From: Andrea Bianco Date: Wed, 3 Mar 2021 10:04:02 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.20 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=e44558116b988c1e20f8e8049e9bbb9fe628135a;p=motion2.git Built motion from commit (unavailable).|2.5.20 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1ef7aae..37d4e8f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-03T09:23:15.225Z", + "time": "2021-03-03T09:55:41.350Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 89328ae..434b39d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-03T09:23:15.225Z", + "time": "2021-03-03T09:55:41.350Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index c412e6e..2683657 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 _0xdd21=['motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdd21,0xd5));var _0x1dd2=function(_0x35157c,_0x11e57c){_0x35157c=_0x35157c-0x0;var _0x310d53=_0xdd21[_0x35157c];return _0x310d53;};'use strict';var Sequelize=require(_0x1dd2('0x0'));module[_0x1dd2('0x1')]={'name':{'type':Sequelize[_0x1dd2('0x2')],'get':function(_0x59eab4){return this[_0x1dd2('0x3')](_0x1dd2('0x4'));}},'action':{'type':Sequelize[_0x1dd2('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1dd2('0x6'),_0x1dd2('0x7'),_0x1dd2('0x8'),_0x1dd2('0x9'),_0x1dd2('0xa'),'browser',_0x1dd2('0xb'),_0x1dd2('0xc')]],'msg':_0x1dd2('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x1dd2('0x5')](0x1000),'comment':_0x1dd2('0xe')},'data2':{'type':Sequelize[_0x1dd2('0x5')](0x1000),'comment':_0x1dd2('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x1dd2('0x5')]},'data7':{'type':Sequelize[_0x1dd2('0x10')]}}; \ No newline at end of file +var _0x1375=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','integration','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x5e4cd3,_0x2d42fe){var _0x1fe0ed=function(_0x575af4){while(--_0x575af4){_0x5e4cd3['push'](_0x5e4cd3['shift']());}};_0x1fe0ed(++_0x2d42fe);}(_0x1375,0x16f));var _0x5137=function(_0x42fa7b,_0x3bd62d){_0x42fa7b=_0x42fa7b-0x0;var _0xe5725f=_0x1375[_0x42fa7b];return _0xe5725f;};'use strict';var Sequelize=require(_0x5137('0x0'));module[_0x5137('0x1')]={'name':{'type':Sequelize[_0x5137('0x2')],'get':function(_0x489dff){return this[_0x5137('0x3')]('action');}},'action':{'type':Sequelize[_0x5137('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x5137('0x5'),'motionbar',_0x5137('0x6'),_0x5137('0x7'),_0x5137('0x8'),_0x5137('0x9'),'script']],'msg':_0x5137('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x5137('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x5137('0x4')](0x1000),'comment':_0x5137('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x5137('0xc')},'data4':{'type':Sequelize[_0x5137('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x5137('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 0a1f342..2b0a47c 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 _0xa6bb=['sox','lodash','squel','crypto','to-csv','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','json','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x79d0bd,_0x15414c){var _0x3b04f1=function(_0x454be4){while(--_0x454be4){_0x79d0bd['push'](_0x79d0bd['shift']());}};_0x3b04f1(++_0x15414c);}(_0xa6bb,0x12c));var _0xba6b=function(_0xfcbb11,_0x54f801){_0xfcbb11=_0xfcbb11-0x0;var _0x17b85a=_0xa6bb[_0xfcbb11];return _0x17b85a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba6b('0x0'));var rimraf=require(_0xba6b('0x1'));var zipdir=require(_0xba6b('0x2'));var jsonpatch=require(_0xba6b('0x3'));var rp=require(_0xba6b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xba6b('0x5'));var util=require(_0xba6b('0x6'));var path=require(_0xba6b('0x7'));var sox=require(_0xba6b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xba6b('0x9'));var squel=require(_0xba6b('0xa'));var crypto=require(_0xba6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba6b('0xc'));var querystring=require(_0xba6b('0xd'));var Papa=require(_0xba6b('0xe'));var Redis=require(_0xba6b('0xf'));var authService=require(_0xba6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xba6b('0x11'));var hardwareService=require(_0xba6b('0x12'));var logger=require(_0xba6b('0x13'))('api');var utils=require(_0xba6b('0x14'));var config=require(_0xba6b('0x15'));var licenseUtil=require(_0xba6b('0x16'));var db=require(_0xba6b('0x17'))['db'];function respondWithStatusCode(_0x55b6ab,_0x1e8473){_0x1e8473=_0x1e8473||0xcc;return function(_0x5b1d28){if(_0x5b1d28){return _0x55b6ab[_0xba6b('0x18')](_0x1e8473);}return _0x55b6ab[_0xba6b('0x19')](_0x1e8473)[_0xba6b('0x1a')]();};}function respondWithResult(_0x15d4e2,_0x32144e){_0x32144e=_0x32144e||0xc8;return function(_0x53ec00){if(_0x53ec00){return _0x15d4e2[_0xba6b('0x19')](_0x32144e)[_0xba6b('0x1b')](_0x53ec00);}};}function respondWithFilteredResult(_0x50b58a,_0x16c3d0){return function(_0x1d280e){if(_0x1d280e){var _0x52b2ff=_0x1d280e['count'],_0x58b4a2=_0x16c3d0['offset'],_0x208210=_0x16c3d0['offset']+_0x16c3d0['limit'],_0x5b32cd;if(_0x208210>=_0x52b2ff){_0x208210=_0x52b2ff;_0x5b32cd=0xc8;}else{_0x5b32cd=0xce;}_0x50b58a[_0xba6b('0x19')](_0x5b32cd);return _0x50b58a[_0xba6b('0x1c')](_0xba6b('0x1d'),_0x58b4a2+'-'+_0x208210+'/'+_0x52b2ff)[_0xba6b('0x1b')](_0x1d280e);}return null;};}function patchUpdates(_0x300399){return function(_0x15d1d2){try{jsonpatch[_0xba6b('0x1e')](_0x15d1d2,_0x300399,!![]);}catch(_0x5697f8){return BPromise[_0xba6b('0x1f')](_0x5697f8);}return _0x15d1d2['save']();};}function saveUpdates(_0x54a392,_0x13beca){return function(_0x120157){if(_0x120157){return _0x120157[_0xba6b('0x20')](_0x54a392)[_0xba6b('0x21')](function(_0x47b615){return _0x47b615;});}return null;};}function removeEntity(_0xa632cb,_0x436623){return function(_0x548c1b){if(_0x548c1b){return _0x548c1b[_0xba6b('0x22')]()[_0xba6b('0x21')](function(){_0xa632cb[_0xba6b('0x19')](0xcc)[_0xba6b('0x1a')]();});}};}function handleEntityNotFound(_0x426641,_0x5c2845){return function(_0x5799b7){if(!_0x5799b7){_0x426641['sendStatus'](0x194);}return _0x5799b7;};}function handleError(_0x5d9163,_0x211434){_0x211434=_0x211434||0x1f4;return function(_0x2525f8){logger[_0xba6b('0x23')](_0x2525f8[_0xba6b('0x24')]);if(_0x2525f8[_0xba6b('0x25')]){delete _0x2525f8[_0xba6b('0x25')];}_0x5d9163['status'](_0x211434)[_0xba6b('0x26')](_0x2525f8);};}exports[_0xba6b('0x20')]=function(_0x11785e,_0x4d7db9){if(_0x11785e[_0xba6b('0x27')]['id']){delete _0x11785e[_0xba6b('0x27')]['id'];}return db['Action'][_0xba6b('0x28')]({'where':{'id':_0x11785e[_0xba6b('0x29')]['id']}})[_0xba6b('0x21')](handleEntityNotFound(_0x4d7db9,null))[_0xba6b('0x21')](saveUpdates(_0x11785e[_0xba6b('0x27')],null))['then'](respondWithResult(_0x4d7db9,null))[_0xba6b('0x2a')](handleError(_0x4d7db9,null));};exports['destroy']=function(_0x2d7908,_0x5286a9){return db[_0xba6b('0x2b')]['find']({'where':{'id':_0x2d7908[_0xba6b('0x29')]['id']}})['then'](handleEntityNotFound(_0x5286a9,null))[_0xba6b('0x21')](removeEntity(_0x5286a9,null))[_0xba6b('0x2a')](handleError(_0x5286a9,null));}; \ No newline at end of file +var _0xdc97=['../../config/utils','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','body','Action','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xe2e67f,_0x3f67c3){var _0x3bbcf8=function(_0x17ab60){while(--_0x17ab60){_0xe2e67f['push'](_0xe2e67f['shift']());}};_0x3bbcf8(++_0x3f67c3);}(_0xdc97,0x13b));var _0x7dc9=function(_0x57eb2a,_0x3c1bc8){_0x57eb2a=_0x57eb2a-0x0;var _0x1c3698=_0xdc97[_0x57eb2a];return _0x1c3698;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');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('0x9'));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=_0x1b0aa1[_0x7dc9('0x18')],_0x11606f=_0x278191[_0x7dc9('0x19')],_0xbe0437=_0x278191['offset']+_0x278191[_0x7dc9('0x1a')],_0x45698c;if(_0xbe0437>=_0x442819){_0xbe0437=_0x442819;_0x45698c=0xc8;}else{_0x45698c=0xce;}_0x3a54f2['status'](_0x45698c);return _0x3a54f2[_0x7dc9('0x1b')](_0x7dc9('0x1c'),_0x11606f+'-'+_0xbe0437+'/'+_0x442819)['json'](_0x1b0aa1);}return null;};}function patchUpdates(_0x41f66e){return function(_0x3b738a){try{jsonpatch[_0x7dc9('0x1d')](_0x3b738a,_0x41f66e,!![]);}catch(_0x4b2703){return BPromise[_0x7dc9('0x1e')](_0x4b2703);}return _0x3b738a[_0x7dc9('0x1f')]();};}function saveUpdates(_0x2dad65,_0x2895f5){return function(_0x155cc4){if(_0x155cc4){return _0x155cc4[_0x7dc9('0x20')](_0x2dad65)['then'](function(_0x593e60){return _0x593e60;});}return null;};}function removeEntity(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x21')]()[_0x7dc9('0x22')](function(){_0x12954f['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x43d31f,_0x41110a){return function(_0x4906b1){if(!_0x4906b1){_0x43d31f[_0x7dc9('0x23')](0x194);}return _0x4906b1;};}function handleError(_0x1e3a8d,_0xf95336){_0xf95336=_0xf95336||0x1f4;return function(_0x55a482){logger['error'](_0x55a482['stack']);if(_0x55a482[_0x7dc9('0x24')]){delete _0x55a482[_0x7dc9('0x24')];}_0x1e3a8d['status'](_0xf95336)['send'](_0x55a482);};}exports[_0x7dc9('0x20')]=function(_0x5afb7d,_0x2d22eb){if(_0x5afb7d[_0x7dc9('0x25')]['id']){delete _0x5afb7d[_0x7dc9('0x25')]['id'];}return db[_0x7dc9('0x26')][_0x7dc9('0x27')]({'where':{'id':_0x5afb7d[_0x7dc9('0x28')]['id']}})[_0x7dc9('0x22')](handleEntityNotFound(_0x2d22eb,null))[_0x7dc9('0x22')](saveUpdates(_0x5afb7d[_0x7dc9('0x25')],null))[_0x7dc9('0x22')](respondWithResult(_0x2d22eb,null))[_0x7dc9('0x29')](handleError(_0x2d22eb,null));};exports[_0x7dc9('0x21')]=function(_0x4bb716,_0x4e929c){return db['Action']['find']({'where':{'id':_0x4bb716['params']['id']}})['then'](handleEntityNotFound(_0x4e929c,null))['then'](removeEntity(_0x4e929c,null))['catch'](handleError(_0x4e929c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a21dff9..f85076f 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 _0x34c5=['define','Action','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x4c8d4f,_0x2ad9cc){var _0x2fbdfb=function(_0x54e4e2){while(--_0x54e4e2){_0x4c8d4f['push'](_0x4c8d4f['shift']());}};_0x2fbdfb(++_0x2ad9cc);}(_0x34c5,0x1b0));var _0x534c=function(_0x1183d0,_0xdd3587){_0x1183d0=_0x1183d0-0x0;var _0x12c406=_0x34c5[_0x1183d0];return _0x12c406;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x534c('0x0'))('api');var moment=require(_0x534c('0x1'));var BPromise=require(_0x534c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x534c('0x3'));var rimraf=require(_0x534c('0x4'));var config=require(_0x534c('0x5'));var attributes=require(_0x534c('0x6'));module[_0x534c('0x7')]=function(_0xf62298,_0x37e60c){return _0xf62298[_0x534c('0x8')](_0x534c('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc706=['define','Action','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./action.attributes','exports'];(function(_0x402ceb,_0x16b5cd){var _0x49f88b=function(_0x4bf66d){while(--_0x4bf66d){_0x402ceb['push'](_0x402ceb['shift']());}};_0x49f88b(++_0x16b5cd);}(_0xc706,0x1be));var _0x6c70=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0xc706[_0x4e7c1c];return _0x47adb2;};'use strict';var _=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var logger=require(_0x6c70('0x2'))(_0x6c70('0x3'));var moment=require(_0x6c70('0x4'));var BPromise=require(_0x6c70('0x5'));var rp=require(_0x6c70('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c70('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c70('0x8'));module[_0x6c70('0x9')]=function(_0x18fd65,_0x44b41e){return _0x18fd65[_0x6c70('0xa')](_0x6c70('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 83bcd51..1f0a859 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x419115,_0x50221d){var _0x359bdc=function(_0x5a27b0){while(--_0x5a27b0){_0x419115['push'](_0x419115['shift']());}};_0x359bdc(++_0x50221d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x5c8788,_0x4f15bd){var _0x111412=function(_0x3a1017){while(--_0x3a1017){_0x5c8788['push'](_0x5c8788['shift']());}};_0x111412(++_0x4f15bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xcb91[_0x4c7935];return _0x30651d;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index a148987..dd439a3 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 _0x3c9a=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update','delete','destroy'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x3c9a,0x10b));var _0xa3c9=function(_0x5f41ac,_0x679866){_0x5f41ac=_0x5f41ac-0x0;var _0x762c98=_0x3c9a[_0x5f41ac];return _0x762c98;};'use strict';var multer=require(_0xa3c9('0x0'));var util=require(_0xa3c9('0x1'));var path=require(_0xa3c9('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3c9('0x3'));var router=express[_0xa3c9('0x4')]();var auth=require(_0xa3c9('0x5'));var interaction=require(_0xa3c9('0x6'));var config=require('../../config/environment');var controller=require(_0xa3c9('0x7'));router['put'](_0xa3c9('0x8'),auth[_0xa3c9('0x9')](),controller[_0xa3c9('0xa')]);router[_0xa3c9('0xb')](_0xa3c9('0x8'),auth['isAuthenticated'](),controller[_0xa3c9('0xc')]);module[_0xa3c9('0xd')]=router; \ No newline at end of file +var _0xc360=['isAuthenticated','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','/:id'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0xc360,0x1b6));var _0x0c36=function(_0x4a8563,_0x519be5){_0x4a8563=_0x4a8563-0x0;var _0x1e66cb=_0xc360[_0x4a8563];return _0x1e66cb;};'use strict';var multer=require(_0x0c36('0x0'));var util=require(_0x0c36('0x1'));var path=require('path');var timeout=require(_0x0c36('0x2'));var express=require(_0x0c36('0x3'));var router=express['Router']();var auth=require(_0x0c36('0x4'));var interaction=require(_0x0c36('0x5'));var config=require(_0x0c36('0x6'));var controller=require(_0x0c36('0x7'));router[_0x0c36('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0c36('0x9')]);router[_0x0c36('0xa')](_0x0c36('0xb'),auth[_0x0c36('0xc')](),controller[_0x0c36('0xd')]);module[_0x0c36('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 8df3ca5..aa6d7db 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 _0xd01f=['TEXT','sequelize','STRING'];(function(_0x4a6e72,_0x6b2575){var _0x1bbaea=function(_0x309630){while(--_0x309630){_0x4a6e72['push'](_0x4a6e72['shift']());}};_0x1bbaea(++_0x6b2575);}(_0xd01f,0x100));var _0xfd01=function(_0x5f511f,_0x57a484){_0x5f511f=_0x5f511f-0x0;var _0x30aa77=_0xd01f[_0x5f511f];return _0x30aa77;};'use strict';var Sequelize=require(_0xfd01('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd01('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfd01('0x1')]},'parent':{'type':Sequelize[_0xfd01('0x1')]},'table':{'type':Sequelize[_0xfd01('0x1')]},'conditions':{'type':Sequelize[_0xfd01('0x2')]},'joins':{'type':Sequelize[_0xfd01('0x2')]}}; \ No newline at end of file +var _0xcc6e=['STRING','TEXT','sequelize','exports'];(function(_0x4fb004,_0x410c3b){var _0x4e94aa=function(_0xd62021){while(--_0xd62021){_0x4fb004['push'](_0x4fb004['shift']());}};_0x4e94aa(++_0x410c3b);}(_0xcc6e,0xbe));var _0xecc6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc6e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xecc6('0x0'));module[_0xecc6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xecc6('0x2')]},'parent':{'type':Sequelize[_0xecc6('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xecc6('0x3')]},'joins':{'type':Sequelize[_0xecc6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 25d845b..2b9b1dd 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 _0xb4d9=['alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','COUNT(%s)','AVG(%s)','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','getFields','Please\x20insert\x20at\x20least\x20one\x20field','DESC','web','%s-%s.%s','randomstring','generate','output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','toString','../../files/reports','countTable','COUNT(*)','run','GROUP_CONCAT(%s)','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','error','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','options','where','includeAll','findAll','catch','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy'];(function(_0x21dea2,_0x12388e){var _0x30800b=function(_0x4cbb1d){while(--_0x4cbb1d){_0x21dea2['push'](_0x21dea2['shift']());}};_0x30800b(++_0x12388e);}(_0xb4d9,0xce));var _0x9b4d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb4d9[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0x9b4d('0x0'));var emlformat=require(_0x9b4d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9b4d('0x2'));var jsonpatch=require(_0x9b4d('0x3'));var rp=require(_0x9b4d('0x4'));var moment=require('moment');var BPromise=require(_0x9b4d('0x5'));var Mustache=require(_0x9b4d('0x6'));var util=require(_0x9b4d('0x7'));var path=require(_0x9b4d('0x8'));var sox=require(_0x9b4d('0x9'));var csv=require(_0x9b4d('0xa'));var ejs=require(_0x9b4d('0xb'));var fs=require('fs');var _=require(_0x9b4d('0xc'));var squel=require(_0x9b4d('0xd'));var crypto=require(_0x9b4d('0xe'));var jsforce=require(_0x9b4d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9b4d('0xa'));var querystring=require('querystring');var Papa=require(_0x9b4d('0x10'));var Redis=require('ioredis');var authService=require(_0x9b4d('0x11'));var qs=require(_0x9b4d('0x12'));var as=require(_0x9b4d('0x13'));var hardwareService=require(_0x9b4d('0x14'));var logger=require(_0x9b4d('0x15'))(_0x9b4d('0x16'));var utils=require(_0x9b4d('0x17'));var config=require(_0x9b4d('0x18'));var licenseUtil=require(_0x9b4d('0x19'));var db=require(_0x9b4d('0x1a'))['db'];var dbH=require(_0x9b4d('0x1a'))[_0x9b4d('0x1b')];function respondWithStatusCode(_0x4881c4,_0x4238ff){_0x4238ff=_0x4238ff||0xcc;return function(_0x30d2b1){if(_0x30d2b1){return _0x4881c4[_0x9b4d('0x1c')](_0x4238ff);}return _0x4881c4[_0x9b4d('0x1d')](_0x4238ff)['end']();};}function respondWithResult(_0x1dc9ee,_0x599681){_0x599681=_0x599681||0xc8;return function(_0x5d857b){if(_0x5d857b){return _0x1dc9ee[_0x9b4d('0x1d')](_0x599681)[_0x9b4d('0x1e')](_0x5d857b);}};}function respondWithFilteredResult(_0x2660f2,_0x1f9fb7){return function(_0x93a6b9){if(_0x93a6b9){var _0xd98b47=_0x93a6b9[_0x9b4d('0x1f')],_0x5d23f3=_0x1f9fb7[_0x9b4d('0x20')],_0x58bfc5=_0x1f9fb7[_0x9b4d('0x20')]+_0x1f9fb7[_0x9b4d('0x21')],_0x66ddb9;if(_0x58bfc5>=_0xd98b47){_0x58bfc5=_0xd98b47;_0x66ddb9=0xc8;}else{_0x66ddb9=0xce;}_0x2660f2[_0x9b4d('0x1d')](_0x66ddb9);return _0x2660f2[_0x9b4d('0x22')](_0x9b4d('0x23'),_0x5d23f3+'-'+_0x58bfc5+'/'+_0xd98b47)[_0x9b4d('0x1e')](_0x93a6b9);}return null;};}function patchUpdates(_0x67a82){return function(_0x2d2561){try{jsonpatch[_0x9b4d('0x24')](_0x2d2561,_0x67a82,!![]);}catch(_0x2fcf7f){return BPromise[_0x9b4d('0x25')](_0x2fcf7f);}return _0x2d2561[_0x9b4d('0x26')]();};}function saveUpdates(_0x26285b,_0x2c5d05){return function(_0x2a9d1a){if(_0x2a9d1a){return _0x2a9d1a[_0x9b4d('0x27')](_0x26285b)[_0x9b4d('0x28')](function(_0x5ea613){return _0x5ea613;});}return null;};}function removeEntity(_0x3a698f,_0x398b4c){return function(_0xd837db){if(_0xd837db){return _0xd837db['destroy']()[_0x9b4d('0x28')](function(){var _0x5daeda=_0xd837db['get']({'plain':!![]});var _0x348c3f='CustomReports';return db[_0x9b4d('0x29')][_0x9b4d('0x2a')]({'where':{'type':_0x348c3f,'resourceId':_0x5daeda['id']}})['then'](function(){return _0xd837db;});})[_0x9b4d('0x28')](function(){_0x3a698f[_0x9b4d('0x1d')](0xcc)[_0x9b4d('0x2b')]();});}};}function handleEntityNotFound(_0x495a31,_0x504b87){return function(_0x465013){if(!_0x465013){_0x495a31[_0x9b4d('0x1c')](0x194);}return _0x465013;};}function handleError(_0x5e6f5b,_0xb13b6d){_0xb13b6d=_0xb13b6d||0x1f4;return function(_0x5d639b){logger[_0x9b4d('0x2c')](_0x5d639b['stack']);if(_0x5d639b[_0x9b4d('0x2d')]){delete _0x5d639b['name'];}_0x5e6f5b[_0x9b4d('0x1d')](_0xb13b6d)[_0x9b4d('0x2e')](_0x5d639b);};}exports['index']=function(_0x34ca4d,_0x4a6ad8){var _0x5637e1={},_0x12648d={},_0x320eb={'count':0x0,'rows':[]};var _0x4f9382=_['map'](db[_0x9b4d('0x2f')][_0x9b4d('0x30')],function(_0x1da4ab){return{'name':_0x1da4ab[_0x9b4d('0x31')],'type':_0x1da4ab[_0x9b4d('0x32')][_0x9b4d('0x33')]};});_0x12648d[_0x9b4d('0x34')]=_[_0x9b4d('0x35')](_0x4f9382,_0x9b4d('0x2d'));_0x12648d[_0x9b4d('0x36')]=_[_0x9b4d('0x37')](_0x34ca4d[_0x9b4d('0x36')]);_0x12648d[_0x9b4d('0x38')]=_[_0x9b4d('0x39')](_0x12648d[_0x9b4d('0x34')],_0x12648d['query']);_0x5637e1[_0x9b4d('0x3a')]=_['intersection'](_0x12648d[_0x9b4d('0x34')],qs[_0x9b4d('0x3b')](_0x34ca4d[_0x9b4d('0x36')][_0x9b4d('0x3b')]));_0x5637e1[_0x9b4d('0x3a')]=_0x5637e1[_0x9b4d('0x3a')][_0x9b4d('0x3c')]?_0x5637e1['attributes']:_0x12648d[_0x9b4d('0x34')];if(!_0x34ca4d[_0x9b4d('0x36')][_0x9b4d('0x3d')]('nolimit')){_0x5637e1['limit']=qs[_0x9b4d('0x21')](_0x34ca4d['query']['limit']);_0x5637e1[_0x9b4d('0x20')]=qs[_0x9b4d('0x20')](_0x34ca4d[_0x9b4d('0x36')][_0x9b4d('0x20')]);}_0x5637e1[_0x9b4d('0x3e')]=qs['sort'](_0x34ca4d[_0x9b4d('0x36')][_0x9b4d('0x3f')]);_0x5637e1['where']=qs[_0x9b4d('0x38')](_[_0x9b4d('0x40')](_0x34ca4d[_0x9b4d('0x36')],_0x12648d[_0x9b4d('0x38')]),_0x4f9382);if(_0x34ca4d[_0x9b4d('0x36')]['filter']){_0x5637e1['where']=_[_0x9b4d('0x41')](_0x5637e1['where'],{'$or':_[_0x9b4d('0x35')](_0x4f9382,function(_0x1f310d){if(_0x1f310d['type']!==_0x9b4d('0x42')){var _0x55ea8f={};_0x55ea8f[_0x1f310d['name']]={'$like':'%'+_0x34ca4d[_0x9b4d('0x36')]['filter']+'%'};return _0x55ea8f;}})});}_0x5637e1=_[_0x9b4d('0x41')]({},_0x5637e1,_0x34ca4d[_0x9b4d('0x43')]);var _0x5d9d65={'where':_0x5637e1[_0x9b4d('0x44')]};return db[_0x9b4d('0x2f')][_0x9b4d('0x1f')](_0x5d9d65)['then'](function(_0x811977){_0x320eb['count']=_0x811977;if(_0x34ca4d[_0x9b4d('0x36')][_0x9b4d('0x45')]){_0x5637e1['include']=[{'all':!![]}];}return db[_0x9b4d('0x2f')][_0x9b4d('0x46')](_0x5637e1);})[_0x9b4d('0x28')](function(_0x39f4bf){_0x320eb['rows']=_0x39f4bf;return _0x320eb;})['then'](respondWithFilteredResult(_0x4a6ad8,_0x5637e1))[_0x9b4d('0x47')](handleError(_0x4a6ad8,null));};exports['show']=function(_0x49bae8,_0x5da42a){var _0x2201ad={'raw':![],'where':{'id':_0x49bae8['params']['id']}},_0x39ae35={};_0x39ae35[_0x9b4d('0x34')]=_[_0x9b4d('0x37')](db[_0x9b4d('0x2f')]['rawAttributes']);_0x39ae35[_0x9b4d('0x36')]=_[_0x9b4d('0x37')](_0x49bae8['query']);_0x39ae35[_0x9b4d('0x38')]=_[_0x9b4d('0x39')](_0x39ae35['model'],_0x39ae35[_0x9b4d('0x36')]);_0x2201ad[_0x9b4d('0x3a')]=_['intersection'](_0x39ae35[_0x9b4d('0x34')],qs[_0x9b4d('0x3b')](_0x49bae8['query'][_0x9b4d('0x3b')]));_0x2201ad[_0x9b4d('0x3a')]=_0x2201ad[_0x9b4d('0x3a')][_0x9b4d('0x3c')]?_0x2201ad['attributes']:_0x39ae35[_0x9b4d('0x34')];if(_0x49bae8[_0x9b4d('0x36')][_0x9b4d('0x45')]){_0x2201ad[_0x9b4d('0x48')]=[{'all':!![]}];}_0x2201ad=_[_0x9b4d('0x41')]({},_0x2201ad,_0x49bae8[_0x9b4d('0x43')]);return db[_0x9b4d('0x2f')][_0x9b4d('0x49')](_0x2201ad)['then'](handleEntityNotFound(_0x5da42a,null))['then'](respondWithResult(_0x5da42a,null))['catch'](handleError(_0x5da42a,null));};exports[_0x9b4d('0x4a')]=function(_0x51089b,_0x252c58){return db[_0x9b4d('0x2f')][_0x9b4d('0x4a')](_0x51089b[_0x9b4d('0x4b')],{})['then'](function(_0x1d5051){var _0x52db9a=_0x51089b['user'][_0x9b4d('0x4c')]({'plain':!![]});if(!_0x52db9a)throw new Error(_0x9b4d('0x4d'));if(_0x52db9a[_0x9b4d('0x4e')]===_0x9b4d('0x4f')){var _0x351808=_0x1d5051[_0x9b4d('0x4c')]({'plain':!![]});var _0x16e6cb='Reports';return db['UserProfileSection'][_0x9b4d('0x49')]({'where':{'name':_0x16e6cb,'userProfileId':_0x52db9a[_0x9b4d('0x50')]},'raw':!![]})[_0x9b4d('0x28')](function(_0x10a5b2){if(_0x10a5b2&&_0x10a5b2[_0x9b4d('0x51')]===0x0){return db[_0x9b4d('0x29')][_0x9b4d('0x4a')]({'name':_0x351808[_0x9b4d('0x2d')],'resourceId':_0x351808['id'],'type':_0x9b4d('0x52'),'sectionId':_0x10a5b2['id']},{})[_0x9b4d('0x28')](function(){return _0x1d5051;});}else{return _0x1d5051;}})[_0x9b4d('0x47')](function(_0x3452d3){logger[_0x9b4d('0x2c')](_0x9b4d('0x53'),_0x3452d3);throw _0x3452d3;});}return _0x1d5051;})['then'](respondWithResult(_0x252c58,0xc9))[_0x9b4d('0x47')](handleError(_0x252c58,null));};exports[_0x9b4d('0x27')]=function(_0x26a2a2,_0x155bf2){if(_0x26a2a2[_0x9b4d('0x4b')]['id']){delete _0x26a2a2[_0x9b4d('0x4b')]['id'];}return db['AnalyticCustomReport'][_0x9b4d('0x49')]({'where':{'id':_0x26a2a2[_0x9b4d('0x54')]['id']}})[_0x9b4d('0x28')](handleEntityNotFound(_0x155bf2,null))[_0x9b4d('0x28')](saveUpdates(_0x26a2a2[_0x9b4d('0x4b')],null))[_0x9b4d('0x28')](respondWithResult(_0x155bf2,null))[_0x9b4d('0x47')](handleError(_0x155bf2,null));};exports[_0x9b4d('0x2a')]=function(_0x20df59,_0x31ddda){return db[_0x9b4d('0x2f')][_0x9b4d('0x49')]({'where':{'id':_0x20df59[_0x9b4d('0x54')]['id']}})[_0x9b4d('0x28')](handleEntityNotFound(_0x31ddda,null))[_0x9b4d('0x28')](removeEntity(_0x31ddda,null))[_0x9b4d('0x47')](handleError(_0x31ddda,null));};exports['preview']=function(_0x5ab7b1,_0x5bc2a5){var _0x3c1a55=0xa;var _0x5d3d49=[_0x9b4d('0x55'),_0x9b4d('0x56'),_0x9b4d('0x57'),_0x9b4d('0x58')];var _0x30a293={'SUM':_0x9b4d('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9b4d('0x5a'),'MAX':_0x9b4d('0x5b'),'MIN':_0x9b4d('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9b4d('0x5d'),'GROUP_CONCAT DESC':_0x9b4d('0x5e')};var _0x26c44a={'SEC_TO_TIME':_0x9b4d('0x5f'),'DATE':_0x9b4d('0x60'),'HOUR':_0x9b4d('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9b4d('0x62')};var _0x47fe7c=function(_0x128536){return!_[_0x9b4d('0x63')]([_0x9b4d('0x64'),_0x9b4d('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x128536);};var _0x2b8b3a=function(_0x1d75f7){if(!_0x1d75f7||!_0x1d75f7[_0x9b4d('0x66')][_0x9b4d('0x3c')]){return'';}for(var _0x25434f='(',_0x4fcddb=0x0;_0x4fcddb<_0x1d75f7['rules'][_0x9b4d('0x3c')];_0x4fcddb+=0x1){_0x4fcddb>0x0&&(_0x25434f+='\x20'+_0x1d75f7[_0x9b4d('0x67')]+'\x20');_0x25434f+=_0x1d75f7['rules'][_0x4fcddb][_0x9b4d('0x68')]?_0x2b8b3a(_0x1d75f7[_0x9b4d('0x66')][_0x4fcddb][_0x9b4d('0x68')]):_0x1d75f7[_0x9b4d('0x66')][_0x4fcddb][_0x9b4d('0x69')]+'\x20'+_0x1d75f7[_0x9b4d('0x66')][_0x4fcddb]['condition']+(_0x47fe7c(_0x1d75f7[_0x9b4d('0x66')][_0x4fcddb][_0x9b4d('0x6a')])?'\x20'+_0x1d75f7['rules'][_0x4fcddb][_0x9b4d('0x6b')]:'');}return _0x25434f+')';};var _0x2b22bd={'where':{'id':_0x5ab7b1[_0x9b4d('0x54')]['id']}},_0x470bc7,_0xc60c68,_0x4ffa4d,_0x40e3b4,_0x19bc55;_0x2b22bd=_[_0x9b4d('0x41')]({},_0x2b22bd,_0x5ab7b1[_0x9b4d('0x43')]);return db[_0x9b4d('0x2f')]['find'](_0x2b22bd)[_0x9b4d('0x28')](function(_0x4a38b2){if(_0x4a38b2){_0x470bc7=_0x4a38b2;return _0x4a38b2['getFields']();}return null;})[_0x9b4d('0x28')](function(_0x385ee3){if(_0x385ee3){if(!_0x385ee3['length']){throw new db[(_0x9b4d('0x6c'))][(_0x9b4d('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xc60c68=_0x385ee3;return db[_0x9b4d('0x6e')][_0x9b4d('0x46')]({'raw':!![]});}return null;})[_0x9b4d('0x28')](function(_0x5f19f4){if(_0x5f19f4){_0x4ffa4d=_[_0x9b4d('0x6f')](_0x5f19f4,'id');var _0xe3789d;var _0x147f73=squel[_0x9b4d('0x70')]();_0x147f73[_0x9b4d('0x71')](_0x470bc7[_0x9b4d('0x72')]);for(var _0x44061c=0x0;_0x44061c<_0xc60c68[_0x9b4d('0x3c')];_0x44061c+=0x1){_0xe3789d=_0xc60c68[_0x44061c][_0x9b4d('0x73')]?_0x4ffa4d[_0xc60c68[_0x44061c]['MetricId']][_0x9b4d('0x74')]:_0xc60c68[_0x44061c]['field'];_0xe3789d=_0xc60c68[_0x44061c]['function']?_['replace'](_0x30a293[_0xc60c68[_0x44061c][_0x9b4d('0x75')]],'%s',_0xe3789d):_0xe3789d;_0xe3789d=_0xc60c68[_0x44061c]['format']?_[_0x9b4d('0x76')](_0x26c44a[_0xc60c68[_0x44061c][_0x9b4d('0x77')]],'%s',_0xe3789d):_0xe3789d;if(_0xc60c68[_0x44061c][_0x9b4d('0x78')]){_0x147f73['group'](_0xe3789d);}_0xc60c68[_0x44061c][_0x9b4d('0x79')]&&_0x147f73[_0x9b4d('0x3e')](_0xe3789d,_0xc60c68[_0x44061c][_0x9b4d('0x79')]==='DESC'?![]:!![]);_0x147f73['field'](_0xe3789d,_0xc60c68[_0x44061c][_0x9b4d('0x7a')]||_0xe3789d);}if(_0x470bc7[_0x9b4d('0x7b')]){_0x470bc7[_0x9b4d('0x7b')]=JSON['parse'](_0x470bc7['joins']);for(var _0x13ac8c=0x0;_0x13ac8c<_0x470bc7[_0x9b4d('0x7b')][_0x9b4d('0x3c')];_0x13ac8c+=0x1){if(_0x470bc7['joins'][_0x13ac8c][_0x9b4d('0x32')]&&_[_0x9b4d('0x63')](_0x5d3d49,_0x470bc7[_0x9b4d('0x7b')][_0x13ac8c][_0x9b4d('0x32')])&&_0x470bc7['joins'][_0x13ac8c][_0x9b4d('0x7c')]&&_0x470bc7['joins'][_0x13ac8c][_0x9b4d('0x7d')]&&_0x470bc7[_0x9b4d('0x7b')][_0x13ac8c][_0x9b4d('0x7e')]){_0x147f73[_0x470bc7['joins'][_0x13ac8c][_0x9b4d('0x32')]](_0x470bc7[_0x9b4d('0x7b')][_0x13ac8c][_0x9b4d('0x7d')],null,util[_0x9b4d('0x77')](_0x9b4d('0x7f'),_0x470bc7[_0x9b4d('0x72')],_0x470bc7[_0x9b4d('0x7b')][_0x13ac8c][_0x9b4d('0x7c')],_0x470bc7[_0x9b4d('0x7b')][_0x13ac8c][_0x9b4d('0x7d')],_0x470bc7[_0x9b4d('0x7b')][_0x13ac8c][_0x9b4d('0x7e')]));}}}if(_0x470bc7[_0x9b4d('0x80')]){_0x470bc7['conditions']=JSON[_0x9b4d('0x81')](_0x470bc7[_0x9b4d('0x80')]);_0x147f73[_0x9b4d('0x44')](_0x2b8b3a(_0x470bc7[_0x9b4d('0x80')]['group']));}_0x19bc55=_0x147f73[_0x9b4d('0x82')]();_0x147f73[_0x9b4d('0x21')](_0x3c1a55);_0x147f73['offset'](0x0);logger[_0x9b4d('0x83')](_0x9b4d('0x84'),_0x147f73['toString']());return dbH[_0x9b4d('0x85')][_0x9b4d('0x36')](_0x147f73['toString'](),{'type':dbH[_0x9b4d('0x85')][_0x9b4d('0x86')][_0x9b4d('0x87')]});}})[_0x9b4d('0x28')](respondWithResult(_0x5bc2a5,null))[_0x9b4d('0x47')](handleError(_0x5bc2a5,null));};function runReport(_0x58e75b,_0xdb9fa,_0x3f8847){var _0x36f6d5=_0xdb9fa['name'];var _0x4bf400=0xa;var _0x20711f=[_0x9b4d('0x55'),_0x9b4d('0x56'),_0x9b4d('0x57'),_0x9b4d('0x58')];var _0x4f4732={'SUM':_0x9b4d('0x59'),'COUNT':_0x9b4d('0x88'),'COUNT DISTINCT':_0x9b4d('0x5a'),'MAX':_0x9b4d('0x5b'),'MIN':_0x9b4d('0x5c'),'AVG':_0x9b4d('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9b4d('0x5d'),'GROUP_CONCAT DESC':_0x9b4d('0x5e')};var _0x54c5f6={'SEC_TO_TIME':_0x9b4d('0x5f'),'DATE':_0x9b4d('0x60'),'HOUR':_0x9b4d('0x61'),'ROUND':_0x9b4d('0x8a'),'UNIX_TIMESTAMP':_0x9b4d('0x62')};var _0x548451=function(_0x324cb5){return!_[_0x9b4d('0x63')]([_0x9b4d('0x64'),'IS\x20NOT\x20NULL',_0x9b4d('0x8b'),_0x9b4d('0x8c')],_0x324cb5);};var _0x55e743=function(_0x3139ec){if(!_0x3139ec||!_0x3139ec[_0x9b4d('0x66')][_0x9b4d('0x3c')]){return'';}for(var _0x53082a='(',_0x444c8e=0x0;_0x444c8e<_0x3139ec[_0x9b4d('0x66')][_0x9b4d('0x3c')];_0x444c8e+=0x1){_0x444c8e>0x0&&(_0x53082a+='\x20'+_0x3139ec['operator']+'\x20');_0x53082a+=_0x3139ec[_0x9b4d('0x66')][_0x444c8e][_0x9b4d('0x68')]?_0x55e743(_0x3139ec[_0x9b4d('0x66')][_0x444c8e][_0x9b4d('0x68')]):_0x3139ec['rules'][_0x444c8e][_0x9b4d('0x69')]+'\x20'+_0x3139ec[_0x9b4d('0x66')][_0x444c8e]['condition']+(_0x548451(_0x3139ec[_0x9b4d('0x66')][_0x444c8e]['condition'])?'\x20'+_0x3139ec[_0x9b4d('0x66')][_0x444c8e][_0x9b4d('0x6b')]:'');}return _0x53082a+')';};var _0x5e9370={'where':{'id':_0x58e75b['id']}},_0xbb99e0,_0x540899,_0x3c0134,_0x123be1,_0x4c5862;_0x5e9370=_['merge']({},_0x5e9370,_0x3f8847);return db['AnalyticCustomReport']['find'](_0x5e9370)[_0x9b4d('0x28')](function(_0x4da8bf){if(_0x4da8bf){_0xbb99e0=_0x4da8bf;return _0x4da8bf[_0x9b4d('0x8d')]();}return null;})[_0x9b4d('0x28')](function(_0x513d5a){if(_0x513d5a){if(!_0x513d5a[_0x9b4d('0x3c')]){throw new db[(_0x9b4d('0x6c'))][(_0x9b4d('0x6d'))](_0x9b4d('0x8e'),0x193);}_0x540899=_0x513d5a;return db[_0x9b4d('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x9b4d('0x28')](function(_0x291808){if(_0x291808){_0x3c0134=_['keyBy'](_0x291808,'id');var _0x518f93;var _0xbd108e=squel[_0x9b4d('0x70')]();_0xbd108e[_0x9b4d('0x71')](_0xbb99e0[_0x9b4d('0x72')]);for(var _0x1c25c4=0x0;_0x1c25c4<_0x540899['length'];_0x1c25c4+=0x1){_0x518f93=_0x540899[_0x1c25c4]['MetricId']?_0x3c0134[_0x540899[_0x1c25c4][_0x9b4d('0x73')]][_0x9b4d('0x74')]:_0x540899[_0x1c25c4][_0x9b4d('0x69')];_0x518f93=_0x540899[_0x1c25c4][_0x9b4d('0x75')]?_[_0x9b4d('0x76')](_0x4f4732[_0x540899[_0x1c25c4][_0x9b4d('0x75')]],'%s',_0x518f93):_0x518f93;_0x518f93=_0x540899[_0x1c25c4][_0x9b4d('0x77')]?_[_0x9b4d('0x76')](_0x54c5f6[_0x540899[_0x1c25c4]['format']],'%s',_0x518f93):_0x518f93;if(_0x540899[_0x1c25c4]['groupBy']){_0xbd108e[_0x9b4d('0x68')](_0x518f93);}_0x540899[_0x1c25c4][_0x9b4d('0x79')]&&_0xbd108e['order'](_0x518f93,_0x540899[_0x1c25c4][_0x9b4d('0x79')]===_0x9b4d('0x8f')?![]:!![]);_0xbd108e[_0x9b4d('0x69')](_0x518f93,_0x540899[_0x1c25c4][_0x9b4d('0x7a')]||_0x518f93);}if(_0xbb99e0[_0x9b4d('0x7b')]){_0xbb99e0[_0x9b4d('0x7b')]=JSON[_0x9b4d('0x81')](_0xbb99e0[_0x9b4d('0x7b')]);for(var _0x2dcbcf=0x0;_0x2dcbcf<_0xbb99e0[_0x9b4d('0x7b')]['length'];_0x2dcbcf+=0x1){if(_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x32')]&&_[_0x9b4d('0x63')](_0x20711f,_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x32')])&&_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x7c')]&&_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf]['foreignTable']&&_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x7e')]){_0xbd108e[_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x32')]](_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf]['foreignTable'],null,util[_0x9b4d('0x77')]('%s.%s\x20=\x20%s.%s',_0xbb99e0['table'],_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x7c')],_0xbb99e0[_0x9b4d('0x7b')][_0x2dcbcf][_0x9b4d('0x7d')],_0xbb99e0['joins'][_0x2dcbcf][_0x9b4d('0x7e')]));}}}if(_0xbb99e0[_0x9b4d('0x80')]){_0xbb99e0[_0x9b4d('0x80')]=JSON[_0x9b4d('0x81')](_0xbb99e0[_0x9b4d('0x80')]);_0xbd108e['where'](_0x55e743(_0xbb99e0[_0x9b4d('0x80')][_0x9b4d('0x68')]));}_0x4c5862=_0xbd108e[_0x9b4d('0x82')]();_0xbd108e['limit'](_0x4bf400);_0xbd108e[_0x9b4d('0x20')](0x0);return;}})[_0x9b4d('0x28')](function(){if(_0xdb9fa['output']===_0x9b4d('0x90')){return null;}var _0x434257=_['merge'](_0xdb9fa,{'name':_0xdb9fa['fullPath']||_0xdb9fa['name']||_0xbb99e0[_0x9b4d('0x2d')],'basename':_0x36f6d5,'savename':util['format'](_0x9b4d('0x91'),_0xdb9fa[_0x9b4d('0x2d')]||_0xbb99e0[_0x9b4d('0x2d')],require(_0x9b4d('0x92'))[_0x9b4d('0x93')](0x4),_0xdb9fa[_0x9b4d('0x94')]||_0x9b4d('0x95')),'reportId':_0xbb99e0['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x9b4d('0x4a')](_0x434257,{'raw':!![]});})['then'](function(_0x254703){if(_0xbb99e0[_0x9b4d('0x72')]===_0x9b4d('0x96')){_0x4c5862[_0x9b4d('0x44')](_0xbb99e0['table']+_0x9b4d('0x97'),_0xdb9fa[_0x9b4d('0x98')],_0xdb9fa[_0x9b4d('0x99')]);}else{_0x4c5862[_0x9b4d('0x44')](_0xbb99e0[_0x9b4d('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xdb9fa['startDate'],_0xdb9fa[_0x9b4d('0x99')]);}if(_0x254703){logger['info'](_0x9b4d('0x9a'),_0x4c5862['toString']());require(_0x9b4d('0x9b'))[_0x9b4d('0x9c')](path[_0x9b4d('0x55')](__dirname,_0x9b4d('0x9d'),_0x254703[_0x9b4d('0x94')]),[_0x254703['id'],_0x4c5862[_0x9b4d('0x9e')](),path[_0x9b4d('0x55')](__dirname,_0x9b4d('0x9f'),_0x254703['savename']),_0x36f6d5]);return _0x254703;}else{var _0x2a25d9=squel[_0x9b4d('0x70')]();_0x2a25d9[_0x9b4d('0x71')]('('+_0x4c5862[_0x9b4d('0x9e')]()+')',_0x9b4d('0xa0'));_0x2a25d9[_0x9b4d('0x69')](_0x9b4d('0xa1'),_0x9b4d('0x1f'));_0x4c5862['limit'](_0xdb9fa[_0x9b4d('0x21')]||_0x4bf400);_0x4c5862[_0x9b4d('0x20')](_0xdb9fa['offset']||0x0);return dbH[_0x9b4d('0x85')][_0x9b4d('0x36')](_0x2a25d9[_0x9b4d('0x9e')](),{'type':dbH[_0x9b4d('0x85')][_0x9b4d('0x86')][_0x9b4d('0x87')]})['then'](function(_0x11806b){if(!_0x11806b[_0x9b4d('0x3c')]){_0x123be1=0x0;}else{_0x123be1=_0x11806b[0x0][_0x9b4d('0x1f')]||0x0;}return dbH[_0x9b4d('0x85')][_0x9b4d('0x36')](_0x4c5862[_0x9b4d('0x9e')](),{'type':dbH[_0x9b4d('0x85')][_0x9b4d('0x86')][_0x9b4d('0x87')]});})[_0x9b4d('0x28')](function(_0xe533ca){return{'rows':_0xe533ca||[],'count':_0x123be1};});}});}exports[_0x9b4d('0xa2')]=function(_0x212f9d,_0xa3bd2d){return runReport(_0x212f9d['params'],_0x212f9d['query'],_0x212f9d['options'])[_0x9b4d('0x28')](respondWithResult(_0xa3bd2d,null))['catch'](handleError(_0xa3bd2d,null));};exports['runReport']=runReport;exports[_0x9b4d('0x36')]=function(_0x5a61a2,_0x561f96){var _0x5e0813=0xa;var _0x3b4c90=['join',_0x9b4d('0x56'),_0x9b4d('0x57'),_0x9b4d('0x58')];var _0x45f502={'SUM':'SUM(%s)','COUNT':_0x9b4d('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9b4d('0x5b'),'MIN':_0x9b4d('0x5c'),'AVG':_0x9b4d('0x89'),'GROUP_CONCAT':_0x9b4d('0xa3'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33edfb={'SEC_TO_TIME':_0x9b4d('0x5f'),'DATE':_0x9b4d('0x60'),'HOUR':_0x9b4d('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9b4d('0x62')};var _0xdcde6a=function(_0xc03916){return!_[_0x9b4d('0x63')](['IS\x20NULL',_0x9b4d('0x65'),_0x9b4d('0x8b'),_0x9b4d('0x8c')],_0xc03916);};var _0x205706=function(_0x40140b){if(!_0x40140b||!_0x40140b[_0x9b4d('0x66')]['length']){return'';}for(var _0x34126a='(',_0x3fb05d=0x0;_0x3fb05d<_0x40140b[_0x9b4d('0x66')][_0x9b4d('0x3c')];_0x3fb05d+=0x1){_0x3fb05d>0x0&&(_0x34126a+='\x20'+_0x40140b['operator']+'\x20');_0x34126a+=_0x40140b[_0x9b4d('0x66')][_0x3fb05d][_0x9b4d('0x68')]?_0x205706(_0x40140b[_0x9b4d('0x66')][_0x3fb05d][_0x9b4d('0x68')]):_0x40140b[_0x9b4d('0x66')][_0x3fb05d][_0x9b4d('0x69')]+'\x20'+_0x40140b[_0x9b4d('0x66')][_0x3fb05d][_0x9b4d('0x6a')]+(_0xdcde6a(_0x40140b[_0x9b4d('0x66')][_0x3fb05d][_0x9b4d('0x6a')])?'\x20'+_0x40140b['rules'][_0x3fb05d]['value']:'');}return _0x34126a+')';};var _0x4d794f={'where':{'id':_0x5a61a2['params']['id']}},_0x4ef3db,_0x282281,_0x39ae59,_0x1aa760,_0x29a9b0;_0x4d794f=_[_0x9b4d('0x41')]({},_0x4d794f,_0x5a61a2[_0x9b4d('0x43')]);return db[_0x9b4d('0x2f')][_0x9b4d('0x49')](_0x4d794f)[_0x9b4d('0x28')](function(_0x5b617c){if(_0x5b617c){_0x4ef3db=_0x5b617c;return _0x5b617c[_0x9b4d('0x8d')]();}return null;})['then'](function(_0x45a28c){if(_0x45a28c){if(!_0x45a28c[_0x9b4d('0x3c')]){throw new db[(_0x9b4d('0x6c'))][(_0x9b4d('0x6d'))](_0x9b4d('0x8e'),0x193);}_0x282281=_0x45a28c;return db[_0x9b4d('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x9b4d('0x28')](function(_0x1cbd7c){if(_0x1cbd7c){_0x39ae59=_[_0x9b4d('0x6f')](_0x1cbd7c,'id');var _0x4a45ab;var _0x143ae6=squel['select']();_0x143ae6[_0x9b4d('0x71')](_0x4ef3db[_0x9b4d('0x72')]);for(var _0xce99eb=0x0;_0xce99eb<_0x282281[_0x9b4d('0x3c')];_0xce99eb+=0x1){_0x4a45ab=_0x282281[_0xce99eb]['MetricId']?_0x39ae59[_0x282281[_0xce99eb][_0x9b4d('0x73')]][_0x9b4d('0x74')]:_0x282281[_0xce99eb]['field'];_0x4a45ab=_0x282281[_0xce99eb][_0x9b4d('0x75')]?_[_0x9b4d('0x76')](_0x45f502[_0x282281[_0xce99eb][_0x9b4d('0x75')]],'%s',_0x4a45ab):_0x4a45ab;_0x4a45ab=_0x282281[_0xce99eb]['format']?_['replace'](_0x33edfb[_0x282281[_0xce99eb]['format']],'%s',_0x4a45ab):_0x4a45ab;if(_0x282281[_0xce99eb][_0x9b4d('0x78')]){_0x143ae6[_0x9b4d('0x68')](_0x4a45ab);}_0x282281[_0xce99eb]['orderBy']&&_0x143ae6[_0x9b4d('0x3e')](_0x4a45ab,_0x282281[_0xce99eb][_0x9b4d('0x79')]===_0x9b4d('0x8f')?![]:!![]);_0x143ae6[_0x9b4d('0x69')](_0x4a45ab,_0x282281[_0xce99eb][_0x9b4d('0x7a')]||_0x4a45ab);}if(_0x4ef3db[_0x9b4d('0x7b')]){_0x4ef3db[_0x9b4d('0x7b')]=JSON[_0x9b4d('0x81')](_0x4ef3db[_0x9b4d('0x7b')]);for(var _0x4f9cf0=0x0;_0x4f9cf0<_0x4ef3db[_0x9b4d('0x7b')][_0x9b4d('0x3c')];_0x4f9cf0+=0x1){if(_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0][_0x9b4d('0x32')]&&_[_0x9b4d('0x63')](_0x3b4c90,_0x4ef3db['joins'][_0x4f9cf0]['type'])&&_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0][_0x9b4d('0x7c')]&&_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0]['foreignTable']&&_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0]['foreignKey']){_0x143ae6[_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0][_0x9b4d('0x32')]](_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0]['foreignTable'],null,util[_0x9b4d('0x77')]('%s.%s\x20=\x20%s.%s',_0x4ef3db[_0x9b4d('0x72')],_0x4ef3db['joins'][_0x4f9cf0][_0x9b4d('0x7c')],_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0]['foreignTable'],_0x4ef3db[_0x9b4d('0x7b')][_0x4f9cf0]['foreignKey']));}}}if(_0x4ef3db['conditions']){_0x4ef3db['conditions']=JSON[_0x9b4d('0x81')](_0x4ef3db[_0x9b4d('0x80')]);_0x143ae6[_0x9b4d('0x44')](_0x205706(_0x4ef3db[_0x9b4d('0x80')]['group']));}_0x29a9b0=_0x143ae6[_0x9b4d('0x82')]();_0x143ae6['limit'](_0x5e0813);_0x143ae6[_0x9b4d('0x20')](0x0);logger[_0x9b4d('0x83')](_0x9b4d('0x84'),_0x143ae6['toString']());return dbH[_0x9b4d('0x85')][_0x9b4d('0x36')](_0x143ae6['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x9b4d('0x28')](function(){return{'sql':_0x29a9b0[_0x9b4d('0x9e')]()};})[_0x9b4d('0x28')](respondWithResult(_0x561f96,null))[_0x9b4d('0x47')](handleError(_0x561f96,null));}; \ No newline at end of file +var _0x8ae2=['toString','SELECT','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','IS\x20NULL','clone','fullPath','%s-%s.%s','generate','output','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../files/reports','savename','countTable','QueryTypes','runReport','cross_join','IS\x20NOT\x20EMPTY','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','dbH','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CustomReports','destroy','sendStatus','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','role','Reports','autoAssociation','UserProfileResource','error','preview','join','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize'];(function(_0xb1bb3e,_0x4771be){var _0x2ef4e5=function(_0x2b53f7){while(--_0x2b53f7){_0xb1bb3e['push'](_0xb1bb3e['shift']());}};_0x2ef4e5(++_0x4771be);}(_0x8ae2,0x143));var _0x28ae=function(_0x5961f4,_0x5322dc){_0x5961f4=_0x5961f4-0x0;var _0xb9e13e=_0x8ae2[_0x5961f4];return _0xb9e13e;};'use strict';var pdf=require(_0x28ae('0x0'));var emlformat=require(_0x28ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x28ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ae('0x3'));var moment=require('moment');var BPromise=require(_0x28ae('0x4'));var Mustache=require(_0x28ae('0x5'));var util=require(_0x28ae('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x28ae('0x7'));var ejs=require(_0x28ae('0x8'));var fs=require('fs');var _=require(_0x28ae('0x9'));var squel=require('squel');var crypto=require(_0x28ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x28ae('0xb'));var toCsv=require(_0x28ae('0x7'));var querystring=require(_0x28ae('0xc'));var Papa=require(_0x28ae('0xd'));var Redis=require(_0x28ae('0xe'));var authService=require(_0x28ae('0xf'));var qs=require(_0x28ae('0x10'));var as=require(_0x28ae('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28ae('0x12'))(_0x28ae('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x28ae('0x14'))['db'];var dbH=require(_0x28ae('0x14'))[_0x28ae('0x15')];function respondWithStatusCode(_0x57ee3a,_0x19f998){_0x19f998=_0x19f998||0xcc;return function(_0x2e96d3){if(_0x2e96d3){return _0x57ee3a['sendStatus'](_0x19f998);}return _0x57ee3a[_0x28ae('0x16')](_0x19f998)[_0x28ae('0x17')]();};}function respondWithResult(_0x522c70,_0x2bfa29){_0x2bfa29=_0x2bfa29||0xc8;return function(_0x5141f5){if(_0x5141f5){return _0x522c70[_0x28ae('0x16')](_0x2bfa29)[_0x28ae('0x18')](_0x5141f5);}};}function respondWithFilteredResult(_0x3d9deb,_0x295f36){return function(_0x56620c){if(_0x56620c){var _0x6ebb5b=_0x56620c[_0x28ae('0x19')],_0x4d7c26=_0x295f36[_0x28ae('0x1a')],_0xa83fc6=_0x295f36[_0x28ae('0x1a')]+_0x295f36[_0x28ae('0x1b')],_0x4db342;if(_0xa83fc6>=_0x6ebb5b){_0xa83fc6=_0x6ebb5b;_0x4db342=0xc8;}else{_0x4db342=0xce;}_0x3d9deb[_0x28ae('0x16')](_0x4db342);return _0x3d9deb[_0x28ae('0x1c')](_0x28ae('0x1d'),_0x4d7c26+'-'+_0xa83fc6+'/'+_0x6ebb5b)[_0x28ae('0x18')](_0x56620c);}return null;};}function patchUpdates(_0x2c3c05){return function(_0x180c9f){try{jsonpatch['apply'](_0x180c9f,_0x2c3c05,!![]);}catch(_0x530293){return BPromise[_0x28ae('0x1e')](_0x530293);}return _0x180c9f[_0x28ae('0x1f')]();};}function saveUpdates(_0xbdbbc6,_0x489122){return function(_0xe04e97){if(_0xe04e97){return _0xe04e97[_0x28ae('0x20')](_0xbdbbc6)[_0x28ae('0x21')](function(_0x56baeb){return _0x56baeb;});}return null;};}function removeEntity(_0x431f63,_0x67d1fd){return function(_0x1e0ac9){if(_0x1e0ac9){return _0x1e0ac9['destroy']()['then'](function(){var _0x1cc686=_0x1e0ac9['get']({'plain':!![]});var _0x4d2f86=_0x28ae('0x22');return db['UserProfileResource'][_0x28ae('0x23')]({'where':{'type':_0x4d2f86,'resourceId':_0x1cc686['id']}})['then'](function(){return _0x1e0ac9;});})[_0x28ae('0x21')](function(){_0x431f63['status'](0xcc)[_0x28ae('0x17')]();});}};}function handleEntityNotFound(_0x3fc06d,_0x5a0284){return function(_0x365d6b){if(!_0x365d6b){_0x3fc06d[_0x28ae('0x24')](0x194);}return _0x365d6b;};}function handleError(_0x665814,_0x61fb72){_0x61fb72=_0x61fb72||0x1f4;return function(_0x401ca2){logger['error'](_0x401ca2['stack']);if(_0x401ca2['name']){delete _0x401ca2[_0x28ae('0x25')];}_0x665814[_0x28ae('0x16')](_0x61fb72)['send'](_0x401ca2);};}exports[_0x28ae('0x26')]=function(_0x306626,_0x39e82d){var _0x3904d4={},_0x2ef411={},_0x276945={'count':0x0,'rows':[]};var _0x21f4f2=_[_0x28ae('0x27')](db[_0x28ae('0x28')][_0x28ae('0x29')],function(_0x48cfdd){return{'name':_0x48cfdd[_0x28ae('0x2a')],'type':_0x48cfdd[_0x28ae('0x2b')][_0x28ae('0x2c')]};});_0x2ef411[_0x28ae('0x2d')]=_[_0x28ae('0x27')](_0x21f4f2,'name');_0x2ef411['query']=_[_0x28ae('0x2e')](_0x306626[_0x28ae('0x2f')]);_0x2ef411[_0x28ae('0x30')]=_['intersection'](_0x2ef411[_0x28ae('0x2d')],_0x2ef411[_0x28ae('0x2f')]);_0x3904d4['attributes']=_[_0x28ae('0x31')](_0x2ef411['model'],qs[_0x28ae('0x32')](_0x306626['query'][_0x28ae('0x32')]));_0x3904d4['attributes']=_0x3904d4[_0x28ae('0x33')]['length']?_0x3904d4[_0x28ae('0x33')]:_0x2ef411[_0x28ae('0x2d')];if(!_0x306626[_0x28ae('0x2f')]['hasOwnProperty']('nolimit')){_0x3904d4[_0x28ae('0x1b')]=qs['limit'](_0x306626['query'][_0x28ae('0x1b')]);_0x3904d4[_0x28ae('0x1a')]=qs[_0x28ae('0x1a')](_0x306626['query'][_0x28ae('0x1a')]);}_0x3904d4['order']=qs[_0x28ae('0x34')](_0x306626['query'][_0x28ae('0x34')]);_0x3904d4[_0x28ae('0x35')]=qs[_0x28ae('0x30')](_['pick'](_0x306626[_0x28ae('0x2f')],_0x2ef411['filters']),_0x21f4f2);if(_0x306626['query'][_0x28ae('0x36')]){_0x3904d4[_0x28ae('0x35')]=_[_0x28ae('0x37')](_0x3904d4[_0x28ae('0x35')],{'$or':_[_0x28ae('0x27')](_0x21f4f2,function(_0x4fdedc){if(_0x4fdedc[_0x28ae('0x2b')]!=='VIRTUAL'){var _0x189d0c={};_0x189d0c[_0x4fdedc[_0x28ae('0x25')]]={'$like':'%'+_0x306626[_0x28ae('0x2f')][_0x28ae('0x36')]+'%'};return _0x189d0c;}})});}_0x3904d4=_[_0x28ae('0x37')]({},_0x3904d4,_0x306626[_0x28ae('0x38')]);var _0x2f2774={'where':_0x3904d4[_0x28ae('0x35')]};return db[_0x28ae('0x28')][_0x28ae('0x19')](_0x2f2774)['then'](function(_0x32d868){_0x276945[_0x28ae('0x19')]=_0x32d868;if(_0x306626[_0x28ae('0x2f')][_0x28ae('0x39')]){_0x3904d4[_0x28ae('0x3a')]=[{'all':!![]}];}return db[_0x28ae('0x28')][_0x28ae('0x3b')](_0x3904d4);})['then'](function(_0x5051b9){_0x276945[_0x28ae('0x3c')]=_0x5051b9;return _0x276945;})[_0x28ae('0x21')](respondWithFilteredResult(_0x39e82d,_0x3904d4))[_0x28ae('0x3d')](handleError(_0x39e82d,null));};exports[_0x28ae('0x3e')]=function(_0x1774c2,_0x46a632){var _0x1e52d2={'raw':![],'where':{'id':_0x1774c2[_0x28ae('0x3f')]['id']}},_0x3d7838={};_0x3d7838[_0x28ae('0x2d')]=_[_0x28ae('0x2e')](db[_0x28ae('0x28')][_0x28ae('0x29')]);_0x3d7838[_0x28ae('0x2f')]=_[_0x28ae('0x2e')](_0x1774c2['query']);_0x3d7838[_0x28ae('0x30')]=_['intersection'](_0x3d7838[_0x28ae('0x2d')],_0x3d7838[_0x28ae('0x2f')]);_0x1e52d2['attributes']=_[_0x28ae('0x31')](_0x3d7838['model'],qs[_0x28ae('0x32')](_0x1774c2['query'][_0x28ae('0x32')]));_0x1e52d2[_0x28ae('0x33')]=_0x1e52d2[_0x28ae('0x33')][_0x28ae('0x40')]?_0x1e52d2['attributes']:_0x3d7838[_0x28ae('0x2d')];if(_0x1774c2['query']['includeAll']){_0x1e52d2['include']=[{'all':!![]}];}_0x1e52d2=_[_0x28ae('0x37')]({},_0x1e52d2,_0x1774c2['options']);return db['AnalyticCustomReport'][_0x28ae('0x41')](_0x1e52d2)[_0x28ae('0x21')](handleEntityNotFound(_0x46a632,null))[_0x28ae('0x21')](respondWithResult(_0x46a632,null))[_0x28ae('0x3d')](handleError(_0x46a632,null));};exports[_0x28ae('0x42')]=function(_0xc49c1a,_0x5a8fa1){return db[_0x28ae('0x28')][_0x28ae('0x42')](_0xc49c1a[_0x28ae('0x43')],{})[_0x28ae('0x21')](function(_0x40b89e){var _0x2514c0=_0xc49c1a['user']['get']({'plain':!![]});if(!_0x2514c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2514c0[_0x28ae('0x44')]==='user'){var _0x54e423=_0x40b89e['get']({'plain':!![]});var _0x18b414=_0x28ae('0x45');return db['UserProfileSection'][_0x28ae('0x41')]({'where':{'name':_0x18b414,'userProfileId':_0x2514c0['userProfileId']},'raw':!![]})[_0x28ae('0x21')](function(_0x42c6f7){if(_0x42c6f7&&_0x42c6f7[_0x28ae('0x46')]===0x0){return db[_0x28ae('0x47')][_0x28ae('0x42')]({'name':_0x54e423[_0x28ae('0x25')],'resourceId':_0x54e423['id'],'type':'CustomReports','sectionId':_0x42c6f7['id']},{})[_0x28ae('0x21')](function(){return _0x40b89e;});}else{return _0x40b89e;}})['catch'](function(_0x429a1a){logger[_0x28ae('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429a1a);throw _0x429a1a;});}return _0x40b89e;})[_0x28ae('0x21')](respondWithResult(_0x5a8fa1,0xc9))['catch'](handleError(_0x5a8fa1,null));};exports[_0x28ae('0x20')]=function(_0x42acd1,_0x11a226){if(_0x42acd1['body']['id']){delete _0x42acd1[_0x28ae('0x43')]['id'];}return db[_0x28ae('0x28')][_0x28ae('0x41')]({'where':{'id':_0x42acd1[_0x28ae('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11a226,null))[_0x28ae('0x21')](saveUpdates(_0x42acd1[_0x28ae('0x43')],null))[_0x28ae('0x21')](respondWithResult(_0x11a226,null))['catch'](handleError(_0x11a226,null));};exports[_0x28ae('0x23')]=function(_0x47dd0e,_0x36e06e){return db[_0x28ae('0x28')]['find']({'where':{'id':_0x47dd0e[_0x28ae('0x3f')]['id']}})[_0x28ae('0x21')](handleEntityNotFound(_0x36e06e,null))[_0x28ae('0x21')](removeEntity(_0x36e06e,null))['catch'](handleError(_0x36e06e,null));};exports[_0x28ae('0x49')]=function(_0x3ef134,_0x504379){var _0x4df882=0xa;var _0x5117f2=[_0x28ae('0x4a'),_0x28ae('0x4b'),_0x28ae('0x4c'),'cross_join'];var _0x11bc8a={'SUM':_0x28ae('0x4d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x28ae('0x4e'),'MAX':_0x28ae('0x4f'),'MIN':_0x28ae('0x50'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x28ae('0x51'),'GROUP_CONCAT DESC':_0x28ae('0x52')};var _0x258a86={'SEC_TO_TIME':_0x28ae('0x53'),'DATE':_0x28ae('0x54'),'HOUR':'HOUR(%s)','ROUND':_0x28ae('0x55'),'UNIX_TIMESTAMP':_0x28ae('0x56')};var _0x1dcfb2=function(_0x4f639f){return!_[_0x28ae('0x57')](['IS\x20NULL',_0x28ae('0x58'),_0x28ae('0x59'),'IS\x20NOT\x20EMPTY'],_0x4f639f);};var _0x12bd60=function(_0x30551c){if(!_0x30551c||!_0x30551c[_0x28ae('0x5a')][_0x28ae('0x40')]){return'';}for(var _0x1602d1='(',_0x5e3b82=0x0;_0x5e3b82<_0x30551c[_0x28ae('0x5a')]['length'];_0x5e3b82+=0x1){_0x5e3b82>0x0&&(_0x1602d1+='\x20'+_0x30551c[_0x28ae('0x5b')]+'\x20');_0x1602d1+=_0x30551c[_0x28ae('0x5a')][_0x5e3b82][_0x28ae('0x5c')]?_0x12bd60(_0x30551c['rules'][_0x5e3b82]['group']):_0x30551c['rules'][_0x5e3b82][_0x28ae('0x5d')]+'\x20'+_0x30551c[_0x28ae('0x5a')][_0x5e3b82]['condition']+(_0x1dcfb2(_0x30551c[_0x28ae('0x5a')][_0x5e3b82][_0x28ae('0x5e')])?'\x20'+_0x30551c[_0x28ae('0x5a')][_0x5e3b82][_0x28ae('0x5f')]:'');}return _0x1602d1+')';};var _0x4206d7={'where':{'id':_0x3ef134[_0x28ae('0x3f')]['id']}},_0x3c0d83,_0x30620b,_0x56bff8,_0x593259,_0x43d262;_0x4206d7=_[_0x28ae('0x37')]({},_0x4206d7,_0x3ef134['options']);return db['AnalyticCustomReport'][_0x28ae('0x41')](_0x4206d7)[_0x28ae('0x21')](function(_0x5e0056){if(_0x5e0056){_0x3c0d83=_0x5e0056;return _0x5e0056[_0x28ae('0x60')]();}return null;})['then'](function(_0x112a1e){if(_0x112a1e){if(!_0x112a1e[_0x28ae('0x40')]){throw new db[(_0x28ae('0x61'))][(_0x28ae('0x62'))](_0x28ae('0x63'),0x193);}_0x30620b=_0x112a1e;return db['AnalyticMetric'][_0x28ae('0x3b')]({'raw':!![]});}return null;})['then'](function(_0x5c5277){if(_0x5c5277){_0x56bff8=_[_0x28ae('0x64')](_0x5c5277,'id');var _0x3e0424;var _0x5f594b=squel[_0x28ae('0x65')]();_0x5f594b[_0x28ae('0x66')](_0x3c0d83[_0x28ae('0x67')]);for(var _0x6788ff=0x0;_0x6788ff<_0x30620b[_0x28ae('0x40')];_0x6788ff+=0x1){_0x3e0424=_0x30620b[_0x6788ff][_0x28ae('0x68')]?_0x56bff8[_0x30620b[_0x6788ff][_0x28ae('0x68')]][_0x28ae('0x69')]:_0x30620b[_0x6788ff][_0x28ae('0x5d')];_0x3e0424=_0x30620b[_0x6788ff][_0x28ae('0x6a')]?_[_0x28ae('0x6b')](_0x11bc8a[_0x30620b[_0x6788ff][_0x28ae('0x6a')]],'%s',_0x3e0424):_0x3e0424;_0x3e0424=_0x30620b[_0x6788ff][_0x28ae('0x6c')]?_['replace'](_0x258a86[_0x30620b[_0x6788ff][_0x28ae('0x6c')]],'%s',_0x3e0424):_0x3e0424;if(_0x30620b[_0x6788ff][_0x28ae('0x6d')]){_0x5f594b[_0x28ae('0x5c')](_0x3e0424);}_0x30620b[_0x6788ff]['orderBy']&&_0x5f594b[_0x28ae('0x6e')](_0x3e0424,_0x30620b[_0x6788ff][_0x28ae('0x6f')]===_0x28ae('0x70')?![]:!![]);_0x5f594b[_0x28ae('0x5d')](_0x3e0424,_0x30620b[_0x6788ff][_0x28ae('0x71')]||_0x3e0424);}if(_0x3c0d83[_0x28ae('0x72')]){_0x3c0d83[_0x28ae('0x72')]=JSON[_0x28ae('0x73')](_0x3c0d83[_0x28ae('0x72')]);for(var _0x12ba2f=0x0;_0x12ba2f<_0x3c0d83[_0x28ae('0x72')]['length'];_0x12ba2f+=0x1){if(_0x3c0d83[_0x28ae('0x72')][_0x12ba2f][_0x28ae('0x2b')]&&_[_0x28ae('0x57')](_0x5117f2,_0x3c0d83['joins'][_0x12ba2f][_0x28ae('0x2b')])&&_0x3c0d83[_0x28ae('0x72')][_0x12ba2f][_0x28ae('0x74')]&&_0x3c0d83['joins'][_0x12ba2f][_0x28ae('0x75')]&&_0x3c0d83[_0x28ae('0x72')][_0x12ba2f][_0x28ae('0x76')]){_0x5f594b[_0x3c0d83[_0x28ae('0x72')][_0x12ba2f]['type']](_0x3c0d83[_0x28ae('0x72')][_0x12ba2f][_0x28ae('0x75')],null,util[_0x28ae('0x6c')](_0x28ae('0x77'),_0x3c0d83[_0x28ae('0x67')],_0x3c0d83[_0x28ae('0x72')][_0x12ba2f][_0x28ae('0x74')],_0x3c0d83['joins'][_0x12ba2f][_0x28ae('0x75')],_0x3c0d83[_0x28ae('0x72')][_0x12ba2f][_0x28ae('0x76')]));}}}if(_0x3c0d83[_0x28ae('0x78')]){_0x3c0d83[_0x28ae('0x78')]=JSON['parse'](_0x3c0d83[_0x28ae('0x78')]);_0x5f594b[_0x28ae('0x35')](_0x12bd60(_0x3c0d83['conditions'][_0x28ae('0x5c')]));}_0x43d262=_0x5f594b['clone']();_0x5f594b[_0x28ae('0x1b')](_0x4df882);_0x5f594b[_0x28ae('0x1a')](0x0);logger[_0x28ae('0x79')](_0x28ae('0x7a'),_0x5f594b['toString']());return dbH[_0x28ae('0x7b')][_0x28ae('0x2f')](_0x5f594b[_0x28ae('0x7c')](),{'type':dbH['sequelize']['QueryTypes'][_0x28ae('0x7d')]});}})['then'](respondWithResult(_0x504379,null))[_0x28ae('0x3d')](handleError(_0x504379,null));};function runReport(_0x43aab2,_0x1c05a6,_0x51cc10){var _0x4b72ae=_0x1c05a6['name'];var _0x2324c6=0xa;var _0x42fa50=[_0x28ae('0x4a'),'left_join',_0x28ae('0x4c'),'cross_join'];var _0x45fb1b={'SUM':'SUM(%s)','COUNT':_0x28ae('0x7e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x28ae('0x7f'),'GROUP_CONCAT':_0x28ae('0x80'),'GROUP_CONCAT ASC':_0x28ae('0x51'),'GROUP_CONCAT DESC':_0x28ae('0x52')};var _0x3d7c0c={'SEC_TO_TIME':_0x28ae('0x53'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x28ae('0x55'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e8e4c=function(_0x2f9f66){return!_[_0x28ae('0x57')]([_0x28ae('0x81'),_0x28ae('0x58'),_0x28ae('0x59'),'IS\x20NOT\x20EMPTY'],_0x2f9f66);};var _0x464516=function(_0x2b6d64){if(!_0x2b6d64||!_0x2b6d64[_0x28ae('0x5a')]['length']){return'';}for(var _0x4c5012='(',_0x2e4467=0x0;_0x2e4467<_0x2b6d64[_0x28ae('0x5a')][_0x28ae('0x40')];_0x2e4467+=0x1){_0x2e4467>0x0&&(_0x4c5012+='\x20'+_0x2b6d64[_0x28ae('0x5b')]+'\x20');_0x4c5012+=_0x2b6d64[_0x28ae('0x5a')][_0x2e4467]['group']?_0x464516(_0x2b6d64[_0x28ae('0x5a')][_0x2e4467][_0x28ae('0x5c')]):_0x2b6d64[_0x28ae('0x5a')][_0x2e4467][_0x28ae('0x5d')]+'\x20'+_0x2b6d64['rules'][_0x2e4467][_0x28ae('0x5e')]+(_0x1e8e4c(_0x2b6d64[_0x28ae('0x5a')][_0x2e4467][_0x28ae('0x5e')])?'\x20'+_0x2b6d64[_0x28ae('0x5a')][_0x2e4467][_0x28ae('0x5f')]:'');}return _0x4c5012+')';};var _0xec74a4={'where':{'id':_0x43aab2['id']}},_0x38a1af,_0x5ad7a6,_0x51057f,_0x10469e,_0x4f543a;_0xec74a4=_[_0x28ae('0x37')]({},_0xec74a4,_0x51cc10);return db[_0x28ae('0x28')][_0x28ae('0x41')](_0xec74a4)[_0x28ae('0x21')](function(_0x12c360){if(_0x12c360){_0x38a1af=_0x12c360;return _0x12c360['getFields']();}return null;})[_0x28ae('0x21')](function(_0x2e98ab){if(_0x2e98ab){if(!_0x2e98ab[_0x28ae('0x40')]){throw new db[(_0x28ae('0x61'))][(_0x28ae('0x62'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ad7a6=_0x2e98ab;return db['AnalyticMetric'][_0x28ae('0x3b')]({'raw':!![]});}return null;})[_0x28ae('0x21')](function(_0x4bf1c6){if(_0x4bf1c6){_0x51057f=_[_0x28ae('0x64')](_0x4bf1c6,'id');var _0x58da01;var _0x1b7ca7=squel[_0x28ae('0x65')]();_0x1b7ca7[_0x28ae('0x66')](_0x38a1af[_0x28ae('0x67')]);for(var _0x366041=0x0;_0x366041<_0x5ad7a6[_0x28ae('0x40')];_0x366041+=0x1){_0x58da01=_0x5ad7a6[_0x366041]['MetricId']?_0x51057f[_0x5ad7a6[_0x366041][_0x28ae('0x68')]][_0x28ae('0x69')]:_0x5ad7a6[_0x366041][_0x28ae('0x5d')];_0x58da01=_0x5ad7a6[_0x366041][_0x28ae('0x6a')]?_['replace'](_0x45fb1b[_0x5ad7a6[_0x366041][_0x28ae('0x6a')]],'%s',_0x58da01):_0x58da01;_0x58da01=_0x5ad7a6[_0x366041][_0x28ae('0x6c')]?_[_0x28ae('0x6b')](_0x3d7c0c[_0x5ad7a6[_0x366041][_0x28ae('0x6c')]],'%s',_0x58da01):_0x58da01;if(_0x5ad7a6[_0x366041][_0x28ae('0x6d')]){_0x1b7ca7[_0x28ae('0x5c')](_0x58da01);}_0x5ad7a6[_0x366041][_0x28ae('0x6f')]&&_0x1b7ca7['order'](_0x58da01,_0x5ad7a6[_0x366041]['orderBy']===_0x28ae('0x70')?![]:!![]);_0x1b7ca7[_0x28ae('0x5d')](_0x58da01,_0x5ad7a6[_0x366041][_0x28ae('0x71')]||_0x58da01);}if(_0x38a1af['joins']){_0x38a1af[_0x28ae('0x72')]=JSON[_0x28ae('0x73')](_0x38a1af[_0x28ae('0x72')]);for(var _0x120251=0x0;_0x120251<_0x38a1af[_0x28ae('0x72')][_0x28ae('0x40')];_0x120251+=0x1){if(_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x2b')]&&_['includes'](_0x42fa50,_0x38a1af['joins'][_0x120251]['type'])&&_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x74')]&&_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x75')]&&_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x76')]){_0x1b7ca7[_0x38a1af['joins'][_0x120251][_0x28ae('0x2b')]](_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x75')],null,util[_0x28ae('0x6c')]('%s.%s\x20=\x20%s.%s',_0x38a1af['table'],_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x74')],_0x38a1af['joins'][_0x120251]['foreignTable'],_0x38a1af[_0x28ae('0x72')][_0x120251][_0x28ae('0x76')]));}}}if(_0x38a1af[_0x28ae('0x78')]){_0x38a1af['conditions']=JSON[_0x28ae('0x73')](_0x38a1af['conditions']);_0x1b7ca7['where'](_0x464516(_0x38a1af['conditions']['group']));}_0x4f543a=_0x1b7ca7[_0x28ae('0x82')]();_0x1b7ca7[_0x28ae('0x1b')](_0x2324c6);_0x1b7ca7['offset'](0x0);return;}})[_0x28ae('0x21')](function(){if(_0x1c05a6['output']==='web'){return null;}var _0x2a806e=_[_0x28ae('0x37')](_0x1c05a6,{'name':_0x1c05a6[_0x28ae('0x83')]||_0x1c05a6['name']||_0x38a1af[_0x28ae('0x25')],'basename':_0x4b72ae,'savename':util[_0x28ae('0x6c')](_0x28ae('0x84'),_0x1c05a6[_0x28ae('0x25')]||_0x38a1af[_0x28ae('0x25')],require('randomstring')[_0x28ae('0x85')](0x4),_0x1c05a6[_0x28ae('0x86')]||'csv'),'reportId':_0x38a1af['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x28ae('0x42')](_0x2a806e,{'raw':!![]});})[_0x28ae('0x21')](function(_0x20d434){if(_0x38a1af['table']==='cdr'){_0x4f543a[_0x28ae('0x35')](_0x38a1af[_0x28ae('0x67')]+_0x28ae('0x87'),_0x1c05a6[_0x28ae('0x88')],_0x1c05a6[_0x28ae('0x89')]);}else{_0x4f543a[_0x28ae('0x35')](_0x38a1af[_0x28ae('0x67')]+_0x28ae('0x8a'),_0x1c05a6['startDate'],_0x1c05a6[_0x28ae('0x89')]);}if(_0x20d434){logger[_0x28ae('0x8b')](_0x28ae('0x8c'),_0x4f543a[_0x28ae('0x7c')]());require('child_process')[_0x28ae('0x8d')](path['join'](__dirname,'../../components/export/',_0x20d434[_0x28ae('0x86')]),[_0x20d434['id'],_0x4f543a[_0x28ae('0x7c')](),path['join'](__dirname,_0x28ae('0x8e'),_0x20d434[_0x28ae('0x8f')]),_0x4b72ae]);return _0x20d434;}else{var _0x87aa18=squel[_0x28ae('0x65')]();_0x87aa18[_0x28ae('0x66')]('('+_0x4f543a[_0x28ae('0x7c')]()+')',_0x28ae('0x90'));_0x87aa18['field']('COUNT(*)',_0x28ae('0x19'));_0x4f543a[_0x28ae('0x1b')](_0x1c05a6['limit']||_0x2324c6);_0x4f543a[_0x28ae('0x1a')](_0x1c05a6['offset']||0x0);return dbH[_0x28ae('0x7b')][_0x28ae('0x2f')](_0x87aa18[_0x28ae('0x7c')](),{'type':dbH[_0x28ae('0x7b')]['QueryTypes']['SELECT']})['then'](function(_0x221bef){if(!_0x221bef[_0x28ae('0x40')]){_0x10469e=0x0;}else{_0x10469e=_0x221bef[0x0][_0x28ae('0x19')]||0x0;}return dbH[_0x28ae('0x7b')][_0x28ae('0x2f')](_0x4f543a[_0x28ae('0x7c')](),{'type':dbH[_0x28ae('0x7b')][_0x28ae('0x91')][_0x28ae('0x7d')]});})[_0x28ae('0x21')](function(_0x512c4d){return{'rows':_0x512c4d||[],'count':_0x10469e};});}});}exports['run']=function(_0x5a6c16,_0x2c4ce4){return runReport(_0x5a6c16['params'],_0x5a6c16[_0x28ae('0x2f')],_0x5a6c16['options'])[_0x28ae('0x21')](respondWithResult(_0x2c4ce4,null))[_0x28ae('0x3d')](handleError(_0x2c4ce4,null));};exports[_0x28ae('0x92')]=runReport;exports[_0x28ae('0x2f')]=function(_0x3661ea,_0x59f3e0){var _0x574ac0=0xa;var _0x5d4972=[_0x28ae('0x4a'),_0x28ae('0x4b'),_0x28ae('0x4c'),_0x28ae('0x93')];var _0x12407f={'SUM':_0x28ae('0x4d'),'COUNT':_0x28ae('0x7e'),'COUNT DISTINCT':_0x28ae('0x4e'),'MAX':_0x28ae('0x4f'),'MIN':_0x28ae('0x50'),'AVG':_0x28ae('0x7f'),'GROUP_CONCAT':_0x28ae('0x80'),'GROUP_CONCAT ASC':_0x28ae('0x51'),'GROUP_CONCAT DESC':_0x28ae('0x52')};var _0x10f30d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x28ae('0x54'),'HOUR':'HOUR(%s)','ROUND':_0x28ae('0x55'),'UNIX_TIMESTAMP':_0x28ae('0x56')};var _0x2e23e8=function(_0x47e90f){return!_[_0x28ae('0x57')]([_0x28ae('0x81'),_0x28ae('0x58'),_0x28ae('0x59'),_0x28ae('0x94')],_0x47e90f);};var _0x837a3a=function(_0x3ce94c){if(!_0x3ce94c||!_0x3ce94c[_0x28ae('0x5a')][_0x28ae('0x40')]){return'';}for(var _0x2228a9='(',_0x427164=0x0;_0x427164<_0x3ce94c[_0x28ae('0x5a')]['length'];_0x427164+=0x1){_0x427164>0x0&&(_0x2228a9+='\x20'+_0x3ce94c['operator']+'\x20');_0x2228a9+=_0x3ce94c[_0x28ae('0x5a')][_0x427164]['group']?_0x837a3a(_0x3ce94c[_0x28ae('0x5a')][_0x427164][_0x28ae('0x5c')]):_0x3ce94c[_0x28ae('0x5a')][_0x427164][_0x28ae('0x5d')]+'\x20'+_0x3ce94c[_0x28ae('0x5a')][_0x427164][_0x28ae('0x5e')]+(_0x2e23e8(_0x3ce94c['rules'][_0x427164][_0x28ae('0x5e')])?'\x20'+_0x3ce94c['rules'][_0x427164][_0x28ae('0x5f')]:'');}return _0x2228a9+')';};var _0x51781d={'where':{'id':_0x3661ea[_0x28ae('0x3f')]['id']}},_0x4b1fb1,_0x50bb85,_0x1f349e,_0x2a0280,_0x3ce535;_0x51781d=_['merge']({},_0x51781d,_0x3661ea[_0x28ae('0x38')]);return db['AnalyticCustomReport'][_0x28ae('0x41')](_0x51781d)[_0x28ae('0x21')](function(_0x196edc){if(_0x196edc){_0x4b1fb1=_0x196edc;return _0x196edc[_0x28ae('0x60')]();}return null;})[_0x28ae('0x21')](function(_0x201070){if(_0x201070){if(!_0x201070[_0x28ae('0x40')]){throw new db[(_0x28ae('0x61'))]['ValidationErrorItem'](_0x28ae('0x63'),0x193);}_0x50bb85=_0x201070;return db['AnalyticMetric'][_0x28ae('0x3b')]({'raw':!![]});}return null;})[_0x28ae('0x21')](function(_0x3da10e){if(_0x3da10e){_0x1f349e=_['keyBy'](_0x3da10e,'id');var _0x29f707;var _0x1ddf7f=squel[_0x28ae('0x65')]();_0x1ddf7f[_0x28ae('0x66')](_0x4b1fb1['table']);for(var _0x2a2e9b=0x0;_0x2a2e9b<_0x50bb85[_0x28ae('0x40')];_0x2a2e9b+=0x1){_0x29f707=_0x50bb85[_0x2a2e9b][_0x28ae('0x68')]?_0x1f349e[_0x50bb85[_0x2a2e9b]['MetricId']][_0x28ae('0x69')]:_0x50bb85[_0x2a2e9b][_0x28ae('0x5d')];_0x29f707=_0x50bb85[_0x2a2e9b][_0x28ae('0x6a')]?_[_0x28ae('0x6b')](_0x12407f[_0x50bb85[_0x2a2e9b][_0x28ae('0x6a')]],'%s',_0x29f707):_0x29f707;_0x29f707=_0x50bb85[_0x2a2e9b][_0x28ae('0x6c')]?_[_0x28ae('0x6b')](_0x10f30d[_0x50bb85[_0x2a2e9b][_0x28ae('0x6c')]],'%s',_0x29f707):_0x29f707;if(_0x50bb85[_0x2a2e9b][_0x28ae('0x6d')]){_0x1ddf7f['group'](_0x29f707);}_0x50bb85[_0x2a2e9b]['orderBy']&&_0x1ddf7f[_0x28ae('0x6e')](_0x29f707,_0x50bb85[_0x2a2e9b][_0x28ae('0x6f')]===_0x28ae('0x70')?![]:!![]);_0x1ddf7f['field'](_0x29f707,_0x50bb85[_0x2a2e9b][_0x28ae('0x71')]||_0x29f707);}if(_0x4b1fb1['joins']){_0x4b1fb1['joins']=JSON[_0x28ae('0x73')](_0x4b1fb1['joins']);for(var _0x2f64e7=0x0;_0x2f64e7<_0x4b1fb1[_0x28ae('0x72')][_0x28ae('0x40')];_0x2f64e7+=0x1){if(_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7]['type']&&_[_0x28ae('0x57')](_0x5d4972,_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7][_0x28ae('0x2b')])&&_0x4b1fb1['joins'][_0x2f64e7][_0x28ae('0x74')]&&_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7][_0x28ae('0x75')]&&_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7]['foreignKey']){_0x1ddf7f[_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7]['type']](_0x4b1fb1['joins'][_0x2f64e7][_0x28ae('0x75')],null,util[_0x28ae('0x6c')]('%s.%s\x20=\x20%s.%s',_0x4b1fb1[_0x28ae('0x67')],_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7][_0x28ae('0x74')],_0x4b1fb1['joins'][_0x2f64e7][_0x28ae('0x75')],_0x4b1fb1[_0x28ae('0x72')][_0x2f64e7]['foreignKey']));}}}if(_0x4b1fb1[_0x28ae('0x78')]){_0x4b1fb1['conditions']=JSON[_0x28ae('0x73')](_0x4b1fb1[_0x28ae('0x78')]);_0x1ddf7f[_0x28ae('0x35')](_0x837a3a(_0x4b1fb1['conditions']['group']));}_0x3ce535=_0x1ddf7f[_0x28ae('0x82')]();_0x1ddf7f[_0x28ae('0x1b')](_0x574ac0);_0x1ddf7f[_0x28ae('0x1a')](0x0);logger[_0x28ae('0x79')](_0x28ae('0x7a'),_0x1ddf7f[_0x28ae('0x7c')]());return dbH[_0x28ae('0x7b')][_0x28ae('0x2f')](_0x1ddf7f[_0x28ae('0x7c')](),{'type':dbH['sequelize']['QueryTypes'][_0x28ae('0x7d')]});}})['then'](function(){return{'sql':_0x3ce535[_0x28ae('0x7c')]()};})[_0x28ae('0x21')](respondWithResult(_0x59f3e0,null))[_0x28ae('0x3d')](handleError(_0x59f3e0,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9ab0284..bcaf0db 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 _0x922c=['bluebird','request-promise','path','../../config/environment','exports','define','lodash','util','../../config/logger','moment'];(function(_0x3437bc,_0x24bcf8){var _0x23fa97=function(_0x46975c){while(--_0x46975c){_0x3437bc['push'](_0x3437bc['shift']());}};_0x23fa97(++_0x24bcf8);}(_0x922c,0x92));var _0xc922=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x922c[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0xc922('0x0'));var util=require(_0xc922('0x1'));var logger=require(_0xc922('0x2'))('api');var moment=require(_0xc922('0x3'));var BPromise=require(_0xc922('0x4'));var rp=require(_0xc922('0x5'));var fs=require('fs');var path=require(_0xc922('0x6'));var rimraf=require('rimraf');var config=require(_0xc922('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0xc922('0x8')]=function(_0x28057f,_0x1a2c12){return _0x28057f[_0xc922('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3311=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x12dc02,_0x4eca0a){var _0x13e575=function(_0x204ab0){while(--_0x204ab0){_0x12dc02['push'](_0x12dc02['shift']());}};_0x13e575(++_0x4eca0a);}(_0x3311,0x179));var _0x1331=function(_0x58e09e,_0x177026){_0x58e09e=_0x58e09e-0x0;var _0x93e5fb=_0x3311[_0x58e09e];return _0x93e5fb;};'use strict';var _=require(_0x1331('0x0'));var util=require(_0x1331('0x1'));var logger=require(_0x1331('0x2'))(_0x1331('0x3'));var moment=require(_0x1331('0x4'));var BPromise=require('bluebird');var rp=require(_0x1331('0x5'));var fs=require('fs');var path=require(_0x1331('0x6'));var rimraf=require(_0x1331('0x7'));var config=require(_0x1331('0x8'));var attributes=require(_0x1331('0x9'));module[_0x1331('0xa')]=function(_0x4270ad,_0x253efb){return _0x4270ad[_0x1331('0xb')](_0x1331('0xc'),attributes,{'tableName':_0x1331('0xd'),'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 788e77a..a1e5306 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 _0x6b7f=['../../mysqldb','rpc','../../config/environment','jayson/promise','then','info','debug','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x6b7f,0x19c));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6b7('0x0'));var util=require(_0xf6b7('0x1'));var moment=require(_0xf6b7('0x2'));var BPromise=require(_0xf6b7('0x3'));var rs=require(_0xf6b7('0x4'));var fs=require('fs');var Redis=require(_0xf6b7('0x5'));var db=require(_0xf6b7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf6b7('0x7'));var config=require(_0xf6b7('0x8'));var jayson=require(_0xf6b7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b513b,_0x63196f,_0x31d7a3){return new BPromise(function(_0x199477,_0x174c0f){return client['request'](_0x1b513b,_0x31d7a3)[_0xf6b7('0xa')](function(_0x1b7c1a){logger[_0xf6b7('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x63196f,'request\x20sent');logger[_0xf6b7('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x63196f,_0xf6b7('0xd'),JSON['stringify'](_0x1b7c1a));if(_0x1b7c1a[_0xf6b7('0xe')]){if(_0x1b7c1a[_0xf6b7('0xe')][_0xf6b7('0xf')]===0x1f4){logger[_0xf6b7('0xe')](_0xf6b7('0x10'),_0x63196f,_0x1b7c1a['error'][_0xf6b7('0x11')]);return _0x174c0f(_0x1b7c1a[_0xf6b7('0xe')][_0xf6b7('0x11')]);}logger[_0xf6b7('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x63196f,_0x1b7c1a[_0xf6b7('0xe')]['message']);return _0x199477(_0x1b7c1a[_0xf6b7('0xe')][_0xf6b7('0x11')]);}else{logger[_0xf6b7('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x63196f,_0xf6b7('0xd'));_0x199477(_0x1b7c1a['result']['message']);}})[_0xf6b7('0x12')](function(_0x4523ff){logger[_0xf6b7('0xe')](_0xf6b7('0x10'),_0x63196f,_0x4523ff);_0x174c0f(_0x4523ff);});});} \ No newline at end of file +var _0x169b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x169b,0xa7));var _0xb169=function(_0x13bbf9,_0x298629){_0x13bbf9=_0x13bbf9-0x0;var _0x28cd98=_0x169b[_0x13bbf9];return _0x28cd98;};'use strict';var _=require(_0xb169('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb169('0x1'));var rs=require(_0xb169('0x2'));var fs=require('fs');var Redis=require(_0xb169('0x3'));var db=require(_0xb169('0x4'))['db'];var utils=require(_0xb169('0x5'));var logger=require(_0xb169('0x6'))(_0xb169('0x7'));var config=require(_0xb169('0x8'));var jayson=require(_0xb169('0x9'));var client=jayson[_0xb169('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa67089,_0x542233,_0x15e374){return new BPromise(function(_0x372887,_0x528168){return client[_0xb169('0xb')](_0xa67089,_0x15e374)[_0xb169('0xc')](function(_0x59ccb1){logger[_0xb169('0xd')](_0xb169('0xe'),_0x542233,'request\x20sent');logger[_0xb169('0xf')](_0xb169('0x10'),_0x542233,_0xb169('0x11'),JSON[_0xb169('0x12')](_0x59ccb1));if(_0x59ccb1[_0xb169('0x13')]){if(_0x59ccb1[_0xb169('0x13')][_0xb169('0x14')]===0x1f4){logger[_0xb169('0x13')](_0xb169('0xe'),_0x542233,_0x59ccb1[_0xb169('0x13')]['message']);return _0x528168(_0x59ccb1[_0xb169('0x13')][_0xb169('0x15')]);}logger[_0xb169('0x13')](_0xb169('0xe'),_0x542233,_0x59ccb1[_0xb169('0x13')][_0xb169('0x15')]);return _0x372887(_0x59ccb1['error']['message']);}else{logger[_0xb169('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x542233,_0xb169('0x11'));_0x372887(_0x59ccb1[_0xb169('0x16')][_0xb169('0x15')]);}})[_0xb169('0x17')](function(_0x417c1f){logger[_0xb169('0x13')](_0xb169('0xe'),_0x542233,_0x417c1f);_0x528168(_0x417c1f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3d44573..8b27f85 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 _0x2cfc=['update','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','/:id','show','preview','/:id/run','isAuthenticated','run','/:id/query','query','post','put'];(function(_0x527733,_0x4266c1){var _0x20cf91=function(_0x139e39){while(--_0x139e39){_0x527733['push'](_0x527733['shift']());}};_0x20cf91(++_0x4266c1);}(_0x2cfc,0x1e2));var _0xc2cf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2cfc[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc2cf('0x0'));var util=require(_0xc2cf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc2cf('0x2'));var interaction=require(_0xc2cf('0x3'));var config=require(_0xc2cf('0x4'));var controller=require(_0xc2cf('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc2cf('0x6')]);router[_0xc2cf('0x7')](_0xc2cf('0x8'),auth['isAuthenticated'](),controller[_0xc2cf('0x9')]);router[_0xc2cf('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0xc2cf('0xa')]);router[_0xc2cf('0x7')](_0xc2cf('0xb'),auth[_0xc2cf('0xc')](),controller[_0xc2cf('0xd')]);router[_0xc2cf('0x7')](_0xc2cf('0xe'),auth[_0xc2cf('0xc')](),controller[_0xc2cf('0xf')]);router[_0xc2cf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc2cf('0x11')]('/:id',auth[_0xc2cf('0xc')](),controller[_0xc2cf('0x12')]);router['delete'](_0xc2cf('0x8'),auth[_0xc2cf('0xc')](),controller['destroy']);module[_0xc2cf('0x13')]=router; \ No newline at end of file +var _0x9f32=['destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete'];(function(_0x2d778d,_0x453b15){var _0x41d05b=function(_0x2ebeef){while(--_0x2ebeef){_0x2d778d['push'](_0x2d778d['shift']());}};_0x41d05b(++_0x453b15);}(_0x9f32,0x169));var _0x29f3=function(_0x119f7b,_0x391db2){_0x119f7b=_0x119f7b-0x0;var _0x2782f0=_0x9f32[_0x119f7b];return _0x2782f0;};'use strict';var multer=require(_0x29f3('0x0'));var util=require(_0x29f3('0x1'));var path=require(_0x29f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x29f3('0x3'));var router=express[_0x29f3('0x4')]();var auth=require(_0x29f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x29f3('0x6'));var controller=require(_0x29f3('0x7'));router['get']('/',auth[_0x29f3('0x8')](),controller[_0x29f3('0x9')]);router[_0x29f3('0xa')](_0x29f3('0xb'),auth[_0x29f3('0x8')](),controller[_0x29f3('0xc')]);router[_0x29f3('0xa')]('/:id/preview',auth[_0x29f3('0x8')](),controller[_0x29f3('0xd')]);router[_0x29f3('0xa')](_0x29f3('0xe'),auth[_0x29f3('0x8')](),controller[_0x29f3('0xf')]);router[_0x29f3('0xa')](_0x29f3('0x10'),auth[_0x29f3('0x8')](),controller[_0x29f3('0x11')]);router[_0x29f3('0x12')]('/',auth['isAuthenticated'](),controller[_0x29f3('0x13')]);router[_0x29f3('0x14')](_0x29f3('0xb'),auth['isAuthenticated'](),controller[_0x29f3('0x15')]);router[_0x29f3('0x16')](_0x29f3('0xb'),auth[_0x29f3('0x8')](),controller[_0x29f3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 52f9a78..466a663 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 _0xc6b5=['STRING','TEXT','sequelize','exports'];(function(_0x485481,_0x24e9cb){var _0x560311=function(_0x24d89c){while(--_0x24d89c){_0x485481['push'](_0x485481['shift']());}};_0x560311(++_0x24e9cb);}(_0xc6b5,0xe6));var _0x5c6b=function(_0x1b7d33,_0x3f0b17){_0x1b7d33=_0x1b7d33-0x0;var _0x369861=_0xc6b5[_0x1b7d33];return _0x369861;};'use strict';var Sequelize=require(_0x5c6b('0x0'));module[_0x5c6b('0x1')]={'name':{'type':Sequelize[_0x5c6b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5c6b('0x2')]},'parent':{'type':Sequelize[_0x5c6b('0x2')]},'table':{'type':Sequelize[_0x5c6b('0x2')]},'conditions':{'type':Sequelize[_0x5c6b('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0611=['sequelize','exports','STRING','TEXT'];(function(_0x1e243a,_0x412fd0){var _0x561939=function(_0x25b5f8){while(--_0x25b5f8){_0x1e243a['push'](_0x1e243a['shift']());}};_0x561939(++_0x412fd0);}(_0x0611,0xc4));var _0x1061=function(_0x27cd63,_0x3b10e2){_0x27cd63=_0x27cd63-0x0;var _0x3dea21=_0x0611[_0x27cd63];return _0x3dea21;};'use strict';var Sequelize=require(_0x1061('0x0'));module[_0x1061('0x1')]={'name':{'type':Sequelize[_0x1061('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x1061('0x2')]},'conditions':{'type':Sequelize[_0x1061('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a005bd7..23bd1da 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 _0xf04b=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','includes','%s.%s\x20=\x20%s.%s','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','ROUND(%s)','IS\x20NOT\x20NULL','value','clone','output','web','fullPath','%s-%s.%s','randomstring','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','operator','alias','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','reject','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','map','AnalyticDefaultReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','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)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize'];(function(_0x46972d,_0x483c13){var _0x502dac=function(_0x124c59){while(--_0x124c59){_0x46972d['push'](_0x46972d['shift']());}};_0x502dac(++_0x483c13);}(_0xf04b,0x17a));var _0xbf04=function(_0x28220f,_0x3df48c){_0x28220f=_0x28220f-0x0;var _0x2ff5ef=_0xf04b[_0x28220f];return _0x2ff5ef;};'use strict';var pdf=require(_0xbf04('0x0'));var emlformat=require(_0xbf04('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf04('0x2'));var moment=require(_0xbf04('0x3'));var BPromise=require(_0xbf04('0x4'));var Mustache=require(_0xbf04('0x5'));var util=require(_0xbf04('0x6'));var path=require('path');var sox=require(_0xbf04('0x7'));var csv=require(_0xbf04('0x8'));var ejs=require(_0xbf04('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbf04('0xa'));var crypto=require(_0xbf04('0xb'));var jsforce=require(_0xbf04('0xc'));var deskjs=require(_0xbf04('0xd'));var toCsv=require(_0xbf04('0x8'));var querystring=require('querystring');var Papa=require(_0xbf04('0xe'));var Redis=require(_0xbf04('0xf'));var authService=require(_0xbf04('0x10'));var qs=require(_0xbf04('0x11'));var as=require(_0xbf04('0x12'));var hardwareService=require(_0xbf04('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbf04('0x14'));var config=require(_0xbf04('0x15'));var licenseUtil=require(_0xbf04('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbf04('0x17'))['dbH'];function respondWithStatusCode(_0x2c4a8b,_0x4dc83b){_0x4dc83b=_0x4dc83b||0xcc;return function(_0x4e6be4){if(_0x4e6be4){return _0x2c4a8b[_0xbf04('0x18')](_0x4dc83b);}return _0x2c4a8b[_0xbf04('0x19')](_0x4dc83b)[_0xbf04('0x1a')]();};}function respondWithResult(_0x2bb6da,_0x4f50de){_0x4f50de=_0x4f50de||0xc8;return function(_0x5917d6){if(_0x5917d6){return _0x2bb6da[_0xbf04('0x19')](_0x4f50de)[_0xbf04('0x1b')](_0x5917d6);}};}function respondWithFilteredResult(_0x2fb3f6,_0x3c3e4d){return function(_0x5d5473){if(_0x5d5473){var _0x3f186e=_0x5d5473['count'],_0x41f3c2=_0x3c3e4d[_0xbf04('0x1c')],_0x5f27a5=_0x3c3e4d[_0xbf04('0x1c')]+_0x3c3e4d['limit'],_0x152b59;if(_0x5f27a5>=_0x3f186e){_0x5f27a5=_0x3f186e;_0x152b59=0xc8;}else{_0x152b59=0xce;}_0x2fb3f6[_0xbf04('0x19')](_0x152b59);return _0x2fb3f6['set']('Content-Range',_0x41f3c2+'-'+_0x5f27a5+'/'+_0x3f186e)[_0xbf04('0x1b')](_0x5d5473);}return null;};}function patchUpdates(_0x2db575){return function(_0x30bf42){try{jsonpatch['apply'](_0x30bf42,_0x2db575,!![]);}catch(_0x50c8a5){return BPromise[_0xbf04('0x1d')](_0x50c8a5);}return _0x30bf42['save']();};}function saveUpdates(_0x24a201,_0x275a7f){return function(_0x27310a){if(_0x27310a){return _0x27310a['update'](_0x24a201)[_0xbf04('0x1e')](function(_0x2c2ec6){return _0x2c2ec6;});}return null;};}function removeEntity(_0x4a6af2,_0x1199b){return function(_0x5ed95a){if(_0x5ed95a){return _0x5ed95a[_0xbf04('0x1f')]()[_0xbf04('0x1e')](function(){var _0x214d0d=_0x5ed95a[_0xbf04('0x20')]({'plain':!![]});var _0x27ad18=_0xbf04('0x21');return db[_0xbf04('0x22')][_0xbf04('0x1f')]({'where':{'type':_0x27ad18,'resourceId':_0x214d0d['id']}})['then'](function(){return _0x5ed95a;});})[_0xbf04('0x1e')](function(){_0x4a6af2[_0xbf04('0x19')](0xcc)[_0xbf04('0x1a')]();});}};}function handleEntityNotFound(_0xebda28,_0x212b56){return function(_0x5aa8ab){if(!_0x5aa8ab){_0xebda28['sendStatus'](0x194);}return _0x5aa8ab;};}function handleError(_0x5d3c85,_0x5656ea){_0x5656ea=_0x5656ea||0x1f4;return function(_0x1ffcec){logger[_0xbf04('0x23')](_0x1ffcec[_0xbf04('0x24')]);if(_0x1ffcec[_0xbf04('0x25')]){delete _0x1ffcec[_0xbf04('0x25')];}_0x5d3c85[_0xbf04('0x19')](_0x5656ea)[_0xbf04('0x26')](_0x1ffcec);};}exports['index']=function(_0x336b75,_0x5d19a7){var _0x4ac2f3={},_0x5159e8={},_0x566abf={'count':0x0,'rows':[]};var _0x4da11c=_[_0xbf04('0x27')](db[_0xbf04('0x28')]['rawAttributes'],function(_0x458e4f){return{'name':_0x458e4f[_0xbf04('0x29')],'type':_0x458e4f[_0xbf04('0x2a')][_0xbf04('0x2b')]};});_0x5159e8['model']=_['map'](_0x4da11c,_0xbf04('0x25'));_0x5159e8[_0xbf04('0x2c')]=_[_0xbf04('0x2d')](_0x336b75[_0xbf04('0x2c')]);_0x5159e8['filters']=_[_0xbf04('0x2e')](_0x5159e8[_0xbf04('0x2f')],_0x5159e8[_0xbf04('0x2c')]);_0x4ac2f3[_0xbf04('0x30')]=_[_0xbf04('0x2e')](_0x5159e8[_0xbf04('0x2f')],qs[_0xbf04('0x31')](_0x336b75[_0xbf04('0x2c')]['fields']));_0x4ac2f3[_0xbf04('0x30')]=_0x4ac2f3[_0xbf04('0x30')][_0xbf04('0x32')]?_0x4ac2f3[_0xbf04('0x30')]:_0x5159e8[_0xbf04('0x2f')];if(!_0x336b75[_0xbf04('0x2c')][_0xbf04('0x33')]('nolimit')){_0x4ac2f3[_0xbf04('0x34')]=qs[_0xbf04('0x34')](_0x336b75[_0xbf04('0x2c')]['limit']);_0x4ac2f3['offset']=qs[_0xbf04('0x1c')](_0x336b75[_0xbf04('0x2c')][_0xbf04('0x1c')]);}_0x4ac2f3[_0xbf04('0x35')]=qs['sort'](_0x336b75[_0xbf04('0x2c')][_0xbf04('0x36')]);_0x4ac2f3[_0xbf04('0x37')]=qs[_0xbf04('0x38')](_[_0xbf04('0x39')](_0x336b75['query'],_0x5159e8[_0xbf04('0x38')]),_0x4da11c);if(_0x336b75[_0xbf04('0x2c')][_0xbf04('0x3a')]){_0x4ac2f3['where']=_[_0xbf04('0x3b')](_0x4ac2f3[_0xbf04('0x37')],{'$or':_[_0xbf04('0x27')](_0x4da11c,function(_0x43fdb4){if(_0x43fdb4['type']!==_0xbf04('0x3c')){var _0x2d4a97={};_0x2d4a97[_0x43fdb4[_0xbf04('0x25')]]={'$like':'%'+_0x336b75[_0xbf04('0x2c')][_0xbf04('0x3a')]+'%'};return _0x2d4a97;}})});}_0x4ac2f3=_[_0xbf04('0x3b')]({},_0x4ac2f3,_0x336b75['options']);var _0x14bcd3={'where':_0x4ac2f3[_0xbf04('0x37')]};return db[_0xbf04('0x28')]['count'](_0x14bcd3)['then'](function(_0x323a31){_0x566abf[_0xbf04('0x3d')]=_0x323a31;if(_0x336b75[_0xbf04('0x2c')][_0xbf04('0x3e')]){_0x4ac2f3[_0xbf04('0x3f')]=[{'all':!![]}];}return db[_0xbf04('0x28')][_0xbf04('0x40')](_0x4ac2f3);})[_0xbf04('0x1e')](function(_0xbafbe6){_0x566abf['rows']=_0xbafbe6;return _0x566abf;})[_0xbf04('0x1e')](respondWithFilteredResult(_0x5d19a7,_0x4ac2f3))[_0xbf04('0x41')](handleError(_0x5d19a7,null));};exports[_0xbf04('0x42')]=function(_0x3b9a3a,_0x4f22a2){var _0x2b2a1a={'raw':!![],'where':{'id':_0x3b9a3a[_0xbf04('0x43')]['id']}},_0x96e1c2={};_0x96e1c2['model']=_['keys'](db[_0xbf04('0x28')][_0xbf04('0x44')]);_0x96e1c2[_0xbf04('0x2c')]=_[_0xbf04('0x2d')](_0x3b9a3a[_0xbf04('0x2c')]);_0x96e1c2[_0xbf04('0x38')]=_['intersection'](_0x96e1c2['model'],_0x96e1c2['query']);_0x2b2a1a[_0xbf04('0x30')]=_[_0xbf04('0x2e')](_0x96e1c2[_0xbf04('0x2f')],qs[_0xbf04('0x31')](_0x3b9a3a[_0xbf04('0x2c')][_0xbf04('0x31')]));_0x2b2a1a[_0xbf04('0x30')]=_0x2b2a1a[_0xbf04('0x30')][_0xbf04('0x32')]?_0x2b2a1a['attributes']:_0x96e1c2['model'];if(_0x3b9a3a['query'][_0xbf04('0x3e')]){_0x2b2a1a['include']=[{'all':!![]}];}_0x2b2a1a=_[_0xbf04('0x3b')]({},_0x2b2a1a,_0x3b9a3a[_0xbf04('0x45')]);return db['AnalyticDefaultReport'][_0xbf04('0x46')](_0x2b2a1a)[_0xbf04('0x1e')](handleEntityNotFound(_0x4f22a2,null))[_0xbf04('0x1e')](respondWithResult(_0x4f22a2,null))[_0xbf04('0x41')](handleError(_0x4f22a2,null));};exports[_0xbf04('0x47')]=function(_0x5515da,_0x28ba1c){return db['AnalyticDefaultReport'][_0xbf04('0x47')](_0x5515da[_0xbf04('0x48')],{})[_0xbf04('0x1e')](function(_0x2120a8){var _0x59fe05=_0x5515da['user'][_0xbf04('0x20')]({'plain':!![]});if(!_0x59fe05)throw new Error(_0xbf04('0x49'));if(_0x59fe05[_0xbf04('0x4a')]===_0xbf04('0x4b')){var _0x211745=_0x2120a8[_0xbf04('0x20')]({'plain':!![]});var _0x36b239=_0xbf04('0x4c');return db['UserProfileSection'][_0xbf04('0x46')]({'where':{'name':_0x36b239,'userProfileId':_0x59fe05['userProfileId']},'raw':!![]})['then'](function(_0x51f31d){if(_0x51f31d&&_0x51f31d[_0xbf04('0x4d')]===0x0){return db[_0xbf04('0x22')][_0xbf04('0x47')]({'name':_0x211745[_0xbf04('0x25')],'resourceId':_0x211745['id'],'type':'DefaultReports','sectionId':_0x51f31d['id']},{})['then'](function(){return _0x2120a8;});}else{return _0x2120a8;}})['catch'](function(_0x1c87f4){logger[_0xbf04('0x23')](_0xbf04('0x4e'),_0x1c87f4);throw _0x1c87f4;});}return _0x2120a8;})[_0xbf04('0x1e')](respondWithResult(_0x28ba1c,0xc9))['catch'](handleError(_0x28ba1c,null));};exports[_0xbf04('0x4f')]=function(_0x4c05a0,_0x28a9de){if(_0x4c05a0['body']['id']){delete _0x4c05a0[_0xbf04('0x48')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x4c05a0['params']['id']}})[_0xbf04('0x1e')](handleEntityNotFound(_0x28a9de,null))[_0xbf04('0x1e')](saveUpdates(_0x4c05a0[_0xbf04('0x48')],null))[_0xbf04('0x1e')](respondWithResult(_0x28a9de,null))[_0xbf04('0x41')](handleError(_0x28a9de,null));};exports[_0xbf04('0x1f')]=function(_0x4a2802,_0x464d3d){return db[_0xbf04('0x28')][_0xbf04('0x46')]({'where':{'id':_0x4a2802[_0xbf04('0x43')]['id']}})['then'](handleEntityNotFound(_0x464d3d,null))[_0xbf04('0x1e')](removeEntity(_0x464d3d,null))['catch'](handleError(_0x464d3d,null));};exports[_0xbf04('0x50')]=function(_0x5dd3bd,_0x3ef9c3){var _0x295753=0xa;var _0xe2be46=[_0xbf04('0x51'),_0xbf04('0x52'),_0xbf04('0x53'),_0xbf04('0x54')];var _0x51c049={'SUM':_0xbf04('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbf04('0x56'),'MAX':_0xbf04('0x57'),'MIN':'MIN(%s)','AVG':_0xbf04('0x58'),'GROUP_CONCAT':_0xbf04('0x59'),'GROUP_CONCAT ASC':_0xbf04('0x5a'),'GROUP_CONCAT DESC':_0xbf04('0x5b')};var _0x1abc1a={'SEC_TO_TIME':_0xbf04('0x5c'),'DATE':_0xbf04('0x5d'),'HOUR':_0xbf04('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbf04('0x5f')};var _0x4220e0=function(_0x584750){return!_['includes']([_0xbf04('0x60'),'IS\x20NOT\x20NULL',_0xbf04('0x61'),_0xbf04('0x62')],_0x584750);};var _0x2f5f36=function(_0xf2c4f7){if(!_0xf2c4f7||!_0xf2c4f7[_0xbf04('0x63')][_0xbf04('0x32')]){return'';}for(var _0x3d8f86='(',_0x333de1=0x0;_0x333de1<_0xf2c4f7[_0xbf04('0x63')][_0xbf04('0x32')];_0x333de1+=0x1){_0x333de1>0x0&&(_0x3d8f86+='\x20'+_0xf2c4f7['operator']+'\x20');_0x3d8f86+=_0xf2c4f7[_0xbf04('0x63')][_0x333de1][_0xbf04('0x64')]?_0x2f5f36(_0xf2c4f7['rules'][_0x333de1][_0xbf04('0x64')]):_0xf2c4f7['rules'][_0x333de1][_0xbf04('0x65')]+'\x20'+_0xf2c4f7[_0xbf04('0x63')][_0x333de1][_0xbf04('0x66')]+(_0x4220e0(_0xf2c4f7[_0xbf04('0x63')][_0x333de1][_0xbf04('0x66')])?'\x20'+_0xf2c4f7[_0xbf04('0x63')][_0x333de1]['value']:'');}return _0x3d8f86+')';};var _0x200055={'where':{'id':_0x5dd3bd[_0xbf04('0x43')]['id']}},_0x49d0f6,_0x48ac95,_0x3d838b,_0x4054cc,_0x7b362a;_0x200055=_['merge']({},_0x200055,_0x5dd3bd[_0xbf04('0x45')]);return db[_0xbf04('0x28')][_0xbf04('0x46')](_0x200055)[_0xbf04('0x1e')](function(_0x5b6d29){if(_0x5b6d29){_0x49d0f6=_0x5b6d29;return _0x5b6d29[_0xbf04('0x67')]();}return null;})['then'](function(_0x4e5a02){if(_0x4e5a02){if(!_0x4e5a02[_0xbf04('0x32')]){throw new db[(_0xbf04('0x68'))][(_0xbf04('0x69'))](_0xbf04('0x6a'),0x193);}_0x48ac95=_0x4e5a02;return db[_0xbf04('0x6b')][_0xbf04('0x40')]({'raw':!![]});}return null;})[_0xbf04('0x1e')](function(_0x5d647a){if(_0x5d647a){_0x3d838b=_[_0xbf04('0x6c')](_0x5d647a,'id');var _0x1fefce;var _0xe401eb=squel[_0xbf04('0x6d')]();_0xe401eb[_0xbf04('0x6e')](_0x49d0f6[_0xbf04('0x6f')]);for(var _0x2cb61d=0x0;_0x2cb61d<_0x48ac95[_0xbf04('0x32')];_0x2cb61d+=0x1){_0x1fefce=_0x48ac95[_0x2cb61d]['MetricId']?_0x3d838b[_0x48ac95[_0x2cb61d][_0xbf04('0x70')]][_0xbf04('0x71')]:_0x48ac95[_0x2cb61d][_0xbf04('0x65')];_0x1fefce=_0x48ac95[_0x2cb61d][_0xbf04('0x72')]?_[_0xbf04('0x73')](_0x51c049[_0x48ac95[_0x2cb61d]['function']],'%s',_0x1fefce):_0x1fefce;_0x1fefce=_0x48ac95[_0x2cb61d][_0xbf04('0x74')]?_['replace'](_0x1abc1a[_0x48ac95[_0x2cb61d]['format']],'%s',_0x1fefce):_0x1fefce;if(_0x48ac95[_0x2cb61d][_0xbf04('0x75')]){_0xe401eb['group'](_0x1fefce);}_0x48ac95[_0x2cb61d]['orderBy']&&_0xe401eb[_0xbf04('0x35')](_0x1fefce,_0x48ac95[_0x2cb61d][_0xbf04('0x76')]===_0xbf04('0x77')?![]:!![]);_0xe401eb['field'](_0x1fefce,_0x48ac95[_0x2cb61d]['alias']||_0x1fefce);}if(_0x49d0f6['joins']){_0x49d0f6[_0xbf04('0x78')]=JSON[_0xbf04('0x79')](_0x49d0f6[_0xbf04('0x78')]);for(var _0xf507b6=0x0;_0xf507b6<_0x49d0f6[_0xbf04('0x78')]['length'];_0xf507b6+=0x1){if(_0x49d0f6['joins'][_0xf507b6]['type']&&_[_0xbf04('0x7a')](_0xe2be46,_0x49d0f6[_0xbf04('0x78')][_0xf507b6][_0xbf04('0x2a')])&&_0x49d0f6[_0xbf04('0x78')][_0xf507b6]['parentKey']&&_0x49d0f6[_0xbf04('0x78')][_0xf507b6]['foreignTable']&&_0x49d0f6[_0xbf04('0x78')][_0xf507b6]['foreignKey']){_0xe401eb[_0x49d0f6[_0xbf04('0x78')][_0xf507b6]['type']](_0x49d0f6[_0xbf04('0x78')][_0xf507b6]['foreignTable'],null,util[_0xbf04('0x74')](_0xbf04('0x7b'),_0x49d0f6[_0xbf04('0x6f')],_0x49d0f6[_0xbf04('0x78')][_0xf507b6][_0xbf04('0x7c')],_0x49d0f6[_0xbf04('0x78')][_0xf507b6][_0xbf04('0x7d')],_0x49d0f6[_0xbf04('0x78')][_0xf507b6][_0xbf04('0x7e')]));}}}if(_0x49d0f6['conditions']){_0x49d0f6[_0xbf04('0x7f')]=JSON['parse'](_0x49d0f6[_0xbf04('0x7f')]);_0xe401eb['where'](_0x2f5f36(_0x49d0f6['conditions']['group']));}_0x7b362a=_0xe401eb['clone']();_0xe401eb[_0xbf04('0x34')](_0x295753);_0xe401eb[_0xbf04('0x1c')](0x0);logger[_0xbf04('0x80')](_0xbf04('0x81'),_0xe401eb[_0xbf04('0x82')]());return dbH[_0xbf04('0x83')]['query'](_0xe401eb[_0xbf04('0x82')](),{'type':dbH[_0xbf04('0x83')][_0xbf04('0x84')][_0xbf04('0x85')]});}})[_0xbf04('0x1e')](respondWithResult(_0x3ef9c3,null))['catch'](handleError(_0x3ef9c3,null));};function runReport(_0x45e08f,_0x1a31e3,_0x1fa46f){var _0x54c758=_0x1a31e3['name'];var _0x3d4984=0xa;var _0x2b89fe=[_0xbf04('0x51'),_0xbf04('0x52'),_0xbf04('0x53'),_0xbf04('0x54')];var _0x5a73ff={'SUM':'SUM(%s)','COUNT':_0xbf04('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xbf04('0x57'),'MIN':_0xbf04('0x87'),'AVG':_0xbf04('0x58'),'GROUP_CONCAT':_0xbf04('0x59'),'GROUP_CONCAT ASC':_0xbf04('0x5a'),'GROUP_CONCAT DESC':_0xbf04('0x5b')};var _0x430470={'SEC_TO_TIME':_0xbf04('0x5c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xbf04('0x88'),'UNIX_TIMESTAMP':_0xbf04('0x5f')};var _0x261002=function(_0x141cc9){return!_[_0xbf04('0x7a')]([_0xbf04('0x60'),_0xbf04('0x89'),'IS\x20EMPTY',_0xbf04('0x62')],_0x141cc9);};var _0x563caa=function(_0x8bd5ca){if(!_0x8bd5ca||!_0x8bd5ca[_0xbf04('0x63')][_0xbf04('0x32')]){return'';}for(var _0x15d339='(',_0x1c41be=0x0;_0x1c41be<_0x8bd5ca[_0xbf04('0x63')][_0xbf04('0x32')];_0x1c41be+=0x1){_0x1c41be>0x0&&(_0x15d339+='\x20'+_0x8bd5ca['operator']+'\x20');_0x15d339+=_0x8bd5ca['rules'][_0x1c41be]['group']?_0x563caa(_0x8bd5ca[_0xbf04('0x63')][_0x1c41be][_0xbf04('0x64')]):_0x8bd5ca[_0xbf04('0x63')][_0x1c41be]['field']+'\x20'+_0x8bd5ca[_0xbf04('0x63')][_0x1c41be][_0xbf04('0x66')]+(_0x261002(_0x8bd5ca[_0xbf04('0x63')][_0x1c41be][_0xbf04('0x66')])?'\x20'+_0x8bd5ca[_0xbf04('0x63')][_0x1c41be][_0xbf04('0x8a')]:'');}return _0x15d339+')';};var _0x3f9b99={'where':{'id':_0x45e08f['id']}},_0x5b813a,_0x141dc2,_0x528d51,_0x9749a5,_0xa5da19;_0x3f9b99=_[_0xbf04('0x3b')]({},_0x3f9b99,_0x1fa46f);return db[_0xbf04('0x28')][_0xbf04('0x46')](_0x3f9b99)['then'](function(_0x2cad8a){if(_0x2cad8a){_0x5b813a=_0x2cad8a;return _0x2cad8a[_0xbf04('0x67')]();}return null;})[_0xbf04('0x1e')](function(_0x2076a4){if(_0x2076a4){if(!_0x2076a4[_0xbf04('0x32')]){throw new db[(_0xbf04('0x68'))][(_0xbf04('0x69'))](_0xbf04('0x6a'),0x193);}_0x141dc2=_0x2076a4;return db[_0xbf04('0x6b')][_0xbf04('0x40')]({'raw':!![]});}return null;})['then'](function(_0x19bbe4){if(_0x19bbe4){_0x528d51=_[_0xbf04('0x6c')](_0x19bbe4,'id');var _0x5c88ba;var _0x3c46e2=squel[_0xbf04('0x6d')]();_0x3c46e2['from'](_0x5b813a[_0xbf04('0x6f')]);for(var _0x1d0d03=0x0;_0x1d0d03<_0x141dc2[_0xbf04('0x32')];_0x1d0d03+=0x1){_0x5c88ba=_0x141dc2[_0x1d0d03]['MetricId']?_0x528d51[_0x141dc2[_0x1d0d03][_0xbf04('0x70')]]['metric']:_0x141dc2[_0x1d0d03][_0xbf04('0x65')];_0x5c88ba=_0x141dc2[_0x1d0d03][_0xbf04('0x72')]?_[_0xbf04('0x73')](_0x5a73ff[_0x141dc2[_0x1d0d03][_0xbf04('0x72')]],'%s',_0x5c88ba):_0x5c88ba;_0x5c88ba=_0x141dc2[_0x1d0d03][_0xbf04('0x74')]?_[_0xbf04('0x73')](_0x430470[_0x141dc2[_0x1d0d03][_0xbf04('0x74')]],'%s',_0x5c88ba):_0x5c88ba;if(_0x141dc2[_0x1d0d03][_0xbf04('0x75')]){_0x3c46e2['group'](_0x5c88ba);}_0x141dc2[_0x1d0d03][_0xbf04('0x76')]&&_0x3c46e2['order'](_0x5c88ba,_0x141dc2[_0x1d0d03]['orderBy']===_0xbf04('0x77')?![]:!![]);_0x3c46e2[_0xbf04('0x65')](_0x5c88ba,_0x141dc2[_0x1d0d03]['alias']||_0x5c88ba);}if(_0x5b813a['joins']){_0x5b813a[_0xbf04('0x78')]=JSON[_0xbf04('0x79')](_0x5b813a['joins']);for(var _0x410c6b=0x0;_0x410c6b<_0x5b813a[_0xbf04('0x78')][_0xbf04('0x32')];_0x410c6b+=0x1){if(_0x5b813a['joins'][_0x410c6b]['type']&&_[_0xbf04('0x7a')](_0x2b89fe,_0x5b813a['joins'][_0x410c6b][_0xbf04('0x2a')])&&_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x7c')]&&_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x7d')]&&_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x7e')]){_0x3c46e2[_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x2a')]](_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x7d')],null,util[_0xbf04('0x74')]('%s.%s\x20=\x20%s.%s',_0x5b813a['table'],_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x7c')],_0x5b813a[_0xbf04('0x78')][_0x410c6b]['foreignTable'],_0x5b813a[_0xbf04('0x78')][_0x410c6b][_0xbf04('0x7e')]));}}}if(_0x5b813a['conditions']){_0x5b813a[_0xbf04('0x7f')]=JSON['parse'](_0x5b813a['conditions']);_0x3c46e2[_0xbf04('0x37')](_0x563caa(_0x5b813a[_0xbf04('0x7f')][_0xbf04('0x64')]));}_0xa5da19=_0x3c46e2[_0xbf04('0x8b')]();_0x3c46e2[_0xbf04('0x34')](_0x3d4984);_0x3c46e2[_0xbf04('0x1c')](0x0);return;}})['then'](function(){if(_0x1a31e3[_0xbf04('0x8c')]===_0xbf04('0x8d')){return null;}var _0x1f7352=_[_0xbf04('0x3b')](_0x1a31e3,{'name':_0x1a31e3[_0xbf04('0x8e')]||_0x1a31e3[_0xbf04('0x25')]||_0x5b813a[_0xbf04('0x25')],'basename':_0x54c758,'savename':util[_0xbf04('0x74')](_0xbf04('0x8f'),_0x1a31e3[_0xbf04('0x25')]||_0x5b813a[_0xbf04('0x25')],require(_0xbf04('0x90'))['generate'](0x4),_0x1a31e3[_0xbf04('0x8c')]||'csv'),'reportId':_0x5b813a['id'],'reportType':'default'});return db[_0xbf04('0x91')][_0xbf04('0x47')](_0x1f7352,{'raw':!![]});})[_0xbf04('0x1e')](function(_0x5c4c04){if(_0x5b813a[_0xbf04('0x6f')]===_0xbf04('0x92')){_0xa5da19[_0xbf04('0x37')](_0x5b813a['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1a31e3[_0xbf04('0x93')],_0x1a31e3[_0xbf04('0x94')]);}else{_0xa5da19[_0xbf04('0x37')](_0x5b813a[_0xbf04('0x6f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a31e3['startDate'],_0x1a31e3['endDate']);}if(_0x5c4c04){logger[_0xbf04('0x95')](_0xbf04('0x96'),_0xa5da19[_0xbf04('0x82')]());require(_0xbf04('0x97'))[_0xbf04('0x98')](path[_0xbf04('0x51')](__dirname,_0xbf04('0x99'),_0x5c4c04[_0xbf04('0x8c')]),[_0x5c4c04['id'],_0xa5da19[_0xbf04('0x82')](),path[_0xbf04('0x51')](__dirname,'../../files/reports',_0x5c4c04[_0xbf04('0x9a')]),_0x54c758]);return _0x5c4c04;}else{var _0x203ad1=squel[_0xbf04('0x6d')]();_0x203ad1[_0xbf04('0x6e')]('('+_0xa5da19[_0xbf04('0x82')]()+')',_0xbf04('0x9b'));_0x203ad1['field'](_0xbf04('0x9c'),_0xbf04('0x3d'));_0xa5da19[_0xbf04('0x34')](_0x1a31e3['limit']||_0x3d4984);_0xa5da19[_0xbf04('0x1c')](_0x1a31e3[_0xbf04('0x1c')]||0x0);return dbH[_0xbf04('0x83')][_0xbf04('0x2c')](_0x203ad1[_0xbf04('0x82')](),{'type':dbH['sequelize'][_0xbf04('0x84')]['SELECT']})[_0xbf04('0x1e')](function(_0x5350a1){if(!_0x5350a1[_0xbf04('0x32')]){_0x9749a5=0x0;}else{_0x9749a5=_0x5350a1[0x0]['count']||0x0;}return dbH[_0xbf04('0x83')][_0xbf04('0x2c')](_0xa5da19['toString'](),{'type':dbH[_0xbf04('0x83')]['QueryTypes'][_0xbf04('0x85')]});})[_0xbf04('0x1e')](function(_0x46d9f5){return{'rows':_0x46d9f5||[],'count':_0x9749a5};});}});}exports[_0xbf04('0x9d')]=function(_0x1a866b,_0x200f4f){return runReport(_0x1a866b[_0xbf04('0x43')],_0x1a866b['query'],_0x1a866b[_0xbf04('0x45')])[_0xbf04('0x1e')](respondWithResult(_0x200f4f,null))[_0xbf04('0x41')](handleError(_0x200f4f,null));};exports[_0xbf04('0x9e')]=runReport;exports[_0xbf04('0x2c')]=function(_0x8aab80,_0x141bc3){var _0x167a4e=0xa;var _0x26259f=[_0xbf04('0x51'),_0xbf04('0x52'),_0xbf04('0x53'),_0xbf04('0x54')];var _0x4f2f25={'SUM':_0xbf04('0x55'),'COUNT':_0xbf04('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xbf04('0x87'),'AVG':_0xbf04('0x58'),'GROUP_CONCAT':_0xbf04('0x59'),'GROUP_CONCAT ASC':_0xbf04('0x5a'),'GROUP_CONCAT DESC':_0xbf04('0x5b')};var _0x4e0a95={'SEC_TO_TIME':_0xbf04('0x5c'),'DATE':_0xbf04('0x5d'),'HOUR':_0xbf04('0x5e'),'ROUND':_0xbf04('0x88'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3334ca=function(_0x2fbb69){return!_[_0xbf04('0x7a')]([_0xbf04('0x60'),_0xbf04('0x89'),_0xbf04('0x61'),_0xbf04('0x62')],_0x2fbb69);};var _0x570d0d=function(_0x1ac0b7){if(!_0x1ac0b7||!_0x1ac0b7['rules'][_0xbf04('0x32')]){return'';}for(var _0x7cacc1='(',_0x4ed078=0x0;_0x4ed078<_0x1ac0b7['rules'][_0xbf04('0x32')];_0x4ed078+=0x1){_0x4ed078>0x0&&(_0x7cacc1+='\x20'+_0x1ac0b7[_0xbf04('0x9f')]+'\x20');_0x7cacc1+=_0x1ac0b7['rules'][_0x4ed078][_0xbf04('0x64')]?_0x570d0d(_0x1ac0b7[_0xbf04('0x63')][_0x4ed078][_0xbf04('0x64')]):_0x1ac0b7['rules'][_0x4ed078][_0xbf04('0x65')]+'\x20'+_0x1ac0b7[_0xbf04('0x63')][_0x4ed078][_0xbf04('0x66')]+(_0x3334ca(_0x1ac0b7[_0xbf04('0x63')][_0x4ed078][_0xbf04('0x66')])?'\x20'+_0x1ac0b7[_0xbf04('0x63')][_0x4ed078][_0xbf04('0x8a')]:'');}return _0x7cacc1+')';};var _0x1b9d9b={'where':{'id':_0x8aab80['params']['id']}},_0x32f95b,_0x364182,_0x57c040,_0x340862,_0x332c12;_0x1b9d9b=_['merge']({},_0x1b9d9b,_0x8aab80['options']);return db[_0xbf04('0x28')][_0xbf04('0x46')](_0x1b9d9b)[_0xbf04('0x1e')](function(_0x3e6324){if(_0x3e6324){_0x32f95b=_0x3e6324;return _0x3e6324[_0xbf04('0x67')]();}return null;})[_0xbf04('0x1e')](function(_0x5ceb3c){if(_0x5ceb3c){if(!_0x5ceb3c[_0xbf04('0x32')]){throw new db[(_0xbf04('0x68'))][(_0xbf04('0x69'))](_0xbf04('0x6a'),0x193);}_0x364182=_0x5ceb3c;return db[_0xbf04('0x6b')][_0xbf04('0x40')]({'raw':!![]});}return null;})[_0xbf04('0x1e')](function(_0x438b6e){if(_0x438b6e){_0x57c040=_[_0xbf04('0x6c')](_0x438b6e,'id');var _0x2f4dd;var _0x1ca4ec=squel[_0xbf04('0x6d')]();_0x1ca4ec[_0xbf04('0x6e')](_0x32f95b[_0xbf04('0x6f')]);for(var _0x37e2c0=0x0;_0x37e2c0<_0x364182[_0xbf04('0x32')];_0x37e2c0+=0x1){_0x2f4dd=_0x364182[_0x37e2c0][_0xbf04('0x70')]?_0x57c040[_0x364182[_0x37e2c0][_0xbf04('0x70')]]['metric']:_0x364182[_0x37e2c0]['field'];_0x2f4dd=_0x364182[_0x37e2c0][_0xbf04('0x72')]?_[_0xbf04('0x73')](_0x4f2f25[_0x364182[_0x37e2c0]['function']],'%s',_0x2f4dd):_0x2f4dd;_0x2f4dd=_0x364182[_0x37e2c0][_0xbf04('0x74')]?_[_0xbf04('0x73')](_0x4e0a95[_0x364182[_0x37e2c0][_0xbf04('0x74')]],'%s',_0x2f4dd):_0x2f4dd;if(_0x364182[_0x37e2c0][_0xbf04('0x75')]){_0x1ca4ec[_0xbf04('0x64')](_0x2f4dd);}_0x364182[_0x37e2c0][_0xbf04('0x76')]&&_0x1ca4ec[_0xbf04('0x35')](_0x2f4dd,_0x364182[_0x37e2c0][_0xbf04('0x76')]===_0xbf04('0x77')?![]:!![]);_0x1ca4ec['field'](_0x2f4dd,_0x364182[_0x37e2c0][_0xbf04('0xa0')]||_0x2f4dd);}if(_0x32f95b[_0xbf04('0x78')]){_0x32f95b[_0xbf04('0x78')]=JSON[_0xbf04('0x79')](_0x32f95b[_0xbf04('0x78')]);for(var _0x4b9ab9=0x0;_0x4b9ab9<_0x32f95b['joins'][_0xbf04('0x32')];_0x4b9ab9+=0x1){if(_0x32f95b[_0xbf04('0x78')][_0x4b9ab9]['type']&&_[_0xbf04('0x7a')](_0x26259f,_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x2a')])&&_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x7c')]&&_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x7d')]&&_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x7e')]){_0x1ca4ec[_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x2a')]](_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x7d')],null,util[_0xbf04('0x74')]('%s.%s\x20=\x20%s.%s',_0x32f95b[_0xbf04('0x6f')],_0x32f95b['joins'][_0x4b9ab9][_0xbf04('0x7c')],_0x32f95b[_0xbf04('0x78')][_0x4b9ab9][_0xbf04('0x7d')],_0x32f95b[_0xbf04('0x78')][_0x4b9ab9]['foreignKey']));}}}if(_0x32f95b[_0xbf04('0x7f')]){_0x32f95b[_0xbf04('0x7f')]=JSON[_0xbf04('0x79')](_0x32f95b[_0xbf04('0x7f')]);_0x1ca4ec[_0xbf04('0x37')](_0x570d0d(_0x32f95b[_0xbf04('0x7f')]['group']));}_0x332c12=_0x1ca4ec[_0xbf04('0x8b')]();_0x1ca4ec['limit'](_0x167a4e);_0x1ca4ec[_0xbf04('0x1c')](0x0);logger[_0xbf04('0x80')](_0xbf04('0x81'),_0x1ca4ec[_0xbf04('0x82')]());return dbH['sequelize'][_0xbf04('0x2c')](_0x1ca4ec[_0xbf04('0x82')](),{'type':dbH[_0xbf04('0x83')]['QueryTypes'][_0xbf04('0x85')]});}})[_0xbf04('0x1e')](function(){return{'sql':_0x332c12[_0xbf04('0x82')]()};})[_0xbf04('0x1e')](respondWithResult(_0x141bc3,null))['catch'](handleError(_0x141bc3,null));}; \ No newline at end of file +var _0xc8fa=['json','count','offset','limit','Content-Range','reject','save','update','then','destroy','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','AnalyticDefaultReport','includeAll','findAll','rows','catch','show','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','replace','function','format','groupBy','orderBy','order','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','metric','alias','clone','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','join','../../components/export/','savename','sequelize','run','runReport','IS\x20EMPTY','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status'];(function(_0xf52020,_0x3e15b9){var _0x2b138e=function(_0x26a8fa){while(--_0x26a8fa){_0xf52020['push'](_0xf52020['shift']());}};_0x2b138e(++_0x3e15b9);}(_0xc8fa,0x1e2));var _0xac8f=function(_0x5d0594,_0x3d8ede){_0x5d0594=_0x5d0594-0x0;var _0x179e9a=_0xc8fa[_0x5d0594];return _0x179e9a;};'use strict';var pdf=require(_0xac8f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xac8f('0x1'));var zipdir=require(_0xac8f('0x2'));var jsonpatch=require(_0xac8f('0x3'));var rp=require(_0xac8f('0x4'));var moment=require(_0xac8f('0x5'));var BPromise=require(_0xac8f('0x6'));var Mustache=require(_0xac8f('0x7'));var util=require(_0xac8f('0x8'));var path=require(_0xac8f('0x9'));var sox=require(_0xac8f('0xa'));var csv=require(_0xac8f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xac8f('0xc'));var crypto=require(_0xac8f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xac8f('0xe'));var toCsv=require(_0xac8f('0xb'));var querystring=require('querystring');var Papa=require(_0xac8f('0xf'));var Redis=require(_0xac8f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xac8f('0x11'));var hardwareService=require(_0xac8f('0x12'));var logger=require(_0xac8f('0x13'))(_0xac8f('0x14'));var utils=require(_0xac8f('0x15'));var config=require(_0xac8f('0x16'));var licenseUtil=require(_0xac8f('0x17'));var db=require(_0xac8f('0x18'))['db'];var dbH=require(_0xac8f('0x18'))[_0xac8f('0x19')];function respondWithStatusCode(_0x5bb5ef,_0x5ae90d){_0x5ae90d=_0x5ae90d||0xcc;return function(_0x2809fc){if(_0x2809fc){return _0x5bb5ef['sendStatus'](_0x5ae90d);}return _0x5bb5ef['status'](_0x5ae90d)[_0xac8f('0x1a')]();};}function respondWithResult(_0x54a868,_0x347809){_0x347809=_0x347809||0xc8;return function(_0x526b0e){if(_0x526b0e){return _0x54a868[_0xac8f('0x1b')](_0x347809)[_0xac8f('0x1c')](_0x526b0e);}};}function respondWithFilteredResult(_0x126676,_0x2dd392){return function(_0x4a46a6){if(_0x4a46a6){var _0x3240cb=_0x4a46a6[_0xac8f('0x1d')],_0x2ce43a=_0x2dd392[_0xac8f('0x1e')],_0x2ad07d=_0x2dd392['offset']+_0x2dd392[_0xac8f('0x1f')],_0x2f3174;if(_0x2ad07d>=_0x3240cb){_0x2ad07d=_0x3240cb;_0x2f3174=0xc8;}else{_0x2f3174=0xce;}_0x126676['status'](_0x2f3174);return _0x126676['set'](_0xac8f('0x20'),_0x2ce43a+'-'+_0x2ad07d+'/'+_0x3240cb)['json'](_0x4a46a6);}return null;};}function patchUpdates(_0x2214ab){return function(_0x4e2620){try{jsonpatch['apply'](_0x4e2620,_0x2214ab,!![]);}catch(_0x25ad3f){return BPromise[_0xac8f('0x21')](_0x25ad3f);}return _0x4e2620[_0xac8f('0x22')]();};}function saveUpdates(_0x7d1033,_0x25eabb){return function(_0x345b2d){if(_0x345b2d){return _0x345b2d[_0xac8f('0x23')](_0x7d1033)[_0xac8f('0x24')](function(_0x233ea7){return _0x233ea7;});}return null;};}function removeEntity(_0x34c421,_0x38f0cb){return function(_0x4b3cde){if(_0x4b3cde){return _0x4b3cde[_0xac8f('0x25')]()[_0xac8f('0x24')](function(){var _0x57f7b4=_0x4b3cde['get']({'plain':!![]});var _0x15ec81=_0xac8f('0x26');return db[_0xac8f('0x27')]['destroy']({'where':{'type':_0x15ec81,'resourceId':_0x57f7b4['id']}})[_0xac8f('0x24')](function(){return _0x4b3cde;});})['then'](function(){_0x34c421[_0xac8f('0x1b')](0xcc)[_0xac8f('0x1a')]();});}};}function handleEntityNotFound(_0x4994fa,_0x34116a){return function(_0x248659){if(!_0x248659){_0x4994fa[_0xac8f('0x28')](0x194);}return _0x248659;};}function handleError(_0x2bdc05,_0x1f7518){_0x1f7518=_0x1f7518||0x1f4;return function(_0x56f6b5){logger[_0xac8f('0x29')](_0x56f6b5[_0xac8f('0x2a')]);if(_0x56f6b5[_0xac8f('0x2b')]){delete _0x56f6b5[_0xac8f('0x2b')];}_0x2bdc05[_0xac8f('0x1b')](_0x1f7518)[_0xac8f('0x2c')](_0x56f6b5);};}exports[_0xac8f('0x2d')]=function(_0x114255,_0x1d7bca){var _0x280a7e={},_0x149c2d={},_0x37e4d7={'count':0x0,'rows':[]};var _0x8218f4=_['map'](db['AnalyticDefaultReport'][_0xac8f('0x2e')],function(_0x58213e){return{'name':_0x58213e[_0xac8f('0x2f')],'type':_0x58213e['type'][_0xac8f('0x30')]};});_0x149c2d['model']=_[_0xac8f('0x31')](_0x8218f4,_0xac8f('0x2b'));_0x149c2d[_0xac8f('0x32')]=_[_0xac8f('0x33')](_0x114255[_0xac8f('0x32')]);_0x149c2d[_0xac8f('0x34')]=_[_0xac8f('0x35')](_0x149c2d[_0xac8f('0x36')],_0x149c2d['query']);_0x280a7e[_0xac8f('0x37')]=_['intersection'](_0x149c2d['model'],qs[_0xac8f('0x38')](_0x114255[_0xac8f('0x32')][_0xac8f('0x38')]));_0x280a7e['attributes']=_0x280a7e[_0xac8f('0x37')][_0xac8f('0x39')]?_0x280a7e[_0xac8f('0x37')]:_0x149c2d[_0xac8f('0x36')];if(!_0x114255[_0xac8f('0x32')][_0xac8f('0x3a')](_0xac8f('0x3b'))){_0x280a7e[_0xac8f('0x1f')]=qs['limit'](_0x114255['query']['limit']);_0x280a7e['offset']=qs[_0xac8f('0x1e')](_0x114255[_0xac8f('0x32')]['offset']);}_0x280a7e['order']=qs[_0xac8f('0x3c')](_0x114255['query'][_0xac8f('0x3c')]);_0x280a7e['where']=qs[_0xac8f('0x34')](_['pick'](_0x114255[_0xac8f('0x32')],_0x149c2d[_0xac8f('0x34')]),_0x8218f4);if(_0x114255[_0xac8f('0x32')]['filter']){_0x280a7e[_0xac8f('0x3d')]=_[_0xac8f('0x3e')](_0x280a7e['where'],{'$or':_[_0xac8f('0x31')](_0x8218f4,function(_0x5f0652){if(_0x5f0652[_0xac8f('0x3f')]!==_0xac8f('0x40')){var _0x34b19e={};_0x34b19e[_0x5f0652[_0xac8f('0x2b')]]={'$like':'%'+_0x114255['query'][_0xac8f('0x41')]+'%'};return _0x34b19e;}})});}_0x280a7e=_[_0xac8f('0x3e')]({},_0x280a7e,_0x114255[_0xac8f('0x42')]);var _0x45f9e9={'where':_0x280a7e['where']};return db[_0xac8f('0x43')]['count'](_0x45f9e9)['then'](function(_0x22fed9){_0x37e4d7[_0xac8f('0x1d')]=_0x22fed9;if(_0x114255[_0xac8f('0x32')][_0xac8f('0x44')]){_0x280a7e['include']=[{'all':!![]}];}return db[_0xac8f('0x43')][_0xac8f('0x45')](_0x280a7e);})[_0xac8f('0x24')](function(_0x34dfc1){_0x37e4d7[_0xac8f('0x46')]=_0x34dfc1;return _0x37e4d7;})[_0xac8f('0x24')](respondWithFilteredResult(_0x1d7bca,_0x280a7e))[_0xac8f('0x47')](handleError(_0x1d7bca,null));};exports[_0xac8f('0x48')]=function(_0x42df1b,_0x14410b){var _0x54a549={'raw':!![],'where':{'id':_0x42df1b['params']['id']}},_0x5d0c35={};_0x5d0c35[_0xac8f('0x36')]=_['keys'](db[_0xac8f('0x43')][_0xac8f('0x2e')]);_0x5d0c35['query']=_[_0xac8f('0x33')](_0x42df1b[_0xac8f('0x32')]);_0x5d0c35['filters']=_[_0xac8f('0x35')](_0x5d0c35[_0xac8f('0x36')],_0x5d0c35['query']);_0x54a549[_0xac8f('0x37')]=_[_0xac8f('0x35')](_0x5d0c35[_0xac8f('0x36')],qs['fields'](_0x42df1b[_0xac8f('0x32')][_0xac8f('0x38')]));_0x54a549[_0xac8f('0x37')]=_0x54a549[_0xac8f('0x37')][_0xac8f('0x39')]?_0x54a549[_0xac8f('0x37')]:_0x5d0c35[_0xac8f('0x36')];if(_0x42df1b[_0xac8f('0x32')][_0xac8f('0x44')]){_0x54a549[_0xac8f('0x49')]=[{'all':!![]}];}_0x54a549=_[_0xac8f('0x3e')]({},_0x54a549,_0x42df1b[_0xac8f('0x42')]);return db[_0xac8f('0x43')][_0xac8f('0x4a')](_0x54a549)[_0xac8f('0x24')](handleEntityNotFound(_0x14410b,null))['then'](respondWithResult(_0x14410b,null))['catch'](handleError(_0x14410b,null));};exports[_0xac8f('0x4b')]=function(_0x2f8a42,_0x4ee791){return db[_0xac8f('0x43')][_0xac8f('0x4b')](_0x2f8a42[_0xac8f('0x4c')],{})[_0xac8f('0x24')](function(_0xbd2b33){var _0x24e92f=_0x2f8a42[_0xac8f('0x4d')][_0xac8f('0x4e')]({'plain':!![]});if(!_0x24e92f)throw new Error(_0xac8f('0x4f'));if(_0x24e92f[_0xac8f('0x50')]===_0xac8f('0x4d')){var _0x692061=_0xbd2b33['get']({'plain':!![]});var _0x394e22=_0xac8f('0x51');return db[_0xac8f('0x52')][_0xac8f('0x4a')]({'where':{'name':_0x394e22,'userProfileId':_0x24e92f[_0xac8f('0x53')]},'raw':!![]})[_0xac8f('0x24')](function(_0x5a56a0){if(_0x5a56a0&&_0x5a56a0['autoAssociation']===0x0){return db[_0xac8f('0x27')][_0xac8f('0x4b')]({'name':_0x692061[_0xac8f('0x2b')],'resourceId':_0x692061['id'],'type':_0xac8f('0x26'),'sectionId':_0x5a56a0['id']},{})['then'](function(){return _0xbd2b33;});}else{return _0xbd2b33;}})[_0xac8f('0x47')](function(_0x5bba9a){logger[_0xac8f('0x29')](_0xac8f('0x54'),_0x5bba9a);throw _0x5bba9a;});}return _0xbd2b33;})[_0xac8f('0x24')](respondWithResult(_0x4ee791,0xc9))[_0xac8f('0x47')](handleError(_0x4ee791,null));};exports[_0xac8f('0x23')]=function(_0x19cd34,_0xbce0f7){if(_0x19cd34[_0xac8f('0x4c')]['id']){delete _0x19cd34[_0xac8f('0x4c')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x19cd34[_0xac8f('0x55')]['id']}})[_0xac8f('0x24')](handleEntityNotFound(_0xbce0f7,null))['then'](saveUpdates(_0x19cd34[_0xac8f('0x4c')],null))[_0xac8f('0x24')](respondWithResult(_0xbce0f7,null))[_0xac8f('0x47')](handleError(_0xbce0f7,null));};exports[_0xac8f('0x25')]=function(_0x4799f4,_0xa12626){return db[_0xac8f('0x43')][_0xac8f('0x4a')]({'where':{'id':_0x4799f4[_0xac8f('0x55')]['id']}})[_0xac8f('0x24')](handleEntityNotFound(_0xa12626,null))[_0xac8f('0x24')](removeEntity(_0xa12626,null))[_0xac8f('0x47')](handleError(_0xa12626,null));};exports[_0xac8f('0x56')]=function(_0x2785f4,_0x5ac31d){var _0x2726e7=0xa;var _0xd9ce8b=['join','left_join',_0xac8f('0x57'),_0xac8f('0x58')];var _0x39282f={'SUM':_0xac8f('0x59'),'COUNT':_0xac8f('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac8f('0x5b'),'MIN':_0xac8f('0x5c'),'AVG':_0xac8f('0x5d'),'GROUP_CONCAT':_0xac8f('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac8f('0x5f')};var _0x3af6ff={'SEC_TO_TIME':_0xac8f('0x60'),'DATE':_0xac8f('0x61'),'HOUR':_0xac8f('0x62'),'ROUND':_0xac8f('0x63'),'UNIX_TIMESTAMP':_0xac8f('0x64')};var _0x2be5fa=function(_0x51f42d){return!_[_0xac8f('0x65')]([_0xac8f('0x66'),_0xac8f('0x67'),'IS\x20EMPTY',_0xac8f('0x68')],_0x51f42d);};var _0x2e5539=function(_0x17a0ae){if(!_0x17a0ae||!_0x17a0ae[_0xac8f('0x69')][_0xac8f('0x39')]){return'';}for(var _0x1a0bd4='(',_0x471caa=0x0;_0x471caa<_0x17a0ae[_0xac8f('0x69')][_0xac8f('0x39')];_0x471caa+=0x1){_0x471caa>0x0&&(_0x1a0bd4+='\x20'+_0x17a0ae[_0xac8f('0x6a')]+'\x20');_0x1a0bd4+=_0x17a0ae[_0xac8f('0x69')][_0x471caa][_0xac8f('0x6b')]?_0x2e5539(_0x17a0ae[_0xac8f('0x69')][_0x471caa][_0xac8f('0x6b')]):_0x17a0ae[_0xac8f('0x69')][_0x471caa]['field']+'\x20'+_0x17a0ae[_0xac8f('0x69')][_0x471caa][_0xac8f('0x6c')]+(_0x2be5fa(_0x17a0ae[_0xac8f('0x69')][_0x471caa]['condition'])?'\x20'+_0x17a0ae[_0xac8f('0x69')][_0x471caa][_0xac8f('0x6d')]:'');}return _0x1a0bd4+')';};var _0x244ac5={'where':{'id':_0x2785f4[_0xac8f('0x55')]['id']}},_0x2333e6,_0x23b91d,_0x1faec0,_0x2e0924,_0x23f6ef;_0x244ac5=_[_0xac8f('0x3e')]({},_0x244ac5,_0x2785f4[_0xac8f('0x42')]);return db[_0xac8f('0x43')][_0xac8f('0x4a')](_0x244ac5)[_0xac8f('0x24')](function(_0x261eb9){if(_0x261eb9){_0x2333e6=_0x261eb9;return _0x261eb9['getFields']();}return null;})[_0xac8f('0x24')](function(_0xafdbda){if(_0xafdbda){if(!_0xafdbda['length']){throw new db[(_0xac8f('0x6e'))][(_0xac8f('0x6f'))](_0xac8f('0x70'),0x193);}_0x23b91d=_0xafdbda;return db[_0xac8f('0x71')][_0xac8f('0x45')]({'raw':!![]});}return null;})[_0xac8f('0x24')](function(_0x534758){if(_0x534758){_0x1faec0=_[_0xac8f('0x72')](_0x534758,'id');var _0x531096;var _0x32415e=squel[_0xac8f('0x73')]();_0x32415e[_0xac8f('0x74')](_0x2333e6[_0xac8f('0x75')]);for(var _0x100606=0x0;_0x100606<_0x23b91d['length'];_0x100606+=0x1){_0x531096=_0x23b91d[_0x100606]['MetricId']?_0x1faec0[_0x23b91d[_0x100606][_0xac8f('0x76')]]['metric']:_0x23b91d[_0x100606][_0xac8f('0x77')];_0x531096=_0x23b91d[_0x100606]['function']?_[_0xac8f('0x78')](_0x39282f[_0x23b91d[_0x100606][_0xac8f('0x79')]],'%s',_0x531096):_0x531096;_0x531096=_0x23b91d[_0x100606][_0xac8f('0x7a')]?_['replace'](_0x3af6ff[_0x23b91d[_0x100606][_0xac8f('0x7a')]],'%s',_0x531096):_0x531096;if(_0x23b91d[_0x100606][_0xac8f('0x7b')]){_0x32415e['group'](_0x531096);}_0x23b91d[_0x100606][_0xac8f('0x7c')]&&_0x32415e[_0xac8f('0x7d')](_0x531096,_0x23b91d[_0x100606][_0xac8f('0x7c')]===_0xac8f('0x7e')?![]:!![]);_0x32415e[_0xac8f('0x77')](_0x531096,_0x23b91d[_0x100606]['alias']||_0x531096);}if(_0x2333e6[_0xac8f('0x7f')]){_0x2333e6[_0xac8f('0x7f')]=JSON[_0xac8f('0x80')](_0x2333e6[_0xac8f('0x7f')]);for(var _0x1e44c3=0x0;_0x1e44c3<_0x2333e6[_0xac8f('0x7f')]['length'];_0x1e44c3+=0x1){if(_0x2333e6[_0xac8f('0x7f')][_0x1e44c3][_0xac8f('0x3f')]&&_[_0xac8f('0x65')](_0xd9ce8b,_0x2333e6[_0xac8f('0x7f')][_0x1e44c3][_0xac8f('0x3f')])&&_0x2333e6['joins'][_0x1e44c3]['parentKey']&&_0x2333e6['joins'][_0x1e44c3][_0xac8f('0x81')]&&_0x2333e6[_0xac8f('0x7f')][_0x1e44c3][_0xac8f('0x82')]){_0x32415e[_0x2333e6['joins'][_0x1e44c3][_0xac8f('0x3f')]](_0x2333e6[_0xac8f('0x7f')][_0x1e44c3][_0xac8f('0x81')],null,util[_0xac8f('0x7a')](_0xac8f('0x83'),_0x2333e6[_0xac8f('0x75')],_0x2333e6['joins'][_0x1e44c3][_0xac8f('0x84')],_0x2333e6[_0xac8f('0x7f')][_0x1e44c3][_0xac8f('0x81')],_0x2333e6[_0xac8f('0x7f')][_0x1e44c3][_0xac8f('0x82')]));}}}if(_0x2333e6[_0xac8f('0x85')]){_0x2333e6['conditions']=JSON[_0xac8f('0x80')](_0x2333e6[_0xac8f('0x85')]);_0x32415e[_0xac8f('0x3d')](_0x2e5539(_0x2333e6[_0xac8f('0x85')]['group']));}_0x23f6ef=_0x32415e['clone']();_0x32415e[_0xac8f('0x1f')](_0x2726e7);_0x32415e['offset'](0x0);logger[_0xac8f('0x86')](_0xac8f('0x87'),_0x32415e[_0xac8f('0x88')]());return dbH['sequelize'][_0xac8f('0x32')](_0x32415e[_0xac8f('0x88')](),{'type':dbH['sequelize'][_0xac8f('0x89')][_0xac8f('0x8a')]});}})['then'](respondWithResult(_0x5ac31d,null))[_0xac8f('0x47')](handleError(_0x5ac31d,null));};function runReport(_0x957a93,_0x2b12e3,_0x2117f0){var _0x219d28=_0x2b12e3[_0xac8f('0x2b')];var _0x201e8c=0xa;var _0x4bb311=['join',_0xac8f('0x8b'),_0xac8f('0x57'),_0xac8f('0x58')];var _0x56f7d1={'SUM':_0xac8f('0x59'),'COUNT':_0xac8f('0x5a'),'COUNT DISTINCT':_0xac8f('0x8c'),'MAX':_0xac8f('0x5b'),'MIN':_0xac8f('0x5c'),'AVG':_0xac8f('0x5d'),'GROUP_CONCAT':_0xac8f('0x5e'),'GROUP_CONCAT ASC':_0xac8f('0x8d'),'GROUP_CONCAT DESC':_0xac8f('0x5f')};var _0xa0498c={'SEC_TO_TIME':_0xac8f('0x60'),'DATE':_0xac8f('0x61'),'HOUR':_0xac8f('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac8f('0x64')};var _0x3e57bd=function(_0x79eecc){return!_[_0xac8f('0x65')](['IS\x20NULL',_0xac8f('0x67'),'IS\x20EMPTY',_0xac8f('0x68')],_0x79eecc);};var _0x2e9073=function(_0x1f2bc8){if(!_0x1f2bc8||!_0x1f2bc8['rules']['length']){return'';}for(var _0x3ec974='(',_0x5e62c9=0x0;_0x5e62c9<_0x1f2bc8['rules'][_0xac8f('0x39')];_0x5e62c9+=0x1){_0x5e62c9>0x0&&(_0x3ec974+='\x20'+_0x1f2bc8['operator']+'\x20');_0x3ec974+=_0x1f2bc8[_0xac8f('0x69')][_0x5e62c9][_0xac8f('0x6b')]?_0x2e9073(_0x1f2bc8[_0xac8f('0x69')][_0x5e62c9][_0xac8f('0x6b')]):_0x1f2bc8[_0xac8f('0x69')][_0x5e62c9][_0xac8f('0x77')]+'\x20'+_0x1f2bc8[_0xac8f('0x69')][_0x5e62c9][_0xac8f('0x6c')]+(_0x3e57bd(_0x1f2bc8[_0xac8f('0x69')][_0x5e62c9][_0xac8f('0x6c')])?'\x20'+_0x1f2bc8['rules'][_0x5e62c9]['value']:'');}return _0x3ec974+')';};var _0x3790a1={'where':{'id':_0x957a93['id']}},_0x39c12b,_0x3cb852,_0x50ffdb,_0x4896e6,_0x476439;_0x3790a1=_[_0xac8f('0x3e')]({},_0x3790a1,_0x2117f0);return db[_0xac8f('0x43')][_0xac8f('0x4a')](_0x3790a1)['then'](function(_0x3e138f){if(_0x3e138f){_0x39c12b=_0x3e138f;return _0x3e138f[_0xac8f('0x8e')]();}return null;})[_0xac8f('0x24')](function(_0x453bfa){if(_0x453bfa){if(!_0x453bfa[_0xac8f('0x39')]){throw new db[(_0xac8f('0x6e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cb852=_0x453bfa;return db[_0xac8f('0x71')][_0xac8f('0x45')]({'raw':!![]});}return null;})[_0xac8f('0x24')](function(_0x1400b8){if(_0x1400b8){_0x50ffdb=_[_0xac8f('0x72')](_0x1400b8,'id');var _0x36f55b;var _0x3a28aa=squel[_0xac8f('0x73')]();_0x3a28aa[_0xac8f('0x74')](_0x39c12b[_0xac8f('0x75')]);for(var _0x1d3545=0x0;_0x1d3545<_0x3cb852['length'];_0x1d3545+=0x1){_0x36f55b=_0x3cb852[_0x1d3545][_0xac8f('0x76')]?_0x50ffdb[_0x3cb852[_0x1d3545][_0xac8f('0x76')]][_0xac8f('0x8f')]:_0x3cb852[_0x1d3545][_0xac8f('0x77')];_0x36f55b=_0x3cb852[_0x1d3545][_0xac8f('0x79')]?_['replace'](_0x56f7d1[_0x3cb852[_0x1d3545]['function']],'%s',_0x36f55b):_0x36f55b;_0x36f55b=_0x3cb852[_0x1d3545][_0xac8f('0x7a')]?_[_0xac8f('0x78')](_0xa0498c[_0x3cb852[_0x1d3545][_0xac8f('0x7a')]],'%s',_0x36f55b):_0x36f55b;if(_0x3cb852[_0x1d3545][_0xac8f('0x7b')]){_0x3a28aa[_0xac8f('0x6b')](_0x36f55b);}_0x3cb852[_0x1d3545][_0xac8f('0x7c')]&&_0x3a28aa[_0xac8f('0x7d')](_0x36f55b,_0x3cb852[_0x1d3545][_0xac8f('0x7c')]===_0xac8f('0x7e')?![]:!![]);_0x3a28aa[_0xac8f('0x77')](_0x36f55b,_0x3cb852[_0x1d3545][_0xac8f('0x90')]||_0x36f55b);}if(_0x39c12b[_0xac8f('0x7f')]){_0x39c12b[_0xac8f('0x7f')]=JSON[_0xac8f('0x80')](_0x39c12b[_0xac8f('0x7f')]);for(var _0x3a7f16=0x0;_0x3a7f16<_0x39c12b[_0xac8f('0x7f')][_0xac8f('0x39')];_0x3a7f16+=0x1){if(_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x3f')]&&_['includes'](_0x4bb311,_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x3f')])&&_0x39c12b['joins'][_0x3a7f16][_0xac8f('0x84')]&&_0x39c12b[_0xac8f('0x7f')][_0x3a7f16]['foreignTable']&&_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x82')]){_0x3a28aa[_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x3f')]](_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x81')],null,util[_0xac8f('0x7a')](_0xac8f('0x83'),_0x39c12b[_0xac8f('0x75')],_0x39c12b[_0xac8f('0x7f')][_0x3a7f16]['parentKey'],_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x81')],_0x39c12b[_0xac8f('0x7f')][_0x3a7f16][_0xac8f('0x82')]));}}}if(_0x39c12b['conditions']){_0x39c12b[_0xac8f('0x85')]=JSON[_0xac8f('0x80')](_0x39c12b[_0xac8f('0x85')]);_0x3a28aa[_0xac8f('0x3d')](_0x2e9073(_0x39c12b['conditions'][_0xac8f('0x6b')]));}_0x476439=_0x3a28aa[_0xac8f('0x91')]();_0x3a28aa[_0xac8f('0x1f')](_0x201e8c);_0x3a28aa[_0xac8f('0x1e')](0x0);return;}})[_0xac8f('0x24')](function(){if(_0x2b12e3[_0xac8f('0x92')]===_0xac8f('0x93')){return null;}var _0x5011f5=_['merge'](_0x2b12e3,{'name':_0x2b12e3[_0xac8f('0x94')]||_0x2b12e3[_0xac8f('0x2b')]||_0x39c12b['name'],'basename':_0x219d28,'savename':util['format'](_0xac8f('0x95'),_0x2b12e3[_0xac8f('0x2b')]||_0x39c12b[_0xac8f('0x2b')],require('randomstring')[_0xac8f('0x96')](0x4),_0x2b12e3[_0xac8f('0x92')]||_0xac8f('0x97')),'reportId':_0x39c12b['id'],'reportType':_0xac8f('0x98')});return db[_0xac8f('0x99')]['create'](_0x5011f5,{'raw':!![]});})[_0xac8f('0x24')](function(_0x5ec5f5){if(_0x39c12b[_0xac8f('0x75')]===_0xac8f('0x9a')){_0x476439['where'](_0x39c12b[_0xac8f('0x75')]+_0xac8f('0x9b'),_0x2b12e3[_0xac8f('0x9c')],_0x2b12e3[_0xac8f('0x9d')]);}else{_0x476439[_0xac8f('0x3d')](_0x39c12b[_0xac8f('0x75')]+_0xac8f('0x9e'),_0x2b12e3['startDate'],_0x2b12e3['endDate']);}if(_0x5ec5f5){logger[_0xac8f('0x9f')](_0xac8f('0xa0'),_0x476439[_0xac8f('0x88')]());require(_0xac8f('0xa1'))[_0xac8f('0xa2')](path[_0xac8f('0xa3')](__dirname,_0xac8f('0xa4'),_0x5ec5f5[_0xac8f('0x92')]),[_0x5ec5f5['id'],_0x476439[_0xac8f('0x88')](),path[_0xac8f('0xa3')](__dirname,'../../files/reports',_0x5ec5f5[_0xac8f('0xa5')]),_0x219d28]);return _0x5ec5f5;}else{var _0x5cafc5=squel[_0xac8f('0x73')]();_0x5cafc5[_0xac8f('0x74')]('('+_0x476439['toString']()+')','countTable');_0x5cafc5['field']('COUNT(*)',_0xac8f('0x1d'));_0x476439[_0xac8f('0x1f')](_0x2b12e3['limit']||_0x201e8c);_0x476439[_0xac8f('0x1e')](_0x2b12e3[_0xac8f('0x1e')]||0x0);return dbH[_0xac8f('0xa6')][_0xac8f('0x32')](_0x5cafc5[_0xac8f('0x88')](),{'type':dbH[_0xac8f('0xa6')]['QueryTypes'][_0xac8f('0x8a')]})[_0xac8f('0x24')](function(_0x49e1be){if(!_0x49e1be[_0xac8f('0x39')]){_0x4896e6=0x0;}else{_0x4896e6=_0x49e1be[0x0][_0xac8f('0x1d')]||0x0;}return dbH['sequelize'][_0xac8f('0x32')](_0x476439[_0xac8f('0x88')](),{'type':dbH[_0xac8f('0xa6')][_0xac8f('0x89')][_0xac8f('0x8a')]});})[_0xac8f('0x24')](function(_0x4c96a6){return{'rows':_0x4c96a6||[],'count':_0x4896e6};});}});}exports[_0xac8f('0xa7')]=function(_0x18a070,_0x1a1df2){return runReport(_0x18a070[_0xac8f('0x55')],_0x18a070[_0xac8f('0x32')],_0x18a070[_0xac8f('0x42')])[_0xac8f('0x24')](respondWithResult(_0x1a1df2,null))[_0xac8f('0x47')](handleError(_0x1a1df2,null));};exports[_0xac8f('0xa8')]=runReport;exports[_0xac8f('0x32')]=function(_0x15f484,_0x45f693){var _0x50e77b=0xa;var _0x20039e=[_0xac8f('0xa3'),_0xac8f('0x8b'),_0xac8f('0x57'),_0xac8f('0x58')];var _0x48287a={'SUM':_0xac8f('0x59'),'COUNT':_0xac8f('0x5a'),'COUNT DISTINCT':_0xac8f('0x8c'),'MAX':_0xac8f('0x5b'),'MIN':_0xac8f('0x5c'),'AVG':_0xac8f('0x5d'),'GROUP_CONCAT':_0xac8f('0x5e'),'GROUP_CONCAT ASC':_0xac8f('0x8d'),'GROUP_CONCAT DESC':_0xac8f('0x5f')};var _0x222812={'SEC_TO_TIME':_0xac8f('0x60'),'DATE':_0xac8f('0x61'),'HOUR':_0xac8f('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac8f('0x64')};var _0x2e4488=function(_0x9b9ac2){return!_[_0xac8f('0x65')]([_0xac8f('0x66'),_0xac8f('0x67'),_0xac8f('0xa9'),'IS\x20NOT\x20EMPTY'],_0x9b9ac2);};var _0x367068=function(_0x35d302){if(!_0x35d302||!_0x35d302['rules'][_0xac8f('0x39')]){return'';}for(var _0x4c2a94='(',_0x31d0bb=0x0;_0x31d0bb<_0x35d302[_0xac8f('0x69')][_0xac8f('0x39')];_0x31d0bb+=0x1){_0x31d0bb>0x0&&(_0x4c2a94+='\x20'+_0x35d302['operator']+'\x20');_0x4c2a94+=_0x35d302[_0xac8f('0x69')][_0x31d0bb]['group']?_0x367068(_0x35d302['rules'][_0x31d0bb][_0xac8f('0x6b')]):_0x35d302['rules'][_0x31d0bb][_0xac8f('0x77')]+'\x20'+_0x35d302[_0xac8f('0x69')][_0x31d0bb]['condition']+(_0x2e4488(_0x35d302[_0xac8f('0x69')][_0x31d0bb][_0xac8f('0x6c')])?'\x20'+_0x35d302[_0xac8f('0x69')][_0x31d0bb][_0xac8f('0x6d')]:'');}return _0x4c2a94+')';};var _0x3663ba={'where':{'id':_0x15f484[_0xac8f('0x55')]['id']}},_0x1576a9,_0x2cf03e,_0x58cc69,_0xb8cd79,_0x17c86c;_0x3663ba=_['merge']({},_0x3663ba,_0x15f484[_0xac8f('0x42')]);return db[_0xac8f('0x43')][_0xac8f('0x4a')](_0x3663ba)[_0xac8f('0x24')](function(_0x8c30ed){if(_0x8c30ed){_0x1576a9=_0x8c30ed;return _0x8c30ed[_0xac8f('0x8e')]();}return null;})[_0xac8f('0x24')](function(_0x487446){if(_0x487446){if(!_0x487446[_0xac8f('0x39')]){throw new db[(_0xac8f('0x6e'))][(_0xac8f('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2cf03e=_0x487446;return db[_0xac8f('0x71')][_0xac8f('0x45')]({'raw':!![]});}return null;})['then'](function(_0xb4a7fe){if(_0xb4a7fe){_0x58cc69=_[_0xac8f('0x72')](_0xb4a7fe,'id');var _0x4ac481;var _0x333c01=squel['select']();_0x333c01[_0xac8f('0x74')](_0x1576a9[_0xac8f('0x75')]);for(var _0x4cf86e=0x0;_0x4cf86e<_0x2cf03e[_0xac8f('0x39')];_0x4cf86e+=0x1){_0x4ac481=_0x2cf03e[_0x4cf86e][_0xac8f('0x76')]?_0x58cc69[_0x2cf03e[_0x4cf86e][_0xac8f('0x76')]][_0xac8f('0x8f')]:_0x2cf03e[_0x4cf86e][_0xac8f('0x77')];_0x4ac481=_0x2cf03e[_0x4cf86e][_0xac8f('0x79')]?_['replace'](_0x48287a[_0x2cf03e[_0x4cf86e][_0xac8f('0x79')]],'%s',_0x4ac481):_0x4ac481;_0x4ac481=_0x2cf03e[_0x4cf86e][_0xac8f('0x7a')]?_['replace'](_0x222812[_0x2cf03e[_0x4cf86e][_0xac8f('0x7a')]],'%s',_0x4ac481):_0x4ac481;if(_0x2cf03e[_0x4cf86e][_0xac8f('0x7b')]){_0x333c01[_0xac8f('0x6b')](_0x4ac481);}_0x2cf03e[_0x4cf86e][_0xac8f('0x7c')]&&_0x333c01[_0xac8f('0x7d')](_0x4ac481,_0x2cf03e[_0x4cf86e][_0xac8f('0x7c')]===_0xac8f('0x7e')?![]:!![]);_0x333c01['field'](_0x4ac481,_0x2cf03e[_0x4cf86e][_0xac8f('0x90')]||_0x4ac481);}if(_0x1576a9[_0xac8f('0x7f')]){_0x1576a9[_0xac8f('0x7f')]=JSON[_0xac8f('0x80')](_0x1576a9[_0xac8f('0x7f')]);for(var _0x150800=0x0;_0x150800<_0x1576a9['joins'][_0xac8f('0x39')];_0x150800+=0x1){if(_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x3f')]&&_[_0xac8f('0x65')](_0x20039e,_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x3f')])&&_0x1576a9['joins'][_0x150800][_0xac8f('0x84')]&&_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x81')]&&_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x82')]){_0x333c01[_0x1576a9['joins'][_0x150800]['type']](_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x81')],null,util[_0xac8f('0x7a')](_0xac8f('0x83'),_0x1576a9[_0xac8f('0x75')],_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x84')],_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x81')],_0x1576a9[_0xac8f('0x7f')][_0x150800][_0xac8f('0x82')]));}}}if(_0x1576a9[_0xac8f('0x85')]){_0x1576a9[_0xac8f('0x85')]=JSON[_0xac8f('0x80')](_0x1576a9['conditions']);_0x333c01[_0xac8f('0x3d')](_0x367068(_0x1576a9[_0xac8f('0x85')][_0xac8f('0x6b')]));}_0x17c86c=_0x333c01['clone']();_0x333c01[_0xac8f('0x1f')](_0x50e77b);_0x333c01[_0xac8f('0x1e')](0x0);logger['debug'](_0xac8f('0x87'),_0x333c01[_0xac8f('0x88')]());return dbH[_0xac8f('0xa6')][_0xac8f('0x32')](_0x333c01[_0xac8f('0x88')](),{'type':dbH[_0xac8f('0xa6')]['QueryTypes'][_0xac8f('0x8a')]});}})[_0xac8f('0x24')](function(){return{'sql':_0x17c86c[_0xac8f('0x88')]()};})[_0xac8f('0x24')](respondWithResult(_0x45f693,null))[_0xac8f('0x47')](handleError(_0x45f693,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b92db6e..ed5f6ff 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 _0x342b=['api','moment','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x342b,0xbc));var _0xb342=function(_0x4a8c66,_0xaa36a3){_0x4a8c66=_0x4a8c66-0x0;var _0x55eeea=_0x342b[_0x4a8c66];return _0x55eeea;};'use strict';var _=require(_0xb342('0x0'));var util=require('util');var logger=require(_0xb342('0x1'))(_0xb342('0x2'));var moment=require(_0xb342('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(_0xb342('0x4'));var attributes=require(_0xb342('0x5'));module[_0xb342('0x6')]=function(_0x28bca8,_0x25ecba){return _0x28bca8[_0xb342('0x7')](_0xb342('0x8'),attributes,{'tableName':_0xb342('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b88=['api','moment','request-promise','rimraf','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger'];(function(_0x5d1c9d,_0x8bb82d){var _0x8edfe4=function(_0x30fdc4){while(--_0x30fdc4){_0x5d1c9d['push'](_0x5d1c9d['shift']());}};_0x8edfe4(++_0x8bb82d);}(_0x4b88,0x1ca));var _0x84b8=function(_0x32f7c4,_0x246ac1){_0x32f7c4=_0x32f7c4-0x0;var _0x128dbc=_0x4b88[_0x32f7c4];return _0x128dbc;};'use strict';var _=require('lodash');var util=require(_0x84b8('0x0'));var logger=require(_0x84b8('0x1'))(_0x84b8('0x2'));var moment=require(_0x84b8('0x3'));var BPromise=require('bluebird');var rp=require(_0x84b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84b8('0x5'));var config=require('../../config/environment');var attributes=require(_0x84b8('0x6'));module[_0x84b8('0x7')]=function(_0x17168f,_0x595eb7){return _0x17168f['define'](_0x84b8('0x8'),attributes,{'tableName':_0x84b8('0x9'),'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 77e623b..d6a23ac 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 _0xaa1b=['randomstring','../../mysqldb','../../config/utils','jayson/promise','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x4e3189,_0x1923f5){var _0x54d17b=function(_0x3ccc56){while(--_0x3ccc56){_0x4e3189['push'](_0x4e3189['shift']());}};_0x54d17b(++_0x1923f5);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var moment=require(_0xbaa1('0x2'));var BPromise=require('bluebird');var rs=require(_0xbaa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaa1('0x4'))['db'];var utils=require(_0xbaa1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbaa1('0x6'));var client=jayson[_0xbaa1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22516a,_0x56e7ec,_0x364ce9){return new BPromise(function(_0x15b968,_0x339e3e){return client[_0xbaa1('0x8')](_0x22516a,_0x364ce9)[_0xbaa1('0x9')](function(_0x1159ee){logger['info'](_0xbaa1('0xa'),_0x56e7ec,_0xbaa1('0xb'));logger[_0xbaa1('0xc')](_0xbaa1('0xd'),_0x56e7ec,_0xbaa1('0xb'),JSON[_0xbaa1('0xe')](_0x1159ee));if(_0x1159ee[_0xbaa1('0xf')]){if(_0x1159ee[_0xbaa1('0xf')][_0xbaa1('0x10')]===0x1f4){logger[_0xbaa1('0xf')](_0xbaa1('0xa'),_0x56e7ec,_0x1159ee[_0xbaa1('0xf')]['message']);return _0x339e3e(_0x1159ee['error']['message']);}logger['error'](_0xbaa1('0xa'),_0x56e7ec,_0x1159ee[_0xbaa1('0xf')][_0xbaa1('0x11')]);return _0x15b968(_0x1159ee[_0xbaa1('0xf')][_0xbaa1('0x11')]);}else{logger[_0xbaa1('0x12')](_0xbaa1('0xa'),_0x56e7ec,_0xbaa1('0xb'));_0x15b968(_0x1159ee[_0xbaa1('0x13')][_0xbaa1('0x11')]);}})[_0xbaa1('0x14')](function(_0x42f360){logger[_0xbaa1('0xf')](_0xbaa1('0xa'),_0x56e7ec,_0x42f360);_0x339e3e(_0x42f360);});});} \ No newline at end of file +var _0x6947=['../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0x6947,0x72));var _0x7694=function(_0x4c5281,_0x167d13){_0x4c5281=_0x4c5281-0x0;var _0x5d6af3=_0x6947[_0x4c5281];return _0x5d6af3;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var moment=require('moment');var BPromise=require(_0x7694('0x1'));var rs=require(_0x7694('0x2'));var fs=require('fs');var Redis=require(_0x7694('0x3'));var db=require(_0x7694('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7694('0x5'));var config=require(_0x7694('0x6'));var jayson=require(_0x7694('0x7'));var client=jayson[_0x7694('0x8')][_0x7694('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x266a27,_0x52cecf,_0x9ecd68){return new BPromise(function(_0x57d637,_0x28ea4f){return client[_0x7694('0xa')](_0x266a27,_0x9ecd68)['then'](function(_0x3a4a92){logger[_0x7694('0xb')](_0x7694('0xc'),_0x52cecf,_0x7694('0xd'));logger[_0x7694('0xe')](_0x7694('0xf'),_0x52cecf,_0x7694('0xd'),JSON['stringify'](_0x3a4a92));if(_0x3a4a92[_0x7694('0x10')]){if(_0x3a4a92[_0x7694('0x10')]['code']===0x1f4){logger[_0x7694('0x10')](_0x7694('0xc'),_0x52cecf,_0x3a4a92[_0x7694('0x10')]['message']);return _0x28ea4f(_0x3a4a92['error'][_0x7694('0x11')]);}logger[_0x7694('0x10')](_0x7694('0xc'),_0x52cecf,_0x3a4a92['error'][_0x7694('0x11')]);return _0x57d637(_0x3a4a92['error'][_0x7694('0x11')]);}else{logger[_0x7694('0xb')](_0x7694('0xc'),_0x52cecf,_0x7694('0xd'));_0x57d637(_0x3a4a92[_0x7694('0x12')]['message']);}})[_0x7694('0x13')](function(_0xb1edf0){logger[_0x7694('0x10')](_0x7694('0xc'),_0x52cecf,_0xb1edf0);_0x28ea4f(_0xb1edf0);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7e0e78d..5471f8c 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 _0x3c77=['/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x3c77,0x172));var _0x73c7=function(_0x274a09,_0xcc9199){_0x274a09=_0x274a09-0x0;var _0x5d23ba=_0x3c77[_0x274a09];return _0x5d23ba;};'use strict';var multer=require('multer');var util=require(_0x73c7('0x0'));var path=require(_0x73c7('0x1'));var timeout=require(_0x73c7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x73c7('0x3'));var interaction=require(_0x73c7('0x4'));var config=require(_0x73c7('0x5'));var controller=require(_0x73c7('0x6'));router[_0x73c7('0x7')]('/',auth[_0x73c7('0x8')](),controller['index']);router[_0x73c7('0x7')](_0x73c7('0x9'),auth[_0x73c7('0x8')](),controller['show']);router[_0x73c7('0x7')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x73c7('0x7')]('/:id/run',auth[_0x73c7('0x8')](),controller['run']);router[_0x73c7('0x7')](_0x73c7('0xa'),auth[_0x73c7('0x8')](),controller[_0x73c7('0xb')]);router[_0x73c7('0xc')]('/',auth[_0x73c7('0x8')](),controller[_0x73c7('0xd')]);router[_0x73c7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x73c7('0xf')]);router[_0x73c7('0x10')](_0x73c7('0x9'),auth['isAuthenticated'](),controller[_0x73c7('0x11')]);module[_0x73c7('0x12')]=router; \ No newline at end of file +var _0xb031=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post','create','delete','exports','multer','util','connect-timeout','express'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xb031,0x161));var _0x1b03=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xb031[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require(_0x1b03('0x0'));var util=require(_0x1b03('0x1'));var path=require('path');var timeout=require(_0x1b03('0x2'));var express=require(_0x1b03('0x3'));var router=express[_0x1b03('0x4')]();var auth=require(_0x1b03('0x5'));var interaction=require(_0x1b03('0x6'));var config=require(_0x1b03('0x7'));var controller=require(_0x1b03('0x8'));router[_0x1b03('0x9')]('/',auth[_0x1b03('0xa')](),controller['index']);router[_0x1b03('0x9')](_0x1b03('0xb'),auth[_0x1b03('0xa')](),controller['show']);router['get'](_0x1b03('0xc'),auth['isAuthenticated'](),controller[_0x1b03('0xd')]);router[_0x1b03('0x9')](_0x1b03('0xe'),auth[_0x1b03('0xa')](),controller[_0x1b03('0xf')]);router['get'](_0x1b03('0x10'),auth[_0x1b03('0xa')](),controller['query']);router[_0x1b03('0x11')]('/',auth['isAuthenticated'](),controller[_0x1b03('0x12')]);router['put'](_0x1b03('0xb'),auth[_0x1b03('0xa')](),controller['update']);router[_0x1b03('0x13')](_0x1b03('0xb'),auth[_0x1b03('0xa')](),controller['destroy']);module[_0x1b03('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 fecf683..515337b 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 _0xf408=['manual','INTEGER','UNSIGNED','moment','exports','STRING','csv','pdf','xlsx','DATE','ENUM'];(function(_0x3af46,_0xf0dccb){var _0x42da70=function(_0x394e48){while(--_0x394e48){_0x3af46['push'](_0x3af46['shift']());}};_0x42da70(++_0xf0dccb);}(_0xf408,0x19a));var _0x8f40=function(_0xe9dbe9,_0x14b58a){_0xe9dbe9=_0xe9dbe9-0x0;var _0x4b9ebd=_0xf408[_0xe9dbe9];return _0x4b9ebd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8f40('0x0'));module[_0x8f40('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x8f40('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x8f40('0x3'),_0x8f40('0x4'),_0x8f40('0x5')),'allowNull':![],'defaultValue':_0x8f40('0x3')},'savename':{'type':Sequelize[_0x8f40('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x8f40('0x6')]},'status':{'type':Sequelize[_0x8f40('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x8f40('0x7')](_0x8f40('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x8f40('0x8')},'reportId':{'type':Sequelize[_0x8f40('0x9')](0xb)[_0x8f40('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8411=['INTEGER','UNSIGNED','STRING','ENUM','csv','pdf','xlsx','Loading','manual','scheduled'];(function(_0x34350c,_0x16f4ef){var _0x1fa189=function(_0xe605d7){while(--_0xe605d7){_0x34350c['push'](_0x34350c['shift']());}};_0x1fa189(++_0x16f4ef);}(_0x8411,0x174));var _0x1841=function(_0x477fa0,_0x430904){_0x477fa0=_0x477fa0-0x0;var _0x2fafc4=_0x8411[_0x477fa0];return _0x2fafc4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x1841('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x1841('0x1')](_0x1841('0x2'),_0x1841('0x3'),_0x1841('0x4')),'allowNull':![],'defaultValue':_0x1841('0x2')},'savename':{'type':Sequelize[_0x1841('0x0')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x1841('0x0')],'defaultValue':_0x1841('0x5')},'type':{'type':Sequelize[_0x1841('0x1')](_0x1841('0x6'),_0x1841('0x7')),'allowNull':![],'defaultValue':_0x1841('0x6')},'reportId':{'type':Sequelize[_0x1841('0x8')](0xb)[_0x1841('0x9')]},'reportType':{'type':Sequelize[_0x1841('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 633fc4b..b91d43b 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 _0xb0a3=['name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','download','basename','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','ExtractedReports','stack'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0xb0a3,0xfb));var _0x3b0a=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0xb0a3[_0xf363f0];return _0x55a386;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b0a('0x0'));var rimraf=require(_0x3b0a('0x1'));var zipdir=require(_0x3b0a('0x2'));var jsonpatch=require(_0x3b0a('0x3'));var rp=require(_0x3b0a('0x4'));var moment=require(_0x3b0a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3b0a('0x6'));var util=require(_0x3b0a('0x7'));var path=require(_0x3b0a('0x8'));var sox=require(_0x3b0a('0x9'));var csv=require(_0x3b0a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b0a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b0a('0xc'));var deskjs=require(_0x3b0a('0xd'));var toCsv=require(_0x3b0a('0xa'));var querystring=require(_0x3b0a('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b0a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3b0a('0x10'));var as=require(_0x3b0a('0x11'));var hardwareService=require(_0x3b0a('0x12'));var logger=require(_0x3b0a('0x13'))(_0x3b0a('0x14'));var utils=require('../../config/utils');var config=require(_0x3b0a('0x15'));var licenseUtil=require(_0x3b0a('0x16'));var db=require(_0x3b0a('0x17'))['db'];function respondWithStatusCode(_0x4dc00b,_0x170757){_0x170757=_0x170757||0xcc;return function(_0x3b83d9){if(_0x3b83d9){return _0x4dc00b[_0x3b0a('0x18')](_0x170757);}return _0x4dc00b[_0x3b0a('0x19')](_0x170757)[_0x3b0a('0x1a')]();};}function respondWithResult(_0x521fc0,_0x7610ef){_0x7610ef=_0x7610ef||0xc8;return function(_0x382ec9){if(_0x382ec9){return _0x521fc0[_0x3b0a('0x19')](_0x7610ef)['json'](_0x382ec9);}};}function respondWithFilteredResult(_0x314293,_0x5ba0b3){return function(_0x349572){if(_0x349572){var _0x4fcfb0=_0x349572[_0x3b0a('0x1b')],_0x1e3898=_0x5ba0b3['offset'],_0xbaee1c=_0x5ba0b3['offset']+_0x5ba0b3[_0x3b0a('0x1c')],_0x28ddcd;if(_0xbaee1c>=_0x4fcfb0){_0xbaee1c=_0x4fcfb0;_0x28ddcd=0xc8;}else{_0x28ddcd=0xce;}_0x314293['status'](_0x28ddcd);return _0x314293[_0x3b0a('0x1d')](_0x3b0a('0x1e'),_0x1e3898+'-'+_0xbaee1c+'/'+_0x4fcfb0)[_0x3b0a('0x1f')](_0x349572);}return null;};}function patchUpdates(_0x1890b4){return function(_0x200d3d){try{jsonpatch[_0x3b0a('0x20')](_0x200d3d,_0x1890b4,!![]);}catch(_0x38573b){return BPromise[_0x3b0a('0x21')](_0x38573b);}return _0x200d3d[_0x3b0a('0x22')]();};}function saveUpdates(_0x2476d0,_0x504a56){return function(_0x2a3fb5){if(_0x2a3fb5){return _0x2a3fb5[_0x3b0a('0x23')](_0x2476d0)['then'](function(_0x4142c9){return _0x4142c9;});}return null;};}function removeEntity(_0x7a7473,_0x459aa5){return function(_0x524f0c){if(_0x524f0c){return _0x524f0c['destroy']()[_0x3b0a('0x24')](function(){var _0x1dc3bf=_0x524f0c[_0x3b0a('0x25')]({'plain':!![]});var _0x4383b1=_0x3b0a('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4383b1,'resourceId':_0x1dc3bf['id']}})[_0x3b0a('0x24')](function(){return _0x524f0c;});})[_0x3b0a('0x24')](function(){_0x7a7473[_0x3b0a('0x19')](0xcc)[_0x3b0a('0x1a')]();});}};}function handleEntityNotFound(_0x51f166,_0x15dc68){return function(_0x40cae8){if(!_0x40cae8){_0x51f166[_0x3b0a('0x18')](0x194);}return _0x40cae8;};}function handleError(_0x4e98f7,_0x2f338a){_0x2f338a=_0x2f338a||0x1f4;return function(_0x234e40){logger['error'](_0x234e40[_0x3b0a('0x27')]);if(_0x234e40[_0x3b0a('0x28')]){delete _0x234e40[_0x3b0a('0x28')];}_0x4e98f7['status'](_0x2f338a)[_0x3b0a('0x29')](_0x234e40);};}exports[_0x3b0a('0x2a')]=function(_0x111f38,_0x1c91f9){var _0x343cfd={},_0x24cb46={},_0x4777b9={'count':0x0,'rows':[]};var _0x482f41=_[_0x3b0a('0x2b')](db[_0x3b0a('0x2c')][_0x3b0a('0x2d')],function(_0xd0c9b7){return{'name':_0xd0c9b7[_0x3b0a('0x2e')],'type':_0xd0c9b7[_0x3b0a('0x2f')][_0x3b0a('0x30')]};});_0x24cb46['model']=_[_0x3b0a('0x2b')](_0x482f41,_0x3b0a('0x28'));_0x24cb46['query']=_['keys'](_0x111f38[_0x3b0a('0x31')]);_0x24cb46[_0x3b0a('0x32')]=_[_0x3b0a('0x33')](_0x24cb46[_0x3b0a('0x34')],_0x24cb46[_0x3b0a('0x31')]);_0x343cfd[_0x3b0a('0x35')]=_[_0x3b0a('0x33')](_0x24cb46[_0x3b0a('0x34')],qs['fields'](_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x36')]));_0x343cfd[_0x3b0a('0x35')]=_0x343cfd[_0x3b0a('0x35')]['length']?_0x343cfd[_0x3b0a('0x35')]:_0x24cb46['model'];if(!_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x37')](_0x3b0a('0x38'))){_0x343cfd[_0x3b0a('0x1c')]=qs[_0x3b0a('0x1c')](_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x1c')]);_0x343cfd['offset']=qs[_0x3b0a('0x39')](_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x39')]);}_0x343cfd[_0x3b0a('0x3a')]=qs['sort'](_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x3b')]);_0x343cfd[_0x3b0a('0x3c')]=qs[_0x3b0a('0x32')](_[_0x3b0a('0x3d')](_0x111f38[_0x3b0a('0x31')],_0x24cb46['filters']),_0x482f41);if(_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x3e')]){_0x343cfd['where']=_['merge'](_0x343cfd[_0x3b0a('0x3c')],{'$or':_[_0x3b0a('0x2b')](_0x482f41,function(_0x4fe820){if(_0x4fe820['type']!==_0x3b0a('0x3f')){var _0x23560d={};_0x23560d[_0x4fe820[_0x3b0a('0x28')]]={'$like':'%'+_0x111f38['query'][_0x3b0a('0x3e')]+'%'};return _0x23560d;}})});}_0x343cfd=_[_0x3b0a('0x40')]({},_0x343cfd,_0x111f38[_0x3b0a('0x41')]);var _0x101cf0={'where':_0x343cfd['where']};return db['AnalyticExtractedReport'][_0x3b0a('0x1b')](_0x101cf0)[_0x3b0a('0x24')](function(_0x38c11a){_0x4777b9[_0x3b0a('0x1b')]=_0x38c11a;if(_0x111f38[_0x3b0a('0x31')][_0x3b0a('0x42')]){_0x343cfd[_0x3b0a('0x43')]=[{'all':!![]}];}return db[_0x3b0a('0x2c')][_0x3b0a('0x44')](_0x343cfd);})[_0x3b0a('0x24')](function(_0x1e949f){_0x4777b9[_0x3b0a('0x45')]=_0x1e949f;return _0x4777b9;})[_0x3b0a('0x24')](respondWithFilteredResult(_0x1c91f9,_0x343cfd))[_0x3b0a('0x46')](handleError(_0x1c91f9,null));};exports['show']=function(_0x360ef3,_0x48aff6){var _0x3ddcb5={'raw':!![],'where':{'id':_0x360ef3['params']['id']}},_0x1778d8={};_0x1778d8['model']=_[_0x3b0a('0x47')](db[_0x3b0a('0x2c')]['rawAttributes']);_0x1778d8[_0x3b0a('0x31')]=_[_0x3b0a('0x47')](_0x360ef3['query']);_0x1778d8[_0x3b0a('0x32')]=_['intersection'](_0x1778d8[_0x3b0a('0x34')],_0x1778d8[_0x3b0a('0x31')]);_0x3ddcb5['attributes']=_[_0x3b0a('0x33')](_0x1778d8['model'],qs[_0x3b0a('0x36')](_0x360ef3['query'][_0x3b0a('0x36')]));_0x3ddcb5['attributes']=_0x3ddcb5[_0x3b0a('0x35')]['length']?_0x3ddcb5[_0x3b0a('0x35')]:_0x1778d8[_0x3b0a('0x34')];if(_0x360ef3[_0x3b0a('0x31')][_0x3b0a('0x42')]){_0x3ddcb5['include']=[{'all':!![]}];}_0x3ddcb5=_['merge']({},_0x3ddcb5,_0x360ef3[_0x3b0a('0x41')]);return db[_0x3b0a('0x2c')][_0x3b0a('0x48')](_0x3ddcb5)['then'](handleEntityNotFound(_0x48aff6,null))[_0x3b0a('0x24')](respondWithResult(_0x48aff6,null))[_0x3b0a('0x46')](handleError(_0x48aff6,null));};exports[_0x3b0a('0x49')]=function(_0x4e3220,_0x52d222){return db[_0x3b0a('0x2c')]['create'](_0x4e3220[_0x3b0a('0x4a')],{})[_0x3b0a('0x24')](function(_0x561694){var _0x590367=_0x4e3220['user'][_0x3b0a('0x25')]({'plain':!![]});if(!_0x590367)throw new Error(_0x3b0a('0x4b'));if(_0x590367[_0x3b0a('0x4c')]==='user'){var _0x220d04=_0x561694[_0x3b0a('0x25')]({'plain':!![]});var _0x4236a1='ExtractedReports';return db['UserProfileSection'][_0x3b0a('0x48')]({'where':{'name':_0x4236a1,'userProfileId':_0x590367[_0x3b0a('0x4d')]},'raw':!![]})[_0x3b0a('0x24')](function(_0x195dc3){if(_0x195dc3&&_0x195dc3[_0x3b0a('0x4e')]===0x0){return db[_0x3b0a('0x4f')][_0x3b0a('0x49')]({'name':_0x220d04[_0x3b0a('0x28')],'resourceId':_0x220d04['id'],'type':_0x195dc3[_0x3b0a('0x28')],'sectionId':_0x195dc3['id']},{})[_0x3b0a('0x24')](function(){return _0x561694;});}else{return _0x561694;}})[_0x3b0a('0x46')](function(_0x5d66c0){logger[_0x3b0a('0x50')](_0x3b0a('0x51'),_0x5d66c0);throw _0x5d66c0;});}return _0x561694;})[_0x3b0a('0x24')](respondWithResult(_0x52d222,0xc9))['catch'](handleError(_0x52d222,null));};exports[_0x3b0a('0x23')]=function(_0x272d7a,_0x69c5a6){if(_0x272d7a[_0x3b0a('0x4a')]['id']){delete _0x272d7a['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x272d7a[_0x3b0a('0x52')]['id']}})[_0x3b0a('0x24')](handleEntityNotFound(_0x69c5a6,null))['then'](saveUpdates(_0x272d7a[_0x3b0a('0x4a')],null))['then'](respondWithResult(_0x69c5a6,null))[_0x3b0a('0x46')](handleError(_0x69c5a6,null));};exports[_0x3b0a('0x53')]=function(_0x57e99f,_0x4dc34f){return db[_0x3b0a('0x2c')][_0x3b0a('0x48')]({'where':{'id':_0x57e99f[_0x3b0a('0x52')]['id']}})[_0x3b0a('0x24')](handleEntityNotFound(_0x4dc34f,null))[_0x3b0a('0x24')](removeEntity(_0x4dc34f,null))[_0x3b0a('0x46')](handleError(_0x4dc34f,null));};exports[_0x3b0a('0x54')]=function(_0x31c8b8,_0x21587f,_0x54c183){return db[_0x3b0a('0x2c')][_0x3b0a('0x48')]({'where':{'id':_0x31c8b8[_0x3b0a('0x52')]['id']},'attributes':['name',_0x3b0a('0x55'),'savename','output'],'raw':!![]})[_0x3b0a('0x24')](handleEntityNotFound(_0x21587f,null))[_0x3b0a('0x24')](function(_0x3ff260){if(_0x3ff260){if(!fs[_0x3b0a('0x56')](path[_0x3b0a('0x57')](config[_0x3b0a('0x58')],_0x3b0a('0x59'),_0x3ff260[_0x3b0a('0x5a')]))){throw new db[(_0x3b0a('0x5b'))]['ValidationError'](_0x3b0a('0x5c'));}if(_0x31c8b8[_0x3b0a('0x31')][_0x3b0a('0x5d')]){return _0x21587f['sendStatus'](0xc8);}return _0x21587f[_0x3b0a('0x54')](path[_0x3b0a('0x57')](config['root'],_0x3b0a('0x59'),_0x3ff260[_0x3b0a('0x5a')]),util[_0x3b0a('0x5e')](_0x3b0a('0x5f'),_0x3ff260[_0x3b0a('0x55')]||_0x3ff260['name'],_0x3ff260['output'][_0x3b0a('0x60')]()));}})[_0x3b0a('0x46')](handleError(_0x21587f,null));}; \ No newline at end of file +var _0x13b9=['keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','download','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','output','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','update','destroy','then','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','query'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x13b9,0x80));var _0x913b=function(_0x227b24,_0xad6e3a){_0x227b24=_0x227b24-0x0;var _0x36e760=_0x13b9[_0x227b24];return _0x36e760;};'use strict';var pdf=require(_0x913b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x913b('0x1'));var zipdir=require(_0x913b('0x2'));var jsonpatch=require(_0x913b('0x3'));var rp=require(_0x913b('0x4'));var moment=require(_0x913b('0x5'));var BPromise=require(_0x913b('0x6'));var Mustache=require(_0x913b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x913b('0x8'));var csv=require(_0x913b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x913b('0xa'));var deskjs=require(_0x913b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x913b('0xc'));var Papa=require(_0x913b('0xd'));var Redis=require(_0x913b('0xe'));var authService=require(_0x913b('0xf'));var qs=require(_0x913b('0x10'));var as=require(_0x913b('0x11'));var hardwareService=require(_0x913b('0x12'));var logger=require(_0x913b('0x13'))(_0x913b('0x14'));var utils=require('../../config/utils');var config=require(_0x913b('0x15'));var licenseUtil=require(_0x913b('0x16'));var db=require(_0x913b('0x17'))['db'];function respondWithStatusCode(_0x4330d1,_0x4390f8){_0x4390f8=_0x4390f8||0xcc;return function(_0x210a36){if(_0x210a36){return _0x4330d1[_0x913b('0x18')](_0x4390f8);}return _0x4330d1[_0x913b('0x19')](_0x4390f8)[_0x913b('0x1a')]();};}function respondWithResult(_0x124985,_0x4b6dd9){_0x4b6dd9=_0x4b6dd9||0xc8;return function(_0x4a26cd){if(_0x4a26cd){return _0x124985['status'](_0x4b6dd9)[_0x913b('0x1b')](_0x4a26cd);}};}function respondWithFilteredResult(_0x8f3291,_0x13461c){return function(_0x1b81dd){if(_0x1b81dd){var _0x1632f2=_0x1b81dd['count'],_0x39df4f=_0x13461c[_0x913b('0x1c')],_0x5b64d2=_0x13461c[_0x913b('0x1c')]+_0x13461c[_0x913b('0x1d')],_0x5c8020;if(_0x5b64d2>=_0x1632f2){_0x5b64d2=_0x1632f2;_0x5c8020=0xc8;}else{_0x5c8020=0xce;}_0x8f3291[_0x913b('0x19')](_0x5c8020);return _0x8f3291['set']('Content-Range',_0x39df4f+'-'+_0x5b64d2+'/'+_0x1632f2)['json'](_0x1b81dd);}return null;};}function patchUpdates(_0x27864e){return function(_0x36de51){try{jsonpatch['apply'](_0x36de51,_0x27864e,!![]);}catch(_0x17b186){return BPromise['reject'](_0x17b186);}return _0x36de51['save']();};}function saveUpdates(_0x5d026a,_0x1fd462){return function(_0x36beac){if(_0x36beac){return _0x36beac[_0x913b('0x1e')](_0x5d026a)['then'](function(_0x308ef5){return _0x308ef5;});}return null;};}function removeEntity(_0x57f9a0,_0x2284ac){return function(_0x50e531){if(_0x50e531){return _0x50e531[_0x913b('0x1f')]()[_0x913b('0x20')](function(){var _0x5b137b=_0x50e531[_0x913b('0x21')]({'plain':!![]});var _0x44ca09=_0x913b('0x22');return db['UserProfileResource'][_0x913b('0x1f')]({'where':{'type':_0x44ca09,'resourceId':_0x5b137b['id']}})['then'](function(){return _0x50e531;});})[_0x913b('0x20')](function(){_0x57f9a0[_0x913b('0x19')](0xcc)[_0x913b('0x1a')]();});}};}function handleEntityNotFound(_0x53fa28,_0x29ef56){return function(_0x839540){if(!_0x839540){_0x53fa28['sendStatus'](0x194);}return _0x839540;};}function handleError(_0x4171c3,_0x565241){_0x565241=_0x565241||0x1f4;return function(_0x2a2aa9){logger[_0x913b('0x23')](_0x2a2aa9[_0x913b('0x24')]);if(_0x2a2aa9[_0x913b('0x25')]){delete _0x2a2aa9[_0x913b('0x25')];}_0x4171c3[_0x913b('0x19')](_0x565241)[_0x913b('0x26')](_0x2a2aa9);};}exports[_0x913b('0x27')]=function(_0x34f254,_0x288442){var _0x1b5de9={},_0x43b955={},_0x4acf89={'count':0x0,'rows':[]};var _0x520e57=_[_0x913b('0x28')](db[_0x913b('0x29')][_0x913b('0x2a')],function(_0x457234){return{'name':_0x457234['fieldName'],'type':_0x457234['type'][_0x913b('0x2b')]};});_0x43b955[_0x913b('0x2c')]=_[_0x913b('0x28')](_0x520e57,_0x913b('0x25'));_0x43b955[_0x913b('0x2d')]=_[_0x913b('0x2e')](_0x34f254[_0x913b('0x2d')]);_0x43b955[_0x913b('0x2f')]=_['intersection'](_0x43b955[_0x913b('0x2c')],_0x43b955['query']);_0x1b5de9[_0x913b('0x30')]=_[_0x913b('0x31')](_0x43b955[_0x913b('0x2c')],qs[_0x913b('0x32')](_0x34f254[_0x913b('0x2d')][_0x913b('0x32')]));_0x1b5de9['attributes']=_0x1b5de9[_0x913b('0x30')]['length']?_0x1b5de9[_0x913b('0x30')]:_0x43b955['model'];if(!_0x34f254[_0x913b('0x2d')][_0x913b('0x33')](_0x913b('0x34'))){_0x1b5de9[_0x913b('0x1d')]=qs[_0x913b('0x1d')](_0x34f254[_0x913b('0x2d')][_0x913b('0x1d')]);_0x1b5de9[_0x913b('0x1c')]=qs['offset'](_0x34f254[_0x913b('0x2d')][_0x913b('0x1c')]);}_0x1b5de9[_0x913b('0x35')]=qs[_0x913b('0x36')](_0x34f254['query'][_0x913b('0x36')]);_0x1b5de9[_0x913b('0x37')]=qs['filters'](_[_0x913b('0x38')](_0x34f254[_0x913b('0x2d')],_0x43b955[_0x913b('0x2f')]),_0x520e57);if(_0x34f254[_0x913b('0x2d')][_0x913b('0x39')]){_0x1b5de9[_0x913b('0x37')]=_[_0x913b('0x3a')](_0x1b5de9[_0x913b('0x37')],{'$or':_[_0x913b('0x28')](_0x520e57,function(_0x23ee79){if(_0x23ee79['type']!=='VIRTUAL'){var _0x53930d={};_0x53930d[_0x23ee79['name']]={'$like':'%'+_0x34f254[_0x913b('0x2d')][_0x913b('0x39')]+'%'};return _0x53930d;}})});}_0x1b5de9=_[_0x913b('0x3a')]({},_0x1b5de9,_0x34f254[_0x913b('0x3b')]);var _0xea6b86={'where':_0x1b5de9[_0x913b('0x37')]};return db['AnalyticExtractedReport'][_0x913b('0x3c')](_0xea6b86)[_0x913b('0x20')](function(_0x214109){_0x4acf89[_0x913b('0x3c')]=_0x214109;if(_0x34f254[_0x913b('0x2d')]['includeAll']){_0x1b5de9[_0x913b('0x3d')]=[{'all':!![]}];}return db[_0x913b('0x29')][_0x913b('0x3e')](_0x1b5de9);})[_0x913b('0x20')](function(_0x7bca45){_0x4acf89['rows']=_0x7bca45;return _0x4acf89;})[_0x913b('0x20')](respondWithFilteredResult(_0x288442,_0x1b5de9))[_0x913b('0x3f')](handleError(_0x288442,null));};exports['show']=function(_0x4ed238,_0x2a313e){var _0x5ec868={'raw':!![],'where':{'id':_0x4ed238[_0x913b('0x40')]['id']}},_0x26bd4c={};_0x26bd4c[_0x913b('0x2c')]=_['keys'](db[_0x913b('0x29')][_0x913b('0x2a')]);_0x26bd4c[_0x913b('0x2d')]=_[_0x913b('0x2e')](_0x4ed238[_0x913b('0x2d')]);_0x26bd4c[_0x913b('0x2f')]=_['intersection'](_0x26bd4c['model'],_0x26bd4c[_0x913b('0x2d')]);_0x5ec868[_0x913b('0x30')]=_['intersection'](_0x26bd4c['model'],qs[_0x913b('0x32')](_0x4ed238[_0x913b('0x2d')][_0x913b('0x32')]));_0x5ec868[_0x913b('0x30')]=_0x5ec868[_0x913b('0x30')]['length']?_0x5ec868[_0x913b('0x30')]:_0x26bd4c[_0x913b('0x2c')];if(_0x4ed238[_0x913b('0x2d')]['includeAll']){_0x5ec868[_0x913b('0x3d')]=[{'all':!![]}];}_0x5ec868=_[_0x913b('0x3a')]({},_0x5ec868,_0x4ed238[_0x913b('0x3b')]);return db[_0x913b('0x29')][_0x913b('0x41')](_0x5ec868)[_0x913b('0x20')](handleEntityNotFound(_0x2a313e,null))[_0x913b('0x20')](respondWithResult(_0x2a313e,null))[_0x913b('0x3f')](handleError(_0x2a313e,null));};exports[_0x913b('0x42')]=function(_0x3009be,_0x4e3f7b){return db[_0x913b('0x29')][_0x913b('0x42')](_0x3009be[_0x913b('0x43')],{})[_0x913b('0x20')](function(_0x207181){var _0x247fdc=_0x3009be[_0x913b('0x44')][_0x913b('0x21')]({'plain':!![]});if(!_0x247fdc)throw new Error(_0x913b('0x45'));if(_0x247fdc['role']==='user'){var _0x467c52=_0x207181['get']({'plain':!![]});var _0x16f25f=_0x913b('0x22');return db[_0x913b('0x46')]['find']({'where':{'name':_0x16f25f,'userProfileId':_0x247fdc[_0x913b('0x47')]},'raw':!![]})[_0x913b('0x20')](function(_0x1cbe33){if(_0x1cbe33&&_0x1cbe33[_0x913b('0x48')]===0x0){return db[_0x913b('0x49')][_0x913b('0x42')]({'name':_0x467c52[_0x913b('0x25')],'resourceId':_0x467c52['id'],'type':_0x1cbe33[_0x913b('0x25')],'sectionId':_0x1cbe33['id']},{})[_0x913b('0x20')](function(){return _0x207181;});}else{return _0x207181;}})[_0x913b('0x3f')](function(_0x54c83a){logger[_0x913b('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54c83a);throw _0x54c83a;});}return _0x207181;})[_0x913b('0x20')](respondWithResult(_0x4e3f7b,0xc9))[_0x913b('0x3f')](handleError(_0x4e3f7b,null));};exports[_0x913b('0x1e')]=function(_0x328e0e,_0x1ed372){if(_0x328e0e['body']['id']){delete _0x328e0e[_0x913b('0x43')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x328e0e['params']['id']}})[_0x913b('0x20')](handleEntityNotFound(_0x1ed372,null))[_0x913b('0x20')](saveUpdates(_0x328e0e[_0x913b('0x43')],null))['then'](respondWithResult(_0x1ed372,null))['catch'](handleError(_0x1ed372,null));};exports['destroy']=function(_0x475526,_0x3f2183){return db[_0x913b('0x29')][_0x913b('0x41')]({'where':{'id':_0x475526['params']['id']}})[_0x913b('0x20')](handleEntityNotFound(_0x3f2183,null))[_0x913b('0x20')](removeEntity(_0x3f2183,null))[_0x913b('0x3f')](handleError(_0x3f2183,null));};exports[_0x913b('0x4a')]=function(_0x4dccab,_0x5740ed,_0x23cb46){return db[_0x913b('0x29')][_0x913b('0x41')]({'where':{'id':_0x4dccab[_0x913b('0x40')]['id']},'attributes':['name','basename',_0x913b('0x4b'),'output'],'raw':!![]})[_0x913b('0x20')](handleEntityNotFound(_0x5740ed,null))['then'](function(_0x30cf09){if(_0x30cf09){if(!fs['existsSync'](path[_0x913b('0x4c')](config[_0x913b('0x4d')],_0x913b('0x4e'),_0x30cf09['savename']))){throw new db[(_0x913b('0x4f'))][(_0x913b('0x50'))](_0x913b('0x51'));}if(_0x4dccab['query'][_0x913b('0x52')]){return _0x5740ed[_0x913b('0x18')](0xc8);}return _0x5740ed[_0x913b('0x4a')](path['join'](config[_0x913b('0x4d')],'server/files/reports',_0x30cf09[_0x913b('0x4b')]),util['format'](_0x913b('0x53'),_0x30cf09[_0x913b('0x54')]||_0x30cf09['name'],_0x30cf09[_0x913b('0x55')][_0x913b('0x56')]()));}})[_0x913b('0x3f')](handleError(_0x5740ed,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 295e81f..6d10b39 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 _0x7c7c=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird'];(function(_0x390778,_0x5f8631){var _0x45da39=function(_0x27563a){while(--_0x27563a){_0x390778['push'](_0x390778['shift']());}};_0x45da39(++_0x5f8631);}(_0x7c7c,0x67));var _0xc7c7=function(_0x1b4395,_0x427c86){_0x1b4395=_0x1b4395-0x0;var _0x25b235=_0x7c7c[_0x1b4395];return _0x25b235;};'use strict';var _=require('lodash');var util=require(_0xc7c7('0x0'));var logger=require(_0xc7c7('0x1'))(_0xc7c7('0x2'));var moment=require(_0xc7c7('0x3'));var BPromise=require(_0xc7c7('0x4'));var rp=require(_0xc7c7('0x5'));var fs=require('fs');var path=require(_0xc7c7('0x6'));var rimraf=require('rimraf');var config=require(_0xc7c7('0x7'));var attributes=require(_0xc7c7('0x8'));module[_0xc7c7('0x9')]=function(_0x3102f7,_0x25520f){return _0x3102f7[_0xc7c7('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xc7c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf59e=['../../config/logger','api','moment','bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x570c15,_0x3893d3){var _0x34e4d0=function(_0x5dcc44){while(--_0x5dcc44){_0x570c15['push'](_0x570c15['shift']());}};_0x34e4d0(++_0x3893d3);}(_0xf59e,0x1df));var _0xef59=function(_0x18981d,_0x4d21f5){_0x18981d=_0x18981d-0x0;var _0x1c0f9a=_0xf59e[_0x18981d];return _0x1c0f9a;};'use strict';var _=require(_0xef59('0x0'));var util=require('util');var logger=require(_0xef59('0x1'))(_0xef59('0x2'));var moment=require(_0xef59('0x3'));var BPromise=require(_0xef59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef59('0x5'));var rimraf=require('rimraf');var config=require(_0xef59('0x6'));var attributes=require(_0xef59('0x7'));module[_0xef59('0x8')]=function(_0x2eadb4,_0x261d16){return _0x2eadb4[_0xef59('0x9')](_0xef59('0xa'),attributes,{'tableName':_0xef59('0xb'),'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 7768317..5502d6f 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 _0x05d1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x463525,_0x4609ed){var _0xc60083=function(_0x418d7b){while(--_0x418d7b){_0x463525['push'](_0x463525['shift']());}};_0xc60083(++_0x4609ed);}(_0x05d1,0x154));var _0x105d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x05d1[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x105d('0x0'));var util=require(_0x105d('0x1'));var moment=require(_0x105d('0x2'));var BPromise=require(_0x105d('0x3'));var rs=require(_0x105d('0x4'));var fs=require('fs');var Redis=require(_0x105d('0x5'));var db=require(_0x105d('0x6'))['db'];var utils=require(_0x105d('0x7'));var logger=require(_0x105d('0x8'))(_0x105d('0x9'));var config=require('../../config/environment');var jayson=require(_0x105d('0xa'));var client=jayson['client'][_0x105d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x319ba4,_0xd87899,_0x2c779d){return new BPromise(function(_0x3b5e87,_0x373ea9){return client[_0x105d('0xc')](_0x319ba4,_0x2c779d)['then'](function(_0x3c809b){logger[_0x105d('0xd')](_0x105d('0xe'),_0xd87899,_0x105d('0xf'));logger['debug'](_0x105d('0x10'),_0xd87899,_0x105d('0xf'),JSON[_0x105d('0x11')](_0x3c809b));if(_0x3c809b['error']){if(_0x3c809b[_0x105d('0x12')][_0x105d('0x13')]===0x1f4){logger[_0x105d('0x12')](_0x105d('0xe'),_0xd87899,_0x3c809b[_0x105d('0x12')]['message']);return _0x373ea9(_0x3c809b['error'][_0x105d('0x14')]);}logger[_0x105d('0x12')](_0x105d('0xe'),_0xd87899,_0x3c809b['error'][_0x105d('0x14')]);return _0x3b5e87(_0x3c809b[_0x105d('0x12')][_0x105d('0x14')]);}else{logger[_0x105d('0xd')](_0x105d('0xe'),_0xd87899,_0x105d('0xf'));_0x3b5e87(_0x3c809b[_0x105d('0x15')][_0x105d('0x14')]);}})[_0x105d('0x16')](function(_0x3f3038){logger[_0x105d('0x12')](_0x105d('0xe'),_0xd87899,_0x3f3038);_0x373ea9(_0x3f3038);});});} \ No newline at end of file +var _0x3d74=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x27b530,_0x223a73){var _0x3a67a9=function(_0x219137){while(--_0x219137){_0x27b530['push'](_0x27b530['shift']());}};_0x3a67a9(++_0x223a73);}(_0x3d74,0x6c));var _0x43d7=function(_0x59fe28,_0x4db31e){_0x59fe28=_0x59fe28-0x0;var _0x330410=_0x3d74[_0x59fe28];return _0x330410;};'use strict';var _=require(_0x43d7('0x0'));var util=require(_0x43d7('0x1'));var moment=require(_0x43d7('0x2'));var BPromise=require(_0x43d7('0x3'));var rs=require(_0x43d7('0x4'));var fs=require('fs');var Redis=require(_0x43d7('0x5'));var db=require(_0x43d7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x43d7('0x7'))(_0x43d7('0x8'));var config=require(_0x43d7('0x9'));var jayson=require(_0x43d7('0xa'));var client=jayson['client'][_0x43d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21d8c2,_0x47c92e,_0xd1a717){return new BPromise(function(_0x2f243e,_0x291720){return client[_0x43d7('0xc')](_0x21d8c2,_0xd1a717)[_0x43d7('0xd')](function(_0x419a2f){logger[_0x43d7('0xe')](_0x43d7('0xf'),_0x47c92e,_0x43d7('0x10'));logger['debug'](_0x43d7('0x11'),_0x47c92e,_0x43d7('0x10'),JSON[_0x43d7('0x12')](_0x419a2f));if(_0x419a2f['error']){if(_0x419a2f[_0x43d7('0x13')][_0x43d7('0x14')]===0x1f4){logger[_0x43d7('0x13')](_0x43d7('0xf'),_0x47c92e,_0x419a2f[_0x43d7('0x13')][_0x43d7('0x15')]);return _0x291720(_0x419a2f['error'][_0x43d7('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x47c92e,_0x419a2f['error']['message']);return _0x2f243e(_0x419a2f[_0x43d7('0x13')][_0x43d7('0x15')]);}else{logger[_0x43d7('0xe')](_0x43d7('0xf'),_0x47c92e,_0x43d7('0x10'));_0x2f243e(_0x419a2f[_0x43d7('0x16')][_0x43d7('0x15')]);}})[_0x43d7('0x17')](function(_0x599adf){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x47c92e,_0x599adf);_0x291720(_0x599adf);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e8fe09a..42c819a 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 _0x3a0f=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x12f38a,_0x2bd595){var _0x388264=function(_0x217c9b){while(--_0x217c9b){_0x12f38a['push'](_0x12f38a['shift']());}};_0x388264(++_0x2bd595);}(_0x3a0f,0x75));var _0xf3a0=function(_0x38e1ac,_0x3b34b4){_0x38e1ac=_0x38e1ac-0x0;var _0x182bd3=_0x3a0f[_0x38e1ac];return _0x182bd3;};'use strict';var multer=require(_0xf3a0('0x0'));var util=require(_0xf3a0('0x1'));var path=require(_0xf3a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xf3a0('0x3'));var router=express[_0xf3a0('0x4')]();var auth=require(_0xf3a0('0x5'));var interaction=require(_0xf3a0('0x6'));var config=require(_0xf3a0('0x7'));var controller=require(_0xf3a0('0x8'));router[_0xf3a0('0x9')]('/',auth[_0xf3a0('0xa')](),controller[_0xf3a0('0xb')]);router[_0xf3a0('0x9')](_0xf3a0('0xc'),auth[_0xf3a0('0xa')](),controller[_0xf3a0('0xd')]);router[_0xf3a0('0x9')](_0xf3a0('0xe'),auth[_0xf3a0('0xa')](),controller[_0xf3a0('0xf')]);router[_0xf3a0('0x10')]('/',auth['isAuthenticated'](),controller[_0xf3a0('0x11')]);router[_0xf3a0('0x12')](_0xf3a0('0xc'),auth['isAuthenticated'](),controller[_0xf3a0('0x13')]);router['delete'](_0xf3a0('0xc'),auth[_0xf3a0('0xa')](),controller['destroy']);module[_0xf3a0('0x14')]=router; \ No newline at end of file +var _0xc11b=['put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create'];(function(_0x5adbfb,_0x477471){var _0x46ffb2=function(_0x44992d){while(--_0x44992d){_0x5adbfb['push'](_0x5adbfb['shift']());}};_0x46ffb2(++_0x477471);}(_0xc11b,0x139));var _0xbc11=function(_0x286462,_0x2944a6){_0x286462=_0x286462-0x0;var _0x520658=_0xc11b[_0x286462];return _0x520658;};'use strict';var multer=require(_0xbc11('0x0'));var util=require(_0xbc11('0x1'));var path=require(_0xbc11('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc11('0x3'));var router=express[_0xbc11('0x4')]();var auth=require(_0xbc11('0x5'));var interaction=require(_0xbc11('0x6'));var config=require(_0xbc11('0x7'));var controller=require(_0xbc11('0x8'));router[_0xbc11('0x9')]('/',auth[_0xbc11('0xa')](),controller[_0xbc11('0xb')]);router[_0xbc11('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbc11('0xc')]);router[_0xbc11('0x9')](_0xbc11('0xd'),auth[_0xbc11('0xa')](),controller[_0xbc11('0xe')]);router[_0xbc11('0xf')]('/',auth[_0xbc11('0xa')](),controller[_0xbc11('0x10')]);router[_0xbc11('0x11')](_0xbc11('0x12'),auth[_0xbc11('0xa')](),controller['update']);router[_0xbc11('0x13')]('/:id',auth[_0xbc11('0xa')](),controller[_0xbc11('0x14')]);module[_0xbc11('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index fd2bfb5..58ac95b 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 _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x24775c,_0x369347){var _0x8aa447=function(_0x46720e){while(--_0x46720e){_0x24775c['push'](_0x24775c['shift']());}};_0x8aa447(++_0x369347);}(_0x7a54,0x106));var _0x47a5=function(_0x439c26,_0x9848f8){_0x439c26=_0x439c26-0x0;var _0x11a14a=_0x7a54[_0x439c26];return _0x11a14a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x1ba3cb,_0x44b146){var _0x12c1e8=function(_0x4c8da6){while(--_0x4c8da6){_0x1ba3cb['push'](_0x1ba3cb['shift']());}};_0x12c1e8(++_0x44b146);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 658475b..8b3b4bd 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 _0xe5ba=['destroy','then','sendStatus','error','name','send','index','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','create','bulkCreate','body','bulkDestroy','ids','addFields','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','save','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe5ba,0xd0));var _0xae5b=function(_0x398ee0,_0x14ea64){_0x398ee0=_0x398ee0-0x0;var _0x29b64a=_0xe5ba[_0x398ee0];return _0x29b64a;};'use strict';var pdf=require(_0xae5b('0x0'));var emlformat=require(_0xae5b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xae5b('0x2'));var jsonpatch=require(_0xae5b('0x3'));var rp=require(_0xae5b('0x4'));var moment=require(_0xae5b('0x5'));var BPromise=require(_0xae5b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae5b('0x7'));var sox=require(_0xae5b('0x8'));var csv=require(_0xae5b('0x9'));var ejs=require(_0xae5b('0xa'));var fs=require('fs');var _=require(_0xae5b('0xb'));var squel=require(_0xae5b('0xc'));var crypto=require(_0xae5b('0xd'));var jsforce=require(_0xae5b('0xe'));var deskjs=require(_0xae5b('0xf'));var toCsv=require(_0xae5b('0x9'));var querystring=require('querystring');var Papa=require(_0xae5b('0x10'));var Redis=require('ioredis');var authService=require(_0xae5b('0x11'));var qs=require(_0xae5b('0x12'));var as=require(_0xae5b('0x13'));var hardwareService=require(_0xae5b('0x14'));var logger=require(_0xae5b('0x15'))(_0xae5b('0x16'));var utils=require(_0xae5b('0x17'));var config=require(_0xae5b('0x18'));var licenseUtil=require(_0xae5b('0x19'));var db=require(_0xae5b('0x1a'))['db'];function respondWithStatusCode(_0x562b3c,_0x4fd19d){_0x4fd19d=_0x4fd19d||0xcc;return function(_0x447048){if(_0x447048){return _0x562b3c['sendStatus'](_0x4fd19d);}return _0x562b3c[_0xae5b('0x1b')](_0x4fd19d)[_0xae5b('0x1c')]();};}function respondWithResult(_0x276415,_0x259c9e){_0x259c9e=_0x259c9e||0xc8;return function(_0x251455){if(_0x251455){return _0x276415[_0xae5b('0x1b')](_0x259c9e)[_0xae5b('0x1d')](_0x251455);}};}function respondWithFilteredResult(_0x4af548,_0x238a88){return function(_0x78c298){if(_0x78c298){var _0x12c0a4=_0x78c298[_0xae5b('0x1e')],_0x45daa2=_0x238a88[_0xae5b('0x1f')],_0x4bd7ca=_0x238a88[_0xae5b('0x1f')]+_0x238a88['limit'],_0xc47b7b;if(_0x4bd7ca>=_0x12c0a4){_0x4bd7ca=_0x12c0a4;_0xc47b7b=0xc8;}else{_0xc47b7b=0xce;}_0x4af548['status'](_0xc47b7b);return _0x4af548[_0xae5b('0x20')]('Content-Range',_0x45daa2+'-'+_0x4bd7ca+'/'+_0x12c0a4)[_0xae5b('0x1d')](_0x78c298);}return null;};}function patchUpdates(_0x3bc58c){return function(_0x42350c){try{jsonpatch['apply'](_0x42350c,_0x3bc58c,!![]);}catch(_0x542d2a){return BPromise['reject'](_0x542d2a);}return _0x42350c[_0xae5b('0x21')]();};}function saveUpdates(_0x49a4b4,_0x33e87b){return function(_0xbe5a86){if(_0xbe5a86){return _0xbe5a86[_0xae5b('0x22')](_0x49a4b4)['then'](function(_0x391b49){return _0x391b49;});}return null;};}function removeEntity(_0x3f4f2a,_0x283f7a){return function(_0x386ec5){if(_0x386ec5){return _0x386ec5[_0xae5b('0x23')]()[_0xae5b('0x24')](function(){_0x3f4f2a[_0xae5b('0x1b')](0xcc)[_0xae5b('0x1c')]();});}};}function handleEntityNotFound(_0x4f5ca2,_0x6c2308){return function(_0x29aa98){if(!_0x29aa98){_0x4f5ca2[_0xae5b('0x25')](0x194);}return _0x29aa98;};}function handleError(_0x5c7756,_0x368e32){_0x368e32=_0x368e32||0x1f4;return function(_0x860d8a){logger[_0xae5b('0x26')](_0x860d8a['stack']);if(_0x860d8a[_0xae5b('0x27')]){delete _0x860d8a[_0xae5b('0x27')];}_0x5c7756['status'](_0x368e32)[_0xae5b('0x28')](_0x860d8a);};}exports[_0xae5b('0x29')]=function(_0x3ac2d5,_0x471e66){var _0x4ee538={},_0x4f9e50={},_0x2b9db0={'count':0x0,'rows':[]};var _0x1b1801=_['map'](db[_0xae5b('0x2a')][_0xae5b('0x2b')],function(_0x1497c9){return{'name':_0x1497c9['fieldName'],'type':_0x1497c9[_0xae5b('0x2c')][_0xae5b('0x2d')]};});_0x4f9e50[_0xae5b('0x2e')]=_['map'](_0x1b1801,_0xae5b('0x27'));_0x4f9e50[_0xae5b('0x2f')]=_[_0xae5b('0x30')](_0x3ac2d5[_0xae5b('0x2f')]);_0x4f9e50[_0xae5b('0x31')]=_['intersection'](_0x4f9e50[_0xae5b('0x2e')],_0x4f9e50[_0xae5b('0x2f')]);_0x4ee538['attributes']=_[_0xae5b('0x32')](_0x4f9e50['model'],qs[_0xae5b('0x33')](_0x3ac2d5[_0xae5b('0x2f')]['fields']));_0x4ee538[_0xae5b('0x34')]=_0x4ee538[_0xae5b('0x34')][_0xae5b('0x35')]?_0x4ee538['attributes']:_0x4f9e50[_0xae5b('0x2e')];if(!_0x3ac2d5[_0xae5b('0x2f')][_0xae5b('0x36')](_0xae5b('0x37'))){_0x4ee538[_0xae5b('0x38')]=qs[_0xae5b('0x38')](_0x3ac2d5[_0xae5b('0x2f')][_0xae5b('0x38')]);_0x4ee538[_0xae5b('0x1f')]=qs['offset'](_0x3ac2d5[_0xae5b('0x2f')][_0xae5b('0x1f')]);}_0x4ee538[_0xae5b('0x39')]=qs[_0xae5b('0x3a')](_0x3ac2d5['query']['sort']);_0x4ee538[_0xae5b('0x3b')]=qs[_0xae5b('0x31')](_['pick'](_0x3ac2d5[_0xae5b('0x2f')],_0x4f9e50[_0xae5b('0x31')]),_0x1b1801);if(_0x3ac2d5[_0xae5b('0x2f')][_0xae5b('0x3c')]){_0x4ee538['where']=_['merge'](_0x4ee538[_0xae5b('0x3b')],{'$or':_[_0xae5b('0x3d')](_0x1b1801,function(_0x80d344){if(_0x80d344[_0xae5b('0x2c')]!==_0xae5b('0x3e')){var _0x2e14f8={};_0x2e14f8[_0x80d344['name']]={'$like':'%'+_0x3ac2d5[_0xae5b('0x2f')]['filter']+'%'};return _0x2e14f8;}})});}_0x4ee538=_[_0xae5b('0x3f')]({},_0x4ee538,_0x3ac2d5['options']);var _0x1c1658={'where':_0x4ee538[_0xae5b('0x3b')]};return db['AnalyticFieldReport'][_0xae5b('0x1e')](_0x1c1658)[_0xae5b('0x24')](function(_0x59d0ec){_0x2b9db0['count']=_0x59d0ec;if(_0x3ac2d5[_0xae5b('0x2f')][_0xae5b('0x40')]){_0x4ee538[_0xae5b('0x41')]=[{'all':!![]}];}return db[_0xae5b('0x2a')][_0xae5b('0x42')](_0x4ee538);})[_0xae5b('0x24')](function(_0x5923dc){_0x2b9db0[_0xae5b('0x43')]=_0x5923dc;return _0x2b9db0;})[_0xae5b('0x24')](respondWithFilteredResult(_0x471e66,_0x4ee538))[_0xae5b('0x44')](handleError(_0x471e66,null));};exports[_0xae5b('0x45')]=function(_0x431438,_0x1535b4){var _0x8ea8b7={'raw':![],'where':{'id':_0x431438[_0xae5b('0x46')]['id']}},_0x1aeff4={};_0x1aeff4[_0xae5b('0x2e')]=_['keys'](db[_0xae5b('0x2a')][_0xae5b('0x2b')]);_0x1aeff4[_0xae5b('0x2f')]=_['keys'](_0x431438[_0xae5b('0x2f')]);_0x1aeff4[_0xae5b('0x31')]=_[_0xae5b('0x32')](_0x1aeff4[_0xae5b('0x2e')],_0x1aeff4[_0xae5b('0x2f')]);_0x8ea8b7[_0xae5b('0x34')]=_[_0xae5b('0x32')](_0x1aeff4[_0xae5b('0x2e')],qs[_0xae5b('0x33')](_0x431438[_0xae5b('0x2f')]['fields']));_0x8ea8b7[_0xae5b('0x34')]=_0x8ea8b7['attributes'][_0xae5b('0x35')]?_0x8ea8b7[_0xae5b('0x34')]:_0x1aeff4['model'];if(_0x431438[_0xae5b('0x2f')][_0xae5b('0x40')]){_0x8ea8b7[_0xae5b('0x41')]=[{'all':!![]}];}_0x8ea8b7=_['merge']({},_0x8ea8b7,_0x431438[_0xae5b('0x47')]);return db[_0xae5b('0x2a')]['find'](_0x8ea8b7)[_0xae5b('0x24')](handleEntityNotFound(_0x1535b4,null))['then'](respondWithResult(_0x1535b4,null))[_0xae5b('0x44')](handleError(_0x1535b4,null));};exports[_0xae5b('0x48')]=function(_0x11631d,_0x4e4341){return db[_0xae5b('0x2a')][_0xae5b('0x48')](_0x11631d['body'],{})[_0xae5b('0x24')](respondWithResult(_0x4e4341,0xc9))[_0xae5b('0x44')](handleError(_0x4e4341,null));};exports['bulkCreate']=function(_0x498bdd,_0x221499){return db['AnalyticFieldReport'][_0xae5b('0x49')](_0x498bdd[_0xae5b('0x4a')],{'raw':![],'individualHooks':!![]})[_0xae5b('0x24')](respondWithResult(_0x221499,0xc9))[_0xae5b('0x44')](handleError(_0x221499,null));};exports[_0xae5b('0x22')]=function(_0x10b4a3,_0x223362){if(_0x10b4a3['body']['id']){delete _0x10b4a3['body']['id'];}return db[_0xae5b('0x2a')]['find']({'where':{'id':_0x10b4a3[_0xae5b('0x46')]['id']}})[_0xae5b('0x24')](handleEntityNotFound(_0x223362,null))[_0xae5b('0x24')](saveUpdates(_0x10b4a3[_0xae5b('0x4a')],null))[_0xae5b('0x24')](respondWithResult(_0x223362,null))[_0xae5b('0x44')](handleError(_0x223362,null));};exports[_0xae5b('0x23')]=function(_0x58c68d,_0x2162a6){return db[_0xae5b('0x2a')]['find']({'where':{'id':_0x58c68d[_0xae5b('0x46')]['id']}})[_0xae5b('0x24')](handleEntityNotFound(_0x2162a6,null))[_0xae5b('0x24')](removeEntity(_0x2162a6,null))['catch'](handleError(_0x2162a6,null));};exports[_0xae5b('0x4b')]=function(_0x375557,_0x10c4e4){return db['AnalyticFieldReport'][_0xae5b('0x23')]({'where':{'id':_0x375557[_0xae5b('0x2f')][_0xae5b('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xae5b('0x24')](respondWithResult(_0x10c4e4,0xcc))[_0xae5b('0x44')](handleError(_0x10c4e4,null));};exports[_0xae5b('0x4d')]=function(_0x2d70a4,_0x555d0b,_0x56311a){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x2d70a4[_0xae5b('0x46')]['id']}})[_0xae5b('0x24')](handleEntityNotFound(_0x555d0b,null))['then'](function(_0x434623){if(_0x434623){return db[_0xae5b('0x4e')][_0xae5b('0x4f')](function(_0x5b61dd){return db[_0xae5b('0x2a')][_0xae5b('0x23')]({'where':{'CustomReportId':_0x2d70a4[_0xae5b('0x46')]['id']},'transaction':_0x5b61dd})[_0xae5b('0x24')](function(_0x55f1c6){var _0x57d41d=_['map'](_0x2d70a4[_0xae5b('0x4a')],function(_0x538c3e){delete _0x538c3e['id'];_0x538c3e[_0xae5b('0x50')]=_0x2d70a4[_0xae5b('0x46')]['id'];return _0x538c3e;});return db[_0xae5b('0x2a')][_0xae5b('0x49')](_0x57d41d,{'transaction':_0x5b61dd});});})['then'](function(){return db[_0xae5b('0x2a')][_0xae5b('0x42')]({'where':{'CustomReportId':_0x2d70a4[_0xae5b('0x46')]['id']}});});}})[_0xae5b('0x24')](respondWithResult(_0x555d0b,null))[_0xae5b('0x44')](handleError(_0x555d0b,null));}; \ No newline at end of file +var _0x7f6a=['sort','where','filter','merge','VIRTUAL','options','then','include','show','params','keys','includeAll','catch','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','name','map','AnalyticFieldReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x7f6a,0x69));var _0xa7f6=function(_0x28fa8f,_0x110107){_0x28fa8f=_0x28fa8f-0x0;var _0x520903=_0x7f6a[_0x28fa8f];return _0x520903;};'use strict';var pdf=require(_0xa7f6('0x0'));var emlformat=require(_0xa7f6('0x1'));var rimraf=require(_0xa7f6('0x2'));var zipdir=require(_0xa7f6('0x3'));var jsonpatch=require(_0xa7f6('0x4'));var rp=require(_0xa7f6('0x5'));var moment=require(_0xa7f6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa7f6('0x7'));var util=require(_0xa7f6('0x8'));var path=require(_0xa7f6('0x9'));var sox=require('sox');var csv=require(_0xa7f6('0xa'));var ejs=require(_0xa7f6('0xb'));var fs=require('fs');var _=require(_0xa7f6('0xc'));var squel=require('squel');var crypto=require(_0xa7f6('0xd'));var jsforce=require(_0xa7f6('0xe'));var deskjs=require(_0xa7f6('0xf'));var toCsv=require(_0xa7f6('0xa'));var querystring=require(_0xa7f6('0x10'));var Papa=require(_0xa7f6('0x11'));var Redis=require('ioredis');var authService=require(_0xa7f6('0x12'));var qs=require(_0xa7f6('0x13'));var as=require(_0xa7f6('0x14'));var hardwareService=require(_0xa7f6('0x15'));var logger=require(_0xa7f6('0x16'))(_0xa7f6('0x17'));var utils=require(_0xa7f6('0x18'));var config=require(_0xa7f6('0x19'));var licenseUtil=require(_0xa7f6('0x1a'));var db=require(_0xa7f6('0x1b'))['db'];function respondWithStatusCode(_0x553137,_0x3ffaea){_0x3ffaea=_0x3ffaea||0xcc;return function(_0x36e341){if(_0x36e341){return _0x553137[_0xa7f6('0x1c')](_0x3ffaea);}return _0x553137[_0xa7f6('0x1d')](_0x3ffaea)[_0xa7f6('0x1e')]();};}function respondWithResult(_0x1e56d3,_0x54e492){_0x54e492=_0x54e492||0xc8;return function(_0x51311e){if(_0x51311e){return _0x1e56d3[_0xa7f6('0x1d')](_0x54e492)[_0xa7f6('0x1f')](_0x51311e);}};}function respondWithFilteredResult(_0x2e2668,_0x49cdc6){return function(_0x4e4ba3){if(_0x4e4ba3){var _0x17f66f=_0x4e4ba3[_0xa7f6('0x20')],_0x2d7a10=_0x49cdc6[_0xa7f6('0x21')],_0x504a0d=_0x49cdc6[_0xa7f6('0x21')]+_0x49cdc6['limit'],_0x1f8d7f;if(_0x504a0d>=_0x17f66f){_0x504a0d=_0x17f66f;_0x1f8d7f=0xc8;}else{_0x1f8d7f=0xce;}_0x2e2668[_0xa7f6('0x1d')](_0x1f8d7f);return _0x2e2668[_0xa7f6('0x22')](_0xa7f6('0x23'),_0x2d7a10+'-'+_0x504a0d+'/'+_0x17f66f)[_0xa7f6('0x1f')](_0x4e4ba3);}return null;};}function patchUpdates(_0xb4c5c7){return function(_0x3af69a){try{jsonpatch[_0xa7f6('0x24')](_0x3af69a,_0xb4c5c7,!![]);}catch(_0x3c9bf7){return BPromise['reject'](_0x3c9bf7);}return _0x3af69a[_0xa7f6('0x25')]();};}function saveUpdates(_0x15d4c5,_0x402885){return function(_0xe6f248){if(_0xe6f248){return _0xe6f248['update'](_0x15d4c5)['then'](function(_0xa2874){return _0xa2874;});}return null;};}function removeEntity(_0x4b4c8e,_0x132a5b){return function(_0x54d8f6){if(_0x54d8f6){return _0x54d8f6[_0xa7f6('0x26')]()['then'](function(){_0x4b4c8e[_0xa7f6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8e0d,_0x24ad7c){return function(_0x1a4f87){if(!_0x1a4f87){_0x3a8e0d[_0xa7f6('0x1c')](0x194);}return _0x1a4f87;};}function handleError(_0x4a2c6b,_0x2a64c8){_0x2a64c8=_0x2a64c8||0x1f4;return function(_0xbe9f58){logger['error'](_0xbe9f58['stack']);if(_0xbe9f58[_0xa7f6('0x27')]){delete _0xbe9f58[_0xa7f6('0x27')];}_0x4a2c6b['status'](_0x2a64c8)['send'](_0xbe9f58);};}exports['index']=function(_0x43de0c,_0x26f682){var _0x3a8b3e={},_0x20d5fe={},_0x1d2150={'count':0x0,'rows':[]};var _0x3c074e=_[_0xa7f6('0x28')](db[_0xa7f6('0x29')][_0xa7f6('0x2a')],function(_0x3d6573){return{'name':_0x3d6573['fieldName'],'type':_0x3d6573[_0xa7f6('0x2b')][_0xa7f6('0x2c')]};});_0x20d5fe[_0xa7f6('0x2d')]=_[_0xa7f6('0x28')](_0x3c074e,_0xa7f6('0x27'));_0x20d5fe[_0xa7f6('0x2e')]=_['keys'](_0x43de0c['query']);_0x20d5fe[_0xa7f6('0x2f')]=_[_0xa7f6('0x30')](_0x20d5fe[_0xa7f6('0x2d')],_0x20d5fe[_0xa7f6('0x2e')]);_0x3a8b3e[_0xa7f6('0x31')]=_['intersection'](_0x20d5fe[_0xa7f6('0x2d')],qs[_0xa7f6('0x32')](_0x43de0c[_0xa7f6('0x2e')][_0xa7f6('0x32')]));_0x3a8b3e[_0xa7f6('0x31')]=_0x3a8b3e[_0xa7f6('0x31')][_0xa7f6('0x33')]?_0x3a8b3e[_0xa7f6('0x31')]:_0x20d5fe['model'];if(!_0x43de0c[_0xa7f6('0x2e')][_0xa7f6('0x34')]('nolimit')){_0x3a8b3e['limit']=qs[_0xa7f6('0x35')](_0x43de0c['query']['limit']);_0x3a8b3e[_0xa7f6('0x21')]=qs[_0xa7f6('0x21')](_0x43de0c[_0xa7f6('0x2e')]['offset']);}_0x3a8b3e[_0xa7f6('0x36')]=qs[_0xa7f6('0x37')](_0x43de0c['query']['sort']);_0x3a8b3e[_0xa7f6('0x38')]=qs['filters'](_['pick'](_0x43de0c['query'],_0x20d5fe[_0xa7f6('0x2f')]),_0x3c074e);if(_0x43de0c[_0xa7f6('0x2e')][_0xa7f6('0x39')]){_0x3a8b3e[_0xa7f6('0x38')]=_[_0xa7f6('0x3a')](_0x3a8b3e[_0xa7f6('0x38')],{'$or':_[_0xa7f6('0x28')](_0x3c074e,function(_0x5daf45){if(_0x5daf45[_0xa7f6('0x2b')]!==_0xa7f6('0x3b')){var _0x5e9575={};_0x5e9575[_0x5daf45[_0xa7f6('0x27')]]={'$like':'%'+_0x43de0c[_0xa7f6('0x2e')][_0xa7f6('0x39')]+'%'};return _0x5e9575;}})});}_0x3a8b3e=_['merge']({},_0x3a8b3e,_0x43de0c[_0xa7f6('0x3c')]);var _0x252441={'where':_0x3a8b3e[_0xa7f6('0x38')]};return db[_0xa7f6('0x29')][_0xa7f6('0x20')](_0x252441)[_0xa7f6('0x3d')](function(_0x2823f4){_0x1d2150['count']=_0x2823f4;if(_0x43de0c[_0xa7f6('0x2e')]['includeAll']){_0x3a8b3e[_0xa7f6('0x3e')]=[{'all':!![]}];}return db[_0xa7f6('0x29')]['findAll'](_0x3a8b3e);})[_0xa7f6('0x3d')](function(_0x471ea7){_0x1d2150['rows']=_0x471ea7;return _0x1d2150;})[_0xa7f6('0x3d')](respondWithFilteredResult(_0x26f682,_0x3a8b3e))['catch'](handleError(_0x26f682,null));};exports[_0xa7f6('0x3f')]=function(_0x3d54f7,_0x4c4f77){var _0x25ac10={'raw':![],'where':{'id':_0x3d54f7[_0xa7f6('0x40')]['id']}},_0x223b31={};_0x223b31[_0xa7f6('0x2d')]=_[_0xa7f6('0x41')](db[_0xa7f6('0x29')][_0xa7f6('0x2a')]);_0x223b31[_0xa7f6('0x2e')]=_[_0xa7f6('0x41')](_0x3d54f7[_0xa7f6('0x2e')]);_0x223b31[_0xa7f6('0x2f')]=_[_0xa7f6('0x30')](_0x223b31[_0xa7f6('0x2d')],_0x223b31[_0xa7f6('0x2e')]);_0x25ac10[_0xa7f6('0x31')]=_['intersection'](_0x223b31[_0xa7f6('0x2d')],qs[_0xa7f6('0x32')](_0x3d54f7['query'][_0xa7f6('0x32')]));_0x25ac10[_0xa7f6('0x31')]=_0x25ac10[_0xa7f6('0x31')][_0xa7f6('0x33')]?_0x25ac10['attributes']:_0x223b31[_0xa7f6('0x2d')];if(_0x3d54f7[_0xa7f6('0x2e')][_0xa7f6('0x42')]){_0x25ac10[_0xa7f6('0x3e')]=[{'all':!![]}];}_0x25ac10=_['merge']({},_0x25ac10,_0x3d54f7[_0xa7f6('0x3c')]);return db[_0xa7f6('0x29')]['find'](_0x25ac10)[_0xa7f6('0x3d')](handleEntityNotFound(_0x4c4f77,null))[_0xa7f6('0x3d')](respondWithResult(_0x4c4f77,null))[_0xa7f6('0x43')](handleError(_0x4c4f77,null));};exports[_0xa7f6('0x44')]=function(_0x2f25df,_0x33f5c1){return db[_0xa7f6('0x29')][_0xa7f6('0x44')](_0x2f25df[_0xa7f6('0x45')],{})[_0xa7f6('0x3d')](respondWithResult(_0x33f5c1,0xc9))[_0xa7f6('0x43')](handleError(_0x33f5c1,null));};exports[_0xa7f6('0x46')]=function(_0x307f32,_0x187106){return db[_0xa7f6('0x29')][_0xa7f6('0x46')](_0x307f32['body'],{'raw':![],'individualHooks':!![]})[_0xa7f6('0x3d')](respondWithResult(_0x187106,0xc9))[_0xa7f6('0x43')](handleError(_0x187106,null));};exports['update']=function(_0x1253fe,_0x2f6d57){if(_0x1253fe[_0xa7f6('0x45')]['id']){delete _0x1253fe[_0xa7f6('0x45')]['id'];}return db[_0xa7f6('0x29')]['find']({'where':{'id':_0x1253fe['params']['id']}})[_0xa7f6('0x3d')](handleEntityNotFound(_0x2f6d57,null))[_0xa7f6('0x3d')](saveUpdates(_0x1253fe[_0xa7f6('0x45')],null))[_0xa7f6('0x3d')](respondWithResult(_0x2f6d57,null))[_0xa7f6('0x43')](handleError(_0x2f6d57,null));};exports[_0xa7f6('0x26')]=function(_0x3b7d3a,_0x1b3068){return db['AnalyticFieldReport'][_0xa7f6('0x47')]({'where':{'id':_0x3b7d3a[_0xa7f6('0x40')]['id']}})[_0xa7f6('0x3d')](handleEntityNotFound(_0x1b3068,null))[_0xa7f6('0x3d')](removeEntity(_0x1b3068,null))[_0xa7f6('0x43')](handleError(_0x1b3068,null));};exports[_0xa7f6('0x48')]=function(_0x2df2ad,_0x18e45f){return db[_0xa7f6('0x29')][_0xa7f6('0x26')]({'where':{'id':_0x2df2ad[_0xa7f6('0x2e')][_0xa7f6('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xa7f6('0x3d')](respondWithResult(_0x18e45f,0xcc))[_0xa7f6('0x43')](handleError(_0x18e45f,null));};exports[_0xa7f6('0x4a')]=function(_0x26cba6,_0x51f39b,_0x3adbfe){return db[_0xa7f6('0x4b')][_0xa7f6('0x4c')]({'where':{'id':_0x26cba6[_0xa7f6('0x40')]['id']}})[_0xa7f6('0x3d')](handleEntityNotFound(_0x51f39b,null))[_0xa7f6('0x3d')](function(_0xaa1fad){if(_0xaa1fad){return db[_0xa7f6('0x4d')][_0xa7f6('0x4e')](function(_0x45ae3b){return db[_0xa7f6('0x29')][_0xa7f6('0x26')]({'where':{'CustomReportId':_0x26cba6[_0xa7f6('0x40')]['id']},'transaction':_0x45ae3b})['then'](function(_0x304973){var _0x55db74=_[_0xa7f6('0x28')](_0x26cba6[_0xa7f6('0x45')],function(_0x1ae6ef){delete _0x1ae6ef['id'];_0x1ae6ef[_0xa7f6('0x4f')]=_0x26cba6['params']['id'];return _0x1ae6ef;});return db[_0xa7f6('0x29')][_0xa7f6('0x46')](_0x55db74,{'transaction':_0x45ae3b});});})[_0xa7f6('0x3d')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x26cba6[_0xa7f6('0x40')]['id']}});});}})[_0xa7f6('0x3d')](respondWithResult(_0x51f39b,null))[_0xa7f6('0x43')](handleError(_0x51f39b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f5fa300..dbcfc58 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 _0xffa8=['bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','lodash','util','../../config/logger','api','moment'];(function(_0x316923,_0x435111){var _0x1ce888=function(_0x59e97e){while(--_0x59e97e){_0x316923['push'](_0x316923['shift']());}};_0x1ce888(++_0x435111);}(_0xffa8,0xdf));var _0x8ffa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xffa8[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x8ffa('0x0'));var util=require(_0x8ffa('0x1'));var logger=require(_0x8ffa('0x2'))(_0x8ffa('0x3'));var moment=require(_0x8ffa('0x4'));var BPromise=require(_0x8ffa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ffa('0x6'));var rimraf=require(_0x8ffa('0x7'));var config=require(_0x8ffa('0x8'));var attributes=require(_0x8ffa('0x9'));module[_0x8ffa('0xa')]=function(_0xb3c3ce,_0x494420){return _0xb3c3ce['define'](_0x8ffa('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9991=['api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x39493f,_0x36b9c6){var _0x2c1ddf=function(_0x49b0ea){while(--_0x49b0ea){_0x39493f['push'](_0x39493f['shift']());}};_0x2c1ddf(++_0x36b9c6);}(_0x9991,0x6d));var _0x1999=function(_0xdef7a2,_0x4a2b35){_0xdef7a2=_0xdef7a2-0x0;var _0x29c0a8=_0x9991[_0xdef7a2];return _0x29c0a8;};'use strict';var _=require(_0x1999('0x0'));var util=require(_0x1999('0x1'));var logger=require(_0x1999('0x2'))(_0x1999('0x3'));var moment=require(_0x1999('0x4'));var BPromise=require(_0x1999('0x5'));var rp=require(_0x1999('0x6'));var fs=require('fs');var path=require(_0x1999('0x7'));var rimraf=require(_0x1999('0x8'));var config=require('../../config/environment');var attributes=require(_0x1999('0x9'));module[_0x1999('0xa')]=function(_0x343075,_0x53ea36){return _0x343075[_0x1999('0xb')](_0x1999('0xc'),attributes,{'tableName':_0x1999('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c6e92ce..34026de 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 _0x3c08=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x27e7cb,_0x242c56){var _0x1e5e7a=function(_0x1aab88){while(--_0x1aab88){_0x27e7cb['push'](_0x27e7cb['shift']());}};_0x1e5e7a(++_0x242c56);}(_0x3c08,0x16e));var _0x83c0=function(_0x9b4965,_0x49372d){_0x9b4965=_0x9b4965-0x0;var _0x344a8c=_0x3c08[_0x9b4965];return _0x344a8c;};'use strict';var _=require(_0x83c0('0x0'));var util=require(_0x83c0('0x1'));var moment=require('moment');var BPromise=require(_0x83c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83c0('0x3'));var db=require(_0x83c0('0x4'))['db'];var utils=require(_0x83c0('0x5'));var logger=require(_0x83c0('0x6'))(_0x83c0('0x7'));var config=require(_0x83c0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x83c0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x310385,_0xdaaa06,_0x117801){return new BPromise(function(_0x5bfc52,_0x1a41b8){return client[_0x83c0('0xa')](_0x310385,_0x117801)[_0x83c0('0xb')](function(_0x1212ad){logger[_0x83c0('0xc')](_0x83c0('0xd'),_0xdaaa06,_0x83c0('0xe'));logger[_0x83c0('0xf')](_0x83c0('0x10'),_0xdaaa06,_0x83c0('0xe'),JSON[_0x83c0('0x11')](_0x1212ad));if(_0x1212ad[_0x83c0('0x12')]){if(_0x1212ad['error'][_0x83c0('0x13')]===0x1f4){logger['error'](_0x83c0('0xd'),_0xdaaa06,_0x1212ad[_0x83c0('0x12')][_0x83c0('0x14')]);return _0x1a41b8(_0x1212ad[_0x83c0('0x12')][_0x83c0('0x14')]);}logger['error'](_0x83c0('0xd'),_0xdaaa06,_0x1212ad[_0x83c0('0x12')]['message']);return _0x5bfc52(_0x1212ad[_0x83c0('0x12')][_0x83c0('0x14')]);}else{logger[_0x83c0('0xc')](_0x83c0('0xd'),_0xdaaa06,'request\x20sent');_0x5bfc52(_0x1212ad[_0x83c0('0x15')][_0x83c0('0x14')]);}})[_0x83c0('0x16')](function(_0x40fa2c){logger[_0x83c0('0x12')](_0x83c0('0xd'),_0xdaaa06,_0x40fa2c);_0x1a41b8(_0x40fa2c);});});} \ No newline at end of file +var _0x10c0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10c0,0xa5));var _0x010c=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x10c0[_0x4ed1d4];return _0x28e363;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x010c('0x0'));var BPromise=require('bluebird');var rs=require(_0x010c('0x1'));var fs=require('fs');var Redis=require(_0x010c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x010c('0x3'));var logger=require(_0x010c('0x4'))(_0x010c('0x5'));var config=require(_0x010c('0x6'));var jayson=require(_0x010c('0x7'));var client=jayson[_0x010c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15b6b4,_0x5bcfc5,_0x486341){return new BPromise(function(_0x4e6cf7,_0x3f03bf){return client[_0x010c('0x9')](_0x15b6b4,_0x486341)[_0x010c('0xa')](function(_0x82bf1f){logger[_0x010c('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5bcfc5,_0x010c('0xc'));logger[_0x010c('0xd')](_0x010c('0xe'),_0x5bcfc5,_0x010c('0xc'),JSON[_0x010c('0xf')](_0x82bf1f));if(_0x82bf1f[_0x010c('0x10')]){if(_0x82bf1f[_0x010c('0x10')]['code']===0x1f4){logger[_0x010c('0x10')](_0x010c('0x11'),_0x5bcfc5,_0x82bf1f[_0x010c('0x10')][_0x010c('0x12')]);return _0x3f03bf(_0x82bf1f[_0x010c('0x10')][_0x010c('0x12')]);}logger['error'](_0x010c('0x11'),_0x5bcfc5,_0x82bf1f[_0x010c('0x10')]['message']);return _0x4e6cf7(_0x82bf1f[_0x010c('0x10')][_0x010c('0x12')]);}else{logger[_0x010c('0xb')](_0x010c('0x11'),_0x5bcfc5,'request\x20sent');_0x4e6cf7(_0x82bf1f[_0x010c('0x13')][_0x010c('0x12')]);}})[_0x010c('0x14')](function(_0xc6f15a){logger[_0x010c('0x10')](_0x010c('0x11'),_0x5bcfc5,_0xc6f15a);_0x3f03bf(_0xc6f15a);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 530359c..ad9208b 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 _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x342136,_0x55dab7){var _0x194c7f=function(_0x5e0924){while(--_0x5e0924){_0x342136['push'](_0x342136['shift']());}};_0x194c7f(++_0x55dab7);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'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 auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('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 11d15dc..c0acc8f 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 _0xb515=['sequelize','STRING','name','TEXT'];(function(_0x55cc5a,_0x4a79e0){var _0x45289c=function(_0x3393ba){while(--_0x3393ba){_0x55cc5a['push'](_0x55cc5a['shift']());}};_0x45289c(++_0x4a79e0);}(_0xb515,0x1b8));var _0x5b51=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0xb515[_0x1196bd];return _0x26014f;};'use strict';var Sequelize=require(_0x5b51('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b51('0x1')],'allowNull':![],'unique':_0x5b51('0x2')},'table':{'type':Sequelize[_0x5b51('0x1')]},'metric':{'type':Sequelize[_0x5b51('0x3')]},'description':{'type':Sequelize[_0x5b51('0x1')]}}; \ No newline at end of file +var _0x9ed4=['STRING','name','TEXT','sequelize','exports'];(function(_0x25622f,_0x4fb9f9){var _0x44f990=function(_0x38626e){while(--_0x38626e){_0x25622f['push'](_0x25622f['shift']());}};_0x44f990(++_0x4fb9f9);}(_0x9ed4,0x1a7));var _0x49ed=function(_0x5cdf7e,_0x4059d6){_0x5cdf7e=_0x5cdf7e-0x0;var _0x449f2d=_0x9ed4[_0x5cdf7e];return _0x449f2d;};'use strict';var Sequelize=require(_0x49ed('0x0'));module[_0x49ed('0x1')]={'name':{'type':Sequelize[_0x49ed('0x2')],'allowNull':![],'unique':_0x49ed('0x3')},'table':{'type':Sequelize[_0x49ed('0x2')]},'metric':{'type':Sequelize[_0x49ed('0x4')]},'description':{'type':Sequelize[_0x49ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c4d9582..7e8900b 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 _0x0a0b=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Metrics','then','sendStatus','error','stack','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2385d6,_0x54c478){var _0x26e919=function(_0x43090a){while(--_0x43090a){_0x2385d6['push'](_0x2385d6['shift']());}};_0x26e919(++_0x54c478);}(_0x0a0b,0x1bd));var _0xb0a0=function(_0x51620c,_0x1ca88d){_0x51620c=_0x51620c-0x0;var _0x317e7e=_0x0a0b[_0x51620c];return _0x317e7e;};'use strict';var pdf=require(_0xb0a0('0x0'));var emlformat=require(_0xb0a0('0x1'));var rimraf=require(_0xb0a0('0x2'));var zipdir=require(_0xb0a0('0x3'));var jsonpatch=require(_0xb0a0('0x4'));var rp=require(_0xb0a0('0x5'));var moment=require(_0xb0a0('0x6'));var BPromise=require(_0xb0a0('0x7'));var Mustache=require(_0xb0a0('0x8'));var util=require(_0xb0a0('0x9'));var path=require(_0xb0a0('0xa'));var sox=require('sox');var csv=require(_0xb0a0('0xb'));var ejs=require(_0xb0a0('0xc'));var fs=require('fs');var _=require(_0xb0a0('0xd'));var squel=require(_0xb0a0('0xe'));var crypto=require(_0xb0a0('0xf'));var jsforce=require(_0xb0a0('0x10'));var deskjs=require(_0xb0a0('0x11'));var toCsv=require(_0xb0a0('0xb'));var querystring=require(_0xb0a0('0x12'));var Papa=require(_0xb0a0('0x13'));var Redis=require(_0xb0a0('0x14'));var authService=require(_0xb0a0('0x15'));var qs=require(_0xb0a0('0x16'));var as=require(_0xb0a0('0x17'));var hardwareService=require(_0xb0a0('0x18'));var logger=require(_0xb0a0('0x19'))('api');var utils=require(_0xb0a0('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb0a0('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2d30,_0x4a2abe){_0x4a2abe=_0x4a2abe||0xcc;return function(_0x34dcae){if(_0x34dcae){return _0x4f2d30['sendStatus'](_0x4a2abe);}return _0x4f2d30['status'](_0x4a2abe)[_0xb0a0('0x1c')]();};}function respondWithResult(_0x116fd4,_0x2649db){_0x2649db=_0x2649db||0xc8;return function(_0x3b64fd){if(_0x3b64fd){return _0x116fd4[_0xb0a0('0x1d')](_0x2649db)['json'](_0x3b64fd);}};}function respondWithFilteredResult(_0x4d2193,_0x3c1132){return function(_0xeff40c){if(_0xeff40c){var _0x5da8f2=_0xeff40c[_0xb0a0('0x1e')],_0x5812c7=_0x3c1132['offset'],_0x4a5315=_0x3c1132[_0xb0a0('0x1f')]+_0x3c1132[_0xb0a0('0x20')],_0x3debeb;if(_0x4a5315>=_0x5da8f2){_0x4a5315=_0x5da8f2;_0x3debeb=0xc8;}else{_0x3debeb=0xce;}_0x4d2193[_0xb0a0('0x1d')](_0x3debeb);return _0x4d2193[_0xb0a0('0x21')](_0xb0a0('0x22'),_0x5812c7+'-'+_0x4a5315+'/'+_0x5da8f2)['json'](_0xeff40c);}return null;};}function patchUpdates(_0x1d8e77){return function(_0x5b3b36){try{jsonpatch[_0xb0a0('0x23')](_0x5b3b36,_0x1d8e77,!![]);}catch(_0x4c352f){return BPromise[_0xb0a0('0x24')](_0x4c352f);}return _0x5b3b36[_0xb0a0('0x25')]();};}function saveUpdates(_0xb01f8,_0x4f214e){return function(_0x8eb0cc){if(_0x8eb0cc){return _0x8eb0cc[_0xb0a0('0x26')](_0xb01f8)['then'](function(_0x4649ee){return _0x4649ee;});}return null;};}function removeEntity(_0x5d5a0f,_0xfecabf){return function(_0x791d7d){if(_0x791d7d){return _0x791d7d[_0xb0a0('0x27')]()['then'](function(){var _0x5d5472=_0x791d7d[_0xb0a0('0x28')]({'plain':!![]});var _0x400e1a=_0xb0a0('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x400e1a,'resourceId':_0x5d5472['id']}})[_0xb0a0('0x2a')](function(){return _0x791d7d;});})['then'](function(){_0x5d5a0f['status'](0xcc)[_0xb0a0('0x1c')]();});}};}function handleEntityNotFound(_0x3374f3,_0x82f77e){return function(_0x122e1a){if(!_0x122e1a){_0x3374f3[_0xb0a0('0x2b')](0x194);}return _0x122e1a;};}function handleError(_0x324331,_0x3bc15b){_0x3bc15b=_0x3bc15b||0x1f4;return function(_0x214a28){logger[_0xb0a0('0x2c')](_0x214a28[_0xb0a0('0x2d')]);if(_0x214a28['name']){delete _0x214a28['name'];}_0x324331['status'](_0x3bc15b)[_0xb0a0('0x2e')](_0x214a28);};}exports[_0xb0a0('0x2f')]=function(_0x6cb79e,_0x272075){var _0x43e1d8={},_0x1f28cf={},_0x3d33d={'count':0x0,'rows':[]};var _0x1221e6=_[_0xb0a0('0x30')](db[_0xb0a0('0x31')][_0xb0a0('0x32')],function(_0x5467b5){return{'name':_0x5467b5[_0xb0a0('0x33')],'type':_0x5467b5['type'][_0xb0a0('0x34')]};});_0x1f28cf[_0xb0a0('0x35')]=_['map'](_0x1221e6,_0xb0a0('0x36'));_0x1f28cf['query']=_['keys'](_0x6cb79e['query']);_0x1f28cf[_0xb0a0('0x37')]=_[_0xb0a0('0x38')](_0x1f28cf[_0xb0a0('0x35')],_0x1f28cf[_0xb0a0('0x39')]);_0x43e1d8[_0xb0a0('0x3a')]=_['intersection'](_0x1f28cf[_0xb0a0('0x35')],qs[_0xb0a0('0x3b')](_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x3b')]));_0x43e1d8[_0xb0a0('0x3a')]=_0x43e1d8[_0xb0a0('0x3a')][_0xb0a0('0x3c')]?_0x43e1d8[_0xb0a0('0x3a')]:_0x1f28cf[_0xb0a0('0x35')];if(!_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x3d')](_0xb0a0('0x3e'))){_0x43e1d8[_0xb0a0('0x20')]=qs[_0xb0a0('0x20')](_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x20')]);_0x43e1d8['offset']=qs['offset'](_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x1f')]);}_0x43e1d8[_0xb0a0('0x3f')]=qs[_0xb0a0('0x40')](_0x6cb79e['query']['sort']);_0x43e1d8[_0xb0a0('0x41')]=qs['filters'](_[_0xb0a0('0x42')](_0x6cb79e[_0xb0a0('0x39')],_0x1f28cf[_0xb0a0('0x37')]),_0x1221e6);if(_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x43')]){_0x43e1d8['where']=_['merge'](_0x43e1d8[_0xb0a0('0x41')],{'$or':_[_0xb0a0('0x30')](_0x1221e6,function(_0x574f7f){if(_0x574f7f[_0xb0a0('0x44')]!=='VIRTUAL'){var _0x2e5597={};_0x2e5597[_0x574f7f[_0xb0a0('0x36')]]={'$like':'%'+_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x43')]+'%'};return _0x2e5597;}})});}_0x43e1d8=_['merge']({},_0x43e1d8,_0x6cb79e[_0xb0a0('0x45')]);var _0xa9ec3c={'where':_0x43e1d8[_0xb0a0('0x41')]};return db[_0xb0a0('0x31')][_0xb0a0('0x1e')](_0xa9ec3c)[_0xb0a0('0x2a')](function(_0x1bea18){_0x3d33d[_0xb0a0('0x1e')]=_0x1bea18;if(_0x6cb79e[_0xb0a0('0x39')][_0xb0a0('0x46')]){_0x43e1d8[_0xb0a0('0x47')]=[{'all':!![]}];}return db[_0xb0a0('0x31')][_0xb0a0('0x48')](_0x43e1d8);})[_0xb0a0('0x2a')](function(_0xd0ccc1){_0x3d33d[_0xb0a0('0x49')]=_0xd0ccc1;return _0x3d33d;})['then'](respondWithFilteredResult(_0x272075,_0x43e1d8))[_0xb0a0('0x4a')](handleError(_0x272075,null));};exports[_0xb0a0('0x4b')]=function(_0x5058bd,_0x48cd63){var _0x42cc1d={'raw':!![],'where':{'id':_0x5058bd[_0xb0a0('0x4c')]['id']}},_0x7e2624={};_0x7e2624[_0xb0a0('0x35')]=_['keys'](db[_0xb0a0('0x31')][_0xb0a0('0x32')]);_0x7e2624[_0xb0a0('0x39')]=_[_0xb0a0('0x4d')](_0x5058bd[_0xb0a0('0x39')]);_0x7e2624[_0xb0a0('0x37')]=_[_0xb0a0('0x38')](_0x7e2624[_0xb0a0('0x35')],_0x7e2624[_0xb0a0('0x39')]);_0x42cc1d[_0xb0a0('0x3a')]=_[_0xb0a0('0x38')](_0x7e2624[_0xb0a0('0x35')],qs['fields'](_0x5058bd['query'][_0xb0a0('0x3b')]));_0x42cc1d[_0xb0a0('0x3a')]=_0x42cc1d[_0xb0a0('0x3a')][_0xb0a0('0x3c')]?_0x42cc1d[_0xb0a0('0x3a')]:_0x7e2624[_0xb0a0('0x35')];if(_0x5058bd['query']['includeAll']){_0x42cc1d['include']=[{'all':!![]}];}_0x42cc1d=_['merge']({},_0x42cc1d,_0x5058bd['options']);return db[_0xb0a0('0x31')][_0xb0a0('0x4e')](_0x42cc1d)[_0xb0a0('0x2a')](handleEntityNotFound(_0x48cd63,null))[_0xb0a0('0x2a')](respondWithResult(_0x48cd63,null))['catch'](handleError(_0x48cd63,null));};exports[_0xb0a0('0x4f')]=function(_0x52cf66,_0x2923f8){return db['AnalyticMetric']['create'](_0x52cf66[_0xb0a0('0x50')],{})[_0xb0a0('0x2a')](function(_0x538e5d){var _0x556459=_0x52cf66['user'][_0xb0a0('0x28')]({'plain':!![]});if(!_0x556459)throw new Error(_0xb0a0('0x51'));if(_0x556459[_0xb0a0('0x52')]===_0xb0a0('0x53')){var _0x12e3fc=_0x538e5d['get']({'plain':!![]});var _0x25ae56=_0xb0a0('0x29');return db[_0xb0a0('0x54')][_0xb0a0('0x4e')]({'where':{'name':_0x25ae56,'userProfileId':_0x556459[_0xb0a0('0x55')]},'raw':!![]})['then'](function(_0x364d32){if(_0x364d32&&_0x364d32[_0xb0a0('0x56')]===0x0){return db['UserProfileResource'][_0xb0a0('0x4f')]({'name':_0x12e3fc[_0xb0a0('0x36')],'resourceId':_0x12e3fc['id'],'type':_0x364d32[_0xb0a0('0x36')],'sectionId':_0x364d32['id']},{})[_0xb0a0('0x2a')](function(){return _0x538e5d;});}else{return _0x538e5d;}})['catch'](function(_0x49483f){logger[_0xb0a0('0x2c')](_0xb0a0('0x57'),_0x49483f);throw _0x49483f;});}return _0x538e5d;})[_0xb0a0('0x2a')](respondWithResult(_0x2923f8,0xc9))[_0xb0a0('0x4a')](handleError(_0x2923f8,null));};exports['update']=function(_0x38f555,_0x511295){if(_0x38f555[_0xb0a0('0x50')]['id']){delete _0x38f555[_0xb0a0('0x50')]['id'];}return db[_0xb0a0('0x31')][_0xb0a0('0x4e')]({'where':{'id':_0x38f555[_0xb0a0('0x4c')]['id']}})[_0xb0a0('0x2a')](handleEntityNotFound(_0x511295,null))[_0xb0a0('0x2a')](saveUpdates(_0x38f555[_0xb0a0('0x50')],null))[_0xb0a0('0x2a')](respondWithResult(_0x511295,null))['catch'](handleError(_0x511295,null));};exports['destroy']=function(_0x46566f,_0x5d5c51){return db[_0xb0a0('0x31')][_0xb0a0('0x4e')]({'where':{'id':_0x46566f[_0xb0a0('0x4c')]['id']}})[_0xb0a0('0x2a')](handleEntityNotFound(_0x5d5c51,null))['then'](removeEntity(_0x5d5c51,null))['catch'](handleError(_0x5d5c51,null));}; \ No newline at end of file +var _0x7f98=['userProfileId','autoAssociation','html-pdf','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x483dac,_0x4b1204){var _0x104853=function(_0x458c7c){while(--_0x458c7c){_0x483dac['push'](_0x483dac['shift']());}};_0x104853(++_0x4b1204);}(_0x7f98,0x1e2));var _0x87f9=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x7f98[_0xefd519];return _0x4bb882;};'use strict';var pdf=require(_0x87f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x87f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x87f9('0x3'));var Mustache=require('mustache');var util=require(_0x87f9('0x4'));var path=require(_0x87f9('0x5'));var sox=require(_0x87f9('0x6'));var csv=require(_0x87f9('0x7'));var ejs=require(_0x87f9('0x8'));var fs=require('fs');var _=require(_0x87f9('0x9'));var squel=require(_0x87f9('0xa'));var crypto=require(_0x87f9('0xb'));var jsforce=require(_0x87f9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x87f9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x87f9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87f9('0xe'));var logger=require(_0x87f9('0xf'))(_0x87f9('0x10'));var utils=require(_0x87f9('0x11'));var config=require(_0x87f9('0x12'));var licenseUtil=require(_0x87f9('0x13'));var db=require(_0x87f9('0x14'))['db'];function respondWithStatusCode(_0x40fc49,_0x195009){_0x195009=_0x195009||0xcc;return function(_0x3c02b4){if(_0x3c02b4){return _0x40fc49['sendStatus'](_0x195009);}return _0x40fc49[_0x87f9('0x15')](_0x195009)[_0x87f9('0x16')]();};}function respondWithResult(_0x510539,_0x257d53){_0x257d53=_0x257d53||0xc8;return function(_0x1efe16){if(_0x1efe16){return _0x510539[_0x87f9('0x15')](_0x257d53)[_0x87f9('0x17')](_0x1efe16);}};}function respondWithFilteredResult(_0x145ec9,_0x4c1ec3){return function(_0x4284ad){if(_0x4284ad){var _0x41e0b5=_0x4284ad['count'],_0x3b04cb=_0x4c1ec3[_0x87f9('0x18')],_0x28fb29=_0x4c1ec3[_0x87f9('0x18')]+_0x4c1ec3[_0x87f9('0x19')],_0x36f83d;if(_0x28fb29>=_0x41e0b5){_0x28fb29=_0x41e0b5;_0x36f83d=0xc8;}else{_0x36f83d=0xce;}_0x145ec9[_0x87f9('0x15')](_0x36f83d);return _0x145ec9[_0x87f9('0x1a')](_0x87f9('0x1b'),_0x3b04cb+'-'+_0x28fb29+'/'+_0x41e0b5)[_0x87f9('0x17')](_0x4284ad);}return null;};}function patchUpdates(_0x410b56){return function(_0x25a9c8){try{jsonpatch[_0x87f9('0x1c')](_0x25a9c8,_0x410b56,!![]);}catch(_0x501fd1){return BPromise[_0x87f9('0x1d')](_0x501fd1);}return _0x25a9c8[_0x87f9('0x1e')]();};}function saveUpdates(_0x48027a,_0x26dda2){return function(_0x49d925){if(_0x49d925){return _0x49d925[_0x87f9('0x1f')](_0x48027a)[_0x87f9('0x20')](function(_0x2e4632){return _0x2e4632;});}return null;};}function removeEntity(_0x446df7,_0x468243){return function(_0x29383c){if(_0x29383c){return _0x29383c['destroy']()[_0x87f9('0x20')](function(){var _0x257361=_0x29383c[_0x87f9('0x21')]({'plain':!![]});var _0x295028=_0x87f9('0x22');return db[_0x87f9('0x23')][_0x87f9('0x24')]({'where':{'type':_0x295028,'resourceId':_0x257361['id']}})[_0x87f9('0x20')](function(){return _0x29383c;});})['then'](function(){_0x446df7['status'](0xcc)[_0x87f9('0x16')]();});}};}function handleEntityNotFound(_0x2426c7,_0x59d13){return function(_0x330b96){if(!_0x330b96){_0x2426c7[_0x87f9('0x25')](0x194);}return _0x330b96;};}function handleError(_0x37c61d,_0x33d088){_0x33d088=_0x33d088||0x1f4;return function(_0x9eef95){logger[_0x87f9('0x26')](_0x9eef95[_0x87f9('0x27')]);if(_0x9eef95[_0x87f9('0x28')]){delete _0x9eef95[_0x87f9('0x28')];}_0x37c61d[_0x87f9('0x15')](_0x33d088)[_0x87f9('0x29')](_0x9eef95);};}exports[_0x87f9('0x2a')]=function(_0xa19651,_0x3dbcbf){var _0x2fd7a5={},_0x36f624={},_0x5c62bc={'count':0x0,'rows':[]};var _0x3a4443=_[_0x87f9('0x2b')](db[_0x87f9('0x2c')][_0x87f9('0x2d')],function(_0xa598ed){return{'name':_0xa598ed[_0x87f9('0x2e')],'type':_0xa598ed[_0x87f9('0x2f')][_0x87f9('0x30')]};});_0x36f624['model']=_[_0x87f9('0x2b')](_0x3a4443,'name');_0x36f624[_0x87f9('0x31')]=_[_0x87f9('0x32')](_0xa19651[_0x87f9('0x31')]);_0x36f624[_0x87f9('0x33')]=_['intersection'](_0x36f624['model'],_0x36f624[_0x87f9('0x31')]);_0x2fd7a5[_0x87f9('0x34')]=_[_0x87f9('0x35')](_0x36f624[_0x87f9('0x36')],qs[_0x87f9('0x37')](_0xa19651['query'][_0x87f9('0x37')]));_0x2fd7a5[_0x87f9('0x34')]=_0x2fd7a5['attributes'][_0x87f9('0x38')]?_0x2fd7a5[_0x87f9('0x34')]:_0x36f624[_0x87f9('0x36')];if(!_0xa19651['query']['hasOwnProperty'](_0x87f9('0x39'))){_0x2fd7a5[_0x87f9('0x19')]=qs[_0x87f9('0x19')](_0xa19651[_0x87f9('0x31')][_0x87f9('0x19')]);_0x2fd7a5[_0x87f9('0x18')]=qs[_0x87f9('0x18')](_0xa19651[_0x87f9('0x31')][_0x87f9('0x18')]);}_0x2fd7a5['order']=qs[_0x87f9('0x3a')](_0xa19651[_0x87f9('0x31')][_0x87f9('0x3a')]);_0x2fd7a5[_0x87f9('0x3b')]=qs['filters'](_[_0x87f9('0x3c')](_0xa19651[_0x87f9('0x31')],_0x36f624['filters']),_0x3a4443);if(_0xa19651[_0x87f9('0x31')][_0x87f9('0x3d')]){_0x2fd7a5['where']=_[_0x87f9('0x3e')](_0x2fd7a5[_0x87f9('0x3b')],{'$or':_[_0x87f9('0x2b')](_0x3a4443,function(_0x3e53f2){if(_0x3e53f2[_0x87f9('0x2f')]!==_0x87f9('0x3f')){var _0x42016e={};_0x42016e[_0x3e53f2[_0x87f9('0x28')]]={'$like':'%'+_0xa19651[_0x87f9('0x31')][_0x87f9('0x3d')]+'%'};return _0x42016e;}})});}_0x2fd7a5=_[_0x87f9('0x3e')]({},_0x2fd7a5,_0xa19651[_0x87f9('0x40')]);var _0x5a818f={'where':_0x2fd7a5[_0x87f9('0x3b')]};return db[_0x87f9('0x2c')][_0x87f9('0x41')](_0x5a818f)[_0x87f9('0x20')](function(_0x533979){_0x5c62bc['count']=_0x533979;if(_0xa19651[_0x87f9('0x31')]['includeAll']){_0x2fd7a5[_0x87f9('0x42')]=[{'all':!![]}];}return db[_0x87f9('0x2c')][_0x87f9('0x43')](_0x2fd7a5);})['then'](function(_0x559399){_0x5c62bc[_0x87f9('0x44')]=_0x559399;return _0x5c62bc;})[_0x87f9('0x20')](respondWithFilteredResult(_0x3dbcbf,_0x2fd7a5))['catch'](handleError(_0x3dbcbf,null));};exports[_0x87f9('0x45')]=function(_0x2f977b,_0x6ec5c7){var _0x352141={'raw':!![],'where':{'id':_0x2f977b[_0x87f9('0x46')]['id']}},_0x4e4bbf={};_0x4e4bbf[_0x87f9('0x36')]=_[_0x87f9('0x32')](db[_0x87f9('0x2c')][_0x87f9('0x2d')]);_0x4e4bbf[_0x87f9('0x31')]=_[_0x87f9('0x32')](_0x2f977b[_0x87f9('0x31')]);_0x4e4bbf['filters']=_[_0x87f9('0x35')](_0x4e4bbf[_0x87f9('0x36')],_0x4e4bbf[_0x87f9('0x31')]);_0x352141['attributes']=_['intersection'](_0x4e4bbf[_0x87f9('0x36')],qs[_0x87f9('0x37')](_0x2f977b[_0x87f9('0x31')][_0x87f9('0x37')]));_0x352141[_0x87f9('0x34')]=_0x352141[_0x87f9('0x34')][_0x87f9('0x38')]?_0x352141['attributes']:_0x4e4bbf['model'];if(_0x2f977b[_0x87f9('0x31')][_0x87f9('0x47')]){_0x352141['include']=[{'all':!![]}];}_0x352141=_[_0x87f9('0x3e')]({},_0x352141,_0x2f977b[_0x87f9('0x40')]);return db[_0x87f9('0x2c')][_0x87f9('0x48')](_0x352141)[_0x87f9('0x20')](handleEntityNotFound(_0x6ec5c7,null))['then'](respondWithResult(_0x6ec5c7,null))[_0x87f9('0x49')](handleError(_0x6ec5c7,null));};exports['create']=function(_0x2d898c,_0x7682bb){return db['AnalyticMetric'][_0x87f9('0x4a')](_0x2d898c[_0x87f9('0x4b')],{})[_0x87f9('0x20')](function(_0xde6f33){var _0x1f1c5d=_0x2d898c['user'][_0x87f9('0x21')]({'plain':!![]});if(!_0x1f1c5d)throw new Error(_0x87f9('0x4c'));if(_0x1f1c5d['role']===_0x87f9('0x4d')){var _0x4ab8f6=_0xde6f33[_0x87f9('0x21')]({'plain':!![]});var _0x12eec9=_0x87f9('0x22');return db['UserProfileSection'][_0x87f9('0x48')]({'where':{'name':_0x12eec9,'userProfileId':_0x1f1c5d[_0x87f9('0x4e')]},'raw':!![]})[_0x87f9('0x20')](function(_0x5ea237){if(_0x5ea237&&_0x5ea237[_0x87f9('0x4f')]===0x0){return db[_0x87f9('0x23')]['create']({'name':_0x4ab8f6['name'],'resourceId':_0x4ab8f6['id'],'type':_0x5ea237['name'],'sectionId':_0x5ea237['id']},{})['then'](function(){return _0xde6f33;});}else{return _0xde6f33;}})[_0x87f9('0x49')](function(_0x217c33){logger[_0x87f9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x217c33);throw _0x217c33;});}return _0xde6f33;})[_0x87f9('0x20')](respondWithResult(_0x7682bb,0xc9))[_0x87f9('0x49')](handleError(_0x7682bb,null));};exports[_0x87f9('0x1f')]=function(_0x13c05f,_0x5be19c){if(_0x13c05f[_0x87f9('0x4b')]['id']){delete _0x13c05f[_0x87f9('0x4b')]['id'];}return db[_0x87f9('0x2c')][_0x87f9('0x48')]({'where':{'id':_0x13c05f[_0x87f9('0x46')]['id']}})[_0x87f9('0x20')](handleEntityNotFound(_0x5be19c,null))[_0x87f9('0x20')](saveUpdates(_0x13c05f[_0x87f9('0x4b')],null))[_0x87f9('0x20')](respondWithResult(_0x5be19c,null))[_0x87f9('0x49')](handleError(_0x5be19c,null));};exports[_0x87f9('0x24')]=function(_0xf1a8f7,_0x29eb19){return db[_0x87f9('0x2c')][_0x87f9('0x48')]({'where':{'id':_0xf1a8f7[_0x87f9('0x46')]['id']}})[_0x87f9('0x20')](handleEntityNotFound(_0x29eb19,null))[_0x87f9('0x20')](removeEntity(_0x29eb19,null))[_0x87f9('0x49')](handleError(_0x29eb19,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6893e7e..0f4188f 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 _0x65f2=['rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','api','moment','path'];(function(_0x55d88c,_0x3be057){var _0x3a0ede=function(_0x1a604a){while(--_0x1a604a){_0x55d88c['push'](_0x55d88c['shift']());}};_0x3a0ede(++_0x3be057);}(_0x65f2,0xcb));var _0x265f=function(_0x2be6ba,_0x6f028c){_0x2be6ba=_0x2be6ba-0x0;var _0x3abffe=_0x65f2[_0x2be6ba];return _0x3abffe;};'use strict';var _=require(_0x265f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x265f('0x1'));var moment=require(_0x265f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x265f('0x3'));var rimraf=require(_0x265f('0x4'));var config=require('../../config/environment');var attributes=require(_0x265f('0x5'));module['exports']=function(_0x3801bd,_0x871ef8){return _0x3801bd[_0x265f('0x6')](_0x265f('0x7'),attributes,{'tableName':_0x265f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4365=['request-promise','path','rimraf','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2223be,_0x4e4034){var _0x453496=function(_0x18f9ee){while(--_0x18f9ee){_0x2223be['push'](_0x2223be['shift']());}};_0x453496(++_0x4e4034);}(_0x4365,0xcb));var _0x5436=function(_0x547890,_0x593741){_0x547890=_0x547890-0x0;var _0x2c8daa=_0x4365[_0x547890];return _0x2c8daa;};'use strict';var _=require(_0x5436('0x0'));var util=require(_0x5436('0x1'));var logger=require(_0x5436('0x2'))(_0x5436('0x3'));var moment=require(_0x5436('0x4'));var BPromise=require(_0x5436('0x5'));var rp=require(_0x5436('0x6'));var fs=require('fs');var path=require(_0x5436('0x7'));var rimraf=require(_0x5436('0x8'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x93760c,_0x3c7392){return _0x93760c[_0x5436('0x9')](_0x5436('0xa'),attributes,{'tableName':'analytics_metrics','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 de0df55..0dc2501 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 _0x3d3b=['message','AnalyticMetric,\x20%s,\x20%s','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x893353,_0x2b1285){var _0x21b907=function(_0x325230){while(--_0x325230){_0x893353['push'](_0x893353['shift']());}};_0x21b907(++_0x2b1285);}(_0x3d3b,0x191));var _0xb3d3=function(_0x2d0f1d,_0x34ea6f){_0x2d0f1d=_0x2d0f1d-0x0;var _0x42866f=_0x3d3b[_0x2d0f1d];return _0x42866f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb3d3('0x0'));var BPromise=require('bluebird');var rs=require(_0xb3d3('0x1'));var fs=require('fs');var Redis=require(_0xb3d3('0x2'));var db=require(_0xb3d3('0x3'))['db'];var utils=require(_0xb3d3('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb3d3('0x5'));var client=jayson[_0xb3d3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40ac2f,_0x26b1fe,_0x22c76f){return new BPromise(function(_0xe86520,_0x385163){return client[_0xb3d3('0x7')](_0x40ac2f,_0x22c76f)[_0xb3d3('0x8')](function(_0x45ee44){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x26b1fe,'request\x20sent');logger[_0xb3d3('0x9')](_0xb3d3('0xa'),_0x26b1fe,'request\x20sent',JSON[_0xb3d3('0xb')](_0x45ee44));if(_0x45ee44[_0xb3d3('0xc')]){if(_0x45ee44['error']['code']===0x1f4){logger[_0xb3d3('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x26b1fe,_0x45ee44[_0xb3d3('0xc')][_0xb3d3('0xd')]);return _0x385163(_0x45ee44[_0xb3d3('0xc')]['message']);}logger[_0xb3d3('0xc')](_0xb3d3('0xe'),_0x26b1fe,_0x45ee44[_0xb3d3('0xc')][_0xb3d3('0xd')]);return _0xe86520(_0x45ee44[_0xb3d3('0xc')]['message']);}else{logger[_0xb3d3('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x26b1fe,'request\x20sent');_0xe86520(_0x45ee44[_0xb3d3('0x10')][_0xb3d3('0xd')]);}})[_0xb3d3('0x11')](function(_0x25d703){logger[_0xb3d3('0xc')](_0xb3d3('0xe'),_0x26b1fe,_0x25d703);_0x385163(_0x25d703);});});} \ No newline at end of file +var _0x4702=['catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result'];(function(_0x4b0d61,_0x333afc){var _0x60e13a=function(_0x36ece2){while(--_0x36ece2){_0x4b0d61['push'](_0x4b0d61['shift']());}};_0x60e13a(++_0x333afc);}(_0x4702,0xd2));var _0x2470=function(_0x423cdc,_0x21ee81){_0x423cdc=_0x423cdc-0x0;var _0x52214e=_0x4702[_0x423cdc];return _0x52214e;};'use strict';var _=require(_0x2470('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2470('0x1'));var rs=require(_0x2470('0x2'));var fs=require('fs');var Redis=require(_0x2470('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2470('0x4'));var logger=require('../../config/logger')(_0x2470('0x5'));var config=require(_0x2470('0x6'));var jayson=require(_0x2470('0x7'));var client=jayson[_0x2470('0x8')][_0x2470('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c82be,_0x288d47,_0x2f41dc){return new BPromise(function(_0x37ffcb,_0x389f75){return client[_0x2470('0xa')](_0x4c82be,_0x2f41dc)['then'](function(_0x4bc3c8){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x288d47,'request\x20sent');logger['debug'](_0x2470('0xb'),_0x288d47,'request\x20sent',JSON[_0x2470('0xc')](_0x4bc3c8));if(_0x4bc3c8[_0x2470('0xd')]){if(_0x4bc3c8[_0x2470('0xd')][_0x2470('0xe')]===0x1f4){logger[_0x2470('0xd')](_0x2470('0xf'),_0x288d47,_0x4bc3c8[_0x2470('0xd')]['message']);return _0x389f75(_0x4bc3c8[_0x2470('0xd')][_0x2470('0x10')]);}logger[_0x2470('0xd')](_0x2470('0xf'),_0x288d47,_0x4bc3c8[_0x2470('0xd')][_0x2470('0x10')]);return _0x37ffcb(_0x4bc3c8[_0x2470('0xd')][_0x2470('0x10')]);}else{logger['info'](_0x2470('0xf'),_0x288d47,'request\x20sent');_0x37ffcb(_0x4bc3c8[_0x2470('0x11')][_0x2470('0x10')]);}})[_0x2470('0x12')](function(_0x55d8af){logger[_0x2470('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x288d47,_0x55d8af);_0x389f75(_0x55d8af);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2e63c01..d95232a 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x3a924a,_0x5b8ed3){var _0x144b03=function(_0x4b7375){while(--_0x4b7375){_0x3a924a['push'](_0x3a924a['shift']());}};_0x144b03(++_0x5b8ed3);}(_0x524e,0x15e));var _0xe524=function(_0x1c9d4d,_0x22cb6b){_0x1c9d4d=_0x1c9d4d-0x0;var _0x1dc5ff=_0x524e[_0x1c9d4d];return _0x1dc5ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x161c3b,_0x386315){var _0x20e7ba=function(_0x51eb67){while(--_0x51eb67){_0x161c3b['push'](_0x161c3b['shift']());}};_0x20e7ba(++_0x386315);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5a6bff1..ffdfa9f 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 _0x67ed=['sequelize','exports','TEXT'];(function(_0x5024c7,_0xd560bd){var _0xf2f316=function(_0x4d7748){while(--_0x4d7748){_0x5024c7['push'](_0x5024c7['shift']());}};_0xf2f316(++_0xd560bd);}(_0x67ed,0x1f2));var _0xd67e=function(_0x46a539,_0x5c9cbb){_0x46a539=_0x46a539-0x0;var _0x45ed52=_0x67ed[_0x46a539];return _0x45ed52;};'use strict';var Sequelize=require(_0xd67e('0x0'));module[_0xd67e('0x1')]={'tree':{'type':Sequelize[_0xd67e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x288b=['TEXT','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x288b,0x69));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb288('0x0')]={'tree':{'type':Sequelize[_0xb288('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index bbbb176..4bc00ae 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 _0xd2a6=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','apply','save','then','destroy','stack','name','index','AnalyticTreeReport','rawAttributes'];(function(_0x7ac6d3,_0x5511bd){var _0xa1e3df=function(_0x308660){while(--_0x308660){_0x7ac6d3['push'](_0x7ac6d3['shift']());}};_0xa1e3df(++_0x5511bd);}(_0xd2a6,0x65));var _0x6d2a=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0xd2a6[_0xfb65aa];return _0x2aee31;};'use strict';var pdf=require(_0x6d2a('0x0'));var emlformat=require(_0x6d2a('0x1'));var rimraf=require(_0x6d2a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d2a('0x3'));var rp=require(_0x6d2a('0x4'));var moment=require(_0x6d2a('0x5'));var BPromise=require(_0x6d2a('0x6'));var Mustache=require('mustache');var util=require(_0x6d2a('0x7'));var path=require(_0x6d2a('0x8'));var sox=require(_0x6d2a('0x9'));var csv=require('to-csv');var ejs=require(_0x6d2a('0xa'));var fs=require('fs');var _=require(_0x6d2a('0xb'));var squel=require(_0x6d2a('0xc'));var crypto=require(_0x6d2a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6d2a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6d2a('0xf'));var Papa=require(_0x6d2a('0x10'));var Redis=require('ioredis');var authService=require(_0x6d2a('0x11'));var qs=require(_0x6d2a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d2a('0x13'));var logger=require(_0x6d2a('0x14'))(_0x6d2a('0x15'));var utils=require(_0x6d2a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d2a('0x17'))['db'];function respondWithStatusCode(_0x41408f,_0x214eb6){_0x214eb6=_0x214eb6||0xcc;return function(_0x154579){if(_0x154579){return _0x41408f[_0x6d2a('0x18')](_0x214eb6);}return _0x41408f['status'](_0x214eb6)[_0x6d2a('0x19')]();};}function respondWithResult(_0x1360be,_0xaea6f0){_0xaea6f0=_0xaea6f0||0xc8;return function(_0xf78d7f){if(_0xf78d7f){return _0x1360be[_0x6d2a('0x1a')](_0xaea6f0)['json'](_0xf78d7f);}};}function respondWithFilteredResult(_0x33783a,_0x5b7cd4){return function(_0x4cddab){if(_0x4cddab){var _0x57bf91=_0x4cddab[_0x6d2a('0x1b')],_0x362755=_0x5b7cd4[_0x6d2a('0x1c')],_0x2a46b7=_0x5b7cd4[_0x6d2a('0x1c')]+_0x5b7cd4['limit'],_0x2ebb6f;if(_0x2a46b7>=_0x57bf91){_0x2a46b7=_0x57bf91;_0x2ebb6f=0xc8;}else{_0x2ebb6f=0xce;}_0x33783a[_0x6d2a('0x1a')](_0x2ebb6f);return _0x33783a['set'](_0x6d2a('0x1d'),_0x362755+'-'+_0x2a46b7+'/'+_0x57bf91)['json'](_0x4cddab);}return null;};}function patchUpdates(_0x4b793c){return function(_0x475e6b){try{jsonpatch[_0x6d2a('0x1e')](_0x475e6b,_0x4b793c,!![]);}catch(_0x5c4834){return BPromise['reject'](_0x5c4834);}return _0x475e6b[_0x6d2a('0x1f')]();};}function saveUpdates(_0x1e32ac,_0x20e6ff){return function(_0xcbabe9){if(_0xcbabe9){return _0xcbabe9['update'](_0x1e32ac)[_0x6d2a('0x20')](function(_0x2dbc38){return _0x2dbc38;});}return null;};}function removeEntity(_0x3eb492,_0x2343c3){return function(_0x142518){if(_0x142518){return _0x142518[_0x6d2a('0x21')]()[_0x6d2a('0x20')](function(){_0x3eb492['status'](0xcc)[_0x6d2a('0x19')]();});}};}function handleEntityNotFound(_0x3a421a,_0x5e6ca3){return function(_0x39cf6e){if(!_0x39cf6e){_0x3a421a[_0x6d2a('0x18')](0x194);}return _0x39cf6e;};}function handleError(_0x366cdb,_0x54f004){_0x54f004=_0x54f004||0x1f4;return function(_0x4410cd){logger['error'](_0x4410cd[_0x6d2a('0x22')]);if(_0x4410cd[_0x6d2a('0x23')]){delete _0x4410cd[_0x6d2a('0x23')];}_0x366cdb['status'](_0x54f004)['send'](_0x4410cd);};}exports[_0x6d2a('0x24')]=function(_0x1d867a,_0x9cdaca){var _0x17b88f={},_0x1e58bb={},_0x2ca6b2={'count':0x0,'rows':[]};var _0xf54f3b=_['map'](db[_0x6d2a('0x25')][_0x6d2a('0x26')],function(_0x33a4bb){return{'name':_0x33a4bb[_0x6d2a('0x27')],'type':_0x33a4bb[_0x6d2a('0x28')]['key']};});_0x1e58bb[_0x6d2a('0x29')]=_[_0x6d2a('0x2a')](_0xf54f3b,_0x6d2a('0x23'));_0x1e58bb[_0x6d2a('0x2b')]=_[_0x6d2a('0x2c')](_0x1d867a[_0x6d2a('0x2b')]);_0x1e58bb[_0x6d2a('0x2d')]=_[_0x6d2a('0x2e')](_0x1e58bb[_0x6d2a('0x29')],_0x1e58bb['query']);_0x17b88f[_0x6d2a('0x2f')]=_[_0x6d2a('0x2e')](_0x1e58bb[_0x6d2a('0x29')],qs[_0x6d2a('0x30')](_0x1d867a['query'][_0x6d2a('0x30')]));_0x17b88f['attributes']=_0x17b88f[_0x6d2a('0x2f')][_0x6d2a('0x31')]?_0x17b88f[_0x6d2a('0x2f')]:_0x1e58bb['model'];if(!_0x1d867a['query'][_0x6d2a('0x32')](_0x6d2a('0x33'))){_0x17b88f[_0x6d2a('0x34')]=qs['limit'](_0x1d867a['query'][_0x6d2a('0x34')]);_0x17b88f[_0x6d2a('0x1c')]=qs[_0x6d2a('0x1c')](_0x1d867a['query'][_0x6d2a('0x1c')]);}_0x17b88f[_0x6d2a('0x35')]=qs[_0x6d2a('0x36')](_0x1d867a['query'][_0x6d2a('0x36')]);_0x17b88f[_0x6d2a('0x37')]=qs[_0x6d2a('0x2d')](_['pick'](_0x1d867a['query'],_0x1e58bb[_0x6d2a('0x2d')]),_0xf54f3b);if(_0x1d867a[_0x6d2a('0x2b')]['filter']){_0x17b88f[_0x6d2a('0x37')]=_[_0x6d2a('0x38')](_0x17b88f[_0x6d2a('0x37')],{'$or':_['map'](_0xf54f3b,function(_0x5a2c7e){if(_0x5a2c7e['type']!==_0x6d2a('0x39')){var _0x4750a6={};_0x4750a6[_0x5a2c7e[_0x6d2a('0x23')]]={'$like':'%'+_0x1d867a[_0x6d2a('0x2b')][_0x6d2a('0x3a')]+'%'};return _0x4750a6;}})});}_0x17b88f=_[_0x6d2a('0x38')]({},_0x17b88f,_0x1d867a[_0x6d2a('0x3b')]);var _0x4a6eb3={'where':_0x17b88f['where']};return db['AnalyticTreeReport'][_0x6d2a('0x1b')](_0x4a6eb3)[_0x6d2a('0x20')](function(_0x2c5f65){_0x2ca6b2[_0x6d2a('0x1b')]=_0x2c5f65;if(_0x1d867a['query'][_0x6d2a('0x3c')]){_0x17b88f[_0x6d2a('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x17b88f);})['then'](function(_0x58fd30){_0x2ca6b2[_0x6d2a('0x3e')]=_0x58fd30;return _0x2ca6b2;})[_0x6d2a('0x20')](respondWithFilteredResult(_0x9cdaca,_0x17b88f))[_0x6d2a('0x3f')](handleError(_0x9cdaca,null));};exports[_0x6d2a('0x40')]=function(_0xcff8c2,_0x34a137){var _0x58e153={'raw':!![],'where':{'id':_0xcff8c2['params']['id']}},_0x1f2a32={};_0x1f2a32['model']=_[_0x6d2a('0x2c')](db['AnalyticTreeReport']['rawAttributes']);_0x1f2a32['query']=_[_0x6d2a('0x2c')](_0xcff8c2[_0x6d2a('0x2b')]);_0x1f2a32[_0x6d2a('0x2d')]=_[_0x6d2a('0x2e')](_0x1f2a32['model'],_0x1f2a32[_0x6d2a('0x2b')]);_0x58e153[_0x6d2a('0x2f')]=_[_0x6d2a('0x2e')](_0x1f2a32[_0x6d2a('0x29')],qs[_0x6d2a('0x30')](_0xcff8c2[_0x6d2a('0x2b')][_0x6d2a('0x30')]));_0x58e153[_0x6d2a('0x2f')]=_0x58e153[_0x6d2a('0x2f')][_0x6d2a('0x31')]?_0x58e153['attributes']:_0x1f2a32[_0x6d2a('0x29')];if(_0xcff8c2[_0x6d2a('0x2b')]['includeAll']){_0x58e153[_0x6d2a('0x3d')]=[{'all':!![]}];}_0x58e153=_['merge']({},_0x58e153,_0xcff8c2['options']);return db[_0x6d2a('0x25')][_0x6d2a('0x41')](_0x58e153)['then'](handleEntityNotFound(_0x34a137,null))[_0x6d2a('0x20')](respondWithResult(_0x34a137,null))['catch'](handleError(_0x34a137,null));};exports[_0x6d2a('0x42')]=function(_0x27ea78,_0x1974fe){return db[_0x6d2a('0x25')]['create'](_0x27ea78[_0x6d2a('0x43')],{})[_0x6d2a('0x20')](respondWithResult(_0x1974fe,0xc9))[_0x6d2a('0x3f')](handleError(_0x1974fe,null));};exports[_0x6d2a('0x44')]=function(_0x3f1048,_0x3a89de){if(_0x3f1048[_0x6d2a('0x43')]['id']){delete _0x3f1048[_0x6d2a('0x43')]['id'];}return db[_0x6d2a('0x25')][_0x6d2a('0x41')]({'where':{'id':_0x3f1048[_0x6d2a('0x45')]['id']}})[_0x6d2a('0x20')](handleEntityNotFound(_0x3a89de,null))[_0x6d2a('0x20')](saveUpdates(_0x3f1048[_0x6d2a('0x43')],null))['then'](respondWithResult(_0x3a89de,null))[_0x6d2a('0x3f')](handleError(_0x3a89de,null));};exports[_0x6d2a('0x21')]=function(_0x8e1246,_0x17ad9a){return db['AnalyticTreeReport'][_0x6d2a('0x41')]({'where':{'id':_0x8e1246[_0x6d2a('0x45')]['id']}})[_0x6d2a('0x20')](handleEntityNotFound(_0x17ad9a,null))[_0x6d2a('0x20')](removeEntity(_0x17ad9a,null))[_0x6d2a('0x3f')](handleError(_0x17ad9a,null));}; \ No newline at end of file +var _0x9ede=['reject','save','update','destroy','then','end','sendStatus','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3de692,_0x50a311){var _0x264ed7=function(_0x38d830){while(--_0x38d830){_0x3de692['push'](_0x3de692['shift']());}};_0x264ed7(++_0x50a311);}(_0x9ede,0xc1));var _0xe9ed=function(_0x49005d,_0x360c93){_0x49005d=_0x49005d-0x0;var _0xe0fa31=_0x9ede[_0x49005d];return _0xe0fa31;};'use strict';var pdf=require(_0xe9ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe9ed('0x2'));var moment=require(_0xe9ed('0x3'));var BPromise=require(_0xe9ed('0x4'));var Mustache=require(_0xe9ed('0x5'));var util=require(_0xe9ed('0x6'));var path=require(_0xe9ed('0x7'));var sox=require(_0xe9ed('0x8'));var csv=require(_0xe9ed('0x9'));var ejs=require(_0xe9ed('0xa'));var fs=require('fs');var _=require(_0xe9ed('0xb'));var squel=require(_0xe9ed('0xc'));var crypto=require(_0xe9ed('0xd'));var jsforce=require(_0xe9ed('0xe'));var deskjs=require(_0xe9ed('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe9ed('0x10'));var Papa=require(_0xe9ed('0x11'));var Redis=require(_0xe9ed('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9ed('0x13'));var hardwareService=require(_0xe9ed('0x14'));var logger=require(_0xe9ed('0x15'))(_0xe9ed('0x16'));var utils=require(_0xe9ed('0x17'));var config=require(_0xe9ed('0x18'));var licenseUtil=require(_0xe9ed('0x19'));var db=require(_0xe9ed('0x1a'))['db'];function respondWithStatusCode(_0x223104,_0x13ac81){_0x13ac81=_0x13ac81||0xcc;return function(_0x4422a1){if(_0x4422a1){return _0x223104['sendStatus'](_0x13ac81);}return _0x223104[_0xe9ed('0x1b')](_0x13ac81)['end']();};}function respondWithResult(_0x15eb24,_0x114d17){_0x114d17=_0x114d17||0xc8;return function(_0x525a3c){if(_0x525a3c){return _0x15eb24[_0xe9ed('0x1b')](_0x114d17)[_0xe9ed('0x1c')](_0x525a3c);}};}function respondWithFilteredResult(_0x3495c2,_0x317cd2){return function(_0x4fadfb){if(_0x4fadfb){var _0x2dd85f=_0x4fadfb[_0xe9ed('0x1d')],_0x43e9a1=_0x317cd2[_0xe9ed('0x1e')],_0x1951f8=_0x317cd2['offset']+_0x317cd2[_0xe9ed('0x1f')],_0x581e1c;if(_0x1951f8>=_0x2dd85f){_0x1951f8=_0x2dd85f;_0x581e1c=0xc8;}else{_0x581e1c=0xce;}_0x3495c2[_0xe9ed('0x1b')](_0x581e1c);return _0x3495c2[_0xe9ed('0x20')](_0xe9ed('0x21'),_0x43e9a1+'-'+_0x1951f8+'/'+_0x2dd85f)[_0xe9ed('0x1c')](_0x4fadfb);}return null;};}function patchUpdates(_0x578996){return function(_0xcd1d33){try{jsonpatch[_0xe9ed('0x22')](_0xcd1d33,_0x578996,!![]);}catch(_0x193bb7){return BPromise[_0xe9ed('0x23')](_0x193bb7);}return _0xcd1d33[_0xe9ed('0x24')]();};}function saveUpdates(_0x540910,_0x4fa94d){return function(_0x2d4908){if(_0x2d4908){return _0x2d4908[_0xe9ed('0x25')](_0x540910)['then'](function(_0x75bb69){return _0x75bb69;});}return null;};}function removeEntity(_0x464f8a,_0x3e8673){return function(_0x2bc019){if(_0x2bc019){return _0x2bc019[_0xe9ed('0x26')]()[_0xe9ed('0x27')](function(){_0x464f8a[_0xe9ed('0x1b')](0xcc)[_0xe9ed('0x28')]();});}};}function handleEntityNotFound(_0x586030,_0x1d112a){return function(_0x205d55){if(!_0x205d55){_0x586030[_0xe9ed('0x29')](0x194);}return _0x205d55;};}function handleError(_0x37cb61,_0x182c74){_0x182c74=_0x182c74||0x1f4;return function(_0xb6c619){logger['error'](_0xb6c619['stack']);if(_0xb6c619['name']){delete _0xb6c619[_0xe9ed('0x2a')];}_0x37cb61[_0xe9ed('0x1b')](_0x182c74)[_0xe9ed('0x2b')](_0xb6c619);};}exports[_0xe9ed('0x2c')]=function(_0x5745e9,_0x341598){var _0x5e1c9b={},_0xc47109={},_0x2e0684={'count':0x0,'rows':[]};var _0xb118d2=_[_0xe9ed('0x2d')](db[_0xe9ed('0x2e')][_0xe9ed('0x2f')],function(_0x5d25a7){return{'name':_0x5d25a7[_0xe9ed('0x30')],'type':_0x5d25a7['type'][_0xe9ed('0x31')]};});_0xc47109[_0xe9ed('0x32')]=_[_0xe9ed('0x2d')](_0xb118d2,_0xe9ed('0x2a'));_0xc47109[_0xe9ed('0x33')]=_[_0xe9ed('0x34')](_0x5745e9['query']);_0xc47109[_0xe9ed('0x35')]=_['intersection'](_0xc47109[_0xe9ed('0x32')],_0xc47109[_0xe9ed('0x33')]);_0x5e1c9b['attributes']=_[_0xe9ed('0x36')](_0xc47109[_0xe9ed('0x32')],qs[_0xe9ed('0x37')](_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x37')]));_0x5e1c9b['attributes']=_0x5e1c9b['attributes']['length']?_0x5e1c9b[_0xe9ed('0x38')]:_0xc47109['model'];if(!_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x39')](_0xe9ed('0x3a'))){_0x5e1c9b[_0xe9ed('0x1f')]=qs['limit'](_0x5745e9['query'][_0xe9ed('0x1f')]);_0x5e1c9b['offset']=qs[_0xe9ed('0x1e')](_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x1e')]);}_0x5e1c9b[_0xe9ed('0x3b')]=qs[_0xe9ed('0x3c')](_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x3c')]);_0x5e1c9b[_0xe9ed('0x3d')]=qs[_0xe9ed('0x35')](_[_0xe9ed('0x3e')](_0x5745e9['query'],_0xc47109[_0xe9ed('0x35')]),_0xb118d2);if(_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x3f')]){_0x5e1c9b['where']=_['merge'](_0x5e1c9b[_0xe9ed('0x3d')],{'$or':_['map'](_0xb118d2,function(_0x5213dc){if(_0x5213dc['type']!==_0xe9ed('0x40')){var _0x346814={};_0x346814[_0x5213dc['name']]={'$like':'%'+_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x3f')]+'%'};return _0x346814;}})});}_0x5e1c9b=_[_0xe9ed('0x41')]({},_0x5e1c9b,_0x5745e9[_0xe9ed('0x42')]);var _0x1f0103={'where':_0x5e1c9b[_0xe9ed('0x3d')]};return db[_0xe9ed('0x2e')][_0xe9ed('0x1d')](_0x1f0103)[_0xe9ed('0x27')](function(_0x1bfa2e){_0x2e0684[_0xe9ed('0x1d')]=_0x1bfa2e;if(_0x5745e9[_0xe9ed('0x33')][_0xe9ed('0x43')]){_0x5e1c9b[_0xe9ed('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xe9ed('0x45')](_0x5e1c9b);})[_0xe9ed('0x27')](function(_0x1e1cc0){_0x2e0684['rows']=_0x1e1cc0;return _0x2e0684;})[_0xe9ed('0x27')](respondWithFilteredResult(_0x341598,_0x5e1c9b))[_0xe9ed('0x46')](handleError(_0x341598,null));};exports[_0xe9ed('0x47')]=function(_0x1a9780,_0x137efe){var _0x33eb1e={'raw':!![],'where':{'id':_0x1a9780['params']['id']}},_0x122e9f={};_0x122e9f['model']=_[_0xe9ed('0x34')](db[_0xe9ed('0x2e')]['rawAttributes']);_0x122e9f[_0xe9ed('0x33')]=_[_0xe9ed('0x34')](_0x1a9780[_0xe9ed('0x33')]);_0x122e9f[_0xe9ed('0x35')]=_[_0xe9ed('0x36')](_0x122e9f[_0xe9ed('0x32')],_0x122e9f[_0xe9ed('0x33')]);_0x33eb1e[_0xe9ed('0x38')]=_['intersection'](_0x122e9f[_0xe9ed('0x32')],qs[_0xe9ed('0x37')](_0x1a9780[_0xe9ed('0x33')][_0xe9ed('0x37')]));_0x33eb1e['attributes']=_0x33eb1e[_0xe9ed('0x38')]['length']?_0x33eb1e[_0xe9ed('0x38')]:_0x122e9f[_0xe9ed('0x32')];if(_0x1a9780[_0xe9ed('0x33')][_0xe9ed('0x43')]){_0x33eb1e['include']=[{'all':!![]}];}_0x33eb1e=_[_0xe9ed('0x41')]({},_0x33eb1e,_0x1a9780[_0xe9ed('0x42')]);return db['AnalyticTreeReport'][_0xe9ed('0x48')](_0x33eb1e)[_0xe9ed('0x27')](handleEntityNotFound(_0x137efe,null))[_0xe9ed('0x27')](respondWithResult(_0x137efe,null))[_0xe9ed('0x46')](handleError(_0x137efe,null));};exports[_0xe9ed('0x49')]=function(_0x5db9fc,_0x590aa1){return db['AnalyticTreeReport'][_0xe9ed('0x49')](_0x5db9fc[_0xe9ed('0x4a')],{})[_0xe9ed('0x27')](respondWithResult(_0x590aa1,0xc9))[_0xe9ed('0x46')](handleError(_0x590aa1,null));};exports[_0xe9ed('0x25')]=function(_0x1a5574,_0x3319b9){if(_0x1a5574['body']['id']){delete _0x1a5574[_0xe9ed('0x4a')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x1a5574[_0xe9ed('0x4b')]['id']}})[_0xe9ed('0x27')](handleEntityNotFound(_0x3319b9,null))[_0xe9ed('0x27')](saveUpdates(_0x1a5574[_0xe9ed('0x4a')],null))['then'](respondWithResult(_0x3319b9,null))[_0xe9ed('0x46')](handleError(_0x3319b9,null));};exports['destroy']=function(_0x284f09,_0x3211c2){return db[_0xe9ed('0x2e')][_0xe9ed('0x48')]({'where':{'id':_0x284f09[_0xe9ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3211c2,null))[_0xe9ed('0x27')](removeEntity(_0x3211c2,null))[_0xe9ed('0x46')](handleError(_0x3211c2,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 018a240..abed412 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 _0xd959=['./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3a96ab,_0x3ca980){var _0x5b3a5b=function(_0x201c90){while(--_0x201c90){_0x3a96ab['push'](_0x3a96ab['shift']());}};_0x5b3a5b(++_0x3ca980);}(_0xd959,0x94));var _0x9d95=function(_0x1c1905,_0x2bc420){_0x1c1905=_0x1c1905-0x0;var _0x4ea72e=_0xd959[_0x1c1905];return _0x4ea72e;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var logger=require(_0x9d95('0x2'))('api');var moment=require(_0x9d95('0x3'));var BPromise=require(_0x9d95('0x4'));var rp=require(_0x9d95('0x5'));var fs=require('fs');var path=require(_0x9d95('0x6'));var rimraf=require(_0x9d95('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d95('0x8'));module[_0x9d95('0x9')]=function(_0x33d82f,_0x7b40b1){return _0x33d82f['define'](_0x9d95('0xa'),attributes,{'tableName':_0x9d95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad9f=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xad9f,0x1be));var _0xfad9=function(_0x40890b,_0x2b8f33){_0x40890b=_0x40890b-0x0;var _0x522e7b=_0xad9f[_0x40890b];return _0x522e7b;};'use strict';var _=require(_0xfad9('0x0'));var util=require(_0xfad9('0x1'));var logger=require(_0xfad9('0x2'))('api');var moment=require(_0xfad9('0x3'));var BPromise=require(_0xfad9('0x4'));var rp=require(_0xfad9('0x5'));var fs=require('fs');var path=require(_0xfad9('0x6'));var rimraf=require('rimraf');var config=require(_0xfad9('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xfad9('0x8')]=function(_0x24d3fb,_0x19230a){return _0x24d3fb[_0xfad9('0x9')](_0xfad9('0xa'),attributes,{'tableName':_0xfad9('0xb'),'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 be4106b..d9b12ea 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 _0xbdf2=['error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d5e5b,_0x126b1b){var _0x2373be=function(_0x3af3c3){while(--_0x3af3c3){_0x3d5e5b['push'](_0x3d5e5b['shift']());}};_0x2373be(++_0x126b1b);}(_0xbdf2,0x195));var _0x2bdf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbdf2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2bdf('0x0'));var util=require(_0x2bdf('0x1'));var moment=require('moment');var BPromise=require(_0x2bdf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bdf('0x3'));var db=require(_0x2bdf('0x4'))['db'];var utils=require(_0x2bdf('0x5'));var logger=require(_0x2bdf('0x6'))(_0x2bdf('0x7'));var config=require(_0x2bdf('0x8'));var jayson=require(_0x2bdf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a5a76,_0x21e8e2,_0x31fedb){return new BPromise(function(_0x1bd3d6,_0x113115){return client[_0x2bdf('0xa')](_0x2a5a76,_0x31fedb)[_0x2bdf('0xb')](function(_0x5ee585){logger['info'](_0x2bdf('0xc'),_0x21e8e2,_0x2bdf('0xd'));logger[_0x2bdf('0xe')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x21e8e2,_0x2bdf('0xd'),JSON['stringify'](_0x5ee585));if(_0x5ee585[_0x2bdf('0xf')]){if(_0x5ee585['error'][_0x2bdf('0x10')]===0x1f4){logger[_0x2bdf('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x21e8e2,_0x5ee585[_0x2bdf('0xf')][_0x2bdf('0x11')]);return _0x113115(_0x5ee585['error'][_0x2bdf('0x11')]);}logger[_0x2bdf('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x21e8e2,_0x5ee585[_0x2bdf('0xf')]['message']);return _0x1bd3d6(_0x5ee585[_0x2bdf('0xf')][_0x2bdf('0x11')]);}else{logger[_0x2bdf('0x12')](_0x2bdf('0xc'),_0x21e8e2,_0x2bdf('0xd'));_0x1bd3d6(_0x5ee585[_0x2bdf('0x13')][_0x2bdf('0x11')]);}})[_0x2bdf('0x14')](function(_0x57c9ed){logger[_0x2bdf('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x21e8e2,_0x57c9ed);_0x113115(_0x57c9ed);});});} \ No newline at end of file +var _0x9e4b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2ac94a,_0x483de7){var _0x49d782=function(_0x49866e){while(--_0x49866e){_0x2ac94a['push'](_0x2ac94a['shift']());}};_0x49d782(++_0x483de7);}(_0x9e4b,0xea));var _0xb9e4=function(_0x2c1e8e,_0x48f08e){_0x2c1e8e=_0x2c1e8e-0x0;var _0x446d65=_0x9e4b[_0x2c1e8e];return _0x446d65;};'use strict';var _=require(_0xb9e4('0x0'));var util=require(_0xb9e4('0x1'));var moment=require(_0xb9e4('0x2'));var BPromise=require(_0xb9e4('0x3'));var rs=require(_0xb9e4('0x4'));var fs=require('fs');var Redis=require(_0xb9e4('0x5'));var db=require(_0xb9e4('0x6'))['db'];var utils=require(_0xb9e4('0x7'));var logger=require(_0xb9e4('0x8'))(_0xb9e4('0x9'));var config=require(_0xb9e4('0xa'));var jayson=require(_0xb9e4('0xb'));var client=jayson[_0xb9e4('0xc')][_0xb9e4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ba40a,_0x53f00c,_0x1b5f07){return new BPromise(function(_0x16c1e9,_0x393b08){return client['request'](_0x5ba40a,_0x1b5f07)['then'](function(_0x470a76){logger[_0xb9e4('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x53f00c,_0xb9e4('0xf'));logger[_0xb9e4('0x10')](_0xb9e4('0x11'),_0x53f00c,_0xb9e4('0xf'),JSON[_0xb9e4('0x12')](_0x470a76));if(_0x470a76[_0xb9e4('0x13')]){if(_0x470a76[_0xb9e4('0x13')][_0xb9e4('0x14')]===0x1f4){logger[_0xb9e4('0x13')](_0xb9e4('0x15'),_0x53f00c,_0x470a76[_0xb9e4('0x13')][_0xb9e4('0x16')]);return _0x393b08(_0x470a76[_0xb9e4('0x13')]['message']);}logger[_0xb9e4('0x13')](_0xb9e4('0x15'),_0x53f00c,_0x470a76[_0xb9e4('0x13')][_0xb9e4('0x16')]);return _0x16c1e9(_0x470a76[_0xb9e4('0x13')][_0xb9e4('0x16')]);}else{logger[_0xb9e4('0xe')](_0xb9e4('0x15'),_0x53f00c,_0xb9e4('0xf'));_0x16c1e9(_0x470a76[_0xb9e4('0x17')][_0xb9e4('0x16')]);}})['catch'](function(_0x545b05){logger[_0xb9e4('0x13')](_0xb9e4('0x15'),_0x53f00c,_0x545b05);_0x393b08(_0x545b05);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c714682..20acf94 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 _0x1ef2=['show','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticTreeReport.controller','isAuthenticated','index','/:id'];(function(_0x4e1926,_0x2415d6){var _0x85fa41=function(_0x3f3886){while(--_0x3f3886){_0x4e1926['push'](_0x4e1926['shift']());}};_0x85fa41(++_0x2415d6);}(_0x1ef2,0x196));var _0x21ef=function(_0x212283,_0x517230){_0x212283=_0x212283-0x0;var _0x391557=_0x1ef2[_0x212283];return _0x391557;};'use strict';var multer=require(_0x21ef('0x0'));var util=require('util');var path=require(_0x21ef('0x1'));var timeout=require(_0x21ef('0x2'));var express=require(_0x21ef('0x3'));var router=express[_0x21ef('0x4')]();var auth=require(_0x21ef('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21ef('0x6'));router['get']('/',auth[_0x21ef('0x7')](),controller[_0x21ef('0x8')]);router['get'](_0x21ef('0x9'),auth[_0x21ef('0x7')](),controller[_0x21ef('0xa')]);router[_0x21ef('0xb')]('/',auth[_0x21ef('0x7')](),controller[_0x21ef('0xc')]);router['put'](_0x21ef('0x9'),auth[_0x21ef('0x7')](),controller['update']);router[_0x21ef('0xd')](_0x21ef('0x9'),auth[_0x21ef('0x7')](),controller[_0x21ef('0xe')]);module[_0x21ef('0xf')]=router; \ No newline at end of file +var _0xc0f3=['create','put','update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','show','post'];(function(_0x556a5f,_0x5d0a3e){var _0x5dc353=function(_0x3d417b){while(--_0x3d417b){_0x556a5f['push'](_0x556a5f['shift']());}};_0x5dc353(++_0x5d0a3e);}(_0xc0f3,0xd7));var _0x3c0f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0f3[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x3c0f('0x0'));var util=require(_0x3c0f('0x1'));var path=require(_0x3c0f('0x2'));var timeout=require(_0x3c0f('0x3'));var express=require('express');var router=express[_0x3c0f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c0f('0x5'));var config=require(_0x3c0f('0x6'));var controller=require(_0x3c0f('0x7'));router[_0x3c0f('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c0f('0x9')]);router[_0x3c0f('0x8')](_0x3c0f('0xa'),auth['isAuthenticated'](),controller[_0x3c0f('0xb')]);router[_0x3c0f('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c0f('0xd')]);router[_0x3c0f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3c0f('0xf')]);router[_0x3c0f('0x10')](_0x3c0f('0xa'),auth[_0x3c0f('0x11')](),controller[_0x3c0f('0x12')]);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 54dc618..62d956a 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 _0x08f8=['STRING','sequelize'];(function(_0x1cd41f,_0x1b9279){var _0x572030=function(_0x2a5592){while(--_0x2a5592){_0x1cd41f['push'](_0x1cd41f['shift']());}};_0x572030(++_0x1b9279);}(_0x08f8,0x14f));var _0x808f=function(_0x139b66,_0x2bc13b){_0x139b66=_0x139b66-0x0;var _0x4ba0fe=_0x08f8[_0x139b66];return _0x4ba0fe;};'use strict';var Sequelize=require(_0x808f('0x0'));module['exports']={'name':{'type':Sequelize[_0x808f('0x1')]},'basename':{'type':Sequelize[_0x808f('0x1')]},'type':{'type':Sequelize[_0x808f('0x1')]}}; \ No newline at end of file +var _0xb3bf=['exports','STRING','sequelize'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xb3bf,0x1a3));var _0xfb3b=function(_0x476ee3,_0x4e1617){_0x476ee3=_0x476ee3-0x0;var _0x14bd75=_0xb3bf[_0x476ee3];return _0x14bd75;};'use strict';var Sequelize=require(_0xfb3b('0x0'));module[_0xfb3b('0x1')]={'name':{'type':Sequelize[_0xfb3b('0x2')]},'basename':{'type':Sequelize[_0xfb3b('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 2ec1fb6..4dc6b18 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 _0xb565=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','Attachment','includeAll','include','findAll','catch','show','params','clone','options','find','get','omit','createdAt','updatedAt','body','create','originalname','basename','file','filename','download','findOne','root','html-pdf','rimraf','request-promise','mustache','util','path','to-csv','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x48d923,_0x1052eb){var _0x1ff501=function(_0x48342e){while(--_0x48342e){_0x48d923['push'](_0x48d923['shift']());}};_0x1ff501(++_0x1052eb);}(_0xb565,0x83));var _0x5b56=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0xb565[_0x592d48];return _0x5d789e;};'use strict';var pdf=require(_0x5b56('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b56('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b56('0x3'));var util=require(_0x5b56('0x4'));var path=require(_0x5b56('0x5'));var sox=require('sox');var csv=require(_0x5b56('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5b56('0x7'));var squel=require('squel');var crypto=require(_0x5b56('0x8'));var jsforce=require(_0x5b56('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5b56('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b56('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x5b56('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b56('0xc'));var logger=require(_0x5b56('0xd'))('api');var utils=require(_0x5b56('0xe'));var config=require(_0x5b56('0xf'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2dac,_0x2f4df2){_0x2f4df2=_0x2f4df2||0xcc;return function(_0x5e7478){if(_0x5e7478){return _0x2b2dac[_0x5b56('0x10')](_0x2f4df2);}return _0x2b2dac[_0x5b56('0x11')](_0x2f4df2)[_0x5b56('0x12')]();};}function respondWithResult(_0x4e551a,_0x26c9cf){_0x26c9cf=_0x26c9cf||0xc8;return function(_0x147126){if(_0x147126){return _0x4e551a[_0x5b56('0x11')](_0x26c9cf)[_0x5b56('0x13')](_0x147126);}};}function respondWithFilteredResult(_0x4af5f1,_0x598e49){return function(_0x466143){if(_0x466143){var _0xf61141=_0x466143[_0x5b56('0x14')],_0x442dbf=_0x598e49[_0x5b56('0x15')],_0x2a734d=_0x598e49[_0x5b56('0x15')]+_0x598e49[_0x5b56('0x16')],_0xb4a725;if(_0x2a734d>=_0xf61141){_0x2a734d=_0xf61141;_0xb4a725=0xc8;}else{_0xb4a725=0xce;}_0x4af5f1[_0x5b56('0x11')](_0xb4a725);return _0x4af5f1[_0x5b56('0x17')](_0x5b56('0x18'),_0x442dbf+'-'+_0x2a734d+'/'+_0xf61141)[_0x5b56('0x13')](_0x466143);}return null;};}function patchUpdates(_0x355a42){return function(_0x2cf072){try{jsonpatch[_0x5b56('0x19')](_0x2cf072,_0x355a42,!![]);}catch(_0x56b1f6){return BPromise[_0x5b56('0x1a')](_0x56b1f6);}return _0x2cf072[_0x5b56('0x1b')]();};}function saveUpdates(_0x2505d6,_0x23387d){return function(_0x1fff9d){if(_0x1fff9d){return _0x1fff9d[_0x5b56('0x1c')](_0x2505d6)[_0x5b56('0x1d')](function(_0x502a1b){return _0x502a1b;});}return null;};}function removeEntity(_0x4d3d4d,_0x1b56c0){return function(_0x33911a){if(_0x33911a){return _0x33911a[_0x5b56('0x1e')]()['then'](function(){_0x4d3d4d[_0x5b56('0x11')](0xcc)[_0x5b56('0x12')]();});}};}function handleEntityNotFound(_0x493a5a,_0x1a7886){return function(_0xfe311b){if(!_0xfe311b){_0x493a5a[_0x5b56('0x10')](0x194);}return _0xfe311b;};}function handleError(_0x5753ca,_0xddd438){_0xddd438=_0xddd438||0x1f4;return function(_0xd22562){logger[_0x5b56('0x1f')](_0xd22562[_0x5b56('0x20')]);if(_0xd22562[_0x5b56('0x21')]){delete _0xd22562[_0x5b56('0x21')];}_0x5753ca['status'](_0xddd438)[_0x5b56('0x22')](_0xd22562);};}exports[_0x5b56('0x23')]=function(_0x3f49f8,_0x12a3ef){var _0x3f574e={},_0x336805={},_0x181efd={'count':0x0,'rows':[]};var _0x4e2102=_[_0x5b56('0x24')](db['Attachment'][_0x5b56('0x25')],function(_0x58872e){return{'name':_0x58872e[_0x5b56('0x26')],'type':_0x58872e[_0x5b56('0x27')][_0x5b56('0x28')]};});_0x336805[_0x5b56('0x29')]=_[_0x5b56('0x24')](_0x4e2102,'name');_0x336805[_0x5b56('0x2a')]=_[_0x5b56('0x2b')](_0x3f49f8['query']);_0x336805[_0x5b56('0x2c')]=_['intersection'](_0x336805['model'],_0x336805['query']);_0x3f574e[_0x5b56('0x2d')]=_[_0x5b56('0x2e')](_0x336805[_0x5b56('0x29')],qs[_0x5b56('0x2f')](_0x3f49f8[_0x5b56('0x2a')][_0x5b56('0x2f')]));_0x3f574e[_0x5b56('0x2d')]=_0x3f574e[_0x5b56('0x2d')][_0x5b56('0x30')]?_0x3f574e['attributes']:_0x336805[_0x5b56('0x29')];if(!_0x3f49f8[_0x5b56('0x2a')]['hasOwnProperty'](_0x5b56('0x31'))){_0x3f574e['limit']=qs[_0x5b56('0x16')](_0x3f49f8[_0x5b56('0x2a')][_0x5b56('0x16')]);_0x3f574e[_0x5b56('0x15')]=qs['offset'](_0x3f49f8['query']['offset']);}_0x3f574e[_0x5b56('0x32')]=qs[_0x5b56('0x33')](_0x3f49f8[_0x5b56('0x2a')][_0x5b56('0x33')]);_0x3f574e[_0x5b56('0x34')]=qs[_0x5b56('0x2c')](_['pick'](_0x3f49f8[_0x5b56('0x2a')],_0x336805[_0x5b56('0x2c')]),_0x4e2102);if(_0x3f49f8[_0x5b56('0x2a')][_0x5b56('0x35')]){_0x3f574e['where']=_[_0x5b56('0x36')](_0x3f574e[_0x5b56('0x34')],{'$or':_[_0x5b56('0x24')](_0x4e2102,function(_0x23554f){if(_0x23554f[_0x5b56('0x27')]!==_0x5b56('0x37')){var _0x5782cd={};_0x5782cd[_0x23554f[_0x5b56('0x21')]]={'$like':'%'+_0x3f49f8['query'][_0x5b56('0x35')]+'%'};return _0x5782cd;}})});}_0x3f574e=_[_0x5b56('0x36')]({},_0x3f574e,_0x3f49f8['options']);var _0x614f6d={'where':_0x3f574e[_0x5b56('0x34')]};return db[_0x5b56('0x38')][_0x5b56('0x14')](_0x614f6d)['then'](function(_0x4bfc00){_0x181efd[_0x5b56('0x14')]=_0x4bfc00;if(_0x3f49f8['query'][_0x5b56('0x39')]){_0x3f574e[_0x5b56('0x3a')]=[{'all':!![]}];}return db['Attachment'][_0x5b56('0x3b')](_0x3f574e);})[_0x5b56('0x1d')](function(_0x5d0cbf){_0x181efd['rows']=_0x5d0cbf;return _0x181efd;})[_0x5b56('0x1d')](respondWithFilteredResult(_0x12a3ef,_0x3f574e))[_0x5b56('0x3c')](handleError(_0x12a3ef,null));};exports[_0x5b56('0x3d')]=function(_0x49d4a6,_0x2ba673){var _0x26db3a={'raw':!![],'where':{'id':_0x49d4a6[_0x5b56('0x3e')]['id']}},_0x31b9f6={};_0x31b9f6['model']=_['keys'](db['Attachment'][_0x5b56('0x25')]);_0x31b9f6['query']=_['keys'](_0x49d4a6[_0x5b56('0x2a')]);_0x31b9f6[_0x5b56('0x2c')]=_[_0x5b56('0x2e')](_0x31b9f6['model'],_0x31b9f6[_0x5b56('0x2a')]);_0x26db3a[_0x5b56('0x2d')]=_['intersection'](_0x31b9f6[_0x5b56('0x29')],qs['fields'](_0x49d4a6[_0x5b56('0x2a')][_0x5b56('0x2f')]));_0x26db3a[_0x5b56('0x2d')]=_0x26db3a[_0x5b56('0x2d')][_0x5b56('0x30')]?_0x26db3a[_0x5b56('0x2d')]:_0x31b9f6[_0x5b56('0x29')];if(_0x49d4a6[_0x5b56('0x2a')][_0x5b56('0x39')]){_0x26db3a[_0x5b56('0x3a')]=[{'all':!![]}];}_0x26db3a=_['merge']({},_0x26db3a,_0x49d4a6['options']);return db['Attachment']['find'](_0x26db3a)[_0x5b56('0x1d')](handleEntityNotFound(_0x2ba673,null))[_0x5b56('0x1d')](respondWithResult(_0x2ba673,null))[_0x5b56('0x3c')](handleError(_0x2ba673,null));};exports[_0x5b56('0x3f')]=function(_0x15cf6f,_0x2580a8){var _0x24e533={'where':{'id':_0x15cf6f[_0x5b56('0x3e')]['id']}},_0x37c571={};_0x37c571[_0x5b56('0x29')]=_[_0x5b56('0x2b')](db[_0x5b56('0x38')][_0x5b56('0x25')]);_0x24e533[_0x5b56('0x2d')]=_[_0x5b56('0x2e')](_0x37c571[_0x5b56('0x29')],qs[_0x5b56('0x2f')](_0x15cf6f[_0x5b56('0x2a')][_0x5b56('0x2f')]));_0x24e533[_0x5b56('0x2d')]=_0x24e533[_0x5b56('0x2d')][_0x5b56('0x30')]?_0x24e533[_0x5b56('0x2d')]:_0x37c571[_0x5b56('0x29')];if(_0x15cf6f['query'][_0x5b56('0x39')]){_0x24e533[_0x5b56('0x3a')]=[{'all':!![]}];}_0x24e533=_[_0x5b56('0x36')]({},_0x24e533,_0x15cf6f[_0x5b56('0x40')]);return db[_0x5b56('0x38')][_0x5b56('0x41')](_0x24e533)[_0x5b56('0x1d')](handleEntityNotFound(_0x2580a8,null))[_0x5b56('0x1d')](function(_0x4ebacd){if(_0x4ebacd){var _0x152826=_0x4ebacd[_0x5b56('0x42')]({'plain':!![]});_0x152826=qs[_0x5b56('0x43')](_0x152826,['id',_0x5b56('0x44'),'updatedAt']);_0x15cf6f['body']=_['omit'](_0x15cf6f['body'],['id',_0x5b56('0x44'),_0x5b56('0x45')]);return db[_0x5b56('0x38')]['create'](_['merge'](_0x152826,_0x15cf6f[_0x5b56('0x46')]),{'include':_0x15cf6f[_0x5b56('0x2a')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x5b56('0x1d')](respondWithResult(_0x2580a8,0xc9))[_0x5b56('0x3c')](handleError(_0x2580a8,null));};exports['update']=function(_0x40a117,_0x351087){if(_0x40a117[_0x5b56('0x46')]['id']){delete _0x40a117[_0x5b56('0x46')]['id'];}return db[_0x5b56('0x38')]['find']({'where':{'id':_0x40a117['params']['id']}})[_0x5b56('0x1d')](handleEntityNotFound(_0x351087,null))[_0x5b56('0x1d')](saveUpdates(_0x40a117[_0x5b56('0x46')],null))[_0x5b56('0x1d')](respondWithResult(_0x351087,null))[_0x5b56('0x3c')](handleError(_0x351087,null));};exports['destroy']=function(_0x52cb91,_0x12f035){return db[_0x5b56('0x38')][_0x5b56('0x41')]({'where':{'id':_0x52cb91[_0x5b56('0x3e')]['id']}})['then'](handleEntityNotFound(_0x12f035,null))[_0x5b56('0x1d')](removeEntity(_0x12f035,null))[_0x5b56('0x3c')](handleError(_0x12f035,null));};exports[_0x5b56('0x47')]=function(_0xc097d0,_0x13d769,_0x4b955b){_0xc097d0[_0x5b56('0x46')][_0x5b56('0x21')]=_0xc097d0['file'][_0x5b56('0x48')];_0xc097d0['body'][_0x5b56('0x49')]=_0xc097d0[_0x5b56('0x4a')][_0x5b56('0x4b')];_0xc097d0[_0x5b56('0x46')][_0x5b56('0x27')]=_0xc097d0['file']['mimetype'];return db[_0x5b56('0x38')][_0x5b56('0x47')](_0xc097d0[_0x5b56('0x46')])['then'](respondWithResult(_0x13d769,0xc9))[_0x5b56('0x3c')](handleError(_0x13d769,null));};exports[_0x5b56('0x4c')]=function(_0x228c04,_0x975468,_0x1ddf81){return db[_0x5b56('0x38')][_0x5b56('0x4d')]({'where':{'id':_0x228c04[_0x5b56('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x975468,null))[_0x5b56('0x1d')](function(_0xd835d){if(_0xd835d){return _0x975468['download'](path['join'](config[_0x5b56('0x4e')],'server/files/attachments/',_0xd835d[_0x5b56('0x49')]));}})[_0x5b56('0x3c')](handleError(_0x975468,null));}; \ No newline at end of file +var _0x6e2c=['params','get','createdAt','updatedAt','body','omit','create','destroy','originalname','file','filename','mimetype','download','findOne','root','server/files/attachments/','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','clone'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x6e2c,0x171));var _0xc6e2=function(_0x47c66a,_0x32eb6e){_0x47c66a=_0x47c66a-0x0;var _0x307555=_0x6e2c[_0x47c66a];return _0x307555;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc6e2('0x0'));var zipdir=require(_0xc6e2('0x1'));var jsonpatch=require(_0xc6e2('0x2'));var rp=require(_0xc6e2('0x3'));var moment=require(_0xc6e2('0x4'));var BPromise=require(_0xc6e2('0x5'));var Mustache=require(_0xc6e2('0x6'));var util=require(_0xc6e2('0x7'));var path=require(_0xc6e2('0x8'));var sox=require('sox');var csv=require(_0xc6e2('0x9'));var ejs=require(_0xc6e2('0xa'));var fs=require('fs');var _=require(_0xc6e2('0xb'));var squel=require(_0xc6e2('0xc'));var crypto=require(_0xc6e2('0xd'));var jsforce=require(_0xc6e2('0xe'));var deskjs=require(_0xc6e2('0xf'));var toCsv=require(_0xc6e2('0x9'));var querystring=require(_0xc6e2('0x10'));var Papa=require(_0xc6e2('0x11'));var Redis=require('ioredis');var authService=require(_0xc6e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc6e2('0x13'));var hardwareService=require(_0xc6e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc6e2('0x15'));var licenseUtil=require(_0xc6e2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4960fb,_0x2a7362){_0x2a7362=_0x2a7362||0xcc;return function(_0x305e60){if(_0x305e60){return _0x4960fb[_0xc6e2('0x17')](_0x2a7362);}return _0x4960fb['status'](_0x2a7362)['end']();};}function respondWithResult(_0x520db9,_0x1c67b3){_0x1c67b3=_0x1c67b3||0xc8;return function(_0x122ee4){if(_0x122ee4){return _0x520db9[_0xc6e2('0x18')](_0x1c67b3)['json'](_0x122ee4);}};}function respondWithFilteredResult(_0x1d5dde,_0x204404){return function(_0xbfed5c){if(_0xbfed5c){var _0x23bf9e=_0xbfed5c[_0xc6e2('0x19')],_0x83d8bf=_0x204404[_0xc6e2('0x1a')],_0x156fd4=_0x204404[_0xc6e2('0x1a')]+_0x204404['limit'],_0x2a6004;if(_0x156fd4>=_0x23bf9e){_0x156fd4=_0x23bf9e;_0x2a6004=0xc8;}else{_0x2a6004=0xce;}_0x1d5dde[_0xc6e2('0x18')](_0x2a6004);return _0x1d5dde[_0xc6e2('0x1b')](_0xc6e2('0x1c'),_0x83d8bf+'-'+_0x156fd4+'/'+_0x23bf9e)[_0xc6e2('0x1d')](_0xbfed5c);}return null;};}function patchUpdates(_0xca3c26){return function(_0xdddb87){try{jsonpatch[_0xc6e2('0x1e')](_0xdddb87,_0xca3c26,!![]);}catch(_0x11c02b){return BPromise[_0xc6e2('0x1f')](_0x11c02b);}return _0xdddb87[_0xc6e2('0x20')]();};}function saveUpdates(_0x4609e6,_0x3ec813){return function(_0x577261){if(_0x577261){return _0x577261[_0xc6e2('0x21')](_0x4609e6)[_0xc6e2('0x22')](function(_0x2a2ebf){return _0x2a2ebf;});}return null;};}function removeEntity(_0x597b20,_0x1228fd){return function(_0x210b94){if(_0x210b94){return _0x210b94['destroy']()[_0xc6e2('0x22')](function(){_0x597b20[_0xc6e2('0x18')](0xcc)[_0xc6e2('0x23')]();});}};}function handleEntityNotFound(_0x2114a8,_0x2af5b9){return function(_0x49b351){if(!_0x49b351){_0x2114a8[_0xc6e2('0x17')](0x194);}return _0x49b351;};}function handleError(_0xd7798a,_0x31a687){_0x31a687=_0x31a687||0x1f4;return function(_0x57672a){logger[_0xc6e2('0x24')](_0x57672a['stack']);if(_0x57672a[_0xc6e2('0x25')]){delete _0x57672a[_0xc6e2('0x25')];}_0xd7798a[_0xc6e2('0x18')](_0x31a687)[_0xc6e2('0x26')](_0x57672a);};}exports[_0xc6e2('0x27')]=function(_0x4b740a,_0x577b6b){var _0x1d832a={},_0x1b9d44={},_0x29d059={'count':0x0,'rows':[]};var _0x1edc98=_[_0xc6e2('0x28')](db[_0xc6e2('0x29')][_0xc6e2('0x2a')],function(_0x254558){return{'name':_0x254558['fieldName'],'type':_0x254558[_0xc6e2('0x2b')][_0xc6e2('0x2c')]};});_0x1b9d44[_0xc6e2('0x2d')]=_[_0xc6e2('0x28')](_0x1edc98,_0xc6e2('0x25'));_0x1b9d44[_0xc6e2('0x2e')]=_[_0xc6e2('0x2f')](_0x4b740a[_0xc6e2('0x2e')]);_0x1b9d44[_0xc6e2('0x30')]=_['intersection'](_0x1b9d44[_0xc6e2('0x2d')],_0x1b9d44['query']);_0x1d832a['attributes']=_[_0xc6e2('0x31')](_0x1b9d44[_0xc6e2('0x2d')],qs[_0xc6e2('0x32')](_0x4b740a[_0xc6e2('0x2e')]['fields']));_0x1d832a[_0xc6e2('0x33')]=_0x1d832a['attributes'][_0xc6e2('0x34')]?_0x1d832a[_0xc6e2('0x33')]:_0x1b9d44[_0xc6e2('0x2d')];if(!_0x4b740a[_0xc6e2('0x2e')][_0xc6e2('0x35')](_0xc6e2('0x36'))){_0x1d832a[_0xc6e2('0x37')]=qs[_0xc6e2('0x37')](_0x4b740a[_0xc6e2('0x2e')][_0xc6e2('0x37')]);_0x1d832a['offset']=qs['offset'](_0x4b740a['query'][_0xc6e2('0x1a')]);}_0x1d832a[_0xc6e2('0x38')]=qs[_0xc6e2('0x39')](_0x4b740a[_0xc6e2('0x2e')][_0xc6e2('0x39')]);_0x1d832a[_0xc6e2('0x3a')]=qs[_0xc6e2('0x30')](_['pick'](_0x4b740a[_0xc6e2('0x2e')],_0x1b9d44[_0xc6e2('0x30')]),_0x1edc98);if(_0x4b740a['query']['filter']){_0x1d832a[_0xc6e2('0x3a')]=_[_0xc6e2('0x3b')](_0x1d832a[_0xc6e2('0x3a')],{'$or':_[_0xc6e2('0x28')](_0x1edc98,function(_0x2c596a){if(_0x2c596a[_0xc6e2('0x2b')]!==_0xc6e2('0x3c')){var _0x187f13={};_0x187f13[_0x2c596a[_0xc6e2('0x25')]]={'$like':'%'+_0x4b740a['query'][_0xc6e2('0x3d')]+'%'};return _0x187f13;}})});}_0x1d832a=_['merge']({},_0x1d832a,_0x4b740a[_0xc6e2('0x3e')]);var _0x57a7f9={'where':_0x1d832a[_0xc6e2('0x3a')]};return db['Attachment']['count'](_0x57a7f9)[_0xc6e2('0x22')](function(_0x43293c){_0x29d059[_0xc6e2('0x19')]=_0x43293c;if(_0x4b740a[_0xc6e2('0x2e')]['includeAll']){_0x1d832a[_0xc6e2('0x3f')]=[{'all':!![]}];}return db[_0xc6e2('0x29')][_0xc6e2('0x40')](_0x1d832a);})[_0xc6e2('0x22')](function(_0x4f3892){_0x29d059[_0xc6e2('0x41')]=_0x4f3892;return _0x29d059;})[_0xc6e2('0x22')](respondWithFilteredResult(_0x577b6b,_0x1d832a))[_0xc6e2('0x42')](handleError(_0x577b6b,null));};exports[_0xc6e2('0x43')]=function(_0x114354,_0x1548c3){var _0x41995e={'raw':!![],'where':{'id':_0x114354['params']['id']}},_0x198df5={};_0x198df5[_0xc6e2('0x2d')]=_[_0xc6e2('0x2f')](db[_0xc6e2('0x29')]['rawAttributes']);_0x198df5[_0xc6e2('0x2e')]=_[_0xc6e2('0x2f')](_0x114354['query']);_0x198df5[_0xc6e2('0x30')]=_['intersection'](_0x198df5[_0xc6e2('0x2d')],_0x198df5[_0xc6e2('0x2e')]);_0x41995e[_0xc6e2('0x33')]=_[_0xc6e2('0x31')](_0x198df5[_0xc6e2('0x2d')],qs[_0xc6e2('0x32')](_0x114354[_0xc6e2('0x2e')][_0xc6e2('0x32')]));_0x41995e[_0xc6e2('0x33')]=_0x41995e['attributes'][_0xc6e2('0x34')]?_0x41995e[_0xc6e2('0x33')]:_0x198df5['model'];if(_0x114354[_0xc6e2('0x2e')][_0xc6e2('0x44')]){_0x41995e['include']=[{'all':!![]}];}_0x41995e=_['merge']({},_0x41995e,_0x114354[_0xc6e2('0x3e')]);return db[_0xc6e2('0x29')][_0xc6e2('0x45')](_0x41995e)[_0xc6e2('0x22')](handleEntityNotFound(_0x1548c3,null))[_0xc6e2('0x22')](respondWithResult(_0x1548c3,null))['catch'](handleError(_0x1548c3,null));};exports[_0xc6e2('0x46')]=function(_0x43ccd0,_0x1886b4){var _0x3b6204={'where':{'id':_0x43ccd0[_0xc6e2('0x47')]['id']}},_0x5d581e={};_0x5d581e['model']=_[_0xc6e2('0x2f')](db['Attachment'][_0xc6e2('0x2a')]);_0x3b6204[_0xc6e2('0x33')]=_['intersection'](_0x5d581e['model'],qs['fields'](_0x43ccd0[_0xc6e2('0x2e')][_0xc6e2('0x32')]));_0x3b6204[_0xc6e2('0x33')]=_0x3b6204[_0xc6e2('0x33')][_0xc6e2('0x34')]?_0x3b6204[_0xc6e2('0x33')]:_0x5d581e[_0xc6e2('0x2d')];if(_0x43ccd0['query'][_0xc6e2('0x44')]){_0x3b6204[_0xc6e2('0x3f')]=[{'all':!![]}];}_0x3b6204=_[_0xc6e2('0x3b')]({},_0x3b6204,_0x43ccd0[_0xc6e2('0x3e')]);return db['Attachment'][_0xc6e2('0x45')](_0x3b6204)[_0xc6e2('0x22')](handleEntityNotFound(_0x1886b4,null))['then'](function(_0x238afc){if(_0x238afc){var _0xea1fc4=_0x238afc[_0xc6e2('0x48')]({'plain':!![]});_0xea1fc4=qs['omit'](_0xea1fc4,['id',_0xc6e2('0x49'),_0xc6e2('0x4a')]);_0x43ccd0[_0xc6e2('0x4b')]=_[_0xc6e2('0x4c')](_0x43ccd0[_0xc6e2('0x4b')],['id',_0xc6e2('0x49'),_0xc6e2('0x4a')]);return db[_0xc6e2('0x29')][_0xc6e2('0x4d')](_['merge'](_0xea1fc4,_0x43ccd0[_0xc6e2('0x4b')]),{'include':_0x43ccd0['query'][_0xc6e2('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1886b4,0xc9))[_0xc6e2('0x42')](handleError(_0x1886b4,null));};exports[_0xc6e2('0x21')]=function(_0x2f00e9,_0x2d21f6){if(_0x2f00e9['body']['id']){delete _0x2f00e9[_0xc6e2('0x4b')]['id'];}return db['Attachment']['find']({'where':{'id':_0x2f00e9['params']['id']}})[_0xc6e2('0x22')](handleEntityNotFound(_0x2d21f6,null))[_0xc6e2('0x22')](saveUpdates(_0x2f00e9[_0xc6e2('0x4b')],null))['then'](respondWithResult(_0x2d21f6,null))[_0xc6e2('0x42')](handleError(_0x2d21f6,null));};exports[_0xc6e2('0x4e')]=function(_0x22649a,_0x188be6){return db['Attachment'][_0xc6e2('0x45')]({'where':{'id':_0x22649a[_0xc6e2('0x47')]['id']}})[_0xc6e2('0x22')](handleEntityNotFound(_0x188be6,null))[_0xc6e2('0x22')](removeEntity(_0x188be6,null))[_0xc6e2('0x42')](handleError(_0x188be6,null));};exports[_0xc6e2('0x4d')]=function(_0x42804a,_0x1da011,_0x21f22f){_0x42804a[_0xc6e2('0x4b')]['name']=_0x42804a['file'][_0xc6e2('0x4f')];_0x42804a[_0xc6e2('0x4b')]['basename']=_0x42804a[_0xc6e2('0x50')][_0xc6e2('0x51')];_0x42804a['body'][_0xc6e2('0x2b')]=_0x42804a[_0xc6e2('0x50')][_0xc6e2('0x52')];return db[_0xc6e2('0x29')][_0xc6e2('0x4d')](_0x42804a[_0xc6e2('0x4b')])[_0xc6e2('0x22')](respondWithResult(_0x1da011,0xc9))['catch'](handleError(_0x1da011,null));};exports[_0xc6e2('0x53')]=function(_0x10d58d,_0x3610e9,_0x53c575){return db[_0xc6e2('0x29')][_0xc6e2('0x54')]({'where':{'id':_0x10d58d['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3610e9,null))[_0xc6e2('0x22')](function(_0x14447c){if(_0x14447c){return _0x3610e9[_0xc6e2('0x53')](path['join'](config[_0xc6e2('0x55')],_0xc6e2('0x56'),_0x14447c[_0xc6e2('0x57')]));}})[_0xc6e2('0x42')](handleError(_0x3610e9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index bc0c4bc..6535601 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 _0x9e63=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger'];(function(_0x2873eb,_0x2f7dd4){var _0x184e35=function(_0x1b89b1){while(--_0x1b89b1){_0x2873eb['push'](_0x2873eb['shift']());}};_0x184e35(++_0x2f7dd4);}(_0x9e63,0x65));var _0x39e6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x9e63[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require(_0x39e6('0x2'))('api');var moment=require(_0x39e6('0x3'));var BPromise=require(_0x39e6('0x4'));var rp=require(_0x39e6('0x5'));var fs=require('fs');var path=require(_0x39e6('0x6'));var rimraf=require(_0x39e6('0x7'));var config=require(_0x39e6('0x8'));var attributes=require(_0x39e6('0x9'));module[_0x39e6('0xa')]=function(_0x48f3bb,_0x367e77){return _0x48f3bb[_0x39e6('0xb')](_0x39e6('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa702=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','Attachment','attachments'];(function(_0x2483f6,_0x70bc75){var _0x44f7b9=function(_0x42aa04){while(--_0x42aa04){_0x2483f6['push'](_0x2483f6['shift']());}};_0x44f7b9(++_0x70bc75);}(_0xa702,0x1ae));var _0x2a70=function(_0x2e155a,_0x3d8e81){_0x2e155a=_0x2e155a-0x0;var _0x1bb016=_0xa702[_0x2e155a];return _0x1bb016;};'use strict';var _=require(_0x2a70('0x0'));var util=require(_0x2a70('0x1'));var logger=require(_0x2a70('0x2'))(_0x2a70('0x3'));var moment=require(_0x2a70('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a70('0x6'));var attributes=require('./attachment.attributes');module[_0x2a70('0x7')]=function(_0x16cdc3,_0x4b2915){return _0x16cdc3['define'](_0x2a70('0x8'),attributes,{'tableName':_0x2a70('0x9'),'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 6777370..5aeba17 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 _0xed69=['code','message','result','catch','Attachment','create','body','options','raw','then','CreateAttachment','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xed69,0x1c6));var _0x9ed6=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0xed69[_0x19f9e6];return _0x45c862;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ed6('0x0'));var BPromise=require(_0x9ed6('0x1'));var rs=require(_0x9ed6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ed6('0x3'))['db'];var utils=require(_0x9ed6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9ed6('0x5'));var jayson=require(_0x9ed6('0x6'));var client=jayson['client'][_0x9ed6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1686ee,_0x5277df,_0x4a75c){return new BPromise(function(_0x40be73,_0x31880a){return client['request'](_0x1686ee,_0x4a75c)['then'](function(_0x26ba32){logger[_0x9ed6('0x8')](_0x9ed6('0x9'),_0x5277df,_0x9ed6('0xa'));logger[_0x9ed6('0xb')](_0x9ed6('0xc'),_0x5277df,_0x9ed6('0xa'),JSON['stringify'](_0x26ba32));if(_0x26ba32['error']){if(_0x26ba32[_0x9ed6('0xd')][_0x9ed6('0xe')]===0x1f4){logger['error'](_0x9ed6('0x9'),_0x5277df,_0x26ba32[_0x9ed6('0xd')]['message']);return _0x31880a(_0x26ba32[_0x9ed6('0xd')][_0x9ed6('0xf')]);}logger['error'](_0x9ed6('0x9'),_0x5277df,_0x26ba32['error']['message']);return _0x40be73(_0x26ba32[_0x9ed6('0xd')][_0x9ed6('0xf')]);}else{logger[_0x9ed6('0x8')](_0x9ed6('0x9'),_0x5277df,'request\x20sent');_0x40be73(_0x26ba32[_0x9ed6('0x10')][_0x9ed6('0xf')]);}})[_0x9ed6('0x11')](function(_0x5cbaba){logger[_0x9ed6('0xd')](_0x9ed6('0x9'),_0x5277df,_0x5cbaba);_0x31880a(_0x5cbaba);});});}exports['CreateAttachment']=function(_0x262125){var _0x4f5cb7=this;return new Promise(function(_0x734e7d,_0x3db07f){return db[_0x9ed6('0x12')][_0x9ed6('0x13')](_0x262125[_0x9ed6('0x14')],{'raw':_0x262125[_0x9ed6('0x15')]?_0x262125[_0x9ed6('0x15')][_0x9ed6('0x16')]===undefined?!![]:![]:!![]})[_0x9ed6('0x17')](function(_0x3ccfa7){logger[_0x9ed6('0x8')](_0x9ed6('0x18'),_0x262125);logger[_0x9ed6('0xb')](_0x9ed6('0x18'),_0x262125,JSON[_0x9ed6('0x19')](_0x3ccfa7));_0x734e7d(_0x3ccfa7);})[_0x9ed6('0x11')](function(_0x4d5fe8){logger['error'](_0x9ed6('0x18'),_0x4d5fe8[_0x9ed6('0xf')],_0x262125);_0x3db07f(_0x4f5cb7[_0x9ed6('0xd')](0x1f4,_0x4d5fe8[_0x9ed6('0xf')]));});});}; \ No newline at end of file +var _0xf10e=['debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment','body','options','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x4a6bca,_0x41c563){var _0x27958e=function(_0x11d207){while(--_0x11d207){_0x4a6bca['push'](_0x4a6bca['shift']());}};_0x27958e(++_0x41c563);}(_0xf10e,0x1c5));var _0xef10=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf10e[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xef10('0x0'));var util=require(_0xef10('0x1'));var moment=require(_0xef10('0x2'));var BPromise=require(_0xef10('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef10('0x4'))(_0xef10('0x5'));var config=require(_0xef10('0x6'));var jayson=require(_0xef10('0x7'));var client=jayson[_0xef10('0x8')][_0xef10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3db2bd,_0x5b5847,_0xde9c0a){return new BPromise(function(_0x5a1094,_0x21b108){return client[_0xef10('0xa')](_0x3db2bd,_0xde9c0a)[_0xef10('0xb')](function(_0x3ffe13){logger[_0xef10('0xc')](_0xef10('0xd'),_0x5b5847,_0xef10('0xe'));logger[_0xef10('0xf')](_0xef10('0x10'),_0x5b5847,_0xef10('0xe'),JSON[_0xef10('0x11')](_0x3ffe13));if(_0x3ffe13[_0xef10('0x12')]){if(_0x3ffe13[_0xef10('0x12')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x5b5847,_0x3ffe13[_0xef10('0x12')][_0xef10('0x13')]);return _0x21b108(_0x3ffe13[_0xef10('0x12')]['message']);}logger[_0xef10('0x12')](_0xef10('0xd'),_0x5b5847,_0x3ffe13[_0xef10('0x12')]['message']);return _0x5a1094(_0x3ffe13[_0xef10('0x12')][_0xef10('0x13')]);}else{logger[_0xef10('0xc')](_0xef10('0xd'),_0x5b5847,_0xef10('0xe'));_0x5a1094(_0x3ffe13[_0xef10('0x14')]['message']);}})[_0xef10('0x15')](function(_0xea8541){logger[_0xef10('0x12')](_0xef10('0xd'),_0x5b5847,_0xea8541);_0x21b108(_0xea8541);});});}exports[_0xef10('0x16')]=function(_0x5d4755){var _0x34f361=this;return new Promise(function(_0x24bf3f,_0x3e2593){return db[_0xef10('0x17')]['create'](_0x5d4755[_0xef10('0x18')],{'raw':_0x5d4755[_0xef10('0x19')]?_0x5d4755[_0xef10('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xef10('0xb')](function(_0x3a37f1){logger['info'](_0xef10('0x16'),_0x5d4755);logger[_0xef10('0xf')](_0xef10('0x16'),_0x5d4755,JSON[_0xef10('0x11')](_0x3a37f1));_0x24bf3f(_0x3a37f1);})[_0xef10('0x15')](function(_0x24713){logger[_0xef10('0x12')](_0xef10('0x16'),_0x24713['message'],_0x5d4755);_0x3e2593(_0x34f361[_0xef10('0x12')](0x1f4,_0x24713[_0xef10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3818bae..2e84b8a 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 _0xb758=['show','/:id/download','download','post','/:id/clone','diskStorage','join','root','server/files/attachments/','%s-%s','originalname','replace','single','file','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./attachment.controller','get','index','/:id','isAuthenticated'];(function(_0x36398b,_0x336209){var _0x50107d=function(_0x1b5825){while(--_0x1b5825){_0x36398b['push'](_0x36398b['shift']());}};_0x50107d(++_0x336209);}(_0xb758,0x14a));var _0x8b75=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0xb758[_0x53f04f];return _0x16a824;};'use strict';var multer=require(_0x8b75('0x0'));var util=require(_0x8b75('0x1'));var path=require(_0x8b75('0x2'));var timeout=require(_0x8b75('0x3'));var express=require('express');var router=express[_0x8b75('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8b75('0x5'));var config=require('../../config/environment');var controller=require(_0x8b75('0x6'));router[_0x8b75('0x7')]('/',auth['isAuthenticated'](),controller[_0x8b75('0x8')]);router[_0x8b75('0x7')](_0x8b75('0x9'),auth[_0x8b75('0xa')](),controller[_0x8b75('0xb')]);router[_0x8b75('0x7')](_0x8b75('0xc'),auth[_0x8b75('0xa')](),controller[_0x8b75('0xd')]);router[_0x8b75('0xe')](_0x8b75('0xf'),auth[_0x8b75('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x8b75('0x10')]({'destination':function(_0x3d81ce,_0x82d32d,_0x10cc42){_0x10cc42(null,path[_0x8b75('0x11')](config[_0x8b75('0x12')],_0x8b75('0x13')));},'filename':function(_0x5d4ac7,_0x128a72,_0x1dbfe2){_0x1dbfe2(null,util['format'](_0x8b75('0x14'),Date['now'](),_0x128a72[_0x8b75('0x15')][_0x8b75('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8b75('0xe')]('/',upload[_0x8b75('0x17')](_0x8b75('0x18')),controller[_0x8b75('0x19')]);router[_0x8b75('0x1a')]('/:id',auth[_0x8b75('0xa')](),controller[_0x8b75('0x1b')]);router[_0x8b75('0x1c')](_0x8b75('0x9'),auth[_0x8b75('0xa')](),controller[_0x8b75('0x1d')]);module[_0x8b75('0x1e')]=router; \ No newline at end of file +var _0xf363=['express','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','clone','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x2d3513,_0x12bc99){var _0x2a757c=function(_0x1724ea){while(--_0x1724ea){_0x2d3513['push'](_0x2d3513['shift']());}};_0x2a757c(++_0x12bc99);}(_0xf363,0x9c));var _0x3f36=function(_0x26fd69,_0x3dfb5d){_0x26fd69=_0x26fd69-0x0;var _0x56f8d5=_0xf363[_0x26fd69];return _0x56f8d5;};'use strict';var multer=require(_0x3f36('0x0'));var util=require(_0x3f36('0x1'));var path=require(_0x3f36('0x2'));var timeout=require(_0x3f36('0x3'));var express=require(_0x3f36('0x4'));var router=express[_0x3f36('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3f36('0x6'));var config=require(_0x3f36('0x7'));var controller=require(_0x3f36('0x8'));router[_0x3f36('0x9')]('/',auth[_0x3f36('0xa')](),controller[_0x3f36('0xb')]);router[_0x3f36('0x9')](_0x3f36('0xc'),auth[_0x3f36('0xa')](),controller[_0x3f36('0xd')]);router[_0x3f36('0x9')](_0x3f36('0xe'),auth['isAuthenticated'](),controller[_0x3f36('0xf')]);router['post']('/:id/clone',auth[_0x3f36('0xa')](),controller[_0x3f36('0x10')]);var upload=multer({'storage':multer[_0x3f36('0x11')]({'destination':function(_0x49dce4,_0x4f0bb2,_0xaaf296){_0xaaf296(null,path[_0x3f36('0x12')](config[_0x3f36('0x13')],_0x3f36('0x14')));},'filename':function(_0x4afc8a,_0x3400cf,_0x2e19b7){_0x2e19b7(null,util['format'](_0x3f36('0x15'),Date[_0x3f36('0x16')](),_0x3400cf[_0x3f36('0x17')][_0x3f36('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3f36('0x19')]('/',upload[_0x3f36('0x1a')](_0x3f36('0x1b')),controller[_0x3f36('0x1c')]);router[_0x3f36('0x1d')](_0x3f36('0xc'),auth['isAuthenticated'](),controller[_0x3f36('0x1e')]);router['delete'](_0x3f36('0xc'),auth[_0x3f36('0xa')](),controller['destroy']);module[_0x3f36('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e4faca5..50e8824 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 _0x389c=['secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','find','value','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','getLicense','catch','lodash','passport','Strategy','../../config/environment','signToken','login','authenticate','google','/login','profile','use'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x389c,0x154));var _0xc389=function(_0x2a9d1f,_0x10a045){_0x2a9d1f=_0x2a9d1f-0x0;var _0x50bd7a=_0x389c[_0x2a9d1f];return _0x50bd7a;};'use strict';var _=require(_0xc389('0x0'));var passport=require(_0xc389('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xc389('0x2')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0xc389('0x3'));var signToken=require('../../components/auth/service')[_0xc389('0x4')];var utils=require('../../config/utils');exports[_0xc389('0x5')]=passport[_0xc389('0x6')](_0xc389('0x7'),{'failureRedirect':_0xc389('0x8'),'scope':[_0xc389('0x9'),'email'],'session':![]});exports['callback']=passport[_0xc389('0x6')](_0xc389('0x7'),{'failureRedirect':_0xc389('0x8'),'session':![]});passport[_0xc389('0xa')](new GoogleStrategy({'clientID':config[_0xc389('0x7')]?config[_0xc389('0x7')]['clientID']:'id','clientSecret':config['google']?config['google']['clientSecret']:_0xc389('0xb'),'callbackURL':config[_0xc389('0x7')]?config[_0xc389('0x7')][_0xc389('0xc')]:''},function(_0xa08274,_0x4ab723,_0x2f2b2b,_0x1771ab){var _0x5d47d8,_0x29f980;return db[_0xc389('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0xc389('0xe'),_0xc389('0xf')],'raw':!![]})[_0xc389('0x10')](function(_0x442516){_0x5d47d8=_0x442516;return db[_0xc389('0x11')][_0xc389('0x12')]({'where':{'email':_['map'](_0x2f2b2b['emails'],_0xc389('0x13')),'role':{'$or':[_0xc389('0x14'),'user','agent']}}});})[_0xc389('0x10')](function(_0x18741a){_0x29f980=_0x18741a;if(_0x29f980){if(_0x29f980[_0xc389('0x15')]){return _0x1771ab(_0xc389('0x16'));}else if(_0x5d47d8[_0xc389('0xf')]>0x0){if(_0x29f980[_0xc389('0x17')]){if(moment(_0x29f980[_0xc389('0x18')])['add'](_0x5d47d8[_0xc389('0xf')],'minutes')>moment()){return _0x1771ab(_0xc389('0x16'));}else{return utils['clearBlockUser'](_0x29f980,0x0,![],null)[_0xc389('0x10')](function(){return utils[_0xc389('0x19')](_0x29f980);})[_0xc389('0x10')](function(){return _0x1771ab(null,_0x29f980);});}}else{return utils[_0xc389('0x19')](_0x29f980)[_0xc389('0x10')](function(){return _0x1771ab(null,_0x29f980);});}}else{return utils[_0xc389('0x19')](_0x29f980)[_0xc389('0x10')](function(){return _0x1771ab(null,_0x29f980);});}}return _0x1771ab(_0xc389('0x16'));})[_0xc389('0x1a')](function(_0x2dc8af){_0x1771ab(_0x2dc8af);});})); \ No newline at end of file +var _0xdc56=['catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','/login','profile','email','use','clientID','clientSecret','secret','Setting','blockDuration','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense'];(function(_0x3cef4a,_0x29891c){var _0x348a0d=function(_0x3d64bf){while(--_0x3d64bf){_0x3cef4a['push'](_0x3cef4a['shift']());}};_0x348a0d(++_0x29891c);}(_0xdc56,0x1dd));var _0x6dc5=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xdc56[_0x4e198a];return _0xb84bfe;};'use strict';var _=require(_0x6dc5('0x0'));var passport=require(_0x6dc5('0x1'));var GoogleStrategy=require(_0x6dc5('0x2'))[_0x6dc5('0x3')];var moment=require(_0x6dc5('0x4'));var db=require(_0x6dc5('0x5'))['db'];var config=require(_0x6dc5('0x6'));var signToken=require(_0x6dc5('0x7'))[_0x6dc5('0x8')];var utils=require(_0x6dc5('0x9'));exports['login']=passport[_0x6dc5('0xa')](_0x6dc5('0xb'),{'failureRedirect':_0x6dc5('0xc'),'scope':[_0x6dc5('0xd'),_0x6dc5('0xe')],'session':![]});exports['callback']=passport[_0x6dc5('0xa')]('google',{'failureRedirect':_0x6dc5('0xc'),'session':![]});passport[_0x6dc5('0xf')](new GoogleStrategy({'clientID':config[_0x6dc5('0xb')]?config[_0x6dc5('0xb')][_0x6dc5('0x10')]:'id','clientSecret':config[_0x6dc5('0xb')]?config[_0x6dc5('0xb')][_0x6dc5('0x11')]:_0x6dc5('0x12'),'callbackURL':config[_0x6dc5('0xb')]?config[_0x6dc5('0xb')]['callbackURL']:''},function(_0x3f03df,_0x1bb6eb,_0xeba1f0,_0x116dde){var _0x1da8ab,_0x50296c;return db[_0x6dc5('0x13')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6dc5('0x14')],'raw':!![]})['then'](function(_0x3f037d){_0x1da8ab=_0x3f037d;return db['User']['find']({'where':{'email':_['map'](_0xeba1f0['emails'],_0x6dc5('0x15')),'role':{'$or':[_0x6dc5('0x16'),_0x6dc5('0x17'),_0x6dc5('0x18')]}}});})[_0x6dc5('0x19')](function(_0x38541f){_0x50296c=_0x38541f;if(_0x50296c){if(_0x50296c[_0x6dc5('0x1a')]){return _0x116dde(_0x6dc5('0x1b'));}else if(_0x1da8ab['blockDuration']>0x0){if(_0x50296c['blocked']){if(moment(_0x50296c[_0x6dc5('0x1c')])[_0x6dc5('0x1d')](_0x1da8ab[_0x6dc5('0x14')],_0x6dc5('0x1e'))>moment()){return _0x116dde(_0x6dc5('0x1b'));}else{return utils[_0x6dc5('0x1f')](_0x50296c,0x0,![],null)['then'](function(){return utils['getLicense'](_0x50296c);})[_0x6dc5('0x19')](function(){return _0x116dde(null,_0x50296c);});}}else{return utils['getLicense'](_0x50296c)[_0x6dc5('0x19')](function(){return _0x116dde(null,_0x50296c);});}}else{return utils[_0x6dc5('0x20')](_0x50296c)[_0x6dc5('0x19')](function(){return _0x116dde(null,_0x50296c);});}}return _0x116dde(_0x6dc5('0x1b'));})[_0x6dc5('0x21')](function(_0x1a4445){_0x116dde(_0x1a4445);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2b2b495..d4b3451 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 _0xc560=['/callback','callback','setTokenCookie','exports','express','Router','../user/user.controller.js','login','get'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0xc560,0x82));var _0x0c56=function(_0x56a0d3,_0x3f10bc){_0x56a0d3=_0x56a0d3-0x0;var _0x6ee6b3=_0xc560[_0x56a0d3];return _0x6ee6b3;};'use strict';var express=require(_0x0c56('0x0'));var passport=require('passport');var router=express[_0x0c56('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x0c56('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller[_0x0c56('0x3')]);router[_0x0c56('0x4')](_0x0c56('0x5'),controller[_0x0c56('0x6')],authService['isMiddleware'],userController[_0x0c56('0x3')],authService[_0x0c56('0x7')]);module[_0x0c56('0x8')]=router; \ No newline at end of file +var _0xc524=['../../components/auth/service','get','login','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc524,0x1bf));var _0x4c52=function(_0x192a56,_0x40ecfc){_0x192a56=_0x192a56-0x0;var _0x290e96=_0xc524[_0x192a56];return _0x290e96;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x4c52('0x0')]();var controller=require(_0x4c52('0x1'));var userController=require(_0x4c52('0x2'));var authService=require(_0x4c52('0x3'));router[_0x4c52('0x4')]('/',controller[_0x4c52('0x5')]);router[_0x4c52('0x4')]('/callback',controller['callback'],authService[_0x4c52('0x6')],userController[_0x4c52('0x5')],authService[_0x4c52('0x7')]);module[_0x4c52('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index aa093c0..604cb67 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 _0x2a07=['User','This\x20email\x20is\x20not\x20registered.','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2a07,0x74));var _0x72a0=function(_0xedea6a,_0x23fa84){_0xedea6a=_0xedea6a-0x0;var _0x3bc2f8=_0x2a07[_0xedea6a];return _0x3bc2f8;};'use strict';var util=require(_0x72a0('0x0'));var passport=require(_0x72a0('0x1'));var LocalStrategy=require(_0x72a0('0x2'))[_0x72a0('0x3')];var jayson=require(_0x72a0('0x4'));var _=require('lodash');var rs=require(_0x72a0('0x5'));var moment=require(_0x72a0('0x6'));var db=require(_0x72a0('0x7'))['db'];var authService=require(_0x72a0('0x8'));var utils=require(_0x72a0('0x9'));var client=jayson[_0x72a0('0xa')][_0x72a0('0xb')]({'port':0x232b});function localAuthenticate(_0x20dab9,_0x193e3b,_0x287b06,_0x21c819){var _0x2c04eb,_0x22270e;return db[_0x72a0('0xc')][_0x72a0('0xd')]({'where':{'id':0x1},'attributes':[_0x72a0('0xe'),'blockDuration'],'raw':!![]})[_0x72a0('0xf')](function(_0x1109f7){_0x2c04eb=_0x1109f7;return _0x20dab9['findOne']({'attributes':['id',_0x72a0('0x10'),_0x72a0('0x11'),_0x72a0('0x12'),_0x72a0('0x13'),_0x72a0('0x14'),'blocked',_0x72a0('0x15'),_0x72a0('0x16')],'where':{'name':_0x193e3b,'role':{'$or':[_0x72a0('0x17'),_0x72a0('0x18'),_0x72a0('0x19')]}}});})[_0x72a0('0xf')](function(_0xe73b5e){if(!_0xe73b5e||_0xe73b5e&&_0xe73b5e['name']!==_0x193e3b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x22270e=_0xe73b5e;return _0x22270e;}})[_0x72a0('0xf')](function(){_0x22270e[_0x72a0('0x1a')](_0x287b06,function(_0x19eaf9,_0x1d1133){var _0x23b001=_0x22270e[_0x72a0('0x16')]+0x1;if(_0x19eaf9){return _0x21c819(_0x19eaf9);}else if(!_0x1d1133){if(_0x22270e['disabled']){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else if(_0x2c04eb[_0x72a0('0xe')]>0x0){if(_0x22270e[_0x72a0('0x1c')]){if(_0x2c04eb[_0x72a0('0x1d')]>0x0){if(moment(_0x22270e[_0x72a0('0x15')])['add'](_0x2c04eb[_0x72a0('0x1d')],_0x72a0('0x1e'))>moment()){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else{return utils['clearBlockUser'](_0x22270e,_0x23b001,![],null)[_0x72a0('0xf')](function(){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});});}}else{return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}}else{if(_0x23b001>=_0x2c04eb[_0x72a0('0xe')]){return utils['clearBlockUser'](_0x22270e,0x0,!![],moment())[_0x72a0('0xf')](function(){return _0x21c819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x72a0('0x1f')](_0x22270e,_0x23b001,![],null)[_0x72a0('0xf')](function(){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});});}}}else{return _0x21c819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x22270e[_0x72a0('0x14')]){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else if(_0x2c04eb[_0x72a0('0xe')]>0x0){if(_0x22270e[_0x72a0('0x1c')]){if(_0x2c04eb['blockDuration']>0x0){if(moment(_0x22270e[_0x72a0('0x15')])[_0x72a0('0x20')](_0x2c04eb[_0x72a0('0x1d')],_0x72a0('0x1e'))>moment()){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else{return utils[_0x72a0('0x1f')](_0x22270e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x22270e);})[_0x72a0('0xf')](function(){return _0x21c819(null,_0x22270e);});}}else{return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}}else{return utils[_0x72a0('0x1f')](_0x22270e,0x0,![],null)[_0x72a0('0xf')](function(){return utils[_0x72a0('0x21')](_0x22270e);})[_0x72a0('0xf')](function(){return _0x21c819(null,_0x22270e);})[_0x72a0('0x22')](function(_0x15922a){return _0x21c819(null,![],_0x15922a);});}}else{if(_0x22270e[_0x72a0('0x1c')]){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else{return utils['getLicense'](_0x22270e)[_0x72a0('0xf')](function(){return _0x21c819(null,_0x22270e);});}}}});})[_0x72a0('0x22')](function(_0xc22d18){return _0x21c819(null,![],_0xc22d18);});}function sendServiceMail(_0x2928f6){return db[_0x72a0('0x23')][_0x72a0('0x24')]({'where':{'service':!![]},'attributes':['id',_0x72a0('0x10'),_0x72a0('0x25')],'include':[{'model':db[_0x72a0('0x26')],'as':_0x72a0('0x27')}]})['then'](function(_0x41efc1){if(!_0x41efc1){throw new Error(_0x72a0('0x28'));}var _0x39136d={'tls':{'rejectUnauthorized':![]}};if(_0x41efc1[_0x72a0('0x27')][_0x72a0('0x29')]){_0x39136d[_0x72a0('0x29')]=_0x41efc1[_0x72a0('0x27')]['service'];}else{_0x39136d[_0x72a0('0x2a')]=_0x41efc1[_0x72a0('0x27')][_0x72a0('0x2a')];_0x39136d[_0x72a0('0x2b')]=_0x41efc1[_0x72a0('0x27')][_0x72a0('0x2b')];_0x39136d[_0x72a0('0x2c')]=_0x41efc1[_0x72a0('0x27')]['secure'];}if(_0x41efc1[_0x72a0('0x27')][_0x72a0('0x2d')]){_0x39136d[_0x72a0('0x2e')]={'user':_0x41efc1['Smtp'][_0x72a0('0x18')],'pass':_0x41efc1['Smtp'][_0x72a0('0x2f')]};}var _0x277d8f={'account':_0x39136d,'message':_[_0x72a0('0x30')]({'from':util[_0x72a0('0x31')](_0x72a0('0x32'),_0x41efc1[_0x72a0('0x10')],_0x41efc1[_0x72a0('0x25')]||_0x41efc1[_0x72a0('0x27')][_0x72a0('0x18')])},_0x2928f6)};return client[_0x72a0('0x33')](_0x72a0('0x34'),_0x277d8f);})[_0x72a0('0xf')](function(_0x5b6326){if(_0x5b6326[_0x72a0('0x35')]){throw new Error(util['format'](_0x72a0('0x36'),_0x5b6326[_0x72a0('0x35')][_0x72a0('0x37')]||JSON[_0x72a0('0x38')](_0x5b6326[_0x72a0('0x35')])));}return!![];});}function handleError(_0x17dcd8,_0x90b437,_0x3c9b74){return _0x17dcd8[_0x72a0('0x39')](_0x90b437||0x1f4)['send']({'message':_0x3c9b74?_0x3c9b74['message']||_0x3c9b74:''});}exports[_0x72a0('0x3a')]=function(_0x1d9403,_0x332051,_0x2f8f42){passport[_0x72a0('0x1a')]('local',function(_0x3bdd4e,_0x3f1fa9,_0x582c90){var _0x21ad08=_0x3bdd4e||_0x582c90;if(_0x21ad08){return handleError(_0x332051,0x191,_0x21ad08);}if(!_0x3f1fa9){return handleError(_0x332051,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x582c84={'payload':{'id':_0x3f1fa9['id'],'role':_0x3f1fa9['role']},'options':{'expiresIn':0x15180}};return authService[_0x72a0('0x3b')](_0x582c84)['then'](function(_0x44b47b){_0x332051[_0x72a0('0x3c')]({'id':_0x3f1fa9['id'],'token':_0x44b47b,'statusCall':'','isAlreadyLogged':_0x3f1fa9[_0x72a0('0x3d')]});});}})(_0x1d9403,_0x332051,_0x2f8f42);};exports[_0x72a0('0x3e')]=function(_0x4bf56e,_0x5602cc,_0x4bb006){if(!_0x4bf56e['body'][_0x72a0('0x25')]){return handleError(_0x5602cc,0x1f4,{'message':_0x72a0('0x3f')});}var _0x4a7032=rs[_0x72a0('0x40')]();_0x4bf56e[_0x72a0('0x41')]['email']=_0x4bf56e[_0x72a0('0x41')][_0x72a0('0x25')][_0x72a0('0x42')]()[_0x72a0('0x43')]();var _0x340153;return db[_0x72a0('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x72a0('0xe'),'blockDuration'],'raw':!![]})[_0x72a0('0xf')](function(_0x4ac6dd){_0x340153=_0x4ac6dd;return db[_0x72a0('0x44')][_0x72a0('0x24')]({'where':{'email':_0x4bf56e['body'][_0x72a0('0x25')]}});})['then'](function(_0x443b3e){if(!_0x443b3e){throw new Error(_0x72a0('0x45'));}if(_0x443b3e[_0x72a0('0x14')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x443b3e[_0x72a0('0x1c')]){if(moment(_0x443b3e[_0x72a0('0x15')])[_0x72a0('0x20')](_0x340153['blockDuration'],'minutes')>moment()){throw new Error(_0x72a0('0x46'));}else{_0x443b3e['blocked']=![];_0x443b3e[_0x72a0('0x15')]=null;}}_0x443b3e[_0x72a0('0x47')]=_0x4a7032;_0x443b3e[_0x72a0('0x48')]=Date[_0x72a0('0x49')]()+0x36ee80;return _0x443b3e[_0x72a0('0x4a')]();})[_0x72a0('0xf')](function(){return sendServiceMail({'to':_0x4bf56e[_0x72a0('0x41')][_0x72a0('0x25')],'subject':_0x72a0('0x4b'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x72a0('0x4c')+_0x72a0('0x4d')+_0x4bf56e[_0x72a0('0x4e')][_0x72a0('0x2a')]+_0x72a0('0x4f')+_0x4a7032+'\x0a\x0a'+_0x72a0('0x50')});})[_0x72a0('0xf')](function(){_0x5602cc['status'](0xc8)['send']({'message':_0x72a0('0x51')});})[_0x72a0('0x22')](function(_0xe38fb3){return handleError(_0x5602cc,0x1f4,_0xe38fb3);});};exports[_0x72a0('0x52')]=function(_0x35a6ad,_0x4640f6,_0x43de45){return db[_0x72a0('0x44')][_0x72a0('0x24')]({'where':{'resetPasswordToken':_0x35a6ad[_0x72a0('0x53')]['token'],'resetPasswordExpires':{'$gt':Date[_0x72a0('0x49')]()}}})[_0x72a0('0xf')](function(_0x480d49){if(!_0x480d49){throw new Error(_0x72a0('0x54'));}return db[_0x72a0('0xc')]['findOne']({'attributes':['id',_0x72a0('0x55'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x72a0('0xf')](function(_0x27123c){if(_0x27123c[_0x72a0('0x55')])authService[_0x72a0('0x56')](_0x35a6ad[_0x72a0('0x41')]['password']);if(!_0x27123c[_0x72a0('0x57')]||!_0x480d49[_0x72a0('0x58')])return _0x480d49;authService['validatePasswordHistory'](_0x35a6ad['body'][_0x72a0('0x11')],_0x480d49[_0x72a0('0x58')],_0x27123c[_0x72a0('0x59')]);return _0x480d49;})[_0x72a0('0xf')](function(){_0x480d49[_0x72a0('0x11')]=_0x35a6ad[_0x72a0('0x41')][_0x72a0('0x11')];_0x480d49[_0x72a0('0x47')]=null;_0x480d49['resetPasswordExpires']=null;return _0x480d49[_0x72a0('0x4a')]();});})['then'](function(){_0x4640f6['status'](0xc8)['send']({'message':_0x72a0('0x5a')});})[_0x72a0('0x22')](function(_0x583434){return handleError(_0x4640f6,0x1f4,_0x583434);});};passport[_0x72a0('0x5b')](new LocalStrategy({'usernameField':'name','passwordField':_0x72a0('0x11')},function(_0x5a0ec6,_0x51335e,_0x4184f5){return localAuthenticate(db[_0x72a0('0x44')],_0x5a0ec6,_0x51335e,_0x4184f5);})); \ No newline at end of file +var _0x4c60=['role','signToken','online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','status','Reset\x20Email\x20sent!','reset','token','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','password','salt','disabled','blocked','blockedAt','loginAttempts','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x1d3b70,_0x5480f9){var _0x4025ef=function(_0x45fd85){while(--_0x45fd85){_0x1d3b70['push'](_0x1d3b70['shift']());}};_0x4025ef(++_0x5480f9);}(_0x4c60,0xc1));var _0x04c6=function(_0x489a0f,_0x41f4bd){_0x489a0f=_0x489a0f-0x0;var _0x487f36=_0x4c60[_0x489a0f];return _0x487f36;};'use strict';var util=require(_0x04c6('0x0'));var passport=require(_0x04c6('0x1'));var LocalStrategy=require(_0x04c6('0x2'))[_0x04c6('0x3')];var jayson=require('jayson/promise');var _=require(_0x04c6('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x04c6('0x5'));var client=jayson[_0x04c6('0x6')][_0x04c6('0x7')]({'port':0x232b});function localAuthenticate(_0x12bd5d,_0x2b9041,_0x39be2d,_0x8f9b13){var _0x530a48,_0x2a4b51;return db[_0x04c6('0x8')][_0x04c6('0x9')]({'where':{'id':0x1},'attributes':[_0x04c6('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x5498a9){_0x530a48=_0x5498a9;return _0x12bd5d[_0x04c6('0x9')]({'attributes':['id','name',_0x04c6('0xb'),_0x04c6('0xc'),'role',_0x04c6('0xd'),_0x04c6('0xe'),_0x04c6('0xf'),_0x04c6('0x10')],'where':{'name':_0x2b9041,'role':{'$or':['admin',_0x04c6('0x11'),_0x04c6('0x12')]}}});})[_0x04c6('0x13')](function(_0x56422a){if(!_0x56422a||_0x56422a&&_0x56422a[_0x04c6('0x14')]!==_0x2b9041){throw new Error(_0x04c6('0x15'));}else{_0x2a4b51=_0x56422a;return _0x2a4b51;}})[_0x04c6('0x13')](function(){_0x2a4b51[_0x04c6('0x16')](_0x39be2d,function(_0x4760f8,_0x19a26f){var _0x1cd963=_0x2a4b51[_0x04c6('0x10')]+0x1;if(_0x4760f8){return _0x8f9b13(_0x4760f8);}else if(!_0x19a26f){if(_0x2a4b51['disabled']){return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});}else if(_0x530a48[_0x04c6('0xa')]>0x0){if(_0x2a4b51[_0x04c6('0xe')]){if(_0x530a48[_0x04c6('0x17')]>0x0){if(moment(_0x2a4b51[_0x04c6('0xf')])[_0x04c6('0x18')](_0x530a48[_0x04c6('0x17')],_0x04c6('0x19'))>moment()){return _0x8f9b13(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x04c6('0x1a')](_0x2a4b51,_0x1cd963,![],null)[_0x04c6('0x13')](function(){return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});});}}else{return _0x8f9b13(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1cd963>=_0x530a48['allowedLoginAttempts']){return utils['clearBlockUser'](_0x2a4b51,0x0,!![],moment())[_0x04c6('0x13')](function(){return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});});}else{return utils['clearBlockUser'](_0x2a4b51,_0x1cd963,![],null)['then'](function(){return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});});}}}else{return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});}}else{if(_0x2a4b51[_0x04c6('0xd')]){return _0x8f9b13(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x530a48[_0x04c6('0xa')]>0x0){if(_0x2a4b51[_0x04c6('0xe')]){if(_0x530a48[_0x04c6('0x17')]>0x0){if(moment(_0x2a4b51['blockedAt'])[_0x04c6('0x18')](_0x530a48[_0x04c6('0x17')],'minutes')>moment()){return _0x8f9b13(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2a4b51,0x0,![],null)[_0x04c6('0x13')](function(){return utils[_0x04c6('0x1b')](_0x2a4b51);})[_0x04c6('0x13')](function(){return _0x8f9b13(null,_0x2a4b51);});}}else{return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});}}else{return utils[_0x04c6('0x1a')](_0x2a4b51,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2a4b51);})[_0x04c6('0x13')](function(){return _0x8f9b13(null,_0x2a4b51);})[_0x04c6('0x1c')](function(_0x9acfa){return _0x8f9b13(null,![],_0x9acfa);});}}else{if(_0x2a4b51[_0x04c6('0xe')]){return _0x8f9b13(null,![],{'message':_0x04c6('0x15')});}else{return utils[_0x04c6('0x1b')](_0x2a4b51)['then'](function(){return _0x8f9b13(null,_0x2a4b51);});}}}});})[_0x04c6('0x1c')](function(_0x165cb5){return _0x8f9b13(null,![],_0x165cb5);});}function sendServiceMail(_0x4e00fe){return db[_0x04c6('0x1d')][_0x04c6('0x1e')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x04c6('0x1f')],'as':_0x04c6('0x20')}]})[_0x04c6('0x13')](function(_0xbb9e81){if(!_0xbb9e81){throw new Error(_0x04c6('0x21'));}var _0x43884e={'tls':{'rejectUnauthorized':![]}};if(_0xbb9e81['Smtp']['service']){_0x43884e['service']=_0xbb9e81[_0x04c6('0x20')]['service'];}else{_0x43884e[_0x04c6('0x22')]=_0xbb9e81[_0x04c6('0x20')]['host'];_0x43884e[_0x04c6('0x23')]=_0xbb9e81[_0x04c6('0x20')][_0x04c6('0x23')];_0x43884e[_0x04c6('0x24')]=_0xbb9e81['Smtp'][_0x04c6('0x24')];}if(_0xbb9e81[_0x04c6('0x20')][_0x04c6('0x25')]){_0x43884e[_0x04c6('0x26')]={'user':_0xbb9e81[_0x04c6('0x20')][_0x04c6('0x11')],'pass':_0xbb9e81[_0x04c6('0x20')][_0x04c6('0x27')]};}var _0x19a05b={'account':_0x43884e,'message':_[_0x04c6('0x28')]({'from':util[_0x04c6('0x29')](_0x04c6('0x2a'),_0xbb9e81[_0x04c6('0x14')],_0xbb9e81[_0x04c6('0x2b')]||_0xbb9e81[_0x04c6('0x20')]['user'])},_0x4e00fe)};return client[_0x04c6('0x2c')](_0x04c6('0x2d'),_0x19a05b);})[_0x04c6('0x13')](function(_0x206e32){if(_0x206e32['error']){throw new Error(util[_0x04c6('0x29')](_0x04c6('0x2e'),_0x206e32['error']['message']||JSON['stringify'](_0x206e32[_0x04c6('0x2f')])));}return!![];});}function handleError(_0x2382ff,_0x4f9a6c,_0x3fbdd0){return _0x2382ff['status'](_0x4f9a6c||0x1f4)[_0x04c6('0x30')]({'message':_0x3fbdd0?_0x3fbdd0[_0x04c6('0x31')]||_0x3fbdd0:''});}exports[_0x04c6('0x32')]=function(_0x2b28cd,_0x5144f5,_0x57ce4b){passport[_0x04c6('0x16')](_0x04c6('0x33'),function(_0x50041f,_0x3f4fad,_0x5ce4b0){var _0x501d7d=_0x50041f||_0x5ce4b0;if(_0x501d7d){return handleError(_0x5144f5,0x191,_0x501d7d);}if(!_0x3f4fad){return handleError(_0x5144f5,0x194,{'message':_0x04c6('0x34')});}else{var _0x5aede6={'payload':{'id':_0x3f4fad['id'],'role':_0x3f4fad[_0x04c6('0x35')]},'options':{'expiresIn':0x15180}};return authService[_0x04c6('0x36')](_0x5aede6)['then'](function(_0x69e2b6){_0x5144f5['json']({'id':_0x3f4fad['id'],'token':_0x69e2b6,'statusCall':'','isAlreadyLogged':_0x3f4fad[_0x04c6('0x37')]});});}})(_0x2b28cd,_0x5144f5,_0x57ce4b);};exports[_0x04c6('0x38')]=function(_0x2d83eb,_0x120238,_0x679718){if(!_0x2d83eb['body'][_0x04c6('0x2b')]){return handleError(_0x120238,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x74f1d1=rs['generate']();_0x2d83eb[_0x04c6('0x39')][_0x04c6('0x2b')]=_0x2d83eb[_0x04c6('0x39')][_0x04c6('0x2b')][_0x04c6('0x3a')]()[_0x04c6('0x3b')]();var _0x40477f;return db['Setting'][_0x04c6('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x04c6('0x17')],'raw':!![]})['then'](function(_0x59be20){_0x40477f=_0x59be20;return db[_0x04c6('0x3c')]['find']({'where':{'email':_0x2d83eb[_0x04c6('0x39')][_0x04c6('0x2b')]}});})[_0x04c6('0x13')](function(_0x599682){if(!_0x599682){throw new Error(_0x04c6('0x3d'));}if(_0x599682[_0x04c6('0xd')]){throw new Error(_0x04c6('0x3e'));}if(_0x599682[_0x04c6('0xe')]){if(moment(_0x599682[_0x04c6('0xf')])[_0x04c6('0x18')](_0x40477f[_0x04c6('0x17')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x599682[_0x04c6('0xe')]=![];_0x599682[_0x04c6('0xf')]=null;}}_0x599682[_0x04c6('0x3f')]=_0x74f1d1;_0x599682['resetPasswordExpires']=Date[_0x04c6('0x40')]()+0x36ee80;return _0x599682[_0x04c6('0x41')]();})[_0x04c6('0x13')](function(){return sendServiceMail({'to':_0x2d83eb['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x04c6('0x42')+_0x04c6('0x43')+'https://'+_0x2d83eb[_0x04c6('0x44')][_0x04c6('0x22')]+_0x04c6('0x45')+_0x74f1d1+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x04c6('0x13')](function(){_0x120238[_0x04c6('0x46')](0xc8)['send']({'message':_0x04c6('0x47')});})[_0x04c6('0x1c')](function(_0x2472ed){return handleError(_0x120238,0x1f4,_0x2472ed);});};exports[_0x04c6('0x48')]=function(_0x4cfde2,_0x46f0ac,_0x461549){return db[_0x04c6('0x3c')][_0x04c6('0x1e')]({'where':{'resetPasswordToken':_0x4cfde2['params'][_0x04c6('0x49')],'resetPasswordExpires':{'$gt':Date[_0x04c6('0x40')]()}}})[_0x04c6('0x13')](function(_0x168933){if(!_0x168933){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x04c6('0x8')][_0x04c6('0x9')]({'attributes':['id',_0x04c6('0x4a'),'enforcePasswordHistory',_0x04c6('0x4b')]})[_0x04c6('0x13')](function(_0x2a342c){if(_0x2a342c[_0x04c6('0x4a')])authService[_0x04c6('0x4c')](_0x4cfde2[_0x04c6('0x39')][_0x04c6('0xb')]);if(!_0x2a342c[_0x04c6('0x4d')]||!_0x168933[_0x04c6('0x4e')])return _0x168933;authService[_0x04c6('0x4f')](_0x4cfde2[_0x04c6('0x39')][_0x04c6('0xb')],_0x168933[_0x04c6('0x4e')],_0x2a342c['passwordHistoryLimit']);return _0x168933;})[_0x04c6('0x13')](function(){_0x168933[_0x04c6('0xb')]=_0x4cfde2[_0x04c6('0x39')][_0x04c6('0xb')];_0x168933[_0x04c6('0x3f')]=null;_0x168933['resetPasswordExpires']=null;return _0x168933[_0x04c6('0x41')]();});})[_0x04c6('0x13')](function(){_0x46f0ac[_0x04c6('0x46')](0xc8)[_0x04c6('0x30')]({'message':_0x04c6('0x50')});})[_0x04c6('0x1c')](function(_0x111364){return handleError(_0x46f0ac,0x1f4,_0x111364);});};passport[_0x04c6('0x51')](new LocalStrategy({'usernameField':_0x04c6('0x14'),'passwordField':_0x04c6('0xb')},function(_0x48d2cb,_0x594c06,_0x570fcf){return localAuthenticate(db['User'],_0x48d2cb,_0x594c06,_0x570fcf);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e7a4043..be65c53 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 _0x070c=['login','/forgot','forgot','exports','express','post'];(function(_0x247ffb,_0x4f5bcd){var _0xafc7af=function(_0x1e4335){while(--_0x1e4335){_0x247ffb['push'](_0x247ffb['shift']());}};_0xafc7af(++_0x4f5bcd);}(_0x070c,0x1ea));var _0xc070=function(_0xfd663c,_0x1b5afd){_0xfd663c=_0xfd663c-0x0;var _0x5034a2=_0x070c[_0xfd663c];return _0x5034a2;};'use strict';var express=require(_0xc070('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0xc070('0x1')]('/',controller[_0xc070('0x2')]);router[_0xc070('0x1')](_0xc070('0x3'),controller[_0xc070('0x4')]);router[_0xc070('0x1')]('/reset/:token',controller['reset']);module[_0xc070('0x5')]=router; \ No newline at end of file +var _0x577c=['post','/forgot','forgot','/reset/:token','exports','express','./authLocal.controller','login'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x577c,0xe5));var _0xc577=function(_0x44b40c,_0x3cc2ac){_0x44b40c=_0x44b40c-0x0;var _0x49e38f=_0x577c[_0x44b40c];return _0x49e38f;};'use strict';var express=require(_0xc577('0x0'));var router=express['Router']();var controller=require(_0xc577('0x1'));router['post']('/',controller[_0xc577('0x2')]);router[_0xc577('0x3')](_0xc577('0x4'),controller[_0xc577('0x5')]);router[_0xc577('0x3')](_0xc577('0x6'),controller['reset']);module[_0xc577('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index de2a7a5..912e370 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 _0xb2a8=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x339438,_0x2d9b62){var _0x4a8081=function(_0x5bfeef){while(--_0x5bfeef){_0x339438['push'](_0x339438['shift']());}};_0x4a8081(++_0x2d9b62);}(_0xb2a8,0xd2));var _0x8b2a=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0xb2a8[_0x2e914];return _0x936e45;};'use strict';var Sequelize=require('sequelize');module[_0x8b2a('0x0')]={'name':{'type':Sequelize[_0x8b2a('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x8b2a('0x1')]},'description':{'type':Sequelize[_0x8b2a('0x1')]},'status':{'type':Sequelize[_0x8b2a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8b2a('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xfad9=['STRING','INTEGER','sequelize','exports'];(function(_0x40f291,_0x121b5a){var _0x397e98=function(_0x10e881){while(--_0x10e881){_0x40f291['push'](_0x40f291['shift']());}};_0x397e98(++_0x121b5a);}(_0xfad9,0x1be));var _0x9fad=function(_0x5650b4,_0x2723ba){_0x5650b4=_0x5650b4-0x0;var _0x297a62=_0xfad9[_0x5650b4];return _0x297a62;};'use strict';var Sequelize=require(_0x9fad('0x0'));module[_0x9fad('0x1')]={'name':{'type':Sequelize[_0x9fad('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x9fad('0x2')]},'description':{'type':Sequelize[_0x9fad('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9fad('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 65b9fab..d3add2d 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 _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x4417a6,_0x2e9b9b){var _0x49ccb1=function(_0x557e83){while(--_0x557e83){_0x4417a6['push'](_0x4417a6['shift']());}};_0x49ccb1(++_0x2e9b9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x1a0707,_0x12b4a7){var _0x2256d5=function(_0x810464){while(--_0x810464){_0x1a0707['push'](_0x1a0707['shift']());}};_0x2256d5(++_0x12b4a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 57adcdb..1cfaea0 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 _0x345e=['bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','api','moment'];(function(_0x39c8f2,_0x23df6c){var _0x445526=function(_0x56376c){while(--_0x56376c){_0x39c8f2['push'](_0x39c8f2['shift']());}};_0x445526(++_0x23df6c);}(_0x345e,0x168));var _0xe345=function(_0x18a794,_0x335c63){_0x18a794=_0x18a794-0x0;var _0x4fadaa=_0x345e[_0x18a794];return _0x4fadaa;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var logger=require('../../config/logger')(_0xe345('0x2'));var moment=require(_0xe345('0x3'));var BPromise=require(_0xe345('0x4'));var rp=require(_0xe345('0x5'));var fs=require('fs');var path=require(_0xe345('0x6'));var rimraf=require(_0xe345('0x7'));var config=require(_0xe345('0x8'));var attributes=require(_0xe345('0x9'));module[_0xe345('0xa')]=function(_0x575c38,_0x4491a9){return _0x575c38[_0xe345('0xb')](_0xe345('0xc'),attributes,{'tableName':_0xe345('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebea=['Automation','tools_automations','api','moment','path','rimraf','./automation.attributes','exports','define'];(function(_0x40faed,_0x3db178){var _0x7cae3b=function(_0x93c321){while(--_0x93c321){_0x40faed['push'](_0x40faed['shift']());}};_0x7cae3b(++_0x3db178);}(_0xebea,0xec));var _0xaebe=function(_0x468e79,_0xf4906f){_0x468e79=_0x468e79-0x0;var _0x3f0fdb=_0xebea[_0x468e79];return _0x3f0fdb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaebe('0x0'));var moment=require(_0xaebe('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaebe('0x2'));var rimraf=require(_0xaebe('0x3'));var config=require('../../config/environment');var attributes=require(_0xaebe('0x4'));module[_0xaebe('0x5')]=function(_0x1050a1,_0x59aba5){return _0x1050a1[_0xaebe('0x6')](_0xaebe('0x7'),attributes,{'tableName':_0xaebe('0x8'),'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 0ae6e3b..c37968c 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 _0x1e82=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1e82,0x192));var _0x21e8=function(_0x181e60,_0x3aa295){_0x181e60=_0x181e60-0x0;var _0x464d45=_0x1e82[_0x181e60];return _0x464d45;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var moment=require(_0x21e8('0x2'));var BPromise=require(_0x21e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21e8('0x4'))['db'];var utils=require(_0x21e8('0x5'));var logger=require(_0x21e8('0x6'))(_0x21e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x21e8('0x8'));var client=jayson[_0x21e8('0x9')][_0x21e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x120cf5,_0x118e7a,_0x5836e8){return new BPromise(function(_0x2ff934,_0x5072a6){return client[_0x21e8('0xb')](_0x120cf5,_0x5836e8)['then'](function(_0x44e8c7){logger['info'](_0x21e8('0xc'),_0x118e7a,_0x21e8('0xd'));logger[_0x21e8('0xe')](_0x21e8('0xf'),_0x118e7a,_0x21e8('0xd'),JSON[_0x21e8('0x10')](_0x44e8c7));if(_0x44e8c7[_0x21e8('0x11')]){if(_0x44e8c7[_0x21e8('0x11')][_0x21e8('0x12')]===0x1f4){logger['error'](_0x21e8('0xc'),_0x118e7a,_0x44e8c7[_0x21e8('0x11')][_0x21e8('0x13')]);return _0x5072a6(_0x44e8c7[_0x21e8('0x11')]['message']);}logger[_0x21e8('0x11')](_0x21e8('0xc'),_0x118e7a,_0x44e8c7[_0x21e8('0x11')][_0x21e8('0x13')]);return _0x2ff934(_0x44e8c7[_0x21e8('0x11')][_0x21e8('0x13')]);}else{logger[_0x21e8('0x14')](_0x21e8('0xc'),_0x118e7a,_0x21e8('0xd'));_0x2ff934(_0x44e8c7[_0x21e8('0x15')][_0x21e8('0x13')]);}})[_0x21e8('0x16')](function(_0x3b2dc3){logger['error'](_0x21e8('0xc'),_0x118e7a,_0x3b2dc3);_0x5072a6(_0x3b2dc3);});});} \ No newline at end of file +var _0x830f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','Automation,\x20%s,\x20%s','result','lodash','util','moment','bluebird'];(function(_0x44db68,_0x26fbd3){var _0x5165a9=function(_0x5decec){while(--_0x5decec){_0x44db68['push'](_0x44db68['shift']());}};_0x5165a9(++_0x26fbd3);}(_0x830f,0x1a0));var _0xf830=function(_0x16e70a,_0x5c5ce2){_0x16e70a=_0x16e70a-0x0;var _0x40a628=_0x830f[_0x16e70a];return _0x40a628;};'use strict';var _=require(_0xf830('0x0'));var util=require(_0xf830('0x1'));var moment=require(_0xf830('0x2'));var BPromise=require(_0xf830('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf830('0x4'))(_0xf830('0x5'));var config=require(_0xf830('0x6'));var jayson=require(_0xf830('0x7'));var client=jayson[_0xf830('0x8')][_0xf830('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1288f6,_0xdc31db,_0x17a6e0){return new BPromise(function(_0x114fc1,_0x74d164){return client[_0xf830('0xa')](_0x1288f6,_0x17a6e0)[_0xf830('0xb')](function(_0x5b8516){logger[_0xf830('0xc')]('Automation,\x20%s,\x20%s',_0xdc31db,_0xf830('0xd'));logger[_0xf830('0xe')](_0xf830('0xf'),_0xdc31db,_0xf830('0xd'),JSON['stringify'](_0x5b8516));if(_0x5b8516[_0xf830('0x10')]){if(_0x5b8516[_0xf830('0x10')][_0xf830('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xdc31db,_0x5b8516['error'][_0xf830('0x12')]);return _0x74d164(_0x5b8516[_0xf830('0x10')][_0xf830('0x12')]);}logger[_0xf830('0x10')](_0xf830('0x13'),_0xdc31db,_0x5b8516[_0xf830('0x10')][_0xf830('0x12')]);return _0x114fc1(_0x5b8516[_0xf830('0x10')][_0xf830('0x12')]);}else{logger[_0xf830('0xc')]('Automation,\x20%s,\x20%s',_0xdc31db,_0xf830('0xd'));_0x114fc1(_0x5b8516[_0xf830('0x14')][_0xf830('0x12')]);}})['catch'](function(_0x83f112){logger[_0xf830('0x10')](_0xf830('0x13'),_0xdc31db,_0x83f112);_0x74d164(_0x83f112);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ddf060f..b753905 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 _0xe695=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','/:id','show','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','update','destroy','exports','multer','express','Router'];(function(_0x9119f3,_0x5364d3){var _0x336cc3=function(_0x3c8cd6){while(--_0x3c8cd6){_0x9119f3['push'](_0x9119f3['shift']());}};_0x336cc3(++_0x5364d3);}(_0xe695,0x1cb));var _0x5e69=function(_0x157c44,_0xdd2d72){_0x157c44=_0x157c44-0x0;var _0x3a6323=_0xe695[_0x157c44];return _0x3a6323;};'use strict';var multer=require(_0x5e69('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5e69('0x1'));var router=express[_0x5e69('0x2')]();var auth=require(_0x5e69('0x3'));var interaction=require(_0x5e69('0x4'));var config=require(_0x5e69('0x5'));var controller=require(_0x5e69('0x6'));router['get']('/',auth[_0x5e69('0x7')](),controller['index']);router['get'](_0x5e69('0x8'),auth[_0x5e69('0x7')](),controller[_0x5e69('0x9')]);router[_0x5e69('0xa')](_0x5e69('0xb'),auth['isAuthenticated'](),controller[_0x5e69('0xc')]);router[_0x5e69('0xa')](_0x5e69('0xd'),auth[_0x5e69('0x7')](),controller[_0x5e69('0xe')]);router[_0x5e69('0xf')]('/',auth[_0x5e69('0x7')](),controller[_0x5e69('0x10')]);router[_0x5e69('0xf')]('/:id/conditions',auth[_0x5e69('0x7')](),controller[_0x5e69('0x11')]);router[_0x5e69('0xf')](_0x5e69('0xd'),auth['isAuthenticated'](),controller['addActions']);router[_0x5e69('0x12')]('/:id',auth[_0x5e69('0x7')](),controller[_0x5e69('0x13')]);router['delete'](_0x5e69('0x8'),auth[_0x5e69('0x7')](),controller[_0x5e69('0x14')]);module[_0x5e69('0x15')]=router; \ No newline at end of file +var _0xda2d=['create','addActions','put','update','delete','exports','util','path','connect-timeout','express','Router','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post'];(function(_0x4f582d,_0x401096){var _0xac2050=function(_0xfc7c62){while(--_0xfc7c62){_0x4f582d['push'](_0x4f582d['shift']());}};_0xac2050(++_0x401096);}(_0xda2d,0x102));var _0xdda2=function(_0x5c05ef,_0x2bac41){_0x5c05ef=_0x5c05ef-0x0;var _0x1692f6=_0xda2d[_0x5c05ef];return _0x1692f6;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda2('0x5'));router[_0xdda2('0x6')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0x8')]);router[_0xdda2('0x6')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0xa')]);router[_0xdda2('0x6')](_0xdda2('0xb'),auth['isAuthenticated'](),controller[_0xdda2('0xc')]);router[_0xdda2('0x6')]('/:id/actions',auth[_0xdda2('0x7')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0xf')]);router[_0xdda2('0xe')](_0xdda2('0xb'),auth[_0xdda2('0x7')](),controller['addConditions']);router['post']('/:id/actions',auth[_0xdda2('0x7')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0x12')]);router[_0xdda2('0x13')]('/:id',auth[_0xdda2('0x7')](),controller['destroy']);module[_0xdda2('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 1fe6404..d13bfa2 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 _0xace7=['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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0xb65f0c,_0xe60c57){var _0x2ff246=function(_0x7d191c){while(--_0x7d191c){_0xb65f0c['push'](_0xb65f0c['shift']());}};_0x2ff246(++_0xe60c57);}(_0xace7,0x11b));var _0x7ace=function(_0x5b7606,_0x3367ef){_0x5b7606=_0x5b7606-0x0;var _0x186584=_0xace7[_0x5b7606];return _0x186584;};'use strict';var Sequelize=require(_0x7ace('0x0'));module[_0x7ace('0x1')]={'name':{'type':Sequelize[_0x7ace('0x2')],'unique':_0x7ace('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7ace('0x4')),'allowNull':![],'defaultValue':_0x7ace('0x4')},'description':{'type':Sequelize[_0x7ace('0x2')]},'active':{'type':Sequelize[_0x7ace('0x5')],'defaultValue':0x0,'comment':_0x7ace('0x6')},'limitCalls':{'type':Sequelize[_0x7ace('0x7')](0x4)[_0x7ace('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7ace('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7ace('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7ace('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7ace('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ace('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7ace('0x7')](0x5)[_0x7ace('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7ace('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'comment':_0x7ace('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7ace('0x7')](0x5)[_0x7ace('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x7ace('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x7ace('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x7ace('0x10')](_0x7ace('0x11'),_0x7ace('0x12'),_0x7ace('0x13')),'defaultValue':_0x7ace('0x11')},'dialAMDActive':{'type':Sequelize[_0x7ace('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7ace('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x7ace('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7ace('0x7')](0x9)[_0x7ace('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7ace('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7ace('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7ace('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x7ace('0x7')](0x9)[_0x7ace('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7ace('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7ace('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7ace('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7ace('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x7ace('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7ace('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7ace('0x7')](0x9)[_0x7ace('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7ace('0x10')]('DESC','ASC'),'defaultValue':_0x7ace('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7ace('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7ace('0x1c')},'dialCutDigit':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7ace('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ace('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7ace('0x7')](0x5)[_0x7ace('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ace('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7ace('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ace('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7ace('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7ace('0x7')](0x3)[_0x7ace('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7ace('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7ace('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7ace('0x26')}}; \ No newline at end of file +var _0xa4fc=['STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\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','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports'];(function(_0x3cb286,_0x325eac){var _0x3989b5=function(_0x56b66c){while(--_0x56b66c){_0x3cb286['push'](_0x3cb286['shift']());}};_0x3989b5(++_0x325eac);}(_0xa4fc,0x1c6));var _0xca4f=function(_0xe85e0e,_0x32fe9b){_0xe85e0e=_0xe85e0e-0x0;var _0x3fa88e=_0xa4fc[_0xe85e0e];return _0x3fa88e;};'use strict';var Sequelize=require(_0xca4f('0x0'));module[_0xca4f('0x1')]={'name':{'type':Sequelize[_0xca4f('0x2')],'unique':_0xca4f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xca4f('0x4')](_0xca4f('0x5')),'allowNull':![],'defaultValue':_0xca4f('0x5')},'description':{'type':Sequelize[_0xca4f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xca4f('0x6')},'limitCalls':{'type':Sequelize[_0xca4f('0x7')](0x4)[_0xca4f('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xca4f('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xca4f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xca4f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xca4f('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca4f('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca4f('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xca4f('0x7')](0x5)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca4f('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)[_0xca4f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca4f('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xca4f('0x7')](0x5)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)[_0xca4f('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xca4f('0x7')](0x5)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca4f('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xca4f('0xf')},'dialTimezone':{'type':Sequelize[_0xca4f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xca4f('0x2')],'defaultValue':_0xca4f('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xca4f('0x4')](_0xca4f('0x11'),_0xca4f('0x12'),_0xca4f('0x13')),'defaultValue':_0xca4f('0x11')},'dialAMDActive':{'type':Sequelize[_0xca4f('0x14')],'defaultValue':0x0,'comment':_0xca4f('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xca4f('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xca4f('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xca4f('0x7')](0x9)[_0xca4f('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xca4f('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xca4f('0x7')](0x9)[_0xca4f('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xca4f('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xca4f('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xca4f('0x7')](0x9)[_0xca4f('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xca4f('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xca4f('0x7')](0x9)[_0xca4f('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xca4f('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xca4f('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xca4f('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xca4f('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xca4f('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xca4f('0x4')](_0xca4f('0x1d'),_0xca4f('0x1e')),'defaultValue':_0xca4f('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xca4f('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xca4f('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xca4f('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca4f('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xca4f('0x7')](0x5)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca4f('0x21')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xca4f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xca4f('0x7')](0x5)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca4f('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca4f('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xca4f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)[_0xca4f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xca4f('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xca4f('0x7')](0x3)[_0xca4f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xca4f('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xca4f('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 645ec93..ec9f116 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 _0x5a2a=['addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','error','clone','omit','createdAt','updatedAt','includeAll','IvrCampaigns','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList'];(function(_0x26c8cf,_0x3c07a6){var _0x587fe0=function(_0x1dde6a){while(--_0x1dde6a){_0x26c8cf['push'](_0x26c8cf['shift']());}};_0x587fe0(++_0x3c07a6);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x4d6934,_0x4fef26){_0x4d6934=_0x4d6934-0x0;var _0x17d504=_0x5a2a[_0x4d6934];return _0x17d504;};'use strict';var pdf=require(_0xa5a2('0x0'));var emlformat=require(_0xa5a2('0x1'));var rimraf=require(_0xa5a2('0x2'));var zipdir=require(_0xa5a2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa5a2('0x4'));var Mustache=require(_0xa5a2('0x5'));var util=require('util');var path=require(_0xa5a2('0x6'));var sox=require(_0xa5a2('0x7'));var csv=require(_0xa5a2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5a2('0x9'));var squel=require('squel');var crypto=require(_0xa5a2('0xa'));var jsforce=require(_0xa5a2('0xb'));var deskjs=require(_0xa5a2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa5a2('0xd'));var Redis=require(_0xa5a2('0xe'));var authService=require(_0xa5a2('0xf'));var qs=require(_0xa5a2('0x10'));var as=require(_0xa5a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a2('0x12'))(_0xa5a2('0x13'));var utils=require(_0xa5a2('0x14'));var config=require(_0xa5a2('0x15'));var licenseUtil=require(_0xa5a2('0x16'));var db=require(_0xa5a2('0x17'))['db'];function respondWithStatusCode(_0x501e3c,_0x5e71a8){_0x5e71a8=_0x5e71a8||0xcc;return function(_0x4a6a35){if(_0x4a6a35){return _0x501e3c[_0xa5a2('0x18')](_0x5e71a8);}return _0x501e3c[_0xa5a2('0x19')](_0x5e71a8)[_0xa5a2('0x1a')]();};}function respondWithResult(_0x29174b,_0x39d6a6){_0x39d6a6=_0x39d6a6||0xc8;return function(_0x488b10){if(_0x488b10){return _0x29174b[_0xa5a2('0x19')](_0x39d6a6)[_0xa5a2('0x1b')](_0x488b10);}};}function respondWithFilteredResult(_0x570d87,_0x20ae7c){return function(_0x1bdcd2){if(_0x1bdcd2){var _0x5e1b56=_0x1bdcd2[_0xa5a2('0x1c')],_0xc3eb39=_0x20ae7c[_0xa5a2('0x1d')],_0x29f458=_0x20ae7c[_0xa5a2('0x1d')]+_0x20ae7c[_0xa5a2('0x1e')],_0x599599;if(_0x29f458>=_0x5e1b56){_0x29f458=_0x5e1b56;_0x599599=0xc8;}else{_0x599599=0xce;}_0x570d87[_0xa5a2('0x19')](_0x599599);return _0x570d87[_0xa5a2('0x1f')]('Content-Range',_0xc3eb39+'-'+_0x29f458+'/'+_0x5e1b56)[_0xa5a2('0x1b')](_0x1bdcd2);}return null;};}function patchUpdates(_0x195363){return function(_0x21712b){try{jsonpatch[_0xa5a2('0x20')](_0x21712b,_0x195363,!![]);}catch(_0x281730){return BPromise[_0xa5a2('0x21')](_0x281730);}return _0x21712b['save']();};}function saveUpdates(_0x299208,_0x2fa65d){return function(_0xba2aa6){if(_0xba2aa6){return _0xba2aa6[_0xa5a2('0x22')](_0x299208)[_0xa5a2('0x23')](function(_0x253cc6){return _0x253cc6;});}return null;};}function removeEntity(_0x134877,_0x27f3bf){return function(_0x3a7a6a){if(_0x3a7a6a){return _0x3a7a6a[_0xa5a2('0x24')]()[_0xa5a2('0x23')](function(){var _0x2adce9=_0x3a7a6a[_0xa5a2('0x25')]({'plain':!![]});var _0x349f94='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x349f94,'resourceId':_0x2adce9['id']}})[_0xa5a2('0x23')](function(){return _0x3a7a6a;});})[_0xa5a2('0x23')](function(){_0x134877[_0xa5a2('0x19')](0xcc)[_0xa5a2('0x1a')]();});}};}function handleEntityNotFound(_0x43d74d,_0x446c70){return function(_0x29556e){if(!_0x29556e){_0x43d74d[_0xa5a2('0x18')](0x194);}return _0x29556e;};}function handleError(_0x50722e,_0x42f79f){_0x42f79f=_0x42f79f||0x1f4;return function(_0x3eca31){logger['error'](_0x3eca31[_0xa5a2('0x26')]);if(_0x3eca31[_0xa5a2('0x27')]){delete _0x3eca31['name'];}_0x50722e[_0xa5a2('0x19')](_0x42f79f)[_0xa5a2('0x28')](_0x3eca31);};}exports[_0xa5a2('0x29')]=function(_0x180b8a,_0x5284a9){var _0x41eae4={},_0x25b806={},_0x45521c={'count':0x0,'rows':[]};var _0x653fb9=_[_0xa5a2('0x2a')](db[_0xa5a2('0x2b')][_0xa5a2('0x2c')],function(_0x2e55ba){return{'name':_0x2e55ba[_0xa5a2('0x2d')],'type':_0x2e55ba[_0xa5a2('0x2e')][_0xa5a2('0x2f')]};});_0x25b806[_0xa5a2('0x30')]=_[_0xa5a2('0x2a')](_0x653fb9,'name');_0x25b806[_0xa5a2('0x31')]=_['keys'](_0x180b8a[_0xa5a2('0x31')]);_0x25b806[_0xa5a2('0x32')]=_[_0xa5a2('0x33')](_0x25b806[_0xa5a2('0x30')],_0x25b806['query']);_0x41eae4['attributes']=_[_0xa5a2('0x33')](_0x25b806['model'],qs['fields'](_0x180b8a[_0xa5a2('0x31')][_0xa5a2('0x34')]));_0x41eae4['attributes']=_0x41eae4[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0x41eae4[_0xa5a2('0x35')]:_0x25b806['model'];if(!_0x180b8a['query'][_0xa5a2('0x37')](_0xa5a2('0x38'))){_0x41eae4[_0xa5a2('0x1e')]=qs[_0xa5a2('0x1e')](_0x180b8a[_0xa5a2('0x31')][_0xa5a2('0x1e')]);_0x41eae4[_0xa5a2('0x1d')]=qs['offset'](_0x180b8a[_0xa5a2('0x31')][_0xa5a2('0x1d')]);}_0x41eae4[_0xa5a2('0x39')]=qs[_0xa5a2('0x3a')](_0x180b8a['query'][_0xa5a2('0x3a')]);_0x41eae4[_0xa5a2('0x3b')]=qs['filters'](_[_0xa5a2('0x3c')](_0x180b8a[_0xa5a2('0x31')],_0x25b806[_0xa5a2('0x32')]),_0x653fb9);if(_0x180b8a[_0xa5a2('0x31')][_0xa5a2('0x3d')]){_0x41eae4[_0xa5a2('0x3b')]=_[_0xa5a2('0x3e')](_0x41eae4[_0xa5a2('0x3b')],{'$or':_[_0xa5a2('0x2a')](_0x653fb9,function(_0x3058a1){if(_0x3058a1[_0xa5a2('0x2e')]!=='VIRTUAL'){var _0x4a2e19={};_0x4a2e19[_0x3058a1['name']]={'$like':'%'+_0x180b8a[_0xa5a2('0x31')][_0xa5a2('0x3d')]+'%'};return _0x4a2e19;}})});}_0x41eae4=_[_0xa5a2('0x3e')]({},_0x41eae4,_0x180b8a[_0xa5a2('0x3f')]);var _0x1f7397={'where':_0x41eae4[_0xa5a2('0x3b')]};return db['Campaign'][_0xa5a2('0x1c')](_0x1f7397)[_0xa5a2('0x23')](function(_0x5c026c){_0x45521c[_0xa5a2('0x1c')]=_0x5c026c;if(_0x180b8a[_0xa5a2('0x31')]['includeAll']){_0x41eae4[_0xa5a2('0x40')]=[{'all':!![]}];}return db[_0xa5a2('0x2b')][_0xa5a2('0x41')](_0x41eae4);})[_0xa5a2('0x23')](function(_0x2ca866){_0x45521c[_0xa5a2('0x42')]=_0x2ca866;return _0x45521c;})[_0xa5a2('0x23')](respondWithFilteredResult(_0x5284a9,_0x41eae4))['catch'](handleError(_0x5284a9,null));};exports[_0xa5a2('0x43')]=function(_0x35d9ed,_0x28d0c8){var _0x377232={'raw':![],'where':{'id':_0x35d9ed[_0xa5a2('0x44')]['id']}},_0x52fd0c={};_0x52fd0c[_0xa5a2('0x30')]=_['keys'](db[_0xa5a2('0x2b')][_0xa5a2('0x2c')]);_0x52fd0c['query']=_['keys'](_0x35d9ed['query']);_0x52fd0c[_0xa5a2('0x32')]=_['intersection'](_0x52fd0c['model'],_0x52fd0c['query']);_0x377232['attributes']=_['intersection'](_0x52fd0c[_0xa5a2('0x30')],qs[_0xa5a2('0x34')](_0x35d9ed['query'][_0xa5a2('0x34')]));_0x377232[_0xa5a2('0x35')]=_0x377232[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0x377232[_0xa5a2('0x35')]:_0x52fd0c[_0xa5a2('0x30')];if(_0x35d9ed[_0xa5a2('0x31')]['includeAll']){_0x377232[_0xa5a2('0x40')]=[{'all':!![]}];}_0x377232=_[_0xa5a2('0x3e')]({},_0x377232,_0x35d9ed[_0xa5a2('0x3f')]);return db[_0xa5a2('0x2b')]['find'](_0x377232)['then'](handleEntityNotFound(_0x28d0c8,null))[_0xa5a2('0x23')](respondWithResult(_0x28d0c8,null))['catch'](handleError(_0x28d0c8,null));};exports[_0xa5a2('0x45')]=function(_0x11b60f,_0x3dbdc7){return db['Campaign']['create'](_0x11b60f[_0xa5a2('0x46')],{})[_0xa5a2('0x23')](function(_0x589b52){var _0x44d1ea=_0x11b60f[_0xa5a2('0x47')][_0xa5a2('0x25')]({'plain':!![]});if(!_0x44d1ea)throw new Error(_0xa5a2('0x48'));if(_0x44d1ea[_0xa5a2('0x49')]===_0xa5a2('0x47')){var _0x355ff4=_0x589b52[_0xa5a2('0x25')]({'plain':!![]});var _0x162fc9='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x162fc9,'userProfileId':_0x44d1ea[_0xa5a2('0x4a')]},'raw':!![]})[_0xa5a2('0x23')](function(_0x3e4ced){if(_0x3e4ced&&_0x3e4ced[_0xa5a2('0x4b')]===0x0){return db[_0xa5a2('0x4c')][_0xa5a2('0x45')]({'name':_0x355ff4[_0xa5a2('0x27')],'resourceId':_0x355ff4['id'],'type':_0x3e4ced['name'],'sectionId':_0x3e4ced['id']},{})['then'](function(){return _0x589b52;});}else{return _0x589b52;}})[_0xa5a2('0x4d')](function(_0x1d8bf0){logger[_0xa5a2('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d8bf0);throw _0x1d8bf0;});}return _0x589b52;})['then'](respondWithResult(_0x3dbdc7,0xc9))[_0xa5a2('0x4d')](handleError(_0x3dbdc7,null));};exports[_0xa5a2('0x4f')]=function(_0x3dfb97,_0x138c3c){var _0xe6ca76={'where':{'id':_0x3dfb97['params']['id']}},_0x3f04f2={};_0x3f04f2[_0xa5a2('0x30')]=_['keys'](db[_0xa5a2('0x2b')][_0xa5a2('0x2c')]);_0xe6ca76[_0xa5a2('0x35')]=_[_0xa5a2('0x33')](_0x3f04f2[_0xa5a2('0x30')],qs['fields'](_0x3dfb97[_0xa5a2('0x31')][_0xa5a2('0x34')]));_0xe6ca76['attributes']=_0xe6ca76[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0xe6ca76['attributes']:_0x3f04f2[_0xa5a2('0x30')];if(_0x3dfb97[_0xa5a2('0x31')]['includeAll']){_0xe6ca76['include']=[{'all':!![]}];}_0xe6ca76=_[_0xa5a2('0x3e')]({},_0xe6ca76,_0x3dfb97[_0xa5a2('0x3f')]);return db[_0xa5a2('0x2b')]['find'](_0xe6ca76)['then'](handleEntityNotFound(_0x138c3c,null))[_0xa5a2('0x23')](function(_0x42ef2e){if(_0x42ef2e){var _0x413cf6=_0x42ef2e['get']({'plain':!![]});_0x413cf6=qs[_0xa5a2('0x50')](_0x413cf6,['id',_0xa5a2('0x51'),_0xa5a2('0x52')]);_0x3dfb97[_0xa5a2('0x46')]=_[_0xa5a2('0x50')](_0x3dfb97[_0xa5a2('0x46')],['id',_0xa5a2('0x51'),_0xa5a2('0x52')]);return db['Campaign'][_0xa5a2('0x45')](_['merge'](_0x413cf6,_0x3dfb97[_0xa5a2('0x46')]),{'include':_0x3dfb97[_0xa5a2('0x31')][_0xa5a2('0x53')]?[{'all':!![]}]:undefined})[_0xa5a2('0x23')](function(_0x4c1761){var _0x1a4c8e=_0x3dfb97[_0xa5a2('0x47')][_0xa5a2('0x25')]({'plain':!![]});if(!_0x1a4c8e)throw new Error(_0xa5a2('0x48'));if(_0x1a4c8e['role']===_0xa5a2('0x47')){var _0x214606=_0x4c1761['get']({'plain':!![]});var _0x3d0f2a=_0xa5a2('0x54');return db[_0xa5a2('0x55')][_0xa5a2('0x56')]({'where':{'name':_0x3d0f2a,'userProfileId':_0x1a4c8e['userProfileId']},'raw':!![]})[_0xa5a2('0x23')](function(_0x1d020b){if(_0x1d020b&&_0x1d020b['autoAssociation']===0x0){return db[_0xa5a2('0x4c')][_0xa5a2('0x45')]({'name':_0x214606['name'],'resourceId':_0x214606['id'],'type':_0x1d020b[_0xa5a2('0x27')],'sectionId':_0x1d020b['id']},{})['then'](function(){return _0x4c1761;});}else{return _0x4c1761;}})[_0xa5a2('0x4d')](function(_0x5c1298){logger[_0xa5a2('0x4e')](_0xa5a2('0x57'),_0x5c1298);throw _0x5c1298;});}return _0x4c1761;});}})[_0xa5a2('0x23')](respondWithResult(_0x138c3c,0xc9))[_0xa5a2('0x4d')](handleError(_0x138c3c,null));};exports[_0xa5a2('0x22')]=function(_0x2c80aa,_0x151df0){if(_0x2c80aa['body']['id']){delete _0x2c80aa[_0xa5a2('0x46')]['id'];}return db[_0xa5a2('0x2b')][_0xa5a2('0x56')]({'where':{'id':_0x2c80aa['params']['id']}})['then'](handleEntityNotFound(_0x151df0,null))[_0xa5a2('0x23')](saveUpdates(_0x2c80aa[_0xa5a2('0x46')],null))[_0xa5a2('0x23')](respondWithResult(_0x151df0,null))[_0xa5a2('0x4d')](handleError(_0x151df0,null));};exports[_0xa5a2('0x24')]=function(_0x41453e,_0x5e7a41){return db[_0xa5a2('0x2b')][_0xa5a2('0x56')]({'where':{'id':_0x41453e[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x5e7a41,null))[_0xa5a2('0x23')](removeEntity(_0x5e7a41,null))['catch'](handleError(_0x5e7a41,null));};exports[_0xa5a2('0x58')]=function(_0x4c91a2,_0x114262,_0x870c76){var _0x479a14={'raw':!![],'where':{}};var _0xd6012c={};var _0x51e33c={'count':0x0,'rows':[]};return db[_0xa5a2('0x2b')][_0xa5a2('0x59')]({'where':{'id':_0x4c91a2[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x114262,null))['then'](function(_0x15fab8){if(_0x15fab8){_0xd6012c['model']=_[_0xa5a2('0x5a')](db['CmHopper'][_0xa5a2('0x2c')]);_0xd6012c[_0xa5a2('0x31')]=_[_0xa5a2('0x5a')](_0x4c91a2[_0xa5a2('0x31')]);_0xd6012c[_0xa5a2('0x32')]=_[_0xa5a2('0x33')](_0xd6012c[_0xa5a2('0x30')],_0xd6012c['query']);_0x479a14['attributes']=_[_0xa5a2('0x33')](_0xd6012c['model'],qs[_0xa5a2('0x34')](_0x4c91a2[_0xa5a2('0x31')][_0xa5a2('0x34')]));_0x479a14[_0xa5a2('0x35')]=_0x479a14[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0x479a14['attributes']:_0xd6012c[_0xa5a2('0x30')];if(!_0x4c91a2[_0xa5a2('0x31')][_0xa5a2('0x37')](_0xa5a2('0x38'))){_0x479a14['limit']=qs[_0xa5a2('0x1e')](_0x4c91a2[_0xa5a2('0x31')][_0xa5a2('0x1e')]);_0x479a14[_0xa5a2('0x1d')]=qs[_0xa5a2('0x1d')](_0x4c91a2[_0xa5a2('0x31')][_0xa5a2('0x1d')]);}_0x479a14[_0xa5a2('0x39')]=qs['sort'](_0x4c91a2[_0xa5a2('0x31')]['sort']);_0x479a14[_0xa5a2('0x3b')]=qs['filters'](_['pick'](_0x4c91a2[_0xa5a2('0x31')],_0xd6012c['filters']));_0x479a14[_0xa5a2('0x3b')][_0xa5a2('0x5b')]=_0x15fab8['id'];if(_0x4c91a2[_0xa5a2('0x31')][_0xa5a2('0x3d')]){_0x479a14[_0xa5a2('0x3b')]=_[_0xa5a2('0x3e')](_0x479a14['where'],{'$or':_[_0xa5a2('0x2a')](_0x479a14[_0xa5a2('0x35')],function(_0x1a4c62){var _0x45f8e9={};_0x45f8e9[_0x1a4c62]={'$like':'%'+_0x4c91a2[_0xa5a2('0x31')][_0xa5a2('0x3d')]+'%'};return _0x45f8e9;})});}_0x479a14=_[_0xa5a2('0x3e')]({},_0x479a14,_0x4c91a2[_0xa5a2('0x3f')]);return db[_0xa5a2('0x5c')][_0xa5a2('0x1c')]({'where':_0x479a14['where']})[_0xa5a2('0x23')](function(_0x70c8e8){_0x51e33c[_0xa5a2('0x1c')]=_0x70c8e8;if(_0x4c91a2['query'][_0xa5a2('0x53')]){_0x479a14[_0xa5a2('0x40')]=[{'all':!![]}];}return db[_0xa5a2('0x5c')][_0xa5a2('0x41')](_0x479a14);})[_0xa5a2('0x23')](function(_0x4e4f23){_0x51e33c[_0xa5a2('0x42')]=_0x4e4f23;return _0x51e33c;});}})[_0xa5a2('0x23')](respondWithFilteredResult(_0x114262,_0x479a14))[_0xa5a2('0x4d')](handleError(_0x114262,null));};exports[_0xa5a2('0x5d')]=function(_0x4d0282,_0x545b2f,_0x534b30){var _0x352591={'raw':!![],'where':{}};var _0x260326={};var _0x4241ad={'count':0x0,'rows':[]};return db[_0xa5a2('0x2b')][_0xa5a2('0x59')]({'where':{'id':_0x4d0282[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x545b2f,null))[_0xa5a2('0x23')](function(_0x1728ca){if(_0x1728ca){_0x260326[_0xa5a2('0x30')]=_[_0xa5a2('0x5a')](db[_0xa5a2('0x5e')]['rawAttributes']);_0x260326['query']=_['keys'](_0x4d0282[_0xa5a2('0x31')]);_0x260326[_0xa5a2('0x32')]=_['intersection'](_0x260326['model'],_0x260326[_0xa5a2('0x31')]);_0x352591['attributes']=_[_0xa5a2('0x33')](_0x260326['model'],qs[_0xa5a2('0x34')](_0x4d0282[_0xa5a2('0x31')]['fields']));_0x352591[_0xa5a2('0x35')]=_0x352591[_0xa5a2('0x35')]['length']?_0x352591[_0xa5a2('0x35')]:_0x260326[_0xa5a2('0x30')];if(!_0x4d0282[_0xa5a2('0x31')]['hasOwnProperty'](_0xa5a2('0x38'))){_0x352591[_0xa5a2('0x1e')]=qs[_0xa5a2('0x1e')](_0x4d0282[_0xa5a2('0x31')][_0xa5a2('0x1e')]);_0x352591[_0xa5a2('0x1d')]=qs[_0xa5a2('0x1d')](_0x4d0282[_0xa5a2('0x31')][_0xa5a2('0x1d')]);}_0x352591[_0xa5a2('0x39')]=qs[_0xa5a2('0x3a')](_0x4d0282[_0xa5a2('0x31')][_0xa5a2('0x3a')]);_0x352591['where']=qs['filters'](_[_0xa5a2('0x3c')](_0x4d0282['query'],_0x260326[_0xa5a2('0x32')]));_0x352591['where'][_0xa5a2('0x5b')]=_0x1728ca['id'];if(_0x4d0282['query']['filter']){_0x352591[_0xa5a2('0x3b')]=_['merge'](_0x352591[_0xa5a2('0x3b')],{'$or':_['map'](_0x352591[_0xa5a2('0x35')],function(_0x2ea0ec){var _0x49fcef={};_0x49fcef[_0x2ea0ec]={'$like':'%'+_0x4d0282['query'][_0xa5a2('0x3d')]+'%'};return _0x49fcef;})});}_0x352591=_[_0xa5a2('0x3e')]({},_0x352591,_0x4d0282[_0xa5a2('0x3f')]);return db[_0xa5a2('0x5e')][_0xa5a2('0x1c')]({'where':_0x352591[_0xa5a2('0x3b')]})[_0xa5a2('0x23')](function(_0x14f411){_0x4241ad[_0xa5a2('0x1c')]=_0x14f411;if(_0x4d0282[_0xa5a2('0x31')][_0xa5a2('0x53')]){_0x352591['include']=[{'all':!![]}];}return db[_0xa5a2('0x5e')][_0xa5a2('0x41')](_0x352591);})[_0xa5a2('0x23')](function(_0x1ea25b){_0x4241ad[_0xa5a2('0x42')]=_0x1ea25b;return _0x4241ad;});}})[_0xa5a2('0x23')](respondWithFilteredResult(_0x545b2f,_0x352591))['catch'](handleError(_0x545b2f,null));};exports[_0xa5a2('0x5f')]=function(_0xb78e37,_0x25fe3e,_0x3c9084){var _0x227e59={'raw':!![],'where':{}};var _0xdd6b2d={};var _0x3c9b2f={'count':0x0,'rows':[]};return db[_0xa5a2('0x2b')][_0xa5a2('0x59')]({'where':{'id':_0xb78e37[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x25fe3e,null))[_0xa5a2('0x23')](function(_0x5c1557){if(_0x5c1557){_0xdd6b2d[_0xa5a2('0x30')]=_[_0xa5a2('0x5a')](db['CmHopperFinal'][_0xa5a2('0x2c')]);_0xdd6b2d['query']=_[_0xa5a2('0x5a')](_0xb78e37[_0xa5a2('0x31')]);_0xdd6b2d[_0xa5a2('0x32')]=_[_0xa5a2('0x33')](_0xdd6b2d['model'],_0xdd6b2d['query']);_0x227e59[_0xa5a2('0x35')]=_[_0xa5a2('0x33')](_0xdd6b2d['model'],qs[_0xa5a2('0x34')](_0xb78e37[_0xa5a2('0x31')]['fields']));_0x227e59[_0xa5a2('0x35')]=_0x227e59[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0x227e59[_0xa5a2('0x35')]:_0xdd6b2d[_0xa5a2('0x30')];if(!_0xb78e37[_0xa5a2('0x31')][_0xa5a2('0x37')](_0xa5a2('0x38'))){_0x227e59[_0xa5a2('0x1e')]=qs[_0xa5a2('0x1e')](_0xb78e37[_0xa5a2('0x31')][_0xa5a2('0x1e')]);_0x227e59[_0xa5a2('0x1d')]=qs['offset'](_0xb78e37[_0xa5a2('0x31')][_0xa5a2('0x1d')]);}_0x227e59[_0xa5a2('0x39')]=qs[_0xa5a2('0x3a')](_0xb78e37[_0xa5a2('0x31')][_0xa5a2('0x3a')]);_0x227e59[_0xa5a2('0x3b')]=qs['filters'](_['pick'](_0xb78e37[_0xa5a2('0x31')],_0xdd6b2d[_0xa5a2('0x32')]));_0x227e59['where']['CampaignId']=_0x5c1557['id'];if(_0xb78e37['query'][_0xa5a2('0x3d')]){_0x227e59['where']=_[_0xa5a2('0x3e')](_0x227e59[_0xa5a2('0x3b')],{'$or':_[_0xa5a2('0x2a')](_0x227e59['attributes'],function(_0xb54d3e){var _0x1f9062={};_0x1f9062[_0xb54d3e]={'$like':'%'+_0xb78e37[_0xa5a2('0x31')][_0xa5a2('0x3d')]+'%'};return _0x1f9062;})});}_0x227e59=_[_0xa5a2('0x3e')]({},_0x227e59,_0xb78e37[_0xa5a2('0x3f')]);return db[_0xa5a2('0x60')][_0xa5a2('0x1c')]({'where':_0x227e59[_0xa5a2('0x3b')]})[_0xa5a2('0x23')](function(_0x4d3488){_0x3c9b2f[_0xa5a2('0x1c')]=_0x4d3488;if(_0xb78e37[_0xa5a2('0x31')]['includeAll']){_0x227e59[_0xa5a2('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xa5a2('0x41')](_0x227e59);})[_0xa5a2('0x23')](function(_0x365d3f){_0x3c9b2f['rows']=_0x365d3f;return _0x3c9b2f;});}})[_0xa5a2('0x23')](respondWithFilteredResult(_0x25fe3e,_0x227e59))['catch'](handleError(_0x25fe3e,null));};exports[_0xa5a2('0x61')]=function(_0x41651b,_0x479c22,_0x13d4b7){var _0x4db85a={'raw':!![],'where':{}};var _0x2cf838={};var _0x428657={'count':0x0,'rows':[]};return db[_0xa5a2('0x2b')][_0xa5a2('0x59')]({'where':{'id':_0x41651b[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x479c22,null))[_0xa5a2('0x23')](function(_0x5dcf42){if(_0x5dcf42){_0x2cf838[_0xa5a2('0x30')]=_['keys'](db[_0xa5a2('0x62')][_0xa5a2('0x2c')]);_0x2cf838[_0xa5a2('0x31')]=_[_0xa5a2('0x5a')](_0x41651b[_0xa5a2('0x31')]);_0x2cf838['filters']=_[_0xa5a2('0x33')](_0x2cf838[_0xa5a2('0x30')],_0x2cf838['query']);_0x4db85a[_0xa5a2('0x35')]=_[_0xa5a2('0x33')](_0x2cf838['model'],qs['fields'](_0x41651b[_0xa5a2('0x31')]['fields']));_0x4db85a[_0xa5a2('0x35')]=_0x4db85a[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0x4db85a['attributes']:_0x2cf838[_0xa5a2('0x30')];if(!_0x41651b[_0xa5a2('0x31')][_0xa5a2('0x37')](_0xa5a2('0x38'))){_0x4db85a[_0xa5a2('0x1e')]=qs[_0xa5a2('0x1e')](_0x41651b['query'][_0xa5a2('0x1e')]);_0x4db85a[_0xa5a2('0x1d')]=qs['offset'](_0x41651b[_0xa5a2('0x31')][_0xa5a2('0x1d')]);}_0x4db85a['order']=qs[_0xa5a2('0x3a')](_0x41651b[_0xa5a2('0x31')][_0xa5a2('0x3a')]);_0x4db85a[_0xa5a2('0x3b')]=qs[_0xa5a2('0x32')](_[_0xa5a2('0x3c')](_0x41651b['query'],_0x2cf838[_0xa5a2('0x32')]));_0x4db85a[_0xa5a2('0x3b')][_0xa5a2('0x5b')]=_0x5dcf42['id'];if(_0x41651b['query'][_0xa5a2('0x3d')]){_0x4db85a[_0xa5a2('0x3b')]=_[_0xa5a2('0x3e')](_0x4db85a['where'],{'$or':_['map'](_0x4db85a[_0xa5a2('0x35')],function(_0x28482a){var _0x2b4c40={};_0x2b4c40[_0x28482a]={'$like':'%'+_0x41651b[_0xa5a2('0x31')]['filter']+'%'};return _0x2b4c40;})});}_0x4db85a=_[_0xa5a2('0x3e')]({},_0x4db85a,_0x41651b['options']);return db[_0xa5a2('0x62')]['count']({'where':_0x4db85a[_0xa5a2('0x3b')]})['then'](function(_0x590394){_0x428657[_0xa5a2('0x1c')]=_0x590394;if(_0x41651b['query'][_0xa5a2('0x53')]){_0x4db85a['include']=[{'all':!![]}];}return db[_0xa5a2('0x62')][_0xa5a2('0x41')](_0x4db85a);})[_0xa5a2('0x23')](function(_0x323cb1){_0x428657[_0xa5a2('0x42')]=_0x323cb1;return _0x428657;});}})[_0xa5a2('0x23')](respondWithFilteredResult(_0x479c22,_0x4db85a))[_0xa5a2('0x4d')](handleError(_0x479c22,null));};exports[_0xa5a2('0x63')]=function(_0x4deae9,_0x3d14b4,_0x39ebd2){var _0x46c354={};var _0x10829c={};var _0x5a2abb;var _0x2ea594;return db[_0xa5a2('0x2b')][_0xa5a2('0x59')]({'where':{'id':_0x4deae9[_0xa5a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d14b4,null))[_0xa5a2('0x23')](function(_0x3f9622){if(_0x3f9622){_0x5a2abb=_0x3f9622;_0x10829c[_0xa5a2('0x30')]=_[_0xa5a2('0x5a')](db[_0xa5a2('0x64')][_0xa5a2('0x2c')]);_0x10829c[_0xa5a2('0x31')]=_[_0xa5a2('0x5a')](_0x4deae9[_0xa5a2('0x31')]);_0x10829c['filters']=_[_0xa5a2('0x33')](_0x10829c[_0xa5a2('0x30')],_0x10829c[_0xa5a2('0x31')]);_0x46c354['attributes']=_[_0xa5a2('0x33')](_0x10829c[_0xa5a2('0x30')],qs[_0xa5a2('0x34')](_0x4deae9[_0xa5a2('0x31')][_0xa5a2('0x34')]));_0x46c354[_0xa5a2('0x35')]=_0x46c354['attributes'][_0xa5a2('0x36')]?_0x46c354['attributes']:_0x10829c[_0xa5a2('0x30')];_0x46c354[_0xa5a2('0x39')]=qs[_0xa5a2('0x3a')](_0x4deae9[_0xa5a2('0x31')][_0xa5a2('0x3a')]);_0x46c354[_0xa5a2('0x3b')]=qs[_0xa5a2('0x32')](_[_0xa5a2('0x3c')](_0x4deae9[_0xa5a2('0x31')],_0x10829c[_0xa5a2('0x32')]));if(_0x4deae9[_0xa5a2('0x31')][_0xa5a2('0x3d')]){_0x46c354[_0xa5a2('0x3b')]=_[_0xa5a2('0x3e')](_0x46c354[_0xa5a2('0x3b')],{'$or':_[_0xa5a2('0x2a')](_0x46c354[_0xa5a2('0x35')],function(_0x25517a){var _0x4d4317={};_0x4d4317[_0x25517a]={'$like':'%'+_0x4deae9[_0xa5a2('0x31')][_0xa5a2('0x3d')]+'%'};return _0x4d4317;})});}_0x46c354=_[_0xa5a2('0x3e')]({},_0x46c354,_0x4deae9[_0xa5a2('0x3f')]);return _0x5a2abb[_0xa5a2('0x63')](_0x46c354);}})['then'](function(_0x28113c){if(_0x28113c){_0x2ea594=_0x28113c[_0xa5a2('0x36')];if(!_0x4deae9[_0xa5a2('0x31')][_0xa5a2('0x37')](_0xa5a2('0x38'))){_0x46c354[_0xa5a2('0x1e')]=qs[_0xa5a2('0x1e')](_0x4deae9[_0xa5a2('0x31')][_0xa5a2('0x1e')]);_0x46c354[_0xa5a2('0x1d')]=qs[_0xa5a2('0x1d')](_0x4deae9[_0xa5a2('0x31')]['offset']);}return _0x5a2abb[_0xa5a2('0x63')](_0x46c354);}})['then'](function(_0x49efdc){if(_0x49efdc){return _0x49efdc?{'count':_0x2ea594,'rows':_0x49efdc}:null;}})[_0xa5a2('0x23')](respondWithResult(_0x3d14b4,null))[_0xa5a2('0x4d')](handleError(_0x3d14b4,null));};exports[_0xa5a2('0x65')]=function(_0x41d5dd,_0x5dae53,_0x1a4639){var _0x158523,_0x4a2111;return db[_0xa5a2('0x2b')][_0xa5a2('0x56')]({'where':{'id':_0x41d5dd[_0xa5a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dae53,null))['then'](function(_0x3e7442){if(_0x3e7442){_0x4a2111=_0x3e7442;return _0x3e7442[_0xa5a2('0x65')](_0x41d5dd[_0xa5a2('0x46')]['ids'],_[_0xa5a2('0x50')](_0x41d5dd[_0xa5a2('0x46')],[_0xa5a2('0x66'),'id'])||{});}return null;})[_0xa5a2('0x67')](function(_0x258cee){var _0x24851f;_0x158523=_0x258cee||[];var _0x479bc2=[];if(_0x258cee){for(var _0x1455ce=0x0;_0x1455ce<_0x258cee[_0xa5a2('0x36')];_0x1455ce+=0x1){var _0x5be1d3=_0x258cee[_0x1455ce][_0xa5a2('0x25')]({'plain':!![]});_0x4a2111[_0xa5a2('0x68')]=_0x41d5dd['body'][_0xa5a2('0x68')]?_0x41d5dd[_0xa5a2('0x46')][_0xa5a2('0x68')]:_0x4a2111[_0xa5a2('0x68')];switch(_0x4a2111[_0xa5a2('0x68')]){case _0xa5a2('0x69'):_0x24851f=squel[_0xa5a2('0x6a')]()[_0xa5a2('0x6b')](_0xa5a2('0x6c'))[_0xa5a2('0x6d')]([_0xa5a2('0x6e'),_0xa5a2('0x6f'),_0xa5a2('0x70'),_0xa5a2('0x71'),_0xa5a2('0x5b'),_0xa5a2('0x51'),'updatedAt'],squel[_0xa5a2('0x72')]()['field'](_0xa5a2('0x6e'),_0xa5a2('0x6e'))[_0xa5a2('0x73')](_0xa5a2('0x74'),'scheduledAt')['field']('id',_0xa5a2('0x70'))[_0xa5a2('0x73')](_0x5be1d3['CmListId'][_0xa5a2('0x75')](),'ListId')[_0xa5a2('0x73')](_0x41d5dd[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')](),'CampaignId')['field'](_0xa5a2('0x74'),_0xa5a2('0x51'))[_0xa5a2('0x73')]('NOW()',_0xa5a2('0x52'))[_0xa5a2('0x76')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xa5a2('0x3b')](_0xa5a2('0x77'),_0x5be1d3[_0xa5a2('0x78')][_0xa5a2('0x75')]())['where'](_0xa5a2('0x79'))[_0xa5a2('0x3b')](_0xa5a2('0x7a'),squel[_0xa5a2('0x72')]()[_0xa5a2('0x73')](_0xa5a2('0x7b'))[_0xa5a2('0x76')](_0xa5a2('0x7c'))['where'](_0xa5a2('0x7d'),_0x41d5dd[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')]()))['where'](_0xa5a2('0x7a'),squel[_0xa5a2('0x72')]()[_0xa5a2('0x73')](_0xa5a2('0x7e'))['from'](_0xa5a2('0x6c'))['where'](_0xa5a2('0x7d'),_0x41d5dd[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')]())))[_0xa5a2('0x75')]();break;case _0xa5a2('0x7f'):_0x24851f=squel['insert']()[_0xa5a2('0x6b')]('cm_hopper')[_0xa5a2('0x6d')]([_0xa5a2('0x6e'),_0xa5a2('0x6f'),'ContactId',_0xa5a2('0x71'),_0xa5a2('0x5b'),_0xa5a2('0x51'),_0xa5a2('0x52')],squel[_0xa5a2('0x72')]()[_0xa5a2('0x73')]('phone',_0xa5a2('0x6e'))[_0xa5a2('0x73')](_0xa5a2('0x74'),_0xa5a2('0x6f'))[_0xa5a2('0x73')]('id',_0xa5a2('0x70'))[_0xa5a2('0x73')](_0x5be1d3['CmListId'][_0xa5a2('0x75')](),_0xa5a2('0x71'))['field'](_0x41d5dd[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')](),_0xa5a2('0x5b'))[_0xa5a2('0x73')](_0xa5a2('0x74'),_0xa5a2('0x51'))[_0xa5a2('0x73')]('NOW()','updatedAt')['from'](_0xa5a2('0x80'))['where'](_0xa5a2('0x81'))['where']('ListId\x20=\x20?',_0x5be1d3[_0xa5a2('0x78')]['toString']())[_0xa5a2('0x3b')](_0xa5a2('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa5a2('0x72')]()[_0xa5a2('0x73')](_0xa5a2('0x7e'))['from'](_0xa5a2('0x6c'))[_0xa5a2('0x3b')]('CampaignId\x20=\x20?',_0x41d5dd[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')]())))[_0xa5a2('0x75')]();break;default:_0x24851f=squel['insert']()[_0xa5a2('0x6b')]('cm_hopper')[_0xa5a2('0x6d')]([_0xa5a2('0x6e'),_0xa5a2('0x6f'),_0xa5a2('0x70'),'ListId',_0xa5a2('0x5b'),_0xa5a2('0x51'),_0xa5a2('0x52')],squel[_0xa5a2('0x72')]()[_0xa5a2('0x73')](_0xa5a2('0x6e'),_0xa5a2('0x6e'))['field'](_0xa5a2('0x74'),_0xa5a2('0x6f'))[_0xa5a2('0x73')]('id',_0xa5a2('0x70'))[_0xa5a2('0x73')](_0x5be1d3[_0xa5a2('0x78')][_0xa5a2('0x75')](),'ListId')[_0xa5a2('0x73')](_0x41d5dd[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')](),_0xa5a2('0x5b'))[_0xa5a2('0x73')](_0xa5a2('0x74'),_0xa5a2('0x51'))[_0xa5a2('0x73')](_0xa5a2('0x74'),_0xa5a2('0x52'))[_0xa5a2('0x76')](_0xa5a2('0x80'))[_0xa5a2('0x3b')]('deletedAt\x20IS\x20NULL')[_0xa5a2('0x3b')]('ListId\x20=\x20?',_0x5be1d3[_0xa5a2('0x78')][_0xa5a2('0x75')]())[_0xa5a2('0x3b')](_0xa5a2('0x79')))[_0xa5a2('0x75')]();}_0x479bc2[_0xa5a2('0x82')](db[_0xa5a2('0x83')]['query'](_0x24851f));}return BPromise[_0xa5a2('0x84')](_0x479bc2);}})['then'](function(){return _0x158523;})['then'](respondWithResult(_0x5dae53,null))['catch'](handleError(_0x5dae53,null));};exports[_0xa5a2('0x85')]=function(_0x138a20,_0x4f67ab,_0x30b830){return db['Campaign'][_0xa5a2('0x56')]({'where':{'id':_0x138a20[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x4f67ab,null))[_0xa5a2('0x23')](function(_0x5d66fa){if(_0x5d66fa){return _0x5d66fa[_0xa5a2('0x85')](_0x138a20[_0xa5a2('0x31')][_0xa5a2('0x66')]);}})['then'](function(_0x134a28){if(_0x134a28){return db[_0xa5a2('0x5c')]['destroy']({'where':{'ListId':_0x138a20[_0xa5a2('0x31')][_0xa5a2('0x66')],'CampaignId':_0x138a20[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](function(){return _0x134a28;});}})[_0xa5a2('0x23')](respondWithStatusCode(_0x4f67ab,null))['catch'](handleError(_0x4f67ab,null));};exports[_0xa5a2('0x86')]=function(_0x22960e,_0x5e804a,_0x49b2c8){var _0x5590bd={};var _0x592c23={};var _0x11a371;var _0x18d140;return db[_0xa5a2('0x2b')][_0xa5a2('0x59')]({'where':{'id':_0x22960e['params']['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x5e804a,null))[_0xa5a2('0x23')](function(_0x193248){if(_0x193248){_0x11a371=_0x193248;_0x592c23[_0xa5a2('0x30')]=_[_0xa5a2('0x5a')](db['CmList']['rawAttributes']);_0x592c23[_0xa5a2('0x31')]=_[_0xa5a2('0x5a')](_0x22960e[_0xa5a2('0x31')]);_0x592c23['filters']=_[_0xa5a2('0x33')](_0x592c23[_0xa5a2('0x30')],_0x592c23[_0xa5a2('0x31')]);_0x5590bd[_0xa5a2('0x35')]=_[_0xa5a2('0x33')](_0x592c23[_0xa5a2('0x30')],qs[_0xa5a2('0x34')](_0x22960e['query']['fields']));_0x5590bd['attributes']=_0x5590bd[_0xa5a2('0x35')][_0xa5a2('0x36')]?_0x5590bd[_0xa5a2('0x35')]:_0x592c23[_0xa5a2('0x30')];_0x5590bd[_0xa5a2('0x39')]=qs[_0xa5a2('0x3a')](_0x22960e[_0xa5a2('0x31')][_0xa5a2('0x3a')]);_0x5590bd['where']=qs[_0xa5a2('0x32')](_[_0xa5a2('0x3c')](_0x22960e[_0xa5a2('0x31')],_0x592c23['filters']));if(_0x22960e['query'][_0xa5a2('0x3d')]){_0x5590bd[_0xa5a2('0x3b')]=_['merge'](_0x5590bd[_0xa5a2('0x3b')],{'$or':_[_0xa5a2('0x2a')](_0x5590bd['attributes'],function(_0x4ecf5d){var _0x53fb19={};_0x53fb19[_0x4ecf5d]={'$like':'%'+_0x22960e[_0xa5a2('0x31')][_0xa5a2('0x3d')]+'%'};return _0x53fb19;})});}_0x5590bd=_['merge']({},_0x5590bd,_0x22960e[_0xa5a2('0x3f')]);return _0x11a371[_0xa5a2('0x86')](_0x5590bd);}})[_0xa5a2('0x23')](function(_0x7191fb){if(_0x7191fb){_0x18d140=_0x7191fb[_0xa5a2('0x36')];if(!_0x22960e[_0xa5a2('0x31')][_0xa5a2('0x37')](_0xa5a2('0x38'))){_0x5590bd[_0xa5a2('0x1e')]=qs['limit'](_0x22960e[_0xa5a2('0x31')]['limit']);_0x5590bd[_0xa5a2('0x1d')]=qs[_0xa5a2('0x1d')](_0x22960e[_0xa5a2('0x31')][_0xa5a2('0x1d')]);}return _0x11a371['getBlackLists'](_0x5590bd);}})[_0xa5a2('0x23')](function(_0x746fee){if(_0x746fee){return _0x746fee?{'count':_0x18d140,'rows':_0x746fee}:null;}})['then'](respondWithResult(_0x5e804a,null))[_0xa5a2('0x4d')](handleError(_0x5e804a,null));};exports[_0xa5a2('0x87')]=function(_0x5056e9,_0x43ffbe,_0x1f0e2e){var _0x6e3e24,_0x41498a;return db[_0xa5a2('0x2b')][_0xa5a2('0x56')]({'where':{'id':_0x5056e9[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x43ffbe,null))[_0xa5a2('0x23')](function(_0x5dc1af){if(_0x5dc1af){_0x41498a=_0x5dc1af;return _0x5dc1af[_0xa5a2('0x87')](_0x5056e9[_0xa5a2('0x46')][_0xa5a2('0x66')],_[_0xa5a2('0x50')](_0x5056e9[_0xa5a2('0x46')],[_0xa5a2('0x66'),'id'])||{});}return null;})[_0xa5a2('0x67')](function(_0x590da7){var _0x14a48e;_0x6e3e24=_0x590da7||[];var _0x1cdf2e=[];if(_0x590da7){for(var _0x521506=0x0;_0x521506<_0x590da7[_0xa5a2('0x36')];_0x521506+=0x1){var _0xafc811=_0x590da7[_0x521506][_0xa5a2('0x25')]({'plain':!![]});_0x14a48e=squel[_0xa5a2('0x6a')]()[_0xa5a2('0x6b')](_0xa5a2('0x88'))[_0xa5a2('0x6d')]([_0xa5a2('0x6e'),_0xa5a2('0x70'),'ListId',_0xa5a2('0x5b'),'createdAt',_0xa5a2('0x52')],squel[_0xa5a2('0x72')]()['field'](_0xa5a2('0x6e'),_0xa5a2('0x6e'))[_0xa5a2('0x73')]('id','ContactId')['field'](_0xafc811[_0xa5a2('0x78')][_0xa5a2('0x75')](),_0xa5a2('0x71'))['field'](_0x5056e9[_0xa5a2('0x44')]['id'][_0xa5a2('0x75')](),_0xa5a2('0x5b'))[_0xa5a2('0x73')]('NOW()',_0xa5a2('0x51'))['field'](_0xa5a2('0x74'),_0xa5a2('0x52'))[_0xa5a2('0x76')](_0xa5a2('0x80'))['where']('deletedAt\x20IS\x20NULL')[_0xa5a2('0x3b')](_0xa5a2('0x77'),_0xafc811[_0xa5a2('0x78')][_0xa5a2('0x75')]())[_0xa5a2('0x3b')](_0xa5a2('0x79')))[_0xa5a2('0x75')]();_0x1cdf2e[_0xa5a2('0x82')](db[_0xa5a2('0x83')][_0xa5a2('0x31')](_0x14a48e));}return BPromise['all'](_0x1cdf2e);}})[_0xa5a2('0x23')](function(){return _0x6e3e24;})[_0xa5a2('0x23')](respondWithResult(_0x43ffbe,null))[_0xa5a2('0x4d')](handleError(_0x43ffbe,null));};exports[_0xa5a2('0x89')]=function(_0x4cdcfc,_0x4e4f9e,_0x524d06){return db[_0xa5a2('0x2b')]['find']({'where':{'id':_0x4cdcfc[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](handleEntityNotFound(_0x4e4f9e,null))['then'](function(_0x8bd752){if(_0x8bd752){return _0x8bd752[_0xa5a2('0x89')](_0x4cdcfc[_0xa5a2('0x31')]['ids']);}})[_0xa5a2('0x23')](function(_0x3e3de3){if(_0x3e3de3){return db[_0xa5a2('0x62')][_0xa5a2('0x24')]({'where':{'ListId':_0x4cdcfc[_0xa5a2('0x31')][_0xa5a2('0x66')],'CampaignId':_0x4cdcfc[_0xa5a2('0x44')]['id']}})[_0xa5a2('0x23')](function(){return _0x3e3de3;});}})['then'](respondWithStatusCode(_0x4e4f9e,null))['catch'](handleError(_0x4e4f9e,null));}; \ No newline at end of file +var _0xcceb=['clone','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','findOne','filter','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','cm_hopper','push','all','removeLists','getBlackLists','spread','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x55c2e3,_0x35a53d){var _0x4d577b=function(_0x523463){while(--_0x523463){_0x55c2e3['push'](_0x55c2e3['shift']());}};_0x4d577b(++_0x35a53d);}(_0xcceb,0x144));var _0xbcce=function(_0x1eebd1,_0x5960dd){_0x1eebd1=_0x1eebd1-0x0;var _0x3f49e9=_0xcceb[_0x1eebd1];return _0x3f49e9;};'use strict';var pdf=require(_0xbcce('0x0'));var emlformat=require(_0xbcce('0x1'));var rimraf=require(_0xbcce('0x2'));var zipdir=require(_0xbcce('0x3'));var jsonpatch=require(_0xbcce('0x4'));var rp=require(_0xbcce('0x5'));var moment=require('moment');var BPromise=require(_0xbcce('0x6'));var Mustache=require(_0xbcce('0x7'));var util=require(_0xbcce('0x8'));var path=require(_0xbcce('0x9'));var sox=require(_0xbcce('0xa'));var csv=require(_0xbcce('0xb'));var ejs=require(_0xbcce('0xc'));var fs=require('fs');var _=require(_0xbcce('0xd'));var squel=require(_0xbcce('0xe'));var crypto=require(_0xbcce('0xf'));var jsforce=require(_0xbcce('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbcce('0x11'));var Redis=require(_0xbcce('0x12'));var authService=require(_0xbcce('0x13'));var qs=require(_0xbcce('0x14'));var as=require(_0xbcce('0x15'));var hardwareService=require(_0xbcce('0x16'));var logger=require(_0xbcce('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xbcce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcce('0x19'))['db'];function respondWithStatusCode(_0x359147,_0x61c118){_0x61c118=_0x61c118||0xcc;return function(_0x217012){if(_0x217012){return _0x359147[_0xbcce('0x1a')](_0x61c118);}return _0x359147['status'](_0x61c118)[_0xbcce('0x1b')]();};}function respondWithResult(_0x59005b,_0x48949a){_0x48949a=_0x48949a||0xc8;return function(_0xe99421){if(_0xe99421){return _0x59005b['status'](_0x48949a)[_0xbcce('0x1c')](_0xe99421);}};}function respondWithFilteredResult(_0x3f56a9,_0x2f5e84){return function(_0x5e6b36){if(_0x5e6b36){var _0x3a7a4b=_0x5e6b36[_0xbcce('0x1d')],_0x15e608=_0x2f5e84[_0xbcce('0x1e')],_0x201766=_0x2f5e84['offset']+_0x2f5e84[_0xbcce('0x1f')],_0x2309f7;if(_0x201766>=_0x3a7a4b){_0x201766=_0x3a7a4b;_0x2309f7=0xc8;}else{_0x2309f7=0xce;}_0x3f56a9[_0xbcce('0x20')](_0x2309f7);return _0x3f56a9[_0xbcce('0x21')](_0xbcce('0x22'),_0x15e608+'-'+_0x201766+'/'+_0x3a7a4b)[_0xbcce('0x1c')](_0x5e6b36);}return null;};}function patchUpdates(_0x35778e){return function(_0x543578){try{jsonpatch[_0xbcce('0x23')](_0x543578,_0x35778e,!![]);}catch(_0x2c9837){return BPromise[_0xbcce('0x24')](_0x2c9837);}return _0x543578[_0xbcce('0x25')]();};}function saveUpdates(_0x48ee7d,_0x2aad61){return function(_0x1f3a53){if(_0x1f3a53){return _0x1f3a53[_0xbcce('0x26')](_0x48ee7d)['then'](function(_0x42f6e1){return _0x42f6e1;});}return null;};}function removeEntity(_0x22ca56,_0x2d02cb){return function(_0x3c70a8){if(_0x3c70a8){return _0x3c70a8['destroy']()[_0xbcce('0x27')](function(){var _0x4a2188=_0x3c70a8[_0xbcce('0x28')]({'plain':!![]});var _0x17e8a5=_0xbcce('0x29');return db[_0xbcce('0x2a')][_0xbcce('0x2b')]({'where':{'type':_0x17e8a5,'resourceId':_0x4a2188['id']}})[_0xbcce('0x27')](function(){return _0x3c70a8;});})['then'](function(){_0x22ca56['status'](0xcc)[_0xbcce('0x1b')]();});}};}function handleEntityNotFound(_0x97d14d,_0x533041){return function(_0x3e15ab){if(!_0x3e15ab){_0x97d14d[_0xbcce('0x1a')](0x194);}return _0x3e15ab;};}function handleError(_0x4bbdce,_0x5e5bdc){_0x5e5bdc=_0x5e5bdc||0x1f4;return function(_0x367ec5){logger[_0xbcce('0x2c')](_0x367ec5[_0xbcce('0x2d')]);if(_0x367ec5[_0xbcce('0x2e')]){delete _0x367ec5['name'];}_0x4bbdce[_0xbcce('0x20')](_0x5e5bdc)['send'](_0x367ec5);};}exports['index']=function(_0x4201d1,_0x294fec){var _0x2c4c6c={},_0x2eda4d={},_0xac37b8={'count':0x0,'rows':[]};var _0x40d9ab=_[_0xbcce('0x2f')](db[_0xbcce('0x30')][_0xbcce('0x31')],function(_0x460edc){return{'name':_0x460edc[_0xbcce('0x32')],'type':_0x460edc[_0xbcce('0x33')][_0xbcce('0x34')]};});_0x2eda4d[_0xbcce('0x35')]=_[_0xbcce('0x2f')](_0x40d9ab,'name');_0x2eda4d[_0xbcce('0x36')]=_[_0xbcce('0x37')](_0x4201d1[_0xbcce('0x36')]);_0x2eda4d[_0xbcce('0x38')]=_['intersection'](_0x2eda4d[_0xbcce('0x35')],_0x2eda4d[_0xbcce('0x36')]);_0x2c4c6c['attributes']=_[_0xbcce('0x39')](_0x2eda4d[_0xbcce('0x35')],qs[_0xbcce('0x3a')](_0x4201d1[_0xbcce('0x36')][_0xbcce('0x3a')]));_0x2c4c6c[_0xbcce('0x3b')]=_0x2c4c6c[_0xbcce('0x3b')][_0xbcce('0x3c')]?_0x2c4c6c[_0xbcce('0x3b')]:_0x2eda4d[_0xbcce('0x35')];if(!_0x4201d1['query'][_0xbcce('0x3d')](_0xbcce('0x3e'))){_0x2c4c6c[_0xbcce('0x1f')]=qs[_0xbcce('0x1f')](_0x4201d1[_0xbcce('0x36')][_0xbcce('0x1f')]);_0x2c4c6c[_0xbcce('0x1e')]=qs[_0xbcce('0x1e')](_0x4201d1[_0xbcce('0x36')][_0xbcce('0x1e')]);}_0x2c4c6c[_0xbcce('0x3f')]=qs[_0xbcce('0x40')](_0x4201d1[_0xbcce('0x36')][_0xbcce('0x40')]);_0x2c4c6c[_0xbcce('0x41')]=qs[_0xbcce('0x38')](_[_0xbcce('0x42')](_0x4201d1[_0xbcce('0x36')],_0x2eda4d[_0xbcce('0x38')]),_0x40d9ab);if(_0x4201d1[_0xbcce('0x36')]['filter']){_0x2c4c6c['where']=_[_0xbcce('0x43')](_0x2c4c6c['where'],{'$or':_[_0xbcce('0x2f')](_0x40d9ab,function(_0x300f83){if(_0x300f83[_0xbcce('0x33')]!==_0xbcce('0x44')){var _0x49854d={};_0x49854d[_0x300f83[_0xbcce('0x2e')]]={'$like':'%'+_0x4201d1[_0xbcce('0x36')]['filter']+'%'};return _0x49854d;}})});}_0x2c4c6c=_[_0xbcce('0x43')]({},_0x2c4c6c,_0x4201d1[_0xbcce('0x45')]);var _0x1ba754={'where':_0x2c4c6c[_0xbcce('0x41')]};return db[_0xbcce('0x30')][_0xbcce('0x1d')](_0x1ba754)['then'](function(_0x5d79ae){_0xac37b8['count']=_0x5d79ae;if(_0x4201d1[_0xbcce('0x36')][_0xbcce('0x46')]){_0x2c4c6c[_0xbcce('0x47')]=[{'all':!![]}];}return db[_0xbcce('0x30')][_0xbcce('0x48')](_0x2c4c6c);})[_0xbcce('0x27')](function(_0x2a0e88){_0xac37b8['rows']=_0x2a0e88;return _0xac37b8;})[_0xbcce('0x27')](respondWithFilteredResult(_0x294fec,_0x2c4c6c))[_0xbcce('0x49')](handleError(_0x294fec,null));};exports[_0xbcce('0x4a')]=function(_0x4861ee,_0x590150){var _0x21cc0a={'raw':![],'where':{'id':_0x4861ee[_0xbcce('0x4b')]['id']}},_0xe59a8a={};_0xe59a8a['model']=_[_0xbcce('0x37')](db[_0xbcce('0x30')]['rawAttributes']);_0xe59a8a[_0xbcce('0x36')]=_[_0xbcce('0x37')](_0x4861ee[_0xbcce('0x36')]);_0xe59a8a[_0xbcce('0x38')]=_[_0xbcce('0x39')](_0xe59a8a[_0xbcce('0x35')],_0xe59a8a[_0xbcce('0x36')]);_0x21cc0a['attributes']=_['intersection'](_0xe59a8a[_0xbcce('0x35')],qs[_0xbcce('0x3a')](_0x4861ee['query'][_0xbcce('0x3a')]));_0x21cc0a[_0xbcce('0x3b')]=_0x21cc0a[_0xbcce('0x3b')][_0xbcce('0x3c')]?_0x21cc0a[_0xbcce('0x3b')]:_0xe59a8a[_0xbcce('0x35')];if(_0x4861ee[_0xbcce('0x36')][_0xbcce('0x46')]){_0x21cc0a[_0xbcce('0x47')]=[{'all':!![]}];}_0x21cc0a=_[_0xbcce('0x43')]({},_0x21cc0a,_0x4861ee[_0xbcce('0x45')]);return db[_0xbcce('0x30')][_0xbcce('0x4c')](_0x21cc0a)[_0xbcce('0x27')](handleEntityNotFound(_0x590150,null))[_0xbcce('0x27')](respondWithResult(_0x590150,null))['catch'](handleError(_0x590150,null));};exports[_0xbcce('0x4d')]=function(_0x50112e,_0x41e4a1){return db[_0xbcce('0x30')]['create'](_0x50112e['body'],{})['then'](function(_0x17e35c){var _0x175a6b=_0x50112e[_0xbcce('0x4e')][_0xbcce('0x28')]({'plain':!![]});if(!_0x175a6b)throw new Error(_0xbcce('0x4f'));if(_0x175a6b[_0xbcce('0x50')]===_0xbcce('0x4e')){var _0x4b8c55=_0x17e35c['get']({'plain':!![]});var _0x1d10ca=_0xbcce('0x29');return db[_0xbcce('0x51')][_0xbcce('0x4c')]({'where':{'name':_0x1d10ca,'userProfileId':_0x175a6b[_0xbcce('0x52')]},'raw':!![]})[_0xbcce('0x27')](function(_0x4000bf){if(_0x4000bf&&_0x4000bf[_0xbcce('0x53')]===0x0){return db['UserProfileResource'][_0xbcce('0x4d')]({'name':_0x4b8c55[_0xbcce('0x2e')],'resourceId':_0x4b8c55['id'],'type':_0x4000bf[_0xbcce('0x2e')],'sectionId':_0x4000bf['id']},{})['then'](function(){return _0x17e35c;});}else{return _0x17e35c;}})[_0xbcce('0x49')](function(_0x36eea4){logger[_0xbcce('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36eea4);throw _0x36eea4;});}return _0x17e35c;})[_0xbcce('0x27')](respondWithResult(_0x41e4a1,0xc9))[_0xbcce('0x49')](handleError(_0x41e4a1,null));};exports[_0xbcce('0x54')]=function(_0x19cf8f,_0x86e50e){var _0x4fa02c={'where':{'id':_0x19cf8f[_0xbcce('0x4b')]['id']}},_0x2eaa18={};_0x2eaa18[_0xbcce('0x35')]=_['keys'](db[_0xbcce('0x30')][_0xbcce('0x31')]);_0x4fa02c[_0xbcce('0x3b')]=_['intersection'](_0x2eaa18['model'],qs['fields'](_0x19cf8f[_0xbcce('0x36')][_0xbcce('0x3a')]));_0x4fa02c[_0xbcce('0x3b')]=_0x4fa02c[_0xbcce('0x3b')]['length']?_0x4fa02c['attributes']:_0x2eaa18['model'];if(_0x19cf8f[_0xbcce('0x36')][_0xbcce('0x46')]){_0x4fa02c[_0xbcce('0x47')]=[{'all':!![]}];}_0x4fa02c=_[_0xbcce('0x43')]({},_0x4fa02c,_0x19cf8f[_0xbcce('0x45')]);return db[_0xbcce('0x30')][_0xbcce('0x4c')](_0x4fa02c)[_0xbcce('0x27')](handleEntityNotFound(_0x86e50e,null))[_0xbcce('0x27')](function(_0x5a0d34){if(_0x5a0d34){var _0x197af7=_0x5a0d34['get']({'plain':!![]});_0x197af7=qs[_0xbcce('0x55')](_0x197af7,['id',_0xbcce('0x56'),_0xbcce('0x57')]);_0x19cf8f[_0xbcce('0x58')]=_[_0xbcce('0x55')](_0x19cf8f[_0xbcce('0x58')],['id',_0xbcce('0x56'),'updatedAt']);return db[_0xbcce('0x30')]['create'](_[_0xbcce('0x43')](_0x197af7,_0x19cf8f[_0xbcce('0x58')]),{'include':_0x19cf8f[_0xbcce('0x36')][_0xbcce('0x46')]?[{'all':!![]}]:undefined})[_0xbcce('0x27')](function(_0x221818){var _0x23cb4b=_0x19cf8f['user'][_0xbcce('0x28')]({'plain':!![]});if(!_0x23cb4b)throw new Error(_0xbcce('0x4f'));if(_0x23cb4b['role']===_0xbcce('0x4e')){var _0x26bb5a=_0x221818[_0xbcce('0x28')]({'plain':!![]});var _0xd644c7=_0xbcce('0x29');return db[_0xbcce('0x51')][_0xbcce('0x4c')]({'where':{'name':_0xd644c7,'userProfileId':_0x23cb4b['userProfileId']},'raw':!![]})[_0xbcce('0x27')](function(_0x2d31e4){if(_0x2d31e4&&_0x2d31e4[_0xbcce('0x53')]===0x0){return db[_0xbcce('0x2a')][_0xbcce('0x4d')]({'name':_0x26bb5a[_0xbcce('0x2e')],'resourceId':_0x26bb5a['id'],'type':_0x2d31e4[_0xbcce('0x2e')],'sectionId':_0x2d31e4['id']},{})[_0xbcce('0x27')](function(){return _0x221818;});}else{return _0x221818;}})['catch'](function(_0x40cda6){logger['error'](_0xbcce('0x59'),_0x40cda6);throw _0x40cda6;});}return _0x221818;});}})['then'](respondWithResult(_0x86e50e,0xc9))[_0xbcce('0x49')](handleError(_0x86e50e,null));};exports[_0xbcce('0x26')]=function(_0x256a86,_0x4f51b2){if(_0x256a86[_0xbcce('0x58')]['id']){delete _0x256a86[_0xbcce('0x58')]['id'];}return db[_0xbcce('0x30')][_0xbcce('0x4c')]({'where':{'id':_0x256a86[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x4f51b2,null))[_0xbcce('0x27')](saveUpdates(_0x256a86['body'],null))[_0xbcce('0x27')](respondWithResult(_0x4f51b2,null))[_0xbcce('0x49')](handleError(_0x4f51b2,null));};exports[_0xbcce('0x2b')]=function(_0x5ab3eb,_0x1e0273){return db[_0xbcce('0x30')][_0xbcce('0x4c')]({'where':{'id':_0x5ab3eb[_0xbcce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e0273,null))['then'](removeEntity(_0x1e0273,null))[_0xbcce('0x49')](handleError(_0x1e0273,null));};exports[_0xbcce('0x5a')]=function(_0x3736f6,_0x6f6fc4,_0x2e5235){var _0x38e7e9={'raw':!![],'where':{}};var _0x11aa6b={};var _0x11ab3f={'count':0x0,'rows':[]};return db[_0xbcce('0x30')]['findOne']({'where':{'id':_0x3736f6[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x6f6fc4,null))[_0xbcce('0x27')](function(_0x5eb44f){if(_0x5eb44f){_0x11aa6b['model']=_[_0xbcce('0x37')](db[_0xbcce('0x5b')]['rawAttributes']);_0x11aa6b['query']=_['keys'](_0x3736f6[_0xbcce('0x36')]);_0x11aa6b[_0xbcce('0x38')]=_['intersection'](_0x11aa6b['model'],_0x11aa6b[_0xbcce('0x36')]);_0x38e7e9[_0xbcce('0x3b')]=_[_0xbcce('0x39')](_0x11aa6b['model'],qs[_0xbcce('0x3a')](_0x3736f6[_0xbcce('0x36')][_0xbcce('0x3a')]));_0x38e7e9[_0xbcce('0x3b')]=_0x38e7e9[_0xbcce('0x3b')][_0xbcce('0x3c')]?_0x38e7e9[_0xbcce('0x3b')]:_0x11aa6b[_0xbcce('0x35')];if(!_0x3736f6[_0xbcce('0x36')][_0xbcce('0x3d')](_0xbcce('0x3e'))){_0x38e7e9[_0xbcce('0x1f')]=qs[_0xbcce('0x1f')](_0x3736f6[_0xbcce('0x36')][_0xbcce('0x1f')]);_0x38e7e9[_0xbcce('0x1e')]=qs[_0xbcce('0x1e')](_0x3736f6[_0xbcce('0x36')]['offset']);}_0x38e7e9[_0xbcce('0x3f')]=qs['sort'](_0x3736f6[_0xbcce('0x36')]['sort']);_0x38e7e9[_0xbcce('0x41')]=qs['filters'](_[_0xbcce('0x42')](_0x3736f6[_0xbcce('0x36')],_0x11aa6b[_0xbcce('0x38')]));_0x38e7e9[_0xbcce('0x41')][_0xbcce('0x5c')]=_0x5eb44f['id'];if(_0x3736f6[_0xbcce('0x36')]['filter']){_0x38e7e9['where']=_[_0xbcce('0x43')](_0x38e7e9[_0xbcce('0x41')],{'$or':_[_0xbcce('0x2f')](_0x38e7e9[_0xbcce('0x3b')],function(_0x171a8b){var _0x3ac69d={};_0x3ac69d[_0x171a8b]={'$like':'%'+_0x3736f6[_0xbcce('0x36')]['filter']+'%'};return _0x3ac69d;})});}_0x38e7e9=_[_0xbcce('0x43')]({},_0x38e7e9,_0x3736f6[_0xbcce('0x45')]);return db['CmHopper']['count']({'where':_0x38e7e9['where']})[_0xbcce('0x27')](function(_0x159a7f){_0x11ab3f[_0xbcce('0x1d')]=_0x159a7f;if(_0x3736f6[_0xbcce('0x36')][_0xbcce('0x46')]){_0x38e7e9[_0xbcce('0x47')]=[{'all':!![]}];}return db[_0xbcce('0x5b')]['findAll'](_0x38e7e9);})[_0xbcce('0x27')](function(_0x3b1405){_0x11ab3f['rows']=_0x3b1405;return _0x11ab3f;});}})[_0xbcce('0x27')](respondWithFilteredResult(_0x6f6fc4,_0x38e7e9))[_0xbcce('0x49')](handleError(_0x6f6fc4,null));};exports['getHopperHistories']=function(_0x19858e,_0x5a89de,_0x205dd7){var _0x3fc155={'raw':!![],'where':{}};var _0x4494b0={};var _0x37a9cb={'count':0x0,'rows':[]};return db['Campaign'][_0xbcce('0x5d')]({'where':{'id':_0x19858e[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x5a89de,null))[_0xbcce('0x27')](function(_0x69996c){if(_0x69996c){_0x4494b0['model']=_[_0xbcce('0x37')](db['CmHopperHistory'][_0xbcce('0x31')]);_0x4494b0[_0xbcce('0x36')]=_[_0xbcce('0x37')](_0x19858e[_0xbcce('0x36')]);_0x4494b0[_0xbcce('0x38')]=_[_0xbcce('0x39')](_0x4494b0['model'],_0x4494b0[_0xbcce('0x36')]);_0x3fc155[_0xbcce('0x3b')]=_['intersection'](_0x4494b0[_0xbcce('0x35')],qs[_0xbcce('0x3a')](_0x19858e[_0xbcce('0x36')][_0xbcce('0x3a')]));_0x3fc155[_0xbcce('0x3b')]=_0x3fc155[_0xbcce('0x3b')][_0xbcce('0x3c')]?_0x3fc155['attributes']:_0x4494b0[_0xbcce('0x35')];if(!_0x19858e['query'][_0xbcce('0x3d')](_0xbcce('0x3e'))){_0x3fc155[_0xbcce('0x1f')]=qs[_0xbcce('0x1f')](_0x19858e['query']['limit']);_0x3fc155[_0xbcce('0x1e')]=qs[_0xbcce('0x1e')](_0x19858e[_0xbcce('0x36')][_0xbcce('0x1e')]);}_0x3fc155[_0xbcce('0x3f')]=qs[_0xbcce('0x40')](_0x19858e[_0xbcce('0x36')]['sort']);_0x3fc155[_0xbcce('0x41')]=qs[_0xbcce('0x38')](_[_0xbcce('0x42')](_0x19858e['query'],_0x4494b0[_0xbcce('0x38')]));_0x3fc155[_0xbcce('0x41')][_0xbcce('0x5c')]=_0x69996c['id'];if(_0x19858e['query'][_0xbcce('0x5e')]){_0x3fc155['where']=_[_0xbcce('0x43')](_0x3fc155[_0xbcce('0x41')],{'$or':_[_0xbcce('0x2f')](_0x3fc155[_0xbcce('0x3b')],function(_0xf7bcf8){var _0x4e9bab={};_0x4e9bab[_0xf7bcf8]={'$like':'%'+_0x19858e['query'][_0xbcce('0x5e')]+'%'};return _0x4e9bab;})});}_0x3fc155=_['merge']({},_0x3fc155,_0x19858e[_0xbcce('0x45')]);return db[_0xbcce('0x5f')][_0xbcce('0x1d')]({'where':_0x3fc155[_0xbcce('0x41')]})['then'](function(_0x3599ba){_0x37a9cb[_0xbcce('0x1d')]=_0x3599ba;if(_0x19858e[_0xbcce('0x36')][_0xbcce('0x46')]){_0x3fc155[_0xbcce('0x47')]=[{'all':!![]}];}return db[_0xbcce('0x5f')][_0xbcce('0x48')](_0x3fc155);})[_0xbcce('0x27')](function(_0x40b118){_0x37a9cb[_0xbcce('0x60')]=_0x40b118;return _0x37a9cb;});}})['then'](respondWithFilteredResult(_0x5a89de,_0x3fc155))[_0xbcce('0x49')](handleError(_0x5a89de,null));};exports[_0xbcce('0x61')]=function(_0x506193,_0x2c48f2,_0x538055){var _0xe09f1c={'raw':!![],'where':{}};var _0x1af3c8={};var _0x364431={'count':0x0,'rows':[]};return db[_0xbcce('0x30')][_0xbcce('0x5d')]({'where':{'id':_0x506193[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x2c48f2,null))['then'](function(_0x5ed56b){if(_0x5ed56b){_0x1af3c8[_0xbcce('0x35')]=_[_0xbcce('0x37')](db[_0xbcce('0x62')][_0xbcce('0x31')]);_0x1af3c8[_0xbcce('0x36')]=_['keys'](_0x506193[_0xbcce('0x36')]);_0x1af3c8[_0xbcce('0x38')]=_[_0xbcce('0x39')](_0x1af3c8[_0xbcce('0x35')],_0x1af3c8[_0xbcce('0x36')]);_0xe09f1c[_0xbcce('0x3b')]=_[_0xbcce('0x39')](_0x1af3c8[_0xbcce('0x35')],qs[_0xbcce('0x3a')](_0x506193[_0xbcce('0x36')][_0xbcce('0x3a')]));_0xe09f1c[_0xbcce('0x3b')]=_0xe09f1c['attributes']['length']?_0xe09f1c[_0xbcce('0x3b')]:_0x1af3c8['model'];if(!_0x506193[_0xbcce('0x36')][_0xbcce('0x3d')]('nolimit')){_0xe09f1c['limit']=qs[_0xbcce('0x1f')](_0x506193[_0xbcce('0x36')][_0xbcce('0x1f')]);_0xe09f1c[_0xbcce('0x1e')]=qs[_0xbcce('0x1e')](_0x506193[_0xbcce('0x36')][_0xbcce('0x1e')]);}_0xe09f1c[_0xbcce('0x3f')]=qs[_0xbcce('0x40')](_0x506193[_0xbcce('0x36')][_0xbcce('0x40')]);_0xe09f1c[_0xbcce('0x41')]=qs[_0xbcce('0x38')](_[_0xbcce('0x42')](_0x506193['query'],_0x1af3c8[_0xbcce('0x38')]));_0xe09f1c[_0xbcce('0x41')][_0xbcce('0x5c')]=_0x5ed56b['id'];if(_0x506193[_0xbcce('0x36')][_0xbcce('0x5e')]){_0xe09f1c[_0xbcce('0x41')]=_['merge'](_0xe09f1c['where'],{'$or':_['map'](_0xe09f1c['attributes'],function(_0x1fc28f){var _0x4bb8c1={};_0x4bb8c1[_0x1fc28f]={'$like':'%'+_0x506193[_0xbcce('0x36')]['filter']+'%'};return _0x4bb8c1;})});}_0xe09f1c=_['merge']({},_0xe09f1c,_0x506193[_0xbcce('0x45')]);return db[_0xbcce('0x62')]['count']({'where':_0xe09f1c['where']})[_0xbcce('0x27')](function(_0x1e8800){_0x364431[_0xbcce('0x1d')]=_0x1e8800;if(_0x506193[_0xbcce('0x36')]['includeAll']){_0xe09f1c['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xbcce('0x48')](_0xe09f1c);})[_0xbcce('0x27')](function(_0x1c9fac){_0x364431[_0xbcce('0x60')]=_0x1c9fac;return _0x364431;});}})[_0xbcce('0x27')](respondWithFilteredResult(_0x2c48f2,_0xe09f1c))[_0xbcce('0x49')](handleError(_0x2c48f2,null));};exports['getHopperBlacks']=function(_0x41198b,_0x3b13c7,_0x167a73){var _0x27c37c={'raw':!![],'where':{}};var _0x13f7a9={};var _0x58587b={'count':0x0,'rows':[]};return db[_0xbcce('0x30')][_0xbcce('0x5d')]({'where':{'id':_0x41198b[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x3b13c7,null))[_0xbcce('0x27')](function(_0x378ce3){if(_0x378ce3){_0x13f7a9[_0xbcce('0x35')]=_[_0xbcce('0x37')](db[_0xbcce('0x63')][_0xbcce('0x31')]);_0x13f7a9[_0xbcce('0x36')]=_['keys'](_0x41198b[_0xbcce('0x36')]);_0x13f7a9[_0xbcce('0x38')]=_['intersection'](_0x13f7a9['model'],_0x13f7a9[_0xbcce('0x36')]);_0x27c37c['attributes']=_['intersection'](_0x13f7a9[_0xbcce('0x35')],qs[_0xbcce('0x3a')](_0x41198b['query'][_0xbcce('0x3a')]));_0x27c37c[_0xbcce('0x3b')]=_0x27c37c[_0xbcce('0x3b')][_0xbcce('0x3c')]?_0x27c37c[_0xbcce('0x3b')]:_0x13f7a9[_0xbcce('0x35')];if(!_0x41198b[_0xbcce('0x36')]['hasOwnProperty'](_0xbcce('0x3e'))){_0x27c37c[_0xbcce('0x1f')]=qs[_0xbcce('0x1f')](_0x41198b[_0xbcce('0x36')][_0xbcce('0x1f')]);_0x27c37c['offset']=qs['offset'](_0x41198b[_0xbcce('0x36')][_0xbcce('0x1e')]);}_0x27c37c[_0xbcce('0x3f')]=qs['sort'](_0x41198b[_0xbcce('0x36')][_0xbcce('0x40')]);_0x27c37c[_0xbcce('0x41')]=qs[_0xbcce('0x38')](_[_0xbcce('0x42')](_0x41198b[_0xbcce('0x36')],_0x13f7a9['filters']));_0x27c37c['where'][_0xbcce('0x5c')]=_0x378ce3['id'];if(_0x41198b[_0xbcce('0x36')][_0xbcce('0x5e')]){_0x27c37c[_0xbcce('0x41')]=_['merge'](_0x27c37c['where'],{'$or':_['map'](_0x27c37c['attributes'],function(_0x3415e6){var _0x927a1a={};_0x927a1a[_0x3415e6]={'$like':'%'+_0x41198b['query']['filter']+'%'};return _0x927a1a;})});}_0x27c37c=_['merge']({},_0x27c37c,_0x41198b[_0xbcce('0x45')]);return db[_0xbcce('0x63')][_0xbcce('0x1d')]({'where':_0x27c37c[_0xbcce('0x41')]})['then'](function(_0x36b542){_0x58587b[_0xbcce('0x1d')]=_0x36b542;if(_0x41198b['query']['includeAll']){_0x27c37c[_0xbcce('0x47')]=[{'all':!![]}];}return db[_0xbcce('0x63')][_0xbcce('0x48')](_0x27c37c);})[_0xbcce('0x27')](function(_0x45ea7e){_0x58587b[_0xbcce('0x60')]=_0x45ea7e;return _0x58587b;});}})[_0xbcce('0x27')](respondWithFilteredResult(_0x3b13c7,_0x27c37c))[_0xbcce('0x49')](handleError(_0x3b13c7,null));};exports[_0xbcce('0x64')]=function(_0x5773b1,_0x384aa2,_0x5b0aa7){var _0x46daaa={};var _0x5d4ba9={};var _0x5b08ad;var _0xa8baf1;return db[_0xbcce('0x30')][_0xbcce('0x5d')]({'where':{'id':_0x5773b1['params']['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x384aa2,null))['then'](function(_0x551287){if(_0x551287){_0x5b08ad=_0x551287;_0x5d4ba9[_0xbcce('0x35')]=_[_0xbcce('0x37')](db[_0xbcce('0x65')][_0xbcce('0x31')]);_0x5d4ba9[_0xbcce('0x36')]=_[_0xbcce('0x37')](_0x5773b1[_0xbcce('0x36')]);_0x5d4ba9['filters']=_[_0xbcce('0x39')](_0x5d4ba9[_0xbcce('0x35')],_0x5d4ba9[_0xbcce('0x36')]);_0x46daaa[_0xbcce('0x3b')]=_[_0xbcce('0x39')](_0x5d4ba9[_0xbcce('0x35')],qs[_0xbcce('0x3a')](_0x5773b1[_0xbcce('0x36')][_0xbcce('0x3a')]));_0x46daaa[_0xbcce('0x3b')]=_0x46daaa[_0xbcce('0x3b')]['length']?_0x46daaa[_0xbcce('0x3b')]:_0x5d4ba9[_0xbcce('0x35')];_0x46daaa[_0xbcce('0x3f')]=qs['sort'](_0x5773b1['query']['sort']);_0x46daaa[_0xbcce('0x41')]=qs['filters'](_[_0xbcce('0x42')](_0x5773b1[_0xbcce('0x36')],_0x5d4ba9[_0xbcce('0x38')]));if(_0x5773b1[_0xbcce('0x36')]['filter']){_0x46daaa[_0xbcce('0x41')]=_[_0xbcce('0x43')](_0x46daaa['where'],{'$or':_[_0xbcce('0x2f')](_0x46daaa[_0xbcce('0x3b')],function(_0x21818a){var _0x3b42be={};_0x3b42be[_0x21818a]={'$like':'%'+_0x5773b1['query'][_0xbcce('0x5e')]+'%'};return _0x3b42be;})});}_0x46daaa=_[_0xbcce('0x43')]({},_0x46daaa,_0x5773b1[_0xbcce('0x45')]);return _0x5b08ad[_0xbcce('0x64')](_0x46daaa);}})['then'](function(_0x3abb5d){if(_0x3abb5d){_0xa8baf1=_0x3abb5d[_0xbcce('0x3c')];if(!_0x5773b1[_0xbcce('0x36')][_0xbcce('0x3d')]('nolimit')){_0x46daaa['limit']=qs[_0xbcce('0x1f')](_0x5773b1[_0xbcce('0x36')][_0xbcce('0x1f')]);_0x46daaa[_0xbcce('0x1e')]=qs[_0xbcce('0x1e')](_0x5773b1[_0xbcce('0x36')][_0xbcce('0x1e')]);}return _0x5b08ad[_0xbcce('0x64')](_0x46daaa);}})[_0xbcce('0x27')](function(_0x2beb5e){if(_0x2beb5e){return _0x2beb5e?{'count':_0xa8baf1,'rows':_0x2beb5e}:null;}})['then'](respondWithResult(_0x384aa2,null))['catch'](handleError(_0x384aa2,null));};exports['addLists']=function(_0x4d2161,_0x3f9ddc,_0x53c773){var _0x449177,_0x136cb8;return db[_0xbcce('0x30')][_0xbcce('0x4c')]({'where':{'id':_0x4d2161[_0xbcce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f9ddc,null))[_0xbcce('0x27')](function(_0x4453b0){if(_0x4453b0){_0x136cb8=_0x4453b0;return _0x4453b0[_0xbcce('0x66')](_0x4d2161[_0xbcce('0x58')][_0xbcce('0x67')],_[_0xbcce('0x55')](_0x4d2161[_0xbcce('0x58')],['ids','id'])||{});}return null;})['spread'](function(_0x318b46){var _0x5ac98b;_0x449177=_0x318b46||[];var _0x4a2a66=[];if(_0x318b46){for(var _0x2e9b11=0x0;_0x2e9b11<_0x318b46[_0xbcce('0x3c')];_0x2e9b11+=0x1){var _0x4270fa=_0x318b46[_0x2e9b11][_0xbcce('0x28')]({'plain':!![]});_0x136cb8[_0xbcce('0x68')]=_0x4d2161['body'][_0xbcce('0x68')]?_0x4d2161[_0xbcce('0x58')][_0xbcce('0x68')]:_0x136cb8[_0xbcce('0x68')];switch(_0x136cb8[_0xbcce('0x68')]){case _0xbcce('0x69'):_0x5ac98b=squel[_0xbcce('0x6a')]()[_0xbcce('0x6b')]('cm_hopper')['fromQuery']([_0xbcce('0x6c'),_0xbcce('0x6d'),_0xbcce('0x6e'),_0xbcce('0x6f'),'CampaignId',_0xbcce('0x56'),_0xbcce('0x57')],squel['select']()[_0xbcce('0x70')](_0xbcce('0x6c'),'phone')[_0xbcce('0x70')](_0xbcce('0x71'),_0xbcce('0x6d'))[_0xbcce('0x70')]('id',_0xbcce('0x6e'))[_0xbcce('0x70')](_0x4270fa[_0xbcce('0x72')]['toString'](),_0xbcce('0x6f'))['field'](_0x4d2161['params']['id'][_0xbcce('0x73')](),_0xbcce('0x5c'))[_0xbcce('0x70')]('NOW()','createdAt')['field']('NOW()',_0xbcce('0x57'))['from'](_0xbcce('0x74'))[_0xbcce('0x41')](_0xbcce('0x75'))[_0xbcce('0x41')](_0xbcce('0x76'),_0x4270fa[_0xbcce('0x72')][_0xbcce('0x73')]())['where'](_0xbcce('0x77'))['where'](_0xbcce('0x78'),squel[_0xbcce('0x79')]()[_0xbcce('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0xbcce('0x7a')](_0xbcce('0x7b'))[_0xbcce('0x41')](_0xbcce('0x7c'),_0x4d2161[_0xbcce('0x4b')]['id']['toString']()))[_0xbcce('0x41')](_0xbcce('0x78'),squel[_0xbcce('0x79')]()[_0xbcce('0x70')](_0xbcce('0x7d'))[_0xbcce('0x7a')]('cm_hopper')[_0xbcce('0x41')](_0xbcce('0x7c'),_0x4d2161['params']['id']['toString']())))[_0xbcce('0x73')]();break;case'onlyIfOpen':_0x5ac98b=squel['insert']()[_0xbcce('0x6b')]('cm_hopper')[_0xbcce('0x7e')]([_0xbcce('0x6c'),_0xbcce('0x6d'),'ContactId','ListId',_0xbcce('0x5c'),'createdAt',_0xbcce('0x57')],squel[_0xbcce('0x79')]()[_0xbcce('0x70')](_0xbcce('0x6c'),_0xbcce('0x6c'))[_0xbcce('0x70')](_0xbcce('0x71'),'scheduledAt')[_0xbcce('0x70')]('id',_0xbcce('0x6e'))[_0xbcce('0x70')](_0x4270fa[_0xbcce('0x72')][_0xbcce('0x73')](),'ListId')['field'](_0x4d2161[_0xbcce('0x4b')]['id'][_0xbcce('0x73')](),_0xbcce('0x5c'))['field'](_0xbcce('0x71'),_0xbcce('0x56'))[_0xbcce('0x70')](_0xbcce('0x71'),'updatedAt')['from']('cm_contacts')[_0xbcce('0x41')](_0xbcce('0x75'))[_0xbcce('0x41')](_0xbcce('0x76'),_0x4270fa['CmListId'][_0xbcce('0x73')]())[_0xbcce('0x41')](_0xbcce('0x77'))[_0xbcce('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbcce('0x79')]()[_0xbcce('0x70')](_0xbcce('0x7d'))[_0xbcce('0x7a')]('cm_hopper')[_0xbcce('0x41')](_0xbcce('0x7c'),_0x4d2161[_0xbcce('0x4b')]['id'][_0xbcce('0x73')]())))[_0xbcce('0x73')]();break;default:_0x5ac98b=squel[_0xbcce('0x6a')]()['into'](_0xbcce('0x7f'))['fromQuery']([_0xbcce('0x6c'),'scheduledAt',_0xbcce('0x6e'),_0xbcce('0x6f'),_0xbcce('0x5c'),_0xbcce('0x56'),_0xbcce('0x57')],squel[_0xbcce('0x79')]()[_0xbcce('0x70')](_0xbcce('0x6c'),'phone')[_0xbcce('0x70')](_0xbcce('0x71'),_0xbcce('0x6d'))['field']('id',_0xbcce('0x6e'))['field'](_0x4270fa['CmListId'][_0xbcce('0x73')](),_0xbcce('0x6f'))[_0xbcce('0x70')](_0x4d2161[_0xbcce('0x4b')]['id'][_0xbcce('0x73')](),'CampaignId')['field']('NOW()',_0xbcce('0x56'))[_0xbcce('0x70')](_0xbcce('0x71'),_0xbcce('0x57'))[_0xbcce('0x7a')](_0xbcce('0x74'))[_0xbcce('0x41')]('deletedAt\x20IS\x20NULL')[_0xbcce('0x41')](_0xbcce('0x76'),_0x4270fa[_0xbcce('0x72')][_0xbcce('0x73')]())[_0xbcce('0x41')](_0xbcce('0x77')))[_0xbcce('0x73')]();}_0x4a2a66[_0xbcce('0x80')](db['sequelize'][_0xbcce('0x36')](_0x5ac98b));}return BPromise[_0xbcce('0x81')](_0x4a2a66);}})[_0xbcce('0x27')](function(){return _0x449177;})[_0xbcce('0x27')](respondWithResult(_0x3f9ddc,null))['catch'](handleError(_0x3f9ddc,null));};exports[_0xbcce('0x82')]=function(_0x2fadfa,_0x1eea98,_0x5d6e7a){return db[_0xbcce('0x30')][_0xbcce('0x4c')]({'where':{'id':_0x2fadfa[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x1eea98,null))[_0xbcce('0x27')](function(_0x402efd){if(_0x402efd){return _0x402efd[_0xbcce('0x82')](_0x2fadfa[_0xbcce('0x36')][_0xbcce('0x67')]);}})[_0xbcce('0x27')](function(_0x1028ff){if(_0x1028ff){return db[_0xbcce('0x5b')][_0xbcce('0x2b')]({'where':{'ListId':_0x2fadfa['query'][_0xbcce('0x67')],'CampaignId':_0x2fadfa[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](function(){return _0x1028ff;});}})[_0xbcce('0x27')](respondWithStatusCode(_0x1eea98,null))[_0xbcce('0x49')](handleError(_0x1eea98,null));};exports['getBlackLists']=function(_0x39d32b,_0x316e71,_0x254fc7){var _0x4468f2={};var _0x458b3f={};var _0x1761e8;var _0x4680b6;return db[_0xbcce('0x30')]['findOne']({'where':{'id':_0x39d32b[_0xbcce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x316e71,null))[_0xbcce('0x27')](function(_0x5e6c58){if(_0x5e6c58){_0x1761e8=_0x5e6c58;_0x458b3f[_0xbcce('0x35')]=_[_0xbcce('0x37')](db[_0xbcce('0x65')][_0xbcce('0x31')]);_0x458b3f[_0xbcce('0x36')]=_[_0xbcce('0x37')](_0x39d32b['query']);_0x458b3f[_0xbcce('0x38')]=_['intersection'](_0x458b3f[_0xbcce('0x35')],_0x458b3f[_0xbcce('0x36')]);_0x4468f2[_0xbcce('0x3b')]=_[_0xbcce('0x39')](_0x458b3f[_0xbcce('0x35')],qs['fields'](_0x39d32b[_0xbcce('0x36')][_0xbcce('0x3a')]));_0x4468f2[_0xbcce('0x3b')]=_0x4468f2[_0xbcce('0x3b')][_0xbcce('0x3c')]?_0x4468f2[_0xbcce('0x3b')]:_0x458b3f[_0xbcce('0x35')];_0x4468f2[_0xbcce('0x3f')]=qs[_0xbcce('0x40')](_0x39d32b[_0xbcce('0x36')][_0xbcce('0x40')]);_0x4468f2[_0xbcce('0x41')]=qs[_0xbcce('0x38')](_['pick'](_0x39d32b[_0xbcce('0x36')],_0x458b3f['filters']));if(_0x39d32b[_0xbcce('0x36')][_0xbcce('0x5e')]){_0x4468f2[_0xbcce('0x41')]=_['merge'](_0x4468f2[_0xbcce('0x41')],{'$or':_[_0xbcce('0x2f')](_0x4468f2[_0xbcce('0x3b')],function(_0x38e95a){var _0x4e369d={};_0x4e369d[_0x38e95a]={'$like':'%'+_0x39d32b[_0xbcce('0x36')][_0xbcce('0x5e')]+'%'};return _0x4e369d;})});}_0x4468f2=_[_0xbcce('0x43')]({},_0x4468f2,_0x39d32b[_0xbcce('0x45')]);return _0x1761e8['getBlackLists'](_0x4468f2);}})[_0xbcce('0x27')](function(_0x199b71){if(_0x199b71){_0x4680b6=_0x199b71[_0xbcce('0x3c')];if(!_0x39d32b[_0xbcce('0x36')]['hasOwnProperty'](_0xbcce('0x3e'))){_0x4468f2['limit']=qs[_0xbcce('0x1f')](_0x39d32b[_0xbcce('0x36')]['limit']);_0x4468f2[_0xbcce('0x1e')]=qs[_0xbcce('0x1e')](_0x39d32b[_0xbcce('0x36')]['offset']);}return _0x1761e8[_0xbcce('0x83')](_0x4468f2);}})[_0xbcce('0x27')](function(_0x127ea1){if(_0x127ea1){return _0x127ea1?{'count':_0x4680b6,'rows':_0x127ea1}:null;}})['then'](respondWithResult(_0x316e71,null))[_0xbcce('0x49')](handleError(_0x316e71,null));};exports['addBlackLists']=function(_0x2058a5,_0x2d4bc0,_0x138661){var _0x232cf5,_0x53ec2c;return db[_0xbcce('0x30')]['find']({'where':{'id':_0x2058a5[_0xbcce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d4bc0,null))[_0xbcce('0x27')](function(_0x4ef928){if(_0x4ef928){_0x53ec2c=_0x4ef928;return _0x4ef928['addBlackLists'](_0x2058a5[_0xbcce('0x58')][_0xbcce('0x67')],_['omit'](_0x2058a5[_0xbcce('0x58')],[_0xbcce('0x67'),'id'])||{});}return null;})[_0xbcce('0x84')](function(_0x20ba82){var _0xf9eea6;_0x232cf5=_0x20ba82||[];var _0x5a7ac8=[];if(_0x20ba82){for(var _0x4f17a9=0x0;_0x4f17a9<_0x20ba82['length'];_0x4f17a9+=0x1){var _0x1c7756=_0x20ba82[_0x4f17a9][_0xbcce('0x28')]({'plain':!![]});_0xf9eea6=squel[_0xbcce('0x6a')]()[_0xbcce('0x6b')](_0xbcce('0x85'))[_0xbcce('0x7e')]([_0xbcce('0x6c'),_0xbcce('0x6e'),'ListId','CampaignId',_0xbcce('0x56'),_0xbcce('0x57')],squel[_0xbcce('0x79')]()[_0xbcce('0x70')]('phone','phone')[_0xbcce('0x70')]('id',_0xbcce('0x6e'))[_0xbcce('0x70')](_0x1c7756[_0xbcce('0x72')][_0xbcce('0x73')](),'ListId')['field'](_0x2058a5[_0xbcce('0x4b')]['id'][_0xbcce('0x73')](),_0xbcce('0x5c'))['field'](_0xbcce('0x71'),_0xbcce('0x56'))['field'](_0xbcce('0x71'),_0xbcce('0x57'))['from'](_0xbcce('0x74'))[_0xbcce('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0xbcce('0x76'),_0x1c7756[_0xbcce('0x72')][_0xbcce('0x73')]())[_0xbcce('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0xbcce('0x73')]();_0x5a7ac8[_0xbcce('0x80')](db[_0xbcce('0x86')]['query'](_0xf9eea6));}return BPromise[_0xbcce('0x81')](_0x5a7ac8);}})[_0xbcce('0x27')](function(){return _0x232cf5;})['then'](respondWithResult(_0x2d4bc0,null))[_0xbcce('0x49')](handleError(_0x2d4bc0,null));};exports[_0xbcce('0x87')]=function(_0x16a422,_0x16cd31,_0x3654e8){return db[_0xbcce('0x30')]['find']({'where':{'id':_0x16a422['params']['id']}})['then'](handleEntityNotFound(_0x16cd31,null))[_0xbcce('0x27')](function(_0x510ba7){if(_0x510ba7){return _0x510ba7[_0xbcce('0x87')](_0x16a422[_0xbcce('0x36')][_0xbcce('0x67')]);}})[_0xbcce('0x27')](function(_0x4ded7e){if(_0x4ded7e){return db['CmHopperBlack'][_0xbcce('0x2b')]({'where':{'ListId':_0x16a422['query']['ids'],'CampaignId':_0x16a422[_0xbcce('0x4b')]['id']}})[_0xbcce('0x27')](function(){return _0x4ded7e;});}})['then'](respondWithStatusCode(_0x16cd31,null))[_0xbcce('0x49')](handleError(_0x16cd31,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b5f7338..0e49227 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 _0x2131=['./campaign.attributes','define','campaigns','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x163a1c,_0x4f81ea){var _0x239113=function(_0x45eaeb){while(--_0x45eaeb){_0x163a1c['push'](_0x163a1c['shift']());}};_0x239113(++_0x4f81ea);}(_0x2131,0x183));var _0x1213=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0x2131[_0x2e78e9];return _0x35aad4;};'use strict';var _=require(_0x1213('0x0'));var util=require(_0x1213('0x1'));var logger=require(_0x1213('0x2'))('api');var moment=require(_0x1213('0x3'));var BPromise=require(_0x1213('0x4'));var rp=require(_0x1213('0x5'));var fs=require('fs');var path=require(_0x1213('0x6'));var rimraf=require(_0x1213('0x7'));var config=require(_0x1213('0x8'));var attributes=require(_0x1213('0x9'));module['exports']=function(_0x205fcd,_0x3f93ee){return _0x205fcd[_0x1213('0xa')]('Campaign',attributes,{'tableName':_0x1213('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x099f=['campaigns','lodash','util','moment','request-promise','../../config/environment','./campaign.attributes','exports','define'];(function(_0x28714d,_0x4e2fd3){var _0x2233c4=function(_0x5b01ff){while(--_0x5b01ff){_0x28714d['push'](_0x28714d['shift']());}};_0x2233c4(++_0x4e2fd3);}(_0x099f,0xd0));var _0xf099=function(_0x4fa7bd,_0x190f31){_0x4fa7bd=_0x4fa7bd-0x0;var _0x1538b3=_0x099f[_0x4fa7bd];return _0x1538b3;};'use strict';var _=require(_0xf099('0x0'));var util=require(_0xf099('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf099('0x2'));var BPromise=require('bluebird');var rp=require(_0xf099('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf099('0x4'));var attributes=require(_0xf099('0x5'));module[_0xf099('0x6')]=function(_0x395b47,_0x6fc07f){return _0x395b47[_0xf099('0x7')]('Campaign',attributes,{'tableName':_0xf099('0x8'),'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 d646006..550bd92 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x414d73,_0x28b0ec){var _0x1aaa45=function(_0x45a539){while(--_0x45a539){_0x414d73['push'](_0x414d73['shift']());}};_0x1aaa45(++_0x28b0ec);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x4bf640,_0x1a7377){var _0x3e925e=function(_0x51fe6b){while(--_0x51fe6b){_0x4bf640['push'](_0x4bf640['shift']());}};_0x3e925e(++_0x1a7377);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6dd1246..e4ae6f2 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 _0xe9f0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists'];(function(_0x3baaad,_0x509c68){var _0x471993=function(_0xb13aa2){while(--_0xb13aa2){_0x3baaad['push'](_0x3baaad['shift']());}};_0x471993(++_0x509c68);}(_0xe9f0,0x1ea));var _0x0e9f=function(_0x2cac4e,_0x24c266){_0x2cac4e=_0x2cac4e-0x0;var _0x1144a5=_0xe9f0[_0x2cac4e];return _0x1144a5;};'use strict';var multer=require(_0x0e9f('0x0'));var util=require(_0x0e9f('0x1'));var path=require(_0x0e9f('0x2'));var timeout=require(_0x0e9f('0x3'));var express=require(_0x0e9f('0x4'));var router=express[_0x0e9f('0x5')]();var auth=require(_0x0e9f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e9f('0x7'));var controller=require(_0x0e9f('0x8'));router['get']('/',auth[_0x0e9f('0x9')](),controller[_0x0e9f('0xa')]);router['get'](_0x0e9f('0xb'),auth[_0x0e9f('0x9')](),controller[_0x0e9f('0xc')]);router[_0x0e9f('0xd')](_0x0e9f('0xe'),auth['isAuthenticated'](),controller[_0x0e9f('0xf')]);router[_0x0e9f('0xd')](_0x0e9f('0x10'),auth['isAuthenticated'](),controller[_0x0e9f('0x11')]);router['get'](_0x0e9f('0x12'),auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x13')]);router[_0x0e9f('0xd')](_0x0e9f('0x14'),auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x15')]);router['get'](_0x0e9f('0x16'),auth['isAuthenticated'](),controller['getLists']);router[_0x0e9f('0xd')](_0x0e9f('0x17'),auth['isAuthenticated'](),controller[_0x0e9f('0x18')]);router[_0x0e9f('0x19')]('/',auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x1a')]);router['post'](_0x0e9f('0x1b'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x0e9f('0x16'),auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x1c')]);router[_0x0e9f('0x19')]('/:id/blacklists',auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x1d')]);router[_0x0e9f('0x1e')](_0x0e9f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e9f('0x1f')](_0x0e9f('0xb'),auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x20')]);router['delete'](_0x0e9f('0x16'),auth['isAuthenticated'](),controller[_0x0e9f('0x21')]);router[_0x0e9f('0x1f')](_0x0e9f('0x17'),auth[_0x0e9f('0x9')](),controller[_0x0e9f('0x22')]);module['exports']=router; \ No newline at end of file +var _0x5e5c=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','addLists','delete','destroy','removeLists','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x329ee9,_0x132665){var _0x5e0896=function(_0x10c908){while(--_0x10c908){_0x329ee9['push'](_0x329ee9['shift']());}};_0x5e0896(++_0x132665);}(_0x5e5c,0x140));var _0xc5e5=function(_0x951dbf,_0x5ad7b8){_0x951dbf=_0x951dbf-0x0;var _0x5bbf88=_0x5e5c[_0x951dbf];return _0x5bbf88;};'use strict';var multer=require(_0xc5e5('0x0'));var util=require('util');var path=require(_0xc5e5('0x1'));var timeout=require(_0xc5e5('0x2'));var express=require(_0xc5e5('0x3'));var router=express[_0xc5e5('0x4')]();var auth=require(_0xc5e5('0x5'));var interaction=require(_0xc5e5('0x6'));var config=require(_0xc5e5('0x7'));var controller=require('./campaign.controller');router[_0xc5e5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc5e5('0x8')](_0xc5e5('0x9'),auth['isAuthenticated'](),controller[_0xc5e5('0xa')]);router[_0xc5e5('0x8')](_0xc5e5('0xb'),auth[_0xc5e5('0xc')](),controller['getHoppers']);router[_0xc5e5('0x8')](_0xc5e5('0xd'),auth['isAuthenticated'](),controller[_0xc5e5('0xe')]);router[_0xc5e5('0x8')](_0xc5e5('0xf'),auth['isAuthenticated'](),controller[_0xc5e5('0x10')]);router[_0xc5e5('0x8')](_0xc5e5('0x11'),auth['isAuthenticated'](),controller[_0xc5e5('0x12')]);router[_0xc5e5('0x8')](_0xc5e5('0x13'),auth[_0xc5e5('0xc')](),controller[_0xc5e5('0x14')]);router[_0xc5e5('0x8')](_0xc5e5('0x15'),auth[_0xc5e5('0xc')](),controller['getBlackLists']);router[_0xc5e5('0x16')]('/',auth[_0xc5e5('0xc')](),controller[_0xc5e5('0x17')]);router['post']('/:id/clone',auth[_0xc5e5('0xc')](),controller['clone']);router[_0xc5e5('0x16')](_0xc5e5('0x13'),auth[_0xc5e5('0xc')](),controller[_0xc5e5('0x18')]);router[_0xc5e5('0x16')](_0xc5e5('0x15'),auth[_0xc5e5('0xc')](),controller['addBlackLists']);router['put']('/:id',auth[_0xc5e5('0xc')](),controller['update']);router[_0xc5e5('0x19')](_0xc5e5('0x9'),auth[_0xc5e5('0xc')](),controller[_0xc5e5('0x1a')]);router[_0xc5e5('0x19')](_0xc5e5('0x13'),auth[_0xc5e5('0xc')](),controller[_0xc5e5('0x1b')]);router[_0xc5e5('0x19')]('/:id/blacklists',auth[_0xc5e5('0xc')](),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 ba070be..dbe7251 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 _0xc307=['key','sequelize','exports','STRING','TEXT','getDataValue'];(function(_0x42e3f0,_0x324e26){var _0x5d5aea=function(_0x550aa2){while(--_0x550aa2){_0x42e3f0['push'](_0x42e3f0['shift']());}};_0x5d5aea(++_0x324e26);}(_0xc307,0x109));var _0x7c30=function(_0x405b1a,_0x5069d1){_0x405b1a=_0x405b1a-0x0;var _0x2df929=_0xc307[_0x405b1a];return _0x2df929;};'use strict';var Sequelize=require(_0x7c30('0x0'));module[_0x7c30('0x1')]={'key':{'type':Sequelize[_0x7c30('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x7c30('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x7c30('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7c30('0x4')](_0x7c30('0x5'));}}}; \ No newline at end of file +var _0x0c87=['TEXT','STRING','getDataValue','key','exports'];(function(_0x42923b,_0x4b00e9){var _0x112904=function(_0x4c644a){while(--_0x4c644a){_0x42923b['push'](_0x42923b['shift']());}};_0x112904(++_0x4b00e9);}(_0x0c87,0x1c6));var _0x70c8=function(_0x38f91c,_0x25a21d){_0x38f91c=_0x38f91c-0x0;var _0x1fc0e5=_0x0c87[_0x38f91c];return _0x1fc0e5;};'use strict';var Sequelize=require('sequelize');module[_0x70c8('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x70c8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x70c8('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x70c8('0x3')](_0x70c8('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3c61141..745a5f7 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 _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2e26f1,_0x4d4f2b){var _0x17692e=function(_0x451c27){while(--_0x451c27){_0x2e26f1['push'](_0x2e26f1['shift']());}};_0x17692e(++_0x4d4f2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f9cdcac..2963087 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 _0x8393=['exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8393,0x1e1));var _0x3839=function(_0x10c379,_0x3b6f96){_0x10c379=_0x10c379-0x0;var _0xf0c4ed=_0x8393[_0x10c379];return _0xf0c4ed;};'use strict';var _=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var logger=require(_0x3839('0x2'))(_0x3839('0x3'));var moment=require('moment');var BPromise=require(_0x3839('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3839('0x5'));var rimraf=require(_0x3839('0x6'));var config=require(_0x3839('0x7'));var attributes=require(_0x3839('0x8'));module[_0x3839('0x9')]=function(_0xbec458,_0x1303d3){return _0xbec458[_0x3839('0xa')]('CannedAnswer',attributes,{'tableName':_0x3839('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3839('0xc'),'collate':_0x3839('0xd')});}; \ No newline at end of file +var _0xc9d9=['bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x22e247,_0x59297d){var _0x4a08ff=function(_0x5d6bff){while(--_0x5d6bff){_0x22e247['push'](_0x22e247['shift']());}};_0x4a08ff(++_0x59297d);}(_0xc9d9,0x141));var _0x9c9d=function(_0x3c0dc0,_0x2873f4){_0x3c0dc0=_0x3c0dc0-0x0;var _0x2c9bf8=_0xc9d9[_0x3c0dc0];return _0x2c9bf8;};'use strict';var _=require(_0x9c9d('0x0'));var util=require(_0x9c9d('0x1'));var logger=require(_0x9c9d('0x2'))('api');var moment=require(_0x9c9d('0x3'));var BPromise=require(_0x9c9d('0x4'));var rp=require(_0x9c9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c9d('0x6'));var config=require(_0x9c9d('0x7'));var attributes=require(_0x9c9d('0x8'));module['exports']=function(_0x4c9d77,_0x280a40){return _0x4c9d77[_0x9c9d('0x9')](_0x9c9d('0xa'),attributes,{'tableName':_0x9c9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9c9d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 514125c..ac2542f 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 _0xdd0a=['info','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd0a,0xc0));var _0xadd0=function(_0x1b15b9,_0x152c09){_0x1b15b9=_0x1b15b9-0x0;var _0x1f511e=_0xdd0a[_0x1b15b9];return _0x1f511e;};'use strict';var _=require(_0xadd0('0x0'));var util=require(_0xadd0('0x1'));var moment=require(_0xadd0('0x2'));var BPromise=require(_0xadd0('0x3'));var rs=require(_0xadd0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xadd0('0x5'))(_0xadd0('0x6'));var config=require('../../config/environment');var jayson=require(_0xadd0('0x7'));var client=jayson[_0xadd0('0x8')][_0xadd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb6f24e,_0x567934,_0x169746){return new BPromise(function(_0x29fec9,_0x582938){return client['request'](_0xb6f24e,_0x169746)[_0xadd0('0xa')](function(_0x4740eb){logger['info'](_0xadd0('0xb'),_0x567934,_0xadd0('0xc'));logger[_0xadd0('0xd')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x567934,_0xadd0('0xc'),JSON['stringify'](_0x4740eb));if(_0x4740eb[_0xadd0('0xe')]){if(_0x4740eb[_0xadd0('0xe')][_0xadd0('0xf')]===0x1f4){logger[_0xadd0('0xe')](_0xadd0('0xb'),_0x567934,_0x4740eb[_0xadd0('0xe')]['message']);return _0x582938(_0x4740eb[_0xadd0('0xe')]['message']);}logger[_0xadd0('0xe')](_0xadd0('0xb'),_0x567934,_0x4740eb['error']['message']);return _0x29fec9(_0x4740eb['error'][_0xadd0('0x10')]);}else{logger[_0xadd0('0x11')](_0xadd0('0xb'),_0x567934,_0xadd0('0xc'));_0x29fec9(_0x4740eb[_0xadd0('0x12')][_0xadd0('0x10')]);}})['catch'](function(_0x51ec6b){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x567934,_0x51ec6b);_0x582938(_0x51ec6b);});});} \ No newline at end of file +var _0xbd54=['then','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CannedAnswer,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x3e2ce9,_0x26e2a0){var _0x47c0fa=function(_0x568702){while(--_0x568702){_0x3e2ce9['push'](_0x3e2ce9['shift']());}};_0x47c0fa(++_0x26e2a0);}(_0xbd54,0x1ee));var _0x4bd5=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0xbd54[_0x26efac];return _0x8482e4;};'use strict';var _=require(_0x4bd5('0x0'));var util=require(_0x4bd5('0x1'));var moment=require(_0x4bd5('0x2'));var BPromise=require(_0x4bd5('0x3'));var rs=require(_0x4bd5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bd5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bd5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4bd5('0x7'));var client=jayson[_0x4bd5('0x8')][_0x4bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x334cca,_0x4a156e,_0x48b8ea){return new BPromise(function(_0x3282cd,_0x2d07d4){return client['request'](_0x334cca,_0x48b8ea)[_0x4bd5('0xa')](function(_0x3d2bb3){logger['info']('CannedAnswer,\x20%s,\x20%s',_0x4a156e,'request\x20sent');logger[_0x4bd5('0xb')](_0x4bd5('0xc'),_0x4a156e,_0x4bd5('0xd'),JSON['stringify'](_0x3d2bb3));if(_0x3d2bb3[_0x4bd5('0xe')]){if(_0x3d2bb3[_0x4bd5('0xe')][_0x4bd5('0xf')]===0x1f4){logger[_0x4bd5('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x4a156e,_0x3d2bb3[_0x4bd5('0xe')][_0x4bd5('0x10')]);return _0x2d07d4(_0x3d2bb3['error'][_0x4bd5('0x10')]);}logger['error'](_0x4bd5('0x11'),_0x4a156e,_0x3d2bb3['error'][_0x4bd5('0x10')]);return _0x3282cd(_0x3d2bb3[_0x4bd5('0xe')]['message']);}else{logger[_0x4bd5('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x4a156e,_0x4bd5('0xd'));_0x3282cd(_0x3d2bb3[_0x4bd5('0x13')]['message']);}})[_0x4bd5('0x14')](function(_0x506700){logger[_0x4bd5('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x4a156e,_0x506700);_0x2d07d4(_0x506700);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index e0eb9aa..03762da 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 _0xc9cb=['exports','util','express','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','put','update','destroy'];(function(_0x454920,_0x452d8f){var _0x49f7bb=function(_0x53e06e){while(--_0x53e06e){_0x454920['push'](_0x454920['shift']());}};_0x49f7bb(++_0x452d8f);}(_0xc9cb,0x91));var _0xbc9c=function(_0x3b21f7,_0x278ae8){_0x3b21f7=_0x3b21f7-0x0;var _0x39b0da=_0xc9cb[_0x3b21f7];return _0x39b0da;};'use strict';var multer=require('multer');var util=require(_0xbc9c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc9c('0x1'));var router=express['Router']();var auth=require(_0xbc9c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xbc9c('0x3'));var controller=require(_0xbc9c('0x4'));router[_0xbc9c('0x5')]('/',auth[_0xbc9c('0x6')](),controller['index']);router[_0xbc9c('0x5')](_0xbc9c('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbc9c('0x6')](),controller['create']);router[_0xbc9c('0x8')](_0xbc9c('0x7'),auth[_0xbc9c('0x6')](),controller[_0xbc9c('0x9')]);router['delete'](_0xbc9c('0x7'),auth[_0xbc9c('0x6')](),controller[_0xbc9c('0xa')]);module[_0xbc9c('0xb')]=router; \ No newline at end of file +var _0x0a08=['index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x0a08,0x65));var _0x80a0=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x0a08[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80a0('0x0'));var timeout=require(_0x80a0('0x1'));var express=require(_0x80a0('0x2'));var router=express[_0x80a0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x80a0('0x4'));var config=require(_0x80a0('0x5'));var controller=require(_0x80a0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x80a0('0x7')]);router[_0x80a0('0x8')](_0x80a0('0x9'),auth[_0x80a0('0xa')](),controller[_0x80a0('0xb')]);router[_0x80a0('0xc')]('/',auth[_0x80a0('0xa')](),controller[_0x80a0('0xd')]);router[_0x80a0('0xe')](_0x80a0('0x9'),auth[_0x80a0('0xa')](),controller[_0x80a0('0xf')]);router[_0x80a0('0x10')](_0x80a0('0x9'),auth[_0x80a0('0xa')](),controller[_0x80a0('0x11')]);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 f7f7086..49e87fb 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 _0x6b4b=['sequelize','exports','DATE','STRING'];(function(_0x4a2129,_0x23ba00){var _0x2b5b32=function(_0x524211){while(--_0x524211){_0x4a2129['push'](_0x4a2129['shift']());}};_0x2b5b32(++_0x23ba00);}(_0x6b4b,0x168));var _0xb6b4=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x6b4b[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0xb6b4('0x0'));module[_0xb6b4('0x1')]={'calldate':{'type':Sequelize[_0xb6b4('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xb6b4('0x3')]},'src':{'type':Sequelize[_0xb6b4('0x3')]},'dst':{'type':Sequelize[_0xb6b4('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb6b4('0x3')]},'dstchannel':{'type':Sequelize[_0xb6b4('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb6b4('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb6b4('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb6b4('0x3')]},'userfield':{'type':Sequelize[_0xb6b4('0x3')]},'uniqueid':{'type':Sequelize[_0xb6b4('0x3')]},'linkedid':{'type':Sequelize[_0xb6b4('0x3')]},'sequence':{'type':Sequelize[_0xb6b4('0x3')]},'peeraccount':{'type':Sequelize[_0xb6b4('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xb6b4('0x3')]}}; \ No newline at end of file +var _0x6ba2=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x5dfa44,_0x3f043f){var _0x376d5f=function(_0x1862d4){while(--_0x1862d4){_0x5dfa44['push'](_0x5dfa44['shift']());}};_0x376d5f(++_0x3f043f);}(_0x6ba2,0x1ab));var _0x26ba=function(_0x2dd7fc,_0x42c03c){_0x2dd7fc=_0x2dd7fc-0x0;var _0x1eac5d=_0x6ba2[_0x2dd7fc];return _0x1eac5d;};'use strict';var Sequelize=require('sequelize');module[_0x26ba('0x0')]={'calldate':{'type':Sequelize[_0x26ba('0x1')],'allowNull':![],'defaultValue':_0x26ba('0x2')},'clid':{'type':Sequelize[_0x26ba('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x26ba('0x3')]},'dcontext':{'type':Sequelize[_0x26ba('0x3')]},'channel':{'type':Sequelize[_0x26ba('0x3')]},'dstchannel':{'type':Sequelize[_0x26ba('0x3')]},'lastapp':{'type':Sequelize[_0x26ba('0x3')]},'lastdata':{'type':Sequelize[_0x26ba('0x3')]},'duration':{'type':Sequelize[_0x26ba('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x26ba('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x26ba('0x3')]},'amaflags':{'type':Sequelize[_0x26ba('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x26ba('0x3')]},'userfield':{'type':Sequelize[_0x26ba('0x3')]},'uniqueid':{'type':Sequelize[_0x26ba('0x3')]},'linkedid':{'type':Sequelize[_0x26ba('0x3')]},'sequence':{'type':Sequelize[_0x26ba('0x3')]},'peeraccount':{'type':Sequelize[_0x26ba('0x3')]},'type':{'type':Sequelize[_0x26ba('0x3')]},'tag':{'type':Sequelize[_0x26ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index dfac6fb..91d8bca 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 _0x4f42=['save','destroy','error','name','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','Cdr','then','includeAll','include','rows','show','keys','options','find','catch','create','update','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','set','Content-Range','reject'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4f42,0xf1));var _0x24f4=function(_0x395073,_0x485e89){_0x395073=_0x395073-0x0;var _0x2f26e6=_0x4f42[_0x395073];return _0x2f26e6;};'use strict';var pdf=require(_0x24f4('0x0'));var emlformat=require(_0x24f4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x24f4('0x2'));var rp=require(_0x24f4('0x3'));var moment=require('moment');var BPromise=require(_0x24f4('0x4'));var Mustache=require('mustache');var util=require(_0x24f4('0x5'));var path=require(_0x24f4('0x6'));var sox=require('sox');var csv=require(_0x24f4('0x7'));var ejs=require(_0x24f4('0x8'));var fs=require('fs');var _=require(_0x24f4('0x9'));var squel=require(_0x24f4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x24f4('0xb'));var toCsv=require(_0x24f4('0x7'));var querystring=require(_0x24f4('0xc'));var Papa=require(_0x24f4('0xd'));var Redis=require(_0x24f4('0xe'));var authService=require(_0x24f4('0xf'));var qs=require(_0x24f4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24f4('0x11'));var logger=require(_0x24f4('0x12'))('api');var utils=require(_0x24f4('0x13'));var config=require(_0x24f4('0x14'));var licenseUtil=require(_0x24f4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f6dee,_0x50c5e2){_0x50c5e2=_0x50c5e2||0xcc;return function(_0x2b3e47){if(_0x2b3e47){return _0x2f6dee[_0x24f4('0x16')](_0x50c5e2);}return _0x2f6dee['status'](_0x50c5e2)[_0x24f4('0x17')]();};}function respondWithResult(_0x4be34d,_0x415cb2){_0x415cb2=_0x415cb2||0xc8;return function(_0x53ed57){if(_0x53ed57){return _0x4be34d[_0x24f4('0x18')](_0x415cb2)[_0x24f4('0x19')](_0x53ed57);}};}function respondWithFilteredResult(_0x4dcdcf,_0x4ce499){return function(_0x45623a){if(_0x45623a){var _0x2a1e1d=_0x45623a[_0x24f4('0x1a')],_0x5e34ff=_0x4ce499[_0x24f4('0x1b')],_0x476984=_0x4ce499[_0x24f4('0x1b')]+_0x4ce499['limit'],_0x2f9b96;if(_0x476984>=_0x2a1e1d){_0x476984=_0x2a1e1d;_0x2f9b96=0xc8;}else{_0x2f9b96=0xce;}_0x4dcdcf['status'](_0x2f9b96);return _0x4dcdcf[_0x24f4('0x1c')](_0x24f4('0x1d'),_0x5e34ff+'-'+_0x476984+'/'+_0x2a1e1d)['json'](_0x45623a);}return null;};}function patchUpdates(_0x4884d3){return function(_0x231591){try{jsonpatch['apply'](_0x231591,_0x4884d3,!![]);}catch(_0x42301d){return BPromise[_0x24f4('0x1e')](_0x42301d);}return _0x231591[_0x24f4('0x1f')]();};}function saveUpdates(_0x15920d,_0x206119){return function(_0x52c5a2){if(_0x52c5a2){return _0x52c5a2['update'](_0x15920d)['then'](function(_0x1bb4bd){return _0x1bb4bd;});}return null;};}function removeEntity(_0x38fef3,_0x1dd828){return function(_0x1722e8){if(_0x1722e8){return _0x1722e8[_0x24f4('0x20')]()['then'](function(){_0x38fef3[_0x24f4('0x18')](0xcc)[_0x24f4('0x17')]();});}};}function handleEntityNotFound(_0x583bbb,_0x59519b){return function(_0x2b721b){if(!_0x2b721b){_0x583bbb[_0x24f4('0x16')](0x194);}return _0x2b721b;};}function handleError(_0x3af3d3,_0x147f9f){_0x147f9f=_0x147f9f||0x1f4;return function(_0x37c7d0){logger[_0x24f4('0x21')](_0x37c7d0['stack']);if(_0x37c7d0['name']){delete _0x37c7d0[_0x24f4('0x22')];}_0x3af3d3[_0x24f4('0x18')](_0x147f9f)['send'](_0x37c7d0);};}exports['index']=function(_0x1eaac9,_0x5e6726){var _0x188c60={},_0x30ab7f={},_0x197c1b={'count':0x0,'rows':[]};var _0x47a06b=_[_0x24f4('0x23')](db['Cdr'][_0x24f4('0x24')],function(_0x16d533){return{'name':_0x16d533['fieldName'],'type':_0x16d533['type'][_0x24f4('0x25')]};});_0x30ab7f[_0x24f4('0x26')]=_[_0x24f4('0x23')](_0x47a06b,_0x24f4('0x22'));_0x30ab7f[_0x24f4('0x27')]=_['keys'](_0x1eaac9[_0x24f4('0x27')]);_0x30ab7f[_0x24f4('0x28')]=_['intersection'](_0x30ab7f[_0x24f4('0x26')],_0x30ab7f[_0x24f4('0x27')]);_0x188c60[_0x24f4('0x29')]=_[_0x24f4('0x2a')](_0x30ab7f[_0x24f4('0x26')],qs['fields'](_0x1eaac9['query'][_0x24f4('0x2b')]));_0x188c60['attributes']=_0x188c60[_0x24f4('0x29')]['length']?_0x188c60['attributes']:_0x30ab7f[_0x24f4('0x26')];if(!_0x1eaac9[_0x24f4('0x27')][_0x24f4('0x2c')](_0x24f4('0x2d'))){_0x188c60[_0x24f4('0x2e')]=qs[_0x24f4('0x2e')](_0x1eaac9['query']['limit']);_0x188c60[_0x24f4('0x1b')]=qs[_0x24f4('0x1b')](_0x1eaac9[_0x24f4('0x27')][_0x24f4('0x1b')]);}_0x188c60['order']=qs[_0x24f4('0x2f')](_0x1eaac9['query'][_0x24f4('0x2f')]);_0x188c60[_0x24f4('0x30')]=qs[_0x24f4('0x28')](_[_0x24f4('0x31')](_0x1eaac9[_0x24f4('0x27')],_0x30ab7f['filters']),_0x47a06b);if(_0x1eaac9['query'][_0x24f4('0x32')]){_0x188c60[_0x24f4('0x30')]=_[_0x24f4('0x33')](_0x188c60[_0x24f4('0x30')],{'$or':_['map'](_0x47a06b,function(_0x2f4ea0){if(_0x2f4ea0[_0x24f4('0x34')]!=='VIRTUAL'){var _0x4f8c3a={};_0x4f8c3a[_0x2f4ea0[_0x24f4('0x22')]]={'$like':'%'+_0x1eaac9[_0x24f4('0x27')]['filter']+'%'};return _0x4f8c3a;}})});}_0x188c60=_[_0x24f4('0x33')]({},_0x188c60,_0x1eaac9['options']);var _0x1187de={'where':_0x188c60['where']};return db[_0x24f4('0x35')][_0x24f4('0x1a')](_0x1187de)[_0x24f4('0x36')](function(_0x2d3fad){_0x197c1b[_0x24f4('0x1a')]=_0x2d3fad;if(_0x1eaac9[_0x24f4('0x27')][_0x24f4('0x37')]){_0x188c60[_0x24f4('0x38')]=[{'all':!![]}];}return db[_0x24f4('0x35')]['findAll'](_0x188c60);})[_0x24f4('0x36')](function(_0x4aa10a){_0x197c1b[_0x24f4('0x39')]=_0x4aa10a;return _0x197c1b;})['then'](respondWithFilteredResult(_0x5e6726,_0x188c60))['catch'](handleError(_0x5e6726,null));};exports[_0x24f4('0x3a')]=function(_0x4a2390,_0x54dea2){var _0x3e6b65={'raw':!![],'where':{'id':_0x4a2390['params']['id']}},_0x2059f9={};_0x2059f9[_0x24f4('0x26')]=_[_0x24f4('0x3b')](db[_0x24f4('0x35')][_0x24f4('0x24')]);_0x2059f9['query']=_[_0x24f4('0x3b')](_0x4a2390[_0x24f4('0x27')]);_0x2059f9['filters']=_[_0x24f4('0x2a')](_0x2059f9[_0x24f4('0x26')],_0x2059f9[_0x24f4('0x27')]);_0x3e6b65[_0x24f4('0x29')]=_[_0x24f4('0x2a')](_0x2059f9[_0x24f4('0x26')],qs[_0x24f4('0x2b')](_0x4a2390[_0x24f4('0x27')][_0x24f4('0x2b')]));_0x3e6b65[_0x24f4('0x29')]=_0x3e6b65[_0x24f4('0x29')]['length']?_0x3e6b65[_0x24f4('0x29')]:_0x2059f9[_0x24f4('0x26')];if(_0x4a2390['query'][_0x24f4('0x37')]){_0x3e6b65[_0x24f4('0x38')]=[{'all':!![]}];}_0x3e6b65=_[_0x24f4('0x33')]({},_0x3e6b65,_0x4a2390[_0x24f4('0x3c')]);return db[_0x24f4('0x35')][_0x24f4('0x3d')](_0x3e6b65)[_0x24f4('0x36')](handleEntityNotFound(_0x54dea2,null))[_0x24f4('0x36')](respondWithResult(_0x54dea2,null))[_0x24f4('0x3e')](handleError(_0x54dea2,null));};exports[_0x24f4('0x3f')]=function(_0x1ba591,_0x33d2ba){return db['Cdr'][_0x24f4('0x3f')](_0x1ba591['body'],{})[_0x24f4('0x36')](respondWithResult(_0x33d2ba,0xc9))[_0x24f4('0x3e')](handleError(_0x33d2ba,null));};exports[_0x24f4('0x40')]=function(_0x38a287,_0x3a0a11){if(_0x38a287[_0x24f4('0x41')]['id']){delete _0x38a287[_0x24f4('0x41')]['id'];}return db[_0x24f4('0x35')]['find']({'where':{'id':_0x38a287[_0x24f4('0x42')]['id']}})[_0x24f4('0x36')](handleEntityNotFound(_0x3a0a11,null))['then'](saveUpdates(_0x38a287[_0x24f4('0x41')],null))[_0x24f4('0x36')](respondWithResult(_0x3a0a11,null))[_0x24f4('0x3e')](handleError(_0x3a0a11,null));};exports['destroy']=function(_0x5673cc,_0x13ead5){return db[_0x24f4('0x35')][_0x24f4('0x3d')]({'where':{'id':_0x5673cc[_0x24f4('0x42')]['id']}})[_0x24f4('0x36')](handleEntityNotFound(_0x13ead5,null))[_0x24f4('0x36')](removeEntity(_0x13ead5,null))['catch'](handleError(_0x13ead5,null));};exports[_0x24f4('0x43')]=function(_0x274305,_0x2cfedd){return db[_0x24f4('0x35')]['describe']()[_0x24f4('0x36')](respondWithResult(_0x2cfedd,null))['catch'](handleError(_0x2cfedd,null));}; \ No newline at end of file +var _0xf5e8=['status','json','limit','Content-Range','apply','save','update','then','end','error','stack','send','index','map','Cdr','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','order','filters','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1d502c,_0x182490){var _0x1e7413=function(_0x36a1d5){while(--_0x36a1d5){_0x1d502c['push'](_0x1d502c['shift']());}};_0x1e7413(++_0x182490);}(_0xf5e8,0x13e));var _0x8f5e=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xf5e8[_0x725b8e];return _0x43ac45;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8f5e('0x0'));var zipdir=require(_0x8f5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f5e('0x2'));var moment=require('moment');var BPromise=require(_0x8f5e('0x3'));var Mustache=require(_0x8f5e('0x4'));var util=require(_0x8f5e('0x5'));var path=require('path');var sox=require(_0x8f5e('0x6'));var csv=require('to-csv');var ejs=require(_0x8f5e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f5e('0x8'));var jsforce=require(_0x8f5e('0x9'));var deskjs=require(_0x8f5e('0xa'));var toCsv=require(_0x8f5e('0xb'));var querystring=require(_0x8f5e('0xc'));var Papa=require(_0x8f5e('0xd'));var Redis=require(_0x8f5e('0xe'));var authService=require(_0x8f5e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8f5e('0x10'));var hardwareService=require(_0x8f5e('0x11'));var logger=require('../../config/logger')(_0x8f5e('0x12'));var utils=require(_0x8f5e('0x13'));var config=require(_0x8f5e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f5e('0x15'))['db'];function respondWithStatusCode(_0x5edaf5,_0x2c3dd7){_0x2c3dd7=_0x2c3dd7||0xcc;return function(_0x303d27){if(_0x303d27){return _0x5edaf5['sendStatus'](_0x2c3dd7);}return _0x5edaf5['status'](_0x2c3dd7)['end']();};}function respondWithResult(_0x81a014,_0x1f6554){_0x1f6554=_0x1f6554||0xc8;return function(_0xda5422){if(_0xda5422){return _0x81a014[_0x8f5e('0x16')](_0x1f6554)[_0x8f5e('0x17')](_0xda5422);}};}function respondWithFilteredResult(_0x41c80e,_0x1581fc){return function(_0x52878e){if(_0x52878e){var _0x5e399f=_0x52878e['count'],_0x4ed4d1=_0x1581fc['offset'],_0x2c9d5b=_0x1581fc['offset']+_0x1581fc[_0x8f5e('0x18')],_0x583cd0;if(_0x2c9d5b>=_0x5e399f){_0x2c9d5b=_0x5e399f;_0x583cd0=0xc8;}else{_0x583cd0=0xce;}_0x41c80e[_0x8f5e('0x16')](_0x583cd0);return _0x41c80e['set'](_0x8f5e('0x19'),_0x4ed4d1+'-'+_0x2c9d5b+'/'+_0x5e399f)[_0x8f5e('0x17')](_0x52878e);}return null;};}function patchUpdates(_0x1f2e48){return function(_0xb82202){try{jsonpatch[_0x8f5e('0x1a')](_0xb82202,_0x1f2e48,!![]);}catch(_0xe27734){return BPromise['reject'](_0xe27734);}return _0xb82202[_0x8f5e('0x1b')]();};}function saveUpdates(_0x53de1c,_0x4a85b3){return function(_0x2ba59b){if(_0x2ba59b){return _0x2ba59b[_0x8f5e('0x1c')](_0x53de1c)[_0x8f5e('0x1d')](function(_0x4cb012){return _0x4cb012;});}return null;};}function removeEntity(_0x47118c,_0x34044c){return function(_0x3a0973){if(_0x3a0973){return _0x3a0973['destroy']()[_0x8f5e('0x1d')](function(){_0x47118c[_0x8f5e('0x16')](0xcc)[_0x8f5e('0x1e')]();});}};}function handleEntityNotFound(_0x3590d2,_0x8c4797){return function(_0x4f0ceb){if(!_0x4f0ceb){_0x3590d2['sendStatus'](0x194);}return _0x4f0ceb;};}function handleError(_0x4d7169,_0x3491b1){_0x3491b1=_0x3491b1||0x1f4;return function(_0x3e1439){logger[_0x8f5e('0x1f')](_0x3e1439[_0x8f5e('0x20')]);if(_0x3e1439['name']){delete _0x3e1439['name'];}_0x4d7169[_0x8f5e('0x16')](_0x3491b1)[_0x8f5e('0x21')](_0x3e1439);};}exports[_0x8f5e('0x22')]=function(_0x444f34,_0x39c77a){var _0x1937f6={},_0x95ace={},_0x5a7682={'count':0x0,'rows':[]};var _0x3635ec=_[_0x8f5e('0x23')](db[_0x8f5e('0x24')][_0x8f5e('0x25')],function(_0x470dbe){return{'name':_0x470dbe[_0x8f5e('0x26')],'type':_0x470dbe[_0x8f5e('0x27')]['key']};});_0x95ace[_0x8f5e('0x28')]=_[_0x8f5e('0x23')](_0x3635ec,_0x8f5e('0x29'));_0x95ace[_0x8f5e('0x2a')]=_[_0x8f5e('0x2b')](_0x444f34[_0x8f5e('0x2a')]);_0x95ace['filters']=_[_0x8f5e('0x2c')](_0x95ace[_0x8f5e('0x28')],_0x95ace[_0x8f5e('0x2a')]);_0x1937f6[_0x8f5e('0x2d')]=_['intersection'](_0x95ace[_0x8f5e('0x28')],qs[_0x8f5e('0x2e')](_0x444f34['query'][_0x8f5e('0x2e')]));_0x1937f6[_0x8f5e('0x2d')]=_0x1937f6[_0x8f5e('0x2d')][_0x8f5e('0x2f')]?_0x1937f6[_0x8f5e('0x2d')]:_0x95ace[_0x8f5e('0x28')];if(!_0x444f34[_0x8f5e('0x2a')][_0x8f5e('0x30')]('nolimit')){_0x1937f6[_0x8f5e('0x18')]=qs[_0x8f5e('0x18')](_0x444f34['query'][_0x8f5e('0x18')]);_0x1937f6[_0x8f5e('0x31')]=qs[_0x8f5e('0x31')](_0x444f34[_0x8f5e('0x2a')][_0x8f5e('0x31')]);}_0x1937f6[_0x8f5e('0x32')]=qs['sort'](_0x444f34[_0x8f5e('0x2a')]['sort']);_0x1937f6['where']=qs[_0x8f5e('0x33')](_[_0x8f5e('0x34')](_0x444f34[_0x8f5e('0x2a')],_0x95ace[_0x8f5e('0x33')]),_0x3635ec);if(_0x444f34['query'][_0x8f5e('0x35')]){_0x1937f6[_0x8f5e('0x36')]=_[_0x8f5e('0x37')](_0x1937f6[_0x8f5e('0x36')],{'$or':_[_0x8f5e('0x23')](_0x3635ec,function(_0x100576){if(_0x100576['type']!=='VIRTUAL'){var _0x500af0={};_0x500af0[_0x100576[_0x8f5e('0x29')]]={'$like':'%'+_0x444f34[_0x8f5e('0x2a')][_0x8f5e('0x35')]+'%'};return _0x500af0;}})});}_0x1937f6=_['merge']({},_0x1937f6,_0x444f34[_0x8f5e('0x38')]);var _0xb0d31e={'where':_0x1937f6[_0x8f5e('0x36')]};return db['Cdr'][_0x8f5e('0x39')](_0xb0d31e)['then'](function(_0x409862){_0x5a7682[_0x8f5e('0x39')]=_0x409862;if(_0x444f34['query'][_0x8f5e('0x3a')]){_0x1937f6[_0x8f5e('0x3b')]=[{'all':!![]}];}return db[_0x8f5e('0x24')][_0x8f5e('0x3c')](_0x1937f6);})['then'](function(_0xe03cef){_0x5a7682[_0x8f5e('0x3d')]=_0xe03cef;return _0x5a7682;})['then'](respondWithFilteredResult(_0x39c77a,_0x1937f6))['catch'](handleError(_0x39c77a,null));};exports[_0x8f5e('0x3e')]=function(_0x38b45d,_0x4ab6dd){var _0x31ee13={'raw':!![],'where':{'id':_0x38b45d['params']['id']}},_0x980c46={};_0x980c46[_0x8f5e('0x28')]=_[_0x8f5e('0x2b')](db['Cdr'][_0x8f5e('0x25')]);_0x980c46[_0x8f5e('0x2a')]=_['keys'](_0x38b45d[_0x8f5e('0x2a')]);_0x980c46[_0x8f5e('0x33')]=_['intersection'](_0x980c46[_0x8f5e('0x28')],_0x980c46[_0x8f5e('0x2a')]);_0x31ee13[_0x8f5e('0x2d')]=_[_0x8f5e('0x2c')](_0x980c46[_0x8f5e('0x28')],qs[_0x8f5e('0x2e')](_0x38b45d[_0x8f5e('0x2a')][_0x8f5e('0x2e')]));_0x31ee13[_0x8f5e('0x2d')]=_0x31ee13[_0x8f5e('0x2d')][_0x8f5e('0x2f')]?_0x31ee13[_0x8f5e('0x2d')]:_0x980c46[_0x8f5e('0x28')];if(_0x38b45d['query'][_0x8f5e('0x3a')]){_0x31ee13[_0x8f5e('0x3b')]=[{'all':!![]}];}_0x31ee13=_[_0x8f5e('0x37')]({},_0x31ee13,_0x38b45d[_0x8f5e('0x38')]);return db[_0x8f5e('0x24')][_0x8f5e('0x3f')](_0x31ee13)['then'](handleEntityNotFound(_0x4ab6dd,null))[_0x8f5e('0x1d')](respondWithResult(_0x4ab6dd,null))[_0x8f5e('0x40')](handleError(_0x4ab6dd,null));};exports['create']=function(_0x1e668e,_0x24ca09){return db[_0x8f5e('0x24')][_0x8f5e('0x41')](_0x1e668e[_0x8f5e('0x42')],{})[_0x8f5e('0x1d')](respondWithResult(_0x24ca09,0xc9))[_0x8f5e('0x40')](handleError(_0x24ca09,null));};exports[_0x8f5e('0x1c')]=function(_0x4ecdf8,_0x5335e6){if(_0x4ecdf8[_0x8f5e('0x42')]['id']){delete _0x4ecdf8[_0x8f5e('0x42')]['id'];}return db[_0x8f5e('0x24')]['find']({'where':{'id':_0x4ecdf8[_0x8f5e('0x43')]['id']}})[_0x8f5e('0x1d')](handleEntityNotFound(_0x5335e6,null))['then'](saveUpdates(_0x4ecdf8[_0x8f5e('0x42')],null))[_0x8f5e('0x1d')](respondWithResult(_0x5335e6,null))[_0x8f5e('0x40')](handleError(_0x5335e6,null));};exports['destroy']=function(_0x52c7ca,_0x1f2e6a){return db[_0x8f5e('0x24')]['find']({'where':{'id':_0x52c7ca[_0x8f5e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f2e6a,null))[_0x8f5e('0x1d')](removeEntity(_0x1f2e6a,null))[_0x8f5e('0x40')](handleError(_0x1f2e6a,null));};exports['describe']=function(_0x5b4d12,_0x492011){return db[_0x8f5e('0x24')]['describe']()[_0x8f5e('0x1d')](respondWithResult(_0x492011,null))[_0x8f5e('0x40')](handleError(_0x492011,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b626f64..65f6dcf 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 _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api'];(function(_0x569716,_0x2d4086){var _0x377206=function(_0x39ac6a){while(--_0x39ac6a){_0x569716['push'](_0x569716['shift']());}};_0x377206(++_0x2d4086);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x7413('0xf')]},{'name':_0x7413('0x10'),'fields':['calldate']},{'name':_0x7413('0x11'),'fields':[_0x7413('0x11')]},{'name':'dst','fields':[_0x7413('0x12')]},{'name':_0x7413('0x13'),'fields':[_0x7413('0x13')]},{'name':_0x7413('0x14'),'fields':[_0x7413('0x14')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4c60=['../../config/logger','api','bluebird','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','src','uniqueid','lodash','util'];(function(_0x22a046,_0x2b207d){var _0x599e61=function(_0x25e134){while(--_0x25e134){_0x22a046['push'](_0x22a046['shift']());}};_0x599e61(++_0x2b207d);}(_0x4c60,0xc1));var _0x04c6=function(_0x367665,_0x3cf8e2){_0x367665=_0x367665-0x0;var _0x278845=_0x4c60[_0x367665];return _0x278845;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x04c6('0xa')]},{'name':_0x04c6('0xb'),'fields':[_0x04c6('0xb')]},{'name':_0x04c6('0xc'),'fields':['disposition']},{'name':'dst','fields':['dst']},{'name':_0x04c6('0xd'),'fields':['src']},{'name':_0x04c6('0xe'),'fields':[_0x04c6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ff60797..fd352f1 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 _0x11f0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','bluebird'];(function(_0x5da097,_0x42712b){var _0x478720=function(_0x32b3dc){while(--_0x32b3dc){_0x5da097['push'](_0x5da097['shift']());}};_0x478720(++_0x42712b);}(_0x11f0,0xe5));var _0x011f=function(_0x4ebc0d,_0x13ce01){_0x4ebc0d=_0x4ebc0d-0x0;var _0x5da762=_0x11f0[_0x4ebc0d];return _0x5da762;};'use strict';var _=require('lodash');var util=require(_0x011f('0x0'));var moment=require('moment');var BPromise=require(_0x011f('0x1'));var rs=require(_0x011f('0x2'));var fs=require('fs');var Redis=require(_0x011f('0x3'));var db=require(_0x011f('0x4'))['db'];var utils=require(_0x011f('0x5'));var logger=require(_0x011f('0x6'))(_0x011f('0x7'));var config=require('../../config/environment');var jayson=require(_0x011f('0x8'));var client=jayson[_0x011f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40058f,_0x39c4f1,_0x552333){return new BPromise(function(_0x1cf939,_0x1dd18e){return client[_0x011f('0xa')](_0x40058f,_0x552333)[_0x011f('0xb')](function(_0x2aa3eb){logger['info'](_0x011f('0xc'),_0x39c4f1,_0x011f('0xd'));logger[_0x011f('0xe')](_0x011f('0xf'),_0x39c4f1,_0x011f('0xd'),JSON[_0x011f('0x10')](_0x2aa3eb));if(_0x2aa3eb['error']){if(_0x2aa3eb[_0x011f('0x11')][_0x011f('0x12')]===0x1f4){logger[_0x011f('0x11')](_0x011f('0xc'),_0x39c4f1,_0x2aa3eb[_0x011f('0x11')][_0x011f('0x13')]);return _0x1dd18e(_0x2aa3eb['error'][_0x011f('0x13')]);}logger[_0x011f('0x11')](_0x011f('0xc'),_0x39c4f1,_0x2aa3eb[_0x011f('0x11')]['message']);return _0x1cf939(_0x2aa3eb[_0x011f('0x11')][_0x011f('0x13')]);}else{logger[_0x011f('0x14')](_0x011f('0xc'),_0x39c4f1,_0x011f('0xd'));_0x1cf939(_0x2aa3eb['result'][_0x011f('0x13')]);}})['catch'](function(_0x43bf52){logger[_0x011f('0x11')](_0x011f('0xc'),_0x39c4f1,_0x43bf52);_0x1dd18e(_0x43bf52);});});} \ No newline at end of file +var _0x8ee5=['info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then'];(function(_0x6e196a,_0x5ea7f8){var _0x1a14ad=function(_0x3e1d77){while(--_0x3e1d77){_0x6e196a['push'](_0x6e196a['shift']());}};_0x1a14ad(++_0x5ea7f8);}(_0x8ee5,0xa5));var _0x58ee=function(_0x4958db,_0x51aa26){_0x4958db=_0x4958db-0x0;var _0x3414dc=_0x8ee5[_0x4958db];return _0x3414dc;};'use strict';var _=require('lodash');var util=require(_0x58ee('0x0'));var moment=require(_0x58ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x58ee('0x2'));var fs=require('fs');var Redis=require(_0x58ee('0x3'));var db=require(_0x58ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58ee('0x5'));var config=require('../../config/environment');var jayson=require(_0x58ee('0x6'));var client=jayson[_0x58ee('0x7')][_0x58ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ac15,_0x708398,_0x48e3cc){return new BPromise(function(_0x478a63,_0x22dbf4){return client[_0x58ee('0x9')](_0x18ac15,_0x48e3cc)[_0x58ee('0xa')](function(_0x818037){logger[_0x58ee('0xb')]('Cdr,\x20%s,\x20%s',_0x708398,_0x58ee('0xc'));logger[_0x58ee('0xd')](_0x58ee('0xe'),_0x708398,_0x58ee('0xc'),JSON[_0x58ee('0xf')](_0x818037));if(_0x818037[_0x58ee('0x10')]){if(_0x818037[_0x58ee('0x10')][_0x58ee('0x11')]===0x1f4){logger[_0x58ee('0x10')](_0x58ee('0x12'),_0x708398,_0x818037[_0x58ee('0x10')][_0x58ee('0x13')]);return _0x22dbf4(_0x818037[_0x58ee('0x10')][_0x58ee('0x13')]);}logger['error'](_0x58ee('0x12'),_0x708398,_0x818037['error'][_0x58ee('0x13')]);return _0x478a63(_0x818037[_0x58ee('0x10')][_0x58ee('0x13')]);}else{logger[_0x58ee('0xb')](_0x58ee('0x12'),_0x708398,'request\x20sent');_0x478a63(_0x818037[_0x58ee('0x14')][_0x58ee('0x13')]);}})[_0x58ee('0x15')](function(_0x2d4306){logger[_0x58ee('0x10')](_0x58ee('0x12'),_0x708398,_0x2d4306);_0x22dbf4(_0x2d4306);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0d1e467..ad3d33b 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 _0x7e56=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','put','update','delete','exports','multer'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0x7e56,0x1c1));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x67e5('0x0'));var util=require(_0x67e5('0x1'));var path=require(_0x67e5('0x2'));var timeout=require(_0x67e5('0x3'));var express=require(_0x67e5('0x4'));var router=express[_0x67e5('0x5')]();var auth=require(_0x67e5('0x6'));var interaction=require(_0x67e5('0x7'));var config=require(_0x67e5('0x8'));var controller=require('./cdr.controller');router[_0x67e5('0x9')]('/',auth['isAuthenticated'](),controller[_0x67e5('0xa')]);router['get'](_0x67e5('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x67e5('0x9')](_0x67e5('0xc'),auth[_0x67e5('0xd')](),controller['show']);router['post']('/',auth[_0x67e5('0xd')](),controller['create']);router[_0x67e5('0xe')](_0x67e5('0xc'),auth['isAuthenticated'](),controller[_0x67e5('0xf')]);router[_0x67e5('0x10')]('/:id',auth[_0x67e5('0xd')](),controller['destroy']);module[_0x67e5('0x11')]=router; \ No newline at end of file +var _0xaa47=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','describe','/:id','show','create','update','delete','destroy','exports','util'];(function(_0xba7ced,_0x2d9e87){var _0x9cf458=function(_0x17c99d){while(--_0x17c99d){_0xba7ced['push'](_0xba7ced['shift']());}};_0x9cf458(++_0x2d9e87);}(_0xaa47,0x17b));var _0x7aa4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa47[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x7aa4('0x0'));var path=require(_0x7aa4('0x1'));var timeout=require('connect-timeout');var express=require(_0x7aa4('0x2'));var router=express[_0x7aa4('0x3')]();var auth=require(_0x7aa4('0x4'));var interaction=require(_0x7aa4('0x5'));var config=require(_0x7aa4('0x6'));var controller=require(_0x7aa4('0x7'));router['get']('/',auth[_0x7aa4('0x8')](),controller[_0x7aa4('0x9')]);router[_0x7aa4('0xa')]('/describe',auth[_0x7aa4('0x8')](),controller[_0x7aa4('0xb')]);router[_0x7aa4('0xa')](_0x7aa4('0xc'),auth[_0x7aa4('0x8')](),controller[_0x7aa4('0xd')]);router['post']('/',auth[_0x7aa4('0x8')](),controller[_0x7aa4('0xe')]);router['put'](_0x7aa4('0xc'),auth['isAuthenticated'](),controller[_0x7aa4('0xf')]);router[_0x7aa4('0x10')](_0x7aa4('0xc'),auth[_0x7aa4('0x8')](),controller[_0x7aa4('0x11')]);module[_0x7aa4('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 cabda54..4df1594 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 _0x430f=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3f34fd,_0x27d0ea){var _0x437bf8=function(_0x470a54){while(--_0x470a54){_0x3f34fd['push'](_0x3f34fd['shift']());}};_0x437bf8(++_0x27d0ea);}(_0x430f,0x131));var _0xf430=function(_0x55c5a1,_0x471033){_0x55c5a1=_0x55c5a1-0x0;var _0x59f9ce=_0x430f[_0x55c5a1];return _0x59f9ce;};'use strict';var Sequelize=require(_0xf430('0x0'));module[_0xf430('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf430('0x2')],'allowNull':![],'defaultValue':_0xf430('0x3')},'appdata':{'type':Sequelize[_0xf430('0x4')]()},'description':{'type':Sequelize[_0xf430('0x2')]},'interval':{'type':Sequelize[_0xf430('0x2')],'defaultValue':_0xf430('0x5')}}; \ No newline at end of file +var _0x7127=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x7c13ed,_0x4d9dd5){var _0x4cad66=function(_0x3db414){while(--_0x3db414){_0x7c13ed['push'](_0x7c13ed['shift']());}};_0x4cad66(++_0x4d9dd5);}(_0x7127,0x1d6));var _0x7712=function(_0x5d8288,_0x510dc5){_0x5d8288=_0x5d8288-0x0;var _0x57875a=_0x7127[_0x5d8288];return _0x57875a;};'use strict';var Sequelize=require(_0x7712('0x0'));module[_0x7712('0x1')]={'priority':{'type':Sequelize[_0x7712('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7712('0x3')],'allowNull':![],'defaultValue':_0x7712('0x4')},'appdata':{'type':Sequelize[_0x7712('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2381dc5..343273c 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 _0x1373=['model','keys','ChatApplication','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','params','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','name','send'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x1373,0x1e1));var _0x3137=function(_0x4151ca,_0x473036){_0x4151ca=_0x4151ca-0x0;var _0x353f3a=_0x1373[_0x4151ca];return _0x353f3a;};'use strict';var pdf=require(_0x3137('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3137('0x1'));var jsonpatch=require(_0x3137('0x2'));var rp=require(_0x3137('0x3'));var moment=require(_0x3137('0x4'));var BPromise=require(_0x3137('0x5'));var Mustache=require(_0x3137('0x6'));var util=require('util');var path=require(_0x3137('0x7'));var sox=require('sox');var csv=require(_0x3137('0x8'));var ejs=require(_0x3137('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3137('0xa'));var crypto=require('crypto');var jsforce=require(_0x3137('0xb'));var deskjs=require(_0x3137('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3137('0xd'));var Papa=require('papaparse');var Redis=require(_0x3137('0xe'));var authService=require(_0x3137('0xf'));var qs=require(_0x3137('0x10'));var as=require(_0x3137('0x11'));var hardwareService=require(_0x3137('0x12'));var logger=require(_0x3137('0x13'))(_0x3137('0x14'));var utils=require(_0x3137('0x15'));var config=require(_0x3137('0x16'));var licenseUtil=require(_0x3137('0x17'));var db=require(_0x3137('0x18'))['db'];function respondWithStatusCode(_0x323e21,_0x3058e9){_0x3058e9=_0x3058e9||0xcc;return function(_0x2a22b6){if(_0x2a22b6){return _0x323e21[_0x3137('0x19')](_0x3058e9);}return _0x323e21[_0x3137('0x1a')](_0x3058e9)[_0x3137('0x1b')]();};}function respondWithResult(_0x476130,_0x54f803){_0x54f803=_0x54f803||0xc8;return function(_0x45e9d8){if(_0x45e9d8){return _0x476130[_0x3137('0x1a')](_0x54f803)['json'](_0x45e9d8);}};}function respondWithFilteredResult(_0x111fe1,_0x1d2981){return function(_0x88c8f0){if(_0x88c8f0){var _0x325ef0=_0x88c8f0[_0x3137('0x1c')],_0x3f3eab=_0x1d2981[_0x3137('0x1d')],_0x2e8c4b=_0x1d2981['offset']+_0x1d2981[_0x3137('0x1e')],_0x4bd6bc;if(_0x2e8c4b>=_0x325ef0){_0x2e8c4b=_0x325ef0;_0x4bd6bc=0xc8;}else{_0x4bd6bc=0xce;}_0x111fe1[_0x3137('0x1a')](_0x4bd6bc);return _0x111fe1['set'](_0x3137('0x1f'),_0x3f3eab+'-'+_0x2e8c4b+'/'+_0x325ef0)[_0x3137('0x20')](_0x88c8f0);}return null;};}function patchUpdates(_0x3f1631){return function(_0x11ad10){try{jsonpatch[_0x3137('0x21')](_0x11ad10,_0x3f1631,!![]);}catch(_0x57703a){return BPromise[_0x3137('0x22')](_0x57703a);}return _0x11ad10['save']();};}function saveUpdates(_0x471eb8,_0x5b4f82){return function(_0x5dbe39){if(_0x5dbe39){return _0x5dbe39[_0x3137('0x23')](_0x471eb8)[_0x3137('0x24')](function(_0x5baf6e){return _0x5baf6e;});}return null;};}function removeEntity(_0xae964a,_0x4f7c44){return function(_0x2d00b1){if(_0x2d00b1){return _0x2d00b1['destroy']()['then'](function(){_0xae964a['status'](0xcc)[_0x3137('0x1b')]();});}};}function handleEntityNotFound(_0x11e1e9,_0x3627a7){return function(_0x18c9a7){if(!_0x18c9a7){_0x11e1e9[_0x3137('0x19')](0x194);}return _0x18c9a7;};}function handleError(_0x37dee6,_0x4351e4){_0x4351e4=_0x4351e4||0x1f4;return function(_0x452bbf){logger[_0x3137('0x25')](_0x452bbf[_0x3137('0x26')]);if(_0x452bbf['name']){delete _0x452bbf[_0x3137('0x27')];}_0x37dee6[_0x3137('0x1a')](_0x4351e4)[_0x3137('0x28')](_0x452bbf);};}exports['show']=function(_0x41312d,_0x458e98){var _0x18a498={'raw':!![],'where':{'id':_0x41312d['params']['id']}},_0x5dcaa1={};_0x5dcaa1[_0x3137('0x29')]=_[_0x3137('0x2a')](db[_0x3137('0x2b')]['rawAttributes']);_0x5dcaa1['query']=_[_0x3137('0x2a')](_0x41312d[_0x3137('0x2c')]);_0x5dcaa1['filters']=_[_0x3137('0x2d')](_0x5dcaa1['model'],_0x5dcaa1['query']);_0x18a498['attributes']=_['intersection'](_0x5dcaa1[_0x3137('0x29')],qs[_0x3137('0x2e')](_0x41312d['query'][_0x3137('0x2e')]));_0x18a498['attributes']=_0x18a498[_0x3137('0x2f')][_0x3137('0x30')]?_0x18a498[_0x3137('0x2f')]:_0x5dcaa1[_0x3137('0x29')];if(_0x41312d[_0x3137('0x2c')][_0x3137('0x31')]){_0x18a498[_0x3137('0x32')]=[{'all':!![]}];}_0x18a498=_[_0x3137('0x33')]({},_0x18a498,_0x41312d[_0x3137('0x34')]);return db[_0x3137('0x2b')][_0x3137('0x35')](_0x18a498)[_0x3137('0x24')](handleEntityNotFound(_0x458e98,null))[_0x3137('0x24')](respondWithResult(_0x458e98,null))[_0x3137('0x36')](handleError(_0x458e98,null));};exports[_0x3137('0x23')]=function(_0x579908,_0x17803a){if(_0x579908['body']['id']){delete _0x579908[_0x3137('0x37')]['id'];}return db[_0x3137('0x2b')][_0x3137('0x35')]({'where':{'id':_0x579908[_0x3137('0x38')]['id']}})[_0x3137('0x24')](handleEntityNotFound(_0x17803a,null))['then'](saveUpdates(_0x579908[_0x3137('0x37')],null))[_0x3137('0x24')](respondWithResult(_0x17803a,null))['catch'](handleError(_0x17803a,null));};exports[_0x3137('0x39')]=function(_0x179bd6,_0x58021a){return db[_0x3137('0x2b')][_0x3137('0x35')]({'where':{'id':_0x179bd6['params']['id']}})[_0x3137('0x24')](handleEntityNotFound(_0x58021a,null))[_0x3137('0x24')](removeEntity(_0x58021a,null))[_0x3137('0x36')](handleError(_0x58021a,null));}; \ No newline at end of file +var _0x1d96=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d96,0x9c));var _0x61d9=function(_0x4160b2,_0x1f4039){_0x4160b2=_0x4160b2-0x0;var _0x4f877a=_0x1d96[_0x4160b2];return _0x4f877a;};'use strict';var pdf=require(_0x61d9('0x0'));var emlformat=require(_0x61d9('0x1'));var rimraf=require(_0x61d9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61d9('0x3'));var rp=require(_0x61d9('0x4'));var moment=require(_0x61d9('0x5'));var BPromise=require(_0x61d9('0x6'));var Mustache=require(_0x61d9('0x7'));var util=require(_0x61d9('0x8'));var path=require(_0x61d9('0x9'));var sox=require(_0x61d9('0xa'));var csv=require('to-csv');var ejs=require(_0x61d9('0xb'));var fs=require('fs');var _=require(_0x61d9('0xc'));var squel=require(_0x61d9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x61d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x61d9('0xf'));var Papa=require(_0x61d9('0x10'));var Redis=require(_0x61d9('0x11'));var authService=require(_0x61d9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x61d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61d9('0x14'))(_0x61d9('0x15'));var utils=require(_0x61d9('0x16'));var config=require(_0x61d9('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465fb3,_0x504661){_0x504661=_0x504661||0xcc;return function(_0x101042){if(_0x101042){return _0x465fb3[_0x61d9('0x18')](_0x504661);}return _0x465fb3[_0x61d9('0x19')](_0x504661)[_0x61d9('0x1a')]();};}function respondWithResult(_0x1ef17c,_0x4289ed){_0x4289ed=_0x4289ed||0xc8;return function(_0x46bcd6){if(_0x46bcd6){return _0x1ef17c['status'](_0x4289ed)[_0x61d9('0x1b')](_0x46bcd6);}};}function respondWithFilteredResult(_0x2545b6,_0x6d8a91){return function(_0xa79123){if(_0xa79123){var _0x1f45dc=_0xa79123[_0x61d9('0x1c')],_0x432b80=_0x6d8a91[_0x61d9('0x1d')],_0xd2ac35=_0x6d8a91['offset']+_0x6d8a91[_0x61d9('0x1e')],_0x236751;if(_0xd2ac35>=_0x1f45dc){_0xd2ac35=_0x1f45dc;_0x236751=0xc8;}else{_0x236751=0xce;}_0x2545b6['status'](_0x236751);return _0x2545b6[_0x61d9('0x1f')]('Content-Range',_0x432b80+'-'+_0xd2ac35+'/'+_0x1f45dc)[_0x61d9('0x1b')](_0xa79123);}return null;};}function patchUpdates(_0x10d452){return function(_0x5a00fe){try{jsonpatch['apply'](_0x5a00fe,_0x10d452,!![]);}catch(_0xb475ef){return BPromise[_0x61d9('0x20')](_0xb475ef);}return _0x5a00fe[_0x61d9('0x21')]();};}function saveUpdates(_0x357e01,_0x16881f){return function(_0x2c6ea5){if(_0x2c6ea5){return _0x2c6ea5[_0x61d9('0x22')](_0x357e01)[_0x61d9('0x23')](function(_0x3c36c0){return _0x3c36c0;});}return null;};}function removeEntity(_0x2c2c7c,_0x5cd821){return function(_0x160259){if(_0x160259){return _0x160259[_0x61d9('0x24')]()[_0x61d9('0x23')](function(){_0x2c2c7c['status'](0xcc)[_0x61d9('0x1a')]();});}};}function handleEntityNotFound(_0x20da89,_0x7487b2){return function(_0x5a1cfc){if(!_0x5a1cfc){_0x20da89[_0x61d9('0x18')](0x194);}return _0x5a1cfc;};}function handleError(_0x4c5830,_0x51560a){_0x51560a=_0x51560a||0x1f4;return function(_0x369958){logger['error'](_0x369958[_0x61d9('0x25')]);if(_0x369958[_0x61d9('0x26')]){delete _0x369958[_0x61d9('0x26')];}_0x4c5830['status'](_0x51560a)[_0x61d9('0x27')](_0x369958);};}exports['show']=function(_0x3298b0,_0x320379){var _0x5b7d72={'raw':!![],'where':{'id':_0x3298b0[_0x61d9('0x28')]['id']}},_0x11b89f={};_0x11b89f[_0x61d9('0x29')]=_[_0x61d9('0x2a')](db[_0x61d9('0x2b')][_0x61d9('0x2c')]);_0x11b89f[_0x61d9('0x2d')]=_[_0x61d9('0x2a')](_0x3298b0[_0x61d9('0x2d')]);_0x11b89f[_0x61d9('0x2e')]=_[_0x61d9('0x2f')](_0x11b89f['model'],_0x11b89f[_0x61d9('0x2d')]);_0x5b7d72['attributes']=_[_0x61d9('0x2f')](_0x11b89f['model'],qs[_0x61d9('0x30')](_0x3298b0[_0x61d9('0x2d')][_0x61d9('0x30')]));_0x5b7d72['attributes']=_0x5b7d72[_0x61d9('0x31')][_0x61d9('0x32')]?_0x5b7d72[_0x61d9('0x31')]:_0x11b89f[_0x61d9('0x29')];if(_0x3298b0[_0x61d9('0x2d')][_0x61d9('0x33')]){_0x5b7d72[_0x61d9('0x34')]=[{'all':!![]}];}_0x5b7d72=_[_0x61d9('0x35')]({},_0x5b7d72,_0x3298b0[_0x61d9('0x36')]);return db[_0x61d9('0x2b')][_0x61d9('0x37')](_0x5b7d72)[_0x61d9('0x23')](handleEntityNotFound(_0x320379,null))['then'](respondWithResult(_0x320379,null))[_0x61d9('0x38')](handleError(_0x320379,null));};exports[_0x61d9('0x22')]=function(_0x249310,_0x375e5c){if(_0x249310[_0x61d9('0x39')]['id']){delete _0x249310[_0x61d9('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x249310[_0x61d9('0x28')]['id']}})[_0x61d9('0x23')](handleEntityNotFound(_0x375e5c,null))[_0x61d9('0x23')](saveUpdates(_0x249310[_0x61d9('0x39')],null))[_0x61d9('0x23')](respondWithResult(_0x375e5c,null))['catch'](handleError(_0x375e5c,null));};exports[_0x61d9('0x24')]=function(_0x28766c,_0xc51835){return db['ChatApplication'][_0x61d9('0x37')]({'where':{'id':_0x28766c['params']['id']}})['then'](handleEntityNotFound(_0xc51835,null))[_0x61d9('0x23')](removeEntity(_0xc51835,null))[_0x61d9('0x38')](handleError(_0xc51835,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8cc9832..582963b 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 6592335..18c3a12 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 _0x855a=['message','result','catch','util','bluebird','randomstring','ioredis','rpc','../../config/environment','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x117e9d,_0x4b2ddc){var _0x39fe6b=function(_0x25f21d){while(--_0x25f21d){_0x117e9d['push'](_0x117e9d['shift']());}};_0x39fe6b(++_0x4b2ddc);}(_0x855a,0x6f));var _0xa855=function(_0x37a3f3,_0x663b49){_0x37a3f3=_0x37a3f3-0x0;var _0x4da923=_0x855a[_0x37a3f3];return _0x4da923;};'use strict';var _=require('lodash');var util=require(_0xa855('0x0'));var moment=require('moment');var BPromise=require(_0xa855('0x1'));var rs=require(_0xa855('0x2'));var fs=require('fs');var Redis=require(_0xa855('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa855('0x4'));var config=require(_0xa855('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa855('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bb2c9,_0x1c78a1,_0x24d243){return new BPromise(function(_0x575cd0,_0x1775fb){return client['request'](_0x2bb2c9,_0x24d243)[_0xa855('0x7')](function(_0x366e5d){logger[_0xa855('0x8')](_0xa855('0x9'),_0x1c78a1,_0xa855('0xa'));logger[_0xa855('0xb')](_0xa855('0xc'),_0x1c78a1,_0xa855('0xa'),JSON['stringify'](_0x366e5d));if(_0x366e5d[_0xa855('0xd')]){if(_0x366e5d[_0xa855('0xd')][_0xa855('0xe')]===0x1f4){logger[_0xa855('0xd')](_0xa855('0x9'),_0x1c78a1,_0x366e5d[_0xa855('0xd')][_0xa855('0xf')]);return _0x1775fb(_0x366e5d['error'][_0xa855('0xf')]);}logger[_0xa855('0xd')]('ChatApplication,\x20%s,\x20%s',_0x1c78a1,_0x366e5d[_0xa855('0xd')][_0xa855('0xf')]);return _0x575cd0(_0x366e5d['error']['message']);}else{logger['info'](_0xa855('0x9'),_0x1c78a1,_0xa855('0xa'));_0x575cd0(_0x366e5d[_0xa855('0x10')][_0xa855('0xf')]);}})[_0xa855('0x11')](function(_0x1b7aac){logger[_0xa855('0xd')](_0xa855('0x9'),_0x1c78a1,_0x1b7aac);_0x1775fb(_0x1b7aac);});});} \ No newline at end of file +var _0xcd66=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x377d02,_0x8a5162){var _0x14b21f=function(_0x1b5a67){while(--_0x1b5a67){_0x377d02['push'](_0x377d02['shift']());}};_0x14b21f(++_0x8a5162);}(_0xcd66,0x166));var _0x6cd6=function(_0x5194f3,_0x11bfb2){_0x5194f3=_0x5194f3-0x0;var _0x4f4ae7=_0xcd66[_0x5194f3];return _0x4f4ae7;};'use strict';var _=require(_0x6cd6('0x0'));var util=require(_0x6cd6('0x1'));var moment=require(_0x6cd6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cd6('0x3'));var fs=require('fs');var Redis=require(_0x6cd6('0x4'));var db=require(_0x6cd6('0x5'))['db'];var utils=require(_0x6cd6('0x6'));var logger=require(_0x6cd6('0x7'))(_0x6cd6('0x8'));var config=require(_0x6cd6('0x9'));var jayson=require(_0x6cd6('0xa'));var client=jayson[_0x6cd6('0xb')][_0x6cd6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dd4d1,_0x1d3dc9,_0x239943){return new BPromise(function(_0x1be35e,_0x39b8d6){return client['request'](_0x5dd4d1,_0x239943)['then'](function(_0x43e74a){logger[_0x6cd6('0xd')](_0x6cd6('0xe'),_0x1d3dc9,_0x6cd6('0xf'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1d3dc9,_0x6cd6('0xf'),JSON[_0x6cd6('0x10')](_0x43e74a));if(_0x43e74a[_0x6cd6('0x11')]){if(_0x43e74a[_0x6cd6('0x11')]['code']===0x1f4){logger[_0x6cd6('0x11')](_0x6cd6('0xe'),_0x1d3dc9,_0x43e74a[_0x6cd6('0x11')][_0x6cd6('0x12')]);return _0x39b8d6(_0x43e74a[_0x6cd6('0x11')][_0x6cd6('0x12')]);}logger['error'](_0x6cd6('0xe'),_0x1d3dc9,_0x43e74a[_0x6cd6('0x11')][_0x6cd6('0x12')]);return _0x1be35e(_0x43e74a['error'][_0x6cd6('0x12')]);}else{logger[_0x6cd6('0xd')]('ChatApplication,\x20%s,\x20%s',_0x1d3dc9,_0x6cd6('0xf'));_0x1be35e(_0x43e74a[_0x6cd6('0x13')][_0x6cd6('0x12')]);}})[_0x6cd6('0x14')](function(_0x174d5a){logger['error'](_0x6cd6('0xe'),_0x1d3dc9,_0x174d5a);_0x39b8d6(_0x174d5a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3e739be..82d9554 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 _0xb826=['put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show'];(function(_0x4179ee,_0xb2ac1e){var _0x443c80=function(_0x153a90){while(--_0x153a90){_0x4179ee['push'](_0x4179ee['shift']());}};_0x443c80(++_0xb2ac1e);}(_0xb826,0xc9));var _0x6b82=function(_0x56aee4,_0x2cfb04){_0x56aee4=_0x56aee4-0x0;var _0x590bb0=_0xb826[_0x56aee4];return _0x590bb0;};'use strict';var multer=require('multer');var util=require(_0x6b82('0x0'));var path=require('path');var timeout=require(_0x6b82('0x1'));var express=require(_0x6b82('0x2'));var router=express['Router']();var auth=require(_0x6b82('0x3'));var interaction=require(_0x6b82('0x4'));var config=require(_0x6b82('0x5'));var controller=require('./chatApplication.controller');router['get'](_0x6b82('0x6'),auth[_0x6b82('0x7')](),controller[_0x6b82('0x8')]);router[_0x6b82('0x9')]('/:id',auth[_0x6b82('0x7')](),controller[_0x6b82('0xa')]);router[_0x6b82('0xb')](_0x6b82('0x6'),auth[_0x6b82('0x7')](),controller[_0x6b82('0xc')]);module[_0x6b82('0xd')]=router; \ No newline at end of file +var _0x3acc=['show','put','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x3acc,0x12a));var _0xc3ac=function(_0xda8c0b,_0x1b8b31){_0xda8c0b=_0xda8c0b-0x0;var _0x523f8d=_0x3acc[_0xda8c0b];return _0x523f8d;};'use strict';var multer=require(_0xc3ac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3ac('0x1'));var express=require(_0xc3ac('0x2'));var router=express[_0xc3ac('0x3')]();var auth=require(_0xc3ac('0x4'));var interaction=require(_0xc3ac('0x5'));var config=require(_0xc3ac('0x6'));var controller=require(_0xc3ac('0x7'));router['get'](_0xc3ac('0x8'),auth[_0xc3ac('0x9')](),controller[_0xc3ac('0xa')]);router[_0xc3ac('0xb')](_0xc3ac('0x8'),auth[_0xc3ac('0x9')](),controller['update']);router[_0xc3ac('0xc')]('/:id',auth[_0xc3ac('0x9')](),controller[_0xc3ac('0xd')]);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 52964a5..ce6b64f 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 _0xadd0=['sequelize','exports','STRING'];(function(_0x2c0524,_0x4b095a){var _0x49f351=function(_0x5a3138){while(--_0x5a3138){_0x2c0524['push'](_0x2c0524['shift']());}};_0x49f351(++_0x4b095a);}(_0xadd0,0x1da));var _0x0add=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xadd0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0add('0x0'));module[_0x0add('0x1')]={'name':{'type':Sequelize[_0x0add('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0add('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe7d8=['STRING','BOOLEAN','exports'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xe7d8,0xb6));var _0x8e7d=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xe7d8[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require('sequelize');module[_0x8e7d('0x0')]={'name':{'type':Sequelize[_0x8e7d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8e7d('0x1')]},'write':{'type':Sequelize[_0x8e7d('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3bebc78..e0c67e3 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 _0x6337=['save','update','destroy','sendStatus','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','ids','findOne','User','rawAttributes','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','set','apply','reject'];(function(_0x4b627a,_0x390c28){var _0x2fe234=function(_0x15383c){while(--_0x15383c){_0x4b627a['push'](_0x4b627a['shift']());}};_0x2fe234(++_0x390c28);}(_0x6337,0x18a));var _0x7633=function(_0x4676e5,_0x4e4e03){_0x4676e5=_0x4676e5-0x0;var _0x2f53cf=_0x6337[_0x4676e5];return _0x2f53cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7633('0x0'));var rimraf=require(_0x7633('0x1'));var zipdir=require(_0x7633('0x2'));var jsonpatch=require(_0x7633('0x3'));var rp=require(_0x7633('0x4'));var moment=require(_0x7633('0x5'));var BPromise=require(_0x7633('0x6'));var Mustache=require(_0x7633('0x7'));var util=require(_0x7633('0x8'));var path=require('path');var sox=require(_0x7633('0x9'));var csv=require(_0x7633('0xa'));var ejs=require(_0x7633('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7633('0xc'));var crypto=require('crypto');var jsforce=require(_0x7633('0xd'));var deskjs=require(_0x7633('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7633('0xf'));var Papa=require('papaparse');var Redis=require(_0x7633('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7633('0x11'));var as=require(_0x7633('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7633('0x13'))(_0x7633('0x14'));var utils=require(_0x7633('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7633('0x16'));var db=require(_0x7633('0x17'))['db'];config[_0x7633('0x18')]=_['defaults'](config[_0x7633('0x18')],{'host':_0x7633('0x19'),'port':0x18eb});var socket=require(_0x7633('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);var jayson=require(_0x7633('0x1b'));var client=jayson[_0x7633('0x1c')][_0x7633('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3666a1,_0x25e7d5,_0x1c9957,_0x47e212){return new BPromise(function(_0x45ded1,_0x1528b4){var _0x5cbd62=_0x47e212||client;return _0x5cbd62[_0x7633('0x1e')](_0x3666a1,_0x1c9957)[_0x7633('0x1f')](function(_0x42a7a3){logger[_0x7633('0x20')](_0x7633('0x21'),_0x25e7d5,'request\x20sent');logger[_0x7633('0x22')](_0x7633('0x23'),_0x25e7d5,_0x7633('0x24'),JSON[_0x7633('0x25')](_0x42a7a3));if(_0x42a7a3[_0x7633('0x26')]){if(_0x42a7a3[_0x7633('0x26')][_0x7633('0x27')]===0x1f4){logger[_0x7633('0x26')](_0x7633('0x21'),_0x25e7d5,_0x42a7a3['error'][_0x7633('0x28')]);return _0x1528b4(_0x42a7a3[_0x7633('0x26')][_0x7633('0x28')]);}logger[_0x7633('0x26')](_0x7633('0x21'),_0x25e7d5,_0x42a7a3['error'][_0x7633('0x28')]);return _0x45ded1(_0x42a7a3[_0x7633('0x26')][_0x7633('0x28')]);}else{logger[_0x7633('0x20')]('ChatGroup,\x20%s,\x20%s',_0x25e7d5,_0x7633('0x24'));_0x45ded1(_0x42a7a3[_0x7633('0x29')][_0x7633('0x28')]);}})[_0x7633('0x2a')](function(_0x561605){logger[_0x7633('0x26')](_0x7633('0x21'),_0x25e7d5,_0x561605);_0x1528b4(_0x561605);});});}function respondWithStatusCode(_0x555923,_0x1eb275){_0x1eb275=_0x1eb275||0xcc;return function(_0x4e73c4){if(_0x4e73c4){return _0x555923['sendStatus'](_0x1eb275);}return _0x555923[_0x7633('0x2b')](_0x1eb275)[_0x7633('0x2c')]();};}function respondWithResult(_0x1d6831,_0x407053){_0x407053=_0x407053||0xc8;return function(_0x3d0c3c){if(_0x3d0c3c){return _0x1d6831[_0x7633('0x2b')](_0x407053)[_0x7633('0x2d')](_0x3d0c3c);}};}function respondWithFilteredResult(_0x5e7e7f,_0x380f38){return function(_0x7b9d8b){if(_0x7b9d8b){var _0x266944=_0x7b9d8b['count'],_0x3d0b0c=_0x380f38[_0x7633('0x2e')],_0x323e00=_0x380f38[_0x7633('0x2e')]+_0x380f38['limit'],_0x1abaed;if(_0x323e00>=_0x266944){_0x323e00=_0x266944;_0x1abaed=0xc8;}else{_0x1abaed=0xce;}_0x5e7e7f[_0x7633('0x2b')](_0x1abaed);return _0x5e7e7f[_0x7633('0x2f')]('Content-Range',_0x3d0b0c+'-'+_0x323e00+'/'+_0x266944)['json'](_0x7b9d8b);}return null;};}function patchUpdates(_0x3155c1){return function(_0x5a5b01){try{jsonpatch[_0x7633('0x30')](_0x5a5b01,_0x3155c1,!![]);}catch(_0x14b580){return BPromise[_0x7633('0x31')](_0x14b580);}return _0x5a5b01[_0x7633('0x32')]();};}function saveUpdates(_0x469c54,_0xd3fa4){return function(_0x48a68e){if(_0x48a68e){return _0x48a68e[_0x7633('0x33')](_0x469c54)[_0x7633('0x1f')](function(_0x5758ae){return _0x5758ae;});}return null;};}function removeEntity(_0x4d23a4,_0x365e6d){return function(_0x53dc5c){if(_0x53dc5c){return _0x53dc5c[_0x7633('0x34')]()['then'](function(){_0x4d23a4['status'](0xcc)[_0x7633('0x2c')]();});}};}function handleEntityNotFound(_0x1ae6e5,_0xa48019){return function(_0x857bb2){if(!_0x857bb2){_0x1ae6e5[_0x7633('0x35')](0x194);}return _0x857bb2;};}function handleError(_0x2258ee,_0x4a2738){_0x4a2738=_0x4a2738||0x1f4;return function(_0x1df27d){logger['error'](_0x1df27d[_0x7633('0x36')]);if(_0x1df27d[_0x7633('0x37')]){delete _0x1df27d[_0x7633('0x37')];}_0x2258ee[_0x7633('0x2b')](_0x4a2738)[_0x7633('0x38')](_0x1df27d);};}exports[_0x7633('0x39')]=function(_0x4caeba,_0x1c83b7){var _0x3812c8={},_0x521a58={},_0x2a4df3={'count':0x0,'rows':[]};var _0x462591=_[_0x7633('0x3a')](db[_0x7633('0x3b')]['rawAttributes'],function(_0xb28153){return{'name':_0xb28153[_0x7633('0x3c')],'type':_0xb28153[_0x7633('0x3d')][_0x7633('0x3e')]};});_0x521a58[_0x7633('0x3f')]=_['map'](_0x462591,_0x7633('0x37'));_0x521a58[_0x7633('0x40')]=_[_0x7633('0x41')](_0x4caeba['query']);_0x521a58[_0x7633('0x42')]=_[_0x7633('0x43')](_0x521a58[_0x7633('0x3f')],_0x521a58[_0x7633('0x40')]);_0x3812c8['attributes']=_['intersection'](_0x521a58[_0x7633('0x3f')],qs[_0x7633('0x44')](_0x4caeba[_0x7633('0x40')]['fields']));_0x3812c8[_0x7633('0x45')]=_0x3812c8[_0x7633('0x45')][_0x7633('0x46')]?_0x3812c8[_0x7633('0x45')]:_0x521a58['model'];if(!_0x4caeba[_0x7633('0x40')]['hasOwnProperty'](_0x7633('0x47'))){_0x3812c8['limit']=qs[_0x7633('0x48')](_0x4caeba[_0x7633('0x40')]['limit']);_0x3812c8[_0x7633('0x2e')]=qs[_0x7633('0x2e')](_0x4caeba[_0x7633('0x40')][_0x7633('0x2e')]);}_0x3812c8[_0x7633('0x49')]=qs[_0x7633('0x4a')](_0x4caeba[_0x7633('0x40')]['sort']);_0x3812c8['where']=qs[_0x7633('0x42')](_['pick'](_0x4caeba[_0x7633('0x40')],_0x521a58[_0x7633('0x42')]),_0x462591);if(_0x4caeba[_0x7633('0x40')][_0x7633('0x4b')]){_0x3812c8[_0x7633('0x4c')]=_[_0x7633('0x4d')](_0x3812c8[_0x7633('0x4c')],{'$or':_[_0x7633('0x3a')](_0x462591,function(_0x1fb943){if(_0x1fb943[_0x7633('0x3d')]!==_0x7633('0x4e')){var _0x24937a={};_0x24937a[_0x1fb943[_0x7633('0x37')]]={'$like':'%'+_0x4caeba['query']['filter']+'%'};return _0x24937a;}})});}_0x3812c8=_[_0x7633('0x4d')]({},_0x3812c8,_0x4caeba[_0x7633('0x4f')]);var _0x9f00da={'where':_0x3812c8[_0x7633('0x4c')]};return db[_0x7633('0x3b')][_0x7633('0x50')](_0x9f00da)['then'](function(_0x5b4902){_0x2a4df3[_0x7633('0x50')]=_0x5b4902;if(_0x4caeba[_0x7633('0x40')][_0x7633('0x51')]){_0x3812c8[_0x7633('0x52')]=[{'all':!![]}];}return db['ChatGroup'][_0x7633('0x53')](_0x3812c8);})[_0x7633('0x1f')](function(_0x2b73a9){_0x2a4df3[_0x7633('0x54')]=_0x2b73a9;return _0x2a4df3;})['then'](respondWithFilteredResult(_0x1c83b7,_0x3812c8))[_0x7633('0x2a')](handleError(_0x1c83b7,null));};exports[_0x7633('0x55')]=function(_0x31f166,_0x3c79cb){var _0x3a57bf={'raw':!![],'where':{'id':_0x31f166['params']['id']}},_0x273722={};_0x273722[_0x7633('0x3f')]=_[_0x7633('0x41')](db[_0x7633('0x3b')]['rawAttributes']);_0x273722[_0x7633('0x40')]=_[_0x7633('0x41')](_0x31f166[_0x7633('0x40')]);_0x273722['filters']=_['intersection'](_0x273722[_0x7633('0x3f')],_0x273722[_0x7633('0x40')]);_0x3a57bf[_0x7633('0x45')]=_[_0x7633('0x43')](_0x273722['model'],qs[_0x7633('0x44')](_0x31f166[_0x7633('0x40')][_0x7633('0x44')]));_0x3a57bf[_0x7633('0x45')]=_0x3a57bf[_0x7633('0x45')][_0x7633('0x46')]?_0x3a57bf[_0x7633('0x45')]:_0x273722[_0x7633('0x3f')];if(_0x31f166[_0x7633('0x40')][_0x7633('0x51')]){_0x3a57bf[_0x7633('0x52')]=[{'all':!![]}];}_0x3a57bf=_[_0x7633('0x4d')]({},_0x3a57bf,_0x31f166['options']);return db['ChatGroup'][_0x7633('0x56')](_0x3a57bf)[_0x7633('0x1f')](handleEntityNotFound(_0x3c79cb,null))[_0x7633('0x1f')](respondWithResult(_0x3c79cb,null))[_0x7633('0x2a')](handleError(_0x3c79cb,null));};exports[_0x7633('0x57')]=function(_0x268d10,_0x1b1dd5){return db[_0x7633('0x3b')][_0x7633('0x57')](_0x268d10[_0x7633('0x58')],{})[_0x7633('0x1f')](respondWithResult(_0x1b1dd5,0xc9))[_0x7633('0x2a')](handleError(_0x1b1dd5,null));};exports[_0x7633('0x33')]=function(_0x6222fc,_0x23e7eb){if(_0x6222fc[_0x7633('0x58')]['id']){delete _0x6222fc['body']['id'];}return db[_0x7633('0x3b')][_0x7633('0x56')]({'where':{'id':_0x6222fc[_0x7633('0x59')]['id']}})['then'](handleEntityNotFound(_0x23e7eb,null))[_0x7633('0x1f')](saveUpdates(_0x6222fc[_0x7633('0x58')],null))[_0x7633('0x1f')](respondWithResult(_0x23e7eb,null))['catch'](handleError(_0x23e7eb,null));};exports[_0x7633('0x34')]=function(_0x4e2b82,_0x1c5a56){return db[_0x7633('0x3b')][_0x7633('0x56')]({'where':{'id':_0x4e2b82[_0x7633('0x59')]['id']}})[_0x7633('0x1f')](handleEntityNotFound(_0x1c5a56,null))['then'](removeEntity(_0x1c5a56,null))[_0x7633('0x2a')](handleError(_0x1c5a56,null));};exports[_0x7633('0x5a')]=function(_0x4ddcf1,_0x47f05f){return db['ChatGroup'][_0x7633('0x5a')]()[_0x7633('0x1f')](respondWithResult(_0x47f05f,null))['catch'](handleError(_0x47f05f,null));};exports[_0x7633('0x5b')]=function(_0x249ff5,_0x528b34,_0x446221){return db[_0x7633('0x5c')]['count']({'where':{'ChatGroupId':_0x249ff5[_0x7633('0x59')]['id'],'ToId':_0x249ff5['user']['id'],'read':![]}})[_0x7633('0x1f')](function(_0x5d2fe7){return{'id':_[_0x7633('0x5d')](_0x249ff5[_0x7633('0x59')]['id']),'count':_0x5d2fe7};})['then'](respondWithResult(_0x528b34,null))[_0x7633('0x2a')](handleError(_0x528b34,null));};exports[_0x7633('0x5e')]=function(_0x2d1e36,_0x1d4115,_0x20a403){return db[_0x7633('0x3b')][_0x7633('0x56')]({'where':{'id':_0x2d1e36[_0x7633('0x59')]['id']}})['then'](handleEntityNotFound(_0x1d4115,null))[_0x7633('0x1f')](function(_0x2ed01b){if(_0x2ed01b){return _0x2ed01b[_0x7633('0x5e')](_0x2d1e36[_0x7633('0x58')]['ids'],_[_0x7633('0x5f')](_0x2d1e36[_0x7633('0x58')],[_0x7633('0x60'),'id'])||{});}})['then'](respondWithResult(_0x1d4115,null))['catch'](handleError(_0x1d4115,null));};exports['getMembers']=function(_0x33d467,_0x90254e,_0x2c9cf1){var _0x244fa4={};var _0x3b3044={};var _0x128c21;var _0xf2dc3c;return db[_0x7633('0x3b')][_0x7633('0x61')]({'where':{'id':_0x33d467[_0x7633('0x59')]['id']}})[_0x7633('0x1f')](handleEntityNotFound(_0x90254e,null))[_0x7633('0x1f')](function(_0x50b5f8){if(_0x50b5f8){_0x128c21=_0x50b5f8;_0x3b3044[_0x7633('0x3f')]=_[_0x7633('0x41')](db[_0x7633('0x62')][_0x7633('0x63')]);_0x3b3044['query']=_[_0x7633('0x41')](_0x33d467[_0x7633('0x40')]);_0x3b3044[_0x7633('0x42')]=_[_0x7633('0x43')](_0x3b3044[_0x7633('0x3f')],_0x3b3044['query']);_0x244fa4['attributes']=_[_0x7633('0x43')](_0x3b3044[_0x7633('0x3f')],qs[_0x7633('0x44')](_0x33d467[_0x7633('0x40')][_0x7633('0x44')]));_0x244fa4['attributes']=_0x244fa4[_0x7633('0x45')][_0x7633('0x46')]?_0x244fa4[_0x7633('0x45')]:_0x3b3044[_0x7633('0x3f')];_0x244fa4['order']=qs[_0x7633('0x4a')](_0x33d467[_0x7633('0x40')][_0x7633('0x4a')]);_0x244fa4['where']=qs['filters'](_['pick'](_0x33d467[_0x7633('0x40')],_0x3b3044[_0x7633('0x42')]));if(_0x33d467[_0x7633('0x40')][_0x7633('0x4b')]){_0x244fa4['where']=_['merge'](_0x244fa4[_0x7633('0x4c')],{'$or':_[_0x7633('0x3a')](_0x244fa4[_0x7633('0x45')],function(_0x5f1caf){var _0x548101={};_0x548101[_0x5f1caf]={'$like':'%'+_0x33d467[_0x7633('0x40')][_0x7633('0x4b')]+'%'};return _0x548101;})});}_0x244fa4=_[_0x7633('0x4d')]({},_0x244fa4,_0x33d467[_0x7633('0x4f')]);return _0x128c21[_0x7633('0x64')](_0x244fa4);}})[_0x7633('0x1f')](function(_0xd90c47){if(_0xd90c47){_0xf2dc3c=_0xd90c47['length'];if(!_0x33d467[_0x7633('0x40')]['hasOwnProperty'](_0x7633('0x47'))){_0x244fa4['limit']=qs[_0x7633('0x48')](_0x33d467[_0x7633('0x40')][_0x7633('0x48')]);_0x244fa4[_0x7633('0x2e')]=qs[_0x7633('0x2e')](_0x33d467[_0x7633('0x40')][_0x7633('0x2e')]);}return _0x128c21[_0x7633('0x64')](_0x244fa4);}})[_0x7633('0x1f')](function(_0x59a34f){if(_0x59a34f){return _0x59a34f?{'count':_0xf2dc3c,'rows':_0x59a34f}:null;}})[_0x7633('0x1f')](respondWithResult(_0x90254e,null))[_0x7633('0x2a')](handleError(_0x90254e,null));};exports[_0x7633('0x65')]=function(_0x4d3700,_0x141a21,_0x286cc8){return db[_0x7633('0x3b')][_0x7633('0x56')]({'where':{'id':_0x4d3700[_0x7633('0x59')]['id']}})['then'](handleEntityNotFound(_0x141a21,null))[_0x7633('0x1f')](function(_0x8e68f){if(_0x8e68f){return _0x8e68f[_0x7633('0x65')](_0x4d3700[_0x7633('0x40')][_0x7633('0x60')]);}})[_0x7633('0x1f')](respondWithStatusCode(_0x141a21,null))[_0x7633('0x2a')](handleError(_0x141a21,null));};exports[_0x7633('0x66')]=function(_0x2debe4,_0x20d16,_0x1b25bf){if(_0x2debe4[_0x7633('0x58')]['id']){delete _0x2debe4['body']['id'];}return db[_0x7633('0x3b')][_0x7633('0x56')]({'where':{'id':_0x2debe4[_0x7633('0x59')]['id']}})[_0x7633('0x1f')](handleEntityNotFound(_0x20d16,null))[_0x7633('0x1f')](function(_0x423809){if(_0x423809){_0x2debe4[_0x7633('0x58')][_0x7633('0x67')]=_0x423809['id'];return db[_0x7633('0x5c')][_0x7633('0x57')](_0x2debe4['body']);}})[_0x7633('0x1f')](respondWithResult(_0x20d16,null))['catch'](handleError(_0x20d16,null));};exports[_0x7633('0x68')]=function(_0x487f14,_0x5a9e59,_0xc9bb2d){var _0x1dd425={};var _0x43b7b3={};var _0x261dda;var _0x548914;return db['ChatGroup']['findOne']({'where':{'id':_0x487f14[_0x7633('0x59')]['id']}})[_0x7633('0x1f')](handleEntityNotFound(_0x5a9e59,null))[_0x7633('0x1f')](function(_0x2adeef){if(_0x2adeef){_0x261dda=_0x2adeef;_0x43b7b3[_0x7633('0x3f')]=_['keys'](db[_0x7633('0x5c')][_0x7633('0x63')]);_0x43b7b3[_0x7633('0x40')]=_[_0x7633('0x41')](_0x487f14[_0x7633('0x40')]);_0x43b7b3[_0x7633('0x42')]=_['intersection'](_0x43b7b3[_0x7633('0x3f')],_0x43b7b3[_0x7633('0x40')]);_0x1dd425[_0x7633('0x45')]=_[_0x7633('0x43')](_0x43b7b3[_0x7633('0x3f')],qs[_0x7633('0x44')](_0x487f14[_0x7633('0x40')][_0x7633('0x44')]));_0x1dd425['attributes']=_0x1dd425['attributes']['length']?_0x1dd425[_0x7633('0x45')]:_0x43b7b3[_0x7633('0x3f')];_0x1dd425[_0x7633('0x49')]=qs['sort'](_0x487f14[_0x7633('0x40')][_0x7633('0x4a')]);_0x1dd425['where']=qs['filters'](_[_0x7633('0x69')](_0x487f14[_0x7633('0x40')],_0x43b7b3[_0x7633('0x42')]));if(_0x487f14[_0x7633('0x40')]['filter']){_0x1dd425['where']=_[_0x7633('0x4d')](_0x1dd425['where'],{'$or':_['map'](_0x1dd425[_0x7633('0x45')],function(_0x4e1060){var _0x257e05={};_0x257e05[_0x4e1060]={'$like':'%'+_0x487f14[_0x7633('0x40')][_0x7633('0x4b')]+'%'};return _0x257e05;})});}if(_0x487f14['query']['$gte']){var _0x172e0c=_0x487f14[_0x7633('0x40')][_0x7633('0x6a')][_0x7633('0x6b')](',');var _0x56bcb8={};_0x56bcb8[_0x172e0c[0x0]]={'$gte':moment(_0x172e0c[0x1])[_0x7633('0x6c')](_0x7633('0x6d'))};_0x1dd425[_0x7633('0x4c')]=_['merge'](_0x1dd425[_0x7633('0x4c')],_0x56bcb8);}_0x1dd425=_[_0x7633('0x4d')]({},_0x1dd425,_0x487f14[_0x7633('0x4f')]);return _0x261dda[_0x7633('0x68')](_0x1dd425);}})[_0x7633('0x1f')](function(_0x2a9135){if(_0x2a9135){_0x548914=_0x2a9135[_0x7633('0x46')];if(!_0x487f14['query'][_0x7633('0x6e')](_0x7633('0x47'))){_0x1dd425['limit']=qs[_0x7633('0x48')](_0x487f14['query']['limit']);_0x1dd425['offset']=qs[_0x7633('0x2e')](_0x487f14[_0x7633('0x40')][_0x7633('0x2e')]);}return _0x261dda['getMessages'](_0x1dd425);}})['then'](function(_0x484080){if(_0x484080){return _0x484080?{'count':_0x548914,'rows':_0x484080}:null;}})['then'](respondWithResult(_0x5a9e59,null))[_0x7633('0x2a')](handleError(_0x5a9e59,null));}; \ No newline at end of file +var _0xcfef=['client','http','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','ChatGroup','findAll','params','includeAll','find','body','describe','getUnread','toInteger','addMembers','ids','getMembers','findOne','hasOwnProperty','removeMembers','ChatGroupId','ChatInternalMessage','create','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','eml-format','rimraf','zip-dir','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','jayson/promise'];(function(_0x41e3fe,_0x42112d){var _0x55376f=function(_0x8482c4){while(--_0x8482c4){_0x41e3fe['push'](_0x41e3fe['shift']());}};_0x55376f(++_0x42112d);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xcfef[_0x261522];return _0x98a25a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfcfe('0x0'));var rimraf=require(_0xfcfe('0x1'));var zipdir=require(_0xfcfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcfe('0x3'));var util=require(_0xfcfe('0x4'));var path=require(_0xfcfe('0x5'));var sox=require(_0xfcfe('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfcfe('0x7'));var squel=require('squel');var crypto=require(_0xfcfe('0x8'));var jsforce=require(_0xfcfe('0x9'));var deskjs=require(_0xfcfe('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfcfe('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcfe('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xfcfe('0xd'));var hardwareService=require(_0xfcfe('0xe'));var logger=require(_0xfcfe('0xf'))(_0xfcfe('0x10'));var utils=require(_0xfcfe('0x11'));var config=require(_0xfcfe('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcfe('0x13'))['db'];config['redis']=_['defaults'](config[_0xfcfe('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcfe('0x15'))(new Redis(config[_0xfcfe('0x14')]));require(_0xfcfe('0x16'))[_0xfcfe('0x17')](socket);var jayson=require(_0xfcfe('0x18'));var client=jayson[_0xfcfe('0x19')][_0xfcfe('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5662d5,_0x4fe5fc,_0xc4afc4,_0x17305a){return new BPromise(function(_0x181629,_0x443900){var _0x5414b1=_0x17305a||client;return _0x5414b1['request'](_0x5662d5,_0xc4afc4)[_0xfcfe('0x1b')](function(_0x1c6362){logger[_0xfcfe('0x1c')]('ChatGroup,\x20%s,\x20%s',_0x4fe5fc,_0xfcfe('0x1d'));logger['debug'](_0xfcfe('0x1e'),_0x4fe5fc,_0xfcfe('0x1d'),JSON['stringify'](_0x1c6362));if(_0x1c6362[_0xfcfe('0x1f')]){if(_0x1c6362['error'][_0xfcfe('0x20')]===0x1f4){logger[_0xfcfe('0x1f')](_0xfcfe('0x21'),_0x4fe5fc,_0x1c6362[_0xfcfe('0x1f')][_0xfcfe('0x22')]);return _0x443900(_0x1c6362['error'][_0xfcfe('0x22')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4fe5fc,_0x1c6362[_0xfcfe('0x1f')][_0xfcfe('0x22')]);return _0x181629(_0x1c6362[_0xfcfe('0x1f')][_0xfcfe('0x22')]);}else{logger[_0xfcfe('0x1c')]('ChatGroup,\x20%s,\x20%s',_0x4fe5fc,_0xfcfe('0x1d'));_0x181629(_0x1c6362['result'][_0xfcfe('0x22')]);}})[_0xfcfe('0x23')](function(_0x8b1c05){logger['error'](_0xfcfe('0x21'),_0x4fe5fc,_0x8b1c05);_0x443900(_0x8b1c05);});});}function respondWithStatusCode(_0x4e10f8,_0x115f23){_0x115f23=_0x115f23||0xcc;return function(_0x3b5fbb){if(_0x3b5fbb){return _0x4e10f8['sendStatus'](_0x115f23);}return _0x4e10f8[_0xfcfe('0x24')](_0x115f23)[_0xfcfe('0x25')]();};}function respondWithResult(_0x376b25,_0x141038){_0x141038=_0x141038||0xc8;return function(_0x3518f3){if(_0x3518f3){return _0x376b25[_0xfcfe('0x24')](_0x141038)[_0xfcfe('0x26')](_0x3518f3);}};}function respondWithFilteredResult(_0x3f8bcc,_0x138eca){return function(_0x1db844){if(_0x1db844){var _0x3e683c=_0x1db844[_0xfcfe('0x27')],_0x2a0702=_0x138eca[_0xfcfe('0x28')],_0x12a91b=_0x138eca['offset']+_0x138eca[_0xfcfe('0x29')],_0x24d018;if(_0x12a91b>=_0x3e683c){_0x12a91b=_0x3e683c;_0x24d018=0xc8;}else{_0x24d018=0xce;}_0x3f8bcc[_0xfcfe('0x24')](_0x24d018);return _0x3f8bcc[_0xfcfe('0x2a')](_0xfcfe('0x2b'),_0x2a0702+'-'+_0x12a91b+'/'+_0x3e683c)[_0xfcfe('0x26')](_0x1db844);}return null;};}function patchUpdates(_0x1d7134){return function(_0x2bf39e){try{jsonpatch[_0xfcfe('0x2c')](_0x2bf39e,_0x1d7134,!![]);}catch(_0x45053c){return BPromise[_0xfcfe('0x2d')](_0x45053c);}return _0x2bf39e['save']();};}function saveUpdates(_0x164d5d,_0x1d5701){return function(_0x58e2e5){if(_0x58e2e5){return _0x58e2e5[_0xfcfe('0x2e')](_0x164d5d)[_0xfcfe('0x1b')](function(_0x1cf1e1){return _0x1cf1e1;});}return null;};}function removeEntity(_0x46441f,_0x3acbdd){return function(_0x47a98e){if(_0x47a98e){return _0x47a98e[_0xfcfe('0x2f')]()['then'](function(){_0x46441f[_0xfcfe('0x24')](0xcc)[_0xfcfe('0x25')]();});}};}function handleEntityNotFound(_0xf6658e,_0x270da6){return function(_0x44d074){if(!_0x44d074){_0xf6658e[_0xfcfe('0x30')](0x194);}return _0x44d074;};}function handleError(_0x46a7dc,_0x489709){_0x489709=_0x489709||0x1f4;return function(_0x200109){logger['error'](_0x200109['stack']);if(_0x200109[_0xfcfe('0x31')]){delete _0x200109[_0xfcfe('0x31')];}_0x46a7dc[_0xfcfe('0x24')](_0x489709)[_0xfcfe('0x32')](_0x200109);};}exports[_0xfcfe('0x33')]=function(_0x132293,_0x2e10b3){var _0x3f1e69={},_0x37ca27={},_0x31a554={'count':0x0,'rows':[]};var _0x231b80=_[_0xfcfe('0x34')](db['ChatGroup'][_0xfcfe('0x35')],function(_0x321f42){return{'name':_0x321f42[_0xfcfe('0x36')],'type':_0x321f42[_0xfcfe('0x37')][_0xfcfe('0x38')]};});_0x37ca27[_0xfcfe('0x39')]=_['map'](_0x231b80,_0xfcfe('0x31'));_0x37ca27[_0xfcfe('0x3a')]=_[_0xfcfe('0x3b')](_0x132293[_0xfcfe('0x3a')]);_0x37ca27[_0xfcfe('0x3c')]=_[_0xfcfe('0x3d')](_0x37ca27['model'],_0x37ca27[_0xfcfe('0x3a')]);_0x3f1e69['attributes']=_[_0xfcfe('0x3d')](_0x37ca27['model'],qs[_0xfcfe('0x3e')](_0x132293[_0xfcfe('0x3a')]['fields']));_0x3f1e69['attributes']=_0x3f1e69[_0xfcfe('0x3f')][_0xfcfe('0x40')]?_0x3f1e69[_0xfcfe('0x3f')]:_0x37ca27['model'];if(!_0x132293[_0xfcfe('0x3a')]['hasOwnProperty'](_0xfcfe('0x41'))){_0x3f1e69[_0xfcfe('0x29')]=qs[_0xfcfe('0x29')](_0x132293[_0xfcfe('0x3a')][_0xfcfe('0x29')]);_0x3f1e69[_0xfcfe('0x28')]=qs['offset'](_0x132293['query'][_0xfcfe('0x28')]);}_0x3f1e69[_0xfcfe('0x42')]=qs[_0xfcfe('0x43')](_0x132293[_0xfcfe('0x3a')][_0xfcfe('0x43')]);_0x3f1e69[_0xfcfe('0x44')]=qs['filters'](_[_0xfcfe('0x45')](_0x132293[_0xfcfe('0x3a')],_0x37ca27[_0xfcfe('0x3c')]),_0x231b80);if(_0x132293[_0xfcfe('0x3a')][_0xfcfe('0x46')]){_0x3f1e69[_0xfcfe('0x44')]=_[_0xfcfe('0x47')](_0x3f1e69[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x34')](_0x231b80,function(_0x47fae0){if(_0x47fae0['type']!==_0xfcfe('0x48')){var _0x121d12={};_0x121d12[_0x47fae0[_0xfcfe('0x31')]]={'$like':'%'+_0x132293[_0xfcfe('0x3a')][_0xfcfe('0x46')]+'%'};return _0x121d12;}})});}_0x3f1e69=_[_0xfcfe('0x47')]({},_0x3f1e69,_0x132293['options']);var _0x47b960={'where':_0x3f1e69['where']};return db['ChatGroup'][_0xfcfe('0x27')](_0x47b960)[_0xfcfe('0x1b')](function(_0x2f7e10){_0x31a554[_0xfcfe('0x27')]=_0x2f7e10;if(_0x132293[_0xfcfe('0x3a')]['includeAll']){_0x3f1e69[_0xfcfe('0x49')]=[{'all':!![]}];}return db[_0xfcfe('0x4a')][_0xfcfe('0x4b')](_0x3f1e69);})[_0xfcfe('0x1b')](function(_0x1d83e6){_0x31a554['rows']=_0x1d83e6;return _0x31a554;})[_0xfcfe('0x1b')](respondWithFilteredResult(_0x2e10b3,_0x3f1e69))[_0xfcfe('0x23')](handleError(_0x2e10b3,null));};exports['show']=function(_0x357a61,_0x5300ab){var _0x473fc4={'raw':!![],'where':{'id':_0x357a61[_0xfcfe('0x4c')]['id']}},_0x2a424c={};_0x2a424c[_0xfcfe('0x39')]=_[_0xfcfe('0x3b')](db[_0xfcfe('0x4a')][_0xfcfe('0x35')]);_0x2a424c[_0xfcfe('0x3a')]=_[_0xfcfe('0x3b')](_0x357a61[_0xfcfe('0x3a')]);_0x2a424c[_0xfcfe('0x3c')]=_[_0xfcfe('0x3d')](_0x2a424c['model'],_0x2a424c['query']);_0x473fc4[_0xfcfe('0x3f')]=_[_0xfcfe('0x3d')](_0x2a424c['model'],qs[_0xfcfe('0x3e')](_0x357a61['query'][_0xfcfe('0x3e')]));_0x473fc4[_0xfcfe('0x3f')]=_0x473fc4[_0xfcfe('0x3f')][_0xfcfe('0x40')]?_0x473fc4[_0xfcfe('0x3f')]:_0x2a424c[_0xfcfe('0x39')];if(_0x357a61['query'][_0xfcfe('0x4d')]){_0x473fc4['include']=[{'all':!![]}];}_0x473fc4=_['merge']({},_0x473fc4,_0x357a61['options']);return db[_0xfcfe('0x4a')][_0xfcfe('0x4e')](_0x473fc4)[_0xfcfe('0x1b')](handleEntityNotFound(_0x5300ab,null))[_0xfcfe('0x1b')](respondWithResult(_0x5300ab,null))['catch'](handleError(_0x5300ab,null));};exports['create']=function(_0x5b0a7b,_0x160e7a){return db[_0xfcfe('0x4a')]['create'](_0x5b0a7b['body'],{})['then'](respondWithResult(_0x160e7a,0xc9))[_0xfcfe('0x23')](handleError(_0x160e7a,null));};exports[_0xfcfe('0x2e')]=function(_0x28ceff,_0x45892c){if(_0x28ceff[_0xfcfe('0x4f')]['id']){delete _0x28ceff[_0xfcfe('0x4f')]['id'];}return db[_0xfcfe('0x4a')]['find']({'where':{'id':_0x28ceff[_0xfcfe('0x4c')]['id']}})[_0xfcfe('0x1b')](handleEntityNotFound(_0x45892c,null))[_0xfcfe('0x1b')](saveUpdates(_0x28ceff['body'],null))['then'](respondWithResult(_0x45892c,null))['catch'](handleError(_0x45892c,null));};exports['destroy']=function(_0x159bc5,_0x1ad261){return db['ChatGroup'][_0xfcfe('0x4e')]({'where':{'id':_0x159bc5[_0xfcfe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ad261,null))['then'](removeEntity(_0x1ad261,null))[_0xfcfe('0x23')](handleError(_0x1ad261,null));};exports[_0xfcfe('0x50')]=function(_0x2ac10d,_0x1cef53){return db[_0xfcfe('0x4a')][_0xfcfe('0x50')]()[_0xfcfe('0x1b')](respondWithResult(_0x1cef53,null))[_0xfcfe('0x23')](handleError(_0x1cef53,null));};exports[_0xfcfe('0x51')]=function(_0xe172c2,_0x2188c2,_0x5b517d){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0xe172c2[_0xfcfe('0x4c')]['id'],'ToId':_0xe172c2['user']['id'],'read':![]}})[_0xfcfe('0x1b')](function(_0xde17be){return{'id':_[_0xfcfe('0x52')](_0xe172c2[_0xfcfe('0x4c')]['id']),'count':_0xde17be};})[_0xfcfe('0x1b')](respondWithResult(_0x2188c2,null))[_0xfcfe('0x23')](handleError(_0x2188c2,null));};exports['addMembers']=function(_0x4da30b,_0x2477d3,_0x46ea9e){return db[_0xfcfe('0x4a')][_0xfcfe('0x4e')]({'where':{'id':_0x4da30b[_0xfcfe('0x4c')]['id']}})[_0xfcfe('0x1b')](handleEntityNotFound(_0x2477d3,null))[_0xfcfe('0x1b')](function(_0x58dc6f){if(_0x58dc6f){return _0x58dc6f[_0xfcfe('0x53')](_0x4da30b[_0xfcfe('0x4f')][_0xfcfe('0x54')],_['omit'](_0x4da30b[_0xfcfe('0x4f')],[_0xfcfe('0x54'),'id'])||{});}})['then'](respondWithResult(_0x2477d3,null))[_0xfcfe('0x23')](handleError(_0x2477d3,null));};exports[_0xfcfe('0x55')]=function(_0x2069de,_0x57b09e,_0x2b9db0){var _0x368eaa={};var _0x2a8a49={};var _0x3d324a;var _0x58a765;return db[_0xfcfe('0x4a')][_0xfcfe('0x56')]({'where':{'id':_0x2069de['params']['id']}})['then'](handleEntityNotFound(_0x57b09e,null))[_0xfcfe('0x1b')](function(_0x4a427e){if(_0x4a427e){_0x3d324a=_0x4a427e;_0x2a8a49[_0xfcfe('0x39')]=_['keys'](db['User'][_0xfcfe('0x35')]);_0x2a8a49[_0xfcfe('0x3a')]=_[_0xfcfe('0x3b')](_0x2069de[_0xfcfe('0x3a')]);_0x2a8a49[_0xfcfe('0x3c')]=_[_0xfcfe('0x3d')](_0x2a8a49[_0xfcfe('0x39')],_0x2a8a49[_0xfcfe('0x3a')]);_0x368eaa[_0xfcfe('0x3f')]=_[_0xfcfe('0x3d')](_0x2a8a49[_0xfcfe('0x39')],qs[_0xfcfe('0x3e')](_0x2069de[_0xfcfe('0x3a')]['fields']));_0x368eaa[_0xfcfe('0x3f')]=_0x368eaa[_0xfcfe('0x3f')][_0xfcfe('0x40')]?_0x368eaa[_0xfcfe('0x3f')]:_0x2a8a49[_0xfcfe('0x39')];_0x368eaa[_0xfcfe('0x42')]=qs[_0xfcfe('0x43')](_0x2069de[_0xfcfe('0x3a')][_0xfcfe('0x43')]);_0x368eaa[_0xfcfe('0x44')]=qs[_0xfcfe('0x3c')](_[_0xfcfe('0x45')](_0x2069de[_0xfcfe('0x3a')],_0x2a8a49[_0xfcfe('0x3c')]));if(_0x2069de[_0xfcfe('0x3a')][_0xfcfe('0x46')]){_0x368eaa['where']=_[_0xfcfe('0x47')](_0x368eaa[_0xfcfe('0x44')],{'$or':_[_0xfcfe('0x34')](_0x368eaa['attributes'],function(_0x45fb0d){var _0xcc7aff={};_0xcc7aff[_0x45fb0d]={'$like':'%'+_0x2069de[_0xfcfe('0x3a')]['filter']+'%'};return _0xcc7aff;})});}_0x368eaa=_[_0xfcfe('0x47')]({},_0x368eaa,_0x2069de['options']);return _0x3d324a[_0xfcfe('0x55')](_0x368eaa);}})['then'](function(_0x58d491){if(_0x58d491){_0x58a765=_0x58d491[_0xfcfe('0x40')];if(!_0x2069de[_0xfcfe('0x3a')][_0xfcfe('0x57')](_0xfcfe('0x41'))){_0x368eaa[_0xfcfe('0x29')]=qs[_0xfcfe('0x29')](_0x2069de[_0xfcfe('0x3a')][_0xfcfe('0x29')]);_0x368eaa[_0xfcfe('0x28')]=qs[_0xfcfe('0x28')](_0x2069de[_0xfcfe('0x3a')][_0xfcfe('0x28')]);}return _0x3d324a[_0xfcfe('0x55')](_0x368eaa);}})[_0xfcfe('0x1b')](function(_0x344e64){if(_0x344e64){return _0x344e64?{'count':_0x58a765,'rows':_0x344e64}:null;}})[_0xfcfe('0x1b')](respondWithResult(_0x57b09e,null))[_0xfcfe('0x23')](handleError(_0x57b09e,null));};exports[_0xfcfe('0x58')]=function(_0x3ba23f,_0x57d41b,_0xbb8786){return db[_0xfcfe('0x4a')]['find']({'where':{'id':_0x3ba23f['params']['id']}})['then'](handleEntityNotFound(_0x57d41b,null))[_0xfcfe('0x1b')](function(_0x10a290){if(_0x10a290){return _0x10a290[_0xfcfe('0x58')](_0x3ba23f[_0xfcfe('0x3a')][_0xfcfe('0x54')]);}})[_0xfcfe('0x1b')](respondWithStatusCode(_0x57d41b,null))[_0xfcfe('0x23')](handleError(_0x57d41b,null));};exports['addMessage']=function(_0x1819bf,_0x31fef1,_0x55905c){if(_0x1819bf[_0xfcfe('0x4f')]['id']){delete _0x1819bf[_0xfcfe('0x4f')]['id'];}return db[_0xfcfe('0x4a')][_0xfcfe('0x4e')]({'where':{'id':_0x1819bf[_0xfcfe('0x4c')]['id']}})[_0xfcfe('0x1b')](handleEntityNotFound(_0x31fef1,null))[_0xfcfe('0x1b')](function(_0x3a7147){if(_0x3a7147){_0x1819bf['body'][_0xfcfe('0x59')]=_0x3a7147['id'];return db[_0xfcfe('0x5a')][_0xfcfe('0x5b')](_0x1819bf[_0xfcfe('0x4f')]);}})[_0xfcfe('0x1b')](respondWithResult(_0x31fef1,null))[_0xfcfe('0x23')](handleError(_0x31fef1,null));};exports[_0xfcfe('0x5c')]=function(_0x4db3e5,_0x4f6868,_0x9d31b1){var _0x244a12={};var _0x5b73f3={};var _0x15dc6b;var _0x5d0d51;return db['ChatGroup']['findOne']({'where':{'id':_0x4db3e5[_0xfcfe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f6868,null))[_0xfcfe('0x1b')](function(_0x5a3cc9){if(_0x5a3cc9){_0x15dc6b=_0x5a3cc9;_0x5b73f3[_0xfcfe('0x39')]=_[_0xfcfe('0x3b')](db['ChatInternalMessage'][_0xfcfe('0x35')]);_0x5b73f3[_0xfcfe('0x3a')]=_[_0xfcfe('0x3b')](_0x4db3e5[_0xfcfe('0x3a')]);_0x5b73f3[_0xfcfe('0x3c')]=_[_0xfcfe('0x3d')](_0x5b73f3[_0xfcfe('0x39')],_0x5b73f3[_0xfcfe('0x3a')]);_0x244a12['attributes']=_[_0xfcfe('0x3d')](_0x5b73f3[_0xfcfe('0x39')],qs[_0xfcfe('0x3e')](_0x4db3e5['query'][_0xfcfe('0x3e')]));_0x244a12[_0xfcfe('0x3f')]=_0x244a12['attributes'][_0xfcfe('0x40')]?_0x244a12[_0xfcfe('0x3f')]:_0x5b73f3[_0xfcfe('0x39')];_0x244a12['order']=qs[_0xfcfe('0x43')](_0x4db3e5['query'][_0xfcfe('0x43')]);_0x244a12['where']=qs[_0xfcfe('0x3c')](_[_0xfcfe('0x45')](_0x4db3e5['query'],_0x5b73f3[_0xfcfe('0x3c')]));if(_0x4db3e5[_0xfcfe('0x3a')]['filter']){_0x244a12[_0xfcfe('0x44')]=_[_0xfcfe('0x47')](_0x244a12[_0xfcfe('0x44')],{'$or':_['map'](_0x244a12[_0xfcfe('0x3f')],function(_0x44070e){var _0xfcc0e9={};_0xfcc0e9[_0x44070e]={'$like':'%'+_0x4db3e5[_0xfcfe('0x3a')][_0xfcfe('0x46')]+'%'};return _0xfcc0e9;})});}if(_0x4db3e5['query'][_0xfcfe('0x5d')]){var _0x16b0e0=_0x4db3e5[_0xfcfe('0x3a')][_0xfcfe('0x5d')][_0xfcfe('0x5e')](',');var _0x3a194e={};_0x3a194e[_0x16b0e0[0x0]]={'$gte':moment(_0x16b0e0[0x1])['format'](_0xfcfe('0x5f'))};_0x244a12[_0xfcfe('0x44')]=_['merge'](_0x244a12[_0xfcfe('0x44')],_0x3a194e);}_0x244a12=_['merge']({},_0x244a12,_0x4db3e5[_0xfcfe('0x60')]);return _0x15dc6b[_0xfcfe('0x5c')](_0x244a12);}})['then'](function(_0x53fc17){if(_0x53fc17){_0x5d0d51=_0x53fc17['length'];if(!_0x4db3e5['query'][_0xfcfe('0x57')](_0xfcfe('0x41'))){_0x244a12[_0xfcfe('0x29')]=qs['limit'](_0x4db3e5[_0xfcfe('0x3a')]['limit']);_0x244a12[_0xfcfe('0x28')]=qs[_0xfcfe('0x28')](_0x4db3e5[_0xfcfe('0x3a')][_0xfcfe('0x28')]);}return _0x15dc6b[_0xfcfe('0x5c')](_0x244a12);}})[_0xfcfe('0x1b')](function(_0xbfeac7){if(_0xbfeac7){return _0xbfeac7?{'count':_0x5d0d51,'rows':_0xbfeac7}:null;}})[_0xfcfe('0x1b')](respondWithResult(_0x4f6868,null))['catch'](handleError(_0x4f6868,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b01c20e..642e1a5 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x9dec93,_0x461131){var _0x1a2184=function(_0x19c6c4){while(--_0x19c6c4){_0x9dec93['push'](_0x9dec93['shift']());}};_0x1a2184(++_0x461131);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5b11d2,_0x19cb1b){var _0x4908b6=function(_0x57d3cf){while(--_0x57d3cf){_0x5b11d2['push'](_0x5b11d2['shift']());}};_0x4908b6(++_0x19cb1b);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfd183f,_0x21bbde){_0xfd183f=_0xfd183f-0x0;var _0x40b42e=_0x0b0e[_0xfd183f];return _0x40b42e;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 236fa02..86694d4 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 _0x0f89=['moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x0f89,0x111));var _0x90f8=function(_0x115bf6,_0xb66009){_0x115bf6=_0x115bf6-0x0;var _0x379ee5=_0x0f89[_0x115bf6];return _0x379ee5;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var logger=require(_0x90f8('0x2'))('api');var moment=require(_0x90f8('0x3'));var BPromise=require(_0x90f8('0x4'));var rp=require(_0x90f8('0x5'));var fs=require('fs');var path=require(_0x90f8('0x6'));var rimraf=require('rimraf');var config=require(_0x90f8('0x7'));var attributes=require(_0x90f8('0x8'));module['exports']=function(_0x7b8d25,_0x4439a9){return _0x7b8d25[_0x90f8('0x9')](_0x90f8('0xa'),attributes,{'tableName':_0x90f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','chat_groups'];(function(_0x41ccdf,_0x501a79){var _0x37e1fa=function(_0x4e28f2){while(--_0x4e28f2){_0x41ccdf['push'](_0x41ccdf['shift']());}};_0x37e1fa(++_0x501a79);}(_0xe015,0x13b));var _0x5e01=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe015[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('ChatGroup',attributes,{'tableName':_0x5e01('0x8'),'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 48f32e7..7e5da83 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 _0x52a7=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1fced3,_0x1a65f9){var _0x1324b5=function(_0x35aeb2){while(--_0x35aeb2){_0x1fced3['push'](_0x1fced3['shift']());}};_0x1324b5(++_0x1a65f9);}(_0x52a7,0x93));var _0x752a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x52a7[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x752a('0x0'));var util=require(_0x752a('0x1'));var moment=require(_0x752a('0x2'));var BPromise=require(_0x752a('0x3'));var rs=require(_0x752a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x752a('0x5'))['db'];var utils=require(_0x752a('0x6'));var logger=require(_0x752a('0x7'))(_0x752a('0x8'));var config=require(_0x752a('0x9'));var jayson=require(_0x752a('0xa'));var client=jayson['client'][_0x752a('0xb')]({'port':0x232a});config['redis']=_[_0x752a('0xc')](config[_0x752a('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x752a('0xd')]));require(_0x752a('0xe'))[_0x752a('0xf')](socket);function respondWithRpcPromise(_0x2e6763,_0x5102f8,_0x1c7abb){return new BPromise(function(_0x438245,_0x57064d){return client[_0x752a('0x10')](_0x2e6763,_0x1c7abb)[_0x752a('0x11')](function(_0x3978d7){logger[_0x752a('0x12')](_0x752a('0x13'),_0x5102f8,'request\x20sent');logger[_0x752a('0x14')](_0x752a('0x15'),_0x5102f8,_0x752a('0x16'),JSON[_0x752a('0x17')](_0x3978d7));if(_0x3978d7['error']){if(_0x3978d7[_0x752a('0x18')][_0x752a('0x19')]===0x1f4){logger[_0x752a('0x18')](_0x752a('0x13'),_0x5102f8,_0x3978d7['error'][_0x752a('0x1a')]);return _0x57064d(_0x3978d7[_0x752a('0x18')]['message']);}logger[_0x752a('0x18')](_0x752a('0x13'),_0x5102f8,_0x3978d7[_0x752a('0x18')][_0x752a('0x1a')]);return _0x438245(_0x3978d7[_0x752a('0x18')][_0x752a('0x1a')]);}else{logger[_0x752a('0x12')](_0x752a('0x13'),_0x5102f8,_0x752a('0x16'));_0x438245(_0x3978d7[_0x752a('0x1b')][_0x752a('0x1a')]);}})[_0x752a('0x1c')](function(_0x506529){logger['error'](_0x752a('0x13'),_0x5102f8,_0x506529);_0x57064d(_0x506529);});});} \ No newline at end of file +var _0xcfa8=['./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x22ee34,_0x141b90){var _0x155387=function(_0x11101f){while(--_0x11101f){_0x22ee34['push'](_0x22ee34['shift']());}};_0x155387(++_0x141b90);}(_0xcfa8,0x114));var _0x8cfa=function(_0x30ac40,_0x161b54){_0x30ac40=_0x30ac40-0x0;var _0x9e4524=_0xcfa8[_0x30ac40];return _0x9e4524;};'use strict';var _=require(_0x8cfa('0x0'));var util=require(_0x8cfa('0x1'));var moment=require('moment');var BPromise=require(_0x8cfa('0x2'));var rs=require(_0x8cfa('0x3'));var fs=require('fs');var Redis=require(_0x8cfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cfa('0x5'));var logger=require('../../config/logger')(_0x8cfa('0x6'));var config=require(_0x8cfa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8cfa('0x8')]({'port':0x232a});config[_0x8cfa('0x9')]=_[_0x8cfa('0xa')](config[_0x8cfa('0x9')],{'host':_0x8cfa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cfa('0x9')]));require(_0x8cfa('0xc'))['register'](socket);function respondWithRpcPromise(_0x34fa29,_0x498c3e,_0xd3a32f){return new BPromise(function(_0xc3f0e2,_0x3b8910){return client[_0x8cfa('0xd')](_0x34fa29,_0xd3a32f)[_0x8cfa('0xe')](function(_0x5167d2){logger[_0x8cfa('0xf')](_0x8cfa('0x10'),_0x498c3e,'request\x20sent');logger[_0x8cfa('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x498c3e,_0x8cfa('0x12'),JSON[_0x8cfa('0x13')](_0x5167d2));if(_0x5167d2[_0x8cfa('0x14')]){if(_0x5167d2[_0x8cfa('0x14')][_0x8cfa('0x15')]===0x1f4){logger[_0x8cfa('0x14')]('ChatGroup,\x20%s,\x20%s',_0x498c3e,_0x5167d2['error'][_0x8cfa('0x16')]);return _0x3b8910(_0x5167d2[_0x8cfa('0x14')]['message']);}logger[_0x8cfa('0x14')]('ChatGroup,\x20%s,\x20%s',_0x498c3e,_0x5167d2[_0x8cfa('0x14')]['message']);return _0xc3f0e2(_0x5167d2[_0x8cfa('0x14')][_0x8cfa('0x16')]);}else{logger[_0x8cfa('0xf')](_0x8cfa('0x10'),_0x498c3e,_0x8cfa('0x12'));_0xc3f0e2(_0x5167d2[_0x8cfa('0x17')][_0x8cfa('0x16')]);}})['catch'](function(_0x451552){logger[_0x8cfa('0x14')](_0x8cfa('0x10'),_0x498c3e,_0x451552);_0x3b8910(_0x451552);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a7ecc89..11addde 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 _0x78db=['./chatGroup.events','remove','update','register','chatGroup:'];(function(_0x789efb,_0x54f2fe){var _0x531bae=function(_0x2386be){while(--_0x2386be){_0x789efb['push'](_0x789efb['shift']());}};_0x531bae(++_0x54f2fe);}(_0x78db,0x186));var _0xb78d=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x78db[_0xbec8e6];return _0x4aa6f2;};'use strict';var ChatGroupEvents=require(_0xb78d('0x0'));var events=['save',_0xb78d('0x1'),_0xb78d('0x2')];function createListener(_0x27141b,_0x51949d){return function(_0x10f834){_0x51949d['emit'](_0x27141b,_0x10f834);};}function removeListener(_0x4cf0b6,_0x5785f5){return function(){ChatGroupEvents['removeListener'](_0x4cf0b6,_0x5785f5);};}exports[_0xb78d('0x3')]=function(_0x89e098){for(var _0x235217=0x0,_0x191143=events['length'];_0x235217<_0x191143;_0x235217++){var _0x180b24=events[_0x235217];var _0x53d6f0=createListener(_0xb78d('0x4')+_0x180b24,_0x89e098);ChatGroupEvents['on'](_0x180b24,_0x53d6f0);}}; \ No newline at end of file +var _0x8c12=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register','length'];(function(_0x48c172,_0x171787){var _0x1db796=function(_0x5d1909){while(--_0x5d1909){_0x48c172['push'](_0x48c172['shift']());}};_0x1db796(++_0x171787);}(_0x8c12,0xd9));var _0x28c1=function(_0x24a690,_0x5934cf){_0x24a690=_0x24a690-0x0;var _0x66cbc7=_0x8c12[_0x24a690];return _0x66cbc7;};'use strict';var ChatGroupEvents=require(_0x28c1('0x0'));var events=[_0x28c1('0x1'),_0x28c1('0x2'),_0x28c1('0x3')];function createListener(_0x5398ff,_0x552a43){return function(_0x42c65c){_0x552a43[_0x28c1('0x4')](_0x5398ff,_0x42c65c);};}function removeListener(_0x284ec1,_0x3654dc){return function(){ChatGroupEvents[_0x28c1('0x5')](_0x284ec1,_0x3654dc);};}exports[_0x28c1('0x6')]=function(_0x2cbe04){for(var _0x2a6ef4=0x0,_0xeb24fa=events[_0x28c1('0x7')];_0x2a6ef4<_0xeb24fa;_0x2a6ef4++){var _0x5ef823=events[_0x2a6ef4];var _0x38470d=createListener(_0x28c1('0x8')+_0x5ef823,_0x2cbe04);ChatGroupEvents['on'](_0x5ef823,_0x38470d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4ada8de..ce4f955 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 _0x8eee=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/unread','/:id/members','/:id/messages','post','put','/:id','update','delete','destroy','removeMembers','exports'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x8eee,0xfd));var _0xe8ee=function(_0x538b31,_0x80e294){_0x538b31=_0x538b31-0x0;var _0x4348f0=_0x8eee[_0x538b31];return _0x4348f0;};'use strict';var multer=require('multer');var util=require(_0xe8ee('0x0'));var path=require('path');var timeout=require(_0xe8ee('0x1'));var express=require(_0xe8ee('0x2'));var router=express['Router']();var auth=require(_0xe8ee('0x3'));var interaction=require(_0xe8ee('0x4'));var config=require(_0xe8ee('0x5'));var controller=require('./chatGroup.controller');router[_0xe8ee('0x6')]('/',auth[_0xe8ee('0x7')](),controller[_0xe8ee('0x8')]);router[_0xe8ee('0x6')](_0xe8ee('0x9'),auth[_0xe8ee('0x7')](),controller[_0xe8ee('0xa')]);router[_0xe8ee('0x6')]('/:id',auth[_0xe8ee('0x7')](),controller[_0xe8ee('0xb')]);router['get'](_0xe8ee('0xc'),auth[_0xe8ee('0x7')](),controller['getUnread']);router[_0xe8ee('0x6')](_0xe8ee('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xe8ee('0xe'),auth[_0xe8ee('0x7')](),controller['getMessages']);router['post']('/',auth[_0xe8ee('0x7')](),controller['create']);router[_0xe8ee('0xf')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router['post'](_0xe8ee('0xe'),auth[_0xe8ee('0x7')](),controller['addMessage']);router[_0xe8ee('0x10')](_0xe8ee('0x11'),auth[_0xe8ee('0x7')](),controller[_0xe8ee('0x12')]);router[_0xe8ee('0x13')](_0xe8ee('0x11'),auth['isAuthenticated'](),controller[_0xe8ee('0x14')]);router['delete'](_0xe8ee('0xd'),auth[_0xe8ee('0x7')](),controller[_0xe8ee('0x15')]);module[_0xe8ee('0x16')]=router; \ No newline at end of file +var _0xd477=['index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','post','addMembers','/:id/messages','addMessage','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x6ff5d4,_0x44faf6){var _0x37ae7f=function(_0x197f37){while(--_0x197f37){_0x6ff5d4['push'](_0x6ff5d4['shift']());}};_0x37ae7f(++_0x44faf6);}(_0xd477,0x17d));var _0x7d47=function(_0x37ea17,_0x58c122){_0x37ea17=_0x37ea17-0x0;var _0x4c6387=_0xd477[_0x37ea17];return _0x4c6387;};'use strict';var multer=require(_0x7d47('0x0'));var util=require(_0x7d47('0x1'));var path=require(_0x7d47('0x2'));var timeout=require(_0x7d47('0x3'));var express=require('express');var router=express[_0x7d47('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7d47('0x5'));var config=require(_0x7d47('0x6'));var controller=require('./chatGroup.controller');router[_0x7d47('0x7')]('/',auth[_0x7d47('0x8')](),controller[_0x7d47('0x9')]);router[_0x7d47('0x7')](_0x7d47('0xa'),auth[_0x7d47('0x8')](),controller[_0x7d47('0xb')]);router[_0x7d47('0x7')](_0x7d47('0xc'),auth['isAuthenticated'](),controller[_0x7d47('0xd')]);router[_0x7d47('0x7')](_0x7d47('0xe'),auth[_0x7d47('0x8')](),controller[_0x7d47('0xf')]);router['get'](_0x7d47('0x10'),auth[_0x7d47('0x8')](),controller[_0x7d47('0x11')]);router[_0x7d47('0x7')]('/:id/messages',auth[_0x7d47('0x8')](),controller['getMessages']);router[_0x7d47('0x12')]('/',auth[_0x7d47('0x8')](),controller['create']);router[_0x7d47('0x12')]('/:id/members',auth[_0x7d47('0x8')](),controller[_0x7d47('0x13')]);router[_0x7d47('0x12')](_0x7d47('0x14'),auth[_0x7d47('0x8')](),controller[_0x7d47('0x15')]);router['put'](_0x7d47('0xc'),auth['isAuthenticated'](),controller[_0x7d47('0x16')]);router[_0x7d47('0x17')](_0x7d47('0xc'),auth[_0x7d47('0x8')](),controller[_0x7d47('0x18')]);router[_0x7d47('0x17')](_0x7d47('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x7d47('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 5480c41..4cdd7ea 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 _0xefe3=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long','out'];(function(_0x830eab,_0x241a26){var _0x572f39=function(_0x396696){while(--_0x396696){_0x830eab['push'](_0x830eab['shift']());}};_0x572f39(++_0x241a26);}(_0xefe3,0xd1));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3efe('0x0'));module[_0x3efe('0x1')]={'closed':{'type':Sequelize[_0x3efe('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3efe('0x3')]},'ratingType':{'type':Sequelize[_0x3efe('0x4')](_0x3efe('0x5'),'thumb'),'defaultValue':_0x3efe('0x5')},'ratingMessage':{'type':Sequelize[_0x3efe('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3efe('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3efe('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3efe('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3efe('0x7')]},'browserName':{'type':Sequelize[_0x3efe('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x3efe('0x7')]},'deviceModel':{'type':Sequelize[_0x3efe('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x3efe('0x7')]},'referer':{'type':Sequelize[_0x3efe('0x6')]},'customerIp':{'type':Sequelize[_0x3efe('0x7')]},'formData':{'type':Sequelize[_0x3efe('0x6')](_0x3efe('0x9'))},'read1stAt':{'type':Sequelize[_0x3efe('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3efe('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3efe('0x4')]('in',_0x3efe('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3efe('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9e26=['STRING','DATE','long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9e26,0x87));var _0x69e2=function(_0x5b6e65,_0xf3e3e2){_0x5b6e65=_0x5b6e65-0x0;var _0x53bf0f=_0x9e26[_0x5b6e65];return _0x53bf0f;};'use strict';var Sequelize=require(_0x69e2('0x0'));module[_0x69e2('0x1')]={'closed':{'type':Sequelize[_0x69e2('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x69e2('0x3')]},'ratingType':{'type':Sequelize[_0x69e2('0x4')](_0x69e2('0x5'),_0x69e2('0x6')),'defaultValue':_0x69e2('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x69e2('0x7')]},'mailTranscript':{'type':Sequelize[_0x69e2('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x69e2('0x9')]},'disposition':{'type':Sequelize[_0x69e2('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x69e2('0x8')]},'note':{'type':Sequelize[_0x69e2('0x8')]},'browserName':{'type':Sequelize[_0x69e2('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x69e2('0x8')]},'osVersion':{'type':Sequelize[_0x69e2('0x8')]},'deviceModel':{'type':Sequelize[_0x69e2('0x8')]},'deviceVendor':{'type':Sequelize[_0x69e2('0x8')]},'deviceType':{'type':Sequelize[_0x69e2('0x8')]},'referer':{'type':Sequelize[_0x69e2('0x7')]},'customerIp':{'type':Sequelize[_0x69e2('0x8')]},'formData':{'type':Sequelize[_0x69e2('0x7')](_0x69e2('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x69e2('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x69e2('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x69e2('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x69e2('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 346e749..848d840 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 _0x919a=['operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','some','compact','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','show','params','includeAll','include','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','mimetype','Attachment','attachmentDownload','closed','attachId','download','server/files/attachments/','basename','close','mailTranscript','root','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','System','customer','%s%d','Visitor','website_alias','agent_alias','alias','agent_fullname','agentAlias','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','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','nolimit','filter','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','includeAgent','addTags','chatInteractionTags:save','removeTags','unix','join','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','Owner','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Account','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','out','views','toFile','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','json','count','offset','set','update','destroy','status','end','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','from','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','User'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x919a,0xbd));var _0xa919=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x919a[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xa919('0x0'));var emlformat=require(_0xa919('0x1'));var rimraf=require(_0xa919('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa919('0x3'));var moment=require(_0xa919('0x4'));var BPromise=require(_0xa919('0x5'));var Mustache=require('mustache');var util=require(_0xa919('0x6'));var path=require(_0xa919('0x7'));var sox=require(_0xa919('0x8'));var csv=require('to-csv');var ejs=require(_0xa919('0x9'));var fs=require('fs');var _=require(_0xa919('0xa'));var squel=require('squel');var crypto=require(_0xa919('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa919('0xc'));var querystring=require('querystring');var Papa=require(_0xa919('0xd'));var Redis=require('ioredis');var authService=require(_0xa919('0xe'));var qs=require(_0xa919('0xf'));var as=require(_0xa919('0x10'));var hardwareService=require(_0xa919('0x11'));var logger=require(_0xa919('0x12'))(_0xa919('0x13'));var utils=require(_0xa919('0x14'));var config=require(_0xa919('0x15'));var licenseUtil=require(_0xa919('0x16'));var db=require(_0xa919('0x17'))['db'];config[_0xa919('0x18')]=_['defaults'](config['redis'],{'host':_0xa919('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa919('0x1a'))[_0xa919('0x1b')](socket);var jayson=require(_0xa919('0x1c'));var client=jayson[_0xa919('0x1d')]['http']({'port':0x232b});var client9004=jayson['client'][_0xa919('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2e71ec,_0xc05eef,_0x14b886,_0x48bd6b){return new BPromise(function(_0x58a0e3,_0x57b7f7){var _0x591fff=_0x48bd6b||client;return _0x591fff[_0xa919('0x1f')](_0x2e71ec,_0x14b886)[_0xa919('0x20')](function(_0x5004e6){logger['info'](_0xa919('0x21'),_0xc05eef,_0xa919('0x22'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xc05eef,'request\x20sent',JSON['stringify'](_0x5004e6));if(_0x5004e6['error']){if(_0x5004e6[_0xa919('0x23')][_0xa919('0x24')]===0x1f4){logger[_0xa919('0x23')](_0xa919('0x21'),_0xc05eef,_0x5004e6[_0xa919('0x23')]['message']);return _0x57b7f7(_0x5004e6[_0xa919('0x23')][_0xa919('0x25')]);}logger[_0xa919('0x23')](_0xa919('0x21'),_0xc05eef,_0x5004e6[_0xa919('0x23')]['message']);return _0x58a0e3(_0x5004e6['error']['message']);}else{logger[_0xa919('0x26')](_0xa919('0x21'),_0xc05eef,_0xa919('0x22'));_0x58a0e3(_0x5004e6['result'][_0xa919('0x25')]);}})['catch'](function(_0x2fecb8){logger[_0xa919('0x23')](_0xa919('0x21'),_0xc05eef,_0x2fecb8);_0x57b7f7(_0x2fecb8);});});}function respondWithStatusCode(_0x35b186,_0x4c603d){_0x4c603d=_0x4c603d||0xcc;return function(_0x9b5448){if(_0x9b5448){return _0x35b186[_0xa919('0x27')](_0x4c603d);}return _0x35b186['status'](_0x4c603d)['end']();};}function respondWithResult(_0x2ba1d1,_0x8206a0){_0x8206a0=_0x8206a0||0xc8;return function(_0x2df0d6){if(_0x2df0d6){return _0x2ba1d1['status'](_0x8206a0)[_0xa919('0x28')](_0x2df0d6);}};}function respondWithFilteredResult(_0x98fb5b,_0x43cce9){return function(_0x2ace7e){if(_0x2ace7e){var _0x30440e=_0x2ace7e[_0xa919('0x29')],_0x167edd=_0x43cce9['offset'],_0x2a1d50=_0x43cce9[_0xa919('0x2a')]+_0x43cce9['limit'],_0x2092a1;if(_0x2a1d50>=_0x30440e){_0x2a1d50=_0x30440e;_0x2092a1=0xc8;}else{_0x2092a1=0xce;}_0x98fb5b['status'](_0x2092a1);return _0x98fb5b[_0xa919('0x2b')]('Content-Range',_0x167edd+'-'+_0x2a1d50+'/'+_0x30440e)[_0xa919('0x28')](_0x2ace7e);}return null;};}function patchUpdates(_0x4aa0d1){return function(_0x4a14cf){try{jsonpatch['apply'](_0x4a14cf,_0x4aa0d1,!![]);}catch(_0x31aad1){return BPromise['reject'](_0x31aad1);}return _0x4a14cf['save']();};}function saveUpdates(_0x3707ea,_0x1c1782){return function(_0x5bbeb4){if(_0x5bbeb4){return _0x5bbeb4[_0xa919('0x2c')](_0x3707ea)[_0xa919('0x20')](function(_0x286f01){return _0x286f01;});}return null;};}function removeEntity(_0x1ae901,_0x4a3676){return function(_0x5cbd95){if(_0x5cbd95){return _0x5cbd95[_0xa919('0x2d')]()[_0xa919('0x20')](function(){_0x1ae901[_0xa919('0x2e')](0xcc)[_0xa919('0x2f')]();});}};}function handleEntityNotFound(_0x2fc956,_0x22d5f8){return function(_0x576b81){if(!_0x576b81){_0x2fc956[_0xa919('0x27')](0x194);}return _0x576b81;};}function handleError(_0x5542ef,_0x44f7a8){_0x44f7a8=_0x44f7a8||0x1f4;return function(_0x192cd5){logger[_0xa919('0x23')](_0x192cd5[_0xa919('0x30')]);if(_0x192cd5[_0xa919('0x31')]){delete _0x192cd5['name'];}_0x5542ef['status'](_0x44f7a8)[_0xa919('0x32')](_0x192cd5);};}function getInteractionUsers(_0x4e0a68,_0x4758a2){return new BPromise(function(_0x225cc0,_0x1a8469){try{if(_0x4758a2[_0x4e0a68['id']]){_0x4e0a68[_0xa919('0x33')]=_[_0xa919('0x34')](_0x4758a2[_0x4e0a68['id']],function(_0x4fe967){return{'id':_0x4fe967['id'],'fullname':_0x4fe967[_0xa919('0x35')]};});}}catch(_0x422e36){_0x1a8469(_0x422e36);}_0x225cc0(_0x4e0a68);});}function getInteractionTags(_0x25e29b,_0x12734e){return new BPromise(function(_0xca78df,_0x475e59){try{if(_0x25e29b[_0xa919('0x36')]){_0x25e29b[_0xa919('0x37')]=[];_0x25e29b[_0xa919('0x36')][_0xa919('0x38')](',')[_0xa919('0x39')](function(_0x2972c0){_0x25e29b[_0xa919('0x37')][_0xa919('0x3a')](_0x12734e[_0x2972c0]);});}delete _0x25e29b[_0xa919('0x36')];}catch(_0x5ee65d){_0x475e59(_0x5ee65d);}_0xca78df(_0x25e29b);});}function updateChatInteraction(_0x3bdf54,_0x1f6a9e,_0x5b979f){return new BPromise(function(_0x5f2eef,_0x10d2ed){return getInteractionUsers(_0x3bdf54,_0x5b979f)['then'](function(_0x24ae1e){return getInteractionTags(_0x24ae1e,_0x1f6a9e);})[_0xa919('0x20')](function(_0x4402db){_0x5f2eef(_0x4402db);})[_0xa919('0x3b')](function(_0x5070a1){_0x10d2ed(_0x5070a1);});});}exports['index']=function(_0x1c0d73,_0x435199){var _0x53c931={},_0x4704d6={},_0x3d9c18={'count':0x0,'rows':[]};var _0x40c71e=_[_0xa919('0x34')](db[_0xa919('0x3c')][_0xa919('0x3d')],function(_0x3e59ee){return{'name':_0x3e59ee[_0xa919('0x3e')],'type':_0x3e59ee[_0xa919('0x3f')][_0xa919('0x40')]};});_0x4704d6[_0xa919('0x41')]=_['map'](_0x40c71e,_0xa919('0x31'));_0x4704d6[_0xa919('0x42')]=_[_0xa919('0x43')](_0x1c0d73[_0xa919('0x42')]);_0x4704d6[_0xa919('0x44')]=_[_0xa919('0x45')](_0x4704d6[_0xa919('0x41')],_0x4704d6[_0xa919('0x42')]);_0x53c931[_0xa919('0x46')]=_[_0xa919('0x45')](_0x4704d6[_0xa919('0x41')],qs[_0xa919('0x47')](_0x1c0d73[_0xa919('0x42')][_0xa919('0x47')]));_0x53c931[_0xa919('0x46')]=_0x53c931[_0xa919('0x46')][_0xa919('0x48')]?_0x53c931['attributes']:_0x4704d6[_0xa919('0x41')];if(!_0x1c0d73[_0xa919('0x42')][_0xa919('0x49')]('nolimit')){_0x53c931[_0xa919('0x4a')]=qs['limit'](_0x1c0d73[_0xa919('0x42')]['limit']);_0x53c931[_0xa919('0x2a')]=qs[_0xa919('0x2a')](_0x1c0d73[_0xa919('0x42')]['offset']);}_0x53c931[_0xa919('0x4b')]=qs['sort'](_0x1c0d73[_0xa919('0x42')][_0xa919('0x4c')]);_0x53c931['where']=qs[_0xa919('0x44')](_[_0xa919('0x4d')](_0x1c0d73[_0xa919('0x42')],_0x4704d6[_0xa919('0x44')]),_0x40c71e);var _0x23e249=[];var _0x4be1ac=squel[_0xa919('0x4e')]()[_0xa919('0x4f')]('id')[_0xa919('0x4f')](_0xa919('0x31'))[_0xa919('0x4f')](_0xa919('0x50'))['from'](_0xa919('0x51'));var _0x278432=squel[_0xa919('0x4e')]()[_0xa919('0x4f')](_0xa919('0x52'))[_0xa919('0x4f')](_0xa919('0x53'))[_0xa919('0x4f')](_0xa919('0x54'))['from'](_0xa919('0x55'),'ui')['left_join'](_0xa919('0x56'),'u',_0xa919('0x57'));var _0x33104e=squel[_0xa919('0x4e')]()[_0xa919('0x58')](_0xa919('0x59'),'i')['left_join'](_0xa919('0x5a'),'c',_0xa919('0x5b'))[_0xa919('0x5c')](_0xa919('0x56'),'o',_0xa919('0x5d'))['left_join'](_0xa919('0x5e'),'a',_0xa919('0x5f'))[_0xa919('0x5c')](_0xa919('0x60'),'me',_0xa919('0x61'))[_0xa919('0x5c')]('chat_interaction_has_tags','it',_0xa919('0x62'))['left_join'](_0xa919('0x51'),'t',_0xa919('0x63'));var _0x4225e1=squel[_0xa919('0x64')]();var _0x30e775=[];var _0xe2e43b=squel[_0xa919('0x64')]();var _0x7e238b;if(_0x1c0d73['query'][_0xa919('0x65')]){_0x7e238b=as[_0xa919('0x66')](_0x1c0d73[_0xa919('0x42')][_0xa919('0x65')]);var _0x524ec9=_0x7e238b[_0xa919('0x67')];for(var _0x348993=0x0;_0x348993<_0x7e238b[_0xa919('0x68')][_0xa919('0x48')];_0x348993++){var _0x2c3c4d=_0x7e238b[_0xa919('0x68')][_0x348993];var _0x4e7512='i';var _0x15b3fd=_[_0xa919('0x69')](_0x40c71e,[_0xa919('0x31'),_0x2c3c4d[_0xa919('0x4f')]]);if(!_0x15b3fd){switch(_0x2c3c4d[_0xa919('0x4f')]){case _0xa919('0x6a'):if(_0x2c3c4d['value']==0x1){_0x33104e['having']('`'+_0x2c3c4d[_0xa919('0x4f')]+_0xa919('0x6b'));}else{_0x33104e['having']('`'+_0x2c3c4d['field']+'`\x20>\x200');}break;case _0xa919('0x6c'):if(_0x2c3c4d['operator']===_0xa919('0x6d')){if(_0x2c3c4d[_0xa919('0x6e')]['split']('\x20')['length']>0x1){_0x4225e1[_0x524ec9](_0xa919('0x6f'),qs[_0xa919('0x70')](_0x2c3c4d[_0xa919('0x6e')]),null);}else{var _0x190d32='%'+_0x2c3c4d[_0xa919('0x6e')]+'%';_0x4225e1[_0x524ec9](_0xa919('0x71'),_0x190d32,_0x190d32,_0x190d32);}}else{_0x15b3fd=_[_0xa919('0x69')](_0x40c71e,[_0xa919('0x31'),'ContactId']);_0x2c3c4d[_0xa919('0x4f')]=_0xa919('0x72');_0x28f194=as['buildExpression'](_0x4e7512,_0x15b3fd[_0xa919('0x3f')],_0x2c3c4d);_0x4225e1[_0x524ec9](_0x28f194[_0xa919('0x73')],_0x28f194[_0xa919('0x6e')][_0xa919('0x74')],_0x28f194[_0xa919('0x6e')]['end']);}break;case _0xa919('0x75'):var _0x2d94ba=_0x2c3c4d[_0xa919('0x6e')]['split'](',')[_0xa919('0x34')](function(_0x3073fe){return Number(_0x3073fe);});_0x2d94ba[_0xa919('0x39')](function(_0x111297){_0xe2e43b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x111297+',%');});_0x30e775=_[_0xa919('0x76')](_0x30e775,_0x2d94ba);break;case _0xa919('0x77'):if(_0x2c3c4d[_0xa919('0x78')]===_0xa919('0x6d')){_0x4225e1[_0x524ec9](_0xa919('0x79'),'%'+_0x2c3c4d[_0xa919('0x6e')]+'%',null);}else{_0x15b3fd=_[_0xa919('0x69')](_0x40c71e,[_0xa919('0x31'),_0xa919('0x7a')]);_0x2c3c4d[_0xa919('0x4f')]='UserId';_0x28f194=as['buildExpression'](_0x4e7512,_0x15b3fd[_0xa919('0x3f')],_0x2c3c4d);_0x4225e1[_0x524ec9](_0x28f194[_0xa919('0x73')],_0x28f194[_0xa919('0x6e')]['start'],_0x28f194['value'][_0xa919('0x2f')]);}break;case _0xa919('0x7b'):_0x28f194=as[_0xa919('0x7c')]('me',null,_0x2c3c4d);_0x4225e1[_0x524ec9](_0x28f194[_0xa919('0x73')],_0x28f194[_0xa919('0x6e')][_0xa919('0x74')],_0x28f194[_0xa919('0x6e')][_0xa919('0x2f')]);break;}}else{var _0x28f194=as[_0xa919('0x7c')](_0x4e7512,_0x15b3fd[_0xa919('0x3f')],_0x2c3c4d);_0x4225e1[_0x524ec9](_0x28f194[_0xa919('0x73')],_0x28f194[_0xa919('0x6e')]['start'],_0x28f194['value'][_0xa919('0x2f')]);}}}else{var _0x186baf=_(_0x1c0d73[_0xa919('0x42')])['keys']()['map'](function(_0x370729){return _[_0xa919('0x7d')](_0x40c71e,[_0xa919('0x31'),_0x370729])?_0x370729:undefined;})[_0xa919('0x7e')]()[_0xa919('0x6e')]();if(!_['isEmpty'](_0x186baf)){_0x186baf[_0xa919('0x39')](function(_0x435f93){if(_0x435f93==='ChatWebsiteId'){_0x33104e[_0xa919('0x7f')](_0xa919('0x80'),[][_0xa919('0x81')](_0x1c0d73[_0xa919('0x42')][_0x435f93]));}else if(_0x435f93===_0xa919('0x82')){var _0x2a7ecb=JSON[_0xa919('0x83')](_0x1c0d73['query'][_0x435f93])[_0xa919('0x84')];var _0x222190=JSON['parse'](_0x1c0d73['query'][_0x435f93])[_0xa919('0x85')];_0x33104e[_0xa919('0x7f')](_0xa919('0x86'),_0x2a7ecb,_0x222190);}else{if(_0x1c0d73['query'][_0x435f93]===_0xa919('0x87')){_0x33104e['where']('i.'+_0x435f93+_0xa919('0x88'));}else{_0x33104e[_0xa919('0x7f')]('i.'+_0x435f93+_0xa919('0x89'),_0x1c0d73['query'][_0x435f93]);}}});}if(_0x1c0d73['query'][_0xa919('0x8a')]){if(_0x1c0d73[_0xa919('0x42')][_0xa919('0x8a')]==0x1){_0x33104e[_0xa919('0x8b')]('`unreadMessages`\x20=\x200');}else{_0x33104e[_0xa919('0x8b')](_0xa919('0x8c'));}}if(_0x1c0d73[_0xa919('0x42')][_0xa919('0x8d')]){_0x30e775=_[_0xa919('0x8e')](_0x1c0d73['query']['tag'])?_0x1c0d73[_0xa919('0x42')]['tag']:new Array(_0x1c0d73[_0xa919('0x42')][_0xa919('0x8d')]);_0x30e775[_0xa919('0x39')](function(_0x445ee8){_0xe2e43b['or'](_0xa919('0x8f'),'%,'+_0x445ee8+',%');});}if(_0x1c0d73[_0xa919('0x42')]['filter']){var _0x36992d=_0x1c0d73['query']['filter'][_0xa919('0x90')]('\x5c','\x5c\x5c')[_0xa919('0x90')](/'/g,'\x27\x27');if(qs[_0xa919('0x91')](_0x36992d)){_0x4225e1['or']('i.id\x20LIKE\x20?',_0x36992d+'%');}else{_0x4225e1['or'](_0xa919('0x92'),qs[_0xa919('0x70')](_0x36992d))['or'](_0xa919('0x93'),_0x36992d+'%');}}}_0x33104e[_0xa919('0x7f')](_0x4225e1);_0x33104e[_0xa919('0x94')]('i.id');var _0x3f1d62={'type':db[_0xa919('0x95')][_0xa919('0x96')][_0xa919('0x97')],'raw':!![]};var _0x985966=_0x33104e[_0xa919('0x98')]();_0x985966[_0xa919('0x4f')]('i.id');_0x985966[_0xa919('0x4f')](_0xa919('0x99'),'unreadMessages');if(_0x53c931[_0xa919('0x4b')]){_0x53c931[_0xa919('0x4b')][_0xa919('0x39')](function(_0x26af94){var _0x3f54bf=_0x26af94[0x0]===_0xa919('0x9a')?_0x26af94[0x0]:'i.'+_0x26af94[0x0];_0x33104e[_0xa919('0x4b')](_0x3f54bf,_0x26af94[0x1]===_0xa919('0x9b')?![]:!![]);});}if(!_['isEmpty'](_0x30e775)){_0x33104e[_0xa919('0x8b')](_0xe2e43b);_0x985966['where'](_0xa919('0x9c'),_0x30e775);}BPromise['resolve']()['then'](function(){if(!_0x7e238b){if(_0x1c0d73[_0xa919('0x42')][_0xa919('0x9d')])return;_0x985966[_0xa919('0x7f')](_0xa919('0x9e'));_0x33104e[_0xa919('0x7f')](_0xa919('0x9e'));return;}if(_0x1c0d73[_0xa919('0x9f')]['role']!==_0xa919('0xa0'))return;return _0x1c0d73['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xa919('0x20')](function(_0x27ffa1){if(_[_0xa919('0xa1')](_0x27ffa1)){_0x985966[_0xa919('0x7f')](_0xa919('0xa2'));_0x33104e[_0xa919('0x7f')](_0xa919('0xa2'));}else{_0x985966['where'](_0xa919('0x80'),_[_0xa919('0x34')](_0x27ffa1,'id'));_0x33104e['where'](_0xa919('0x80'),_[_0xa919('0x34')](_0x27ffa1,'id'));}});})[_0xa919('0x20')](function(){if(_0x1c0d73[_0xa919('0x9f')][_0xa919('0xa3')]===_0xa919('0xa0')&&!_0x7e238b&&!_0x1c0d73[_0xa919('0x42')]['ChatWebsiteId'])return[];return db[_0xa919('0xa4')][_0xa919('0x42')](_0x985966['toString'](),_0x3f1d62);})[_0xa919('0x20')](function(_0x572b62){_0x3d9c18[_0xa919('0x29')]=_0x572b62[_0xa919('0x48')];if(_0x3d9c18['count']===0x0)return[];return db[_0xa919('0xa4')][_0xa919('0x42')](_0x4be1ac[_0xa919('0xa5')](),_0x3f1d62)[_0xa919('0x20')](function(_0x206e34){_0x23e249=_[_0xa919('0xa6')](_0x206e34,'id');_0x3f1d62=_[_0xa919('0xa7')](_0x3f1d62,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c0d73[_0xa919('0x42')]['fields']){_0x53c931[_0xa919('0x46')][_0xa919('0x39')](function(_0x31cb61){_0x33104e['field']('i.'+_0x31cb61);});}else{_0x33104e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x33104e[_0xa919('0x4f')]('a.key',_0xa919('0xa8'));_0x33104e[_0xa919('0x4f')](_0xa919('0xa9'),_0xa919('0xaa'));_0x33104e[_0xa919('0x4f')](_0xa919('0xab'),_0xa919('0x9a'));_0x33104e[_0xa919('0x4f')]('i.*');_0x33104e['field'](_0xa919('0xac'),'Contact.firstName');_0x33104e[_0xa919('0x4f')](_0xa919('0xad'),_0xa919('0xae'));_0x33104e[_0xa919('0x4f')](_0xa919('0xaf'),'Contact.email');_0x33104e[_0xa919('0x4f')](_0xa919('0xb0'),_0xa919('0xb1'));_0x33104e[_0xa919('0x4f')](_0xa919('0xb2'),_0xa919('0xb3'));_0x33104e[_0xa919('0x4f')](_0xa919('0xb4'),_0xa919('0xb5'));_0x33104e['field'](_0xa919('0xb6'),_0xa919('0xb7'));_0x33104e[_0xa919('0x4f')](_0xa919('0xb8'),_0xa919('0xb9'));_0x33104e['field'](_0xa919('0xba'),_0xa919('0x36'));}if(_0x53c931[_0xa919('0x4a')])_0x33104e[_0xa919('0x4a')](_0x53c931[_0xa919('0x4a')]);if(_0x53c931[_0xa919('0x2a')])_0x33104e[_0xa919('0x2a')](_0x53c931[_0xa919('0x2a')]);return db[_0xa919('0xa4')][_0xa919('0x42')](_0x33104e[_0xa919('0xa5')](),_0x3f1d62);})['then'](function(_0x31c50d){_0x278432[_0xa919('0x7f')]('ui.ChatInteractionId\x20IN\x20?',_[_0xa919('0x34')](_0x31c50d,'id'));return db['sequelize'][_0xa919('0x42')](_0x278432['toString'](),_0x3f1d62)[_0xa919('0x20')](function(_0xb00127){var _0x4a630e=_[_0xa919('0xbb')](_0xb00127,_0xa919('0xbc'));var _0xcffd76=[];_0x31c50d[_0xa919('0x39')](function(_0x5298be){_0xcffd76['push'](updateChatInteraction(_0x5298be,_0x23e249,_0x4a630e));});return BPromise['all'](_0xcffd76);});});})[_0xa919('0x20')](function(_0x520030){_0x3d9c18['rows']=_0x520030;return _0x3d9c18;})[_0xa919('0x20')](respondWithFilteredResult(_0x435199,_0x53c931))['catch'](handleError(_0x435199,null));};exports[_0xa919('0xbd')]=function(_0x23da92,_0x555cf3){var _0x4196ed={'raw':![],'where':{'id':_0x23da92[_0xa919('0xbe')]['id']}},_0xf46777={};_0xf46777[_0xa919('0x41')]=_[_0xa919('0x43')](db[_0xa919('0x3c')][_0xa919('0x3d')]);_0xf46777['query']=_[_0xa919('0x43')](_0x23da92[_0xa919('0x42')]);_0xf46777['filters']=_['intersection'](_0xf46777[_0xa919('0x41')],_0xf46777['query']);_0x4196ed[_0xa919('0x46')]=_['intersection'](_0xf46777['model'],qs['fields'](_0x23da92[_0xa919('0x42')]['fields']));_0x4196ed[_0xa919('0x46')]=_0x4196ed[_0xa919('0x46')][_0xa919('0x48')]?_0x4196ed[_0xa919('0x46')]:_0xf46777[_0xa919('0x41')];if(_0x23da92[_0xa919('0x42')][_0xa919('0xbf')]){_0x4196ed[_0xa919('0xc0')]=[{'all':!![]}];}_0x4196ed=_['merge']({},_0x4196ed,_0x23da92['options']);return db[_0xa919('0x3c')][_0xa919('0x69')](_0x4196ed)[_0xa919('0x20')](handleEntityNotFound(_0x555cf3,null))[_0xa919('0x20')](respondWithResult(_0x555cf3,null))[_0xa919('0x3b')](handleError(_0x555cf3,null));};exports['create']=function(_0x803b8f,_0x5495c7){return db[_0xa919('0x3c')][_0xa919('0xc1')](_0x803b8f[_0xa919('0x7b')],{})[_0xa919('0x20')](respondWithResult(_0x5495c7,0xc9))[_0xa919('0x3b')](handleError(_0x5495c7,null));};exports[_0xa919('0x2c')]=function(_0x107ad4,_0x35afe7){if(_0x107ad4[_0xa919('0x7b')]['id']){delete _0x107ad4[_0xa919('0x7b')]['id'];}return db[_0xa919('0x3c')][_0xa919('0x69')]({'where':{'id':_0x107ad4['params']['id']}})['then'](handleEntityNotFound(_0x35afe7,null))[_0xa919('0x20')](saveUpdates(_0x107ad4[_0xa919('0x7b')],null))[_0xa919('0x20')](respondWithResult(_0x35afe7,null))[_0xa919('0x3b')](handleError(_0x35afe7,null));};exports[_0xa919('0x2d')]=function(_0x31ccc5,_0x2df154){return db[_0xa919('0x3c')][_0xa919('0x69')]({'where':{'id':_0x31ccc5[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](handleEntityNotFound(_0x2df154,null))[_0xa919('0x20')](removeEntity(_0x2df154,null))[_0xa919('0x3b')](handleError(_0x2df154,null));};exports[_0xa919('0xc2')]=function(_0x537756,_0x3f60e1){return db[_0xa919('0x3c')][_0xa919('0xc2')]()[_0xa919('0x20')](respondWithResult(_0x3f60e1,null))[_0xa919('0x3b')](handleError(_0x3f60e1,null));};exports[_0xa919('0xc3')]=function(_0x1fdcb3,_0xd88741){var _0x3fae9e=_0x1fdcb3[_0xa919('0xbe')]['id'];var _0x2a7cc7;var _0x73b185;var _0x4bb944;return db['ChatInteraction'][_0xa919('0xc4')]({'where':{'id':_0x3fae9e}})[_0xa919('0x20')](function(_0x3121b1){_0x2a7cc7=_0x3121b1;return db[_0xa919('0xc5')][_0xa919('0xc4')]({'where':{'id':_0x3121b1['ChatWebsiteId']},'attributes':['id',_0xa919('0xc6'),'vidaooEscalation'],'raw':!![]});})[_0xa919('0x20')](function(_0x258195){if(_0x258195&&_0x258195['vidaooApiKey']&&_0x258195['vidaooEscalation']){_0x73b185=_0x258195;var _0xdb7438={'rejectUnauthorized':![],'method':_0xa919('0xc7'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x258195[_0xa919('0xc6')]},'body':{'name':_0xa919('0xc8')+_0x3fae9e},'redirect':_0xa919('0xc9'),'json':!![]};return rp(_0xdb7438);}else{throw new db[(_0xa919('0x95'))][(_0xa919('0xca'))](_0xa919('0xcb'));}})[_0xa919('0x20')](function(_0x38ca7e){_0x4bb944=_0x38ca7e;if(_0x4bb944['id']){var _0x4d48db={'body':_0x4bb944[_0xa919('0xcc')],'ChatWebsiteId':_0x73b185['id'],'ChatInteractionId':_0x2a7cc7['id'],'direction':'out','UserId':_0x1fdcb3['user']['id']};return db[_0xa919('0xcd')][_0xa919('0xc1')](_0x4d48db,{});}else{throw new db['Sequelize']['ValidationError'](_0xa919('0xce'));}})[_0xa919('0x20')](function(){return _0x2a7cc7[_0xa919('0xcf')]({'vidaooSessionId':_0x4bb944['id']});})[_0xa919('0x20')](respondWithResult(_0xd88741,null))['catch'](handleError(_0xd88741,null));};exports[_0xa919('0xd0')]=function(_0x19d7d8,_0x57f429){if(_0x19d7d8[_0xa919('0x7b')]['id']){delete _0x19d7d8['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x19d7d8[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](handleEntityNotFound(_0x57f429,null))['then'](saveUpdates(_0x19d7d8['body'],null))[_0xa919('0x20')](respondWithResult(_0x57f429,null))['catch'](handleError(_0x57f429,null));};exports[_0xa919('0xd1')]=function(_0xf1501c,_0x4604db,_0x378642){if(_0xf1501c[_0xa919('0x7b')]['id']){delete _0xf1501c[_0xa919('0x7b')]['id'];}return db['ChatInteraction'][_0xa919('0x69')]({'where':{'id':_0xf1501c[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](function(_0xfbb73c){if(!_0xfbb73c){logger[_0xa919('0x23')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xa919('0xd1'),0x194,_0xa919('0xd2'));_0x4604db['sendStatus'](0x194);}else{if(_0xfbb73c[_0xa919('0x7a')]){throw new db[(_0xa919('0x95'))][(_0xa919('0xca'))](_0xa919('0xd3'));}}return _0xfbb73c;})['then'](function(_0x28ec69){if(_0x28ec69){return _0x28ec69['update']({'closed':_0xf1501c[_0xa919('0x7b')]['closed'],'disposition':_0xf1501c['body'][_0xa919('0xd4')]})[_0xa919('0x20')](function(_0x22faa3){return _0x22faa3;});}})[_0xa919('0x20')](function(_0x311791){return respondWithRpcPromise(_0xa919('0xd5'),_0xa919('0xd1'),_0xf1501c['body'],client9004);})[_0xa919('0x20')](respondWithResult(_0x4604db,null))['catch'](handleError(_0x4604db,null));};exports['attachmentUpload']=function(_0x5db176,_0x159153,_0x2ad394){_0x5db176['body'][_0xa919('0x31')]=_0x5db176[_0xa919('0xd6')][_0xa919('0xd7')];_0x5db176['body']['basename']=_0x5db176[_0xa919('0xd6')]['filename'];_0x5db176[_0xa919('0x7b')]['type']=_0x5db176[_0xa919('0xd6')][_0xa919('0xd8')];return db[_0xa919('0xd9')]['create'](_0x5db176[_0xa919('0x7b')])[_0xa919('0x20')](respondWithResult(_0x159153,0xc9))[_0xa919('0x3b')](handleError(_0x159153,null));};exports[_0xa919('0xda')]=function(_0x342e1d,_0x509a78,_0x84ec63){return db[_0xa919('0x3c')]['findOne']({'where':{'id':_0x342e1d['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x509a78,null))[_0xa919('0x20')](function(_0x3dba44){if(_0x3dba44){if(_0x3dba44[_0xa919('0xdb')]){return _0x509a78[_0xa919('0x2e')](0x193)[_0xa919('0x28')]({'status':0x193,'message':'Unauthorized'});}return db[_0xa919('0xd9')][_0xa919('0xc4')]({'where':{'id':_0x342e1d[_0xa919('0x42')][_0xa919('0xdc')]},'raw':!![]})['then'](handleEntityNotFound(_0x509a78,null));}})['then'](function(_0x4909b4){if(_0x4909b4){return _0x509a78[_0xa919('0xdd')](path['join'](config['root'],_0xa919('0xde'),_0x4909b4[_0xa919('0xdf')]));}})[_0xa919('0x3b')](handleError(_0x509a78,null));};exports[_0xa919('0xe0')]=function(_0x4454bd,_0x31f671){var _0x62b5fd=null;var _0x882227=null;var _0x2c859e=null;var _0x23be43=null;if(_0x4454bd['body']['id']){delete _0x4454bd[_0xa919('0x7b')]['id'];}if(_0x4454bd['body'][_0xa919('0xe1')]){_0x23be43=path['join'](config[_0xa919('0xe2')],'server/files/chat/upload/',util[_0xa919('0xe3')](_0xa919('0xe4'),Date[_0xa919('0xe5')]()));_0x4454bd[_0xa919('0x7b')][_0xa919('0xe6')]=_0x23be43;}return db['ChatInteraction'][_0xa919('0x69')]({'where':{'id':_0x4454bd[_0xa919('0xbe')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa919('0xe7'),'include':[{'model':db[_0xa919('0x77')],'as':_0xa919('0x77')}]}]})['then'](handleEntityNotFound(_0x31f671,null))[_0xa919('0x20')](saveUpdates(_0x4454bd[_0xa919('0x7b')],null))['then'](function(_0x19e470){if(_0x19e470){_0x62b5fd=_0x19e470;return db[_0xa919('0xc5')]['find']({'where':{'id':_0x62b5fd[_0xa919('0x9d')]}});}})[_0xa919('0x20')](function(_0x26353f){if(_0x26353f){_0x2c859e=_0x26353f;return db[_0xa919('0xe8')][_0xa919('0x69')]({'where':{'id':_0x62b5fd[_0xa919('0x72')]}});}})[_0xa919('0x20')](function(_0x1f1321){if(_0x1f1321){_0x882227=_0x1f1321;if(_0x23be43){var _0x510a68=null;for(var _0x3681cb=0x1;_0x3681cb<_0x62b5fd[_0xa919('0xe7')][_0xa919('0x48')];++_0x3681cb){_0x510a68=_0x62b5fd['Messages'][_0x3681cb];var _0x4f9b8c=_0x510a68[_0xa919('0x7a')]?util['format']('%s%d',_0x2c859e['agentAlias'],_0x510a68[_0xa919('0x7a')]):_0xa919('0xe9');var _0x5e4719=_0x4454bd['body'][_0xa919('0xea')]||util[_0xa919('0xe3')](_0xa919('0xeb'),_0xa919('0xec'),_0x510a68[_0xa919('0x72')]);switch(_0x2c859e['agentIdentifier']){case _0xa919('0xed'):_0x4f9b8c=_0x510a68[_0xa919('0x7a')]?util['format'](_0xa919('0xeb'),_0x2c859e['agentAlias'],_0x510a68[_0xa919('0x7a')]):_0xa919('0xe9');break;case _0xa919('0xee'):_0x4f9b8c=_0x510a68['UserId']?_0x510a68[_0xa919('0x77')][_0xa919('0xef')]||_0x510a68[_0xa919('0x77')][_0xa919('0x35')]:_0xa919('0xe9');break;case _0xa919('0xf0'):_0x4f9b8c=_0x510a68[_0xa919('0x7a')]?_0x510a68['User'][_0xa919('0x35')]:_0xa919('0xe9');break;default:_0x4f9b8c=_0x510a68[_0xa919('0x7a')]?util[_0xa919('0xe3')](_0xa919('0xeb'),_0x2c859e[_0xa919('0xf1')],_0x510a68[_0xa919('0x7a')]):'System';}var _0x1aefcf=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x510a68[_0xa919('0x82')])[_0xa919('0xe3')](_0xa919('0xf2')),_0x510a68[_0xa919('0xf3')]==='in'?_0x5e4719:_0x4f9b8c,_0x510a68[_0xa919('0x7b')]);if(!_0x510a68[_0xa919('0xf4')]){fs[_0xa919('0xf5')](_0x23be43,_0x1aefcf);}}return db[_0xa919('0xf6')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa919('0xf7')],'as':_0xa919('0xf8'),'raw':!![]}]});}}})['then'](function(_0x3499b4){if(_0x3499b4&&_0x3499b4[_0xa919('0xf8')]&&_0x4454bd[_0xa919('0x7b')]){var _0x38de13={'tls':{'rejectUnauthorized':![]}};if(_0x3499b4[_0xa919('0xf8')][_0xa919('0xf9')]){_0x38de13[_0xa919('0xf9')]=_0x3499b4['Smtp'][_0xa919('0xf9')];}else{_0x38de13[_0xa919('0xfa')]=_0x3499b4['Smtp'][_0xa919('0xfa')];_0x38de13['port']=_0x3499b4[_0xa919('0xf8')][_0xa919('0xfb')];_0x38de13['secure']=_0x3499b4[_0xa919('0xf8')][_0xa919('0xfc')];}if(_0x3499b4['Smtp'][_0xa919('0xfd')]){_0x38de13[_0xa919('0xfe')]={'user':_0x3499b4[_0xa919('0xf8')][_0xa919('0x9f')],'pass':_0x3499b4['Smtp']['pass']};}return respondWithRpcPromise(_0xa919('0xff'),_0xa919('0x100'),{'account':_0x38de13,'message':{'from':util[_0xa919('0xe3')](_0xa919('0x101'),_0x3499b4[_0xa919('0x31')],_0x3499b4[_0xa919('0x102')]||_0x3499b4['Smtp'][_0xa919('0x9f')]),'to':_0x4454bd['body'][_0xa919('0xe1')],'subject':_0xa919('0x103'),'text':util[_0xa919('0xe3')](_0xa919('0x104'),_0x4454bd['body'][_0xa919('0xe1')]),'attachments':[{'path':_0x23be43}]}})['then'](function(){return _0x62b5fd;})[_0xa919('0x3b')](function(_0x591fcf){console['error'](_0x591fcf);});}else{return _0x62b5fd;}})[_0xa919('0x20')](respondWithStatusCode(_0x31f671,0xc8))[_0xa919('0x3b')](handleError(_0x31f671,null));};exports[_0xa919('0x105')]=function(_0x14bcd7,_0xbd26e4,_0x5d1c2c){return db[_0xa919('0xcd')]['find']({'where':{'id':_0x14bcd7[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](handleEntityNotFound(_0xbd26e4,null))[_0xa919('0x20')](function(_0x5a145a){if(_0x5a145a){return _0x5a145a[_0xa919('0x105')](_0x14bcd7[_0xa919('0x7b')][_0xa919('0x106')],_[_0xa919('0x107')](_0x14bcd7[_0xa919('0x7b')],['ids','id'])||{});}})[_0xa919('0x20')](respondWithResult(_0xbd26e4,null))[_0xa919('0x3b')](handleError(_0xbd26e4,null));};exports['getMessages']=function(_0x58f2c5,_0x58167e,_0x43fe28){var _0x4259a0={'raw':![],'where':{}};var _0x6de05a={};var _0x20149a={'count':0x0,'rows':[]};return db[_0xa919('0x3c')][_0xa919('0xc4')]({'where':{'id':_0x58f2c5[_0xa919('0xbe')]['id']}})['then'](handleEntityNotFound(_0x58167e,null))['then'](function(_0x290a24){if(_0x290a24){_0x6de05a[_0xa919('0x41')]=_['keys'](db[_0xa919('0xcd')][_0xa919('0x3d')]);_0x6de05a[_0xa919('0x42')]=_['keys'](_0x58f2c5['query']);_0x6de05a[_0xa919('0x44')]=_[_0xa919('0x45')](_0x6de05a['model'],_0x6de05a['query']);_0x4259a0['attributes']=_[_0xa919('0x45')](_0x6de05a['model'],qs[_0xa919('0x47')](_0x58f2c5[_0xa919('0x42')]['fields']));_0x4259a0['attributes']=_0x4259a0[_0xa919('0x46')][_0xa919('0x48')]?_0x4259a0[_0xa919('0x46')]:_0x6de05a[_0xa919('0x41')];if(!_0x58f2c5[_0xa919('0x42')]['hasOwnProperty'](_0xa919('0x108'))){_0x4259a0[_0xa919('0x4a')]=qs['limit'](_0x58f2c5['query'][_0xa919('0x4a')]);_0x4259a0[_0xa919('0x2a')]=qs['offset'](_0x58f2c5['query'][_0xa919('0x2a')]);}_0x4259a0[_0xa919('0x4b')]=qs[_0xa919('0x4c')](_0x58f2c5[_0xa919('0x42')][_0xa919('0x4c')]);_0x4259a0[_0xa919('0x7f')]=qs[_0xa919('0x44')](_['pick'](_0x58f2c5[_0xa919('0x42')],_0x6de05a[_0xa919('0x44')]));_0x4259a0[_0xa919('0x7f')]['ChatInteractionId']=_0x290a24['id'];if(_0x58f2c5['query'][_0xa919('0x109')]){_0x4259a0[_0xa919('0x7f')]=_[_0xa919('0xa7')](_0x4259a0['where'],{'$or':_['map'](_0x4259a0[_0xa919('0x46')],function(_0x108d3d){var _0x4e1234={};_0x4e1234[_0x108d3d]={'$like':'%'+_0x58f2c5['query'][_0xa919('0x109')]+'%'};return _0x4e1234;})});}if(_0x58f2c5[_0xa919('0x42')][_0xa919('0x84')]){var _0x304ae7=_0x58f2c5[_0xa919('0x42')]['$gte'][_0xa919('0x38')](',');var _0x5a4473={};_0x5a4473[_0x304ae7[0x0]]={'$gte':moment(_0x304ae7[0x1])[_0xa919('0xe3')](_0xa919('0x10a'))};_0x4259a0[_0xa919('0x7f')]=_[_0xa919('0xa7')](_0x4259a0[_0xa919('0x7f')],_0x5a4473);}_0x4259a0=_[_0xa919('0xa7')]({},_0x4259a0,_0x58f2c5[_0xa919('0x10b')]);return db[_0xa919('0xcd')][_0xa919('0x29')]({'where':_0x4259a0[_0xa919('0x7f')]})[_0xa919('0x20')](function(_0x57ea9d){_0x20149a[_0xa919('0x29')]=_0x57ea9d;if(_0x58f2c5[_0xa919('0x42')][_0xa919('0xbf')]){_0x4259a0[_0xa919('0xc0')]=[{'all':!![]}];}return db[_0xa919('0xcd')][_0xa919('0x10c')](_0x4259a0);})[_0xa919('0x20')](function(_0x3de9c4){_0x20149a[_0xa919('0x10d')]=_0x3de9c4;return _0x20149a;});}})[_0xa919('0x20')](respondWithFilteredResult(_0x58167e,_0x4259a0))['catch'](handleError(_0x58167e,null));};exports['getMyMessages']=function(_0x2402ea,_0x5ae2e5,_0x349316){var _0x4c6c4f={'where':{}},_0x11dadf={},_0x90d3fe={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x2402ea[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](handleEntityNotFound(_0x5ae2e5,null))[_0xa919('0x20')](function(_0x37b0f0){if(_0x37b0f0){_0x11dadf[_0xa919('0x41')]=_['keys'](db[_0xa919('0xcd')]['rawAttributes']);_0x11dadf[_0xa919('0x42')]=_[_0xa919('0x43')](_0x2402ea[_0xa919('0x42')]);_0x11dadf['filters']=_['intersection'](_0x11dadf[_0xa919('0x41')],_0x11dadf['query']);_0x4c6c4f[_0xa919('0x46')]=_[_0xa919('0x45')](_0x11dadf[_0xa919('0x41')],qs[_0xa919('0x47')](_0x2402ea[_0xa919('0x42')]['fields']));_0x4c6c4f['attributes']=_0x4c6c4f['attributes'][_0xa919('0x48')]?_0x4c6c4f[_0xa919('0x46')]:_0x11dadf[_0xa919('0x41')];if(!_0x2402ea[_0xa919('0x42')][_0xa919('0x49')](_0xa919('0x108'))){_0x4c6c4f[_0xa919('0x4a')]=qs[_0xa919('0x4a')](_0x2402ea[_0xa919('0x42')][_0xa919('0x4a')]);_0x4c6c4f[_0xa919('0x2a')]=qs[_0xa919('0x2a')](_0x2402ea['query'][_0xa919('0x2a')]);}_0x4c6c4f[_0xa919('0x4b')]=qs[_0xa919('0x4c')](_0x2402ea[_0xa919('0x42')][_0xa919('0x4c')]);_0x4c6c4f[_0xa919('0x7f')]=qs[_0xa919('0x44')](_[_0xa919('0x4d')](_0x2402ea[_0xa919('0x42')],_0x11dadf[_0xa919('0x44')]));_0x4c6c4f[_0xa919('0x7f')][_0xa919('0xbc')]=_0x37b0f0['id'];if(_0x2402ea[_0xa919('0x42')][_0xa919('0x109')]){_0x4c6c4f[_0xa919('0x7f')]=_[_0xa919('0xa7')](_0x4c6c4f[_0xa919('0x7f')],{'$or':_[_0xa919('0x34')](_0x4c6c4f[_0xa919('0x46')],function(_0x1df66e){var _0x2f81b3={};_0x2f81b3[_0x1df66e]={'$like':'%'+_0x2402ea[_0xa919('0x42')][_0xa919('0x109')]+'%'};return _0x2f81b3;})});}_0x4c6c4f['where'][_0xa919('0xf4')]=![];if(_0x2402ea['query']['id']){_0x4c6c4f[_0xa919('0x7f')]['id']={'$gt':_0x2402ea[_0xa919('0x42')]['id']};}_0x4c6c4f=_['merge']({},_0x4c6c4f,_0x2402ea[_0xa919('0x10b')]);return db['ChatMessage']['count']({'where':_0x4c6c4f[_0xa919('0x7f')]})[_0xa919('0x20')](function(_0x308ba8){_0x90d3fe[_0xa919('0x29')]=_0x308ba8;_0x4c6c4f[_0xa919('0xc0')]=[];if(_0x2402ea[_0xa919('0x42')][_0xa919('0x10e')]){_0x4c6c4f[_0xa919('0xc0')][_0xa919('0x3a')]({'model':db['User'],'as':_0xa919('0x77'),'attributes':['id',_0xa919('0x35'),'alias']});}if(_0x2402ea[_0xa919('0x42')][_0xa919('0xbf')]){_0x4c6c4f[_0xa919('0xc0')]=[{'all':!![]}];}return db[_0xa919('0xcd')][_0xa919('0x10c')](_0x4c6c4f);})['then'](function(_0x10bf41){_0x90d3fe[_0xa919('0x10d')]=_0x10bf41;return _0x90d3fe;});}})[_0xa919('0x20')](respondWithFilteredResult(_0x5ae2e5,_0x4c6c4f))[_0xa919('0x3b')](handleError(_0x5ae2e5,null));};exports[_0xa919('0x10f')]=function(_0x36156c,_0x368e70,_0x3d6bd7){return db[_0xa919('0x3c')][_0xa919('0x69')]({'where':{'id':_0x36156c[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](handleEntityNotFound(_0x368e70,null))[_0xa919('0x20')](function(_0x5f0375){if(_0x5f0375){return _0x5f0375['setTags'](_0x36156c['body'][_0xa919('0x106')],_['omit'](_0x36156c[_0xa919('0x7b')],[_0xa919('0x106'),'id'])||{})['spread'](function(){return db[_0xa919('0x75')][_0xa919('0x10c')]({'attributes':['id','name',_0xa919('0x50')],'where':{'id':_0x36156c['body'][_0xa919('0x106')]}});})[_0xa919('0x20')](function(_0x18cda1){socket['emit'](_0xa919('0x110'),{'id':Number(_0x36156c[_0xa919('0xbe')]['id']),'tags':_0x18cda1||[]});return{'id':Number(_0x36156c[_0xa919('0xbe')]['id']),'tags':_0x18cda1||[]};});}})[_0xa919('0x20')](respondWithResult(_0x368e70,null))[_0xa919('0x3b')](handleError(_0x368e70,null));};exports[_0xa919('0x111')]=function(_0x560b8c,_0x183e4e,_0x4a9039){return db[_0xa919('0x3c')][_0xa919('0x69')]({'where':{'id':_0x560b8c[_0xa919('0xbe')]['id']}})[_0xa919('0x20')](handleEntityNotFound(_0x183e4e,null))[_0xa919('0x20')](function(_0x200358){if(_0x200358){return _0x200358[_0xa919('0x111')](_0x560b8c[_0xa919('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x183e4e,null))[_0xa919('0x3b')](handleError(_0x183e4e,null));};exports[_0xa919('0xdd')]=function(_0x1362e1,_0x23b569){var _0x2989a2=moment()[_0xa919('0x112')]()[_0xa919('0xa5')]();var _0x156f20=path[_0xa919('0x113')](config[_0xa919('0xe2')],_0xa919('0x114'),'files',_0xa919('0x115'));var _0x42a8b6=path['join'](config[_0xa919('0xe2')],_0xa919('0x114'),_0xa919('0x116'),_0xa919('0x117'));var _0x41ec56=path[_0xa919('0x113')](_0x156f20,_0x2989a2);var _0x207dba=util[_0xa919('0xe3')](_0xa919('0x118'),_0x1362e1['params']['id'],_0x2989a2);var _0x2c8189=path[_0xa919('0x113')](_0x156f20,_0x207dba);var _0xe3825f=[];_0xe3825f[_0xa919('0x3a')]({'model':db[_0xa919('0x77')],'as':_0xa919('0x77'),'attributes':['id',_0xa919('0x35')],'raw':!![]});_0xe3825f[_0xa919('0x3a')]({'model':db[_0xa919('0xe8')],'as':'Contact','attributes':['id',_0xa919('0x119'),_0xa919('0x11a')],'raw':!![]});if(_0x1362e1[_0xa919('0x42')][_0xa919('0x117')]){_0xe3825f['push']({'model':db[_0xa919('0xd9')],'as':'Attachment','raw':!![]});}var _0x1a6e96=[{'model':db['ChatMessage'],'as':_0xa919('0xe7'),'attributes':['id',_0xa919('0x7b'),'createdAt',_0xa919('0xf3'),_0xa919('0xf4'),_0xa919('0x8a')],'include':_0xe3825f}];_0x1a6e96[_0xa919('0x3a')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xa919('0x31')]});_0x1a6e96[_0xa919('0x3a')]({'model':db[_0xa919('0x77')],'as':_0xa919('0x11b'),'attributes':['id','fullname']});return db[_0xa919('0x3c')][_0xa919('0x69')]({'where':{'id':_0x1362e1[_0xa919('0xbe')]['id']},'include':_0x1a6e96})[_0xa919('0x20')](handleEntityNotFound(_0x23b569,null))[_0xa919('0x20')](function(_0x1497c0){if(_0x1497c0){var _0x431beb=_0x1497c0['get']({'plain':!![]});fs[_0xa919('0x11c')](_0x41ec56);var _0x5f3fe4={'format':'A4','border':'10px','header':{'height':_0xa919('0x11d'),'contents':{'first':_0xa919('0x11e')}},'footer':{'height':_0xa919('0x11f'),'contents':{'default':util[_0xa919('0xe3')](_0xa919('0x120'),util[_0xa919('0xe3')](_0xa919('0x121'),'Chat',_0x431beb['id']),moment()[_0xa919('0xe3')](_0xa919('0x122'))[_0xa919('0xa5')]())}}};var _0x59372b={'channel':'Chat','account':_0x431beb[_0xa919('0x123')][_0xa919('0x31')],'agent':_0x431beb[_0xa919('0x11b')]?_0x431beb[_0xa919('0x11b')][_0xa919('0x35')]:'N.A.','createdAt':moment(_0x431beb[_0xa919('0x82')])['format'](_0xa919('0x10a'))[_0xa919('0xa5')](),'closedAt':_0x431beb['closed']?moment(_0x431beb[_0xa919('0x124')])[_0xa919('0xe3')](_0xa919('0x10a'))['toString']():'','disposition':_0x431beb['disposition'],'chatInfo':{'browser':_0x431beb[_0xa919('0x125')],'os':_0x431beb[_0xa919('0x126')],'referer':_0x431beb[_0xa919('0x127')],'customerIp':_0x431beb[_0xa919('0x128')],'customerPort':_0x431beb[_0xa919('0x129')]?_0x431beb[_0xa919('0x129')]:_0xa919('0x12a')},'messages':_(_0x431beb['Messages'])[_0xa919('0x12b')]()[_0xa919('0x109')]({'secret':![]})[_0xa919('0x34')](function(_0x528f2c){if(_0x528f2c[_0xa919('0xd9')]){var _0x442d93=path['join'](_0x42a8b6,_0x528f2c[_0xa919('0xd9')][_0xa919('0xdf')]);if(fs[_0xa919('0x12c')](_0x442d93)){fs[_0xa919('0x12d')](_0x442d93)['pipe'](fs[_0xa919('0x12e')](path[_0xa919('0x113')](_0x41ec56,_0x528f2c[_0xa919('0xd9')][_0xa919('0xdf')])));}}return{'date':moment(_0x528f2c[_0xa919('0x82')])[_0xa919('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x528f2c[_0xa919('0xf3')]===_0xa919('0x12f')?_0x528f2c[_0xa919('0x77')]?_0x528f2c[_0xa919('0x77')][_0xa919('0x35')]:'System':_0x528f2c[_0xa919('0x6c')]['firstName']+(_0x528f2c[_0xa919('0x6c')]['lastName']?'\x20'+_0x528f2c[_0xa919('0x6c')][_0xa919('0x11a')]:''),'body':_0x528f2c[_0xa919('0xd9')]?_0x528f2c[_0xa919('0xd9')][_0xa919('0xdf')]:_0x528f2c[_0xa919('0x7b')],'direction':_0x528f2c[_0xa919('0xf3')]===_0xa919('0x12f')?'A':'C','secret':_0x528f2c[_0xa919('0xf4')],'read':_0x528f2c[_0xa919('0x8a')],'attachment':_0x528f2c[_0xa919('0xd9')]};})[_0xa919('0x6e')]()};return ejs['renderFile'](path['join'](config[_0xa919('0xe2')],_0xa919('0x114'),_0xa919('0x130'),'downloadInteraction.html'),{'interaction':_0x59372b})[_0xa919('0x20')](function(_0x1ce9cf){return new BPromise(function(_0xf711d6,_0x270beb){pdf[_0xa919('0xc1')](_0x1ce9cf,_0x5f3fe4)[_0xa919('0x131')](path[_0xa919('0x113')](_0x41ec56,'transcript-'+_0x431beb['id']+'-'+_0x2989a2+_0xa919('0x132')),function(_0x1ab176,_0x2e9689){if(_0x1ab176)return _0x270beb(_0x1ab176);_0xf711d6(_0x2e9689);});});})[_0xa919('0x20')](function(){return new BPromise(function(_0x2d2d12,_0x4ebc0b){zipdir(_0x41ec56,{'saveTo':_0x2c8189},function(_0x57444d,_0x12b823){if(_0x57444d)return _0x4ebc0b(_0x57444d);return _0x2d2d12(_0x12b823);});})['then'](function(){return new BPromise(function(_0x1e4f4c,_0x35c34a){rimraf(_0x41ec56,function(_0x1bf86f){if(_0x1bf86f)_0x35c34a(_0x1bf86f);return _0x1e4f4c();});});})[_0xa919('0x20')](function(){return _0x23b569[_0xa919('0xdd')](_0x2c8189,_0x207dba,function(_0x2660b3){if(_0x2660b3){console['log'](_0xa919('0x133'),_0x2660b3);}else{fs[_0xa919('0x134')](_0x2c8189);}});});});}else{return _0x23b569[_0xa919('0x27')](0xc8);}})[_0xa919('0x3b')](handleError(_0x23b569,null));}; \ No newline at end of file +var _0x4520=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','unreadMessages','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','include','create','update','destroy','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','download','join','root','close','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','service','host','port','secure','authentication','auth','SendMail','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','$gte','findAll','getMyMessages','options','includeAgent','includeAll','setTags','spread','emit','removeTags','unix','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','stack','name','send','Users','map','fullname','TagIds','split','Tags','index','ChatInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4520,0xb3));var _0x0452=function(_0x16daee,_0xaf8850){_0x16daee=_0x16daee-0x0;var _0x436115=_0x4520[_0x16daee];return _0x436115;};'use strict';var pdf=require(_0x0452('0x0'));var emlformat=require(_0x0452('0x1'));var rimraf=require(_0x0452('0x2'));var zipdir=require(_0x0452('0x3'));var jsonpatch=require(_0x0452('0x4'));var rp=require(_0x0452('0x5'));var moment=require(_0x0452('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0452('0x7'));var path=require(_0x0452('0x8'));var sox=require('sox');var csv=require(_0x0452('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0452('0xa'));var squel=require(_0x0452('0xb'));var crypto=require('crypto');var jsforce=require(_0x0452('0xc'));var deskjs=require(_0x0452('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0452('0xe'));var Papa=require('papaparse');var Redis=require(_0x0452('0xf'));var authService=require(_0x0452('0x10'));var qs=require(_0x0452('0x11'));var as=require(_0x0452('0x12'));var hardwareService=require(_0x0452('0x13'));var logger=require(_0x0452('0x14'))(_0x0452('0x15'));var utils=require(_0x0452('0x16'));var config=require(_0x0452('0x17'));var licenseUtil=require(_0x0452('0x18'));var db=require(_0x0452('0x19'))['db'];config['redis']=_[_0x0452('0x1a')](config[_0x0452('0x1b')],{'host':_0x0452('0x1c'),'port':0x18eb});var socket=require(_0x0452('0x1d'))(new Redis(config[_0x0452('0x1b')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x0452('0x1e'));var client=jayson['client'][_0x0452('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0x0452('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xfbb64e,_0x3533e3,_0x15f5fa,_0x52f3c5){return new BPromise(function(_0x13b55c,_0x1b7cdd){var _0x1c7d3d=_0x52f3c5||client;return _0x1c7d3d['request'](_0xfbb64e,_0x15f5fa)[_0x0452('0x20')](function(_0x11fccc){logger[_0x0452('0x21')](_0x0452('0x22'),_0x3533e3,_0x0452('0x23'));logger[_0x0452('0x24')](_0x0452('0x25'),_0x3533e3,_0x0452('0x23'),JSON[_0x0452('0x26')](_0x11fccc));if(_0x11fccc['error']){if(_0x11fccc['error']['code']===0x1f4){logger[_0x0452('0x27')](_0x0452('0x22'),_0x3533e3,_0x11fccc[_0x0452('0x27')][_0x0452('0x28')]);return _0x1b7cdd(_0x11fccc[_0x0452('0x27')]['message']);}logger[_0x0452('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x3533e3,_0x11fccc['error'][_0x0452('0x28')]);return _0x13b55c(_0x11fccc[_0x0452('0x27')]['message']);}else{logger[_0x0452('0x21')](_0x0452('0x22'),_0x3533e3,_0x0452('0x23'));_0x13b55c(_0x11fccc['result'][_0x0452('0x28')]);}})[_0x0452('0x29')](function(_0x486b2e){logger[_0x0452('0x27')](_0x0452('0x22'),_0x3533e3,_0x486b2e);_0x1b7cdd(_0x486b2e);});});}function respondWithStatusCode(_0x10fbfa,_0x3d49dd){_0x3d49dd=_0x3d49dd||0xcc;return function(_0x44e6c0){if(_0x44e6c0){return _0x10fbfa[_0x0452('0x2a')](_0x3d49dd);}return _0x10fbfa[_0x0452('0x2b')](_0x3d49dd)[_0x0452('0x2c')]();};}function respondWithResult(_0x4c33b8,_0x3dd9d1){_0x3dd9d1=_0x3dd9d1||0xc8;return function(_0x5ad685){if(_0x5ad685){return _0x4c33b8[_0x0452('0x2b')](_0x3dd9d1)[_0x0452('0x2d')](_0x5ad685);}};}function respondWithFilteredResult(_0x4544fd,_0x26a623){return function(_0x572f84){if(_0x572f84){var _0x3e83a5=_0x572f84[_0x0452('0x2e')],_0xeec454=_0x26a623[_0x0452('0x2f')],_0xbf9c33=_0x26a623[_0x0452('0x2f')]+_0x26a623['limit'],_0x54bed7;if(_0xbf9c33>=_0x3e83a5){_0xbf9c33=_0x3e83a5;_0x54bed7=0xc8;}else{_0x54bed7=0xce;}_0x4544fd[_0x0452('0x2b')](_0x54bed7);return _0x4544fd[_0x0452('0x30')](_0x0452('0x31'),_0xeec454+'-'+_0xbf9c33+'/'+_0x3e83a5)[_0x0452('0x2d')](_0x572f84);}return null;};}function patchUpdates(_0x528913){return function(_0x2947f7){try{jsonpatch[_0x0452('0x32')](_0x2947f7,_0x528913,!![]);}catch(_0x497d59){return BPromise[_0x0452('0x33')](_0x497d59);}return _0x2947f7[_0x0452('0x34')]();};}function saveUpdates(_0x1894c7,_0x1cf0f){return function(_0x390bdd){if(_0x390bdd){return _0x390bdd['update'](_0x1894c7)['then'](function(_0x2b295f){return _0x2b295f;});}return null;};}function removeEntity(_0x422dd6,_0x115b85){return function(_0x2ff378){if(_0x2ff378){return _0x2ff378['destroy']()['then'](function(){_0x422dd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a6d0,_0x250759){return function(_0x1237b1){if(!_0x1237b1){_0x59a6d0[_0x0452('0x2a')](0x194);}return _0x1237b1;};}function handleError(_0x271d4d,_0x92b8b9){_0x92b8b9=_0x92b8b9||0x1f4;return function(_0x107758){logger[_0x0452('0x27')](_0x107758[_0x0452('0x35')]);if(_0x107758[_0x0452('0x36')]){delete _0x107758[_0x0452('0x36')];}_0x271d4d[_0x0452('0x2b')](_0x92b8b9)[_0x0452('0x37')](_0x107758);};}function getInteractionUsers(_0x211fd0,_0x4be21b){return new BPromise(function(_0x2dcc6d,_0x573d73){try{if(_0x4be21b[_0x211fd0['id']]){_0x211fd0[_0x0452('0x38')]=_[_0x0452('0x39')](_0x4be21b[_0x211fd0['id']],function(_0x3bf39b){return{'id':_0x3bf39b['id'],'fullname':_0x3bf39b[_0x0452('0x3a')]};});}}catch(_0x2f30d6){_0x573d73(_0x2f30d6);}_0x2dcc6d(_0x211fd0);});}function getInteractionTags(_0x298c16,_0x186cf2){return new BPromise(function(_0x31c141,_0x143148){try{if(_0x298c16[_0x0452('0x3b')]){_0x298c16['Tags']=[];_0x298c16[_0x0452('0x3b')][_0x0452('0x3c')](',')['forEach'](function(_0x323cfd){_0x298c16[_0x0452('0x3d')]['push'](_0x186cf2[_0x323cfd]);});}delete _0x298c16[_0x0452('0x3b')];}catch(_0x198e4d){_0x143148(_0x198e4d);}_0x31c141(_0x298c16);});}function updateChatInteraction(_0x100c01,_0x25c510,_0x3ce0e6){return new BPromise(function(_0x25b62d,_0x2309c0){return getInteractionUsers(_0x100c01,_0x3ce0e6)[_0x0452('0x20')](function(_0x4ad7d1){return getInteractionTags(_0x4ad7d1,_0x25c510);})[_0x0452('0x20')](function(_0x59b911){_0x25b62d(_0x59b911);})[_0x0452('0x29')](function(_0x185268){_0x2309c0(_0x185268);});});}exports[_0x0452('0x3e')]=function(_0x411cd0,_0x167652){var _0x4b84c1={},_0x4d6723={},_0x287e86={'count':0x0,'rows':[]};var _0x3c8e09=_[_0x0452('0x39')](db[_0x0452('0x3f')][_0x0452('0x40')],function(_0x415a4a){return{'name':_0x415a4a[_0x0452('0x41')],'type':_0x415a4a[_0x0452('0x42')]['key']};});_0x4d6723[_0x0452('0x43')]=_[_0x0452('0x39')](_0x3c8e09,_0x0452('0x36'));_0x4d6723[_0x0452('0x44')]=_[_0x0452('0x45')](_0x411cd0[_0x0452('0x44')]);_0x4d6723[_0x0452('0x46')]=_[_0x0452('0x47')](_0x4d6723[_0x0452('0x43')],_0x4d6723[_0x0452('0x44')]);_0x4b84c1['attributes']=_[_0x0452('0x47')](_0x4d6723[_0x0452('0x43')],qs['fields'](_0x411cd0[_0x0452('0x44')][_0x0452('0x48')]));_0x4b84c1[_0x0452('0x49')]=_0x4b84c1['attributes'][_0x0452('0x4a')]?_0x4b84c1['attributes']:_0x4d6723[_0x0452('0x43')];if(!_0x411cd0['query'][_0x0452('0x4b')](_0x0452('0x4c'))){_0x4b84c1['limit']=qs['limit'](_0x411cd0['query'][_0x0452('0x4d')]);_0x4b84c1[_0x0452('0x2f')]=qs['offset'](_0x411cd0['query'][_0x0452('0x2f')]);}_0x4b84c1[_0x0452('0x4e')]=qs[_0x0452('0x4f')](_0x411cd0[_0x0452('0x44')][_0x0452('0x4f')]);_0x4b84c1[_0x0452('0x50')]=qs[_0x0452('0x46')](_[_0x0452('0x51')](_0x411cd0[_0x0452('0x44')],_0x4d6723[_0x0452('0x46')]),_0x3c8e09);var _0x5af180=[];var _0x21ed89=squel[_0x0452('0x52')]()[_0x0452('0x53')]('id')[_0x0452('0x53')](_0x0452('0x36'))[_0x0452('0x53')](_0x0452('0x54'))['from'](_0x0452('0x55'));var _0x20d271=squel[_0x0452('0x52')]()[_0x0452('0x53')]('u.id')[_0x0452('0x53')](_0x0452('0x56'))[_0x0452('0x53')](_0x0452('0x57'))['from']('user_has_chat_interactions','ui')['left_join']('users','u',_0x0452('0x58'));var _0x319a4e=squel[_0x0452('0x52')]()['from'](_0x0452('0x59'),'i')[_0x0452('0x5a')](_0x0452('0x5b'),'c',_0x0452('0x5c'))[_0x0452('0x5a')](_0x0452('0x5d'),'o',_0x0452('0x5e'))['left_join'](_0x0452('0x5f'),'a',_0x0452('0x60'))[_0x0452('0x5a')](_0x0452('0x61'),'me',_0x0452('0x62'))[_0x0452('0x5a')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x0452('0x5a')](_0x0452('0x55'),'t','t.id\x20=\x20it.TagId');var _0x3ab51e=squel[_0x0452('0x63')]();var _0x4a4571=[];var _0x56e488=squel['expr']();var _0x2cec16;if(_0x411cd0['query'][_0x0452('0x64')]){_0x2cec16=as[_0x0452('0x65')](_0x411cd0[_0x0452('0x44')]['search']);var _0x1fd151=_0x2cec16[_0x0452('0x66')];for(var _0x44e1b1=0x0;_0x44e1b1<_0x2cec16[_0x0452('0x67')][_0x0452('0x4a')];_0x44e1b1++){var _0x5e2f74=_0x2cec16['conditions'][_0x44e1b1];var _0x3d3b67='i';var _0x27fcbd=_[_0x0452('0x68')](_0x3c8e09,[_0x0452('0x36'),_0x5e2f74[_0x0452('0x53')]]);if(!_0x27fcbd){switch(_0x5e2f74[_0x0452('0x53')]){case'unreadMessages':if(_0x5e2f74[_0x0452('0x69')]==0x1){_0x319a4e['having']('`'+_0x5e2f74[_0x0452('0x53')]+_0x0452('0x6a'));}else{_0x319a4e[_0x0452('0x6b')]('`'+_0x5e2f74[_0x0452('0x53')]+'`\x20>\x200');}break;case _0x0452('0x6c'):if(_0x5e2f74['operator']===_0x0452('0x6d')){if(_0x5e2f74[_0x0452('0x69')][_0x0452('0x3c')]('\x20')['length']>0x1){_0x3ab51e[_0x1fd151](_0x0452('0x6e'),qs[_0x0452('0x6f')](_0x5e2f74[_0x0452('0x69')]),null);}else{var _0x434b84='%'+_0x5e2f74['value']+'%';_0x3ab51e[_0x1fd151](_0x0452('0x70'),_0x434b84,_0x434b84,_0x434b84);}}else{_0x27fcbd=_[_0x0452('0x68')](_0x3c8e09,['name',_0x0452('0x71')]);_0x5e2f74['field']=_0x0452('0x71');_0x150ca6=as[_0x0452('0x72')](_0x3d3b67,_0x27fcbd[_0x0452('0x42')],_0x5e2f74);_0x3ab51e[_0x1fd151](_0x150ca6['text'],_0x150ca6['value']['start'],_0x150ca6[_0x0452('0x69')]['end']);}break;case'Tag':var _0x703219=_0x5e2f74['value'][_0x0452('0x3c')](',')['map'](function(_0x4eac3f){return Number(_0x4eac3f);});_0x703219[_0x0452('0x73')](function(_0x533a5c){_0x56e488['or'](_0x0452('0x74'),'%,'+_0x533a5c+',%');});_0x4a4571=_[_0x0452('0x75')](_0x4a4571,_0x703219);break;case _0x0452('0x76'):if(_0x5e2f74['operator']==='$substring'){_0x3ab51e[_0x1fd151](_0x0452('0x77'),'%'+_0x5e2f74[_0x0452('0x69')]+'%',null);}else{_0x27fcbd=_[_0x0452('0x68')](_0x3c8e09,[_0x0452('0x36'),_0x0452('0x78')]);_0x5e2f74['field']=_0x0452('0x78');_0x150ca6=as[_0x0452('0x72')](_0x3d3b67,_0x27fcbd[_0x0452('0x42')],_0x5e2f74);_0x3ab51e[_0x1fd151](_0x150ca6[_0x0452('0x79')],_0x150ca6['value'][_0x0452('0x7a')],_0x150ca6[_0x0452('0x69')][_0x0452('0x2c')]);}break;case _0x0452('0x7b'):_0x150ca6=as[_0x0452('0x72')]('me',null,_0x5e2f74);_0x3ab51e[_0x1fd151](_0x150ca6[_0x0452('0x79')],_0x150ca6[_0x0452('0x69')][_0x0452('0x7a')],_0x150ca6['value'][_0x0452('0x2c')]);break;}}else{var _0x150ca6=as[_0x0452('0x72')](_0x3d3b67,_0x27fcbd[_0x0452('0x42')],_0x5e2f74);_0x3ab51e[_0x1fd151](_0x150ca6['text'],_0x150ca6['value']['start'],_0x150ca6[_0x0452('0x69')]['end']);}}}else{var _0x434ee1=_(_0x411cd0[_0x0452('0x44')])[_0x0452('0x45')]()[_0x0452('0x39')](function(_0x23f46d){return _[_0x0452('0x7c')](_0x3c8e09,[_0x0452('0x36'),_0x23f46d])?_0x23f46d:undefined;})['compact']()[_0x0452('0x69')]();if(!_[_0x0452('0x7d')](_0x434ee1)){_0x434ee1[_0x0452('0x73')](function(_0x4bf68f){if(_0x4bf68f===_0x0452('0x7e')){_0x319a4e[_0x0452('0x50')](_0x0452('0x7f'),[][_0x0452('0x80')](_0x411cd0[_0x0452('0x44')][_0x4bf68f]));}else if(_0x4bf68f===_0x0452('0x81')){var _0x1b290c=JSON[_0x0452('0x82')](_0x411cd0['query'][_0x4bf68f])['$gte'];var _0x4e9534=JSON[_0x0452('0x82')](_0x411cd0[_0x0452('0x44')][_0x4bf68f])[_0x0452('0x83')];_0x319a4e['where'](_0x0452('0x84'),_0x1b290c,_0x4e9534);}else{if(_0x411cd0['query'][_0x4bf68f]===_0x0452('0x85')){_0x319a4e[_0x0452('0x50')]('i.'+_0x4bf68f+'\x20IS\x20NULL');}else{_0x319a4e[_0x0452('0x50')]('i.'+_0x4bf68f+_0x0452('0x86'),_0x411cd0[_0x0452('0x44')][_0x4bf68f]);}}});}if(_0x411cd0[_0x0452('0x44')][_0x0452('0x87')]){if(_0x411cd0[_0x0452('0x44')][_0x0452('0x87')]==0x1){_0x319a4e[_0x0452('0x6b')](_0x0452('0x88'));}else{_0x319a4e[_0x0452('0x6b')](_0x0452('0x89'));}}if(_0x411cd0[_0x0452('0x44')][_0x0452('0x8a')]){_0x4a4571=_[_0x0452('0x8b')](_0x411cd0[_0x0452('0x44')][_0x0452('0x8a')])?_0x411cd0['query'][_0x0452('0x8a')]:new Array(_0x411cd0['query'][_0x0452('0x8a')]);_0x4a4571[_0x0452('0x73')](function(_0x4f496f){_0x56e488['or'](_0x0452('0x74'),'%,'+_0x4f496f+',%');});}if(_0x411cd0[_0x0452('0x44')]['filter']){var _0x156b03=_0x411cd0[_0x0452('0x44')][_0x0452('0x8c')][_0x0452('0x8d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x156b03)){_0x3ab51e['or']('i.id\x20LIKE\x20?',_0x156b03+'%');}else{_0x3ab51e['or'](_0x0452('0x8e'),qs[_0x0452('0x6f')](_0x156b03))['or'](_0x0452('0x8f'),_0x156b03+'%');}}}_0x319a4e['where'](_0x3ab51e);_0x319a4e['group'](_0x0452('0x90'));var _0x383c01={'type':db[_0x0452('0x91')][_0x0452('0x92')][_0x0452('0x93')],'raw':!![]};var _0xeac11a=_0x319a4e['clone']();_0xeac11a[_0x0452('0x53')](_0x0452('0x90'));_0xeac11a[_0x0452('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0452('0x94'));if(_0x4b84c1[_0x0452('0x4e')]){_0x4b84c1[_0x0452('0x4e')]['forEach'](function(_0x5ace09){var _0x4f4284=_0x5ace09[0x0]===_0x0452('0x95')?_0x5ace09[0x0]:'i.'+_0x5ace09[0x0];_0x319a4e[_0x0452('0x4e')](_0x4f4284,_0x5ace09[0x1]===_0x0452('0x96')?![]:!![]);});}if(!_[_0x0452('0x7d')](_0x4a4571)){_0x319a4e['having'](_0x56e488);_0xeac11a['where']('t.id\x20IN\x20?',_0x4a4571);}BPromise[_0x0452('0x97')]()['then'](function(){if(!_0x2cec16){if(_0x411cd0[_0x0452('0x44')][_0x0452('0x7e')])return;_0xeac11a[_0x0452('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x319a4e[_0x0452('0x50')](_0x0452('0x98'));return;}if(_0x411cd0[_0x0452('0x99')][_0x0452('0x9a')]!==_0x0452('0x9b'))return;return _0x411cd0['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x0452('0x20')](function(_0x59875e){if(_[_0x0452('0x7d')](_0x59875e)){_0xeac11a[_0x0452('0x50')](_0x0452('0x9c'));_0x319a4e[_0x0452('0x50')](_0x0452('0x9c'));}else{_0xeac11a['where'](_0x0452('0x7f'),_['map'](_0x59875e,'id'));_0x319a4e[_0x0452('0x50')](_0x0452('0x7f'),_[_0x0452('0x39')](_0x59875e,'id'));}});})[_0x0452('0x20')](function(){if(_0x411cd0[_0x0452('0x99')][_0x0452('0x9a')]===_0x0452('0x9b')&&!_0x2cec16&&!_0x411cd0[_0x0452('0x44')]['ChatWebsiteId'])return[];return db[_0x0452('0x9d')][_0x0452('0x44')](_0xeac11a[_0x0452('0x9e')](),_0x383c01);})[_0x0452('0x20')](function(_0xa8a675){_0x287e86[_0x0452('0x2e')]=_0xa8a675[_0x0452('0x4a')];if(_0x287e86[_0x0452('0x2e')]===0x0)return[];return db['sequelize'][_0x0452('0x44')](_0x21ed89[_0x0452('0x9e')](),_0x383c01)[_0x0452('0x20')](function(_0x1a99bf){_0x5af180=_['keyBy'](_0x1a99bf,'id');_0x383c01=_[_0x0452('0x9f')](_0x383c01,{'model':db[_0x0452('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x411cd0[_0x0452('0x44')]['fields']){_0x4b84c1[_0x0452('0x49')]['forEach'](function(_0x20a498){_0x319a4e[_0x0452('0x53')]('i.'+_0x20a498);});}else{_0x319a4e[_0x0452('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x319a4e['field'](_0x0452('0xa0'),_0x0452('0xa1'));_0x319a4e[_0x0452('0x53')](_0x0452('0xa2'),_0x0452('0xa3'));_0x319a4e['field'](_0x0452('0xa4'),'contactName');_0x319a4e[_0x0452('0x53')](_0x0452('0xa5'));_0x319a4e[_0x0452('0x53')](_0x0452('0xa6'),_0x0452('0xa7'));_0x319a4e[_0x0452('0x53')]('c.lastName',_0x0452('0xa8'));_0x319a4e['field'](_0x0452('0xa9'),_0x0452('0xaa'));_0x319a4e[_0x0452('0x53')](_0x0452('0xab'),_0x0452('0xac'));_0x319a4e[_0x0452('0x53')](_0x0452('0xad'),_0x0452('0xae'));_0x319a4e[_0x0452('0x53')]('c.fax','Contact.fax');_0x319a4e[_0x0452('0x53')](_0x0452('0xaf'),'Owner.fullname');_0x319a4e[_0x0452('0x53')](_0x0452('0xb0'),'Owner.internal');_0x319a4e['field'](_0x0452('0xb1'),_0x0452('0x3b'));}if(_0x4b84c1[_0x0452('0x4d')])_0x319a4e[_0x0452('0x4d')](_0x4b84c1[_0x0452('0x4d')]);if(_0x4b84c1[_0x0452('0x2f')])_0x319a4e[_0x0452('0x2f')](_0x4b84c1[_0x0452('0x2f')]);return db[_0x0452('0x9d')][_0x0452('0x44')](_0x319a4e['toString'](),_0x383c01);})[_0x0452('0x20')](function(_0x214647){_0x20d271[_0x0452('0x50')](_0x0452('0xb2'),_[_0x0452('0x39')](_0x214647,'id'));return db['sequelize'][_0x0452('0x44')](_0x20d271['toString'](),_0x383c01)[_0x0452('0x20')](function(_0x293221){var _0x441bec=_[_0x0452('0xb3')](_0x293221,_0x0452('0xb4'));var _0x4dfe21=[];_0x214647[_0x0452('0x73')](function(_0x115e9d){_0x4dfe21[_0x0452('0xb5')](updateChatInteraction(_0x115e9d,_0x5af180,_0x441bec));});return BPromise[_0x0452('0xb6')](_0x4dfe21);});});})[_0x0452('0x20')](function(_0xd3f56a){_0x287e86[_0x0452('0xb7')]=_0xd3f56a;return _0x287e86;})['then'](respondWithFilteredResult(_0x167652,_0x4b84c1))['catch'](handleError(_0x167652,null));};exports[_0x0452('0xb8')]=function(_0x56b637,_0x53bce7){var _0x48cf9c={'raw':![],'where':{'id':_0x56b637[_0x0452('0xb9')]['id']}},_0x49c604={};_0x49c604['model']=_[_0x0452('0x45')](db[_0x0452('0x3f')][_0x0452('0x40')]);_0x49c604[_0x0452('0x44')]=_[_0x0452('0x45')](_0x56b637['query']);_0x49c604[_0x0452('0x46')]=_[_0x0452('0x47')](_0x49c604[_0x0452('0x43')],_0x49c604[_0x0452('0x44')]);_0x48cf9c[_0x0452('0x49')]=_[_0x0452('0x47')](_0x49c604[_0x0452('0x43')],qs['fields'](_0x56b637[_0x0452('0x44')]['fields']));_0x48cf9c['attributes']=_0x48cf9c['attributes'][_0x0452('0x4a')]?_0x48cf9c[_0x0452('0x49')]:_0x49c604['model'];if(_0x56b637['query']['includeAll']){_0x48cf9c[_0x0452('0xba')]=[{'all':!![]}];}_0x48cf9c=_[_0x0452('0x9f')]({},_0x48cf9c,_0x56b637['options']);return db['ChatInteraction'][_0x0452('0x68')](_0x48cf9c)[_0x0452('0x20')](handleEntityNotFound(_0x53bce7,null))['then'](respondWithResult(_0x53bce7,null))['catch'](handleError(_0x53bce7,null));};exports[_0x0452('0xbb')]=function(_0xa562b0,_0x208ce6){return db[_0x0452('0x3f')][_0x0452('0xbb')](_0xa562b0[_0x0452('0x7b')],{})[_0x0452('0x20')](respondWithResult(_0x208ce6,0xc9))[_0x0452('0x29')](handleError(_0x208ce6,null));};exports[_0x0452('0xbc')]=function(_0x4f11c1,_0x1a17cb){if(_0x4f11c1[_0x0452('0x7b')]['id']){delete _0x4f11c1[_0x0452('0x7b')]['id'];}return db[_0x0452('0x3f')][_0x0452('0x68')]({'where':{'id':_0x4f11c1[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x1a17cb,null))['then'](saveUpdates(_0x4f11c1[_0x0452('0x7b')],null))['then'](respondWithResult(_0x1a17cb,null))['catch'](handleError(_0x1a17cb,null));};exports[_0x0452('0xbd')]=function(_0x963b85,_0x4efb02){return db[_0x0452('0x3f')][_0x0452('0x68')]({'where':{'id':_0x963b85[_0x0452('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4efb02,null))['then'](removeEntity(_0x4efb02,null))[_0x0452('0x29')](handleError(_0x4efb02,null));};exports[_0x0452('0xbe')]=function(_0x40fe2a,_0x12fc31){return db['ChatInteraction'][_0x0452('0xbe')]()[_0x0452('0x20')](respondWithResult(_0x12fc31,null))[_0x0452('0x29')](handleError(_0x12fc31,null));};exports[_0x0452('0xbf')]=function(_0x28197a,_0x3f37c0){var _0x24e6b1=_0x28197a[_0x0452('0xb9')]['id'];var _0x52ebd1;var _0x16f4d1;var _0x22d9f7;return db[_0x0452('0x3f')]['findOne']({'where':{'id':_0x24e6b1}})['then'](function(_0x1c2416){_0x52ebd1=_0x1c2416;return db[_0x0452('0xc0')][_0x0452('0xc1')]({'where':{'id':_0x1c2416['ChatWebsiteId']},'attributes':['id',_0x0452('0xc2'),_0x0452('0xc3')],'raw':!![]});})[_0x0452('0x20')](function(_0x32a782){if(_0x32a782&&_0x32a782['vidaooApiKey']&&_0x32a782[_0x0452('0xc3')]){_0x16f4d1=_0x32a782;var _0x19f806={'rejectUnauthorized':![],'method':_0x0452('0xc4'),'uri':_0x0452('0xc5'),'headers':{'X-APIKEY':_0x32a782['vidaooApiKey']},'body':{'name':_0x0452('0xc6')+_0x24e6b1},'redirect':_0x0452('0xc7'),'json':!![]};return rp(_0x19f806);}else{throw new db[(_0x0452('0x91'))][(_0x0452('0xc8'))](_0x0452('0xc9'));}})[_0x0452('0x20')](function(_0x5a49d7){_0x22d9f7=_0x5a49d7;if(_0x22d9f7['id']){var _0x299758={'body':_0x22d9f7[_0x0452('0xca')],'ChatWebsiteId':_0x16f4d1['id'],'ChatInteractionId':_0x52ebd1['id'],'direction':_0x0452('0xcb'),'UserId':_0x28197a[_0x0452('0x99')]['id']};return db['ChatMessage'][_0x0452('0xbb')](_0x299758,{});}else{throw new db['Sequelize'][(_0x0452('0xc8'))](_0x0452('0xcc'));}})[_0x0452('0x20')](function(){return _0x52ebd1[_0x0452('0xcd')]({'vidaooSessionId':_0x22d9f7['id']});})[_0x0452('0x20')](respondWithResult(_0x3f37c0,null))['catch'](handleError(_0x3f37c0,null));};exports[_0x0452('0xce')]=function(_0x54a7b5,_0x5a383a){if(_0x54a7b5[_0x0452('0x7b')]['id']){delete _0x54a7b5[_0x0452('0x7b')]['id'];}return db[_0x0452('0x3f')]['find']({'where':{'id':_0x54a7b5[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x5a383a,null))[_0x0452('0x20')](saveUpdates(_0x54a7b5[_0x0452('0x7b')],null))[_0x0452('0x20')](respondWithResult(_0x5a383a,null))['catch'](handleError(_0x5a383a,null));};exports['abandon']=function(_0xe6c058,_0x39bbe6,_0x279aec){if(_0xe6c058['body']['id']){delete _0xe6c058[_0x0452('0x7b')]['id'];}return db[_0x0452('0x3f')][_0x0452('0x68')]({'where':{'id':_0xe6c058[_0x0452('0xb9')]['id']}})['then'](function(_0x1d1141){if(!_0x1d1141){logger[_0x0452('0x27')](_0x0452('0xcf'),'abandon',0x194,_0x0452('0xd0'));_0x39bbe6[_0x0452('0x2a')](0x194);}else{if(_0x1d1141[_0x0452('0x78')]){throw new db[(_0x0452('0x91'))][(_0x0452('0xc8'))](_0x0452('0xd1'));}}return _0x1d1141;})['then'](function(_0x878c15){if(_0x878c15){return _0x878c15[_0x0452('0xbc')]({'closed':_0xe6c058[_0x0452('0x7b')][_0x0452('0xd2')],'disposition':_0xe6c058['body']['disposition']})[_0x0452('0x20')](function(_0x2c8178){return _0x2c8178;});}})[_0x0452('0x20')](function(_0x257bc9){return respondWithRpcPromise(_0x0452('0xd3'),_0x0452('0xd4'),_0xe6c058['body'],client9004);})[_0x0452('0x20')](respondWithResult(_0x39bbe6,null))['catch'](handleError(_0x39bbe6,null));};exports[_0x0452('0xd5')]=function(_0x4b5a5f,_0x43aef6,_0x199d7e){_0x4b5a5f['body'][_0x0452('0x36')]=_0x4b5a5f[_0x0452('0xd6')][_0x0452('0xd7')];_0x4b5a5f[_0x0452('0x7b')][_0x0452('0xd8')]=_0x4b5a5f[_0x0452('0xd6')][_0x0452('0xd9')];_0x4b5a5f[_0x0452('0x7b')][_0x0452('0x42')]=_0x4b5a5f[_0x0452('0xd6')][_0x0452('0xda')];return db[_0x0452('0xdb')][_0x0452('0xbb')](_0x4b5a5f[_0x0452('0x7b')])[_0x0452('0x20')](respondWithResult(_0x43aef6,0xc9))[_0x0452('0x29')](handleError(_0x43aef6,null));};exports[_0x0452('0xdc')]=function(_0x4bfd11,_0x357331,_0x3b1158){return db[_0x0452('0x3f')]['findOne']({'where':{'id':_0x4bfd11[_0x0452('0xb9')]['id']},'raw':!![]})[_0x0452('0x20')](handleEntityNotFound(_0x357331,null))['then'](function(_0x3256f3){if(_0x3256f3){if(_0x3256f3[_0x0452('0xd2')]){return _0x357331['status'](0x193)[_0x0452('0x2d')]({'status':0x193,'message':_0x0452('0xdd')});}return db[_0x0452('0xdb')][_0x0452('0xc1')]({'where':{'id':_0x4bfd11[_0x0452('0x44')]['attachId']},'raw':!![]})[_0x0452('0x20')](handleEntityNotFound(_0x357331,null));}})[_0x0452('0x20')](function(_0x5b302f){if(_0x5b302f){return _0x357331[_0x0452('0xde')](path[_0x0452('0xdf')](config[_0x0452('0xe0')],'server/files/attachments/',_0x5b302f[_0x0452('0xd8')]));}})['catch'](handleError(_0x357331,null));};exports[_0x0452('0xe1')]=function(_0x17998a,_0x3f364b){var _0x219e9d=null;var _0x50c567=null;var _0x2dcf6c=null;var _0x181d18=null;if(_0x17998a[_0x0452('0x7b')]['id']){delete _0x17998a[_0x0452('0x7b')]['id'];}if(_0x17998a['body']['mailTranscript']){_0x181d18=path[_0x0452('0xdf')](config[_0x0452('0xe0')],'server/files/chat/upload/',util['format'](_0x0452('0xe2'),Date[_0x0452('0xe3')]()));_0x17998a[_0x0452('0x7b')][_0x0452('0xe4')]=_0x181d18;}return db[_0x0452('0x3f')][_0x0452('0x68')]({'where':{'id':_0x17998a['params']['id']},'include':[{'model':db[_0x0452('0xe5')],'as':_0x0452('0xe6'),'include':[{'model':db[_0x0452('0x76')],'as':_0x0452('0x76')}]}]})[_0x0452('0x20')](handleEntityNotFound(_0x3f364b,null))[_0x0452('0x20')](saveUpdates(_0x17998a[_0x0452('0x7b')],null))[_0x0452('0x20')](function(_0x28fb38){if(_0x28fb38){_0x219e9d=_0x28fb38;return db['ChatWebsite'][_0x0452('0x68')]({'where':{'id':_0x219e9d['ChatWebsiteId']}});}})['then'](function(_0x303e21){if(_0x303e21){_0x2dcf6c=_0x303e21;return db[_0x0452('0xe7')]['find']({'where':{'id':_0x219e9d[_0x0452('0x71')]}});}})[_0x0452('0x20')](function(_0x4613b0){if(_0x4613b0){_0x50c567=_0x4613b0;if(_0x181d18){var _0x307c22=null;for(var _0x1d447a=0x1;_0x1d447a<_0x219e9d[_0x0452('0xe6')]['length'];++_0x1d447a){_0x307c22=_0x219e9d[_0x0452('0xe6')][_0x1d447a];var _0xa31f80=_0x307c22['UserId']?util[_0x0452('0xe8')](_0x0452('0xe9'),_0x2dcf6c[_0x0452('0xea')],_0x307c22[_0x0452('0x78')]):_0x0452('0xeb');var _0xded7e2=_0x17998a[_0x0452('0x7b')][_0x0452('0xec')]||util['format'](_0x0452('0xe9'),_0x0452('0xed'),_0x307c22[_0x0452('0x71')]);switch(_0x2dcf6c[_0x0452('0xee')]){case _0x0452('0xef'):_0xa31f80=_0x307c22[_0x0452('0x78')]?util[_0x0452('0xe8')](_0x0452('0xe9'),_0x2dcf6c[_0x0452('0xea')],_0x307c22[_0x0452('0x78')]):_0x0452('0xeb');break;case _0x0452('0xf0'):_0xa31f80=_0x307c22[_0x0452('0x78')]?_0x307c22[_0x0452('0x76')][_0x0452('0xf1')]||_0x307c22['User'][_0x0452('0x3a')]:_0x0452('0xeb');break;case _0x0452('0xf2'):_0xa31f80=_0x307c22[_0x0452('0x78')]?_0x307c22['User'][_0x0452('0x3a')]:'System';break;default:_0xa31f80=_0x307c22[_0x0452('0x78')]?util[_0x0452('0xe8')](_0x0452('0xe9'),_0x2dcf6c['agentAlias'],_0x307c22['UserId']):_0x0452('0xeb');}var _0x20964b=util[_0x0452('0xe8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x307c22['createdAt'])['format'](_0x0452('0xf3')),_0x307c22[_0x0452('0xf4')]==='in'?_0xded7e2:_0xa31f80,_0x307c22[_0x0452('0x7b')]);if(!_0x307c22[_0x0452('0xf5')]){fs[_0x0452('0xf6')](_0x181d18,_0x20964b);}}return db['MailAccount'][_0x0452('0xc1')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x0452('0xf7'),'raw':!![]}]});}}})[_0x0452('0x20')](function(_0x15a3ab){if(_0x15a3ab&&_0x15a3ab[_0x0452('0xf7')]&&_0x17998a[_0x0452('0x7b')]){var _0x1ba3d3={'tls':{'rejectUnauthorized':![]}};if(_0x15a3ab[_0x0452('0xf7')][_0x0452('0xf8')]){_0x1ba3d3[_0x0452('0xf8')]=_0x15a3ab[_0x0452('0xf7')][_0x0452('0xf8')];}else{_0x1ba3d3[_0x0452('0xf9')]=_0x15a3ab['Smtp']['host'];_0x1ba3d3[_0x0452('0xfa')]=_0x15a3ab[_0x0452('0xf7')]['port'];_0x1ba3d3['secure']=_0x15a3ab['Smtp'][_0x0452('0xfb')];}if(_0x15a3ab[_0x0452('0xf7')][_0x0452('0xfc')]){_0x1ba3d3[_0x0452('0xfd')]={'user':_0x15a3ab['Smtp'][_0x0452('0x99')],'pass':_0x15a3ab[_0x0452('0xf7')]['pass']};}return respondWithRpcPromise(_0x0452('0xfe'),'sendMail',{'account':_0x1ba3d3,'message':{'from':util[_0x0452('0xe8')]('\x22%s\x22\x20<%s>',_0x15a3ab['name'],_0x15a3ab[_0x0452('0xff')]||_0x15a3ab[_0x0452('0xf7')]['user']),'to':_0x17998a[_0x0452('0x7b')][_0x0452('0x100')],'subject':_0x0452('0x101'),'text':util[_0x0452('0xe8')](_0x0452('0x102'),_0x17998a[_0x0452('0x7b')]['mailTranscript']),'attachments':[{'path':_0x181d18}]}})['then'](function(){return _0x219e9d;})[_0x0452('0x29')](function(_0x40d24b){console['error'](_0x40d24b);});}else{return _0x219e9d;}})[_0x0452('0x20')](respondWithStatusCode(_0x3f364b,0xc8))[_0x0452('0x29')](handleError(_0x3f364b,null));};exports[_0x0452('0x103')]=function(_0x4e9158,_0x24243e,_0x68d29d){return db[_0x0452('0xe5')][_0x0452('0x68')]({'where':{'id':_0x4e9158[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x24243e,null))[_0x0452('0x20')](function(_0x3488c0){if(_0x3488c0){return _0x3488c0[_0x0452('0x103')](_0x4e9158[_0x0452('0x7b')][_0x0452('0x104')],_[_0x0452('0x105')](_0x4e9158[_0x0452('0x7b')],[_0x0452('0x104'),'id'])||{});}})[_0x0452('0x20')](respondWithResult(_0x24243e,null))[_0x0452('0x29')](handleError(_0x24243e,null));};exports[_0x0452('0x106')]=function(_0x133fb1,_0x1c0bee,_0x59ffa4){var _0x525657={'raw':![],'where':{}};var _0x50d898={};var _0x12fd40={'count':0x0,'rows':[]};return db[_0x0452('0x3f')]['findOne']({'where':{'id':_0x133fb1[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x1c0bee,null))[_0x0452('0x20')](function(_0xe80de5){if(_0xe80de5){_0x50d898[_0x0452('0x43')]=_['keys'](db[_0x0452('0xe5')]['rawAttributes']);_0x50d898['query']=_[_0x0452('0x45')](_0x133fb1[_0x0452('0x44')]);_0x50d898['filters']=_[_0x0452('0x47')](_0x50d898[_0x0452('0x43')],_0x50d898[_0x0452('0x44')]);_0x525657[_0x0452('0x49')]=_[_0x0452('0x47')](_0x50d898[_0x0452('0x43')],qs['fields'](_0x133fb1[_0x0452('0x44')][_0x0452('0x48')]));_0x525657[_0x0452('0x49')]=_0x525657[_0x0452('0x49')][_0x0452('0x4a')]?_0x525657[_0x0452('0x49')]:_0x50d898[_0x0452('0x43')];if(!_0x133fb1['query'][_0x0452('0x4b')](_0x0452('0x4c'))){_0x525657['limit']=qs[_0x0452('0x4d')](_0x133fb1[_0x0452('0x44')][_0x0452('0x4d')]);_0x525657['offset']=qs[_0x0452('0x2f')](_0x133fb1[_0x0452('0x44')][_0x0452('0x2f')]);}_0x525657[_0x0452('0x4e')]=qs[_0x0452('0x4f')](_0x133fb1[_0x0452('0x44')][_0x0452('0x4f')]);_0x525657[_0x0452('0x50')]=qs['filters'](_[_0x0452('0x51')](_0x133fb1[_0x0452('0x44')],_0x50d898[_0x0452('0x46')]));_0x525657[_0x0452('0x50')]['ChatInteractionId']=_0xe80de5['id'];if(_0x133fb1[_0x0452('0x44')]['filter']){_0x525657[_0x0452('0x50')]=_[_0x0452('0x9f')](_0x525657[_0x0452('0x50')],{'$or':_[_0x0452('0x39')](_0x525657['attributes'],function(_0x2fd475){var _0x31820f={};_0x31820f[_0x2fd475]={'$like':'%'+_0x133fb1[_0x0452('0x44')][_0x0452('0x8c')]+'%'};return _0x31820f;})});}if(_0x133fb1['query'][_0x0452('0x107')]){var _0x2c9ee2=_0x133fb1[_0x0452('0x44')][_0x0452('0x107')][_0x0452('0x3c')](',');var _0x830464={};_0x830464[_0x2c9ee2[0x0]]={'$gte':moment(_0x2c9ee2[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x525657[_0x0452('0x50')]=_[_0x0452('0x9f')](_0x525657['where'],_0x830464);}_0x525657=_['merge']({},_0x525657,_0x133fb1['options']);return db[_0x0452('0xe5')][_0x0452('0x2e')]({'where':_0x525657[_0x0452('0x50')]})['then'](function(_0x232145){_0x12fd40[_0x0452('0x2e')]=_0x232145;if(_0x133fb1[_0x0452('0x44')]['includeAll']){_0x525657[_0x0452('0xba')]=[{'all':!![]}];}return db[_0x0452('0xe5')][_0x0452('0x108')](_0x525657);})[_0x0452('0x20')](function(_0x27dafd){_0x12fd40[_0x0452('0xb7')]=_0x27dafd;return _0x12fd40;});}})[_0x0452('0x20')](respondWithFilteredResult(_0x1c0bee,_0x525657))['catch'](handleError(_0x1c0bee,null));};exports[_0x0452('0x109')]=function(_0x14834a,_0x3c5229,_0x148ef2){var _0x25322a={'where':{}},_0x102019={},_0x4e4ca5={'count':0x0,'rows':[]};return db[_0x0452('0x3f')][_0x0452('0xc1')]({'where':{'id':_0x14834a[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x3c5229,null))[_0x0452('0x20')](function(_0x30b075){if(_0x30b075){_0x102019[_0x0452('0x43')]=_[_0x0452('0x45')](db[_0x0452('0xe5')][_0x0452('0x40')]);_0x102019[_0x0452('0x44')]=_[_0x0452('0x45')](_0x14834a[_0x0452('0x44')]);_0x102019[_0x0452('0x46')]=_['intersection'](_0x102019[_0x0452('0x43')],_0x102019[_0x0452('0x44')]);_0x25322a['attributes']=_[_0x0452('0x47')](_0x102019[_0x0452('0x43')],qs[_0x0452('0x48')](_0x14834a['query'][_0x0452('0x48')]));_0x25322a[_0x0452('0x49')]=_0x25322a[_0x0452('0x49')]['length']?_0x25322a[_0x0452('0x49')]:_0x102019[_0x0452('0x43')];if(!_0x14834a['query']['hasOwnProperty'](_0x0452('0x4c'))){_0x25322a['limit']=qs['limit'](_0x14834a[_0x0452('0x44')][_0x0452('0x4d')]);_0x25322a[_0x0452('0x2f')]=qs['offset'](_0x14834a[_0x0452('0x44')][_0x0452('0x2f')]);}_0x25322a[_0x0452('0x4e')]=qs[_0x0452('0x4f')](_0x14834a['query'][_0x0452('0x4f')]);_0x25322a['where']=qs['filters'](_[_0x0452('0x51')](_0x14834a[_0x0452('0x44')],_0x102019[_0x0452('0x46')]));_0x25322a['where'][_0x0452('0xb4')]=_0x30b075['id'];if(_0x14834a[_0x0452('0x44')][_0x0452('0x8c')]){_0x25322a['where']=_[_0x0452('0x9f')](_0x25322a[_0x0452('0x50')],{'$or':_['map'](_0x25322a[_0x0452('0x49')],function(_0x136220){var _0x2db796={};_0x2db796[_0x136220]={'$like':'%'+_0x14834a[_0x0452('0x44')]['filter']+'%'};return _0x2db796;})});}_0x25322a['where'][_0x0452('0xf5')]=![];if(_0x14834a[_0x0452('0x44')]['id']){_0x25322a[_0x0452('0x50')]['id']={'$gt':_0x14834a[_0x0452('0x44')]['id']};}_0x25322a=_[_0x0452('0x9f')]({},_0x25322a,_0x14834a[_0x0452('0x10a')]);return db['ChatMessage'][_0x0452('0x2e')]({'where':_0x25322a[_0x0452('0x50')]})[_0x0452('0x20')](function(_0x26cdd3){_0x4e4ca5['count']=_0x26cdd3;_0x25322a[_0x0452('0xba')]=[];if(_0x14834a[_0x0452('0x44')][_0x0452('0x10b')]){_0x25322a[_0x0452('0xba')][_0x0452('0xb5')]({'model':db['User'],'as':_0x0452('0x76'),'attributes':['id',_0x0452('0x3a'),_0x0452('0xf1')]});}if(_0x14834a[_0x0452('0x44')][_0x0452('0x10c')]){_0x25322a[_0x0452('0xba')]=[{'all':!![]}];}return db[_0x0452('0xe5')][_0x0452('0x108')](_0x25322a);})[_0x0452('0x20')](function(_0x3d8e6d){_0x4e4ca5['rows']=_0x3d8e6d;return _0x4e4ca5;});}})[_0x0452('0x20')](respondWithFilteredResult(_0x3c5229,_0x25322a))[_0x0452('0x29')](handleError(_0x3c5229,null));};exports['addTags']=function(_0x4f8469,_0x1f3aa3,_0x267050){return db['ChatInteraction'][_0x0452('0x68')]({'where':{'id':_0x4f8469[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x1f3aa3,null))[_0x0452('0x20')](function(_0x2fd818){if(_0x2fd818){return _0x2fd818[_0x0452('0x10d')](_0x4f8469[_0x0452('0x7b')]['ids'],_[_0x0452('0x105')](_0x4f8469[_0x0452('0x7b')],[_0x0452('0x104'),'id'])||{})[_0x0452('0x10e')](function(){return db['Tag'][_0x0452('0x108')]({'attributes':['id',_0x0452('0x36'),_0x0452('0x54')],'where':{'id':_0x4f8469[_0x0452('0x7b')][_0x0452('0x104')]}});})['then'](function(_0x2f00d7){socket[_0x0452('0x10f')]('chatInteractionTags:save',{'id':Number(_0x4f8469[_0x0452('0xb9')]['id']),'tags':_0x2f00d7||[]});return{'id':Number(_0x4f8469[_0x0452('0xb9')]['id']),'tags':_0x2f00d7||[]};});}})[_0x0452('0x20')](respondWithResult(_0x1f3aa3,null))[_0x0452('0x29')](handleError(_0x1f3aa3,null));};exports[_0x0452('0x110')]=function(_0x4f88ce,_0x33793d,_0x1d69b5){return db[_0x0452('0x3f')][_0x0452('0x68')]({'where':{'id':_0x4f88ce[_0x0452('0xb9')]['id']}})[_0x0452('0x20')](handleEntityNotFound(_0x33793d,null))['then'](function(_0x287d9f){if(_0x287d9f){return _0x287d9f['removeTags'](_0x4f88ce[_0x0452('0x44')]['ids']);}})[_0x0452('0x20')](respondWithStatusCode(_0x33793d,null))[_0x0452('0x29')](handleError(_0x33793d,null));};exports['download']=function(_0x5d987b,_0x23c2c0){var _0x108568=moment()[_0x0452('0x111')]()[_0x0452('0x9e')]();var _0x2fdc6c=path[_0x0452('0xdf')](config[_0x0452('0xe0')],_0x0452('0x112'),_0x0452('0x113'),_0x0452('0x114'));var _0x40192c=path[_0x0452('0xdf')](config['root'],_0x0452('0x112'),_0x0452('0x113'),'attachments');var _0x28aad3=path[_0x0452('0xdf')](_0x2fdc6c,_0x108568);var _0xcf9ee0=util[_0x0452('0xe8')](_0x0452('0x115'),_0x5d987b[_0x0452('0xb9')]['id'],_0x108568);var _0x3e1f47=path[_0x0452('0xdf')](_0x2fdc6c,_0xcf9ee0);var _0x4c8856=[];_0x4c8856[_0x0452('0xb5')]({'model':db['User'],'as':_0x0452('0x76'),'attributes':['id',_0x0452('0x3a')],'raw':!![]});_0x4c8856['push']({'model':db[_0x0452('0xe7')],'as':_0x0452('0x6c'),'attributes':['id',_0x0452('0x116'),_0x0452('0x117')],'raw':!![]});if(_0x5d987b[_0x0452('0x44')][_0x0452('0x118')]){_0x4c8856[_0x0452('0xb5')]({'model':db[_0x0452('0xdb')],'as':'Attachment','raw':!![]});}var _0x5bd2e0=[{'model':db[_0x0452('0xe5')],'as':'Messages','attributes':['id','body','createdAt',_0x0452('0xf4'),'secret',_0x0452('0x87')],'include':_0x4c8856}];_0x5bd2e0[_0x0452('0xb5')]({'model':db[_0x0452('0xc0')],'as':_0x0452('0x119'),'attributes':['id','name']});_0x5bd2e0[_0x0452('0xb5')]({'model':db[_0x0452('0x76')],'as':_0x0452('0x11a'),'attributes':['id',_0x0452('0x3a')]});return db[_0x0452('0x3f')][_0x0452('0x68')]({'where':{'id':_0x5d987b[_0x0452('0xb9')]['id']},'include':_0x5bd2e0})[_0x0452('0x20')](handleEntityNotFound(_0x23c2c0,null))[_0x0452('0x20')](function(_0x2131f5){if(_0x2131f5){var _0x4f1f35=_0x2131f5[_0x0452('0x11b')]({'plain':!![]});fs[_0x0452('0x11c')](_0x28aad3);var _0x3a0f84={'format':'A4','border':_0x0452('0x11d'),'header':{'height':_0x0452('0x11e'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x0452('0x11f'),'contents':{'default':util['format'](_0x0452('0x120'),util[_0x0452('0xe8')](_0x0452('0x121'),_0x0452('0x122'),_0x4f1f35['id']),moment()[_0x0452('0xe8')](_0x0452('0x123'))['toString']())}}};var _0x4d616c={'channel':_0x0452('0x122'),'account':_0x4f1f35['Account'][_0x0452('0x36')],'agent':_0x4f1f35[_0x0452('0x11a')]?_0x4f1f35[_0x0452('0x11a')][_0x0452('0x3a')]:_0x0452('0x124'),'createdAt':moment(_0x4f1f35[_0x0452('0x81')])[_0x0452('0xe8')](_0x0452('0x125'))[_0x0452('0x9e')](),'closedAt':_0x4f1f35[_0x0452('0xd2')]?moment(_0x4f1f35[_0x0452('0x126')])[_0x0452('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0452('0x9e')]():'','disposition':_0x4f1f35[_0x0452('0x127')],'chatInfo':{'browser':_0x4f1f35[_0x0452('0x128')],'os':_0x4f1f35[_0x0452('0x129')],'referer':_0x4f1f35[_0x0452('0x12a')],'customerIp':_0x4f1f35[_0x0452('0x12b')],'customerPort':_0x4f1f35[_0x0452('0x12c')]?_0x4f1f35[_0x0452('0x12c')]:_0x0452('0x124')},'messages':_(_0x4f1f35[_0x0452('0xe6')])[_0x0452('0x12d')]()[_0x0452('0x8c')]({'secret':![]})[_0x0452('0x39')](function(_0x3bc4d0){if(_0x3bc4d0[_0x0452('0xdb')]){var _0x355e8b=path['join'](_0x40192c,_0x3bc4d0[_0x0452('0xdb')]['basename']);if(fs[_0x0452('0x12e')](_0x355e8b)){fs[_0x0452('0x12f')](_0x355e8b)['pipe'](fs['createWriteStream'](path['join'](_0x28aad3,_0x3bc4d0[_0x0452('0xdb')][_0x0452('0xd8')])));}}return{'date':moment(_0x3bc4d0[_0x0452('0x81')])[_0x0452('0xe8')](_0x0452('0x125'))[_0x0452('0x9e')](),'sender':_0x3bc4d0[_0x0452('0xf4')]===_0x0452('0xcb')?_0x3bc4d0[_0x0452('0x76')]?_0x3bc4d0['User'][_0x0452('0x3a')]:_0x0452('0xeb'):_0x3bc4d0[_0x0452('0x6c')][_0x0452('0x116')]+(_0x3bc4d0[_0x0452('0x6c')][_0x0452('0x117')]?'\x20'+_0x3bc4d0['Contact']['lastName']:''),'body':_0x3bc4d0[_0x0452('0xdb')]?_0x3bc4d0[_0x0452('0xdb')][_0x0452('0xd8')]:_0x3bc4d0['body'],'direction':_0x3bc4d0[_0x0452('0xf4')]===_0x0452('0xcb')?'A':'C','secret':_0x3bc4d0['secret'],'read':_0x3bc4d0['read'],'attachment':_0x3bc4d0['Attachment']};})[_0x0452('0x69')]()};return ejs['renderFile'](path['join'](config['root'],_0x0452('0x112'),_0x0452('0x130'),_0x0452('0x131')),{'interaction':_0x4d616c})[_0x0452('0x20')](function(_0x2b6344){return new BPromise(function(_0x22a2c5,_0x4341e7){pdf[_0x0452('0xbb')](_0x2b6344,_0x3a0f84)[_0x0452('0x132')](path[_0x0452('0xdf')](_0x28aad3,_0x0452('0x133')+_0x4f1f35['id']+'-'+_0x108568+'.pdf'),function(_0x531b62,_0x52058c){if(_0x531b62)return _0x4341e7(_0x531b62);_0x22a2c5(_0x52058c);});});})['then'](function(){return new BPromise(function(_0xfe79ae,_0x2d74fd){zipdir(_0x28aad3,{'saveTo':_0x3e1f47},function(_0x563366,_0x40129d){if(_0x563366)return _0x2d74fd(_0x563366);return _0xfe79ae(_0x40129d);});})[_0x0452('0x20')](function(){return new BPromise(function(_0x1279c6,_0x4c700a){rimraf(_0x28aad3,function(_0x3b0ea8){if(_0x3b0ea8)_0x4c700a(_0x3b0ea8);return _0x1279c6();});});})[_0x0452('0x20')](function(){return _0x23c2c0['download'](_0x3e1f47,_0xcf9ee0,function(_0x1dc97f){if(_0x1dc97f){console[_0x0452('0x134')](_0x0452('0x135'),_0x1dc97f);}else{fs[_0x0452('0x136')](_0x3e1f47);}});});});}else{return _0x23c2c0[_0x0452('0x2a')](0xc8);}})[_0x0452('0x29')](handleError(_0x23c2c0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index b7bb831..f7bd178 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 _0x0bdb=['ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x5080fd,_0x294a56){var _0x83e0cc=function(_0x26d164){while(--_0x26d164){_0x5080fd['push'](_0x5080fd['shift']());}};_0x83e0cc(++_0x294a56);}(_0x0bdb,0x11f));var _0xb0bd=function(_0x1c2fb6,_0x56e83a){_0x1c2fb6=_0x1c2fb6-0x0;var _0x1f5b64=_0x0bdb[_0x1c2fb6];return _0x1f5b64;};'use strict';var EventEmitter=require(_0xb0bd('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xb0bd('0x1'))['db'][_0xb0bd('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb0bd('0x3')](0x0);var events={'afterCreate':_0xb0bd('0x4'),'afterUpdate':_0xb0bd('0x5'),'afterDestroy':_0xb0bd('0x6')};function emitEvent(_0x95626f){return function(_0x20f04e,_0x21b3c2,_0x4b28f9){_0x20f04e[_0xb0bd('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a4eb6){_0x20f04e[_0xb0bd('0x8')](_0xb0bd('0x9'),_0x1a4eb6[_0xb0bd('0xa')](function(_0x39c08c){return{'id':_0x39c08c['id']};}));return ChatMessage[_0xb0bd('0xb')]({'where':{'ChatInteractionId':_0x20f04e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x12a482){_0x20f04e[_0xb0bd('0x8')](_0xb0bd('0xc'),_0x12a482[_0xb0bd('0xd')]);ChatInteractionEvents[_0xb0bd('0xe')](_0x95626f+':'+_0x20f04e['id'],_0x20f04e);ChatInteractionEvents[_0xb0bd('0xe')](_0x95626f,_0x20f04e);_0x4b28f9(null);})[_0xb0bd('0xf')](_0x4b28f9(null));};}for(var e in events){if(events[_0xb0bd('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x8ed7=['ChatInteraction','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x18bfd5,_0x2b0680){var _0x2e0b75=function(_0x15903d){while(--_0x15903d){_0x18bfd5['push'](_0x18bfd5['shift']());}};_0x2e0b75(++_0x2b0680);}(_0x8ed7,0x8b));var _0x78ed=function(_0x2f3685,_0x1a56a2){_0x2f3685=_0x2f3685-0x0;var _0x5dceda=_0x8ed7[_0x2f3685];return _0x5dceda;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x78ed('0x0'))['db'][_0x78ed('0x1')];var ChatMessage=require(_0x78ed('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x78ed('0x2'),'afterUpdate':_0x78ed('0x3'),'afterDestroy':_0x78ed('0x4')};function emitEvent(_0x1301bc){return function(_0x137b24,_0x21ae33,_0x3d8efa){_0x137b24[_0x78ed('0x5')]({'attributes':['id'],'raw':!![]})[_0x78ed('0x6')](function(_0x54c783){_0x137b24[_0x78ed('0x7')]('Users',_0x54c783[_0x78ed('0x8')](function(_0x574428){return{'id':_0x574428['id']};}));return ChatMessage[_0x78ed('0x9')]({'where':{'ChatInteractionId':_0x137b24['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d3b0e){_0x137b24[_0x78ed('0x7')](_0x78ed('0xa'),_0x5d3b0e['length']);ChatInteractionEvents[_0x78ed('0xb')](_0x1301bc+':'+_0x137b24['id'],_0x137b24);ChatInteractionEvents[_0x78ed('0xb')](_0x1301bc,_0x137b24);_0x3d8efa(null);})['catch'](_0x3d8efa(null));};}for(var e in events){if(events[_0x78ed('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x78ed('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 977f835..ec2314f 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 _0x889a=['chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x889a,0xdf));var _0xa889=function(_0x1b7c5a,_0x1ef9c9){_0x1b7c5a=_0x1b7c5a-0x0;var _0x2187b7=_0x889a[_0x1b7c5a];return _0x2187b7;};'use strict';var _=require(_0xa889('0x0'));var util=require(_0xa889('0x1'));var logger=require(_0xa889('0x2'))('api');var moment=require(_0xa889('0x3'));var BPromise=require(_0xa889('0x4'));var rp=require(_0xa889('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa889('0x6'));var attributes=require(_0xa889('0x7'));module[_0xa889('0x8')]=function(_0x470f10,_0x22afc3){return _0x470f10[_0xa889('0x9')](_0xa889('0xa'),attributes,{'tableName':_0xa889('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x653ad7,_0x12f41e,_0x235105){if(_0x653ad7[_0xa889('0xc')](_0xa889('0xd'))){_0x653ad7[_0xa889('0xe')]=moment()[_0xa889('0xf')](_0xa889('0x10'));}_0x235105(null,_0x653ad7);}},'charset':_0xa889('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xde9b=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','closedAt'];(function(_0x1f61ba,_0x378003){var _0x1faa3c=function(_0xf885a4){while(--_0xf885a4){_0x1f61ba['push'](_0x1f61ba['shift']());}};_0x1faa3c(++_0x378003);}(_0xde9b,0x147));var _0xbde9=function(_0x5cdcff,_0x3118f2){_0x5cdcff=_0x5cdcff-0x0;var _0x46b31a=_0xde9b[_0x5cdcff];return _0x46b31a;};'use strict';var _=require('lodash');var util=require(_0xbde9('0x0'));var logger=require(_0xbde9('0x1'))(_0xbde9('0x2'));var moment=require(_0xbde9('0x3'));var BPromise=require(_0xbde9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbde9('0x5'));var rimraf=require(_0xbde9('0x6'));var config=require(_0xbde9('0x7'));var attributes=require(_0xbde9('0x8'));module[_0xbde9('0x9')]=function(_0x129344,_0xca4116){return _0x129344[_0xbde9('0xa')](_0xbde9('0xb'),attributes,{'tableName':_0xbde9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46ff8d,_0x2f97b4,_0x5c9d98){if(_0x46ff8d['changed'](_0xbde9('0xd'))){_0x46ff8d[_0xbde9('0xe')]=moment()[_0xbde9('0xf')](_0xbde9('0x10'));}_0x5c9d98(null,_0x46ff8d);}},'charset':_0xbde9('0x11'),'collate':_0xbde9('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b17df09..9d96687 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 _0x6ac6=['./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','update','options','raw','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','addTags','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6ac6,0x17c));var _0x66ac=function(_0x486cc7,_0x5d689a){_0x486cc7=_0x486cc7-0x0;var _0x1069c0=_0x6ac6[_0x486cc7];return _0x1069c0;};'use strict';var _=require(_0x66ac('0x0'));var util=require(_0x66ac('0x1'));var moment=require('moment');var BPromise=require(_0x66ac('0x2'));var rs=require(_0x66ac('0x3'));var fs=require('fs');var Redis=require(_0x66ac('0x4'));var db=require(_0x66ac('0x5'))['db'];var utils=require(_0x66ac('0x6'));var logger=require(_0x66ac('0x7'))(_0x66ac('0x8'));var config=require(_0x66ac('0x9'));var jayson=require(_0x66ac('0xa'));var client=jayson['client'][_0x66ac('0xb')]({'port':0x232a});config[_0x66ac('0xc')]=_[_0x66ac('0xd')](config[_0x66ac('0xc')],{'host':_0x66ac('0xe'),'port':0x18eb});var socket=require(_0x66ac('0xf'))(new Redis(config['redis']));require(_0x66ac('0x10'))[_0x66ac('0x11')](socket);function respondWithRpcPromise(_0x3dc89d,_0x34dad4,_0xb1de5e){return new BPromise(function(_0x20cbda,_0x3726c4){return client['request'](_0x3dc89d,_0xb1de5e)[_0x66ac('0x12')](function(_0x22b5a8){logger[_0x66ac('0x13')](_0x66ac('0x14'),_0x34dad4,_0x66ac('0x15'));logger[_0x66ac('0x16')](_0x66ac('0x17'),_0x34dad4,_0x66ac('0x15'),JSON[_0x66ac('0x18')](_0x22b5a8));if(_0x22b5a8[_0x66ac('0x19')]){if(_0x22b5a8['error']['code']===0x1f4){logger['error'](_0x66ac('0x14'),_0x34dad4,_0x22b5a8[_0x66ac('0x19')][_0x66ac('0x1a')]);return _0x3726c4(_0x22b5a8[_0x66ac('0x19')][_0x66ac('0x1a')]);}logger[_0x66ac('0x19')](_0x66ac('0x14'),_0x34dad4,_0x22b5a8[_0x66ac('0x19')][_0x66ac('0x1a')]);return _0x20cbda(_0x22b5a8['error'][_0x66ac('0x1a')]);}else{logger[_0x66ac('0x13')](_0x66ac('0x14'),_0x34dad4,_0x66ac('0x15'));_0x20cbda(_0x22b5a8[_0x66ac('0x1b')][_0x66ac('0x1a')]);}})[_0x66ac('0x1c')](function(_0x990295){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x34dad4,_0x990295);_0x3726c4(_0x990295);});});}exports[_0x66ac('0x1d')]=function(_0x35fd7f){var _0x37a9b9=this;return new Promise(function(_0x156944,_0x35f74f){return db['ChatInteraction'][_0x66ac('0x1e')](_0x35fd7f['body'],{'raw':_0x35fd7f[_0x66ac('0x1f')]?_0x35fd7f[_0x66ac('0x1f')][_0x66ac('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35fd7f[_0x66ac('0x1f')]?_0x35fd7f['options'][_0x66ac('0x21')]||null:null,'attributes':_0x35fd7f['options']?_0x35fd7f[_0x66ac('0x1f')][_0x66ac('0x22')]||null:null,'limit':_0x35fd7f[_0x66ac('0x1f')]?_0x35fd7f[_0x66ac('0x1f')][_0x66ac('0x23')]||null:null})[_0x66ac('0x12')](function(_0xbb0e6){logger[_0x66ac('0x13')](_0x66ac('0x1d'),_0x35fd7f);logger[_0x66ac('0x16')](_0x66ac('0x1d'),_0x35fd7f,JSON[_0x66ac('0x18')](_0xbb0e6));_0x156944(_0xbb0e6);})[_0x66ac('0x1c')](function(_0x172e13){logger[_0x66ac('0x19')]('UpdateChatInteraction',_0x172e13[_0x66ac('0x1a')],_0x35fd7f);_0x35f74f(_0x37a9b9[_0x66ac('0x19')](0x1f4,_0x172e13[_0x66ac('0x1a')]));});});};exports[_0x66ac('0x24')]=function(_0x2a17c9){return new Promise(function(_0x4091f3,_0x1fad93){return db[_0x66ac('0x25')]['find']({'where':_0x2a17c9['options']?_0x2a17c9['options'][_0x66ac('0x21')]||null:null})['then'](function(_0x454ef3){if(_0x454ef3){return _0x454ef3[_0x66ac('0x26')](_0x2a17c9['body'][_0x66ac('0x27')],_[_0x66ac('0x28')](_0x2a17c9[_0x66ac('0x29')],['ids','id'])||{});}})[_0x66ac('0x2a')](function(_0x1249b4){logger[_0x66ac('0x13')](_0x66ac('0x2b'),_0x2a17c9);logger[_0x66ac('0x16')](_0x66ac('0x2b'),_0x2a17c9,JSON['stringify'](_0x1249b4));_0x4091f3(_0x1249b4);})[_0x66ac('0x1c')](function(_0x843dd){logger[_0x66ac('0x19')](_0x66ac('0x2b'),_0x843dd[_0x66ac('0x1a')],_0x2a17c9);_0x1fad93(_this[_0x66ac('0x19')](0x1f4,_0x843dd[_0x66ac('0x1a')]));});});}; \ No newline at end of file +var _0x87b0=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','limit','then','catch','AddTagsToChatInteraction','find','ids','omit','spread'];(function(_0x43d57c,_0xdd02fe){var _0x5d9d5c=function(_0xd253cb){while(--_0xd253cb){_0x43d57c['push'](_0x43d57c['shift']());}};_0x5d9d5c(++_0xdd02fe);}(_0x87b0,0x151));var _0x087b=function(_0x3db36b,_0x143eeb){_0x3db36b=_0x3db36b-0x0;var _0x3c762e=_0x87b0[_0x3db36b];return _0x3c762e;};'use strict';var _=require(_0x087b('0x0'));var util=require(_0x087b('0x1'));var moment=require(_0x087b('0x2'));var BPromise=require(_0x087b('0x3'));var rs=require(_0x087b('0x4'));var fs=require('fs');var Redis=require(_0x087b('0x5'));var db=require(_0x087b('0x6'))['db'];var utils=require(_0x087b('0x7'));var logger=require('../../config/logger')(_0x087b('0x8'));var config=require(_0x087b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x087b('0xa')][_0x087b('0xb')]({'port':0x232a});config[_0x087b('0xc')]=_[_0x087b('0xd')](config[_0x087b('0xc')],{'host':_0x087b('0xe'),'port':0x18eb});var socket=require(_0x087b('0xf'))(new Redis(config['redis']));require(_0x087b('0x10'))['register'](socket);function respondWithRpcPromise(_0xa178d2,_0x916ed7,_0x22bd21){return new BPromise(function(_0x3a8a38,_0x5e114e){return client[_0x087b('0x11')](_0xa178d2,_0x22bd21)['then'](function(_0x6a6406){logger[_0x087b('0x12')](_0x087b('0x13'),_0x916ed7,_0x087b('0x14'));logger[_0x087b('0x15')](_0x087b('0x16'),_0x916ed7,'request\x20sent',JSON[_0x087b('0x17')](_0x6a6406));if(_0x6a6406[_0x087b('0x18')]){if(_0x6a6406[_0x087b('0x18')]['code']===0x1f4){logger[_0x087b('0x18')](_0x087b('0x13'),_0x916ed7,_0x6a6406[_0x087b('0x18')][_0x087b('0x19')]);return _0x5e114e(_0x6a6406[_0x087b('0x18')][_0x087b('0x19')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x916ed7,_0x6a6406[_0x087b('0x18')]['message']);return _0x3a8a38(_0x6a6406[_0x087b('0x18')]['message']);}else{logger[_0x087b('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x916ed7,'request\x20sent');_0x3a8a38(_0x6a6406[_0x087b('0x1a')]['message']);}})['catch'](function(_0x565018){logger[_0x087b('0x18')](_0x087b('0x13'),_0x916ed7,_0x565018);_0x5e114e(_0x565018);});});}exports[_0x087b('0x1b')]=function(_0x195d79){var _0x2cdb03=this;return new Promise(function(_0x1e50e7,_0x304c53){return db[_0x087b('0x1c')][_0x087b('0x1d')](_0x195d79[_0x087b('0x1e')],{'raw':_0x195d79['options']?_0x195d79[_0x087b('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x195d79['options']?_0x195d79[_0x087b('0x1f')][_0x087b('0x20')]||null:null,'attributes':_0x195d79[_0x087b('0x1f')]?_0x195d79[_0x087b('0x1f')]['attributes']||null:null,'limit':_0x195d79[_0x087b('0x1f')]?_0x195d79[_0x087b('0x1f')][_0x087b('0x21')]||null:null})[_0x087b('0x22')](function(_0x230f36){logger[_0x087b('0x12')](_0x087b('0x1b'),_0x195d79);logger[_0x087b('0x15')](_0x087b('0x1b'),_0x195d79,JSON['stringify'](_0x230f36));_0x1e50e7(_0x230f36);})[_0x087b('0x23')](function(_0x5e1d4a){logger[_0x087b('0x18')]('UpdateChatInteraction',_0x5e1d4a[_0x087b('0x19')],_0x195d79);_0x304c53(_0x2cdb03['error'](0x1f4,_0x5e1d4a[_0x087b('0x19')]));});});};exports[_0x087b('0x24')]=function(_0x5ee722){return new Promise(function(_0x466e6f,_0xe9a082){return db['ChatInteraction'][_0x087b('0x25')]({'where':_0x5ee722[_0x087b('0x1f')]?_0x5ee722[_0x087b('0x1f')][_0x087b('0x20')]||null:null})[_0x087b('0x22')](function(_0x853803){if(_0x853803){return _0x853803['addTags'](_0x5ee722[_0x087b('0x1e')][_0x087b('0x26')],_[_0x087b('0x27')](_0x5ee722['body'],[_0x087b('0x26'),'id'])||{});}})[_0x087b('0x28')](function(_0x5c638d){logger[_0x087b('0x12')]('AddTags',_0x5ee722);logger['debug'](_0x087b('0x29'),_0x5ee722,JSON[_0x087b('0x17')](_0x5c638d));_0x466e6f(_0x5c638d);})[_0x087b('0x23')](function(_0x244237){logger['error'](_0x087b('0x29'),_0x244237[_0x087b('0x19')],_0x5ee722);_0xe9a082(_this[_0x087b('0x18')](0x1f4,_0x244237[_0x087b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4e66487..3b3c76c 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 _0xd589=['removeListener','length','chatInteraction:','./chatInteraction.events','save','remove','emit'];(function(_0xaac101,_0x34b51f){var _0x5f1256=function(_0x8011bf){while(--_0x8011bf){_0xaac101['push'](_0xaac101['shift']());}};_0x5f1256(++_0x34b51f);}(_0xd589,0x96));var _0x9d58=function(_0xd01004,_0x3bb5b9){_0xd01004=_0xd01004-0x0;var _0x4fe7b8=_0xd589[_0xd01004];return _0x4fe7b8;};'use strict';var ChatInteractionEvents=require(_0x9d58('0x0'));var events=[_0x9d58('0x1'),_0x9d58('0x2'),'update'];function createListener(_0x5c5a42,_0x55af7b){return function(_0xc81dc0){_0x55af7b[_0x9d58('0x3')](_0x5c5a42,_0xc81dc0);};}function removeListener(_0x5d7589,_0x25879c){return function(){ChatInteractionEvents[_0x9d58('0x4')](_0x5d7589,_0x25879c);};}exports['register']=function(_0x25bafb){for(var _0x2db258=0x0,_0x11f83a=events[_0x9d58('0x5')];_0x2db258<_0x11f83a;_0x2db258++){var _0x548856=events[_0x2db258];var _0x24c47a=createListener(_0x9d58('0x6')+_0x548856,_0x25bafb);ChatInteractionEvents['on'](_0x548856,_0x24c47a);}}; \ No newline at end of file +var _0x2cfd=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x478422,_0x4702ff){var _0x17a385=function(_0x32d907){while(--_0x32d907){_0x478422['push'](_0x478422['shift']());}};_0x17a385(++_0x4702ff);}(_0x2cfd,0x189));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';var ChatInteractionEvents=require(_0xd2cf('0x0'));var events=[_0xd2cf('0x1'),_0xd2cf('0x2'),_0xd2cf('0x3')];function createListener(_0x16787a,_0x340ad4){return function(_0x11380a){_0x340ad4[_0xd2cf('0x4')](_0x16787a,_0x11380a);};}function removeListener(_0x55b5af,_0x10de38){return function(){ChatInteractionEvents[_0xd2cf('0x5')](_0x55b5af,_0x10de38);};}exports[_0xd2cf('0x6')]=function(_0x53540e){for(var _0x2e10e5=0x0,_0x5acc46=events[_0xd2cf('0x7')];_0x2e10e5<_0x5acc46;_0x2e10e5++){var _0x5c8825=events[_0x2e10e5];var _0x3b7958=createListener('chatInteraction:'+_0x5c8825,_0x53540e);ChatInteractionEvents['on'](_0x5c8825,_0x3b7958);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 245852f..805c3f2 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 _0xdb48=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','diskStorage','root','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb48,0x103));var _0x8db4=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xdb48[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x8db4('0x0'));var util=require(_0x8db4('0x1'));var path=require(_0x8db4('0x2'));var timeout=require(_0x8db4('0x3'));var express=require(_0x8db4('0x4'));var router=express[_0x8db4('0x5')]();var auth=require(_0x8db4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8db4('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x8db4('0x8')](),controller[_0x8db4('0x9')]);router['get'](_0x8db4('0xa'),auth[_0x8db4('0x8')](),controller[_0x8db4('0xb')]);router[_0x8db4('0xc')](_0x8db4('0xd'),auth[_0x8db4('0xe')](),controller[_0x8db4('0xf')]);router[_0x8db4('0xc')](_0x8db4('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x8db4('0x11')]);router[_0x8db4('0xc')](_0x8db4('0x12'),auth[_0x8db4('0x8')](),controller[_0x8db4('0x13')]);router[_0x8db4('0xc')](_0x8db4('0x14'),auth[_0x8db4('0xe')](),controller['getMyMessages']);router[_0x8db4('0xc')](_0x8db4('0x15'),auth[_0x8db4('0x8')](),controller[_0x8db4('0x16')]);router[_0x8db4('0x17')]('/',auth[_0x8db4('0x8')](),controller[_0x8db4('0x18')]);router['post']('/:id/vidaoo',auth[_0x8db4('0x8')](),controller[_0x8db4('0x19')]);var upload=multer({'storage':multer[_0x8db4('0x1a')]({'destination':function(_0x24ebab,_0x419e5e,_0x2a1d81){_0x2a1d81(null,path['join'](config[_0x8db4('0x1b')],'server/files/attachments/'));},'filename':function(_0x3ac9ca,_0x329092,_0x4be918){_0x4be918(null,util[_0x8db4('0x1c')]('%s-%s',Date[_0x8db4('0x1d')](),_0x329092[_0x8db4('0x1e')][_0x8db4('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db4('0x17')](_0x8db4('0x20'),upload[_0x8db4('0x21')](_0x8db4('0x22')),controller[_0x8db4('0x23')]);router['post'](_0x8db4('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x8db4('0x24')]);router[_0x8db4('0x17')](_0x8db4('0x25'),auth[_0x8db4('0x8')](),interaction[_0x8db4('0x26')](_0x8db4('0x27'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x8db4('0xd'),auth[_0x8db4('0x8')](),interaction[_0x8db4('0x26')](_0x8db4('0x27'),'chatinteraction:update'),controller[_0x8db4('0x28')]);router[_0x8db4('0x29')](_0x8db4('0x2a'),controller[_0x8db4('0x2b')]);router[_0x8db4('0x29')](_0x8db4('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0x8db4('0x2d')]);router[_0x8db4('0x29')](_0x8db4('0x2e'),controller[_0x8db4('0x2f')]);router[_0x8db4('0x30')](_0x8db4('0xd'),auth[_0x8db4('0x8')](),interaction['tracked'](_0x8db4('0x27'),_0x8db4('0x31')),controller['destroy']);router['delete'](_0x8db4('0x25'),auth[_0x8db4('0x8')](),controller[_0x8db4('0x32')]);module[_0x8db4('0x33')]=router; \ No newline at end of file +var _0xa51b=['/:id/my_messages','isChatInteractionAuthorized','post','create','createVidaooSession','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xa51b,0x1c0));var _0xba51=function(_0x31ff63,_0x15ab56){_0x31ff63=_0x31ff63-0x0;var _0x445ba1=_0xa51b[_0x31ff63];return _0x445ba1;};'use strict';var multer=require(_0xba51('0x0'));var util=require(_0xba51('0x1'));var path=require(_0xba51('0x2'));var timeout=require(_0xba51('0x3'));var express=require(_0xba51('0x4'));var router=express[_0xba51('0x5')]();var auth=require(_0xba51('0x6'));var interaction=require(_0xba51('0x7'));var config=require(_0xba51('0x8'));var controller=require('./chatInteraction.controller');router[_0xba51('0x9')]('/',auth[_0xba51('0xa')](),controller[_0xba51('0xb')]);router[_0xba51('0x9')](_0xba51('0xc'),auth[_0xba51('0xa')](),controller[_0xba51('0xd')]);router[_0xba51('0x9')](_0xba51('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xba51('0xf')]);router[_0xba51('0x9')](_0xba51('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xba51('0x11')]);router[_0xba51('0x9')](_0xba51('0x12'),auth[_0xba51('0xa')](),controller[_0xba51('0x13')]);router[_0xba51('0x9')](_0xba51('0x14'),auth[_0xba51('0x15')](),controller['getMyMessages']);router[_0xba51('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xba51('0x16')]('/',auth[_0xba51('0xa')](),controller[_0xba51('0x17')]);router['post']('/:id/vidaoo',auth[_0xba51('0xa')](),controller[_0xba51('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56bdc5,_0x52c24d,_0x154cce){_0x154cce(null,path[_0xba51('0x19')](config['root'],_0xba51('0x1a')));},'filename':function(_0x109a60,_0x3c3d17,_0x268fb6){_0x268fb6(null,util[_0xba51('0x1b')]('%s-%s',Date[_0xba51('0x1c')](),_0x3c3d17[_0xba51('0x1d')][_0xba51('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xba51('0x16')](_0xba51('0x1f'),upload['single'](_0xba51('0x20')),controller[_0xba51('0x21')]);router[_0xba51('0x16')](_0xba51('0x12'),auth[_0xba51('0x15')](),controller[_0xba51('0x22')]);router[_0xba51('0x16')](_0xba51('0x23'),auth['isAuthenticated'](),interaction[_0xba51('0x24')](_0xba51('0x25'),_0xba51('0x26')),controller[_0xba51('0x27')]);router[_0xba51('0x28')](_0xba51('0xe'),auth[_0xba51('0xa')](),interaction['tracked'](_0xba51('0x25'),'chatinteraction:update'),controller[_0xba51('0x29')]);router[_0xba51('0x28')](_0xba51('0x2a'),controller[_0xba51('0x2b')]);router['put'](_0xba51('0x2c'),auth[_0xba51('0x15')](),controller[_0xba51('0x2d')]);router[_0xba51('0x28')](_0xba51('0x2e'),controller[_0xba51('0x2f')]);router[_0xba51('0x30')](_0xba51('0xe'),auth['isAuthenticated'](),interaction[_0xba51('0x24')](_0xba51('0x25'),'chatinteraction:destroy'),controller[_0xba51('0x31')]);router['delete'](_0xba51('0x23'),auth[_0xba51('0xa')](),controller[_0xba51('0x32')]);module[_0xba51('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 96f80b5..6f85c85 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 _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x18f20c,_0x2aaaf8){var _0x18dd6c=function(_0x22d276){while(--_0x22d276){_0x18f20c['push'](_0x18f20c['shift']());}};_0x18dd6c(++_0x2aaaf8);}(_0x57ca,0x108));var _0xa57c=function(_0x210777,_0x5d95d7){_0x210777=_0x210777-0x0;var _0x96152e=_0x57ca[_0x210777];return _0x96152e;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x9b2246,_0x509adc){var _0x428638=function(_0x3a0d65){while(--_0x3a0d65){_0x9b2246['push'](_0x9b2246['shift']());}};_0x428638(++_0x509adc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 443f08a..eac9b78 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 _0x3c2e=['rows','catch','show','params','rawAttributes','find','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','userpic','allowmessenger','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x567ec1,_0xc65745){var _0x3bb23d=function(_0x1459fd){while(--_0x1459fd){_0x567ec1['push'](_0x567ec1['shift']());}};_0x3bb23d(++_0xc65745);}(_0x3c2e,0x1cf));var _0xe3c2=function(_0xc39343,_0x31cbbf){_0xc39343=_0xc39343-0x0;var _0x1c8b52=_0x3c2e[_0xc39343];return _0x1c8b52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3c2('0x0'));var rimraf=require(_0xe3c2('0x1'));var zipdir=require(_0xe3c2('0x2'));var jsonpatch=require(_0xe3c2('0x3'));var rp=require('request-promise');var moment=require(_0xe3c2('0x4'));var BPromise=require(_0xe3c2('0x5'));var Mustache=require(_0xe3c2('0x6'));var util=require(_0xe3c2('0x7'));var path=require('path');var sox=require(_0xe3c2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3c2('0x9'));var squel=require(_0xe3c2('0xa'));var crypto=require(_0xe3c2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe3c2('0xc'));var toCsv=require(_0xe3c2('0xd'));var querystring=require(_0xe3c2('0xe'));var Papa=require(_0xe3c2('0xf'));var Redis=require(_0xe3c2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe3c2('0x11'));var as=require(_0xe3c2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3c2('0x13'))(_0xe3c2('0x14'));var utils=require(_0xe3c2('0x15'));var config=require(_0xe3c2('0x16'));var licenseUtil=require(_0xe3c2('0x17'));var db=require(_0xe3c2('0x18'))['db'];config[_0xe3c2('0x19')]=_[_0xe3c2('0x1a')](config['redis'],{'host':_0xe3c2('0x1b'),'port':0x18eb});var socket=require(_0xe3c2('0x1c'))(new Redis(config[_0xe3c2('0x19')]));require(_0xe3c2('0x1d'))['register'](socket);function respondWithStatusCode(_0x220abc,_0xb44659){_0xb44659=_0xb44659||0xcc;return function(_0x469b2a){if(_0x469b2a){return _0x220abc[_0xe3c2('0x1e')](_0xb44659);}return _0x220abc['status'](_0xb44659)[_0xe3c2('0x1f')]();};}function respondWithResult(_0x2a3dc9,_0x4ac80c){_0x4ac80c=_0x4ac80c||0xc8;return function(_0x2d0537){if(_0x2d0537){return _0x2a3dc9[_0xe3c2('0x20')](_0x4ac80c)['json'](_0x2d0537);}};}function respondWithFilteredResult(_0x149dc9,_0x36e05){return function(_0xf61f4f){if(_0xf61f4f){var _0x16c60e=_0xf61f4f[_0xe3c2('0x21')],_0x54adc6=_0x36e05[_0xe3c2('0x22')],_0xf37f7b=_0x36e05[_0xe3c2('0x22')]+_0x36e05[_0xe3c2('0x23')],_0x1803e8;if(_0xf37f7b>=_0x16c60e){_0xf37f7b=_0x16c60e;_0x1803e8=0xc8;}else{_0x1803e8=0xce;}_0x149dc9[_0xe3c2('0x20')](_0x1803e8);return _0x149dc9[_0xe3c2('0x24')](_0xe3c2('0x25'),_0x54adc6+'-'+_0xf37f7b+'/'+_0x16c60e)[_0xe3c2('0x26')](_0xf61f4f);}return null;};}function patchUpdates(_0x8e144){return function(_0x4a76a8){try{jsonpatch['apply'](_0x4a76a8,_0x8e144,!![]);}catch(_0x2f914b){return BPromise['reject'](_0x2f914b);}return _0x4a76a8[_0xe3c2('0x27')]();};}function saveUpdates(_0x504534,_0x4ebb4f){return function(_0x28703e){if(_0x28703e){return _0x28703e['update'](_0x504534)[_0xe3c2('0x28')](function(_0x4263d1){return _0x4263d1;});}return null;};}function removeEntity(_0xf27912,_0x16c43b){return function(_0x5b1f6a){if(_0x5b1f6a){return _0x5b1f6a[_0xe3c2('0x29')]()[_0xe3c2('0x28')](function(){_0xf27912[_0xe3c2('0x20')](0xcc)[_0xe3c2('0x1f')]();});}};}function handleEntityNotFound(_0x31dbf5,_0x405d4f){return function(_0x2907a3){if(!_0x2907a3){_0x31dbf5[_0xe3c2('0x1e')](0x194);}return _0x2907a3;};}function handleError(_0x5be887,_0x3fd6e0){_0x3fd6e0=_0x3fd6e0||0x1f4;return function(_0x381a82){logger[_0xe3c2('0x2a')](_0x381a82[_0xe3c2('0x2b')]);if(_0x381a82[_0xe3c2('0x2c')]){delete _0x381a82['name'];}_0x5be887['status'](_0x3fd6e0)[_0xe3c2('0x2d')](_0x381a82);};}exports[_0xe3c2('0x2e')]=function(_0x1aa6da,_0x1d9604){var _0x5d693a={},_0x5039c6={},_0x4944d3={'count':0x0,'rows':[]};var _0x15509d=_[_0xe3c2('0x2f')](db[_0xe3c2('0x30')]['rawAttributes'],function(_0x5aa002){return{'name':_0x5aa002[_0xe3c2('0x31')],'type':_0x5aa002[_0xe3c2('0x32')][_0xe3c2('0x33')]};});_0x5039c6[_0xe3c2('0x34')]=_[_0xe3c2('0x2f')](_0x15509d,_0xe3c2('0x2c'));_0x5039c6[_0xe3c2('0x35')]=_[_0xe3c2('0x36')](_0x1aa6da['query']);_0x5039c6[_0xe3c2('0x37')]=_[_0xe3c2('0x38')](_0x5039c6[_0xe3c2('0x34')],_0x5039c6[_0xe3c2('0x35')]);_0x5d693a[_0xe3c2('0x39')]=_['intersection'](_0x5039c6[_0xe3c2('0x34')],qs['fields'](_0x1aa6da[_0xe3c2('0x35')][_0xe3c2('0x3a')]));_0x5d693a[_0xe3c2('0x39')]=_0x5d693a[_0xe3c2('0x39')][_0xe3c2('0x3b')]?_0x5d693a[_0xe3c2('0x39')]:_0x5039c6['model'];if(!_0x1aa6da[_0xe3c2('0x35')]['hasOwnProperty'](_0xe3c2('0x3c'))){_0x5d693a[_0xe3c2('0x23')]=qs[_0xe3c2('0x23')](_0x1aa6da['query'][_0xe3c2('0x23')]);_0x5d693a[_0xe3c2('0x22')]=qs['offset'](_0x1aa6da[_0xe3c2('0x35')][_0xe3c2('0x22')]);}_0x5d693a[_0xe3c2('0x3d')]=qs['sort'](_0x1aa6da[_0xe3c2('0x35')][_0xe3c2('0x3e')]);_0x5d693a['where']=qs[_0xe3c2('0x37')](_[_0xe3c2('0x3f')](_0x1aa6da[_0xe3c2('0x35')],_0x5039c6[_0xe3c2('0x37')]),_0x15509d);if(_0x1aa6da[_0xe3c2('0x35')][_0xe3c2('0x40')]){_0x5d693a[_0xe3c2('0x41')]=_[_0xe3c2('0x42')](_0x5d693a['where'],{'$or':_[_0xe3c2('0x2f')](_0x15509d,function(_0x59b9fc){if(_0x59b9fc[_0xe3c2('0x32')]!==_0xe3c2('0x43')){var _0xc77250={};_0xc77250[_0x59b9fc[_0xe3c2('0x2c')]]={'$like':'%'+_0x1aa6da[_0xe3c2('0x35')][_0xe3c2('0x40')]+'%'};return _0xc77250;}})});}_0x5d693a=_[_0xe3c2('0x42')]({},_0x5d693a,_0x1aa6da[_0xe3c2('0x44')]);var _0x3b6909={'where':_0x5d693a[_0xe3c2('0x41')]};return db[_0xe3c2('0x30')][_0xe3c2('0x21')](_0x3b6909)[_0xe3c2('0x28')](function(_0x13b625){_0x4944d3[_0xe3c2('0x21')]=_0x13b625;if(_0x1aa6da[_0xe3c2('0x35')][_0xe3c2('0x45')]){_0x5d693a[_0xe3c2('0x46')]=[{'all':!![]}];}return db[_0xe3c2('0x30')][_0xe3c2('0x47')](_0x5d693a);})['then'](function(_0xe733f1){_0x4944d3[_0xe3c2('0x48')]=_0xe733f1;return _0x4944d3;})[_0xe3c2('0x28')](respondWithFilteredResult(_0x1d9604,_0x5d693a))[_0xe3c2('0x49')](handleError(_0x1d9604,null));};exports[_0xe3c2('0x4a')]=function(_0x291467,_0x336aca){var _0x22ae28={'raw':!![],'where':{'id':_0x291467[_0xe3c2('0x4b')]['id']}},_0x141326={};_0x141326[_0xe3c2('0x34')]=_[_0xe3c2('0x36')](db[_0xe3c2('0x30')][_0xe3c2('0x4c')]);_0x141326[_0xe3c2('0x35')]=_['keys'](_0x291467[_0xe3c2('0x35')]);_0x141326['filters']=_[_0xe3c2('0x38')](_0x141326['model'],_0x141326[_0xe3c2('0x35')]);_0x22ae28[_0xe3c2('0x39')]=_[_0xe3c2('0x38')](_0x141326['model'],qs[_0xe3c2('0x3a')](_0x291467[_0xe3c2('0x35')][_0xe3c2('0x3a')]));_0x22ae28[_0xe3c2('0x39')]=_0x22ae28[_0xe3c2('0x39')][_0xe3c2('0x3b')]?_0x22ae28[_0xe3c2('0x39')]:_0x141326[_0xe3c2('0x34')];if(_0x291467['query'][_0xe3c2('0x45')]){_0x22ae28[_0xe3c2('0x46')]=[{'all':!![]}];}_0x22ae28=_[_0xe3c2('0x42')]({},_0x22ae28,_0x291467[_0xe3c2('0x44')]);return db[_0xe3c2('0x30')][_0xe3c2('0x4d')](_0x22ae28)[_0xe3c2('0x28')](handleEntityNotFound(_0x336aca,null))['then'](respondWithResult(_0x336aca,null))['catch'](handleError(_0x336aca,null));};exports[_0xe3c2('0x4e')]=function(_0x4f8b28,_0x1aaaff){return db['ChatInternalMessage'][_0xe3c2('0x4e')](_0x4f8b28[_0xe3c2('0x4f')],{})['then'](respondWithResult(_0x1aaaff,0xc9))[_0xe3c2('0x49')](handleError(_0x1aaaff,null));};exports['update']=function(_0x3e848d,_0x2390c4){if(_0x3e848d[_0xe3c2('0x4f')]['id']){delete _0x3e848d[_0xe3c2('0x4f')]['id'];}return db[_0xe3c2('0x30')]['find']({'where':{'id':_0x3e848d['params']['id']}})[_0xe3c2('0x28')](handleEntityNotFound(_0x2390c4,null))[_0xe3c2('0x28')](saveUpdates(_0x3e848d[_0xe3c2('0x4f')],null))['then'](respondWithResult(_0x2390c4,null))[_0xe3c2('0x49')](handleError(_0x2390c4,null));};exports[_0xe3c2('0x29')]=function(_0x4b0468,_0x5c70bc){return db[_0xe3c2('0x30')][_0xe3c2('0x4d')]({'where':{'id':_0x4b0468[_0xe3c2('0x4b')]['id']}})[_0xe3c2('0x28')](handleEntityNotFound(_0x5c70bc,null))[_0xe3c2('0x28')](removeEntity(_0x5c70bc,null))[_0xe3c2('0x49')](handleError(_0x5c70bc,null));};exports[_0xe3c2('0x50')]=function(_0x3c6a80,_0x1b219f){return db[_0xe3c2('0x30')][_0xe3c2('0x50')]()[_0xe3c2('0x28')](respondWithResult(_0x1b219f,null))[_0xe3c2('0x49')](handleError(_0x1b219f,null));};function wrapUser(_0x3b425f){return function(_0x1a613b){var _0x1f4377=_0x3b425f[_0xe3c2('0x51')]({'plain':!![]});_0x1f4377[_0xe3c2('0x52')]=[];if(_0x1a613b){_0x1f4377[_0xe3c2('0x53')]=_0x1a613b['createdAt'];_0x1f4377[_0xe3c2('0x54')]=_0x1a613b;}else{_0x1f4377['lastMessageAt']=moment(0x0)[_0xe3c2('0x55')](_0xe3c2('0x56'));_0x1f4377[_0xe3c2('0x54')]={};}return _0x1f4377;};}exports['getUsers']=function(_0x369b62,_0x2313b2,_0x50b511){var _0x4f405e=[];return db[_0xe3c2('0x57')][_0xe3c2('0x47')]({'where':{'role':[_0xe3c2('0x58'),_0xe3c2('0x59'),_0xe3c2('0x5a')]},'attributes':['id',_0xe3c2('0x5b'),_0xe3c2('0x2c'),'role',_0xe3c2('0x5c'),'internal','online','lastLoginAt',_0xe3c2('0x5d'),'showWebBar'],'order':qs[_0xe3c2('0x3e')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xe3c2('0x2c'),_0xe3c2('0x32')],'through':{'attributes':[]}}]})[_0xe3c2('0x28')](function(_0x259feb){if(_0x259feb){var _0x12f68d=_0x369b62[_0xe3c2('0x5a')][_0xe3c2('0x51')]({'plain':!![]});if(!_0x12f68d)throw new Error(_0xe3c2('0x5e'));if(_0x12f68d[_0xe3c2('0x5f')]===_0xe3c2('0x5a')){return db['UserProfileSection']['find']({'where':{'name':_0xe3c2('0x60'),'userProfileId':_0x12f68d[_0xe3c2('0x61')]},'raw':!![]})[_0xe3c2('0x28')](function(_0x58c418){if(_0x58c418){if(_0x58c418['autoAssociation']===0x0){return db[_0xe3c2('0x62')]['findAll']({'where':{'sectionId':_0x58c418['id']},'raw':!![]})[_0xe3c2('0x28')](function(_0x24d0a4){var _0x4c6229=[];if(_[_0xe3c2('0x63')](_0x24d0a4)){_0x4c6229=_[_0xe3c2('0x40')](_0x259feb,function(_0x5348e7){if(_0x5348e7[_0xe3c2('0x5f')]!==_0xe3c2('0x58')){return _0x5348e7;}});return _0x4c6229;}else{for(var _0x4bc17c=0x0;_0x4bc17c<_0x259feb[_0xe3c2('0x3b')];_0x4bc17c++){var _0x4f3b04=_0x259feb[_0x4bc17c];if(_0x4f3b04[_0xe3c2('0x5f')]===_0xe3c2('0x58')){var _0x57e782=_[_0xe3c2('0x4d')](_0x24d0a4,function(_0x1b616e){return _0x1b616e[_0xe3c2('0x64')]===_0x4f3b04['id'];});if(_0x57e782)_0x4c6229['push'](_0x4f3b04);}else{_0x4c6229['push'](_0x4f3b04);}}return _0x4c6229;}});}else{return _0x259feb;}}else{var _0x11c827=_[_0xe3c2('0x40')](_0x259feb,function(_0x37f89c){if(_0x37f89c['role']!==_0xe3c2('0x58')){return _0x37f89c;}});return _0x11c827;}});}else{return _0x259feb;}}})['then'](function(_0x201573){var _0x5e43cd=[];if(_0x201573){_0x4f405e=_0x201573;for(var _0x14a77b=0x0;_0x14a77b<_0x201573[_0xe3c2('0x3b')];_0x14a77b+=0x1){_0x4f405e[_0x14a77b][_0xe3c2('0x52')]=[];_0x5e43cd[_0xe3c2('0x65')](db[_0xe3c2('0x30')][_0xe3c2('0x4d')]({'where':{'FromId':[_0x369b62[_0xe3c2('0x5a')]['id'],_0x201573[_0x14a77b]['id']],'ToId':[_0x369b62[_0xe3c2('0x5a')]['id'],_0x201573[_0x14a77b]['id']],'ChatGroupId':null},'attributes':['id',_0xe3c2('0x66'),_0xe3c2('0x67'),'ToId',_0xe3c2('0x68'),_0xe3c2('0x4f')],'order':qs[_0xe3c2('0x3e')](_0xe3c2('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe3c2('0x28')](wrapUser(_0x201573[_0x14a77b])));}return BPromise[_0xe3c2('0x6a')](_0x5e43cd);}return[];})[_0xe3c2('0x28')](function(_0x5c8d3a){return{'rows':_0x5c8d3a,'count':_0x5c8d3a[_0xe3c2('0x3b')]};})[_0xe3c2('0x28')](respondWithResult(_0x2313b2,null))[_0xe3c2('0x49')](handleError(_0x2313b2,null));}; \ No newline at end of file +var _0xfaf9=['body','update','describe','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','error','stack','name','index','map','ChatInternalMessage','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','type','options','then','includeAll','include','findAll','rows','show','params','find','catch','create'];(function(_0x3887c8,_0x2d9d8b){var _0x474980=function(_0x1663e6){while(--_0x1663e6){_0x3887c8['push'](_0x3887c8['shift']());}};_0x474980(++_0x2d9d8b);}(_0xfaf9,0x166));var _0x9faf=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xfaf9[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0x9faf('0x0'));var emlformat=require(_0x9faf('0x1'));var rimraf=require(_0x9faf('0x2'));var zipdir=require(_0x9faf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9faf('0x4'));var BPromise=require(_0x9faf('0x5'));var Mustache=require(_0x9faf('0x6'));var util=require(_0x9faf('0x7'));var path=require('path');var sox=require(_0x9faf('0x8'));var csv=require(_0x9faf('0x9'));var ejs=require(_0x9faf('0xa'));var fs=require('fs');var _=require(_0x9faf('0xb'));var squel=require(_0x9faf('0xc'));var crypto=require(_0x9faf('0xd'));var jsforce=require(_0x9faf('0xe'));var deskjs=require(_0x9faf('0xf'));var toCsv=require(_0x9faf('0x9'));var querystring=require(_0x9faf('0x10'));var Papa=require('papaparse');var Redis=require(_0x9faf('0x11'));var authService=require(_0x9faf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9faf('0x13'));var logger=require(_0x9faf('0x14'))(_0x9faf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9faf('0x16'))['db'];config[_0x9faf('0x17')]=_[_0x9faf('0x18')](config[_0x9faf('0x17')],{'host':_0x9faf('0x19'),'port':0x18eb});var socket=require(_0x9faf('0x1a'))(new Redis(config[_0x9faf('0x17')]));require(_0x9faf('0x1b'))[_0x9faf('0x1c')](socket);function respondWithStatusCode(_0x1d2348,_0x428a31){_0x428a31=_0x428a31||0xcc;return function(_0x104062){if(_0x104062){return _0x1d2348[_0x9faf('0x1d')](_0x428a31);}return _0x1d2348[_0x9faf('0x1e')](_0x428a31)[_0x9faf('0x1f')]();};}function respondWithResult(_0x51e8b2,_0x52f2a8){_0x52f2a8=_0x52f2a8||0xc8;return function(_0x549b2b){if(_0x549b2b){return _0x51e8b2[_0x9faf('0x1e')](_0x52f2a8)[_0x9faf('0x20')](_0x549b2b);}};}function respondWithFilteredResult(_0x5d9b29,_0x408d22){return function(_0x222f74){if(_0x222f74){var _0x329239=_0x222f74[_0x9faf('0x21')],_0x23609d=_0x408d22[_0x9faf('0x22')],_0x1d013c=_0x408d22[_0x9faf('0x22')]+_0x408d22['limit'],_0x4c3d10;if(_0x1d013c>=_0x329239){_0x1d013c=_0x329239;_0x4c3d10=0xc8;}else{_0x4c3d10=0xce;}_0x5d9b29[_0x9faf('0x1e')](_0x4c3d10);return _0x5d9b29[_0x9faf('0x23')]('Content-Range',_0x23609d+'-'+_0x1d013c+'/'+_0x329239)[_0x9faf('0x20')](_0x222f74);}return null;};}function patchUpdates(_0x13551f){return function(_0x5db0b4){try{jsonpatch[_0x9faf('0x24')](_0x5db0b4,_0x13551f,!![]);}catch(_0x491a07){return BPromise[_0x9faf('0x25')](_0x491a07);}return _0x5db0b4[_0x9faf('0x26')]();};}function saveUpdates(_0x5ced90,_0x27bcbc){return function(_0x18a94e){if(_0x18a94e){return _0x18a94e['update'](_0x5ced90)['then'](function(_0x34f81c){return _0x34f81c;});}return null;};}function removeEntity(_0x4abf3f,_0x131027){return function(_0x3d6fa5){if(_0x3d6fa5){return _0x3d6fa5['destroy']()['then'](function(){_0x4abf3f['status'](0xcc)[_0x9faf('0x1f')]();});}};}function handleEntityNotFound(_0x4e8c6f,_0x396b75){return function(_0x582113){if(!_0x582113){_0x4e8c6f[_0x9faf('0x1d')](0x194);}return _0x582113;};}function handleError(_0x558280,_0x351289){_0x351289=_0x351289||0x1f4;return function(_0x506cc9){logger[_0x9faf('0x27')](_0x506cc9[_0x9faf('0x28')]);if(_0x506cc9[_0x9faf('0x29')]){delete _0x506cc9['name'];}_0x558280[_0x9faf('0x1e')](_0x351289)['send'](_0x506cc9);};}exports[_0x9faf('0x2a')]=function(_0x5ab9e9,_0x23a5ba){var _0x57b2ff={},_0x5659d6={},_0x26a526={'count':0x0,'rows':[]};var _0x29bf23=_[_0x9faf('0x2b')](db[_0x9faf('0x2c')][_0x9faf('0x2d')],function(_0x1c92cb){return{'name':_0x1c92cb['fieldName'],'type':_0x1c92cb['type'][_0x9faf('0x2e')]};});_0x5659d6[_0x9faf('0x2f')]=_[_0x9faf('0x2b')](_0x29bf23,_0x9faf('0x29'));_0x5659d6[_0x9faf('0x30')]=_[_0x9faf('0x31')](_0x5ab9e9[_0x9faf('0x30')]);_0x5659d6[_0x9faf('0x32')]=_[_0x9faf('0x33')](_0x5659d6[_0x9faf('0x2f')],_0x5659d6['query']);_0x57b2ff['attributes']=_['intersection'](_0x5659d6['model'],qs[_0x9faf('0x34')](_0x5ab9e9[_0x9faf('0x30')][_0x9faf('0x34')]));_0x57b2ff['attributes']=_0x57b2ff[_0x9faf('0x35')][_0x9faf('0x36')]?_0x57b2ff[_0x9faf('0x35')]:_0x5659d6[_0x9faf('0x2f')];if(!_0x5ab9e9[_0x9faf('0x30')][_0x9faf('0x37')](_0x9faf('0x38'))){_0x57b2ff[_0x9faf('0x39')]=qs[_0x9faf('0x39')](_0x5ab9e9[_0x9faf('0x30')]['limit']);_0x57b2ff[_0x9faf('0x22')]=qs[_0x9faf('0x22')](_0x5ab9e9[_0x9faf('0x30')][_0x9faf('0x22')]);}_0x57b2ff[_0x9faf('0x3a')]=qs['sort'](_0x5ab9e9[_0x9faf('0x30')]['sort']);_0x57b2ff[_0x9faf('0x3b')]=qs[_0x9faf('0x32')](_['pick'](_0x5ab9e9[_0x9faf('0x30')],_0x5659d6[_0x9faf('0x32')]),_0x29bf23);if(_0x5ab9e9[_0x9faf('0x30')][_0x9faf('0x3c')]){_0x57b2ff[_0x9faf('0x3b')]=_[_0x9faf('0x3d')](_0x57b2ff['where'],{'$or':_['map'](_0x29bf23,function(_0x101767){if(_0x101767[_0x9faf('0x3e')]!=='VIRTUAL'){var _0xb7c331={};_0xb7c331[_0x101767['name']]={'$like':'%'+_0x5ab9e9['query'][_0x9faf('0x3c')]+'%'};return _0xb7c331;}})});}_0x57b2ff=_[_0x9faf('0x3d')]({},_0x57b2ff,_0x5ab9e9[_0x9faf('0x3f')]);var _0xff84f9={'where':_0x57b2ff[_0x9faf('0x3b')]};return db[_0x9faf('0x2c')]['count'](_0xff84f9)[_0x9faf('0x40')](function(_0x51d194){_0x26a526[_0x9faf('0x21')]=_0x51d194;if(_0x5ab9e9[_0x9faf('0x30')][_0x9faf('0x41')]){_0x57b2ff[_0x9faf('0x42')]=[{'all':!![]}];}return db[_0x9faf('0x2c')][_0x9faf('0x43')](_0x57b2ff);})[_0x9faf('0x40')](function(_0x41171c){_0x26a526[_0x9faf('0x44')]=_0x41171c;return _0x26a526;})[_0x9faf('0x40')](respondWithFilteredResult(_0x23a5ba,_0x57b2ff))['catch'](handleError(_0x23a5ba,null));};exports[_0x9faf('0x45')]=function(_0x423aae,_0x16be5d){var _0x4fd85c={'raw':!![],'where':{'id':_0x423aae[_0x9faf('0x46')]['id']}},_0x2d8509={};_0x2d8509[_0x9faf('0x2f')]=_['keys'](db['ChatInternalMessage'][_0x9faf('0x2d')]);_0x2d8509[_0x9faf('0x30')]=_[_0x9faf('0x31')](_0x423aae[_0x9faf('0x30')]);_0x2d8509[_0x9faf('0x32')]=_['intersection'](_0x2d8509['model'],_0x2d8509['query']);_0x4fd85c['attributes']=_['intersection'](_0x2d8509[_0x9faf('0x2f')],qs[_0x9faf('0x34')](_0x423aae[_0x9faf('0x30')][_0x9faf('0x34')]));_0x4fd85c[_0x9faf('0x35')]=_0x4fd85c[_0x9faf('0x35')][_0x9faf('0x36')]?_0x4fd85c[_0x9faf('0x35')]:_0x2d8509[_0x9faf('0x2f')];if(_0x423aae[_0x9faf('0x30')][_0x9faf('0x41')]){_0x4fd85c[_0x9faf('0x42')]=[{'all':!![]}];}_0x4fd85c=_[_0x9faf('0x3d')]({},_0x4fd85c,_0x423aae[_0x9faf('0x3f')]);return db[_0x9faf('0x2c')][_0x9faf('0x47')](_0x4fd85c)[_0x9faf('0x40')](handleEntityNotFound(_0x16be5d,null))[_0x9faf('0x40')](respondWithResult(_0x16be5d,null))[_0x9faf('0x48')](handleError(_0x16be5d,null));};exports[_0x9faf('0x49')]=function(_0x55b9dd,_0x39e4b8){return db['ChatInternalMessage'][_0x9faf('0x49')](_0x55b9dd[_0x9faf('0x4a')],{})['then'](respondWithResult(_0x39e4b8,0xc9))[_0x9faf('0x48')](handleError(_0x39e4b8,null));};exports[_0x9faf('0x4b')]=function(_0x139e03,_0x35b734){if(_0x139e03['body']['id']){delete _0x139e03['body']['id'];}return db[_0x9faf('0x2c')][_0x9faf('0x47')]({'where':{'id':_0x139e03[_0x9faf('0x46')]['id']}})[_0x9faf('0x40')](handleEntityNotFound(_0x35b734,null))[_0x9faf('0x40')](saveUpdates(_0x139e03[_0x9faf('0x4a')],null))[_0x9faf('0x40')](respondWithResult(_0x35b734,null))[_0x9faf('0x48')](handleError(_0x35b734,null));};exports['destroy']=function(_0x462524,_0xdea6cb){return db['ChatInternalMessage'][_0x9faf('0x47')]({'where':{'id':_0x462524[_0x9faf('0x46')]['id']}})['then'](handleEntityNotFound(_0xdea6cb,null))[_0x9faf('0x40')](removeEntity(_0xdea6cb,null))[_0x9faf('0x48')](handleError(_0xdea6cb,null));};exports[_0x9faf('0x4c')]=function(_0x19410d,_0x277a4c){return db[_0x9faf('0x2c')][_0x9faf('0x4c')]()[_0x9faf('0x40')](respondWithResult(_0x277a4c,null))[_0x9faf('0x48')](handleError(_0x277a4c,null));};function wrapUser(_0x4fc928){return function(_0xa35129){var _0x3eda89=_0x4fc928['get']({'plain':!![]});_0x3eda89[_0x9faf('0x4d')]=[];if(_0xa35129){_0x3eda89[_0x9faf('0x4e')]=_0xa35129['createdAt'];_0x3eda89[_0x9faf('0x4f')]=_0xa35129;}else{_0x3eda89['lastMessageAt']=moment(0x0)['format'](_0x9faf('0x50'));_0x3eda89['lastMessage']={};}return _0x3eda89;};}exports['getUsers']=function(_0x138c43,_0x3418e7,_0x4907f7){var _0x9b6b23=[];return db[_0x9faf('0x51')]['findAll']({'where':{'role':[_0x9faf('0x52'),_0x9faf('0x53'),_0x9faf('0x54')]},'attributes':['id','fullname',_0x9faf('0x29'),_0x9faf('0x55'),_0x9faf('0x56'),_0x9faf('0x57'),_0x9faf('0x58'),_0x9faf('0x59'),_0x9faf('0x5a'),_0x9faf('0x5b')],'order':qs['sort'](_0x9faf('0x5c')),'include':[{'model':db['VoiceQueue'],'as':_0x9faf('0x5d'),'attributes':['id','name',_0x9faf('0x3e')],'through':{'attributes':[]}}]})['then'](function(_0x4bbbb9){if(_0x4bbbb9){var _0x4d8534=_0x138c43[_0x9faf('0x54')][_0x9faf('0x5e')]({'plain':!![]});if(!_0x4d8534)throw new Error(_0x9faf('0x5f'));if(_0x4d8534['role']===_0x9faf('0x54')){return db[_0x9faf('0x60')][_0x9faf('0x47')]({'where':{'name':_0x9faf('0x61'),'userProfileId':_0x4d8534['userProfileId']},'raw':!![]})[_0x9faf('0x40')](function(_0x3010ab){if(_0x3010ab){if(_0x3010ab[_0x9faf('0x62')]===0x0){return db['UserProfileResource'][_0x9faf('0x43')]({'where':{'sectionId':_0x3010ab['id']},'raw':!![]})[_0x9faf('0x40')](function(_0x5f4e44){var _0x1c21e7=[];if(_[_0x9faf('0x63')](_0x5f4e44)){_0x1c21e7=_[_0x9faf('0x3c')](_0x4bbbb9,function(_0x141270){if(_0x141270[_0x9faf('0x55')]!=='agent'){return _0x141270;}});return _0x1c21e7;}else{for(var _0x1dcd14=0x0;_0x1dcd14<_0x4bbbb9[_0x9faf('0x36')];_0x1dcd14++){var _0x2b7395=_0x4bbbb9[_0x1dcd14];if(_0x2b7395[_0x9faf('0x55')]===_0x9faf('0x52')){var _0x231489=_[_0x9faf('0x47')](_0x5f4e44,function(_0x1ebe9e){return _0x1ebe9e[_0x9faf('0x64')]===_0x2b7395['id'];});if(_0x231489)_0x1c21e7['push'](_0x2b7395);}else{_0x1c21e7[_0x9faf('0x65')](_0x2b7395);}}return _0x1c21e7;}});}else{return _0x4bbbb9;}}else{var _0x315120=_['filter'](_0x4bbbb9,function(_0x462daa){if(_0x462daa[_0x9faf('0x55')]!==_0x9faf('0x52')){return _0x462daa;}});return _0x315120;}});}else{return _0x4bbbb9;}}})[_0x9faf('0x40')](function(_0x5bc0bd){var _0x204e4c=[];if(_0x5bc0bd){_0x9b6b23=_0x5bc0bd;for(var _0x5858fe=0x0;_0x5858fe<_0x5bc0bd['length'];_0x5858fe+=0x1){_0x9b6b23[_0x5858fe]['messages']=[];_0x204e4c['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x138c43['user']['id'],_0x5bc0bd[_0x5858fe]['id']],'ToId':[_0x138c43['user']['id'],_0x5bc0bd[_0x5858fe]['id']],'ChatGroupId':null},'attributes':['id',_0x9faf('0x66'),_0x9faf('0x67'),_0x9faf('0x68'),_0x9faf('0x69'),_0x9faf('0x4a')],'order':qs['sort'](_0x9faf('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9faf('0x40')](wrapUser(_0x5bc0bd[_0x5858fe])));}return BPromise[_0x9faf('0x6b')](_0x204e4c);}return[];})[_0x9faf('0x40')](function(_0xcd3140){return{'rows':_0xcd3140,'count':_0xcd3140[_0x9faf('0x36')]};})[_0x9faf('0x40')](respondWithResult(_0x3418e7,null))[_0x9faf('0x48')](handleError(_0x3418e7,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0b03e71..69b1813 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 _0xe893=['save','update','remove','emit','hook','exports','../../mysqldb','ChatInternalMessage'];(function(_0x259983,_0x23f35c){var _0x24f4e1=function(_0x5c8515){while(--_0x5c8515){_0x259983['push'](_0x259983['shift']());}};_0x24f4e1(++_0x23f35c);}(_0xe893,0xbe));var _0x3e89=function(_0x860520,_0x20520a){_0x860520=_0x860520-0x0;var _0x22ce80=_0xe893[_0x860520];return _0x22ce80;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x3e89('0x0'))['db'][_0x3e89('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e89('0x2'),'afterUpdate':_0x3e89('0x3'),'afterDestroy':_0x3e89('0x4')};function emitEvent(_0x2b08f0){return function(_0x2e4719,_0x55e262,_0x3cfcda){ChatInternalMessageEvents[_0x3e89('0x5')](_0x2b08f0+':'+_0x2e4719['id'],_0x2e4719);ChatInternalMessageEvents[_0x3e89('0x5')](_0x2b08f0,_0x2e4719);_0x3cfcda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x3e89('0x6')](e,emitEvent(event));}}module[_0x3e89('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3756=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3c27b2,_0xbe3d97){var _0x334e45=function(_0x39ab5a){while(--_0x39ab5a){_0x3c27b2['push'](_0x3c27b2['shift']());}};_0x334e45(++_0xbe3d97);}(_0x3756,0x116));var _0x6375=function(_0x289f54,_0x265a88){_0x289f54=_0x289f54-0x0;var _0x31c958=_0x3756[_0x289f54];return _0x31c958;};'use strict';var EventEmitter=require(_0x6375('0x0'));var ChatInternalMessage=require(_0x6375('0x1'))['db'][_0x6375('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6375('0x3')](0x0);var events={'afterCreate':_0x6375('0x4'),'afterUpdate':_0x6375('0x5'),'afterDestroy':_0x6375('0x6')};function emitEvent(_0x206284){return function(_0x3f7d9a,_0x46954e,_0x78a00e){ChatInternalMessageEvents[_0x6375('0x7')](_0x206284+':'+_0x3f7d9a['id'],_0x3f7d9a);ChatInternalMessageEvents[_0x6375('0x7')](_0x206284,_0x3f7d9a);_0x78a00e(null);};}for(var e in events){if(events[_0x6375('0x8')](e)){var event=events[e];ChatInternalMessage[_0x6375('0x9')](e,emitEvent(event));}}module[_0x6375('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cc2c127..773ec15 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 _0x757a=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x95c56a,_0x350a11){var _0x19624f=function(_0x2a422f){while(--_0x2a422f){_0x95c56a['push'](_0x95c56a['shift']());}};_0x19624f(++_0x350a11);}(_0x757a,0xde));var _0xa757=function(_0x21bf6f,_0x2560bd){_0x21bf6f=_0x21bf6f-0x0;var _0x1fa172=_0x757a[_0x21bf6f];return _0x1fa172;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatInternalMessage',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa757('0xa'),'collate':_0xa757('0xb')});}; \ No newline at end of file +var _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0xb30581,_0x4581c1){var _0x29cd12=function(_0x1d35fb){while(--_0x1d35fb){_0xb30581['push'](_0xb30581['shift']());}};_0x29cd12(++_0x4581c1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index acf4887..875191c 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 _0xe38b=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f0eca,_0xcff5ee){var _0x195150=function(_0x3bd8c2){while(--_0x3bd8c2){_0x1f0eca['push'](_0x1f0eca['shift']());}};_0x195150(++_0xcff5ee);}(_0xe38b,0x198));var _0xbe38=function(_0x523e29,_0x522d82){_0x523e29=_0x523e29-0x0;var _0x54bfe1=_0xe38b[_0x523e29];return _0x54bfe1;};'use strict';var _=require(_0xbe38('0x0'));var util=require(_0xbe38('0x1'));var moment=require(_0xbe38('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe38('0x3'));var fs=require('fs');var Redis=require(_0xbe38('0x4'));var db=require(_0xbe38('0x5'))['db'];var utils=require(_0xbe38('0x6'));var logger=require(_0xbe38('0x7'))(_0xbe38('0x8'));var config=require(_0xbe38('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe38('0xa')][_0xbe38('0xb')]({'port':0x232a});config[_0xbe38('0xc')]=_[_0xbe38('0xd')](config[_0xbe38('0xc')],{'host':_0xbe38('0xe'),'port':0x18eb});var socket=require(_0xbe38('0xf'))(new Redis(config[_0xbe38('0xc')]));require('./chatInternalMessage.socket')[_0xbe38('0x10')](socket);function respondWithRpcPromise(_0x3336dd,_0xb46f41,_0x462625){return new BPromise(function(_0x5dedfa,_0xf2d6e1){return client[_0xbe38('0x11')](_0x3336dd,_0x462625)['then'](function(_0x4ab7b4){logger[_0xbe38('0x12')](_0xbe38('0x13'),_0xb46f41,_0xbe38('0x14'));logger[_0xbe38('0x15')](_0xbe38('0x16'),_0xb46f41,'request\x20sent',JSON[_0xbe38('0x17')](_0x4ab7b4));if(_0x4ab7b4[_0xbe38('0x18')]){if(_0x4ab7b4[_0xbe38('0x18')][_0xbe38('0x19')]===0x1f4){logger[_0xbe38('0x18')](_0xbe38('0x13'),_0xb46f41,_0x4ab7b4[_0xbe38('0x18')]['message']);return _0xf2d6e1(_0x4ab7b4['error'][_0xbe38('0x1a')]);}logger['error'](_0xbe38('0x13'),_0xb46f41,_0x4ab7b4[_0xbe38('0x18')][_0xbe38('0x1a')]);return _0x5dedfa(_0x4ab7b4[_0xbe38('0x18')][_0xbe38('0x1a')]);}else{logger[_0xbe38('0x12')](_0xbe38('0x13'),_0xb46f41,'request\x20sent');_0x5dedfa(_0x4ab7b4[_0xbe38('0x1b')]['message']);}})[_0xbe38('0x1c')](function(_0x33fb3c){logger[_0xbe38('0x18')](_0xbe38('0x13'),_0xb46f41,_0x33fb3c);_0xf2d6e1(_0x33fb3c);});});} \ No newline at end of file +var _0x63db=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xb10d46,_0x3b1167){var _0x4fcc9d=function(_0xf3f54a){while(--_0xf3f54a){_0xb10d46['push'](_0xb10d46['shift']());}};_0x4fcc9d(++_0x3b1167);}(_0x63db,0x196));var _0xb63d=function(_0x16e7ae,_0x4f5917){_0x16e7ae=_0x16e7ae-0x0;var _0x3413c0=_0x63db[_0x16e7ae];return _0x3413c0;};'use strict';var _=require(_0xb63d('0x0'));var util=require(_0xb63d('0x1'));var moment=require(_0xb63d('0x2'));var BPromise=require(_0xb63d('0x3'));var rs=require(_0xb63d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb63d('0x5'))['db'];var utils=require(_0xb63d('0x6'));var logger=require(_0xb63d('0x7'))(_0xb63d('0x8'));var config=require('../../config/environment');var jayson=require(_0xb63d('0x9'));var client=jayson[_0xb63d('0xa')][_0xb63d('0xb')]({'port':0x232a});config[_0xb63d('0xc')]=_[_0xb63d('0xd')](config[_0xb63d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb63d('0xe'))(new Redis(config[_0xb63d('0xc')]));require(_0xb63d('0xf'))[_0xb63d('0x10')](socket);function respondWithRpcPromise(_0x15a603,_0x487172,_0x1a0bb3){return new BPromise(function(_0x19defc,_0x1e7a4c){return client['request'](_0x15a603,_0x1a0bb3)[_0xb63d('0x11')](function(_0x290f58){logger[_0xb63d('0x12')](_0xb63d('0x13'),_0x487172,_0xb63d('0x14'));logger[_0xb63d('0x15')](_0xb63d('0x16'),_0x487172,'request\x20sent',JSON[_0xb63d('0x17')](_0x290f58));if(_0x290f58[_0xb63d('0x18')]){if(_0x290f58['error']['code']===0x1f4){logger[_0xb63d('0x18')](_0xb63d('0x13'),_0x487172,_0x290f58[_0xb63d('0x18')][_0xb63d('0x19')]);return _0x1e7a4c(_0x290f58['error'][_0xb63d('0x19')]);}logger[_0xb63d('0x18')](_0xb63d('0x13'),_0x487172,_0x290f58[_0xb63d('0x18')][_0xb63d('0x19')]);return _0x19defc(_0x290f58[_0xb63d('0x18')][_0xb63d('0x19')]);}else{logger[_0xb63d('0x12')](_0xb63d('0x13'),_0x487172,_0xb63d('0x14'));_0x19defc(_0x290f58['result'][_0xb63d('0x19')]);}})[_0xb63d('0x1a')](function(_0x295185){logger[_0xb63d('0x18')](_0xb63d('0x13'),_0x487172,_0x295185);_0x1e7a4c(_0x295185);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index dda3399..c3df4fc 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 _0x9491=['./chatInternalMessage.events','save','remove','update','emit','register','chatInternalMessage:'];(function(_0x2d2ad9,_0x56b121){var _0x527bab=function(_0xec64af){while(--_0xec64af){_0x2d2ad9['push'](_0x2d2ad9['shift']());}};_0x527bab(++_0x56b121);}(_0x9491,0xb6));var _0x1949=function(_0x4954f4,_0x3f0a9a){_0x4954f4=_0x4954f4-0x0;var _0x57c162=_0x9491[_0x4954f4];return _0x57c162;};'use strict';var ChatInternalMessageEvents=require(_0x1949('0x0'));var events=[_0x1949('0x1'),_0x1949('0x2'),_0x1949('0x3')];function createListener(_0x46e060,_0x1f05db){return function(_0x28621a){_0x1f05db[_0x1949('0x4')](_0x46e060,_0x28621a);};}function removeListener(_0x4270d7,_0x358907){return function(){ChatInternalMessageEvents['removeListener'](_0x4270d7,_0x358907);};}exports[_0x1949('0x5')]=function(_0x5b01b9){for(var _0x14c30e=0x0,_0x2d39a3=events['length'];_0x14c30e<_0x2d39a3;_0x14c30e++){var _0x28b2b6=events[_0x14c30e];var _0x3665b6=createListener(_0x1949('0x6')+_0x28b2b6,_0x5b01b9);ChatInternalMessageEvents['on'](_0x28b2b6,_0x3665b6);}}; \ No newline at end of file +var _0x1c42=['remove','update','emit','removeListener','register','length','save'];(function(_0x291c1b,_0x5216a6){var _0x2109c9=function(_0x498cbf){while(--_0x498cbf){_0x291c1b['push'](_0x291c1b['shift']());}};_0x2109c9(++_0x5216a6);}(_0x1c42,0x13a));var _0x21c4=function(_0x1f4d42,_0x3a6c33){_0x1f4d42=_0x1f4d42-0x0;var _0x1a29e1=_0x1c42[_0x1f4d42];return _0x1a29e1;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x21c4('0x0'),_0x21c4('0x1'),_0x21c4('0x2')];function createListener(_0x558257,_0x27cb4a){return function(_0x40bc3e){_0x27cb4a[_0x21c4('0x3')](_0x558257,_0x40bc3e);};}function removeListener(_0xd7340,_0x435179){return function(){ChatInternalMessageEvents[_0x21c4('0x4')](_0xd7340,_0x435179);};}exports[_0x21c4('0x5')]=function(_0x8d4312){for(var _0x4fc4da=0x0,_0x247ec9=events[_0x21c4('0x6')];_0x4fc4da<_0x247ec9;_0x4fc4da++){var _0x54b2ea=events[_0x4fc4da];var _0x184e75=createListener('chatInternalMessage:'+_0x54b2ea,_0x8d4312);ChatInternalMessageEvents['on'](_0x54b2ea,_0x184e75);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 84b669a..2e6d1f7 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 _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x3c59d4,_0x4f3e06){var _0x189167=function(_0x2a67bc){while(--_0x2a67bc){_0x3c59d4['push'](_0x3c59d4['shift']());}};_0x189167(++_0x4f3e06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file +var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x56bd22,_0x53c814){var _0x23d1c9=function(_0x1c2fcd){while(--_0x1c2fcd){_0x56bd22['push'](_0x56bd22['shift']());}};_0x23d1c9(++_0x53c814);}(_0x70e0,0x17b));var _0x070e=function(_0x18a9e1,_0x1fe34e){_0x18a9e1=_0x18a9e1-0x0;var _0xe4824f=_0x70e0[_0x18a9e1];return _0xe4824f;};'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 auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 453c3ff..b280e36 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 _0xfb15=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xfb15,0x14a));var _0x5fb1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfb15[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x5fb1('0x0'));module[_0x5fb1('0x1')]={'body':{'type':Sequelize[_0x5fb1('0x2')](_0x5fb1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5fb1('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5fb1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5fb1('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x5fb1('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5fb1('0x2')]}}; \ No newline at end of file +var _0x9452=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x41e87a,_0x354e71){var _0x2ed96=function(_0x22409c){while(--_0x22409c){_0x41e87a['push'](_0x41e87a['shift']());}};_0x2ed96(++_0x354e71);}(_0x9452,0x1df));var _0x2945=function(_0x58b32f,_0x14fccb){_0x58b32f=_0x58b32f-0x0;var _0x5c6e49=_0x9452[_0x58b32f];return _0x5c6e49;};'use strict';var Sequelize=require(_0x2945('0x0'));module[_0x2945('0x1')]={'body':{'type':Sequelize[_0x2945('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2945('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2945('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2945('0x4')]('in','out'),'defaultValue':_0x2945('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2945('0x6')]},'providerName':{'type':Sequelize[_0x2945('0x7')]},'providerResponse':{'type':Sequelize[_0x2945('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index aca69be..8f987a6 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 _0x5f01=['accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','info','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','interaction','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','save','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','where','pick','type','VIRTUAL','filter','merge','options','ChatMessage','count','includeAll','include','findAll','rows','show','find','create','body','update','destroy','params','describe','../../config/logger','chat-interactions'];(function(_0x1f8ec1,_0x33bc41){var _0x21969c=function(_0x5500a8){while(--_0x5500a8){_0x1f8ec1['push'](_0x1f8ec1['shift']());}};_0x21969c(++_0x33bc41);}(_0x5f01,0x9e));var _0x15f0=function(_0x4188a7,_0x5cdebb){_0x4188a7=_0x4188a7-0x0;var _0x50dca0=_0x5f01[_0x4188a7];return _0x50dca0;};'use strict';var pdf=require(_0x15f0('0x0'));var emlformat=require(_0x15f0('0x1'));var rimraf=require(_0x15f0('0x2'));var zipdir=require(_0x15f0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f0('0x4'));var moment=require(_0x15f0('0x5'));var BPromise=require(_0x15f0('0x6'));var Mustache=require(_0x15f0('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x15f0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x15f0('0x9'));var squel=require(_0x15f0('0xa'));var crypto=require('crypto');var jsforce=require(_0x15f0('0xb'));var deskjs=require(_0x15f0('0xc'));var toCsv=require(_0x15f0('0x8'));var querystring=require(_0x15f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x15f0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x15f0('0xf'));var as=require(_0x15f0('0x10'));var hardwareService=require(_0x15f0('0x11'));var logger=require('../../config/logger')(_0x15f0('0x12'));var utils=require(_0x15f0('0x13'));var config=require(_0x15f0('0x14'));var licenseUtil=require(_0x15f0('0x15'));var db=require(_0x15f0('0x16'))['db'];config[_0x15f0('0x17')]=_[_0x15f0('0x18')](config[_0x15f0('0x17')],{'host':_0x15f0('0x19'),'port':0x18eb});var socket=require(_0x15f0('0x1a'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x15f0('0x1b')](socket);var jayson=require(_0x15f0('0x1c'));var client=jayson[_0x15f0('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x15f0('0x1d')][_0x15f0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2ae0b3,_0x35d95d,_0x56b539,_0x12661f){return new BPromise(function(_0x34fd48,_0x15c4a2){var _0x9cbe06=_0x12661f||client;return _0x9cbe06[_0x15f0('0x1f')](_0x2ae0b3,_0x56b539)[_0x15f0('0x20')](function(_0x572778){logger['info'](_0x15f0('0x21'),_0x35d95d,_0x15f0('0x22'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x35d95d,_0x15f0('0x22'),JSON[_0x15f0('0x23')](_0x572778));if(_0x572778[_0x15f0('0x24')]){if(_0x572778[_0x15f0('0x24')][_0x15f0('0x25')]===0x1f4){logger['error'](_0x15f0('0x21'),_0x35d95d,_0x572778[_0x15f0('0x24')][_0x15f0('0x26')]);return _0x15c4a2(_0x572778[_0x15f0('0x24')][_0x15f0('0x26')]);}logger[_0x15f0('0x24')](_0x15f0('0x21'),_0x35d95d,_0x572778[_0x15f0('0x24')][_0x15f0('0x26')]);return _0x34fd48(_0x572778[_0x15f0('0x24')][_0x15f0('0x26')]);}else{logger['info'](_0x15f0('0x21'),_0x35d95d,_0x15f0('0x22'));_0x34fd48(_0x572778['result'][_0x15f0('0x26')]);}})[_0x15f0('0x27')](function(_0x183ba0){logger[_0x15f0('0x24')](_0x15f0('0x21'),_0x35d95d,_0x183ba0);_0x15c4a2(_0x183ba0);});});}function respondWithStatusCode(_0x250c42,_0x59cb05){_0x59cb05=_0x59cb05||0xcc;return function(_0x4fae45){if(_0x4fae45){return _0x250c42[_0x15f0('0x28')](_0x59cb05);}return _0x250c42['status'](_0x59cb05)[_0x15f0('0x29')]();};}function respondWithResult(_0xcf8d78,_0x1bc38a){_0x1bc38a=_0x1bc38a||0xc8;return function(_0x35c4b2){if(_0x35c4b2){return _0xcf8d78[_0x15f0('0x2a')](_0x1bc38a)[_0x15f0('0x2b')](_0x35c4b2);}};}function respondWithFilteredResult(_0x19ac04,_0x24b593){return function(_0x31a8d9){if(_0x31a8d9){var _0x5c6e8c=_0x31a8d9['count'],_0x2649c2=_0x24b593[_0x15f0('0x2c')],_0x5cb8a6=_0x24b593['offset']+_0x24b593['limit'],_0x303948;if(_0x5cb8a6>=_0x5c6e8c){_0x5cb8a6=_0x5c6e8c;_0x303948=0xc8;}else{_0x303948=0xce;}_0x19ac04[_0x15f0('0x2a')](_0x303948);return _0x19ac04[_0x15f0('0x2d')](_0x15f0('0x2e'),_0x2649c2+'-'+_0x5cb8a6+'/'+_0x5c6e8c)[_0x15f0('0x2b')](_0x31a8d9);}return null;};}function patchUpdates(_0x37ae3a){return function(_0x104aa6){try{jsonpatch[_0x15f0('0x2f')](_0x104aa6,_0x37ae3a,!![]);}catch(_0x11e83f){return BPromise['reject'](_0x11e83f);}return _0x104aa6[_0x15f0('0x30')]();};}function saveUpdates(_0x1c88b5,_0x1483fa){return function(_0x324560){if(_0x324560){return _0x324560['update'](_0x1c88b5)['then'](function(_0x5c2695){return _0x5c2695;});}return null;};}function removeEntity(_0x1a5ca6,_0x38fe76){return function(_0xf440a9){if(_0xf440a9){return _0xf440a9['destroy']()[_0x15f0('0x20')](function(){_0x1a5ca6['status'](0xcc)[_0x15f0('0x29')]();});}};}function handleEntityNotFound(_0xdd499f,_0x3f6484){return function(_0x59389a){if(!_0x59389a){_0xdd499f[_0x15f0('0x28')](0x194);}return _0x59389a;};}function handleError(_0xd295a4,_0x50f28e){_0x50f28e=_0x50f28e||0x1f4;return function(_0x45924c){logger[_0x15f0('0x24')](_0x45924c['stack']);if(_0x45924c[_0x15f0('0x31')]){delete _0x45924c[_0x15f0('0x31')];}_0xd295a4['status'](_0x50f28e)[_0x15f0('0x32')](_0x45924c);};}exports[_0x15f0('0x33')]=function(_0x15b411,_0x2e7ce3){var _0x17d676={},_0x3bd916={},_0x34dcbd={'count':0x0,'rows':[]};var _0xa80b56=_[_0x15f0('0x34')](db['ChatMessage'][_0x15f0('0x35')],function(_0x425128){return{'name':_0x425128[_0x15f0('0x36')],'type':_0x425128['type'][_0x15f0('0x37')]};});_0x3bd916['model']=_[_0x15f0('0x34')](_0xa80b56,_0x15f0('0x31'));_0x3bd916[_0x15f0('0x38')]=_[_0x15f0('0x39')](_0x15b411[_0x15f0('0x38')]);_0x3bd916[_0x15f0('0x3a')]=_[_0x15f0('0x3b')](_0x3bd916['model'],_0x3bd916[_0x15f0('0x38')]);_0x17d676[_0x15f0('0x3c')]=_[_0x15f0('0x3b')](_0x3bd916[_0x15f0('0x3d')],qs[_0x15f0('0x3e')](_0x15b411[_0x15f0('0x38')]['fields']));_0x17d676['attributes']=_0x17d676['attributes'][_0x15f0('0x3f')]?_0x17d676[_0x15f0('0x3c')]:_0x3bd916[_0x15f0('0x3d')];if(!_0x15b411[_0x15f0('0x38')]['hasOwnProperty'](_0x15f0('0x40'))){_0x17d676['limit']=qs[_0x15f0('0x41')](_0x15b411[_0x15f0('0x38')][_0x15f0('0x41')]);_0x17d676['offset']=qs[_0x15f0('0x2c')](_0x15b411[_0x15f0('0x38')][_0x15f0('0x2c')]);}_0x17d676['order']=qs[_0x15f0('0x42')](_0x15b411[_0x15f0('0x38')][_0x15f0('0x42')]);_0x17d676[_0x15f0('0x43')]=qs[_0x15f0('0x3a')](_[_0x15f0('0x44')](_0x15b411[_0x15f0('0x38')],_0x3bd916[_0x15f0('0x3a')]),_0xa80b56);if(_0x15b411[_0x15f0('0x38')]['filter']){_0x17d676[_0x15f0('0x43')]=_['merge'](_0x17d676[_0x15f0('0x43')],{'$or':_[_0x15f0('0x34')](_0xa80b56,function(_0x1f0082){if(_0x1f0082[_0x15f0('0x45')]!==_0x15f0('0x46')){var _0x315136={};_0x315136[_0x1f0082[_0x15f0('0x31')]]={'$like':'%'+_0x15b411[_0x15f0('0x38')][_0x15f0('0x47')]+'%'};return _0x315136;}})});}_0x17d676=_[_0x15f0('0x48')]({},_0x17d676,_0x15b411[_0x15f0('0x49')]);var _0x389d2b={'where':_0x17d676[_0x15f0('0x43')]};return db[_0x15f0('0x4a')]['count'](_0x389d2b)[_0x15f0('0x20')](function(_0x2a4a2a){_0x34dcbd[_0x15f0('0x4b')]=_0x2a4a2a;if(_0x15b411[_0x15f0('0x38')][_0x15f0('0x4c')]){_0x17d676[_0x15f0('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0x15f0('0x4e')](_0x17d676);})['then'](function(_0xd7f6ae){_0x34dcbd[_0x15f0('0x4f')]=_0xd7f6ae;return _0x34dcbd;})[_0x15f0('0x20')](respondWithFilteredResult(_0x2e7ce3,_0x17d676))[_0x15f0('0x27')](handleError(_0x2e7ce3,null));};exports[_0x15f0('0x50')]=function(_0x449f31,_0xde9482){var _0x2a49a7={'raw':!![],'where':{'id':_0x449f31['params']['id']}},_0x7dfe90={};_0x7dfe90[_0x15f0('0x3d')]=_[_0x15f0('0x39')](db[_0x15f0('0x4a')]['rawAttributes']);_0x7dfe90[_0x15f0('0x38')]=_['keys'](_0x449f31['query']);_0x7dfe90[_0x15f0('0x3a')]=_['intersection'](_0x7dfe90[_0x15f0('0x3d')],_0x7dfe90[_0x15f0('0x38')]);_0x2a49a7[_0x15f0('0x3c')]=_[_0x15f0('0x3b')](_0x7dfe90[_0x15f0('0x3d')],qs[_0x15f0('0x3e')](_0x449f31['query'][_0x15f0('0x3e')]));_0x2a49a7[_0x15f0('0x3c')]=_0x2a49a7[_0x15f0('0x3c')][_0x15f0('0x3f')]?_0x2a49a7[_0x15f0('0x3c')]:_0x7dfe90[_0x15f0('0x3d')];if(_0x449f31[_0x15f0('0x38')]['includeAll']){_0x2a49a7['include']=[{'all':!![]}];}_0x2a49a7=_[_0x15f0('0x48')]({},_0x2a49a7,_0x449f31[_0x15f0('0x49')]);return db['ChatMessage'][_0x15f0('0x51')](_0x2a49a7)['then'](handleEntityNotFound(_0xde9482,null))[_0x15f0('0x20')](respondWithResult(_0xde9482,null))[_0x15f0('0x27')](handleError(_0xde9482,null));};exports['create']=function(_0x4af859,_0x75b4bb){return db[_0x15f0('0x4a')][_0x15f0('0x52')](_0x4af859[_0x15f0('0x53')],{})[_0x15f0('0x20')](respondWithResult(_0x75b4bb,0xc9))[_0x15f0('0x27')](handleError(_0x75b4bb,null));};exports[_0x15f0('0x54')]=function(_0x573854,_0x471cbf){if(_0x573854[_0x15f0('0x53')]['id']){delete _0x573854[_0x15f0('0x53')]['id'];}return db[_0x15f0('0x4a')][_0x15f0('0x51')]({'where':{'id':_0x573854['params']['id']}})[_0x15f0('0x20')](handleEntityNotFound(_0x471cbf,null))[_0x15f0('0x20')](saveUpdates(_0x573854[_0x15f0('0x53')],null))[_0x15f0('0x20')](respondWithResult(_0x471cbf,null))[_0x15f0('0x27')](handleError(_0x471cbf,null));};exports[_0x15f0('0x55')]=function(_0x1dbce5,_0x43c4ea){return db['ChatMessage']['find']({'where':{'id':_0x1dbce5[_0x15f0('0x56')]['id']}})[_0x15f0('0x20')](handleEntityNotFound(_0x43c4ea,null))[_0x15f0('0x20')](removeEntity(_0x43c4ea,null))['catch'](handleError(_0x43c4ea,null));};exports[_0x15f0('0x57')]=function(_0x36a773,_0x237caf){return db['ChatMessage'][_0x15f0('0x57')]()[_0x15f0('0x20')](respondWithResult(_0x237caf,null))[_0x15f0('0x27')](handleError(_0x237caf,null));};var interaction_log=require(_0x15f0('0x58'))(_0x15f0('0x59'));exports[_0x15f0('0x5a')]=function(_0x4de4ed,_0x3d05a8,_0x37f024){var _0x1119e1={'agent':{},'channel':_0x15f0('0x5b')};if(_0x4de4ed['body']['id']){delete _0x4de4ed[_0x15f0('0x53')]['id'];}_0x4de4ed[_0x15f0('0x53')][_0x15f0('0x5c')]=!![];_0x4de4ed[_0x15f0('0x53')][_0x15f0('0x5d')]=moment()[_0x15f0('0x5e')](_0x15f0('0x5f'));_0x4de4ed[_0x15f0('0x53')][_0x15f0('0x60')]=_0x4de4ed[_0x15f0('0x53')][_0x15f0('0x60')]||_0x4de4ed[_0x15f0('0x61')]['id'];_0x1119e1[_0x15f0('0x62')]['id']=_0x4de4ed[_0x15f0('0x53')][_0x15f0('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x4de4ed[_0x15f0('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x15f0('0x63')],'as':_0x15f0('0x64')}]})[_0x15f0('0x20')](handleEntityNotFound(_0x3d05a8,null))[_0x15f0('0x20')](saveUpdates(_0x4de4ed[_0x15f0('0x53')],null))[_0x15f0('0x20')](function(_0x546c41){if(_0x546c41){_0x1119e1['message']=_0x546c41[_0x15f0('0x65')]({'plain':!![]});return db[_0x15f0('0x66')][_0x15f0('0x51')]({'where':{'id':_0x546c41[_0x15f0('0x67')]}});}return null;})[_0x15f0('0x20')](handleEntityNotFound(_0x3d05a8,null))['then'](function(_0x16ad9b){if(_0x16ad9b){return _0x16ad9b['update']({'UserId':_0x4de4ed['body'][_0x15f0('0x60')],'read1stAt':_[_0x15f0('0x68')](_0x16ad9b[_0x15f0('0x69')])?moment()[_0x15f0('0x5e')](_0x15f0('0x5f')):undefined});}return null;})['then'](function(_0x3da954){if(_0x3da954){_0x1119e1['interaction']=_0x3da954[_0x15f0('0x65')]({'plain':!![]});interaction_log[_0x15f0('0x6a')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4de4ed['user']['id'],_0x4de4ed[_0x15f0('0x61')]['name'],_0x4de4ed[_0x15f0('0x61')]['role'],_0x1119e1['interaction']['id'],_0x4de4ed[_0x15f0('0x53')]?JSON[_0x15f0('0x23')](_0x4de4ed[_0x15f0('0x53')]):_0x15f0('0x6b'));return respondWithRpcPromise(_0x15f0('0x6c'),_0x15f0('0x6d'),_0x1119e1);}return null;})[_0x15f0('0x20')](function(_0x766f9a){if(_0x766f9a){if(_0x4de4ed['body'][_0x15f0('0x6e')]){_0x1119e1[_0x15f0('0x26')][_0x15f0('0x6f')]=util[_0x15f0('0x5e')](_0x15f0('0x70'),_0x4de4ed['user'][_0x15f0('0x31')]);_0x1119e1['message'][_0x15f0('0x71')]=_0x1119e1['channel'];_0x1119e1[_0x15f0('0x26')][_0x15f0('0x72')]=_0x15f0('0x5a');return respondWithRpcPromise(_0x15f0('0x73'),_0x15f0('0x73'),{'event':_0x15f0('0x74'),'message':_['merge'](_0x1119e1[_0x15f0('0x26')],JSON[_0x15f0('0x75')](_0x1119e1[_0x15f0('0x76')][_0x15f0('0x77')]))},client9002)['then'](function(){return _0x1119e1;});}return _0x1119e1;}return null;})[_0x15f0('0x20')](respondWithResult(_0x3d05a8,null))[_0x15f0('0x27')](handleError(_0x3d05a8,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x15f0('0x78')]=function(_0x4f88f8,_0x2b58ae,_0x5e8c80){var _0xf7258={'agent':{},'channel':_0x15f0('0x5b')};if(_0x4f88f8[_0x15f0('0x53')]['id']){delete _0x4f88f8['body']['id'];}_0x4f88f8[_0x15f0('0x53')][_0x15f0('0x60')]=_0x4f88f8['body'][_0x15f0('0x60')]||_0x4f88f8['user']['id'];_0xf7258[_0x15f0('0x62')]['id']=_0x4f88f8[_0x15f0('0x53')]['UserId'];return db[_0x15f0('0x4a')][_0x15f0('0x51')]({'where':{'id':_0x4f88f8[_0x15f0('0x56')]['id'],'UserId':null}})[_0x15f0('0x20')](handleEntityNotFound(_0x2b58ae,null))[_0x15f0('0x20')](function(_0x9e1548){if(_0x9e1548){_0xf7258[_0x15f0('0x26')]=_0x9e1548[_0x15f0('0x65')]({'plain':!![]});return db[_0x15f0('0x66')][_0x15f0('0x51')]({'where':{'id':_0x9e1548[_0x15f0('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2b58ae,null))[_0x15f0('0x20')](function(_0x3d8d5c){if(_0x3d8d5c){_0xf7258['interaction']=_0x3d8d5c[_0x15f0('0x65')]({'plain':!![]});interaction_log['info'](_0x15f0('0x79'),_0x4f88f8[_0x15f0('0x61')]['id'],_0x4f88f8['user'][_0x15f0('0x31')],_0x4f88f8[_0x15f0('0x61')]['role'],_0xf7258['interaction']['id'],_0x4f88f8[_0x15f0('0x53')]?JSON['stringify'](_0x4f88f8[_0x15f0('0x53')]):'null');return respondWithRpcPromise(_0x15f0('0x7a'),'rejectMessage',_0xf7258);}return null;})['then'](function(_0x22625c){if(_0x22625c){_0x22625c[_0x15f0('0x26')]['interface']=util['format'](_0x15f0('0x70'),_0x4f88f8['user']['name']);_0x22625c[_0x15f0('0x26')][_0x15f0('0x71')]=_0xf7258[_0x15f0('0x71')];_0x22625c['message'][_0x15f0('0x72')]=_0x15f0('0x78');respondWithRpcPromise(_0x15f0('0x73'),_0x15f0('0x73'),{'event':_0x15f0('0x7b'),'message':_0x22625c[_0x15f0('0x26')]},client9002);return _0xf7258;}return null;})['then'](respondWithResult(_0x2b58ae,null))[_0x15f0('0x27')](handleError(_0x2b58ae,null));}; \ No newline at end of file +var _0x663a=['options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','params','describe','../../config/logger','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','moment','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x663a,0x119));var _0xa663=function(_0x298b58,_0x3691f3){_0x298b58=_0x298b58-0x0;var _0x306106=_0x663a[_0x298b58];return _0x306106;};'use strict';var pdf=require(_0xa663('0x0'));var emlformat=require(_0xa663('0x1'));var rimraf=require(_0xa663('0x2'));var zipdir=require(_0xa663('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa663('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa663('0x5'));var csv=require('to-csv');var ejs=require(_0xa663('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa663('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xa663('0x8'));var toCsv=require(_0xa663('0x9'));var querystring=require(_0xa663('0xa'));var Papa=require(_0xa663('0xb'));var Redis=require(_0xa663('0xc'));var authService=require(_0xa663('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa663('0xe'));var hardwareService=require(_0xa663('0xf'));var logger=require('../../config/logger')(_0xa663('0x10'));var utils=require(_0xa663('0x11'));var config=require(_0xa663('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa663('0x13'))['db'];config['redis']=_[_0xa663('0x14')](config[_0xa663('0x15')],{'host':_0xa663('0x16'),'port':0x18eb});var socket=require(_0xa663('0x17'))(new Redis(config[_0xa663('0x15')]));require(_0xa663('0x18'))['register'](socket);var jayson=require(_0xa663('0x19'));var client=jayson[_0xa663('0x1a')][_0xa663('0x1b')]({'port':0x232c});var client9002=jayson[_0xa663('0x1a')][_0xa663('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x532c12,_0x8e45d7,_0x32fac7,_0x16b531){return new BPromise(function(_0x25d390,_0x549201){var _0x14e7e2=_0x16b531||client;return _0x14e7e2[_0xa663('0x1c')](_0x532c12,_0x32fac7)['then'](function(_0x2efeb9){logger[_0xa663('0x1d')](_0xa663('0x1e'),_0x8e45d7,_0xa663('0x1f'));logger[_0xa663('0x20')](_0xa663('0x21'),_0x8e45d7,'request\x20sent',JSON[_0xa663('0x22')](_0x2efeb9));if(_0x2efeb9[_0xa663('0x23')]){if(_0x2efeb9[_0xa663('0x23')]['code']===0x1f4){logger[_0xa663('0x23')]('ChatMessage,\x20%s,\x20%s',_0x8e45d7,_0x2efeb9[_0xa663('0x23')][_0xa663('0x24')]);return _0x549201(_0x2efeb9[_0xa663('0x23')][_0xa663('0x24')]);}logger[_0xa663('0x23')]('ChatMessage,\x20%s,\x20%s',_0x8e45d7,_0x2efeb9['error'][_0xa663('0x24')]);return _0x25d390(_0x2efeb9['error'][_0xa663('0x24')]);}else{logger['info'](_0xa663('0x1e'),_0x8e45d7,_0xa663('0x1f'));_0x25d390(_0x2efeb9['result'][_0xa663('0x24')]);}})['catch'](function(_0x5528c9){logger[_0xa663('0x23')](_0xa663('0x1e'),_0x8e45d7,_0x5528c9);_0x549201(_0x5528c9);});});}function respondWithStatusCode(_0x26ba4e,_0x33a31c){_0x33a31c=_0x33a31c||0xcc;return function(_0xc62f7b){if(_0xc62f7b){return _0x26ba4e[_0xa663('0x25')](_0x33a31c);}return _0x26ba4e[_0xa663('0x26')](_0x33a31c)[_0xa663('0x27')]();};}function respondWithResult(_0x3136d7,_0x5a7c6d){_0x5a7c6d=_0x5a7c6d||0xc8;return function(_0x2d66b8){if(_0x2d66b8){return _0x3136d7[_0xa663('0x26')](_0x5a7c6d)[_0xa663('0x28')](_0x2d66b8);}};}function respondWithFilteredResult(_0x1807e5,_0x16fc80){return function(_0x4c69ba){if(_0x4c69ba){var _0x500ab2=_0x4c69ba[_0xa663('0x29')],_0x294791=_0x16fc80[_0xa663('0x2a')],_0x26095b=_0x16fc80[_0xa663('0x2a')]+_0x16fc80[_0xa663('0x2b')],_0x18179c;if(_0x26095b>=_0x500ab2){_0x26095b=_0x500ab2;_0x18179c=0xc8;}else{_0x18179c=0xce;}_0x1807e5[_0xa663('0x26')](_0x18179c);return _0x1807e5[_0xa663('0x2c')]('Content-Range',_0x294791+'-'+_0x26095b+'/'+_0x500ab2)[_0xa663('0x28')](_0x4c69ba);}return null;};}function patchUpdates(_0x11b5c8){return function(_0x23163d){try{jsonpatch['apply'](_0x23163d,_0x11b5c8,!![]);}catch(_0x300b1f){return BPromise[_0xa663('0x2d')](_0x300b1f);}return _0x23163d['save']();};}function saveUpdates(_0x37bcd1,_0x114abc){return function(_0x3d3c6c){if(_0x3d3c6c){return _0x3d3c6c[_0xa663('0x2e')](_0x37bcd1)[_0xa663('0x2f')](function(_0x4cfc4d){return _0x4cfc4d;});}return null;};}function removeEntity(_0x1ec9df,_0xaf23ea){return function(_0x263c06){if(_0x263c06){return _0x263c06[_0xa663('0x30')]()[_0xa663('0x2f')](function(){_0x1ec9df['status'](0xcc)[_0xa663('0x27')]();});}};}function handleEntityNotFound(_0x4f2477,_0x3f2615){return function(_0x9d7145){if(!_0x9d7145){_0x4f2477['sendStatus'](0x194);}return _0x9d7145;};}function handleError(_0x1e4eb0,_0x1ee393){_0x1ee393=_0x1ee393||0x1f4;return function(_0x548bf4){logger[_0xa663('0x23')](_0x548bf4[_0xa663('0x31')]);if(_0x548bf4['name']){delete _0x548bf4[_0xa663('0x32')];}_0x1e4eb0[_0xa663('0x26')](_0x1ee393)['send'](_0x548bf4);};}exports[_0xa663('0x33')]=function(_0x42fffe,_0x36d509){var _0x5f0cd9={},_0x510666={},_0x3c483a={'count':0x0,'rows':[]};var _0x153052=_[_0xa663('0x34')](db[_0xa663('0x35')][_0xa663('0x36')],function(_0x430a38){return{'name':_0x430a38[_0xa663('0x37')],'type':_0x430a38[_0xa663('0x38')]['key']};});_0x510666['model']=_['map'](_0x153052,_0xa663('0x32'));_0x510666[_0xa663('0x39')]=_[_0xa663('0x3a')](_0x42fffe['query']);_0x510666['filters']=_['intersection'](_0x510666[_0xa663('0x3b')],_0x510666[_0xa663('0x39')]);_0x5f0cd9[_0xa663('0x3c')]=_['intersection'](_0x510666[_0xa663('0x3b')],qs['fields'](_0x42fffe[_0xa663('0x39')][_0xa663('0x3d')]));_0x5f0cd9[_0xa663('0x3c')]=_0x5f0cd9[_0xa663('0x3c')][_0xa663('0x3e')]?_0x5f0cd9[_0xa663('0x3c')]:_0x510666['model'];if(!_0x42fffe[_0xa663('0x39')][_0xa663('0x3f')](_0xa663('0x40'))){_0x5f0cd9[_0xa663('0x2b')]=qs[_0xa663('0x2b')](_0x42fffe[_0xa663('0x39')][_0xa663('0x2b')]);_0x5f0cd9['offset']=qs[_0xa663('0x2a')](_0x42fffe[_0xa663('0x39')][_0xa663('0x2a')]);}_0x5f0cd9[_0xa663('0x41')]=qs['sort'](_0x42fffe[_0xa663('0x39')][_0xa663('0x42')]);_0x5f0cd9['where']=qs[_0xa663('0x43')](_[_0xa663('0x44')](_0x42fffe[_0xa663('0x39')],_0x510666[_0xa663('0x43')]),_0x153052);if(_0x42fffe['query'][_0xa663('0x45')]){_0x5f0cd9['where']=_[_0xa663('0x46')](_0x5f0cd9[_0xa663('0x47')],{'$or':_['map'](_0x153052,function(_0x56b423){if(_0x56b423[_0xa663('0x38')]!==_0xa663('0x48')){var _0x136c77={};_0x136c77[_0x56b423[_0xa663('0x32')]]={'$like':'%'+_0x42fffe[_0xa663('0x39')][_0xa663('0x45')]+'%'};return _0x136c77;}})});}_0x5f0cd9=_['merge']({},_0x5f0cd9,_0x42fffe[_0xa663('0x49')]);var _0x46050a={'where':_0x5f0cd9[_0xa663('0x47')]};return db[_0xa663('0x35')][_0xa663('0x29')](_0x46050a)[_0xa663('0x2f')](function(_0x378404){_0x3c483a[_0xa663('0x29')]=_0x378404;if(_0x42fffe[_0xa663('0x39')][_0xa663('0x4a')]){_0x5f0cd9[_0xa663('0x4b')]=[{'all':!![]}];}return db['ChatMessage'][_0xa663('0x4c')](_0x5f0cd9);})[_0xa663('0x2f')](function(_0x39594a){_0x3c483a[_0xa663('0x4d')]=_0x39594a;return _0x3c483a;})[_0xa663('0x2f')](respondWithFilteredResult(_0x36d509,_0x5f0cd9))['catch'](handleError(_0x36d509,null));};exports[_0xa663('0x4e')]=function(_0x25b5d0,_0x382b62){var _0x34fa3a={'raw':!![],'where':{'id':_0x25b5d0['params']['id']}},_0x284165={};_0x284165['model']=_['keys'](db['ChatMessage']['rawAttributes']);_0x284165[_0xa663('0x39')]=_[_0xa663('0x3a')](_0x25b5d0[_0xa663('0x39')]);_0x284165[_0xa663('0x43')]=_['intersection'](_0x284165['model'],_0x284165[_0xa663('0x39')]);_0x34fa3a[_0xa663('0x3c')]=_[_0xa663('0x4f')](_0x284165[_0xa663('0x3b')],qs[_0xa663('0x3d')](_0x25b5d0[_0xa663('0x39')][_0xa663('0x3d')]));_0x34fa3a[_0xa663('0x3c')]=_0x34fa3a[_0xa663('0x3c')][_0xa663('0x3e')]?_0x34fa3a[_0xa663('0x3c')]:_0x284165[_0xa663('0x3b')];if(_0x25b5d0[_0xa663('0x39')][_0xa663('0x4a')]){_0x34fa3a['include']=[{'all':!![]}];}_0x34fa3a=_[_0xa663('0x46')]({},_0x34fa3a,_0x25b5d0[_0xa663('0x49')]);return db[_0xa663('0x35')][_0xa663('0x50')](_0x34fa3a)['then'](handleEntityNotFound(_0x382b62,null))[_0xa663('0x2f')](respondWithResult(_0x382b62,null))[_0xa663('0x51')](handleError(_0x382b62,null));};exports[_0xa663('0x52')]=function(_0x582c9d,_0x117430){return db['ChatMessage']['create'](_0x582c9d['body'],{})[_0xa663('0x2f')](respondWithResult(_0x117430,0xc9))['catch'](handleError(_0x117430,null));};exports[_0xa663('0x2e')]=function(_0x27ed0e,_0x2a8b91){if(_0x27ed0e[_0xa663('0x53')]['id']){delete _0x27ed0e[_0xa663('0x53')]['id'];}return db[_0xa663('0x35')][_0xa663('0x50')]({'where':{'id':_0x27ed0e[_0xa663('0x54')]['id']}})[_0xa663('0x2f')](handleEntityNotFound(_0x2a8b91,null))[_0xa663('0x2f')](saveUpdates(_0x27ed0e[_0xa663('0x53')],null))[_0xa663('0x2f')](respondWithResult(_0x2a8b91,null))[_0xa663('0x51')](handleError(_0x2a8b91,null));};exports['destroy']=function(_0x1c0de8,_0xa98985){return db['ChatMessage']['find']({'where':{'id':_0x1c0de8[_0xa663('0x54')]['id']}})[_0xa663('0x2f')](handleEntityNotFound(_0xa98985,null))['then'](removeEntity(_0xa98985,null))[_0xa663('0x51')](handleError(_0xa98985,null));};exports['describe']=function(_0x4670e6,_0x41aff3){return db[_0xa663('0x35')][_0xa663('0x55')]()[_0xa663('0x2f')](respondWithResult(_0x41aff3,null))[_0xa663('0x51')](handleError(_0x41aff3,null));};var interaction_log=require(_0xa663('0x56'))('chat-interactions');exports[_0xa663('0x57')]=function(_0x30caa5,_0x41edf7,_0x365617){var _0xd81742={'agent':{},'channel':_0xa663('0x58')};if(_0x30caa5[_0xa663('0x53')]['id']){delete _0x30caa5[_0xa663('0x53')]['id'];}_0x30caa5[_0xa663('0x53')][_0xa663('0x59')]=!![];_0x30caa5[_0xa663('0x53')][_0xa663('0x5a')]=moment()[_0xa663('0x5b')](_0xa663('0x5c'));_0x30caa5[_0xa663('0x53')][_0xa663('0x5d')]=_0x30caa5[_0xa663('0x53')][_0xa663('0x5d')]||_0x30caa5[_0xa663('0x5e')]['id'];_0xd81742[_0xa663('0x5f')]['id']=_0x30caa5[_0xa663('0x53')][_0xa663('0x5d')];return db[_0xa663('0x35')]['find']({'where':{'id':_0x30caa5[_0xa663('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xa663('0x60')}]})[_0xa663('0x2f')](handleEntityNotFound(_0x41edf7,null))[_0xa663('0x2f')](saveUpdates(_0x30caa5[_0xa663('0x53')],null))['then'](function(_0x2d7311){if(_0x2d7311){_0xd81742[_0xa663('0x24')]=_0x2d7311[_0xa663('0x61')]({'plain':!![]});return db[_0xa663('0x62')]['find']({'where':{'id':_0x2d7311[_0xa663('0x63')]}});}return null;})[_0xa663('0x2f')](handleEntityNotFound(_0x41edf7,null))[_0xa663('0x2f')](function(_0x4d7d52){if(_0x4d7d52){return _0x4d7d52[_0xa663('0x2e')]({'UserId':_0x30caa5['body'][_0xa663('0x5d')],'read1stAt':_[_0xa663('0x64')](_0x4d7d52[_0xa663('0x65')])?moment()[_0xa663('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa663('0x2f')](function(_0x52a8f0){if(_0x52a8f0){_0xd81742['interaction']=_0x52a8f0[_0xa663('0x61')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30caa5[_0xa663('0x5e')]['id'],_0x30caa5['user'][_0xa663('0x32')],_0x30caa5['user'][_0xa663('0x66')],_0xd81742[_0xa663('0x67')]['id'],_0x30caa5[_0xa663('0x53')]?JSON['stringify'](_0x30caa5[_0xa663('0x53')]):_0xa663('0x68'));return respondWithRpcPromise(_0xa663('0x69'),'acceptMessage',_0xd81742);}return null;})[_0xa663('0x2f')](function(_0xde8504){if(_0xde8504){if(_0x30caa5[_0xa663('0x53')][_0xa663('0x6a')]){_0xd81742[_0xa663('0x24')][_0xa663('0x6b')]=util[_0xa663('0x5b')](_0xa663('0x6c'),_0x30caa5['user']['name']);_0xd81742[_0xa663('0x24')][_0xa663('0x6d')]=_0xd81742['channel'];_0xd81742[_0xa663('0x24')][_0xa663('0x6e')]='accept';return respondWithRpcPromise(_0xa663('0x6f'),_0xa663('0x6f'),{'event':'acceptmessage','message':_['merge'](_0xd81742['message'],JSON[_0xa663('0x70')](_0xd81742[_0xa663('0x67')][_0xa663('0x71')]))},client9002)[_0xa663('0x2f')](function(){return _0xd81742;});}return _0xd81742;}return null;})['then'](respondWithResult(_0x41edf7,null))['catch'](handleError(_0x41edf7,null));};var interaction_log=require('../../config/logger')(_0xa663('0x72'));exports[_0xa663('0x2d')]=function(_0x2d1334,_0x8901f8,_0x2221cb){var _0x4286e3={'agent':{},'channel':'chat'};if(_0x2d1334['body']['id']){delete _0x2d1334[_0xa663('0x53')]['id'];}_0x2d1334[_0xa663('0x53')][_0xa663('0x5d')]=_0x2d1334['body'][_0xa663('0x5d')]||_0x2d1334[_0xa663('0x5e')]['id'];_0x4286e3[_0xa663('0x5f')]['id']=_0x2d1334[_0xa663('0x53')]['UserId'];return db[_0xa663('0x35')]['find']({'where':{'id':_0x2d1334[_0xa663('0x54')]['id'],'UserId':null}})[_0xa663('0x2f')](handleEntityNotFound(_0x8901f8,null))['then'](function(_0x2a114b){if(_0x2a114b){_0x4286e3[_0xa663('0x24')]=_0x2a114b['get']({'plain':!![]});return db[_0xa663('0x62')]['find']({'where':{'id':_0x2a114b[_0xa663('0x63')]}});}return null;})[_0xa663('0x2f')](handleEntityNotFound(_0x8901f8,null))[_0xa663('0x2f')](function(_0x3e8aab){if(_0x3e8aab){_0x4286e3[_0xa663('0x67')]=_0x3e8aab[_0xa663('0x61')]({'plain':!![]});interaction_log['info'](_0xa663('0x73'),_0x2d1334[_0xa663('0x5e')]['id'],_0x2d1334[_0xa663('0x5e')][_0xa663('0x32')],_0x2d1334[_0xa663('0x5e')][_0xa663('0x66')],_0x4286e3[_0xa663('0x67')]['id'],_0x2d1334[_0xa663('0x53')]?JSON['stringify'](_0x2d1334[_0xa663('0x53')]):_0xa663('0x68'));return respondWithRpcPromise('RejectMessage',_0xa663('0x74'),_0x4286e3);}return null;})[_0xa663('0x2f')](function(_0x53ec3e){if(_0x53ec3e){_0x53ec3e['message']['interface']=util[_0xa663('0x5b')](_0xa663('0x6c'),_0x2d1334[_0xa663('0x5e')]['name']);_0x53ec3e[_0xa663('0x24')]['channel']=_0x4286e3[_0xa663('0x6d')];_0x53ec3e[_0xa663('0x24')]['event']=_0xa663('0x2d');respondWithRpcPromise(_0xa663('0x6f'),_0xa663('0x6f'),{'event':_0xa663('0x75'),'message':_0x53ec3e['message']},client9002);return _0x4286e3;}return null;})['then'](respondWithResult(_0x8901f8,null))[_0xa663('0x51')](handleError(_0x8901f8,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c0d48a6..a54b8ac 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 _0xbbee=['ChatMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xbbee,0x69));var _0xebbe=function(_0x452d09,_0xb569a){_0x452d09=_0x452d09-0x0;var _0x378a15=_0xbbee[_0x452d09];return _0x378a15;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xebbe('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xebbe('0x1')](0x0);var events={'afterCreate':_0xebbe('0x2'),'afterUpdate':_0xebbe('0x3'),'afterDestroy':_0xebbe('0x4')};function emitEvent(_0xc7d34c){return function(_0x5659c0,_0x434025,_0x12744c){ChatMessageEvents['emit'](_0xc7d34c+':'+_0x5659c0['id'],_0x5659c0);ChatMessageEvents[_0xebbe('0x5')](_0xc7d34c,_0x5659c0);_0x12744c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xebbe('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xc0c6=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3baaed,_0x52f8bd){var _0x354850=function(_0x3e2f2a){while(--_0x3e2f2a){_0x3baaed['push'](_0x3baaed['shift']());}};_0x354850(++_0x52f8bd);}(_0xc0c6,0x107));var _0x6c0c=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xc0c6[_0x319cb9];return _0x1735fc;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x6c0c('0x0'))['db'][_0x6c0c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6c0c('0x2')](0x0);var events={'afterCreate':_0x6c0c('0x3'),'afterUpdate':_0x6c0c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5bbc19){return function(_0x2b442e,_0x4f904e,_0xee4125){ChatMessageEvents[_0x6c0c('0x5')](_0x5bbc19+':'+_0x2b442e['id'],_0x2b442e);ChatMessageEvents[_0x6c0c('0x5')](_0x5bbc19,_0x2b442e);_0xee4125(null);};}for(var e in events){if(events[_0x6c0c('0x6')](e)){var event=events[e];ChatMessage[_0x6c0c('0x7')](e,emitEvent(event));}}module[_0x6c0c('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 05190d4..b9b0c83 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 _0x896c=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','createdAt','catch'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x896c,0x12c));var _0xc896=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x896c[_0x54ea7a];return _0x65a10d;};'use strict';var _=require(_0xc896('0x0'));var util=require(_0xc896('0x1'));var logger=require(_0xc896('0x2'))('api');var moment=require(_0xc896('0x3'));var BPromise=require(_0xc896('0x4'));var rp=require(_0xc896('0x5'));var fs=require('fs');var path=require(_0xc896('0x6'));var rimraf=require(_0xc896('0x7'));var config=require(_0xc896('0x8'));var attributes=require('./chatMessage.attributes');module[_0xc896('0x9')]=function(_0x3518c7,_0x43c610){return _0x3518c7[_0xc896('0xa')]('ChatMessage',attributes,{'tableName':_0xc896('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xc896('0xc')],'type':_0xc896('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1343c0,_0x4e3499,_0x193905){var _0x2978b8=_0x3518c7[_0xc896('0xe')];var _0x14ef6d=_0x1343c0['get']({'plain':!![]});if(_0x14ef6d[_0xc896('0xf')][_0xc896('0x10')]()==='in'||_0x14ef6d[_0xc896('0xf')][_0xc896('0x10')]()===_0xc896('0x11')&&!_0x14ef6d[_0xc896('0x12')]&&!_[_0xc896('0x13')](_0x14ef6d[_0xc896('0x14')])){_0x2978b8[_0xc896('0x15')]['findOne']({'where':{'id':_0x14ef6d['ChatInteractionId']}})['then'](function(_0x434760){if(_0x434760){_0x434760['update']({'lastMsgAt':_0x14ef6d[_0xc896('0x16')],'lastMsgDirection':_0x14ef6d[_0xc896('0xf')][_0xc896('0x10')]()});}})[_0xc896('0x17')](function(_0x23a81d){console[_0xc896('0x18')](_0x23a81d);});}_0x193905();}},'charset':_0xc896('0x19'),'collate':_0xc896('0x1a')});}; \ No newline at end of file +var _0xa2ce=['update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','findOne','ChatInteractionId','then'];(function(_0x4eff62,_0x32f1a8){var _0x26ccca=function(_0x92c02c){while(--_0x92c02c){_0x4eff62['push'](_0x4eff62['shift']());}};_0x26ccca(++_0x32f1a8);}(_0xa2ce,0x155));var _0xea2c=function(_0x474742,_0x3aaf60){_0x474742=_0x474742-0x0;var _0x4d588c=_0xa2ce[_0x474742];return _0x4d588c;};'use strict';var _=require(_0xea2c('0x0'));var util=require(_0xea2c('0x1'));var logger=require(_0xea2c('0x2'))('api');var moment=require(_0xea2c('0x3'));var BPromise=require('bluebird');var rp=require(_0xea2c('0x4'));var fs=require('fs');var path=require(_0xea2c('0x5'));var rimraf=require(_0xea2c('0x6'));var config=require(_0xea2c('0x7'));var attributes=require(_0xea2c('0x8'));module['exports']=function(_0x160e85,_0x39253a){return _0x160e85['define'](_0xea2c('0x9'),attributes,{'tableName':_0xea2c('0xa'),'paranoid':![],'indexes':[{'name':_0xea2c('0xb'),'fields':[_0xea2c('0xc')],'type':_0xea2c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ab0a0,_0x552083,_0x4bbef0){var _0x1ab05f=_0x160e85[_0xea2c('0xe')];var _0x105520=_0x3ab0a0[_0xea2c('0xf')]({'plain':!![]});if(_0x105520[_0xea2c('0x10')][_0xea2c('0x11')]()==='in'||_0x105520[_0xea2c('0x10')]['toLowerCase']()==='out'&&!_0x105520['secret']&&!_[_0xea2c('0x12')](_0x105520[_0xea2c('0x13')])){_0x1ab05f['ChatInteraction'][_0xea2c('0x14')]({'where':{'id':_0x105520[_0xea2c('0x15')]}})[_0xea2c('0x16')](function(_0x76f2c1){if(_0x76f2c1){_0x76f2c1[_0xea2c('0x17')]({'lastMsgAt':_0x105520[_0xea2c('0x18')],'lastMsgDirection':_0x105520[_0xea2c('0x10')][_0xea2c('0x11')]()});}})[_0xea2c('0x19')](function(_0x33eb4d){console[_0xea2c('0x1a')](_0x33eb4d);});}_0x4bbef0();}},'charset':'utf8mb4','collate':_0xea2c('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 03cd3b1..4c6a8a0 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 _0xba66=['then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x57d082,_0x51bb57){var _0x53538d=function(_0x4aadd1){while(--_0x4aadd1){_0x57d082['push'](_0x57d082['shift']());}};_0x53538d(++_0x51bb57);}(_0xba66,0x165));var _0x6ba6=function(_0x48c997,_0x2d0ffa){_0x48c997=_0x48c997-0x0;var _0xf88c96=_0xba66[_0x48c997];return _0xf88c96;};'use strict';var _=require(_0x6ba6('0x0'));var util=require(_0x6ba6('0x1'));var moment=require(_0x6ba6('0x2'));var BPromise=require(_0x6ba6('0x3'));var rs=require(_0x6ba6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ba6('0x5'))['db'];var utils=require(_0x6ba6('0x6'));var logger=require(_0x6ba6('0x7'))('rpc');var config=require(_0x6ba6('0x8'));var jayson=require(_0x6ba6('0x9'));var client=jayson[_0x6ba6('0xa')][_0x6ba6('0xb')]({'port':0x232a});config[_0x6ba6('0xc')]=_[_0x6ba6('0xd')](config[_0x6ba6('0xc')],{'host':_0x6ba6('0xe'),'port':0x18eb});var socket=require(_0x6ba6('0xf'))(new Redis(config[_0x6ba6('0xc')]));require('./chatMessage.socket')[_0x6ba6('0x10')](socket);function respondWithRpcPromise(_0x57fde4,_0x35ac87,_0x55ad93){return new BPromise(function(_0x5d93e0,_0x1d77bc){return client['request'](_0x57fde4,_0x55ad93)[_0x6ba6('0x11')](function(_0xdde320){logger[_0x6ba6('0x12')](_0x6ba6('0x13'),_0x35ac87,_0x6ba6('0x14'));logger[_0x6ba6('0x15')](_0x6ba6('0x16'),_0x35ac87,_0x6ba6('0x14'),JSON[_0x6ba6('0x17')](_0xdde320));if(_0xdde320[_0x6ba6('0x18')]){if(_0xdde320['error'][_0x6ba6('0x19')]===0x1f4){logger[_0x6ba6('0x18')]('ChatMessage,\x20%s,\x20%s',_0x35ac87,_0xdde320[_0x6ba6('0x18')][_0x6ba6('0x1a')]);return _0x1d77bc(_0xdde320[_0x6ba6('0x18')]['message']);}logger[_0x6ba6('0x18')](_0x6ba6('0x13'),_0x35ac87,_0xdde320[_0x6ba6('0x18')][_0x6ba6('0x1a')]);return _0x5d93e0(_0xdde320[_0x6ba6('0x18')][_0x6ba6('0x1a')]);}else{logger[_0x6ba6('0x12')](_0x6ba6('0x13'),_0x35ac87,_0x6ba6('0x14'));_0x5d93e0(_0xdde320[_0x6ba6('0x1b')][_0x6ba6('0x1a')]);}})['catch'](function(_0x5ac4d8){logger[_0x6ba6('0x18')](_0x6ba6('0x13'),_0x35ac87,_0x5ac4d8);_0x1d77bc(_0x5ac4d8);});});}exports['CreateChatMessage']=function(_0x2bcab8){var _0x31208f=this;return new Promise(function(_0x34a95f,_0x1c1d8){return db[_0x6ba6('0x1c')][_0x6ba6('0x1d')](_0x2bcab8[_0x6ba6('0x1e')],{'raw':_0x2bcab8[_0x6ba6('0x1f')]?_0x2bcab8[_0x6ba6('0x1f')][_0x6ba6('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x46162b){logger[_0x6ba6('0x12')](_0x6ba6('0x21'),_0x2bcab8);logger['debug'](_0x6ba6('0x21'),_0x2bcab8,JSON[_0x6ba6('0x17')](_0x46162b));_0x34a95f(_0x46162b);})['catch'](function(_0x36ffb6){logger[_0x6ba6('0x18')]('CreateChatMessage',_0x36ffb6['message'],_0x2bcab8);_0x1c1d8(_0x31208f[_0x6ba6('0x18')](0x1f4,_0x36ffb6['message']));});});}; \ No newline at end of file +var _0x049d=['body','options','raw','then','CreateChatMessage','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','redis','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x049d,0x132));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd049('0x0'));var util=require('util');var moment=require(_0xd049('0x1'));var BPromise=require(_0xd049('0x2'));var rs=require(_0xd049('0x3'));var fs=require('fs');var Redis=require(_0xd049('0x4'));var db=require(_0xd049('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd049('0x6'));var config=require(_0xd049('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd049('0x8')]({'port':0x232a});config['redis']=_[_0xd049('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd049('0xa')]));require(_0xd049('0xb'))[_0xd049('0xc')](socket);function respondWithRpcPromise(_0xb41e7c,_0x304e0f,_0xf82ba7){return new BPromise(function(_0x2414e9,_0x5b3d89){return client['request'](_0xb41e7c,_0xf82ba7)['then'](function(_0x1567e1){logger[_0xd049('0xd')](_0xd049('0xe'),_0x304e0f,_0xd049('0xf'));logger['debug'](_0xd049('0x10'),_0x304e0f,'request\x20sent',JSON[_0xd049('0x11')](_0x1567e1));if(_0x1567e1[_0xd049('0x12')]){if(_0x1567e1[_0xd049('0x12')][_0xd049('0x13')]===0x1f4){logger['error'](_0xd049('0xe'),_0x304e0f,_0x1567e1[_0xd049('0x12')][_0xd049('0x14')]);return _0x5b3d89(_0x1567e1['error']['message']);}logger[_0xd049('0x12')](_0xd049('0xe'),_0x304e0f,_0x1567e1[_0xd049('0x12')][_0xd049('0x14')]);return _0x2414e9(_0x1567e1[_0xd049('0x12')][_0xd049('0x14')]);}else{logger['info'](_0xd049('0xe'),_0x304e0f,_0xd049('0xf'));_0x2414e9(_0x1567e1[_0xd049('0x15')][_0xd049('0x14')]);}})[_0xd049('0x16')](function(_0xcf7999){logger[_0xd049('0x12')](_0xd049('0xe'),_0x304e0f,_0xcf7999);_0x5b3d89(_0xcf7999);});});}exports['CreateChatMessage']=function(_0x3e442c){var _0xf9b0b1=this;return new Promise(function(_0x545949,_0xbece96){return db['ChatMessage'][_0xd049('0x17')](_0x3e442c[_0xd049('0x18')],{'raw':_0x3e442c['options']?_0x3e442c[_0xd049('0x19')][_0xd049('0x1a')]===undefined?!![]:![]:!![]})[_0xd049('0x1b')](function(_0x281497){logger[_0xd049('0xd')](_0xd049('0x1c'),_0x3e442c);logger[_0xd049('0x1d')](_0xd049('0x1c'),_0x3e442c,JSON[_0xd049('0x11')](_0x281497));_0x545949(_0x281497);})[_0xd049('0x16')](function(_0x5a540b){logger[_0xd049('0x12')](_0xd049('0x1c'),_0x5a540b[_0xd049('0x14')],_0x3e442c);_0xbece96(_0xf9b0b1[_0xd049('0x12')](0x1f4,_0x5a540b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 44fdebf..ecc3934 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 _0x1a37=['remove','update','emit','register','length','./chatMessage.events','save'];(function(_0x140b4f,_0x5245a5){var _0x1cfa49=function(_0x988e17){while(--_0x988e17){_0x140b4f['push'](_0x140b4f['shift']());}};_0x1cfa49(++_0x5245a5);}(_0x1a37,0xb4));var _0x71a3=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1a37[_0x543084];return _0x306a57;};'use strict';var ChatMessageEvents=require(_0x71a3('0x0'));var events=[_0x71a3('0x1'),_0x71a3('0x2'),_0x71a3('0x3')];function createListener(_0x353cf0,_0x20d8a7){return function(_0x348395){_0x20d8a7[_0x71a3('0x4')](_0x353cf0,_0x348395);};}function removeListener(_0x29c54f,_0x100181){return function(){ChatMessageEvents['removeListener'](_0x29c54f,_0x100181);};}exports[_0x71a3('0x5')]=function(_0x4f6b7a){for(var _0xd09f7=0x0,_0x45050a=events[_0x71a3('0x6')];_0xd09f7<_0x45050a;_0xd09f7++){var _0x2bb6a2=events[_0xd09f7];var _0x4a9ab2=createListener('chatMessage:'+_0x2bb6a2,_0x4f6b7a);ChatMessageEvents['on'](_0x2bb6a2,_0x4a9ab2);}}; \ No newline at end of file +var _0xd8fb=['./chatMessage.events','save','remove','update','emit','removeListener','register','length','chatMessage:'];(function(_0x1fbf16,_0x4a0f2c){var _0xb28935=function(_0x597db0){while(--_0x597db0){_0x1fbf16['push'](_0x1fbf16['shift']());}};_0xb28935(++_0x4a0f2c);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3a951c,_0x4578ed){_0x3a951c=_0x3a951c-0x0;var _0x4e59cc=_0xd8fb[_0x3a951c];return _0x4e59cc;};'use strict';var ChatMessageEvents=require(_0xbd8f('0x0'));var events=[_0xbd8f('0x1'),_0xbd8f('0x2'),_0xbd8f('0x3')];function createListener(_0x52724c,_0x5ea933){return function(_0x4e9545){_0x5ea933[_0xbd8f('0x4')](_0x52724c,_0x4e9545);};}function removeListener(_0x43d177,_0x53cccc){return function(){ChatMessageEvents[_0xbd8f('0x5')](_0x43d177,_0x53cccc);};}exports[_0xbd8f('0x6')]=function(_0x5543b2){for(var _0x33d541=0x0,_0x4e97cf=events[_0xbd8f('0x7')];_0x33d541<_0x4e97cf;_0x33d541++){var _0x578499=events[_0x33d541];var _0x197827=createListener(_0xbd8f('0x8')+_0x578499,_0x5543b2);ChatMessageEvents['on'](_0x578499,_0x197827);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index df5e3fd..e42e109 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 _0xfc15=['update','/:id/accept','accept','reject','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','chat','chatmessage:create','create','put'];(function(_0xd959ea,_0x3c3b41){var _0x4c8593=function(_0x39da51){while(--_0x39da51){_0xd959ea['push'](_0xd959ea['shift']());}};_0x4c8593(++_0x3c3b41);}(_0xfc15,0x95));var _0x5fc1=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xfc15[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require('multer');var util=require(_0x5fc1('0x0'));var path=require(_0x5fc1('0x1'));var timeout=require(_0x5fc1('0x2'));var express=require(_0x5fc1('0x3'));var router=express[_0x5fc1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5fc1('0x5'));var config=require(_0x5fc1('0x6'));var controller=require(_0x5fc1('0x7'));router[_0x5fc1('0x8')]('/',auth['isAuthenticated'](),controller[_0x5fc1('0x9')]);router[_0x5fc1('0x8')](_0x5fc1('0xa'),auth[_0x5fc1('0xb')](),controller[_0x5fc1('0xc')]);router[_0x5fc1('0x8')](_0x5fc1('0xd'),auth[_0x5fc1('0xb')](),controller['show']);router[_0x5fc1('0xe')]('/',auth[_0x5fc1('0xb')](),interaction['tracked'](_0x5fc1('0xf'),_0x5fc1('0x10')),controller[_0x5fc1('0x11')]);router[_0x5fc1('0x12')](_0x5fc1('0xd'),controller[_0x5fc1('0x13')]);router[_0x5fc1('0x12')](_0x5fc1('0x14'),auth[_0x5fc1('0xb')](),controller[_0x5fc1('0x15')]);router[_0x5fc1('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0x5fc1('0x16')]);router['delete'](_0x5fc1('0xd'),auth[_0x5fc1('0xb')](),controller[_0x5fc1('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1a37=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','path','express','Router','../../components/auth/service'];(function(_0xb4d347,_0x5dd5ce){var _0x2d7585=function(_0x260cbe){while(--_0x260cbe){_0xb4d347['push'](_0xb4d347['shift']());}};_0x2d7585(++_0x5dd5ce);}(_0x1a37,0xf5));var _0x71a3=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1a37[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x71a3('0x0'));var util=require('util');var path=require(_0x71a3('0x1'));var timeout=require('connect-timeout');var express=require(_0x71a3('0x2'));var router=express[_0x71a3('0x3')]();var auth=require(_0x71a3('0x4'));var interaction=require(_0x71a3('0x5'));var config=require(_0x71a3('0x6'));var controller=require(_0x71a3('0x7'));router[_0x71a3('0x8')]('/',auth[_0x71a3('0x9')](),controller[_0x71a3('0xa')]);router[_0x71a3('0x8')](_0x71a3('0xb'),auth[_0x71a3('0x9')](),controller[_0x71a3('0xc')]);router[_0x71a3('0x8')](_0x71a3('0xd'),auth[_0x71a3('0x9')](),controller[_0x71a3('0xe')]);router[_0x71a3('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x71a3('0x10'),_0x71a3('0x11')),controller['create']);router[_0x71a3('0x12')](_0x71a3('0xd'),controller[_0x71a3('0x13')]);router[_0x71a3('0x12')](_0x71a3('0x14'),auth[_0x71a3('0x9')](),controller[_0x71a3('0x15')]);router[_0x71a3('0x12')](_0x71a3('0x16'),auth[_0x71a3('0x9')](),controller[_0x71a3('0x17')]);router[_0x71a3('0x18')]('/:id',auth[_0x71a3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 7eb5565..d4f87fe 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 _0xef88=['sequelize','TEXT','medium'];(function(_0x5194f3,_0x4136a6){var _0x5734a6=function(_0x192704){while(--_0x192704){_0x5194f3['push'](_0x5194f3['shift']());}};_0x5734a6(++_0x4136a6);}(_0xef88,0x14d));var _0x8ef8=function(_0x21c26e,_0x8168a7){_0x21c26e=_0x21c26e-0x0;var _0x5403ca=_0xef88[_0x21c26e];return _0x5403ca;};'use strict';var Sequelize=require(_0x8ef8('0x0'));module['exports']={'body':{'type':Sequelize[_0x8ef8('0x1')](_0x8ef8('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x4b6b=['exports','TEXT','medium','sequelize'];(function(_0x39aba3,_0x48338b){var _0x2e3b17=function(_0x30fe03){while(--_0x30fe03){_0x39aba3['push'](_0x39aba3['shift']());}};_0x2e3b17(++_0x48338b);}(_0x4b6b,0x1cf));var _0xb4b6=function(_0x5b703f,_0x2e401b){_0x5b703f=_0x5b703f-0x0;var _0x1225d9=_0x4b6b[_0x5b703f];return _0x1225d9;};'use strict';var Sequelize=require(_0xb4b6('0x0'));module[_0xb4b6('0x1')]={'body':{'type':Sequelize[_0xb4b6('0x2')](_0xb4b6('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 701ea23..2fe19a0 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 _0xe3cd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ChatOfflineMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','show','params','keys','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xe3cd,0x1e0));var _0xde3c=function(_0x1f140a,_0x575c52){_0x1f140a=_0x1f140a-0x0;var _0x102620=_0xe3cd[_0x1f140a];return _0x102620;};'use strict';var pdf=require(_0xde3c('0x0'));var emlformat=require(_0xde3c('0x1'));var rimraf=require(_0xde3c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde3c('0x3'));var BPromise=require(_0xde3c('0x4'));var Mustache=require(_0xde3c('0x5'));var util=require(_0xde3c('0x6'));var path=require(_0xde3c('0x7'));var sox=require('sox');var csv=require(_0xde3c('0x8'));var ejs=require(_0xde3c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xde3c('0xa'));var crypto=require('crypto');var jsforce=require(_0xde3c('0xb'));var deskjs=require(_0xde3c('0xc'));var toCsv=require(_0xde3c('0x8'));var querystring=require('querystring');var Papa=require(_0xde3c('0xd'));var Redis=require(_0xde3c('0xe'));var authService=require(_0xde3c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xde3c('0x10'));var hardwareService=require(_0xde3c('0x11'));var logger=require(_0xde3c('0x12'))(_0xde3c('0x13'));var utils=require(_0xde3c('0x14'));var config=require(_0xde3c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xde3c('0x16'))['db'];function respondWithStatusCode(_0x59598a,_0x37201b){_0x37201b=_0x37201b||0xcc;return function(_0x32e646){if(_0x32e646){return _0x59598a['sendStatus'](_0x37201b);}return _0x59598a[_0xde3c('0x17')](_0x37201b)['end']();};}function respondWithResult(_0x604b30,_0xe3e48a){_0xe3e48a=_0xe3e48a||0xc8;return function(_0x4150ee){if(_0x4150ee){return _0x604b30[_0xde3c('0x17')](_0xe3e48a)[_0xde3c('0x18')](_0x4150ee);}};}function respondWithFilteredResult(_0x5d1a60,_0x3c6452){return function(_0x3ebac4){if(_0x3ebac4){var _0x552164=_0x3ebac4[_0xde3c('0x19')],_0x570f4c=_0x3c6452[_0xde3c('0x1a')],_0x257a68=_0x3c6452['offset']+_0x3c6452[_0xde3c('0x1b')],_0x2c9cc1;if(_0x257a68>=_0x552164){_0x257a68=_0x552164;_0x2c9cc1=0xc8;}else{_0x2c9cc1=0xce;}_0x5d1a60['status'](_0x2c9cc1);return _0x5d1a60['set'](_0xde3c('0x1c'),_0x570f4c+'-'+_0x257a68+'/'+_0x552164)[_0xde3c('0x18')](_0x3ebac4);}return null;};}function patchUpdates(_0x5d531f){return function(_0x164789){try{jsonpatch[_0xde3c('0x1d')](_0x164789,_0x5d531f,!![]);}catch(_0x3d3f16){return BPromise[_0xde3c('0x1e')](_0x3d3f16);}return _0x164789[_0xde3c('0x1f')]();};}function saveUpdates(_0x46bc15,_0x4a6dd0){return function(_0x2f67c7){if(_0x2f67c7){return _0x2f67c7[_0xde3c('0x20')](_0x46bc15)[_0xde3c('0x21')](function(_0x3882ae){return _0x3882ae;});}return null;};}function removeEntity(_0x1ea87e,_0x38552c){return function(_0x22beee){if(_0x22beee){return _0x22beee[_0xde3c('0x22')]()[_0xde3c('0x21')](function(){_0x1ea87e[_0xde3c('0x17')](0xcc)[_0xde3c('0x23')]();});}};}function handleEntityNotFound(_0x39e57d,_0x5a6ef2){return function(_0x1366b5){if(!_0x1366b5){_0x39e57d['sendStatus'](0x194);}return _0x1366b5;};}function handleError(_0x5c094b,_0x19f6f5){_0x19f6f5=_0x19f6f5||0x1f4;return function(_0x58c7cb){logger[_0xde3c('0x24')](_0x58c7cb[_0xde3c('0x25')]);if(_0x58c7cb[_0xde3c('0x26')]){delete _0x58c7cb[_0xde3c('0x26')];}_0x5c094b[_0xde3c('0x17')](_0x19f6f5)[_0xde3c('0x27')](_0x58c7cb);};}exports['index']=function(_0x1c8b7e,_0x1027e6){var _0x310afa={},_0x1c224f={},_0x10a6f5={'count':0x0,'rows':[]};var _0x34c7c8=_[_0xde3c('0x28')](db[_0xde3c('0x29')][_0xde3c('0x2a')],function(_0x5d5ee4){return{'name':_0x5d5ee4[_0xde3c('0x2b')],'type':_0x5d5ee4[_0xde3c('0x2c')]['key']};});_0x1c224f[_0xde3c('0x2d')]=_[_0xde3c('0x28')](_0x34c7c8,'name');_0x1c224f[_0xde3c('0x2e')]=_['keys'](_0x1c8b7e['query']);_0x1c224f[_0xde3c('0x2f')]=_[_0xde3c('0x30')](_0x1c224f[_0xde3c('0x2d')],_0x1c224f[_0xde3c('0x2e')]);_0x310afa[_0xde3c('0x31')]=_['intersection'](_0x1c224f[_0xde3c('0x2d')],qs[_0xde3c('0x32')](_0x1c8b7e[_0xde3c('0x2e')]['fields']));_0x310afa[_0xde3c('0x31')]=_0x310afa[_0xde3c('0x31')][_0xde3c('0x33')]?_0x310afa[_0xde3c('0x31')]:_0x1c224f[_0xde3c('0x2d')];if(!_0x1c8b7e['query'][_0xde3c('0x34')](_0xde3c('0x35'))){_0x310afa[_0xde3c('0x1b')]=qs['limit'](_0x1c8b7e['query']['limit']);_0x310afa['offset']=qs[_0xde3c('0x1a')](_0x1c8b7e['query'][_0xde3c('0x1a')]);}_0x310afa[_0xde3c('0x36')]=qs[_0xde3c('0x37')](_0x1c8b7e['query']['sort']);_0x310afa[_0xde3c('0x38')]=qs[_0xde3c('0x2f')](_['pick'](_0x1c8b7e[_0xde3c('0x2e')],_0x1c224f[_0xde3c('0x2f')]),_0x34c7c8);if(_0x1c8b7e[_0xde3c('0x2e')][_0xde3c('0x39')]){_0x310afa[_0xde3c('0x38')]=_[_0xde3c('0x3a')](_0x310afa[_0xde3c('0x38')],{'$or':_['map'](_0x34c7c8,function(_0x1bd6ec){if(_0x1bd6ec[_0xde3c('0x2c')]!=='VIRTUAL'){var _0x360b1e={};_0x360b1e[_0x1bd6ec['name']]={'$like':'%'+_0x1c8b7e['query'][_0xde3c('0x39')]+'%'};return _0x360b1e;}})});}_0x310afa=_[_0xde3c('0x3a')]({},_0x310afa,_0x1c8b7e['options']);var _0x66240a={'where':_0x310afa[_0xde3c('0x38')]};return db['ChatOfflineMessage'][_0xde3c('0x19')](_0x66240a)[_0xde3c('0x21')](function(_0x4cbad9){_0x10a6f5[_0xde3c('0x19')]=_0x4cbad9;if(_0x1c8b7e[_0xde3c('0x2e')][_0xde3c('0x3b')]){_0x310afa['include']=[{'all':!![]}];}return db[_0xde3c('0x29')][_0xde3c('0x3c')](_0x310afa);})['then'](function(_0x1775b5){_0x10a6f5[_0xde3c('0x3d')]=_0x1775b5;return _0x10a6f5;})[_0xde3c('0x21')](respondWithFilteredResult(_0x1027e6,_0x310afa))['catch'](handleError(_0x1027e6,null));};exports[_0xde3c('0x3e')]=function(_0x326fd3,_0x4642b9){var _0x578c74={'raw':!![],'where':{'id':_0x326fd3[_0xde3c('0x3f')]['id']}},_0x19693c={};_0x19693c[_0xde3c('0x2d')]=_[_0xde3c('0x40')](db[_0xde3c('0x29')][_0xde3c('0x2a')]);_0x19693c['query']=_[_0xde3c('0x40')](_0x326fd3[_0xde3c('0x2e')]);_0x19693c['filters']=_[_0xde3c('0x30')](_0x19693c[_0xde3c('0x2d')],_0x19693c['query']);_0x578c74[_0xde3c('0x31')]=_[_0xde3c('0x30')](_0x19693c['model'],qs['fields'](_0x326fd3[_0xde3c('0x2e')][_0xde3c('0x32')]));_0x578c74[_0xde3c('0x31')]=_0x578c74[_0xde3c('0x31')][_0xde3c('0x33')]?_0x578c74[_0xde3c('0x31')]:_0x19693c['model'];if(_0x326fd3[_0xde3c('0x2e')][_0xde3c('0x3b')]){_0x578c74['include']=[{'all':!![]}];}_0x578c74=_[_0xde3c('0x3a')]({},_0x578c74,_0x326fd3[_0xde3c('0x41')]);return db['ChatOfflineMessage'][_0xde3c('0x42')](_0x578c74)['then'](handleEntityNotFound(_0x4642b9,null))[_0xde3c('0x21')](respondWithResult(_0x4642b9,null))[_0xde3c('0x43')](handleError(_0x4642b9,null));};exports['create']=function(_0x54e5f8,_0x1a5c39){return db[_0xde3c('0x29')][_0xde3c('0x44')](_0x54e5f8[_0xde3c('0x45')],{})[_0xde3c('0x21')](respondWithResult(_0x1a5c39,0xc9))['catch'](handleError(_0x1a5c39,null));};exports[_0xde3c('0x20')]=function(_0x55fd6e,_0x5b7d0b){if(_0x55fd6e[_0xde3c('0x45')]['id']){delete _0x55fd6e['body']['id'];}return db[_0xde3c('0x29')][_0xde3c('0x42')]({'where':{'id':_0x55fd6e[_0xde3c('0x3f')]['id']}})[_0xde3c('0x21')](handleEntityNotFound(_0x5b7d0b,null))[_0xde3c('0x21')](saveUpdates(_0x55fd6e[_0xde3c('0x45')],null))[_0xde3c('0x21')](respondWithResult(_0x5b7d0b,null))[_0xde3c('0x43')](handleError(_0x5b7d0b,null));};exports['destroy']=function(_0xf66628,_0x1afcdd){return db[_0xde3c('0x29')][_0xde3c('0x42')]({'where':{'id':_0xf66628[_0xde3c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1afcdd,null))['then'](removeEntity(_0x1afcdd,null))[_0xde3c('0x43')](handleError(_0x1afcdd,null));};exports['describe']=function(_0x4a48e7,_0x30012b){return db[_0xde3c('0x29')][_0xde3c('0x46')]()[_0xde3c('0x21')](respondWithResult(_0x30012b,null))['catch'](handleError(_0x30012b,null));}; \ No newline at end of file +var _0xcd2e=['fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','ChatOfflineMessage','includeAll','findAll','rows','catch','show','options','find','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes'];(function(_0x5e8935,_0x3d1365){var _0x417bc8=function(_0xec77a6){while(--_0xec77a6){_0x5e8935['push'](_0x5e8935['shift']());}};_0x417bc8(++_0x3d1365);}(_0xcd2e,0xfb));var _0xecd2=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xcd2e[_0x1b51ea];return _0x18bbdc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xecd2('0x0'));var rimraf=require(_0xecd2('0x1'));var zipdir=require(_0xecd2('0x2'));var jsonpatch=require(_0xecd2('0x3'));var rp=require(_0xecd2('0x4'));var moment=require(_0xecd2('0x5'));var BPromise=require(_0xecd2('0x6'));var Mustache=require(_0xecd2('0x7'));var util=require(_0xecd2('0x8'));var path=require(_0xecd2('0x9'));var sox=require(_0xecd2('0xa'));var csv=require('to-csv');var ejs=require(_0xecd2('0xb'));var fs=require('fs');var _=require(_0xecd2('0xc'));var squel=require('squel');var crypto=require(_0xecd2('0xd'));var jsforce=require(_0xecd2('0xe'));var deskjs=require(_0xecd2('0xf'));var toCsv=require(_0xecd2('0x10'));var querystring=require(_0xecd2('0x11'));var Papa=require(_0xecd2('0x12'));var Redis=require(_0xecd2('0x13'));var authService=require(_0xecd2('0x14'));var qs=require(_0xecd2('0x15'));var as=require(_0xecd2('0x16'));var hardwareService=require(_0xecd2('0x17'));var logger=require('../../config/logger')(_0xecd2('0x18'));var utils=require('../../config/utils');var config=require(_0xecd2('0x19'));var licenseUtil=require(_0xecd2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5892bd,_0x10849b){_0x10849b=_0x10849b||0xcc;return function(_0x89be9b){if(_0x89be9b){return _0x5892bd[_0xecd2('0x1b')](_0x10849b);}return _0x5892bd[_0xecd2('0x1c')](_0x10849b)[_0xecd2('0x1d')]();};}function respondWithResult(_0x228cb7,_0x2456e0){_0x2456e0=_0x2456e0||0xc8;return function(_0x1243c6){if(_0x1243c6){return _0x228cb7[_0xecd2('0x1c')](_0x2456e0)[_0xecd2('0x1e')](_0x1243c6);}};}function respondWithFilteredResult(_0x4a750a,_0x22ed1a){return function(_0x2ab42c){if(_0x2ab42c){var _0x2e8ca2=_0x2ab42c[_0xecd2('0x1f')],_0x272af7=_0x22ed1a[_0xecd2('0x20')],_0xb1335a=_0x22ed1a['offset']+_0x22ed1a[_0xecd2('0x21')],_0x3c9627;if(_0xb1335a>=_0x2e8ca2){_0xb1335a=_0x2e8ca2;_0x3c9627=0xc8;}else{_0x3c9627=0xce;}_0x4a750a[_0xecd2('0x1c')](_0x3c9627);return _0x4a750a[_0xecd2('0x22')](_0xecd2('0x23'),_0x272af7+'-'+_0xb1335a+'/'+_0x2e8ca2)[_0xecd2('0x1e')](_0x2ab42c);}return null;};}function patchUpdates(_0x50ca65){return function(_0x2a4d88){try{jsonpatch['apply'](_0x2a4d88,_0x50ca65,!![]);}catch(_0x193709){return BPromise[_0xecd2('0x24')](_0x193709);}return _0x2a4d88[_0xecd2('0x25')]();};}function saveUpdates(_0xf103cc,_0x24f4ef){return function(_0x1fd68a){if(_0x1fd68a){return _0x1fd68a['update'](_0xf103cc)[_0xecd2('0x26')](function(_0x4d4720){return _0x4d4720;});}return null;};}function removeEntity(_0x4593a6,_0xc8c8d0){return function(_0x1496f7){if(_0x1496f7){return _0x1496f7[_0xecd2('0x27')]()[_0xecd2('0x26')](function(){_0x4593a6[_0xecd2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1215d2,_0x386a77){return function(_0x8d7e19){if(!_0x8d7e19){_0x1215d2['sendStatus'](0x194);}return _0x8d7e19;};}function handleError(_0x18a583,_0x5eb163){_0x5eb163=_0x5eb163||0x1f4;return function(_0x5da8a6){logger[_0xecd2('0x28')](_0x5da8a6['stack']);if(_0x5da8a6[_0xecd2('0x29')]){delete _0x5da8a6[_0xecd2('0x29')];}_0x18a583[_0xecd2('0x1c')](_0x5eb163)[_0xecd2('0x2a')](_0x5da8a6);};}exports[_0xecd2('0x2b')]=function(_0xe39391,_0x37e05a){var _0x20767b={},_0x1d6be6={},_0x475632={'count':0x0,'rows':[]};var _0x149726=_[_0xecd2('0x2c')](db['ChatOfflineMessage'][_0xecd2('0x2d')],function(_0x3eeac1){return{'name':_0x3eeac1[_0xecd2('0x2e')],'type':_0x3eeac1[_0xecd2('0x2f')]['key']};});_0x1d6be6['model']=_[_0xecd2('0x2c')](_0x149726,'name');_0x1d6be6[_0xecd2('0x30')]=_[_0xecd2('0x31')](_0xe39391[_0xecd2('0x30')]);_0x1d6be6['filters']=_[_0xecd2('0x32')](_0x1d6be6[_0xecd2('0x33')],_0x1d6be6[_0xecd2('0x30')]);_0x20767b[_0xecd2('0x34')]=_[_0xecd2('0x32')](_0x1d6be6[_0xecd2('0x33')],qs[_0xecd2('0x35')](_0xe39391[_0xecd2('0x30')]['fields']));_0x20767b[_0xecd2('0x34')]=_0x20767b['attributes'][_0xecd2('0x36')]?_0x20767b['attributes']:_0x1d6be6['model'];if(!_0xe39391[_0xecd2('0x30')][_0xecd2('0x37')](_0xecd2('0x38'))){_0x20767b[_0xecd2('0x21')]=qs[_0xecd2('0x21')](_0xe39391['query'][_0xecd2('0x21')]);_0x20767b[_0xecd2('0x20')]=qs[_0xecd2('0x20')](_0xe39391[_0xecd2('0x30')][_0xecd2('0x20')]);}_0x20767b['order']=qs[_0xecd2('0x39')](_0xe39391['query'][_0xecd2('0x39')]);_0x20767b[_0xecd2('0x3a')]=qs[_0xecd2('0x3b')](_[_0xecd2('0x3c')](_0xe39391[_0xecd2('0x30')],_0x1d6be6[_0xecd2('0x3b')]),_0x149726);if(_0xe39391[_0xecd2('0x30')][_0xecd2('0x3d')]){_0x20767b[_0xecd2('0x3a')]=_['merge'](_0x20767b[_0xecd2('0x3a')],{'$or':_[_0xecd2('0x2c')](_0x149726,function(_0x43fea4){if(_0x43fea4[_0xecd2('0x2f')]!==_0xecd2('0x3e')){var _0x5348ef={};_0x5348ef[_0x43fea4[_0xecd2('0x29')]]={'$like':'%'+_0xe39391['query'][_0xecd2('0x3d')]+'%'};return _0x5348ef;}})});}_0x20767b=_[_0xecd2('0x3f')]({},_0x20767b,_0xe39391['options']);var _0x4ee5a1={'where':_0x20767b[_0xecd2('0x3a')]};return db[_0xecd2('0x40')][_0xecd2('0x1f')](_0x4ee5a1)['then'](function(_0x217cec){_0x475632[_0xecd2('0x1f')]=_0x217cec;if(_0xe39391[_0xecd2('0x30')][_0xecd2('0x41')]){_0x20767b['include']=[{'all':!![]}];}return db[_0xecd2('0x40')][_0xecd2('0x42')](_0x20767b);})[_0xecd2('0x26')](function(_0x381798){_0x475632[_0xecd2('0x43')]=_0x381798;return _0x475632;})['then'](respondWithFilteredResult(_0x37e05a,_0x20767b))[_0xecd2('0x44')](handleError(_0x37e05a,null));};exports[_0xecd2('0x45')]=function(_0x23b897,_0x274dfb){var _0x1a1396={'raw':!![],'where':{'id':_0x23b897['params']['id']}},_0x2c9dad={};_0x2c9dad[_0xecd2('0x33')]=_[_0xecd2('0x31')](db['ChatOfflineMessage'][_0xecd2('0x2d')]);_0x2c9dad[_0xecd2('0x30')]=_[_0xecd2('0x31')](_0x23b897[_0xecd2('0x30')]);_0x2c9dad[_0xecd2('0x3b')]=_[_0xecd2('0x32')](_0x2c9dad['model'],_0x2c9dad[_0xecd2('0x30')]);_0x1a1396[_0xecd2('0x34')]=_[_0xecd2('0x32')](_0x2c9dad[_0xecd2('0x33')],qs[_0xecd2('0x35')](_0x23b897[_0xecd2('0x30')][_0xecd2('0x35')]));_0x1a1396[_0xecd2('0x34')]=_0x1a1396[_0xecd2('0x34')][_0xecd2('0x36')]?_0x1a1396[_0xecd2('0x34')]:_0x2c9dad[_0xecd2('0x33')];if(_0x23b897[_0xecd2('0x30')][_0xecd2('0x41')]){_0x1a1396['include']=[{'all':!![]}];}_0x1a1396=_[_0xecd2('0x3f')]({},_0x1a1396,_0x23b897[_0xecd2('0x46')]);return db[_0xecd2('0x40')][_0xecd2('0x47')](_0x1a1396)[_0xecd2('0x26')](handleEntityNotFound(_0x274dfb,null))[_0xecd2('0x26')](respondWithResult(_0x274dfb,null))[_0xecd2('0x44')](handleError(_0x274dfb,null));};exports['create']=function(_0x5f5c45,_0x2f9f1e){return db[_0xecd2('0x40')]['create'](_0x5f5c45[_0xecd2('0x48')],{})[_0xecd2('0x26')](respondWithResult(_0x2f9f1e,0xc9))[_0xecd2('0x44')](handleError(_0x2f9f1e,null));};exports[_0xecd2('0x49')]=function(_0x2c29af,_0x2a448f){if(_0x2c29af[_0xecd2('0x48')]['id']){delete _0x2c29af[_0xecd2('0x48')]['id'];}return db[_0xecd2('0x40')][_0xecd2('0x47')]({'where':{'id':_0x2c29af[_0xecd2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a448f,null))[_0xecd2('0x26')](saveUpdates(_0x2c29af[_0xecd2('0x48')],null))['then'](respondWithResult(_0x2a448f,null))[_0xecd2('0x44')](handleError(_0x2a448f,null));};exports[_0xecd2('0x27')]=function(_0x554c01,_0x1a31fb){return db[_0xecd2('0x40')]['find']({'where':{'id':_0x554c01[_0xecd2('0x4a')]['id']}})[_0xecd2('0x26')](handleEntityNotFound(_0x1a31fb,null))['then'](removeEntity(_0x1a31fb,null))[_0xecd2('0x44')](handleError(_0x1a31fb,null));};exports[_0xecd2('0x4b')]=function(_0x2d660e,_0x32dcaa){return db[_0xecd2('0x40')]['describe']()['then'](respondWithResult(_0x32dcaa,null))[_0xecd2('0x44')](handleError(_0x32dcaa,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 62d7e2b..ffee813 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 _0xe14d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x35775a,_0x3d31e8){var _0x2c9f85=function(_0x35dbee){while(--_0x35dbee){_0x35775a['push'](_0x35775a['shift']());}};_0x2c9f85(++_0x3d31e8);}(_0xe14d,0x1ee));var _0xde14=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xe14d[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('ChatOfflineMessage',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde14('0xb'),'collate':_0xde14('0xc')});}; \ No newline at end of file +var _0x6f0d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x11c4fa,_0x3d68f0){var _0x12e9aa=function(_0x417aa1){while(--_0x417aa1){_0x11c4fa['push'](_0x11c4fa['shift']());}};_0x12e9aa(++_0x3d68f0);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5598bb,_0x70bcff){_0x5598bb=_0x5598bb-0x0;var _0x3edde8=_0x6f0d[_0x5598bb];return _0x3edde8;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6f0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8b068be..cec3cae 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 _0x307f=['stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x307f,0x1d2));var _0xf307=function(_0xc01de1,_0x26f86c){_0xc01de1=_0xc01de1-0x0;var _0x14c1c0=_0x307f[_0xc01de1];return _0x14c1c0;};'use strict';var _=require(_0xf307('0x0'));var util=require(_0xf307('0x1'));var moment=require(_0xf307('0x2'));var BPromise=require('bluebird');var rs=require(_0xf307('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf307('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf307('0x5'))('rpc');var config=require(_0xf307('0x6'));var jayson=require(_0xf307('0x7'));var client=jayson[_0xf307('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158ba6,_0x35c61b,_0xe02310){return new BPromise(function(_0x373621,_0x2fa81b){return client[_0xf307('0x9')](_0x158ba6,_0xe02310)[_0xf307('0xa')](function(_0x5b568f){logger[_0xf307('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x35c61b,_0xf307('0xc'));logger['debug'](_0xf307('0xd'),_0x35c61b,_0xf307('0xc'),JSON[_0xf307('0xe')](_0x5b568f));if(_0x5b568f[_0xf307('0xf')]){if(_0x5b568f['error'][_0xf307('0x10')]===0x1f4){logger['error'](_0xf307('0x11'),_0x35c61b,_0x5b568f[_0xf307('0xf')]['message']);return _0x2fa81b(_0x5b568f['error'][_0xf307('0x12')]);}logger[_0xf307('0xf')](_0xf307('0x11'),_0x35c61b,_0x5b568f['error'][_0xf307('0x12')]);return _0x373621(_0x5b568f['error'][_0xf307('0x12')]);}else{logger[_0xf307('0xb')](_0xf307('0x11'),_0x35c61b,_0xf307('0xc'));_0x373621(_0x5b568f['result'][_0xf307('0x12')]);}})[_0xf307('0x13')](function(_0x3a1f3e){logger['error'](_0xf307('0x11'),_0x35c61b,_0x3a1f3e);_0x2fa81b(_0x3a1f3e);});});} \ No newline at end of file +var _0xe0e6=['client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xe0e6,0x65));var _0x6e0e=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0xe0e6[_0xd1b4d7];return _0x3002ec;};'use strict';var _=require(_0x6e0e('0x0'));var util=require('util');var moment=require(_0x6e0e('0x1'));var BPromise=require(_0x6e0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e0e('0x3'));var db=require(_0x6e0e('0x4'))['db'];var utils=require(_0x6e0e('0x5'));var logger=require(_0x6e0e('0x6'))(_0x6e0e('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e0e('0x8'));var client=jayson[_0x6e0e('0x9')][_0x6e0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41fd46,_0x3581d5,_0x285118){return new BPromise(function(_0x20f66d,_0x4fd523){return client[_0x6e0e('0xb')](_0x41fd46,_0x285118)['then'](function(_0x35035c){logger[_0x6e0e('0xc')](_0x6e0e('0xd'),_0x3581d5,_0x6e0e('0xe'));logger[_0x6e0e('0xf')](_0x6e0e('0x10'),_0x3581d5,_0x6e0e('0xe'),JSON[_0x6e0e('0x11')](_0x35035c));if(_0x35035c[_0x6e0e('0x12')]){if(_0x35035c['error']['code']===0x1f4){logger[_0x6e0e('0x12')](_0x6e0e('0xd'),_0x3581d5,_0x35035c['error'][_0x6e0e('0x13')]);return _0x4fd523(_0x35035c['error'][_0x6e0e('0x13')]);}logger[_0x6e0e('0x12')](_0x6e0e('0xd'),_0x3581d5,_0x35035c[_0x6e0e('0x12')]['message']);return _0x20f66d(_0x35035c[_0x6e0e('0x12')][_0x6e0e('0x13')]);}else{logger[_0x6e0e('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3581d5,'request\x20sent');_0x20f66d(_0x35035c[_0x6e0e('0x14')][_0x6e0e('0x13')]);}})[_0x6e0e('0x15')](function(_0x1b39d5){logger[_0x6e0e('0x12')](_0x6e0e('0xd'),_0x3581d5,_0x1b39d5);_0x4fd523(_0x1b39d5);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c4582ca..79ba6c5 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 _0x590f=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x590f,0x13f));var _0xf590=function(_0x4ece29,_0xf47aa5){_0x4ece29=_0x4ece29-0x0;var _0x58f7bd=_0x590f[_0x4ece29];return _0x58f7bd;};'use strict';var multer=require(_0xf590('0x0'));var util=require(_0xf590('0x1'));var path=require(_0xf590('0x2'));var timeout=require(_0xf590('0x3'));var express=require(_0xf590('0x4'));var router=express[_0xf590('0x5')]();var auth=require(_0xf590('0x6'));var interaction=require(_0xf590('0x7'));var config=require(_0xf590('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0xf590('0x9')]('/',auth['isAuthenticated'](),controller[_0xf590('0xa')]);router[_0xf590('0x9')](_0xf590('0xb'),auth[_0xf590('0xc')](),controller[_0xf590('0xd')]);router[_0xf590('0x9')](_0xf590('0xe'),auth[_0xf590('0xc')](),controller[_0xf590('0xf')]);router[_0xf590('0x10')]('/',auth[_0xf590('0xc')](),controller[_0xf590('0x11')]);router[_0xf590('0x12')](_0xf590('0xe'),auth[_0xf590('0xc')](),controller[_0xf590('0x13')]);router[_0xf590('0x14')](_0xf590('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xf590('0x15')]=router; \ No newline at end of file +var _0x229d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x229d,0x13d));var _0xd229=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x229d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd229('0x0'));var util=require(_0xd229('0x1'));var path=require(_0xd229('0x2'));var timeout=require(_0xd229('0x3'));var express=require(_0xd229('0x4'));var router=express[_0xd229('0x5')]();var auth=require(_0xd229('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd229('0x7'));router[_0xd229('0x8')]('/',auth[_0xd229('0x9')](),controller[_0xd229('0xa')]);router['get'](_0xd229('0xb'),auth['isAuthenticated'](),controller[_0xd229('0xc')]);router[_0xd229('0x8')](_0xd229('0xd'),auth[_0xd229('0x9')](),controller[_0xd229('0xe')]);router[_0xd229('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd229('0x10')](_0xd229('0xd'),auth[_0xd229('0x9')](),controller[_0xd229('0x11')]);router[_0xd229('0x12')](_0xd229('0xd'),auth[_0xd229('0x9')](),controller[_0xd229('0x13')]);module[_0xd229('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 4cd294a..0ab08e1 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 _0x0990=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x0990,0x1be));var _0x0099=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x0990[_0x25248b];return _0x509939;};'use strict';var Sequelize=require(_0x0099('0x0'));module[_0x0099('0x1')]={'name':{'type':Sequelize[_0x0099('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0099('0x3'),_0x0099('0x4')),'defaultValue':_0x0099('0x3')},'selector':{'type':Sequelize[_0x0099('0x2')]},'timeout':{'type':Sequelize[_0x0099('0x5')]}}; \ No newline at end of file +var _0x32cf=['mouseOver','timeout','INTEGER','sequelize','STRING','ENUM'];(function(_0x20b665,_0x14edfa){var _0x115189=function(_0x5b80f5){while(--_0x5b80f5){_0x20b665['push'](_0x20b665['shift']());}};_0x115189(++_0x14edfa);}(_0x32cf,0x17d));var _0xf32c=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x32cf[_0xd0a847];return _0x2536ec;};'use strict';var Sequelize=require(_0xf32c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf32c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf32c('0x2')](_0xf32c('0x3'),_0xf32c('0x4')),'defaultValue':_0xf32c('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf32c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9942455..d1ad659 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 _0xb9a1=['sendStatus','end','status','offset','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','send','show','model','ChatProactiveAction','rawAttributes','keys','intersection','query','attributes','fields','length','include','options','find','catch','create','body','params','html-pdf','eml-format','rimraf','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xb9a1,0xf8));var _0x1b9a=function(_0x192279,_0x3d3669){_0x192279=_0x192279-0x0;var _0x2171a8=_0xb9a1[_0x192279];return _0x2171a8;};'use strict';var pdf=require(_0x1b9a('0x0'));var emlformat=require(_0x1b9a('0x1'));var rimraf=require(_0x1b9a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b9a('0x3'));var BPromise=require(_0x1b9a('0x4'));var Mustache=require(_0x1b9a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1b9a('0x6'));var csv=require('to-csv');var ejs=require(_0x1b9a('0x7'));var fs=require('fs');var _=require(_0x1b9a('0x8'));var squel=require(_0x1b9a('0x9'));var crypto=require('crypto');var jsforce=require(_0x1b9a('0xa'));var deskjs=require(_0x1b9a('0xb'));var toCsv=require(_0x1b9a('0xc'));var querystring=require(_0x1b9a('0xd'));var Papa=require(_0x1b9a('0xe'));var Redis=require(_0x1b9a('0xf'));var authService=require(_0x1b9a('0x10'));var qs=require(_0x1b9a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b9a('0x12'))(_0x1b9a('0x13'));var utils=require(_0x1b9a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b9a('0x15'))['db'];function respondWithStatusCode(_0x19c2d2,_0x432c2b){_0x432c2b=_0x432c2b||0xcc;return function(_0x5b1780){if(_0x5b1780){return _0x19c2d2[_0x1b9a('0x16')](_0x432c2b);}return _0x19c2d2['status'](_0x432c2b)[_0x1b9a('0x17')]();};}function respondWithResult(_0x14af48,_0x48fa67){_0x48fa67=_0x48fa67||0xc8;return function(_0x100e01){if(_0x100e01){return _0x14af48[_0x1b9a('0x18')](_0x48fa67)['json'](_0x100e01);}};}function respondWithFilteredResult(_0x1216de,_0x476be0){return function(_0x23d646){if(_0x23d646){var _0x242eb5=_0x23d646['count'],_0x2021d8=_0x476be0[_0x1b9a('0x19')],_0x1b1dfc=_0x476be0[_0x1b9a('0x19')]+_0x476be0[_0x1b9a('0x1a')],_0x5e8a8e;if(_0x1b1dfc>=_0x242eb5){_0x1b1dfc=_0x242eb5;_0x5e8a8e=0xc8;}else{_0x5e8a8e=0xce;}_0x1216de[_0x1b9a('0x18')](_0x5e8a8e);return _0x1216de['set'](_0x1b9a('0x1b'),_0x2021d8+'-'+_0x1b1dfc+'/'+_0x242eb5)[_0x1b9a('0x1c')](_0x23d646);}return null;};}function patchUpdates(_0x9ec9ba){return function(_0x42b8f7){try{jsonpatch[_0x1b9a('0x1d')](_0x42b8f7,_0x9ec9ba,!![]);}catch(_0x4c3002){return BPromise['reject'](_0x4c3002);}return _0x42b8f7[_0x1b9a('0x1e')]();};}function saveUpdates(_0x2f6c7c,_0x14d85c){return function(_0x507059){if(_0x507059){return _0x507059[_0x1b9a('0x1f')](_0x2f6c7c)[_0x1b9a('0x20')](function(_0x323867){return _0x323867;});}return null;};}function removeEntity(_0x4aeaf,_0x13df90){return function(_0x3cfbef){if(_0x3cfbef){return _0x3cfbef[_0x1b9a('0x21')]()[_0x1b9a('0x20')](function(){_0x4aeaf['status'](0xcc)[_0x1b9a('0x17')]();});}};}function handleEntityNotFound(_0x192c37,_0x3d46fc){return function(_0x288d59){if(!_0x288d59){_0x192c37[_0x1b9a('0x16')](0x194);}return _0x288d59;};}function handleError(_0x136029,_0x35bcb5){_0x35bcb5=_0x35bcb5||0x1f4;return function(_0x3dac3f){logger[_0x1b9a('0x22')](_0x3dac3f[_0x1b9a('0x23')]);if(_0x3dac3f['name']){delete _0x3dac3f['name'];}_0x136029[_0x1b9a('0x18')](_0x35bcb5)[_0x1b9a('0x24')](_0x3dac3f);};}exports[_0x1b9a('0x25')]=function(_0x187274,_0x239c75){var _0x1e92b2={'raw':!![],'where':{'id':_0x187274['params']['id']}},_0x2c7759={};_0x2c7759[_0x1b9a('0x26')]=_['keys'](db[_0x1b9a('0x27')][_0x1b9a('0x28')]);_0x2c7759['query']=_[_0x1b9a('0x29')](_0x187274['query']);_0x2c7759['filters']=_[_0x1b9a('0x2a')](_0x2c7759['model'],_0x2c7759[_0x1b9a('0x2b')]);_0x1e92b2[_0x1b9a('0x2c')]=_[_0x1b9a('0x2a')](_0x2c7759[_0x1b9a('0x26')],qs['fields'](_0x187274[_0x1b9a('0x2b')][_0x1b9a('0x2d')]));_0x1e92b2[_0x1b9a('0x2c')]=_0x1e92b2[_0x1b9a('0x2c')][_0x1b9a('0x2e')]?_0x1e92b2[_0x1b9a('0x2c')]:_0x2c7759['model'];if(_0x187274[_0x1b9a('0x2b')]['includeAll']){_0x1e92b2[_0x1b9a('0x2f')]=[{'all':!![]}];}_0x1e92b2=_['merge']({},_0x1e92b2,_0x187274[_0x1b9a('0x30')]);return db['ChatProactiveAction'][_0x1b9a('0x31')](_0x1e92b2)[_0x1b9a('0x20')](handleEntityNotFound(_0x239c75,null))[_0x1b9a('0x20')](respondWithResult(_0x239c75,null))[_0x1b9a('0x32')](handleError(_0x239c75,null));};exports['create']=function(_0x35af8c,_0x1b26c1){return db[_0x1b9a('0x27')][_0x1b9a('0x33')](_0x35af8c[_0x1b9a('0x34')],{})[_0x1b9a('0x20')](respondWithResult(_0x1b26c1,0xc9))['catch'](handleError(_0x1b26c1,null));};exports[_0x1b9a('0x1f')]=function(_0x33cebc,_0x311b53){if(_0x33cebc[_0x1b9a('0x34')]['id']){delete _0x33cebc['body']['id'];}return db['ChatProactiveAction'][_0x1b9a('0x31')]({'where':{'id':_0x33cebc[_0x1b9a('0x35')]['id']}})[_0x1b9a('0x20')](handleEntityNotFound(_0x311b53,null))[_0x1b9a('0x20')](saveUpdates(_0x33cebc['body'],null))['then'](respondWithResult(_0x311b53,null))['catch'](handleError(_0x311b53,null));};exports['destroy']=function(_0x362762,_0x33fabf){return db[_0x1b9a('0x27')][_0x1b9a('0x31')]({'where':{'id':_0x362762[_0x1b9a('0x35')]['id']}})['then'](handleEntityNotFound(_0x33fabf,null))[_0x1b9a('0x20')](removeEntity(_0x33fabf,null))['catch'](handleError(_0x33fabf,null));}; \ No newline at end of file +var _0xaafd=['reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','include','merge','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xaafd,0x1be));var _0xdaaf=function(_0x4057a1,_0x315235){_0x4057a1=_0x4057a1-0x0;var _0x12f4a3=_0xaafd[_0x4057a1];return _0x12f4a3;};'use strict';var pdf=require(_0xdaaf('0x0'));var emlformat=require(_0xdaaf('0x1'));var rimraf=require(_0xdaaf('0x2'));var zipdir=require(_0xdaaf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdaaf('0x4'));var moment=require(_0xdaaf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdaaf('0x6'));var util=require(_0xdaaf('0x7'));var path=require(_0xdaaf('0x8'));var sox=require(_0xdaaf('0x9'));var csv=require(_0xdaaf('0xa'));var ejs=require(_0xdaaf('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdaaf('0xc'));var crypto=require(_0xdaaf('0xd'));var jsforce=require(_0xdaaf('0xe'));var deskjs=require(_0xdaaf('0xf'));var toCsv=require(_0xdaaf('0xa'));var querystring=require(_0xdaaf('0x10'));var Papa=require('papaparse');var Redis=require(_0xdaaf('0x11'));var authService=require(_0xdaaf('0x12'));var qs=require(_0xdaaf('0x13'));var as=require(_0xdaaf('0x14'));var hardwareService=require(_0xdaaf('0x15'));var logger=require(_0xdaaf('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xdaaf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaaf('0x18'))['db'];function respondWithStatusCode(_0x57d930,_0x2a1c9e){_0x2a1c9e=_0x2a1c9e||0xcc;return function(_0x385d71){if(_0x385d71){return _0x57d930[_0xdaaf('0x19')](_0x2a1c9e);}return _0x57d930[_0xdaaf('0x1a')](_0x2a1c9e)[_0xdaaf('0x1b')]();};}function respondWithResult(_0x4801af,_0x4b62b6){_0x4b62b6=_0x4b62b6||0xc8;return function(_0x564f11){if(_0x564f11){return _0x4801af['status'](_0x4b62b6)[_0xdaaf('0x1c')](_0x564f11);}};}function respondWithFilteredResult(_0x2dba35,_0x5792cf){return function(_0x67c76f){if(_0x67c76f){var _0x2036b7=_0x67c76f[_0xdaaf('0x1d')],_0x50a409=_0x5792cf[_0xdaaf('0x1e')],_0x35b167=_0x5792cf['offset']+_0x5792cf[_0xdaaf('0x1f')],_0x3e91df;if(_0x35b167>=_0x2036b7){_0x35b167=_0x2036b7;_0x3e91df=0xc8;}else{_0x3e91df=0xce;}_0x2dba35[_0xdaaf('0x1a')](_0x3e91df);return _0x2dba35[_0xdaaf('0x20')](_0xdaaf('0x21'),_0x50a409+'-'+_0x35b167+'/'+_0x2036b7)[_0xdaaf('0x1c')](_0x67c76f);}return null;};}function patchUpdates(_0x11ab53){return function(_0x2985e8){try{jsonpatch['apply'](_0x2985e8,_0x11ab53,!![]);}catch(_0x1e59e1){return BPromise[_0xdaaf('0x22')](_0x1e59e1);}return _0x2985e8[_0xdaaf('0x23')]();};}function saveUpdates(_0x549eb3,_0x426e95){return function(_0xc1a010){if(_0xc1a010){return _0xc1a010[_0xdaaf('0x24')](_0x549eb3)[_0xdaaf('0x25')](function(_0x1f5cbf){return _0x1f5cbf;});}return null;};}function removeEntity(_0x912362,_0x2a529d){return function(_0x57f859){if(_0x57f859){return _0x57f859[_0xdaaf('0x26')]()[_0xdaaf('0x25')](function(){_0x912362[_0xdaaf('0x1a')](0xcc)[_0xdaaf('0x1b')]();});}};}function handleEntityNotFound(_0x597d2a,_0x28b8f0){return function(_0x471e29){if(!_0x471e29){_0x597d2a[_0xdaaf('0x19')](0x194);}return _0x471e29;};}function handleError(_0x323ad5,_0x3b095d){_0x3b095d=_0x3b095d||0x1f4;return function(_0x3b3a99){logger[_0xdaaf('0x27')](_0x3b3a99[_0xdaaf('0x28')]);if(_0x3b3a99[_0xdaaf('0x29')]){delete _0x3b3a99[_0xdaaf('0x29')];}_0x323ad5[_0xdaaf('0x1a')](_0x3b095d)[_0xdaaf('0x2a')](_0x3b3a99);};}exports[_0xdaaf('0x2b')]=function(_0x258996,_0x181928){var _0x1663a8={'raw':!![],'where':{'id':_0x258996[_0xdaaf('0x2c')]['id']}},_0xf2c713={};_0xf2c713[_0xdaaf('0x2d')]=_[_0xdaaf('0x2e')](db[_0xdaaf('0x2f')]['rawAttributes']);_0xf2c713[_0xdaaf('0x30')]=_['keys'](_0x258996[_0xdaaf('0x30')]);_0xf2c713['filters']=_['intersection'](_0xf2c713[_0xdaaf('0x2d')],_0xf2c713['query']);_0x1663a8['attributes']=_[_0xdaaf('0x31')](_0xf2c713[_0xdaaf('0x2d')],qs['fields'](_0x258996[_0xdaaf('0x30')]['fields']));_0x1663a8[_0xdaaf('0x32')]=_0x1663a8[_0xdaaf('0x32')][_0xdaaf('0x33')]?_0x1663a8[_0xdaaf('0x32')]:_0xf2c713[_0xdaaf('0x2d')];if(_0x258996[_0xdaaf('0x30')][_0xdaaf('0x34')]){_0x1663a8[_0xdaaf('0x35')]=[{'all':!![]}];}_0x1663a8=_[_0xdaaf('0x36')]({},_0x1663a8,_0x258996[_0xdaaf('0x37')]);return db[_0xdaaf('0x2f')][_0xdaaf('0x38')](_0x1663a8)[_0xdaaf('0x25')](handleEntityNotFound(_0x181928,null))['then'](respondWithResult(_0x181928,null))[_0xdaaf('0x39')](handleError(_0x181928,null));};exports[_0xdaaf('0x3a')]=function(_0x5b3b35,_0x22d8b3){return db['ChatProactiveAction'][_0xdaaf('0x3a')](_0x5b3b35[_0xdaaf('0x3b')],{})[_0xdaaf('0x25')](respondWithResult(_0x22d8b3,0xc9))['catch'](handleError(_0x22d8b3,null));};exports['update']=function(_0x4da020,_0x5d3e0c){if(_0x4da020[_0xdaaf('0x3b')]['id']){delete _0x4da020[_0xdaaf('0x3b')]['id'];}return db[_0xdaaf('0x2f')]['find']({'where':{'id':_0x4da020['params']['id']}})[_0xdaaf('0x25')](handleEntityNotFound(_0x5d3e0c,null))['then'](saveUpdates(_0x4da020[_0xdaaf('0x3b')],null))['then'](respondWithResult(_0x5d3e0c,null))[_0xdaaf('0x39')](handleError(_0x5d3e0c,null));};exports[_0xdaaf('0x26')]=function(_0x4b922a,_0x4cd208){return db[_0xdaaf('0x2f')][_0xdaaf('0x38')]({'where':{'id':_0x4b922a[_0xdaaf('0x2c')]['id']}})[_0xdaaf('0x25')](handleEntityNotFound(_0x4cd208,null))['then'](removeEntity(_0x4cd208,null))[_0xdaaf('0x39')](handleError(_0x4cd208,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7b331e3..ebb494e 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 _0x5626=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x3822e3,_0x3b6500){var _0x37e6c5=function(_0xa151){while(--_0xa151){_0x3822e3['push'](_0x3822e3['shift']());}};_0x37e6c5(++_0x3b6500);}(_0x5626,0x7d));var _0x6562=function(_0x3b6b1f,_0x1ced30){_0x3b6b1f=_0x3b6b1f-0x0;var _0x3fcafc=_0x5626[_0x3b6b1f];return _0x3fcafc;};'use strict';var _=require(_0x6562('0x0'));var util=require(_0x6562('0x1'));var logger=require(_0x6562('0x2'))('api');var moment=require(_0x6562('0x3'));var BPromise=require(_0x6562('0x4'));var rp=require(_0x6562('0x5'));var fs=require('fs');var path=require(_0x6562('0x6'));var rimraf=require(_0x6562('0x7'));var config=require(_0x6562('0x8'));var attributes=require(_0x6562('0x9'));module[_0x6562('0xa')]=function(_0x17416f,_0x16d6bc){return _0x17416f[_0x6562('0xb')](_0x6562('0xc'),attributes,{'tableName':_0x6562('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb7e=['moment','bluebird','request-promise','path','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x4e8cb0,_0x6a7716){var _0x32dabf=function(_0x2bafca){while(--_0x2bafca){_0x4e8cb0['push'](_0x4e8cb0['shift']());}};_0x32dabf(++_0x6a7716);}(_0xcb7e,0x193));var _0xecb7=function(_0x26d08d,_0x10b14c){_0x26d08d=_0x26d08d-0x0;var _0x3ff885=_0xcb7e[_0x26d08d];return _0x3ff885;};'use strict';var _=require(_0xecb7('0x0'));var util=require(_0xecb7('0x1'));var logger=require(_0xecb7('0x2'))(_0xecb7('0x3'));var moment=require(_0xecb7('0x4'));var BPromise=require(_0xecb7('0x5'));var rp=require(_0xecb7('0x6'));var fs=require('fs');var path=require(_0xecb7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xecb7('0x8')]=function(_0x174e5e,_0x2a47ed){return _0x174e5e['define'](_0xecb7('0x9'),attributes,{'tableName':_0xecb7('0xa'),'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 a94182d..5c5b2b1 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 _0x94c6=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x94c6,0xef));var _0x694c=function(_0x59db68,_0x1ae2bd){_0x59db68=_0x59db68-0x0;var _0x493ed3=_0x94c6[_0x59db68];return _0x493ed3;};'use strict';var _=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var moment=require('moment');var BPromise=require(_0x694c('0x2'));var rs=require(_0x694c('0x3'));var fs=require('fs');var Redis=require(_0x694c('0x4'));var db=require(_0x694c('0x5'))['db'];var utils=require(_0x694c('0x6'));var logger=require(_0x694c('0x7'))(_0x694c('0x8'));var config=require(_0x694c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x694c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2146,_0x461ea2,_0x2de30c){return new BPromise(function(_0x28f6f7,_0x3ed19c){return client['request'](_0x1f2146,_0x2de30c)[_0x694c('0xb')](function(_0x27a1b3){logger['info'](_0x694c('0xc'),_0x461ea2,_0x694c('0xd'));logger[_0x694c('0xe')](_0x694c('0xf'),_0x461ea2,_0x694c('0xd'),JSON['stringify'](_0x27a1b3));if(_0x27a1b3[_0x694c('0x10')]){if(_0x27a1b3[_0x694c('0x10')][_0x694c('0x11')]===0x1f4){logger['error'](_0x694c('0xc'),_0x461ea2,_0x27a1b3[_0x694c('0x10')][_0x694c('0x12')]);return _0x3ed19c(_0x27a1b3['error'][_0x694c('0x12')]);}logger[_0x694c('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x461ea2,_0x27a1b3[_0x694c('0x10')][_0x694c('0x12')]);return _0x28f6f7(_0x27a1b3[_0x694c('0x10')][_0x694c('0x12')]);}else{logger[_0x694c('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x461ea2,'request\x20sent');_0x28f6f7(_0x27a1b3[_0x694c('0x14')]['message']);}})['catch'](function(_0x501346){logger[_0x694c('0x10')](_0x694c('0xc'),_0x461ea2,_0x501346);_0x3ed19c(_0x501346);});});} \ No newline at end of file +var _0x680b=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0xba5e3f,_0x33f8cd){var _0x2b1cfa=function(_0x25d495){while(--_0x25d495){_0xba5e3f['push'](_0xba5e3f['shift']());}};_0x2b1cfa(++_0x33f8cd);}(_0x680b,0x72));var _0xb680=function(_0x1fb99b,_0x1454c3){_0x1fb99b=_0x1fb99b-0x0;var _0x921d11=_0x680b[_0x1fb99b];return _0x921d11;};'use strict';var _=require(_0xb680('0x0'));var util=require(_0xb680('0x1'));var moment=require(_0xb680('0x2'));var BPromise=require(_0xb680('0x3'));var rs=require(_0xb680('0x4'));var fs=require('fs');var Redis=require(_0xb680('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb680('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb680('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a35fa,_0x2fee50,_0x5d337b){return new BPromise(function(_0x2b540e,_0x5065fb){return client['request'](_0x1a35fa,_0x5d337b)[_0xb680('0x8')](function(_0x5307d0){logger[_0xb680('0x9')](_0xb680('0xa'),_0x2fee50,_0xb680('0xb'));logger['debug'](_0xb680('0xc'),_0x2fee50,'request\x20sent',JSON[_0xb680('0xd')](_0x5307d0));if(_0x5307d0[_0xb680('0xe')]){if(_0x5307d0[_0xb680('0xe')]['code']===0x1f4){logger[_0xb680('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2fee50,_0x5307d0[_0xb680('0xe')][_0xb680('0xf')]);return _0x5065fb(_0x5307d0[_0xb680('0xe')][_0xb680('0xf')]);}logger['error'](_0xb680('0xa'),_0x2fee50,_0x5307d0['error'][_0xb680('0xf')]);return _0x2b540e(_0x5307d0[_0xb680('0xe')][_0xb680('0xf')]);}else{logger[_0xb680('0x9')](_0xb680('0xa'),_0x2fee50,_0xb680('0xb'));_0x2b540e(_0x5307d0[_0xb680('0x10')][_0xb680('0xf')]);}})[_0xb680('0x11')](function(_0xe558fa){logger[_0xb680('0xe')](_0xb680('0xa'),_0x2fee50,_0xe558fa);_0x5065fb(_0xe558fa);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 4d34779..6625084 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 _0x4502=['Router','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x35d21d,_0xa0d8a){var _0x345d0e=function(_0x476cfc){while(--_0x476cfc){_0x35d21d['push'](_0x35d21d['shift']());}};_0x345d0e(++_0xa0d8a);}(_0x4502,0x157));var _0x2450=function(_0x20cbbf,_0x48a41f){_0x20cbbf=_0x20cbbf-0x0;var _0x247211=_0x4502[_0x20cbbf];return _0x247211;};'use strict';var multer=require(_0x2450('0x0'));var util=require('util');var path=require(_0x2450('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2450('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x2450('0x3'));var config=require(_0x2450('0x4'));var controller=require(_0x2450('0x5'));router[_0x2450('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2450('0x7')]('/',auth[_0x2450('0x8')](),controller['create']);router[_0x2450('0x9')](_0x2450('0xa'),auth[_0x2450('0x8')](),controller[_0x2450('0xb')]);router[_0x2450('0xc')](_0x2450('0xa'),auth['isAuthenticated'](),controller[_0x2450('0xd')]);module[_0x2450('0xe')]=router; \ No newline at end of file +var _0xe76a=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','post','create','put'];(function(_0x118c41,_0x47ae71){var _0x2bf5af=function(_0x17dd0e){while(--_0x17dd0e){_0x118c41['push'](_0x118c41['shift']());}};_0x2bf5af(++_0x47ae71);}(_0xe76a,0xd4));var _0xae76=function(_0x30fd17,_0x11c713){_0x30fd17=_0x30fd17-0x0;var _0x1df204=_0xe76a[_0x30fd17];return _0x1df204;};'use strict';var multer=require(_0xae76('0x0'));var util=require(_0xae76('0x1'));var path=require(_0xae76('0x2'));var timeout=require(_0xae76('0x3'));var express=require(_0xae76('0x4'));var router=express[_0xae76('0x5')]();var auth=require(_0xae76('0x6'));var interaction=require(_0xae76('0x7'));var config=require(_0xae76('0x8'));var controller=require(_0xae76('0x9'));router[_0xae76('0xa')](_0xae76('0xb'),auth[_0xae76('0xc')](),controller['show']);router[_0xae76('0xd')]('/',auth['isAuthenticated'](),controller[_0xae76('0xe')]);router[_0xae76('0xf')](_0xae76('0xb'),auth['isAuthenticated'](),controller[_0xae76('0x10')]);router[_0xae76('0x11')](_0xae76('0xb'),auth[_0xae76('0xc')](),controller[_0xae76('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 4e84da9..055b4a2 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 _0x8f5c=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x36d7fb,_0x15da5f){var _0x26df70=function(_0x3f85fd){while(--_0x3f85fd){_0x36d7fb['push'](_0x36d7fb['shift']());}};_0x26df70(++_0x15da5f);}(_0x8f5c,0x78));var _0xc8f5=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x8f5c[_0x4de1b1];return _0x639f27;};'use strict';var Sequelize=require(_0xc8f5('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8f5('0x1')],'unique':_0xc8f5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc8f5('0x1')]},'timeout':{'type':Sequelize[_0xc8f5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8f5('0x4')](_0xc8f5('0x5'),_0xc8f5('0x6'),_0xc8f5('0x7'))}}; \ No newline at end of file +var _0x1c4f=['INTEGER','roundrobin','sequelize','exports','name','STRING'];(function(_0x457339,_0x1f433f){var _0x7536c9=function(_0x5ded09){while(--_0x5ded09){_0x457339['push'](_0x457339['shift']());}};_0x7536c9(++_0x1f433f);}(_0x1c4f,0x128));var _0xf1c4=function(_0x3a9012,_0x14f910){_0x3a9012=_0x3a9012-0x0;var _0x3bfd2e=_0x1c4f[_0x3a9012];return _0x3bfd2e;};'use strict';var Sequelize=require(_0xf1c4('0x0'));module[_0xf1c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf1c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf1c4('0x3')]},'timeout':{'type':Sequelize[_0xf1c4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xf1c4('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ff58754..aabf5ea 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 _0xf57a=['offset','limit','set','apply','reject','save','update','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','nolimit','order','ChatQueueId','options','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','fields','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userChatQueue:save','ids','select','tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','isEmpty','forEach','omit','spread','removeAgents','userChatQueue:remove','getAgents','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','count'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xf57a,0x191));var _0xaf57=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xf57a[_0x1694f5];return _0x5b4321;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaf57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaf57('0x1'));var moment=require(_0xaf57('0x2'));var BPromise=require(_0xaf57('0x3'));var Mustache=require('mustache');var util=require(_0xaf57('0x4'));var path=require(_0xaf57('0x5'));var sox=require(_0xaf57('0x6'));var csv=require(_0xaf57('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xaf57('0x8'));var crypto=require(_0xaf57('0x9'));var jsforce=require(_0xaf57('0xa'));var deskjs=require(_0xaf57('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaf57('0xc'));var Papa=require(_0xaf57('0xd'));var Redis=require(_0xaf57('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaf57('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf57('0x10'));var logger=require(_0xaf57('0x11'))(_0xaf57('0x12'));var utils=require(_0xaf57('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xaf57('0x14'));var db=require('../../mysqldb')['db'];config[_0xaf57('0x15')]=_['defaults'](config['redis'],{'host':_0xaf57('0x16'),'port':0x18eb});var socket=require(_0xaf57('0x17'))(new Redis(config[_0xaf57('0x15')]));require(_0xaf57('0x18'))[_0xaf57('0x19')](socket);var jayson=require(_0xaf57('0x1a'));var client=jayson[_0xaf57('0x1b')][_0xaf57('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x548040,_0x2742bd,_0x2e575a,_0x27aa00){return new BPromise(function(_0x38ec95,_0x35bee0){var _0x62d681=_0x27aa00||client;return _0x62d681[_0xaf57('0x1d')](_0x548040,_0x2e575a)[_0xaf57('0x1e')](function(_0x475b72){logger[_0xaf57('0x1f')](_0xaf57('0x20'),_0x2742bd,_0xaf57('0x21'));logger['debug'](_0xaf57('0x22'),_0x2742bd,_0xaf57('0x21'),JSON[_0xaf57('0x23')](_0x475b72));if(_0x475b72[_0xaf57('0x24')]){if(_0x475b72['error'][_0xaf57('0x25')]===0x1f4){logger['error'](_0xaf57('0x20'),_0x2742bd,_0x475b72['error'][_0xaf57('0x26')]);return _0x35bee0(_0x475b72[_0xaf57('0x24')][_0xaf57('0x26')]);}logger[_0xaf57('0x24')](_0xaf57('0x20'),_0x2742bd,_0x475b72[_0xaf57('0x24')][_0xaf57('0x26')]);return _0x38ec95(_0x475b72[_0xaf57('0x24')]['message']);}else{logger[_0xaf57('0x1f')](_0xaf57('0x20'),_0x2742bd,_0xaf57('0x21'));_0x38ec95(_0x475b72[_0xaf57('0x27')]['message']);}})[_0xaf57('0x28')](function(_0xf30cb3){logger[_0xaf57('0x24')](_0xaf57('0x20'),_0x2742bd,_0xf30cb3);_0x35bee0(_0xf30cb3);});});}function respondWithStatusCode(_0x5129cd,_0x4ad629){_0x4ad629=_0x4ad629||0xcc;return function(_0x4c16e4){if(_0x4c16e4){return _0x5129cd['sendStatus'](_0x4ad629);}return _0x5129cd['status'](_0x4ad629)['end']();};}function respondWithResult(_0x1e9684,_0xbd92f6){_0xbd92f6=_0xbd92f6||0xc8;return function(_0x4c8618){if(_0x4c8618){return _0x1e9684[_0xaf57('0x29')](_0xbd92f6)['json'](_0x4c8618);}};}function respondWithFilteredResult(_0x52ef2b,_0x4c9737){return function(_0x345cbf){if(_0x345cbf){var _0x292e8b=_0x345cbf[_0xaf57('0x2a')],_0xdade2b=_0x4c9737[_0xaf57('0x2b')],_0x37cd0c=_0x4c9737['offset']+_0x4c9737[_0xaf57('0x2c')],_0x16e6a3;if(_0x37cd0c>=_0x292e8b){_0x37cd0c=_0x292e8b;_0x16e6a3=0xc8;}else{_0x16e6a3=0xce;}_0x52ef2b[_0xaf57('0x29')](_0x16e6a3);return _0x52ef2b[_0xaf57('0x2d')]('Content-Range',_0xdade2b+'-'+_0x37cd0c+'/'+_0x292e8b)['json'](_0x345cbf);}return null;};}function patchUpdates(_0x1f12a1){return function(_0x34b246){try{jsonpatch[_0xaf57('0x2e')](_0x34b246,_0x1f12a1,!![]);}catch(_0x2ace0e){return BPromise[_0xaf57('0x2f')](_0x2ace0e);}return _0x34b246[_0xaf57('0x30')]();};}function saveUpdates(_0x8915e3,_0x45eba8){return function(_0x51d6b0){if(_0x51d6b0){return _0x51d6b0[_0xaf57('0x31')](_0x8915e3)['then'](function(_0x11c6dd){return _0x11c6dd;});}return null;};}function removeEntity(_0x4bccf2,_0x18e56f){return function(_0x1dcf97){if(_0x1dcf97){return _0x1dcf97['destroy']()[_0xaf57('0x1e')](function(){var _0x1c6ef7=_0x1dcf97[_0xaf57('0x32')]({'plain':!![]});var _0x380b50='ChatQueues';return db[_0xaf57('0x33')][_0xaf57('0x34')]({'where':{'type':_0x380b50,'resourceId':_0x1c6ef7['id']}})[_0xaf57('0x1e')](function(){return _0x1dcf97;});})[_0xaf57('0x1e')](function(){_0x4bccf2[_0xaf57('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d933a,_0x5c02dd){return function(_0x152c3a){if(!_0x152c3a){_0x4d933a[_0xaf57('0x35')](0x194);}return _0x152c3a;};}function handleError(_0x1d2e9f,_0x6eb23e){_0x6eb23e=_0x6eb23e||0x1f4;return function(_0x43c7b4){logger[_0xaf57('0x24')](_0x43c7b4[_0xaf57('0x36')]);if(_0x43c7b4[_0xaf57('0x37')]){delete _0x43c7b4[_0xaf57('0x37')];}_0x1d2e9f[_0xaf57('0x29')](_0x6eb23e)[_0xaf57('0x38')](_0x43c7b4);};}exports[_0xaf57('0x39')]=function(_0x22205c,_0x27f9bf){var _0x3e935b={},_0x2835b4={},_0x1a9797={'count':0x0,'rows':[]};var _0x4c596b=_[_0xaf57('0x3a')](db[_0xaf57('0x3b')][_0xaf57('0x3c')],function(_0xf2fdaa){return{'name':_0xf2fdaa[_0xaf57('0x3d')],'type':_0xf2fdaa[_0xaf57('0x3e')][_0xaf57('0x3f')]};});_0x2835b4[_0xaf57('0x40')]=_[_0xaf57('0x3a')](_0x4c596b,_0xaf57('0x37'));_0x2835b4[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x22205c[_0xaf57('0x41')]);_0x2835b4['filters']=_[_0xaf57('0x43')](_0x2835b4['model'],_0x2835b4[_0xaf57('0x41')]);_0x3e935b[_0xaf57('0x44')]=_[_0xaf57('0x43')](_0x2835b4[_0xaf57('0x40')],qs['fields'](_0x22205c['query']['fields']));_0x3e935b[_0xaf57('0x44')]=_0x3e935b[_0xaf57('0x44')]['length']?_0x3e935b[_0xaf57('0x44')]:_0x2835b4[_0xaf57('0x40')];if(!_0x22205c[_0xaf57('0x41')][_0xaf57('0x45')]('nolimit')){_0x3e935b['limit']=qs[_0xaf57('0x2c')](_0x22205c['query'][_0xaf57('0x2c')]);_0x3e935b[_0xaf57('0x2b')]=qs[_0xaf57('0x2b')](_0x22205c[_0xaf57('0x41')][_0xaf57('0x2b')]);}_0x3e935b['order']=qs[_0xaf57('0x46')](_0x22205c['query'][_0xaf57('0x46')]);_0x3e935b[_0xaf57('0x47')]=qs[_0xaf57('0x48')](_[_0xaf57('0x49')](_0x22205c[_0xaf57('0x41')],_0x2835b4[_0xaf57('0x48')]),_0x4c596b);if(_0x22205c[_0xaf57('0x41')][_0xaf57('0x4a')]){_0x3e935b[_0xaf57('0x47')]=_[_0xaf57('0x4b')](_0x3e935b[_0xaf57('0x47')],{'$or':_['map'](_0x4c596b,function(_0x519053){if(_0x519053[_0xaf57('0x3e')]!==_0xaf57('0x4c')){var _0x265acd={};_0x265acd[_0x519053[_0xaf57('0x37')]]={'$like':'%'+_0x22205c[_0xaf57('0x41')][_0xaf57('0x4a')]+'%'};return _0x265acd;}})});}_0x3e935b=_[_0xaf57('0x4b')]({},_0x3e935b,_0x22205c['options']);var _0x525166={'where':_0x3e935b[_0xaf57('0x47')]};return db[_0xaf57('0x3b')][_0xaf57('0x2a')](_0x525166)[_0xaf57('0x1e')](function(_0x35089f){_0x1a9797[_0xaf57('0x2a')]=_0x35089f;if(_0x22205c[_0xaf57('0x41')][_0xaf57('0x4d')]){_0x3e935b[_0xaf57('0x4e')]=[{'all':!![]}];}return db[_0xaf57('0x3b')][_0xaf57('0x4f')](_0x3e935b);})['then'](function(_0x481881){_0x1a9797[_0xaf57('0x50')]=_0x481881;return _0x1a9797;})[_0xaf57('0x1e')](respondWithFilteredResult(_0x27f9bf,_0x3e935b))[_0xaf57('0x28')](handleError(_0x27f9bf,null));};exports[_0xaf57('0x51')]=function(_0x149240,_0x4a7f0f){var _0x55b22f={'raw':!![],'where':{'id':_0x149240[_0xaf57('0x52')]['id']}},_0x3fe909={};_0x3fe909[_0xaf57('0x40')]=_[_0xaf57('0x42')](db['ChatQueue'][_0xaf57('0x3c')]);_0x3fe909[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x149240[_0xaf57('0x41')]);_0x3fe909['filters']=_['intersection'](_0x3fe909[_0xaf57('0x40')],_0x3fe909[_0xaf57('0x41')]);_0x55b22f[_0xaf57('0x44')]=_[_0xaf57('0x43')](_0x3fe909[_0xaf57('0x40')],qs['fields'](_0x149240[_0xaf57('0x41')]['fields']));_0x55b22f['attributes']=_0x55b22f['attributes'][_0xaf57('0x53')]?_0x55b22f[_0xaf57('0x44')]:_0x3fe909[_0xaf57('0x40')];if(_0x149240[_0xaf57('0x41')]['includeAll']){_0x55b22f[_0xaf57('0x4e')]=[{'all':!![]}];}_0x55b22f=_[_0xaf57('0x4b')]({},_0x55b22f,_0x149240['options']);return db[_0xaf57('0x3b')][_0xaf57('0x54')](_0x55b22f)[_0xaf57('0x1e')](handleEntityNotFound(_0x4a7f0f,null))['then'](respondWithResult(_0x4a7f0f,null))[_0xaf57('0x28')](handleError(_0x4a7f0f,null));};exports[_0xaf57('0x55')]=function(_0x32bafe,_0x5eeeb5){return db[_0xaf57('0x3b')]['create'](_0x32bafe['body'],{})['then'](function(_0x39a4b6){var _0xe44130=_0x32bafe[_0xaf57('0x56')][_0xaf57('0x32')]({'plain':!![]});if(!_0xe44130)throw new Error(_0xaf57('0x57'));if(_0xe44130[_0xaf57('0x58')]===_0xaf57('0x56')){var _0x5b2332=_0x39a4b6['get']({'plain':!![]});var _0x520cc4=_0xaf57('0x59');return db[_0xaf57('0x5a')]['find']({'where':{'name':_0x520cc4,'userProfileId':_0xe44130[_0xaf57('0x5b')]},'raw':!![]})[_0xaf57('0x1e')](function(_0x646906){if(_0x646906&&_0x646906[_0xaf57('0x5c')]===0x0){return db['UserProfileResource'][_0xaf57('0x55')]({'name':_0x5b2332['name'],'resourceId':_0x5b2332['id'],'type':_0x646906[_0xaf57('0x37')],'sectionId':_0x646906['id']},{})[_0xaf57('0x1e')](function(){return _0x39a4b6;});}else{return _0x39a4b6;}})[_0xaf57('0x28')](function(_0x291258){logger[_0xaf57('0x24')](_0xaf57('0x5d'),_0x291258);throw _0x291258;});}return _0x39a4b6;})['then'](respondWithResult(_0x5eeeb5,0xc9))[_0xaf57('0x28')](handleError(_0x5eeeb5,null));};exports[_0xaf57('0x31')]=function(_0x195c2b,_0xbef752){if(_0x195c2b[_0xaf57('0x5e')]['id']){delete _0x195c2b[_0xaf57('0x5e')]['id'];}return db[_0xaf57('0x3b')][_0xaf57('0x54')]({'where':{'id':_0x195c2b[_0xaf57('0x52')]['id']}})[_0xaf57('0x1e')](handleEntityNotFound(_0xbef752,null))[_0xaf57('0x1e')](saveUpdates(_0x195c2b[_0xaf57('0x5e')],null))[_0xaf57('0x1e')](respondWithResult(_0xbef752,null))[_0xaf57('0x28')](handleError(_0xbef752,null));};exports[_0xaf57('0x34')]=function(_0x243afb,_0x5b8f84){return db[_0xaf57('0x3b')][_0xaf57('0x54')]({'where':{'id':_0x243afb['params']['id']}})[_0xaf57('0x1e')](handleEntityNotFound(_0x5b8f84,null))['then'](removeEntity(_0x5b8f84,null))[_0xaf57('0x28')](handleError(_0x5b8f84,null));};exports[_0xaf57('0x5f')]=function(_0x324a5d,_0x35649c){return db['ChatQueue'][_0xaf57('0x5f')]()[_0xaf57('0x1e')](respondWithResult(_0x35649c,null))[_0xaf57('0x28')](handleError(_0x35649c,null));};exports[_0xaf57('0x60')]=function(_0x5c93c4,_0x1d0e43,_0x58ab15){var _0x2c0e22={'raw':!![],'where':{}},_0x276fd4={},_0x56dc4d;return db['ChatQueue'][_0xaf57('0x61')]({'where':{'id':_0x5c93c4['params']['id']}})['then'](handleEntityNotFound(_0x1d0e43,null))[_0xaf57('0x1e')](function(_0xdd9ce7){if(_0xdd9ce7){_0x56dc4d=_0xdd9ce7['get']({'plain':!![]});_0x276fd4[_0xaf57('0x40')]=_[_0xaf57('0x42')](db[_0xaf57('0x62')][_0xaf57('0x3c')]);_0x276fd4[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x5c93c4[_0xaf57('0x41')]);_0x276fd4[_0xaf57('0x48')]=_[_0xaf57('0x43')](_0x276fd4['model'],_0x276fd4[_0xaf57('0x41')]);_0x2c0e22[_0xaf57('0x44')]=_[_0xaf57('0x43')](_0x276fd4[_0xaf57('0x40')],qs['fields'](_0x5c93c4['query']['fields']));_0x2c0e22[_0xaf57('0x44')]=_0x2c0e22['attributes'][_0xaf57('0x53')]?_0x2c0e22['attributes']:_0x276fd4['model'];if(!_0x5c93c4[_0xaf57('0x41')]['hasOwnProperty'](_0xaf57('0x63'))){_0x2c0e22[_0xaf57('0x2c')]=qs[_0xaf57('0x2c')](_0x5c93c4[_0xaf57('0x41')]['limit']);_0x2c0e22[_0xaf57('0x2b')]=qs[_0xaf57('0x2b')](_0x5c93c4[_0xaf57('0x41')][_0xaf57('0x2b')]);}_0x2c0e22[_0xaf57('0x64')]=qs[_0xaf57('0x46')](_0x5c93c4[_0xaf57('0x41')][_0xaf57('0x46')]);_0x2c0e22[_0xaf57('0x47')]=qs['filters'](_[_0xaf57('0x49')](_0x5c93c4[_0xaf57('0x41')],_0x276fd4[_0xaf57('0x48')]));_0x2c0e22['where'][_0xaf57('0x65')]=_0xdd9ce7['id'];if(_0x5c93c4[_0xaf57('0x41')][_0xaf57('0x4a')]){_0x2c0e22[_0xaf57('0x47')]=_[_0xaf57('0x4b')](_0x2c0e22['where'],{'$or':_['map'](_0x2c0e22['attributes'],function(_0x27f44d){var _0x3b1188={};_0x3b1188[_0x27f44d]={'$like':'%'+_0x5c93c4[_0xaf57('0x41')][_0xaf57('0x4a')]+'%'};return _0x3b1188;})});}_0x2c0e22=_[_0xaf57('0x4b')]({},_0x2c0e22,_0x5c93c4[_0xaf57('0x66')]);return db[_0xaf57('0x62')][_0xaf57('0x4f')](_0x2c0e22);}})[_0xaf57('0x1e')](function(_0x4e84c9){if(_0x4e84c9){return db[_0xaf57('0x67')][_0xaf57('0x68')]({'where':{'id':_[_0xaf57('0x3a')](_0x4e84c9,_0xaf57('0x69')),'role':_0xaf57('0x6a')},'attributes':['id','name','chatPause',_0xaf57('0x6b'),_0xaf57('0x6c')]});}})[_0xaf57('0x1e')](function(_0x78acc0){if(_0x78acc0){return{'count':_0x78acc0[_0xaf57('0x2a')],'rows':_[_0xaf57('0x3a')](_0x78acc0[_0xaf57('0x50')],function(_0x548e0a){return{'membername':_0x548e0a[_0xaf57('0x37')],'UserId':_0x548e0a['id'],'queue_name':_0x56dc4d[_0xaf57('0x37')],'ChatQueueId':_0x56dc4d['id'],'interface':util[_0xaf57('0x6d')](_0xaf57('0x6e'),_0xaf57('0x6f'),_0x548e0a[_0xaf57('0x37')]),'penalty':0x0,'paused':_0x548e0a['chatPause'],'createdAt':_0x548e0a['createdAt'],'updatedAt':_0x548e0a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d0e43,_0x2c0e22))['catch'](handleError(_0x1d0e43,null));};exports[_0xaf57('0x70')]=function(_0x1e992c,_0x15aad3,_0x7b07e3){var _0x3bcd18={};var _0x16b6f6={};var _0x4d3c1a;var _0x381281;return db['ChatQueue']['findOne']({'where':{'id':_0x1e992c['params']['id']}})[_0xaf57('0x1e')](handleEntityNotFound(_0x15aad3,null))[_0xaf57('0x1e')](function(_0x570dac){if(_0x570dac){_0x4d3c1a=_0x570dac;_0x16b6f6[_0xaf57('0x40')]=_[_0xaf57('0x42')](db[_0xaf57('0x71')]['rawAttributes']);_0x16b6f6[_0xaf57('0x41')]=_[_0xaf57('0x42')](_0x1e992c[_0xaf57('0x41')]);_0x16b6f6['filters']=_[_0xaf57('0x43')](_0x16b6f6[_0xaf57('0x40')],_0x16b6f6[_0xaf57('0x41')]);_0x3bcd18[_0xaf57('0x44')]=_['intersection'](_0x16b6f6[_0xaf57('0x40')],qs[_0xaf57('0x72')](_0x1e992c[_0xaf57('0x41')][_0xaf57('0x72')]));_0x3bcd18[_0xaf57('0x44')]=_0x3bcd18['attributes'][_0xaf57('0x53')]?_0x3bcd18[_0xaf57('0x44')]:_0x16b6f6[_0xaf57('0x40')];_0x3bcd18['order']=qs[_0xaf57('0x46')](_0x1e992c[_0xaf57('0x41')][_0xaf57('0x46')]);_0x3bcd18['where']=qs[_0xaf57('0x48')](_['pick'](_0x1e992c[_0xaf57('0x41')],_0x16b6f6[_0xaf57('0x48')]));if(_0x1e992c[_0xaf57('0x41')][_0xaf57('0x4a')]){_0x3bcd18[_0xaf57('0x47')]=_[_0xaf57('0x4b')](_0x3bcd18['where'],{'$or':_[_0xaf57('0x3a')](_0x3bcd18[_0xaf57('0x44')],function(_0x4b67be){var _0xdc18e0={};_0xdc18e0[_0x4b67be]={'$like':'%'+_0x1e992c[_0xaf57('0x41')][_0xaf57('0x4a')]+'%'};return _0xdc18e0;})});}_0x3bcd18=_['merge']({},_0x3bcd18,_0x1e992c['options']);return _0x4d3c1a[_0xaf57('0x70')](_0x3bcd18);}})[_0xaf57('0x1e')](function(_0x19dc50){if(_0x19dc50){_0x381281=_0x19dc50[_0xaf57('0x53')];if(!_0x1e992c[_0xaf57('0x41')][_0xaf57('0x45')](_0xaf57('0x63'))){_0x3bcd18['limit']=qs[_0xaf57('0x2c')](_0x1e992c[_0xaf57('0x41')][_0xaf57('0x2c')]);_0x3bcd18[_0xaf57('0x2b')]=qs['offset'](_0x1e992c[_0xaf57('0x41')][_0xaf57('0x2b')]);}return _0x4d3c1a['getTeams'](_0x3bcd18);}})[_0xaf57('0x1e')](function(_0x1951c7){if(_0x1951c7){return _0x1951c7?{'count':_0x381281,'rows':_0x1951c7}:null;}})[_0xaf57('0x1e')](respondWithResult(_0x15aad3,null))[_0xaf57('0x28')](handleError(_0x15aad3,null));};exports[_0xaf57('0x73')]=function(_0x3fc64c,_0x315435,_0x4b27e2){var _0x59e145=_0x3fc64c[_0xaf57('0x5e')]['ids'];return db['Team'][_0xaf57('0x4f')]({'where':{'id':_0x59e145},'attributes':['id'],'include':[{'model':db[_0xaf57('0x67')],'as':_0xaf57('0x74'),'attributes':['id',_0xaf57('0x37'),_0xaf57('0x75'),_0xaf57('0x76'),_0xaf57('0x77')],'raw':!![]}]})[_0xaf57('0x1e')](function(_0x41c80d){if(_0x41c80d){var _0x1671dc=_[_0xaf57('0x78')](_0x41c80d,function(_0x3f23b0){var _0x42eb06=_0x3f23b0['get']({'plain':!![]});return _0x42eb06['Agents'];});return db[_0xaf57('0x3b')][_0xaf57('0x54')]({'where':{'id':_0x3fc64c[_0xaf57('0x52')]['id']}})['then'](function(_0x2cb91c){return db[_0xaf57('0x79')][_0xaf57('0x7a')](function(_0x24e1f1){return _0x2cb91c[_0xaf57('0x73')](_0x59e145,{'transaction':_0x24e1f1})['then'](function(){return BPromise[_0xaf57('0x7b')](_0x1671dc,function(_0x3bce32){return db[_0xaf57('0x62')]['findOrCreate']({'where':{'UserId':_0x3bce32['id'],'ChatQueueId':_0x3fc64c[_0xaf57('0x52')]['id']},'transaction':_0x24e1f1});});})[_0xaf57('0x1e')](function(){_0x1671dc['forEach'](function(_0x433f11){socket[_0xaf57('0x7c')](_0xaf57('0x7d'),{'UserId':_0x433f11['id'],'ChatQueueId':_0x2cb91c['id']});});});});});}})[_0xaf57('0x1e')](respondWithStatusCode(_0x315435,null))[_0xaf57('0x28')](handleError(_0x315435,null));};exports['removeTeams']=function(_0x6398b5,_0xb1720e,_0x178aa8){return db[_0xaf57('0x71')][_0xaf57('0x4f')]({'where':{'id':_0x6398b5[_0xaf57('0x41')][_0xaf57('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xaf57('0x67')],'as':_0xaf57('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xb1720e,null))[_0xaf57('0x1e')](function(_0xb66350){var _0x1d1c00=_[_0xaf57('0x3a')](_0xb66350,'id');var _0x3fbabc=[];var _0x562d85=[];var _0x51d274=squel[_0xaf57('0x7f')]();_0x51d274['field'](_0xaf57('0x80'))[_0xaf57('0x81')]('team_has_chat_queues','tq')[_0xaf57('0x82')](_0xaf57('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xaf57('0x47')](_0xaf57('0x84'),_0x6398b5[_0xaf57('0x52')]['id']);for(var _0x597dc1=0x0;_0x597dc1<_0xb66350[_0xaf57('0x53')];_0x597dc1+=0x1){let _0x2af483=_0xb66350[_0x597dc1];for(var _0x4e8527=0x0;_0x4e8527<_0x2af483['Agents'][_0xaf57('0x53')];_0x4e8527+=0x1){let _0x265542=_0x2af483[_0xaf57('0x74')][_0x4e8527];var _0x28a404=_0x51d274['clone']();_0x28a404[_0xaf57('0x47')]('ut.UserId\x20=\x20?',_0x265542['id']);_0x562d85[_0xaf57('0x85')](db[_0xaf57('0x79')][_0xaf57('0x41')](_0x28a404['toString'](),{'type':db[_0xaf57('0x79')][_0xaf57('0x86')][_0xaf57('0x87')]})[_0xaf57('0x1e')](function(_0x2a2f39){if(_0x2a2f39[_0xaf57('0x53')]===0x1){return _0x265542['id'];}else{var _0x3cf834=_[_0xaf57('0x88')](_[_0xaf57('0x3a')](_0x2a2f39,_0xaf57('0x89')),function(_0x3c1bac){return _[_0xaf57('0x8a')](_0x1d1c00,_0x3c1bac);});if(_0x3cf834){return _0x265542['id'];}}}));}}return BPromise['all'](_0x562d85)['then'](function(_0x2ebddc){_0x3fbabc=_(_0x3fbabc)[_0xaf57('0x8b')](_0x2ebddc)['compact']()['value']();return db['ChatQueue']['find']({'where':{'id':_0x6398b5[_0xaf57('0x52')]['id']}})[_0xaf57('0x1e')](function(_0x5124dd){return db[_0xaf57('0x79')][_0xaf57('0x7a')](function(_0x58d12b){return _0x5124dd[_0xaf57('0x8c')](_0x6398b5[_0xaf57('0x41')]['ids'],{'transaction':_0x58d12b})[_0xaf57('0x1e')](function(){if(!_[_0xaf57('0x8d')](_0x3fbabc)){return _0x5124dd['removeAgents'](_0x3fbabc,{'transaction':_0x58d12b});}})[_0xaf57('0x1e')](function(){_0x3fbabc[_0xaf57('0x8e')](function(_0x209a6c){socket[_0xaf57('0x7c')]('userChatQueue:remove',{'UserId':_0x209a6c,'ChatQueueId':_0x5124dd['id']});});});});});});})['then'](respondWithStatusCode(_0xb1720e,null))[_0xaf57('0x28')](handleError(_0xb1720e,null));};exports['addAgents']=function(_0x3e0ace,_0x2b5632,_0x345a91){return db['ChatQueue'][_0xaf57('0x54')]({'where':{'id':_0x3e0ace['params']['id']}})[_0xaf57('0x1e')](handleEntityNotFound(_0x2b5632,null))[_0xaf57('0x1e')](function(_0x90707e){if(_0x90707e){return _0x90707e['addAgents'](_0x3e0ace[_0xaf57('0x5e')][_0xaf57('0x7e')],_[_0xaf57('0x8f')](_0x3e0ace[_0xaf57('0x5e')],[_0xaf57('0x7e'),'id'])||{})[_0xaf57('0x90')](function(_0x129124){for(var _0x59dc49=0x0;_0x59dc49<_0x3e0ace[_0xaf57('0x5e')][_0xaf57('0x7e')][_0xaf57('0x53')];_0x59dc49+=0x1){socket[_0xaf57('0x7c')](_0xaf57('0x7d'),{'UserId':_0x3e0ace['body'][_0xaf57('0x7e')][_0x59dc49],'ChatQueueId':_0x3e0ace[_0xaf57('0x52')]['id']});}return _0x129124;});}})['then'](respondWithResult(_0x2b5632,null))[_0xaf57('0x28')](handleError(_0x2b5632,null));};exports[_0xaf57('0x91')]=function(_0x2f2632,_0xc3484e,_0x39fb22){return db[_0xaf57('0x3b')][_0xaf57('0x54')]({'where':{'id':_0x2f2632[_0xaf57('0x52')]['id']}})[_0xaf57('0x1e')](handleEntityNotFound(_0xc3484e,null))['then'](function(_0x3ddb0f){if(_0x3ddb0f){return _0x3ddb0f[_0xaf57('0x91')](_0x2f2632['query'][_0xaf57('0x7e')])[_0xaf57('0x1e')](function(){if(_['isArray'](_0x2f2632[_0xaf57('0x41')][_0xaf57('0x7e')])){for(var _0x4b9a1f=0x0;_0x4b9a1f<_0x2f2632['query'][_0xaf57('0x7e')][_0xaf57('0x53')];_0x4b9a1f+=0x1){socket[_0xaf57('0x7c')](_0xaf57('0x92'),{'UserId':Number(_0x2f2632['query'][_0xaf57('0x7e')][_0x4b9a1f]),'ChatQueueId':Number(_0x2f2632['params']['id'])});}}else{socket['emit'](_0xaf57('0x92'),{'UserId':Number(_0x2f2632[_0xaf57('0x41')][_0xaf57('0x7e')]),'ChatQueueId':Number(_0x2f2632[_0xaf57('0x52')]['id'])});}});}})[_0xaf57('0x1e')](respondWithStatusCode(_0xc3484e,null))[_0xaf57('0x28')](handleError(_0xc3484e,null));};exports['getAgents']=function(_0xff627e,_0x3cb9ba,_0x15d17c){var _0x2fce60={};var _0x3dec90={};var _0x82cc39;var _0x49b253;return db[_0xaf57('0x3b')][_0xaf57('0x61')]({'where':{'id':_0xff627e[_0xaf57('0x52')]['id']}})[_0xaf57('0x1e')](handleEntityNotFound(_0x3cb9ba,null))['then'](function(_0x18d6e5){if(_0x18d6e5){_0x82cc39=_0x18d6e5;_0x3dec90[_0xaf57('0x40')]=_['keys'](db[_0xaf57('0x67')][_0xaf57('0x3c')]);_0x3dec90['query']=_[_0xaf57('0x42')](_0xff627e[_0xaf57('0x41')]);_0x3dec90[_0xaf57('0x48')]=_[_0xaf57('0x43')](_0x3dec90['model'],_0x3dec90[_0xaf57('0x41')]);_0x2fce60['attributes']=_[_0xaf57('0x43')](_0x3dec90[_0xaf57('0x40')],qs[_0xaf57('0x72')](_0xff627e[_0xaf57('0x41')]['fields']));_0x2fce60[_0xaf57('0x44')]=_0x2fce60[_0xaf57('0x44')][_0xaf57('0x53')]?_0x2fce60[_0xaf57('0x44')]:_0x3dec90[_0xaf57('0x40')];_0x2fce60[_0xaf57('0x64')]=qs['sort'](_0xff627e[_0xaf57('0x41')][_0xaf57('0x46')]);_0x2fce60[_0xaf57('0x47')]=qs[_0xaf57('0x48')](_[_0xaf57('0x49')](_0xff627e[_0xaf57('0x41')],_0x3dec90[_0xaf57('0x48')]));if(_0xff627e[_0xaf57('0x41')][_0xaf57('0x4a')]){_0x2fce60[_0xaf57('0x47')]=_[_0xaf57('0x4b')](_0x2fce60[_0xaf57('0x47')],{'$or':_[_0xaf57('0x3a')](_0x2fce60['attributes'],function(_0x4bf3ff){var _0x187ca1={};_0x187ca1[_0x4bf3ff]={'$like':'%'+_0xff627e[_0xaf57('0x41')][_0xaf57('0x4a')]+'%'};return _0x187ca1;})});}_0x2fce60=_[_0xaf57('0x4b')]({},_0x2fce60,_0xff627e[_0xaf57('0x66')]);return _0x82cc39[_0xaf57('0x93')](_0x2fce60);}})[_0xaf57('0x1e')](function(_0x3c87b4){if(_0x3c87b4){_0x49b253=_0x3c87b4[_0xaf57('0x53')];if(!_0xff627e['query'][_0xaf57('0x45')](_0xaf57('0x63'))){_0x2fce60[_0xaf57('0x2c')]=qs['limit'](_0xff627e[_0xaf57('0x41')][_0xaf57('0x2c')]);_0x2fce60['offset']=qs[_0xaf57('0x2b')](_0xff627e[_0xaf57('0x41')][_0xaf57('0x2b')]);}return _0x82cc39['getAgents'](_0x2fce60);}})[_0xaf57('0x1e')](function(_0x694a7a){if(_0x694a7a){return _0x694a7a?{'count':_0x49b253,'rows':_0x694a7a}:null;}})['then'](respondWithResult(_0x3cb9ba,null))[_0xaf57('0x28')](handleError(_0x3cb9ba,null));}; \ No newline at end of file +var _0xe310=['apply','reject','update','destroy','get','UserProfileResource','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','nolimit','ids','Team','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','TeamId','includes','all','union','compact','value','transaction','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0xd2c333,_0x1f438f){var _0x57ae06=function(_0x46b424){while(--_0x46b424){_0xd2c333['push'](_0xd2c333['shift']());}};_0x57ae06(++_0x1f438f);}(_0xe310,0x198));var _0x0e31=function(_0x39b9ba,_0x11680d){_0x39b9ba=_0x39b9ba-0x0;var _0xb62149=_0xe310[_0x39b9ba];return _0xb62149;};'use strict';var pdf=require(_0x0e31('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e31('0x1'));var zipdir=require(_0x0e31('0x2'));var jsonpatch=require(_0x0e31('0x3'));var rp=require('request-promise');var moment=require(_0x0e31('0x4'));var BPromise=require(_0x0e31('0x5'));var Mustache=require('mustache');var util=require(_0x0e31('0x6'));var path=require(_0x0e31('0x7'));var sox=require(_0x0e31('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0e31('0x9'));var crypto=require('crypto');var jsforce=require(_0x0e31('0xa'));var deskjs=require(_0x0e31('0xb'));var toCsv=require(_0x0e31('0xc'));var querystring=require(_0x0e31('0xd'));var Papa=require(_0x0e31('0xe'));var Redis=require(_0x0e31('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e31('0x10'));var as=require(_0x0e31('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e31('0x12'));var utils=require(_0x0e31('0x13'));var config=require(_0x0e31('0x14'));var licenseUtil=require(_0x0e31('0x15'));var db=require(_0x0e31('0x16'))['db'];config['redis']=_[_0x0e31('0x17')](config[_0x0e31('0x18')],{'host':_0x0e31('0x19'),'port':0x18eb});var socket=require(_0x0e31('0x1a'))(new Redis(config[_0x0e31('0x18')]));require(_0x0e31('0x1b'))[_0x0e31('0x1c')](socket);var jayson=require(_0x0e31('0x1d'));var client=jayson['client'][_0x0e31('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x30698c,_0x11a73b,_0x32533f,_0x20ed62){return new BPromise(function(_0x1fcbe2,_0x418f12){var _0x2a8b38=_0x20ed62||client;return _0x2a8b38[_0x0e31('0x1f')](_0x30698c,_0x32533f)[_0x0e31('0x20')](function(_0x3a3bb1){logger['info']('ChatQueue,\x20%s,\x20%s',_0x11a73b,_0x0e31('0x21'));logger[_0x0e31('0x22')](_0x0e31('0x23'),_0x11a73b,_0x0e31('0x21'),JSON['stringify'](_0x3a3bb1));if(_0x3a3bb1[_0x0e31('0x24')]){if(_0x3a3bb1[_0x0e31('0x24')]['code']===0x1f4){logger[_0x0e31('0x24')](_0x0e31('0x25'),_0x11a73b,_0x3a3bb1[_0x0e31('0x24')][_0x0e31('0x26')]);return _0x418f12(_0x3a3bb1['error'][_0x0e31('0x26')]);}logger[_0x0e31('0x24')]('ChatQueue,\x20%s,\x20%s',_0x11a73b,_0x3a3bb1[_0x0e31('0x24')][_0x0e31('0x26')]);return _0x1fcbe2(_0x3a3bb1[_0x0e31('0x24')][_0x0e31('0x26')]);}else{logger[_0x0e31('0x27')](_0x0e31('0x25'),_0x11a73b,'request\x20sent');_0x1fcbe2(_0x3a3bb1[_0x0e31('0x28')][_0x0e31('0x26')]);}})[_0x0e31('0x29')](function(_0x34b1b3){logger[_0x0e31('0x24')](_0x0e31('0x25'),_0x11a73b,_0x34b1b3);_0x418f12(_0x34b1b3);});});}function respondWithStatusCode(_0x79d93,_0x8d2160){_0x8d2160=_0x8d2160||0xcc;return function(_0xcbd7bc){if(_0xcbd7bc){return _0x79d93[_0x0e31('0x2a')](_0x8d2160);}return _0x79d93['status'](_0x8d2160)[_0x0e31('0x2b')]();};}function respondWithResult(_0x5a29e7,_0x4fb267){_0x4fb267=_0x4fb267||0xc8;return function(_0x1fd34c){if(_0x1fd34c){return _0x5a29e7[_0x0e31('0x2c')](_0x4fb267)[_0x0e31('0x2d')](_0x1fd34c);}};}function respondWithFilteredResult(_0x30857b,_0x5ec32b){return function(_0x146f75){if(_0x146f75){var _0x2652db=_0x146f75[_0x0e31('0x2e')],_0x7e4e1f=_0x5ec32b[_0x0e31('0x2f')],_0x1c9ec5=_0x5ec32b['offset']+_0x5ec32b[_0x0e31('0x30')],_0x27ba34;if(_0x1c9ec5>=_0x2652db){_0x1c9ec5=_0x2652db;_0x27ba34=0xc8;}else{_0x27ba34=0xce;}_0x30857b[_0x0e31('0x2c')](_0x27ba34);return _0x30857b[_0x0e31('0x31')](_0x0e31('0x32'),_0x7e4e1f+'-'+_0x1c9ec5+'/'+_0x2652db)[_0x0e31('0x2d')](_0x146f75);}return null;};}function patchUpdates(_0x205367){return function(_0xcf48d1){try{jsonpatch[_0x0e31('0x33')](_0xcf48d1,_0x205367,!![]);}catch(_0x5857b1){return BPromise[_0x0e31('0x34')](_0x5857b1);}return _0xcf48d1['save']();};}function saveUpdates(_0x129060,_0x596fad){return function(_0x4f8abe){if(_0x4f8abe){return _0x4f8abe[_0x0e31('0x35')](_0x129060)[_0x0e31('0x20')](function(_0x4464cc){return _0x4464cc;});}return null;};}function removeEntity(_0x49b9b6,_0x3d535c){return function(_0x5dc536){if(_0x5dc536){return _0x5dc536[_0x0e31('0x36')]()[_0x0e31('0x20')](function(){var _0x405cac=_0x5dc536[_0x0e31('0x37')]({'plain':!![]});var _0x2227f2='ChatQueues';return db[_0x0e31('0x38')][_0x0e31('0x36')]({'where':{'type':_0x2227f2,'resourceId':_0x405cac['id']}})[_0x0e31('0x20')](function(){return _0x5dc536;});})[_0x0e31('0x20')](function(){_0x49b9b6[_0x0e31('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa3244e,_0xb7ff2d){return function(_0x3e9094){if(!_0x3e9094){_0xa3244e['sendStatus'](0x194);}return _0x3e9094;};}function handleError(_0x4435f3,_0x11aaf6){_0x11aaf6=_0x11aaf6||0x1f4;return function(_0x3ca819){logger[_0x0e31('0x24')](_0x3ca819[_0x0e31('0x39')]);if(_0x3ca819[_0x0e31('0x3a')]){delete _0x3ca819[_0x0e31('0x3a')];}_0x4435f3[_0x0e31('0x2c')](_0x11aaf6)['send'](_0x3ca819);};}exports['index']=function(_0xc3b1e7,_0x443e02){var _0x2ab12c={},_0x11513c={},_0xdeaaa0={'count':0x0,'rows':[]};var _0x4f4779=_[_0x0e31('0x3b')](db[_0x0e31('0x3c')][_0x0e31('0x3d')],function(_0x552fec){return{'name':_0x552fec[_0x0e31('0x3e')],'type':_0x552fec[_0x0e31('0x3f')][_0x0e31('0x40')]};});_0x11513c[_0x0e31('0x41')]=_[_0x0e31('0x3b')](_0x4f4779,_0x0e31('0x3a'));_0x11513c[_0x0e31('0x42')]=_[_0x0e31('0x43')](_0xc3b1e7[_0x0e31('0x42')]);_0x11513c[_0x0e31('0x44')]=_['intersection'](_0x11513c['model'],_0x11513c['query']);_0x2ab12c[_0x0e31('0x45')]=_[_0x0e31('0x46')](_0x11513c[_0x0e31('0x41')],qs['fields'](_0xc3b1e7[_0x0e31('0x42')][_0x0e31('0x47')]));_0x2ab12c[_0x0e31('0x45')]=_0x2ab12c[_0x0e31('0x45')][_0x0e31('0x48')]?_0x2ab12c[_0x0e31('0x45')]:_0x11513c[_0x0e31('0x41')];if(!_0xc3b1e7[_0x0e31('0x42')]['hasOwnProperty']('nolimit')){_0x2ab12c[_0x0e31('0x30')]=qs[_0x0e31('0x30')](_0xc3b1e7[_0x0e31('0x42')][_0x0e31('0x30')]);_0x2ab12c['offset']=qs['offset'](_0xc3b1e7[_0x0e31('0x42')][_0x0e31('0x2f')]);}_0x2ab12c[_0x0e31('0x49')]=qs[_0x0e31('0x4a')](_0xc3b1e7[_0x0e31('0x42')][_0x0e31('0x4a')]);_0x2ab12c['where']=qs[_0x0e31('0x44')](_['pick'](_0xc3b1e7['query'],_0x11513c[_0x0e31('0x44')]),_0x4f4779);if(_0xc3b1e7[_0x0e31('0x42')][_0x0e31('0x4b')]){_0x2ab12c[_0x0e31('0x4c')]=_[_0x0e31('0x4d')](_0x2ab12c['where'],{'$or':_[_0x0e31('0x3b')](_0x4f4779,function(_0x2256cb){if(_0x2256cb['type']!==_0x0e31('0x4e')){var _0x3327fd={};_0x3327fd[_0x2256cb[_0x0e31('0x3a')]]={'$like':'%'+_0xc3b1e7['query'][_0x0e31('0x4b')]+'%'};return _0x3327fd;}})});}_0x2ab12c=_['merge']({},_0x2ab12c,_0xc3b1e7[_0x0e31('0x4f')]);var _0x5f50f6={'where':_0x2ab12c[_0x0e31('0x4c')]};return db['ChatQueue'][_0x0e31('0x2e')](_0x5f50f6)['then'](function(_0x236ed5){_0xdeaaa0['count']=_0x236ed5;if(_0xc3b1e7[_0x0e31('0x42')]['includeAll']){_0x2ab12c[_0x0e31('0x50')]=[{'all':!![]}];}return db[_0x0e31('0x3c')][_0x0e31('0x51')](_0x2ab12c);})[_0x0e31('0x20')](function(_0x47642d){_0xdeaaa0[_0x0e31('0x52')]=_0x47642d;return _0xdeaaa0;})[_0x0e31('0x20')](respondWithFilteredResult(_0x443e02,_0x2ab12c))[_0x0e31('0x29')](handleError(_0x443e02,null));};exports[_0x0e31('0x53')]=function(_0x317dd9,_0x27980d){var _0x2b652e={'raw':!![],'where':{'id':_0x317dd9[_0x0e31('0x54')]['id']}},_0xa54338={};_0xa54338[_0x0e31('0x41')]=_[_0x0e31('0x43')](db['ChatQueue'][_0x0e31('0x3d')]);_0xa54338[_0x0e31('0x42')]=_[_0x0e31('0x43')](_0x317dd9[_0x0e31('0x42')]);_0xa54338['filters']=_['intersection'](_0xa54338['model'],_0xa54338[_0x0e31('0x42')]);_0x2b652e[_0x0e31('0x45')]=_[_0x0e31('0x46')](_0xa54338['model'],qs[_0x0e31('0x47')](_0x317dd9['query']['fields']));_0x2b652e['attributes']=_0x2b652e[_0x0e31('0x45')]['length']?_0x2b652e[_0x0e31('0x45')]:_0xa54338[_0x0e31('0x41')];if(_0x317dd9[_0x0e31('0x42')][_0x0e31('0x55')]){_0x2b652e[_0x0e31('0x50')]=[{'all':!![]}];}_0x2b652e=_[_0x0e31('0x4d')]({},_0x2b652e,_0x317dd9[_0x0e31('0x4f')]);return db[_0x0e31('0x3c')][_0x0e31('0x56')](_0x2b652e)['then'](handleEntityNotFound(_0x27980d,null))['then'](respondWithResult(_0x27980d,null))[_0x0e31('0x29')](handleError(_0x27980d,null));};exports['create']=function(_0x49fc13,_0x43deff){return db[_0x0e31('0x3c')][_0x0e31('0x57')](_0x49fc13[_0x0e31('0x58')],{})[_0x0e31('0x20')](function(_0x1d5fce){var _0x268881=_0x49fc13[_0x0e31('0x59')][_0x0e31('0x37')]({'plain':!![]});if(!_0x268881)throw new Error(_0x0e31('0x5a'));if(_0x268881['role']===_0x0e31('0x59')){var _0x1f20cd=_0x1d5fce[_0x0e31('0x37')]({'plain':!![]});var _0x2465a2=_0x0e31('0x5b');return db[_0x0e31('0x5c')][_0x0e31('0x56')]({'where':{'name':_0x2465a2,'userProfileId':_0x268881[_0x0e31('0x5d')]},'raw':!![]})[_0x0e31('0x20')](function(_0x3f84a7){if(_0x3f84a7&&_0x3f84a7['autoAssociation']===0x0){return db[_0x0e31('0x38')][_0x0e31('0x57')]({'name':_0x1f20cd[_0x0e31('0x3a')],'resourceId':_0x1f20cd['id'],'type':_0x3f84a7[_0x0e31('0x3a')],'sectionId':_0x3f84a7['id']},{})[_0x0e31('0x20')](function(){return _0x1d5fce;});}else{return _0x1d5fce;}})[_0x0e31('0x29')](function(_0x465e68){logger[_0x0e31('0x24')](_0x0e31('0x5e'),_0x465e68);throw _0x465e68;});}return _0x1d5fce;})['then'](respondWithResult(_0x43deff,0xc9))[_0x0e31('0x29')](handleError(_0x43deff,null));};exports[_0x0e31('0x35')]=function(_0xadcdff,_0x4dd445){if(_0xadcdff[_0x0e31('0x58')]['id']){delete _0xadcdff[_0x0e31('0x58')]['id'];}return db['ChatQueue'][_0x0e31('0x56')]({'where':{'id':_0xadcdff[_0x0e31('0x54')]['id']}})[_0x0e31('0x20')](handleEntityNotFound(_0x4dd445,null))[_0x0e31('0x20')](saveUpdates(_0xadcdff['body'],null))['then'](respondWithResult(_0x4dd445,null))[_0x0e31('0x29')](handleError(_0x4dd445,null));};exports[_0x0e31('0x36')]=function(_0x4070ec,_0x81a327){return db['ChatQueue'][_0x0e31('0x56')]({'where':{'id':_0x4070ec[_0x0e31('0x54')]['id']}})[_0x0e31('0x20')](handleEntityNotFound(_0x81a327,null))['then'](removeEntity(_0x81a327,null))[_0x0e31('0x29')](handleError(_0x81a327,null));};exports[_0x0e31('0x5f')]=function(_0x21dcf2,_0xf2a016){return db[_0x0e31('0x3c')][_0x0e31('0x5f')]()[_0x0e31('0x20')](respondWithResult(_0xf2a016,null))[_0x0e31('0x29')](handleError(_0xf2a016,null));};exports[_0x0e31('0x60')]=function(_0x23a902,_0x32ad84,_0x54f196){var _0x35a56d={'raw':!![],'where':{}},_0x2d43f6={},_0x529e0f;return db[_0x0e31('0x3c')][_0x0e31('0x61')]({'where':{'id':_0x23a902[_0x0e31('0x54')]['id']}})[_0x0e31('0x20')](handleEntityNotFound(_0x32ad84,null))[_0x0e31('0x20')](function(_0x34512d){if(_0x34512d){_0x529e0f=_0x34512d['get']({'plain':!![]});_0x2d43f6[_0x0e31('0x41')]=_['keys'](db[_0x0e31('0x62')][_0x0e31('0x3d')]);_0x2d43f6[_0x0e31('0x42')]=_[_0x0e31('0x43')](_0x23a902[_0x0e31('0x42')]);_0x2d43f6[_0x0e31('0x44')]=_[_0x0e31('0x46')](_0x2d43f6['model'],_0x2d43f6['query']);_0x35a56d['attributes']=_['intersection'](_0x2d43f6[_0x0e31('0x41')],qs[_0x0e31('0x47')](_0x23a902['query'][_0x0e31('0x47')]));_0x35a56d[_0x0e31('0x45')]=_0x35a56d[_0x0e31('0x45')][_0x0e31('0x48')]?_0x35a56d['attributes']:_0x2d43f6[_0x0e31('0x41')];if(!_0x23a902[_0x0e31('0x42')][_0x0e31('0x63')]('nolimit')){_0x35a56d['limit']=qs[_0x0e31('0x30')](_0x23a902[_0x0e31('0x42')]['limit']);_0x35a56d[_0x0e31('0x2f')]=qs[_0x0e31('0x2f')](_0x23a902[_0x0e31('0x42')]['offset']);}_0x35a56d[_0x0e31('0x49')]=qs[_0x0e31('0x4a')](_0x23a902[_0x0e31('0x42')][_0x0e31('0x4a')]);_0x35a56d[_0x0e31('0x4c')]=qs['filters'](_[_0x0e31('0x64')](_0x23a902['query'],_0x2d43f6[_0x0e31('0x44')]));_0x35a56d['where']['ChatQueueId']=_0x34512d['id'];if(_0x23a902[_0x0e31('0x42')][_0x0e31('0x4b')]){_0x35a56d[_0x0e31('0x4c')]=_[_0x0e31('0x4d')](_0x35a56d[_0x0e31('0x4c')],{'$or':_[_0x0e31('0x3b')](_0x35a56d[_0x0e31('0x45')],function(_0x20aac0){var _0x569850={};_0x569850[_0x20aac0]={'$like':'%'+_0x23a902[_0x0e31('0x42')][_0x0e31('0x4b')]+'%'};return _0x569850;})});}_0x35a56d=_[_0x0e31('0x4d')]({},_0x35a56d,_0x23a902[_0x0e31('0x4f')]);return db[_0x0e31('0x62')]['findAll'](_0x35a56d);}})[_0x0e31('0x20')](function(_0x47a52c){if(_0x47a52c){return db[_0x0e31('0x65')][_0x0e31('0x66')]({'where':{'id':_[_0x0e31('0x3b')](_0x47a52c,_0x0e31('0x67')),'role':_0x0e31('0x68')},'attributes':['id',_0x0e31('0x3a'),_0x0e31('0x69'),'updatedAt',_0x0e31('0x6a')]});}})['then'](function(_0x37a325){if(_0x37a325){return{'count':_0x37a325['count'],'rows':_[_0x0e31('0x3b')](_0x37a325[_0x0e31('0x52')],function(_0x2d3c01){return{'membername':_0x2d3c01[_0x0e31('0x3a')],'UserId':_0x2d3c01['id'],'queue_name':_0x529e0f[_0x0e31('0x3a')],'ChatQueueId':_0x529e0f['id'],'interface':util[_0x0e31('0x6b')](_0x0e31('0x6c'),_0x0e31('0x6d'),_0x2d3c01[_0x0e31('0x3a')]),'penalty':0x0,'paused':_0x2d3c01[_0x0e31('0x69')],'createdAt':_0x2d3c01[_0x0e31('0x6a')],'updatedAt':_0x2d3c01[_0x0e31('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0e31('0x20')](respondWithFilteredResult(_0x32ad84,_0x35a56d))[_0x0e31('0x29')](handleError(_0x32ad84,null));};exports[_0x0e31('0x6f')]=function(_0x3c9505,_0x2d07f2,_0x44f7c0){var _0x319d6f={};var _0x1b0b62={};var _0x31c981;var _0x35d009;return db[_0x0e31('0x3c')][_0x0e31('0x61')]({'where':{'id':_0x3c9505[_0x0e31('0x54')]['id']}})[_0x0e31('0x20')](handleEntityNotFound(_0x2d07f2,null))[_0x0e31('0x20')](function(_0x326985){if(_0x326985){_0x31c981=_0x326985;_0x1b0b62[_0x0e31('0x41')]=_[_0x0e31('0x43')](db['Team'][_0x0e31('0x3d')]);_0x1b0b62[_0x0e31('0x42')]=_[_0x0e31('0x43')](_0x3c9505[_0x0e31('0x42')]);_0x1b0b62[_0x0e31('0x44')]=_[_0x0e31('0x46')](_0x1b0b62[_0x0e31('0x41')],_0x1b0b62['query']);_0x319d6f['attributes']=_[_0x0e31('0x46')](_0x1b0b62[_0x0e31('0x41')],qs[_0x0e31('0x47')](_0x3c9505['query']['fields']));_0x319d6f['attributes']=_0x319d6f[_0x0e31('0x45')][_0x0e31('0x48')]?_0x319d6f[_0x0e31('0x45')]:_0x1b0b62[_0x0e31('0x41')];_0x319d6f[_0x0e31('0x49')]=qs[_0x0e31('0x4a')](_0x3c9505[_0x0e31('0x42')][_0x0e31('0x4a')]);_0x319d6f[_0x0e31('0x4c')]=qs['filters'](_[_0x0e31('0x64')](_0x3c9505[_0x0e31('0x42')],_0x1b0b62[_0x0e31('0x44')]));if(_0x3c9505[_0x0e31('0x42')]['filter']){_0x319d6f['where']=_[_0x0e31('0x4d')](_0x319d6f[_0x0e31('0x4c')],{'$or':_[_0x0e31('0x3b')](_0x319d6f[_0x0e31('0x45')],function(_0x4d1d89){var _0x27fff4={};_0x27fff4[_0x4d1d89]={'$like':'%'+_0x3c9505[_0x0e31('0x42')][_0x0e31('0x4b')]+'%'};return _0x27fff4;})});}_0x319d6f=_['merge']({},_0x319d6f,_0x3c9505[_0x0e31('0x4f')]);return _0x31c981[_0x0e31('0x6f')](_0x319d6f);}})[_0x0e31('0x20')](function(_0x4c9d77){if(_0x4c9d77){_0x35d009=_0x4c9d77[_0x0e31('0x48')];if(!_0x3c9505['query'][_0x0e31('0x63')](_0x0e31('0x70'))){_0x319d6f[_0x0e31('0x30')]=qs['limit'](_0x3c9505[_0x0e31('0x42')][_0x0e31('0x30')]);_0x319d6f['offset']=qs[_0x0e31('0x2f')](_0x3c9505['query'][_0x0e31('0x2f')]);}return _0x31c981['getTeams'](_0x319d6f);}})[_0x0e31('0x20')](function(_0x56665c){if(_0x56665c){return _0x56665c?{'count':_0x35d009,'rows':_0x56665c}:null;}})['then'](respondWithResult(_0x2d07f2,null))[_0x0e31('0x29')](handleError(_0x2d07f2,null));};exports['addTeams']=function(_0x1142ff,_0x791228,_0x23917e){var _0x447e0e=_0x1142ff[_0x0e31('0x58')][_0x0e31('0x71')];return db[_0x0e31('0x72')][_0x0e31('0x51')]({'where':{'id':_0x447e0e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e31('0x73'),'attributes':['id',_0x0e31('0x3a'),_0x0e31('0x74'),_0x0e31('0x75'),_0x0e31('0x76')],'raw':!![]}]})[_0x0e31('0x20')](function(_0x222dca){if(_0x222dca){var _0x10acfc=_[_0x0e31('0x77')](_0x222dca,function(_0x366c06){var _0x209751=_0x366c06[_0x0e31('0x37')]({'plain':!![]});return _0x209751[_0x0e31('0x73')];});return db[_0x0e31('0x3c')][_0x0e31('0x56')]({'where':{'id':_0x1142ff[_0x0e31('0x54')]['id']}})[_0x0e31('0x20')](function(_0x52591e){return db['sequelize']['transaction'](function(_0x588098){return _0x52591e[_0x0e31('0x78')](_0x447e0e,{'transaction':_0x588098})[_0x0e31('0x20')](function(){return BPromise[_0x0e31('0x79')](_0x10acfc,function(_0x4a51f1){return db[_0x0e31('0x62')][_0x0e31('0x7a')]({'where':{'UserId':_0x4a51f1['id'],'ChatQueueId':_0x1142ff['params']['id']},'transaction':_0x588098});});})[_0x0e31('0x20')](function(){_0x10acfc[_0x0e31('0x7b')](function(_0x5f0405){socket[_0x0e31('0x7c')](_0x0e31('0x7d'),{'UserId':_0x5f0405['id'],'ChatQueueId':_0x52591e['id']});});});});});}})[_0x0e31('0x20')](respondWithStatusCode(_0x791228,null))['catch'](handleError(_0x791228,null));};exports[_0x0e31('0x7e')]=function(_0x2ecb3d,_0x2a9d38,_0x415c03){return db[_0x0e31('0x72')][_0x0e31('0x51')]({'where':{'id':_0x2ecb3d[_0x0e31('0x42')][_0x0e31('0x71')]},'attributes':['id'],'include':[{'model':db[_0x0e31('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0e31('0x20')](handleEntityNotFound(_0x2a9d38,null))['then'](function(_0x1f779b){var _0x32a14d=_[_0x0e31('0x3b')](_0x1f779b,'id');var _0x53cb43=[];var _0x188bcb=[];var _0x5d3da5=squel['select']();_0x5d3da5[_0x0e31('0x7f')](_0x0e31('0x80'))[_0x0e31('0x81')](_0x0e31('0x82'),'tq')[_0x0e31('0x83')]('user_has_teams','ut',_0x0e31('0x84'))[_0x0e31('0x4c')](_0x0e31('0x85'),_0x2ecb3d[_0x0e31('0x54')]['id']);for(var _0xba23ed=0x0;_0xba23ed<_0x1f779b[_0x0e31('0x48')];_0xba23ed+=0x1){let _0x524754=_0x1f779b[_0xba23ed];for(var _0xaffd9f=0x0;_0xaffd9f<_0x524754['Agents'][_0x0e31('0x48')];_0xaffd9f+=0x1){let _0x7e6e95=_0x524754[_0x0e31('0x73')][_0xaffd9f];var _0x18595f=_0x5d3da5['clone']();_0x18595f[_0x0e31('0x4c')](_0x0e31('0x86'),_0x7e6e95['id']);_0x188bcb[_0x0e31('0x87')](db['sequelize']['query'](_0x18595f[_0x0e31('0x88')](),{'type':db[_0x0e31('0x89')][_0x0e31('0x8a')]['SELECT']})[_0x0e31('0x20')](function(_0x20cfe7){if(_0x20cfe7[_0x0e31('0x48')]===0x1){return _0x7e6e95['id'];}else{var _0x11f64a=_['every'](_['map'](_0x20cfe7,_0x0e31('0x8b')),function(_0x56790f){return _[_0x0e31('0x8c')](_0x32a14d,_0x56790f);});if(_0x11f64a){return _0x7e6e95['id'];}}}));}}return BPromise[_0x0e31('0x8d')](_0x188bcb)[_0x0e31('0x20')](function(_0x18bcce){_0x53cb43=_(_0x53cb43)[_0x0e31('0x8e')](_0x18bcce)[_0x0e31('0x8f')]()[_0x0e31('0x90')]();return db[_0x0e31('0x3c')][_0x0e31('0x56')]({'where':{'id':_0x2ecb3d['params']['id']}})[_0x0e31('0x20')](function(_0x534b9b){return db[_0x0e31('0x89')][_0x0e31('0x91')](function(_0x360607){return _0x534b9b['removeTeams'](_0x2ecb3d[_0x0e31('0x42')][_0x0e31('0x71')],{'transaction':_0x360607})[_0x0e31('0x20')](function(){if(!_['isEmpty'](_0x53cb43)){return _0x534b9b[_0x0e31('0x92')](_0x53cb43,{'transaction':_0x360607});}})[_0x0e31('0x20')](function(){_0x53cb43[_0x0e31('0x7b')](function(_0x388f25){socket['emit'](_0x0e31('0x93'),{'UserId':_0x388f25,'ChatQueueId':_0x534b9b['id']});});});});});});})['then'](respondWithStatusCode(_0x2a9d38,null))['catch'](handleError(_0x2a9d38,null));};exports[_0x0e31('0x94')]=function(_0x323508,_0x34c43e,_0x588379){return db[_0x0e31('0x3c')][_0x0e31('0x56')]({'where':{'id':_0x323508['params']['id']}})['then'](handleEntityNotFound(_0x34c43e,null))[_0x0e31('0x20')](function(_0x57a33a){if(_0x57a33a){return _0x57a33a[_0x0e31('0x94')](_0x323508[_0x0e31('0x58')][_0x0e31('0x71')],_[_0x0e31('0x95')](_0x323508[_0x0e31('0x58')],[_0x0e31('0x71'),'id'])||{})[_0x0e31('0x96')](function(_0x51b55a){for(var _0x74bf84=0x0;_0x74bf84<_0x323508[_0x0e31('0x58')][_0x0e31('0x71')][_0x0e31('0x48')];_0x74bf84+=0x1){socket['emit'](_0x0e31('0x7d'),{'UserId':_0x323508['body']['ids'][_0x74bf84],'ChatQueueId':_0x323508[_0x0e31('0x54')]['id']});}return _0x51b55a;});}})['then'](respondWithResult(_0x34c43e,null))[_0x0e31('0x29')](handleError(_0x34c43e,null));};exports[_0x0e31('0x92')]=function(_0x571a01,_0x535e28,_0x50224c){return db['ChatQueue'][_0x0e31('0x56')]({'where':{'id':_0x571a01[_0x0e31('0x54')]['id']}})[_0x0e31('0x20')](handleEntityNotFound(_0x535e28,null))['then'](function(_0x552c94){if(_0x552c94){return _0x552c94['removeAgents'](_0x571a01['query']['ids'])['then'](function(){if(_[_0x0e31('0x97')](_0x571a01[_0x0e31('0x42')]['ids'])){for(var _0x22b158=0x0;_0x22b158<_0x571a01[_0x0e31('0x42')][_0x0e31('0x71')]['length'];_0x22b158+=0x1){socket[_0x0e31('0x7c')](_0x0e31('0x93'),{'UserId':Number(_0x571a01[_0x0e31('0x42')][_0x0e31('0x71')][_0x22b158]),'ChatQueueId':Number(_0x571a01[_0x0e31('0x54')]['id'])});}}else{socket[_0x0e31('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x571a01[_0x0e31('0x42')]['ids']),'ChatQueueId':Number(_0x571a01[_0x0e31('0x54')]['id'])});}});}})[_0x0e31('0x20')](respondWithStatusCode(_0x535e28,null))['catch'](handleError(_0x535e28,null));};exports[_0x0e31('0x98')]=function(_0x4f321c,_0xc4a95a,_0x43603d){var _0xca72f7={};var _0x3aee24={};var _0x5f3978;var _0x1ece24;return db[_0x0e31('0x3c')][_0x0e31('0x61')]({'where':{'id':_0x4f321c[_0x0e31('0x54')]['id']}})['then'](handleEntityNotFound(_0xc4a95a,null))[_0x0e31('0x20')](function(_0x313806){if(_0x313806){_0x5f3978=_0x313806;_0x3aee24[_0x0e31('0x41')]=_[_0x0e31('0x43')](db[_0x0e31('0x65')][_0x0e31('0x3d')]);_0x3aee24[_0x0e31('0x42')]=_['keys'](_0x4f321c[_0x0e31('0x42')]);_0x3aee24[_0x0e31('0x44')]=_[_0x0e31('0x46')](_0x3aee24['model'],_0x3aee24[_0x0e31('0x42')]);_0xca72f7[_0x0e31('0x45')]=_[_0x0e31('0x46')](_0x3aee24[_0x0e31('0x41')],qs[_0x0e31('0x47')](_0x4f321c[_0x0e31('0x42')][_0x0e31('0x47')]));_0xca72f7[_0x0e31('0x45')]=_0xca72f7[_0x0e31('0x45')][_0x0e31('0x48')]?_0xca72f7[_0x0e31('0x45')]:_0x3aee24[_0x0e31('0x41')];_0xca72f7['order']=qs[_0x0e31('0x4a')](_0x4f321c[_0x0e31('0x42')][_0x0e31('0x4a')]);_0xca72f7[_0x0e31('0x4c')]=qs['filters'](_['pick'](_0x4f321c[_0x0e31('0x42')],_0x3aee24[_0x0e31('0x44')]));if(_0x4f321c['query'][_0x0e31('0x4b')]){_0xca72f7[_0x0e31('0x4c')]=_[_0x0e31('0x4d')](_0xca72f7['where'],{'$or':_[_0x0e31('0x3b')](_0xca72f7[_0x0e31('0x45')],function(_0x1fce67){var _0x4877a6={};_0x4877a6[_0x1fce67]={'$like':'%'+_0x4f321c['query'][_0x0e31('0x4b')]+'%'};return _0x4877a6;})});}_0xca72f7=_[_0x0e31('0x4d')]({},_0xca72f7,_0x4f321c[_0x0e31('0x4f')]);return _0x5f3978[_0x0e31('0x98')](_0xca72f7);}})['then'](function(_0x384357){if(_0x384357){_0x1ece24=_0x384357[_0x0e31('0x48')];if(!_0x4f321c['query'][_0x0e31('0x63')]('nolimit')){_0xca72f7['limit']=qs[_0x0e31('0x30')](_0x4f321c[_0x0e31('0x42')][_0x0e31('0x30')]);_0xca72f7[_0x0e31('0x2f')]=qs['offset'](_0x4f321c[_0x0e31('0x42')][_0x0e31('0x2f')]);}return _0x5f3978[_0x0e31('0x98')](_0xca72f7);}})[_0x0e31('0x20')](function(_0x335f7e){if(_0x335f7e){return _0x335f7e?{'count':_0x1ece24,'rows':_0x335f7e}:null;}})['then'](respondWithResult(_0xc4a95a,null))[_0x0e31('0x29')](handleError(_0xc4a95a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e827a97..a222fb9 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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3e9c95,_0x17979a){var _0x2f7aa7=function(_0x34c726){while(--_0x34c726){_0x3e9c95['push'](_0x3e9c95['shift']());}};_0x2f7aa7(++_0x17979a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x592cbc,_0x5ec030){_0x592cbc=_0x592cbc-0x0;var _0x39b8d9=_0x0b0e[_0x592cbc];return _0x39b8d9;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x3d81a9,_0x1222a4){var _0x462c37=function(_0xd30415){while(--_0xd30415){_0x3d81a9['push'](_0x3d81a9['shift']());}};_0x462c37(++_0x1222a4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x409777,_0x2b66e5){_0x409777=_0x409777-0x0;var _0x531870=_0x5f2f[_0x409777];return _0x531870;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a76053e..e422d62 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 _0x516f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x1d3390,_0x3447ed){var _0x91b6b3=function(_0x5edd7c){while(--_0x5edd7c){_0x1d3390['push'](_0x1d3390['shift']());}};_0x91b6b3(++_0x3447ed);}(_0x516f,0xa8));var _0xf516=function(_0xef8f45,_0x2f3ce6){_0xef8f45=_0xef8f45-0x0;var _0x57fc49=_0x516f[_0xef8f45];return _0x57fc49;};'use strict';var _=require('lodash');var util=require(_0xf516('0x0'));var logger=require(_0xf516('0x1'))(_0xf516('0x2'));var moment=require(_0xf516('0x3'));var BPromise=require(_0xf516('0x4'));var rp=require(_0xf516('0x5'));var fs=require('fs');var path=require(_0xf516('0x6'));var rimraf=require(_0xf516('0x7'));var config=require(_0xf516('0x8'));var attributes=require(_0xf516('0x9'));module[_0xf516('0xa')]=function(_0x3edde7,_0x2681f2){return _0x3edde7[_0xf516('0xb')](_0xf516('0xc'),attributes,{'tableName':_0xf516('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65f8=['path','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','../../config/logger','moment','request-promise'];(function(_0x1e954e,_0x256592){var _0xa8b051=function(_0x51657f){while(--_0x51657f){_0x1e954e['push'](_0x1e954e['shift']());}};_0xa8b051(++_0x256592);}(_0x65f8,0xa8));var _0x865f=function(_0x62dc08,_0x2c2950){_0x62dc08=_0x62dc08-0x0;var _0x356695=_0x65f8[_0x62dc08];return _0x356695;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x865f('0x0'))('api');var moment=require(_0x865f('0x1'));var BPromise=require('bluebird');var rp=require(_0x865f('0x2'));var fs=require('fs');var path=require(_0x865f('0x3'));var rimraf=require('rimraf');var config=require(_0x865f('0x4'));var attributes=require(_0x865f('0x5'));module[_0x865f('0x6')]=function(_0x303ac9,_0xc87496){return _0x303ac9['define'](_0x865f('0x7'),attributes,{'tableName':_0x865f('0x8'),'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 109f0cc..d623752 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=['jayson/promise','http','redis','socket.io-emitter','./chatQueue.socket','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','map','include','model','attributes','ShowChatQueue','find','where','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x3eae,0x66));var _0xe3ea=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x3eae[_0x27bd2c];return _0x3784ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe3ea('0x0'));var BPromise=require(_0xe3ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3ea('0x2'));var db=require(_0xe3ea('0x3'))['db'];var utils=require(_0xe3ea('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe3ea('0x5'));var jayson=require(_0xe3ea('0x6'));var client=jayson['client'][_0xe3ea('0x7')]({'port':0x232a});config[_0xe3ea('0x8')]=_['defaults'](config[_0xe3ea('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3ea('0x9'))(new Redis(config[_0xe3ea('0x8')]));require(_0xe3ea('0xa'))['register'](socket);function respondWithRpcPromise(_0xd81169,_0x1b6707,_0x1ef29c){return new BPromise(function(_0x31a966,_0x3175e0){return client[_0xe3ea('0xb')](_0xd81169,_0x1ef29c)[_0xe3ea('0xc')](function(_0x2eae0d){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1b6707,_0xe3ea('0xd'));logger[_0xe3ea('0xe')](_0xe3ea('0xf'),_0x1b6707,_0xe3ea('0xd'),JSON[_0xe3ea('0x10')](_0x2eae0d));if(_0x2eae0d[_0xe3ea('0x11')]){if(_0x2eae0d[_0xe3ea('0x11')][_0xe3ea('0x12')]===0x1f4){logger[_0xe3ea('0x11')](_0xe3ea('0x13'),_0x1b6707,_0x2eae0d[_0xe3ea('0x11')][_0xe3ea('0x14')]);return _0x3175e0(_0x2eae0d[_0xe3ea('0x11')]['message']);}logger[_0xe3ea('0x11')](_0xe3ea('0x13'),_0x1b6707,_0x2eae0d[_0xe3ea('0x11')][_0xe3ea('0x14')]);return _0x31a966(_0x2eae0d[_0xe3ea('0x11')][_0xe3ea('0x14')]);}else{logger[_0xe3ea('0x15')](_0xe3ea('0x13'),_0x1b6707,_0xe3ea('0xd'));_0x31a966(_0x2eae0d[_0xe3ea('0x16')][_0xe3ea('0x14')]);}})[_0xe3ea('0x17')](function(_0x255a50){logger[_0xe3ea('0x11')](_0xe3ea('0x13'),_0x1b6707,_0x255a50);_0x3175e0(_0x255a50);});});}exports[_0xe3ea('0x18')]=function(_0x1280be){var _0xa367ed=this;return new Promise(function(_0x1f28ca,_0x29e32e){return db[_0xe3ea('0x19')][_0xe3ea('0x1a')]({'raw':_0x1280be[_0xe3ea('0x1b')]?_0x1280be[_0xe3ea('0x1b')][_0xe3ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x1280be['options']?_0x1280be['options']['where']||null:null,'attributes':_0x1280be[_0xe3ea('0x1b')]?_0x1280be['options']['attributes']||null:null,'limit':_0x1280be[_0xe3ea('0x1b')]?_0x1280be[_0xe3ea('0x1b')]['limit']||null:null,'include':_0x1280be[_0xe3ea('0x1b')]?_0x1280be[_0xe3ea('0x1b')]['include']?_[_0xe3ea('0x1d')](_0x1280be['options'][_0xe3ea('0x1e')],function(_0x3255ad){return{'model':db[_0x3255ad[_0xe3ea('0x1f')]],'as':_0x3255ad['as'],'attributes':_0x3255ad['attributes'],'include':_0x3255ad[_0xe3ea('0x1e')]?_[_0xe3ea('0x1d')](_0x3255ad['include'],function(_0x522a3f){return{'model':db[_0x522a3f['model']],'as':_0x522a3f['as'],'attributes':_0x522a3f['attributes'],'include':_0x522a3f['include']?_['map'](_0x522a3f[_0xe3ea('0x1e')],function(_0x3e7c9f){return{'model':db[_0x3e7c9f[_0xe3ea('0x1f')]],'as':_0x3e7c9f['as'],'attributes':_0x3e7c9f[_0xe3ea('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48a6a1){logger[_0xe3ea('0x15')]('GetChatQueue',_0x1280be);logger[_0xe3ea('0xe')](_0xe3ea('0x18'),_0x1280be,JSON[_0xe3ea('0x10')](_0x48a6a1));_0x1f28ca(_0x48a6a1);})['catch'](function(_0x5c8a68){logger[_0xe3ea('0x11')](_0xe3ea('0x18'),_0x5c8a68['message'],_0x1280be);_0x29e32e(_0xa367ed[_0xe3ea('0x11')](0x1f4,_0x5c8a68[_0xe3ea('0x14')]));});});};exports[_0xe3ea('0x21')]=function(_0x482376){var _0x2aa2b9=this;return new Promise(function(_0x6e44a5,_0x58b8ca){return db[_0xe3ea('0x19')][_0xe3ea('0x22')]({'raw':_0x482376[_0xe3ea('0x1b')]?_0x482376[_0xe3ea('0x1b')][_0xe3ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x482376[_0xe3ea('0x1b')]?_0x482376[_0xe3ea('0x1b')][_0xe3ea('0x23')]||null:null,'attributes':_0x482376[_0xe3ea('0x1b')]?_0x482376['options']['attributes']||null:null,'include':_0x482376[_0xe3ea('0x1b')]?_0x482376[_0xe3ea('0x1b')][_0xe3ea('0x1e')]?_[_0xe3ea('0x1d')](_0x482376[_0xe3ea('0x1b')][_0xe3ea('0x1e')],function(_0x588595){return{'model':db[_0x588595['model']],'as':_0x588595['as'],'attributes':_0x588595[_0xe3ea('0x20')],'include':_0x588595[_0xe3ea('0x1e')]?_[_0xe3ea('0x1d')](_0x588595[_0xe3ea('0x1e')],function(_0x18a547){return{'model':db[_0x18a547[_0xe3ea('0x1f')]],'as':_0x18a547['as'],'attributes':_0x18a547[_0xe3ea('0x20')],'include':_0x18a547[_0xe3ea('0x1e')]?_[_0xe3ea('0x1d')](_0x18a547[_0xe3ea('0x1e')],function(_0x53a1ec){return{'model':db[_0x53a1ec[_0xe3ea('0x1f')]],'as':_0x53a1ec['as'],'attributes':_0x53a1ec[_0xe3ea('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe3ea('0xc')](function(_0x5b73b3){logger['info']('ShowChatQueue',_0x482376);logger[_0xe3ea('0xe')](_0xe3ea('0x21'),_0x482376,JSON['stringify'](_0x5b73b3));_0x6e44a5(_0x5b73b3);})[_0xe3ea('0x17')](function(_0x2db6f7){logger[_0xe3ea('0x11')]('ShowChatQueue',_0x2db6f7[_0xe3ea('0x14')],_0x482376);_0x58b8ca(_0x2aa2b9[_0xe3ea('0x11')](0x1f4,_0x2db6f7[_0xe3ea('0x14')]));});});}; \ No newline at end of file +var _0xb396=['include','model','attributes','then','debug','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetChatQueue','findAll','options','raw','where','limit','map'];(function(_0x3aac9a,_0xdd778e){var _0x18612f=function(_0x15f819){while(--_0x15f819){_0x3aac9a['push'](_0x3aac9a['shift']());}};_0x18612f(++_0xdd778e);}(_0xb396,0x1e8));var _0x6b39=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb396[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6b39('0x0'));var util=require(_0x6b39('0x1'));var moment=require(_0x6b39('0x2'));var BPromise=require(_0x6b39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b39('0x4'));var db=require(_0x6b39('0x5'))['db'];var utils=require(_0x6b39('0x6'));var logger=require(_0x6b39('0x7'))(_0x6b39('0x8'));var config=require(_0x6b39('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6b39('0xa')]['http']({'port':0x232a});config[_0x6b39('0xb')]=_['defaults'](config['redis'],{'host':_0x6b39('0xc'),'port':0x18eb});var socket=require(_0x6b39('0xd'))(new Redis(config[_0x6b39('0xb')]));require(_0x6b39('0xe'))[_0x6b39('0xf')](socket);function respondWithRpcPromise(_0x36606d,_0x32c7b2,_0x5adff6){return new BPromise(function(_0x4a1b39,_0x5c098a){return client[_0x6b39('0x10')](_0x36606d,_0x5adff6)['then'](function(_0x5ba3af){logger['info'](_0x6b39('0x11'),_0x32c7b2,_0x6b39('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x32c7b2,_0x6b39('0x12'),JSON[_0x6b39('0x13')](_0x5ba3af));if(_0x5ba3af[_0x6b39('0x14')]){if(_0x5ba3af[_0x6b39('0x14')][_0x6b39('0x15')]===0x1f4){logger['error'](_0x6b39('0x11'),_0x32c7b2,_0x5ba3af['error'][_0x6b39('0x16')]);return _0x5c098a(_0x5ba3af[_0x6b39('0x14')][_0x6b39('0x16')]);}logger['error'](_0x6b39('0x11'),_0x32c7b2,_0x5ba3af['error'][_0x6b39('0x16')]);return _0x4a1b39(_0x5ba3af[_0x6b39('0x14')][_0x6b39('0x16')]);}else{logger[_0x6b39('0x17')](_0x6b39('0x11'),_0x32c7b2,_0x6b39('0x12'));_0x4a1b39(_0x5ba3af[_0x6b39('0x18')][_0x6b39('0x16')]);}})['catch'](function(_0x51a7dc){logger[_0x6b39('0x14')](_0x6b39('0x11'),_0x32c7b2,_0x51a7dc);_0x5c098a(_0x51a7dc);});});}exports[_0x6b39('0x19')]=function(_0x3a8b5b){var _0x1893ad=this;return new Promise(function(_0x299538,_0x458e7d){return db['ChatQueue'][_0x6b39('0x1a')]({'raw':_0x3a8b5b[_0x6b39('0x1b')]?_0x3a8b5b['options'][_0x6b39('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a8b5b[_0x6b39('0x1b')]?_0x3a8b5b[_0x6b39('0x1b')][_0x6b39('0x1d')]||null:null,'attributes':_0x3a8b5b['options']?_0x3a8b5b[_0x6b39('0x1b')]['attributes']||null:null,'limit':_0x3a8b5b['options']?_0x3a8b5b[_0x6b39('0x1b')][_0x6b39('0x1e')]||null:null,'include':_0x3a8b5b[_0x6b39('0x1b')]?_0x3a8b5b['options']['include']?_[_0x6b39('0x1f')](_0x3a8b5b['options'][_0x6b39('0x20')],function(_0x2423bb){return{'model':db[_0x2423bb[_0x6b39('0x21')]],'as':_0x2423bb['as'],'attributes':_0x2423bb['attributes'],'include':_0x2423bb[_0x6b39('0x20')]?_['map'](_0x2423bb[_0x6b39('0x20')],function(_0x4f0c90){return{'model':db[_0x4f0c90[_0x6b39('0x21')]],'as':_0x4f0c90['as'],'attributes':_0x4f0c90[_0x6b39('0x22')],'include':_0x4f0c90[_0x6b39('0x20')]?_['map'](_0x4f0c90[_0x6b39('0x20')],function(_0x26ef5b){return{'model':db[_0x26ef5b[_0x6b39('0x21')]],'as':_0x26ef5b['as'],'attributes':_0x26ef5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b39('0x23')](function(_0x2fa81a){logger[_0x6b39('0x17')]('GetChatQueue',_0x3a8b5b);logger[_0x6b39('0x24')](_0x6b39('0x19'),_0x3a8b5b,JSON[_0x6b39('0x13')](_0x2fa81a));_0x299538(_0x2fa81a);})['catch'](function(_0x267443){logger[_0x6b39('0x14')](_0x6b39('0x19'),_0x267443[_0x6b39('0x16')],_0x3a8b5b);_0x458e7d(_0x1893ad[_0x6b39('0x14')](0x1f4,_0x267443[_0x6b39('0x16')]));});});};exports[_0x6b39('0x25')]=function(_0x5be8ab){var _0x2f9e5d=this;return new Promise(function(_0x2a0702,_0x5d9859){return db[_0x6b39('0x26')][_0x6b39('0x27')]({'raw':_0x5be8ab[_0x6b39('0x1b')]?_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x1c')]===undefined?!![]:![]:!![],'where':_0x5be8ab[_0x6b39('0x1b')]?_0x5be8ab['options'][_0x6b39('0x1d')]||null:null,'attributes':_0x5be8ab[_0x6b39('0x1b')]?_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x22')]||null:null,'include':_0x5be8ab['options']?_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x20')]?_[_0x6b39('0x1f')](_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x20')],function(_0x449afc){return{'model':db[_0x449afc[_0x6b39('0x21')]],'as':_0x449afc['as'],'attributes':_0x449afc[_0x6b39('0x22')],'include':_0x449afc[_0x6b39('0x20')]?_['map'](_0x449afc['include'],function(_0xc40fe7){return{'model':db[_0xc40fe7[_0x6b39('0x21')]],'as':_0xc40fe7['as'],'attributes':_0xc40fe7[_0x6b39('0x22')],'include':_0xc40fe7['include']?_['map'](_0xc40fe7[_0x6b39('0x20')],function(_0x215032){return{'model':db[_0x215032[_0x6b39('0x21')]],'as':_0x215032['as'],'attributes':_0x215032[_0x6b39('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b39('0x23')](function(_0x2c981c){logger['info'](_0x6b39('0x25'),_0x5be8ab);logger[_0x6b39('0x24')](_0x6b39('0x25'),_0x5be8ab,JSON[_0x6b39('0x13')](_0x2c981c));_0x2a0702(_0x2c981c);})['catch'](function(_0x72e6b6){logger[_0x6b39('0x14')](_0x6b39('0x25'),_0x72e6b6[_0x6b39('0x16')],_0x5be8ab);_0x5d9859(_0x2f9e5d[_0x6b39('0x14')](0x1f4,_0x72e6b6[_0x6b39('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 53dabac..1214997 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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x2c2ecd,_0x353a8b){var _0x2042d9=function(_0x179d12){while(--_0x179d12){_0x2c2ecd['push'](_0x2c2ecd['shift']());}};_0x2042d9(++_0x353a8b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x0b0e[_0x556bb1];return _0x45455f;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x3fa4e3,_0x2c8e0f){var _0x3ef90d=function(_0x125982){while(--_0x125982){_0x3fa4e3['push'](_0x3fa4e3['shift']());}};_0x3ef90d(++_0x2c8e0f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x0b0e[_0x45313f];return _0x402910;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7f9f301..2c65fb7 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 _0xf312=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x39ea10,_0x5c7e0e){var _0x2d727d=function(_0x4f32a7){while(--_0x4f32a7){_0x39ea10['push'](_0x39ea10['shift']());}};_0x2d727d(++_0x5c7e0e);}(_0xf312,0x1be));var _0x2f31=function(_0x13d966,_0x718afb){_0x13d966=_0x13d966-0x0;var _0x5d22e8=_0xf312[_0x13d966];return _0x5d22e8;};'use strict';var multer=require(_0x2f31('0x0'));var util=require(_0x2f31('0x1'));var path=require(_0x2f31('0x2'));var timeout=require(_0x2f31('0x3'));var express=require(_0x2f31('0x4'));var router=express[_0x2f31('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2f31('0x6'));var config=require(_0x2f31('0x7'));var controller=require(_0x2f31('0x8'));router[_0x2f31('0x9')]('/',auth[_0x2f31('0xa')](),controller[_0x2f31('0xb')]);router[_0x2f31('0x9')](_0x2f31('0xc'),auth[_0x2f31('0xa')](),controller[_0x2f31('0xd')]);router[_0x2f31('0x9')](_0x2f31('0xe'),auth[_0x2f31('0xa')](),controller[_0x2f31('0xf')]);router['get']('/:id/members',auth[_0x2f31('0xa')](),controller['getMembers']);router[_0x2f31('0x9')](_0x2f31('0x10'),auth[_0x2f31('0xa')](),controller[_0x2f31('0x11')]);router[_0x2f31('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x2f31('0x12')]);router[_0x2f31('0x13')]('/',auth[_0x2f31('0xa')](),controller[_0x2f31('0x14')]);router[_0x2f31('0x13')](_0x2f31('0x10'),auth[_0x2f31('0xa')](),controller['addTeams']);router[_0x2f31('0x13')](_0x2f31('0x15'),auth[_0x2f31('0xa')](),controller[_0x2f31('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2f31('0x17')]);router[_0x2f31('0x18')](_0x2f31('0xe'),auth[_0x2f31('0xa')](),controller['destroy']);router[_0x2f31('0x18')](_0x2f31('0x10'),auth[_0x2f31('0xa')](),controller[_0x2f31('0x19')]);router[_0x2f31('0x18')](_0x2f31('0x15'),auth[_0x2f31('0xa')](),controller[_0x2f31('0x1a')]);module[_0x2f31('0x1b')]=router; \ No newline at end of file +var _0xa4f0=['create','post','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../config/environment','./chatQueue.controller','get','index','isAuthenticated','describe','show','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x3cc6a2,_0x396f68){var _0x145e84=function(_0x476be2){while(--_0x476be2){_0x3cc6a2['push'](_0x3cc6a2['shift']());}};_0x145e84(++_0x396f68);}(_0xa4f0,0x1e8));var _0x0a4f=function(_0x27ffc3,_0x6a9a3f){_0x27ffc3=_0x27ffc3-0x0;var _0x139f94=_0xa4f0[_0x27ffc3];return _0x139f94;};'use strict';var multer=require(_0x0a4f('0x0'));var util=require(_0x0a4f('0x1'));var path=require(_0x0a4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a4f('0x3'));var router=express[_0x0a4f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a4f('0x5'));var controller=require(_0x0a4f('0x6'));router[_0x0a4f('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a4f('0x8')]);router[_0x0a4f('0x7')]('/describe',auth[_0x0a4f('0x9')](),controller[_0x0a4f('0xa')]);router[_0x0a4f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0a4f('0xb')]);router['get']('/:id/members',auth[_0x0a4f('0x9')](),controller['getMembers']);router['get'](_0x0a4f('0xc'),auth[_0x0a4f('0x9')](),controller[_0x0a4f('0xd')]);router[_0x0a4f('0x7')](_0x0a4f('0xe'),auth[_0x0a4f('0x9')](),controller[_0x0a4f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a4f('0x10')]);router[_0x0a4f('0x11')](_0x0a4f('0xc'),auth['isAuthenticated'](),controller[_0x0a4f('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x0a4f('0x13')]);router[_0x0a4f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0a4f('0x15')]);router[_0x0a4f('0x16')](_0x0a4f('0x17'),auth['isAuthenticated'](),controller[_0x0a4f('0x18')]);router[_0x0a4f('0x16')]('/:id/teams',auth[_0x0a4f('0x9')](),controller[_0x0a4f('0x19')]);router[_0x0a4f('0x16')](_0x0a4f('0xe'),auth['isAuthenticated'](),controller[_0x0a4f('0x1a')]);module[_0x0a4f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5c17581..3893571 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 _0xa9c8=['STRING','DATE','moment','sequelize'];(function(_0xc6fb2f,_0x39f0f4){var _0x399ba3=function(_0x4661a3){while(--_0x4661a3){_0xc6fb2f['push'](_0xc6fb2f['shift']());}};_0x399ba3(++_0x39f0f4);}(_0xa9c8,0x102));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8a9c('0x0'));var Sequelize=require(_0x8a9c('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8a9c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8a9c('0x3')]},'exitAt':{'type':Sequelize[_0x8a9c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa0a=['exports','STRING','DATE','moment','sequelize'];(function(_0x1537a7,_0x4d390d){var _0x14b246=function(_0x553180){while(--_0x553180){_0x1537a7['push'](_0x1537a7['shift']());}};_0x14b246(++_0x4d390d);}(_0xaa0a,0x102));var _0xaaa0=function(_0x354a41,_0x477f09){_0x354a41=_0x354a41-0x0;var _0x5ba25f=_0xaa0a[_0x354a41];return _0x5ba25f;};'use strict';var moment=require(_0xaaa0('0x0'));var Sequelize=require(_0xaaa0('0x1'));module[_0xaaa0('0x2')]={'uniqueid':{'type':Sequelize[_0xaaa0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaaa0('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xaaa0('0x4')]},'acceptAt':{'type':Sequelize[_0xaaa0('0x4')]},'exitAt':{'type':Sequelize[_0xaaa0('0x4')]},'reason':{'type':Sequelize[_0xaaa0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9e5636f..ab95a66 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 _0xf098=['offset','limit','reject','save','update','then','end','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0xf098,0x1d4));var _0x8f09=function(_0x545191,_0xbf4e14){_0x545191=_0x545191-0x0;var _0x108b9d=_0xf098[_0x545191];return _0x108b9d;};'use strict';var pdf=require(_0x8f09('0x0'));var emlformat=require(_0x8f09('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8f09('0x2'));var jsonpatch=require(_0x8f09('0x3'));var rp=require(_0x8f09('0x4'));var moment=require(_0x8f09('0x5'));var BPromise=require(_0x8f09('0x6'));var Mustache=require(_0x8f09('0x7'));var util=require(_0x8f09('0x8'));var path=require(_0x8f09('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f09('0xa'));var fs=require('fs');var _=require(_0x8f09('0xb'));var squel=require(_0x8f09('0xc'));var crypto=require(_0x8f09('0xd'));var jsforce=require(_0x8f09('0xe'));var deskjs=require(_0x8f09('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f09('0x10'));var Redis=require(_0x8f09('0x11'));var authService=require(_0x8f09('0x12'));var qs=require(_0x8f09('0x13'));var as=require(_0x8f09('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8f09('0x15'));var config=require(_0x8f09('0x16'));var licenseUtil=require(_0x8f09('0x17'));var db=require(_0x8f09('0x18'))['db'];function respondWithStatusCode(_0x449590,_0x551d34){_0x551d34=_0x551d34||0xcc;return function(_0x486f4e){if(_0x486f4e){return _0x449590[_0x8f09('0x19')](_0x551d34);}return _0x449590[_0x8f09('0x1a')](_0x551d34)['end']();};}function respondWithResult(_0x5736d8,_0x4f55f8){_0x4f55f8=_0x4f55f8||0xc8;return function(_0x3d166e){if(_0x3d166e){return _0x5736d8[_0x8f09('0x1a')](_0x4f55f8)[_0x8f09('0x1b')](_0x3d166e);}};}function respondWithFilteredResult(_0xcd04a5,_0x439e3c){return function(_0x560e98){if(_0x560e98){var _0x5e25e7=_0x560e98[_0x8f09('0x1c')],_0x3474b5=_0x439e3c['offset'],_0xb8cc1b=_0x439e3c[_0x8f09('0x1d')]+_0x439e3c[_0x8f09('0x1e')],_0x21c1c2;if(_0xb8cc1b>=_0x5e25e7){_0xb8cc1b=_0x5e25e7;_0x21c1c2=0xc8;}else{_0x21c1c2=0xce;}_0xcd04a5['status'](_0x21c1c2);return _0xcd04a5['set']('Content-Range',_0x3474b5+'-'+_0xb8cc1b+'/'+_0x5e25e7)[_0x8f09('0x1b')](_0x560e98);}return null;};}function patchUpdates(_0x223d9b){return function(_0x3e9e9d){try{jsonpatch['apply'](_0x3e9e9d,_0x223d9b,!![]);}catch(_0x51a880){return BPromise[_0x8f09('0x1f')](_0x51a880);}return _0x3e9e9d[_0x8f09('0x20')]();};}function saveUpdates(_0x551027,_0x109b37){return function(_0x55be90){if(_0x55be90){return _0x55be90[_0x8f09('0x21')](_0x551027)['then'](function(_0x26e55f){return _0x26e55f;});}return null;};}function removeEntity(_0x23beac,_0x34c3d8){return function(_0x247e57){if(_0x247e57){return _0x247e57['destroy']()[_0x8f09('0x22')](function(){_0x23beac[_0x8f09('0x1a')](0xcc)[_0x8f09('0x23')]();});}};}function handleEntityNotFound(_0x48928e,_0x3fa6f2){return function(_0x310cd7){if(!_0x310cd7){_0x48928e[_0x8f09('0x19')](0x194);}return _0x310cd7;};}function handleError(_0x175766,_0x5a5a3e){_0x5a5a3e=_0x5a5a3e||0x1f4;return function(_0x4bd9bf){logger['error'](_0x4bd9bf[_0x8f09('0x24')]);if(_0x4bd9bf[_0x8f09('0x25')]){delete _0x4bd9bf[_0x8f09('0x25')];}_0x175766['status'](_0x5a5a3e)[_0x8f09('0x26')](_0x4bd9bf);};}exports[_0x8f09('0x27')]=function(_0x2dbb61,_0x1a015a){var _0x2e6c40={},_0xb1a46={},_0x4da84d={'count':0x0,'rows':[]};var _0x462c95=_[_0x8f09('0x28')](db[_0x8f09('0x29')]['rawAttributes'],function(_0x46c6b8){return{'name':_0x46c6b8[_0x8f09('0x2a')],'type':_0x46c6b8[_0x8f09('0x2b')][_0x8f09('0x2c')]};});_0xb1a46[_0x8f09('0x2d')]=_[_0x8f09('0x28')](_0x462c95,_0x8f09('0x25'));_0xb1a46[_0x8f09('0x2e')]=_['keys'](_0x2dbb61[_0x8f09('0x2e')]);_0xb1a46[_0x8f09('0x2f')]=_[_0x8f09('0x30')](_0xb1a46[_0x8f09('0x2d')],_0xb1a46[_0x8f09('0x2e')]);_0x2e6c40['attributes']=_[_0x8f09('0x30')](_0xb1a46['model'],qs['fields'](_0x2dbb61['query'][_0x8f09('0x31')]));_0x2e6c40[_0x8f09('0x32')]=_0x2e6c40[_0x8f09('0x32')][_0x8f09('0x33')]?_0x2e6c40[_0x8f09('0x32')]:_0xb1a46['model'];if(!_0x2dbb61['query'][_0x8f09('0x34')]('nolimit')){_0x2e6c40[_0x8f09('0x1e')]=qs['limit'](_0x2dbb61['query'][_0x8f09('0x1e')]);_0x2e6c40[_0x8f09('0x1d')]=qs[_0x8f09('0x1d')](_0x2dbb61['query'][_0x8f09('0x1d')]);}_0x2e6c40['order']=qs['sort'](_0x2dbb61['query'][_0x8f09('0x35')]);_0x2e6c40[_0x8f09('0x36')]=qs[_0x8f09('0x2f')](_['pick'](_0x2dbb61[_0x8f09('0x2e')],_0xb1a46['filters']),_0x462c95);if(_0x2dbb61[_0x8f09('0x2e')]['filter']){_0x2e6c40[_0x8f09('0x36')]=_[_0x8f09('0x37')](_0x2e6c40['where'],{'$or':_['map'](_0x462c95,function(_0x34c37f){if(_0x34c37f[_0x8f09('0x2b')]!=='VIRTUAL'){var _0x2e418d={};_0x2e418d[_0x34c37f[_0x8f09('0x25')]]={'$like':'%'+_0x2dbb61[_0x8f09('0x2e')][_0x8f09('0x38')]+'%'};return _0x2e418d;}})});}_0x2e6c40=_[_0x8f09('0x37')]({},_0x2e6c40,_0x2dbb61[_0x8f09('0x39')]);var _0x44e509={'where':_0x2e6c40[_0x8f09('0x36')]};return db['ChatQueueReport']['count'](_0x44e509)[_0x8f09('0x22')](function(_0x1089b6){_0x4da84d[_0x8f09('0x1c')]=_0x1089b6;if(_0x2dbb61[_0x8f09('0x2e')][_0x8f09('0x3a')]){_0x2e6c40[_0x8f09('0x3b')]=[{'all':!![]}];}return db[_0x8f09('0x29')][_0x8f09('0x3c')](_0x2e6c40);})[_0x8f09('0x22')](function(_0x1daa46){_0x4da84d['rows']=_0x1daa46;return _0x4da84d;})['then'](respondWithFilteredResult(_0x1a015a,_0x2e6c40))[_0x8f09('0x3d')](handleError(_0x1a015a,null));};exports[_0x8f09('0x3e')]=function(_0x4d3112,_0x5c314f){var _0x5dd6af={'raw':!![],'where':{'id':_0x4d3112[_0x8f09('0x3f')]['id']}},_0x28ed63={};_0x28ed63[_0x8f09('0x2d')]=_[_0x8f09('0x40')](db['ChatQueueReport'][_0x8f09('0x41')]);_0x28ed63[_0x8f09('0x2e')]=_[_0x8f09('0x40')](_0x4d3112[_0x8f09('0x2e')]);_0x28ed63[_0x8f09('0x2f')]=_[_0x8f09('0x30')](_0x28ed63[_0x8f09('0x2d')],_0x28ed63['query']);_0x5dd6af['attributes']=_[_0x8f09('0x30')](_0x28ed63[_0x8f09('0x2d')],qs[_0x8f09('0x31')](_0x4d3112[_0x8f09('0x2e')][_0x8f09('0x31')]));_0x5dd6af[_0x8f09('0x32')]=_0x5dd6af['attributes'][_0x8f09('0x33')]?_0x5dd6af['attributes']:_0x28ed63[_0x8f09('0x2d')];if(_0x4d3112[_0x8f09('0x2e')][_0x8f09('0x3a')]){_0x5dd6af[_0x8f09('0x3b')]=[{'all':!![]}];}_0x5dd6af=_[_0x8f09('0x37')]({},_0x5dd6af,_0x4d3112[_0x8f09('0x39')]);return db[_0x8f09('0x29')][_0x8f09('0x42')](_0x5dd6af)[_0x8f09('0x22')](handleEntityNotFound(_0x5c314f,null))[_0x8f09('0x22')](respondWithResult(_0x5c314f,null))['catch'](handleError(_0x5c314f,null));};exports[_0x8f09('0x43')]=function(_0x4985c1,_0x117953){return db[_0x8f09('0x29')]['create'](_0x4985c1[_0x8f09('0x44')],{})[_0x8f09('0x22')](respondWithResult(_0x117953,0xc9))['catch'](handleError(_0x117953,null));};exports[_0x8f09('0x21')]=function(_0x90be1b,_0x200cb4){if(_0x90be1b['body']['id']){delete _0x90be1b[_0x8f09('0x44')]['id'];}return db[_0x8f09('0x29')][_0x8f09('0x42')]({'where':{'id':_0x90be1b['params']['id']}})['then'](handleEntityNotFound(_0x200cb4,null))[_0x8f09('0x22')](saveUpdates(_0x90be1b[_0x8f09('0x44')],null))['then'](respondWithResult(_0x200cb4,null))[_0x8f09('0x3d')](handleError(_0x200cb4,null));};exports[_0x8f09('0x45')]=function(_0x2d6bed,_0xece135){return db[_0x8f09('0x29')]['find']({'where':{'id':_0x2d6bed[_0x8f09('0x3f')]['id']}})[_0x8f09('0x22')](handleEntityNotFound(_0xece135,null))['then'](removeEntity(_0xece135,null))[_0x8f09('0x3d')](handleError(_0xece135,null));};exports[_0x8f09('0x46')]=function(_0x112ffb,_0x394ce3){return db[_0x8f09('0x29')][_0x8f09('0x46')]()[_0x8f09('0x22')](respondWithResult(_0x394ce3,null))['catch'](handleError(_0x394ce3,null));}; \ No newline at end of file +var _0x1004=['json','count','offset','limit','set','update','then','destroy','sendStatus','stack','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1004,0x1ca));var _0x4100=function(_0x3fe155,_0x4f468){_0x3fe155=_0x3fe155-0x0;var _0x6f13c3=_0x1004[_0x3fe155];return _0x6f13c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4100('0x0'));var rimraf=require(_0x4100('0x1'));var zipdir=require(_0x4100('0x2'));var jsonpatch=require(_0x4100('0x3'));var rp=require(_0x4100('0x4'));var moment=require(_0x4100('0x5'));var BPromise=require(_0x4100('0x6'));var Mustache=require(_0x4100('0x7'));var util=require(_0x4100('0x8'));var path=require('path');var sox=require(_0x4100('0x9'));var csv=require(_0x4100('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4100('0xb'));var squel=require(_0x4100('0xc'));var crypto=require(_0x4100('0xd'));var jsforce=require(_0x4100('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4100('0xa'));var querystring=require(_0x4100('0xf'));var Papa=require(_0x4100('0x10'));var Redis=require(_0x4100('0x11'));var authService=require(_0x4100('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4100('0x13'))(_0x4100('0x14'));var utils=require(_0x4100('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4100('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e295e,_0x4c1f55){_0x4c1f55=_0x4c1f55||0xcc;return function(_0x59767b){if(_0x59767b){return _0x3e295e['sendStatus'](_0x4c1f55);}return _0x3e295e[_0x4100('0x17')](_0x4c1f55)[_0x4100('0x18')]();};}function respondWithResult(_0x10215c,_0x3fe398){_0x3fe398=_0x3fe398||0xc8;return function(_0xa033cc){if(_0xa033cc){return _0x10215c[_0x4100('0x17')](_0x3fe398)[_0x4100('0x19')](_0xa033cc);}};}function respondWithFilteredResult(_0x55c963,_0x514449){return function(_0x328dbb){if(_0x328dbb){var _0x3c1304=_0x328dbb[_0x4100('0x1a')],_0x17bcb5=_0x514449[_0x4100('0x1b')],_0x49b26d=_0x514449[_0x4100('0x1b')]+_0x514449[_0x4100('0x1c')],_0x2a812b;if(_0x49b26d>=_0x3c1304){_0x49b26d=_0x3c1304;_0x2a812b=0xc8;}else{_0x2a812b=0xce;}_0x55c963[_0x4100('0x17')](_0x2a812b);return _0x55c963[_0x4100('0x1d')]('Content-Range',_0x17bcb5+'-'+_0x49b26d+'/'+_0x3c1304)['json'](_0x328dbb);}return null;};}function patchUpdates(_0x12e092){return function(_0x4ca1c4){try{jsonpatch['apply'](_0x4ca1c4,_0x12e092,!![]);}catch(_0x8ec6d5){return BPromise['reject'](_0x8ec6d5);}return _0x4ca1c4['save']();};}function saveUpdates(_0x5a36c4,_0x222c98){return function(_0x509300){if(_0x509300){return _0x509300[_0x4100('0x1e')](_0x5a36c4)[_0x4100('0x1f')](function(_0x59a759){return _0x59a759;});}return null;};}function removeEntity(_0x35975d,_0x105da8){return function(_0x2ec1f1){if(_0x2ec1f1){return _0x2ec1f1[_0x4100('0x20')]()['then'](function(){_0x35975d[_0x4100('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fa9c,_0x5955ca){return function(_0x597954){if(!_0x597954){_0x49fa9c[_0x4100('0x21')](0x194);}return _0x597954;};}function handleError(_0x4304b0,_0x320f60){_0x320f60=_0x320f60||0x1f4;return function(_0x21207c){logger['error'](_0x21207c[_0x4100('0x22')]);if(_0x21207c['name']){delete _0x21207c['name'];}_0x4304b0[_0x4100('0x17')](_0x320f60)[_0x4100('0x23')](_0x21207c);};}exports[_0x4100('0x24')]=function(_0x42f87a,_0xf3c305){var _0x283674={},_0x2ac0fa={},_0x5f5084={'count':0x0,'rows':[]};var _0x3d015b=_[_0x4100('0x25')](db[_0x4100('0x26')][_0x4100('0x27')],function(_0x116996){return{'name':_0x116996[_0x4100('0x28')],'type':_0x116996[_0x4100('0x29')]['key']};});_0x2ac0fa[_0x4100('0x2a')]=_[_0x4100('0x25')](_0x3d015b,'name');_0x2ac0fa[_0x4100('0x2b')]=_[_0x4100('0x2c')](_0x42f87a[_0x4100('0x2b')]);_0x2ac0fa[_0x4100('0x2d')]=_[_0x4100('0x2e')](_0x2ac0fa[_0x4100('0x2a')],_0x2ac0fa['query']);_0x283674[_0x4100('0x2f')]=_[_0x4100('0x2e')](_0x2ac0fa[_0x4100('0x2a')],qs['fields'](_0x42f87a[_0x4100('0x2b')][_0x4100('0x30')]));_0x283674[_0x4100('0x2f')]=_0x283674[_0x4100('0x2f')][_0x4100('0x31')]?_0x283674[_0x4100('0x2f')]:_0x2ac0fa['model'];if(!_0x42f87a[_0x4100('0x2b')][_0x4100('0x32')](_0x4100('0x33'))){_0x283674['limit']=qs[_0x4100('0x1c')](_0x42f87a[_0x4100('0x2b')]['limit']);_0x283674['offset']=qs['offset'](_0x42f87a[_0x4100('0x2b')]['offset']);}_0x283674[_0x4100('0x34')]=qs[_0x4100('0x35')](_0x42f87a['query'][_0x4100('0x35')]);_0x283674['where']=qs[_0x4100('0x2d')](_[_0x4100('0x36')](_0x42f87a['query'],_0x2ac0fa[_0x4100('0x2d')]),_0x3d015b);if(_0x42f87a[_0x4100('0x2b')][_0x4100('0x37')]){_0x283674[_0x4100('0x38')]=_[_0x4100('0x39')](_0x283674[_0x4100('0x38')],{'$or':_[_0x4100('0x25')](_0x3d015b,function(_0x4077af){if(_0x4077af[_0x4100('0x29')]!=='VIRTUAL'){var _0x2e891a={};_0x2e891a[_0x4077af['name']]={'$like':'%'+_0x42f87a[_0x4100('0x2b')][_0x4100('0x37')]+'%'};return _0x2e891a;}})});}_0x283674=_[_0x4100('0x39')]({},_0x283674,_0x42f87a[_0x4100('0x3a')]);var _0x1d6eac={'where':_0x283674[_0x4100('0x38')]};return db[_0x4100('0x26')]['count'](_0x1d6eac)[_0x4100('0x1f')](function(_0x47c2b9){_0x5f5084[_0x4100('0x1a')]=_0x47c2b9;if(_0x42f87a[_0x4100('0x2b')][_0x4100('0x3b')]){_0x283674[_0x4100('0x3c')]=[{'all':!![]}];}return db[_0x4100('0x26')][_0x4100('0x3d')](_0x283674);})[_0x4100('0x1f')](function(_0x5a6b6e){_0x5f5084[_0x4100('0x3e')]=_0x5a6b6e;return _0x5f5084;})[_0x4100('0x1f')](respondWithFilteredResult(_0xf3c305,_0x283674))[_0x4100('0x3f')](handleError(_0xf3c305,null));};exports['show']=function(_0x39d041,_0x4863eb){var _0x49a498={'raw':!![],'where':{'id':_0x39d041['params']['id']}},_0x4d84b7={};_0x4d84b7[_0x4100('0x2a')]=_[_0x4100('0x2c')](db[_0x4100('0x26')][_0x4100('0x27')]);_0x4d84b7[_0x4100('0x2b')]=_[_0x4100('0x2c')](_0x39d041[_0x4100('0x2b')]);_0x4d84b7[_0x4100('0x2d')]=_[_0x4100('0x2e')](_0x4d84b7[_0x4100('0x2a')],_0x4d84b7[_0x4100('0x2b')]);_0x49a498[_0x4100('0x2f')]=_[_0x4100('0x2e')](_0x4d84b7['model'],qs[_0x4100('0x30')](_0x39d041[_0x4100('0x2b')][_0x4100('0x30')]));_0x49a498[_0x4100('0x2f')]=_0x49a498[_0x4100('0x2f')][_0x4100('0x31')]?_0x49a498[_0x4100('0x2f')]:_0x4d84b7['model'];if(_0x39d041[_0x4100('0x2b')][_0x4100('0x3b')]){_0x49a498[_0x4100('0x3c')]=[{'all':!![]}];}_0x49a498=_['merge']({},_0x49a498,_0x39d041[_0x4100('0x3a')]);return db['ChatQueueReport'][_0x4100('0x40')](_0x49a498)[_0x4100('0x1f')](handleEntityNotFound(_0x4863eb,null))[_0x4100('0x1f')](respondWithResult(_0x4863eb,null))[_0x4100('0x3f')](handleError(_0x4863eb,null));};exports[_0x4100('0x41')]=function(_0x1730ee,_0x79b427){return db[_0x4100('0x26')][_0x4100('0x41')](_0x1730ee['body'],{})[_0x4100('0x1f')](respondWithResult(_0x79b427,0xc9))[_0x4100('0x3f')](handleError(_0x79b427,null));};exports[_0x4100('0x1e')]=function(_0x89de35,_0x3f8099){if(_0x89de35[_0x4100('0x42')]['id']){delete _0x89de35[_0x4100('0x42')]['id'];}return db[_0x4100('0x26')][_0x4100('0x40')]({'where':{'id':_0x89de35[_0x4100('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f8099,null))['then'](saveUpdates(_0x89de35['body'],null))['then'](respondWithResult(_0x3f8099,null))['catch'](handleError(_0x3f8099,null));};exports[_0x4100('0x20')]=function(_0x522b9a,_0x16dcdb){return db[_0x4100('0x26')][_0x4100('0x40')]({'where':{'id':_0x522b9a[_0x4100('0x43')]['id']}})[_0x4100('0x1f')](handleEntityNotFound(_0x16dcdb,null))['then'](removeEntity(_0x16dcdb,null))[_0x4100('0x3f')](handleError(_0x16dcdb,null));};exports[_0x4100('0x44')]=function(_0xdeae1,_0x9356a8){return db['ChatQueueReport'][_0x4100('0x44')]()['then'](respondWithResult(_0x9356a8,null))[_0x4100('0x3f')](handleError(_0x9356a8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d9a3d31..4609375 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 _0x1f96=['lodash','util','../../config/logger','api','bluebird','request-promise','path','./chatQueueReport.attributes','define','report_chat_queue','uniqueid'];(function(_0x578fad,_0x269978){var _0x533101=function(_0x1769ea){while(--_0x1769ea){_0x578fad['push'](_0x578fad['shift']());}};_0x533101(++_0x269978);}(_0x1f96,0x197));var _0x61f9=function(_0x3fa6dc,_0x3b0771){_0x3fa6dc=_0x3fa6dc-0x0;var _0x4bfcc3=_0x1f96[_0x3fa6dc];return _0x4bfcc3;};'use strict';var _=require(_0x61f9('0x0'));var util=require(_0x61f9('0x1'));var logger=require(_0x61f9('0x2'))(_0x61f9('0x3'));var moment=require('moment');var BPromise=require(_0x61f9('0x4'));var rp=require(_0x61f9('0x5'));var fs=require('fs');var path=require(_0x61f9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61f9('0x7'));module['exports']=function(_0x546829,_0x8bbdc5){return _0x546829[_0x61f9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x61f9('0x9'),'paranoid':![],'indexes':[{'name':_0x61f9('0xa'),'fields':[_0x61f9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32b2=['api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger'];(function(_0x24a974,_0x116c40){var _0x3fb340=function(_0x349b5b){while(--_0x349b5b){_0x24a974['push'](_0x24a974['shift']());}};_0x3fb340(++_0x116c40);}(_0x32b2,0x102));var _0x232b=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x32b2[_0xd9c529];return _0x146760;};'use strict';var _=require('lodash');var util=require(_0x232b('0x0'));var logger=require(_0x232b('0x1'))(_0x232b('0x2'));var moment=require(_0x232b('0x3'));var BPromise=require(_0x232b('0x4'));var rp=require(_0x232b('0x5'));var fs=require('fs');var path=require(_0x232b('0x6'));var rimraf=require(_0x232b('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueueReport.attributes');module[_0x232b('0x8')]=function(_0x141123,_0x1f1cc8){return _0x141123[_0x232b('0x9')](_0x232b('0xa'),attributes,{'tableName':_0x232b('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x232b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fde604a..5087aa6 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 _0x03c2=['http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','where','limit','UpdateChatQueueReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x03c2,0xb5));var _0x203c=function(_0x2698af,_0x2a5c71){_0x2698af=_0x2698af-0x0;var _0x2f3267=_0x03c2[_0x2698af];return _0x2f3267;};'use strict';var _=require(_0x203c('0x0'));var util=require(_0x203c('0x1'));var moment=require(_0x203c('0x2'));var BPromise=require(_0x203c('0x3'));var rs=require(_0x203c('0x4'));var fs=require('fs');var Redis=require(_0x203c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x203c('0x6'));var logger=require('../../config/logger')(_0x203c('0x7'));var config=require(_0x203c('0x8'));var jayson=require(_0x203c('0x9'));var client=jayson[_0x203c('0xa')][_0x203c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ef7d6,_0x491c7b,_0x3e630c){return new BPromise(function(_0x480bef,_0x479b46){return client['request'](_0x1ef7d6,_0x3e630c)[_0x203c('0xc')](function(_0xab9195){logger[_0x203c('0xd')](_0x203c('0xe'),_0x491c7b,_0x203c('0xf'));logger[_0x203c('0x10')](_0x203c('0x11'),_0x491c7b,_0x203c('0xf'),JSON[_0x203c('0x12')](_0xab9195));if(_0xab9195['error']){if(_0xab9195[_0x203c('0x13')][_0x203c('0x14')]===0x1f4){logger[_0x203c('0x13')](_0x203c('0xe'),_0x491c7b,_0xab9195[_0x203c('0x13')]['message']);return _0x479b46(_0xab9195['error'][_0x203c('0x15')]);}logger[_0x203c('0x13')](_0x203c('0xe'),_0x491c7b,_0xab9195[_0x203c('0x13')]['message']);return _0x480bef(_0xab9195['error'][_0x203c('0x15')]);}else{logger[_0x203c('0xd')](_0x203c('0xe'),_0x491c7b,_0x203c('0xf'));_0x480bef(_0xab9195[_0x203c('0x16')][_0x203c('0x15')]);}})['catch'](function(_0x1551b4){logger[_0x203c('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x491c7b,_0x1551b4);_0x479b46(_0x1551b4);});});}exports[_0x203c('0x17')]=function(_0x3d89f4){var _0x3ffd23=this;return new Promise(function(_0x682f48,_0x882e83){return db[_0x203c('0x18')][_0x203c('0x19')](_0x3d89f4[_0x203c('0x1a')],{'raw':_0x3d89f4['options']?_0x3d89f4['options']['raw']===undefined?!![]:![]:!![]})[_0x203c('0xc')](function(_0x1eb317){logger[_0x203c('0xd')](_0x203c('0x17'),_0x3d89f4);logger[_0x203c('0x10')](_0x203c('0x17'),_0x3d89f4,JSON[_0x203c('0x12')](_0x1eb317));_0x682f48(_0x1eb317);})['catch'](function(_0x1a1c1c){logger[_0x203c('0x13')]('CreateChatQueueReport',_0x1a1c1c[_0x203c('0x15')],_0x3d89f4);_0x882e83(_0x3ffd23['error'](0x1f4,_0x1a1c1c['message']));});});};exports['UpdateChatQueueReport']=function(_0x219b90){var _0x862fdd=this;return new Promise(function(_0x50c33b,_0x5ec7dc){return db[_0x203c('0x18')]['update'](_0x219b90[_0x203c('0x1a')],{'raw':_0x219b90[_0x203c('0x1b')]?_0x219b90[_0x203c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x219b90[_0x203c('0x1b')]?_0x219b90[_0x203c('0x1b')][_0x203c('0x1c')]||null:null,'attributes':_0x219b90[_0x203c('0x1b')]?_0x219b90['options']['attributes']||null:null,'limit':_0x219b90[_0x203c('0x1b')]?_0x219b90[_0x203c('0x1b')][_0x203c('0x1d')]||null:null})[_0x203c('0xc')](function(_0x3185ab){logger[_0x203c('0xd')](_0x203c('0x1e'),_0x219b90);logger[_0x203c('0x10')](_0x203c('0x1e'),_0x219b90,JSON[_0x203c('0x12')](_0x3185ab));_0x50c33b(_0x3185ab);})[_0x203c('0x1f')](function(_0x431537){logger['error'](_0x203c('0x1e'),_0x431537['message'],_0x219b90);_0x5ec7dc(_0x862fdd[_0x203c('0x13')](0x1f4,_0x431537[_0x203c('0x15')]));});});}; \ No newline at end of file +var _0xe040=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','options','CreateChatQueueReport','UpdateChatQueueReport','update','raw','where','attributes','limit','util'];(function(_0x1880dd,_0x10e591){var _0x3b377c=function(_0x508876){while(--_0x508876){_0x1880dd['push'](_0x1880dd['shift']());}};_0x3b377c(++_0x10e591);}(_0xe040,0x7f));var _0x0e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe040[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0e04('0x0'));var moment=require(_0x0e04('0x1'));var BPromise=require(_0x0e04('0x2'));var rs=require(_0x0e04('0x3'));var fs=require('fs');var Redis=require(_0x0e04('0x4'));var db=require(_0x0e04('0x5'))['db'];var utils=require(_0x0e04('0x6'));var logger=require(_0x0e04('0x7'))(_0x0e04('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8978,_0x37630c,_0x1634ba){return new BPromise(function(_0x2e80c1,_0xc34b4e){return client[_0x0e04('0x9')](_0x1c8978,_0x1634ba)[_0x0e04('0xa')](function(_0x263041){logger[_0x0e04('0xb')](_0x0e04('0xc'),_0x37630c,_0x0e04('0xd'));logger[_0x0e04('0xe')](_0x0e04('0xf'),_0x37630c,'request\x20sent',JSON[_0x0e04('0x10')](_0x263041));if(_0x263041[_0x0e04('0x11')]){if(_0x263041[_0x0e04('0x11')][_0x0e04('0x12')]===0x1f4){logger[_0x0e04('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x37630c,_0x263041[_0x0e04('0x11')][_0x0e04('0x13')]);return _0xc34b4e(_0x263041[_0x0e04('0x11')][_0x0e04('0x13')]);}logger[_0x0e04('0x11')](_0x0e04('0xc'),_0x37630c,_0x263041[_0x0e04('0x11')]['message']);return _0x2e80c1(_0x263041[_0x0e04('0x11')]['message']);}else{logger[_0x0e04('0xb')](_0x0e04('0xc'),_0x37630c,_0x0e04('0xd'));_0x2e80c1(_0x263041[_0x0e04('0x14')][_0x0e04('0x13')]);}})[_0x0e04('0x15')](function(_0x1a0857){logger[_0x0e04('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x37630c,_0x1a0857);_0xc34b4e(_0x1a0857);});});}exports['CreateChatQueueReport']=function(_0x2f2719){var _0x522863=this;return new Promise(function(_0x131107,_0x3e9b7a){return db[_0x0e04('0x16')][_0x0e04('0x17')](_0x2f2719['body'],{'raw':_0x2f2719[_0x0e04('0x18')]?_0x2f2719[_0x0e04('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0e04('0xa')](function(_0x96b29b){logger[_0x0e04('0xb')](_0x0e04('0x19'),_0x2f2719);logger[_0x0e04('0xe')](_0x0e04('0x19'),_0x2f2719,JSON[_0x0e04('0x10')](_0x96b29b));_0x131107(_0x96b29b);})[_0x0e04('0x15')](function(_0x767417){logger[_0x0e04('0x11')](_0x0e04('0x19'),_0x767417['message'],_0x2f2719);_0x3e9b7a(_0x522863[_0x0e04('0x11')](0x1f4,_0x767417[_0x0e04('0x13')]));});});};exports[_0x0e04('0x1a')]=function(_0x93d669){var _0x57dd4f=this;return new Promise(function(_0x3350c4,_0x37e680){return db[_0x0e04('0x16')][_0x0e04('0x1b')](_0x93d669['body'],{'raw':_0x93d669[_0x0e04('0x18')]?_0x93d669[_0x0e04('0x18')][_0x0e04('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x93d669[_0x0e04('0x18')]?_0x93d669[_0x0e04('0x18')][_0x0e04('0x1d')]||null:null,'attributes':_0x93d669['options']?_0x93d669['options'][_0x0e04('0x1e')]||null:null,'limit':_0x93d669['options']?_0x93d669['options'][_0x0e04('0x1f')]||null:null})[_0x0e04('0xa')](function(_0x5b5e4a){logger[_0x0e04('0xb')](_0x0e04('0x1a'),_0x93d669);logger[_0x0e04('0xe')](_0x0e04('0x1a'),_0x93d669,JSON[_0x0e04('0x10')](_0x5b5e4a));_0x3350c4(_0x5b5e4a);})['catch'](function(_0x16e9e8){logger[_0x0e04('0x11')](_0x0e04('0x1a'),_0x16e9e8[_0x0e04('0x13')],_0x93d669);_0x37e680(_0x57dd4f[_0x0e04('0x11')](0x1f4,_0x16e9e8[_0x0e04('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 35d756a..2813e75 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 _0x39fb=['get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x5d109f,_0x1342e4){var _0xf751ce=function(_0x3e12dd){while(--_0x3e12dd){_0x5d109f['push'](_0x5d109f['shift']());}};_0xf751ce(++_0x1342e4);}(_0x39fb,0x10f));var _0xb39f=function(_0x1eadbe,_0x4621f9){_0x1eadbe=_0x1eadbe-0x0;var _0x68f6c5=_0x39fb[_0x1eadbe];return _0x68f6c5;};'use strict';var multer=require(_0xb39f('0x0'));var util=require(_0xb39f('0x1'));var path=require(_0xb39f('0x2'));var timeout=require(_0xb39f('0x3'));var express=require('express');var router=express[_0xb39f('0x4')]();var auth=require(_0xb39f('0x5'));var interaction=require(_0xb39f('0x6'));var config=require(_0xb39f('0x7'));var controller=require(_0xb39f('0x8'));router[_0xb39f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb39f('0x9')]('/describe',auth[_0xb39f('0xa')](),controller[_0xb39f('0xb')]);router[_0xb39f('0x9')](_0xb39f('0xc'),auth['isAuthenticated'](),controller[_0xb39f('0xd')]);router[_0xb39f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb39f('0xf')](_0xb39f('0xc'),auth['isAuthenticated'](),controller[_0xb39f('0x10')]);router[_0xb39f('0x11')](_0xb39f('0xc'),auth[_0xb39f('0xa')](),controller[_0xb39f('0x12')]);module[_0xb39f('0x13')]=router; \ No newline at end of file +var _0x6fc5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','multer','util','path'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x6fc5,0x1eb));var _0x56fc=function(_0xf61270,_0x8f2a74){_0xf61270=_0xf61270-0x0;var _0x28dcd7=_0x6fc5[_0xf61270];return _0x28dcd7;};'use strict';var multer=require(_0x56fc('0x0'));var util=require(_0x56fc('0x1'));var path=require(_0x56fc('0x2'));var timeout=require(_0x56fc('0x3'));var express=require(_0x56fc('0x4'));var router=express[_0x56fc('0x5')]();var auth=require(_0x56fc('0x6'));var interaction=require(_0x56fc('0x7'));var config=require(_0x56fc('0x8'));var controller=require('./chatQueueReport.controller');router[_0x56fc('0x9')]('/',auth[_0x56fc('0xa')](),controller[_0x56fc('0xb')]);router[_0x56fc('0x9')](_0x56fc('0xc'),auth[_0x56fc('0xa')](),controller['describe']);router['get'](_0x56fc('0xd'),auth[_0x56fc('0xa')](),controller[_0x56fc('0xe')]);router[_0x56fc('0xf')]('/',auth[_0x56fc('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x56fc('0x10')]);router[_0x56fc('0x11')](_0x56fc('0xd'),auth[_0x56fc('0xa')](),controller[_0x56fc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a76e234..a4b9558 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 _0x1b0b=['moment','sequelize','exports','STRING','ENUM','account','queue','DATE','NOW'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1b0b,0x171));var _0xb1b0=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1b0b[_0x209941];return _0x1e8729;};'use strict';var moment=require(_0xb1b0('0x0'));var Sequelize=require(_0xb1b0('0x1'));module[_0xb1b0('0x2')]={'uniqueid':{'type':Sequelize[_0xb1b0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb1b0('0x4')](_0xb1b0('0x5'),'agent','queue'),'allowNull':![],'defaultValue':_0xb1b0('0x6')},'transferredAt':{'type':Sequelize[_0xb1b0('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xb1b0('0x8')]}}; \ No newline at end of file +var _0xb59e=['queue','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x320dd0,_0x266a5b){var _0x1ffb02=function(_0x23fc0c){while(--_0x23fc0c){_0x320dd0['push'](_0x320dd0['shift']());}};_0x1ffb02(++_0x266a5b);}(_0xb59e,0xda));var _0xeb59=function(_0x3f1403,_0x59973c){_0x3f1403=_0x3f1403-0x0;var _0xd8daa3=_0xb59e[_0x3f1403];return _0xd8daa3;};'use strict';var moment=require(_0xeb59('0x0'));var Sequelize=require(_0xeb59('0x1'));module[_0xeb59('0x2')]={'uniqueid':{'type':Sequelize[_0xeb59('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xeb59('0x4')](_0xeb59('0x5'),'agent',_0xeb59('0x6')),'allowNull':![],'defaultValue':_0xeb59('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xeb59('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 62265b9..148fe65 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 _0x2299=['catch','params','include','options','create','body','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','ChatTransferReport','includeAll','findAll','rows'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x2299,0x167));var _0x9229=function(_0x327e78,_0x5eb501){_0x327e78=_0x327e78-0x0;var _0x43697a=_0x2299[_0x327e78];return _0x43697a;};'use strict';var pdf=require(_0x9229('0x0'));var emlformat=require(_0x9229('0x1'));var rimraf=require(_0x9229('0x2'));var zipdir=require(_0x9229('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9229('0x4'));var util=require('util');var path=require(_0x9229('0x5'));var sox=require(_0x9229('0x6'));var csv=require(_0x9229('0x7'));var ejs=require(_0x9229('0x8'));var fs=require('fs');var _=require(_0x9229('0x9'));var squel=require('squel');var crypto=require(_0x9229('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9229('0x7'));var querystring=require(_0x9229('0xb'));var Papa=require('papaparse');var Redis=require(_0x9229('0xc'));var authService=require(_0x9229('0xd'));var qs=require(_0x9229('0xe'));var as=require(_0x9229('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9229('0x10'));var utils=require(_0x9229('0x11'));var config=require(_0x9229('0x12'));var licenseUtil=require(_0x9229('0x13'));var db=require(_0x9229('0x14'))['db'];function respondWithStatusCode(_0x39c5ff,_0x4d59f2){_0x4d59f2=_0x4d59f2||0xcc;return function(_0x3a5784){if(_0x3a5784){return _0x39c5ff[_0x9229('0x15')](_0x4d59f2);}return _0x39c5ff[_0x9229('0x16')](_0x4d59f2)[_0x9229('0x17')]();};}function respondWithResult(_0x84b3b7,_0x57f9b6){_0x57f9b6=_0x57f9b6||0xc8;return function(_0x3260f4){if(_0x3260f4){return _0x84b3b7['status'](_0x57f9b6)[_0x9229('0x18')](_0x3260f4);}};}function respondWithFilteredResult(_0x375edd,_0xed8c06){return function(_0x4cba57){if(_0x4cba57){var _0x16dbdc=_0x4cba57[_0x9229('0x19')],_0x48aaa3=_0xed8c06['offset'],_0x58de83=_0xed8c06[_0x9229('0x1a')]+_0xed8c06[_0x9229('0x1b')],_0x156627;if(_0x58de83>=_0x16dbdc){_0x58de83=_0x16dbdc;_0x156627=0xc8;}else{_0x156627=0xce;}_0x375edd[_0x9229('0x16')](_0x156627);return _0x375edd[_0x9229('0x1c')]('Content-Range',_0x48aaa3+'-'+_0x58de83+'/'+_0x16dbdc)['json'](_0x4cba57);}return null;};}function patchUpdates(_0x371d57){return function(_0x17a011){try{jsonpatch[_0x9229('0x1d')](_0x17a011,_0x371d57,!![]);}catch(_0x1e76fd){return BPromise['reject'](_0x1e76fd);}return _0x17a011[_0x9229('0x1e')]();};}function saveUpdates(_0x2bedf3,_0x2a5254){return function(_0x126c57){if(_0x126c57){return _0x126c57[_0x9229('0x1f')](_0x2bedf3)[_0x9229('0x20')](function(_0x2ea9be){return _0x2ea9be;});}return null;};}function removeEntity(_0x11ad71,_0x4f5e1e){return function(_0x38facc){if(_0x38facc){return _0x38facc['destroy']()[_0x9229('0x20')](function(){_0x11ad71[_0x9229('0x16')](0xcc)[_0x9229('0x17')]();});}};}function handleEntityNotFound(_0x1c047a,_0x4c25f9){return function(_0x46ede7){if(!_0x46ede7){_0x1c047a[_0x9229('0x15')](0x194);}return _0x46ede7;};}function handleError(_0xb396a,_0x4a5324){_0x4a5324=_0x4a5324||0x1f4;return function(_0x5580a9){logger['error'](_0x5580a9[_0x9229('0x21')]);if(_0x5580a9[_0x9229('0x22')]){delete _0x5580a9[_0x9229('0x22')];}_0xb396a[_0x9229('0x16')](_0x4a5324)[_0x9229('0x23')](_0x5580a9);};}exports[_0x9229('0x24')]=function(_0x43216f,_0x321fe1){var _0x4a8304={},_0x12bfcd={},_0x3e3cb5={'count':0x0,'rows':[]};var _0x56c450=_['map'](db['ChatTransferReport'][_0x9229('0x25')],function(_0x531731){return{'name':_0x531731[_0x9229('0x26')],'type':_0x531731[_0x9229('0x27')][_0x9229('0x28')]};});_0x12bfcd[_0x9229('0x29')]=_[_0x9229('0x2a')](_0x56c450,_0x9229('0x22'));_0x12bfcd[_0x9229('0x2b')]=_[_0x9229('0x2c')](_0x43216f[_0x9229('0x2b')]);_0x12bfcd[_0x9229('0x2d')]=_[_0x9229('0x2e')](_0x12bfcd[_0x9229('0x29')],_0x12bfcd[_0x9229('0x2b')]);_0x4a8304[_0x9229('0x2f')]=_[_0x9229('0x2e')](_0x12bfcd[_0x9229('0x29')],qs['fields'](_0x43216f['query'][_0x9229('0x30')]));_0x4a8304[_0x9229('0x2f')]=_0x4a8304[_0x9229('0x2f')][_0x9229('0x31')]?_0x4a8304[_0x9229('0x2f')]:_0x12bfcd[_0x9229('0x29')];if(!_0x43216f['query'][_0x9229('0x32')]('nolimit')){_0x4a8304[_0x9229('0x1b')]=qs['limit'](_0x43216f[_0x9229('0x2b')]['limit']);_0x4a8304['offset']=qs['offset'](_0x43216f[_0x9229('0x2b')][_0x9229('0x1a')]);}_0x4a8304[_0x9229('0x33')]=qs[_0x9229('0x34')](_0x43216f[_0x9229('0x2b')]['sort']);_0x4a8304[_0x9229('0x35')]=qs[_0x9229('0x2d')](_[_0x9229('0x36')](_0x43216f[_0x9229('0x2b')],_0x12bfcd[_0x9229('0x2d')]),_0x56c450);if(_0x43216f[_0x9229('0x2b')]['filter']){_0x4a8304['where']=_[_0x9229('0x37')](_0x4a8304[_0x9229('0x35')],{'$or':_[_0x9229('0x2a')](_0x56c450,function(_0xdb9e11){if(_0xdb9e11[_0x9229('0x27')]!==_0x9229('0x38')){var _0x4e428e={};_0x4e428e[_0xdb9e11[_0x9229('0x22')]]={'$like':'%'+_0x43216f['query']['filter']+'%'};return _0x4e428e;}})});}_0x4a8304=_[_0x9229('0x37')]({},_0x4a8304,_0x43216f['options']);var _0x1e98eb={'where':_0x4a8304[_0x9229('0x35')]};return db[_0x9229('0x39')][_0x9229('0x19')](_0x1e98eb)[_0x9229('0x20')](function(_0x53fdcc){_0x3e3cb5['count']=_0x53fdcc;if(_0x43216f['query'][_0x9229('0x3a')]){_0x4a8304['include']=[{'all':!![]}];}return db[_0x9229('0x39')][_0x9229('0x3b')](_0x4a8304);})[_0x9229('0x20')](function(_0x5b6112){_0x3e3cb5[_0x9229('0x3c')]=_0x5b6112;return _0x3e3cb5;})[_0x9229('0x20')](respondWithFilteredResult(_0x321fe1,_0x4a8304))[_0x9229('0x3d')](handleError(_0x321fe1,null));};exports['show']=function(_0x5bbb89,_0x48cbaf){var _0x5bb1be={'raw':!![],'where':{'id':_0x5bbb89[_0x9229('0x3e')]['id']}},_0x9e4af8={};_0x9e4af8[_0x9229('0x29')]=_['keys'](db[_0x9229('0x39')][_0x9229('0x25')]);_0x9e4af8[_0x9229('0x2b')]=_[_0x9229('0x2c')](_0x5bbb89[_0x9229('0x2b')]);_0x9e4af8[_0x9229('0x2d')]=_[_0x9229('0x2e')](_0x9e4af8[_0x9229('0x29')],_0x9e4af8['query']);_0x5bb1be[_0x9229('0x2f')]=_[_0x9229('0x2e')](_0x9e4af8['model'],qs[_0x9229('0x30')](_0x5bbb89['query'][_0x9229('0x30')]));_0x5bb1be[_0x9229('0x2f')]=_0x5bb1be[_0x9229('0x2f')][_0x9229('0x31')]?_0x5bb1be[_0x9229('0x2f')]:_0x9e4af8['model'];if(_0x5bbb89[_0x9229('0x2b')]['includeAll']){_0x5bb1be[_0x9229('0x3f')]=[{'all':!![]}];}_0x5bb1be=_['merge']({},_0x5bb1be,_0x5bbb89[_0x9229('0x40')]);return db[_0x9229('0x39')]['find'](_0x5bb1be)[_0x9229('0x20')](handleEntityNotFound(_0x48cbaf,null))[_0x9229('0x20')](respondWithResult(_0x48cbaf,null))['catch'](handleError(_0x48cbaf,null));};exports[_0x9229('0x41')]=function(_0x38be3a,_0x5add3e){return db[_0x9229('0x39')]['create'](_0x38be3a[_0x9229('0x42')],{})[_0x9229('0x20')](respondWithResult(_0x5add3e,0xc9))[_0x9229('0x3d')](handleError(_0x5add3e,null));};exports[_0x9229('0x1f')]=function(_0x4c1076,_0x1b0555){if(_0x4c1076['body']['id']){delete _0x4c1076[_0x9229('0x42')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x4c1076['params']['id']}})[_0x9229('0x20')](handleEntityNotFound(_0x1b0555,null))['then'](saveUpdates(_0x4c1076[_0x9229('0x42')],null))['then'](respondWithResult(_0x1b0555,null))[_0x9229('0x3d')](handleError(_0x1b0555,null));};exports[_0x9229('0x43')]=function(_0x2ecedc,_0x26df6f){return db['ChatTransferReport'][_0x9229('0x44')]({'where':{'id':_0x2ecedc[_0x9229('0x3e')]['id']}})[_0x9229('0x20')](handleEntityNotFound(_0x26df6f,null))[_0x9229('0x20')](removeEntity(_0x26df6f,null))[_0x9229('0x3d')](handleError(_0x26df6f,null));};exports[_0x9229('0x45')]=function(_0xc6bdb9,_0x549824){return db[_0x9229('0x39')][_0x9229('0x45')]()[_0x9229('0x20')](respondWithResult(_0x549824,null))[_0x9229('0x3d')](handleError(_0x549824,null));}; \ No newline at end of file +var _0x32a4=['stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','show','params','keys','merge','catch','create','body','update','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','error'];(function(_0x4f7418,_0x1755cc){var _0x4afe7e=function(_0x5ae646){while(--_0x5ae646){_0x4f7418['push'](_0x4f7418['shift']());}};_0x4afe7e(++_0x1755cc);}(_0x32a4,0x6f));var _0x432a=function(_0x48863d,_0xb57402){_0x48863d=_0x48863d-0x0;var _0x16c8f1=_0x32a4[_0x48863d];return _0x16c8f1;};'use strict';var pdf=require(_0x432a('0x0'));var emlformat=require(_0x432a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x432a('0x2'));var jsonpatch=require(_0x432a('0x3'));var rp=require(_0x432a('0x4'));var moment=require(_0x432a('0x5'));var BPromise=require(_0x432a('0x6'));var Mustache=require(_0x432a('0x7'));var util=require(_0x432a('0x8'));var path=require(_0x432a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x432a('0xa'));var squel=require('squel');var crypto=require(_0x432a('0xb'));var jsforce=require(_0x432a('0xc'));var deskjs=require(_0x432a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432a('0xe'));var Papa=require(_0x432a('0xf'));var Redis=require(_0x432a('0x10'));var authService=require(_0x432a('0x11'));var qs=require(_0x432a('0x12'));var as=require(_0x432a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x432a('0x14'));var utils=require(_0x432a('0x15'));var config=require(_0x432a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107e79,_0x8cfa2c){_0x8cfa2c=_0x8cfa2c||0xcc;return function(_0x259db5){if(_0x259db5){return _0x107e79[_0x432a('0x17')](_0x8cfa2c);}return _0x107e79['status'](_0x8cfa2c)[_0x432a('0x18')]();};}function respondWithResult(_0x38b3df,_0x36cd7c){_0x36cd7c=_0x36cd7c||0xc8;return function(_0x46eb3f){if(_0x46eb3f){return _0x38b3df['status'](_0x36cd7c)[_0x432a('0x19')](_0x46eb3f);}};}function respondWithFilteredResult(_0x2128de,_0x5227fb){return function(_0x32c20a){if(_0x32c20a){var _0x30ddb6=_0x32c20a[_0x432a('0x1a')],_0x547bce=_0x5227fb[_0x432a('0x1b')],_0x523796=_0x5227fb[_0x432a('0x1b')]+_0x5227fb[_0x432a('0x1c')],_0x23e2c3;if(_0x523796>=_0x30ddb6){_0x523796=_0x30ddb6;_0x23e2c3=0xc8;}else{_0x23e2c3=0xce;}_0x2128de[_0x432a('0x1d')](_0x23e2c3);return _0x2128de[_0x432a('0x1e')](_0x432a('0x1f'),_0x547bce+'-'+_0x523796+'/'+_0x30ddb6)['json'](_0x32c20a);}return null;};}function patchUpdates(_0x534918){return function(_0x247a93){try{jsonpatch[_0x432a('0x20')](_0x247a93,_0x534918,!![]);}catch(_0x581b54){return BPromise[_0x432a('0x21')](_0x581b54);}return _0x247a93[_0x432a('0x22')]();};}function saveUpdates(_0x18e5e0,_0x1c060f){return function(_0xddfd06){if(_0xddfd06){return _0xddfd06['update'](_0x18e5e0)[_0x432a('0x23')](function(_0x14b517){return _0x14b517;});}return null;};}function removeEntity(_0x17f6fe,_0x453188){return function(_0x4eff89){if(_0x4eff89){return _0x4eff89['destroy']()[_0x432a('0x23')](function(){_0x17f6fe[_0x432a('0x1d')](0xcc)[_0x432a('0x18')]();});}};}function handleEntityNotFound(_0x3d1e26,_0x2d6b12){return function(_0x3bfd98){if(!_0x3bfd98){_0x3d1e26[_0x432a('0x17')](0x194);}return _0x3bfd98;};}function handleError(_0x5431a1,_0x31baf7){_0x31baf7=_0x31baf7||0x1f4;return function(_0x8e5731){logger[_0x432a('0x24')](_0x8e5731[_0x432a('0x25')]);if(_0x8e5731[_0x432a('0x26')]){delete _0x8e5731[_0x432a('0x26')];}_0x5431a1['status'](_0x31baf7)[_0x432a('0x27')](_0x8e5731);};}exports[_0x432a('0x28')]=function(_0xf70c7d,_0x5c0c40){var _0x11eb91={},_0x43559c={},_0x56d391={'count':0x0,'rows':[]};var _0x83e78f=_[_0x432a('0x29')](db[_0x432a('0x2a')][_0x432a('0x2b')],function(_0x9cfb5a){return{'name':_0x9cfb5a[_0x432a('0x2c')],'type':_0x9cfb5a[_0x432a('0x2d')]['key']};});_0x43559c[_0x432a('0x2e')]=_['map'](_0x83e78f,'name');_0x43559c['query']=_['keys'](_0xf70c7d[_0x432a('0x2f')]);_0x43559c[_0x432a('0x30')]=_[_0x432a('0x31')](_0x43559c['model'],_0x43559c[_0x432a('0x2f')]);_0x11eb91[_0x432a('0x32')]=_['intersection'](_0x43559c[_0x432a('0x2e')],qs[_0x432a('0x33')](_0xf70c7d[_0x432a('0x2f')]['fields']));_0x11eb91[_0x432a('0x32')]=_0x11eb91[_0x432a('0x32')][_0x432a('0x34')]?_0x11eb91[_0x432a('0x32')]:_0x43559c['model'];if(!_0xf70c7d[_0x432a('0x2f')]['hasOwnProperty'](_0x432a('0x35'))){_0x11eb91[_0x432a('0x1c')]=qs['limit'](_0xf70c7d[_0x432a('0x2f')][_0x432a('0x1c')]);_0x11eb91['offset']=qs[_0x432a('0x1b')](_0xf70c7d[_0x432a('0x2f')]['offset']);}_0x11eb91[_0x432a('0x36')]=qs[_0x432a('0x37')](_0xf70c7d[_0x432a('0x2f')]['sort']);_0x11eb91[_0x432a('0x38')]=qs[_0x432a('0x30')](_[_0x432a('0x39')](_0xf70c7d[_0x432a('0x2f')],_0x43559c['filters']),_0x83e78f);if(_0xf70c7d[_0x432a('0x2f')][_0x432a('0x3a')]){_0x11eb91['where']=_['merge'](_0x11eb91[_0x432a('0x38')],{'$or':_['map'](_0x83e78f,function(_0x2387b0){if(_0x2387b0['type']!=='VIRTUAL'){var _0x14c58e={};_0x14c58e[_0x2387b0[_0x432a('0x26')]]={'$like':'%'+_0xf70c7d[_0x432a('0x2f')][_0x432a('0x3a')]+'%'};return _0x14c58e;}})});}_0x11eb91=_['merge']({},_0x11eb91,_0xf70c7d[_0x432a('0x3b')]);var _0x1b7d8a={'where':_0x11eb91[_0x432a('0x38')]};return db['ChatTransferReport'][_0x432a('0x1a')](_0x1b7d8a)[_0x432a('0x23')](function(_0x5008f9){_0x56d391['count']=_0x5008f9;if(_0xf70c7d[_0x432a('0x2f')]['includeAll']){_0x11eb91[_0x432a('0x3c')]=[{'all':!![]}];}return db[_0x432a('0x2a')][_0x432a('0x3d')](_0x11eb91);})[_0x432a('0x23')](function(_0x11f323){_0x56d391[_0x432a('0x3e')]=_0x11f323;return _0x56d391;})[_0x432a('0x23')](respondWithFilteredResult(_0x5c0c40,_0x11eb91))['catch'](handleError(_0x5c0c40,null));};exports[_0x432a('0x3f')]=function(_0x392e1a,_0x47e780){var _0x40489b={'raw':!![],'where':{'id':_0x392e1a[_0x432a('0x40')]['id']}},_0x2dfc45={};_0x2dfc45[_0x432a('0x2e')]=_[_0x432a('0x41')](db[_0x432a('0x2a')][_0x432a('0x2b')]);_0x2dfc45[_0x432a('0x2f')]=_[_0x432a('0x41')](_0x392e1a['query']);_0x2dfc45[_0x432a('0x30')]=_[_0x432a('0x31')](_0x2dfc45[_0x432a('0x2e')],_0x2dfc45[_0x432a('0x2f')]);_0x40489b[_0x432a('0x32')]=_['intersection'](_0x2dfc45['model'],qs[_0x432a('0x33')](_0x392e1a[_0x432a('0x2f')][_0x432a('0x33')]));_0x40489b['attributes']=_0x40489b[_0x432a('0x32')][_0x432a('0x34')]?_0x40489b[_0x432a('0x32')]:_0x2dfc45[_0x432a('0x2e')];if(_0x392e1a['query']['includeAll']){_0x40489b[_0x432a('0x3c')]=[{'all':!![]}];}_0x40489b=_[_0x432a('0x42')]({},_0x40489b,_0x392e1a[_0x432a('0x3b')]);return db[_0x432a('0x2a')]['find'](_0x40489b)[_0x432a('0x23')](handleEntityNotFound(_0x47e780,null))[_0x432a('0x23')](respondWithResult(_0x47e780,null))[_0x432a('0x43')](handleError(_0x47e780,null));};exports[_0x432a('0x44')]=function(_0x705ac5,_0x43a236){return db[_0x432a('0x2a')][_0x432a('0x44')](_0x705ac5[_0x432a('0x45')],{})[_0x432a('0x23')](respondWithResult(_0x43a236,0xc9))['catch'](handleError(_0x43a236,null));};exports[_0x432a('0x46')]=function(_0x3092cb,_0x16aeac){if(_0x3092cb['body']['id']){delete _0x3092cb[_0x432a('0x45')]['id'];}return db[_0x432a('0x2a')][_0x432a('0x47')]({'where':{'id':_0x3092cb[_0x432a('0x40')]['id']}})[_0x432a('0x23')](handleEntityNotFound(_0x16aeac,null))[_0x432a('0x23')](saveUpdates(_0x3092cb['body'],null))[_0x432a('0x23')](respondWithResult(_0x16aeac,null))['catch'](handleError(_0x16aeac,null));};exports[_0x432a('0x48')]=function(_0x1e6fff,_0x3b8b67){return db[_0x432a('0x2a')][_0x432a('0x47')]({'where':{'id':_0x1e6fff[_0x432a('0x40')]['id']}})[_0x432a('0x23')](handleEntityNotFound(_0x3b8b67,null))['then'](removeEntity(_0x3b8b67,null))[_0x432a('0x43')](handleError(_0x3b8b67,null));};exports['describe']=function(_0x36809a,_0x12e0b9){return db[_0x432a('0x2a')][_0x432a('0x49')]()['then'](respondWithResult(_0x12e0b9,null))[_0x432a('0x43')](handleError(_0x12e0b9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9256e32..327646d 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 _0x9dbc=['util','api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x5252e3,_0x35c80e){var _0x5ceb44=function(_0x757362){while(--_0x757362){_0x5252e3['push'](_0x5252e3['shift']());}};_0x5ceb44(++_0x35c80e);}(_0x9dbc,0x15e));var _0xc9db=function(_0x4262ff,_0x54eac3){_0x4262ff=_0x4262ff-0x0;var _0x347ca6=_0x9dbc[_0x4262ff];return _0x347ca6;};'use strict';var _=require(_0xc9db('0x0'));var util=require(_0xc9db('0x1'));var logger=require('../../config/logger')(_0xc9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9db('0x3'));var fs=require('fs');var path=require(_0xc9db('0x4'));var rimraf=require(_0xc9db('0x5'));var config=require(_0xc9db('0x6'));var attributes=require(_0xc9db('0x7'));module[_0xc9db('0x8')]=function(_0x29087b,_0x5ac03e){return _0x29087b[_0xc9db('0x9')](_0xc9db('0xa'),attributes,{'tableName':_0xc9db('0xb'),'paranoid':![],'indexes':[{'name':_0xc9db('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ca7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x5bbfd1,_0x388977){var _0x573219=function(_0x200441){while(--_0x200441){_0x5bbfd1['push'](_0x5bbfd1['shift']());}};_0x573219(++_0x388977);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78ca('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x78ca('0x1'));var BPromise=require(_0x78ca('0x2'));var rp=require(_0x78ca('0x3'));var fs=require('fs');var path=require(_0x78ca('0x4'));var rimraf=require(_0x78ca('0x5'));var config=require(_0x78ca('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x78ca('0x7')]=function(_0x348764,_0xb3b329){return _0x348764[_0x78ca('0x8')](_0x78ca('0x9'),attributes,{'tableName':_0x78ca('0xa'),'paranoid':![],'indexes':[{'name':_0x78ca('0xb'),'fields':[_0x78ca('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ceec816..316bd7a 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 _0xbd63=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x7e190d,_0x41c650){var _0x5dad7b=function(_0x23765c){while(--_0x23765c){_0x7e190d['push'](_0x7e190d['shift']());}};_0x5dad7b(++_0x41c650);}(_0xbd63,0x99));var _0x3bd6=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbd63[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x3bd6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bd6('0x1'));var fs=require('fs');var Redis=require(_0x3bd6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bd6('0x3'));var logger=require(_0x3bd6('0x4'))(_0x3bd6('0x5'));var config=require(_0x3bd6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3bd6('0x7')][_0x3bd6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f3d1f,_0x161fa3,_0x4bd256){return new BPromise(function(_0x494561,_0x21ddc9){return client[_0x3bd6('0x9')](_0x1f3d1f,_0x4bd256)[_0x3bd6('0xa')](function(_0x3d1f0f){logger[_0x3bd6('0xb')](_0x3bd6('0xc'),_0x161fa3,_0x3bd6('0xd'));logger[_0x3bd6('0xe')](_0x3bd6('0xf'),_0x161fa3,'request\x20sent',JSON[_0x3bd6('0x10')](_0x3d1f0f));if(_0x3d1f0f[_0x3bd6('0x11')]){if(_0x3d1f0f[_0x3bd6('0x11')][_0x3bd6('0x12')]===0x1f4){logger[_0x3bd6('0x11')](_0x3bd6('0xc'),_0x161fa3,_0x3d1f0f[_0x3bd6('0x11')][_0x3bd6('0x13')]);return _0x21ddc9(_0x3d1f0f[_0x3bd6('0x11')][_0x3bd6('0x13')]);}logger[_0x3bd6('0x11')](_0x3bd6('0xc'),_0x161fa3,_0x3d1f0f[_0x3bd6('0x11')][_0x3bd6('0x13')]);return _0x494561(_0x3d1f0f[_0x3bd6('0x11')]['message']);}else{logger[_0x3bd6('0xb')](_0x3bd6('0xc'),_0x161fa3,'request\x20sent');_0x494561(_0x3d1f0f[_0x3bd6('0x14')][_0x3bd6('0x13')]);}})['catch'](function(_0x196b48){logger[_0x3bd6('0x11')](_0x3bd6('0xc'),_0x161fa3,_0x196b48);_0x21ddc9(_0x196b48);});});} \ No newline at end of file +var _0x985e=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x985e,0x102));var _0xe985=function(_0x441a2e,_0xf09670){_0x441a2e=_0x441a2e-0x0;var _0x422f81=_0x985e[_0x441a2e];return _0x422f81;};'use strict';var _=require('lodash');var util=require(_0xe985('0x0'));var moment=require(_0xe985('0x1'));var BPromise=require(_0xe985('0x2'));var rs=require(_0xe985('0x3'));var fs=require('fs');var Redis=require(_0xe985('0x4'));var db=require(_0xe985('0x5'))['db'];var utils=require(_0xe985('0x6'));var logger=require(_0xe985('0x7'))(_0xe985('0x8'));var config=require(_0xe985('0x9'));var jayson=require(_0xe985('0xa'));var client=jayson[_0xe985('0xb')][_0xe985('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc10a31,_0x21921b,_0x1d5b0b){return new BPromise(function(_0x4409a8,_0x52eeec){return client[_0xe985('0xd')](_0xc10a31,_0x1d5b0b)[_0xe985('0xe')](function(_0x73beae){logger[_0xe985('0xf')](_0xe985('0x10'),_0x21921b,_0xe985('0x11'));logger[_0xe985('0x12')](_0xe985('0x13'),_0x21921b,_0xe985('0x11'),JSON[_0xe985('0x14')](_0x73beae));if(_0x73beae[_0xe985('0x15')]){if(_0x73beae['error']['code']===0x1f4){logger['error'](_0xe985('0x10'),_0x21921b,_0x73beae[_0xe985('0x15')][_0xe985('0x16')]);return _0x52eeec(_0x73beae['error']['message']);}logger['error'](_0xe985('0x10'),_0x21921b,_0x73beae['error'][_0xe985('0x16')]);return _0x4409a8(_0x73beae['error']['message']);}else{logger[_0xe985('0xf')](_0xe985('0x10'),_0x21921b,_0xe985('0x11'));_0x4409a8(_0x73beae[_0xe985('0x17')][_0xe985('0x16')]);}})[_0xe985('0x18')](function(_0x2d2196){logger[_0xe985('0x15')](_0xe985('0x10'),_0x21921b,_0x2d2196);_0x52eeec(_0x2d2196);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 6592c92..b6bfad9 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 _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x37b824,_0xa6225c){var _0x2d2074=function(_0x105db7){while(--_0x105db7){_0x37b824['push'](_0x37b824['shift']());}};_0x2d2074(++_0xa6225c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index c179cdd..45f4515 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 _0x6f72=['input','name','text','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify'];(function(_0x30d74b,_0x4e619f){var _0x5c13e5=function(_0x449d8){while(--_0x449d8){_0x30d74b['push'](_0x30d74b['shift']());}};_0x5c13e5(++_0x4e619f);}(_0x6f72,0xae));var _0x26f7=function(_0x8a79ef,_0x52272c){_0x8a79ef=_0x8a79ef-0x0;var _0x21ca2a=_0x6f72[_0x8a79ef];return _0x21ca2a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x26f7('0x0'));module[_0x26f7('0x1')]={'name':{'type':Sequelize[_0x26f7('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x26f7('0x3')},'description':{'type':Sequelize[_0x26f7('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x26f7('0x4')},'mapKeyOffline':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x26f7('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x26f7('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x26f7('0x2')],'allowNull':![],'defaultValue':_0x26f7('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x26f7('0x2')],'allowNull':![],'defaultValue':_0x26f7('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x26f7('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x26f7('0x2')]},'animation':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x26f7('0xa')](_0x26f7('0xb'),_0x26f7('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0xd')},'offline_chat_button':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0xe')},'header_offline':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0xf')},'download_transcript':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x26f7('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x26f7('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x26f7('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x14')},'closingMessage':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x16')},'ratingType':{'type':Sequelize[_0x26f7('0xa')](_0x26f7('0x17'),_0x26f7('0x18')),'defaultValue':_0x26f7('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x26f7('0x11')],'defaultValue':function(){return JSON[_0x26f7('0x19')]({'items':[{'type':_0x26f7('0x1a'),'variable':null,'config':{'placeholder':_0x26f7('0x1b'),'type':_0x26f7('0x1c'),'required':!![]},'props':{'title':_0x26f7('0x1b'),'helpText':''}},{'type':_0x26f7('0x1a'),'props':{'title':_0x26f7('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x26f7('0x4'),'type':_0x26f7('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x26f7('0x1d')]('onlineForm')?JSON[_0x26f7('0x1e')](this['getDataValue']('onlineForm')):{};},'set':function(_0x46fedb){return this[_0x26f7('0x1f')](_0x26f7('0x20'),JSON[_0x26f7('0x19')](_0x46fedb));}},'offlineForm':{'type':Sequelize[_0x26f7('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x26f7('0x1a'),'props':{'title':_0x26f7('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x26f7('0x4'),'type':_0x26f7('0x4')},'variable':null},{'type':_0x26f7('0x21'),'config':{'placeholder':_0x26f7('0x22')},'props':{'title':'Comments','helpText':_0x26f7('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x26f7('0x1e')](this['getDataValue']('offlineForm')):{};},'set':function(_0x4c7282){return this[_0x26f7('0x1f')](_0x26f7('0x24'),JSON[_0x26f7('0x19')](_0x4c7282));}},'token':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':function(){return rs[_0x26f7('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x26f7('0x2')]},'waitingTitle':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x26')},'waitingMessage':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x28')},'skipUnmanaged':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x29')},'sendUnmanaged':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x26f7('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x26f7('0x11')],'defaultValue':function(){return _0x26f7('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x2c')},'verticalAlignment':{'type':Sequelize[_0x26f7('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x26f7('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x26f7('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x26f7('0x2')],'allowNull':![],'defaultValue':_0x26f7('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x26f7('0x2')],'defaultValue':_0x26f7('0x2e')},'systemAvatar':{'type':Sequelize[_0x26f7('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26f7('0x8')],'comment':_0x26f7('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![],'comment':_0x26f7('0x30'),'set':function(_0x3d5972){if(!_0x3d5972)this['setDataValue'](_0x26f7('0x31'),null);this[_0x26f7('0x1f')]('mandatoryDisposition',_0x3d5972);}},'vidaooEscalation':{'type':Sequelize[_0x26f7('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x9865=['Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','onlineForm','getDataValue','setDataValue','textarea','Comments','offlineForm','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x448747,_0x52303a){var _0x34b9f4=function(_0x398dcb){while(--_0x398dcb){_0x448747['push'](_0x448747['shift']());}};_0x34b9f4(++_0x52303a);}(_0x9865,0x1ba));var _0x5986=function(_0x2399ee,_0x1fd6eb){_0x2399ee=_0x2399ee-0x0;var _0x517039=_0x9865[_0x2399ee];return _0x517039;};'use strict';var Sequelize=require(_0x5986('0x0'));var rs=require(_0x5986('0x1'));module[_0x5986('0x2')]={'name':{'type':Sequelize[_0x5986('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x5986('0x3')],'allowNull':![],'unique':_0x5986('0x4')},'description':{'type':Sequelize[_0x5986('0x3')]},'mapKey':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x5')},'mapKeyOffline':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x5986('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x6')},'customerAlias':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5986('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5986('0x3')],'allowNull':![],'defaultValue':_0x5986('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5986('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5986('0x3')]},'animation':{'type':Sequelize[_0x5986('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x5986('0xa'),_0x5986('0xb')),'defaultValue':_0x5986('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0xc')},'offline_chat_button':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0xd')},'header_offline':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5986('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x5986('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x5986('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5986('0xf')]},'closingQuestion':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x11')},'placeholderMessage':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x12')},'closingMessage':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x13')},'closingMessageButton':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0xd')},'skipMessageButton':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5986('0x15')},'ratingType':{'type':Sequelize[_0x5986('0x16')](_0x5986('0x17'),_0x5986('0x18')),'defaultValue':_0x5986('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x5986('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5986('0xf')],'defaultValue':function(){return JSON[_0x5986('0x19')]({'items':[{'type':_0x5986('0x1a'),'variable':null,'config':{'placeholder':_0x5986('0x1b'),'type':_0x5986('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5986('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5986('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5986('0x1d'))?JSON['parse'](this[_0x5986('0x1e')](_0x5986('0x1d'))):{};},'set':function(_0x52864a){return this[_0x5986('0x1f')](_0x5986('0x1d'),JSON[_0x5986('0x19')](_0x52864a));}},'offlineForm':{'type':Sequelize[_0x5986('0xf')],'defaultValue':function(){return JSON[_0x5986('0x19')]({'items':[{'type':_0x5986('0x1a'),'props':{'title':_0x5986('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5986('0x5')},'variable':null},{'type':_0x5986('0x20'),'config':{'placeholder':_0x5986('0x21')},'props':{'title':_0x5986('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5986('0x1e')]('offlineForm')?JSON['parse'](this[_0x5986('0x1e')](_0x5986('0x22'))):{};},'set':function(_0x5a5ae5){return this[_0x5986('0x1f')]('offlineForm',JSON[_0x5986('0x19')](_0x5a5ae5));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x5986('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5986('0x3')]},'forwardOffline':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5986('0x3')]},'waitingTitle':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x5986('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x5986('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x14')},'sendUnmanaged':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5986('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5986('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5986('0x24');}},'notificationSound':{'type':Sequelize[_0x5986('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5986('0x3')],'defaultValue':_0x5986('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5986('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5986('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x5986('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5986('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5986('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5986('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5986('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x5986('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5986('0x8')],'comment':_0x5986('0x27')},'mandatoryDisposition':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![],'comment':_0x5986('0x28'),'set':function(_0x51c64e){if(!_0x51c64e)this[_0x5986('0x1f')]('mandatoryDispositionPauseId',null);this[_0x5986('0x1f')](_0x5986('0x29'),_0x51c64e);}},'vidaooEscalation':{'type':Sequelize[_0x5986('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5986('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 65a40a4..ab0d006 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 _0x5ad2=['socket.io-emitter','./chatWebsite.socket','register','http','client','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','get','UserProfileResource','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','ChatWebsiteId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','getLicense','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','account','applications','orderBy','priority','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','format','browser','version','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','*,*,*,*','startRouting','Start','EventManager','offline','difference','CompanyId','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','sendMail','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x1e0de7,_0x28b328){var _0x212ce6=function(_0x78cc58){while(--_0x78cc58){_0x1e0de7['push'](_0x1e0de7['shift']());}};_0x212ce6(++_0x28b328);}(_0x5ad2,0xfd));var _0x25ad=function(_0x53d520,_0x35c166){_0x53d520=_0x53d520-0x0;var _0x488a7e=_0x5ad2[_0x53d520];return _0x488a7e;};'use strict';var pdf=require(_0x25ad('0x0'));var emlformat=require(_0x25ad('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x25ad('0x2'));var jsonpatch=require(_0x25ad('0x3'));var rp=require(_0x25ad('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x25ad('0x5'));var path=require('path');var sox=require(_0x25ad('0x6'));var csv=require(_0x25ad('0x7'));var ejs=require(_0x25ad('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25ad('0x9'));var crypto=require('crypto');var jsforce=require(_0x25ad('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x25ad('0x7'));var querystring=require('querystring');var Papa=require(_0x25ad('0xb'));var Redis=require(_0x25ad('0xc'));var authService=require(_0x25ad('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x25ad('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25ad('0xf'))(_0x25ad('0x10'));var utils=require(_0x25ad('0x11'));var config=require(_0x25ad('0x12'));var licenseUtil=require(_0x25ad('0x13'));var db=require(_0x25ad('0x14'))['db'];config[_0x25ad('0x15')]=_[_0x25ad('0x16')](config[_0x25ad('0x15')],{'host':_0x25ad('0x17'),'port':0x18eb});var socket=require(_0x25ad('0x18'))(new Redis(config[_0x25ad('0x15')]));require(_0x25ad('0x19'))[_0x25ad('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x25ad('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x25ad('0x1b')]({'port':0x232a});var client9003=jayson[_0x25ad('0x1c')][_0x25ad('0x1b')]({'port':0x232b});function respondWithRpcPromise(_0x4a0184,_0x5483e2,_0x1051e6,_0xafc526){return new BPromise(function(_0x1705d1,_0x2931b0){var _0x3618e6=_0xafc526||client;return _0x3618e6['request'](_0x4a0184,_0x1051e6)[_0x25ad('0x1d')](function(_0x4870b1){logger['info'](_0x25ad('0x1e'),_0x5483e2,_0x25ad('0x1f'));logger['debug'](_0x25ad('0x20'),_0x5483e2,'request\x20sent',JSON[_0x25ad('0x21')](_0x4870b1));if(_0x4870b1[_0x25ad('0x22')]){if(_0x4870b1[_0x25ad('0x22')]['code']===0x1f4){logger[_0x25ad('0x22')](_0x25ad('0x1e'),_0x5483e2,_0x4870b1[_0x25ad('0x22')][_0x25ad('0x23')]);return _0x2931b0(_0x4870b1['error'][_0x25ad('0x23')]);}logger['error'](_0x25ad('0x1e'),_0x5483e2,_0x4870b1['error'][_0x25ad('0x23')]);return _0x1705d1(_0x4870b1['error'][_0x25ad('0x23')]);}else{logger[_0x25ad('0x24')](_0x25ad('0x1e'),_0x5483e2,_0x25ad('0x1f'));_0x1705d1(_0x4870b1[_0x25ad('0x25')][_0x25ad('0x23')]);}})[_0x25ad('0x26')](function(_0x35b068){logger[_0x25ad('0x22')](_0x25ad('0x1e'),_0x5483e2,_0x35b068);_0x2931b0(_0x35b068);});});}function respondWithStatusCode(_0x323b34,_0x1ba6f2){_0x1ba6f2=_0x1ba6f2||0xcc;return function(_0x1eca1b){if(_0x1eca1b){return _0x323b34['sendStatus'](_0x1ba6f2);}return _0x323b34[_0x25ad('0x27')](_0x1ba6f2)['end']();};}function respondWithResult(_0x1f00a0,_0x3fd4b5){_0x3fd4b5=_0x3fd4b5||0xc8;return function(_0x3145bf){if(_0x3145bf){return _0x1f00a0[_0x25ad('0x27')](_0x3fd4b5)['json'](_0x3145bf);}};}function respondWithFilteredResult(_0x14ac51,_0x9a02f7){return function(_0x1445da){if(_0x1445da){var _0xb7f770=_0x1445da[_0x25ad('0x28')],_0x415955=_0x9a02f7['offset'],_0x2b807c=_0x9a02f7[_0x25ad('0x29')]+_0x9a02f7[_0x25ad('0x2a')],_0x427c8e;if(_0x2b807c>=_0xb7f770){_0x2b807c=_0xb7f770;_0x427c8e=0xc8;}else{_0x427c8e=0xce;}_0x14ac51[_0x25ad('0x27')](_0x427c8e);return _0x14ac51[_0x25ad('0x2b')](_0x25ad('0x2c'),_0x415955+'-'+_0x2b807c+'/'+_0xb7f770)[_0x25ad('0x2d')](_0x1445da);}return null;};}function patchUpdates(_0x17fd09){return function(_0x542719){try{jsonpatch[_0x25ad('0x2e')](_0x542719,_0x17fd09,!![]);}catch(_0x86e04){return BPromise['reject'](_0x86e04);}return _0x542719[_0x25ad('0x2f')]();};}function saveUpdates(_0x529f54,_0xfc322){return function(_0x14e7a9){if(_0x14e7a9){return _0x14e7a9[_0x25ad('0x30')](_0x529f54)[_0x25ad('0x1d')](function(_0x306bb0){return _0x306bb0;});}return null;};}function removeEntity(_0x2b3ac5,_0x5c75e3){return function(_0xf9aff6){if(_0xf9aff6){return _0xf9aff6[_0x25ad('0x31')]()[_0x25ad('0x1d')](function(){var _0x40f513=_0xf9aff6[_0x25ad('0x32')]({'plain':!![]});var _0x460f9f='ChatWebsites';return db[_0x25ad('0x33')][_0x25ad('0x31')]({'where':{'type':_0x460f9f,'resourceId':_0x40f513['id']}})[_0x25ad('0x1d')](function(){return _0xf9aff6;});})[_0x25ad('0x1d')](function(){_0x2b3ac5[_0x25ad('0x27')](0xcc)[_0x25ad('0x34')]();});}};}function handleEntityNotFound(_0x1d1a83,_0x5736cf){return function(_0x20b5df){if(!_0x20b5df){_0x1d1a83[_0x25ad('0x35')](0x194);}return _0x20b5df;};}function handleError(_0xb362a0,_0x181f1d){_0x181f1d=_0x181f1d||0x1f4;return function(_0x1b863e){logger[_0x25ad('0x22')](_0x1b863e[_0x25ad('0x36')]);if(_0x1b863e[_0x25ad('0x37')]){delete _0x1b863e[_0x25ad('0x37')];}_0xb362a0['status'](_0x181f1d)['send'](_0x1b863e);};}exports['index']=function(_0x3d98e2,_0x191424){var _0x26aaca={'include':[{'model':db[_0x25ad('0x38')],'as':_0x25ad('0x39')}]},_0x341b10={},_0x515013={'count':0x0,'rows':[]};var _0x384722=_[_0x25ad('0x3a')](db['ChatWebsite'][_0x25ad('0x3b')],function(_0x44e189){return{'name':_0x44e189[_0x25ad('0x3c')],'type':_0x44e189[_0x25ad('0x3d')][_0x25ad('0x3e')]};});_0x341b10['model']=_['map'](_0x384722,'name');_0x341b10[_0x25ad('0x3f')]=_[_0x25ad('0x40')](_0x3d98e2[_0x25ad('0x3f')]);_0x341b10[_0x25ad('0x41')]=_[_0x25ad('0x42')](_0x341b10[_0x25ad('0x43')],_0x341b10[_0x25ad('0x3f')]);_0x26aaca[_0x25ad('0x44')]=_[_0x25ad('0x42')](_0x341b10[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x45')]));_0x26aaca[_0x25ad('0x44')]=_0x26aaca[_0x25ad('0x44')][_0x25ad('0x46')]?_0x26aaca['attributes']:_0x341b10[_0x25ad('0x43')];if(!_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x47')](_0x25ad('0x48'))){_0x26aaca[_0x25ad('0x2a')]=qs['limit'](_0x3d98e2['query'][_0x25ad('0x2a')]);_0x26aaca[_0x25ad('0x29')]=qs['offset'](_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x29')]);}_0x26aaca[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x4a')]);_0x26aaca['where']=qs[_0x25ad('0x41')](_['pick'](_0x3d98e2[_0x25ad('0x3f')],_0x341b10['filters']),_0x384722);if(_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x4b')]){_0x26aaca[_0x25ad('0x4c')]=_[_0x25ad('0x4d')](_0x26aaca['where'],{'$or':_[_0x25ad('0x3a')](_0x384722,function(_0x4da155){if(_0x4da155[_0x25ad('0x3d')]!==_0x25ad('0x4e')){var _0x4fa491={};_0x4fa491[_0x4da155[_0x25ad('0x37')]]={'$like':'%'+_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x4b')]+'%'};return _0x4fa491;}})});}_0x26aaca=_[_0x25ad('0x4d')]({},_0x26aaca,_0x3d98e2[_0x25ad('0x4f')]);var _0x505ee4={'where':_0x26aaca['where']};return db[_0x25ad('0x50')][_0x25ad('0x28')](_0x505ee4)['then'](function(_0x2c2911){_0x515013[_0x25ad('0x28')]=_0x2c2911;if(_0x3d98e2[_0x25ad('0x3f')][_0x25ad('0x51')]){_0x26aaca[_0x25ad('0x52')]=[{'all':!![]}];}return db[_0x25ad('0x50')][_0x25ad('0x53')](_0x26aaca);})[_0x25ad('0x1d')](function(_0x15fba){_0x515013[_0x25ad('0x54')]=_0x15fba;return _0x515013;})[_0x25ad('0x1d')](respondWithFilteredResult(_0x191424,_0x26aaca))['catch'](handleError(_0x191424,null));};exports['show']=function(_0x3cc377,_0x346e98){var _0x81e0ba={'raw':![],'where':{'id':_0x3cc377[_0x25ad('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x25ad('0x39')}]},_0x6e530={};_0x6e530[_0x25ad('0x43')]=_[_0x25ad('0x40')](db[_0x25ad('0x50')][_0x25ad('0x3b')]);_0x6e530[_0x25ad('0x3f')]=_[_0x25ad('0x40')](_0x3cc377[_0x25ad('0x3f')]);_0x6e530[_0x25ad('0x41')]=_[_0x25ad('0x42')](_0x6e530[_0x25ad('0x43')],_0x6e530[_0x25ad('0x3f')]);_0x81e0ba[_0x25ad('0x44')]=_[_0x25ad('0x42')](_0x6e530[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x3cc377[_0x25ad('0x3f')][_0x25ad('0x45')]));_0x81e0ba[_0x25ad('0x44')]=_0x81e0ba[_0x25ad('0x44')][_0x25ad('0x46')]?_0x81e0ba[_0x25ad('0x44')]:_0x6e530[_0x25ad('0x43')];if(_0x3cc377['query']['includeAll']){_0x81e0ba[_0x25ad('0x52')]=[{'all':!![]}];}_0x81e0ba=_[_0x25ad('0x4d')]({},_0x81e0ba,_0x3cc377['options']);return db[_0x25ad('0x50')]['find'](_0x81e0ba)[_0x25ad('0x1d')](handleEntityNotFound(_0x346e98,null))['then'](respondWithResult(_0x346e98,null))[_0x25ad('0x26')](handleError(_0x346e98,null));};exports[_0x25ad('0x56')]=function(_0x2bc0f0,_0x2ba06e){return db[_0x25ad('0x50')][_0x25ad('0x56')](_0x2bc0f0[_0x25ad('0x57')],{})[_0x25ad('0x1d')](function(_0x161b3a){var _0x4d01d5=_0x2bc0f0[_0x25ad('0x58')][_0x25ad('0x32')]({'plain':!![]});if(!_0x4d01d5)throw new Error(_0x25ad('0x59'));if(_0x4d01d5[_0x25ad('0x5a')]===_0x25ad('0x58')){var _0x2447ea=_0x161b3a[_0x25ad('0x32')]({'plain':!![]});var _0x12b310='ChatWebsites';return db['UserProfileSection'][_0x25ad('0x5b')]({'where':{'name':_0x12b310,'userProfileId':_0x4d01d5[_0x25ad('0x5c')]},'raw':!![]})[_0x25ad('0x1d')](function(_0x408868){if(_0x408868&&_0x408868['autoAssociation']===0x0){return db[_0x25ad('0x33')]['create']({'name':_0x2447ea['name'],'resourceId':_0x2447ea['id'],'type':_0x408868[_0x25ad('0x37')],'sectionId':_0x408868['id']},{})[_0x25ad('0x1d')](function(){return _0x161b3a;});}else{return _0x161b3a;}})['catch'](function(_0x13d59f){logger[_0x25ad('0x22')](_0x25ad('0x5d'),_0x13d59f);throw _0x13d59f;});}return _0x161b3a;})['then'](respondWithResult(_0x2ba06e,0xc9))['catch'](handleError(_0x2ba06e,null));};exports['update']=function(_0x36d7c5,_0x76b9eb){if(_0x36d7c5[_0x25ad('0x57')]['id']){delete _0x36d7c5[_0x25ad('0x57')]['id'];}return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x36d7c5[_0x25ad('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x25ad('0x39')}]})[_0x25ad('0x1d')](handleEntityNotFound(_0x76b9eb,null))[_0x25ad('0x1d')](saveUpdates(_0x36d7c5[_0x25ad('0x57')],null))['then'](respondWithResult(_0x76b9eb,null))[_0x25ad('0x26')](handleError(_0x76b9eb,null));};exports[_0x25ad('0x31')]=function(_0x3e6d89,_0x1c165d){return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x3e6d89[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x1c165d,null))[_0x25ad('0x1d')](removeEntity(_0x1c165d,null))[_0x25ad('0x26')](handleError(_0x1c165d,null));};exports[_0x25ad('0x5e')]=function(_0x2c621d,_0x376d40){return db[_0x25ad('0x50')][_0x25ad('0x5e')]()[_0x25ad('0x1d')](respondWithResult(_0x376d40,null))[_0x25ad('0x26')](handleError(_0x376d40,null));};exports[_0x25ad('0x5f')]=function(_0x58a583,_0x3d8017,_0x138ebf){if(_0x58a583['body']['id']){delete _0x58a583[_0x25ad('0x57')]['id'];}return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x58a583['params']['id']}})['then'](handleEntityNotFound(_0x3d8017,null))[_0x25ad('0x1d')](function(_0x38ceb4){if(_0x38ceb4){_0x58a583[_0x25ad('0x57')]['ChatWebsiteId']=_0x38ceb4['id'];return db[_0x25ad('0x60')][_0x25ad('0x56')](_0x58a583['body']);}})['then'](respondWithResult(_0x3d8017,null))['catch'](handleError(_0x3d8017,null));};exports[_0x25ad('0x61')]=function(_0x13cb50,_0x52b9d4,_0x29373b){var _0x47b6ac={'raw':![],'where':{}};var _0x103967={};var _0x24e727={'count':0x0,'rows':[]};return db[_0x25ad('0x50')][_0x25ad('0x62')]({'where':{'id':_0x13cb50[_0x25ad('0x55')]['id']}})['then'](handleEntityNotFound(_0x52b9d4,null))[_0x25ad('0x1d')](function(_0x487174){if(_0x487174){_0x103967['model']=_[_0x25ad('0x40')](db[_0x25ad('0x60')]['rawAttributes']);_0x103967[_0x25ad('0x3f')]=_['keys'](_0x13cb50[_0x25ad('0x3f')]);_0x103967[_0x25ad('0x41')]=_[_0x25ad('0x42')](_0x103967[_0x25ad('0x43')],_0x103967[_0x25ad('0x3f')]);_0x47b6ac[_0x25ad('0x44')]=_[_0x25ad('0x42')](_0x103967[_0x25ad('0x43')],qs['fields'](_0x13cb50['query'][_0x25ad('0x45')]));_0x47b6ac[_0x25ad('0x44')]=_0x47b6ac[_0x25ad('0x44')][_0x25ad('0x46')]?_0x47b6ac[_0x25ad('0x44')]:_0x103967[_0x25ad('0x43')];if(!_0x13cb50[_0x25ad('0x3f')][_0x25ad('0x47')]('nolimit')){_0x47b6ac[_0x25ad('0x2a')]=qs[_0x25ad('0x2a')](_0x13cb50[_0x25ad('0x3f')][_0x25ad('0x2a')]);_0x47b6ac['offset']=qs['offset'](_0x13cb50['query'][_0x25ad('0x29')]);}_0x47b6ac[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x13cb50[_0x25ad('0x3f')][_0x25ad('0x4a')]);_0x47b6ac[_0x25ad('0x4c')]=qs[_0x25ad('0x41')](_[_0x25ad('0x63')](_0x13cb50[_0x25ad('0x3f')],_0x103967[_0x25ad('0x41')]));_0x47b6ac[_0x25ad('0x4c')][_0x25ad('0x64')]=_0x487174['id'];if(_0x13cb50[_0x25ad('0x3f')][_0x25ad('0x4b')]){_0x47b6ac[_0x25ad('0x4c')]=_[_0x25ad('0x4d')](_0x47b6ac[_0x25ad('0x4c')],{'$or':_[_0x25ad('0x3a')](_0x47b6ac['attributes'],function(_0x3b1243){var _0x7b7743={};_0x7b7743[_0x3b1243]={'$like':'%'+_0x13cb50[_0x25ad('0x3f')]['filter']+'%'};return _0x7b7743;})});}_0x47b6ac=_['merge']({},_0x47b6ac,_0x13cb50[_0x25ad('0x4f')]);return db['Disposition'][_0x25ad('0x28')]({'where':_0x47b6ac[_0x25ad('0x4c')]})[_0x25ad('0x1d')](function(_0x420d52){_0x24e727[_0x25ad('0x28')]=_0x420d52;if(_0x13cb50[_0x25ad('0x3f')][_0x25ad('0x51')]){_0x47b6ac[_0x25ad('0x52')]=[{'all':!![]}];}return db[_0x25ad('0x60')][_0x25ad('0x53')](_0x47b6ac);})[_0x25ad('0x1d')](function(_0x568701){_0x24e727[_0x25ad('0x54')]=_0x568701;return _0x24e727;});}})[_0x25ad('0x1d')](respondWithFilteredResult(_0x52b9d4,_0x47b6ac))['catch'](handleError(_0x52b9d4,null));};exports[_0x25ad('0x65')]=function(_0x442e10,_0xbe6df8,_0x57a51b){return db['ChatWebsite'][_0x25ad('0x5b')]({'where':{'id':_0x442e10[_0x25ad('0x55')]['id']}})['then'](handleEntityNotFound(_0xbe6df8,null))[_0x25ad('0x1d')](function(_0x270e92){if(_0x270e92){return _0x270e92[_0x25ad('0x65')](_0x442e10[_0x25ad('0x3f')][_0x25ad('0x66')]);}})[_0x25ad('0x1d')](respondWithStatusCode(_0xbe6df8,null))[_0x25ad('0x26')](handleError(_0xbe6df8,null));};exports['addAnswer']=function(_0x493dcb,_0x1b065c,_0xcae2ea){if(_0x493dcb[_0x25ad('0x57')]['id']){delete _0x493dcb['body']['id'];}return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x493dcb['params']['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x1b065c,null))[_0x25ad('0x1d')](function(_0x3044a9){if(_0x3044a9){_0x493dcb[_0x25ad('0x57')][_0x25ad('0x64')]=_0x3044a9['id'];return db[_0x25ad('0x67')][_0x25ad('0x56')](_0x493dcb[_0x25ad('0x57')]);}})['then'](respondWithResult(_0x1b065c,null))[_0x25ad('0x26')](handleError(_0x1b065c,null));};exports[_0x25ad('0x68')]=function(_0x409c59,_0x5b3db5,_0x7b2c0c){var _0x2ad663={'raw':![],'where':{}};var _0x572d9f={};var _0x29f093={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x25ad('0x62')]({'where':{'id':_0x409c59['params']['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x5b3db5,null))[_0x25ad('0x1d')](function(_0x26c0ed){if(_0x26c0ed){_0x572d9f[_0x25ad('0x43')]=_[_0x25ad('0x40')](db[_0x25ad('0x67')][_0x25ad('0x3b')]);_0x572d9f['query']=_[_0x25ad('0x40')](_0x409c59[_0x25ad('0x3f')]);_0x572d9f['filters']=_[_0x25ad('0x42')](_0x572d9f['model'],_0x572d9f['query']);_0x2ad663['attributes']=_[_0x25ad('0x42')](_0x572d9f[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x409c59[_0x25ad('0x3f')][_0x25ad('0x45')]));_0x2ad663[_0x25ad('0x44')]=_0x2ad663[_0x25ad('0x44')]['length']?_0x2ad663['attributes']:_0x572d9f[_0x25ad('0x43')];if(!_0x409c59[_0x25ad('0x3f')][_0x25ad('0x47')](_0x25ad('0x48'))){_0x2ad663[_0x25ad('0x2a')]=qs[_0x25ad('0x2a')](_0x409c59[_0x25ad('0x3f')]['limit']);_0x2ad663[_0x25ad('0x29')]=qs['offset'](_0x409c59['query'][_0x25ad('0x29')]);}_0x2ad663[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x409c59['query'][_0x25ad('0x4a')]);_0x2ad663[_0x25ad('0x4c')]=qs['filters'](_[_0x25ad('0x63')](_0x409c59['query'],_0x572d9f['filters']));_0x2ad663[_0x25ad('0x4c')]['ChatWebsiteId']=_0x26c0ed['id'];if(_0x409c59[_0x25ad('0x3f')][_0x25ad('0x4b')]){_0x2ad663[_0x25ad('0x4c')]=_[_0x25ad('0x4d')](_0x2ad663[_0x25ad('0x4c')],{'$or':_[_0x25ad('0x3a')](_0x2ad663[_0x25ad('0x44')],function(_0x1ed627){var _0x6d8d78={};_0x6d8d78[_0x1ed627]={'$like':'%'+_0x409c59[_0x25ad('0x3f')][_0x25ad('0x4b')]+'%'};return _0x6d8d78;})});}_0x2ad663=_[_0x25ad('0x4d')]({},_0x2ad663,_0x409c59[_0x25ad('0x4f')]);return db[_0x25ad('0x67')][_0x25ad('0x28')]({'where':_0x2ad663[_0x25ad('0x4c')]})['then'](function(_0x2ba461){_0x29f093[_0x25ad('0x28')]=_0x2ba461;if(_0x409c59[_0x25ad('0x3f')][_0x25ad('0x51')]){_0x2ad663[_0x25ad('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x25ad('0x53')](_0x2ad663);})['then'](function(_0x28ea39){_0x29f093[_0x25ad('0x54')]=_0x28ea39;return _0x29f093;});}})['then'](respondWithFilteredResult(_0x5b3db5,_0x2ad663))[_0x25ad('0x26')](handleError(_0x5b3db5,null));};exports[_0x25ad('0x69')]=function(_0x53bcf2,_0x28e43d,_0x264497){return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x53bcf2['params']['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x28e43d,null))[_0x25ad('0x1d')](function(_0xfe1d11){if(_0xfe1d11){return _0xfe1d11[_0x25ad('0x69')](_0x53bcf2[_0x25ad('0x3f')][_0x25ad('0x66')]);}})[_0x25ad('0x1d')](respondWithStatusCode(_0x28e43d,null))['catch'](handleError(_0x28e43d,null));};exports[_0x25ad('0x6a')]=function(_0x3d32e1,_0x1eec4b,_0x1137e8){_0x3d32e1[_0x25ad('0x57')][_0x25ad('0x6b')]=_0x3d32e1[_0x25ad('0x6c')][_0x25ad('0x6d')];return db[_0x25ad('0x50')]['find']({'where':{'id':_0x3d32e1[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x1eec4b,null))[_0x25ad('0x1d')](saveUpdates(_0x3d32e1[_0x25ad('0x57')],null))['then'](respondWithResult(_0x1eec4b,null))['catch'](handleError(_0x1eec4b,null));};exports[_0x25ad('0x6e')]=function(_0x37879f,_0x28836f,_0x2afa98){_0x37879f[_0x25ad('0x57')][_0x25ad('0x6f')]=_0x37879f[_0x25ad('0x6c')]['filename'];return db['ChatWebsite'][_0x25ad('0x5b')]({'where':{'id':_0x37879f['params']['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x28836f,null))[_0x25ad('0x1d')](saveUpdates(_0x37879f[_0x25ad('0x57')],null))[_0x25ad('0x1d')](respondWithResult(_0x28836f,null))[_0x25ad('0x26')](handleError(_0x28836f,null));};exports[_0x25ad('0x70')]=function(_0x115d7b,_0x5a5633,_0x59afd3){_0x115d7b['body'][_0x25ad('0x71')]=_0x115d7b[_0x25ad('0x6c')]['filename'];return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x115d7b[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x5a5633,null))[_0x25ad('0x1d')](saveUpdates(_0x115d7b[_0x25ad('0x57')],null))[_0x25ad('0x1d')](respondWithResult(_0x5a5633,null))[_0x25ad('0x26')](handleError(_0x5a5633,null));};exports[_0x25ad('0x72')]=function(_0x24ad06,_0x3f88d2,_0x2bc4c3){_0x24ad06[_0x25ad('0x57')][_0x25ad('0x73')]=_0x24ad06[_0x25ad('0x6c')][_0x25ad('0x6d')];return db[_0x25ad('0x50')]['find']({'where':{'id':_0x24ad06['params']['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x3f88d2,null))[_0x25ad('0x1d')](saveUpdates(_0x24ad06[_0x25ad('0x57')],null))['then'](respondWithResult(_0x3f88d2,null))[_0x25ad('0x26')](handleError(_0x3f88d2,null));};exports['getLogo']=function(_0x57288a,_0x1efddc,_0x3d814d){var _0x1d31d3=path[_0x25ad('0x74')](config[_0x25ad('0x75')],'server/files/images/logos/default_logo.svg');var _0x107d5c={'where':{'id':_0x57288a[_0x25ad('0x55')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3bbcd2=![];return require(_0x25ad('0x13'))[_0x25ad('0x76')]()['then'](function(_0x146ced){if(_0x146ced){_0x3bbcd2=_0x146ced[_0x25ad('0x77')];}})[_0x25ad('0x1d')](function(){return db['ChatWebsite']['find'](_0x107d5c);})[_0x25ad('0x1d')](handleEntityNotFound(_0x1efddc,null))[_0x25ad('0x1d')](function(_0x11edab){if(_0x11edab){if(!_['isNil'](_0x11edab['sitepic'])){if(fs[_0x25ad('0x78')](path[_0x25ad('0x74')](config[_0x25ad('0x75')],'server/files/images/logos/',_0x11edab[_0x25ad('0x6b')]))&&_0x3bbcd2){_0x1d31d3=path['join'](config[_0x25ad('0x75')],_0x25ad('0x79'),_0x11edab['sitepic']);}}return _0x1efddc['download'](_0x1d31d3);}})['catch'](handleError(_0x1efddc,null));};exports[_0x25ad('0x7a')]=function(_0x1472dd,_0x4ca5be,_0x2c9e10){var _0xb43db9=path[_0x25ad('0x74')](config[_0x25ad('0x75')],'server/files/images/avatars/default_avatar.png');var _0x580d80={'where':{'id':_0x1472dd['params']['id']},'attributes':['id',_0x25ad('0x6f')],'raw':!![]};return db[_0x25ad('0x50')][_0x25ad('0x5b')](_0x580d80)[_0x25ad('0x1d')](handleEntityNotFound(_0x4ca5be,null))[_0x25ad('0x1d')](function(_0x255765){if(_0x255765){if(!_['isNil'](_0x255765[_0x25ad('0x6f')])){if(fs[_0x25ad('0x78')](path[_0x25ad('0x74')](config['root'],_0x25ad('0x7b'),_0x255765['agentAvatar']))){_0xb43db9=path[_0x25ad('0x74')](config[_0x25ad('0x75')],_0x25ad('0x7b'),_0x255765[_0x25ad('0x6f')]);}}return _0x4ca5be[_0x25ad('0x7c')](_0xb43db9);}})[_0x25ad('0x26')](handleError(_0x4ca5be,null));};exports[_0x25ad('0x7d')]=function(_0x25b1d,_0x1b8132,_0x400a21){var _0x32e500=path[_0x25ad('0x74')](config[_0x25ad('0x75')],_0x25ad('0x7e'));var _0x5e63a9={'where':{'id':_0x25b1d['params']['id']},'attributes':['id','customerAvatar',_0x25ad('0x7f')],'raw':!![]};return db[_0x25ad('0x50')]['find'](_0x5e63a9)[_0x25ad('0x1d')](handleEntityNotFound(_0x1b8132,null))['then'](function(_0x32abcb){if(_0x32abcb){if(!_[_0x25ad('0x80')](_0x32abcb[_0x25ad('0x71')])){if(fs[_0x25ad('0x78')](path[_0x25ad('0x74')](config['root'],_0x25ad('0x7b'),_0x32abcb[_0x25ad('0x71')]))&&_0x32abcb[_0x25ad('0x7f')]){_0x32e500=path[_0x25ad('0x74')](config[_0x25ad('0x75')],_0x25ad('0x7b'),_0x32abcb[_0x25ad('0x71')]);}}return _0x1b8132['download'](_0x32e500);}})[_0x25ad('0x26')](handleError(_0x1b8132,null));};exports['getSystemAvatar']=function(_0x2cbd6c,_0x3c9bbc,_0x28e061){var _0x5deb86=path[_0x25ad('0x74')](config[_0x25ad('0x75')],_0x25ad('0x81'));var _0x47b5da={'where':{'id':_0x2cbd6c[_0x25ad('0x55')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x25ad('0x50')][_0x25ad('0x5b')](_0x47b5da)[_0x25ad('0x1d')](handleEntityNotFound(_0x3c9bbc,null))[_0x25ad('0x1d')](function(_0x38b143){if(_0x38b143){if(!_['isNil'](_0x38b143[_0x25ad('0x73')])){if(fs['existsSync'](path['join'](config[_0x25ad('0x75')],_0x25ad('0x7b'),_0x38b143[_0x25ad('0x73')]))){_0x5deb86=path[_0x25ad('0x74')](config[_0x25ad('0x75')],_0x25ad('0x7b'),_0x38b143[_0x25ad('0x73')]);}}return _0x3c9bbc[_0x25ad('0x7c')](_0x5deb86);}})[_0x25ad('0x26')](handleError(_0x3c9bbc,null));};exports[_0x25ad('0x82')]=function(_0x592f54,_0x21d513,_0x1b72bb){var _0x5e4684=require('user-agent-parser');var _0x1b6f08=new _0x5e4684();var _0x130d4e=_0x1b6f08[_0x25ad('0x83')](_0x592f54[_0x25ad('0x84')][_0x25ad('0x85')])[_0x25ad('0x86')]();var _0x5ba0b1={'body':_0x592f54[_0x25ad('0x57')],'channel':'chat'};var _0x3e84cd=[];var _0x4851b5=[];var _0x4e3613={};var _0x5491bc=![];return db[_0x25ad('0x87')][_0x25ad('0x5e')]()[_0x25ad('0x1d')](function(_0x2f5287){if(!_0x2f5287){throw new db[(_0x25ad('0x88'))][(_0x25ad('0x89'))](_0x25ad('0x8a'));}_0x3e84cd=_['difference'](_[_0x25ad('0x40')](_0x2f5287),['createdAt','updatedAt']);_0x4851b5=_['difference'](_[_0x25ad('0x40')](_0x2f5287),[_0x25ad('0x8b'),_0x25ad('0x8c'),'CompanyId',_0x25ad('0x8d')]);if(_0x592f54['body']['id']){delete _0x592f54[_0x25ad('0x57')]['id'];}if(_['isNil'](_0x592f54[_0x25ad('0x57')][_0x25ad('0x8e')])){throw new db['Sequelize'][(_0x25ad('0x89'))](_0x25ad('0x8f'));}if(_[_0x25ad('0x80')](_0x592f54[_0x25ad('0x57')][_0x25ad('0x57')])||_0x592f54[_0x25ad('0x57')][_0x25ad('0x57')]===''){throw new db[(_0x25ad('0x88'))]['ValidationError'](_0x25ad('0x90'));}if(_[_0x25ad('0x80')](_0x592f54[_0x25ad('0x57')][_0x25ad('0x91')])){throw new db[(_0x25ad('0x88'))][(_0x25ad('0x89'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4851b5);}if(!_[_0x25ad('0x92')](_0x4851b5,_0x592f54['body'][_0x25ad('0x91')])){throw new db[(_0x25ad('0x88'))]['ValidationError'](_0x25ad('0x93')+_0x4851b5);}_0x4e3613[_0x592f54['body'][_0x25ad('0x91')]]=_0x592f54[_0x25ad('0x57')]['from'];})['then'](function(){return db[_0x25ad('0x50')]['find']({'where':{'id':_0x592f54[_0x25ad('0x55')]['id']},'include':[{'model':db[_0x25ad('0x94')],'as':_0x25ad('0x95'),'include':[{'model':db[_0x25ad('0x87')],'as':_0x25ad('0x96'),'where':_0x4e3613,'limit':0x1,'order':[[_0x25ad('0x8c'),'DESC']]}]},{'model':db[_0x25ad('0x97')],'as':_0x25ad('0x98')}]});})[_0x25ad('0x1d')](handleEntityNotFound(_0x21d513,null))[_0x25ad('0x1d')](function(_0x5f4fb0){if(_0x5f4fb0&&_0x5f4fb0['List']){_0x5ba0b1[_0x25ad('0x99')]=_0x5f4fb0;_0x5ba0b1[_0x25ad('0x9a')]=_0x5f4fb0['Applications'];_0x5ba0b1['list']=_0x5f4fb0[_0x25ad('0x95')];_0x5ba0b1[_0x25ad('0x9a')]=_[_0x25ad('0x9b')](_0x5ba0b1[_0x25ad('0x9a')],[_0x25ad('0x9c')],['asc']);if(_0x5ba0b1[_0x25ad('0x99')][_0x25ad('0x98')]){delete _0x5ba0b1[_0x25ad('0x99')]['Applications'];}if(_0x5ba0b1[_0x25ad('0x99')][_0x25ad('0x95')]&&_0x5ba0b1[_0x25ad('0x99')][_0x25ad('0x95')][_0x25ad('0x96')][_0x25ad('0x46')]){return _0x5ba0b1[_0x25ad('0x99')][_0x25ad('0x95')][_0x25ad('0x96')][0x0];}var _0x25db85=_['defaults'](_0x592f54[_0x25ad('0x57')],{'firstName':_0x592f54['body']['from'],'ListId':_0x5f4fb0[_0x25ad('0x8d')]});_0x25db85[_0x592f54[_0x25ad('0x57')][_0x25ad('0x91')]]=_0x592f54['body'][_0x25ad('0x8e')];return db['CmContact'][_0x25ad('0x56')](_0x25db85,{'fields':_0x3e84cd,'raw':!![]});}})['then'](handleEntityNotFound(_0x21d513,null))[_0x25ad('0x1d')](function(_0x4e8a47){_0x5ba0b1[_0x25ad('0x9d')]=_0x4e8a47;var _0xd57ee4=_0x592f54[_0x25ad('0x57')][_0x25ad('0x9e')];if(_0x592f54[_0x25ad('0x84')][_0x25ad('0x9f')]){_0xd57ee4=_0x592f54[_0x25ad('0x84')][_0x25ad('0x9f')];}else if(_0x592f54[_0x25ad('0x84')][_0x25ad('0xa0')]){_0xd57ee4=_[_0x25ad('0xa1')](_0x592f54[_0x25ad('0x84')][_0x25ad('0xa0')][_0x25ad('0xa2')](','));}if(_0x4e8a47){var _0x5ec293={'ContactId':_0x4e8a47['id'],'ChatWebsiteId':_0x592f54['params']['id'],'from':(_0x4e8a47[_0x25ad('0xa3')]||'')+'\x20'+(_0x4e8a47[_0x25ad('0xa4')]||''),'customerIp':_0xd57ee4,'customerPort':_0x592f54['headers'][_0x25ad('0xa5')]?_0x592f54[_0x25ad('0x84')][_0x25ad('0xa5')]:null,'referer':_0x592f54[_0x25ad('0x57')]['referer'],'browserName':_0x130d4e['browser'][_0x25ad('0x37')]&&_0x130d4e['browser']['version']?util[_0x25ad('0xa6')]('%s\x20%s',_0x130d4e[_0x25ad('0xa7')][_0x25ad('0x37')],_0x130d4e[_0x25ad('0xa7')][_0x25ad('0xa8')]):_0x25ad('0xa9'),'browserVersion':_0x130d4e[_0x25ad('0xa7')][_0x25ad('0xa8')]||_0x25ad('0xa9'),'osName':util[_0x25ad('0xa6')](_0x25ad('0xaa'),_0x130d4e['os'][_0x25ad('0x37')],_0x130d4e['os'][_0x25ad('0xa8')]),'osVersion':_0x130d4e['os'][_0x25ad('0xa8')],'deviceModel':_0x130d4e[_0x25ad('0xab')]['model']&&_0x130d4e['device'][_0x25ad('0xac')]?util[_0x25ad('0xa6')]('%s\x20%s\x20%s',_0x130d4e[_0x25ad('0xab')][_0x25ad('0x43')],_0x130d4e[_0x25ad('0xab')][_0x25ad('0xac')],_0x130d4e['device']['type']):null,'deviceVendor':_0x130d4e['device'][_0x25ad('0xac')],'deviceType':_0x130d4e[_0x25ad('0xab')][_0x25ad('0x3d')],'formData':JSON[_0x25ad('0x21')](_0x592f54[_0x25ad('0x57')])};var _0x6221a2={'ChatWebsiteId':_0x592f54['params']['id'],'closed':![]};if(_0x592f54[_0x25ad('0x57')][_0x25ad('0xad')]){_0x6221a2[_0x25ad('0xad')]=_0x592f54['body'][_0x25ad('0xad')];return db[_0x25ad('0xae')][_0x25ad('0x5b')]({'where':_0x6221a2})[_0x25ad('0x1d')](function(_0x31b8c1){if(_0x31b8c1){return[_0x31b8c1,![]];}_0x5ec293[_0x25ad('0xad')]=_0x592f54[_0x25ad('0x57')][_0x25ad('0xad')];_0x5ec293[_0x25ad('0xaf')]=_0x592f54[_0x25ad('0x57')][_0x25ad('0xaf')];return db['ChatInteraction'][_0x25ad('0x56')](_0x5ec293)[_0x25ad('0x1d')](function(_0x52724c){return[_0x52724c,!![]];});});}_0x6221a2[_0x25ad('0xb0')]=_0x4e8a47['id'];if(_0x592f54['body']['interaction']&&_0x592f54[_0x25ad('0x57')][_0x25ad('0xb1')]['id']){_0x6221a2['id']=_0x592f54['body'][_0x25ad('0xb1')]['id'];return db['ChatInteraction'][_0x25ad('0x5b')]({'where':_0x6221a2})[_0x25ad('0x1d')](function(_0x5a998d){if(_0x5a998d){return[_0x5a998d,![]];}return db[_0x25ad('0xae')][_0x25ad('0x56')](_0x5ec293)[_0x25ad('0x1d')](function(_0x4328c5){return[_0x4328c5,!![]];});});}return db[_0x25ad('0xae')][_0x25ad('0x56')](_0x5ec293)['then'](function(_0x50ae49){return[_0x50ae49,!![]];});}})[_0x25ad('0xb2')](function(_0x5dc6ab,_0x20f297){if(_0x5dc6ab){_0x5491bc=_0x20f297;if(!_0x20f297){var _0x1817c8={'from':(_0x5ba0b1['contact'][_0x25ad('0xa3')]||'')+'\x20'+(_0x5ba0b1['contact'][_0x25ad('0xa4')]||'')};if(_0x592f54[_0x25ad('0x57')][_0x25ad('0xad')]&&_0x592f54[_0x25ad('0x57')][_0x25ad('0xb3')]&&_0x592f54[_0x25ad('0x57')][_0x25ad('0xad')]!=_0x592f54[_0x25ad('0x57')][_0x25ad('0xb3')]){_0x1817c8[_0x25ad('0xad')]=_0x592f54[_0x25ad('0x57')]['messageId'];}return _0x5dc6ab[_0x25ad('0x30')](_0x1817c8);}else{return _0x5dc6ab;}}})['then'](function(_0x1f743f){_0x5ba0b1[_0x25ad('0xb1')]=_0x1f743f['get']({'plain':!![]});_0x5ba0b1[_0x25ad('0xb1')][_0x25ad('0xb4')]=_0x5491bc;if(_0x5ba0b1['interaction'][_0x25ad('0xb4')]){if(_0x5ba0b1[_0x25ad('0x99')][_0x25ad('0xb5')]){_0x5ba0b1[_0x25ad('0x9a')]['push']({'id':0x0,'priority':_0x5ba0b1[_0x25ad('0x9a')][_0x25ad('0x46')]+0x1,'app':_0x25ad('0xb6'),'appdata':_0x25ad('0xb7'),'interval':'*,*,*,*'});}}return db[_0x25ad('0xb8')]['create']({'body':_0x592f54['body'][_0x25ad('0x57')],'ChatWebsiteId':_0x592f54[_0x25ad('0x55')]['id'],'ChatInteractionId':_0x1f743f['id'],'direction':'in','ContactId':_0x5ba0b1[_0x25ad('0x9d')]['id'],'AttachmentId':_0x592f54[_0x25ad('0x57')][_0x25ad('0xb9')]});})[_0x25ad('0x1d')](function(_0x4a1029){_0x5ba0b1[_0x25ad('0x23')]=_0x4a1029;if(_0x5ba0b1['interaction'][_0x25ad('0xba')]){return db['User'][_0x25ad('0x5b')]({'attributes':['id','name'],'where':{'id':_0x5ba0b1['interaction'][_0x25ad('0xba')]}})[_0x25ad('0x1d')](function(_0x49fd8b){if(_0x49fd8b){_0x5ba0b1[_0x25ad('0x9a')][_0x25ad('0xbb')]({'id':0x0,'priority':0x0,'app':_0x25ad('0xbc'),'appdata':_0x49fd8b[_0x25ad('0x37')]+','+(_0x5ba0b1[_0x25ad('0x99')]['waitForTheAssignedAgent']||0xa),'interval':_0x25ad('0xbd')});_0x5ba0b1['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x25ad('0xbe'),_0x5ba0b1);});}return respondWithRpcPromise(_0x25ad('0xbf'),'startRouting',_0x5ba0b1);})[_0x25ad('0x1d')](function(_0x180c0c){respondWithRpcPromise(_0x25ad('0xc0'),_0x25ad('0xc0'),{'event':_0x25ad('0x82'),'message':_0x180c0c},client9002);return _0x180c0c;})[_0x25ad('0x1d')](respondWithResult(_0x21d513,null))[_0x25ad('0x26')](handleError(_0x21d513,null));};exports[_0x25ad('0xc1')]=function(_0x2234a4,_0xe70a41,_0x398ac5){var _0x4a07b7,_0x365f65,_0x1db788;var _0x2d1941=[];var _0x505853=[];var _0x11d122={};return db[_0x25ad('0x87')][_0x25ad('0x5e')]()[_0x25ad('0x1d')](function(_0xb1a310){if(!_0xb1a310){throw new db[(_0x25ad('0x88'))][(_0x25ad('0x89'))](_0x25ad('0x8a'));}_0x505853=_[_0x25ad('0xc2')](_[_0x25ad('0x40')](_0xb1a310),[_0x25ad('0x8b'),'updatedAt']);_0x2d1941=_[_0x25ad('0xc2')](_[_0x25ad('0x40')](_0xb1a310),[_0x25ad('0x8b'),_0x25ad('0x8c'),_0x25ad('0xc3'),'ListId']);if(_0x2234a4[_0x25ad('0x57')]['id']){delete _0x2234a4[_0x25ad('0x57')]['id'];}if(_['isNil'](_0x2234a4['body'][_0x25ad('0x8e')])){throw _0xe70a41['status'](0x1f4)[_0x25ad('0xc4')](new db[(_0x25ad('0x88'))][(_0x25ad('0x89'))](_0x25ad('0x8f')));}if(_[_0x25ad('0x80')](_0x2234a4[_0x25ad('0x57')][_0x25ad('0x57')])||_0x2234a4[_0x25ad('0x57')][_0x25ad('0x57')]===''){throw _0xe70a41[_0x25ad('0x27')](0x1f4)['send'](new db['Sequelize'][(_0x25ad('0x89'))](_0x25ad('0x90')));}if(_[_0x25ad('0x80')](_0x2234a4[_0x25ad('0x57')][_0x25ad('0xc5')])){throw _0xe70a41[_0x25ad('0x27')](0x1f4)[_0x25ad('0xc4')](new db[(_0x25ad('0x88'))][(_0x25ad('0x89'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d1941));}if(!_[_0x25ad('0x92')](_0x2d1941,_0x2234a4[_0x25ad('0x57')][_0x25ad('0xc5')])){throw _0xe70a41[_0x25ad('0x27')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x25ad('0xc6')+_0x2d1941));}_0x11d122[_0x2234a4[_0x25ad('0x57')][_0x25ad('0xc5')]]=_0x2234a4['body'][_0x25ad('0x8e')];})[_0x25ad('0x1d')](function(){return db[_0x25ad('0x50')]['find']({'where':{'id':_0x2234a4['params']['id']},'include':[{'model':db['CmList'],'as':_0x25ad('0x95')}]});})[_0x25ad('0x1d')](handleEntityNotFound(_0xe70a41,null))[_0x25ad('0x1d')](function(_0x1617c0){if(_0x1617c0&&_0x1617c0[_0x25ad('0x95')]){_0x365f65=_0x1617c0;var _0x2904ab=_[_0x25ad('0x16')](_0x2234a4[_0x25ad('0x57')],{'firstName':_0x2234a4[_0x25ad('0x57')][_0x25ad('0x8e')],'phone':_0x2234a4[_0x25ad('0x57')]['from'],'ListId':_0x1617c0[_0x25ad('0x8d')]});_0x2904ab[_0x2234a4[_0x25ad('0x57')][_0x25ad('0xc5')]]=_0x2234a4['body'][_0x25ad('0x8e')];return db[_0x25ad('0x87')]['findOrCreate']({'where':_0x11d122,'defaults':_0x2904ab});}})[_0x25ad('0xb2')](function(_0x5a289d){if(_0x5a289d){_0x1db788=_0x5a289d;var _0x3f95a3=fs[_0x25ad('0xc7')](path[_0x25ad('0x74')](config[_0x25ad('0x75')],'server/files/templates/chatOfflineMessage.ejs'),_0x25ad('0xc8'));var _0x551be5=ejs[_0x25ad('0xc9')](_0x3f95a3,{'body':_['toPairs'](_0x2234a4[_0x25ad('0x57')][_0x25ad('0x57')]),'bodyTitle':_0x365f65[_0x25ad('0xca')]});return db[_0x25ad('0xcb')]['create']({'body':_0x551be5,'ContactId':_0x5a289d['id'],'ChatWebsiteId':_0x365f65['id']});}})[_0x25ad('0x1d')](function(_0x32f9ec){if(_0x32f9ec){_0x4a07b7=_0x32f9ec;return db[_0x25ad('0xcc')][_0x25ad('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x25ad('0xcd')],'as':_0x25ad('0xce'),'raw':!![]}]});}})[_0x25ad('0x1d')](function(_0x4d6c46){if(_0x4d6c46&&_0x4d6c46[_0x25ad('0xce')]&&_0x365f65['forwardOfflineAddress']){var _0x1988d2={'tls':{'rejectUnauthorized':![]}};if(_0x4d6c46[_0x25ad('0xce')][_0x25ad('0xcf')]){_0x1988d2[_0x25ad('0xcf')]=_0x4d6c46[_0x25ad('0xce')]['service'];}else{_0x1988d2[_0x25ad('0xd0')]=_0x4d6c46[_0x25ad('0xce')]['host'];_0x1988d2[_0x25ad('0xd1')]=_0x4d6c46[_0x25ad('0xce')][_0x25ad('0xd1')];_0x1988d2[_0x25ad('0xd2')]=_0x4d6c46[_0x25ad('0xce')][_0x25ad('0xd2')];}if(_0x4d6c46[_0x25ad('0xce')][_0x25ad('0xd3')]){_0x1988d2['auth']={'user':_0x4d6c46[_0x25ad('0xce')][_0x25ad('0x58')],'pass':_0x4d6c46['Smtp'][_0x25ad('0xd4')]};}return respondWithRpcPromise('SendMail',_0x25ad('0xd5'),{'account':_0x1988d2,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4d6c46[_0x25ad('0x37')],_0x4d6c46[_0x25ad('0xd6')]||_0x4d6c46['Smtp']['user']),'to':_0x365f65['forwardOfflineAddress'],'subject':_0x365f65[_0x25ad('0xd7')],'text':_0x4a07b7[_0x25ad('0x57')]}},client9003)['then'](function(){return _0x4a07b7;})['catch'](function(_0x4c57c6){console[_0x25ad('0x22')](_0x4c57c6);});}})[_0x25ad('0x1d')](function(){if(_0x4a07b7){return _0x4a07b7;}})[_0x25ad('0x1d')](respondWithResult(_0xe70a41,null))['catch'](handleError(_0xe70a41,null));};exports['addInteraction']=function(_0x480cb5,_0x58f70a,_0x569ff2){return db['ChatInteraction'][_0x25ad('0x5b')]({'where':{'id':_0x480cb5[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x58f70a,null))[_0x25ad('0x1d')](function(_0x47d2ab){if(_0x47d2ab){return _0x47d2ab[_0x25ad('0xd8')](_0x480cb5[_0x25ad('0x57')][_0x25ad('0x66')],_[_0x25ad('0xd9')](_0x480cb5[_0x25ad('0x57')],[_0x25ad('0x66'),'id'])||{});}})[_0x25ad('0x1d')](respondWithResult(_0x58f70a,null))['catch'](handleError(_0x58f70a,null));};exports['getInteractions']=function(_0x2c35b1,_0x1d62db,_0x5e85b3){var _0x42338f={'raw':![],'where':{}};var _0x181607={};var _0x5c8f00={'count':0x0,'rows':[]};return db[_0x25ad('0x50')][_0x25ad('0x62')]({'where':{'id':_0x2c35b1[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x1d62db,null))[_0x25ad('0x1d')](function(_0x375d3a){if(_0x375d3a){_0x181607[_0x25ad('0x43')]=_[_0x25ad('0x40')](db[_0x25ad('0xae')][_0x25ad('0x3b')]);_0x181607[_0x25ad('0x3f')]=_['keys'](_0x2c35b1['query']);_0x181607[_0x25ad('0x41')]=_[_0x25ad('0x42')](_0x181607[_0x25ad('0x43')],_0x181607['query']);_0x42338f[_0x25ad('0x44')]=_['intersection'](_0x181607['model'],qs[_0x25ad('0x45')](_0x2c35b1[_0x25ad('0x3f')][_0x25ad('0x45')]));_0x42338f[_0x25ad('0x44')]=_0x42338f[_0x25ad('0x44')]['length']?_0x42338f[_0x25ad('0x44')]:_0x181607[_0x25ad('0x43')];if(!_0x2c35b1[_0x25ad('0x3f')][_0x25ad('0x47')]('nolimit')){_0x42338f[_0x25ad('0x2a')]=qs[_0x25ad('0x2a')](_0x2c35b1[_0x25ad('0x3f')][_0x25ad('0x2a')]);_0x42338f[_0x25ad('0x29')]=qs[_0x25ad('0x29')](_0x2c35b1['query'][_0x25ad('0x29')]);}_0x42338f[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x2c35b1[_0x25ad('0x3f')]['sort']);_0x42338f[_0x25ad('0x4c')]=qs[_0x25ad('0x41')](_['pick'](_0x2c35b1[_0x25ad('0x3f')],_0x181607[_0x25ad('0x41')]));_0x42338f[_0x25ad('0x4c')][_0x25ad('0x64')]=_0x375d3a['id'];if(_0x2c35b1['query'][_0x25ad('0x4b')]){_0x42338f[_0x25ad('0x4c')]=_[_0x25ad('0x4d')](_0x42338f['where'],{'$or':_[_0x25ad('0x3a')](_0x42338f[_0x25ad('0x44')],function(_0x50ffdd){var _0x38e7b3={};_0x38e7b3[_0x50ffdd]={'$like':'%'+_0x2c35b1[_0x25ad('0x3f')]['filter']+'%'};return _0x38e7b3;})});}_0x42338f=_[_0x25ad('0x4d')]({},_0x42338f,_0x2c35b1[_0x25ad('0x4f')]);return db['ChatInteraction']['count']({'where':_0x42338f[_0x25ad('0x4c')]})['then'](function(_0xbd3dba){_0x5c8f00['count']=_0xbd3dba;if(_0x2c35b1['query'][_0x25ad('0x51')]){_0x42338f[_0x25ad('0x52')]=[{'model':db[_0x25ad('0x87')],'as':_0x25ad('0xda'),'required':![]},{'model':db['User'],'as':_0x25ad('0xdb'),'attributes':[_0x25ad('0x37'),'fullname',_0x25ad('0xdc')],'required':![]},{'model':db[_0x25ad('0xdd')],'as':_0x25ad('0xde'),'attributes':['id','name',_0x25ad('0xdf')],'where':_0x2c35b1['query']['tag']?{'id':_0x2c35b1[_0x25ad('0x3f')][_0x25ad('0xe0')]}:undefined,'required':_0x2c35b1['query'][_0x25ad('0xe0')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x42338f);})[_0x25ad('0x1d')](function(_0x525f65){_0x5c8f00['rows']=_0x525f65;return _0x5c8f00;});}})[_0x25ad('0x1d')](respondWithFilteredResult(_0x1d62db,_0x42338f))[_0x25ad('0x26')](handleError(_0x1d62db,null));};function iftimePromise(_0x40f277,_0x4bf847){return respondWithRpcPromise('Command',_0x25ad('0xe1'),{'command':_0x4bf847[_0x25ad('0xe2')]?util[_0x25ad('0xa6')](_0x25ad('0xe3'),_0x40f277[_0x25ad('0xe4')],_0x4bf847[_0x25ad('0xe2')]):util[_0x25ad('0xa6')](_0x25ad('0xe5'),_0x40f277[_0x25ad('0xe4')])},client9002)[_0x25ad('0x1d')](function(_0x2de21f){var _0x77dfdd=_0x2de21f&&_0x2de21f[_0x25ad('0xe6')](_0x25ad('0xe7'))>=0x0?!![]:![];logger[_0x25ad('0x24')](_0x25ad('0xe8'),_0x4bf847['id'],_0x40f277['id'],_0x40f277[_0x25ad('0xe4')],_0x77dfdd?_0x25ad('0xe9'):_0x25ad('0xea'),_0x4bf847[_0x25ad('0xe2')]?_0x4bf847[_0x25ad('0xe2')]:'No\x20timezone');return _0x77dfdd;})['catch'](function(_0x4c5705){logger[_0x25ad('0x22')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4bf847['id'],_0x40f277['id'],_0x40f277[_0x25ad('0xe4')],util[_0x25ad('0xeb')](_0x4c5705,{'showHidden':![],'depth':null}),_0x4bf847[_0x25ad('0xe2')]?_0x4bf847[_0x25ad('0xe2')]:_0x25ad('0xec'));return![];});}exports[_0x25ad('0xe1')]=function(_0x1cde1c,_0x2c5286,_0x16a449){var _0x340b1e=0x0;var _0x127d63=0x0;var _0x27e283=![];var _0x4b0a04;var _0x2637f4;return db['ChatWebsite'][_0x25ad('0x5b')]({'where':{'id':_0x1cde1c[_0x25ad('0x55')]['id']},'include':[{'model':db[_0x25ad('0xed')],'as':_0x25ad('0xed'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x25ad('0xe4')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2c5286,null))['then'](function(_0x27b083){if(_0x27b083){_0x4b0a04=_0x27b083;return _0x27b083['getProactiveActions']({'raw':!![]});}})[_0x25ad('0x1d')](function(_0x3209f9){if(_0x4b0a04){if(_0x3209f9){_0x2637f4=_0x3209f9;}}return require(_0x25ad('0x13'))[_0x25ad('0x76')]();})['then'](function(_0x58908f){if(_0x58908f){_0x127d63=_0x58908f[_0x25ad('0xee')];_0x27e283=_0x58908f[_0x25ad('0x77')];}})[_0x25ad('0x1d')](function(){return db[_0x25ad('0xae')][_0x25ad('0x28')]({'where':{'closed':![]}});})[_0x25ad('0x1d')](function(_0x49890b){_0x340b1e=_0x49890b;if(_0x127d63&&_0x49890b>_0x127d63){return db[_0x25ad('0xef')][_0x25ad('0x62')]({'where':{'id':0x1}})[_0x25ad('0x1d')](function(_0x44f3e9){if(_0x44f3e9){_0x44f3e9[_0x25ad('0xf0')](_0x25ad('0xf1'));}});}})[_0x25ad('0x1d')](function(){if(_0x4b0a04[_0x25ad('0xed')]&&_0x4b0a04['Interval'][_0x25ad('0xf2')]){var _0x4162b6=[];for(var _0x56975a=0x0;_0x56975a<_0x4b0a04['Interval']['Intervals'][_0x25ad('0x46')];_0x56975a++){var _0xc0e68f=_0x4b0a04['Interval'][_0x25ad('0xf2')][_0x56975a]['get']({'plain':!![]});_0x4162b6[_0x25ad('0xf3')](iftimePromise(_0xc0e68f,_0x4b0a04));}return BPromise[_0x25ad('0xf4')](_0x4162b6)['then'](function(_0x4d5977){return _[_0x25ad('0xf5')](_0x4d5977);});}else{return!![];}})[_0x25ad('0x1d')](function(_0xc6062c){var _0x5e7b76=fs['readFileSync'](path[_0x25ad('0x74')](config[_0x25ad('0x75')],_0x25ad('0xf6')),_0x25ad('0xc8'));var _0xf6f30={'remote':_0x4b0a04[_0x25ad('0xf7')],'query':querystring[_0x25ad('0x21')](_[_0x25ad('0x4d')](_0x4b0a04[_0x25ad('0x32')]({'plain':!![]}),{'customerIp':_0x1cde1c[_0x25ad('0x84')]['x-forwarded-for']||_0x1cde1c['headers'][_0x25ad('0xf8')]||_0x1cde1c[_0x25ad('0xf9')][_0x25ad('0xfa')]||_0x1cde1c['ip'],'referer':_0x1cde1c['headers'][_0x25ad('0xfb')],'openedInteractions':_0x340b1e,'maxInteractions':_0x127d63,'virtual':_0x27e283[_0x25ad('0xee')],'online':_0xc6062c,'custom':_0x27e283}))[_0x25ad('0xfc')](/'/g,'\x5c\x27')};_0x2c5286[_0x25ad('0xc4')](ejs[_0x25ad('0xc9')](Mustache[_0x25ad('0xc9')](_0x5e7b76,_0xf6f30),{'proactiveActions':_0x2637f4,'alignment':_0x4b0a04[_0x25ad('0xfd')],'verticalAlignment':_0x4b0a04[_0x25ad('0xfe')],'div_color':_0x4b0a04[_0x25ad('0xdf')],'text_color':_0x4b0a04['textColor']}));})[_0x25ad('0x26')](handleError(_0x2c5286,null));};exports[_0x25ad('0xff')]=function(_0x1f16ad,_0x26bff3,_0x438494){return db[_0x25ad('0x50')]['findOne']({'where':{'id':_0x1f16ad[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x26bff3,null))['then'](function(_0x2b863e){if(_0x2b863e){return db[_0x25ad('0x100')][_0x25ad('0x101')](function(_0x3a99d1){return db[_0x25ad('0x97')][_0x25ad('0x31')]({'where':{'ChatWebsiteId':_0x1f16ad['params']['id']},'transaction':_0x3a99d1})['then'](function(_0x27eb3f){var _0x150fa0=_[_0x25ad('0x3a')](_0x1f16ad[_0x25ad('0x57')],function(_0x6be676){_0x6be676[_0x25ad('0x64')]=_0x1f16ad[_0x25ad('0x55')]['id'];return _0x6be676;});return db['ChatApplication']['bulkCreate'](_0x150fa0,{'transaction':_0x3a99d1});});})[_0x25ad('0x1d')](function(){return db[_0x25ad('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1f16ad['params']['id']},'order':'priority'});});}})[_0x25ad('0x1d')](respondWithResult(_0x26bff3,null))['catch'](handleError(_0x26bff3,null));};exports[_0x25ad('0x102')]=function(_0x4e959c,_0x29dc67,_0x398fb4){var _0x1d4ec8={};var _0x48cbea={};var _0x2e33f3;var _0x63e3f1;return db[_0x25ad('0x50')][_0x25ad('0x62')]({'where':{'id':_0x4e959c[_0x25ad('0x55')]['id']}})['then'](handleEntityNotFound(_0x29dc67,null))[_0x25ad('0x1d')](function(_0xb458ba){if(_0xb458ba){_0x2e33f3=_0xb458ba;_0x48cbea[_0x25ad('0x43')]=_[_0x25ad('0x40')](db[_0x25ad('0x97')]['rawAttributes']);_0x48cbea['query']=_[_0x25ad('0x40')](_0x4e959c[_0x25ad('0x3f')]);_0x48cbea['filters']=_[_0x25ad('0x42')](_0x48cbea[_0x25ad('0x43')],_0x48cbea[_0x25ad('0x3f')]);_0x1d4ec8['attributes']=_[_0x25ad('0x42')](_0x48cbea[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x4e959c[_0x25ad('0x3f')]['fields']));_0x1d4ec8[_0x25ad('0x44')]=_0x1d4ec8[_0x25ad('0x44')][_0x25ad('0x46')]?_0x1d4ec8['attributes']:_0x48cbea[_0x25ad('0x43')];_0x1d4ec8[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x4e959c[_0x25ad('0x3f')][_0x25ad('0x4a')]);_0x1d4ec8['where']=qs['filters'](_[_0x25ad('0x63')](_0x4e959c['query'],_0x48cbea[_0x25ad('0x41')]));if(_0x4e959c[_0x25ad('0x3f')][_0x25ad('0x4b')]){_0x1d4ec8[_0x25ad('0x4c')]=_['merge'](_0x1d4ec8['where'],{'$or':_[_0x25ad('0x3a')](_0x1d4ec8[_0x25ad('0x44')],function(_0x5c7ba1){var _0x3a64f8={};_0x3a64f8[_0x5c7ba1]={'$like':'%'+_0x4e959c['query'][_0x25ad('0x4b')]+'%'};return _0x3a64f8;})});}_0x1d4ec8=_[_0x25ad('0x4d')]({},_0x1d4ec8,_0x4e959c[_0x25ad('0x4f')]);return _0x2e33f3[_0x25ad('0x102')](_0x1d4ec8);}})[_0x25ad('0x1d')](function(_0x38af4c){if(_0x38af4c){_0x63e3f1=_0x38af4c[_0x25ad('0x46')];if(!_0x4e959c[_0x25ad('0x3f')][_0x25ad('0x47')](_0x25ad('0x48'))){_0x1d4ec8['limit']=qs[_0x25ad('0x2a')](_0x4e959c[_0x25ad('0x3f')][_0x25ad('0x2a')]);_0x1d4ec8['offset']=qs['offset'](_0x4e959c['query'][_0x25ad('0x29')]);}return _0x2e33f3[_0x25ad('0x102')](_0x1d4ec8);}})[_0x25ad('0x1d')](function(_0x1828c5){if(_0x1828c5){return _0x1828c5?{'count':_0x63e3f1,'rows':_0x1828c5}:null;}})[_0x25ad('0x1d')](respondWithResult(_0x29dc67,null))[_0x25ad('0x26')](handleError(_0x29dc67,null));};exports[_0x25ad('0x103')]=function(_0x976c36,_0x170566,_0x6de0ff){return db[_0x25ad('0x104')][_0x25ad('0x5b')]({'where':{'id':_0x976c36[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x170566,null))['then'](function(_0x33f2c4){if(_0x33f2c4){return _0x33f2c4[_0x25ad('0x103')](_0x976c36[_0x25ad('0x57')][_0x25ad('0x66')],_[_0x25ad('0xd9')](_0x976c36[_0x25ad('0x57')],[_0x25ad('0x66'),'id'])||{});}})[_0x25ad('0x1d')](respondWithResult(_0x170566,null))[_0x25ad('0x26')](handleError(_0x170566,null));};exports[_0x25ad('0x105')]=function(_0x461d68,_0x115499,_0xe6e9d4){var _0x56e826={};var _0x108051={};var _0x5d6acc;var _0x1a0cb9;return db['ChatWebsite']['findOne']({'where':{'id':_0x461d68[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x115499,null))['then'](function(_0x4cfc66){if(_0x4cfc66){_0x5d6acc=_0x4cfc66;_0x108051[_0x25ad('0x43')]=_['keys'](db[_0x25ad('0x106')][_0x25ad('0x3b')]);_0x108051[_0x25ad('0x3f')]=_[_0x25ad('0x40')](_0x461d68['query']);_0x108051[_0x25ad('0x41')]=_['intersection'](_0x108051[_0x25ad('0x43')],_0x108051['query']);_0x56e826[_0x25ad('0x44')]=_[_0x25ad('0x42')](_0x108051[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x461d68[_0x25ad('0x3f')]['fields']));_0x56e826[_0x25ad('0x44')]=_0x56e826[_0x25ad('0x44')][_0x25ad('0x46')]?_0x56e826[_0x25ad('0x44')]:_0x108051[_0x25ad('0x43')];_0x56e826[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x461d68[_0x25ad('0x3f')]['sort']);_0x56e826[_0x25ad('0x4c')]=qs[_0x25ad('0x41')](_[_0x25ad('0x63')](_0x461d68[_0x25ad('0x3f')],_0x108051['filters']));if(_0x461d68[_0x25ad('0x3f')][_0x25ad('0x4b')]){_0x56e826[_0x25ad('0x4c')]=_['merge'](_0x56e826['where'],{'$or':_[_0x25ad('0x3a')](_0x56e826['attributes'],function(_0x2cf804){var _0x4bbc28={};_0x4bbc28[_0x2cf804]={'$like':'%'+_0x461d68[_0x25ad('0x3f')][_0x25ad('0x4b')]+'%'};return _0x4bbc28;})});}_0x56e826=_[_0x25ad('0x4d')]({},_0x56e826,_0x461d68[_0x25ad('0x4f')]);return _0x5d6acc[_0x25ad('0x105')](_0x56e826);}})[_0x25ad('0x1d')](function(_0x5970d2){if(_0x5970d2){_0x1a0cb9=_0x5970d2['length'];if(!_0x461d68[_0x25ad('0x3f')][_0x25ad('0x47')](_0x25ad('0x48'))){_0x56e826[_0x25ad('0x2a')]=qs[_0x25ad('0x2a')](_0x461d68[_0x25ad('0x3f')][_0x25ad('0x2a')]);_0x56e826[_0x25ad('0x29')]=qs[_0x25ad('0x29')](_0x461d68[_0x25ad('0x3f')]['offset']);}return _0x5d6acc[_0x25ad('0x105')](_0x56e826);}})[_0x25ad('0x1d')](function(_0x46cd25){if(_0x46cd25){return _0x46cd25?{'count':_0x1a0cb9,'rows':_0x46cd25}:null;}})['then'](respondWithResult(_0x115499,null))[_0x25ad('0x26')](handleError(_0x115499,null));};exports[_0x25ad('0x107')]=function(_0x4bf5dd,_0x3787e2,_0x4006b0){var _0x19d179=_0x4bf5dd[_0x25ad('0x3f')][_0x25ad('0x108')]==='false'?_0x25ad('0x109'):_0x25ad('0x10a');return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'attributes':['id',_0x19d179],'where':{'id':_0x4bf5dd[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x3787e2,null))[_0x25ad('0x1d')](function(_0x29e5d6){if(_0x29e5d6){var _0xcc6ea5=_0x29e5d6[_0x19d179];var _0x1c8f4f=_0xcc6ea5&&_0xcc6ea5['items']?_0xcc6ea5[_0x25ad('0x10b')]:[];_0x3787e2['send']({'fromKey':_[_0x25ad('0x80')](_0xcc6ea5[_0x25ad('0x10c')])?undefined:_0xcc6ea5[_0x25ad('0x10c')],'count':_0x1c8f4f['length'],'rows':_0x1c8f4f});}})[_0x25ad('0x26')](handleError(_0x3787e2,null));};exports['getOfflineMessages']=function(_0x4c6acb,_0x42badb,_0x39748d){var _0xd5a4fc={'raw':![],'where':{}};var _0x56f605={};var _0x795f8f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x25ad('0x62')]({'where':{'id':_0x4c6acb[_0x25ad('0x55')]['id']}})['then'](handleEntityNotFound(_0x42badb,null))['then'](function(_0x495e41){if(_0x495e41){_0x56f605['model']=_[_0x25ad('0x40')](db[_0x25ad('0xcb')]['rawAttributes']);_0x56f605['query']=_[_0x25ad('0x40')](_0x4c6acb[_0x25ad('0x3f')]);_0x56f605['filters']=_[_0x25ad('0x42')](_0x56f605[_0x25ad('0x43')],_0x56f605['query']);_0xd5a4fc['attributes']=_[_0x25ad('0x42')](_0x56f605[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x4c6acb[_0x25ad('0x3f')][_0x25ad('0x45')]));_0xd5a4fc[_0x25ad('0x44')]=_0xd5a4fc[_0x25ad('0x44')][_0x25ad('0x46')]?_0xd5a4fc[_0x25ad('0x44')]:_0x56f605[_0x25ad('0x43')];if(!_0x4c6acb['query']['hasOwnProperty'](_0x25ad('0x48'))){_0xd5a4fc['limit']=qs[_0x25ad('0x2a')](_0x4c6acb[_0x25ad('0x3f')][_0x25ad('0x2a')]);_0xd5a4fc['offset']=qs[_0x25ad('0x29')](_0x4c6acb[_0x25ad('0x3f')][_0x25ad('0x29')]);}_0xd5a4fc[_0x25ad('0x49')]=qs[_0x25ad('0x4a')](_0x4c6acb[_0x25ad('0x3f')][_0x25ad('0x4a')]);_0xd5a4fc['where']=qs['filters'](_[_0x25ad('0x63')](_0x4c6acb['query'],_0x56f605[_0x25ad('0x41')]));_0xd5a4fc['where'][_0x25ad('0x64')]=_0x495e41['id'];if(_0x4c6acb['query'][_0x25ad('0x4b')]){_0xd5a4fc[_0x25ad('0x4c')]=_[_0x25ad('0x4d')](_0xd5a4fc[_0x25ad('0x4c')],{'$or':_[_0x25ad('0x3a')](_0xd5a4fc['attributes'],function(_0x2affb1){var _0x4bf496={};_0x4bf496[_0x2affb1]={'$like':'%'+_0x4c6acb[_0x25ad('0x3f')][_0x25ad('0x4b')]+'%'};return _0x4bf496;})});}_0xd5a4fc=_[_0x25ad('0x4d')]({},_0xd5a4fc,_0x4c6acb['options']);return db[_0x25ad('0xcb')][_0x25ad('0x28')]({'where':_0xd5a4fc[_0x25ad('0x4c')]})[_0x25ad('0x1d')](function(_0x43be13){_0x795f8f['count']=_0x43be13;if(_0x4c6acb[_0x25ad('0x3f')][_0x25ad('0x51')]){_0xd5a4fc[_0x25ad('0x52')]=[{'all':!![]}];}else{_0xd5a4fc[_0x25ad('0x52')]=[{'model':db['CmContact'],'as':_0x25ad('0xda'),'required':![]}];}return db[_0x25ad('0xcb')][_0x25ad('0x53')](_0xd5a4fc);})[_0x25ad('0x1d')](function(_0x51b5e6){_0x795f8f[_0x25ad('0x54')]=_0x51b5e6;return _0x795f8f;});}})[_0x25ad('0x1d')](respondWithFilteredResult(_0x42badb,_0xd5a4fc))['catch'](handleError(_0x42badb,null));};exports[_0x25ad('0x10d')]=function(_0x59e3b7,_0x1bb381,_0x52db93){return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x59e3b7[_0x25ad('0x55')]['id']}})[_0x25ad('0x1d')](handleEntityNotFound(_0x1bb381,null))[_0x25ad('0x1d')](function(_0x53a228){if(_0x53a228){return _0x53a228[_0x25ad('0x10d')](_0x59e3b7[_0x25ad('0x57')][_0x25ad('0x66')],_[_0x25ad('0xd9')](_0x59e3b7[_0x25ad('0x57')],[_0x25ad('0x66'),'id'])||{})[_0x25ad('0xb2')](function(_0x365026){for(var _0x588e81=0x0;_0x588e81<_0x59e3b7['body'][_0x25ad('0x66')][_0x25ad('0x46')];_0x588e81+=0x1){socket[_0x25ad('0x10e')](_0x25ad('0x10f'),{'UserId':_0x59e3b7[_0x25ad('0x57')][_0x25ad('0x66')][_0x588e81],'ChatWebsiteId':_0x59e3b7[_0x25ad('0x55')]['id']});}return _0x365026;});}})[_0x25ad('0x1d')](respondWithResult(_0x1bb381,null))[_0x25ad('0x26')](handleError(_0x1bb381,null));};exports[_0x25ad('0x110')]=function(_0x401de4,_0x4783d0,_0xdf7990){return db[_0x25ad('0x50')][_0x25ad('0x5b')]({'where':{'id':_0x401de4[_0x25ad('0x55')]['id']}})['then'](handleEntityNotFound(_0x4783d0,null))[_0x25ad('0x1d')](function(_0x9666c5){if(_0x9666c5){return _0x9666c5['removeAgents'](_0x401de4[_0x25ad('0x3f')]['ids'])[_0x25ad('0x1d')](function(){if(_[_0x25ad('0x111')](_0x401de4[_0x25ad('0x3f')][_0x25ad('0x66')])){for(var _0x3c861d=0x0;_0x3c861d<_0x401de4[_0x25ad('0x3f')]['ids'][_0x25ad('0x46')];_0x3c861d+=0x1){socket['emit'](_0x25ad('0x112'),{'UserId':Number(_0x401de4[_0x25ad('0x3f')][_0x25ad('0x66')][_0x3c861d]),'ChatWebsiteId':Number(_0x401de4[_0x25ad('0x55')]['id'])});}}else{socket['emit'](_0x25ad('0x112'),{'UserId':Number(_0x401de4[_0x25ad('0x3f')][_0x25ad('0x66')]),'ChatWebsiteId':Number(_0x401de4[_0x25ad('0x55')]['id'])});}});}})[_0x25ad('0x1d')](respondWithStatusCode(_0x4783d0,null))[_0x25ad('0x26')](handleError(_0x4783d0,null));};exports[_0x25ad('0x113')]=function(_0x5d57a1,_0x4085aa,_0x7ba372){var _0x9b4754={};var _0x3a342d={};var _0x15ce49;var _0x25ab6b;return db[_0x25ad('0x50')][_0x25ad('0x62')]({'where':{'id':_0x5d57a1[_0x25ad('0x55')]['id']}})['then'](handleEntityNotFound(_0x4085aa,null))[_0x25ad('0x1d')](function(_0x1227e5){if(_0x1227e5){_0x15ce49=_0x1227e5;_0x3a342d[_0x25ad('0x43')]=_[_0x25ad('0x40')](db[_0x25ad('0x114')][_0x25ad('0x3b')]);_0x3a342d[_0x25ad('0x3f')]=_[_0x25ad('0x40')](_0x5d57a1['query']);_0x3a342d[_0x25ad('0x41')]=_['intersection'](_0x3a342d['model'],_0x3a342d['query']);_0x9b4754[_0x25ad('0x44')]=_[_0x25ad('0x42')](_0x3a342d[_0x25ad('0x43')],qs[_0x25ad('0x45')](_0x5d57a1['query'][_0x25ad('0x45')]));_0x9b4754[_0x25ad('0x44')]=_0x9b4754[_0x25ad('0x44')]['length']?_0x9b4754['attributes']:_0x3a342d[_0x25ad('0x43')];_0x9b4754['order']=qs[_0x25ad('0x4a')](_0x5d57a1[_0x25ad('0x3f')][_0x25ad('0x4a')]);_0x9b4754['where']=qs['filters'](_[_0x25ad('0x63')](_0x5d57a1[_0x25ad('0x3f')],_0x3a342d['filters']));if(_0x5d57a1[_0x25ad('0x3f')][_0x25ad('0x4b')]){_0x9b4754[_0x25ad('0x4c')]=_[_0x25ad('0x4d')](_0x9b4754['where'],{'$or':_['map'](_0x9b4754[_0x25ad('0x44')],function(_0x43236a){var _0x1703a1={};_0x1703a1[_0x43236a]={'$like':'%'+_0x5d57a1['query'][_0x25ad('0x4b')]+'%'};return _0x1703a1;})});}_0x9b4754=_[_0x25ad('0x4d')]({},_0x9b4754,_0x5d57a1[_0x25ad('0x4f')]);return _0x15ce49[_0x25ad('0x113')](_0x9b4754);}})[_0x25ad('0x1d')](function(_0x865a9c){if(_0x865a9c){_0x25ab6b=_0x865a9c['length'];if(!_0x5d57a1[_0x25ad('0x3f')][_0x25ad('0x47')](_0x25ad('0x48'))){_0x9b4754['limit']=qs[_0x25ad('0x2a')](_0x5d57a1[_0x25ad('0x3f')]['limit']);_0x9b4754[_0x25ad('0x29')]=qs['offset'](_0x5d57a1['query']['offset']);}return _0x15ce49[_0x25ad('0x113')](_0x9b4754);}})['then'](function(_0x303a71){if(_0x303a71){return _0x303a71?{'count':_0x25ab6b,'rows':_0x303a71}:null;}})[_0x25ad('0x1d')](respondWithResult(_0x4085aa,null))[_0x25ad('0x26')](handleError(_0x4085aa,null));}; \ No newline at end of file +var _0x31b9=['../../mysqldb','redis','localhost','./chatWebsite.socket','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','status','end','json','offset','limit','set','destroy','then','ChatWebsites','UserProfileResource','sendStatus','index','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','options','count','includeAll','include','ChatWebsite','rows','show','Pause','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','name','update','params','describe','addDisposition','Disposition','getDispositions','findOne','length','nolimit','ChatWebsiteId','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','file','addAvatar','addCustomerAvatar','customerAvatar','filename','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','account','applications','list','orderBy','priority','asc','defaults','customerIp','cf-connecting-ip','headers','x-forwarded-for','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','contact','lastName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','difference','mapKeyOffline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','email','addInteraction','omit','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','getLicense','virtual','License','increment','Intervals','push','all','some','server/files/chat/iframe.js','remote','connection','remoteAddress','replace','verticalAlignment','textColor','addApplications','sequelize','transaction','ChatApplication','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xb7b669,_0x49591e){var _0x569591=function(_0x22e340){while(--_0x22e340){_0xb7b669['push'](_0xb7b669['shift']());}};_0x569591(++_0x49591e);}(_0x31b9,0xff));var _0x931b=function(_0x33d2c2,_0x46bdbc){_0x33d2c2=_0x33d2c2-0x0;var _0x484e3d=_0x31b9[_0x33d2c2];return _0x484e3d;};'use strict';var pdf=require(_0x931b('0x0'));var emlformat=require(_0x931b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x931b('0x2'));var jsonpatch=require(_0x931b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x931b('0x4'));var Mustache=require(_0x931b('0x5'));var util=require(_0x931b('0x6'));var path=require(_0x931b('0x7'));var sox=require(_0x931b('0x8'));var csv=require(_0x931b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x931b('0xa'));var crypto=require(_0x931b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x931b('0xc'));var toCsv=require(_0x931b('0x9'));var querystring=require(_0x931b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x931b('0xe'));var qs=require(_0x931b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x931b('0x10'));var logger=require(_0x931b('0x11'))(_0x931b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x931b('0x13'))['db'];config[_0x931b('0x14')]=_['defaults'](config[_0x931b('0x14')],{'host':_0x931b('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x931b('0x14')]));require(_0x931b('0x16'))['register'](socket);var jayson=require(_0x931b('0x17'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x931b('0x18')][_0x931b('0x19')]({'port':0x232a});var client9003=jayson[_0x931b('0x18')]['http']({'port':0x232b});function respondWithRpcPromise(_0x217472,_0x5b56e7,_0xb4bc17,_0x28c38a){return new BPromise(function(_0x380e2b,_0x41c39a){var _0x17a235=_0x28c38a||client;return _0x17a235[_0x931b('0x1a')](_0x217472,_0xb4bc17)['then'](function(_0x3751e1){logger[_0x931b('0x1b')](_0x931b('0x1c'),_0x5b56e7,_0x931b('0x1d'));logger['debug'](_0x931b('0x1e'),_0x5b56e7,_0x931b('0x1d'),JSON[_0x931b('0x1f')](_0x3751e1));if(_0x3751e1['error']){if(_0x3751e1['error']['code']===0x1f4){logger['error'](_0x931b('0x1c'),_0x5b56e7,_0x3751e1['error'][_0x931b('0x20')]);return _0x41c39a(_0x3751e1[_0x931b('0x21')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5b56e7,_0x3751e1['error']['message']);return _0x380e2b(_0x3751e1[_0x931b('0x21')][_0x931b('0x20')]);}else{logger[_0x931b('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x5b56e7,_0x931b('0x1d'));_0x380e2b(_0x3751e1[_0x931b('0x22')]['message']);}})[_0x931b('0x23')](function(_0x9795e4){logger[_0x931b('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x5b56e7,_0x9795e4);_0x41c39a(_0x9795e4);});});}function respondWithStatusCode(_0x5a3500,_0x482cce){_0x482cce=_0x482cce||0xcc;return function(_0x3bcf86){if(_0x3bcf86){return _0x5a3500['sendStatus'](_0x482cce);}return _0x5a3500[_0x931b('0x24')](_0x482cce)[_0x931b('0x25')]();};}function respondWithResult(_0xc0b221,_0x193b2c){_0x193b2c=_0x193b2c||0xc8;return function(_0x4d7ba2){if(_0x4d7ba2){return _0xc0b221[_0x931b('0x24')](_0x193b2c)[_0x931b('0x26')](_0x4d7ba2);}};}function respondWithFilteredResult(_0x41f74,_0x57cdc3){return function(_0x333920){if(_0x333920){var _0x55a08f=_0x333920['count'],_0x236ef2=_0x57cdc3[_0x931b('0x27')],_0x141754=_0x57cdc3['offset']+_0x57cdc3[_0x931b('0x28')],_0x1f29ba;if(_0x141754>=_0x55a08f){_0x141754=_0x55a08f;_0x1f29ba=0xc8;}else{_0x1f29ba=0xce;}_0x41f74[_0x931b('0x24')](_0x1f29ba);return _0x41f74[_0x931b('0x29')]('Content-Range',_0x236ef2+'-'+_0x141754+'/'+_0x55a08f)[_0x931b('0x26')](_0x333920);}return null;};}function patchUpdates(_0x42d28b){return function(_0x14eb16){try{jsonpatch['apply'](_0x14eb16,_0x42d28b,!![]);}catch(_0x1fabf1){return BPromise['reject'](_0x1fabf1);}return _0x14eb16['save']();};}function saveUpdates(_0x4f1044,_0x2259ce){return function(_0x373352){if(_0x373352){return _0x373352['update'](_0x4f1044)['then'](function(_0x2a48af){return _0x2a48af;});}return null;};}function removeEntity(_0x1e4061,_0x443832){return function(_0x1106df){if(_0x1106df){return _0x1106df[_0x931b('0x2a')]()[_0x931b('0x2b')](function(){var _0x447e70=_0x1106df['get']({'plain':!![]});var _0x5e8cfd=_0x931b('0x2c');return db[_0x931b('0x2d')]['destroy']({'where':{'type':_0x5e8cfd,'resourceId':_0x447e70['id']}})[_0x931b('0x2b')](function(){return _0x1106df;});})[_0x931b('0x2b')](function(){_0x1e4061[_0x931b('0x24')](0xcc)[_0x931b('0x25')]();});}};}function handleEntityNotFound(_0x37d0e5,_0x9ee1e5){return function(_0x47bc58){if(!_0x47bc58){_0x37d0e5[_0x931b('0x2e')](0x194);}return _0x47bc58;};}function handleError(_0x321eda,_0x2b85b6){_0x2b85b6=_0x2b85b6||0x1f4;return function(_0x3f6d24){logger['error'](_0x3f6d24['stack']);if(_0x3f6d24['name']){delete _0x3f6d24['name'];}_0x321eda['status'](_0x2b85b6)['send'](_0x3f6d24);};}exports[_0x931b('0x2f')]=function(_0xb036d9,_0x29c56a){var _0x42179a={'include':[{'model':db['Pause'],'as':_0x931b('0x30')}]},_0x490332={},_0xf1c064={'count':0x0,'rows':[]};var _0x56cd32=_[_0x931b('0x31')](db['ChatWebsite'][_0x931b('0x32')],function(_0x20e997){return{'name':_0x20e997['fieldName'],'type':_0x20e997[_0x931b('0x33')][_0x931b('0x34')]};});_0x490332[_0x931b('0x35')]=_[_0x931b('0x31')](_0x56cd32,'name');_0x490332[_0x931b('0x36')]=_[_0x931b('0x37')](_0xb036d9['query']);_0x490332[_0x931b('0x38')]=_[_0x931b('0x39')](_0x490332[_0x931b('0x35')],_0x490332[_0x931b('0x36')]);_0x42179a[_0x931b('0x3a')]=_[_0x931b('0x39')](_0x490332[_0x931b('0x35')],qs[_0x931b('0x3b')](_0xb036d9['query']['fields']));_0x42179a[_0x931b('0x3a')]=_0x42179a['attributes']['length']?_0x42179a['attributes']:_0x490332[_0x931b('0x35')];if(!_0xb036d9[_0x931b('0x36')][_0x931b('0x3c')]('nolimit')){_0x42179a[_0x931b('0x28')]=qs[_0x931b('0x28')](_0xb036d9[_0x931b('0x36')][_0x931b('0x28')]);_0x42179a[_0x931b('0x27')]=qs[_0x931b('0x27')](_0xb036d9[_0x931b('0x36')][_0x931b('0x27')]);}_0x42179a[_0x931b('0x3d')]=qs[_0x931b('0x3e')](_0xb036d9[_0x931b('0x36')][_0x931b('0x3e')]);_0x42179a['where']=qs[_0x931b('0x38')](_[_0x931b('0x3f')](_0xb036d9[_0x931b('0x36')],_0x490332[_0x931b('0x38')]),_0x56cd32);if(_0xb036d9[_0x931b('0x36')]['filter']){_0x42179a['where']=_[_0x931b('0x40')](_0x42179a[_0x931b('0x41')],{'$or':_[_0x931b('0x31')](_0x56cd32,function(_0x42d2d4){if(_0x42d2d4[_0x931b('0x33')]!==_0x931b('0x42')){var _0x2fca40={};_0x2fca40[_0x42d2d4['name']]={'$like':'%'+_0xb036d9['query']['filter']+'%'};return _0x2fca40;}})});}_0x42179a=_[_0x931b('0x40')]({},_0x42179a,_0xb036d9[_0x931b('0x43')]);var _0x1f5fdd={'where':_0x42179a['where']};return db['ChatWebsite'][_0x931b('0x44')](_0x1f5fdd)['then'](function(_0x2278d6){_0xf1c064['count']=_0x2278d6;if(_0xb036d9[_0x931b('0x36')][_0x931b('0x45')]){_0x42179a[_0x931b('0x46')]=[{'all':!![]}];}return db[_0x931b('0x47')]['findAll'](_0x42179a);})[_0x931b('0x2b')](function(_0x99c4fd){_0xf1c064[_0x931b('0x48')]=_0x99c4fd;return _0xf1c064;})[_0x931b('0x2b')](respondWithFilteredResult(_0x29c56a,_0x42179a))['catch'](handleError(_0x29c56a,null));};exports[_0x931b('0x49')]=function(_0x505a2f,_0x3b995c){var _0x4857b6={'raw':![],'where':{'id':_0x505a2f['params']['id']},'include':[{'model':db[_0x931b('0x4a')],'as':'mandatoryDispositionPause'}]},_0x7adecd={};_0x7adecd[_0x931b('0x35')]=_[_0x931b('0x37')](db['ChatWebsite'][_0x931b('0x32')]);_0x7adecd[_0x931b('0x36')]=_['keys'](_0x505a2f['query']);_0x7adecd[_0x931b('0x38')]=_[_0x931b('0x39')](_0x7adecd[_0x931b('0x35')],_0x7adecd['query']);_0x4857b6[_0x931b('0x3a')]=_[_0x931b('0x39')](_0x7adecd['model'],qs[_0x931b('0x3b')](_0x505a2f[_0x931b('0x36')][_0x931b('0x3b')]));_0x4857b6[_0x931b('0x3a')]=_0x4857b6[_0x931b('0x3a')]['length']?_0x4857b6[_0x931b('0x3a')]:_0x7adecd[_0x931b('0x35')];if(_0x505a2f['query']['includeAll']){_0x4857b6['include']=[{'all':!![]}];}_0x4857b6=_[_0x931b('0x40')]({},_0x4857b6,_0x505a2f[_0x931b('0x43')]);return db['ChatWebsite'][_0x931b('0x4b')](_0x4857b6)[_0x931b('0x2b')](handleEntityNotFound(_0x3b995c,null))[_0x931b('0x2b')](respondWithResult(_0x3b995c,null))['catch'](handleError(_0x3b995c,null));};exports[_0x931b('0x4c')]=function(_0x1a303b,_0x8c087b){return db[_0x931b('0x47')]['create'](_0x1a303b[_0x931b('0x4d')],{})[_0x931b('0x2b')](function(_0x2bc737){var _0x2b363b=_0x1a303b[_0x931b('0x4e')][_0x931b('0x4f')]({'plain':!![]});if(!_0x2b363b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b363b[_0x931b('0x50')]==='user'){var _0x1da303=_0x2bc737['get']({'plain':!![]});var _0xc58c35='ChatWebsites';return db[_0x931b('0x51')][_0x931b('0x4b')]({'where':{'name':_0xc58c35,'userProfileId':_0x2b363b[_0x931b('0x52')]},'raw':!![]})[_0x931b('0x2b')](function(_0x1ba013){if(_0x1ba013&&_0x1ba013[_0x931b('0x53')]===0x0){return db['UserProfileResource'][_0x931b('0x4c')]({'name':_0x1da303[_0x931b('0x54')],'resourceId':_0x1da303['id'],'type':_0x1ba013[_0x931b('0x54')],'sectionId':_0x1ba013['id']},{})[_0x931b('0x2b')](function(){return _0x2bc737;});}else{return _0x2bc737;}})[_0x931b('0x23')](function(_0x284829){logger[_0x931b('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x284829);throw _0x284829;});}return _0x2bc737;})[_0x931b('0x2b')](respondWithResult(_0x8c087b,0xc9))[_0x931b('0x23')](handleError(_0x8c087b,null));};exports[_0x931b('0x55')]=function(_0x3bb132,_0x515a84){if(_0x3bb132[_0x931b('0x4d')]['id']){delete _0x3bb132[_0x931b('0x4d')]['id'];}return db['ChatWebsite'][_0x931b('0x4b')]({'where':{'id':_0x3bb132[_0x931b('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x931b('0x30')}]})[_0x931b('0x2b')](handleEntityNotFound(_0x515a84,null))['then'](saveUpdates(_0x3bb132[_0x931b('0x4d')],null))[_0x931b('0x2b')](respondWithResult(_0x515a84,null))[_0x931b('0x23')](handleError(_0x515a84,null));};exports['destroy']=function(_0x5707ff,_0x1e470a){return db['ChatWebsite']['find']({'where':{'id':_0x5707ff[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x1e470a,null))[_0x931b('0x2b')](removeEntity(_0x1e470a,null))[_0x931b('0x23')](handleError(_0x1e470a,null));};exports[_0x931b('0x57')]=function(_0x6f50d5,_0x444edb){return db[_0x931b('0x47')][_0x931b('0x57')]()[_0x931b('0x2b')](respondWithResult(_0x444edb,null))[_0x931b('0x23')](handleError(_0x444edb,null));};exports[_0x931b('0x58')]=function(_0x267f59,_0x32f88f,_0x2c16e4){if(_0x267f59[_0x931b('0x4d')]['id']){delete _0x267f59[_0x931b('0x4d')]['id'];}return db[_0x931b('0x47')]['find']({'where':{'id':_0x267f59[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x32f88f,null))[_0x931b('0x2b')](function(_0x5ae844){if(_0x5ae844){_0x267f59[_0x931b('0x4d')]['ChatWebsiteId']=_0x5ae844['id'];return db[_0x931b('0x59')][_0x931b('0x4c')](_0x267f59['body']);}})[_0x931b('0x2b')](respondWithResult(_0x32f88f,null))[_0x931b('0x23')](handleError(_0x32f88f,null));};exports[_0x931b('0x5a')]=function(_0x517276,_0x4eed61,_0x2ad64d){var _0x28ced9={'raw':![],'where':{}};var _0xaab8dc={};var _0x51a0af={'count':0x0,'rows':[]};return db[_0x931b('0x47')][_0x931b('0x5b')]({'where':{'id':_0x517276[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x4eed61,null))[_0x931b('0x2b')](function(_0x1d74d8){if(_0x1d74d8){_0xaab8dc['model']=_[_0x931b('0x37')](db[_0x931b('0x59')][_0x931b('0x32')]);_0xaab8dc['query']=_['keys'](_0x517276[_0x931b('0x36')]);_0xaab8dc['filters']=_['intersection'](_0xaab8dc[_0x931b('0x35')],_0xaab8dc[_0x931b('0x36')]);_0x28ced9[_0x931b('0x3a')]=_['intersection'](_0xaab8dc[_0x931b('0x35')],qs[_0x931b('0x3b')](_0x517276[_0x931b('0x36')][_0x931b('0x3b')]));_0x28ced9[_0x931b('0x3a')]=_0x28ced9[_0x931b('0x3a')][_0x931b('0x5c')]?_0x28ced9['attributes']:_0xaab8dc[_0x931b('0x35')];if(!_0x517276[_0x931b('0x36')][_0x931b('0x3c')](_0x931b('0x5d'))){_0x28ced9[_0x931b('0x28')]=qs[_0x931b('0x28')](_0x517276[_0x931b('0x36')]['limit']);_0x28ced9[_0x931b('0x27')]=qs[_0x931b('0x27')](_0x517276['query']['offset']);}_0x28ced9['order']=qs['sort'](_0x517276[_0x931b('0x36')][_0x931b('0x3e')]);_0x28ced9['where']=qs['filters'](_[_0x931b('0x3f')](_0x517276[_0x931b('0x36')],_0xaab8dc['filters']));_0x28ced9['where'][_0x931b('0x5e')]=_0x1d74d8['id'];if(_0x517276['query']['filter']){_0x28ced9[_0x931b('0x41')]=_[_0x931b('0x40')](_0x28ced9['where'],{'$or':_[_0x931b('0x31')](_0x28ced9[_0x931b('0x3a')],function(_0x20b329){var _0x396ce6={};_0x396ce6[_0x20b329]={'$like':'%'+_0x517276[_0x931b('0x36')][_0x931b('0x5f')]+'%'};return _0x396ce6;})});}_0x28ced9=_[_0x931b('0x40')]({},_0x28ced9,_0x517276[_0x931b('0x43')]);return db[_0x931b('0x59')]['count']({'where':_0x28ced9['where']})[_0x931b('0x2b')](function(_0x411d46){_0x51a0af[_0x931b('0x44')]=_0x411d46;if(_0x517276[_0x931b('0x36')][_0x931b('0x45')]){_0x28ced9[_0x931b('0x46')]=[{'all':!![]}];}return db[_0x931b('0x59')][_0x931b('0x60')](_0x28ced9);})[_0x931b('0x2b')](function(_0x46c467){_0x51a0af[_0x931b('0x48')]=_0x46c467;return _0x51a0af;});}})[_0x931b('0x2b')](respondWithFilteredResult(_0x4eed61,_0x28ced9))[_0x931b('0x23')](handleError(_0x4eed61,null));};exports['removeDispositions']=function(_0x4288d2,_0x1afc57,_0x49f6fd){return db[_0x931b('0x47')][_0x931b('0x4b')]({'where':{'id':_0x4288d2[_0x931b('0x56')]['id']}})['then'](handleEntityNotFound(_0x1afc57,null))[_0x931b('0x2b')](function(_0xe308d){if(_0xe308d){return _0xe308d[_0x931b('0x61')](_0x4288d2[_0x931b('0x36')][_0x931b('0x62')]);}})[_0x931b('0x2b')](respondWithStatusCode(_0x1afc57,null))[_0x931b('0x23')](handleError(_0x1afc57,null));};exports[_0x931b('0x63')]=function(_0x4aeb54,_0x154dd3,_0x9a9661){if(_0x4aeb54['body']['id']){delete _0x4aeb54[_0x931b('0x4d')]['id'];}return db['ChatWebsite'][_0x931b('0x4b')]({'where':{'id':_0x4aeb54[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x154dd3,null))[_0x931b('0x2b')](function(_0x1d408d){if(_0x1d408d){_0x4aeb54[_0x931b('0x4d')][_0x931b('0x5e')]=_0x1d408d['id'];return db[_0x931b('0x64')][_0x931b('0x4c')](_0x4aeb54[_0x931b('0x4d')]);}})[_0x931b('0x2b')](respondWithResult(_0x154dd3,null))[_0x931b('0x23')](handleError(_0x154dd3,null));};exports[_0x931b('0x65')]=function(_0x36debe,_0x7b36bd,_0x3b2719){var _0x2dba6c={'raw':![],'where':{}};var _0x367dba={};var _0x309f95={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x931b('0x5b')]({'where':{'id':_0x36debe[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x7b36bd,null))[_0x931b('0x2b')](function(_0xcbda22){if(_0xcbda22){_0x367dba[_0x931b('0x35')]=_[_0x931b('0x37')](db[_0x931b('0x64')][_0x931b('0x32')]);_0x367dba['query']=_['keys'](_0x36debe[_0x931b('0x36')]);_0x367dba['filters']=_[_0x931b('0x39')](_0x367dba[_0x931b('0x35')],_0x367dba['query']);_0x2dba6c['attributes']=_[_0x931b('0x39')](_0x367dba[_0x931b('0x35')],qs['fields'](_0x36debe['query'][_0x931b('0x3b')]));_0x2dba6c[_0x931b('0x3a')]=_0x2dba6c[_0x931b('0x3a')][_0x931b('0x5c')]?_0x2dba6c[_0x931b('0x3a')]:_0x367dba[_0x931b('0x35')];if(!_0x36debe[_0x931b('0x36')][_0x931b('0x3c')](_0x931b('0x5d'))){_0x2dba6c[_0x931b('0x28')]=qs[_0x931b('0x28')](_0x36debe[_0x931b('0x36')][_0x931b('0x28')]);_0x2dba6c['offset']=qs[_0x931b('0x27')](_0x36debe['query'][_0x931b('0x27')]);}_0x2dba6c[_0x931b('0x3d')]=qs[_0x931b('0x3e')](_0x36debe['query']['sort']);_0x2dba6c['where']=qs[_0x931b('0x38')](_[_0x931b('0x3f')](_0x36debe['query'],_0x367dba[_0x931b('0x38')]));_0x2dba6c[_0x931b('0x41')][_0x931b('0x5e')]=_0xcbda22['id'];if(_0x36debe[_0x931b('0x36')]['filter']){_0x2dba6c[_0x931b('0x41')]=_[_0x931b('0x40')](_0x2dba6c[_0x931b('0x41')],{'$or':_['map'](_0x2dba6c[_0x931b('0x3a')],function(_0x525f91){var _0x168ebe={};_0x168ebe[_0x525f91]={'$like':'%'+_0x36debe[_0x931b('0x36')][_0x931b('0x5f')]+'%'};return _0x168ebe;})});}_0x2dba6c=_['merge']({},_0x2dba6c,_0x36debe[_0x931b('0x43')]);return db['CannedAnswer']['count']({'where':_0x2dba6c['where']})['then'](function(_0x509f24){_0x309f95[_0x931b('0x44')]=_0x509f24;if(_0x36debe[_0x931b('0x36')][_0x931b('0x45')]){_0x2dba6c[_0x931b('0x46')]=[{'all':!![]}];}return db[_0x931b('0x64')][_0x931b('0x60')](_0x2dba6c);})[_0x931b('0x2b')](function(_0x2f59a8){_0x309f95[_0x931b('0x48')]=_0x2f59a8;return _0x309f95;});}})[_0x931b('0x2b')](respondWithFilteredResult(_0x7b36bd,_0x2dba6c))[_0x931b('0x23')](handleError(_0x7b36bd,null));};exports['removeAnswers']=function(_0x36e6c7,_0x36cbad,_0x8c2d1a){return db[_0x931b('0x47')][_0x931b('0x4b')]({'where':{'id':_0x36e6c7[_0x931b('0x56')]['id']}})['then'](handleEntityNotFound(_0x36cbad,null))[_0x931b('0x2b')](function(_0x269a18){if(_0x269a18){return _0x269a18[_0x931b('0x66')](_0x36e6c7[_0x931b('0x36')][_0x931b('0x62')]);}})[_0x931b('0x2b')](respondWithStatusCode(_0x36cbad,null))[_0x931b('0x23')](handleError(_0x36cbad,null));};exports['addLogo']=function(_0x2f86de,_0x4311e6,_0x3e5c99){_0x2f86de[_0x931b('0x4d')]['sitepic']=_0x2f86de[_0x931b('0x67')]['filename'];return db[_0x931b('0x47')][_0x931b('0x4b')]({'where':{'id':_0x2f86de[_0x931b('0x56')]['id']}})['then'](handleEntityNotFound(_0x4311e6,null))[_0x931b('0x2b')](saveUpdates(_0x2f86de[_0x931b('0x4d')],null))[_0x931b('0x2b')](respondWithResult(_0x4311e6,null))[_0x931b('0x23')](handleError(_0x4311e6,null));};exports[_0x931b('0x68')]=function(_0x513f61,_0x3b3759,_0x33a6b2){_0x513f61[_0x931b('0x4d')]['agentAvatar']=_0x513f61[_0x931b('0x67')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x513f61['params']['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x3b3759,null))[_0x931b('0x2b')](saveUpdates(_0x513f61[_0x931b('0x4d')],null))[_0x931b('0x2b')](respondWithResult(_0x3b3759,null))[_0x931b('0x23')](handleError(_0x3b3759,null));};exports[_0x931b('0x69')]=function(_0x3ad480,_0x468805,_0x2813ee){_0x3ad480['body'][_0x931b('0x6a')]=_0x3ad480[_0x931b('0x67')][_0x931b('0x6b')];return db[_0x931b('0x47')]['find']({'where':{'id':_0x3ad480[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x468805,null))[_0x931b('0x2b')](saveUpdates(_0x3ad480[_0x931b('0x4d')],null))[_0x931b('0x2b')](respondWithResult(_0x468805,null))['catch'](handleError(_0x468805,null));};exports['addSystemAvatar']=function(_0x5a8624,_0x27066a,_0x378db1){_0x5a8624['body'][_0x931b('0x6c')]=_0x5a8624['file'][_0x931b('0x6b')];return db[_0x931b('0x47')][_0x931b('0x4b')]({'where':{'id':_0x5a8624[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x27066a,null))['then'](saveUpdates(_0x5a8624['body'],null))[_0x931b('0x2b')](respondWithResult(_0x27066a,null))[_0x931b('0x23')](handleError(_0x27066a,null));};exports[_0x931b('0x6d')]=function(_0x399581,_0x4da24d,_0x477b47){var _0x350b83=path[_0x931b('0x6e')](config[_0x931b('0x6f')],_0x931b('0x70'));var _0x146cb4={'where':{'id':_0x399581['params']['id']},'attributes':['id',_0x931b('0x71')],'raw':!![]};var _0x71e038=![];return require(_0x931b('0x72'))['getLicense']()[_0x931b('0x2b')](function(_0x4a5176){if(_0x4a5176){_0x71e038=_0x4a5176[_0x931b('0x73')];}})['then'](function(){return db[_0x931b('0x47')]['find'](_0x146cb4);})['then'](handleEntityNotFound(_0x4da24d,null))[_0x931b('0x2b')](function(_0x2017a8){if(_0x2017a8){if(!_[_0x931b('0x74')](_0x2017a8[_0x931b('0x71')])){if(fs['existsSync'](path['join'](config[_0x931b('0x6f')],_0x931b('0x75'),_0x2017a8[_0x931b('0x71')]))&&_0x71e038){_0x350b83=path['join'](config[_0x931b('0x6f')],_0x931b('0x75'),_0x2017a8[_0x931b('0x71')]);}}return _0x4da24d[_0x931b('0x76')](_0x350b83);}})[_0x931b('0x23')](handleError(_0x4da24d,null));};exports[_0x931b('0x77')]=function(_0x16fcaf,_0x559bb6,_0x5c0ceb){var _0x4d0194=path['join'](config[_0x931b('0x6f')],_0x931b('0x78'));var _0x600b60={'where':{'id':_0x16fcaf['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x931b('0x47')]['find'](_0x600b60)[_0x931b('0x2b')](handleEntityNotFound(_0x559bb6,null))[_0x931b('0x2b')](function(_0x15e124){if(_0x15e124){if(!_['isNil'](_0x15e124[_0x931b('0x79')])){if(fs['existsSync'](path['join'](config[_0x931b('0x6f')],_0x931b('0x7a'),_0x15e124[_0x931b('0x79')]))){_0x4d0194=path['join'](config[_0x931b('0x6f')],_0x931b('0x7a'),_0x15e124[_0x931b('0x79')]);}}return _0x559bb6[_0x931b('0x76')](_0x4d0194);}})[_0x931b('0x23')](handleError(_0x559bb6,null));};exports['getCustomerAvatar']=function(_0x1f4810,_0x18f3c0,_0x3d1dbb){var _0x587090=path[_0x931b('0x6e')](config[_0x931b('0x6f')],_0x931b('0x7b'));var _0x2e142f={'where':{'id':_0x1f4810[_0x931b('0x56')]['id']},'attributes':['id',_0x931b('0x6a'),'showCustomerAvatar'],'raw':!![]};return db[_0x931b('0x47')]['find'](_0x2e142f)['then'](handleEntityNotFound(_0x18f3c0,null))['then'](function(_0x42d68d){if(_0x42d68d){if(!_[_0x931b('0x74')](_0x42d68d[_0x931b('0x6a')])){if(fs[_0x931b('0x7c')](path[_0x931b('0x6e')](config[_0x931b('0x6f')],_0x931b('0x7a'),_0x42d68d[_0x931b('0x6a')]))&&_0x42d68d['showCustomerAvatar']){_0x587090=path[_0x931b('0x6e')](config[_0x931b('0x6f')],_0x931b('0x7a'),_0x42d68d['customerAvatar']);}}return _0x18f3c0[_0x931b('0x76')](_0x587090);}})[_0x931b('0x23')](handleError(_0x18f3c0,null));};exports[_0x931b('0x7d')]=function(_0x329d71,_0x140fab,_0x52d025){var _0x491099=path[_0x931b('0x6e')](config['root'],_0x931b('0x7e'));var _0x52ad4d={'where':{'id':_0x329d71[_0x931b('0x56')]['id']},'attributes':['id',_0x931b('0x6c')],'raw':!![]};return db['ChatWebsite'][_0x931b('0x4b')](_0x52ad4d)[_0x931b('0x2b')](handleEntityNotFound(_0x140fab,null))[_0x931b('0x2b')](function(_0x5cfc3a){if(_0x5cfc3a){if(!_[_0x931b('0x74')](_0x5cfc3a['systemAvatar'])){if(fs[_0x931b('0x7c')](path['join'](config[_0x931b('0x6f')],'server/files/images/avatars/',_0x5cfc3a[_0x931b('0x6c')]))){_0x491099=path[_0x931b('0x6e')](config[_0x931b('0x6f')],'server/files/images/avatars/',_0x5cfc3a[_0x931b('0x6c')]);}}return _0x140fab[_0x931b('0x76')](_0x491099);}})['catch'](handleError(_0x140fab,null));};exports[_0x931b('0x7f')]=function(_0x47f0b1,_0xe70c0c,_0x3a0f44){var _0x30aee3=require('user-agent-parser');var _0x3fc818=new _0x30aee3();var _0x595087=_0x3fc818[_0x931b('0x80')](_0x47f0b1['headers'][_0x931b('0x81')])[_0x931b('0x82')]();var _0x53e67e={'body':_0x47f0b1[_0x931b('0x4d')],'channel':_0x931b('0x83')};var _0x42e5d1=[];var _0x27b7f7=[];var _0x187d69={};var _0x39e8f7=![];return db[_0x931b('0x84')]['describe']()['then'](function(_0x25a5bb){if(!_0x25a5bb){throw new db[(_0x931b('0x85'))]['ValidationError'](_0x931b('0x86'));}_0x42e5d1=_['difference'](_[_0x931b('0x37')](_0x25a5bb),[_0x931b('0x87'),'updatedAt']);_0x27b7f7=_['difference'](_[_0x931b('0x37')](_0x25a5bb),[_0x931b('0x87'),_0x931b('0x88'),_0x931b('0x89'),_0x931b('0x8a')]);if(_0x47f0b1['body']['id']){delete _0x47f0b1[_0x931b('0x4d')]['id'];}if(_[_0x931b('0x74')](_0x47f0b1[_0x931b('0x4d')]['from'])){throw new db[(_0x931b('0x85'))][(_0x931b('0x8b'))](_0x931b('0x8c'));}if(_['isNil'](_0x47f0b1[_0x931b('0x4d')][_0x931b('0x4d')])||_0x47f0b1[_0x931b('0x4d')][_0x931b('0x4d')]===''){throw new db[(_0x931b('0x85'))]['ValidationError'](_0x931b('0x8d'));}if(_[_0x931b('0x74')](_0x47f0b1[_0x931b('0x4d')][_0x931b('0x8e')])){throw new db[(_0x931b('0x85'))][(_0x931b('0x8b'))](_0x931b('0x8f')+_0x27b7f7);}if(!_[_0x931b('0x90')](_0x27b7f7,_0x47f0b1['body'][_0x931b('0x8e')])){throw new db[(_0x931b('0x85'))]['ValidationError'](_0x931b('0x91')+_0x27b7f7);}_0x187d69[_0x47f0b1[_0x931b('0x4d')][_0x931b('0x8e')]]=_0x47f0b1[_0x931b('0x4d')]['from'];})[_0x931b('0x2b')](function(){return db[_0x931b('0x47')]['find']({'where':{'id':_0x47f0b1[_0x931b('0x56')]['id']},'include':[{'model':db[_0x931b('0x92')],'as':_0x931b('0x93'),'include':[{'model':db[_0x931b('0x84')],'as':_0x931b('0x94'),'where':_0x187d69,'limit':0x1,'order':[[_0x931b('0x88'),'DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x931b('0x2b')](handleEntityNotFound(_0xe70c0c,null))['then'](function(_0x203448){if(_0x203448&&_0x203448[_0x931b('0x93')]){_0x53e67e[_0x931b('0x95')]=_0x203448;_0x53e67e[_0x931b('0x96')]=_0x203448['Applications'];_0x53e67e[_0x931b('0x97')]=_0x203448[_0x931b('0x93')];_0x53e67e[_0x931b('0x96')]=_[_0x931b('0x98')](_0x53e67e[_0x931b('0x96')],[_0x931b('0x99')],[_0x931b('0x9a')]);if(_0x53e67e[_0x931b('0x95')]['Applications']){delete _0x53e67e['account']['Applications'];}if(_0x53e67e['account'][_0x931b('0x93')]&&_0x53e67e[_0x931b('0x95')]['List']['Contacts'][_0x931b('0x5c')]){return _0x53e67e[_0x931b('0x95')][_0x931b('0x93')][_0x931b('0x94')][0x0];}var _0x5ca339=_[_0x931b('0x9b')](_0x47f0b1[_0x931b('0x4d')],{'firstName':_0x47f0b1['body']['from'],'ListId':_0x203448[_0x931b('0x8a')]});_0x5ca339[_0x47f0b1['body'][_0x931b('0x8e')]]=_0x47f0b1[_0x931b('0x4d')]['from'];return db[_0x931b('0x84')]['create'](_0x5ca339,{'fields':_0x42e5d1,'raw':!![]});}})[_0x931b('0x2b')](handleEntityNotFound(_0xe70c0c,null))['then'](function(_0x2defb2){_0x53e67e['contact']=_0x2defb2;var _0x1e33a6=_0x47f0b1[_0x931b('0x4d')][_0x931b('0x9c')];if(_0x47f0b1['headers'][_0x931b('0x9d')]){_0x1e33a6=_0x47f0b1['headers']['cf-connecting-ip'];}else if(_0x47f0b1[_0x931b('0x9e')][_0x931b('0x9f')]){_0x1e33a6=_['first'](_0x47f0b1[_0x931b('0x9e')][_0x931b('0x9f')]['split'](','));}if(_0x2defb2){var _0x124910={'ContactId':_0x2defb2['id'],'ChatWebsiteId':_0x47f0b1['params']['id'],'from':(_0x2defb2[_0x931b('0xa0')]||'')+'\x20'+(_0x2defb2['lastName']||''),'customerIp':_0x1e33a6,'customerPort':_0x47f0b1['headers'][_0x931b('0xa1')]?_0x47f0b1[_0x931b('0x9e')][_0x931b('0xa1')]:null,'referer':_0x47f0b1[_0x931b('0x4d')][_0x931b('0xa2')],'browserName':_0x595087[_0x931b('0xa3')][_0x931b('0x54')]&&_0x595087[_0x931b('0xa3')][_0x931b('0xa4')]?util[_0x931b('0xa5')]('%s\x20%s',_0x595087[_0x931b('0xa3')][_0x931b('0x54')],_0x595087[_0x931b('0xa3')][_0x931b('0xa4')]):_0x931b('0xa6'),'browserVersion':_0x595087[_0x931b('0xa3')][_0x931b('0xa4')]||_0x931b('0xa6'),'osName':util['format'](_0x931b('0xa7'),_0x595087['os']['name'],_0x595087['os'][_0x931b('0xa4')]),'osVersion':_0x595087['os'][_0x931b('0xa4')],'deviceModel':_0x595087['device'][_0x931b('0x35')]&&_0x595087[_0x931b('0xa8')]['vendor']?util[_0x931b('0xa5')](_0x931b('0xa9'),_0x595087[_0x931b('0xa8')][_0x931b('0x35')],_0x595087[_0x931b('0xa8')][_0x931b('0xaa')],_0x595087[_0x931b('0xa8')][_0x931b('0x33')]):null,'deviceVendor':_0x595087[_0x931b('0xa8')]['vendor'],'deviceType':_0x595087['device'][_0x931b('0x33')],'formData':JSON['stringify'](_0x47f0b1[_0x931b('0x4d')])};var _0x4ba4d2={'ChatWebsiteId':_0x47f0b1[_0x931b('0x56')]['id'],'closed':![]};if(_0x47f0b1['body']['threadId']){_0x4ba4d2['threadId']=_0x47f0b1[_0x931b('0x4d')][_0x931b('0xab')];return db[_0x931b('0xac')]['find']({'where':_0x4ba4d2})[_0x931b('0x2b')](function(_0x2d2fb2){if(_0x2d2fb2){return[_0x2d2fb2,![]];}_0x124910[_0x931b('0xab')]=_0x47f0b1[_0x931b('0x4d')][_0x931b('0xab')];_0x124910[_0x931b('0xad')]=_0x47f0b1[_0x931b('0x4d')][_0x931b('0xad')];return db[_0x931b('0xac')][_0x931b('0x4c')](_0x124910)[_0x931b('0x2b')](function(_0x407a9e){return[_0x407a9e,!![]];});});}_0x4ba4d2['ContactId']=_0x2defb2['id'];if(_0x47f0b1[_0x931b('0x4d')][_0x931b('0xae')]&&_0x47f0b1[_0x931b('0x4d')]['interaction']['id']){_0x4ba4d2['id']=_0x47f0b1[_0x931b('0x4d')]['interaction']['id'];return db[_0x931b('0xac')]['find']({'where':_0x4ba4d2})['then'](function(_0x2f5250){if(_0x2f5250){return[_0x2f5250,![]];}return db[_0x931b('0xac')][_0x931b('0x4c')](_0x124910)[_0x931b('0x2b')](function(_0xd8a15){return[_0xd8a15,!![]];});});}return db[_0x931b('0xac')][_0x931b('0x4c')](_0x124910)[_0x931b('0x2b')](function(_0x55e1ed){return[_0x55e1ed,!![]];});}})[_0x931b('0xaf')](function(_0x1c7a1f,_0xa0b76d){if(_0x1c7a1f){_0x39e8f7=_0xa0b76d;if(!_0xa0b76d){var _0x40688f={'from':(_0x53e67e[_0x931b('0xb0')][_0x931b('0xa0')]||'')+'\x20'+(_0x53e67e['contact'][_0x931b('0xb1')]||'')};if(_0x47f0b1[_0x931b('0x4d')][_0x931b('0xab')]&&_0x47f0b1['body']['messageId']&&_0x47f0b1[_0x931b('0x4d')]['threadId']!=_0x47f0b1[_0x931b('0x4d')][_0x931b('0xb2')]){_0x40688f[_0x931b('0xab')]=_0x47f0b1['body'][_0x931b('0xb2')];}return _0x1c7a1f[_0x931b('0x55')](_0x40688f);}else{return _0x1c7a1f;}}})[_0x931b('0x2b')](function(_0x525013){_0x53e67e[_0x931b('0xae')]=_0x525013[_0x931b('0x4f')]({'plain':!![]});_0x53e67e['interaction'][_0x931b('0xb3')]=_0x39e8f7;if(_0x53e67e[_0x931b('0xae')][_0x931b('0xb3')]){if(_0x53e67e['account']['autoclose']){_0x53e67e['applications']['push']({'id':0x0,'priority':_0x53e67e['applications'][_0x931b('0x5c')]+0x1,'app':_0x931b('0xb4'),'appdata':_0x931b('0xb5'),'interval':_0x931b('0xb6')});}}return db[_0x931b('0xb7')][_0x931b('0x4c')]({'body':_0x47f0b1[_0x931b('0x4d')][_0x931b('0x4d')],'ChatWebsiteId':_0x47f0b1[_0x931b('0x56')]['id'],'ChatInteractionId':_0x525013['id'],'direction':'in','ContactId':_0x53e67e[_0x931b('0xb0')]['id'],'AttachmentId':_0x47f0b1[_0x931b('0x4d')][_0x931b('0xb8')]});})[_0x931b('0x2b')](function(_0x222b67){_0x53e67e[_0x931b('0x20')]=_0x222b67;if(_0x53e67e[_0x931b('0xae')][_0x931b('0xb9')]){return db[_0x931b('0xba')][_0x931b('0x4b')]({'attributes':['id',_0x931b('0x54')],'where':{'id':_0x53e67e[_0x931b('0xae')]['UserId']}})[_0x931b('0x2b')](function(_0x156c13){if(_0x156c13){_0x53e67e[_0x931b('0x96')][_0x931b('0xbb')]({'id':0x0,'priority':0x0,'app':_0x931b('0xbc'),'appdata':_0x156c13[_0x931b('0x54')]+','+(_0x53e67e[_0x931b('0x95')][_0x931b('0xbd')]||0xa),'interval':_0x931b('0xb6')});_0x53e67e['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x931b('0xbe'),_0x53e67e);});}return respondWithRpcPromise(_0x931b('0xbf'),'startRouting',_0x53e67e);})[_0x931b('0x2b')](function(_0xb8ea6a){respondWithRpcPromise(_0x931b('0xc0'),_0x931b('0xc0'),{'event':'notify','message':_0xb8ea6a},client9002);return _0xb8ea6a;})[_0x931b('0x2b')](respondWithResult(_0xe70c0c,null))[_0x931b('0x23')](handleError(_0xe70c0c,null));};exports[_0x931b('0xc1')]=function(_0x8778d3,_0x40ac96,_0x591e18){var _0x820794,_0x5d6306,_0xa3390;var _0x57f105=[];var _0x527b15=[];var _0x134ba0={};return db[_0x931b('0x84')][_0x931b('0x57')]()['then'](function(_0x5e0b32){if(!_0x5e0b32){throw new db['Sequelize'][(_0x931b('0x8b'))]('no\x20available\x20attributes');}_0x527b15=_[_0x931b('0xc2')](_[_0x931b('0x37')](_0x5e0b32),[_0x931b('0x87'),_0x931b('0x88')]);_0x57f105=_[_0x931b('0xc2')](_[_0x931b('0x37')](_0x5e0b32),[_0x931b('0x87'),_0x931b('0x88'),_0x931b('0x89'),_0x931b('0x8a')]);if(_0x8778d3[_0x931b('0x4d')]['id']){delete _0x8778d3[_0x931b('0x4d')]['id'];}if(_[_0x931b('0x74')](_0x8778d3['body']['from'])){throw _0x40ac96[_0x931b('0x24')](0x1f4)['send'](new db['Sequelize'][(_0x931b('0x8b'))](_0x931b('0x8c')));}if(_['isNil'](_0x8778d3[_0x931b('0x4d')][_0x931b('0x4d')])||_0x8778d3[_0x931b('0x4d')][_0x931b('0x4d')]===''){throw _0x40ac96[_0x931b('0x24')](0x1f4)['send'](new db[(_0x931b('0x85'))][(_0x931b('0x8b'))](_0x931b('0x8d')));}if(_[_0x931b('0x74')](_0x8778d3[_0x931b('0x4d')][_0x931b('0xc3')])){throw _0x40ac96[_0x931b('0x24')](0x1f4)[_0x931b('0xc4')](new db[(_0x931b('0x85'))][(_0x931b('0x8b'))](_0x931b('0xc5')+_0x57f105));}if(!_['includes'](_0x57f105,_0x8778d3['body'][_0x931b('0xc3')])){throw _0x40ac96['status'](0x1f4)[_0x931b('0xc4')](new db[(_0x931b('0x85'))]['ValidationError'](_0x931b('0xc6')+_0x57f105));}_0x134ba0[_0x8778d3[_0x931b('0x4d')][_0x931b('0xc3')]]=_0x8778d3[_0x931b('0x4d')]['from'];})[_0x931b('0x2b')](function(){return db[_0x931b('0x47')][_0x931b('0x4b')]({'where':{'id':_0x8778d3[_0x931b('0x56')]['id']},'include':[{'model':db[_0x931b('0x92')],'as':'List'}]});})['then'](handleEntityNotFound(_0x40ac96,null))[_0x931b('0x2b')](function(_0x347867){if(_0x347867&&_0x347867[_0x931b('0x93')]){_0x5d6306=_0x347867;var _0x1d945b=_[_0x931b('0x9b')](_0x8778d3['body'],{'firstName':_0x8778d3[_0x931b('0x4d')][_0x931b('0xc7')],'phone':_0x8778d3[_0x931b('0x4d')][_0x931b('0xc7')],'ListId':_0x347867[_0x931b('0x8a')]});_0x1d945b[_0x8778d3['body'][_0x931b('0xc3')]]=_0x8778d3['body'][_0x931b('0xc7')];return db['CmContact'][_0x931b('0xc8')]({'where':_0x134ba0,'defaults':_0x1d945b});}})[_0x931b('0xaf')](function(_0x124e28){if(_0x124e28){_0xa3390=_0x124e28;var _0xcc0754=fs[_0x931b('0xc9')](path[_0x931b('0x6e')](config[_0x931b('0x6f')],_0x931b('0xca')),_0x931b('0xcb'));var _0x1324f0=ejs[_0x931b('0xcc')](_0xcc0754,{'body':_[_0x931b('0xcd')](_0x8778d3['body'][_0x931b('0x4d')]),'bodyTitle':_0x5d6306['offlineMessageBody']});return db[_0x931b('0xce')][_0x931b('0x4c')]({'body':_0x1324f0,'ContactId':_0x124e28['id'],'ChatWebsiteId':_0x5d6306['id']});}})['then'](function(_0x5e43b8){if(_0x5e43b8){_0x820794=_0x5e43b8;return db[_0x931b('0xcf')][_0x931b('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0x931b('0xd0')],'as':_0x931b('0xd1'),'raw':!![]}]});}})[_0x931b('0x2b')](function(_0x20540b){if(_0x20540b&&_0x20540b[_0x931b('0xd1')]&&_0x5d6306[_0x931b('0xd2')]){var _0x2bd277={'tls':{'rejectUnauthorized':![]}};if(_0x20540b[_0x931b('0xd1')]['service']){_0x2bd277[_0x931b('0xd3')]=_0x20540b[_0x931b('0xd1')][_0x931b('0xd3')];}else{_0x2bd277[_0x931b('0xd4')]=_0x20540b[_0x931b('0xd1')]['host'];_0x2bd277[_0x931b('0xd5')]=_0x20540b['Smtp']['port'];_0x2bd277[_0x931b('0xd6')]=_0x20540b[_0x931b('0xd1')][_0x931b('0xd6')];}if(_0x20540b[_0x931b('0xd1')]['authentication']){_0x2bd277[_0x931b('0xd7')]={'user':_0x20540b['Smtp']['user'],'pass':_0x20540b[_0x931b('0xd1')][_0x931b('0xd8')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x2bd277,'message':{'from':util[_0x931b('0xa5')]('\x22%s\x22\x20<%s>',_0x20540b[_0x931b('0x54')],_0x20540b[_0x931b('0xd9')]||_0x20540b[_0x931b('0xd1')][_0x931b('0x4e')]),'to':_0x5d6306['forwardOfflineAddress'],'subject':_0x5d6306['offlineMessageSubject'],'text':_0x820794[_0x931b('0x4d')]}},client9003)[_0x931b('0x2b')](function(){return _0x820794;})[_0x931b('0x23')](function(_0x7b07d2){console[_0x931b('0x21')](_0x7b07d2);});}})[_0x931b('0x2b')](function(){if(_0x820794){return _0x820794;}})[_0x931b('0x2b')](respondWithResult(_0x40ac96,null))[_0x931b('0x23')](handleError(_0x40ac96,null));};exports[_0x931b('0xda')]=function(_0x59ef58,_0x3cc7f2,_0x3e99f8){return db['ChatInteraction']['find']({'where':{'id':_0x59ef58['params']['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x3cc7f2,null))[_0x931b('0x2b')](function(_0x338a98){if(_0x338a98){return _0x338a98[_0x931b('0xda')](_0x59ef58[_0x931b('0x4d')]['ids'],_[_0x931b('0xdb')](_0x59ef58[_0x931b('0x4d')],['ids','id'])||{});}})[_0x931b('0x2b')](respondWithResult(_0x3cc7f2,null))[_0x931b('0x23')](handleError(_0x3cc7f2,null));};exports['getInteractions']=function(_0x21f3fa,_0x12b3c3,_0x55615f){var _0x443a2a={'raw':![],'where':{}};var _0x12fdbc={};var _0x432017={'count':0x0,'rows':[]};return db[_0x931b('0x47')][_0x931b('0x5b')]({'where':{'id':_0x21f3fa[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x12b3c3,null))[_0x931b('0x2b')](function(_0x311f0b){if(_0x311f0b){_0x12fdbc[_0x931b('0x35')]=_['keys'](db[_0x931b('0xac')][_0x931b('0x32')]);_0x12fdbc[_0x931b('0x36')]=_[_0x931b('0x37')](_0x21f3fa[_0x931b('0x36')]);_0x12fdbc[_0x931b('0x38')]=_[_0x931b('0x39')](_0x12fdbc[_0x931b('0x35')],_0x12fdbc[_0x931b('0x36')]);_0x443a2a[_0x931b('0x3a')]=_[_0x931b('0x39')](_0x12fdbc['model'],qs[_0x931b('0x3b')](_0x21f3fa[_0x931b('0x36')][_0x931b('0x3b')]));_0x443a2a[_0x931b('0x3a')]=_0x443a2a[_0x931b('0x3a')][_0x931b('0x5c')]?_0x443a2a[_0x931b('0x3a')]:_0x12fdbc[_0x931b('0x35')];if(!_0x21f3fa['query'][_0x931b('0x3c')](_0x931b('0x5d'))){_0x443a2a[_0x931b('0x28')]=qs['limit'](_0x21f3fa[_0x931b('0x36')][_0x931b('0x28')]);_0x443a2a[_0x931b('0x27')]=qs[_0x931b('0x27')](_0x21f3fa[_0x931b('0x36')][_0x931b('0x27')]);}_0x443a2a[_0x931b('0x3d')]=qs[_0x931b('0x3e')](_0x21f3fa[_0x931b('0x36')][_0x931b('0x3e')]);_0x443a2a[_0x931b('0x41')]=qs['filters'](_[_0x931b('0x3f')](_0x21f3fa[_0x931b('0x36')],_0x12fdbc[_0x931b('0x38')]));_0x443a2a[_0x931b('0x41')]['ChatWebsiteId']=_0x311f0b['id'];if(_0x21f3fa[_0x931b('0x36')][_0x931b('0x5f')]){_0x443a2a[_0x931b('0x41')]=_[_0x931b('0x40')](_0x443a2a[_0x931b('0x41')],{'$or':_[_0x931b('0x31')](_0x443a2a[_0x931b('0x3a')],function(_0x12dc55){var _0x301d0f={};_0x301d0f[_0x12dc55]={'$like':'%'+_0x21f3fa['query']['filter']+'%'};return _0x301d0f;})});}_0x443a2a=_['merge']({},_0x443a2a,_0x21f3fa[_0x931b('0x43')]);return db[_0x931b('0xac')][_0x931b('0x44')]({'where':_0x443a2a[_0x931b('0x41')]})[_0x931b('0x2b')](function(_0x462fbc){_0x432017[_0x931b('0x44')]=_0x462fbc;if(_0x21f3fa[_0x931b('0x36')][_0x931b('0x45')]){_0x443a2a[_0x931b('0x46')]=[{'model':db[_0x931b('0x84')],'as':_0x931b('0xdc'),'required':![]},{'model':db[_0x931b('0xba')],'as':_0x931b('0xdd'),'attributes':[_0x931b('0x54'),'fullname',_0x931b('0xde')],'required':![]},{'model':db[_0x931b('0xdf')],'as':_0x931b('0xe0'),'attributes':['id',_0x931b('0x54'),_0x931b('0xe1')],'where':_0x21f3fa['query']['tag']?{'id':_0x21f3fa[_0x931b('0x36')]['tag']}:undefined,'required':_0x21f3fa['query'][_0x931b('0xe2')]?!![]:![]}];}return db[_0x931b('0xac')][_0x931b('0x60')](_0x443a2a);})[_0x931b('0x2b')](function(_0x4b3932){_0x432017['rows']=_0x4b3932;return _0x432017;});}})[_0x931b('0x2b')](respondWithFilteredResult(_0x12b3c3,_0x443a2a))[_0x931b('0x23')](handleError(_0x12b3c3,null));};function iftimePromise(_0x283b65,_0x468433){return respondWithRpcPromise(_0x931b('0xe3'),_0x931b('0xe4'),{'command':_0x468433[_0x931b('0xe5')]?util[_0x931b('0xa5')](_0x931b('0xe6'),_0x283b65[_0x931b('0xe7')],_0x468433[_0x931b('0xe5')]):util[_0x931b('0xa5')]('iftime\x20%s',_0x283b65[_0x931b('0xe7')])},client9002)['then'](function(_0x4a10e0){var _0x3bbb47=_0x4a10e0&&_0x4a10e0[_0x931b('0xe8')]('true')>=0x0?!![]:![];logger['info'](_0x931b('0xe9'),_0x468433['id'],_0x283b65['id'],_0x283b65['interval'],_0x3bbb47?'ONLINE':_0x931b('0xea'),_0x468433[_0x931b('0xe5')]?_0x468433[_0x931b('0xe5')]:_0x931b('0xeb'));return _0x3bbb47;})[_0x931b('0x23')](function(_0x328868){logger[_0x931b('0x21')](_0x931b('0xe9'),_0x468433['id'],_0x283b65['id'],_0x283b65['interval'],util[_0x931b('0xec')](_0x328868,{'showHidden':![],'depth':null}),_0x468433[_0x931b('0xe5')]?_0x468433['timezone']:'No\x20timezone');return![];});}exports[_0x931b('0xe4')]=function(_0x2e664e,_0x25a35d,_0x463b47){var _0x4219f6=0x0;var _0x159144=0x0;var _0x44bc98=![];var _0x5a70c3;var _0xdeefc3;return db['ChatWebsite'][_0x931b('0x4b')]({'where':{'id':_0x2e664e[_0x931b('0x56')]['id']},'include':[{'model':db[_0x931b('0xed')],'as':_0x931b('0xed'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x931b('0xe7')],'raw':!![]}]}]})[_0x931b('0x2b')](handleEntityNotFound(_0x25a35d,null))['then'](function(_0x200bb2){if(_0x200bb2){_0x5a70c3=_0x200bb2;return _0x200bb2['getProactiveActions']({'raw':!![]});}})[_0x931b('0x2b')](function(_0x1d0788){if(_0x5a70c3){if(_0x1d0788){_0xdeefc3=_0x1d0788;}}return require(_0x931b('0x72'))[_0x931b('0xee')]();})[_0x931b('0x2b')](function(_0x53f182){if(_0x53f182){_0x159144=_0x53f182[_0x931b('0xef')];_0x44bc98=_0x53f182['custom'];}})[_0x931b('0x2b')](function(){return db[_0x931b('0xac')][_0x931b('0x44')]({'where':{'closed':![]}});})['then'](function(_0x3ca19f){_0x4219f6=_0x3ca19f;if(_0x159144&&_0x3ca19f>_0x159144){return db[_0x931b('0xf0')][_0x931b('0x5b')]({'where':{'id':0x1}})[_0x931b('0x2b')](function(_0x2dfcac){if(_0x2dfcac){_0x2dfcac[_0x931b('0xf1')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x5a70c3['Interval']&&_0x5a70c3[_0x931b('0xed')][_0x931b('0xf2')]){var _0x34adf0=[];for(var _0x529598=0x0;_0x529598<_0x5a70c3[_0x931b('0xed')][_0x931b('0xf2')][_0x931b('0x5c')];_0x529598++){var _0x3c409b=_0x5a70c3['Interval'][_0x931b('0xf2')][_0x529598]['get']({'plain':!![]});_0x34adf0[_0x931b('0xf3')](iftimePromise(_0x3c409b,_0x5a70c3));}return BPromise[_0x931b('0xf4')](_0x34adf0)[_0x931b('0x2b')](function(_0xf5df37){return _[_0x931b('0xf5')](_0xf5df37);});}else{return!![];}})[_0x931b('0x2b')](function(_0x32a824){var _0x3f0f76=fs[_0x931b('0xc9')](path[_0x931b('0x6e')](config[_0x931b('0x6f')],_0x931b('0xf6')),_0x931b('0xcb'));var _0x1b1853={'remote':_0x5a70c3[_0x931b('0xf7')],'query':querystring[_0x931b('0x1f')](_[_0x931b('0x40')](_0x5a70c3[_0x931b('0x4f')]({'plain':!![]}),{'customerIp':_0x2e664e[_0x931b('0x9e')][_0x931b('0x9f')]||_0x2e664e[_0x931b('0x9e')]['x-real-ip']||_0x2e664e[_0x931b('0xf8')][_0x931b('0xf9')]||_0x2e664e['ip'],'referer':_0x2e664e[_0x931b('0x9e')][_0x931b('0xa2')],'openedInteractions':_0x4219f6,'maxInteractions':_0x159144,'virtual':_0x44bc98[_0x931b('0xef')],'online':_0x32a824,'custom':_0x44bc98}))[_0x931b('0xfa')](/'/g,'\x5c\x27')};_0x25a35d[_0x931b('0xc4')](ejs[_0x931b('0xcc')](Mustache[_0x931b('0xcc')](_0x3f0f76,_0x1b1853),{'proactiveActions':_0xdeefc3,'alignment':_0x5a70c3['alignment'],'verticalAlignment':_0x5a70c3[_0x931b('0xfb')],'div_color':_0x5a70c3[_0x931b('0xe1')],'text_color':_0x5a70c3[_0x931b('0xfc')]}));})[_0x931b('0x23')](handleError(_0x25a35d,null));};exports[_0x931b('0xfd')]=function(_0x8872da,_0x22abc5,_0x3dbc75){return db[_0x931b('0x47')][_0x931b('0x5b')]({'where':{'id':_0x8872da['params']['id']}})['then'](handleEntityNotFound(_0x22abc5,null))[_0x931b('0x2b')](function(_0x48a1e3){if(_0x48a1e3){return db[_0x931b('0xfe')][_0x931b('0xff')](function(_0x425eb4){return db[_0x931b('0x100')][_0x931b('0x2a')]({'where':{'ChatWebsiteId':_0x8872da['params']['id']},'transaction':_0x425eb4})['then'](function(_0x1e79b4){var _0x25dc36=_[_0x931b('0x31')](_0x8872da['body'],function(_0x2cee17){_0x2cee17[_0x931b('0x5e')]=_0x8872da['params']['id'];return _0x2cee17;});return db['ChatApplication']['bulkCreate'](_0x25dc36,{'transaction':_0x425eb4});});})[_0x931b('0x2b')](function(){return db[_0x931b('0x100')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x8872da['params']['id']},'order':_0x931b('0x99')});});}})['then'](respondWithResult(_0x22abc5,null))[_0x931b('0x23')](handleError(_0x22abc5,null));};exports[_0x931b('0x101')]=function(_0x2c39d8,_0x1b6633,_0x812f81){var _0x2c3853={};var _0x5d7d66={};var _0x34ea59;var _0x2939ef;return db[_0x931b('0x47')][_0x931b('0x5b')]({'where':{'id':_0x2c39d8['params']['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x1b6633,null))[_0x931b('0x2b')](function(_0x5158f8){if(_0x5158f8){_0x34ea59=_0x5158f8;_0x5d7d66[_0x931b('0x35')]=_[_0x931b('0x37')](db[_0x931b('0x100')][_0x931b('0x32')]);_0x5d7d66['query']=_[_0x931b('0x37')](_0x2c39d8[_0x931b('0x36')]);_0x5d7d66[_0x931b('0x38')]=_['intersection'](_0x5d7d66[_0x931b('0x35')],_0x5d7d66['query']);_0x2c3853[_0x931b('0x3a')]=_['intersection'](_0x5d7d66['model'],qs['fields'](_0x2c39d8[_0x931b('0x36')]['fields']));_0x2c3853[_0x931b('0x3a')]=_0x2c3853['attributes']['length']?_0x2c3853[_0x931b('0x3a')]:_0x5d7d66[_0x931b('0x35')];_0x2c3853[_0x931b('0x3d')]=qs['sort'](_0x2c39d8[_0x931b('0x36')]['sort']);_0x2c3853[_0x931b('0x41')]=qs[_0x931b('0x38')](_[_0x931b('0x3f')](_0x2c39d8[_0x931b('0x36')],_0x5d7d66[_0x931b('0x38')]));if(_0x2c39d8[_0x931b('0x36')][_0x931b('0x5f')]){_0x2c3853[_0x931b('0x41')]=_[_0x931b('0x40')](_0x2c3853['where'],{'$or':_['map'](_0x2c3853['attributes'],function(_0x1b652d){var _0x3b443e={};_0x3b443e[_0x1b652d]={'$like':'%'+_0x2c39d8[_0x931b('0x36')]['filter']+'%'};return _0x3b443e;})});}_0x2c3853=_['merge']({},_0x2c3853,_0x2c39d8['options']);return _0x34ea59[_0x931b('0x101')](_0x2c3853);}})[_0x931b('0x2b')](function(_0x5d9508){if(_0x5d9508){_0x2939ef=_0x5d9508['length'];if(!_0x2c39d8['query'][_0x931b('0x3c')]('nolimit')){_0x2c3853[_0x931b('0x28')]=qs[_0x931b('0x28')](_0x2c39d8[_0x931b('0x36')][_0x931b('0x28')]);_0x2c3853[_0x931b('0x27')]=qs[_0x931b('0x27')](_0x2c39d8[_0x931b('0x36')][_0x931b('0x27')]);}return _0x34ea59[_0x931b('0x101')](_0x2c3853);}})[_0x931b('0x2b')](function(_0x265bba){if(_0x265bba){return _0x265bba?{'count':_0x2939ef,'rows':_0x265bba}:null;}})[_0x931b('0x2b')](respondWithResult(_0x1b6633,null))[_0x931b('0x23')](handleError(_0x1b6633,null));};exports[_0x931b('0x102')]=function(_0x5a6a04,_0x5d8f0b,_0x200285){return db['chatProactiveAction'][_0x931b('0x4b')]({'where':{'id':_0x5a6a04['params']['id']}})['then'](handleEntityNotFound(_0x5d8f0b,null))[_0x931b('0x2b')](function(_0x8e7579){if(_0x8e7579){return _0x8e7579[_0x931b('0x102')](_0x5a6a04[_0x931b('0x4d')][_0x931b('0x62')],_[_0x931b('0xdb')](_0x5a6a04[_0x931b('0x4d')],[_0x931b('0x62'),'id'])||{});}})['then'](respondWithResult(_0x5d8f0b,null))[_0x931b('0x23')](handleError(_0x5d8f0b,null));};exports[_0x931b('0x103')]=function(_0xc7363e,_0x5515ca,_0x2f2446){var _0x4c4bbb={};var _0x1801e6={};var _0x4c1a38;var _0x108304;return db['ChatWebsite']['findOne']({'where':{'id':_0xc7363e[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x5515ca,null))['then'](function(_0x309ff1){if(_0x309ff1){_0x4c1a38=_0x309ff1;_0x1801e6[_0x931b('0x35')]=_[_0x931b('0x37')](db[_0x931b('0x104')]['rawAttributes']);_0x1801e6[_0x931b('0x36')]=_[_0x931b('0x37')](_0xc7363e[_0x931b('0x36')]);_0x1801e6[_0x931b('0x38')]=_[_0x931b('0x39')](_0x1801e6[_0x931b('0x35')],_0x1801e6[_0x931b('0x36')]);_0x4c4bbb[_0x931b('0x3a')]=_[_0x931b('0x39')](_0x1801e6['model'],qs[_0x931b('0x3b')](_0xc7363e[_0x931b('0x36')][_0x931b('0x3b')]));_0x4c4bbb[_0x931b('0x3a')]=_0x4c4bbb[_0x931b('0x3a')][_0x931b('0x5c')]?_0x4c4bbb[_0x931b('0x3a')]:_0x1801e6[_0x931b('0x35')];_0x4c4bbb['order']=qs[_0x931b('0x3e')](_0xc7363e[_0x931b('0x36')][_0x931b('0x3e')]);_0x4c4bbb['where']=qs['filters'](_[_0x931b('0x3f')](_0xc7363e['query'],_0x1801e6[_0x931b('0x38')]));if(_0xc7363e[_0x931b('0x36')][_0x931b('0x5f')]){_0x4c4bbb[_0x931b('0x41')]=_[_0x931b('0x40')](_0x4c4bbb[_0x931b('0x41')],{'$or':_[_0x931b('0x31')](_0x4c4bbb[_0x931b('0x3a')],function(_0x3fa46f){var _0x2db167={};_0x2db167[_0x3fa46f]={'$like':'%'+_0xc7363e[_0x931b('0x36')][_0x931b('0x5f')]+'%'};return _0x2db167;})});}_0x4c4bbb=_[_0x931b('0x40')]({},_0x4c4bbb,_0xc7363e[_0x931b('0x43')]);return _0x4c1a38['getProactiveActions'](_0x4c4bbb);}})[_0x931b('0x2b')](function(_0x367747){if(_0x367747){_0x108304=_0x367747[_0x931b('0x5c')];if(!_0xc7363e[_0x931b('0x36')][_0x931b('0x3c')]('nolimit')){_0x4c4bbb['limit']=qs['limit'](_0xc7363e['query'][_0x931b('0x28')]);_0x4c4bbb[_0x931b('0x27')]=qs[_0x931b('0x27')](_0xc7363e['query'][_0x931b('0x27')]);}return _0x4c1a38[_0x931b('0x103')](_0x4c4bbb);}})[_0x931b('0x2b')](function(_0x154ab4){if(_0x154ab4){return _0x154ab4?{'count':_0x108304,'rows':_0x154ab4}:null;}})[_0x931b('0x2b')](respondWithResult(_0x5515ca,null))[_0x931b('0x23')](handleError(_0x5515ca,null));};exports[_0x931b('0x105')]=function(_0x2125cb,_0xf00f16,_0x371a50){var _0x1268e=_0x2125cb[_0x931b('0x36')]['online']===_0x931b('0x106')?_0x931b('0x107'):_0x931b('0x108');return db[_0x931b('0x47')]['find']({'attributes':['id',_0x1268e],'where':{'id':_0x2125cb[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0xf00f16,null))[_0x931b('0x2b')](function(_0x449469){if(_0x449469){var _0x42c9ac=_0x449469[_0x1268e];var _0x17c796=_0x42c9ac&&_0x42c9ac[_0x931b('0x109')]?_0x42c9ac[_0x931b('0x109')]:[];_0xf00f16[_0x931b('0xc4')]({'fromKey':_['isNil'](_0x42c9ac[_0x931b('0x10a')])?undefined:_0x42c9ac[_0x931b('0x10a')],'count':_0x17c796[_0x931b('0x5c')],'rows':_0x17c796});}})[_0x931b('0x23')](handleError(_0xf00f16,null));};exports['getOfflineMessages']=function(_0x4bf502,_0x318d87,_0x3d0dfa){var _0x12b911={'raw':![],'where':{}};var _0x5b088f={};var _0x49c45d={'count':0x0,'rows':[]};return db[_0x931b('0x47')][_0x931b('0x5b')]({'where':{'id':_0x4bf502['params']['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x318d87,null))[_0x931b('0x2b')](function(_0x52a84c){if(_0x52a84c){_0x5b088f['model']=_[_0x931b('0x37')](db['ChatOfflineMessage'][_0x931b('0x32')]);_0x5b088f[_0x931b('0x36')]=_[_0x931b('0x37')](_0x4bf502[_0x931b('0x36')]);_0x5b088f[_0x931b('0x38')]=_[_0x931b('0x39')](_0x5b088f['model'],_0x5b088f[_0x931b('0x36')]);_0x12b911['attributes']=_[_0x931b('0x39')](_0x5b088f[_0x931b('0x35')],qs[_0x931b('0x3b')](_0x4bf502[_0x931b('0x36')][_0x931b('0x3b')]));_0x12b911['attributes']=_0x12b911[_0x931b('0x3a')][_0x931b('0x5c')]?_0x12b911[_0x931b('0x3a')]:_0x5b088f[_0x931b('0x35')];if(!_0x4bf502[_0x931b('0x36')][_0x931b('0x3c')](_0x931b('0x5d'))){_0x12b911[_0x931b('0x28')]=qs[_0x931b('0x28')](_0x4bf502[_0x931b('0x36')][_0x931b('0x28')]);_0x12b911[_0x931b('0x27')]=qs['offset'](_0x4bf502[_0x931b('0x36')][_0x931b('0x27')]);}_0x12b911[_0x931b('0x3d')]=qs[_0x931b('0x3e')](_0x4bf502[_0x931b('0x36')][_0x931b('0x3e')]);_0x12b911[_0x931b('0x41')]=qs[_0x931b('0x38')](_[_0x931b('0x3f')](_0x4bf502[_0x931b('0x36')],_0x5b088f['filters']));_0x12b911['where']['ChatWebsiteId']=_0x52a84c['id'];if(_0x4bf502[_0x931b('0x36')][_0x931b('0x5f')]){_0x12b911[_0x931b('0x41')]=_[_0x931b('0x40')](_0x12b911[_0x931b('0x41')],{'$or':_['map'](_0x12b911[_0x931b('0x3a')],function(_0x18fad7){var _0x571c58={};_0x571c58[_0x18fad7]={'$like':'%'+_0x4bf502[_0x931b('0x36')][_0x931b('0x5f')]+'%'};return _0x571c58;})});}_0x12b911=_['merge']({},_0x12b911,_0x4bf502['options']);return db[_0x931b('0xce')][_0x931b('0x44')]({'where':_0x12b911[_0x931b('0x41')]})[_0x931b('0x2b')](function(_0x45b3f7){_0x49c45d[_0x931b('0x44')]=_0x45b3f7;if(_0x4bf502[_0x931b('0x36')][_0x931b('0x45')]){_0x12b911[_0x931b('0x46')]=[{'all':!![]}];}else{_0x12b911[_0x931b('0x46')]=[{'model':db[_0x931b('0x84')],'as':_0x931b('0xdc'),'required':![]}];}return db['ChatOfflineMessage'][_0x931b('0x60')](_0x12b911);})[_0x931b('0x2b')](function(_0x55d8f6){_0x49c45d[_0x931b('0x48')]=_0x55d8f6;return _0x49c45d;});}})[_0x931b('0x2b')](respondWithFilteredResult(_0x318d87,_0x12b911))[_0x931b('0x23')](handleError(_0x318d87,null));};exports[_0x931b('0x10b')]=function(_0x332da1,_0x8ce5c2,_0x328769){return db[_0x931b('0x47')][_0x931b('0x4b')]({'where':{'id':_0x332da1['params']['id']}})['then'](handleEntityNotFound(_0x8ce5c2,null))[_0x931b('0x2b')](function(_0x57aa69){if(_0x57aa69){return _0x57aa69[_0x931b('0x10b')](_0x332da1[_0x931b('0x4d')][_0x931b('0x62')],_[_0x931b('0xdb')](_0x332da1[_0x931b('0x4d')],['ids','id'])||{})[_0x931b('0xaf')](function(_0x17049a){for(var _0x16a195=0x0;_0x16a195<_0x332da1[_0x931b('0x4d')]['ids'][_0x931b('0x5c')];_0x16a195+=0x1){socket[_0x931b('0x10c')](_0x931b('0x10d'),{'UserId':_0x332da1[_0x931b('0x4d')][_0x931b('0x62')][_0x16a195],'ChatWebsiteId':_0x332da1['params']['id']});}return _0x17049a;});}})[_0x931b('0x2b')](respondWithResult(_0x8ce5c2,null))[_0x931b('0x23')](handleError(_0x8ce5c2,null));};exports['removeAgents']=function(_0x55e8a0,_0x5e1ae4,_0x3e93d7){return db['ChatWebsite'][_0x931b('0x4b')]({'where':{'id':_0x55e8a0[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x5e1ae4,null))[_0x931b('0x2b')](function(_0x58b305){if(_0x58b305){return _0x58b305[_0x931b('0x10e')](_0x55e8a0[_0x931b('0x36')][_0x931b('0x62')])[_0x931b('0x2b')](function(){if(_[_0x931b('0x10f')](_0x55e8a0[_0x931b('0x36')]['ids'])){for(var _0x186da3=0x0;_0x186da3<_0x55e8a0[_0x931b('0x36')]['ids'][_0x931b('0x5c')];_0x186da3+=0x1){socket['emit'](_0x931b('0x110'),{'UserId':Number(_0x55e8a0[_0x931b('0x36')][_0x931b('0x62')][_0x186da3]),'ChatWebsiteId':Number(_0x55e8a0[_0x931b('0x56')]['id'])});}}else{socket[_0x931b('0x10c')](_0x931b('0x110'),{'UserId':Number(_0x55e8a0[_0x931b('0x36')][_0x931b('0x62')]),'ChatWebsiteId':Number(_0x55e8a0['params']['id'])});}});}})[_0x931b('0x2b')](respondWithStatusCode(_0x5e1ae4,null))['catch'](handleError(_0x5e1ae4,null));};exports[_0x931b('0x111')]=function(_0x3c89c9,_0x3f4c64,_0x1ad7b8){var _0x5b5a46={};var _0x2fb624={};var _0x5217d8;var _0x5c2a19;return db['ChatWebsite']['findOne']({'where':{'id':_0x3c89c9[_0x931b('0x56')]['id']}})[_0x931b('0x2b')](handleEntityNotFound(_0x3f4c64,null))['then'](function(_0x149b52){if(_0x149b52){_0x5217d8=_0x149b52;_0x2fb624['model']=_[_0x931b('0x37')](db['User']['rawAttributes']);_0x2fb624[_0x931b('0x36')]=_[_0x931b('0x37')](_0x3c89c9['query']);_0x2fb624['filters']=_[_0x931b('0x39')](_0x2fb624[_0x931b('0x35')],_0x2fb624[_0x931b('0x36')]);_0x5b5a46[_0x931b('0x3a')]=_[_0x931b('0x39')](_0x2fb624[_0x931b('0x35')],qs[_0x931b('0x3b')](_0x3c89c9['query'][_0x931b('0x3b')]));_0x5b5a46[_0x931b('0x3a')]=_0x5b5a46[_0x931b('0x3a')][_0x931b('0x5c')]?_0x5b5a46[_0x931b('0x3a')]:_0x2fb624['model'];_0x5b5a46['order']=qs['sort'](_0x3c89c9[_0x931b('0x36')][_0x931b('0x3e')]);_0x5b5a46[_0x931b('0x41')]=qs['filters'](_[_0x931b('0x3f')](_0x3c89c9[_0x931b('0x36')],_0x2fb624[_0x931b('0x38')]));if(_0x3c89c9['query'][_0x931b('0x5f')]){_0x5b5a46[_0x931b('0x41')]=_[_0x931b('0x40')](_0x5b5a46[_0x931b('0x41')],{'$or':_[_0x931b('0x31')](_0x5b5a46[_0x931b('0x3a')],function(_0x54b626){var _0x3bd2e9={};_0x3bd2e9[_0x54b626]={'$like':'%'+_0x3c89c9['query'][_0x931b('0x5f')]+'%'};return _0x3bd2e9;})});}_0x5b5a46=_[_0x931b('0x40')]({},_0x5b5a46,_0x3c89c9[_0x931b('0x43')]);return _0x5217d8[_0x931b('0x111')](_0x5b5a46);}})[_0x931b('0x2b')](function(_0x97838b){if(_0x97838b){_0x5c2a19=_0x97838b[_0x931b('0x5c')];if(!_0x3c89c9[_0x931b('0x36')][_0x931b('0x3c')](_0x931b('0x5d'))){_0x5b5a46[_0x931b('0x28')]=qs['limit'](_0x3c89c9[_0x931b('0x36')][_0x931b('0x28')]);_0x5b5a46[_0x931b('0x27')]=qs['offset'](_0x3c89c9[_0x931b('0x36')]['offset']);}return _0x5217d8['getAgents'](_0x5b5a46);}})['then'](function(_0x500dda){if(_0x500dda){return _0x500dda?{'count':_0x5c2a19,'rows':_0x500dda}:null;}})[_0x931b('0x2b')](respondWithResult(_0x3f4c64,null))[_0x931b('0x23')](handleError(_0x3f4c64,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 1f220b8..dec3df9 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 _0x089f=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x1d1e34,_0x5123f8){var _0x508990=function(_0xb15553){while(--_0xb15553){_0x1d1e34['push'](_0x1d1e34['shift']());}};_0x508990(++_0x5123f8);}(_0x089f,0x1c7));var _0xf089=function(_0x25eb36,_0x35bff0){_0x25eb36=_0x25eb36-0x0;var _0x5ed3d9=_0x089f[_0x25eb36];return _0x5ed3d9;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xf089('0x0'))['db'][_0xf089('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf089('0x2')](0x0);var events={'afterCreate':_0xf089('0x3'),'afterUpdate':_0xf089('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b7602){return function(_0x3195ed,_0x250428,_0x5ea026){ChatWebsiteEvents[_0xf089('0x5')](_0x2b7602+':'+_0x3195ed['id'],_0x3195ed);ChatWebsiteEvents[_0xf089('0x5')](_0x2b7602,_0x3195ed);_0x5ea026(null);};}for(var e in events){if(events[_0xf089('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xf089('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe407=['exports','events','../../mysqldb','save','update','remove','emit','hook'];(function(_0x5de7e2,_0x3a09ea){var _0x359100=function(_0x1cd27e){while(--_0x1cd27e){_0x5de7e2['push'](_0x5de7e2['shift']());}};_0x359100(++_0x3a09ea);}(_0xe407,0x181));var _0x7e40=function(_0x14dff9,_0x3aa1ac){_0x14dff9=_0x14dff9-0x0;var _0x55bd43=_0xe407[_0x14dff9];return _0x55bd43;};'use strict';var EventEmitter=require(_0x7e40('0x0'));var ChatWebsite=require(_0x7e40('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7e40('0x2'),'afterUpdate':_0x7e40('0x3'),'afterDestroy':_0x7e40('0x4')};function emitEvent(_0xb885df){return function(_0x4d40e9,_0x1dfc2a,_0xc5fdaa){ChatWebsiteEvents['emit'](_0xb885df+':'+_0x4d40e9['id'],_0x4d40e9);ChatWebsiteEvents[_0x7e40('0x5')](_0xb885df,_0x4d40e9);_0xc5fdaa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x7e40('0x6')](e,emitEvent(event));}}module[_0x7e40('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 39a2c19..ca90029 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 _0x9b87=['define','ChatWebsite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0x9b87,0x8e));var _0x79b8=function(_0x53e924,_0x17c7d9){_0x53e924=_0x53e924-0x0;var _0x4e65a1=_0x9b87[_0x53e924];return _0x4e65a1;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var logger=require(_0x79b8('0x2'))(_0x79b8('0x3'));var moment=require(_0x79b8('0x4'));var BPromise=require(_0x79b8('0x5'));var rp=require(_0x79b8('0x6'));var fs=require('fs');var path=require(_0x79b8('0x7'));var rimraf=require(_0x79b8('0x8'));var config=require(_0x79b8('0x9'));var attributes=require(_0x79b8('0xa'));module[_0x79b8('0xb')]=function(_0x3ccc53,_0x2e21b9){return _0x3ccc53[_0x79b8('0xc')](_0x79b8('0xd'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1152=['moment','bluebird','request-promise','path','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x546a14,_0x30f479){var _0x21cc26=function(_0x1e42e6){while(--_0x1e42e6){_0x546a14['push'](_0x546a14['shift']());}};_0x21cc26(++_0x30f479);}(_0x1152,0x182));var _0x2115=function(_0x8fd7be,_0xcd1d8d){_0x8fd7be=_0x8fd7be-0x0;var _0xd527d7=_0x1152[_0x8fd7be];return _0xd527d7;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require(_0x2115('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x2115('0x9')]=function(_0x241dcb,_0x51a3cf){return _0x241dcb['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 5ff12f9..ab010ab 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 _0xf61e=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x339263,_0x1afc90){var _0x460930=function(_0xf92e8f){while(--_0xf92e8f){_0x339263['push'](_0x339263['shift']());}};_0x460930(++_0x1afc90);}(_0xf61e,0x191));var _0xef61=function(_0x5c3232,_0x17c445){_0x5c3232=_0x5c3232-0x0;var _0x3ec58c=_0xf61e[_0x5c3232];return _0x3ec58c;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});config[_0xef61('0xd')]=_['defaults'](config[_0xef61('0xd')],{'host':_0xef61('0xe'),'port':0x18eb});var socket=require(_0xef61('0xf'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xef61('0x10')](socket);function respondWithRpcPromise(_0x2e28c7,_0x1ab79d,_0x11181b){return new BPromise(function(_0x2af74c,_0xdcd707){return client[_0xef61('0x11')](_0x2e28c7,_0x11181b)[_0xef61('0x12')](function(_0x237f43){logger[_0xef61('0x13')](_0xef61('0x14'),_0x1ab79d,_0xef61('0x15'));logger[_0xef61('0x16')](_0xef61('0x17'),_0x1ab79d,'request\x20sent',JSON[_0xef61('0x18')](_0x237f43));if(_0x237f43['error']){if(_0x237f43[_0xef61('0x19')][_0xef61('0x1a')]===0x1f4){logger[_0xef61('0x19')](_0xef61('0x14'),_0x1ab79d,_0x237f43['error'][_0xef61('0x1b')]);return _0xdcd707(_0x237f43[_0xef61('0x19')][_0xef61('0x1b')]);}logger[_0xef61('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1ab79d,_0x237f43[_0xef61('0x19')][_0xef61('0x1b')]);return _0x2af74c(_0x237f43['error'][_0xef61('0x1b')]);}else{logger[_0xef61('0x13')](_0xef61('0x14'),_0x1ab79d,_0xef61('0x15'));_0x2af74c(_0x237f43[_0xef61('0x1c')][_0xef61('0x1b')]);}})[_0xef61('0x1d')](function(_0x55f887){logger[_0xef61('0x19')](_0xef61('0x14'),_0x1ab79d,_0x55f887);_0xdcd707(_0x55f887);});});} \ No newline at end of file +var _0x7096=['ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','then','info'];(function(_0x455268,_0x4bbc72){var _0x5475c4=function(_0x467e73){while(--_0x467e73){_0x455268['push'](_0x455268['shift']());}};_0x5475c4(++_0x4bbc72);}(_0x7096,0x10c));var _0x6709=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7096[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});config[_0x6709('0xb')]=_[_0x6709('0xc')](config[_0x6709('0xb')],{'host':_0x6709('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6709('0xe'))[_0x6709('0xf')](socket);function respondWithRpcPromise(_0xbcb47,_0x1aa476,_0x12eea2){return new BPromise(function(_0x426ea1,_0x5de1fa){return client['request'](_0xbcb47,_0x12eea2)[_0x6709('0x10')](function(_0x262261){logger[_0x6709('0x11')](_0x6709('0x12'),_0x1aa476,_0x6709('0x13'));logger[_0x6709('0x14')](_0x6709('0x15'),_0x1aa476,_0x6709('0x13'),JSON['stringify'](_0x262261));if(_0x262261[_0x6709('0x16')]){if(_0x262261[_0x6709('0x16')][_0x6709('0x17')]===0x1f4){logger[_0x6709('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1aa476,_0x262261[_0x6709('0x16')]['message']);return _0x5de1fa(_0x262261[_0x6709('0x16')]['message']);}logger[_0x6709('0x16')](_0x6709('0x12'),_0x1aa476,_0x262261[_0x6709('0x16')][_0x6709('0x18')]);return _0x426ea1(_0x262261['error']['message']);}else{logger['info'](_0x6709('0x12'),_0x1aa476,_0x6709('0x13'));_0x426ea1(_0x262261['result'][_0x6709('0x18')]);}})[_0x6709('0x19')](function(_0xf1a70d){logger['error'](_0x6709('0x12'),_0x1aa476,_0xf1a70d);_0x5de1fa(_0xf1a70d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7d17858..3e3d156 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0xb1b481,_0x337b26){var _0x2433d2=function(_0x5c8bdf){while(--_0x5c8bdf){_0xb1b481['push'](_0xb1b481['shift']());}};_0x2433d2(++_0x337b26);}(_0xb10b,0x12a));var _0xbb10=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0xb10b[_0x68a0b0];return _0x4b4ee6;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x23b980,_0x57697f){var _0x475354=function(_0x3ee3fb){while(--_0x3ee3fb){_0x23b980['push'](_0x23b980['shift']());}};_0x475354(++_0x57697f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30b6c3,_0x552158){_0x30b6c3=_0x30b6c3-0x0;var _0xabed1a=_0x5f2f[_0x30b6c3];return _0xabed1a;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 37c026c..d59e577 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 _0x9437=['getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','server/files/images/logos/','single','file','addLogo','root','server/files/images/avatars/','format','%s-%s','now','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/applications','addProactiveActions','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','describe','get','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar'];(function(_0x5822dd,_0x51a0ca){var _0x5086af=function(_0x2eea23){while(--_0x2eea23){_0x5822dd['push'](_0x5822dd['shift']());}};_0x5086af(++_0x51a0ca);}(_0x9437,0xab));var _0x7943=function(_0x1581f3,_0x26f75a){_0x1581f3=_0x1581f3-0x0;var _0x519f3b=_0x9437[_0x1581f3];return _0x519f3b;};'use strict';var multer=require('multer');var util=require(_0x7943('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7943('0x1')]();var auth=require(_0x7943('0x2'));var interaction=require(_0x7943('0x3'));var config=require(_0x7943('0x4'));var controller=require(_0x7943('0x5'));router['get']('/',auth[_0x7943('0x6')](),controller['index']);router['get']('/describe',auth[_0x7943('0x6')](),controller[_0x7943('0x7')]);router[_0x7943('0x8')](_0x7943('0x9'),auth['isAuthenticated'](),controller[_0x7943('0xa')]);router['get'](_0x7943('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x7943('0xc'),auth[_0x7943('0x6')](),controller[_0x7943('0xd')]);router[_0x7943('0x8')](_0x7943('0xe'),controller[_0x7943('0xf')]);router[_0x7943('0x8')](_0x7943('0x10'),controller['getAvatar']);router[_0x7943('0x8')](_0x7943('0x11'),controller[_0x7943('0x12')]);router[_0x7943('0x8')](_0x7943('0x13'),controller[_0x7943('0x14')]);router['get'](_0x7943('0x15'),auth[_0x7943('0x6')](),controller[_0x7943('0x16')]);router['get'](_0x7943('0x17'),controller['getSnippet']);router[_0x7943('0x8')]('/:id/applications',auth[_0x7943('0x6')](),controller[_0x7943('0x18')]);router[_0x7943('0x8')](_0x7943('0x19'),auth[_0x7943('0x6')](),controller[_0x7943('0x1a')]);router['get'](_0x7943('0x1b'),controller[_0x7943('0x1c')]);router['get'](_0x7943('0x1d'),auth[_0x7943('0x6')](),controller[_0x7943('0x1e')]);router[_0x7943('0x8')](_0x7943('0x1f'),auth[_0x7943('0x6')](),controller[_0x7943('0x20')]);router[_0x7943('0x21')]('/',auth['isAuthenticated'](),controller[_0x7943('0x22')]);router[_0x7943('0x21')](_0x7943('0xb'),auth[_0x7943('0x6')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x7943('0x6')](),controller[_0x7943('0x23')]);var upload=multer({'storage':multer[_0x7943('0x24')]({'destination':function(_0x3d5c64,_0x140fb2,_0x2e1ff9){_0x2e1ff9(null,path[_0x7943('0x25')](config['root'],_0x7943('0x26')));},'filename':function(_0x216359,_0x5b512d,_0x2383d7){_0x2383d7(null,util['format']('%s-%s',Date['now'](),_0x5b512d['originalname']));}})});router[_0x7943('0x21')](_0x7943('0xe'),upload[_0x7943('0x27')](_0x7943('0x28')),controller[_0x7943('0x29')]);var upload=multer({'storage':multer[_0x7943('0x24')]({'destination':function(_0x2919cc,_0x37b394,_0x1ed1bd){_0x1ed1bd(null,path[_0x7943('0x25')](config[_0x7943('0x2a')],_0x7943('0x2b')));},'filename':function(_0x32434e,_0x2b0202,_0x5b284c){_0x5b284c(null,util[_0x7943('0x2c')](_0x7943('0x2d'),Date[_0x7943('0x2e')](),_0x2b0202[_0x7943('0x2f')]));}})});router['post'](_0x7943('0x10'),upload[_0x7943('0x27')](_0x7943('0x28')),controller[_0x7943('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55e59c,_0x39e1bc,_0x372dd0){_0x372dd0(null,path[_0x7943('0x25')](config[_0x7943('0x2a')],_0x7943('0x2b')));},'filename':function(_0x3d9b4c,_0x316c7b,_0x467cff){_0x467cff(null,util[_0x7943('0x2c')](_0x7943('0x2d'),Date[_0x7943('0x2e')](),_0x316c7b[_0x7943('0x2f')]));}})});router['post'](_0x7943('0x11'),upload[_0x7943('0x27')](_0x7943('0x28')),controller[_0x7943('0x31')]);var upload=multer({'storage':multer[_0x7943('0x24')]({'destination':function(_0x599f1d,_0x1d8ae2,_0x3463cf){_0x3463cf(null,path['join'](config['root'],_0x7943('0x2b')));},'filename':function(_0x2b28aa,_0x58641f,_0x24f3d0){_0x24f3d0(null,util[_0x7943('0x2c')]('%s-%s',Date[_0x7943('0x2e')](),_0x58641f[_0x7943('0x2f')]));}})});router['post'](_0x7943('0x13'),upload[_0x7943('0x27')](_0x7943('0x28')),controller[_0x7943('0x32')]);router['post'](_0x7943('0x33'),controller[_0x7943('0x34')]);router['post'](_0x7943('0x35'),controller['offline']);router['post'](_0x7943('0x15'),auth[_0x7943('0x6')](),controller[_0x7943('0x36')]);router[_0x7943('0x21')](_0x7943('0x37'),auth[_0x7943('0x6')](),controller['addApplications']);router['post'](_0x7943('0x19'),auth[_0x7943('0x6')](),controller[_0x7943('0x38')]);router[_0x7943('0x21')](_0x7943('0x1f'),auth[_0x7943('0x6')](),controller['addAgents']);router['put'](_0x7943('0x9'),auth[_0x7943('0x6')](),controller['update']);router[_0x7943('0x39')](_0x7943('0x9'),auth[_0x7943('0x6')](),controller[_0x7943('0x3a')]);router[_0x7943('0x39')]('/:id/dispositions',auth[_0x7943('0x6')](),controller[_0x7943('0x3b')]);router[_0x7943('0x39')](_0x7943('0xc'),auth['isAuthenticated'](),controller[_0x7943('0x3c')]);router[_0x7943('0x39')]('/:id/users',auth[_0x7943('0x6')](),controller[_0x7943('0x3d')]);module[_0x7943('0x3e')]=router; \ No newline at end of file +var _0x3781=['/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','getOfflineMessages','getAgents','post','addDisposition','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','diskStorage','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','put','update','destroy','delete','removeDispositions','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3781,0x130));var _0x1378=function(_0x527129,_0x4843d7){_0x527129=_0x527129-0x0;var _0x1c2a80=_0x3781[_0x527129];return _0x1c2a80;};'use strict';var multer=require('multer');var util=require(_0x1378('0x0'));var path=require(_0x1378('0x1'));var timeout=require(_0x1378('0x2'));var express=require(_0x1378('0x3'));var router=express[_0x1378('0x4')]();var auth=require(_0x1378('0x5'));var interaction=require(_0x1378('0x6'));var config=require(_0x1378('0x7'));var controller=require(_0x1378('0x8'));router[_0x1378('0x9')]('/',auth['isAuthenticated'](),controller[_0x1378('0xa')]);router[_0x1378('0x9')](_0x1378('0xb'),auth[_0x1378('0xc')](),controller['describe']);router['get'](_0x1378('0xd'),auth[_0x1378('0xc')](),controller[_0x1378('0xe')]);router[_0x1378('0x9')](_0x1378('0xf'),auth['isAuthenticated'](),controller[_0x1378('0x10')]);router[_0x1378('0x9')](_0x1378('0x11'),auth['isAuthenticated'](),controller[_0x1378('0x12')]);router[_0x1378('0x9')]('/:id/logo',controller['getLogo']);router['get'](_0x1378('0x13'),controller[_0x1378('0x14')]);router[_0x1378('0x9')](_0x1378('0x15'),controller[_0x1378('0x16')]);router[_0x1378('0x9')](_0x1378('0x17'),controller[_0x1378('0x18')]);router[_0x1378('0x9')](_0x1378('0x19'),auth[_0x1378('0xc')](),controller[_0x1378('0x1a')]);router[_0x1378('0x9')](_0x1378('0x1b'),controller[_0x1378('0x1c')]);router[_0x1378('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x1378('0x1d')]);router['get'](_0x1378('0x1e'),auth[_0x1378('0xc')](),controller['getProactiveActions']);router[_0x1378('0x9')](_0x1378('0x1f'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0x1378('0xc')](),controller[_0x1378('0x20')]);router[_0x1378('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x1378('0x21')]);router[_0x1378('0x22')]('/',auth[_0x1378('0xc')](),controller['create']);router[_0x1378('0x22')](_0x1378('0xf'),auth[_0x1378('0xc')](),controller[_0x1378('0x23')]);router[_0x1378('0x22')](_0x1378('0x11'),auth[_0x1378('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x386648,_0x59271,_0x3dcb14){_0x3dcb14(null,path[_0x1378('0x24')](config[_0x1378('0x25')],_0x1378('0x26')));},'filename':function(_0x1d4850,_0x22c793,_0x567807){_0x567807(null,util[_0x1378('0x27')](_0x1378('0x28'),Date[_0x1378('0x29')](),_0x22c793[_0x1378('0x2a')]));}})});router['post'](_0x1378('0x2b'),upload[_0x1378('0x2c')](_0x1378('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x1378('0x2e')]({'destination':function(_0x36d05a,_0x2546c1,_0xf2a8cd){_0xf2a8cd(null,path[_0x1378('0x24')](config['root'],_0x1378('0x2f')));},'filename':function(_0x1d8caa,_0x3fe23b,_0x25680a){_0x25680a(null,util[_0x1378('0x27')](_0x1378('0x28'),Date[_0x1378('0x29')](),_0x3fe23b[_0x1378('0x2a')]));}})});router[_0x1378('0x22')](_0x1378('0x13'),upload['single'](_0x1378('0x2d')),controller[_0x1378('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x180c44,_0x5bed6a,_0x44de15){_0x44de15(null,path['join'](config['root'],_0x1378('0x2f')));},'filename':function(_0x1fa25d,_0x135d39,_0x29ba52){_0x29ba52(null,util[_0x1378('0x27')](_0x1378('0x28'),Date[_0x1378('0x29')](),_0x135d39[_0x1378('0x2a')]));}})});router[_0x1378('0x22')](_0x1378('0x15'),upload[_0x1378('0x2c')]('file'),controller[_0x1378('0x31')]);var upload=multer({'storage':multer[_0x1378('0x2e')]({'destination':function(_0x4d938c,_0x16368a,_0x3bdf1d){_0x3bdf1d(null,path[_0x1378('0x24')](config[_0x1378('0x25')],_0x1378('0x2f')));},'filename':function(_0x20fba6,_0x10f24d,_0x301955){_0x301955(null,util[_0x1378('0x27')](_0x1378('0x28'),Date[_0x1378('0x29')](),_0x10f24d[_0x1378('0x2a')]));}})});router['post']('/:id/system_avatar',upload['single'](_0x1378('0x2d')),controller['addSystemAvatar']);router[_0x1378('0x22')](_0x1378('0x32'),controller[_0x1378('0x33')]);router[_0x1378('0x22')](_0x1378('0x34'),controller[_0x1378('0x35')]);router[_0x1378('0x22')](_0x1378('0x19'),auth[_0x1378('0xc')](),controller[_0x1378('0x36')]);router['post']('/:id/applications',auth[_0x1378('0xc')](),controller[_0x1378('0x37')]);router[_0x1378('0x22')](_0x1378('0x1e'),auth[_0x1378('0xc')](),controller[_0x1378('0x38')]);router[_0x1378('0x22')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x1378('0x39')](_0x1378('0xd'),auth[_0x1378('0xc')](),controller[_0x1378('0x3a')]);router['delete'](_0x1378('0xd'),auth[_0x1378('0xc')](),controller[_0x1378('0x3b')]);router[_0x1378('0x3c')](_0x1378('0xf'),auth[_0x1378('0xc')](),controller[_0x1378('0x3d')]);router['delete'](_0x1378('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1378('0x3c')](_0x1378('0x3e'),auth[_0x1378('0xc')](),controller[_0x1378('0x3f')]);module[_0x1378('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6b05d16..5c66f4c 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 _0xc2d6=['STRING','ENUM','AmazonAWS','Google','exports'];(function(_0x5e7d2a,_0x4c778e){var _0xf5090=function(_0x46587d){while(--_0x46587d){_0x5e7d2a['push'](_0x5e7d2a['shift']());}};_0xf5090(++_0x4c778e);}(_0xc2d6,0x171));var _0x6c2d=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xc2d6[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require('sequelize');module[_0x6c2d('0x0')]={'name':{'type':Sequelize[_0x6c2d('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6c2d('0x2')](_0x6c2d('0x3'),_0x6c2d('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x6c2d('0x1')]},'data2':{'type':Sequelize[_0x6c2d('0x1')]}}; \ No newline at end of file +var _0x624c=['STRING','ENUM','AmazonAWS','Google','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x624c,0x1ee));var _0xc624=function(_0x551b1c,_0x3584f9){_0x551b1c=_0x551b1c-0x0;var _0x131273=_0x624c[_0x551b1c];return _0x131273;};'use strict';var Sequelize=require('sequelize');module[_0xc624('0x0')]={'name':{'type':Sequelize[_0xc624('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc624('0x2')](_0xc624('0x3'),_0xc624('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc624('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 93f593e..c2ad58f 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 _0x2608=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','type','key','model','map','keys'];(function(_0x269bcc,_0x105aa3){var _0x1332fd=function(_0x530651){while(--_0x530651){_0x269bcc['push'](_0x269bcc['shift']());}};_0x1332fd(++_0x105aa3);}(_0x2608,0x1c8));var _0x8260=function(_0x2f13ab,_0x155d6c){_0x2f13ab=_0x2f13ab-0x0;var _0x2b01e8=_0x2608[_0x2f13ab];return _0x2b01e8;};'use strict';var pdf=require(_0x8260('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8260('0x1'));var zipdir=require(_0x8260('0x2'));var jsonpatch=require(_0x8260('0x3'));var rp=require('request-promise');var moment=require(_0x8260('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8260('0x5'));var util=require(_0x8260('0x6'));var path=require('path');var sox=require(_0x8260('0x7'));var csv=require(_0x8260('0x8'));var ejs=require(_0x8260('0x9'));var fs=require('fs');var _=require(_0x8260('0xa'));var squel=require(_0x8260('0xb'));var crypto=require(_0x8260('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8260('0xd'));var Papa=require('papaparse');var Redis=require(_0x8260('0xe'));var authService=require(_0x8260('0xf'));var qs=require(_0x8260('0x10'));var as=require(_0x8260('0x11'));var hardwareService=require(_0x8260('0x12'));var logger=require(_0x8260('0x13'))(_0x8260('0x14'));var utils=require(_0x8260('0x15'));var config=require(_0x8260('0x16'));var licenseUtil=require(_0x8260('0x17'));var db=require(_0x8260('0x18'))['db'];function respondWithStatusCode(_0x579643,_0x53b46f){_0x53b46f=_0x53b46f||0xcc;return function(_0x37edbd){if(_0x37edbd){return _0x579643[_0x8260('0x19')](_0x53b46f);}return _0x579643[_0x8260('0x1a')](_0x53b46f)[_0x8260('0x1b')]();};}function respondWithResult(_0x3aba6d,_0x22b966){_0x22b966=_0x22b966||0xc8;return function(_0x1730a0){if(_0x1730a0){return _0x3aba6d['status'](_0x22b966)['json'](_0x1730a0);}};}function respondWithFilteredResult(_0x1da39c,_0x5e95b5){return function(_0x59c2da){if(_0x59c2da){var _0x3253b2=_0x59c2da[_0x8260('0x1c')],_0x2e4098=_0x5e95b5[_0x8260('0x1d')],_0xb6230=_0x5e95b5[_0x8260('0x1d')]+_0x5e95b5[_0x8260('0x1e')],_0x21b4e5;if(_0xb6230>=_0x3253b2){_0xb6230=_0x3253b2;_0x21b4e5=0xc8;}else{_0x21b4e5=0xce;}_0x1da39c['status'](_0x21b4e5);return _0x1da39c['set']('Content-Range',_0x2e4098+'-'+_0xb6230+'/'+_0x3253b2)['json'](_0x59c2da);}return null;};}function patchUpdates(_0x45af35){return function(_0x41503a){try{jsonpatch['apply'](_0x41503a,_0x45af35,!![]);}catch(_0x456a92){return BPromise[_0x8260('0x1f')](_0x456a92);}return _0x41503a[_0x8260('0x20')]();};}function saveUpdates(_0x5ec5ce,_0x3a516f){return function(_0xfb90fc){if(_0xfb90fc){return _0xfb90fc[_0x8260('0x21')](_0x5ec5ce)[_0x8260('0x22')](function(_0x360080){return _0x360080;});}return null;};}function removeEntity(_0x451493,_0x2fd872){return function(_0x1717e2){if(_0x1717e2){return _0x1717e2[_0x8260('0x23')]()[_0x8260('0x22')](function(){_0x451493[_0x8260('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x496152,_0x166aa0){return function(_0x4f3736){if(!_0x4f3736){_0x496152[_0x8260('0x19')](0x194);}return _0x4f3736;};}function handleError(_0x2c10ac,_0x2e15c8){_0x2e15c8=_0x2e15c8||0x1f4;return function(_0x1f055e){logger[_0x8260('0x24')](_0x1f055e[_0x8260('0x25')]);if(_0x1f055e[_0x8260('0x26')]){delete _0x1f055e['name'];}_0x2c10ac[_0x8260('0x1a')](_0x2e15c8)[_0x8260('0x27')](_0x1f055e);};}exports[_0x8260('0x28')]=function(_0x45bc4f,_0x43fe69){var _0x5c5872={},_0x4bf0de={},_0x589b9b={'count':0x0,'rows':[]};var _0xe4a66a=_['map'](db[_0x8260('0x29')][_0x8260('0x2a')],function(_0x3c3694){return{'name':_0x3c3694['fieldName'],'type':_0x3c3694[_0x8260('0x2b')][_0x8260('0x2c')]};});_0x4bf0de[_0x8260('0x2d')]=_[_0x8260('0x2e')](_0xe4a66a,_0x8260('0x26'));_0x4bf0de['query']=_[_0x8260('0x2f')](_0x45bc4f[_0x8260('0x30')]);_0x4bf0de[_0x8260('0x31')]=_[_0x8260('0x32')](_0x4bf0de[_0x8260('0x2d')],_0x4bf0de[_0x8260('0x30')]);_0x5c5872[_0x8260('0x33')]=_[_0x8260('0x32')](_0x4bf0de['model'],qs[_0x8260('0x34')](_0x45bc4f[_0x8260('0x30')]['fields']));_0x5c5872[_0x8260('0x33')]=_0x5c5872[_0x8260('0x33')][_0x8260('0x35')]?_0x5c5872[_0x8260('0x33')]:_0x4bf0de[_0x8260('0x2d')];if(!_0x45bc4f[_0x8260('0x30')][_0x8260('0x36')](_0x8260('0x37'))){_0x5c5872['limit']=qs[_0x8260('0x1e')](_0x45bc4f[_0x8260('0x30')]['limit']);_0x5c5872[_0x8260('0x1d')]=qs[_0x8260('0x1d')](_0x45bc4f['query'][_0x8260('0x1d')]);}_0x5c5872[_0x8260('0x38')]=qs[_0x8260('0x39')](_0x45bc4f['query'][_0x8260('0x39')]);_0x5c5872[_0x8260('0x3a')]=qs['filters'](_[_0x8260('0x3b')](_0x45bc4f[_0x8260('0x30')],_0x4bf0de[_0x8260('0x31')]),_0xe4a66a);if(_0x45bc4f[_0x8260('0x30')]['filter']){_0x5c5872[_0x8260('0x3a')]=_[_0x8260('0x3c')](_0x5c5872[_0x8260('0x3a')],{'$or':_[_0x8260('0x2e')](_0xe4a66a,function(_0x1c61ff){if(_0x1c61ff[_0x8260('0x2b')]!==_0x8260('0x3d')){var _0xe265c8={};_0xe265c8[_0x1c61ff[_0x8260('0x26')]]={'$like':'%'+_0x45bc4f[_0x8260('0x30')]['filter']+'%'};return _0xe265c8;}})});}_0x5c5872=_[_0x8260('0x3c')]({},_0x5c5872,_0x45bc4f[_0x8260('0x3e')]);var _0x3d5b9={'where':_0x5c5872[_0x8260('0x3a')]};return db[_0x8260('0x29')]['count'](_0x3d5b9)[_0x8260('0x22')](function(_0xb0a8b4){_0x589b9b[_0x8260('0x1c')]=_0xb0a8b4;if(_0x45bc4f[_0x8260('0x30')][_0x8260('0x3f')]){_0x5c5872[_0x8260('0x40')]=[{'all':!![]}];}return db[_0x8260('0x29')][_0x8260('0x41')](_0x5c5872);})[_0x8260('0x22')](function(_0x3606d8){_0x589b9b[_0x8260('0x42')]=_0x3606d8;return _0x589b9b;})[_0x8260('0x22')](respondWithFilteredResult(_0x43fe69,_0x5c5872))[_0x8260('0x43')](handleError(_0x43fe69,null));};exports['show']=function(_0x515bc0,_0xf9530d){var _0x4ca9c4={'raw':!![],'where':{'id':_0x515bc0[_0x8260('0x44')]['id']}},_0x5ada44={};_0x5ada44[_0x8260('0x2d')]=_[_0x8260('0x2f')](db['CloudProvider']['rawAttributes']);_0x5ada44['query']=_[_0x8260('0x2f')](_0x515bc0['query']);_0x5ada44[_0x8260('0x31')]=_[_0x8260('0x32')](_0x5ada44[_0x8260('0x2d')],_0x5ada44[_0x8260('0x30')]);_0x4ca9c4['attributes']=_[_0x8260('0x32')](_0x5ada44[_0x8260('0x2d')],qs[_0x8260('0x34')](_0x515bc0[_0x8260('0x30')][_0x8260('0x34')]));_0x4ca9c4[_0x8260('0x33')]=_0x4ca9c4[_0x8260('0x33')][_0x8260('0x35')]?_0x4ca9c4['attributes']:_0x5ada44[_0x8260('0x2d')];if(_0x515bc0[_0x8260('0x30')][_0x8260('0x3f')]){_0x4ca9c4[_0x8260('0x40')]=[{'all':!![]}];}_0x4ca9c4=_[_0x8260('0x3c')]({},_0x4ca9c4,_0x515bc0['options']);return db[_0x8260('0x29')][_0x8260('0x45')](_0x4ca9c4)[_0x8260('0x22')](handleEntityNotFound(_0xf9530d,null))[_0x8260('0x22')](respondWithResult(_0xf9530d,null))[_0x8260('0x43')](handleError(_0xf9530d,null));};exports[_0x8260('0x46')]=function(_0x3c0884,_0x40d180){return db[_0x8260('0x29')][_0x8260('0x46')](_0x3c0884[_0x8260('0x47')],{})[_0x8260('0x22')](respondWithResult(_0x40d180,0xc9))[_0x8260('0x43')](handleError(_0x40d180,null));};exports[_0x8260('0x21')]=function(_0xe74626,_0x2e1dab){if(_0xe74626['body']['id']){delete _0xe74626['body']['id'];}return db[_0x8260('0x29')]['find']({'where':{'id':_0xe74626['params']['id']}})[_0x8260('0x22')](handleEntityNotFound(_0x2e1dab,null))[_0x8260('0x22')](saveUpdates(_0xe74626[_0x8260('0x47')],null))[_0x8260('0x22')](respondWithResult(_0x2e1dab,null))[_0x8260('0x43')](handleError(_0x2e1dab,null));};exports[_0x8260('0x23')]=function(_0x583bbe,_0x4a2680){return db[_0x8260('0x29')]['find']({'where':{'id':_0x583bbe['params']['id']}})[_0x8260('0x22')](handleEntityNotFound(_0x4a2680,null))[_0x8260('0x22')](removeEntity(_0x4a2680,null))[_0x8260('0x43')](handleError(_0x4a2680,null));}; \ No newline at end of file +var _0xc3fa=['rows','catch','show','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x464bff,_0x457ec7){var _0xbac919=function(_0x1eddf1){while(--_0x1eddf1){_0x464bff['push'](_0x464bff['shift']());}};_0xbac919(++_0x457ec7);}(_0xc3fa,0x9f));var _0xac3f=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0xc3fa[_0x4b1665];return _0x5850c0;};'use strict';var pdf=require(_0xac3f('0x0'));var emlformat=require(_0xac3f('0x1'));var rimraf=require(_0xac3f('0x2'));var zipdir=require(_0xac3f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac3f('0x4'));var moment=require(_0xac3f('0x5'));var BPromise=require(_0xac3f('0x6'));var Mustache=require(_0xac3f('0x7'));var util=require('util');var path=require(_0xac3f('0x8'));var sox=require(_0xac3f('0x9'));var csv=require('to-csv');var ejs=require(_0xac3f('0xa'));var fs=require('fs');var _=require(_0xac3f('0xb'));var squel=require('squel');var crypto=require(_0xac3f('0xc'));var jsforce=require(_0xac3f('0xd'));var deskjs=require(_0xac3f('0xe'));var toCsv=require(_0xac3f('0xf'));var querystring=require('querystring');var Papa=require(_0xac3f('0x10'));var Redis=require(_0xac3f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xac3f('0x12'));var as=require(_0xac3f('0x13'));var hardwareService=require(_0xac3f('0x14'));var logger=require('../../config/logger')(_0xac3f('0x15'));var utils=require(_0xac3f('0x16'));var config=require(_0xac3f('0x17'));var licenseUtil=require(_0xac3f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x445d48,_0x33fc03){_0x33fc03=_0x33fc03||0xcc;return function(_0x2530bf){if(_0x2530bf){return _0x445d48[_0xac3f('0x19')](_0x33fc03);}return _0x445d48['status'](_0x33fc03)['end']();};}function respondWithResult(_0x34eaa7,_0x29733e){_0x29733e=_0x29733e||0xc8;return function(_0xe1ac45){if(_0xe1ac45){return _0x34eaa7[_0xac3f('0x1a')](_0x29733e)[_0xac3f('0x1b')](_0xe1ac45);}};}function respondWithFilteredResult(_0x2ceada,_0x12cb44){return function(_0x571e4c){if(_0x571e4c){var _0x37acb8=_0x571e4c[_0xac3f('0x1c')],_0x17ea4e=_0x12cb44['offset'],_0x304e16=_0x12cb44[_0xac3f('0x1d')]+_0x12cb44[_0xac3f('0x1e')],_0x375361;if(_0x304e16>=_0x37acb8){_0x304e16=_0x37acb8;_0x375361=0xc8;}else{_0x375361=0xce;}_0x2ceada['status'](_0x375361);return _0x2ceada[_0xac3f('0x1f')](_0xac3f('0x20'),_0x17ea4e+'-'+_0x304e16+'/'+_0x37acb8)[_0xac3f('0x1b')](_0x571e4c);}return null;};}function patchUpdates(_0x38b905){return function(_0x2f1cb7){try{jsonpatch[_0xac3f('0x21')](_0x2f1cb7,_0x38b905,!![]);}catch(_0x5925e7){return BPromise[_0xac3f('0x22')](_0x5925e7);}return _0x2f1cb7[_0xac3f('0x23')]();};}function saveUpdates(_0x2b3307,_0x284e73){return function(_0x14fab1){if(_0x14fab1){return _0x14fab1[_0xac3f('0x24')](_0x2b3307)[_0xac3f('0x25')](function(_0x32ec87){return _0x32ec87;});}return null;};}function removeEntity(_0x51c28e,_0x3a55df){return function(_0x4d08c3){if(_0x4d08c3){return _0x4d08c3[_0xac3f('0x26')]()['then'](function(){_0x51c28e['status'](0xcc)[_0xac3f('0x27')]();});}};}function handleEntityNotFound(_0x2fb866,_0x2be794){return function(_0x3ab832){if(!_0x3ab832){_0x2fb866[_0xac3f('0x19')](0x194);}return _0x3ab832;};}function handleError(_0x3ee188,_0x23aa7b){_0x23aa7b=_0x23aa7b||0x1f4;return function(_0x4ac2fb){logger['error'](_0x4ac2fb[_0xac3f('0x28')]);if(_0x4ac2fb[_0xac3f('0x29')]){delete _0x4ac2fb[_0xac3f('0x29')];}_0x3ee188[_0xac3f('0x1a')](_0x23aa7b)['send'](_0x4ac2fb);};}exports[_0xac3f('0x2a')]=function(_0x354de9,_0x2d49cc){var _0x54dab5={},_0x221549={},_0x537c72={'count':0x0,'rows':[]};var _0x585b97=_[_0xac3f('0x2b')](db[_0xac3f('0x2c')][_0xac3f('0x2d')],function(_0x41ccab){return{'name':_0x41ccab[_0xac3f('0x2e')],'type':_0x41ccab[_0xac3f('0x2f')][_0xac3f('0x30')]};});_0x221549[_0xac3f('0x31')]=_['map'](_0x585b97,_0xac3f('0x29'));_0x221549[_0xac3f('0x32')]=_['keys'](_0x354de9['query']);_0x221549[_0xac3f('0x33')]=_[_0xac3f('0x34')](_0x221549[_0xac3f('0x31')],_0x221549[_0xac3f('0x32')]);_0x54dab5[_0xac3f('0x35')]=_[_0xac3f('0x34')](_0x221549['model'],qs[_0xac3f('0x36')](_0x354de9[_0xac3f('0x32')][_0xac3f('0x36')]));_0x54dab5['attributes']=_0x54dab5[_0xac3f('0x35')][_0xac3f('0x37')]?_0x54dab5[_0xac3f('0x35')]:_0x221549['model'];if(!_0x354de9[_0xac3f('0x32')][_0xac3f('0x38')]('nolimit')){_0x54dab5[_0xac3f('0x1e')]=qs['limit'](_0x354de9[_0xac3f('0x32')][_0xac3f('0x1e')]);_0x54dab5[_0xac3f('0x1d')]=qs['offset'](_0x354de9[_0xac3f('0x32')][_0xac3f('0x1d')]);}_0x54dab5[_0xac3f('0x39')]=qs[_0xac3f('0x3a')](_0x354de9[_0xac3f('0x32')][_0xac3f('0x3a')]);_0x54dab5[_0xac3f('0x3b')]=qs['filters'](_['pick'](_0x354de9[_0xac3f('0x32')],_0x221549[_0xac3f('0x33')]),_0x585b97);if(_0x354de9['query'][_0xac3f('0x3c')]){_0x54dab5[_0xac3f('0x3b')]=_[_0xac3f('0x3d')](_0x54dab5[_0xac3f('0x3b')],{'$or':_['map'](_0x585b97,function(_0xc7b776){if(_0xc7b776[_0xac3f('0x2f')]!==_0xac3f('0x3e')){var _0x31d7e3={};_0x31d7e3[_0xc7b776[_0xac3f('0x29')]]={'$like':'%'+_0x354de9['query']['filter']+'%'};return _0x31d7e3;}})});}_0x54dab5=_[_0xac3f('0x3d')]({},_0x54dab5,_0x354de9['options']);var _0x118a33={'where':_0x54dab5[_0xac3f('0x3b')]};return db[_0xac3f('0x2c')][_0xac3f('0x1c')](_0x118a33)[_0xac3f('0x25')](function(_0x79c27){_0x537c72['count']=_0x79c27;if(_0x354de9['query'][_0xac3f('0x3f')]){_0x54dab5[_0xac3f('0x40')]=[{'all':!![]}];}return db[_0xac3f('0x2c')][_0xac3f('0x41')](_0x54dab5);})[_0xac3f('0x25')](function(_0x5ddb17){_0x537c72[_0xac3f('0x42')]=_0x5ddb17;return _0x537c72;})[_0xac3f('0x25')](respondWithFilteredResult(_0x2d49cc,_0x54dab5))[_0xac3f('0x43')](handleError(_0x2d49cc,null));};exports[_0xac3f('0x44')]=function(_0x125095,_0x34cc32){var _0x2d3da3={'raw':!![],'where':{'id':_0x125095[_0xac3f('0x45')]['id']}},_0x3ece07={};_0x3ece07[_0xac3f('0x31')]=_[_0xac3f('0x46')](db[_0xac3f('0x2c')]['rawAttributes']);_0x3ece07[_0xac3f('0x32')]=_[_0xac3f('0x46')](_0x125095[_0xac3f('0x32')]);_0x3ece07[_0xac3f('0x33')]=_['intersection'](_0x3ece07[_0xac3f('0x31')],_0x3ece07[_0xac3f('0x32')]);_0x2d3da3[_0xac3f('0x35')]=_[_0xac3f('0x34')](_0x3ece07['model'],qs[_0xac3f('0x36')](_0x125095[_0xac3f('0x32')][_0xac3f('0x36')]));_0x2d3da3['attributes']=_0x2d3da3[_0xac3f('0x35')][_0xac3f('0x37')]?_0x2d3da3[_0xac3f('0x35')]:_0x3ece07[_0xac3f('0x31')];if(_0x125095[_0xac3f('0x32')][_0xac3f('0x3f')]){_0x2d3da3[_0xac3f('0x40')]=[{'all':!![]}];}_0x2d3da3=_[_0xac3f('0x3d')]({},_0x2d3da3,_0x125095[_0xac3f('0x47')]);return db['CloudProvider'][_0xac3f('0x48')](_0x2d3da3)[_0xac3f('0x25')](handleEntityNotFound(_0x34cc32,null))[_0xac3f('0x25')](respondWithResult(_0x34cc32,null))[_0xac3f('0x43')](handleError(_0x34cc32,null));};exports[_0xac3f('0x49')]=function(_0x5e8541,_0x56a072){return db[_0xac3f('0x2c')][_0xac3f('0x49')](_0x5e8541[_0xac3f('0x4a')],{})[_0xac3f('0x25')](respondWithResult(_0x56a072,0xc9))['catch'](handleError(_0x56a072,null));};exports[_0xac3f('0x24')]=function(_0x1231a5,_0x41ef9f){if(_0x1231a5['body']['id']){delete _0x1231a5[_0xac3f('0x4a')]['id'];}return db[_0xac3f('0x2c')]['find']({'where':{'id':_0x1231a5[_0xac3f('0x45')]['id']}})['then'](handleEntityNotFound(_0x41ef9f,null))[_0xac3f('0x25')](saveUpdates(_0x1231a5[_0xac3f('0x4a')],null))[_0xac3f('0x25')](respondWithResult(_0x41ef9f,null))[_0xac3f('0x43')](handleError(_0x41ef9f,null));};exports[_0xac3f('0x26')]=function(_0x6a766a,_0x361f3d){return db[_0xac3f('0x2c')][_0xac3f('0x48')]({'where':{'id':_0x6a766a[_0xac3f('0x45')]['id']}})['then'](handleEntityNotFound(_0x361f3d,null))['then'](removeEntity(_0x361f3d,null))[_0xac3f('0x43')](handleError(_0x361f3d,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0c2f672..2c25dc2 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 _0xac17=['moment','path','rimraf','../../config/environment','CloudProvider','cloud_providers','util','../../config/logger','api'];(function(_0x4410e5,_0x4df2f8){var _0x4f3e18=function(_0x52a0bd){while(--_0x52a0bd){_0x4410e5['push'](_0x4410e5['shift']());}};_0x4f3e18(++_0x4df2f8);}(_0xac17,0x96));var _0x7ac1=function(_0x5b9986,_0x5d376a){_0x5b9986=_0x5b9986-0x0;var _0x2c3085=_0xac17[_0x5b9986];return _0x2c3085;};'use strict';var _=require('lodash');var util=require(_0x7ac1('0x0'));var logger=require(_0x7ac1('0x1'))(_0x7ac1('0x2'));var moment=require(_0x7ac1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ac1('0x4'));var rimraf=require(_0x7ac1('0x5'));var config=require(_0x7ac1('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x3e325e,_0x38dc2b){return _0x3e325e['define'](_0x7ac1('0x7'),attributes,{'tableName':_0x7ac1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x601a=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','../../config/logger'];(function(_0x5a9dad,_0x19bed1){var _0x896bdf=function(_0x4d7abb){while(--_0x4d7abb){_0x5a9dad['push'](_0x5a9dad['shift']());}};_0x896bdf(++_0x19bed1);}(_0x601a,0xd6));var _0xa601=function(_0xdffb4d,_0x50e5fb){_0xdffb4d=_0xdffb4d-0x0;var _0x57167a=_0x601a[_0xdffb4d];return _0x57167a;};'use strict';var _=require(_0xa601('0x0'));var util=require('util');var logger=require(_0xa601('0x1'))(_0xa601('0x2'));var moment=require('moment');var BPromise=require(_0xa601('0x3'));var rp=require(_0xa601('0x4'));var fs=require('fs');var path=require(_0xa601('0x5'));var rimraf=require(_0xa601('0x6'));var config=require(_0xa601('0x7'));var attributes=require(_0xa601('0x8'));module[_0xa601('0x9')]=function(_0x326da5,_0x58ff29){return _0x326da5['define'](_0xa601('0xa'),attributes,{'tableName':_0xa601('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index c15d70d..aefd122 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 _0x7c6e=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7c6e,0x1b9));var _0xe7c6=function(_0x23e735,_0x2427b4){_0x23e735=_0x23e735-0x0;var _0x333398=_0x7c6e[_0x23e735];return _0x333398;};'use strict';var _=require(_0xe7c6('0x0'));var util=require('util');var moment=require(_0xe7c6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7c6('0x2'));var db=require(_0xe7c6('0x3'))['db'];var utils=require(_0xe7c6('0x4'));var logger=require(_0xe7c6('0x5'))(_0xe7c6('0x6'));var config=require(_0xe7c6('0x7'));var jayson=require(_0xe7c6('0x8'));var client=jayson['client'][_0xe7c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x210ca2,_0x21cccc,_0x3db179){return new BPromise(function(_0x4a2f13,_0x302b2a){return client[_0xe7c6('0xa')](_0x210ca2,_0x3db179)['then'](function(_0x4076c0){logger[_0xe7c6('0xb')](_0xe7c6('0xc'),_0x21cccc,_0xe7c6('0xd'));logger[_0xe7c6('0xe')](_0xe7c6('0xf'),_0x21cccc,_0xe7c6('0xd'),JSON['stringify'](_0x4076c0));if(_0x4076c0[_0xe7c6('0x10')]){if(_0x4076c0[_0xe7c6('0x10')][_0xe7c6('0x11')]===0x1f4){logger[_0xe7c6('0x10')](_0xe7c6('0xc'),_0x21cccc,_0x4076c0[_0xe7c6('0x10')][_0xe7c6('0x12')]);return _0x302b2a(_0x4076c0[_0xe7c6('0x10')][_0xe7c6('0x12')]);}logger['error'](_0xe7c6('0xc'),_0x21cccc,_0x4076c0[_0xe7c6('0x10')][_0xe7c6('0x12')]);return _0x4a2f13(_0x4076c0[_0xe7c6('0x10')]['message']);}else{logger['info'](_0xe7c6('0xc'),_0x21cccc,'request\x20sent');_0x4a2f13(_0x4076c0['result'][_0xe7c6('0x12')]);}})[_0xe7c6('0x13')](function(_0x1f2fc0){logger[_0xe7c6('0x10')](_0xe7c6('0xc'),_0x21cccc,_0x1f2fc0);_0x302b2a(_0x1f2fc0);});});} \ No newline at end of file +var _0x65ca=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0x65ca,0x13f));var _0xa65c=function(_0x16c2b1,_0x36a70c){_0x16c2b1=_0x16c2b1-0x0;var _0x199ac4=_0x65ca[_0x16c2b1];return _0x199ac4;};'use strict';var _=require('lodash');var util=require(_0xa65c('0x0'));var moment=require(_0xa65c('0x1'));var BPromise=require(_0xa65c('0x2'));var rs=require(_0xa65c('0x3'));var fs=require('fs');var Redis=require(_0xa65c('0x4'));var db=require(_0xa65c('0x5'))['db'];var utils=require(_0xa65c('0x6'));var logger=require(_0xa65c('0x7'))(_0xa65c('0x8'));var config=require(_0xa65c('0x9'));var jayson=require(_0xa65c('0xa'));var client=jayson[_0xa65c('0xb')][_0xa65c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc3178,_0x367f28,_0x5cc9da){return new BPromise(function(_0x50d392,_0x54bb54){return client[_0xa65c('0xd')](_0xc3178,_0x5cc9da)[_0xa65c('0xe')](function(_0x2ba729){logger['info'](_0xa65c('0xf'),_0x367f28,_0xa65c('0x10'));logger[_0xa65c('0x11')](_0xa65c('0x12'),_0x367f28,_0xa65c('0x10'),JSON['stringify'](_0x2ba729));if(_0x2ba729[_0xa65c('0x13')]){if(_0x2ba729[_0xa65c('0x13')][_0xa65c('0x14')]===0x1f4){logger[_0xa65c('0x13')](_0xa65c('0xf'),_0x367f28,_0x2ba729[_0xa65c('0x13')]['message']);return _0x54bb54(_0x2ba729[_0xa65c('0x13')][_0xa65c('0x15')]);}logger[_0xa65c('0x13')](_0xa65c('0xf'),_0x367f28,_0x2ba729['error'][_0xa65c('0x15')]);return _0x50d392(_0x2ba729[_0xa65c('0x13')][_0xa65c('0x15')]);}else{logger['info'](_0xa65c('0xf'),_0x367f28,_0xa65c('0x10'));_0x50d392(_0x2ba729[_0xa65c('0x16')]['message']);}})['catch'](function(_0x2b4a77){logger[_0xa65c('0x13')](_0xa65c('0xf'),_0x367f28,_0x2b4a77);_0x54bb54(_0x2b4a77);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5aa1c34..0b51fd8 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 _0xee55=['get','isAuthenticated','index','/:id','post','create','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller'];(function(_0x1e8331,_0x22736d){var _0x245d22=function(_0x2ad4bc){while(--_0x2ad4bc){_0x1e8331['push'](_0x1e8331['shift']());}};_0x245d22(++_0x22736d);}(_0xee55,0x105));var _0x5ee5=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xee55[_0x47c5bf];return _0x11b779;};'use strict';var multer=require('multer');var util=require(_0x5ee5('0x0'));var path=require(_0x5ee5('0x1'));var timeout=require(_0x5ee5('0x2'));var express=require(_0x5ee5('0x3'));var router=express[_0x5ee5('0x4')]();var auth=require(_0x5ee5('0x5'));var interaction=require(_0x5ee5('0x6'));var config=require(_0x5ee5('0x7'));var controller=require(_0x5ee5('0x8'));router[_0x5ee5('0x9')]('/',auth[_0x5ee5('0xa')](),controller[_0x5ee5('0xb')]);router[_0x5ee5('0x9')](_0x5ee5('0xc'),auth[_0x5ee5('0xa')](),controller['show']);router[_0x5ee5('0xd')]('/',auth[_0x5ee5('0xa')](),controller[_0x5ee5('0xe')]);router['put'](_0x5ee5('0xc'),auth[_0x5ee5('0xa')](),controller[_0x5ee5('0xf')]);router['delete'](_0x5ee5('0xc'),auth[_0x5ee5('0xa')](),controller[_0x5ee5('0x10')]);module[_0x5ee5('0x11')]=router; \ No newline at end of file +var _0xf9fa=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x301a02,_0x64eec9){var _0x8ddeba=function(_0x17b005){while(--_0x17b005){_0x301a02['push'](_0x301a02['shift']());}};_0x8ddeba(++_0x64eec9);}(_0xf9fa,0xe5));var _0xaf9f=function(_0x442ded,_0x4fce29){_0x442ded=_0x442ded-0x0;var _0x4cbc6d=_0xf9fa[_0x442ded];return _0x4cbc6d;};'use strict';var multer=require(_0xaf9f('0x0'));var util=require(_0xaf9f('0x1'));var path=require(_0xaf9f('0x2'));var timeout=require(_0xaf9f('0x3'));var express=require(_0xaf9f('0x4'));var router=express[_0xaf9f('0x5')]();var auth=require(_0xaf9f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf9f('0x7'));var controller=require(_0xaf9f('0x8'));router[_0xaf9f('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf9f('0xa')]);router[_0xaf9f('0x9')](_0xaf9f('0xb'),auth[_0xaf9f('0xc')](),controller[_0xaf9f('0xd')]);router[_0xaf9f('0xe')]('/',auth[_0xaf9f('0xc')](),controller[_0xaf9f('0xf')]);router[_0xaf9f('0x10')](_0xaf9f('0xb'),auth['isAuthenticated'](),controller[_0xaf9f('0x11')]);router[_0xaf9f('0x12')](_0xaf9f('0xb'),auth['isAuthenticated'](),controller[_0xaf9f('0x13')]);module[_0xaf9f('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 08e7983..6849b3f 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 _0xd421=['STRING','name','sequelize','exports'];(function(_0x13394b,_0x230238){var _0x19e803=function(_0x3a1efe){while(--_0x3a1efe){_0x13394b['push'](_0x13394b['shift']());}};_0x19e803(++_0x230238);}(_0xd421,0x1f2));var _0x1d42=function(_0x11248a,_0x4ff6a2){_0x11248a=_0x11248a-0x0;var _0x5a2784=_0xd421[_0x11248a];return _0x5a2784;};'use strict';var Sequelize=require(_0x1d42('0x0'));module[_0x1d42('0x1')]={'name':{'type':Sequelize[_0x1d42('0x2')],'unique':_0x1d42('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1d42('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1d42('0x2')]},'phone':{'type':Sequelize[_0x1d42('0x2')]},'fax':{'type':Sequelize[_0x1d42('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x1d42('0x2')]},'postalCode':{'type':Sequelize[_0x1d42('0x2')]},'city':{'type':Sequelize[_0x1d42('0x2')]},'country':{'type':Sequelize[_0x1d42('0x2')]},'email':{'type':Sequelize[_0x1d42('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1d42('0x2')]},'sStreet':{'type':Sequelize[_0x1d42('0x2')]},'sPostalCode':{'type':Sequelize[_0x1d42('0x2')]},'sCity':{'type':Sequelize[_0x1d42('0x2')]},'sCountry':{'type':Sequelize[_0x1d42('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c6a=['exports','STRING','name','sequelize'];(function(_0x19d55c,_0x385f3e){var _0x14f709=function(_0x4af052){while(--_0x4af052){_0x19d55c['push'](_0x19d55c['shift']());}};_0x14f709(++_0x385f3e);}(_0x9c6a,0x67));var _0xa9c6=function(_0x10c518,_0x568d85){_0x10c518=_0x10c518-0x0;var _0xf21ad0=_0x9c6a[_0x10c518];return _0xf21ad0;};'use strict';var Sequelize=require(_0xa9c6('0x0'));module[_0xa9c6('0x1')]={'name':{'type':Sequelize[_0xa9c6('0x2')],'unique':_0xa9c6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa9c6('0x2')]},'companyId':{'type':Sequelize[_0xa9c6('0x2')]},'website':{'type':Sequelize[_0xa9c6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa9c6('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa9c6('0x2')]},'postalCode':{'type':Sequelize[_0xa9c6('0x2')]},'city':{'type':Sequelize[_0xa9c6('0x2')]},'country':{'type':Sequelize[_0xa9c6('0x2')]},'email':{'type':Sequelize[_0xa9c6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa9c6('0x2')]},'sStreet':{'type':Sequelize[_0xa9c6('0x2')]},'sPostalCode':{'type':Sequelize[_0xa9c6('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa9c6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index ea7bef7..e33874e 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 _0xfd7a=['lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','then','destroy','Companies','UserProfileResource','end','error','stack','name','send','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','getContacts','findOne','filter','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x1a3e2a,_0x3f2564){var _0x154e03=function(_0x54a13f){while(--_0x54a13f){_0x1a3e2a['push'](_0x1a3e2a['shift']());}};_0x154e03(++_0x3f2564);}(_0xfd7a,0x93));var _0xafd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd7a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xafd7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafd7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafd7('0x2'));var moment=require(_0xafd7('0x3'));var BPromise=require(_0xafd7('0x4'));var Mustache=require('mustache');var util=require(_0xafd7('0x5'));var path=require(_0xafd7('0x6'));var sox=require(_0xafd7('0x7'));var csv=require('to-csv');var ejs=require(_0xafd7('0x8'));var fs=require('fs');var _=require(_0xafd7('0x9'));var squel=require(_0xafd7('0xa'));var crypto=require(_0xafd7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xafd7('0xc'));var querystring=require('querystring');var Papa=require(_0xafd7('0xd'));var Redis=require(_0xafd7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xafd7('0xf'));var as=require(_0xafd7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafd7('0x11'))('api');var utils=require(_0xafd7('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xafd7('0x13'))['db'];function respondWithStatusCode(_0x314fb8,_0xb30d84){_0xb30d84=_0xb30d84||0xcc;return function(_0x5e9f52){if(_0x5e9f52){return _0x314fb8[_0xafd7('0x14')](_0xb30d84);}return _0x314fb8[_0xafd7('0x15')](_0xb30d84)['end']();};}function respondWithResult(_0x190d5a,_0x2bb1fd){_0x2bb1fd=_0x2bb1fd||0xc8;return function(_0xaac4c){if(_0xaac4c){return _0x190d5a['status'](_0x2bb1fd)['json'](_0xaac4c);}};}function respondWithFilteredResult(_0x4febbd,_0x5605a3){return function(_0x4c0822){if(_0x4c0822){var _0x4386d2=_0x4c0822[_0xafd7('0x16')],_0x189409=_0x5605a3[_0xafd7('0x17')],_0x54b957=_0x5605a3[_0xafd7('0x17')]+_0x5605a3[_0xafd7('0x18')],_0x5e7ac5;if(_0x54b957>=_0x4386d2){_0x54b957=_0x4386d2;_0x5e7ac5=0xc8;}else{_0x5e7ac5=0xce;}_0x4febbd[_0xafd7('0x15')](_0x5e7ac5);return _0x4febbd['set'](_0xafd7('0x19'),_0x189409+'-'+_0x54b957+'/'+_0x4386d2)['json'](_0x4c0822);}return null;};}function patchUpdates(_0xa9077b){return function(_0x56c1e0){try{jsonpatch[_0xafd7('0x1a')](_0x56c1e0,_0xa9077b,!![]);}catch(_0xcd27e){return BPromise[_0xafd7('0x1b')](_0xcd27e);}return _0x56c1e0[_0xafd7('0x1c')]();};}function saveUpdates(_0x349e8a,_0x48228a){return function(_0xe9952d){if(_0xe9952d){return _0xe9952d['update'](_0x349e8a)[_0xafd7('0x1d')](function(_0x3e1492){return _0x3e1492;});}return null;};}function removeEntity(_0x54e7fc,_0x314a35){return function(_0x1df185){if(_0x1df185){return _0x1df185[_0xafd7('0x1e')]()[_0xafd7('0x1d')](function(){var _0x5590b5=_0x1df185['get']({'plain':!![]});var _0x230c2c=_0xafd7('0x1f');return db[_0xafd7('0x20')][_0xafd7('0x1e')]({'where':{'type':_0x230c2c,'resourceId':_0x5590b5['id']}})[_0xafd7('0x1d')](function(){return _0x1df185;});})[_0xafd7('0x1d')](function(){_0x54e7fc[_0xafd7('0x15')](0xcc)[_0xafd7('0x21')]();});}};}function handleEntityNotFound(_0x26d6d2,_0x5d2a2b){return function(_0x550fb2){if(!_0x550fb2){_0x26d6d2[_0xafd7('0x14')](0x194);}return _0x550fb2;};}function handleError(_0x27d9c7,_0x42605a){_0x42605a=_0x42605a||0x1f4;return function(_0x43805f){logger[_0xafd7('0x22')](_0x43805f[_0xafd7('0x23')]);if(_0x43805f[_0xafd7('0x24')]){delete _0x43805f[_0xafd7('0x24')];}_0x27d9c7[_0xafd7('0x15')](_0x42605a)[_0xafd7('0x25')](_0x43805f);};}exports['index']=function(_0x2c9179,_0x4b12cb){var _0x1cc39a={},_0x10dff7={},_0x5d5992={'count':0x0,'rows':[]};return db[_0xafd7('0x26')][_0xafd7('0x27')]()[_0xafd7('0x1d')](function(_0x56ee07){_0x10dff7[_0xafd7('0x28')]=_[_0xafd7('0x29')](_0x56ee07);_0x10dff7[_0xafd7('0x2a')]=_['keys'](_0x2c9179[_0xafd7('0x2a')]);_0x10dff7['filters']=_[_0xafd7('0x2b')](_0x10dff7[_0xafd7('0x28')],_0x10dff7[_0xafd7('0x2a')]);_0x1cc39a[_0xafd7('0x2c')]=_[_0xafd7('0x2b')](_0x10dff7[_0xafd7('0x28')],qs['fields'](_0x2c9179['query'][_0xafd7('0x2d')]));_0x1cc39a['attributes']=_0x1cc39a[_0xafd7('0x2c')][_0xafd7('0x2e')]?_0x1cc39a[_0xafd7('0x2c')]:_0x10dff7[_0xafd7('0x28')];if(!_0x2c9179[_0xafd7('0x2a')][_0xafd7('0x2f')](_0xafd7('0x30'))){_0x1cc39a[_0xafd7('0x18')]=qs[_0xafd7('0x18')](_0x2c9179['query'][_0xafd7('0x18')]);_0x1cc39a['offset']=qs[_0xafd7('0x17')](_0x2c9179[_0xafd7('0x2a')][_0xafd7('0x17')]);}_0x1cc39a[_0xafd7('0x31')]=qs[_0xafd7('0x32')](_0x2c9179['query'][_0xafd7('0x32')]);_0x1cc39a['where']=qs['filters'](_['pick'](_0x2c9179[_0xafd7('0x2a')],_0x10dff7[_0xafd7('0x33')]),_0x56ee07);if(_0x2c9179['query']['filter']){_0x1cc39a[_0xafd7('0x34')]=_[_0xafd7('0x35')](_0x1cc39a[_0xafd7('0x34')],{'$or':_[_0xafd7('0x36')](_0x1cc39a['attributes'],function(_0x47ab94){var _0x47d715={};_0x47d715[_0x47ab94]={'$like':'%'+_0x2c9179['query']['filter']+'%'};return _0x47d715;})});}_0x1cc39a=_['merge']({},_0x1cc39a,_0x2c9179[_0xafd7('0x37')]);var _0x2d110f={'where':_0x1cc39a[_0xafd7('0x34')]};return db[_0xafd7('0x26')][_0xafd7('0x16')](_0x2d110f)[_0xafd7('0x1d')](function(_0x3f6246){_0x5d5992[_0xafd7('0x16')]=_0x3f6246;if(_0x2c9179[_0xafd7('0x2a')][_0xafd7('0x38')]){_0x1cc39a[_0xafd7('0x39')]=[{'all':!![]}];}return db[_0xafd7('0x26')][_0xafd7('0x3a')](_0x1cc39a);})[_0xafd7('0x1d')](function(_0x27e035){_0x5d5992['rows']=_0x27e035;return _0x5d5992;})[_0xafd7('0x1d')](respondWithFilteredResult(_0x4b12cb,_0x1cc39a))[_0xafd7('0x3b')](handleError(_0x4b12cb,null));})[_0xafd7('0x3b')](handleError(_0x4b12cb,null));};exports[_0xafd7('0x3c')]=function(_0x576af0,_0x18ba53){var _0x2230ca={'raw':![],'where':{'id':_0x576af0[_0xafd7('0x3d')]['id']}},_0x3bf7a1={};_0x3bf7a1[_0xafd7('0x28')]=_[_0xafd7('0x29')](db['CmCompany'][_0xafd7('0x3e')]);_0x3bf7a1[_0xafd7('0x2a')]=_[_0xafd7('0x29')](_0x576af0[_0xafd7('0x2a')]);_0x3bf7a1[_0xafd7('0x33')]=_[_0xafd7('0x2b')](_0x3bf7a1[_0xafd7('0x28')],_0x3bf7a1[_0xafd7('0x2a')]);_0x2230ca['attributes']=_[_0xafd7('0x2b')](_0x3bf7a1['model'],qs[_0xafd7('0x2d')](_0x576af0[_0xafd7('0x2a')][_0xafd7('0x2d')]));_0x2230ca['attributes']=_0x2230ca[_0xafd7('0x2c')]['length']?_0x2230ca[_0xafd7('0x2c')]:_0x3bf7a1[_0xafd7('0x28')];if(_0x576af0[_0xafd7('0x2a')]['includeAll']){_0x2230ca[_0xafd7('0x39')]=[{'all':!![]}];}_0x2230ca=_['merge']({},_0x2230ca,_0x576af0['options']);return db['CmCompany'][_0xafd7('0x3f')](_0x2230ca)[_0xafd7('0x1d')](handleEntityNotFound(_0x18ba53,null))[_0xafd7('0x1d')](respondWithResult(_0x18ba53,null))['catch'](handleError(_0x18ba53,null));};exports[_0xafd7('0x40')]=function(_0x103369,_0x3a1631){return db[_0xafd7('0x26')]['create'](_0x103369[_0xafd7('0x41')],{})['then'](function(_0x13fbc0){var _0x2f62d6=_0x103369['user']['get']({'plain':!![]});if(!_0x2f62d6)throw new Error(_0xafd7('0x42'));if(_0x2f62d6['role']===_0xafd7('0x43')){var _0x26f9fc=_0x13fbc0[_0xafd7('0x44')]({'plain':!![]});var _0x129ab3=_0xafd7('0x1f');return db['UserProfileSection'][_0xafd7('0x3f')]({'where':{'name':_0x129ab3,'userProfileId':_0x2f62d6['userProfileId']},'raw':!![]})[_0xafd7('0x1d')](function(_0x27b23f){if(_0x27b23f&&_0x27b23f[_0xafd7('0x45')]===0x0){return db['UserProfileResource'][_0xafd7('0x40')]({'name':_0x26f9fc[_0xafd7('0x24')],'resourceId':_0x26f9fc['id'],'type':_0x27b23f['name'],'sectionId':_0x27b23f['id']},{})[_0xafd7('0x1d')](function(){return _0x13fbc0;});}else{return _0x13fbc0;}})[_0xafd7('0x3b')](function(_0x235bed){logger['error'](_0xafd7('0x46'),_0x235bed);throw _0x235bed;});}return _0x13fbc0;})[_0xafd7('0x1d')](respondWithResult(_0x3a1631,0xc9))[_0xafd7('0x3b')](handleError(_0x3a1631,null));};exports[_0xafd7('0x47')]=function(_0x2b8ba4,_0x5281ef){if(_0x2b8ba4[_0xafd7('0x41')]['id']){delete _0x2b8ba4['body']['id'];}return db['CmCompany'][_0xafd7('0x3f')]({'where':{'id':_0x2b8ba4[_0xafd7('0x3d')]['id']}})[_0xafd7('0x1d')](handleEntityNotFound(_0x5281ef,null))[_0xafd7('0x1d')](saveUpdates(_0x2b8ba4[_0xafd7('0x41')],null))[_0xafd7('0x1d')](respondWithResult(_0x5281ef,null))[_0xafd7('0x3b')](handleError(_0x5281ef,null));};exports[_0xafd7('0x1e')]=function(_0x45ffb6,_0x5df2e2){return db['CmCompany'][_0xafd7('0x3f')]({'where':{'id':_0x45ffb6[_0xafd7('0x3d')]['id']}})[_0xafd7('0x1d')](handleEntityNotFound(_0x5df2e2,null))[_0xafd7('0x1d')](removeEntity(_0x5df2e2,null))['catch'](handleError(_0x5df2e2,null));};exports[_0xafd7('0x27')]=function(_0x5ee295,_0x455be5){return db[_0xafd7('0x26')][_0xafd7('0x27')]()[_0xafd7('0x1d')](respondWithResult(_0x455be5,null))['catch'](handleError(_0x455be5,null));};exports[_0xafd7('0x48')]=function(_0x41a9c9,_0x20221d,_0x5317a0){return db[_0xafd7('0x49')]['find']({'where':{'id':_0x41a9c9[_0xafd7('0x3d')]['id']}})[_0xafd7('0x1d')](handleEntityNotFound(_0x20221d,null))[_0xafd7('0x1d')](function(_0x57659b){if(_0x57659b){return _0x57659b[_0xafd7('0x48')](_0x41a9c9[_0xafd7('0x41')][_0xafd7('0x4a')],_['omit'](_0x41a9c9['body'],[_0xafd7('0x4a'),'id'])||{});}})[_0xafd7('0x1d')](respondWithResult(_0x20221d,null))[_0xafd7('0x3b')](handleError(_0x20221d,null));};exports[_0xafd7('0x4b')]=function(_0x26f899,_0x143c0b,_0x50bd6b){var _0x27c5a7={};var _0xd650c4={};var _0x4b6a02;var _0x487767;return db[_0xafd7('0x26')][_0xafd7('0x4c')]({'where':{'id':_0x26f899[_0xafd7('0x3d')]['id']}})[_0xafd7('0x1d')](handleEntityNotFound(_0x143c0b,null))[_0xafd7('0x1d')](function(_0x577362){if(_0x577362){_0x4b6a02=_0x577362;_0xd650c4[_0xafd7('0x28')]=_[_0xafd7('0x29')](db['CmContact'][_0xafd7('0x3e')]);_0xd650c4[_0xafd7('0x2a')]=_[_0xafd7('0x29')](_0x26f899['query']);_0xd650c4[_0xafd7('0x33')]=_[_0xafd7('0x2b')](_0xd650c4['model'],_0xd650c4[_0xafd7('0x2a')]);_0x27c5a7[_0xafd7('0x2c')]=_[_0xafd7('0x2b')](_0xd650c4[_0xafd7('0x28')],qs[_0xafd7('0x2d')](_0x26f899[_0xafd7('0x2a')]['fields']));_0x27c5a7[_0xafd7('0x2c')]=_0x27c5a7['attributes'][_0xafd7('0x2e')]?_0x27c5a7[_0xafd7('0x2c')]:_0xd650c4['model'];_0x27c5a7[_0xafd7('0x31')]=qs[_0xafd7('0x32')](_0x26f899['query']['sort']);_0x27c5a7[_0xafd7('0x34')]=qs['filters'](_['pick'](_0x26f899[_0xafd7('0x2a')],_0xd650c4[_0xafd7('0x33')]));if(_0x26f899['query'][_0xafd7('0x4d')]){_0x27c5a7[_0xafd7('0x34')]=_[_0xafd7('0x35')](_0x27c5a7[_0xafd7('0x34')],{'$or':_[_0xafd7('0x36')](_0x27c5a7[_0xafd7('0x2c')],function(_0x599132){var _0x2173de={};_0x2173de[_0x599132]={'$like':'%'+_0x26f899[_0xafd7('0x2a')][_0xafd7('0x4d')]+'%'};return _0x2173de;})});}_0x27c5a7=_[_0xafd7('0x35')]({},_0x27c5a7,_0x26f899[_0xafd7('0x37')]);return _0x4b6a02[_0xafd7('0x4b')](_0x27c5a7);}})[_0xafd7('0x1d')](function(_0x283c66){if(_0x283c66){_0x487767=_0x283c66[_0xafd7('0x2e')];if(!_0x26f899[_0xafd7('0x2a')][_0xafd7('0x2f')]('nolimit')){_0x27c5a7['limit']=qs[_0xafd7('0x18')](_0x26f899[_0xafd7('0x2a')][_0xafd7('0x18')]);_0x27c5a7[_0xafd7('0x17')]=qs[_0xafd7('0x17')](_0x26f899[_0xafd7('0x2a')]['offset']);}return _0x4b6a02['getContacts'](_0x27c5a7);}})[_0xafd7('0x1d')](function(_0x27420a){if(_0x27420a){return _0x27420a?{'count':_0x487767,'rows':_0x27420a}:null;}})['then'](respondWithResult(_0x143c0b,null))['catch'](handleError(_0x143c0b,null));}; \ No newline at end of file +var _0x983a=['path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','CmCompany','includeAll','include','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','map','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x4f7432,_0x2e0131){var _0x3c91ca=function(_0x4b43f1){while(--_0x4b43f1){_0x4f7432['push'](_0x4f7432['shift']());}};_0x3c91ca(++_0x2e0131);}(_0x983a,0x14a));var _0xa983=function(_0x38a59e,_0x327787){_0x38a59e=_0x38a59e-0x0;var _0x303b43=_0x983a[_0x38a59e];return _0x303b43;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa983('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa983('0x1'));var jsonpatch=require(_0xa983('0x2'));var rp=require('request-promise');var moment=require(_0xa983('0x3'));var BPromise=require(_0xa983('0x4'));var Mustache=require('mustache');var util=require(_0xa983('0x5'));var path=require(_0xa983('0x6'));var sox=require('sox');var csv=require(_0xa983('0x7'));var ejs=require(_0xa983('0x8'));var fs=require('fs');var _=require(_0xa983('0x9'));var squel=require(_0xa983('0xa'));var crypto=require(_0xa983('0xb'));var jsforce=require(_0xa983('0xc'));var deskjs=require(_0xa983('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa983('0xe'));var Papa=require(_0xa983('0xf'));var Redis=require(_0xa983('0x10'));var authService=require(_0xa983('0x11'));var qs=require(_0xa983('0x12'));var as=require(_0xa983('0x13'));var hardwareService=require(_0xa983('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa983('0x15'));var config=require(_0xa983('0x16'));var licenseUtil=require(_0xa983('0x17'));var db=require(_0xa983('0x18'))['db'];function respondWithStatusCode(_0x1e5b94,_0x22be0a){_0x22be0a=_0x22be0a||0xcc;return function(_0x6f5377){if(_0x6f5377){return _0x1e5b94[_0xa983('0x19')](_0x22be0a);}return _0x1e5b94[_0xa983('0x1a')](_0x22be0a)[_0xa983('0x1b')]();};}function respondWithResult(_0x4af23f,_0x4c6a72){_0x4c6a72=_0x4c6a72||0xc8;return function(_0x68e3e0){if(_0x68e3e0){return _0x4af23f['status'](_0x4c6a72)[_0xa983('0x1c')](_0x68e3e0);}};}function respondWithFilteredResult(_0x57097c,_0x34abd4){return function(_0x459aba){if(_0x459aba){var _0x40cca6=_0x459aba[_0xa983('0x1d')],_0x26f69b=_0x34abd4[_0xa983('0x1e')],_0x4c0603=_0x34abd4[_0xa983('0x1e')]+_0x34abd4[_0xa983('0x1f')],_0x101ee8;if(_0x4c0603>=_0x40cca6){_0x4c0603=_0x40cca6;_0x101ee8=0xc8;}else{_0x101ee8=0xce;}_0x57097c[_0xa983('0x1a')](_0x101ee8);return _0x57097c['set'](_0xa983('0x20'),_0x26f69b+'-'+_0x4c0603+'/'+_0x40cca6)[_0xa983('0x1c')](_0x459aba);}return null;};}function patchUpdates(_0x1f75ca){return function(_0x645f5c){try{jsonpatch[_0xa983('0x21')](_0x645f5c,_0x1f75ca,!![]);}catch(_0x57672a){return BPromise[_0xa983('0x22')](_0x57672a);}return _0x645f5c[_0xa983('0x23')]();};}function saveUpdates(_0x1d8988,_0x4f613f){return function(_0x27f682){if(_0x27f682){return _0x27f682[_0xa983('0x24')](_0x1d8988)[_0xa983('0x25')](function(_0x3cda71){return _0x3cda71;});}return null;};}function removeEntity(_0x2d038c,_0x2be6d2){return function(_0x277533){if(_0x277533){return _0x277533[_0xa983('0x26')]()[_0xa983('0x25')](function(){var _0x1f0c1c=_0x277533[_0xa983('0x27')]({'plain':!![]});var _0x387ade=_0xa983('0x28');return db[_0xa983('0x29')]['destroy']({'where':{'type':_0x387ade,'resourceId':_0x1f0c1c['id']}})[_0xa983('0x25')](function(){return _0x277533;});})[_0xa983('0x25')](function(){_0x2d038c[_0xa983('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x731073,_0x23a904){return function(_0x3f8d5a){if(!_0x3f8d5a){_0x731073[_0xa983('0x19')](0x194);}return _0x3f8d5a;};}function handleError(_0x1974a9,_0x31fb91){_0x31fb91=_0x31fb91||0x1f4;return function(_0x2d126f){logger[_0xa983('0x2a')](_0x2d126f[_0xa983('0x2b')]);if(_0x2d126f[_0xa983('0x2c')]){delete _0x2d126f[_0xa983('0x2c')];}_0x1974a9['status'](_0x31fb91)[_0xa983('0x2d')](_0x2d126f);};}exports[_0xa983('0x2e')]=function(_0x2dc0b5,_0x194913){var _0x13aef4={},_0x41f609={},_0x58b327={'count':0x0,'rows':[]};return db['CmCompany'][_0xa983('0x2f')]()[_0xa983('0x25')](function(_0x5654a6){_0x41f609[_0xa983('0x30')]=_[_0xa983('0x31')](_0x5654a6);_0x41f609[_0xa983('0x32')]=_[_0xa983('0x31')](_0x2dc0b5[_0xa983('0x32')]);_0x41f609[_0xa983('0x33')]=_[_0xa983('0x34')](_0x41f609[_0xa983('0x30')],_0x41f609[_0xa983('0x32')]);_0x13aef4[_0xa983('0x35')]=_[_0xa983('0x34')](_0x41f609['model'],qs['fields'](_0x2dc0b5[_0xa983('0x32')][_0xa983('0x36')]));_0x13aef4[_0xa983('0x35')]=_0x13aef4[_0xa983('0x35')][_0xa983('0x37')]?_0x13aef4[_0xa983('0x35')]:_0x41f609[_0xa983('0x30')];if(!_0x2dc0b5[_0xa983('0x32')][_0xa983('0x38')]('nolimit')){_0x13aef4[_0xa983('0x1f')]=qs[_0xa983('0x1f')](_0x2dc0b5[_0xa983('0x32')][_0xa983('0x1f')]);_0x13aef4[_0xa983('0x1e')]=qs[_0xa983('0x1e')](_0x2dc0b5[_0xa983('0x32')]['offset']);}_0x13aef4[_0xa983('0x39')]=qs['sort'](_0x2dc0b5[_0xa983('0x32')][_0xa983('0x3a')]);_0x13aef4[_0xa983('0x3b')]=qs[_0xa983('0x33')](_[_0xa983('0x3c')](_0x2dc0b5[_0xa983('0x32')],_0x41f609[_0xa983('0x33')]),_0x5654a6);if(_0x2dc0b5[_0xa983('0x32')]['filter']){_0x13aef4['where']=_[_0xa983('0x3d')](_0x13aef4[_0xa983('0x3b')],{'$or':_['map'](_0x13aef4['attributes'],function(_0x24361f){var _0x27e2cc={};_0x27e2cc[_0x24361f]={'$like':'%'+_0x2dc0b5['query'][_0xa983('0x3e')]+'%'};return _0x27e2cc;})});}_0x13aef4=_[_0xa983('0x3d')]({},_0x13aef4,_0x2dc0b5[_0xa983('0x3f')]);var _0x42b1ec={'where':_0x13aef4[_0xa983('0x3b')]};return db[_0xa983('0x40')][_0xa983('0x1d')](_0x42b1ec)[_0xa983('0x25')](function(_0x331286){_0x58b327['count']=_0x331286;if(_0x2dc0b5[_0xa983('0x32')][_0xa983('0x41')]){_0x13aef4[_0xa983('0x42')]=[{'all':!![]}];}return db[_0xa983('0x40')]['findAll'](_0x13aef4);})[_0xa983('0x25')](function(_0x1b781c){_0x58b327['rows']=_0x1b781c;return _0x58b327;})[_0xa983('0x25')](respondWithFilteredResult(_0x194913,_0x13aef4))[_0xa983('0x43')](handleError(_0x194913,null));})[_0xa983('0x43')](handleError(_0x194913,null));};exports['show']=function(_0x3320db,_0x5c923d){var _0xff72f1={'raw':![],'where':{'id':_0x3320db[_0xa983('0x44')]['id']}},_0xcb099={};_0xcb099['model']=_['keys'](db[_0xa983('0x40')][_0xa983('0x45')]);_0xcb099[_0xa983('0x32')]=_['keys'](_0x3320db[_0xa983('0x32')]);_0xcb099[_0xa983('0x33')]=_[_0xa983('0x34')](_0xcb099[_0xa983('0x30')],_0xcb099[_0xa983('0x32')]);_0xff72f1[_0xa983('0x35')]=_['intersection'](_0xcb099[_0xa983('0x30')],qs[_0xa983('0x36')](_0x3320db[_0xa983('0x32')]['fields']));_0xff72f1[_0xa983('0x35')]=_0xff72f1['attributes'][_0xa983('0x37')]?_0xff72f1[_0xa983('0x35')]:_0xcb099[_0xa983('0x30')];if(_0x3320db[_0xa983('0x32')]['includeAll']){_0xff72f1[_0xa983('0x42')]=[{'all':!![]}];}_0xff72f1=_['merge']({},_0xff72f1,_0x3320db[_0xa983('0x3f')]);return db[_0xa983('0x40')][_0xa983('0x46')](_0xff72f1)['then'](handleEntityNotFound(_0x5c923d,null))['then'](respondWithResult(_0x5c923d,null))[_0xa983('0x43')](handleError(_0x5c923d,null));};exports[_0xa983('0x47')]=function(_0x5d62ea,_0x51fe8e){return db['CmCompany'][_0xa983('0x47')](_0x5d62ea[_0xa983('0x48')],{})[_0xa983('0x25')](function(_0x1dcf28){var _0x34b61c=_0x5d62ea[_0xa983('0x49')]['get']({'plain':!![]});if(!_0x34b61c)throw new Error(_0xa983('0x4a'));if(_0x34b61c['role']===_0xa983('0x49')){var _0x2c73ca=_0x1dcf28[_0xa983('0x27')]({'plain':!![]});var _0x27052b='Companies';return db['UserProfileSection'][_0xa983('0x46')]({'where':{'name':_0x27052b,'userProfileId':_0x34b61c['userProfileId']},'raw':!![]})[_0xa983('0x25')](function(_0x1d21cd){if(_0x1d21cd&&_0x1d21cd['autoAssociation']===0x0){return db[_0xa983('0x29')]['create']({'name':_0x2c73ca[_0xa983('0x2c')],'resourceId':_0x2c73ca['id'],'type':_0x1d21cd[_0xa983('0x2c')],'sectionId':_0x1d21cd['id']},{})['then'](function(){return _0x1dcf28;});}else{return _0x1dcf28;}})['catch'](function(_0x22c4f2){logger[_0xa983('0x2a')](_0xa983('0x4b'),_0x22c4f2);throw _0x22c4f2;});}return _0x1dcf28;})[_0xa983('0x25')](respondWithResult(_0x51fe8e,0xc9))[_0xa983('0x43')](handleError(_0x51fe8e,null));};exports[_0xa983('0x24')]=function(_0x1149a1,_0x551d53){if(_0x1149a1[_0xa983('0x48')]['id']){delete _0x1149a1['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x1149a1[_0xa983('0x44')]['id']}})[_0xa983('0x25')](handleEntityNotFound(_0x551d53,null))[_0xa983('0x25')](saveUpdates(_0x1149a1[_0xa983('0x48')],null))[_0xa983('0x25')](respondWithResult(_0x551d53,null))[_0xa983('0x43')](handleError(_0x551d53,null));};exports[_0xa983('0x26')]=function(_0x3a898a,_0xca6c7a){return db['CmCompany'][_0xa983('0x46')]({'where':{'id':_0x3a898a[_0xa983('0x44')]['id']}})[_0xa983('0x25')](handleEntityNotFound(_0xca6c7a,null))[_0xa983('0x25')](removeEntity(_0xca6c7a,null))[_0xa983('0x43')](handleError(_0xca6c7a,null));};exports[_0xa983('0x2f')]=function(_0x31ec0a,_0x467032){return db[_0xa983('0x40')][_0xa983('0x2f')]()[_0xa983('0x25')](respondWithResult(_0x467032,null))[_0xa983('0x43')](handleError(_0x467032,null));};exports[_0xa983('0x4c')]=function(_0x118877,_0xb6bf25,_0x24b1a2){return db[_0xa983('0x4d')][_0xa983('0x46')]({'where':{'id':_0x118877[_0xa983('0x44')]['id']}})[_0xa983('0x25')](handleEntityNotFound(_0xb6bf25,null))[_0xa983('0x25')](function(_0x52e106){if(_0x52e106){return _0x52e106[_0xa983('0x4c')](_0x118877[_0xa983('0x48')][_0xa983('0x4e')],_[_0xa983('0x4f')](_0x118877[_0xa983('0x48')],['ids','id'])||{});}})[_0xa983('0x25')](respondWithResult(_0xb6bf25,null))[_0xa983('0x43')](handleError(_0xb6bf25,null));};exports[_0xa983('0x50')]=function(_0x526752,_0x191f13,_0x48e8fd){var _0x4580cb={};var _0x2556bf={};var _0x20f505;var _0x1335ed;return db['CmCompany'][_0xa983('0x51')]({'where':{'id':_0x526752[_0xa983('0x44')]['id']}})[_0xa983('0x25')](handleEntityNotFound(_0x191f13,null))[_0xa983('0x25')](function(_0xfae40d){if(_0xfae40d){_0x20f505=_0xfae40d;_0x2556bf[_0xa983('0x30')]=_['keys'](db[_0xa983('0x4d')][_0xa983('0x45')]);_0x2556bf['query']=_[_0xa983('0x31')](_0x526752[_0xa983('0x32')]);_0x2556bf[_0xa983('0x33')]=_['intersection'](_0x2556bf[_0xa983('0x30')],_0x2556bf['query']);_0x4580cb[_0xa983('0x35')]=_[_0xa983('0x34')](_0x2556bf[_0xa983('0x30')],qs[_0xa983('0x36')](_0x526752['query'][_0xa983('0x36')]));_0x4580cb[_0xa983('0x35')]=_0x4580cb[_0xa983('0x35')][_0xa983('0x37')]?_0x4580cb[_0xa983('0x35')]:_0x2556bf[_0xa983('0x30')];_0x4580cb[_0xa983('0x39')]=qs[_0xa983('0x3a')](_0x526752['query'][_0xa983('0x3a')]);_0x4580cb['where']=qs['filters'](_[_0xa983('0x3c')](_0x526752[_0xa983('0x32')],_0x2556bf[_0xa983('0x33')]));if(_0x526752[_0xa983('0x32')]['filter']){_0x4580cb[_0xa983('0x3b')]=_[_0xa983('0x3d')](_0x4580cb['where'],{'$or':_[_0xa983('0x52')](_0x4580cb[_0xa983('0x35')],function(_0x44f33c){var _0x1d418e={};_0x1d418e[_0x44f33c]={'$like':'%'+_0x526752[_0xa983('0x32')][_0xa983('0x3e')]+'%'};return _0x1d418e;})});}_0x4580cb=_['merge']({},_0x4580cb,_0x526752[_0xa983('0x3f')]);return _0x20f505[_0xa983('0x50')](_0x4580cb);}})[_0xa983('0x25')](function(_0x461b7d){if(_0x461b7d){_0x1335ed=_0x461b7d['length'];if(!_0x526752['query']['hasOwnProperty'](_0xa983('0x53'))){_0x4580cb[_0xa983('0x1f')]=qs[_0xa983('0x1f')](_0x526752[_0xa983('0x32')][_0xa983('0x1f')]);_0x4580cb[_0xa983('0x1e')]=qs['offset'](_0x526752['query'][_0xa983('0x1e')]);}return _0x20f505[_0xa983('0x50')](_0x4580cb);}})[_0xa983('0x25')](function(_0x31c62d){if(_0x31c62d){return _0x31c62d?{'count':_0x1335ed,'rows':_0x31c62d}:null;}})[_0xa983('0x25')](respondWithResult(_0x191f13,null))[_0xa983('0x43')](handleError(_0x191f13,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4ca5755..a0d2350 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xce2ee4,_0x3fe1e1){_0xce2ee4=_0xce2ee4-0x0;var _0x3fd000=_0x7fbe[_0xce2ee4];return _0x3fd000;};'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':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','CmCompany','cm_companies','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4b1f[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'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 fae7225..3de06b7 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 _0xc2c0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xcce84a,_0x148a0a){var _0x273e9d=function(_0x318266){while(--_0x318266){_0xcce84a['push'](_0xcce84a['shift']());}};_0x273e9d(++_0x148a0a);}(_0xc2c0,0x1dd));var _0x0c2c=function(_0xe7908d,_0x38c980){_0xe7908d=_0xe7908d-0x0;var _0x58d6c7=_0xc2c0[_0xe7908d];return _0x58d6c7;};'use strict';var _=require(_0x0c2c('0x0'));var util=require(_0x0c2c('0x1'));var moment=require(_0x0c2c('0x2'));var BPromise=require(_0x0c2c('0x3'));var rs=require(_0x0c2c('0x4'));var fs=require('fs');var Redis=require(_0x0c2c('0x5'));var db=require(_0x0c2c('0x6'))['db'];var utils=require(_0x0c2c('0x7'));var logger=require(_0x0c2c('0x8'))(_0x0c2c('0x9'));var config=require('../../config/environment');var jayson=require(_0x0c2c('0xa'));var client=jayson['client'][_0x0c2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7febbf,_0x55f326,_0x57f221){return new BPromise(function(_0xb869d5,_0x597058){return client[_0x0c2c('0xc')](_0x7febbf,_0x57f221)['then'](function(_0x300518){logger[_0x0c2c('0xd')](_0x0c2c('0xe'),_0x55f326,_0x0c2c('0xf'));logger[_0x0c2c('0x10')](_0x0c2c('0x11'),_0x55f326,_0x0c2c('0xf'),JSON[_0x0c2c('0x12')](_0x300518));if(_0x300518['error']){if(_0x300518[_0x0c2c('0x13')][_0x0c2c('0x14')]===0x1f4){logger[_0x0c2c('0x13')](_0x0c2c('0xe'),_0x55f326,_0x300518['error'][_0x0c2c('0x15')]);return _0x597058(_0x300518['error']['message']);}logger[_0x0c2c('0x13')]('CmCompany,\x20%s,\x20%s',_0x55f326,_0x300518[_0x0c2c('0x13')][_0x0c2c('0x15')]);return _0xb869d5(_0x300518['error']['message']);}else{logger['info'](_0x0c2c('0xe'),_0x55f326,_0x0c2c('0xf'));_0xb869d5(_0x300518[_0x0c2c('0x16')][_0x0c2c('0x15')]);}})[_0x0c2c('0x17')](function(_0x337742){logger[_0x0c2c('0x13')](_0x0c2c('0xe'),_0x55f326,_0x337742);_0x597058(_0x337742);});});} \ No newline at end of file +var _0xc282=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x228b45,_0x1fef06){var _0x3a52aa=function(_0x1d37e9){while(--_0x1d37e9){_0x228b45['push'](_0x228b45['shift']());}};_0x3a52aa(++_0x1fef06);}(_0xc282,0xd0));var _0x2c28=function(_0x50d233,_0x22616d){_0x50d233=_0x50d233-0x0;var _0x3588b3=_0xc282[_0x50d233];return _0x3588b3;};'use strict';var _=require('lodash');var util=require(_0x2c28('0x0'));var moment=require(_0x2c28('0x1'));var BPromise=require(_0x2c28('0x2'));var rs=require(_0x2c28('0x3'));var fs=require('fs');var Redis=require(_0x2c28('0x4'));var db=require(_0x2c28('0x5'))['db'];var utils=require(_0x2c28('0x6'));var logger=require(_0x2c28('0x7'))(_0x2c28('0x8'));var config=require(_0x2c28('0x9'));var jayson=require(_0x2c28('0xa'));var client=jayson[_0x2c28('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34f254,_0xc5fadf,_0x57af48){return new BPromise(function(_0x229eef,_0x4fa5f6){return client['request'](_0x34f254,_0x57af48)[_0x2c28('0xc')](function(_0x4433e6){logger['info'](_0x2c28('0xd'),_0xc5fadf,_0x2c28('0xe'));logger[_0x2c28('0xf')](_0x2c28('0x10'),_0xc5fadf,'request\x20sent',JSON['stringify'](_0x4433e6));if(_0x4433e6['error']){if(_0x4433e6[_0x2c28('0x11')][_0x2c28('0x12')]===0x1f4){logger['error'](_0x2c28('0xd'),_0xc5fadf,_0x4433e6[_0x2c28('0x11')][_0x2c28('0x13')]);return _0x4fa5f6(_0x4433e6[_0x2c28('0x11')][_0x2c28('0x13')]);}logger[_0x2c28('0x11')](_0x2c28('0xd'),_0xc5fadf,_0x4433e6[_0x2c28('0x11')]['message']);return _0x229eef(_0x4433e6[_0x2c28('0x11')][_0x2c28('0x13')]);}else{logger[_0x2c28('0x14')]('CmCompany,\x20%s,\x20%s',_0xc5fadf,'request\x20sent');_0x229eef(_0x4433e6[_0x2c28('0x15')][_0x2c28('0x13')]);}})[_0x2c28('0x16')](function(_0x47c0bd){logger[_0x2c28('0x11')](_0x2c28('0xd'),_0xc5fadf,_0x47c0bd);_0x4fa5f6(_0x47c0bd);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index eba04bf..6349be5 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 _0x4bd3=['/describe','get','/:id','show','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x4bd3,0x174));var _0x34bd=function(_0x43e362,_0x3e972a){_0x43e362=_0x43e362-0x0;var _0x4c3b96=_0x4bd3[_0x43e362];return _0x4c3b96;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x34bd('0x3'));var config=require(_0x34bd('0x4'));var controller=require(_0x34bd('0x5'));router['get']('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0x7')]);router['get'](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['describe']);router[_0x34bd('0x9')](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0xb')]);router[_0x34bd('0x9')](_0x34bd('0xc'),auth['isAuthenticated'](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')]('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0xf')]);router['post']('/:id/contacts',auth[_0x34bd('0x6')](),controller['addContacts']);router['put'](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x10')]);router[_0x34bd('0x11')](_0x34bd('0xa'),auth[_0x34bd('0x6')](),controller[_0x34bd('0x12')]);module[_0x34bd('0x13')]=router; \ No newline at end of file +var _0xacf4=['/describe','describe','show','/:id/contacts','getContacts','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3df1e4,_0x473acf){var _0x2c22e9=function(_0x2e7f48){while(--_0x2e7f48){_0x3df1e4['push'](_0x3df1e4['shift']());}};_0x2c22e9(++_0x473acf);}(_0xacf4,0xe7));var _0x4acf=function(_0x269e2d,_0x561780){_0x269e2d=_0x269e2d-0x0;var _0x42c9e2=_0xacf4[_0x269e2d];return _0x42c9e2;};'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 auth=require(_0x4acf('0x4'));var interaction=require(_0x4acf('0x5'));var config=require(_0x4acf('0x6'));var controller=require('./cmCompany.controller');router[_0x4acf('0x7')]('/',auth[_0x4acf('0x8')](),controller['index']);router[_0x4acf('0x7')](_0x4acf('0x9'),auth[_0x4acf('0x8')](),controller[_0x4acf('0xa')]);router[_0x4acf('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4acf('0xb')]);router['get'](_0x4acf('0xc'),auth[_0x4acf('0x8')](),controller[_0x4acf('0xd')]);router['post']('/',auth[_0x4acf('0x8')](),controller[_0x4acf('0xe')]);router['post']('/:id/contacts',auth[_0x4acf('0x8')](),controller['addContacts']);router['put'](_0x4acf('0xf'),auth[_0x4acf('0x8')](),controller[_0x4acf('0x10')]);router[_0x4acf('0x11')](_0x4acf('0xf'),auth[_0x4acf('0x8')](),controller[_0x4acf('0x12')]);module[_0x4acf('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 0014ced..661a048 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 _0x12e1=['NOW','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x4aca46,_0x2251a7){var _0x2e8cbb=function(_0x5872af){while(--_0x5872af){_0x4aca46['push'](_0x4aca46['shift']());}};_0x2e8cbb(++_0x2251a7);}(_0x12e1,0x1f2));var _0x112e=function(_0x1b74ff,_0x1db524){_0x1b74ff=_0x1b74ff-0x0;var _0x3b1d4a=_0x12e1[_0x1b74ff];return _0x3b1d4a;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x112e('0x0')]={'firstName':{'type':Sequelize[_0x112e('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x112e('0x1')]},'postalCode':{'type':Sequelize[_0x112e('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x112e('0x1')]},'dateOfBirth':{'type':Sequelize[_0x112e('0x1')]},'description':{'type':Sequelize[_0x112e('0x2')]},'phone':{'type':Sequelize[_0x112e('0x1')]},'mobile':{'type':Sequelize[_0x112e('0x1')]},'fax':{'type':Sequelize[_0x112e('0x1')]},'email':{'type':Sequelize[_0x112e('0x1')]},'url':{'type':Sequelize[_0x112e('0x1')]},'facebook':{'type':Sequelize[_0x112e('0x1')]},'fb_data':{'type':Sequelize[_0x112e('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x112e('0x1')]},'teams':{'type':Sequelize[_0x112e('0x1')]},'viber':{'type':Sequelize[_0x112e('0x1')]},'line':{'type':Sequelize[_0x112e('0x1')]},'wechat':{'type':Sequelize[_0x112e('0x1')]},'telegram':{'type':Sequelize[_0x112e('0x1')]},'UserId':{'type':Sequelize[_0x112e('0x3')]},'priority':{'type':Sequelize[_0x112e('0x3')](0x2)[_0x112e('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x112e('0x5')],'defaultValue':Sequelize[_0x112e('0x6')]}}; \ No newline at end of file +var _0xbccc=['INTEGER','UNSIGNED','lodash','sequelize','exports','STRING','TEXT'];(function(_0x21b894,_0x48b6d4){var _0x4fc99c=function(_0x2898bd){while(--_0x2898bd){_0x21b894['push'](_0x21b894['shift']());}};_0x4fc99c(++_0x48b6d4);}(_0xbccc,0x1d7));var _0xcbcc=function(_0x2830b7,_0x19121c){_0x2830b7=_0x2830b7-0x0;var _0x2a368f=_0xbccc[_0x2830b7];return _0x2a368f;};'use strict';var _=require(_0xcbcc('0x0'));var Sequelize=require(_0xcbcc('0x1'));module[_0xcbcc('0x2')]={'firstName':{'type':Sequelize[_0xcbcc('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xcbcc('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xcbcc('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcbcc('0x4')]},'phone':{'type':Sequelize[_0xcbcc('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcbcc('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xcbcc('0x3')]},'fb_data':{'type':Sequelize[_0xcbcc('0x3')]},'twitter':{'type':Sequelize[_0xcbcc('0x3')]},'skype':{'type':Sequelize[_0xcbcc('0x3')]},'teams':{'type':Sequelize[_0xcbcc('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xcbcc('0x3')]},'wechat':{'type':Sequelize[_0xcbcc('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xcbcc('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xcbcc('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4eb2a5b..c3ae5d9 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 _0x4c4e=['destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','alias','DESC','fullname','startCase','chat','Website','Account','closed','disposition','secondDisposition','thirdDisposition','UserId','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','slice','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','send','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','attributes','fields','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','datetime','DATE','start','hasOwnProperty','filter','isNil','Contact','push','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','tag','replace','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?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','SELECT','clone','having','user','role','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.mobile','c.ListId','c.deletedAt','c.CompanyId','TagIds','Tags','catch','destroy','columnName','displayName','findAll','custom','values','body','get','tags','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','error','show','params','name','omit','format','cf_%d','$and','pickBy','table','setFields','id\x20=\x20?','text','phone','getTags','rawAttributes','intersection','setTags','ids','includeAll','include','rows','ContactId','getHopperFinals','CmHopperFinal','options','getJscriptySessions','JscriptySessionReport','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','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','pid','upload','createReadStream','parse','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source'];(function(_0x2a1241,_0x39c7e8){var _0x219494=function(_0x12ec6c){while(--_0x12ec6c){_0x2a1241['push'](_0x2a1241['shift']());}};_0x219494(++_0x39c7e8);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4e834a,_0x55b543){_0x4e834a=_0x4e834a-0x0;var _0x2587ee=_0x4c4e[_0x4e834a];return _0x2587ee;};'use strict';var pdf=require(_0xe4c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4c4('0x1'));var zipdir=require(_0xe4c4('0x2'));var jsonpatch=require(_0xe4c4('0x3'));var rp=require('request-promise');var moment=require(_0xe4c4('0x4'));var BPromise=require(_0xe4c4('0x5'));var Mustache=require(_0xe4c4('0x6'));var util=require('util');var path=require(_0xe4c4('0x7'));var sox=require('sox');var csv=require(_0xe4c4('0x8'));var ejs=require(_0xe4c4('0x9'));var fs=require('fs');var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0xf'));var authService=require(_0xe4c4('0x10'));var qs=require(_0xe4c4('0x11'));var as=require(_0xe4c4('0x12'));var hardwareService=require(_0xe4c4('0x13'));var logger=require(_0xe4c4('0x14'))('api');var utils=require(_0xe4c4('0x15'));var config=require(_0xe4c4('0x16'));var licenseUtil=require(_0xe4c4('0x17'));var db=require(_0xe4c4('0x18'))['db'];config['redis']=_[_0xe4c4('0x19')](config[_0xe4c4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4c4('0x1b'))(new Redis(config[_0xe4c4('0x1a')]));require('./cmContact.socket')[_0xe4c4('0x1c')](socket);function respondWithStatusCode(_0x29766a,_0x5e263c){_0x5e263c=_0x5e263c||0xcc;return function(_0x307aa8){if(_0x307aa8){return _0x29766a[_0xe4c4('0x1d')](_0x5e263c);}return _0x29766a[_0xe4c4('0x1e')](_0x5e263c)[_0xe4c4('0x1f')]();};}function respondWithResult(_0x19e59b,_0x882be2){_0x882be2=_0x882be2||0xc8;return function(_0x1f637e){if(_0x1f637e){return _0x19e59b[_0xe4c4('0x1e')](_0x882be2)[_0xe4c4('0x20')](_0x1f637e);}};}function respondWithFilteredResult(_0x36b10c,_0x23b7e6){return function(_0x42242c){if(_0x42242c){var _0x3820c7=_0x42242c[_0xe4c4('0x21')],_0x43a9ce=_0x23b7e6[_0xe4c4('0x22')],_0x376585=_0x23b7e6[_0xe4c4('0x22')]+_0x23b7e6[_0xe4c4('0x23')],_0x5a32b5;if(_0x376585>=_0x3820c7){_0x376585=_0x3820c7;_0x5a32b5=0xc8;}else{_0x5a32b5=0xce;}_0x36b10c['status'](_0x5a32b5);return _0x36b10c[_0xe4c4('0x24')](_0xe4c4('0x25'),_0x43a9ce+'-'+_0x376585+'/'+_0x3820c7)[_0xe4c4('0x20')](_0x42242c);}return null;};}function patchUpdates(_0x30d56a){return function(_0x2c5aea){try{jsonpatch[_0xe4c4('0x26')](_0x2c5aea,_0x30d56a,!![]);}catch(_0x1d4597){return BPromise[_0xe4c4('0x27')](_0x1d4597);}return _0x2c5aea[_0xe4c4('0x28')]();};}function saveUpdates(_0x1a7690,_0x210ee1){return function(_0x3a6d39){if(_0x3a6d39){return _0x3a6d39[_0xe4c4('0x29')](_0x1a7690)[_0xe4c4('0x2a')](function(_0x15873e){return _0x15873e;});}return null;};}function removeEntity(_0x59498e,_0x49cadc){return function(_0x403a2c){if(_0x403a2c){return _0x403a2c['destroy']()[_0xe4c4('0x2a')](function(){_0x59498e['status'](0xcc)[_0xe4c4('0x1f')]();});}};}function handleEntityNotFound(_0x5efc4c,_0x34d667){return function(_0x583393){if(!_0x583393){_0x5efc4c[_0xe4c4('0x1d')](0x194);}return _0x583393;};}function handleError(_0x4a0199,_0x5a2adb){_0x5a2adb=_0x5a2adb||0x1f4;return function(_0x4cea1f){logger['error'](_0x4cea1f[_0xe4c4('0x2b')]);if(_0x4cea1f['name']){delete _0x4cea1f['name'];}_0x4a0199[_0xe4c4('0x1e')](_0x5a2adb)[_0xe4c4('0x2c')](_0x4cea1f);};}exports['index']=function(_0x57ba43,_0x7428ad){var _0x33de43={},_0x4aa6c1={},_0x158432={'count':0x0,'rows':[]};return db[_0xe4c4('0x2d')][_0xe4c4('0x2e')]()['then'](function(_0x5d49fd){var _0x46db7e=[];for(var _0x2c5652=0x0;_0x2c56520x1){_0x5ab715['or'](_0xe4c4('0x6e'),qs[_0xe4c4('0x6f')](_0x3a06da),null);}else{if(qs[_0xe4c4('0x70')](_0x3a06da)){_0x5ab715['or'](_0xe4c4('0x71'),_0x3a06da+'%');_0x5ab715['or'](_0xe4c4('0x72'),_0x3a06da+'%');_0x5ab715['or']('c.mobile\x20LIKE\x20?',_0x3a06da+'%');_0x5ab715['or']('c.fax\x20LIKE\x20?',_0x3a06da+'%');}else if(qs[_0xe4c4('0x73')](_0x3a06da)){_0x5ab715['or'](_0xe4c4('0x74'),_0x3a06da+'%');}else{_0x5ab715['or'](_0xe4c4('0x75'),'%'+_0x3a06da+'%');_0x5ab715['or'](_0xe4c4('0x76'),'%'+_0x3a06da+'%');_0x5ab715['or'](_0xe4c4('0x74'),'%'+_0x3a06da+'%');}}}}_0x260141[_0xe4c4('0x41')](_0x5ab715);_0x260141[_0xe4c4('0x77')](_0xe4c4('0x78'));var _0x43a4ff={'type':db['Sequelize']['QueryTypes'][_0xe4c4('0x79')],'raw':!![]};var _0x56f32e=_0x260141[_0xe4c4('0x7a')]()[_0xe4c4('0x44')](_0xe4c4('0x78'));if(_0x33de43['order']){_0x33de43[_0xe4c4('0x3f')]['forEach'](function(_0x3af3f0){_0x260141['order']('c.'+_0x3af3f0[0x0],_0x3af3f0[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe4c4('0x67')](_0x66304)){_0x260141[_0xe4c4('0x7b')](_0xc792eb);_0x56f32e[_0xe4c4('0x41')]('t.id\x20IN\x20?',_0x66304);}BPromise['resolve']()['then'](function(){if(!_0x54e073)return;if(_0x57ba43[_0xe4c4('0x7c')][_0xe4c4('0x7d')]!=='agent')return;if(!_[_0xe4c4('0x7e')](_0x54e073[_0xe4c4('0x54')],[_0xe4c4('0x44'),'User'])){return _0x57ba43['user'][_0xe4c4('0x7f')]({'attributes':['id'],'raw':!![]})[_0xe4c4('0x2a')](function(_0x7328e1){if(_[_0xe4c4('0x67')](_0x7328e1)){_0x56f32e[_0xe4c4('0x41')](_0xe4c4('0x80'));_0x260141['where'](_0xe4c4('0x80'));}else{_0x56f32e[_0xe4c4('0x41')](_0xe4c4('0x6a'),_['map'](_0x7328e1,'id'));_0x260141[_0xe4c4('0x41')](_0xe4c4('0x6a'),_[_0xe4c4('0x59')](_0x7328e1,'id'));}});}})['then'](function(){if(_0x57ba43['user'][_0xe4c4('0x7d')]==='agent'&&!_0x54e073&&!_0x57ba43['query'][_0xe4c4('0x69')])return[];return db[_0xe4c4('0x81')][_0xe4c4('0x3a')](_0x56f32e[_0xe4c4('0x82')](),_0x43a4ff);})[_0xe4c4('0x2a')](function(_0x4b988d){_0x158432[_0xe4c4('0x21')]=_0x4b988d[_0xe4c4('0x30')];if(_0x158432['count']===0x0)return[];return db[_0xe4c4('0x81')][_0xe4c4('0x3a')](_0x1e457c['toString'](),_0x43a4ff)['then'](function(_0x3de25d){_0x43201e=_[_0xe4c4('0x83')](_0x3de25d,'id');_0x43a4ff=_[_0xe4c4('0x84')](_0x43a4ff,{'model':db[_0xe4c4('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x57ba43['query'][_0xe4c4('0x3d')]){_0x33de43[_0xe4c4('0x3c')][_0xe4c4('0x68')](function(_0x5945b3){_0x260141['field']('c.'+_0x5945b3);});}else{_0x260141[_0xe4c4('0x44')](_0xe4c4('0x78'));_0x260141[_0xe4c4('0x44')](_0xe4c4('0x85'));_0x260141['field']('c.lastName');_0x260141[_0xe4c4('0x44')](_0xe4c4('0x86'));_0x260141[_0xe4c4('0x44')](_0xe4c4('0x87'));_0x260141[_0xe4c4('0x44')]('c.fax');_0x260141[_0xe4c4('0x44')]('c.email');_0x260141[_0xe4c4('0x44')](_0xe4c4('0x88'));_0x260141['field']('c.createdAt');_0x260141[_0xe4c4('0x44')](_0xe4c4('0x89'));_0x260141[_0xe4c4('0x44')](_0xe4c4('0x8a'));_0x260141[_0xe4c4('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x33de43['limit'])_0x260141[_0xe4c4('0x23')](_0x33de43[_0xe4c4('0x23')]);if(_0x33de43['offset'])_0x260141[_0xe4c4('0x22')](_0x33de43[_0xe4c4('0x22')]);return db[_0xe4c4('0x81')][_0xe4c4('0x3a')](_0x260141['toString'](),_0x43a4ff);});})['then'](function(_0x26d34d){_0x26d34d[_0xe4c4('0x68')](function(_0x5ad3f5){if(_0x5ad3f5[_0xe4c4('0x8b')]){_0x5ad3f5[_0xe4c4('0x8c')]=[];_0x5ad3f5[_0xe4c4('0x8b')][_0xe4c4('0x58')](',')['forEach'](function(_0x22e42a){_0x5ad3f5[_0xe4c4('0x8c')][_0xe4c4('0x66')](_0x43201e[_0x22e42a]);});}delete _0x5ad3f5[_0xe4c4('0x8b')];});_0x158432['rows']=_0x26d34d;return _0x158432;})[_0xe4c4('0x2a')](respondWithFilteredResult(_0x7428ad,_0x33de43));})[_0xe4c4('0x8d')](handleError(_0x7428ad,null));};exports[_0xe4c4('0x8e')]=function(_0x4647bb,_0x4dabb8){return db[_0xe4c4('0x2d')][_0xe4c4('0x55')]({'where':{'id':_0x4647bb['params']['id']}})['then'](handleEntityNotFound(_0x4dabb8,null))[_0xe4c4('0x2a')](removeEntity(_0x4dabb8,null))[_0xe4c4('0x8d')](handleError(_0x4dabb8,null));};exports[_0xe4c4('0x2e')]=function(_0xe30faf,_0x3d7d71){return db[_0xe4c4('0x2d')][_0xe4c4('0x2e')]()[_0xe4c4('0x2a')](function(_0x5b98fb){delete _0x5b98fb['tags'];for(var _0x14c41a=0x0;_0x14c41a=_0x11b4a3){_0x35eb5c=_0x11b4a3;_0xac51f5=0xc8;}else{_0xac51f5=0xce;}_0x5a0ae5[_0xbee5('0x1c')](_0xac51f5);return _0x5a0ae5[_0xbee5('0x21')](_0xbee5('0x22'),_0x3c3f4e+'-'+_0x35eb5c+'/'+_0x11b4a3)[_0xbee5('0x1d')](_0x538460);}return null;};}function patchUpdates(_0x450824){return function(_0x47af8e){try{jsonpatch['apply'](_0x47af8e,_0x450824,!![]);}catch(_0x469a7a){return BPromise['reject'](_0x469a7a);}return _0x47af8e[_0xbee5('0x23')]();};}function saveUpdates(_0x117cb3,_0x3cee7f){return function(_0x2bfb0f){if(_0x2bfb0f){return _0x2bfb0f[_0xbee5('0x24')](_0x117cb3)[_0xbee5('0x25')](function(_0x359ccf){return _0x359ccf;});}return null;};}function removeEntity(_0x3cfa8d,_0xc79035){return function(_0x520c02){if(_0x520c02){return _0x520c02['destroy']()['then'](function(){_0x3cfa8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af3de,_0x18d7f4){return function(_0x3b84c8){if(!_0x3b84c8){_0x1af3de[_0xbee5('0x1a')](0x194);}return _0x3b84c8;};}function handleError(_0x169042,_0x20e7e8){_0x20e7e8=_0x20e7e8||0x1f4;return function(_0x3c8643){logger['error'](_0x3c8643[_0xbee5('0x26')]);if(_0x3c8643[_0xbee5('0x27')]){delete _0x3c8643[_0xbee5('0x27')];}_0x169042[_0xbee5('0x1c')](_0x20e7e8)[_0xbee5('0x28')](_0x3c8643);};}exports['index']=function(_0x21b993,_0x15ffb1){var _0xb7a077={},_0x136a00={},_0xa57f85={'count':0x0,'rows':[]};return db[_0xbee5('0x29')][_0xbee5('0x2a')]()[_0xbee5('0x25')](function(_0x2ccb91){var _0x59c2e4=[];for(var _0x22df5f=0x0;_0x22df5f0x1){_0x4e6350['or'](_0xbee5('0x64'),qs[_0xbee5('0x65')](_0x2c0958),null);}else{if(qs[_0xbee5('0x66')](_0x2c0958)){_0x4e6350['or'](_0xbee5('0x67'),_0x2c0958+'%');_0x4e6350['or'](_0xbee5('0x68'),_0x2c0958+'%');_0x4e6350['or'](_0xbee5('0x69'),_0x2c0958+'%');_0x4e6350['or'](_0xbee5('0x6a'),_0x2c0958+'%');}else if(qs[_0xbee5('0x6b')](_0x2c0958)){_0x4e6350['or'](_0xbee5('0x6c'),_0x2c0958+'%');}else{_0x4e6350['or']('c.firstName\x20LIKE\x20?','%'+_0x2c0958+'%');_0x4e6350['or'](_0xbee5('0x6d'),'%'+_0x2c0958+'%');_0x4e6350['or']('c.email\x20LIKE\x20?','%'+_0x2c0958+'%');}}}}_0x426934['where'](_0x4e6350);_0x426934[_0xbee5('0x6e')](_0xbee5('0x6f'));var _0x54faee={'type':db['Sequelize'][_0xbee5('0x70')]['SELECT'],'raw':!![]};var _0x2fa95e=_0x426934[_0xbee5('0x71')]()['field'](_0xbee5('0x6f'));if(_0xb7a077[_0xbee5('0x3a')]){_0xb7a077[_0xbee5('0x3a')][_0xbee5('0x5d')](function(_0x5107d3){_0x426934[_0xbee5('0x3a')]('c.'+_0x5107d3[0x0],_0x5107d3[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbee5('0x72')](_0x51726a)){_0x426934[_0xbee5('0x73')](_0x1a2344);_0x2fa95e['where'](_0xbee5('0x74'),_0x51726a);}BPromise[_0xbee5('0x75')]()['then'](function(){if(!_0x5d36f5)return;if(_0x21b993[_0xbee5('0x76')][_0xbee5('0x77')]!=='agent')return;if(!_[_0xbee5('0x78')](_0x5d36f5['conditions'],[_0xbee5('0x40'),'User'])){return _0x21b993[_0xbee5('0x76')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x3120f5){if(_[_0xbee5('0x72')](_0x3120f5)){_0x2fa95e[_0xbee5('0x3c')](_0xbee5('0x79'));_0x426934[_0xbee5('0x3c')](_0xbee5('0x79'));}else{_0x2fa95e['where'](_0xbee5('0x5f'),_[_0xbee5('0x4f')](_0x3120f5,'id'));_0x426934[_0xbee5('0x3c')](_0xbee5('0x5f'),_[_0xbee5('0x4f')](_0x3120f5,'id'));}});}})[_0xbee5('0x25')](function(){if(_0x21b993[_0xbee5('0x76')][_0xbee5('0x77')]===_0xbee5('0x7a')&&!_0x5d36f5&&!_0x21b993['query'][_0xbee5('0x5e')])return[];return db[_0xbee5('0x7b')][_0xbee5('0x34')](_0x2fa95e[_0xbee5('0x7c')](),_0x54faee);})['then'](function(_0x13e84a){_0xa57f85[_0xbee5('0x1e')]=_0x13e84a[_0xbee5('0x2b')];if(_0xa57f85[_0xbee5('0x1e')]===0x0)return[];return db[_0xbee5('0x7b')][_0xbee5('0x34')](_0x297294[_0xbee5('0x7c')](),_0x54faee)[_0xbee5('0x25')](function(_0x37d516){_0x32513=_[_0xbee5('0x7d')](_0x37d516,'id');_0x54faee=_[_0xbee5('0x7e')](_0x54faee,{'model':db[_0xbee5('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21b993['query'][_0xbee5('0x36')]){_0xb7a077[_0xbee5('0x37')]['forEach'](function(_0x3612ee){_0x426934['field']('c.'+_0x3612ee);});}else{_0x426934[_0xbee5('0x40')](_0xbee5('0x6f'));_0x426934['field'](_0xbee5('0x7f'));_0x426934['field']('c.lastName');_0x426934['field']('c.phone');_0x426934['field']('c.mobile');_0x426934[_0xbee5('0x40')](_0xbee5('0x80'));_0x426934[_0xbee5('0x40')](_0xbee5('0x81'));_0x426934[_0xbee5('0x40')](_0xbee5('0x82'));_0x426934[_0xbee5('0x40')](_0xbee5('0x83'));_0x426934[_0xbee5('0x40')](_0xbee5('0x84'));_0x426934[_0xbee5('0x40')](_0xbee5('0x85'));_0x426934['field'](_0xbee5('0x86'),_0xbee5('0x87'));}if(_0xb7a077['limit'])_0x426934['limit'](_0xb7a077[_0xbee5('0x20')]);if(_0xb7a077[_0xbee5('0x1f')])_0x426934[_0xbee5('0x1f')](_0xb7a077['offset']);return db[_0xbee5('0x7b')][_0xbee5('0x34')](_0x426934[_0xbee5('0x7c')](),_0x54faee);});})['then'](function(_0x4d8e58){_0x4d8e58['forEach'](function(_0x3b0d82){if(_0x3b0d82[_0xbee5('0x87')]){_0x3b0d82[_0xbee5('0x88')]=[];_0x3b0d82[_0xbee5('0x87')][_0xbee5('0x4e')](',')[_0xbee5('0x5d')](function(_0x3e86e8){_0x3b0d82[_0xbee5('0x88')]['push'](_0x32513[_0x3e86e8]);});}delete _0x3b0d82['TagIds'];});_0xa57f85[_0xbee5('0x89')]=_0x4d8e58;return _0xa57f85;})[_0xbee5('0x25')](respondWithFilteredResult(_0x15ffb1,_0xb7a077));})['catch'](handleError(_0x15ffb1,null));};exports['destroy']=function(_0x44738d,_0x5985b4){return db['CmContact'][_0xbee5('0x4c')]({'where':{'id':_0x44738d['params']['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x5985b4,null))[_0xbee5('0x25')](removeEntity(_0x5985b4,null))['catch'](handleError(_0x5985b4,null));};exports[_0xbee5('0x2a')]=function(_0x1a94f1,_0x122ccf){return db[_0xbee5('0x29')][_0xbee5('0x2a')]()['then'](function(_0x5b5603){delete _0x5b5603[_0xbee5('0x8a')];for(var _0x5219a4=0x0;_0x5219a4{}\s\\|]/g,'-');_0x5ab592(null,util[_0x0f29('0x21')]('%s-%s%s',path[_0x0f29('0x22')](_0x5a5a03[_0x0f29('0x23')],path[_0x0f29('0x24')](_0x5a5a03[_0x0f29('0x23')])),Date[_0x0f29('0x25')](),path['extname'](_0x5a5a03[_0x0f29('0x23')])));}})});router['post'](_0x0f29('0x26'),upload[_0x0f29('0x27')](_0x0f29('0x28')),controller[_0x0f29('0x29')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13a2c7,_0x540d72,_0x58b201){_0x58b201(null,path[_0x0f29('0x1e')](config['root'],'server/files/tmp'));},'filename':function(_0x57dcc7,_0x4dd0b0,_0x3c6ce9){_0x4dd0b0[_0x0f29('0x23')]=_0x4dd0b0['originalname'][_0x0f29('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c6ce9(null,util[_0x0f29('0x21')](_0x0f29('0x2a'),path['basename'](_0x4dd0b0['originalname'],path[_0x0f29('0x24')](_0x4dd0b0['originalname'])),Date[_0x0f29('0x25')](),path['extname'](_0x4dd0b0['originalname'])));}})});router[_0x0f29('0x17')](_0x0f29('0x2b'),upload[_0x0f29('0x27')](_0x0f29('0x28')),controller['upload']);router['post'](_0x0f29('0x2c'),auth['isAuthenticated'](),controller['import']);router[_0x0f29('0x2d')]('/:id',auth[_0x0f29('0x7')](),controller['update']);router['delete'](_0x0f29('0xb'),auth[_0x0f29('0x7')](),controller[_0x0f29('0x2e')]);module[_0x0f29('0x2f')]=router; \ No newline at end of file +var _0x48bc=['import','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','diskStorage','format','/upload','upload','/upload/:id'];(function(_0x462545,_0x3c0f1b){var _0x680d51=function(_0x22727b){while(--_0x22727b){_0x462545['push'](_0x462545['shift']());}};_0x680d51(++_0x3c0f1b);}(_0x48bc,0x1b6));var _0xc48b=function(_0x4df67c,_0x5a658d){_0x4df67c=_0x4df67c-0x0;var _0x23ecb8=_0x48bc[_0x4df67c];return _0x23ecb8;};'use strict';var multer=require(_0xc48b('0x0'));var util=require(_0xc48b('0x1'));var path=require(_0xc48b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc48b('0x3'));var router=express[_0xc48b('0x4')]();var auth=require(_0xc48b('0x5'));var interaction=require(_0xc48b('0x6'));var config=require(_0xc48b('0x7'));var controller=require(_0xc48b('0x8'));router[_0xc48b('0x9')]('/',auth['isAuthenticated'](),controller[_0xc48b('0xa')]);router['get'](_0xc48b('0xb'),auth[_0xc48b('0xc')](),controller['describe']);router[_0xc48b('0x9')]('/:id',auth[_0xc48b('0xc')](),controller[_0xc48b('0xd')]);router['get'](_0xc48b('0xe'),auth[_0xc48b('0xc')](),controller[_0xc48b('0xf')]);router[_0xc48b('0x9')](_0xc48b('0x10'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x11')]);router[_0xc48b('0x9')](_0xc48b('0x12'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x13')]);router[_0xc48b('0x9')]('/:id/hopper_finals',auth[_0xc48b('0xc')](),controller[_0xc48b('0x14')]);router[_0xc48b('0x9')]('/:id/jscripty_sessions',auth[_0xc48b('0xc')](),controller[_0xc48b('0x15')]);router[_0xc48b('0x9')](_0xc48b('0x16'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x17')]);router[_0xc48b('0x18')](_0xc48b('0x19'),auth['isAuthenticated'](),controller[_0xc48b('0x1a')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc48b('0x1b')]);router['post'](_0xc48b('0x1c'),auth['isAuthenticated'](),controller[_0xc48b('0x1d')]);router['post'](_0xc48b('0xe'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51eede,_0x12b34f,_0x4a2997){_0x4a2997(null,path[_0xc48b('0x1f')](config[_0xc48b('0x20')],_0xc48b('0x21')));},'filename':function(_0x44762e,_0x38799f,_0x8a3a7b){_0x38799f[_0xc48b('0x22')]=_0x38799f[_0xc48b('0x22')][_0xc48b('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8a3a7b(null,util['format'](_0xc48b('0x24'),path[_0xc48b('0x25')](_0x38799f[_0xc48b('0x22')],path[_0xc48b('0x26')](_0x38799f[_0xc48b('0x22')])),Date[_0xc48b('0x27')](),path[_0xc48b('0x26')](_0x38799f[_0xc48b('0x22')])));}})});router[_0xc48b('0x18')](_0xc48b('0x28'),upload[_0xc48b('0x29')](_0xc48b('0x2a')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xc48b('0x2b')]({'destination':function(_0x13869d,_0x3be806,_0x182b02){_0x182b02(null,path[_0xc48b('0x1f')](config[_0xc48b('0x20')],_0xc48b('0x21')));},'filename':function(_0x5659a3,_0x32ef49,_0x57fe66){_0x32ef49['originalname']=_0x32ef49['originalname'][_0xc48b('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57fe66(null,util[_0xc48b('0x2c')](_0xc48b('0x24'),path[_0xc48b('0x25')](_0x32ef49[_0xc48b('0x22')],path['extname'](_0x32ef49['originalname'])),Date[_0xc48b('0x27')](),path[_0xc48b('0x26')](_0x32ef49['originalname'])));}})});router[_0xc48b('0x18')](_0xc48b('0x2d'),upload[_0xc48b('0x29')](_0xc48b('0x2a')),controller[_0xc48b('0x2e')]);router[_0xc48b('0x18')](_0xc48b('0x2f'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x30')]);router['put'](_0xc48b('0x31'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x32')]);router[_0xc48b('0x33')](_0xc48b('0x31'),auth[_0xc48b('0xc')](),controller[_0xc48b('0x34')]);module[_0xc48b('0x35')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 6fea421..f282f8c 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 _0x4c6d=['values','isArray','setDataValue','stringify','ENUM','sequelize','lodash','exports','VIRTUAL','alias','STRING','getDataValue','TEXT','long','type','select','parse'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x4a7de4,_0x3c759a){_0x4a7de4=_0x4a7de4-0x0;var _0x428672=_0x4c6d[_0x4a7de4];return _0x428672;};'use strict';var Sequelize=require(_0xd4c6('0x0'));var _=require(_0xd4c6('0x1'));module[_0xd4c6('0x2')]={'name':{'type':Sequelize[_0xd4c6('0x3')],'get':function(_0x350cc0){return this['getDataValue'](_0xd4c6('0x4'));}},'alias':{'type':Sequelize[_0xd4c6('0x5')],'allowNull':![],'set':function(_0x306766){this['setDataValue'](_0xd4c6('0x4'),_0x306766?_0x306766:this[_0xd4c6('0x6')]('name'));}},'type':{'type':Sequelize[_0xd4c6('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xd4c6('0x7')](_0xd4c6('0x8')),'get':function(){if(this['getDataValue'](_0xd4c6('0x9'))===_0xd4c6('0xa')){return JSON[_0xd4c6('0xb')](this['getDataValue'](_0xd4c6('0xc')));}else{return this[_0xd4c6('0x6')](_0xd4c6('0xc'));}},'set':function(_0x5b53b5){if(Array[_0xd4c6('0xd')](_0x5b53b5)){this[_0xd4c6('0xe')](_0xd4c6('0xc'),JSON[_0xd4c6('0xf')](_0x5b53b5));}else{this[_0xd4c6('0xe')](_0xd4c6('0xc'),_0x5b53b5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd4c6('0x10')]('voice')}}; \ No newline at end of file +var _0x3c17=['alias','setDataValue','STRING','long','type','values','isArray','BOOLEAN','voice','sequelize','exports','getDataValue'];(function(_0x1415c4,_0x167c9f){var _0x38fd52=function(_0x56a721){while(--_0x56a721){_0x1415c4['push'](_0x1415c4['shift']());}};_0x38fd52(++_0x167c9f);}(_0x3c17,0x1a1));var _0x73c1=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3c17[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x73c1('0x0'));var _=require('lodash');module[_0x73c1('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1a088c){return this[_0x73c1('0x2')](_0x73c1('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3a00a0){this[_0x73c1('0x4')](_0x73c1('0x3'),_0x3a00a0?_0x3a00a0:this[_0x73c1('0x2')]('name'));}},'type':{'type':Sequelize[_0x73c1('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x73c1('0x6')),'get':function(){if(this[_0x73c1('0x2')](_0x73c1('0x7'))==='select'){return JSON['parse'](this[_0x73c1('0x2')](_0x73c1('0x8')));}else{return this[_0x73c1('0x2')](_0x73c1('0x8'));}},'set':function(_0x2b2578){if(Array[_0x73c1('0x9')](_0x2b2578)){this[_0x73c1('0x4')]('values',JSON['stringify'](_0x2b2578));}else{this[_0x73c1('0x4')](_0x73c1('0x8'),_0x2b2578);}}},'required':{'type':Sequelize[_0x73c1('0xa')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x73c1('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x73c1('0xb'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ddf40d1..a08fae7 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 _0x84cc=['catch','show','params','keys','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','update','then','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x35fbd9,_0x5e9248){var _0x4f96b7=function(_0x2ac841){while(--_0x2ac841){_0x35fbd9['push'](_0x35fbd9['shift']());}};_0x4f96b7(++_0x5e9248);}(_0x84cc,0x1c6));var _0xc84c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x84cc[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0xc84c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc84c('0x1'));var zipdir=require(_0xc84c('0x2'));var jsonpatch=require(_0xc84c('0x3'));var rp=require('request-promise');var moment=require(_0xc84c('0x4'));var BPromise=require(_0xc84c('0x5'));var Mustache=require(_0xc84c('0x6'));var util=require('util');var path=require(_0xc84c('0x7'));var sox=require(_0xc84c('0x8'));var csv=require(_0xc84c('0x9'));var ejs=require(_0xc84c('0xa'));var fs=require('fs');var _=require(_0xc84c('0xb'));var squel=require(_0xc84c('0xc'));var crypto=require(_0xc84c('0xd'));var jsforce=require(_0xc84c('0xe'));var deskjs=require(_0xc84c('0xf'));var toCsv=require(_0xc84c('0x9'));var querystring=require(_0xc84c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc84c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc84c('0x12'));var hardwareService=require(_0xc84c('0x13'));var logger=require(_0xc84c('0x14'))(_0xc84c('0x15'));var utils=require('../../config/utils');var config=require(_0xc84c('0x16'));var licenseUtil=require(_0xc84c('0x17'));var db=require(_0xc84c('0x18'))['db'];function respondWithStatusCode(_0x25e5e0,_0x10aa98){_0x10aa98=_0x10aa98||0xcc;return function(_0x19a29c){if(_0x19a29c){return _0x25e5e0[_0xc84c('0x19')](_0x10aa98);}return _0x25e5e0[_0xc84c('0x1a')](_0x10aa98)[_0xc84c('0x1b')]();};}function respondWithResult(_0x584e49,_0x59b499){_0x59b499=_0x59b499||0xc8;return function(_0x13ecd5){if(_0x13ecd5){return _0x584e49[_0xc84c('0x1a')](_0x59b499)[_0xc84c('0x1c')](_0x13ecd5);}};}function respondWithFilteredResult(_0x1360fd,_0x3f5fd8){return function(_0x190672){if(_0x190672){var _0x5e2aca=_0x190672[_0xc84c('0x1d')],_0x254c98=_0x3f5fd8[_0xc84c('0x1e')],_0xa7d8f=_0x3f5fd8[_0xc84c('0x1e')]+_0x3f5fd8['limit'],_0x11deb4;if(_0xa7d8f>=_0x5e2aca){_0xa7d8f=_0x5e2aca;_0x11deb4=0xc8;}else{_0x11deb4=0xce;}_0x1360fd[_0xc84c('0x1a')](_0x11deb4);return _0x1360fd[_0xc84c('0x1f')]('Content-Range',_0x254c98+'-'+_0xa7d8f+'/'+_0x5e2aca)[_0xc84c('0x1c')](_0x190672);}return null;};}function patchUpdates(_0x2472b8){return function(_0xefd72){try{jsonpatch[_0xc84c('0x20')](_0xefd72,_0x2472b8,!![]);}catch(_0x526e8b){return BPromise['reject'](_0x526e8b);}return _0xefd72['save']();};}function saveUpdates(_0x3ebdba,_0x335d36){return function(_0x51df73){if(_0x51df73){return _0x51df73[_0xc84c('0x21')](_0x3ebdba)[_0xc84c('0x22')](function(_0x209390){return _0x209390;});}return null;};}function removeEntity(_0x135d89,_0x4dcc3f){return function(_0x46a8a1){if(_0x46a8a1){return _0x46a8a1['destroy']()['then'](function(){_0x135d89['status'](0xcc)[_0xc84c('0x1b')]();});}};}function handleEntityNotFound(_0x530fc3,_0x82a841){return function(_0x206a7a){if(!_0x206a7a){_0x530fc3[_0xc84c('0x19')](0x194);}return _0x206a7a;};}function handleError(_0xe22c9a,_0x47466e){_0x47466e=_0x47466e||0x1f4;return function(_0x2dc122){logger[_0xc84c('0x23')](_0x2dc122[_0xc84c('0x24')]);if(_0x2dc122[_0xc84c('0x25')]){delete _0x2dc122[_0xc84c('0x25')];}_0xe22c9a[_0xc84c('0x1a')](_0x47466e)[_0xc84c('0x26')](_0x2dc122);};}exports[_0xc84c('0x27')]=function(_0x550d8b,_0x33f929){var _0x338f81={},_0x508d={},_0x4738ed={'count':0x0,'rows':[]};var _0x348d64=_['map'](db[_0xc84c('0x28')][_0xc84c('0x29')],function(_0xb45743){return{'name':_0xb45743[_0xc84c('0x2a')],'type':_0xb45743[_0xc84c('0x2b')][_0xc84c('0x2c')]};});_0x508d[_0xc84c('0x2d')]=_[_0xc84c('0x2e')](_['map'](_0x348d64,_0xc84c('0x25')),[_0xc84c('0x25')]);_0x508d['query']=_['keys'](_0x550d8b[_0xc84c('0x2f')]);_0x508d[_0xc84c('0x30')]=_[_0xc84c('0x31')](_0x508d[_0xc84c('0x2d')],_0x508d[_0xc84c('0x2f')]);_0x338f81['attributes']=_['intersection'](_0x508d[_0xc84c('0x2d')],qs['fields'](_0x550d8b['query'][_0xc84c('0x32')]));_0x338f81[_0xc84c('0x33')]=_0x338f81[_0xc84c('0x33')][_0xc84c('0x34')]?_0x338f81[_0xc84c('0x33')]:_0x508d[_0xc84c('0x2d')];if(!_0x550d8b[_0xc84c('0x2f')][_0xc84c('0x35')](_0xc84c('0x36'))){_0x338f81[_0xc84c('0x37')]=qs[_0xc84c('0x37')](_0x550d8b[_0xc84c('0x2f')]['limit']);_0x338f81['offset']=qs['offset'](_0x550d8b[_0xc84c('0x2f')][_0xc84c('0x1e')]);}_0x338f81[_0xc84c('0x38')]=qs[_0xc84c('0x39')](_0x550d8b[_0xc84c('0x2f')][_0xc84c('0x39')]);_0x338f81[_0xc84c('0x3a')]=qs[_0xc84c('0x30')](_[_0xc84c('0x3b')](_0x550d8b[_0xc84c('0x2f')],_0x508d[_0xc84c('0x30')]),_0x348d64);if(_0x550d8b[_0xc84c('0x2f')][_0xc84c('0x3c')]){_0x338f81[_0xc84c('0x3a')]=_[_0xc84c('0x3d')](_0x338f81[_0xc84c('0x3a')],{'$or':_['map'](_0x348d64,function(_0x88a6e9){if(_0x88a6e9[_0xc84c('0x2b')]!==_0xc84c('0x3e')){var _0x31f259={};_0x31f259[_0x88a6e9[_0xc84c('0x25')]]={'$like':'%'+_0x550d8b['query']['filter']+'%'};return _0x31f259;}})});}_0x338f81=_[_0xc84c('0x3d')]({},_0x338f81,_0x550d8b[_0xc84c('0x3f')]);var _0x5ef37b={'where':_0x338f81[_0xc84c('0x3a')]};return db['CmCustomField'][_0xc84c('0x1d')](_0x5ef37b)[_0xc84c('0x22')](function(_0x34eb08){_0x4738ed['count']=_0x34eb08;if(_0x550d8b[_0xc84c('0x2f')][_0xc84c('0x40')]){_0x338f81[_0xc84c('0x41')]=[{'all':!![]}];}return db[_0xc84c('0x28')][_0xc84c('0x42')](_0x338f81);})[_0xc84c('0x22')](function(_0x40c4d0){_0x4738ed[_0xc84c('0x43')]=_0x40c4d0;return _0x4738ed;})[_0xc84c('0x22')](respondWithFilteredResult(_0x33f929,_0x338f81))[_0xc84c('0x44')](handleError(_0x33f929,null));};exports[_0xc84c('0x45')]=function(_0x5d2363,_0x51d506){var _0x13756f={'raw':!![],'where':{'id':_0x5d2363[_0xc84c('0x46')]['id']}},_0x119548={};_0x119548['model']=_['keys'](db['CmCustomField']['rawAttributes']);_0x119548[_0xc84c('0x2f')]=_[_0xc84c('0x47')](_0x5d2363[_0xc84c('0x2f')]);_0x119548['filters']=_[_0xc84c('0x31')](_0x119548[_0xc84c('0x2d')],_0x119548[_0xc84c('0x2f')]);_0x13756f['attributes']=_[_0xc84c('0x31')](_0x119548[_0xc84c('0x2d')],qs[_0xc84c('0x32')](_0x5d2363['query'][_0xc84c('0x32')]));_0x13756f['attributes']=_0x13756f[_0xc84c('0x33')]['length']?_0x13756f['attributes']:_0x119548[_0xc84c('0x2d')];if(_0x5d2363[_0xc84c('0x2f')][_0xc84c('0x40')]){_0x13756f[_0xc84c('0x41')]=[{'all':!![]}];}_0x13756f=_[_0xc84c('0x3d')]({},_0x13756f,_0x5d2363['options']);return db[_0xc84c('0x28')][_0xc84c('0x48')](_0x13756f)[_0xc84c('0x22')](handleEntityNotFound(_0x51d506,null))[_0xc84c('0x22')](respondWithResult(_0x51d506,null))[_0xc84c('0x44')](handleError(_0x51d506,null));};exports[_0xc84c('0x21')]=function(_0xfb373c,_0x750e51){if(_0xfb373c[_0xc84c('0x49')]['id']){delete _0xfb373c[_0xc84c('0x49')]['id'];}return db[_0xc84c('0x28')][_0xc84c('0x48')]({'where':{'id':_0xfb373c['params']['id']}})['then'](handleEntityNotFound(_0x750e51,null))[_0xc84c('0x22')](saveUpdates(_0xfb373c[_0xc84c('0x49')],null))[_0xc84c('0x22')](respondWithResult(_0x750e51,null))['catch'](handleError(_0x750e51,null));};exports['destroy']=function(_0xf661cb,_0x545b66){return db[_0xc84c('0x28')][_0xc84c('0x48')]({'where':{'id':_0xf661cb['params']['id']}})[_0xc84c('0x22')](handleEntityNotFound(_0x545b66,null))[_0xc84c('0x22')](removeEntity(_0x545b66,null))['catch'](handleError(_0x545b66,null));};exports[_0xc84c('0x4a')]=function(_0x29f704,_0x2cb1e0){var _0x43f95a;return db[_0xc84c('0x4b')][_0xc84c('0x4c')](function(_0x479b4a){return db[_0xc84c('0x28')][_0xc84c('0x4a')](_0x29f704['body'],{'transaction':_0x479b4a})[_0xc84c('0x22')](function(_0x20a46a){_0x43f95a=_0x20a46a;var _0x2802cd={'type':db[_0xc84c('0x4d')][_0xc84c('0x4e')],'transaction':_0x479b4a};switch(_0x29f704[_0xc84c('0x49')][_0xc84c('0x2b')]){case _0xc84c('0x4f'):_0x2802cd[_0xc84c('0x2b')]=db[_0xc84c('0x4d')]['TEXT'];break;case _0xc84c('0x50'):_0x2802cd[_0xc84c('0x2b')]=db[_0xc84c('0x4d')]['INTEGER'];break;case _0xc84c('0x51'):_0x2802cd[_0xc84c('0x2b')]=db['Sequelize']['BOOLEAN'];_0x2802cd[_0xc84c('0x52')]=![];break;default:}return db[_0xc84c('0x4b')][_0xc84c('0x53')][_0xc84c('0x54')](_0xc84c('0x55'),util[_0xc84c('0x56')]('cf_%d',_0x43f95a['id']),_0x2802cd);})['then'](function(){return _0x43f95a;});})[_0xc84c('0x22')](respondWithResult(_0x2cb1e0,0xc9))[_0xc84c('0x44')](handleError(_0x2cb1e0,null));}; \ No newline at end of file +var _0x9517=['body','find','create','sequelize','transaction','TEXT','number','Sequelize','switch','defaultValue','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','CmCustomField','includeAll','include','findAll','catch','show','params','keys'];(function(_0x4f48a6,_0x3b0514){var _0x2fb6a5=function(_0x488763){while(--_0x488763){_0x4f48a6['push'](_0x4f48a6['shift']());}};_0x2fb6a5(++_0x3b0514);}(_0x9517,0x109));var _0x7951=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9517[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x7951('0x0'));var emlformat=require(_0x7951('0x1'));var rimraf=require(_0x7951('0x2'));var zipdir=require(_0x7951('0x3'));var jsonpatch=require(_0x7951('0x4'));var rp=require(_0x7951('0x5'));var moment=require(_0x7951('0x6'));var BPromise=require(_0x7951('0x7'));var Mustache=require(_0x7951('0x8'));var util=require(_0x7951('0x9'));var path=require(_0x7951('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7951('0xb'));var crypto=require(_0x7951('0xc'));var jsforce=require(_0x7951('0xd'));var deskjs=require(_0x7951('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7951('0xf'));var Papa=require(_0x7951('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7951('0x11'));var as=require(_0x7951('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7951('0x13'))(_0x7951('0x14'));var utils=require('../../config/utils');var config=require(_0x7951('0x15'));var licenseUtil=require(_0x7951('0x16'));var db=require(_0x7951('0x17'))['db'];function respondWithStatusCode(_0x1a32a5,_0x35bb4c){_0x35bb4c=_0x35bb4c||0xcc;return function(_0x6a3ef2){if(_0x6a3ef2){return _0x1a32a5['sendStatus'](_0x35bb4c);}return _0x1a32a5[_0x7951('0x18')](_0x35bb4c)[_0x7951('0x19')]();};}function respondWithResult(_0x5a13d4,_0x5e593a){_0x5e593a=_0x5e593a||0xc8;return function(_0xaaa9c2){if(_0xaaa9c2){return _0x5a13d4[_0x7951('0x18')](_0x5e593a)[_0x7951('0x1a')](_0xaaa9c2);}};}function respondWithFilteredResult(_0x4264a8,_0x3edf74){return function(_0x48d8b7){if(_0x48d8b7){var _0x46d3f1=_0x48d8b7[_0x7951('0x1b')],_0x3fdc9e=_0x3edf74[_0x7951('0x1c')],_0x25cfe6=_0x3edf74[_0x7951('0x1c')]+_0x3edf74[_0x7951('0x1d')],_0x421e4b;if(_0x25cfe6>=_0x46d3f1){_0x25cfe6=_0x46d3f1;_0x421e4b=0xc8;}else{_0x421e4b=0xce;}_0x4264a8[_0x7951('0x18')](_0x421e4b);return _0x4264a8[_0x7951('0x1e')](_0x7951('0x1f'),_0x3fdc9e+'-'+_0x25cfe6+'/'+_0x46d3f1)['json'](_0x48d8b7);}return null;};}function patchUpdates(_0x2bfaad){return function(_0x4cec3c){try{jsonpatch[_0x7951('0x20')](_0x4cec3c,_0x2bfaad,!![]);}catch(_0x418cc4){return BPromise['reject'](_0x418cc4);}return _0x4cec3c['save']();};}function saveUpdates(_0x5c3d11,_0x2892c5){return function(_0x38ba36){if(_0x38ba36){return _0x38ba36[_0x7951('0x21')](_0x5c3d11)['then'](function(_0x334636){return _0x334636;});}return null;};}function removeEntity(_0xfe0e24,_0x4eace9){return function(_0xe99d6e){if(_0xe99d6e){return _0xe99d6e[_0x7951('0x22')]()[_0x7951('0x23')](function(){_0xfe0e24['status'](0xcc)[_0x7951('0x19')]();});}};}function handleEntityNotFound(_0x17271c,_0x21296a){return function(_0x391e1d){if(!_0x391e1d){_0x17271c['sendStatus'](0x194);}return _0x391e1d;};}function handleError(_0x1a3b9a,_0x2569da){_0x2569da=_0x2569da||0x1f4;return function(_0x4e3e7d){logger[_0x7951('0x24')](_0x4e3e7d[_0x7951('0x25')]);if(_0x4e3e7d[_0x7951('0x26')]){delete _0x4e3e7d['name'];}_0x1a3b9a[_0x7951('0x18')](_0x2569da)[_0x7951('0x27')](_0x4e3e7d);};}exports[_0x7951('0x28')]=function(_0x46e604,_0x11ca80){var _0x4cac4f={},_0x20e79b={},_0x4f2922={'count':0x0,'rows':[]};var _0x425616=_[_0x7951('0x29')](db['CmCustomField'][_0x7951('0x2a')],function(_0x3fdc3d){return{'name':_0x3fdc3d[_0x7951('0x2b')],'type':_0x3fdc3d[_0x7951('0x2c')][_0x7951('0x2d')]};});_0x20e79b[_0x7951('0x2e')]=_[_0x7951('0x2f')](_[_0x7951('0x29')](_0x425616,'name'),['name']);_0x20e79b['query']=_['keys'](_0x46e604[_0x7951('0x30')]);_0x20e79b['filters']=_[_0x7951('0x31')](_0x20e79b['model'],_0x20e79b['query']);_0x4cac4f[_0x7951('0x32')]=_[_0x7951('0x31')](_0x20e79b['model'],qs[_0x7951('0x33')](_0x46e604[_0x7951('0x30')]['fields']));_0x4cac4f['attributes']=_0x4cac4f[_0x7951('0x32')][_0x7951('0x34')]?_0x4cac4f[_0x7951('0x32')]:_0x20e79b[_0x7951('0x2e')];if(!_0x46e604['query'][_0x7951('0x35')](_0x7951('0x36'))){_0x4cac4f[_0x7951('0x1d')]=qs[_0x7951('0x1d')](_0x46e604['query'][_0x7951('0x1d')]);_0x4cac4f[_0x7951('0x1c')]=qs[_0x7951('0x1c')](_0x46e604[_0x7951('0x30')][_0x7951('0x1c')]);}_0x4cac4f['order']=qs[_0x7951('0x37')](_0x46e604['query']['sort']);_0x4cac4f['where']=qs[_0x7951('0x38')](_[_0x7951('0x39')](_0x46e604[_0x7951('0x30')],_0x20e79b[_0x7951('0x38')]),_0x425616);if(_0x46e604[_0x7951('0x30')]['filter']){_0x4cac4f[_0x7951('0x3a')]=_[_0x7951('0x3b')](_0x4cac4f[_0x7951('0x3a')],{'$or':_[_0x7951('0x29')](_0x425616,function(_0x1f375a){if(_0x1f375a[_0x7951('0x2c')]!==_0x7951('0x3c')){var _0x46ed92={};_0x46ed92[_0x1f375a[_0x7951('0x26')]]={'$like':'%'+_0x46e604[_0x7951('0x30')][_0x7951('0x3d')]+'%'};return _0x46ed92;}})});}_0x4cac4f=_[_0x7951('0x3b')]({},_0x4cac4f,_0x46e604[_0x7951('0x3e')]);var _0x9b308d={'where':_0x4cac4f['where']};return db[_0x7951('0x3f')][_0x7951('0x1b')](_0x9b308d)[_0x7951('0x23')](function(_0x47ba56){_0x4f2922[_0x7951('0x1b')]=_0x47ba56;if(_0x46e604['query'][_0x7951('0x40')]){_0x4cac4f[_0x7951('0x41')]=[{'all':!![]}];}return db[_0x7951('0x3f')][_0x7951('0x42')](_0x4cac4f);})[_0x7951('0x23')](function(_0x5b26c9){_0x4f2922['rows']=_0x5b26c9;return _0x4f2922;})[_0x7951('0x23')](respondWithFilteredResult(_0x11ca80,_0x4cac4f))[_0x7951('0x43')](handleError(_0x11ca80,null));};exports[_0x7951('0x44')]=function(_0x31f47d,_0x391e06){var _0x45882a={'raw':!![],'where':{'id':_0x31f47d[_0x7951('0x45')]['id']}},_0x1874f5={};_0x1874f5[_0x7951('0x2e')]=_[_0x7951('0x46')](db[_0x7951('0x3f')][_0x7951('0x2a')]);_0x1874f5['query']=_[_0x7951('0x46')](_0x31f47d['query']);_0x1874f5[_0x7951('0x38')]=_['intersection'](_0x1874f5['model'],_0x1874f5[_0x7951('0x30')]);_0x45882a[_0x7951('0x32')]=_[_0x7951('0x31')](_0x1874f5['model'],qs['fields'](_0x31f47d[_0x7951('0x30')][_0x7951('0x33')]));_0x45882a[_0x7951('0x32')]=_0x45882a['attributes'][_0x7951('0x34')]?_0x45882a[_0x7951('0x32')]:_0x1874f5[_0x7951('0x2e')];if(_0x31f47d[_0x7951('0x30')][_0x7951('0x40')]){_0x45882a[_0x7951('0x41')]=[{'all':!![]}];}_0x45882a=_['merge']({},_0x45882a,_0x31f47d['options']);return db[_0x7951('0x3f')]['find'](_0x45882a)[_0x7951('0x23')](handleEntityNotFound(_0x391e06,null))[_0x7951('0x23')](respondWithResult(_0x391e06,null))[_0x7951('0x43')](handleError(_0x391e06,null));};exports[_0x7951('0x21')]=function(_0xcef13a,_0x46327e){if(_0xcef13a[_0x7951('0x47')]['id']){delete _0xcef13a[_0x7951('0x47')]['id'];}return db[_0x7951('0x3f')][_0x7951('0x48')]({'where':{'id':_0xcef13a['params']['id']}})[_0x7951('0x23')](handleEntityNotFound(_0x46327e,null))[_0x7951('0x23')](saveUpdates(_0xcef13a[_0x7951('0x47')],null))[_0x7951('0x23')](respondWithResult(_0x46327e,null))[_0x7951('0x43')](handleError(_0x46327e,null));};exports[_0x7951('0x22')]=function(_0xb42b45,_0x1ffc4f){return db[_0x7951('0x3f')][_0x7951('0x48')]({'where':{'id':_0xb42b45[_0x7951('0x45')]['id']}})[_0x7951('0x23')](handleEntityNotFound(_0x1ffc4f,null))[_0x7951('0x23')](removeEntity(_0x1ffc4f,null))[_0x7951('0x43')](handleError(_0x1ffc4f,null));};exports[_0x7951('0x49')]=function(_0x439a15,_0x15da64){var _0x24e375;return db[_0x7951('0x4a')][_0x7951('0x4b')](function(_0x3099b0){return db[_0x7951('0x3f')][_0x7951('0x49')](_0x439a15[_0x7951('0x47')],{'transaction':_0x3099b0})[_0x7951('0x23')](function(_0x51b3a3){_0x24e375=_0x51b3a3;var _0x113a72={'type':db['Sequelize'][_0x7951('0x4c')],'transaction':_0x3099b0};switch(_0x439a15[_0x7951('0x47')][_0x7951('0x2c')]){case'text':_0x113a72[_0x7951('0x2c')]=db['Sequelize']['TEXT'];break;case _0x7951('0x4d'):_0x113a72[_0x7951('0x2c')]=db[_0x7951('0x4e')]['INTEGER'];break;case _0x7951('0x4f'):_0x113a72[_0x7951('0x2c')]=db['Sequelize']['BOOLEAN'];_0x113a72[_0x7951('0x50')]=![];break;default:}return db[_0x7951('0x4a')]['queryInterface'][_0x7951('0x51')](_0x7951('0x52'),util['format'](_0x7951('0x53'),_0x24e375['id']),_0x113a72);})[_0x7951('0x23')](function(){return _0x24e375;});})[_0x7951('0x23')](respondWithResult(_0x15da64,0xc9))[_0x7951('0x43')](handleError(_0x15da64,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 97638ce..d08e3bf 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 _0x16e0=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCustomField.attributes','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x16e0,0x12e));var _0x016e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x016e('0x0'));var util=require(_0x016e('0x1'));var logger=require(_0x016e('0x2'))(_0x016e('0x3'));var moment=require(_0x016e('0x4'));var BPromise=require('bluebird');var rp=require(_0x016e('0x5'));var fs=require('fs');var path=require(_0x016e('0x6'));var rimraf=require(_0x016e('0x7'));var config=require('../../config/environment');var attributes=require(_0x016e('0x8'));module[_0x016e('0x9')]=function(_0x159f8e,_0x505af1){return _0x159f8e[_0x016e('0xa')](_0x016e('0xb'),attributes,{'tableName':_0x016e('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75fd=['CmCustomField','cm_custom_fields','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','define'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x75fd,0x183));var _0xd75f=function(_0x3024ef,_0x1ac3e9){_0x3024ef=_0x3024ef-0x0;var _0x1ca3d6=_0x75fd[_0x3024ef];return _0x1ca3d6;};'use strict';var _=require('lodash');var util=require(_0xd75f('0x0'));var logger=require('../../config/logger')(_0xd75f('0x1'));var moment=require(_0xd75f('0x2'));var BPromise=require(_0xd75f('0x3'));var rp=require(_0xd75f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd75f('0x5'));var config=require(_0xd75f('0x6'));var attributes=require(_0xd75f('0x7'));module['exports']=function(_0x16a6fb,_0x16955e){return _0x16a6fb[_0xd75f('0x8')](_0xd75f('0x9'),attributes,{'tableName':_0xd75f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 66b5cb9..fb4a669 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 _0x5c12=['../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x5c12,0x188));var _0x25c1=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x5c12[_0x1a9e78];return _0x113e06;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('CmCustomField,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('CmCustomField,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xe5b3,0x133));var _0x3e5b=function(_0x566c11,_0x4cc982){_0x566c11=_0x566c11-0x0;var _0x266e48=_0xe5b3[_0x566c11];return _0x266e48;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('CmCustomField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('CmCustomField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5ac2d3c..1a38cd4 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 _0xa5d7=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','show','put','/:id'];(function(_0x37cd60,_0x21961e){var _0x148b8b=function(_0x3a761e){while(--_0x3a761e){_0x37cd60['push'](_0x37cd60['shift']());}};_0x148b8b(++_0x21961e);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x4a5246,_0x3e9b8a){_0x4a5246=_0x4a5246-0x0;var _0x49f9a7=_0xa5d7[_0x4a5246];return _0x49f9a7;};'use strict';var multer=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var path=require(_0x7a5d('0x2'));var timeout=require(_0x7a5d('0x3'));var express=require('express');var router=express[_0x7a5d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a5d('0x5'));var config=require('../../config/environment');var controller=require(_0x7a5d('0x6'));router['get']('/',auth[_0x7a5d('0x7')](),controller[_0x7a5d('0x8')]);router[_0x7a5d('0x9')]('/:id',auth[_0x7a5d('0x7')](),controller[_0x7a5d('0xa')]);router['post']('/',auth[_0x7a5d('0x7')](),controller['create']);router[_0x7a5d('0xb')](_0x7a5d('0xc'),auth[_0x7a5d('0x7')](),controller['update']);router[_0x7a5d('0xd')](_0x7a5d('0xc'),auth[_0x7a5d('0x7')](),controller[_0x7a5d('0xe')]);module[_0x7a5d('0xf')]=router; \ No newline at end of file +var _0x0705=['index','/:id','show','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x4a67f7,_0xb06bf9){var _0x560193=function(_0x5b30b8){while(--_0x5b30b8){_0x4a67f7['push'](_0x4a67f7['shift']());}};_0x560193(++_0xb06bf9);}(_0x0705,0x1dc));var _0x5070=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0x0705[_0x3fcfb6];return _0x3b99a7;};'use strict';var multer=require(_0x5070('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5070('0x1'));var express=require(_0x5070('0x2'));var router=express[_0x5070('0x3')]();var auth=require(_0x5070('0x4'));var interaction=require(_0x5070('0x5'));var config=require(_0x5070('0x6'));var controller=require(_0x5070('0x7'));router[_0x5070('0x8')]('/',auth[_0x5070('0x9')](),controller[_0x5070('0xa')]);router[_0x5070('0x8')](_0x5070('0xb'),auth[_0x5070('0x9')](),controller[_0x5070('0xc')]);router[_0x5070('0xd')]('/',auth['isAuthenticated'](),controller[_0x5070('0xe')]);router[_0x5070('0xf')]('/:id',auth[_0x5070('0x9')](),controller[_0x5070('0x10')]);router['delete'](_0x5070('0xb'),auth[_0x5070('0x9')](),controller['destroy']);module[_0x5070('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index d5bf9f2..37ea68e 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 _0x3e74=['INTEGER','DATE','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5d2817,_0x18d475){var _0x30103b=function(_0x4f9d7f){while(--_0x4f9d7f){_0x5d2817['push'](_0x5d2817['shift']());}};_0x30103b(++_0x18d475);}(_0x3e74,0x175));var _0x43e7=function(_0x36e316,_0x1c65f3){_0x36e316=_0x36e316-0x0;var _0x37730b=_0x3e74[_0x36e316];return _0x37730b;};'use strict';var moment=require(_0x43e7('0x0'));var Sequelize=require('sequelize');module[_0x43e7('0x1')]={'phone':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x43e7('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x43e7('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x43e7('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x43e7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x43e7('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x43e7('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x43e7('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x43e7('0x5')],'unique':_0x43e7('0x8')},'ListId':{'type':Sequelize[_0x43e7('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x43e7('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x43e7('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bd8=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format'];(function(_0x37488c,_0x22aff2){var _0x35d4c7=function(_0x1e1bbc){while(--_0x1e1bbc){_0x37488c['push'](_0x37488c['shift']());}};_0x35d4c7(++_0x22aff2);}(_0x2bd8,0x130));var _0x82bd=function(_0x3011a1,_0x26f4a2){_0x3011a1=_0x3011a1-0x0;var _0xfe6355=_0x2bd8[_0x3011a1];return _0xfe6355;};'use strict';var moment=require(_0x82bd('0x0'));var Sequelize=require('sequelize');module[_0x82bd('0x1')]={'phone':{'type':Sequelize[_0x82bd('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x82bd('0x4')],'defaultValue':moment()[_0x82bd('0x5')](_0x82bd('0x6'))},'countbusyretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x82bd('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x82bd('0x7')](0x2)[_0x82bd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x82bd('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x82bd('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x82bd('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4d8e8b0..535c9c6 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 _0x9879=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','CmHopper','rawAttributes','key','model','map','query','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','update','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','transaction','format','direction','prev','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','UPDATE','Contact','Queue','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found'];(function(_0x245c39,_0x849957){var _0x37fd73=function(_0x50abee){while(--_0x50abee){_0x245c39['push'](_0x245c39['shift']());}};_0x37fd73(++_0x849957);}(_0x9879,0x98));var _0x9987=function(_0xce5cc1,_0x6816ff){_0xce5cc1=_0xce5cc1-0x0;var _0x3393a5=_0x9879[_0xce5cc1];return _0x3393a5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9987('0x0'));var rimraf=require(_0x9987('0x1'));var zipdir=require(_0x9987('0x2'));var jsonpatch=require(_0x9987('0x3'));var rp=require(_0x9987('0x4'));var moment=require(_0x9987('0x5'));var BPromise=require(_0x9987('0x6'));var Mustache=require(_0x9987('0x7'));var util=require(_0x9987('0x8'));var path=require(_0x9987('0x9'));var sox=require(_0x9987('0xa'));var csv=require(_0x9987('0xb'));var ejs=require(_0x9987('0xc'));var fs=require('fs');var _=require(_0x9987('0xd'));var squel=require(_0x9987('0xe'));var crypto=require('crypto');var jsforce=require(_0x9987('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9987('0x10'));var Papa=require('papaparse');var Redis=require(_0x9987('0x11'));var authService=require(_0x9987('0x12'));var qs=require(_0x9987('0x13'));var as=require(_0x9987('0x14'));var hardwareService=require(_0x9987('0x15'));var logger=require(_0x9987('0x16'))(_0x9987('0x17'));var utils=require(_0x9987('0x18'));var config=require(_0x9987('0x19'));var licenseUtil=require(_0x9987('0x1a'));var db=require(_0x9987('0x1b'))['db'];function respondWithStatusCode(_0x2c353c,_0x4c91e3){_0x4c91e3=_0x4c91e3||0xcc;return function(_0x24a42b){if(_0x24a42b){return _0x2c353c[_0x9987('0x1c')](_0x4c91e3);}return _0x2c353c[_0x9987('0x1d')](_0x4c91e3)[_0x9987('0x1e')]();};}function respondWithResult(_0x1d66fe,_0x99976){_0x99976=_0x99976||0xc8;return function(_0x40cd6c){if(_0x40cd6c){return _0x1d66fe[_0x9987('0x1d')](_0x99976)[_0x9987('0x1f')](_0x40cd6c);}};}function respondWithFilteredResult(_0x1fcddb,_0x211574){return function(_0x383996){if(_0x383996){var _0x598a6f=_0x383996[_0x9987('0x20')],_0x5db9c3=_0x211574[_0x9987('0x21')],_0x311f37=_0x211574[_0x9987('0x21')]+_0x211574['limit'],_0x3442c3;if(_0x311f37>=_0x598a6f){_0x311f37=_0x598a6f;_0x3442c3=0xc8;}else{_0x3442c3=0xce;}_0x1fcddb[_0x9987('0x1d')](_0x3442c3);return _0x1fcddb[_0x9987('0x22')](_0x9987('0x23'),_0x5db9c3+'-'+_0x311f37+'/'+_0x598a6f)[_0x9987('0x1f')](_0x383996);}return null;};}function patchUpdates(_0x3888a1){return function(_0x185842){try{jsonpatch[_0x9987('0x24')](_0x185842,_0x3888a1,!![]);}catch(_0x4af501){return BPromise[_0x9987('0x25')](_0x4af501);}return _0x185842[_0x9987('0x26')]();};}function saveUpdates(_0x5c4035,_0x5b2adb){return function(_0xdbf5c){if(_0xdbf5c){return _0xdbf5c['update'](_0x5c4035)['then'](function(_0x3013dc){return _0x3013dc;});}return null;};}function removeEntity(_0xd18e1f,_0x3deea2){return function(_0x1fcec7){if(_0x1fcec7){return _0x1fcec7[_0x9987('0x27')]()[_0x9987('0x28')](function(){_0xd18e1f['status'](0xcc)[_0x9987('0x1e')]();});}};}function handleEntityNotFound(_0x2fe4b6,_0x10b59c){return function(_0x36b44a){if(!_0x36b44a){_0x2fe4b6['sendStatus'](0x194);}return _0x36b44a;};}function handleError(_0x450fe4,_0xa49dd7){_0xa49dd7=_0xa49dd7||0x1f4;return function(_0x490475){logger[_0x9987('0x29')](_0x490475[_0x9987('0x2a')]);if(_0x490475[_0x9987('0x2b')]){delete _0x490475['name'];}_0x450fe4[_0x9987('0x1d')](_0xa49dd7)[_0x9987('0x2c')](_0x490475);};}exports[_0x9987('0x2d')]=function(_0x776714,_0x410507){var _0x77506b={},_0xf20f38={},_0x474c42={'count':0x0,'rows':[]};var _0x526879=_['map'](db[_0x9987('0x2e')][_0x9987('0x2f')],function(_0x26670f){return{'name':_0x26670f['fieldName'],'type':_0x26670f['type'][_0x9987('0x30')]};});_0xf20f38[_0x9987('0x31')]=_[_0x9987('0x32')](_0x526879,_0x9987('0x2b'));_0xf20f38[_0x9987('0x33')]=_['keys'](_0x776714[_0x9987('0x33')]);_0xf20f38['filters']=_['intersection'](_0xf20f38['model'],_0xf20f38[_0x9987('0x33')]);_0xf20f38[_0x9987('0x34')]=_[_0x9987('0x35')](_0xf20f38[_0x9987('0x34')],[_0x9987('0x36'),_0x9987('0x37'),_0x9987('0x38'),_0x9987('0x39'),_0x9987('0x3a'),_0x9987('0x3b'),_0x9987('0x3c'),_0x9987('0x3d'),'$not',_0x9987('0x3e'),_0x9987('0x3f'),_0x9987('0x40'),_0x9987('0x41'),_0x9987('0x42'),_0x9987('0x43'),_0x9987('0x44'),'$notILike',_0x9987('0x42'),_0x9987('0x45'),_0x9987('0x46'),_0x9987('0x47'),_0x9987('0x48')]);_0x77506b[_0x9987('0x49')]=_[_0x9987('0x4a')](_0xf20f38['model'],qs['fields'](_0x776714['query'][_0x9987('0x4b')]));_0x77506b[_0x9987('0x49')]=_0x77506b[_0x9987('0x49')][_0x9987('0x4c')]?_0x77506b[_0x9987('0x49')]:_0xf20f38[_0x9987('0x31')];if(!_0x776714[_0x9987('0x33')]['hasOwnProperty'](_0x9987('0x4d'))){_0x77506b[_0x9987('0x4e')]=qs['limit'](_0x776714[_0x9987('0x33')][_0x9987('0x4e')]);_0x77506b['offset']=qs[_0x9987('0x21')](_0x776714[_0x9987('0x33')]['offset']);}_0x77506b[_0x9987('0x4f')]=qs[_0x9987('0x50')](_0x776714[_0x9987('0x33')][_0x9987('0x50')]);_0x77506b['where']=qs['filters'](_[_0x9987('0x51')](_0x776714[_0x9987('0x33')],_0xf20f38['filters']),_0x526879);if(_0x776714[_0x9987('0x33')][_0x9987('0x52')]){_0x77506b[_0x9987('0x53')]=_[_0x9987('0x54')](_0x77506b[_0x9987('0x53')],{'$or':_[_0x9987('0x32')](_0x526879,function(_0x2677b5){if(_0x2677b5[_0x9987('0x55')]!=='VIRTUAL'){var _0xcbaf54={};_0xcbaf54[_0x2677b5[_0x9987('0x2b')]]={'$like':'%'+_0x776714['query'][_0x9987('0x52')]+'%'};return _0xcbaf54;}})});}_0x77506b=_['merge']({},_0x77506b,_0x776714[_0x9987('0x56')]);var _0x3b3720={'where':_0x77506b[_0x9987('0x53')]};return db[_0x9987('0x2e')][_0x9987('0x20')](_0x3b3720)[_0x9987('0x28')](function(_0x5cbfce){_0x474c42[_0x9987('0x20')]=_0x5cbfce;if(_0x776714['query'][_0x9987('0x57')]){_0x77506b[_0x9987('0x58')]=[{'all':!![]}];}return db[_0x9987('0x2e')][_0x9987('0x59')](_0x77506b);})['then'](function(_0x4ee888){_0x474c42[_0x9987('0x5a')]=_0x4ee888;return _0x474c42;})['then'](respondWithFilteredResult(_0x410507,_0x77506b))['catch'](handleError(_0x410507,null));};exports[_0x9987('0x5b')]=function(_0x70c08d,_0x234f2f){var _0x503efb={'raw':!![],'where':{'id':_0x70c08d['params']['id']}},_0x854b1={};_0x854b1[_0x9987('0x31')]=_[_0x9987('0x5c')](db['CmHopper'][_0x9987('0x2f')]);_0x854b1[_0x9987('0x33')]=_[_0x9987('0x5c')](_0x70c08d[_0x9987('0x33')]);_0x854b1[_0x9987('0x34')]=_['intersection'](_0x854b1[_0x9987('0x31')],_0x854b1['query']);_0x503efb[_0x9987('0x49')]=_['intersection'](_0x854b1[_0x9987('0x31')],qs['fields'](_0x70c08d[_0x9987('0x33')]['fields']));_0x503efb[_0x9987('0x49')]=_0x503efb[_0x9987('0x49')][_0x9987('0x4c')]?_0x503efb['attributes']:_0x854b1[_0x9987('0x31')];if(_0x70c08d['query'][_0x9987('0x57')]){_0x503efb[_0x9987('0x58')]=[{'all':!![]}];}_0x503efb=_[_0x9987('0x54')]({},_0x503efb,_0x70c08d['options']);return db[_0x9987('0x2e')][_0x9987('0x5d')](_0x503efb)[_0x9987('0x28')](handleEntityNotFound(_0x234f2f,null))[_0x9987('0x28')](respondWithResult(_0x234f2f,null))[_0x9987('0x5e')](handleError(_0x234f2f,null));};exports['create']=function(_0x99f0e6,_0x3329fe){return db[_0x9987('0x2e')][_0x9987('0x5f')](_0x99f0e6[_0x9987('0x60')],{})['then'](respondWithResult(_0x3329fe,0xc9))[_0x9987('0x5e')](handleError(_0x3329fe,null));};exports[_0x9987('0x61')]=function(_0x51e7d3,_0x1bf6eb){if(_0x51e7d3[_0x9987('0x60')]['id']){delete _0x51e7d3[_0x9987('0x60')]['id'];}return db[_0x9987('0x2e')][_0x9987('0x5d')]({'where':{'id':_0x51e7d3['params']['id']}})[_0x9987('0x28')](handleEntityNotFound(_0x1bf6eb,null))[_0x9987('0x28')](saveUpdates(_0x51e7d3[_0x9987('0x60')],null))[_0x9987('0x28')](respondWithResult(_0x1bf6eb,null))[_0x9987('0x5e')](handleError(_0x1bf6eb,null));};exports[_0x9987('0x62')]=function(_0xf9270b,_0x2e6613){return db[_0x9987('0x2e')][_0x9987('0x62')]()[_0x9987('0x28')](respondWithResult(_0x2e6613,null))[_0x9987('0x5e')](handleError(_0x2e6613,null));};exports[_0x9987('0x27')]=function(_0x129d88,_0x19787d){var _0x501522;return db[_0x9987('0x2e')][_0x9987('0x5d')]({'where':{'id':_0x129d88['params']['id']}})[_0x9987('0x28')](handleEntityNotFound(_0x19787d,null))['then'](function(_0x47390e){if(_0x47390e){return _0x47390e[_0x9987('0x27')]()[_0x9987('0x28')](function(_0x34dbbd){return _0x34dbbd;});}})[_0x9987('0x28')](function(_0x4e083e){_0x501522=_0x4e083e;if(_0x4e083e){if(_0x4e083e[_0x9987('0x63')]||_0x4e083e[_0x9987('0x64')]){return db[_0x4e083e['VoiceQueueId']?_0x9987('0x65'):'Campaign'][_0x9987('0x5d')]({'where':{'id':_0x4e083e[_0x9987('0x63')]?_0x4e083e[_0x9987('0x63')]:_0x4e083e['CampaignId']},'attributes':['id',_0x9987('0x2b')],'raw':!![]});}}})[_0x9987('0x28')](function(_0x272290){var _0x1f64e3={};if(_0x272290){_[_0x9987('0x54')](_0x1f64e3,_[_0x9987('0x66')](_0x501522[_0x9987('0x67')],[_0x9987('0x68'),_0x9987('0x69'),'id']));_0x1f64e3['state']=0x15;_0x1f64e3[_0x9987('0x6a')]=_0x9987('0x6b');_0x1f64e3[_0x9987('0x6c')]=_0x272290[_0x9987('0x2b')];_0x1f64e3[_0x9987('0x6d')]=_0x129d88['user']['name'];_0x1f64e3[_0x9987('0x6e')]=_0x129d88[_0x9987('0x6f')]['id'];_0x1f64e3[_0x9987('0x6b')]=!![];_0x1f64e3[_0x9987('0x70')]=moment()['format'](_0x9987('0x71'));_0x1f64e3['calleridnum']=_0x501522[_0x9987('0x72')];_0x1f64e3[_0x9987('0x73')]=_0x501522[_0x9987('0x63')]?'queue':_0x9987('0x74');return db['CmContact'][_0x9987('0x5d')]({'where':{'id':_0x1f64e3[_0x9987('0x75')]},'attributes':[_0x9987('0x76'),_0x9987('0x77')]})[_0x9987('0x28')](function(_0x2d0c45){if(!_['isNil'](_0x19787d)&&!_[_0x9987('0x78')](_0x2d0c45['firstName'])){_0x1f64e3[_0x9987('0x79')]=_0x2d0c45[_0x9987('0x76')];if(!_[_0x9987('0x78')](_0x2d0c45[_0x9987('0x77')])){_0x1f64e3[_0x9987('0x79')]+='\x20'+_0x2d0c45[_0x9987('0x77')];}}})[_0x9987('0x7a')](function(){return db[_0x9987('0x7b')][_0x9987('0x5f')](_0x1f64e3);});}})[_0x9987('0x28')](function(){return _0x19787d[_0x9987('0x1d')](0xcc)['end']();})[_0x9987('0x5e')](handleError(_0x19787d,null));};exports[_0x9987('0x7c')]=function(_0x5e1ba2,_0x2a30df,_0x81d0eb){var _0x38f8ee=[];return db[_0x9987('0x7d')][_0x9987('0x62')]()['then'](function(_0xb4450a){_0x38f8ee=_['keys'](_0xb4450a);return _0x5e1ba2['user'][_0x9987('0x7e')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x9987('0x28')](function(_0x5a2d6f){if(_0x5a2d6f&&_0x5a2d6f[_0x9987('0x4c')]){return db['sequelize'][_0x9987('0x7f')](function(_0x1424dd){var _0x15f6d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9987('0x80')](_0x9987('0x71'))},'VoiceQueueId':{'$in':_[_0x9987('0x32')](_0x5a2d6f,'id')},'$or':[{'UserId':null},{'UserId':_0x5e1ba2[_0x9987('0x6f')]['id']}]};var _0xea693c=[];if(_0x5e1ba2[_0x9987('0x60')][_0x9987('0x81')]&&_0x5e1ba2[_0x9987('0x60')][_0x9987('0x81')]===_0x9987('0x82')){if(!_['isEmpty'](_0x5e1ba2['body']['hopperIds'])){_0x15f6d3['id']={'$in':_0x5e1ba2[_0x9987('0x60')][_0x9987('0x83')]};}_0xea693c=[[_0x9987('0x84'),_0x9987('0x85')],['scheduledAt',_0x5a2d6f[0x0][_0x9987('0x86')]===_0x9987('0x85')?_0x9987('0x87'):_0x9987('0x85')],db[_0x9987('0x88')][_0x9987('0x89')](_0x9987('0x8a')),['id',_0x9987('0x87')]];}else{if(!_['isEmpty'](_0x5e1ba2[_0x9987('0x60')]['hopperIds'])){_0x15f6d3['id']={'$notIn':_0x5e1ba2['body'][_0x9987('0x83')]};}_0xea693c=[['priority','DESC'],[_0x9987('0x8b'),_0x5a2d6f[0x0][_0x9987('0x86')]],db[_0x9987('0x88')][_0x9987('0x89')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x9987('0x85')]];}return db[_0x9987('0x2e')][_0x9987('0x8c')]({'attributes':['id',_0x9987('0x8d')],'where':_0x15f6d3,'order':_0xea693c,'transaction':_0x1424dd,'lock':_0x1424dd['LOCK'][_0x9987('0x8e')],'include':[{'model':db['CmContact'],'as':_0x9987('0x8f'),'attributes':_0x38f8ee,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x9987('0x2b')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x9987('0x2b')]},{'model':db[_0x9987('0x65')],'as':_0x9987('0x90'),'attributes':['id','name',_0x9987('0x91')]}]})[_0x9987('0x28')](function(_0x710f5d){if(_0x710f5d){return _0x710f5d[_0x9987('0x61')]({'UserId':_0x5e1ba2[_0x9987('0x6f')]['id']},{'transaction':_0x1424dd});}});});}})[_0x9987('0x28')](handleEntityNotFound(_0x2a30df,null))[_0x9987('0x28')](respondWithResult(_0x2a30df,null))['catch'](handleError(_0x2a30df,null));};exports[_0x9987('0x92')]=function(_0x325150,_0xb38b3c,_0x23e300){return _0x325150[_0x9987('0x6f')][_0x9987('0x7e')]({'where':{'type':_0x9987('0x93'),'dialActive':!![],'dialMethod':_0x9987('0x94')},'attributes':['id'],'raw':!![]})[_0x9987('0x28')](function(_0x5465f9){if(_0x5465f9&&_0x5465f9['length']){return db[_0x9987('0x2e')][_0x9987('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9987('0x80')](_0x9987('0x71'))},'VoiceQueueId':{'$in':_[_0x9987('0x32')](_0x5465f9,'id')},'$or':[{'UserId':null},{'UserId':_0x325150[_0x9987('0x6f')]['id']}]}});}return 0x0;})[_0x9987('0x28')](function(_0x265427){if(!_['isNil'](_0x265427)&&_[_0x9987('0x95')](_0x265427)){return _0xb38b3c['status'](0xc8)[_0x9987('0x1f')]({'contacts':_0x265427});}else{logger['error'](_0x9987('0x96'),_0x9987('0x92'),0x194,_0x9987('0x97'));_0xb38b3c['sendStatus'](0x194);}})[_0x9987('0x5e')](handleError(_0xb38b3c,null));}; \ No newline at end of file +var _0x18c9=['hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','update','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$iLike','$like','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty'];(function(_0x320d8c,_0x160481){var _0x2b41eb=function(_0x28316a){while(--_0x28316a){_0x320d8c['push'](_0x320d8c['shift']());}};_0x2b41eb(++_0x160481);}(_0x18c9,0x13c));var _0x918c=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x18c9[_0x186376];return _0x2dbdd9;};'use strict';var pdf=require(_0x918c('0x0'));var emlformat=require(_0x918c('0x1'));var rimraf=require(_0x918c('0x2'));var zipdir=require(_0x918c('0x3'));var jsonpatch=require(_0x918c('0x4'));var rp=require(_0x918c('0x5'));var moment=require('moment');var BPromise=require(_0x918c('0x6'));var Mustache=require(_0x918c('0x7'));var util=require('util');var path=require(_0x918c('0x8'));var sox=require('sox');var csv=require(_0x918c('0x9'));var ejs=require(_0x918c('0xa'));var fs=require('fs');var _=require(_0x918c('0xb'));var squel=require(_0x918c('0xc'));var crypto=require(_0x918c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x918c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x918c('0xf'));var Redis=require(_0x918c('0x10'));var authService=require(_0x918c('0x11'));var qs=require(_0x918c('0x12'));var as=require(_0x918c('0x13'));var hardwareService=require(_0x918c('0x14'));var logger=require(_0x918c('0x15'))(_0x918c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x918c('0x17'));var db=require(_0x918c('0x18'))['db'];function respondWithStatusCode(_0x1684e0,_0x18abb5){_0x18abb5=_0x18abb5||0xcc;return function(_0x3c8716){if(_0x3c8716){return _0x1684e0['sendStatus'](_0x18abb5);}return _0x1684e0[_0x918c('0x19')](_0x18abb5)[_0x918c('0x1a')]();};}function respondWithResult(_0xe5ba1e,_0x1204b3){_0x1204b3=_0x1204b3||0xc8;return function(_0x1bd619){if(_0x1bd619){return _0xe5ba1e[_0x918c('0x19')](_0x1204b3)[_0x918c('0x1b')](_0x1bd619);}};}function respondWithFilteredResult(_0x32729f,_0x38f3b5){return function(_0x50d54d){if(_0x50d54d){var _0x51b1bd=_0x50d54d[_0x918c('0x1c')],_0x50f880=_0x38f3b5['offset'],_0x5baa51=_0x38f3b5[_0x918c('0x1d')]+_0x38f3b5[_0x918c('0x1e')],_0x4fa363;if(_0x5baa51>=_0x51b1bd){_0x5baa51=_0x51b1bd;_0x4fa363=0xc8;}else{_0x4fa363=0xce;}_0x32729f[_0x918c('0x19')](_0x4fa363);return _0x32729f['set']('Content-Range',_0x50f880+'-'+_0x5baa51+'/'+_0x51b1bd)[_0x918c('0x1b')](_0x50d54d);}return null;};}function patchUpdates(_0x45dc12){return function(_0x570482){try{jsonpatch[_0x918c('0x1f')](_0x570482,_0x45dc12,!![]);}catch(_0x13d13a){return BPromise[_0x918c('0x20')](_0x13d13a);}return _0x570482[_0x918c('0x21')]();};}function saveUpdates(_0x5b7526,_0xcfd3e6){return function(_0x4a2178){if(_0x4a2178){return _0x4a2178['update'](_0x5b7526)['then'](function(_0x30fe20){return _0x30fe20;});}return null;};}function removeEntity(_0x50cf49,_0x5c27d1){return function(_0x33d952){if(_0x33d952){return _0x33d952['destroy']()[_0x918c('0x22')](function(){_0x50cf49[_0x918c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3780db,_0x30fd1b){return function(_0x27c08b){if(!_0x27c08b){_0x3780db[_0x918c('0x23')](0x194);}return _0x27c08b;};}function handleError(_0x59799f,_0x27a7d6){_0x27a7d6=_0x27a7d6||0x1f4;return function(_0x8577fe){logger[_0x918c('0x24')](_0x8577fe[_0x918c('0x25')]);if(_0x8577fe[_0x918c('0x26')]){delete _0x8577fe[_0x918c('0x26')];}_0x59799f['status'](_0x27a7d6)[_0x918c('0x27')](_0x8577fe);};}exports[_0x918c('0x28')]=function(_0x9aca49,_0x11e8bf){var _0x481fd7={},_0x194e7e={},_0x3b16d0={'count':0x0,'rows':[]};var _0x48fa8c=_[_0x918c('0x29')](db[_0x918c('0x2a')][_0x918c('0x2b')],function(_0x146579){return{'name':_0x146579[_0x918c('0x2c')],'type':_0x146579[_0x918c('0x2d')][_0x918c('0x2e')]};});_0x194e7e[_0x918c('0x2f')]=_[_0x918c('0x29')](_0x48fa8c,_0x918c('0x26'));_0x194e7e['query']=_[_0x918c('0x30')](_0x9aca49[_0x918c('0x31')]);_0x194e7e['filters']=_['intersection'](_0x194e7e[_0x918c('0x2f')],_0x194e7e[_0x918c('0x31')]);_0x194e7e[_0x918c('0x32')]=_['concat'](_0x194e7e[_0x918c('0x32')],['$and',_0x918c('0x33'),_0x918c('0x34'),_0x918c('0x35'),_0x918c('0x36'),_0x918c('0x37'),'$ne',_0x918c('0x38'),_0x918c('0x39'),_0x918c('0x3a'),_0x918c('0x3b'),_0x918c('0x3c'),_0x918c('0x3d'),'$like','$notLike',_0x918c('0x3e'),'$notILike',_0x918c('0x3f'),'$overlap','$contains',_0x918c('0x40'),_0x918c('0x41')]);_0x481fd7[_0x918c('0x42')]=_['intersection'](_0x194e7e['model'],qs[_0x918c('0x43')](_0x9aca49[_0x918c('0x31')]['fields']));_0x481fd7[_0x918c('0x42')]=_0x481fd7[_0x918c('0x42')][_0x918c('0x44')]?_0x481fd7[_0x918c('0x42')]:_0x194e7e[_0x918c('0x2f')];if(!_0x9aca49['query'][_0x918c('0x45')](_0x918c('0x46'))){_0x481fd7['limit']=qs[_0x918c('0x1e')](_0x9aca49['query'][_0x918c('0x1e')]);_0x481fd7[_0x918c('0x1d')]=qs['offset'](_0x9aca49[_0x918c('0x31')][_0x918c('0x1d')]);}_0x481fd7[_0x918c('0x47')]=qs[_0x918c('0x48')](_0x9aca49[_0x918c('0x31')][_0x918c('0x48')]);_0x481fd7[_0x918c('0x49')]=qs[_0x918c('0x32')](_[_0x918c('0x4a')](_0x9aca49[_0x918c('0x31')],_0x194e7e['filters']),_0x48fa8c);if(_0x9aca49[_0x918c('0x31')][_0x918c('0x4b')]){_0x481fd7[_0x918c('0x49')]=_[_0x918c('0x4c')](_0x481fd7[_0x918c('0x49')],{'$or':_['map'](_0x48fa8c,function(_0xae45a0){if(_0xae45a0[_0x918c('0x2d')]!==_0x918c('0x4d')){var _0x944087={};_0x944087[_0xae45a0[_0x918c('0x26')]]={'$like':'%'+_0x9aca49['query'][_0x918c('0x4b')]+'%'};return _0x944087;}})});}_0x481fd7=_[_0x918c('0x4c')]({},_0x481fd7,_0x9aca49[_0x918c('0x4e')]);var _0x56b795={'where':_0x481fd7[_0x918c('0x49')]};return db['CmHopper'][_0x918c('0x1c')](_0x56b795)[_0x918c('0x22')](function(_0x19d878){_0x3b16d0[_0x918c('0x1c')]=_0x19d878;if(_0x9aca49['query'][_0x918c('0x4f')]){_0x481fd7[_0x918c('0x50')]=[{'all':!![]}];}return db[_0x918c('0x2a')][_0x918c('0x51')](_0x481fd7);})['then'](function(_0x19a155){_0x3b16d0[_0x918c('0x52')]=_0x19a155;return _0x3b16d0;})[_0x918c('0x22')](respondWithFilteredResult(_0x11e8bf,_0x481fd7))['catch'](handleError(_0x11e8bf,null));};exports[_0x918c('0x53')]=function(_0x51bd10,_0x4e9a12){var _0x397666={'raw':!![],'where':{'id':_0x51bd10[_0x918c('0x54')]['id']}},_0x2daf68={};_0x2daf68[_0x918c('0x2f')]=_[_0x918c('0x30')](db[_0x918c('0x2a')][_0x918c('0x2b')]);_0x2daf68[_0x918c('0x31')]=_['keys'](_0x51bd10[_0x918c('0x31')]);_0x2daf68[_0x918c('0x32')]=_[_0x918c('0x55')](_0x2daf68[_0x918c('0x2f')],_0x2daf68[_0x918c('0x31')]);_0x397666[_0x918c('0x42')]=_['intersection'](_0x2daf68[_0x918c('0x2f')],qs['fields'](_0x51bd10[_0x918c('0x31')][_0x918c('0x43')]));_0x397666[_0x918c('0x42')]=_0x397666[_0x918c('0x42')][_0x918c('0x44')]?_0x397666[_0x918c('0x42')]:_0x2daf68[_0x918c('0x2f')];if(_0x51bd10[_0x918c('0x31')][_0x918c('0x4f')]){_0x397666[_0x918c('0x50')]=[{'all':!![]}];}_0x397666=_['merge']({},_0x397666,_0x51bd10[_0x918c('0x4e')]);return db[_0x918c('0x2a')]['find'](_0x397666)[_0x918c('0x22')](handleEntityNotFound(_0x4e9a12,null))[_0x918c('0x22')](respondWithResult(_0x4e9a12,null))[_0x918c('0x56')](handleError(_0x4e9a12,null));};exports[_0x918c('0x57')]=function(_0x2f131f,_0x4e686a){return db['CmHopper'][_0x918c('0x57')](_0x2f131f[_0x918c('0x58')],{})[_0x918c('0x22')](respondWithResult(_0x4e686a,0xc9))[_0x918c('0x56')](handleError(_0x4e686a,null));};exports['update']=function(_0x2e9267,_0x4395e7){if(_0x2e9267[_0x918c('0x58')]['id']){delete _0x2e9267[_0x918c('0x58')]['id'];}return db['CmHopper'][_0x918c('0x59')]({'where':{'id':_0x2e9267['params']['id']}})['then'](handleEntityNotFound(_0x4395e7,null))[_0x918c('0x22')](saveUpdates(_0x2e9267['body'],null))[_0x918c('0x22')](respondWithResult(_0x4395e7,null))[_0x918c('0x56')](handleError(_0x4395e7,null));};exports['describe']=function(_0x52cc0b,_0x2add75){return db['CmHopper'][_0x918c('0x5a')]()['then'](respondWithResult(_0x2add75,null))[_0x918c('0x56')](handleError(_0x2add75,null));};exports[_0x918c('0x5b')]=function(_0x3678b3,_0x692097){var _0x4da7a3;return db[_0x918c('0x2a')][_0x918c('0x59')]({'where':{'id':_0x3678b3['params']['id']}})[_0x918c('0x22')](handleEntityNotFound(_0x692097,null))[_0x918c('0x22')](function(_0x3d7b93){if(_0x3d7b93){return _0x3d7b93[_0x918c('0x5b')]()['then'](function(_0x104f39){return _0x104f39;});}})[_0x918c('0x22')](function(_0x20aea8){_0x4da7a3=_0x20aea8;if(_0x20aea8){if(_0x20aea8[_0x918c('0x5c')]||_0x20aea8[_0x918c('0x5d')]){return db[_0x20aea8[_0x918c('0x5c')]?_0x918c('0x5e'):_0x918c('0x5f')][_0x918c('0x59')]({'where':{'id':_0x20aea8['VoiceQueueId']?_0x20aea8[_0x918c('0x5c')]:_0x20aea8[_0x918c('0x5d')]},'attributes':['id',_0x918c('0x26')],'raw':!![]});}}})['then'](function(_0x19985c){var _0x3f315f={};if(_0x19985c){_[_0x918c('0x4c')](_0x3f315f,_[_0x918c('0x60')](_0x4da7a3[_0x918c('0x61')],[_0x918c('0x62'),_0x918c('0x63'),'id']));_0x3f315f['state']=0x15;_0x3f315f[_0x918c('0x64')]='deleted';_0x3f315f['campaign']=_0x19985c[_0x918c('0x26')];_0x3f315f[_0x918c('0x65')]=_0x3678b3[_0x918c('0x66')]['name'];_0x3f315f[_0x918c('0x67')]=_0x3678b3[_0x918c('0x66')]['id'];_0x3f315f['deleted']=!![];_0x3f315f[_0x918c('0x68')]=moment()[_0x918c('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f315f[_0x918c('0x6a')]=_0x4da7a3[_0x918c('0x6b')];_0x3f315f[_0x918c('0x6c')]=_0x4da7a3[_0x918c('0x5c')]?'queue':_0x918c('0x6d');return db[_0x918c('0x6e')][_0x918c('0x59')]({'where':{'id':_0x3f315f[_0x918c('0x6f')]},'attributes':[_0x918c('0x70'),'lastName']})['then'](function(_0x2102df){if(!_['isNil'](_0x692097)&&!_[_0x918c('0x71')](_0x2102df[_0x918c('0x70')])){_0x3f315f[_0x918c('0x72')]=_0x2102df[_0x918c('0x70')];if(!_[_0x918c('0x71')](_0x2102df['lastName'])){_0x3f315f[_0x918c('0x72')]+='\x20'+_0x2102df['lastName'];}}})[_0x918c('0x73')](function(){return db[_0x918c('0x74')][_0x918c('0x57')](_0x3f315f);});}})[_0x918c('0x22')](function(){return _0x692097[_0x918c('0x19')](0xcc)['end']();})['catch'](handleError(_0x692097,null));};exports[_0x918c('0x75')]=function(_0x557d3c,_0x3a7aff,_0x55e9c1){var _0x27fd2a=[];return db[_0x918c('0x6e')][_0x918c('0x5a')]()[_0x918c('0x22')](function(_0x6b7f49){_0x27fd2a=_[_0x918c('0x30')](_0x6b7f49);return _0x557d3c[_0x918c('0x66')][_0x918c('0x76')]({'where':{'type':_0x918c('0x77'),'dialActive':!![],'dialMethod':_0x918c('0x78')},'attributes':['id',_0x918c('0x79')],'raw':!![]});})[_0x918c('0x22')](function(_0x5edfbb){if(_0x5edfbb&&_0x5edfbb['length']){return db[_0x918c('0x7a')][_0x918c('0x7b')](function(_0x432960){var _0x47b33b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x918c('0x69')](_0x918c('0x7c'))},'VoiceQueueId':{'$in':_[_0x918c('0x29')](_0x5edfbb,'id')},'$or':[{'UserId':null},{'UserId':_0x557d3c[_0x918c('0x66')]['id']}]};var _0x31dae1=[];if(_0x557d3c[_0x918c('0x58')][_0x918c('0x7d')]&&_0x557d3c['body'][_0x918c('0x7d')]===_0x918c('0x7e')){if(!_[_0x918c('0x7f')](_0x557d3c['body'][_0x918c('0x80')])){_0x47b33b['id']={'$in':_0x557d3c[_0x918c('0x58')][_0x918c('0x80')]};}_0x31dae1=[[_0x918c('0x81'),'ASC'],['scheduledAt',_0x5edfbb[0x0][_0x918c('0x79')]===_0x918c('0x82')?'DESC':'ASC'],db['sequelize'][_0x918c('0x83')](_0x918c('0x84')),['id','DESC']];}else{if(!_[_0x918c('0x7f')](_0x557d3c[_0x918c('0x58')][_0x918c('0x80')])){_0x47b33b['id']={'$notIn':_0x557d3c[_0x918c('0x58')][_0x918c('0x80')]};}_0x31dae1=[[_0x918c('0x81'),'DESC'],[_0x918c('0x85'),_0x5edfbb[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x918c('0x83')](_0x918c('0x86')),['id','ASC']];}return db[_0x918c('0x2a')]['findOne']({'attributes':['id',_0x918c('0x87')],'where':_0x47b33b,'order':_0x31dae1,'transaction':_0x432960,'lock':_0x432960[_0x918c('0x88')][_0x918c('0x89')],'include':[{'model':db[_0x918c('0x6e')],'as':_0x918c('0x8a'),'attributes':_0x27fd2a,'include':[{'model':db[_0x918c('0x8b')],'as':_0x918c('0x8c'),'attributes':['id','name']}]},{'model':db[_0x918c('0x8d')],'as':_0x918c('0x8e'),'attributes':['id',_0x918c('0x26')]},{'model':db[_0x918c('0x5e')],'as':_0x918c('0x8f'),'attributes':['id',_0x918c('0x26'),_0x918c('0x90')]}]})[_0x918c('0x22')](function(_0x52c5e4){if(_0x52c5e4){return _0x52c5e4[_0x918c('0x91')]({'UserId':_0x557d3c[_0x918c('0x66')]['id']},{'transaction':_0x432960});}});});}})[_0x918c('0x22')](handleEntityNotFound(_0x3a7aff,null))[_0x918c('0x22')](respondWithResult(_0x3a7aff,null))[_0x918c('0x56')](handleError(_0x3a7aff,null));};exports[_0x918c('0x92')]=function(_0x54acce,_0x24fd42,_0x2c74bf){return _0x54acce[_0x918c('0x66')][_0x918c('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x918c('0x78')},'attributes':['id'],'raw':!![]})[_0x918c('0x22')](function(_0x3ca6bd){if(_0x3ca6bd&&_0x3ca6bd[_0x918c('0x44')]){return db[_0x918c('0x2a')][_0x918c('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x918c('0x29')](_0x3ca6bd,'id')},'$or':[{'UserId':null},{'UserId':_0x54acce['user']['id']}]}});}return 0x0;})[_0x918c('0x22')](function(_0x1bfc34){if(!_[_0x918c('0x71')](_0x1bfc34)&&_['isNumber'](_0x1bfc34)){return _0x24fd42[_0x918c('0x19')](0xc8)[_0x918c('0x1b')]({'contacts':_0x1bfc34});}else{logger[_0x918c('0x24')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x918c('0x92'),0x194,_0x918c('0x93'));_0x24fd42[_0x918c('0x23')](0x194);}})[_0x918c('0x56')](handleError(_0x24fd42,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 5ac19f7..0a6d248 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 _0xd685=['moment','path','define','CmHopper','phone','../../config/logger','api'];(function(_0x2c1ba7,_0x1dc705){var _0x2ffd21=function(_0x320a5e){while(--_0x320a5e){_0x2c1ba7['push'](_0x2c1ba7['shift']());}};_0x2ffd21(++_0x1dc705);}(_0xd685,0x124));var _0x5d68=function(_0x38af38,_0xc69a76){_0x38af38=_0x38af38-0x0;var _0x101109=_0xd685[_0x38af38];return _0x101109;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d68('0x0'))(_0x5d68('0x1'));var moment=require(_0x5d68('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d68('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x48fb7d,_0x1b4b4f){return _0x48fb7d[_0x5d68('0x4')](_0x5d68('0x5'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0x5d68('0x6'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','scheduledat','phone'];(function(_0x17db77,_0x3c0563){var _0x39055b=function(_0xb135ca){while(--_0xb135ca){_0x17db77['push'](_0x17db77['shift']());}};_0x39055b(++_0x3c0563);}(_0x42f4,0x17b));var _0x442f=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0x42f4[_0x44606e];return _0xe68388;};'use strict';var _=require(_0x442f('0x0'));var util=require(_0x442f('0x1'));var logger=require(_0x442f('0x2'))(_0x442f('0x3'));var moment=require(_0x442f('0x4'));var BPromise=require(_0x442f('0x5'));var rp=require(_0x442f('0x6'));var fs=require('fs');var path=require(_0x442f('0x7'));var rimraf=require(_0x442f('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x442f('0x9')]=function(_0x25bc12,_0x155bad){return _0x25bc12[_0x442f('0xa')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x442f('0xb'),'fields':[_0x442f('0xb')]},{'name':_0x442f('0xc'),'fields':[_0x442f('0xc')]},{'name':_0x442f('0xd'),'fields':[_0x442f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b1f0e48..13b435a 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 _0x773d=['update','UpdateCmHopper','DestroyCmHopper','destroy','CmContact','describe','findAll','order','LOCK','UPDATE','Contact','User','name','voicePause','UserId','all','GetContactDialer','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','CountReScheduled','GetContactRecallMe','length','push','GetCmHopperPreview','keys','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','options','raw','where','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','find','create','body','CreateCmHopper'];(function(_0x18caf8,_0x559f8b){var _0x44a8b0=function(_0x5e6297){while(--_0x5e6297){_0x18caf8['push'](_0x18caf8['shift']());}};_0x44a8b0(++_0x559f8b);}(_0x773d,0xb3));var _0xd773=function(_0x244a5f,_0x6f3dc3){_0x244a5f=_0x244a5f-0x0;var _0x2f0d8f=_0x773d[_0x244a5f];return _0x2f0d8f;};'use strict';var _=require(_0xd773('0x0'));var util=require(_0xd773('0x1'));var moment=require(_0xd773('0x2'));var BPromise=require('bluebird');var rs=require(_0xd773('0x3'));var fs=require('fs');var Redis=require(_0xd773('0x4'));var db=require(_0xd773('0x5'))['db'];var utils=require(_0xd773('0x6'));var logger=require(_0xd773('0x7'))(_0xd773('0x8'));var config=require(_0xd773('0x9'));var jayson=require(_0xd773('0xa'));var client=jayson[_0xd773('0xb')][_0xd773('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x289c59,_0x510218,_0x253dc1){return new BPromise(function(_0x5ac4dc,_0x4ecbf2){return client['request'](_0x289c59,_0x253dc1)[_0xd773('0xd')](function(_0x14615d){logger[_0xd773('0xe')]('CmHopper,\x20%s,\x20%s',_0x510218,_0xd773('0xf'));logger[_0xd773('0x10')](_0xd773('0x11'),_0x510218,_0xd773('0xf'),JSON[_0xd773('0x12')](_0x14615d));if(_0x14615d[_0xd773('0x13')]){if(_0x14615d[_0xd773('0x13')][_0xd773('0x14')]===0x1f4){logger['error'](_0xd773('0x15'),_0x510218,_0x14615d[_0xd773('0x13')][_0xd773('0x16')]);return _0x4ecbf2(_0x14615d['error'][_0xd773('0x16')]);}logger['error'](_0xd773('0x15'),_0x510218,_0x14615d['error']['message']);return _0x5ac4dc(_0x14615d[_0xd773('0x13')][_0xd773('0x16')]);}else{logger[_0xd773('0xe')]('CmHopper,\x20%s,\x20%s',_0x510218,'request\x20sent');_0x5ac4dc(_0x14615d[_0xd773('0x17')][_0xd773('0x16')]);}})[_0xd773('0x18')](function(_0x1acc03){logger['error']('CmHopper,\x20%s,\x20%s',_0x510218,_0x1acc03);_0x4ecbf2(_0x1acc03);});});}exports['GetCmHopper']=function(_0x579643){var _0x2e2ab4=this;return new Promise(function(_0x423f93,_0x14cd1c){return db[_0xd773('0x19')]['findAll']({'raw':_0x579643[_0xd773('0x1a')]?_0x579643[_0xd773('0x1a')][_0xd773('0x1b')]===undefined?!![]:![]:!![],'where':_0x579643['options']?_0x579643[_0xd773('0x1a')][_0xd773('0x1c')]||null:null,'attributes':_0x579643[_0xd773('0x1a')]?_0x579643[_0xd773('0x1a')][_0xd773('0x1d')]||null:null,'limit':_0x579643[_0xd773('0x1a')]?_0x579643['options'][_0xd773('0x1e')]||null:null,'include':_0x579643[_0xd773('0x1a')]?_0x579643['options'][_0xd773('0x1f')]?_[_0xd773('0x20')](_0x579643[_0xd773('0x1a')][_0xd773('0x1f')],function(_0x4716ba){return{'model':db[_0x4716ba[_0xd773('0x21')]],'as':_0x4716ba['as'],'attributes':_0x4716ba[_0xd773('0x1d')],'include':_0x4716ba[_0xd773('0x1f')]?_[_0xd773('0x20')](_0x4716ba[_0xd773('0x1f')],function(_0xe697c7){return{'model':db[_0xe697c7[_0xd773('0x21')]],'as':_0xe697c7['as'],'attributes':_0xe697c7[_0xd773('0x1d')],'include':_0xe697c7[_0xd773('0x1f')]?_[_0xd773('0x20')](_0xe697c7[_0xd773('0x1f')],function(_0x5b5841){return{'model':db[_0x5b5841['model']],'as':_0x5b5841['as'],'attributes':_0x5b5841['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4977c6){logger[_0xd773('0xe')](_0xd773('0x22'),_0x579643);logger['debug']('GetCmHopper',_0x579643,JSON[_0xd773('0x12')](_0x4977c6));_0x423f93(_0x4977c6);})['catch'](function(_0x4740e2){logger[_0xd773('0x13')](_0xd773('0x22'),_0x4740e2[_0xd773('0x16')],_0x579643);_0x14cd1c(_0x2e2ab4[_0xd773('0x13')](0x1f4,_0x4740e2[_0xd773('0x16')]));});});};exports[_0xd773('0x23')]=function(_0x3a858b){var _0x43e1bb=this;return new Promise(function(_0x5b3a82,_0x2a014b){return db[_0xd773('0x19')][_0xd773('0x24')]({'raw':_0x3a858b['options']?_0x3a858b['options'][_0xd773('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a858b[_0xd773('0x1a')]?_0x3a858b[_0xd773('0x1a')]['where']||null:null,'attributes':_0x3a858b['options']?_0x3a858b[_0xd773('0x1a')][_0xd773('0x1d')]||null:null,'include':_0x3a858b[_0xd773('0x1a')]?_0x3a858b[_0xd773('0x1a')][_0xd773('0x1f')]?_[_0xd773('0x20')](_0x3a858b['options'][_0xd773('0x1f')],function(_0x376854){return{'model':db[_0x376854[_0xd773('0x21')]],'as':_0x376854['as'],'attributes':_0x376854[_0xd773('0x1d')],'include':_0x376854[_0xd773('0x1f')]?_[_0xd773('0x20')](_0x376854[_0xd773('0x1f')],function(_0x66b91b){return{'model':db[_0x66b91b['model']],'as':_0x66b91b['as'],'attributes':_0x66b91b[_0xd773('0x1d')],'include':_0x66b91b['include']?_[_0xd773('0x20')](_0x66b91b['include'],function(_0x2a5cea){return{'model':db[_0x2a5cea[_0xd773('0x21')]],'as':_0x2a5cea['as'],'attributes':_0x2a5cea[_0xd773('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd773('0xd')](function(_0x29a843){logger[_0xd773('0xe')](_0xd773('0x23'),_0x3a858b);logger[_0xd773('0x10')](_0xd773('0x23'),_0x3a858b,JSON[_0xd773('0x12')](_0x29a843));_0x5b3a82(_0x29a843);})[_0xd773('0x18')](function(_0x5ad941){logger[_0xd773('0x13')](_0xd773('0x23'),_0x5ad941[_0xd773('0x16')],_0x3a858b);_0x2a014b(_0x43e1bb[_0xd773('0x13')](0x1f4,_0x5ad941[_0xd773('0x16')]));});});};exports['CreateCmHopper']=function(_0x1076be){var _0x24d321=this;return new Promise(function(_0x1a1a4f,_0x2c06fd){return db[_0xd773('0x19')][_0xd773('0x25')](_0x1076be[_0xd773('0x26')],{'raw':_0x1076be[_0xd773('0x1a')]?_0x1076be[_0xd773('0x1a')][_0xd773('0x1b')]===undefined?!![]:![]:!![]})[_0xd773('0xd')](function(_0x20af6c){logger[_0xd773('0xe')](_0xd773('0x27'),_0x1076be);logger[_0xd773('0x10')](_0xd773('0x27'),_0x1076be,JSON[_0xd773('0x12')](_0x20af6c));_0x1a1a4f(_0x20af6c);})[_0xd773('0x18')](function(_0x2eec46){logger[_0xd773('0x13')](_0xd773('0x27'),_0x2eec46[_0xd773('0x16')],_0x1076be);_0x2c06fd(_0x24d321[_0xd773('0x13')](0x1f4,_0x2eec46[_0xd773('0x16')]));});});};exports['UpdateCmHopper']=function(_0x56c6a6){var _0x46e25a=this;return new Promise(function(_0x39e2e3,_0x460aa4){return db['CmHopper'][_0xd773('0x28')](_0x56c6a6[_0xd773('0x26')],{'raw':_0x56c6a6['options']?_0x56c6a6[_0xd773('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c6a6[_0xd773('0x1a')]?_0x56c6a6[_0xd773('0x1a')][_0xd773('0x1c')]||null:null,'attributes':_0x56c6a6[_0xd773('0x1a')]?_0x56c6a6[_0xd773('0x1a')][_0xd773('0x1d')]||null:null,'limit':_0x56c6a6[_0xd773('0x1a')]?_0x56c6a6['options'][_0xd773('0x1e')]||null:null})['then'](function(_0x3e4846){logger[_0xd773('0xe')](_0xd773('0x29'),_0x56c6a6);logger[_0xd773('0x10')](_0xd773('0x29'),_0x56c6a6,JSON[_0xd773('0x12')](_0x3e4846));_0x39e2e3(_0x3e4846);})['catch'](function(_0x151ea9){logger['error'](_0xd773('0x29'),_0x151ea9[_0xd773('0x16')],_0x56c6a6);_0x460aa4(_0x46e25a[_0xd773('0x13')](0x1f4,_0x151ea9[_0xd773('0x16')]));});});};exports[_0xd773('0x2a')]=function(_0x8fc947){var _0x370c6d=this;return new Promise(function(_0x1d1f32,_0x19c4fa){return db[_0xd773('0x19')][_0xd773('0x2b')]({'where':_0x8fc947['options']?_0x8fc947[_0xd773('0x1a')][_0xd773('0x1c')]||null:null})[_0xd773('0xd')](function(_0x36cce3){logger[_0xd773('0xe')](_0xd773('0x2a'),_0x8fc947);logger[_0xd773('0x10')]('DestroyCmHopper',_0x8fc947,JSON[_0xd773('0x12')](_0x36cce3));_0x1d1f32(_0x36cce3);})['catch'](function(_0x22bab5){logger[_0xd773('0x13')](_0xd773('0x2a'),_0x22bab5[_0xd773('0x16')],_0x8fc947);_0x19c4fa(_0x370c6d['error'](0x1f4,_0x22bab5[_0xd773('0x16')]));});});};exports['GetContactDialer']=function(_0x5b29ce){var _0x270ceb=this;return new Promise(function(_0x53f2fb,_0x1e7b21){return db[_0xd773('0x2c')][_0xd773('0x2d')]()[_0xd773('0xd')](function(_0x180d9f){return db['sequelize']['transaction'](function(_0x595c2c){return db[_0xd773('0x19')][_0xd773('0x2e')]({'where':_0x5b29ce[_0xd773('0x1a')]?_0x5b29ce['options'][_0xd773('0x1c')]||null:null,'attributes':_0x5b29ce[_0xd773('0x1a')]?_0x5b29ce[_0xd773('0x1a')]['attributes']||null:null,'limit':_0x5b29ce[_0xd773('0x1a')]?_0x5b29ce[_0xd773('0x1a')][_0xd773('0x1e')]||null:null,'order':_0x5b29ce[_0xd773('0x1a')]?_0x5b29ce[_0xd773('0x1a')][_0xd773('0x2f')]||null:null,'transaction':_0x595c2c,'lock':_0x595c2c[_0xd773('0x30')][_0xd773('0x31')],'include':[{'model':db[_0xd773('0x2c')],'as':_0xd773('0x32'),'attributes':_['keys'](_0x180d9f)},{'model':db[_0xd773('0x33')],'as':'Agent','attributes':['id',_0xd773('0x34'),_0xd773('0x35')]}]})['then'](function(_0x1c5a2e){var _0x2152cc=[];var _0x340247=[];for(var _0x438157=0x0;_0x438157<_0x1c5a2e['length'];_0x438157+=0x1){if(!_0x340247['includes'](_0x1c5a2e[_0x438157]['UserId'])){_0x340247['push'](_0x1c5a2e[_0x438157][_0xd773('0x36')]);_0x2152cc['push'](_0x1c5a2e[_0x438157][_0xd773('0x28')](_0x5b29ce[_0xd773('0x26')],{'transaction':_0x595c2c}));}}return BPromise[_0xd773('0x37')](_0x2152cc);});})[_0xd773('0xd')](function(_0x4d8d43){logger[_0xd773('0xe')](_0xd773('0x38'),_0x5b29ce);logger[_0xd773('0x10')]('GetContactDialer',_0x5b29ce,JSON[_0xd773('0x12')](_0x4d8d43));_0x53f2fb(_0x4d8d43);})[_0xd773('0x18')](function(_0x5595c4){logger['error'](_0xd773('0x38'),_0x5595c4['message'],_0x5b29ce);_0x1e7b21(_0x270ceb[_0xd773('0x13')](0x1f4,_0x5595c4[_0xd773('0x16')]));});});});};exports[_0xd773('0x39')]=function(_0x22c987){var _0x512e3a=this;return new Promise(function(_0x20cb6c,_0x36d56e){return db[_0xd773('0x3a')][_0xd773('0x3b')](function(_0x12081b){return db[_0xd773('0x3c')][_0xd773('0x25')](_0x22c987[_0xd773('0x26')],{'raw':_0x22c987[_0xd773('0x1a')]?_0x22c987[_0xd773('0x1a')][_0xd773('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x12081b})['then'](function(){return db[_0xd773('0x19')][_0xd773('0x2b')]({'where':_0x22c987[_0xd773('0x1a')]?_0x22c987['options'][_0xd773('0x1c')]||null:null,'transaction':_0x12081b});});})[_0xd773('0xd')](function(_0x243a6d){logger['info'](_0xd773('0x39'),_0x22c987);logger[_0xd773('0x10')](_0xd773('0x39'),_0x22c987,JSON['stringify'](_0x243a6d));_0x20cb6c(_0x243a6d);})[_0xd773('0x18')](function(_0x5b4994){logger[_0xd773('0x13')](_0xd773('0x39'),_0x5b4994[_0xd773('0x16')],_0x22c987);_0x36d56e(_0x512e3a['error'](0x1f4,_0x5b4994[_0xd773('0x16')]));});});};exports['CountReScheduled']=function(_0x36e97e){var _0x1e407c=this;return new Promise(function(_0x622b4b,_0x184edf){return db[_0xd773('0x19')][_0xd773('0x2e')]({'raw':_0x36e97e[_0xd773('0x1a')]?_0x36e97e['options'][_0xd773('0x1b')]===undefined?!![]:![]:!![],'where':_0x36e97e[_0xd773('0x1a')]?_0x36e97e['options'][_0xd773('0x1c')]||null:null,'attributes':[[db[_0xd773('0x3a')]['fn'](_0xd773('0x3d'),db[_0xd773('0x3a')]['fn']('IF',db[_0xd773('0x3a')][_0xd773('0x3e')](_0xd773('0x3f')+util[_0xd773('0x40')](_0xd773('0x41'),moment()[_0xd773('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xd773('0x42')]]})[_0xd773('0xd')](function(_0x308e5e){logger['info'](_0xd773('0x43'),_0x36e97e);logger[_0xd773('0x10')](_0xd773('0x43'),_0x36e97e,JSON[_0xd773('0x12')](_0x308e5e));_0x622b4b(_0x308e5e);})[_0xd773('0x18')](function(_0x53e21e){logger[_0xd773('0x13')](_0xd773('0x43'),_0x53e21e[_0xd773('0x16')],_0x36e97e);_0x184edf(_0x1e407c[_0xd773('0x13')](0x1f4,_0x53e21e['message']));});});};exports[_0xd773('0x44')]=function(_0x4dd695){var _0xf2aa09=this;return new Promise(function(_0x2c6f2c,_0x420c1f){return db[_0xd773('0x2c')][_0xd773('0x2d')]()['then'](function(_0x42dc14){return db['sequelize'][_0xd773('0x3b')](function(_0x5a47ed){return db['CmHopper'][_0xd773('0x2e')]({'where':_0x4dd695[_0xd773('0x1a')]?_0x4dd695[_0xd773('0x1a')][_0xd773('0x1c')]||null:null,'attributes':_0x4dd695[_0xd773('0x1a')]?_0x4dd695[_0xd773('0x1a')][_0xd773('0x1d')]||null:null,'limit':0x1,'order':_0x4dd695[_0xd773('0x1a')]?_0x4dd695['options'][_0xd773('0x2f')]||null:null,'group':db['CmHopper'][_0xd773('0x36')],'transaction':_0x5a47ed,'lock':_0x5a47ed['LOCK'][_0xd773('0x31')],'include':_0x4dd695[_0xd773('0x1a')]?_0x4dd695[_0xd773('0x1a')]['include']?_[_0xd773('0x20')](_0x4dd695[_0xd773('0x1a')]['include'],function(_0x5a3e33){return{'model':db[_0x5a3e33[_0xd773('0x21')]],'as':_0x5a3e33['as'],'attributes':_0x5a3e33['attributes'],'include':_0x5a3e33[_0xd773('0x1f')]?_['map'](_0x5a3e33[_0xd773('0x1f')],function(_0xa274c8){return{'model':db[_0xa274c8[_0xd773('0x21')]],'as':_0xa274c8['as'],'attributes':_0xa274c8[_0xd773('0x1d')],'include':_0xa274c8['include']?_[_0xd773('0x20')](_0xa274c8[_0xd773('0x1f')],function(_0x495a30){return{'model':db[_0x495a30[_0xd773('0x21')]],'as':_0x495a30['as'],'attributes':_0x495a30['attributes']};}):[]};}):[]};}):[]:[]})[_0xd773('0xd')](function(_0x11c11b){var _0x281d73=[];for(var _0x2c6d08=0x0;_0x2c6d08<_0x11c11b[_0xd773('0x45')];_0x2c6d08+=0x1){_0x281d73[_0xd773('0x46')](_0x11c11b[_0x2c6d08]['update'](_0x4dd695[_0xd773('0x26')],{'transaction':_0x5a47ed}));}return BPromise[_0xd773('0x37')](_0x281d73);});})[_0xd773('0xd')](function(_0x1e7d87){logger['info']('GetContactRecallMe',_0x4dd695);logger[_0xd773('0x10')](_0xd773('0x44'),_0x4dd695,JSON[_0xd773('0x12')](_0x1e7d87));_0x2c6f2c(_0x1e7d87);})[_0xd773('0x18')](function(_0x3a42fd){logger[_0xd773('0x13')](_0xd773('0x44'),_0x3a42fd[_0xd773('0x16')],_0x4dd695);_0x420c1f(_0xf2aa09[_0xd773('0x13')](0x1f4,_0x3a42fd[_0xd773('0x16')]));});});});};exports[_0xd773('0x47')]=function(_0x5be9d5){var _0x3095ab=this;return new Promise(function(_0x1f6d10,_0x583ab7){db[_0xd773('0x2c')]['describe']()[_0xd773('0xd')](function(_0x482141){return db[_0xd773('0x19')][_0xd773('0x2e')]({'raw':_0x5be9d5[_0xd773('0x1a')]?_0x5be9d5[_0xd773('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5be9d5[_0xd773('0x1a')]?_0x5be9d5[_0xd773('0x1a')][_0xd773('0x1c')]||null:null,'attributes':_0x5be9d5[_0xd773('0x1a')]?_0x5be9d5[_0xd773('0x1a')][_0xd773('0x1d')]||null:null,'limit':_0x5be9d5[_0xd773('0x1a')]?_0x5be9d5[_0xd773('0x1a')][_0xd773('0x1e')]||null:null,'include':_0x5be9d5[_0xd773('0x1a')]?_0x5be9d5[_0xd773('0x1a')][_0xd773('0x1f')]?_[_0xd773('0x20')](_0x5be9d5['options'][_0xd773('0x1f')],function(_0x11daa4){return{'model':db[_0x11daa4[_0xd773('0x21')]],'as':_0x11daa4['as'],'attributes':_0x11daa4['as']==='Contact'?_[_0xd773('0x48')](_0x482141):_0x11daa4['attributes'],'include':_0x11daa4['include']?_[_0xd773('0x20')](_0x11daa4[_0xd773('0x1f')],function(_0x3f0e97){return{'model':db[_0x3f0e97['model']],'as':_0x3f0e97['as'],'attributes':_0x3f0e97['attributes'],'include':_0x3f0e97[_0xd773('0x1f')]?_[_0xd773('0x20')](_0x3f0e97[_0xd773('0x1f')],function(_0x343ce8){return{'model':db[_0x343ce8[_0xd773('0x21')]],'as':_0x343ce8['as'],'attributes':_0x343ce8[_0xd773('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd773('0xd')](function(_0x346642){logger[_0xd773('0xe')]('GetCmHopper',_0x5be9d5);logger[_0xd773('0x10')](_0xd773('0x22'),_0x5be9d5,JSON[_0xd773('0x12')](_0x346642));_0x1f6d10(_0x346642);})[_0xd773('0x18')](function(_0x18a849){logger[_0xd773('0x13')]('GetCmHopper',_0x18a849[_0xd773('0x16')],_0x5be9d5);_0x583ab7(_0x3095ab[_0xd773('0x13')](0x1f4,_0x18a849[_0xd773('0x16')]));});});});}; \ No newline at end of file +var _0x5078=['code','message','result','catch','GetCmHopper','CmHopper','raw','options','where','attributes','limit','include','map','model','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','order','LOCK','keys','Agent','name','voicePause','length','includes','UserId','update','all','transaction','create','MoveContactManagedDialer','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','UPDATE','push','GetContactRecallMe','GetCmHopperPreview','Contact','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x297ff6,_0x48e3c4){var _0x4a76ba=function(_0x1405a1){while(--_0x1405a1){_0x297ff6['push'](_0x297ff6['shift']());}};_0x4a76ba(++_0x48e3c4);}(_0x5078,0xb7));var _0x8507=function(_0x5673c6,_0xc302ec){_0x5673c6=_0x5673c6-0x0;var _0x130bd9=_0x5078[_0x5673c6];return _0x130bd9;};'use strict';var _=require(_0x8507('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8507('0x1'));var db=require(_0x8507('0x2'))['db'];var utils=require(_0x8507('0x3'));var logger=require(_0x8507('0x4'))(_0x8507('0x5'));var config=require(_0x8507('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8507('0x7')][_0x8507('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c3586,_0x1f9a1d,_0x46e71b){return new BPromise(function(_0xd58eeb,_0x29f6af){return client[_0x8507('0x9')](_0x5c3586,_0x46e71b)[_0x8507('0xa')](function(_0x57c788){logger[_0x8507('0xb')](_0x8507('0xc'),_0x1f9a1d,_0x8507('0xd'));logger[_0x8507('0xe')](_0x8507('0xf'),_0x1f9a1d,_0x8507('0xd'),JSON[_0x8507('0x10')](_0x57c788));if(_0x57c788[_0x8507('0x11')]){if(_0x57c788[_0x8507('0x11')][_0x8507('0x12')]===0x1f4){logger['error'](_0x8507('0xc'),_0x1f9a1d,_0x57c788[_0x8507('0x11')][_0x8507('0x13')]);return _0x29f6af(_0x57c788['error'][_0x8507('0x13')]);}logger[_0x8507('0x11')](_0x8507('0xc'),_0x1f9a1d,_0x57c788['error'][_0x8507('0x13')]);return _0xd58eeb(_0x57c788[_0x8507('0x11')][_0x8507('0x13')]);}else{logger['info'](_0x8507('0xc'),_0x1f9a1d,_0x8507('0xd'));_0xd58eeb(_0x57c788[_0x8507('0x14')][_0x8507('0x13')]);}})[_0x8507('0x15')](function(_0x5b6372){logger[_0x8507('0x11')](_0x8507('0xc'),_0x1f9a1d,_0x5b6372);_0x29f6af(_0x5b6372);});});}exports[_0x8507('0x16')]=function(_0x3eedda){var _0x553b1d=this;return new Promise(function(_0xff959d,_0x54449b){return db[_0x8507('0x17')]['findAll']({'raw':_0x3eedda['options']?_0x3eedda['options'][_0x8507('0x18')]===undefined?!![]:![]:!![],'where':_0x3eedda[_0x8507('0x19')]?_0x3eedda[_0x8507('0x19')][_0x8507('0x1a')]||null:null,'attributes':_0x3eedda[_0x8507('0x19')]?_0x3eedda[_0x8507('0x19')][_0x8507('0x1b')]||null:null,'limit':_0x3eedda[_0x8507('0x19')]?_0x3eedda[_0x8507('0x19')][_0x8507('0x1c')]||null:null,'include':_0x3eedda[_0x8507('0x19')]?_0x3eedda[_0x8507('0x19')][_0x8507('0x1d')]?_[_0x8507('0x1e')](_0x3eedda['options'][_0x8507('0x1d')],function(_0x25d55e){return{'model':db[_0x25d55e[_0x8507('0x1f')]],'as':_0x25d55e['as'],'attributes':_0x25d55e[_0x8507('0x1b')],'include':_0x25d55e['include']?_[_0x8507('0x1e')](_0x25d55e[_0x8507('0x1d')],function(_0x57136e){return{'model':db[_0x57136e[_0x8507('0x1f')]],'as':_0x57136e['as'],'attributes':_0x57136e[_0x8507('0x1b')],'include':_0x57136e[_0x8507('0x1d')]?_[_0x8507('0x1e')](_0x57136e[_0x8507('0x1d')],function(_0x2e99a9){return{'model':db[_0x2e99a9[_0x8507('0x1f')]],'as':_0x2e99a9['as'],'attributes':_0x2e99a9[_0x8507('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8507('0xa')](function(_0x423dc2){logger[_0x8507('0xb')]('GetCmHopper',_0x3eedda);logger[_0x8507('0xe')](_0x8507('0x16'),_0x3eedda,JSON['stringify'](_0x423dc2));_0xff959d(_0x423dc2);})['catch'](function(_0x41cf66){logger['error']('GetCmHopper',_0x41cf66[_0x8507('0x13')],_0x3eedda);_0x54449b(_0x553b1d['error'](0x1f4,_0x41cf66['message']));});});};exports[_0x8507('0x20')]=function(_0x104f69){var _0x3f1086=this;return new Promise(function(_0x3b25d3,_0x5580d8){return db['CmHopper']['find']({'raw':_0x104f69[_0x8507('0x19')]?_0x104f69[_0x8507('0x19')][_0x8507('0x18')]===undefined?!![]:![]:!![],'where':_0x104f69['options']?_0x104f69[_0x8507('0x19')][_0x8507('0x1a')]||null:null,'attributes':_0x104f69[_0x8507('0x19')]?_0x104f69['options'][_0x8507('0x1b')]||null:null,'include':_0x104f69[_0x8507('0x19')]?_0x104f69[_0x8507('0x19')]['include']?_[_0x8507('0x1e')](_0x104f69[_0x8507('0x19')]['include'],function(_0x45eb91){return{'model':db[_0x45eb91['model']],'as':_0x45eb91['as'],'attributes':_0x45eb91['attributes'],'include':_0x45eb91[_0x8507('0x1d')]?_[_0x8507('0x1e')](_0x45eb91[_0x8507('0x1d')],function(_0xf419fe){return{'model':db[_0xf419fe[_0x8507('0x1f')]],'as':_0xf419fe['as'],'attributes':_0xf419fe['attributes'],'include':_0xf419fe[_0x8507('0x1d')]?_[_0x8507('0x1e')](_0xf419fe[_0x8507('0x1d')],function(_0x3cdf6f){return{'model':db[_0x3cdf6f[_0x8507('0x1f')]],'as':_0x3cdf6f['as'],'attributes':_0x3cdf6f[_0x8507('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8507('0xa')](function(_0x3b06e6){logger[_0x8507('0xb')](_0x8507('0x20'),_0x104f69);logger['debug']('ShowCmHopper',_0x104f69,JSON[_0x8507('0x10')](_0x3b06e6));_0x3b25d3(_0x3b06e6);})[_0x8507('0x15')](function(_0x2d9116){logger[_0x8507('0x11')](_0x8507('0x20'),_0x2d9116[_0x8507('0x13')],_0x104f69);_0x5580d8(_0x3f1086[_0x8507('0x11')](0x1f4,_0x2d9116['message']));});});};exports[_0x8507('0x21')]=function(_0x2567f3){var _0x760c2b=this;return new Promise(function(_0x1fcd65,_0x5bc2ba){return db['CmHopper']['create'](_0x2567f3['body'],{'raw':_0x2567f3[_0x8507('0x19')]?_0x2567f3['options'][_0x8507('0x18')]===undefined?!![]:![]:!![]})[_0x8507('0xa')](function(_0x790dbb){logger[_0x8507('0xb')]('CreateCmHopper',_0x2567f3);logger[_0x8507('0xe')](_0x8507('0x21'),_0x2567f3,JSON[_0x8507('0x10')](_0x790dbb));_0x1fcd65(_0x790dbb);})[_0x8507('0x15')](function(_0x5b4e75){logger[_0x8507('0x11')]('CreateCmHopper',_0x5b4e75[_0x8507('0x13')],_0x2567f3);_0x5bc2ba(_0x760c2b[_0x8507('0x11')](0x1f4,_0x5b4e75[_0x8507('0x13')]));});});};exports['UpdateCmHopper']=function(_0x4dba82){var _0x5c0993=this;return new Promise(function(_0x281e2e,_0x55a0de){return db[_0x8507('0x17')]['update'](_0x4dba82[_0x8507('0x22')],{'raw':_0x4dba82[_0x8507('0x19')]?_0x4dba82[_0x8507('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dba82[_0x8507('0x19')]?_0x4dba82[_0x8507('0x19')][_0x8507('0x1a')]||null:null,'attributes':_0x4dba82[_0x8507('0x19')]?_0x4dba82[_0x8507('0x19')][_0x8507('0x1b')]||null:null,'limit':_0x4dba82[_0x8507('0x19')]?_0x4dba82[_0x8507('0x19')]['limit']||null:null})['then'](function(_0x5ee517){logger['info']('UpdateCmHopper',_0x4dba82);logger['debug']('UpdateCmHopper',_0x4dba82,JSON[_0x8507('0x10')](_0x5ee517));_0x281e2e(_0x5ee517);})[_0x8507('0x15')](function(_0x2d4fe5){logger['error'](_0x8507('0x23'),_0x2d4fe5[_0x8507('0x13')],_0x4dba82);_0x55a0de(_0x5c0993['error'](0x1f4,_0x2d4fe5[_0x8507('0x13')]));});});};exports[_0x8507('0x24')]=function(_0x4298c7){var _0x58c74e=this;return new Promise(function(_0x375f80,_0x868748){return db[_0x8507('0x17')][_0x8507('0x25')]({'where':_0x4298c7[_0x8507('0x19')]?_0x4298c7[_0x8507('0x19')][_0x8507('0x1a')]||null:null})[_0x8507('0xa')](function(_0x9d0a1d){logger[_0x8507('0xb')]('DestroyCmHopper',_0x4298c7);logger[_0x8507('0xe')](_0x8507('0x24'),_0x4298c7,JSON['stringify'](_0x9d0a1d));_0x375f80(_0x9d0a1d);})[_0x8507('0x15')](function(_0x3d8ca6){logger[_0x8507('0x11')](_0x8507('0x24'),_0x3d8ca6[_0x8507('0x13')],_0x4298c7);_0x868748(_0x58c74e[_0x8507('0x11')](0x1f4,_0x3d8ca6[_0x8507('0x13')]));});});};exports[_0x8507('0x26')]=function(_0xfe335a){var _0x527813=this;return new Promise(function(_0x6261c2,_0x28ac07){return db[_0x8507('0x27')][_0x8507('0x28')]()[_0x8507('0xa')](function(_0x184251){return db[_0x8507('0x29')]['transaction'](function(_0x27c5ba){return db[_0x8507('0x17')][_0x8507('0x2a')]({'where':_0xfe335a[_0x8507('0x19')]?_0xfe335a[_0x8507('0x19')][_0x8507('0x1a')]||null:null,'attributes':_0xfe335a[_0x8507('0x19')]?_0xfe335a[_0x8507('0x19')][_0x8507('0x1b')]||null:null,'limit':_0xfe335a['options']?_0xfe335a[_0x8507('0x19')][_0x8507('0x1c')]||null:null,'order':_0xfe335a[_0x8507('0x19')]?_0xfe335a[_0x8507('0x19')][_0x8507('0x2b')]||null:null,'transaction':_0x27c5ba,'lock':_0x27c5ba[_0x8507('0x2c')]['UPDATE'],'include':[{'model':db[_0x8507('0x27')],'as':'Contact','attributes':_[_0x8507('0x2d')](_0x184251)},{'model':db['User'],'as':_0x8507('0x2e'),'attributes':['id',_0x8507('0x2f'),_0x8507('0x30')]}]})[_0x8507('0xa')](function(_0x30e711){var _0x6be07c=[];var _0x1e97c7=[];for(var _0x1bfa08=0x0;_0x1bfa08<_0x30e711[_0x8507('0x31')];_0x1bfa08+=0x1){if(!_0x1e97c7[_0x8507('0x32')](_0x30e711[_0x1bfa08][_0x8507('0x33')])){_0x1e97c7['push'](_0x30e711[_0x1bfa08][_0x8507('0x33')]);_0x6be07c['push'](_0x30e711[_0x1bfa08][_0x8507('0x34')](_0xfe335a[_0x8507('0x22')],{'transaction':_0x27c5ba}));}}return BPromise[_0x8507('0x35')](_0x6be07c);});})[_0x8507('0xa')](function(_0x287be3){logger[_0x8507('0xb')](_0x8507('0x26'),_0xfe335a);logger[_0x8507('0xe')](_0x8507('0x26'),_0xfe335a,JSON['stringify'](_0x287be3));_0x6261c2(_0x287be3);})[_0x8507('0x15')](function(_0x4baf32){logger[_0x8507('0x11')](_0x8507('0x26'),_0x4baf32[_0x8507('0x13')],_0xfe335a);_0x28ac07(_0x527813[_0x8507('0x11')](0x1f4,_0x4baf32[_0x8507('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x5b9fb8){var _0x20d06a=this;return new Promise(function(_0x3e4432,_0x41ad81){return db[_0x8507('0x29')][_0x8507('0x36')](function(_0x245dea){return db['CmHopperFinal'][_0x8507('0x37')](_0x5b9fb8['body'],{'raw':_0x5b9fb8[_0x8507('0x19')]?_0x5b9fb8[_0x8507('0x19')][_0x8507('0x18')]===undefined?!![]:![]:!![],'transaction':_0x245dea})[_0x8507('0xa')](function(){return db[_0x8507('0x17')][_0x8507('0x25')]({'where':_0x5b9fb8[_0x8507('0x19')]?_0x5b9fb8[_0x8507('0x19')][_0x8507('0x1a')]||null:null,'transaction':_0x245dea});});})['then'](function(_0x529c18){logger[_0x8507('0xb')](_0x8507('0x38'),_0x5b9fb8);logger['debug'](_0x8507('0x38'),_0x5b9fb8,JSON[_0x8507('0x10')](_0x529c18));_0x3e4432(_0x529c18);})[_0x8507('0x15')](function(_0x5d3eb9){logger[_0x8507('0x11')](_0x8507('0x38'),_0x5d3eb9[_0x8507('0x13')],_0x5b9fb8);_0x41ad81(_0x20d06a[_0x8507('0x11')](0x1f4,_0x5d3eb9['message']));});});};exports['CountReScheduled']=function(_0x56822f){var _0x1dd56e=this;return new Promise(function(_0x446b2d,_0x323b30){return db['CmHopper'][_0x8507('0x2a')]({'raw':_0x56822f[_0x8507('0x19')]?_0x56822f[_0x8507('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56822f['options']?_0x56822f['options'][_0x8507('0x1a')]||null:null,'attributes':[[db[_0x8507('0x29')]['fn']('COUNT',db[_0x8507('0x29')]['fn']('IF',db[_0x8507('0x29')]['literal'](_0x8507('0x39')+util[_0x8507('0x3a')]('\x22%s\x22',moment()[_0x8507('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x8507('0x3b')))),_0x8507('0x3c')]]})[_0x8507('0xa')](function(_0x5acb9a){logger[_0x8507('0xb')](_0x8507('0x3d'),_0x56822f);logger[_0x8507('0xe')]('CountReScheduled',_0x56822f,JSON['stringify'](_0x5acb9a));_0x446b2d(_0x5acb9a);})['catch'](function(_0x393482){logger[_0x8507('0x11')]('CountReScheduled',_0x393482[_0x8507('0x13')],_0x56822f);_0x323b30(_0x1dd56e[_0x8507('0x11')](0x1f4,_0x393482[_0x8507('0x13')]));});});};exports['GetContactRecallMe']=function(_0x668ffb){var _0x4f17d1=this;return new Promise(function(_0x4282a0,_0x166cf5){return db['CmContact'][_0x8507('0x28')]()[_0x8507('0xa')](function(_0x28316c){return db[_0x8507('0x29')][_0x8507('0x36')](function(_0x550f9f){return db[_0x8507('0x17')][_0x8507('0x2a')]({'where':_0x668ffb['options']?_0x668ffb['options'][_0x8507('0x1a')]||null:null,'attributes':_0x668ffb['options']?_0x668ffb[_0x8507('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x668ffb['options']?_0x668ffb[_0x8507('0x19')][_0x8507('0x2b')]||null:null,'group':db['CmHopper'][_0x8507('0x33')],'transaction':_0x550f9f,'lock':_0x550f9f['LOCK'][_0x8507('0x3e')],'include':_0x668ffb[_0x8507('0x19')]?_0x668ffb[_0x8507('0x19')]['include']?_['map'](_0x668ffb['options'][_0x8507('0x1d')],function(_0x51c066){return{'model':db[_0x51c066[_0x8507('0x1f')]],'as':_0x51c066['as'],'attributes':_0x51c066['attributes'],'include':_0x51c066[_0x8507('0x1d')]?_[_0x8507('0x1e')](_0x51c066[_0x8507('0x1d')],function(_0x3631a3){return{'model':db[_0x3631a3[_0x8507('0x1f')]],'as':_0x3631a3['as'],'attributes':_0x3631a3[_0x8507('0x1b')],'include':_0x3631a3[_0x8507('0x1d')]?_[_0x8507('0x1e')](_0x3631a3['include'],function(_0x49c5ee){return{'model':db[_0x49c5ee[_0x8507('0x1f')]],'as':_0x49c5ee['as'],'attributes':_0x49c5ee[_0x8507('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ad57b){var _0x19c7f2=[];for(var _0x5e403f=0x0;_0x5e403f<_0x1ad57b['length'];_0x5e403f+=0x1){_0x19c7f2[_0x8507('0x3f')](_0x1ad57b[_0x5e403f][_0x8507('0x34')](_0x668ffb[_0x8507('0x22')],{'transaction':_0x550f9f}));}return BPromise[_0x8507('0x35')](_0x19c7f2);});})['then'](function(_0x2aebfb){logger[_0x8507('0xb')](_0x8507('0x40'),_0x668ffb);logger[_0x8507('0xe')]('GetContactRecallMe',_0x668ffb,JSON['stringify'](_0x2aebfb));_0x4282a0(_0x2aebfb);})[_0x8507('0x15')](function(_0x5960e5){logger[_0x8507('0x11')]('GetContactRecallMe',_0x5960e5[_0x8507('0x13')],_0x668ffb);_0x166cf5(_0x4f17d1['error'](0x1f4,_0x5960e5[_0x8507('0x13')]));});});});};exports[_0x8507('0x41')]=function(_0x469648){var _0x1e4c92=this;return new Promise(function(_0x1ed848,_0x29444a){db['CmContact'][_0x8507('0x28')]()[_0x8507('0xa')](function(_0x4acb76){return db[_0x8507('0x17')][_0x8507('0x2a')]({'raw':_0x469648['options']?_0x469648['options'][_0x8507('0x18')]===undefined?!![]:![]:!![],'where':_0x469648[_0x8507('0x19')]?_0x469648[_0x8507('0x19')][_0x8507('0x1a')]||null:null,'attributes':_0x469648[_0x8507('0x19')]?_0x469648[_0x8507('0x19')]['attributes']||null:null,'limit':_0x469648['options']?_0x469648[_0x8507('0x19')]['limit']||null:null,'include':_0x469648['options']?_0x469648[_0x8507('0x19')][_0x8507('0x1d')]?_['map'](_0x469648[_0x8507('0x19')][_0x8507('0x1d')],function(_0x239e64){return{'model':db[_0x239e64[_0x8507('0x1f')]],'as':_0x239e64['as'],'attributes':_0x239e64['as']===_0x8507('0x42')?_[_0x8507('0x2d')](_0x4acb76):_0x239e64[_0x8507('0x1b')],'include':_0x239e64['include']?_[_0x8507('0x1e')](_0x239e64['include'],function(_0x2dc4cf){return{'model':db[_0x2dc4cf[_0x8507('0x1f')]],'as':_0x2dc4cf['as'],'attributes':_0x2dc4cf[_0x8507('0x1b')],'include':_0x2dc4cf[_0x8507('0x1d')]?_[_0x8507('0x1e')](_0x2dc4cf[_0x8507('0x1d')],function(_0x422de6){return{'model':db[_0x422de6[_0x8507('0x1f')]],'as':_0x422de6['as'],'attributes':_0x422de6[_0x8507('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x563999){logger[_0x8507('0xb')](_0x8507('0x16'),_0x469648);logger[_0x8507('0xe')](_0x8507('0x16'),_0x469648,JSON['stringify'](_0x563999));_0x1ed848(_0x563999);})[_0x8507('0x15')](function(_0x5b875c){logger[_0x8507('0x11')](_0x8507('0x16'),_0x5b875c[_0x8507('0x13')],_0x469648);_0x29444a(_0x1e4c92[_0x8507('0x11')](0x1f4,_0x5b875c[_0x8507('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9f2a222..eb5f143 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 _0xfef3=['multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','show','post','/preview','put','update','delete','exports'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xfef3,0x118));var _0x3fef=function(_0xe5088b,_0x21f295){_0xe5088b=_0xe5088b-0x0;var _0x7ff7f5=_0xfef3[_0xe5088b];return _0x7ff7f5;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3fef('0x4'));var config=require(_0x3fef('0x5'));var controller=require('./cmHopper.controller');router[_0x3fef('0x6')]('/',auth[_0x3fef('0x7')](),controller['index']);router[_0x3fef('0x6')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller[_0x3fef('0x9')]);router[_0x3fef('0x6')](_0x3fef('0xa'),auth[_0x3fef('0x7')](),controller[_0x3fef('0xb')]);router[_0x3fef('0x6')](_0x3fef('0xc'),auth[_0x3fef('0x7')](),controller[_0x3fef('0xd')]);router[_0x3fef('0xe')]('/',auth[_0x3fef('0x7')](),controller['create']);router[_0x3fef('0xe')](_0x3fef('0xf'),auth[_0x3fef('0x7')](),controller['getPreview']);router[_0x3fef('0x10')]('/:id',auth[_0x3fef('0x7')](),controller[_0x3fef('0x11')]);router[_0x3fef('0x12')]('/:id',auth[_0x3fef('0x7')](),controller['destroy']);module[_0x3fef('0x13')]=router; \ No newline at end of file +var _0x1d21=['get','isAuthenticated','index','/describe','describe','/opencontacts','show','create','post','/preview','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1dc484,_0x46350a){var _0x5cf305=function(_0xee791a){while(--_0xee791a){_0x1dc484['push'](_0x1dc484['shift']());}};_0x5cf305(++_0x46350a);}(_0x1d21,0x158));var _0x11d2=function(_0x4eb7e6,_0x451464){_0x4eb7e6=_0x4eb7e6-0x0;var _0x3cf508=_0x1d21[_0x4eb7e6];return _0x3cf508;};'use strict';var multer=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var path=require(_0x11d2('0x2'));var timeout=require(_0x11d2('0x3'));var express=require('express');var router=express[_0x11d2('0x4')]();var auth=require(_0x11d2('0x5'));var interaction=require(_0x11d2('0x6'));var config=require(_0x11d2('0x7'));var controller=require('./cmHopper.controller');router[_0x11d2('0x8')]('/',auth[_0x11d2('0x9')](),controller[_0x11d2('0xa')]);router[_0x11d2('0x8')](_0x11d2('0xb'),auth[_0x11d2('0x9')](),controller[_0x11d2('0xc')]);router['get'](_0x11d2('0xd'),auth[_0x11d2('0x9')](),controller['getOpenContacts']);router[_0x11d2('0x8')]('/:id',auth[_0x11d2('0x9')](),controller[_0x11d2('0xe')]);router['post']('/',auth[_0x11d2('0x9')](),controller[_0x11d2('0xf')]);router[_0x11d2('0x10')](_0x11d2('0x11'),auth['isAuthenticated'](),controller['getPreview']);router[_0x11d2('0x12')](_0x11d2('0x13'),auth[_0x11d2('0x9')](),controller['update']);router[_0x11d2('0x14')](_0x11d2('0x13'),auth[_0x11d2('0x9')](),controller[_0x11d2('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index af1888b..3c7d7c2 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 _0x53aa=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0xb104ab,_0x2d29f5){var _0x3adfbf=function(_0x156fa9){while(--_0x156fa9){_0xb104ab['push'](_0xb104ab['shift']());}};_0x3adfbf(++_0x2d29f5);}(_0x53aa,0xca));var _0xa53a=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x53aa[_0x2080a3];return _0x8d7d17;};'use strict';var moment=require('moment');var Sequelize=require(_0xa53a('0x0'));module[_0xa53a('0x1')]={'phone':{'type':Sequelize[_0xa53a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa53a('0x3')],'unique':_0xa53a('0x4')},'ListId':{'type':Sequelize[_0xa53a('0x3')],'unique':_0xa53a('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa53a('0x3')],'unique':_0xa53a('0x4')}}; \ No newline at end of file +var _0xfb10=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0xfb10,0xa8));var _0x0fb1=function(_0x54763a,_0xe483a6){_0x54763a=_0x54763a-0x0;var _0x6e6344=_0xfb10[_0x54763a];return _0x6e6344;};'use strict';var moment=require(_0x0fb1('0x0'));var Sequelize=require(_0x0fb1('0x1'));module[_0x0fb1('0x2')]={'phone':{'type':Sequelize[_0x0fb1('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0fb1('0x4')],'unique':_0x0fb1('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0fb1('0x5')},'VoiceQueueId':{'type':Sequelize[_0x0fb1('0x4')],'unique':_0x0fb1('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index da0d285..4bb9fa8 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 _0x3c61=['send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','name'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x3c61,0xc3));var _0x13c6=function(_0x4eedb6,_0x5f4b86){_0x4eedb6=_0x4eedb6-0x0;var _0x59fc26=_0x3c61[_0x4eedb6];return _0x59fc26;};'use strict';var pdf=require(_0x13c6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x13c6('0x1'));var jsonpatch=require(_0x13c6('0x2'));var rp=require(_0x13c6('0x3'));var moment=require(_0x13c6('0x4'));var BPromise=require(_0x13c6('0x5'));var Mustache=require(_0x13c6('0x6'));var util=require(_0x13c6('0x7'));var path=require(_0x13c6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x13c6('0x9'));var fs=require('fs');var _=require(_0x13c6('0xa'));var squel=require(_0x13c6('0xb'));var crypto=require(_0x13c6('0xc'));var jsforce=require(_0x13c6('0xd'));var deskjs=require(_0x13c6('0xe'));var toCsv=require(_0x13c6('0xf'));var querystring=require(_0x13c6('0x10'));var Papa=require(_0x13c6('0x11'));var Redis=require(_0x13c6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x13c6('0x13'));var as=require(_0x13c6('0x14'));var hardwareService=require(_0x13c6('0x15'));var logger=require(_0x13c6('0x16'))(_0x13c6('0x17'));var utils=require(_0x13c6('0x18'));var config=require(_0x13c6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x13c6('0x1a'))['db'];function respondWithStatusCode(_0x192672,_0xb61e60){_0xb61e60=_0xb61e60||0xcc;return function(_0x2f9560){if(_0x2f9560){return _0x192672[_0x13c6('0x1b')](_0xb61e60);}return _0x192672[_0x13c6('0x1c')](_0xb61e60)['end']();};}function respondWithResult(_0x53db85,_0x4999ff){_0x4999ff=_0x4999ff||0xc8;return function(_0x990859){if(_0x990859){return _0x53db85['status'](_0x4999ff)['json'](_0x990859);}};}function respondWithFilteredResult(_0x37eac9,_0x43f0a2){return function(_0x5306fd){if(_0x5306fd){var _0x3a763d=_0x5306fd[_0x13c6('0x1d')],_0xad208d=_0x43f0a2[_0x13c6('0x1e')],_0x2fc920=_0x43f0a2[_0x13c6('0x1e')]+_0x43f0a2['limit'],_0xa52c40;if(_0x2fc920>=_0x3a763d){_0x2fc920=_0x3a763d;_0xa52c40=0xc8;}else{_0xa52c40=0xce;}_0x37eac9['status'](_0xa52c40);return _0x37eac9[_0x13c6('0x1f')](_0x13c6('0x20'),_0xad208d+'-'+_0x2fc920+'/'+_0x3a763d)[_0x13c6('0x21')](_0x5306fd);}return null;};}function patchUpdates(_0x140b54){return function(_0x4afd32){try{jsonpatch[_0x13c6('0x22')](_0x4afd32,_0x140b54,!![]);}catch(_0x44f621){return BPromise[_0x13c6('0x23')](_0x44f621);}return _0x4afd32[_0x13c6('0x24')]();};}function saveUpdates(_0xd66f2e,_0x23b614){return function(_0x2286c0){if(_0x2286c0){return _0x2286c0[_0x13c6('0x25')](_0xd66f2e)[_0x13c6('0x26')](function(_0x202e01){return _0x202e01;});}return null;};}function removeEntity(_0x49b646,_0x23b5dc){return function(_0xb48d75){if(_0xb48d75){return _0xb48d75['destroy']()['then'](function(){_0x49b646[_0x13c6('0x1c')](0xcc)[_0x13c6('0x27')]();});}};}function handleEntityNotFound(_0xb336b4,_0x43e2d2){return function(_0x17048f){if(!_0x17048f){_0xb336b4['sendStatus'](0x194);}return _0x17048f;};}function handleError(_0x3bb7d2,_0x442f74){_0x442f74=_0x442f74||0x1f4;return function(_0x12f136){logger[_0x13c6('0x28')](_0x12f136['stack']);if(_0x12f136[_0x13c6('0x29')]){delete _0x12f136['name'];}_0x3bb7d2[_0x13c6('0x1c')](_0x442f74)[_0x13c6('0x2a')](_0x12f136);};}exports[_0x13c6('0x2b')]=function(_0x26bf7e,_0x296e48){var _0x202876={},_0x41abd2={},_0x418533={'count':0x0,'rows':[]};var _0x2fa327=_[_0x13c6('0x2c')](db[_0x13c6('0x2d')][_0x13c6('0x2e')],function(_0x7d857a){return{'name':_0x7d857a[_0x13c6('0x2f')],'type':_0x7d857a['type'][_0x13c6('0x30')]};});_0x41abd2[_0x13c6('0x31')]=_['map'](_0x2fa327,'name');_0x41abd2[_0x13c6('0x32')]=_[_0x13c6('0x33')](_0x26bf7e['query']);_0x41abd2[_0x13c6('0x34')]=_[_0x13c6('0x35')](_0x41abd2[_0x13c6('0x31')],_0x41abd2[_0x13c6('0x32')]);_0x202876[_0x13c6('0x36')]=_[_0x13c6('0x35')](_0x41abd2[_0x13c6('0x31')],qs[_0x13c6('0x37')](_0x26bf7e[_0x13c6('0x32')]['fields']));_0x202876[_0x13c6('0x36')]=_0x202876[_0x13c6('0x36')][_0x13c6('0x38')]?_0x202876[_0x13c6('0x36')]:_0x41abd2[_0x13c6('0x31')];if(!_0x26bf7e['query']['hasOwnProperty'](_0x13c6('0x39'))){_0x202876[_0x13c6('0x3a')]=qs[_0x13c6('0x3a')](_0x26bf7e['query'][_0x13c6('0x3a')]);_0x202876[_0x13c6('0x1e')]=qs['offset'](_0x26bf7e[_0x13c6('0x32')][_0x13c6('0x1e')]);}_0x202876[_0x13c6('0x3b')]=qs[_0x13c6('0x3c')](_0x26bf7e[_0x13c6('0x32')][_0x13c6('0x3c')]);_0x202876[_0x13c6('0x3d')]=qs[_0x13c6('0x34')](_[_0x13c6('0x3e')](_0x26bf7e['query'],_0x41abd2['filters']),_0x2fa327);if(_0x26bf7e[_0x13c6('0x32')][_0x13c6('0x3f')]){_0x202876[_0x13c6('0x3d')]=_[_0x13c6('0x40')](_0x202876['where'],{'$or':_['map'](_0x2fa327,function(_0x46527a){if(_0x46527a[_0x13c6('0x41')]!==_0x13c6('0x42')){var _0x279b22={};_0x279b22[_0x46527a['name']]={'$like':'%'+_0x26bf7e[_0x13c6('0x32')][_0x13c6('0x3f')]+'%'};return _0x279b22;}})});}_0x202876=_['merge']({},_0x202876,_0x26bf7e[_0x13c6('0x43')]);var _0x1b4555={'where':_0x202876[_0x13c6('0x3d')]};return db[_0x13c6('0x2d')][_0x13c6('0x1d')](_0x1b4555)[_0x13c6('0x26')](function(_0x5cbe3d){_0x418533[_0x13c6('0x1d')]=_0x5cbe3d;if(_0x26bf7e['query']['includeAll']){_0x202876[_0x13c6('0x44')]=[{'all':!![]}];}return db[_0x13c6('0x2d')][_0x13c6('0x45')](_0x202876);})[_0x13c6('0x26')](function(_0xd7a4a3){_0x418533[_0x13c6('0x46')]=_0xd7a4a3;return _0x418533;})[_0x13c6('0x26')](respondWithFilteredResult(_0x296e48,_0x202876))[_0x13c6('0x47')](handleError(_0x296e48,null));};exports[_0x13c6('0x48')]=function(_0x2f0cd6,_0x69f0b6){var _0x5dc17f={'raw':!![],'where':{'id':_0x2f0cd6[_0x13c6('0x49')]['id']}},_0x3cb534={};_0x3cb534[_0x13c6('0x31')]=_[_0x13c6('0x33')](db[_0x13c6('0x2d')][_0x13c6('0x2e')]);_0x3cb534[_0x13c6('0x32')]=_[_0x13c6('0x33')](_0x2f0cd6[_0x13c6('0x32')]);_0x3cb534[_0x13c6('0x34')]=_[_0x13c6('0x35')](_0x3cb534[_0x13c6('0x31')],_0x3cb534[_0x13c6('0x32')]);_0x5dc17f[_0x13c6('0x36')]=_[_0x13c6('0x35')](_0x3cb534[_0x13c6('0x31')],qs['fields'](_0x2f0cd6['query'][_0x13c6('0x37')]));_0x5dc17f[_0x13c6('0x36')]=_0x5dc17f[_0x13c6('0x36')][_0x13c6('0x38')]?_0x5dc17f[_0x13c6('0x36')]:_0x3cb534[_0x13c6('0x31')];if(_0x2f0cd6[_0x13c6('0x32')][_0x13c6('0x4a')]){_0x5dc17f[_0x13c6('0x44')]=[{'all':!![]}];}_0x5dc17f=_[_0x13c6('0x40')]({},_0x5dc17f,_0x2f0cd6['options']);return db[_0x13c6('0x2d')][_0x13c6('0x4b')](_0x5dc17f)[_0x13c6('0x26')](handleEntityNotFound(_0x69f0b6,null))[_0x13c6('0x26')](respondWithResult(_0x69f0b6,null))[_0x13c6('0x47')](handleError(_0x69f0b6,null));};exports[_0x13c6('0x25')]=function(_0x36b38f,_0x25b605){if(_0x36b38f[_0x13c6('0x4c')]['id']){delete _0x36b38f['body']['id'];}return db[_0x13c6('0x2d')][_0x13c6('0x4b')]({'where':{'id':_0x36b38f['params']['id']}})[_0x13c6('0x26')](handleEntityNotFound(_0x25b605,null))['then'](saveUpdates(_0x36b38f[_0x13c6('0x4c')],null))[_0x13c6('0x26')](respondWithResult(_0x25b605,null))['catch'](handleError(_0x25b605,null));};exports[_0x13c6('0x4d')]=function(_0x1ead8c,_0xb14cc){return db['CmHopperBlack'][_0x13c6('0x4b')]({'where':{'id':_0x1ead8c[_0x13c6('0x49')]['id']}})[_0x13c6('0x26')](handleEntityNotFound(_0xb14cc,null))[_0x13c6('0x26')](removeEntity(_0xb14cc,null))[_0x13c6('0x47')](handleError(_0xb14cc,null));};exports[_0x13c6('0x4e')]=function(_0x205123,_0x53f573){return db[_0x13c6('0x2d')]['describe']()[_0x13c6('0x26')](respondWithResult(_0x53f573,null))['catch'](handleError(_0x53f573,null));}; \ No newline at end of file +var _0x9ef2=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x9ef2,0x1b0));var _0x29ef=function(_0x1c6a55,_0x3c47d2){_0x1c6a55=_0x1c6a55-0x0;var _0x5242ad=_0x9ef2[_0x1c6a55];return _0x5242ad;};'use strict';var pdf=require(_0x29ef('0x0'));var emlformat=require(_0x29ef('0x1'));var rimraf=require(_0x29ef('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x29ef('0x3'));var moment=require('moment');var BPromise=require(_0x29ef('0x4'));var Mustache=require(_0x29ef('0x5'));var util=require('util');var path=require(_0x29ef('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x29ef('0x7'));var fs=require('fs');var _=require(_0x29ef('0x8'));var squel=require(_0x29ef('0x9'));var crypto=require('crypto');var jsforce=require(_0x29ef('0xa'));var deskjs=require(_0x29ef('0xb'));var toCsv=require(_0x29ef('0xc'));var querystring=require(_0x29ef('0xd'));var Papa=require(_0x29ef('0xe'));var Redis=require(_0x29ef('0xf'));var authService=require(_0x29ef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x29ef('0x11'));var hardwareService=require(_0x29ef('0x12'));var logger=require('../../config/logger')(_0x29ef('0x13'));var utils=require('../../config/utils');var config=require(_0x29ef('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x29ef('0x15'))['db'];function respondWithStatusCode(_0x53aa62,_0x3b9c54){_0x3b9c54=_0x3b9c54||0xcc;return function(_0x4b5371){if(_0x4b5371){return _0x53aa62['sendStatus'](_0x3b9c54);}return _0x53aa62[_0x29ef('0x16')](_0x3b9c54)[_0x29ef('0x17')]();};}function respondWithResult(_0x13221d,_0x2f4f1b){_0x2f4f1b=_0x2f4f1b||0xc8;return function(_0x41b99d){if(_0x41b99d){return _0x13221d[_0x29ef('0x16')](_0x2f4f1b)['json'](_0x41b99d);}};}function respondWithFilteredResult(_0x3fb1be,_0x3a2d1f){return function(_0x21bcd1){if(_0x21bcd1){var _0x586f4f=_0x21bcd1[_0x29ef('0x18')],_0x26c9f6=_0x3a2d1f[_0x29ef('0x19')],_0x2489fe=_0x3a2d1f[_0x29ef('0x19')]+_0x3a2d1f['limit'],_0x4ab036;if(_0x2489fe>=_0x586f4f){_0x2489fe=_0x586f4f;_0x4ab036=0xc8;}else{_0x4ab036=0xce;}_0x3fb1be[_0x29ef('0x16')](_0x4ab036);return _0x3fb1be[_0x29ef('0x1a')](_0x29ef('0x1b'),_0x26c9f6+'-'+_0x2489fe+'/'+_0x586f4f)[_0x29ef('0x1c')](_0x21bcd1);}return null;};}function patchUpdates(_0x328884){return function(_0x11dfa5){try{jsonpatch[_0x29ef('0x1d')](_0x11dfa5,_0x328884,!![]);}catch(_0x255830){return BPromise[_0x29ef('0x1e')](_0x255830);}return _0x11dfa5[_0x29ef('0x1f')]();};}function saveUpdates(_0x15a4db,_0x493afe){return function(_0x882b70){if(_0x882b70){return _0x882b70[_0x29ef('0x20')](_0x15a4db)[_0x29ef('0x21')](function(_0x296efa){return _0x296efa;});}return null;};}function removeEntity(_0xd0bcd5,_0xaef101){return function(_0x39150b){if(_0x39150b){return _0x39150b[_0x29ef('0x22')]()[_0x29ef('0x21')](function(){_0xd0bcd5[_0x29ef('0x16')](0xcc)[_0x29ef('0x17')]();});}};}function handleEntityNotFound(_0x4f6582,_0x5dc3df){return function(_0x2eb2da){if(!_0x2eb2da){_0x4f6582['sendStatus'](0x194);}return _0x2eb2da;};}function handleError(_0x53dadd,_0x7e60f7){_0x7e60f7=_0x7e60f7||0x1f4;return function(_0x1776ca){logger[_0x29ef('0x23')](_0x1776ca[_0x29ef('0x24')]);if(_0x1776ca[_0x29ef('0x25')]){delete _0x1776ca[_0x29ef('0x25')];}_0x53dadd[_0x29ef('0x16')](_0x7e60f7)[_0x29ef('0x26')](_0x1776ca);};}exports[_0x29ef('0x27')]=function(_0x263035,_0x4d3fe7){var _0x204723={},_0x5b25ac={},_0x374bca={'count':0x0,'rows':[]};var _0x34e8b1=_[_0x29ef('0x28')](db[_0x29ef('0x29')][_0x29ef('0x2a')],function(_0x367a14){return{'name':_0x367a14[_0x29ef('0x2b')],'type':_0x367a14[_0x29ef('0x2c')][_0x29ef('0x2d')]};});_0x5b25ac['model']=_['map'](_0x34e8b1,'name');_0x5b25ac[_0x29ef('0x2e')]=_[_0x29ef('0x2f')](_0x263035[_0x29ef('0x2e')]);_0x5b25ac[_0x29ef('0x30')]=_[_0x29ef('0x31')](_0x5b25ac['model'],_0x5b25ac[_0x29ef('0x2e')]);_0x204723[_0x29ef('0x32')]=_[_0x29ef('0x31')](_0x5b25ac[_0x29ef('0x33')],qs['fields'](_0x263035[_0x29ef('0x2e')][_0x29ef('0x34')]));_0x204723[_0x29ef('0x32')]=_0x204723[_0x29ef('0x32')]['length']?_0x204723[_0x29ef('0x32')]:_0x5b25ac[_0x29ef('0x33')];if(!_0x263035[_0x29ef('0x2e')][_0x29ef('0x35')](_0x29ef('0x36'))){_0x204723[_0x29ef('0x37')]=qs[_0x29ef('0x37')](_0x263035[_0x29ef('0x2e')][_0x29ef('0x37')]);_0x204723[_0x29ef('0x19')]=qs[_0x29ef('0x19')](_0x263035['query'][_0x29ef('0x19')]);}_0x204723[_0x29ef('0x38')]=qs[_0x29ef('0x39')](_0x263035[_0x29ef('0x2e')]['sort']);_0x204723[_0x29ef('0x3a')]=qs[_0x29ef('0x30')](_[_0x29ef('0x3b')](_0x263035[_0x29ef('0x2e')],_0x5b25ac['filters']),_0x34e8b1);if(_0x263035[_0x29ef('0x2e')][_0x29ef('0x3c')]){_0x204723[_0x29ef('0x3a')]=_[_0x29ef('0x3d')](_0x204723['where'],{'$or':_[_0x29ef('0x28')](_0x34e8b1,function(_0x3bc18c){if(_0x3bc18c['type']!=='VIRTUAL'){var _0x455b10={};_0x455b10[_0x3bc18c['name']]={'$like':'%'+_0x263035['query']['filter']+'%'};return _0x455b10;}})});}_0x204723=_[_0x29ef('0x3d')]({},_0x204723,_0x263035[_0x29ef('0x3e')]);var _0x9c3720={'where':_0x204723['where']};return db['CmHopperBlack'][_0x29ef('0x18')](_0x9c3720)[_0x29ef('0x21')](function(_0x114824){_0x374bca['count']=_0x114824;if(_0x263035[_0x29ef('0x2e')][_0x29ef('0x3f')]){_0x204723[_0x29ef('0x40')]=[{'all':!![]}];}return db[_0x29ef('0x29')][_0x29ef('0x41')](_0x204723);})[_0x29ef('0x21')](function(_0x18b111){_0x374bca[_0x29ef('0x42')]=_0x18b111;return _0x374bca;})[_0x29ef('0x21')](respondWithFilteredResult(_0x4d3fe7,_0x204723))[_0x29ef('0x43')](handleError(_0x4d3fe7,null));};exports[_0x29ef('0x44')]=function(_0x4cf818,_0x320e4e){var _0x298893={'raw':!![],'where':{'id':_0x4cf818[_0x29ef('0x45')]['id']}},_0x2f046c={};_0x2f046c[_0x29ef('0x33')]=_[_0x29ef('0x2f')](db[_0x29ef('0x29')]['rawAttributes']);_0x2f046c[_0x29ef('0x2e')]=_[_0x29ef('0x2f')](_0x4cf818['query']);_0x2f046c[_0x29ef('0x30')]=_['intersection'](_0x2f046c[_0x29ef('0x33')],_0x2f046c[_0x29ef('0x2e')]);_0x298893['attributes']=_[_0x29ef('0x31')](_0x2f046c[_0x29ef('0x33')],qs[_0x29ef('0x34')](_0x4cf818['query'][_0x29ef('0x34')]));_0x298893[_0x29ef('0x32')]=_0x298893[_0x29ef('0x32')][_0x29ef('0x46')]?_0x298893[_0x29ef('0x32')]:_0x2f046c[_0x29ef('0x33')];if(_0x4cf818[_0x29ef('0x2e')]['includeAll']){_0x298893[_0x29ef('0x40')]=[{'all':!![]}];}_0x298893=_['merge']({},_0x298893,_0x4cf818['options']);return db['CmHopperBlack'][_0x29ef('0x47')](_0x298893)[_0x29ef('0x21')](handleEntityNotFound(_0x320e4e,null))[_0x29ef('0x21')](respondWithResult(_0x320e4e,null))[_0x29ef('0x43')](handleError(_0x320e4e,null));};exports[_0x29ef('0x20')]=function(_0xa0f880,_0x583aa8){if(_0xa0f880[_0x29ef('0x48')]['id']){delete _0xa0f880[_0x29ef('0x48')]['id'];}return db[_0x29ef('0x29')][_0x29ef('0x47')]({'where':{'id':_0xa0f880[_0x29ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x583aa8,null))[_0x29ef('0x21')](saveUpdates(_0xa0f880[_0x29ef('0x48')],null))['then'](respondWithResult(_0x583aa8,null))[_0x29ef('0x43')](handleError(_0x583aa8,null));};exports['destroy']=function(_0x30a38e,_0x5b44cf){return db[_0x29ef('0x29')][_0x29ef('0x47')]({'where':{'id':_0x30a38e[_0x29ef('0x45')]['id']}})[_0x29ef('0x21')](handleEntityNotFound(_0x5b44cf,null))[_0x29ef('0x21')](removeEntity(_0x5b44cf,null))[_0x29ef('0x43')](handleError(_0x5b44cf,null));};exports['describe']=function(_0x16207e,_0x254842){return db['CmHopperBlack'][_0x29ef('0x49')]()[_0x29ef('0x21')](respondWithResult(_0x254842,null))['catch'](handleError(_0x254842,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f34dbe6..c4bd2a4 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 _0x464b=['request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment'];(function(_0x4975ad,_0x2a69d4){var _0x40af69=function(_0x474e5e){while(--_0x474e5e){_0x4975ad['push'](_0x4975ad['shift']());}};_0x40af69(++_0x2a69d4);}(_0x464b,0xf9));var _0xb464=function(_0xcbe712,_0x1c739b){_0xcbe712=_0xcbe712-0x0;var _0x47ee6d=_0x464b[_0xcbe712];return _0x47ee6d;};'use strict';var _=require('lodash');var util=require(_0xb464('0x0'));var logger=require(_0xb464('0x1'))(_0xb464('0x2'));var moment=require(_0xb464('0x3'));var BPromise=require('bluebird');var rp=require(_0xb464('0x4'));var fs=require('fs');var path=require(_0xb464('0x5'));var rimraf=require(_0xb464('0x6'));var config=require('../../config/environment');var attributes=require(_0xb464('0x7'));module[_0xb464('0x8')]=function(_0xb87496,_0x5a12cd){return _0xb87496['define'](_0xb464('0x9'),attributes,{'tableName':_0xb464('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec7f=['../../config/logger','moment','path','../../config/environment','define','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xec7f,0x115));var _0xfec7=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xec7f[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xfec7('0x0'));var util=require(_0xfec7('0x1'));var logger=require(_0xfec7('0x2'))('api');var moment=require(_0xfec7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfec7('0x4'));var rimraf=require('rimraf');var config=require(_0xfec7('0x5'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xe06eb1,_0x3ef97c){return _0xe06eb1[_0xfec7('0x6')](_0xfec7('0x7'),attributes,{'tableName':_0xfec7('0x8'),'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 9d8e647..690b499 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 _0x80d0=['result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x8f62d1,_0x1055b1){var _0x5cd898=function(_0x417df1){while(--_0x417df1){_0x8f62d1['push'](_0x8f62d1['shift']());}};_0x5cd898(++_0x1055b1);}(_0x80d0,0x64));var _0x080d=function(_0x1fa250,_0x5b094c){_0x1fa250=_0x1fa250-0x0;var _0x5a7f00=_0x80d0[_0x1fa250];return _0x5a7f00;};'use strict';var _=require('lodash');var util=require(_0x080d('0x0'));var moment=require(_0x080d('0x1'));var BPromise=require(_0x080d('0x2'));var rs=require(_0x080d('0x3'));var fs=require('fs');var Redis=require(_0x080d('0x4'));var db=require(_0x080d('0x5'))['db'];var utils=require(_0x080d('0x6'));var logger=require(_0x080d('0x7'))(_0x080d('0x8'));var config=require(_0x080d('0x9'));var jayson=require(_0x080d('0xa'));var client=jayson[_0x080d('0xb')][_0x080d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x305353,_0x4a5b06,_0x15cd78){return new BPromise(function(_0x1ecab9,_0xa36f9a){return client['request'](_0x305353,_0x15cd78)[_0x080d('0xd')](function(_0xd835cf){logger[_0x080d('0xe')](_0x080d('0xf'),_0x4a5b06,_0x080d('0x10'));logger[_0x080d('0x11')](_0x080d('0x12'),_0x4a5b06,_0x080d('0x10'),JSON[_0x080d('0x13')](_0xd835cf));if(_0xd835cf[_0x080d('0x14')]){if(_0xd835cf[_0x080d('0x14')][_0x080d('0x15')]===0x1f4){logger[_0x080d('0x14')](_0x080d('0xf'),_0x4a5b06,_0xd835cf['error'][_0x080d('0x16')]);return _0xa36f9a(_0xd835cf[_0x080d('0x14')]['message']);}logger[_0x080d('0x14')](_0x080d('0xf'),_0x4a5b06,_0xd835cf['error'][_0x080d('0x16')]);return _0x1ecab9(_0xd835cf[_0x080d('0x14')]['message']);}else{logger[_0x080d('0xe')](_0x080d('0xf'),_0x4a5b06,_0x080d('0x10'));_0x1ecab9(_0xd835cf[_0x080d('0x17')][_0x080d('0x16')]);}})['catch'](function(_0x1b01e3){logger[_0x080d('0x14')](_0x080d('0xf'),_0x4a5b06,_0x1b01e3);_0xa36f9a(_0x1b01e3);});});}exports[_0x080d('0x18')]=function(_0x12ec97){var _0x502ee2=this;return new Promise(function(_0x3cc97a,_0x4cbd0a){return db[_0x080d('0x19')][_0x080d('0x1a')]({'raw':_0x12ec97[_0x080d('0x1b')]?_0x12ec97['options'][_0x080d('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ec97[_0x080d('0x1b')]?_0x12ec97[_0x080d('0x1b')][_0x080d('0x1d')]||null:null,'attributes':_0x12ec97[_0x080d('0x1b')]?_0x12ec97['options'][_0x080d('0x1e')]||null:null,'limit':_0x12ec97[_0x080d('0x1b')]?_0x12ec97[_0x080d('0x1b')][_0x080d('0x1f')]||null:null,'include':_0x12ec97['options']?_0x12ec97[_0x080d('0x1b')][_0x080d('0x20')]?_[_0x080d('0x21')](_0x12ec97[_0x080d('0x1b')][_0x080d('0x20')],function(_0x5bd775){return{'model':db[_0x5bd775[_0x080d('0x22')]],'as':_0x5bd775['as'],'attributes':_0x5bd775['attributes'],'include':_0x5bd775[_0x080d('0x20')]?_[_0x080d('0x21')](_0x5bd775[_0x080d('0x20')],function(_0x36342f){return{'model':db[_0x36342f[_0x080d('0x22')]],'as':_0x36342f['as'],'attributes':_0x36342f[_0x080d('0x1e')],'include':_0x36342f[_0x080d('0x20')]?_[_0x080d('0x21')](_0x36342f['include'],function(_0x2342ca){return{'model':db[_0x2342ca[_0x080d('0x22')]],'as':_0x2342ca['as'],'attributes':_0x2342ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x080d('0xd')](function(_0x1ccf73){logger[_0x080d('0xe')](_0x080d('0x18'),_0x12ec97);logger['debug'](_0x080d('0x18'),_0x12ec97,JSON[_0x080d('0x13')](_0x1ccf73));_0x3cc97a(_0x1ccf73);})[_0x080d('0x23')](function(_0x2fc5a0){logger['error']('GetCmHopperBlack',_0x2fc5a0[_0x080d('0x16')],_0x12ec97);_0x4cbd0a(_0x502ee2['error'](0x1f4,_0x2fc5a0[_0x080d('0x16')]));});});};exports[_0x080d('0x24')]=function(_0x97f7bf){var _0x4017ca=this;return new Promise(function(_0x190858,_0x3ff2a1){return db[_0x080d('0x19')][_0x080d('0x25')](_0x97f7bf[_0x080d('0x26')],{'raw':_0x97f7bf[_0x080d('0x1b')]?_0x97f7bf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x97f7bf[_0x080d('0x1b')]?_0x97f7bf['options'][_0x080d('0x1d')]||null:null,'attributes':_0x97f7bf[_0x080d('0x1b')]?_0x97f7bf[_0x080d('0x1b')][_0x080d('0x1e')]||null:null,'limit':_0x97f7bf[_0x080d('0x1b')]?_0x97f7bf[_0x080d('0x1b')]['limit']||null:null})['then'](function(_0x27383d){logger['info'](_0x080d('0x24'),_0x97f7bf);logger['debug'](_0x080d('0x24'),_0x97f7bf,JSON[_0x080d('0x13')](_0x27383d));_0x190858(_0x27383d);})['catch'](function(_0x2399ac){logger['error'](_0x080d('0x24'),_0x2399ac['message'],_0x97f7bf);_0x3ff2a1(_0x4017ca[_0x080d('0x14')](0x1f4,_0x2399ac[_0x080d('0x16')]));});});};exports[_0x080d('0x27')]=function(_0x2fb0f0){var _0x493916=this;return new Promise(function(_0x23d1b0,_0x318f5a){return db[_0x080d('0x19')][_0x080d('0x28')]({'where':_0x2fb0f0[_0x080d('0x1b')]?_0x2fb0f0['options']['where']||null:null})['then'](function(_0x2e07c1){logger[_0x080d('0xe')]('DestroyCmHopperBlack',_0x2fb0f0);logger['debug'](_0x080d('0x27'),_0x2fb0f0,JSON[_0x080d('0x13')](_0x2e07c1));_0x23d1b0(_0x2e07c1);})['catch'](function(_0x131adb){logger['error'](_0x080d('0x27'),_0x131adb['message'],_0x2fb0f0);_0x318f5a(_0x493916[_0x080d('0x14')](0x1f4,_0x131adb['message']));});});}; \ No newline at end of file +var _0xdff5=['client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','include','model','map','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2c9b3a,_0x28a1c5){var _0xccdc43=function(_0x4b5f83){while(--_0x4b5f83){_0x2c9b3a['push'](_0x2c9b3a['shift']());}};_0xccdc43(++_0x28a1c5);}(_0xdff5,0xd0));var _0x5dff=function(_0x177393,_0x2e107f){_0x177393=_0x177393-0x0;var _0x15da20=_0xdff5[_0x177393];return _0x15da20;};'use strict';var _=require(_0x5dff('0x0'));var util=require('util');var moment=require(_0x5dff('0x1'));var BPromise=require(_0x5dff('0x2'));var rs=require(_0x5dff('0x3'));var fs=require('fs');var Redis=require(_0x5dff('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5dff('0x5'))('rpc');var config=require(_0x5dff('0x6'));var jayson=require(_0x5dff('0x7'));var client=jayson[_0x5dff('0x8')][_0x5dff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17d66b,_0x2d399a,_0x4c2c35){return new BPromise(function(_0x2301e0,_0x58bab0){return client['request'](_0x17d66b,_0x4c2c35)[_0x5dff('0xa')](function(_0x4af28c){logger[_0x5dff('0xb')](_0x5dff('0xc'),_0x2d399a,_0x5dff('0xd'));logger[_0x5dff('0xe')](_0x5dff('0xf'),_0x2d399a,_0x5dff('0xd'),JSON[_0x5dff('0x10')](_0x4af28c));if(_0x4af28c[_0x5dff('0x11')]){if(_0x4af28c[_0x5dff('0x11')][_0x5dff('0x12')]===0x1f4){logger[_0x5dff('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2d399a,_0x4af28c[_0x5dff('0x11')][_0x5dff('0x13')]);return _0x58bab0(_0x4af28c[_0x5dff('0x11')]['message']);}logger[_0x5dff('0x11')](_0x5dff('0xc'),_0x2d399a,_0x4af28c[_0x5dff('0x11')][_0x5dff('0x13')]);return _0x2301e0(_0x4af28c['error'][_0x5dff('0x13')]);}else{logger[_0x5dff('0xb')](_0x5dff('0xc'),_0x2d399a,'request\x20sent');_0x2301e0(_0x4af28c[_0x5dff('0x14')]['message']);}})[_0x5dff('0x15')](function(_0x1da807){logger[_0x5dff('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2d399a,_0x1da807);_0x58bab0(_0x1da807);});});}exports[_0x5dff('0x16')]=function(_0x461d06){var _0xb1954e=this;return new Promise(function(_0x50d69e,_0x2373f2){return db[_0x5dff('0x17')]['findAll']({'raw':_0x461d06[_0x5dff('0x18')]?_0x461d06[_0x5dff('0x18')][_0x5dff('0x19')]===undefined?!![]:![]:!![],'where':_0x461d06[_0x5dff('0x18')]?_0x461d06[_0x5dff('0x18')][_0x5dff('0x1a')]||null:null,'attributes':_0x461d06[_0x5dff('0x18')]?_0x461d06[_0x5dff('0x18')][_0x5dff('0x1b')]||null:null,'limit':_0x461d06[_0x5dff('0x18')]?_0x461d06[_0x5dff('0x18')]['limit']||null:null,'include':_0x461d06['options']?_0x461d06[_0x5dff('0x18')][_0x5dff('0x1c')]?_['map'](_0x461d06['options'][_0x5dff('0x1c')],function(_0x3664a7){return{'model':db[_0x3664a7[_0x5dff('0x1d')]],'as':_0x3664a7['as'],'attributes':_0x3664a7[_0x5dff('0x1b')],'include':_0x3664a7[_0x5dff('0x1c')]?_[_0x5dff('0x1e')](_0x3664a7[_0x5dff('0x1c')],function(_0x24b2c8){return{'model':db[_0x24b2c8[_0x5dff('0x1d')]],'as':_0x24b2c8['as'],'attributes':_0x24b2c8[_0x5dff('0x1b')],'include':_0x24b2c8['include']?_[_0x5dff('0x1e')](_0x24b2c8['include'],function(_0x5d7300){return{'model':db[_0x5d7300[_0x5dff('0x1d')]],'as':_0x5d7300['as'],'attributes':_0x5d7300[_0x5dff('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36f970){logger[_0x5dff('0xb')](_0x5dff('0x16'),_0x461d06);logger['debug']('GetCmHopperBlack',_0x461d06,JSON[_0x5dff('0x10')](_0x36f970));_0x50d69e(_0x36f970);})[_0x5dff('0x15')](function(_0x34f8b0){logger[_0x5dff('0x11')](_0x5dff('0x16'),_0x34f8b0[_0x5dff('0x13')],_0x461d06);_0x2373f2(_0xb1954e[_0x5dff('0x11')](0x1f4,_0x34f8b0[_0x5dff('0x13')]));});});};exports[_0x5dff('0x1f')]=function(_0x52cd0a){var _0x23d3c5=this;return new Promise(function(_0xe2e9c2,_0x331d83){return db['CmHopperBlack'][_0x5dff('0x20')](_0x52cd0a[_0x5dff('0x21')],{'raw':_0x52cd0a['options']?_0x52cd0a[_0x5dff('0x18')][_0x5dff('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52cd0a[_0x5dff('0x18')]?_0x52cd0a['options'][_0x5dff('0x1a')]||null:null,'attributes':_0x52cd0a[_0x5dff('0x18')]?_0x52cd0a[_0x5dff('0x18')][_0x5dff('0x1b')]||null:null,'limit':_0x52cd0a[_0x5dff('0x18')]?_0x52cd0a['options'][_0x5dff('0x22')]||null:null})[_0x5dff('0xa')](function(_0x4b0c13){logger['info'](_0x5dff('0x1f'),_0x52cd0a);logger[_0x5dff('0xe')](_0x5dff('0x1f'),_0x52cd0a,JSON[_0x5dff('0x10')](_0x4b0c13));_0xe2e9c2(_0x4b0c13);})[_0x5dff('0x15')](function(_0x3347b4){logger[_0x5dff('0x11')](_0x5dff('0x1f'),_0x3347b4[_0x5dff('0x13')],_0x52cd0a);_0x331d83(_0x23d3c5[_0x5dff('0x11')](0x1f4,_0x3347b4[_0x5dff('0x13')]));});});};exports[_0x5dff('0x23')]=function(_0x18869c){var _0x7c59f6=this;return new Promise(function(_0x2a03bf,_0x5a5292){return db[_0x5dff('0x17')]['destroy']({'where':_0x18869c[_0x5dff('0x18')]?_0x18869c[_0x5dff('0x18')][_0x5dff('0x1a')]||null:null})[_0x5dff('0xa')](function(_0x2fbb02){logger[_0x5dff('0xb')](_0x5dff('0x23'),_0x18869c);logger['debug'](_0x5dff('0x23'),_0x18869c,JSON[_0x5dff('0x10')](_0x2fbb02));_0x2a03bf(_0x2fbb02);})[_0x5dff('0x15')](function(_0x375cd6){logger[_0x5dff('0x11')](_0x5dff('0x23'),_0x375cd6['message'],_0x18869c);_0x5a5292(_0x7c59f6[_0x5dff('0x11')](0x1f4,_0x375cd6['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a5c526e..9d5f099 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 _0xac9d=['../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xac9d,0x14d));var _0xdac9=function(_0x7e3bb8,_0x27c048){_0x7e3bb8=_0x7e3bb8-0x0;var _0x44c887=_0xac9d[_0x7e3bb8];return _0x44c887;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var auth=require(_0xdac9('0x6'));var interaction=require(_0xdac9('0x7'));var config=require('../../config/environment');var controller=require(_0xdac9('0x8'));router['get']('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0xa')]);router[_0xdac9('0xb')](_0xdac9('0xc'),auth[_0xdac9('0x9')](),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x11')]);router[_0xdac9('0x12')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9f62=['/describe','describe','/:id','exports','util','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x38a745,_0x556f29){var _0x1bdcb9=function(_0x2b0d8e){while(--_0x2b0d8e){_0x38a745['push'](_0x38a745['shift']());}};_0x1bdcb9(++_0x556f29);}(_0x9f62,0x154));var _0x29f6=function(_0x461da0,_0x2eef51){_0x461da0=_0x461da0-0x0;var _0x322ad7=_0x9f62[_0x461da0];return _0x322ad7;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['put'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['update']);router['delete'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['destroy']);module[_0x29f6('0xb')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index fb61efa..3aa29ee 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 _0xf9cc=['getDataValue','followuptime','seconds','setDataValue','dispositionat','BOOLEAN','moment','exports','INTEGER','DATE','STRING'];(function(_0x37ecca,_0x1cc8be){var _0x47a32c=function(_0x2974e5){while(--_0x2974e5){_0x37ecca['push'](_0x37ecca['shift']());}};_0x47a32c(++_0x1cc8be);}(_0xf9cc,0xa0));var _0xcf9c=function(_0x21145f,_0x3d9fef){_0x21145f=_0x21145f-0x0;var _0x3c0d97=_0xf9cc[_0x21145f];return _0x3c0d97;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcf9c('0x0'));module[_0xcf9c('0x1')]={'state':{'type':Sequelize[_0xcf9c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xcf9c('0x3')]},'countbusyretry':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcf9c('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcf9c('0x4')]},'calleridnum':{'type':Sequelize[_0xcf9c('0x4')]},'calleridname':{'type':Sequelize[_0xcf9c('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcf9c('0x3')]},'answertime':{'type':Sequelize[_0xcf9c('0x3')]},'droptime':{'type':Sequelize[_0xcf9c('0x3')]},'endtime':{'type':Sequelize[_0xcf9c('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcf9c('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcf9c('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcf9c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcf9c('0x4')]},'dispositionat':{'type':Sequelize[_0xcf9c('0x3')],'set':function(_0xc62cbb){var _0x6e258d=this[_0xcf9c('0x5')]('endtime');if(_0x6e258d&&_0xc62cbb){this['setDataValue'](_0xcf9c('0x6'),moment(_0xc62cbb)['diff'](moment(_0x6e258d),_0xcf9c('0x7')));}return this[_0xcf9c('0x8')](_0xcf9c('0x9'),_0xc62cbb);}},'amd':{'type':Sequelize[_0xcf9c('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcf9c('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xcf9c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcf9c('0x3')]},'deleted':{'type':Sequelize[_0xcf9c('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcf9c('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xcf9c('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8da9=['getDataValue','setDataValue','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','DATE','STRING'];(function(_0x357a1d,_0x3eb0ac){var _0x61de7d=function(_0x2786f3){while(--_0x2786f3){_0x357a1d['push'](_0x357a1d['shift']());}};_0x61de7d(++_0x3eb0ac);}(_0x8da9,0x1be));var _0x98da=function(_0x3befc6,_0x444457){_0x3befc6=_0x3befc6-0x0;var _0x562f1b=_0x8da9[_0x3befc6];return _0x562f1b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x98da('0x0'));module[_0x98da('0x1')]={'state':{'type':Sequelize[_0x98da('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x98da('0x3')]},'countbusyretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x98da('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x98da('0x4')]},'originatecalleridname':{'type':Sequelize[_0x98da('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x98da('0x4')]},'starttime':{'type':Sequelize[_0x98da('0x3')]},'responsetime':{'type':Sequelize[_0x98da('0x3')]},'answertime':{'type':Sequelize[_0x98da('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x98da('0x3')]},'ringtime':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x98da('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x98da('0x4')]},'reason':{'type':Sequelize[_0x98da('0x4')]},'disposition':{'type':Sequelize[_0x98da('0x4')]},'secondDisposition':{'type':Sequelize[_0x98da('0x4')]},'thirdDisposition':{'type':Sequelize[_0x98da('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x289c95){var _0x48c78b=this[_0x98da('0x5')]('endtime');if(_0x48c78b&&_0x289c95){this[_0x98da('0x6')]('followuptime',moment(_0x289c95)[_0x98da('0x7')](moment(_0x48c78b),_0x98da('0x8')));}return this[_0x98da('0x6')](_0x98da('0x9'),_0x289c95);}},'amd':{'type':Sequelize[_0x98da('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x98da('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x98da('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x98da('0x3')]},'callback':{'type':Sequelize[_0x98da('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x98da('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x98da('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x98da('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 0c8fdea..0c0f2a4 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 _0xf3cd=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','find','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','checkContactHopper','CmHopper','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x12aaed,_0x22e13f){var _0x24058e=function(_0x24ecd8){while(--_0x24ecd8){_0x12aaed['push'](_0x12aaed['shift']());}};_0x24058e(++_0x22e13f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xf3cd[_0x5447fd];return _0x15b28a;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d483c,_0x166ae5){_0x166ae5=_0x166ae5||0xcc;return function(_0x41fc33){if(_0x41fc33){return _0x1d483c[_0xdf3c('0x1a')](_0x166ae5);}return _0x1d483c['status'](_0x166ae5)[_0xdf3c('0x1b')]();};}function respondWithResult(_0x461079,_0x13ea5f){_0x13ea5f=_0x13ea5f||0xc8;return function(_0x5e0047){if(_0x5e0047){return _0x461079[_0xdf3c('0x1c')](_0x13ea5f)[_0xdf3c('0x1d')](_0x5e0047);}};}function respondWithFilteredResult(_0x173041,_0x4274fd){return function(_0x21e587){if(_0x21e587){var _0x1a7a5a=_0x21e587[_0xdf3c('0x1e')],_0x305ea5=_0x4274fd['offset'],_0x92008b=_0x4274fd[_0xdf3c('0x1f')]+_0x4274fd[_0xdf3c('0x20')],_0x2986d0;if(_0x92008b>=_0x1a7a5a){_0x92008b=_0x1a7a5a;_0x2986d0=0xc8;}else{_0x2986d0=0xce;}_0x173041[_0xdf3c('0x1c')](_0x2986d0);return _0x173041[_0xdf3c('0x21')](_0xdf3c('0x22'),_0x305ea5+'-'+_0x92008b+'/'+_0x1a7a5a)[_0xdf3c('0x1d')](_0x21e587);}return null;};}function patchUpdates(_0x16b02b){return function(_0x3ee0af){try{jsonpatch[_0xdf3c('0x23')](_0x3ee0af,_0x16b02b,!![]);}catch(_0x18fb5f){return BPromise[_0xdf3c('0x24')](_0x18fb5f);}return _0x3ee0af[_0xdf3c('0x25')]();};}function saveUpdates(_0x25487c,_0x5d2390){return function(_0x4d620f){if(_0x4d620f){return _0x4d620f[_0xdf3c('0x26')](_0x25487c)['then'](function(_0x15776c){return _0x15776c;});}return null;};}function removeEntity(_0x40e7ec,_0x36552e){return function(_0x38b319){if(_0x38b319){return _0x38b319[_0xdf3c('0x27')]()[_0xdf3c('0x28')](function(){_0x40e7ec['status'](0xcc)[_0xdf3c('0x1b')]();});}};}function handleEntityNotFound(_0x213d75,_0x13e3ca){return function(_0x24754a){if(!_0x24754a){_0x213d75[_0xdf3c('0x1a')](0x194);}return _0x24754a;};}function handleError(_0x3b5371,_0xef54cb){_0xef54cb=_0xef54cb||0x1f4;return function(_0x155f54){logger[_0xdf3c('0x29')](_0x155f54[_0xdf3c('0x2a')]);if(_0x155f54['name']){delete _0x155f54[_0xdf3c('0x2b')];}_0x3b5371[_0xdf3c('0x1c')](_0xef54cb)['send'](_0x155f54);};}exports[_0xdf3c('0x2c')]=function(_0x59659e,_0x4eaced){var _0x508be9={},_0x14aac9={},_0x186bba={'count':0x0,'rows':[]};var _0x52b8f6=_['map'](db[_0xdf3c('0x2d')][_0xdf3c('0x2e')],function(_0xd3cfcb){return{'name':_0xd3cfcb[_0xdf3c('0x2f')],'type':_0xd3cfcb['type'][_0xdf3c('0x30')]};});_0x14aac9[_0xdf3c('0x31')]=_['map'](_0x52b8f6,'name');_0x14aac9[_0xdf3c('0x32')]=_[_0xdf3c('0x33')](_0x59659e[_0xdf3c('0x32')]);_0x14aac9['filters']=_[_0xdf3c('0x34')](_0x14aac9[_0xdf3c('0x31')],_0x14aac9[_0xdf3c('0x32')]);_0x508be9[_0xdf3c('0x35')]=_['intersection'](_0x14aac9[_0xdf3c('0x31')],qs[_0xdf3c('0x36')](_0x59659e['query'][_0xdf3c('0x36')]));_0x508be9[_0xdf3c('0x35')]=_0x508be9[_0xdf3c('0x35')][_0xdf3c('0x37')]?_0x508be9['attributes']:_0x14aac9[_0xdf3c('0x31')];if(!_0x59659e[_0xdf3c('0x32')][_0xdf3c('0x38')](_0xdf3c('0x39'))){_0x508be9['limit']=qs[_0xdf3c('0x20')](_0x59659e[_0xdf3c('0x32')]['limit']);_0x508be9['offset']=qs[_0xdf3c('0x1f')](_0x59659e['query'][_0xdf3c('0x1f')]);}_0x508be9['order']=qs['sort'](_0x59659e['query'][_0xdf3c('0x3a')]);_0x508be9[_0xdf3c('0x3b')]=qs[_0xdf3c('0x3c')](_[_0xdf3c('0x3d')](_0x59659e['query'],_0x14aac9['filters']),_0x52b8f6);if(_0x59659e[_0xdf3c('0x32')]['filter']){_0x508be9[_0xdf3c('0x3b')]=_[_0xdf3c('0x3e')](_0x508be9[_0xdf3c('0x3b')],{'$or':_[_0xdf3c('0x3f')](_0x52b8f6,function(_0x1004e9){if(_0x1004e9[_0xdf3c('0x40')]!==_0xdf3c('0x41')){var _0x809f3d={};_0x809f3d[_0x1004e9[_0xdf3c('0x2b')]]={'$like':'%'+_0x59659e['query'][_0xdf3c('0x42')]+'%'};return _0x809f3d;}})});}_0x508be9=_['merge']({},_0x508be9,_0x59659e['options']);var _0x3b97bc={'where':_0x508be9['where']};return db[_0xdf3c('0x2d')]['count'](_0x3b97bc)[_0xdf3c('0x28')](function(_0x27ee91){_0x186bba[_0xdf3c('0x1e')]=_0x27ee91;if(_0x59659e[_0xdf3c('0x32')][_0xdf3c('0x43')]){_0x508be9[_0xdf3c('0x44')]=[{'all':!![]}];}return db[_0xdf3c('0x2d')][_0xdf3c('0x45')](_0x508be9);})[_0xdf3c('0x28')](function(_0xa65478){_0x186bba[_0xdf3c('0x46')]=_0xa65478;return _0x186bba;})[_0xdf3c('0x28')](respondWithFilteredResult(_0x4eaced,_0x508be9))['catch'](handleError(_0x4eaced,null));};exports['show']=function(_0x169ba6,_0x5752e6){var _0x3a6527={'raw':!![],'where':{'id':_0x169ba6[_0xdf3c('0x47')]['id']}},_0x14d8e1={};_0x14d8e1[_0xdf3c('0x31')]=_['keys'](db['CmHopperFinal'][_0xdf3c('0x2e')]);_0x14d8e1[_0xdf3c('0x32')]=_[_0xdf3c('0x33')](_0x169ba6['query']);_0x14d8e1[_0xdf3c('0x3c')]=_[_0xdf3c('0x34')](_0x14d8e1[_0xdf3c('0x31')],_0x14d8e1[_0xdf3c('0x32')]);_0x3a6527['attributes']=_[_0xdf3c('0x34')](_0x14d8e1[_0xdf3c('0x31')],qs[_0xdf3c('0x36')](_0x169ba6[_0xdf3c('0x32')][_0xdf3c('0x36')]));_0x3a6527['attributes']=_0x3a6527[_0xdf3c('0x35')][_0xdf3c('0x37')]?_0x3a6527[_0xdf3c('0x35')]:_0x14d8e1[_0xdf3c('0x31')];if(_0x169ba6[_0xdf3c('0x32')][_0xdf3c('0x43')]){_0x3a6527['include']=[{'all':!![]}];}_0x3a6527=_['merge']({},_0x3a6527,_0x169ba6[_0xdf3c('0x48')]);return db[_0xdf3c('0x2d')]['find'](_0x3a6527)['then'](handleEntityNotFound(_0x5752e6,null))[_0xdf3c('0x28')](respondWithResult(_0x5752e6,null))[_0xdf3c('0x49')](handleError(_0x5752e6,null));};exports[_0xdf3c('0x4a')]=function(_0x2aeb29,_0xaae4bc){return db[_0xdf3c('0x2d')][_0xdf3c('0x4a')]()[_0xdf3c('0x28')](respondWithResult(_0xaae4bc,null))[_0xdf3c('0x49')](handleError(_0xaae4bc,null));};exports['update']=function(_0x129c2a,_0x2cfdb2){if(_0x129c2a[_0xdf3c('0x4b')][_0xdf3c('0x4c')]){delete _0x129c2a[_0xdf3c('0x4b')][_0xdf3c('0x4c')];}return db[_0xdf3c('0x2d')]['find']({'where':{'uniqueid':_0x129c2a[_0xdf3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cfdb2,null))[_0xdf3c('0x28')](saveUpdates(_0x129c2a['body'],null))[_0xdf3c('0x28')](respondWithResult(_0x2cfdb2,null))[_0xdf3c('0x49')](handleError(_0x2cfdb2,null));};exports[_0xdf3c('0x4d')]=function(_0x94c5b9,_0x5eef94,_0x55da0f){return db['CmHopperFinal'][_0xdf3c('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x94c5b9['params']['id']},'attributes':[[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db['sequelize']['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x51')))),_0xdf3c('0x52')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db['sequelize']['literal'](_0xdf3c('0x53')))),_0xdf3c('0x54')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x55')))),_0xdf3c('0x56')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db['sequelize']['fn']('IF',db[_0xdf3c('0x4e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')]['literal'](_0xdf3c('0x57')))),_0xdf3c('0x58')],[db['sequelize']['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x59')))),_0xdf3c('0x5a')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),_0xdf3c('0x5b')]]})[_0xdf3c('0x28')](handleEntityNotFound(_0x5eef94,null))[_0xdf3c('0x28')](respondWithResult(_0x5eef94,null))['catch'](handleError(_0x5eef94,null));};exports[_0xdf3c('0x5c')]=function(_0x3e327e,_0x235d6c,_0x552264){return db[_0xdf3c('0x2d')][_0xdf3c('0x45')]({'raw':![],'where':{'CampaignId':_0x3e327e['params']['id']},'attributes':[[db[_0xdf3c('0x4e')]['fn']('COUNT',db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x5d')))),_0xdf3c('0x5e')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x51')))),_0xdf3c('0x52')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db['sequelize'][_0xdf3c('0x50')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x5f')))),_0xdf3c('0x60')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x57')))),'abandonedContacts'],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdf3c('0x5a')],[db[_0xdf3c('0x4e')]['fn'](_0xdf3c('0x4f'),db[_0xdf3c('0x4e')]['fn']('IF',db[_0xdf3c('0x4e')][_0xdf3c('0x50')](_0xdf3c('0x61')))),_0xdf3c('0x5b')]]})[_0xdf3c('0x28')](handleEntityNotFound(_0x235d6c,null))[_0xdf3c('0x28')](respondWithResult(_0x235d6c,null))['catch'](handleError(_0x235d6c,null));};exports[_0xdf3c('0x62')]=function(_0x9cc472,_0x19ac31,_0x1de114){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'where':{'id':_0x9cc472[_0xdf3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x19ac31,null))[_0xdf3c('0x28')](function(_0x662fd5){var _0x4e1b77;if(_0x662fd5){_0x4e1b77=squel['insert']()[_0xdf3c('0x65')](_0xdf3c('0x66'))[_0xdf3c('0x67')]([_0xdf3c('0x68'),_0xdf3c('0x69'),_0xdf3c('0x6a'),_0xdf3c('0x6b'),_0xdf3c('0x6c'),'createdAt',_0xdf3c('0x6d')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('ANY_VALUE(calleridnum)',_0xdf3c('0x68'))[_0xdf3c('0x6f')](_0xdf3c('0x70'),'scheduledAt')[_0xdf3c('0x6f')](_0xdf3c('0x71'),_0xdf3c('0x6a'))[_0xdf3c('0x6f')](_0xdf3c('0x72'),_0xdf3c('0x6b'))['field']('ANY_VALUE(VoiceQueueId)','VoiceQueueId')['field']('NOW()',_0xdf3c('0x73'))[_0xdf3c('0x6f')](_0xdf3c('0x70'),'updatedAt')[_0xdf3c('0x74')](_0xdf3c('0x75'))[_0xdf3c('0x3b')]('VoiceQueueId\x20=\x20?',_0x9cc472['params']['id'][_0xdf3c('0x76')]())['where'](_0xdf3c('0x77'),_0x9cc472['body'][_0xdf3c('0x78')][_0xdf3c('0x76')]())[_0xdf3c('0x3b')](_0xdf3c('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x68'))[_0xdf3c('0x74')](_0xdf3c('0x66'))[_0xdf3c('0x3b')]('VoiceQueueId\x20=\x20?',_0x9cc472[_0xdf3c('0x47')]['id']['toString']()))[_0xdf3c('0x3b')](_0xdf3c('0x7a'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x7b'))['from'](_0xdf3c('0x75'))[_0xdf3c('0x3b')](_0xdf3c('0x7c'),_0x9cc472['params']['id']['toString']())['where']('state\x20=\x204'))[_0xdf3c('0x7d')](_0xdf3c('0x6a')))[_0xdf3c('0x76')]();return db[_0xdf3c('0x4e')][_0xdf3c('0x32')](_0x4e1b77);}return[];})[_0xdf3c('0x28')](respondWithResult(_0x19ac31,null))['catch'](handleError(_0x19ac31,null));};exports[_0xdf3c('0x7e')]=function(_0x585871,_0x42df23,_0x389708){return db[_0xdf3c('0x7f')][_0xdf3c('0x64')]({'where':{'id':_0x585871[_0xdf3c('0x47')]['id']}})[_0xdf3c('0x28')](handleEntityNotFound(_0x42df23,null))[_0xdf3c('0x28')](function(_0x3eece1){var _0x32d09d;if(_0x3eece1){_0x32d09d=squel[_0xdf3c('0x80')]()[_0xdf3c('0x65')](_0xdf3c('0x66'))[_0xdf3c('0x67')]([_0xdf3c('0x68'),'scheduledAt',_0xdf3c('0x6a'),_0xdf3c('0x6b'),_0xdf3c('0x81'),_0xdf3c('0x73'),'updatedAt'],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('ANY_VALUE(calleridnum)','phone')[_0xdf3c('0x6f')](_0xdf3c('0x70'),_0xdf3c('0x69'))[_0xdf3c('0x6f')](_0xdf3c('0x71'),'ContactId')[_0xdf3c('0x6f')](_0xdf3c('0x72'),_0xdf3c('0x6b'))[_0xdf3c('0x6f')](_0xdf3c('0x82'),_0xdf3c('0x81'))['field'](_0xdf3c('0x70'),_0xdf3c('0x73'))[_0xdf3c('0x6f')](_0xdf3c('0x70'),_0xdf3c('0x6d'))['from']('cm_hopper_final')['where'](_0xdf3c('0x83'),_0x585871[_0xdf3c('0x47')]['id'][_0xdf3c('0x76')]())[_0xdf3c('0x3b')](_0xdf3c('0x77'),_0x585871[_0xdf3c('0x4b')][_0xdf3c('0x78')][_0xdf3c('0x76')]())['where'](_0xdf3c('0x79'))[_0xdf3c('0x3b')](_0xdf3c('0x7a'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x68'))['from'](_0xdf3c('0x66'))[_0xdf3c('0x3b')]('CampaignId\x20=\x20?',_0x585871['params']['id'][_0xdf3c('0x76')]()))['where'](_0xdf3c('0x7a'),squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x7b'))[_0xdf3c('0x74')](_0xdf3c('0x75'))[_0xdf3c('0x3b')](_0xdf3c('0x83'),_0x585871[_0xdf3c('0x47')]['id']['toString']())[_0xdf3c('0x3b')](_0xdf3c('0x84')))[_0xdf3c('0x7d')](_0xdf3c('0x6a')))[_0xdf3c('0x76')]();return db[_0xdf3c('0x4e')][_0xdf3c('0x32')](_0x32d09d);}return[];})['then'](respondWithResult(_0x42df23,null))['catch'](handleError(_0x42df23,null));};exports[_0xdf3c('0x85')]=function(_0x259249,_0x1f6f9b,_0x5b6419){return db[_0xdf3c('0x86')]['findOne']({'where':{'VoiceQueueId':_0x259249['body'][_0xdf3c('0x6c')],'CampaignId':_0x259249[_0xdf3c('0x4b')]['CampaignId'],'ContactId':_0x259249[_0xdf3c('0x4b')]['ContactId']}})[_0xdf3c('0x28')](handleEntityNotFound(_0x1f6f9b,null))['then'](function(_0x12b135){if(_0x12b135){return _0x12b135;}return null;})[_0xdf3c('0x28')](respondWithResult(_0x1f6f9b,null))[_0xdf3c('0x49')](handleError(_0x1f6f9b,null));}; \ No newline at end of file +var _0x9b87=['group','moveContactsIvrCampaignHopperFinal','fromQuery','CampaignId','NOW()','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204'];(function(_0x23c77e,_0x110c62){var _0x57d2be=function(_0x3bead3){while(--_0x3bead3){_0x23c77e['push'](_0x23c77e['shift']());}};_0x57d2be(++_0x110c62);}(_0x9b87,0x8e));var _0x79b8=function(_0x46787b,_0x46660e){_0x46787b=_0x46787b-0x0;var _0x4f1aac=_0x9b87[_0x46787b];return _0x4f1aac;};'use strict';var pdf=require(_0x79b8('0x0'));var emlformat=require(_0x79b8('0x1'));var rimraf=require(_0x79b8('0x2'));var zipdir=require(_0x79b8('0x3'));var jsonpatch=require(_0x79b8('0x4'));var rp=require(_0x79b8('0x5'));var moment=require(_0x79b8('0x6'));var BPromise=require(_0x79b8('0x7'));var Mustache=require(_0x79b8('0x8'));var util=require(_0x79b8('0x9'));var path=require(_0x79b8('0xa'));var sox=require(_0x79b8('0xb'));var csv=require(_0x79b8('0xc'));var ejs=require(_0x79b8('0xd'));var fs=require('fs');var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=_0x57a248[_0x79b8('0x1d')],_0x3e3de3=_0x21aae0[_0x79b8('0x1e')],_0x49e40b=_0x21aae0[_0x79b8('0x1e')]+_0x21aae0[_0x79b8('0x1f')],_0x5ef869;if(_0x49e40b>=_0x5ddab5){_0x49e40b=_0x5ddab5;_0x5ef869=0xc8;}else{_0x5ef869=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x5ef869);return _0x3142e9[_0x79b8('0x20')]('Content-Range',_0x3e3de3+'-'+_0x49e40b+'/'+_0x5ddab5)[_0x79b8('0x21')](_0x57a248);}return null;};}function patchUpdates(_0x5bdfb9){return function(_0x53d386){try{jsonpatch[_0x79b8('0x22')](_0x53d386,_0x5bdfb9,!![]);}catch(_0x131d04){return BPromise[_0x79b8('0x23')](_0x131d04);}return _0x53d386[_0x79b8('0x24')]();};}function saveUpdates(_0x1e24cf,_0x1e7507){return function(_0x3611c3){if(_0x3611c3){return _0x3611c3[_0x79b8('0x25')](_0x1e24cf)[_0x79b8('0x26')](function(_0x48ba32){return _0x48ba32;});}return null;};}function removeEntity(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x3e9d83['status'](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x4f543f,_0x5e8228){return function(_0x257ea5){if(!_0x257ea5){_0x4f543f[_0x79b8('0x1a')](0x194);}return _0x257ea5;};}function handleError(_0x262b48,_0x665170){_0x665170=_0x665170||0x1f4;return function(_0x9deb6c){logger['error'](_0x9deb6c[_0x79b8('0x28')]);if(_0x9deb6c[_0x79b8('0x29')]){delete _0x9deb6c[_0x79b8('0x29')];}_0x262b48[_0x79b8('0x1b')](_0x665170)['send'](_0x9deb6c);};}exports[_0x79b8('0x2a')]=function(_0x2b6fad,_0x14a4d6){var _0x4aa92c={},_0x43a09e={},_0x4a4ef6={'count':0x0,'rows':[]};var _0x43058e=_[_0x79b8('0x2b')](db[_0x79b8('0x2c')][_0x79b8('0x2d')],function(_0x4f51d1){return{'name':_0x4f51d1[_0x79b8('0x2e')],'type':_0x4f51d1['type'][_0x79b8('0x2f')]};});_0x43a09e['model']=_[_0x79b8('0x2b')](_0x43058e,_0x79b8('0x29'));_0x43a09e[_0x79b8('0x30')]=_['keys'](_0x2b6fad[_0x79b8('0x30')]);_0x43a09e[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x43a09e[_0x79b8('0x33')],_0x43a09e['query']);_0x4aa92c[_0x79b8('0x34')]=_['intersection'](_0x43a09e['model'],qs[_0x79b8('0x35')](_0x2b6fad[_0x79b8('0x30')]['fields']));_0x4aa92c[_0x79b8('0x34')]=_0x4aa92c['attributes']['length']?_0x4aa92c[_0x79b8('0x34')]:_0x43a09e['model'];if(!_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x36')]('nolimit')){_0x4aa92c[_0x79b8('0x1f')]=qs[_0x79b8('0x1f')](_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x1f')]);_0x4aa92c[_0x79b8('0x1e')]=qs[_0x79b8('0x1e')](_0x2b6fad['query'][_0x79b8('0x1e')]);}_0x4aa92c[_0x79b8('0x37')]=qs[_0x79b8('0x38')](_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x38')]);_0x4aa92c[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_[_0x79b8('0x3a')](_0x2b6fad[_0x79b8('0x30')],_0x43a09e[_0x79b8('0x31')]),_0x43058e);if(_0x2b6fad[_0x79b8('0x30')]['filter']){_0x4aa92c[_0x79b8('0x39')]=_[_0x79b8('0x3b')](_0x4aa92c[_0x79b8('0x39')],{'$or':_['map'](_0x43058e,function(_0x3cbf9b){if(_0x3cbf9b[_0x79b8('0x3c')]!==_0x79b8('0x3d')){var _0x1f0dea={};_0x1f0dea[_0x3cbf9b[_0x79b8('0x29')]]={'$like':'%'+_0x2b6fad[_0x79b8('0x30')]['filter']+'%'};return _0x1f0dea;}})});}_0x4aa92c=_[_0x79b8('0x3b')]({},_0x4aa92c,_0x2b6fad['options']);var _0x512d04={'where':_0x4aa92c[_0x79b8('0x39')]};return db['CmHopperFinal']['count'](_0x512d04)[_0x79b8('0x26')](function(_0x1f211a){_0x4a4ef6[_0x79b8('0x1d')]=_0x1f211a;if(_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x3e')]){_0x4aa92c[_0x79b8('0x3f')]=[{'all':!![]}];}return db[_0x79b8('0x2c')][_0x79b8('0x40')](_0x4aa92c);})[_0x79b8('0x26')](function(_0x37fe86){_0x4a4ef6[_0x79b8('0x41')]=_0x37fe86;return _0x4a4ef6;})[_0x79b8('0x26')](respondWithFilteredResult(_0x14a4d6,_0x4aa92c))[_0x79b8('0x42')](handleError(_0x14a4d6,null));};exports['show']=function(_0x317fe2,_0x13b041){var _0x4da364={'raw':!![],'where':{'id':_0x317fe2[_0x79b8('0x43')]['id']}},_0x3c4ce7={};_0x3c4ce7['model']=_[_0x79b8('0x44')](db[_0x79b8('0x2c')][_0x79b8('0x2d')]);_0x3c4ce7[_0x79b8('0x30')]=_[_0x79b8('0x44')](_0x317fe2[_0x79b8('0x30')]);_0x3c4ce7[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x3c4ce7[_0x79b8('0x33')],_0x3c4ce7[_0x79b8('0x30')]);_0x4da364[_0x79b8('0x34')]=_[_0x79b8('0x32')](_0x3c4ce7['model'],qs['fields'](_0x317fe2[_0x79b8('0x30')][_0x79b8('0x35')]));_0x4da364[_0x79b8('0x34')]=_0x4da364[_0x79b8('0x34')]['length']?_0x4da364[_0x79b8('0x34')]:_0x3c4ce7[_0x79b8('0x33')];if(_0x317fe2[_0x79b8('0x30')][_0x79b8('0x3e')]){_0x4da364['include']=[{'all':!![]}];}_0x4da364=_[_0x79b8('0x3b')]({},_0x4da364,_0x317fe2[_0x79b8('0x45')]);return db[_0x79b8('0x2c')][_0x79b8('0x46')](_0x4da364)['then'](handleEntityNotFound(_0x13b041,null))[_0x79b8('0x26')](respondWithResult(_0x13b041,null))[_0x79b8('0x42')](handleError(_0x13b041,null));};exports[_0x79b8('0x47')]=function(_0x181f52,_0x354ddc){return db[_0x79b8('0x2c')]['describe']()[_0x79b8('0x26')](respondWithResult(_0x354ddc,null))[_0x79b8('0x42')](handleError(_0x354ddc,null));};exports[_0x79b8('0x25')]=function(_0xc89e93,_0x478940){if(_0xc89e93['body'][_0x79b8('0x48')]){delete _0xc89e93[_0x79b8('0x49')][_0x79b8('0x48')];}return db[_0x79b8('0x2c')][_0x79b8('0x46')]({'where':{'uniqueid':_0xc89e93[_0x79b8('0x43')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x478940,null))[_0x79b8('0x26')](saveUpdates(_0xc89e93[_0x79b8('0x49')],null))['then'](respondWithResult(_0x478940,null))[_0x79b8('0x42')](handleError(_0x478940,null));};exports[_0x79b8('0x4a')]=function(_0xe82504,_0x54e359,_0x28d28f){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0xe82504[_0x79b8('0x43')]['id']},'attributes':[[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x79b8('0x4d')))),_0x79b8('0x4e')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')](_0x79b8('0x50')))),_0x79b8('0x51')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x79b8('0x52')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x79b8('0x53')))),_0x79b8('0x54')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db['sequelize']['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x79b8('0x55')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db['sequelize']['fn']('IF',db[_0x79b8('0x4b')]['literal'](_0x79b8('0x56')))),_0x79b8('0x57')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')](_0x79b8('0x58')))),_0x79b8('0x59')],[db[_0x79b8('0x4b')]['fn']('COUNT',db[_0x79b8('0x4b')]['fn']('IF',db['sequelize'][_0x79b8('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x79b8('0x5a')]]})[_0x79b8('0x26')](handleEntityNotFound(_0x54e359,null))[_0x79b8('0x26')](respondWithResult(_0x54e359,null))[_0x79b8('0x42')](handleError(_0x54e359,null));};exports[_0x79b8('0x5b')]=function(_0x5885a3,_0x1d5b81,_0x57d73d){return db[_0x79b8('0x2c')][_0x79b8('0x40')]({'raw':![],'where':{'CampaignId':_0x5885a3[_0x79b8('0x43')]['id']},'attributes':[[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db['sequelize'][_0x79b8('0x4f')](_0x79b8('0x4d')))),'noSuchContacts'],[db[_0x79b8('0x4b')]['fn']('COUNT',db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')]['literal'](_0x79b8('0x50')))),_0x79b8('0x51')],[db['sequelize']['fn'](_0x79b8('0x4c'),db['sequelize']['fn']('IF',db[_0x79b8('0x4b')]['literal'](_0x79b8('0x5c')))),_0x79b8('0x52')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')]['literal'](_0x79b8('0x53')))),_0x79b8('0x54')],[db['sequelize']['fn']('COUNT',db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')]['literal'](_0x79b8('0x5d')))),_0x79b8('0x55')],[db[_0x79b8('0x4b')]['fn']('COUNT',db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')](_0x79b8('0x56')))),_0x79b8('0x57')],[db[_0x79b8('0x4b')]['fn']('COUNT',db[_0x79b8('0x4b')]['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x79b8('0x59')],[db[_0x79b8('0x4b')]['fn'](_0x79b8('0x4c'),db['sequelize']['fn']('IF',db[_0x79b8('0x4b')][_0x79b8('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x79b8('0x26')](handleEntityNotFound(_0x1d5b81,null))[_0x79b8('0x26')](respondWithResult(_0x1d5b81,null))[_0x79b8('0x42')](handleError(_0x1d5b81,null));};exports[_0x79b8('0x5e')]=function(_0xd39bc0,_0x1c6ff0,_0x3e165f){return db[_0x79b8('0x5f')]['find']({'where':{'id':_0xd39bc0[_0x79b8('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c6ff0,null))['then'](function(_0xbb092e){var _0x54e855;if(_0xbb092e){_0x54e855=squel[_0x79b8('0x60')]()[_0x79b8('0x61')](_0x79b8('0x62'))['fromQuery']([_0x79b8('0x63'),_0x79b8('0x64'),_0x79b8('0x65'),_0x79b8('0x66'),_0x79b8('0x67'),_0x79b8('0x68'),_0x79b8('0x69')],squel[_0x79b8('0x6a')]()[_0x79b8('0x6b')](_0x79b8('0x6c'),_0x79b8('0x63'))[_0x79b8('0x6b')]('NOW()',_0x79b8('0x64'))[_0x79b8('0x6b')](_0x79b8('0x6d'),_0x79b8('0x65'))[_0x79b8('0x6b')](_0x79b8('0x6e'),_0x79b8('0x66'))[_0x79b8('0x6b')](_0x79b8('0x6f'),_0x79b8('0x67'))[_0x79b8('0x6b')]('NOW()',_0x79b8('0x68'))['field']('NOW()',_0x79b8('0x69'))[_0x79b8('0x70')](_0x79b8('0x71'))[_0x79b8('0x39')](_0x79b8('0x72'),_0xd39bc0[_0x79b8('0x43')]['id'][_0x79b8('0x73')]())[_0x79b8('0x39')]('state\x20=\x20?',_0xd39bc0['body']['state'][_0x79b8('0x73')]())[_0x79b8('0x39')](_0x79b8('0x74'))[_0x79b8('0x39')](_0x79b8('0x75'),squel[_0x79b8('0x6a')]()[_0x79b8('0x6b')](_0x79b8('0x63'))[_0x79b8('0x70')](_0x79b8('0x62'))[_0x79b8('0x39')](_0x79b8('0x72'),_0xd39bc0['params']['id'][_0x79b8('0x73')]()))[_0x79b8('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x79b8('0x6a')]()[_0x79b8('0x6b')](_0x79b8('0x76'))[_0x79b8('0x70')](_0x79b8('0x71'))[_0x79b8('0x39')](_0x79b8('0x72'),_0xd39bc0[_0x79b8('0x43')]['id']['toString']())['where'](_0x79b8('0x77')))[_0x79b8('0x78')](_0x79b8('0x65')))[_0x79b8('0x73')]();return db[_0x79b8('0x4b')][_0x79b8('0x30')](_0x54e855);}return[];})[_0x79b8('0x26')](respondWithResult(_0x1c6ff0,null))[_0x79b8('0x42')](handleError(_0x1c6ff0,null));};exports[_0x79b8('0x79')]=function(_0x70dd24,_0x4912ce,_0x56f946){return db['Campaign']['find']({'where':{'id':_0x70dd24[_0x79b8('0x43')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x4912ce,null))['then'](function(_0x30b485){var _0xd6c7e7;if(_0x30b485){_0xd6c7e7=squel[_0x79b8('0x60')]()[_0x79b8('0x61')](_0x79b8('0x62'))[_0x79b8('0x7a')]([_0x79b8('0x63'),_0x79b8('0x64'),_0x79b8('0x65'),_0x79b8('0x66'),_0x79b8('0x7b'),'createdAt','updatedAt'],squel[_0x79b8('0x6a')]()[_0x79b8('0x6b')](_0x79b8('0x6c'),_0x79b8('0x63'))[_0x79b8('0x6b')](_0x79b8('0x7c'),_0x79b8('0x64'))['field'](_0x79b8('0x6d'),_0x79b8('0x65'))[_0x79b8('0x6b')](_0x79b8('0x6e'),'ListId')[_0x79b8('0x6b')](_0x79b8('0x7d'),_0x79b8('0x7b'))['field'](_0x79b8('0x7c'),_0x79b8('0x68'))[_0x79b8('0x6b')](_0x79b8('0x7c'),'updatedAt')['from'](_0x79b8('0x71'))[_0x79b8('0x39')](_0x79b8('0x7e'),_0x70dd24[_0x79b8('0x43')]['id'][_0x79b8('0x73')]())[_0x79b8('0x39')](_0x79b8('0x7f'),_0x70dd24[_0x79b8('0x49')]['state'][_0x79b8('0x73')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x79b8('0x39')](_0x79b8('0x75'),squel['select']()['field'](_0x79b8('0x63'))[_0x79b8('0x70')](_0x79b8('0x62'))[_0x79b8('0x39')]('CampaignId\x20=\x20?',_0x70dd24[_0x79b8('0x43')]['id'][_0x79b8('0x73')]()))[_0x79b8('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x79b8('0x6a')]()['field']('calleridnum')[_0x79b8('0x70')](_0x79b8('0x71'))[_0x79b8('0x39')]('CampaignId\x20=\x20?',_0x70dd24['params']['id']['toString']())[_0x79b8('0x39')](_0x79b8('0x77')))[_0x79b8('0x78')]('ContactId'))[_0x79b8('0x73')]();return db[_0x79b8('0x4b')][_0x79b8('0x30')](_0xd6c7e7);}return[];})['then'](respondWithResult(_0x4912ce,null))[_0x79b8('0x42')](handleError(_0x4912ce,null));};exports[_0x79b8('0x80')]=function(_0x456e63,_0x2c1a7d,_0x2b4de){return db[_0x79b8('0x81')][_0x79b8('0x82')]({'where':{'VoiceQueueId':_0x456e63['body'][_0x79b8('0x67')],'CampaignId':_0x456e63[_0x79b8('0x49')][_0x79b8('0x7b')],'ContactId':_0x456e63[_0x79b8('0x49')][_0x79b8('0x65')]}})[_0x79b8('0x26')](handleEntityNotFound(_0x2c1a7d,null))['then'](function(_0x413995){if(_0x413995){return _0x413995;}return null;})[_0x79b8('0x26')](respondWithResult(_0x2c1a7d,null))[_0x79b8('0x42')](handleError(_0x2c1a7d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c85e0fa..b729b2c 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 _0xfe92=['CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x20cc33,_0x24919a){var _0x2da49e=function(_0x29be76){while(--_0x29be76){_0x20cc33['push'](_0x20cc33['shift']());}};_0x2da49e(++_0x24919a);}(_0xfe92,0xe0));var _0x2fe9=function(_0xff8595,_0x39341d){_0xff8595=_0xff8595-0x0;var _0x31e49e=_0xfe92[_0xff8595];return _0x31e49e;};'use strict';var _=require(_0x2fe9('0x0'));var util=require(_0x2fe9('0x1'));var logger=require(_0x2fe9('0x2'))(_0x2fe9('0x3'));var moment=require(_0x2fe9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fe9('0x5'));var rimraf=require('rimraf');var config=require(_0x2fe9('0x6'));var attributes=require(_0x2fe9('0x7'));module[_0x2fe9('0x8')]=function(_0x5bf849,_0x176c35){return _0x5bf849[_0x2fe9('0x9')](_0x2fe9('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2fe9('0xb'),'fields':[_0x2fe9('0xb')]},{'name':_0x2fe9('0xc'),'fields':[_0x2fe9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1494=['calleridnum','uniqueid','util','api','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x465162,_0x3f5127){var _0x32d6dd=function(_0x252a70){while(--_0x252a70){_0x465162['push'](_0x465162['shift']());}};_0x32d6dd(++_0x3f5127);}(_0x1494,0xe6));var _0x4149=function(_0x502313,_0x1c888c){_0x502313=_0x502313-0x0;var _0x1b880c=_0x1494[_0x502313];return _0x1b880c;};'use strict';var _=require('lodash');var util=require(_0x4149('0x0'));var logger=require('../../config/logger')(_0x4149('0x1'));var moment=require('moment');var BPromise=require(_0x4149('0x2'));var rp=require(_0x4149('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4149('0x4'));var attributes=require(_0x4149('0x5'));module[_0x4149('0x6')]=function(_0x4823ae,_0x4297c7){return _0x4823ae[_0x4149('0x7')](_0x4149('0x8'),attributes,{'tableName':_0x4149('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x4149('0xa')]},{'name':_0x4149('0xb'),'fields':[_0x4149('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5bf14d1..1bee3e2 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 _0xb964=['create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperFinal','CmHopperFinal'];(function(_0x52608f,_0x2a3f02){var _0x298b94=function(_0x1297d4){while(--_0x1297d4){_0x52608f['push'](_0x52608f['shift']());}};_0x298b94(++_0x2a3f02);}(_0xb964,0x12d));var _0x4b96=function(_0x29a32f,_0x356dbe){_0x29a32f=_0x29a32f-0x0;var _0x37ee39=_0xb964[_0x29a32f];return _0x37ee39;};'use strict';var _=require('lodash');var util=require(_0x4b96('0x0'));var moment=require(_0x4b96('0x1'));var BPromise=require(_0x4b96('0x2'));var rs=require(_0x4b96('0x3'));var fs=require('fs');var Redis=require(_0x4b96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b96('0x5'));var logger=require(_0x4b96('0x6'))(_0x4b96('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b96('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b4bd2,_0x13ce94,_0x2e4f8e){return new BPromise(function(_0x3ae627,_0x2d1f3f){return client[_0x4b96('0x9')](_0x4b4bd2,_0x2e4f8e)[_0x4b96('0xa')](function(_0x2e0346){logger[_0x4b96('0xb')](_0x4b96('0xc'),_0x13ce94,_0x4b96('0xd'));logger[_0x4b96('0xe')](_0x4b96('0xf'),_0x13ce94,_0x4b96('0xd'),JSON[_0x4b96('0x10')](_0x2e0346));if(_0x2e0346[_0x4b96('0x11')]){if(_0x2e0346[_0x4b96('0x11')][_0x4b96('0x12')]===0x1f4){logger[_0x4b96('0x11')](_0x4b96('0xc'),_0x13ce94,_0x2e0346[_0x4b96('0x11')]['message']);return _0x2d1f3f(_0x2e0346['error']['message']);}logger['error'](_0x4b96('0xc'),_0x13ce94,_0x2e0346['error'][_0x4b96('0x13')]);return _0x3ae627(_0x2e0346[_0x4b96('0x11')][_0x4b96('0x13')]);}else{logger[_0x4b96('0xb')](_0x4b96('0xc'),_0x13ce94,_0x4b96('0xd'));_0x3ae627(_0x2e0346['result'][_0x4b96('0x13')]);}})[_0x4b96('0x14')](function(_0x122173){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x13ce94,_0x122173);_0x2d1f3f(_0x122173);});});}exports[_0x4b96('0x15')]=function(_0x11bc18){var _0x4bd836=this;return new Promise(function(_0x1dae18,_0x3c689b){return db[_0x4b96('0x16')][_0x4b96('0x17')](_0x11bc18[_0x4b96('0x18')],{'raw':_0x11bc18[_0x4b96('0x19')]?_0x11bc18[_0x4b96('0x19')][_0x4b96('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x439bc6){logger[_0x4b96('0xb')](_0x4b96('0x15'),_0x11bc18);logger['debug']('CreateCmHopperFinal',_0x11bc18,JSON[_0x4b96('0x10')](_0x439bc6));_0x1dae18(_0x439bc6);})[_0x4b96('0x14')](function(_0x279ecb){logger[_0x4b96('0x11')](_0x4b96('0x15'),_0x279ecb[_0x4b96('0x13')],_0x11bc18);_0x3c689b(_0x4bd836[_0x4b96('0x11')](0x1f4,_0x279ecb[_0x4b96('0x13')]));});});}; \ No newline at end of file +var _0x1401=['CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x34e9b2,_0x347475){var _0x5c664d=function(_0x3c3739){while(--_0x3c3739){_0x34e9b2['push'](_0x34e9b2['shift']());}};_0x5c664d(++_0x347475);}(_0x1401,0x1bc));var _0x1140=function(_0x18987a,_0x5dcef0){_0x18987a=_0x18987a-0x0;var _0x1542c=_0x1401[_0x18987a];return _0x1542c;};'use strict';var _=require(_0x1140('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1140('0x1'));var rs=require(_0x1140('0x2'));var fs=require('fs');var Redis=require(_0x1140('0x3'));var db=require(_0x1140('0x4'))['db'];var utils=require(_0x1140('0x5'));var logger=require(_0x1140('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1140('0x7')][_0x1140('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c87fb,_0x90704f,_0x7e6d53){return new BPromise(function(_0x5d245d,_0x42ab74){return client[_0x1140('0x9')](_0x5c87fb,_0x7e6d53)[_0x1140('0xa')](function(_0x3e11c5){logger[_0x1140('0xb')](_0x1140('0xc'),_0x90704f,_0x1140('0xd'));logger[_0x1140('0xe')](_0x1140('0xf'),_0x90704f,_0x1140('0xd'),JSON[_0x1140('0x10')](_0x3e11c5));if(_0x3e11c5[_0x1140('0x11')]){if(_0x3e11c5['error'][_0x1140('0x12')]===0x1f4){logger[_0x1140('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x90704f,_0x3e11c5['error']['message']);return _0x42ab74(_0x3e11c5[_0x1140('0x11')][_0x1140('0x13')]);}logger[_0x1140('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x90704f,_0x3e11c5['error'][_0x1140('0x13')]);return _0x5d245d(_0x3e11c5[_0x1140('0x11')]['message']);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x90704f,'request\x20sent');_0x5d245d(_0x3e11c5[_0x1140('0x14')]['message']);}})[_0x1140('0x15')](function(_0x242dc4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x90704f,_0x242dc4);_0x42ab74(_0x242dc4);});});}exports[_0x1140('0x16')]=function(_0x315a1c){var _0x2b05fc=this;return new Promise(function(_0x395cc9,_0xb34a89){return db[_0x1140('0x17')][_0x1140('0x18')](_0x315a1c[_0x1140('0x19')],{'raw':_0x315a1c[_0x1140('0x1a')]?_0x315a1c[_0x1140('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1140('0xa')](function(_0x22912e){logger['info']('CreateCmHopperFinal',_0x315a1c);logger[_0x1140('0xe')](_0x1140('0x16'),_0x315a1c,JSON[_0x1140('0x10')](_0x22912e));_0x395cc9(_0x22912e);})[_0x1140('0x15')](function(_0x5d6ff4){logger[_0x1140('0x11')](_0x1140('0x16'),_0x5d6ff4['message'],_0x315a1c);_0xb34a89(_0x2b05fc[_0x1140('0x11')](0x1f4,_0x5d6ff4[_0x1140('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0c4ec9b..476d538 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 _0xae62=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','util','path','connect-timeout','express'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xae62,0x1f0));var _0x2ae6=function(_0x584b95,_0x1d8b74){_0x584b95=_0x584b95-0x0;var _0x1c914f=_0xae62[_0x584b95];return _0x1c914f;};'use strict';var multer=require('multer');var util=require(_0x2ae6('0x0'));var path=require(_0x2ae6('0x1'));var timeout=require(_0x2ae6('0x2'));var express=require(_0x2ae6('0x3'));var router=express[_0x2ae6('0x4')]();var auth=require(_0x2ae6('0x5'));var interaction=require(_0x2ae6('0x6'));var config=require(_0x2ae6('0x7'));var controller=require(_0x2ae6('0x8'));router[_0x2ae6('0x9')]('/',auth[_0x2ae6('0xa')](),controller[_0x2ae6('0xb')]);router['get'](_0x2ae6('0xc'),auth['isAuthenticated'](),controller[_0x2ae6('0xd')]);router[_0x2ae6('0x9')](_0x2ae6('0xe'),auth[_0x2ae6('0xa')](),controller[_0x2ae6('0xf')]);router[_0x2ae6('0x9')]('/voice/queue/countAttributes/:id',auth[_0x2ae6('0xa')](),controller[_0x2ae6('0x10')]);router[_0x2ae6('0x9')](_0x2ae6('0x11'),auth[_0x2ae6('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x2ae6('0x12'),auth[_0x2ae6('0xa')](),controller[_0x2ae6('0x13')]);router[_0x2ae6('0x14')]('/voice/campaign/moveContacts/:id',auth[_0x2ae6('0xa')](),controller[_0x2ae6('0x15')]);router[_0x2ae6('0x14')](_0x2ae6('0x16'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put']('/:id',auth[_0x2ae6('0xa')](),controller[_0x2ae6('0x17')]);module[_0x2ae6('0x18')]=router; \ No newline at end of file +var _0x3e05=['../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','get','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x531722,_0x161aa9){var _0x3f1769=function(_0x44e0d8){while(--_0x44e0d8){_0x531722['push'](_0x531722['shift']());}};_0x3f1769(++_0x161aa9);}(_0x3e05,0x1de));var _0x53e0=function(_0x16ca2a,_0x29d1ef){_0x16ca2a=_0x16ca2a-0x0;var _0x986858=_0x3e05[_0x16ca2a];return _0x986858;};'use strict';var multer=require(_0x53e0('0x0'));var util=require(_0x53e0('0x1'));var path=require(_0x53e0('0x2'));var timeout=require(_0x53e0('0x3'));var express=require('express');var router=express[_0x53e0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x53e0('0x5'));var config=require(_0x53e0('0x6'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x53e0('0x7')](),controller[_0x53e0('0x8')]);router['get'](_0x53e0('0x9'),auth[_0x53e0('0x7')](),controller[_0x53e0('0xa')]);router['get'](_0x53e0('0xb'),auth[_0x53e0('0x7')](),controller[_0x53e0('0xc')]);router[_0x53e0('0xd')](_0x53e0('0xe'),auth[_0x53e0('0x7')](),controller[_0x53e0('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0x53e0('0x7')](),controller[_0x53e0('0x10')]);router[_0x53e0('0x11')](_0x53e0('0x12'),auth[_0x53e0('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x53e0('0x11')](_0x53e0('0x13'),auth[_0x53e0('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x53e0('0x11')]('/checkContactHopper',auth[_0x53e0('0x7')](),controller['checkContactHopper']);router['put'](_0x53e0('0xb'),auth[_0x53e0('0x7')](),controller[_0x53e0('0x14')]);module[_0x53e0('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f07e3ab..bf20dc6 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 _0x4bfb=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x39ffb3,_0x55538c){var _0x4b6923=function(_0x1026bf){while(--_0x1026bf){_0x39ffb3['push'](_0x39ffb3['shift']());}};_0x4b6923(++_0x55538c);}(_0x4bfb,0x7e));var _0xb4bf=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0x4bfb[_0x6cf622];return _0x1887fe;};'use strict';var Sequelize=require(_0xb4bf('0x0'));module['exports']={'state':{'type':Sequelize[_0xb4bf('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb4bf('0x2')]},'scheduledat':{'type':Sequelize[_0xb4bf('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb4bf('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb4bf('0x2')]},'calleridnum':{'type':Sequelize[_0xb4bf('0x2')]},'calleridname':{'type':Sequelize[_0xb4bf('0x2')]},'starttime':{'type':Sequelize[_0xb4bf('0x3')]},'responsetime':{'type':Sequelize[_0xb4bf('0x3')]},'answertime':{'type':Sequelize[_0xb4bf('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb4bf('0x3')]},'ringtime':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb4bf('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb4bf('0x2')]},'amd':{'type':Sequelize[_0xb4bf('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb4bf('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb4bf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb4bf('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb4bf('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb4bf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2db4=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x130a51,_0x4572f3){var _0x1f69cc=function(_0x516bdc){while(--_0x516bdc){_0x130a51['push'](_0x130a51['shift']());}};_0x1f69cc(++_0x4572f3);}(_0x2db4,0x7c));var _0x42db=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2db4[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x42db('0x0')]={'state':{'type':Sequelize[_0x42db('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x42db('0x2')]},'scheduledat':{'type':Sequelize[_0x42db('0x3')]},'countbusyretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x42db('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x42db('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x42db('0x2')]},'calleridname':{'type':Sequelize[_0x42db('0x2')]},'starttime':{'type':Sequelize[_0x42db('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x42db('0x3')]},'endtime':{'type':Sequelize[_0x42db('0x3')]},'ringtime':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x42db('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x42db('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x42db('0x2')]},'amd':{'type':Sequelize[_0x42db('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x42db('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x42db('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x42db('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x42db('0x3')]},'recallme':{'type':Sequelize[_0x42db('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x42db('0x3')]},'edited':{'type':Sequelize[_0x42db('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x42db('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index fda5b54..22bf995 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 _0x432c=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','describe','update','uniqueid','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x432c,0xba));var _0xc432=function(_0x44a1da,_0x47d880){_0x44a1da=_0x44a1da-0x0;var _0x4a7c79=_0x432c[_0x44a1da];return _0x4a7c79;};'use strict';var pdf=require(_0xc432('0x0'));var emlformat=require(_0xc432('0x1'));var rimraf=require(_0xc432('0x2'));var zipdir=require(_0xc432('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc432('0x4'));var moment=require('moment');var BPromise=require(_0xc432('0x5'));var Mustache=require(_0xc432('0x6'));var util=require(_0xc432('0x7'));var path=require('path');var sox=require(_0xc432('0x8'));var csv=require(_0xc432('0x9'));var ejs=require(_0xc432('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc432('0xb'));var crypto=require(_0xc432('0xc'));var jsforce=require(_0xc432('0xd'));var deskjs=require(_0xc432('0xe'));var toCsv=require(_0xc432('0x9'));var querystring=require(_0xc432('0xf'));var Papa=require(_0xc432('0x10'));var Redis=require(_0xc432('0x11'));var authService=require(_0xc432('0x12'));var qs=require(_0xc432('0x13'));var as=require(_0xc432('0x14'));var hardwareService=require(_0xc432('0x15'));var logger=require(_0xc432('0x16'))(_0xc432('0x17'));var utils=require(_0xc432('0x18'));var config=require(_0xc432('0x19'));var licenseUtil=require(_0xc432('0x1a'));var db=require(_0xc432('0x1b'))['db'];function respondWithStatusCode(_0x4a1490,_0x2d4b35){_0x2d4b35=_0x2d4b35||0xcc;return function(_0x540348){if(_0x540348){return _0x4a1490[_0xc432('0x1c')](_0x2d4b35);}return _0x4a1490[_0xc432('0x1d')](_0x2d4b35)[_0xc432('0x1e')]();};}function respondWithResult(_0xdae464,_0x5194c9){_0x5194c9=_0x5194c9||0xc8;return function(_0x17bb70){if(_0x17bb70){return _0xdae464[_0xc432('0x1d')](_0x5194c9)[_0xc432('0x1f')](_0x17bb70);}};}function respondWithFilteredResult(_0x3db9bd,_0x3ccf57){return function(_0x41daae){if(_0x41daae){var _0x4211a9=_0x41daae[_0xc432('0x20')],_0x5a5741=_0x3ccf57[_0xc432('0x21')],_0xd07773=_0x3ccf57[_0xc432('0x21')]+_0x3ccf57[_0xc432('0x22')],_0x292ab8;if(_0xd07773>=_0x4211a9){_0xd07773=_0x4211a9;_0x292ab8=0xc8;}else{_0x292ab8=0xce;}_0x3db9bd[_0xc432('0x1d')](_0x292ab8);return _0x3db9bd['set']('Content-Range',_0x5a5741+'-'+_0xd07773+'/'+_0x4211a9)[_0xc432('0x1f')](_0x41daae);}return null;};}function patchUpdates(_0xbed823){return function(_0x173160){try{jsonpatch[_0xc432('0x23')](_0x173160,_0xbed823,!![]);}catch(_0x531a16){return BPromise[_0xc432('0x24')](_0x531a16);}return _0x173160[_0xc432('0x25')]();};}function saveUpdates(_0x19e8ff,_0x3dbee9){return function(_0x996c56){if(_0x996c56){return _0x996c56['update'](_0x19e8ff)['then'](function(_0x199cdd){return _0x199cdd;});}return null;};}function removeEntity(_0x27878d,_0x5db28c){return function(_0x2649c7){if(_0x2649c7){return _0x2649c7['destroy']()[_0xc432('0x26')](function(){_0x27878d[_0xc432('0x1d')](0xcc)[_0xc432('0x1e')]();});}};}function handleEntityNotFound(_0x2776ef,_0x41e1ba){return function(_0x4f2486){if(!_0x4f2486){_0x2776ef[_0xc432('0x1c')](0x194);}return _0x4f2486;};}function handleError(_0x17c240,_0x4b1642){_0x4b1642=_0x4b1642||0x1f4;return function(_0x48e912){logger[_0xc432('0x27')](_0x48e912['stack']);if(_0x48e912[_0xc432('0x28')]){delete _0x48e912[_0xc432('0x28')];}_0x17c240[_0xc432('0x1d')](_0x4b1642)[_0xc432('0x29')](_0x48e912);};}exports[_0xc432('0x2a')]=function(_0x5d87d4,_0x3c783d){var _0x2d1b80={},_0x243668={},_0xc1f509={'count':0x0,'rows':[]};var _0x38a694=_[_0xc432('0x2b')](db[_0xc432('0x2c')][_0xc432('0x2d')],function(_0x13b05f){return{'name':_0x13b05f[_0xc432('0x2e')],'type':_0x13b05f[_0xc432('0x2f')]['key']};});_0x243668[_0xc432('0x30')]=_[_0xc432('0x2b')](_0x38a694,'name');_0x243668[_0xc432('0x31')]=_[_0xc432('0x32')](_0x5d87d4[_0xc432('0x31')]);_0x243668[_0xc432('0x33')]=_[_0xc432('0x34')](_0x243668[_0xc432('0x30')],_0x243668[_0xc432('0x31')]);_0x2d1b80[_0xc432('0x35')]=_[_0xc432('0x34')](_0x243668['model'],qs[_0xc432('0x36')](_0x5d87d4[_0xc432('0x31')]['fields']));_0x2d1b80[_0xc432('0x35')]=_0x2d1b80[_0xc432('0x35')]['length']?_0x2d1b80[_0xc432('0x35')]:_0x243668[_0xc432('0x30')];if(!_0x5d87d4[_0xc432('0x31')][_0xc432('0x37')](_0xc432('0x38'))){_0x2d1b80[_0xc432('0x22')]=qs['limit'](_0x5d87d4['query'][_0xc432('0x22')]);_0x2d1b80[_0xc432('0x21')]=qs[_0xc432('0x21')](_0x5d87d4[_0xc432('0x31')][_0xc432('0x21')]);}_0x2d1b80[_0xc432('0x39')]=qs[_0xc432('0x3a')](_0x5d87d4['query'][_0xc432('0x3a')]);_0x2d1b80[_0xc432('0x3b')]=qs['filters'](_['pick'](_0x5d87d4[_0xc432('0x31')],_0x243668[_0xc432('0x33')]),_0x38a694);if(_0x5d87d4['query'][_0xc432('0x3c')]){_0x2d1b80[_0xc432('0x3b')]=_[_0xc432('0x3d')](_0x2d1b80[_0xc432('0x3b')],{'$or':_[_0xc432('0x2b')](_0x38a694,function(_0x5b1717){if(_0x5b1717[_0xc432('0x2f')]!==_0xc432('0x3e')){var _0xa76eb8={};_0xa76eb8[_0x5b1717[_0xc432('0x28')]]={'$like':'%'+_0x5d87d4[_0xc432('0x31')][_0xc432('0x3c')]+'%'};return _0xa76eb8;}})});}_0x2d1b80=_[_0xc432('0x3d')]({},_0x2d1b80,_0x5d87d4['options']);var _0xaed3e0={'where':_0x2d1b80[_0xc432('0x3b')]};return db[_0xc432('0x2c')][_0xc432('0x20')](_0xaed3e0)[_0xc432('0x26')](function(_0x2c43f2){_0xc1f509[_0xc432('0x20')]=_0x2c43f2;if(_0x5d87d4[_0xc432('0x31')]['includeAll']){_0x2d1b80[_0xc432('0x3f')]=[{'all':!![]}];}return db[_0xc432('0x2c')][_0xc432('0x40')](_0x2d1b80);})[_0xc432('0x26')](function(_0x112583){_0xc1f509[_0xc432('0x41')]=_0x112583;return _0xc1f509;})[_0xc432('0x26')](respondWithFilteredResult(_0x3c783d,_0x2d1b80))[_0xc432('0x42')](handleError(_0x3c783d,null));};exports[_0xc432('0x43')]=function(_0x51637f,_0x52327a){var _0x3eea2f={'raw':!![],'where':{'id':_0x51637f[_0xc432('0x44')]['id']}},_0x562ea3={};_0x562ea3[_0xc432('0x30')]=_[_0xc432('0x32')](db[_0xc432('0x2c')][_0xc432('0x2d')]);_0x562ea3['query']=_[_0xc432('0x32')](_0x51637f[_0xc432('0x31')]);_0x562ea3[_0xc432('0x33')]=_[_0xc432('0x34')](_0x562ea3[_0xc432('0x30')],_0x562ea3[_0xc432('0x31')]);_0x3eea2f[_0xc432('0x35')]=_[_0xc432('0x34')](_0x562ea3[_0xc432('0x30')],qs[_0xc432('0x36')](_0x51637f[_0xc432('0x31')][_0xc432('0x36')]));_0x3eea2f['attributes']=_0x3eea2f[_0xc432('0x35')][_0xc432('0x45')]?_0x3eea2f['attributes']:_0x562ea3[_0xc432('0x30')];if(_0x51637f[_0xc432('0x31')][_0xc432('0x46')]){_0x3eea2f['include']=[{'all':!![]}];}_0x3eea2f=_[_0xc432('0x3d')]({},_0x3eea2f,_0x51637f[_0xc432('0x47')]);return db['CmHopperHistory'][_0xc432('0x48')](_0x3eea2f)['then'](handleEntityNotFound(_0x52327a,null))[_0xc432('0x26')](respondWithResult(_0x52327a,null))[_0xc432('0x42')](handleError(_0x52327a,null));};exports[_0xc432('0x49')]=function(_0x213f0d,_0x3f20ce){return db['CmHopperHistory'][_0xc432('0x49')](_0x213f0d[_0xc432('0x4a')],{})[_0xc432('0x26')](respondWithResult(_0x3f20ce,0xc9))[_0xc432('0x42')](handleError(_0x3f20ce,null));};exports[_0xc432('0x4b')]=function(_0x3ff96f,_0x14e508){return db['CmHopperHistory'][_0xc432('0x4b')]()[_0xc432('0x26')](respondWithResult(_0x14e508,null))['catch'](handleError(_0x14e508,null));};exports[_0xc432('0x4c')]=function(_0x704689,_0x5d324d){if(_0x704689[_0xc432('0x4a')][_0xc432('0x4d')]){delete _0x704689[_0xc432('0x4a')][_0xc432('0x4d')];}return db['CmHopperHistory'][_0xc432('0x48')]({'where':{'uniqueid':_0x704689[_0xc432('0x44')]['id']}})[_0xc432('0x26')](handleEntityNotFound(_0x5d324d,null))[_0xc432('0x26')](saveUpdates(_0x704689[_0xc432('0x4a')],null))[_0xc432('0x26')](respondWithResult(_0x5d324d,null))[_0xc432('0x42')](handleError(_0x5d324d,null));}; \ No newline at end of file +var _0xbe2f=['params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','update','then','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include','CmHopperHistory','findAll','rows','show','rawAttributes','length','options','find','create','body','describe','catch','uniqueid'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0xbe2f,0x17d));var _0xfbe2=function(_0x30de89,_0x25603d){_0x30de89=_0x30de89-0x0;var _0x2f59a5=_0xbe2f[_0x30de89];return _0x2f59a5;};'use strict';var pdf=require(_0xfbe2('0x0'));var emlformat=require(_0xfbe2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfbe2('0x2'));var jsonpatch=require(_0xfbe2('0x3'));var rp=require('request-promise');var moment=require(_0xfbe2('0x4'));var BPromise=require(_0xfbe2('0x5'));var Mustache=require('mustache');var util=require(_0xfbe2('0x6'));var path=require(_0xfbe2('0x7'));var sox=require(_0xfbe2('0x8'));var csv=require(_0xfbe2('0x9'));var ejs=require(_0xfbe2('0xa'));var fs=require('fs');var _=require(_0xfbe2('0xb'));var squel=require(_0xfbe2('0xc'));var crypto=require(_0xfbe2('0xd'));var jsforce=require(_0xfbe2('0xe'));var deskjs=require(_0xfbe2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfbe2('0x10'));var Papa=require(_0xfbe2('0x11'));var Redis=require(_0xfbe2('0x12'));var authService=require(_0xfbe2('0x13'));var qs=require(_0xfbe2('0x14'));var as=require(_0xfbe2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbe2('0x16'))('api');var utils=require(_0xfbe2('0x17'));var config=require(_0xfbe2('0x18'));var licenseUtil=require(_0xfbe2('0x19'));var db=require(_0xfbe2('0x1a'))['db'];function respondWithStatusCode(_0x1a5385,_0x146e3c){_0x146e3c=_0x146e3c||0xcc;return function(_0x4f005f){if(_0x4f005f){return _0x1a5385[_0xfbe2('0x1b')](_0x146e3c);}return _0x1a5385[_0xfbe2('0x1c')](_0x146e3c)['end']();};}function respondWithResult(_0x18a207,_0x291ec4){_0x291ec4=_0x291ec4||0xc8;return function(_0x5b02ba){if(_0x5b02ba){return _0x18a207[_0xfbe2('0x1c')](_0x291ec4)[_0xfbe2('0x1d')](_0x5b02ba);}};}function respondWithFilteredResult(_0x525e7e,_0x178e0f){return function(_0x1ccdc5){if(_0x1ccdc5){var _0x506ffa=_0x1ccdc5[_0xfbe2('0x1e')],_0x4b40f3=_0x178e0f[_0xfbe2('0x1f')],_0x1e7ceb=_0x178e0f[_0xfbe2('0x1f')]+_0x178e0f['limit'],_0x2e5359;if(_0x1e7ceb>=_0x506ffa){_0x1e7ceb=_0x506ffa;_0x2e5359=0xc8;}else{_0x2e5359=0xce;}_0x525e7e[_0xfbe2('0x1c')](_0x2e5359);return _0x525e7e[_0xfbe2('0x20')]('Content-Range',_0x4b40f3+'-'+_0x1e7ceb+'/'+_0x506ffa)[_0xfbe2('0x1d')](_0x1ccdc5);}return null;};}function patchUpdates(_0x439409){return function(_0x205d2f){try{jsonpatch[_0xfbe2('0x21')](_0x205d2f,_0x439409,!![]);}catch(_0x1013f1){return BPromise['reject'](_0x1013f1);}return _0x205d2f['save']();};}function saveUpdates(_0x4895ef,_0x2ada58){return function(_0x829c65){if(_0x829c65){return _0x829c65[_0xfbe2('0x22')](_0x4895ef)[_0xfbe2('0x23')](function(_0x4d7f57){return _0x4d7f57;});}return null;};}function removeEntity(_0x4304eb,_0x32b823){return function(_0x254f36){if(_0x254f36){return _0x254f36['destroy']()[_0xfbe2('0x23')](function(){_0x4304eb['status'](0xcc)[_0xfbe2('0x24')]();});}};}function handleEntityNotFound(_0x794f15,_0x45cb93){return function(_0x95f6){if(!_0x95f6){_0x794f15['sendStatus'](0x194);}return _0x95f6;};}function handleError(_0x5299eb,_0xe8069f){_0xe8069f=_0xe8069f||0x1f4;return function(_0x28ff9a){logger['error'](_0x28ff9a[_0xfbe2('0x25')]);if(_0x28ff9a['name']){delete _0x28ff9a[_0xfbe2('0x26')];}_0x5299eb[_0xfbe2('0x1c')](_0xe8069f)[_0xfbe2('0x27')](_0x28ff9a);};}exports[_0xfbe2('0x28')]=function(_0x1bc890,_0x57d606){var _0x47c00d={},_0x4c5901={},_0x1eb060={'count':0x0,'rows':[]};var _0xd622a1=_[_0xfbe2('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0x5bcb4b){return{'name':_0x5bcb4b[_0xfbe2('0x2a')],'type':_0x5bcb4b[_0xfbe2('0x2b')][_0xfbe2('0x2c')]};});_0x4c5901['model']=_[_0xfbe2('0x29')](_0xd622a1,'name');_0x4c5901[_0xfbe2('0x2d')]=_[_0xfbe2('0x2e')](_0x1bc890[_0xfbe2('0x2d')]);_0x4c5901[_0xfbe2('0x2f')]=_['intersection'](_0x4c5901[_0xfbe2('0x30')],_0x4c5901['query']);_0x47c00d['attributes']=_[_0xfbe2('0x31')](_0x4c5901[_0xfbe2('0x30')],qs[_0xfbe2('0x32')](_0x1bc890[_0xfbe2('0x2d')][_0xfbe2('0x32')]));_0x47c00d[_0xfbe2('0x33')]=_0x47c00d[_0xfbe2('0x33')]['length']?_0x47c00d[_0xfbe2('0x33')]:_0x4c5901['model'];if(!_0x1bc890[_0xfbe2('0x2d')][_0xfbe2('0x34')](_0xfbe2('0x35'))){_0x47c00d[_0xfbe2('0x36')]=qs['limit'](_0x1bc890['query'][_0xfbe2('0x36')]);_0x47c00d[_0xfbe2('0x1f')]=qs[_0xfbe2('0x1f')](_0x1bc890[_0xfbe2('0x2d')][_0xfbe2('0x1f')]);}_0x47c00d[_0xfbe2('0x37')]=qs[_0xfbe2('0x38')](_0x1bc890[_0xfbe2('0x2d')][_0xfbe2('0x38')]);_0x47c00d[_0xfbe2('0x39')]=qs[_0xfbe2('0x2f')](_[_0xfbe2('0x3a')](_0x1bc890[_0xfbe2('0x2d')],_0x4c5901[_0xfbe2('0x2f')]),_0xd622a1);if(_0x1bc890[_0xfbe2('0x2d')][_0xfbe2('0x3b')]){_0x47c00d[_0xfbe2('0x39')]=_[_0xfbe2('0x3c')](_0x47c00d[_0xfbe2('0x39')],{'$or':_[_0xfbe2('0x29')](_0xd622a1,function(_0x3d87e0){if(_0x3d87e0['type']!=='VIRTUAL'){var _0x2a2f8f={};_0x2a2f8f[_0x3d87e0['name']]={'$like':'%'+_0x1bc890['query'][_0xfbe2('0x3b')]+'%'};return _0x2a2f8f;}})});}_0x47c00d=_[_0xfbe2('0x3c')]({},_0x47c00d,_0x1bc890['options']);var _0xb90c15={'where':_0x47c00d[_0xfbe2('0x39')]};return db['CmHopperHistory'][_0xfbe2('0x1e')](_0xb90c15)[_0xfbe2('0x23')](function(_0x20e87b){_0x1eb060[_0xfbe2('0x1e')]=_0x20e87b;if(_0x1bc890['query']['includeAll']){_0x47c00d[_0xfbe2('0x3d')]=[{'all':!![]}];}return db[_0xfbe2('0x3e')][_0xfbe2('0x3f')](_0x47c00d);})[_0xfbe2('0x23')](function(_0x525646){_0x1eb060[_0xfbe2('0x40')]=_0x525646;return _0x1eb060;})['then'](respondWithFilteredResult(_0x57d606,_0x47c00d))['catch'](handleError(_0x57d606,null));};exports[_0xfbe2('0x41')]=function(_0x14018c,_0x1bc339){var _0x387bdf={'raw':!![],'where':{'id':_0x14018c['params']['id']}},_0x5d5e7d={};_0x5d5e7d[_0xfbe2('0x30')]=_['keys'](db[_0xfbe2('0x3e')][_0xfbe2('0x42')]);_0x5d5e7d[_0xfbe2('0x2d')]=_['keys'](_0x14018c[_0xfbe2('0x2d')]);_0x5d5e7d['filters']=_[_0xfbe2('0x31')](_0x5d5e7d['model'],_0x5d5e7d[_0xfbe2('0x2d')]);_0x387bdf[_0xfbe2('0x33')]=_[_0xfbe2('0x31')](_0x5d5e7d[_0xfbe2('0x30')],qs[_0xfbe2('0x32')](_0x14018c['query'][_0xfbe2('0x32')]));_0x387bdf['attributes']=_0x387bdf[_0xfbe2('0x33')][_0xfbe2('0x43')]?_0x387bdf['attributes']:_0x5d5e7d[_0xfbe2('0x30')];if(_0x14018c[_0xfbe2('0x2d')]['includeAll']){_0x387bdf[_0xfbe2('0x3d')]=[{'all':!![]}];}_0x387bdf=_['merge']({},_0x387bdf,_0x14018c[_0xfbe2('0x44')]);return db[_0xfbe2('0x3e')][_0xfbe2('0x45')](_0x387bdf)['then'](handleEntityNotFound(_0x1bc339,null))[_0xfbe2('0x23')](respondWithResult(_0x1bc339,null))['catch'](handleError(_0x1bc339,null));};exports[_0xfbe2('0x46')]=function(_0x27cbeb,_0x2ab8e3){return db[_0xfbe2('0x3e')][_0xfbe2('0x46')](_0x27cbeb[_0xfbe2('0x47')],{})['then'](respondWithResult(_0x2ab8e3,0xc9))['catch'](handleError(_0x2ab8e3,null));};exports[_0xfbe2('0x48')]=function(_0x35fb74,_0x4447c1){return db[_0xfbe2('0x3e')][_0xfbe2('0x48')]()[_0xfbe2('0x23')](respondWithResult(_0x4447c1,null))[_0xfbe2('0x49')](handleError(_0x4447c1,null));};exports[_0xfbe2('0x22')]=function(_0x3c7991,_0xea6301){if(_0x3c7991[_0xfbe2('0x47')][_0xfbe2('0x4a')]){delete _0x3c7991[_0xfbe2('0x47')][_0xfbe2('0x4a')];}return db[_0xfbe2('0x3e')][_0xfbe2('0x45')]({'where':{'uniqueid':_0x3c7991[_0xfbe2('0x4b')]['id']}})[_0xfbe2('0x23')](handleEntityNotFound(_0xea6301,null))['then'](saveUpdates(_0x3c7991['body'],null))[_0xfbe2('0x23')](respondWithResult(_0xea6301,null))[_0xfbe2('0x49')](handleError(_0xea6301,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 76b1224..bc37c95 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 _0x0a22=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','lodash','util','api'];(function(_0x4dc96c,_0x5ae9a6){var _0x2c4a75=function(_0x4eebee){while(--_0x4eebee){_0x4dc96c['push'](_0x4dc96c['shift']());}};_0x2c4a75(++_0x5ae9a6);}(_0x0a22,0x1c4));var _0x20a2=function(_0x41f429,_0x5e8560){_0x41f429=_0x41f429-0x0;var _0x122a59=_0x0a22[_0x41f429];return _0x122a59;};'use strict';var _=require(_0x20a2('0x0'));var util=require(_0x20a2('0x1'));var logger=require('../../config/logger')(_0x20a2('0x2'));var moment=require('moment');var BPromise=require(_0x20a2('0x3'));var rp=require(_0x20a2('0x4'));var fs=require('fs');var path=require(_0x20a2('0x5'));var rimraf=require('rimraf');var config=require(_0x20a2('0x6'));var attributes=require(_0x20a2('0x7'));module[_0x20a2('0x8')]=function(_0x49a32e,_0x4c07cc){return _0x49a32e[_0x20a2('0x9')](_0x20a2('0xa'),attributes,{'tableName':_0x20a2('0xb'),'paranoid':![],'indexes':[{'name':_0x20a2('0xc'),'fields':[_0x20a2('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd223=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2cbb74,_0x241c10){var _0xa6d18=function(_0x5a2940){while(--_0x5a2940){_0x2cbb74['push'](_0x2cbb74['shift']());}};_0xa6d18(++_0x241c10);}(_0xd223,0x79));var _0x3d22=function(_0x3046da,_0x599123){_0x3046da=_0x3046da-0x0;var _0x467db2=_0xd223[_0x3046da];return _0x467db2;};'use strict';var _=require(_0x3d22('0x0'));var util=require(_0x3d22('0x1'));var logger=require(_0x3d22('0x2'))(_0x3d22('0x3'));var moment=require(_0x3d22('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d22('0x5'));var rimraf=require(_0x3d22('0x6'));var config=require(_0x3d22('0x7'));var attributes=require(_0x3d22('0x8'));module['exports']=function(_0x311dca,_0x220120){return _0x311dca[_0x3d22('0x9')](_0x3d22('0xa'),attributes,{'tableName':_0x3d22('0xb'),'paranoid':![],'indexes':[{'name':_0x3d22('0xc'),'fields':[_0x3d22('0xc')]},{'name':_0x3d22('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e13a74b..53e1b00 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 _0x84e4=['outboundReCallsDay','info','GetCampaignHopperHistory','findAll','col','ivrAnswerCallsDay','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','sequelize','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x84e4,0x1a4));var _0x484e=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x84e4[_0x39bc44];return _0x2916d8;};'use strict';var _=require('lodash');var util=require(_0x484e('0x0'));var moment=require(_0x484e('0x1'));var BPromise=require(_0x484e('0x2'));var rs=require(_0x484e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x484e('0x4'));var logger=require(_0x484e('0x5'))(_0x484e('0x6'));var config=require(_0x484e('0x7'));var jayson=require(_0x484e('0x8'));var client=jayson[_0x484e('0x9')][_0x484e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43d4da,_0x424dac,_0x1dfb16){return new BPromise(function(_0x53a74a,_0x14a20e){return client[_0x484e('0xb')](_0x43d4da,_0x1dfb16)['then'](function(_0x2af346){logger['info'](_0x484e('0xc'),_0x424dac,'request\x20sent');logger[_0x484e('0xd')](_0x484e('0xe'),_0x424dac,_0x484e('0xf'),JSON[_0x484e('0x10')](_0x2af346));if(_0x2af346['error']){if(_0x2af346['error']['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x424dac,_0x2af346['error'][_0x484e('0x11')]);return _0x14a20e(_0x2af346[_0x484e('0x12')]['message']);}logger[_0x484e('0x12')](_0x484e('0xc'),_0x424dac,_0x2af346[_0x484e('0x12')]['message']);return _0x53a74a(_0x2af346[_0x484e('0x12')]['message']);}else{logger['info'](_0x484e('0xc'),_0x424dac,_0x484e('0xf'));_0x53a74a(_0x2af346['result'][_0x484e('0x11')]);}})[_0x484e('0x13')](function(_0x2aab8d){logger[_0x484e('0x12')](_0x484e('0xc'),_0x424dac,_0x2aab8d);_0x14a20e(_0x2aab8d);});});}exports[_0x484e('0x14')]=function(_0x2b2c2f){var _0x3ec983=this;return new Promise(function(_0x460e6d,_0x26f585){return db[_0x484e('0x15')]['create'](_0x2b2c2f[_0x484e('0x16')],{'raw':_0x2b2c2f[_0x484e('0x17')]?_0x2b2c2f[_0x484e('0x17')][_0x484e('0x18')]===undefined?!![]:![]:!![]})[_0x484e('0x19')](function(_0x279f42){logger['info'](_0x484e('0x14'),_0x2b2c2f);logger[_0x484e('0xd')](_0x484e('0x14'),_0x2b2c2f,JSON[_0x484e('0x10')](_0x279f42));_0x460e6d(_0x279f42);})[_0x484e('0x13')](function(_0x16bae5){logger['error']('CreateCmHopperHistory',_0x16bae5['message'],_0x2b2c2f);_0x26f585(_0x3ec983[_0x484e('0x12')](0x1f4,_0x16bae5[_0x484e('0x11')]));});});};exports['AvgHandleTime']=function(_0x33b458){var _0x5d79f7=this;return new Promise(function(_0x37d025,_0x51ab1f){return db['CmHopperHistory']['findAll']({'raw':_0x33b458[_0x484e('0x17')]?_0x33b458[_0x484e('0x17')][_0x484e('0x18')]===undefined?!![]:![]:!![],'where':_0x33b458['options']?_0x33b458[_0x484e('0x17')]['where']||null:null,'attributes':[[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')]['literal'](_0x484e('0x1c')))),_0x484e('0x1d')],[db['sequelize']['fn'](_0x484e('0x1b'),db['sequelize']['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x1f')))),_0x484e('0x20')],[db[_0x484e('0x1a')]['fn']('COUNT',db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x21')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x484e('0x1a')]['fn'](_0x484e('0x22'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x23')))),_0x484e('0x24')],[db['sequelize']['fn'](_0x484e('0x22'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x25')))),'predictiveIntervalAvgTalktime']]})[_0x484e('0x19')](function(_0x4fc7da){logger['info'](_0x484e('0x26'),_0x33b458);logger[_0x484e('0xd')](_0x484e('0x26'),_0x33b458,JSON[_0x484e('0x10')](_0x4fc7da));_0x37d025(_0x4fc7da);})['catch'](function(_0x1b88cc){logger[_0x484e('0x12')]('AvgHandleTime',_0x1b88cc[_0x484e('0x11')],_0x33b458);_0x51ab1f(_0x5d79f7['error'](0x1f4,_0x1b88cc[_0x484e('0x11')]));});});};exports[_0x484e('0x27')]=function(_0x79a3de){var _0x5b8dc=this;return new Promise(function(_0x42daaa,_0xbe32c1){return db[_0x484e('0x15')]['findAll']({'raw':_0x79a3de[_0x484e('0x17')]?_0x79a3de[_0x484e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x79a3de['options']?_0x79a3de['options'][_0x484e('0x28')]||null:null,'attributes':[[_0x484e('0x29'),'name'],[db[_0x484e('0x1a')]['fn']('COUNT',db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x2a')))),_0x484e('0x2b')],[db[_0x484e('0x1a')]['fn']('COUNT',db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x2c')))),_0x484e('0x2d')],[db[_0x484e('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x1c')))),_0x484e('0x2e')],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')]('`state`\x20=\x205,\x201,\x20null'))),_0x484e('0x2f')],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x30')))),'outboundCongestionCallsDay'],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db['sequelize']['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x31')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x32')))),_0x484e('0x33')],[db['sequelize']['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x34')))),_0x484e('0x35')],[db['sequelize']['fn']('COUNT',db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')]['literal'](_0x484e('0x36')))),_0x484e('0x37')],[db[_0x484e('0x1a')]['fn']('COUNT',db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x38')))),_0x484e('0x39')],[db[_0x484e('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x3a')))),_0x484e('0x3b')],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')][_0x484e('0x1e')](_0x484e('0x3c')))),_0x484e('0x3d')],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0x484e('0x1e')](_0x484e('0x3e')))),_0x484e('0x3b')],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x484e('0x3f')]],'group':[_0x484e('0x29')]})[_0x484e('0x19')](function(_0x3d7a2d){logger[_0x484e('0x40')](_0x484e('0x27'),_0x79a3de);logger[_0x484e('0xd')](_0x484e('0x27'),_0x79a3de,JSON[_0x484e('0x10')](_0x3d7a2d));_0x42daaa(_0x3d7a2d);})[_0x484e('0x13')](function(_0x52ce6f){logger[_0x484e('0x12')](_0x484e('0x27'),_0x52ce6f[_0x484e('0x11')],_0x79a3de);_0xbe32c1(_0x5b8dc[_0x484e('0x12')](0x1f4,_0x52ce6f['message']));});});};exports[_0x484e('0x41')]=function(_0x5ea2b3){var _0x172cc0=this;return new Promise(function(_0x3353b2,_0x3174b1){return db[_0x484e('0x15')][_0x484e('0x42')]({'raw':_0x5ea2b3[_0x484e('0x17')]?_0x5ea2b3[_0x484e('0x17')][_0x484e('0x18')]===undefined?!![]:![]:!![],'where':_0x5ea2b3[_0x484e('0x17')]?_0x5ea2b3[_0x484e('0x17')][_0x484e('0x28')]||null:null,'attributes':[[_0x484e('0x29'),'name'],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')][_0x484e('0x43')]('id')),'ivrTotalCallsDays'],[db[_0x484e('0x1a')]['fn'](_0x484e('0x1b'),db[_0x484e('0x1a')]['fn']('IF',db[_0x484e('0x1a')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x484e('0x44')]],'group':['campaign']})[_0x484e('0x19')](function(_0x16d8a0){logger['info'](_0x484e('0x41'),_0x5ea2b3);logger[_0x484e('0xd')]('GetCampaignHopperHistory',_0x5ea2b3,JSON['stringify'](_0x16d8a0));_0x3353b2(_0x16d8a0);})['catch'](function(_0x52789b){logger['error']('GetCampaignHopperHistory',_0x52789b[_0x484e('0x11')],_0x5ea2b3);_0x3174b1(_0x172cc0[_0x484e('0x12')](0x1f4,_0x52789b['message']));});});}; \ No newline at end of file +var _0xf247=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopperHistory','create','body','options','CreateCmHopperHistory','AvgHandleTime','findAll','raw','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','debug','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird'];(function(_0x588783,_0x550af0){var _0x146ed6=function(_0x27ffe9){while(--_0x27ffe9){_0x588783['push'](_0x588783['shift']());}};_0x146ed6(++_0x550af0);}(_0xf247,0x157));var _0x7f24=function(_0x4291dd,_0x95d82){_0x4291dd=_0x4291dd-0x0;var _0x152462=_0xf247[_0x4291dd];return _0x152462;};'use strict';var _=require('lodash');var util=require(_0x7f24('0x0'));var moment=require('moment');var BPromise=require(_0x7f24('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f24('0x2'));var db=require(_0x7f24('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f24('0x4'))(_0x7f24('0x5'));var config=require(_0x7f24('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7f24('0x7')][_0x7f24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34a014,_0x1347cf,_0x4776ae){return new BPromise(function(_0x2b4d36,_0x3eb434){return client[_0x7f24('0x9')](_0x34a014,_0x4776ae)[_0x7f24('0xa')](function(_0x47a0c1){logger[_0x7f24('0xb')](_0x7f24('0xc'),_0x1347cf,_0x7f24('0xd'));logger['debug'](_0x7f24('0xe'),_0x1347cf,_0x7f24('0xd'),JSON[_0x7f24('0xf')](_0x47a0c1));if(_0x47a0c1[_0x7f24('0x10')]){if(_0x47a0c1['error']['code']===0x1f4){logger[_0x7f24('0x10')](_0x7f24('0xc'),_0x1347cf,_0x47a0c1[_0x7f24('0x10')]['message']);return _0x3eb434(_0x47a0c1[_0x7f24('0x10')][_0x7f24('0x11')]);}logger['error'](_0x7f24('0xc'),_0x1347cf,_0x47a0c1['error'][_0x7f24('0x11')]);return _0x2b4d36(_0x47a0c1[_0x7f24('0x10')][_0x7f24('0x11')]);}else{logger[_0x7f24('0xb')](_0x7f24('0xc'),_0x1347cf,_0x7f24('0xd'));_0x2b4d36(_0x47a0c1[_0x7f24('0x12')][_0x7f24('0x11')]);}})[_0x7f24('0x13')](function(_0x41f3b2){logger[_0x7f24('0x10')](_0x7f24('0xc'),_0x1347cf,_0x41f3b2);_0x3eb434(_0x41f3b2);});});}exports['CreateCmHopperHistory']=function(_0x4a2c2f){var _0x3d9607=this;return new Promise(function(_0x4f3b7c,_0x2d38e0){return db[_0x7f24('0x14')][_0x7f24('0x15')](_0x4a2c2f[_0x7f24('0x16')],{'raw':_0x4a2c2f[_0x7f24('0x17')]?_0x4a2c2f['options']['raw']===undefined?!![]:![]:!![]})[_0x7f24('0xa')](function(_0x43e2ac){logger[_0x7f24('0xb')]('CreateCmHopperHistory',_0x4a2c2f);logger['debug'](_0x7f24('0x18'),_0x4a2c2f,JSON['stringify'](_0x43e2ac));_0x4f3b7c(_0x43e2ac);})[_0x7f24('0x13')](function(_0x17c85a){logger[_0x7f24('0x10')](_0x7f24('0x18'),_0x17c85a[_0x7f24('0x11')],_0x4a2c2f);_0x2d38e0(_0x3d9607[_0x7f24('0x10')](0x1f4,_0x17c85a[_0x7f24('0x11')]));});});};exports[_0x7f24('0x19')]=function(_0x278fff){var _0x4fc944=this;return new Promise(function(_0x261c71,_0x38f3d8){return db[_0x7f24('0x14')][_0x7f24('0x1a')]({'raw':_0x278fff['options']?_0x278fff[_0x7f24('0x17')][_0x7f24('0x1b')]===undefined?!![]:![]:!![],'where':_0x278fff[_0x7f24('0x17')]?_0x278fff[_0x7f24('0x17')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')][_0x7f24('0x1e')]('id')),_0x7f24('0x1f')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x7f24('0x1d')]['fn']('COUNT',db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x22')))),_0x7f24('0x23')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x24')))),_0x7f24('0x25')],[db[_0x7f24('0x1d')]['fn']('AVG',db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x26')))),'predictiveIntervalAvgHoldtime'],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x27'),db['sequelize']['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x28')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x1379ad){logger['info'](_0x7f24('0x19'),_0x278fff);logger[_0x7f24('0x29')]('AvgHandleTime',_0x278fff,JSON[_0x7f24('0xf')](_0x1379ad));_0x261c71(_0x1379ad);})['catch'](function(_0x2cca6e){logger[_0x7f24('0x10')](_0x7f24('0x19'),_0x2cca6e['message'],_0x278fff);_0x38f3d8(_0x4fc944[_0x7f24('0x10')](0x1f4,_0x2cca6e['message']));});});};exports[_0x7f24('0x2a')]=function(_0x455155){var _0x5b2a3c=this;return new Promise(function(_0x5e3dbb,_0x140293){return db[_0x7f24('0x14')][_0x7f24('0x1a')]({'raw':_0x455155[_0x7f24('0x17')]?_0x455155[_0x7f24('0x17')][_0x7f24('0x1b')]===undefined?!![]:![]:!![],'where':_0x455155[_0x7f24('0x17')]?_0x455155[_0x7f24('0x17')]['where']||null:null,'attributes':[[_0x7f24('0x2b'),_0x7f24('0x2c')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db['sequelize']['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x7f24('0x2d')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7f24('0x2e')],[db['sequelize']['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x21')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db['sequelize'][_0x7f24('0x20')](_0x7f24('0x2f')))),_0x7f24('0x30')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0x7f24('0x31')],[db[_0x7f24('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x32')))),'outboundDropCallsDayTimeout'],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')]['literal'](_0x7f24('0x33')))),_0x7f24('0x34')],[db['sequelize']['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x35')))),_0x7f24('0x36')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x7f24('0x37')],[db['sequelize']['fn'](_0x7f24('0x1c'),db['sequelize']['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x38')))),_0x7f24('0x39')],[db[_0x7f24('0x1d')]['fn']('COUNT',db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x3a')))),_0x7f24('0x3b')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db[_0x7f24('0x1d')]['literal'](_0x7f24('0x3c')))),_0x7f24('0x3d')],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db['sequelize']['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x3e')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7f24('0x1d')][_0x7f24('0x20')](_0x7f24('0x3f')))),_0x7f24('0x40')]],'group':[_0x7f24('0x2b')]})[_0x7f24('0xa')](function(_0x1c613e){logger['info'](_0x7f24('0x2a'),_0x455155);logger['debug'](_0x7f24('0x2a'),_0x455155,JSON['stringify'](_0x1c613e));_0x5e3dbb(_0x1c613e);})['catch'](function(_0x5e208c){logger[_0x7f24('0x10')](_0x7f24('0x2a'),_0x5e208c[_0x7f24('0x11')],_0x455155);_0x140293(_0x5b2a3c[_0x7f24('0x10')](0x1f4,_0x5e208c['message']));});});};exports[_0x7f24('0x41')]=function(_0x1f6c7a){var _0x2dbb98=this;return new Promise(function(_0x572acf,_0x128015){return db[_0x7f24('0x14')]['findAll']({'raw':_0x1f6c7a[_0x7f24('0x17')]?_0x1f6c7a[_0x7f24('0x17')][_0x7f24('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f6c7a[_0x7f24('0x17')]?_0x1f6c7a[_0x7f24('0x17')][_0x7f24('0x42')]||null:null,'attributes':[[_0x7f24('0x2b'),'name'],[db[_0x7f24('0x1d')]['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')][_0x7f24('0x1e')]('id')),_0x7f24('0x43')],[db['sequelize']['fn'](_0x7f24('0x1c'),db[_0x7f24('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x7f24('0x44')]],'group':[_0x7f24('0x2b')]})[_0x7f24('0xa')](function(_0x58fd6d){logger[_0x7f24('0xb')](_0x7f24('0x41'),_0x1f6c7a);logger[_0x7f24('0x29')]('GetCampaignHopperHistory',_0x1f6c7a,JSON[_0x7f24('0xf')](_0x58fd6d));_0x572acf(_0x58fd6d);})['catch'](function(_0x4d61db){logger[_0x7f24('0x10')](_0x7f24('0x41'),_0x4d61db[_0x7f24('0x11')],_0x1f6c7a);_0x128015(_0x2dbb98[_0x7f24('0x10')](0x1f4,_0x4d61db[_0x7f24('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e10c3f8..df1afec 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 _0x7380=['/describe','/:id','isAuthenticated','show','create','update','util','path','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7380,0x172));var _0x0738=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x7380[_0x424a9a];return _0xa7831c;};'use strict';var multer=require('multer');var util=require(_0x0738('0x0'));var path=require(_0x0738('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0738('0x2')]();var auth=require(_0x0738('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0738('0x4'));var controller=require(_0x0738('0x5'));router[_0x0738('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0738('0x6')](_0x0738('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x0738('0x6')](_0x0738('0x8'),auth[_0x0738('0x9')](),controller[_0x0738('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0738('0xb')]);router['put'](_0x0738('0x8'),auth[_0x0738('0x9')](),controller[_0x0738('0xc')]);module['exports']=router; \ No newline at end of file +var _0x3f32=['multer','util','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x3cfb89,_0x2b2846){var _0x5bc464=function(_0x1ec13c){while(--_0x1ec13c){_0x3cfb89['push'](_0x3cfb89['shift']());}};_0x5bc464(++_0x2b2846);}(_0x3f32,0x87));var _0x23f3=function(_0x5103a4,_0x4b7f5c){_0x5103a4=_0x5103a4-0x0;var _0x4f99e0=_0x3f32[_0x5103a4];return _0x4f99e0;};'use strict';var multer=require(_0x23f3('0x0'));var util=require(_0x23f3('0x1'));var path=require('path');var timeout=require(_0x23f3('0x2'));var express=require(_0x23f3('0x3'));var router=express[_0x23f3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x23f3('0x5')]('/',auth[_0x23f3('0x6')](),controller[_0x23f3('0x7')]);router[_0x23f3('0x5')](_0x23f3('0x8'),auth[_0x23f3('0x6')](),controller[_0x23f3('0x9')]);router['get'](_0x23f3('0xa'),auth[_0x23f3('0x6')](),controller[_0x23f3('0xb')]);router[_0x23f3('0xc')]('/',auth[_0x23f3('0x6')](),controller['create']);router[_0x23f3('0xd')](_0x23f3('0xa'),auth[_0x23f3('0x6')](),controller[_0x23f3('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index d245f6c..8c62af3 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 _0x7067=['STRING','name','sequelize'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7067,0xf2));var _0x7706=function(_0x221744,_0x575a67){_0x221744=_0x221744-0x0;var _0x233c41=_0x7067[_0x221744];return _0x233c41;};'use strict';var Sequelize=require(_0x7706('0x0'));module['exports']={'name':{'type':Sequelize[_0x7706('0x1')],'unique':_0x7706('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7706('0x1')]},'dialPrefix':{'type':Sequelize[_0x7706('0x1')]}}; \ No newline at end of file +var _0xa6c4=['sequelize','exports','STRING','name'];(function(_0x2b33a6,_0x4bef3f){var _0x245ac8=function(_0x231785){while(--_0x231785){_0x2b33a6['push'](_0x2b33a6['shift']());}};_0x245ac8(++_0x4bef3f);}(_0xa6c4,0x1cc));var _0x4a6c=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xa6c4[_0x5cbf0e];return _0x1c76f8;};'use strict';var Sequelize=require(_0x4a6c('0x0'));module[_0x4a6c('0x1')]={'name':{'type':Sequelize[_0x4a6c('0x2')],'unique':_0x4a6c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4a6c('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2ae1afa..6d29d4a 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 _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0xaff18,_0x4057b1){var _0x5f5a2f=function(_0x143e5f){while(--_0x143e5f){_0xaff18['push'](_0xaff18['shift']());}};_0x5f5a2f(++_0x4057b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x525d18,_0x28770d){var _0x2cb12e=function(_0x31ebea){while(--_0x31ebea){_0x525d18['push'](_0x525d18['shift']());}};_0x2cb12e(++_0x28770d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e8e38b6..e8e5e6e 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 _0xb99c=['CmList','setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0xb99c,0x11e));var _0xcb99=function(_0x48f5cd,_0x5bfd9e){_0x48f5cd=_0x48f5cd-0x0;var _0x382317=_0xb99c[_0x48f5cd];return _0x382317;};'use strict';var EventEmitter=require(_0xcb99('0x0'));var CmList=require(_0xcb99('0x1'))['db'][_0xcb99('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xcb99('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc397cd){return function(_0x3a3cf1,_0x3cc88e,_0x463aab){CmListEvents[_0xcb99('0x4')](_0xc397cd+':'+_0x3a3cf1['id'],_0x3a3cf1);CmListEvents['emit'](_0xc397cd,_0x3a3cf1);_0x463aab(null);};}for(var e in events){if(events[_0xcb99('0x5')](e)){var event=events[e];CmList[_0xcb99('0x6')](e,emitEvent(event));}}module[_0xcb99('0x7')]=CmListEvents; \ No newline at end of file +var _0x4056=['hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x11f8ff,_0x1cd51a){var _0x26c793=function(_0x59de80){while(--_0x59de80){_0x11f8ff['push'](_0x11f8ff['shift']());}};_0x26c793(++_0x1cd51a);}(_0x4056,0x113));var _0x6405=function(_0xb32c3f,_0x3fff3b){_0xb32c3f=_0xb32c3f-0x0;var _0x55eb6e=_0x4056[_0xb32c3f];return _0x55eb6e;};'use strict';var EventEmitter=require('events');var CmList=require(_0x6405('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x6405('0x1')](0x0);var events={'afterCreate':_0x6405('0x2'),'afterUpdate':'update','afterDestroy':_0x6405('0x3')};function emitEvent(_0x5eddda){return function(_0x354f9f,_0x253289,_0x247d75){CmListEvents[_0x6405('0x4')](_0x5eddda+':'+_0x354f9f['id'],_0x354f9f);CmListEvents['emit'](_0x5eddda,_0x354f9f);_0x247d75(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x6405('0x5')](e,emitEvent(event));}}module[_0x6405('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index fc514b4..b05fa03 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 _0x786b=['CmList','cm_lists','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define'];(function(_0x475bc3,_0x274e38){var _0x2494ee=function(_0x590138){while(--_0x590138){_0x475bc3['push'](_0x475bc3['shift']());}};_0x2494ee(++_0x274e38);}(_0x786b,0x154));var _0xb786=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x786b[_0x243217];return _0x478029;};'use strict';var _=require(_0xb786('0x0'));var util=require(_0xb786('0x1'));var logger=require('../../config/logger')(_0xb786('0x2'));var moment=require(_0xb786('0x3'));var BPromise=require(_0xb786('0x4'));var rp=require(_0xb786('0x5'));var fs=require('fs');var path=require(_0xb786('0x6'));var rimraf=require(_0xb786('0x7'));var config=require(_0xb786('0x8'));var attributes=require(_0xb786('0x9'));module['exports']=function(_0x4dc9b2,_0x4d72df){return _0x4dc9b2[_0xb786('0xa')](_0xb786('0xb'),attributes,{'tableName':_0xb786('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a65=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x16fa72,_0x445de7){var _0x2679da=function(_0x80781e){while(--_0x80781e){_0x16fa72['push'](_0x16fa72['shift']());}};_0x2679da(++_0x445de7);}(_0x0a65,0x6c));var _0x50a6=function(_0x1dae90,_0x1fa510){_0x1dae90=_0x1dae90-0x0;var _0x35ecce=_0x0a65[_0x1dae90];return _0x35ecce;};'use strict';var _=require(_0x50a6('0x0'));var util=require(_0x50a6('0x1'));var logger=require(_0x50a6('0x2'))(_0x50a6('0x3'));var moment=require(_0x50a6('0x4'));var BPromise=require(_0x50a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50a6('0x6'));var rimraf=require(_0x50a6('0x7'));var config=require(_0x50a6('0x8'));var attributes=require(_0x50a6('0x9'));module['exports']=function(_0x4ec841,_0x4c4f49){return _0x4ec841[_0x50a6('0xa')]('CmList',attributes,{'tableName':_0x50a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 24fe6c6..b48db7e 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 _0xec6f=['stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xec6f,0x93));var _0xfec6=function(_0x154854,_0x2af4a0){_0x154854=_0x154854-0x0;var _0x2d3f87=_0xec6f[_0x154854];return _0x2d3f87;};'use strict';var _=require('lodash');var util=require(_0xfec6('0x0'));var moment=require(_0xfec6('0x1'));var BPromise=require(_0xfec6('0x2'));var rs=require(_0xfec6('0x3'));var fs=require('fs');var Redis=require(_0xfec6('0x4'));var db=require(_0xfec6('0x5'))['db'];var utils=require(_0xfec6('0x6'));var logger=require(_0xfec6('0x7'))(_0xfec6('0x8'));var config=require(_0xfec6('0x9'));var jayson=require(_0xfec6('0xa'));var client=jayson[_0xfec6('0xb')]['http']({'port':0x232a});config[_0xfec6('0xc')]=_['defaults'](config['redis'],{'host':_0xfec6('0xd'),'port':0x18eb});var socket=require(_0xfec6('0xe'))(new Redis(config['redis']));require('./cmList.socket')[_0xfec6('0xf')](socket);function respondWithRpcPromise(_0x25b9bd,_0x4b578a,_0x3388f6){return new BPromise(function(_0x1388e6,_0x51de7e){return client[_0xfec6('0x10')](_0x25b9bd,_0x3388f6)[_0xfec6('0x11')](function(_0x1fd9fb){logger['info'](_0xfec6('0x12'),_0x4b578a,_0xfec6('0x13'));logger[_0xfec6('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x4b578a,'request\x20sent',JSON[_0xfec6('0x15')](_0x1fd9fb));if(_0x1fd9fb[_0xfec6('0x16')]){if(_0x1fd9fb['error'][_0xfec6('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x4b578a,_0x1fd9fb['error']['message']);return _0x51de7e(_0x1fd9fb['error'][_0xfec6('0x18')]);}logger[_0xfec6('0x16')](_0xfec6('0x12'),_0x4b578a,_0x1fd9fb[_0xfec6('0x16')][_0xfec6('0x18')]);return _0x1388e6(_0x1fd9fb[_0xfec6('0x16')][_0xfec6('0x18')]);}else{logger[_0xfec6('0x19')](_0xfec6('0x12'),_0x4b578a,'request\x20sent');_0x1388e6(_0x1fd9fb[_0xfec6('0x1a')][_0xfec6('0x18')]);}})[_0xfec6('0x1b')](function(_0x56d833){logger['error']('CmList,\x20%s,\x20%s',_0x4b578a,_0x56d833);_0x51de7e(_0x56d833);});});} \ No newline at end of file +var _0x3ec4=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','then','info','CmList,\x20%s,\x20%s'];(function(_0xe31599,_0xfc3a7e){var _0x13fa5e=function(_0x44d78f){while(--_0x44d78f){_0xe31599['push'](_0xe31599['shift']());}};_0x13fa5e(++_0xfc3a7e);}(_0x3ec4,0x174));var _0x43ec=function(_0x5c7eae,_0x27dbb4){_0x5c7eae=_0x5c7eae-0x0;var _0x327c0f=_0x3ec4[_0x5c7eae];return _0x327c0f;};'use strict';var _=require('lodash');var util=require(_0x43ec('0x0'));var moment=require(_0x43ec('0x1'));var BPromise=require(_0x43ec('0x2'));var rs=require(_0x43ec('0x3'));var fs=require('fs');var Redis=require(_0x43ec('0x4'));var db=require(_0x43ec('0x5'))['db'];var utils=require(_0x43ec('0x6'));var logger=require(_0x43ec('0x7'))(_0x43ec('0x8'));var config=require(_0x43ec('0x9'));var jayson=require(_0x43ec('0xa'));var client=jayson['client'][_0x43ec('0xb')]({'port':0x232a});config[_0x43ec('0xc')]=_[_0x43ec('0xd')](config[_0x43ec('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43ec('0xc')]));require('./cmList.socket')[_0x43ec('0xe')](socket);function respondWithRpcPromise(_0x541837,_0x19f144,_0x3428a4){return new BPromise(function(_0x17555b,_0x5a5cad){return client['request'](_0x541837,_0x3428a4)[_0x43ec('0xf')](function(_0x35af9d){logger[_0x43ec('0x10')](_0x43ec('0x11'),_0x19f144,_0x43ec('0x12'));logger[_0x43ec('0x13')](_0x43ec('0x14'),_0x19f144,_0x43ec('0x12'),JSON[_0x43ec('0x15')](_0x35af9d));if(_0x35af9d['error']){if(_0x35af9d[_0x43ec('0x16')][_0x43ec('0x17')]===0x1f4){logger[_0x43ec('0x16')](_0x43ec('0x11'),_0x19f144,_0x35af9d[_0x43ec('0x16')][_0x43ec('0x18')]);return _0x5a5cad(_0x35af9d['error'][_0x43ec('0x18')]);}logger[_0x43ec('0x16')](_0x43ec('0x11'),_0x19f144,_0x35af9d[_0x43ec('0x16')]['message']);return _0x17555b(_0x35af9d[_0x43ec('0x16')][_0x43ec('0x18')]);}else{logger['info'](_0x43ec('0x11'),_0x19f144,_0x43ec('0x12'));_0x17555b(_0x35af9d['result'][_0x43ec('0x18')]);}})[_0x43ec('0x19')](function(_0x461212){logger[_0x43ec('0x16')](_0x43ec('0x11'),_0x19f144,_0x461212);_0x5a5cad(_0x461212);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7eca957..4920a35 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd634=['remove','removeListener','register','length','save'];(function(_0x59334a,_0x4ba158){var _0x277642=function(_0x54b2b8){while(--_0x54b2b8){_0x59334a['push'](_0x59334a['shift']());}};_0x277642(++_0x4ba158);}(_0xd634,0xf4));var _0x4d63=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0xd634[_0x53c256];return _0x25feb6;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x4d63('0x0'),_0x4d63('0x1'),'update'];function createListener(_0x4b0edc,_0x2034ac){return function(_0x42e27c){_0x2034ac['emit'](_0x4b0edc,_0x42e27c);};}function removeListener(_0x4f99ac,_0x2b8d62){return function(){CmListEvents[_0x4d63('0x2')](_0x4f99ac,_0x2b8d62);};}exports[_0x4d63('0x3')]=function(_0x3b573c){for(var _0x3f188d=0x0,_0x381601=events[_0x4d63('0x4')];_0x3f188d<_0x381601;_0x3f188d++){var _0x6a60f4=events[_0x3f188d];var _0x49c1da=createListener('cmList:'+_0x6a60f4,_0x3b573c);CmListEvents['on'](_0x6a60f4,_0x49c1da);}}; \ No newline at end of file +var _0x1883=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0xd91c92,_0x511a0b){var _0x4d82dd=function(_0x1f81c1){while(--_0x1f81c1){_0xd91c92['push'](_0xd91c92['shift']());}};_0x4d82dd(++_0x511a0b);}(_0x1883,0xab));var _0x3188=function(_0x5cc949,_0x9de31c){_0x5cc949=_0x5cc949-0x0;var _0x67afa9=_0x1883[_0x5cc949];return _0x67afa9;};'use strict';var CmListEvents=require(_0x3188('0x0'));var events=[_0x3188('0x1'),_0x3188('0x2'),_0x3188('0x3')];function createListener(_0x11e3bf,_0x7ce655){return function(_0x2551e5){_0x7ce655[_0x3188('0x4')](_0x11e3bf,_0x2551e5);};}function removeListener(_0x1c7c86,_0x44afb8){return function(){CmListEvents[_0x3188('0x5')](_0x1c7c86,_0x44afb8);};}exports[_0x3188('0x6')]=function(_0x408ae0){for(var _0x33b62d=0x0,_0x24f2f1=events[_0x3188('0x7')];_0x33b62d<_0x24f2f1;_0x33b62d++){var _0x3e3afb=events[_0x33b62d];var _0x5c8f26=createListener(_0x3188('0x8')+_0x3e3afb,_0x408ae0);CmListEvents['on'](_0x3e3afb,_0x5c8f26);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f7de95b..68a8388 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1b10606..0cb962c 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0xca7920,_0x319f40){var _0x40012c=function(_0x3911eb){while(--_0x3911eb){_0xca7920['push'](_0xca7920['shift']());}};_0x40012c(++_0x319f40);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x4a6bbb,_0x13b5f6){var _0x36539d=function(_0x1629db){while(--_0x1629db){_0x4a6bbb['push'](_0x4a6bbb['shift']());}};_0x36539d(++_0x13b5f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 86e3da2..5f36113 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 _0xc54b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','then','destroy','error','stack','name','send','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','jsforce','desk.js','querystring'];(function(_0x4cab80,_0x1e1baf){var _0x5edbb2=function(_0x31a38a){while(--_0x31a38a){_0x4cab80['push'](_0x4cab80['shift']());}};_0x5edbb2(++_0x1e1baf);}(_0xc54b,0xa2));var _0xbc54=function(_0x533bcc,_0x1ba26f){_0x533bcc=_0x533bcc-0x0;var _0x364d38=_0xc54b[_0x533bcc];return _0x364d38;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbc54('0x0'));var rimraf=require(_0xbc54('0x1'));var zipdir=require(_0xbc54('0x2'));var jsonpatch=require(_0xbc54('0x3'));var rp=require(_0xbc54('0x4'));var moment=require(_0xbc54('0x5'));var BPromise=require(_0xbc54('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbc54('0x7'));var sox=require(_0xbc54('0x8'));var csv=require(_0xbc54('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbc54('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbc54('0xb'));var deskjs=require(_0xbc54('0xc'));var toCsv=require(_0xbc54('0x9'));var querystring=require(_0xbc54('0xd'));var Papa=require(_0xbc54('0xe'));var Redis=require(_0xbc54('0xf'));var authService=require(_0xbc54('0x10'));var qs=require(_0xbc54('0x11'));var as=require(_0xbc54('0x12'));var hardwareService=require(_0xbc54('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbc54('0x14'));var config=require(_0xbc54('0x15'));var licenseUtil=require(_0xbc54('0x16'));var db=require(_0xbc54('0x17'))['db'];function respondWithStatusCode(_0x48c107,_0x77373d){_0x77373d=_0x77373d||0xcc;return function(_0x54cfdc){if(_0x54cfdc){return _0x48c107['sendStatus'](_0x77373d);}return _0x48c107[_0xbc54('0x18')](_0x77373d)[_0xbc54('0x19')]();};}function respondWithResult(_0x55dc22,_0x336a75){_0x336a75=_0x336a75||0xc8;return function(_0x3a5e53){if(_0x3a5e53){return _0x55dc22[_0xbc54('0x18')](_0x336a75)[_0xbc54('0x1a')](_0x3a5e53);}};}function respondWithFilteredResult(_0x3763ab,_0x1a5b26){return function(_0x397dee){if(_0x397dee){var _0x40f6e0=_0x397dee[_0xbc54('0x1b')],_0x27506b=_0x1a5b26[_0xbc54('0x1c')],_0x435d03=_0x1a5b26['offset']+_0x1a5b26[_0xbc54('0x1d')],_0x3333d4;if(_0x435d03>=_0x40f6e0){_0x435d03=_0x40f6e0;_0x3333d4=0xc8;}else{_0x3333d4=0xce;}_0x3763ab[_0xbc54('0x18')](_0x3333d4);return _0x3763ab[_0xbc54('0x1e')]('Content-Range',_0x27506b+'-'+_0x435d03+'/'+_0x40f6e0)[_0xbc54('0x1a')](_0x397dee);}return null;};}function patchUpdates(_0x4b12c9){return function(_0x4c27a5){try{jsonpatch['apply'](_0x4c27a5,_0x4b12c9,!![]);}catch(_0x3efab4){return BPromise[_0xbc54('0x1f')](_0x3efab4);}return _0x4c27a5[_0xbc54('0x20')]();};}function saveUpdates(_0x479e2e,_0x301621){return function(_0xcc88c1){if(_0xcc88c1){return _0xcc88c1['update'](_0x479e2e)[_0xbc54('0x21')](function(_0x3f365b){return _0x3f365b;});}return null;};}function removeEntity(_0x2f191e,_0x1c8094){return function(_0x2ba530){if(_0x2ba530){return _0x2ba530[_0xbc54('0x22')]()[_0xbc54('0x21')](function(){_0x2f191e[_0xbc54('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54465c,_0x1d9f3e){return function(_0x2f285e){if(!_0x2f285e){_0x54465c['sendStatus'](0x194);}return _0x2f285e;};}function handleError(_0x358f93,_0xa5adf8){_0xa5adf8=_0xa5adf8||0x1f4;return function(_0xad5620){logger[_0xbc54('0x23')](_0xad5620[_0xbc54('0x24')]);if(_0xad5620['name']){delete _0xad5620[_0xbc54('0x25')];}_0x358f93[_0xbc54('0x18')](_0xa5adf8)[_0xbc54('0x26')](_0xad5620);};}exports['update']=function(_0x3fc863,_0x23f60f){if(_0x3fc863[_0xbc54('0x27')]['id']){delete _0x3fc863[_0xbc54('0x27')]['id'];}return db[_0xbc54('0x28')][_0xbc54('0x29')]({'where':{'id':_0x3fc863[_0xbc54('0x2a')]['id']}})[_0xbc54('0x21')](handleEntityNotFound(_0x23f60f,null))[_0xbc54('0x21')](saveUpdates(_0x3fc863['body'],null))['then'](respondWithResult(_0x23f60f,null))['catch'](handleError(_0x23f60f,null));};exports[_0xbc54('0x22')]=function(_0x162254,_0x5b3c90){return db[_0xbc54('0x28')][_0xbc54('0x29')]({'where':{'id':_0x162254[_0xbc54('0x2a')]['id']}})[_0xbc54('0x21')](handleEntityNotFound(_0x5b3c90,null))['then'](removeEntity(_0x5b3c90,null))[_0xbc54('0x2b')](handleError(_0x5b3c90,null));}; \ No newline at end of file +var _0x665e=['set','Content-Range','apply','save','update','then','error','stack','body','Condition','find','catch','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x5effad,_0x2065ce){var _0x1b3240=function(_0x323e30){while(--_0x323e30){_0x5effad['push'](_0x5effad['shift']());}};_0x1b3240(++_0x2065ce);}(_0x665e,0x1b2));var _0xe665=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x665e[_0x27530d];return _0x59e561;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe665('0x0'));var zipdir=require(_0xe665('0x1'));var jsonpatch=require(_0xe665('0x2'));var rp=require(_0xe665('0x3'));var moment=require(_0xe665('0x4'));var BPromise=require(_0xe665('0x5'));var Mustache=require(_0xe665('0x6'));var util=require(_0xe665('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe665('0x8'));var fs=require('fs');var _=require(_0xe665('0x9'));var squel=require(_0xe665('0xa'));var crypto=require(_0xe665('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe665('0xc'));var toCsv=require(_0xe665('0xd'));var querystring=require('querystring');var Papa=require(_0xe665('0xe'));var Redis=require(_0xe665('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe665('0x10'));var as=require(_0xe665('0x11'));var hardwareService=require(_0xe665('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe665('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe665('0x14'));var db=require(_0xe665('0x15'))['db'];function respondWithStatusCode(_0x50bff6,_0x34eadb){_0x34eadb=_0x34eadb||0xcc;return function(_0x1bb0da){if(_0x1bb0da){return _0x50bff6[_0xe665('0x16')](_0x34eadb);}return _0x50bff6[_0xe665('0x17')](_0x34eadb)[_0xe665('0x18')]();};}function respondWithResult(_0x3de519,_0x296e4d){_0x296e4d=_0x296e4d||0xc8;return function(_0x54566a){if(_0x54566a){return _0x3de519['status'](_0x296e4d)['json'](_0x54566a);}};}function respondWithFilteredResult(_0x1fcf89,_0x2af073){return function(_0x140da2){if(_0x140da2){var _0x2d34fc=_0x140da2[_0xe665('0x19')],_0x9fcf11=_0x2af073[_0xe665('0x1a')],_0x4e1360=_0x2af073[_0xe665('0x1a')]+_0x2af073[_0xe665('0x1b')],_0x49e970;if(_0x4e1360>=_0x2d34fc){_0x4e1360=_0x2d34fc;_0x49e970=0xc8;}else{_0x49e970=0xce;}_0x1fcf89[_0xe665('0x17')](_0x49e970);return _0x1fcf89[_0xe665('0x1c')](_0xe665('0x1d'),_0x9fcf11+'-'+_0x4e1360+'/'+_0x2d34fc)['json'](_0x140da2);}return null;};}function patchUpdates(_0x12151d){return function(_0x5541e2){try{jsonpatch[_0xe665('0x1e')](_0x5541e2,_0x12151d,!![]);}catch(_0x3a0b54){return BPromise['reject'](_0x3a0b54);}return _0x5541e2[_0xe665('0x1f')]();};}function saveUpdates(_0x454323,_0x553fb7){return function(_0x3925ce){if(_0x3925ce){return _0x3925ce[_0xe665('0x20')](_0x454323)[_0xe665('0x21')](function(_0x5b2af4){return _0x5b2af4;});}return null;};}function removeEntity(_0x6ba2c,_0x30b04){return function(_0x1d9e8b){if(_0x1d9e8b){return _0x1d9e8b['destroy']()['then'](function(){_0x6ba2c[_0xe665('0x17')](0xcc)[_0xe665('0x18')]();});}};}function handleEntityNotFound(_0x3ae3b,_0x5b8d13){return function(_0xd75598){if(!_0xd75598){_0x3ae3b[_0xe665('0x16')](0x194);}return _0xd75598;};}function handleError(_0x30dca5,_0x2c43db){_0x2c43db=_0x2c43db||0x1f4;return function(_0x2303af){logger[_0xe665('0x22')](_0x2303af[_0xe665('0x23')]);if(_0x2303af['name']){delete _0x2303af['name'];}_0x30dca5[_0xe665('0x17')](_0x2c43db)['send'](_0x2303af);};}exports[_0xe665('0x20')]=function(_0x3b09ab,_0x3f8178){if(_0x3b09ab['body']['id']){delete _0x3b09ab[_0xe665('0x24')]['id'];}return db[_0xe665('0x25')][_0xe665('0x26')]({'where':{'id':_0x3b09ab['params']['id']}})[_0xe665('0x21')](handleEntityNotFound(_0x3f8178,null))[_0xe665('0x21')](saveUpdates(_0x3b09ab['body'],null))[_0xe665('0x21')](respondWithResult(_0x3f8178,null))[_0xe665('0x27')](handleError(_0x3f8178,null));};exports[_0xe665('0x28')]=function(_0xbd8609,_0x2dc266){return db[_0xe665('0x25')][_0xe665('0x26')]({'where':{'id':_0xbd8609[_0xe665('0x29')]['id']}})['then'](handleEntityNotFound(_0x2dc266,null))['then'](removeEntity(_0x2dc266,null))[_0xe665('0x27')](handleError(_0x2dc266,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9fd6969..0840f53 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 _0xa6fa=['./condition.attributes','Condition','tools_conditions','lodash','../../config/logger','moment','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa6fa,0x10b));var _0xaa6f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa6fa[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xaa6f('0x0'));var util=require('util');var logger=require(_0xaa6f('0x1'))('api');var moment=require(_0xaa6f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa6f('0x3'));var rimraf=require(_0xaa6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xaa6f('0x5'));module['exports']=function(_0x386935,_0x5cbaee){return _0x386935['define'](_0xaa6f('0x6'),attributes,{'tableName':_0xaa6f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde2b=['lodash','../../config/logger','moment','request-promise','path','../../config/environment','define'];(function(_0x451e21,_0x44c27f){var _0x12b7bf=function(_0x4bcbe7){while(--_0x4bcbe7){_0x451e21['push'](_0x451e21['shift']());}};_0x12b7bf(++_0x44c27f);}(_0xde2b,0xf5));var _0xbde2=function(_0x2e5ba1,_0x54d106){_0x2e5ba1=_0x2e5ba1-0x0;var _0x1d3381=_0xde2b[_0x2e5ba1];return _0x1d3381;};'use strict';var _=require(_0xbde2('0x0'));var util=require('util');var logger=require(_0xbde2('0x1'))('api');var moment=require(_0xbde2('0x2'));var BPromise=require('bluebird');var rp=require(_0xbde2('0x3'));var fs=require('fs');var path=require(_0xbde2('0x4'));var rimraf=require('rimraf');var config=require(_0xbde2('0x5'));var attributes=require('./condition.attributes');module['exports']=function(_0x6e9d61,_0x554a80){return _0x6e9d61[_0xbde2('0x6')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 027bb2d..a1ce854 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 _0x730a=['message','result','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x310754,_0x5ed23b){var _0x386c18=function(_0xe4951b){while(--_0xe4951b){_0x310754['push'](_0x310754['shift']());}};_0x386c18(++_0x5ed23b);}(_0x730a,0x1dd));var _0xa730=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x730a[_0x5ad190];return _0x518ed3;};'use strict';var _=require('lodash');var util=require(_0xa730('0x0'));var moment=require(_0xa730('0x1'));var BPromise=require(_0xa730('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa730('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa730('0x4'));var config=require(_0xa730('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa730('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x185296,_0x1d5a86,_0xc6d8c7){return new BPromise(function(_0x2d92f9,_0x2a3133){return client[_0xa730('0x7')](_0x185296,_0xc6d8c7)[_0xa730('0x8')](function(_0x40e61f){logger[_0xa730('0x9')](_0xa730('0xa'),_0x1d5a86,_0xa730('0xb'));logger[_0xa730('0xc')](_0xa730('0xd'),_0x1d5a86,_0xa730('0xb'),JSON[_0xa730('0xe')](_0x40e61f));if(_0x40e61f[_0xa730('0xf')]){if(_0x40e61f['error'][_0xa730('0x10')]===0x1f4){logger[_0xa730('0xf')]('Condition,\x20%s,\x20%s',_0x1d5a86,_0x40e61f[_0xa730('0xf')][_0xa730('0x11')]);return _0x2a3133(_0x40e61f['error'][_0xa730('0x11')]);}logger[_0xa730('0xf')]('Condition,\x20%s,\x20%s',_0x1d5a86,_0x40e61f[_0xa730('0xf')]['message']);return _0x2d92f9(_0x40e61f['error']['message']);}else{logger[_0xa730('0x9')](_0xa730('0xa'),_0x1d5a86,'request\x20sent');_0x2d92f9(_0x40e61f[_0xa730('0x12')][_0xa730('0x11')]);}})['catch'](function(_0x2c8498){logger['error'](_0xa730('0xa'),_0x1d5a86,_0x2c8498);_0x2a3133(_0x2c8498);});});} \ No newline at end of file +var _0x9fa1=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x509785,_0x2549be){var _0xb93458=function(_0x44bdc2){while(--_0x44bdc2){_0x509785['push'](_0x509785['shift']());}};_0xb93458(++_0x2549be);}(_0x9fa1,0x8d));var _0x19fa=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9fa1[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x19fa('0x0'));var util=require(_0x19fa('0x1'));var moment=require('moment');var BPromise=require(_0x19fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19fa('0x3'));var db=require(_0x19fa('0x4'))['db'];var utils=require(_0x19fa('0x5'));var logger=require(_0x19fa('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19fa('0x7')][_0x19fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256e98,_0x5949a1,_0x2b88ba){return new BPromise(function(_0x440ff4,_0x26b727){return client[_0x19fa('0x9')](_0x256e98,_0x2b88ba)[_0x19fa('0xa')](function(_0x4d607a){logger['info'](_0x19fa('0xb'),_0x5949a1,'request\x20sent');logger[_0x19fa('0xc')](_0x19fa('0xd'),_0x5949a1,_0x19fa('0xe'),JSON[_0x19fa('0xf')](_0x4d607a));if(_0x4d607a['error']){if(_0x4d607a[_0x19fa('0x10')][_0x19fa('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x5949a1,_0x4d607a[_0x19fa('0x10')][_0x19fa('0x12')]);return _0x26b727(_0x4d607a['error'][_0x19fa('0x12')]);}logger[_0x19fa('0x10')](_0x19fa('0xb'),_0x5949a1,_0x4d607a[_0x19fa('0x10')][_0x19fa('0x12')]);return _0x440ff4(_0x4d607a['error'][_0x19fa('0x12')]);}else{logger['info'](_0x19fa('0xb'),_0x5949a1,_0x19fa('0xe'));_0x440ff4(_0x4d607a[_0x19fa('0x13')][_0x19fa('0x12')]);}})['catch'](function(_0x45aa9a){logger[_0x19fa('0x10')]('Condition,\x20%s,\x20%s',_0x5949a1,_0x45aa9a);_0x26b727(_0x45aa9a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index af8aa1b..53176b4 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 _0x6703=['put','/:id','isAuthenticated','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x25ad58,_0x1b42c2){var _0x58d181=function(_0x1c0e93){while(--_0x1c0e93){_0x25ad58['push'](_0x25ad58['shift']());}};_0x58d181(++_0x1b42c2);}(_0x6703,0x1aa));var _0x3670=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x6703[_0x7cb10c];return _0x11df59;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3670('0x0'));var express=require(_0x3670('0x1'));var router=express['Router']();var auth=require(_0x3670('0x2'));var interaction=require(_0x3670('0x3'));var config=require(_0x3670('0x4'));var controller=require(_0x3670('0x5'));router[_0x3670('0x6')](_0x3670('0x7'),auth[_0x3670('0x8')](),controller['update']);router['delete'](_0x3670('0x7'),auth[_0x3670('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd877=['isAuthenticated','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x164048,_0x56d704){var _0x5cda3e=function(_0x2082c1){while(--_0x2082c1){_0x164048['push'](_0x164048['shift']());}};_0x5cda3e(++_0x56d704);}(_0xd877,0xfe));var _0x7d87=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xd877[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x7d87('0x0'));var util=require(_0x7d87('0x1'));var path=require(_0x7d87('0x2'));var timeout=require('connect-timeout');var express=require(_0x7d87('0x3'));var router=express[_0x7d87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7d87('0x5'));var config=require(_0x7d87('0x6'));var controller=require(_0x7d87('0x7'));router[_0x7d87('0x8')](_0x7d87('0x9'),auth[_0x7d87('0xa')](),controller['update']);router['delete'](_0x7d87('0x9'),auth[_0x7d87('0xa')](),controller[_0x7d87('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index bbe3d07..11725b9 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 _0xb3a7=['STRING','sequelize'];(function(_0x5cad5f,_0x4017fa){var _0x4837d4=function(_0x1ec349){while(--_0x1ec349){_0x5cad5f['push'](_0x5cad5f['shift']());}};_0x4837d4(++_0x4017fa);}(_0xb3a7,0x1c5));var _0x7b3a=function(_0x1d4b06,_0x13a7c2){_0x1d4b06=_0x1d4b06-0x0;var _0x5ab6a5=_0xb3a7[_0x1d4b06];return _0x5ab6a5;};'use strict';var Sequelize=require(_0x7b3a('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b3a('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b3a('0x1')]}}; \ No newline at end of file +var _0xb2cb=['STRING','name','sequelize','exports'];(function(_0x13c164,_0xb1bae8){var _0x31e86a=function(_0x2fe1e2){while(--_0x2fe1e2){_0x13c164['push'](_0x13c164['shift']());}};_0x31e86a(++_0xb1bae8);}(_0xb2cb,0x8a));var _0xbb2c=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0xb2cb[_0x5ed54b];return _0x4b58c7;};'use strict';var Sequelize=require(_0xbb2c('0x0'));module[_0xbb2c('0x1')]={'name':{'type':Sequelize[_0xbb2c('0x2')],'allowNull':![],'unique':_0xbb2c('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 401b61c..3c56059 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 _0x6f51=['addItem','DashboardId','DashboardItem','getItems','findOne','order','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify'];(function(_0x49d88b,_0x2358eb){var _0x1260dc=function(_0x76c92f){while(--_0x76c92f){_0x49d88b['push'](_0x49d88b['shift']());}};_0x1260dc(++_0x2358eb);}(_0x6f51,0x17a));var _0x16f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f51[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x16f5('0x0'));var emlformat=require(_0x16f5('0x1'));var rimraf=require(_0x16f5('0x2'));var zipdir=require(_0x16f5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16f5('0x4'));var moment=require(_0x16f5('0x5'));var BPromise=require(_0x16f5('0x6'));var Mustache=require(_0x16f5('0x7'));var util=require(_0x16f5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x16f5('0x9'));var ejs=require(_0x16f5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16f5('0xb'));var jsforce=require(_0x16f5('0xc'));var deskjs=require(_0x16f5('0xd'));var toCsv=require(_0x16f5('0x9'));var querystring=require(_0x16f5('0xe'));var Papa=require(_0x16f5('0xf'));var Redis=require(_0x16f5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x16f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16f5('0x12'));var logger=require('../../config/logger')(_0x16f5('0x13'));var utils=require(_0x16f5('0x14'));var config=require(_0x16f5('0x15'));var licenseUtil=require(_0x16f5('0x16'));var db=require(_0x16f5('0x17'))['db'];config[_0x16f5('0x18')]=_[_0x16f5('0x19')](config[_0x16f5('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16f5('0x18')]));require(_0x16f5('0x1a'))['register'](socket);function respondWithStatusCode(_0x2c3fbe,_0x5ddd10){_0x5ddd10=_0x5ddd10||0xcc;return function(_0x572a23){if(_0x572a23){return _0x2c3fbe['sendStatus'](_0x5ddd10);}return _0x2c3fbe[_0x16f5('0x1b')](_0x5ddd10)[_0x16f5('0x1c')]();};}function respondWithResult(_0xb6d5a1,_0x38d076){_0x38d076=_0x38d076||0xc8;return function(_0xbde77a){if(_0xbde77a){return _0xb6d5a1['status'](_0x38d076)[_0x16f5('0x1d')](_0xbde77a);}};}function respondWithFilteredResult(_0x85b4a6,_0x54f885){return function(_0x36ba64){if(_0x36ba64){var _0x2845c0=_0x36ba64[_0x16f5('0x1e')],_0x588593=_0x54f885[_0x16f5('0x1f')],_0x2f90df=_0x54f885['offset']+_0x54f885['limit'],_0x2613af;if(_0x2f90df>=_0x2845c0){_0x2f90df=_0x2845c0;_0x2613af=0xc8;}else{_0x2613af=0xce;}_0x85b4a6[_0x16f5('0x1b')](_0x2613af);return _0x85b4a6[_0x16f5('0x20')](_0x16f5('0x21'),_0x588593+'-'+_0x2f90df+'/'+_0x2845c0)[_0x16f5('0x1d')](_0x36ba64);}return null;};}function patchUpdates(_0x51d971){return function(_0x1cf376){try{jsonpatch[_0x16f5('0x22')](_0x1cf376,_0x51d971,!![]);}catch(_0x2df6cf){return BPromise[_0x16f5('0x23')](_0x2df6cf);}return _0x1cf376[_0x16f5('0x24')]();};}function saveUpdates(_0x68b28e,_0x2d42df){return function(_0x2dd0f7){if(_0x2dd0f7){return _0x2dd0f7['update'](_0x68b28e)['then'](function(_0x36694a){return _0x36694a;});}return null;};}function removeEntity(_0x13961d,_0x55434d){return function(_0x4583ce){if(_0x4583ce){return _0x4583ce[_0x16f5('0x25')]()[_0x16f5('0x26')](function(){var _0x5b6279=_0x4583ce[_0x16f5('0x27')]({'plain':!![]});var _0x263b1f=_0x16f5('0x28');return db[_0x16f5('0x29')][_0x16f5('0x25')]({'where':{'type':_0x263b1f,'resourceId':_0x5b6279['id']}})['then'](function(){return _0x4583ce;});})[_0x16f5('0x26')](function(){_0x13961d[_0x16f5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93e2a5,_0x4d13ed){return function(_0x1f88a2){if(!_0x1f88a2){_0x93e2a5[_0x16f5('0x2a')](0x194);}return _0x1f88a2;};}function handleError(_0x22648f,_0x4198fa){_0x4198fa=_0x4198fa||0x1f4;return function(_0x5aa081){logger[_0x16f5('0x2b')](_0x5aa081[_0x16f5('0x2c')]);if(_0x5aa081['name']){delete _0x5aa081[_0x16f5('0x2d')];}_0x22648f['status'](_0x4198fa)[_0x16f5('0x2e')](_0x5aa081);};}exports[_0x16f5('0x2f')]=function(_0x50cecd,_0xe313c0){var _0x514c0f={},_0x56fd29={},_0x369af3={'count':0x0,'rows':[]};var _0x8ca436=_[_0x16f5('0x30')](db[_0x16f5('0x31')]['rawAttributes'],function(_0x3da816){return{'name':_0x3da816[_0x16f5('0x32')],'type':_0x3da816[_0x16f5('0x33')][_0x16f5('0x34')]};});_0x56fd29[_0x16f5('0x35')]=_[_0x16f5('0x30')](_0x8ca436,_0x16f5('0x2d'));_0x56fd29[_0x16f5('0x36')]=_[_0x16f5('0x37')](_0x50cecd['query']);_0x56fd29[_0x16f5('0x38')]=_['intersection'](_0x56fd29[_0x16f5('0x35')],_0x56fd29[_0x16f5('0x36')]);_0x514c0f['attributes']=_[_0x16f5('0x39')](_0x56fd29[_0x16f5('0x35')],qs[_0x16f5('0x3a')](_0x50cecd[_0x16f5('0x36')][_0x16f5('0x3a')]));_0x514c0f['attributes']=_0x514c0f[_0x16f5('0x3b')][_0x16f5('0x3c')]?_0x514c0f['attributes']:_0x56fd29['model'];if(!_0x50cecd[_0x16f5('0x36')][_0x16f5('0x3d')]('nolimit')){_0x514c0f[_0x16f5('0x3e')]=qs[_0x16f5('0x3e')](_0x50cecd[_0x16f5('0x36')][_0x16f5('0x3e')]);_0x514c0f[_0x16f5('0x1f')]=qs[_0x16f5('0x1f')](_0x50cecd[_0x16f5('0x36')][_0x16f5('0x1f')]);}_0x514c0f['order']=qs[_0x16f5('0x3f')](_0x50cecd[_0x16f5('0x36')]['sort']);_0x514c0f[_0x16f5('0x40')]=qs[_0x16f5('0x38')](_[_0x16f5('0x41')](_0x50cecd[_0x16f5('0x36')],_0x56fd29['filters']),_0x8ca436);if(_0x50cecd['query'][_0x16f5('0x42')]){_0x514c0f['where']=_[_0x16f5('0x43')](_0x514c0f[_0x16f5('0x40')],{'$or':_[_0x16f5('0x30')](_0x8ca436,function(_0x162f80){if(_0x162f80[_0x16f5('0x33')]!==_0x16f5('0x44')){var _0x32afef={};_0x32afef[_0x162f80[_0x16f5('0x2d')]]={'$like':'%'+_0x50cecd[_0x16f5('0x36')][_0x16f5('0x42')]+'%'};return _0x32afef;}})});}_0x514c0f=_[_0x16f5('0x43')]({},_0x514c0f,_0x50cecd['options']);var _0x24175c={'where':_0x514c0f[_0x16f5('0x40')]};return db['Dashboard'][_0x16f5('0x1e')](_0x24175c)['then'](function(_0x2618d8){_0x369af3[_0x16f5('0x1e')]=_0x2618d8;if(_0x50cecd[_0x16f5('0x36')][_0x16f5('0x45')]){_0x514c0f[_0x16f5('0x46')]=[{'all':!![]}];}return db[_0x16f5('0x31')][_0x16f5('0x47')](_0x514c0f);})[_0x16f5('0x26')](function(_0x5e0681){_0x369af3[_0x16f5('0x48')]=_0x5e0681;return _0x369af3;})[_0x16f5('0x26')](respondWithFilteredResult(_0xe313c0,_0x514c0f))[_0x16f5('0x49')](handleError(_0xe313c0,null));};exports[_0x16f5('0x4a')]=function(_0x5bd27d,_0x1c16e0){var _0x20aeda={'raw':![],'where':{'id':_0x5bd27d[_0x16f5('0x4b')]['id']}},_0x329d32={};_0x329d32[_0x16f5('0x35')]=_[_0x16f5('0x37')](db[_0x16f5('0x31')][_0x16f5('0x4c')]);_0x329d32[_0x16f5('0x36')]=_[_0x16f5('0x37')](_0x5bd27d[_0x16f5('0x36')]);_0x329d32[_0x16f5('0x38')]=_[_0x16f5('0x39')](_0x329d32['model'],_0x329d32[_0x16f5('0x36')]);_0x20aeda[_0x16f5('0x3b')]=_[_0x16f5('0x39')](_0x329d32[_0x16f5('0x35')],qs[_0x16f5('0x3a')](_0x5bd27d[_0x16f5('0x36')][_0x16f5('0x3a')]));_0x20aeda['attributes']=_0x20aeda[_0x16f5('0x3b')]['length']?_0x20aeda[_0x16f5('0x3b')]:_0x329d32['model'];if(_0x5bd27d['query'][_0x16f5('0x45')]){_0x20aeda[_0x16f5('0x46')]=[{'all':!![]}];}_0x20aeda=_[_0x16f5('0x43')]({},_0x20aeda,_0x5bd27d[_0x16f5('0x4d')]);return db['Dashboard'][_0x16f5('0x4e')](_0x20aeda)[_0x16f5('0x26')](handleEntityNotFound(_0x1c16e0,null))[_0x16f5('0x26')](respondWithResult(_0x1c16e0,null))[_0x16f5('0x49')](handleError(_0x1c16e0,null));};exports[_0x16f5('0x4f')]=function(_0x5a2cd2,_0x353ddf){return db[_0x16f5('0x31')]['create'](_0x5a2cd2[_0x16f5('0x50')],{})['then'](function(_0x156f96){var _0x17a86f=_0x5a2cd2[_0x16f5('0x51')][_0x16f5('0x27')]({'plain':!![]});if(!_0x17a86f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17a86f['role']===_0x16f5('0x51')){var _0x5786b2=_0x156f96[_0x16f5('0x27')]({'plain':!![]});var _0x5254db=_0x16f5('0x28');return db[_0x16f5('0x52')][_0x16f5('0x4e')]({'where':{'name':_0x5254db,'userProfileId':_0x17a86f[_0x16f5('0x53')]},'raw':!![]})[_0x16f5('0x26')](function(_0x4185d5){if(_0x4185d5&&_0x4185d5[_0x16f5('0x54')]===0x0){return db['UserProfileResource'][_0x16f5('0x4f')]({'name':_0x5786b2['name'],'resourceId':_0x5786b2['id'],'type':_0x4185d5['name'],'sectionId':_0x4185d5['id']},{})['then'](function(){return _0x156f96;});}else{return _0x156f96;}})[_0x16f5('0x49')](function(_0x382515){logger[_0x16f5('0x2b')](_0x16f5('0x55'),_0x382515);throw _0x382515;});}return _0x156f96;})[_0x16f5('0x26')](respondWithResult(_0x353ddf,0xc9))[_0x16f5('0x49')](handleError(_0x353ddf,null));};exports[_0x16f5('0x56')]=function(_0x2a134b,_0x3503a1){var _0x55fb1f={'where':{'id':_0x2a134b[_0x16f5('0x4b')]['id']}},_0x1302ce={};_0x1302ce[_0x16f5('0x35')]=_[_0x16f5('0x37')](db['Dashboard'][_0x16f5('0x4c')]);_0x55fb1f[_0x16f5('0x3b')]=_[_0x16f5('0x39')](_0x1302ce[_0x16f5('0x35')],qs[_0x16f5('0x3a')](_0x2a134b['query'][_0x16f5('0x3a')]));_0x55fb1f[_0x16f5('0x3b')]=_0x55fb1f[_0x16f5('0x3b')]['length']?_0x55fb1f['attributes']:_0x1302ce['model'];if(_0x2a134b[_0x16f5('0x36')][_0x16f5('0x45')]){_0x55fb1f[_0x16f5('0x46')]=[{'all':!![]}];}_0x55fb1f=_[_0x16f5('0x43')]({},_0x55fb1f,_0x2a134b[_0x16f5('0x4d')]);return db['Dashboard'][_0x16f5('0x4e')](_0x55fb1f)['then'](handleEntityNotFound(_0x3503a1,null))['then'](function(_0x43c89e){if(_0x43c89e){var _0x7fabbd=_0x43c89e[_0x16f5('0x27')]({'plain':!![]});_0x7fabbd=qs[_0x16f5('0x57')](_0x7fabbd,['id',_0x16f5('0x58'),'updatedAt']);_0x2a134b[_0x16f5('0x50')]=_[_0x16f5('0x57')](_0x2a134b[_0x16f5('0x50')],['id','createdAt',_0x16f5('0x59')]);return db[_0x16f5('0x31')][_0x16f5('0x4f')](_[_0x16f5('0x43')](_0x7fabbd,_0x2a134b[_0x16f5('0x50')]),{'include':_0x2a134b[_0x16f5('0x36')][_0x16f5('0x45')]?[{'all':!![]}]:undefined})[_0x16f5('0x26')](function(_0x6ef887){var _0xfaeae7=_0x2a134b[_0x16f5('0x51')][_0x16f5('0x27')]({'plain':!![]});if(!_0xfaeae7)throw new Error(_0x16f5('0x5a'));if(_0xfaeae7['role']===_0x16f5('0x51')){var _0x8d3b77=_0x6ef887[_0x16f5('0x27')]({'plain':!![]});var _0x2112aa='CustomDashboards';return db[_0x16f5('0x52')][_0x16f5('0x4e')]({'where':{'name':_0x2112aa,'userProfileId':_0xfaeae7[_0x16f5('0x53')]},'raw':!![]})[_0x16f5('0x26')](function(_0x36ab92){if(_0x36ab92&&_0x36ab92['autoAssociation']===0x0){return db[_0x16f5('0x29')][_0x16f5('0x4f')]({'name':_0x8d3b77[_0x16f5('0x2d')],'resourceId':_0x8d3b77['id'],'type':_0x36ab92['name'],'sectionId':_0x36ab92['id']},{})[_0x16f5('0x26')](function(){return _0x6ef887;});}else{return _0x6ef887;}})[_0x16f5('0x49')](function(_0x5eae45){logger[_0x16f5('0x2b')](_0x16f5('0x55'),_0x5eae45);throw _0x5eae45;});}return _0x6ef887;});}})[_0x16f5('0x26')](respondWithResult(_0x3503a1,0xc9))['catch'](handleError(_0x3503a1,null));};exports[_0x16f5('0x5b')]=function(_0x541a6a,_0x467e5f){if(_0x541a6a[_0x16f5('0x50')]['id']){delete _0x541a6a[_0x16f5('0x50')]['id'];}return db[_0x16f5('0x31')][_0x16f5('0x4e')]({'where':{'id':_0x541a6a['params']['id']}})[_0x16f5('0x26')](handleEntityNotFound(_0x467e5f,null))[_0x16f5('0x26')](saveUpdates(_0x541a6a[_0x16f5('0x50')],null))['then'](respondWithResult(_0x467e5f,null))[_0x16f5('0x49')](handleError(_0x467e5f,null));};exports[_0x16f5('0x25')]=function(_0x42777e,_0x1bd761){return db[_0x16f5('0x31')][_0x16f5('0x4e')]({'where':{'id':_0x42777e[_0x16f5('0x4b')]['id']}})[_0x16f5('0x26')](handleEntityNotFound(_0x1bd761,null))[_0x16f5('0x26')](removeEntity(_0x1bd761,null))[_0x16f5('0x49')](handleError(_0x1bd761,null));};function widgetAttributes(_0xd2ee3b){try{switch(_0xd2ee3b['type']){case _0x16f5('0x5c'):return[{'name':'attrUrl','value':_0xd2ee3b[_0x16f5('0x5d')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b['attrs'][0x0]?_0xd2ee3b[_0x16f5('0x5e')][0x0]['value']:undefined)||_0x16f5('0x5f')}];case'custom':return[{'name':_0x16f5('0x60'),'value':_0xd2ee3b[_0x16f5('0x60')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x0]?_0xd2ee3b['attrs'][0x0][_0x16f5('0x61')]:undefined)||''}];case _0x16f5('0x62'):return[{'name':_0x16f5('0x63'),'value':_0xd2ee3b['attrHourFormat']||(_0xd2ee3b['attrs']&&_0xd2ee3b[_0x16f5('0x5e')][0x0]?_0xd2ee3b[_0x16f5('0x5e')][0x0][_0x16f5('0x61')]:undefined)||_0x16f5('0x64')},{'name':_0x16f5('0x65'),'value':_0xd2ee3b['attrTimezone']||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x1]?_0xd2ee3b[_0x16f5('0x5e')][0x1][_0x16f5('0x61')]:undefined)||_0x16f5('0x66')},{'name':'attrFontSize','value':_0xd2ee3b[_0x16f5('0x67')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b['attrs'][0x2]?_0xd2ee3b[_0x16f5('0x5e')][0x2][_0x16f5('0x61')]:undefined)||0xc}];case _0x16f5('0x68'):return[{'name':_0x16f5('0x69'),'value':_0xd2ee3b[_0x16f5('0x69')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x0]?_0xd2ee3b[_0x16f5('0x5e')][0x0][_0x16f5('0x61')]:undefined)||_0x16f5('0x6a')},{'name':_0x16f5('0x6b'),'value':_0xd2ee3b['attrVoiceQueues']||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b['attrs'][0x1]?_0xd2ee3b[_0x16f5('0x5e')][0x1][_0x16f5('0x61')]:undefined)||[]},{'name':_0x16f5('0x67'),'value':_0xd2ee3b[_0x16f5('0x67')]||(_0xd2ee3b['attrs']&&_0xd2ee3b[_0x16f5('0x5e')][0x2]?_0xd2ee3b[_0x16f5('0x5e')][0x2][_0x16f5('0x61')]:undefined)||0x14}];case _0x16f5('0x6c'):case _0x16f5('0x6d'):return[{'name':_0x16f5('0x6e'),'value':_0xd2ee3b[_0x16f5('0x6e')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x0]?_0xd2ee3b[_0x16f5('0x5e')][0x0]['value']:undefined)||'total'},{'name':_0x16f5('0x6f'),'value':_0xd2ee3b['attrSerie2']||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x1]?_0xd2ee3b[_0x16f5('0x5e')][0x1][_0x16f5('0x61')]:undefined)||null},{'name':_0x16f5('0x70'),'value':_0xd2ee3b[_0x16f5('0x70')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x2]?_0xd2ee3b[_0x16f5('0x5e')][0x2][_0x16f5('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0xd2ee3b['attrVoiceQueues']||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x3]?_0xd2ee3b['attrs'][0x3][_0x16f5('0x61')]:undefined)||[]}];case _0x16f5('0x71'):return[{'name':_0x16f5('0x72'),'type':_0xd2ee3b[_0x16f5('0x73')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b[_0x16f5('0x5e')][0x0]?_0xd2ee3b[_0x16f5('0x5e')][0x0]['type']:undefined)||null,'value':_0xd2ee3b[_0x16f5('0x72')]||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b['attrs'][0x0]?_0xd2ee3b['attrs'][0x0][_0x16f5('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0xd2ee3b['attrRefresh']||(_0xd2ee3b[_0x16f5('0x5e')]&&_0xd2ee3b['attrs'][0x1]?_0xd2ee3b[_0x16f5('0x5e')][0x1][_0x16f5('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x52aef9){logger['error'](_0x16f5('0x74'),JSON[_0x16f5('0x75')](_0x52aef9));return[];}}exports[_0x16f5('0x76')]=function(_0x144a8f,_0x1afb22,_0x11e6bc){if(_0x144a8f[_0x16f5('0x50')]['id']){delete _0x144a8f[_0x16f5('0x50')]['id'];}return db[_0x16f5('0x31')]['find']({'where':{'id':_0x144a8f[_0x16f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1afb22,null))['then'](function(_0x2bd6a3){if(_0x2bd6a3){_0x144a8f[_0x16f5('0x50')][_0x16f5('0x77')]=_0x2bd6a3['id'];_0x144a8f[_0x16f5('0x50')]['attrs']=widgetAttributes(_0x144a8f[_0x16f5('0x50')]);return db[_0x16f5('0x78')][_0x16f5('0x4f')](_0x144a8f['body']);}})[_0x16f5('0x26')](respondWithResult(_0x1afb22,null))['catch'](handleError(_0x1afb22,null));};exports[_0x16f5('0x79')]=function(_0x205f2e,_0x173efe,_0x5617ce){var _0x37c740={};var _0x5141d4={};var _0x2eebdb;var _0x488520;return db[_0x16f5('0x31')][_0x16f5('0x7a')]({'where':{'id':_0x205f2e['params']['id']}})[_0x16f5('0x26')](handleEntityNotFound(_0x173efe,null))['then'](function(_0x5ad1d0){if(_0x5ad1d0){_0x2eebdb=_0x5ad1d0;_0x5141d4[_0x16f5('0x35')]=_[_0x16f5('0x37')](db[_0x16f5('0x78')][_0x16f5('0x4c')]);_0x5141d4[_0x16f5('0x36')]=_[_0x16f5('0x37')](_0x205f2e[_0x16f5('0x36')]);_0x5141d4[_0x16f5('0x38')]=_['intersection'](_0x5141d4[_0x16f5('0x35')],_0x5141d4[_0x16f5('0x36')]);_0x37c740['attributes']=_['intersection'](_0x5141d4['model'],qs[_0x16f5('0x3a')](_0x205f2e[_0x16f5('0x36')][_0x16f5('0x3a')]));_0x37c740[_0x16f5('0x3b')]=_0x37c740[_0x16f5('0x3b')]['length']?_0x37c740[_0x16f5('0x3b')]:_0x5141d4[_0x16f5('0x35')];_0x37c740[_0x16f5('0x7b')]=qs[_0x16f5('0x3f')](_0x205f2e['query'][_0x16f5('0x3f')]);_0x37c740['where']=qs[_0x16f5('0x38')](_['pick'](_0x205f2e[_0x16f5('0x36')],_0x5141d4[_0x16f5('0x38')]));if(_0x205f2e[_0x16f5('0x36')][_0x16f5('0x42')]){_0x37c740['where']=_['merge'](_0x37c740[_0x16f5('0x40')],{'$or':_[_0x16f5('0x30')](_0x37c740[_0x16f5('0x3b')],function(_0x5a9bb5){var _0xe57a35={};_0xe57a35[_0x5a9bb5]={'$like':'%'+_0x205f2e['query'][_0x16f5('0x42')]+'%'};return _0xe57a35;})});}_0x37c740=_['merge']({},_0x37c740,_0x205f2e[_0x16f5('0x4d')]);return _0x2eebdb[_0x16f5('0x79')](_0x37c740);}})['then'](function(_0x55bb87){if(_0x55bb87){_0x488520=_0x55bb87[_0x16f5('0x3c')];if(!_0x205f2e[_0x16f5('0x36')][_0x16f5('0x3d')]('nolimit')){_0x37c740[_0x16f5('0x3e')]=qs['limit'](_0x205f2e[_0x16f5('0x36')]['limit']);_0x37c740[_0x16f5('0x1f')]=qs[_0x16f5('0x1f')](_0x205f2e['query'][_0x16f5('0x1f')]);}return _0x2eebdb[_0x16f5('0x79')](_0x37c740);}})[_0x16f5('0x26')](function(_0x543ccd){if(_0x543ccd){return _0x543ccd?{'count':_0x488520,'rows':_0x543ccd}:null;}})[_0x16f5('0x26')](respondWithResult(_0x173efe,null))[_0x16f5('0x49')](handleError(_0x173efe,null));}; \ No newline at end of file +var _0x5f2b=['get','CustomDashboards','UserProfileResource','error','name','index','map','Dashboard','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','user','userProfileId','iframe','attrUrl','attrs','value','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x228725,_0x28131b){var _0x1b4f80=function(_0x4e46a5){while(--_0x4e46a5){_0x228725['push'](_0x228725['shift']());}};_0x1b4f80(++_0x28131b);}(_0x5f2b,0xbc));var _0xb5f2=function(_0x596947,_0x33e9ca){_0x596947=_0x596947-0x0;var _0x598a39=_0x5f2b[_0x596947];return _0x598a39;};'use strict';var pdf=require(_0xb5f2('0x0'));var emlformat=require(_0xb5f2('0x1'));var rimraf=require(_0xb5f2('0x2'));var zipdir=require(_0xb5f2('0x3'));var jsonpatch=require(_0xb5f2('0x4'));var rp=require(_0xb5f2('0x5'));var moment=require(_0xb5f2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb5f2('0x7'));var util=require(_0xb5f2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb5f2('0x9'));var ejs=require(_0xb5f2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5f2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb5f2('0x9'));var querystring=require(_0xb5f2('0xc'));var Papa=require(_0xb5f2('0xd'));var Redis=require(_0xb5f2('0xe'));var authService=require(_0xb5f2('0xf'));var qs=require(_0xb5f2('0x10'));var as=require(_0xb5f2('0x11'));var hardwareService=require(_0xb5f2('0x12'));var logger=require(_0xb5f2('0x13'))(_0xb5f2('0x14'));var utils=require(_0xb5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb5f2('0x16'))['db'];config[_0xb5f2('0x17')]=_[_0xb5f2('0x18')](config[_0xb5f2('0x17')],{'host':_0xb5f2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5f2('0x17')]));require(_0xb5f2('0x1a'))[_0xb5f2('0x1b')](socket);function respondWithStatusCode(_0x21bd76,_0x8b5e37){_0x8b5e37=_0x8b5e37||0xcc;return function(_0x5690a6){if(_0x5690a6){return _0x21bd76[_0xb5f2('0x1c')](_0x8b5e37);}return _0x21bd76[_0xb5f2('0x1d')](_0x8b5e37)[_0xb5f2('0x1e')]();};}function respondWithResult(_0x2b15f0,_0xd0b534){_0xd0b534=_0xd0b534||0xc8;return function(_0x3eb89f){if(_0x3eb89f){return _0x2b15f0['status'](_0xd0b534)['json'](_0x3eb89f);}};}function respondWithFilteredResult(_0x88c1d8,_0x563173){return function(_0x36e490){if(_0x36e490){var _0x4c142b=_0x36e490[_0xb5f2('0x1f')],_0x9c58a2=_0x563173[_0xb5f2('0x20')],_0x3ead99=_0x563173[_0xb5f2('0x20')]+_0x563173['limit'],_0x5e359e;if(_0x3ead99>=_0x4c142b){_0x3ead99=_0x4c142b;_0x5e359e=0xc8;}else{_0x5e359e=0xce;}_0x88c1d8[_0xb5f2('0x1d')](_0x5e359e);return _0x88c1d8[_0xb5f2('0x21')](_0xb5f2('0x22'),_0x9c58a2+'-'+_0x3ead99+'/'+_0x4c142b)[_0xb5f2('0x23')](_0x36e490);}return null;};}function patchUpdates(_0x5157fb){return function(_0x4106c1){try{jsonpatch[_0xb5f2('0x24')](_0x4106c1,_0x5157fb,!![]);}catch(_0x254165){return BPromise[_0xb5f2('0x25')](_0x254165);}return _0x4106c1[_0xb5f2('0x26')]();};}function saveUpdates(_0x331eef,_0x54e378){return function(_0x33eba8){if(_0x33eba8){return _0x33eba8[_0xb5f2('0x27')](_0x331eef)[_0xb5f2('0x28')](function(_0x5403c2){return _0x5403c2;});}return null;};}function removeEntity(_0x2a3f72,_0x1f935b){return function(_0x2ef7fb){if(_0x2ef7fb){return _0x2ef7fb[_0xb5f2('0x29')]()[_0xb5f2('0x28')](function(){var _0x3c8979=_0x2ef7fb[_0xb5f2('0x2a')]({'plain':!![]});var _0x255908=_0xb5f2('0x2b');return db[_0xb5f2('0x2c')][_0xb5f2('0x29')]({'where':{'type':_0x255908,'resourceId':_0x3c8979['id']}})['then'](function(){return _0x2ef7fb;});})[_0xb5f2('0x28')](function(){_0x2a3f72[_0xb5f2('0x1d')](0xcc)[_0xb5f2('0x1e')]();});}};}function handleEntityNotFound(_0x3571c9,_0x4dd44f){return function(_0x3f7370){if(!_0x3f7370){_0x3571c9[_0xb5f2('0x1c')](0x194);}return _0x3f7370;};}function handleError(_0x309f74,_0x25a70c){_0x25a70c=_0x25a70c||0x1f4;return function(_0x8f2a56){logger[_0xb5f2('0x2d')](_0x8f2a56['stack']);if(_0x8f2a56[_0xb5f2('0x2e')]){delete _0x8f2a56[_0xb5f2('0x2e')];}_0x309f74[_0xb5f2('0x1d')](_0x25a70c)['send'](_0x8f2a56);};}exports[_0xb5f2('0x2f')]=function(_0x12d6f9,_0x1c4a27){var _0x2ed4f8={},_0xd21d46={},_0x1fc609={'count':0x0,'rows':[]};var _0x13378d=_[_0xb5f2('0x30')](db[_0xb5f2('0x31')]['rawAttributes'],function(_0x14a4db){return{'name':_0x14a4db[_0xb5f2('0x32')],'type':_0x14a4db[_0xb5f2('0x33')]['key']};});_0xd21d46[_0xb5f2('0x34')]=_[_0xb5f2('0x30')](_0x13378d,_0xb5f2('0x2e'));_0xd21d46[_0xb5f2('0x35')]=_[_0xb5f2('0x36')](_0x12d6f9['query']);_0xd21d46[_0xb5f2('0x37')]=_[_0xb5f2('0x38')](_0xd21d46[_0xb5f2('0x34')],_0xd21d46[_0xb5f2('0x35')]);_0x2ed4f8[_0xb5f2('0x39')]=_[_0xb5f2('0x38')](_0xd21d46['model'],qs['fields'](_0x12d6f9['query'][_0xb5f2('0x3a')]));_0x2ed4f8['attributes']=_0x2ed4f8[_0xb5f2('0x39')][_0xb5f2('0x3b')]?_0x2ed4f8[_0xb5f2('0x39')]:_0xd21d46[_0xb5f2('0x34')];if(!_0x12d6f9[_0xb5f2('0x35')][_0xb5f2('0x3c')](_0xb5f2('0x3d'))){_0x2ed4f8['limit']=qs[_0xb5f2('0x3e')](_0x12d6f9['query'][_0xb5f2('0x3e')]);_0x2ed4f8[_0xb5f2('0x20')]=qs[_0xb5f2('0x20')](_0x12d6f9[_0xb5f2('0x35')][_0xb5f2('0x20')]);}_0x2ed4f8[_0xb5f2('0x3f')]=qs['sort'](_0x12d6f9[_0xb5f2('0x35')][_0xb5f2('0x40')]);_0x2ed4f8[_0xb5f2('0x41')]=qs[_0xb5f2('0x37')](_[_0xb5f2('0x42')](_0x12d6f9[_0xb5f2('0x35')],_0xd21d46[_0xb5f2('0x37')]),_0x13378d);if(_0x12d6f9[_0xb5f2('0x35')][_0xb5f2('0x43')]){_0x2ed4f8[_0xb5f2('0x41')]=_['merge'](_0x2ed4f8[_0xb5f2('0x41')],{'$or':_[_0xb5f2('0x30')](_0x13378d,function(_0x528ad0){if(_0x528ad0['type']!==_0xb5f2('0x44')){var _0xfd904d={};_0xfd904d[_0x528ad0[_0xb5f2('0x2e')]]={'$like':'%'+_0x12d6f9[_0xb5f2('0x35')][_0xb5f2('0x43')]+'%'};return _0xfd904d;}})});}_0x2ed4f8=_[_0xb5f2('0x45')]({},_0x2ed4f8,_0x12d6f9[_0xb5f2('0x46')]);var _0xc62334={'where':_0x2ed4f8['where']};return db[_0xb5f2('0x31')][_0xb5f2('0x1f')](_0xc62334)[_0xb5f2('0x28')](function(_0xcef9ca){_0x1fc609[_0xb5f2('0x1f')]=_0xcef9ca;if(_0x12d6f9[_0xb5f2('0x35')][_0xb5f2('0x47')]){_0x2ed4f8['include']=[{'all':!![]}];}return db[_0xb5f2('0x31')][_0xb5f2('0x48')](_0x2ed4f8);})[_0xb5f2('0x28')](function(_0x10dede){_0x1fc609[_0xb5f2('0x49')]=_0x10dede;return _0x1fc609;})[_0xb5f2('0x28')](respondWithFilteredResult(_0x1c4a27,_0x2ed4f8))[_0xb5f2('0x4a')](handleError(_0x1c4a27,null));};exports['show']=function(_0x124b68,_0x1ea2f5){var _0x2808e={'raw':![],'where':{'id':_0x124b68['params']['id']}},_0x5be656={};_0x5be656[_0xb5f2('0x34')]=_['keys'](db['Dashboard'][_0xb5f2('0x4b')]);_0x5be656['query']=_['keys'](_0x124b68['query']);_0x5be656[_0xb5f2('0x37')]=_[_0xb5f2('0x38')](_0x5be656[_0xb5f2('0x34')],_0x5be656['query']);_0x2808e[_0xb5f2('0x39')]=_[_0xb5f2('0x38')](_0x5be656['model'],qs[_0xb5f2('0x3a')](_0x124b68[_0xb5f2('0x35')][_0xb5f2('0x3a')]));_0x2808e[_0xb5f2('0x39')]=_0x2808e['attributes'][_0xb5f2('0x3b')]?_0x2808e[_0xb5f2('0x39')]:_0x5be656[_0xb5f2('0x34')];if(_0x124b68[_0xb5f2('0x35')]['includeAll']){_0x2808e[_0xb5f2('0x4c')]=[{'all':!![]}];}_0x2808e=_[_0xb5f2('0x45')]({},_0x2808e,_0x124b68[_0xb5f2('0x46')]);return db[_0xb5f2('0x31')][_0xb5f2('0x4d')](_0x2808e)[_0xb5f2('0x28')](handleEntityNotFound(_0x1ea2f5,null))[_0xb5f2('0x28')](respondWithResult(_0x1ea2f5,null))[_0xb5f2('0x4a')](handleError(_0x1ea2f5,null));};exports['create']=function(_0x1a342e,_0x362796){return db[_0xb5f2('0x31')][_0xb5f2('0x4e')](_0x1a342e[_0xb5f2('0x4f')],{})[_0xb5f2('0x28')](function(_0x2e652f){var _0x311371=_0x1a342e['user']['get']({'plain':!![]});if(!_0x311371)throw new Error(_0xb5f2('0x50'));if(_0x311371[_0xb5f2('0x51')]==='user'){var _0xc89b1f=_0x2e652f[_0xb5f2('0x2a')]({'plain':!![]});var _0x46ec3b=_0xb5f2('0x2b');return db[_0xb5f2('0x52')][_0xb5f2('0x4d')]({'where':{'name':_0x46ec3b,'userProfileId':_0x311371['userProfileId']},'raw':!![]})[_0xb5f2('0x28')](function(_0x44a9d9){if(_0x44a9d9&&_0x44a9d9['autoAssociation']===0x0){return db[_0xb5f2('0x2c')][_0xb5f2('0x4e')]({'name':_0xc89b1f[_0xb5f2('0x2e')],'resourceId':_0xc89b1f['id'],'type':_0x44a9d9['name'],'sectionId':_0x44a9d9['id']},{})[_0xb5f2('0x28')](function(){return _0x2e652f;});}else{return _0x2e652f;}})[_0xb5f2('0x4a')](function(_0x2496d5){logger[_0xb5f2('0x2d')](_0xb5f2('0x53'),_0x2496d5);throw _0x2496d5;});}return _0x2e652f;})[_0xb5f2('0x28')](respondWithResult(_0x362796,0xc9))['catch'](handleError(_0x362796,null));};exports[_0xb5f2('0x54')]=function(_0x17a4c7,_0x4a69e8){var _0x251180={'where':{'id':_0x17a4c7[_0xb5f2('0x55')]['id']}},_0x3d88d7={};_0x3d88d7[_0xb5f2('0x34')]=_[_0xb5f2('0x36')](db['Dashboard']['rawAttributes']);_0x251180[_0xb5f2('0x39')]=_[_0xb5f2('0x38')](_0x3d88d7[_0xb5f2('0x34')],qs[_0xb5f2('0x3a')](_0x17a4c7[_0xb5f2('0x35')][_0xb5f2('0x3a')]));_0x251180[_0xb5f2('0x39')]=_0x251180[_0xb5f2('0x39')][_0xb5f2('0x3b')]?_0x251180[_0xb5f2('0x39')]:_0x3d88d7[_0xb5f2('0x34')];if(_0x17a4c7[_0xb5f2('0x35')]['includeAll']){_0x251180[_0xb5f2('0x4c')]=[{'all':!![]}];}_0x251180=_['merge']({},_0x251180,_0x17a4c7[_0xb5f2('0x46')]);return db[_0xb5f2('0x31')][_0xb5f2('0x4d')](_0x251180)[_0xb5f2('0x28')](handleEntityNotFound(_0x4a69e8,null))['then'](function(_0x102b7d){if(_0x102b7d){var _0x18ac19=_0x102b7d[_0xb5f2('0x2a')]({'plain':!![]});_0x18ac19=qs[_0xb5f2('0x56')](_0x18ac19,['id','createdAt',_0xb5f2('0x57')]);_0x17a4c7[_0xb5f2('0x4f')]=_[_0xb5f2('0x56')](_0x17a4c7[_0xb5f2('0x4f')],['id',_0xb5f2('0x58'),'updatedAt']);return db[_0xb5f2('0x31')][_0xb5f2('0x4e')](_[_0xb5f2('0x45')](_0x18ac19,_0x17a4c7[_0xb5f2('0x4f')]),{'include':_0x17a4c7['query']['includeAll']?[{'all':!![]}]:undefined})[_0xb5f2('0x28')](function(_0xafb1ef){var _0x4f7f66=_0x17a4c7[_0xb5f2('0x59')][_0xb5f2('0x2a')]({'plain':!![]});if(!_0x4f7f66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f7f66[_0xb5f2('0x51')]===_0xb5f2('0x59')){var _0x549a92=_0xafb1ef[_0xb5f2('0x2a')]({'plain':!![]});var _0x3c23d4='CustomDashboards';return db[_0xb5f2('0x52')][_0xb5f2('0x4d')]({'where':{'name':_0x3c23d4,'userProfileId':_0x4f7f66[_0xb5f2('0x5a')]},'raw':!![]})[_0xb5f2('0x28')](function(_0x2ab984){if(_0x2ab984&&_0x2ab984['autoAssociation']===0x0){return db[_0xb5f2('0x2c')][_0xb5f2('0x4e')]({'name':_0x549a92[_0xb5f2('0x2e')],'resourceId':_0x549a92['id'],'type':_0x2ab984[_0xb5f2('0x2e')],'sectionId':_0x2ab984['id']},{})[_0xb5f2('0x28')](function(){return _0xafb1ef;});}else{return _0xafb1ef;}})[_0xb5f2('0x4a')](function(_0x456a20){logger['error'](_0xb5f2('0x53'),_0x456a20);throw _0x456a20;});}return _0xafb1ef;});}})[_0xb5f2('0x28')](respondWithResult(_0x4a69e8,0xc9))[_0xb5f2('0x4a')](handleError(_0x4a69e8,null));};exports[_0xb5f2('0x27')]=function(_0x2b7546,_0x290bc3){if(_0x2b7546[_0xb5f2('0x4f')]['id']){delete _0x2b7546[_0xb5f2('0x4f')]['id'];}return db[_0xb5f2('0x31')][_0xb5f2('0x4d')]({'where':{'id':_0x2b7546[_0xb5f2('0x55')]['id']}})[_0xb5f2('0x28')](handleEntityNotFound(_0x290bc3,null))[_0xb5f2('0x28')](saveUpdates(_0x2b7546[_0xb5f2('0x4f')],null))[_0xb5f2('0x28')](respondWithResult(_0x290bc3,null))['catch'](handleError(_0x290bc3,null));};exports[_0xb5f2('0x29')]=function(_0x298b6b,_0x5ba323){return db['Dashboard'][_0xb5f2('0x4d')]({'where':{'id':_0x298b6b[_0xb5f2('0x55')]['id']}})[_0xb5f2('0x28')](handleEntityNotFound(_0x5ba323,null))[_0xb5f2('0x28')](removeEntity(_0x5ba323,null))[_0xb5f2('0x4a')](handleError(_0x5ba323,null));};function widgetAttributes(_0x1b6d2b){try{switch(_0x1b6d2b[_0xb5f2('0x33')]){case _0xb5f2('0x5b'):return[{'name':_0xb5f2('0x5c'),'value':_0x1b6d2b[_0xb5f2('0x5c')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b[_0xb5f2('0x5d')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x1b6d2b['attrPath']||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b[_0xb5f2('0x5d')][0x0][_0xb5f2('0x5e')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x1b6d2b[_0xb5f2('0x5f')]||(_0x1b6d2b['attrs']&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b[_0xb5f2('0x5d')][0x0][_0xb5f2('0x5e')]:undefined)||_0xb5f2('0x60')},{'name':'attrTimezone','value':_0x1b6d2b[_0xb5f2('0x61')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x1]?_0x1b6d2b['attrs'][0x1][_0xb5f2('0x5e')]:undefined)||'0.00'},{'name':_0xb5f2('0x62'),'value':_0x1b6d2b[_0xb5f2('0x62')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x2]?_0x1b6d2b[_0xb5f2('0x5d')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xb5f2('0x63'),'value':_0x1b6d2b[_0xb5f2('0x63')]||(_0x1b6d2b['attrs']&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b['attrs'][0x0][_0xb5f2('0x5e')]:undefined)||_0xb5f2('0x64')},{'name':_0xb5f2('0x65'),'value':_0x1b6d2b[_0xb5f2('0x65')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b['attrs'][0x1]?_0x1b6d2b[_0xb5f2('0x5d')][0x1]['value']:undefined)||[]},{'name':_0xb5f2('0x62'),'value':_0x1b6d2b[_0xb5f2('0x62')]||(_0x1b6d2b['attrs']&&_0x1b6d2b['attrs'][0x2]?_0x1b6d2b[_0xb5f2('0x5d')][0x2][_0xb5f2('0x5e')]:undefined)||0x14}];case _0xb5f2('0x66'):case'pie-chart':return[{'name':_0xb5f2('0x67'),'value':_0x1b6d2b['attrSerie1']||(_0x1b6d2b['attrs']&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b[_0xb5f2('0x5d')][0x0]['value']:undefined)||_0xb5f2('0x64')},{'name':_0xb5f2('0x68'),'value':_0x1b6d2b[_0xb5f2('0x68')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x1]?_0x1b6d2b[_0xb5f2('0x5d')][0x1][_0xb5f2('0x5e')]:undefined)||null},{'name':_0xb5f2('0x69'),'value':_0x1b6d2b[_0xb5f2('0x69')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x2]?_0x1b6d2b[_0xb5f2('0x5d')][0x2][_0xb5f2('0x5e')]:undefined)||null},{'name':_0xb5f2('0x65'),'value':_0x1b6d2b['attrVoiceQueues']||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x3]?_0x1b6d2b['attrs'][0x3][_0xb5f2('0x5e')]:undefined)||[]}];case _0xb5f2('0x6a'):return[{'name':_0xb5f2('0x6b'),'type':_0x1b6d2b[_0xb5f2('0x6c')]||(_0x1b6d2b['attrs']&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b[_0xb5f2('0x5d')][0x0]['type']:undefined)||null,'value':_0x1b6d2b[_0xb5f2('0x6b')]||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b[_0xb5f2('0x5d')][0x0]?_0x1b6d2b['attrs'][0x0][_0xb5f2('0x5e')]:undefined)||null},{'name':_0xb5f2('0x6d'),'value':_0x1b6d2b['attrRefresh']||(_0x1b6d2b[_0xb5f2('0x5d')]&&_0x1b6d2b['attrs'][0x1]?_0x1b6d2b[_0xb5f2('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5547b0){logger[_0xb5f2('0x2d')]('widgetAttributes:\x20%s',JSON[_0xb5f2('0x6e')](_0x5547b0));return[];}}exports[_0xb5f2('0x6f')]=function(_0x22bc0d,_0x456a08,_0x199254){if(_0x22bc0d[_0xb5f2('0x4f')]['id']){delete _0x22bc0d[_0xb5f2('0x4f')]['id'];}return db[_0xb5f2('0x31')][_0xb5f2('0x4d')]({'where':{'id':_0x22bc0d[_0xb5f2('0x55')]['id']}})[_0xb5f2('0x28')](handleEntityNotFound(_0x456a08,null))[_0xb5f2('0x28')](function(_0x4655e3){if(_0x4655e3){_0x22bc0d[_0xb5f2('0x4f')]['DashboardId']=_0x4655e3['id'];_0x22bc0d['body']['attrs']=widgetAttributes(_0x22bc0d[_0xb5f2('0x4f')]);return db[_0xb5f2('0x70')][_0xb5f2('0x4e')](_0x22bc0d[_0xb5f2('0x4f')]);}})[_0xb5f2('0x28')](respondWithResult(_0x456a08,null))['catch'](handleError(_0x456a08,null));};exports[_0xb5f2('0x71')]=function(_0x3f724b,_0x54e34f,_0x405272){var _0x5c96b7={};var _0x5b8698={};var _0x4f6b1c;var _0xc4a0e1;return db[_0xb5f2('0x31')][_0xb5f2('0x72')]({'where':{'id':_0x3f724b['params']['id']}})[_0xb5f2('0x28')](handleEntityNotFound(_0x54e34f,null))[_0xb5f2('0x28')](function(_0x4996c6){if(_0x4996c6){_0x4f6b1c=_0x4996c6;_0x5b8698[_0xb5f2('0x34')]=_[_0xb5f2('0x36')](db['DashboardItem'][_0xb5f2('0x4b')]);_0x5b8698[_0xb5f2('0x35')]=_[_0xb5f2('0x36')](_0x3f724b[_0xb5f2('0x35')]);_0x5b8698['filters']=_[_0xb5f2('0x38')](_0x5b8698[_0xb5f2('0x34')],_0x5b8698[_0xb5f2('0x35')]);_0x5c96b7[_0xb5f2('0x39')]=_[_0xb5f2('0x38')](_0x5b8698[_0xb5f2('0x34')],qs[_0xb5f2('0x3a')](_0x3f724b[_0xb5f2('0x35')]['fields']));_0x5c96b7['attributes']=_0x5c96b7[_0xb5f2('0x39')]['length']?_0x5c96b7[_0xb5f2('0x39')]:_0x5b8698[_0xb5f2('0x34')];_0x5c96b7['order']=qs[_0xb5f2('0x40')](_0x3f724b[_0xb5f2('0x35')]['sort']);_0x5c96b7[_0xb5f2('0x41')]=qs[_0xb5f2('0x37')](_['pick'](_0x3f724b[_0xb5f2('0x35')],_0x5b8698[_0xb5f2('0x37')]));if(_0x3f724b[_0xb5f2('0x35')][_0xb5f2('0x43')]){_0x5c96b7[_0xb5f2('0x41')]=_[_0xb5f2('0x45')](_0x5c96b7[_0xb5f2('0x41')],{'$or':_[_0xb5f2('0x30')](_0x5c96b7[_0xb5f2('0x39')],function(_0x198ba2){var _0x3ca744={};_0x3ca744[_0x198ba2]={'$like':'%'+_0x3f724b[_0xb5f2('0x35')]['filter']+'%'};return _0x3ca744;})});}_0x5c96b7=_[_0xb5f2('0x45')]({},_0x5c96b7,_0x3f724b[_0xb5f2('0x46')]);return _0x4f6b1c[_0xb5f2('0x71')](_0x5c96b7);}})[_0xb5f2('0x28')](function(_0x4c897d){if(_0x4c897d){_0xc4a0e1=_0x4c897d['length'];if(!_0x3f724b['query'][_0xb5f2('0x3c')](_0xb5f2('0x3d'))){_0x5c96b7['limit']=qs[_0xb5f2('0x3e')](_0x3f724b['query'][_0xb5f2('0x3e')]);_0x5c96b7[_0xb5f2('0x20')]=qs[_0xb5f2('0x20')](_0x3f724b[_0xb5f2('0x35')]['offset']);}return _0x4f6b1c[_0xb5f2('0x71')](_0x5c96b7);}})[_0xb5f2('0x28')](function(_0x24f5ce){if(_0x24f5ce){return _0x24f5ce?{'count':_0xc4a0e1,'rows':_0x24f5ce}:null;}})[_0xb5f2('0x28')](respondWithResult(_0x54e34f,null))[_0xb5f2('0x4a')](handleError(_0x54e34f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c1f0137..dfd4650 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 _0xfc6e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc6e,0x12e));var _0xefc6=function(_0x4d5d0a,_0x4148dd){_0x4d5d0a=_0x4d5d0a-0x0;var _0x502c59=_0xfc6e[_0x4d5d0a];return _0x502c59;};'use strict';var EventEmitter=require(_0xefc6('0x0'));var Dashboard=require(_0xefc6('0x1'))['db'][_0xefc6('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xefc6('0x3'),'afterDestroy':_0xefc6('0x4')};function emitEvent(_0x44592d){return function(_0x106aaa,_0x6b7436,_0x7515e5){DashboardEvents[_0xefc6('0x5')](_0x44592d+':'+_0x106aaa['id'],_0x106aaa);DashboardEvents['emit'](_0x44592d,_0x106aaa);_0x7515e5(null);};}for(var e in events){if(events[_0xefc6('0x6')](e)){var event=events[e];Dashboard[_0xefc6('0x7')](e,emitEvent(event));}}module[_0xefc6('0x8')]=DashboardEvents; \ No newline at end of file +var _0x6f51=['emit','hook','exports','setMaxListeners','save','update','remove'];(function(_0x21fab4,_0x1254b7){var _0x1a8136=function(_0x2be794){while(--_0x2be794){_0x21fab4['push'](_0x21fab4['shift']());}};_0x1a8136(++_0x1254b7);}(_0x6f51,0xb2));var _0x16f5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f51[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x16f5('0x0')](0x0);var events={'afterCreate':_0x16f5('0x1'),'afterUpdate':_0x16f5('0x2'),'afterDestroy':_0x16f5('0x3')};function emitEvent(_0x2a7b65){return function(_0x5957b3,_0x4e3d43,_0x47adb3){DashboardEvents[_0x16f5('0x4')](_0x2a7b65+':'+_0x5957b3['id'],_0x5957b3);DashboardEvents[_0x16f5('0x4')](_0x2a7b65,_0x5957b3);_0x47adb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x16f5('0x5')](e,emitEvent(event));}}module[_0x16f5('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 3d27663..b545c47 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 _0xfed4=['define','Dashboard','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0xad03d4,_0x2f0726){var _0x3195bc=function(_0x16d6f3){while(--_0x16d6f3){_0xad03d4['push'](_0xad03d4['shift']());}};_0x3195bc(++_0x2f0726);}(_0xfed4,0x16e));var _0x4fed=function(_0x1b059c,_0x32c5e0){_0x1b059c=_0x1b059c-0x0;var _0x26398c=_0xfed4[_0x1b059c];return _0x26398c;};'use strict';var _=require(_0x4fed('0x0'));var util=require(_0x4fed('0x1'));var logger=require(_0x4fed('0x2'))(_0x4fed('0x3'));var moment=require(_0x4fed('0x4'));var BPromise=require('bluebird');var rp=require(_0x4fed('0x5'));var fs=require('fs');var path=require(_0x4fed('0x6'));var rimraf=require(_0x4fed('0x7'));var config=require(_0x4fed('0x8'));var attributes=require(_0x4fed('0x9'));module[_0x4fed('0xa')]=function(_0x35b551,_0x13c197){return _0x35b551[_0x4fed('0xb')](_0x4fed('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c54=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x537cde,_0x455a62){var _0x24ac61=function(_0x19e8fd){while(--_0x19e8fd){_0x537cde['push'](_0x537cde['shift']());}};_0x24ac61(++_0x455a62);}(_0x6c54,0xe2));var _0x46c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c54[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x46c5('0x0'));var util=require(_0x46c5('0x1'));var logger=require(_0x46c5('0x2'))(_0x46c5('0x3'));var moment=require(_0x46c5('0x4'));var BPromise=require(_0x46c5('0x5'));var rp=require(_0x46c5('0x6'));var fs=require('fs');var path=require(_0x46c5('0x7'));var rimraf=require(_0x46c5('0x8'));var config=require(_0x46c5('0x9'));var attributes=require('./dashboard.attributes');module[_0x46c5('0xa')]=function(_0xee0095,_0x3e57e8){return _0xee0095[_0x46c5('0xb')](_0x46c5('0xc'),attributes,{'tableName':_0x46c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 81777b1..61e5a30 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 _0xa83f=['stringify','error','Dashboard,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0xc92c0a,_0x76c1c4){var _0x555c6c=function(_0x17bf88){while(--_0x17bf88){_0xc92c0a['push'](_0xc92c0a['shift']());}};_0x555c6c(++_0x76c1c4);}(_0xa83f,0x118));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfa83('0x1'));var rs=require(_0xfa83('0x2'));var fs=require('fs');var Redis=require(_0xfa83('0x3'));var db=require(_0xfa83('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa83('0x5'))(_0xfa83('0x6'));var config=require(_0xfa83('0x7'));var jayson=require(_0xfa83('0x8'));var client=jayson[_0xfa83('0x9')][_0xfa83('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xfa83('0xb'),'port':0x18eb});var socket=require(_0xfa83('0xc'))(new Redis(config[_0xfa83('0xd')]));require('./dashboard.socket')[_0xfa83('0xe')](socket);function respondWithRpcPromise(_0x43e9a8,_0x33f20b,_0x115132){return new BPromise(function(_0x1eadd7,_0x18cf64){return client[_0xfa83('0xf')](_0x43e9a8,_0x115132)[_0xfa83('0x10')](function(_0x548ab7){logger[_0xfa83('0x11')]('Dashboard,\x20%s,\x20%s',_0x33f20b,'request\x20sent');logger[_0xfa83('0x12')](_0xfa83('0x13'),_0x33f20b,'request\x20sent',JSON[_0xfa83('0x14')](_0x548ab7));if(_0x548ab7['error']){if(_0x548ab7[_0xfa83('0x15')]['code']===0x1f4){logger['error'](_0xfa83('0x16'),_0x33f20b,_0x548ab7[_0xfa83('0x15')]['message']);return _0x18cf64(_0x548ab7[_0xfa83('0x15')][_0xfa83('0x17')]);}logger[_0xfa83('0x15')](_0xfa83('0x16'),_0x33f20b,_0x548ab7['error'][_0xfa83('0x17')]);return _0x1eadd7(_0x548ab7[_0xfa83('0x15')]['message']);}else{logger[_0xfa83('0x11')](_0xfa83('0x16'),_0x33f20b,'request\x20sent');_0x1eadd7(_0x548ab7[_0xfa83('0x18')]['message']);}})['catch'](function(_0x3886e8){logger[_0xfa83('0x15')](_0xfa83('0x16'),_0x33f20b,_0x3886e8);_0x18cf64(_0x3886e8);});});} \ No newline at end of file +var _0xe981=['catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result'];(function(_0x2b3da6,_0x2e2783){var _0x5c4e50=function(_0x5c51d5){while(--_0x5c51d5){_0x2b3da6['push'](_0x2b3da6['shift']());}};_0x5c4e50(++_0x2e2783);}(_0xe981,0xd9));var _0x1e98=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xe981[_0x1d7037];return _0x4d6568;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1e98('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e98('0x1'));var db=require(_0x1e98('0x2'))['db'];var utils=require(_0x1e98('0x3'));var logger=require(_0x1e98('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1e98('0x5'));var client=jayson[_0x1e98('0x6')]['http']({'port':0x232a});config[_0x1e98('0x7')]=_[_0x1e98('0x8')](config[_0x1e98('0x7')],{'host':_0x1e98('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e98('0x7')]));require(_0x1e98('0xa'))[_0x1e98('0xb')](socket);function respondWithRpcPromise(_0x245c68,_0x31f03e,_0x443fb5){return new BPromise(function(_0x432805,_0x1a6587){return client[_0x1e98('0xc')](_0x245c68,_0x443fb5)[_0x1e98('0xd')](function(_0x51caee){logger[_0x1e98('0xe')]('Dashboard,\x20%s,\x20%s',_0x31f03e,_0x1e98('0xf'));logger[_0x1e98('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x31f03e,_0x1e98('0xf'),JSON[_0x1e98('0x11')](_0x51caee));if(_0x51caee[_0x1e98('0x12')]){if(_0x51caee[_0x1e98('0x12')][_0x1e98('0x13')]===0x1f4){logger[_0x1e98('0x12')]('Dashboard,\x20%s,\x20%s',_0x31f03e,_0x51caee[_0x1e98('0x12')][_0x1e98('0x14')]);return _0x1a6587(_0x51caee['error']['message']);}logger[_0x1e98('0x12')](_0x1e98('0x15'),_0x31f03e,_0x51caee[_0x1e98('0x12')][_0x1e98('0x14')]);return _0x432805(_0x51caee[_0x1e98('0x12')]['message']);}else{logger[_0x1e98('0xe')](_0x1e98('0x15'),_0x31f03e,_0x1e98('0xf'));_0x432805(_0x51caee[_0x1e98('0x16')][_0x1e98('0x14')]);}})[_0x1e98('0x17')](function(_0xb08042){logger[_0x1e98('0x12')](_0x1e98('0x15'),_0x31f03e,_0xb08042);_0x1a6587(_0xb08042);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8a7ed79..9ee7bdf 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 _0x81d4=['remove','emit','removeListener','register','./dashboard.events','save'];(function(_0x1946aa,_0x493b74){var _0x3c4133=function(_0xdce9b){while(--_0xdce9b){_0x1946aa['push'](_0x1946aa['shift']());}};_0x3c4133(++_0x493b74);}(_0x81d4,0x1ea));var _0x481d=function(_0x361a52,_0x2244b1){_0x361a52=_0x361a52-0x0;var _0x3672c1=_0x81d4[_0x361a52];return _0x3672c1;};'use strict';var DashboardEvents=require(_0x481d('0x0'));var events=[_0x481d('0x1'),_0x481d('0x2'),'update'];function createListener(_0x12dc20,_0x215a27){return function(_0x18fbc7){_0x215a27[_0x481d('0x3')](_0x12dc20,_0x18fbc7);};}function removeListener(_0x39d633,_0x2ac970){return function(){DashboardEvents[_0x481d('0x4')](_0x39d633,_0x2ac970);};}exports[_0x481d('0x5')]=function(_0xfeadf9){for(var _0x7dae07=0x0,_0x3b3251=events['length'];_0x7dae07<_0x3b3251;_0x7dae07++){var _0x1f609f=events[_0x7dae07];var _0x132937=createListener('dashboard:'+_0x1f609f,_0xfeadf9);DashboardEvents['on'](_0x1f609f,_0x132937);}}; \ No newline at end of file +var _0xdd79=['removeListener','register','length','dashboard:','./dashboard.events','remove','update','emit'];(function(_0x12e96f,_0x2ec3e4){var _0x53f46d=function(_0x5c13f4){while(--_0x5c13f4){_0x12e96f['push'](_0x12e96f['shift']());}};_0x53f46d(++_0x2ec3e4);}(_0xdd79,0x134));var _0x9dd7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd79[_0x14add3];return _0x4a174f;};'use strict';var DashboardEvents=require(_0x9dd7('0x0'));var events=['save',_0x9dd7('0x1'),_0x9dd7('0x2')];function createListener(_0x3d2caa,_0x524a30){return function(_0xf6c9d6){_0x524a30[_0x9dd7('0x3')](_0x3d2caa,_0xf6c9d6);};}function removeListener(_0x5a335c,_0x416620){return function(){DashboardEvents[_0x9dd7('0x4')](_0x5a335c,_0x416620);};}exports[_0x9dd7('0x5')]=function(_0x4760c4){for(var _0x1cf6c0=0x0,_0xb95d1=events[_0x9dd7('0x6')];_0x1cf6c0<_0xb95d1;_0x1cf6c0++){var _0x4e9b7e=events[_0x1cf6c0];var _0x88bb38=createListener(_0x9dd7('0x7')+_0x4e9b7e,_0x4760c4);DashboardEvents['on'](_0x4e9b7e,_0x88bb38);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2c76d59..cf522c5 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 _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x4d584f,_0x385fcd){var _0x383793=function(_0x309159){while(--_0x309159){_0x4d584f['push'](_0x4d584f['shift']());}};_0x383793(++_0x385fcd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xcb91[_0xcf4569];return _0x7fef;};'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 auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0xcb91[_0x4c5c97];return _0xd5d2cb;};'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 auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f889175..5fe230f 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 _0xedd6=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x39829a,_0x542c68){var _0x5942e4=function(_0x55aaf1){while(--_0x55aaf1){_0x39829a['push'](_0x39829a['shift']());}};_0x5942e4(++_0x542c68);}(_0xedd6,0xc6));var _0x6edd=function(_0x6810cd,_0x4cf418){_0x6810cd=_0x6810cd-0x0;var _0x22be82=_0xedd6[_0x6810cd];return _0x22be82;};'use strict';var Sequelize=require(_0x6edd('0x0'));var squel=require(_0x6edd('0x1'));var _=require(_0x6edd('0x2'));module[_0x6edd('0x3')]={'title':{'type':Sequelize[_0x6edd('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x6edd('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6edd('0x5')](_0x6edd('0x6')),'get':function(){try{return JSON['parse'](this[_0x6edd('0x7')](_0x6edd('0x8')));}catch(_0x134469){return[];}},'set':function(_0x139d2f){try{this[_0x6edd('0x9')](_0x6edd('0x8'),JSON[_0x6edd('0xa')](_0x139d2f));}catch(_0x8bd632){this['setDataValue'](_0x6edd('0x8'),JSON[_0x6edd('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6edd('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6edd('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x6edd('0x4')],'allowNull':![],'defaultValue':_0x6edd('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6edd('0x4')],'allowNull':![],'defaultValue':_0x6edd('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6edd('0x4')]},'titleFontSize':{'type':Sequelize[_0x6edd('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x756b=['attrs','stringify','INTEGER','#2196f3','sequelize','lodash','exports','STRING','TEXT','long','getDataValue','setDataValue'];(function(_0xb41dd1,_0x3eec0b){var _0x2fecec=function(_0x1b8939){while(--_0x1b8939){_0xb41dd1['push'](_0xb41dd1['shift']());}};_0x2fecec(++_0x3eec0b);}(_0x756b,0xa0));var _0xb756=function(_0x45c9b2,_0x15ed93){_0x45c9b2=_0x45c9b2-0x0;var _0x4a5ecc=_0x756b[_0x45c9b2];return _0x4a5ecc;};'use strict';var Sequelize=require(_0xb756('0x0'));var squel=require('squel');var _=require(_0xb756('0x1'));module[_0xb756('0x2')]={'title':{'type':Sequelize[_0xb756('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb756('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb756('0x4')](_0xb756('0x5')),'get':function(){try{return JSON['parse'](this[_0xb756('0x6')]('attrs'));}catch(_0x405c02){return[];}},'set':function(_0x2ffff6){try{this[_0xb756('0x7')](_0xb756('0x8'),JSON[_0xb756('0x9')](_0x2ffff6));}catch(_0x4e4d8d){this[_0xb756('0x7')](_0xb756('0x8'),JSON[_0xb756('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb756('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb756('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb756('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb756('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb756('0x3')]},'titleFontSize':{'type':Sequelize[_0xb756('0xa')],'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 94a6eca..b406c6f 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 _0x95c5=['https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','set','apply','reject','update','then','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','filters','intersection','attributes','fields','length','query','include','merge','options','destroy','catch','type','attrUrl','attrs','value'];(function(_0x439774,_0xcac95f){var _0x4ff486=function(_0x2b4545){while(--_0x2b4545){_0x439774['push'](_0x439774['shift']());}};_0x4ff486(++_0xcac95f);}(_0x95c5,0x179));var _0x595c=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x95c5[_0x466af7];return _0x348c96;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x595c('0x0'));var zipdir=require(_0x595c('0x1'));var jsonpatch=require(_0x595c('0x2'));var rp=require(_0x595c('0x3'));var moment=require(_0x595c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x595c('0x5'));var util=require(_0x595c('0x6'));var path=require(_0x595c('0x7'));var sox=require(_0x595c('0x8'));var csv=require(_0x595c('0x9'));var ejs=require(_0x595c('0xa'));var fs=require('fs');var _=require(_0x595c('0xb'));var squel=require('squel');var crypto=require(_0x595c('0xc'));var jsforce=require(_0x595c('0xd'));var deskjs=require(_0x595c('0xe'));var toCsv=require(_0x595c('0x9'));var querystring=require(_0x595c('0xf'));var Papa=require('papaparse');var Redis=require(_0x595c('0x10'));var authService=require(_0x595c('0x11'));var qs=require(_0x595c('0x12'));var as=require(_0x595c('0x13'));var hardwareService=require(_0x595c('0x14'));var logger=require(_0x595c('0x15'))(_0x595c('0x16'));var utils=require(_0x595c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x595c('0x18'));var db=require('../../mysqldb')['db'];config[_0x595c('0x19')]=_[_0x595c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x595c('0x1b'))[_0x595c('0x1c')](socket);function respondWithStatusCode(_0x170a88,_0x3d46f7){_0x3d46f7=_0x3d46f7||0xcc;return function(_0x18d825){if(_0x18d825){return _0x170a88[_0x595c('0x1d')](_0x3d46f7);}return _0x170a88[_0x595c('0x1e')](_0x3d46f7)['end']();};}function respondWithResult(_0x17d919,_0x3ba56a){_0x3ba56a=_0x3ba56a||0xc8;return function(_0x37d252){if(_0x37d252){return _0x17d919[_0x595c('0x1e')](_0x3ba56a)[_0x595c('0x1f')](_0x37d252);}};}function respondWithFilteredResult(_0x51160a,_0x3cc509){return function(_0x23563f){if(_0x23563f){var _0x3cafbc=_0x23563f['count'],_0x325061=_0x3cc509[_0x595c('0x20')],_0x2d5fb9=_0x3cc509[_0x595c('0x20')]+_0x3cc509[_0x595c('0x21')],_0x96585d;if(_0x2d5fb9>=_0x3cafbc){_0x2d5fb9=_0x3cafbc;_0x96585d=0xc8;}else{_0x96585d=0xce;}_0x51160a['status'](_0x96585d);return _0x51160a[_0x595c('0x22')]('Content-Range',_0x325061+'-'+_0x2d5fb9+'/'+_0x3cafbc)[_0x595c('0x1f')](_0x23563f);}return null;};}function patchUpdates(_0x37687d){return function(_0x437807){try{jsonpatch[_0x595c('0x23')](_0x437807,_0x37687d,!![]);}catch(_0x41168a){return BPromise[_0x595c('0x24')](_0x41168a);}return _0x437807['save']();};}function saveUpdates(_0x1306e8,_0x58e0ae){return function(_0x4f47e6){if(_0x4f47e6){return _0x4f47e6[_0x595c('0x25')](_0x1306e8)[_0x595c('0x26')](function(_0x2768e4){return _0x2768e4;});}return null;};}function removeEntity(_0x11dd74,_0xf494e5){return function(_0x3bf26e){if(_0x3bf26e){return _0x3bf26e['destroy']()[_0x595c('0x26')](function(){_0x11dd74['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59beb3,_0x45d444){return function(_0x3684fe){if(!_0x3684fe){_0x59beb3[_0x595c('0x1d')](0x194);}return _0x3684fe;};}function handleError(_0x14ce8c,_0x27d498){_0x27d498=_0x27d498||0x1f4;return function(_0x15085b){logger[_0x595c('0x27')](_0x15085b[_0x595c('0x28')]);if(_0x15085b[_0x595c('0x29')]){delete _0x15085b[_0x595c('0x29')];}_0x14ce8c[_0x595c('0x1e')](_0x27d498)['send'](_0x15085b);};}exports[_0x595c('0x2a')]=function(_0x2c6d4c,_0x1d9b56){var _0x478bf2={'raw':![],'where':{'id':_0x2c6d4c[_0x595c('0x2b')]['id']}},_0x186918={};_0x186918[_0x595c('0x2c')]=_[_0x595c('0x2d')](db[_0x595c('0x2e')][_0x595c('0x2f')]);_0x186918['query']=_['keys'](_0x2c6d4c['query']);_0x186918[_0x595c('0x30')]=_[_0x595c('0x31')](_0x186918[_0x595c('0x2c')],_0x186918['query']);_0x478bf2[_0x595c('0x32')]=_[_0x595c('0x31')](_0x186918[_0x595c('0x2c')],qs[_0x595c('0x33')](_0x2c6d4c['query'][_0x595c('0x33')]));_0x478bf2[_0x595c('0x32')]=_0x478bf2['attributes'][_0x595c('0x34')]?_0x478bf2[_0x595c('0x32')]:_0x186918[_0x595c('0x2c')];if(_0x2c6d4c[_0x595c('0x35')]['includeAll']){_0x478bf2[_0x595c('0x36')]=[{'all':!![]}];}_0x478bf2=_[_0x595c('0x37')]({},_0x478bf2,_0x2c6d4c[_0x595c('0x38')]);return db['DashboardItem']['find'](_0x478bf2)[_0x595c('0x26')](handleEntityNotFound(_0x1d9b56,null))[_0x595c('0x26')](respondWithResult(_0x1d9b56,null))['catch'](handleError(_0x1d9b56,null));};exports[_0x595c('0x39')]=function(_0x2111c9,_0x37a8f2){return db['DashboardItem']['find']({'where':{'id':_0x2111c9['params']['id']}})['then'](handleEntityNotFound(_0x37a8f2,null))['then'](removeEntity(_0x37a8f2,null))[_0x595c('0x3a')](handleError(_0x37a8f2,null));};function widgetAttributes(_0x2cffe8){try{switch(_0x2cffe8[_0x595c('0x3b')]){case'iframe':return[{'name':_0x595c('0x3c'),'value':_0x2cffe8[_0x595c('0x3c')]||(_0x2cffe8['attrs']&&_0x2cffe8[_0x595c('0x3d')][0x0]?_0x2cffe8[_0x595c('0x3d')][0x0][_0x595c('0x3e')]:undefined)||_0x595c('0x3f')}];case _0x595c('0x40'):return[{'name':_0x595c('0x41'),'value':_0x2cffe8[_0x595c('0x41')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x0]?_0x2cffe8['attrs'][0x0][_0x595c('0x3e')]:undefined)||''}];case _0x595c('0x42'):return[{'name':_0x595c('0x43'),'value':_0x2cffe8[_0x595c('0x43')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8['attrs'][0x0]?_0x2cffe8[_0x595c('0x3d')][0x0][_0x595c('0x3e')]:undefined)||_0x595c('0x44')},{'name':'attrTimezone','value':_0x2cffe8[_0x595c('0x45')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x1]?_0x2cffe8[_0x595c('0x3d')][0x1][_0x595c('0x3e')]:undefined)||_0x595c('0x46')},{'name':_0x595c('0x47'),'value':_0x2cffe8[_0x595c('0x47')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x2]?_0x2cffe8[_0x595c('0x3d')][0x2][_0x595c('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0x595c('0x48'),'value':_0x2cffe8[_0x595c('0x48')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x0]?_0x2cffe8[_0x595c('0x3d')][0x0][_0x595c('0x3e')]:undefined)||'total'},{'name':_0x595c('0x49'),'value':_0x2cffe8[_0x595c('0x49')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8['attrs'][0x1]?_0x2cffe8[_0x595c('0x3d')][0x1][_0x595c('0x3e')]:undefined)||[]},{'name':_0x595c('0x47'),'value':_0x2cffe8[_0x595c('0x47')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x2]?_0x2cffe8['attrs'][0x2][_0x595c('0x3e')]:undefined)||0x14}];case _0x595c('0x4a'):case'pie-chart':return[{'name':_0x595c('0x4b'),'value':_0x2cffe8[_0x595c('0x4b')]||(_0x2cffe8['attrs']&&_0x2cffe8[_0x595c('0x3d')][0x0]?_0x2cffe8[_0x595c('0x3d')][0x0][_0x595c('0x3e')]:undefined)||_0x595c('0x4c')},{'name':_0x595c('0x4d'),'value':_0x2cffe8['attrSerie2']||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x1]?_0x2cffe8['attrs'][0x1][_0x595c('0x3e')]:undefined)||null},{'name':_0x595c('0x4e'),'value':_0x2cffe8[_0x595c('0x4e')]||(_0x2cffe8['attrs']&&_0x2cffe8['attrs'][0x2]?_0x2cffe8[_0x595c('0x3d')][0x2][_0x595c('0x3e')]:undefined)||null},{'name':_0x595c('0x49'),'value':_0x2cffe8[_0x595c('0x49')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x3]?_0x2cffe8[_0x595c('0x3d')][0x3]['value']:undefined)||[]}];case _0x595c('0x4f'):return[{'name':_0x595c('0x50'),'type':_0x2cffe8[_0x595c('0x51')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x0]?_0x2cffe8[_0x595c('0x3d')][0x0]['type']:undefined)||null,'value':_0x2cffe8['attrReport']||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8['attrs'][0x0]?_0x2cffe8[_0x595c('0x3d')][0x0][_0x595c('0x3e')]:undefined)||null},{'name':'attrRefresh','value':_0x2cffe8[_0x595c('0x52')]||(_0x2cffe8[_0x595c('0x3d')]&&_0x2cffe8[_0x595c('0x3d')][0x1]?_0x2cffe8[_0x595c('0x3d')][0x1][_0x595c('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x2cf522){logger[_0x595c('0x27')](_0x595c('0x53'),JSON[_0x595c('0x54')](_0x2cf522));return[];}}exports[_0x595c('0x55')]=function(_0x537f20,_0x1f81c9){if(_0x537f20[_0x595c('0x56')]){_0x537f20[_0x595c('0x56')][_0x595c('0x3d')]=widgetAttributes(_0x537f20[_0x595c('0x56')]);}return db[_0x595c('0x2e')][_0x595c('0x55')](_0x537f20[_0x595c('0x56')],{})['then'](respondWithResult(_0x1f81c9,0xc9))['catch'](handleError(_0x1f81c9,null));};exports[_0x595c('0x25')]=function(_0x1b63d6,_0x370789){if(_0x1b63d6[_0x595c('0x56')]['id']){delete _0x1b63d6['body']['id'];}_0x1b63d6['body'][_0x595c('0x3d')]=widgetAttributes(_0x1b63d6[_0x595c('0x56')]);return db[_0x595c('0x2e')][_0x595c('0x57')]({'where':{'id':_0x1b63d6[_0x595c('0x2b')]['id']}})[_0x595c('0x26')](handleEntityNotFound(_0x370789,null))['then'](saveUpdates(_0x1b63d6[_0x595c('0x56')],null))[_0x595c('0x26')](respondWithResult(_0x370789,null))[_0x595c('0x3a')](handleError(_0x370789,null));}; \ No newline at end of file +var _0x9667=['options','find','params','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge'];(function(_0x51d5ad,_0xbea2f){var _0x3fc9d0=function(_0x51f81b){while(--_0x51f81b){_0x51d5ad['push'](_0x51d5ad['shift']());}};_0x3fc9d0(++_0xbea2f);}(_0x9667,0xd0));var _0x7966=function(_0x9f3180,_0x4fb4c3){_0x9f3180=_0x9f3180-0x0;var _0x1c7049=_0x9667[_0x9f3180];return _0x1c7049;};'use strict';var pdf=require(_0x7966('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7966('0x1'));var zipdir=require(_0x7966('0x2'));var jsonpatch=require(_0x7966('0x3'));var rp=require(_0x7966('0x4'));var moment=require(_0x7966('0x5'));var BPromise=require(_0x7966('0x6'));var Mustache=require(_0x7966('0x7'));var util=require(_0x7966('0x8'));var path=require(_0x7966('0x9'));var sox=require(_0x7966('0xa'));var csv=require(_0x7966('0xb'));var ejs=require(_0x7966('0xc'));var fs=require('fs');var _=require(_0x7966('0xd'));var squel=require('squel');var crypto=require(_0x7966('0xe'));var jsforce=require(_0x7966('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7966('0xb'));var querystring=require(_0x7966('0x10'));var Papa=require(_0x7966('0x11'));var Redis=require(_0x7966('0x12'));var authService=require(_0x7966('0x13'));var qs=require(_0x7966('0x14'));var as=require(_0x7966('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7966('0x16'));var utils=require(_0x7966('0x17'));var config=require(_0x7966('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7966('0x19'))['db'];config['redis']=_[_0x7966('0x1a')](config[_0x7966('0x1b')],{'host':_0x7966('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7966('0x1b')]));require(_0x7966('0x1d'))[_0x7966('0x1e')](socket);function respondWithStatusCode(_0x436edb,_0x4d5fe7){_0x4d5fe7=_0x4d5fe7||0xcc;return function(_0x5c64ac){if(_0x5c64ac){return _0x436edb[_0x7966('0x1f')](_0x4d5fe7);}return _0x436edb[_0x7966('0x20')](_0x4d5fe7)['end']();};}function respondWithResult(_0x1d017a,_0x5ceb90){_0x5ceb90=_0x5ceb90||0xc8;return function(_0x38eec2){if(_0x38eec2){return _0x1d017a['status'](_0x5ceb90)[_0x7966('0x21')](_0x38eec2);}};}function respondWithFilteredResult(_0x3721be,_0x21f0f2){return function(_0x300bd1){if(_0x300bd1){var _0x2db559=_0x300bd1[_0x7966('0x22')],_0x4b18c9=_0x21f0f2[_0x7966('0x23')],_0x3c3609=_0x21f0f2[_0x7966('0x23')]+_0x21f0f2[_0x7966('0x24')],_0x7408a1;if(_0x3c3609>=_0x2db559){_0x3c3609=_0x2db559;_0x7408a1=0xc8;}else{_0x7408a1=0xce;}_0x3721be[_0x7966('0x20')](_0x7408a1);return _0x3721be['set'](_0x7966('0x25'),_0x4b18c9+'-'+_0x3c3609+'/'+_0x2db559)[_0x7966('0x21')](_0x300bd1);}return null;};}function patchUpdates(_0x4175f8){return function(_0x1006dd){try{jsonpatch[_0x7966('0x26')](_0x1006dd,_0x4175f8,!![]);}catch(_0x3a7c39){return BPromise[_0x7966('0x27')](_0x3a7c39);}return _0x1006dd[_0x7966('0x28')]();};}function saveUpdates(_0x5e22dd,_0x58f57b){return function(_0x3a894c){if(_0x3a894c){return _0x3a894c[_0x7966('0x29')](_0x5e22dd)['then'](function(_0x4d140c){return _0x4d140c;});}return null;};}function removeEntity(_0x5b5423,_0x29fd13){return function(_0x18d288){if(_0x18d288){return _0x18d288[_0x7966('0x2a')]()[_0x7966('0x2b')](function(){_0x5b5423['status'](0xcc)[_0x7966('0x2c')]();});}};}function handleEntityNotFound(_0x33c417,_0x4c7271){return function(_0x28c4fa){if(!_0x28c4fa){_0x33c417[_0x7966('0x1f')](0x194);}return _0x28c4fa;};}function handleError(_0x55bee5,_0x2db154){_0x2db154=_0x2db154||0x1f4;return function(_0x4ab761){logger[_0x7966('0x2d')](_0x4ab761[_0x7966('0x2e')]);if(_0x4ab761[_0x7966('0x2f')]){delete _0x4ab761[_0x7966('0x2f')];}_0x55bee5[_0x7966('0x20')](_0x2db154)[_0x7966('0x30')](_0x4ab761);};}exports['show']=function(_0x27c625,_0x344ecf){var _0x134157={'raw':![],'where':{'id':_0x27c625['params']['id']}},_0x5e5bdb={};_0x5e5bdb[_0x7966('0x31')]=_[_0x7966('0x32')](db[_0x7966('0x33')][_0x7966('0x34')]);_0x5e5bdb[_0x7966('0x35')]=_[_0x7966('0x32')](_0x27c625[_0x7966('0x35')]);_0x5e5bdb[_0x7966('0x36')]=_[_0x7966('0x37')](_0x5e5bdb[_0x7966('0x31')],_0x5e5bdb[_0x7966('0x35')]);_0x134157['attributes']=_[_0x7966('0x37')](_0x5e5bdb[_0x7966('0x31')],qs[_0x7966('0x38')](_0x27c625[_0x7966('0x35')][_0x7966('0x38')]));_0x134157['attributes']=_0x134157[_0x7966('0x39')][_0x7966('0x3a')]?_0x134157[_0x7966('0x39')]:_0x5e5bdb[_0x7966('0x31')];if(_0x27c625['query'][_0x7966('0x3b')]){_0x134157[_0x7966('0x3c')]=[{'all':!![]}];}_0x134157=_[_0x7966('0x3d')]({},_0x134157,_0x27c625[_0x7966('0x3e')]);return db[_0x7966('0x33')][_0x7966('0x3f')](_0x134157)[_0x7966('0x2b')](handleEntityNotFound(_0x344ecf,null))[_0x7966('0x2b')](respondWithResult(_0x344ecf,null))['catch'](handleError(_0x344ecf,null));};exports[_0x7966('0x2a')]=function(_0x10317b,_0x393cc9){return db[_0x7966('0x33')][_0x7966('0x3f')]({'where':{'id':_0x10317b[_0x7966('0x40')]['id']}})[_0x7966('0x2b')](handleEntityNotFound(_0x393cc9,null))[_0x7966('0x2b')](removeEntity(_0x393cc9,null))[_0x7966('0x41')](handleError(_0x393cc9,null));};function widgetAttributes(_0x56db31){try{switch(_0x56db31[_0x7966('0x42')]){case _0x7966('0x43'):return[{'name':_0x7966('0x44'),'value':_0x56db31[_0x7966('0x44')]||(_0x56db31[_0x7966('0x45')]&&_0x56db31['attrs'][0x0]?_0x56db31[_0x7966('0x45')][0x0][_0x7966('0x46')]:undefined)||'https://'}];case'custom':return[{'name':_0x7966('0x47'),'value':_0x56db31['attrPath']||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x0]?_0x56db31['attrs'][0x0]['value']:undefined)||''}];case _0x7966('0x48'):return[{'name':_0x7966('0x49'),'value':_0x56db31['attrHourFormat']||(_0x56db31[_0x7966('0x45')]&&_0x56db31['attrs'][0x0]?_0x56db31[_0x7966('0x45')][0x0][_0x7966('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x7966('0x4a'),'value':_0x56db31[_0x7966('0x4a')]||(_0x56db31['attrs']&&_0x56db31[_0x7966('0x45')][0x1]?_0x56db31[_0x7966('0x45')][0x1][_0x7966('0x46')]:undefined)||_0x7966('0x4b')},{'name':_0x7966('0x4c'),'value':_0x56db31['attrFontSize']||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x2]?_0x56db31[_0x7966('0x45')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x7966('0x4d'),'value':_0x56db31['attrMetric']||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x0]?_0x56db31[_0x7966('0x45')][0x0][_0x7966('0x46')]:undefined)||'total'},{'name':_0x7966('0x4e'),'value':_0x56db31[_0x7966('0x4e')]||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x1]?_0x56db31['attrs'][0x1][_0x7966('0x46')]:undefined)||[]},{'name':_0x7966('0x4c'),'value':_0x56db31['attrFontSize']||(_0x56db31['attrs']&&_0x56db31[_0x7966('0x45')][0x2]?_0x56db31[_0x7966('0x45')][0x2][_0x7966('0x46')]:undefined)||0x14}];case _0x7966('0x4f'):case'pie-chart':return[{'name':_0x7966('0x50'),'value':_0x56db31[_0x7966('0x50')]||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x0]?_0x56db31['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x56db31[_0x7966('0x51')]||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x1]?_0x56db31[_0x7966('0x45')][0x1][_0x7966('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x56db31[_0x7966('0x52')]||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x2]?_0x56db31[_0x7966('0x45')][0x2][_0x7966('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x56db31['attrVoiceQueues']||(_0x56db31[_0x7966('0x45')]&&_0x56db31[_0x7966('0x45')][0x3]?_0x56db31['attrs'][0x3]['value']:undefined)||[]}];case _0x7966('0x53'):return[{'name':_0x7966('0x54'),'type':_0x56db31[_0x7966('0x55')]||(_0x56db31[_0x7966('0x45')]&&_0x56db31['attrs'][0x0]?_0x56db31['attrs'][0x0][_0x7966('0x42')]:undefined)||null,'value':_0x56db31['attrReport']||(_0x56db31[_0x7966('0x45')]&&_0x56db31['attrs'][0x0]?_0x56db31[_0x7966('0x45')][0x0][_0x7966('0x46')]:undefined)||null},{'name':_0x7966('0x56'),'value':_0x56db31['attrRefresh']||(_0x56db31[_0x7966('0x45')]&&_0x56db31['attrs'][0x1]?_0x56db31[_0x7966('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1a5415){logger[_0x7966('0x2d')](_0x7966('0x57'),JSON['stringify'](_0x1a5415));return[];}}exports[_0x7966('0x58')]=function(_0x4925f4,_0xd680f8){if(_0x4925f4['body']){_0x4925f4['body']['attrs']=widgetAttributes(_0x4925f4[_0x7966('0x59')]);}return db[_0x7966('0x33')][_0x7966('0x58')](_0x4925f4['body'],{})[_0x7966('0x2b')](respondWithResult(_0xd680f8,0xc9))[_0x7966('0x41')](handleError(_0xd680f8,null));};exports['update']=function(_0x226379,_0x7f2469){if(_0x226379[_0x7966('0x59')]['id']){delete _0x226379[_0x7966('0x59')]['id'];}_0x226379[_0x7966('0x59')][_0x7966('0x45')]=widgetAttributes(_0x226379['body']);return db['DashboardItem']['find']({'where':{'id':_0x226379['params']['id']}})[_0x7966('0x2b')](handleEntityNotFound(_0x7f2469,null))[_0x7966('0x2b')](saveUpdates(_0x226379[_0x7966('0x59')],null))[_0x7966('0x2b')](respondWithResult(_0x7f2469,null))['catch'](handleError(_0x7f2469,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a222d4e..73f17d4 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 _0x5533=['DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x24248e,_0xa5b266){var _0x5a27c1=function(_0x44c48a){while(--_0x44c48a){_0x24248e['push'](_0x24248e['shift']());}};_0x5a27c1(++_0xa5b266);}(_0x5533,0x184));var _0x3553=function(_0xa9c98d,_0x17a058){_0xa9c98d=_0xa9c98d-0x0;var _0x567d6e=_0x5533[_0xa9c98d];return _0x567d6e;};'use strict';var EventEmitter=require(_0x3553('0x0'));var DashboardItem=require(_0x3553('0x1'))['db'][_0x3553('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3553('0x3')](0x0);var events={'afterCreate':_0x3553('0x4'),'afterUpdate':_0x3553('0x5'),'afterDestroy':'remove'};function emitEvent(_0x298b7e){return function(_0x3b06d3,_0x8617f9,_0x1a8e01){DashboardItemEvents['emit'](_0x298b7e+':'+_0x3b06d3['id'],_0x3b06d3);DashboardItemEvents[_0x3553('0x6')](_0x298b7e,_0x3b06d3);_0x1a8e01(null);};}for(var e in events){if(events[_0x3553('0x7')](e)){var event=events[e];DashboardItem[_0x3553('0x8')](e,emitEvent(event));}}module[_0x3553('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x96e4=['events','DashboardItem','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x512513,_0x43df34){var _0x2c2c5a=function(_0x18efcc){while(--_0x18efcc){_0x512513['push'](_0x512513['shift']());}};_0x2c2c5a(++_0x43df34);}(_0x96e4,0x111));var _0x496e=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x96e4[_0x3acee8];return _0x5046cc;};'use strict';var EventEmitter=require(_0x496e('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x496e('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x496e('0x2')](0x0);var events={'afterCreate':_0x496e('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xfee912){return function(_0x3c1616,_0x2396e7,_0x3b17f7){DashboardItemEvents[_0x496e('0x4')](_0xfee912+':'+_0x3c1616['id'],_0x3c1616);DashboardItemEvents[_0x496e('0x4')](_0xfee912,_0x3c1616);_0x3b17f7(null);};}for(var e in events){if(events[_0x496e('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x496e('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 18542fb..6f04517 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 _0x2fc8=['DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4b4079,_0x5f0a66){var _0x311810=function(_0x216392){while(--_0x216392){_0x4b4079['push'](_0x4b4079['shift']());}};_0x311810(++_0x5f0a66);}(_0x2fc8,0x86));var _0x82fc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2fc8[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x82fc('0x0'));var logger=require(_0x82fc('0x1'))(_0x82fc('0x2'));var moment=require(_0x82fc('0x3'));var BPromise=require(_0x82fc('0x4'));var rp=require(_0x82fc('0x5'));var fs=require('fs');var path=require(_0x82fc('0x6'));var rimraf=require(_0x82fc('0x7'));var config=require(_0x82fc('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x82fc('0x9')]=function(_0x12aca6,_0x4e87f){return _0x12aca6['define'](_0x82fc('0xa'),attributes,{'tableName':_0x82fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd00=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x577077,_0x52f056){var _0x370769=function(_0x34d109){while(--_0x34d109){_0x577077['push'](_0x577077['shift']());}};_0x370769(++_0x52f056);}(_0xbd00,0x1a7));var _0x0bd0=function(_0x26b462,_0x4a2fe2){_0x26b462=_0x26b462-0x0;var _0x5050af=_0xbd00[_0x26b462];return _0x5050af;};'use strict';var _=require(_0x0bd0('0x0'));var util=require(_0x0bd0('0x1'));var logger=require(_0x0bd0('0x2'))(_0x0bd0('0x3'));var moment=require(_0x0bd0('0x4'));var BPromise=require(_0x0bd0('0x5'));var rp=require(_0x0bd0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd0('0x7'));var config=require(_0x0bd0('0x8'));var attributes=require(_0x0bd0('0x9'));module[_0x0bd0('0xa')]=function(_0x4a6c45,_0x29344c){return _0x4a6c45[_0x0bd0('0xb')](_0x0bd0('0xc'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0193b92..f08227f 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 _0x4587=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x2caf9f,_0x431df0){var _0x4b44ee=function(_0x1c3c07){while(--_0x1c3c07){_0x2caf9f['push'](_0x2caf9f['shift']());}};_0x4b44ee(++_0x431df0);}(_0x4587,0x8f));var _0x7458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4587[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7458('0x0'));var BPromise=require(_0x7458('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7458('0x2'));var db=require(_0x7458('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7458('0x4'))(_0x7458('0x5'));var config=require('../../config/environment');var jayson=require(_0x7458('0x6'));var client=jayson['client'][_0x7458('0x7')]({'port':0x232a});config[_0x7458('0x8')]=_[_0x7458('0x9')](config['redis'],{'host':_0x7458('0xa'),'port':0x18eb});var socket=require(_0x7458('0xb'))(new Redis(config[_0x7458('0x8')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x3823da,_0x5e23b7,_0x3022de){return new BPromise(function(_0x3fcc12,_0x2e9b92){return client[_0x7458('0xc')](_0x3823da,_0x3022de)[_0x7458('0xd')](function(_0x428e4e){logger[_0x7458('0xe')]('DashboardItem,\x20%s,\x20%s',_0x5e23b7,_0x7458('0xf'));logger[_0x7458('0x10')](_0x7458('0x11'),_0x5e23b7,_0x7458('0xf'),JSON[_0x7458('0x12')](_0x428e4e));if(_0x428e4e['error']){if(_0x428e4e['error']['code']===0x1f4){logger[_0x7458('0x13')](_0x7458('0x14'),_0x5e23b7,_0x428e4e[_0x7458('0x13')][_0x7458('0x15')]);return _0x2e9b92(_0x428e4e[_0x7458('0x13')][_0x7458('0x15')]);}logger[_0x7458('0x13')](_0x7458('0x14'),_0x5e23b7,_0x428e4e[_0x7458('0x13')][_0x7458('0x15')]);return _0x3fcc12(_0x428e4e[_0x7458('0x13')]['message']);}else{logger[_0x7458('0xe')]('DashboardItem,\x20%s,\x20%s',_0x5e23b7,_0x7458('0xf'));_0x3fcc12(_0x428e4e[_0x7458('0x16')]['message']);}})[_0x7458('0x17')](function(_0x3078ec){logger[_0x7458('0x13')](_0x7458('0x14'),_0x5e23b7,_0x3078ec);_0x2e9b92(_0x3078ec);});});} \ No newline at end of file +var _0x77ff=['DashboardItem,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','register','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x1d3a89,_0x200254){var _0x4e523f=function(_0xf9ed20){while(--_0xf9ed20){_0x1d3a89['push'](_0x1d3a89['shift']());}};_0x4e523f(++_0x200254);}(_0x77ff,0x103));var _0xf77f=function(_0x462042,_0x524279){_0x462042=_0x462042-0x0;var _0x585608=_0x77ff[_0x462042];return _0x585608;};'use strict';var _=require(_0xf77f('0x0'));var util=require(_0xf77f('0x1'));var moment=require(_0xf77f('0x2'));var BPromise=require(_0xf77f('0x3'));var rs=require(_0xf77f('0x4'));var fs=require('fs');var Redis=require(_0xf77f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf77f('0x6'));var logger=require(_0xf77f('0x7'))(_0xf77f('0x8'));var config=require(_0xf77f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf77f('0xa')]['http']({'port':0x232a});config[_0xf77f('0xb')]=_[_0xf77f('0xc')](config[_0xf77f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf77f('0xb')]));require('./dashboardItem.socket')[_0xf77f('0xd')](socket);function respondWithRpcPromise(_0xa100b3,_0x5c38a6,_0x330adb){return new BPromise(function(_0x221b6f,_0x5bb321){return client['request'](_0xa100b3,_0x330adb)[_0xf77f('0xe')](function(_0x5e6a2e){logger[_0xf77f('0xf')](_0xf77f('0x10'),_0x5c38a6,'request\x20sent');logger['debug'](_0xf77f('0x11'),_0x5c38a6,'request\x20sent',JSON['stringify'](_0x5e6a2e));if(_0x5e6a2e[_0xf77f('0x12')]){if(_0x5e6a2e[_0xf77f('0x12')]['code']===0x1f4){logger[_0xf77f('0x12')](_0xf77f('0x10'),_0x5c38a6,_0x5e6a2e[_0xf77f('0x12')][_0xf77f('0x13')]);return _0x5bb321(_0x5e6a2e['error'][_0xf77f('0x13')]);}logger[_0xf77f('0x12')](_0xf77f('0x10'),_0x5c38a6,_0x5e6a2e['error']['message']);return _0x221b6f(_0x5e6a2e['error']['message']);}else{logger['info'](_0xf77f('0x10'),_0x5c38a6,_0xf77f('0x14'));_0x221b6f(_0x5e6a2e[_0xf77f('0x15')][_0xf77f('0x13')]);}})[_0xf77f('0x16')](function(_0x4ac3c4){logger[_0xf77f('0x12')](_0xf77f('0x10'),_0x5c38a6,_0x4ac3c4);_0x5bb321(_0x4ac3c4);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a83b76f..0554788 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 _0x40e8=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','length'];(function(_0x2be226,_0x54b4df){var _0x15713f=function(_0x30f48e){while(--_0x30f48e){_0x2be226['push'](_0x2be226['shift']());}};_0x15713f(++_0x54b4df);}(_0x40e8,0x199));var _0x840e=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x40e8[_0x378720];return _0x47920a;};'use strict';var DashboardItemEvents=require(_0x840e('0x0'));var events=[_0x840e('0x1'),_0x840e('0x2'),_0x840e('0x3')];function createListener(_0x134720,_0x342284){return function(_0x1e5eaf){_0x342284[_0x840e('0x4')](_0x134720,_0x1e5eaf);};}function removeListener(_0x363dce,_0x50d741){return function(){DashboardItemEvents[_0x840e('0x5')](_0x363dce,_0x50d741);};}exports['register']=function(_0x135df0){for(var _0x13615f=0x0,_0x1f97bb=events[_0x840e('0x6')];_0x13615f<_0x1f97bb;_0x13615f++){var _0x284491=events[_0x13615f];var _0x31db6e=createListener(_0x840e('0x7')+_0x284491,_0x135df0);DashboardItemEvents['on'](_0x284491,_0x31db6e);}}; \ No newline at end of file +var _0xce67=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x2360f0,_0xed69da){var _0x15b866=function(_0x2c7fc7){while(--_0x2c7fc7){_0x2360f0['push'](_0x2360f0['shift']());}};_0x15b866(++_0xed69da);}(_0xce67,0x12f));var _0x7ce6=function(_0x103395,_0x268b69){_0x103395=_0x103395-0x0;var _0x3e7913=_0xce67[_0x103395];return _0x3e7913;};'use strict';var DashboardItemEvents=require(_0x7ce6('0x0'));var events=[_0x7ce6('0x1'),_0x7ce6('0x2'),_0x7ce6('0x3')];function createListener(_0x3d1fa7,_0x456ae9){return function(_0x354ff0){_0x456ae9[_0x7ce6('0x4')](_0x3d1fa7,_0x354ff0);};}function removeListener(_0xbbdd11,_0x203a0f){return function(){DashboardItemEvents[_0x7ce6('0x5')](_0xbbdd11,_0x203a0f);};}exports[_0x7ce6('0x6')]=function(_0x17bb88){for(var _0x394e09=0x0,_0xcf973f=events[_0x7ce6('0x7')];_0x394e09<_0xcf973f;_0x394e09++){var _0xf88438=events[_0x394e09];var _0x496648=createListener(_0x7ce6('0x8')+_0xf88438,_0x17bb88);DashboardItemEvents['on'](_0xf88438,_0x496648);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d28ee9c..01f3bf6 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 _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2a75cd,_0x247962){_0x2a75cd=_0x2a75cd-0x0;var _0x2319bc=_0xf2ca[_0x2a75cd];return _0x2319bc;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0x7217=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7217,0x19e));var _0x7721=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7217[_0x4709c0];return _0x13348b;};'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 auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0xb')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller['destroy']);module[_0x7721('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 5f3b317..bef0e56 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 _0xb96c=['STRING','sequelize','exports','first','second','third'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0xb96c,0x1b7));var _0xcb96=function(_0x1a1f55,_0x104f1f){_0x1a1f55=_0x1a1f55-0x0;var _0xc11b2b=_0xb96c[_0x1a1f55];return _0xc11b2b;};'use strict';var Sequelize=require(_0xcb96('0x0'));module[_0xcb96('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xcb96('0x2'),_0xcb96('0x3'),_0xcb96('0x4')),'allowNull':![],'defaultValue':_0xcb96('0x2')},'description':{'type':Sequelize[_0xcb96('0x5')]}}; \ No newline at end of file +var _0x8dcb=['second','third','sequelize','STRING','ENUM'];(function(_0xaa3590,_0x31360f){var _0xec47ee=function(_0x12cea7){while(--_0x12cea7){_0xaa3590['push'](_0xaa3590['shift']());}};_0xec47ee(++_0x31360f);}(_0x8dcb,0x6b));var _0xb8dc=function(_0x2d3000,_0x424572){_0x2d3000=_0x2d3000-0x0;var _0xab6ac8=_0x8dcb[_0x2d3000];return _0xab6ac8;};'use strict';var Sequelize=require(_0xb8dc('0x0'));module['exports']={'name':{'type':Sequelize[_0xb8dc('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xb8dc('0x2')]('first',_0xb8dc('0x3'),_0xb8dc('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xb8dc('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6559067..20c1d11 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 _0x5c99=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','Dispositions','destroy','error','stack','name','index','map','Disposition','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','create','user','get'];(function(_0x421b55,_0x1db550){var _0x32da0a=function(_0xd90c69){while(--_0xd90c69){_0x421b55['push'](_0x421b55['shift']());}};_0x32da0a(++_0x1db550);}(_0x5c99,0x1b8));var _0x95c9=function(_0x1892f9,_0x2cb4ab){_0x1892f9=_0x1892f9-0x0;var _0x5a765f=_0x5c99[_0x1892f9];return _0x5a765f;};'use strict';var pdf=require(_0x95c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x95c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95c9('0x2'));var rp=require(_0x95c9('0x3'));var moment=require(_0x95c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x95c9('0x5'));var util=require(_0x95c9('0x6'));var path=require('path');var sox=require(_0x95c9('0x7'));var csv=require(_0x95c9('0x8'));var ejs=require(_0x95c9('0x9'));var fs=require('fs');var _=require(_0x95c9('0xa'));var squel=require(_0x95c9('0xb'));var crypto=require(_0x95c9('0xc'));var jsforce=require(_0x95c9('0xd'));var deskjs=require(_0x95c9('0xe'));var toCsv=require(_0x95c9('0x8'));var querystring=require(_0x95c9('0xf'));var Papa=require(_0x95c9('0x10'));var Redis=require(_0x95c9('0x11'));var authService=require(_0x95c9('0x12'));var qs=require(_0x95c9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95c9('0x14'));var logger=require(_0x95c9('0x15'))(_0x95c9('0x16'));var utils=require(_0x95c9('0x17'));var config=require(_0x95c9('0x18'));var licenseUtil=require(_0x95c9('0x19'));var db=require(_0x95c9('0x1a'))['db'];function respondWithStatusCode(_0x28cfcb,_0x36d738){_0x36d738=_0x36d738||0xcc;return function(_0x4babcf){if(_0x4babcf){return _0x28cfcb[_0x95c9('0x1b')](_0x36d738);}return _0x28cfcb[_0x95c9('0x1c')](_0x36d738)[_0x95c9('0x1d')]();};}function respondWithResult(_0x169a7d,_0x2c6300){_0x2c6300=_0x2c6300||0xc8;return function(_0x2393ae){if(_0x2393ae){return _0x169a7d[_0x95c9('0x1c')](_0x2c6300)['json'](_0x2393ae);}};}function respondWithFilteredResult(_0x2e596d,_0x25fb39){return function(_0x52350d){if(_0x52350d){var _0x541026=_0x52350d[_0x95c9('0x1e')],_0x13d28f=_0x25fb39[_0x95c9('0x1f')],_0x229ecd=_0x25fb39['offset']+_0x25fb39[_0x95c9('0x20')],_0x2e48b7;if(_0x229ecd>=_0x541026){_0x229ecd=_0x541026;_0x2e48b7=0xc8;}else{_0x2e48b7=0xce;}_0x2e596d['status'](_0x2e48b7);return _0x2e596d['set'](_0x95c9('0x21'),_0x13d28f+'-'+_0x229ecd+'/'+_0x541026)[_0x95c9('0x22')](_0x52350d);}return null;};}function patchUpdates(_0x24fe07){return function(_0x302a91){try{jsonpatch[_0x95c9('0x23')](_0x302a91,_0x24fe07,!![]);}catch(_0x5c4793){return BPromise['reject'](_0x5c4793);}return _0x302a91[_0x95c9('0x24')]();};}function saveUpdates(_0x27641d,_0x7d5b2d){return function(_0x4bda4f){if(_0x4bda4f){return _0x4bda4f[_0x95c9('0x25')](_0x27641d)[_0x95c9('0x26')](function(_0x2e13f8){return _0x2e13f8;});}return null;};}function removeEntity(_0x216c5b,_0x299b47){return function(_0x2e17fd){if(_0x2e17fd){return _0x2e17fd['destroy']()[_0x95c9('0x26')](function(){var _0x36d4a7=_0x2e17fd['get']({'plain':!![]});var _0x1a7f43=_0x95c9('0x27');return db['UserProfileResource'][_0x95c9('0x28')]({'where':{'type':_0x1a7f43,'resourceId':_0x36d4a7['id']}})[_0x95c9('0x26')](function(){return _0x2e17fd;});})[_0x95c9('0x26')](function(){_0x216c5b['status'](0xcc)[_0x95c9('0x1d')]();});}};}function handleEntityNotFound(_0x101bcb,_0x2529f6){return function(_0x3ed1a9){if(!_0x3ed1a9){_0x101bcb['sendStatus'](0x194);}return _0x3ed1a9;};}function handleError(_0x2a3dfd,_0x82dc7d){_0x82dc7d=_0x82dc7d||0x1f4;return function(_0x61bf6f){logger[_0x95c9('0x29')](_0x61bf6f[_0x95c9('0x2a')]);if(_0x61bf6f['name']){delete _0x61bf6f[_0x95c9('0x2b')];}_0x2a3dfd[_0x95c9('0x1c')](_0x82dc7d)['send'](_0x61bf6f);};}exports[_0x95c9('0x2c')]=function(_0x39074c,_0x4997a2){var _0x5ce34f={},_0x10e0ae={},_0x1849d0={'count':0x0,'rows':[]};var _0x5831fc=_[_0x95c9('0x2d')](db[_0x95c9('0x2e')][_0x95c9('0x2f')],function(_0x3716c6){return{'name':_0x3716c6[_0x95c9('0x30')],'type':_0x3716c6['type']['key']};});_0x10e0ae[_0x95c9('0x31')]=_['map'](_0x5831fc,_0x95c9('0x2b'));_0x10e0ae[_0x95c9('0x32')]=_[_0x95c9('0x33')](_0x39074c[_0x95c9('0x32')]);_0x10e0ae[_0x95c9('0x34')]=_[_0x95c9('0x35')](_0x10e0ae['model'],_0x10e0ae[_0x95c9('0x32')]);_0x5ce34f['attributes']=_[_0x95c9('0x35')](_0x10e0ae[_0x95c9('0x31')],qs[_0x95c9('0x36')](_0x39074c[_0x95c9('0x32')][_0x95c9('0x36')]));_0x5ce34f[_0x95c9('0x37')]=_0x5ce34f[_0x95c9('0x37')][_0x95c9('0x38')]?_0x5ce34f['attributes']:_0x10e0ae[_0x95c9('0x31')];if(!_0x39074c[_0x95c9('0x32')][_0x95c9('0x39')](_0x95c9('0x3a'))){_0x5ce34f['limit']=qs[_0x95c9('0x20')](_0x39074c[_0x95c9('0x32')][_0x95c9('0x20')]);_0x5ce34f[_0x95c9('0x1f')]=qs['offset'](_0x39074c['query']['offset']);}_0x5ce34f[_0x95c9('0x3b')]=qs[_0x95c9('0x3c')](_0x39074c[_0x95c9('0x32')]['sort']);_0x5ce34f['where']=qs[_0x95c9('0x34')](_[_0x95c9('0x3d')](_0x39074c[_0x95c9('0x32')],_0x10e0ae['filters']),_0x5831fc);if(_0x39074c['query'][_0x95c9('0x3e')]){_0x5ce34f[_0x95c9('0x3f')]=_[_0x95c9('0x40')](_0x5ce34f['where'],{'$or':_[_0x95c9('0x2d')](_0x5831fc,function(_0x1ad16a){if(_0x1ad16a[_0x95c9('0x41')]!==_0x95c9('0x42')){var _0x44ea45={};_0x44ea45[_0x1ad16a[_0x95c9('0x2b')]]={'$like':'%'+_0x39074c[_0x95c9('0x32')]['filter']+'%'};return _0x44ea45;}})});}_0x5ce34f=_[_0x95c9('0x40')]({},_0x5ce34f,_0x39074c[_0x95c9('0x43')]);var _0x2a0ba8={'where':_0x5ce34f[_0x95c9('0x3f')]};return db[_0x95c9('0x2e')][_0x95c9('0x1e')](_0x2a0ba8)[_0x95c9('0x26')](function(_0x54b9ee){_0x1849d0[_0x95c9('0x1e')]=_0x54b9ee;if(_0x39074c['query'][_0x95c9('0x44')]){_0x5ce34f[_0x95c9('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x95c9('0x46')](_0x5ce34f);})[_0x95c9('0x26')](function(_0x3fb110){_0x1849d0['rows']=_0x3fb110;return _0x1849d0;})[_0x95c9('0x26')](respondWithFilteredResult(_0x4997a2,_0x5ce34f))['catch'](handleError(_0x4997a2,null));};exports[_0x95c9('0x47')]=function(_0x5b9825,_0x38f036){var _0x33cf13={'raw':!![],'where':{'id':_0x5b9825['params']['id']}},_0x373bc2={};_0x373bc2[_0x95c9('0x31')]=_['keys'](db[_0x95c9('0x2e')][_0x95c9('0x2f')]);_0x373bc2[_0x95c9('0x32')]=_[_0x95c9('0x33')](_0x5b9825[_0x95c9('0x32')]);_0x373bc2['filters']=_[_0x95c9('0x35')](_0x373bc2['model'],_0x373bc2['query']);_0x33cf13['attributes']=_[_0x95c9('0x35')](_0x373bc2[_0x95c9('0x31')],qs[_0x95c9('0x36')](_0x5b9825[_0x95c9('0x32')][_0x95c9('0x36')]));_0x33cf13['attributes']=_0x33cf13['attributes'][_0x95c9('0x38')]?_0x33cf13['attributes']:_0x373bc2[_0x95c9('0x31')];if(_0x5b9825['query'][_0x95c9('0x44')]){_0x33cf13['include']=[{'all':!![]}];}_0x33cf13=_['merge']({},_0x33cf13,_0x5b9825[_0x95c9('0x43')]);return db[_0x95c9('0x2e')][_0x95c9('0x48')](_0x33cf13)[_0x95c9('0x26')](handleEntityNotFound(_0x38f036,null))[_0x95c9('0x26')](respondWithResult(_0x38f036,null))['catch'](handleError(_0x38f036,null));};exports[_0x95c9('0x49')]=function(_0x41a850,_0x2b37b4){return db[_0x95c9('0x2e')]['create'](_0x41a850['body'],{})[_0x95c9('0x26')](function(_0x1abdd8){var _0x299c05=_0x41a850[_0x95c9('0x4a')][_0x95c9('0x4b')]({'plain':!![]});if(!_0x299c05)throw new Error(_0x95c9('0x4c'));if(_0x299c05[_0x95c9('0x4d')]==='user'){var _0x9c0290=_0x1abdd8[_0x95c9('0x4b')]({'plain':!![]});var _0x513b7f='Dispositions';return db[_0x95c9('0x4e')]['find']({'where':{'name':_0x513b7f,'userProfileId':_0x299c05[_0x95c9('0x4f')]},'raw':!![]})[_0x95c9('0x26')](function(_0x3e8c4b){if(_0x3e8c4b&&_0x3e8c4b[_0x95c9('0x50')]===0x0){return db[_0x95c9('0x51')][_0x95c9('0x49')]({'name':_0x9c0290[_0x95c9('0x2b')],'resourceId':_0x9c0290['id'],'type':_0x3e8c4b[_0x95c9('0x2b')],'sectionId':_0x3e8c4b['id']},{})[_0x95c9('0x26')](function(){return _0x1abdd8;});}else{return _0x1abdd8;}})[_0x95c9('0x52')](function(_0x30e161){logger['error'](_0x95c9('0x53'),_0x30e161);throw _0x30e161;});}return _0x1abdd8;})['then'](respondWithResult(_0x2b37b4,0xc9))[_0x95c9('0x52')](handleError(_0x2b37b4,null));};exports[_0x95c9('0x25')]=function(_0x3d707b,_0x44bef6){if(_0x3d707b[_0x95c9('0x54')]['id']){delete _0x3d707b[_0x95c9('0x54')]['id'];}return db[_0x95c9('0x2e')]['find']({'where':{'id':_0x3d707b[_0x95c9('0x55')]['id']}})[_0x95c9('0x26')](handleEntityNotFound(_0x44bef6,null))[_0x95c9('0x26')](saveUpdates(_0x3d707b['body'],null))[_0x95c9('0x26')](respondWithResult(_0x44bef6,null))[_0x95c9('0x52')](handleError(_0x44bef6,null));};exports[_0x95c9('0x28')]=function(_0x55b4c3,_0x2538e0){return db['Disposition']['find']({'where':{'id':_0x55b4c3[_0x95c9('0x55')]['id']}})[_0x95c9('0x26')](handleEntityNotFound(_0x2538e0,null))[_0x95c9('0x26')](removeEntity(_0x2538e0,null))[_0x95c9('0x52')](handleError(_0x2538e0,null));}; \ No newline at end of file +var _0xeeea=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','Dispositions','UserProfileResource','destroy','error','stack','name','index','map','Disposition','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body'];(function(_0x520138,_0x28b48e){var _0x46b0bf=function(_0x13798e){while(--_0x13798e){_0x520138['push'](_0x520138['shift']());}};_0x46b0bf(++_0x28b48e);}(_0xeeea,0x148));var _0xaeee=function(_0x13111c,_0x5c3c95){_0x13111c=_0x13111c-0x0;var _0x4ff4f9=_0xeeea[_0x13111c];return _0x4ff4f9;};'use strict';var pdf=require(_0xaeee('0x0'));var emlformat=require(_0xaeee('0x1'));var rimraf=require(_0xaeee('0x2'));var zipdir=require(_0xaeee('0x3'));var jsonpatch=require(_0xaeee('0x4'));var rp=require(_0xaeee('0x5'));var moment=require('moment');var BPromise=require(_0xaeee('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaeee('0x7'));var sox=require(_0xaeee('0x8'));var csv=require(_0xaeee('0x9'));var ejs=require(_0xaeee('0xa'));var fs=require('fs');var _=require(_0xaeee('0xb'));var squel=require(_0xaeee('0xc'));var crypto=require(_0xaeee('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaeee('0x9'));var querystring=require(_0xaeee('0xe'));var Papa=require(_0xaeee('0xf'));var Redis=require(_0xaeee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaeee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaeee('0x12'))(_0xaeee('0x13'));var utils=require(_0xaeee('0x14'));var config=require(_0xaeee('0x15'));var licenseUtil=require(_0xaeee('0x16'));var db=require(_0xaeee('0x17'))['db'];function respondWithStatusCode(_0xf21285,_0xa166f4){_0xa166f4=_0xa166f4||0xcc;return function(_0x47006b){if(_0x47006b){return _0xf21285[_0xaeee('0x18')](_0xa166f4);}return _0xf21285[_0xaeee('0x19')](_0xa166f4)[_0xaeee('0x1a')]();};}function respondWithResult(_0xe6aafb,_0x2733de){_0x2733de=_0x2733de||0xc8;return function(_0x1f223e){if(_0x1f223e){return _0xe6aafb[_0xaeee('0x19')](_0x2733de)['json'](_0x1f223e);}};}function respondWithFilteredResult(_0x8ab970,_0x410e2e){return function(_0x2a6459){if(_0x2a6459){var _0x9f148=_0x2a6459[_0xaeee('0x1b')],_0x4438c7=_0x410e2e[_0xaeee('0x1c')],_0x4b3efb=_0x410e2e['offset']+_0x410e2e['limit'],_0xc489c5;if(_0x4b3efb>=_0x9f148){_0x4b3efb=_0x9f148;_0xc489c5=0xc8;}else{_0xc489c5=0xce;}_0x8ab970[_0xaeee('0x19')](_0xc489c5);return _0x8ab970[_0xaeee('0x1d')](_0xaeee('0x1e'),_0x4438c7+'-'+_0x4b3efb+'/'+_0x9f148)[_0xaeee('0x1f')](_0x2a6459);}return null;};}function patchUpdates(_0x5a3efb){return function(_0x1e8365){try{jsonpatch[_0xaeee('0x20')](_0x1e8365,_0x5a3efb,!![]);}catch(_0x4c1d14){return BPromise[_0xaeee('0x21')](_0x4c1d14);}return _0x1e8365[_0xaeee('0x22')]();};}function saveUpdates(_0x37bb6a,_0x332c0e){return function(_0x27de6){if(_0x27de6){return _0x27de6['update'](_0x37bb6a)[_0xaeee('0x23')](function(_0x127fe4){return _0x127fe4;});}return null;};}function removeEntity(_0x4ba9eb,_0x515751){return function(_0xb3f2e5){if(_0xb3f2e5){return _0xb3f2e5['destroy']()[_0xaeee('0x23')](function(){var _0x1ae6fc=_0xb3f2e5['get']({'plain':!![]});var _0x24abbb=_0xaeee('0x24');return db[_0xaeee('0x25')][_0xaeee('0x26')]({'where':{'type':_0x24abbb,'resourceId':_0x1ae6fc['id']}})[_0xaeee('0x23')](function(){return _0xb3f2e5;});})['then'](function(){_0x4ba9eb[_0xaeee('0x19')](0xcc)[_0xaeee('0x1a')]();});}};}function handleEntityNotFound(_0x2794cd,_0x1fe1d7){return function(_0x36235c){if(!_0x36235c){_0x2794cd[_0xaeee('0x18')](0x194);}return _0x36235c;};}function handleError(_0x3eda98,_0x5473ce){_0x5473ce=_0x5473ce||0x1f4;return function(_0x2df555){logger[_0xaeee('0x27')](_0x2df555[_0xaeee('0x28')]);if(_0x2df555[_0xaeee('0x29')]){delete _0x2df555[_0xaeee('0x29')];}_0x3eda98[_0xaeee('0x19')](_0x5473ce)['send'](_0x2df555);};}exports[_0xaeee('0x2a')]=function(_0x4b28b3,_0x45dfed){var _0x2b3ed2={},_0x4ea167={},_0x42628f={'count':0x0,'rows':[]};var _0x2dc47b=_[_0xaeee('0x2b')](db[_0xaeee('0x2c')][_0xaeee('0x2d')],function(_0x51cac1){return{'name':_0x51cac1['fieldName'],'type':_0x51cac1['type']['key']};});_0x4ea167[_0xaeee('0x2e')]=_[_0xaeee('0x2b')](_0x2dc47b,_0xaeee('0x29'));_0x4ea167['query']=_[_0xaeee('0x2f')](_0x4b28b3[_0xaeee('0x30')]);_0x4ea167[_0xaeee('0x31')]=_[_0xaeee('0x32')](_0x4ea167[_0xaeee('0x2e')],_0x4ea167['query']);_0x2b3ed2[_0xaeee('0x33')]=_[_0xaeee('0x32')](_0x4ea167[_0xaeee('0x2e')],qs['fields'](_0x4b28b3['query'][_0xaeee('0x34')]));_0x2b3ed2[_0xaeee('0x33')]=_0x2b3ed2['attributes']['length']?_0x2b3ed2[_0xaeee('0x33')]:_0x4ea167[_0xaeee('0x2e')];if(!_0x4b28b3[_0xaeee('0x30')][_0xaeee('0x35')](_0xaeee('0x36'))){_0x2b3ed2['limit']=qs[_0xaeee('0x37')](_0x4b28b3[_0xaeee('0x30')][_0xaeee('0x37')]);_0x2b3ed2[_0xaeee('0x1c')]=qs[_0xaeee('0x1c')](_0x4b28b3[_0xaeee('0x30')]['offset']);}_0x2b3ed2[_0xaeee('0x38')]=qs['sort'](_0x4b28b3['query'][_0xaeee('0x39')]);_0x2b3ed2[_0xaeee('0x3a')]=qs[_0xaeee('0x31')](_[_0xaeee('0x3b')](_0x4b28b3['query'],_0x4ea167[_0xaeee('0x31')]),_0x2dc47b);if(_0x4b28b3[_0xaeee('0x30')]['filter']){_0x2b3ed2[_0xaeee('0x3a')]=_[_0xaeee('0x3c')](_0x2b3ed2['where'],{'$or':_[_0xaeee('0x2b')](_0x2dc47b,function(_0x51ef48){if(_0x51ef48['type']!=='VIRTUAL'){var _0x251a28={};_0x251a28[_0x51ef48[_0xaeee('0x29')]]={'$like':'%'+_0x4b28b3['query'][_0xaeee('0x3d')]+'%'};return _0x251a28;}})});}_0x2b3ed2=_[_0xaeee('0x3c')]({},_0x2b3ed2,_0x4b28b3[_0xaeee('0x3e')]);var _0xbd52b9={'where':_0x2b3ed2[_0xaeee('0x3a')]};return db[_0xaeee('0x2c')]['count'](_0xbd52b9)[_0xaeee('0x23')](function(_0x32c3d9){_0x42628f['count']=_0x32c3d9;if(_0x4b28b3[_0xaeee('0x30')]['includeAll']){_0x2b3ed2[_0xaeee('0x3f')]=[{'all':!![]}];}return db[_0xaeee('0x2c')][_0xaeee('0x40')](_0x2b3ed2);})[_0xaeee('0x23')](function(_0x43efd3){_0x42628f[_0xaeee('0x41')]=_0x43efd3;return _0x42628f;})['then'](respondWithFilteredResult(_0x45dfed,_0x2b3ed2))[_0xaeee('0x42')](handleError(_0x45dfed,null));};exports[_0xaeee('0x43')]=function(_0xaf7d73,_0x21376b){var _0x3fe19e={'raw':!![],'where':{'id':_0xaf7d73[_0xaeee('0x44')]['id']}},_0x3800d3={};_0x3800d3[_0xaeee('0x2e')]=_[_0xaeee('0x2f')](db['Disposition']['rawAttributes']);_0x3800d3['query']=_[_0xaeee('0x2f')](_0xaf7d73[_0xaeee('0x30')]);_0x3800d3[_0xaeee('0x31')]=_['intersection'](_0x3800d3[_0xaeee('0x2e')],_0x3800d3[_0xaeee('0x30')]);_0x3fe19e[_0xaeee('0x33')]=_[_0xaeee('0x32')](_0x3800d3[_0xaeee('0x2e')],qs['fields'](_0xaf7d73[_0xaeee('0x30')][_0xaeee('0x34')]));_0x3fe19e['attributes']=_0x3fe19e[_0xaeee('0x33')][_0xaeee('0x45')]?_0x3fe19e['attributes']:_0x3800d3[_0xaeee('0x2e')];if(_0xaf7d73[_0xaeee('0x30')]['includeAll']){_0x3fe19e[_0xaeee('0x3f')]=[{'all':!![]}];}_0x3fe19e=_[_0xaeee('0x3c')]({},_0x3fe19e,_0xaf7d73['options']);return db[_0xaeee('0x2c')][_0xaeee('0x46')](_0x3fe19e)['then'](handleEntityNotFound(_0x21376b,null))['then'](respondWithResult(_0x21376b,null))['catch'](handleError(_0x21376b,null));};exports[_0xaeee('0x47')]=function(_0x47527e,_0x3b7546){return db[_0xaeee('0x2c')][_0xaeee('0x47')](_0x47527e['body'],{})['then'](function(_0x43a0dc){var _0x2443e8=_0x47527e[_0xaeee('0x48')]['get']({'plain':!![]});if(!_0x2443e8)throw new Error(_0xaeee('0x49'));if(_0x2443e8[_0xaeee('0x4a')]===_0xaeee('0x48')){var _0x25eaf2=_0x43a0dc[_0xaeee('0x4b')]({'plain':!![]});var _0x573463=_0xaeee('0x24');return db[_0xaeee('0x4c')][_0xaeee('0x46')]({'where':{'name':_0x573463,'userProfileId':_0x2443e8[_0xaeee('0x4d')]},'raw':!![]})[_0xaeee('0x23')](function(_0x1a178b){if(_0x1a178b&&_0x1a178b[_0xaeee('0x4e')]===0x0){return db[_0xaeee('0x25')][_0xaeee('0x47')]({'name':_0x25eaf2[_0xaeee('0x29')],'resourceId':_0x25eaf2['id'],'type':_0x1a178b['name'],'sectionId':_0x1a178b['id']},{})[_0xaeee('0x23')](function(){return _0x43a0dc;});}else{return _0x43a0dc;}})[_0xaeee('0x42')](function(_0x49bc97){logger[_0xaeee('0x27')](_0xaeee('0x4f'),_0x49bc97);throw _0x49bc97;});}return _0x43a0dc;})['then'](respondWithResult(_0x3b7546,0xc9))[_0xaeee('0x42')](handleError(_0x3b7546,null));};exports[_0xaeee('0x50')]=function(_0x5cf3f6,_0x27e186){if(_0x5cf3f6['body']['id']){delete _0x5cf3f6[_0xaeee('0x51')]['id'];}return db['Disposition'][_0xaeee('0x46')]({'where':{'id':_0x5cf3f6[_0xaeee('0x44')]['id']}})[_0xaeee('0x23')](handleEntityNotFound(_0x27e186,null))['then'](saveUpdates(_0x5cf3f6[_0xaeee('0x51')],null))[_0xaeee('0x23')](respondWithResult(_0x27e186,null))[_0xaeee('0x42')](handleError(_0x27e186,null));};exports[_0xaeee('0x26')]=function(_0x5626bf,_0x4c06c7){return db[_0xaeee('0x2c')][_0xaeee('0x46')]({'where':{'id':_0x5626bf[_0xaeee('0x44')]['id']}})[_0xaeee('0x23')](handleEntityNotFound(_0x4c06c7,null))[_0xaeee('0x23')](removeEntity(_0x4c06c7,null))['catch'](handleError(_0x4c06c7,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 93a59ad..8638e03 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 _0x8ff3=['name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','path','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x3fc4ef,_0xa91944){var _0x3e8992=function(_0x349c5b){while(--_0x349c5b){_0x3fc4ef['push'](_0x3fc4ef['shift']());}};_0x3e8992(++_0xa91944);}(_0x8ff3,0x72));var _0x38ff=function(_0xec9262,_0x3e62bd){_0xec9262=_0xec9262-0x0;var _0x19aeff=_0x8ff3[_0xec9262];return _0x19aeff;};'use strict';var _=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var logger=require('../../config/logger')(_0x38ff('0x2'));var moment=require(_0x38ff('0x3'));var BPromise=require(_0x38ff('0x4'));var rp=require(_0x38ff('0x5'));var fs=require('fs');var path=require(_0x38ff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x38ff('0x7'));module['exports']=function(_0x32a606,_0x5428e3){return _0x32a606[_0x38ff('0x8')](_0x38ff('0x9'),attributes,{'tableName':_0x38ff('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x38ff('0xb'),'fields':[_0x38ff('0xc'),_0x38ff('0xd')]},{'unique':!![],'name':_0x38ff('0xe'),'fields':[_0x38ff('0xc'),_0x38ff('0xf')]},{'unique':!![],'name':_0x38ff('0x10'),'fields':[_0x38ff('0xc'),_0x38ff('0x11')]},{'unique':!![],'name':_0x38ff('0x12'),'fields':['name',_0x38ff('0x13')]},{'unique':!![],'name':_0x38ff('0x14'),'fields':[_0x38ff('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x38ff('0x15'),'fields':[_0x38ff('0xc'),_0x38ff('0x16')]},{'unique':!![],'name':_0x38ff('0x17'),'fields':['name',_0x38ff('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc0d=['tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xdc0d,0x1db));var _0xddc0=function(_0x5d9046,_0x2f3f06){_0x5d9046=_0x5d9046-0x0;var _0x1e2a4f=_0xdc0d[_0x5d9046];return _0x1e2a4f;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')(_0xddc0('0x2'));var moment=require('moment');var BPromise=require(_0xddc0('0x3'));var rp=require(_0xddc0('0x4'));var fs=require('fs');var path=require(_0xddc0('0x5'));var rimraf=require(_0xddc0('0x6'));var config=require(_0xddc0('0x7'));var attributes=require(_0xddc0('0x8'));module[_0xddc0('0x9')]=function(_0x39a8da,_0x20f5a9){return _0x39a8da['define'](_0xddc0('0xa'),attributes,{'tableName':_0xddc0('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xddc0('0xc'),'fields':[_0xddc0('0xd'),_0xddc0('0xe')]},{'unique':!![],'name':_0xddc0('0xf'),'fields':['name',_0xddc0('0x10')]},{'unique':!![],'name':_0xddc0('0x11'),'fields':[_0xddc0('0xd'),_0xddc0('0x12')]},{'unique':!![],'name':_0xddc0('0x13'),'fields':[_0xddc0('0xd'),_0xddc0('0x14')]},{'unique':!![],'name':_0xddc0('0x15'),'fields':['name',_0xddc0('0x16')]},{'unique':!![],'name':_0xddc0('0x17'),'fields':['name',_0xddc0('0x18')]},{'unique':!![],'name':_0xddc0('0x19'),'fields':[_0xddc0('0xd'),_0xddc0('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8dc8f7c..acbcb69 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 _0x9f23=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird'];(function(_0x42ce1f,_0x4b16a4){var _0x3ab8af=function(_0x44871c){while(--_0x44871c){_0x42ce1f['push'](_0x42ce1f['shift']());}};_0x3ab8af(++_0x4b16a4);}(_0x9f23,0x115));var _0x39f2=function(_0x1d8ac9,_0x32caa4){_0x1d8ac9=_0x1d8ac9-0x0;var _0x152359=_0x9f23[_0x1d8ac9];return _0x152359;};'use strict';var _=require(_0x39f2('0x0'));var util=require('util');var moment=require(_0x39f2('0x1'));var BPromise=require(_0x39f2('0x2'));var rs=require(_0x39f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x39f2('0x5'))(_0x39f2('0x6'));var config=require('../../config/environment');var jayson=require(_0x39f2('0x7'));var client=jayson['client'][_0x39f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf2b85e,_0x3e1c1a,_0x2ec7d7){return new BPromise(function(_0x36d301,_0x4f4874){return client[_0x39f2('0x9')](_0xf2b85e,_0x2ec7d7)[_0x39f2('0xa')](function(_0x3e5051){logger[_0x39f2('0xb')](_0x39f2('0xc'),_0x3e1c1a,_0x39f2('0xd'));logger[_0x39f2('0xe')](_0x39f2('0xf'),_0x3e1c1a,_0x39f2('0xd'),JSON[_0x39f2('0x10')](_0x3e5051));if(_0x3e5051[_0x39f2('0x11')]){if(_0x3e5051[_0x39f2('0x11')][_0x39f2('0x12')]===0x1f4){logger[_0x39f2('0x11')]('Disposition,\x20%s,\x20%s',_0x3e1c1a,_0x3e5051[_0x39f2('0x11')][_0x39f2('0x13')]);return _0x4f4874(_0x3e5051[_0x39f2('0x11')][_0x39f2('0x13')]);}logger[_0x39f2('0x11')](_0x39f2('0xc'),_0x3e1c1a,_0x3e5051[_0x39f2('0x11')][_0x39f2('0x13')]);return _0x36d301(_0x3e5051['error'][_0x39f2('0x13')]);}else{logger[_0x39f2('0xb')]('Disposition,\x20%s,\x20%s',_0x3e1c1a,'request\x20sent');_0x36d301(_0x3e5051['result'][_0x39f2('0x13')]);}})['catch'](function(_0x5b3b37){logger[_0x39f2('0x11')](_0x39f2('0xc'),_0x3e1c1a,_0x5b3b37);_0x4f4874(_0x5b3b37);});});} \ No newline at end of file +var _0xd6be=['client','http','request','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xd6be,0x1af));var _0xed6b=function(_0x4a3ae6,_0xa4130b){_0x4a3ae6=_0x4a3ae6-0x0;var _0x2503a6=_0xd6be[_0x4a3ae6];return _0x2503a6;};'use strict';var _=require(_0xed6b('0x0'));var util=require(_0xed6b('0x1'));var moment=require(_0xed6b('0x2'));var BPromise=require(_0xed6b('0x3'));var rs=require(_0xed6b('0x4'));var fs=require('fs');var Redis=require(_0xed6b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed6b('0x6'))(_0xed6b('0x7'));var config=require(_0xed6b('0x8'));var jayson=require(_0xed6b('0x9'));var client=jayson[_0xed6b('0xa')][_0xed6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a899d,_0xac99df,_0x52b555){return new BPromise(function(_0x40105a,_0x17d9ab){return client[_0xed6b('0xc')](_0x3a899d,_0x52b555)['then'](function(_0x3870e9){logger['info'](_0xed6b('0xd'),_0xac99df,_0xed6b('0xe'));logger['debug'](_0xed6b('0xf'),_0xac99df,_0xed6b('0xe'),JSON['stringify'](_0x3870e9));if(_0x3870e9[_0xed6b('0x10')]){if(_0x3870e9[_0xed6b('0x10')]['code']===0x1f4){logger[_0xed6b('0x10')](_0xed6b('0xd'),_0xac99df,_0x3870e9[_0xed6b('0x10')][_0xed6b('0x11')]);return _0x17d9ab(_0x3870e9[_0xed6b('0x10')][_0xed6b('0x11')]);}logger[_0xed6b('0x10')](_0xed6b('0xd'),_0xac99df,_0x3870e9[_0xed6b('0x10')]['message']);return _0x40105a(_0x3870e9['error'][_0xed6b('0x11')]);}else{logger[_0xed6b('0x12')]('Disposition,\x20%s,\x20%s',_0xac99df,'request\x20sent');_0x40105a(_0x3870e9[_0xed6b('0x13')][_0xed6b('0x11')]);}})[_0xed6b('0x14')](function(_0x1f42a6){logger['error'](_0xed6b('0xd'),_0xac99df,_0x1f42a6);_0x17d9ab(_0x1f42a6);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b3c7105..3b3479d 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 _0xb3be=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb3be,0x64));var _0xeb3b=function(_0x3ba779,_0x51bfbd){_0x3ba779=_0x3ba779-0x0;var _0x466dca=_0xb3be[_0x3ba779];return _0x466dca;};'use strict';var multer=require('multer');var util=require(_0xeb3b('0x0'));var path=require(_0xeb3b('0x1'));var timeout=require(_0xeb3b('0x2'));var express=require(_0xeb3b('0x3'));var router=express[_0xeb3b('0x4')]();var auth=require(_0xeb3b('0x5'));var interaction=require(_0xeb3b('0x6'));var config=require(_0xeb3b('0x7'));var controller=require(_0xeb3b('0x8'));router[_0xeb3b('0x9')]('/',auth[_0xeb3b('0xa')](),controller['index']);router[_0xeb3b('0x9')](_0xeb3b('0xb'),auth[_0xeb3b('0xa')](),controller[_0xeb3b('0xc')]);router[_0xeb3b('0xd')]('/',auth[_0xeb3b('0xa')](),controller['create']);router[_0xeb3b('0xe')](_0xeb3b('0xb'),auth['isAuthenticated'](),controller[_0xeb3b('0xf')]);router[_0xeb3b('0x10')](_0xeb3b('0xb'),auth[_0xeb3b('0xa')](),controller[_0xeb3b('0x11')]);module[_0xeb3b('0x12')]=router; \ No newline at end of file +var _0x1dfc=['post','create','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x24ecf7,_0x59d4ab){var _0x202152=function(_0x547fce){while(--_0x547fce){_0x24ecf7['push'](_0x24ecf7['shift']());}};_0x202152(++_0x59d4ab);}(_0x1dfc,0x6b));var _0xc1df=function(_0x12df7d,_0x2ed1c8){_0x12df7d=_0x12df7d-0x0;var _0x4aa5aa=_0x1dfc[_0x12df7d];return _0x4aa5aa;};'use strict';var multer=require(_0xc1df('0x0'));var util=require('util');var path=require(_0xc1df('0x1'));var timeout=require(_0xc1df('0x2'));var express=require(_0xc1df('0x3'));var router=express[_0xc1df('0x4')]();var auth=require(_0xc1df('0x5'));var interaction=require(_0xc1df('0x6'));var config=require('../../config/environment');var controller=require(_0xc1df('0x7'));router[_0xc1df('0x8')]('/',auth[_0xc1df('0x9')](),controller[_0xc1df('0xa')]);router[_0xc1df('0x8')](_0xc1df('0xb'),auth[_0xc1df('0x9')](),controller[_0xc1df('0xc')]);router[_0xc1df('0xd')]('/',auth['isAuthenticated'](),controller[_0xc1df('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc1df('0xb'),auth['isAuthenticated'](),controller['destroy']);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 f58c1d7..e7642f3 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 _0x6694=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x3a3660,_0x33ffbc){var _0x48ab46=function(_0x2e8e45){while(--_0x2e8e45){_0x3a3660['push'](_0x3a3660['shift']());}};_0x48ab46(++_0x33ffbc);}(_0x6694,0xc6));var _0x4669=function(_0x1236f8,_0x50e4fc){_0x1236f8=_0x1236f8-0x0;var _0x48daa7=_0x6694[_0x1236f8];return _0x48daa7;};'use strict';var Sequelize=require(_0x4669('0x0'));module[_0x4669('0x1')]={'name':{'type':Sequelize[_0x4669('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4669('0x2')]},'ecm':{'type':Sequelize[_0x4669('0x3')](_0x4669('0x4'),'no'),'defaultValue':_0x4669('0x4')},'headerinfo':{'type':Sequelize[_0x4669('0x2')],'defaultValue':_0x4669('0x5')},'localstationid':{'type':Sequelize[_0x4669('0x2')],'unique':_0x4669('0x6')},'minrate':{'type':Sequelize[_0x4669('0x3')](_0x4669('0x7'),'4800',_0x4669('0x8'),_0x4669('0x9'),_0x4669('0xa'),_0x4669('0xb')),'defaultValue':_0x4669('0xc')},'maxrate':{'type':Sequelize['ENUM'](_0x4669('0x7'),_0x4669('0xc'),_0x4669('0x8'),_0x4669('0x9'),_0x4669('0xa'),_0x4669('0xb')),'defaultValue':_0x4669('0xb')},'modem':{'type':Sequelize[_0x4669('0x2')],'defaultValue':_0x4669('0xd')},'gateway':{'type':Sequelize[_0x4669('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4669('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4669('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4669('0x3')](_0x4669('0xf'),_0x4669('0x10'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x4669('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4669('0x11')],'defaultValue':function(){return _0x4669('0x12');}},'notificationSound':{'type':Sequelize[_0x4669('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4669('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4669('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4669('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4669('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x4669('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x4669('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5bc42f){if(!_0x5bc42f)this['setDataValue'](_0x4669('0x15'),null);this['setDataValue']('mandatoryDisposition',_0x5bc42f);}}}; \ No newline at end of file +var _0x3c51=['sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','v17,v27,v29','INTEGER','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition'];(function(_0xd0ab34,_0x115e43){var _0x4e0d4d=function(_0x2dc7a0){while(--_0x2dc7a0){_0xd0ab34['push'](_0xd0ab34['shift']());}};_0x4e0d4d(++_0x115e43);}(_0x3c51,0xb4));var _0x13c5=function(_0x4f8e46,_0x1b03ae){_0x4f8e46=_0x4f8e46-0x0;var _0x550b4d=_0x3c51[_0x4f8e46];return _0x550b4d;};'use strict';var Sequelize=require(_0x13c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x13c5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x13c5('0x1')]},'ecm':{'type':Sequelize[_0x13c5('0x2')](_0x13c5('0x3'),'no'),'defaultValue':_0x13c5('0x3')},'headerinfo':{'type':Sequelize[_0x13c5('0x1')],'defaultValue':_0x13c5('0x4')},'localstationid':{'type':Sequelize[_0x13c5('0x1')],'unique':_0x13c5('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x13c5('0x6'),_0x13c5('0x7'),_0x13c5('0x8'),'9600',_0x13c5('0x9'),_0x13c5('0xa')),'defaultValue':_0x13c5('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x13c5('0x7'),_0x13c5('0x8'),'9600','12000',_0x13c5('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x13c5('0xb')},'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[_0x13c5('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x13c5('0x2')](_0x13c5('0xd'),'IAX','DADHI','KHOMP'),'defaultValue':_0x13c5('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x13c5('0xe')],'defaultValue':function(){return _0x13c5('0xf');}},'notificationSound':{'type':Sequelize[_0x13c5('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13c5('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x13c5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x13c5('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13c5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x13c5('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x13c5('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x13c5('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x461649){if(!_0x461649)this[_0x13c5('0x12')]('mandatoryDispositionPauseId',null);this[_0x13c5('0x12')](_0x13c5('0x13'),_0x461649);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3319fbd..49b7195 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 _0x06f4=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','minrate','modem','t38timeout','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','TrunkId','ListId','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','updatedAt','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','info','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x49bcb8,_0x4c2449){var _0x2b706c=function(_0x58db55){while(--_0x58db55){_0x49bcb8['push'](_0x49bcb8['shift']());}};_0x2b706c(++_0x4c2449);}(_0x06f4,0x136));var _0x406f=function(_0x3498f5,_0x2dae28){_0x3498f5=_0x3498f5-0x0;var _0x36bec6=_0x06f4[_0x3498f5];return _0x36bec6;};'use strict';var pdf=require(_0x406f('0x0'));var emlformat=require(_0x406f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x406f('0x2'));var jsonpatch=require(_0x406f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x406f('0x4'));var Mustache=require('mustache');var util=require(_0x406f('0x5'));var path=require(_0x406f('0x6'));var sox=require(_0x406f('0x7'));var csv=require(_0x406f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x406f('0x9'));var squel=require('squel');var crypto=require(_0x406f('0xa'));var jsforce=require(_0x406f('0xb'));var deskjs=require(_0x406f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x406f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x406f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x406f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x406f('0x10'))('api');var utils=require(_0x406f('0x11'));var config=require(_0x406f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x406f('0x13'))['db'];config[_0x406f('0x14')]=_[_0x406f('0x15')](config[_0x406f('0x14')],{'host':_0x406f('0x16'),'port':0x18eb});var socket=require(_0x406f('0x17'))(new Redis(config[_0x406f('0x14')]));require(_0x406f('0x18'))[_0x406f('0x19')](socket);var jayson=require(_0x406f('0x1a'));var client=jayson[_0x406f('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x406f('0x1b')][_0x406f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4498d9,_0x5c80af,_0x18ffbb,_0x14b838){return new BPromise(function(_0x4dfbc1,_0x4a4da9){var _0x11c759=_0x14b838||client;return _0x11c759[_0x406f('0x1d')](_0x4498d9,_0x18ffbb)['then'](function(_0x2e4409){logger['info'](_0x406f('0x1e'),_0x5c80af,_0x406f('0x1f'));logger[_0x406f('0x20')](_0x406f('0x21'),_0x5c80af,'request\x20sent',JSON['stringify'](_0x2e4409));if(_0x2e4409[_0x406f('0x22')]){if(_0x2e4409['error'][_0x406f('0x23')]===0x1f4){logger['error'](_0x406f('0x1e'),_0x5c80af,_0x2e4409[_0x406f('0x22')][_0x406f('0x24')]);return _0x4a4da9(_0x2e4409['error']['message']);}logger['error'](_0x406f('0x1e'),_0x5c80af,_0x2e4409[_0x406f('0x22')][_0x406f('0x24')]);return _0x4dfbc1(_0x2e4409['error'][_0x406f('0x24')]);}else{logger['info'](_0x406f('0x1e'),_0x5c80af,_0x406f('0x1f'));_0x4dfbc1(_0x2e4409[_0x406f('0x25')][_0x406f('0x24')]);}})[_0x406f('0x26')](function(_0x51ac15){logger['error'](_0x406f('0x1e'),_0x5c80af,_0x51ac15);_0x4a4da9(_0x51ac15);});});}function respondWithStatusCode(_0x58501f,_0x467a3a){_0x467a3a=_0x467a3a||0xcc;return function(_0xa240d8){if(_0xa240d8){return _0x58501f['sendStatus'](_0x467a3a);}return _0x58501f['status'](_0x467a3a)[_0x406f('0x27')]();};}function respondWithResult(_0x484f7c,_0x377cb9){_0x377cb9=_0x377cb9||0xc8;return function(_0x394430){if(_0x394430){return _0x484f7c[_0x406f('0x28')](_0x377cb9)[_0x406f('0x29')](_0x394430);}};}function respondWithFilteredResult(_0x2c439b,_0x174e47){return function(_0x224bd0){if(_0x224bd0){var _0x2b41dd=_0x224bd0[_0x406f('0x2a')],_0x5ec2ed=_0x174e47[_0x406f('0x2b')],_0x5ac8e5=_0x174e47[_0x406f('0x2b')]+_0x174e47['limit'],_0x315869;if(_0x5ac8e5>=_0x2b41dd){_0x5ac8e5=_0x2b41dd;_0x315869=0xc8;}else{_0x315869=0xce;}_0x2c439b['status'](_0x315869);return _0x2c439b[_0x406f('0x2c')](_0x406f('0x2d'),_0x5ec2ed+'-'+_0x5ac8e5+'/'+_0x2b41dd)['json'](_0x224bd0);}return null;};}function patchUpdates(_0x5e2c7a){return function(_0x4430c5){try{jsonpatch[_0x406f('0x2e')](_0x4430c5,_0x5e2c7a,!![]);}catch(_0x2e42fa){return BPromise[_0x406f('0x2f')](_0x2e42fa);}return _0x4430c5[_0x406f('0x30')]();};}function saveUpdates(_0x3e0683,_0x1d7230){return function(_0x34c19e){if(_0x34c19e){return _0x34c19e[_0x406f('0x31')](_0x3e0683)[_0x406f('0x32')](function(_0x25bd98){return _0x25bd98;});}return null;};}function removeEntity(_0x449c79,_0x23efaa){return function(_0x48bf35){if(_0x48bf35){return _0x48bf35[_0x406f('0x33')]()[_0x406f('0x32')](function(){var _0x13fb61=_0x48bf35[_0x406f('0x34')]({'plain':!![]});var _0x29352b=_0x406f('0x35');return db[_0x406f('0x36')][_0x406f('0x33')]({'where':{'type':_0x29352b,'resourceId':_0x13fb61['id']}})[_0x406f('0x32')](function(){return _0x48bf35;});})[_0x406f('0x32')](function(){_0x449c79['status'](0xcc)[_0x406f('0x27')]();});}};}function handleEntityNotFound(_0x1062ef,_0x36a17a){return function(_0x444387){if(!_0x444387){_0x1062ef[_0x406f('0x37')](0x194);}return _0x444387;};}function handleError(_0x2a3cc1,_0x58108b){_0x58108b=_0x58108b||0x1f4;return function(_0x52f878){logger[_0x406f('0x22')](_0x52f878[_0x406f('0x38')]);if(_0x52f878['name']){delete _0x52f878[_0x406f('0x39')];}_0x2a3cc1['status'](_0x58108b)[_0x406f('0x3a')](_0x52f878);};}exports[_0x406f('0x3b')]=function(_0xe86907,_0x5f2a29){var _0x14ca94={'include':[{'model':db[_0x406f('0x3c')],'as':_0x406f('0x3d')}]},_0x147448={},_0x3e3546={'count':0x0,'rows':[]};var _0x2666f1=_[_0x406f('0x3e')](db[_0x406f('0x3f')][_0x406f('0x40')],function(_0x14c27f){return{'name':_0x14c27f[_0x406f('0x41')],'type':_0x14c27f[_0x406f('0x42')][_0x406f('0x43')]};});_0x147448[_0x406f('0x44')]=_[_0x406f('0x3e')](_0x2666f1,'name');_0x147448['query']=_['keys'](_0xe86907[_0x406f('0x45')]);_0x147448[_0x406f('0x46')]=_[_0x406f('0x47')](_0x147448['model'],_0x147448[_0x406f('0x45')]);_0x14ca94[_0x406f('0x48')]=_[_0x406f('0x47')](_0x147448[_0x406f('0x44')],qs[_0x406f('0x49')](_0xe86907[_0x406f('0x45')]['fields']));_0x14ca94[_0x406f('0x48')]=_0x14ca94[_0x406f('0x48')]['length']?_0x14ca94[_0x406f('0x48')]:_0x147448['model'];if(!_0xe86907['query'][_0x406f('0x4a')](_0x406f('0x4b'))){_0x14ca94[_0x406f('0x4c')]=qs[_0x406f('0x4c')](_0xe86907[_0x406f('0x45')][_0x406f('0x4c')]);_0x14ca94['offset']=qs['offset'](_0xe86907[_0x406f('0x45')][_0x406f('0x2b')]);}_0x14ca94[_0x406f('0x4d')]=qs[_0x406f('0x4e')](_0xe86907[_0x406f('0x45')][_0x406f('0x4e')]);_0x14ca94[_0x406f('0x4f')]=qs['filters'](_[_0x406f('0x50')](_0xe86907[_0x406f('0x45')],_0x147448[_0x406f('0x46')]),_0x2666f1);if(_0xe86907[_0x406f('0x45')][_0x406f('0x51')]){_0x14ca94[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x14ca94[_0x406f('0x4f')],{'$or':_[_0x406f('0x3e')](_0x2666f1,function(_0x27926a){if(_0x27926a[_0x406f('0x42')]!=='VIRTUAL'){var _0x13f2b2={};_0x13f2b2[_0x27926a[_0x406f('0x39')]]={'$like':'%'+_0xe86907['query']['filter']+'%'};return _0x13f2b2;}})});}_0x14ca94=_[_0x406f('0x52')]({},_0x14ca94,_0xe86907[_0x406f('0x53')]);var _0x2a13c3={'where':_0x14ca94[_0x406f('0x4f')]};return db['FaxAccount'][_0x406f('0x2a')](_0x2a13c3)['then'](function(_0x43e77b){_0x3e3546[_0x406f('0x2a')]=_0x43e77b;if(_0xe86907['query']['includeAll']){_0x14ca94[_0x406f('0x54')]=[{'all':!![]}];}return db[_0x406f('0x3f')][_0x406f('0x55')](_0x14ca94);})[_0x406f('0x32')](function(_0x56339a){_0x3e3546[_0x406f('0x56')]=_0x56339a;return _0x3e3546;})[_0x406f('0x32')](respondWithFilteredResult(_0x5f2a29,_0x14ca94))[_0x406f('0x26')](handleError(_0x5f2a29,null));};exports[_0x406f('0x57')]=function(_0x578f4c,_0x5d4041){var _0x2b1add={'raw':![],'where':{'id':_0x578f4c[_0x406f('0x58')]['id']},'include':[{'model':db[_0x406f('0x3c')],'as':_0x406f('0x3d')}]},_0x244fcf={};_0x244fcf['model']=_[_0x406f('0x59')](db[_0x406f('0x3f')]['rawAttributes']);_0x244fcf['query']=_[_0x406f('0x59')](_0x578f4c[_0x406f('0x45')]);_0x244fcf[_0x406f('0x46')]=_['intersection'](_0x244fcf[_0x406f('0x44')],_0x244fcf[_0x406f('0x45')]);_0x2b1add[_0x406f('0x48')]=_[_0x406f('0x47')](_0x244fcf[_0x406f('0x44')],qs[_0x406f('0x49')](_0x578f4c[_0x406f('0x45')][_0x406f('0x49')]));_0x2b1add[_0x406f('0x48')]=_0x2b1add['attributes']['length']?_0x2b1add[_0x406f('0x48')]:_0x244fcf[_0x406f('0x44')];if(_0x578f4c[_0x406f('0x45')][_0x406f('0x5a')]){_0x2b1add[_0x406f('0x54')]=[{'all':!![]}];}_0x2b1add=_[_0x406f('0x52')]({},_0x2b1add,_0x578f4c[_0x406f('0x53')]);return db[_0x406f('0x3f')][_0x406f('0x5b')](_0x2b1add)[_0x406f('0x32')](handleEntityNotFound(_0x5d4041,null))['then'](respondWithResult(_0x5d4041,null))['catch'](handleError(_0x5d4041,null));};exports[_0x406f('0x5c')]=function(_0x2cba99,_0x3039a4){return db[_0x406f('0x3f')][_0x406f('0x5c')](_0x2cba99[_0x406f('0x5d')],{})['then'](function(_0x1faac1){var _0x2b59ae=_0x2cba99[_0x406f('0x5e')][_0x406f('0x34')]({'plain':!![]});if(!_0x2b59ae)throw new Error(_0x406f('0x5f'));if(_0x2b59ae[_0x406f('0x60')]===_0x406f('0x5e')){var _0x10db69=_0x1faac1[_0x406f('0x34')]({'plain':!![]});var _0x319cdb='FaxAccounts';return db[_0x406f('0x61')][_0x406f('0x5b')]({'where':{'name':_0x319cdb,'userProfileId':_0x2b59ae[_0x406f('0x62')]},'raw':!![]})['then'](function(_0x177c23){if(_0x177c23&&_0x177c23['autoAssociation']===0x0){return db['UserProfileResource'][_0x406f('0x5c')]({'name':_0x10db69[_0x406f('0x39')],'resourceId':_0x10db69['id'],'type':_0x177c23['name'],'sectionId':_0x177c23['id']},{})[_0x406f('0x32')](function(){return _0x1faac1;});}else{return _0x1faac1;}})['catch'](function(_0x2f6f1d){logger['error'](_0x406f('0x63'),_0x2f6f1d);throw _0x2f6f1d;});}return _0x1faac1;})['then'](respondWithResult(_0x3039a4,0xc9))[_0x406f('0x26')](handleError(_0x3039a4,null));};exports[_0x406f('0x31')]=function(_0x5cd209,_0x5dd1e8){if(_0x5cd209[_0x406f('0x5d')]['id']){delete _0x5cd209[_0x406f('0x5d')]['id'];}return db[_0x406f('0x3f')][_0x406f('0x5b')]({'where':{'id':_0x5cd209['params']['id']},'include':[{'model':db[_0x406f('0x3c')],'as':_0x406f('0x3d')}]})[_0x406f('0x32')](handleEntityNotFound(_0x5dd1e8,null))[_0x406f('0x32')](saveUpdates(_0x5cd209[_0x406f('0x5d')],null))[_0x406f('0x32')](respondWithResult(_0x5dd1e8,null))[_0x406f('0x26')](handleError(_0x5dd1e8,null));};exports['destroy']=function(_0x44297b,_0x4cab81){return db[_0x406f('0x3f')][_0x406f('0x5b')]({'where':{'id':_0x44297b[_0x406f('0x58')]['id']}})['then'](handleEntityNotFound(_0x4cab81,null))[_0x406f('0x32')](removeEntity(_0x4cab81,null))[_0x406f('0x26')](handleError(_0x4cab81,null));};exports['describe']=function(_0x5b11ae,_0x69dddb){return db[_0x406f('0x3f')]['describe']()['then'](respondWithResult(_0x69dddb,null))['catch'](handleError(_0x69dddb,null));};exports[_0x406f('0x64')]=function(_0xef3d60,_0x329977,_0x563d25){if(_0xef3d60['body']['id']){delete _0xef3d60[_0x406f('0x5d')]['id'];}return db[_0x406f('0x3f')][_0x406f('0x5b')]({'where':{'id':_0xef3d60[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x329977,null))['then'](function(_0xcd8003){if(_0xcd8003){_0xef3d60[_0x406f('0x5d')][_0x406f('0x65')]=_0xcd8003['id'];return db[_0x406f('0x66')][_0x406f('0x5c')](_0xef3d60[_0x406f('0x5d')]);}})[_0x406f('0x32')](respondWithResult(_0x329977,null))[_0x406f('0x26')](handleError(_0x329977,null));};exports[_0x406f('0x67')]=function(_0xed8f65,_0x44ca9a,_0x387941){var _0x3e8ab6={'raw':![],'where':{}};var _0x33b186={};var _0x1283f2={'count':0x0,'rows':[]};return db[_0x406f('0x3f')][_0x406f('0x68')]({'where':{'id':_0xed8f65['params']['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x44ca9a,null))[_0x406f('0x32')](function(_0x2c7971){if(_0x2c7971){_0x33b186['model']=_[_0x406f('0x59')](db[_0x406f('0x66')]['rawAttributes']);_0x33b186[_0x406f('0x45')]=_['keys'](_0xed8f65['query']);_0x33b186[_0x406f('0x46')]=_[_0x406f('0x47')](_0x33b186['model'],_0x33b186[_0x406f('0x45')]);_0x3e8ab6['attributes']=_[_0x406f('0x47')](_0x33b186[_0x406f('0x44')],qs[_0x406f('0x49')](_0xed8f65[_0x406f('0x45')][_0x406f('0x49')]));_0x3e8ab6[_0x406f('0x48')]=_0x3e8ab6[_0x406f('0x48')][_0x406f('0x69')]?_0x3e8ab6[_0x406f('0x48')]:_0x33b186['model'];if(!_0xed8f65[_0x406f('0x45')]['hasOwnProperty'](_0x406f('0x4b'))){_0x3e8ab6['limit']=qs['limit'](_0xed8f65['query'][_0x406f('0x4c')]);_0x3e8ab6[_0x406f('0x2b')]=qs[_0x406f('0x2b')](_0xed8f65[_0x406f('0x45')][_0x406f('0x2b')]);}_0x3e8ab6['order']=qs['sort'](_0xed8f65['query'][_0x406f('0x4e')]);_0x3e8ab6['where']=qs[_0x406f('0x46')](_[_0x406f('0x50')](_0xed8f65[_0x406f('0x45')],_0x33b186[_0x406f('0x46')]));_0x3e8ab6[_0x406f('0x4f')][_0x406f('0x65')]=_0x2c7971['id'];if(_0xed8f65['query']['filter']){_0x3e8ab6[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x3e8ab6[_0x406f('0x4f')],{'$or':_['map'](_0x3e8ab6[_0x406f('0x48')],function(_0x2d5d32){var _0x37e3c0={};_0x37e3c0[_0x2d5d32]={'$like':'%'+_0xed8f65[_0x406f('0x45')][_0x406f('0x51')]+'%'};return _0x37e3c0;})});}_0x3e8ab6=_['merge']({},_0x3e8ab6,_0xed8f65[_0x406f('0x53')]);return db[_0x406f('0x66')][_0x406f('0x2a')]({'where':_0x3e8ab6[_0x406f('0x4f')]})[_0x406f('0x32')](function(_0x40b036){_0x1283f2[_0x406f('0x2a')]=_0x40b036;if(_0xed8f65[_0x406f('0x45')]['includeAll']){_0x3e8ab6['include']=[{'all':!![]}];}return db['Disposition'][_0x406f('0x55')](_0x3e8ab6);})['then'](function(_0x5ec137){_0x1283f2[_0x406f('0x56')]=_0x5ec137;return _0x1283f2;});}})[_0x406f('0x32')](respondWithFilteredResult(_0x44ca9a,_0x3e8ab6))[_0x406f('0x26')](handleError(_0x44ca9a,null));};exports[_0x406f('0x6a')]=function(_0x4f37e5,_0x55ddec,_0x58206a){return db[_0x406f('0x3f')][_0x406f('0x5b')]({'where':{'id':_0x4f37e5['params']['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x55ddec,null))['then'](function(_0x101b16){if(_0x101b16){return _0x101b16[_0x406f('0x6a')](_0x4f37e5['query'][_0x406f('0x6b')]);}})[_0x406f('0x32')](respondWithStatusCode(_0x55ddec,null))[_0x406f('0x26')](handleError(_0x55ddec,null));};exports[_0x406f('0x6c')]=function(_0x781230,_0x3eb22a,_0x13e536){if(_0x781230[_0x406f('0x5d')]['id']){delete _0x781230[_0x406f('0x5d')]['id'];}return db[_0x406f('0x3f')][_0x406f('0x5b')]({'where':{'id':_0x781230['params']['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x3eb22a,null))[_0x406f('0x32')](function(_0x169662){if(_0x169662){_0x781230[_0x406f('0x5d')][_0x406f('0x65')]=_0x169662['id'];return db[_0x406f('0x6d')][_0x406f('0x5c')](_0x781230[_0x406f('0x5d')]);}})[_0x406f('0x32')](respondWithResult(_0x3eb22a,null))['catch'](handleError(_0x3eb22a,null));};exports[_0x406f('0x6e')]=function(_0x3a2f69,_0x517840,_0x4393ff){var _0x2213b4={'raw':![],'where':{}};var _0x39fe38={};var _0x42a297={'count':0x0,'rows':[]};return db[_0x406f('0x3f')][_0x406f('0x68')]({'where':{'id':_0x3a2f69['params']['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x517840,null))[_0x406f('0x32')](function(_0x5f3e2e){if(_0x5f3e2e){_0x39fe38[_0x406f('0x44')]=_['keys'](db[_0x406f('0x6d')][_0x406f('0x40')]);_0x39fe38[_0x406f('0x45')]=_[_0x406f('0x59')](_0x3a2f69[_0x406f('0x45')]);_0x39fe38[_0x406f('0x46')]=_[_0x406f('0x47')](_0x39fe38[_0x406f('0x44')],_0x39fe38['query']);_0x2213b4[_0x406f('0x48')]=_[_0x406f('0x47')](_0x39fe38['model'],qs[_0x406f('0x49')](_0x3a2f69['query'][_0x406f('0x49')]));_0x2213b4['attributes']=_0x2213b4[_0x406f('0x48')][_0x406f('0x69')]?_0x2213b4[_0x406f('0x48')]:_0x39fe38[_0x406f('0x44')];if(!_0x3a2f69['query'][_0x406f('0x4a')](_0x406f('0x4b'))){_0x2213b4[_0x406f('0x4c')]=qs[_0x406f('0x4c')](_0x3a2f69[_0x406f('0x45')]['limit']);_0x2213b4[_0x406f('0x2b')]=qs[_0x406f('0x2b')](_0x3a2f69[_0x406f('0x45')]['offset']);}_0x2213b4[_0x406f('0x4d')]=qs[_0x406f('0x4e')](_0x3a2f69['query']['sort']);_0x2213b4[_0x406f('0x4f')]=qs[_0x406f('0x46')](_[_0x406f('0x50')](_0x3a2f69[_0x406f('0x45')],_0x39fe38[_0x406f('0x46')]));_0x2213b4[_0x406f('0x4f')][_0x406f('0x65')]=_0x5f3e2e['id'];if(_0x3a2f69['query'][_0x406f('0x51')]){_0x2213b4[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x2213b4[_0x406f('0x4f')],{'$or':_[_0x406f('0x3e')](_0x2213b4[_0x406f('0x48')],function(_0x499848){var _0x2e67b4={};_0x2e67b4[_0x499848]={'$like':'%'+_0x3a2f69[_0x406f('0x45')][_0x406f('0x51')]+'%'};return _0x2e67b4;})});}_0x2213b4=_[_0x406f('0x52')]({},_0x2213b4,_0x3a2f69[_0x406f('0x53')]);return db[_0x406f('0x6d')][_0x406f('0x2a')]({'where':_0x2213b4[_0x406f('0x4f')]})['then'](function(_0x3f5e8e){_0x42a297[_0x406f('0x2a')]=_0x3f5e8e;if(_0x3a2f69[_0x406f('0x45')][_0x406f('0x5a')]){_0x2213b4['include']=[{'all':!![]}];}return db[_0x406f('0x6d')]['findAll'](_0x2213b4);})['then'](function(_0x110be9){_0x42a297[_0x406f('0x56')]=_0x110be9;return _0x42a297;});}})[_0x406f('0x32')](respondWithFilteredResult(_0x517840,_0x2213b4))[_0x406f('0x26')](handleError(_0x517840,null));};exports[_0x406f('0x6f')]=function(_0x4bc3e0,_0x3ccf6e,_0x5cc431){return db['FaxAccount'][_0x406f('0x5b')]({'where':{'id':_0x4bc3e0['params']['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x3ccf6e,null))[_0x406f('0x32')](function(_0x38dc34){if(_0x38dc34){return _0x38dc34['removeAnswers'](_0x4bc3e0['query'][_0x406f('0x6b')]);}})[_0x406f('0x32')](respondWithStatusCode(_0x3ccf6e,null))['catch'](handleError(_0x3ccf6e,null));};exports[_0x406f('0x70')]=function(_0x5e80f9,_0x5bff28,_0x206caa){return db['FaxInteraction'][_0x406f('0x5b')]({'where':{'id':_0x5e80f9[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x5bff28,null))[_0x406f('0x32')](function(_0x27e063){if(_0x27e063){return _0x27e063[_0x406f('0x70')](_0x5e80f9[_0x406f('0x5d')][_0x406f('0x6b')],_[_0x406f('0x71')](_0x5e80f9['body'],[_0x406f('0x6b'),'id'])||{});}})[_0x406f('0x32')](respondWithResult(_0x5bff28,null))[_0x406f('0x26')](handleError(_0x5bff28,null));};exports[_0x406f('0x72')]=function(_0x43fa25,_0x12f400,_0x13fd72){var _0x11e01c={'raw':![],'where':{}};var _0x3c1618={};var _0x2055c3={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x43fa25[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x12f400,null))[_0x406f('0x32')](function(_0x3029ec){if(_0x3029ec){_0x3c1618[_0x406f('0x44')]=_[_0x406f('0x59')](db[_0x406f('0x73')]['rawAttributes']);_0x3c1618['query']=_['keys'](_0x43fa25[_0x406f('0x45')]);_0x3c1618[_0x406f('0x46')]=_[_0x406f('0x47')](_0x3c1618[_0x406f('0x44')],_0x3c1618[_0x406f('0x45')]);_0x11e01c[_0x406f('0x48')]=_[_0x406f('0x47')](_0x3c1618[_0x406f('0x44')],qs[_0x406f('0x49')](_0x43fa25[_0x406f('0x45')][_0x406f('0x49')]));_0x11e01c[_0x406f('0x48')]=_0x11e01c['attributes'][_0x406f('0x69')]?_0x11e01c['attributes']:_0x3c1618[_0x406f('0x44')];if(!_0x43fa25['query'][_0x406f('0x4a')](_0x406f('0x4b'))){_0x11e01c[_0x406f('0x4c')]=qs[_0x406f('0x4c')](_0x43fa25[_0x406f('0x45')][_0x406f('0x4c')]);_0x11e01c[_0x406f('0x2b')]=qs['offset'](_0x43fa25[_0x406f('0x45')][_0x406f('0x2b')]);}_0x11e01c['order']=qs[_0x406f('0x4e')](_0x43fa25[_0x406f('0x45')][_0x406f('0x4e')]);_0x11e01c[_0x406f('0x4f')]=qs['filters'](_[_0x406f('0x50')](_0x43fa25[_0x406f('0x45')],_0x3c1618[_0x406f('0x46')]));_0x11e01c['where'][_0x406f('0x65')]=_0x3029ec['id'];if(_0x43fa25[_0x406f('0x45')][_0x406f('0x51')]){_0x11e01c[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x11e01c[_0x406f('0x4f')],{'$or':_[_0x406f('0x3e')](_0x11e01c[_0x406f('0x48')],function(_0x4787e8){var _0x4f2b04={};_0x4f2b04[_0x4787e8]={'$like':'%'+_0x43fa25[_0x406f('0x45')][_0x406f('0x51')]+'%'};return _0x4f2b04;})});}_0x11e01c=_[_0x406f('0x52')]({},_0x11e01c,_0x43fa25[_0x406f('0x53')]);return db['FaxInteraction'][_0x406f('0x2a')]({'where':_0x11e01c[_0x406f('0x4f')]})[_0x406f('0x32')](function(_0x1e8f85){_0x2055c3[_0x406f('0x2a')]=_0x1e8f85;if(_0x43fa25[_0x406f('0x45')][_0x406f('0x5a')]){_0x11e01c[_0x406f('0x54')]=[{'model':db[_0x406f('0x74')],'as':'Contact','required':![]},{'model':db[_0x406f('0x75')],'as':_0x406f('0x76'),'attributes':[_0x406f('0x39'),_0x406f('0x77'),_0x406f('0x78')],'required':![]},{'model':db[_0x406f('0x79')],'as':_0x406f('0x7a'),'attributes':['id',_0x406f('0x39'),_0x406f('0x7b')],'where':_0x43fa25['query'][_0x406f('0x7c')]?{'id':_0x43fa25['query'][_0x406f('0x7c')]}:undefined,'required':_0x43fa25[_0x406f('0x45')][_0x406f('0x7c')]?!![]:![]}];}return db[_0x406f('0x73')][_0x406f('0x55')](_0x11e01c);})[_0x406f('0x32')](function(_0x4fb801){_0x2055c3[_0x406f('0x56')]=_0x4fb801;return _0x2055c3;});}})[_0x406f('0x32')](respondWithFilteredResult(_0x12f400,_0x11e01c))[_0x406f('0x26')](handleError(_0x12f400,null));};exports['addApplications']=function(_0x3afa28,_0x137eaf,_0x36390f){return db[_0x406f('0x3f')][_0x406f('0x68')]({'where':{'id':_0x3afa28[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x137eaf,null))[_0x406f('0x32')](function(_0x1e0fc1){if(_0x1e0fc1){return db[_0x406f('0x7d')][_0x406f('0x7e')](function(_0xdf7793){return db[_0x406f('0x7f')]['destroy']({'where':{'FaxAccountId':_0x3afa28['params']['id']},'transaction':_0xdf7793})[_0x406f('0x32')](function(_0x1f2c9c){var _0x3976b5=_[_0x406f('0x3e')](_0x3afa28[_0x406f('0x5d')],function(_0x501f8f){_0x501f8f[_0x406f('0x65')]=_0x3afa28[_0x406f('0x58')]['id'];return _0x501f8f;});return db['FaxApplication'][_0x406f('0x80')](_0x3976b5,{'transaction':_0xdf7793});});})[_0x406f('0x32')](function(){return db[_0x406f('0x7f')][_0x406f('0x81')]({'where':{'FaxAccountId':_0x3afa28[_0x406f('0x58')]['id']},'order':_0x406f('0x82')});});}})['then'](respondWithResult(_0x137eaf,null))[_0x406f('0x26')](handleError(_0x137eaf,null));};exports[_0x406f('0x83')]=function(_0x55b3a7,_0x20a282,_0x3653df){var _0x2394c2={};var _0x3aaa13={};var _0x44c438;var _0x4a722f;return db[_0x406f('0x3f')][_0x406f('0x68')]({'where':{'id':_0x55b3a7[_0x406f('0x58')]['id']}})['then'](handleEntityNotFound(_0x20a282,null))['then'](function(_0x2c317d){if(_0x2c317d){_0x44c438=_0x2c317d;_0x3aaa13[_0x406f('0x44')]=_[_0x406f('0x59')](db[_0x406f('0x7f')][_0x406f('0x40')]);_0x3aaa13['query']=_['keys'](_0x55b3a7['query']);_0x3aaa13['filters']=_[_0x406f('0x47')](_0x3aaa13['model'],_0x3aaa13[_0x406f('0x45')]);_0x2394c2[_0x406f('0x48')]=_[_0x406f('0x47')](_0x3aaa13['model'],qs[_0x406f('0x49')](_0x55b3a7[_0x406f('0x45')][_0x406f('0x49')]));_0x2394c2['attributes']=_0x2394c2[_0x406f('0x48')][_0x406f('0x69')]?_0x2394c2[_0x406f('0x48')]:_0x3aaa13['model'];_0x2394c2[_0x406f('0x4d')]=qs['sort'](_0x55b3a7[_0x406f('0x45')]['sort']);_0x2394c2[_0x406f('0x4f')]=qs[_0x406f('0x46')](_[_0x406f('0x50')](_0x55b3a7[_0x406f('0x45')],_0x3aaa13[_0x406f('0x46')]));if(_0x55b3a7[_0x406f('0x45')][_0x406f('0x51')]){_0x2394c2[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x2394c2[_0x406f('0x4f')],{'$or':_[_0x406f('0x3e')](_0x2394c2[_0x406f('0x48')],function(_0x391dd0){var _0x147817={};_0x147817[_0x391dd0]={'$like':'%'+_0x55b3a7[_0x406f('0x45')]['filter']+'%'};return _0x147817;})});}_0x2394c2=_['merge']({},_0x2394c2,_0x55b3a7[_0x406f('0x53')]);return _0x44c438[_0x406f('0x83')](_0x2394c2);}})[_0x406f('0x32')](function(_0x251b9d){if(_0x251b9d){_0x4a722f=_0x251b9d['length'];if(!_0x55b3a7[_0x406f('0x45')][_0x406f('0x4a')]('nolimit')){_0x2394c2[_0x406f('0x4c')]=qs[_0x406f('0x4c')](_0x55b3a7[_0x406f('0x45')][_0x406f('0x4c')]);_0x2394c2['offset']=qs[_0x406f('0x2b')](_0x55b3a7[_0x406f('0x45')]['offset']);}return _0x44c438['getApplications'](_0x2394c2);}})[_0x406f('0x32')](function(_0x3c13ad){if(_0x3c13ad){return _0x3c13ad?{'count':_0x4a722f,'rows':_0x3c13ad}:null;}})[_0x406f('0x32')](respondWithResult(_0x20a282,null))[_0x406f('0x26')](handleError(_0x20a282,null));};function Extension(_0x1115fa,_0x133528,_0x3e4f4e,_0x5a7969){this[_0x406f('0x84')]='from-voip-provider';this['exten']=_0x1115fa[_0x406f('0x85')];this[_0x406f('0x86')]=_0x5a7969;this[_0x406f('0x42')]=_0x406f('0x87');this[_0x406f('0x88')]=_0x406f('0x89');this[_0x406f('0x65')]=_0x1115fa['id'];this[_0x406f('0x82')]=_0x133528;this[_0x406f('0x8a')]=_0x3e4f4e;}function createExtensionsReciveFax(_0x1439d8){var _0x58b303=0x1;var _0x4a30eb=[];_0x4a30eb[_0x406f('0x8b')](new Extension(_0x1439d8,_0x58b303,'',_0x406f('0x8c')));_0x58b303+=0x1;_0x4a30eb[_0x406f('0x8b')](new Extension(_0x1439d8,_0x58b303,'CDR(type)=inbound-fax',_0x406f('0x8d')));_0x58b303+=0x1;for(var _0x550a24 in _0x1439d8){if(_0x1439d8[_0x406f('0x4a')](_0x550a24)&&(_0x550a24===_0x406f('0x8e')||_0x550a24===_0x406f('0x85')||_0x550a24===_0x406f('0x8f')||_0x550a24===_0x406f('0x90')||_0x550a24==='headerinfo'||_0x550a24==='maxrate'||_0x550a24===_0x406f('0x91')||_0x550a24===_0x406f('0x92')||_0x550a24===_0x406f('0x93'))){_0x4a30eb['push'](new Extension(_0x1439d8,_0x58b303,_0x406f('0x94')+_0x550a24+')='+_0x1439d8[_0x550a24],'Set'));_0x58b303+=0x1;}}_0x4a30eb[_0x406f('0x8b')](new Extension(_0x1439d8,_0x58b303,'6',_0x406f('0x95')));_0x58b303+=0x1;_0x4a30eb['push'](new Extension(_0x1439d8,_0x58b303,_0x406f('0x96'),_0x406f('0x97')));_0x58b303=0x0;return _0x4a30eb;}exports[_0x406f('0x98')]=function(_0x5b2ccd,_0x26ca08,_0x4a89a1){var _0x4fba49;return db[_0x406f('0x7d')][_0x406f('0x7e')](function(_0x3a9a27){return db[_0x406f('0x3f')][_0x406f('0x5c')](_0x5b2ccd['body'],{'transaction':_0x3a9a27})[_0x406f('0x32')](function(_0x332a4b){_0x4fba49=_0x332a4b[_0x406f('0x34')]({'plain':!![]});return db[_0x406f('0x99')][_0x406f('0x80')](createExtensionsReciveFax(_0x4fba49),{'transaction':_0x3a9a27});});})[_0x406f('0x32')](function(){return _0x4fba49;})[_0x406f('0x32')](respondWithResult(_0x26ca08,null))[_0x406f('0x26')](handleError(_0x26ca08,null));};exports[_0x406f('0x9a')]=function(_0x3ce235,_0x2a1262,_0x2e154b){var _0x4355a0;return db[_0x406f('0x7d')][_0x406f('0x7e')](function(_0x3d13f9){return db[_0x406f('0x3f')]['update'](_0x3ce235[_0x406f('0x5d')],{'where':{'id':_0x3ce235[_0x406f('0x5d')]['id']},'transaction':_0x3d13f9})[_0x406f('0x32')](function(_0x3b6d0e){return db[_0x406f('0x99')][_0x406f('0x33')]({'where':{'FaxAccountId':_0x3ce235[_0x406f('0x5d')]['id']},'transaction':_0x3d13f9})[_0x406f('0x32')](function(_0x5f1399){return db[_0x406f('0x99')][_0x406f('0x80')](createExtensionsReciveFax(_['omit'](_0x3ce235[_0x406f('0x5d')],['tech',_0x406f('0x43'),'createdAt','updatedAt',_0x406f('0x9b'),_0x406f('0x9c')])),{'transaction':_0x3d13f9});});});})[_0x406f('0x32')](function(){return db['FaxAccount'][_0x406f('0x9d')](_0x3ce235[_0x406f('0x5d')]['id']);})['then'](respondWithResult(_0x2a1262,null))[_0x406f('0x26')](handleError(_0x2a1262,null));};exports[_0x406f('0x9e')]=function(_0x5f20fc,_0x1f5188,_0x250c42){var _0x10a8d9={'raw':!![],'where':{}};var _0x8bc4fb={};var _0x53610a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x5f20fc[_0x406f('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f5188,null))[_0x406f('0x32')](function(_0x28fcac){if(_0x28fcac){_0x8bc4fb['model']=_['keys'](db['FaxMessage'][_0x406f('0x40')]);_0x8bc4fb[_0x406f('0x45')]=_[_0x406f('0x59')](_0x5f20fc['query']);_0x8bc4fb[_0x406f('0x46')]=_[_0x406f('0x47')](_0x8bc4fb[_0x406f('0x44')],_0x8bc4fb[_0x406f('0x45')]);_0x10a8d9['attributes']=_[_0x406f('0x47')](_0x8bc4fb[_0x406f('0x44')],qs[_0x406f('0x49')](_0x5f20fc[_0x406f('0x45')][_0x406f('0x49')]));_0x10a8d9[_0x406f('0x48')]=_0x10a8d9[_0x406f('0x48')][_0x406f('0x69')]?_0x10a8d9['attributes']:_0x8bc4fb[_0x406f('0x44')];if(!_0x5f20fc[_0x406f('0x45')][_0x406f('0x4a')](_0x406f('0x4b'))){_0x10a8d9[_0x406f('0x4c')]=qs['limit'](_0x5f20fc[_0x406f('0x45')][_0x406f('0x4c')]);_0x10a8d9[_0x406f('0x2b')]=qs['offset'](_0x5f20fc[_0x406f('0x45')][_0x406f('0x2b')]);}_0x10a8d9['order']=qs[_0x406f('0x4e')](_0x5f20fc[_0x406f('0x45')][_0x406f('0x4e')]);_0x10a8d9[_0x406f('0x4f')]=qs[_0x406f('0x46')](_[_0x406f('0x50')](_0x5f20fc[_0x406f('0x45')],_0x8bc4fb['filters']));_0x10a8d9[_0x406f('0x4f')][_0x406f('0x65')]=_0x28fcac['id'];if(_0x5f20fc['query'][_0x406f('0x51')]){_0x10a8d9[_0x406f('0x4f')]=_['merge'](_0x10a8d9[_0x406f('0x4f')],{'$or':_[_0x406f('0x3e')](_0x10a8d9[_0x406f('0x48')],function(_0x357722){var _0x23e196={};_0x23e196[_0x357722]={'$like':'%'+_0x5f20fc[_0x406f('0x45')]['filter']+'%'};return _0x23e196;})});}if(_0x5f20fc[_0x406f('0x45')][_0x406f('0x9f')]){var _0x448aec=_0x5f20fc[_0x406f('0x45')][_0x406f('0x9f')][_0x406f('0xa0')](',');var _0x3cb02b={};_0x3cb02b[_0x448aec[0x0]]={'$gte':moment(_0x448aec[0x1])['format'](_0x406f('0xa1'))};_0x10a8d9[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x10a8d9['where'],_0x3cb02b);}_0x10a8d9=_['merge']({},_0x10a8d9,_0x5f20fc[_0x406f('0x53')]);return db[_0x406f('0xa2')][_0x406f('0x2a')]({'where':_0x10a8d9[_0x406f('0x4f')]})[_0x406f('0x32')](function(_0x2a3869){_0x53610a['count']=_0x2a3869;if(_0x5f20fc[_0x406f('0x45')][_0x406f('0x5a')]){_0x10a8d9['include']=[{'all':!![]}];}return db['FaxMessage'][_0x406f('0x55')](_0x10a8d9);})[_0x406f('0x32')](function(_0x1828f8){_0x53610a[_0x406f('0x56')]=_0x1828f8;return _0x53610a;});}})[_0x406f('0x32')](respondWithFilteredResult(_0x1f5188,_0x10a8d9))[_0x406f('0x26')](handleError(_0x1f5188,null));};exports['send']=function(_0x35595b,_0x54fa56,_0x517e17){var _0x5e7816,_0x5564cd={},_0x152207;if(_0x35595b['body']['to']){_0x152207=_0x35595b[_0x406f('0x5d')]['to'][0x0];}return db[_0x406f('0x3f')][_0x406f('0x5b')]({'where':{'id':_0x35595b[_0x406f('0x58')]['id']},'include':[{'model':db[_0x406f('0xa3')],'as':_0x406f('0xa4'),'include':[{'model':db[_0x406f('0x74')],'as':_0x406f('0xa5'),'where':{'fax':_0x152207},'limit':0x1,'order':[[_0x406f('0xa6'),'DESC']]}]}]})[_0x406f('0x32')](handleEntityNotFound(_0x54fa56,null))[_0x406f('0x32')](function(_0x1d4b01){_0x5e7816=_0x1d4b01;if(_0x35595b[_0x406f('0x5d')][_0x406f('0xa7')]&&_0x35595b['body']['attachments']['length']){for(var _0x2f8cba=0x0;_0x2f8cba<_0x35595b[_0x406f('0x5d')][_0x406f('0xa7')][_0x406f('0x69')];_0x2f8cba+=0x1){_0x35595b['body'][_0x406f('0xa7')][_0x2f8cba]={'filename':_0x35595b[_0x406f('0x5d')]['attachments'][_0x2f8cba][_0x406f('0x39')],'id':_0x35595b['body'][_0x406f('0xa7')][_0x2f8cba]['id'],'path':path[_0x406f('0xa8')](config[_0x406f('0xa9')],_0x406f('0xaa'),_0x35595b['body'][_0x406f('0xa7')][_0x2f8cba]['basename'])};}}return respondWithRpcPromise(_0x406f('0xab'),'CheckAfterSend',{'FaxAccountId':_[_0x406f('0xac')](_0x35595b[_0x406f('0x58')]['id'])?undefined:_0x35595b[_0x406f('0x58')]['id'],'path':_[_0x406f('0xac')](_0x35595b[_0x406f('0x5d')]['attachments'][0x0][_0x406f('0x6')])?undefined:_0x35595b[_0x406f('0x5d')]['attachments'][0x0]['path'],'fax':_[_0x406f('0xac')](_0x35595b['body']['to'][0x0])?undefined:_0x35595b[_0x406f('0x5d')]['to'][0x0]},client9002);})[_0x406f('0x32')](function(){if(_0x5e7816){if(_[_0x406f('0xac')](_0x35595b['body']['from'])){_0x35595b['body'][_0x406f('0xad')]=util['format'](_0x406f('0xae'),_0x5e7816[_0x406f('0x39')],_0x5e7816[_0x406f('0xaf')]);}if(_0x5e7816[_0x406f('0xa4')]){if(_0x5e7816['List'][_0x406f('0xa5')][_0x406f('0x69')]){return _0x5e7816[_0x406f('0xa4')][_0x406f('0xa5')][0x0];}else{return db[_0x406f('0x74')][_0x406f('0x5c')](_[_0x406f('0x15')](_0x35595b[_0x406f('0x5d')],{'firstName':_0x35595b[_0x406f('0x5d')]['to'][0x0],'phone':_0x35595b['body']['to'][0x0],'fax':_0x35595b[_0x406f('0x5d')]['to'][0x0],'ListId':_0x5e7816[_0x406f('0x9c')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x406f('0xb0'));}})[_0x406f('0x32')](function(_0x5067ee){if(_0x5067ee){return db[_0x406f('0x73')][_0x406f('0x5b')]({'where':{'ContactId':_0x5067ee['id'],'closed':![],'FaxAccountId':_0x5e7816['id']}})['then'](function(_0x297e68){if(_0x297e68){return[_0x297e68,![]];}return db[_0x406f('0x73')]['create']({'UserId':_0x35595b[_0x406f('0x5e')]['id'],'ContactId':_0x5067ee['id'],'FaxAccountId':_0x5e7816['id'],'fax':_0x35595b['body']['to'][0x0],'firstMsgDirection':_0x406f('0xb1'),'Messages':[_[_0x406f('0x52')](_0x35595b[_0x406f('0x5d')],{'read':![],'body':_0x35595b[_0x406f('0x5d')]['attachments'][0x0][_0x406f('0xb2')],'FaxAccountId':_0x5e7816['id'],'UserId':_0x35595b[_0x406f('0x5e')]['id'],'ContactId':_0x5067ee['id'],'AttachmentId':_0x35595b[_0x406f('0x5d')][_0x406f('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x406f('0xa2')],'as':_0x406f('0xb3')}]})[_0x406f('0x32')](function(_0x58e0ec){return[_0x58e0ec,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3b4467,_0x1a5725){if(_0x1a5725){return _0x3b4467;}return db[_0x406f('0xa2')][_0x406f('0x5c')]({'direction':_0x406f('0xb1'),'read':![],'body':_0x35595b[_0x406f('0x5d')]['attachments'][0x0][_0x406f('0xb2')],'FaxAccountId':_0x5e7816['id'],'FaxInteractionId':_0x3b4467['id'],'UserId':_0x35595b[_0x406f('0x5e')]['id'],'ContactId':_0x3b4467[_0x406f('0xb4')],'AttachmentId':_0x35595b[_0x406f('0x5d')][_0x406f('0xa7')][0x0]['id']})[_0x406f('0x32')](function(_0x48d221){_0x3b4467[_0x406f('0xb5')][_0x406f('0xb3')]=[];_0x3b4467[_0x406f('0xb5')][_0x406f('0xb3')][_0x406f('0x8b')](_0x48d221[_0x406f('0xb5')]);return _0x3b4467;});})['then'](function(_0x45ecb0){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x406f('0xac')](_0x35595b[_0x406f('0x58')]['id'])?undefined:_0x35595b[_0x406f('0x58')]['id'],'path':_[_0x406f('0xac')](_0x35595b[_0x406f('0x5d')][_0x406f('0xa7')][0x0]['path'])?undefined:_0x35595b[_0x406f('0x5d')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x35595b[_0x406f('0x5d')]['to'][0x0])?undefined:_0x35595b['body']['to'][0x0],'AttachmentId':_0x35595b[_0x406f('0x5d')][_0x406f('0xa7')][0x0]['id']},client9002)[_0x406f('0x32')](function(_0x54c763){logger[_0x406f('0xb6')](_0x406f('0xb7'),_0x54c763);})[_0x406f('0x26')](function(_0x38a9bc){logger['info'](_0x406f('0xb7'),_0x38a9bc);});return _0x45ecb0;})[_0x406f('0x32')](respondWithResult(_0x54fa56,null))[_0x406f('0x26')](handleError(_0x54fa56,null));};exports[_0x406f('0xb8')]=function(_0x17708a,_0x53f036,_0x295828){return db[_0x406f('0x3f')]['find']({'where':{'id':_0x17708a[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x53f036,null))[_0x406f('0x32')](function(_0x770c44){if(_0x770c44){return _0x770c44[_0x406f('0xb8')](_0x17708a[_0x406f('0x5d')]['ids'],_[_0x406f('0x71')](_0x17708a['body'],[_0x406f('0x6b'),'id'])||{})[_0x406f('0xb9')](function(_0x2273e3){for(var _0x2369f3=0x0;_0x2369f3<_0x17708a[_0x406f('0x5d')][_0x406f('0x6b')][_0x406f('0x69')];_0x2369f3+=0x1){socket[_0x406f('0xba')](_0x406f('0xbb'),{'UserId':_0x17708a['body'][_0x406f('0x6b')][_0x2369f3],'FaxAccountId':_0x17708a[_0x406f('0x58')]['id']});}return _0x2273e3;});}})[_0x406f('0x32')](respondWithResult(_0x53f036,null))['catch'](handleError(_0x53f036,null));};exports[_0x406f('0xbc')]=function(_0x6ae1bd,_0x180f9c,_0x5238a7){return db['FaxAccount'][_0x406f('0x5b')]({'where':{'id':_0x6ae1bd[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x180f9c,null))[_0x406f('0x32')](function(_0x197a05){if(_0x197a05){return _0x197a05[_0x406f('0xbc')](_0x6ae1bd[_0x406f('0x45')][_0x406f('0x6b')])[_0x406f('0x32')](function(){if(_[_0x406f('0xbd')](_0x6ae1bd[_0x406f('0x45')]['ids'])){for(var _0x1fe687=0x0;_0x1fe687<_0x6ae1bd[_0x406f('0x45')][_0x406f('0x6b')][_0x406f('0x69')];_0x1fe687+=0x1){socket[_0x406f('0xba')](_0x406f('0xbe'),{'UserId':Number(_0x6ae1bd[_0x406f('0x45')][_0x406f('0x6b')][_0x1fe687]),'FaxAccountId':Number(_0x6ae1bd[_0x406f('0x58')]['id'])});}}else{socket[_0x406f('0xba')](_0x406f('0xbe'),{'UserId':Number(_0x6ae1bd[_0x406f('0x45')][_0x406f('0x6b')]),'FaxAccountId':Number(_0x6ae1bd[_0x406f('0x58')]['id'])});}});}})[_0x406f('0x32')](respondWithStatusCode(_0x180f9c,null))[_0x406f('0x26')](handleError(_0x180f9c,null));};exports[_0x406f('0xbf')]=function(_0x3671d2,_0x52f112,_0x47d643){var _0x297328={};var _0xee6868={};var _0x41437f;var _0x18125e;return db['FaxAccount'][_0x406f('0x68')]({'where':{'id':_0x3671d2[_0x406f('0x58')]['id']}})[_0x406f('0x32')](handleEntityNotFound(_0x52f112,null))[_0x406f('0x32')](function(_0x4f0ddd){if(_0x4f0ddd){_0x41437f=_0x4f0ddd;_0xee6868['model']=_[_0x406f('0x59')](db[_0x406f('0x75')]['rawAttributes']);_0xee6868['query']=_[_0x406f('0x59')](_0x3671d2[_0x406f('0x45')]);_0xee6868[_0x406f('0x46')]=_[_0x406f('0x47')](_0xee6868[_0x406f('0x44')],_0xee6868['query']);_0x297328[_0x406f('0x48')]=_[_0x406f('0x47')](_0xee6868[_0x406f('0x44')],qs[_0x406f('0x49')](_0x3671d2['query'][_0x406f('0x49')]));_0x297328[_0x406f('0x48')]=_0x297328['attributes'][_0x406f('0x69')]?_0x297328[_0x406f('0x48')]:_0xee6868[_0x406f('0x44')];_0x297328[_0x406f('0x4d')]=qs[_0x406f('0x4e')](_0x3671d2[_0x406f('0x45')][_0x406f('0x4e')]);_0x297328[_0x406f('0x4f')]=qs[_0x406f('0x46')](_['pick'](_0x3671d2['query'],_0xee6868[_0x406f('0x46')]));if(_0x3671d2[_0x406f('0x45')][_0x406f('0x51')]){_0x297328[_0x406f('0x4f')]=_[_0x406f('0x52')](_0x297328[_0x406f('0x4f')],{'$or':_['map'](_0x297328[_0x406f('0x48')],function(_0xfda9f5){var _0x50692d={};_0x50692d[_0xfda9f5]={'$like':'%'+_0x3671d2[_0x406f('0x45')][_0x406f('0x51')]+'%'};return _0x50692d;})});}_0x297328=_[_0x406f('0x52')]({},_0x297328,_0x3671d2[_0x406f('0x53')]);return _0x41437f['getAgents'](_0x297328);}})[_0x406f('0x32')](function(_0x1f54f0){if(_0x1f54f0){_0x18125e=_0x1f54f0[_0x406f('0x69')];if(!_0x3671d2[_0x406f('0x45')][_0x406f('0x4a')](_0x406f('0x4b'))){_0x297328[_0x406f('0x4c')]=qs[_0x406f('0x4c')](_0x3671d2[_0x406f('0x45')][_0x406f('0x4c')]);_0x297328[_0x406f('0x2b')]=qs[_0x406f('0x2b')](_0x3671d2['query'][_0x406f('0x2b')]);}return _0x41437f[_0x406f('0xbf')](_0x297328);}})[_0x406f('0x32')](function(_0x1b061d){if(_0x1b061d){return _0x1b061d?{'count':_0x18125e,'rows':_0x1b061d}:null;}})[_0x406f('0x32')](respondWithResult(_0x52f112,null))[_0x406f('0x26')](handleError(_0x52f112,null));}; \ No newline at end of file +var _0x84ab=['nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','where','FaxAccount','count','includeAll','include','params','keys','rawAttributes','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','findOne','Disposition','rows','removeDispositions','ids','getAnswers','CannedAnswer','findAll','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','Set','ecm','gateway','faxdetect','maxrate','t38timeout','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','transaction','VoiceExtension','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','basename','isNil','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84ab,0x12f));var _0xb84a=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x84ab[_0x34933a];return _0x36abb4;};'use strict';var pdf=require(_0xb84a('0x0'));var emlformat=require(_0xb84a('0x1'));var rimraf=require(_0xb84a('0x2'));var zipdir=require(_0xb84a('0x3'));var jsonpatch=require(_0xb84a('0x4'));var rp=require('request-promise');var moment=require(_0xb84a('0x5'));var BPromise=require(_0xb84a('0x6'));var Mustache=require('mustache');var util=require(_0xb84a('0x7'));var path=require(_0xb84a('0x8'));var sox=require(_0xb84a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];config['redis']=_[_0xb84a('0x16')](config[_0xb84a('0x17')],{'host':_0xb84a('0x18'),'port':0x18eb});var socket=require(_0xb84a('0x19'))(new Redis(config[_0xb84a('0x17')]));require(_0xb84a('0x1a'))[_0xb84a('0x1b')](socket);var jayson=require(_0xb84a('0x1c'));var client=jayson[_0xb84a('0x1d')][_0xb84a('0x1e')]({'port':0x232c});var client9002=jayson[_0xb84a('0x1d')][_0xb84a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5716bd,_0x11dd4d,_0x4a691d,_0xb65e5a){return new BPromise(function(_0x3c0b54,_0x1c7378){var _0x1be87a=_0xb65e5a||client;return _0x1be87a[_0xb84a('0x1f')](_0x5716bd,_0x4a691d)[_0xb84a('0x20')](function(_0x28fe46){logger[_0xb84a('0x21')](_0xb84a('0x22'),_0x11dd4d,_0xb84a('0x23'));logger[_0xb84a('0x24')](_0xb84a('0x25'),_0x11dd4d,'request\x20sent',JSON[_0xb84a('0x26')](_0x28fe46));if(_0x28fe46[_0xb84a('0x27')]){if(_0x28fe46['error'][_0xb84a('0x28')]===0x1f4){logger[_0xb84a('0x27')](_0xb84a('0x22'),_0x11dd4d,_0x28fe46[_0xb84a('0x27')]['message']);return _0x1c7378(_0x28fe46['error'][_0xb84a('0x29')]);}logger[_0xb84a('0x27')](_0xb84a('0x22'),_0x11dd4d,_0x28fe46[_0xb84a('0x27')][_0xb84a('0x29')]);return _0x3c0b54(_0x28fe46[_0xb84a('0x27')][_0xb84a('0x29')]);}else{logger[_0xb84a('0x21')](_0xb84a('0x22'),_0x11dd4d,_0xb84a('0x23'));_0x3c0b54(_0x28fe46[_0xb84a('0x2a')][_0xb84a('0x29')]);}})[_0xb84a('0x2b')](function(_0x409df0){logger[_0xb84a('0x27')](_0xb84a('0x22'),_0x11dd4d,_0x409df0);_0x1c7378(_0x409df0);});});}function respondWithStatusCode(_0x378ce1,_0x3ff0bc){_0x3ff0bc=_0x3ff0bc||0xcc;return function(_0x3b6805){if(_0x3b6805){return _0x378ce1[_0xb84a('0x2c')](_0x3ff0bc);}return _0x378ce1[_0xb84a('0x2d')](_0x3ff0bc)[_0xb84a('0x2e')]();};}function respondWithResult(_0x2fe40d,_0x35d1f7){_0x35d1f7=_0x35d1f7||0xc8;return function(_0xefef48){if(_0xefef48){return _0x2fe40d[_0xb84a('0x2d')](_0x35d1f7)['json'](_0xefef48);}};}function respondWithFilteredResult(_0x582954,_0x4608ce){return function(_0x2c30b0){if(_0x2c30b0){var _0x4dab4e=_0x2c30b0['count'],_0x1f690a=_0x4608ce[_0xb84a('0x2f')],_0x36b4f4=_0x4608ce[_0xb84a('0x2f')]+_0x4608ce['limit'],_0x52c23c;if(_0x36b4f4>=_0x4dab4e){_0x36b4f4=_0x4dab4e;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x582954[_0xb84a('0x2d')](_0x52c23c);return _0x582954[_0xb84a('0x30')](_0xb84a('0x31'),_0x1f690a+'-'+_0x36b4f4+'/'+_0x4dab4e)[_0xb84a('0x32')](_0x2c30b0);}return null;};}function patchUpdates(_0x2444fe){return function(_0x144c25){try{jsonpatch[_0xb84a('0x33')](_0x144c25,_0x2444fe,!![]);}catch(_0xac214f){return BPromise['reject'](_0xac214f);}return _0x144c25[_0xb84a('0x34')]();};}function saveUpdates(_0x5b794f,_0x4bca85){return function(_0x2eea7e){if(_0x2eea7e){return _0x2eea7e[_0xb84a('0x35')](_0x5b794f)['then'](function(_0x560203){return _0x560203;});}return null;};}function removeEntity(_0x218481,_0x13c167){return function(_0xdda20e){if(_0xdda20e){return _0xdda20e[_0xb84a('0x36')]()[_0xb84a('0x20')](function(){var _0x1d7ef1=_0xdda20e[_0xb84a('0x37')]({'plain':!![]});var _0x1023aa='FaxAccounts';return db[_0xb84a('0x38')][_0xb84a('0x36')]({'where':{'type':_0x1023aa,'resourceId':_0x1d7ef1['id']}})[_0xb84a('0x20')](function(){return _0xdda20e;});})[_0xb84a('0x20')](function(){_0x218481[_0xb84a('0x2d')](0xcc)[_0xb84a('0x2e')]();});}};}function handleEntityNotFound(_0x2a5130,_0x5aa2ae){return function(_0x30d22d){if(!_0x30d22d){_0x2a5130['sendStatus'](0x194);}return _0x30d22d;};}function handleError(_0x1a3115,_0xb93cca){_0xb93cca=_0xb93cca||0x1f4;return function(_0x2f7e6c){logger['error'](_0x2f7e6c['stack']);if(_0x2f7e6c[_0xb84a('0x39')]){delete _0x2f7e6c[_0xb84a('0x39')];}_0x1a3115[_0xb84a('0x2d')](_0xb93cca)[_0xb84a('0x3a')](_0x2f7e6c);};}exports[_0xb84a('0x3b')]=function(_0x4cb5d4,_0x19aa4c){var _0x2d7216={'include':[{'model':db[_0xb84a('0x3c')],'as':_0xb84a('0x3d')}]},_0x4c2899={},_0x179b02={'count':0x0,'rows':[]};var _0xea32b3=_['map'](db['FaxAccount']['rawAttributes'],function(_0xfac196){return{'name':_0xfac196[_0xb84a('0x3e')],'type':_0xfac196[_0xb84a('0x3f')][_0xb84a('0x40')]};});_0x4c2899['model']=_[_0xb84a('0x41')](_0xea32b3,'name');_0x4c2899[_0xb84a('0x42')]=_['keys'](_0x4cb5d4['query']);_0x4c2899['filters']=_[_0xb84a('0x43')](_0x4c2899[_0xb84a('0x44')],_0x4c2899[_0xb84a('0x42')]);_0x2d7216[_0xb84a('0x45')]=_['intersection'](_0x4c2899[_0xb84a('0x44')],qs[_0xb84a('0x46')](_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x46')]));_0x2d7216['attributes']=_0x2d7216['attributes'][_0xb84a('0x47')]?_0x2d7216[_0xb84a('0x45')]:_0x4c2899['model'];if(!_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x48')](_0xb84a('0x49'))){_0x2d7216[_0xb84a('0x4a')]=qs[_0xb84a('0x4a')](_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x4a')]);_0x2d7216[_0xb84a('0x2f')]=qs[_0xb84a('0x2f')](_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x2f')]);}_0x2d7216[_0xb84a('0x4b')]=qs[_0xb84a('0x4c')](_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x4c')]);_0x2d7216['where']=qs[_0xb84a('0x4d')](_[_0xb84a('0x4e')](_0x4cb5d4[_0xb84a('0x42')],_0x4c2899[_0xb84a('0x4d')]),_0xea32b3);if(_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x4f')]){_0x2d7216['where']=_[_0xb84a('0x50')](_0x2d7216['where'],{'$or':_[_0xb84a('0x41')](_0xea32b3,function(_0x408d2f){if(_0x408d2f[_0xb84a('0x3f')]!==_0xb84a('0x51')){var _0x5e7327={};_0x5e7327[_0x408d2f[_0xb84a('0x39')]]={'$like':'%'+_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x4f')]+'%'};return _0x5e7327;}})});}_0x2d7216=_['merge']({},_0x2d7216,_0x4cb5d4['options']);var _0x385986={'where':_0x2d7216[_0xb84a('0x52')]};return db[_0xb84a('0x53')]['count'](_0x385986)['then'](function(_0x5536f8){_0x179b02[_0xb84a('0x54')]=_0x5536f8;if(_0x4cb5d4[_0xb84a('0x42')][_0xb84a('0x55')]){_0x2d7216[_0xb84a('0x56')]=[{'all':!![]}];}return db[_0xb84a('0x53')]['findAll'](_0x2d7216);})['then'](function(_0x5b853a){_0x179b02['rows']=_0x5b853a;return _0x179b02;})[_0xb84a('0x20')](respondWithFilteredResult(_0x19aa4c,_0x2d7216))[_0xb84a('0x2b')](handleError(_0x19aa4c,null));};exports['show']=function(_0x146d9b,_0xc8bac2){var _0x300516={'raw':![],'where':{'id':_0x146d9b[_0xb84a('0x57')]['id']},'include':[{'model':db[_0xb84a('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2f70f0={};_0x2f70f0['model']=_[_0xb84a('0x58')](db['FaxAccount'][_0xb84a('0x59')]);_0x2f70f0['query']=_['keys'](_0x146d9b['query']);_0x2f70f0[_0xb84a('0x4d')]=_[_0xb84a('0x43')](_0x2f70f0[_0xb84a('0x44')],_0x2f70f0[_0xb84a('0x42')]);_0x300516[_0xb84a('0x45')]=_[_0xb84a('0x43')](_0x2f70f0[_0xb84a('0x44')],qs[_0xb84a('0x46')](_0x146d9b['query']['fields']));_0x300516['attributes']=_0x300516[_0xb84a('0x45')][_0xb84a('0x47')]?_0x300516['attributes']:_0x2f70f0[_0xb84a('0x44')];if(_0x146d9b['query']['includeAll']){_0x300516['include']=[{'all':!![]}];}_0x300516=_[_0xb84a('0x50')]({},_0x300516,_0x146d9b[_0xb84a('0x5a')]);return db[_0xb84a('0x53')]['find'](_0x300516)[_0xb84a('0x20')](handleEntityNotFound(_0xc8bac2,null))[_0xb84a('0x20')](respondWithResult(_0xc8bac2,null))[_0xb84a('0x2b')](handleError(_0xc8bac2,null));};exports['create']=function(_0x1adf13,_0x4c1307){return db['FaxAccount'][_0xb84a('0x5b')](_0x1adf13['body'],{})[_0xb84a('0x20')](function(_0x540742){var _0x1aad15=_0x1adf13[_0xb84a('0x5c')][_0xb84a('0x37')]({'plain':!![]});if(!_0x1aad15)throw new Error(_0xb84a('0x5d'));if(_0x1aad15['role']==='user'){var _0x4fc998=_0x540742[_0xb84a('0x37')]({'plain':!![]});var _0x2bebb6='FaxAccounts';return db['UserProfileSection'][_0xb84a('0x5e')]({'where':{'name':_0x2bebb6,'userProfileId':_0x1aad15[_0xb84a('0x5f')]},'raw':!![]})[_0xb84a('0x20')](function(_0x5f415d){if(_0x5f415d&&_0x5f415d[_0xb84a('0x60')]===0x0){return db[_0xb84a('0x38')]['create']({'name':_0x4fc998[_0xb84a('0x39')],'resourceId':_0x4fc998['id'],'type':_0x5f415d[_0xb84a('0x39')],'sectionId':_0x5f415d['id']},{})[_0xb84a('0x20')](function(){return _0x540742;});}else{return _0x540742;}})[_0xb84a('0x2b')](function(_0x3bbc69){logger[_0xb84a('0x27')](_0xb84a('0x61'),_0x3bbc69);throw _0x3bbc69;});}return _0x540742;})['then'](respondWithResult(_0x4c1307,0xc9))[_0xb84a('0x2b')](handleError(_0x4c1307,null));};exports[_0xb84a('0x35')]=function(_0x521e4a,_0x30846b){if(_0x521e4a[_0xb84a('0x62')]['id']){delete _0x521e4a[_0xb84a('0x62')]['id'];}return db[_0xb84a('0x53')][_0xb84a('0x5e')]({'where':{'id':_0x521e4a[_0xb84a('0x57')]['id']},'include':[{'model':db[_0xb84a('0x3c')],'as':_0xb84a('0x3d')}]})[_0xb84a('0x20')](handleEntityNotFound(_0x30846b,null))['then'](saveUpdates(_0x521e4a[_0xb84a('0x62')],null))['then'](respondWithResult(_0x30846b,null))['catch'](handleError(_0x30846b,null));};exports[_0xb84a('0x36')]=function(_0x5e11c8,_0x2800f3){return db['FaxAccount'][_0xb84a('0x5e')]({'where':{'id':_0x5e11c8[_0xb84a('0x57')]['id']}})['then'](handleEntityNotFound(_0x2800f3,null))[_0xb84a('0x20')](removeEntity(_0x2800f3,null))[_0xb84a('0x2b')](handleError(_0x2800f3,null));};exports[_0xb84a('0x63')]=function(_0x1dd409,_0x2e39c3){return db[_0xb84a('0x53')][_0xb84a('0x63')]()['then'](respondWithResult(_0x2e39c3,null))[_0xb84a('0x2b')](handleError(_0x2e39c3,null));};exports['addDisposition']=function(_0x4cee7b,_0x45b798,_0x2a2dc0){if(_0x4cee7b[_0xb84a('0x62')]['id']){delete _0x4cee7b[_0xb84a('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4cee7b[_0xb84a('0x57')]['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x45b798,null))[_0xb84a('0x20')](function(_0x1a2e1a){if(_0x1a2e1a){_0x4cee7b['body'][_0xb84a('0x64')]=_0x1a2e1a['id'];return db['Disposition'][_0xb84a('0x5b')](_0x4cee7b['body']);}})[_0xb84a('0x20')](respondWithResult(_0x45b798,null))['catch'](handleError(_0x45b798,null));};exports['getDispositions']=function(_0x5f2667,_0x23fd4c,_0xf936f1){var _0x18abb6={'raw':![],'where':{}};var _0x1001f8={};var _0x5a2c96={'count':0x0,'rows':[]};return db[_0xb84a('0x53')][_0xb84a('0x65')]({'where':{'id':_0x5f2667[_0xb84a('0x57')]['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x23fd4c,null))[_0xb84a('0x20')](function(_0x27a37b){if(_0x27a37b){_0x1001f8[_0xb84a('0x44')]=_['keys'](db[_0xb84a('0x66')][_0xb84a('0x59')]);_0x1001f8[_0xb84a('0x42')]=_[_0xb84a('0x58')](_0x5f2667[_0xb84a('0x42')]);_0x1001f8[_0xb84a('0x4d')]=_['intersection'](_0x1001f8[_0xb84a('0x44')],_0x1001f8[_0xb84a('0x42')]);_0x18abb6[_0xb84a('0x45')]=_[_0xb84a('0x43')](_0x1001f8[_0xb84a('0x44')],qs['fields'](_0x5f2667[_0xb84a('0x42')]['fields']));_0x18abb6[_0xb84a('0x45')]=_0x18abb6['attributes'][_0xb84a('0x47')]?_0x18abb6[_0xb84a('0x45')]:_0x1001f8[_0xb84a('0x44')];if(!_0x5f2667['query'][_0xb84a('0x48')](_0xb84a('0x49'))){_0x18abb6[_0xb84a('0x4a')]=qs[_0xb84a('0x4a')](_0x5f2667[_0xb84a('0x42')]['limit']);_0x18abb6[_0xb84a('0x2f')]=qs[_0xb84a('0x2f')](_0x5f2667[_0xb84a('0x42')]['offset']);}_0x18abb6[_0xb84a('0x4b')]=qs['sort'](_0x5f2667['query'][_0xb84a('0x4c')]);_0x18abb6[_0xb84a('0x52')]=qs[_0xb84a('0x4d')](_[_0xb84a('0x4e')](_0x5f2667[_0xb84a('0x42')],_0x1001f8[_0xb84a('0x4d')]));_0x18abb6[_0xb84a('0x52')][_0xb84a('0x64')]=_0x27a37b['id'];if(_0x5f2667[_0xb84a('0x42')][_0xb84a('0x4f')]){_0x18abb6[_0xb84a('0x52')]=_[_0xb84a('0x50')](_0x18abb6[_0xb84a('0x52')],{'$or':_[_0xb84a('0x41')](_0x18abb6[_0xb84a('0x45')],function(_0x1bfbb2){var _0xb18756={};_0xb18756[_0x1bfbb2]={'$like':'%'+_0x5f2667[_0xb84a('0x42')]['filter']+'%'};return _0xb18756;})});}_0x18abb6=_[_0xb84a('0x50')]({},_0x18abb6,_0x5f2667[_0xb84a('0x5a')]);return db['Disposition'][_0xb84a('0x54')]({'where':_0x18abb6['where']})[_0xb84a('0x20')](function(_0x5eff4e){_0x5a2c96[_0xb84a('0x54')]=_0x5eff4e;if(_0x5f2667['query']['includeAll']){_0x18abb6[_0xb84a('0x56')]=[{'all':!![]}];}return db[_0xb84a('0x66')]['findAll'](_0x18abb6);})[_0xb84a('0x20')](function(_0xcf9bc2){_0x5a2c96[_0xb84a('0x67')]=_0xcf9bc2;return _0x5a2c96;});}})[_0xb84a('0x20')](respondWithFilteredResult(_0x23fd4c,_0x18abb6))[_0xb84a('0x2b')](handleError(_0x23fd4c,null));};exports['removeDispositions']=function(_0x249db5,_0x134f92,_0x3ab655){return db[_0xb84a('0x53')]['find']({'where':{'id':_0x249db5[_0xb84a('0x57')]['id']}})['then'](handleEntityNotFound(_0x134f92,null))[_0xb84a('0x20')](function(_0x12d796){if(_0x12d796){return _0x12d796[_0xb84a('0x68')](_0x249db5[_0xb84a('0x42')][_0xb84a('0x69')]);}})[_0xb84a('0x20')](respondWithStatusCode(_0x134f92,null))['catch'](handleError(_0x134f92,null));};exports['addAnswer']=function(_0x33d069,_0x3eca58,_0x4ba1b4){if(_0x33d069[_0xb84a('0x62')]['id']){delete _0x33d069['body']['id'];}return db[_0xb84a('0x53')]['find']({'where':{'id':_0x33d069['params']['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x3eca58,null))[_0xb84a('0x20')](function(_0xac353){if(_0xac353){_0x33d069[_0xb84a('0x62')][_0xb84a('0x64')]=_0xac353['id'];return db['CannedAnswer']['create'](_0x33d069[_0xb84a('0x62')]);}})[_0xb84a('0x20')](respondWithResult(_0x3eca58,null))['catch'](handleError(_0x3eca58,null));};exports[_0xb84a('0x6a')]=function(_0x448758,_0x385a05,_0x462a02){var _0x521e9c={'raw':![],'where':{}};var _0x20173d={};var _0x5cfc2c={'count':0x0,'rows':[]};return db[_0xb84a('0x53')][_0xb84a('0x65')]({'where':{'id':_0x448758[_0xb84a('0x57')]['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x385a05,null))[_0xb84a('0x20')](function(_0x1c3fd9){if(_0x1c3fd9){_0x20173d[_0xb84a('0x44')]=_[_0xb84a('0x58')](db[_0xb84a('0x6b')][_0xb84a('0x59')]);_0x20173d[_0xb84a('0x42')]=_[_0xb84a('0x58')](_0x448758['query']);_0x20173d[_0xb84a('0x4d')]=_[_0xb84a('0x43')](_0x20173d[_0xb84a('0x44')],_0x20173d[_0xb84a('0x42')]);_0x521e9c[_0xb84a('0x45')]=_[_0xb84a('0x43')](_0x20173d[_0xb84a('0x44')],qs['fields'](_0x448758[_0xb84a('0x42')][_0xb84a('0x46')]));_0x521e9c[_0xb84a('0x45')]=_0x521e9c[_0xb84a('0x45')][_0xb84a('0x47')]?_0x521e9c[_0xb84a('0x45')]:_0x20173d[_0xb84a('0x44')];if(!_0x448758['query'][_0xb84a('0x48')](_0xb84a('0x49'))){_0x521e9c[_0xb84a('0x4a')]=qs[_0xb84a('0x4a')](_0x448758[_0xb84a('0x42')][_0xb84a('0x4a')]);_0x521e9c[_0xb84a('0x2f')]=qs[_0xb84a('0x2f')](_0x448758[_0xb84a('0x42')]['offset']);}_0x521e9c[_0xb84a('0x4b')]=qs[_0xb84a('0x4c')](_0x448758[_0xb84a('0x42')][_0xb84a('0x4c')]);_0x521e9c['where']=qs[_0xb84a('0x4d')](_[_0xb84a('0x4e')](_0x448758[_0xb84a('0x42')],_0x20173d[_0xb84a('0x4d')]));_0x521e9c['where'][_0xb84a('0x64')]=_0x1c3fd9['id'];if(_0x448758['query']['filter']){_0x521e9c[_0xb84a('0x52')]=_['merge'](_0x521e9c[_0xb84a('0x52')],{'$or':_[_0xb84a('0x41')](_0x521e9c['attributes'],function(_0x384cff){var _0x558398={};_0x558398[_0x384cff]={'$like':'%'+_0x448758[_0xb84a('0x42')]['filter']+'%'};return _0x558398;})});}_0x521e9c=_[_0xb84a('0x50')]({},_0x521e9c,_0x448758[_0xb84a('0x5a')]);return db['CannedAnswer'][_0xb84a('0x54')]({'where':_0x521e9c[_0xb84a('0x52')]})[_0xb84a('0x20')](function(_0x3eac66){_0x5cfc2c['count']=_0x3eac66;if(_0x448758[_0xb84a('0x42')][_0xb84a('0x55')]){_0x521e9c[_0xb84a('0x56')]=[{'all':!![]}];}return db[_0xb84a('0x6b')][_0xb84a('0x6c')](_0x521e9c);})[_0xb84a('0x20')](function(_0x213af0){_0x5cfc2c[_0xb84a('0x67')]=_0x213af0;return _0x5cfc2c;});}})[_0xb84a('0x20')](respondWithFilteredResult(_0x385a05,_0x521e9c))[_0xb84a('0x2b')](handleError(_0x385a05,null));};exports[_0xb84a('0x6d')]=function(_0x126e59,_0x28d2a0,_0x136b11){return db[_0xb84a('0x53')][_0xb84a('0x5e')]({'where':{'id':_0x126e59[_0xb84a('0x57')]['id']}})['then'](handleEntityNotFound(_0x28d2a0,null))[_0xb84a('0x20')](function(_0x36b88a){if(_0x36b88a){return _0x36b88a['removeAnswers'](_0x126e59[_0xb84a('0x42')]['ids']);}})[_0xb84a('0x20')](respondWithStatusCode(_0x28d2a0,null))['catch'](handleError(_0x28d2a0,null));};exports[_0xb84a('0x6e')]=function(_0x57fe57,_0x54250a,_0x388cc6){return db[_0xb84a('0x6f')][_0xb84a('0x5e')]({'where':{'id':_0x57fe57[_0xb84a('0x57')]['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x54250a,null))[_0xb84a('0x20')](function(_0x3e8a1c){if(_0x3e8a1c){return _0x3e8a1c['addInteraction'](_0x57fe57[_0xb84a('0x62')]['ids'],_[_0xb84a('0x70')](_0x57fe57[_0xb84a('0x62')],[_0xb84a('0x69'),'id'])||{});}})[_0xb84a('0x20')](respondWithResult(_0x54250a,null))['catch'](handleError(_0x54250a,null));};exports['getInteractions']=function(_0x4ebd70,_0x589181,_0x454cb){var _0x77a106={'raw':![],'where':{}};var _0x1a7447={};var _0x2698b9={'count':0x0,'rows':[]};return db[_0xb84a('0x53')]['findOne']({'where':{'id':_0x4ebd70[_0xb84a('0x57')]['id']}})['then'](handleEntityNotFound(_0x589181,null))[_0xb84a('0x20')](function(_0x1f64ce){if(_0x1f64ce){_0x1a7447[_0xb84a('0x44')]=_[_0xb84a('0x58')](db[_0xb84a('0x6f')]['rawAttributes']);_0x1a7447[_0xb84a('0x42')]=_[_0xb84a('0x58')](_0x4ebd70[_0xb84a('0x42')]);_0x1a7447[_0xb84a('0x4d')]=_[_0xb84a('0x43')](_0x1a7447[_0xb84a('0x44')],_0x1a7447['query']);_0x77a106[_0xb84a('0x45')]=_['intersection'](_0x1a7447[_0xb84a('0x44')],qs[_0xb84a('0x46')](_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x46')]));_0x77a106[_0xb84a('0x45')]=_0x77a106[_0xb84a('0x45')]['length']?_0x77a106['attributes']:_0x1a7447['model'];if(!_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x48')](_0xb84a('0x49'))){_0x77a106['limit']=qs['limit'](_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x4a')]);_0x77a106[_0xb84a('0x2f')]=qs[_0xb84a('0x2f')](_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x2f')]);}_0x77a106[_0xb84a('0x4b')]=qs[_0xb84a('0x4c')](_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x4c')]);_0x77a106[_0xb84a('0x52')]=qs[_0xb84a('0x4d')](_[_0xb84a('0x4e')](_0x4ebd70[_0xb84a('0x42')],_0x1a7447[_0xb84a('0x4d')]));_0x77a106[_0xb84a('0x52')][_0xb84a('0x64')]=_0x1f64ce['id'];if(_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x4f')]){_0x77a106[_0xb84a('0x52')]=_[_0xb84a('0x50')](_0x77a106[_0xb84a('0x52')],{'$or':_[_0xb84a('0x41')](_0x77a106['attributes'],function(_0x2ffaf5){var _0x4a8222={};_0x4a8222[_0x2ffaf5]={'$like':'%'+_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x4f')]+'%'};return _0x4a8222;})});}_0x77a106=_['merge']({},_0x77a106,_0x4ebd70[_0xb84a('0x5a')]);return db[_0xb84a('0x6f')][_0xb84a('0x54')]({'where':_0x77a106[_0xb84a('0x52')]})[_0xb84a('0x20')](function(_0x57aa21){_0x2698b9[_0xb84a('0x54')]=_0x57aa21;if(_0x4ebd70['query'][_0xb84a('0x55')]){_0x77a106['include']=[{'model':db[_0xb84a('0x71')],'as':'Contact','required':![]},{'model':db[_0xb84a('0x72')],'as':_0xb84a('0x73'),'attributes':['name',_0xb84a('0x74'),_0xb84a('0x75')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xb84a('0x39'),_0xb84a('0x76')],'where':_0x4ebd70[_0xb84a('0x42')][_0xb84a('0x77')]?{'id':_0x4ebd70[_0xb84a('0x42')]['tag']}:undefined,'required':_0x4ebd70['query'][_0xb84a('0x77')]?!![]:![]}];}return db['FaxInteraction'][_0xb84a('0x6c')](_0x77a106);})['then'](function(_0x3e83d6){_0x2698b9[_0xb84a('0x67')]=_0x3e83d6;return _0x2698b9;});}})[_0xb84a('0x20')](respondWithFilteredResult(_0x589181,_0x77a106))[_0xb84a('0x2b')](handleError(_0x589181,null));};exports[_0xb84a('0x78')]=function(_0x3f4fac,_0xfb98c8,_0x1457fc){return db[_0xb84a('0x53')]['findOne']({'where':{'id':_0x3f4fac[_0xb84a('0x57')]['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0xfb98c8,null))[_0xb84a('0x20')](function(_0x4c7020){if(_0x4c7020){return db[_0xb84a('0x79')]['transaction'](function(_0x271d3d){return db[_0xb84a('0x7a')][_0xb84a('0x36')]({'where':{'FaxAccountId':_0x3f4fac[_0xb84a('0x57')]['id']},'transaction':_0x271d3d})[_0xb84a('0x20')](function(_0x2123b4){var _0x17c7f7=_['map'](_0x3f4fac[_0xb84a('0x62')],function(_0xcb0995){_0xcb0995['FaxAccountId']=_0x3f4fac['params']['id'];return _0xcb0995;});return db[_0xb84a('0x7a')][_0xb84a('0x7b')](_0x17c7f7,{'transaction':_0x271d3d});});})[_0xb84a('0x20')](function(){return db[_0xb84a('0x7a')][_0xb84a('0x7c')]({'where':{'FaxAccountId':_0x3f4fac[_0xb84a('0x57')]['id']},'order':_0xb84a('0x7d')});});}})[_0xb84a('0x20')](respondWithResult(_0xfb98c8,null))[_0xb84a('0x2b')](handleError(_0xfb98c8,null));};exports[_0xb84a('0x7e')]=function(_0x430d2e,_0x19cef4,_0x22b586){var _0x3ae266={};var _0x151983={};var _0x29773a;var _0x1a0bd0;return db[_0xb84a('0x53')][_0xb84a('0x65')]({'where':{'id':_0x430d2e[_0xb84a('0x57')]['id']}})['then'](handleEntityNotFound(_0x19cef4,null))[_0xb84a('0x20')](function(_0x5c7f20){if(_0x5c7f20){_0x29773a=_0x5c7f20;_0x151983[_0xb84a('0x44')]=_[_0xb84a('0x58')](db[_0xb84a('0x7a')][_0xb84a('0x59')]);_0x151983[_0xb84a('0x42')]=_[_0xb84a('0x58')](_0x430d2e[_0xb84a('0x42')]);_0x151983[_0xb84a('0x4d')]=_['intersection'](_0x151983[_0xb84a('0x44')],_0x151983[_0xb84a('0x42')]);_0x3ae266['attributes']=_[_0xb84a('0x43')](_0x151983[_0xb84a('0x44')],qs[_0xb84a('0x46')](_0x430d2e[_0xb84a('0x42')]['fields']));_0x3ae266[_0xb84a('0x45')]=_0x3ae266[_0xb84a('0x45')][_0xb84a('0x47')]?_0x3ae266[_0xb84a('0x45')]:_0x151983[_0xb84a('0x44')];_0x3ae266['order']=qs[_0xb84a('0x4c')](_0x430d2e[_0xb84a('0x42')]['sort']);_0x3ae266[_0xb84a('0x52')]=qs['filters'](_[_0xb84a('0x4e')](_0x430d2e[_0xb84a('0x42')],_0x151983[_0xb84a('0x4d')]));if(_0x430d2e[_0xb84a('0x42')]['filter']){_0x3ae266[_0xb84a('0x52')]=_[_0xb84a('0x50')](_0x3ae266['where'],{'$or':_['map'](_0x3ae266['attributes'],function(_0x3ec8da){var _0x28e6ed={};_0x28e6ed[_0x3ec8da]={'$like':'%'+_0x430d2e['query']['filter']+'%'};return _0x28e6ed;})});}_0x3ae266=_[_0xb84a('0x50')]({},_0x3ae266,_0x430d2e['options']);return _0x29773a[_0xb84a('0x7e')](_0x3ae266);}})[_0xb84a('0x20')](function(_0x3e5d64){if(_0x3e5d64){_0x1a0bd0=_0x3e5d64['length'];if(!_0x430d2e['query'][_0xb84a('0x48')]('nolimit')){_0x3ae266[_0xb84a('0x4a')]=qs[_0xb84a('0x4a')](_0x430d2e[_0xb84a('0x42')][_0xb84a('0x4a')]);_0x3ae266[_0xb84a('0x2f')]=qs[_0xb84a('0x2f')](_0x430d2e['query'][_0xb84a('0x2f')]);}return _0x29773a[_0xb84a('0x7e')](_0x3ae266);}})[_0xb84a('0x20')](function(_0x179590){if(_0x179590){return _0x179590?{'count':_0x1a0bd0,'rows':_0x179590}:null;}})[_0xb84a('0x20')](respondWithResult(_0x19cef4,null))[_0xb84a('0x2b')](handleError(_0x19cef4,null));};function Extension(_0x277aab,_0x3c20cf,_0x2c1ad5,_0x333146){this[_0xb84a('0x7f')]=_0xb84a('0x80');this[_0xb84a('0x81')]=_0x277aab[_0xb84a('0x82')];this[_0xb84a('0x83')]=_0x333146;this['type']=_0xb84a('0x84');this[_0xb84a('0x85')]=_0xb84a('0x86');this[_0xb84a('0x64')]=_0x277aab['id'];this[_0xb84a('0x7d')]=_0x3c20cf;this['appdata']=_0x2c1ad5;}function createExtensionsReciveFax(_0x4af1fb){var _0x53f1e0=0x1;var _0x1ea81c=[];_0x1ea81c[_0xb84a('0x87')](new Extension(_0x4af1fb,_0x53f1e0,'',_0xb84a('0x88')));_0x53f1e0+=0x1;_0x1ea81c['push'](new Extension(_0x4af1fb,_0x53f1e0,'CDR(type)=inbound-fax',_0xb84a('0x89')));_0x53f1e0+=0x1;for(var _0x4ebcc0 in _0x4af1fb){if(_0x4af1fb['hasOwnProperty'](_0x4ebcc0)&&(_0x4ebcc0===_0xb84a('0x8a')||_0x4ebcc0===_0xb84a('0x82')||_0x4ebcc0===_0xb84a('0x8b')||_0x4ebcc0===_0xb84a('0x8c')||_0x4ebcc0==='headerinfo'||_0x4ebcc0===_0xb84a('0x8d')||_0x4ebcc0==='minrate'||_0x4ebcc0==='modem'||_0x4ebcc0===_0xb84a('0x8e'))){_0x1ea81c[_0xb84a('0x87')](new Extension(_0x4af1fb,_0x53f1e0,_0xb84a('0x8f')+_0x4ebcc0+')='+_0x4af1fb[_0x4ebcc0],_0xb84a('0x89')));_0x53f1e0+=0x1;}}_0x1ea81c[_0xb84a('0x87')](new Extension(_0x4af1fb,_0x53f1e0,'6',_0xb84a('0x90')));_0x53f1e0+=0x1;_0x1ea81c[_0xb84a('0x87')](new Extension(_0x4af1fb,_0x53f1e0,_0xb84a('0x91'),_0xb84a('0x92')));_0x53f1e0=0x0;return _0x1ea81c;}exports[_0xb84a('0x93')]=function(_0x455f98,_0x41ca11,_0x23cd7f){var _0x1b229b;return db['sequelize'][_0xb84a('0x94')](function(_0x376495){return db[_0xb84a('0x53')][_0xb84a('0x5b')](_0x455f98[_0xb84a('0x62')],{'transaction':_0x376495})[_0xb84a('0x20')](function(_0x33ec5d){_0x1b229b=_0x33ec5d[_0xb84a('0x37')]({'plain':!![]});return db[_0xb84a('0x95')]['bulkCreate'](createExtensionsReciveFax(_0x1b229b),{'transaction':_0x376495});});})[_0xb84a('0x20')](function(){return _0x1b229b;})[_0xb84a('0x20')](respondWithResult(_0x41ca11,null))['catch'](handleError(_0x41ca11,null));};exports['updateAccountApplications']=function(_0x24e3fb,_0x53b3c3,_0x239550){var _0x438801;return db[_0xb84a('0x79')][_0xb84a('0x94')](function(_0x5398f2){return db[_0xb84a('0x53')][_0xb84a('0x35')](_0x24e3fb[_0xb84a('0x62')],{'where':{'id':_0x24e3fb[_0xb84a('0x62')]['id']},'transaction':_0x5398f2})[_0xb84a('0x20')](function(_0x148b95){return db[_0xb84a('0x95')][_0xb84a('0x36')]({'where':{'FaxAccountId':_0x24e3fb[_0xb84a('0x62')]['id']},'transaction':_0x5398f2})['then'](function(_0x149032){return db[_0xb84a('0x95')][_0xb84a('0x7b')](createExtensionsReciveFax(_[_0xb84a('0x70')](_0x24e3fb[_0xb84a('0x62')],[_0xb84a('0x96'),'key','createdAt',_0xb84a('0x97'),_0xb84a('0x98'),'ListId'])),{'transaction':_0x5398f2});});});})[_0xb84a('0x20')](function(){return db['FaxAccount'][_0xb84a('0x99')](_0x24e3fb[_0xb84a('0x62')]['id']);})[_0xb84a('0x20')](respondWithResult(_0x53b3c3,null))[_0xb84a('0x2b')](handleError(_0x53b3c3,null));};exports[_0xb84a('0x9a')]=function(_0x5e4d3e,_0x2d1a82,_0x3b413c){var _0x2702ad={'raw':!![],'where':{}};var _0x43de36={};var _0x112611={'count':0x0,'rows':[]};return db[_0xb84a('0x53')][_0xb84a('0x65')]({'where':{'id':_0x5e4d3e['params']['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x2d1a82,null))['then'](function(_0x13ae58){if(_0x13ae58){_0x43de36[_0xb84a('0x44')]=_[_0xb84a('0x58')](db[_0xb84a('0x9b')][_0xb84a('0x59')]);_0x43de36[_0xb84a('0x42')]=_[_0xb84a('0x58')](_0x5e4d3e[_0xb84a('0x42')]);_0x43de36[_0xb84a('0x4d')]=_['intersection'](_0x43de36[_0xb84a('0x44')],_0x43de36[_0xb84a('0x42')]);_0x2702ad[_0xb84a('0x45')]=_['intersection'](_0x43de36['model'],qs[_0xb84a('0x46')](_0x5e4d3e[_0xb84a('0x42')]['fields']));_0x2702ad[_0xb84a('0x45')]=_0x2702ad[_0xb84a('0x45')][_0xb84a('0x47')]?_0x2702ad[_0xb84a('0x45')]:_0x43de36['model'];if(!_0x5e4d3e[_0xb84a('0x42')][_0xb84a('0x48')](_0xb84a('0x49'))){_0x2702ad[_0xb84a('0x4a')]=qs[_0xb84a('0x4a')](_0x5e4d3e[_0xb84a('0x42')][_0xb84a('0x4a')]);_0x2702ad[_0xb84a('0x2f')]=qs['offset'](_0x5e4d3e['query'][_0xb84a('0x2f')]);}_0x2702ad[_0xb84a('0x4b')]=qs[_0xb84a('0x4c')](_0x5e4d3e['query'][_0xb84a('0x4c')]);_0x2702ad['where']=qs[_0xb84a('0x4d')](_['pick'](_0x5e4d3e[_0xb84a('0x42')],_0x43de36[_0xb84a('0x4d')]));_0x2702ad['where'][_0xb84a('0x64')]=_0x13ae58['id'];if(_0x5e4d3e[_0xb84a('0x42')][_0xb84a('0x4f')]){_0x2702ad[_0xb84a('0x52')]=_[_0xb84a('0x50')](_0x2702ad[_0xb84a('0x52')],{'$or':_['map'](_0x2702ad[_0xb84a('0x45')],function(_0x7e4103){var _0x5b96e4={};_0x5b96e4[_0x7e4103]={'$like':'%'+_0x5e4d3e['query'][_0xb84a('0x4f')]+'%'};return _0x5b96e4;})});}if(_0x5e4d3e['query'][_0xb84a('0x9c')]){var _0x25d57a=_0x5e4d3e['query'][_0xb84a('0x9c')][_0xb84a('0x9d')](',');var _0x2eb8ed={};_0x2eb8ed[_0x25d57a[0x0]]={'$gte':moment(_0x25d57a[0x1])[_0xb84a('0x9e')](_0xb84a('0x9f'))};_0x2702ad['where']=_['merge'](_0x2702ad['where'],_0x2eb8ed);}_0x2702ad=_[_0xb84a('0x50')]({},_0x2702ad,_0x5e4d3e['options']);return db[_0xb84a('0x9b')][_0xb84a('0x54')]({'where':_0x2702ad[_0xb84a('0x52')]})[_0xb84a('0x20')](function(_0x3ec69b){_0x112611[_0xb84a('0x54')]=_0x3ec69b;if(_0x5e4d3e[_0xb84a('0x42')][_0xb84a('0x55')]){_0x2702ad[_0xb84a('0x56')]=[{'all':!![]}];}return db['FaxMessage'][_0xb84a('0x6c')](_0x2702ad);})[_0xb84a('0x20')](function(_0x3f8664){_0x112611[_0xb84a('0x67')]=_0x3f8664;return _0x112611;});}})[_0xb84a('0x20')](respondWithFilteredResult(_0x2d1a82,_0x2702ad))['catch'](handleError(_0x2d1a82,null));};exports[_0xb84a('0x3a')]=function(_0x1a015f,_0x42a323,_0x847c4e){var _0x54fe74,_0x5c25a6={},_0x513e22;if(_0x1a015f[_0xb84a('0x62')]['to']){_0x513e22=_0x1a015f[_0xb84a('0x62')]['to'][0x0];}return db[_0xb84a('0x53')][_0xb84a('0x5e')]({'where':{'id':_0x1a015f[_0xb84a('0x57')]['id']},'include':[{'model':db[_0xb84a('0xa0')],'as':_0xb84a('0xa1'),'include':[{'model':db['CmContact'],'as':_0xb84a('0xa2'),'where':{'fax':_0x513e22},'limit':0x1,'order':[['updatedAt',_0xb84a('0xa3')]]}]}]})[_0xb84a('0x20')](handleEntityNotFound(_0x42a323,null))['then'](function(_0x9fc664){_0x54fe74=_0x9fc664;if(_0x1a015f['body'][_0xb84a('0xa4')]&&_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][_0xb84a('0x47')]){for(var _0x344933=0x0;_0x344933<_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][_0xb84a('0x47')];_0x344933+=0x1){_0x1a015f[_0xb84a('0x62')]['attachments'][_0x344933]={'filename':_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][_0x344933][_0xb84a('0x39')],'id':_0x1a015f['body']['attachments'][_0x344933]['id'],'path':path[_0xb84a('0xa5')](config[_0xb84a('0xa6')],'server/files/attachments',_0x1a015f['body'][_0xb84a('0xa4')][_0x344933][_0xb84a('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x1a015f['params']['id'])?undefined:_0x1a015f[_0xb84a('0x57')]['id'],'path':_[_0xb84a('0xa8')](_0x1a015f['body'][_0xb84a('0xa4')][0x0][_0xb84a('0x8')])?undefined:_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][0x0][_0xb84a('0x8')],'fax':_[_0xb84a('0xa8')](_0x1a015f[_0xb84a('0x62')]['to'][0x0])?undefined:_0x1a015f['body']['to'][0x0]},client9002);})[_0xb84a('0x20')](function(){if(_0x54fe74){if(_['isNil'](_0x1a015f[_0xb84a('0x62')]['from'])){_0x1a015f[_0xb84a('0x62')]['from']=util['format'](_0xb84a('0xa9'),_0x54fe74[_0xb84a('0x39')],_0x54fe74[_0xb84a('0xaa')]);}if(_0x54fe74[_0xb84a('0xa1')]){if(_0x54fe74[_0xb84a('0xa1')][_0xb84a('0xa2')]['length']){return _0x54fe74[_0xb84a('0xa1')][_0xb84a('0xa2')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x1a015f['body'],{'firstName':_0x1a015f['body']['to'][0x0],'phone':_0x1a015f[_0xb84a('0x62')]['to'][0x0],'fax':_0x1a015f[_0xb84a('0x62')]['to'][0x0],'ListId':_0x54fe74[_0xb84a('0xab')]}));}}else{throw new Error(_0xb84a('0xac'));}}else{throw new Error(_0xb84a('0xad'));}})[_0xb84a('0x20')](function(_0x180ea1){if(_0x180ea1){return db['FaxInteraction'][_0xb84a('0x5e')]({'where':{'ContactId':_0x180ea1['id'],'closed':![],'FaxAccountId':_0x54fe74['id']}})[_0xb84a('0x20')](function(_0x158220){if(_0x158220){return[_0x158220,![]];}return db[_0xb84a('0x6f')]['create']({'UserId':_0x1a015f[_0xb84a('0x5c')]['id'],'ContactId':_0x180ea1['id'],'FaxAccountId':_0x54fe74['id'],'fax':_0x1a015f[_0xb84a('0x62')]['to'][0x0],'firstMsgDirection':_0xb84a('0xae'),'Messages':[_[_0xb84a('0x50')](_0x1a015f['body'],{'read':![],'body':_0x1a015f['body']['attachments'][0x0][_0xb84a('0xaf')],'FaxAccountId':_0x54fe74['id'],'UserId':_0x1a015f['user']['id'],'ContactId':_0x180ea1['id'],'AttachmentId':_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0xb84a('0x9b')],'as':_0xb84a('0xb0')}]})[_0xb84a('0x20')](function(_0x2e3c1e){return[_0x2e3c1e,!![]];});});}else{throw new Error(_0xb84a('0xb1'));}})[_0xb84a('0xb2')](function(_0x14a1fc,_0x437fa6){if(_0x437fa6){return _0x14a1fc;}return db[_0xb84a('0x9b')][_0xb84a('0x5b')]({'direction':_0xb84a('0xae'),'read':![],'body':_0x1a015f['body'][_0xb84a('0xa4')][0x0]['filename'],'FaxAccountId':_0x54fe74['id'],'FaxInteractionId':_0x14a1fc['id'],'UserId':_0x1a015f[_0xb84a('0x5c')]['id'],'ContactId':_0x14a1fc[_0xb84a('0xb3')],'AttachmentId':_0x1a015f['body'][_0xb84a('0xa4')][0x0]['id']})[_0xb84a('0x20')](function(_0x54067f){_0x14a1fc[_0xb84a('0xb4')][_0xb84a('0xb0')]=[];_0x14a1fc[_0xb84a('0xb4')][_0xb84a('0xb0')][_0xb84a('0x87')](_0x54067f[_0xb84a('0xb4')]);return _0x14a1fc;});})[_0xb84a('0x20')](function(_0x498c2f){respondWithRpcPromise(_0xb84a('0xb5'),_0xb84a('0xb5'),{'FaxAccountId':_[_0xb84a('0xa8')](_0x1a015f[_0xb84a('0x57')]['id'])?undefined:_0x1a015f[_0xb84a('0x57')]['id'],'path':_[_0xb84a('0xa8')](_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][0x0][_0xb84a('0x8')])?undefined:_0x1a015f[_0xb84a('0x62')][_0xb84a('0xa4')][0x0][_0xb84a('0x8')],'fax':_[_0xb84a('0xa8')](_0x1a015f[_0xb84a('0x62')]['to'][0x0])?undefined:_0x1a015f[_0xb84a('0x62')]['to'][0x0],'AttachmentId':_0x1a015f['body'][_0xb84a('0xa4')][0x0]['id']},client9002)[_0xb84a('0x20')](function(_0x23b727){logger['info']('SendFaxRpc,\x20%s',_0x23b727);})['catch'](function(_0x2abeb1){logger[_0xb84a('0x21')](_0xb84a('0xb6'),_0x2abeb1);});return _0x498c2f;})[_0xb84a('0x20')](respondWithResult(_0x42a323,null))[_0xb84a('0x2b')](handleError(_0x42a323,null));};exports[_0xb84a('0xb7')]=function(_0x2418f3,_0x24a5e4,_0x169766){return db[_0xb84a('0x53')][_0xb84a('0x5e')]({'where':{'id':_0x2418f3['params']['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x24a5e4,null))['then'](function(_0x59cdc5){if(_0x59cdc5){return _0x59cdc5[_0xb84a('0xb7')](_0x2418f3['body'][_0xb84a('0x69')],_['omit'](_0x2418f3[_0xb84a('0x62')],[_0xb84a('0x69'),'id'])||{})[_0xb84a('0xb2')](function(_0x4d5e73){for(var _0x614af5=0x0;_0x614af5<_0x2418f3[_0xb84a('0x62')][_0xb84a('0x69')][_0xb84a('0x47')];_0x614af5+=0x1){socket[_0xb84a('0xb8')]('userFaxAccount:save',{'UserId':_0x2418f3[_0xb84a('0x62')][_0xb84a('0x69')][_0x614af5],'FaxAccountId':_0x2418f3[_0xb84a('0x57')]['id']});}return _0x4d5e73;});}})[_0xb84a('0x20')](respondWithResult(_0x24a5e4,null))[_0xb84a('0x2b')](handleError(_0x24a5e4,null));};exports['removeAgents']=function(_0x194cd1,_0x2e89ed,_0x4eeee1){return db['FaxAccount'][_0xb84a('0x5e')]({'where':{'id':_0x194cd1['params']['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x2e89ed,null))[_0xb84a('0x20')](function(_0x2eeaaa){if(_0x2eeaaa){return _0x2eeaaa[_0xb84a('0xb9')](_0x194cd1[_0xb84a('0x42')]['ids'])[_0xb84a('0x20')](function(){if(_['isArray'](_0x194cd1[_0xb84a('0x42')][_0xb84a('0x69')])){for(var _0x51f70a=0x0;_0x51f70a<_0x194cd1[_0xb84a('0x42')][_0xb84a('0x69')][_0xb84a('0x47')];_0x51f70a+=0x1){socket[_0xb84a('0xb8')](_0xb84a('0xba'),{'UserId':Number(_0x194cd1['query'][_0xb84a('0x69')][_0x51f70a]),'FaxAccountId':Number(_0x194cd1[_0xb84a('0x57')]['id'])});}}else{socket['emit'](_0xb84a('0xba'),{'UserId':Number(_0x194cd1[_0xb84a('0x42')][_0xb84a('0x69')]),'FaxAccountId':Number(_0x194cd1[_0xb84a('0x57')]['id'])});}});}})[_0xb84a('0x20')](respondWithStatusCode(_0x2e89ed,null))[_0xb84a('0x2b')](handleError(_0x2e89ed,null));};exports[_0xb84a('0xbb')]=function(_0xb2572,_0x58f7a9,_0x51a820){var _0x5c9a5b={};var _0x147206={};var _0x31c5ea;var _0xede9ad;return db[_0xb84a('0x53')][_0xb84a('0x65')]({'where':{'id':_0xb2572[_0xb84a('0x57')]['id']}})[_0xb84a('0x20')](handleEntityNotFound(_0x58f7a9,null))[_0xb84a('0x20')](function(_0x42e633){if(_0x42e633){_0x31c5ea=_0x42e633;_0x147206[_0xb84a('0x44')]=_[_0xb84a('0x58')](db[_0xb84a('0x72')][_0xb84a('0x59')]);_0x147206[_0xb84a('0x42')]=_[_0xb84a('0x58')](_0xb2572[_0xb84a('0x42')]);_0x147206[_0xb84a('0x4d')]=_['intersection'](_0x147206['model'],_0x147206[_0xb84a('0x42')]);_0x5c9a5b['attributes']=_['intersection'](_0x147206[_0xb84a('0x44')],qs[_0xb84a('0x46')](_0xb2572[_0xb84a('0x42')][_0xb84a('0x46')]));_0x5c9a5b[_0xb84a('0x45')]=_0x5c9a5b[_0xb84a('0x45')][_0xb84a('0x47')]?_0x5c9a5b['attributes']:_0x147206[_0xb84a('0x44')];_0x5c9a5b[_0xb84a('0x4b')]=qs['sort'](_0xb2572[_0xb84a('0x42')][_0xb84a('0x4c')]);_0x5c9a5b[_0xb84a('0x52')]=qs[_0xb84a('0x4d')](_[_0xb84a('0x4e')](_0xb2572['query'],_0x147206[_0xb84a('0x4d')]));if(_0xb2572[_0xb84a('0x42')]['filter']){_0x5c9a5b[_0xb84a('0x52')]=_['merge'](_0x5c9a5b[_0xb84a('0x52')],{'$or':_[_0xb84a('0x41')](_0x5c9a5b['attributes'],function(_0x50c77b){var _0x332a81={};_0x332a81[_0x50c77b]={'$like':'%'+_0xb2572[_0xb84a('0x42')][_0xb84a('0x4f')]+'%'};return _0x332a81;})});}_0x5c9a5b=_[_0xb84a('0x50')]({},_0x5c9a5b,_0xb2572['options']);return _0x31c5ea[_0xb84a('0xbb')](_0x5c9a5b);}})['then'](function(_0xc9c603){if(_0xc9c603){_0xede9ad=_0xc9c603[_0xb84a('0x47')];if(!_0xb2572[_0xb84a('0x42')][_0xb84a('0x48')]('nolimit')){_0x5c9a5b[_0xb84a('0x4a')]=qs[_0xb84a('0x4a')](_0xb2572[_0xb84a('0x42')][_0xb84a('0x4a')]);_0x5c9a5b['offset']=qs[_0xb84a('0x2f')](_0xb2572[_0xb84a('0x42')][_0xb84a('0x2f')]);}return _0x31c5ea[_0xb84a('0xbb')](_0x5c9a5b);}})[_0xb84a('0x20')](function(_0x378321){if(_0x378321){return _0x378321?{'count':_0xede9ad,'rows':_0x378321}:null;}})[_0xb84a('0x20')](respondWithResult(_0x58f7a9,null))[_0xb84a('0x2b')](handleError(_0x58f7a9,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4a132b7..87f4fb8 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 _0x1886=['remove','emit','hasOwnProperty','events','FaxAccount','setMaxListeners'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x1886,0x87));var _0x6188=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1886[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x6188('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x6188('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6188('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6188('0x3')};function emitEvent(_0x3602c8){return function(_0x2984d9,_0xe208a8,_0x59fd20){FaxAccountEvents[_0x6188('0x4')](_0x3602c8+':'+_0x2984d9['id'],_0x2984d9);FaxAccountEvents[_0x6188('0x4')](_0x3602c8,_0x2984d9);_0x59fd20(null);};}for(var e in events){if(events[_0x6188('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xd4e8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xd4e8,0xf2));var _0x8d4e=function(_0x766080,_0x32d34a){_0x766080=_0x766080-0x0;var _0x27f3b5=_0xd4e8[_0x766080];return _0x27f3b5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x8d4e('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8d4e('0x1')](0x0);var events={'afterCreate':_0x8d4e('0x2'),'afterUpdate':_0x8d4e('0x3'),'afterDestroy':_0x8d4e('0x4')};function emitEvent(_0x422c04){return function(_0x3cab43,_0x211b87,_0x55f24c){FaxAccountEvents[_0x8d4e('0x5')](_0x422c04+':'+_0x3cab43['id'],_0x3cab43);FaxAccountEvents['emit'](_0x422c04,_0x3cab43);_0x55f24c(null);};}for(var e in events){if(events[_0x8d4e('0x6')](e)){var event=events[e];FaxAccount[_0x8d4e('0x7')](e,emitEvent(event));}}module[_0x8d4e('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 1f3da9a..c714d94 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 _0x87cc=['fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x152998,_0x673cc5){var _0x348f90=function(_0x2c1054){while(--_0x2c1054){_0x152998['push'](_0x152998['shift']());}};_0x348f90(++_0x673cc5);}(_0x87cc,0x187));var _0xc87c=function(_0x100bdc,_0x37ae59){_0x100bdc=_0x100bdc-0x0;var _0x5040c3=_0x87cc[_0x100bdc];return _0x5040c3;};'use strict';var _=require('lodash');var util=require(_0xc87c('0x0'));var logger=require(_0xc87c('0x1'))(_0xc87c('0x2'));var moment=require(_0xc87c('0x3'));var BPromise=require(_0xc87c('0x4'));var rp=require(_0xc87c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc87c('0x6'));var config=require(_0xc87c('0x7'));var attributes=require(_0xc87c('0x8'));module[_0xc87c('0x9')]=function(_0x46c67d,_0x15231c){return _0x46c67d[_0xc87c('0xa')](_0xc87c('0xb'),attributes,{'tableName':_0xc87c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e2=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x20e2,0x18d));var _0x220e=function(_0x19fd89,_0x584151){_0x19fd89=_0x19fd89-0x0;var _0x217b0d=_0x20e2[_0x19fd89];return _0x217b0d;};'use strict';var _=require(_0x220e('0x0'));var util=require(_0x220e('0x1'));var logger=require(_0x220e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x220e('0x3'));var rp=require(_0x220e('0x4'));var fs=require('fs');var path=require(_0x220e('0x5'));var rimraf=require(_0x220e('0x6'));var config=require(_0x220e('0x7'));var attributes=require(_0x220e('0x8'));module[_0x220e('0x9')]=function(_0x58c025,_0xa4f4e0){return _0x58c025[_0x220e('0xa')](_0x220e('0xb'),attributes,{'tableName':_0x220e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 1f57168..e91d364 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 _0x58a4=['attributes','map','info','debug','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','find','Contacts','DESC','FaxApplication','Applications','account','applications','orderBy','priority','asc','List','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','limit','include','model'];(function(_0x730d69,_0x1d1594){var _0x2f6a8a=function(_0xddc5a8){while(--_0xddc5a8){_0x730d69['push'](_0x730d69['shift']());}};_0x2f6a8a(++_0x1d1594);}(_0x58a4,0x196));var _0x458a=function(_0x366e51,_0x3a0178){_0x366e51=_0x366e51-0x0;var _0x4e23e3=_0x58a4[_0x366e51];return _0x4e23e3;};'use strict';var _=require('lodash');var util=require(_0x458a('0x0'));var moment=require(_0x458a('0x1'));var BPromise=require(_0x458a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x458a('0x3'));var db=require(_0x458a('0x4'))['db'];var utils=require(_0x458a('0x5'));var logger=require(_0x458a('0x6'))('rpc');var config=require(_0x458a('0x7'));var jayson=require(_0x458a('0x8'));var client=jayson[_0x458a('0x9')][_0x458a('0xa')]({'port':0x232c});config['redis']=_[_0x458a('0xb')](config[_0x458a('0xc')],{'host':_0x458a('0xd'),'port':0x18eb});var socket=require(_0x458a('0xe'))(new Redis(config[_0x458a('0xc')]));require(_0x458a('0xf'))[_0x458a('0x10')](socket);function respondWithRpcPromise(_0xe67bae,_0x232339,_0x3d1feb){return new BPromise(function(_0x6fe940,_0x49a7e6){return client['request'](_0xe67bae,_0x3d1feb)[_0x458a('0x11')](function(_0x4b2da3){logger['info'](_0x458a('0x12'),_0x232339,_0x458a('0x13'));logger['debug'](_0x458a('0x14'),_0x232339,_0x458a('0x13'),JSON['stringify'](_0x4b2da3));if(_0x4b2da3[_0x458a('0x15')]){if(_0x4b2da3[_0x458a('0x15')][_0x458a('0x16')]===0x1f4){logger[_0x458a('0x15')](_0x458a('0x12'),_0x232339,_0x4b2da3[_0x458a('0x15')]['message']);return _0x49a7e6(_0x4b2da3[_0x458a('0x15')]['message']);}logger[_0x458a('0x15')](_0x458a('0x12'),_0x232339,_0x4b2da3['error'][_0x458a('0x17')]);return _0x6fe940(_0x4b2da3[_0x458a('0x15')][_0x458a('0x17')]);}else{logger['info'](_0x458a('0x12'),_0x232339,_0x458a('0x13'));_0x6fe940(_0x4b2da3[_0x458a('0x18')][_0x458a('0x17')]);}})[_0x458a('0x19')](function(_0x8ffdee){logger['error'](_0x458a('0x12'),_0x232339,_0x8ffdee);_0x49a7e6(_0x8ffdee);});});}exports[_0x458a('0x1a')]=function(_0x508195){var _0xd1818b=this;return new Promise(function(_0x2502f7,_0x4679fa){return db[_0x458a('0x1b')][_0x458a('0x1c')]({'raw':_0x508195['options']?_0x508195[_0x458a('0x1d')][_0x458a('0x1e')]===undefined?!![]:![]:!![],'where':_0x508195[_0x458a('0x1d')]?_0x508195[_0x458a('0x1d')]['where']||null:null,'attributes':_0x508195[_0x458a('0x1d')]?_0x508195[_0x458a('0x1d')]['attributes']||null:null,'limit':_0x508195[_0x458a('0x1d')]?_0x508195[_0x458a('0x1d')][_0x458a('0x1f')]||null:null,'include':_0x508195[_0x458a('0x1d')]?_0x508195['options']['include']?_['map'](_0x508195[_0x458a('0x1d')][_0x458a('0x20')],function(_0x37a8fc){return{'model':db[_0x37a8fc[_0x458a('0x21')]],'as':_0x37a8fc['as'],'attributes':_0x37a8fc[_0x458a('0x22')],'include':_0x37a8fc['include']?_[_0x458a('0x23')](_0x37a8fc[_0x458a('0x20')],function(_0x179db6){return{'model':db[_0x179db6[_0x458a('0x21')]],'as':_0x179db6['as'],'attributes':_0x179db6['attributes'],'include':_0x179db6[_0x458a('0x20')]?_[_0x458a('0x23')](_0x179db6[_0x458a('0x20')],function(_0x25a3ad){return{'model':db[_0x25a3ad[_0x458a('0x21')]],'as':_0x25a3ad['as'],'attributes':_0x25a3ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x458a('0x11')](function(_0xab831d){logger[_0x458a('0x24')](_0x458a('0x1a'),_0x508195);logger[_0x458a('0x25')](_0x458a('0x1a'),_0x508195,JSON[_0x458a('0x26')](_0xab831d));_0x2502f7(_0xab831d);})[_0x458a('0x19')](function(_0x5f642d){logger[_0x458a('0x15')](_0x458a('0x1a'),_0x5f642d[_0x458a('0x17')],_0x508195);_0x4679fa(_0xd1818b[_0x458a('0x15')](0x1f4,_0x5f642d[_0x458a('0x17')]));});});};exports[_0x458a('0x27')]=function(_0x349e56,_0x23aa72,_0x31b8f5){var _0x46ea69=this;return new Promise(function(_0x1b396f,_0xfc7dcf){var _0x9c293b={'body':_0x349e56[_0x458a('0x28')],'channel':_0x458a('0x29')};var _0x2fda49=[];var _0x187f58=[];var _0x33bfcf={};return db[_0x458a('0x2a')][_0x458a('0x2b')]()['then'](function(_0x4d79d4){if(!_0x4d79d4){throw new db[(_0x458a('0x2c'))]['ValidationError'](_0x458a('0x2d'));}_0x2fda49=_[_0x458a('0x2e')](_['keys'](_0x4d79d4),[_0x458a('0x2f'),'updatedAt']);_0x187f58=_[_0x458a('0x2e')](_['keys'](_0x4d79d4),[_0x458a('0x2f'),_0x458a('0x30'),_0x458a('0x31'),_0x458a('0x32')]);if(_0x349e56[_0x458a('0x28')]['id']){delete _0x349e56[_0x458a('0x28')]['id'];}if(_[_0x458a('0x33')](_0x349e56['body'][_0x458a('0x34')])){throw new db[(_0x458a('0x2c'))][(_0x458a('0x35'))]('from\x20is\x20mandatory');}if(_[_0x458a('0x33')](_0x349e56[_0x458a('0x28')][_0x458a('0x28')])||_0x349e56[_0x458a('0x28')][_0x458a('0x28')]===''){throw new db[(_0x458a('0x2c'))][(_0x458a('0x35'))](_0x458a('0x36'));}if(_[_0x458a('0x33')](_0x349e56[_0x458a('0x28')][_0x458a('0x37')])){throw new db[(_0x458a('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x187f58);}if(!_[_0x458a('0x38')](_0x187f58,_0x349e56['body'][_0x458a('0x37')])){throw new db[(_0x458a('0x2c'))][(_0x458a('0x35'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x187f58);}_0x33bfcf[_0x349e56[_0x458a('0x28')][_0x458a('0x37')]]=_0x349e56[_0x458a('0x28')][_0x458a('0x34')];})[_0x458a('0x11')](function(){return db[_0x458a('0x1b')][_0x458a('0x39')]({'where':{'id':_0x349e56['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x458a('0x2a')],'as':_0x458a('0x3a'),'where':_0x33bfcf,'limit':0x1,'order':[[_0x458a('0x30'),_0x458a('0x3b')]]}]},{'model':db[_0x458a('0x3c')],'as':_0x458a('0x3d')}]});})[_0x458a('0x11')](function(_0x28a2b3){if(_0x28a2b3&&_0x28a2b3['List']){var _0x2c069f=_0x28a2b3['get']({'plain':!![]});_0x9c293b[_0x458a('0x3e')]=_0x2c069f;_0x9c293b[_0x458a('0x3f')]=_0x2c069f['Applications'];_0x9c293b['list']=_0x2c069f['List'];_0x9c293b[_0x458a('0x3f')]=_[_0x458a('0x40')](_0x9c293b[_0x458a('0x3f')],[_0x458a('0x41')],[_0x458a('0x42')]);if(_0x9c293b[_0x458a('0x3e')][_0x458a('0x3d')]){delete _0x9c293b[_0x458a('0x3e')][_0x458a('0x3d')];}if(_0x9c293b[_0x458a('0x3e')][_0x458a('0x43')]&&_0x9c293b[_0x458a('0x3e')][_0x458a('0x43')][_0x458a('0x3a')][_0x458a('0x44')]){return _0x9c293b[_0x458a('0x3e')][_0x458a('0x43')][_0x458a('0x3a')][0x0];}var _0x153fd1=_[_0x458a('0xb')](_0x349e56[_0x458a('0x28')],{'firstName':_0x349e56[_0x458a('0x28')]['from'],'ListId':_0x2c069f[_0x458a('0x32')]});_0x153fd1[_0x349e56[_0x458a('0x28')]['mapKey']]=_0x349e56[_0x458a('0x28')][_0x458a('0x34')];return db[_0x458a('0x2a')][_0x458a('0x45')](_0x153fd1,{'fields':_0x2fda49,'raw':!![]});}})[_0x458a('0x11')](function(_0x7b4498){_0x9c293b[_0x458a('0x46')]=_0x7b4498;if(_0x7b4498){var _0x58e229={'ContactId':_0x7b4498['id'],'FaxAccountId':_0x349e56[_0x458a('0x3e')]['id'],'fax':_0x7b4498[_0x458a('0x29')]};return db[_0x458a('0x47')]['find']({'where':{'ContactId':_0x7b4498['id'],'closed':![],'FaxAccountId':_0x349e56[_0x458a('0x3e')]['id']}})[_0x458a('0x11')](function(_0x59b685){if(_0x59b685){return[_0x59b685,![]];}return db[_0x458a('0x47')]['create'](_0x58e229)['then'](function(_0x11e1ae){return[_0x11e1ae,!![]];});});}else{throw new Error(_0x458a('0x48'));}})[_0x458a('0x49')](function(_0x41f9c6,_0xedcfd0){var _0x5bee58=_0x41f9c6[_0x458a('0x4a')]({'plain':!![]});if(_0xedcfd0){if(_0x9c293b[_0x458a('0x3e')][_0x458a('0x4b')]){_0x9c293b[_0x458a('0x3f')][_0x458a('0x4c')]({'id':0x0,'priority':_0x9c293b['applications'][_0x458a('0x44')]+0x1,'app':_0x458a('0x4d'),'appdata':'unmanaged','interval':_0x458a('0x4e')});}_0x5bee58[_0x458a('0x4f')]=!![];}else{_0x5bee58[_0x458a('0x4f')]=![];}_0x9c293b[_0x458a('0x50')]=_0x5bee58;return db[_0x458a('0x51')][_0x458a('0x45')]({'body':_0x349e56['body'][_0x458a('0x28')],'FaxAccountId':_0x349e56[_0x458a('0x3e')]['id'],'FaxInteractionId':_0x41f9c6['id'],'direction':'in','ContactId':_0x41f9c6['ContactId'],'AttachmentId':_0x349e56['body'][_0x458a('0x52')]});})[_0x458a('0x11')](function(_0x1c091c){_0x9c293b[_0x458a('0x17')]=_0x1c091c;if(_0x9c293b[_0x458a('0x50')][_0x458a('0x53')]){return db['User'][_0x458a('0x39')]({'attributes':['id',_0x458a('0x54')],'where':{'id':_0x9c293b['interaction'][_0x458a('0x53')]}})[_0x458a('0x11')](function(_0x416ec4){if(_0x416ec4){_0x9c293b[_0x458a('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x416ec4['name']+','+(_0x9c293b[_0x458a('0x3e')][_0x458a('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x458a('0x56'),_0x458a('0x57'),_0x9c293b);});}return respondWithRpcPromise(_0x458a('0x56'),'startRouting',_0x9c293b);})[_0x458a('0x11')](function(_0x3c2cfb){_0x1b396f(_0x3c2cfb);})[_0x458a('0x19')](function(_0x2ce86b){_0xfc7dcf(_0x46ea69[_0x458a('0x15')](0x1f4,_0x2ce86b[_0x458a('0x17')]));});});}; \ No newline at end of file +var _0xec6a=['priority','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','keys','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','Applications','get','applications','list'];(function(_0x4f0a35,_0x27807d){var _0x520214=function(_0x336e0a){while(--_0x336e0a){_0x4f0a35['push'](_0x4f0a35['shift']());}};_0x520214(++_0x27807d);}(_0xec6a,0x1c6));var _0xaec6=function(_0x3a7379,_0x2fe99b){_0x3a7379=_0x3a7379-0x0;var _0x30791a=_0xec6a[_0x3a7379];return _0x30791a;};'use strict';var _=require(_0xaec6('0x0'));var util=require(_0xaec6('0x1'));var moment=require('moment');var BPromise=require(_0xaec6('0x2'));var rs=require(_0xaec6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaec6('0x4'));var logger=require(_0xaec6('0x5'))(_0xaec6('0x6'));var config=require(_0xaec6('0x7'));var jayson=require(_0xaec6('0x8'));var client=jayson[_0xaec6('0x9')][_0xaec6('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0xaec6('0xb')],{'host':_0xaec6('0xc'),'port':0x18eb});var socket=require(_0xaec6('0xd'))(new Redis(config[_0xaec6('0xb')]));require('./faxAccount.socket')[_0xaec6('0xe')](socket);function respondWithRpcPromise(_0x593565,_0x39f1e3,_0x536fb2){return new BPromise(function(_0x33e722,_0x18d3a0){return client[_0xaec6('0xf')](_0x593565,_0x536fb2)[_0xaec6('0x10')](function(_0x49875c){logger[_0xaec6('0x11')](_0xaec6('0x12'),_0x39f1e3,_0xaec6('0x13'));logger[_0xaec6('0x14')](_0xaec6('0x15'),_0x39f1e3,_0xaec6('0x13'),JSON[_0xaec6('0x16')](_0x49875c));if(_0x49875c[_0xaec6('0x17')]){if(_0x49875c[_0xaec6('0x17')]['code']===0x1f4){logger[_0xaec6('0x17')](_0xaec6('0x12'),_0x39f1e3,_0x49875c[_0xaec6('0x17')][_0xaec6('0x18')]);return _0x18d3a0(_0x49875c[_0xaec6('0x17')]['message']);}logger[_0xaec6('0x17')](_0xaec6('0x12'),_0x39f1e3,_0x49875c[_0xaec6('0x17')][_0xaec6('0x18')]);return _0x33e722(_0x49875c[_0xaec6('0x17')][_0xaec6('0x18')]);}else{logger['info'](_0xaec6('0x12'),_0x39f1e3,_0xaec6('0x13'));_0x33e722(_0x49875c[_0xaec6('0x19')][_0xaec6('0x18')]);}})[_0xaec6('0x1a')](function(_0x482c2d){logger[_0xaec6('0x17')](_0xaec6('0x12'),_0x39f1e3,_0x482c2d);_0x18d3a0(_0x482c2d);});});}exports[_0xaec6('0x1b')]=function(_0x421eaa){var _0x2790c2=this;return new Promise(function(_0xb727d5,_0x3235ef){return db[_0xaec6('0x1c')][_0xaec6('0x1d')]({'raw':_0x421eaa[_0xaec6('0x1e')]?_0x421eaa[_0xaec6('0x1e')][_0xaec6('0x1f')]===undefined?!![]:![]:!![],'where':_0x421eaa[_0xaec6('0x1e')]?_0x421eaa[_0xaec6('0x1e')]['where']||null:null,'attributes':_0x421eaa[_0xaec6('0x1e')]?_0x421eaa[_0xaec6('0x1e')][_0xaec6('0x20')]||null:null,'limit':_0x421eaa['options']?_0x421eaa[_0xaec6('0x1e')][_0xaec6('0x21')]||null:null,'include':_0x421eaa[_0xaec6('0x1e')]?_0x421eaa['options'][_0xaec6('0x22')]?_[_0xaec6('0x23')](_0x421eaa[_0xaec6('0x1e')]['include'],function(_0x2a1d37){return{'model':db[_0x2a1d37[_0xaec6('0x24')]],'as':_0x2a1d37['as'],'attributes':_0x2a1d37[_0xaec6('0x20')],'include':_0x2a1d37[_0xaec6('0x22')]?_[_0xaec6('0x23')](_0x2a1d37[_0xaec6('0x22')],function(_0xceeac6){return{'model':db[_0xceeac6[_0xaec6('0x24')]],'as':_0xceeac6['as'],'attributes':_0xceeac6[_0xaec6('0x20')],'include':_0xceeac6[_0xaec6('0x22')]?_[_0xaec6('0x23')](_0xceeac6['include'],function(_0x50cd58){return{'model':db[_0x50cd58[_0xaec6('0x24')]],'as':_0x50cd58['as'],'attributes':_0x50cd58[_0xaec6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaec6('0x10')](function(_0x33e169){logger[_0xaec6('0x11')](_0xaec6('0x1b'),_0x421eaa);logger[_0xaec6('0x14')](_0xaec6('0x1b'),_0x421eaa,JSON[_0xaec6('0x16')](_0x33e169));_0xb727d5(_0x33e169);})['catch'](function(_0x436e9b){logger[_0xaec6('0x17')](_0xaec6('0x1b'),_0x436e9b[_0xaec6('0x18')],_0x421eaa);_0x3235ef(_0x2790c2['error'](0x1f4,_0x436e9b['message']));});});};exports[_0xaec6('0x25')]=function(_0x55fb84,_0x250edf,_0x5c7eac){var _0x5ea023=this;return new Promise(function(_0x50caa3,_0x3205ac){var _0x103f48={'body':_0x55fb84[_0xaec6('0x26')],'channel':_0xaec6('0x27')};var _0x130709=[];var _0x5e0620=[];var _0x57a14e={};return db[_0xaec6('0x28')][_0xaec6('0x29')]()['then'](function(_0x4c40d0){if(!_0x4c40d0){throw new db[(_0xaec6('0x2a'))][(_0xaec6('0x2b'))](_0xaec6('0x2c'));}_0x130709=_['difference'](_['keys'](_0x4c40d0),[_0xaec6('0x2d'),'updatedAt']);_0x5e0620=_[_0xaec6('0x2e')](_[_0xaec6('0x2f')](_0x4c40d0),[_0xaec6('0x2d'),_0xaec6('0x30'),_0xaec6('0x31'),_0xaec6('0x32')]);if(_0x55fb84[_0xaec6('0x26')]['id']){delete _0x55fb84[_0xaec6('0x26')]['id'];}if(_[_0xaec6('0x33')](_0x55fb84[_0xaec6('0x26')][_0xaec6('0x34')])){throw new db[(_0xaec6('0x2a'))]['ValidationError'](_0xaec6('0x35'));}if(_[_0xaec6('0x33')](_0x55fb84['body'][_0xaec6('0x26')])||_0x55fb84['body'][_0xaec6('0x26')]===''){throw new db[(_0xaec6('0x2a'))]['ValidationError'](_0xaec6('0x36'));}if(_['isNil'](_0x55fb84['body'][_0xaec6('0x37')])){throw new db[(_0xaec6('0x2a'))][(_0xaec6('0x2b'))](_0xaec6('0x38')+_0x5e0620);}if(!_[_0xaec6('0x39')](_0x5e0620,_0x55fb84[_0xaec6('0x26')][_0xaec6('0x37')])){throw new db[(_0xaec6('0x2a'))]['ValidationError'](_0xaec6('0x3a')+_0x5e0620);}_0x57a14e[_0x55fb84[_0xaec6('0x26')]['mapKey']]=_0x55fb84[_0xaec6('0x26')][_0xaec6('0x34')];})['then'](function(){return db[_0xaec6('0x1c')][_0xaec6('0x3b')]({'where':{'id':_0x55fb84[_0xaec6('0x3c')]['id']},'include':[{'model':db[_0xaec6('0x3d')],'as':_0xaec6('0x3e'),'include':[{'model':db[_0xaec6('0x28')],'as':_0xaec6('0x3f'),'where':_0x57a14e,'limit':0x1,'order':[[_0xaec6('0x30'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xaec6('0x40')}]});})[_0xaec6('0x10')](function(_0x1cb162){if(_0x1cb162&&_0x1cb162[_0xaec6('0x3e')]){var _0x4fb009=_0x1cb162[_0xaec6('0x41')]({'plain':!![]});_0x103f48[_0xaec6('0x3c')]=_0x4fb009;_0x103f48[_0xaec6('0x42')]=_0x4fb009['Applications'];_0x103f48[_0xaec6('0x43')]=_0x4fb009['List'];_0x103f48[_0xaec6('0x42')]=_['orderBy'](_0x103f48[_0xaec6('0x42')],[_0xaec6('0x44')],['asc']);if(_0x103f48[_0xaec6('0x3c')][_0xaec6('0x40')]){delete _0x103f48[_0xaec6('0x3c')][_0xaec6('0x40')];}if(_0x103f48[_0xaec6('0x3c')][_0xaec6('0x3e')]&&_0x103f48[_0xaec6('0x3c')][_0xaec6('0x3e')]['Contacts'][_0xaec6('0x45')]){return _0x103f48[_0xaec6('0x3c')][_0xaec6('0x3e')][_0xaec6('0x3f')][0x0];}var _0x47b475=_[_0xaec6('0x46')](_0x55fb84['body'],{'firstName':_0x55fb84[_0xaec6('0x26')][_0xaec6('0x34')],'ListId':_0x4fb009[_0xaec6('0x32')]});_0x47b475[_0x55fb84['body']['mapKey']]=_0x55fb84[_0xaec6('0x26')][_0xaec6('0x34')];return db[_0xaec6('0x28')][_0xaec6('0x47')](_0x47b475,{'fields':_0x130709,'raw':!![]});}})[_0xaec6('0x10')](function(_0x5838cd){_0x103f48[_0xaec6('0x48')]=_0x5838cd;if(_0x5838cd){var _0x26f112={'ContactId':_0x5838cd['id'],'FaxAccountId':_0x55fb84[_0xaec6('0x3c')]['id'],'fax':_0x5838cd[_0xaec6('0x27')]};return db[_0xaec6('0x49')]['find']({'where':{'ContactId':_0x5838cd['id'],'closed':![],'FaxAccountId':_0x55fb84[_0xaec6('0x3c')]['id']}})[_0xaec6('0x10')](function(_0x3c4eaf){if(_0x3c4eaf){return[_0x3c4eaf,![]];}return db[_0xaec6('0x49')]['create'](_0x26f112)['then'](function(_0x505789){return[_0x505789,!![]];});});}else{throw new Error(_0xaec6('0x4a'));}})['spread'](function(_0x34d311,_0x130243){var _0x1f87cc=_0x34d311[_0xaec6('0x41')]({'plain':!![]});if(_0x130243){if(_0x103f48[_0xaec6('0x3c')][_0xaec6('0x4b')]){_0x103f48[_0xaec6('0x42')]['push']({'id':0x0,'priority':_0x103f48[_0xaec6('0x42')][_0xaec6('0x45')]+0x1,'app':_0xaec6('0x4c'),'appdata':_0xaec6('0x4d'),'interval':_0xaec6('0x4e')});}_0x1f87cc['created']=!![];}else{_0x1f87cc['created']=![];}_0x103f48['interaction']=_0x1f87cc;return db['FaxMessage']['create']({'body':_0x55fb84[_0xaec6('0x26')][_0xaec6('0x26')],'FaxAccountId':_0x55fb84[_0xaec6('0x3c')]['id'],'FaxInteractionId':_0x34d311['id'],'direction':'in','ContactId':_0x34d311['ContactId'],'AttachmentId':_0x55fb84[_0xaec6('0x26')][_0xaec6('0x4f')]});})['then'](function(_0x333128){_0x103f48[_0xaec6('0x18')]=_0x333128;if(_0x103f48['interaction'][_0xaec6('0x50')]){return db[_0xaec6('0x51')][_0xaec6('0x3b')]({'attributes':['id',_0xaec6('0x52')],'where':{'id':_0x103f48['interaction'][_0xaec6('0x50')]}})[_0xaec6('0x10')](function(_0x11e3cd){if(_0x11e3cd){_0x103f48['applications'][_0xaec6('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x11e3cd['name']+','+(_0x103f48[_0xaec6('0x3c')][_0xaec6('0x54')]||0xa),'interval':_0xaec6('0x4e')});}return respondWithRpcPromise(_0xaec6('0x55'),_0xaec6('0x56'),_0x103f48);});}return respondWithRpcPromise('Start',_0xaec6('0x56'),_0x103f48);})['then'](function(_0x350845){_0x50caa3(_0x350845);})[_0xaec6('0x1a')](function(_0x3011d0){_0x3205ac(_0x5ea023['error'](0x1f4,_0x3011d0[_0xaec6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c3c3033..4a9e6d3 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 _0xba34=['faxAccount:','./faxAccount.events','save','remove','update','removeListener','register'];(function(_0x43a3ed,_0x17a4d9){var _0x4eaa3b=function(_0x9a542d){while(--_0x9a542d){_0x43a3ed['push'](_0x43a3ed['shift']());}};_0x4eaa3b(++_0x17a4d9);}(_0xba34,0x119));var _0x4ba3=function(_0x2c1d4f,_0x42653a){_0x2c1d4f=_0x2c1d4f-0x0;var _0x369d75=_0xba34[_0x2c1d4f];return _0x369d75;};'use strict';var FaxAccountEvents=require(_0x4ba3('0x0'));var events=[_0x4ba3('0x1'),_0x4ba3('0x2'),_0x4ba3('0x3')];function createListener(_0xeb0ac4,_0x4d6e75){return function(_0x5aa88e){_0x4d6e75['emit'](_0xeb0ac4,_0x5aa88e);};}function removeListener(_0x4592fc,_0x2947f2){return function(){FaxAccountEvents[_0x4ba3('0x4')](_0x4592fc,_0x2947f2);};}exports[_0x4ba3('0x5')]=function(_0x3590a1){for(var _0xb88621=0x0,_0xe5f99a=events['length'];_0xb88621<_0xe5f99a;_0xb88621++){var _0x6254fb=events[_0xb88621];var _0x368eee=createListener(_0x4ba3('0x6')+_0x6254fb,_0x3590a1);FaxAccountEvents['on'](_0x6254fb,_0x368eee);}}; \ No newline at end of file +var _0xa46e=['./faxAccount.events','save','update','emit','register','faxAccount:'];(function(_0x343997,_0x55396e){var _0xf4918c=function(_0x2385f1){while(--_0x2385f1){_0x343997['push'](_0x343997['shift']());}};_0xf4918c(++_0x55396e);}(_0xa46e,0x8a));var _0xea46=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xa46e[_0x4429e0];return _0x51a5b3;};'use strict';var FaxAccountEvents=require(_0xea46('0x0'));var events=[_0xea46('0x1'),'remove',_0xea46('0x2')];function createListener(_0x2f69cc,_0x12deba){return function(_0x4cc9a2){_0x12deba[_0xea46('0x3')](_0x2f69cc,_0x4cc9a2);};}function removeListener(_0x4b6e4a,_0x3a2209){return function(){FaxAccountEvents['removeListener'](_0x4b6e4a,_0x3a2209);};}exports[_0xea46('0x4')]=function(_0x528404){for(var _0x10bee5=0x0,_0x3dc26f=events['length'];_0x10bee5<_0x3dc26f;_0x10bee5++){var _0x2d1b30=events[_0x10bee5];var _0x42771a=createListener(_0xea46('0x5')+_0x2d1b30,_0x528404);FaxAccountEvents['on'](_0x2d1b30,_0x42771a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 38fed1c..5b61379 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 _0x4e9f=['addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction'];(function(_0x5cc140,_0x27c42a){var _0x54df93=function(_0x55fb50){while(--_0x55fb50){_0x5cc140['push'](_0x5cc140['shift']());}};_0x54df93(++_0x27c42a);}(_0x4e9f,0x122));var _0xf4e9=function(_0x2ce03a,_0x53a2ee){_0x2ce03a=_0x2ce03a-0x0;var _0x836f56=_0x4e9f[_0x2ce03a];return _0x836f56;};'use strict';var multer=require(_0xf4e9('0x0'));var util=require(_0xf4e9('0x1'));var path=require(_0xf4e9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4e9('0x3'));var router=express[_0xf4e9('0x4')]();var auth=require(_0xf4e9('0x5'));var interaction=require(_0xf4e9('0x6'));var config=require(_0xf4e9('0x7'));var controller=require(_0xf4e9('0x8'));router[_0xf4e9('0x9')]('/',auth[_0xf4e9('0xa')](),controller[_0xf4e9('0xb')]);router[_0xf4e9('0x9')](_0xf4e9('0xc'),auth['isAuthenticated'](),controller[_0xf4e9('0xd')]);router[_0xf4e9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf4e9('0xe')]);router[_0xf4e9('0x9')](_0xf4e9('0xf'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x10')]);router[_0xf4e9('0x9')](_0xf4e9('0x11'),auth['isAuthenticated'](),controller[_0xf4e9('0x12')]);router[_0xf4e9('0x9')](_0xf4e9('0x13'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x14')]);router[_0xf4e9('0x9')](_0xf4e9('0x15'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x16')]);router[_0xf4e9('0x9')](_0xf4e9('0x17'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x18')]);router[_0xf4e9('0x9')](_0xf4e9('0x19'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x1a')]);router['post']('/',auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x1b')]);router[_0xf4e9('0x1c')](_0xf4e9('0xf'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x1d')]);router[_0xf4e9('0x1c')]('/:id/canned_answers',auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x1e')]);router[_0xf4e9('0x1c')](_0xf4e9('0x13'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x1f')]);router[_0xf4e9('0x1c')](_0xf4e9('0x15'),auth['isAuthenticated'](),controller[_0xf4e9('0x20')]);router[_0xf4e9('0x1c')]('/addaccountapplications',auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x21')]);router[_0xf4e9('0x1c')](_0xf4e9('0x22'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x23')]);router[_0xf4e9('0x1c')]('/:id/send',auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x24')]);router['post']('/:id/users',auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x25')]);router[_0xf4e9('0x26')](_0xf4e9('0x27'),auth['isAuthenticated'](),controller[_0xf4e9('0x28')]);router[_0xf4e9('0x29')](_0xf4e9('0x27'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x2a')]);router[_0xf4e9('0x29')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf4e9('0x2b')]);router[_0xf4e9('0x29')](_0xf4e9('0x11'),auth[_0xf4e9('0xa')](),controller[_0xf4e9('0x2c')]);router['delete']('/:id/users',auth[_0xf4e9('0xa')](),controller['removeAgents']);module[_0xf4e9('0x2d')]=router; \ No newline at end of file +var _0xfc8a=['../../components/auth/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router'];(function(_0x1afe69,_0x105028){var _0x19dc82=function(_0x4591e8){while(--_0x4591e8){_0x1afe69['push'](_0x1afe69['shift']());}};_0x19dc82(++_0x105028);}(_0xfc8a,0xd3));var _0xafc8=function(_0x1e3870,_0x373b28){_0x1e3870=_0x1e3870-0x0;var _0x2c46fc=_0xfc8a[_0x1e3870];return _0x2c46fc;};'use strict';var multer=require('multer');var util=require(_0xafc8('0x0'));var path=require(_0xafc8('0x1'));var timeout=require('connect-timeout');var express=require(_0xafc8('0x2'));var router=express[_0xafc8('0x3')]();var auth=require(_0xafc8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xafc8('0x5'));var controller=require(_0xafc8('0x6'));router[_0xafc8('0x7')]('/',auth['isAuthenticated'](),controller[_0xafc8('0x8')]);router[_0xafc8('0x7')](_0xafc8('0x9'),auth[_0xafc8('0xa')](),controller[_0xafc8('0xb')]);router['get'](_0xafc8('0xc'),auth[_0xafc8('0xa')](),controller['show']);router[_0xafc8('0x7')](_0xafc8('0xd'),auth['isAuthenticated'](),controller[_0xafc8('0xe')]);router['get']('/:id/canned_answers',auth[_0xafc8('0xa')](),controller[_0xafc8('0xf')]);router['get'](_0xafc8('0x10'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x11')]);router[_0xafc8('0x7')](_0xafc8('0x12'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x13')]);router[_0xafc8('0x7')](_0xafc8('0x14'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x15')]);router[_0xafc8('0x7')]('/:id/users',auth[_0xafc8('0xa')](),controller[_0xafc8('0x16')]);router[_0xafc8('0x17')]('/',auth['isAuthenticated'](),controller[_0xafc8('0x18')]);router[_0xafc8('0x17')](_0xafc8('0xd'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x19')]);router[_0xafc8('0x17')](_0xafc8('0x1a'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x1b')]);router[_0xafc8('0x17')](_0xafc8('0x10'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x1c')]);router['post'](_0xafc8('0x12'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x1d')]);router[_0xafc8('0x17')](_0xafc8('0x1e'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x1f')]);router[_0xafc8('0x17')](_0xafc8('0x20'),auth[_0xafc8('0xa')](),controller['updateAccountApplications']);router['post'](_0xafc8('0x21'),auth[_0xafc8('0xa')](),controller['send']);router['post']('/:id/users',auth[_0xafc8('0xa')](),controller[_0xafc8('0x22')]);router[_0xafc8('0x23')](_0xafc8('0xc'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x24')]);router['delete'](_0xafc8('0xc'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x25')]);router[_0xafc8('0x26')](_0xafc8('0xd'),auth['isAuthenticated'](),controller[_0xafc8('0x27')]);router[_0xafc8('0x26')](_0xafc8('0x1a'),auth[_0xafc8('0xa')](),controller[_0xafc8('0x28')]);router[_0xafc8('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0xafc8('0x29')]);module[_0xafc8('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b1c27c2..f3a7977 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 _0xb0b3=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x838f23,_0x47611f){_0x838f23=_0x838f23-0x0;var _0x305d20=_0xb0b3[_0x838f23];return _0x305d20;};'use strict';var Sequelize=require(_0x3b0b('0x0'));module[_0x3b0b('0x1')]={'priority':{'type':Sequelize[_0x3b0b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3b0b('0x3')],'allowNull':![],'defaultValue':_0x3b0b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3b0b('0x3')]},'interval':{'type':Sequelize[_0x3b0b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4f3d=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x35db09,_0x53bede){var _0x2e35aa=function(_0xd5935d){while(--_0xd5935d){_0x35db09['push'](_0x35db09['shift']());}};_0x2e35aa(++_0x53bede);}(_0x4f3d,0x171));var _0xd4f3=function(_0x273b4b,_0x276c2c){_0x273b4b=_0x273b4b-0x0;var _0x86dc4b=_0x4f3d[_0x273b4b];return _0x86dc4b;};'use strict';var Sequelize=require(_0xd4f3('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd4f3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd4f3('0x2')],'allowNull':![],'defaultValue':_0xd4f3('0x3')},'appdata':{'type':Sequelize[_0xd4f3('0x4')]()},'description':{'type':Sequelize[_0xd4f3('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd4f3('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 32a9aa4..aba1c09 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 _0xe677=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto'];(function(_0x12da6c,_0x23ee55){var _0x3ef7b3=function(_0xeec4fb){while(--_0xeec4fb){_0x12da6c['push'](_0x12da6c['shift']());}};_0x3ef7b3(++_0x23ee55);}(_0xe677,0x8a));var _0x7e67=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xe677[_0x545b71];return _0x26e587;};'use strict';var pdf=require(_0x7e67('0x0'));var emlformat=require(_0x7e67('0x1'));var rimraf=require(_0x7e67('0x2'));var zipdir=require(_0x7e67('0x3'));var jsonpatch=require(_0x7e67('0x4'));var rp=require(_0x7e67('0x5'));var moment=require(_0x7e67('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7e67('0x7'));var util=require(_0x7e67('0x8'));var path=require(_0x7e67('0x9'));var sox=require('sox');var csv=require(_0x7e67('0xa'));var ejs=require(_0x7e67('0xb'));var fs=require('fs');var _=require(_0x7e67('0xc'));var squel=require('squel');var crypto=require(_0x7e67('0xd'));var jsforce=require(_0x7e67('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7e67('0xa'));var querystring=require(_0x7e67('0xf'));var Papa=require(_0x7e67('0x10'));var Redis=require(_0x7e67('0x11'));var authService=require(_0x7e67('0x12'));var qs=require(_0x7e67('0x13'));var as=require(_0x7e67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e67('0x15'))('api');var utils=require(_0x7e67('0x16'));var config=require(_0x7e67('0x17'));var licenseUtil=require(_0x7e67('0x18'));var db=require(_0x7e67('0x19'))['db'];function respondWithStatusCode(_0xe8b790,_0x1dff6a){_0x1dff6a=_0x1dff6a||0xcc;return function(_0x32ff07){if(_0x32ff07){return _0xe8b790[_0x7e67('0x1a')](_0x1dff6a);}return _0xe8b790['status'](_0x1dff6a)[_0x7e67('0x1b')]();};}function respondWithResult(_0x1bffee,_0x459a2b){_0x459a2b=_0x459a2b||0xc8;return function(_0x2a8a5c){if(_0x2a8a5c){return _0x1bffee[_0x7e67('0x1c')](_0x459a2b)[_0x7e67('0x1d')](_0x2a8a5c);}};}function respondWithFilteredResult(_0x1f3413,_0x162dea){return function(_0x20e41d){if(_0x20e41d){var _0x9e1a07=_0x20e41d[_0x7e67('0x1e')],_0x204209=_0x162dea[_0x7e67('0x1f')],_0x497d2c=_0x162dea[_0x7e67('0x1f')]+_0x162dea[_0x7e67('0x20')],_0xa8ce96;if(_0x497d2c>=_0x9e1a07){_0x497d2c=_0x9e1a07;_0xa8ce96=0xc8;}else{_0xa8ce96=0xce;}_0x1f3413[_0x7e67('0x1c')](_0xa8ce96);return _0x1f3413[_0x7e67('0x21')]('Content-Range',_0x204209+'-'+_0x497d2c+'/'+_0x9e1a07)[_0x7e67('0x1d')](_0x20e41d);}return null;};}function patchUpdates(_0xbbb6ef){return function(_0xee5cc5){try{jsonpatch['apply'](_0xee5cc5,_0xbbb6ef,!![]);}catch(_0xf24336){return BPromise[_0x7e67('0x22')](_0xf24336);}return _0xee5cc5[_0x7e67('0x23')]();};}function saveUpdates(_0x3210ac,_0x1f0c91){return function(_0x577223){if(_0x577223){return _0x577223[_0x7e67('0x24')](_0x3210ac)[_0x7e67('0x25')](function(_0x30d440){return _0x30d440;});}return null;};}function removeEntity(_0x5c54fe,_0x111f19){return function(_0x34319c){if(_0x34319c){return _0x34319c[_0x7e67('0x26')]()['then'](function(){_0x5c54fe[_0x7e67('0x1c')](0xcc)[_0x7e67('0x1b')]();});}};}function handleEntityNotFound(_0x561095,_0x33d8ca){return function(_0x13f39e){if(!_0x13f39e){_0x561095[_0x7e67('0x1a')](0x194);}return _0x13f39e;};}function handleError(_0x5622ec,_0x4bea28){_0x4bea28=_0x4bea28||0x1f4;return function(_0x12535a){logger[_0x7e67('0x27')](_0x12535a[_0x7e67('0x28')]);if(_0x12535a[_0x7e67('0x29')]){delete _0x12535a[_0x7e67('0x29')];}_0x5622ec[_0x7e67('0x1c')](_0x4bea28)[_0x7e67('0x2a')](_0x12535a);};}exports[_0x7e67('0x2b')]=function(_0x4c51c5,_0x44a93c){var _0x26d926={},_0x3214c6={},_0xfd37ef={'count':0x0,'rows':[]};var _0x190357=_[_0x7e67('0x2c')](db[_0x7e67('0x2d')]['rawAttributes'],function(_0x18eff9){return{'name':_0x18eff9[_0x7e67('0x2e')],'type':_0x18eff9['type'][_0x7e67('0x2f')]};});_0x3214c6[_0x7e67('0x30')]=_[_0x7e67('0x2c')](_0x190357,_0x7e67('0x29'));_0x3214c6[_0x7e67('0x31')]=_[_0x7e67('0x32')](_0x4c51c5[_0x7e67('0x31')]);_0x3214c6[_0x7e67('0x33')]=_['intersection'](_0x3214c6[_0x7e67('0x30')],_0x3214c6[_0x7e67('0x31')]);_0x26d926[_0x7e67('0x34')]=_[_0x7e67('0x35')](_0x3214c6[_0x7e67('0x30')],qs[_0x7e67('0x36')](_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x36')]));_0x26d926[_0x7e67('0x34')]=_0x26d926[_0x7e67('0x34')][_0x7e67('0x37')]?_0x26d926[_0x7e67('0x34')]:_0x3214c6[_0x7e67('0x30')];if(!_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x38')]('nolimit')){_0x26d926[_0x7e67('0x20')]=qs[_0x7e67('0x20')](_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x20')]);_0x26d926[_0x7e67('0x1f')]=qs[_0x7e67('0x1f')](_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x1f')]);}_0x26d926[_0x7e67('0x39')]=qs[_0x7e67('0x3a')](_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x3a')]);_0x26d926[_0x7e67('0x3b')]=qs[_0x7e67('0x33')](_[_0x7e67('0x3c')](_0x4c51c5[_0x7e67('0x31')],_0x3214c6[_0x7e67('0x33')]),_0x190357);if(_0x4c51c5['query'][_0x7e67('0x3d')]){_0x26d926[_0x7e67('0x3b')]=_['merge'](_0x26d926['where'],{'$or':_[_0x7e67('0x2c')](_0x190357,function(_0x2115fa){if(_0x2115fa['type']!==_0x7e67('0x3e')){var _0x16c022={};_0x16c022[_0x2115fa[_0x7e67('0x29')]]={'$like':'%'+_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x3d')]+'%'};return _0x16c022;}})});}_0x26d926=_[_0x7e67('0x3f')]({},_0x26d926,_0x4c51c5[_0x7e67('0x40')]);var _0x3a7396={'where':_0x26d926['where']};return db[_0x7e67('0x2d')][_0x7e67('0x1e')](_0x3a7396)[_0x7e67('0x25')](function(_0x4e6144){_0xfd37ef[_0x7e67('0x1e')]=_0x4e6144;if(_0x4c51c5[_0x7e67('0x31')][_0x7e67('0x41')]){_0x26d926[_0x7e67('0x42')]=[{'all':!![]}];}return db[_0x7e67('0x2d')][_0x7e67('0x43')](_0x26d926);})[_0x7e67('0x25')](function(_0x127109){_0xfd37ef[_0x7e67('0x44')]=_0x127109;return _0xfd37ef;})['then'](respondWithFilteredResult(_0x44a93c,_0x26d926))['catch'](handleError(_0x44a93c,null));};exports[_0x7e67('0x45')]=function(_0x4013b7,_0x5b7ad8){var _0x949f15={'raw':!![],'where':{'id':_0x4013b7[_0x7e67('0x46')]['id']}},_0x2d3704={};_0x2d3704[_0x7e67('0x30')]=_[_0x7e67('0x32')](db[_0x7e67('0x2d')][_0x7e67('0x47')]);_0x2d3704['query']=_[_0x7e67('0x32')](_0x4013b7[_0x7e67('0x31')]);_0x2d3704[_0x7e67('0x33')]=_['intersection'](_0x2d3704[_0x7e67('0x30')],_0x2d3704['query']);_0x949f15[_0x7e67('0x34')]=_[_0x7e67('0x35')](_0x2d3704['model'],qs[_0x7e67('0x36')](_0x4013b7[_0x7e67('0x31')]['fields']));_0x949f15['attributes']=_0x949f15[_0x7e67('0x34')]['length']?_0x949f15[_0x7e67('0x34')]:_0x2d3704[_0x7e67('0x30')];if(_0x4013b7[_0x7e67('0x31')]['includeAll']){_0x949f15[_0x7e67('0x42')]=[{'all':!![]}];}_0x949f15=_[_0x7e67('0x3f')]({},_0x949f15,_0x4013b7[_0x7e67('0x40')]);return db[_0x7e67('0x2d')][_0x7e67('0x48')](_0x949f15)[_0x7e67('0x25')](handleEntityNotFound(_0x5b7ad8,null))['then'](respondWithResult(_0x5b7ad8,null))[_0x7e67('0x49')](handleError(_0x5b7ad8,null));};exports[_0x7e67('0x4a')]=function(_0x16a3e5,_0x1156d5){return db[_0x7e67('0x2d')][_0x7e67('0x4a')](_0x16a3e5[_0x7e67('0x4b')],{})[_0x7e67('0x25')](respondWithResult(_0x1156d5,0xc9))['catch'](handleError(_0x1156d5,null));};exports[_0x7e67('0x24')]=function(_0x4fdd33,_0xb80afc){if(_0x4fdd33[_0x7e67('0x4b')]['id']){delete _0x4fdd33[_0x7e67('0x4b')]['id'];}return db[_0x7e67('0x2d')][_0x7e67('0x48')]({'where':{'id':_0x4fdd33[_0x7e67('0x46')]['id']}})['then'](handleEntityNotFound(_0xb80afc,null))['then'](saveUpdates(_0x4fdd33[_0x7e67('0x4b')],null))[_0x7e67('0x25')](respondWithResult(_0xb80afc,null))[_0x7e67('0x49')](handleError(_0xb80afc,null));};exports[_0x7e67('0x26')]=function(_0x278708,_0x139ec6){return db['FaxApplication'][_0x7e67('0x48')]({'where':{'id':_0x278708[_0x7e67('0x46')]['id']}})[_0x7e67('0x25')](handleEntityNotFound(_0x139ec6,null))[_0x7e67('0x25')](removeEntity(_0x139ec6,null))[_0x7e67('0x49')](handleError(_0x139ec6,null));}; \ No newline at end of file +var _0x09ae=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','FaxApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x5da48e,_0x4f4d18){var _0x129057=function(_0x37409b){while(--_0x37409b){_0x5da48e['push'](_0x5da48e['shift']());}};_0x129057(++_0x4f4d18);}(_0x09ae,0x1ab));var _0xe09a=function(_0xb547a5,_0x5ec09c){_0xb547a5=_0xb547a5-0x0;var _0x58f4a4=_0x09ae[_0xb547a5];return _0x58f4a4;};'use strict';var pdf=require(_0xe09a('0x0'));var emlformat=require(_0xe09a('0x1'));var rimraf=require(_0xe09a('0x2'));var zipdir=require(_0xe09a('0x3'));var jsonpatch=require(_0xe09a('0x4'));var rp=require(_0xe09a('0x5'));var moment=require('moment');var BPromise=require(_0xe09a('0x6'));var Mustache=require(_0xe09a('0x7'));var util=require(_0xe09a('0x8'));var path=require(_0xe09a('0x9'));var sox=require(_0xe09a('0xa'));var csv=require(_0xe09a('0xb'));var ejs=require(_0xe09a('0xc'));var fs=require('fs');var _=require(_0xe09a('0xd'));var squel=require(_0xe09a('0xe'));var crypto=require(_0xe09a('0xf'));var jsforce=require(_0xe09a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe09a('0xb'));var querystring=require(_0xe09a('0x11'));var Papa=require('papaparse');var Redis=require(_0xe09a('0x12'));var authService=require(_0xe09a('0x13'));var qs=require(_0xe09a('0x14'));var as=require(_0xe09a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe09a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe09a('0x17'));var licenseUtil=require(_0xe09a('0x18'));var db=require(_0xe09a('0x19'))['db'];function respondWithStatusCode(_0x57ced4,_0x36e385){_0x36e385=_0x36e385||0xcc;return function(_0xd2022d){if(_0xd2022d){return _0x57ced4[_0xe09a('0x1a')](_0x36e385);}return _0x57ced4['status'](_0x36e385)[_0xe09a('0x1b')]();};}function respondWithResult(_0x386aa9,_0x4d735c){_0x4d735c=_0x4d735c||0xc8;return function(_0x1486ea){if(_0x1486ea){return _0x386aa9[_0xe09a('0x1c')](_0x4d735c)[_0xe09a('0x1d')](_0x1486ea);}};}function respondWithFilteredResult(_0x5bc218,_0x9f162a){return function(_0x5bf659){if(_0x5bf659){var _0x4c399d=_0x5bf659[_0xe09a('0x1e')],_0x3feb8d=_0x9f162a[_0xe09a('0x1f')],_0x2771b0=_0x9f162a['offset']+_0x9f162a[_0xe09a('0x20')],_0x170590;if(_0x2771b0>=_0x4c399d){_0x2771b0=_0x4c399d;_0x170590=0xc8;}else{_0x170590=0xce;}_0x5bc218['status'](_0x170590);return _0x5bc218[_0xe09a('0x21')](_0xe09a('0x22'),_0x3feb8d+'-'+_0x2771b0+'/'+_0x4c399d)['json'](_0x5bf659);}return null;};}function patchUpdates(_0x3ca44a){return function(_0x53db9d){try{jsonpatch[_0xe09a('0x23')](_0x53db9d,_0x3ca44a,!![]);}catch(_0x30e7fb){return BPromise[_0xe09a('0x24')](_0x30e7fb);}return _0x53db9d[_0xe09a('0x25')]();};}function saveUpdates(_0x549454,_0x12c4a8){return function(_0x45eea6){if(_0x45eea6){return _0x45eea6[_0xe09a('0x26')](_0x549454)[_0xe09a('0x27')](function(_0x488795){return _0x488795;});}return null;};}function removeEntity(_0x591c34,_0x140b17){return function(_0x3235cb){if(_0x3235cb){return _0x3235cb[_0xe09a('0x28')]()[_0xe09a('0x27')](function(){_0x591c34[_0xe09a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43aa3f,_0xe8af3a){return function(_0x2d8224){if(!_0x2d8224){_0x43aa3f[_0xe09a('0x1a')](0x194);}return _0x2d8224;};}function handleError(_0x4d0af0,_0x113fe6){_0x113fe6=_0x113fe6||0x1f4;return function(_0x25b235){logger['error'](_0x25b235['stack']);if(_0x25b235[_0xe09a('0x29')]){delete _0x25b235['name'];}_0x4d0af0[_0xe09a('0x1c')](_0x113fe6)['send'](_0x25b235);};}exports[_0xe09a('0x2a')]=function(_0x1dd109,_0x3ee3d6){var _0x1cc6d9={},_0xc97eb7={},_0x54b5a3={'count':0x0,'rows':[]};var _0x124b71=_['map'](db[_0xe09a('0x2b')][_0xe09a('0x2c')],function(_0x22cec3){return{'name':_0x22cec3[_0xe09a('0x2d')],'type':_0x22cec3[_0xe09a('0x2e')]['key']};});_0xc97eb7[_0xe09a('0x2f')]=_[_0xe09a('0x30')](_0x124b71,'name');_0xc97eb7[_0xe09a('0x31')]=_[_0xe09a('0x32')](_0x1dd109[_0xe09a('0x31')]);_0xc97eb7[_0xe09a('0x33')]=_['intersection'](_0xc97eb7['model'],_0xc97eb7[_0xe09a('0x31')]);_0x1cc6d9['attributes']=_[_0xe09a('0x34')](_0xc97eb7['model'],qs[_0xe09a('0x35')](_0x1dd109[_0xe09a('0x31')]['fields']));_0x1cc6d9[_0xe09a('0x36')]=_0x1cc6d9[_0xe09a('0x36')][_0xe09a('0x37')]?_0x1cc6d9[_0xe09a('0x36')]:_0xc97eb7['model'];if(!_0x1dd109['query']['hasOwnProperty'](_0xe09a('0x38'))){_0x1cc6d9[_0xe09a('0x20')]=qs['limit'](_0x1dd109['query'][_0xe09a('0x20')]);_0x1cc6d9[_0xe09a('0x1f')]=qs[_0xe09a('0x1f')](_0x1dd109[_0xe09a('0x31')][_0xe09a('0x1f')]);}_0x1cc6d9['order']=qs[_0xe09a('0x39')](_0x1dd109[_0xe09a('0x31')]['sort']);_0x1cc6d9[_0xe09a('0x3a')]=qs[_0xe09a('0x33')](_[_0xe09a('0x3b')](_0x1dd109[_0xe09a('0x31')],_0xc97eb7['filters']),_0x124b71);if(_0x1dd109[_0xe09a('0x31')][_0xe09a('0x3c')]){_0x1cc6d9[_0xe09a('0x3a')]=_[_0xe09a('0x3d')](_0x1cc6d9[_0xe09a('0x3a')],{'$or':_['map'](_0x124b71,function(_0x438818){if(_0x438818[_0xe09a('0x2e')]!==_0xe09a('0x3e')){var _0x1183ca={};_0x1183ca[_0x438818['name']]={'$like':'%'+_0x1dd109[_0xe09a('0x31')][_0xe09a('0x3c')]+'%'};return _0x1183ca;}})});}_0x1cc6d9=_['merge']({},_0x1cc6d9,_0x1dd109[_0xe09a('0x3f')]);var _0x319373={'where':_0x1cc6d9[_0xe09a('0x3a')]};return db[_0xe09a('0x2b')]['count'](_0x319373)[_0xe09a('0x27')](function(_0x45565d){_0x54b5a3[_0xe09a('0x1e')]=_0x45565d;if(_0x1dd109[_0xe09a('0x31')][_0xe09a('0x40')]){_0x1cc6d9[_0xe09a('0x41')]=[{'all':!![]}];}return db[_0xe09a('0x2b')]['findAll'](_0x1cc6d9);})[_0xe09a('0x27')](function(_0x298dc0){_0x54b5a3[_0xe09a('0x42')]=_0x298dc0;return _0x54b5a3;})[_0xe09a('0x27')](respondWithFilteredResult(_0x3ee3d6,_0x1cc6d9))[_0xe09a('0x43')](handleError(_0x3ee3d6,null));};exports['show']=function(_0x543b5e,_0x13ee61){var _0x3e84dd={'raw':!![],'where':{'id':_0x543b5e[_0xe09a('0x44')]['id']}},_0x275a67={};_0x275a67[_0xe09a('0x2f')]=_['keys'](db[_0xe09a('0x2b')][_0xe09a('0x2c')]);_0x275a67['query']=_['keys'](_0x543b5e['query']);_0x275a67[_0xe09a('0x33')]=_[_0xe09a('0x34')](_0x275a67['model'],_0x275a67[_0xe09a('0x31')]);_0x3e84dd['attributes']=_[_0xe09a('0x34')](_0x275a67[_0xe09a('0x2f')],qs['fields'](_0x543b5e['query']['fields']));_0x3e84dd['attributes']=_0x3e84dd[_0xe09a('0x36')]['length']?_0x3e84dd[_0xe09a('0x36')]:_0x275a67['model'];if(_0x543b5e[_0xe09a('0x31')][_0xe09a('0x40')]){_0x3e84dd[_0xe09a('0x41')]=[{'all':!![]}];}_0x3e84dd=_[_0xe09a('0x3d')]({},_0x3e84dd,_0x543b5e[_0xe09a('0x3f')]);return db[_0xe09a('0x2b')][_0xe09a('0x45')](_0x3e84dd)[_0xe09a('0x27')](handleEntityNotFound(_0x13ee61,null))[_0xe09a('0x27')](respondWithResult(_0x13ee61,null))['catch'](handleError(_0x13ee61,null));};exports[_0xe09a('0x46')]=function(_0x1013ca,_0x1a497f){return db[_0xe09a('0x2b')][_0xe09a('0x46')](_0x1013ca['body'],{})[_0xe09a('0x27')](respondWithResult(_0x1a497f,0xc9))[_0xe09a('0x43')](handleError(_0x1a497f,null));};exports['update']=function(_0x4785ff,_0xcae20e){if(_0x4785ff[_0xe09a('0x47')]['id']){delete _0x4785ff[_0xe09a('0x47')]['id'];}return db[_0xe09a('0x2b')][_0xe09a('0x45')]({'where':{'id':_0x4785ff[_0xe09a('0x44')]['id']}})[_0xe09a('0x27')](handleEntityNotFound(_0xcae20e,null))['then'](saveUpdates(_0x4785ff['body'],null))['then'](respondWithResult(_0xcae20e,null))[_0xe09a('0x43')](handleError(_0xcae20e,null));};exports[_0xe09a('0x28')]=function(_0x120839,_0x4623bd){return db[_0xe09a('0x2b')][_0xe09a('0x45')]({'where':{'id':_0x120839[_0xe09a('0x44')]['id']}})[_0xe09a('0x27')](handleEntityNotFound(_0x4623bd,null))['then'](removeEntity(_0x4623bd,null))['catch'](handleError(_0x4623bd,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7b9ef22..c34110a 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 _0xb534=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','util','../../config/logger','api'];(function(_0x238caa,_0xc685a1){var _0x5b0829=function(_0x5abf6b){while(--_0x5abf6b){_0x238caa['push'](_0x238caa['shift']());}};_0x5b0829(++_0xc685a1);}(_0xb534,0x1dd));var _0x4b53=function(_0x2a0c0b,_0x2c88f4){_0x2a0c0b=_0x2a0c0b-0x0;var _0x48c083=_0xb534[_0x2a0c0b];return _0x48c083;};'use strict';var _=require('lodash');var util=require(_0x4b53('0x0'));var logger=require(_0x4b53('0x1'))(_0x4b53('0x2'));var moment=require(_0x4b53('0x3'));var BPromise=require(_0x4b53('0x4'));var rp=require(_0x4b53('0x5'));var fs=require('fs');var path=require(_0x4b53('0x6'));var rimraf=require(_0x4b53('0x7'));var config=require(_0x4b53('0x8'));var attributes=require(_0x4b53('0x9'));module[_0x4b53('0xa')]=function(_0x5bf0d7,_0x4112c0){return _0x5bf0d7[_0x4b53('0xb')](_0x4b53('0xc'),attributes,{'tableName':_0x4b53('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b53('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9c23=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x1e5024,_0x26cd44){var _0x3f482e=function(_0x15d954){while(--_0x15d954){_0x1e5024['push'](_0x1e5024['shift']());}};_0x3f482e(++_0x26cd44);}(_0x9c23,0x10c));var _0x39c2=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0x9c23[_0x143cfd];return _0x2cb5f5;};'use strict';var _=require(_0x39c2('0x0'));var util=require(_0x39c2('0x1'));var logger=require(_0x39c2('0x2'))(_0x39c2('0x3'));var moment=require(_0x39c2('0x4'));var BPromise=require(_0x39c2('0x5'));var rp=require(_0x39c2('0x6'));var fs=require('fs');var path=require(_0x39c2('0x7'));var rimraf=require(_0x39c2('0x8'));var config=require(_0x39c2('0x9'));var attributes=require(_0x39c2('0xa'));module[_0x39c2('0xb')]=function(_0x1abb5e,_0x42a3f9){return _0x1abb5e['define'](_0x39c2('0xc'),attributes,{'tableName':_0x39c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x39c2('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7782907..d0449f2 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 _0x8e7a=['stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','attributes','limit','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x39ff17,_0x376aa8){var _0x37461d=function(_0x493548){while(--_0x493548){_0x39ff17['push'](_0x39ff17['shift']());}};_0x37461d(++_0x376aa8);}(_0x8e7a,0x1ac));var _0xa8e7=function(_0x5444dd,_0x3abb82){_0x5444dd=_0x5444dd-0x0;var _0x236366=_0x8e7a[_0x5444dd];return _0x236366;};'use strict';var _=require(_0xa8e7('0x0'));var util=require('util');var moment=require(_0xa8e7('0x1'));var BPromise=require('bluebird');var rs=require(_0xa8e7('0x2'));var fs=require('fs');var Redis=require(_0xa8e7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8e7('0x4'));var logger=require(_0xa8e7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa8e7('0x6'));var client=jayson[_0xa8e7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e19b8,_0x55b335,_0x4ddb5e){return new BPromise(function(_0x2a81e4,_0x4567b7){return client[_0xa8e7('0x8')](_0x5e19b8,_0x4ddb5e)[_0xa8e7('0x9')](function(_0xa22935){logger[_0xa8e7('0xa')](_0xa8e7('0xb'),_0x55b335,'request\x20sent');logger[_0xa8e7('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x55b335,_0xa8e7('0xd'),JSON[_0xa8e7('0xe')](_0xa22935));if(_0xa22935[_0xa8e7('0xf')]){if(_0xa22935[_0xa8e7('0xf')][_0xa8e7('0x10')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x55b335,_0xa22935['error'][_0xa8e7('0x11')]);return _0x4567b7(_0xa22935[_0xa8e7('0xf')]['message']);}logger['error'](_0xa8e7('0xb'),_0x55b335,_0xa22935[_0xa8e7('0xf')][_0xa8e7('0x11')]);return _0x2a81e4(_0xa22935[_0xa8e7('0xf')][_0xa8e7('0x11')]);}else{logger[_0xa8e7('0xa')](_0xa8e7('0xb'),_0x55b335,_0xa8e7('0xd'));_0x2a81e4(_0xa22935['result'][_0xa8e7('0x11')]);}})[_0xa8e7('0x12')](function(_0x514cd8){logger['error'](_0xa8e7('0xb'),_0x55b335,_0x514cd8);_0x4567b7(_0x514cd8);});});}exports[_0xa8e7('0x13')]=function(_0x58ef38){var _0x10fb2f=this;return new Promise(function(_0x7a32be,_0x5edb11){return db[_0xa8e7('0x14')][_0xa8e7('0x15')](_0x58ef38[_0xa8e7('0x16')],{'raw':_0x58ef38['options']?_0x58ef38[_0xa8e7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ef38[_0xa8e7('0x17')]?_0x58ef38[_0xa8e7('0x17')]['where']||null:null,'attributes':_0x58ef38[_0xa8e7('0x17')]?_0x58ef38[_0xa8e7('0x17')][_0xa8e7('0x18')]||null:null,'limit':_0x58ef38[_0xa8e7('0x17')]?_0x58ef38['options'][_0xa8e7('0x19')]||null:null})[_0xa8e7('0x9')](function(_0x53f9fe){logger[_0xa8e7('0xa')](_0xa8e7('0x13'),_0x58ef38);logger[_0xa8e7('0xc')]('UpdateFaxApplication',_0x58ef38,JSON[_0xa8e7('0xe')](_0x53f9fe));_0x7a32be(_0x53f9fe);})[_0xa8e7('0x12')](function(_0x19dfae){logger[_0xa8e7('0xf')](_0xa8e7('0x13'),_0x19dfae[_0xa8e7('0x11')],_0x58ef38);_0x5edb11(_0x10fb2f[_0xa8e7('0xf')](0x1f4,_0x19dfae[_0xa8e7('0x11')]));});});}; \ No newline at end of file +var _0xeb5d=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2945a1,_0x159944){var _0x40ed93=function(_0x402895){while(--_0x402895){_0x2945a1['push'](_0x2945a1['shift']());}};_0x40ed93(++_0x159944);}(_0xeb5d,0xb8));var _0xdeb5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeb5d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var moment=require(_0xdeb5('0x1'));var BPromise=require(_0xdeb5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeb5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdeb5('0x4'));var config=require(_0xdeb5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdeb5('0x6')][_0xdeb5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d36cf,_0x30a821,_0x5e19de){return new BPromise(function(_0x2c23ef,_0x4f66a8){return client['request'](_0x1d36cf,_0x5e19de)[_0xdeb5('0x8')](function(_0x15538a){logger[_0xdeb5('0x9')](_0xdeb5('0xa'),_0x30a821,_0xdeb5('0xb'));logger[_0xdeb5('0xc')](_0xdeb5('0xd'),_0x30a821,_0xdeb5('0xb'),JSON[_0xdeb5('0xe')](_0x15538a));if(_0x15538a[_0xdeb5('0xf')]){if(_0x15538a[_0xdeb5('0xf')][_0xdeb5('0x10')]===0x1f4){logger[_0xdeb5('0xf')](_0xdeb5('0xa'),_0x30a821,_0x15538a[_0xdeb5('0xf')][_0xdeb5('0x11')]);return _0x4f66a8(_0x15538a[_0xdeb5('0xf')][_0xdeb5('0x11')]);}logger['error'](_0xdeb5('0xa'),_0x30a821,_0x15538a[_0xdeb5('0xf')]['message']);return _0x2c23ef(_0x15538a[_0xdeb5('0xf')][_0xdeb5('0x11')]);}else{logger[_0xdeb5('0x9')](_0xdeb5('0xa'),_0x30a821,_0xdeb5('0xb'));_0x2c23ef(_0x15538a[_0xdeb5('0x12')]['message']);}})[_0xdeb5('0x13')](function(_0x142792){logger[_0xdeb5('0xf')](_0xdeb5('0xa'),_0x30a821,_0x142792);_0x4f66a8(_0x142792);});});}exports[_0xdeb5('0x14')]=function(_0x449f4e){var _0x3bd461=this;return new Promise(function(_0x2631c2,_0x2674dd){return db['FaxApplication'][_0xdeb5('0x15')](_0x449f4e[_0xdeb5('0x16')],{'raw':_0x449f4e[_0xdeb5('0x17')]?_0x449f4e[_0xdeb5('0x17')][_0xdeb5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x449f4e['options']?_0x449f4e[_0xdeb5('0x17')][_0xdeb5('0x19')]||null:null,'attributes':_0x449f4e[_0xdeb5('0x17')]?_0x449f4e[_0xdeb5('0x17')][_0xdeb5('0x1a')]||null:null,'limit':_0x449f4e['options']?_0x449f4e[_0xdeb5('0x17')][_0xdeb5('0x1b')]||null:null})[_0xdeb5('0x8')](function(_0x3fcbfd){logger[_0xdeb5('0x9')](_0xdeb5('0x14'),_0x449f4e);logger[_0xdeb5('0xc')](_0xdeb5('0x14'),_0x449f4e,JSON[_0xdeb5('0xe')](_0x3fcbfd));_0x2631c2(_0x3fcbfd);})[_0xdeb5('0x13')](function(_0x3e77e1){logger['error'](_0xdeb5('0x14'),_0x3e77e1['message'],_0x449f4e);_0x2674dd(_0x3bd461['error'](0x1f4,_0x3e77e1[_0xdeb5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 48eddb6..d03061c 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 _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x318ea4,_0x135e23){var _0x171988=function(_0x3d9180){while(--_0x3d9180){_0x318ea4['push'](_0x318ea4['shift']());}};_0x171988(++_0x135e23);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xeb6ab2,_0x51f1c3){_0xeb6ab2=_0xeb6ab2-0x0;var _0x2dcdaf=_0xdbf5[_0xeb6ab2];return _0x2dcdaf;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=router; \ No newline at end of file +var _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x326f,0xd1));var _0xf326=function(_0x6f2cfb,_0x38e232){_0x6f2cfb=_0x6f2cfb-0x0;var _0x498c28=_0x326f[_0x6f2cfb];return _0x498c28;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5007a30..a579f39 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 _0xab86=['ENUM','out','DATE','sequelize','exports','BOOLEAN','STRING'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0xab86,0x13e));var _0x6ab8=function(_0x4bc718,_0x422ed4){_0x4bc718=_0x4bc718-0x0;var _0x452c7f=_0xab86[_0x4bc718];return _0x452c7f;};'use strict';var Sequelize=require(_0x6ab8('0x0'));module[_0x6ab8('0x1')]={'closed':{'type':Sequelize[_0x6ab8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6ab8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6ab8('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x6ab8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6ab8('0x4')]('in',_0x6ab8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6ab8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x6ab8('0x4')]('in',_0x6ab8('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa3e6=['STRING','DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x4218f2,_0x434bd0){var _0x311acd=function(_0x2278e6){while(--_0x2278e6){_0x4218f2['push'](_0x4218f2['shift']());}};_0x311acd(++_0x434bd0);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x122ede,_0x13d621){_0x122ede=_0x122ede-0x0;var _0x42f25e=_0xa3e6[_0x122ede];return _0x42f25e;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6a3e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6a3e('0x2')]},'secondDisposition':{'type':Sequelize[_0x6a3e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6a3e('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6a3e('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x6a3e('0x4')]('in',_0x6a3e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6a3e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6a3e('0x4')]('in',_0x6a3e('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f16b653..a516f44 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 _0xbb8c=['../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','send','Users','map','fullname','Tags','TagIds','split','forEach','push','index','FaxInteraction','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','params','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','removeTags','unix','join','root','server','files','Attachment','Messages','get','basename','createReadStream','pipe','createWriteStream','resolve','download','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0xce3461,_0x5cb765){var _0x59f52d=function(_0x287d16){while(--_0x287d16){_0xce3461['push'](_0xce3461['shift']());}};_0x59f52d(++_0x5cb765);}(_0xbb8c,0xc5));var _0xcbb8=function(_0xab70b6,_0x48df75){_0xab70b6=_0xab70b6-0x0;var _0xbd31de=_0xbb8c[_0xab70b6];return _0xbd31de;};'use strict';var pdf=require(_0xcbb8('0x0'));var emlformat=require(_0xcbb8('0x1'));var rimraf=require(_0xcbb8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcbb8('0x3'));var moment=require(_0xcbb8('0x4'));var BPromise=require(_0xcbb8('0x5'));var Mustache=require(_0xcbb8('0x6'));var util=require(_0xcbb8('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcbb8('0x8'));var crypto=require(_0xcbb8('0x9'));var jsforce=require(_0xcbb8('0xa'));var deskjs=require(_0xcbb8('0xb'));var toCsv=require(_0xcbb8('0xc'));var querystring=require(_0xcbb8('0xd'));var Papa=require('papaparse');var Redis=require(_0xcbb8('0xe'));var authService=require(_0xcbb8('0xf'));var qs=require(_0xcbb8('0x10'));var as=require(_0xcbb8('0x11'));var hardwareService=require(_0xcbb8('0x12'));var logger=require('../../config/logger')(_0xcbb8('0x13'));var utils=require(_0xcbb8('0x14'));var config=require(_0xcbb8('0x15'));var licenseUtil=require(_0xcbb8('0x16'));var db=require(_0xcbb8('0x17'))['db'];config['redis']=_[_0xcbb8('0x18')](config[_0xcbb8('0x19')],{'host':_0xcbb8('0x1a'),'port':0x18eb});var socket=require(_0xcbb8('0x1b'))(new Redis(config[_0xcbb8('0x19')]));require(_0xcbb8('0x1c'))[_0xcbb8('0x1d')](socket);function respondWithStatusCode(_0x36676c,_0x616ab7){_0x616ab7=_0x616ab7||0xcc;return function(_0x2710f5){if(_0x2710f5){return _0x36676c[_0xcbb8('0x1e')](_0x616ab7);}return _0x36676c[_0xcbb8('0x1f')](_0x616ab7)[_0xcbb8('0x20')]();};}function respondWithResult(_0x4c8ef3,_0x337753){_0x337753=_0x337753||0xc8;return function(_0x19e385){if(_0x19e385){return _0x4c8ef3[_0xcbb8('0x1f')](_0x337753)[_0xcbb8('0x21')](_0x19e385);}};}function respondWithFilteredResult(_0xe5867c,_0x1d7937){return function(_0x23dcd5){if(_0x23dcd5){var _0x190462=_0x23dcd5[_0xcbb8('0x22')],_0x43e4b7=_0x1d7937[_0xcbb8('0x23')],_0x15a2c1=_0x1d7937[_0xcbb8('0x23')]+_0x1d7937[_0xcbb8('0x24')],_0x5e801a;if(_0x15a2c1>=_0x190462){_0x15a2c1=_0x190462;_0x5e801a=0xc8;}else{_0x5e801a=0xce;}_0xe5867c[_0xcbb8('0x1f')](_0x5e801a);return _0xe5867c[_0xcbb8('0x25')]('Content-Range',_0x43e4b7+'-'+_0x15a2c1+'/'+_0x190462)[_0xcbb8('0x21')](_0x23dcd5);}return null;};}function patchUpdates(_0x584050){return function(_0x12dd9c){try{jsonpatch[_0xcbb8('0x26')](_0x12dd9c,_0x584050,!![]);}catch(_0x1fae0a){return BPromise[_0xcbb8('0x27')](_0x1fae0a);}return _0x12dd9c[_0xcbb8('0x28')]();};}function saveUpdates(_0x1535e6,_0x4964eb){return function(_0x23c01e){if(_0x23c01e){return _0x23c01e[_0xcbb8('0x29')](_0x1535e6)[_0xcbb8('0x2a')](function(_0x243451){return _0x243451;});}return null;};}function removeEntity(_0x245c1d,_0x300f25){return function(_0x24352f){if(_0x24352f){return _0x24352f[_0xcbb8('0x2b')]()[_0xcbb8('0x2a')](function(){_0x245c1d[_0xcbb8('0x1f')](0xcc)[_0xcbb8('0x20')]();});}};}function handleEntityNotFound(_0xdfbbcd,_0x38e42f){return function(_0x540157){if(!_0x540157){_0xdfbbcd[_0xcbb8('0x1e')](0x194);}return _0x540157;};}function handleError(_0x2525ad,_0x5cb828){_0x5cb828=_0x5cb828||0x1f4;return function(_0x4483b4){logger[_0xcbb8('0x2c')](_0x4483b4[_0xcbb8('0x2d')]);if(_0x4483b4['name']){delete _0x4483b4['name'];}_0x2525ad[_0xcbb8('0x1f')](_0x5cb828)[_0xcbb8('0x2e')](_0x4483b4);};}function getInteractionUsers(_0x4388ba,_0x2e0a4c){return new BPromise(function(_0x44e1bb,_0x5b9741){try{if(_0x2e0a4c[_0x4388ba['id']]){_0x4388ba[_0xcbb8('0x2f')]=_[_0xcbb8('0x30')](_0x2e0a4c[_0x4388ba['id']],function(_0xed85b9){return{'id':_0xed85b9['id'],'fullname':_0xed85b9[_0xcbb8('0x31')]};});}}catch(_0x5402b2){_0x5b9741(_0x5402b2);}_0x44e1bb(_0x4388ba);});}function getInteractionTags(_0x142597,_0x33b3a1){return new BPromise(function(_0x33d95d,_0x2fe105){try{if(_0x142597['TagIds']){_0x142597[_0xcbb8('0x32')]=[];_0x142597[_0xcbb8('0x33')][_0xcbb8('0x34')](',')[_0xcbb8('0x35')](function(_0x308be6){_0x142597[_0xcbb8('0x32')][_0xcbb8('0x36')](_0x33b3a1[_0x308be6]);});}delete _0x142597[_0xcbb8('0x33')];}catch(_0x2e21c3){_0x2fe105(_0x2e21c3);}_0x33d95d(_0x142597);});}function updateFaxInteraction(_0x23cfa3,_0xd5cac7,_0x1328a0){return new BPromise(function(_0x26ed88,_0x88250e){return getInteractionUsers(_0x23cfa3,_0x1328a0)[_0xcbb8('0x2a')](function(_0x2d581e){return getInteractionTags(_0x2d581e,_0xd5cac7);})[_0xcbb8('0x2a')](function(_0x4ad510){_0x26ed88(_0x4ad510);})['catch'](function(_0x3f355a){_0x88250e(_0x3f355a);});});}exports[_0xcbb8('0x37')]=function(_0x263bfc,_0xdf962b){var _0x4e66a6={},_0x281a3b={},_0x5595e8={'count':0x0,'rows':[]};var _0x170346=_['map'](db[_0xcbb8('0x38')][_0xcbb8('0x39')],function(_0x197a30){return{'name':_0x197a30[_0xcbb8('0x3a')],'type':_0x197a30[_0xcbb8('0x3b')]['key']};});_0x281a3b[_0xcbb8('0x3c')]=_[_0xcbb8('0x30')](_0x170346,_0xcbb8('0x3d'));_0x281a3b['query']=_[_0xcbb8('0x3e')](_0x263bfc[_0xcbb8('0x3f')]);_0x281a3b[_0xcbb8('0x40')]=_[_0xcbb8('0x41')](_0x281a3b['model'],_0x281a3b['query']);_0x4e66a6[_0xcbb8('0x42')]=_[_0xcbb8('0x41')](_0x281a3b['model'],qs[_0xcbb8('0x43')](_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x43')]));_0x4e66a6[_0xcbb8('0x42')]=_0x4e66a6[_0xcbb8('0x42')][_0xcbb8('0x44')]?_0x4e66a6[_0xcbb8('0x42')]:_0x281a3b[_0xcbb8('0x3c')];if(!_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x45')]('nolimit')){_0x4e66a6[_0xcbb8('0x24')]=qs[_0xcbb8('0x24')](_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x24')]);_0x4e66a6[_0xcbb8('0x23')]=qs[_0xcbb8('0x23')](_0x263bfc[_0xcbb8('0x3f')]['offset']);}_0x4e66a6[_0xcbb8('0x46')]=qs[_0xcbb8('0x47')](_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x47')]);_0x4e66a6[_0xcbb8('0x48')]=qs[_0xcbb8('0x40')](_[_0xcbb8('0x49')](_0x263bfc['query'],_0x281a3b['filters']),_0x170346);var _0x536afa=[];var _0x2c33c2=squel[_0xcbb8('0x4a')]()[_0xcbb8('0x4b')]('id')[_0xcbb8('0x4b')](_0xcbb8('0x3d'))[_0xcbb8('0x4b')](_0xcbb8('0x4c'))['from'](_0xcbb8('0x4d'));var _0x14b34b=squel[_0xcbb8('0x4a')]()[_0xcbb8('0x4b')]('u.id')[_0xcbb8('0x4b')](_0xcbb8('0x4e'))['field'](_0xcbb8('0x4f'))[_0xcbb8('0x50')](_0xcbb8('0x51'),'ui')['left_join'](_0xcbb8('0x52'),'u',_0xcbb8('0x53'));var _0xa0af16=squel['select']()['from']('fax_interactions','i')[_0xcbb8('0x54')](_0xcbb8('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xcbb8('0x54')](_0xcbb8('0x52'),'o',_0xcbb8('0x56'))['left_join'](_0xcbb8('0x57'),'a',_0xcbb8('0x58'))['left_join'](_0xcbb8('0x59'),'me',_0xcbb8('0x5a'))[_0xcbb8('0x54')](_0xcbb8('0x5b'),'it',_0xcbb8('0x5c'))[_0xcbb8('0x54')](_0xcbb8('0x4d'),'t',_0xcbb8('0x5d'));var _0x2cb121=squel[_0xcbb8('0x5e')]();var _0x575cc0=[];var _0x320d76=squel['expr']();var _0x510122;if(_0x263bfc[_0xcbb8('0x3f')]['search']){_0x510122=as[_0xcbb8('0x5f')](_0x263bfc[_0xcbb8('0x3f')]['search']);var _0x1aad12=_0x510122[_0xcbb8('0x60')];for(var _0x9ed2ed=0x0;_0x9ed2ed<_0x510122[_0xcbb8('0x61')][_0xcbb8('0x44')];_0x9ed2ed++){var _0x45ebbb=_0x510122[_0xcbb8('0x61')][_0x9ed2ed];var _0x3baaa1='i';var _0x3f9e1f=_[_0xcbb8('0x62')](_0x170346,['name',_0x45ebbb[_0xcbb8('0x4b')]]);if(!_0x3f9e1f){switch(_0x45ebbb[_0xcbb8('0x4b')]){case'unreadMessages':if(_0x45ebbb[_0xcbb8('0x63')]==0x1){_0xa0af16[_0xcbb8('0x64')]('`'+_0x45ebbb['field']+_0xcbb8('0x65'));}else{_0xa0af16[_0xcbb8('0x64')]('`'+_0x45ebbb[_0xcbb8('0x4b')]+_0xcbb8('0x66'));}break;case _0xcbb8('0x67'):if(_0x45ebbb[_0xcbb8('0x68')]===_0xcbb8('0x69')){if(_0x45ebbb[_0xcbb8('0x63')][_0xcbb8('0x34')]('\x20')[_0xcbb8('0x44')]>0x1){_0x2cb121[_0x1aad12]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcbb8('0x6a')](_0x45ebbb[_0xcbb8('0x63')]),null);}else{var _0x1eb0fb='%'+_0x45ebbb[_0xcbb8('0x63')]+'%';_0x2cb121[_0x1aad12]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1eb0fb,_0x1eb0fb,_0x1eb0fb);}}else{_0x3f9e1f=_[_0xcbb8('0x62')](_0x170346,[_0xcbb8('0x3d'),_0xcbb8('0x6b')]);_0x45ebbb[_0xcbb8('0x4b')]=_0xcbb8('0x6b');_0x5ead83=as['buildExpression'](_0x3baaa1,_0x3f9e1f[_0xcbb8('0x3b')],_0x45ebbb);_0x2cb121[_0x1aad12](_0x5ead83[_0xcbb8('0x6c')],_0x5ead83['value'][_0xcbb8('0x6d')],_0x5ead83[_0xcbb8('0x63')][_0xcbb8('0x20')]);}break;case'Tag':var _0x2a382e=_0x45ebbb['value']['split'](',')[_0xcbb8('0x30')](function(_0x2bc498){return Number(_0x2bc498);});_0x2a382e[_0xcbb8('0x35')](function(_0x3fda45){_0x320d76['or'](_0xcbb8('0x6e'),'%,'+_0x3fda45+',%');});_0x575cc0=_[_0xcbb8('0x6f')](_0x575cc0,_0x2a382e);break;case _0xcbb8('0x70'):if(_0x45ebbb[_0xcbb8('0x68')]===_0xcbb8('0x69')){_0x2cb121[_0x1aad12](_0xcbb8('0x71'),'%'+_0x45ebbb[_0xcbb8('0x63')]+'%',null);}else{_0x3f9e1f=_[_0xcbb8('0x62')](_0x170346,['name','UserId']);_0x45ebbb[_0xcbb8('0x4b')]=_0xcbb8('0x72');_0x5ead83=as[_0xcbb8('0x73')](_0x3baaa1,_0x3f9e1f[_0xcbb8('0x3b')],_0x45ebbb);_0x2cb121[_0x1aad12](_0x5ead83[_0xcbb8('0x6c')],_0x5ead83[_0xcbb8('0x63')][_0xcbb8('0x6d')],_0x5ead83[_0xcbb8('0x63')][_0xcbb8('0x20')]);}break;case _0xcbb8('0x74'):_0x5ead83=as[_0xcbb8('0x73')]('me',null,_0x45ebbb);_0x2cb121[_0x1aad12](_0x5ead83[_0xcbb8('0x6c')],_0x5ead83[_0xcbb8('0x63')][_0xcbb8('0x6d')],_0x5ead83[_0xcbb8('0x63')][_0xcbb8('0x20')]);break;}}else{var _0x5ead83=as[_0xcbb8('0x73')](_0x3baaa1,_0x3f9e1f[_0xcbb8('0x3b')],_0x45ebbb);_0x2cb121[_0x1aad12](_0x5ead83[_0xcbb8('0x6c')],_0x5ead83[_0xcbb8('0x63')][_0xcbb8('0x6d')],_0x5ead83['value'][_0xcbb8('0x20')]);}}}else{var _0x426303=_(_0x263bfc[_0xcbb8('0x3f')])[_0xcbb8('0x3e')]()[_0xcbb8('0x30')](function(_0x89e30b){return _[_0xcbb8('0x75')](_0x170346,[_0xcbb8('0x3d'),_0x89e30b])?_0x89e30b:undefined;})[_0xcbb8('0x76')]()['value']();if(!_[_0xcbb8('0x77')](_0x426303)){_0x426303[_0xcbb8('0x35')](function(_0x346014){if(_0x346014===_0xcbb8('0x78')){_0xa0af16[_0xcbb8('0x48')](_0xcbb8('0x79'),[][_0xcbb8('0x7a')](_0x263bfc['query'][_0x346014]));}else if(_0x346014===_0xcbb8('0x7b')){var _0x4f0eca=JSON[_0xcbb8('0x7c')](_0x263bfc[_0xcbb8('0x3f')][_0x346014])[_0xcbb8('0x7d')];var _0x392050=JSON[_0xcbb8('0x7c')](_0x263bfc['query'][_0x346014])[_0xcbb8('0x7e')];_0xa0af16['where'](_0xcbb8('0x7f'),_0x4f0eca,_0x392050);}else{if(_0x263bfc[_0xcbb8('0x3f')][_0x346014]===_0xcbb8('0x80')){_0xa0af16[_0xcbb8('0x48')]('i.'+_0x346014+_0xcbb8('0x81'));}else{_0xa0af16['where']('i.'+_0x346014+_0xcbb8('0x82'),_0x263bfc[_0xcbb8('0x3f')][_0x346014]);}}});}if(_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x83')]){if(_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x83')]==0x1){_0xa0af16[_0xcbb8('0x64')](_0xcbb8('0x84'));}else{_0xa0af16[_0xcbb8('0x64')](_0xcbb8('0x85'));}}if(_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x86')]){_0x575cc0=_[_0xcbb8('0x87')](_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x86')])?_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x86')]:new Array(_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x86')]);_0x575cc0[_0xcbb8('0x35')](function(_0x36764d){_0x320d76['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36764d+',%');});}if(_0x263bfc[_0xcbb8('0x3f')]['filter']){var _0x28679e=_0x263bfc['query'][_0xcbb8('0x88')][_0xcbb8('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xcbb8('0x8a')](_0x28679e)){_0x2cb121['or'](_0xcbb8('0x8b'),_0x28679e+'%')['or'](_0xcbb8('0x8c'),_0x28679e+'%');}_0x2cb121['or'](_0xcbb8('0x8d'),_0x28679e+'%');}}_0xa0af16[_0xcbb8('0x48')](_0x2cb121);_0xa0af16[_0xcbb8('0x8e')]('i.id');var _0x4fbc56={'type':db[_0xcbb8('0x8f')][_0xcbb8('0x90')][_0xcbb8('0x91')],'raw':!![]};var _0x226652=_0xa0af16['clone']();_0x226652[_0xcbb8('0x4b')]('i.id');_0x226652[_0xcbb8('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcbb8('0x92'));if(_0x4e66a6[_0xcbb8('0x46')]){_0x4e66a6[_0xcbb8('0x46')][_0xcbb8('0x35')](function(_0x26439c){var _0x3b42f8=_0x26439c[0x0]===_0xcbb8('0x93')?_0x26439c[0x0]:'i.'+_0x26439c[0x0];_0xa0af16[_0xcbb8('0x46')](_0x3b42f8,_0x26439c[0x1]===_0xcbb8('0x94')?![]:!![]);});}if(!_[_0xcbb8('0x77')](_0x575cc0)){_0xa0af16[_0xcbb8('0x64')](_0x320d76);_0x226652[_0xcbb8('0x48')](_0xcbb8('0x95'),_0x575cc0);}BPromise['resolve']()[_0xcbb8('0x2a')](function(){if(!_0x510122){if(_0x263bfc['query'][_0xcbb8('0x78')])return;_0x226652[_0xcbb8('0x48')](_0xcbb8('0x96'));_0xa0af16[_0xcbb8('0x48')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x263bfc[_0xcbb8('0x97')]['role']!==_0xcbb8('0x98'))return;return _0x263bfc[_0xcbb8('0x97')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xcbb8('0x2a')](function(_0x135fff){if(_[_0xcbb8('0x77')](_0x135fff)){_0x226652['where'](_0xcbb8('0x99'));_0xa0af16['where'](_0xcbb8('0x99'));}else{_0x226652[_0xcbb8('0x48')]('i.FaxAccountId\x20IN\x20?',_[_0xcbb8('0x30')](_0x135fff,'id'));_0xa0af16[_0xcbb8('0x48')](_0xcbb8('0x79'),_['map'](_0x135fff,'id'));}});})[_0xcbb8('0x2a')](function(){if(_0x263bfc[_0xcbb8('0x97')][_0xcbb8('0x9a')]===_0xcbb8('0x98')&&!_0x510122&&!_0x263bfc[_0xcbb8('0x3f')]['FaxAccountId'])return[];return db[_0xcbb8('0x9b')]['query'](_0x226652['toString'](),_0x4fbc56);})[_0xcbb8('0x2a')](function(_0x505383){_0x5595e8[_0xcbb8('0x22')]=_0x505383[_0xcbb8('0x44')];if(_0x5595e8['count']===0x0)return[];return db[_0xcbb8('0x9b')][_0xcbb8('0x3f')](_0x2c33c2[_0xcbb8('0x9c')](),_0x4fbc56)[_0xcbb8('0x2a')](function(_0x5b87d3){_0x536afa=_[_0xcbb8('0x9d')](_0x5b87d3,'id');_0x4fbc56=_[_0xcbb8('0x9e')](_0x4fbc56,{'model':db[_0xcbb8('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x263bfc[_0xcbb8('0x3f')][_0xcbb8('0x43')]){_0x4e66a6[_0xcbb8('0x42')]['forEach'](function(_0x7daf71){_0xa0af16[_0xcbb8('0x4b')]('i.'+_0x7daf71);});}else{_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0x9f'),_0xcbb8('0x92'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xa0'),_0xcbb8('0xa1'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xa2'),_0xcbb8('0xa3'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xa4'),_0xcbb8('0x93'));_0xa0af16['field'](_0xcbb8('0xa5'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xa6'),_0xcbb8('0xa7'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xa8'),_0xcbb8('0xa9'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xaa'),_0xcbb8('0xab'));_0xa0af16['field']('c.phone',_0xcbb8('0xac'));_0xa0af16[_0xcbb8('0x4b')]('c.mobile',_0xcbb8('0xad'));_0xa0af16['field'](_0xcbb8('0xae'),'Contact.fax');_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xaf'),_0xcbb8('0xb0'));_0xa0af16[_0xcbb8('0x4b')]('o.internal',_0xcbb8('0xb1'));_0xa0af16[_0xcbb8('0x4b')](_0xcbb8('0xb2'),_0xcbb8('0x33'));}if(_0x4e66a6[_0xcbb8('0x24')])_0xa0af16[_0xcbb8('0x24')](_0x4e66a6[_0xcbb8('0x24')]);if(_0x4e66a6[_0xcbb8('0x23')])_0xa0af16[_0xcbb8('0x23')](_0x4e66a6['offset']);return db[_0xcbb8('0x9b')]['query'](_0xa0af16[_0xcbb8('0x9c')](),_0x4fbc56);})[_0xcbb8('0x2a')](function(_0x3f9c9d){_0x14b34b[_0xcbb8('0x48')](_0xcbb8('0xb3'),_[_0xcbb8('0x30')](_0x3f9c9d,'id'));return db[_0xcbb8('0x9b')][_0xcbb8('0x3f')](_0x14b34b['toString'](),_0x4fbc56)[_0xcbb8('0x2a')](function(_0x5bbf2f){var _0x11ccac=_[_0xcbb8('0xb4')](_0x5bbf2f,_0xcbb8('0xb5'));var _0x3b3aae=[];_0x3f9c9d[_0xcbb8('0x35')](function(_0x13a527){_0x3b3aae['push'](updateFaxInteraction(_0x13a527,_0x536afa,_0x11ccac));});return BPromise[_0xcbb8('0xb6')](_0x3b3aae);});});})['then'](function(_0x2a4264){_0x5595e8[_0xcbb8('0xb7')]=_0x2a4264;return _0x5595e8;})[_0xcbb8('0x2a')](respondWithFilteredResult(_0xdf962b,_0x4e66a6))[_0xcbb8('0xb8')](handleError(_0xdf962b,null));};exports[_0xcbb8('0xb9')]=function(_0x493f99,_0x58e055){var _0x3b5a42={'raw':![],'where':{'id':_0x493f99[_0xcbb8('0xba')]['id']}},_0x298de6={};_0x298de6[_0xcbb8('0x3c')]=_[_0xcbb8('0x3e')](db[_0xcbb8('0x38')][_0xcbb8('0x39')]);_0x298de6[_0xcbb8('0x3f')]=_[_0xcbb8('0x3e')](_0x493f99[_0xcbb8('0x3f')]);_0x298de6[_0xcbb8('0x40')]=_[_0xcbb8('0x41')](_0x298de6[_0xcbb8('0x3c')],_0x298de6[_0xcbb8('0x3f')]);_0x3b5a42[_0xcbb8('0x42')]=_[_0xcbb8('0x41')](_0x298de6[_0xcbb8('0x3c')],qs['fields'](_0x493f99[_0xcbb8('0x3f')]['fields']));_0x3b5a42[_0xcbb8('0x42')]=_0x3b5a42[_0xcbb8('0x42')][_0xcbb8('0x44')]?_0x3b5a42[_0xcbb8('0x42')]:_0x298de6[_0xcbb8('0x3c')];if(_0x493f99[_0xcbb8('0x3f')][_0xcbb8('0xbb')]){_0x3b5a42[_0xcbb8('0xbc')]=[{'all':!![]}];}_0x3b5a42=_[_0xcbb8('0x9e')]({},_0x3b5a42,_0x493f99[_0xcbb8('0xbd')]);return db[_0xcbb8('0x38')][_0xcbb8('0x62')](_0x3b5a42)[_0xcbb8('0x2a')](handleEntityNotFound(_0x58e055,null))['then'](respondWithResult(_0x58e055,null))['catch'](handleError(_0x58e055,null));};exports[_0xcbb8('0xbe')]=function(_0x4447a8,_0x320b13){return db[_0xcbb8('0x38')][_0xcbb8('0xbe')](_0x4447a8[_0xcbb8('0x74')],{})['then'](respondWithResult(_0x320b13,0xc9))[_0xcbb8('0xb8')](handleError(_0x320b13,null));};exports[_0xcbb8('0x29')]=function(_0x418fac,_0x41b59b){if(_0x418fac[_0xcbb8('0x74')]['id']){delete _0x418fac[_0xcbb8('0x74')]['id'];}return db[_0xcbb8('0x38')]['find']({'where':{'id':_0x418fac['params']['id']}})['then'](handleEntityNotFound(_0x41b59b,null))['then'](saveUpdates(_0x418fac['body'],null))[_0xcbb8('0x2a')](respondWithResult(_0x41b59b,null))['catch'](handleError(_0x41b59b,null));};exports[_0xcbb8('0x2b')]=function(_0x4fe670,_0x457626){return db['FaxInteraction']['find']({'where':{'id':_0x4fe670['params']['id']}})[_0xcbb8('0x2a')](handleEntityNotFound(_0x457626,null))[_0xcbb8('0x2a')](removeEntity(_0x457626,null))[_0xcbb8('0xb8')](handleError(_0x457626,null));};exports[_0xcbb8('0xbf')]=function(_0x32f3d6,_0x26a6b7){return db[_0xcbb8('0x38')][_0xcbb8('0xbf')]()['then'](respondWithResult(_0x26a6b7,null))[_0xcbb8('0xb8')](handleError(_0x26a6b7,null));};exports[_0xcbb8('0xc0')]=function(_0x4236cd,_0x239880,_0x3dfeb2){return db[_0xcbb8('0xc1')][_0xcbb8('0x62')]({'where':{'id':_0x4236cd[_0xcbb8('0xba')]['id']}})[_0xcbb8('0x2a')](handleEntityNotFound(_0x239880,null))['then'](function(_0x5c32b8){if(_0x5c32b8){return _0x5c32b8['addMessage'](_0x4236cd['body'][_0xcbb8('0xc2')],_[_0xcbb8('0xc3')](_0x4236cd[_0xcbb8('0x74')],[_0xcbb8('0xc2'),'id'])||{});}})[_0xcbb8('0x2a')](respondWithResult(_0x239880,null))[_0xcbb8('0xb8')](handleError(_0x239880,null));};exports[_0xcbb8('0xc4')]=function(_0x3b2069,_0x274db8,_0x3baa42){var _0x36577a={'raw':![],'where':{}};var _0x2ee615={};var _0x338e08={'count':0x0,'rows':[]};return db[_0xcbb8('0x38')][_0xcbb8('0xc5')]({'where':{'id':_0x3b2069[_0xcbb8('0xba')]['id']}})[_0xcbb8('0x2a')](handleEntityNotFound(_0x274db8,null))['then'](function(_0x17ab6c){if(_0x17ab6c){_0x2ee615[_0xcbb8('0x3c')]=_[_0xcbb8('0x3e')](db['FaxMessage'][_0xcbb8('0x39')]);_0x2ee615[_0xcbb8('0x3f')]=_[_0xcbb8('0x3e')](_0x3b2069['query']);_0x2ee615[_0xcbb8('0x40')]=_[_0xcbb8('0x41')](_0x2ee615[_0xcbb8('0x3c')],_0x2ee615['query']);_0x36577a['attributes']=_[_0xcbb8('0x41')](_0x2ee615['model'],qs[_0xcbb8('0x43')](_0x3b2069[_0xcbb8('0x3f')][_0xcbb8('0x43')]));_0x36577a[_0xcbb8('0x42')]=_0x36577a['attributes'][_0xcbb8('0x44')]?_0x36577a[_0xcbb8('0x42')]:_0x2ee615[_0xcbb8('0x3c')];if(!_0x3b2069['query'][_0xcbb8('0x45')]('nolimit')){_0x36577a[_0xcbb8('0x24')]=qs[_0xcbb8('0x24')](_0x3b2069['query']['limit']);_0x36577a['offset']=qs[_0xcbb8('0x23')](_0x3b2069['query']['offset']);}_0x36577a[_0xcbb8('0x46')]=qs[_0xcbb8('0x47')](_0x3b2069[_0xcbb8('0x3f')][_0xcbb8('0x47')]);_0x36577a[_0xcbb8('0x48')]=qs[_0xcbb8('0x40')](_['pick'](_0x3b2069['query'],_0x2ee615['filters']));_0x36577a[_0xcbb8('0x48')]['FaxInteractionId']=_0x17ab6c['id'];if(_0x3b2069[_0xcbb8('0x3f')][_0xcbb8('0x88')]){_0x36577a['where']=_[_0xcbb8('0x9e')](_0x36577a[_0xcbb8('0x48')],{'$or':_[_0xcbb8('0x30')](_0x36577a[_0xcbb8('0x42')],function(_0x308a5e){var _0x3335a5={};_0x3335a5[_0x308a5e]={'$like':'%'+_0x3b2069['query'][_0xcbb8('0x88')]+'%'};return _0x3335a5;})});}if(_0x3b2069[_0xcbb8('0x3f')]['$gte']){var _0x1b1228=_0x3b2069[_0xcbb8('0x3f')][_0xcbb8('0x7d')][_0xcbb8('0x34')](',');var _0xaabdc2={};_0xaabdc2[_0x1b1228[0x0]]={'$gte':moment(_0x1b1228[0x1])[_0xcbb8('0xc6')](_0xcbb8('0xc7'))};_0x36577a[_0xcbb8('0x48')]=_['merge'](_0x36577a[_0xcbb8('0x48')],_0xaabdc2);}_0x36577a=_[_0xcbb8('0x9e')]({},_0x36577a,_0x3b2069[_0xcbb8('0xbd')]);return db[_0xcbb8('0xc1')][_0xcbb8('0x22')]({'where':_0x36577a[_0xcbb8('0x48')]})[_0xcbb8('0x2a')](function(_0x12e4d3){_0x338e08[_0xcbb8('0x22')]=_0x12e4d3;if(_0x3b2069['query'][_0xcbb8('0xbb')]){_0x36577a[_0xcbb8('0xbc')]=[{'all':!![]}];}return db[_0xcbb8('0xc1')][_0xcbb8('0xc8')](_0x36577a);})['then'](function(_0x4667ea){_0x338e08[_0xcbb8('0xb7')]=_0x4667ea;return _0x338e08;});}})[_0xcbb8('0x2a')](respondWithFilteredResult(_0x274db8,_0x36577a))[_0xcbb8('0xb8')](handleError(_0x274db8,null));};exports['addTags']=function(_0x10a070,_0x2377f1,_0x3a30f){return db[_0xcbb8('0x38')][_0xcbb8('0x62')]({'where':{'id':_0x10a070['params']['id']}})['then'](handleEntityNotFound(_0x2377f1,null))[_0xcbb8('0x2a')](function(_0xaed36d){if(_0xaed36d){return _0xaed36d['setTags'](_0x10a070[_0xcbb8('0x74')][_0xcbb8('0xc2')],_[_0xcbb8('0xc3')](_0x10a070['body'],[_0xcbb8('0xc2'),'id'])||{})[_0xcbb8('0xc9')](function(){return db['Tag'][_0xcbb8('0xc8')]({'attributes':['id','name',_0xcbb8('0x4c')],'where':{'id':_0x10a070['body'][_0xcbb8('0xc2')]}});})[_0xcbb8('0x2a')](function(_0x5cc2fb){socket['emit']('faxInteractionTags:save',{'id':Number(_0x10a070[_0xcbb8('0xba')]['id']),'tags':_0x5cc2fb||[]});return{'id':Number(_0x10a070['params']['id']),'tags':_0x5cc2fb||[]};});}})['then'](respondWithResult(_0x2377f1,null))[_0xcbb8('0xb8')](handleError(_0x2377f1,null));};exports[_0xcbb8('0xca')]=function(_0x59e56e,_0x5e7a50,_0x105da3){return db['FaxInteraction'][_0xcbb8('0x62')]({'where':{'id':_0x59e56e[_0xcbb8('0xba')]['id']}})[_0xcbb8('0x2a')](handleEntityNotFound(_0x5e7a50,null))[_0xcbb8('0x2a')](function(_0x2ad55c){if(_0x2ad55c){return _0x2ad55c[_0xcbb8('0xca')](_0x59e56e[_0xcbb8('0x3f')][_0xcbb8('0xc2')]);}})[_0xcbb8('0x2a')](respondWithStatusCode(_0x5e7a50,null))['catch'](handleError(_0x5e7a50,null));};exports['download']=function(_0x1ad882,_0x17a9c8){var _0x31650e=moment()[_0xcbb8('0xcb')]()[_0xcbb8('0x9c')]();var _0x399d9b=path[_0xcbb8('0xcc')](config[_0xcbb8('0xcd')],_0xcbb8('0xce'),_0xcbb8('0xcf'),'tmp');var _0x5df360=path[_0xcbb8('0xcc')](config[_0xcbb8('0xcd')],_0xcbb8('0xce'),'files','attachments');var _0x29658f=path[_0xcbb8('0xcc')](_0x399d9b,_0x31650e);var _0x244173=util[_0xcbb8('0xc6')]('transcript-%d-%s.zip',_0x1ad882['params']['id'],_0x31650e);var _0xe5bcbc=path['join'](_0x399d9b,_0x244173);var _0x52c588=[];_0x52c588['push']({'model':db[_0xcbb8('0xd0')],'as':'Attachment','raw':!![]});var _0x164940=[{'model':db[_0xcbb8('0xc1')],'as':'Messages','attributes':['id','body',_0xcbb8('0x7b')],'include':_0x52c588}];return db[_0xcbb8('0x38')][_0xcbb8('0x62')]({'where':{'id':_0x1ad882[_0xcbb8('0xba')]['id']},'include':_0x164940})[_0xcbb8('0x2a')](handleEntityNotFound(_0x17a9c8,null))[_0xcbb8('0x2a')](function(_0x111a85){if(_0x111a85&&_0x111a85[_0xcbb8('0xd1')]){var _0x563129=_0x111a85[_0xcbb8('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x29658f);for(var _0x273fe5=0x0;_0x273fe5<_0x563129[_0xcbb8('0xd1')]['length'];_0x273fe5++){var _0x50f54e=_0x563129[_0xcbb8('0xd1')][_0x273fe5][_0xcbb8('0xd0')];if(_0x50f54e){var _0x149a89=path[_0xcbb8('0xcc')](_0x5df360,_0x50f54e[_0xcbb8('0xd3')]);if(fs['existsSync'](_0x149a89)){fs[_0xcbb8('0xd4')](_0x149a89)[_0xcbb8('0xd5')](fs[_0xcbb8('0xd6')](path[_0xcbb8('0xcc')](_0x29658f,_0x50f54e[_0xcbb8('0xd3')])));}}}return BPromise[_0xcbb8('0xd7')]()['then'](function(){return new BPromise(function(_0xe1ca51,_0xa28cc8){zipdir(_0x29658f,{'saveTo':_0xe5bcbc},function(_0x5c8159,_0x1c1816){if(_0x5c8159)return _0xa28cc8(_0x5c8159);return _0xe1ca51(_0x1c1816);});})[_0xcbb8('0x2a')](function(){return new BPromise(function(_0xe28bf4,_0x16736e){rimraf(_0x29658f,function(_0x41bdc7){if(_0x41bdc7)_0x16736e(_0x41bdc7);return _0xe28bf4();});});})['then'](function(){return _0x17a9c8[_0xcbb8('0xd8')](_0xe5bcbc,_0x244173,function(_0x1aa959){if(_0x1aa959){console['log'](_0xcbb8('0xd9'),_0x1aa959);}else{fs[_0xcbb8('0xda')](_0xe5bcbc);}});});});}else{return _0x17a9c8[_0xcbb8('0x1e')](0xc8);}})['catch'](handleError(_0x17a9c8,null));}; \ No newline at end of file +var _0x0e7c=['t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','show','params','intersection','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','emit','removeTags','download','unix','join','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','pipe','createWriteStream','basename','err','unlinkSync','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','field','color','from','select','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','having'];(function(_0x333258,_0x27b5e2){var _0x60c088=function(_0x573098){while(--_0x573098){_0x333258['push'](_0x333258['shift']());}};_0x60c088(++_0x27b5e2);}(_0x0e7c,0x121));var _0xc0e7=function(_0x59d369,_0x56a533){_0x59d369=_0x59d369-0x0;var _0x58c3eb=_0x0e7c[_0x59d369];return _0x58c3eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc0e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0e7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0e7('0x3'));var util=require(_0xc0e7('0x4'));var path=require(_0xc0e7('0x5'));var sox=require(_0xc0e7('0x6'));var csv=require(_0xc0e7('0x7'));var ejs=require(_0xc0e7('0x8'));var fs=require('fs');var _=require(_0xc0e7('0x9'));var squel=require(_0xc0e7('0xa'));var crypto=require(_0xc0e7('0xb'));var jsforce=require(_0xc0e7('0xc'));var deskjs=require(_0xc0e7('0xd'));var toCsv=require(_0xc0e7('0x7'));var querystring=require(_0xc0e7('0xe'));var Papa=require(_0xc0e7('0xf'));var Redis=require('ioredis');var authService=require(_0xc0e7('0x10'));var qs=require(_0xc0e7('0x11'));var as=require(_0xc0e7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0e7('0x13'))(_0xc0e7('0x14'));var utils=require(_0xc0e7('0x15'));var config=require(_0xc0e7('0x16'));var licenseUtil=require(_0xc0e7('0x17'));var db=require(_0xc0e7('0x18'))['db'];config[_0xc0e7('0x19')]=_[_0xc0e7('0x1a')](config[_0xc0e7('0x19')],{'host':_0xc0e7('0x1b'),'port':0x18eb});var socket=require(_0xc0e7('0x1c'))(new Redis(config[_0xc0e7('0x19')]));require(_0xc0e7('0x1d'))['register'](socket);function respondWithStatusCode(_0x26008e,_0x391150){_0x391150=_0x391150||0xcc;return function(_0x4b156c){if(_0x4b156c){return _0x26008e[_0xc0e7('0x1e')](_0x391150);}return _0x26008e[_0xc0e7('0x1f')](_0x391150)[_0xc0e7('0x20')]();};}function respondWithResult(_0x89d70b,_0x3bbb57){_0x3bbb57=_0x3bbb57||0xc8;return function(_0x1d7dcf){if(_0x1d7dcf){return _0x89d70b[_0xc0e7('0x1f')](_0x3bbb57)[_0xc0e7('0x21')](_0x1d7dcf);}};}function respondWithFilteredResult(_0x34c709,_0x344021){return function(_0x2b6ee3){if(_0x2b6ee3){var _0x16d93e=_0x2b6ee3[_0xc0e7('0x22')],_0x5be8c2=_0x344021[_0xc0e7('0x23')],_0x39bd7e=_0x344021['offset']+_0x344021['limit'],_0xf2c31f;if(_0x39bd7e>=_0x16d93e){_0x39bd7e=_0x16d93e;_0xf2c31f=0xc8;}else{_0xf2c31f=0xce;}_0x34c709[_0xc0e7('0x1f')](_0xf2c31f);return _0x34c709[_0xc0e7('0x24')](_0xc0e7('0x25'),_0x5be8c2+'-'+_0x39bd7e+'/'+_0x16d93e)[_0xc0e7('0x21')](_0x2b6ee3);}return null;};}function patchUpdates(_0x250e19){return function(_0x5f717a){try{jsonpatch[_0xc0e7('0x26')](_0x5f717a,_0x250e19,!![]);}catch(_0x587140){return BPromise['reject'](_0x587140);}return _0x5f717a[_0xc0e7('0x27')]();};}function saveUpdates(_0x597cee,_0x575f8e){return function(_0x5e9ba7){if(_0x5e9ba7){return _0x5e9ba7[_0xc0e7('0x28')](_0x597cee)[_0xc0e7('0x29')](function(_0x5959cb){return _0x5959cb;});}return null;};}function removeEntity(_0x35752e,_0x13ade5){return function(_0x3ee49b){if(_0x3ee49b){return _0x3ee49b[_0xc0e7('0x2a')]()[_0xc0e7('0x29')](function(){_0x35752e[_0xc0e7('0x1f')](0xcc)[_0xc0e7('0x20')]();});}};}function handleEntityNotFound(_0x2a2e51,_0x2d82a0){return function(_0x2d47f2){if(!_0x2d47f2){_0x2a2e51[_0xc0e7('0x1e')](0x194);}return _0x2d47f2;};}function handleError(_0x957271,_0x1002bd){_0x1002bd=_0x1002bd||0x1f4;return function(_0x1ebee0){logger[_0xc0e7('0x2b')](_0x1ebee0[_0xc0e7('0x2c')]);if(_0x1ebee0['name']){delete _0x1ebee0[_0xc0e7('0x2d')];}_0x957271['status'](_0x1002bd)[_0xc0e7('0x2e')](_0x1ebee0);};}function getInteractionUsers(_0x9b94b6,_0x3156c5){return new BPromise(function(_0x4d2cb6,_0x19db4d){try{if(_0x3156c5[_0x9b94b6['id']]){_0x9b94b6['Users']=_[_0xc0e7('0x2f')](_0x3156c5[_0x9b94b6['id']],function(_0x3c7204){return{'id':_0x3c7204['id'],'fullname':_0x3c7204[_0xc0e7('0x30')]};});}}catch(_0x12e755){_0x19db4d(_0x12e755);}_0x4d2cb6(_0x9b94b6);});}function getInteractionTags(_0xbe1e9a,_0x59e926){return new BPromise(function(_0x53f524,_0x3a90e6){try{if(_0xbe1e9a[_0xc0e7('0x31')]){_0xbe1e9a[_0xc0e7('0x32')]=[];_0xbe1e9a['TagIds'][_0xc0e7('0x33')](',')[_0xc0e7('0x34')](function(_0x406e81){_0xbe1e9a[_0xc0e7('0x32')][_0xc0e7('0x35')](_0x59e926[_0x406e81]);});}delete _0xbe1e9a[_0xc0e7('0x31')];}catch(_0x3e4781){_0x3a90e6(_0x3e4781);}_0x53f524(_0xbe1e9a);});}function updateFaxInteraction(_0x2037b6,_0x3b4377,_0x6b981f){return new BPromise(function(_0x1d3523,_0x1a0c2f){return getInteractionUsers(_0x2037b6,_0x6b981f)[_0xc0e7('0x29')](function(_0x79f411){return getInteractionTags(_0x79f411,_0x3b4377);})[_0xc0e7('0x29')](function(_0xc2ac86){_0x1d3523(_0xc2ac86);})[_0xc0e7('0x36')](function(_0x8463dc){_0x1a0c2f(_0x8463dc);});});}exports[_0xc0e7('0x37')]=function(_0x387715,_0x3c3678){var _0x551fd2={},_0x57d25c={},_0x10575d={'count':0x0,'rows':[]};var _0x133216=_[_0xc0e7('0x2f')](db[_0xc0e7('0x38')]['rawAttributes'],function(_0x468caf){return{'name':_0x468caf[_0xc0e7('0x39')],'type':_0x468caf[_0xc0e7('0x3a')][_0xc0e7('0x3b')]};});_0x57d25c[_0xc0e7('0x3c')]=_[_0xc0e7('0x2f')](_0x133216,_0xc0e7('0x2d'));_0x57d25c['query']=_[_0xc0e7('0x3d')](_0x387715['query']);_0x57d25c['filters']=_['intersection'](_0x57d25c[_0xc0e7('0x3c')],_0x57d25c[_0xc0e7('0x3e')]);_0x551fd2[_0xc0e7('0x3f')]=_['intersection'](_0x57d25c[_0xc0e7('0x3c')],qs[_0xc0e7('0x40')](_0x387715['query'][_0xc0e7('0x40')]));_0x551fd2[_0xc0e7('0x3f')]=_0x551fd2[_0xc0e7('0x3f')]['length']?_0x551fd2[_0xc0e7('0x3f')]:_0x57d25c['model'];if(!_0x387715['query'][_0xc0e7('0x41')](_0xc0e7('0x42'))){_0x551fd2[_0xc0e7('0x43')]=qs[_0xc0e7('0x43')](_0x387715['query'][_0xc0e7('0x43')]);_0x551fd2['offset']=qs[_0xc0e7('0x23')](_0x387715[_0xc0e7('0x3e')]['offset']);}_0x551fd2[_0xc0e7('0x44')]=qs[_0xc0e7('0x45')](_0x387715['query'][_0xc0e7('0x45')]);_0x551fd2[_0xc0e7('0x46')]=qs['filters'](_['pick'](_0x387715[_0xc0e7('0x3e')],_0x57d25c[_0xc0e7('0x47')]),_0x133216);var _0x582535=[];var _0x466fc7=squel['select']()[_0xc0e7('0x48')]('id')[_0xc0e7('0x48')]('name')['field'](_0xc0e7('0x49'))[_0xc0e7('0x4a')]('tools_tags');var _0xe78ada=squel[_0xc0e7('0x4b')]()[_0xc0e7('0x48')](_0xc0e7('0x4c'))[_0xc0e7('0x48')](_0xc0e7('0x4d'))[_0xc0e7('0x48')]('ui.FaxInteractionId')['from'](_0xc0e7('0x4e'),'ui')[_0xc0e7('0x4f')](_0xc0e7('0x50'),'u',_0xc0e7('0x51'));var _0x2dfc67=squel['select']()[_0xc0e7('0x4a')](_0xc0e7('0x52'),'i')['left_join'](_0xc0e7('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc0e7('0x4f')](_0xc0e7('0x50'),'o',_0xc0e7('0x54'))['left_join'](_0xc0e7('0x55'),'a',_0xc0e7('0x56'))[_0xc0e7('0x4f')](_0xc0e7('0x57'),'me',_0xc0e7('0x58'))[_0xc0e7('0x4f')](_0xc0e7('0x59'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xc0e7('0x4f')]('tools_tags','t',_0xc0e7('0x5a'));var _0x2ea683=squel[_0xc0e7('0x5b')]();var _0x59b5df=[];var _0x454cac=squel[_0xc0e7('0x5b')]();var _0x3cdd7f;if(_0x387715['query'][_0xc0e7('0x5c')]){_0x3cdd7f=as[_0xc0e7('0x5d')](_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x5c')]);var _0x4a3cd9=_0x3cdd7f[_0xc0e7('0x5e')];for(var _0x2c79f4=0x0;_0x2c79f4<_0x3cdd7f[_0xc0e7('0x5f')][_0xc0e7('0x60')];_0x2c79f4++){var _0x1daa7f=_0x3cdd7f['conditions'][_0x2c79f4];var _0x28e2a4='i';var _0x192676=_[_0xc0e7('0x61')](_0x133216,[_0xc0e7('0x2d'),_0x1daa7f['field']]);if(!_0x192676){switch(_0x1daa7f[_0xc0e7('0x48')]){case _0xc0e7('0x62'):if(_0x1daa7f[_0xc0e7('0x63')]==0x1){_0x2dfc67['having']('`'+_0x1daa7f[_0xc0e7('0x48')]+'`\x20=\x200');}else{_0x2dfc67['having']('`'+_0x1daa7f[_0xc0e7('0x48')]+_0xc0e7('0x64'));}break;case _0xc0e7('0x65'):if(_0x1daa7f['operator']===_0xc0e7('0x66')){if(_0x1daa7f[_0xc0e7('0x63')][_0xc0e7('0x33')]('\x20')[_0xc0e7('0x60')]>0x1){_0x2ea683[_0x4a3cd9](_0xc0e7('0x67'),qs[_0xc0e7('0x68')](_0x1daa7f[_0xc0e7('0x63')]),null);}else{var _0x28d2d8='%'+_0x1daa7f[_0xc0e7('0x63')]+'%';_0x2ea683[_0x4a3cd9](_0xc0e7('0x69'),_0x28d2d8,_0x28d2d8,_0x28d2d8);}}else{_0x192676=_[_0xc0e7('0x61')](_0x133216,[_0xc0e7('0x2d'),_0xc0e7('0x6a')]);_0x1daa7f[_0xc0e7('0x48')]=_0xc0e7('0x6a');_0x24bee6=as[_0xc0e7('0x6b')](_0x28e2a4,_0x192676[_0xc0e7('0x3a')],_0x1daa7f);_0x2ea683[_0x4a3cd9](_0x24bee6[_0xc0e7('0x6c')],_0x24bee6[_0xc0e7('0x63')][_0xc0e7('0x6d')],_0x24bee6[_0xc0e7('0x63')]['end']);}break;case _0xc0e7('0x6e'):var _0x498fdd=_0x1daa7f[_0xc0e7('0x63')][_0xc0e7('0x33')](',')['map'](function(_0x4b303a){return Number(_0x4b303a);});_0x498fdd[_0xc0e7('0x34')](function(_0x4d0af1){_0x454cac['or'](_0xc0e7('0x6f'),'%,'+_0x4d0af1+',%');});_0x59b5df=_[_0xc0e7('0x70')](_0x59b5df,_0x498fdd);break;case _0xc0e7('0x71'):if(_0x1daa7f[_0xc0e7('0x72')]==='$substring'){_0x2ea683[_0x4a3cd9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1daa7f[_0xc0e7('0x63')]+'%',null);}else{_0x192676=_[_0xc0e7('0x61')](_0x133216,['name',_0xc0e7('0x73')]);_0x1daa7f[_0xc0e7('0x48')]=_0xc0e7('0x73');_0x24bee6=as['buildExpression'](_0x28e2a4,_0x192676['type'],_0x1daa7f);_0x2ea683[_0x4a3cd9](_0x24bee6[_0xc0e7('0x6c')],_0x24bee6[_0xc0e7('0x63')]['start'],_0x24bee6[_0xc0e7('0x63')][_0xc0e7('0x20')]);}break;case _0xc0e7('0x74'):_0x24bee6=as['buildExpression']('me',null,_0x1daa7f);_0x2ea683[_0x4a3cd9](_0x24bee6[_0xc0e7('0x6c')],_0x24bee6[_0xc0e7('0x63')][_0xc0e7('0x6d')],_0x24bee6[_0xc0e7('0x63')]['end']);break;}}else{var _0x24bee6=as[_0xc0e7('0x6b')](_0x28e2a4,_0x192676[_0xc0e7('0x3a')],_0x1daa7f);_0x2ea683[_0x4a3cd9](_0x24bee6[_0xc0e7('0x6c')],_0x24bee6['value'][_0xc0e7('0x6d')],_0x24bee6[_0xc0e7('0x63')][_0xc0e7('0x20')]);}}}else{var _0x99ba6c=_(_0x387715[_0xc0e7('0x3e')])[_0xc0e7('0x3d')]()[_0xc0e7('0x2f')](function(_0x5ee848){return _[_0xc0e7('0x75')](_0x133216,[_0xc0e7('0x2d'),_0x5ee848])?_0x5ee848:undefined;})[_0xc0e7('0x76')]()['value']();if(!_[_0xc0e7('0x77')](_0x99ba6c)){_0x99ba6c['forEach'](function(_0x296247){if(_0x296247===_0xc0e7('0x78')){_0x2dfc67[_0xc0e7('0x46')](_0xc0e7('0x79'),[][_0xc0e7('0x7a')](_0x387715[_0xc0e7('0x3e')][_0x296247]));}else if(_0x296247===_0xc0e7('0x7b')){var _0x597e14=JSON['parse'](_0x387715[_0xc0e7('0x3e')][_0x296247])['$gte'];var _0x3c3a6d=JSON[_0xc0e7('0x7c')](_0x387715['query'][_0x296247])['$lte'];_0x2dfc67[_0xc0e7('0x46')](_0xc0e7('0x7d'),_0x597e14,_0x3c3a6d);}else{if(_0x387715[_0xc0e7('0x3e')][_0x296247]===_0xc0e7('0x7e')){_0x2dfc67[_0xc0e7('0x46')]('i.'+_0x296247+'\x20IS\x20NULL');}else{_0x2dfc67[_0xc0e7('0x46')]('i.'+_0x296247+_0xc0e7('0x7f'),_0x387715[_0xc0e7('0x3e')][_0x296247]);}}});}if(_0x387715['query']['read']){if(_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x80')]==0x1){_0x2dfc67['having']('`unreadMessages`\x20=\x200');}else{_0x2dfc67['having'](_0xc0e7('0x81'));}}if(_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x82')]){_0x59b5df=_[_0xc0e7('0x83')](_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x82')])?_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x82')]:new Array(_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x82')]);_0x59b5df[_0xc0e7('0x34')](function(_0x65ba4e){_0x454cac['or'](_0xc0e7('0x6f'),'%,'+_0x65ba4e+',%');});}if(_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x84')]){var _0x5bde28=_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x84')][_0xc0e7('0x85')]('\x5c','\x5c\x5c')[_0xc0e7('0x85')](/'/g,'\x27\x27');if(qs[_0xc0e7('0x86')](_0x5bde28)){_0x2ea683['or'](_0xc0e7('0x87'),_0x5bde28+'%')['or'](_0xc0e7('0x88'),_0x5bde28+'%');}_0x2ea683['or'](_0xc0e7('0x89'),_0x5bde28+'%');}}_0x2dfc67['where'](_0x2ea683);_0x2dfc67[_0xc0e7('0x8a')](_0xc0e7('0x8b'));var _0x8f2cf4={'type':db[_0xc0e7('0x8c')]['QueryTypes'][_0xc0e7('0x8d')],'raw':!![]};var _0x32e818=_0x2dfc67['clone']();_0x32e818[_0xc0e7('0x48')]('i.id');_0x32e818['field'](_0xc0e7('0x8e'),'unreadMessages');if(_0x551fd2[_0xc0e7('0x44')]){_0x551fd2[_0xc0e7('0x44')][_0xc0e7('0x34')](function(_0x561daa){var _0x499fbc=_0x561daa[0x0]==='contactName'?_0x561daa[0x0]:'i.'+_0x561daa[0x0];_0x2dfc67[_0xc0e7('0x44')](_0x499fbc,_0x561daa[0x1]===_0xc0e7('0x8f')?![]:!![]);});}if(!_[_0xc0e7('0x77')](_0x59b5df)){_0x2dfc67[_0xc0e7('0x90')](_0x454cac);_0x32e818[_0xc0e7('0x46')](_0xc0e7('0x91'),_0x59b5df);}BPromise[_0xc0e7('0x92')]()['then'](function(){if(!_0x3cdd7f){if(_0x387715[_0xc0e7('0x3e')][_0xc0e7('0x78')])return;_0x32e818[_0xc0e7('0x46')](_0xc0e7('0x93'));_0x2dfc67['where'](_0xc0e7('0x93'));return;}if(_0x387715[_0xc0e7('0x94')][_0xc0e7('0x95')]!=='agent')return;return _0x387715[_0xc0e7('0x94')][_0xc0e7('0x96')]({'attributes':['id'],'raw':!![]})[_0xc0e7('0x29')](function(_0x2922bc){if(_[_0xc0e7('0x77')](_0x2922bc)){_0x32e818[_0xc0e7('0x46')](_0xc0e7('0x97'));_0x2dfc67[_0xc0e7('0x46')](_0xc0e7('0x97'));}else{_0x32e818[_0xc0e7('0x46')](_0xc0e7('0x79'),_['map'](_0x2922bc,'id'));_0x2dfc67[_0xc0e7('0x46')](_0xc0e7('0x79'),_['map'](_0x2922bc,'id'));}});})[_0xc0e7('0x29')](function(){if(_0x387715[_0xc0e7('0x94')][_0xc0e7('0x95')]===_0xc0e7('0x98')&&!_0x3cdd7f&&!_0x387715['query']['FaxAccountId'])return[];return db[_0xc0e7('0x99')][_0xc0e7('0x3e')](_0x32e818[_0xc0e7('0x9a')](),_0x8f2cf4);})[_0xc0e7('0x29')](function(_0x52bc25){_0x10575d[_0xc0e7('0x22')]=_0x52bc25['length'];if(_0x10575d[_0xc0e7('0x22')]===0x0)return[];return db[_0xc0e7('0x99')][_0xc0e7('0x3e')](_0x466fc7[_0xc0e7('0x9a')](),_0x8f2cf4)[_0xc0e7('0x29')](function(_0x50f3fe){_0x582535=_[_0xc0e7('0x9b')](_0x50f3fe,'id');_0x8f2cf4=_[_0xc0e7('0x9c')](_0x8f2cf4,{'model':db[_0xc0e7('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x387715['query']['fields']){_0x551fd2['attributes'][_0xc0e7('0x34')](function(_0x299704){_0x2dfc67[_0xc0e7('0x48')]('i.'+_0x299704);});}else{_0x2dfc67[_0xc0e7('0x48')](_0xc0e7('0x8e'),_0xc0e7('0x62'));_0x2dfc67['field']('a.key',_0xc0e7('0x9d'));_0x2dfc67[_0xc0e7('0x48')](_0xc0e7('0x9e'),_0xc0e7('0x9f'));_0x2dfc67[_0xc0e7('0x48')]('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',_0xc0e7('0xa0'));_0x2dfc67['field'](_0xc0e7('0xa1'));_0x2dfc67[_0xc0e7('0x48')](_0xc0e7('0xa2'),_0xc0e7('0xa3'));_0x2dfc67[_0xc0e7('0x48')]('c.lastName','Contact.lastName');_0x2dfc67['field'](_0xc0e7('0xa4'),_0xc0e7('0xa5'));_0x2dfc67[_0xc0e7('0x48')](_0xc0e7('0xa6'),_0xc0e7('0xa7'));_0x2dfc67[_0xc0e7('0x48')]('c.mobile',_0xc0e7('0xa8'));_0x2dfc67[_0xc0e7('0x48')]('c.fax',_0xc0e7('0xa9'));_0x2dfc67[_0xc0e7('0x48')]('o.fullname',_0xc0e7('0xaa'));_0x2dfc67[_0xc0e7('0x48')](_0xc0e7('0xab'),'Owner.internal');_0x2dfc67[_0xc0e7('0x48')](_0xc0e7('0xac'),'TagIds');}if(_0x551fd2['limit'])_0x2dfc67[_0xc0e7('0x43')](_0x551fd2[_0xc0e7('0x43')]);if(_0x551fd2['offset'])_0x2dfc67['offset'](_0x551fd2[_0xc0e7('0x23')]);return db[_0xc0e7('0x99')][_0xc0e7('0x3e')](_0x2dfc67[_0xc0e7('0x9a')](),_0x8f2cf4);})['then'](function(_0x5038c7){_0xe78ada['where'](_0xc0e7('0xad'),_[_0xc0e7('0x2f')](_0x5038c7,'id'));return db[_0xc0e7('0x99')][_0xc0e7('0x3e')](_0xe78ada['toString'](),_0x8f2cf4)['then'](function(_0x18681e){var _0x315444=_['groupBy'](_0x18681e,_0xc0e7('0xae'));var _0x19cd51=[];_0x5038c7[_0xc0e7('0x34')](function(_0x4ad48a){_0x19cd51['push'](updateFaxInteraction(_0x4ad48a,_0x582535,_0x315444));});return BPromise[_0xc0e7('0xaf')](_0x19cd51);});});})['then'](function(_0x5af18e){_0x10575d['rows']=_0x5af18e;return _0x10575d;})[_0xc0e7('0x29')](respondWithFilteredResult(_0x3c3678,_0x551fd2))[_0xc0e7('0x36')](handleError(_0x3c3678,null));};exports[_0xc0e7('0xb0')]=function(_0x11ee29,_0x36fa10){var _0x1c8330={'raw':![],'where':{'id':_0x11ee29[_0xc0e7('0xb1')]['id']}},_0x49465b={};_0x49465b[_0xc0e7('0x3c')]=_[_0xc0e7('0x3d')](db['FaxInteraction']['rawAttributes']);_0x49465b['query']=_[_0xc0e7('0x3d')](_0x11ee29[_0xc0e7('0x3e')]);_0x49465b[_0xc0e7('0x47')]=_['intersection'](_0x49465b[_0xc0e7('0x3c')],_0x49465b[_0xc0e7('0x3e')]);_0x1c8330[_0xc0e7('0x3f')]=_[_0xc0e7('0xb2')](_0x49465b[_0xc0e7('0x3c')],qs['fields'](_0x11ee29[_0xc0e7('0x3e')][_0xc0e7('0x40')]));_0x1c8330[_0xc0e7('0x3f')]=_0x1c8330[_0xc0e7('0x3f')]['length']?_0x1c8330['attributes']:_0x49465b[_0xc0e7('0x3c')];if(_0x11ee29[_0xc0e7('0x3e')][_0xc0e7('0xb3')]){_0x1c8330[_0xc0e7('0xb4')]=[{'all':!![]}];}_0x1c8330=_[_0xc0e7('0x9c')]({},_0x1c8330,_0x11ee29[_0xc0e7('0xb5')]);return db['FaxInteraction'][_0xc0e7('0x61')](_0x1c8330)['then'](handleEntityNotFound(_0x36fa10,null))[_0xc0e7('0x29')](respondWithResult(_0x36fa10,null))['catch'](handleError(_0x36fa10,null));};exports['create']=function(_0x5a39d8,_0x6a8232){return db[_0xc0e7('0x38')][_0xc0e7('0xb6')](_0x5a39d8[_0xc0e7('0x74')],{})[_0xc0e7('0x29')](respondWithResult(_0x6a8232,0xc9))[_0xc0e7('0x36')](handleError(_0x6a8232,null));};exports[_0xc0e7('0x28')]=function(_0x56ad43,_0x2cd4d1){if(_0x56ad43[_0xc0e7('0x74')]['id']){delete _0x56ad43[_0xc0e7('0x74')]['id'];}return db['FaxInteraction'][_0xc0e7('0x61')]({'where':{'id':_0x56ad43[_0xc0e7('0xb1')]['id']}})[_0xc0e7('0x29')](handleEntityNotFound(_0x2cd4d1,null))[_0xc0e7('0x29')](saveUpdates(_0x56ad43['body'],null))[_0xc0e7('0x29')](respondWithResult(_0x2cd4d1,null))[_0xc0e7('0x36')](handleError(_0x2cd4d1,null));};exports[_0xc0e7('0x2a')]=function(_0x59501e,_0x1aa625){return db[_0xc0e7('0x38')][_0xc0e7('0x61')]({'where':{'id':_0x59501e[_0xc0e7('0xb1')]['id']}})[_0xc0e7('0x29')](handleEntityNotFound(_0x1aa625,null))[_0xc0e7('0x29')](removeEntity(_0x1aa625,null))[_0xc0e7('0x36')](handleError(_0x1aa625,null));};exports[_0xc0e7('0xb7')]=function(_0xe8f436,_0x483b93){return db[_0xc0e7('0x38')][_0xc0e7('0xb7')]()[_0xc0e7('0x29')](respondWithResult(_0x483b93,null))[_0xc0e7('0x36')](handleError(_0x483b93,null));};exports[_0xc0e7('0xb8')]=function(_0x2dd8ce,_0x5813cb,_0x54ddca){return db[_0xc0e7('0xb9')]['find']({'where':{'id':_0x2dd8ce['params']['id']}})[_0xc0e7('0x29')](handleEntityNotFound(_0x5813cb,null))[_0xc0e7('0x29')](function(_0x38ab75){if(_0x38ab75){return _0x38ab75['addMessage'](_0x2dd8ce[_0xc0e7('0x74')][_0xc0e7('0xba')],_['omit'](_0x2dd8ce[_0xc0e7('0x74')],[_0xc0e7('0xba'),'id'])||{});}})[_0xc0e7('0x29')](respondWithResult(_0x5813cb,null))['catch'](handleError(_0x5813cb,null));};exports[_0xc0e7('0xbb')]=function(_0x2416c0,_0x5d852b,_0x129d62){var _0x42d848={'raw':![],'where':{}};var _0x180f02={};var _0x203bd2={'count':0x0,'rows':[]};return db[_0xc0e7('0x38')][_0xc0e7('0xbc')]({'where':{'id':_0x2416c0[_0xc0e7('0xb1')]['id']}})['then'](handleEntityNotFound(_0x5d852b,null))[_0xc0e7('0x29')](function(_0x1f475d){if(_0x1f475d){_0x180f02[_0xc0e7('0x3c')]=_[_0xc0e7('0x3d')](db[_0xc0e7('0xb9')]['rawAttributes']);_0x180f02[_0xc0e7('0x3e')]=_[_0xc0e7('0x3d')](_0x2416c0[_0xc0e7('0x3e')]);_0x180f02[_0xc0e7('0x47')]=_[_0xc0e7('0xb2')](_0x180f02['model'],_0x180f02[_0xc0e7('0x3e')]);_0x42d848[_0xc0e7('0x3f')]=_[_0xc0e7('0xb2')](_0x180f02[_0xc0e7('0x3c')],qs['fields'](_0x2416c0[_0xc0e7('0x3e')][_0xc0e7('0x40')]));_0x42d848[_0xc0e7('0x3f')]=_0x42d848[_0xc0e7('0x3f')][_0xc0e7('0x60')]?_0x42d848['attributes']:_0x180f02[_0xc0e7('0x3c')];if(!_0x2416c0[_0xc0e7('0x3e')]['hasOwnProperty'](_0xc0e7('0x42'))){_0x42d848[_0xc0e7('0x43')]=qs[_0xc0e7('0x43')](_0x2416c0[_0xc0e7('0x3e')][_0xc0e7('0x43')]);_0x42d848[_0xc0e7('0x23')]=qs[_0xc0e7('0x23')](_0x2416c0[_0xc0e7('0x3e')]['offset']);}_0x42d848[_0xc0e7('0x44')]=qs[_0xc0e7('0x45')](_0x2416c0[_0xc0e7('0x3e')][_0xc0e7('0x45')]);_0x42d848[_0xc0e7('0x46')]=qs[_0xc0e7('0x47')](_[_0xc0e7('0xbd')](_0x2416c0[_0xc0e7('0x3e')],_0x180f02[_0xc0e7('0x47')]));_0x42d848[_0xc0e7('0x46')][_0xc0e7('0xae')]=_0x1f475d['id'];if(_0x2416c0[_0xc0e7('0x3e')][_0xc0e7('0x84')]){_0x42d848['where']=_[_0xc0e7('0x9c')](_0x42d848[_0xc0e7('0x46')],{'$or':_[_0xc0e7('0x2f')](_0x42d848[_0xc0e7('0x3f')],function(_0x4ebac9){var _0x52d0c7={};_0x52d0c7[_0x4ebac9]={'$like':'%'+_0x2416c0['query'][_0xc0e7('0x84')]+'%'};return _0x52d0c7;})});}if(_0x2416c0['query'][_0xc0e7('0xbe')]){var _0x5276f7=_0x2416c0[_0xc0e7('0x3e')]['$gte'][_0xc0e7('0x33')](',');var _0x2f0845={};_0x2f0845[_0x5276f7[0x0]]={'$gte':moment(_0x5276f7[0x1])[_0xc0e7('0xbf')](_0xc0e7('0xc0'))};_0x42d848['where']=_[_0xc0e7('0x9c')](_0x42d848[_0xc0e7('0x46')],_0x2f0845);}_0x42d848=_['merge']({},_0x42d848,_0x2416c0['options']);return db[_0xc0e7('0xb9')][_0xc0e7('0x22')]({'where':_0x42d848[_0xc0e7('0x46')]})[_0xc0e7('0x29')](function(_0x1e14d0){_0x203bd2[_0xc0e7('0x22')]=_0x1e14d0;if(_0x2416c0[_0xc0e7('0x3e')][_0xc0e7('0xb3')]){_0x42d848[_0xc0e7('0xb4')]=[{'all':!![]}];}return db['FaxMessage'][_0xc0e7('0xc1')](_0x42d848);})['then'](function(_0x38b2b0){_0x203bd2[_0xc0e7('0xc2')]=_0x38b2b0;return _0x203bd2;});}})[_0xc0e7('0x29')](respondWithFilteredResult(_0x5d852b,_0x42d848))['catch'](handleError(_0x5d852b,null));};exports[_0xc0e7('0xc3')]=function(_0x10d1d6,_0x45a80d,_0x494dc5){return db[_0xc0e7('0x38')][_0xc0e7('0x61')]({'where':{'id':_0x10d1d6['params']['id']}})[_0xc0e7('0x29')](handleEntityNotFound(_0x45a80d,null))[_0xc0e7('0x29')](function(_0x243b0b){if(_0x243b0b){return _0x243b0b[_0xc0e7('0xc4')](_0x10d1d6['body'][_0xc0e7('0xba')],_[_0xc0e7('0xc5')](_0x10d1d6[_0xc0e7('0x74')],[_0xc0e7('0xba'),'id'])||{})[_0xc0e7('0xc6')](function(){return db['Tag'][_0xc0e7('0xc1')]({'attributes':['id',_0xc0e7('0x2d'),_0xc0e7('0x49')],'where':{'id':_0x10d1d6[_0xc0e7('0x74')][_0xc0e7('0xba')]}});})['then'](function(_0x4ca8e5){socket[_0xc0e7('0xc7')]('faxInteractionTags:save',{'id':Number(_0x10d1d6[_0xc0e7('0xb1')]['id']),'tags':_0x4ca8e5||[]});return{'id':Number(_0x10d1d6[_0xc0e7('0xb1')]['id']),'tags':_0x4ca8e5||[]};});}})[_0xc0e7('0x29')](respondWithResult(_0x45a80d,null))[_0xc0e7('0x36')](handleError(_0x45a80d,null));};exports['removeTags']=function(_0x1e3819,_0x17ec07,_0x3f3e0a){return db[_0xc0e7('0x38')][_0xc0e7('0x61')]({'where':{'id':_0x1e3819[_0xc0e7('0xb1')]['id']}})[_0xc0e7('0x29')](handleEntityNotFound(_0x17ec07,null))[_0xc0e7('0x29')](function(_0x153470){if(_0x153470){return _0x153470[_0xc0e7('0xc8')](_0x1e3819[_0xc0e7('0x3e')][_0xc0e7('0xba')]);}})['then'](respondWithStatusCode(_0x17ec07,null))[_0xc0e7('0x36')](handleError(_0x17ec07,null));};exports[_0xc0e7('0xc9')]=function(_0x289fd0,_0x2c9a03){var _0x22af6f=moment()[_0xc0e7('0xca')]()[_0xc0e7('0x9a')]();var _0x29c558=path[_0xc0e7('0xcb')](config[_0xc0e7('0xcc')],'server',_0xc0e7('0xcd'),'tmp');var _0x226743=path[_0xc0e7('0xcb')](config[_0xc0e7('0xcc')],'server',_0xc0e7('0xcd'),_0xc0e7('0xce'));var _0x5638f5=path[_0xc0e7('0xcb')](_0x29c558,_0x22af6f);var _0x4f65d5=util['format'](_0xc0e7('0xcf'),_0x289fd0[_0xc0e7('0xb1')]['id'],_0x22af6f);var _0x5df3da=path[_0xc0e7('0xcb')](_0x29c558,_0x4f65d5);var _0x4ea249=[];_0x4ea249[_0xc0e7('0x35')]({'model':db[_0xc0e7('0xd0')],'as':_0xc0e7('0xd0'),'raw':!![]});var _0x21663a=[{'model':db['FaxMessage'],'as':_0xc0e7('0xd1'),'attributes':['id',_0xc0e7('0x74'),_0xc0e7('0x7b')],'include':_0x4ea249}];return db[_0xc0e7('0x38')][_0xc0e7('0x61')]({'where':{'id':_0x289fd0[_0xc0e7('0xb1')]['id']},'include':_0x21663a})[_0xc0e7('0x29')](handleEntityNotFound(_0x2c9a03,null))[_0xc0e7('0x29')](function(_0x55f99f){if(_0x55f99f&&_0x55f99f[_0xc0e7('0xd1')]){var _0x39007=_0x55f99f[_0xc0e7('0xd2')]({'plain':!![]});fs[_0xc0e7('0xd3')](_0x5638f5);for(var _0x420c71=0x0;_0x420c71<_0x39007[_0xc0e7('0xd1')][_0xc0e7('0x60')];_0x420c71++){var _0x54bea9=_0x39007[_0xc0e7('0xd1')][_0x420c71][_0xc0e7('0xd0')];if(_0x54bea9){var _0x5bb0d6=path[_0xc0e7('0xcb')](_0x226743,_0x54bea9['basename']);if(fs['existsSync'](_0x5bb0d6)){fs['createReadStream'](_0x5bb0d6)[_0xc0e7('0xd4')](fs[_0xc0e7('0xd5')](path[_0xc0e7('0xcb')](_0x5638f5,_0x54bea9[_0xc0e7('0xd6')])));}}}return BPromise[_0xc0e7('0x92')]()[_0xc0e7('0x29')](function(){return new BPromise(function(_0x3ce3d4,_0x52b882){zipdir(_0x5638f5,{'saveTo':_0x5df3da},function(_0x35745e,_0x2c13cf){if(_0x35745e)return _0x52b882(_0x35745e);return _0x3ce3d4(_0x2c13cf);});})['then'](function(){return new BPromise(function(_0x397b9a,_0x3e6d8b){rimraf(_0x5638f5,function(_0x415ab6){if(_0x415ab6)_0x3e6d8b(_0x415ab6);return _0x397b9a();});});})[_0xc0e7('0x29')](function(){return _0x2c9a03[_0xc0e7('0xc9')](_0x5df3da,_0x4f65d5,function(_0x360aaa){if(_0x360aaa){console['log'](_0xc0e7('0xd7'),_0x360aaa);}else{fs[_0xc0e7('0xd8')](_0x5df3da);}});});});}else{return _0x2c9a03[_0xc0e7('0x1e')](0xc8);}})['catch'](handleError(_0x2c9a03,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c8e5d97..c9cf0cc 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x140448,_0x586ff9){var _0x43e4b3=function(_0x3c6f89){while(--_0x3c6f89){_0x140448['push'](_0x140448['shift']());}};_0x43e4b3(++_0x586ff9);}(_0x1261,0x144));var _0x1126=function(_0x3db1f7,_0x2beb9b){_0x3db1f7=_0x3db1f7-0x0;var _0x5016ed=_0x1261[_0x3db1f7];return _0x5016ed;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x1bb179,_0x57a128){var _0x464f12=function(_0x56718e){while(--_0x56718e){_0x1bb179['push'](_0x1bb179['shift']());}};_0x464f12(++_0x57a128);}(_0xadb5,0xad));var _0x5adb=function(_0x3e49f6,_0x3895cb){_0x3e49f6=_0x3e49f6-0x0;var _0x36e933=_0xadb5[_0x3e49f6];return _0x36e933;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('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 cb806c3..d7652fb 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 _0x2448=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x34d081,_0x3738db){var _0x6d85a3=function(_0x51d749){while(--_0x51d749){_0x34d081['push'](_0x34d081['shift']());}};_0x6d85a3(++_0x3738db);}(_0x2448,0x11e));var _0x8244=function(_0x11c674,_0xe406bf){_0x11c674=_0x11c674-0x0;var _0xd4c16b=_0x2448[_0x11c674];return _0xd4c16b;};'use strict';var _=require(_0x8244('0x0'));var util=require(_0x8244('0x1'));var logger=require(_0x8244('0x2'))(_0x8244('0x3'));var moment=require(_0x8244('0x4'));var BPromise=require('bluebird');var rp=require(_0x8244('0x5'));var fs=require('fs');var path=require(_0x8244('0x6'));var rimraf=require(_0x8244('0x7'));var config=require(_0x8244('0x8'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0xdc9669,_0x3d9561){return _0xdc9669[_0x8244('0x9')](_0x8244('0xa'),attributes,{'tableName':_0x8244('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28a9fe,_0x5b5d98,_0x56e2b0){if(_0x28a9fe[_0x8244('0xc')]('closed')){_0x28a9fe[_0x8244('0xd')]=moment()[_0x8244('0xe')](_0x8244('0xf'));}_0x56e2b0(null,_0x28a9fe);}}});}; \ No newline at end of file +var _0xb48c=['bluebird','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x588660,_0x8eb601){var _0x362a9f=function(_0x5f22f6){while(--_0x5f22f6){_0x588660['push'](_0x588660['shift']());}};_0x362a9f(++_0x8eb601);}(_0xb48c,0x1db));var _0xcb48=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb48c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var logger=require(_0xcb48('0x2'))(_0xcb48('0x3'));var moment=require(_0xcb48('0x4'));var BPromise=require(_0xcb48('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb48('0x6'));var rimraf=require(_0xcb48('0x7'));var config=require('../../config/environment');var attributes=require(_0xcb48('0x8'));module[_0xcb48('0x9')]=function(_0x3aad2c,_0x47ee6f){return _0x3aad2c[_0xcb48('0xa')](_0xcb48('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfabd45,_0x4bb93e,_0x5f335c){if(_0xfabd45[_0xcb48('0xc')](_0xcb48('0xd'))){_0xfabd45[_0xcb48('0xe')]=moment()[_0xcb48('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5f335c(null,_0xfabd45);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f0f34d1..84731a3 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 _0x10ef=['socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','where','attributes','UpdateFaxInteraction','debug','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x10ef,0xbc));var _0xf10e=function(_0x34227a,_0x4388c9){_0x34227a=_0x34227a-0x0;var _0x1df602=_0x10ef[_0x34227a];return _0x1df602;};'use strict';var _=require(_0xf10e('0x0'));var util=require(_0xf10e('0x1'));var moment=require(_0xf10e('0x2'));var BPromise=require(_0xf10e('0x3'));var rs=require(_0xf10e('0x4'));var fs=require('fs');var Redis=require(_0xf10e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf10e('0x6'));var logger=require(_0xf10e('0x7'))(_0xf10e('0x8'));var config=require(_0xf10e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xf10e('0xa')]=_[_0xf10e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf10e('0xc'))(new Redis(config['redis']));require(_0xf10e('0xd'))[_0xf10e('0xe')](socket);function respondWithRpcPromise(_0xce3ba0,_0x2f32cc,_0x80b1bd){return new BPromise(function(_0x3da1bb,_0x1e6ac9){return client[_0xf10e('0xf')](_0xce3ba0,_0x80b1bd)[_0xf10e('0x10')](function(_0x3e8272){logger[_0xf10e('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x2f32cc,_0xf10e('0x12'));logger['debug'](_0xf10e('0x13'),_0x2f32cc,_0xf10e('0x12'),JSON[_0xf10e('0x14')](_0x3e8272));if(_0x3e8272[_0xf10e('0x15')]){if(_0x3e8272[_0xf10e('0x15')]['code']===0x1f4){logger[_0xf10e('0x15')](_0xf10e('0x16'),_0x2f32cc,_0x3e8272[_0xf10e('0x15')][_0xf10e('0x17')]);return _0x1e6ac9(_0x3e8272[_0xf10e('0x15')][_0xf10e('0x17')]);}logger[_0xf10e('0x15')](_0xf10e('0x16'),_0x2f32cc,_0x3e8272[_0xf10e('0x15')][_0xf10e('0x17')]);return _0x3da1bb(_0x3e8272[_0xf10e('0x15')][_0xf10e('0x17')]);}else{logger['info'](_0xf10e('0x16'),_0x2f32cc,_0xf10e('0x12'));_0x3da1bb(_0x3e8272[_0xf10e('0x18')][_0xf10e('0x17')]);}})[_0xf10e('0x19')](function(_0x8fd392){logger[_0xf10e('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2f32cc,_0x8fd392);_0x1e6ac9(_0x8fd392);});});}exports['UpdateFaxInteraction']=function(_0x28b71c){var _0x142cb3=this;return new Promise(function(_0x2d8e17,_0x576c21){return db['FaxInteraction'][_0xf10e('0x1a')](_0x28b71c[_0xf10e('0x1b')],{'raw':_0x28b71c[_0xf10e('0x1c')]?_0x28b71c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b71c[_0xf10e('0x1c')]?_0x28b71c[_0xf10e('0x1c')][_0xf10e('0x1d')]||null:null,'attributes':_0x28b71c[_0xf10e('0x1c')]?_0x28b71c['options'][_0xf10e('0x1e')]||null:null,'limit':_0x28b71c[_0xf10e('0x1c')]?_0x28b71c[_0xf10e('0x1c')]['limit']||null:null})[_0xf10e('0x10')](function(_0xa88199){logger[_0xf10e('0x11')](_0xf10e('0x1f'),_0x28b71c);logger[_0xf10e('0x20')](_0xf10e('0x1f'),_0x28b71c,JSON[_0xf10e('0x14')](_0xa88199));_0x2d8e17(_0xa88199);})[_0xf10e('0x19')](function(_0x1f499b){logger[_0xf10e('0x15')](_0xf10e('0x1f'),_0x1f499b['message'],_0x28b71c);_0x576c21(_0x142cb3[_0xf10e('0x15')](0x1f4,_0x1f499b['message']));});});};exports[_0xf10e('0x21')]=function(_0x51a884){return new Promise(function(_0x3a3067,_0x9b230a){return db[_0xf10e('0x22')]['find']({'where':_0x51a884[_0xf10e('0x1c')]?_0x51a884[_0xf10e('0x1c')][_0xf10e('0x1d')]||null:null})[_0xf10e('0x10')](function(_0x27ad9d){if(_0x27ad9d){return _0x27ad9d[_0xf10e('0x23')](_0x51a884['body'][_0xf10e('0x24')],_[_0xf10e('0x25')](_0x51a884[_0xf10e('0x1b')],[_0xf10e('0x24'),'id'])||{});}})[_0xf10e('0x26')](function(_0x180828){logger[_0xf10e('0x11')]('AddTags',_0x51a884);logger[_0xf10e('0x20')](_0xf10e('0x27'),_0x51a884,JSON[_0xf10e('0x14')](_0x180828));_0x3a3067(_0x180828);})[_0xf10e('0x19')](function(_0x5888f4){logger[_0xf10e('0x15')](_0xf10e('0x27'),_0x5888f4[_0xf10e('0x17')],_0x51a884);_0x9b230a(_this[_0xf10e('0x15')](0x1f4,_0x5888f4[_0xf10e('0x17')]));});});}; \ No newline at end of file +var _0x0a94=['options','raw','where','attributes','limit','then','find','addTags','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body'];(function(_0x10ba35,_0x1106a0){var _0x44a0aa=function(_0x430a75){while(--_0x430a75){_0x10ba35['push'](_0x10ba35['shift']());}};_0x44a0aa(++_0x1106a0);}(_0x0a94,0x130));var _0x40a9=function(_0x5b1539,_0x361d2e){_0x5b1539=_0x5b1539-0x0;var _0x2137fe=_0x0a94[_0x5b1539];return _0x2137fe;};'use strict';var _=require(_0x40a9('0x0'));var util=require(_0x40a9('0x1'));var moment=require('moment');var BPromise=require(_0x40a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40a9('0x3'));var db=require(_0x40a9('0x4'))['db'];var utils=require(_0x40a9('0x5'));var logger=require(_0x40a9('0x6'))(_0x40a9('0x7'));var config=require(_0x40a9('0x8'));var jayson=require(_0x40a9('0x9'));var client=jayson[_0x40a9('0xa')][_0x40a9('0xb')]({'port':0x232a});config[_0x40a9('0xc')]=_[_0x40a9('0xd')](config[_0x40a9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x40a9('0xe'))(new Redis(config[_0x40a9('0xc')]));require(_0x40a9('0xf'))[_0x40a9('0x10')](socket);function respondWithRpcPromise(_0x48a95a,_0xae0769,_0x2909cb){return new BPromise(function(_0x7c1c47,_0xf89238){return client['request'](_0x48a95a,_0x2909cb)['then'](function(_0x49f179){logger[_0x40a9('0x11')](_0x40a9('0x12'),_0xae0769,'request\x20sent');logger[_0x40a9('0x13')](_0x40a9('0x14'),_0xae0769,_0x40a9('0x15'),JSON[_0x40a9('0x16')](_0x49f179));if(_0x49f179[_0x40a9('0x17')]){if(_0x49f179[_0x40a9('0x17')][_0x40a9('0x18')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0xae0769,_0x49f179['error']['message']);return _0xf89238(_0x49f179['error'][_0x40a9('0x19')]);}logger[_0x40a9('0x17')](_0x40a9('0x12'),_0xae0769,_0x49f179[_0x40a9('0x17')][_0x40a9('0x19')]);return _0x7c1c47(_0x49f179[_0x40a9('0x17')]['message']);}else{logger[_0x40a9('0x11')](_0x40a9('0x12'),_0xae0769,_0x40a9('0x15'));_0x7c1c47(_0x49f179[_0x40a9('0x1a')]['message']);}})[_0x40a9('0x1b')](function(_0xe0a66a){logger[_0x40a9('0x17')](_0x40a9('0x12'),_0xae0769,_0xe0a66a);_0xf89238(_0xe0a66a);});});}exports[_0x40a9('0x1c')]=function(_0x3531d0){var _0x4d29ba=this;return new Promise(function(_0x18c77d,_0x15a3c8){return db[_0x40a9('0x1d')][_0x40a9('0x1e')](_0x3531d0[_0x40a9('0x1f')],{'raw':_0x3531d0[_0x40a9('0x20')]?_0x3531d0['options'][_0x40a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3531d0['options']?_0x3531d0[_0x40a9('0x20')][_0x40a9('0x22')]||null:null,'attributes':_0x3531d0[_0x40a9('0x20')]?_0x3531d0['options'][_0x40a9('0x23')]||null:null,'limit':_0x3531d0[_0x40a9('0x20')]?_0x3531d0[_0x40a9('0x20')][_0x40a9('0x24')]||null:null})[_0x40a9('0x25')](function(_0x148ad2){logger['info'](_0x40a9('0x1c'),_0x3531d0);logger['debug'](_0x40a9('0x1c'),_0x3531d0,JSON[_0x40a9('0x16')](_0x148ad2));_0x18c77d(_0x148ad2);})[_0x40a9('0x1b')](function(_0x436922){logger['error'](_0x40a9('0x1c'),_0x436922[_0x40a9('0x19')],_0x3531d0);_0x15a3c8(_0x4d29ba[_0x40a9('0x17')](0x1f4,_0x436922[_0x40a9('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4f3e59){return new Promise(function(_0x30f5cd,_0x5fbfe4){return db[_0x40a9('0x1d')][_0x40a9('0x26')]({'where':_0x4f3e59[_0x40a9('0x20')]?_0x4f3e59['options'][_0x40a9('0x22')]||null:null})[_0x40a9('0x25')](function(_0x34407f){if(_0x34407f){return _0x34407f[_0x40a9('0x27')](_0x4f3e59['body'][_0x40a9('0x28')],_['omit'](_0x4f3e59['body'],[_0x40a9('0x28'),'id'])||{});}})['spread'](function(_0x353c81){logger[_0x40a9('0x11')](_0x40a9('0x29'),_0x4f3e59);logger[_0x40a9('0x13')](_0x40a9('0x29'),_0x4f3e59,JSON[_0x40a9('0x16')](_0x353c81));_0x30f5cd(_0x353c81);})[_0x40a9('0x1b')](function(_0x310754){logger[_0x40a9('0x17')]('AddTags',_0x310754[_0x40a9('0x19')],_0x4f3e59);_0x5fbfe4(_this[_0x40a9('0x17')](0x1f4,_0x310754['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e8055eb..6dd9be1 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 _0x05b2=['update','removeListener','length','faxInteraction:','save','remove'];(function(_0x34951e,_0x12f28c){var _0x24745d=function(_0x206131){while(--_0x206131){_0x34951e['push'](_0x34951e['shift']());}};_0x24745d(++_0x12f28c);}(_0x05b2,0xe2));var _0x205b=function(_0x336810,_0x1906fe){_0x336810=_0x336810-0x0;var _0x5d5876=_0x05b2[_0x336810];return _0x5d5876;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x205b('0x0'),_0x205b('0x1'),_0x205b('0x2')];function createListener(_0xc30394,_0x383aa8){return function(_0x764743){_0x383aa8['emit'](_0xc30394,_0x764743);};}function removeListener(_0x3e9afd,_0x398b1a){return function(){FaxInteractionEvents[_0x205b('0x3')](_0x3e9afd,_0x398b1a);};}exports['register']=function(_0x16a1d0){for(var _0x485402=0x0,_0x49b9ee=events[_0x205b('0x4')];_0x485402<_0x49b9ee;_0x485402++){var _0xca43c4=events[_0x485402];var _0x51b755=createListener(_0x205b('0x5')+_0xca43c4,_0x16a1d0);FaxInteractionEvents['on'](_0xca43c4,_0x51b755);}}; \ No newline at end of file +var _0xe226=['emit','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xbed1ab,_0x2c6b39){var _0x3886fa=function(_0xe1b7f2){while(--_0xe1b7f2){_0xbed1ab['push'](_0xbed1ab['shift']());}};_0x3886fa(++_0x2c6b39);}(_0xe226,0x1cb));var _0x6e22=function(_0x48a86f,_0x3669c1){_0x48a86f=_0x48a86f-0x0;var _0x270893=_0xe226[_0x48a86f];return _0x270893;};'use strict';var FaxInteractionEvents=require(_0x6e22('0x0'));var events=[_0x6e22('0x1'),_0x6e22('0x2'),'update'];function createListener(_0x1359bc,_0x5b8674){return function(_0x35a44c){_0x5b8674[_0x6e22('0x3')](_0x1359bc,_0x35a44c);};}function removeListener(_0x4b9aa1,_0x3b0206){return function(){FaxInteractionEvents['removeListener'](_0x4b9aa1,_0x3b0206);};}exports[_0x6e22('0x4')]=function(_0x25193b){for(var _0x1dfb74=0x0,_0xc2e191=events[_0x6e22('0x5')];_0x1dfb74<_0xc2e191;_0x1dfb74++){var _0x531229=events[_0x1dfb74];var _0x375d84=createListener(_0x6e22('0x6')+_0x531229,_0x25193b);FaxInteractionEvents['on'](_0x531229,_0x375d84);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c189fa3..8a14204 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 _0x750a=['addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','update','faxinteraction:destroy','delete','removeTags','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','download','create'];(function(_0x54382e,_0x4c7480){var _0x36562a=function(_0x2336bb){while(--_0x2336bb){_0x54382e['push'](_0x54382e['shift']());}};_0x36562a(++_0x4c7480);}(_0x750a,0x140));var _0xa750=function(_0x5abb72,_0x1543ad){_0x5abb72=_0x5abb72-0x0;var _0x4f38d9=_0x750a[_0x5abb72];return _0x4f38d9;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['get']('/:id',auth[_0xa750('0x8')](),controller['show']);router[_0xa750('0x7')](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xa750('0xe')]);router['post']('/',auth[_0xa750('0x8')](),controller[_0xa750('0xf')]);router['post'](_0xa750('0xc'),auth[_0xa750('0x8')](),controller[_0xa750('0x10')]);router['post'](_0xa750('0x11'),auth[_0xa750('0x8')](),interaction[_0xa750('0x12')](_0xa750('0x13'),_0xa750('0x14')),controller[_0xa750('0x15')]);router['put'](_0xa750('0x16'),auth[_0xa750('0x8')](),interaction[_0xa750('0x12')]('fax',_0xa750('0x17')),controller[_0xa750('0x18')]);router['delete']('/:id',auth[_0xa750('0x8')](),interaction['tracked'](_0xa750('0x13'),_0xa750('0x19')),controller['destroy']);router[_0xa750('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa750('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xf109=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','update','delete','tracked','faxinteraction:destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0xf109,0xce));var _0x9f10=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xf109[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9f10('0x3'));var interaction=require(_0x9f10('0x4'));var config=require(_0x9f10('0x5'));var controller=require(_0x9f10('0x6'));router[_0x9f10('0x7')]('/',auth[_0x9f10('0x8')](),controller[_0x9f10('0x9')]);router[_0x9f10('0x7')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller[_0x9f10('0xb')]);router['get'](_0x9f10('0xc'),auth[_0x9f10('0x8')](),controller[_0x9f10('0xd')]);router[_0x9f10('0x7')](_0x9f10('0xe'),auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x7')](_0x9f10('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x9f10('0x11')]('/',auth[_0x9f10('0x8')](),controller[_0x9f10('0x12')]);router['post'](_0x9f10('0xe'),auth[_0x9f10('0x8')](),controller[_0x9f10('0x13')]);router['post'](_0x9f10('0x14'),auth[_0x9f10('0x8')](),interaction['tracked'](_0x9f10('0x15'),_0x9f10('0x16')),controller['addTags']);router['put'](_0x9f10('0xc'),auth[_0x9f10('0x8')](),interaction['tracked'](_0x9f10('0x15'),'faxinteraction:update'),controller[_0x9f10('0x17')]);router[_0x9f10('0x18')]('/:id',auth[_0x9f10('0x8')](),interaction[_0x9f10('0x19')]('fax',_0x9f10('0x1a')),controller['destroy']);router[_0x9f10('0x18')]('/:id/tags',auth[_0x9f10('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0a84894..5a83de1 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 _0x00e1=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x4e47be,_0x341325){var _0x2ee5d9=function(_0x406f09){while(--_0x406f09){_0x4e47be['push'](_0x4e47be['shift']());}};_0x2ee5d9(++_0x341325);}(_0x00e1,0x1a8));var _0x100e=function(_0x109225,_0x1bde22){_0x109225=_0x109225-0x0;var _0x371da9=_0x00e1[_0x109225];return _0x371da9;};'use strict';var Sequelize=require(_0x100e('0x0'));module[_0x100e('0x1')]={'body':{'type':Sequelize[_0x100e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x100e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x100e('0x4')]('in',_0x100e('0x5')),'defaultValue':_0x100e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x100e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7201=['medium','BOOLEAN','out','DATE','TEXT'];(function(_0x9a29ea,_0x5b8b29){var _0x11f261=function(_0x397dea){while(--_0x397dea){_0x9a29ea['push'](_0x9a29ea['shift']());}};_0x11f261(++_0x5b8b29);}(_0x7201,0x103));var _0x1720=function(_0x5691c7,_0x1708f0){_0x5691c7=_0x5691c7-0x0;var _0x3e3aa7=_0x7201[_0x5691c7];return _0x3e3aa7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x1720('0x0')](_0x1720('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1720('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1720('0x3')),'defaultValue':_0x1720('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1720('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1720('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8152b36..e0c480f 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 _0x5eb8=['FaxMessage','findAll','rows','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','isNil','read1stAt','role','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','FaxInteraction','FaxInteractionId','rejectMessage','create','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','server','files','attachments','download','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','intersection','attributes','order','sort','where','pick','merge','type','filter','options','includeAll','include'];(function(_0x144e54,_0x484288){var _0x22c213=function(_0xf1af53){while(--_0xf1af53){_0x144e54['push'](_0x144e54['shift']());}};_0x22c213(++_0x484288);}(_0x5eb8,0xb0));var _0x85eb=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x5eb8[_0x38b2d9];return _0x23a3e1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85eb('0x0'));var zipdir=require(_0x85eb('0x1'));var jsonpatch=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var moment=require(_0x85eb('0x4'));var BPromise=require(_0x85eb('0x5'));var Mustache=require(_0x85eb('0x6'));var util=require(_0x85eb('0x7'));var path=require(_0x85eb('0x8'));var sox=require(_0x85eb('0x9'));var csv=require(_0x85eb('0xa'));var ejs=require(_0x85eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0xa'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];config[_0x85eb('0x19')]=_[_0x85eb('0x1a')](config[_0x85eb('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0x19')]));require('./faxMessage.socket')[_0x85eb('0x1b')](socket);var jayson=require(_0x85eb('0x1c'));var client=jayson[_0x85eb('0x1d')][_0x85eb('0x1e')]({'port':0x232c});var client9002=jayson[_0x85eb('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e5c0a,_0x59237b,_0x17140b,_0x10c2c9){return new BPromise(function(_0x3e23e8,_0x5deab1){var _0x5dbeda=_0x10c2c9||client;return _0x5dbeda['request'](_0x2e5c0a,_0x17140b)['then'](function(_0xe198ca){logger[_0x85eb('0x1f')](_0x85eb('0x20'),_0x59237b,_0x85eb('0x21'));logger[_0x85eb('0x22')](_0x85eb('0x23'),_0x59237b,'request\x20sent',JSON[_0x85eb('0x24')](_0xe198ca));if(_0xe198ca[_0x85eb('0x25')]){if(_0xe198ca[_0x85eb('0x25')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x59237b,_0xe198ca['error'][_0x85eb('0x26')]);return _0x5deab1(_0xe198ca[_0x85eb('0x25')][_0x85eb('0x26')]);}logger[_0x85eb('0x25')](_0x85eb('0x20'),_0x59237b,_0xe198ca[_0x85eb('0x25')]['message']);return _0x3e23e8(_0xe198ca['error']['message']);}else{logger[_0x85eb('0x1f')](_0x85eb('0x20'),_0x59237b,_0x85eb('0x21'));_0x3e23e8(_0xe198ca[_0x85eb('0x27')][_0x85eb('0x26')]);}})[_0x85eb('0x28')](function(_0x5dfc96){logger[_0x85eb('0x25')](_0x85eb('0x20'),_0x59237b,_0x5dfc96);_0x5deab1(_0x5dfc96);});});}function respondWithStatusCode(_0x4709ad,_0x30e766){_0x30e766=_0x30e766||0xcc;return function(_0x3e2326){if(_0x3e2326){return _0x4709ad['sendStatus'](_0x30e766);}return _0x4709ad[_0x85eb('0x29')](_0x30e766)[_0x85eb('0x2a')]();};}function respondWithResult(_0x291557,_0x3e7eb9){_0x3e7eb9=_0x3e7eb9||0xc8;return function(_0x40f13e){if(_0x40f13e){return _0x291557[_0x85eb('0x29')](_0x3e7eb9)['json'](_0x40f13e);}};}function respondWithFilteredResult(_0x562792,_0x37515c){return function(_0x585f2a){if(_0x585f2a){var _0xa9b14f=_0x585f2a[_0x85eb('0x2b')],_0x5255eb=_0x37515c[_0x85eb('0x2c')],_0x4229e9=_0x37515c[_0x85eb('0x2c')]+_0x37515c[_0x85eb('0x2d')],_0x3570f7;if(_0x4229e9>=_0xa9b14f){_0x4229e9=_0xa9b14f;_0x3570f7=0xc8;}else{_0x3570f7=0xce;}_0x562792[_0x85eb('0x29')](_0x3570f7);return _0x562792['set'](_0x85eb('0x2e'),_0x5255eb+'-'+_0x4229e9+'/'+_0xa9b14f)[_0x85eb('0x2f')](_0x585f2a);}return null;};}function patchUpdates(_0x515ee9){return function(_0x197898){try{jsonpatch['apply'](_0x197898,_0x515ee9,!![]);}catch(_0x5439aa){return BPromise[_0x85eb('0x30')](_0x5439aa);}return _0x197898[_0x85eb('0x31')]();};}function saveUpdates(_0x3e6f34,_0x246dda){return function(_0x33c05f){if(_0x33c05f){return _0x33c05f[_0x85eb('0x32')](_0x3e6f34)[_0x85eb('0x33')](function(_0x3858e6){return _0x3858e6;});}return null;};}function removeEntity(_0xa3fe68,_0x1008bf){return function(_0x4cbee0){if(_0x4cbee0){return _0x4cbee0[_0x85eb('0x34')]()[_0x85eb('0x33')](function(){_0xa3fe68['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x340745,_0x13f245){return function(_0x38b96e){if(!_0x38b96e){_0x340745[_0x85eb('0x35')](0x194);}return _0x38b96e;};}function handleError(_0x2125c8,_0x3c2686){_0x3c2686=_0x3c2686||0x1f4;return function(_0xf4d0e4){logger[_0x85eb('0x25')](_0xf4d0e4[_0x85eb('0x36')]);if(_0xf4d0e4[_0x85eb('0x37')]){delete _0xf4d0e4[_0x85eb('0x37')];}_0x2125c8[_0x85eb('0x29')](_0x3c2686)[_0x85eb('0x38')](_0xf4d0e4);};}exports[_0x85eb('0x39')]=function(_0x4b69a7,_0x4361e2){var _0x3dfe74={},_0x58f091={},_0x5b77e5={'count':0x0,'rows':[]};var _0x2b3747=_[_0x85eb('0x3a')](db['FaxMessage'][_0x85eb('0x3b')],function(_0x50c7f9){return{'name':_0x50c7f9[_0x85eb('0x3c')],'type':_0x50c7f9['type'][_0x85eb('0x3d')]};});_0x58f091['model']=_[_0x85eb('0x3a')](_0x2b3747,'name');_0x58f091[_0x85eb('0x3e')]=_[_0x85eb('0x3f')](_0x4b69a7['query']);_0x58f091[_0x85eb('0x40')]=_['intersection'](_0x58f091[_0x85eb('0x41')],_0x58f091[_0x85eb('0x3e')]);_0x3dfe74['attributes']=_[_0x85eb('0x42')](_0x58f091['model'],qs['fields'](_0x4b69a7[_0x85eb('0x3e')]['fields']));_0x3dfe74[_0x85eb('0x43')]=_0x3dfe74[_0x85eb('0x43')]['length']?_0x3dfe74['attributes']:_0x58f091[_0x85eb('0x41')];if(!_0x4b69a7[_0x85eb('0x3e')]['hasOwnProperty']('nolimit')){_0x3dfe74[_0x85eb('0x2d')]=qs[_0x85eb('0x2d')](_0x4b69a7[_0x85eb('0x3e')][_0x85eb('0x2d')]);_0x3dfe74[_0x85eb('0x2c')]=qs['offset'](_0x4b69a7[_0x85eb('0x3e')][_0x85eb('0x2c')]);}_0x3dfe74[_0x85eb('0x44')]=qs[_0x85eb('0x45')](_0x4b69a7[_0x85eb('0x3e')][_0x85eb('0x45')]);_0x3dfe74[_0x85eb('0x46')]=qs[_0x85eb('0x40')](_[_0x85eb('0x47')](_0x4b69a7['query'],_0x58f091[_0x85eb('0x40')]),_0x2b3747);if(_0x4b69a7[_0x85eb('0x3e')]['filter']){_0x3dfe74[_0x85eb('0x46')]=_[_0x85eb('0x48')](_0x3dfe74[_0x85eb('0x46')],{'$or':_[_0x85eb('0x3a')](_0x2b3747,function(_0x1b1559){if(_0x1b1559[_0x85eb('0x49')]!=='VIRTUAL'){var _0x246f3a={};_0x246f3a[_0x1b1559[_0x85eb('0x37')]]={'$like':'%'+_0x4b69a7[_0x85eb('0x3e')][_0x85eb('0x4a')]+'%'};return _0x246f3a;}})});}_0x3dfe74=_[_0x85eb('0x48')]({},_0x3dfe74,_0x4b69a7[_0x85eb('0x4b')]);var _0xe6b7f3={'where':_0x3dfe74[_0x85eb('0x46')]};return db['FaxMessage'][_0x85eb('0x2b')](_0xe6b7f3)[_0x85eb('0x33')](function(_0x1b3cfa){_0x5b77e5[_0x85eb('0x2b')]=_0x1b3cfa;if(_0x4b69a7[_0x85eb('0x3e')][_0x85eb('0x4c')]){_0x3dfe74[_0x85eb('0x4d')]=[{'all':!![]}];}return db[_0x85eb('0x4e')][_0x85eb('0x4f')](_0x3dfe74);})[_0x85eb('0x33')](function(_0x32b20f){_0x5b77e5[_0x85eb('0x50')]=_0x32b20f;return _0x5b77e5;})['then'](respondWithFilteredResult(_0x4361e2,_0x3dfe74))[_0x85eb('0x28')](handleError(_0x4361e2,null));};exports[_0x85eb('0x51')]=function(_0x22d9d6,_0x4e60dc){var _0xb3b646={'raw':!![],'where':{'id':_0x22d9d6[_0x85eb('0x52')]['id']}},_0x30f921={};_0x30f921[_0x85eb('0x41')]=_[_0x85eb('0x3f')](db['FaxMessage'][_0x85eb('0x3b')]);_0x30f921[_0x85eb('0x3e')]=_[_0x85eb('0x3f')](_0x22d9d6['query']);_0x30f921[_0x85eb('0x40')]=_[_0x85eb('0x42')](_0x30f921[_0x85eb('0x41')],_0x30f921['query']);_0xb3b646['attributes']=_[_0x85eb('0x42')](_0x30f921['model'],qs['fields'](_0x22d9d6[_0x85eb('0x3e')]['fields']));_0xb3b646[_0x85eb('0x43')]=_0xb3b646[_0x85eb('0x43')]['length']?_0xb3b646['attributes']:_0x30f921[_0x85eb('0x41')];if(_0x22d9d6[_0x85eb('0x3e')][_0x85eb('0x4c')]){_0xb3b646[_0x85eb('0x4d')]=[{'all':!![]}];}_0xb3b646=_[_0x85eb('0x48')]({},_0xb3b646,_0x22d9d6['options']);return db[_0x85eb('0x4e')][_0x85eb('0x53')](_0xb3b646)[_0x85eb('0x33')](handleEntityNotFound(_0x4e60dc,null))[_0x85eb('0x33')](respondWithResult(_0x4e60dc,null))[_0x85eb('0x28')](handleError(_0x4e60dc,null));};exports['update']=function(_0x140919,_0x5cd2d3){if(_0x140919[_0x85eb('0x54')]['id']){delete _0x140919[_0x85eb('0x54')]['id'];}return db['FaxMessage'][_0x85eb('0x53')]({'where':{'id':_0x140919[_0x85eb('0x52')]['id']}})[_0x85eb('0x33')](handleEntityNotFound(_0x5cd2d3,null))[_0x85eb('0x33')](saveUpdates(_0x140919[_0x85eb('0x54')],null))[_0x85eb('0x33')](respondWithResult(_0x5cd2d3,null))['catch'](handleError(_0x5cd2d3,null));};exports[_0x85eb('0x34')]=function(_0x51368c,_0x311857){return db[_0x85eb('0x4e')]['find']({'where':{'id':_0x51368c[_0x85eb('0x52')]['id']}})[_0x85eb('0x33')](handleEntityNotFound(_0x311857,null))['then'](removeEntity(_0x311857,null))[_0x85eb('0x28')](handleError(_0x311857,null));};exports['describe']=function(_0x452e7e,_0x3f6985){return db[_0x85eb('0x4e')][_0x85eb('0x55')]()[_0x85eb('0x33')](respondWithResult(_0x3f6985,null))[_0x85eb('0x28')](handleError(_0x3f6985,null));};var interaction_log=require('../../config/logger')(_0x85eb('0x56'));exports[_0x85eb('0x57')]=function(_0x1d3204,_0x2b46a0,_0x18f739){var _0x1529dd={'agent':{},'channel':_0x85eb('0x58')};if(_0x1d3204[_0x85eb('0x54')]['id']){delete _0x1d3204[_0x85eb('0x54')]['id'];}_0x1d3204[_0x85eb('0x54')][_0x85eb('0x59')]=!![];_0x1d3204['body'][_0x85eb('0x5a')]=moment()[_0x85eb('0x5b')](_0x85eb('0x5c'));_0x1d3204[_0x85eb('0x54')][_0x85eb('0x5d')]=_0x1d3204[_0x85eb('0x54')]['UserId']||_0x1d3204[_0x85eb('0x5e')]['id'];_0x1529dd['agent']['id']=_0x1d3204[_0x85eb('0x54')][_0x85eb('0x5d')];return db[_0x85eb('0x4e')][_0x85eb('0x53')]({'where':{'id':_0x1d3204[_0x85eb('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x85eb('0x5f')}]})[_0x85eb('0x33')](handleEntityNotFound(_0x2b46a0,null))[_0x85eb('0x33')](saveUpdates(_0x1d3204[_0x85eb('0x54')],null))[_0x85eb('0x33')](function(_0x14cab8){if(_0x14cab8){_0x1529dd[_0x85eb('0x26')]=_0x14cab8[_0x85eb('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x85eb('0x53')]({'where':{'id':_0x14cab8['FaxInteractionId']}});}return null;})[_0x85eb('0x33')](handleEntityNotFound(_0x2b46a0,null))[_0x85eb('0x33')](function(_0x2ac293){if(_0x2ac293){return _0x2ac293[_0x85eb('0x32')]({'UserId':_0x1d3204[_0x85eb('0x54')]['UserId'],'read1stAt':_[_0x85eb('0x61')](_0x2ac293[_0x85eb('0x62')])?moment()[_0x85eb('0x5b')](_0x85eb('0x5c')):undefined});}return null;})[_0x85eb('0x33')](function(_0x419b24){if(_0x419b24){_0x1529dd['interaction']=_0x419b24['get']({'plain':!![]});interaction_log[_0x85eb('0x1f')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d3204[_0x85eb('0x5e')]['id'],_0x1d3204[_0x85eb('0x5e')][_0x85eb('0x37')],_0x1d3204[_0x85eb('0x5e')][_0x85eb('0x63')],_0x1529dd[_0x85eb('0x64')]['id'],_0x1d3204['body']?JSON[_0x85eb('0x24')](_0x1d3204[_0x85eb('0x54')]):_0x85eb('0x65'));return respondWithRpcPromise(_0x85eb('0x66'),'acceptMessage',_0x1529dd);}return null;})[_0x85eb('0x33')](function(_0x32c432){if(_0x32c432){if(_0x1d3204[_0x85eb('0x54')][_0x85eb('0x67')]){_0x1529dd['message'][_0x85eb('0x68')]=util[_0x85eb('0x5b')](_0x85eb('0x69'),_0x1d3204[_0x85eb('0x5e')][_0x85eb('0x37')]);_0x1529dd[_0x85eb('0x26')][_0x85eb('0x6a')]=_0x1529dd[_0x85eb('0x6a')];_0x1529dd[_0x85eb('0x26')][_0x85eb('0x6b')]=_0x85eb('0x57');return respondWithRpcPromise(_0x85eb('0x6c'),_0x85eb('0x6c'),{'event':_0x85eb('0x6d'),'message':_0x1529dd[_0x85eb('0x26')]},client9002)[_0x85eb('0x33')](function(){return _0x1529dd;});}return _0x1529dd;}return null;})[_0x85eb('0x33')](respondWithResult(_0x2b46a0,null))[_0x85eb('0x28')](handleError(_0x2b46a0,null));};var interaction_log=require(_0x85eb('0x15'))('fax-interactions');exports[_0x85eb('0x30')]=function(_0x4dd31e,_0x121a9e,_0x2346b1){var _0x1597c3={'agent':{},'channel':_0x85eb('0x58')};if(_0x4dd31e[_0x85eb('0x54')]['id']){delete _0x4dd31e[_0x85eb('0x54')]['id'];}_0x4dd31e[_0x85eb('0x54')][_0x85eb('0x5d')]=_0x4dd31e[_0x85eb('0x54')]['UserId']||_0x4dd31e[_0x85eb('0x5e')]['id'];_0x1597c3[_0x85eb('0x6e')]['id']=_0x4dd31e[_0x85eb('0x54')][_0x85eb('0x5d')];return db[_0x85eb('0x4e')]['find']({'where':{'id':_0x4dd31e[_0x85eb('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x121a9e,null))[_0x85eb('0x33')](function(_0x330c2b){if(_0x330c2b){_0x1597c3[_0x85eb('0x26')]=_0x330c2b['get']({'plain':!![]});return db[_0x85eb('0x6f')][_0x85eb('0x53')]({'where':{'id':_0x330c2b[_0x85eb('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x121a9e,null))['then'](function(_0x45a1ef){if(_0x45a1ef){_0x1597c3[_0x85eb('0x64')]=_0x45a1ef[_0x85eb('0x60')]({'plain':!![]});interaction_log[_0x85eb('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4dd31e[_0x85eb('0x5e')]['id'],_0x4dd31e['user'][_0x85eb('0x37')],_0x4dd31e[_0x85eb('0x5e')][_0x85eb('0x63')],_0x1597c3[_0x85eb('0x64')]['id'],_0x4dd31e[_0x85eb('0x54')]?JSON[_0x85eb('0x24')](_0x4dd31e['body']):_0x85eb('0x65'));return respondWithRpcPromise('RejectMessage',_0x85eb('0x71'),_0x1597c3);}return null;})[_0x85eb('0x33')](function(_0x3f20f2){if(_0x3f20f2){_0x3f20f2[_0x85eb('0x26')][_0x85eb('0x68')]=util[_0x85eb('0x5b')](_0x85eb('0x69'),_0x4dd31e[_0x85eb('0x5e')][_0x85eb('0x37')]);_0x3f20f2['message'][_0x85eb('0x6a')]=_0x1597c3[_0x85eb('0x6a')];_0x3f20f2['message']['event']=_0x85eb('0x30');respondWithRpcPromise('EventManager',_0x85eb('0x6c'),{'event':'rejectmessage','message':_0x3f20f2[_0x85eb('0x26')]},client9002);return _0x1597c3;}return null;})['then'](respondWithResult(_0x121a9e,null))[_0x85eb('0x28')](handleError(_0x121a9e,null));};exports[_0x85eb('0x72')]=function(_0x589baf,_0x1b7eb3){var _0x285642;return db['FaxMessage'][_0x85eb('0x72')](_0x589baf[_0x85eb('0x54')],{})[_0x85eb('0x33')](function(_0x16b378){_0x285642=_0x16b378;return db['CmContact'][_0x85eb('0x73')]({'where':{'id':_0x285642['ContactId']}});})[_0x85eb('0x33')](function(_0xf6a387){if(_[_0x85eb('0x61')](_0xf6a387)){return;}else{_0x285642['fax']=_0xf6a387[_0x85eb('0x58')];return db[_0x85eb('0x74')][_0x85eb('0x73')]({'where':{'id':_0x285642['AttachmentId']}});}})[_0x85eb('0x33')](function(_0x5eb629){return respondWithRpcPromise(_0x85eb('0x75'),_0x85eb('0x75'),{'FaxAccountId':_[_0x85eb('0x61')](_0x589baf['body'])?undefined:_0x589baf['body']['FaxAccountId'],'path':_[_0x85eb('0x61')](_0x5eb629)?undefined:util[_0x85eb('0x5b')](_0x85eb('0x76'),_0x5eb629['basename']),'fax':_[_0x85eb('0x61')](_0x285642[_0x85eb('0x58')])?undefined:_0x285642[_0x85eb('0x58')],'AttachmentId':_0x285642[_0x85eb('0x77')]},client9002);})[_0x85eb('0x33')](respondWithResult(_0x1b7eb3,0xc9))['catch'](handleError(_0x1b7eb3,null));};exports['download']=function(_0x2684c3,_0x3edaba){var _0x5473ec=path[_0x85eb('0x78')](config[_0x85eb('0x79')],_0x85eb('0x7a'),_0x85eb('0x7b'),_0x85eb('0x7c'));return db[_0x85eb('0x4e')][_0x85eb('0x53')]({'where':{'id':_0x2684c3[_0x85eb('0x52')]['id']},'include':[{'model':db[_0x85eb('0x74')],'as':_0x85eb('0x74')}]})[_0x85eb('0x33')](handleEntityNotFound(_0x3edaba,null))[_0x85eb('0x33')](function(_0x1f9782){if(_0x1f9782){return _0x3edaba[_0x85eb('0x7d')](path[_0x85eb('0x78')](_0x5473ec,_0x1f9782['Attachment'][_0x85eb('0x7e')]));}})[_0x85eb('0x28')](handleError(_0x3edaba,null));}; \ No newline at end of file +var _0x2547=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','rawAttributes','includeAll','find','body','describe','fax-interactions','accept','fax','read','format','UserId','user','Contact','get','FaxInteraction','FaxInteractionId','update','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SIP/%s','channel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interface','event','rejectmessage','create','CmContact','findOne','ContactId','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','isNil','download','join','root','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','index','FaxMessage','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2547,0x1cd));var _0x7254=function(_0x11d65d,_0x43e6b9){_0x11d65d=_0x11d65d-0x0;var _0x2f9d04=_0x2547[_0x11d65d];return _0x2f9d04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7254('0x0'));var rimraf=require(_0x7254('0x1'));var zipdir=require(_0x7254('0x2'));var jsonpatch=require(_0x7254('0x3'));var rp=require(_0x7254('0x4'));var moment=require(_0x7254('0x5'));var BPromise=require(_0x7254('0x6'));var Mustache=require(_0x7254('0x7'));var util=require('util');var path=require(_0x7254('0x8'));var sox=require(_0x7254('0x9'));var csv=require(_0x7254('0xa'));var ejs=require(_0x7254('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];config['redis']=_[_0x7254('0x17')](config[_0x7254('0x18')],{'host':_0x7254('0x19'),'port':0x18eb});var socket=require(_0x7254('0x1a'))(new Redis(config[_0x7254('0x18')]));require(_0x7254('0x1b'))[_0x7254('0x1c')](socket);var jayson=require(_0x7254('0x1d'));var client=jayson[_0x7254('0x1e')][_0x7254('0x1f')]({'port':0x232c});var client9002=jayson[_0x7254('0x1e')][_0x7254('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x163c8c,_0x535065,_0x265293,_0x4395fb){return new BPromise(function(_0xf47255,_0x39909d){var _0x3b5f06=_0x4395fb||client;return _0x3b5f06[_0x7254('0x20')](_0x163c8c,_0x265293)[_0x7254('0x21')](function(_0x5dd23b){logger[_0x7254('0x22')](_0x7254('0x23'),_0x535065,_0x7254('0x24'));logger[_0x7254('0x25')](_0x7254('0x26'),_0x535065,_0x7254('0x24'),JSON[_0x7254('0x27')](_0x5dd23b));if(_0x5dd23b[_0x7254('0x28')]){if(_0x5dd23b[_0x7254('0x28')][_0x7254('0x29')]===0x1f4){logger[_0x7254('0x28')](_0x7254('0x23'),_0x535065,_0x5dd23b[_0x7254('0x28')][_0x7254('0x2a')]);return _0x39909d(_0x5dd23b[_0x7254('0x28')][_0x7254('0x2a')]);}logger[_0x7254('0x28')](_0x7254('0x23'),_0x535065,_0x5dd23b[_0x7254('0x28')][_0x7254('0x2a')]);return _0xf47255(_0x5dd23b[_0x7254('0x28')]['message']);}else{logger['info'](_0x7254('0x23'),_0x535065,_0x7254('0x24'));_0xf47255(_0x5dd23b[_0x7254('0x2b')][_0x7254('0x2a')]);}})[_0x7254('0x2c')](function(_0x36b5d5){logger[_0x7254('0x28')]('FaxMessage,\x20%s,\x20%s',_0x535065,_0x36b5d5);_0x39909d(_0x36b5d5);});});}function respondWithStatusCode(_0x133287,_0x21a579){_0x21a579=_0x21a579||0xcc;return function(_0x2b4f46){if(_0x2b4f46){return _0x133287['sendStatus'](_0x21a579);}return _0x133287[_0x7254('0x2d')](_0x21a579)['end']();};}function respondWithResult(_0x1bb6a7,_0x134a9e){_0x134a9e=_0x134a9e||0xc8;return function(_0x5702fe){if(_0x5702fe){return _0x1bb6a7[_0x7254('0x2d')](_0x134a9e)[_0x7254('0x2e')](_0x5702fe);}};}function respondWithFilteredResult(_0x4f684c,_0x14cbea){return function(_0x6c4927){if(_0x6c4927){var _0x37cb5c=_0x6c4927['count'],_0xb9198b=_0x14cbea[_0x7254('0x2f')],_0x43bf02=_0x14cbea[_0x7254('0x2f')]+_0x14cbea['limit'],_0xfe02ea;if(_0x43bf02>=_0x37cb5c){_0x43bf02=_0x37cb5c;_0xfe02ea=0xc8;}else{_0xfe02ea=0xce;}_0x4f684c[_0x7254('0x2d')](_0xfe02ea);return _0x4f684c[_0x7254('0x30')](_0x7254('0x31'),_0xb9198b+'-'+_0x43bf02+'/'+_0x37cb5c)['json'](_0x6c4927);}return null;};}function patchUpdates(_0x3261fb){return function(_0xd1b95d){try{jsonpatch[_0x7254('0x32')](_0xd1b95d,_0x3261fb,!![]);}catch(_0x173b6b){return BPromise[_0x7254('0x33')](_0x173b6b);}return _0xd1b95d[_0x7254('0x34')]();};}function saveUpdates(_0x43cd7a,_0x560706){return function(_0x276db8){if(_0x276db8){return _0x276db8['update'](_0x43cd7a)['then'](function(_0x31471a){return _0x31471a;});}return null;};}function removeEntity(_0x346576,_0x272386){return function(_0xa433e3){if(_0xa433e3){return _0xa433e3[_0x7254('0x35')]()[_0x7254('0x21')](function(){_0x346576[_0x7254('0x2d')](0xcc)[_0x7254('0x36')]();});}};}function handleEntityNotFound(_0x447515,_0x24b629){return function(_0x235822){if(!_0x235822){_0x447515[_0x7254('0x37')](0x194);}return _0x235822;};}function handleError(_0x462ab0,_0x46cecb){_0x46cecb=_0x46cecb||0x1f4;return function(_0x57a7d4){logger[_0x7254('0x28')](_0x57a7d4[_0x7254('0x38')]);if(_0x57a7d4[_0x7254('0x39')]){delete _0x57a7d4[_0x7254('0x39')];}_0x462ab0[_0x7254('0x2d')](_0x46cecb)['send'](_0x57a7d4);};}exports[_0x7254('0x3a')]=function(_0x5e36b0,_0x64067b){var _0xb7716a={},_0x3bb517={},_0x238aa6={'count':0x0,'rows':[]};var _0x5726fc=_['map'](db[_0x7254('0x3b')]['rawAttributes'],function(_0x1c03c5){return{'name':_0x1c03c5[_0x7254('0x3c')],'type':_0x1c03c5['type'][_0x7254('0x3d')]};});_0x3bb517[_0x7254('0x3e')]=_[_0x7254('0x3f')](_0x5726fc,_0x7254('0x39'));_0x3bb517[_0x7254('0x40')]=_[_0x7254('0x41')](_0x5e36b0['query']);_0x3bb517[_0x7254('0x42')]=_[_0x7254('0x43')](_0x3bb517[_0x7254('0x3e')],_0x3bb517['query']);_0xb7716a[_0x7254('0x44')]=_[_0x7254('0x43')](_0x3bb517[_0x7254('0x3e')],qs['fields'](_0x5e36b0[_0x7254('0x40')][_0x7254('0x45')]));_0xb7716a[_0x7254('0x44')]=_0xb7716a[_0x7254('0x44')][_0x7254('0x46')]?_0xb7716a['attributes']:_0x3bb517['model'];if(!_0x5e36b0[_0x7254('0x40')][_0x7254('0x47')](_0x7254('0x48'))){_0xb7716a[_0x7254('0x49')]=qs['limit'](_0x5e36b0['query'][_0x7254('0x49')]);_0xb7716a['offset']=qs[_0x7254('0x2f')](_0x5e36b0[_0x7254('0x40')][_0x7254('0x2f')]);}_0xb7716a[_0x7254('0x4a')]=qs['sort'](_0x5e36b0['query'][_0x7254('0x4b')]);_0xb7716a[_0x7254('0x4c')]=qs[_0x7254('0x42')](_[_0x7254('0x4d')](_0x5e36b0[_0x7254('0x40')],_0x3bb517['filters']),_0x5726fc);if(_0x5e36b0['query'][_0x7254('0x4e')]){_0xb7716a[_0x7254('0x4c')]=_[_0x7254('0x4f')](_0xb7716a['where'],{'$or':_[_0x7254('0x3f')](_0x5726fc,function(_0x33604e){if(_0x33604e['type']!==_0x7254('0x50')){var _0x36e987={};_0x36e987[_0x33604e[_0x7254('0x39')]]={'$like':'%'+_0x5e36b0[_0x7254('0x40')]['filter']+'%'};return _0x36e987;}})});}_0xb7716a=_[_0x7254('0x4f')]({},_0xb7716a,_0x5e36b0[_0x7254('0x51')]);var _0x5b7332={'where':_0xb7716a[_0x7254('0x4c')]};return db[_0x7254('0x3b')][_0x7254('0x52')](_0x5b7332)['then'](function(_0x251192){_0x238aa6[_0x7254('0x52')]=_0x251192;if(_0x5e36b0['query']['includeAll']){_0xb7716a[_0x7254('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0x7254('0x54')](_0xb7716a);})[_0x7254('0x21')](function(_0x5c4d0b){_0x238aa6['rows']=_0x5c4d0b;return _0x238aa6;})[_0x7254('0x21')](respondWithFilteredResult(_0x64067b,_0xb7716a))[_0x7254('0x2c')](handleError(_0x64067b,null));};exports[_0x7254('0x55')]=function(_0x104d98,_0x200e5c){var _0x1f58e1={'raw':!![],'where':{'id':_0x104d98[_0x7254('0x56')]['id']}},_0x4fe2ae={};_0x4fe2ae['model']=_[_0x7254('0x41')](db[_0x7254('0x3b')][_0x7254('0x57')]);_0x4fe2ae['query']=_[_0x7254('0x41')](_0x104d98[_0x7254('0x40')]);_0x4fe2ae[_0x7254('0x42')]=_['intersection'](_0x4fe2ae[_0x7254('0x3e')],_0x4fe2ae[_0x7254('0x40')]);_0x1f58e1[_0x7254('0x44')]=_[_0x7254('0x43')](_0x4fe2ae[_0x7254('0x3e')],qs['fields'](_0x104d98['query'][_0x7254('0x45')]));_0x1f58e1[_0x7254('0x44')]=_0x1f58e1[_0x7254('0x44')][_0x7254('0x46')]?_0x1f58e1[_0x7254('0x44')]:_0x4fe2ae['model'];if(_0x104d98['query'][_0x7254('0x58')]){_0x1f58e1[_0x7254('0x53')]=[{'all':!![]}];}_0x1f58e1=_[_0x7254('0x4f')]({},_0x1f58e1,_0x104d98[_0x7254('0x51')]);return db['FaxMessage'][_0x7254('0x59')](_0x1f58e1)[_0x7254('0x21')](handleEntityNotFound(_0x200e5c,null))['then'](respondWithResult(_0x200e5c,null))[_0x7254('0x2c')](handleError(_0x200e5c,null));};exports['update']=function(_0x3fba1a,_0x5a24f4){if(_0x3fba1a[_0x7254('0x5a')]['id']){delete _0x3fba1a['body']['id'];}return db['FaxMessage'][_0x7254('0x59')]({'where':{'id':_0x3fba1a[_0x7254('0x56')]['id']}})[_0x7254('0x21')](handleEntityNotFound(_0x5a24f4,null))[_0x7254('0x21')](saveUpdates(_0x3fba1a['body'],null))[_0x7254('0x21')](respondWithResult(_0x5a24f4,null))['catch'](handleError(_0x5a24f4,null));};exports[_0x7254('0x35')]=function(_0x7e26af,_0x3145c2){return db[_0x7254('0x3b')][_0x7254('0x59')]({'where':{'id':_0x7e26af[_0x7254('0x56')]['id']}})['then'](handleEntityNotFound(_0x3145c2,null))[_0x7254('0x21')](removeEntity(_0x3145c2,null))[_0x7254('0x2c')](handleError(_0x3145c2,null));};exports[_0x7254('0x5b')]=function(_0x24a6a5,_0x281436){return db[_0x7254('0x3b')]['describe']()[_0x7254('0x21')](respondWithResult(_0x281436,null))[_0x7254('0x2c')](handleError(_0x281436,null));};var interaction_log=require(_0x7254('0x13'))(_0x7254('0x5c'));exports[_0x7254('0x5d')]=function(_0x2396ce,_0xf70c29,_0x4e5857){var _0x5dd108={'agent':{},'channel':_0x7254('0x5e')};if(_0x2396ce['body']['id']){delete _0x2396ce['body']['id'];}_0x2396ce[_0x7254('0x5a')][_0x7254('0x5f')]=!![];_0x2396ce[_0x7254('0x5a')]['readAt']=moment()[_0x7254('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x2396ce[_0x7254('0x5a')][_0x7254('0x61')]=_0x2396ce[_0x7254('0x5a')][_0x7254('0x61')]||_0x2396ce[_0x7254('0x62')]['id'];_0x5dd108['agent']['id']=_0x2396ce[_0x7254('0x5a')][_0x7254('0x61')];return db[_0x7254('0x3b')][_0x7254('0x59')]({'where':{'id':_0x2396ce['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7254('0x63')}]})[_0x7254('0x21')](handleEntityNotFound(_0xf70c29,null))[_0x7254('0x21')](saveUpdates(_0x2396ce[_0x7254('0x5a')],null))[_0x7254('0x21')](function(_0x1cf028){if(_0x1cf028){_0x5dd108[_0x7254('0x2a')]=_0x1cf028[_0x7254('0x64')]({'plain':!![]});return db[_0x7254('0x65')][_0x7254('0x59')]({'where':{'id':_0x1cf028[_0x7254('0x66')]}});}return null;})[_0x7254('0x21')](handleEntityNotFound(_0xf70c29,null))[_0x7254('0x21')](function(_0x5647dd){if(_0x5647dd){return _0x5647dd[_0x7254('0x67')]({'UserId':_0x2396ce[_0x7254('0x5a')][_0x7254('0x61')],'read1stAt':_['isNil'](_0x5647dd[_0x7254('0x68')])?moment()[_0x7254('0x60')](_0x7254('0x69')):undefined});}return null;})[_0x7254('0x21')](function(_0x49f62d){if(_0x49f62d){_0x5dd108[_0x7254('0x6a')]=_0x49f62d['get']({'plain':!![]});interaction_log[_0x7254('0x22')](_0x7254('0x6b'),_0x2396ce[_0x7254('0x62')]['id'],_0x2396ce[_0x7254('0x62')]['name'],_0x2396ce[_0x7254('0x62')]['role'],_0x5dd108[_0x7254('0x6a')]['id'],_0x2396ce['body']?JSON[_0x7254('0x27')](_0x2396ce[_0x7254('0x5a')]):_0x7254('0x6c'));return respondWithRpcPromise(_0x7254('0x6d'),_0x7254('0x6e'),_0x5dd108);}return null;})[_0x7254('0x21')](function(_0x45c21c){if(_0x45c21c){if(_0x2396ce[_0x7254('0x5a')]['manual']){_0x5dd108[_0x7254('0x2a')]['interface']=util[_0x7254('0x60')](_0x7254('0x6f'),_0x2396ce[_0x7254('0x62')][_0x7254('0x39')]);_0x5dd108[_0x7254('0x2a')][_0x7254('0x70')]=_0x5dd108[_0x7254('0x70')];_0x5dd108[_0x7254('0x2a')]['event']=_0x7254('0x5d');return respondWithRpcPromise('EventManager',_0x7254('0x71'),{'event':_0x7254('0x72'),'message':_0x5dd108[_0x7254('0x2a')]},client9002)[_0x7254('0x21')](function(){return _0x5dd108;});}return _0x5dd108;}return null;})[_0x7254('0x21')](respondWithResult(_0xf70c29,null))[_0x7254('0x2c')](handleError(_0xf70c29,null));};var interaction_log=require(_0x7254('0x13'))(_0x7254('0x5c'));exports[_0x7254('0x33')]=function(_0x1df8e2,_0x240d19,_0x62419c){var _0x3f7be7={'agent':{},'channel':_0x7254('0x5e')};if(_0x1df8e2[_0x7254('0x5a')]['id']){delete _0x1df8e2[_0x7254('0x5a')]['id'];}_0x1df8e2[_0x7254('0x5a')]['UserId']=_0x1df8e2['body'][_0x7254('0x61')]||_0x1df8e2[_0x7254('0x62')]['id'];_0x3f7be7['agent']['id']=_0x1df8e2['body']['UserId'];return db[_0x7254('0x3b')][_0x7254('0x59')]({'where':{'id':_0x1df8e2[_0x7254('0x56')]['id'],'UserId':null}})[_0x7254('0x21')](handleEntityNotFound(_0x240d19,null))['then'](function(_0x2f8e8e){if(_0x2f8e8e){_0x3f7be7[_0x7254('0x2a')]=_0x2f8e8e['get']({'plain':!![]});return db[_0x7254('0x65')][_0x7254('0x59')]({'where':{'id':_0x2f8e8e[_0x7254('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x240d19,null))['then'](function(_0x220066){if(_0x220066){_0x3f7be7[_0x7254('0x6a')]=_0x220066['get']({'plain':!![]});interaction_log[_0x7254('0x22')](_0x7254('0x73'),_0x1df8e2[_0x7254('0x62')]['id'],_0x1df8e2[_0x7254('0x62')][_0x7254('0x39')],_0x1df8e2['user'][_0x7254('0x74')],_0x3f7be7[_0x7254('0x6a')]['id'],_0x1df8e2[_0x7254('0x5a')]?JSON['stringify'](_0x1df8e2[_0x7254('0x5a')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3f7be7);}return null;})[_0x7254('0x21')](function(_0x5a8afd){if(_0x5a8afd){_0x5a8afd['message'][_0x7254('0x75')]=util[_0x7254('0x60')](_0x7254('0x6f'),_0x1df8e2['user'][_0x7254('0x39')]);_0x5a8afd['message'][_0x7254('0x70')]=_0x3f7be7[_0x7254('0x70')];_0x5a8afd['message'][_0x7254('0x76')]=_0x7254('0x33');respondWithRpcPromise(_0x7254('0x71'),_0x7254('0x71'),{'event':_0x7254('0x77'),'message':_0x5a8afd[_0x7254('0x2a')]},client9002);return _0x3f7be7;}return null;})[_0x7254('0x21')](respondWithResult(_0x240d19,null))['catch'](handleError(_0x240d19,null));};exports[_0x7254('0x78')]=function(_0x4bdda1,_0x4aef90){var _0x186e93;return db[_0x7254('0x3b')][_0x7254('0x78')](_0x4bdda1[_0x7254('0x5a')],{})['then'](function(_0x19c5f8){_0x186e93=_0x19c5f8;return db[_0x7254('0x79')][_0x7254('0x7a')]({'where':{'id':_0x186e93[_0x7254('0x7b')]}});})['then'](function(_0x1f4ba1){if(_['isNil'](_0x1f4ba1)){return;}else{_0x186e93['fax']=_0x1f4ba1['fax'];return db[_0x7254('0x7c')][_0x7254('0x7a')]({'where':{'id':_0x186e93['AttachmentId']}});}})['then'](function(_0x2d1f90){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x4bdda1['body'])?undefined:_0x4bdda1[_0x7254('0x5a')][_0x7254('0x7d')],'path':_['isNil'](_0x2d1f90)?undefined:util['format'](_0x7254('0x7e'),_0x2d1f90[_0x7254('0x7f')]),'fax':_[_0x7254('0x80')](_0x186e93[_0x7254('0x5e')])?undefined:_0x186e93[_0x7254('0x5e')],'AttachmentId':_0x186e93['AttachmentId']},client9002);})[_0x7254('0x21')](respondWithResult(_0x4aef90,0xc9))[_0x7254('0x2c')](handleError(_0x4aef90,null));};exports[_0x7254('0x81')]=function(_0x7d8a8d,_0x3beea2){var _0x39b833=path[_0x7254('0x82')](config[_0x7254('0x83')],'server','files',_0x7254('0x84'));return db[_0x7254('0x3b')][_0x7254('0x59')]({'where':{'id':_0x7d8a8d[_0x7254('0x56')]['id']},'include':[{'model':db[_0x7254('0x7c')],'as':_0x7254('0x7c')}]})['then'](handleEntityNotFound(_0x3beea2,null))[_0x7254('0x21')](function(_0x4120de){if(_0x4120de){return _0x3beea2['download'](path[_0x7254('0x82')](_0x39b833,_0x4120de['Attachment']['basename']));}})[_0x7254('0x2c')](handleError(_0x3beea2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ef26ade..2fdf6b5 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x55ca,0x126));var _0xa55c=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0x55ca[_0x21b762];return _0x2ea6d4;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 340588e..6e31742 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 _0x7f6d=['error','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','FaxInteractionId','then','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7f6d,0xf1));var _0xd7f6=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x7f6d[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xd7f6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd7f6('0x1'));var rp=require(_0xd7f6('0x2'));var fs=require('fs');var path=require(_0xd7f6('0x3'));var rimraf=require(_0xd7f6('0x4'));var config=require(_0xd7f6('0x5'));var attributes=require(_0xd7f6('0x6'));module[_0xd7f6('0x7')]=function(_0x4866f1,_0x45b176){return _0x4866f1[_0xd7f6('0x8')](_0xd7f6('0x9'),attributes,{'tableName':_0xd7f6('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xd7f6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bb566,_0x3553d5,_0x535a22){var _0x5a1fa0=_0x4866f1[_0xd7f6('0xc')];var _0x284801=_0x4bb566[_0xd7f6('0xd')]({'plain':!![]});if(_0x284801[_0xd7f6('0xe')][_0xd7f6('0xf')]()==='in'||_0x284801[_0xd7f6('0xe')]['toLowerCase']()===_0xd7f6('0x10')&&!_0x284801['secret']&&!_[_0xd7f6('0x11')](_0x284801[_0xd7f6('0x12')])){_0x5a1fa0[_0xd7f6('0x13')]['findOne']({'where':{'id':_0x284801[_0xd7f6('0x14')]}})[_0xd7f6('0x15')](function(_0x40f68b){if(_0x40f68b){_0x40f68b[_0xd7f6('0x16')]({'lastMsgAt':_0x284801['createdAt'],'lastMsgDirection':_0x284801[_0xd7f6('0xe')][_0xd7f6('0xf')]()});}})['catch'](function(_0x3a1d60){console[_0xd7f6('0x17')](_0x3a1d60);});}_0x535a22();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe8df=['exports','define','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x5c6c9a,_0x35db23){var _0x4895a1=function(_0x3e7a62){while(--_0x3e7a62){_0x5c6c9a['push'](_0x5c6c9a['shift']());}};_0x4895a1(++_0x35db23);}(_0xe8df,0x189));var _0xfe8d=function(_0x243c8f,_0x1fc066){_0x243c8f=_0x243c8f-0x0;var _0x1c98c1=_0xe8df[_0x243c8f];return _0x1c98c1;};'use strict';var _=require(_0xfe8d('0x0'));var util=require(_0xfe8d('0x1'));var logger=require(_0xfe8d('0x2'))(_0xfe8d('0x3'));var moment=require(_0xfe8d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe8d('0x5'));var config=require(_0xfe8d('0x6'));var attributes=require('./faxMessage.attributes');module[_0xfe8d('0x7')]=function(_0x3346e5,_0x465db4){return _0x3346e5[_0xfe8d('0x8')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xfe8d('0x9'),'fields':[_0xfe8d('0xa')],'type':_0xfe8d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c38ac,_0x2e1157,_0x262abb){var _0x424ed5=_0x3346e5['models'];var _0x22faba=_0x3c38ac[_0xfe8d('0xc')]({'plain':!![]});if(_0x22faba[_0xfe8d('0xd')][_0xfe8d('0xe')]()==='in'||_0x22faba['direction'][_0xfe8d('0xe')]()===_0xfe8d('0xf')&&!_0x22faba['secret']&&!_[_0xfe8d('0x10')](_0x22faba[_0xfe8d('0x11')])){_0x424ed5[_0xfe8d('0x12')][_0xfe8d('0x13')]({'where':{'id':_0x22faba[_0xfe8d('0x14')]}})[_0xfe8d('0x15')](function(_0x43330e){if(_0x43330e){_0x43330e['update']({'lastMsgAt':_0x22faba['createdAt'],'lastMsgDirection':_0x22faba[_0xfe8d('0xd')][_0xfe8d('0xe')]()});}})['catch'](function(_0x33efcc){console[_0xfe8d('0x16')](_0x33efcc);});}_0x262abb();}},'charset':_0xfe8d('0x17'),'collate':_0xfe8d('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3af5844..c3eff9b 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 _0x3126=['redis','defaults','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2f6dfe,_0x115dab){var _0x5e5c9c=function(_0x502840){while(--_0x502840){_0x2f6dfe['push'](_0x2f6dfe['shift']());}};_0x5e5c9c(++_0x115dab);}(_0x3126,0x160));var _0x6312=function(_0x4752ac,_0x3b32a1){_0x4752ac=_0x4752ac-0x0;var _0x28fcbd=_0x3126[_0x4752ac];return _0x28fcbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6312('0x0'));var rs=require(_0x6312('0x1'));var fs=require('fs');var Redis=require(_0x6312('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6312('0x3'))(_0x6312('0x4'));var config=require('../../config/environment');var jayson=require(_0x6312('0x5'));var client=jayson[_0x6312('0x6')][_0x6312('0x7')]({'port':0x232a});config[_0x6312('0x8')]=_[_0x6312('0x9')](config[_0x6312('0x8')],{'host':_0x6312('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6312('0xb'))[_0x6312('0xc')](socket);function respondWithRpcPromise(_0x33c38b,_0x4e7b94,_0x2cc009){return new BPromise(function(_0x48620d,_0x4b7312){return client[_0x6312('0xd')](_0x33c38b,_0x2cc009)[_0x6312('0xe')](function(_0x189caa){logger[_0x6312('0xf')](_0x6312('0x10'),_0x4e7b94,'request\x20sent');logger[_0x6312('0x11')](_0x6312('0x12'),_0x4e7b94,_0x6312('0x13'),JSON['stringify'](_0x189caa));if(_0x189caa['error']){if(_0x189caa[_0x6312('0x14')]['code']===0x1f4){logger[_0x6312('0x14')](_0x6312('0x10'),_0x4e7b94,_0x189caa[_0x6312('0x14')][_0x6312('0x15')]);return _0x4b7312(_0x189caa[_0x6312('0x14')][_0x6312('0x15')]);}logger['error'](_0x6312('0x10'),_0x4e7b94,_0x189caa[_0x6312('0x14')][_0x6312('0x15')]);return _0x48620d(_0x189caa[_0x6312('0x14')][_0x6312('0x15')]);}else{logger[_0x6312('0xf')](_0x6312('0x10'),_0x4e7b94,_0x6312('0x13'));_0x48620d(_0x189caa[_0x6312('0x16')]['message']);}})['catch'](function(_0x272707){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4e7b94,_0x272707);_0x4b7312(_0x272707);});});}exports[_0x6312('0x17')]=function(_0x6b08a3){var _0xdecc57=this;return new Promise(function(_0x4cf7ad,_0x157df9){return db[_0x6312('0x18')][_0x6312('0x19')](_0x6b08a3[_0x6312('0x1a')],{'raw':_0x6b08a3[_0x6312('0x1b')]?_0x6b08a3[_0x6312('0x1b')][_0x6312('0x1c')]===undefined?!![]:![]:!![]})[_0x6312('0xe')](function(_0x394dce){logger[_0x6312('0xf')](_0x6312('0x17'),_0x6b08a3);logger[_0x6312('0x11')](_0x6312('0x17'),_0x6b08a3,JSON[_0x6312('0x1d')](_0x394dce));_0x4cf7ad(_0x394dce);})[_0x6312('0x1e')](function(_0x24aa9f){logger[_0x6312('0x14')](_0x6312('0x17'),_0x24aa9f[_0x6312('0x15')],_0x6b08a3);_0x157df9(_0xdecc57[_0x6312('0x14')](0x1f4,_0x24aa9f['message']));});});};exports[_0x6312('0x1f')]=function(_0x4df76e){var _0x366333=this;return new Promise(function(_0x1ac171,_0x22d3ab){return db[_0x6312('0x18')][_0x6312('0x20')](_0x4df76e[_0x6312('0x1a')],{'raw':_0x4df76e[_0x6312('0x1b')]?_0x4df76e[_0x6312('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4df76e[_0x6312('0x1b')]?_0x4df76e[_0x6312('0x1b')][_0x6312('0x21')]||null:null,'attributes':_0x4df76e[_0x6312('0x1b')]?_0x4df76e['options'][_0x6312('0x22')]||null:null,'limit':_0x4df76e[_0x6312('0x1b')]?_0x4df76e['options'][_0x6312('0x23')]||null:null})[_0x6312('0xe')](function(_0x25656e){logger[_0x6312('0xf')](_0x6312('0x1f'),_0x4df76e);logger[_0x6312('0x11')](_0x6312('0x1f'),_0x4df76e,JSON['stringify'](_0x25656e));_0x1ac171(_0x25656e);})['catch'](function(_0x260b8d){logger['error'](_0x6312('0x1f'),_0x260b8d[_0x6312('0x15')],_0x4df76e);_0x22d3ab(_0x366333['error'](0x1f4,_0x260b8d['message']));});});}; \ No newline at end of file +var _0xb1a9=['info','CreateFaxMessage','create','options','raw','then','stringify','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./faxMessage.socket','register','request\x20sent','debug','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x540a05,_0x243aa5){var _0x1bc0d6=function(_0x389372){while(--_0x389372){_0x540a05['push'](_0x540a05['shift']());}};_0x1bc0d6(++_0x243aa5);}(_0xb1a9,0xbb));var _0x9b1a=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xb1a9[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0x9b1a('0x0'));var util=require(_0x9b1a('0x1'));var moment=require(_0x9b1a('0x2'));var BPromise=require(_0x9b1a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b1a('0x4'));var db=require(_0x9b1a('0x5'))['db'];var utils=require(_0x9b1a('0x6'));var logger=require(_0x9b1a('0x7'))(_0x9b1a('0x8'));var config=require(_0x9b1a('0x9'));var jayson=require(_0x9b1a('0xa'));var client=jayson['client'][_0x9b1a('0xb')]({'port':0x232a});config['redis']=_[_0x9b1a('0xc')](config[_0x9b1a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b1a('0xe'))(new Redis(config[_0x9b1a('0xd')]));require(_0x9b1a('0xf'))[_0x9b1a('0x10')](socket);function respondWithRpcPromise(_0x92bba4,_0x17c0fc,_0x5ee7e1){return new BPromise(function(_0xe47977,_0x14a934){return client['request'](_0x92bba4,_0x5ee7e1)['then'](function(_0x8c380c){logger['info']('FaxMessage,\x20%s,\x20%s',_0x17c0fc,_0x9b1a('0x11'));logger[_0x9b1a('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17c0fc,_0x9b1a('0x11'),JSON['stringify'](_0x8c380c));if(_0x8c380c[_0x9b1a('0x13')]){if(_0x8c380c[_0x9b1a('0x13')][_0x9b1a('0x14')]===0x1f4){logger[_0x9b1a('0x13')](_0x9b1a('0x15'),_0x17c0fc,_0x8c380c[_0x9b1a('0x13')][_0x9b1a('0x16')]);return _0x14a934(_0x8c380c[_0x9b1a('0x13')][_0x9b1a('0x16')]);}logger[_0x9b1a('0x13')](_0x9b1a('0x15'),_0x17c0fc,_0x8c380c[_0x9b1a('0x13')][_0x9b1a('0x16')]);return _0xe47977(_0x8c380c[_0x9b1a('0x13')][_0x9b1a('0x16')]);}else{logger[_0x9b1a('0x17')](_0x9b1a('0x15'),_0x17c0fc,_0x9b1a('0x11'));_0xe47977(_0x8c380c['result'][_0x9b1a('0x16')]);}})['catch'](function(_0x27e511){logger['error'](_0x9b1a('0x15'),_0x17c0fc,_0x27e511);_0x14a934(_0x27e511);});});}exports[_0x9b1a('0x18')]=function(_0x4e18c0){var _0x52d742=this;return new Promise(function(_0x3bbdaa,_0x1a4086){return db['FaxMessage'][_0x9b1a('0x19')](_0x4e18c0['body'],{'raw':_0x4e18c0[_0x9b1a('0x1a')]?_0x4e18c0['options'][_0x9b1a('0x1b')]===undefined?!![]:![]:!![]})[_0x9b1a('0x1c')](function(_0x3acefc){logger['info'](_0x9b1a('0x18'),_0x4e18c0);logger[_0x9b1a('0x12')](_0x9b1a('0x18'),_0x4e18c0,JSON[_0x9b1a('0x1d')](_0x3acefc));_0x3bbdaa(_0x3acefc);})[_0x9b1a('0x1e')](function(_0x5a0f09){logger['error']('CreateFaxMessage',_0x5a0f09['message'],_0x4e18c0);_0x1a4086(_0x52d742[_0x9b1a('0x13')](0x1f4,_0x5a0f09[_0x9b1a('0x16')]));});});};exports[_0x9b1a('0x1f')]=function(_0x2db1ca){var _0x117625=this;return new Promise(function(_0x20eb32,_0x3c3a90){return db[_0x9b1a('0x20')]['update'](_0x2db1ca['body'],{'raw':_0x2db1ca[_0x9b1a('0x1a')]?_0x2db1ca['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2db1ca[_0x9b1a('0x1a')]?_0x2db1ca[_0x9b1a('0x1a')][_0x9b1a('0x21')]||null:null,'attributes':_0x2db1ca[_0x9b1a('0x1a')]?_0x2db1ca[_0x9b1a('0x1a')][_0x9b1a('0x22')]||null:null,'limit':_0x2db1ca[_0x9b1a('0x1a')]?_0x2db1ca[_0x9b1a('0x1a')]['limit']||null:null})[_0x9b1a('0x1c')](function(_0xc632ba){logger[_0x9b1a('0x17')](_0x9b1a('0x1f'),_0x2db1ca);logger[_0x9b1a('0x12')](_0x9b1a('0x1f'),_0x2db1ca,JSON[_0x9b1a('0x1d')](_0xc632ba));_0x20eb32(_0xc632ba);})[_0x9b1a('0x1e')](function(_0x2ea023){logger[_0x9b1a('0x13')](_0x9b1a('0x1f'),_0x2ea023[_0x9b1a('0x16')],_0x2db1ca);_0x3c3a90(_0x117625['error'](0x1f4,_0x2ea023['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 55b2ccf..93ff317 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index fd3dea5..536d8a6 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 _0x1605=['post','tracked','fax','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1605,0x1df));var _0x5160=function(_0x14b029,_0xf43f82){_0x14b029=_0x14b029-0x0;var _0x218033=_0x1605[_0x14b029];return _0x218033;};'use strict';var multer=require('multer');var util=require(_0x5160('0x0'));var path=require(_0x5160('0x1'));var timeout=require(_0x5160('0x2'));var express=require(_0x5160('0x3'));var router=express[_0x5160('0x4')]();var auth=require(_0x5160('0x5'));var interaction=require(_0x5160('0x6'));var config=require('../../config/environment');var controller=require(_0x5160('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5160('0x8')]);router[_0x5160('0x9')](_0x5160('0xa'),auth[_0x5160('0xb')](),controller[_0x5160('0xc')]);router[_0x5160('0x9')](_0x5160('0xd'),auth[_0x5160('0xb')](),controller[_0x5160('0xe')]);router[_0x5160('0x9')]('/:id/download',auth[_0x5160('0xb')](),controller['download']);router[_0x5160('0xf')]('/',auth['isAuthenticated'](),interaction[_0x5160('0x10')](_0x5160('0x11'),'faxmessage:create'),controller['create']);router[_0x5160('0x12')](_0x5160('0xd'),auth[_0x5160('0xb')](),controller['update']);router['put'](_0x5160('0x13'),auth[_0x5160('0xb')](),controller[_0x5160('0x14')]);router['put'](_0x5160('0x15'),auth[_0x5160('0xb')](),controller[_0x5160('0x16')]);router[_0x5160('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x5160('0x18')]);module[_0x5160('0x19')]=router; \ No newline at end of file +var _0x7400=['download','post','tracked','faxmessage:create','create','update','put','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','isAuthenticated','describe','/:id','/:id/download'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7400,0x1d7));var _0x0740=function(_0x5dff5b,_0x600c5d){_0x5dff5b=_0x5dff5b-0x0;var _0x34dd83=_0x7400[_0x5dff5b];return _0x34dd83;};'use strict';var multer=require('multer');var util=require(_0x0740('0x0'));var path=require(_0x0740('0x1'));var timeout=require(_0x0740('0x2'));var express=require(_0x0740('0x3'));var router=express[_0x0740('0x4')]();var auth=require(_0x0740('0x5'));var interaction=require(_0x0740('0x6'));var config=require(_0x0740('0x7'));var controller=require(_0x0740('0x8'));router[_0x0740('0x9')]('/',auth['isAuthenticated'](),controller[_0x0740('0xa')]);router[_0x0740('0x9')]('/describe',auth[_0x0740('0xb')](),controller[_0x0740('0xc')]);router[_0x0740('0x9')](_0x0740('0xd'),auth[_0x0740('0xb')](),controller['show']);router[_0x0740('0x9')](_0x0740('0xe'),auth[_0x0740('0xb')](),controller[_0x0740('0xf')]);router[_0x0740('0x10')]('/',auth[_0x0740('0xb')](),interaction[_0x0740('0x11')]('fax',_0x0740('0x12')),controller[_0x0740('0x13')]);router['put'](_0x0740('0xd'),auth[_0x0740('0xb')](),controller[_0x0740('0x14')]);router[_0x0740('0x15')](_0x0740('0x16'),auth[_0x0740('0xb')](),controller[_0x0740('0x17')]);router[_0x0740('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0740('0x18')]);router[_0x0740('0x19')](_0x0740('0xd'),auth[_0x0740('0xb')](),controller['destroy']);module[_0x0740('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0f254d2..2aed318 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 _0x87d0=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x87d0,0xf6));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x087d('0x0'));module[_0x087d('0x1')]={'name':{'type':Sequelize[_0x087d('0x2')],'unique':_0x087d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x087d('0x2')]},'timeout':{'type':Sequelize[_0x087d('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x087d('0x5')](_0x087d('0x6'),_0x087d('0x7'),_0x087d('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b96=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','name'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x1b96,0x1e8));var _0x61b9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1b96[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x61b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x61b9('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x61b9('0x2')]},'timeout':{'type':Sequelize[_0x61b9('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x61b9('0x4')]('rrmemory',_0x61b9('0x5'),_0x61b9('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 86f0457..c2f28c9 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 _0x51a8=['error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','filter','UserFaxQueue','UserId','agent','faxPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','from','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','emit','isArray','getAgents','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get'];(function(_0x133ef5,_0x31e532){var _0x1070b4=function(_0xbb0fab){while(--_0xbb0fab){_0x133ef5['push'](_0x133ef5['shift']());}};_0x1070b4(++_0x31e532);}(_0x51a8,0xec));var _0x851a=function(_0x34bea3,_0x520efd){_0x34bea3=_0x34bea3-0x0;var _0xbd8ad0=_0x51a8[_0x34bea3];return _0xbd8ad0;};'use strict';var pdf=require(_0x851a('0x0'));var emlformat=require(_0x851a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x851a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x851a('0x3'));var moment=require('moment');var BPromise=require(_0x851a('0x4'));var Mustache=require(_0x851a('0x5'));var util=require(_0x851a('0x6'));var path=require(_0x851a('0x7'));var sox=require(_0x851a('0x8'));var csv=require('to-csv');var ejs=require(_0x851a('0x9'));var fs=require('fs');var _=require(_0x851a('0xa'));var squel=require(_0x851a('0xb'));var crypto=require(_0x851a('0xc'));var jsforce=require(_0x851a('0xd'));var deskjs=require(_0x851a('0xe'));var toCsv=require(_0x851a('0xf'));var querystring=require(_0x851a('0x10'));var Papa=require(_0x851a('0x11'));var Redis=require('ioredis');var authService=require(_0x851a('0x12'));var qs=require(_0x851a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x851a('0x14'));var logger=require(_0x851a('0x15'))(_0x851a('0x16'));var utils=require(_0x851a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x851a('0x18'));var db=require(_0x851a('0x19'))['db'];config[_0x851a('0x1a')]=_[_0x851a('0x1b')](config[_0x851a('0x1a')],{'host':_0x851a('0x1c'),'port':0x18eb});var socket=require(_0x851a('0x1d'))(new Redis(config[_0x851a('0x1a')]));require(_0x851a('0x1e'))[_0x851a('0x1f')](socket);function respondWithStatusCode(_0x3e9dd9,_0x474d04){_0x474d04=_0x474d04||0xcc;return function(_0x8268d5){if(_0x8268d5){return _0x3e9dd9[_0x851a('0x20')](_0x474d04);}return _0x3e9dd9[_0x851a('0x21')](_0x474d04)[_0x851a('0x22')]();};}function respondWithResult(_0x12ef90,_0x23a3fc){_0x23a3fc=_0x23a3fc||0xc8;return function(_0x6c81f6){if(_0x6c81f6){return _0x12ef90[_0x851a('0x21')](_0x23a3fc)[_0x851a('0x23')](_0x6c81f6);}};}function respondWithFilteredResult(_0x3366bc,_0x590b8b){return function(_0x53b4ce){if(_0x53b4ce){var _0x41f977=_0x53b4ce['count'],_0x4c9d2f=_0x590b8b[_0x851a('0x24')],_0x467013=_0x590b8b[_0x851a('0x24')]+_0x590b8b[_0x851a('0x25')],_0x4cb9a;if(_0x467013>=_0x41f977){_0x467013=_0x41f977;_0x4cb9a=0xc8;}else{_0x4cb9a=0xce;}_0x3366bc[_0x851a('0x21')](_0x4cb9a);return _0x3366bc[_0x851a('0x26')](_0x851a('0x27'),_0x4c9d2f+'-'+_0x467013+'/'+_0x41f977)[_0x851a('0x23')](_0x53b4ce);}return null;};}function patchUpdates(_0x185dbc){return function(_0x1f8a9f){try{jsonpatch[_0x851a('0x28')](_0x1f8a9f,_0x185dbc,!![]);}catch(_0x5c1330){return BPromise[_0x851a('0x29')](_0x5c1330);}return _0x1f8a9f[_0x851a('0x2a')]();};}function saveUpdates(_0x215334,_0xf63e2){return function(_0x50c80b){if(_0x50c80b){return _0x50c80b['update'](_0x215334)[_0x851a('0x2b')](function(_0x52d153){return _0x52d153;});}return null;};}function removeEntity(_0x343165,_0x404f7f){return function(_0x2439b7){if(_0x2439b7){return _0x2439b7[_0x851a('0x2c')]()['then'](function(){var _0x4ff49c=_0x2439b7[_0x851a('0x2d')]({'plain':!![]});var _0x249e50='FaxQueues';return db['UserProfileResource'][_0x851a('0x2c')]({'where':{'type':_0x249e50,'resourceId':_0x4ff49c['id']}})[_0x851a('0x2b')](function(){return _0x2439b7;});})[_0x851a('0x2b')](function(){_0x343165[_0x851a('0x21')](0xcc)[_0x851a('0x22')]();});}};}function handleEntityNotFound(_0x4bce08,_0x534c34){return function(_0x507f7d){if(!_0x507f7d){_0x4bce08['sendStatus'](0x194);}return _0x507f7d;};}function handleError(_0x271940,_0x2865d2){_0x2865d2=_0x2865d2||0x1f4;return function(_0x40b141){logger[_0x851a('0x2e')](_0x40b141[_0x851a('0x2f')]);if(_0x40b141[_0x851a('0x30')]){delete _0x40b141[_0x851a('0x30')];}_0x271940[_0x851a('0x21')](_0x2865d2)[_0x851a('0x31')](_0x40b141);};}exports[_0x851a('0x32')]=function(_0x4c4236,_0x597d8f){var _0x4999b2={},_0x422f85={},_0x551672={'count':0x0,'rows':[]};var _0x377c38=_[_0x851a('0x33')](db[_0x851a('0x34')][_0x851a('0x35')],function(_0x224850){return{'name':_0x224850[_0x851a('0x36')],'type':_0x224850['type'][_0x851a('0x37')]};});_0x422f85[_0x851a('0x38')]=_[_0x851a('0x33')](_0x377c38,'name');_0x422f85['query']=_['keys'](_0x4c4236[_0x851a('0x39')]);_0x422f85[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x422f85[_0x851a('0x38')],_0x422f85[_0x851a('0x39')]);_0x4999b2[_0x851a('0x3c')]=_['intersection'](_0x422f85[_0x851a('0x38')],qs[_0x851a('0x3d')](_0x4c4236[_0x851a('0x39')][_0x851a('0x3d')]));_0x4999b2['attributes']=_0x4999b2[_0x851a('0x3c')][_0x851a('0x3e')]?_0x4999b2[_0x851a('0x3c')]:_0x422f85['model'];if(!_0x4c4236[_0x851a('0x39')][_0x851a('0x3f')](_0x851a('0x40'))){_0x4999b2['limit']=qs['limit'](_0x4c4236[_0x851a('0x39')][_0x851a('0x25')]);_0x4999b2[_0x851a('0x24')]=qs['offset'](_0x4c4236[_0x851a('0x39')][_0x851a('0x24')]);}_0x4999b2[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x4c4236[_0x851a('0x39')]['sort']);_0x4999b2[_0x851a('0x43')]=qs[_0x851a('0x3a')](_[_0x851a('0x44')](_0x4c4236[_0x851a('0x39')],_0x422f85[_0x851a('0x3a')]),_0x377c38);if(_0x4c4236[_0x851a('0x39')]['filter']){_0x4999b2['where']=_[_0x851a('0x45')](_0x4999b2['where'],{'$or':_['map'](_0x377c38,function(_0x3fb1f5){if(_0x3fb1f5[_0x851a('0x46')]!==_0x851a('0x47')){var _0x28c03d={};_0x28c03d[_0x3fb1f5[_0x851a('0x30')]]={'$like':'%'+_0x4c4236['query']['filter']+'%'};return _0x28c03d;}})});}_0x4999b2=_[_0x851a('0x45')]({},_0x4999b2,_0x4c4236[_0x851a('0x48')]);var _0x149ff7={'where':_0x4999b2[_0x851a('0x43')]};return db['FaxQueue'][_0x851a('0x49')](_0x149ff7)[_0x851a('0x2b')](function(_0x4774fc){_0x551672['count']=_0x4774fc;if(_0x4c4236['query'][_0x851a('0x4a')]){_0x4999b2[_0x851a('0x4b')]=[{'all':!![]}];}return db[_0x851a('0x34')][_0x851a('0x4c')](_0x4999b2);})[_0x851a('0x2b')](function(_0x570ba3){_0x551672['rows']=_0x570ba3;return _0x551672;})[_0x851a('0x2b')](respondWithFilteredResult(_0x597d8f,_0x4999b2))[_0x851a('0x4d')](handleError(_0x597d8f,null));};exports[_0x851a('0x4e')]=function(_0x3639c2,_0x4c6f15){var _0x111722={'raw':!![],'where':{'id':_0x3639c2['params']['id']}},_0x1041c4={};_0x1041c4[_0x851a('0x38')]=_[_0x851a('0x4f')](db[_0x851a('0x34')][_0x851a('0x35')]);_0x1041c4[_0x851a('0x39')]=_['keys'](_0x3639c2['query']);_0x1041c4[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x1041c4[_0x851a('0x38')],_0x1041c4[_0x851a('0x39')]);_0x111722[_0x851a('0x3c')]=_[_0x851a('0x3b')](_0x1041c4[_0x851a('0x38')],qs[_0x851a('0x3d')](_0x3639c2[_0x851a('0x39')][_0x851a('0x3d')]));_0x111722[_0x851a('0x3c')]=_0x111722['attributes'][_0x851a('0x3e')]?_0x111722[_0x851a('0x3c')]:_0x1041c4[_0x851a('0x38')];if(_0x3639c2[_0x851a('0x39')]['includeAll']){_0x111722[_0x851a('0x4b')]=[{'all':!![]}];}_0x111722=_['merge']({},_0x111722,_0x3639c2[_0x851a('0x48')]);return db['FaxQueue'][_0x851a('0x50')](_0x111722)[_0x851a('0x2b')](handleEntityNotFound(_0x4c6f15,null))[_0x851a('0x2b')](respondWithResult(_0x4c6f15,null))[_0x851a('0x4d')](handleError(_0x4c6f15,null));};exports[_0x851a('0x51')]=function(_0xa56e1f,_0x137718){return db['FaxQueue']['create'](_0xa56e1f[_0x851a('0x52')],{})[_0x851a('0x2b')](function(_0x5f22d8){var _0x3e000e=_0xa56e1f[_0x851a('0x53')][_0x851a('0x2d')]({'plain':!![]});if(!_0x3e000e)throw new Error(_0x851a('0x54'));if(_0x3e000e[_0x851a('0x55')]===_0x851a('0x53')){var _0x514b8e=_0x5f22d8['get']({'plain':!![]});var _0x1bab23=_0x851a('0x56');return db[_0x851a('0x57')][_0x851a('0x50')]({'where':{'name':_0x1bab23,'userProfileId':_0x3e000e['userProfileId']},'raw':!![]})[_0x851a('0x2b')](function(_0x215b63){if(_0x215b63&&_0x215b63['autoAssociation']===0x0){return db[_0x851a('0x58')][_0x851a('0x51')]({'name':_0x514b8e[_0x851a('0x30')],'resourceId':_0x514b8e['id'],'type':_0x215b63['name'],'sectionId':_0x215b63['id']},{})[_0x851a('0x2b')](function(){return _0x5f22d8;});}else{return _0x5f22d8;}})[_0x851a('0x4d')](function(_0x1ee7e7){logger['error'](_0x851a('0x59'),_0x1ee7e7);throw _0x1ee7e7;});}return _0x5f22d8;})[_0x851a('0x2b')](respondWithResult(_0x137718,0xc9))['catch'](handleError(_0x137718,null));};exports['update']=function(_0x146e08,_0x122ba1){if(_0x146e08[_0x851a('0x52')]['id']){delete _0x146e08[_0x851a('0x52')]['id'];}return db['FaxQueue'][_0x851a('0x50')]({'where':{'id':_0x146e08['params']['id']}})[_0x851a('0x2b')](handleEntityNotFound(_0x122ba1,null))['then'](saveUpdates(_0x146e08[_0x851a('0x52')],null))[_0x851a('0x2b')](respondWithResult(_0x122ba1,null))[_0x851a('0x4d')](handleError(_0x122ba1,null));};exports[_0x851a('0x2c')]=function(_0x48d4e6,_0x5c2982){return db['FaxQueue']['find']({'where':{'id':_0x48d4e6[_0x851a('0x5a')]['id']}})[_0x851a('0x2b')](handleEntityNotFound(_0x5c2982,null))[_0x851a('0x2b')](removeEntity(_0x5c2982,null))[_0x851a('0x4d')](handleError(_0x5c2982,null));};exports[_0x851a('0x5b')]=function(_0x2ce735,_0x55e1ea){return db[_0x851a('0x34')][_0x851a('0x5b')]()[_0x851a('0x2b')](respondWithResult(_0x55e1ea,null))[_0x851a('0x4d')](handleError(_0x55e1ea,null));};exports['getMembers']=function(_0x48e934,_0xd2b069,_0x478c0c){var _0x4f1377={'raw':!![],'where':{}},_0x587c8d={},_0x6568e;return db[_0x851a('0x34')][_0x851a('0x5c')]({'where':{'id':_0x48e934[_0x851a('0x5a')]['id']}})[_0x851a('0x2b')](handleEntityNotFound(_0xd2b069,null))[_0x851a('0x2b')](function(_0x24260c){if(_0x24260c){_0x6568e=_0x24260c[_0x851a('0x2d')]({'plain':!![]});_0x587c8d[_0x851a('0x38')]=_[_0x851a('0x4f')](db['UserFaxQueue'][_0x851a('0x35')]);_0x587c8d[_0x851a('0x39')]=_[_0x851a('0x4f')](_0x48e934['query']);_0x587c8d['filters']=_[_0x851a('0x3b')](_0x587c8d[_0x851a('0x38')],_0x587c8d['query']);_0x4f1377[_0x851a('0x3c')]=_['intersection'](_0x587c8d[_0x851a('0x38')],qs[_0x851a('0x3d')](_0x48e934['query'][_0x851a('0x3d')]));_0x4f1377[_0x851a('0x3c')]=_0x4f1377[_0x851a('0x3c')][_0x851a('0x3e')]?_0x4f1377[_0x851a('0x3c')]:_0x587c8d[_0x851a('0x38')];if(!_0x48e934['query']['hasOwnProperty'](_0x851a('0x40'))){_0x4f1377[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x48e934[_0x851a('0x39')][_0x851a('0x25')]);_0x4f1377[_0x851a('0x24')]=qs[_0x851a('0x24')](_0x48e934[_0x851a('0x39')]['offset']);}_0x4f1377[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x48e934[_0x851a('0x39')][_0x851a('0x42')]);_0x4f1377[_0x851a('0x43')]=qs[_0x851a('0x3a')](_[_0x851a('0x44')](_0x48e934[_0x851a('0x39')],_0x587c8d[_0x851a('0x3a')]));_0x4f1377[_0x851a('0x43')]['FaxQueueId']=_0x24260c['id'];if(_0x48e934[_0x851a('0x39')][_0x851a('0x5d')]){_0x4f1377[_0x851a('0x43')]=_[_0x851a('0x45')](_0x4f1377['where'],{'$or':_[_0x851a('0x33')](_0x4f1377[_0x851a('0x3c')],function(_0x22c882){var _0xc5c4f4={};_0xc5c4f4[_0x22c882]={'$like':'%'+_0x48e934[_0x851a('0x39')]['filter']+'%'};return _0xc5c4f4;})});}_0x4f1377=_[_0x851a('0x45')]({},_0x4f1377,_0x48e934[_0x851a('0x48')]);return db[_0x851a('0x5e')][_0x851a('0x4c')](_0x4f1377);}})['then'](function(_0x1ef892){if(_0x1ef892){return db['User']['findAndCountAll']({'where':{'id':_[_0x851a('0x33')](_0x1ef892,_0x851a('0x5f')),'role':_0x851a('0x60')},'attributes':['id','name',_0x851a('0x61'),_0x851a('0x62'),_0x851a('0x63')]});}})[_0x851a('0x2b')](function(_0x41994c){if(_0x41994c){return{'count':_0x41994c[_0x851a('0x49')],'rows':_['map'](_0x41994c[_0x851a('0x64')],function(_0x3c8377){return{'membername':_0x3c8377[_0x851a('0x30')],'UserId':_0x3c8377['id'],'queue_name':_0x6568e[_0x851a('0x30')],'FaxQueueId':_0x6568e['id'],'interface':util['format'](_0x851a('0x65'),_0x851a('0x66'),_0x3c8377[_0x851a('0x30')]),'penalty':0x0,'paused':_0x3c8377[_0x851a('0x61')],'createdAt':_0x3c8377[_0x851a('0x63')],'updatedAt':_0x3c8377['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x851a('0x2b')](respondWithFilteredResult(_0xd2b069,_0x4f1377))[_0x851a('0x4d')](handleError(_0xd2b069,null));};exports[_0x851a('0x67')]=function(_0x38248a,_0x3e87b4,_0xaa309f){var _0x41bb28={};var _0xe63d0c={};var _0x1bb0b4;var _0x5399f5;return db[_0x851a('0x34')]['findOne']({'where':{'id':_0x38248a['params']['id']}})['then'](handleEntityNotFound(_0x3e87b4,null))[_0x851a('0x2b')](function(_0x36487d){if(_0x36487d){_0x1bb0b4=_0x36487d;_0xe63d0c[_0x851a('0x38')]=_[_0x851a('0x4f')](db[_0x851a('0x68')]['rawAttributes']);_0xe63d0c[_0x851a('0x39')]=_[_0x851a('0x4f')](_0x38248a[_0x851a('0x39')]);_0xe63d0c['filters']=_[_0x851a('0x3b')](_0xe63d0c[_0x851a('0x38')],_0xe63d0c[_0x851a('0x39')]);_0x41bb28['attributes']=_[_0x851a('0x3b')](_0xe63d0c['model'],qs[_0x851a('0x3d')](_0x38248a[_0x851a('0x39')][_0x851a('0x3d')]));_0x41bb28[_0x851a('0x3c')]=_0x41bb28[_0x851a('0x3c')][_0x851a('0x3e')]?_0x41bb28[_0x851a('0x3c')]:_0xe63d0c[_0x851a('0x38')];_0x41bb28[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x38248a['query'][_0x851a('0x42')]);_0x41bb28[_0x851a('0x43')]=qs[_0x851a('0x3a')](_[_0x851a('0x44')](_0x38248a[_0x851a('0x39')],_0xe63d0c['filters']));if(_0x38248a['query']['filter']){_0x41bb28['where']=_[_0x851a('0x45')](_0x41bb28[_0x851a('0x43')],{'$or':_['map'](_0x41bb28[_0x851a('0x3c')],function(_0x4571ac){var _0x57b38b={};_0x57b38b[_0x4571ac]={'$like':'%'+_0x38248a['query']['filter']+'%'};return _0x57b38b;})});}_0x41bb28=_[_0x851a('0x45')]({},_0x41bb28,_0x38248a['options']);return _0x1bb0b4['getTeams'](_0x41bb28);}})[_0x851a('0x2b')](function(_0x2d39c0){if(_0x2d39c0){_0x5399f5=_0x2d39c0['length'];if(!_0x38248a[_0x851a('0x39')]['hasOwnProperty'](_0x851a('0x40'))){_0x41bb28[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x38248a[_0x851a('0x39')][_0x851a('0x25')]);_0x41bb28[_0x851a('0x24')]=qs[_0x851a('0x24')](_0x38248a[_0x851a('0x39')][_0x851a('0x24')]);}return _0x1bb0b4[_0x851a('0x67')](_0x41bb28);}})['then'](function(_0x592a16){if(_0x592a16){return _0x592a16?{'count':_0x5399f5,'rows':_0x592a16}:null;}})['then'](respondWithResult(_0x3e87b4,null))['catch'](handleError(_0x3e87b4,null));};exports['addTeams']=function(_0x532fe1,_0x392586,_0x2ca557){var _0x92671f=_0x532fe1[_0x851a('0x52')]['ids'];return db[_0x851a('0x68')]['findAll']({'where':{'id':_0x92671f},'attributes':['id'],'include':[{'model':db[_0x851a('0x69')],'as':_0x851a('0x6a'),'attributes':['id',_0x851a('0x30'),_0x851a('0x6b'),_0x851a('0x6c'),_0x851a('0x6d')],'raw':!![]}]})[_0x851a('0x2b')](function(_0x47607d){if(_0x47607d){var _0x117203=_[_0x851a('0x6e')](_0x47607d,function(_0x28d999){var _0x4d8b37=_0x28d999[_0x851a('0x2d')]({'plain':!![]});return _0x4d8b37[_0x851a('0x6a')];});return db[_0x851a('0x34')][_0x851a('0x50')]({'where':{'id':_0x532fe1[_0x851a('0x5a')]['id']}})['then'](function(_0xa8d50d){return db[_0x851a('0x6f')][_0x851a('0x70')](function(_0x12dbb6){return _0xa8d50d[_0x851a('0x71')](_0x92671f,{'transaction':_0x12dbb6})[_0x851a('0x2b')](function(){return BPromise[_0x851a('0x72')](_0x117203,function(_0x30f735){return db[_0x851a('0x5e')][_0x851a('0x73')]({'where':{'UserId':_0x30f735['id'],'FaxQueueId':_0x532fe1[_0x851a('0x5a')]['id']},'transaction':_0x12dbb6});});})[_0x851a('0x2b')](function(){_0x117203[_0x851a('0x74')](function(_0x54111f){socket['emit'](_0x851a('0x75'),{'UserId':_0x54111f['id'],'FaxQueueId':_0xa8d50d['id']});});});});});}})[_0x851a('0x2b')](respondWithStatusCode(_0x392586,null))[_0x851a('0x4d')](handleError(_0x392586,null));};exports[_0x851a('0x76')]=function(_0x47c3c0,_0x24f136,_0x194a6f){return db['Team'][_0x851a('0x4c')]({'where':{'id':_0x47c3c0['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x851a('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x851a('0x2b')](handleEntityNotFound(_0x24f136,null))[_0x851a('0x2b')](function(_0xf3ba83){var _0x277af0=_[_0x851a('0x33')](_0xf3ba83,'id');var _0x550a9f=[];var _0x1402de=[];var _0x1226ac=squel['select']();_0x1226ac['field']('tq.TeamId')[_0x851a('0x77')]('team_has_fax_queues','tq')[_0x851a('0x78')](_0x851a('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x851a('0x43')](_0x851a('0x7a'),_0x47c3c0['params']['id']);for(var _0x45950b=0x0;_0x45950b<_0xf3ba83['length'];_0x45950b+=0x1){let _0x121e34=_0xf3ba83[_0x45950b];for(var _0x3d157c=0x0;_0x3d157c<_0x121e34[_0x851a('0x6a')]['length'];_0x3d157c+=0x1){let _0x35a60e=_0x121e34[_0x851a('0x6a')][_0x3d157c];var _0x2a878a=_0x1226ac[_0x851a('0x7b')]();_0x2a878a[_0x851a('0x43')]('ut.UserId\x20=\x20?',_0x35a60e['id']);_0x1402de[_0x851a('0x7c')](db[_0x851a('0x6f')][_0x851a('0x39')](_0x2a878a[_0x851a('0x7d')](),{'type':db[_0x851a('0x6f')][_0x851a('0x7e')][_0x851a('0x7f')]})[_0x851a('0x2b')](function(_0x586c79){if(_0x586c79['length']===0x1){return _0x35a60e['id'];}else{var _0x2d2b36=_[_0x851a('0x80')](_[_0x851a('0x33')](_0x586c79,_0x851a('0x81')),function(_0x3bf59d){return _['includes'](_0x277af0,_0x3bf59d);});if(_0x2d2b36){return _0x35a60e['id'];}}}));}}return BPromise[_0x851a('0x82')](_0x1402de)[_0x851a('0x2b')](function(_0x36bf8f){_0x550a9f=_(_0x550a9f)[_0x851a('0x83')](_0x36bf8f)['compact']()[_0x851a('0x84')]();return db[_0x851a('0x34')][_0x851a('0x50')]({'where':{'id':_0x47c3c0[_0x851a('0x5a')]['id']}})['then'](function(_0x31b4ae){return db[_0x851a('0x6f')]['transaction'](function(_0x59c9af){return _0x31b4ae[_0x851a('0x76')](_0x47c3c0[_0x851a('0x39')][_0x851a('0x85')],{'transaction':_0x59c9af})[_0x851a('0x2b')](function(){if(!_[_0x851a('0x86')](_0x550a9f)){return _0x31b4ae[_0x851a('0x87')](_0x550a9f,{'transaction':_0x59c9af});}})['then'](function(){_0x550a9f['forEach'](function(_0x40c783){socket['emit'](_0x851a('0x88'),{'UserId':_0x40c783,'FaxQueueId':_0x31b4ae['id']});});});});});});})[_0x851a('0x2b')](respondWithStatusCode(_0x24f136,null))[_0x851a('0x4d')](handleError(_0x24f136,null));};exports[_0x851a('0x89')]=function(_0x1bb0ea,_0x45cd69,_0x2e31f5){return db['FaxQueue'][_0x851a('0x50')]({'where':{'id':_0x1bb0ea['params']['id']}})[_0x851a('0x2b')](handleEntityNotFound(_0x45cd69,null))['then'](function(_0x256443){if(_0x256443){return _0x256443[_0x851a('0x89')](_0x1bb0ea[_0x851a('0x52')][_0x851a('0x85')],_['omit'](_0x1bb0ea[_0x851a('0x52')],[_0x851a('0x85'),'id'])||{})['spread'](function(_0x50df65){for(var _0x58a43e=0x0;_0x58a43e<_0x1bb0ea[_0x851a('0x52')]['ids']['length'];_0x58a43e+=0x1){socket[_0x851a('0x8a')](_0x851a('0x75'),{'UserId':_0x1bb0ea[_0x851a('0x52')]['ids'][_0x58a43e],'FaxQueueId':_0x1bb0ea[_0x851a('0x5a')]['id']});}return _0x50df65;});}})[_0x851a('0x2b')](respondWithResult(_0x45cd69,null))[_0x851a('0x4d')](handleError(_0x45cd69,null));};exports[_0x851a('0x87')]=function(_0x40bf21,_0x46b957,_0x25987b){return db[_0x851a('0x34')][_0x851a('0x50')]({'where':{'id':_0x40bf21[_0x851a('0x5a')]['id']}})[_0x851a('0x2b')](handleEntityNotFound(_0x46b957,null))[_0x851a('0x2b')](function(_0x47671a){if(_0x47671a){return _0x47671a['removeAgents'](_0x40bf21['query']['ids'])['then'](function(){if(_[_0x851a('0x8b')](_0x40bf21[_0x851a('0x39')][_0x851a('0x85')])){for(var _0x3d4cd0=0x0;_0x3d4cd0<_0x40bf21[_0x851a('0x39')][_0x851a('0x85')][_0x851a('0x3e')];_0x3d4cd0+=0x1){socket[_0x851a('0x8a')](_0x851a('0x88'),{'UserId':Number(_0x40bf21[_0x851a('0x39')][_0x851a('0x85')][_0x3d4cd0]),'FaxQueueId':Number(_0x40bf21[_0x851a('0x5a')]['id'])});}}else{socket[_0x851a('0x8a')](_0x851a('0x88'),{'UserId':Number(_0x40bf21[_0x851a('0x39')]['ids']),'FaxQueueId':Number(_0x40bf21['params']['id'])});}});}})['then'](respondWithStatusCode(_0x46b957,null))[_0x851a('0x4d')](handleError(_0x46b957,null));};exports['getAgents']=function(_0x200cc5,_0x110638,_0x2fce4b){var _0x30b7b9={};var _0x2eeb5b={};var _0x2576f9;var _0x18cccf;return db[_0x851a('0x34')][_0x851a('0x5c')]({'where':{'id':_0x200cc5[_0x851a('0x5a')]['id']}})[_0x851a('0x2b')](handleEntityNotFound(_0x110638,null))[_0x851a('0x2b')](function(_0x2043de){if(_0x2043de){_0x2576f9=_0x2043de;_0x2eeb5b[_0x851a('0x38')]=_[_0x851a('0x4f')](db[_0x851a('0x69')][_0x851a('0x35')]);_0x2eeb5b[_0x851a('0x39')]=_[_0x851a('0x4f')](_0x200cc5['query']);_0x2eeb5b[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x2eeb5b[_0x851a('0x38')],_0x2eeb5b[_0x851a('0x39')]);_0x30b7b9[_0x851a('0x3c')]=_[_0x851a('0x3b')](_0x2eeb5b[_0x851a('0x38')],qs['fields'](_0x200cc5['query'][_0x851a('0x3d')]));_0x30b7b9[_0x851a('0x3c')]=_0x30b7b9[_0x851a('0x3c')][_0x851a('0x3e')]?_0x30b7b9[_0x851a('0x3c')]:_0x2eeb5b[_0x851a('0x38')];_0x30b7b9[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x200cc5['query'][_0x851a('0x42')]);_0x30b7b9[_0x851a('0x43')]=qs[_0x851a('0x3a')](_['pick'](_0x200cc5['query'],_0x2eeb5b[_0x851a('0x3a')]));if(_0x200cc5[_0x851a('0x39')]['filter']){_0x30b7b9[_0x851a('0x43')]=_['merge'](_0x30b7b9[_0x851a('0x43')],{'$or':_[_0x851a('0x33')](_0x30b7b9[_0x851a('0x3c')],function(_0x4f5232){var _0x88e0a={};_0x88e0a[_0x4f5232]={'$like':'%'+_0x200cc5['query']['filter']+'%'};return _0x88e0a;})});}_0x30b7b9=_[_0x851a('0x45')]({},_0x30b7b9,_0x200cc5[_0x851a('0x48')]);return _0x2576f9[_0x851a('0x8c')](_0x30b7b9);}})[_0x851a('0x2b')](function(_0x19627d){if(_0x19627d){_0x18cccf=_0x19627d['length'];if(!_0x200cc5[_0x851a('0x39')][_0x851a('0x3f')](_0x851a('0x40'))){_0x30b7b9['limit']=qs[_0x851a('0x25')](_0x200cc5[_0x851a('0x39')][_0x851a('0x25')]);_0x30b7b9['offset']=qs[_0x851a('0x24')](_0x200cc5[_0x851a('0x39')][_0x851a('0x24')]);}return _0x2576f9[_0x851a('0x8c')](_0x30b7b9);}})['then'](function(_0x432a01){if(_0x432a01){return _0x432a01?{'count':_0x18cccf,'rows':_0x432a01}:null;}})['then'](respondWithResult(_0x110638,null))[_0x851a('0x4d')](handleError(_0x110638,null));}; \ No newline at end of file +var _0xa376=['isEmpty','removeAgents','forEach','addAgents','omit','isArray','getAgents','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','end','error','name','send','index','FaxQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserFaxQueue','length','map','User','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','filter','getTeams','addTeams','ids','Team','Agents','voicePause','interface','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','compact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa376,0x88));var _0x6a37=function(_0x56a63a,_0x45448c){_0x56a63a=_0x56a63a-0x0;var _0x306291=_0xa376[_0x56a63a];return _0x306291;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a37('0x1'));var rp=require(_0x6a37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a37('0x3'));var util=require(_0x6a37('0x4'));var path=require(_0x6a37('0x5'));var sox=require(_0x6a37('0x6'));var csv=require(_0x6a37('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a37('0x8'));var squel=require(_0x6a37('0x9'));var crypto=require(_0x6a37('0xa'));var jsforce=require(_0x6a37('0xb'));var deskjs=require(_0x6a37('0xc'));var toCsv=require(_0x6a37('0x7'));var querystring=require(_0x6a37('0xd'));var Papa=require('papaparse');var Redis=require(_0x6a37('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a37('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a37('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a37('0x11'))['db'];config[_0x6a37('0x12')]=_[_0x6a37('0x13')](config[_0x6a37('0x12')],{'host':_0x6a37('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a37('0x12')]));require('./faxQueue.socket')[_0x6a37('0x15')](socket);function respondWithStatusCode(_0x58fb53,_0x413995){_0x413995=_0x413995||0xcc;return function(_0x59f7a8){if(_0x59f7a8){return _0x58fb53[_0x6a37('0x16')](_0x413995);}return _0x58fb53[_0x6a37('0x17')](_0x413995)['end']();};}function respondWithResult(_0x952417,_0x121f19){_0x121f19=_0x121f19||0xc8;return function(_0x14b25b){if(_0x14b25b){return _0x952417[_0x6a37('0x17')](_0x121f19)[_0x6a37('0x18')](_0x14b25b);}};}function respondWithFilteredResult(_0x38181a,_0x3d4df3){return function(_0x6b525a){if(_0x6b525a){var _0x3ecd35=_0x6b525a[_0x6a37('0x19')],_0x22fc54=_0x3d4df3[_0x6a37('0x1a')],_0x4f91df=_0x3d4df3[_0x6a37('0x1a')]+_0x3d4df3[_0x6a37('0x1b')],_0x4b4e57;if(_0x4f91df>=_0x3ecd35){_0x4f91df=_0x3ecd35;_0x4b4e57=0xc8;}else{_0x4b4e57=0xce;}_0x38181a['status'](_0x4b4e57);return _0x38181a[_0x6a37('0x1c')]('Content-Range',_0x22fc54+'-'+_0x4f91df+'/'+_0x3ecd35)['json'](_0x6b525a);}return null;};}function patchUpdates(_0x7cfc81){return function(_0x1390fe){try{jsonpatch[_0x6a37('0x1d')](_0x1390fe,_0x7cfc81,!![]);}catch(_0x36b264){return BPromise[_0x6a37('0x1e')](_0x36b264);}return _0x1390fe[_0x6a37('0x1f')]();};}function saveUpdates(_0x135352,_0x4dbb3b){return function(_0x37b38d){if(_0x37b38d){return _0x37b38d[_0x6a37('0x20')](_0x135352)[_0x6a37('0x21')](function(_0x13fc84){return _0x13fc84;});}return null;};}function removeEntity(_0x460324,_0x2735d8){return function(_0x3d5dd9){if(_0x3d5dd9){return _0x3d5dd9['destroy']()[_0x6a37('0x21')](function(){var _0xf8d82d=_0x3d5dd9[_0x6a37('0x22')]({'plain':!![]});var _0x187ebb=_0x6a37('0x23');return db[_0x6a37('0x24')][_0x6a37('0x25')]({'where':{'type':_0x187ebb,'resourceId':_0xf8d82d['id']}})[_0x6a37('0x21')](function(){return _0x3d5dd9;});})[_0x6a37('0x21')](function(){_0x460324[_0x6a37('0x17')](0xcc)[_0x6a37('0x26')]();});}};}function handleEntityNotFound(_0x1a45dd,_0x46e8db){return function(_0x205953){if(!_0x205953){_0x1a45dd[_0x6a37('0x16')](0x194);}return _0x205953;};}function handleError(_0x18f076,_0x2398d9){_0x2398d9=_0x2398d9||0x1f4;return function(_0x1bf83b){logger[_0x6a37('0x27')](_0x1bf83b['stack']);if(_0x1bf83b['name']){delete _0x1bf83b[_0x6a37('0x28')];}_0x18f076[_0x6a37('0x17')](_0x2398d9)[_0x6a37('0x29')](_0x1bf83b);};}exports[_0x6a37('0x2a')]=function(_0x1a5cf0,_0x38c4ae){var _0x1bcfcc={},_0x21977b={},_0x17c272={'count':0x0,'rows':[]};var _0x390f4c=_['map'](db[_0x6a37('0x2b')]['rawAttributes'],function(_0x58df5b){return{'name':_0x58df5b[_0x6a37('0x2c')],'type':_0x58df5b[_0x6a37('0x2d')][_0x6a37('0x2e')]};});_0x21977b[_0x6a37('0x2f')]=_['map'](_0x390f4c,_0x6a37('0x28'));_0x21977b[_0x6a37('0x30')]=_[_0x6a37('0x31')](_0x1a5cf0['query']);_0x21977b[_0x6a37('0x32')]=_[_0x6a37('0x33')](_0x21977b[_0x6a37('0x2f')],_0x21977b[_0x6a37('0x30')]);_0x1bcfcc[_0x6a37('0x34')]=_[_0x6a37('0x33')](_0x21977b[_0x6a37('0x2f')],qs[_0x6a37('0x35')](_0x1a5cf0['query'][_0x6a37('0x35')]));_0x1bcfcc[_0x6a37('0x34')]=_0x1bcfcc[_0x6a37('0x34')]['length']?_0x1bcfcc[_0x6a37('0x34')]:_0x21977b['model'];if(!_0x1a5cf0[_0x6a37('0x30')][_0x6a37('0x36')](_0x6a37('0x37'))){_0x1bcfcc[_0x6a37('0x1b')]=qs['limit'](_0x1a5cf0['query'][_0x6a37('0x1b')]);_0x1bcfcc['offset']=qs[_0x6a37('0x1a')](_0x1a5cf0['query'][_0x6a37('0x1a')]);}_0x1bcfcc[_0x6a37('0x38')]=qs['sort'](_0x1a5cf0[_0x6a37('0x30')][_0x6a37('0x39')]);_0x1bcfcc[_0x6a37('0x3a')]=qs[_0x6a37('0x32')](_[_0x6a37('0x3b')](_0x1a5cf0[_0x6a37('0x30')],_0x21977b[_0x6a37('0x32')]),_0x390f4c);if(_0x1a5cf0['query']['filter']){_0x1bcfcc[_0x6a37('0x3a')]=_[_0x6a37('0x3c')](_0x1bcfcc[_0x6a37('0x3a')],{'$or':_['map'](_0x390f4c,function(_0x433d4c){if(_0x433d4c['type']!=='VIRTUAL'){var _0x5bda31={};_0x5bda31[_0x433d4c['name']]={'$like':'%'+_0x1a5cf0[_0x6a37('0x30')]['filter']+'%'};return _0x5bda31;}})});}_0x1bcfcc=_['merge']({},_0x1bcfcc,_0x1a5cf0[_0x6a37('0x3d')]);var _0x29b99b={'where':_0x1bcfcc[_0x6a37('0x3a')]};return db[_0x6a37('0x2b')][_0x6a37('0x19')](_0x29b99b)[_0x6a37('0x21')](function(_0x199176){_0x17c272[_0x6a37('0x19')]=_0x199176;if(_0x1a5cf0['query']['includeAll']){_0x1bcfcc[_0x6a37('0x3e')]=[{'all':!![]}];}return db['FaxQueue'][_0x6a37('0x3f')](_0x1bcfcc);})[_0x6a37('0x21')](function(_0x39b05c){_0x17c272[_0x6a37('0x40')]=_0x39b05c;return _0x17c272;})[_0x6a37('0x21')](respondWithFilteredResult(_0x38c4ae,_0x1bcfcc))['catch'](handleError(_0x38c4ae,null));};exports[_0x6a37('0x41')]=function(_0x52d624,_0x18c5e0){var _0x3f94e1={'raw':!![],'where':{'id':_0x52d624[_0x6a37('0x42')]['id']}},_0x485bcb={};_0x485bcb['model']=_[_0x6a37('0x31')](db[_0x6a37('0x2b')][_0x6a37('0x43')]);_0x485bcb[_0x6a37('0x30')]=_[_0x6a37('0x31')](_0x52d624[_0x6a37('0x30')]);_0x485bcb[_0x6a37('0x32')]=_[_0x6a37('0x33')](_0x485bcb['model'],_0x485bcb[_0x6a37('0x30')]);_0x3f94e1[_0x6a37('0x34')]=_[_0x6a37('0x33')](_0x485bcb[_0x6a37('0x2f')],qs[_0x6a37('0x35')](_0x52d624[_0x6a37('0x30')][_0x6a37('0x35')]));_0x3f94e1[_0x6a37('0x34')]=_0x3f94e1[_0x6a37('0x34')]['length']?_0x3f94e1[_0x6a37('0x34')]:_0x485bcb['model'];if(_0x52d624[_0x6a37('0x30')][_0x6a37('0x44')]){_0x3f94e1[_0x6a37('0x3e')]=[{'all':!![]}];}_0x3f94e1=_[_0x6a37('0x3c')]({},_0x3f94e1,_0x52d624[_0x6a37('0x3d')]);return db[_0x6a37('0x2b')][_0x6a37('0x45')](_0x3f94e1)['then'](handleEntityNotFound(_0x18c5e0,null))[_0x6a37('0x21')](respondWithResult(_0x18c5e0,null))[_0x6a37('0x46')](handleError(_0x18c5e0,null));};exports[_0x6a37('0x47')]=function(_0x321545,_0x58c63c){return db[_0x6a37('0x2b')][_0x6a37('0x47')](_0x321545[_0x6a37('0x48')],{})[_0x6a37('0x21')](function(_0x5bdd4b){var _0x50ffc8=_0x321545['user'][_0x6a37('0x22')]({'plain':!![]});if(!_0x50ffc8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50ffc8[_0x6a37('0x49')]===_0x6a37('0x4a')){var _0x41baf1=_0x5bdd4b[_0x6a37('0x22')]({'plain':!![]});var _0x594da8=_0x6a37('0x23');return db[_0x6a37('0x4b')][_0x6a37('0x45')]({'where':{'name':_0x594da8,'userProfileId':_0x50ffc8[_0x6a37('0x4c')]},'raw':!![]})[_0x6a37('0x21')](function(_0x5cd706){if(_0x5cd706&&_0x5cd706[_0x6a37('0x4d')]===0x0){return db[_0x6a37('0x24')]['create']({'name':_0x41baf1[_0x6a37('0x28')],'resourceId':_0x41baf1['id'],'type':_0x5cd706[_0x6a37('0x28')],'sectionId':_0x5cd706['id']},{})[_0x6a37('0x21')](function(){return _0x5bdd4b;});}else{return _0x5bdd4b;}})[_0x6a37('0x46')](function(_0x4bea20){logger[_0x6a37('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bea20);throw _0x4bea20;});}return _0x5bdd4b;})[_0x6a37('0x21')](respondWithResult(_0x58c63c,0xc9))[_0x6a37('0x46')](handleError(_0x58c63c,null));};exports[_0x6a37('0x20')]=function(_0x56de44,_0x1377b2){if(_0x56de44[_0x6a37('0x48')]['id']){delete _0x56de44['body']['id'];}return db[_0x6a37('0x2b')][_0x6a37('0x45')]({'where':{'id':_0x56de44[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](handleEntityNotFound(_0x1377b2,null))[_0x6a37('0x21')](saveUpdates(_0x56de44['body'],null))[_0x6a37('0x21')](respondWithResult(_0x1377b2,null))[_0x6a37('0x46')](handleError(_0x1377b2,null));};exports[_0x6a37('0x25')]=function(_0x1aa623,_0x277ae8){return db[_0x6a37('0x2b')]['find']({'where':{'id':_0x1aa623['params']['id']}})['then'](handleEntityNotFound(_0x277ae8,null))['then'](removeEntity(_0x277ae8,null))[_0x6a37('0x46')](handleError(_0x277ae8,null));};exports[_0x6a37('0x4e')]=function(_0x1f1a36,_0xd40201){return db[_0x6a37('0x2b')][_0x6a37('0x4e')]()[_0x6a37('0x21')](respondWithResult(_0xd40201,null))[_0x6a37('0x46')](handleError(_0xd40201,null));};exports[_0x6a37('0x4f')]=function(_0x4421a0,_0x2316e4,_0x23556d){var _0x45b10d={'raw':!![],'where':{}},_0x2e30d7={},_0x246a2e;return db['FaxQueue'][_0x6a37('0x50')]({'where':{'id':_0x4421a0[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](handleEntityNotFound(_0x2316e4,null))[_0x6a37('0x21')](function(_0x3f8bef){if(_0x3f8bef){_0x246a2e=_0x3f8bef[_0x6a37('0x22')]({'plain':!![]});_0x2e30d7['model']=_[_0x6a37('0x31')](db[_0x6a37('0x51')]['rawAttributes']);_0x2e30d7[_0x6a37('0x30')]=_[_0x6a37('0x31')](_0x4421a0[_0x6a37('0x30')]);_0x2e30d7[_0x6a37('0x32')]=_['intersection'](_0x2e30d7[_0x6a37('0x2f')],_0x2e30d7[_0x6a37('0x30')]);_0x45b10d[_0x6a37('0x34')]=_[_0x6a37('0x33')](_0x2e30d7[_0x6a37('0x2f')],qs[_0x6a37('0x35')](_0x4421a0[_0x6a37('0x30')][_0x6a37('0x35')]));_0x45b10d[_0x6a37('0x34')]=_0x45b10d['attributes'][_0x6a37('0x52')]?_0x45b10d[_0x6a37('0x34')]:_0x2e30d7[_0x6a37('0x2f')];if(!_0x4421a0[_0x6a37('0x30')][_0x6a37('0x36')]('nolimit')){_0x45b10d['limit']=qs[_0x6a37('0x1b')](_0x4421a0[_0x6a37('0x30')][_0x6a37('0x1b')]);_0x45b10d['offset']=qs['offset'](_0x4421a0['query']['offset']);}_0x45b10d[_0x6a37('0x38')]=qs[_0x6a37('0x39')](_0x4421a0['query'][_0x6a37('0x39')]);_0x45b10d[_0x6a37('0x3a')]=qs['filters'](_[_0x6a37('0x3b')](_0x4421a0['query'],_0x2e30d7[_0x6a37('0x32')]));_0x45b10d[_0x6a37('0x3a')]['FaxQueueId']=_0x3f8bef['id'];if(_0x4421a0['query']['filter']){_0x45b10d[_0x6a37('0x3a')]=_['merge'](_0x45b10d[_0x6a37('0x3a')],{'$or':_[_0x6a37('0x53')](_0x45b10d[_0x6a37('0x34')],function(_0x5964a1){var _0x22ad9={};_0x22ad9[_0x5964a1]={'$like':'%'+_0x4421a0['query']['filter']+'%'};return _0x22ad9;})});}_0x45b10d=_[_0x6a37('0x3c')]({},_0x45b10d,_0x4421a0[_0x6a37('0x3d')]);return db['UserFaxQueue']['findAll'](_0x45b10d);}})[_0x6a37('0x21')](function(_0x137299){if(_0x137299){return db[_0x6a37('0x54')]['findAndCountAll']({'where':{'id':_[_0x6a37('0x53')](_0x137299,'UserId'),'role':_0x6a37('0x55')},'attributes':['id',_0x6a37('0x28'),_0x6a37('0x56'),_0x6a37('0x57'),_0x6a37('0x58')]});}})[_0x6a37('0x21')](function(_0x17d91c){if(_0x17d91c){return{'count':_0x17d91c[_0x6a37('0x19')],'rows':_[_0x6a37('0x53')](_0x17d91c['rows'],function(_0x473d8e){return{'membername':_0x473d8e[_0x6a37('0x28')],'UserId':_0x473d8e['id'],'queue_name':_0x246a2e['name'],'FaxQueueId':_0x246a2e['id'],'interface':util[_0x6a37('0x59')](_0x6a37('0x5a'),_0x6a37('0x5b'),_0x473d8e['name']),'penalty':0x0,'paused':_0x473d8e[_0x6a37('0x56')],'createdAt':_0x473d8e['createdAt'],'updatedAt':_0x473d8e[_0x6a37('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2316e4,_0x45b10d))['catch'](handleError(_0x2316e4,null));};exports['getTeams']=function(_0x404b5a,_0x28a777,_0x2732c0){var _0x4fa9bb={};var _0x486ffc={};var _0x39acd1;var _0x19ee3e;return db['FaxQueue'][_0x6a37('0x50')]({'where':{'id':_0x404b5a[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](handleEntityNotFound(_0x28a777,null))['then'](function(_0x4aeb45){if(_0x4aeb45){_0x39acd1=_0x4aeb45;_0x486ffc['model']=_[_0x6a37('0x31')](db['Team'][_0x6a37('0x43')]);_0x486ffc[_0x6a37('0x30')]=_[_0x6a37('0x31')](_0x404b5a[_0x6a37('0x30')]);_0x486ffc[_0x6a37('0x32')]=_[_0x6a37('0x33')](_0x486ffc[_0x6a37('0x2f')],_0x486ffc[_0x6a37('0x30')]);_0x4fa9bb[_0x6a37('0x34')]=_[_0x6a37('0x33')](_0x486ffc[_0x6a37('0x2f')],qs[_0x6a37('0x35')](_0x404b5a[_0x6a37('0x30')][_0x6a37('0x35')]));_0x4fa9bb[_0x6a37('0x34')]=_0x4fa9bb['attributes'][_0x6a37('0x52')]?_0x4fa9bb[_0x6a37('0x34')]:_0x486ffc[_0x6a37('0x2f')];_0x4fa9bb['order']=qs[_0x6a37('0x39')](_0x404b5a['query'][_0x6a37('0x39')]);_0x4fa9bb[_0x6a37('0x3a')]=qs[_0x6a37('0x32')](_[_0x6a37('0x3b')](_0x404b5a[_0x6a37('0x30')],_0x486ffc[_0x6a37('0x32')]));if(_0x404b5a[_0x6a37('0x30')][_0x6a37('0x5c')]){_0x4fa9bb['where']=_['merge'](_0x4fa9bb['where'],{'$or':_[_0x6a37('0x53')](_0x4fa9bb[_0x6a37('0x34')],function(_0x407bf5){var _0x532e2e={};_0x532e2e[_0x407bf5]={'$like':'%'+_0x404b5a['query'][_0x6a37('0x5c')]+'%'};return _0x532e2e;})});}_0x4fa9bb=_[_0x6a37('0x3c')]({},_0x4fa9bb,_0x404b5a[_0x6a37('0x3d')]);return _0x39acd1[_0x6a37('0x5d')](_0x4fa9bb);}})[_0x6a37('0x21')](function(_0x28a8b5){if(_0x28a8b5){_0x19ee3e=_0x28a8b5['length'];if(!_0x404b5a[_0x6a37('0x30')][_0x6a37('0x36')](_0x6a37('0x37'))){_0x4fa9bb[_0x6a37('0x1b')]=qs[_0x6a37('0x1b')](_0x404b5a['query'][_0x6a37('0x1b')]);_0x4fa9bb[_0x6a37('0x1a')]=qs['offset'](_0x404b5a['query']['offset']);}return _0x39acd1[_0x6a37('0x5d')](_0x4fa9bb);}})[_0x6a37('0x21')](function(_0x28f602){if(_0x28f602){return _0x28f602?{'count':_0x19ee3e,'rows':_0x28f602}:null;}})['then'](respondWithResult(_0x28a777,null))[_0x6a37('0x46')](handleError(_0x28a777,null));};exports[_0x6a37('0x5e')]=function(_0x432410,_0x377035,_0x260ceb){var _0x45eb20=_0x432410[_0x6a37('0x48')][_0x6a37('0x5f')];return db[_0x6a37('0x60')][_0x6a37('0x3f')]({'where':{'id':_0x45eb20},'attributes':['id'],'include':[{'model':db[_0x6a37('0x54')],'as':_0x6a37('0x61'),'attributes':['id',_0x6a37('0x28'),'online',_0x6a37('0x62'),_0x6a37('0x63')],'raw':!![]}]})[_0x6a37('0x21')](function(_0x50d1a5){if(_0x50d1a5){var _0x47f7ed=_['flatMap'](_0x50d1a5,function(_0x3f435d){var _0x33a511=_0x3f435d[_0x6a37('0x22')]({'plain':!![]});return _0x33a511[_0x6a37('0x61')];});return db['FaxQueue']['find']({'where':{'id':_0x432410[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](function(_0x6f0f97){return db[_0x6a37('0x64')][_0x6a37('0x65')](function(_0x174f48){return _0x6f0f97[_0x6a37('0x5e')](_0x45eb20,{'transaction':_0x174f48})[_0x6a37('0x21')](function(){return BPromise['each'](_0x47f7ed,function(_0x7d4e57){return db[_0x6a37('0x51')][_0x6a37('0x66')]({'where':{'UserId':_0x7d4e57['id'],'FaxQueueId':_0x432410[_0x6a37('0x42')]['id']},'transaction':_0x174f48});});})[_0x6a37('0x21')](function(){_0x47f7ed['forEach'](function(_0x2fb9ec){socket[_0x6a37('0x67')](_0x6a37('0x68'),{'UserId':_0x2fb9ec['id'],'FaxQueueId':_0x6f0f97['id']});});});});});}})[_0x6a37('0x21')](respondWithStatusCode(_0x377035,null))['catch'](handleError(_0x377035,null));};exports[_0x6a37('0x69')]=function(_0x33a94e,_0xa1ee9b,_0x34012d){return db[_0x6a37('0x60')][_0x6a37('0x3f')]({'where':{'id':_0x33a94e[_0x6a37('0x30')][_0x6a37('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x6a37('0x54')],'as':_0x6a37('0x61'),'attributes':['id'],'raw':!![]}]})[_0x6a37('0x21')](handleEntityNotFound(_0xa1ee9b,null))[_0x6a37('0x21')](function(_0x55abc7){var _0x21e228=_[_0x6a37('0x53')](_0x55abc7,'id');var _0x3f3325=[];var _0x4a137d=[];var _0xf02f41=squel['select']();_0xf02f41[_0x6a37('0x6a')]('tq.TeamId')[_0x6a37('0x6b')](_0x6a37('0x6c'),'tq')[_0x6a37('0x6d')](_0x6a37('0x6e'),'ut',_0x6a37('0x6f'))[_0x6a37('0x3a')](_0x6a37('0x70'),_0x33a94e['params']['id']);for(var _0xe3c893=0x0;_0xe3c893<_0x55abc7['length'];_0xe3c893+=0x1){let _0x5096b6=_0x55abc7[_0xe3c893];for(var _0xa6343f=0x0;_0xa6343f<_0x5096b6[_0x6a37('0x61')][_0x6a37('0x52')];_0xa6343f+=0x1){let _0x9e8533=_0x5096b6['Agents'][_0xa6343f];var _0x38393e=_0xf02f41[_0x6a37('0x71')]();_0x38393e[_0x6a37('0x3a')](_0x6a37('0x72'),_0x9e8533['id']);_0x4a137d[_0x6a37('0x73')](db[_0x6a37('0x64')][_0x6a37('0x30')](_0x38393e['toString'](),{'type':db[_0x6a37('0x64')][_0x6a37('0x74')]['SELECT']})['then'](function(_0x4148eb){if(_0x4148eb[_0x6a37('0x52')]===0x1){return _0x9e8533['id'];}else{var _0xfa9c99=_[_0x6a37('0x75')](_['map'](_0x4148eb,_0x6a37('0x76')),function(_0x506e28){return _[_0x6a37('0x77')](_0x21e228,_0x506e28);});if(_0xfa9c99){return _0x9e8533['id'];}}}));}}return BPromise[_0x6a37('0x78')](_0x4a137d)[_0x6a37('0x21')](function(_0x48af59){_0x3f3325=_(_0x3f3325)['union'](_0x48af59)[_0x6a37('0x79')]()['value']();return db[_0x6a37('0x2b')][_0x6a37('0x45')]({'where':{'id':_0x33a94e[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](function(_0x1c5987){return db[_0x6a37('0x64')][_0x6a37('0x65')](function(_0x4c3efb){return _0x1c5987['removeTeams'](_0x33a94e['query'][_0x6a37('0x5f')],{'transaction':_0x4c3efb})['then'](function(){if(!_[_0x6a37('0x7a')](_0x3f3325)){return _0x1c5987[_0x6a37('0x7b')](_0x3f3325,{'transaction':_0x4c3efb});}})['then'](function(){_0x3f3325[_0x6a37('0x7c')](function(_0x50cd63){socket[_0x6a37('0x67')]('userFaxQueue:remove',{'UserId':_0x50cd63,'FaxQueueId':_0x1c5987['id']});});});});});});})[_0x6a37('0x21')](respondWithStatusCode(_0xa1ee9b,null))[_0x6a37('0x46')](handleError(_0xa1ee9b,null));};exports[_0x6a37('0x7d')]=function(_0x446ced,_0x1039b7,_0x21e3c1){return db[_0x6a37('0x2b')]['find']({'where':{'id':_0x446ced[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](handleEntityNotFound(_0x1039b7,null))[_0x6a37('0x21')](function(_0x357615){if(_0x357615){return _0x357615[_0x6a37('0x7d')](_0x446ced[_0x6a37('0x48')][_0x6a37('0x5f')],_[_0x6a37('0x7e')](_0x446ced[_0x6a37('0x48')],[_0x6a37('0x5f'),'id'])||{})['spread'](function(_0x10eb33){for(var _0x33b6a3=0x0;_0x33b6a3<_0x446ced[_0x6a37('0x48')][_0x6a37('0x5f')]['length'];_0x33b6a3+=0x1){socket[_0x6a37('0x67')](_0x6a37('0x68'),{'UserId':_0x446ced['body'][_0x6a37('0x5f')][_0x33b6a3],'FaxQueueId':_0x446ced[_0x6a37('0x42')]['id']});}return _0x10eb33;});}})[_0x6a37('0x21')](respondWithResult(_0x1039b7,null))[_0x6a37('0x46')](handleError(_0x1039b7,null));};exports['removeAgents']=function(_0x1edb65,_0x1f3985,_0x1542fc){return db[_0x6a37('0x2b')][_0x6a37('0x45')]({'where':{'id':_0x1edb65['params']['id']}})[_0x6a37('0x21')](handleEntityNotFound(_0x1f3985,null))[_0x6a37('0x21')](function(_0x3c6abd){if(_0x3c6abd){return _0x3c6abd[_0x6a37('0x7b')](_0x1edb65['query'][_0x6a37('0x5f')])[_0x6a37('0x21')](function(){if(_[_0x6a37('0x7f')](_0x1edb65[_0x6a37('0x30')][_0x6a37('0x5f')])){for(var _0x2942bb=0x0;_0x2942bb<_0x1edb65[_0x6a37('0x30')][_0x6a37('0x5f')][_0x6a37('0x52')];_0x2942bb+=0x1){socket[_0x6a37('0x67')]('userFaxQueue:remove',{'UserId':Number(_0x1edb65[_0x6a37('0x30')]['ids'][_0x2942bb]),'FaxQueueId':Number(_0x1edb65[_0x6a37('0x42')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x1edb65['query']['ids']),'FaxQueueId':Number(_0x1edb65[_0x6a37('0x42')]['id'])});}});}})[_0x6a37('0x21')](respondWithStatusCode(_0x1f3985,null))[_0x6a37('0x46')](handleError(_0x1f3985,null));};exports[_0x6a37('0x80')]=function(_0x40753b,_0x2aec42,_0xfdb258){var _0x3befb9={};var _0x386a15={};var _0x144791;var _0x478248;return db[_0x6a37('0x2b')][_0x6a37('0x50')]({'where':{'id':_0x40753b[_0x6a37('0x42')]['id']}})[_0x6a37('0x21')](handleEntityNotFound(_0x2aec42,null))[_0x6a37('0x21')](function(_0x1bf62f){if(_0x1bf62f){_0x144791=_0x1bf62f;_0x386a15[_0x6a37('0x2f')]=_[_0x6a37('0x31')](db[_0x6a37('0x54')]['rawAttributes']);_0x386a15[_0x6a37('0x30')]=_['keys'](_0x40753b[_0x6a37('0x30')]);_0x386a15[_0x6a37('0x32')]=_['intersection'](_0x386a15['model'],_0x386a15['query']);_0x3befb9[_0x6a37('0x34')]=_[_0x6a37('0x33')](_0x386a15[_0x6a37('0x2f')],qs[_0x6a37('0x35')](_0x40753b[_0x6a37('0x30')][_0x6a37('0x35')]));_0x3befb9[_0x6a37('0x34')]=_0x3befb9[_0x6a37('0x34')][_0x6a37('0x52')]?_0x3befb9[_0x6a37('0x34')]:_0x386a15['model'];_0x3befb9[_0x6a37('0x38')]=qs[_0x6a37('0x39')](_0x40753b[_0x6a37('0x30')][_0x6a37('0x39')]);_0x3befb9[_0x6a37('0x3a')]=qs[_0x6a37('0x32')](_[_0x6a37('0x3b')](_0x40753b[_0x6a37('0x30')],_0x386a15[_0x6a37('0x32')]));if(_0x40753b[_0x6a37('0x30')][_0x6a37('0x5c')]){_0x3befb9[_0x6a37('0x3a')]=_['merge'](_0x3befb9[_0x6a37('0x3a')],{'$or':_['map'](_0x3befb9['attributes'],function(_0x40886f){var _0x4c0aa9={};_0x4c0aa9[_0x40886f]={'$like':'%'+_0x40753b[_0x6a37('0x30')]['filter']+'%'};return _0x4c0aa9;})});}_0x3befb9=_[_0x6a37('0x3c')]({},_0x3befb9,_0x40753b[_0x6a37('0x3d')]);return _0x144791['getAgents'](_0x3befb9);}})[_0x6a37('0x21')](function(_0x38d26a){if(_0x38d26a){_0x478248=_0x38d26a[_0x6a37('0x52')];if(!_0x40753b['query']['hasOwnProperty'](_0x6a37('0x37'))){_0x3befb9[_0x6a37('0x1b')]=qs[_0x6a37('0x1b')](_0x40753b[_0x6a37('0x30')][_0x6a37('0x1b')]);_0x3befb9[_0x6a37('0x1a')]=qs[_0x6a37('0x1a')](_0x40753b[_0x6a37('0x30')][_0x6a37('0x1a')]);}return _0x144791[_0x6a37('0x80')](_0x3befb9);}})['then'](function(_0x1a2077){if(_0x1a2077){return _0x1a2077?{'count':_0x478248,'rows':_0x1a2077}:null;}})[_0x6a37('0x21')](respondWithResult(_0x2aec42,null))[_0x6a37('0x46')](handleError(_0x2aec42,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7d2d881..003bbd3 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 _0x37f5=['hook','events','FaxQueue','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x1b475d,_0x4f9318){var _0x592d40=function(_0x59d115){while(--_0x59d115){_0x1b475d['push'](_0x1b475d['shift']());}};_0x592d40(++_0x4f9318);}(_0x37f5,0xe1));var _0x537f=function(_0x42f844,_0x2d13b8){_0x42f844=_0x42f844-0x0;var _0x4caf18=_0x37f5[_0x42f844];return _0x4caf18;};'use strict';var EventEmitter=require(_0x537f('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x537f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x537f('0x2')](0x0);var events={'afterCreate':_0x537f('0x3'),'afterUpdate':_0x537f('0x4'),'afterDestroy':_0x537f('0x5')};function emitEvent(_0x34f73c){return function(_0xbf0226,_0x17d631,_0x39bff1){FaxQueueEvents['emit'](_0x34f73c+':'+_0xbf0226['id'],_0xbf0226);FaxQueueEvents['emit'](_0x34f73c,_0xbf0226);_0x39bff1(null);};}for(var e in events){if(events[_0x537f('0x6')](e)){var event=events[e];FaxQueue[_0x537f('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x1959=['remove','emit','hasOwnProperty','hook','events','FaxQueue','setMaxListeners','save','update'];(function(_0x5b28b6,_0x1d1650){var _0x1e7684=function(_0x4db583){while(--_0x4db583){_0x5b28b6['push'](_0x5b28b6['shift']());}};_0x1e7684(++_0x1d1650);}(_0x1959,0x13f));var _0x9195=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x1959[_0x186376];return _0x2dbdd9;};'use strict';var EventEmitter=require(_0x9195('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x9195('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9195('0x2')](0x0);var events={'afterCreate':_0x9195('0x3'),'afterUpdate':_0x9195('0x4'),'afterDestroy':_0x9195('0x5')};function emitEvent(_0x8ecf5b){return function(_0x24ce6d,_0x4334f6,_0x494033){FaxQueueEvents[_0x9195('0x6')](_0x8ecf5b+':'+_0x24ce6d['id'],_0x24ce6d);FaxQueueEvents[_0x9195('0x6')](_0x8ecf5b,_0x24ce6d);_0x494033(null);};}for(var e in events){if(events[_0x9195('0x7')](e)){var event=events[e];FaxQueue[_0x9195('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 52abc97..e559bf6 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 _0x31e8=['moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api'];(function(_0xd899bf,_0x4d53ca){var _0x15100c=function(_0x5270c8){while(--_0x5270c8){_0xd899bf['push'](_0xd899bf['shift']());}};_0x15100c(++_0x4d53ca);}(_0x31e8,0xf4));var _0x831e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x31e8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x831e('0x0'));var util=require(_0x831e('0x1'));var logger=require('../../config/logger')(_0x831e('0x2'));var moment=require(_0x831e('0x3'));var BPromise=require(_0x831e('0x4'));var rp=require(_0x831e('0x5'));var fs=require('fs');var path=require(_0x831e('0x6'));var rimraf=require('rimraf');var config=require(_0x831e('0x7'));var attributes=require(_0x831e('0x8'));module[_0x831e('0x9')]=function(_0x32285c,_0x5105b2){return _0x32285c[_0x831e('0xa')](_0x831e('0xb'),attributes,{'tableName':_0x831e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6e8=['moment','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','api'];(function(_0x141993,_0x5cd8c2){var _0x55203a=function(_0x1797cd){while(--_0x1797cd){_0x141993['push'](_0x141993['shift']());}};_0x55203a(++_0x5cd8c2);}(_0xc6e8,0x18e));var _0x8c6e=function(_0x1cc027,_0x48531e){_0x1cc027=_0x1cc027-0x0;var _0x22f100=_0xc6e8[_0x1cc027];return _0x22f100;};'use strict';var _=require('lodash');var util=require(_0x8c6e('0x0'));var logger=require('../../config/logger')(_0x8c6e('0x1'));var moment=require(_0x8c6e('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c6e('0x3'));var fs=require('fs');var path=require(_0x8c6e('0x4'));var rimraf=require('rimraf');var config=require(_0x8c6e('0x5'));var attributes=require(_0x8c6e('0x6'));module[_0x8c6e('0x7')]=function(_0x2a6d82,_0x4ae2a2){return _0x2a6d82[_0x8c6e('0x8')]('FaxQueue',attributes,{'tableName':_0x8c6e('0x9'),'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 d3909ea..3c4c152 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 _0xf9c6=['./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueue','options','where','limit','include','model','map','attributes','info','GetFaxQueue','ShowFaxQueue','find','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x1ba543,_0x52e77c){var _0xa404eb=function(_0x94a683){while(--_0x94a683){_0x1ba543['push'](_0x1ba543['shift']());}};_0xa404eb(++_0x52e77c);}(_0xf9c6,0x8b));var _0x6f9c=function(_0x3e3a06,_0x3ec73b){_0x3e3a06=_0x3e3a06-0x0;var _0x45e335=_0xf9c6[_0x3e3a06];return _0x45e335;};'use strict';var _=require(_0x6f9c('0x0'));var util=require(_0x6f9c('0x1'));var moment=require(_0x6f9c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f9c('0x3'));var db=require(_0x6f9c('0x4'))['db'];var utils=require(_0x6f9c('0x5'));var logger=require(_0x6f9c('0x6'))(_0x6f9c('0x7'));var config=require(_0x6f9c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6f9c('0x9')]=_[_0x6f9c('0xa')](config[_0x6f9c('0x9')],{'host':_0x6f9c('0xb'),'port':0x18eb});var socket=require(_0x6f9c('0xc'))(new Redis(config[_0x6f9c('0x9')]));require(_0x6f9c('0xd'))[_0x6f9c('0xe')](socket);function respondWithRpcPromise(_0x4735d3,_0x4dc2a5,_0x1636e9){return new BPromise(function(_0x5b5dbb,_0x458b46){return client['request'](_0x4735d3,_0x1636e9)[_0x6f9c('0xf')](function(_0x4ad71d){logger['info'](_0x6f9c('0x10'),_0x4dc2a5,_0x6f9c('0x11'));logger[_0x6f9c('0x12')](_0x6f9c('0x13'),_0x4dc2a5,_0x6f9c('0x11'),JSON[_0x6f9c('0x14')](_0x4ad71d));if(_0x4ad71d[_0x6f9c('0x15')]){if(_0x4ad71d[_0x6f9c('0x15')]['code']===0x1f4){logger[_0x6f9c('0x15')](_0x6f9c('0x10'),_0x4dc2a5,_0x4ad71d[_0x6f9c('0x15')]['message']);return _0x458b46(_0x4ad71d[_0x6f9c('0x15')][_0x6f9c('0x16')]);}logger[_0x6f9c('0x15')](_0x6f9c('0x10'),_0x4dc2a5,_0x4ad71d[_0x6f9c('0x15')][_0x6f9c('0x16')]);return _0x5b5dbb(_0x4ad71d['error'][_0x6f9c('0x16')]);}else{logger['info'](_0x6f9c('0x10'),_0x4dc2a5,_0x6f9c('0x11'));_0x5b5dbb(_0x4ad71d[_0x6f9c('0x17')][_0x6f9c('0x16')]);}})[_0x6f9c('0x18')](function(_0x4d0a5d){logger[_0x6f9c('0x15')](_0x6f9c('0x10'),_0x4dc2a5,_0x4d0a5d);_0x458b46(_0x4d0a5d);});});}exports['GetFaxQueue']=function(_0x275577){var _0x390312=this;return new Promise(function(_0x3917eb,_0x5617a9){return db[_0x6f9c('0x19')]['findAll']({'raw':_0x275577[_0x6f9c('0x1a')]?_0x275577[_0x6f9c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x275577['options']?_0x275577[_0x6f9c('0x1a')][_0x6f9c('0x1b')]||null:null,'attributes':_0x275577[_0x6f9c('0x1a')]?_0x275577['options']['attributes']||null:null,'limit':_0x275577[_0x6f9c('0x1a')]?_0x275577['options'][_0x6f9c('0x1c')]||null:null,'include':_0x275577[_0x6f9c('0x1a')]?_0x275577['options'][_0x6f9c('0x1d')]?_['map'](_0x275577['options'][_0x6f9c('0x1d')],function(_0x5aa899){return{'model':db[_0x5aa899[_0x6f9c('0x1e')]],'as':_0x5aa899['as'],'attributes':_0x5aa899['attributes'],'include':_0x5aa899['include']?_[_0x6f9c('0x1f')](_0x5aa899['include'],function(_0x5f1cf1){return{'model':db[_0x5f1cf1[_0x6f9c('0x1e')]],'as':_0x5f1cf1['as'],'attributes':_0x5f1cf1[_0x6f9c('0x20')],'include':_0x5f1cf1['include']?_[_0x6f9c('0x1f')](_0x5f1cf1[_0x6f9c('0x1d')],function(_0x4776e0){return{'model':db[_0x4776e0[_0x6f9c('0x1e')]],'as':_0x4776e0['as'],'attributes':_0x4776e0[_0x6f9c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6f9c('0xf')](function(_0x1560ea){logger[_0x6f9c('0x21')](_0x6f9c('0x22'),_0x275577);logger[_0x6f9c('0x12')]('GetFaxQueue',_0x275577,JSON[_0x6f9c('0x14')](_0x1560ea));_0x3917eb(_0x1560ea);})[_0x6f9c('0x18')](function(_0x497ca7){logger['error'](_0x6f9c('0x22'),_0x497ca7[_0x6f9c('0x16')],_0x275577);_0x5617a9(_0x390312[_0x6f9c('0x15')](0x1f4,_0x497ca7['message']));});});};exports[_0x6f9c('0x23')]=function(_0x53ec4a){var _0x43901b=this;return new Promise(function(_0x27f4e5,_0x1a987f){return db[_0x6f9c('0x19')][_0x6f9c('0x24')]({'raw':_0x53ec4a[_0x6f9c('0x1a')]?_0x53ec4a[_0x6f9c('0x1a')][_0x6f9c('0x25')]===undefined?!![]:![]:!![],'where':_0x53ec4a['options']?_0x53ec4a['options'][_0x6f9c('0x1b')]||null:null,'attributes':_0x53ec4a[_0x6f9c('0x1a')]?_0x53ec4a[_0x6f9c('0x1a')][_0x6f9c('0x20')]||null:null,'include':_0x53ec4a[_0x6f9c('0x1a')]?_0x53ec4a[_0x6f9c('0x1a')]['include']?_[_0x6f9c('0x1f')](_0x53ec4a[_0x6f9c('0x1a')][_0x6f9c('0x1d')],function(_0x4df61){return{'model':db[_0x4df61['model']],'as':_0x4df61['as'],'attributes':_0x4df61['attributes'],'include':_0x4df61[_0x6f9c('0x1d')]?_[_0x6f9c('0x1f')](_0x4df61[_0x6f9c('0x1d')],function(_0x3a0dc9){return{'model':db[_0x3a0dc9['model']],'as':_0x3a0dc9['as'],'attributes':_0x3a0dc9[_0x6f9c('0x20')],'include':_0x3a0dc9['include']?_[_0x6f9c('0x1f')](_0x3a0dc9[_0x6f9c('0x1d')],function(_0x272463){return{'model':db[_0x272463[_0x6f9c('0x1e')]],'as':_0x272463['as'],'attributes':_0x272463['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f9c('0xf')](function(_0x2553a6){logger['info'](_0x6f9c('0x23'),_0x53ec4a);logger[_0x6f9c('0x12')](_0x6f9c('0x23'),_0x53ec4a,JSON[_0x6f9c('0x14')](_0x2553a6));_0x27f4e5(_0x2553a6);})[_0x6f9c('0x18')](function(_0x417828){logger[_0x6f9c('0x15')](_0x6f9c('0x23'),_0x417828[_0x6f9c('0x16')],_0x53ec4a);_0x1a987f(_0x43901b[_0x6f9c('0x15')](0x1f4,_0x417828['message']));});});}; \ No newline at end of file +var _0x34f6=['GetFaxQueue','options','raw','where','attributes','limit','map','model','include','ShowFaxQueue','FaxQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x34f6,0x1b8));var _0x634f=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0x34f6[_0x469ac7];return _0x22f3b0;};'use strict';var _=require(_0x634f('0x0'));var util=require(_0x634f('0x1'));var moment=require(_0x634f('0x2'));var BPromise=require('bluebird');var rs=require(_0x634f('0x3'));var fs=require('fs');var Redis=require(_0x634f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x634f('0x5'));var logger=require(_0x634f('0x6'))(_0x634f('0x7'));var config=require(_0x634f('0x8'));var jayson=require(_0x634f('0x9'));var client=jayson[_0x634f('0xa')][_0x634f('0xb')]({'port':0x232a});config[_0x634f('0xc')]=_[_0x634f('0xd')](config[_0x634f('0xc')],{'host':_0x634f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x634f('0xc')]));require(_0x634f('0xf'))['register'](socket);function respondWithRpcPromise(_0x4be5f3,_0x2d6901,_0x213ab4){return new BPromise(function(_0xc5af18,_0x3471e5){return client[_0x634f('0x10')](_0x4be5f3,_0x213ab4)[_0x634f('0x11')](function(_0x1a7c53){logger[_0x634f('0x12')](_0x634f('0x13'),_0x2d6901,_0x634f('0x14'));logger[_0x634f('0x15')](_0x634f('0x16'),_0x2d6901,_0x634f('0x14'),JSON[_0x634f('0x17')](_0x1a7c53));if(_0x1a7c53['error']){if(_0x1a7c53['error']['code']===0x1f4){logger[_0x634f('0x18')](_0x634f('0x13'),_0x2d6901,_0x1a7c53[_0x634f('0x18')][_0x634f('0x19')]);return _0x3471e5(_0x1a7c53[_0x634f('0x18')][_0x634f('0x19')]);}logger[_0x634f('0x18')](_0x634f('0x13'),_0x2d6901,_0x1a7c53[_0x634f('0x18')]['message']);return _0xc5af18(_0x1a7c53[_0x634f('0x18')][_0x634f('0x19')]);}else{logger[_0x634f('0x12')](_0x634f('0x13'),_0x2d6901,_0x634f('0x14'));_0xc5af18(_0x1a7c53[_0x634f('0x1a')][_0x634f('0x19')]);}})[_0x634f('0x1b')](function(_0x2520ec){logger[_0x634f('0x18')](_0x634f('0x13'),_0x2d6901,_0x2520ec);_0x3471e5(_0x2520ec);});});}exports[_0x634f('0x1c')]=function(_0x3e1d8f){var _0x5bad77=this;return new Promise(function(_0x467393,_0x65f9f9){return db['FaxQueue']['findAll']({'raw':_0x3e1d8f['options']?_0x3e1d8f[_0x634f('0x1d')][_0x634f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e1d8f[_0x634f('0x1d')]?_0x3e1d8f[_0x634f('0x1d')][_0x634f('0x1f')]||null:null,'attributes':_0x3e1d8f[_0x634f('0x1d')]?_0x3e1d8f[_0x634f('0x1d')][_0x634f('0x20')]||null:null,'limit':_0x3e1d8f['options']?_0x3e1d8f['options'][_0x634f('0x21')]||null:null,'include':_0x3e1d8f[_0x634f('0x1d')]?_0x3e1d8f[_0x634f('0x1d')]['include']?_[_0x634f('0x22')](_0x3e1d8f[_0x634f('0x1d')]['include'],function(_0x52073f){return{'model':db[_0x52073f[_0x634f('0x23')]],'as':_0x52073f['as'],'attributes':_0x52073f[_0x634f('0x20')],'include':_0x52073f[_0x634f('0x24')]?_['map'](_0x52073f[_0x634f('0x24')],function(_0x533d5f){return{'model':db[_0x533d5f[_0x634f('0x23')]],'as':_0x533d5f['as'],'attributes':_0x533d5f[_0x634f('0x20')],'include':_0x533d5f[_0x634f('0x24')]?_[_0x634f('0x22')](_0x533d5f[_0x634f('0x24')],function(_0x4d2e83){return{'model':db[_0x4d2e83[_0x634f('0x23')]],'as':_0x4d2e83['as'],'attributes':_0x4d2e83['attributes']};}):[]};}):[]};}):[]:[]})[_0x634f('0x11')](function(_0x4c61c5){logger[_0x634f('0x12')](_0x634f('0x1c'),_0x3e1d8f);logger[_0x634f('0x15')](_0x634f('0x1c'),_0x3e1d8f,JSON[_0x634f('0x17')](_0x4c61c5));_0x467393(_0x4c61c5);})[_0x634f('0x1b')](function(_0x273056){logger[_0x634f('0x18')](_0x634f('0x1c'),_0x273056[_0x634f('0x19')],_0x3e1d8f);_0x65f9f9(_0x5bad77[_0x634f('0x18')](0x1f4,_0x273056['message']));});});};exports[_0x634f('0x25')]=function(_0x4bb989){var _0x48447c=this;return new Promise(function(_0x22d8aa,_0x8e407c){return db[_0x634f('0x26')]['find']({'raw':_0x4bb989['options']?_0x4bb989[_0x634f('0x1d')][_0x634f('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bb989[_0x634f('0x1d')]?_0x4bb989[_0x634f('0x1d')]['where']||null:null,'attributes':_0x4bb989[_0x634f('0x1d')]?_0x4bb989[_0x634f('0x1d')][_0x634f('0x20')]||null:null,'include':_0x4bb989[_0x634f('0x1d')]?_0x4bb989[_0x634f('0x1d')][_0x634f('0x24')]?_['map'](_0x4bb989[_0x634f('0x1d')][_0x634f('0x24')],function(_0x478740){return{'model':db[_0x478740[_0x634f('0x23')]],'as':_0x478740['as'],'attributes':_0x478740[_0x634f('0x20')],'include':_0x478740[_0x634f('0x24')]?_[_0x634f('0x22')](_0x478740[_0x634f('0x24')],function(_0x72545c){return{'model':db[_0x72545c[_0x634f('0x23')]],'as':_0x72545c['as'],'attributes':_0x72545c[_0x634f('0x20')],'include':_0x72545c[_0x634f('0x24')]?_[_0x634f('0x22')](_0x72545c['include'],function(_0x512ca7){return{'model':db[_0x512ca7[_0x634f('0x23')]],'as':_0x512ca7['as'],'attributes':_0x512ca7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x445e2b){logger[_0x634f('0x12')](_0x634f('0x25'),_0x4bb989);logger['debug'](_0x634f('0x25'),_0x4bb989,JSON['stringify'](_0x445e2b));_0x22d8aa(_0x445e2b);})[_0x634f('0x1b')](function(_0x10bd7a){logger[_0x634f('0x18')]('ShowFaxQueue',_0x10bd7a['message'],_0x4bb989);_0x8e407c(_0x48447c['error'](0x1f4,_0x10bd7a[_0x634f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b4b0271..e61dd28 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 _0xaaf6=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x5c0f9b,_0x5a01c0){var _0x12c597=function(_0x408de9){while(--_0x408de9){_0x5c0f9b['push'](_0x5c0f9b['shift']());}};_0x12c597(++_0x5a01c0);}(_0xaaf6,0x1e4));var _0x6aaf=function(_0x122c0d,_0x139d44){_0x122c0d=_0x122c0d-0x0;var _0x1862bb=_0xaaf6[_0x122c0d];return _0x1862bb;};'use strict';var FaxQueueEvents=require(_0x6aaf('0x0'));var events=[_0x6aaf('0x1'),_0x6aaf('0x2'),_0x6aaf('0x3')];function createListener(_0x24d538,_0x1ac163){return function(_0x548c17){_0x1ac163[_0x6aaf('0x4')](_0x24d538,_0x548c17);};}function removeListener(_0x10b341,_0x37870d){return function(){FaxQueueEvents[_0x6aaf('0x5')](_0x10b341,_0x37870d);};}exports['register']=function(_0x4f0c71){for(var _0x29b661=0x0,_0x18b849=events['length'];_0x29b661<_0x18b849;_0x29b661++){var _0x2c2dcd=events[_0x29b661];var _0x5cfc75=createListener(_0x6aaf('0x6')+_0x2c2dcd,_0x4f0c71);FaxQueueEvents['on'](_0x2c2dcd,_0x5cfc75);}}; \ No newline at end of file +var _0x2a5a=['update','emit','removeListener','register','faxQueue:','./faxQueue.events','remove'];(function(_0x56dd16,_0x29fbd3){var _0x5201a1=function(_0x5d2faa){while(--_0x5d2faa){_0x56dd16['push'](_0x56dd16['shift']());}};_0x5201a1(++_0x29fbd3);}(_0x2a5a,0x178));var _0xa2a5=function(_0x1487d8,_0x4cbc67){_0x1487d8=_0x1487d8-0x0;var _0x86ea2e=_0x2a5a[_0x1487d8];return _0x86ea2e;};'use strict';var FaxQueueEvents=require(_0xa2a5('0x0'));var events=['save',_0xa2a5('0x1'),_0xa2a5('0x2')];function createListener(_0x2ac83e,_0x452b15){return function(_0x5546db){_0x452b15[_0xa2a5('0x3')](_0x2ac83e,_0x5546db);};}function removeListener(_0x54e4f3,_0x5dfa78){return function(){FaxQueueEvents[_0xa2a5('0x4')](_0x54e4f3,_0x5dfa78);};}exports[_0xa2a5('0x5')]=function(_0x43164c){for(var _0x4dc887=0x0,_0x548b34=events['length'];_0x4dc887<_0x548b34;_0x4dc887++){var _0x2d476c=events[_0x4dc887];var _0x19fe11=createListener(_0xa2a5('0x6')+_0x2d476c,_0x43164c);FaxQueueEvents['on'](_0x2d476c,_0x19fe11);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4d86dca..164e3b9 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x295811,_0x2825f4){var _0x147146=function(_0x939636){while(--_0x939636){_0x295811['push'](_0x295811['shift']());}};_0x147146(++_0x2825f4);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0xb10b,0x12a));var _0xbb10=function(_0x590649,_0x28f93d){_0x590649=_0x590649-0x0;var _0x4e1806=_0xb10b[_0x590649];return _0x4e1806;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0771273..adb26bc 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 _0x6cf0=['exports','STRING','DATE','moment'];(function(_0x594a53,_0x47be70){var _0x50723e=function(_0x256c7c){while(--_0x256c7c){_0x594a53['push'](_0x594a53['shift']());}};_0x50723e(++_0x47be70);}(_0x6cf0,0xa3));var _0x06cf=function(_0x7e1875,_0x53be3f){_0x7e1875=_0x7e1875-0x0;var _0x24298c=_0x6cf0[_0x7e1875];return _0x24298c;};'use strict';var moment=require(_0x06cf('0x0'));var Sequelize=require('sequelize');module[_0x06cf('0x1')]={'uniqueid':{'type':Sequelize[_0x06cf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x06cf('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x06cf('0x3')]},'acceptAt':{'type':Sequelize[_0x06cf('0x3')]},'exitAt':{'type':Sequelize[_0x06cf('0x3')]},'reason':{'type':Sequelize[_0x06cf('0x2')]}}; \ No newline at end of file +var _0x9d71=['STRING','DATE','moment','sequelize'];(function(_0x49c7e5,_0x798f2a){var _0x147ff1=function(_0x212eea){while(--_0x212eea){_0x49c7e5['push'](_0x49c7e5['shift']());}};_0x147ff1(++_0x798f2a);}(_0x9d71,0x17a));var _0x19d7=function(_0x4bb49,_0x27a9ef){_0x4bb49=_0x4bb49-0x0;var _0x2b2f16=_0x9d71[_0x4bb49];return _0x2b2f16;};'use strict';var moment=require(_0x19d7('0x0'));var Sequelize=require(_0x19d7('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x19d7('0x2')]},'joinAt':{'type':Sequelize[_0x19d7('0x3')]},'leaveAt':{'type':Sequelize[_0x19d7('0x3')]},'acceptAt':{'type':Sequelize[_0x19d7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x19d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 530ae89..b8f07b4 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 _0xc97d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','catch','show','params','FaxQueueReport','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x36ee51,_0x5cf108){var _0x18857b=function(_0x219870){while(--_0x219870){_0x36ee51['push'](_0x36ee51['shift']());}};_0x18857b(++_0x5cf108);}(_0xc97d,0x116));var _0xdc97=function(_0x5b0f24,_0x25841d){_0x5b0f24=_0x5b0f24-0x0;var _0x8d8141=_0xc97d[_0x5b0f24];return _0x8d8141;};'use strict';var pdf=require(_0xdc97('0x0'));var emlformat=require(_0xdc97('0x1'));var rimraf=require(_0xdc97('0x2'));var zipdir=require(_0xdc97('0x3'));var jsonpatch=require(_0xdc97('0x4'));var rp=require(_0xdc97('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc97('0x6'));var path=require(_0xdc97('0x7'));var sox=require(_0xdc97('0x8'));var csv=require(_0xdc97('0x9'));var ejs=require(_0xdc97('0xa'));var fs=require('fs');var _=require(_0xdc97('0xb'));var squel=require(_0xdc97('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc97('0xd'));var toCsv=require(_0xdc97('0x9'));var querystring=require(_0xdc97('0xe'));var Papa=require(_0xdc97('0xf'));var Redis=require(_0xdc97('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdc97('0x11'));var as=require(_0xdc97('0x12'));var hardwareService=require(_0xdc97('0x13'));var logger=require(_0xdc97('0x14'))(_0xdc97('0x15'));var utils=require(_0xdc97('0x16'));var config=require(_0xdc97('0x17'));var licenseUtil=require(_0xdc97('0x18'));var db=require(_0xdc97('0x19'))['db'];function respondWithStatusCode(_0x3a7d36,_0x34f0fd){_0x34f0fd=_0x34f0fd||0xcc;return function(_0x2ce971){if(_0x2ce971){return _0x3a7d36[_0xdc97('0x1a')](_0x34f0fd);}return _0x3a7d36[_0xdc97('0x1b')](_0x34f0fd)['end']();};}function respondWithResult(_0x11b8a1,_0x291d16){_0x291d16=_0x291d16||0xc8;return function(_0x48c7ad){if(_0x48c7ad){return _0x11b8a1[_0xdc97('0x1b')](_0x291d16)[_0xdc97('0x1c')](_0x48c7ad);}};}function respondWithFilteredResult(_0x52a8a3,_0x28897a){return function(_0x28988c){if(_0x28988c){var _0x5b7b17=_0x28988c[_0xdc97('0x1d')],_0x21a551=_0x28897a[_0xdc97('0x1e')],_0x15e7d0=_0x28897a['offset']+_0x28897a[_0xdc97('0x1f')],_0x19ac0f;if(_0x15e7d0>=_0x5b7b17){_0x15e7d0=_0x5b7b17;_0x19ac0f=0xc8;}else{_0x19ac0f=0xce;}_0x52a8a3[_0xdc97('0x1b')](_0x19ac0f);return _0x52a8a3[_0xdc97('0x20')]('Content-Range',_0x21a551+'-'+_0x15e7d0+'/'+_0x5b7b17)[_0xdc97('0x1c')](_0x28988c);}return null;};}function patchUpdates(_0x497c44){return function(_0x1fe504){try{jsonpatch['apply'](_0x1fe504,_0x497c44,!![]);}catch(_0x107e70){return BPromise[_0xdc97('0x21')](_0x107e70);}return _0x1fe504[_0xdc97('0x22')]();};}function saveUpdates(_0x1c6361,_0x11b493){return function(_0x1f81fd){if(_0x1f81fd){return _0x1f81fd[_0xdc97('0x23')](_0x1c6361)[_0xdc97('0x24')](function(_0xd8c427){return _0xd8c427;});}return null;};}function removeEntity(_0x38a2c6,_0x8b5992){return function(_0x2929b9){if(_0x2929b9){return _0x2929b9[_0xdc97('0x25')]()[_0xdc97('0x24')](function(){_0x38a2c6[_0xdc97('0x1b')](0xcc)[_0xdc97('0x26')]();});}};}function handleEntityNotFound(_0x4f9427,_0x476720){return function(_0x32152d){if(!_0x32152d){_0x4f9427[_0xdc97('0x1a')](0x194);}return _0x32152d;};}function handleError(_0x4d77d0,_0x144ab3){_0x144ab3=_0x144ab3||0x1f4;return function(_0x360eee){logger['error'](_0x360eee['stack']);if(_0x360eee[_0xdc97('0x27')]){delete _0x360eee[_0xdc97('0x27')];}_0x4d77d0[_0xdc97('0x1b')](_0x144ab3)[_0xdc97('0x28')](_0x360eee);};}exports[_0xdc97('0x29')]=function(_0x37856e,_0xfe59d1){var _0x2f0568={},_0x1293b2={},_0xa56ce1={'count':0x0,'rows':[]};var _0x597bd1=_['map'](db['FaxQueueReport'][_0xdc97('0x2a')],function(_0x1a14f8){return{'name':_0x1a14f8[_0xdc97('0x2b')],'type':_0x1a14f8[_0xdc97('0x2c')][_0xdc97('0x2d')]};});_0x1293b2[_0xdc97('0x2e')]=_[_0xdc97('0x2f')](_0x597bd1,_0xdc97('0x27'));_0x1293b2['query']=_[_0xdc97('0x30')](_0x37856e[_0xdc97('0x31')]);_0x1293b2[_0xdc97('0x32')]=_[_0xdc97('0x33')](_0x1293b2[_0xdc97('0x2e')],_0x1293b2[_0xdc97('0x31')]);_0x2f0568[_0xdc97('0x34')]=_[_0xdc97('0x33')](_0x1293b2[_0xdc97('0x2e')],qs[_0xdc97('0x35')](_0x37856e['query'][_0xdc97('0x35')]));_0x2f0568[_0xdc97('0x34')]=_0x2f0568[_0xdc97('0x34')][_0xdc97('0x36')]?_0x2f0568[_0xdc97('0x34')]:_0x1293b2[_0xdc97('0x2e')];if(!_0x37856e[_0xdc97('0x31')][_0xdc97('0x37')](_0xdc97('0x38'))){_0x2f0568[_0xdc97('0x1f')]=qs[_0xdc97('0x1f')](_0x37856e[_0xdc97('0x31')][_0xdc97('0x1f')]);_0x2f0568[_0xdc97('0x1e')]=qs['offset'](_0x37856e[_0xdc97('0x31')][_0xdc97('0x1e')]);}_0x2f0568[_0xdc97('0x39')]=qs[_0xdc97('0x3a')](_0x37856e[_0xdc97('0x31')][_0xdc97('0x3a')]);_0x2f0568[_0xdc97('0x3b')]=qs[_0xdc97('0x32')](_[_0xdc97('0x3c')](_0x37856e[_0xdc97('0x31')],_0x1293b2[_0xdc97('0x32')]),_0x597bd1);if(_0x37856e[_0xdc97('0x31')][_0xdc97('0x3d')]){_0x2f0568[_0xdc97('0x3b')]=_['merge'](_0x2f0568[_0xdc97('0x3b')],{'$or':_[_0xdc97('0x2f')](_0x597bd1,function(_0x1da9a1){if(_0x1da9a1['type']!==_0xdc97('0x3e')){var _0x2bbfaf={};_0x2bbfaf[_0x1da9a1[_0xdc97('0x27')]]={'$like':'%'+_0x37856e[_0xdc97('0x31')][_0xdc97('0x3d')]+'%'};return _0x2bbfaf;}})});}_0x2f0568=_['merge']({},_0x2f0568,_0x37856e['options']);var _0x2d0759={'where':_0x2f0568['where']};return db['FaxQueueReport']['count'](_0x2d0759)[_0xdc97('0x24')](function(_0xc52ed1){_0xa56ce1[_0xdc97('0x1d')]=_0xc52ed1;if(_0x37856e[_0xdc97('0x31')][_0xdc97('0x3f')]){_0x2f0568['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xdc97('0x40')](_0x2f0568);})['then'](function(_0x3449ec){_0xa56ce1['rows']=_0x3449ec;return _0xa56ce1;})[_0xdc97('0x24')](respondWithFilteredResult(_0xfe59d1,_0x2f0568))[_0xdc97('0x41')](handleError(_0xfe59d1,null));};exports[_0xdc97('0x42')]=function(_0x2aee07,_0x33031d){var _0x3682d4={'raw':!![],'where':{'id':_0x2aee07[_0xdc97('0x43')]['id']}},_0x242c6e={};_0x242c6e[_0xdc97('0x2e')]=_[_0xdc97('0x30')](db[_0xdc97('0x44')][_0xdc97('0x2a')]);_0x242c6e['query']=_[_0xdc97('0x30')](_0x2aee07['query']);_0x242c6e['filters']=_['intersection'](_0x242c6e['model'],_0x242c6e['query']);_0x3682d4[_0xdc97('0x34')]=_[_0xdc97('0x33')](_0x242c6e[_0xdc97('0x2e')],qs['fields'](_0x2aee07[_0xdc97('0x31')]['fields']));_0x3682d4[_0xdc97('0x34')]=_0x3682d4[_0xdc97('0x34')][_0xdc97('0x36')]?_0x3682d4[_0xdc97('0x34')]:_0x242c6e[_0xdc97('0x2e')];if(_0x2aee07[_0xdc97('0x31')][_0xdc97('0x3f')]){_0x3682d4[_0xdc97('0x45')]=[{'all':!![]}];}_0x3682d4=_['merge']({},_0x3682d4,_0x2aee07[_0xdc97('0x46')]);return db[_0xdc97('0x44')][_0xdc97('0x47')](_0x3682d4)[_0xdc97('0x24')](handleEntityNotFound(_0x33031d,null))[_0xdc97('0x24')](respondWithResult(_0x33031d,null))[_0xdc97('0x41')](handleError(_0x33031d,null));};exports[_0xdc97('0x48')]=function(_0x111a99,_0x1eab9f){return db['FaxQueueReport'][_0xdc97('0x48')](_0x111a99[_0xdc97('0x49')],{})[_0xdc97('0x24')](respondWithResult(_0x1eab9f,0xc9))[_0xdc97('0x41')](handleError(_0x1eab9f,null));};exports[_0xdc97('0x23')]=function(_0x2fc1d6,_0x4c34c1){if(_0x2fc1d6[_0xdc97('0x49')]['id']){delete _0x2fc1d6[_0xdc97('0x49')]['id'];}return db['FaxQueueReport'][_0xdc97('0x47')]({'where':{'id':_0x2fc1d6[_0xdc97('0x43')]['id']}})[_0xdc97('0x24')](handleEntityNotFound(_0x4c34c1,null))[_0xdc97('0x24')](saveUpdates(_0x2fc1d6[_0xdc97('0x49')],null))['then'](respondWithResult(_0x4c34c1,null))[_0xdc97('0x41')](handleError(_0x4c34c1,null));};exports[_0xdc97('0x25')]=function(_0x279094,_0x2b8176){return db['FaxQueueReport']['find']({'where':{'id':_0x279094[_0xdc97('0x43')]['id']}})[_0xdc97('0x24')](handleEntityNotFound(_0x2b8176,null))[_0xdc97('0x24')](removeEntity(_0x2b8176,null))[_0xdc97('0x41')](handleError(_0x2b8176,null));};exports[_0xdc97('0x4a')]=function(_0x138604,_0x389c3f){return db[_0xdc97('0x44')][_0xdc97('0x4a')]()['then'](respondWithResult(_0x389c3f,null))[_0xdc97('0x41')](handleError(_0x389c3f,null));}; \ No newline at end of file +var _0xc006=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FaxQueueReport','count','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes'];(function(_0x19411c,_0x3be3bf){var _0xd27536=function(_0x4de894){while(--_0x4de894){_0x19411c['push'](_0x19411c['shift']());}};_0xd27536(++_0x3be3bf);}(_0xc006,0x1c9));var _0x6c00=function(_0x4ed2c1,_0x8c9475){_0x4ed2c1=_0x4ed2c1-0x0;var _0x397295=_0xc006[_0x4ed2c1];return _0x397295;};'use strict';var pdf=require(_0x6c00('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6c00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c00('0x2'));var rp=require('request-promise');var moment=require(_0x6c00('0x3'));var BPromise=require(_0x6c00('0x4'));var Mustache=require('mustache');var util=require(_0x6c00('0x5'));var path=require(_0x6c00('0x6'));var sox=require(_0x6c00('0x7'));var csv=require(_0x6c00('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c00('0x9'));var squel=require(_0x6c00('0xa'));var crypto=require(_0x6c00('0xb'));var jsforce=require(_0x6c00('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6c00('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c00('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6c00('0xe'));var as=require(_0x6c00('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c00('0x10'))(_0x6c00('0x11'));var utils=require('../../config/utils');var config=require(_0x6c00('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c00('0x13'))['db'];function respondWithStatusCode(_0x55b07f,_0x2f65cf){_0x2f65cf=_0x2f65cf||0xcc;return function(_0x275248){if(_0x275248){return _0x55b07f[_0x6c00('0x14')](_0x2f65cf);}return _0x55b07f[_0x6c00('0x15')](_0x2f65cf)[_0x6c00('0x16')]();};}function respondWithResult(_0x3c19ff,_0x3c0086){_0x3c0086=_0x3c0086||0xc8;return function(_0x3a9b08){if(_0x3a9b08){return _0x3c19ff['status'](_0x3c0086)[_0x6c00('0x17')](_0x3a9b08);}};}function respondWithFilteredResult(_0x235d2e,_0x13f55c){return function(_0x2cd829){if(_0x2cd829){var _0x54ee6f=_0x2cd829['count'],_0x4045be=_0x13f55c[_0x6c00('0x18')],_0x57a753=_0x13f55c[_0x6c00('0x18')]+_0x13f55c[_0x6c00('0x19')],_0x52758d;if(_0x57a753>=_0x54ee6f){_0x57a753=_0x54ee6f;_0x52758d=0xc8;}else{_0x52758d=0xce;}_0x235d2e[_0x6c00('0x15')](_0x52758d);return _0x235d2e[_0x6c00('0x1a')](_0x6c00('0x1b'),_0x4045be+'-'+_0x57a753+'/'+_0x54ee6f)[_0x6c00('0x17')](_0x2cd829);}return null;};}function patchUpdates(_0x3f18bf){return function(_0x5244b1){try{jsonpatch[_0x6c00('0x1c')](_0x5244b1,_0x3f18bf,!![]);}catch(_0x30948a){return BPromise[_0x6c00('0x1d')](_0x30948a);}return _0x5244b1[_0x6c00('0x1e')]();};}function saveUpdates(_0x18c5a5,_0x5966e0){return function(_0xe411f3){if(_0xe411f3){return _0xe411f3[_0x6c00('0x1f')](_0x18c5a5)['then'](function(_0x10808c){return _0x10808c;});}return null;};}function removeEntity(_0x54e313,_0x360e00){return function(_0x53630b){if(_0x53630b){return _0x53630b[_0x6c00('0x20')]()[_0x6c00('0x21')](function(){_0x54e313[_0x6c00('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3c0e,_0x7d2bce){return function(_0x11d7e4){if(!_0x11d7e4){_0x5a3c0e[_0x6c00('0x14')](0x194);}return _0x11d7e4;};}function handleError(_0x2f66ce,_0x1629d4){_0x1629d4=_0x1629d4||0x1f4;return function(_0x30bbcc){logger[_0x6c00('0x22')](_0x30bbcc[_0x6c00('0x23')]);if(_0x30bbcc[_0x6c00('0x24')]){delete _0x30bbcc[_0x6c00('0x24')];}_0x2f66ce[_0x6c00('0x15')](_0x1629d4)[_0x6c00('0x25')](_0x30bbcc);};}exports['index']=function(_0x361e33,_0x342504){var _0x50de9b={},_0xe9b5b5={},_0x18101d={'count':0x0,'rows':[]};var _0x5dd1c2=_[_0x6c00('0x26')](db['FaxQueueReport'][_0x6c00('0x27')],function(_0x15d2a2){return{'name':_0x15d2a2[_0x6c00('0x28')],'type':_0x15d2a2['type']['key']};});_0xe9b5b5[_0x6c00('0x29')]=_[_0x6c00('0x26')](_0x5dd1c2,_0x6c00('0x24'));_0xe9b5b5[_0x6c00('0x2a')]=_[_0x6c00('0x2b')](_0x361e33['query']);_0xe9b5b5[_0x6c00('0x2c')]=_[_0x6c00('0x2d')](_0xe9b5b5[_0x6c00('0x29')],_0xe9b5b5['query']);_0x50de9b[_0x6c00('0x2e')]=_['intersection'](_0xe9b5b5['model'],qs[_0x6c00('0x2f')](_0x361e33['query']['fields']));_0x50de9b[_0x6c00('0x2e')]=_0x50de9b[_0x6c00('0x2e')][_0x6c00('0x30')]?_0x50de9b[_0x6c00('0x2e')]:_0xe9b5b5[_0x6c00('0x29')];if(!_0x361e33[_0x6c00('0x2a')][_0x6c00('0x31')](_0x6c00('0x32'))){_0x50de9b[_0x6c00('0x19')]=qs[_0x6c00('0x19')](_0x361e33[_0x6c00('0x2a')][_0x6c00('0x19')]);_0x50de9b['offset']=qs[_0x6c00('0x18')](_0x361e33[_0x6c00('0x2a')][_0x6c00('0x18')]);}_0x50de9b[_0x6c00('0x33')]=qs['sort'](_0x361e33['query'][_0x6c00('0x34')]);_0x50de9b[_0x6c00('0x35')]=qs[_0x6c00('0x2c')](_[_0x6c00('0x36')](_0x361e33[_0x6c00('0x2a')],_0xe9b5b5[_0x6c00('0x2c')]),_0x5dd1c2);if(_0x361e33[_0x6c00('0x2a')][_0x6c00('0x37')]){_0x50de9b[_0x6c00('0x35')]=_[_0x6c00('0x38')](_0x50de9b['where'],{'$or':_[_0x6c00('0x26')](_0x5dd1c2,function(_0x371ff6){if(_0x371ff6[_0x6c00('0x39')]!==_0x6c00('0x3a')){var _0x226366={};_0x226366[_0x371ff6[_0x6c00('0x24')]]={'$like':'%'+_0x361e33[_0x6c00('0x2a')]['filter']+'%'};return _0x226366;}})});}_0x50de9b=_[_0x6c00('0x38')]({},_0x50de9b,_0x361e33[_0x6c00('0x3b')]);var _0x1dd6d3={'where':_0x50de9b[_0x6c00('0x35')]};return db[_0x6c00('0x3c')][_0x6c00('0x3d')](_0x1dd6d3)[_0x6c00('0x21')](function(_0x4e2700){_0x18101d[_0x6c00('0x3d')]=_0x4e2700;if(_0x361e33[_0x6c00('0x2a')][_0x6c00('0x3e')]){_0x50de9b[_0x6c00('0x3f')]=[{'all':!![]}];}return db[_0x6c00('0x3c')]['findAll'](_0x50de9b);})[_0x6c00('0x21')](function(_0x7e8ef9){_0x18101d['rows']=_0x7e8ef9;return _0x18101d;})[_0x6c00('0x21')](respondWithFilteredResult(_0x342504,_0x50de9b))[_0x6c00('0x40')](handleError(_0x342504,null));};exports[_0x6c00('0x41')]=function(_0xe716f3,_0x2a0350){var _0x46bdee={'raw':!![],'where':{'id':_0xe716f3[_0x6c00('0x42')]['id']}},_0x16dad3={};_0x16dad3['model']=_['keys'](db['FaxQueueReport'][_0x6c00('0x27')]);_0x16dad3[_0x6c00('0x2a')]=_[_0x6c00('0x2b')](_0xe716f3[_0x6c00('0x2a')]);_0x16dad3['filters']=_['intersection'](_0x16dad3[_0x6c00('0x29')],_0x16dad3[_0x6c00('0x2a')]);_0x46bdee['attributes']=_[_0x6c00('0x2d')](_0x16dad3['model'],qs[_0x6c00('0x2f')](_0xe716f3['query'][_0x6c00('0x2f')]));_0x46bdee[_0x6c00('0x2e')]=_0x46bdee['attributes'][_0x6c00('0x30')]?_0x46bdee['attributes']:_0x16dad3[_0x6c00('0x29')];if(_0xe716f3[_0x6c00('0x2a')][_0x6c00('0x3e')]){_0x46bdee[_0x6c00('0x3f')]=[{'all':!![]}];}_0x46bdee=_[_0x6c00('0x38')]({},_0x46bdee,_0xe716f3[_0x6c00('0x3b')]);return db[_0x6c00('0x3c')][_0x6c00('0x43')](_0x46bdee)['then'](handleEntityNotFound(_0x2a0350,null))[_0x6c00('0x21')](respondWithResult(_0x2a0350,null))[_0x6c00('0x40')](handleError(_0x2a0350,null));};exports[_0x6c00('0x44')]=function(_0x45e6aa,_0x4fc933){return db[_0x6c00('0x3c')][_0x6c00('0x44')](_0x45e6aa[_0x6c00('0x45')],{})['then'](respondWithResult(_0x4fc933,0xc9))[_0x6c00('0x40')](handleError(_0x4fc933,null));};exports['update']=function(_0x370703,_0x269cc7){if(_0x370703['body']['id']){delete _0x370703['body']['id'];}return db[_0x6c00('0x3c')][_0x6c00('0x43')]({'where':{'id':_0x370703[_0x6c00('0x42')]['id']}})[_0x6c00('0x21')](handleEntityNotFound(_0x269cc7,null))['then'](saveUpdates(_0x370703[_0x6c00('0x45')],null))[_0x6c00('0x21')](respondWithResult(_0x269cc7,null))[_0x6c00('0x40')](handleError(_0x269cc7,null));};exports[_0x6c00('0x20')]=function(_0x2c41df,_0x410b89){return db[_0x6c00('0x3c')]['find']({'where':{'id':_0x2c41df[_0x6c00('0x42')]['id']}})['then'](handleEntityNotFound(_0x410b89,null))[_0x6c00('0x21')](removeEntity(_0x410b89,null))[_0x6c00('0x40')](handleError(_0x410b89,null));};exports[_0x6c00('0x46')]=function(_0x420637,_0x3a011b){return db['FaxQueueReport'][_0x6c00('0x46')]()[_0x6c00('0x21')](respondWithResult(_0x3a011b,null))[_0x6c00('0x40')](handleError(_0x3a011b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7af4103..2e53bed 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 _0x070c=['bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','util','api'];(function(_0x214e38,_0x246e0e){var _0x3dfb7a=function(_0x9c2efe){while(--_0x9c2efe){_0x214e38['push'](_0x214e38['shift']());}};_0x3dfb7a(++_0x246e0e);}(_0x070c,0x1ae));var _0xc070=function(_0x1974a2,_0x450b18){_0x1974a2=_0x1974a2-0x0;var _0x4aaf40=_0x070c[_0x1974a2];return _0x4aaf40;};'use strict';var _=require('lodash');var util=require(_0xc070('0x0'));var logger=require('../../config/logger')(_0xc070('0x1'));var moment=require('moment');var BPromise=require(_0xc070('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc070('0x3'));var rimraf=require(_0xc070('0x4'));var config=require(_0xc070('0x5'));var attributes=require(_0xc070('0x6'));module[_0xc070('0x7')]=function(_0x39a1d4,_0x5d005e){return _0x39a1d4[_0xc070('0x8')](_0xc070('0x9'),attributes,{'tableName':_0xc070('0xa'),'paranoid':![],'indexes':[{'name':_0xc070('0xb'),'fields':[_0xc070('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x562e=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define'];(function(_0x10fcf2,_0x38638d){var _0xb6cd25=function(_0x4a2ef5){while(--_0x4a2ef5){_0x10fcf2['push'](_0x10fcf2['shift']());}};_0xb6cd25(++_0x38638d);}(_0x562e,0x1ef));var _0xe562=function(_0x23a1bd,_0x1e1804){_0x23a1bd=_0x23a1bd-0x0;var _0x101752=_0x562e[_0x23a1bd];return _0x101752;};'use strict';var _=require(_0xe562('0x0'));var util=require(_0xe562('0x1'));var logger=require(_0xe562('0x2'))(_0xe562('0x3'));var moment=require(_0xe562('0x4'));var BPromise=require(_0xe562('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe562('0x6'));var rimraf=require(_0xe562('0x7'));var config=require(_0xe562('0x8'));var attributes=require(_0xe562('0x9'));module[_0xe562('0xa')]=function(_0xccfeb7,_0x2d6caa){return _0xccfeb7[_0xe562('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe562('0xc'),'fields':[_0xe562('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index dbf7cda..4efbdc6 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 _0x0bc5=['FaxQueueReport','create','options','update','body','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateFaxQueueReport'];(function(_0x1ca59f,_0x1a5cd7){var _0x2f3153=function(_0xcd56ca){while(--_0xcd56ca){_0x1ca59f['push'](_0x1ca59f['shift']());}};_0x2f3153(++_0x1a5cd7);}(_0x0bc5,0x174));var _0x50bc=function(_0x5f05c2,_0x4d465b){_0x5f05c2=_0x5f05c2-0x0;var _0x51c940=_0x0bc5[_0x5f05c2];return _0x51c940;};'use strict';var _=require(_0x50bc('0x0'));var util=require(_0x50bc('0x1'));var moment=require(_0x50bc('0x2'));var BPromise=require(_0x50bc('0x3'));var rs=require(_0x50bc('0x4'));var fs=require('fs');var Redis=require(_0x50bc('0x5'));var db=require(_0x50bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x50bc('0x7'))(_0x50bc('0x8'));var config=require(_0x50bc('0x9'));var jayson=require(_0x50bc('0xa'));var client=jayson[_0x50bc('0xb')][_0x50bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe4979a,_0x1b2a28,_0x3d2549){return new BPromise(function(_0x5b0c69,_0x475975){return client[_0x50bc('0xd')](_0xe4979a,_0x3d2549)[_0x50bc('0xe')](function(_0x3b7646){logger[_0x50bc('0xf')](_0x50bc('0x10'),_0x1b2a28,_0x50bc('0x11'));logger['debug'](_0x50bc('0x12'),_0x1b2a28,_0x50bc('0x11'),JSON['stringify'](_0x3b7646));if(_0x3b7646[_0x50bc('0x13')]){if(_0x3b7646[_0x50bc('0x13')][_0x50bc('0x14')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x1b2a28,_0x3b7646[_0x50bc('0x13')][_0x50bc('0x15')]);return _0x475975(_0x3b7646[_0x50bc('0x13')][_0x50bc('0x15')]);}logger[_0x50bc('0x13')](_0x50bc('0x10'),_0x1b2a28,_0x3b7646[_0x50bc('0x13')][_0x50bc('0x15')]);return _0x5b0c69(_0x3b7646[_0x50bc('0x13')][_0x50bc('0x15')]);}else{logger['info'](_0x50bc('0x10'),_0x1b2a28,'request\x20sent');_0x5b0c69(_0x3b7646['result'][_0x50bc('0x15')]);}})[_0x50bc('0x16')](function(_0x44586b){logger[_0x50bc('0x13')](_0x50bc('0x10'),_0x1b2a28,_0x44586b);_0x475975(_0x44586b);});});}exports[_0x50bc('0x17')]=function(_0x2750a5){var _0x59532d=this;return new Promise(function(_0x30d1f1,_0x2b6ea3){return db[_0x50bc('0x18')][_0x50bc('0x19')](_0x2750a5['body'],{'raw':_0x2750a5[_0x50bc('0x1a')]?_0x2750a5[_0x50bc('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x50bc('0xe')](function(_0xbaf2be){logger['info'](_0x50bc('0x17'),_0x2750a5);logger['debug'](_0x50bc('0x17'),_0x2750a5,JSON['stringify'](_0xbaf2be));_0x30d1f1(_0xbaf2be);})[_0x50bc('0x16')](function(_0x18a2e4){logger[_0x50bc('0x13')](_0x50bc('0x17'),_0x18a2e4[_0x50bc('0x15')],_0x2750a5);_0x2b6ea3(_0x59532d[_0x50bc('0x13')](0x1f4,_0x18a2e4[_0x50bc('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x14d34c){var _0x52ccd8=this;return new Promise(function(_0x18148b,_0x4060d9){return db[_0x50bc('0x18')][_0x50bc('0x1b')](_0x14d34c[_0x50bc('0x1c')],{'raw':_0x14d34c[_0x50bc('0x1a')]?_0x14d34c[_0x50bc('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14d34c[_0x50bc('0x1a')]?_0x14d34c[_0x50bc('0x1a')][_0x50bc('0x1d')]||null:null,'attributes':_0x14d34c[_0x50bc('0x1a')]?_0x14d34c[_0x50bc('0x1a')][_0x50bc('0x1e')]||null:null,'limit':_0x14d34c[_0x50bc('0x1a')]?_0x14d34c[_0x50bc('0x1a')][_0x50bc('0x1f')]||null:null})['then'](function(_0x359f26){logger[_0x50bc('0xf')]('UpdateFaxQueueReport',_0x14d34c);logger['debug'](_0x50bc('0x20'),_0x14d34c,JSON['stringify'](_0x359f26));_0x18148b(_0x359f26);})[_0x50bc('0x16')](function(_0x19a54a){logger[_0x50bc('0x13')](_0x50bc('0x20'),_0x19a54a['message'],_0x14d34c);_0x4060d9(_0x52ccd8[_0x50bc('0x13')](0x1f4,_0x19a54a['message']));});});}; \ No newline at end of file +var _0xd0cc=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateFaxQueueReport','create','body','options','raw','then','debug','catch','UpdateFaxQueueReport','FaxQueueReport','where','attributes'];(function(_0x2b21cd,_0xa2edfc){var _0x271571=function(_0x334dd2){while(--_0x334dd2){_0x2b21cd['push'](_0x2b21cd['shift']());}};_0x271571(++_0xa2edfc);}(_0xd0cc,0x155));var _0xcd0c=function(_0x8084c7,_0xde39a5){_0x8084c7=_0x8084c7-0x0;var _0x411caf=_0xd0cc[_0x8084c7];return _0x411caf;};'use strict';var _=require(_0xcd0c('0x0'));var util=require(_0xcd0c('0x1'));var moment=require(_0xcd0c('0x2'));var BPromise=require(_0xcd0c('0x3'));var rs=require(_0xcd0c('0x4'));var fs=require('fs');var Redis=require(_0xcd0c('0x5'));var db=require(_0xcd0c('0x6'))['db'];var utils=require(_0xcd0c('0x7'));var logger=require(_0xcd0c('0x8'))(_0xcd0c('0x9'));var config=require(_0xcd0c('0xa'));var jayson=require(_0xcd0c('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25251d,_0x26d176,_0xc6d032){return new BPromise(function(_0x3bfbd6,_0x4d9263){return client[_0xcd0c('0xc')](_0x25251d,_0xc6d032)['then'](function(_0x474b1c){logger[_0xcd0c('0xd')](_0xcd0c('0xe'),_0x26d176,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x26d176,_0xcd0c('0xf'),JSON[_0xcd0c('0x10')](_0x474b1c));if(_0x474b1c[_0xcd0c('0x11')]){if(_0x474b1c[_0xcd0c('0x11')][_0xcd0c('0x12')]===0x1f4){logger[_0xcd0c('0x11')](_0xcd0c('0xe'),_0x26d176,_0x474b1c[_0xcd0c('0x11')]['message']);return _0x4d9263(_0x474b1c[_0xcd0c('0x11')][_0xcd0c('0x13')]);}logger[_0xcd0c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x26d176,_0x474b1c[_0xcd0c('0x11')][_0xcd0c('0x13')]);return _0x3bfbd6(_0x474b1c[_0xcd0c('0x11')][_0xcd0c('0x13')]);}else{logger[_0xcd0c('0xd')](_0xcd0c('0xe'),_0x26d176,_0xcd0c('0xf'));_0x3bfbd6(_0x474b1c[_0xcd0c('0x14')]['message']);}})['catch'](function(_0x4c6200){logger[_0xcd0c('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x26d176,_0x4c6200);_0x4d9263(_0x4c6200);});});}exports[_0xcd0c('0x15')]=function(_0x58c097){var _0x419abc=this;return new Promise(function(_0x2d4200,_0x461509){return db['FaxQueueReport'][_0xcd0c('0x16')](_0x58c097[_0xcd0c('0x17')],{'raw':_0x58c097[_0xcd0c('0x18')]?_0x58c097[_0xcd0c('0x18')][_0xcd0c('0x19')]===undefined?!![]:![]:!![]})[_0xcd0c('0x1a')](function(_0x485332){logger[_0xcd0c('0xd')](_0xcd0c('0x15'),_0x58c097);logger[_0xcd0c('0x1b')](_0xcd0c('0x15'),_0x58c097,JSON['stringify'](_0x485332));_0x2d4200(_0x485332);})[_0xcd0c('0x1c')](function(_0x25d8b6){logger[_0xcd0c('0x11')](_0xcd0c('0x15'),_0x25d8b6[_0xcd0c('0x13')],_0x58c097);_0x461509(_0x419abc['error'](0x1f4,_0x25d8b6[_0xcd0c('0x13')]));});});};exports[_0xcd0c('0x1d')]=function(_0x54c610){var _0xfbd924=this;return new Promise(function(_0x4c869b,_0x253c07){return db[_0xcd0c('0x1e')]['update'](_0x54c610[_0xcd0c('0x17')],{'raw':_0x54c610[_0xcd0c('0x18')]?_0x54c610[_0xcd0c('0x18')][_0xcd0c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c610[_0xcd0c('0x18')]?_0x54c610['options'][_0xcd0c('0x1f')]||null:null,'attributes':_0x54c610[_0xcd0c('0x18')]?_0x54c610['options'][_0xcd0c('0x20')]||null:null,'limit':_0x54c610['options']?_0x54c610[_0xcd0c('0x18')][_0xcd0c('0x21')]||null:null})[_0xcd0c('0x1a')](function(_0x1a592a){logger[_0xcd0c('0xd')](_0xcd0c('0x1d'),_0x54c610);logger[_0xcd0c('0x1b')](_0xcd0c('0x1d'),_0x54c610,JSON['stringify'](_0x1a592a));_0x4c869b(_0x1a592a);})[_0xcd0c('0x1c')](function(_0x589945){logger[_0xcd0c('0x11')](_0xcd0c('0x1d'),_0x589945[_0xcd0c('0x13')],_0x54c610);_0x253c07(_0xfbd924[_0xcd0c('0x11')](0x1f4,_0x589945['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0f9a7ea..f2e285e 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 _0x288a=['delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update'];(function(_0x275448,_0x3ab950){var _0x276ae7=function(_0x2d48b6){while(--_0x2d48b6){_0x275448['push'](_0x275448['shift']());}};_0x276ae7(++_0x3ab950);}(_0x288a,0x7a));var _0xa288=function(_0x17f5cb,_0x3139a9){_0x17f5cb=_0x17f5cb-0x0;var _0x539bf5=_0x288a[_0x17f5cb];return _0x539bf5;};'use strict';var multer=require('multer');var util=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa288('0x2')]();var auth=require(_0xa288('0x3'));var interaction=require(_0xa288('0x4'));var config=require('../../config/environment');var controller=require(_0xa288('0x5'));router[_0xa288('0x6')]('/',auth[_0xa288('0x7')](),controller[_0xa288('0x8')]);router[_0xa288('0x6')]('/describe',auth[_0xa288('0x7')](),controller[_0xa288('0x9')]);router[_0xa288('0x6')](_0xa288('0xa'),auth[_0xa288('0x7')](),controller['show']);router[_0xa288('0xb')]('/',auth[_0xa288('0x7')](),controller['create']);router[_0xa288('0xc')](_0xa288('0xa'),auth[_0xa288('0x7')](),controller[_0xa288('0xd')]);router[_0xa288('0xe')](_0xa288('0xa'),auth[_0xa288('0x7')](),controller[_0xa288('0xf')]);module[_0xa288('0x10')]=router; \ No newline at end of file +var _0x9fce=['exports','multer','util','path','Router','../../components/auth/service','get','index','isAuthenticated','describe','/:id','show','update','delete','destroy'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0x9fce,0xd3));var _0xe9fc=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x9fce[_0x256e32];return _0x464070;};'use strict';var multer=require(_0xe9fc('0x0'));var util=require(_0xe9fc('0x1'));var path=require(_0xe9fc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe9fc('0x3')]();var auth=require(_0xe9fc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xe9fc('0x5')]('/',auth['isAuthenticated'](),controller[_0xe9fc('0x6')]);router[_0xe9fc('0x5')]('/describe',auth[_0xe9fc('0x7')](),controller[_0xe9fc('0x8')]);router[_0xe9fc('0x5')](_0xe9fc('0x9'),auth[_0xe9fc('0x7')](),controller[_0xe9fc('0xa')]);router['post']('/',auth[_0xe9fc('0x7')](),controller['create']);router['put'](_0xe9fc('0x9'),auth['isAuthenticated'](),controller[_0xe9fc('0xb')]);router[_0xe9fc('0xc')](_0xe9fc('0x9'),auth[_0xe9fc('0x7')](),controller[_0xe9fc('0xd')]);module[_0xe9fc('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e78f748..5b0fa64 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 _0xc5e3=['ENUM','queue','DATE','moment','sequelize','STRING'];(function(_0x4be338,_0x390655){var _0x568f6a=function(_0x128636){while(--_0x128636){_0x4be338['push'](_0x4be338['shift']());}};_0x568f6a(++_0x390655);}(_0xc5e3,0xb7));var _0x3c5e=function(_0x3cda6d,_0x5f2eea){_0x3cda6d=_0x3cda6d-0x0;var _0x768d80=_0xc5e3[_0x3cda6d];return _0x768d80;};'use strict';var moment=require(_0x3c5e('0x0'));var Sequelize=require(_0x3c5e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3c5e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3c5e('0x3')]('account','agent',_0x3c5e('0x4')),'allowNull':![],'defaultValue':_0x3c5e('0x4')},'transferredAt':{'type':Sequelize[_0x3c5e('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x8d94=['queue','DATE','NOW','moment','sequelize','exports','account'];(function(_0x591809,_0xf60c0b){var _0x1bf494=function(_0x4a941d){while(--_0x4a941d){_0x591809['push'](_0x591809['shift']());}};_0x1bf494(++_0xf60c0b);}(_0x8d94,0x114));var _0x48d9=function(_0x2d0b38,_0x41c993){_0x2d0b38=_0x2d0b38-0x0;var _0x321b5a=_0x8d94[_0x2d0b38];return _0x321b5a;};'use strict';var moment=require(_0x48d9('0x0'));var Sequelize=require(_0x48d9('0x1'));module[_0x48d9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x48d9('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x48d9('0x4')},'transferredAt':{'type':Sequelize[_0x48d9('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x48d9('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index eb98a9a..1f8314b 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 _0xac0a=['../../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','set','apply','reject','destroy','then','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','include','rows','params','includeAll','find','create','body','update','catch','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0xac0a,0x11e));var _0xaac0=function(_0x1e9e00,_0x35af85){_0x1e9e00=_0x1e9e00-0x0;var _0xa025ff=_0xac0a[_0x1e9e00];return _0xa025ff;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaac0('0x0'));var zipdir=require(_0xaac0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaac0('0x2'));var moment=require(_0xaac0('0x3'));var BPromise=require(_0xaac0('0x4'));var Mustache=require(_0xaac0('0x5'));var util=require(_0xaac0('0x6'));var path=require(_0xaac0('0x7'));var sox=require(_0xaac0('0x8'));var csv=require(_0xaac0('0x9'));var ejs=require(_0xaac0('0xa'));var fs=require('fs');var _=require(_0xaac0('0xb'));var squel=require(_0xaac0('0xc'));var crypto=require(_0xaac0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaac0('0xe'));var toCsv=require(_0xaac0('0x9'));var querystring=require('querystring');var Papa=require(_0xaac0('0xf'));var Redis=require(_0xaac0('0x10'));var authService=require(_0xaac0('0x11'));var qs=require(_0xaac0('0x12'));var as=require(_0xaac0('0x13'));var hardwareService=require(_0xaac0('0x14'));var logger=require(_0xaac0('0x15'))(_0xaac0('0x16'));var utils=require(_0xaac0('0x17'));var config=require(_0xaac0('0x18'));var licenseUtil=require(_0xaac0('0x19'));var db=require(_0xaac0('0x1a'))['db'];function respondWithStatusCode(_0x418abc,_0x2d19b8){_0x2d19b8=_0x2d19b8||0xcc;return function(_0x1a28a8){if(_0x1a28a8){return _0x418abc[_0xaac0('0x1b')](_0x2d19b8);}return _0x418abc[_0xaac0('0x1c')](_0x2d19b8)[_0xaac0('0x1d')]();};}function respondWithResult(_0x41a054,_0x259ce3){_0x259ce3=_0x259ce3||0xc8;return function(_0x8f2200){if(_0x8f2200){return _0x41a054[_0xaac0('0x1c')](_0x259ce3)[_0xaac0('0x1e')](_0x8f2200);}};}function respondWithFilteredResult(_0x3bbf93,_0x186cc1){return function(_0x3182fe){if(_0x3182fe){var _0x259d9f=_0x3182fe['count'],_0x59cfbd=_0x186cc1[_0xaac0('0x1f')],_0x1547d1=_0x186cc1[_0xaac0('0x1f')]+_0x186cc1['limit'],_0x542132;if(_0x1547d1>=_0x259d9f){_0x1547d1=_0x259d9f;_0x542132=0xc8;}else{_0x542132=0xce;}_0x3bbf93[_0xaac0('0x1c')](_0x542132);return _0x3bbf93[_0xaac0('0x20')]('Content-Range',_0x59cfbd+'-'+_0x1547d1+'/'+_0x259d9f)[_0xaac0('0x1e')](_0x3182fe);}return null;};}function patchUpdates(_0x300e09){return function(_0x57cdd5){try{jsonpatch[_0xaac0('0x21')](_0x57cdd5,_0x300e09,!![]);}catch(_0xdffa60){return BPromise[_0xaac0('0x22')](_0xdffa60);}return _0x57cdd5['save']();};}function saveUpdates(_0x58f4ba,_0x3dcbe9){return function(_0x221bce){if(_0x221bce){return _0x221bce['update'](_0x58f4ba)['then'](function(_0x33d2cd){return _0x33d2cd;});}return null;};}function removeEntity(_0x20a65e,_0x5aefda){return function(_0x222baa){if(_0x222baa){return _0x222baa[_0xaac0('0x23')]()[_0xaac0('0x24')](function(){_0x20a65e['status'](0xcc)[_0xaac0('0x1d')]();});}};}function handleEntityNotFound(_0x206fb4,_0x2269fd){return function(_0x17d486){if(!_0x17d486){_0x206fb4[_0xaac0('0x1b')](0x194);}return _0x17d486;};}function handleError(_0x285daf,_0x13f0b9){_0x13f0b9=_0x13f0b9||0x1f4;return function(_0x50106e){logger[_0xaac0('0x25')](_0x50106e[_0xaac0('0x26')]);if(_0x50106e[_0xaac0('0x27')]){delete _0x50106e[_0xaac0('0x27')];}_0x285daf['status'](_0x13f0b9)[_0xaac0('0x28')](_0x50106e);};}exports[_0xaac0('0x29')]=function(_0x15f0f4,_0x4c473f){var _0x5b9593={},_0x27a000={},_0x46b879={'count':0x0,'rows':[]};var _0x5c81f6=_['map'](db[_0xaac0('0x2a')][_0xaac0('0x2b')],function(_0x50aae6){return{'name':_0x50aae6['fieldName'],'type':_0x50aae6[_0xaac0('0x2c')][_0xaac0('0x2d')]};});_0x27a000[_0xaac0('0x2e')]=_[_0xaac0('0x2f')](_0x5c81f6,_0xaac0('0x27'));_0x27a000['query']=_[_0xaac0('0x30')](_0x15f0f4[_0xaac0('0x31')]);_0x27a000[_0xaac0('0x32')]=_[_0xaac0('0x33')](_0x27a000[_0xaac0('0x2e')],_0x27a000['query']);_0x5b9593[_0xaac0('0x34')]=_['intersection'](_0x27a000[_0xaac0('0x2e')],qs[_0xaac0('0x35')](_0x15f0f4['query'][_0xaac0('0x35')]));_0x5b9593[_0xaac0('0x34')]=_0x5b9593['attributes'][_0xaac0('0x36')]?_0x5b9593['attributes']:_0x27a000[_0xaac0('0x2e')];if(!_0x15f0f4['query'][_0xaac0('0x37')](_0xaac0('0x38'))){_0x5b9593[_0xaac0('0x39')]=qs[_0xaac0('0x39')](_0x15f0f4[_0xaac0('0x31')][_0xaac0('0x39')]);_0x5b9593[_0xaac0('0x1f')]=qs[_0xaac0('0x1f')](_0x15f0f4[_0xaac0('0x31')][_0xaac0('0x1f')]);}_0x5b9593[_0xaac0('0x3a')]=qs['sort'](_0x15f0f4[_0xaac0('0x31')][_0xaac0('0x3b')]);_0x5b9593[_0xaac0('0x3c')]=qs[_0xaac0('0x32')](_['pick'](_0x15f0f4['query'],_0x27a000['filters']),_0x5c81f6);if(_0x15f0f4['query'][_0xaac0('0x3d')]){_0x5b9593[_0xaac0('0x3c')]=_[_0xaac0('0x3e')](_0x5b9593['where'],{'$or':_['map'](_0x5c81f6,function(_0x4082c1){if(_0x4082c1[_0xaac0('0x2c')]!==_0xaac0('0x3f')){var _0x10730f={};_0x10730f[_0x4082c1['name']]={'$like':'%'+_0x15f0f4['query']['filter']+'%'};return _0x10730f;}})});}_0x5b9593=_[_0xaac0('0x3e')]({},_0x5b9593,_0x15f0f4[_0xaac0('0x40')]);var _0x329c73={'where':_0x5b9593[_0xaac0('0x3c')]};return db[_0xaac0('0x2a')]['count'](_0x329c73)[_0xaac0('0x24')](function(_0x1608e2){_0x46b879[_0xaac0('0x41')]=_0x1608e2;if(_0x15f0f4[_0xaac0('0x31')]['includeAll']){_0x5b9593[_0xaac0('0x42')]=[{'all':!![]}];}return db[_0xaac0('0x2a')]['findAll'](_0x5b9593);})[_0xaac0('0x24')](function(_0xed34ce){_0x46b879[_0xaac0('0x43')]=_0xed34ce;return _0x46b879;})[_0xaac0('0x24')](respondWithFilteredResult(_0x4c473f,_0x5b9593))['catch'](handleError(_0x4c473f,null));};exports['show']=function(_0x21c85e,_0x5be612){var _0x34c859={'raw':!![],'where':{'id':_0x21c85e[_0xaac0('0x44')]['id']}},_0x15543c={};_0x15543c[_0xaac0('0x2e')]=_[_0xaac0('0x30')](db[_0xaac0('0x2a')][_0xaac0('0x2b')]);_0x15543c[_0xaac0('0x31')]=_[_0xaac0('0x30')](_0x21c85e[_0xaac0('0x31')]);_0x15543c['filters']=_[_0xaac0('0x33')](_0x15543c[_0xaac0('0x2e')],_0x15543c['query']);_0x34c859[_0xaac0('0x34')]=_[_0xaac0('0x33')](_0x15543c['model'],qs[_0xaac0('0x35')](_0x21c85e[_0xaac0('0x31')][_0xaac0('0x35')]));_0x34c859[_0xaac0('0x34')]=_0x34c859[_0xaac0('0x34')][_0xaac0('0x36')]?_0x34c859['attributes']:_0x15543c[_0xaac0('0x2e')];if(_0x21c85e[_0xaac0('0x31')][_0xaac0('0x45')]){_0x34c859[_0xaac0('0x42')]=[{'all':!![]}];}_0x34c859=_[_0xaac0('0x3e')]({},_0x34c859,_0x21c85e['options']);return db[_0xaac0('0x2a')][_0xaac0('0x46')](_0x34c859)[_0xaac0('0x24')](handleEntityNotFound(_0x5be612,null))[_0xaac0('0x24')](respondWithResult(_0x5be612,null))['catch'](handleError(_0x5be612,null));};exports[_0xaac0('0x47')]=function(_0x5c473a,_0x28f03a){return db['FaxTransferReport'][_0xaac0('0x47')](_0x5c473a[_0xaac0('0x48')],{})[_0xaac0('0x24')](respondWithResult(_0x28f03a,0xc9))['catch'](handleError(_0x28f03a,null));};exports[_0xaac0('0x49')]=function(_0x168978,_0x2cb95e){if(_0x168978[_0xaac0('0x48')]['id']){delete _0x168978[_0xaac0('0x48')]['id'];}return db[_0xaac0('0x2a')][_0xaac0('0x46')]({'where':{'id':_0x168978[_0xaac0('0x44')]['id']}})[_0xaac0('0x24')](handleEntityNotFound(_0x2cb95e,null))['then'](saveUpdates(_0x168978[_0xaac0('0x48')],null))[_0xaac0('0x24')](respondWithResult(_0x2cb95e,null))[_0xaac0('0x4a')](handleError(_0x2cb95e,null));};exports[_0xaac0('0x23')]=function(_0x2e8176,_0x1587a8){return db[_0xaac0('0x2a')]['find']({'where':{'id':_0x2e8176['params']['id']}})[_0xaac0('0x24')](handleEntityNotFound(_0x1587a8,null))['then'](removeEntity(_0x1587a8,null))[_0xaac0('0x4a')](handleError(_0x1587a8,null));};exports[_0xaac0('0x4b')]=function(_0x207739,_0x3f7dd2){return db[_0xaac0('0x2a')][_0xaac0('0x4b')]()[_0xaac0('0x24')](respondWithResult(_0x3f7dd2,null))['catch'](handleError(_0x3f7dd2,null));}; \ No newline at end of file +var _0xcb41=['apply','save','update','then','error','stack','name','map','FaxTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','show','include','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range'];(function(_0xfedc81,_0x304800){var _0x39a084=function(_0x3e7c9c){while(--_0x3e7c9c){_0xfedc81['push'](_0xfedc81['shift']());}};_0x39a084(++_0x304800);}(_0xcb41,0x1df));var _0x1cb4=function(_0x91fac8,_0x520b20){_0x91fac8=_0x91fac8-0x0;var _0x527e51=_0xcb41[_0x91fac8];return _0x527e51;};'use strict';var pdf=require(_0x1cb4('0x0'));var emlformat=require(_0x1cb4('0x1'));var rimraf=require(_0x1cb4('0x2'));var zipdir=require(_0x1cb4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cb4('0x4'));var moment=require('moment');var BPromise=require(_0x1cb4('0x5'));var Mustache=require(_0x1cb4('0x6'));var util=require(_0x1cb4('0x7'));var path=require(_0x1cb4('0x8'));var sox=require(_0x1cb4('0x9'));var csv=require(_0x1cb4('0xa'));var ejs=require(_0x1cb4('0xb'));var fs=require('fs');var _=require(_0x1cb4('0xc'));var squel=require('squel');var crypto=require(_0x1cb4('0xd'));var jsforce=require(_0x1cb4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1cb4('0xa'));var querystring=require(_0x1cb4('0xf'));var Papa=require(_0x1cb4('0x10'));var Redis=require('ioredis');var authService=require(_0x1cb4('0x11'));var qs=require(_0x1cb4('0x12'));var as=require(_0x1cb4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cb4('0x14'));var utils=require('../../config/utils');var config=require(_0x1cb4('0x15'));var licenseUtil=require(_0x1cb4('0x16'));var db=require(_0x1cb4('0x17'))['db'];function respondWithStatusCode(_0xd57cb1,_0x2409a2){_0x2409a2=_0x2409a2||0xcc;return function(_0x4eafc0){if(_0x4eafc0){return _0xd57cb1[_0x1cb4('0x18')](_0x2409a2);}return _0xd57cb1['status'](_0x2409a2)[_0x1cb4('0x19')]();};}function respondWithResult(_0x3d2f2e,_0x29a3bf){_0x29a3bf=_0x29a3bf||0xc8;return function(_0xb01aec){if(_0xb01aec){return _0x3d2f2e[_0x1cb4('0x1a')](_0x29a3bf)[_0x1cb4('0x1b')](_0xb01aec);}};}function respondWithFilteredResult(_0x34e04e,_0x35783e){return function(_0xc444d){if(_0xc444d){var _0x1858f1=_0xc444d[_0x1cb4('0x1c')],_0x521b49=_0x35783e[_0x1cb4('0x1d')],_0xbc72fd=_0x35783e['offset']+_0x35783e['limit'],_0x514285;if(_0xbc72fd>=_0x1858f1){_0xbc72fd=_0x1858f1;_0x514285=0xc8;}else{_0x514285=0xce;}_0x34e04e[_0x1cb4('0x1a')](_0x514285);return _0x34e04e[_0x1cb4('0x1e')](_0x1cb4('0x1f'),_0x521b49+'-'+_0xbc72fd+'/'+_0x1858f1)[_0x1cb4('0x1b')](_0xc444d);}return null;};}function patchUpdates(_0x274f12){return function(_0x43e481){try{jsonpatch[_0x1cb4('0x20')](_0x43e481,_0x274f12,!![]);}catch(_0xdbb325){return BPromise['reject'](_0xdbb325);}return _0x43e481[_0x1cb4('0x21')]();};}function saveUpdates(_0x1d1a19,_0x5a24ec){return function(_0x33993b){if(_0x33993b){return _0x33993b[_0x1cb4('0x22')](_0x1d1a19)[_0x1cb4('0x23')](function(_0x19d342){return _0x19d342;});}return null;};}function removeEntity(_0x4e5f9b,_0x316325){return function(_0x51fc8d){if(_0x51fc8d){return _0x51fc8d['destroy']()[_0x1cb4('0x23')](function(){_0x4e5f9b[_0x1cb4('0x1a')](0xcc)[_0x1cb4('0x19')]();});}};}function handleEntityNotFound(_0x4d93b9,_0x3533e8){return function(_0x33ec9c){if(!_0x33ec9c){_0x4d93b9[_0x1cb4('0x18')](0x194);}return _0x33ec9c;};}function handleError(_0x5bce36,_0x70d3dc){_0x70d3dc=_0x70d3dc||0x1f4;return function(_0x1e8d9c){logger[_0x1cb4('0x24')](_0x1e8d9c[_0x1cb4('0x25')]);if(_0x1e8d9c['name']){delete _0x1e8d9c[_0x1cb4('0x26')];}_0x5bce36['status'](_0x70d3dc)['send'](_0x1e8d9c);};}exports['index']=function(_0x242185,_0x54b46f){var _0x28ac89={},_0x17f4e1={},_0x569fff={'count':0x0,'rows':[]};var _0x5ef7b0=_[_0x1cb4('0x27')](db[_0x1cb4('0x28')][_0x1cb4('0x29')],function(_0x253864){return{'name':_0x253864[_0x1cb4('0x2a')],'type':_0x253864[_0x1cb4('0x2b')]['key']};});_0x17f4e1['model']=_['map'](_0x5ef7b0,_0x1cb4('0x26'));_0x17f4e1[_0x1cb4('0x2c')]=_[_0x1cb4('0x2d')](_0x242185[_0x1cb4('0x2c')]);_0x17f4e1[_0x1cb4('0x2e')]=_[_0x1cb4('0x2f')](_0x17f4e1[_0x1cb4('0x30')],_0x17f4e1[_0x1cb4('0x2c')]);_0x28ac89[_0x1cb4('0x31')]=_[_0x1cb4('0x2f')](_0x17f4e1[_0x1cb4('0x30')],qs[_0x1cb4('0x32')](_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x32')]));_0x28ac89[_0x1cb4('0x31')]=_0x28ac89[_0x1cb4('0x31')][_0x1cb4('0x33')]?_0x28ac89[_0x1cb4('0x31')]:_0x17f4e1['model'];if(!_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x34')](_0x1cb4('0x35'))){_0x28ac89[_0x1cb4('0x36')]=qs[_0x1cb4('0x36')](_0x242185['query'][_0x1cb4('0x36')]);_0x28ac89[_0x1cb4('0x1d')]=qs[_0x1cb4('0x1d')](_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x1d')]);}_0x28ac89[_0x1cb4('0x37')]=qs[_0x1cb4('0x38')](_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x38')]);_0x28ac89['where']=qs['filters'](_[_0x1cb4('0x39')](_0x242185['query'],_0x17f4e1['filters']),_0x5ef7b0);if(_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x3a')]){_0x28ac89[_0x1cb4('0x3b')]=_[_0x1cb4('0x3c')](_0x28ac89[_0x1cb4('0x3b')],{'$or':_[_0x1cb4('0x27')](_0x5ef7b0,function(_0x5e2c65){if(_0x5e2c65[_0x1cb4('0x2b')]!==_0x1cb4('0x3d')){var _0x31bef7={};_0x31bef7[_0x5e2c65[_0x1cb4('0x26')]]={'$like':'%'+_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x3a')]+'%'};return _0x31bef7;}})});}_0x28ac89=_['merge']({},_0x28ac89,_0x242185[_0x1cb4('0x3e')]);var _0x388684={'where':_0x28ac89[_0x1cb4('0x3b')]};return db[_0x1cb4('0x28')][_0x1cb4('0x1c')](_0x388684)[_0x1cb4('0x23')](function(_0x59d6c7){_0x569fff[_0x1cb4('0x1c')]=_0x59d6c7;if(_0x242185[_0x1cb4('0x2c')][_0x1cb4('0x3f')]){_0x28ac89['include']=[{'all':!![]}];}return db[_0x1cb4('0x28')]['findAll'](_0x28ac89);})[_0x1cb4('0x23')](function(_0x313767){_0x569fff['rows']=_0x313767;return _0x569fff;})['then'](respondWithFilteredResult(_0x54b46f,_0x28ac89))['catch'](handleError(_0x54b46f,null));};exports[_0x1cb4('0x40')]=function(_0x1ff523,_0x230b73){var _0x1730f8={'raw':!![],'where':{'id':_0x1ff523['params']['id']}},_0x1e4616={};_0x1e4616['model']=_[_0x1cb4('0x2d')](db[_0x1cb4('0x28')][_0x1cb4('0x29')]);_0x1e4616[_0x1cb4('0x2c')]=_[_0x1cb4('0x2d')](_0x1ff523[_0x1cb4('0x2c')]);_0x1e4616[_0x1cb4('0x2e')]=_[_0x1cb4('0x2f')](_0x1e4616[_0x1cb4('0x30')],_0x1e4616[_0x1cb4('0x2c')]);_0x1730f8[_0x1cb4('0x31')]=_['intersection'](_0x1e4616['model'],qs[_0x1cb4('0x32')](_0x1ff523[_0x1cb4('0x2c')]['fields']));_0x1730f8[_0x1cb4('0x31')]=_0x1730f8[_0x1cb4('0x31')][_0x1cb4('0x33')]?_0x1730f8[_0x1cb4('0x31')]:_0x1e4616['model'];if(_0x1ff523[_0x1cb4('0x2c')][_0x1cb4('0x3f')]){_0x1730f8[_0x1cb4('0x41')]=[{'all':!![]}];}_0x1730f8=_[_0x1cb4('0x3c')]({},_0x1730f8,_0x1ff523['options']);return db[_0x1cb4('0x28')][_0x1cb4('0x42')](_0x1730f8)['then'](handleEntityNotFound(_0x230b73,null))['then'](respondWithResult(_0x230b73,null))[_0x1cb4('0x43')](handleError(_0x230b73,null));};exports['create']=function(_0x48235c,_0x1835a2){return db[_0x1cb4('0x28')][_0x1cb4('0x44')](_0x48235c['body'],{})[_0x1cb4('0x23')](respondWithResult(_0x1835a2,0xc9))[_0x1cb4('0x43')](handleError(_0x1835a2,null));};exports[_0x1cb4('0x22')]=function(_0x41ee98,_0x3171e8){if(_0x41ee98['body']['id']){delete _0x41ee98[_0x1cb4('0x45')]['id'];}return db[_0x1cb4('0x28')][_0x1cb4('0x42')]({'where':{'id':_0x41ee98[_0x1cb4('0x46')]['id']}})[_0x1cb4('0x23')](handleEntityNotFound(_0x3171e8,null))['then'](saveUpdates(_0x41ee98[_0x1cb4('0x45')],null))[_0x1cb4('0x23')](respondWithResult(_0x3171e8,null))[_0x1cb4('0x43')](handleError(_0x3171e8,null));};exports[_0x1cb4('0x47')]=function(_0x1e0157,_0x38faa3){return db[_0x1cb4('0x28')][_0x1cb4('0x42')]({'where':{'id':_0x1e0157[_0x1cb4('0x46')]['id']}})['then'](handleEntityNotFound(_0x38faa3,null))[_0x1cb4('0x23')](removeEntity(_0x38faa3,null))['catch'](handleError(_0x38faa3,null));};exports[_0x1cb4('0x48')]=function(_0x1298af,_0x3472c5){return db[_0x1cb4('0x28')][_0x1cb4('0x48')]()[_0x1cb4('0x23')](respondWithResult(_0x3472c5,null))[_0x1cb4('0x43')](handleError(_0x3472c5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 30ee4f2..f5f0bd7 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 _0x5351=['FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x297fe9,_0x2a310e){var _0x493e6a=function(_0x4eacb2){while(--_0x4eacb2){_0x297fe9['push'](_0x297fe9['shift']());}};_0x493e6a(++_0x2a310e);}(_0x5351,0x1d1));var _0x1535=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5351[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x1535('0x0'));var logger=require(_0x1535('0x1'))(_0x1535('0x2'));var moment=require(_0x1535('0x3'));var BPromise=require(_0x1535('0x4'));var rp=require(_0x1535('0x5'));var fs=require('fs');var path=require(_0x1535('0x6'));var rimraf=require(_0x1535('0x7'));var config=require(_0x1535('0x8'));var attributes=require(_0x1535('0x9'));module['exports']=function(_0x5a4c45,_0x40c426){return _0x5a4c45[_0x1535('0xa')](_0x1535('0xb'),attributes,{'tableName':_0x1535('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1535('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x900e=['uniqueid','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports','define','report_fax_transfer'];(function(_0x597ac6,_0x55a3e4){var _0x5883e7=function(_0x36f00e){while(--_0x36f00e){_0x597ac6['push'](_0x597ac6['shift']());}};_0x5883e7(++_0x55a3e4);}(_0x900e,0x1cd));var _0xe900=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x900e[_0x46e523];return _0x5da0ee;};'use strict';var _=require(_0xe900('0x0'));var util=require(_0xe900('0x1'));var logger=require(_0xe900('0x2'))(_0xe900('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(_0xe900('0x4'));var config=require(_0xe900('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0xe900('0x6')]=function(_0x334b96,_0x1c2612){return _0x334b96[_0xe900('0x7')]('FaxTransferReport',attributes,{'tableName':_0xe900('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe900('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a00cfee..9cd60c0 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 _0xeb5f=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','message','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x7de33e,_0x46a873){var _0x9b0f8=function(_0x264f7f){while(--_0x264f7f){_0x7de33e['push'](_0x7de33e['shift']());}};_0x9b0f8(++_0x46a873);}(_0xeb5f,0x15e));var _0xfeb5=function(_0x59ec7d,_0x112cd8){_0x59ec7d=_0x59ec7d-0x0;var _0x3df1a0=_0xeb5f[_0x59ec7d];return _0x3df1a0;};'use strict';var _=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var moment=require(_0xfeb5('0x2'));var BPromise=require('bluebird');var rs=require(_0xfeb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfeb5('0x4'))['db'];var utils=require(_0xfeb5('0x5'));var logger=require(_0xfeb5('0x6'))(_0xfeb5('0x7'));var config=require(_0xfeb5('0x8'));var jayson=require(_0xfeb5('0x9'));var client=jayson[_0xfeb5('0xa')][_0xfeb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e338c,_0x5c5b10,_0x1e30f4){return new BPromise(function(_0x33785f,_0x59b6ef){return client['request'](_0x5e338c,_0x1e30f4)[_0xfeb5('0xc')](function(_0x13a822){logger[_0xfeb5('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x5c5b10,_0xfeb5('0xe'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5c5b10,'request\x20sent',JSON['stringify'](_0x13a822));if(_0x13a822[_0xfeb5('0xf')]){if(_0x13a822[_0xfeb5('0xf')][_0xfeb5('0x10')]===0x1f4){logger[_0xfeb5('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5c5b10,_0x13a822['error'][_0xfeb5('0x11')]);return _0x59b6ef(_0x13a822['error']['message']);}logger['error'](_0xfeb5('0x12'),_0x5c5b10,_0x13a822[_0xfeb5('0xf')][_0xfeb5('0x11')]);return _0x33785f(_0x13a822['error'][_0xfeb5('0x11')]);}else{logger[_0xfeb5('0xd')](_0xfeb5('0x12'),_0x5c5b10,'request\x20sent');_0x33785f(_0x13a822[_0xfeb5('0x13')][_0xfeb5('0x11')]);}})[_0xfeb5('0x14')](function(_0x51ad9b){logger[_0xfeb5('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5c5b10,_0x51ad9b);_0x59b6ef(_0x51ad9b);});});} \ No newline at end of file +var _0x9140=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x11b266,_0x5c8a35){var _0x3986e7=function(_0x1172e9){while(--_0x1172e9){_0x11b266['push'](_0x11b266['shift']());}};_0x3986e7(++_0x5c8a35);}(_0x9140,0x16a));var _0x0914=function(_0x9a359f,_0x32bf5f){_0x9a359f=_0x9a359f-0x0;var _0x5680e1=_0x9140[_0x9a359f];return _0x5680e1;};'use strict';var _=require('lodash');var util=require(_0x0914('0x0'));var moment=require(_0x0914('0x1'));var BPromise=require(_0x0914('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0914('0x3'));var db=require(_0x0914('0x4'))['db'];var utils=require(_0x0914('0x5'));var logger=require(_0x0914('0x6'))(_0x0914('0x7'));var config=require(_0x0914('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0914('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48e154,_0x470c2d,_0x1bb03b){return new BPromise(function(_0x7ff027,_0x4d58cf){return client[_0x0914('0xa')](_0x48e154,_0x1bb03b)[_0x0914('0xb')](function(_0x32c70d){logger[_0x0914('0xc')](_0x0914('0xd'),_0x470c2d,'request\x20sent');logger['debug'](_0x0914('0xe'),_0x470c2d,_0x0914('0xf'),JSON['stringify'](_0x32c70d));if(_0x32c70d[_0x0914('0x10')]){if(_0x32c70d[_0x0914('0x10')][_0x0914('0x11')]===0x1f4){logger[_0x0914('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x470c2d,_0x32c70d[_0x0914('0x10')][_0x0914('0x12')]);return _0x4d58cf(_0x32c70d[_0x0914('0x10')][_0x0914('0x12')]);}logger['error'](_0x0914('0xd'),_0x470c2d,_0x32c70d[_0x0914('0x10')][_0x0914('0x12')]);return _0x7ff027(_0x32c70d[_0x0914('0x10')][_0x0914('0x12')]);}else{logger[_0x0914('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x470c2d,_0x0914('0xf'));_0x7ff027(_0x32c70d[_0x0914('0x13')]['message']);}})[_0x0914('0x14')](function(_0x2f1c5f){logger[_0x0914('0x10')](_0x0914('0xd'),_0x470c2d,_0x2f1c5f);_0x4d58cf(_0x2f1c5f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 5ceec28..93aa69d 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 _0x0a9b=['../../config/environment','./faxTransferReport.controller','get','index','/describe','/:id','show','post','create','put','isAuthenticated','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0a9b,0x109));var _0xb0a9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a9b[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xb0a9('0x0'));var util=require('util');var path=require(_0xb0a9('0x1'));var timeout=require(_0xb0a9('0x2'));var express=require(_0xb0a9('0x3'));var router=express[_0xb0a9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb0a9('0x5'));var controller=require(_0xb0a9('0x6'));router[_0xb0a9('0x7')]('/',auth['isAuthenticated'](),controller[_0xb0a9('0x8')]);router[_0xb0a9('0x7')](_0xb0a9('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xb0a9('0x7')](_0xb0a9('0xa'),auth['isAuthenticated'](),controller[_0xb0a9('0xb')]);router[_0xb0a9('0xc')]('/',auth['isAuthenticated'](),controller[_0xb0a9('0xd')]);router[_0xb0a9('0xe')](_0xb0a9('0xa'),auth[_0xb0a9('0xf')](),controller['update']);router[_0xb0a9('0x10')](_0xb0a9('0xa'),auth[_0xb0a9('0xf')](),controller[_0xb0a9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0dc3=['util','path','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x2096af,_0x552b67){var _0x437883=function(_0x2d5062){while(--_0x2d5062){_0x2096af['push'](_0x2096af['shift']());}};_0x437883(++_0x552b67);}(_0x0dc3,0x156));var _0x30dc=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x0dc3[_0x3747ae];return _0x339035;};'use strict';var multer=require('multer');var util=require(_0x30dc('0x0'));var path=require(_0x30dc('0x1'));var timeout=require('connect-timeout');var express=require(_0x30dc('0x2'));var router=express[_0x30dc('0x3')]();var auth=require(_0x30dc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x30dc('0x5'));var controller=require(_0x30dc('0x6'));router[_0x30dc('0x7')]('/',auth['isAuthenticated'](),controller[_0x30dc('0x8')]);router['get'](_0x30dc('0x9'),auth[_0x30dc('0xa')](),controller[_0x30dc('0xb')]);router['get'](_0x30dc('0xc'),auth[_0x30dc('0xa')](),controller[_0x30dc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x30dc('0xe')]);router[_0x30dc('0xf')](_0x30dc('0xc'),auth[_0x30dc('0xa')](),controller[_0x30dc('0x10')]);router[_0x30dc('0x11')](_0x30dc('0xc'),auth[_0x30dc('0xa')](),controller[_0x30dc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 37319c5..6118583 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 _0x3a4d=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete'];(function(_0x4f77bc,_0x4038f1){var _0x97d26=function(_0x9089f3){while(--_0x9089f3){_0x4f77bc['push'](_0x4f77bc['shift']());}};_0x97d26(++_0x4038f1);}(_0x3a4d,0xb1));var _0xd3a4=function(_0x57041d,_0x3c34ad){_0x57041d=_0x57041d-0x0;var _0x5c5372=_0x3a4d[_0x57041d];return _0x5c5372;};'use strict';var multer=require('multer');var util=require(_0xd3a4('0x0'));var path=require(_0xd3a4('0x1'));var timeout=require(_0xd3a4('0x2'));var express=require('express');var router=express[_0xd3a4('0x3')]();var auth=require(_0xd3a4('0x4'));var interaction=require(_0xd3a4('0x5'));var config=require(_0xd3a4('0x6'));var controller=require(_0xd3a4('0x7'));router['get']('/',auth[_0xd3a4('0x8')](),controller[_0xd3a4('0x9')]);router[_0xd3a4('0xa')](_0xd3a4('0xb'),auth['isAuthenticated'](),controller[_0xd3a4('0xc')]);router[_0xd3a4('0xa')](_0xd3a4('0xd'),auth['isAuthenticated'](),controller[_0xd3a4('0xe')]);router[_0xd3a4('0xa')](_0xd3a4('0xf'),auth[_0xd3a4('0x8')](),controller[_0xd3a4('0x10')]);router[_0xd3a4('0x11')]('/',auth['isAuthenticated'](),controller[_0xd3a4('0x12')]);router['post'](_0xd3a4('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd3a4('0x13')](_0xd3a4('0xb'),auth[_0xd3a4('0x8')](),controller['update']);router[_0xd3a4('0x14')](_0xd3a4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3a4('0x15')]=router; \ No newline at end of file +var _0x4c0d=['put','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post'];(function(_0x1f69bc,_0xaffd71){var _0x1ac3c5=function(_0x3cd005){while(--_0x3cd005){_0x1f69bc['push'](_0x1f69bc['shift']());}};_0x1ac3c5(++_0xaffd71);}(_0x4c0d,0xd4));var _0xd4c0=function(_0x42bad2,_0x4ff953){_0x42bad2=_0x42bad2-0x0;var _0x21fd01=_0x4c0d[_0x42bad2];return _0x21fd01;};'use strict';var multer=require(_0xd4c0('0x0'));var util=require(_0xd4c0('0x1'));var path=require('path');var timeout=require(_0xd4c0('0x2'));var express=require(_0xd4c0('0x3'));var router=express[_0xd4c0('0x4')]();var auth=require(_0xd4c0('0x5'));var interaction=require(_0xd4c0('0x6'));var config=require('../../config/environment');var controller=require(_0xd4c0('0x7'));router[_0xd4c0('0x8')]('/',auth[_0xd4c0('0x9')](),controller[_0xd4c0('0xa')]);router[_0xd4c0('0x8')](_0xd4c0('0xb'),auth[_0xd4c0('0x9')](),controller[_0xd4c0('0xc')]);router[_0xd4c0('0x8')]('/:id/configurations',auth[_0xd4c0('0x9')](),controller['getConfigurations']);router[_0xd4c0('0x8')](_0xd4c0('0xd'),auth[_0xd4c0('0x9')](),controller[_0xd4c0('0xe')]);router[_0xd4c0('0xf')]('/',auth[_0xd4c0('0x9')](),controller['create']);router[_0xd4c0('0xf')]('/:id/configurations',auth[_0xd4c0('0x9')](),controller['addConfiguration']);router[_0xd4c0('0x10')](_0xd4c0('0xb'),auth['isAuthenticated'](),controller[_0xd4c0('0x11')]);router[_0xd4c0('0x12')](_0xd4c0('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index dedc822..1e6c1c0 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 _0x18c9=['STRING','basic','ENUM','integrationTab','sequelize','exports'];(function(_0x1160ce,_0x140eca){var _0x38ea0a=function(_0x5a2a4e){while(--_0x5a2a4e){_0x1160ce['push'](_0x1160ce['shift']());}};_0x38ea0a(++_0x140eca);}(_0x18c9,0x13c));var _0x918c=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x18c9[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x918c('0x0'));module[_0x918c('0x1')]={'name':{'type':Sequelize[_0x918c('0x2')]},'description':{'type':Sequelize[_0x918c('0x2')]},'username':{'type':Sequelize[_0x918c('0x2')]},'remoteUri':{'type':Sequelize[_0x918c('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x918c('0x3')),'defaultValue':_0x918c('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x918c('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x918c('0x2')]},'tokenSecret':{'type':Sequelize[_0x918c('0x2')]},'serverUrl':{'type':Sequelize[_0x918c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x918c('0x4')](_0x918c('0x5'),'newTab'),'defaultValue':_0x918c('0x5')}}; \ No newline at end of file +var _0xdaa8=['sequelize','exports','STRING','ENUM','newTab','integrationTab'];(function(_0x58c3ff,_0x124777){var _0x4e5a30=function(_0x4052ef){while(--_0x4052ef){_0x58c3ff['push'](_0x58c3ff['shift']());}};_0x4e5a30(++_0x124777);}(_0xdaa8,0xe4));var _0x8daa=function(_0x36d8b5,_0x5deedd){_0x36d8b5=_0x36d8b5-0x0;var _0x30dd54=_0xdaa8[_0x36d8b5];return _0x30dd54;};'use strict';var Sequelize=require(_0x8daa('0x0'));module[_0x8daa('0x1')]={'name':{'type':Sequelize[_0x8daa('0x2')]},'description':{'type':Sequelize[_0x8daa('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x8daa('0x2')]},'consumerSecret':{'type':Sequelize[_0x8daa('0x2')]},'token':{'type':Sequelize[_0x8daa('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8daa('0x3')]('integrationTab',_0x8daa('0x4')),'defaultValue':_0x8daa('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f0fffa2..2bfa9fa 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 _0x4bcb=['channel','type','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerKey','token','slice','substring','lastIndexOf','format','application/json','basic','Authorization','%s:%s','toString','base64','concat','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','DeskAccount','fieldName','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','include','rows','catch','keys','rawAttributes','fields','includeAll','find','create','body','params','destroy','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','Subjects','getSubjects'];(function(_0x305aba,_0x271372){var _0x379613=function(_0x23858e){while(--_0x23858e){_0x305aba['push'](_0x305aba['shift']());}};_0x379613(++_0x271372);}(_0x4bcb,0x93));var _0xb4bc=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x4bcb[_0x25c326];return _0x762452;};'use strict';var pdf=require(_0xb4bc('0x0'));var emlformat=require(_0xb4bc('0x1'));var rimraf=require(_0xb4bc('0x2'));var zipdir=require(_0xb4bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4bc('0x4'));var moment=require(_0xb4bc('0x5'));var BPromise=require(_0xb4bc('0x6'));var Mustache=require(_0xb4bc('0x7'));var util=require(_0xb4bc('0x8'));var path=require(_0xb4bc('0x9'));var sox=require(_0xb4bc('0xa'));var csv=require(_0xb4bc('0xb'));var ejs=require(_0xb4bc('0xc'));var fs=require('fs');var _=require(_0xb4bc('0xd'));var squel=require(_0xb4bc('0xe'));var crypto=require('crypto');var jsforce=require(_0xb4bc('0xf'));var deskjs=require(_0xb4bc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb4bc('0x11'));var Papa=require(_0xb4bc('0x12'));var Redis=require(_0xb4bc('0x13'));var authService=require(_0xb4bc('0x14'));var qs=require(_0xb4bc('0x15'));var as=require(_0xb4bc('0x16'));var hardwareService=require(_0xb4bc('0x17'));var logger=require(_0xb4bc('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xb4bc('0x19'));var licenseUtil=require(_0xb4bc('0x1a'));var db=require(_0xb4bc('0x1b'))['db'];var integrations=require(_0xb4bc('0x1c'));var jayson=require(_0xb4bc('0x1d'));var client=jayson['client'][_0xb4bc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1cdf65,_0xb034f3,_0x1c0ae8,_0x32c986){return new BPromise(function(_0x341718,_0xf6de83){var _0x5fcdc2=_0x32c986||client;return _0x5fcdc2[_0xb4bc('0x1f')](_0x1cdf65,_0x1c0ae8)[_0xb4bc('0x20')](function(_0x3c1c45){logger[_0xb4bc('0x21')]('DeskAccount,\x20%s,\x20%s',_0xb034f3,'request\x20sent');logger[_0xb4bc('0x22')](_0xb4bc('0x23'),_0xb034f3,_0xb4bc('0x24'),JSON[_0xb4bc('0x25')](_0x3c1c45));if(_0x3c1c45[_0xb4bc('0x26')]){if(_0x3c1c45['error'][_0xb4bc('0x27')]===0x1f4){logger[_0xb4bc('0x26')](_0xb4bc('0x28'),_0xb034f3,_0x3c1c45[_0xb4bc('0x26')][_0xb4bc('0x29')]);return _0xf6de83(_0x3c1c45[_0xb4bc('0x26')][_0xb4bc('0x29')]);}logger[_0xb4bc('0x26')](_0xb4bc('0x28'),_0xb034f3,_0x3c1c45['error'][_0xb4bc('0x29')]);return _0x341718(_0x3c1c45[_0xb4bc('0x26')][_0xb4bc('0x29')]);}else{logger[_0xb4bc('0x21')]('DeskAccount,\x20%s,\x20%s',_0xb034f3,_0xb4bc('0x24'));_0x341718(_0x3c1c45['result'][_0xb4bc('0x29')]);}})['catch'](function(_0x2990c1){logger['error'](_0xb4bc('0x28'),_0xb034f3,_0x2990c1);_0xf6de83(_0x2990c1);});});}function respondWithStatusCode(_0x1c3d0e,_0x5017a4){_0x5017a4=_0x5017a4||0xcc;return function(_0x3a81ff){if(_0x3a81ff){return _0x1c3d0e[_0xb4bc('0x2a')](_0x5017a4);}return _0x1c3d0e['status'](_0x5017a4)[_0xb4bc('0x2b')]();};}function respondWithResult(_0x2bd71f,_0x46c833){_0x46c833=_0x46c833||0xc8;return function(_0x17c278){if(_0x17c278){return _0x2bd71f[_0xb4bc('0x2c')](_0x46c833)[_0xb4bc('0x2d')](_0x17c278);}};}function respondWithFilteredResult(_0x4c01f3,_0x1071e4){return function(_0x1a2f48){if(_0x1a2f48){var _0x58770d=_0x1a2f48[_0xb4bc('0x2e')],_0x3a9002=_0x1071e4[_0xb4bc('0x2f')],_0x4d10d7=_0x1071e4[_0xb4bc('0x2f')]+_0x1071e4[_0xb4bc('0x30')],_0x56491e;if(_0x4d10d7>=_0x58770d){_0x4d10d7=_0x58770d;_0x56491e=0xc8;}else{_0x56491e=0xce;}_0x4c01f3[_0xb4bc('0x2c')](_0x56491e);return _0x4c01f3[_0xb4bc('0x31')](_0xb4bc('0x32'),_0x3a9002+'-'+_0x4d10d7+'/'+_0x58770d)[_0xb4bc('0x2d')](_0x1a2f48);}return null;};}function patchUpdates(_0x58b710){return function(_0x4e9dcf){try{jsonpatch[_0xb4bc('0x33')](_0x4e9dcf,_0x58b710,!![]);}catch(_0xf0c381){return BPromise[_0xb4bc('0x34')](_0xf0c381);}return _0x4e9dcf['save']();};}function saveUpdates(_0x42fbf0,_0x585aaf){return function(_0xdf9602){if(_0xdf9602){return _0xdf9602[_0xb4bc('0x35')](_0x42fbf0)[_0xb4bc('0x20')](function(_0x332b54){return _0x332b54;});}return null;};}function removeEntity(_0x22ff46,_0x7d6e28){return function(_0x32a9ec){if(_0x32a9ec){return _0x32a9ec['destroy']()[_0xb4bc('0x20')](function(){_0x22ff46[_0xb4bc('0x2c')](0xcc)[_0xb4bc('0x2b')]();});}};}function handleEntityNotFound(_0x330b51,_0x4f8599){return function(_0x22d942){if(!_0x22d942){_0x330b51['sendStatus'](0x194);}return _0x22d942;};}function handleError(_0x16f9c4,_0x1e4082){_0x1e4082=_0x1e4082||0x1f4;return function(_0x573dc1){logger[_0xb4bc('0x26')](_0x573dc1[_0xb4bc('0x36')]);if(_0x573dc1[_0xb4bc('0x37')]){delete _0x573dc1[_0xb4bc('0x37')];}_0x16f9c4[_0xb4bc('0x2c')](_0x1e4082)[_0xb4bc('0x38')](_0x573dc1);};}exports[_0xb4bc('0x39')]=function(_0x2bcf2b,_0x88180c){var _0x33e71e={},_0x125a7c={},_0x5ac74e={'count':0x0,'rows':[]};var _0x32528f=_['map'](db[_0xb4bc('0x3a')]['rawAttributes'],function(_0x98c02e){return{'name':_0x98c02e[_0xb4bc('0x3b')],'type':_0x98c02e['type'][_0xb4bc('0x3c')]};});_0x125a7c[_0xb4bc('0x3d')]=_[_0xb4bc('0x3e')](_0x32528f,_0xb4bc('0x37'));_0x125a7c[_0xb4bc('0x3f')]=_['keys'](_0x2bcf2b[_0xb4bc('0x3f')]);_0x125a7c['filters']=_[_0xb4bc('0x40')](_0x125a7c[_0xb4bc('0x3d')],_0x125a7c['query']);_0x33e71e[_0xb4bc('0x41')]=_[_0xb4bc('0x40')](_0x125a7c[_0xb4bc('0x3d')],qs['fields'](_0x2bcf2b[_0xb4bc('0x3f')]['fields']));_0x33e71e[_0xb4bc('0x41')]=_0x33e71e[_0xb4bc('0x41')][_0xb4bc('0x42')]?_0x33e71e[_0xb4bc('0x41')]:_0x125a7c[_0xb4bc('0x3d')];if(!_0x2bcf2b[_0xb4bc('0x3f')][_0xb4bc('0x43')](_0xb4bc('0x44'))){_0x33e71e[_0xb4bc('0x30')]=qs[_0xb4bc('0x30')](_0x2bcf2b[_0xb4bc('0x3f')]['limit']);_0x33e71e[_0xb4bc('0x2f')]=qs[_0xb4bc('0x2f')](_0x2bcf2b[_0xb4bc('0x3f')]['offset']);}_0x33e71e[_0xb4bc('0x45')]=qs['sort'](_0x2bcf2b['query'][_0xb4bc('0x46')]);_0x33e71e[_0xb4bc('0x47')]=qs[_0xb4bc('0x48')](_['pick'](_0x2bcf2b[_0xb4bc('0x3f')],_0x125a7c[_0xb4bc('0x48')]),_0x32528f);if(_0x2bcf2b[_0xb4bc('0x3f')]['filter']){_0x33e71e[_0xb4bc('0x47')]=_[_0xb4bc('0x49')](_0x33e71e[_0xb4bc('0x47')],{'$or':_[_0xb4bc('0x3e')](_0x32528f,function(_0x54c650){if(_0x54c650['type']!=='VIRTUAL'){var _0x22b024={};_0x22b024[_0x54c650['name']]={'$like':'%'+_0x2bcf2b[_0xb4bc('0x3f')][_0xb4bc('0x4a')]+'%'};return _0x22b024;}})});}_0x33e71e=_[_0xb4bc('0x49')]({},_0x33e71e,_0x2bcf2b[_0xb4bc('0x4b')]);var _0x463365={'where':_0x33e71e[_0xb4bc('0x47')]};return db['DeskAccount'][_0xb4bc('0x2e')](_0x463365)[_0xb4bc('0x20')](function(_0x590791){_0x5ac74e[_0xb4bc('0x2e')]=_0x590791;if(_0x2bcf2b[_0xb4bc('0x3f')]['includeAll']){_0x33e71e[_0xb4bc('0x4c')]=[{'all':!![]}];}return db[_0xb4bc('0x3a')]['findAll'](_0x33e71e);})[_0xb4bc('0x20')](function(_0x53d184){_0x5ac74e[_0xb4bc('0x4d')]=_0x53d184;return _0x5ac74e;})[_0xb4bc('0x20')](respondWithFilteredResult(_0x88180c,_0x33e71e))[_0xb4bc('0x4e')](handleError(_0x88180c,null));};exports['show']=function(_0x5f5a73,_0x20d8c3){var _0xa1101a={'raw':![],'where':{'id':_0x5f5a73['params']['id']}},_0x39c94a={};_0x39c94a[_0xb4bc('0x3d')]=_[_0xb4bc('0x4f')](db[_0xb4bc('0x3a')][_0xb4bc('0x50')]);_0x39c94a[_0xb4bc('0x3f')]=_[_0xb4bc('0x4f')](_0x5f5a73[_0xb4bc('0x3f')]);_0x39c94a[_0xb4bc('0x48')]=_[_0xb4bc('0x40')](_0x39c94a[_0xb4bc('0x3d')],_0x39c94a['query']);_0xa1101a[_0xb4bc('0x41')]=_[_0xb4bc('0x40')](_0x39c94a['model'],qs[_0xb4bc('0x51')](_0x5f5a73[_0xb4bc('0x3f')]['fields']));_0xa1101a[_0xb4bc('0x41')]=_0xa1101a[_0xb4bc('0x41')][_0xb4bc('0x42')]?_0xa1101a[_0xb4bc('0x41')]:_0x39c94a[_0xb4bc('0x3d')];if(_0x5f5a73[_0xb4bc('0x3f')][_0xb4bc('0x52')]){_0xa1101a[_0xb4bc('0x4c')]=[{'all':!![]}];}_0xa1101a=_[_0xb4bc('0x49')]({},_0xa1101a,_0x5f5a73[_0xb4bc('0x4b')]);return db[_0xb4bc('0x3a')][_0xb4bc('0x53')](_0xa1101a)['then'](handleEntityNotFound(_0x20d8c3,null))[_0xb4bc('0x20')](respondWithResult(_0x20d8c3,null))[_0xb4bc('0x4e')](handleError(_0x20d8c3,null));};exports[_0xb4bc('0x54')]=function(_0x103b06,_0x2323c4){return db['DeskAccount'][_0xb4bc('0x54')](_0x103b06[_0xb4bc('0x55')],{})[_0xb4bc('0x20')](respondWithResult(_0x2323c4,0xc9))[_0xb4bc('0x4e')](handleError(_0x2323c4,null));};exports[_0xb4bc('0x35')]=function(_0x263ba8,_0x25af2c){if(_0x263ba8[_0xb4bc('0x55')]['id']){delete _0x263ba8[_0xb4bc('0x55')]['id'];}return db['DeskAccount'][_0xb4bc('0x53')]({'where':{'id':_0x263ba8[_0xb4bc('0x56')]['id']}})[_0xb4bc('0x20')](handleEntityNotFound(_0x25af2c,null))['then'](saveUpdates(_0x263ba8[_0xb4bc('0x55')],null))[_0xb4bc('0x20')](respondWithResult(_0x25af2c,null))[_0xb4bc('0x4e')](handleError(_0x25af2c,null));};exports[_0xb4bc('0x57')]=function(_0x1881c5,_0x16c0b2){return db[_0xb4bc('0x3a')][_0xb4bc('0x53')]({'where':{'id':_0x1881c5['params']['id']}})[_0xb4bc('0x20')](handleEntityNotFound(_0x16c0b2,null))[_0xb4bc('0x20')](removeEntity(_0x16c0b2,null))['catch'](handleError(_0x16c0b2,null));};exports[_0xb4bc('0x58')]=function(_0x4fdc4c,_0x5c202a,_0x15830e){var _0x5a6f93={};var _0x123e64={};var _0x218128;var _0xc0f13;return db[_0xb4bc('0x3a')][_0xb4bc('0x59')]({'where':{'id':_0x4fdc4c[_0xb4bc('0x56')]['id']}})[_0xb4bc('0x20')](handleEntityNotFound(_0x5c202a,null))[_0xb4bc('0x20')](function(_0x3483f9){if(_0x3483f9){_0x218128=_0x3483f9;_0x123e64[_0xb4bc('0x3d')]=_[_0xb4bc('0x4f')](db[_0xb4bc('0x5a')][_0xb4bc('0x50')]);_0x123e64[_0xb4bc('0x3f')]=_[_0xb4bc('0x4f')](_0x4fdc4c[_0xb4bc('0x3f')]);_0x123e64[_0xb4bc('0x48')]=_[_0xb4bc('0x40')](_0x123e64['model'],_0x123e64[_0xb4bc('0x3f')]);_0x5a6f93['attributes']=_[_0xb4bc('0x40')](_0x123e64[_0xb4bc('0x3d')],qs[_0xb4bc('0x51')](_0x4fdc4c[_0xb4bc('0x3f')]['fields']));_0x5a6f93[_0xb4bc('0x41')]=_0x5a6f93[_0xb4bc('0x41')][_0xb4bc('0x42')]?_0x5a6f93[_0xb4bc('0x41')]:_0x123e64[_0xb4bc('0x3d')];_0x5a6f93['order']=qs[_0xb4bc('0x46')](_0x4fdc4c['query'][_0xb4bc('0x46')]);_0x5a6f93['where']=qs[_0xb4bc('0x48')](_[_0xb4bc('0x5b')](_0x4fdc4c[_0xb4bc('0x3f')],_0x123e64['filters']));if(_0x4fdc4c['query'][_0xb4bc('0x4a')]){_0x5a6f93[_0xb4bc('0x47')]=_['merge'](_0x5a6f93[_0xb4bc('0x47')],{'$or':_['map'](_0x5a6f93[_0xb4bc('0x41')],function(_0x43f93a){var _0x41d0ce={};_0x41d0ce[_0x43f93a]={'$like':'%'+_0x4fdc4c[_0xb4bc('0x3f')]['filter']+'%'};return _0x41d0ce;})});}_0x5a6f93=_[_0xb4bc('0x49')]({},_0x5a6f93,_0x4fdc4c[_0xb4bc('0x4b')]);return _0x218128[_0xb4bc('0x58')](_0x5a6f93);}})[_0xb4bc('0x20')](function(_0x4bc422){if(_0x4bc422){_0xc0f13=_0x4bc422[_0xb4bc('0x42')];if(!_0x4fdc4c[_0xb4bc('0x3f')]['hasOwnProperty'](_0xb4bc('0x44'))){_0x5a6f93[_0xb4bc('0x30')]=qs[_0xb4bc('0x30')](_0x4fdc4c[_0xb4bc('0x3f')]['limit']);_0x5a6f93[_0xb4bc('0x2f')]=qs[_0xb4bc('0x2f')](_0x4fdc4c[_0xb4bc('0x3f')]['offset']);}return _0x218128[_0xb4bc('0x58')](_0x5a6f93);}})[_0xb4bc('0x20')](function(_0x53f964){if(_0x53f964){return _0x53f964?{'count':_0xc0f13,'rows':_0x53f964}:null;}})[_0xb4bc('0x20')](respondWithResult(_0x5c202a,null))[_0xb4bc('0x4e')](handleError(_0x5c202a,null));};exports[_0xb4bc('0x5c')]=function(_0x49d862,_0x3a78b4,_0x523c8e){if(_0x49d862['body']['id']){delete _0x49d862[_0xb4bc('0x55')]['id'];}return db['DeskAccount'][_0xb4bc('0x59')]({'where':{'id':_0x49d862[_0xb4bc('0x56')]['id']}})[_0xb4bc('0x20')](handleEntityNotFound(_0x3a78b4,null))[_0xb4bc('0x20')](function(_0x348fd6){if(_0x348fd6){_0x49d862[_0xb4bc('0x55')]['AccountId']=_0x348fd6['id'];_0x49d862[_0xb4bc('0x55')][_0xb4bc('0x5d')]=integrations[_0xb4bc('0x5e')](_0x49d862[_0xb4bc('0x55')][_0xb4bc('0x5f')],_0x49d862[_0xb4bc('0x55')][_0xb4bc('0x60')]);_0x49d862['body']['Descriptions']=integrations[_0xb4bc('0x61')](_0x49d862['body']['channel'],_0x49d862[_0xb4bc('0x55')]['type']);return db[_0xb4bc('0x5a')][_0xb4bc('0x54')](_0x49d862[_0xb4bc('0x55')],{'include':[{'model':db[_0xb4bc('0x62')],'as':'Subjects'},{'model':db[_0xb4bc('0x62')],'as':'Descriptions'}]});}return null;})[_0xb4bc('0x20')](respondWithResult(_0x3a78b4,null))[_0xb4bc('0x4e')](handleError(_0x3a78b4,null));};exports[_0xb4bc('0x63')]=function(_0x15277e,_0x3f38be,_0x2c2dd1){var _0x194395=[{'name':_0xb4bc('0x64'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x36859f='';return db[_0xb4bc('0x3a')][_0xb4bc('0x59')]({'where':{'id':_0x15277e['params']['id']},'attributes':['id',_0xb4bc('0x65'),'authType',_0xb4bc('0x66'),'password',_0xb4bc('0x67'),'consumerSecret',_0xb4bc('0x68'),'tokenSecret']})[_0xb4bc('0x20')](handleEntityNotFound(_0x3f38be,null))[_0xb4bc('0x20')](function(_0x20a82d){if(_0x20a82d){_0x36859f=_0x20a82d[_0xb4bc('0x65')];var _0x20acb6=_0x36859f[_0xb4bc('0x69')](-0x1);if(_0x20acb6==='/'){_0x36859f=_0x36859f[_0xb4bc('0x6a')](0x0,_0x36859f[_0xb4bc('0x6b')](_0x20acb6));}var _0xbcffdd={'method':'GET','uri':util[_0xb4bc('0x6c')]('%s/custom_fields',_0x36859f),'headers':{'Content-Type':_0xb4bc('0x6d'),'Accept':_0xb4bc('0x6d')},'json':!![]};if(_0x20a82d['authType']===_0xb4bc('0x6e')){_0xbcffdd['headers'][_0xb4bc('0x6f')]=util[_0xb4bc('0x6c')]('Basic\x20%s',new Buffer(util['format'](_0xb4bc('0x70'),_0x20a82d[_0xb4bc('0x66')],_0x20a82d['password']))[_0xb4bc('0x71')](_0xb4bc('0x72')));}return rp(_0xbcffdd)[_0xb4bc('0x20')](function(_0x3169ba){return _0x194395[_0xb4bc('0x73')](_[_0xb4bc('0x3e')](_0x3169ba['_embedded']['entries'],function(_0x160140){return{'id':_0x160140[_0xb4bc('0x37')],'name':_0x160140[_0xb4bc('0x37')],'type':_0x160140['type'],'active':_0x160140[_0xb4bc('0x74')],'label':_0x160140['label'],'custom':!![]};}));});}})['then'](function(_0x447768){return{'count':_0x447768[_0xb4bc('0x42')],'rows':_0x447768};})['then'](respondWithResult(_0x3f38be,null))[_0xb4bc('0x4e')](function(_0x4de40d){var _0x5e7f61=_0x15277e['query'][_0xb4bc('0x75')]?0x1f4:_0x4de40d[_0xb4bc('0x76')]||0x1f4;logger[_0xb4bc('0x26')](_0xb4bc('0x77'),'getFields',_0x5e7f61,JSON['stringify'](_0x4de40d));delete _0x4de40d[_0xb4bc('0x37')];if(_0x5e7f61===0x191){_0x5e7f61=0x190;}_0x3f38be['status'](_0x5e7f61)[_0xb4bc('0x38')](_0x15277e[_0xb4bc('0x3f')][_0xb4bc('0x75')]?{'message':_0xb4bc('0x78'),'statusCode':_0x4de40d[_0xb4bc('0x76')]}:_0x4de40d);});}; \ No newline at end of file +var _0xefbb=['name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','body','params','destroy','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskConfiguration','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','GET','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','active','label','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','stack'];(function(_0x26fb55,_0x2fcdf2){var _0x1765c1=function(_0x3023e3){while(--_0x3023e3){_0x26fb55['push'](_0x26fb55['shift']());}};_0x1765c1(++_0x2fcdf2);}(_0xefbb,0xca));var _0xbefb=function(_0x5de78a,_0x37cbe6){_0x5de78a=_0x5de78a-0x0;var _0x4306f0=_0xefbb[_0x5de78a];return _0x4306f0;};'use strict';var pdf=require(_0xbefb('0x0'));var emlformat=require(_0xbefb('0x1'));var rimraf=require(_0xbefb('0x2'));var zipdir=require(_0xbefb('0x3'));var jsonpatch=require(_0xbefb('0x4'));var rp=require(_0xbefb('0x5'));var moment=require(_0xbefb('0x6'));var BPromise=require(_0xbefb('0x7'));var Mustache=require('mustache');var util=require(_0xbefb('0x8'));var path=require(_0xbefb('0x9'));var sox=require(_0xbefb('0xa'));var csv=require(_0xbefb('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbefb('0xc'));var squel=require('squel');var crypto=require(_0xbefb('0xd'));var jsforce=require(_0xbefb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbefb('0xb'));var querystring=require('querystring');var Papa=require(_0xbefb('0xf'));var Redis=require(_0xbefb('0x10'));var authService=require(_0xbefb('0x11'));var qs=require(_0xbefb('0x12'));var as=require(_0xbefb('0x13'));var hardwareService=require(_0xbefb('0x14'));var logger=require('../../config/logger')(_0xbefb('0x15'));var utils=require(_0xbefb('0x16'));var config=require(_0xbefb('0x17'));var licenseUtil=require(_0xbefb('0x18'));var db=require(_0xbefb('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbefb('0x1a'));var client=jayson[_0xbefb('0x1b')][_0xbefb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x544609,_0x215156,_0x5ae53a,_0x20b933){return new BPromise(function(_0xb528bc,_0x26f47c){var _0x5eba88=_0x20b933||client;return _0x5eba88[_0xbefb('0x1d')](_0x544609,_0x5ae53a)[_0xbefb('0x1e')](function(_0x32fae1){logger[_0xbefb('0x1f')](_0xbefb('0x20'),_0x215156,'request\x20sent');logger[_0xbefb('0x21')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x215156,_0xbefb('0x22'),JSON[_0xbefb('0x23')](_0x32fae1));if(_0x32fae1['error']){if(_0x32fae1[_0xbefb('0x24')][_0xbefb('0x25')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x215156,_0x32fae1[_0xbefb('0x24')][_0xbefb('0x26')]);return _0x26f47c(_0x32fae1[_0xbefb('0x24')][_0xbefb('0x26')]);}logger[_0xbefb('0x24')](_0xbefb('0x20'),_0x215156,_0x32fae1['error'][_0xbefb('0x26')]);return _0xb528bc(_0x32fae1[_0xbefb('0x24')][_0xbefb('0x26')]);}else{logger[_0xbefb('0x1f')](_0xbefb('0x20'),_0x215156,_0xbefb('0x22'));_0xb528bc(_0x32fae1[_0xbefb('0x27')][_0xbefb('0x26')]);}})[_0xbefb('0x28')](function(_0x27fe15){logger['error'](_0xbefb('0x20'),_0x215156,_0x27fe15);_0x26f47c(_0x27fe15);});});}function respondWithStatusCode(_0x4cdbf4,_0x3f4915){_0x3f4915=_0x3f4915||0xcc;return function(_0x279d42){if(_0x279d42){return _0x4cdbf4[_0xbefb('0x29')](_0x3f4915);}return _0x4cdbf4[_0xbefb('0x2a')](_0x3f4915)[_0xbefb('0x2b')]();};}function respondWithResult(_0x2afa63,_0x131198){_0x131198=_0x131198||0xc8;return function(_0x54702e){if(_0x54702e){return _0x2afa63[_0xbefb('0x2a')](_0x131198)[_0xbefb('0x2c')](_0x54702e);}};}function respondWithFilteredResult(_0x2fa4bf,_0x1ccc7d){return function(_0x553d48){if(_0x553d48){var _0x5a9cf7=_0x553d48[_0xbefb('0x2d')],_0x48d64f=_0x1ccc7d[_0xbefb('0x2e')],_0x18ca27=_0x1ccc7d['offset']+_0x1ccc7d[_0xbefb('0x2f')],_0x42e426;if(_0x18ca27>=_0x5a9cf7){_0x18ca27=_0x5a9cf7;_0x42e426=0xc8;}else{_0x42e426=0xce;}_0x2fa4bf[_0xbefb('0x2a')](_0x42e426);return _0x2fa4bf['set'](_0xbefb('0x30'),_0x48d64f+'-'+_0x18ca27+'/'+_0x5a9cf7)['json'](_0x553d48);}return null;};}function patchUpdates(_0x39bcf8){return function(_0x3c4f5d){try{jsonpatch[_0xbefb('0x31')](_0x3c4f5d,_0x39bcf8,!![]);}catch(_0x55b703){return BPromise['reject'](_0x55b703);}return _0x3c4f5d[_0xbefb('0x32')]();};}function saveUpdates(_0x260c8e,_0x2ab2d0){return function(_0x223036){if(_0x223036){return _0x223036['update'](_0x260c8e)[_0xbefb('0x1e')](function(_0x112506){return _0x112506;});}return null;};}function removeEntity(_0x2a1a86,_0x3b951c){return function(_0x4f394a){if(_0x4f394a){return _0x4f394a['destroy']()[_0xbefb('0x1e')](function(){_0x2a1a86[_0xbefb('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bf2d2,_0x5d4a6f){return function(_0x4ce9bb){if(!_0x4ce9bb){_0x2bf2d2[_0xbefb('0x29')](0x194);}return _0x4ce9bb;};}function handleError(_0x10639c,_0x57ff9c){_0x57ff9c=_0x57ff9c||0x1f4;return function(_0x470470){logger['error'](_0x470470[_0xbefb('0x33')]);if(_0x470470['name']){delete _0x470470[_0xbefb('0x34')];}_0x10639c['status'](_0x57ff9c)[_0xbefb('0x35')](_0x470470);};}exports[_0xbefb('0x36')]=function(_0x579f7d,_0x216da0){var _0x3b8c99={},_0x52312d={},_0x53ce72={'count':0x0,'rows':[]};var _0x30b350=_[_0xbefb('0x37')](db[_0xbefb('0x38')][_0xbefb('0x39')],function(_0x46e17e){return{'name':_0x46e17e[_0xbefb('0x3a')],'type':_0x46e17e[_0xbefb('0x3b')][_0xbefb('0x3c')]};});_0x52312d[_0xbefb('0x3d')]=_[_0xbefb('0x37')](_0x30b350,_0xbefb('0x34'));_0x52312d[_0xbefb('0x3e')]=_[_0xbefb('0x3f')](_0x579f7d[_0xbefb('0x3e')]);_0x52312d['filters']=_[_0xbefb('0x40')](_0x52312d['model'],_0x52312d[_0xbefb('0x3e')]);_0x3b8c99[_0xbefb('0x41')]=_[_0xbefb('0x40')](_0x52312d[_0xbefb('0x3d')],qs[_0xbefb('0x42')](_0x579f7d[_0xbefb('0x3e')]['fields']));_0x3b8c99[_0xbefb('0x41')]=_0x3b8c99[_0xbefb('0x41')][_0xbefb('0x43')]?_0x3b8c99[_0xbefb('0x41')]:_0x52312d[_0xbefb('0x3d')];if(!_0x579f7d[_0xbefb('0x3e')]['hasOwnProperty'](_0xbefb('0x44'))){_0x3b8c99[_0xbefb('0x2f')]=qs[_0xbefb('0x2f')](_0x579f7d[_0xbefb('0x3e')][_0xbefb('0x2f')]);_0x3b8c99[_0xbefb('0x2e')]=qs[_0xbefb('0x2e')](_0x579f7d[_0xbefb('0x3e')][_0xbefb('0x2e')]);}_0x3b8c99['order']=qs['sort'](_0x579f7d[_0xbefb('0x3e')][_0xbefb('0x45')]);_0x3b8c99[_0xbefb('0x46')]=qs[_0xbefb('0x47')](_[_0xbefb('0x48')](_0x579f7d[_0xbefb('0x3e')],_0x52312d[_0xbefb('0x47')]),_0x30b350);if(_0x579f7d[_0xbefb('0x3e')][_0xbefb('0x49')]){_0x3b8c99['where']=_[_0xbefb('0x4a')](_0x3b8c99[_0xbefb('0x46')],{'$or':_[_0xbefb('0x37')](_0x30b350,function(_0x5dfba3){if(_0x5dfba3[_0xbefb('0x3b')]!==_0xbefb('0x4b')){var _0x40683b={};_0x40683b[_0x5dfba3[_0xbefb('0x34')]]={'$like':'%'+_0x579f7d['query'][_0xbefb('0x49')]+'%'};return _0x40683b;}})});}_0x3b8c99=_[_0xbefb('0x4a')]({},_0x3b8c99,_0x579f7d[_0xbefb('0x4c')]);var _0x14b3b5={'where':_0x3b8c99[_0xbefb('0x46')]};return db[_0xbefb('0x38')][_0xbefb('0x2d')](_0x14b3b5)['then'](function(_0x27386b){_0x53ce72['count']=_0x27386b;if(_0x579f7d['query']['includeAll']){_0x3b8c99[_0xbefb('0x4d')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3b8c99);})['then'](function(_0xb602ed){_0x53ce72[_0xbefb('0x4e')]=_0xb602ed;return _0x53ce72;})[_0xbefb('0x1e')](respondWithFilteredResult(_0x216da0,_0x3b8c99))[_0xbefb('0x28')](handleError(_0x216da0,null));};exports[_0xbefb('0x4f')]=function(_0x4a8884,_0x313aab){var _0x519000={'raw':![],'where':{'id':_0x4a8884['params']['id']}},_0x20f00e={};_0x20f00e[_0xbefb('0x3d')]=_[_0xbefb('0x3f')](db['DeskAccount'][_0xbefb('0x39')]);_0x20f00e[_0xbefb('0x3e')]=_['keys'](_0x4a8884[_0xbefb('0x3e')]);_0x20f00e[_0xbefb('0x47')]=_[_0xbefb('0x40')](_0x20f00e[_0xbefb('0x3d')],_0x20f00e['query']);_0x519000[_0xbefb('0x41')]=_[_0xbefb('0x40')](_0x20f00e[_0xbefb('0x3d')],qs[_0xbefb('0x42')](_0x4a8884['query'][_0xbefb('0x42')]));_0x519000[_0xbefb('0x41')]=_0x519000['attributes'][_0xbefb('0x43')]?_0x519000['attributes']:_0x20f00e[_0xbefb('0x3d')];if(_0x4a8884[_0xbefb('0x3e')][_0xbefb('0x50')]){_0x519000[_0xbefb('0x4d')]=[{'all':!![]}];}_0x519000=_['merge']({},_0x519000,_0x4a8884['options']);return db['DeskAccount'][_0xbefb('0x51')](_0x519000)[_0xbefb('0x1e')](handleEntityNotFound(_0x313aab,null))[_0xbefb('0x1e')](respondWithResult(_0x313aab,null))[_0xbefb('0x28')](handleError(_0x313aab,null));};exports[_0xbefb('0x52')]=function(_0x3899f9,_0x5f4720){return db[_0xbefb('0x38')][_0xbefb('0x52')](_0x3899f9[_0xbefb('0x53')],{})[_0xbefb('0x1e')](respondWithResult(_0x5f4720,0xc9))[_0xbefb('0x28')](handleError(_0x5f4720,null));};exports['update']=function(_0x8cb77d,_0x56cf14){if(_0x8cb77d['body']['id']){delete _0x8cb77d[_0xbefb('0x53')]['id'];}return db[_0xbefb('0x38')][_0xbefb('0x51')]({'where':{'id':_0x8cb77d[_0xbefb('0x54')]['id']}})[_0xbefb('0x1e')](handleEntityNotFound(_0x56cf14,null))[_0xbefb('0x1e')](saveUpdates(_0x8cb77d[_0xbefb('0x53')],null))[_0xbefb('0x1e')](respondWithResult(_0x56cf14,null))['catch'](handleError(_0x56cf14,null));};exports[_0xbefb('0x55')]=function(_0x340026,_0x41c2b7){return db[_0xbefb('0x38')][_0xbefb('0x51')]({'where':{'id':_0x340026[_0xbefb('0x54')]['id']}})[_0xbefb('0x1e')](handleEntityNotFound(_0x41c2b7,null))[_0xbefb('0x1e')](removeEntity(_0x41c2b7,null))['catch'](handleError(_0x41c2b7,null));};exports[_0xbefb('0x56')]=function(_0x3bf429,_0x4f8173,_0x283a36){var _0x3933e6={};var _0x2b02d0={};var _0x1b3c54;var _0x9c6759;return db[_0xbefb('0x38')][_0xbefb('0x57')]({'where':{'id':_0x3bf429['params']['id']}})[_0xbefb('0x1e')](handleEntityNotFound(_0x4f8173,null))[_0xbefb('0x1e')](function(_0xdaf38){if(_0xdaf38){_0x1b3c54=_0xdaf38;_0x2b02d0[_0xbefb('0x3d')]=_[_0xbefb('0x3f')](db['DeskConfiguration'][_0xbefb('0x39')]);_0x2b02d0[_0xbefb('0x3e')]=_[_0xbefb('0x3f')](_0x3bf429[_0xbefb('0x3e')]);_0x2b02d0[_0xbefb('0x47')]=_[_0xbefb('0x40')](_0x2b02d0[_0xbefb('0x3d')],_0x2b02d0['query']);_0x3933e6['attributes']=_[_0xbefb('0x40')](_0x2b02d0[_0xbefb('0x3d')],qs['fields'](_0x3bf429[_0xbefb('0x3e')][_0xbefb('0x42')]));_0x3933e6[_0xbefb('0x41')]=_0x3933e6[_0xbefb('0x41')]['length']?_0x3933e6[_0xbefb('0x41')]:_0x2b02d0[_0xbefb('0x3d')];_0x3933e6[_0xbefb('0x58')]=qs[_0xbefb('0x45')](_0x3bf429[_0xbefb('0x3e')][_0xbefb('0x45')]);_0x3933e6[_0xbefb('0x46')]=qs['filters'](_[_0xbefb('0x48')](_0x3bf429['query'],_0x2b02d0[_0xbefb('0x47')]));if(_0x3bf429['query'][_0xbefb('0x49')]){_0x3933e6['where']=_[_0xbefb('0x4a')](_0x3933e6[_0xbefb('0x46')],{'$or':_['map'](_0x3933e6[_0xbefb('0x41')],function(_0x55863a){var _0x42a1b={};_0x42a1b[_0x55863a]={'$like':'%'+_0x3bf429[_0xbefb('0x3e')][_0xbefb('0x49')]+'%'};return _0x42a1b;})});}_0x3933e6=_[_0xbefb('0x4a')]({},_0x3933e6,_0x3bf429['options']);return _0x1b3c54['getConfigurations'](_0x3933e6);}})[_0xbefb('0x1e')](function(_0x68f4b8){if(_0x68f4b8){_0x9c6759=_0x68f4b8[_0xbefb('0x43')];if(!_0x3bf429[_0xbefb('0x3e')][_0xbefb('0x59')]('nolimit')){_0x3933e6[_0xbefb('0x2f')]=qs[_0xbefb('0x2f')](_0x3bf429[_0xbefb('0x3e')][_0xbefb('0x2f')]);_0x3933e6['offset']=qs[_0xbefb('0x2e')](_0x3bf429[_0xbefb('0x3e')][_0xbefb('0x2e')]);}return _0x1b3c54[_0xbefb('0x56')](_0x3933e6);}})[_0xbefb('0x1e')](function(_0x4bcb98){if(_0x4bcb98){return _0x4bcb98?{'count':_0x9c6759,'rows':_0x4bcb98}:null;}})['then'](respondWithResult(_0x4f8173,null))[_0xbefb('0x28')](handleError(_0x4f8173,null));};exports[_0xbefb('0x5a')]=function(_0x180f08,_0xc027cc,_0xc8509f){if(_0x180f08[_0xbefb('0x53')]['id']){delete _0x180f08[_0xbefb('0x53')]['id'];}return db[_0xbefb('0x38')][_0xbefb('0x57')]({'where':{'id':_0x180f08[_0xbefb('0x54')]['id']}})[_0xbefb('0x1e')](handleEntityNotFound(_0xc027cc,null))[_0xbefb('0x1e')](function(_0x3b8904){if(_0x3b8904){_0x180f08[_0xbefb('0x53')][_0xbefb('0x5b')]=_0x3b8904['id'];_0x180f08[_0xbefb('0x53')][_0xbefb('0x5c')]=integrations[_0xbefb('0x5d')](_0x180f08[_0xbefb('0x53')][_0xbefb('0x5e')],_0x180f08[_0xbefb('0x53')][_0xbefb('0x3b')]);_0x180f08['body']['Descriptions']=integrations[_0xbefb('0x5f')](_0x180f08[_0xbefb('0x53')][_0xbefb('0x5e')],_0x180f08[_0xbefb('0x53')][_0xbefb('0x3b')]);return db[_0xbefb('0x60')][_0xbefb('0x52')](_0x180f08['body'],{'include':[{'model':db[_0xbefb('0x61')],'as':_0xbefb('0x5c')},{'model':db[_0xbefb('0x61')],'as':_0xbefb('0x62')}]});}return null;})['then'](respondWithResult(_0xc027cc,null))[_0xbefb('0x28')](handleError(_0xc027cc,null));};exports[_0xbefb('0x63')]=function(_0x5d47a1,_0x393f42,_0x3bc9be){var _0x551648=[{'name':_0xbefb('0x64'),'label':_0xbefb('0x64'),'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 _0x3d02bf='';return db[_0xbefb('0x38')][_0xbefb('0x57')]({'where':{'id':_0x5d47a1[_0xbefb('0x54')]['id']},'attributes':['id',_0xbefb('0x65'),_0xbefb('0x66'),_0xbefb('0x67'),_0xbefb('0x68'),'consumerKey',_0xbefb('0x69'),_0xbefb('0x6a'),_0xbefb('0x6b')]})[_0xbefb('0x1e')](handleEntityNotFound(_0x393f42,null))[_0xbefb('0x1e')](function(_0xbd9cee){if(_0xbd9cee){_0x3d02bf=_0xbd9cee[_0xbefb('0x65')];var _0x5e293b=_0x3d02bf[_0xbefb('0x6c')](-0x1);if(_0x5e293b==='/'){_0x3d02bf=_0x3d02bf[_0xbefb('0x6d')](0x0,_0x3d02bf['lastIndexOf'](_0x5e293b));}var _0x530af6={'method':_0xbefb('0x6e'),'uri':util['format'](_0xbefb('0x6f'),_0x3d02bf),'headers':{'Content-Type':_0xbefb('0x70'),'Accept':_0xbefb('0x70')},'json':!![]};if(_0xbd9cee[_0xbefb('0x66')]===_0xbefb('0x71')){_0x530af6[_0xbefb('0x72')]['Authorization']=util[_0xbefb('0x73')](_0xbefb('0x74'),new Buffer(util[_0xbefb('0x73')](_0xbefb('0x75'),_0xbd9cee[_0xbefb('0x67')],_0xbd9cee[_0xbefb('0x68')]))[_0xbefb('0x76')]('base64'));}return rp(_0x530af6)[_0xbefb('0x1e')](function(_0x587cf9){return _0x551648[_0xbefb('0x77')](_['map'](_0x587cf9[_0xbefb('0x78')][_0xbefb('0x79')],function(_0x248803){return{'id':_0x248803[_0xbefb('0x34')],'name':_0x248803[_0xbefb('0x34')],'type':_0x248803[_0xbefb('0x3b')],'active':_0x248803[_0xbefb('0x7a')],'label':_0x248803[_0xbefb('0x7b')],'custom':!![]};}));});}})[_0xbefb('0x1e')](function(_0x4804ea){return{'count':_0x4804ea[_0xbefb('0x43')],'rows':_0x4804ea};})[_0xbefb('0x1e')](respondWithResult(_0x393f42,null))[_0xbefb('0x28')](function(_0x1652b2){var _0x54a195=_0x5d47a1[_0xbefb('0x3e')][_0xbefb('0x7c')]?0x1f4:_0x1652b2[_0xbefb('0x7d')]||0x1f4;logger[_0xbefb('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x54a195,JSON[_0xbefb('0x23')](_0x1652b2));delete _0x1652b2['name'];if(_0x54a195===0x191){_0x54a195=0x190;}_0x393f42[_0xbefb('0x2a')](_0x54a195)[_0xbefb('0x35')](_0x5d47a1[_0xbefb('0x3e')][_0xbefb('0x7c')]?{'message':_0xbefb('0x7e'),'statusCode':_0x1652b2['statusCode']}:_0x1652b2);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8ee45c4..462e5a3 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 _0xe185=['int_desk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe185,0xf3));var _0x5e18=function(_0x21d80e,_0x3b1322){_0x21d80e=_0x21d80e-0x0;var _0xc08ca3=_0xe185[_0x21d80e];return _0xc08ca3;};'use strict';var _=require('lodash');var util=require(_0x5e18('0x0'));var logger=require(_0x5e18('0x1'))(_0x5e18('0x2'));var moment=require(_0x5e18('0x3'));var BPromise=require(_0x5e18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e18('0x5'));var rimraf=require(_0x5e18('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e18('0x7'));var integrations=require(_0x5e18('0x8'));module['exports']=function(_0x21f615,_0x39475e){return _0x21f615['define'](_0x5e18('0x9'),attributes,{'tableName':_0x5e18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab32=['./intDeskAccount.attributes','exports','DeskAccount','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0xab32,0x142));var _0x2ab3=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xab32[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require('lodash');var util=require(_0x2ab3('0x0'));var logger=require(_0x2ab3('0x1'))('api');var moment=require(_0x2ab3('0x2'));var BPromise=require(_0x2ab3('0x3'));var rp=require(_0x2ab3('0x4'));var fs=require('fs');var path=require(_0x2ab3('0x5'));var rimraf=require(_0x2ab3('0x6'));var config=require(_0x2ab3('0x7'));var attributes=require(_0x2ab3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2ab3('0x9')]=function(_0x22a4b8,_0x337819){return _0x22a4b8['define'](_0x2ab3('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 9400626..aa54913 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 _0xc7aa=['randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','options','raw','where','include','map','model','attributes','DeskAccount','find','ShowDeskAccount','lodash','util','moment'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xc7aa,0x1bd));var _0xac7a=function(_0x47353c,_0x242d99){_0x47353c=_0x47353c-0x0;var _0x3f5301=_0xc7aa[_0x47353c];return _0x3f5301;};'use strict';var _=require(_0xac7a('0x0'));var util=require(_0xac7a('0x1'));var moment=require(_0xac7a('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7a('0x3'));var fs=require('fs');var Redis=require(_0xac7a('0x4'));var db=require(_0xac7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xac7a('0x7'));var client=jayson['client'][_0xac7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbfaa3f,_0x216d34,_0x1d28e7){return new BPromise(function(_0x5003eb,_0x818a7a){return client[_0xac7a('0x9')](_0xbfaa3f,_0x1d28e7)[_0xac7a('0xa')](function(_0x5dd237){logger[_0xac7a('0xb')](_0xac7a('0xc'),_0x216d34,_0xac7a('0xd'));logger[_0xac7a('0xe')](_0xac7a('0xf'),_0x216d34,_0xac7a('0xd'),JSON[_0xac7a('0x10')](_0x5dd237));if(_0x5dd237[_0xac7a('0x11')]){if(_0x5dd237[_0xac7a('0x11')]['code']===0x1f4){logger[_0xac7a('0x11')](_0xac7a('0xc'),_0x216d34,_0x5dd237[_0xac7a('0x11')][_0xac7a('0x12')]);return _0x818a7a(_0x5dd237[_0xac7a('0x11')]['message']);}logger[_0xac7a('0x11')](_0xac7a('0xc'),_0x216d34,_0x5dd237['error'][_0xac7a('0x12')]);return _0x5003eb(_0x5dd237[_0xac7a('0x11')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x216d34,_0xac7a('0xd'));_0x5003eb(_0x5dd237[_0xac7a('0x13')][_0xac7a('0x12')]);}})[_0xac7a('0x14')](function(_0x1a4cad){logger[_0xac7a('0x11')](_0xac7a('0xc'),_0x216d34,_0x1a4cad);_0x818a7a(_0x1a4cad);});});}exports[_0xac7a('0x15')]=function(_0x4ad61b){var _0x1c58c0=this;return new Promise(function(_0x11707d,_0x5a9917){return db['DeskAccount']['findAll']({'raw':_0x4ad61b[_0xac7a('0x16')]?_0x4ad61b[_0xac7a('0x16')][_0xac7a('0x17')]===undefined?!![]:![]:!![],'where':_0x4ad61b[_0xac7a('0x16')]?_0x4ad61b[_0xac7a('0x16')][_0xac7a('0x18')]||null:null,'attributes':_0x4ad61b[_0xac7a('0x16')]?_0x4ad61b[_0xac7a('0x16')]['attributes']||null:null,'limit':_0x4ad61b['options']?_0x4ad61b[_0xac7a('0x16')]['limit']||null:null,'include':_0x4ad61b[_0xac7a('0x16')]?_0x4ad61b[_0xac7a('0x16')][_0xac7a('0x19')]?_[_0xac7a('0x1a')](_0x4ad61b[_0xac7a('0x16')][_0xac7a('0x19')],function(_0x466f77){return{'model':db[_0x466f77[_0xac7a('0x1b')]],'as':_0x466f77['as'],'attributes':_0x466f77[_0xac7a('0x1c')],'include':_0x466f77[_0xac7a('0x19')]?_['map'](_0x466f77[_0xac7a('0x19')],function(_0x13b8f9){return{'model':db[_0x13b8f9[_0xac7a('0x1b')]],'as':_0x13b8f9['as'],'attributes':_0x13b8f9[_0xac7a('0x1c')],'include':_0x13b8f9[_0xac7a('0x19')]?_[_0xac7a('0x1a')](_0x13b8f9[_0xac7a('0x19')],function(_0x141047){return{'model':db[_0x141047['model']],'as':_0x141047['as'],'attributes':_0x141047[_0xac7a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac7a('0xa')](function(_0x4a8b6a){logger['info'](_0xac7a('0x15'),_0x4ad61b);logger[_0xac7a('0xe')](_0xac7a('0x15'),_0x4ad61b,JSON[_0xac7a('0x10')](_0x4a8b6a));_0x11707d(_0x4a8b6a);})[_0xac7a('0x14')](function(_0x34330c){logger['error']('GetDeskAccount',_0x34330c[_0xac7a('0x12')],_0x4ad61b);_0x5a9917(_0x1c58c0[_0xac7a('0x11')](0x1f4,_0x34330c[_0xac7a('0x12')]));});});};exports['ShowDeskAccount']=function(_0x411825){var _0xaeee4f=this;return new Promise(function(_0x2fb4c1,_0x220be9){return db[_0xac7a('0x1d')][_0xac7a('0x1e')]({'raw':_0x411825[_0xac7a('0x16')]?_0x411825[_0xac7a('0x16')][_0xac7a('0x17')]===undefined?!![]:![]:!![],'where':_0x411825['options']?_0x411825['options'][_0xac7a('0x18')]||null:null,'attributes':_0x411825['options']?_0x411825[_0xac7a('0x16')][_0xac7a('0x1c')]||null:null,'include':_0x411825[_0xac7a('0x16')]?_0x411825[_0xac7a('0x16')][_0xac7a('0x19')]?_[_0xac7a('0x1a')](_0x411825[_0xac7a('0x16')]['include'],function(_0x10135a){return{'model':db[_0x10135a['model']],'as':_0x10135a['as'],'attributes':_0x10135a['attributes'],'include':_0x10135a[_0xac7a('0x19')]?_[_0xac7a('0x1a')](_0x10135a[_0xac7a('0x19')],function(_0x340a92){return{'model':db[_0x340a92[_0xac7a('0x1b')]],'as':_0x340a92['as'],'attributes':_0x340a92[_0xac7a('0x1c')],'include':_0x340a92[_0xac7a('0x19')]?_['map'](_0x340a92[_0xac7a('0x19')],function(_0x1be578){return{'model':db[_0x1be578[_0xac7a('0x1b')]],'as':_0x1be578['as'],'attributes':_0x1be578[_0xac7a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac7a('0xa')](function(_0x597a2f){logger['info'](_0xac7a('0x1f'),_0x411825);logger[_0xac7a('0xe')](_0xac7a('0x1f'),_0x411825,JSON[_0xac7a('0x10')](_0x597a2f));_0x2fb4c1(_0x597a2f);})[_0xac7a('0x14')](function(_0x2b800f){logger['error'](_0xac7a('0x1f'),_0x2b800f[_0xac7a('0x12')],_0x411825);_0x220be9(_0xaeee4f[_0xac7a('0x11')](0x1f4,_0x2b800f['message']));});});}; \ No newline at end of file +var _0x9bec=['findAll','options','raw','where','attributes','map','include','model','then','ShowDeskAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetDeskAccount','DeskAccount'];(function(_0xf2fda2,_0x192fdc){var _0x23f003=function(_0x4e99b5){while(--_0x4e99b5){_0xf2fda2['push'](_0xf2fda2['shift']());}};_0x23f003(++_0x192fdc);}(_0x9bec,0x12b));var _0xc9be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bec[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc9be('0x0'));var BPromise=require(_0xc9be('0x1'));var rs=require(_0xc9be('0x2'));var fs=require('fs');var Redis=require(_0xc9be('0x3'));var db=require(_0xc9be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9be('0x5'))('rpc');var config=require(_0xc9be('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc9be('0x7')][_0xc9be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x473d78,_0x322432,_0x50db71){return new BPromise(function(_0x437c77,_0x143d26){return client['request'](_0x473d78,_0x50db71)['then'](function(_0x3b4076){logger[_0xc9be('0x9')](_0xc9be('0xa'),_0x322432,'request\x20sent');logger[_0xc9be('0xb')](_0xc9be('0xc'),_0x322432,_0xc9be('0xd'),JSON[_0xc9be('0xe')](_0x3b4076));if(_0x3b4076[_0xc9be('0xf')]){if(_0x3b4076[_0xc9be('0xf')][_0xc9be('0x10')]===0x1f4){logger['error'](_0xc9be('0xa'),_0x322432,_0x3b4076[_0xc9be('0xf')][_0xc9be('0x11')]);return _0x143d26(_0x3b4076[_0xc9be('0xf')][_0xc9be('0x11')]);}logger[_0xc9be('0xf')](_0xc9be('0xa'),_0x322432,_0x3b4076['error'][_0xc9be('0x11')]);return _0x437c77(_0x3b4076[_0xc9be('0xf')][_0xc9be('0x11')]);}else{logger[_0xc9be('0x9')](_0xc9be('0xa'),_0x322432,_0xc9be('0xd'));_0x437c77(_0x3b4076['result'][_0xc9be('0x11')]);}})[_0xc9be('0x12')](function(_0x207e1e){logger[_0xc9be('0xf')]('DeskAccount,\x20%s,\x20%s',_0x322432,_0x207e1e);_0x143d26(_0x207e1e);});});}exports[_0xc9be('0x13')]=function(_0x514106){var _0x358c9f=this;return new Promise(function(_0x4adb9c,_0x32673a){return db[_0xc9be('0x14')][_0xc9be('0x15')]({'raw':_0x514106[_0xc9be('0x16')]?_0x514106[_0xc9be('0x16')][_0xc9be('0x17')]===undefined?!![]:![]:!![],'where':_0x514106[_0xc9be('0x16')]?_0x514106[_0xc9be('0x16')][_0xc9be('0x18')]||null:null,'attributes':_0x514106[_0xc9be('0x16')]?_0x514106['options'][_0xc9be('0x19')]||null:null,'limit':_0x514106[_0xc9be('0x16')]?_0x514106[_0xc9be('0x16')]['limit']||null:null,'include':_0x514106[_0xc9be('0x16')]?_0x514106[_0xc9be('0x16')]['include']?_[_0xc9be('0x1a')](_0x514106[_0xc9be('0x16')][_0xc9be('0x1b')],function(_0x1fd5d7){return{'model':db[_0x1fd5d7['model']],'as':_0x1fd5d7['as'],'attributes':_0x1fd5d7['attributes'],'include':_0x1fd5d7['include']?_[_0xc9be('0x1a')](_0x1fd5d7['include'],function(_0x41e7c4){return{'model':db[_0x41e7c4['model']],'as':_0x41e7c4['as'],'attributes':_0x41e7c4['attributes'],'include':_0x41e7c4[_0xc9be('0x1b')]?_[_0xc9be('0x1a')](_0x41e7c4[_0xc9be('0x1b')],function(_0xd295ff){return{'model':db[_0xd295ff[_0xc9be('0x1c')]],'as':_0xd295ff['as'],'attributes':_0xd295ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9be('0x1d')](function(_0x2b6bdb){logger[_0xc9be('0x9')]('GetDeskAccount',_0x514106);logger[_0xc9be('0xb')](_0xc9be('0x13'),_0x514106,JSON[_0xc9be('0xe')](_0x2b6bdb));_0x4adb9c(_0x2b6bdb);})[_0xc9be('0x12')](function(_0x2055f0){logger['error']('GetDeskAccount',_0x2055f0[_0xc9be('0x11')],_0x514106);_0x32673a(_0x358c9f[_0xc9be('0xf')](0x1f4,_0x2055f0['message']));});});};exports[_0xc9be('0x1e')]=function(_0x1f486a){var _0x115ebc=this;return new Promise(function(_0x322aee,_0x5b8897){return db[_0xc9be('0x14')][_0xc9be('0x1f')]({'raw':_0x1f486a[_0xc9be('0x16')]?_0x1f486a[_0xc9be('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1f486a[_0xc9be('0x16')]?_0x1f486a['options'][_0xc9be('0x18')]||null:null,'attributes':_0x1f486a[_0xc9be('0x16')]?_0x1f486a['options'][_0xc9be('0x19')]||null:null,'include':_0x1f486a[_0xc9be('0x16')]?_0x1f486a[_0xc9be('0x16')][_0xc9be('0x1b')]?_[_0xc9be('0x1a')](_0x1f486a[_0xc9be('0x16')][_0xc9be('0x1b')],function(_0x44ff22){return{'model':db[_0x44ff22[_0xc9be('0x1c')]],'as':_0x44ff22['as'],'attributes':_0x44ff22[_0xc9be('0x19')],'include':_0x44ff22[_0xc9be('0x1b')]?_['map'](_0x44ff22[_0xc9be('0x1b')],function(_0x554556){return{'model':db[_0x554556[_0xc9be('0x1c')]],'as':_0x554556['as'],'attributes':_0x554556['attributes'],'include':_0x554556[_0xc9be('0x1b')]?_['map'](_0x554556[_0xc9be('0x1b')],function(_0x5bc310){return{'model':db[_0x5bc310[_0xc9be('0x1c')]],'as':_0x5bc310['as'],'attributes':_0x5bc310[_0xc9be('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c65b0){logger['info'](_0xc9be('0x1e'),_0x1f486a);logger[_0xc9be('0xb')](_0xc9be('0x1e'),_0x1f486a,JSON[_0xc9be('0xe')](_0x3c65b0));_0x322aee(_0x3c65b0);})['catch'](function(_0x46773e){logger[_0xc9be('0xf')](_0xc9be('0x1e'),_0x46773e[_0xc9be('0x11')],_0x1f486a);_0x5b8897(_0x115ebc[_0xc9be('0xf')](0x1f4,_0x46773e['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a7c83a1..48d5176 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 _0x96f2=['/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','setTags','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x820843,_0x4b6f7e){var _0x2077c2=function(_0x26e103){while(--_0x26e103){_0x820843['push'](_0x820843['shift']());}};_0x2077c2(++_0x4b6f7e);}(_0x96f2,0xb0));var _0x296f=function(_0xcbfee1,_0x287c55){_0xcbfee1=_0xcbfee1-0x0;var _0x5bbc59=_0x96f2[_0xcbfee1];return _0x5bbc59;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require(_0x296f('0x2'));var express=require(_0x296f('0x3'));var router=express['Router']();var auth=require(_0x296f('0x4'));var interaction=require(_0x296f('0x5'));var config=require(_0x296f('0x6'));var controller=require('./intDeskConfiguration.controller');router[_0x296f('0x7')]('/',auth[_0x296f('0x8')](),controller['index']);router['get'](_0x296f('0x9'),auth[_0x296f('0x8')](),controller[_0x296f('0xa')]);router[_0x296f('0x7')](_0x296f('0xb'),auth[_0x296f('0x8')](),controller[_0x296f('0xc')]);router[_0x296f('0x7')](_0x296f('0xd'),auth[_0x296f('0x8')](),controller['getSubjects']);router[_0x296f('0x7')](_0x296f('0xe'),auth[_0x296f('0x8')](),controller['getDescriptions']);router[_0x296f('0x7')](_0x296f('0xf'),auth[_0x296f('0x8')](),controller[_0x296f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x296f('0x11')](_0x296f('0xf'),auth[_0x296f('0x8')](),controller[_0x296f('0x12')]);router['put'](_0x296f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x296f('0x13')](_0x296f('0x9'),auth[_0x296f('0x8')](),controller[_0x296f('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf02c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xf02c,0x92));var _0xcf02=function(_0x17990b,_0x2e079f){_0x17990b=_0x17990b-0x0;var _0x301cf4=_0xf02c[_0x17990b];return _0x301cf4;};'use strict';var multer=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var path=require(_0xcf02('0x2'));var timeout=require(_0xcf02('0x3'));var express=require(_0xcf02('0x4'));var router=express[_0xcf02('0x5')]();var auth=require(_0xcf02('0x6'));var interaction=require(_0xcf02('0x7'));var config=require(_0xcf02('0x8'));var controller=require(_0xcf02('0x9'));router[_0xcf02('0xa')]('/',auth[_0xcf02('0xb')](),controller[_0xcf02('0xc')]);router[_0xcf02('0xa')](_0xcf02('0xd'),auth['isAuthenticated'](),controller[_0xcf02('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xcf02('0xf')]);router[_0xcf02('0xa')](_0xcf02('0x10'),auth[_0xcf02('0xb')](),controller['getSubjects']);router[_0xcf02('0xa')](_0xcf02('0x11'),auth[_0xcf02('0xb')](),controller['getDescriptions']);router['get'](_0xcf02('0x12'),auth[_0xcf02('0xb')](),controller[_0xcf02('0x13')]);router[_0xcf02('0x14')]('/',auth[_0xcf02('0xb')](),controller['create']);router[_0xcf02('0x14')](_0xcf02('0x12'),auth[_0xcf02('0xb')](),controller[_0xcf02('0x15')]);router[_0xcf02('0x16')](_0xcf02('0xd'),auth[_0xcf02('0xb')](),controller['update']);router[_0xcf02('0x17')](_0xcf02('0xd'),auth[_0xcf02('0xb')](),controller['destroy']);module[_0xcf02('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6add5ce..23aadf5 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 _0x6666=['STRING','sequelize'];(function(_0x23c28a,_0xd79bee){var _0x1feb42=function(_0x2062d9){while(--_0x2062d9){_0x23c28a['push'](_0x23c28a['shift']());}};_0x1feb42(++_0xd79bee);}(_0x6666,0x8d));var _0x6666=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x6666[_0x5c883f];return _0x4210cc;};'use strict';var Sequelize=require(_0x6666('0x0'));module['exports']={'name':{'type':Sequelize[_0x6666('0x1')]},'description':{'type':Sequelize[_0x6666('0x1')]}}; \ No newline at end of file +var _0xe84e=['sequelize','STRING'];(function(_0x5bc73f,_0x3b6c1a){var _0x56a591=function(_0x2f626c){while(--_0x2f626c){_0x5bc73f['push'](_0x5bc73f['shift']());}};_0x56a591(++_0x3b6c1a);}(_0xe84e,0xc8));var _0xee84=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0xe84e[_0x3124f8];return _0x5bab5f;};'use strict';var Sequelize=require(_0xee84('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xee84('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f7414c0..fb844e4 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 _0xf691=['destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','sort','where','filters','merge','options','includeAll','include','DeskConfiguration','findAll','rows','show','params','keys','length','find','create','body','getFields','findOne','DeskField','order','pick','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','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','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','update'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf691,0x89));var _0x1f69=function(_0x43389d,_0x244dc6){_0x43389d=_0x43389d-0x0;var _0x124d06=_0xf691[_0x43389d];return _0x124d06;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f69('0x1'));var jsonpatch=require(_0x1f69('0x2'));var rp=require(_0x1f69('0x3'));var moment=require('moment');var BPromise=require(_0x1f69('0x4'));var Mustache=require('mustache');var util=require(_0x1f69('0x5'));var path=require(_0x1f69('0x6'));var sox=require(_0x1f69('0x7'));var csv=require('to-csv');var ejs=require(_0x1f69('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f69('0x9'));var crypto=require('crypto');var jsforce=require(_0x1f69('0xa'));var deskjs=require(_0x1f69('0xb'));var toCsv=require(_0x1f69('0xc'));var querystring=require(_0x1f69('0xd'));var Papa=require(_0x1f69('0xe'));var Redis=require(_0x1f69('0xf'));var authService=require(_0x1f69('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1f69('0x11'));var hardwareService=require(_0x1f69('0x12'));var logger=require(_0x1f69('0x13'))('api');var utils=require(_0x1f69('0x14'));var config=require(_0x1f69('0x15'));var licenseUtil=require(_0x1f69('0x16'));var db=require(_0x1f69('0x17'))['db'];var jayson=require(_0x1f69('0x18'));var client=jayson[_0x1f69('0x19')][_0x1f69('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x281bc2,_0x174e29,_0x288c02,_0x21d33f){return new BPromise(function(_0x925592,_0x5165e7){var _0x32efaf=_0x21d33f||client;return _0x32efaf[_0x1f69('0x1b')](_0x281bc2,_0x288c02)[_0x1f69('0x1c')](function(_0x420a0f){logger[_0x1f69('0x1d')](_0x1f69('0x1e'),_0x174e29,_0x1f69('0x1f'));logger[_0x1f69('0x20')](_0x1f69('0x21'),_0x174e29,'request\x20sent',JSON['stringify'](_0x420a0f));if(_0x420a0f[_0x1f69('0x22')]){if(_0x420a0f['error'][_0x1f69('0x23')]===0x1f4){logger[_0x1f69('0x22')](_0x1f69('0x1e'),_0x174e29,_0x420a0f[_0x1f69('0x22')][_0x1f69('0x24')]);return _0x5165e7(_0x420a0f[_0x1f69('0x22')][_0x1f69('0x24')]);}logger[_0x1f69('0x22')](_0x1f69('0x1e'),_0x174e29,_0x420a0f['error']['message']);return _0x925592(_0x420a0f[_0x1f69('0x22')][_0x1f69('0x24')]);}else{logger[_0x1f69('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x174e29,_0x1f69('0x1f'));_0x925592(_0x420a0f[_0x1f69('0x25')][_0x1f69('0x24')]);}})[_0x1f69('0x26')](function(_0x222b62){logger[_0x1f69('0x22')](_0x1f69('0x1e'),_0x174e29,_0x222b62);_0x5165e7(_0x222b62);});});}function respondWithStatusCode(_0x38cc86,_0x4f9446){_0x4f9446=_0x4f9446||0xcc;return function(_0x250a6e){if(_0x250a6e){return _0x38cc86[_0x1f69('0x27')](_0x4f9446);}return _0x38cc86[_0x1f69('0x28')](_0x4f9446)[_0x1f69('0x29')]();};}function respondWithResult(_0x1ba9eb,_0x1de076){_0x1de076=_0x1de076||0xc8;return function(_0x564309){if(_0x564309){return _0x1ba9eb[_0x1f69('0x28')](_0x1de076)['json'](_0x564309);}};}function respondWithFilteredResult(_0x7b71d0,_0x2e8eb2){return function(_0x286da2){if(_0x286da2){var _0x3b0350=_0x286da2[_0x1f69('0x2a')],_0xd6b457=_0x2e8eb2[_0x1f69('0x2b')],_0x593104=_0x2e8eb2[_0x1f69('0x2b')]+_0x2e8eb2[_0x1f69('0x2c')],_0x1df75c;if(_0x593104>=_0x3b0350){_0x593104=_0x3b0350;_0x1df75c=0xc8;}else{_0x1df75c=0xce;}_0x7b71d0[_0x1f69('0x28')](_0x1df75c);return _0x7b71d0[_0x1f69('0x2d')](_0x1f69('0x2e'),_0xd6b457+'-'+_0x593104+'/'+_0x3b0350)['json'](_0x286da2);}return null;};}function patchUpdates(_0x258c0f){return function(_0x366af7){try{jsonpatch['apply'](_0x366af7,_0x258c0f,!![]);}catch(_0x156137){return BPromise[_0x1f69('0x2f')](_0x156137);}return _0x366af7['save']();};}function saveUpdates(_0x3c73de,_0xa8a5e4){return function(_0x5b7d3d){if(_0x5b7d3d){return _0x5b7d3d[_0x1f69('0x30')](_0x3c73de)[_0x1f69('0x1c')](function(_0x2ee4aa){return _0x2ee4aa;});}return null;};}function removeEntity(_0x2ce264,_0x2a1668){return function(_0x4bd70a){if(_0x4bd70a){return _0x4bd70a[_0x1f69('0x31')]()[_0x1f69('0x1c')](function(){_0x2ce264[_0x1f69('0x28')](0xcc)[_0x1f69('0x29')]();});}};}function handleEntityNotFound(_0x2950a3,_0x34e602){return function(_0x1440ac){if(!_0x1440ac){_0x2950a3[_0x1f69('0x27')](0x194);}return _0x1440ac;};}function handleError(_0x4a8477,_0x45ae18){_0x45ae18=_0x45ae18||0x1f4;return function(_0x1459a5){logger['error'](_0x1459a5['stack']);if(_0x1459a5[_0x1f69('0x32')]){delete _0x1459a5[_0x1f69('0x32')];}_0x4a8477[_0x1f69('0x28')](_0x45ae18)[_0x1f69('0x33')](_0x1459a5);};}exports['index']=function(_0x4c36fb,_0x54529d){var _0x15bc82={},_0x25c4c7={},_0x55db94={'count':0x0,'rows':[]};var _0x5137bb=_[_0x1f69('0x34')](db['DeskConfiguration'][_0x1f69('0x35')],function(_0xe3b85c){return{'name':_0xe3b85c[_0x1f69('0x36')],'type':_0xe3b85c[_0x1f69('0x37')][_0x1f69('0x38')]};});_0x25c4c7[_0x1f69('0x39')]=_[_0x1f69('0x34')](_0x5137bb,_0x1f69('0x32'));_0x25c4c7[_0x1f69('0x3a')]=_['keys'](_0x4c36fb['query']);_0x25c4c7['filters']=_['intersection'](_0x25c4c7['model'],_0x25c4c7[_0x1f69('0x3a')]);_0x15bc82[_0x1f69('0x3b')]=_[_0x1f69('0x3c')](_0x25c4c7[_0x1f69('0x39')],qs[_0x1f69('0x3d')](_0x4c36fb[_0x1f69('0x3a')][_0x1f69('0x3d')]));_0x15bc82[_0x1f69('0x3b')]=_0x15bc82['attributes']['length']?_0x15bc82[_0x1f69('0x3b')]:_0x25c4c7[_0x1f69('0x39')];if(!_0x4c36fb[_0x1f69('0x3a')][_0x1f69('0x3e')]('nolimit')){_0x15bc82[_0x1f69('0x2c')]=qs['limit'](_0x4c36fb[_0x1f69('0x3a')]['limit']);_0x15bc82[_0x1f69('0x2b')]=qs[_0x1f69('0x2b')](_0x4c36fb[_0x1f69('0x3a')][_0x1f69('0x2b')]);}_0x15bc82['order']=qs[_0x1f69('0x3f')](_0x4c36fb[_0x1f69('0x3a')][_0x1f69('0x3f')]);_0x15bc82[_0x1f69('0x40')]=qs['filters'](_['pick'](_0x4c36fb[_0x1f69('0x3a')],_0x25c4c7[_0x1f69('0x41')]),_0x5137bb);if(_0x4c36fb[_0x1f69('0x3a')]['filter']){_0x15bc82['where']=_[_0x1f69('0x42')](_0x15bc82['where'],{'$or':_[_0x1f69('0x34')](_0x5137bb,function(_0x208e17){if(_0x208e17['type']!=='VIRTUAL'){var _0x144c9e={};_0x144c9e[_0x208e17[_0x1f69('0x32')]]={'$like':'%'+_0x4c36fb[_0x1f69('0x3a')]['filter']+'%'};return _0x144c9e;}})});}_0x15bc82=_[_0x1f69('0x42')]({},_0x15bc82,_0x4c36fb[_0x1f69('0x43')]);var _0x36e20b={'where':_0x15bc82[_0x1f69('0x40')]};return db['DeskConfiguration'][_0x1f69('0x2a')](_0x36e20b)[_0x1f69('0x1c')](function(_0x61fd90){_0x55db94[_0x1f69('0x2a')]=_0x61fd90;if(_0x4c36fb[_0x1f69('0x3a')][_0x1f69('0x44')]){_0x15bc82[_0x1f69('0x45')]=[{'all':!![]}];}return db[_0x1f69('0x46')][_0x1f69('0x47')](_0x15bc82);})['then'](function(_0x173f74){_0x55db94[_0x1f69('0x48')]=_0x173f74;return _0x55db94;})[_0x1f69('0x1c')](respondWithFilteredResult(_0x54529d,_0x15bc82))[_0x1f69('0x26')](handleError(_0x54529d,null));};exports[_0x1f69('0x49')]=function(_0x292275,_0x309cc3){var _0x44a541={'raw':![],'where':{'id':_0x292275[_0x1f69('0x4a')]['id']}},_0xdfe994={};_0xdfe994[_0x1f69('0x39')]=_[_0x1f69('0x4b')](db[_0x1f69('0x46')][_0x1f69('0x35')]);_0xdfe994[_0x1f69('0x3a')]=_[_0x1f69('0x4b')](_0x292275[_0x1f69('0x3a')]);_0xdfe994['filters']=_[_0x1f69('0x3c')](_0xdfe994[_0x1f69('0x39')],_0xdfe994['query']);_0x44a541[_0x1f69('0x3b')]=_[_0x1f69('0x3c')](_0xdfe994[_0x1f69('0x39')],qs[_0x1f69('0x3d')](_0x292275['query'][_0x1f69('0x3d')]));_0x44a541[_0x1f69('0x3b')]=_0x44a541['attributes'][_0x1f69('0x4c')]?_0x44a541['attributes']:_0xdfe994[_0x1f69('0x39')];if(_0x292275['query'][_0x1f69('0x44')]){_0x44a541[_0x1f69('0x45')]=[{'all':!![]}];}_0x44a541=_[_0x1f69('0x42')]({},_0x44a541,_0x292275['options']);return db[_0x1f69('0x46')][_0x1f69('0x4d')](_0x44a541)[_0x1f69('0x1c')](handleEntityNotFound(_0x309cc3,null))[_0x1f69('0x1c')](respondWithResult(_0x309cc3,null))[_0x1f69('0x26')](handleError(_0x309cc3,null));};exports[_0x1f69('0x4e')]=function(_0x2abdb8,_0x5a52a9){return db[_0x1f69('0x46')]['create'](_0x2abdb8[_0x1f69('0x4f')],{})[_0x1f69('0x1c')](respondWithResult(_0x5a52a9,0xc9))[_0x1f69('0x26')](handleError(_0x5a52a9,null));};exports['update']=function(_0x2e58d4,_0x98ec27){if(_0x2e58d4[_0x1f69('0x4f')]['id']){delete _0x2e58d4[_0x1f69('0x4f')]['id'];}return db['DeskConfiguration'][_0x1f69('0x4d')]({'where':{'id':_0x2e58d4[_0x1f69('0x4a')]['id']}})[_0x1f69('0x1c')](handleEntityNotFound(_0x98ec27,null))['then'](saveUpdates(_0x2e58d4[_0x1f69('0x4f')],null))[_0x1f69('0x1c')](respondWithResult(_0x98ec27,null))[_0x1f69('0x26')](handleError(_0x98ec27,null));};exports[_0x1f69('0x31')]=function(_0x40d8b0,_0x53084e){return db['DeskConfiguration'][_0x1f69('0x4d')]({'where':{'id':_0x40d8b0['params']['id']}})[_0x1f69('0x1c')](handleEntityNotFound(_0x53084e,null))[_0x1f69('0x1c')](removeEntity(_0x53084e,null))[_0x1f69('0x26')](handleError(_0x53084e,null));};exports[_0x1f69('0x50')]=function(_0x3bc7e1,_0xe7fae5,_0xdb9612){var _0x37133c={};var _0x193f54={};var _0x5e942c;var _0x108faf;return db[_0x1f69('0x46')][_0x1f69('0x51')]({'where':{'id':_0x3bc7e1[_0x1f69('0x4a')]['id']}})[_0x1f69('0x1c')](handleEntityNotFound(_0xe7fae5,null))['then'](function(_0x5568c4){if(_0x5568c4){_0x5e942c=_0x5568c4;_0x193f54[_0x1f69('0x39')]=_['keys'](db[_0x1f69('0x52')][_0x1f69('0x35')]);_0x193f54['query']=_[_0x1f69('0x4b')](_0x3bc7e1[_0x1f69('0x3a')]);_0x193f54['filters']=_[_0x1f69('0x3c')](_0x193f54[_0x1f69('0x39')],_0x193f54['query']);_0x37133c['attributes']=_[_0x1f69('0x3c')](_0x193f54['model'],qs['fields'](_0x3bc7e1['query'][_0x1f69('0x3d')]));_0x37133c['attributes']=_0x37133c[_0x1f69('0x3b')][_0x1f69('0x4c')]?_0x37133c['attributes']:_0x193f54[_0x1f69('0x39')];_0x37133c[_0x1f69('0x53')]=qs[_0x1f69('0x3f')](_0x3bc7e1[_0x1f69('0x3a')][_0x1f69('0x3f')]);_0x37133c[_0x1f69('0x40')]=qs[_0x1f69('0x41')](_[_0x1f69('0x54')](_0x3bc7e1['query'],_0x193f54[_0x1f69('0x41')]));if(_0x3bc7e1[_0x1f69('0x3a')][_0x1f69('0x55')]){_0x37133c[_0x1f69('0x40')]=_[_0x1f69('0x42')](_0x37133c['where'],{'$or':_[_0x1f69('0x34')](_0x37133c[_0x1f69('0x3b')],function(_0x1470c8){var _0x555d9b={};_0x555d9b[_0x1470c8]={'$like':'%'+_0x3bc7e1['query'][_0x1f69('0x55')]+'%'};return _0x555d9b;})});}_0x37133c=_[_0x1f69('0x42')]({},_0x37133c,_0x3bc7e1[_0x1f69('0x43')]);return _0x5e942c[_0x1f69('0x50')](_0x37133c);}})['then'](function(_0x4407cd){if(_0x4407cd){_0x108faf=_0x4407cd['length'];if(!_0x3bc7e1[_0x1f69('0x3a')][_0x1f69('0x3e')](_0x1f69('0x56'))){_0x37133c[_0x1f69('0x2c')]=qs[_0x1f69('0x2c')](_0x3bc7e1[_0x1f69('0x3a')][_0x1f69('0x2c')]);_0x37133c[_0x1f69('0x2b')]=qs[_0x1f69('0x2b')](_0x3bc7e1['query'][_0x1f69('0x2b')]);}return _0x5e942c['getFields'](_0x37133c);}})[_0x1f69('0x1c')](function(_0x24486b){if(_0x24486b){return _0x24486b?{'count':_0x108faf,'rows':_0x24486b}:null;}})[_0x1f69('0x1c')](respondWithResult(_0xe7fae5,null))[_0x1f69('0x26')](handleError(_0xe7fae5,null));};exports[_0x1f69('0x57')]=function(_0x4dafeb,_0x33ce1b,_0x385cfc){var _0x324488={};var _0x375c76={};var _0x2ba9b3;var _0x3c5d94;return db[_0x1f69('0x46')][_0x1f69('0x51')]({'where':{'id':_0x4dafeb[_0x1f69('0x4a')]['id']}})[_0x1f69('0x1c')](handleEntityNotFound(_0x33ce1b,null))[_0x1f69('0x1c')](function(_0x147970){if(_0x147970){_0x2ba9b3=_0x147970;_0x375c76[_0x1f69('0x39')]=_[_0x1f69('0x4b')](db['DeskField'][_0x1f69('0x35')]);_0x375c76[_0x1f69('0x3a')]=_['keys'](_0x4dafeb[_0x1f69('0x3a')]);_0x375c76[_0x1f69('0x41')]=_[_0x1f69('0x3c')](_0x375c76['model'],_0x375c76[_0x1f69('0x3a')]);_0x324488['attributes']=_[_0x1f69('0x3c')](_0x375c76[_0x1f69('0x39')],qs[_0x1f69('0x3d')](_0x4dafeb[_0x1f69('0x3a')]['fields']));_0x324488[_0x1f69('0x3b')]=_0x324488[_0x1f69('0x3b')][_0x1f69('0x4c')]?_0x324488[_0x1f69('0x3b')]:_0x375c76['model'];_0x324488['order']=qs['sort'](_0x4dafeb['query'][_0x1f69('0x3f')]);_0x324488[_0x1f69('0x40')]=qs['filters'](_[_0x1f69('0x54')](_0x4dafeb[_0x1f69('0x3a')],_0x375c76[_0x1f69('0x41')]));if(_0x4dafeb[_0x1f69('0x3a')]['filter']){_0x324488[_0x1f69('0x40')]=_['merge'](_0x324488[_0x1f69('0x40')],{'$or':_[_0x1f69('0x34')](_0x324488[_0x1f69('0x3b')],function(_0x574809){var _0x5983e3={};_0x5983e3[_0x574809]={'$like':'%'+_0x4dafeb[_0x1f69('0x3a')][_0x1f69('0x55')]+'%'};return _0x5983e3;})});}_0x324488=_['merge']({},_0x324488,_0x4dafeb[_0x1f69('0x43')]);return _0x2ba9b3[_0x1f69('0x57')](_0x324488);}})['then'](function(_0x52a9e9){if(_0x52a9e9){_0x3c5d94=_0x52a9e9[_0x1f69('0x4c')];if(!_0x4dafeb['query'][_0x1f69('0x3e')](_0x1f69('0x56'))){_0x324488[_0x1f69('0x2c')]=qs['limit'](_0x4dafeb[_0x1f69('0x3a')][_0x1f69('0x2c')]);_0x324488[_0x1f69('0x2b')]=qs[_0x1f69('0x2b')](_0x4dafeb[_0x1f69('0x3a')][_0x1f69('0x2b')]);}return _0x2ba9b3[_0x1f69('0x57')](_0x324488);}})[_0x1f69('0x1c')](function(_0x4bdc6d){if(_0x4bdc6d){return _0x4bdc6d?{'count':_0x3c5d94,'rows':_0x4bdc6d}:null;}})['then'](respondWithResult(_0x33ce1b,null))[_0x1f69('0x26')](handleError(_0x33ce1b,null));};exports[_0x1f69('0x58')]=function(_0x44653e,_0x59cf00,_0x42da32){var _0x58d9e4={};var _0x13bd67={};var _0x11fa91;var _0x5256e2;return db['DeskConfiguration']['findOne']({'where':{'id':_0x44653e[_0x1f69('0x4a')]['id']}})[_0x1f69('0x1c')](handleEntityNotFound(_0x59cf00,null))[_0x1f69('0x1c')](function(_0x543c24){if(_0x543c24){_0x11fa91=_0x543c24;_0x13bd67['model']=_['keys'](db['DeskField'][_0x1f69('0x35')]);_0x13bd67[_0x1f69('0x3a')]=_[_0x1f69('0x4b')](_0x44653e[_0x1f69('0x3a')]);_0x13bd67[_0x1f69('0x41')]=_[_0x1f69('0x3c')](_0x13bd67[_0x1f69('0x39')],_0x13bd67[_0x1f69('0x3a')]);_0x58d9e4[_0x1f69('0x3b')]=_['intersection'](_0x13bd67[_0x1f69('0x39')],qs[_0x1f69('0x3d')](_0x44653e['query'][_0x1f69('0x3d')]));_0x58d9e4[_0x1f69('0x3b')]=_0x58d9e4[_0x1f69('0x3b')][_0x1f69('0x4c')]?_0x58d9e4['attributes']:_0x13bd67['model'];_0x58d9e4[_0x1f69('0x53')]=qs[_0x1f69('0x3f')](_0x44653e[_0x1f69('0x3a')]['sort']);_0x58d9e4['where']=qs[_0x1f69('0x41')](_[_0x1f69('0x54')](_0x44653e[_0x1f69('0x3a')],_0x13bd67[_0x1f69('0x41')]));if(_0x44653e[_0x1f69('0x3a')][_0x1f69('0x55')]){_0x58d9e4['where']=_['merge'](_0x58d9e4[_0x1f69('0x40')],{'$or':_[_0x1f69('0x34')](_0x58d9e4[_0x1f69('0x3b')],function(_0x18d09a){var _0x47272e={};_0x47272e[_0x18d09a]={'$like':'%'+_0x44653e[_0x1f69('0x3a')][_0x1f69('0x55')]+'%'};return _0x47272e;})});}_0x58d9e4=_[_0x1f69('0x42')]({},_0x58d9e4,_0x44653e[_0x1f69('0x43')]);return _0x11fa91[_0x1f69('0x58')](_0x58d9e4);}})[_0x1f69('0x1c')](function(_0x6654c6){if(_0x6654c6){_0x5256e2=_0x6654c6[_0x1f69('0x4c')];if(!_0x44653e[_0x1f69('0x3a')][_0x1f69('0x3e')](_0x1f69('0x56'))){_0x58d9e4[_0x1f69('0x2c')]=qs['limit'](_0x44653e[_0x1f69('0x3a')][_0x1f69('0x2c')]);_0x58d9e4[_0x1f69('0x2b')]=qs['offset'](_0x44653e[_0x1f69('0x3a')][_0x1f69('0x2b')]);}return _0x11fa91[_0x1f69('0x58')](_0x58d9e4);}})[_0x1f69('0x1c')](function(_0x33fe81){if(_0x33fe81){return _0x33fe81?{'count':_0x5256e2,'rows':_0x33fe81}:null;}})[_0x1f69('0x1c')](respondWithResult(_0x59cf00,null))['catch'](handleError(_0x59cf00,null));};exports[_0x1f69('0x59')]=function(_0x3fb356,_0x1f7921,_0x1cfecd){var _0x302d88={};var _0x237a8f={};var _0x5a2ece;var _0x1494eb;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3fb356[_0x1f69('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f7921,null))[_0x1f69('0x1c')](function(_0x5b46d9){if(_0x5b46d9){_0x5a2ece=_0x5b46d9;_0x237a8f['model']=_[_0x1f69('0x4b')](db[_0x1f69('0x5a')][_0x1f69('0x35')]);_0x237a8f[_0x1f69('0x3a')]=_['keys'](_0x3fb356[_0x1f69('0x3a')]);_0x237a8f['filters']=_[_0x1f69('0x3c')](_0x237a8f[_0x1f69('0x39')],_0x237a8f[_0x1f69('0x3a')]);_0x302d88[_0x1f69('0x3b')]=_[_0x1f69('0x3c')](_0x237a8f['model'],qs[_0x1f69('0x3d')](_0x3fb356[_0x1f69('0x3a')][_0x1f69('0x3d')]));_0x302d88['attributes']=_0x302d88[_0x1f69('0x3b')][_0x1f69('0x4c')]?_0x302d88[_0x1f69('0x3b')]:_0x237a8f['model'];_0x302d88['order']=qs['sort'](_0x3fb356[_0x1f69('0x3a')]['sort']);_0x302d88[_0x1f69('0x40')]=qs[_0x1f69('0x41')](_['pick'](_0x3fb356['query'],_0x237a8f[_0x1f69('0x41')]));if(_0x3fb356[_0x1f69('0x3a')][_0x1f69('0x55')]){_0x302d88[_0x1f69('0x40')]=_[_0x1f69('0x42')](_0x302d88[_0x1f69('0x40')],{'$or':_[_0x1f69('0x34')](_0x302d88[_0x1f69('0x3b')],function(_0x574ef6){var _0x36bfc2={};_0x36bfc2[_0x574ef6]={'$like':'%'+_0x3fb356[_0x1f69('0x3a')]['filter']+'%'};return _0x36bfc2;})});}_0x302d88=_[_0x1f69('0x42')]({},_0x302d88,_0x3fb356[_0x1f69('0x43')]);return _0x5a2ece[_0x1f69('0x59')](_0x302d88);}})[_0x1f69('0x1c')](function(_0x4f38cf){if(_0x4f38cf){_0x1494eb=_0x4f38cf['length'];if(!_0x3fb356[_0x1f69('0x3a')][_0x1f69('0x3e')](_0x1f69('0x56'))){_0x302d88[_0x1f69('0x2c')]=qs[_0x1f69('0x2c')](_0x3fb356['query'][_0x1f69('0x2c')]);_0x302d88[_0x1f69('0x2b')]=qs[_0x1f69('0x2b')](_0x3fb356[_0x1f69('0x3a')]['offset']);}return _0x5a2ece['getTags'](_0x302d88);}})[_0x1f69('0x1c')](function(_0x2580cb){if(_0x2580cb){return _0x2580cb?{'count':_0x1494eb,'rows':_0x2580cb}:null;}})[_0x1f69('0x1c')](respondWithResult(_0x1f7921,null))[_0x1f69('0x26')](handleError(_0x1f7921,null));};exports['setTags']=function(_0x8fa36c,_0x380708,_0x30dc9c){if(_0x8fa36c['body']['id']){delete _0x8fa36c[_0x1f69('0x4f')]['id'];}return db[_0x1f69('0x46')]['findOne']({'where':{'id':_0x8fa36c[_0x1f69('0x4a')]['id']}})[_0x1f69('0x1c')](handleEntityNotFound(_0x380708,null))['then'](function(_0x2ccdf1){if(_0x2ccdf1){return _0x2ccdf1[_0x1f69('0x5b')](_0x8fa36c[_0x1f69('0x4f')][_0x1f69('0x5c')]||[]);}return null;})[_0x1f69('0x1c')](respondWithResult(_0x380708,null))['catch'](handleError(_0x380708,null));}; \ No newline at end of file +var _0xc38b=['model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','options','includeAll','rows','show','params','keys','find','create','body','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','name','send','index','DeskConfiguration','rawAttributes','type'];(function(_0x46cd37,_0x2a2b32){var _0x495f0f=function(_0x5d6ebe){while(--_0x5d6ebe){_0x46cd37['push'](_0x46cd37['shift']());}};_0x495f0f(++_0x2a2b32);}(_0xc38b,0x192));var _0xbc38=function(_0x334768,_0x49b07a){_0x334768=_0x334768-0x0;var _0x494bc0=_0xc38b[_0x334768];return _0x494bc0;};'use strict';var pdf=require(_0xbc38('0x0'));var emlformat=require(_0xbc38('0x1'));var rimraf=require(_0xbc38('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc38('0x3'));var rp=require(_0xbc38('0x4'));var moment=require(_0xbc38('0x5'));var BPromise=require(_0xbc38('0x6'));var Mustache=require('mustache');var util=require(_0xbc38('0x7'));var path=require(_0xbc38('0x8'));var sox=require(_0xbc38('0x9'));var csv=require('to-csv');var ejs=require(_0xbc38('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbc38('0xb'));var crypto=require(_0xbc38('0xc'));var jsforce=require(_0xbc38('0xd'));var deskjs=require(_0xbc38('0xe'));var toCsv=require(_0xbc38('0xf'));var querystring=require('querystring');var Papa=require(_0xbc38('0x10'));var Redis=require(_0xbc38('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbc38('0x12'));var as=require(_0xbc38('0x13'));var hardwareService=require(_0xbc38('0x14'));var logger=require('../../config/logger')(_0xbc38('0x15'));var utils=require(_0xbc38('0x16'));var config=require(_0xbc38('0x17'));var licenseUtil=require(_0xbc38('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbc38('0x19'));var client=jayson[_0xbc38('0x1a')][_0xbc38('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1418de,_0xb49778,_0x88d68a,_0x440f94){return new BPromise(function(_0x50fa0b,_0x5c8fbb){var _0x1f2433=_0x440f94||client;return _0x1f2433[_0xbc38('0x1c')](_0x1418de,_0x88d68a)['then'](function(_0x211f7a){logger[_0xbc38('0x1d')](_0xbc38('0x1e'),_0xb49778,_0xbc38('0x1f'));logger['debug'](_0xbc38('0x20'),_0xb49778,'request\x20sent',JSON[_0xbc38('0x21')](_0x211f7a));if(_0x211f7a[_0xbc38('0x22')]){if(_0x211f7a[_0xbc38('0x22')]['code']===0x1f4){logger[_0xbc38('0x22')](_0xbc38('0x1e'),_0xb49778,_0x211f7a[_0xbc38('0x22')]['message']);return _0x5c8fbb(_0x211f7a['error'][_0xbc38('0x23')]);}logger[_0xbc38('0x22')](_0xbc38('0x1e'),_0xb49778,_0x211f7a[_0xbc38('0x22')][_0xbc38('0x23')]);return _0x50fa0b(_0x211f7a[_0xbc38('0x22')][_0xbc38('0x23')]);}else{logger[_0xbc38('0x1d')](_0xbc38('0x1e'),_0xb49778,_0xbc38('0x1f'));_0x50fa0b(_0x211f7a[_0xbc38('0x24')][_0xbc38('0x23')]);}})[_0xbc38('0x25')](function(_0x54b473){logger[_0xbc38('0x22')](_0xbc38('0x1e'),_0xb49778,_0x54b473);_0x5c8fbb(_0x54b473);});});}function respondWithStatusCode(_0x101fe1,_0x324521){_0x324521=_0x324521||0xcc;return function(_0x2a822f){if(_0x2a822f){return _0x101fe1[_0xbc38('0x26')](_0x324521);}return _0x101fe1[_0xbc38('0x27')](_0x324521)[_0xbc38('0x28')]();};}function respondWithResult(_0x4c4f1f,_0x287dd2){_0x287dd2=_0x287dd2||0xc8;return function(_0x31a5bc){if(_0x31a5bc){return _0x4c4f1f['status'](_0x287dd2)['json'](_0x31a5bc);}};}function respondWithFilteredResult(_0x4256ea,_0x5232ab){return function(_0x39a55c){if(_0x39a55c){var _0x183eb2=_0x39a55c[_0xbc38('0x29')],_0x79461c=_0x5232ab[_0xbc38('0x2a')],_0x35de58=_0x5232ab[_0xbc38('0x2a')]+_0x5232ab['limit'],_0x21c306;if(_0x35de58>=_0x183eb2){_0x35de58=_0x183eb2;_0x21c306=0xc8;}else{_0x21c306=0xce;}_0x4256ea[_0xbc38('0x27')](_0x21c306);return _0x4256ea[_0xbc38('0x2b')](_0xbc38('0x2c'),_0x79461c+'-'+_0x35de58+'/'+_0x183eb2)[_0xbc38('0x2d')](_0x39a55c);}return null;};}function patchUpdates(_0xd9f408){return function(_0x27234d){try{jsonpatch[_0xbc38('0x2e')](_0x27234d,_0xd9f408,!![]);}catch(_0x16b690){return BPromise[_0xbc38('0x2f')](_0x16b690);}return _0x27234d[_0xbc38('0x30')]();};}function saveUpdates(_0x1bdeeb,_0x4c3578){return function(_0x42a7a2){if(_0x42a7a2){return _0x42a7a2[_0xbc38('0x31')](_0x1bdeeb)['then'](function(_0x23b706){return _0x23b706;});}return null;};}function removeEntity(_0xa8902b,_0x1b240b){return function(_0x366552){if(_0x366552){return _0x366552[_0xbc38('0x32')]()[_0xbc38('0x33')](function(){_0xa8902b['status'](0xcc)[_0xbc38('0x28')]();});}};}function handleEntityNotFound(_0x8297fd,_0x395a23){return function(_0x542763){if(!_0x542763){_0x8297fd[_0xbc38('0x26')](0x194);}return _0x542763;};}function handleError(_0x5195a0,_0x37cf35){_0x37cf35=_0x37cf35||0x1f4;return function(_0x39e74e){logger[_0xbc38('0x22')](_0x39e74e['stack']);if(_0x39e74e[_0xbc38('0x34')]){delete _0x39e74e[_0xbc38('0x34')];}_0x5195a0[_0xbc38('0x27')](_0x37cf35)[_0xbc38('0x35')](_0x39e74e);};}exports[_0xbc38('0x36')]=function(_0x142148,_0x2b64f1){var _0x535384={},_0x285268={},_0x2fb986={'count':0x0,'rows':[]};var _0x3dfa93=_['map'](db[_0xbc38('0x37')][_0xbc38('0x38')],function(_0x17a178){return{'name':_0x17a178['fieldName'],'type':_0x17a178[_0xbc38('0x39')]['key']};});_0x285268[_0xbc38('0x3a')]=_[_0xbc38('0x3b')](_0x3dfa93,_0xbc38('0x34'));_0x285268['query']=_['keys'](_0x142148[_0xbc38('0x3c')]);_0x285268['filters']=_['intersection'](_0x285268[_0xbc38('0x3a')],_0x285268[_0xbc38('0x3c')]);_0x535384['attributes']=_[_0xbc38('0x3d')](_0x285268[_0xbc38('0x3a')],qs[_0xbc38('0x3e')](_0x142148[_0xbc38('0x3c')]['fields']));_0x535384['attributes']=_0x535384[_0xbc38('0x3f')][_0xbc38('0x40')]?_0x535384[_0xbc38('0x3f')]:_0x285268['model'];if(!_0x142148['query'][_0xbc38('0x41')](_0xbc38('0x42'))){_0x535384[_0xbc38('0x43')]=qs[_0xbc38('0x43')](_0x142148[_0xbc38('0x3c')][_0xbc38('0x43')]);_0x535384[_0xbc38('0x2a')]=qs['offset'](_0x142148['query'][_0xbc38('0x2a')]);}_0x535384['order']=qs[_0xbc38('0x44')](_0x142148[_0xbc38('0x3c')][_0xbc38('0x44')]);_0x535384['where']=qs[_0xbc38('0x45')](_[_0xbc38('0x46')](_0x142148[_0xbc38('0x3c')],_0x285268[_0xbc38('0x45')]),_0x3dfa93);if(_0x142148[_0xbc38('0x3c')][_0xbc38('0x47')]){_0x535384[_0xbc38('0x48')]=_[_0xbc38('0x49')](_0x535384['where'],{'$or':_[_0xbc38('0x3b')](_0x3dfa93,function(_0x21915c){if(_0x21915c[_0xbc38('0x39')]!=='VIRTUAL'){var _0x3b80b9={};_0x3b80b9[_0x21915c[_0xbc38('0x34')]]={'$like':'%'+_0x142148[_0xbc38('0x3c')][_0xbc38('0x47')]+'%'};return _0x3b80b9;}})});}_0x535384=_['merge']({},_0x535384,_0x142148[_0xbc38('0x4a')]);var _0x53d684={'where':_0x535384['where']};return db[_0xbc38('0x37')][_0xbc38('0x29')](_0x53d684)[_0xbc38('0x33')](function(_0x3fdbbd){_0x2fb986[_0xbc38('0x29')]=_0x3fdbbd;if(_0x142148['query'][_0xbc38('0x4b')]){_0x535384['include']=[{'all':!![]}];}return db[_0xbc38('0x37')]['findAll'](_0x535384);})[_0xbc38('0x33')](function(_0x2aad22){_0x2fb986[_0xbc38('0x4c')]=_0x2aad22;return _0x2fb986;})[_0xbc38('0x33')](respondWithFilteredResult(_0x2b64f1,_0x535384))['catch'](handleError(_0x2b64f1,null));};exports[_0xbc38('0x4d')]=function(_0x4b76da,_0x57b501){var _0x57a286={'raw':![],'where':{'id':_0x4b76da[_0xbc38('0x4e')]['id']}},_0x18c3ba={};_0x18c3ba[_0xbc38('0x3a')]=_[_0xbc38('0x4f')](db[_0xbc38('0x37')][_0xbc38('0x38')]);_0x18c3ba['query']=_[_0xbc38('0x4f')](_0x4b76da[_0xbc38('0x3c')]);_0x18c3ba[_0xbc38('0x45')]=_[_0xbc38('0x3d')](_0x18c3ba[_0xbc38('0x3a')],_0x18c3ba[_0xbc38('0x3c')]);_0x57a286[_0xbc38('0x3f')]=_[_0xbc38('0x3d')](_0x18c3ba[_0xbc38('0x3a')],qs[_0xbc38('0x3e')](_0x4b76da[_0xbc38('0x3c')][_0xbc38('0x3e')]));_0x57a286[_0xbc38('0x3f')]=_0x57a286[_0xbc38('0x3f')]['length']?_0x57a286[_0xbc38('0x3f')]:_0x18c3ba[_0xbc38('0x3a')];if(_0x4b76da[_0xbc38('0x3c')]['includeAll']){_0x57a286['include']=[{'all':!![]}];}_0x57a286=_[_0xbc38('0x49')]({},_0x57a286,_0x4b76da['options']);return db[_0xbc38('0x37')][_0xbc38('0x50')](_0x57a286)[_0xbc38('0x33')](handleEntityNotFound(_0x57b501,null))[_0xbc38('0x33')](respondWithResult(_0x57b501,null))[_0xbc38('0x25')](handleError(_0x57b501,null));};exports[_0xbc38('0x51')]=function(_0x1fa1ec,_0xf3bceb){return db['DeskConfiguration'][_0xbc38('0x51')](_0x1fa1ec[_0xbc38('0x52')],{})[_0xbc38('0x33')](respondWithResult(_0xf3bceb,0xc9))['catch'](handleError(_0xf3bceb,null));};exports[_0xbc38('0x31')]=function(_0x452f3a,_0x3b3dea){if(_0x452f3a[_0xbc38('0x52')]['id']){delete _0x452f3a[_0xbc38('0x52')]['id'];}return db[_0xbc38('0x37')]['find']({'where':{'id':_0x452f3a['params']['id']}})[_0xbc38('0x33')](handleEntityNotFound(_0x3b3dea,null))[_0xbc38('0x33')](saveUpdates(_0x452f3a[_0xbc38('0x52')],null))[_0xbc38('0x33')](respondWithResult(_0x3b3dea,null))['catch'](handleError(_0x3b3dea,null));};exports['destroy']=function(_0x20fd64,_0x67f0f6){return db[_0xbc38('0x37')][_0xbc38('0x50')]({'where':{'id':_0x20fd64[_0xbc38('0x4e')]['id']}})[_0xbc38('0x33')](handleEntityNotFound(_0x67f0f6,null))[_0xbc38('0x33')](removeEntity(_0x67f0f6,null))[_0xbc38('0x25')](handleError(_0x67f0f6,null));};exports[_0xbc38('0x53')]=function(_0x40b8bd,_0x404d94,_0x480730){var _0x359e20={};var _0x5a9146={};var _0x5b2f6a;var _0x19069d;return db[_0xbc38('0x37')][_0xbc38('0x54')]({'where':{'id':_0x40b8bd[_0xbc38('0x4e')]['id']}})[_0xbc38('0x33')](handleEntityNotFound(_0x404d94,null))[_0xbc38('0x33')](function(_0x21150b){if(_0x21150b){_0x5b2f6a=_0x21150b;_0x5a9146[_0xbc38('0x3a')]=_[_0xbc38('0x4f')](db[_0xbc38('0x55')][_0xbc38('0x38')]);_0x5a9146[_0xbc38('0x3c')]=_[_0xbc38('0x4f')](_0x40b8bd[_0xbc38('0x3c')]);_0x5a9146[_0xbc38('0x45')]=_[_0xbc38('0x3d')](_0x5a9146[_0xbc38('0x3a')],_0x5a9146[_0xbc38('0x3c')]);_0x359e20['attributes']=_[_0xbc38('0x3d')](_0x5a9146[_0xbc38('0x3a')],qs[_0xbc38('0x3e')](_0x40b8bd[_0xbc38('0x3c')][_0xbc38('0x3e')]));_0x359e20[_0xbc38('0x3f')]=_0x359e20['attributes'][_0xbc38('0x40')]?_0x359e20[_0xbc38('0x3f')]:_0x5a9146[_0xbc38('0x3a')];_0x359e20[_0xbc38('0x56')]=qs[_0xbc38('0x44')](_0x40b8bd[_0xbc38('0x3c')][_0xbc38('0x44')]);_0x359e20[_0xbc38('0x48')]=qs[_0xbc38('0x45')](_[_0xbc38('0x46')](_0x40b8bd[_0xbc38('0x3c')],_0x5a9146[_0xbc38('0x45')]));if(_0x40b8bd[_0xbc38('0x3c')][_0xbc38('0x47')]){_0x359e20[_0xbc38('0x48')]=_[_0xbc38('0x49')](_0x359e20[_0xbc38('0x48')],{'$or':_['map'](_0x359e20['attributes'],function(_0x4feb05){var _0x538e35={};_0x538e35[_0x4feb05]={'$like':'%'+_0x40b8bd['query'][_0xbc38('0x47')]+'%'};return _0x538e35;})});}_0x359e20=_[_0xbc38('0x49')]({},_0x359e20,_0x40b8bd[_0xbc38('0x4a')]);return _0x5b2f6a[_0xbc38('0x53')](_0x359e20);}})[_0xbc38('0x33')](function(_0xb5dcac){if(_0xb5dcac){_0x19069d=_0xb5dcac[_0xbc38('0x40')];if(!_0x40b8bd['query'][_0xbc38('0x41')]('nolimit')){_0x359e20['limit']=qs[_0xbc38('0x43')](_0x40b8bd[_0xbc38('0x3c')][_0xbc38('0x43')]);_0x359e20['offset']=qs[_0xbc38('0x2a')](_0x40b8bd['query'][_0xbc38('0x2a')]);}return _0x5b2f6a[_0xbc38('0x53')](_0x359e20);}})[_0xbc38('0x33')](function(_0x18ac14){if(_0x18ac14){return _0x18ac14?{'count':_0x19069d,'rows':_0x18ac14}:null;}})[_0xbc38('0x33')](respondWithResult(_0x404d94,null))[_0xbc38('0x25')](handleError(_0x404d94,null));};exports['getSubjects']=function(_0x155c9d,_0x2c708a,_0x1f44b2){var _0x5201c4={};var _0x570790={};var _0x28eca1;var _0x731213;return db[_0xbc38('0x37')][_0xbc38('0x54')]({'where':{'id':_0x155c9d[_0xbc38('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c708a,null))[_0xbc38('0x33')](function(_0x33ba91){if(_0x33ba91){_0x28eca1=_0x33ba91;_0x570790[_0xbc38('0x3a')]=_['keys'](db['DeskField']['rawAttributes']);_0x570790[_0xbc38('0x3c')]=_[_0xbc38('0x4f')](_0x155c9d[_0xbc38('0x3c')]);_0x570790[_0xbc38('0x45')]=_[_0xbc38('0x3d')](_0x570790[_0xbc38('0x3a')],_0x570790['query']);_0x5201c4[_0xbc38('0x3f')]=_[_0xbc38('0x3d')](_0x570790[_0xbc38('0x3a')],qs['fields'](_0x155c9d['query']['fields']));_0x5201c4[_0xbc38('0x3f')]=_0x5201c4[_0xbc38('0x3f')]['length']?_0x5201c4['attributes']:_0x570790[_0xbc38('0x3a')];_0x5201c4['order']=qs[_0xbc38('0x44')](_0x155c9d[_0xbc38('0x3c')][_0xbc38('0x44')]);_0x5201c4[_0xbc38('0x48')]=qs[_0xbc38('0x45')](_[_0xbc38('0x46')](_0x155c9d['query'],_0x570790[_0xbc38('0x45')]));if(_0x155c9d['query'][_0xbc38('0x47')]){_0x5201c4[_0xbc38('0x48')]=_[_0xbc38('0x49')](_0x5201c4[_0xbc38('0x48')],{'$or':_['map'](_0x5201c4[_0xbc38('0x3f')],function(_0x3429ac){var _0x13a28f={};_0x13a28f[_0x3429ac]={'$like':'%'+_0x155c9d[_0xbc38('0x3c')][_0xbc38('0x47')]+'%'};return _0x13a28f;})});}_0x5201c4=_[_0xbc38('0x49')]({},_0x5201c4,_0x155c9d[_0xbc38('0x4a')]);return _0x28eca1[_0xbc38('0x57')](_0x5201c4);}})[_0xbc38('0x33')](function(_0x2463e0){if(_0x2463e0){_0x731213=_0x2463e0[_0xbc38('0x40')];if(!_0x155c9d[_0xbc38('0x3c')][_0xbc38('0x41')](_0xbc38('0x42'))){_0x5201c4[_0xbc38('0x43')]=qs['limit'](_0x155c9d[_0xbc38('0x3c')][_0xbc38('0x43')]);_0x5201c4[_0xbc38('0x2a')]=qs[_0xbc38('0x2a')](_0x155c9d[_0xbc38('0x3c')][_0xbc38('0x2a')]);}return _0x28eca1[_0xbc38('0x57')](_0x5201c4);}})[_0xbc38('0x33')](function(_0x4b82bd){if(_0x4b82bd){return _0x4b82bd?{'count':_0x731213,'rows':_0x4b82bd}:null;}})[_0xbc38('0x33')](respondWithResult(_0x2c708a,null))[_0xbc38('0x25')](handleError(_0x2c708a,null));};exports[_0xbc38('0x58')]=function(_0x2f5424,_0x2487c5,_0x2f3129){var _0x1a2976={};var _0x18083c={};var _0x5e7c6c;var _0xdf06a2;return db[_0xbc38('0x37')]['findOne']({'where':{'id':_0x2f5424[_0xbc38('0x4e')]['id']}})[_0xbc38('0x33')](handleEntityNotFound(_0x2487c5,null))['then'](function(_0x2ac2f9){if(_0x2ac2f9){_0x5e7c6c=_0x2ac2f9;_0x18083c[_0xbc38('0x3a')]=_[_0xbc38('0x4f')](db[_0xbc38('0x55')][_0xbc38('0x38')]);_0x18083c[_0xbc38('0x3c')]=_[_0xbc38('0x4f')](_0x2f5424[_0xbc38('0x3c')]);_0x18083c[_0xbc38('0x45')]=_[_0xbc38('0x3d')](_0x18083c['model'],_0x18083c['query']);_0x1a2976['attributes']=_[_0xbc38('0x3d')](_0x18083c[_0xbc38('0x3a')],qs['fields'](_0x2f5424['query']['fields']));_0x1a2976['attributes']=_0x1a2976[_0xbc38('0x3f')][_0xbc38('0x40')]?_0x1a2976[_0xbc38('0x3f')]:_0x18083c['model'];_0x1a2976[_0xbc38('0x56')]=qs[_0xbc38('0x44')](_0x2f5424['query']['sort']);_0x1a2976[_0xbc38('0x48')]=qs['filters'](_['pick'](_0x2f5424[_0xbc38('0x3c')],_0x18083c[_0xbc38('0x45')]));if(_0x2f5424['query']['filter']){_0x1a2976['where']=_['merge'](_0x1a2976[_0xbc38('0x48')],{'$or':_[_0xbc38('0x3b')](_0x1a2976[_0xbc38('0x3f')],function(_0x339b04){var _0x3f529f={};_0x3f529f[_0x339b04]={'$like':'%'+_0x2f5424['query'][_0xbc38('0x47')]+'%'};return _0x3f529f;})});}_0x1a2976=_[_0xbc38('0x49')]({},_0x1a2976,_0x2f5424[_0xbc38('0x4a')]);return _0x5e7c6c[_0xbc38('0x58')](_0x1a2976);}})[_0xbc38('0x33')](function(_0x133260){if(_0x133260){_0xdf06a2=_0x133260[_0xbc38('0x40')];if(!_0x2f5424[_0xbc38('0x3c')]['hasOwnProperty'](_0xbc38('0x42'))){_0x1a2976[_0xbc38('0x43')]=qs[_0xbc38('0x43')](_0x2f5424[_0xbc38('0x3c')][_0xbc38('0x43')]);_0x1a2976[_0xbc38('0x2a')]=qs[_0xbc38('0x2a')](_0x2f5424[_0xbc38('0x3c')][_0xbc38('0x2a')]);}return _0x5e7c6c[_0xbc38('0x58')](_0x1a2976);}})[_0xbc38('0x33')](function(_0x59598b){if(_0x59598b){return _0x59598b?{'count':_0xdf06a2,'rows':_0x59598b}:null;}})[_0xbc38('0x33')](respondWithResult(_0x2487c5,null))[_0xbc38('0x25')](handleError(_0x2487c5,null));};exports[_0xbc38('0x59')]=function(_0x59cd05,_0x1b0140,_0x3f2b93){var _0x593bf5={};var _0x409168={};var _0x49b327;var _0xf8e400;return db['DeskConfiguration'][_0xbc38('0x54')]({'where':{'id':_0x59cd05[_0xbc38('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1b0140,null))[_0xbc38('0x33')](function(_0x1e798e){if(_0x1e798e){_0x49b327=_0x1e798e;_0x409168[_0xbc38('0x3a')]=_[_0xbc38('0x4f')](db[_0xbc38('0x5a')][_0xbc38('0x38')]);_0x409168[_0xbc38('0x3c')]=_[_0xbc38('0x4f')](_0x59cd05['query']);_0x409168[_0xbc38('0x45')]=_[_0xbc38('0x3d')](_0x409168['model'],_0x409168['query']);_0x593bf5[_0xbc38('0x3f')]=_['intersection'](_0x409168[_0xbc38('0x3a')],qs[_0xbc38('0x3e')](_0x59cd05[_0xbc38('0x3c')]['fields']));_0x593bf5['attributes']=_0x593bf5[_0xbc38('0x3f')][_0xbc38('0x40')]?_0x593bf5['attributes']:_0x409168[_0xbc38('0x3a')];_0x593bf5[_0xbc38('0x56')]=qs[_0xbc38('0x44')](_0x59cd05[_0xbc38('0x3c')][_0xbc38('0x44')]);_0x593bf5['where']=qs[_0xbc38('0x45')](_['pick'](_0x59cd05[_0xbc38('0x3c')],_0x409168[_0xbc38('0x45')]));if(_0x59cd05[_0xbc38('0x3c')][_0xbc38('0x47')]){_0x593bf5['where']=_[_0xbc38('0x49')](_0x593bf5[_0xbc38('0x48')],{'$or':_['map'](_0x593bf5[_0xbc38('0x3f')],function(_0x3652c9){var _0x2a99a8={};_0x2a99a8[_0x3652c9]={'$like':'%'+_0x59cd05[_0xbc38('0x3c')][_0xbc38('0x47')]+'%'};return _0x2a99a8;})});}_0x593bf5=_['merge']({},_0x593bf5,_0x59cd05['options']);return _0x49b327[_0xbc38('0x59')](_0x593bf5);}})['then'](function(_0x5e24f3){if(_0x5e24f3){_0xf8e400=_0x5e24f3[_0xbc38('0x40')];if(!_0x59cd05['query'][_0xbc38('0x41')]('nolimit')){_0x593bf5['limit']=qs[_0xbc38('0x43')](_0x59cd05[_0xbc38('0x3c')][_0xbc38('0x43')]);_0x593bf5[_0xbc38('0x2a')]=qs[_0xbc38('0x2a')](_0x59cd05[_0xbc38('0x3c')][_0xbc38('0x2a')]);}return _0x49b327[_0xbc38('0x59')](_0x593bf5);}})[_0xbc38('0x33')](function(_0xe244fa){if(_0xe244fa){return _0xe244fa?{'count':_0xf8e400,'rows':_0xe244fa}:null;}})[_0xbc38('0x33')](respondWithResult(_0x1b0140,null))[_0xbc38('0x25')](handleError(_0x1b0140,null));};exports['setTags']=function(_0xbb51d4,_0x331867,_0x47c19a){if(_0xbb51d4['body']['id']){delete _0xbb51d4[_0xbc38('0x52')]['id'];}return db[_0xbc38('0x37')][_0xbc38('0x54')]({'where':{'id':_0xbb51d4[_0xbc38('0x4e')]['id']}})['then'](handleEntityNotFound(_0x331867,null))['then'](function(_0x13add7){if(_0x13add7){return _0x13add7[_0xbc38('0x5b')](_0xbb51d4[_0xbc38('0x52')]['ids']||[]);}return null;})['then'](respondWithResult(_0x331867,null))[_0xbc38('0x25')](handleError(_0x331867,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b131ff7..d213326 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 _0x7ca4=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x2a6625,_0xc55898){var _0x1a91c6=function(_0x5d6613){while(--_0x5d6613){_0x2a6625['push'](_0x2a6625['shift']());}};_0x1a91c6(++_0xc55898);}(_0x7ca4,0xf7));var _0x47ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7ca4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x47ca('0x0'));var util=require(_0x47ca('0x1'));var logger=require('../../config/logger')(_0x47ca('0x2'));var moment=require(_0x47ca('0x3'));var BPromise=require(_0x47ca('0x4'));var rp=require(_0x47ca('0x5'));var fs=require('fs');var path=require(_0x47ca('0x6'));var rimraf=require(_0x47ca('0x7'));var config=require(_0x47ca('0x8'));var attributes=require(_0x47ca('0x9'));module[_0x47ca('0xa')]=function(_0x19c1a4,_0x5429c9){return _0x19c1a4[_0x47ca('0xb')](_0x47ca('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18d2=['../../config/logger','api','moment','bluebird','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations'];(function(_0x41d552,_0x1e59db){var _0x45d056=function(_0x2813de){while(--_0x2813de){_0x41d552['push'](_0x41d552['shift']());}};_0x45d056(++_0x1e59db);}(_0x18d2,0x196));var _0x218d=function(_0x4ae3bb,_0x212b1c){_0x4ae3bb=_0x4ae3bb-0x0;var _0x224879=_0x18d2[_0x4ae3bb];return _0x224879;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x218d('0x0'))(_0x218d('0x1'));var moment=require(_0x218d('0x2'));var BPromise=require(_0x218d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x218d('0x4'));module['exports']=function(_0x3f5324,_0x62255d){return _0x3f5324['define'](_0x218d('0x5'),attributes,{'tableName':_0x218d('0x6'),'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 f964e41..cae8660 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 _0x4e61=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','DeskConfiguration,\x20%s,\x20%s'];(function(_0x167067,_0xd44da3){var _0x2fa31f=function(_0x5ac479){while(--_0x5ac479){_0x167067['push'](_0x167067['shift']());}};_0x2fa31f(++_0xd44da3);}(_0x4e61,0x8c));var _0x14e6=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0x4e61[_0x191f9d];return _0x58e60d;};'use strict';var _=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var moment=require(_0x14e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14e6('0x3'));var db=require(_0x14e6('0x4'))['db'];var utils=require(_0x14e6('0x5'));var logger=require(_0x14e6('0x6'))(_0x14e6('0x7'));var config=require(_0x14e6('0x8'));var jayson=require(_0x14e6('0x9'));var client=jayson[_0x14e6('0xa')][_0x14e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9f9c31,_0x2a5bc1,_0x91ca48){return new BPromise(function(_0x34b4eb,_0x1200e5){return client[_0x14e6('0xc')](_0x9f9c31,_0x91ca48)[_0x14e6('0xd')](function(_0x17eeed){logger[_0x14e6('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x2a5bc1,_0x14e6('0xf'));logger[_0x14e6('0x10')](_0x14e6('0x11'),_0x2a5bc1,_0x14e6('0xf'),JSON['stringify'](_0x17eeed));if(_0x17eeed['error']){if(_0x17eeed['error']['code']===0x1f4){logger[_0x14e6('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x2a5bc1,_0x17eeed['error'][_0x14e6('0x13')]);return _0x1200e5(_0x17eeed[_0x14e6('0x12')][_0x14e6('0x13')]);}logger['error'](_0x14e6('0x14'),_0x2a5bc1,_0x17eeed[_0x14e6('0x12')][_0x14e6('0x13')]);return _0x34b4eb(_0x17eeed[_0x14e6('0x12')][_0x14e6('0x13')]);}else{logger['info'](_0x14e6('0x14'),_0x2a5bc1,_0x14e6('0xf'));_0x34b4eb(_0x17eeed[_0x14e6('0x15')][_0x14e6('0x13')]);}})[_0x14e6('0x16')](function(_0x4d6d42){logger[_0x14e6('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x2a5bc1,_0x4d6d42);_0x1200e5(_0x4d6d42);});});} \ No newline at end of file +var _0xce3a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2fd65a,_0x1c5e5e){var _0x24a0f5=function(_0x54fdd5){while(--_0x54fdd5){_0x2fd65a['push'](_0x2fd65a['shift']());}};_0x24a0f5(++_0x1c5e5e);}(_0xce3a,0x194));var _0xace3=function(_0x3349e7,_0x3815a3){_0x3349e7=_0x3349e7-0x0;var _0x34745e=_0xce3a[_0x3349e7];return _0x34745e;};'use strict';var _=require(_0xace3('0x0'));var util=require(_0xace3('0x1'));var moment=require(_0xace3('0x2'));var BPromise=require(_0xace3('0x3'));var rs=require(_0xace3('0x4'));var fs=require('fs');var Redis=require(_0xace3('0x5'));var db=require(_0xace3('0x6'))['db'];var utils=require(_0xace3('0x7'));var logger=require(_0xace3('0x8'))(_0xace3('0x9'));var config=require(_0xace3('0xa'));var jayson=require(_0xace3('0xb'));var client=jayson['client'][_0xace3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d4ebc,_0x4d5360,_0x22f00a){return new BPromise(function(_0x4e27ad,_0x3baa73){return client['request'](_0x3d4ebc,_0x22f00a)[_0xace3('0xd')](function(_0x104ce){logger[_0xace3('0xe')](_0xace3('0xf'),_0x4d5360,_0xace3('0x10'));logger[_0xace3('0x11')](_0xace3('0x12'),_0x4d5360,_0xace3('0x10'),JSON['stringify'](_0x104ce));if(_0x104ce['error']){if(_0x104ce['error'][_0xace3('0x13')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4d5360,_0x104ce[_0xace3('0x14')]['message']);return _0x3baa73(_0x104ce[_0xace3('0x14')]['message']);}logger[_0xace3('0x14')](_0xace3('0xf'),_0x4d5360,_0x104ce[_0xace3('0x14')]['message']);return _0x4e27ad(_0x104ce[_0xace3('0x14')][_0xace3('0x15')]);}else{logger[_0xace3('0xe')](_0xace3('0xf'),_0x4d5360,'request\x20sent');_0x4e27ad(_0x104ce[_0xace3('0x16')][_0xace3('0x15')]);}})[_0xace3('0x17')](function(_0x142bb6){logger['error'](_0xace3('0xf'),_0x4d5360,_0x142bb6);_0x3baa73(_0x142bb6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index da3b09c..1b0470f 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 _0xcb44=['multer','util','path','connect-timeout','express','Router','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports'];(function(_0x1185d5,_0x1abbd2){var _0x41d29c=function(_0x33c90e){while(--_0x33c90e){_0x1185d5['push'](_0x1185d5['shift']());}};_0x41d29c(++_0x1abbd2);}(_0xcb44,0x176));var _0x4cb4=function(_0x3e130f,_0x309c01){_0x3e130f=_0x3e130f-0x0;var _0xf4d530=_0xcb44[_0x3e130f];return _0xf4d530;};'use strict';var multer=require(_0x4cb4('0x0'));var util=require(_0x4cb4('0x1'));var path=require(_0x4cb4('0x2'));var timeout=require(_0x4cb4('0x3'));var express=require(_0x4cb4('0x4'));var router=express[_0x4cb4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4cb4('0x6'));router[_0x4cb4('0x7')]('/',auth[_0x4cb4('0x8')](),controller[_0x4cb4('0x9')]);router[_0x4cb4('0x7')](_0x4cb4('0xa'),auth[_0x4cb4('0x8')](),controller[_0x4cb4('0xb')]);router['post']('/',auth[_0x4cb4('0x8')](),controller[_0x4cb4('0xc')]);router[_0x4cb4('0xd')](_0x4cb4('0xa'),auth[_0x4cb4('0x8')](),controller['update']);router[_0x4cb4('0xe')](_0x4cb4('0xa'),auth[_0x4cb4('0x8')](),controller[_0x4cb4('0xf')]);module[_0x4cb4('0x10')]=router; \ No newline at end of file +var _0xca2d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','put','delete','destroy','exports','multer','util','path'];(function(_0x2394ca,_0x238f6b){var _0x138889=function(_0x3cd660){while(--_0x3cd660){_0x2394ca['push'](_0x2394ca['shift']());}};_0x138889(++_0x238f6b);}(_0xca2d,0xb8));var _0xdca2=function(_0x268cbc,_0x2bece3){_0x268cbc=_0x268cbc-0x0;var _0x2f3302=_0xca2d[_0x268cbc];return _0x2f3302;};'use strict';var multer=require(_0xdca2('0x0'));var util=require(_0xdca2('0x1'));var path=require(_0xdca2('0x2'));var timeout=require(_0xdca2('0x3'));var express=require(_0xdca2('0x4'));var router=express[_0xdca2('0x5')]();var auth=require(_0xdca2('0x6'));var interaction=require(_0xdca2('0x7'));var config=require(_0xdca2('0x8'));var controller=require('./intDeskField.controller');router[_0xdca2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdca2('0xa'),auth['isAuthenticated'](),controller[_0xdca2('0xb')]);router['post']('/',auth[_0xdca2('0xc')](),controller['create']);router[_0xdca2('0xd')](_0xdca2('0xa'),auth[_0xdca2('0xc')](),controller['update']);router[_0xdca2('0xe')](_0xdca2('0xa'),auth[_0xdca2('0xc')](),controller[_0xdca2('0xf')]);module[_0xdca2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index edb88d3..4e59cf4 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 _0x63cd=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x44c0c2,_0x29d866){var _0x5b2eb8=function(_0x370296){while(--_0x370296){_0x44c0c2['push'](_0x44c0c2['shift']());}};_0x5b2eb8(++_0x29d866);}(_0x63cd,0x6d));var _0xd63c=function(_0x426cc7,_0x2716d0){_0x426cc7=_0x426cc7-0x0;var _0xde39c3=_0x63cd[_0x426cc7];return _0xde39c3;};'use strict';var Sequelize=require(_0xd63c('0x0'));module[_0xd63c('0x1')]={'type':{'type':Sequelize[_0xd63c('0x2')](_0xd63c('0x3'),_0xd63c('0x4'),_0xd63c('0x5'),_0xd63c('0x6')),'defaultValue':_0xd63c('0x3')},'content':{'type':Sequelize[_0xd63c('0x7')]},'key':{'type':Sequelize[_0xd63c('0x7')]},'keyType':{'type':Sequelize[_0xd63c('0x2')](_0xd63c('0x3'),_0xd63c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xd63c('0x7')]},'idField':{'type':Sequelize[_0xd63c('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd63c('0x7')]}}; \ No newline at end of file +var _0xfb40=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x4d48b7,_0x4da22c){var _0x1c1c57=function(_0x147f7c){while(--_0x147f7c){_0x4d48b7['push'](_0x4d48b7['shift']());}};_0x1c1c57(++_0x4da22c);}(_0xfb40,0x10d));var _0x0fb4=function(_0x129c48,_0x3b8ade){_0x129c48=_0x129c48-0x0;var _0x4e56e3=_0xfb40[_0x129c48];return _0x4e56e3;};'use strict';var Sequelize=require(_0x0fb4('0x0'));module['exports']={'type':{'type':Sequelize[_0x0fb4('0x1')](_0x0fb4('0x2'),_0x0fb4('0x3'),'customVariable',_0x0fb4('0x4')),'defaultValue':_0x0fb4('0x2')},'content':{'type':Sequelize[_0x0fb4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0fb4('0x1')](_0x0fb4('0x2'),_0x0fb4('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0fb4('0x5')]},'nameField':{'type':Sequelize[_0x0fb4('0x5')]},'customField':{'type':Sequelize[_0x0fb4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0fb4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ad47923..3160eea 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 _0xdb22=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','length','catch','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x133441,_0x1ddbd7){var _0x4082b4=function(_0x1ad687){while(--_0x1ad687){_0x133441['push'](_0x133441['shift']());}};_0x4082b4(++_0x1ddbd7);}(_0xdb22,0x1d7));var _0x2db2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb22[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2db2('0x0'));var rimraf=require(_0x2db2('0x1'));var zipdir=require(_0x2db2('0x2'));var jsonpatch=require(_0x2db2('0x3'));var rp=require(_0x2db2('0x4'));var moment=require(_0x2db2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2db2('0x6'));var util=require(_0x2db2('0x7'));var path=require(_0x2db2('0x8'));var sox=require('sox');var csv=require(_0x2db2('0x9'));var ejs=require(_0x2db2('0xa'));var fs=require('fs');var _=require(_0x2db2('0xb'));var squel=require(_0x2db2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2db2('0x9'));var querystring=require(_0x2db2('0xd'));var Papa=require('papaparse');var Redis=require(_0x2db2('0xe'));var authService=require(_0x2db2('0xf'));var qs=require(_0x2db2('0x10'));var as=require(_0x2db2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2db2('0x12'))(_0x2db2('0x13'));var utils=require(_0x2db2('0x14'));var config=require(_0x2db2('0x15'));var licenseUtil=require(_0x2db2('0x16'));var db=require(_0x2db2('0x17'))['db'];function respondWithStatusCode(_0x473a17,_0x25df7a){_0x25df7a=_0x25df7a||0xcc;return function(_0x5a5aae){if(_0x5a5aae){return _0x473a17[_0x2db2('0x18')](_0x25df7a);}return _0x473a17['status'](_0x25df7a)[_0x2db2('0x19')]();};}function respondWithResult(_0xdeb3c,_0x3237eb){_0x3237eb=_0x3237eb||0xc8;return function(_0x16d017){if(_0x16d017){return _0xdeb3c['status'](_0x3237eb)[_0x2db2('0x1a')](_0x16d017);}};}function respondWithFilteredResult(_0x4b7868,_0x26a0a5){return function(_0x1b8517){if(_0x1b8517){var _0x4f73ab=_0x1b8517[_0x2db2('0x1b')],_0x33bcb7=_0x26a0a5[_0x2db2('0x1c')],_0x3a8f03=_0x26a0a5[_0x2db2('0x1c')]+_0x26a0a5[_0x2db2('0x1d')],_0x35cb1b;if(_0x3a8f03>=_0x4f73ab){_0x3a8f03=_0x4f73ab;_0x35cb1b=0xc8;}else{_0x35cb1b=0xce;}_0x4b7868[_0x2db2('0x1e')](_0x35cb1b);return _0x4b7868[_0x2db2('0x1f')]('Content-Range',_0x33bcb7+'-'+_0x3a8f03+'/'+_0x4f73ab)['json'](_0x1b8517);}return null;};}function patchUpdates(_0x585ceb){return function(_0x4c1b0d){try{jsonpatch[_0x2db2('0x20')](_0x4c1b0d,_0x585ceb,!![]);}catch(_0xaef10a){return BPromise[_0x2db2('0x21')](_0xaef10a);}return _0x4c1b0d[_0x2db2('0x22')]();};}function saveUpdates(_0xb4e96,_0x495628){return function(_0x11de7a){if(_0x11de7a){return _0x11de7a[_0x2db2('0x23')](_0xb4e96)['then'](function(_0x393b0e){return _0x393b0e;});}return null;};}function removeEntity(_0xb16f16,_0x1f68d8){return function(_0x2cd221){if(_0x2cd221){return _0x2cd221['destroy']()[_0x2db2('0x24')](function(){_0xb16f16[_0x2db2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x209e94,_0x23034f){return function(_0x1301e5){if(!_0x1301e5){_0x209e94[_0x2db2('0x18')](0x194);}return _0x1301e5;};}function handleError(_0x450251,_0x344749){_0x344749=_0x344749||0x1f4;return function(_0x4758f8){logger[_0x2db2('0x25')](_0x4758f8[_0x2db2('0x26')]);if(_0x4758f8['name']){delete _0x4758f8[_0x2db2('0x27')];}_0x450251[_0x2db2('0x1e')](_0x344749)[_0x2db2('0x28')](_0x4758f8);};}exports[_0x2db2('0x29')]=function(_0x56c187,_0x1fda22){var _0x491666={},_0x20f2d6={},_0x4aeaa7={'count':0x0,'rows':[]};var _0x52a828=_[_0x2db2('0x2a')](db[_0x2db2('0x2b')][_0x2db2('0x2c')],function(_0xebb3c7){return{'name':_0xebb3c7['fieldName'],'type':_0xebb3c7[_0x2db2('0x2d')][_0x2db2('0x2e')]};});_0x20f2d6['model']=_[_0x2db2('0x2a')](_0x52a828,_0x2db2('0x27'));_0x20f2d6[_0x2db2('0x2f')]=_['keys'](_0x56c187[_0x2db2('0x2f')]);_0x20f2d6[_0x2db2('0x30')]=_[_0x2db2('0x31')](_0x20f2d6[_0x2db2('0x32')],_0x20f2d6['query']);_0x491666[_0x2db2('0x33')]=_['intersection'](_0x20f2d6[_0x2db2('0x32')],qs[_0x2db2('0x34')](_0x56c187[_0x2db2('0x2f')][_0x2db2('0x34')]));_0x491666[_0x2db2('0x33')]=_0x491666[_0x2db2('0x33')]['length']?_0x491666[_0x2db2('0x33')]:_0x20f2d6['model'];if(!_0x56c187[_0x2db2('0x2f')]['hasOwnProperty']('nolimit')){_0x491666[_0x2db2('0x1d')]=qs['limit'](_0x56c187[_0x2db2('0x2f')][_0x2db2('0x1d')]);_0x491666[_0x2db2('0x1c')]=qs['offset'](_0x56c187[_0x2db2('0x2f')][_0x2db2('0x1c')]);}_0x491666[_0x2db2('0x35')]=qs[_0x2db2('0x36')](_0x56c187[_0x2db2('0x2f')][_0x2db2('0x36')]);_0x491666[_0x2db2('0x37')]=qs[_0x2db2('0x30')](_[_0x2db2('0x38')](_0x56c187[_0x2db2('0x2f')],_0x20f2d6[_0x2db2('0x30')]),_0x52a828);if(_0x56c187[_0x2db2('0x2f')][_0x2db2('0x39')]){_0x491666['where']=_[_0x2db2('0x3a')](_0x491666[_0x2db2('0x37')],{'$or':_[_0x2db2('0x2a')](_0x52a828,function(_0x1a2182){if(_0x1a2182[_0x2db2('0x2d')]!==_0x2db2('0x3b')){var _0x87e463={};_0x87e463[_0x1a2182[_0x2db2('0x27')]]={'$like':'%'+_0x56c187[_0x2db2('0x2f')][_0x2db2('0x39')]+'%'};return _0x87e463;}})});}_0x491666=_[_0x2db2('0x3a')]({},_0x491666,_0x56c187[_0x2db2('0x3c')]);var _0x4a9e3d={'where':_0x491666[_0x2db2('0x37')]};return db[_0x2db2('0x2b')][_0x2db2('0x1b')](_0x4a9e3d)[_0x2db2('0x24')](function(_0x5e2185){_0x4aeaa7[_0x2db2('0x1b')]=_0x5e2185;if(_0x56c187[_0x2db2('0x2f')][_0x2db2('0x3d')]){_0x491666[_0x2db2('0x3e')]=[{'all':!![]}];}return db[_0x2db2('0x2b')]['findAll'](_0x491666);})['then'](function(_0x18a2e4){_0x4aeaa7['rows']=_0x18a2e4;return _0x4aeaa7;})[_0x2db2('0x24')](respondWithFilteredResult(_0x1fda22,_0x491666))['catch'](handleError(_0x1fda22,null));};exports['show']=function(_0x4ef233,_0x1ff452){var _0x14cf26={'raw':!![],'where':{'id':_0x4ef233[_0x2db2('0x3f')]['id']}},_0x59764f={};_0x59764f[_0x2db2('0x32')]=_['keys'](db[_0x2db2('0x2b')][_0x2db2('0x2c')]);_0x59764f[_0x2db2('0x2f')]=_['keys'](_0x4ef233[_0x2db2('0x2f')]);_0x59764f['filters']=_['intersection'](_0x59764f[_0x2db2('0x32')],_0x59764f[_0x2db2('0x2f')]);_0x14cf26[_0x2db2('0x33')]=_[_0x2db2('0x31')](_0x59764f[_0x2db2('0x32')],qs[_0x2db2('0x34')](_0x4ef233['query'][_0x2db2('0x34')]));_0x14cf26['attributes']=_0x14cf26[_0x2db2('0x33')][_0x2db2('0x40')]?_0x14cf26[_0x2db2('0x33')]:_0x59764f[_0x2db2('0x32')];if(_0x4ef233[_0x2db2('0x2f')][_0x2db2('0x3d')]){_0x14cf26[_0x2db2('0x3e')]=[{'all':!![]}];}_0x14cf26=_[_0x2db2('0x3a')]({},_0x14cf26,_0x4ef233[_0x2db2('0x3c')]);return db[_0x2db2('0x2b')]['find'](_0x14cf26)['then'](handleEntityNotFound(_0x1ff452,null))[_0x2db2('0x24')](respondWithResult(_0x1ff452,null))[_0x2db2('0x41')](handleError(_0x1ff452,null));};exports[_0x2db2('0x42')]=function(_0x412321,_0x159322){return db['DeskField'][_0x2db2('0x42')](_0x412321['body'],{})[_0x2db2('0x24')](respondWithResult(_0x159322,0xc9))[_0x2db2('0x41')](handleError(_0x159322,null));};exports[_0x2db2('0x23')]=function(_0xb01872,_0x47e183){if(_0xb01872[_0x2db2('0x43')]['id']){delete _0xb01872[_0x2db2('0x43')]['id'];}return db['DeskField']['find']({'where':{'id':_0xb01872[_0x2db2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x47e183,null))[_0x2db2('0x24')](saveUpdates(_0xb01872[_0x2db2('0x43')],null))[_0x2db2('0x24')](respondWithResult(_0x47e183,null))[_0x2db2('0x41')](handleError(_0x47e183,null));};exports[_0x2db2('0x44')]=function(_0x27c3ee,_0x3edb8b){return db[_0x2db2('0x2b')][_0x2db2('0x45')]({'where':{'id':_0x27c3ee[_0x2db2('0x3f')]['id']}})[_0x2db2('0x24')](handleEntityNotFound(_0x3edb8b,null))[_0x2db2('0x24')](removeEntity(_0x3edb8b,null))[_0x2db2('0x41')](handleError(_0x3edb8b,null));}; \ No newline at end of file +var _0xb38d=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','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/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type'];(function(_0x6a37a6,_0x137b08){var _0x56410f=function(_0x4e29cc){while(--_0x4e29cc){_0x6a37a6['push'](_0x6a37a6['shift']());}};_0x56410f(++_0x137b08);}(_0xb38d,0x103));var _0xdb38=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xb38d[_0x1f99a0];return _0x1e0849;};'use strict';var pdf=require(_0xdb38('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb38('0x1'));var zipdir=require(_0xdb38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdb38('0x3'));var BPromise=require(_0xdb38('0x4'));var Mustache=require(_0xdb38('0x5'));var util=require(_0xdb38('0x6'));var path=require(_0xdb38('0x7'));var sox=require(_0xdb38('0x8'));var csv=require('to-csv');var ejs=require(_0xdb38('0x9'));var fs=require('fs');var _=require(_0xdb38('0xa'));var squel=require('squel');var crypto=require(_0xdb38('0xb'));var jsforce=require(_0xdb38('0xc'));var deskjs=require(_0xdb38('0xd'));var toCsv=require(_0xdb38('0xe'));var querystring=require(_0xdb38('0xf'));var Papa=require(_0xdb38('0x10'));var Redis=require('ioredis');var authService=require(_0xdb38('0x11'));var qs=require(_0xdb38('0x12'));var as=require(_0xdb38('0x13'));var hardwareService=require(_0xdb38('0x14'));var logger=require(_0xdb38('0x15'))(_0xdb38('0x16'));var utils=require(_0xdb38('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdb38('0x18'));var db=require(_0xdb38('0x19'))['db'];function respondWithStatusCode(_0xab0f14,_0x4339de){_0x4339de=_0x4339de||0xcc;return function(_0x28f8ad){if(_0x28f8ad){return _0xab0f14['sendStatus'](_0x4339de);}return _0xab0f14[_0xdb38('0x1a')](_0x4339de)[_0xdb38('0x1b')]();};}function respondWithResult(_0x30ce52,_0x25396a){_0x25396a=_0x25396a||0xc8;return function(_0x308f27){if(_0x308f27){return _0x30ce52[_0xdb38('0x1a')](_0x25396a)[_0xdb38('0x1c')](_0x308f27);}};}function respondWithFilteredResult(_0x54b8fb,_0x596031){return function(_0x5393c8){if(_0x5393c8){var _0x2f4a65=_0x5393c8[_0xdb38('0x1d')],_0x191f1a=_0x596031['offset'],_0x1167a9=_0x596031[_0xdb38('0x1e')]+_0x596031['limit'],_0x22909e;if(_0x1167a9>=_0x2f4a65){_0x1167a9=_0x2f4a65;_0x22909e=0xc8;}else{_0x22909e=0xce;}_0x54b8fb[_0xdb38('0x1a')](_0x22909e);return _0x54b8fb[_0xdb38('0x1f')](_0xdb38('0x20'),_0x191f1a+'-'+_0x1167a9+'/'+_0x2f4a65)[_0xdb38('0x1c')](_0x5393c8);}return null;};}function patchUpdates(_0x5616d){return function(_0x5540e9){try{jsonpatch[_0xdb38('0x21')](_0x5540e9,_0x5616d,!![]);}catch(_0x1e3557){return BPromise[_0xdb38('0x22')](_0x1e3557);}return _0x5540e9[_0xdb38('0x23')]();};}function saveUpdates(_0x27701a,_0x197048){return function(_0x4ee751){if(_0x4ee751){return _0x4ee751[_0xdb38('0x24')](_0x27701a)[_0xdb38('0x25')](function(_0x498455){return _0x498455;});}return null;};}function removeEntity(_0x4c35fa,_0x420ae3){return function(_0x186ff5){if(_0x186ff5){return _0x186ff5[_0xdb38('0x26')]()[_0xdb38('0x25')](function(){_0x4c35fa[_0xdb38('0x1a')](0xcc)[_0xdb38('0x1b')]();});}};}function handleEntityNotFound(_0x3d75da,_0x3e199c){return function(_0x523c7e){if(!_0x523c7e){_0x3d75da[_0xdb38('0x27')](0x194);}return _0x523c7e;};}function handleError(_0x2ccbb0,_0x45d5c5){_0x45d5c5=_0x45d5c5||0x1f4;return function(_0x1a8676){logger['error'](_0x1a8676[_0xdb38('0x28')]);if(_0x1a8676[_0xdb38('0x29')]){delete _0x1a8676['name'];}_0x2ccbb0[_0xdb38('0x1a')](_0x45d5c5)[_0xdb38('0x2a')](_0x1a8676);};}exports[_0xdb38('0x2b')]=function(_0x4ce60f,_0x15e800){var _0x5f57d5={},_0x1c6e77={},_0x38f352={'count':0x0,'rows':[]};var _0x24099d=_[_0xdb38('0x2c')](db[_0xdb38('0x2d')][_0xdb38('0x2e')],function(_0x42d717){return{'name':_0x42d717[_0xdb38('0x2f')],'type':_0x42d717[_0xdb38('0x30')][_0xdb38('0x31')]};});_0x1c6e77['model']=_[_0xdb38('0x2c')](_0x24099d,_0xdb38('0x29'));_0x1c6e77[_0xdb38('0x32')]=_[_0xdb38('0x33')](_0x4ce60f[_0xdb38('0x32')]);_0x1c6e77[_0xdb38('0x34')]=_[_0xdb38('0x35')](_0x1c6e77[_0xdb38('0x36')],_0x1c6e77[_0xdb38('0x32')]);_0x5f57d5[_0xdb38('0x37')]=_['intersection'](_0x1c6e77[_0xdb38('0x36')],qs[_0xdb38('0x38')](_0x4ce60f[_0xdb38('0x32')][_0xdb38('0x38')]));_0x5f57d5[_0xdb38('0x37')]=_0x5f57d5[_0xdb38('0x37')][_0xdb38('0x39')]?_0x5f57d5[_0xdb38('0x37')]:_0x1c6e77[_0xdb38('0x36')];if(!_0x4ce60f[_0xdb38('0x32')][_0xdb38('0x3a')](_0xdb38('0x3b'))){_0x5f57d5[_0xdb38('0x3c')]=qs[_0xdb38('0x3c')](_0x4ce60f[_0xdb38('0x32')][_0xdb38('0x3c')]);_0x5f57d5[_0xdb38('0x1e')]=qs[_0xdb38('0x1e')](_0x4ce60f[_0xdb38('0x32')][_0xdb38('0x1e')]);}_0x5f57d5[_0xdb38('0x3d')]=qs[_0xdb38('0x3e')](_0x4ce60f['query'][_0xdb38('0x3e')]);_0x5f57d5['where']=qs[_0xdb38('0x34')](_[_0xdb38('0x3f')](_0x4ce60f[_0xdb38('0x32')],_0x1c6e77[_0xdb38('0x34')]),_0x24099d);if(_0x4ce60f[_0xdb38('0x32')][_0xdb38('0x40')]){_0x5f57d5['where']=_[_0xdb38('0x41')](_0x5f57d5[_0xdb38('0x42')],{'$or':_[_0xdb38('0x2c')](_0x24099d,function(_0x3721d2){if(_0x3721d2['type']!==_0xdb38('0x43')){var _0x1e537d={};_0x1e537d[_0x3721d2[_0xdb38('0x29')]]={'$like':'%'+_0x4ce60f[_0xdb38('0x32')][_0xdb38('0x40')]+'%'};return _0x1e537d;}})});}_0x5f57d5=_['merge']({},_0x5f57d5,_0x4ce60f[_0xdb38('0x44')]);var _0x2f2b1d={'where':_0x5f57d5[_0xdb38('0x42')]};return db[_0xdb38('0x2d')][_0xdb38('0x1d')](_0x2f2b1d)['then'](function(_0xed2bc4){_0x38f352['count']=_0xed2bc4;if(_0x4ce60f[_0xdb38('0x32')]['includeAll']){_0x5f57d5[_0xdb38('0x45')]=[{'all':!![]}];}return db[_0xdb38('0x2d')]['findAll'](_0x5f57d5);})['then'](function(_0x3d145f){_0x38f352[_0xdb38('0x46')]=_0x3d145f;return _0x38f352;})['then'](respondWithFilteredResult(_0x15e800,_0x5f57d5))[_0xdb38('0x47')](handleError(_0x15e800,null));};exports[_0xdb38('0x48')]=function(_0x1c5408,_0x5d6985){var _0x2c3f30={'raw':!![],'where':{'id':_0x1c5408[_0xdb38('0x49')]['id']}},_0x45fc56={};_0x45fc56[_0xdb38('0x36')]=_[_0xdb38('0x33')](db[_0xdb38('0x2d')]['rawAttributes']);_0x45fc56[_0xdb38('0x32')]=_[_0xdb38('0x33')](_0x1c5408['query']);_0x45fc56[_0xdb38('0x34')]=_[_0xdb38('0x35')](_0x45fc56['model'],_0x45fc56['query']);_0x2c3f30['attributes']=_['intersection'](_0x45fc56[_0xdb38('0x36')],qs['fields'](_0x1c5408[_0xdb38('0x32')][_0xdb38('0x38')]));_0x2c3f30[_0xdb38('0x37')]=_0x2c3f30['attributes'][_0xdb38('0x39')]?_0x2c3f30['attributes']:_0x45fc56[_0xdb38('0x36')];if(_0x1c5408[_0xdb38('0x32')]['includeAll']){_0x2c3f30[_0xdb38('0x45')]=[{'all':!![]}];}_0x2c3f30=_[_0xdb38('0x41')]({},_0x2c3f30,_0x1c5408['options']);return db[_0xdb38('0x2d')][_0xdb38('0x4a')](_0x2c3f30)['then'](handleEntityNotFound(_0x5d6985,null))[_0xdb38('0x25')](respondWithResult(_0x5d6985,null))[_0xdb38('0x47')](handleError(_0x5d6985,null));};exports[_0xdb38('0x4b')]=function(_0x2ccead,_0xc675b6){return db[_0xdb38('0x2d')][_0xdb38('0x4b')](_0x2ccead['body'],{})[_0xdb38('0x25')](respondWithResult(_0xc675b6,0xc9))[_0xdb38('0x47')](handleError(_0xc675b6,null));};exports[_0xdb38('0x24')]=function(_0x7e3a7,_0x29336d){if(_0x7e3a7[_0xdb38('0x4c')]['id']){delete _0x7e3a7[_0xdb38('0x4c')]['id'];}return db[_0xdb38('0x2d')][_0xdb38('0x4a')]({'where':{'id':_0x7e3a7[_0xdb38('0x49')]['id']}})[_0xdb38('0x25')](handleEntityNotFound(_0x29336d,null))[_0xdb38('0x25')](saveUpdates(_0x7e3a7['body'],null))[_0xdb38('0x25')](respondWithResult(_0x29336d,null))[_0xdb38('0x47')](handleError(_0x29336d,null));};exports[_0xdb38('0x26')]=function(_0x211e0f,_0x100281){return db['DeskField'][_0xdb38('0x4a')]({'where':{'id':_0x211e0f[_0xdb38('0x49')]['id']}})[_0xdb38('0x25')](handleEntityNotFound(_0x100281,null))[_0xdb38('0x25')](removeEntity(_0x100281,null))[_0xdb38('0x47')](handleError(_0x100281,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7e17961..7e536b6 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 _0x9583=['../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','rimraf'];(function(_0x2f77d8,_0x2d6ea5){var _0x2c995b=function(_0x5b35aa){while(--_0x5b35aa){_0x2f77d8['push'](_0x2f77d8['shift']());}};_0x2c995b(++_0x2d6ea5);}(_0x9583,0xcb));var _0x3958=function(_0x436073,_0x11b1d6){_0x436073=_0x436073-0x0;var _0x564463=_0x9583[_0x436073];return _0x564463;};'use strict';var _=require(_0x3958('0x0'));var util=require(_0x3958('0x1'));var logger=require(_0x3958('0x2'))('api');var moment=require(_0x3958('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3958('0x4'));var config=require(_0x3958('0x5'));var attributes=require(_0x3958('0x6'));module[_0x3958('0x7')]=function(_0x315f38,_0x5f5b59){return _0x315f38[_0x3958('0x8')](_0x3958('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3958('0xa'),'fields':[_0x3958('0xb'),_0x3958('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbabd=['api','moment','bluebird','request-promise','../../config/environment','exports','define','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3adadc,_0x4e52f4){var _0x149b37=function(_0x9a3fe2){while(--_0x9a3fe2){_0x3adadc['push'](_0x3adadc['shift']());}};_0x149b37(++_0x4e52f4);}(_0xbabd,0x8c));var _0xdbab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbabd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbab('0x0'));var util=require(_0xdbab('0x1'));var logger=require(_0xdbab('0x2'))(_0xdbab('0x3'));var moment=require(_0xdbab('0x4'));var BPromise=require(_0xdbab('0x5'));var rp=require(_0xdbab('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdbab('0x7'));var attributes=require('./intDeskField.attributes');module[_0xdbab('0x8')]=function(_0x4ad9ce,_0x358d3d){return _0x4ad9ce[_0xdbab('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xdbab('0xa'),'fields':[_0xdbab('0xb'),_0xdbab('0xc')],'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 defd397..4e7f6d1 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 _0x26f3=['jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x26f3,0x1c0));var _0x326f=function(_0x1233d2,_0x5416f4){_0x1233d2=_0x1233d2-0x0;var _0x22759e=_0x26f3[_0x1233d2];return _0x22759e;};'use strict';var _=require(_0x326f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x326f('0x1'));var rs=require(_0x326f('0x2'));var fs=require('fs');var Redis=require(_0x326f('0x3'));var db=require(_0x326f('0x4'))['db'];var utils=require(_0x326f('0x5'));var logger=require('../../config/logger')(_0x326f('0x6'));var config=require(_0x326f('0x7'));var jayson=require(_0x326f('0x8'));var client=jayson[_0x326f('0x9')][_0x326f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce0b4,_0x193e19,_0x14e5c4){return new BPromise(function(_0x552e6c,_0x15fa2b){return client[_0x326f('0xb')](_0x2ce0b4,_0x14e5c4)[_0x326f('0xc')](function(_0x37d9b9){logger['info'](_0x326f('0xd'),_0x193e19,_0x326f('0xe'));logger[_0x326f('0xf')](_0x326f('0x10'),_0x193e19,_0x326f('0xe'),JSON[_0x326f('0x11')](_0x37d9b9));if(_0x37d9b9[_0x326f('0x12')]){if(_0x37d9b9[_0x326f('0x12')][_0x326f('0x13')]===0x1f4){logger[_0x326f('0x12')](_0x326f('0xd'),_0x193e19,_0x37d9b9[_0x326f('0x12')][_0x326f('0x14')]);return _0x15fa2b(_0x37d9b9[_0x326f('0x12')][_0x326f('0x14')]);}logger[_0x326f('0x12')](_0x326f('0xd'),_0x193e19,_0x37d9b9[_0x326f('0x12')][_0x326f('0x14')]);return _0x552e6c(_0x37d9b9[_0x326f('0x12')]['message']);}else{logger[_0x326f('0x15')](_0x326f('0xd'),_0x193e19,_0x326f('0xe'));_0x552e6c(_0x37d9b9[_0x326f('0x16')][_0x326f('0x14')]);}})[_0x326f('0x17')](function(_0x1b3714){logger[_0x326f('0x12')](_0x326f('0xd'),_0x193e19,_0x1b3714);_0x15fa2b(_0x1b3714);});});} \ No newline at end of file +var _0x7327=['info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7327,0x66));var _0x7732=function(_0x5b6c67,_0xebc0af){_0x5b6c67=_0x5b6c67-0x0;var _0x5309f6=_0x7327[_0x5b6c67];return _0x5309f6;};'use strict';var _=require(_0x7732('0x0'));var util=require(_0x7732('0x1'));var moment=require(_0x7732('0x2'));var BPromise=require(_0x7732('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7732('0x4'))['db'];var utils=require(_0x7732('0x5'));var logger=require(_0x7732('0x6'))(_0x7732('0x7'));var config=require(_0x7732('0x8'));var jayson=require(_0x7732('0x9'));var client=jayson[_0x7732('0xa')][_0x7732('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe217cb,_0x34a0e0,_0x3e0aaf){return new BPromise(function(_0x58a609,_0x3b0df0){return client[_0x7732('0xc')](_0xe217cb,_0x3e0aaf)['then'](function(_0x41bfe3){logger[_0x7732('0xd')](_0x7732('0xe'),_0x34a0e0,_0x7732('0xf'));logger['debug'](_0x7732('0x10'),_0x34a0e0,_0x7732('0xf'),JSON[_0x7732('0x11')](_0x41bfe3));if(_0x41bfe3[_0x7732('0x12')]){if(_0x41bfe3[_0x7732('0x12')][_0x7732('0x13')]===0x1f4){logger[_0x7732('0x12')](_0x7732('0xe'),_0x34a0e0,_0x41bfe3[_0x7732('0x12')][_0x7732('0x14')]);return _0x3b0df0(_0x41bfe3[_0x7732('0x12')][_0x7732('0x14')]);}logger[_0x7732('0x12')]('DeskField,\x20%s,\x20%s',_0x34a0e0,_0x41bfe3[_0x7732('0x12')][_0x7732('0x14')]);return _0x58a609(_0x41bfe3[_0x7732('0x12')]['message']);}else{logger[_0x7732('0xd')](_0x7732('0xe'),_0x34a0e0,_0x7732('0xf'));_0x58a609(_0x41bfe3[_0x7732('0x15')][_0x7732('0x14')]);}})[_0x7732('0x16')](function(_0xf9309){logger[_0x7732('0x12')]('DeskField,\x20%s,\x20%s',_0x34a0e0,_0xf9309);_0x3b0df0(_0xf9309);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e109bc1..2156b78 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 _0xb10b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x595705,_0x36e346){var _0x4a6be6=function(_0x1f2f65){while(--_0x1f2f65){_0x595705['push'](_0x595705['shift']());}};_0x4a6be6(++_0x36e346);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e08ee,_0x45c038){_0x5e08ee=_0x5e08ee-0x0;var _0x3b1dcc=_0xb10b[_0x5e08ee];return _0x3b1dcc;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getFields']);router['post']('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router[_0xbb10('0x10')]('/:id/configurations',auth[_0xbb10('0x9')](),controller['addConfiguration']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0x5f2f=['/:id','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x30f327,_0x150885){var _0x26ecbe=function(_0x54749b){while(--_0x54749b){_0x30f327['push'](_0x30f327['shift']());}};_0x26ecbe(++_0x150885);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33bf32,_0x5a4756){_0x33bf32=_0x33bf32-0x0;var _0x35649b=_0x5f2f[_0x33bf32];return _0x35649b;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getConfigurations']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5f2('0xe')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x12')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x13')]);module[_0xf5f2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 31dfee2..60b6fb3 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 _0xb6c4=['sequelize','exports','STRING'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xb6c4,0xb4));var _0x4b6c=function(_0x27a5c1,_0x4bb1ac){_0x27a5c1=_0x27a5c1-0x0;var _0x563799=_0xb6c4[_0x27a5c1];return _0x563799;};'use strict';var Sequelize=require(_0x4b6c('0x0'));module[_0x4b6c('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4b6c('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4b6c('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4b6c('0x2')]},'serverUrl':{'type':Sequelize[_0x4b6c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4b6c('0x2')]}}; \ No newline at end of file +var _0x6dcb=['exports','STRING','sequelize'];(function(_0x5ac65e,_0x230239){var _0x2ae90a=function(_0x5268a1){while(--_0x5268a1){_0x5ac65e['push'](_0x5ac65e['shift']());}};_0x2ae90a(++_0x230239);}(_0x6dcb,0x10d));var _0xb6dc=function(_0x30e77d,_0x4e8d3e){_0x30e77d=_0x30e77d-0x0;var _0x2453ac=_0x6dcb[_0x30e77d];return _0x2453ac;};'use strict';var Sequelize=require(_0xb6dc('0x0'));module[_0xb6dc('0x1')]={'name':{'type':Sequelize[_0xb6dc('0x2')]},'username':{'type':Sequelize[_0xb6dc('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb6dc('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb6dc('0x2')]},'clientSecret':{'type':Sequelize[_0xb6dc('0x2')]},'serverUrl':{'type':Sequelize[_0xb6dc('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 725bcd3..f3d1821 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 _0x53ec=['api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','json','count','offset','set','Content-Range','apply','reject','end','sendStatus','stack','name','send','index','Dynamics365Account','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body','find','destroy','getConfigurations','Dynamics365Configuration','order','sort','pick','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','channel','Descriptions','Dynamics365Field','Subjects','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','slice','substring','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','OptionSet','true','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xd3cc19,_0x491934){var _0xf69125=function(_0x4c380e){while(--_0x4c380e){_0xd3cc19['push'](_0xd3cc19['shift']());}};_0xf69125(++_0x491934);}(_0x53ec,0x192));var _0xc53e=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x53ec[_0x27beea];return _0x122645;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var integrations=require(_0xc53e('0x17'));var jayson=require(_0xc53e('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c06cd,_0x19a772,_0x7cd798,_0x3d2e17){return new BPromise(function(_0x358ef3,_0x382e87){var _0x3dc2fa=_0x3d2e17||client;return _0x3dc2fa[_0xc53e('0x19')](_0x1c06cd,_0x7cd798)[_0xc53e('0x1a')](function(_0x2ad6eb){logger['info'](_0xc53e('0x1b'),_0x19a772,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x19a772,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x2ad6eb));if(_0x2ad6eb[_0xc53e('0x20')]){if(_0x2ad6eb[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x19a772,_0x2ad6eb[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x382e87(_0x2ad6eb[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x1b'),_0x19a772,_0x2ad6eb[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x358ef3(_0x2ad6eb[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x23')](_0xc53e('0x1b'),_0x19a772,_0xc53e('0x1c'));_0x358ef3(_0x2ad6eb['result']['message']);}})['catch'](function(_0x4f4304){logger[_0xc53e('0x20')](_0xc53e('0x1b'),_0x19a772,_0x4f4304);_0x382e87(_0x4f4304);});});}function respondWithStatusCode(_0x4015c8,_0x180811){_0x180811=_0x180811||0xcc;return function(_0x5009e1){if(_0x5009e1){return _0x4015c8['sendStatus'](_0x180811);}return _0x4015c8[_0xc53e('0x24')](_0x180811)['end']();};}function respondWithResult(_0x1ae55e,_0x3a5ce8){_0x3a5ce8=_0x3a5ce8||0xc8;return function(_0x443179){if(_0x443179){return _0x1ae55e[_0xc53e('0x24')](_0x3a5ce8)[_0xc53e('0x25')](_0x443179);}};}function respondWithFilteredResult(_0x4df8cf,_0x398e7a){return function(_0x4b9f6a){if(_0x4b9f6a){var _0x4d9a68=_0x4b9f6a[_0xc53e('0x26')],_0x5c65d3=_0x398e7a['offset'],_0x3c5056=_0x398e7a[_0xc53e('0x27')]+_0x398e7a['limit'],_0x57a1f5;if(_0x3c5056>=_0x4d9a68){_0x3c5056=_0x4d9a68;_0x57a1f5=0xc8;}else{_0x57a1f5=0xce;}_0x4df8cf['status'](_0x57a1f5);return _0x4df8cf[_0xc53e('0x28')](_0xc53e('0x29'),_0x5c65d3+'-'+_0x3c5056+'/'+_0x4d9a68)[_0xc53e('0x25')](_0x4b9f6a);}return null;};}function patchUpdates(_0x2fa20b){return function(_0x6415f6){try{jsonpatch[_0xc53e('0x2a')](_0x6415f6,_0x2fa20b,!![]);}catch(_0x3280fe){return BPromise[_0xc53e('0x2b')](_0x3280fe);}return _0x6415f6['save']();};}function saveUpdates(_0x437893,_0x311835){return function(_0x2d36c0){if(_0x2d36c0){return _0x2d36c0['update'](_0x437893)[_0xc53e('0x1a')](function(_0x495756){return _0x495756;});}return null;};}function removeEntity(_0x4572e,_0x2467f4){return function(_0x49ab9b){if(_0x49ab9b){return _0x49ab9b['destroy']()[_0xc53e('0x1a')](function(){_0x4572e[_0xc53e('0x24')](0xcc)[_0xc53e('0x2c')]();});}};}function handleEntityNotFound(_0x30d037,_0x1b95c2){return function(_0x45fedc){if(!_0x45fedc){_0x30d037[_0xc53e('0x2d')](0x194);}return _0x45fedc;};}function handleError(_0x168d25,_0x4ffddc){_0x4ffddc=_0x4ffddc||0x1f4;return function(_0x24e9e5){logger[_0xc53e('0x20')](_0x24e9e5[_0xc53e('0x2e')]);if(_0x24e9e5[_0xc53e('0x2f')]){delete _0x24e9e5[_0xc53e('0x2f')];}_0x168d25[_0xc53e('0x24')](_0x4ffddc)[_0xc53e('0x30')](_0x24e9e5);};}exports[_0xc53e('0x31')]=function(_0x215abe,_0x595efb){var _0x3e395c={},_0x48d7d0={},_0x1059f3={'count':0x0,'rows':[]};var _0x46406b=_['map'](db[_0xc53e('0x32')][_0xc53e('0x33')],function(_0x3254e9){return{'name':_0x3254e9['fieldName'],'type':_0x3254e9[_0xc53e('0x34')][_0xc53e('0x35')]};});_0x48d7d0[_0xc53e('0x36')]=_[_0xc53e('0x37')](_0x46406b,_0xc53e('0x2f'));_0x48d7d0[_0xc53e('0x38')]=_[_0xc53e('0x39')](_0x215abe['query']);_0x48d7d0[_0xc53e('0x3a')]=_[_0xc53e('0x3b')](_0x48d7d0[_0xc53e('0x36')],_0x48d7d0['query']);_0x3e395c[_0xc53e('0x3c')]=_['intersection'](_0x48d7d0[_0xc53e('0x36')],qs[_0xc53e('0x3d')](_0x215abe[_0xc53e('0x38')][_0xc53e('0x3d')]));_0x3e395c[_0xc53e('0x3c')]=_0x3e395c['attributes'][_0xc53e('0x3e')]?_0x3e395c[_0xc53e('0x3c')]:_0x48d7d0['model'];if(!_0x215abe['query']['hasOwnProperty']('nolimit')){_0x3e395c[_0xc53e('0x3f')]=qs[_0xc53e('0x3f')](_0x215abe['query'][_0xc53e('0x3f')]);_0x3e395c['offset']=qs['offset'](_0x215abe['query'][_0xc53e('0x27')]);}_0x3e395c['order']=qs['sort'](_0x215abe[_0xc53e('0x38')]['sort']);_0x3e395c[_0xc53e('0x40')]=qs[_0xc53e('0x3a')](_['pick'](_0x215abe[_0xc53e('0x38')],_0x48d7d0[_0xc53e('0x3a')]),_0x46406b);if(_0x215abe['query'][_0xc53e('0x41')]){_0x3e395c['where']=_['merge'](_0x3e395c['where'],{'$or':_['map'](_0x46406b,function(_0x887d78){if(_0x887d78[_0xc53e('0x34')]!==_0xc53e('0x42')){var _0x5f1884={};_0x5f1884[_0x887d78[_0xc53e('0x2f')]]={'$like':'%'+_0x215abe[_0xc53e('0x38')]['filter']+'%'};return _0x5f1884;}})});}_0x3e395c=_['merge']({},_0x3e395c,_0x215abe[_0xc53e('0x43')]);var _0x1ab50e={'where':_0x3e395c[_0xc53e('0x40')]};return db['Dynamics365Account'][_0xc53e('0x26')](_0x1ab50e)[_0xc53e('0x1a')](function(_0xf48de9){_0x1059f3[_0xc53e('0x26')]=_0xf48de9;if(_0x215abe[_0xc53e('0x38')][_0xc53e('0x44')]){_0x3e395c[_0xc53e('0x45')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xc53e('0x46')](_0x3e395c);})[_0xc53e('0x1a')](function(_0x338f41){_0x1059f3['rows']=_0x338f41;return _0x1059f3;})[_0xc53e('0x1a')](respondWithFilteredResult(_0x595efb,_0x3e395c))[_0xc53e('0x47')](handleError(_0x595efb,null));};exports[_0xc53e('0x48')]=function(_0x15e744,_0xa7d256){var _0x17cea5={'raw':![],'where':{'id':_0x15e744[_0xc53e('0x49')]['id']}},_0x47df98={};_0x47df98[_0xc53e('0x36')]=_[_0xc53e('0x39')](db['Dynamics365Account'][_0xc53e('0x33')]);_0x47df98[_0xc53e('0x38')]=_[_0xc53e('0x39')](_0x15e744[_0xc53e('0x38')]);_0x47df98[_0xc53e('0x3a')]=_[_0xc53e('0x3b')](_0x47df98[_0xc53e('0x36')],_0x47df98[_0xc53e('0x38')]);_0x17cea5[_0xc53e('0x3c')]=_[_0xc53e('0x3b')](_0x47df98['model'],qs[_0xc53e('0x3d')](_0x15e744[_0xc53e('0x38')][_0xc53e('0x3d')]));_0x17cea5[_0xc53e('0x3c')]=_0x17cea5[_0xc53e('0x3c')]['length']?_0x17cea5['attributes']:_0x47df98[_0xc53e('0x36')];if(_0x15e744['query'][_0xc53e('0x44')]){_0x17cea5['include']=[{'all':!![]}];}_0x17cea5=_[_0xc53e('0x4a')]({},_0x17cea5,_0x15e744[_0xc53e('0x43')]);return db[_0xc53e('0x32')]['find'](_0x17cea5)[_0xc53e('0x1a')](handleEntityNotFound(_0xa7d256,null))[_0xc53e('0x1a')](respondWithResult(_0xa7d256,null))[_0xc53e('0x47')](handleError(_0xa7d256,null));};exports['create']=function(_0x2f7df2,_0x501f0a){return db[_0xc53e('0x32')][_0xc53e('0x4b')](_0x2f7df2['body'],{})[_0xc53e('0x1a')](respondWithResult(_0x501f0a,0xc9))[_0xc53e('0x47')](handleError(_0x501f0a,null));};exports['update']=function(_0x44f7cc,_0x36d321){if(_0x44f7cc[_0xc53e('0x4c')]['id']){delete _0x44f7cc[_0xc53e('0x4c')]['id'];}return db[_0xc53e('0x32')][_0xc53e('0x4d')]({'where':{'id':_0x44f7cc[_0xc53e('0x49')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x36d321,null))[_0xc53e('0x1a')](saveUpdates(_0x44f7cc[_0xc53e('0x4c')],null))[_0xc53e('0x1a')](respondWithResult(_0x36d321,null))['catch'](handleError(_0x36d321,null));};exports[_0xc53e('0x4e')]=function(_0x4a2543,_0x37f459){return db['Dynamics365Account'][_0xc53e('0x4d')]({'where':{'id':_0x4a2543[_0xc53e('0x49')]['id']}})['then'](handleEntityNotFound(_0x37f459,null))[_0xc53e('0x1a')](removeEntity(_0x37f459,null))[_0xc53e('0x47')](handleError(_0x37f459,null));};exports[_0xc53e('0x4f')]=function(_0x432a91,_0x53083b,_0x41c46c){var _0x335427={};var _0x4ae0d4={};var _0x5ea1da;var _0x3c0aa1;return db['Dynamics365Account']['findOne']({'where':{'id':_0x432a91['params']['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x53083b,null))['then'](function(_0x32b390){if(_0x32b390){_0x5ea1da=_0x32b390;_0x4ae0d4['model']=_[_0xc53e('0x39')](db[_0xc53e('0x50')][_0xc53e('0x33')]);_0x4ae0d4[_0xc53e('0x38')]=_[_0xc53e('0x39')](_0x432a91['query']);_0x4ae0d4['filters']=_[_0xc53e('0x3b')](_0x4ae0d4[_0xc53e('0x36')],_0x4ae0d4[_0xc53e('0x38')]);_0x335427[_0xc53e('0x3c')]=_[_0xc53e('0x3b')](_0x4ae0d4[_0xc53e('0x36')],qs[_0xc53e('0x3d')](_0x432a91[_0xc53e('0x38')][_0xc53e('0x3d')]));_0x335427[_0xc53e('0x3c')]=_0x335427[_0xc53e('0x3c')][_0xc53e('0x3e')]?_0x335427[_0xc53e('0x3c')]:_0x4ae0d4['model'];_0x335427[_0xc53e('0x51')]=qs['sort'](_0x432a91[_0xc53e('0x38')][_0xc53e('0x52')]);_0x335427[_0xc53e('0x40')]=qs[_0xc53e('0x3a')](_[_0xc53e('0x53')](_0x432a91[_0xc53e('0x38')],_0x4ae0d4[_0xc53e('0x3a')]));if(_0x432a91[_0xc53e('0x38')]['filter']){_0x335427['where']=_['merge'](_0x335427[_0xc53e('0x40')],{'$or':_[_0xc53e('0x37')](_0x335427[_0xc53e('0x3c')],function(_0x25e4b6){var _0x247d99={};_0x247d99[_0x25e4b6]={'$like':'%'+_0x432a91[_0xc53e('0x38')][_0xc53e('0x41')]+'%'};return _0x247d99;})});}_0x335427=_['merge']({},_0x335427,_0x432a91['options']);return _0x5ea1da['getConfigurations'](_0x335427);}})[_0xc53e('0x1a')](function(_0x150212){if(_0x150212){_0x3c0aa1=_0x150212['length'];if(!_0x432a91[_0xc53e('0x38')][_0xc53e('0x54')](_0xc53e('0x55'))){_0x335427[_0xc53e('0x3f')]=qs[_0xc53e('0x3f')](_0x432a91[_0xc53e('0x38')]['limit']);_0x335427['offset']=qs[_0xc53e('0x27')](_0x432a91[_0xc53e('0x38')][_0xc53e('0x27')]);}return _0x5ea1da[_0xc53e('0x4f')](_0x335427);}})[_0xc53e('0x1a')](function(_0xf0ca75){if(_0xf0ca75){return _0xf0ca75?{'count':_0x3c0aa1,'rows':_0xf0ca75}:null;}})['then'](respondWithResult(_0x53083b,null))[_0xc53e('0x47')](handleError(_0x53083b,null));};exports[_0xc53e('0x56')]=function(_0x1c15a3,_0x3f3dc2,_0x4d2609){if(_0x1c15a3[_0xc53e('0x4c')]['id']){delete _0x1c15a3[_0xc53e('0x4c')]['id'];}return db[_0xc53e('0x32')][_0xc53e('0x57')]({'where':{'id':_0x1c15a3[_0xc53e('0x49')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x3f3dc2,null))['then'](function(_0x1020a0){if(_0x1020a0){_0x1c15a3[_0xc53e('0x4c')][_0xc53e('0x58')]=_0x1020a0['id'];_0x1c15a3[_0xc53e('0x4c')]['Subjects']=integrations['getSubjects'](_0x1c15a3[_0xc53e('0x4c')][_0xc53e('0x59')],_0x1c15a3[_0xc53e('0x4c')][_0xc53e('0x34')]);_0x1c15a3['body'][_0xc53e('0x5a')]=integrations['getDescriptions'](_0x1c15a3[_0xc53e('0x4c')]['channel'],_0x1c15a3[_0xc53e('0x4c')]['type']);return db[_0xc53e('0x50')][_0xc53e('0x4b')](_0x1c15a3['body'],{'include':[{'model':db[_0xc53e('0x5b')],'as':_0xc53e('0x5c')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xc53e('0x1a')](respondWithResult(_0x3f3dc2,null))[_0xc53e('0x47')](handleError(_0x3f3dc2,null));};exports['getFields']=function(_0x584d2d,_0x3c49ec,_0x5ba256){var _0x354c33=_0x584d2d['query'][_0xc53e('0x5d')];var _0x330411=_0x354c33===_0xc53e('0x5e')?_0xc53e('0x5f'):_0xc53e('0x60');var _0x20067c='';var _0x143f15='';var _0x15eac2='';var _0x258be8='';var _0x2cd553='';var _0x576c27='';var _0x38976f='';var _0x4d3b07='';var _0x174cf9=[_0xc53e('0x61'),_0xc53e('0x62'),_0xc53e('0x63'),_0xc53e('0x64'),_0xc53e('0x65'),_0xc53e('0x66'),_0xc53e('0x67'),_0xc53e('0x68'),_0xc53e('0x69'),'phonecall_activity_parties'];var _0x36a8cb=['accountidname',_0xc53e('0x6a'),_0xc53e('0x6b'),_0xc53e('0x6c'),'contactidname',_0xc53e('0x6d'),_0xc53e('0x6e'),_0xc53e('0x6f'),_0xc53e('0x70'),_0xc53e('0x71'),'createdbyname',_0xc53e('0x72'),_0xc53e('0x73'),'createdonbehalfbyname',_0xc53e('0x74'),_0xc53e('0x75'),_0xc53e('0x76'),'customeridyominame',_0xc53e('0x77'),_0xc53e('0x78'),'entityimage_timestamp',_0xc53e('0x79'),_0xc53e('0x7a'),'exchangerate','firstresponsebykpiidname',_0xc53e('0x7b'),'importsequencenumber',_0xc53e('0x7c'),_0xc53e('0x7d'),_0xc53e('0x7e'),'masteridname',_0xc53e('0x7f'),_0xc53e('0x80'),_0xc53e('0x81'),'modifiedbyyominame',_0xc53e('0x82'),_0xc53e('0x83'),_0xc53e('0x84'),_0xc53e('0x85'),_0xc53e('0x86'),'numberofchildincidents',_0xc53e('0x87'),_0xc53e('0x88'),_0xc53e('0x89'),_0xc53e('0x8a'),_0xc53e('0x8b'),_0xc53e('0x8c'),_0xc53e('0x8d'),_0xc53e('0x8e'),_0xc53e('0x8f'),'productidname',_0xc53e('0x90'),_0xc53e('0x91'),_0xc53e('0x92'),_0xc53e('0x93'),_0xc53e('0x94'),_0xc53e('0x95'),_0xc53e('0x96'),_0xc53e('0x97'),_0xc53e('0x98'),'socialprofileidname',_0xc53e('0x99'),_0xc53e('0x9a'),_0xc53e('0x9b'),_0xc53e('0x9c'),'timezoneruleversionnumber',_0xc53e('0x9d'),_0xc53e('0x9e'),_0xc53e('0x9f'),_0xc53e('0xa0')];var _0x4b1145=_0x174cf9[_0xc53e('0xa1')](_0x36a8cb);return db[_0xc53e('0x32')][_0xc53e('0x57')]({'where':{'id':_0x584d2d[_0xc53e('0x49')]['id']},'attributes':['id',_0xc53e('0xa2'),_0xc53e('0xa3'),_0xc53e('0xa4'),'tenantId',_0xc53e('0xa5'),'clientSecret']})[_0xc53e('0x1a')](handleEntityNotFound(_0x3c49ec,null))[_0xc53e('0x1a')](function(_0x3fe278){if(_0x3fe278){_0x4d3b07=_0x3fe278['remoteUri'];var _0x7c56eb=_0x4d3b07[_0xc53e('0xa6')](-0x1);if(_0x7c56eb==='/'){_0x4d3b07=_0x4d3b07[_0xc53e('0xa7')](0x0,_0x4d3b07['lastIndexOf'](_0x7c56eb));}_0x38976f=util[_0xc53e('0xa8')](_0xc53e('0xa9'),_0x4d3b07);var _0x4213b3={'method':'POST','uri':_0xc53e('0xaa')+_0x3fe278[_0xc53e('0xab')]+_0xc53e('0xac'),'form':{'client_id':_0x3fe278[_0xc53e('0xa5')],'resource':_0x4d3b07,'username':_0x3fe278[_0xc53e('0xa2')],'password':_0x3fe278['password'],'grant_type':'password','client_secret':_0x3fe278['clientSecret']},'json':!![]};return rp(_0x4213b3);}})[_0xc53e('0x1a')](function(_0x4207c8){_0x576c27=_0x4207c8[_0xc53e('0xad')];var _0x3e5e89={'method':'GET','uri':encodeURI(_0x38976f+_0xc53e('0xae')+_0x330411+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x576c27,'If-None-Match':null,'OData-Version':_0xc53e('0xaf')},'json':!![]};return rp(_0x3e5e89);})[_0xc53e('0x1a')](function(_0x3c6337){var _0x17df31=_0x3c6337['value'][0x0];var _0x1c751b=_0x17df31[_0xc53e('0xb0')];var _0x4664={'method':_0xc53e('0xb1'),'uri':_0x38976f+_0xc53e('0xb2')+_0x1c751b+_0xc53e('0xb3'),'headers':{'Authorization':_0xc53e('0xb4')+_0x576c27,'If-None-Match':null,'OData-Version':_0xc53e('0xaf')},'json':!![]};return rp(_0x4664);})[_0xc53e('0x1a')](function(_0x37bb6f){_0x20067c=_0x37bb6f;_0x143f15=_0x20067c[_0xc53e('0xb5')];_0x143f15=_[_0xc53e('0xb6')](_0x143f15,function(_0x34f93e){return!_0x4b1145[_0xc53e('0xb7')](_0x34f93e[_0xc53e('0xb8')]);});var _0xdd3b84=[];var _0x3dc1be=[];_0x143f15[_0xc53e('0xb9')](function(_0x2f9577){if(_0x2f9577[_0xc53e('0xba')]){var _0x625c01=_0x2f9577[_0xc53e('0xba')][_0xc53e('0xa7')](_0x2f9577[_0xc53e('0xba')][_0xc53e('0xbb')]('.')+0x1);if(_0x625c01==='PicklistAttributeMetadata'){_0xdd3b84[_0xc53e('0xbc')](getSelectList(_0x38976f,_0x354c33,_0x3dc1be,_0x20067c['MetadataId'],_0x2f9577[_0xc53e('0xb0')],_0x576c27));}}});return Promise[_0xc53e('0xbd')](_0xdd3b84);})['then'](function(_0x398fae){_0x15eac2=_0x398fae[0x0];var _0x3f8010=[];var _0xfa4fd5=[];_0x143f15[_0xc53e('0xb9')](function(_0x845f4a){if(!_[_0xc53e('0xbe')](_0x845f4a[_0xc53e('0xba')])){var _0x3635c1=_0x845f4a[_0xc53e('0xba')]['substring'](_0x845f4a[_0xc53e('0xba')]['lastIndexOf']('.')+0x1);if(_0x3635c1===_0xc53e('0xbf')){_0x3f8010[_0xc53e('0xbc')](getBooleanList(_0x38976f,_0x354c33,_0xfa4fd5,_0x20067c[_0xc53e('0xb0')],_0x845f4a[_0xc53e('0xb0')],_0x576c27));}}});return Promise[_0xc53e('0xbd')](_0x3f8010);})[_0xc53e('0x1a')](function(_0xd8c9fa){_0x258be8=_0xd8c9fa[0x0];var _0x38dae0=[];var _0x42a005=[];_0x143f15[_0xc53e('0xb9')](function(_0x3faeb6){if(_0x3faeb6[_0xc53e('0xba')]){var _0x1353f9=_0x3faeb6['@odata.type'][_0xc53e('0xa7')](_0x3faeb6['@odata.type'][_0xc53e('0xbb')]('.')+0x1);if(_0x1353f9===_0xc53e('0xc0')||_0x1353f9===_0xc53e('0xc1')||_0x1353f9===_0xc53e('0xc2')||_0x1353f9==='IntegerAttributeMetadata'||_0x1353f9==='MemoAttributeMetadata'||_0x1353f9===_0xc53e('0xc3')||_0x1353f9===_0xc53e('0xc4')||_0x1353f9===_0xc53e('0xc5')||_0x1353f9===_0xc53e('0xc6')||_0x1353f9==='DecimalAttributeMetadata'){_0x38dae0['push'](getInputList(_0x38976f,_0x354c33,_0x1353f9,_0x42a005,_0x20067c[_0xc53e('0xb0')],_0x3faeb6[_0xc53e('0xb0')],_0x576c27));}}});return Promise[_0xc53e('0xbd')](_0x38dae0);})[_0xc53e('0x1a')](function(_0x2faa4e){_0x2cd553=_0x2faa4e[0x0];var _0x218fc2=_0x15eac2['concat'](_0x258be8)[_0xc53e('0xa1')](_0x2cd553);var _0x1e2217={'count':_0x218fc2[_0xc53e('0x3e')],'rows':_0x218fc2};return _0x1e2217;})[_0xc53e('0x1a')](respondWithResult(_0x3c49ec,null))[_0xc53e('0x47')](function(_0x4f527e){var _0x1f5d48=_0x584d2d[_0xc53e('0x38')][_0xc53e('0xc7')]?0x1f4:_0x4f527e[_0xc53e('0xc8')]||0x1f4;logger[_0xc53e('0x20')](_0x4f527e[_0xc53e('0x2e')]);delete _0x4f527e[_0xc53e('0x2f')];if(_0x1f5d48===0x191){_0x1f5d48=0x190;}_0x3c49ec[_0xc53e('0x24')](_0x1f5d48)[_0xc53e('0x30')](_0x584d2d[_0xc53e('0x38')][_0xc53e('0xc7')]?{'message':_0xc53e('0xc9'),'statusCode':_0x4f527e[_0xc53e('0xc8')]}:_0x4f527e);});};function getSelectList(_0x51fff1,_0x2dd16a,_0x375f24,_0x5670ab,_0x14a7e4,_0x4ee56b){var _0x5e5458={'method':_0xc53e('0xb1'),'uri':_0x51fff1+'EntityDefinitions('+_0x5670ab+_0xc53e('0xca')+_0x14a7e4+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xc53e('0xcb'),'headers':{'Authorization':'Bearer\x20'+_0x4ee56b,'If-None-Match':null,'OData-Version':_0xc53e('0xaf')},'json':!![]};return rp(_0x5e5458)[_0xc53e('0x1a')](function(_0x10ad32){var _0x524d63=[];var _0xf3f34a=_0x10ad32['OptionSet'][_0xc53e('0xcc')];_0xf3f34a[_0xc53e('0xb9')](function(_0x1c3cb2){_0x524d63[_0xc53e('0xbc')]({'name':_0x1c3cb2[_0xc53e('0xcd')][_0xc53e('0xce')][_0xc53e('0xcd')],'value':String(_0x1c3cb2[_0xc53e('0xcf')])});});var _0x2c776c={'id':_0x2dd16a+'_'+_0x10ad32[_0xc53e('0xb8')],'name':_0x10ad32['DisplayName']['UserLocalizedLabel'][_0xc53e('0xcd')],'custom':![],'options':_0x524d63};_0x375f24['push'](_0x2c776c);return _0x375f24;});}function getBooleanList(_0xd9c9b8,_0xbc960,_0x14baae,_0x2b9785,_0x32bb5d,_0x348add){var _0x32ea86={'method':_0xc53e('0xb1'),'uri':_0xd9c9b8+'EntityDefinitions('+_0x2b9785+_0xc53e('0xca')+_0x32bb5d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc53e('0xb4')+_0x348add,'If-None-Match':null,'OData-Version':_0xc53e('0xaf')},'json':!![]};return rp(_0x32ea86)[_0xc53e('0x1a')](function(_0x2b8d77){var _0x36fbf4=[];_0x36fbf4[_0xc53e('0xbc')]({'name':_0x2b8d77[_0xc53e('0xd0')]['TrueOption'][_0xc53e('0xcd')][_0xc53e('0xce')][_0xc53e('0xcd')],'value':_0xc53e('0xd1')},{'name':_0x2b8d77[_0xc53e('0xd0')]['FalseOption'][_0xc53e('0xcd')][_0xc53e('0xce')]['Label'],'value':'false'});var _0x208c17={'id':_0xbc960+'_'+_0x2b8d77['LogicalName'],'name':_0x2b8d77[_0xc53e('0xd2')][_0xc53e('0xce')]['Label'],'custom':![],'options':_0x36fbf4};_0x14baae['push'](_0x208c17);return _0x14baae;});}function getInputList(_0x258eea,_0x4e23d8,_0x204208,_0x4d43e1,_0x25d604,_0xe7a014,_0x3da1a7){var _0x8296b2={'method':_0xc53e('0xb1'),'uri':_0x258eea+'EntityDefinitions('+_0x25d604+_0xc53e('0xca')+_0xe7a014+')/Microsoft.Dynamics.CRM.'+_0x204208+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc53e('0xb4')+_0x3da1a7,'If-None-Match':null,'OData-Version':_0xc53e('0xaf')},'json':!![]};return rp(_0x8296b2)[_0xc53e('0x1a')](function(_0x3a493f){var _0xf70821={'id':_0x4e23d8+'_'+_0x3a493f[_0xc53e('0xb8')],'name':_0x3a493f[_0xc53e('0xd2')][_0xc53e('0xce')]?_0x3a493f[_0xc53e('0xd2')][_0xc53e('0xce')][_0xc53e('0xcd')]:_0x3a493f[_0xc53e('0xb8')],'custom':![],'options':[]};_0x4d43e1['push'](_0xf70821);return _0x4d43e1;});} \ No newline at end of file +var _0xabce=['remoteUri','slice','substring','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','Attributes','includes','LogicalName','forEach','@odata.type','push','all','lastIndexOf','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','Dynamics365Account','fieldName','type','map','query','model','attributes','intersection','fields','length','nolimit','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','Subjects','getDescriptions','channel','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret'];(function(_0x1a7781,_0x15ccbc){var _0x18bc84=function(_0x53a00a){while(--_0x53a00a){_0x1a7781['push'](_0x1a7781['shift']());}};_0x18bc84(++_0x15ccbc);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var integrations=require(_0xeabc('0x1a'));var jayson=require(_0xeabc('0x1b'));var client=jayson[_0xeabc('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235c2d,_0x1319f3,_0x3251c6,_0x55f0de){return new BPromise(function(_0x5f4ee8,_0x3170ea){var _0x3ae954=_0x55f0de||client;return _0x3ae954[_0xeabc('0x1d')](_0x235c2d,_0x3251c6)['then'](function(_0xf913d7){logger[_0xeabc('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x1319f3,'request\x20sent');logger[_0xeabc('0x1f')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1319f3,_0xeabc('0x20'),JSON[_0xeabc('0x21')](_0xf913d7));if(_0xf913d7[_0xeabc('0x22')]){if(_0xf913d7[_0xeabc('0x22')][_0xeabc('0x23')]===0x1f4){logger[_0xeabc('0x22')](_0xeabc('0x24'),_0x1319f3,_0xf913d7[_0xeabc('0x22')]['message']);return _0x3170ea(_0xf913d7[_0xeabc('0x22')]['message']);}logger[_0xeabc('0x22')](_0xeabc('0x24'),_0x1319f3,_0xf913d7['error'][_0xeabc('0x25')]);return _0x5f4ee8(_0xf913d7[_0xeabc('0x22')][_0xeabc('0x25')]);}else{logger[_0xeabc('0x1e')](_0xeabc('0x24'),_0x1319f3,'request\x20sent');_0x5f4ee8(_0xf913d7[_0xeabc('0x26')][_0xeabc('0x25')]);}})[_0xeabc('0x27')](function(_0x5bdd57){logger[_0xeabc('0x22')](_0xeabc('0x24'),_0x1319f3,_0x5bdd57);_0x3170ea(_0x5bdd57);});});}function respondWithStatusCode(_0x214953,_0x319119){_0x319119=_0x319119||0xcc;return function(_0x5b8838){if(_0x5b8838){return _0x214953[_0xeabc('0x28')](_0x319119);}return _0x214953['status'](_0x319119)[_0xeabc('0x29')]();};}function respondWithResult(_0x4d4e29,_0x811f0d){_0x811f0d=_0x811f0d||0xc8;return function(_0x12acbd){if(_0x12acbd){return _0x4d4e29[_0xeabc('0x2a')](_0x811f0d)[_0xeabc('0x2b')](_0x12acbd);}};}function respondWithFilteredResult(_0x3a1a04,_0x137293){return function(_0x131722){if(_0x131722){var _0x4c2693=_0x131722[_0xeabc('0x2c')],_0x5b2934=_0x137293[_0xeabc('0x2d')],_0x459c8a=_0x137293['offset']+_0x137293[_0xeabc('0x2e')],_0x5bf8f2;if(_0x459c8a>=_0x4c2693){_0x459c8a=_0x4c2693;_0x5bf8f2=0xc8;}else{_0x5bf8f2=0xce;}_0x3a1a04[_0xeabc('0x2a')](_0x5bf8f2);return _0x3a1a04[_0xeabc('0x2f')](_0xeabc('0x30'),_0x5b2934+'-'+_0x459c8a+'/'+_0x4c2693)[_0xeabc('0x2b')](_0x131722);}return null;};}function patchUpdates(_0x481ee1){return function(_0x2c62fe){try{jsonpatch[_0xeabc('0x31')](_0x2c62fe,_0x481ee1,!![]);}catch(_0x2915c1){return BPromise['reject'](_0x2915c1);}return _0x2c62fe[_0xeabc('0x32')]();};}function saveUpdates(_0x5bb1f1,_0x2f03e8){return function(_0x2d027e){if(_0x2d027e){return _0x2d027e[_0xeabc('0x33')](_0x5bb1f1)[_0xeabc('0x34')](function(_0x73c8d4){return _0x73c8d4;});}return null;};}function removeEntity(_0x368b8a,_0x61c0af){return function(_0x545d7f){if(_0x545d7f){return _0x545d7f[_0xeabc('0x35')]()[_0xeabc('0x34')](function(){_0x368b8a[_0xeabc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(!_0x4492fd){_0x1e74ca['sendStatus'](0x194);}return _0x4492fd;};}function handleError(_0xc0a5b0,_0x36cc2f){_0x36cc2f=_0x36cc2f||0x1f4;return function(_0x1f910d){logger['error'](_0x1f910d[_0xeabc('0x36')]);if(_0x1f910d[_0xeabc('0x37')]){delete _0x1f910d['name'];}_0xc0a5b0['status'](_0x36cc2f)[_0xeabc('0x38')](_0x1f910d);};}exports[_0xeabc('0x39')]=function(_0x4fc60c,_0x43df50){var _0x81976d={},_0x3edee7={},_0x10434e={'count':0x0,'rows':[]};var _0x34057c=_['map'](db[_0xeabc('0x3a')]['rawAttributes'],function(_0x31ee7a){return{'name':_0x31ee7a[_0xeabc('0x3b')],'type':_0x31ee7a[_0xeabc('0x3c')]['key']};});_0x3edee7['model']=_[_0xeabc('0x3d')](_0x34057c,'name');_0x3edee7[_0xeabc('0x3e')]=_['keys'](_0x4fc60c['query']);_0x3edee7['filters']=_['intersection'](_0x3edee7[_0xeabc('0x3f')],_0x3edee7['query']);_0x81976d[_0xeabc('0x40')]=_[_0xeabc('0x41')](_0x3edee7['model'],qs[_0xeabc('0x42')](_0x4fc60c['query'][_0xeabc('0x42')]));_0x81976d['attributes']=_0x81976d[_0xeabc('0x40')][_0xeabc('0x43')]?_0x81976d[_0xeabc('0x40')]:_0x3edee7['model'];if(!_0x4fc60c['query']['hasOwnProperty'](_0xeabc('0x44'))){_0x81976d[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x4fc60c['query']['limit']);_0x81976d[_0xeabc('0x2d')]=qs[_0xeabc('0x2d')](_0x4fc60c['query'][_0xeabc('0x2d')]);}_0x81976d['order']=qs[_0xeabc('0x45')](_0x4fc60c['query']['sort']);_0x81976d['where']=qs[_0xeabc('0x46')](_[_0xeabc('0x47')](_0x4fc60c[_0xeabc('0x3e')],_0x3edee7[_0xeabc('0x46')]),_0x34057c);if(_0x4fc60c['query'][_0xeabc('0x48')]){_0x81976d['where']=_[_0xeabc('0x49')](_0x81976d[_0xeabc('0x4a')],{'$or':_[_0xeabc('0x3d')](_0x34057c,function(_0x17a0df){if(_0x17a0df[_0xeabc('0x3c')]!=='VIRTUAL'){var _0x482971={};_0x482971[_0x17a0df[_0xeabc('0x37')]]={'$like':'%'+_0x4fc60c['query'][_0xeabc('0x48')]+'%'};return _0x482971;}})});}_0x81976d=_[_0xeabc('0x49')]({},_0x81976d,_0x4fc60c['options']);var _0x14276d={'where':_0x81976d[_0xeabc('0x4a')]};return db[_0xeabc('0x3a')][_0xeabc('0x2c')](_0x14276d)[_0xeabc('0x34')](function(_0xcaa5b9){_0x10434e[_0xeabc('0x2c')]=_0xcaa5b9;if(_0x4fc60c['query'][_0xeabc('0x4b')]){_0x81976d[_0xeabc('0x4c')]=[{'all':!![]}];}return db[_0xeabc('0x3a')][_0xeabc('0x4d')](_0x81976d);})[_0xeabc('0x34')](function(_0x3fbc97){_0x10434e[_0xeabc('0x4e')]=_0x3fbc97;return _0x10434e;})[_0xeabc('0x34')](respondWithFilteredResult(_0x43df50,_0x81976d))[_0xeabc('0x27')](handleError(_0x43df50,null));};exports[_0xeabc('0x4f')]=function(_0x5689fc,_0x38356c){var _0x2e6efb={'raw':![],'where':{'id':_0x5689fc[_0xeabc('0x50')]['id']}},_0x41f5d7={};_0x41f5d7[_0xeabc('0x3f')]=_[_0xeabc('0x51')](db[_0xeabc('0x3a')]['rawAttributes']);_0x41f5d7[_0xeabc('0x3e')]=_[_0xeabc('0x51')](_0x5689fc[_0xeabc('0x3e')]);_0x41f5d7[_0xeabc('0x46')]=_[_0xeabc('0x41')](_0x41f5d7['model'],_0x41f5d7[_0xeabc('0x3e')]);_0x2e6efb[_0xeabc('0x40')]=_[_0xeabc('0x41')](_0x41f5d7[_0xeabc('0x3f')],qs['fields'](_0x5689fc[_0xeabc('0x3e')][_0xeabc('0x42')]));_0x2e6efb['attributes']=_0x2e6efb[_0xeabc('0x40')]['length']?_0x2e6efb[_0xeabc('0x40')]:_0x41f5d7['model'];if(_0x5689fc[_0xeabc('0x3e')][_0xeabc('0x4b')]){_0x2e6efb[_0xeabc('0x4c')]=[{'all':!![]}];}_0x2e6efb=_[_0xeabc('0x49')]({},_0x2e6efb,_0x5689fc[_0xeabc('0x52')]);return db[_0xeabc('0x3a')][_0xeabc('0x53')](_0x2e6efb)[_0xeabc('0x34')](handleEntityNotFound(_0x38356c,null))[_0xeabc('0x34')](respondWithResult(_0x38356c,null))[_0xeabc('0x27')](handleError(_0x38356c,null));};exports['create']=function(_0x180a14,_0x2537ab){return db[_0xeabc('0x3a')][_0xeabc('0x54')](_0x180a14['body'],{})[_0xeabc('0x34')](respondWithResult(_0x2537ab,0xc9))[_0xeabc('0x27')](handleError(_0x2537ab,null));};exports[_0xeabc('0x33')]=function(_0x21f972,_0x5f2d2f){if(_0x21f972[_0xeabc('0x55')]['id']){delete _0x21f972[_0xeabc('0x55')]['id'];}return db[_0xeabc('0x3a')][_0xeabc('0x53')]({'where':{'id':_0x21f972[_0xeabc('0x50')]['id']}})[_0xeabc('0x34')](handleEntityNotFound(_0x5f2d2f,null))[_0xeabc('0x34')](saveUpdates(_0x21f972[_0xeabc('0x55')],null))[_0xeabc('0x34')](respondWithResult(_0x5f2d2f,null))['catch'](handleError(_0x5f2d2f,null));};exports[_0xeabc('0x35')]=function(_0x4cdb05,_0x5e09fc){return db['Dynamics365Account'][_0xeabc('0x53')]({'where':{'id':_0x4cdb05[_0xeabc('0x50')]['id']}})[_0xeabc('0x34')](handleEntityNotFound(_0x5e09fc,null))[_0xeabc('0x34')](removeEntity(_0x5e09fc,null))[_0xeabc('0x27')](handleError(_0x5e09fc,null));};exports[_0xeabc('0x56')]=function(_0x4a2ad6,_0x4358d7,_0x25fd83){var _0x19f61e={};var _0x104c1e={};var _0x2ddc53;var _0x2c7b4e;return db[_0xeabc('0x3a')][_0xeabc('0x57')]({'where':{'id':_0x4a2ad6['params']['id']}})['then'](handleEntityNotFound(_0x4358d7,null))[_0xeabc('0x34')](function(_0x340520){if(_0x340520){_0x2ddc53=_0x340520;_0x104c1e[_0xeabc('0x3f')]=_['keys'](db[_0xeabc('0x58')]['rawAttributes']);_0x104c1e['query']=_[_0xeabc('0x51')](_0x4a2ad6[_0xeabc('0x3e')]);_0x104c1e[_0xeabc('0x46')]=_[_0xeabc('0x41')](_0x104c1e[_0xeabc('0x3f')],_0x104c1e[_0xeabc('0x3e')]);_0x19f61e['attributes']=_[_0xeabc('0x41')](_0x104c1e[_0xeabc('0x3f')],qs[_0xeabc('0x42')](_0x4a2ad6[_0xeabc('0x3e')][_0xeabc('0x42')]));_0x19f61e[_0xeabc('0x40')]=_0x19f61e['attributes'][_0xeabc('0x43')]?_0x19f61e[_0xeabc('0x40')]:_0x104c1e[_0xeabc('0x3f')];_0x19f61e[_0xeabc('0x59')]=qs[_0xeabc('0x45')](_0x4a2ad6[_0xeabc('0x3e')][_0xeabc('0x45')]);_0x19f61e[_0xeabc('0x4a')]=qs[_0xeabc('0x46')](_['pick'](_0x4a2ad6[_0xeabc('0x3e')],_0x104c1e['filters']));if(_0x4a2ad6[_0xeabc('0x3e')][_0xeabc('0x48')]){_0x19f61e[_0xeabc('0x4a')]=_[_0xeabc('0x49')](_0x19f61e[_0xeabc('0x4a')],{'$or':_[_0xeabc('0x3d')](_0x19f61e[_0xeabc('0x40')],function(_0xb59a2a){var _0x5d4bc2={};_0x5d4bc2[_0xb59a2a]={'$like':'%'+_0x4a2ad6[_0xeabc('0x3e')]['filter']+'%'};return _0x5d4bc2;})});}_0x19f61e=_[_0xeabc('0x49')]({},_0x19f61e,_0x4a2ad6[_0xeabc('0x52')]);return _0x2ddc53[_0xeabc('0x56')](_0x19f61e);}})[_0xeabc('0x34')](function(_0x5b4430){if(_0x5b4430){_0x2c7b4e=_0x5b4430[_0xeabc('0x43')];if(!_0x4a2ad6['query']['hasOwnProperty'](_0xeabc('0x44'))){_0x19f61e[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x4a2ad6[_0xeabc('0x3e')]['limit']);_0x19f61e['offset']=qs[_0xeabc('0x2d')](_0x4a2ad6['query']['offset']);}return _0x2ddc53[_0xeabc('0x56')](_0x19f61e);}})['then'](function(_0x4afc8e){if(_0x4afc8e){return _0x4afc8e?{'count':_0x2c7b4e,'rows':_0x4afc8e}:null;}})[_0xeabc('0x34')](respondWithResult(_0x4358d7,null))[_0xeabc('0x27')](handleError(_0x4358d7,null));};exports['addConfiguration']=function(_0x48cccc,_0xd866c0,_0x5d183a){if(_0x48cccc[_0xeabc('0x55')]['id']){delete _0x48cccc[_0xeabc('0x55')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x48cccc[_0xeabc('0x50')]['id']}})[_0xeabc('0x34')](handleEntityNotFound(_0xd866c0,null))[_0xeabc('0x34')](function(_0x471cb6){if(_0x471cb6){_0x48cccc[_0xeabc('0x55')]['AccountId']=_0x471cb6['id'];_0x48cccc['body'][_0xeabc('0x5a')]=integrations['getSubjects'](_0x48cccc[_0xeabc('0x55')]['channel'],_0x48cccc[_0xeabc('0x55')]['type']);_0x48cccc[_0xeabc('0x55')]['Descriptions']=integrations[_0xeabc('0x5b')](_0x48cccc[_0xeabc('0x55')][_0xeabc('0x5c')],_0x48cccc[_0xeabc('0x55')]['type']);return db[_0xeabc('0x58')]['create'](_0x48cccc[_0xeabc('0x55')],{'include':[{'model':db[_0xeabc('0x5d')],'as':_0xeabc('0x5a')},{'model':db[_0xeabc('0x5d')],'as':_0xeabc('0x5e')}]});}return null;})['then'](respondWithResult(_0xd866c0,null))[_0xeabc('0x27')](handleError(_0xd866c0,null));};exports[_0xeabc('0x5f')]=function(_0x4b9614,_0x2509a4,_0x5427c8){var _0x1559dc=_0x4b9614[_0xeabc('0x3e')][_0xeabc('0x60')];var _0x76efdf=_0x1559dc==='incident'?_0xeabc('0x61'):_0xeabc('0x62');var _0x287f88='';var _0x460520='';var _0x485040='';var _0x56b7d0='';var _0x30e9eb='';var _0x4f406b='';var _0x5ea2e3='';var _0x3271b6='';var _0x460f07=[_0xeabc('0x63'),'description',_0xeabc('0x64'),_0xeabc('0x65'),'caseorigincode',_0xeabc('0x66'),_0xeabc('0x67'),_0xeabc('0x68'),_0xeabc('0x69'),_0xeabc('0x6a')];var _0x4bf9d8=[_0xeabc('0x6b'),'accountidyominame','actualserviceunits','billedserviceunits',_0xeabc('0x6c'),_0xeabc('0x6d'),_0xeabc('0x6e'),_0xeabc('0x6f'),_0xeabc('0x70'),'createdbyexternalpartyyominame',_0xeabc('0x71'),'createdbyyominame',_0xeabc('0x72'),_0xeabc('0x73'),'createdonbehalfbyyominame',_0xeabc('0x74'),'customeridtype','customeridyominame',_0xeabc('0x75'),_0xeabc('0x76'),_0xeabc('0x77'),_0xeabc('0x78'),_0xeabc('0x79'),'exchangerate',_0xeabc('0x7a'),_0xeabc('0x7b'),_0xeabc('0x7c'),_0xeabc('0x7d'),_0xeabc('0x7e'),_0xeabc('0x7f'),_0xeabc('0x80'),_0xeabc('0x81'),_0xeabc('0x82'),_0xeabc('0x83'),'modifiedbyyominame',_0xeabc('0x84'),_0xeabc('0x85'),_0xeabc('0x86'),'msdyn_incidenttypename','msdyn_iotalertname',_0xeabc('0x87'),_0xeabc('0x88'),_0xeabc('0x89'),_0xeabc('0x8a'),_0xeabc('0x8b'),'owneridyominame',_0xeabc('0x8c'),'primarycontactidname','primarycontactidyominame',_0xeabc('0x8d'),_0xeabc('0x8e'),'productserialnumber',_0xeabc('0x8f'),_0xeabc('0x90'),_0xeabc('0x91'),_0xeabc('0x92'),_0xeabc('0x93'),_0xeabc('0x94'),_0xeabc('0x95'),_0xeabc('0x96'),_0xeabc('0x97'),_0xeabc('0x98'),_0xeabc('0x99'),'subjectidname',_0xeabc('0x9a'),'timezoneruleversionnumber',_0xeabc('0x9b'),_0xeabc('0x9c'),_0xeabc('0x9d'),_0xeabc('0x9e')];var _0x62cb8e=_0x460f07[_0xeabc('0x9f')](_0x4bf9d8);return db[_0xeabc('0x3a')][_0xeabc('0x57')]({'where':{'id':_0x4b9614[_0xeabc('0x50')]['id']},'attributes':['id',_0xeabc('0xa0'),_0xeabc('0xa1'),'remoteUri',_0xeabc('0xa2'),_0xeabc('0xa3'),_0xeabc('0xa4')]})[_0xeabc('0x34')](handleEntityNotFound(_0x2509a4,null))['then'](function(_0x26c595){if(_0x26c595){_0x3271b6=_0x26c595[_0xeabc('0xa5')];var _0x580661=_0x3271b6[_0xeabc('0xa6')](-0x1);if(_0x580661==='/'){_0x3271b6=_0x3271b6[_0xeabc('0xa7')](0x0,_0x3271b6['lastIndexOf'](_0x580661));}_0x5ea2e3=util['format']('%s/api/data/v9.0/',_0x3271b6);var _0x5f28dc={'method':_0xeabc('0xa8'),'uri':_0xeabc('0xa9')+_0x26c595[_0xeabc('0xa2')]+_0xeabc('0xaa'),'form':{'client_id':_0x26c595[_0xeabc('0xa3')],'resource':_0x3271b6,'username':_0x26c595[_0xeabc('0xa0')],'password':_0x26c595[_0xeabc('0xa1')],'grant_type':_0xeabc('0xa1'),'client_secret':_0x26c595[_0xeabc('0xa4')]},'json':!![]};return rp(_0x5f28dc);}})[_0xeabc('0x34')](function(_0x5421b9){_0x4f406b=_0x5421b9[_0xeabc('0xab')];var _0x37f3be={'method':'GET','uri':encodeURI(_0x5ea2e3+_0xeabc('0xac')+_0x76efdf+'\x27'),'headers':{'Authorization':_0xeabc('0xad')+_0x4f406b,'If-None-Match':null,'OData-Version':_0xeabc('0xae')},'json':!![]};return rp(_0x37f3be);})['then'](function(_0x1f3198){var _0x488120=_0x1f3198[_0xeabc('0xaf')][0x0];var _0x1b1095=_0x488120[_0xeabc('0xb0')];var _0xd9a156={'method':_0xeabc('0xb1'),'uri':_0x5ea2e3+'EntityDefinitions('+_0x1b1095+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x4f406b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd9a156);})[_0xeabc('0x34')](function(_0x3c2725){_0x287f88=_0x3c2725;_0x460520=_0x287f88[_0xeabc('0xb2')];_0x460520=_['remove'](_0x460520,function(_0x12f83f){return!_0x62cb8e[_0xeabc('0xb3')](_0x12f83f[_0xeabc('0xb4')]);});var _0x36cc30=[];var _0x39964d=[];_0x460520[_0xeabc('0xb5')](function(_0xdd956){if(_0xdd956[_0xeabc('0xb6')]){var _0x33446c=_0xdd956[_0xeabc('0xb6')][_0xeabc('0xa7')](_0xdd956[_0xeabc('0xb6')]['lastIndexOf']('.')+0x1);if(_0x33446c==='PicklistAttributeMetadata'){_0x36cc30[_0xeabc('0xb7')](getSelectList(_0x5ea2e3,_0x1559dc,_0x39964d,_0x287f88['MetadataId'],_0xdd956[_0xeabc('0xb0')],_0x4f406b));}}});return Promise[_0xeabc('0xb8')](_0x36cc30);})[_0xeabc('0x34')](function(_0x56f622){_0x485040=_0x56f622[0x0];var _0x38ccd5=[];var _0x5ae6b0=[];_0x460520[_0xeabc('0xb5')](function(_0x53ef31){if(!_['isNil'](_0x53ef31[_0xeabc('0xb6')])){var _0x2d5005=_0x53ef31[_0xeabc('0xb6')][_0xeabc('0xa7')](_0x53ef31[_0xeabc('0xb6')][_0xeabc('0xb9')]('.')+0x1);if(_0x2d5005==='BooleanAttributeMetadata'){_0x38ccd5['push'](getBooleanList(_0x5ea2e3,_0x1559dc,_0x5ae6b0,_0x287f88[_0xeabc('0xb0')],_0x53ef31[_0xeabc('0xb0')],_0x4f406b));}}});return Promise[_0xeabc('0xb8')](_0x38ccd5);})[_0xeabc('0x34')](function(_0x5f054d){_0x56b7d0=_0x5f054d[0x0];var _0x5e97b5=[];var _0x4bf689=[];_0x460520[_0xeabc('0xb5')](function(_0x57ce9b){if(_0x57ce9b[_0xeabc('0xb6')]){var _0x5016e2=_0x57ce9b[_0xeabc('0xb6')]['substring'](_0x57ce9b[_0xeabc('0xb6')][_0xeabc('0xb9')]('.')+0x1);if(_0x5016e2===_0xeabc('0xba')||_0x5016e2===_0xeabc('0xbb')||_0x5016e2===_0xeabc('0xbc')||_0x5016e2==='IntegerAttributeMetadata'||_0x5016e2===_0xeabc('0xbd')||_0x5016e2===_0xeabc('0xbe')||_0x5016e2===_0xeabc('0xbf')||_0x5016e2==='EntityNameAttributeMetadata'||_0x5016e2===_0xeabc('0xc0')||_0x5016e2===_0xeabc('0xc1')){_0x5e97b5[_0xeabc('0xb7')](getInputList(_0x5ea2e3,_0x1559dc,_0x5016e2,_0x4bf689,_0x287f88[_0xeabc('0xb0')],_0x57ce9b[_0xeabc('0xb0')],_0x4f406b));}}});return Promise['all'](_0x5e97b5);})[_0xeabc('0x34')](function(_0x418728){_0x30e9eb=_0x418728[0x0];var _0x4d6267=_0x485040[_0xeabc('0x9f')](_0x56b7d0)[_0xeabc('0x9f')](_0x30e9eb);var _0x4e820b={'count':_0x4d6267[_0xeabc('0x43')],'rows':_0x4d6267};return _0x4e820b;})[_0xeabc('0x34')](respondWithResult(_0x2509a4,null))[_0xeabc('0x27')](function(_0x307d26){var _0xfcc0=_0x4b9614[_0xeabc('0x3e')][_0xeabc('0xc2')]?0x1f4:_0x307d26[_0xeabc('0xc3')]||0x1f4;logger[_0xeabc('0x22')](_0x307d26[_0xeabc('0x36')]);delete _0x307d26[_0xeabc('0x37')];if(_0xfcc0===0x191){_0xfcc0=0x190;}_0x2509a4[_0xeabc('0x2a')](_0xfcc0)[_0xeabc('0x38')](_0x4b9614['query']['test']?{'message':_0xeabc('0xc4'),'statusCode':_0x307d26[_0xeabc('0xc3')]}:_0x307d26);});};function getSelectList(_0x2006ba,_0x2d4ca9,_0x5805c9,_0x1cc278,_0x510021,_0x49fba2){var _0x5b26a6={'method':'GET','uri':_0x2006ba+'EntityDefinitions('+_0x1cc278+')/Attributes('+_0x510021+_0xeabc('0xc5')+_0xeabc('0xc6'),'headers':{'Authorization':_0xeabc('0xad')+_0x49fba2,'If-None-Match':null,'OData-Version':_0xeabc('0xae')},'json':!![]};return rp(_0x5b26a6)[_0xeabc('0x34')](function(_0xe27492){var _0x152d99=[];var _0x3eaedf=_0xe27492[_0xeabc('0xc7')]['Options'];_0x3eaedf[_0xeabc('0xb5')](function(_0x10b35b){_0x152d99[_0xeabc('0xb7')]({'name':_0x10b35b[_0xeabc('0xc8')][_0xeabc('0xc9')][_0xeabc('0xc8')],'value':String(_0x10b35b[_0xeabc('0xca')])});});var _0x5bb5d6={'id':_0x2d4ca9+'_'+_0xe27492[_0xeabc('0xb4')],'name':_0xe27492['DisplayName'][_0xeabc('0xc9')][_0xeabc('0xc8')],'custom':![],'options':_0x152d99};_0x5805c9['push'](_0x5bb5d6);return _0x5805c9;});}function getBooleanList(_0x1b8782,_0x4c8bf3,_0x23529f,_0x241ead,_0x8f9cb6,_0x11ec16){var _0x45145c={'method':_0xeabc('0xb1'),'uri':_0x1b8782+_0xeabc('0xcb')+_0x241ead+_0xeabc('0xcc')+_0x8f9cb6+_0xeabc('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x11ec16,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45145c)[_0xeabc('0x34')](function(_0x44e6be){var _0x5f1e61=[];_0x5f1e61[_0xeabc('0xb7')]({'name':_0x44e6be['OptionSet'][_0xeabc('0xce')][_0xeabc('0xc8')][_0xeabc('0xc9')][_0xeabc('0xc8')],'value':_0xeabc('0xcf')},{'name':_0x44e6be[_0xeabc('0xc7')]['FalseOption'][_0xeabc('0xc8')]['UserLocalizedLabel'][_0xeabc('0xc8')],'value':_0xeabc('0xd0')});var _0x1fa464={'id':_0x4c8bf3+'_'+_0x44e6be[_0xeabc('0xb4')],'name':_0x44e6be['DisplayName'][_0xeabc('0xc9')][_0xeabc('0xc8')],'custom':![],'options':_0x5f1e61};_0x23529f[_0xeabc('0xb7')](_0x1fa464);return _0x23529f;});}function getInputList(_0x47b513,_0x13601f,_0x40f9a9,_0xf4ebc4,_0x53dd5c,_0x4d8faa,_0x584783){var _0x49b434={'method':_0xeabc('0xb1'),'uri':_0x47b513+_0xeabc('0xcb')+_0x53dd5c+')/Attributes('+_0x4d8faa+_0xeabc('0xd1')+_0x40f9a9+_0xeabc('0xd2'),'headers':{'Authorization':_0xeabc('0xad')+_0x584783,'If-None-Match':null,'OData-Version':_0xeabc('0xae')},'json':!![]};return rp(_0x49b434)[_0xeabc('0x34')](function(_0x17fe7a){var _0x26917c={'id':_0x13601f+'_'+_0x17fe7a[_0xeabc('0xb4')],'name':_0x17fe7a[_0xeabc('0xd3')]['UserLocalizedLabel']?_0x17fe7a[_0xeabc('0xd3')]['UserLocalizedLabel'][_0xeabc('0xc8')]:_0x17fe7a[_0xeabc('0xb4')],'custom':![],'options':[]};_0xf4ebc4[_0xeabc('0xb7')](_0x26917c);return _0xf4ebc4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index fc870d4..dadfbb0 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 _0x76a9=['Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','moment','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1c478f,_0x34b42e){var _0x41e139=function(_0x1359cb){while(--_0x1359cb){_0x1c478f['push'](_0x1c478f['shift']());}};_0x41e139(++_0x34b42e);}(_0x76a9,0x110));var _0x976a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x76a9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x976a('0x0'));var util=require(_0x976a('0x1'));var logger=require(_0x976a('0x2'))('api');var moment=require(_0x976a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x976a('0x4'));var rimraf=require('rimraf');var config=require(_0x976a('0x5'));var attributes=require(_0x976a('0x6'));var integrations=require(_0x976a('0x7'));module['exports']=function(_0x3b29ca,_0x55932b){return _0x3b29ca['define'](_0x976a('0x8'),attributes,{'tableName':_0x976a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0414=['moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','int_dynamics365_accounts','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0414,0x1e8));var _0x4041=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x0414[_0x305486];return _0xa04940;};'use strict';var _=require(_0x4041('0x0'));var util=require('util');var logger=require(_0x4041('0x1'))('api');var moment=require(_0x4041('0x2'));var BPromise=require(_0x4041('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4041('0x4'));var rimraf=require(_0x4041('0x5'));var config=require(_0x4041('0x6'));var attributes=require(_0x4041('0x7'));var integrations=require(_0x4041('0x8'));module['exports']=function(_0x10b90f,_0x4837bf){return _0x10b90f['define']('Dynamics365Account',attributes,{'tableName':_0x4041('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 5e3b5d7..f0becf2 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 _0x0755=['Dynamics365Account','findAll','options','where','include','map','attributes','model','debug','ShowDynamics365Account','find','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account'];(function(_0x474ba7,_0x1e52fe){var _0x5c99b0=function(_0x17d764){while(--_0x17d764){_0x474ba7['push'](_0x474ba7['shift']());}};_0x5c99b0(++_0x1e52fe);}(_0x0755,0x7c));var _0x5075=function(_0xc4f496,_0x5562d3){_0xc4f496=_0xc4f496-0x0;var _0x542d6c=_0x0755[_0xc4f496];return _0x542d6c;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var moment=require(_0x5075('0x2'));var BPromise=require(_0x5075('0x3'));var rs=require(_0x5075('0x4'));var fs=require('fs');var Redis=require(_0x5075('0x5'));var db=require(_0x5075('0x6'))['db'];var utils=require(_0x5075('0x7'));var logger=require(_0x5075('0x8'))(_0x5075('0x9'));var config=require('../../config/environment');var jayson=require(_0x5075('0xa'));var client=jayson[_0x5075('0xb')][_0x5075('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e39f4,_0x57f9e8,_0x52bb37){return new BPromise(function(_0x4f882e,_0x41d88f){return client[_0x5075('0xd')](_0x2e39f4,_0x52bb37)['then'](function(_0x1782e9){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x57f9e8,_0x5075('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x57f9e8,_0x5075('0xe'),JSON[_0x5075('0xf')](_0x1782e9));if(_0x1782e9[_0x5075('0x10')]){if(_0x1782e9['error'][_0x5075('0x11')]===0x1f4){logger['error'](_0x5075('0x12'),_0x57f9e8,_0x1782e9[_0x5075('0x10')][_0x5075('0x13')]);return _0x41d88f(_0x1782e9[_0x5075('0x10')][_0x5075('0x13')]);}logger[_0x5075('0x10')](_0x5075('0x12'),_0x57f9e8,_0x1782e9[_0x5075('0x10')][_0x5075('0x13')]);return _0x4f882e(_0x1782e9[_0x5075('0x10')][_0x5075('0x13')]);}else{logger[_0x5075('0x14')](_0x5075('0x12'),_0x57f9e8,'request\x20sent');_0x4f882e(_0x1782e9[_0x5075('0x15')][_0x5075('0x13')]);}})[_0x5075('0x16')](function(_0x381b3b){logger[_0x5075('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x57f9e8,_0x381b3b);_0x41d88f(_0x381b3b);});});}exports[_0x5075('0x17')]=function(_0xc8b69a){var _0x4dbe45=this;return new Promise(function(_0x2159a8,_0x2beeaf){return db[_0x5075('0x18')][_0x5075('0x19')]({'raw':_0xc8b69a['options']?_0xc8b69a[_0x5075('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xc8b69a[_0x5075('0x1a')]?_0xc8b69a['options'][_0x5075('0x1b')]||null:null,'attributes':_0xc8b69a['options']?_0xc8b69a[_0x5075('0x1a')]['attributes']||null:null,'limit':_0xc8b69a[_0x5075('0x1a')]?_0xc8b69a[_0x5075('0x1a')]['limit']||null:null,'include':_0xc8b69a['options']?_0xc8b69a['options'][_0x5075('0x1c')]?_[_0x5075('0x1d')](_0xc8b69a[_0x5075('0x1a')][_0x5075('0x1c')],function(_0x1d7758){return{'model':db[_0x1d7758['model']],'as':_0x1d7758['as'],'attributes':_0x1d7758[_0x5075('0x1e')],'include':_0x1d7758[_0x5075('0x1c')]?_[_0x5075('0x1d')](_0x1d7758['include'],function(_0x1f16cc){return{'model':db[_0x1f16cc[_0x5075('0x1f')]],'as':_0x1f16cc['as'],'attributes':_0x1f16cc['attributes'],'include':_0x1f16cc[_0x5075('0x1c')]?_[_0x5075('0x1d')](_0x1f16cc[_0x5075('0x1c')],function(_0x38a4ea){return{'model':db[_0x38a4ea['model']],'as':_0x38a4ea['as'],'attributes':_0x38a4ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b3d0b){logger[_0x5075('0x14')]('GetDynamics365Account',_0xc8b69a);logger[_0x5075('0x20')](_0x5075('0x17'),_0xc8b69a,JSON[_0x5075('0xf')](_0x3b3d0b));_0x2159a8(_0x3b3d0b);})['catch'](function(_0x264777){logger['error']('GetDynamics365Account',_0x264777[_0x5075('0x13')],_0xc8b69a);_0x2beeaf(_0x4dbe45[_0x5075('0x10')](0x1f4,_0x264777[_0x5075('0x13')]));});});};exports[_0x5075('0x21')]=function(_0x5e87b0){var _0x362711=this;return new Promise(function(_0x1edab4,_0x8290e7){return db['Dynamics365Account'][_0x5075('0x22')]({'raw':_0x5e87b0[_0x5075('0x1a')]?_0x5e87b0[_0x5075('0x1a')][_0x5075('0x23')]===undefined?!![]:![]:!![],'where':_0x5e87b0['options']?_0x5e87b0[_0x5075('0x1a')][_0x5075('0x1b')]||null:null,'attributes':_0x5e87b0[_0x5075('0x1a')]?_0x5e87b0['options'][_0x5075('0x1e')]||null:null,'include':_0x5e87b0[_0x5075('0x1a')]?_0x5e87b0[_0x5075('0x1a')][_0x5075('0x1c')]?_[_0x5075('0x1d')](_0x5e87b0['options'][_0x5075('0x1c')],function(_0x305b99){return{'model':db[_0x305b99['model']],'as':_0x305b99['as'],'attributes':_0x305b99[_0x5075('0x1e')],'include':_0x305b99['include']?_['map'](_0x305b99['include'],function(_0x1a5e7c){return{'model':db[_0x1a5e7c[_0x5075('0x1f')]],'as':_0x1a5e7c['as'],'attributes':_0x1a5e7c[_0x5075('0x1e')],'include':_0x1a5e7c['include']?_[_0x5075('0x1d')](_0x1a5e7c['include'],function(_0x50c23d){return{'model':db[_0x50c23d[_0x5075('0x1f')]],'as':_0x50c23d['as'],'attributes':_0x50c23d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5075('0x24')](function(_0x1e0435){logger['info'](_0x5075('0x21'),_0x5e87b0);logger[_0x5075('0x20')](_0x5075('0x21'),_0x5e87b0,JSON['stringify'](_0x1e0435));_0x1edab4(_0x1e0435);})[_0x5075('0x16')](function(_0x32af7f){logger[_0x5075('0x10')](_0x5075('0x21'),_0x32af7f[_0x5075('0x13')],_0x5e87b0);_0x8290e7(_0x362711[_0x5075('0x10')](0x1f4,_0x32af7f[_0x5075('0x13')]));});});}; \ No newline at end of file +var _0x176c=['then','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','map','include','model'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x176c,0x134));var _0xc176=function(_0x3e1e8d,_0x1cd9f2){_0x3e1e8d=_0x3e1e8d-0x0;var _0x2713a2=_0x176c[_0x3e1e8d];return _0x2713a2;};'use strict';var _=require(_0xc176('0x0'));var util=require(_0xc176('0x1'));var moment=require(_0xc176('0x2'));var BPromise=require(_0xc176('0x3'));var rs=require(_0xc176('0x4'));var fs=require('fs');var Redis=require(_0xc176('0x5'));var db=require(_0xc176('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc176('0x7'))(_0xc176('0x8'));var config=require('../../config/environment');var jayson=require(_0xc176('0x9'));var client=jayson[_0xc176('0xa')][_0xc176('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55595c,_0x243f57,_0x3b9798){return new BPromise(function(_0x71eb43,_0x121444){return client[_0xc176('0xc')](_0x55595c,_0x3b9798)['then'](function(_0x376b20){logger[_0xc176('0xd')](_0xc176('0xe'),_0x243f57,'request\x20sent');logger[_0xc176('0xf')](_0xc176('0x10'),_0x243f57,_0xc176('0x11'),JSON[_0xc176('0x12')](_0x376b20));if(_0x376b20[_0xc176('0x13')]){if(_0x376b20[_0xc176('0x13')][_0xc176('0x14')]===0x1f4){logger[_0xc176('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x243f57,_0x376b20[_0xc176('0x13')][_0xc176('0x15')]);return _0x121444(_0x376b20[_0xc176('0x13')][_0xc176('0x15')]);}logger[_0xc176('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x243f57,_0x376b20[_0xc176('0x13')][_0xc176('0x15')]);return _0x71eb43(_0x376b20[_0xc176('0x13')]['message']);}else{logger[_0xc176('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x243f57,_0xc176('0x11'));_0x71eb43(_0x376b20[_0xc176('0x16')]['message']);}})[_0xc176('0x17')](function(_0x233ced){logger[_0xc176('0x13')](_0xc176('0xe'),_0x243f57,_0x233ced);_0x121444(_0x233ced);});});}exports[_0xc176('0x18')]=function(_0x284bb8){var _0x5e081a=this;return new Promise(function(_0x2631ec,_0x590786){return db[_0xc176('0x19')][_0xc176('0x1a')]({'raw':_0x284bb8[_0xc176('0x1b')]?_0x284bb8[_0xc176('0x1b')][_0xc176('0x1c')]===undefined?!![]:![]:!![],'where':_0x284bb8[_0xc176('0x1b')]?_0x284bb8['options']['where']||null:null,'attributes':_0x284bb8[_0xc176('0x1b')]?_0x284bb8['options'][_0xc176('0x1d')]||null:null,'limit':_0x284bb8['options']?_0x284bb8[_0xc176('0x1b')][_0xc176('0x1e')]||null:null,'include':_0x284bb8[_0xc176('0x1b')]?_0x284bb8['options']['include']?_[_0xc176('0x1f')](_0x284bb8[_0xc176('0x1b')][_0xc176('0x20')],function(_0x789775){return{'model':db[_0x789775['model']],'as':_0x789775['as'],'attributes':_0x789775[_0xc176('0x1d')],'include':_0x789775['include']?_[_0xc176('0x1f')](_0x789775['include'],function(_0x5049f8){return{'model':db[_0x5049f8[_0xc176('0x21')]],'as':_0x5049f8['as'],'attributes':_0x5049f8[_0xc176('0x1d')],'include':_0x5049f8[_0xc176('0x20')]?_[_0xc176('0x1f')](_0x5049f8[_0xc176('0x20')],function(_0x147569){return{'model':db[_0x147569[_0xc176('0x21')]],'as':_0x147569['as'],'attributes':_0x147569[_0xc176('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc176('0x22')](function(_0x3f5509){logger[_0xc176('0xd')](_0xc176('0x18'),_0x284bb8);logger[_0xc176('0xf')](_0xc176('0x18'),_0x284bb8,JSON[_0xc176('0x12')](_0x3f5509));_0x2631ec(_0x3f5509);})[_0xc176('0x17')](function(_0x44097c){logger['error']('GetDynamics365Account',_0x44097c[_0xc176('0x15')],_0x284bb8);_0x590786(_0x5e081a[_0xc176('0x13')](0x1f4,_0x44097c[_0xc176('0x15')]));});});};exports[_0xc176('0x23')]=function(_0x3c7c1b){var _0x2034fe=this;return new Promise(function(_0x2d3eb1,_0x5a4bd1){return db['Dynamics365Account'][_0xc176('0x24')]({'raw':_0x3c7c1b[_0xc176('0x1b')]?_0x3c7c1b[_0xc176('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3c7c1b[_0xc176('0x1b')]?_0x3c7c1b[_0xc176('0x1b')][_0xc176('0x25')]||null:null,'attributes':_0x3c7c1b[_0xc176('0x1b')]?_0x3c7c1b[_0xc176('0x1b')][_0xc176('0x1d')]||null:null,'include':_0x3c7c1b[_0xc176('0x1b')]?_0x3c7c1b[_0xc176('0x1b')]['include']?_['map'](_0x3c7c1b[_0xc176('0x1b')][_0xc176('0x20')],function(_0xf4d3d1){return{'model':db[_0xf4d3d1[_0xc176('0x21')]],'as':_0xf4d3d1['as'],'attributes':_0xf4d3d1[_0xc176('0x1d')],'include':_0xf4d3d1[_0xc176('0x20')]?_[_0xc176('0x1f')](_0xf4d3d1['include'],function(_0xee90b2){return{'model':db[_0xee90b2[_0xc176('0x21')]],'as':_0xee90b2['as'],'attributes':_0xee90b2[_0xc176('0x1d')],'include':_0xee90b2['include']?_[_0xc176('0x1f')](_0xee90b2[_0xc176('0x20')],function(_0x44840f){return{'model':db[_0x44840f[_0xc176('0x21')]],'as':_0x44840f['as'],'attributes':_0x44840f[_0xc176('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc176('0x22')](function(_0xcaa2ad){logger[_0xc176('0xd')]('ShowDynamics365Account',_0x3c7c1b);logger[_0xc176('0xf')](_0xc176('0x23'),_0x3c7c1b,JSON['stringify'](_0xcaa2ad));_0x2d3eb1(_0xcaa2ad);})[_0xc176('0x17')](function(_0x196cb0){logger[_0xc176('0x13')](_0xc176('0x23'),_0x196cb0[_0xc176('0x15')],_0x3c7c1b);_0x5a4bd1(_0x2034fe[_0xc176('0x13')](0x1f4,_0x196cb0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1165815..1eef916 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 _0xad9f=['../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x10f989,_0x252f30){var _0x39d925=function(_0x44c2d9){while(--_0x44c2d9){_0x10f989['push'](_0x10f989['shift']());}};_0x39d925(++_0x252f30);}(_0xad9f,0x94));var _0xfad9=function(_0x155757,_0x598159){_0x155757=_0x155757-0x0;var _0x3fc594=_0xad9f[_0x155757];return _0x3fc594;};'use strict';var multer=require(_0xfad9('0x0'));var util=require(_0xfad9('0x1'));var path=require('path');var timeout=require(_0xfad9('0x2'));var express=require(_0xfad9('0x3'));var router=express[_0xfad9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfad9('0x5'));var config=require(_0xfad9('0x6'));var controller=require(_0xfad9('0x7'));router[_0xfad9('0x8')]('/',auth['isAuthenticated'](),controller[_0xfad9('0x9')]);router[_0xfad9('0x8')](_0xfad9('0xa'),auth[_0xfad9('0xb')](),controller[_0xfad9('0xc')]);router[_0xfad9('0x8')](_0xfad9('0xd'),auth['isAuthenticated'](),controller[_0xfad9('0xe')]);router[_0xfad9('0x8')](_0xfad9('0xf'),auth[_0xfad9('0xb')](),controller[_0xfad9('0x10')]);router['get'](_0xfad9('0x11'),auth[_0xfad9('0xb')](),controller[_0xfad9('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfad9('0xa'),auth[_0xfad9('0xb')](),controller[_0xfad9('0x13')]);router[_0xfad9('0x14')](_0xfad9('0xa'),auth[_0xfad9('0xb')](),controller[_0xfad9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x23f7=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x21b8ba,_0x12507a){var _0x3cd69f=function(_0x2ffd83){while(--_0x2ffd83){_0x21b8ba['push'](_0x21b8ba['shift']());}};_0x3cd69f(++_0x12507a);}(_0x23f7,0x1bf));var _0x723f=function(_0x3a7e0c,_0x122a82){_0x3a7e0c=_0x3a7e0c-0x0;var _0x2ba60e=_0x23f7[_0x3a7e0c];return _0x2ba60e;};'use strict';var multer=require(_0x723f('0x0'));var util=require(_0x723f('0x1'));var path=require(_0x723f('0x2'));var timeout=require(_0x723f('0x3'));var express=require(_0x723f('0x4'));var router=express[_0x723f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x723f('0x6'));var config=require(_0x723f('0x7'));var controller=require(_0x723f('0x8'));router[_0x723f('0x9')]('/',auth[_0x723f('0xa')](),controller[_0x723f('0xb')]);router[_0x723f('0x9')](_0x723f('0xc'),auth[_0x723f('0xa')](),controller[_0x723f('0xd')]);router[_0x723f('0x9')]('/:id/fields',auth[_0x723f('0xa')](),controller[_0x723f('0xe')]);router[_0x723f('0x9')](_0x723f('0xf'),auth[_0x723f('0xa')](),controller[_0x723f('0x10')]);router[_0x723f('0x9')](_0x723f('0x11'),auth[_0x723f('0xa')](),controller[_0x723f('0x12')]);router[_0x723f('0x13')]('/',auth[_0x723f('0xa')](),controller['create']);router['put'](_0x723f('0xc'),auth[_0x723f('0xa')](),controller['update']);router['delete'](_0x723f('0xc'),auth[_0x723f('0xa')](),controller['destroy']);module[_0x723f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e83b142..f60e535 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 _0x5739=['STRING','ENUM','phonecall','exports'];(function(_0x3cda26,_0x31a42a){var _0x45469f=function(_0x27a69d){while(--_0x27a69d){_0x3cda26['push'](_0x3cda26['shift']());}};_0x45469f(++_0x31a42a);}(_0x5739,0x137));var _0x9573=function(_0x439c71,_0x1e8983){_0x439c71=_0x439c71-0x0;var _0x55080f=_0x5739[_0x439c71];return _0x55080f;};'use strict';var Sequelize=require('sequelize');module[_0x9573('0x0')]={'name':{'type':Sequelize[_0x9573('0x1')]},'description':{'type':Sequelize[_0x9573('0x1')]},'ticketType':{'type':Sequelize[_0x9573('0x2')]('incident',_0x9573('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x57b1=['STRING','ENUM','incident','exports'];(function(_0x213c9a,_0x2bc2a0){var _0x42809c=function(_0x1f52d8){while(--_0x1f52d8){_0x213c9a['push'](_0x213c9a['shift']());}};_0x42809c(++_0x2bc2a0);}(_0x57b1,0x1e3));var _0x157b=function(_0x10676a,_0x7bef3d){_0x10676a=_0x10676a-0x0;var _0x541cbd=_0x57b1[_0x10676a];return _0x541cbd;};'use strict';var Sequelize=require('sequelize');module[_0x157b('0x0')]={'name':{'type':Sequelize[_0x157b('0x1')]},'description':{'type':Sequelize[_0x157b('0x1')]},'ticketType':{'type':Sequelize[_0x157b('0x2')]('incident','phonecall'),'defaultValue':_0x157b('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 70ef775..a53230d 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 _0x234c=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','end','json','offset','limit','set','Content-Range','update','sendStatus','stack','send','index','map','Dynamics365Configuration','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','params','keys','rawAttributes','include','options','find','create','body','destroy','getFields','findOne','order','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5a5e19,_0x49e292){var _0x198904=function(_0x4ce581){while(--_0x4ce581){_0x5a5e19['push'](_0x5a5e19['shift']());}};_0x198904(++_0x49e292);}(_0x234c,0x9b));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc234('0x0'));var emlformat=require(_0xc234('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc234('0x2'));var jsonpatch=require(_0xc234('0x3'));var rp=require('request-promise');var moment=require(_0xc234('0x4'));var BPromise=require(_0xc234('0x5'));var Mustache=require(_0xc234('0x6'));var util=require(_0xc234('0x7'));var path=require(_0xc234('0x8'));var sox=require(_0xc234('0x9'));var csv=require(_0xc234('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc234('0xb'));var squel=require('squel');var crypto=require(_0xc234('0xc'));var jsforce=require(_0xc234('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc234('0xa'));var querystring=require(_0xc234('0xe'));var Papa=require('papaparse');var Redis=require(_0xc234('0xf'));var authService=require(_0xc234('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc234('0x11'));var hardwareService=require(_0xc234('0x12'));var logger=require(_0xc234('0x13'))(_0xc234('0x14'));var utils=require(_0xc234('0x15'));var config=require(_0xc234('0x16'));var licenseUtil=require(_0xc234('0x17'));var db=require(_0xc234('0x18'))['db'];var jayson=require(_0xc234('0x19'));var client=jayson[_0xc234('0x1a')][_0xc234('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5cf237,_0x30dc81,_0xd1fe81,_0x2542e5){return new BPromise(function(_0x574729,_0x431ba7){var _0x1870de=_0x2542e5||client;return _0x1870de['request'](_0x5cf237,_0xd1fe81)[_0xc234('0x1c')](function(_0x152705){logger['info'](_0xc234('0x1d'),_0x30dc81,_0xc234('0x1e'));logger['debug'](_0xc234('0x1f'),_0x30dc81,_0xc234('0x1e'),JSON['stringify'](_0x152705));if(_0x152705[_0xc234('0x20')]){if(_0x152705[_0xc234('0x20')][_0xc234('0x21')]===0x1f4){logger['error'](_0xc234('0x1d'),_0x30dc81,_0x152705[_0xc234('0x20')][_0xc234('0x22')]);return _0x431ba7(_0x152705[_0xc234('0x20')][_0xc234('0x22')]);}logger['error'](_0xc234('0x1d'),_0x30dc81,_0x152705[_0xc234('0x20')]['message']);return _0x574729(_0x152705[_0xc234('0x20')][_0xc234('0x22')]);}else{logger[_0xc234('0x23')](_0xc234('0x1d'),_0x30dc81,'request\x20sent');_0x574729(_0x152705['result'][_0xc234('0x22')]);}})[_0xc234('0x24')](function(_0x2c68f5){logger[_0xc234('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x30dc81,_0x2c68f5);_0x431ba7(_0x2c68f5);});});}function respondWithStatusCode(_0x4c0f2d,_0x5da7d5){_0x5da7d5=_0x5da7d5||0xcc;return function(_0x2a12f0){if(_0x2a12f0){return _0x4c0f2d['sendStatus'](_0x5da7d5);}return _0x4c0f2d[_0xc234('0x25')](_0x5da7d5)[_0xc234('0x26')]();};}function respondWithResult(_0x1e5493,_0x2081d2){_0x2081d2=_0x2081d2||0xc8;return function(_0x14706e){if(_0x14706e){return _0x1e5493[_0xc234('0x25')](_0x2081d2)[_0xc234('0x27')](_0x14706e);}};}function respondWithFilteredResult(_0x4fe7d8,_0x20ce83){return function(_0x26d436){if(_0x26d436){var _0x10bf7d=_0x26d436['count'],_0x207a32=_0x20ce83[_0xc234('0x28')],_0x5187de=_0x20ce83[_0xc234('0x28')]+_0x20ce83[_0xc234('0x29')],_0x316771;if(_0x5187de>=_0x10bf7d){_0x5187de=_0x10bf7d;_0x316771=0xc8;}else{_0x316771=0xce;}_0x4fe7d8[_0xc234('0x25')](_0x316771);return _0x4fe7d8[_0xc234('0x2a')](_0xc234('0x2b'),_0x207a32+'-'+_0x5187de+'/'+_0x10bf7d)[_0xc234('0x27')](_0x26d436);}return null;};}function patchUpdates(_0x234cbd){return function(_0x4e7c44){try{jsonpatch['apply'](_0x4e7c44,_0x234cbd,!![]);}catch(_0x53e8b5){return BPromise['reject'](_0x53e8b5);}return _0x4e7c44['save']();};}function saveUpdates(_0x1b302b,_0x4dcbef){return function(_0x55394c){if(_0x55394c){return _0x55394c[_0xc234('0x2c')](_0x1b302b)[_0xc234('0x1c')](function(_0xba1df7){return _0xba1df7;});}return null;};}function removeEntity(_0x5cf465,_0x43ee9c){return function(_0x10aab8){if(_0x10aab8){return _0x10aab8['destroy']()[_0xc234('0x1c')](function(){_0x5cf465[_0xc234('0x25')](0xcc)[_0xc234('0x26')]();});}};}function handleEntityNotFound(_0x562a09,_0xfc83fe){return function(_0x296cf7){if(!_0x296cf7){_0x562a09[_0xc234('0x2d')](0x194);}return _0x296cf7;};}function handleError(_0x59a544,_0x5911cf){_0x5911cf=_0x5911cf||0x1f4;return function(_0x511eb7){logger['error'](_0x511eb7[_0xc234('0x2e')]);if(_0x511eb7['name']){delete _0x511eb7['name'];}_0x59a544[_0xc234('0x25')](_0x5911cf)[_0xc234('0x2f')](_0x511eb7);};}exports[_0xc234('0x30')]=function(_0x499c98,_0x33b0e6){var _0x36875a={},_0x491295={},_0x4d5a82={'count':0x0,'rows':[]};var _0x2e7f4d=_[_0xc234('0x31')](db[_0xc234('0x32')]['rawAttributes'],function(_0x80daee){return{'name':_0x80daee[_0xc234('0x33')],'type':_0x80daee[_0xc234('0x34')]['key']};});_0x491295[_0xc234('0x35')]=_[_0xc234('0x31')](_0x2e7f4d,_0xc234('0x36'));_0x491295[_0xc234('0x37')]=_['keys'](_0x499c98[_0xc234('0x37')]);_0x491295[_0xc234('0x38')]=_[_0xc234('0x39')](_0x491295[_0xc234('0x35')],_0x491295[_0xc234('0x37')]);_0x36875a[_0xc234('0x3a')]=_['intersection'](_0x491295[_0xc234('0x35')],qs['fields'](_0x499c98[_0xc234('0x37')][_0xc234('0x3b')]));_0x36875a['attributes']=_0x36875a['attributes'][_0xc234('0x3c')]?_0x36875a[_0xc234('0x3a')]:_0x491295[_0xc234('0x35')];if(!_0x499c98[_0xc234('0x37')][_0xc234('0x3d')](_0xc234('0x3e'))){_0x36875a[_0xc234('0x29')]=qs['limit'](_0x499c98[_0xc234('0x37')][_0xc234('0x29')]);_0x36875a[_0xc234('0x28')]=qs['offset'](_0x499c98['query']['offset']);}_0x36875a['order']=qs[_0xc234('0x3f')](_0x499c98[_0xc234('0x37')]['sort']);_0x36875a[_0xc234('0x40')]=qs[_0xc234('0x38')](_[_0xc234('0x41')](_0x499c98[_0xc234('0x37')],_0x491295[_0xc234('0x38')]),_0x2e7f4d);if(_0x499c98[_0xc234('0x37')][_0xc234('0x42')]){_0x36875a[_0xc234('0x40')]=_[_0xc234('0x43')](_0x36875a['where'],{'$or':_[_0xc234('0x31')](_0x2e7f4d,function(_0x381c6c){if(_0x381c6c[_0xc234('0x34')]!==_0xc234('0x44')){var _0x36d85d={};_0x36d85d[_0x381c6c[_0xc234('0x36')]]={'$like':'%'+_0x499c98['query'][_0xc234('0x42')]+'%'};return _0x36d85d;}})});}_0x36875a=_[_0xc234('0x43')]({},_0x36875a,_0x499c98['options']);var _0x484b00={'where':_0x36875a[_0xc234('0x40')]};return db['Dynamics365Configuration'][_0xc234('0x45')](_0x484b00)[_0xc234('0x1c')](function(_0x424bd4){_0x4d5a82[_0xc234('0x45')]=_0x424bd4;if(_0x499c98[_0xc234('0x37')][_0xc234('0x46')]){_0x36875a['include']=[{'all':!![]}];}return db[_0xc234('0x32')][_0xc234('0x47')](_0x36875a);})[_0xc234('0x1c')](function(_0x4761bb){_0x4d5a82[_0xc234('0x48')]=_0x4761bb;return _0x4d5a82;})[_0xc234('0x1c')](respondWithFilteredResult(_0x33b0e6,_0x36875a))[_0xc234('0x24')](handleError(_0x33b0e6,null));};exports['show']=function(_0x5a78ff,_0x174ac1){var _0x2a042={'raw':![],'where':{'id':_0x5a78ff[_0xc234('0x49')]['id']}},_0x4960c5={};_0x4960c5['model']=_[_0xc234('0x4a')](db[_0xc234('0x32')][_0xc234('0x4b')]);_0x4960c5['query']=_['keys'](_0x5a78ff[_0xc234('0x37')]);_0x4960c5['filters']=_[_0xc234('0x39')](_0x4960c5['model'],_0x4960c5['query']);_0x2a042[_0xc234('0x3a')]=_[_0xc234('0x39')](_0x4960c5[_0xc234('0x35')],qs[_0xc234('0x3b')](_0x5a78ff[_0xc234('0x37')]['fields']));_0x2a042[_0xc234('0x3a')]=_0x2a042[_0xc234('0x3a')]['length']?_0x2a042[_0xc234('0x3a')]:_0x4960c5[_0xc234('0x35')];if(_0x5a78ff[_0xc234('0x37')]['includeAll']){_0x2a042[_0xc234('0x4c')]=[{'all':!![]}];}_0x2a042=_[_0xc234('0x43')]({},_0x2a042,_0x5a78ff[_0xc234('0x4d')]);return db['Dynamics365Configuration'][_0xc234('0x4e')](_0x2a042)[_0xc234('0x1c')](handleEntityNotFound(_0x174ac1,null))[_0xc234('0x1c')](respondWithResult(_0x174ac1,null))[_0xc234('0x24')](handleError(_0x174ac1,null));};exports[_0xc234('0x4f')]=function(_0x348940,_0x41daa1){return db['Dynamics365Configuration'][_0xc234('0x4f')](_0x348940['body'],{})[_0xc234('0x1c')](respondWithResult(_0x41daa1,0xc9))['catch'](handleError(_0x41daa1,null));};exports[_0xc234('0x2c')]=function(_0x36fabc,_0x18be4d){if(_0x36fabc['body']['id']){delete _0x36fabc[_0xc234('0x50')]['id'];}return db[_0xc234('0x32')][_0xc234('0x4e')]({'where':{'id':_0x36fabc[_0xc234('0x49')]['id']}})[_0xc234('0x1c')](handleEntityNotFound(_0x18be4d,null))[_0xc234('0x1c')](saveUpdates(_0x36fabc['body'],null))[_0xc234('0x1c')](respondWithResult(_0x18be4d,null))[_0xc234('0x24')](handleError(_0x18be4d,null));};exports[_0xc234('0x51')]=function(_0x4d4bdc,_0x45ab3d){return db['Dynamics365Configuration']['find']({'where':{'id':_0x4d4bdc[_0xc234('0x49')]['id']}})[_0xc234('0x1c')](handleEntityNotFound(_0x45ab3d,null))['then'](removeEntity(_0x45ab3d,null))['catch'](handleError(_0x45ab3d,null));};exports[_0xc234('0x52')]=function(_0x4ebd8e,_0x19ff4c,_0x3dc36f){var _0x518aca={};var _0x232190={};var _0x444470;var _0x18dcd1;return db[_0xc234('0x32')][_0xc234('0x53')]({'where':{'id':_0x4ebd8e[_0xc234('0x49')]['id']}})[_0xc234('0x1c')](handleEntityNotFound(_0x19ff4c,null))['then'](function(_0x1d0c84){if(_0x1d0c84){_0x444470=_0x1d0c84;_0x232190[_0xc234('0x35')]=_[_0xc234('0x4a')](db['Dynamics365Field']['rawAttributes']);_0x232190['query']=_[_0xc234('0x4a')](_0x4ebd8e[_0xc234('0x37')]);_0x232190[_0xc234('0x38')]=_[_0xc234('0x39')](_0x232190[_0xc234('0x35')],_0x232190[_0xc234('0x37')]);_0x518aca[_0xc234('0x3a')]=_[_0xc234('0x39')](_0x232190[_0xc234('0x35')],qs[_0xc234('0x3b')](_0x4ebd8e[_0xc234('0x37')][_0xc234('0x3b')]));_0x518aca[_0xc234('0x3a')]=_0x518aca['attributes'][_0xc234('0x3c')]?_0x518aca['attributes']:_0x232190[_0xc234('0x35')];_0x518aca[_0xc234('0x54')]=qs['sort'](_0x4ebd8e[_0xc234('0x37')][_0xc234('0x3f')]);_0x518aca['where']=qs[_0xc234('0x38')](_[_0xc234('0x41')](_0x4ebd8e['query'],_0x232190['filters']));if(_0x4ebd8e[_0xc234('0x37')]['filter']){_0x518aca['where']=_[_0xc234('0x43')](_0x518aca[_0xc234('0x40')],{'$or':_[_0xc234('0x31')](_0x518aca[_0xc234('0x3a')],function(_0x3117fa){var _0x25f632={};_0x25f632[_0x3117fa]={'$like':'%'+_0x4ebd8e['query'][_0xc234('0x42')]+'%'};return _0x25f632;})});}_0x518aca=_[_0xc234('0x43')]({},_0x518aca,_0x4ebd8e[_0xc234('0x4d')]);return _0x444470[_0xc234('0x52')](_0x518aca);}})['then'](function(_0x51e661){if(_0x51e661){_0x18dcd1=_0x51e661[_0xc234('0x3c')];if(!_0x4ebd8e['query'][_0xc234('0x3d')](_0xc234('0x3e'))){_0x518aca[_0xc234('0x29')]=qs[_0xc234('0x29')](_0x4ebd8e[_0xc234('0x37')][_0xc234('0x29')]);_0x518aca[_0xc234('0x28')]=qs[_0xc234('0x28')](_0x4ebd8e['query']['offset']);}return _0x444470['getFields'](_0x518aca);}})[_0xc234('0x1c')](function(_0x417ca3){if(_0x417ca3){return _0x417ca3?{'count':_0x18dcd1,'rows':_0x417ca3}:null;}})[_0xc234('0x1c')](respondWithResult(_0x19ff4c,null))[_0xc234('0x24')](handleError(_0x19ff4c,null));};exports['getSubjects']=function(_0x3e26c5,_0x3428d9,_0x37c547){var _0x4942cf={};var _0xd6d1b5={};var _0x10be57;var _0x5ac2ce;return db[_0xc234('0x32')][_0xc234('0x53')]({'where':{'id':_0x3e26c5[_0xc234('0x49')]['id']}})[_0xc234('0x1c')](handleEntityNotFound(_0x3428d9,null))[_0xc234('0x1c')](function(_0x562f83){if(_0x562f83){_0x10be57=_0x562f83;_0xd6d1b5['model']=_['keys'](db['Dynamics365Field']['rawAttributes']);_0xd6d1b5[_0xc234('0x37')]=_[_0xc234('0x4a')](_0x3e26c5[_0xc234('0x37')]);_0xd6d1b5[_0xc234('0x38')]=_[_0xc234('0x39')](_0xd6d1b5['model'],_0xd6d1b5['query']);_0x4942cf[_0xc234('0x3a')]=_[_0xc234('0x39')](_0xd6d1b5[_0xc234('0x35')],qs[_0xc234('0x3b')](_0x3e26c5['query'][_0xc234('0x3b')]));_0x4942cf[_0xc234('0x3a')]=_0x4942cf['attributes'][_0xc234('0x3c')]?_0x4942cf[_0xc234('0x3a')]:_0xd6d1b5[_0xc234('0x35')];_0x4942cf[_0xc234('0x54')]=qs[_0xc234('0x3f')](_0x3e26c5[_0xc234('0x37')][_0xc234('0x3f')]);_0x4942cf[_0xc234('0x40')]=qs[_0xc234('0x38')](_[_0xc234('0x41')](_0x3e26c5[_0xc234('0x37')],_0xd6d1b5[_0xc234('0x38')]));if(_0x3e26c5[_0xc234('0x37')][_0xc234('0x42')]){_0x4942cf[_0xc234('0x40')]=_[_0xc234('0x43')](_0x4942cf['where'],{'$or':_[_0xc234('0x31')](_0x4942cf[_0xc234('0x3a')],function(_0x55dbca){var _0x17106b={};_0x17106b[_0x55dbca]={'$like':'%'+_0x3e26c5['query']['filter']+'%'};return _0x17106b;})});}_0x4942cf=_['merge']({},_0x4942cf,_0x3e26c5[_0xc234('0x4d')]);return _0x10be57[_0xc234('0x55')](_0x4942cf);}})[_0xc234('0x1c')](function(_0x109471){if(_0x109471){_0x5ac2ce=_0x109471[_0xc234('0x3c')];if(!_0x3e26c5['query'][_0xc234('0x3d')](_0xc234('0x3e'))){_0x4942cf[_0xc234('0x29')]=qs[_0xc234('0x29')](_0x3e26c5['query'][_0xc234('0x29')]);_0x4942cf['offset']=qs['offset'](_0x3e26c5[_0xc234('0x37')][_0xc234('0x28')]);}return _0x10be57[_0xc234('0x55')](_0x4942cf);}})[_0xc234('0x1c')](function(_0x148bde){if(_0x148bde){return _0x148bde?{'count':_0x5ac2ce,'rows':_0x148bde}:null;}})['then'](respondWithResult(_0x3428d9,null))[_0xc234('0x24')](handleError(_0x3428d9,null));};exports['getDescriptions']=function(_0x2aeed5,_0x22d2c3,_0x438994){var _0x5daa49={};var _0x1a2581={};var _0x11ebfd;var _0x4ca745;return db[_0xc234('0x32')][_0xc234('0x53')]({'where':{'id':_0x2aeed5[_0xc234('0x49')]['id']}})[_0xc234('0x1c')](handleEntityNotFound(_0x22d2c3,null))[_0xc234('0x1c')](function(_0x4a57ab){if(_0x4a57ab){_0x11ebfd=_0x4a57ab;_0x1a2581[_0xc234('0x35')]=_['keys'](db[_0xc234('0x56')]['rawAttributes']);_0x1a2581[_0xc234('0x37')]=_[_0xc234('0x4a')](_0x2aeed5[_0xc234('0x37')]);_0x1a2581[_0xc234('0x38')]=_[_0xc234('0x39')](_0x1a2581[_0xc234('0x35')],_0x1a2581[_0xc234('0x37')]);_0x5daa49[_0xc234('0x3a')]=_[_0xc234('0x39')](_0x1a2581[_0xc234('0x35')],qs[_0xc234('0x3b')](_0x2aeed5[_0xc234('0x37')]['fields']));_0x5daa49[_0xc234('0x3a')]=_0x5daa49[_0xc234('0x3a')][_0xc234('0x3c')]?_0x5daa49['attributes']:_0x1a2581[_0xc234('0x35')];_0x5daa49['order']=qs[_0xc234('0x3f')](_0x2aeed5[_0xc234('0x37')][_0xc234('0x3f')]);_0x5daa49[_0xc234('0x40')]=qs['filters'](_[_0xc234('0x41')](_0x2aeed5[_0xc234('0x37')],_0x1a2581['filters']));if(_0x2aeed5[_0xc234('0x37')][_0xc234('0x42')]){_0x5daa49[_0xc234('0x40')]=_[_0xc234('0x43')](_0x5daa49[_0xc234('0x40')],{'$or':_[_0xc234('0x31')](_0x5daa49[_0xc234('0x3a')],function(_0x496c12){var _0x367729={};_0x367729[_0x496c12]={'$like':'%'+_0x2aeed5[_0xc234('0x37')][_0xc234('0x42')]+'%'};return _0x367729;})});}_0x5daa49=_[_0xc234('0x43')]({},_0x5daa49,_0x2aeed5[_0xc234('0x4d')]);return _0x11ebfd[_0xc234('0x57')](_0x5daa49);}})[_0xc234('0x1c')](function(_0x42ee6c){if(_0x42ee6c){_0x4ca745=_0x42ee6c[_0xc234('0x3c')];if(!_0x2aeed5[_0xc234('0x37')][_0xc234('0x3d')](_0xc234('0x3e'))){_0x5daa49['limit']=qs[_0xc234('0x29')](_0x2aeed5[_0xc234('0x37')][_0xc234('0x29')]);_0x5daa49['offset']=qs[_0xc234('0x28')](_0x2aeed5[_0xc234('0x37')][_0xc234('0x28')]);}return _0x11ebfd['getDescriptions'](_0x5daa49);}})[_0xc234('0x1c')](function(_0x4f75f6){if(_0x4f75f6){return _0x4f75f6?{'count':_0x4ca745,'rows':_0x4f75f6}:null;}})[_0xc234('0x1c')](respondWithResult(_0x22d2c3,null))[_0xc234('0x24')](handleError(_0x22d2c3,null));}; \ No newline at end of file +var _0x19e1=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','set','apply','save','update','destroy','stack','name','status','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','Dynamics365Configuration','includeAll','include','findAll','rows','show','keys','create','body','find','params','findOne','getFields','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x19e1,0x163));var _0x119e=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x19e1[_0x27e811];return _0x1627fa;};'use strict';var pdf=require(_0x119e('0x0'));var emlformat=require(_0x119e('0x1'));var rimraf=require(_0x119e('0x2'));var zipdir=require(_0x119e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x119e('0x4'));var BPromise=require(_0x119e('0x5'));var Mustache=require('mustache');var util=require(_0x119e('0x6'));var path=require(_0x119e('0x7'));var sox=require('sox');var csv=require(_0x119e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x119e('0x9'));var squel=require(_0x119e('0xa'));var crypto=require(_0x119e('0xb'));var jsforce=require(_0x119e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x119e('0x8'));var querystring=require(_0x119e('0xd'));var Papa=require(_0x119e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x119e('0xf'));var as=require(_0x119e('0x10'));var hardwareService=require(_0x119e('0x11'));var logger=require(_0x119e('0x12'))(_0x119e('0x13'));var utils=require(_0x119e('0x14'));var config=require(_0x119e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x119e('0x16'))['db'];var jayson=require(_0x119e('0x17'));var client=jayson[_0x119e('0x18')][_0x119e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x24883e,_0x381c97,_0x4cfe1f,_0x1d46eb){return new BPromise(function(_0x8a9fad,_0x1c6fd5){var _0x881816=_0x1d46eb||client;return _0x881816[_0x119e('0x1a')](_0x24883e,_0x4cfe1f)[_0x119e('0x1b')](function(_0x285148){logger[_0x119e('0x1c')](_0x119e('0x1d'),_0x381c97,_0x119e('0x1e'));logger[_0x119e('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x381c97,_0x119e('0x1e'),JSON[_0x119e('0x20')](_0x285148));if(_0x285148[_0x119e('0x21')]){if(_0x285148[_0x119e('0x21')][_0x119e('0x22')]===0x1f4){logger[_0x119e('0x21')](_0x119e('0x1d'),_0x381c97,_0x285148[_0x119e('0x21')][_0x119e('0x23')]);return _0x1c6fd5(_0x285148[_0x119e('0x21')][_0x119e('0x23')]);}logger['error'](_0x119e('0x1d'),_0x381c97,_0x285148['error'][_0x119e('0x23')]);return _0x8a9fad(_0x285148['error'][_0x119e('0x23')]);}else{logger[_0x119e('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x381c97,'request\x20sent');_0x8a9fad(_0x285148[_0x119e('0x24')][_0x119e('0x23')]);}})[_0x119e('0x25')](function(_0x5b11ca){logger['error'](_0x119e('0x1d'),_0x381c97,_0x5b11ca);_0x1c6fd5(_0x5b11ca);});});}function respondWithStatusCode(_0x52d69b,_0x1a8a24){_0x1a8a24=_0x1a8a24||0xcc;return function(_0x21fb19){if(_0x21fb19){return _0x52d69b[_0x119e('0x26')](_0x1a8a24);}return _0x52d69b['status'](_0x1a8a24)[_0x119e('0x27')]();};}function respondWithResult(_0x59fc43,_0x1e2dd8){_0x1e2dd8=_0x1e2dd8||0xc8;return function(_0x5398e6){if(_0x5398e6){return _0x59fc43['status'](_0x1e2dd8)[_0x119e('0x28')](_0x5398e6);}};}function respondWithFilteredResult(_0x4ff4f,_0x1a7dea){return function(_0x2770ac){if(_0x2770ac){var _0x476f0=_0x2770ac[_0x119e('0x29')],_0x3a9588=_0x1a7dea['offset'],_0x47af82=_0x1a7dea[_0x119e('0x2a')]+_0x1a7dea[_0x119e('0x2b')],_0xc23289;if(_0x47af82>=_0x476f0){_0x47af82=_0x476f0;_0xc23289=0xc8;}else{_0xc23289=0xce;}_0x4ff4f['status'](_0xc23289);return _0x4ff4f[_0x119e('0x2c')]('Content-Range',_0x3a9588+'-'+_0x47af82+'/'+_0x476f0)[_0x119e('0x28')](_0x2770ac);}return null;};}function patchUpdates(_0x201f9b){return function(_0x4211fb){try{jsonpatch[_0x119e('0x2d')](_0x4211fb,_0x201f9b,!![]);}catch(_0x3df7e9){return BPromise['reject'](_0x3df7e9);}return _0x4211fb[_0x119e('0x2e')]();};}function saveUpdates(_0x51f157,_0x2743d9){return function(_0x1e7205){if(_0x1e7205){return _0x1e7205[_0x119e('0x2f')](_0x51f157)[_0x119e('0x1b')](function(_0x4fc239){return _0x4fc239;});}return null;};}function removeEntity(_0x5e27cc,_0x4dcf5f){return function(_0x51b910){if(_0x51b910){return _0x51b910[_0x119e('0x30')]()[_0x119e('0x1b')](function(){_0x5e27cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc2cc,_0x3dc17f){return function(_0x5f021d){if(!_0x5f021d){_0x3cc2cc[_0x119e('0x26')](0x194);}return _0x5f021d;};}function handleError(_0x226483,_0x47e0d8){_0x47e0d8=_0x47e0d8||0x1f4;return function(_0x100b1d){logger[_0x119e('0x21')](_0x100b1d[_0x119e('0x31')]);if(_0x100b1d[_0x119e('0x32')]){delete _0x100b1d[_0x119e('0x32')];}_0x226483[_0x119e('0x33')](_0x47e0d8)[_0x119e('0x34')](_0x100b1d);};}exports[_0x119e('0x35')]=function(_0x7f1e56,_0xf4755){var _0x35f1fd={},_0xf81f0f={},_0x323510={'count':0x0,'rows':[]};var _0x14e67a=_[_0x119e('0x36')](db['Dynamics365Configuration'][_0x119e('0x37')],function(_0x247826){return{'name':_0x247826[_0x119e('0x38')],'type':_0x247826['type'][_0x119e('0x39')]};});_0xf81f0f[_0x119e('0x3a')]=_[_0x119e('0x36')](_0x14e67a,_0x119e('0x32'));_0xf81f0f[_0x119e('0x3b')]=_['keys'](_0x7f1e56['query']);_0xf81f0f[_0x119e('0x3c')]=_[_0x119e('0x3d')](_0xf81f0f[_0x119e('0x3a')],_0xf81f0f[_0x119e('0x3b')]);_0x35f1fd[_0x119e('0x3e')]=_[_0x119e('0x3d')](_0xf81f0f[_0x119e('0x3a')],qs['fields'](_0x7f1e56['query'][_0x119e('0x3f')]));_0x35f1fd['attributes']=_0x35f1fd['attributes'][_0x119e('0x40')]?_0x35f1fd['attributes']:_0xf81f0f['model'];if(!_0x7f1e56['query'][_0x119e('0x41')](_0x119e('0x42'))){_0x35f1fd[_0x119e('0x2b')]=qs[_0x119e('0x2b')](_0x7f1e56[_0x119e('0x3b')][_0x119e('0x2b')]);_0x35f1fd[_0x119e('0x2a')]=qs[_0x119e('0x2a')](_0x7f1e56[_0x119e('0x3b')][_0x119e('0x2a')]);}_0x35f1fd[_0x119e('0x43')]=qs[_0x119e('0x44')](_0x7f1e56[_0x119e('0x3b')][_0x119e('0x44')]);_0x35f1fd['where']=qs[_0x119e('0x3c')](_[_0x119e('0x45')](_0x7f1e56[_0x119e('0x3b')],_0xf81f0f[_0x119e('0x3c')]),_0x14e67a);if(_0x7f1e56[_0x119e('0x3b')][_0x119e('0x46')]){_0x35f1fd['where']=_[_0x119e('0x47')](_0x35f1fd['where'],{'$or':_[_0x119e('0x36')](_0x14e67a,function(_0x46dbc8){if(_0x46dbc8[_0x119e('0x48')]!==_0x119e('0x49')){var _0x43fd89={};_0x43fd89[_0x46dbc8[_0x119e('0x32')]]={'$like':'%'+_0x7f1e56[_0x119e('0x3b')]['filter']+'%'};return _0x43fd89;}})});}_0x35f1fd=_['merge']({},_0x35f1fd,_0x7f1e56[_0x119e('0x4a')]);var _0x3d0142={'where':_0x35f1fd[_0x119e('0x4b')]};return db[_0x119e('0x4c')][_0x119e('0x29')](_0x3d0142)[_0x119e('0x1b')](function(_0xf94dac){_0x323510[_0x119e('0x29')]=_0xf94dac;if(_0x7f1e56[_0x119e('0x3b')][_0x119e('0x4d')]){_0x35f1fd[_0x119e('0x4e')]=[{'all':!![]}];}return db[_0x119e('0x4c')][_0x119e('0x4f')](_0x35f1fd);})[_0x119e('0x1b')](function(_0x54246a){_0x323510[_0x119e('0x50')]=_0x54246a;return _0x323510;})[_0x119e('0x1b')](respondWithFilteredResult(_0xf4755,_0x35f1fd))['catch'](handleError(_0xf4755,null));};exports[_0x119e('0x51')]=function(_0x532f88,_0x460aa6){var _0x103a7d={'raw':![],'where':{'id':_0x532f88['params']['id']}},_0x10d862={};_0x10d862[_0x119e('0x3a')]=_[_0x119e('0x52')](db['Dynamics365Configuration'][_0x119e('0x37')]);_0x10d862[_0x119e('0x3b')]=_[_0x119e('0x52')](_0x532f88['query']);_0x10d862['filters']=_['intersection'](_0x10d862[_0x119e('0x3a')],_0x10d862[_0x119e('0x3b')]);_0x103a7d['attributes']=_[_0x119e('0x3d')](_0x10d862['model'],qs[_0x119e('0x3f')](_0x532f88['query'][_0x119e('0x3f')]));_0x103a7d[_0x119e('0x3e')]=_0x103a7d['attributes']['length']?_0x103a7d[_0x119e('0x3e')]:_0x10d862[_0x119e('0x3a')];if(_0x532f88[_0x119e('0x3b')][_0x119e('0x4d')]){_0x103a7d[_0x119e('0x4e')]=[{'all':!![]}];}_0x103a7d=_[_0x119e('0x47')]({},_0x103a7d,_0x532f88[_0x119e('0x4a')]);return db['Dynamics365Configuration']['find'](_0x103a7d)['then'](handleEntityNotFound(_0x460aa6,null))[_0x119e('0x1b')](respondWithResult(_0x460aa6,null))[_0x119e('0x25')](handleError(_0x460aa6,null));};exports['create']=function(_0x2d02b3,_0x400994){return db[_0x119e('0x4c')][_0x119e('0x53')](_0x2d02b3['body'],{})[_0x119e('0x1b')](respondWithResult(_0x400994,0xc9))['catch'](handleError(_0x400994,null));};exports[_0x119e('0x2f')]=function(_0x3c163a,_0x3b4ec4){if(_0x3c163a[_0x119e('0x54')]['id']){delete _0x3c163a[_0x119e('0x54')]['id'];}return db['Dynamics365Configuration'][_0x119e('0x55')]({'where':{'id':_0x3c163a[_0x119e('0x56')]['id']}})[_0x119e('0x1b')](handleEntityNotFound(_0x3b4ec4,null))[_0x119e('0x1b')](saveUpdates(_0x3c163a[_0x119e('0x54')],null))['then'](respondWithResult(_0x3b4ec4,null))[_0x119e('0x25')](handleError(_0x3b4ec4,null));};exports[_0x119e('0x30')]=function(_0x327697,_0x46f27b){return db[_0x119e('0x4c')]['find']({'where':{'id':_0x327697[_0x119e('0x56')]['id']}})[_0x119e('0x1b')](handleEntityNotFound(_0x46f27b,null))[_0x119e('0x1b')](removeEntity(_0x46f27b,null))['catch'](handleError(_0x46f27b,null));};exports['getFields']=function(_0x230506,_0x308ea2,_0x513c58){var _0x3d291a={};var _0x16807b={};var _0x25dfc5;var _0x5824a7;return db[_0x119e('0x4c')][_0x119e('0x57')]({'where':{'id':_0x230506[_0x119e('0x56')]['id']}})[_0x119e('0x1b')](handleEntityNotFound(_0x308ea2,null))[_0x119e('0x1b')](function(_0x3ecbb9){if(_0x3ecbb9){_0x25dfc5=_0x3ecbb9;_0x16807b['model']=_[_0x119e('0x52')](db['Dynamics365Field'][_0x119e('0x37')]);_0x16807b['query']=_[_0x119e('0x52')](_0x230506[_0x119e('0x3b')]);_0x16807b[_0x119e('0x3c')]=_['intersection'](_0x16807b['model'],_0x16807b[_0x119e('0x3b')]);_0x3d291a[_0x119e('0x3e')]=_[_0x119e('0x3d')](_0x16807b['model'],qs[_0x119e('0x3f')](_0x230506[_0x119e('0x3b')][_0x119e('0x3f')]));_0x3d291a[_0x119e('0x3e')]=_0x3d291a[_0x119e('0x3e')][_0x119e('0x40')]?_0x3d291a[_0x119e('0x3e')]:_0x16807b[_0x119e('0x3a')];_0x3d291a[_0x119e('0x43')]=qs[_0x119e('0x44')](_0x230506[_0x119e('0x3b')][_0x119e('0x44')]);_0x3d291a[_0x119e('0x4b')]=qs['filters'](_[_0x119e('0x45')](_0x230506[_0x119e('0x3b')],_0x16807b[_0x119e('0x3c')]));if(_0x230506['query'][_0x119e('0x46')]){_0x3d291a['where']=_[_0x119e('0x47')](_0x3d291a[_0x119e('0x4b')],{'$or':_[_0x119e('0x36')](_0x3d291a[_0x119e('0x3e')],function(_0x19c617){var _0x178c53={};_0x178c53[_0x19c617]={'$like':'%'+_0x230506[_0x119e('0x3b')][_0x119e('0x46')]+'%'};return _0x178c53;})});}_0x3d291a=_['merge']({},_0x3d291a,_0x230506[_0x119e('0x4a')]);return _0x25dfc5['getFields'](_0x3d291a);}})[_0x119e('0x1b')](function(_0x5bcb09){if(_0x5bcb09){_0x5824a7=_0x5bcb09[_0x119e('0x40')];if(!_0x230506[_0x119e('0x3b')]['hasOwnProperty'](_0x119e('0x42'))){_0x3d291a[_0x119e('0x2b')]=qs['limit'](_0x230506['query']['limit']);_0x3d291a[_0x119e('0x2a')]=qs['offset'](_0x230506[_0x119e('0x3b')][_0x119e('0x2a')]);}return _0x25dfc5[_0x119e('0x58')](_0x3d291a);}})[_0x119e('0x1b')](function(_0x38452e){if(_0x38452e){return _0x38452e?{'count':_0x5824a7,'rows':_0x38452e}:null;}})[_0x119e('0x1b')](respondWithResult(_0x308ea2,null))[_0x119e('0x25')](handleError(_0x308ea2,null));};exports[_0x119e('0x59')]=function(_0x141542,_0x4bc12f,_0x337a23){var _0x1f7953={};var _0x375e5f={};var _0x524d43;var _0x590599;return db['Dynamics365Configuration'][_0x119e('0x57')]({'where':{'id':_0x141542[_0x119e('0x56')]['id']}})[_0x119e('0x1b')](handleEntityNotFound(_0x4bc12f,null))[_0x119e('0x1b')](function(_0x2b66e3){if(_0x2b66e3){_0x524d43=_0x2b66e3;_0x375e5f[_0x119e('0x3a')]=_[_0x119e('0x52')](db['Dynamics365Field'][_0x119e('0x37')]);_0x375e5f[_0x119e('0x3b')]=_[_0x119e('0x52')](_0x141542[_0x119e('0x3b')]);_0x375e5f[_0x119e('0x3c')]=_[_0x119e('0x3d')](_0x375e5f[_0x119e('0x3a')],_0x375e5f[_0x119e('0x3b')]);_0x1f7953[_0x119e('0x3e')]=_['intersection'](_0x375e5f[_0x119e('0x3a')],qs[_0x119e('0x3f')](_0x141542[_0x119e('0x3b')][_0x119e('0x3f')]));_0x1f7953[_0x119e('0x3e')]=_0x1f7953[_0x119e('0x3e')][_0x119e('0x40')]?_0x1f7953['attributes']:_0x375e5f['model'];_0x1f7953['order']=qs[_0x119e('0x44')](_0x141542['query']['sort']);_0x1f7953[_0x119e('0x4b')]=qs[_0x119e('0x3c')](_['pick'](_0x141542[_0x119e('0x3b')],_0x375e5f[_0x119e('0x3c')]));if(_0x141542[_0x119e('0x3b')][_0x119e('0x46')]){_0x1f7953[_0x119e('0x4b')]=_[_0x119e('0x47')](_0x1f7953[_0x119e('0x4b')],{'$or':_[_0x119e('0x36')](_0x1f7953[_0x119e('0x3e')],function(_0x4d618d){var _0x2488d8={};_0x2488d8[_0x4d618d]={'$like':'%'+_0x141542[_0x119e('0x3b')][_0x119e('0x46')]+'%'};return _0x2488d8;})});}_0x1f7953=_['merge']({},_0x1f7953,_0x141542[_0x119e('0x4a')]);return _0x524d43[_0x119e('0x59')](_0x1f7953);}})[_0x119e('0x1b')](function(_0x532b75){if(_0x532b75){_0x590599=_0x532b75[_0x119e('0x40')];if(!_0x141542[_0x119e('0x3b')][_0x119e('0x41')](_0x119e('0x42'))){_0x1f7953[_0x119e('0x2b')]=qs[_0x119e('0x2b')](_0x141542[_0x119e('0x3b')][_0x119e('0x2b')]);_0x1f7953[_0x119e('0x2a')]=qs[_0x119e('0x2a')](_0x141542['query'][_0x119e('0x2a')]);}return _0x524d43[_0x119e('0x59')](_0x1f7953);}})['then'](function(_0x4bcb8a){if(_0x4bcb8a){return _0x4bcb8a?{'count':_0x590599,'rows':_0x4bcb8a}:null;}})['then'](respondWithResult(_0x4bc12f,null))['catch'](handleError(_0x4bc12f,null));};exports['getDescriptions']=function(_0x6373ba,_0x1d45cd,_0x2ad649){var _0x14a377={};var _0x315f8a={};var _0x3be6a6;var _0x2ec98b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x6373ba[_0x119e('0x56')]['id']}})[_0x119e('0x1b')](handleEntityNotFound(_0x1d45cd,null))[_0x119e('0x1b')](function(_0x5d1ccb){if(_0x5d1ccb){_0x3be6a6=_0x5d1ccb;_0x315f8a['model']=_['keys'](db[_0x119e('0x5a')]['rawAttributes']);_0x315f8a['query']=_[_0x119e('0x52')](_0x6373ba[_0x119e('0x3b')]);_0x315f8a[_0x119e('0x3c')]=_[_0x119e('0x3d')](_0x315f8a['model'],_0x315f8a[_0x119e('0x3b')]);_0x14a377[_0x119e('0x3e')]=_[_0x119e('0x3d')](_0x315f8a[_0x119e('0x3a')],qs['fields'](_0x6373ba[_0x119e('0x3b')][_0x119e('0x3f')]));_0x14a377[_0x119e('0x3e')]=_0x14a377[_0x119e('0x3e')][_0x119e('0x40')]?_0x14a377['attributes']:_0x315f8a[_0x119e('0x3a')];_0x14a377['order']=qs['sort'](_0x6373ba[_0x119e('0x3b')][_0x119e('0x44')]);_0x14a377['where']=qs['filters'](_[_0x119e('0x45')](_0x6373ba[_0x119e('0x3b')],_0x315f8a[_0x119e('0x3c')]));if(_0x6373ba[_0x119e('0x3b')][_0x119e('0x46')]){_0x14a377[_0x119e('0x4b')]=_[_0x119e('0x47')](_0x14a377[_0x119e('0x4b')],{'$or':_['map'](_0x14a377[_0x119e('0x3e')],function(_0x20feb2){var _0x5e18fd={};_0x5e18fd[_0x20feb2]={'$like':'%'+_0x6373ba[_0x119e('0x3b')][_0x119e('0x46')]+'%'};return _0x5e18fd;})});}_0x14a377=_['merge']({},_0x14a377,_0x6373ba[_0x119e('0x4a')]);return _0x3be6a6['getDescriptions'](_0x14a377);}})[_0x119e('0x1b')](function(_0x181293){if(_0x181293){_0x2ec98b=_0x181293[_0x119e('0x40')];if(!_0x6373ba['query'][_0x119e('0x41')](_0x119e('0x42'))){_0x14a377[_0x119e('0x2b')]=qs[_0x119e('0x2b')](_0x6373ba[_0x119e('0x3b')][_0x119e('0x2b')]);_0x14a377[_0x119e('0x2a')]=qs[_0x119e('0x2a')](_0x6373ba[_0x119e('0x3b')][_0x119e('0x2a')]);}return _0x3be6a6[_0x119e('0x5b')](_0x14a377);}})[_0x119e('0x1b')](function(_0x1ad98f){if(_0x1ad98f){return _0x1ad98f?{'count':_0x2ec98b,'rows':_0x1ad98f}:null;}})[_0x119e('0x1b')](respondWithResult(_0x1d45cd,null))[_0x119e('0x25')](handleError(_0x1d45cd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ce97ea9..886df93 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 _0x519b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util'];(function(_0x11bf3a,_0x322bbb){var _0x50bf8b=function(_0x34097d){while(--_0x34097d){_0x11bf3a['push'](_0x11bf3a['shift']());}};_0x50bf8b(++_0x322bbb);}(_0x519b,0x177));var _0xb519=function(_0x455a49,_0x441ef7){_0x455a49=_0x455a49-0x0;var _0x2c1e7a=_0x519b[_0x455a49];return _0x2c1e7a;};'use strict';var _=require(_0xb519('0x0'));var util=require(_0xb519('0x1'));var logger=require(_0xb519('0x2'))(_0xb519('0x3'));var moment=require(_0xb519('0x4'));var BPromise=require('bluebird');var rp=require(_0xb519('0x5'));var fs=require('fs');var path=require(_0xb519('0x6'));var rimraf=require(_0xb519('0x7'));var config=require(_0xb519('0x8'));var attributes=require(_0xb519('0x9'));module[_0xb519('0xa')]=function(_0x5e9413,_0x20fbf0){return _0x5e9413[_0xb519('0xb')](_0xb519('0xc'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x568f=['rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x55deec,_0x130e1f){var _0x2a071a=function(_0x292388){while(--_0x292388){_0x55deec['push'](_0x55deec['shift']());}};_0x2a071a(++_0x130e1f);}(_0x568f,0xf5));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf568('0x0'));var util=require(_0xf568('0x1'));var logger=require(_0xf568('0x2'))(_0xf568('0x3'));var moment=require(_0xf568('0x4'));var BPromise=require(_0xf568('0x5'));var rp=require(_0xf568('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf568('0x7'));var config=require(_0xf568('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xf568('0x9')]=function(_0x19b47b,_0x1f5991){return _0x19b47b['define'](_0xf568('0xa'),attributes,{'tableName':_0xf568('0xb'),'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 1978015..fb7d906 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 _0xdfdb=['result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','debug','request\x20sent','error','Dynamics365Configuration,\x20%s,\x20%s','message'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xdfdb,0x89));var _0xbdfd=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0xdfdb[_0x17cb63];return _0x4340bc;};'use strict';var _=require(_0xbdfd('0x0'));var util=require(_0xbdfd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbdfd('0x2'));var fs=require('fs');var Redis=require(_0xbdfd('0x3'));var db=require(_0xbdfd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdfd('0x5'))(_0xbdfd('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdfd('0x7'));var client=jayson['client'][_0xbdfd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x401572,_0x3102f3,_0x2a040d){return new BPromise(function(_0x45812b,_0x52cbe1){return client[_0xbdfd('0x9')](_0x401572,_0x2a040d)[_0xbdfd('0xa')](function(_0x164719){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3102f3,'request\x20sent');logger[_0xbdfd('0xb')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3102f3,_0xbdfd('0xc'),JSON['stringify'](_0x164719));if(_0x164719[_0xbdfd('0xd')]){if(_0x164719[_0xbdfd('0xd')]['code']===0x1f4){logger[_0xbdfd('0xd')](_0xbdfd('0xe'),_0x3102f3,_0x164719['error'][_0xbdfd('0xf')]);return _0x52cbe1(_0x164719[_0xbdfd('0xd')][_0xbdfd('0xf')]);}logger[_0xbdfd('0xd')](_0xbdfd('0xe'),_0x3102f3,_0x164719[_0xbdfd('0xd')][_0xbdfd('0xf')]);return _0x45812b(_0x164719[_0xbdfd('0xd')][_0xbdfd('0xf')]);}else{logger['info'](_0xbdfd('0xe'),_0x3102f3,'request\x20sent');_0x45812b(_0x164719[_0xbdfd('0x10')][_0xbdfd('0xf')]);}})['catch'](function(_0x922dca){logger[_0xbdfd('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3102f3,_0x922dca);_0x52cbe1(_0x922dca);});});} \ No newline at end of file +var _0xe5d6=['info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x52a116,_0x3fca8a){var _0x5b2334=function(_0x2476fe){while(--_0x2476fe){_0x52a116['push'](_0x52a116['shift']());}};_0x5b2334(++_0x3fca8a);}(_0xe5d6,0x19b));var _0x6e5d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe5d6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6e5d('0x0'));var util=require(_0x6e5d('0x1'));var moment=require(_0x6e5d('0x2'));var BPromise=require(_0x6e5d('0x3'));var rs=require(_0x6e5d('0x4'));var fs=require('fs');var Redis=require(_0x6e5d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e5d('0x6'));var logger=require('../../config/logger')(_0x6e5d('0x7'));var config=require(_0x6e5d('0x8'));var jayson=require(_0x6e5d('0x9'));var client=jayson[_0x6e5d('0xa')][_0x6e5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x273cec,_0x5a6098,_0x1badf9){return new BPromise(function(_0x46b620,_0x4c4694){return client[_0x6e5d('0xc')](_0x273cec,_0x1badf9)[_0x6e5d('0xd')](function(_0x4a79b7){logger[_0x6e5d('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6098,'request\x20sent');logger[_0x6e5d('0xf')](_0x6e5d('0x10'),_0x5a6098,_0x6e5d('0x11'),JSON[_0x6e5d('0x12')](_0x4a79b7));if(_0x4a79b7[_0x6e5d('0x13')]){if(_0x4a79b7['error'][_0x6e5d('0x14')]===0x1f4){logger[_0x6e5d('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6098,_0x4a79b7[_0x6e5d('0x13')]['message']);return _0x4c4694(_0x4a79b7[_0x6e5d('0x13')][_0x6e5d('0x15')]);}logger[_0x6e5d('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6098,_0x4a79b7[_0x6e5d('0x13')][_0x6e5d('0x15')]);return _0x46b620(_0x4a79b7[_0x6e5d('0x13')][_0x6e5d('0x15')]);}else{logger[_0x6e5d('0xe')](_0x6e5d('0x16'),_0x5a6098,_0x6e5d('0x11'));_0x46b620(_0x4a79b7[_0x6e5d('0x17')]['message']);}})[_0x6e5d('0x18')](function(_0x1760e4){logger[_0x6e5d('0x13')](_0x6e5d('0x16'),_0x5a6098,_0x1760e4);_0x4c4694(_0x1760e4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 65fc7c4..66c54bf 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 _0x6c76=['update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','/:id','post','create'];(function(_0x15f603,_0x19466a){var _0x26fd2e=function(_0x57f840){while(--_0x57f840){_0x15f603['push'](_0x15f603['shift']());}};_0x26fd2e(++_0x19466a);}(_0x6c76,0x184));var _0x66c7=function(_0x22c4cd,_0x44f9d6){_0x22c4cd=_0x22c4cd-0x0;var _0x3e297c=_0x6c76[_0x22c4cd];return _0x3e297c;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66c7('0x5'));var controller=require(_0x66c7('0x6'));router['get']('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0x8')]);router['get'](_0x66c7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x66c7('0xa')]('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0xb')]);router['put'](_0x66c7('0x9'),auth[_0x66c7('0x7')](),controller[_0x66c7('0xc')]);router[_0x66c7('0xd')]('/:id',auth[_0x66c7('0x7')](),controller[_0x66c7('0xe')]);module[_0x66c7('0xf')]=router; \ No newline at end of file +var _0xb248=['../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x53dbb1,_0x214ea3){var _0x307e49=function(_0xeabc8a){while(--_0xeabc8a){_0x53dbb1['push'](_0x53dbb1['shift']());}};_0x307e49(++_0x214ea3);}(_0xb248,0xc6));var _0x8b24=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb248[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x8b24('0x0'));var util=require('util');var path=require(_0x8b24('0x1'));var timeout=require(_0x8b24('0x2'));var express=require(_0x8b24('0x3'));var router=express[_0x8b24('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8b24('0x5'));var config=require(_0x8b24('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x8b24('0x7')]('/',auth[_0x8b24('0x8')](),controller['index']);router[_0x8b24('0x7')](_0x8b24('0x9'),auth['isAuthenticated'](),controller[_0x8b24('0xa')]);router['post']('/',auth[_0x8b24('0x8')](),controller[_0x8b24('0xb')]);router[_0x8b24('0xc')]('/:id',auth[_0x8b24('0x8')](),controller[_0x8b24('0xd')]);router[_0x8b24('0xe')](_0x8b24('0x9'),auth[_0x8b24('0x8')](),controller[_0x8b24('0xf')]);module[_0x8b24('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a83934e..9f5cf65 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 _0x3667=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x22d747,_0x31603c){var _0x37c7eb=function(_0x3cff6a){while(--_0x3cff6a){_0x22d747['push'](_0x22d747['shift']());}};_0x37c7eb(++_0x31603c);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7366('0x0'));module[_0x7366('0x1')]={'type':{'type':Sequelize[_0x7366('0x2')](_0x7366('0x3'),_0x7366('0x4'),'customVariable',_0x7366('0x5')),'defaultValue':_0x7366('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7366('0x6')]},'keyType':{'type':Sequelize[_0x7366('0x2')](_0x7366('0x3'),_0x7366('0x4'),_0x7366('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7366('0x6')]},'nameField':{'type':Sequelize[_0x7366('0x6')]},'customField':{'type':Sequelize[_0x7366('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7366('0x6')]}}; \ No newline at end of file +var _0x0844=['keyValue','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2d3ebc,_0x1b573f){var _0x28bc16=function(_0x50355f){while(--_0x50355f){_0x2d3ebc['push'](_0x2d3ebc['shift']());}};_0x28bc16(++_0x1b573f);}(_0x0844,0xc1));var _0x4084=function(_0x542ecc,_0xe08e78){_0x542ecc=_0x542ecc-0x0;var _0x10b6b=_0x0844[_0x542ecc];return _0x10b6b;};'use strict';var Sequelize=require(_0x4084('0x0'));module[_0x4084('0x1')]={'type':{'type':Sequelize[_0x4084('0x2')](_0x4084('0x3'),_0x4084('0x4'),'customVariable',_0x4084('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4084('0x2')](_0x4084('0x3'),'variable',_0x4084('0x6'))},'keyContent':{'type':Sequelize[_0x4084('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4084('0x7')]},'customField':{'type':Sequelize[_0x4084('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4084('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2a85b54..3b74583 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 _0x8f83=['fields','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','map','Dynamics365Field','rawAttributes','type','model','keys','query','filters','intersection','attributes'];(function(_0x4a68d2,_0x1a4f9c){var _0x47638c=function(_0x4c7744){while(--_0x4c7744){_0x4a68d2['push'](_0x4a68d2['shift']());}};_0x47638c(++_0x1a4f9c);}(_0x8f83,0x162));var _0x38f8=function(_0x351532,_0x5d199a){_0x351532=_0x351532-0x0;var _0x34837a=_0x8f83[_0x351532];return _0x34837a;};'use strict';var pdf=require(_0x38f8('0x0'));var emlformat=require(_0x38f8('0x1'));var rimraf=require(_0x38f8('0x2'));var zipdir=require(_0x38f8('0x3'));var jsonpatch=require(_0x38f8('0x4'));var rp=require(_0x38f8('0x5'));var moment=require('moment');var BPromise=require(_0x38f8('0x6'));var Mustache=require(_0x38f8('0x7'));var util=require(_0x38f8('0x8'));var path=require(_0x38f8('0x9'));var sox=require(_0x38f8('0xa'));var csv=require(_0x38f8('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x38f8('0xc'));var crypto=require(_0x38f8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38f8('0xe'));var toCsv=require(_0x38f8('0xb'));var querystring=require(_0x38f8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38f8('0x10'));var qs=require(_0x38f8('0x11'));var as=require(_0x38f8('0x12'));var hardwareService=require(_0x38f8('0x13'));var logger=require(_0x38f8('0x14'))(_0x38f8('0x15'));var utils=require(_0x38f8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x38f8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fa676,_0x4d2144){_0x4d2144=_0x4d2144||0xcc;return function(_0x125265){if(_0x125265){return _0x2fa676[_0x38f8('0x18')](_0x4d2144);}return _0x2fa676[_0x38f8('0x19')](_0x4d2144)[_0x38f8('0x1a')]();};}function respondWithResult(_0x3ba66c,_0x5c9958){_0x5c9958=_0x5c9958||0xc8;return function(_0x3393d1){if(_0x3393d1){return _0x3ba66c[_0x38f8('0x19')](_0x5c9958)['json'](_0x3393d1);}};}function respondWithFilteredResult(_0x3989ac,_0x3ff950){return function(_0x4b46a3){if(_0x4b46a3){var _0x3c4aea=_0x4b46a3['count'],_0x1eb7ca=_0x3ff950[_0x38f8('0x1b')],_0x5f2218=_0x3ff950[_0x38f8('0x1b')]+_0x3ff950[_0x38f8('0x1c')],_0x5b6d9f;if(_0x5f2218>=_0x3c4aea){_0x5f2218=_0x3c4aea;_0x5b6d9f=0xc8;}else{_0x5b6d9f=0xce;}_0x3989ac[_0x38f8('0x19')](_0x5b6d9f);return _0x3989ac['set'](_0x38f8('0x1d'),_0x1eb7ca+'-'+_0x5f2218+'/'+_0x3c4aea)['json'](_0x4b46a3);}return null;};}function patchUpdates(_0x40132b){return function(_0x52f490){try{jsonpatch[_0x38f8('0x1e')](_0x52f490,_0x40132b,!![]);}catch(_0x5d3e86){return BPromise[_0x38f8('0x1f')](_0x5d3e86);}return _0x52f490[_0x38f8('0x20')]();};}function saveUpdates(_0x178af2,_0x2acaef){return function(_0x584053){if(_0x584053){return _0x584053[_0x38f8('0x21')](_0x178af2)[_0x38f8('0x22')](function(_0x310b81){return _0x310b81;});}return null;};}function removeEntity(_0x24c682,_0x17d9ae){return function(_0x5cc022){if(_0x5cc022){return _0x5cc022[_0x38f8('0x23')]()[_0x38f8('0x22')](function(){_0x24c682['status'](0xcc)[_0x38f8('0x1a')]();});}};}function handleEntityNotFound(_0x398cf4,_0x56af38){return function(_0x57bc01){if(!_0x57bc01){_0x398cf4[_0x38f8('0x18')](0x194);}return _0x57bc01;};}function handleError(_0x2b8d31,_0x128e05){_0x128e05=_0x128e05||0x1f4;return function(_0x4cfee3){logger['error'](_0x4cfee3['stack']);if(_0x4cfee3[_0x38f8('0x24')]){delete _0x4cfee3[_0x38f8('0x24')];}_0x2b8d31[_0x38f8('0x19')](_0x128e05)[_0x38f8('0x25')](_0x4cfee3);};}exports['index']=function(_0x416eeb,_0x145407){var _0x182a72={},_0x607d87={},_0x363f78={'count':0x0,'rows':[]};var _0x31a7cc=_[_0x38f8('0x26')](db[_0x38f8('0x27')][_0x38f8('0x28')],function(_0x455752){return{'name':_0x455752['fieldName'],'type':_0x455752[_0x38f8('0x29')]['key']};});_0x607d87[_0x38f8('0x2a')]=_[_0x38f8('0x26')](_0x31a7cc,_0x38f8('0x24'));_0x607d87['query']=_[_0x38f8('0x2b')](_0x416eeb[_0x38f8('0x2c')]);_0x607d87[_0x38f8('0x2d')]=_[_0x38f8('0x2e')](_0x607d87[_0x38f8('0x2a')],_0x607d87[_0x38f8('0x2c')]);_0x182a72[_0x38f8('0x2f')]=_[_0x38f8('0x2e')](_0x607d87[_0x38f8('0x2a')],qs[_0x38f8('0x30')](_0x416eeb[_0x38f8('0x2c')][_0x38f8('0x30')]));_0x182a72['attributes']=_0x182a72[_0x38f8('0x2f')]['length']?_0x182a72[_0x38f8('0x2f')]:_0x607d87[_0x38f8('0x2a')];if(!_0x416eeb['query']['hasOwnProperty']('nolimit')){_0x182a72[_0x38f8('0x1c')]=qs['limit'](_0x416eeb['query'][_0x38f8('0x1c')]);_0x182a72[_0x38f8('0x1b')]=qs['offset'](_0x416eeb[_0x38f8('0x2c')][_0x38f8('0x1b')]);}_0x182a72['order']=qs[_0x38f8('0x31')](_0x416eeb[_0x38f8('0x2c')]['sort']);_0x182a72[_0x38f8('0x32')]=qs[_0x38f8('0x2d')](_[_0x38f8('0x33')](_0x416eeb[_0x38f8('0x2c')],_0x607d87[_0x38f8('0x2d')]),_0x31a7cc);if(_0x416eeb[_0x38f8('0x2c')][_0x38f8('0x34')]){_0x182a72[_0x38f8('0x32')]=_[_0x38f8('0x35')](_0x182a72[_0x38f8('0x32')],{'$or':_['map'](_0x31a7cc,function(_0x4cf587){if(_0x4cf587['type']!==_0x38f8('0x36')){var _0x932ce2={};_0x932ce2[_0x4cf587[_0x38f8('0x24')]]={'$like':'%'+_0x416eeb[_0x38f8('0x2c')][_0x38f8('0x34')]+'%'};return _0x932ce2;}})});}_0x182a72=_[_0x38f8('0x35')]({},_0x182a72,_0x416eeb['options']);var _0x22d420={'where':_0x182a72['where']};return db[_0x38f8('0x27')][_0x38f8('0x37')](_0x22d420)['then'](function(_0x5784cf){_0x363f78[_0x38f8('0x37')]=_0x5784cf;if(_0x416eeb['query'][_0x38f8('0x38')]){_0x182a72[_0x38f8('0x39')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x38f8('0x3a')](_0x182a72);})['then'](function(_0x447619){_0x363f78[_0x38f8('0x3b')]=_0x447619;return _0x363f78;})['then'](respondWithFilteredResult(_0x145407,_0x182a72))[_0x38f8('0x3c')](handleError(_0x145407,null));};exports[_0x38f8('0x3d')]=function(_0x315e10,_0x47bda0){var _0x51cb4f={'raw':!![],'where':{'id':_0x315e10[_0x38f8('0x3e')]['id']}},_0x22fa62={};_0x22fa62[_0x38f8('0x2a')]=_[_0x38f8('0x2b')](db[_0x38f8('0x27')][_0x38f8('0x28')]);_0x22fa62[_0x38f8('0x2c')]=_['keys'](_0x315e10['query']);_0x22fa62['filters']=_['intersection'](_0x22fa62['model'],_0x22fa62[_0x38f8('0x2c')]);_0x51cb4f['attributes']=_['intersection'](_0x22fa62[_0x38f8('0x2a')],qs[_0x38f8('0x30')](_0x315e10['query'][_0x38f8('0x30')]));_0x51cb4f[_0x38f8('0x2f')]=_0x51cb4f[_0x38f8('0x2f')]['length']?_0x51cb4f[_0x38f8('0x2f')]:_0x22fa62[_0x38f8('0x2a')];if(_0x315e10['query']['includeAll']){_0x51cb4f[_0x38f8('0x39')]=[{'all':!![]}];}_0x51cb4f=_[_0x38f8('0x35')]({},_0x51cb4f,_0x315e10[_0x38f8('0x3f')]);return db['Dynamics365Field'][_0x38f8('0x40')](_0x51cb4f)['then'](handleEntityNotFound(_0x47bda0,null))[_0x38f8('0x22')](respondWithResult(_0x47bda0,null))[_0x38f8('0x3c')](handleError(_0x47bda0,null));};exports[_0x38f8('0x41')]=function(_0x28487f,_0x3acc92){return db['Dynamics365Field'][_0x38f8('0x41')](_0x28487f[_0x38f8('0x42')],{})[_0x38f8('0x22')](respondWithResult(_0x3acc92,0xc9))[_0x38f8('0x3c')](handleError(_0x3acc92,null));};exports[_0x38f8('0x21')]=function(_0x23c891,_0xc14b98){if(_0x23c891[_0x38f8('0x42')]['id']){delete _0x23c891[_0x38f8('0x42')]['id'];}return db[_0x38f8('0x27')]['find']({'where':{'id':_0x23c891['params']['id']}})['then'](handleEntityNotFound(_0xc14b98,null))[_0x38f8('0x22')](saveUpdates(_0x23c891['body'],null))[_0x38f8('0x22')](respondWithResult(_0xc14b98,null))[_0x38f8('0x3c')](handleError(_0xc14b98,null));};exports[_0x38f8('0x23')]=function(_0x1a25a9,_0x975aa8){return db[_0x38f8('0x27')][_0x38f8('0x40')]({'where':{'id':_0x1a25a9[_0x38f8('0x3e')]['id']}})[_0x38f8('0x22')](handleEntityNotFound(_0x975aa8,null))[_0x38f8('0x22')](removeEntity(_0x975aa8,null))[_0x38f8('0x3c')](handleError(_0x975aa8,null));}; \ No newline at end of file +var _0x1ffc=['include','rows','catch','params','create','body','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','save','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','keys','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x1c7481,_0x13acf9){var _0x3815c2=function(_0x4d7e6d){while(--_0x4d7e6d){_0x1c7481['push'](_0x1c7481['shift']());}};_0x3815c2(++_0x13acf9);}(_0x1ffc,0x8e));var _0xc1ff=function(_0x344452,_0x14cc7c){_0x344452=_0x344452-0x0;var _0x223bc0=_0x1ffc[_0x344452];return _0x223bc0;};'use strict';var pdf=require(_0xc1ff('0x0'));var emlformat=require(_0xc1ff('0x1'));var rimraf=require(_0xc1ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc1ff('0x3'));var moment=require('moment');var BPromise=require(_0xc1ff('0x4'));var Mustache=require('mustache');var util=require(_0xc1ff('0x5'));var path=require(_0xc1ff('0x6'));var sox=require(_0xc1ff('0x7'));var csv=require(_0xc1ff('0x8'));var ejs=require(_0xc1ff('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1ff('0xa'));var crypto=require(_0xc1ff('0xb'));var jsforce=require(_0xc1ff('0xc'));var deskjs=require(_0xc1ff('0xd'));var toCsv=require(_0xc1ff('0x8'));var querystring=require('querystring');var Papa=require(_0xc1ff('0xe'));var Redis=require(_0xc1ff('0xf'));var authService=require(_0xc1ff('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1ff('0x11'));var utils=require(_0xc1ff('0x12'));var config=require(_0xc1ff('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1ff('0x14'))['db'];function respondWithStatusCode(_0x32a8fd,_0x40bfb9){_0x40bfb9=_0x40bfb9||0xcc;return function(_0x199947){if(_0x199947){return _0x32a8fd[_0xc1ff('0x15')](_0x40bfb9);}return _0x32a8fd[_0xc1ff('0x16')](_0x40bfb9)[_0xc1ff('0x17')]();};}function respondWithResult(_0x339f3b,_0x2dddc9){_0x2dddc9=_0x2dddc9||0xc8;return function(_0x4dd176){if(_0x4dd176){return _0x339f3b[_0xc1ff('0x16')](_0x2dddc9)[_0xc1ff('0x18')](_0x4dd176);}};}function respondWithFilteredResult(_0x104d10,_0x23e6b6){return function(_0x4508f8){if(_0x4508f8){var _0x525bb8=_0x4508f8['count'],_0xd13ec1=_0x23e6b6['offset'],_0x4f08dd=_0x23e6b6[_0xc1ff('0x19')]+_0x23e6b6['limit'],_0x32687e;if(_0x4f08dd>=_0x525bb8){_0x4f08dd=_0x525bb8;_0x32687e=0xc8;}else{_0x32687e=0xce;}_0x104d10[_0xc1ff('0x16')](_0x32687e);return _0x104d10[_0xc1ff('0x1a')](_0xc1ff('0x1b'),_0xd13ec1+'-'+_0x4f08dd+'/'+_0x525bb8)['json'](_0x4508f8);}return null;};}function patchUpdates(_0x93e684){return function(_0x55510c){try{jsonpatch['apply'](_0x55510c,_0x93e684,!![]);}catch(_0x108590){return BPromise['reject'](_0x108590);}return _0x55510c[_0xc1ff('0x1c')]();};}function saveUpdates(_0x4f8545,_0x29960a){return function(_0x41a592){if(_0x41a592){return _0x41a592['update'](_0x4f8545)[_0xc1ff('0x1d')](function(_0x17246d){return _0x17246d;});}return null;};}function removeEntity(_0x625bae,_0x439c1e){return function(_0x319d01){if(_0x319d01){return _0x319d01[_0xc1ff('0x1e')]()['then'](function(){_0x625bae[_0xc1ff('0x16')](0xcc)[_0xc1ff('0x17')]();});}};}function handleEntityNotFound(_0x574a12,_0x157207){return function(_0x1f1a8a){if(!_0x1f1a8a){_0x574a12[_0xc1ff('0x15')](0x194);}return _0x1f1a8a;};}function handleError(_0x3f5f6e,_0x1c03ab){_0x1c03ab=_0x1c03ab||0x1f4;return function(_0x1748d3){logger[_0xc1ff('0x1f')](_0x1748d3[_0xc1ff('0x20')]);if(_0x1748d3[_0xc1ff('0x21')]){delete _0x1748d3[_0xc1ff('0x21')];}_0x3f5f6e[_0xc1ff('0x16')](_0x1c03ab)['send'](_0x1748d3);};}exports[_0xc1ff('0x22')]=function(_0x53c167,_0x449ad2){var _0x58d614={},_0x57c347={},_0x5ac68c={'count':0x0,'rows':[]};var _0x3e5994=_[_0xc1ff('0x23')](db[_0xc1ff('0x24')][_0xc1ff('0x25')],function(_0xc9df38){return{'name':_0xc9df38[_0xc1ff('0x26')],'type':_0xc9df38[_0xc1ff('0x27')][_0xc1ff('0x28')]};});_0x57c347['model']=_[_0xc1ff('0x23')](_0x3e5994,'name');_0x57c347['query']=_[_0xc1ff('0x29')](_0x53c167['query']);_0x57c347['filters']=_[_0xc1ff('0x2a')](_0x57c347[_0xc1ff('0x2b')],_0x57c347['query']);_0x58d614['attributes']=_[_0xc1ff('0x2a')](_0x57c347['model'],qs[_0xc1ff('0x2c')](_0x53c167[_0xc1ff('0x2d')][_0xc1ff('0x2c')]));_0x58d614[_0xc1ff('0x2e')]=_0x58d614['attributes'][_0xc1ff('0x2f')]?_0x58d614[_0xc1ff('0x2e')]:_0x57c347[_0xc1ff('0x2b')];if(!_0x53c167[_0xc1ff('0x2d')][_0xc1ff('0x30')](_0xc1ff('0x31'))){_0x58d614[_0xc1ff('0x32')]=qs[_0xc1ff('0x32')](_0x53c167['query'][_0xc1ff('0x32')]);_0x58d614[_0xc1ff('0x19')]=qs[_0xc1ff('0x19')](_0x53c167[_0xc1ff('0x2d')][_0xc1ff('0x19')]);}_0x58d614[_0xc1ff('0x33')]=qs[_0xc1ff('0x34')](_0x53c167[_0xc1ff('0x2d')][_0xc1ff('0x34')]);_0x58d614[_0xc1ff('0x35')]=qs[_0xc1ff('0x36')](_[_0xc1ff('0x37')](_0x53c167[_0xc1ff('0x2d')],_0x57c347['filters']),_0x3e5994);if(_0x53c167[_0xc1ff('0x2d')][_0xc1ff('0x38')]){_0x58d614[_0xc1ff('0x35')]=_[_0xc1ff('0x39')](_0x58d614[_0xc1ff('0x35')],{'$or':_[_0xc1ff('0x23')](_0x3e5994,function(_0x133494){if(_0x133494[_0xc1ff('0x27')]!==_0xc1ff('0x3a')){var _0x4ae3fa={};_0x4ae3fa[_0x133494[_0xc1ff('0x21')]]={'$like':'%'+_0x53c167[_0xc1ff('0x2d')][_0xc1ff('0x38')]+'%'};return _0x4ae3fa;}})});}_0x58d614=_[_0xc1ff('0x39')]({},_0x58d614,_0x53c167[_0xc1ff('0x3b')]);var _0x26cbc7={'where':_0x58d614[_0xc1ff('0x35')]};return db[_0xc1ff('0x24')][_0xc1ff('0x3c')](_0x26cbc7)[_0xc1ff('0x1d')](function(_0x2e897d){_0x5ac68c[_0xc1ff('0x3c')]=_0x2e897d;if(_0x53c167['query'][_0xc1ff('0x3d')]){_0x58d614[_0xc1ff('0x3e')]=[{'all':!![]}];}return db[_0xc1ff('0x24')]['findAll'](_0x58d614);})[_0xc1ff('0x1d')](function(_0x1bf93a){_0x5ac68c[_0xc1ff('0x3f')]=_0x1bf93a;return _0x5ac68c;})[_0xc1ff('0x1d')](respondWithFilteredResult(_0x449ad2,_0x58d614))[_0xc1ff('0x40')](handleError(_0x449ad2,null));};exports['show']=function(_0x412c84,_0x8fd050){var _0x2f0232={'raw':!![],'where':{'id':_0x412c84[_0xc1ff('0x41')]['id']}},_0x11d780={};_0x11d780[_0xc1ff('0x2b')]=_[_0xc1ff('0x29')](db[_0xc1ff('0x24')]['rawAttributes']);_0x11d780['query']=_[_0xc1ff('0x29')](_0x412c84[_0xc1ff('0x2d')]);_0x11d780[_0xc1ff('0x36')]=_[_0xc1ff('0x2a')](_0x11d780[_0xc1ff('0x2b')],_0x11d780[_0xc1ff('0x2d')]);_0x2f0232['attributes']=_[_0xc1ff('0x2a')](_0x11d780[_0xc1ff('0x2b')],qs['fields'](_0x412c84['query'][_0xc1ff('0x2c')]));_0x2f0232[_0xc1ff('0x2e')]=_0x2f0232[_0xc1ff('0x2e')][_0xc1ff('0x2f')]?_0x2f0232[_0xc1ff('0x2e')]:_0x11d780[_0xc1ff('0x2b')];if(_0x412c84['query'][_0xc1ff('0x3d')]){_0x2f0232[_0xc1ff('0x3e')]=[{'all':!![]}];}_0x2f0232=_[_0xc1ff('0x39')]({},_0x2f0232,_0x412c84[_0xc1ff('0x3b')]);return db['Dynamics365Field']['find'](_0x2f0232)[_0xc1ff('0x1d')](handleEntityNotFound(_0x8fd050,null))['then'](respondWithResult(_0x8fd050,null))[_0xc1ff('0x40')](handleError(_0x8fd050,null));};exports[_0xc1ff('0x42')]=function(_0x5f45b1,_0x1454e9){return db[_0xc1ff('0x24')][_0xc1ff('0x42')](_0x5f45b1['body'],{})['then'](respondWithResult(_0x1454e9,0xc9))['catch'](handleError(_0x1454e9,null));};exports['update']=function(_0x4b8bf0,_0x20fb87){if(_0x4b8bf0[_0xc1ff('0x43')]['id']){delete _0x4b8bf0[_0xc1ff('0x43')]['id'];}return db[_0xc1ff('0x24')]['find']({'where':{'id':_0x4b8bf0['params']['id']}})[_0xc1ff('0x1d')](handleEntityNotFound(_0x20fb87,null))[_0xc1ff('0x1d')](saveUpdates(_0x4b8bf0['body'],null))[_0xc1ff('0x1d')](respondWithResult(_0x20fb87,null))[_0xc1ff('0x40')](handleError(_0x20fb87,null));};exports[_0xc1ff('0x1e')]=function(_0x33c547,_0xa99bc0){return db[_0xc1ff('0x24')]['find']({'where':{'id':_0x33c547['params']['id']}})[_0xc1ff('0x1d')](handleEntityNotFound(_0xa99bc0,null))[_0xc1ff('0x1d')](removeEntity(_0xa99bc0,null))[_0xc1ff('0x40')](handleError(_0xa99bc0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b1350f7..2c5cca5 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 _0x6851=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x2c73c6,_0x28332b){var _0x2e203c=function(_0x181ffa){while(--_0x181ffa){_0x2c73c6['push'](_0x2c73c6['shift']());}};_0x2e203c(++_0x28332b);}(_0x6851,0xd4));var _0x1685=function(_0x116482,_0x35ddae){_0x116482=_0x116482-0x0;var _0x56db37=_0x6851[_0x116482];return _0x56db37;};'use strict';var _=require('lodash');var util=require(_0x1685('0x0'));var logger=require(_0x1685('0x1'))('api');var moment=require(_0x1685('0x2'));var BPromise=require(_0x1685('0x3'));var rp=require(_0x1685('0x4'));var fs=require('fs');var path=require(_0x1685('0x5'));var rimraf=require(_0x1685('0x6'));var config=require(_0x1685('0x7'));var attributes=require(_0x1685('0x8'));module[_0x1685('0x9')]=function(_0x1f2dbc,_0x476e9f){return _0x1f2dbc['define'](_0x1685('0xa'),attributes,{'tableName':_0x1685('0xb'),'paranoid':![],'indexes':[{'name':_0x1685('0xc'),'fields':[_0x1685('0xd'),_0x1685('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9119=['./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3a8855,_0x3e7b38){var _0x515764=function(_0x1ea2d7){while(--_0x1ea2d7){_0x3a8855['push'](_0x3a8855['shift']());}};_0x515764(++_0x3e7b38);}(_0x9119,0x1e6));var _0x9911=function(_0x30e229,_0x448b98){_0x30e229=_0x30e229-0x0;var _0x5c08f4=_0x9119[_0x30e229];return _0x5c08f4;};'use strict';var _=require(_0x9911('0x0'));var util=require(_0x9911('0x1'));var logger=require('../../config/logger')(_0x9911('0x2'));var moment=require(_0x9911('0x3'));var BPromise=require(_0x9911('0x4'));var rp=require(_0x9911('0x5'));var fs=require('fs');var path=require(_0x9911('0x6'));var rimraf=require(_0x9911('0x7'));var config=require('../../config/environment');var attributes=require(_0x9911('0x8'));module[_0x9911('0x9')]=function(_0x24edef,_0x3ceb59){return _0x24edef[_0x9911('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x9911('0xb'),'fields':[_0x9911('0xc'),'FieldId'],'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 c9f41aa..43552b8 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 _0xb511=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2493d6,_0x313cb6){var _0x3fb68c=function(_0x180443){while(--_0x180443){_0x2493d6['push'](_0x2493d6['shift']());}};_0x3fb68c(++_0x313cb6);}(_0xb511,0x165));var _0x1b51=function(_0x248ee2,_0x2beac2){_0x248ee2=_0x248ee2-0x0;var _0x5341c9=_0xb511[_0x248ee2];return _0x5341c9;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var moment=require(_0x1b51('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b51('0x3'));var fs=require('fs');var Redis=require(_0x1b51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b51('0x5'));var logger=require(_0x1b51('0x6'))(_0x1b51('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b51('0x8'));var client=jayson[_0x1b51('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475add,_0x43c14c,_0x5e7ece){return new BPromise(function(_0xfa46a3,_0x1690c9){return client[_0x1b51('0xa')](_0x475add,_0x5e7ece)[_0x1b51('0xb')](function(_0x3ceabe){logger[_0x1b51('0xc')](_0x1b51('0xd'),_0x43c14c,_0x1b51('0xe'));logger['debug'](_0x1b51('0xf'),_0x43c14c,_0x1b51('0xe'),JSON[_0x1b51('0x10')](_0x3ceabe));if(_0x3ceabe[_0x1b51('0x11')]){if(_0x3ceabe[_0x1b51('0x11')][_0x1b51('0x12')]===0x1f4){logger['error'](_0x1b51('0xd'),_0x43c14c,_0x3ceabe[_0x1b51('0x11')][_0x1b51('0x13')]);return _0x1690c9(_0x3ceabe[_0x1b51('0x11')][_0x1b51('0x13')]);}logger[_0x1b51('0x11')](_0x1b51('0xd'),_0x43c14c,_0x3ceabe['error'][_0x1b51('0x13')]);return _0xfa46a3(_0x3ceabe['error']['message']);}else{logger[_0x1b51('0xc')](_0x1b51('0xd'),_0x43c14c,'request\x20sent');_0xfa46a3(_0x3ceabe[_0x1b51('0x14')][_0x1b51('0x13')]);}})[_0x1b51('0x15')](function(_0x4ea5e3){logger[_0x1b51('0x11')](_0x1b51('0xd'),_0x43c14c,_0x4ea5e3);_0x1690c9(_0x4ea5e3);});});} \ No newline at end of file +var _0xfc46=['rpc','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4aed7d,_0x5d9a01){var _0x47228b=function(_0xac3b40){while(--_0xac3b40){_0x4aed7d['push'](_0x4aed7d['shift']());}};_0x47228b(++_0x5d9a01);}(_0xfc46,0x9a));var _0x6fc4=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0xfc46[_0x2067e9];return _0x280ce4;};'use strict';var _=require(_0x6fc4('0x0'));var util=require('util');var moment=require(_0x6fc4('0x1'));var BPromise=require(_0x6fc4('0x2'));var rs=require(_0x6fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fc4('0x4'))['db'];var utils=require(_0x6fc4('0x5'));var logger=require(_0x6fc4('0x6'))(_0x6fc4('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fc4('0x8'));var client=jayson[_0x6fc4('0x9')][_0x6fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x454abb,_0x31e6c7,_0x241761){return new BPromise(function(_0x56cee3,_0x1fcd95){return client['request'](_0x454abb,_0x241761)[_0x6fc4('0xb')](function(_0x2fad80){logger['info'](_0x6fc4('0xc'),_0x31e6c7,_0x6fc4('0xd'));logger[_0x6fc4('0xe')](_0x6fc4('0xf'),_0x31e6c7,_0x6fc4('0xd'),JSON[_0x6fc4('0x10')](_0x2fad80));if(_0x2fad80[_0x6fc4('0x11')]){if(_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x12')]===0x1f4){logger[_0x6fc4('0x11')](_0x6fc4('0xc'),_0x31e6c7,_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x13')]);return _0x1fcd95(_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x13')]);}logger[_0x6fc4('0x11')](_0x6fc4('0xc'),_0x31e6c7,_0x2fad80['error']['message']);return _0x56cee3(_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x13')]);}else{logger[_0x6fc4('0x14')](_0x6fc4('0xc'),_0x31e6c7,_0x6fc4('0xd'));_0x56cee3(_0x2fad80[_0x6fc4('0x15')][_0x6fc4('0x13')]);}})[_0x6fc4('0x16')](function(_0x1d51b1){logger['error'](_0x6fc4('0xc'),_0x31e6c7,_0x1d51b1);_0x1fcd95(_0x1d51b1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 770d06f..2648172 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 _0x38bf=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get'];(function(_0x4e9187,_0x4d8f00){var _0x5b6e05=function(_0x45fc8b){while(--_0x45fc8b){_0x4e9187['push'](_0x4e9187['shift']());}};_0x5b6e05(++_0x4d8f00);}(_0x38bf,0xbe));var _0xf38b=function(_0x20dafd,_0x9502e3){_0x20dafd=_0x20dafd-0x0;var _0xae9f01=_0x38bf[_0x20dafd];return _0xae9f01;};'use strict';var multer=require(_0xf38b('0x0'));var util=require('util');var path=require(_0xf38b('0x1'));var timeout=require(_0xf38b('0x2'));var express=require(_0xf38b('0x3'));var router=express[_0xf38b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf38b('0x5'));var config=require('../../config/environment');var controller=require(_0xf38b('0x6'));router[_0xf38b('0x7')]('/',auth[_0xf38b('0x8')](),controller[_0xf38b('0x9')]);router[_0xf38b('0x7')](_0xf38b('0xa'),auth[_0xf38b('0x8')](),controller['show']);router[_0xf38b('0x7')](_0xf38b('0xb'),auth['isAuthenticated'](),controller[_0xf38b('0xc')]);router['get']('/:id/fields',auth[_0xf38b('0x8')](),controller['getFields']);router[_0xf38b('0xd')]('/',auth[_0xf38b('0x8')](),controller['create']);router[_0xf38b('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf38b('0xe')]);router[_0xf38b('0xf')](_0xf38b('0xa'),auth[_0xf38b('0x8')](),controller[_0xf38b('0x10')]);router[_0xf38b('0x11')]('/:id',auth[_0xf38b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x74ed=['exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x1b8050,_0x4d12c6){var _0x1ec2b1=function(_0x4c150a){while(--_0x4c150a){_0x1b8050['push'](_0x1b8050['shift']());}};_0x1ec2b1(++_0x4d12c6);}(_0x74ed,0x1ba));var _0xd74e=function(_0x4f45fb,_0xfdccc6){_0x4f45fb=_0x4f45fb-0x0;var _0x1b901f=_0x74ed[_0x4f45fb];return _0x1b901f;};'use strict';var multer=require(_0xd74e('0x0'));var util=require('util');var path=require(_0xd74e('0x1'));var timeout=require(_0xd74e('0x2'));var express=require('express');var router=express[_0xd74e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd74e('0x4'));var config=require(_0xd74e('0x5'));var controller=require(_0xd74e('0x6'));router['get']('/',auth[_0xd74e('0x7')](),controller['index']);router[_0xd74e('0x8')]('/:id',auth[_0xd74e('0x7')](),controller['show']);router[_0xd74e('0x8')](_0xd74e('0x9'),auth['isAuthenticated'](),controller[_0xd74e('0xa')]);router['get'](_0xd74e('0xb'),auth[_0xd74e('0x7')](),controller[_0xd74e('0xc')]);router[_0xd74e('0xd')]('/',auth[_0xd74e('0x7')](),controller['create']);router[_0xd74e('0xd')]('/:id/configurations',auth[_0xd74e('0x7')](),controller[_0xd74e('0xe')]);router[_0xd74e('0xf')](_0xd74e('0x10'),auth[_0xd74e('0x7')](),controller[_0xd74e('0x11')]);router[_0xd74e('0x12')](_0xd74e('0x10'),auth[_0xd74e('0x7')](),controller[_0xd74e('0x13')]);module[_0xd74e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 51a7041..dc3e459 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 _0xdcdd=['STRING','username','exports'];(function(_0x3954ed,_0x1a6582){var _0x24617a=function(_0x3a7c91){while(--_0x3a7c91){_0x3954ed['push'](_0x3954ed['shift']());}};_0x24617a(++_0x1a6582);}(_0xdcdd,0x18b));var _0xddcd=function(_0x358970,_0x5ee007){_0x358970=_0x358970-0x0;var _0xed57c4=_0xdcdd[_0x358970];return _0xed57c4;};'use strict';var Sequelize=require('sequelize');module[_0xddcd('0x0')]={'name':{'type':Sequelize[_0xddcd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xddcd('0x1')],'unique':_0xddcd('0x2')},'apiKey':{'type':Sequelize[_0xddcd('0x1')]},'remoteUri':{'type':Sequelize[_0xddcd('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xddcd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x39b9=['remoteUri','sequelize','STRING','username'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x39b9,0x14d));var _0x939b=function(_0x3951ff,_0x4a06e0){_0x3951ff=_0x3951ff-0x0;var _0x487314=_0x39b9[_0x3951ff];return _0x487314;};'use strict';var Sequelize=require(_0x939b('0x0'));module['exports']={'name':{'type':Sequelize[_0x939b('0x1')]},'description':{'type':Sequelize[_0x939b('0x1')]},'username':{'type':Sequelize[_0x939b('0x1')],'unique':_0x939b('0x2')},'apiKey':{'type':Sequelize[_0x939b('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x939b('0x3')},'serverUrl':{'type':Sequelize[_0x939b('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 504aa28..c86abc1 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 _0x05a2=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','FreshdeskAccount','rows','show','keys','includeAll','include','create','body','find','params','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x05a2,0x16f));var _0x205a=function(_0x45a694,_0x23da14){_0x45a694=_0x45a694-0x0;var _0x380226=_0x05a2[_0x45a694];return _0x380226;};'use strict';var pdf=require(_0x205a('0x0'));var emlformat=require(_0x205a('0x1'));var rimraf=require(_0x205a('0x2'));var zipdir=require(_0x205a('0x3'));var jsonpatch=require(_0x205a('0x4'));var rp=require('request-promise');var moment=require(_0x205a('0x5'));var BPromise=require(_0x205a('0x6'));var Mustache=require(_0x205a('0x7'));var util=require(_0x205a('0x8'));var path=require(_0x205a('0x9'));var sox=require(_0x205a('0xa'));var csv=require(_0x205a('0xb'));var ejs=require(_0x205a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x205a('0xd'));var crypto=require(_0x205a('0xe'));var jsforce=require(_0x205a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x205a('0xb'));var querystring=require(_0x205a('0x10'));var Papa=require(_0x205a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x205a('0x12'));var as=require(_0x205a('0x13'));var hardwareService=require(_0x205a('0x14'));var logger=require(_0x205a('0x15'))(_0x205a('0x16'));var utils=require(_0x205a('0x17'));var config=require(_0x205a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x205a('0x19'))['db'];var integrations=require(_0x205a('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x205a('0x1b')][_0x205a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x8c8718,_0x279448,_0x45f743,_0x159b83){return new BPromise(function(_0x941cb8,_0x14fe8c){var _0x4dfca6=_0x159b83||client;return _0x4dfca6[_0x205a('0x1d')](_0x8c8718,_0x45f743)[_0x205a('0x1e')](function(_0x3350e3){logger[_0x205a('0x1f')](_0x205a('0x20'),_0x279448,_0x205a('0x21'));logger[_0x205a('0x22')](_0x205a('0x23'),_0x279448,_0x205a('0x21'),JSON['stringify'](_0x3350e3));if(_0x3350e3['error']){if(_0x3350e3['error'][_0x205a('0x24')]===0x1f4){logger[_0x205a('0x25')](_0x205a('0x20'),_0x279448,_0x3350e3[_0x205a('0x25')][_0x205a('0x26')]);return _0x14fe8c(_0x3350e3[_0x205a('0x25')][_0x205a('0x26')]);}logger[_0x205a('0x25')](_0x205a('0x20'),_0x279448,_0x3350e3[_0x205a('0x25')][_0x205a('0x26')]);return _0x941cb8(_0x3350e3['error'][_0x205a('0x26')]);}else{logger[_0x205a('0x1f')](_0x205a('0x20'),_0x279448,'request\x20sent');_0x941cb8(_0x3350e3['result'][_0x205a('0x26')]);}})[_0x205a('0x27')](function(_0x4edd5f){logger[_0x205a('0x25')](_0x205a('0x20'),_0x279448,_0x4edd5f);_0x14fe8c(_0x4edd5f);});});}function respondWithStatusCode(_0x397d15,_0x488ea7){_0x488ea7=_0x488ea7||0xcc;return function(_0x552424){if(_0x552424){return _0x397d15[_0x205a('0x28')](_0x488ea7);}return _0x397d15[_0x205a('0x29')](_0x488ea7)['end']();};}function respondWithResult(_0x4547f9,_0x5f56d0){_0x5f56d0=_0x5f56d0||0xc8;return function(_0x3c73d9){if(_0x3c73d9){return _0x4547f9[_0x205a('0x29')](_0x5f56d0)[_0x205a('0x2a')](_0x3c73d9);}};}function respondWithFilteredResult(_0x5df393,_0x835b5f){return function(_0x190e04){if(_0x190e04){var _0x5cac98=_0x190e04[_0x205a('0x2b')],_0x17dee0=_0x835b5f['offset'],_0x337419=_0x835b5f[_0x205a('0x2c')]+_0x835b5f[_0x205a('0x2d')],_0x3a244d;if(_0x337419>=_0x5cac98){_0x337419=_0x5cac98;_0x3a244d=0xc8;}else{_0x3a244d=0xce;}_0x5df393[_0x205a('0x29')](_0x3a244d);return _0x5df393[_0x205a('0x2e')](_0x205a('0x2f'),_0x17dee0+'-'+_0x337419+'/'+_0x5cac98)['json'](_0x190e04);}return null;};}function patchUpdates(_0xace3a8){return function(_0x483431){try{jsonpatch['apply'](_0x483431,_0xace3a8,!![]);}catch(_0x3e693a){return BPromise[_0x205a('0x30')](_0x3e693a);}return _0x483431['save']();};}function saveUpdates(_0x4ef8c1,_0x52b116){return function(_0x1ceba4){if(_0x1ceba4){return _0x1ceba4[_0x205a('0x31')](_0x4ef8c1)['then'](function(_0x4862a6){return _0x4862a6;});}return null;};}function removeEntity(_0x5af5cd,_0x1722f4){return function(_0x321856){if(_0x321856){return _0x321856[_0x205a('0x32')]()[_0x205a('0x1e')](function(){_0x5af5cd['status'](0xcc)[_0x205a('0x33')]();});}};}function handleEntityNotFound(_0x454898,_0x53c9c4){return function(_0x3ccdd5){if(!_0x3ccdd5){_0x454898[_0x205a('0x28')](0x194);}return _0x3ccdd5;};}function handleError(_0x305055,_0x34ff7c){_0x34ff7c=_0x34ff7c||0x1f4;return function(_0xe9e3f8){logger[_0x205a('0x25')](_0xe9e3f8[_0x205a('0x34')]);if(_0xe9e3f8[_0x205a('0x35')]){delete _0xe9e3f8[_0x205a('0x35')];}_0x305055[_0x205a('0x29')](_0x34ff7c)[_0x205a('0x36')](_0xe9e3f8);};}exports[_0x205a('0x37')]=function(_0x1a5f19,_0x2bb979){var _0x2f2159={},_0x3c54fc={},_0x364f2b={'count':0x0,'rows':[]};var _0xd27bac=_['map'](db['FreshdeskAccount'][_0x205a('0x38')],function(_0x1a0afc){return{'name':_0x1a0afc[_0x205a('0x39')],'type':_0x1a0afc[_0x205a('0x3a')]['key']};});_0x3c54fc['model']=_['map'](_0xd27bac,_0x205a('0x35'));_0x3c54fc[_0x205a('0x3b')]=_['keys'](_0x1a5f19[_0x205a('0x3b')]);_0x3c54fc[_0x205a('0x3c')]=_[_0x205a('0x3d')](_0x3c54fc['model'],_0x3c54fc[_0x205a('0x3b')]);_0x2f2159[_0x205a('0x3e')]=_['intersection'](_0x3c54fc[_0x205a('0x3f')],qs[_0x205a('0x40')](_0x1a5f19[_0x205a('0x3b')]['fields']));_0x2f2159[_0x205a('0x3e')]=_0x2f2159['attributes'][_0x205a('0x41')]?_0x2f2159[_0x205a('0x3e')]:_0x3c54fc[_0x205a('0x3f')];if(!_0x1a5f19['query'][_0x205a('0x42')](_0x205a('0x43'))){_0x2f2159[_0x205a('0x2d')]=qs[_0x205a('0x2d')](_0x1a5f19['query'][_0x205a('0x2d')]);_0x2f2159[_0x205a('0x2c')]=qs[_0x205a('0x2c')](_0x1a5f19[_0x205a('0x3b')][_0x205a('0x2c')]);}_0x2f2159[_0x205a('0x44')]=qs[_0x205a('0x45')](_0x1a5f19['query']['sort']);_0x2f2159['where']=qs[_0x205a('0x3c')](_[_0x205a('0x46')](_0x1a5f19[_0x205a('0x3b')],_0x3c54fc[_0x205a('0x3c')]),_0xd27bac);if(_0x1a5f19[_0x205a('0x3b')][_0x205a('0x47')]){_0x2f2159[_0x205a('0x48')]=_[_0x205a('0x49')](_0x2f2159[_0x205a('0x48')],{'$or':_[_0x205a('0x4a')](_0xd27bac,function(_0x2af974){if(_0x2af974[_0x205a('0x3a')]!=='VIRTUAL'){var _0x20009d={};_0x20009d[_0x2af974['name']]={'$like':'%'+_0x1a5f19[_0x205a('0x3b')]['filter']+'%'};return _0x20009d;}})});}_0x2f2159=_[_0x205a('0x49')]({},_0x2f2159,_0x1a5f19[_0x205a('0x4b')]);var _0x132ef2={'where':_0x2f2159[_0x205a('0x48')]};return db[_0x205a('0x4c')][_0x205a('0x2b')](_0x132ef2)['then'](function(_0x5eb526){_0x364f2b[_0x205a('0x2b')]=_0x5eb526;if(_0x1a5f19[_0x205a('0x3b')]['includeAll']){_0x2f2159['include']=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x2f2159);})[_0x205a('0x1e')](function(_0x59a6f9){_0x364f2b[_0x205a('0x4d')]=_0x59a6f9;return _0x364f2b;})[_0x205a('0x1e')](respondWithFilteredResult(_0x2bb979,_0x2f2159))['catch'](handleError(_0x2bb979,null));};exports[_0x205a('0x4e')]=function(_0x49bc7a,_0x407239){var _0x5b6146={'raw':![],'where':{'id':_0x49bc7a['params']['id']}},_0x703814={};_0x703814['model']=_[_0x205a('0x4f')](db['FreshdeskAccount']['rawAttributes']);_0x703814[_0x205a('0x3b')]=_[_0x205a('0x4f')](_0x49bc7a['query']);_0x703814['filters']=_[_0x205a('0x3d')](_0x703814[_0x205a('0x3f')],_0x703814[_0x205a('0x3b')]);_0x5b6146[_0x205a('0x3e')]=_[_0x205a('0x3d')](_0x703814[_0x205a('0x3f')],qs[_0x205a('0x40')](_0x49bc7a[_0x205a('0x3b')][_0x205a('0x40')]));_0x5b6146[_0x205a('0x3e')]=_0x5b6146[_0x205a('0x3e')]['length']?_0x5b6146['attributes']:_0x703814[_0x205a('0x3f')];if(_0x49bc7a[_0x205a('0x3b')][_0x205a('0x50')]){_0x5b6146[_0x205a('0x51')]=[{'all':!![]}];}_0x5b6146=_[_0x205a('0x49')]({},_0x5b6146,_0x49bc7a[_0x205a('0x4b')]);return db[_0x205a('0x4c')]['find'](_0x5b6146)['then'](handleEntityNotFound(_0x407239,null))[_0x205a('0x1e')](respondWithResult(_0x407239,null))[_0x205a('0x27')](handleError(_0x407239,null));};exports[_0x205a('0x52')]=function(_0x429dff,_0x1f0fb0){return db[_0x205a('0x4c')][_0x205a('0x52')](_0x429dff[_0x205a('0x53')],{})[_0x205a('0x1e')](respondWithResult(_0x1f0fb0,0xc9))[_0x205a('0x27')](handleError(_0x1f0fb0,null));};exports[_0x205a('0x31')]=function(_0xc4d35c,_0x2f761b){if(_0xc4d35c[_0x205a('0x53')]['id']){delete _0xc4d35c['body']['id'];}return db['FreshdeskAccount'][_0x205a('0x54')]({'where':{'id':_0xc4d35c[_0x205a('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f761b,null))[_0x205a('0x1e')](saveUpdates(_0xc4d35c['body'],null))[_0x205a('0x1e')](respondWithResult(_0x2f761b,null))[_0x205a('0x27')](handleError(_0x2f761b,null));};exports[_0x205a('0x32')]=function(_0x3bc70c,_0x3949ec){return db['FreshdeskAccount'][_0x205a('0x54')]({'where':{'id':_0x3bc70c[_0x205a('0x55')]['id']}})[_0x205a('0x1e')](handleEntityNotFound(_0x3949ec,null))[_0x205a('0x1e')](removeEntity(_0x3949ec,null))[_0x205a('0x27')](handleError(_0x3949ec,null));};exports[_0x205a('0x56')]=function(_0x24cf23,_0x1f609f,_0x56591a){var _0x3a5ab9={};var _0x174491={};var _0x3e22c2;var _0x428068;return db[_0x205a('0x4c')]['findOne']({'where':{'id':_0x24cf23[_0x205a('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f609f,null))['then'](function(_0x28e9e0){if(_0x28e9e0){_0x3e22c2=_0x28e9e0;_0x174491[_0x205a('0x3f')]=_[_0x205a('0x4f')](db[_0x205a('0x57')][_0x205a('0x38')]);_0x174491[_0x205a('0x3b')]=_[_0x205a('0x4f')](_0x24cf23[_0x205a('0x3b')]);_0x174491[_0x205a('0x3c')]=_['intersection'](_0x174491[_0x205a('0x3f')],_0x174491['query']);_0x3a5ab9[_0x205a('0x3e')]=_[_0x205a('0x3d')](_0x174491[_0x205a('0x3f')],qs[_0x205a('0x40')](_0x24cf23[_0x205a('0x3b')][_0x205a('0x40')]));_0x3a5ab9['attributes']=_0x3a5ab9[_0x205a('0x3e')][_0x205a('0x41')]?_0x3a5ab9[_0x205a('0x3e')]:_0x174491[_0x205a('0x3f')];_0x3a5ab9[_0x205a('0x44')]=qs[_0x205a('0x45')](_0x24cf23[_0x205a('0x3b')][_0x205a('0x45')]);_0x3a5ab9[_0x205a('0x48')]=qs[_0x205a('0x3c')](_[_0x205a('0x46')](_0x24cf23['query'],_0x174491[_0x205a('0x3c')]));if(_0x24cf23[_0x205a('0x3b')][_0x205a('0x47')]){_0x3a5ab9[_0x205a('0x48')]=_['merge'](_0x3a5ab9[_0x205a('0x48')],{'$or':_[_0x205a('0x4a')](_0x3a5ab9['attributes'],function(_0x192807){var _0x2814f6={};_0x2814f6[_0x192807]={'$like':'%'+_0x24cf23[_0x205a('0x3b')][_0x205a('0x47')]+'%'};return _0x2814f6;})});}_0x3a5ab9=_[_0x205a('0x49')]({},_0x3a5ab9,_0x24cf23[_0x205a('0x4b')]);return _0x3e22c2[_0x205a('0x56')](_0x3a5ab9);}})['then'](function(_0x208c52){if(_0x208c52){_0x428068=_0x208c52[_0x205a('0x41')];if(!_0x24cf23[_0x205a('0x3b')][_0x205a('0x42')]('nolimit')){_0x3a5ab9[_0x205a('0x2d')]=qs[_0x205a('0x2d')](_0x24cf23[_0x205a('0x3b')]['limit']);_0x3a5ab9[_0x205a('0x2c')]=qs[_0x205a('0x2c')](_0x24cf23[_0x205a('0x3b')][_0x205a('0x2c')]);}return _0x3e22c2[_0x205a('0x56')](_0x3a5ab9);}})[_0x205a('0x1e')](function(_0x5ee6ed){if(_0x5ee6ed){return _0x5ee6ed?{'count':_0x428068,'rows':_0x5ee6ed}:null;}})[_0x205a('0x1e')](respondWithResult(_0x1f609f,null))['catch'](handleError(_0x1f609f,null));};exports[_0x205a('0x58')]=function(_0x5691d7,_0x589328,_0x1d316d){if(_0x5691d7[_0x205a('0x53')]['id']){delete _0x5691d7['body']['id'];}return db[_0x205a('0x4c')][_0x205a('0x59')]({'where':{'id':_0x5691d7[_0x205a('0x55')]['id']}})[_0x205a('0x1e')](handleEntityNotFound(_0x589328,null))['then'](function(_0x4cb93c){if(_0x4cb93c){_0x5691d7['body']['AccountId']=_0x4cb93c['id'];_0x5691d7['body'][_0x205a('0x5a')]=integrations['getSubjects'](_0x5691d7[_0x205a('0x53')][_0x205a('0x5b')],_0x5691d7[_0x205a('0x53')][_0x205a('0x3a')]);_0x5691d7[_0x205a('0x53')][_0x205a('0x5c')]=integrations[_0x205a('0x5d')](_0x5691d7[_0x205a('0x53')][_0x205a('0x5b')],_0x5691d7[_0x205a('0x53')]['type']);return db[_0x205a('0x57')]['create'](_0x5691d7[_0x205a('0x53')],{'include':[{'model':db[_0x205a('0x5e')],'as':_0x205a('0x5a')},{'model':db['FreshdeskField'],'as':_0x205a('0x5c')}]});}return null;})[_0x205a('0x1e')](respondWithResult(_0x589328,null))[_0x205a('0x27')](handleError(_0x589328,null));};exports[_0x205a('0x5f')]=function(_0x2b1383,_0x232e1b,_0x379a54){var _0x396a0b='';return db[_0x205a('0x4c')][_0x205a('0x59')]({'where':{'id':_0x2b1383['params']['id']},'attributes':['id',_0x205a('0x60'),_0x205a('0x61')]})['then'](handleEntityNotFound(_0x232e1b,null))[_0x205a('0x1e')](function(_0x267b01){if(_0x267b01){_0x396a0b=_0x267b01[_0x205a('0x60')];var _0x380528=_0x396a0b[_0x205a('0x62')](-0x1);if(_0x380528==='/'){_0x396a0b=_0x396a0b[_0x205a('0x63')](0x0,_0x396a0b[_0x205a('0x64')](_0x380528));}return rp({'method':_0x205a('0x65'),'uri':util[_0x205a('0x66')](_0x205a('0x67'),_0x396a0b,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x205a('0x68'),new Buffer(util[_0x205a('0x66')](_0x205a('0x69'),_0x267b01[_0x205a('0x61')]))[_0x205a('0x6a')](_0x205a('0x6b')))},'json':!![]});}})[_0x205a('0x1e')](function(_0x1219c8){if(_0x1219c8){var _0x3386d8=[_0x205a('0x6c'),_0x205a('0x6d'),'agent',_0x205a('0x6e'),_0x205a('0x29'),_0x205a('0x6f'),_0x205a('0x70'),_0x205a('0x71'),_0x205a('0x72'),'group',_0x205a('0x73')];_[_0x205a('0x74')](_0x1219c8,function(_0x5a775e){return _0x3386d8['includes'](_0x5a775e[_0x205a('0x35')])||!_0x5a775e[_0x205a('0x75')]&&_0x5a775e[_0x205a('0x3a')]!==_0x205a('0x76')&&_0x5a775e['type']!==_0x205a('0x77');});return{'count':_0x1219c8[_0x205a('0x41')],'rows':_['map'](_0x1219c8,function(_0x3cf3a1){return{'id':_0x3cf3a1['name'],'name':_0x3cf3a1[_0x205a('0x78')],'custom':!_0x3cf3a1[_0x205a('0x75')],'options':_0x3cf3a1[_0x205a('0x79')]?_[_0x205a('0x4a')](_0x3cf3a1[_0x205a('0x79')],function(_0x3ace8b){return{'name':_[_0x205a('0x7a')](_0x3ace8b),'value':_0x3ace8b};}):[]};})};}})[_0x205a('0x1e')](respondWithResult(_0x232e1b,null))['catch'](function(_0x6b1558){var _0x4aa2ff=_0x2b1383[_0x205a('0x3b')]['test']?0x1f4:_0x6b1558[_0x205a('0x7b')]||0x1f4;logger[_0x205a('0x25')](_0x205a('0x7c'),_0x205a('0x5f'),_0x4aa2ff,JSON[_0x205a('0x7d')](_0x6b1558));delete _0x6b1558[_0x205a('0x35')];if(_0x4aa2ff===0x191){_0x4aa2ff=0x190;}_0x232e1b['status'](_0x4aa2ff)['send'](_0x2b1383[_0x205a('0x3b')][_0x205a('0x7e')]?{'message':_0x205a('0x7f'),'statusCode':_0x6b1558[_0x205a('0x7b')]}:_0x6b1558);});}; \ No newline at end of file +var _0x7201=['getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','agent','priority','ticket_type','group','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions'];(function(_0xbe3ca8,_0x53e509){var _0x510633=function(_0x57c8ac){while(--_0x57c8ac){_0xbe3ca8['push'](_0xbe3ca8['shift']());}};_0x510633(++_0x53e509);}(_0x7201,0x195));var _0x1720=function(_0x448e5d,_0x296eea){_0x448e5d=_0x448e5d-0x0;var _0x7a2e25=_0x7201[_0x448e5d];return _0x7a2e25;};'use strict';var pdf=require(_0x1720('0x0'));var emlformat=require(_0x1720('0x1'));var rimraf=require(_0x1720('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1720('0x3'));var BPromise=require(_0x1720('0x4'));var Mustache=require(_0x1720('0x5'));var util=require(_0x1720('0x6'));var path=require('path');var sox=require(_0x1720('0x7'));var csv=require(_0x1720('0x8'));var ejs=require(_0x1720('0x9'));var fs=require('fs');var _=require(_0x1720('0xa'));var squel=require(_0x1720('0xb'));var crypto=require(_0x1720('0xc'));var jsforce=require(_0x1720('0xd'));var deskjs=require(_0x1720('0xe'));var toCsv=require(_0x1720('0x8'));var querystring=require(_0x1720('0xf'));var Papa=require(_0x1720('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1720('0x11'));var hardwareService=require(_0x1720('0x12'));var logger=require(_0x1720('0x13'))(_0x1720('0x14'));var utils=require(_0x1720('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1720('0x16'));var db=require(_0x1720('0x17'))['db'];var integrations=require(_0x1720('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x1720('0x19')][_0x1720('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xd8ac3a,_0x33839a,_0x318ea2,_0x1eacfb){return new BPromise(function(_0x218ec4,_0x3febd2){var _0x5759b6=_0x1eacfb||client;return _0x5759b6[_0x1720('0x1b')](_0xd8ac3a,_0x318ea2)[_0x1720('0x1c')](function(_0x1cb2a6){logger[_0x1720('0x1d')](_0x1720('0x1e'),_0x33839a,'request\x20sent');logger[_0x1720('0x1f')](_0x1720('0x20'),_0x33839a,'request\x20sent',JSON[_0x1720('0x21')](_0x1cb2a6));if(_0x1cb2a6['error']){if(_0x1cb2a6[_0x1720('0x22')]['code']===0x1f4){logger[_0x1720('0x22')](_0x1720('0x1e'),_0x33839a,_0x1cb2a6[_0x1720('0x22')][_0x1720('0x23')]);return _0x3febd2(_0x1cb2a6[_0x1720('0x22')][_0x1720('0x23')]);}logger[_0x1720('0x22')](_0x1720('0x1e'),_0x33839a,_0x1cb2a6[_0x1720('0x22')][_0x1720('0x23')]);return _0x218ec4(_0x1cb2a6[_0x1720('0x22')][_0x1720('0x23')]);}else{logger[_0x1720('0x1d')](_0x1720('0x1e'),_0x33839a,'request\x20sent');_0x218ec4(_0x1cb2a6[_0x1720('0x24')][_0x1720('0x23')]);}})[_0x1720('0x25')](function(_0x368126){logger[_0x1720('0x22')](_0x1720('0x1e'),_0x33839a,_0x368126);_0x3febd2(_0x368126);});});}function respondWithStatusCode(_0x4c1ecd,_0x45f91b){_0x45f91b=_0x45f91b||0xcc;return function(_0x274866){if(_0x274866){return _0x4c1ecd[_0x1720('0x26')](_0x45f91b);}return _0x4c1ecd[_0x1720('0x27')](_0x45f91b)[_0x1720('0x28')]();};}function respondWithResult(_0x33645b,_0x5b3176){_0x5b3176=_0x5b3176||0xc8;return function(_0x56eb6a){if(_0x56eb6a){return _0x33645b[_0x1720('0x27')](_0x5b3176)['json'](_0x56eb6a);}};}function respondWithFilteredResult(_0x481ab5,_0x2bb8c9){return function(_0x24cdec){if(_0x24cdec){var _0x12dd09=_0x24cdec[_0x1720('0x29')],_0x5a085f=_0x2bb8c9[_0x1720('0x2a')],_0x2db85d=_0x2bb8c9[_0x1720('0x2a')]+_0x2bb8c9[_0x1720('0x2b')],_0x452ad8;if(_0x2db85d>=_0x12dd09){_0x2db85d=_0x12dd09;_0x452ad8=0xc8;}else{_0x452ad8=0xce;}_0x481ab5[_0x1720('0x27')](_0x452ad8);return _0x481ab5[_0x1720('0x2c')]('Content-Range',_0x5a085f+'-'+_0x2db85d+'/'+_0x12dd09)[_0x1720('0x2d')](_0x24cdec);}return null;};}function patchUpdates(_0x20580c){return function(_0x4e7751){try{jsonpatch[_0x1720('0x2e')](_0x4e7751,_0x20580c,!![]);}catch(_0x3b1385){return BPromise[_0x1720('0x2f')](_0x3b1385);}return _0x4e7751[_0x1720('0x30')]();};}function saveUpdates(_0x42a384,_0x392fd2){return function(_0x42fd03){if(_0x42fd03){return _0x42fd03[_0x1720('0x31')](_0x42a384)[_0x1720('0x1c')](function(_0x423c6d){return _0x423c6d;});}return null;};}function removeEntity(_0x5c3fd7,_0x252f65){return function(_0x27a48a){if(_0x27a48a){return _0x27a48a['destroy']()[_0x1720('0x1c')](function(){_0x5c3fd7['status'](0xcc)[_0x1720('0x28')]();});}};}function handleEntityNotFound(_0xd8c829,_0x18df8f){return function(_0x184e39){if(!_0x184e39){_0xd8c829['sendStatus'](0x194);}return _0x184e39;};}function handleError(_0xf2c8d5,_0x357b03){_0x357b03=_0x357b03||0x1f4;return function(_0x5b673e){logger[_0x1720('0x22')](_0x5b673e[_0x1720('0x32')]);if(_0x5b673e[_0x1720('0x33')]){delete _0x5b673e['name'];}_0xf2c8d5[_0x1720('0x27')](_0x357b03)[_0x1720('0x34')](_0x5b673e);};}exports[_0x1720('0x35')]=function(_0x577622,_0x26d5c5){var _0x50bf94={},_0x7b69f6={},_0x2d70db={'count':0x0,'rows':[]};var _0x2ca0f3=_[_0x1720('0x36')](db[_0x1720('0x37')][_0x1720('0x38')],function(_0x3d446b){return{'name':_0x3d446b[_0x1720('0x39')],'type':_0x3d446b[_0x1720('0x3a')][_0x1720('0x3b')]};});_0x7b69f6[_0x1720('0x3c')]=_['map'](_0x2ca0f3,_0x1720('0x33'));_0x7b69f6[_0x1720('0x3d')]=_[_0x1720('0x3e')](_0x577622['query']);_0x7b69f6[_0x1720('0x3f')]=_[_0x1720('0x40')](_0x7b69f6['model'],_0x7b69f6[_0x1720('0x3d')]);_0x50bf94[_0x1720('0x41')]=_[_0x1720('0x40')](_0x7b69f6[_0x1720('0x3c')],qs[_0x1720('0x42')](_0x577622[_0x1720('0x3d')][_0x1720('0x42')]));_0x50bf94['attributes']=_0x50bf94[_0x1720('0x41')][_0x1720('0x43')]?_0x50bf94[_0x1720('0x41')]:_0x7b69f6['model'];if(!_0x577622[_0x1720('0x3d')][_0x1720('0x44')](_0x1720('0x45'))){_0x50bf94[_0x1720('0x2b')]=qs[_0x1720('0x2b')](_0x577622['query']['limit']);_0x50bf94[_0x1720('0x2a')]=qs[_0x1720('0x2a')](_0x577622[_0x1720('0x3d')][_0x1720('0x2a')]);}_0x50bf94[_0x1720('0x46')]=qs[_0x1720('0x47')](_0x577622[_0x1720('0x3d')][_0x1720('0x47')]);_0x50bf94[_0x1720('0x48')]=qs[_0x1720('0x3f')](_[_0x1720('0x49')](_0x577622[_0x1720('0x3d')],_0x7b69f6[_0x1720('0x3f')]),_0x2ca0f3);if(_0x577622[_0x1720('0x3d')][_0x1720('0x4a')]){_0x50bf94['where']=_[_0x1720('0x4b')](_0x50bf94[_0x1720('0x48')],{'$or':_[_0x1720('0x36')](_0x2ca0f3,function(_0x67154b){if(_0x67154b[_0x1720('0x3a')]!==_0x1720('0x4c')){var _0x25579c={};_0x25579c[_0x67154b[_0x1720('0x33')]]={'$like':'%'+_0x577622[_0x1720('0x3d')][_0x1720('0x4a')]+'%'};return _0x25579c;}})});}_0x50bf94=_[_0x1720('0x4b')]({},_0x50bf94,_0x577622[_0x1720('0x4d')]);var _0x302058={'where':_0x50bf94[_0x1720('0x48')]};return db[_0x1720('0x37')][_0x1720('0x29')](_0x302058)['then'](function(_0x18feec){_0x2d70db[_0x1720('0x29')]=_0x18feec;if(_0x577622['query'][_0x1720('0x4e')]){_0x50bf94[_0x1720('0x4f')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x1720('0x50')](_0x50bf94);})[_0x1720('0x1c')](function(_0x3aa1c6){_0x2d70db[_0x1720('0x51')]=_0x3aa1c6;return _0x2d70db;})[_0x1720('0x1c')](respondWithFilteredResult(_0x26d5c5,_0x50bf94))['catch'](handleError(_0x26d5c5,null));};exports[_0x1720('0x52')]=function(_0xb3994e,_0x40a783){var _0x587393={'raw':![],'where':{'id':_0xb3994e[_0x1720('0x53')]['id']}},_0x15274c={};_0x15274c['model']=_[_0x1720('0x3e')](db[_0x1720('0x37')]['rawAttributes']);_0x15274c[_0x1720('0x3d')]=_['keys'](_0xb3994e['query']);_0x15274c[_0x1720('0x3f')]=_[_0x1720('0x40')](_0x15274c['model'],_0x15274c[_0x1720('0x3d')]);_0x587393['attributes']=_['intersection'](_0x15274c[_0x1720('0x3c')],qs[_0x1720('0x42')](_0xb3994e[_0x1720('0x3d')][_0x1720('0x42')]));_0x587393['attributes']=_0x587393[_0x1720('0x41')]['length']?_0x587393[_0x1720('0x41')]:_0x15274c[_0x1720('0x3c')];if(_0xb3994e[_0x1720('0x3d')]['includeAll']){_0x587393['include']=[{'all':!![]}];}_0x587393=_['merge']({},_0x587393,_0xb3994e[_0x1720('0x4d')]);return db[_0x1720('0x37')][_0x1720('0x54')](_0x587393)['then'](handleEntityNotFound(_0x40a783,null))[_0x1720('0x1c')](respondWithResult(_0x40a783,null))[_0x1720('0x25')](handleError(_0x40a783,null));};exports[_0x1720('0x55')]=function(_0x248246,_0x3b57cb){return db['FreshdeskAccount'][_0x1720('0x55')](_0x248246[_0x1720('0x56')],{})['then'](respondWithResult(_0x3b57cb,0xc9))[_0x1720('0x25')](handleError(_0x3b57cb,null));};exports[_0x1720('0x31')]=function(_0x44793d,_0x550e3f){if(_0x44793d['body']['id']){delete _0x44793d[_0x1720('0x56')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x44793d[_0x1720('0x53')]['id']}})['then'](handleEntityNotFound(_0x550e3f,null))[_0x1720('0x1c')](saveUpdates(_0x44793d[_0x1720('0x56')],null))['then'](respondWithResult(_0x550e3f,null))[_0x1720('0x25')](handleError(_0x550e3f,null));};exports[_0x1720('0x57')]=function(_0x15837d,_0xe1216e){return db['FreshdeskAccount'][_0x1720('0x54')]({'where':{'id':_0x15837d['params']['id']}})[_0x1720('0x1c')](handleEntityNotFound(_0xe1216e,null))[_0x1720('0x1c')](removeEntity(_0xe1216e,null))[_0x1720('0x25')](handleError(_0xe1216e,null));};exports[_0x1720('0x58')]=function(_0x2baad9,_0x4ae3ab,_0x1627f8){var _0x40daf2={};var _0xcf5a35={};var _0x574873;var _0x499e68;return db[_0x1720('0x37')][_0x1720('0x59')]({'where':{'id':_0x2baad9[_0x1720('0x53')]['id']}})[_0x1720('0x1c')](handleEntityNotFound(_0x4ae3ab,null))[_0x1720('0x1c')](function(_0x5d09c6){if(_0x5d09c6){_0x574873=_0x5d09c6;_0xcf5a35[_0x1720('0x3c')]=_[_0x1720('0x3e')](db['FreshdeskConfiguration'][_0x1720('0x38')]);_0xcf5a35[_0x1720('0x3d')]=_[_0x1720('0x3e')](_0x2baad9[_0x1720('0x3d')]);_0xcf5a35['filters']=_[_0x1720('0x40')](_0xcf5a35[_0x1720('0x3c')],_0xcf5a35[_0x1720('0x3d')]);_0x40daf2[_0x1720('0x41')]=_[_0x1720('0x40')](_0xcf5a35['model'],qs['fields'](_0x2baad9['query'][_0x1720('0x42')]));_0x40daf2['attributes']=_0x40daf2[_0x1720('0x41')]['length']?_0x40daf2['attributes']:_0xcf5a35[_0x1720('0x3c')];_0x40daf2[_0x1720('0x46')]=qs[_0x1720('0x47')](_0x2baad9[_0x1720('0x3d')][_0x1720('0x47')]);_0x40daf2[_0x1720('0x48')]=qs[_0x1720('0x3f')](_['pick'](_0x2baad9['query'],_0xcf5a35[_0x1720('0x3f')]));if(_0x2baad9['query'][_0x1720('0x4a')]){_0x40daf2[_0x1720('0x48')]=_['merge'](_0x40daf2['where'],{'$or':_[_0x1720('0x36')](_0x40daf2['attributes'],function(_0x19f0a7){var _0x3ed4c5={};_0x3ed4c5[_0x19f0a7]={'$like':'%'+_0x2baad9[_0x1720('0x3d')][_0x1720('0x4a')]+'%'};return _0x3ed4c5;})});}_0x40daf2=_[_0x1720('0x4b')]({},_0x40daf2,_0x2baad9[_0x1720('0x4d')]);return _0x574873[_0x1720('0x58')](_0x40daf2);}})[_0x1720('0x1c')](function(_0x1d4f1b){if(_0x1d4f1b){_0x499e68=_0x1d4f1b[_0x1720('0x43')];if(!_0x2baad9[_0x1720('0x3d')][_0x1720('0x44')](_0x1720('0x45'))){_0x40daf2[_0x1720('0x2b')]=qs[_0x1720('0x2b')](_0x2baad9[_0x1720('0x3d')][_0x1720('0x2b')]);_0x40daf2['offset']=qs[_0x1720('0x2a')](_0x2baad9[_0x1720('0x3d')][_0x1720('0x2a')]);}return _0x574873[_0x1720('0x58')](_0x40daf2);}})[_0x1720('0x1c')](function(_0x170116){if(_0x170116){return _0x170116?{'count':_0x499e68,'rows':_0x170116}:null;}})[_0x1720('0x1c')](respondWithResult(_0x4ae3ab,null))['catch'](handleError(_0x4ae3ab,null));};exports[_0x1720('0x5a')]=function(_0x4317ae,_0x5cbc6f,_0x176e4f){if(_0x4317ae[_0x1720('0x56')]['id']){delete _0x4317ae[_0x1720('0x56')]['id'];}return db['FreshdeskAccount'][_0x1720('0x59')]({'where':{'id':_0x4317ae[_0x1720('0x53')]['id']}})[_0x1720('0x1c')](handleEntityNotFound(_0x5cbc6f,null))['then'](function(_0x1f86b9){if(_0x1f86b9){_0x4317ae[_0x1720('0x56')][_0x1720('0x5b')]=_0x1f86b9['id'];_0x4317ae['body'][_0x1720('0x5c')]=integrations[_0x1720('0x5d')](_0x4317ae['body'][_0x1720('0x5e')],_0x4317ae[_0x1720('0x56')][_0x1720('0x3a')]);_0x4317ae['body']['Descriptions']=integrations[_0x1720('0x5f')](_0x4317ae[_0x1720('0x56')]['channel'],_0x4317ae[_0x1720('0x56')]['type']);return db[_0x1720('0x60')][_0x1720('0x55')](_0x4317ae[_0x1720('0x56')],{'include':[{'model':db[_0x1720('0x61')],'as':'Subjects'},{'model':db[_0x1720('0x61')],'as':_0x1720('0x62')}]});}return null;})[_0x1720('0x1c')](respondWithResult(_0x5cbc6f,null))[_0x1720('0x25')](handleError(_0x5cbc6f,null));};exports[_0x1720('0x63')]=function(_0x2e0b0f,_0x59322a,_0x157704){var _0x47b837='';return db[_0x1720('0x37')][_0x1720('0x59')]({'where':{'id':_0x2e0b0f[_0x1720('0x53')]['id']},'attributes':['id','remoteUri',_0x1720('0x64')]})[_0x1720('0x1c')](handleEntityNotFound(_0x59322a,null))[_0x1720('0x1c')](function(_0x17c057){if(_0x17c057){_0x47b837=_0x17c057[_0x1720('0x65')];var _0x1f4ccc=_0x47b837[_0x1720('0x66')](-0x1);if(_0x1f4ccc==='/'){_0x47b837=_0x47b837[_0x1720('0x67')](0x0,_0x47b837[_0x1720('0x68')](_0x1f4ccc));}return rp({'method':_0x1720('0x69'),'uri':util[_0x1720('0x6a')]('%s/%s',_0x47b837,_0x1720('0x6b')),'headers':{'Authorization':util['format'](_0x1720('0x6c'),new Buffer(util[_0x1720('0x6a')]('%s:X',_0x17c057['apiKey']))[_0x1720('0x6d')]('base64'))},'json':!![]});}})[_0x1720('0x1c')](function(_0x207a19){if(_0x207a19){var _0x3db560=[_0x1720('0x6e'),_0x1720('0x6f'),_0x1720('0x70'),'description',_0x1720('0x27'),_0x1720('0x71'),'group','source',_0x1720('0x72'),_0x1720('0x73'),_0x1720('0x74')];_['remove'](_0x207a19,function(_0x37609a){return _0x3db560[_0x1720('0x75')](_0x37609a['name'])||!_0x37609a[_0x1720('0x76')]&&_0x37609a[_0x1720('0x3a')]!=='custom_text'&&_0x37609a[_0x1720('0x3a')]!==_0x1720('0x77');});return{'count':_0x207a19[_0x1720('0x43')],'rows':_[_0x1720('0x36')](_0x207a19,function(_0x2f1baa){return{'id':_0x2f1baa[_0x1720('0x33')],'name':_0x2f1baa[_0x1720('0x78')],'custom':!_0x2f1baa['default'],'options':_0x2f1baa[_0x1720('0x79')]?_[_0x1720('0x36')](_0x2f1baa[_0x1720('0x79')],function(_0x373a77){return{'name':_[_0x1720('0x7a')](_0x373a77),'value':_0x373a77};}):[]};})};}})['then'](respondWithResult(_0x59322a,null))['catch'](function(_0xc45625){var _0x30e2dc=_0x2e0b0f[_0x1720('0x3d')][_0x1720('0x7b')]?0x1f4:_0xc45625[_0x1720('0x7c')]||0x1f4;logger['error'](_0x1720('0x7d'),_0x1720('0x63'),_0x30e2dc,JSON[_0x1720('0x21')](_0xc45625));delete _0xc45625[_0x1720('0x33')];if(_0x30e2dc===0x191){_0x30e2dc=0x190;}_0x59322a[_0x1720('0x27')](_0x30e2dc)[_0x1720('0x34')](_0x2e0b0f[_0x1720('0x3d')][_0x1720('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0xc45625[_0x1720('0x7c')]}:_0xc45625);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2a713a1..e66d902 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 _0x6c52=['../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','./intFreshdeskAccount.attributes'];(function(_0x45184e,_0x5a7e3f){var _0x341b7f=function(_0x18812d){while(--_0x18812d){_0x45184e['push'](_0x45184e['shift']());}};_0x341b7f(++_0x5a7e3f);}(_0x6c52,0x19b));var _0x26c5=function(_0x5b40e0,_0x1b15c5){_0x5b40e0=_0x5b40e0-0x0;var _0x3d6427=_0x6c52[_0x5b40e0];return _0x3d6427;};'use strict';var _=require(_0x26c5('0x0'));var util=require(_0x26c5('0x1'));var logger=require(_0x26c5('0x2'))(_0x26c5('0x3'));var moment=require(_0x26c5('0x4'));var BPromise=require(_0x26c5('0x5'));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(_0x26c5('0x6'));var integrations=require(_0x26c5('0x7'));module[_0x26c5('0x8')]=function(_0x11afb8,_0x28ac4c){return _0x11afb8[_0x26c5('0x9')](_0x26c5('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94cd=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','api','moment','request-promise','path'];(function(_0x1321ad,_0x806209){var _0x1a7bcd=function(_0x4a0333){while(--_0x4a0333){_0x1321ad['push'](_0x1321ad['shift']());}};_0x1a7bcd(++_0x806209);}(_0x94cd,0x8b));var _0xd94c=function(_0x1efc85,_0x50be39){_0x1efc85=_0x1efc85-0x0;var _0x468bb3=_0x94cd[_0x1efc85];return _0x468bb3;};'use strict';var _=require(_0xd94c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd94c('0x1'));var moment=require(_0xd94c('0x2'));var BPromise=require('bluebird');var rp=require(_0xd94c('0x3'));var fs=require('fs');var path=require(_0xd94c('0x4'));var rimraf=require(_0xd94c('0x5'));var config=require(_0xd94c('0x6'));var attributes=require(_0xd94c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd94c('0x8')]=function(_0x46cb34,_0x448c13){return _0x46cb34[_0xd94c('0x9')](_0xd94c('0xa'),attributes,{'tableName':_0xd94c('0xb'),'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 00fe2d2..2fe2a61 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 _0x2871=['GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','model','attributes','then','ShowFreshdeskAccount','find','map','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x36431f,_0x9399fe){var _0x741bc7=function(_0x4705e6){while(--_0x4705e6){_0x36431f['push'](_0x36431f['shift']());}};_0x741bc7(++_0x9399fe);}(_0x2871,0x15b));var _0x1287=function(_0x1dde34,_0x5dc607){_0x1dde34=_0x1dde34-0x0;var _0x10f092=_0x2871[_0x1dde34];return _0x10f092;};'use strict';var _=require(_0x1287('0x0'));var util=require(_0x1287('0x1'));var moment=require('moment');var BPromise=require(_0x1287('0x2'));var rs=require(_0x1287('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1287('0x4'));var logger=require(_0x1287('0x5'))(_0x1287('0x6'));var config=require(_0x1287('0x7'));var jayson=require(_0x1287('0x8'));var client=jayson[_0x1287('0x9')][_0x1287('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477593,_0x313586,_0x2dfb8f){return new BPromise(function(_0x2237a7,_0x3c82df){return client[_0x1287('0xb')](_0x477593,_0x2dfb8f)['then'](function(_0x318368){logger[_0x1287('0xc')](_0x1287('0xd'),_0x313586,'request\x20sent');logger[_0x1287('0xe')](_0x1287('0xf'),_0x313586,_0x1287('0x10'),JSON[_0x1287('0x11')](_0x318368));if(_0x318368[_0x1287('0x12')]){if(_0x318368['error'][_0x1287('0x13')]===0x1f4){logger[_0x1287('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x313586,_0x318368[_0x1287('0x12')]['message']);return _0x3c82df(_0x318368['error']['message']);}logger[_0x1287('0x12')](_0x1287('0xd'),_0x313586,_0x318368['error'][_0x1287('0x14')]);return _0x2237a7(_0x318368['error']['message']);}else{logger[_0x1287('0xc')](_0x1287('0xd'),_0x313586,_0x1287('0x10'));_0x2237a7(_0x318368[_0x1287('0x15')][_0x1287('0x14')]);}})[_0x1287('0x16')](function(_0x39a5d1){logger[_0x1287('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x313586,_0x39a5d1);_0x3c82df(_0x39a5d1);});});}exports[_0x1287('0x17')]=function(_0x1de92b){var _0x50713e=this;return new Promise(function(_0x7b3c21,_0x4dfd69){return db[_0x1287('0x18')][_0x1287('0x19')]({'raw':_0x1de92b['options']?_0x1de92b[_0x1287('0x1a')][_0x1287('0x1b')]===undefined?!![]:![]:!![],'where':_0x1de92b['options']?_0x1de92b[_0x1287('0x1a')][_0x1287('0x1c')]||null:null,'attributes':_0x1de92b[_0x1287('0x1a')]?_0x1de92b[_0x1287('0x1a')]['attributes']||null:null,'limit':_0x1de92b['options']?_0x1de92b[_0x1287('0x1a')][_0x1287('0x1d')]||null:null,'include':_0x1de92b[_0x1287('0x1a')]?_0x1de92b[_0x1287('0x1a')][_0x1287('0x1e')]?_['map'](_0x1de92b[_0x1287('0x1a')][_0x1287('0x1e')],function(_0x31e654){return{'model':db[_0x31e654[_0x1287('0x1f')]],'as':_0x31e654['as'],'attributes':_0x31e654[_0x1287('0x20')],'include':_0x31e654[_0x1287('0x1e')]?_['map'](_0x31e654['include'],function(_0x4a75a6){return{'model':db[_0x4a75a6[_0x1287('0x1f')]],'as':_0x4a75a6['as'],'attributes':_0x4a75a6[_0x1287('0x20')],'include':_0x4a75a6[_0x1287('0x1e')]?_['map'](_0x4a75a6[_0x1287('0x1e')],function(_0x3b9c31){return{'model':db[_0x3b9c31[_0x1287('0x1f')]],'as':_0x3b9c31['as'],'attributes':_0x3b9c31[_0x1287('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1287('0x21')](function(_0x5d6afb){logger['info']('GetFreshdeskAccount',_0x1de92b);logger[_0x1287('0xe')]('GetFreshdeskAccount',_0x1de92b,JSON[_0x1287('0x11')](_0x5d6afb));_0x7b3c21(_0x5d6afb);})[_0x1287('0x16')](function(_0x40f95d){logger[_0x1287('0x12')](_0x1287('0x17'),_0x40f95d[_0x1287('0x14')],_0x1de92b);_0x4dfd69(_0x50713e['error'](0x1f4,_0x40f95d[_0x1287('0x14')]));});});};exports[_0x1287('0x22')]=function(_0x13c106){var _0x581470=this;return new Promise(function(_0x273701,_0x3366d3){return db[_0x1287('0x18')][_0x1287('0x23')]({'raw':_0x13c106[_0x1287('0x1a')]?_0x13c106[_0x1287('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x13c106[_0x1287('0x1a')]?_0x13c106[_0x1287('0x1a')][_0x1287('0x1c')]||null:null,'attributes':_0x13c106[_0x1287('0x1a')]?_0x13c106['options'][_0x1287('0x20')]||null:null,'include':_0x13c106[_0x1287('0x1a')]?_0x13c106[_0x1287('0x1a')]['include']?_[_0x1287('0x24')](_0x13c106['options'][_0x1287('0x1e')],function(_0x52084a){return{'model':db[_0x52084a[_0x1287('0x1f')]],'as':_0x52084a['as'],'attributes':_0x52084a[_0x1287('0x20')],'include':_0x52084a[_0x1287('0x1e')]?_[_0x1287('0x24')](_0x52084a[_0x1287('0x1e')],function(_0x6cb655){return{'model':db[_0x6cb655[_0x1287('0x1f')]],'as':_0x6cb655['as'],'attributes':_0x6cb655[_0x1287('0x20')],'include':_0x6cb655[_0x1287('0x1e')]?_[_0x1287('0x24')](_0x6cb655[_0x1287('0x1e')],function(_0x2c924b){return{'model':db[_0x2c924b['model']],'as':_0x2c924b['as'],'attributes':_0x2c924b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1287('0x21')](function(_0x228c55){logger[_0x1287('0xc')](_0x1287('0x22'),_0x13c106);logger[_0x1287('0xe')]('ShowFreshdeskAccount',_0x13c106,JSON['stringify'](_0x228c55));_0x273701(_0x228c55);})[_0x1287('0x16')](function(_0x8f651f){logger['error'](_0x1287('0x22'),_0x8f651f[_0x1287('0x14')],_0x13c106);_0x3366d3(_0x581470[_0x1287('0x12')](0x1f4,_0x8f651f[_0x1287('0x14')]));});});}; \ No newline at end of file +var _0x814e=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','model','include','map','then','GetFreshdeskAccount','find','debug'];(function(_0xe57121,_0x4a10dd){var _0x1fda67=function(_0x207d25){while(--_0x207d25){_0xe57121['push'](_0xe57121['shift']());}};_0x1fda67(++_0x4a10dd);}(_0x814e,0x118));var _0xe814=function(_0x4d0b82,_0x228eb4){_0x4d0b82=_0x4d0b82-0x0;var _0x5f58c9=_0x814e[_0x4d0b82];return _0x5f58c9;};'use strict';var _=require('lodash');var util=require(_0xe814('0x0'));var moment=require(_0xe814('0x1'));var BPromise=require(_0xe814('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe814('0x3'));var db=require(_0xe814('0x4'))['db'];var utils=require(_0xe814('0x5'));var logger=require('../../config/logger')(_0xe814('0x6'));var config=require(_0xe814('0x7'));var jayson=require(_0xe814('0x8'));var client=jayson[_0xe814('0x9')][_0xe814('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13918b,_0xb87bbb,_0x1bef81){return new BPromise(function(_0x94935a,_0xa9b076){return client['request'](_0x13918b,_0x1bef81)['then'](function(_0x376184){logger[_0xe814('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0xb87bbb,'request\x20sent');logger['debug'](_0xe814('0xc'),_0xb87bbb,_0xe814('0xd'),JSON[_0xe814('0xe')](_0x376184));if(_0x376184[_0xe814('0xf')]){if(_0x376184['error'][_0xe814('0x10')]===0x1f4){logger[_0xe814('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0xb87bbb,_0x376184[_0xe814('0xf')][_0xe814('0x11')]);return _0xa9b076(_0x376184[_0xe814('0xf')][_0xe814('0x11')]);}logger['error'](_0xe814('0x12'),_0xb87bbb,_0x376184[_0xe814('0xf')][_0xe814('0x11')]);return _0x94935a(_0x376184[_0xe814('0xf')][_0xe814('0x11')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xb87bbb,'request\x20sent');_0x94935a(_0x376184[_0xe814('0x13')][_0xe814('0x11')]);}})[_0xe814('0x14')](function(_0x5190e5){logger[_0xe814('0xf')](_0xe814('0x12'),_0xb87bbb,_0x5190e5);_0xa9b076(_0x5190e5);});});}exports['GetFreshdeskAccount']=function(_0x253293){var _0x3124c6=this;return new Promise(function(_0x184077,_0x509477){return db[_0xe814('0x15')][_0xe814('0x16')]({'raw':_0x253293[_0xe814('0x17')]?_0x253293[_0xe814('0x17')][_0xe814('0x18')]===undefined?!![]:![]:!![],'where':_0x253293['options']?_0x253293[_0xe814('0x17')][_0xe814('0x19')]||null:null,'attributes':_0x253293[_0xe814('0x17')]?_0x253293[_0xe814('0x17')][_0xe814('0x1a')]||null:null,'limit':_0x253293[_0xe814('0x17')]?_0x253293[_0xe814('0x17')][_0xe814('0x1b')]||null:null,'include':_0x253293[_0xe814('0x17')]?_0x253293[_0xe814('0x17')]['include']?_['map'](_0x253293[_0xe814('0x17')]['include'],function(_0xa5c03b){return{'model':db[_0xa5c03b[_0xe814('0x1c')]],'as':_0xa5c03b['as'],'attributes':_0xa5c03b[_0xe814('0x1a')],'include':_0xa5c03b[_0xe814('0x1d')]?_[_0xe814('0x1e')](_0xa5c03b[_0xe814('0x1d')],function(_0x5efb20){return{'model':db[_0x5efb20[_0xe814('0x1c')]],'as':_0x5efb20['as'],'attributes':_0x5efb20[_0xe814('0x1a')],'include':_0x5efb20['include']?_[_0xe814('0x1e')](_0x5efb20[_0xe814('0x1d')],function(_0x49cb1a){return{'model':db[_0x49cb1a[_0xe814('0x1c')]],'as':_0x49cb1a['as'],'attributes':_0x49cb1a[_0xe814('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe814('0x1f')](function(_0x1f981f){logger['info'](_0xe814('0x20'),_0x253293);logger['debug'](_0xe814('0x20'),_0x253293,JSON[_0xe814('0xe')](_0x1f981f));_0x184077(_0x1f981f);})[_0xe814('0x14')](function(_0xc4dd26){logger[_0xe814('0xf')]('GetFreshdeskAccount',_0xc4dd26['message'],_0x253293);_0x509477(_0x3124c6[_0xe814('0xf')](0x1f4,_0xc4dd26['message']));});});};exports['ShowFreshdeskAccount']=function(_0x54b3aa){var _0x3ade25=this;return new Promise(function(_0x58ae98,_0x4c9a63){return db['FreshdeskAccount'][_0xe814('0x21')]({'raw':_0x54b3aa[_0xe814('0x17')]?_0x54b3aa[_0xe814('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x54b3aa[_0xe814('0x17')]?_0x54b3aa[_0xe814('0x17')][_0xe814('0x19')]||null:null,'attributes':_0x54b3aa[_0xe814('0x17')]?_0x54b3aa[_0xe814('0x17')][_0xe814('0x1a')]||null:null,'include':_0x54b3aa[_0xe814('0x17')]?_0x54b3aa[_0xe814('0x17')]['include']?_[_0xe814('0x1e')](_0x54b3aa[_0xe814('0x17')][_0xe814('0x1d')],function(_0x5b0012){return{'model':db[_0x5b0012[_0xe814('0x1c')]],'as':_0x5b0012['as'],'attributes':_0x5b0012[_0xe814('0x1a')],'include':_0x5b0012[_0xe814('0x1d')]?_[_0xe814('0x1e')](_0x5b0012[_0xe814('0x1d')],function(_0x593474){return{'model':db[_0x593474['model']],'as':_0x593474['as'],'attributes':_0x593474[_0xe814('0x1a')],'include':_0x593474[_0xe814('0x1d')]?_['map'](_0x593474[_0xe814('0x1d')],function(_0xa1226a){return{'model':db[_0xa1226a[_0xe814('0x1c')]],'as':_0xa1226a['as'],'attributes':_0xa1226a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x152c4b){logger['info']('ShowFreshdeskAccount',_0x54b3aa);logger[_0xe814('0x22')]('ShowFreshdeskAccount',_0x54b3aa,JSON[_0xe814('0xe')](_0x152c4b));_0x58ae98(_0x152c4b);})[_0xe814('0x14')](function(_0x926a4b){logger[_0xe814('0xf')]('ShowFreshdeskAccount',_0x926a4b[_0xe814('0x11')],_0x54b3aa);_0x4c9a63(_0x3ade25['error'](0x1f4,_0x926a4b['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1ee516e..fbdb0c5 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 _0x2f3e=['/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x5e25c8,_0x50b9d9){var _0x31e800=function(_0x1fb42d){while(--_0x1fb42d){_0x5e25c8['push'](_0x5e25c8['shift']());}};_0x31e800(++_0x50b9d9);}(_0x2f3e,0x1d1));var _0xe2f3=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x2f3e[_0x32f6b9];return _0x267d52;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe2f3('0x0'));var timeout=require(_0xe2f3('0x1'));var express=require(_0xe2f3('0x2'));var router=express[_0xe2f3('0x3')]();var auth=require(_0xe2f3('0x4'));var interaction=require(_0xe2f3('0x5'));var config=require(_0xe2f3('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xe2f3('0x7')](),controller[_0xe2f3('0x8')]);router[_0xe2f3('0x9')](_0xe2f3('0xa'),auth[_0xe2f3('0x7')](),controller['show']);router['get'](_0xe2f3('0xb'),auth['isAuthenticated'](),controller[_0xe2f3('0xc')]);router[_0xe2f3('0x9')](_0xe2f3('0xd'),auth[_0xe2f3('0x7')](),controller[_0xe2f3('0xe')]);router['get'](_0xe2f3('0xf'),auth[_0xe2f3('0x7')](),controller[_0xe2f3('0x10')]);router['get'](_0xe2f3('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0xe2f3('0x12')]('/',auth[_0xe2f3('0x7')](),controller['create']);router[_0xe2f3('0x12')](_0xe2f3('0x11'),auth[_0xe2f3('0x7')](),controller[_0xe2f3('0x13')]);router[_0xe2f3('0x14')](_0xe2f3('0xa'),auth[_0xe2f3('0x7')](),controller[_0xe2f3('0x15')]);router['delete'](_0xe2f3('0xa'),auth[_0xe2f3('0x7')](),controller[_0xe2f3('0x16')]);module[_0xe2f3('0x17')]=router; \ No newline at end of file +var _0x4b49=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x2d21d5,_0x4a02fb){var _0x309f3e=function(_0x5cf45f){while(--_0x5cf45f){_0x2d21d5['push'](_0x2d21d5['shift']());}};_0x309f3e(++_0x4a02fb);}(_0x4b49,0x1a7));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x94b4('0x0'));var path=require(_0x94b4('0x1'));var timeout=require(_0x94b4('0x2'));var express=require(_0x94b4('0x3'));var router=express[_0x94b4('0x4')]();var auth=require(_0x94b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x94b4('0x6'));var controller=require(_0x94b4('0x7'));router[_0x94b4('0x8')]('/',auth[_0x94b4('0x9')](),controller[_0x94b4('0xa')]);router[_0x94b4('0x8')](_0x94b4('0xb'),auth['isAuthenticated'](),controller[_0x94b4('0xc')]);router[_0x94b4('0x8')]('/:id/fields',auth[_0x94b4('0x9')](),controller['getFields']);router['get'](_0x94b4('0xd'),auth[_0x94b4('0x9')](),controller[_0x94b4('0xe')]);router[_0x94b4('0x8')](_0x94b4('0xf'),auth[_0x94b4('0x9')](),controller[_0x94b4('0x10')]);router[_0x94b4('0x8')](_0x94b4('0x11'),auth[_0x94b4('0x9')](),controller[_0x94b4('0x12')]);router[_0x94b4('0x13')]('/',auth[_0x94b4('0x9')](),controller[_0x94b4('0x14')]);router[_0x94b4('0x13')](_0x94b4('0x11'),auth[_0x94b4('0x9')](),controller['setTags']);router['put']('/:id',auth[_0x94b4('0x9')](),controller['update']);router[_0x94b4('0x15')]('/:id',auth[_0x94b4('0x9')](),controller[_0x94b4('0x16')]);module[_0x94b4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ce1d626..88e6c7c 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 _0x5769=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5769,0xc1));var _0x9576=function(_0x1d5bab,_0x56e9a6){_0x1d5bab=_0x1d5bab-0x0;var _0x507269=_0x5769[_0x1d5bab];return _0x507269;};'use strict';var Sequelize=require(_0x9576('0x0'));module[_0x9576('0x1')]={'name':{'type':Sequelize[_0x9576('0x2')]},'description':{'type':Sequelize[_0x9576('0x2')]}}; \ No newline at end of file +var _0xed66=['STRING','sequelize','exports'];(function(_0x29416f,_0x33fe73){var _0x73271c=function(_0x551571){while(--_0x551571){_0x29416f['push'](_0x29416f['shift']());}};_0x73271c(++_0x33fe73);}(_0xed66,0x1d5));var _0x6ed6=function(_0x446832,_0x12964a){_0x446832=_0x446832-0x0;var _0x2002bd=_0xed66[_0x446832];return _0x2002bd;};'use strict';var Sequelize=require(_0x6ed6('0x0'));module[_0x6ed6('0x1')]={'name':{'type':Sequelize[_0x6ed6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b87d053..09b71b7 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 _0xdb98=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','create','body','destroy','getFields','order','pick','getSubjects','FreshdeskField','getDescriptions','findOne','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','limit','Content-Range','apply','save','update','then','end','stack','name','index','map','FreshdeskConfiguration'];(function(_0xd3bca0,_0x2dd545){var _0x304034=function(_0x1f305c){while(--_0x1f305c){_0xd3bca0['push'](_0xd3bca0['shift']());}};_0x304034(++_0x2dd545);}(_0xdb98,0xe7));var _0x8db9=function(_0x1dcb95,_0x2a7cce){_0x1dcb95=_0x1dcb95-0x0;var _0x7ed6a6=_0xdb98[_0x1dcb95];return _0x7ed6a6;};'use strict';var pdf=require(_0x8db9('0x0'));var emlformat=require(_0x8db9('0x1'));var rimraf=require(_0x8db9('0x2'));var zipdir=require(_0x8db9('0x3'));var jsonpatch=require(_0x8db9('0x4'));var rp=require(_0x8db9('0x5'));var moment=require('moment');var BPromise=require(_0x8db9('0x6'));var Mustache=require(_0x8db9('0x7'));var util=require(_0x8db9('0x8'));var path=require(_0x8db9('0x9'));var sox=require(_0x8db9('0xa'));var csv=require(_0x8db9('0xb'));var ejs=require(_0x8db9('0xc'));var fs=require('fs');var _=require(_0x8db9('0xd'));var squel=require(_0x8db9('0xe'));var crypto=require('crypto');var jsforce=require(_0x8db9('0xf'));var deskjs=require(_0x8db9('0x10'));var toCsv=require(_0x8db9('0xb'));var querystring=require('querystring');var Papa=require(_0x8db9('0x11'));var Redis=require(_0x8db9('0x12'));var authService=require(_0x8db9('0x13'));var qs=require(_0x8db9('0x14'));var as=require(_0x8db9('0x15'));var hardwareService=require(_0x8db9('0x16'));var logger=require(_0x8db9('0x17'))(_0x8db9('0x18'));var utils=require(_0x8db9('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8db9('0x1a'))['db'];var jayson=require(_0x8db9('0x1b'));var client=jayson[_0x8db9('0x1c')][_0x8db9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x364fb1,_0x4c5458,_0x318ecb,_0x54396e){return new BPromise(function(_0x12ef77,_0x836e7f){var _0x374f82=_0x54396e||client;return _0x374f82['request'](_0x364fb1,_0x318ecb)['then'](function(_0x35bc70){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c5458,'request\x20sent');logger[_0x8db9('0x1e')](_0x8db9('0x1f'),_0x4c5458,_0x8db9('0x20'),JSON[_0x8db9('0x21')](_0x35bc70));if(_0x35bc70['error']){if(_0x35bc70['error'][_0x8db9('0x22')]===0x1f4){logger[_0x8db9('0x23')](_0x8db9('0x24'),_0x4c5458,_0x35bc70[_0x8db9('0x23')][_0x8db9('0x25')]);return _0x836e7f(_0x35bc70[_0x8db9('0x23')]['message']);}logger[_0x8db9('0x23')](_0x8db9('0x24'),_0x4c5458,_0x35bc70[_0x8db9('0x23')][_0x8db9('0x25')]);return _0x12ef77(_0x35bc70['error'][_0x8db9('0x25')]);}else{logger[_0x8db9('0x26')](_0x8db9('0x24'),_0x4c5458,_0x8db9('0x20'));_0x12ef77(_0x35bc70[_0x8db9('0x27')][_0x8db9('0x25')]);}})[_0x8db9('0x28')](function(_0x16e780){logger[_0x8db9('0x23')](_0x8db9('0x24'),_0x4c5458,_0x16e780);_0x836e7f(_0x16e780);});});}function respondWithStatusCode(_0x3d8696,_0x3256f5){_0x3256f5=_0x3256f5||0xcc;return function(_0x25b244){if(_0x25b244){return _0x3d8696[_0x8db9('0x29')](_0x3256f5);}return _0x3d8696[_0x8db9('0x2a')](_0x3256f5)['end']();};}function respondWithResult(_0x3562b5,_0x4680bc){_0x4680bc=_0x4680bc||0xc8;return function(_0x13852f){if(_0x13852f){return _0x3562b5[_0x8db9('0x2a')](_0x4680bc)['json'](_0x13852f);}};}function respondWithFilteredResult(_0x5a5257,_0x3f8a22){return function(_0x268fba){if(_0x268fba){var _0x389679=_0x268fba[_0x8db9('0x2b')],_0x128b4d=_0x3f8a22[_0x8db9('0x2c')],_0x251e84=_0x3f8a22[_0x8db9('0x2c')]+_0x3f8a22[_0x8db9('0x2d')],_0x17ad30;if(_0x251e84>=_0x389679){_0x251e84=_0x389679;_0x17ad30=0xc8;}else{_0x17ad30=0xce;}_0x5a5257[_0x8db9('0x2a')](_0x17ad30);return _0x5a5257['set'](_0x8db9('0x2e'),_0x128b4d+'-'+_0x251e84+'/'+_0x389679)['json'](_0x268fba);}return null;};}function patchUpdates(_0x3e5dd6){return function(_0x3048b5){try{jsonpatch[_0x8db9('0x2f')](_0x3048b5,_0x3e5dd6,!![]);}catch(_0x5428ab){return BPromise['reject'](_0x5428ab);}return _0x3048b5[_0x8db9('0x30')]();};}function saveUpdates(_0x1d841b,_0x60778){return function(_0x207b87){if(_0x207b87){return _0x207b87[_0x8db9('0x31')](_0x1d841b)[_0x8db9('0x32')](function(_0x3f92d3){return _0x3f92d3;});}return null;};}function removeEntity(_0x2ff38a,_0x34f318){return function(_0x302642){if(_0x302642){return _0x302642['destroy']()[_0x8db9('0x32')](function(){_0x2ff38a[_0x8db9('0x2a')](0xcc)[_0x8db9('0x33')]();});}};}function handleEntityNotFound(_0x557e56,_0x4b3aa6){return function(_0x1c1448){if(!_0x1c1448){_0x557e56[_0x8db9('0x29')](0x194);}return _0x1c1448;};}function handleError(_0x14a6f7,_0x3bd706){_0x3bd706=_0x3bd706||0x1f4;return function(_0x480aad){logger[_0x8db9('0x23')](_0x480aad[_0x8db9('0x34')]);if(_0x480aad[_0x8db9('0x35')]){delete _0x480aad[_0x8db9('0x35')];}_0x14a6f7[_0x8db9('0x2a')](_0x3bd706)['send'](_0x480aad);};}exports[_0x8db9('0x36')]=function(_0x1cd6c5,_0x4fb500){var _0x5c84aa={},_0x3a948b={},_0x142e2c={'count':0x0,'rows':[]};var _0x14963a=_[_0x8db9('0x37')](db[_0x8db9('0x38')][_0x8db9('0x39')],function(_0x44e9a0){return{'name':_0x44e9a0[_0x8db9('0x3a')],'type':_0x44e9a0[_0x8db9('0x3b')][_0x8db9('0x3c')]};});_0x3a948b[_0x8db9('0x3d')]=_['map'](_0x14963a,_0x8db9('0x35'));_0x3a948b[_0x8db9('0x3e')]=_[_0x8db9('0x3f')](_0x1cd6c5[_0x8db9('0x3e')]);_0x3a948b[_0x8db9('0x40')]=_[_0x8db9('0x41')](_0x3a948b[_0x8db9('0x3d')],_0x3a948b[_0x8db9('0x3e')]);_0x5c84aa['attributes']=_[_0x8db9('0x41')](_0x3a948b[_0x8db9('0x3d')],qs[_0x8db9('0x42')](_0x1cd6c5[_0x8db9('0x3e')]['fields']));_0x5c84aa[_0x8db9('0x43')]=_0x5c84aa[_0x8db9('0x43')][_0x8db9('0x44')]?_0x5c84aa['attributes']:_0x3a948b[_0x8db9('0x3d')];if(!_0x1cd6c5[_0x8db9('0x3e')][_0x8db9('0x45')](_0x8db9('0x46'))){_0x5c84aa[_0x8db9('0x2d')]=qs[_0x8db9('0x2d')](_0x1cd6c5['query'][_0x8db9('0x2d')]);_0x5c84aa[_0x8db9('0x2c')]=qs['offset'](_0x1cd6c5[_0x8db9('0x3e')][_0x8db9('0x2c')]);}_0x5c84aa['order']=qs[_0x8db9('0x47')](_0x1cd6c5[_0x8db9('0x3e')][_0x8db9('0x47')]);_0x5c84aa[_0x8db9('0x48')]=qs['filters'](_['pick'](_0x1cd6c5[_0x8db9('0x3e')],_0x3a948b['filters']),_0x14963a);if(_0x1cd6c5[_0x8db9('0x3e')][_0x8db9('0x49')]){_0x5c84aa['where']=_[_0x8db9('0x4a')](_0x5c84aa[_0x8db9('0x48')],{'$or':_[_0x8db9('0x37')](_0x14963a,function(_0x306cdb){if(_0x306cdb['type']!==_0x8db9('0x4b')){var _0x3e9f13={};_0x3e9f13[_0x306cdb[_0x8db9('0x35')]]={'$like':'%'+_0x1cd6c5[_0x8db9('0x3e')][_0x8db9('0x49')]+'%'};return _0x3e9f13;}})});}_0x5c84aa=_['merge']({},_0x5c84aa,_0x1cd6c5[_0x8db9('0x4c')]);var _0x357d55={'where':_0x5c84aa[_0x8db9('0x48')]};return db[_0x8db9('0x38')]['count'](_0x357d55)[_0x8db9('0x32')](function(_0x125714){_0x142e2c[_0x8db9('0x2b')]=_0x125714;if(_0x1cd6c5[_0x8db9('0x3e')][_0x8db9('0x4d')]){_0x5c84aa['include']=[{'all':!![]}];}return db[_0x8db9('0x38')][_0x8db9('0x4e')](_0x5c84aa);})['then'](function(_0x800714){_0x142e2c[_0x8db9('0x4f')]=_0x800714;return _0x142e2c;})[_0x8db9('0x32')](respondWithFilteredResult(_0x4fb500,_0x5c84aa))[_0x8db9('0x28')](handleError(_0x4fb500,null));};exports['show']=function(_0x31113e,_0x1c799b){var _0x3caef3={'raw':![],'where':{'id':_0x31113e[_0x8db9('0x50')]['id']}},_0x35a7f7={};_0x35a7f7[_0x8db9('0x3d')]=_[_0x8db9('0x3f')](db['FreshdeskConfiguration'][_0x8db9('0x39')]);_0x35a7f7[_0x8db9('0x3e')]=_[_0x8db9('0x3f')](_0x31113e['query']);_0x35a7f7[_0x8db9('0x40')]=_['intersection'](_0x35a7f7[_0x8db9('0x3d')],_0x35a7f7['query']);_0x3caef3[_0x8db9('0x43')]=_[_0x8db9('0x41')](_0x35a7f7[_0x8db9('0x3d')],qs[_0x8db9('0x42')](_0x31113e[_0x8db9('0x3e')][_0x8db9('0x42')]));_0x3caef3[_0x8db9('0x43')]=_0x3caef3[_0x8db9('0x43')][_0x8db9('0x44')]?_0x3caef3[_0x8db9('0x43')]:_0x35a7f7[_0x8db9('0x3d')];if(_0x31113e[_0x8db9('0x3e')][_0x8db9('0x4d')]){_0x3caef3[_0x8db9('0x51')]=[{'all':!![]}];}_0x3caef3=_[_0x8db9('0x4a')]({},_0x3caef3,_0x31113e[_0x8db9('0x4c')]);return db[_0x8db9('0x38')][_0x8db9('0x52')](_0x3caef3)[_0x8db9('0x32')](handleEntityNotFound(_0x1c799b,null))[_0x8db9('0x32')](respondWithResult(_0x1c799b,null))[_0x8db9('0x28')](handleError(_0x1c799b,null));};exports[_0x8db9('0x53')]=function(_0x2aa0e5,_0xeb061b){return db[_0x8db9('0x38')][_0x8db9('0x53')](_0x2aa0e5[_0x8db9('0x54')],{})[_0x8db9('0x32')](respondWithResult(_0xeb061b,0xc9))[_0x8db9('0x28')](handleError(_0xeb061b,null));};exports['update']=function(_0x24b006,_0x342407){if(_0x24b006['body']['id']){delete _0x24b006[_0x8db9('0x54')]['id'];}return db[_0x8db9('0x38')]['find']({'where':{'id':_0x24b006['params']['id']}})[_0x8db9('0x32')](handleEntityNotFound(_0x342407,null))[_0x8db9('0x32')](saveUpdates(_0x24b006[_0x8db9('0x54')],null))[_0x8db9('0x32')](respondWithResult(_0x342407,null))[_0x8db9('0x28')](handleError(_0x342407,null));};exports[_0x8db9('0x55')]=function(_0x46d760,_0x28cf09){return db[_0x8db9('0x38')][_0x8db9('0x52')]({'where':{'id':_0x46d760[_0x8db9('0x50')]['id']}})[_0x8db9('0x32')](handleEntityNotFound(_0x28cf09,null))[_0x8db9('0x32')](removeEntity(_0x28cf09,null))[_0x8db9('0x28')](handleError(_0x28cf09,null));};exports[_0x8db9('0x56')]=function(_0x412a69,_0x33cde6,_0x40e7be){var _0x2814fd={};var _0x561284={};var _0x7343f4;var _0x5b9df2;return db[_0x8db9('0x38')]['findOne']({'where':{'id':_0x412a69[_0x8db9('0x50')]['id']}})[_0x8db9('0x32')](handleEntityNotFound(_0x33cde6,null))[_0x8db9('0x32')](function(_0x2786c0){if(_0x2786c0){_0x7343f4=_0x2786c0;_0x561284['model']=_[_0x8db9('0x3f')](db['FreshdeskField'][_0x8db9('0x39')]);_0x561284['query']=_['keys'](_0x412a69[_0x8db9('0x3e')]);_0x561284[_0x8db9('0x40')]=_[_0x8db9('0x41')](_0x561284[_0x8db9('0x3d')],_0x561284[_0x8db9('0x3e')]);_0x2814fd[_0x8db9('0x43')]=_[_0x8db9('0x41')](_0x561284['model'],qs[_0x8db9('0x42')](_0x412a69[_0x8db9('0x3e')][_0x8db9('0x42')]));_0x2814fd[_0x8db9('0x43')]=_0x2814fd[_0x8db9('0x43')]['length']?_0x2814fd[_0x8db9('0x43')]:_0x561284['model'];_0x2814fd[_0x8db9('0x57')]=qs[_0x8db9('0x47')](_0x412a69[_0x8db9('0x3e')][_0x8db9('0x47')]);_0x2814fd[_0x8db9('0x48')]=qs[_0x8db9('0x40')](_[_0x8db9('0x58')](_0x412a69['query'],_0x561284[_0x8db9('0x40')]));if(_0x412a69[_0x8db9('0x3e')][_0x8db9('0x49')]){_0x2814fd[_0x8db9('0x48')]=_['merge'](_0x2814fd[_0x8db9('0x48')],{'$or':_[_0x8db9('0x37')](_0x2814fd[_0x8db9('0x43')],function(_0x1c125d){var _0x31ba0e={};_0x31ba0e[_0x1c125d]={'$like':'%'+_0x412a69[_0x8db9('0x3e')][_0x8db9('0x49')]+'%'};return _0x31ba0e;})});}_0x2814fd=_[_0x8db9('0x4a')]({},_0x2814fd,_0x412a69[_0x8db9('0x4c')]);return _0x7343f4[_0x8db9('0x56')](_0x2814fd);}})['then'](function(_0x1fccee){if(_0x1fccee){_0x5b9df2=_0x1fccee[_0x8db9('0x44')];if(!_0x412a69[_0x8db9('0x3e')][_0x8db9('0x45')](_0x8db9('0x46'))){_0x2814fd[_0x8db9('0x2d')]=qs[_0x8db9('0x2d')](_0x412a69[_0x8db9('0x3e')][_0x8db9('0x2d')]);_0x2814fd[_0x8db9('0x2c')]=qs[_0x8db9('0x2c')](_0x412a69[_0x8db9('0x3e')]['offset']);}return _0x7343f4[_0x8db9('0x56')](_0x2814fd);}})[_0x8db9('0x32')](function(_0x4097fb){if(_0x4097fb){return _0x4097fb?{'count':_0x5b9df2,'rows':_0x4097fb}:null;}})[_0x8db9('0x32')](respondWithResult(_0x33cde6,null))[_0x8db9('0x28')](handleError(_0x33cde6,null));};exports[_0x8db9('0x59')]=function(_0x2a7a33,_0x2bcc8a,_0x2a5c7a){var _0x5b5a42={};var _0x1bc22f={};var _0x5f44e6;var _0x569b1f;return db[_0x8db9('0x38')]['findOne']({'where':{'id':_0x2a7a33[_0x8db9('0x50')]['id']}})[_0x8db9('0x32')](handleEntityNotFound(_0x2bcc8a,null))[_0x8db9('0x32')](function(_0x228f31){if(_0x228f31){_0x5f44e6=_0x228f31;_0x1bc22f[_0x8db9('0x3d')]=_[_0x8db9('0x3f')](db[_0x8db9('0x5a')][_0x8db9('0x39')]);_0x1bc22f[_0x8db9('0x3e')]=_[_0x8db9('0x3f')](_0x2a7a33['query']);_0x1bc22f[_0x8db9('0x40')]=_[_0x8db9('0x41')](_0x1bc22f['model'],_0x1bc22f[_0x8db9('0x3e')]);_0x5b5a42[_0x8db9('0x43')]=_['intersection'](_0x1bc22f[_0x8db9('0x3d')],qs[_0x8db9('0x42')](_0x2a7a33[_0x8db9('0x3e')]['fields']));_0x5b5a42[_0x8db9('0x43')]=_0x5b5a42[_0x8db9('0x43')]['length']?_0x5b5a42['attributes']:_0x1bc22f[_0x8db9('0x3d')];_0x5b5a42['order']=qs[_0x8db9('0x47')](_0x2a7a33[_0x8db9('0x3e')]['sort']);_0x5b5a42[_0x8db9('0x48')]=qs[_0x8db9('0x40')](_[_0x8db9('0x58')](_0x2a7a33[_0x8db9('0x3e')],_0x1bc22f[_0x8db9('0x40')]));if(_0x2a7a33[_0x8db9('0x3e')][_0x8db9('0x49')]){_0x5b5a42[_0x8db9('0x48')]=_[_0x8db9('0x4a')](_0x5b5a42['where'],{'$or':_[_0x8db9('0x37')](_0x5b5a42[_0x8db9('0x43')],function(_0xd0cfee){var _0x2cdbe7={};_0x2cdbe7[_0xd0cfee]={'$like':'%'+_0x2a7a33['query']['filter']+'%'};return _0x2cdbe7;})});}_0x5b5a42=_[_0x8db9('0x4a')]({},_0x5b5a42,_0x2a7a33['options']);return _0x5f44e6['getSubjects'](_0x5b5a42);}})['then'](function(_0xb2c25b){if(_0xb2c25b){_0x569b1f=_0xb2c25b[_0x8db9('0x44')];if(!_0x2a7a33[_0x8db9('0x3e')][_0x8db9('0x45')](_0x8db9('0x46'))){_0x5b5a42['limit']=qs['limit'](_0x2a7a33[_0x8db9('0x3e')][_0x8db9('0x2d')]);_0x5b5a42[_0x8db9('0x2c')]=qs[_0x8db9('0x2c')](_0x2a7a33[_0x8db9('0x3e')][_0x8db9('0x2c')]);}return _0x5f44e6[_0x8db9('0x59')](_0x5b5a42);}})[_0x8db9('0x32')](function(_0x58339f){if(_0x58339f){return _0x58339f?{'count':_0x569b1f,'rows':_0x58339f}:null;}})['then'](respondWithResult(_0x2bcc8a,null))['catch'](handleError(_0x2bcc8a,null));};exports[_0x8db9('0x5b')]=function(_0x5d4de0,_0x3c8672,_0x305282){var _0x396f58={};var _0x490071={};var _0x1a0c89;var _0x528911;return db[_0x8db9('0x38')][_0x8db9('0x5c')]({'where':{'id':_0x5d4de0[_0x8db9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3c8672,null))[_0x8db9('0x32')](function(_0x562c5f){if(_0x562c5f){_0x1a0c89=_0x562c5f;_0x490071[_0x8db9('0x3d')]=_[_0x8db9('0x3f')](db['FreshdeskField'][_0x8db9('0x39')]);_0x490071[_0x8db9('0x3e')]=_[_0x8db9('0x3f')](_0x5d4de0['query']);_0x490071[_0x8db9('0x40')]=_[_0x8db9('0x41')](_0x490071[_0x8db9('0x3d')],_0x490071[_0x8db9('0x3e')]);_0x396f58[_0x8db9('0x43')]=_[_0x8db9('0x41')](_0x490071[_0x8db9('0x3d')],qs[_0x8db9('0x42')](_0x5d4de0[_0x8db9('0x3e')]['fields']));_0x396f58[_0x8db9('0x43')]=_0x396f58[_0x8db9('0x43')][_0x8db9('0x44')]?_0x396f58[_0x8db9('0x43')]:_0x490071[_0x8db9('0x3d')];_0x396f58[_0x8db9('0x57')]=qs['sort'](_0x5d4de0[_0x8db9('0x3e')][_0x8db9('0x47')]);_0x396f58[_0x8db9('0x48')]=qs[_0x8db9('0x40')](_['pick'](_0x5d4de0[_0x8db9('0x3e')],_0x490071['filters']));if(_0x5d4de0[_0x8db9('0x3e')][_0x8db9('0x49')]){_0x396f58[_0x8db9('0x48')]=_['merge'](_0x396f58[_0x8db9('0x48')],{'$or':_[_0x8db9('0x37')](_0x396f58[_0x8db9('0x43')],function(_0x50e28a){var _0x27107a={};_0x27107a[_0x50e28a]={'$like':'%'+_0x5d4de0[_0x8db9('0x3e')][_0x8db9('0x49')]+'%'};return _0x27107a;})});}_0x396f58=_[_0x8db9('0x4a')]({},_0x396f58,_0x5d4de0['options']);return _0x1a0c89[_0x8db9('0x5b')](_0x396f58);}})[_0x8db9('0x32')](function(_0x393e66){if(_0x393e66){_0x528911=_0x393e66[_0x8db9('0x44')];if(!_0x5d4de0[_0x8db9('0x3e')][_0x8db9('0x45')](_0x8db9('0x46'))){_0x396f58['limit']=qs[_0x8db9('0x2d')](_0x5d4de0[_0x8db9('0x3e')][_0x8db9('0x2d')]);_0x396f58[_0x8db9('0x2c')]=qs[_0x8db9('0x2c')](_0x5d4de0[_0x8db9('0x3e')][_0x8db9('0x2c')]);}return _0x1a0c89[_0x8db9('0x5b')](_0x396f58);}})['then'](function(_0x63c24d){if(_0x63c24d){return _0x63c24d?{'count':_0x528911,'rows':_0x63c24d}:null;}})['then'](respondWithResult(_0x3c8672,null))[_0x8db9('0x28')](handleError(_0x3c8672,null));};exports[_0x8db9('0x5d')]=function(_0x5733d2,_0x3548c0,_0x4cbbff){var _0x138495={};var _0x5a5df5={};var _0x23fff7;var _0x496499;return db[_0x8db9('0x38')][_0x8db9('0x5c')]({'where':{'id':_0x5733d2[_0x8db9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3548c0,null))[_0x8db9('0x32')](function(_0x4f5bc6){if(_0x4f5bc6){_0x23fff7=_0x4f5bc6;_0x5a5df5[_0x8db9('0x3d')]=_[_0x8db9('0x3f')](db['Tag'][_0x8db9('0x39')]);_0x5a5df5[_0x8db9('0x3e')]=_[_0x8db9('0x3f')](_0x5733d2[_0x8db9('0x3e')]);_0x5a5df5[_0x8db9('0x40')]=_[_0x8db9('0x41')](_0x5a5df5[_0x8db9('0x3d')],_0x5a5df5[_0x8db9('0x3e')]);_0x138495[_0x8db9('0x43')]=_[_0x8db9('0x41')](_0x5a5df5[_0x8db9('0x3d')],qs[_0x8db9('0x42')](_0x5733d2['query'][_0x8db9('0x42')]));_0x138495[_0x8db9('0x43')]=_0x138495['attributes'][_0x8db9('0x44')]?_0x138495[_0x8db9('0x43')]:_0x5a5df5[_0x8db9('0x3d')];_0x138495[_0x8db9('0x57')]=qs['sort'](_0x5733d2[_0x8db9('0x3e')][_0x8db9('0x47')]);_0x138495[_0x8db9('0x48')]=qs[_0x8db9('0x40')](_[_0x8db9('0x58')](_0x5733d2['query'],_0x5a5df5[_0x8db9('0x40')]));if(_0x5733d2['query'][_0x8db9('0x49')]){_0x138495['where']=_[_0x8db9('0x4a')](_0x138495[_0x8db9('0x48')],{'$or':_['map'](_0x138495[_0x8db9('0x43')],function(_0x32fe4e){var _0x4f558b={};_0x4f558b[_0x32fe4e]={'$like':'%'+_0x5733d2['query'][_0x8db9('0x49')]+'%'};return _0x4f558b;})});}_0x138495=_[_0x8db9('0x4a')]({},_0x138495,_0x5733d2[_0x8db9('0x4c')]);return _0x23fff7[_0x8db9('0x5d')](_0x138495);}})[_0x8db9('0x32')](function(_0x54617d){if(_0x54617d){_0x496499=_0x54617d['length'];if(!_0x5733d2[_0x8db9('0x3e')][_0x8db9('0x45')](_0x8db9('0x46'))){_0x138495[_0x8db9('0x2d')]=qs[_0x8db9('0x2d')](_0x5733d2['query'][_0x8db9('0x2d')]);_0x138495[_0x8db9('0x2c')]=qs[_0x8db9('0x2c')](_0x5733d2[_0x8db9('0x3e')][_0x8db9('0x2c')]);}return _0x23fff7[_0x8db9('0x5d')](_0x138495);}})[_0x8db9('0x32')](function(_0x41f912){if(_0x41f912){return _0x41f912?{'count':_0x496499,'rows':_0x41f912}:null;}})[_0x8db9('0x32')](respondWithResult(_0x3548c0,null))[_0x8db9('0x28')](handleError(_0x3548c0,null));};exports['setTags']=function(_0x4174d1,_0x2f9b77,_0x1911de){if(_0x4174d1[_0x8db9('0x54')]['id']){delete _0x4174d1[_0x8db9('0x54')]['id'];}return db[_0x8db9('0x38')][_0x8db9('0x5c')]({'where':{'id':_0x4174d1['params']['id']}})[_0x8db9('0x32')](handleEntityNotFound(_0x2f9b77,null))[_0x8db9('0x32')](function(_0x34f103){if(_0x34f103){return _0x34f103[_0x8db9('0x5e')](_0x4174d1[_0x8db9('0x54')][_0x8db9('0x5f')]||[]);}return null;})[_0x8db9('0x32')](respondWithResult(_0x2f9b77,null))[_0x8db9('0x28')](handleError(_0x2f9b77,null));}; \ No newline at end of file +var _0x6680=['destroy','sendStatus','name','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','keys','FreshdeskConfiguration','find','catch','create','body','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4bfe36,_0x53c9f2){var _0x4005a0=function(_0x41e2b4){while(--_0x41e2b4){_0x4bfe36['push'](_0x4bfe36['shift']());}};_0x4005a0(++_0x53c9f2);}(_0x6680,0x198));var _0x0668=function(_0x202692,_0xe9c688){_0x202692=_0x202692-0x0;var _0x1e7eda=_0x6680[_0x202692];return _0x1e7eda;};'use strict';var pdf=require(_0x0668('0x0'));var emlformat=require(_0x0668('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0668('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0668('0x3'));var moment=require(_0x0668('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0668('0x5'));var path=require(_0x0668('0x6'));var sox=require(_0x0668('0x7'));var csv=require(_0x0668('0x8'));var ejs=require(_0x0668('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0668('0xa'));var crypto=require(_0x0668('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0668('0xc'));var toCsv=require(_0x0668('0x8'));var querystring=require(_0x0668('0xd'));var Papa=require('papaparse');var Redis=require(_0x0668('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0668('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0668('0x10'));var logger=require(_0x0668('0x11'))('api');var utils=require(_0x0668('0x12'));var config=require(_0x0668('0x13'));var licenseUtil=require(_0x0668('0x14'));var db=require(_0x0668('0x15'))['db'];var jayson=require(_0x0668('0x16'));var client=jayson['client'][_0x0668('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x476ce4,_0x462505,_0xdbf22e,_0x9b3cd){return new BPromise(function(_0x2a52c1,_0x32737a){var _0xe19dc0=_0x9b3cd||client;return _0xe19dc0[_0x0668('0x18')](_0x476ce4,_0xdbf22e)[_0x0668('0x19')](function(_0xd5d698){logger[_0x0668('0x1a')](_0x0668('0x1b'),_0x462505,_0x0668('0x1c'));logger[_0x0668('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x462505,_0x0668('0x1c'),JSON[_0x0668('0x1e')](_0xd5d698));if(_0xd5d698[_0x0668('0x1f')]){if(_0xd5d698['error'][_0x0668('0x20')]===0x1f4){logger[_0x0668('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x462505,_0xd5d698[_0x0668('0x1f')][_0x0668('0x21')]);return _0x32737a(_0xd5d698['error'][_0x0668('0x21')]);}logger['error'](_0x0668('0x1b'),_0x462505,_0xd5d698[_0x0668('0x1f')][_0x0668('0x21')]);return _0x2a52c1(_0xd5d698['error']['message']);}else{logger['info'](_0x0668('0x1b'),_0x462505,_0x0668('0x1c'));_0x2a52c1(_0xd5d698[_0x0668('0x22')][_0x0668('0x21')]);}})['catch'](function(_0x330511){logger[_0x0668('0x1f')](_0x0668('0x1b'),_0x462505,_0x330511);_0x32737a(_0x330511);});});}function respondWithStatusCode(_0x3dcdcc,_0x1b0358){_0x1b0358=_0x1b0358||0xcc;return function(_0x2f6fc7){if(_0x2f6fc7){return _0x3dcdcc['sendStatus'](_0x1b0358);}return _0x3dcdcc[_0x0668('0x23')](_0x1b0358)[_0x0668('0x24')]();};}function respondWithResult(_0x3f964b,_0x4d67d7){_0x4d67d7=_0x4d67d7||0xc8;return function(_0x3fe2f7){if(_0x3fe2f7){return _0x3f964b[_0x0668('0x23')](_0x4d67d7)[_0x0668('0x25')](_0x3fe2f7);}};}function respondWithFilteredResult(_0x38deb2,_0x34ba6d){return function(_0x153f65){if(_0x153f65){var _0x17afec=_0x153f65[_0x0668('0x26')],_0x3da768=_0x34ba6d[_0x0668('0x27')],_0x431925=_0x34ba6d['offset']+_0x34ba6d[_0x0668('0x28')],_0x973320;if(_0x431925>=_0x17afec){_0x431925=_0x17afec;_0x973320=0xc8;}else{_0x973320=0xce;}_0x38deb2[_0x0668('0x23')](_0x973320);return _0x38deb2[_0x0668('0x29')](_0x0668('0x2a'),_0x3da768+'-'+_0x431925+'/'+_0x17afec)[_0x0668('0x25')](_0x153f65);}return null;};}function patchUpdates(_0x5cb166){return function(_0x12aeb1){try{jsonpatch[_0x0668('0x2b')](_0x12aeb1,_0x5cb166,!![]);}catch(_0x442437){return BPromise[_0x0668('0x2c')](_0x442437);}return _0x12aeb1[_0x0668('0x2d')]();};}function saveUpdates(_0x40ff65,_0x21206d){return function(_0x4585bd){if(_0x4585bd){return _0x4585bd[_0x0668('0x2e')](_0x40ff65)[_0x0668('0x19')](function(_0x23f5ad){return _0x23f5ad;});}return null;};}function removeEntity(_0xacf12e,_0x49e790){return function(_0x2fea97){if(_0x2fea97){return _0x2fea97[_0x0668('0x2f')]()['then'](function(){_0xacf12e[_0x0668('0x23')](0xcc)[_0x0668('0x24')]();});}};}function handleEntityNotFound(_0x568a84,_0x2893db){return function(_0x4a0dfb){if(!_0x4a0dfb){_0x568a84[_0x0668('0x30')](0x194);}return _0x4a0dfb;};}function handleError(_0x3e36fc,_0x19888f){_0x19888f=_0x19888f||0x1f4;return function(_0x4820eb){logger[_0x0668('0x1f')](_0x4820eb['stack']);if(_0x4820eb['name']){delete _0x4820eb[_0x0668('0x31')];}_0x3e36fc['status'](_0x19888f)['send'](_0x4820eb);};}exports[_0x0668('0x32')]=function(_0x41cd87,_0x930cba){var _0x2e5969={},_0x51d3f4={},_0x2ab954={'count':0x0,'rows':[]};var _0x336ac5=_['map'](db['FreshdeskConfiguration'][_0x0668('0x33')],function(_0x4cedd9){return{'name':_0x4cedd9[_0x0668('0x34')],'type':_0x4cedd9[_0x0668('0x35')]['key']};});_0x51d3f4[_0x0668('0x36')]=_['map'](_0x336ac5,'name');_0x51d3f4[_0x0668('0x37')]=_['keys'](_0x41cd87['query']);_0x51d3f4[_0x0668('0x38')]=_[_0x0668('0x39')](_0x51d3f4['model'],_0x51d3f4[_0x0668('0x37')]);_0x2e5969[_0x0668('0x3a')]=_[_0x0668('0x39')](_0x51d3f4['model'],qs[_0x0668('0x3b')](_0x41cd87[_0x0668('0x37')][_0x0668('0x3b')]));_0x2e5969[_0x0668('0x3a')]=_0x2e5969[_0x0668('0x3a')][_0x0668('0x3c')]?_0x2e5969['attributes']:_0x51d3f4[_0x0668('0x36')];if(!_0x41cd87[_0x0668('0x37')][_0x0668('0x3d')](_0x0668('0x3e'))){_0x2e5969[_0x0668('0x28')]=qs[_0x0668('0x28')](_0x41cd87[_0x0668('0x37')][_0x0668('0x28')]);_0x2e5969[_0x0668('0x27')]=qs[_0x0668('0x27')](_0x41cd87[_0x0668('0x37')]['offset']);}_0x2e5969[_0x0668('0x3f')]=qs['sort'](_0x41cd87[_0x0668('0x37')][_0x0668('0x40')]);_0x2e5969[_0x0668('0x41')]=qs[_0x0668('0x38')](_[_0x0668('0x42')](_0x41cd87['query'],_0x51d3f4[_0x0668('0x38')]),_0x336ac5);if(_0x41cd87[_0x0668('0x37')][_0x0668('0x43')]){_0x2e5969[_0x0668('0x41')]=_[_0x0668('0x44')](_0x2e5969[_0x0668('0x41')],{'$or':_[_0x0668('0x45')](_0x336ac5,function(_0x5da248){if(_0x5da248[_0x0668('0x35')]!==_0x0668('0x46')){var _0x330a7c={};_0x330a7c[_0x5da248['name']]={'$like':'%'+_0x41cd87[_0x0668('0x37')][_0x0668('0x43')]+'%'};return _0x330a7c;}})});}_0x2e5969=_[_0x0668('0x44')]({},_0x2e5969,_0x41cd87[_0x0668('0x47')]);var _0x1559fd={'where':_0x2e5969[_0x0668('0x41')]};return db['FreshdeskConfiguration'][_0x0668('0x26')](_0x1559fd)[_0x0668('0x19')](function(_0x2d07e3){_0x2ab954['count']=_0x2d07e3;if(_0x41cd87[_0x0668('0x37')][_0x0668('0x48')]){_0x2e5969[_0x0668('0x49')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x2e5969);})[_0x0668('0x19')](function(_0x3183a){_0x2ab954[_0x0668('0x4a')]=_0x3183a;return _0x2ab954;})[_0x0668('0x19')](respondWithFilteredResult(_0x930cba,_0x2e5969))['catch'](handleError(_0x930cba,null));};exports[_0x0668('0x4b')]=function(_0x4b9cf1,_0x5865bf){var _0x5231a3={'raw':![],'where':{'id':_0x4b9cf1['params']['id']}},_0x4985e0={};_0x4985e0[_0x0668('0x36')]=_[_0x0668('0x4c')](db[_0x0668('0x4d')]['rawAttributes']);_0x4985e0[_0x0668('0x37')]=_[_0x0668('0x4c')](_0x4b9cf1[_0x0668('0x37')]);_0x4985e0[_0x0668('0x38')]=_[_0x0668('0x39')](_0x4985e0[_0x0668('0x36')],_0x4985e0[_0x0668('0x37')]);_0x5231a3[_0x0668('0x3a')]=_[_0x0668('0x39')](_0x4985e0[_0x0668('0x36')],qs['fields'](_0x4b9cf1[_0x0668('0x37')][_0x0668('0x3b')]));_0x5231a3['attributes']=_0x5231a3[_0x0668('0x3a')]['length']?_0x5231a3[_0x0668('0x3a')]:_0x4985e0[_0x0668('0x36')];if(_0x4b9cf1['query']['includeAll']){_0x5231a3['include']=[{'all':!![]}];}_0x5231a3=_[_0x0668('0x44')]({},_0x5231a3,_0x4b9cf1['options']);return db[_0x0668('0x4d')][_0x0668('0x4e')](_0x5231a3)[_0x0668('0x19')](handleEntityNotFound(_0x5865bf,null))[_0x0668('0x19')](respondWithResult(_0x5865bf,null))[_0x0668('0x4f')](handleError(_0x5865bf,null));};exports[_0x0668('0x50')]=function(_0x2f6f68,_0x2957c6){return db[_0x0668('0x4d')]['create'](_0x2f6f68['body'],{})['then'](respondWithResult(_0x2957c6,0xc9))[_0x0668('0x4f')](handleError(_0x2957c6,null));};exports[_0x0668('0x2e')]=function(_0x3b68b9,_0x63d380){if(_0x3b68b9[_0x0668('0x51')]['id']){delete _0x3b68b9[_0x0668('0x51')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x3b68b9['params']['id']}})[_0x0668('0x19')](handleEntityNotFound(_0x63d380,null))[_0x0668('0x19')](saveUpdates(_0x3b68b9['body'],null))[_0x0668('0x19')](respondWithResult(_0x63d380,null))['catch'](handleError(_0x63d380,null));};exports[_0x0668('0x2f')]=function(_0x319e43,_0x1af10c){return db[_0x0668('0x4d')][_0x0668('0x4e')]({'where':{'id':_0x319e43[_0x0668('0x52')]['id']}})[_0x0668('0x19')](handleEntityNotFound(_0x1af10c,null))['then'](removeEntity(_0x1af10c,null))[_0x0668('0x4f')](handleError(_0x1af10c,null));};exports[_0x0668('0x53')]=function(_0x5c1af6,_0x17f8b6,_0x375eb8){var _0x3ebb93={};var _0x40b2b9={};var _0x432e62;var _0x3ea1fc;return db[_0x0668('0x4d')][_0x0668('0x54')]({'where':{'id':_0x5c1af6[_0x0668('0x52')]['id']}})['then'](handleEntityNotFound(_0x17f8b6,null))[_0x0668('0x19')](function(_0x157dae){if(_0x157dae){_0x432e62=_0x157dae;_0x40b2b9[_0x0668('0x36')]=_[_0x0668('0x4c')](db[_0x0668('0x55')][_0x0668('0x33')]);_0x40b2b9[_0x0668('0x37')]=_[_0x0668('0x4c')](_0x5c1af6[_0x0668('0x37')]);_0x40b2b9[_0x0668('0x38')]=_[_0x0668('0x39')](_0x40b2b9['model'],_0x40b2b9[_0x0668('0x37')]);_0x3ebb93['attributes']=_[_0x0668('0x39')](_0x40b2b9[_0x0668('0x36')],qs[_0x0668('0x3b')](_0x5c1af6[_0x0668('0x37')]['fields']));_0x3ebb93[_0x0668('0x3a')]=_0x3ebb93[_0x0668('0x3a')][_0x0668('0x3c')]?_0x3ebb93[_0x0668('0x3a')]:_0x40b2b9[_0x0668('0x36')];_0x3ebb93[_0x0668('0x3f')]=qs[_0x0668('0x40')](_0x5c1af6[_0x0668('0x37')][_0x0668('0x40')]);_0x3ebb93['where']=qs[_0x0668('0x38')](_[_0x0668('0x42')](_0x5c1af6[_0x0668('0x37')],_0x40b2b9[_0x0668('0x38')]));if(_0x5c1af6[_0x0668('0x37')][_0x0668('0x43')]){_0x3ebb93[_0x0668('0x41')]=_[_0x0668('0x44')](_0x3ebb93['where'],{'$or':_[_0x0668('0x45')](_0x3ebb93[_0x0668('0x3a')],function(_0x2f0468){var _0x29163c={};_0x29163c[_0x2f0468]={'$like':'%'+_0x5c1af6[_0x0668('0x37')][_0x0668('0x43')]+'%'};return _0x29163c;})});}_0x3ebb93=_[_0x0668('0x44')]({},_0x3ebb93,_0x5c1af6[_0x0668('0x47')]);return _0x432e62[_0x0668('0x53')](_0x3ebb93);}})['then'](function(_0xafbfe){if(_0xafbfe){_0x3ea1fc=_0xafbfe['length'];if(!_0x5c1af6[_0x0668('0x37')][_0x0668('0x3d')](_0x0668('0x3e'))){_0x3ebb93['limit']=qs[_0x0668('0x28')](_0x5c1af6['query'][_0x0668('0x28')]);_0x3ebb93['offset']=qs['offset'](_0x5c1af6[_0x0668('0x37')][_0x0668('0x27')]);}return _0x432e62[_0x0668('0x53')](_0x3ebb93);}})[_0x0668('0x19')](function(_0x1e41a0){if(_0x1e41a0){return _0x1e41a0?{'count':_0x3ea1fc,'rows':_0x1e41a0}:null;}})['then'](respondWithResult(_0x17f8b6,null))[_0x0668('0x4f')](handleError(_0x17f8b6,null));};exports['getSubjects']=function(_0xfb87e3,_0x1155b1,_0x21041e){var _0x242287={};var _0x2f04e8={};var _0x3127ee;var _0x4824eb;return db[_0x0668('0x4d')][_0x0668('0x54')]({'where':{'id':_0xfb87e3[_0x0668('0x52')]['id']}})[_0x0668('0x19')](handleEntityNotFound(_0x1155b1,null))[_0x0668('0x19')](function(_0x4211ff){if(_0x4211ff){_0x3127ee=_0x4211ff;_0x2f04e8['model']=_[_0x0668('0x4c')](db[_0x0668('0x55')][_0x0668('0x33')]);_0x2f04e8[_0x0668('0x37')]=_[_0x0668('0x4c')](_0xfb87e3[_0x0668('0x37')]);_0x2f04e8[_0x0668('0x38')]=_[_0x0668('0x39')](_0x2f04e8['model'],_0x2f04e8[_0x0668('0x37')]);_0x242287[_0x0668('0x3a')]=_['intersection'](_0x2f04e8['model'],qs[_0x0668('0x3b')](_0xfb87e3[_0x0668('0x37')][_0x0668('0x3b')]));_0x242287[_0x0668('0x3a')]=_0x242287[_0x0668('0x3a')][_0x0668('0x3c')]?_0x242287[_0x0668('0x3a')]:_0x2f04e8['model'];_0x242287[_0x0668('0x3f')]=qs['sort'](_0xfb87e3['query'][_0x0668('0x40')]);_0x242287['where']=qs['filters'](_[_0x0668('0x42')](_0xfb87e3[_0x0668('0x37')],_0x2f04e8[_0x0668('0x38')]));if(_0xfb87e3['query']['filter']){_0x242287['where']=_['merge'](_0x242287[_0x0668('0x41')],{'$or':_[_0x0668('0x45')](_0x242287[_0x0668('0x3a')],function(_0x41ec90){var _0x553e06={};_0x553e06[_0x41ec90]={'$like':'%'+_0xfb87e3[_0x0668('0x37')][_0x0668('0x43')]+'%'};return _0x553e06;})});}_0x242287=_[_0x0668('0x44')]({},_0x242287,_0xfb87e3[_0x0668('0x47')]);return _0x3127ee[_0x0668('0x56')](_0x242287);}})[_0x0668('0x19')](function(_0xff4a0c){if(_0xff4a0c){_0x4824eb=_0xff4a0c[_0x0668('0x3c')];if(!_0xfb87e3[_0x0668('0x37')][_0x0668('0x3d')](_0x0668('0x3e'))){_0x242287[_0x0668('0x28')]=qs[_0x0668('0x28')](_0xfb87e3[_0x0668('0x37')][_0x0668('0x28')]);_0x242287[_0x0668('0x27')]=qs[_0x0668('0x27')](_0xfb87e3[_0x0668('0x37')][_0x0668('0x27')]);}return _0x3127ee[_0x0668('0x56')](_0x242287);}})[_0x0668('0x19')](function(_0x59445d){if(_0x59445d){return _0x59445d?{'count':_0x4824eb,'rows':_0x59445d}:null;}})['then'](respondWithResult(_0x1155b1,null))[_0x0668('0x4f')](handleError(_0x1155b1,null));};exports['getDescriptions']=function(_0x298731,_0x1e12bc,_0x1bed0c){var _0xd9204a={};var _0x2cbeff={};var _0x2467f1;var _0x3e56a5;return db[_0x0668('0x4d')][_0x0668('0x54')]({'where':{'id':_0x298731[_0x0668('0x52')]['id']}})[_0x0668('0x19')](handleEntityNotFound(_0x1e12bc,null))[_0x0668('0x19')](function(_0xe73930){if(_0xe73930){_0x2467f1=_0xe73930;_0x2cbeff[_0x0668('0x36')]=_['keys'](db['FreshdeskField'][_0x0668('0x33')]);_0x2cbeff[_0x0668('0x37')]=_[_0x0668('0x4c')](_0x298731[_0x0668('0x37')]);_0x2cbeff[_0x0668('0x38')]=_[_0x0668('0x39')](_0x2cbeff[_0x0668('0x36')],_0x2cbeff[_0x0668('0x37')]);_0xd9204a[_0x0668('0x3a')]=_[_0x0668('0x39')](_0x2cbeff[_0x0668('0x36')],qs[_0x0668('0x3b')](_0x298731[_0x0668('0x37')][_0x0668('0x3b')]));_0xd9204a['attributes']=_0xd9204a['attributes'][_0x0668('0x3c')]?_0xd9204a['attributes']:_0x2cbeff[_0x0668('0x36')];_0xd9204a[_0x0668('0x3f')]=qs[_0x0668('0x40')](_0x298731['query'][_0x0668('0x40')]);_0xd9204a[_0x0668('0x41')]=qs[_0x0668('0x38')](_[_0x0668('0x42')](_0x298731[_0x0668('0x37')],_0x2cbeff['filters']));if(_0x298731[_0x0668('0x37')][_0x0668('0x43')]){_0xd9204a[_0x0668('0x41')]=_['merge'](_0xd9204a[_0x0668('0x41')],{'$or':_['map'](_0xd9204a['attributes'],function(_0x2f4088){var _0x3fdca5={};_0x3fdca5[_0x2f4088]={'$like':'%'+_0x298731[_0x0668('0x37')]['filter']+'%'};return _0x3fdca5;})});}_0xd9204a=_[_0x0668('0x44')]({},_0xd9204a,_0x298731[_0x0668('0x47')]);return _0x2467f1[_0x0668('0x57')](_0xd9204a);}})[_0x0668('0x19')](function(_0x3eed81){if(_0x3eed81){_0x3e56a5=_0x3eed81[_0x0668('0x3c')];if(!_0x298731['query'][_0x0668('0x3d')](_0x0668('0x3e'))){_0xd9204a[_0x0668('0x28')]=qs[_0x0668('0x28')](_0x298731[_0x0668('0x37')][_0x0668('0x28')]);_0xd9204a[_0x0668('0x27')]=qs['offset'](_0x298731[_0x0668('0x37')][_0x0668('0x27')]);}return _0x2467f1[_0x0668('0x57')](_0xd9204a);}})[_0x0668('0x19')](function(_0x30d828){if(_0x30d828){return _0x30d828?{'count':_0x3e56a5,'rows':_0x30d828}:null;}})[_0x0668('0x19')](respondWithResult(_0x1e12bc,null))[_0x0668('0x4f')](handleError(_0x1e12bc,null));};exports[_0x0668('0x58')]=function(_0x512018,_0x3e0618,_0xca99ba){var _0x21849d={};var _0xa1dfc={};var _0x4fe4eb;var _0x5b5bc0;return db['FreshdeskConfiguration'][_0x0668('0x54')]({'where':{'id':_0x512018[_0x0668('0x52')]['id']}})[_0x0668('0x19')](handleEntityNotFound(_0x3e0618,null))[_0x0668('0x19')](function(_0x46f4ba){if(_0x46f4ba){_0x4fe4eb=_0x46f4ba;_0xa1dfc[_0x0668('0x36')]=_['keys'](db[_0x0668('0x59')][_0x0668('0x33')]);_0xa1dfc[_0x0668('0x37')]=_[_0x0668('0x4c')](_0x512018[_0x0668('0x37')]);_0xa1dfc[_0x0668('0x38')]=_[_0x0668('0x39')](_0xa1dfc[_0x0668('0x36')],_0xa1dfc[_0x0668('0x37')]);_0x21849d[_0x0668('0x3a')]=_[_0x0668('0x39')](_0xa1dfc[_0x0668('0x36')],qs[_0x0668('0x3b')](_0x512018[_0x0668('0x37')][_0x0668('0x3b')]));_0x21849d[_0x0668('0x3a')]=_0x21849d[_0x0668('0x3a')][_0x0668('0x3c')]?_0x21849d['attributes']:_0xa1dfc[_0x0668('0x36')];_0x21849d[_0x0668('0x3f')]=qs['sort'](_0x512018[_0x0668('0x37')][_0x0668('0x40')]);_0x21849d[_0x0668('0x41')]=qs[_0x0668('0x38')](_[_0x0668('0x42')](_0x512018['query'],_0xa1dfc[_0x0668('0x38')]));if(_0x512018[_0x0668('0x37')][_0x0668('0x43')]){_0x21849d['where']=_['merge'](_0x21849d['where'],{'$or':_['map'](_0x21849d['attributes'],function(_0xc49772){var _0x547ef5={};_0x547ef5[_0xc49772]={'$like':'%'+_0x512018[_0x0668('0x37')][_0x0668('0x43')]+'%'};return _0x547ef5;})});}_0x21849d=_[_0x0668('0x44')]({},_0x21849d,_0x512018[_0x0668('0x47')]);return _0x4fe4eb[_0x0668('0x58')](_0x21849d);}})[_0x0668('0x19')](function(_0x86e1f8){if(_0x86e1f8){_0x5b5bc0=_0x86e1f8[_0x0668('0x3c')];if(!_0x512018[_0x0668('0x37')][_0x0668('0x3d')]('nolimit')){_0x21849d['limit']=qs[_0x0668('0x28')](_0x512018[_0x0668('0x37')][_0x0668('0x28')]);_0x21849d[_0x0668('0x27')]=qs[_0x0668('0x27')](_0x512018[_0x0668('0x37')]['offset']);}return _0x4fe4eb[_0x0668('0x58')](_0x21849d);}})[_0x0668('0x19')](function(_0x30c088){if(_0x30c088){return _0x30c088?{'count':_0x5b5bc0,'rows':_0x30c088}:null;}})['then'](respondWithResult(_0x3e0618,null))['catch'](handleError(_0x3e0618,null));};exports['setTags']=function(_0x5eb30e,_0x22a436,_0x5042e7){if(_0x5eb30e['body']['id']){delete _0x5eb30e['body']['id'];}return db[_0x0668('0x4d')][_0x0668('0x54')]({'where':{'id':_0x5eb30e['params']['id']}})[_0x0668('0x19')](handleEntityNotFound(_0x22a436,null))[_0x0668('0x19')](function(_0x2aaac3){if(_0x2aaac3){return _0x2aaac3[_0x0668('0x5a')](_0x5eb30e[_0x0668('0x51')]['ids']||[]);}return null;})[_0x0668('0x19')](respondWithResult(_0x22a436,null))[_0x0668('0x4f')](handleError(_0x22a436,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 683f9b6..b7ee395 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 _0x0e6f=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x5dcca6,_0x1672e8){var _0x178cae=function(_0x3f2ef0){while(--_0x3f2ef0){_0x5dcca6['push'](_0x5dcca6['shift']());}};_0x178cae(++_0x1672e8);}(_0x0e6f,0x128));var _0xf0e6=function(_0x1fdff9,_0x4c4bf4){_0x1fdff9=_0x1fdff9-0x0;var _0x3d1b6e=_0x0e6f[_0x1fdff9];return _0x3d1b6e;};'use strict';var _=require(_0xf0e6('0x0'));var util=require(_0xf0e6('0x1'));var logger=require(_0xf0e6('0x2'))(_0xf0e6('0x3'));var moment=require('moment');var BPromise=require(_0xf0e6('0x4'));var rp=require(_0xf0e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf0e6('0x6'));var attributes=require(_0xf0e6('0x7'));module['exports']=function(_0xf5efe1,_0x2f5c91){return _0xf5efe1[_0xf0e6('0x8')](_0xf0e6('0x9'),attributes,{'tableName':_0xf0e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe045=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment','bluebird','request-promise'];(function(_0x2be1c,_0x229643){var _0x3fb003=function(_0x121d98){while(--_0x121d98){_0x2be1c['push'](_0x2be1c['shift']());}};_0x3fb003(++_0x229643);}(_0xe045,0xac));var _0x5e04=function(_0x531388,_0xd4c2e9){_0x531388=_0x531388-0x0;var _0x245916=_0xe045[_0x531388];return _0x245916;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5e04('0x0'))('api');var moment=require(_0x5e04('0x1'));var BPromise=require(_0x5e04('0x2'));var rp=require(_0x5e04('0x3'));var fs=require('fs');var path=require(_0x5e04('0x4'));var rimraf=require(_0x5e04('0x5'));var config=require(_0x5e04('0x6'));var attributes=require(_0x5e04('0x7'));module['exports']=function(_0x8c927b,_0xdf278c){return _0x8c927b[_0x5e04('0x8')](_0x5e04('0x9'),attributes,{'tableName':_0x5e04('0xa'),'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 64c7f92..4ac1fc7 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 _0xbb51=['moment','ioredis','../../config/utils','../../config/environment','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5cf53d,_0x29d8be){var _0x2c5588=function(_0x106e47){while(--_0x106e47){_0x5cf53d['push'](_0x5cf53d['shift']());}};_0x2c5588(++_0x29d8be);}(_0xbb51,0x1d9));var _0x1bb5=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xbb51[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x1bb5('0x0'));var util=require(_0x1bb5('0x1'));var moment=require(_0x1bb5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bb5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1bb5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1bb5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351eae,_0x1e010d,_0x10cdca){return new BPromise(function(_0x521ad2,_0x50243f){return client[_0x1bb5('0x7')](_0x351eae,_0x10cdca)[_0x1bb5('0x8')](function(_0x5f2bf2){logger[_0x1bb5('0x9')](_0x1bb5('0xa'),_0x1e010d,'request\x20sent');logger[_0x1bb5('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e010d,_0x1bb5('0xc'),JSON[_0x1bb5('0xd')](_0x5f2bf2));if(_0x5f2bf2[_0x1bb5('0xe')]){if(_0x5f2bf2[_0x1bb5('0xe')][_0x1bb5('0xf')]===0x1f4){logger['error'](_0x1bb5('0xa'),_0x1e010d,_0x5f2bf2[_0x1bb5('0xe')][_0x1bb5('0x10')]);return _0x50243f(_0x5f2bf2['error'][_0x1bb5('0x10')]);}logger[_0x1bb5('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e010d,_0x5f2bf2['error'][_0x1bb5('0x10')]);return _0x521ad2(_0x5f2bf2['error']['message']);}else{logger[_0x1bb5('0x9')](_0x1bb5('0xa'),_0x1e010d,_0x1bb5('0xc'));_0x521ad2(_0x5f2bf2[_0x1bb5('0x11')][_0x1bb5('0x10')]);}})[_0x1bb5('0x12')](function(_0x350d9f){logger[_0x1bb5('0xe')](_0x1bb5('0xa'),_0x1e010d,_0x350d9f);_0x50243f(_0x350d9f);});});} \ No newline at end of file +var _0x37c2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3fa517,_0x1ccac0){var _0x1b66a8=function(_0x5cbc8c){while(--_0x5cbc8c){_0x3fa517['push'](_0x3fa517['shift']());}};_0x1b66a8(++_0x1ccac0);}(_0x37c2,0x1d8));var _0x237c=function(_0x423758,_0x5c677a){_0x423758=_0x423758-0x0;var _0x2e6352=_0x37c2[_0x423758];return _0x2e6352;};'use strict';var _=require(_0x237c('0x0'));var util=require('util');var moment=require(_0x237c('0x1'));var BPromise=require(_0x237c('0x2'));var rs=require(_0x237c('0x3'));var fs=require('fs');var Redis=require(_0x237c('0x4'));var db=require(_0x237c('0x5'))['db'];var utils=require(_0x237c('0x6'));var logger=require(_0x237c('0x7'))(_0x237c('0x8'));var config=require(_0x237c('0x9'));var jayson=require(_0x237c('0xa'));var client=jayson[_0x237c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57ab47,_0x346853,_0x312c52){return new BPromise(function(_0xf94f61,_0x2eeda3){return client[_0x237c('0xc')](_0x57ab47,_0x312c52)[_0x237c('0xd')](function(_0x139467){logger[_0x237c('0xe')](_0x237c('0xf'),_0x346853,_0x237c('0x10'));logger[_0x237c('0x11')](_0x237c('0x12'),_0x346853,_0x237c('0x10'),JSON[_0x237c('0x13')](_0x139467));if(_0x139467[_0x237c('0x14')]){if(_0x139467[_0x237c('0x14')][_0x237c('0x15')]===0x1f4){logger[_0x237c('0x14')](_0x237c('0xf'),_0x346853,_0x139467[_0x237c('0x14')][_0x237c('0x16')]);return _0x2eeda3(_0x139467[_0x237c('0x14')][_0x237c('0x16')]);}logger[_0x237c('0x14')](_0x237c('0xf'),_0x346853,_0x139467[_0x237c('0x14')]['message']);return _0xf94f61(_0x139467[_0x237c('0x14')][_0x237c('0x16')]);}else{logger[_0x237c('0xe')](_0x237c('0xf'),_0x346853,'request\x20sent');_0xf94f61(_0x139467[_0x237c('0x17')]['message']);}})[_0x237c('0x18')](function(_0x5b1c37){logger[_0x237c('0x14')](_0x237c('0xf'),_0x346853,_0x5b1c37);_0x2eeda3(_0x5b1c37);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5d45af7..bd28e02 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x326ad4,_0x1744ac){var _0x58df34=function(_0x3778c9){while(--_0x3778c9){_0x326ad4['push'](_0x326ad4['shift']());}};_0x58df34(++_0x1744ac);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x34e8,0x12c));var _0x834e=function(_0x20e7b6,_0x2abb63){_0x20e7b6=_0x20e7b6-0x0;var _0x324fa3=_0x34e8[_0x20e7b6];return _0x324fa3;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index eda3a4c..421ecc9 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 _0xfbaf=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbaf,0xcb));var _0xffba=function(_0x1cdb15,_0x34a71a){_0x1cdb15=_0x1cdb15-0x0;var _0xaf5e4a=_0xfbaf[_0x1cdb15];return _0xaf5e4a;};'use strict';var Sequelize=require(_0xffba('0x0'));module[_0xffba('0x1')]={'type':{'type':Sequelize['ENUM'](_0xffba('0x2'),_0xffba('0x3'),'customVariable',_0xffba('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xffba('0x5')]},'key':{'type':Sequelize[_0xffba('0x5')]},'keyType':{'type':Sequelize[_0xffba('0x6')](_0xffba('0x2'),_0xffba('0x3'),_0xffba('0x7'))},'keyContent':{'type':Sequelize[_0xffba('0x5')]},'idField':{'type':Sequelize[_0xffba('0x5')]},'nameField':{'type':Sequelize[_0xffba('0x5')]},'customField':{'type':Sequelize[_0xffba('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffba('0x5')]}}; \ No newline at end of file +var _0x27a8=['customVariable','keyValue','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x385c9d,_0x13fa41){var _0x34997f=function(_0x2d23f1){while(--_0x2d23f1){_0x385c9d['push'](_0x385c9d['shift']());}};_0x34997f(++_0x13fa41);}(_0x27a8,0x170));var _0x827a=function(_0x4809b9,_0x39e590){_0x4809b9=_0x4809b9-0x0;var _0x4ae1b7=_0x27a8[_0x4809b9];return _0x4ae1b7;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x827a('0x0')](_0x827a('0x1'),_0x827a('0x2'),_0x827a('0x3'),_0x827a('0x4')),'defaultValue':_0x827a('0x1')},'content':{'type':Sequelize[_0x827a('0x5')]},'key':{'type':Sequelize[_0x827a('0x5')]},'keyType':{'type':Sequelize[_0x827a('0x0')](_0x827a('0x1'),_0x827a('0x2'),_0x827a('0x3'))},'keyContent':{'type':Sequelize[_0x827a('0x5')]},'idField':{'type':Sequelize[_0x827a('0x5')]},'nameField':{'type':Sequelize[_0x827a('0x5')]},'customField':{'type':Sequelize[_0x827a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x827a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f98cf4f..f1e8406 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 _0x5e0e=['save','update','then','destroy','sendStatus','error','stack','name','send','FreshdeskField','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','status','set','Content-Range','reject'];(function(_0x1e9ce6,_0x540c36){var _0xb30423=function(_0x501e4e){while(--_0x501e4e){_0x1e9ce6['push'](_0x1e9ce6['shift']());}};_0xb30423(++_0x540c36);}(_0x5e0e,0x147));var _0xe5e0=function(_0x23e02e,_0x4d26cb){_0x23e02e=_0x23e02e-0x0;var _0x2a6db8=_0x5e0e[_0x23e02e];return _0x2a6db8;};'use strict';var pdf=require(_0xe5e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe5e0('0x1'));var zipdir=require(_0xe5e0('0x2'));var jsonpatch=require(_0xe5e0('0x3'));var rp=require(_0xe5e0('0x4'));var moment=require(_0xe5e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe5e0('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe5e0('0x7'));var csv=require(_0xe5e0('0x8'));var ejs=require(_0xe5e0('0x9'));var fs=require('fs');var _=require(_0xe5e0('0xa'));var squel=require(_0xe5e0('0xb'));var crypto=require(_0xe5e0('0xc'));var jsforce=require(_0xe5e0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe5e0('0x8'));var querystring=require(_0xe5e0('0xe'));var Papa=require('papaparse');var Redis=require(_0xe5e0('0xf'));var authService=require(_0xe5e0('0x10'));var qs=require(_0xe5e0('0x11'));var as=require(_0xe5e0('0x12'));var hardwareService=require(_0xe5e0('0x13'));var logger=require('../../config/logger')(_0xe5e0('0x14'));var utils=require(_0xe5e0('0x15'));var config=require(_0xe5e0('0x16'));var licenseUtil=require(_0xe5e0('0x17'));var db=require(_0xe5e0('0x18'))['db'];function respondWithStatusCode(_0x540748,_0x2bbc9b){_0x2bbc9b=_0x2bbc9b||0xcc;return function(_0x51a0d2){if(_0x51a0d2){return _0x540748['sendStatus'](_0x2bbc9b);}return _0x540748['status'](_0x2bbc9b)[_0xe5e0('0x19')]();};}function respondWithResult(_0x25a283,_0x5aafbd){_0x5aafbd=_0x5aafbd||0xc8;return function(_0x1cbff8){if(_0x1cbff8){return _0x25a283['status'](_0x5aafbd)[_0xe5e0('0x1a')](_0x1cbff8);}};}function respondWithFilteredResult(_0x4e81c9,_0x4d9f0f){return function(_0x221c64){if(_0x221c64){var _0x63349=_0x221c64[_0xe5e0('0x1b')],_0x213c31=_0x4d9f0f[_0xe5e0('0x1c')],_0x590260=_0x4d9f0f['offset']+_0x4d9f0f['limit'],_0x37d605;if(_0x590260>=_0x63349){_0x590260=_0x63349;_0x37d605=0xc8;}else{_0x37d605=0xce;}_0x4e81c9[_0xe5e0('0x1d')](_0x37d605);return _0x4e81c9[_0xe5e0('0x1e')](_0xe5e0('0x1f'),_0x213c31+'-'+_0x590260+'/'+_0x63349)['json'](_0x221c64);}return null;};}function patchUpdates(_0x36f948){return function(_0x308c5a){try{jsonpatch['apply'](_0x308c5a,_0x36f948,!![]);}catch(_0x381d81){return BPromise[_0xe5e0('0x20')](_0x381d81);}return _0x308c5a[_0xe5e0('0x21')]();};}function saveUpdates(_0x2fc935,_0x2d0e17){return function(_0x373f55){if(_0x373f55){return _0x373f55[_0xe5e0('0x22')](_0x2fc935)[_0xe5e0('0x23')](function(_0x2e5af4){return _0x2e5af4;});}return null;};}function removeEntity(_0x3c8175,_0x4ab84c){return function(_0x100b2a){if(_0x100b2a){return _0x100b2a[_0xe5e0('0x24')]()[_0xe5e0('0x23')](function(){_0x3c8175[_0xe5e0('0x1d')](0xcc)[_0xe5e0('0x19')]();});}};}function handleEntityNotFound(_0x2bac9e,_0x7c85df){return function(_0x4bf207){if(!_0x4bf207){_0x2bac9e[_0xe5e0('0x25')](0x194);}return _0x4bf207;};}function handleError(_0x488310,_0xc0ad4d){_0xc0ad4d=_0xc0ad4d||0x1f4;return function(_0x1ac878){logger[_0xe5e0('0x26')](_0x1ac878[_0xe5e0('0x27')]);if(_0x1ac878[_0xe5e0('0x28')]){delete _0x1ac878[_0xe5e0('0x28')];}_0x488310[_0xe5e0('0x1d')](_0xc0ad4d)[_0xe5e0('0x29')](_0x1ac878);};}exports['index']=function(_0x35d2bf,_0x4b60c0){var _0x1f81b6={},_0x1b580e={},_0x84c8b9={'count':0x0,'rows':[]};var _0x50a8c8=_['map'](db[_0xe5e0('0x2a')]['rawAttributes'],function(_0x6eb296){return{'name':_0x6eb296[_0xe5e0('0x2b')],'type':_0x6eb296[_0xe5e0('0x2c')][_0xe5e0('0x2d')]};});_0x1b580e['model']=_[_0xe5e0('0x2e')](_0x50a8c8,_0xe5e0('0x28'));_0x1b580e[_0xe5e0('0x2f')]=_['keys'](_0x35d2bf[_0xe5e0('0x2f')]);_0x1b580e[_0xe5e0('0x30')]=_[_0xe5e0('0x31')](_0x1b580e[_0xe5e0('0x32')],_0x1b580e[_0xe5e0('0x2f')]);_0x1f81b6[_0xe5e0('0x33')]=_[_0xe5e0('0x31')](_0x1b580e['model'],qs[_0xe5e0('0x34')](_0x35d2bf[_0xe5e0('0x2f')]['fields']));_0x1f81b6[_0xe5e0('0x33')]=_0x1f81b6[_0xe5e0('0x33')]['length']?_0x1f81b6[_0xe5e0('0x33')]:_0x1b580e['model'];if(!_0x35d2bf['query']['hasOwnProperty'](_0xe5e0('0x35'))){_0x1f81b6[_0xe5e0('0x36')]=qs[_0xe5e0('0x36')](_0x35d2bf[_0xe5e0('0x2f')]['limit']);_0x1f81b6[_0xe5e0('0x1c')]=qs[_0xe5e0('0x1c')](_0x35d2bf[_0xe5e0('0x2f')][_0xe5e0('0x1c')]);}_0x1f81b6[_0xe5e0('0x37')]=qs[_0xe5e0('0x38')](_0x35d2bf[_0xe5e0('0x2f')]['sort']);_0x1f81b6[_0xe5e0('0x39')]=qs[_0xe5e0('0x30')](_[_0xe5e0('0x3a')](_0x35d2bf[_0xe5e0('0x2f')],_0x1b580e[_0xe5e0('0x30')]),_0x50a8c8);if(_0x35d2bf[_0xe5e0('0x2f')]['filter']){_0x1f81b6[_0xe5e0('0x39')]=_[_0xe5e0('0x3b')](_0x1f81b6[_0xe5e0('0x39')],{'$or':_[_0xe5e0('0x2e')](_0x50a8c8,function(_0x55edfb){if(_0x55edfb[_0xe5e0('0x2c')]!==_0xe5e0('0x3c')){var _0x191e0f={};_0x191e0f[_0x55edfb[_0xe5e0('0x28')]]={'$like':'%'+_0x35d2bf[_0xe5e0('0x2f')]['filter']+'%'};return _0x191e0f;}})});}_0x1f81b6=_[_0xe5e0('0x3b')]({},_0x1f81b6,_0x35d2bf[_0xe5e0('0x3d')]);var _0x250d08={'where':_0x1f81b6[_0xe5e0('0x39')]};return db['FreshdeskField'][_0xe5e0('0x1b')](_0x250d08)['then'](function(_0x31f738){_0x84c8b9['count']=_0x31f738;if(_0x35d2bf['query'][_0xe5e0('0x3e')]){_0x1f81b6[_0xe5e0('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0xe5e0('0x40')](_0x1f81b6);})[_0xe5e0('0x23')](function(_0x5a9dc9){_0x84c8b9[_0xe5e0('0x41')]=_0x5a9dc9;return _0x84c8b9;})[_0xe5e0('0x23')](respondWithFilteredResult(_0x4b60c0,_0x1f81b6))[_0xe5e0('0x42')](handleError(_0x4b60c0,null));};exports['show']=function(_0x1cae2e,_0x369a80){var _0x213b6a={'raw':!![],'where':{'id':_0x1cae2e[_0xe5e0('0x43')]['id']}},_0x1be1e8={};_0x1be1e8[_0xe5e0('0x32')]=_['keys'](db[_0xe5e0('0x2a')][_0xe5e0('0x44')]);_0x1be1e8[_0xe5e0('0x2f')]=_['keys'](_0x1cae2e[_0xe5e0('0x2f')]);_0x1be1e8[_0xe5e0('0x30')]=_['intersection'](_0x1be1e8[_0xe5e0('0x32')],_0x1be1e8[_0xe5e0('0x2f')]);_0x213b6a[_0xe5e0('0x33')]=_[_0xe5e0('0x31')](_0x1be1e8[_0xe5e0('0x32')],qs[_0xe5e0('0x34')](_0x1cae2e[_0xe5e0('0x2f')][_0xe5e0('0x34')]));_0x213b6a[_0xe5e0('0x33')]=_0x213b6a[_0xe5e0('0x33')]['length']?_0x213b6a['attributes']:_0x1be1e8[_0xe5e0('0x32')];if(_0x1cae2e[_0xe5e0('0x2f')][_0xe5e0('0x3e')]){_0x213b6a['include']=[{'all':!![]}];}_0x213b6a=_[_0xe5e0('0x3b')]({},_0x213b6a,_0x1cae2e[_0xe5e0('0x3d')]);return db['FreshdeskField'][_0xe5e0('0x45')](_0x213b6a)[_0xe5e0('0x23')](handleEntityNotFound(_0x369a80,null))[_0xe5e0('0x23')](respondWithResult(_0x369a80,null))[_0xe5e0('0x42')](handleError(_0x369a80,null));};exports[_0xe5e0('0x46')]=function(_0x9f491f,_0x48b86b){return db[_0xe5e0('0x2a')]['create'](_0x9f491f[_0xe5e0('0x47')],{})[_0xe5e0('0x23')](respondWithResult(_0x48b86b,0xc9))[_0xe5e0('0x42')](handleError(_0x48b86b,null));};exports[_0xe5e0('0x22')]=function(_0x15f938,_0x5772cc){if(_0x15f938[_0xe5e0('0x47')]['id']){delete _0x15f938[_0xe5e0('0x47')]['id'];}return db[_0xe5e0('0x2a')]['find']({'where':{'id':_0x15f938['params']['id']}})['then'](handleEntityNotFound(_0x5772cc,null))[_0xe5e0('0x23')](saveUpdates(_0x15f938['body'],null))[_0xe5e0('0x23')](respondWithResult(_0x5772cc,null))['catch'](handleError(_0x5772cc,null));};exports[_0xe5e0('0x24')]=function(_0xa5fd09,_0x542d1f){return db[_0xe5e0('0x2a')][_0xe5e0('0x45')]({'where':{'id':_0xa5fd09[_0xe5e0('0x43')]['id']}})['then'](handleEntityNotFound(_0x542d1f,null))[_0xe5e0('0x23')](removeEntity(_0x542d1f,null))[_0xe5e0('0x42')](handleError(_0x542d1f,null));}; \ No newline at end of file +var _0x7b3a=['findAll','rows','catch','params','include','options','find','create','body','html-pdf','rimraf','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7b3a,0x93));var _0xa7b3=function(_0x12b874,_0x5c1c0c){_0x12b874=_0x12b874-0x0;var _0x23c7e6=_0x7b3a[_0x12b874];return _0x23c7e6;};'use strict';var pdf=require(_0xa7b3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa7b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7b3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa7b3('0x3'));var util=require(_0xa7b3('0x4'));var path=require(_0xa7b3('0x5'));var sox=require(_0xa7b3('0x6'));var csv=require('to-csv');var ejs=require(_0xa7b3('0x7'));var fs=require('fs');var _=require(_0xa7b3('0x8'));var squel=require(_0xa7b3('0x9'));var crypto=require(_0xa7b3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa7b3('0xb'));var toCsv=require(_0xa7b3('0xc'));var querystring=require(_0xa7b3('0xd'));var Papa=require(_0xa7b3('0xe'));var Redis=require('ioredis');var authService=require(_0xa7b3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7b3('0x10'));var logger=require(_0xa7b3('0x11'))(_0xa7b3('0x12'));var utils=require(_0xa7b3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa7b3('0x14'));var db=require(_0xa7b3('0x15'))['db'];function respondWithStatusCode(_0x2603cc,_0x2261aa){_0x2261aa=_0x2261aa||0xcc;return function(_0x2eb173){if(_0x2eb173){return _0x2603cc[_0xa7b3('0x16')](_0x2261aa);}return _0x2603cc['status'](_0x2261aa)[_0xa7b3('0x17')]();};}function respondWithResult(_0x3acad6,_0x32b2ef){_0x32b2ef=_0x32b2ef||0xc8;return function(_0x3572dc){if(_0x3572dc){return _0x3acad6[_0xa7b3('0x18')](_0x32b2ef)['json'](_0x3572dc);}};}function respondWithFilteredResult(_0x51a879,_0x17da04){return function(_0x4dede2){if(_0x4dede2){var _0x470c41=_0x4dede2[_0xa7b3('0x19')],_0x1e8af5=_0x17da04[_0xa7b3('0x1a')],_0x48ff16=_0x17da04[_0xa7b3('0x1a')]+_0x17da04[_0xa7b3('0x1b')],_0xd6ef97;if(_0x48ff16>=_0x470c41){_0x48ff16=_0x470c41;_0xd6ef97=0xc8;}else{_0xd6ef97=0xce;}_0x51a879[_0xa7b3('0x18')](_0xd6ef97);return _0x51a879[_0xa7b3('0x1c')](_0xa7b3('0x1d'),_0x1e8af5+'-'+_0x48ff16+'/'+_0x470c41)['json'](_0x4dede2);}return null;};}function patchUpdates(_0xbad1de){return function(_0x33874e){try{jsonpatch['apply'](_0x33874e,_0xbad1de,!![]);}catch(_0x188ccc){return BPromise['reject'](_0x188ccc);}return _0x33874e['save']();};}function saveUpdates(_0x44dba5,_0x5695aa){return function(_0x527131){if(_0x527131){return _0x527131[_0xa7b3('0x1e')](_0x44dba5)[_0xa7b3('0x1f')](function(_0x25a652){return _0x25a652;});}return null;};}function removeEntity(_0x79bed1,_0x239102){return function(_0x334b8d){if(_0x334b8d){return _0x334b8d[_0xa7b3('0x20')]()[_0xa7b3('0x1f')](function(){_0x79bed1[_0xa7b3('0x18')](0xcc)[_0xa7b3('0x17')]();});}};}function handleEntityNotFound(_0x3d0c9d,_0x29ee9d){return function(_0x1256a7){if(!_0x1256a7){_0x3d0c9d['sendStatus'](0x194);}return _0x1256a7;};}function handleError(_0x303adb,_0x4a991c){_0x4a991c=_0x4a991c||0x1f4;return function(_0x3eb719){logger[_0xa7b3('0x21')](_0x3eb719[_0xa7b3('0x22')]);if(_0x3eb719[_0xa7b3('0x23')]){delete _0x3eb719[_0xa7b3('0x23')];}_0x303adb[_0xa7b3('0x18')](_0x4a991c)[_0xa7b3('0x24')](_0x3eb719);};}exports[_0xa7b3('0x25')]=function(_0x79622d,_0x11367f){var _0x4add0b={},_0x17933f={},_0x44d558={'count':0x0,'rows':[]};var _0x1422d1=_[_0xa7b3('0x26')](db[_0xa7b3('0x27')][_0xa7b3('0x28')],function(_0x24dad3){return{'name':_0x24dad3['fieldName'],'type':_0x24dad3[_0xa7b3('0x29')]['key']};});_0x17933f[_0xa7b3('0x2a')]=_[_0xa7b3('0x26')](_0x1422d1,_0xa7b3('0x23'));_0x17933f[_0xa7b3('0x2b')]=_[_0xa7b3('0x2c')](_0x79622d[_0xa7b3('0x2b')]);_0x17933f[_0xa7b3('0x2d')]=_[_0xa7b3('0x2e')](_0x17933f['model'],_0x17933f['query']);_0x4add0b[_0xa7b3('0x2f')]=_[_0xa7b3('0x2e')](_0x17933f['model'],qs['fields'](_0x79622d[_0xa7b3('0x2b')][_0xa7b3('0x30')]));_0x4add0b[_0xa7b3('0x2f')]=_0x4add0b[_0xa7b3('0x2f')][_0xa7b3('0x31')]?_0x4add0b[_0xa7b3('0x2f')]:_0x17933f['model'];if(!_0x79622d['query'][_0xa7b3('0x32')](_0xa7b3('0x33'))){_0x4add0b[_0xa7b3('0x1b')]=qs[_0xa7b3('0x1b')](_0x79622d[_0xa7b3('0x2b')]['limit']);_0x4add0b[_0xa7b3('0x1a')]=qs[_0xa7b3('0x1a')](_0x79622d['query'][_0xa7b3('0x1a')]);}_0x4add0b[_0xa7b3('0x34')]=qs[_0xa7b3('0x35')](_0x79622d[_0xa7b3('0x2b')][_0xa7b3('0x35')]);_0x4add0b[_0xa7b3('0x36')]=qs['filters'](_[_0xa7b3('0x37')](_0x79622d[_0xa7b3('0x2b')],_0x17933f[_0xa7b3('0x2d')]),_0x1422d1);if(_0x79622d[_0xa7b3('0x2b')][_0xa7b3('0x38')]){_0x4add0b[_0xa7b3('0x36')]=_[_0xa7b3('0x39')](_0x4add0b[_0xa7b3('0x36')],{'$or':_[_0xa7b3('0x26')](_0x1422d1,function(_0x46bcf4){if(_0x46bcf4[_0xa7b3('0x29')]!==_0xa7b3('0x3a')){var _0x388578={};_0x388578[_0x46bcf4['name']]={'$like':'%'+_0x79622d['query'][_0xa7b3('0x38')]+'%'};return _0x388578;}})});}_0x4add0b=_[_0xa7b3('0x39')]({},_0x4add0b,_0x79622d['options']);var _0xeb8b98={'where':_0x4add0b[_0xa7b3('0x36')]};return db['FreshdeskField']['count'](_0xeb8b98)[_0xa7b3('0x1f')](function(_0x5820c2){_0x44d558[_0xa7b3('0x19')]=_0x5820c2;if(_0x79622d[_0xa7b3('0x2b')][_0xa7b3('0x3b')]){_0x4add0b['include']=[{'all':!![]}];}return db[_0xa7b3('0x27')][_0xa7b3('0x3c')](_0x4add0b);})[_0xa7b3('0x1f')](function(_0x4f9d95){_0x44d558[_0xa7b3('0x3d')]=_0x4f9d95;return _0x44d558;})[_0xa7b3('0x1f')](respondWithFilteredResult(_0x11367f,_0x4add0b))[_0xa7b3('0x3e')](handleError(_0x11367f,null));};exports['show']=function(_0x4c71d2,_0x176294){var _0x593d53={'raw':!![],'where':{'id':_0x4c71d2[_0xa7b3('0x3f')]['id']}},_0x265eb2={};_0x265eb2[_0xa7b3('0x2a')]=_[_0xa7b3('0x2c')](db[_0xa7b3('0x27')][_0xa7b3('0x28')]);_0x265eb2['query']=_[_0xa7b3('0x2c')](_0x4c71d2[_0xa7b3('0x2b')]);_0x265eb2[_0xa7b3('0x2d')]=_[_0xa7b3('0x2e')](_0x265eb2['model'],_0x265eb2[_0xa7b3('0x2b')]);_0x593d53[_0xa7b3('0x2f')]=_['intersection'](_0x265eb2['model'],qs[_0xa7b3('0x30')](_0x4c71d2[_0xa7b3('0x2b')]['fields']));_0x593d53[_0xa7b3('0x2f')]=_0x593d53['attributes'][_0xa7b3('0x31')]?_0x593d53[_0xa7b3('0x2f')]:_0x265eb2[_0xa7b3('0x2a')];if(_0x4c71d2['query'][_0xa7b3('0x3b')]){_0x593d53[_0xa7b3('0x40')]=[{'all':!![]}];}_0x593d53=_[_0xa7b3('0x39')]({},_0x593d53,_0x4c71d2[_0xa7b3('0x41')]);return db[_0xa7b3('0x27')][_0xa7b3('0x42')](_0x593d53)[_0xa7b3('0x1f')](handleEntityNotFound(_0x176294,null))[_0xa7b3('0x1f')](respondWithResult(_0x176294,null))[_0xa7b3('0x3e')](handleError(_0x176294,null));};exports[_0xa7b3('0x43')]=function(_0x1089f4,_0x1c3ad6){return db['FreshdeskField']['create'](_0x1089f4[_0xa7b3('0x44')],{})[_0xa7b3('0x1f')](respondWithResult(_0x1c3ad6,0xc9))[_0xa7b3('0x3e')](handleError(_0x1c3ad6,null));};exports[_0xa7b3('0x1e')]=function(_0x3435ee,_0x5d5d41){if(_0x3435ee[_0xa7b3('0x44')]['id']){delete _0x3435ee[_0xa7b3('0x44')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x3435ee['params']['id']}})[_0xa7b3('0x1f')](handleEntityNotFound(_0x5d5d41,null))['then'](saveUpdates(_0x3435ee['body'],null))[_0xa7b3('0x1f')](respondWithResult(_0x5d5d41,null))[_0xa7b3('0x3e')](handleError(_0x5d5d41,null));};exports[_0xa7b3('0x20')]=function(_0x267914,_0xaddeed){return db[_0xa7b3('0x27')][_0xa7b3('0x42')]({'where':{'id':_0x267914[_0xa7b3('0x3f')]['id']}})[_0xa7b3('0x1f')](handleEntityNotFound(_0xaddeed,null))[_0xa7b3('0x1f')](removeEntity(_0xaddeed,null))[_0xa7b3('0x3e')](handleError(_0xaddeed,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 8404ced..5961e00 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 _0x0d07=['../../config/logger','api','request-promise','path','rimraf','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x0d07,0x12b));var _0x70d0=function(_0x5881e4,_0x236cf4){_0x5881e4=_0x5881e4-0x0;var _0x19a08c=_0x0d07[_0x5881e4];return _0x19a08c;};'use strict';var _=require(_0x70d0('0x0'));var util=require('util');var logger=require(_0x70d0('0x1'))(_0x70d0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x70d0('0x3'));var fs=require('fs');var path=require(_0x70d0('0x4'));var rimraf=require(_0x70d0('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x3cb565,_0x18e286){return _0x3cb565[_0x70d0('0x6')](_0x70d0('0x7'),attributes,{'tableName':_0x70d0('0x8'),'paranoid':![],'indexes':[{'name':_0x70d0('0x9'),'fields':[_0x70d0('0xa'),_0x70d0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2b1=['../../config/environment','exports','define','FreshdeskField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x324457,_0x57c924){var _0x39f7f5=function(_0x39952e){while(--_0x39952e){_0x324457['push'](_0x324457['shift']());}};_0x39f7f5(++_0x57c924);}(_0xb2b1,0x7e));var _0x1b2b=function(_0x3dd824,_0x5281e2){_0x3dd824=_0x3dd824-0x0;var _0x3ce62f=_0xb2b1[_0x3dd824];return _0x3ce62f;};'use strict';var _=require(_0x1b2b('0x0'));var util=require(_0x1b2b('0x1'));var logger=require(_0x1b2b('0x2'))(_0x1b2b('0x3'));var moment=require(_0x1b2b('0x4'));var BPromise=require(_0x1b2b('0x5'));var rp=require(_0x1b2b('0x6'));var fs=require('fs');var path=require(_0x1b2b('0x7'));var rimraf=require(_0x1b2b('0x8'));var config=require(_0x1b2b('0x9'));var attributes=require('./intFreshdeskField.attributes');module[_0x1b2b('0xa')]=function(_0x5e4de0,_0x262087){return _0x5e4de0[_0x1b2b('0xb')](_0x1b2b('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x1b2b('0xd'),_0x1b2b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 522a8a0..7c4426d 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1c68d0,_0x29d47c){var _0x2e06dd=function(_0x4e2b2c){while(--_0x4e2b2c){_0x1c68d0['push'](_0x1c68d0['shift']());}};_0x2e06dd(++_0x29d47c);}(_0xb10b,0x12a));var _0xbb10=function(_0xdcca54,_0x4b2b61){_0xdcca54=_0xdcca54-0x0;var _0x453197=_0xb10b[_0xdcca54];return _0x453197;};'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);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x2a4ff1,_0x370a52){_0x2a4ff1=_0x2a4ff1-0x0;var _0xd94c7f=_0x7a54[_0x2a4ff1];return _0xd94c7f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 38699c2..ce339d1 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 _0x39c8=['destroy','exports','multer','path','connect-timeout','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','update'];(function(_0x1539cf,_0x4c1e98){var _0x20368f=function(_0x365c7a){while(--_0x365c7a){_0x1539cf['push'](_0x1539cf['shift']());}};_0x20368f(++_0x4c1e98);}(_0x39c8,0x1cd));var _0x839c=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x39c8[_0x5af97c];return _0x3472ae;};'use strict';var multer=require(_0x839c('0x0'));var util=require('util');var path=require(_0x839c('0x1'));var timeout=require(_0x839c('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x839c('0x3'));router[_0x839c('0x4')]('/',auth[_0x839c('0x5')](),controller[_0x839c('0x6')]);router['get'](_0x839c('0x7'),auth[_0x839c('0x5')](),controller['show']);router[_0x839c('0x4')](_0x839c('0x8'),auth['isAuthenticated'](),controller[_0x839c('0x9')]);router[_0x839c('0x4')](_0x839c('0xa'),auth[_0x839c('0x5')](),controller[_0x839c('0xb')]);router['post']('/',auth[_0x839c('0x5')](),controller[_0x839c('0xc')]);router[_0x839c('0xd')](_0x839c('0x8'),auth[_0x839c('0x5')](),controller['addConfiguration']);router['put'](_0x839c('0x7'),auth[_0x839c('0x5')](),controller[_0x839c('0xe')]);router['delete']('/:id',auth[_0x839c('0x5')](),controller[_0x839c('0xf')]);module[_0x839c('0x10')]=router; \ No newline at end of file +var _0xf092=['multer','path','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','destroy','exports'];(function(_0x364479,_0x940001){var _0x2b7177=function(_0x26cc45){while(--_0x26cc45){_0x364479['push'](_0x364479['shift']());}};_0x2b7177(++_0x940001);}(_0xf092,0x11e));var _0x2f09=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0xf092[_0x528497];return _0x392d59;};'use strict';var multer=require(_0x2f09('0x0'));var util=require('util');var path=require(_0x2f09('0x1'));var timeout=require(_0x2f09('0x2'));var express=require(_0x2f09('0x3'));var router=express[_0x2f09('0x4')]();var auth=require(_0x2f09('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f09('0x6'));router[_0x2f09('0x7')]('/',auth[_0x2f09('0x8')](),controller[_0x2f09('0x9')]);router['get'](_0x2f09('0xa'),auth[_0x2f09('0x8')](),controller[_0x2f09('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2f09('0x7')](_0x2f09('0xc'),auth[_0x2f09('0x8')](),controller[_0x2f09('0xd')]);router[_0x2f09('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f09('0xf')]);router[_0x2f09('0xe')](_0x2f09('0x10'),auth[_0x2f09('0x8')](),controller[_0x2f09('0x11')]);router[_0x2f09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f09('0x13')]);router['delete'](_0x2f09('0xa'),auth['isAuthenticated'](),controller[_0x2f09('0x14')]);module[_0x2f09('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 c888bf9..3e5dc88 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 _0xee02=['sequelize','STRING','username','remoteUri'];(function(_0x3a74c2,_0x282fb9){var _0x19d99c=function(_0x1cc89e){while(--_0x1cc89e){_0x3a74c2['push'](_0x3a74c2['shift']());}};_0x19d99c(++_0x282fb9);}(_0xee02,0x74));var _0x2ee0=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xee02[_0x487496];return _0x539dc8;};'use strict';var Sequelize=require(_0x2ee0('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ee0('0x1')]},'description':{'type':Sequelize[_0x2ee0('0x1')]},'username':{'type':Sequelize[_0x2ee0('0x1')],'unique':_0x2ee0('0x2')},'apiKey':{'type':Sequelize[_0x2ee0('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2ee0('0x3')},'serverUrl':{'type':Sequelize[_0x2ee0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8472=['STRING','username','sequelize'];(function(_0x340022,_0x1955f6){var _0x18b0c2=function(_0x364393){while(--_0x364393){_0x340022['push'](_0x340022['shift']());}};_0x18b0c2(++_0x1955f6);}(_0x8472,0x9b));var _0x2847=function(_0x16231b,_0x59e2f1){_0x16231b=_0x16231b-0x0;var _0x36ca06=_0x8472[_0x16231b];return _0x36ca06;};'use strict';var Sequelize=require(_0x2847('0x0'));module['exports']={'name':{'type':Sequelize[_0x2847('0x1')]},'description':{'type':Sequelize[_0x2847('0x1')]},'username':{'type':Sequelize[_0x2847('0x1')],'unique':_0x2847('0x2')},'apiKey':{'type':Sequelize[_0x2847('0x1')]},'remoteUri':{'type':Sequelize[_0x2847('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2847('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e429b92..2106497 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 _0x222f=['offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','FreshsalesAccount','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','find','create','body','FreshsalesConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','username','remoteUri','apiKey','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','count'];(function(_0x492f6d,_0x225b3d){var _0x3f93cf=function(_0x164f88){while(--_0x164f88){_0x492f6d['push'](_0x492f6d['shift']());}};_0x3f93cf(++_0x225b3d);}(_0x222f,0x1a4));var _0xf222=function(_0xf24f30,_0x77205b){_0xf24f30=_0xf24f30-0x0;var _0x364bea=_0x222f[_0xf24f30];return _0x364bea;};'use strict';var pdf=require(_0xf222('0x0'));var emlformat=require(_0xf222('0x1'));var rimraf=require(_0xf222('0x2'));var zipdir=require(_0xf222('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf222('0x4'));var BPromise=require(_0xf222('0x5'));var Mustache=require(_0xf222('0x6'));var util=require(_0xf222('0x7'));var path=require('path');var sox=require(_0xf222('0x8'));var csv=require('to-csv');var ejs=require(_0xf222('0x9'));var fs=require('fs');var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0xd'));var querystring=require(_0xf222('0xe'));var Papa=require(_0xf222('0xf'));var Redis=require(_0xf222('0x10'));var authService=require(_0xf222('0x11'));var qs=require(_0xf222('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x13'));var logger=require(_0xf222('0x14'))(_0xf222('0x15'));var utils=require(_0xf222('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x17'));var db=require(_0xf222('0x18'))['db'];var integrations=require(_0xf222('0x19'));var jayson=require(_0xf222('0x1a'));var client=jayson[_0xf222('0x1b')][_0xf222('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11fca0,_0x17df25,_0x52a003,_0x5b8f97){return new BPromise(function(_0x1feb86,_0x2d597f){var _0x4c2314=_0x5b8f97||client;return _0x4c2314[_0xf222('0x1d')](_0x11fca0,_0x52a003)[_0xf222('0x1e')](function(_0x464f3e){logger[_0xf222('0x1f')](_0xf222('0x20'),_0x17df25,_0xf222('0x21'));logger[_0xf222('0x22')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x17df25,_0xf222('0x21'),JSON[_0xf222('0x23')](_0x464f3e));if(_0x464f3e[_0xf222('0x24')]){if(_0x464f3e[_0xf222('0x24')][_0xf222('0x25')]===0x1f4){logger[_0xf222('0x24')](_0xf222('0x20'),_0x17df25,_0x464f3e['error'][_0xf222('0x26')]);return _0x2d597f(_0x464f3e[_0xf222('0x24')][_0xf222('0x26')]);}logger[_0xf222('0x24')]('FreshsalesAccount,\x20%s,\x20%s',_0x17df25,_0x464f3e['error'][_0xf222('0x26')]);return _0x1feb86(_0x464f3e[_0xf222('0x24')][_0xf222('0x26')]);}else{logger[_0xf222('0x1f')](_0xf222('0x20'),_0x17df25,_0xf222('0x21'));_0x1feb86(_0x464f3e['result'][_0xf222('0x26')]);}})[_0xf222('0x27')](function(_0x4d3bf4){logger[_0xf222('0x24')](_0xf222('0x20'),_0x17df25,_0x4d3bf4);_0x2d597f(_0x4d3bf4);});});}function respondWithStatusCode(_0x2d18ab,_0x4616de){_0x4616de=_0x4616de||0xcc;return function(_0x144775){if(_0x144775){return _0x2d18ab['sendStatus'](_0x4616de);}return _0x2d18ab[_0xf222('0x28')](_0x4616de)[_0xf222('0x29')]();};}function respondWithResult(_0x1883c1,_0x3fce26){_0x3fce26=_0x3fce26||0xc8;return function(_0x4305e0){if(_0x4305e0){return _0x1883c1[_0xf222('0x28')](_0x3fce26)[_0xf222('0x2a')](_0x4305e0);}};}function respondWithFilteredResult(_0x263dc2,_0x15bf4e){return function(_0x2ec2e9){if(_0x2ec2e9){var _0x2a8310=_0x2ec2e9[_0xf222('0x2b')],_0x501f8e=_0x15bf4e[_0xf222('0x2c')],_0x14b2b1=_0x15bf4e[_0xf222('0x2c')]+_0x15bf4e[_0xf222('0x2d')],_0x1c5cd3;if(_0x14b2b1>=_0x2a8310){_0x14b2b1=_0x2a8310;_0x1c5cd3=0xc8;}else{_0x1c5cd3=0xce;}_0x263dc2[_0xf222('0x28')](_0x1c5cd3);return _0x263dc2[_0xf222('0x2e')](_0xf222('0x2f'),_0x501f8e+'-'+_0x14b2b1+'/'+_0x2a8310)['json'](_0x2ec2e9);}return null;};}function patchUpdates(_0x3bdf98){return function(_0x132b18){try{jsonpatch[_0xf222('0x30')](_0x132b18,_0x3bdf98,!![]);}catch(_0x53a382){return BPromise[_0xf222('0x31')](_0x53a382);}return _0x132b18['save']();};}function saveUpdates(_0x40c7e7,_0x27a8cc){return function(_0x434e7b){if(_0x434e7b){return _0x434e7b[_0xf222('0x32')](_0x40c7e7)[_0xf222('0x1e')](function(_0x152d79){return _0x152d79;});}return null;};}function removeEntity(_0x88b8f8,_0x5075ad){return function(_0x58ba55){if(_0x58ba55){return _0x58ba55[_0xf222('0x33')]()[_0xf222('0x1e')](function(){_0x88b8f8[_0xf222('0x28')](0xcc)[_0xf222('0x29')]();});}};}function handleEntityNotFound(_0x636fd0,_0x3cdd52){return function(_0x4e6a5e){if(!_0x4e6a5e){_0x636fd0[_0xf222('0x34')](0x194);}return _0x4e6a5e;};}function handleError(_0x312c65,_0x13324a){_0x13324a=_0x13324a||0x1f4;return function(_0x57c862){logger[_0xf222('0x24')](_0x57c862[_0xf222('0x35')]);if(_0x57c862[_0xf222('0x36')]){delete _0x57c862['name'];}_0x312c65[_0xf222('0x28')](_0x13324a)[_0xf222('0x37')](_0x57c862);};}exports[_0xf222('0x38')]=function(_0x516010,_0x3acea1){var _0x23ed1d={},_0x1345eb={},_0x2b838c={'count':0x0,'rows':[]};var _0x2e9b27=_['map'](db[_0xf222('0x39')]['rawAttributes'],function(_0x220214){return{'name':_0x220214[_0xf222('0x3a')],'type':_0x220214[_0xf222('0x3b')]['key']};});_0x1345eb[_0xf222('0x3c')]=_[_0xf222('0x3d')](_0x2e9b27,'name');_0x1345eb[_0xf222('0x3e')]=_['keys'](_0x516010[_0xf222('0x3e')]);_0x1345eb[_0xf222('0x3f')]=_[_0xf222('0x40')](_0x1345eb['model'],_0x1345eb[_0xf222('0x3e')]);_0x23ed1d[_0xf222('0x41')]=_[_0xf222('0x40')](_0x1345eb[_0xf222('0x3c')],qs[_0xf222('0x42')](_0x516010[_0xf222('0x3e')]['fields']));_0x23ed1d[_0xf222('0x41')]=_0x23ed1d[_0xf222('0x41')]['length']?_0x23ed1d['attributes']:_0x1345eb[_0xf222('0x3c')];if(!_0x516010['query'][_0xf222('0x43')](_0xf222('0x44'))){_0x23ed1d[_0xf222('0x2d')]=qs[_0xf222('0x2d')](_0x516010['query']['limit']);_0x23ed1d[_0xf222('0x2c')]=qs['offset'](_0x516010['query'][_0xf222('0x2c')]);}_0x23ed1d[_0xf222('0x45')]=qs[_0xf222('0x46')](_0x516010[_0xf222('0x3e')][_0xf222('0x46')]);_0x23ed1d[_0xf222('0x47')]=qs['filters'](_[_0xf222('0x48')](_0x516010[_0xf222('0x3e')],_0x1345eb['filters']),_0x2e9b27);if(_0x516010[_0xf222('0x3e')][_0xf222('0x49')]){_0x23ed1d['where']=_[_0xf222('0x4a')](_0x23ed1d['where'],{'$or':_[_0xf222('0x3d')](_0x2e9b27,function(_0x4169a0){if(_0x4169a0[_0xf222('0x3b')]!==_0xf222('0x4b')){var _0x3a3185={};_0x3a3185[_0x4169a0[_0xf222('0x36')]]={'$like':'%'+_0x516010[_0xf222('0x3e')][_0xf222('0x49')]+'%'};return _0x3a3185;}})});}_0x23ed1d=_[_0xf222('0x4a')]({},_0x23ed1d,_0x516010[_0xf222('0x4c')]);var _0x443560={'where':_0x23ed1d['where']};return db['FreshsalesAccount']['count'](_0x443560)[_0xf222('0x1e')](function(_0x2c3584){_0x2b838c[_0xf222('0x2b')]=_0x2c3584;if(_0x516010[_0xf222('0x3e')]['includeAll']){_0x23ed1d[_0xf222('0x4d')]=[{'all':!![]}];}return db[_0xf222('0x39')][_0xf222('0x4e')](_0x23ed1d);})[_0xf222('0x1e')](function(_0x59974f){_0x2b838c[_0xf222('0x4f')]=_0x59974f;return _0x2b838c;})[_0xf222('0x1e')](respondWithFilteredResult(_0x3acea1,_0x23ed1d))[_0xf222('0x27')](handleError(_0x3acea1,null));};exports[_0xf222('0x50')]=function(_0x1d60e5,_0x14710f){var _0x8fc65e={'raw':![],'where':{'id':_0x1d60e5[_0xf222('0x51')]['id']}},_0x7a8ea9={};_0x7a8ea9[_0xf222('0x3c')]=_['keys'](db['FreshsalesAccount'][_0xf222('0x52')]);_0x7a8ea9['query']=_[_0xf222('0x53')](_0x1d60e5['query']);_0x7a8ea9[_0xf222('0x3f')]=_['intersection'](_0x7a8ea9[_0xf222('0x3c')],_0x7a8ea9[_0xf222('0x3e')]);_0x8fc65e[_0xf222('0x41')]=_[_0xf222('0x40')](_0x7a8ea9['model'],qs[_0xf222('0x42')](_0x1d60e5[_0xf222('0x3e')][_0xf222('0x42')]));_0x8fc65e[_0xf222('0x41')]=_0x8fc65e[_0xf222('0x41')][_0xf222('0x54')]?_0x8fc65e[_0xf222('0x41')]:_0x7a8ea9[_0xf222('0x3c')];if(_0x1d60e5[_0xf222('0x3e')][_0xf222('0x55')]){_0x8fc65e[_0xf222('0x4d')]=[{'all':!![]}];}_0x8fc65e=_[_0xf222('0x4a')]({},_0x8fc65e,_0x1d60e5['options']);return db['FreshsalesAccount'][_0xf222('0x56')](_0x8fc65e)[_0xf222('0x1e')](handleEntityNotFound(_0x14710f,null))[_0xf222('0x1e')](respondWithResult(_0x14710f,null))[_0xf222('0x27')](handleError(_0x14710f,null));};exports[_0xf222('0x57')]=function(_0x1be64c,_0x284495){return db[_0xf222('0x39')][_0xf222('0x57')](_0x1be64c[_0xf222('0x58')],{})[_0xf222('0x1e')](respondWithResult(_0x284495,0xc9))['catch'](handleError(_0x284495,null));};exports['update']=function(_0x138f7a,_0x3cd479){if(_0x138f7a[_0xf222('0x58')]['id']){delete _0x138f7a[_0xf222('0x58')]['id'];}return db[_0xf222('0x39')][_0xf222('0x56')]({'where':{'id':_0x138f7a[_0xf222('0x51')]['id']}})[_0xf222('0x1e')](handleEntityNotFound(_0x3cd479,null))[_0xf222('0x1e')](saveUpdates(_0x138f7a[_0xf222('0x58')],null))[_0xf222('0x1e')](respondWithResult(_0x3cd479,null))[_0xf222('0x27')](handleError(_0x3cd479,null));};exports[_0xf222('0x33')]=function(_0x46d421,_0x564f7f){return db[_0xf222('0x39')]['find']({'where':{'id':_0x46d421[_0xf222('0x51')]['id']}})[_0xf222('0x1e')](handleEntityNotFound(_0x564f7f,null))[_0xf222('0x1e')](removeEntity(_0x564f7f,null))[_0xf222('0x27')](handleError(_0x564f7f,null));};exports['getConfigurations']=function(_0x51443f,_0x42732e,_0x2fc98a){var _0x29eaa9={};var _0xd092fc={};var _0x356746;var _0x5ccf4d;return db[_0xf222('0x39')]['findOne']({'where':{'id':_0x51443f[_0xf222('0x51')]['id']}})[_0xf222('0x1e')](handleEntityNotFound(_0x42732e,null))['then'](function(_0x1eb3da){if(_0x1eb3da){_0x356746=_0x1eb3da;_0xd092fc['model']=_[_0xf222('0x53')](db[_0xf222('0x59')][_0xf222('0x52')]);_0xd092fc['query']=_[_0xf222('0x53')](_0x51443f[_0xf222('0x3e')]);_0xd092fc[_0xf222('0x3f')]=_[_0xf222('0x40')](_0xd092fc[_0xf222('0x3c')],_0xd092fc[_0xf222('0x3e')]);_0x29eaa9[_0xf222('0x41')]=_['intersection'](_0xd092fc[_0xf222('0x3c')],qs[_0xf222('0x42')](_0x51443f['query']['fields']));_0x29eaa9['attributes']=_0x29eaa9[_0xf222('0x41')][_0xf222('0x54')]?_0x29eaa9[_0xf222('0x41')]:_0xd092fc[_0xf222('0x3c')];_0x29eaa9['order']=qs[_0xf222('0x46')](_0x51443f['query'][_0xf222('0x46')]);_0x29eaa9[_0xf222('0x47')]=qs[_0xf222('0x3f')](_[_0xf222('0x48')](_0x51443f[_0xf222('0x3e')],_0xd092fc[_0xf222('0x3f')]));if(_0x51443f[_0xf222('0x3e')][_0xf222('0x49')]){_0x29eaa9[_0xf222('0x47')]=_['merge'](_0x29eaa9['where'],{'$or':_[_0xf222('0x3d')](_0x29eaa9['attributes'],function(_0x105768){var _0x3f9695={};_0x3f9695[_0x105768]={'$like':'%'+_0x51443f[_0xf222('0x3e')]['filter']+'%'};return _0x3f9695;})});}_0x29eaa9=_[_0xf222('0x4a')]({},_0x29eaa9,_0x51443f['options']);return _0x356746[_0xf222('0x5a')](_0x29eaa9);}})[_0xf222('0x1e')](function(_0x2be2c9){if(_0x2be2c9){_0x5ccf4d=_0x2be2c9[_0xf222('0x54')];if(!_0x51443f['query'][_0xf222('0x43')](_0xf222('0x44'))){_0x29eaa9[_0xf222('0x2d')]=qs[_0xf222('0x2d')](_0x51443f[_0xf222('0x3e')][_0xf222('0x2d')]);_0x29eaa9[_0xf222('0x2c')]=qs[_0xf222('0x2c')](_0x51443f[_0xf222('0x3e')][_0xf222('0x2c')]);}return _0x356746['getConfigurations'](_0x29eaa9);}})[_0xf222('0x1e')](function(_0xafa840){if(_0xafa840){return _0xafa840?{'count':_0x5ccf4d,'rows':_0xafa840}:null;}})[_0xf222('0x1e')](respondWithResult(_0x42732e,null))[_0xf222('0x27')](handleError(_0x42732e,null));};exports[_0xf222('0x5b')]=function(_0x242317,_0x564fea,_0x1ae19d){if(_0x242317['body']['id']){delete _0x242317[_0xf222('0x58')]['id'];}return db[_0xf222('0x39')][_0xf222('0x5c')]({'where':{'id':_0x242317[_0xf222('0x51')]['id']}})[_0xf222('0x1e')](handleEntityNotFound(_0x564fea,null))['then'](function(_0x9d1030){if(_0x9d1030){_0x242317[_0xf222('0x58')][_0xf222('0x5d')]=_0x9d1030['id'];_0x242317[_0xf222('0x58')][_0xf222('0x5e')]=integrations[_0xf222('0x5f')](_0x242317[_0xf222('0x58')]['channel'],_0x242317[_0xf222('0x58')][_0xf222('0x3b')]);_0x242317[_0xf222('0x58')][_0xf222('0x60')]=integrations[_0xf222('0x61')](_0x242317['body'][_0xf222('0x62')],_0x242317[_0xf222('0x58')]['type']);return db[_0xf222('0x59')][_0xf222('0x57')](_0x242317['body'],{'include':[{'model':db[_0xf222('0x63')],'as':_0xf222('0x5e')},{'model':db['FreshsalesField'],'as':_0xf222('0x60')}]});}return null;})['then'](respondWithResult(_0x564fea,null))[_0xf222('0x27')](handleError(_0x564fea,null));};exports['getFields']=function(_0x3905dc,_0x4aca65,_0x58c643){var _0x3177b5='';var _0x33f968='';return db[_0xf222('0x39')][_0xf222('0x5c')]({'where':{'id':_0x3905dc[_0xf222('0x51')]['id']},'attributes':['id',_0xf222('0x64'),_0xf222('0x65'),_0xf222('0x66')]})[_0xf222('0x1e')](handleEntityNotFound(_0x4aca65,null))[_0xf222('0x1e')](function(_0x115089){if(_0x115089){_0x33f968=_0x115089[_0xf222('0x64')];_0x3177b5=_0x115089[_0xf222('0x65')];var _0x4cc440=_0x115089['remoteUri']['slice'](-0x1);if(_0x4cc440==='/'){_0x3177b5=_0x3177b5[_0xf222('0x67')](0x0,_0x3177b5[_0xf222('0x68')](_0x4cc440));}return rp({'method':'GET','uri':util[_0xf222('0x69')](_0xf222('0x6a'),_0x3177b5,_0xf222('0x6b')),'headers':{'Authorization':_0xf222('0x6c')+_0x115089['apiKey']},'json':!![]});}})[_0xf222('0x1e')](function(_0x1dadc5){if(_0x1dadc5){var _0x298420=_0x1dadc5[_0xf222('0x6d')];var _0x425ae6=![];var _0x7a1d35=null;for(_0x7a1d35=0x0;_0x7a1d35<_0x298420[_0xf222('0x54')];_0x7a1d35++){if(_0x298420[_0x7a1d35][_0xf222('0x6e')]===_0x33f968){_0x425ae6=!![];}}if(_0x425ae6){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xf222('0x1e')](respondWithResult(_0x4aca65,null))[_0xf222('0x27')](function(_0x2237a8){var _0x27fc28=_0x3905dc[_0xf222('0x3e')][_0xf222('0x6f')]?0x1f4:_0x2237a8[_0xf222('0x70')]||0x1f4;logger[_0xf222('0x24')](_0xf222('0x71'),_0xf222('0x72'),_0x27fc28,JSON[_0xf222('0x23')](_0x2237a8));delete _0x2237a8[_0xf222('0x36')];if(_0x27fc28===0x191){_0x27fc28=0x190;}_0x4aca65[_0xf222('0x28')](_0x27fc28)[_0xf222('0x37')](_0x3905dc[_0xf222('0x3e')][_0xf222('0x6f')]?{'message':_0xf222('0x73'),'statusCode':_0x2237a8[_0xf222('0x70')]}:_0x2237a8);});}; \ No newline at end of file +var _0x4483=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','save','update','destroy','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','FreshsalesConfiguration','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x4483,0x1a3));var _0x3448=function(_0x1ac843,_0x3f39d8){_0x1ac843=_0x1ac843-0x0;var _0x2afca0=_0x4483[_0x1ac843];return _0x2afca0;};'use strict';var pdf=require(_0x3448('0x0'));var emlformat=require(_0x3448('0x1'));var rimraf=require(_0x3448('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3448('0x3'));var rp=require(_0x3448('0x4'));var moment=require(_0x3448('0x5'));var BPromise=require(_0x3448('0x6'));var Mustache=require(_0x3448('0x7'));var util=require('util');var path=require(_0x3448('0x8'));var sox=require(_0x3448('0x9'));var csv=require(_0x3448('0xa'));var ejs=require(_0x3448('0xb'));var fs=require('fs');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'];var integrations=require(_0x3448('0x1b'));var jayson=require(_0x3448('0x1c'));var client=jayson['client'][_0x3448('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xdfb89d,_0x587db9,_0x549306,_0x14104c){return new BPromise(function(_0x2952a6,_0x4daf3e){var _0x2387a3=_0x14104c||client;return _0x2387a3[_0x3448('0x1e')](_0xdfb89d,_0x549306)[_0x3448('0x1f')](function(_0x4fc70f){logger[_0x3448('0x20')](_0x3448('0x21'),_0x587db9,_0x3448('0x22'));logger[_0x3448('0x23')](_0x3448('0x24'),_0x587db9,_0x3448('0x22'),JSON[_0x3448('0x25')](_0x4fc70f));if(_0x4fc70f[_0x3448('0x26')]){if(_0x4fc70f['error'][_0x3448('0x27')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x587db9,_0x4fc70f['error'][_0x3448('0x28')]);return _0x4daf3e(_0x4fc70f[_0x3448('0x26')][_0x3448('0x28')]);}logger['error'](_0x3448('0x21'),_0x587db9,_0x4fc70f[_0x3448('0x26')][_0x3448('0x28')]);return _0x2952a6(_0x4fc70f[_0x3448('0x26')][_0x3448('0x28')]);}else{logger[_0x3448('0x20')]('FreshsalesAccount,\x20%s,\x20%s',_0x587db9,'request\x20sent');_0x2952a6(_0x4fc70f['result'][_0x3448('0x28')]);}})[_0x3448('0x29')](function(_0x4b3d74){logger['error'](_0x3448('0x21'),_0x587db9,_0x4b3d74);_0x4daf3e(_0x4b3d74);});});}function respondWithStatusCode(_0x4371d6,_0x22ad5c){_0x22ad5c=_0x22ad5c||0xcc;return function(_0x4368c7){if(_0x4368c7){return _0x4371d6[_0x3448('0x2a')](_0x22ad5c);}return _0x4371d6['status'](_0x22ad5c)[_0x3448('0x2b')]();};}function respondWithResult(_0x1b5c49,_0x114244){_0x114244=_0x114244||0xc8;return function(_0x2088de){if(_0x2088de){return _0x1b5c49[_0x3448('0x2c')](_0x114244)['json'](_0x2088de);}};}function respondWithFilteredResult(_0x329947,_0x393081){return function(_0x52c163){if(_0x52c163){var _0x19a479=_0x52c163[_0x3448('0x2d')],_0x12c22d=_0x393081[_0x3448('0x2e')],_0x310912=_0x393081[_0x3448('0x2e')]+_0x393081[_0x3448('0x2f')],_0x1bd34c;if(_0x310912>=_0x19a479){_0x310912=_0x19a479;_0x1bd34c=0xc8;}else{_0x1bd34c=0xce;}_0x329947['status'](_0x1bd34c);return _0x329947[_0x3448('0x30')](_0x3448('0x31'),_0x12c22d+'-'+_0x310912+'/'+_0x19a479)[_0x3448('0x32')](_0x52c163);}return null;};}function patchUpdates(_0x52c09d){return function(_0x1b8dbb){try{jsonpatch['apply'](_0x1b8dbb,_0x52c09d,!![]);}catch(_0x486f2c){return BPromise['reject'](_0x486f2c);}return _0x1b8dbb[_0x3448('0x33')]();};}function saveUpdates(_0xff6513,_0x5e96f0){return function(_0x49ad42){if(_0x49ad42){return _0x49ad42[_0x3448('0x34')](_0xff6513)[_0x3448('0x1f')](function(_0x32121c){return _0x32121c;});}return null;};}function removeEntity(_0x1e99ff,_0x4f4f32){return function(_0x2df6fc){if(_0x2df6fc){return _0x2df6fc[_0x3448('0x35')]()[_0x3448('0x1f')](function(){_0x1e99ff['status'](0xcc)[_0x3448('0x2b')]();});}};}function handleEntityNotFound(_0x2b4474,_0x5e7e77){return function(_0x4d5dc8){if(!_0x4d5dc8){_0x2b4474[_0x3448('0x2a')](0x194);}return _0x4d5dc8;};}function handleError(_0x26b250,_0x3c7eb1){_0x3c7eb1=_0x3c7eb1||0x1f4;return function(_0x37a0ee){logger['error'](_0x37a0ee[_0x3448('0x36')]);if(_0x37a0ee[_0x3448('0x37')]){delete _0x37a0ee[_0x3448('0x37')];}_0x26b250[_0x3448('0x2c')](_0x3c7eb1)['send'](_0x37a0ee);};}exports[_0x3448('0x38')]=function(_0x311d63,_0x5ea47c){var _0x167266={},_0x25d3df={},_0x89d6ae={'count':0x0,'rows':[]};var _0x25e629=_[_0x3448('0x39')](db[_0x3448('0x3a')][_0x3448('0x3b')],function(_0xd91216){return{'name':_0xd91216[_0x3448('0x3c')],'type':_0xd91216['type']['key']};});_0x25d3df[_0x3448('0x3d')]=_['map'](_0x25e629,_0x3448('0x37'));_0x25d3df[_0x3448('0x3e')]=_[_0x3448('0x3f')](_0x311d63[_0x3448('0x3e')]);_0x25d3df['filters']=_[_0x3448('0x40')](_0x25d3df[_0x3448('0x3d')],_0x25d3df[_0x3448('0x3e')]);_0x167266[_0x3448('0x41')]=_[_0x3448('0x40')](_0x25d3df[_0x3448('0x3d')],qs[_0x3448('0x42')](_0x311d63[_0x3448('0x3e')][_0x3448('0x42')]));_0x167266['attributes']=_0x167266[_0x3448('0x41')][_0x3448('0x43')]?_0x167266[_0x3448('0x41')]:_0x25d3df[_0x3448('0x3d')];if(!_0x311d63[_0x3448('0x3e')]['hasOwnProperty'](_0x3448('0x44'))){_0x167266[_0x3448('0x2f')]=qs[_0x3448('0x2f')](_0x311d63[_0x3448('0x3e')][_0x3448('0x2f')]);_0x167266[_0x3448('0x2e')]=qs[_0x3448('0x2e')](_0x311d63[_0x3448('0x3e')]['offset']);}_0x167266[_0x3448('0x45')]=qs[_0x3448('0x46')](_0x311d63[_0x3448('0x3e')]['sort']);_0x167266[_0x3448('0x47')]=qs[_0x3448('0x48')](_[_0x3448('0x49')](_0x311d63[_0x3448('0x3e')],_0x25d3df[_0x3448('0x48')]),_0x25e629);if(_0x311d63[_0x3448('0x3e')][_0x3448('0x4a')]){_0x167266['where']=_[_0x3448('0x4b')](_0x167266[_0x3448('0x47')],{'$or':_[_0x3448('0x39')](_0x25e629,function(_0x81d512){if(_0x81d512[_0x3448('0x4c')]!==_0x3448('0x4d')){var _0x51c81a={};_0x51c81a[_0x81d512[_0x3448('0x37')]]={'$like':'%'+_0x311d63['query']['filter']+'%'};return _0x51c81a;}})});}_0x167266=_[_0x3448('0x4b')]({},_0x167266,_0x311d63[_0x3448('0x4e')]);var _0x5dd83a={'where':_0x167266[_0x3448('0x47')]};return db[_0x3448('0x3a')]['count'](_0x5dd83a)[_0x3448('0x1f')](function(_0x1372a1){_0x89d6ae['count']=_0x1372a1;if(_0x311d63[_0x3448('0x3e')][_0x3448('0x4f')]){_0x167266[_0x3448('0x50')]=[{'all':!![]}];}return db[_0x3448('0x3a')][_0x3448('0x51')](_0x167266);})[_0x3448('0x1f')](function(_0x2cb2af){_0x89d6ae['rows']=_0x2cb2af;return _0x89d6ae;})['then'](respondWithFilteredResult(_0x5ea47c,_0x167266))[_0x3448('0x29')](handleError(_0x5ea47c,null));};exports[_0x3448('0x52')]=function(_0x1b82e7,_0x3f48e3){var _0x527259={'raw':![],'where':{'id':_0x1b82e7[_0x3448('0x53')]['id']}},_0x23227f={};_0x23227f[_0x3448('0x3d')]=_[_0x3448('0x3f')](db[_0x3448('0x3a')]['rawAttributes']);_0x23227f[_0x3448('0x3e')]=_['keys'](_0x1b82e7[_0x3448('0x3e')]);_0x23227f[_0x3448('0x48')]=_['intersection'](_0x23227f[_0x3448('0x3d')],_0x23227f[_0x3448('0x3e')]);_0x527259[_0x3448('0x41')]=_[_0x3448('0x40')](_0x23227f[_0x3448('0x3d')],qs[_0x3448('0x42')](_0x1b82e7[_0x3448('0x3e')]['fields']));_0x527259[_0x3448('0x41')]=_0x527259[_0x3448('0x41')]['length']?_0x527259['attributes']:_0x23227f[_0x3448('0x3d')];if(_0x1b82e7[_0x3448('0x3e')]['includeAll']){_0x527259['include']=[{'all':!![]}];}_0x527259=_[_0x3448('0x4b')]({},_0x527259,_0x1b82e7[_0x3448('0x4e')]);return db[_0x3448('0x3a')][_0x3448('0x54')](_0x527259)[_0x3448('0x1f')](handleEntityNotFound(_0x3f48e3,null))[_0x3448('0x1f')](respondWithResult(_0x3f48e3,null))[_0x3448('0x29')](handleError(_0x3f48e3,null));};exports['create']=function(_0x5ee303,_0x530dcb){return db[_0x3448('0x3a')][_0x3448('0x55')](_0x5ee303['body'],{})[_0x3448('0x1f')](respondWithResult(_0x530dcb,0xc9))[_0x3448('0x29')](handleError(_0x530dcb,null));};exports['update']=function(_0x3beb2c,_0x93669){if(_0x3beb2c['body']['id']){delete _0x3beb2c[_0x3448('0x56')]['id'];}return db[_0x3448('0x3a')][_0x3448('0x54')]({'where':{'id':_0x3beb2c[_0x3448('0x53')]['id']}})[_0x3448('0x1f')](handleEntityNotFound(_0x93669,null))[_0x3448('0x1f')](saveUpdates(_0x3beb2c[_0x3448('0x56')],null))[_0x3448('0x1f')](respondWithResult(_0x93669,null))[_0x3448('0x29')](handleError(_0x93669,null));};exports['destroy']=function(_0x594d83,_0x5f358e){return db[_0x3448('0x3a')][_0x3448('0x54')]({'where':{'id':_0x594d83[_0x3448('0x53')]['id']}})[_0x3448('0x1f')](handleEntityNotFound(_0x5f358e,null))[_0x3448('0x1f')](removeEntity(_0x5f358e,null))[_0x3448('0x29')](handleError(_0x5f358e,null));};exports['getConfigurations']=function(_0x163443,_0x5795c7,_0x15b48b){var _0xceff06={};var _0x3bf4d2={};var _0x5c9320;var _0x3ead11;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x163443[_0x3448('0x53')]['id']}})[_0x3448('0x1f')](handleEntityNotFound(_0x5795c7,null))[_0x3448('0x1f')](function(_0x5a51bb){if(_0x5a51bb){_0x5c9320=_0x5a51bb;_0x3bf4d2[_0x3448('0x3d')]=_[_0x3448('0x3f')](db[_0x3448('0x57')][_0x3448('0x3b')]);_0x3bf4d2[_0x3448('0x3e')]=_[_0x3448('0x3f')](_0x163443[_0x3448('0x3e')]);_0x3bf4d2[_0x3448('0x48')]=_[_0x3448('0x40')](_0x3bf4d2[_0x3448('0x3d')],_0x3bf4d2[_0x3448('0x3e')]);_0xceff06[_0x3448('0x41')]=_[_0x3448('0x40')](_0x3bf4d2[_0x3448('0x3d')],qs[_0x3448('0x42')](_0x163443[_0x3448('0x3e')][_0x3448('0x42')]));_0xceff06[_0x3448('0x41')]=_0xceff06['attributes'][_0x3448('0x43')]?_0xceff06['attributes']:_0x3bf4d2[_0x3448('0x3d')];_0xceff06['order']=qs[_0x3448('0x46')](_0x163443[_0x3448('0x3e')]['sort']);_0xceff06[_0x3448('0x47')]=qs[_0x3448('0x48')](_['pick'](_0x163443['query'],_0x3bf4d2[_0x3448('0x48')]));if(_0x163443['query']['filter']){_0xceff06[_0x3448('0x47')]=_[_0x3448('0x4b')](_0xceff06['where'],{'$or':_['map'](_0xceff06[_0x3448('0x41')],function(_0x2920fd){var _0x45fd46={};_0x45fd46[_0x2920fd]={'$like':'%'+_0x163443[_0x3448('0x3e')][_0x3448('0x4a')]+'%'};return _0x45fd46;})});}_0xceff06=_[_0x3448('0x4b')]({},_0xceff06,_0x163443[_0x3448('0x4e')]);return _0x5c9320[_0x3448('0x58')](_0xceff06);}})[_0x3448('0x1f')](function(_0x347412){if(_0x347412){_0x3ead11=_0x347412[_0x3448('0x43')];if(!_0x163443[_0x3448('0x3e')][_0x3448('0x59')](_0x3448('0x44'))){_0xceff06['limit']=qs[_0x3448('0x2f')](_0x163443[_0x3448('0x3e')]['limit']);_0xceff06[_0x3448('0x2e')]=qs[_0x3448('0x2e')](_0x163443['query'][_0x3448('0x2e')]);}return _0x5c9320[_0x3448('0x58')](_0xceff06);}})[_0x3448('0x1f')](function(_0x508273){if(_0x508273){return _0x508273?{'count':_0x3ead11,'rows':_0x508273}:null;}})['then'](respondWithResult(_0x5795c7,null))[_0x3448('0x29')](handleError(_0x5795c7,null));};exports['addConfiguration']=function(_0x31dfc5,_0x42c146,_0x5d952a){if(_0x31dfc5['body']['id']){delete _0x31dfc5[_0x3448('0x56')]['id'];}return db[_0x3448('0x3a')][_0x3448('0x5a')]({'where':{'id':_0x31dfc5['params']['id']}})['then'](handleEntityNotFound(_0x42c146,null))[_0x3448('0x1f')](function(_0x36c0b5){if(_0x36c0b5){_0x31dfc5[_0x3448('0x56')][_0x3448('0x5b')]=_0x36c0b5['id'];_0x31dfc5[_0x3448('0x56')][_0x3448('0x5c')]=integrations['getSubjects'](_0x31dfc5[_0x3448('0x56')]['channel'],_0x31dfc5[_0x3448('0x56')][_0x3448('0x4c')]);_0x31dfc5['body'][_0x3448('0x5d')]=integrations[_0x3448('0x5e')](_0x31dfc5['body']['channel'],_0x31dfc5[_0x3448('0x56')][_0x3448('0x4c')]);return db[_0x3448('0x57')][_0x3448('0x55')](_0x31dfc5[_0x3448('0x56')],{'include':[{'model':db[_0x3448('0x5f')],'as':_0x3448('0x5c')},{'model':db[_0x3448('0x5f')],'as':_0x3448('0x5d')}]});}return null;})[_0x3448('0x1f')](respondWithResult(_0x42c146,null))[_0x3448('0x29')](handleError(_0x42c146,null));};exports[_0x3448('0x60')]=function(_0x46c693,_0x11d62f,_0x2f1c7c){var _0x25524d='';var _0x4cfab2='';return db['FreshsalesAccount'][_0x3448('0x5a')]({'where':{'id':_0x46c693['params']['id']},'attributes':['id',_0x3448('0x61'),_0x3448('0x62'),'apiKey']})[_0x3448('0x1f')](handleEntityNotFound(_0x11d62f,null))['then'](function(_0x15d898){if(_0x15d898){_0x4cfab2=_0x15d898[_0x3448('0x61')];_0x25524d=_0x15d898[_0x3448('0x62')];var _0x3a64cc=_0x15d898[_0x3448('0x62')]['slice'](-0x1);if(_0x3a64cc==='/'){_0x25524d=_0x25524d[_0x3448('0x63')](0x0,_0x25524d[_0x3448('0x64')](_0x3a64cc));}return rp({'method':_0x3448('0x65'),'uri':util['format'](_0x3448('0x66'),_0x25524d,_0x3448('0x67')),'headers':{'Authorization':_0x3448('0x68')+_0x15d898['apiKey']},'json':!![]});}})[_0x3448('0x1f')](function(_0x5cde09){if(_0x5cde09){var _0x48d320=_0x5cde09[_0x3448('0x69')];var _0x5e36db=![];var _0x284efb=null;for(_0x284efb=0x0;_0x284efb<_0x48d320['length'];_0x284efb++){if(_0x48d320[_0x284efb][_0x3448('0x6a')]===_0x4cfab2){_0x5e36db=!![];}}if(_0x5e36db){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3448('0x6b')});}}})['then'](respondWithResult(_0x11d62f,null))['catch'](function(_0x2a3e76){var _0x287e21=_0x46c693['query'][_0x3448('0x6c')]?0x1f4:_0x2a3e76[_0x3448('0x6d')]||0x1f4;logger['error'](_0x3448('0x6e'),_0x3448('0x60'),_0x287e21,JSON[_0x3448('0x25')](_0x2a3e76));delete _0x2a3e76[_0x3448('0x37')];if(_0x287e21===0x191){_0x287e21=0x190;}_0x11d62f['status'](_0x287e21)[_0x3448('0x6f')](_0x46c693['query'][_0x3448('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x2a3e76[_0x3448('0x6d')]}:_0x2a3e76);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 236ba97..5108ba4 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 _0xdd8f=['define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4228f1,_0x105cec){var _0x369315=function(_0x462d60){while(--_0x462d60){_0x4228f1['push'](_0x4228f1['shift']());}};_0x369315(++_0x105cec);}(_0xdd8f,0x6b));var _0xfdd8=function(_0x52c7dc,_0xed4f4a){_0x52c7dc=_0x52c7dc-0x0;var _0x5f473b=_0xdd8f[_0x52c7dc];return _0x5f473b;};'use strict';var _=require('lodash');var util=require(_0xfdd8('0x0'));var logger=require('../../config/logger')(_0xfdd8('0x1'));var moment=require(_0xfdd8('0x2'));var BPromise=require(_0xfdd8('0x3'));var rp=require(_0xfdd8('0x4'));var fs=require('fs');var path=require(_0xfdd8('0x5'));var rimraf=require(_0xfdd8('0x6'));var config=require('../../config/environment');var attributes=require(_0xfdd8('0x7'));var integrations=require(_0xfdd8('0x8'));module[_0xfdd8('0x9')]=function(_0x14b4a1,_0x47ef9d){return _0x14b4a1[_0xfdd8('0xa')](_0xfdd8('0xb'),attributes,{'tableName':_0xfdd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a4b=['FreshsalesAccount','int_freshsales_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x1a4b,0xe3));var _0xb1a4=function(_0x176e24,_0xbe9e6){_0x176e24=_0x176e24-0x0;var _0x12584f=_0x1a4b[_0x176e24];return _0x12584f;};'use strict';var _=require(_0xb1a4('0x0'));var util=require(_0xb1a4('0x1'));var logger=require('../../config/logger')(_0xb1a4('0x2'));var moment=require(_0xb1a4('0x3'));var BPromise=require(_0xb1a4('0x4'));var rp=require(_0xb1a4('0x5'));var fs=require('fs');var path=require(_0xb1a4('0x6'));var rimraf=require(_0xb1a4('0x7'));var config=require(_0xb1a4('0x8'));var attributes=require(_0xb1a4('0x9'));var integrations=require(_0xb1a4('0xa'));module[_0xb1a4('0xb')]=function(_0x495e2c,_0x1df7a3){return _0x495e2c[_0xb1a4('0xc')](_0xb1a4('0xd'),attributes,{'tableName':_0xb1a4('0xe'),'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 45f864b..99ca596 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 _0x27f3=['limit','map','include','model','attributes','ShowFreshsalesAccount','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x2e64b6,_0x55cab7){var _0x3816fd=function(_0x480a2d){while(--_0x480a2d){_0x2e64b6['push'](_0x2e64b6['shift']());}};_0x3816fd(++_0x55cab7);}(_0x27f3,0x1e9));var _0x327f=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x27f3[_0x3b19ea];return _0x40ece9;};'use strict';var _=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var moment=require('moment');var BPromise=require(_0x327f('0x2'));var rs=require(_0x327f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x327f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x327f('0x5'))(_0x327f('0x6'));var config=require(_0x327f('0x7'));var jayson=require(_0x327f('0x8'));var client=jayson[_0x327f('0x9')][_0x327f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x181949,_0x19b8cc,_0x551a98){return new BPromise(function(_0x12b0f7,_0x3b4593){return client[_0x327f('0xb')](_0x181949,_0x551a98)[_0x327f('0xc')](function(_0x89473b){logger[_0x327f('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x19b8cc,_0x327f('0xe'));logger[_0x327f('0xf')](_0x327f('0x10'),_0x19b8cc,_0x327f('0xe'),JSON[_0x327f('0x11')](_0x89473b));if(_0x89473b[_0x327f('0x12')]){if(_0x89473b[_0x327f('0x12')][_0x327f('0x13')]===0x1f4){logger['error'](_0x327f('0x14'),_0x19b8cc,_0x89473b[_0x327f('0x12')][_0x327f('0x15')]);return _0x3b4593(_0x89473b[_0x327f('0x12')][_0x327f('0x15')]);}logger[_0x327f('0x12')](_0x327f('0x14'),_0x19b8cc,_0x89473b[_0x327f('0x12')]['message']);return _0x12b0f7(_0x89473b['error'][_0x327f('0x15')]);}else{logger[_0x327f('0xd')](_0x327f('0x14'),_0x19b8cc,_0x327f('0xe'));_0x12b0f7(_0x89473b[_0x327f('0x16')][_0x327f('0x15')]);}})[_0x327f('0x17')](function(_0x6de69e){logger[_0x327f('0x12')](_0x327f('0x14'),_0x19b8cc,_0x6de69e);_0x3b4593(_0x6de69e);});});}exports[_0x327f('0x18')]=function(_0x56e60c){var _0x3ea319=this;return new Promise(function(_0x19c63a,_0x31ba23){return db[_0x327f('0x19')][_0x327f('0x1a')]({'raw':_0x56e60c[_0x327f('0x1b')]?_0x56e60c[_0x327f('0x1b')][_0x327f('0x1c')]===undefined?!![]:![]:!![],'where':_0x56e60c[_0x327f('0x1b')]?_0x56e60c[_0x327f('0x1b')]['where']||null:null,'attributes':_0x56e60c[_0x327f('0x1b')]?_0x56e60c[_0x327f('0x1b')]['attributes']||null:null,'limit':_0x56e60c[_0x327f('0x1b')]?_0x56e60c[_0x327f('0x1b')][_0x327f('0x1d')]||null:null,'include':_0x56e60c[_0x327f('0x1b')]?_0x56e60c[_0x327f('0x1b')]['include']?_[_0x327f('0x1e')](_0x56e60c[_0x327f('0x1b')][_0x327f('0x1f')],function(_0x4eb966){return{'model':db[_0x4eb966[_0x327f('0x20')]],'as':_0x4eb966['as'],'attributes':_0x4eb966[_0x327f('0x21')],'include':_0x4eb966[_0x327f('0x1f')]?_[_0x327f('0x1e')](_0x4eb966['include'],function(_0xa8a89b){return{'model':db[_0xa8a89b[_0x327f('0x20')]],'as':_0xa8a89b['as'],'attributes':_0xa8a89b[_0x327f('0x21')],'include':_0xa8a89b[_0x327f('0x1f')]?_[_0x327f('0x1e')](_0xa8a89b[_0x327f('0x1f')],function(_0x1c22e4){return{'model':db[_0x1c22e4['model']],'as':_0x1c22e4['as'],'attributes':_0x1c22e4[_0x327f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x327f('0xc')](function(_0x2c3351){logger['info'](_0x327f('0x18'),_0x56e60c);logger[_0x327f('0xf')](_0x327f('0x18'),_0x56e60c,JSON[_0x327f('0x11')](_0x2c3351));_0x19c63a(_0x2c3351);})[_0x327f('0x17')](function(_0x123c42){logger[_0x327f('0x12')]('GetFreshsalesAccount',_0x123c42['message'],_0x56e60c);_0x31ba23(_0x3ea319[_0x327f('0x12')](0x1f4,_0x123c42['message']));});});};exports[_0x327f('0x22')]=function(_0x52ee35){var _0x3f9ad2=this;return new Promise(function(_0x4f3cc7,_0x5b4e57){return db[_0x327f('0x19')][_0x327f('0x23')]({'raw':_0x52ee35[_0x327f('0x1b')]?_0x52ee35[_0x327f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x52ee35[_0x327f('0x1b')]?_0x52ee35[_0x327f('0x1b')][_0x327f('0x24')]||null:null,'attributes':_0x52ee35[_0x327f('0x1b')]?_0x52ee35[_0x327f('0x1b')][_0x327f('0x21')]||null:null,'include':_0x52ee35[_0x327f('0x1b')]?_0x52ee35['options'][_0x327f('0x1f')]?_[_0x327f('0x1e')](_0x52ee35[_0x327f('0x1b')][_0x327f('0x1f')],function(_0x2e551c){return{'model':db[_0x2e551c['model']],'as':_0x2e551c['as'],'attributes':_0x2e551c[_0x327f('0x21')],'include':_0x2e551c[_0x327f('0x1f')]?_['map'](_0x2e551c['include'],function(_0x7bfb9c){return{'model':db[_0x7bfb9c[_0x327f('0x20')]],'as':_0x7bfb9c['as'],'attributes':_0x7bfb9c[_0x327f('0x21')],'include':_0x7bfb9c[_0x327f('0x1f')]?_[_0x327f('0x1e')](_0x7bfb9c['include'],function(_0x23c62f){return{'model':db[_0x23c62f['model']],'as':_0x23c62f['as'],'attributes':_0x23c62f[_0x327f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x327f('0xc')](function(_0x2589a4){logger[_0x327f('0xd')](_0x327f('0x22'),_0x52ee35);logger[_0x327f('0xf')]('ShowFreshsalesAccount',_0x52ee35,JSON[_0x327f('0x11')](_0x2589a4));_0x4f3cc7(_0x2589a4);})['catch'](function(_0x5bcebd){logger[_0x327f('0x12')]('ShowFreshsalesAccount',_0x5bcebd['message'],_0x52ee35);_0x5b4e57(_0x3f9ad2[_0x327f('0x12')](0x1f4,_0x5bcebd[_0x327f('0x15')]));});});}; \ No newline at end of file +var _0x38b2=['include','map','model','GetFreshsalesAccount','debug','catch','ShowFreshsalesAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x38b2,0xf6));var _0x238b=function(_0x5f3333,_0xdb032b){_0x5f3333=_0x5f3333-0x0;var _0x80716c=_0x38b2[_0x5f3333];return _0x80716c;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var moment=require(_0x238b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238b('0x3'));var db=require(_0x238b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x238b('0x5'))('rpc');var config=require(_0x238b('0x6'));var jayson=require(_0x238b('0x7'));var client=jayson[_0x238b('0x8')][_0x238b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5509fe,_0x202714,_0x12ac57){return new BPromise(function(_0x4b79d3,_0x16e19d){return client[_0x238b('0xa')](_0x5509fe,_0x12ac57)[_0x238b('0xb')](function(_0x3124e1){logger[_0x238b('0xc')](_0x238b('0xd'),_0x202714,_0x238b('0xe'));logger['debug'](_0x238b('0xf'),_0x202714,_0x238b('0xe'),JSON[_0x238b('0x10')](_0x3124e1));if(_0x3124e1[_0x238b('0x11')]){if(_0x3124e1[_0x238b('0x11')]['code']===0x1f4){logger[_0x238b('0x11')](_0x238b('0xd'),_0x202714,_0x3124e1[_0x238b('0x11')][_0x238b('0x12')]);return _0x16e19d(_0x3124e1['error']['message']);}logger['error'](_0x238b('0xd'),_0x202714,_0x3124e1[_0x238b('0x11')][_0x238b('0x12')]);return _0x4b79d3(_0x3124e1[_0x238b('0x11')][_0x238b('0x12')]);}else{logger[_0x238b('0xc')](_0x238b('0xd'),_0x202714,_0x238b('0xe'));_0x4b79d3(_0x3124e1['result'][_0x238b('0x12')]);}})['catch'](function(_0x2bb3e7){logger['error'](_0x238b('0xd'),_0x202714,_0x2bb3e7);_0x16e19d(_0x2bb3e7);});});}exports['GetFreshsalesAccount']=function(_0x92d5b4){var _0x222d24=this;return new Promise(function(_0x37bfd8,_0x4a70e3){return db[_0x238b('0x13')][_0x238b('0x14')]({'raw':_0x92d5b4['options']?_0x92d5b4[_0x238b('0x15')][_0x238b('0x16')]===undefined?!![]:![]:!![],'where':_0x92d5b4['options']?_0x92d5b4['options'][_0x238b('0x17')]||null:null,'attributes':_0x92d5b4[_0x238b('0x15')]?_0x92d5b4[_0x238b('0x15')][_0x238b('0x18')]||null:null,'limit':_0x92d5b4[_0x238b('0x15')]?_0x92d5b4[_0x238b('0x15')][_0x238b('0x19')]||null:null,'include':_0x92d5b4[_0x238b('0x15')]?_0x92d5b4[_0x238b('0x15')][_0x238b('0x1a')]?_['map'](_0x92d5b4['options'][_0x238b('0x1a')],function(_0x1ae511){return{'model':db[_0x1ae511['model']],'as':_0x1ae511['as'],'attributes':_0x1ae511['attributes'],'include':_0x1ae511['include']?_[_0x238b('0x1b')](_0x1ae511[_0x238b('0x1a')],function(_0xe167de){return{'model':db[_0xe167de[_0x238b('0x1c')]],'as':_0xe167de['as'],'attributes':_0xe167de[_0x238b('0x18')],'include':_0xe167de['include']?_['map'](_0xe167de[_0x238b('0x1a')],function(_0x3c9e76){return{'model':db[_0x3c9e76[_0x238b('0x1c')]],'as':_0x3c9e76['as'],'attributes':_0x3c9e76[_0x238b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x238b('0xb')](function(_0xe8dea4){logger['info'](_0x238b('0x1d'),_0x92d5b4);logger[_0x238b('0x1e')](_0x238b('0x1d'),_0x92d5b4,JSON[_0x238b('0x10')](_0xe8dea4));_0x37bfd8(_0xe8dea4);})[_0x238b('0x1f')](function(_0x2a0728){logger[_0x238b('0x11')](_0x238b('0x1d'),_0x2a0728[_0x238b('0x12')],_0x92d5b4);_0x4a70e3(_0x222d24[_0x238b('0x11')](0x1f4,_0x2a0728[_0x238b('0x12')]));});});};exports[_0x238b('0x20')]=function(_0x4af577){var _0x19fcf9=this;return new Promise(function(_0x54d9e7,_0xc289c0){return db[_0x238b('0x13')][_0x238b('0x21')]({'raw':_0x4af577['options']?_0x4af577['options']['raw']===undefined?!![]:![]:!![],'where':_0x4af577['options']?_0x4af577[_0x238b('0x15')]['where']||null:null,'attributes':_0x4af577[_0x238b('0x15')]?_0x4af577[_0x238b('0x15')][_0x238b('0x18')]||null:null,'include':_0x4af577[_0x238b('0x15')]?_0x4af577[_0x238b('0x15')]['include']?_['map'](_0x4af577[_0x238b('0x15')][_0x238b('0x1a')],function(_0x38aecc){return{'model':db[_0x38aecc['model']],'as':_0x38aecc['as'],'attributes':_0x38aecc[_0x238b('0x18')],'include':_0x38aecc[_0x238b('0x1a')]?_[_0x238b('0x1b')](_0x38aecc[_0x238b('0x1a')],function(_0x5c2e84){return{'model':db[_0x5c2e84[_0x238b('0x1c')]],'as':_0x5c2e84['as'],'attributes':_0x5c2e84['attributes'],'include':_0x5c2e84[_0x238b('0x1a')]?_[_0x238b('0x1b')](_0x5c2e84[_0x238b('0x1a')],function(_0x3de311){return{'model':db[_0x3de311[_0x238b('0x1c')]],'as':_0x3de311['as'],'attributes':_0x3de311[_0x238b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x238b('0xb')](function(_0x6e094){logger[_0x238b('0xc')]('ShowFreshsalesAccount',_0x4af577);logger[_0x238b('0x1e')](_0x238b('0x20'),_0x4af577,JSON[_0x238b('0x10')](_0x6e094));_0x54d9e7(_0x6e094);})[_0x238b('0x1f')](function(_0xa05ef4){logger[_0x238b('0x11')](_0x238b('0x20'),_0xa05ef4['message'],_0x4af577);_0xc289c0(_0x19fcf9[_0x238b('0x11')](0x1f4,_0xa05ef4[_0x238b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4807489..67e0d89 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 _0x4c60=['/:id/fields','getFields','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4c60,0xaf));var _0x04c6=function(_0x48e4f8,_0x69283d){_0x48e4f8=_0x48e4f8-0x0;var _0x38e21d=_0x4c60[_0x48e4f8];return _0x38e21d;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require(_0x04c6('0x4'));var router=express[_0x04c6('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0x7')]);router[_0x04c6('0x8')](_0x04c6('0x9'),auth[_0x04c6('0x6')](),controller[_0x04c6('0xa')]);router[_0x04c6('0x8')](_0x04c6('0xb'),auth[_0x04c6('0x6')](),controller[_0x04c6('0xc')]);router['get'](_0x04c6('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x04c6('0x8')](_0x04c6('0xe'),auth['isAuthenticated'](),controller[_0x04c6('0xf')]);router[_0x04c6('0x10')]('/',auth['isAuthenticated'](),controller[_0x04c6('0x11')]);router[_0x04c6('0x12')](_0x04c6('0x9'),auth[_0x04c6('0x6')](),controller['update']);router[_0x04c6('0x13')](_0x04c6('0x9'),auth[_0x04c6('0x6')](),controller['destroy']);module[_0x04c6('0x14')]=router; \ No newline at end of file +var _0xce0e=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xce0e,0x125));var _0xece0=function(_0x122ac8,_0x25e39e){_0x122ac8=_0x122ac8-0x0;var _0x471da7=_0xce0e[_0x122ac8];return _0x471da7;};'use strict';var multer=require(_0xece0('0x0'));var util=require(_0xece0('0x1'));var path=require(_0xece0('0x2'));var timeout=require(_0xece0('0x3'));var express=require(_0xece0('0x4'));var router=express[_0xece0('0x5')]();var auth=require(_0xece0('0x6'));var interaction=require(_0xece0('0x7'));var config=require('../../config/environment');var controller=require(_0xece0('0x8'));router[_0xece0('0x9')]('/',auth[_0xece0('0xa')](),controller[_0xece0('0xb')]);router[_0xece0('0x9')](_0xece0('0xc'),auth[_0xece0('0xa')](),controller['show']);router[_0xece0('0x9')](_0xece0('0xd'),auth[_0xece0('0xa')](),controller[_0xece0('0xe')]);router[_0xece0('0x9')](_0xece0('0xf'),auth[_0xece0('0xa')](),controller[_0xece0('0x10')]);router[_0xece0('0x9')](_0xece0('0x11'),auth[_0xece0('0xa')](),controller['getFields']);router[_0xece0('0x12')]('/',auth[_0xece0('0xa')](),controller['create']);router[_0xece0('0x13')](_0xece0('0xc'),auth['isAuthenticated'](),controller[_0xece0('0x14')]);router[_0xece0('0x15')](_0xece0('0xc'),auth[_0xece0('0xa')](),controller[_0xece0('0x16')]);module[_0xece0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 78beec9..075199c 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 _0x1ff7=['sequelize','exports','STRING'];(function(_0x27d0d8,_0x2b657d){var _0x2b79d1=function(_0x249ec1){while(--_0x249ec1){_0x27d0d8['push'](_0x27d0d8['shift']());}};_0x2b79d1(++_0x2b657d);}(_0x1ff7,0x15c));var _0x71ff=function(_0x12709a,_0x20d878){_0x12709a=_0x12709a-0x0;var _0x5897a4=_0x1ff7[_0x12709a];return _0x5897a4;};'use strict';var Sequelize=require(_0x71ff('0x0'));module[_0x71ff('0x1')]={'name':{'type':Sequelize[_0x71ff('0x2')]},'description':{'type':Sequelize[_0x71ff('0x2')]}}; \ No newline at end of file +var _0xa5b1=['STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa5b1,0xb7));var _0x1a5b=function(_0x3ba938,_0x27414d){_0x3ba938=_0x3ba938-0x0;var _0x2aabff=_0xa5b1[_0x3ba938];return _0x2aabff;};'use strict';var Sequelize=require(_0x1a5b('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a5b('0x1')]},'description':{'type':Sequelize[_0x1a5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 76f7015..c555a82 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 _0xc4aa=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','stack','name','send','map','FreshsalesConfiguration','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','show','rawAttributes','fields','include','find','catch','create','body','params','getSubjects','findOne','getDescriptions','getFields','FreshsalesField','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x5ef234,_0x1b2776){var _0xc95e9e=function(_0x2c72ac){while(--_0x2c72ac){_0x5ef234['push'](_0x5ef234['shift']());}};_0xc95e9e(++_0x1b2776);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var jayson=require(_0xac4a('0x17'));var client=jayson['client'][_0xac4a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x68424a,_0x247b78,_0x6e00d4,_0x1b4313){return new BPromise(function(_0x3b71c0,_0x34bc01){var _0x33c287=_0x1b4313||client;return _0x33c287[_0xac4a('0x19')](_0x68424a,_0x6e00d4)[_0xac4a('0x1a')](function(_0x11e101){logger[_0xac4a('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x247b78,_0xac4a('0x1c'));logger[_0xac4a('0x1d')](_0xac4a('0x1e'),_0x247b78,_0xac4a('0x1c'),JSON[_0xac4a('0x1f')](_0x11e101));if(_0x11e101[_0xac4a('0x20')]){if(_0x11e101[_0xac4a('0x20')][_0xac4a('0x21')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x247b78,_0x11e101[_0xac4a('0x20')][_0xac4a('0x22')]);return _0x34bc01(_0x11e101[_0xac4a('0x20')]['message']);}logger[_0xac4a('0x20')](_0xac4a('0x23'),_0x247b78,_0x11e101[_0xac4a('0x20')][_0xac4a('0x22')]);return _0x3b71c0(_0x11e101[_0xac4a('0x20')][_0xac4a('0x22')]);}else{logger[_0xac4a('0x1b')](_0xac4a('0x23'),_0x247b78,'request\x20sent');_0x3b71c0(_0x11e101[_0xac4a('0x24')][_0xac4a('0x22')]);}})['catch'](function(_0x3d7ce0){logger[_0xac4a('0x20')](_0xac4a('0x23'),_0x247b78,_0x3d7ce0);_0x34bc01(_0x3d7ce0);});});}function respondWithStatusCode(_0x947d8e,_0x4d2d6c){_0x4d2d6c=_0x4d2d6c||0xcc;return function(_0x1b7998){if(_0x1b7998){return _0x947d8e[_0xac4a('0x25')](_0x4d2d6c);}return _0x947d8e[_0xac4a('0x26')](_0x4d2d6c)[_0xac4a('0x27')]();};}function respondWithResult(_0x594f36,_0x2b0dc2){_0x2b0dc2=_0x2b0dc2||0xc8;return function(_0x222507){if(_0x222507){return _0x594f36[_0xac4a('0x26')](_0x2b0dc2)[_0xac4a('0x28')](_0x222507);}};}function respondWithFilteredResult(_0x3bc318,_0x1d0539){return function(_0x215a31){if(_0x215a31){var _0x14832b=_0x215a31['count'],_0x472c57=_0x1d0539[_0xac4a('0x29')],_0x1c13dc=_0x1d0539[_0xac4a('0x29')]+_0x1d0539[_0xac4a('0x2a')],_0x20202c;if(_0x1c13dc>=_0x14832b){_0x1c13dc=_0x14832b;_0x20202c=0xc8;}else{_0x20202c=0xce;}_0x3bc318[_0xac4a('0x26')](_0x20202c);return _0x3bc318[_0xac4a('0x2b')]('Content-Range',_0x472c57+'-'+_0x1c13dc+'/'+_0x14832b)['json'](_0x215a31);}return null;};}function patchUpdates(_0xdb7e){return function(_0x7a948b){try{jsonpatch[_0xac4a('0x2c')](_0x7a948b,_0xdb7e,!![]);}catch(_0x546b65){return BPromise['reject'](_0x546b65);}return _0x7a948b[_0xac4a('0x2d')]();};}function saveUpdates(_0x2896bc,_0x228629){return function(_0x432066){if(_0x432066){return _0x432066[_0xac4a('0x2e')](_0x2896bc)['then'](function(_0x6dcc7f){return _0x6dcc7f;});}return null;};}function removeEntity(_0x482afc,_0x30364b){return function(_0x57adcf){if(_0x57adcf){return _0x57adcf[_0xac4a('0x2f')]()[_0xac4a('0x1a')](function(){_0x482afc[_0xac4a('0x26')](0xcc)[_0xac4a('0x27')]();});}};}function handleEntityNotFound(_0x34577f,_0x61e552){return function(_0xbd4591){if(!_0xbd4591){_0x34577f[_0xac4a('0x25')](0x194);}return _0xbd4591;};}function handleError(_0x29fb3b,_0xfd7c16){_0xfd7c16=_0xfd7c16||0x1f4;return function(_0x36ab49){logger[_0xac4a('0x20')](_0x36ab49[_0xac4a('0x30')]);if(_0x36ab49[_0xac4a('0x31')]){delete _0x36ab49['name'];}_0x29fb3b[_0xac4a('0x26')](_0xfd7c16)[_0xac4a('0x32')](_0x36ab49);};}exports['index']=function(_0x2a5419,_0x1af1c1){var _0x565164={},_0x58804b={},_0x11f0be={'count':0x0,'rows':[]};var _0x1ba096=_[_0xac4a('0x33')](db[_0xac4a('0x34')]['rawAttributes'],function(_0x453d02){return{'name':_0x453d02[_0xac4a('0x35')],'type':_0x453d02['type'][_0xac4a('0x36')]};});_0x58804b[_0xac4a('0x37')]=_[_0xac4a('0x33')](_0x1ba096,'name');_0x58804b[_0xac4a('0x38')]=_[_0xac4a('0x39')](_0x2a5419[_0xac4a('0x38')]);_0x58804b['filters']=_[_0xac4a('0x3a')](_0x58804b[_0xac4a('0x37')],_0x58804b['query']);_0x565164['attributes']=_[_0xac4a('0x3a')](_0x58804b['model'],qs['fields'](_0x2a5419['query']['fields']));_0x565164[_0xac4a('0x3b')]=_0x565164[_0xac4a('0x3b')][_0xac4a('0x3c')]?_0x565164[_0xac4a('0x3b')]:_0x58804b[_0xac4a('0x37')];if(!_0x2a5419[_0xac4a('0x38')][_0xac4a('0x3d')](_0xac4a('0x3e'))){_0x565164[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x2a5419[_0xac4a('0x38')][_0xac4a('0x2a')]);_0x565164['offset']=qs['offset'](_0x2a5419['query'][_0xac4a('0x29')]);}_0x565164[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x2a5419[_0xac4a('0x38')][_0xac4a('0x40')]);_0x565164[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x2a5419[_0xac4a('0x38')],_0x58804b[_0xac4a('0x42')]),_0x1ba096);if(_0x2a5419['query'][_0xac4a('0x44')]){_0x565164[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x565164[_0xac4a('0x41')],{'$or':_[_0xac4a('0x33')](_0x1ba096,function(_0x57b879){if(_0x57b879[_0xac4a('0x46')]!==_0xac4a('0x47')){var _0x547ba2={};_0x547ba2[_0x57b879[_0xac4a('0x31')]]={'$like':'%'+_0x2a5419['query'][_0xac4a('0x44')]+'%'};return _0x547ba2;}})});}_0x565164=_[_0xac4a('0x45')]({},_0x565164,_0x2a5419[_0xac4a('0x48')]);var _0x32e3fb={'where':_0x565164[_0xac4a('0x41')]};return db[_0xac4a('0x34')][_0xac4a('0x49')](_0x32e3fb)[_0xac4a('0x1a')](function(_0x98e0c4){_0x11f0be[_0xac4a('0x49')]=_0x98e0c4;if(_0x2a5419[_0xac4a('0x38')][_0xac4a('0x4a')]){_0x565164['include']=[{'all':!![]}];}return db[_0xac4a('0x34')][_0xac4a('0x4b')](_0x565164);})[_0xac4a('0x1a')](function(_0x58759a){_0x11f0be[_0xac4a('0x4c')]=_0x58759a;return _0x11f0be;})[_0xac4a('0x1a')](respondWithFilteredResult(_0x1af1c1,_0x565164))['catch'](handleError(_0x1af1c1,null));};exports[_0xac4a('0x4d')]=function(_0x5a7f6e,_0x244950){var _0xe620f6={'raw':![],'where':{'id':_0x5a7f6e['params']['id']}},_0x136a65={};_0x136a65['model']=_[_0xac4a('0x39')](db['FreshsalesConfiguration'][_0xac4a('0x4e')]);_0x136a65['query']=_[_0xac4a('0x39')](_0x5a7f6e['query']);_0x136a65[_0xac4a('0x42')]=_[_0xac4a('0x3a')](_0x136a65[_0xac4a('0x37')],_0x136a65[_0xac4a('0x38')]);_0xe620f6['attributes']=_[_0xac4a('0x3a')](_0x136a65[_0xac4a('0x37')],qs[_0xac4a('0x4f')](_0x5a7f6e[_0xac4a('0x38')][_0xac4a('0x4f')]));_0xe620f6[_0xac4a('0x3b')]=_0xe620f6[_0xac4a('0x3b')]['length']?_0xe620f6[_0xac4a('0x3b')]:_0x136a65[_0xac4a('0x37')];if(_0x5a7f6e['query'][_0xac4a('0x4a')]){_0xe620f6[_0xac4a('0x50')]=[{'all':!![]}];}_0xe620f6=_[_0xac4a('0x45')]({},_0xe620f6,_0x5a7f6e[_0xac4a('0x48')]);return db['FreshsalesConfiguration'][_0xac4a('0x51')](_0xe620f6)[_0xac4a('0x1a')](handleEntityNotFound(_0x244950,null))[_0xac4a('0x1a')](respondWithResult(_0x244950,null))[_0xac4a('0x52')](handleError(_0x244950,null));};exports[_0xac4a('0x53')]=function(_0x49fbc3,_0x179373){return db['FreshsalesConfiguration'][_0xac4a('0x53')](_0x49fbc3[_0xac4a('0x54')],{})['then'](respondWithResult(_0x179373,0xc9))['catch'](handleError(_0x179373,null));};exports[_0xac4a('0x2e')]=function(_0x70fdc3,_0x4d448f){if(_0x70fdc3[_0xac4a('0x54')]['id']){delete _0x70fdc3[_0xac4a('0x54')]['id'];}return db[_0xac4a('0x34')][_0xac4a('0x51')]({'where':{'id':_0x70fdc3['params']['id']}})[_0xac4a('0x1a')](handleEntityNotFound(_0x4d448f,null))[_0xac4a('0x1a')](saveUpdates(_0x70fdc3[_0xac4a('0x54')],null))[_0xac4a('0x1a')](respondWithResult(_0x4d448f,null))[_0xac4a('0x52')](handleError(_0x4d448f,null));};exports[_0xac4a('0x2f')]=function(_0x36179a,_0x487a44){return db[_0xac4a('0x34')][_0xac4a('0x51')]({'where':{'id':_0x36179a[_0xac4a('0x55')]['id']}})[_0xac4a('0x1a')](handleEntityNotFound(_0x487a44,null))[_0xac4a('0x1a')](removeEntity(_0x487a44,null))[_0xac4a('0x52')](handleError(_0x487a44,null));};exports[_0xac4a('0x56')]=function(_0x236f57,_0x159e43,_0x786d9){var _0x3b175a={};var _0x38dd4f={};var _0x400ac4;var _0x2fe7df;return db[_0xac4a('0x34')][_0xac4a('0x57')]({'where':{'id':_0x236f57['params']['id']}})[_0xac4a('0x1a')](handleEntityNotFound(_0x159e43,null))['then'](function(_0x2d598e){if(_0x2d598e){_0x400ac4=_0x2d598e;_0x38dd4f['model']=_[_0xac4a('0x39')](db['FreshsalesField'][_0xac4a('0x4e')]);_0x38dd4f['query']=_['keys'](_0x236f57[_0xac4a('0x38')]);_0x38dd4f[_0xac4a('0x42')]=_[_0xac4a('0x3a')](_0x38dd4f[_0xac4a('0x37')],_0x38dd4f[_0xac4a('0x38')]);_0x3b175a[_0xac4a('0x3b')]=_['intersection'](_0x38dd4f[_0xac4a('0x37')],qs['fields'](_0x236f57[_0xac4a('0x38')]['fields']));_0x3b175a[_0xac4a('0x3b')]=_0x3b175a[_0xac4a('0x3b')][_0xac4a('0x3c')]?_0x3b175a[_0xac4a('0x3b')]:_0x38dd4f[_0xac4a('0x37')];_0x3b175a[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x236f57[_0xac4a('0x38')][_0xac4a('0x40')]);_0x3b175a[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x236f57[_0xac4a('0x38')],_0x38dd4f[_0xac4a('0x42')]));if(_0x236f57[_0xac4a('0x38')][_0xac4a('0x44')]){_0x3b175a[_0xac4a('0x41')]=_['merge'](_0x3b175a[_0xac4a('0x41')],{'$or':_[_0xac4a('0x33')](_0x3b175a['attributes'],function(_0x3c3576){var _0x34bd1c={};_0x34bd1c[_0x3c3576]={'$like':'%'+_0x236f57[_0xac4a('0x38')][_0xac4a('0x44')]+'%'};return _0x34bd1c;})});}_0x3b175a=_[_0xac4a('0x45')]({},_0x3b175a,_0x236f57['options']);return _0x400ac4['getSubjects'](_0x3b175a);}})[_0xac4a('0x1a')](function(_0x11bb54){if(_0x11bb54){_0x2fe7df=_0x11bb54[_0xac4a('0x3c')];if(!_0x236f57[_0xac4a('0x38')][_0xac4a('0x3d')](_0xac4a('0x3e'))){_0x3b175a[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x236f57[_0xac4a('0x38')][_0xac4a('0x2a')]);_0x3b175a[_0xac4a('0x29')]=qs['offset'](_0x236f57['query'][_0xac4a('0x29')]);}return _0x400ac4[_0xac4a('0x56')](_0x3b175a);}})[_0xac4a('0x1a')](function(_0x423f70){if(_0x423f70){return _0x423f70?{'count':_0x2fe7df,'rows':_0x423f70}:null;}})[_0xac4a('0x1a')](respondWithResult(_0x159e43,null))[_0xac4a('0x52')](handleError(_0x159e43,null));};exports[_0xac4a('0x58')]=function(_0x34e42f,_0x453d62,_0x2a5acc){var _0xb09b89={};var _0xb12cc5={};var _0x5f0173;var _0x13c854;return db[_0xac4a('0x34')][_0xac4a('0x57')]({'where':{'id':_0x34e42f[_0xac4a('0x55')]['id']}})['then'](handleEntityNotFound(_0x453d62,null))[_0xac4a('0x1a')](function(_0x5a30af){if(_0x5a30af){_0x5f0173=_0x5a30af;_0xb12cc5[_0xac4a('0x37')]=_[_0xac4a('0x39')](db['FreshsalesField']['rawAttributes']);_0xb12cc5[_0xac4a('0x38')]=_[_0xac4a('0x39')](_0x34e42f[_0xac4a('0x38')]);_0xb12cc5['filters']=_[_0xac4a('0x3a')](_0xb12cc5['model'],_0xb12cc5[_0xac4a('0x38')]);_0xb09b89['attributes']=_['intersection'](_0xb12cc5[_0xac4a('0x37')],qs['fields'](_0x34e42f[_0xac4a('0x38')]['fields']));_0xb09b89[_0xac4a('0x3b')]=_0xb09b89[_0xac4a('0x3b')]['length']?_0xb09b89[_0xac4a('0x3b')]:_0xb12cc5['model'];_0xb09b89[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x34e42f['query'][_0xac4a('0x40')]);_0xb09b89['where']=qs['filters'](_[_0xac4a('0x43')](_0x34e42f['query'],_0xb12cc5[_0xac4a('0x42')]));if(_0x34e42f['query']['filter']){_0xb09b89[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0xb09b89[_0xac4a('0x41')],{'$or':_['map'](_0xb09b89['attributes'],function(_0x1327ea){var _0x9c0fa1={};_0x9c0fa1[_0x1327ea]={'$like':'%'+_0x34e42f['query']['filter']+'%'};return _0x9c0fa1;})});}_0xb09b89=_[_0xac4a('0x45')]({},_0xb09b89,_0x34e42f[_0xac4a('0x48')]);return _0x5f0173[_0xac4a('0x58')](_0xb09b89);}})[_0xac4a('0x1a')](function(_0x1810f7){if(_0x1810f7){_0x13c854=_0x1810f7[_0xac4a('0x3c')];if(!_0x34e42f[_0xac4a('0x38')][_0xac4a('0x3d')](_0xac4a('0x3e'))){_0xb09b89['limit']=qs[_0xac4a('0x2a')](_0x34e42f[_0xac4a('0x38')][_0xac4a('0x2a')]);_0xb09b89['offset']=qs[_0xac4a('0x29')](_0x34e42f[_0xac4a('0x38')][_0xac4a('0x29')]);}return _0x5f0173[_0xac4a('0x58')](_0xb09b89);}})[_0xac4a('0x1a')](function(_0x5daf44){if(_0x5daf44){return _0x5daf44?{'count':_0x13c854,'rows':_0x5daf44}:null;}})[_0xac4a('0x1a')](respondWithResult(_0x453d62,null))[_0xac4a('0x52')](handleError(_0x453d62,null));};exports[_0xac4a('0x59')]=function(_0x37e519,_0x72c90c,_0x451248){var _0xd7bdd6={};var _0x5b9e82={};var _0x2e3bb7;var _0x2be178;return db[_0xac4a('0x34')][_0xac4a('0x57')]({'where':{'id':_0x37e519[_0xac4a('0x55')]['id']}})[_0xac4a('0x1a')](handleEntityNotFound(_0x72c90c,null))['then'](function(_0x318bee){if(_0x318bee){_0x2e3bb7=_0x318bee;_0x5b9e82[_0xac4a('0x37')]=_[_0xac4a('0x39')](db[_0xac4a('0x5a')]['rawAttributes']);_0x5b9e82[_0xac4a('0x38')]=_['keys'](_0x37e519[_0xac4a('0x38')]);_0x5b9e82[_0xac4a('0x42')]=_['intersection'](_0x5b9e82['model'],_0x5b9e82[_0xac4a('0x38')]);_0xd7bdd6[_0xac4a('0x3b')]=_[_0xac4a('0x3a')](_0x5b9e82['model'],qs[_0xac4a('0x4f')](_0x37e519['query'][_0xac4a('0x4f')]));_0xd7bdd6[_0xac4a('0x3b')]=_0xd7bdd6[_0xac4a('0x3b')][_0xac4a('0x3c')]?_0xd7bdd6[_0xac4a('0x3b')]:_0x5b9e82['model'];_0xd7bdd6['order']=qs[_0xac4a('0x40')](_0x37e519[_0xac4a('0x38')][_0xac4a('0x40')]);_0xd7bdd6[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x37e519[_0xac4a('0x38')],_0x5b9e82[_0xac4a('0x42')]));if(_0x37e519['query']['filter']){_0xd7bdd6[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0xd7bdd6[_0xac4a('0x41')],{'$or':_[_0xac4a('0x33')](_0xd7bdd6[_0xac4a('0x3b')],function(_0x2ea4a4){var _0xdaa2ef={};_0xdaa2ef[_0x2ea4a4]={'$like':'%'+_0x37e519[_0xac4a('0x38')]['filter']+'%'};return _0xdaa2ef;})});}_0xd7bdd6=_['merge']({},_0xd7bdd6,_0x37e519[_0xac4a('0x48')]);return _0x2e3bb7[_0xac4a('0x59')](_0xd7bdd6);}})[_0xac4a('0x1a')](function(_0x371e06){if(_0x371e06){_0x2be178=_0x371e06[_0xac4a('0x3c')];if(!_0x37e519[_0xac4a('0x38')][_0xac4a('0x3d')]('nolimit')){_0xd7bdd6[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x37e519[_0xac4a('0x38')]['limit']);_0xd7bdd6[_0xac4a('0x29')]=qs[_0xac4a('0x29')](_0x37e519[_0xac4a('0x38')][_0xac4a('0x29')]);}return _0x2e3bb7[_0xac4a('0x59')](_0xd7bdd6);}})[_0xac4a('0x1a')](function(_0x4445c6){if(_0x4445c6){return _0x4445c6?{'count':_0x2be178,'rows':_0x4445c6}:null;}})[_0xac4a('0x1a')](respondWithResult(_0x72c90c,null))[_0xac4a('0x52')](handleError(_0x72c90c,null));}; \ No newline at end of file +var _0x5fab=['FreshsalesField','length','hasOwnProperty','getSubjects','getDescriptions','nolimit','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','attributes','intersection','fields','query','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fab,0x177));var _0xb5fa=function(_0x385359,_0x325c57){_0x385359=_0x385359-0x0;var _0x2ea4dd=_0x5fab[_0x385359];return _0x2ea4dd;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb5fa('0x1a')][_0xb5fa('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56e8b0,_0x116849,_0x577af0,_0x265992){return new BPromise(function(_0x3fc372,_0x40c914){var _0xca8d82=_0x265992||client;return _0xca8d82[_0xb5fa('0x1c')](_0x56e8b0,_0x577af0)['then'](function(_0x567f31){logger[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));logger[_0xb5fa('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x116849,'request\x20sent',JSON[_0xb5fa('0x21')](_0x567f31));if(_0x567f31[_0xb5fa('0x22')]){if(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x23')]===0x1f4){logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);return _0x40c914(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);}logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31['error'][_0xb5fa('0x24')]);return _0x3fc372(_0x567f31['error'][_0xb5fa('0x24')]);}else{logger['info'](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));_0x3fc372(_0x567f31['result'][_0xb5fa('0x24')]);}})[_0xb5fa('0x25')](function(_0x283a56){logger['error'](_0xb5fa('0x1e'),_0x116849,_0x283a56);_0x40c914(_0x283a56);});});}function respondWithStatusCode(_0xec108f,_0x444237){_0x444237=_0x444237||0xcc;return function(_0x542348){if(_0x542348){return _0xec108f[_0xb5fa('0x26')](_0x444237);}return _0xec108f['status'](_0x444237)[_0xb5fa('0x27')]();};}function respondWithResult(_0x264591,_0x11053a){_0x11053a=_0x11053a||0xc8;return function(_0x543edf){if(_0x543edf){return _0x264591[_0xb5fa('0x28')](_0x11053a)[_0xb5fa('0x29')](_0x543edf);}};}function respondWithFilteredResult(_0x6a455c,_0x20d649){return function(_0x568870){if(_0x568870){var _0x4ec294=_0x568870[_0xb5fa('0x2a')],_0x5bdf11=_0x20d649[_0xb5fa('0x2b')],_0x5a1c39=_0x20d649[_0xb5fa('0x2b')]+_0x20d649[_0xb5fa('0x2c')],_0x28a350;if(_0x5a1c39>=_0x4ec294){_0x5a1c39=_0x4ec294;_0x28a350=0xc8;}else{_0x28a350=0xce;}_0x6a455c[_0xb5fa('0x28')](_0x28a350);return _0x6a455c[_0xb5fa('0x2d')](_0xb5fa('0x2e'),_0x5bdf11+'-'+_0x5a1c39+'/'+_0x4ec294)[_0xb5fa('0x29')](_0x568870);}return null;};}function patchUpdates(_0x2a5690){return function(_0x142bfa){try{jsonpatch[_0xb5fa('0x2f')](_0x142bfa,_0x2a5690,!![]);}catch(_0xab5427){return BPromise[_0xb5fa('0x30')](_0xab5427);}return _0x142bfa[_0xb5fa('0x31')]();};}function saveUpdates(_0x116773,_0x5a0152){return function(_0x3fd1fb){if(_0x3fd1fb){return _0x3fd1fb[_0xb5fa('0x32')](_0x116773)[_0xb5fa('0x33')](function(_0x291938){return _0x291938;});}return null;};}function removeEntity(_0x370d95,_0x10fb43){return function(_0x25fc7c){if(_0x25fc7c){return _0x25fc7c['destroy']()[_0xb5fa('0x33')](function(){_0x370d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558708,_0x1e6ba0){return function(_0x502d57){if(!_0x502d57){_0x558708[_0xb5fa('0x26')](0x194);}return _0x502d57;};}function handleError(_0x5876f1,_0x5518b1){_0x5518b1=_0x5518b1||0x1f4;return function(_0x1847bc){logger[_0xb5fa('0x22')](_0x1847bc['stack']);if(_0x1847bc['name']){delete _0x1847bc[_0xb5fa('0x34')];}_0x5876f1[_0xb5fa('0x28')](_0x5518b1)[_0xb5fa('0x35')](_0x1847bc);};}exports['index']=function(_0xc9adee,_0xc28a80){var _0x4a7137={},_0x18398f={},_0x2056de={'count':0x0,'rows':[]};var _0x204d6b=_['map'](db[_0xb5fa('0x36')][_0xb5fa('0x37')],function(_0x24ef11){return{'name':_0x24ef11['fieldName'],'type':_0x24ef11[_0xb5fa('0x38')][_0xb5fa('0x39')]};});_0x18398f[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x204d6b,'name');_0x18398f['query']=_['keys'](_0xc9adee['query']);_0x18398f['filters']=_['intersection'](_0x18398f[_0xb5fa('0x3a')],_0x18398f['query']);_0x4a7137[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x18398f[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x4a7137['attributes']=_0x4a7137['attributes']['length']?_0x4a7137[_0xb5fa('0x3c')]:_0x18398f['model'];if(!_0xc9adee[_0xb5fa('0x3f')]['hasOwnProperty']('nolimit')){_0x4a7137[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x4a7137[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}_0x4a7137[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0xc9adee['query'][_0xb5fa('0x41')]);_0x4a7137['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0xc9adee[_0xb5fa('0x3f')],_0x18398f[_0xb5fa('0x42')]),_0x204d6b);if(_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x4a7137[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x4a7137['where'],{'$or':_[_0xb5fa('0x3b')](_0x204d6b,function(_0xc03e44){if(_0xc03e44['type']!==_0xb5fa('0x47')){var _0x5a6ae3={};_0x5a6ae3[_0xc03e44[_0xb5fa('0x34')]]={'$like':'%'+_0xc9adee[_0xb5fa('0x3f')]['filter']+'%'};return _0x5a6ae3;}})});}_0x4a7137=_['merge']({},_0x4a7137,_0xc9adee[_0xb5fa('0x48')]);var _0xe86e11={'where':_0x4a7137[_0xb5fa('0x45')]};return db[_0xb5fa('0x36')][_0xb5fa('0x2a')](_0xe86e11)[_0xb5fa('0x33')](function(_0x10f354){_0x2056de[_0xb5fa('0x2a')]=_0x10f354;if(_0xc9adee['query'][_0xb5fa('0x49')]){_0x4a7137[_0xb5fa('0x4a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb5fa('0x4b')](_0x4a7137);})[_0xb5fa('0x33')](function(_0x247999){_0x2056de[_0xb5fa('0x4c')]=_0x247999;return _0x2056de;})[_0xb5fa('0x33')](respondWithFilteredResult(_0xc28a80,_0x4a7137))[_0xb5fa('0x25')](handleError(_0xc28a80,null));};exports[_0xb5fa('0x4d')]=function(_0x33eb2c,_0x20f5f5){var _0x464e36={'raw':![],'where':{'id':_0x33eb2c[_0xb5fa('0x4e')]['id']}},_0xfe091={};_0xfe091[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x36')][_0xb5fa('0x37')]);_0xfe091['query']=_['keys'](_0x33eb2c[_0xb5fa('0x3f')]);_0xfe091['filters']=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],_0xfe091['query']);_0x464e36[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x33eb2c[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x464e36['attributes']=_0x464e36[_0xb5fa('0x3c')]['length']?_0x464e36[_0xb5fa('0x3c')]:_0xfe091[_0xb5fa('0x3a')];if(_0x33eb2c[_0xb5fa('0x3f')]['includeAll']){_0x464e36[_0xb5fa('0x4a')]=[{'all':!![]}];}_0x464e36=_[_0xb5fa('0x46')]({},_0x464e36,_0x33eb2c['options']);return db['FreshsalesConfiguration'][_0xb5fa('0x50')](_0x464e36)[_0xb5fa('0x33')](handleEntityNotFound(_0x20f5f5,null))[_0xb5fa('0x33')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x25')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x51')]=function(_0x7775b4,_0x31c91f){return db[_0xb5fa('0x36')][_0xb5fa('0x51')](_0x7775b4[_0xb5fa('0x52')],{})[_0xb5fa('0x33')](respondWithResult(_0x31c91f,0xc9))[_0xb5fa('0x25')](handleError(_0x31c91f,null));};exports[_0xb5fa('0x32')]=function(_0x2799e7,_0x23f235){if(_0x2799e7[_0xb5fa('0x52')]['id']){delete _0x2799e7[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x2799e7[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x23f235,null))[_0xb5fa('0x33')](saveUpdates(_0x2799e7[_0xb5fa('0x52')],null))[_0xb5fa('0x33')](respondWithResult(_0x23f235,null))[_0xb5fa('0x25')](handleError(_0x23f235,null));};exports[_0xb5fa('0x53')]=function(_0x24117e,_0x1cb39e){return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x24117e['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1cb39e,null))[_0xb5fa('0x33')](removeEntity(_0x1cb39e,null))[_0xb5fa('0x25')](handleError(_0x1cb39e,null));};exports['getSubjects']=function(_0x441c41,_0x367f7a,_0x1572fb){var _0x2e855c={};var _0x31ab22={};var _0x9d12f1;var _0x2e7286;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x441c41[_0xb5fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x367f7a,null))[_0xb5fa('0x33')](function(_0x26bc03){if(_0x26bc03){_0x9d12f1=_0x26bc03;_0x31ab22['model']=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x31ab22[_0xb5fa('0x3f')]=_[_0xb5fa('0x4f')](_0x441c41[_0xb5fa('0x3f')]);_0x31ab22[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],_0x31ab22[_0xb5fa('0x3f')]);_0x2e855c[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x2e855c[_0xb5fa('0x3c')]=_0x2e855c[_0xb5fa('0x3c')][_0xb5fa('0x56')]?_0x2e855c[_0xb5fa('0x3c')]:_0x31ab22[_0xb5fa('0x3a')];_0x2e855c[_0xb5fa('0x40')]=qs['sort'](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x41')]);_0x2e855c[_0xb5fa('0x45')]=qs['filters'](_[_0xb5fa('0x43')](_0x441c41[_0xb5fa('0x3f')],_0x31ab22['filters']));if(_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x2e855c[_0xb5fa('0x45')]=_['merge'](_0x2e855c['where'],{'$or':_[_0xb5fa('0x3b')](_0x2e855c[_0xb5fa('0x3c')],function(_0x432f04){var _0x57d8b7={};_0x57d8b7[_0x432f04]={'$like':'%'+_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x57d8b7;})});}_0x2e855c=_[_0xb5fa('0x46')]({},_0x2e855c,_0x441c41[_0xb5fa('0x48')]);return _0x9d12f1['getSubjects'](_0x2e855c);}})['then'](function(_0x5cec07){if(_0x5cec07){_0x2e7286=_0x5cec07[_0xb5fa('0x56')];if(!_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x57')]('nolimit')){_0x2e855c[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x2e855c[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x9d12f1[_0xb5fa('0x58')](_0x2e855c);}})[_0xb5fa('0x33')](function(_0x3a1db9){if(_0x3a1db9){return _0x3a1db9?{'count':_0x2e7286,'rows':_0x3a1db9}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x367f7a,null))[_0xb5fa('0x25')](handleError(_0x367f7a,null));};exports[_0xb5fa('0x59')]=function(_0x41127a,_0x5eeaa1,_0xf173e4){var _0x5a6f74={};var _0x47193c={};var _0x209213;var _0x37975d;return db[_0xb5fa('0x36')][_0xb5fa('0x54')]({'where':{'id':_0x41127a['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x5eeaa1,null))['then'](function(_0x77a831){if(_0x77a831){_0x209213=_0x77a831;_0x47193c[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')]['rawAttributes']);_0x47193c['query']=_['keys'](_0x41127a[_0xb5fa('0x3f')]);_0x47193c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x47193c[_0xb5fa('0x3a')],_0x47193c[_0xb5fa('0x3f')]);_0x5a6f74[_0xb5fa('0x3c')]=_['intersection'](_0x47193c[_0xb5fa('0x3a')],qs['fields'](_0x41127a['query'][_0xb5fa('0x3e')]));_0x5a6f74['attributes']=_0x5a6f74['attributes']['length']?_0x5a6f74[_0xb5fa('0x3c')]:_0x47193c['model'];_0x5a6f74[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x41127a[_0xb5fa('0x3f')]['sort']);_0x5a6f74['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0x41127a['query'],_0x47193c[_0xb5fa('0x42')]));if(_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x5a6f74[_0xb5fa('0x45')]=_['merge'](_0x5a6f74[_0xb5fa('0x45')],{'$or':_[_0xb5fa('0x3b')](_0x5a6f74[_0xb5fa('0x3c')],function(_0x180e63){var _0x1c0f49={};_0x1c0f49[_0x180e63]={'$like':'%'+_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x1c0f49;})});}_0x5a6f74=_['merge']({},_0x5a6f74,_0x41127a[_0xb5fa('0x48')]);return _0x209213['getDescriptions'](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x45790c){if(_0x45790c){_0x37975d=_0x45790c['length'];if(!_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x5a6f74[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x5a6f74[_0xb5fa('0x2b')]=qs['offset'](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x209213[_0xb5fa('0x59')](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x53095e){if(_0x53095e){return _0x53095e?{'count':_0x37975d,'rows':_0x53095e}:null;}})['then'](respondWithResult(_0x5eeaa1,null))['catch'](handleError(_0x5eeaa1,null));};exports['getFields']=function(_0x1c60bd,_0x1e607b,_0xff504d){var _0x188e66={};var _0x599a7c={};var _0x551822;var _0x148cb4;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x1c60bd[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1e607b,null))[_0xb5fa('0x33')](function(_0x577aef){if(_0x577aef){_0x551822=_0x577aef;_0x599a7c[_0xb5fa('0x3a')]=_['keys'](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x599a7c['query']=_['keys'](_0x1c60bd[_0xb5fa('0x3f')]);_0x599a7c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],_0x599a7c[_0xb5fa('0x3f')]);_0x188e66[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x188e66[_0xb5fa('0x3c')]=_0x188e66[_0xb5fa('0x3c')]['length']?_0x188e66['attributes']:_0x599a7c[_0xb5fa('0x3a')];_0x188e66['order']=qs[_0xb5fa('0x41')](_0x1c60bd[_0xb5fa('0x3f')]['sort']);_0x188e66[_0xb5fa('0x45')]=qs[_0xb5fa('0x42')](_['pick'](_0x1c60bd[_0xb5fa('0x3f')],_0x599a7c[_0xb5fa('0x42')]));if(_0x1c60bd['query'][_0xb5fa('0x44')]){_0x188e66[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x188e66['where'],{'$or':_['map'](_0x188e66[_0xb5fa('0x3c')],function(_0x1a24a2){var _0x3b5e1d={};_0x3b5e1d[_0x1a24a2]={'$like':'%'+_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x3b5e1d;})});}_0x188e66=_[_0xb5fa('0x46')]({},_0x188e66,_0x1c60bd[_0xb5fa('0x48')]);return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x1a4465){if(_0x1a4465){_0x148cb4=_0x1a4465['length'];if(!_0x1c60bd['query'][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x188e66[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x1c60bd['query'][_0xb5fa('0x2c')]);_0x188e66[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x1c60bd['query'][_0xb5fa('0x2b')]);}return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x301d14){if(_0x301d14){return _0x301d14?{'count':_0x148cb4,'rows':_0x301d14}:null;}})['then'](respondWithResult(_0x1e607b,null))[_0xb5fa('0x25')](handleError(_0x1e607b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 31c5fc1..aebd61e 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 _0x3f49=['util','api','moment','bluebird','path','rimraf','exports','FreshsalesConfiguration','lodash'];(function(_0x21b0b7,_0x1d7f0d){var _0x240265=function(_0x4ebce7){while(--_0x4ebce7){_0x21b0b7['push'](_0x21b0b7['shift']());}};_0x240265(++_0x1d7f0d);}(_0x3f49,0x11f));var _0x93f4=function(_0x1a8b8d,_0x34df88){_0x1a8b8d=_0x1a8b8d-0x0;var _0x47149d=_0x3f49[_0x1a8b8d];return _0x47149d;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var logger=require('../../config/logger')(_0x93f4('0x2'));var moment=require(_0x93f4('0x3'));var BPromise=require(_0x93f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93f4('0x5'));var rimraf=require(_0x93f4('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x93f4('0x7')]=function(_0x38eb6c,_0x2dfdf7){return _0x38eb6c['define'](_0x93f4('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddb4=['request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xef457f,_0x400356){var _0x19107c=function(_0x4cb90c){while(--_0x4cb90c){_0xef457f['push'](_0xef457f['shift']());}};_0x19107c(++_0x400356);}(_0xddb4,0x162));var _0x4ddb=function(_0x48b6c6,_0xba4073){_0x48b6c6=_0x48b6c6-0x0;var _0x1bcc9a=_0xddb4[_0x48b6c6];return _0x1bcc9a;};'use strict';var _=require(_0x4ddb('0x0'));var util=require(_0x4ddb('0x1'));var logger=require(_0x4ddb('0x2'))(_0x4ddb('0x3'));var moment=require(_0x4ddb('0x4'));var BPromise=require(_0x4ddb('0x5'));var rp=require(_0x4ddb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ddb('0x7'));var attributes=require(_0x4ddb('0x8'));module['exports']=function(_0x53a1db,_0x4b47f1){return _0x53a1db[_0x4ddb('0x9')](_0x4ddb('0xa'),attributes,{'tableName':_0x4ddb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index d45c5c6..abe3e36 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 _0xf7b4=['result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message'];(function(_0x70cd0c,_0x385194){var _0x2effd5=function(_0x4800de){while(--_0x4800de){_0x70cd0c['push'](_0x70cd0c['shift']());}};_0x2effd5(++_0x385194);}(_0xf7b4,0x152));var _0x4f7b=function(_0xc8aa9b,_0x415971){_0xc8aa9b=_0xc8aa9b-0x0;var _0x947317=_0xf7b4[_0xc8aa9b];return _0x947317;};'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')]('FreshsalesConfiguration,\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')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});} \ No newline at end of file +var _0xe027=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x382d37,_0x57282f){var _0x541b3a=function(_0x229add){while(--_0x229add){_0x382d37['push'](_0x382d37['shift']());}};_0x541b3a(++_0x57282f);}(_0xe027,0x106));var _0x7e02=function(_0x51d15c,_0x4bd992){_0x51d15c=_0x51d15c-0x0;var _0x438ee6=_0xe027[_0x51d15c];return _0x438ee6;};'use strict';var _=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var moment=require(_0x7e02('0x2'));var BPromise=require(_0x7e02('0x3'));var rs=require(_0x7e02('0x4'));var fs=require('fs');var Redis=require(_0x7e02('0x5'));var db=require(_0x7e02('0x6'))['db'];var utils=require(_0x7e02('0x7'));var logger=require(_0x7e02('0x8'))(_0x7e02('0x9'));var config=require(_0x7e02('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ebeca,_0x10ffc5,_0x53b91c){return new BPromise(function(_0x557349,_0x1533d0){return client['request'](_0x4ebeca,_0x53b91c)[_0x7e02('0xc')](function(_0x135555){logger[_0x7e02('0xd')](_0x7e02('0xe'),_0x10ffc5,_0x7e02('0xf'));logger[_0x7e02('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x10ffc5,_0x7e02('0xf'),JSON['stringify'](_0x135555));if(_0x135555[_0x7e02('0x11')]){if(_0x135555[_0x7e02('0x11')][_0x7e02('0x12')]===0x1f4){logger[_0x7e02('0x11')](_0x7e02('0xe'),_0x10ffc5,_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);return _0x1533d0(_0x135555['error'][_0x7e02('0x13')]);}logger['error'](_0x7e02('0xe'),_0x10ffc5,_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);return _0x557349(_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);}else{logger[_0x7e02('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x10ffc5,'request\x20sent');_0x557349(_0x135555['result'][_0x7e02('0x13')]);}})['catch'](function(_0xc9e71c){logger[_0x7e02('0x11')](_0x7e02('0xe'),_0x10ffc5,_0xc9e71c);_0x1533d0(_0xc9e71c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2f3c539..3577185 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 _0x5d0d=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d0d,0x16e));var _0xd5d0=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x5d0d[_0x44a64f];return _0x52024b;};'use strict';var multer=require(_0xd5d0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd5d0('0x1'));var express=require(_0xd5d0('0x2'));var router=express['Router']();var auth=require(_0xd5d0('0x3'));var interaction=require(_0xd5d0('0x4'));var config=require(_0xd5d0('0x5'));var controller=require(_0xd5d0('0x6'));router['get']('/',auth[_0xd5d0('0x7')](),controller[_0xd5d0('0x8')]);router[_0xd5d0('0x9')](_0xd5d0('0xa'),auth[_0xd5d0('0x7')](),controller[_0xd5d0('0xb')]);router['post']('/',auth[_0xd5d0('0x7')](),controller[_0xd5d0('0xc')]);router[_0xd5d0('0xd')]('/:id',auth[_0xd5d0('0x7')](),controller[_0xd5d0('0xe')]);router[_0xd5d0('0xf')](_0xd5d0('0xa'),auth[_0xd5d0('0x7')](),controller[_0xd5d0('0x10')]);module[_0xd5d0('0x11')]=router; \ No newline at end of file +var _0xe7c9=['/:id','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x5cea85,_0x406367){var _0x5b5b65=function(_0x2d65b4){while(--_0x2d65b4){_0x5cea85['push'](_0x5cea85['shift']());}};_0x5b5b65(++_0x406367);}(_0xe7c9,0x1b5));var _0x9e7c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe7c9[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require(_0x9e7c('0x0'));var path=require(_0x9e7c('0x1'));var timeout=require(_0x9e7c('0x2'));var express=require('express');var router=express[_0x9e7c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9e7c('0x4'));var config=require(_0x9e7c('0x5'));var controller=require('./intFreshsalesField.controller');router[_0x9e7c('0x6')]('/',auth[_0x9e7c('0x7')](),controller[_0x9e7c('0x8')]);router[_0x9e7c('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9e7c('0x9')]);router[_0x9e7c('0xa')]('/',auth[_0x9e7c('0x7')](),controller[_0x9e7c('0xb')]);router[_0x9e7c('0xc')]('/:id',auth[_0x9e7c('0x7')](),controller['update']);router['delete'](_0x9e7c('0xd'),auth[_0x9e7c('0x7')](),controller[_0x9e7c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 10305e1..359cd1b 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 _0x9c44=['variable','customVariable','keyValue','STRING','ENUM','string'];(function(_0x3cdb92,_0x5ee616){var _0x16e87b=function(_0x50ce44){while(--_0x50ce44){_0x3cdb92['push'](_0x3cdb92['shift']());}};_0x16e87b(++_0x5ee616);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')),'defaultValue':_0x49c4('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x49c4('0x0')]('string',_0x49c4('0x2'),_0x49c4('0x3'))},'keyContent':{'type':Sequelize[_0x49c4('0x5')]},'idField':{'type':Sequelize[_0x49c4('0x5')]},'nameField':{'type':Sequelize[_0x49c4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49c4('0x5')]}}; \ No newline at end of file +var _0x2772=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0xfb2b3b,_0x3aace7){var _0xf276a5=function(_0x3dcddf){while(--_0x3dcddf){_0xfb2b3b['push'](_0xfb2b3b['shift']());}};_0xf276a5(++_0x3aace7);}(_0x2772,0x1b5));var _0x2277=function(_0x2b7d68,_0x1d690){_0x2b7d68=_0x2b7d68-0x0;var _0x5c38d6=_0x2772[_0x2b7d68];return _0x5c38d6;};'use strict';var Sequelize=require('sequelize');module[_0x2277('0x0')]={'type':{'type':Sequelize[_0x2277('0x1')](_0x2277('0x2'),_0x2277('0x3'),_0x2277('0x4'),_0x2277('0x5')),'defaultValue':_0x2277('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2277('0x6')]},'keyType':{'type':Sequelize[_0x2277('0x1')]('string',_0x2277('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2277('0x6')]},'idField':{'type':Sequelize[_0x2277('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2277('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2277('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 51d9031..e71649c 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 _0xe468=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xe468,0x162));var _0x8e46=function(_0xe2b1c9,_0xbaf73){_0xe2b1c9=_0xe2b1c9-0x0;var _0x4cea8c=_0xe468[_0xe2b1c9];return _0x4cea8c;};'use strict';var pdf=require(_0x8e46('0x0'));var emlformat=require(_0x8e46('0x1'));var rimraf=require(_0x8e46('0x2'));var zipdir=require(_0x8e46('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e46('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e46('0x5'));var util=require(_0x8e46('0x6'));var path=require(_0x8e46('0x7'));var sox=require(_0x8e46('0x8'));var csv=require(_0x8e46('0x9'));var ejs=require(_0x8e46('0xa'));var fs=require('fs');var _=require(_0x8e46('0xb'));var squel=require(_0x8e46('0xc'));var crypto=require(_0x8e46('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e46('0xe'));var toCsv=require(_0x8e46('0x9'));var querystring=require(_0x8e46('0xf'));var Papa=require(_0x8e46('0x10'));var Redis=require(_0x8e46('0x11'));var authService=require(_0x8e46('0x12'));var qs=require(_0x8e46('0x13'));var as=require(_0x8e46('0x14'));var hardwareService=require(_0x8e46('0x15'));var logger=require('../../config/logger')(_0x8e46('0x16'));var utils=require('../../config/utils');var config=require(_0x8e46('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e46('0x18'))['db'];function respondWithStatusCode(_0xc91a49,_0x13c865){_0x13c865=_0x13c865||0xcc;return function(_0x4cd65d){if(_0x4cd65d){return _0xc91a49[_0x8e46('0x19')](_0x13c865);}return _0xc91a49[_0x8e46('0x1a')](_0x13c865)['end']();};}function respondWithResult(_0x31c59c,_0x540e70){_0x540e70=_0x540e70||0xc8;return function(_0x5d4073){if(_0x5d4073){return _0x31c59c[_0x8e46('0x1a')](_0x540e70)[_0x8e46('0x1b')](_0x5d4073);}};}function respondWithFilteredResult(_0x240f10,_0x5acd1b){return function(_0x2d3590){if(_0x2d3590){var _0x5c36e=_0x2d3590[_0x8e46('0x1c')],_0x4b8f03=_0x5acd1b['offset'],_0x449c62=_0x5acd1b['offset']+_0x5acd1b[_0x8e46('0x1d')],_0x50f6db;if(_0x449c62>=_0x5c36e){_0x449c62=_0x5c36e;_0x50f6db=0xc8;}else{_0x50f6db=0xce;}_0x240f10[_0x8e46('0x1a')](_0x50f6db);return _0x240f10[_0x8e46('0x1e')](_0x8e46('0x1f'),_0x4b8f03+'-'+_0x449c62+'/'+_0x5c36e)[_0x8e46('0x1b')](_0x2d3590);}return null;};}function patchUpdates(_0x51ef26){return function(_0x5c588d){try{jsonpatch[_0x8e46('0x20')](_0x5c588d,_0x51ef26,!![]);}catch(_0x118b64){return BPromise[_0x8e46('0x21')](_0x118b64);}return _0x5c588d['save']();};}function saveUpdates(_0x216c74,_0x152284){return function(_0x676d7f){if(_0x676d7f){return _0x676d7f['update'](_0x216c74)[_0x8e46('0x22')](function(_0x5d68aa){return _0x5d68aa;});}return null;};}function removeEntity(_0x4c9ff9,_0x4d31a7){return function(_0x22ba2a){if(_0x22ba2a){return _0x22ba2a[_0x8e46('0x23')]()['then'](function(){_0x4c9ff9[_0x8e46('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58238b,_0x4fffe0){return function(_0x208c15){if(!_0x208c15){_0x58238b[_0x8e46('0x19')](0x194);}return _0x208c15;};}function handleError(_0x231475,_0x10ed98){_0x10ed98=_0x10ed98||0x1f4;return function(_0x31587e){logger[_0x8e46('0x24')](_0x31587e['stack']);if(_0x31587e[_0x8e46('0x25')]){delete _0x31587e[_0x8e46('0x25')];}_0x231475['status'](_0x10ed98)[_0x8e46('0x26')](_0x31587e);};}exports[_0x8e46('0x27')]=function(_0x218b05,_0x17677f){var _0x5f0285={},_0x9c25a1={},_0x46961e={'count':0x0,'rows':[]};var _0x4f0081=_[_0x8e46('0x28')](db[_0x8e46('0x29')][_0x8e46('0x2a')],function(_0x24e761){return{'name':_0x24e761['fieldName'],'type':_0x24e761[_0x8e46('0x2b')][_0x8e46('0x2c')]};});_0x9c25a1[_0x8e46('0x2d')]=_[_0x8e46('0x28')](_0x4f0081,_0x8e46('0x25'));_0x9c25a1[_0x8e46('0x2e')]=_[_0x8e46('0x2f')](_0x218b05[_0x8e46('0x2e')]);_0x9c25a1['filters']=_[_0x8e46('0x30')](_0x9c25a1[_0x8e46('0x2d')],_0x9c25a1['query']);_0x5f0285[_0x8e46('0x31')]=_[_0x8e46('0x30')](_0x9c25a1[_0x8e46('0x2d')],qs['fields'](_0x218b05[_0x8e46('0x2e')]['fields']));_0x5f0285[_0x8e46('0x31')]=_0x5f0285['attributes'][_0x8e46('0x32')]?_0x5f0285[_0x8e46('0x31')]:_0x9c25a1[_0x8e46('0x2d')];if(!_0x218b05[_0x8e46('0x2e')][_0x8e46('0x33')]('nolimit')){_0x5f0285[_0x8e46('0x1d')]=qs[_0x8e46('0x1d')](_0x218b05['query'][_0x8e46('0x1d')]);_0x5f0285[_0x8e46('0x34')]=qs['offset'](_0x218b05[_0x8e46('0x2e')][_0x8e46('0x34')]);}_0x5f0285[_0x8e46('0x35')]=qs[_0x8e46('0x36')](_0x218b05[_0x8e46('0x2e')][_0x8e46('0x36')]);_0x5f0285[_0x8e46('0x37')]=qs['filters'](_[_0x8e46('0x38')](_0x218b05['query'],_0x9c25a1[_0x8e46('0x39')]),_0x4f0081);if(_0x218b05[_0x8e46('0x2e')]['filter']){_0x5f0285[_0x8e46('0x37')]=_[_0x8e46('0x3a')](_0x5f0285[_0x8e46('0x37')],{'$or':_[_0x8e46('0x28')](_0x4f0081,function(_0xcbd2b1){if(_0xcbd2b1[_0x8e46('0x2b')]!==_0x8e46('0x3b')){var _0x18f725={};_0x18f725[_0xcbd2b1[_0x8e46('0x25')]]={'$like':'%'+_0x218b05[_0x8e46('0x2e')][_0x8e46('0x3c')]+'%'};return _0x18f725;}})});}_0x5f0285=_[_0x8e46('0x3a')]({},_0x5f0285,_0x218b05[_0x8e46('0x3d')]);var _0xb956e8={'where':_0x5f0285[_0x8e46('0x37')]};return db[_0x8e46('0x29')][_0x8e46('0x1c')](_0xb956e8)[_0x8e46('0x22')](function(_0xad5f0f){_0x46961e[_0x8e46('0x1c')]=_0xad5f0f;if(_0x218b05[_0x8e46('0x2e')][_0x8e46('0x3e')]){_0x5f0285[_0x8e46('0x3f')]=[{'all':!![]}];}return db[_0x8e46('0x29')][_0x8e46('0x40')](_0x5f0285);})[_0x8e46('0x22')](function(_0x5eddc9){_0x46961e[_0x8e46('0x41')]=_0x5eddc9;return _0x46961e;})[_0x8e46('0x22')](respondWithFilteredResult(_0x17677f,_0x5f0285))[_0x8e46('0x42')](handleError(_0x17677f,null));};exports[_0x8e46('0x43')]=function(_0x81e213,_0x30777e){var _0x3687a2={'raw':!![],'where':{'id':_0x81e213[_0x8e46('0x44')]['id']}},_0x7a6a4f={};_0x7a6a4f['model']=_['keys'](db[_0x8e46('0x29')]['rawAttributes']);_0x7a6a4f[_0x8e46('0x2e')]=_[_0x8e46('0x2f')](_0x81e213[_0x8e46('0x2e')]);_0x7a6a4f[_0x8e46('0x39')]=_[_0x8e46('0x30')](_0x7a6a4f[_0x8e46('0x2d')],_0x7a6a4f['query']);_0x3687a2['attributes']=_[_0x8e46('0x30')](_0x7a6a4f[_0x8e46('0x2d')],qs[_0x8e46('0x45')](_0x81e213[_0x8e46('0x2e')][_0x8e46('0x45')]));_0x3687a2[_0x8e46('0x31')]=_0x3687a2[_0x8e46('0x31')][_0x8e46('0x32')]?_0x3687a2[_0x8e46('0x31')]:_0x7a6a4f[_0x8e46('0x2d')];if(_0x81e213[_0x8e46('0x2e')][_0x8e46('0x3e')]){_0x3687a2[_0x8e46('0x3f')]=[{'all':!![]}];}_0x3687a2=_[_0x8e46('0x3a')]({},_0x3687a2,_0x81e213['options']);return db[_0x8e46('0x29')][_0x8e46('0x46')](_0x3687a2)[_0x8e46('0x22')](handleEntityNotFound(_0x30777e,null))[_0x8e46('0x22')](respondWithResult(_0x30777e,null))[_0x8e46('0x42')](handleError(_0x30777e,null));};exports['create']=function(_0xb93593,_0x461093){return db[_0x8e46('0x29')][_0x8e46('0x47')](_0xb93593[_0x8e46('0x48')],{})[_0x8e46('0x22')](respondWithResult(_0x461093,0xc9))['catch'](handleError(_0x461093,null));};exports[_0x8e46('0x49')]=function(_0x5af0a8,_0x2babc8){if(_0x5af0a8[_0x8e46('0x48')]['id']){delete _0x5af0a8['body']['id'];}return db[_0x8e46('0x29')][_0x8e46('0x46')]({'where':{'id':_0x5af0a8[_0x8e46('0x44')]['id']}})['then'](handleEntityNotFound(_0x2babc8,null))['then'](saveUpdates(_0x5af0a8[_0x8e46('0x48')],null))[_0x8e46('0x22')](respondWithResult(_0x2babc8,null))[_0x8e46('0x42')](handleError(_0x2babc8,null));};exports['destroy']=function(_0x4d1aff,_0x1355bf){return db['FreshsalesField']['find']({'where':{'id':_0x4d1aff[_0x8e46('0x44')]['id']}})[_0x8e46('0x22')](handleEntityNotFound(_0x1355bf,null))[_0x8e46('0x22')](removeEntity(_0x1355bf,null))[_0x8e46('0x42')](handleError(_0x1355bf,null));}; \ No newline at end of file +var _0x483e=['ejs','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x483e,0x162));var _0xe483=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x483e[_0x189305];return _0xea3406;};'use strict';var pdf=require(_0xe483('0x0'));var emlformat=require(_0xe483('0x1'));var rimraf=require(_0xe483('0x2'));var zipdir=require(_0xe483('0x3'));var jsonpatch=require(_0xe483('0x4'));var rp=require('request-promise');var moment=require(_0xe483('0x5'));var BPromise=require(_0xe483('0x6'));var Mustache=require(_0xe483('0x7'));var util=require(_0xe483('0x8'));var path=require('path');var sox=require(_0xe483('0x9'));var csv=require(_0xe483('0xa'));var ejs=require(_0xe483('0xb'));var fs=require('fs');var _=require(_0xe483('0xc'));var squel=require('squel');var crypto=require(_0xe483('0xd'));var jsforce=require(_0xe483('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe483('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe483('0x10'));var as=require(_0xe483('0x11'));var hardwareService=require(_0xe483('0x12'));var logger=require(_0xe483('0x13'))(_0xe483('0x14'));var utils=require(_0xe483('0x15'));var config=require(_0xe483('0x16'));var licenseUtil=require(_0xe483('0x17'));var db=require(_0xe483('0x18'))['db'];function respondWithStatusCode(_0xfcb886,_0xce6598){_0xce6598=_0xce6598||0xcc;return function(_0x1f7710){if(_0x1f7710){return _0xfcb886[_0xe483('0x19')](_0xce6598);}return _0xfcb886['status'](_0xce6598)[_0xe483('0x1a')]();};}function respondWithResult(_0x1adbe0,_0x2b6346){_0x2b6346=_0x2b6346||0xc8;return function(_0x4d278d){if(_0x4d278d){return _0x1adbe0[_0xe483('0x1b')](_0x2b6346)['json'](_0x4d278d);}};}function respondWithFilteredResult(_0x149b58,_0x26374b){return function(_0x35b105){if(_0x35b105){var _0x5baaad=_0x35b105[_0xe483('0x1c')],_0x197361=_0x26374b[_0xe483('0x1d')],_0x580471=_0x26374b[_0xe483('0x1d')]+_0x26374b[_0xe483('0x1e')],_0x53b24a;if(_0x580471>=_0x5baaad){_0x580471=_0x5baaad;_0x53b24a=0xc8;}else{_0x53b24a=0xce;}_0x149b58['status'](_0x53b24a);return _0x149b58[_0xe483('0x1f')](_0xe483('0x20'),_0x197361+'-'+_0x580471+'/'+_0x5baaad)[_0xe483('0x21')](_0x35b105);}return null;};}function patchUpdates(_0xede12e){return function(_0x2c63de){try{jsonpatch['apply'](_0x2c63de,_0xede12e,!![]);}catch(_0x16a541){return BPromise[_0xe483('0x22')](_0x16a541);}return _0x2c63de[_0xe483('0x23')]();};}function saveUpdates(_0x697eef,_0x56f824){return function(_0xb31b82){if(_0xb31b82){return _0xb31b82['update'](_0x697eef)[_0xe483('0x24')](function(_0x2678f7){return _0x2678f7;});}return null;};}function removeEntity(_0x49d763,_0x556b4c){return function(_0x55061c){if(_0x55061c){return _0x55061c[_0xe483('0x25')]()[_0xe483('0x24')](function(){_0x49d763[_0xe483('0x1b')](0xcc)[_0xe483('0x1a')]();});}};}function handleEntityNotFound(_0x4f653a,_0x1e53ce){return function(_0x5b032f){if(!_0x5b032f){_0x4f653a[_0xe483('0x19')](0x194);}return _0x5b032f;};}function handleError(_0x3787d9,_0x1a0990){_0x1a0990=_0x1a0990||0x1f4;return function(_0x7ebb5f){logger['error'](_0x7ebb5f[_0xe483('0x26')]);if(_0x7ebb5f[_0xe483('0x27')]){delete _0x7ebb5f[_0xe483('0x27')];}_0x3787d9[_0xe483('0x1b')](_0x1a0990)[_0xe483('0x28')](_0x7ebb5f);};}exports[_0xe483('0x29')]=function(_0x3b8a7c,_0x476e00){var _0x467202={},_0x7adc1d={},_0x5aa567={'count':0x0,'rows':[]};var _0x35713c=_[_0xe483('0x2a')](db[_0xe483('0x2b')][_0xe483('0x2c')],function(_0x45b310){return{'name':_0x45b310['fieldName'],'type':_0x45b310['type'][_0xe483('0x2d')]};});_0x7adc1d[_0xe483('0x2e')]=_[_0xe483('0x2a')](_0x35713c,_0xe483('0x27'));_0x7adc1d[_0xe483('0x2f')]=_[_0xe483('0x30')](_0x3b8a7c['query']);_0x7adc1d['filters']=_[_0xe483('0x31')](_0x7adc1d['model'],_0x7adc1d[_0xe483('0x2f')]);_0x467202['attributes']=_['intersection'](_0x7adc1d[_0xe483('0x2e')],qs['fields'](_0x3b8a7c[_0xe483('0x2f')]['fields']));_0x467202[_0xe483('0x32')]=_0x467202[_0xe483('0x32')][_0xe483('0x33')]?_0x467202[_0xe483('0x32')]:_0x7adc1d[_0xe483('0x2e')];if(!_0x3b8a7c[_0xe483('0x2f')][_0xe483('0x34')](_0xe483('0x35'))){_0x467202[_0xe483('0x1e')]=qs['limit'](_0x3b8a7c[_0xe483('0x2f')][_0xe483('0x1e')]);_0x467202[_0xe483('0x1d')]=qs[_0xe483('0x1d')](_0x3b8a7c[_0xe483('0x2f')]['offset']);}_0x467202[_0xe483('0x36')]=qs[_0xe483('0x37')](_0x3b8a7c[_0xe483('0x2f')][_0xe483('0x37')]);_0x467202[_0xe483('0x38')]=qs[_0xe483('0x39')](_[_0xe483('0x3a')](_0x3b8a7c['query'],_0x7adc1d[_0xe483('0x39')]),_0x35713c);if(_0x3b8a7c[_0xe483('0x2f')][_0xe483('0x3b')]){_0x467202[_0xe483('0x38')]=_[_0xe483('0x3c')](_0x467202[_0xe483('0x38')],{'$or':_[_0xe483('0x2a')](_0x35713c,function(_0x5307ab){if(_0x5307ab[_0xe483('0x3d')]!==_0xe483('0x3e')){var _0x4f52d4={};_0x4f52d4[_0x5307ab[_0xe483('0x27')]]={'$like':'%'+_0x3b8a7c[_0xe483('0x2f')]['filter']+'%'};return _0x4f52d4;}})});}_0x467202=_[_0xe483('0x3c')]({},_0x467202,_0x3b8a7c[_0xe483('0x3f')]);var _0x166e6e={'where':_0x467202[_0xe483('0x38')]};return db['FreshsalesField']['count'](_0x166e6e)[_0xe483('0x24')](function(_0x3ef47c){_0x5aa567[_0xe483('0x1c')]=_0x3ef47c;if(_0x3b8a7c[_0xe483('0x2f')][_0xe483('0x40')]){_0x467202[_0xe483('0x41')]=[{'all':!![]}];}return db[_0xe483('0x2b')][_0xe483('0x42')](_0x467202);})[_0xe483('0x24')](function(_0x2c3693){_0x5aa567['rows']=_0x2c3693;return _0x5aa567;})[_0xe483('0x24')](respondWithFilteredResult(_0x476e00,_0x467202))[_0xe483('0x43')](handleError(_0x476e00,null));};exports['show']=function(_0x319bf2,_0x40119a){var _0x27f7c1={'raw':!![],'where':{'id':_0x319bf2[_0xe483('0x44')]['id']}},_0xc72ea9={};_0xc72ea9[_0xe483('0x2e')]=_['keys'](db[_0xe483('0x2b')][_0xe483('0x2c')]);_0xc72ea9[_0xe483('0x2f')]=_['keys'](_0x319bf2[_0xe483('0x2f')]);_0xc72ea9[_0xe483('0x39')]=_[_0xe483('0x31')](_0xc72ea9[_0xe483('0x2e')],_0xc72ea9[_0xe483('0x2f')]);_0x27f7c1[_0xe483('0x32')]=_[_0xe483('0x31')](_0xc72ea9[_0xe483('0x2e')],qs['fields'](_0x319bf2['query']['fields']));_0x27f7c1[_0xe483('0x32')]=_0x27f7c1[_0xe483('0x32')][_0xe483('0x33')]?_0x27f7c1['attributes']:_0xc72ea9[_0xe483('0x2e')];if(_0x319bf2[_0xe483('0x2f')]['includeAll']){_0x27f7c1[_0xe483('0x41')]=[{'all':!![]}];}_0x27f7c1=_['merge']({},_0x27f7c1,_0x319bf2[_0xe483('0x3f')]);return db['FreshsalesField']['find'](_0x27f7c1)[_0xe483('0x24')](handleEntityNotFound(_0x40119a,null))[_0xe483('0x24')](respondWithResult(_0x40119a,null))['catch'](handleError(_0x40119a,null));};exports[_0xe483('0x45')]=function(_0x913f93,_0x33d583){return db['FreshsalesField'][_0xe483('0x45')](_0x913f93[_0xe483('0x46')],{})[_0xe483('0x24')](respondWithResult(_0x33d583,0xc9))[_0xe483('0x43')](handleError(_0x33d583,null));};exports[_0xe483('0x47')]=function(_0x4a278d,_0x1d5705){if(_0x4a278d[_0xe483('0x46')]['id']){delete _0x4a278d['body']['id'];}return db[_0xe483('0x2b')]['find']({'where':{'id':_0x4a278d['params']['id']}})[_0xe483('0x24')](handleEntityNotFound(_0x1d5705,null))[_0xe483('0x24')](saveUpdates(_0x4a278d[_0xe483('0x46')],null))[_0xe483('0x24')](respondWithResult(_0x1d5705,null))[_0xe483('0x43')](handleError(_0x1d5705,null));};exports['destroy']=function(_0x3eaf2a,_0x181b5f){return db['FreshsalesField'][_0xe483('0x48')]({'where':{'id':_0x3eaf2a[_0xe483('0x44')]['id']}})['then'](handleEntityNotFound(_0x181b5f,null))[_0xe483('0x24')](removeEntity(_0x181b5f,null))['catch'](handleError(_0x181b5f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 597159d..037487a 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 _0x84f8=['freshsales_unique_index','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','define','FreshsalesField','int_freshsales_fields'];(function(_0x8a7642,_0x3e2c70){var _0x522e7c=function(_0x41f76e){while(--_0x41f76e){_0x8a7642['push'](_0x8a7642['shift']());}};_0x522e7c(++_0x3e2c70);}(_0x84f8,0x19a));var _0x884f=function(_0x178602,_0x4b6b1e){_0x178602=_0x178602-0x0;var _0x22d1fe=_0x84f8[_0x178602];return _0x22d1fe;};'use strict';var _=require(_0x884f('0x0'));var util=require(_0x884f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x884f('0x2'));var BPromise=require(_0x884f('0x3'));var rp=require(_0x884f('0x4'));var fs=require('fs');var path=require(_0x884f('0x5'));var rimraf=require(_0x884f('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x44fe20,_0x388e5a){return _0x44fe20[_0x884f('0x7')](_0x884f('0x8'),attributes,{'tableName':_0x884f('0x9'),'paranoid':![],'indexes':[{'name':_0x884f('0xa'),'fields':['idField',_0x884f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf13e=['path','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5c4308,_0x198d10){var _0x17031e=function(_0x159fb6){while(--_0x159fb6){_0x5c4308['push'](_0x5c4308['shift']());}};_0x17031e(++_0x198d10);}(_0xf13e,0x1cb));var _0xef13=function(_0x582210,_0x184c36){_0x582210=_0x582210-0x0;var _0x18cf58=_0xf13e[_0x582210];return _0x18cf58;};'use strict';var _=require(_0xef13('0x0'));var util=require(_0xef13('0x1'));var logger=require(_0xef13('0x2'))('api');var moment=require(_0xef13('0x3'));var BPromise=require(_0xef13('0x4'));var rp=require(_0xef13('0x5'));var fs=require('fs');var path=require(_0xef13('0x6'));var rimraf=require(_0xef13('0x7'));var config=require(_0xef13('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0xef13('0x9')]=function(_0xc339bf,_0x42878e){return _0xc339bf['define'](_0xef13('0xa'),attributes,{'tableName':_0xef13('0xb'),'paranoid':![],'indexes':[{'name':_0xef13('0xc'),'fields':[_0xef13('0xd'),_0xef13('0xe')],'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 3031523..5b33d0e 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 _0x7cce=['util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3cecd4,_0xb0bcf6){var _0x3d3577=function(_0x10a3fe){while(--_0x10a3fe){_0x3cecd4['push'](_0x3cecd4['shift']());}};_0x3d3577(++_0xb0bcf6);}(_0x7cce,0x143));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7cc('0x0'));var util=require(_0xe7cc('0x1'));var moment=require('moment');var BPromise=require(_0xe7cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7cc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe7cc('0x5'));var jayson=require(_0xe7cc('0x6'));var client=jayson[_0xe7cc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d3247,_0x54296b,_0x15dfd0){return new BPromise(function(_0x185bf1,_0x1a5e46){return client[_0xe7cc('0x8')](_0x5d3247,_0x15dfd0)[_0xe7cc('0x9')](function(_0xb830af){logger['info'](_0xe7cc('0xa'),_0x54296b,_0xe7cc('0xb'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x54296b,_0xe7cc('0xb'),JSON[_0xe7cc('0xc')](_0xb830af));if(_0xb830af[_0xe7cc('0xd')]){if(_0xb830af[_0xe7cc('0xd')][_0xe7cc('0xe')]===0x1f4){logger[_0xe7cc('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x54296b,_0xb830af[_0xe7cc('0xd')][_0xe7cc('0xf')]);return _0x1a5e46(_0xb830af[_0xe7cc('0xd')]['message']);}logger[_0xe7cc('0xd')](_0xe7cc('0xa'),_0x54296b,_0xb830af[_0xe7cc('0xd')][_0xe7cc('0xf')]);return _0x185bf1(_0xb830af[_0xe7cc('0xd')][_0xe7cc('0xf')]);}else{logger['info'](_0xe7cc('0xa'),_0x54296b,'request\x20sent');_0x185bf1(_0xb830af[_0xe7cc('0x10')][_0xe7cc('0xf')]);}})[_0xe7cc('0x11')](function(_0x56ad50){logger[_0xe7cc('0xd')](_0xe7cc('0xa'),_0x54296b,_0x56ad50);_0x1a5e46(_0x56ad50);});});} \ No newline at end of file +var _0xffc8=['debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xffc8,0x111));var _0x8ffc=function(_0x46eac1,_0x205934){_0x46eac1=_0x46eac1-0x0;var _0xa0daed=_0xffc8[_0x46eac1];return _0xa0daed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ffc('0x0'));var BPromise=require(_0x8ffc('0x1'));var rs=require(_0x8ffc('0x2'));var fs=require('fs');var Redis=require(_0x8ffc('0x3'));var db=require(_0x8ffc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8ffc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8ffc('0x6')][_0x8ffc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5afcd7,_0x97f579,_0x3e2dff){return new BPromise(function(_0x52067e,_0x7f692e){return client['request'](_0x5afcd7,_0x3e2dff)[_0x8ffc('0x8')](function(_0x3477c0){logger[_0x8ffc('0x9')](_0x8ffc('0xa'),_0x97f579,_0x8ffc('0xb'));logger[_0x8ffc('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x97f579,_0x8ffc('0xb'),JSON[_0x8ffc('0xd')](_0x3477c0));if(_0x3477c0[_0x8ffc('0xe')]){if(_0x3477c0[_0x8ffc('0xe')][_0x8ffc('0xf')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x97f579,_0x3477c0[_0x8ffc('0xe')][_0x8ffc('0x10')]);return _0x7f692e(_0x3477c0['error'][_0x8ffc('0x10')]);}logger[_0x8ffc('0xe')](_0x8ffc('0xa'),_0x97f579,_0x3477c0[_0x8ffc('0xe')][_0x8ffc('0x10')]);return _0x52067e(_0x3477c0[_0x8ffc('0xe')][_0x8ffc('0x10')]);}else{logger[_0x8ffc('0x9')](_0x8ffc('0xa'),_0x97f579,_0x8ffc('0xb'));_0x52067e(_0x3477c0[_0x8ffc('0x11')]['message']);}})[_0x8ffc('0x12')](function(_0x341df6){logger['error'](_0x8ffc('0xa'),_0x97f579,_0x341df6);_0x7f692e(_0x341df6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 27f20f5..5941e22 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 _0x3d66=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports'];(function(_0x28986c,_0x53082c){var _0x53b3d2=function(_0x311bcc){while(--_0x311bcc){_0x28986c['push'](_0x28986c['shift']());}};_0x53b3d2(++_0x53082c);}(_0x3d66,0x1a2));var _0x63d6=function(_0x589f40,_0x5d5335){_0x589f40=_0x589f40-0x0;var _0x1d42be=_0x3d66[_0x589f40];return _0x1d42be;};'use strict';var multer=require(_0x63d6('0x0'));var util=require(_0x63d6('0x1'));var path=require('path');var timeout=require(_0x63d6('0x2'));var express=require(_0x63d6('0x3'));var router=express[_0x63d6('0x4')]();var auth=require(_0x63d6('0x5'));var interaction=require(_0x63d6('0x6'));var config=require(_0x63d6('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x63d6('0x8')]('/',auth[_0x63d6('0x9')](),controller[_0x63d6('0xa')]);router[_0x63d6('0x8')](_0x63d6('0xb'),auth[_0x63d6('0x9')](),controller[_0x63d6('0xc')]);router[_0x63d6('0x8')](_0x63d6('0xd'),auth[_0x63d6('0x9')](),controller['getConfigurations']);router['get'](_0x63d6('0xe'),auth[_0x63d6('0x9')](),controller['getFields']);router[_0x63d6('0xf')]('/',auth[_0x63d6('0x9')](),controller[_0x63d6('0x10')]);router[_0x63d6('0xf')](_0x63d6('0xd'),auth[_0x63d6('0x9')](),controller[_0x63d6('0x11')]);router[_0x63d6('0x12')](_0x63d6('0xb'),auth[_0x63d6('0x9')](),controller['update']);router[_0x63d6('0x13')](_0x63d6('0xb'),auth[_0x63d6('0x9')](),controller[_0x63d6('0x14')]);module[_0x63d6('0x15')]=router; \ No newline at end of file +var _0x197b=['delete','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update'];(function(_0x33ebf8,_0x11aa61){var _0x2f34a4=function(_0x4eb881){while(--_0x4eb881){_0x33ebf8['push'](_0x33ebf8['shift']());}};_0x2f34a4(++_0x11aa61);}(_0x197b,0x141));var _0xb197=function(_0x5be1ca,_0xc15c91){_0x5be1ca=_0x5be1ca-0x0;var _0x3b4225=_0x197b[_0x5be1ca];return _0x3b4225;};'use strict';var multer=require(_0xb197('0x0'));var util=require('util');var path=require(_0xb197('0x1'));var timeout=require(_0xb197('0x2'));var express=require('express');var router=express[_0xb197('0x3')]();var auth=require(_0xb197('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb197('0x5'));var controller=require(_0xb197('0x6'));router[_0xb197('0x7')]('/',auth[_0xb197('0x8')](),controller[_0xb197('0x9')]);router['get'](_0xb197('0xa'),auth[_0xb197('0x8')](),controller[_0xb197('0xb')]);router[_0xb197('0x7')](_0xb197('0xc'),auth[_0xb197('0x8')](),controller[_0xb197('0xd')]);router['get'](_0xb197('0xe'),auth[_0xb197('0x8')](),controller['getFields']);router[_0xb197('0xf')]('/',auth[_0xb197('0x8')](),controller[_0xb197('0x10')]);router[_0xb197('0xf')]('/:id/configurations',auth[_0xb197('0x8')](),controller[_0xb197('0x11')]);router['put'](_0xb197('0xa'),auth[_0xb197('0x8')](),controller[_0xb197('0x12')]);router[_0xb197('0x13')](_0xb197('0xa'),auth[_0xb197('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ab1dabb..b546581 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 _0xd241=['integrationTab','newTab','STRING'];(function(_0x3ad0bb,_0x2a7098){var _0x4359c6=function(_0x12b22a){while(--_0x12b22a){_0x3ad0bb['push'](_0x3ad0bb['shift']());}};_0x4359c6(++_0x2a7098);}(_0xd241,0x1d6));var _0x1d24=function(_0xf11ab,_0x105897){_0xf11ab=_0xf11ab-0x0;var _0x43c7dd=_0xd241[_0xf11ab];return _0x43c7dd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1d24('0x0')]},'description':{'type':Sequelize[_0x1d24('0x0')]},'username':{'type':Sequelize[_0x1d24('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1d24('0x0')]},'clientId':{'type':Sequelize[_0x1d24('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1d24('0x1'),_0x1d24('0x2')),'defaultValue':_0x1d24('0x1')}}; \ No newline at end of file +var _0xf168=['newTab','exports','STRING','username','ENUM','integrationTab'];(function(_0x5bf404,_0xe1495b){var _0x551a9e=function(_0x546470){while(--_0x546470){_0x5bf404['push'](_0x5bf404['shift']());}};_0x551a9e(++_0xe1495b);}(_0xf168,0xf1));var _0x8f16=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xf168[_0xffa198];return _0x1e4b50;};'use strict';var Sequelize=require('sequelize');module[_0x8f16('0x0')]={'name':{'type':Sequelize[_0x8f16('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8f16('0x1')],'unique':_0x8f16('0x2')},'remoteUri':{'type':Sequelize[_0x8f16('0x1')]},'password':{'type':Sequelize[_0x8f16('0x1')]},'clientId':{'type':Sequelize[_0x8f16('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8f16('0x3')](_0x8f16('0x4'),_0x8f16('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 15b443d..7a09e0a 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 _0xd7d1=['CallObject','CallType','Priority','Type','isNil','Case','Origin','Reason','Status','IsEscalated','SuppliedName','SuppliedCompany','custom','includes','label','picklistValues','value','boolean','True','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','catch','sendStatus','end','status','count','offset','limit','set','apply','reject','save','update','then','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','destroy','params','findOne','keys','SalesforceConfiguration','filter','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','login','concat','ticketType','sobject','describe','CallDurationInSeconds'];(function(_0x29cce4,_0x379f7c){var _0x1a6616=function(_0x21aadf){while(--_0x21aadf){_0x29cce4['push'](_0x29cce4['shift']());}};_0x1a6616(++_0x379f7c);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xda059f,_0x668bdb){_0xda059f=_0xda059f-0x0;var _0x267e00=_0xd7d1[_0xda059f];return _0x267e00;};'use strict';var pdf=require(_0x1d7d('0x0'));var emlformat=require(_0x1d7d('0x1'));var rimraf=require(_0x1d7d('0x2'));var zipdir=require(_0x1d7d('0x3'));var jsonpatch=require(_0x1d7d('0x4'));var rp=require(_0x1d7d('0x5'));var moment=require(_0x1d7d('0x6'));var BPromise=require(_0x1d7d('0x7'));var Mustache=require(_0x1d7d('0x8'));var util=require(_0x1d7d('0x9'));var path=require(_0x1d7d('0xa'));var sox=require(_0x1d7d('0xb'));var csv=require(_0x1d7d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xc'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1d7d('0x1c'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1d7d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4049be,_0x5dd438,_0x55dba7,_0x1d3822){return new BPromise(function(_0x334e78,_0xe10fdd){var _0x183fc6=_0x1d3822||client;return _0x183fc6[_0x1d7d('0x1e')](_0x4049be,_0x55dba7)['then'](function(_0x28adf3){logger[_0x1d7d('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x5dd438,_0x1d7d('0x20'));logger[_0x1d7d('0x21')](_0x1d7d('0x22'),_0x5dd438,_0x1d7d('0x20'),JSON[_0x1d7d('0x23')](_0x28adf3));if(_0x28adf3['error']){if(_0x28adf3[_0x1d7d('0x24')][_0x1d7d('0x25')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5dd438,_0x28adf3[_0x1d7d('0x24')][_0x1d7d('0x26')]);return _0xe10fdd(_0x28adf3[_0x1d7d('0x24')][_0x1d7d('0x26')]);}logger[_0x1d7d('0x24')](_0x1d7d('0x27'),_0x5dd438,_0x28adf3['error'][_0x1d7d('0x26')]);return _0x334e78(_0x28adf3[_0x1d7d('0x24')][_0x1d7d('0x26')]);}else{logger['info'](_0x1d7d('0x27'),_0x5dd438,_0x1d7d('0x20'));_0x334e78(_0x28adf3['result']['message']);}})[_0x1d7d('0x28')](function(_0x264a4e){logger[_0x1d7d('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x5dd438,_0x264a4e);_0xe10fdd(_0x264a4e);});});}function respondWithStatusCode(_0x377653,_0x106376){_0x106376=_0x106376||0xcc;return function(_0x2d4c0c){if(_0x2d4c0c){return _0x377653[_0x1d7d('0x29')](_0x106376);}return _0x377653['status'](_0x106376)[_0x1d7d('0x2a')]();};}function respondWithResult(_0x151198,_0x5c8257){_0x5c8257=_0x5c8257||0xc8;return function(_0x57bbd8){if(_0x57bbd8){return _0x151198[_0x1d7d('0x2b')](_0x5c8257)['json'](_0x57bbd8);}};}function respondWithFilteredResult(_0x38c323,_0x2d4de4){return function(_0x3bc6e8){if(_0x3bc6e8){var _0x22c40d=_0x3bc6e8[_0x1d7d('0x2c')],_0x465938=_0x2d4de4[_0x1d7d('0x2d')],_0x59f827=_0x2d4de4['offset']+_0x2d4de4[_0x1d7d('0x2e')],_0x1c2616;if(_0x59f827>=_0x22c40d){_0x59f827=_0x22c40d;_0x1c2616=0xc8;}else{_0x1c2616=0xce;}_0x38c323[_0x1d7d('0x2b')](_0x1c2616);return _0x38c323[_0x1d7d('0x2f')]('Content-Range',_0x465938+'-'+_0x59f827+'/'+_0x22c40d)['json'](_0x3bc6e8);}return null;};}function patchUpdates(_0x53e25c){return function(_0x189a6a){try{jsonpatch[_0x1d7d('0x30')](_0x189a6a,_0x53e25c,!![]);}catch(_0x559f19){return BPromise[_0x1d7d('0x31')](_0x559f19);}return _0x189a6a[_0x1d7d('0x32')]();};}function saveUpdates(_0x16a81d,_0x3336ab){return function(_0x342f4e){if(_0x342f4e){return _0x342f4e[_0x1d7d('0x33')](_0x16a81d)[_0x1d7d('0x34')](function(_0x803dc9){return _0x803dc9;});}return null;};}function removeEntity(_0xd701e1,_0x456b56){return function(_0x5b2209){if(_0x5b2209){return _0x5b2209['destroy']()[_0x1d7d('0x34')](function(){_0xd701e1[_0x1d7d('0x2b')](0xcc)[_0x1d7d('0x2a')]();});}};}function handleEntityNotFound(_0x40318f,_0x1d5dc5){return function(_0x16d652){if(!_0x16d652){_0x40318f[_0x1d7d('0x29')](0x194);}return _0x16d652;};}function handleError(_0x40aca9,_0x2fa3f4){_0x2fa3f4=_0x2fa3f4||0x1f4;return function(_0x47b6b2){logger[_0x1d7d('0x24')](_0x47b6b2[_0x1d7d('0x35')]);if(_0x47b6b2[_0x1d7d('0x36')]){delete _0x47b6b2[_0x1d7d('0x36')];}_0x40aca9['status'](_0x2fa3f4)['send'](_0x47b6b2);};}exports[_0x1d7d('0x37')]=function(_0x198a06,_0x520b56){var _0x103c77={},_0x3fea2e={},_0x568092={'count':0x0,'rows':[]};var _0x4cd758=_[_0x1d7d('0x38')](db[_0x1d7d('0x39')][_0x1d7d('0x3a')],function(_0x3f686d){return{'name':_0x3f686d[_0x1d7d('0x3b')],'type':_0x3f686d[_0x1d7d('0x3c')][_0x1d7d('0x3d')]};});_0x3fea2e[_0x1d7d('0x3e')]=_[_0x1d7d('0x38')](_0x4cd758,_0x1d7d('0x36'));_0x3fea2e['query']=_['keys'](_0x198a06['query']);_0x3fea2e['filters']=_[_0x1d7d('0x3f')](_0x3fea2e['model'],_0x3fea2e[_0x1d7d('0x40')]);_0x103c77[_0x1d7d('0x41')]=_[_0x1d7d('0x3f')](_0x3fea2e['model'],qs[_0x1d7d('0x42')](_0x198a06[_0x1d7d('0x40')][_0x1d7d('0x42')]));_0x103c77['attributes']=_0x103c77[_0x1d7d('0x41')][_0x1d7d('0x43')]?_0x103c77[_0x1d7d('0x41')]:_0x3fea2e[_0x1d7d('0x3e')];if(!_0x198a06['query'][_0x1d7d('0x44')](_0x1d7d('0x45'))){_0x103c77[_0x1d7d('0x2e')]=qs[_0x1d7d('0x2e')](_0x198a06['query'][_0x1d7d('0x2e')]);_0x103c77['offset']=qs[_0x1d7d('0x2d')](_0x198a06[_0x1d7d('0x40')][_0x1d7d('0x2d')]);}_0x103c77[_0x1d7d('0x46')]=qs[_0x1d7d('0x47')](_0x198a06['query']['sort']);_0x103c77[_0x1d7d('0x48')]=qs[_0x1d7d('0x49')](_[_0x1d7d('0x4a')](_0x198a06['query'],_0x3fea2e['filters']),_0x4cd758);if(_0x198a06[_0x1d7d('0x40')]['filter']){_0x103c77[_0x1d7d('0x48')]=_[_0x1d7d('0x4b')](_0x103c77[_0x1d7d('0x48')],{'$or':_[_0x1d7d('0x38')](_0x4cd758,function(_0x1e2ea8){if(_0x1e2ea8[_0x1d7d('0x3c')]!==_0x1d7d('0x4c')){var _0x51cb15={};_0x51cb15[_0x1e2ea8[_0x1d7d('0x36')]]={'$like':'%'+_0x198a06[_0x1d7d('0x40')]['filter']+'%'};return _0x51cb15;}})});}_0x103c77=_[_0x1d7d('0x4b')]({},_0x103c77,_0x198a06[_0x1d7d('0x4d')]);var _0x40599b={'where':_0x103c77[_0x1d7d('0x48')]};return db[_0x1d7d('0x39')][_0x1d7d('0x2c')](_0x40599b)[_0x1d7d('0x34')](function(_0x1f7066){_0x568092[_0x1d7d('0x2c')]=_0x1f7066;if(_0x198a06[_0x1d7d('0x40')][_0x1d7d('0x4e')]){_0x103c77[_0x1d7d('0x4f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x1d7d('0x50')](_0x103c77);})['then'](function(_0xbfe60){_0x568092['rows']=_0xbfe60;return _0x568092;})[_0x1d7d('0x34')](respondWithFilteredResult(_0x520b56,_0x103c77))[_0x1d7d('0x28')](handleError(_0x520b56,null));};exports[_0x1d7d('0x51')]=function(_0xf25490,_0x5d0ccd){var _0x2dbb61={'raw':![],'where':{'id':_0xf25490['params']['id']}},_0x5535d4={};_0x5535d4[_0x1d7d('0x3e')]=_['keys'](db['SalesforceAccount'][_0x1d7d('0x3a')]);_0x5535d4[_0x1d7d('0x40')]=_['keys'](_0xf25490[_0x1d7d('0x40')]);_0x5535d4[_0x1d7d('0x49')]=_['intersection'](_0x5535d4[_0x1d7d('0x3e')],_0x5535d4[_0x1d7d('0x40')]);_0x2dbb61[_0x1d7d('0x41')]=_[_0x1d7d('0x3f')](_0x5535d4['model'],qs['fields'](_0xf25490[_0x1d7d('0x40')][_0x1d7d('0x42')]));_0x2dbb61[_0x1d7d('0x41')]=_0x2dbb61[_0x1d7d('0x41')][_0x1d7d('0x43')]?_0x2dbb61['attributes']:_0x5535d4[_0x1d7d('0x3e')];if(_0xf25490[_0x1d7d('0x40')][_0x1d7d('0x4e')]){_0x2dbb61[_0x1d7d('0x4f')]=[{'all':!![]}];}_0x2dbb61=_[_0x1d7d('0x4b')]({},_0x2dbb61,_0xf25490[_0x1d7d('0x4d')]);return db[_0x1d7d('0x39')][_0x1d7d('0x52')](_0x2dbb61)[_0x1d7d('0x34')](handleEntityNotFound(_0x5d0ccd,null))['then'](respondWithResult(_0x5d0ccd,null))[_0x1d7d('0x28')](handleError(_0x5d0ccd,null));};exports[_0x1d7d('0x53')]=function(_0x44b1f7,_0x49c5ad){return db['SalesforceAccount'][_0x1d7d('0x53')](_0x44b1f7[_0x1d7d('0x54')],{})[_0x1d7d('0x34')](respondWithResult(_0x49c5ad,0xc9))['catch'](handleError(_0x49c5ad,null));};exports[_0x1d7d('0x33')]=function(_0xfbb4d4,_0x5eff64){if(_0xfbb4d4[_0x1d7d('0x54')]['id']){delete _0xfbb4d4[_0x1d7d('0x54')]['id'];}return db[_0x1d7d('0x39')][_0x1d7d('0x52')]({'where':{'id':_0xfbb4d4['params']['id']}})[_0x1d7d('0x34')](handleEntityNotFound(_0x5eff64,null))[_0x1d7d('0x34')](saveUpdates(_0xfbb4d4['body'],null))['then'](respondWithResult(_0x5eff64,null))[_0x1d7d('0x28')](handleError(_0x5eff64,null));};exports[_0x1d7d('0x55')]=function(_0x5bee2e,_0x552b8e){return db[_0x1d7d('0x39')][_0x1d7d('0x52')]({'where':{'id':_0x5bee2e[_0x1d7d('0x56')]['id']}})[_0x1d7d('0x34')](handleEntityNotFound(_0x552b8e,null))['then'](removeEntity(_0x552b8e,null))[_0x1d7d('0x28')](handleError(_0x552b8e,null));};exports['getConfigurations']=function(_0x3954e0,_0x1b1d9e,_0x14078d){var _0x5f84fe={};var _0x5a4bd7={};var _0x44c6e4;var _0x1ea966;return db[_0x1d7d('0x39')][_0x1d7d('0x57')]({'where':{'id':_0x3954e0[_0x1d7d('0x56')]['id']}})[_0x1d7d('0x34')](handleEntityNotFound(_0x1b1d9e,null))[_0x1d7d('0x34')](function(_0x2bd2a0){if(_0x2bd2a0){_0x44c6e4=_0x2bd2a0;_0x5a4bd7[_0x1d7d('0x3e')]=_[_0x1d7d('0x58')](db[_0x1d7d('0x59')][_0x1d7d('0x3a')]);_0x5a4bd7[_0x1d7d('0x40')]=_[_0x1d7d('0x58')](_0x3954e0[_0x1d7d('0x40')]);_0x5a4bd7['filters']=_[_0x1d7d('0x3f')](_0x5a4bd7['model'],_0x5a4bd7[_0x1d7d('0x40')]);_0x5f84fe[_0x1d7d('0x41')]=_[_0x1d7d('0x3f')](_0x5a4bd7[_0x1d7d('0x3e')],qs[_0x1d7d('0x42')](_0x3954e0[_0x1d7d('0x40')]['fields']));_0x5f84fe[_0x1d7d('0x41')]=_0x5f84fe[_0x1d7d('0x41')]['length']?_0x5f84fe[_0x1d7d('0x41')]:_0x5a4bd7['model'];_0x5f84fe[_0x1d7d('0x46')]=qs[_0x1d7d('0x47')](_0x3954e0[_0x1d7d('0x40')][_0x1d7d('0x47')]);_0x5f84fe[_0x1d7d('0x48')]=qs[_0x1d7d('0x49')](_['pick'](_0x3954e0[_0x1d7d('0x40')],_0x5a4bd7[_0x1d7d('0x49')]));if(_0x3954e0['query'][_0x1d7d('0x5a')]){_0x5f84fe[_0x1d7d('0x48')]=_[_0x1d7d('0x4b')](_0x5f84fe['where'],{'$or':_[_0x1d7d('0x38')](_0x5f84fe[_0x1d7d('0x41')],function(_0x1038ae){var _0x1938fe={};_0x1938fe[_0x1038ae]={'$like':'%'+_0x3954e0['query'][_0x1d7d('0x5a')]+'%'};return _0x1938fe;})});}_0x5f84fe=_[_0x1d7d('0x4b')]({},_0x5f84fe,_0x3954e0[_0x1d7d('0x4d')]);return _0x44c6e4[_0x1d7d('0x5b')](_0x5f84fe);}})[_0x1d7d('0x34')](function(_0x4a6a24){if(_0x4a6a24){_0x1ea966=_0x4a6a24[_0x1d7d('0x43')];if(!_0x3954e0[_0x1d7d('0x40')]['hasOwnProperty'](_0x1d7d('0x45'))){_0x5f84fe[_0x1d7d('0x2e')]=qs[_0x1d7d('0x2e')](_0x3954e0[_0x1d7d('0x40')]['limit']);_0x5f84fe[_0x1d7d('0x2d')]=qs['offset'](_0x3954e0[_0x1d7d('0x40')][_0x1d7d('0x2d')]);}return _0x44c6e4[_0x1d7d('0x5b')](_0x5f84fe);}})['then'](function(_0x4de5ee){if(_0x4de5ee){return _0x4de5ee?{'count':_0x1ea966,'rows':_0x4de5ee}:null;}})[_0x1d7d('0x34')](respondWithResult(_0x1b1d9e,null))[_0x1d7d('0x28')](handleError(_0x1b1d9e,null));};exports['addConfiguration']=function(_0x45b66d,_0x47c1d5,_0x6e9ee6){if(_0x45b66d[_0x1d7d('0x54')]['id']){delete _0x45b66d[_0x1d7d('0x54')]['id'];}return db[_0x1d7d('0x39')][_0x1d7d('0x57')]({'where':{'id':_0x45b66d[_0x1d7d('0x56')]['id']}})[_0x1d7d('0x34')](handleEntityNotFound(_0x47c1d5,null))[_0x1d7d('0x34')](function(_0xeccc15){if(_0xeccc15){_0x45b66d[_0x1d7d('0x54')][_0x1d7d('0x5c')]=_0xeccc15['id'];_0x45b66d['body']['Subjects']=integrations[_0x1d7d('0x5d')](_0x45b66d[_0x1d7d('0x54')][_0x1d7d('0x5e')],_0x45b66d['body'][_0x1d7d('0x3c')]);_0x45b66d['body'][_0x1d7d('0x5f')]=integrations[_0x1d7d('0x60')](_0x45b66d['body'][_0x1d7d('0x5e')],_0x45b66d[_0x1d7d('0x54')]['type']);return db[_0x1d7d('0x59')][_0x1d7d('0x53')](_0x45b66d[_0x1d7d('0x54')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x1d7d('0x61')],'as':_0x1d7d('0x5f')}]});}return null;})['then'](respondWithResult(_0x47c1d5,null))[_0x1d7d('0x28')](handleError(_0x47c1d5,null));};exports[_0x1d7d('0x62')]=function(_0x268046,_0x429823,_0x5a6f5e){var _0x708306;var _0x392e07='';var _0x22cdd1=_0x1d7d('0x63');return db[_0x1d7d('0x39')][_0x1d7d('0x57')]({'where':{'id':_0x268046[_0x1d7d('0x56')]['id']},'attributes':['id',_0x1d7d('0x64'),_0x1d7d('0x65'),_0x1d7d('0x66'),_0x1d7d('0x67'),_0x1d7d('0x68'),_0x1d7d('0x69')]})['then'](handleEntityNotFound(_0x429823,null))[_0x1d7d('0x34')](function(_0x29d9e6){if(_0x29d9e6){_0x392e07=_0x29d9e6['remoteUri'];var _0x13ae13=_0x392e07[_0x1d7d('0x6a')](-0x1);if(_0x13ae13==='/'){_0x392e07=_0x392e07['substring'](0x0,_0x392e07['lastIndexOf'](_0x13ae13));}_0x708306=new jsforce['Connection']({'oauth2':{'loginUrl':_0x392e07,'clientId':_0x29d9e6[_0x1d7d('0x65')],'clientSecret':_0x29d9e6[_0x1d7d('0x66')]}});return _0x708306[_0x1d7d('0x6b')](_0x29d9e6[_0x1d7d('0x67')],_0x29d9e6['password'][_0x1d7d('0x6c')](_0x29d9e6[_0x1d7d('0x69')]));}})[_0x1d7d('0x34')](function(_0x1d39a9){if(_0x1d39a9){if(!_['isNil'](_0x268046[_0x1d7d('0x40')][_0x1d7d('0x6d')])){_0x22cdd1=_0x268046[_0x1d7d('0x40')][_0x1d7d('0x6d')];}return _0x708306[_0x1d7d('0x6e')](_0x22cdd1)[_0x1d7d('0x6f')]();}})['then'](function(_0x230834){var _0x2d90fb=['CallDisposition',_0x1d7d('0x70'),_0x1d7d('0x71'),_0x1d7d('0x72'),'IsArchived',_0x1d7d('0x73'),'Status',_0x1d7d('0x74')];if(!_[_0x1d7d('0x75')](_0x268046['query'][_0x1d7d('0x6d')])&&_0x268046[_0x1d7d('0x40')][_0x1d7d('0x6d')]===_0x1d7d('0x76')){_0x2d90fb=[_0x1d7d('0x74'),_0x1d7d('0x77'),_0x1d7d('0x78'),_0x1d7d('0x79'),_0x1d7d('0x73'),_0x1d7d('0x7a'),_0x1d7d('0x7b'),_0x1d7d('0x7c')];}if(_0x230834){_['remove'](_0x230834['fields'],function(_0xb061a5){return _0xb061a5[_0x1d7d('0x7d')]===![]&&!_0x2d90fb[_0x1d7d('0x7e')](_0xb061a5[_0x1d7d('0x36')]);});return{'count':_0x230834[_0x1d7d('0x42')][_0x1d7d('0x43')],'rows':_[_0x1d7d('0x38')](_0x230834[_0x1d7d('0x42')],function(_0x345c54){return{'id':_0x345c54[_0x1d7d('0x36')],'name':_0x345c54[_0x1d7d('0x7f')],'custom':_0x345c54[_0x1d7d('0x7d')],'options':_0x345c54['picklistValues'][_0x1d7d('0x43')]>0x0?_[_0x1d7d('0x38')](_0x345c54[_0x1d7d('0x80')],function(_0x1258e0){return{'name':_0x1258e0['label'],'value':_0x1258e0[_0x1d7d('0x81')]};}):_0x345c54[_0x1d7d('0x3c')]==_0x1d7d('0x82')?[{'name':_0x1d7d('0x83'),'value':'true'},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x429823,null))[_0x1d7d('0x28')](function(_0x1d2df4){var _0x5e89da=_0x268046['query'][_0x1d7d('0x84')]?0x1f4:_0x1d2df4[_0x1d7d('0x85')]||0x1f4;logger[_0x1d7d('0x24')](_0x1d7d('0x86'),_0x1d7d('0x62'),_0x5e89da,JSON[_0x1d7d('0x23')](_0x1d2df4));delete _0x1d2df4[_0x1d7d('0x36')];if(_0x5e89da===0x191){_0x5e89da=0x190;}_0x429823[_0x1d7d('0x2b')](_0x5e89da)[_0x1d7d('0x87')](_0x268046[_0x1d7d('0x40')]['test']?{'message':_0x1d7d('0x88'),'statusCode':_0x1d2df4['statusCode']}:_0x1d2df4);});}; \ No newline at end of file +var _0xb10b=['Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','describe','CallObject','CallType','IsArchived','Priority','Type','Origin','Reason','IsEscalated','remove','includes','label','picklistValues','value','boolean','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','index','SalesforceAccount','rawAttributes','fieldName','type','key','map','filters','intersection','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','show','params','keys','length','includeAll','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','pick','AccountId','channel','Descriptions','SalesforceField','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bee7a,_0xacfa2a){_0x1bee7a=_0x1bee7a-0x0;var _0x5d69d7=_0xb10b[_0x1bee7a];return _0x5d69d7;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x18'))['db'];var integrations=require(_0xbb10('0x19'));var jayson=require(_0xbb10('0x1a'));var client=jayson[_0xbb10('0x1b')][_0xbb10('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x147230,_0x58a612,_0x26e021,_0x42d7e4){return new BPromise(function(_0x45b9d6,_0x17fd46){var _0x3df17b=_0x42d7e4||client;return _0x3df17b[_0xbb10('0x1d')](_0x147230,_0x26e021)[_0xbb10('0x1e')](function(_0x36b5e8){logger[_0xbb10('0x1f')](_0xbb10('0x20'),_0x58a612,'request\x20sent');logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x58a612,_0xbb10('0x23'),JSON[_0xbb10('0x24')](_0x36b5e8));if(_0x36b5e8[_0xbb10('0x25')]){if(_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x26')]===0x1f4){logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x36b5e8[_0xbb10('0x25')]['message']);return _0x17fd46(_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x27')]);}logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x27')]);return _0x45b9d6(_0x36b5e8['error'][_0xbb10('0x27')]);}else{logger[_0xbb10('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x58a612,'request\x20sent');_0x45b9d6(_0x36b5e8[_0xbb10('0x28')][_0xbb10('0x27')]);}})[_0xbb10('0x29')](function(_0x317da4){logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x317da4);_0x17fd46(_0x317da4);});});}function respondWithStatusCode(_0x407cb4,_0x436104){_0x436104=_0x436104||0xcc;return function(_0x7f2377){if(_0x7f2377){return _0x407cb4[_0xbb10('0x2a')](_0x436104);}return _0x407cb4[_0xbb10('0x2b')](_0x436104)[_0xbb10('0x2c')]();};}function respondWithResult(_0x537898,_0x4fedac){_0x4fedac=_0x4fedac||0xc8;return function(_0x4fb5e0){if(_0x4fb5e0){return _0x537898[_0xbb10('0x2b')](_0x4fedac)[_0xbb10('0x2d')](_0x4fb5e0);}};}function respondWithFilteredResult(_0x2c89b9,_0x4e25ff){return function(_0x2fdde9){if(_0x2fdde9){var _0x24d586=_0x2fdde9[_0xbb10('0x2e')],_0x6ed43b=_0x4e25ff[_0xbb10('0x2f')],_0x1d5e95=_0x4e25ff['offset']+_0x4e25ff[_0xbb10('0x30')],_0x1acce9;if(_0x1d5e95>=_0x24d586){_0x1d5e95=_0x24d586;_0x1acce9=0xc8;}else{_0x1acce9=0xce;}_0x2c89b9[_0xbb10('0x2b')](_0x1acce9);return _0x2c89b9[_0xbb10('0x31')](_0xbb10('0x32'),_0x6ed43b+'-'+_0x1d5e95+'/'+_0x24d586)[_0xbb10('0x2d')](_0x2fdde9);}return null;};}function patchUpdates(_0x2ff4c1){return function(_0x5d5c80){try{jsonpatch[_0xbb10('0x33')](_0x5d5c80,_0x2ff4c1,!![]);}catch(_0x4ee02e){return BPromise[_0xbb10('0x34')](_0x4ee02e);}return _0x5d5c80['save']();};}function saveUpdates(_0x16ad2a,_0x1dcc9c){return function(_0x1b59f9){if(_0x1b59f9){return _0x1b59f9['update'](_0x16ad2a)['then'](function(_0x4c3744){return _0x4c3744;});}return null;};}function removeEntity(_0x34f65e,_0x4f590d){return function(_0x359ad4){if(_0x359ad4){return _0x359ad4[_0xbb10('0x35')]()[_0xbb10('0x1e')](function(){_0x34f65e[_0xbb10('0x2b')](0xcc)[_0xbb10('0x2c')]();});}};}function handleEntityNotFound(_0x138bc6,_0xf85197){return function(_0x4975f5){if(!_0x4975f5){_0x138bc6[_0xbb10('0x2a')](0x194);}return _0x4975f5;};}function handleError(_0x1da9c9,_0x441d15){_0x441d15=_0x441d15||0x1f4;return function(_0x8c1ce6){logger[_0xbb10('0x25')](_0x8c1ce6[_0xbb10('0x36')]);if(_0x8c1ce6[_0xbb10('0x37')]){delete _0x8c1ce6[_0xbb10('0x37')];}_0x1da9c9[_0xbb10('0x2b')](_0x441d15)['send'](_0x8c1ce6);};}exports[_0xbb10('0x38')]=function(_0x150107,_0x1ddd9e){var _0x3c3c45={},_0x570f5a={},_0x111762={'count':0x0,'rows':[]};var _0x5de37b=_['map'](db[_0xbb10('0x39')][_0xbb10('0x3a')],function(_0x26e76a){return{'name':_0x26e76a[_0xbb10('0x3b')],'type':_0x26e76a[_0xbb10('0x3c')][_0xbb10('0x3d')]};});_0x570f5a['model']=_[_0xbb10('0x3e')](_0x5de37b,_0xbb10('0x37'));_0x570f5a['query']=_['keys'](_0x150107['query']);_0x570f5a[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x570f5a[_0xbb10('0x41')],_0x570f5a['query']);_0x3c3c45[_0xbb10('0x42')]=_[_0xbb10('0x40')](_0x570f5a[_0xbb10('0x41')],qs['fields'](_0x150107[_0xbb10('0x43')][_0xbb10('0x44')]));_0x3c3c45[_0xbb10('0x42')]=_0x3c3c45[_0xbb10('0x42')]['length']?_0x3c3c45[_0xbb10('0x42')]:_0x570f5a[_0xbb10('0x41')];if(!_0x150107['query'][_0xbb10('0x45')](_0xbb10('0x46'))){_0x3c3c45[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x150107[_0xbb10('0x43')][_0xbb10('0x30')]);_0x3c3c45['offset']=qs[_0xbb10('0x2f')](_0x150107[_0xbb10('0x43')][_0xbb10('0x2f')]);}_0x3c3c45[_0xbb10('0x47')]=qs['sort'](_0x150107[_0xbb10('0x43')][_0xbb10('0x48')]);_0x3c3c45[_0xbb10('0x49')]=qs[_0xbb10('0x3f')](_['pick'](_0x150107[_0xbb10('0x43')],_0x570f5a[_0xbb10('0x3f')]),_0x5de37b);if(_0x150107['query']['filter']){_0x3c3c45[_0xbb10('0x49')]=_['merge'](_0x3c3c45[_0xbb10('0x49')],{'$or':_[_0xbb10('0x3e')](_0x5de37b,function(_0x4c66d8){if(_0x4c66d8[_0xbb10('0x3c')]!==_0xbb10('0x4a')){var _0x474e99={};_0x474e99[_0x4c66d8['name']]={'$like':'%'+_0x150107[_0xbb10('0x43')][_0xbb10('0x4b')]+'%'};return _0x474e99;}})});}_0x3c3c45=_[_0xbb10('0x4c')]({},_0x3c3c45,_0x150107[_0xbb10('0x4d')]);var _0x36e1fa={'where':_0x3c3c45[_0xbb10('0x49')]};return db[_0xbb10('0x39')][_0xbb10('0x2e')](_0x36e1fa)[_0xbb10('0x1e')](function(_0x43b948){_0x111762[_0xbb10('0x2e')]=_0x43b948;if(_0x150107[_0xbb10('0x43')]['includeAll']){_0x3c3c45[_0xbb10('0x4e')]=[{'all':!![]}];}return db[_0xbb10('0x39')]['findAll'](_0x3c3c45);})[_0xbb10('0x1e')](function(_0x2f5027){_0x111762[_0xbb10('0x4f')]=_0x2f5027;return _0x111762;})[_0xbb10('0x1e')](respondWithFilteredResult(_0x1ddd9e,_0x3c3c45))[_0xbb10('0x29')](handleError(_0x1ddd9e,null));};exports[_0xbb10('0x50')]=function(_0x3e06b0,_0x5be85e){var _0x4a9793={'raw':![],'where':{'id':_0x3e06b0[_0xbb10('0x51')]['id']}},_0xcb3354={};_0xcb3354[_0xbb10('0x41')]=_['keys'](db['SalesforceAccount'][_0xbb10('0x3a')]);_0xcb3354[_0xbb10('0x43')]=_[_0xbb10('0x52')](_0x3e06b0[_0xbb10('0x43')]);_0xcb3354[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0xcb3354[_0xbb10('0x41')],_0xcb3354[_0xbb10('0x43')]);_0x4a9793[_0xbb10('0x42')]=_[_0xbb10('0x40')](_0xcb3354['model'],qs['fields'](_0x3e06b0[_0xbb10('0x43')][_0xbb10('0x44')]));_0x4a9793[_0xbb10('0x42')]=_0x4a9793[_0xbb10('0x42')][_0xbb10('0x53')]?_0x4a9793[_0xbb10('0x42')]:_0xcb3354[_0xbb10('0x41')];if(_0x3e06b0[_0xbb10('0x43')][_0xbb10('0x54')]){_0x4a9793[_0xbb10('0x4e')]=[{'all':!![]}];}_0x4a9793=_[_0xbb10('0x4c')]({},_0x4a9793,_0x3e06b0[_0xbb10('0x4d')]);return db[_0xbb10('0x39')][_0xbb10('0x55')](_0x4a9793)[_0xbb10('0x1e')](handleEntityNotFound(_0x5be85e,null))['then'](respondWithResult(_0x5be85e,null))[_0xbb10('0x29')](handleError(_0x5be85e,null));};exports['create']=function(_0x33d60a,_0x2e21a0){return db[_0xbb10('0x39')][_0xbb10('0x56')](_0x33d60a[_0xbb10('0x57')],{})[_0xbb10('0x1e')](respondWithResult(_0x2e21a0,0xc9))[_0xbb10('0x29')](handleError(_0x2e21a0,null));};exports[_0xbb10('0x58')]=function(_0x180400,_0x3d71e){if(_0x180400[_0xbb10('0x57')]['id']){delete _0x180400[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x55')]({'where':{'id':_0x180400[_0xbb10('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d71e,null))[_0xbb10('0x1e')](saveUpdates(_0x180400[_0xbb10('0x57')],null))[_0xbb10('0x1e')](respondWithResult(_0x3d71e,null))[_0xbb10('0x29')](handleError(_0x3d71e,null));};exports[_0xbb10('0x35')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x39')][_0xbb10('0x55')]({'where':{'id':_0x379d8c[_0xbb10('0x51')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x4bedd0,null))[_0xbb10('0x1e')](removeEntity(_0x4bedd0,null))[_0xbb10('0x29')](handleError(_0x4bedd0,null));};exports[_0xbb10('0x59')]=function(_0x12ec18,_0x205e01,_0x40c4fb){var _0x2eb05a={};var _0x2a1ce1={};var _0x16932f;var _0x4e7fac;return db['SalesforceAccount'][_0xbb10('0x5a')]({'where':{'id':_0x12ec18[_0xbb10('0x51')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x205e01,null))[_0xbb10('0x1e')](function(_0x5573bb){if(_0x5573bb){_0x16932f=_0x5573bb;_0x2a1ce1['model']=_[_0xbb10('0x52')](db[_0xbb10('0x5b')][_0xbb10('0x3a')]);_0x2a1ce1[_0xbb10('0x43')]=_[_0xbb10('0x52')](_0x12ec18[_0xbb10('0x43')]);_0x2a1ce1[_0xbb10('0x3f')]=_['intersection'](_0x2a1ce1[_0xbb10('0x41')],_0x2a1ce1[_0xbb10('0x43')]);_0x2eb05a['attributes']=_['intersection'](_0x2a1ce1['model'],qs[_0xbb10('0x44')](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x44')]));_0x2eb05a['attributes']=_0x2eb05a['attributes']['length']?_0x2eb05a[_0xbb10('0x42')]:_0x2a1ce1[_0xbb10('0x41')];_0x2eb05a[_0xbb10('0x47')]=qs['sort'](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x48')]);_0x2eb05a['where']=qs['filters'](_[_0xbb10('0x5c')](_0x12ec18[_0xbb10('0x43')],_0x2a1ce1[_0xbb10('0x3f')]));if(_0x12ec18[_0xbb10('0x43')]['filter']){_0x2eb05a[_0xbb10('0x49')]=_[_0xbb10('0x4c')](_0x2eb05a[_0xbb10('0x49')],{'$or':_['map'](_0x2eb05a[_0xbb10('0x42')],function(_0x2f05bc){var _0x3e3617={};_0x3e3617[_0x2f05bc]={'$like':'%'+_0x12ec18['query'][_0xbb10('0x4b')]+'%'};return _0x3e3617;})});}_0x2eb05a=_[_0xbb10('0x4c')]({},_0x2eb05a,_0x12ec18[_0xbb10('0x4d')]);return _0x16932f[_0xbb10('0x59')](_0x2eb05a);}})['then'](function(_0x251417){if(_0x251417){_0x4e7fac=_0x251417[_0xbb10('0x53')];if(!_0x12ec18[_0xbb10('0x43')][_0xbb10('0x45')]('nolimit')){_0x2eb05a[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x30')]);_0x2eb05a[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x12ec18[_0xbb10('0x43')]['offset']);}return _0x16932f['getConfigurations'](_0x2eb05a);}})['then'](function(_0xdfbc0b){if(_0xdfbc0b){return _0xdfbc0b?{'count':_0x4e7fac,'rows':_0xdfbc0b}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x205e01,null))[_0xbb10('0x29')](handleError(_0x205e01,null));};exports['addConfiguration']=function(_0x5cd089,_0x46f462,_0x1b11c0){if(_0x5cd089[_0xbb10('0x57')]['id']){delete _0x5cd089[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x5a')]({'where':{'id':_0x5cd089['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x46f462,null))[_0xbb10('0x1e')](function(_0x270fdb){if(_0x270fdb){_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5d')]=_0x270fdb['id'];_0x5cd089['body']['Subjects']=integrations['getSubjects'](_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5e')],_0x5cd089[_0xbb10('0x57')][_0xbb10('0x3c')]);_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5f')]=integrations['getDescriptions'](_0x5cd089[_0xbb10('0x57')]['channel'],_0x5cd089['body']['type']);return db[_0xbb10('0x5b')][_0xbb10('0x56')](_0x5cd089[_0xbb10('0x57')],{'include':[{'model':db[_0xbb10('0x60')],'as':'Subjects'},{'model':db[_0xbb10('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x46f462,null))[_0xbb10('0x29')](handleError(_0x46f462,null));};exports[_0xbb10('0x61')]=function(_0x29529c,_0x2bd2ab,_0xfa3c7c){var _0x4fccc5;var _0x2d52ea='';var _0x19fcec=_0xbb10('0x62');return db[_0xbb10('0x39')][_0xbb10('0x5a')]({'where':{'id':_0x29529c[_0xbb10('0x51')]['id']},'attributes':['id',_0xbb10('0x63'),'clientId',_0xbb10('0x64'),_0xbb10('0x65'),_0xbb10('0x66'),_0xbb10('0x67')]})[_0xbb10('0x1e')](handleEntityNotFound(_0x2bd2ab,null))[_0xbb10('0x1e')](function(_0xa3b23){if(_0xa3b23){_0x2d52ea=_0xa3b23[_0xbb10('0x63')];var _0x5a4429=_0x2d52ea[_0xbb10('0x68')](-0x1);if(_0x5a4429==='/'){_0x2d52ea=_0x2d52ea[_0xbb10('0x69')](0x0,_0x2d52ea[_0xbb10('0x6a')](_0x5a4429));}_0x4fccc5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2d52ea,'clientId':_0xa3b23['clientId'],'clientSecret':_0xa3b23['clientSecret']}});return _0x4fccc5[_0xbb10('0x6b')](_0xa3b23['username'],_0xa3b23['password'][_0xbb10('0x6c')](_0xa3b23[_0xbb10('0x67')]));}})[_0xbb10('0x1e')](function(_0x12ed63){if(_0x12ed63){if(!_[_0xbb10('0x6d')](_0x29529c[_0xbb10('0x43')][_0xbb10('0x6e')])){_0x19fcec=_0x29529c[_0xbb10('0x43')][_0xbb10('0x6e')];}return _0x4fccc5['sobject'](_0x19fcec)[_0xbb10('0x6f')]();}})[_0xbb10('0x1e')](function(_0x46b6d2){var _0x35b811=['CallDisposition','CallDurationInSeconds',_0xbb10('0x70'),_0xbb10('0x71'),_0xbb10('0x72'),_0xbb10('0x73'),'Status',_0xbb10('0x74')];if(!_[_0xbb10('0x6d')](_0x29529c[_0xbb10('0x43')][_0xbb10('0x6e')])&&_0x29529c[_0xbb10('0x43')]['ticketType']==='Case'){_0x35b811=[_0xbb10('0x74'),_0xbb10('0x75'),_0xbb10('0x76'),'Status',_0xbb10('0x73'),_0xbb10('0x77'),'SuppliedName','SuppliedCompany'];}if(_0x46b6d2){_[_0xbb10('0x78')](_0x46b6d2[_0xbb10('0x44')],function(_0x177f77){return _0x177f77['custom']===![]&&!_0x35b811[_0xbb10('0x79')](_0x177f77[_0xbb10('0x37')]);});return{'count':_0x46b6d2[_0xbb10('0x44')][_0xbb10('0x53')],'rows':_[_0xbb10('0x3e')](_0x46b6d2[_0xbb10('0x44')],function(_0x45bd4e){return{'id':_0x45bd4e[_0xbb10('0x37')],'name':_0x45bd4e[_0xbb10('0x7a')],'custom':_0x45bd4e['custom'],'options':_0x45bd4e[_0xbb10('0x7b')][_0xbb10('0x53')]>0x0?_[_0xbb10('0x3e')](_0x45bd4e[_0xbb10('0x7b')],function(_0x3e3083){return{'name':_0x3e3083[_0xbb10('0x7a')],'value':_0x3e3083[_0xbb10('0x7c')]};}):_0x45bd4e[_0xbb10('0x3c')]==_0xbb10('0x7d')?[{'name':_0xbb10('0x7e'),'value':_0xbb10('0x7f')},{'name':_0xbb10('0x80'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x2bd2ab,null))[_0xbb10('0x29')](function(_0x3fa344){var _0x458615=_0x29529c[_0xbb10('0x43')][_0xbb10('0x81')]?0x1f4:_0x3fa344['statusCode']||0x1f4;logger[_0xbb10('0x25')](_0xbb10('0x82'),_0xbb10('0x61'),_0x458615,JSON[_0xbb10('0x24')](_0x3fa344));delete _0x3fa344[_0xbb10('0x37')];if(_0x458615===0x191){_0x458615=0x190;}_0x2bd2ab[_0xbb10('0x2b')](_0x458615)['send'](_0x29529c[_0xbb10('0x43')][_0xbb10('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x3fa344[_0xbb10('0x83')]}:_0x3fa344);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 36578c2..3b56f78 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 _0x9ab9=['path','rimraf','./intSalesforceAccount.attributes','exports','SalesforceAccount','lodash','bluebird','request-promise'];(function(_0x12cff1,_0x6b43aa){var _0x73bbca=function(_0x1715b7){while(--_0x1715b7){_0x12cff1['push'](_0x12cff1['shift']());}};_0x73bbca(++_0x6b43aa);}(_0x9ab9,0x165));var _0x99ab=function(_0x4d6ff7,_0x518e57){_0x4d6ff7=_0x4d6ff7-0x0;var _0x40902c=_0x9ab9[_0x4d6ff7];return _0x40902c;};'use strict';var _=require(_0x99ab('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x99ab('0x1'));var rp=require(_0x99ab('0x2'));var fs=require('fs');var path=require(_0x99ab('0x3'));var rimraf=require(_0x99ab('0x4'));var config=require('../../config/environment');var attributes=require(_0x99ab('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x99ab('0x6')]=function(_0x51ed4f,_0x420713){return _0x51ed4f['define'](_0x99ab('0x7'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1898=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x42294b,_0x78fbc){var _0x2537d4=function(_0x572689){while(--_0x572689){_0x42294b['push'](_0x42294b['shift']());}};_0x2537d4(++_0x78fbc);}(_0x1898,0x73));var _0x8189=function(_0x21a61c,_0x31fd2a){_0x21a61c=_0x21a61c-0x0;var _0x3bf150=_0x1898[_0x21a61c];return _0x3bf150;};'use strict';var _=require(_0x8189('0x0'));var util=require(_0x8189('0x1'));var logger=require(_0x8189('0x2'))('api');var moment=require(_0x8189('0x3'));var BPromise=require(_0x8189('0x4'));var rp=require(_0x8189('0x5'));var fs=require('fs');var path=require(_0x8189('0x6'));var rimraf=require(_0x8189('0x7'));var config=require(_0x8189('0x8'));var attributes=require(_0x8189('0x9'));var integrations=require(_0x8189('0xa'));module[_0x8189('0xb')]=function(_0x4fe456,_0x4ede5f){return _0x4fe456[_0x8189('0xc')](_0x8189('0xd'),attributes,{'tableName':_0x8189('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e9b2724..e9cd9c3 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 _0x57d4=['catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','model','map','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info'];(function(_0x3b6a09,_0x5826de){var _0x3cc0b9=function(_0x26a5cf){while(--_0x26a5cf){_0x3b6a09['push'](_0x3b6a09['shift']());}};_0x3cc0b9(++_0x5826de);}(_0x57d4,0x78));var _0x457d=function(_0x559af3,_0x1d0afb){_0x559af3=_0x559af3-0x0;var _0xe0dc06=_0x57d4[_0x559af3];return _0xe0dc06;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6816,_0x1fc199,_0x381e22){return new BPromise(function(_0x4e32c0,_0x5dff56){return client[_0x457d('0xd')](_0x5c6816,_0x381e22)[_0x457d('0xe')](function(_0x127b89){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1fc199,'request\x20sent');logger[_0x457d('0xf')](_0x457d('0x10'),_0x1fc199,_0x457d('0x11'),JSON[_0x457d('0x12')](_0x127b89));if(_0x127b89[_0x457d('0x13')]){if(_0x127b89[_0x457d('0x13')][_0x457d('0x14')]===0x1f4){logger[_0x457d('0x13')](_0x457d('0x15'),_0x1fc199,_0x127b89['error'][_0x457d('0x16')]);return _0x5dff56(_0x127b89[_0x457d('0x13')]['message']);}logger['error'](_0x457d('0x15'),_0x1fc199,_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);return _0x4e32c0(_0x127b89[_0x457d('0x13')][_0x457d('0x16')]);}else{logger[_0x457d('0x17')](_0x457d('0x15'),_0x1fc199,_0x457d('0x11'));_0x4e32c0(_0x127b89['result'][_0x457d('0x16')]);}})[_0x457d('0x18')](function(_0x2c05ca){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1fc199,_0x2c05ca);_0x5dff56(_0x2c05ca);});});}exports[_0x457d('0x19')]=function(_0x4d988f){var _0x151416=this;return new Promise(function(_0x802f2b,_0x50e78f){return db[_0x457d('0x1a')]['findAll']({'raw':_0x4d988f['options']?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1d')]||null:null,'attributes':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')][_0x457d('0x1e')]||null:null,'limit':_0x4d988f[_0x457d('0x1b')]?_0x4d988f[_0x457d('0x1b')]['limit']||null:null,'include':_0x4d988f['options']?_0x4d988f['options'][_0x457d('0x1f')]?_['map'](_0x4d988f['options']['include'],function(_0x206fdc){return{'model':db[_0x206fdc[_0x457d('0x20')]],'as':_0x206fdc['as'],'attributes':_0x206fdc['attributes'],'include':_0x206fdc[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x206fdc[_0x457d('0x1f')],function(_0x152cfc){return{'model':db[_0x152cfc['model']],'as':_0x152cfc['as'],'attributes':_0x152cfc['attributes'],'include':_0x152cfc[_0x457d('0x1f')]?_['map'](_0x152cfc[_0x457d('0x1f')],function(_0x21a102){return{'model':db[_0x21a102[_0x457d('0x20')]],'as':_0x21a102['as'],'attributes':_0x21a102[_0x457d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x298dd4){logger['info']('GetSalesforceAccount',_0x4d988f);logger[_0x457d('0xf')](_0x457d('0x19'),_0x4d988f,JSON['stringify'](_0x298dd4));_0x802f2b(_0x298dd4);})[_0x457d('0x18')](function(_0x2d69d2){logger['error'](_0x457d('0x19'),_0x2d69d2[_0x457d('0x16')],_0x4d988f);_0x50e78f(_0x151416[_0x457d('0x13')](0x1f4,_0x2d69d2[_0x457d('0x16')]));});});};exports[_0x457d('0x22')]=function(_0x1efd5f){var _0x397f54=this;return new Promise(function(_0x123b58,_0x272d40){return db[_0x457d('0x1a')][_0x457d('0x23')]({'raw':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f[_0x457d('0x1b')][_0x457d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f[_0x457d('0x1b')][_0x457d('0x1d')]||null:null,'attributes':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f['options'][_0x457d('0x1e')]||null:null,'include':_0x1efd5f[_0x457d('0x1b')]?_0x1efd5f['options']['include']?_[_0x457d('0x21')](_0x1efd5f[_0x457d('0x1b')]['include'],function(_0x306ece){return{'model':db[_0x306ece[_0x457d('0x20')]],'as':_0x306ece['as'],'attributes':_0x306ece[_0x457d('0x1e')],'include':_0x306ece[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x306ece[_0x457d('0x1f')],function(_0x17f011){return{'model':db[_0x17f011[_0x457d('0x20')]],'as':_0x17f011['as'],'attributes':_0x17f011[_0x457d('0x1e')],'include':_0x17f011[_0x457d('0x1f')]?_[_0x457d('0x21')](_0x17f011[_0x457d('0x1f')],function(_0x237be1){return{'model':db[_0x237be1[_0x457d('0x20')]],'as':_0x237be1['as'],'attributes':_0x237be1[_0x457d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27811b){logger['info']('ShowSalesforceAccount',_0x1efd5f);logger['debug'](_0x457d('0x22'),_0x1efd5f,JSON['stringify'](_0x27811b));_0x123b58(_0x27811b);})[_0x457d('0x18')](function(_0x55e580){logger['error'](_0x457d('0x22'),_0x55e580[_0x457d('0x16')],_0x1efd5f);_0x272d40(_0x397f54[_0x457d('0x13')](0x1f4,_0x55e580[_0x457d('0x16')]));});});}; \ No newline at end of file +var _0x9f62=['limit','include','model','map','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','find','then','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes'];(function(_0x1106ed,_0xe6b37d){var _0x3ed57b=function(_0x1d4ee0){while(--_0x1d4ee0){_0x1106ed['push'](_0x1106ed['shift']());}};_0x3ed57b(++_0xe6b37d);}(_0x9f62,0x154));var _0x29f6=function(_0x2e5d8f,_0x5c937d){_0x2e5d8f=_0x2e5d8f-0x0;var _0x58db23=_0x9f62[_0x2e5d8f];return _0x58db23;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});}exports['GetSalesforceAccount']=function(_0x2e66d3){var _0x3af478=this;return new Promise(function(_0xb31436,_0x5c8246){return db[_0x29f6('0x11')][_0x29f6('0x12')]({'raw':_0x2e66d3['options']?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x14')]===undefined?!![]:![]:!![],'where':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x15')]||null:null,'attributes':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3['options'][_0x29f6('0x16')]||null:null,'limit':_0x2e66d3['options']?_0x2e66d3['options'][_0x29f6('0x17')]||null:null,'include':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x18')]?_['map'](_0x2e66d3[_0x29f6('0x13')]['include'],function(_0xd4179c){return{'model':db[_0xd4179c[_0x29f6('0x19')]],'as':_0xd4179c['as'],'attributes':_0xd4179c[_0x29f6('0x16')],'include':_0xd4179c[_0x29f6('0x18')]?_['map'](_0xd4179c[_0x29f6('0x18')],function(_0x4d494f){return{'model':db[_0x4d494f['model']],'as':_0x4d494f['as'],'attributes':_0x4d494f[_0x29f6('0x16')],'include':_0x4d494f[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x4d494f[_0x29f6('0x18')],function(_0x84ccb7){return{'model':db[_0x84ccb7[_0x29f6('0x19')]],'as':_0x84ccb7['as'],'attributes':_0x84ccb7[_0x29f6('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2183b7){logger[_0x29f6('0x9')](_0x29f6('0x1b'),_0x2e66d3);logger[_0x29f6('0x1c')](_0x29f6('0x1b'),_0x2e66d3,JSON[_0x29f6('0x1d')](_0x2183b7));_0xb31436(_0x2183b7);})[_0x29f6('0x10')](function(_0x17b2f2){logger[_0x29f6('0xd')](_0x29f6('0x1b'),_0x17b2f2[_0x29f6('0xe')],_0x2e66d3);_0x5c8246(_0x3af478[_0x29f6('0xd')](0x1f4,_0x17b2f2[_0x29f6('0xe')]));});});};exports[_0x29f6('0x1e')]=function(_0x375564){var _0x218931=this;return new Promise(function(_0x3a7249,_0x5492c2){return db['SalesforceAccount'][_0x29f6('0x1f')]({'raw':_0x375564['options']?_0x375564[_0x29f6('0x13')][_0x29f6('0x14')]===undefined?!![]:![]:!![],'where':_0x375564[_0x29f6('0x13')]?_0x375564[_0x29f6('0x13')]['where']||null:null,'attributes':_0x375564['options']?_0x375564[_0x29f6('0x13')][_0x29f6('0x16')]||null:null,'include':_0x375564[_0x29f6('0x13')]?_0x375564[_0x29f6('0x13')][_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x375564[_0x29f6('0x13')][_0x29f6('0x18')],function(_0xad83a3){return{'model':db[_0xad83a3[_0x29f6('0x19')]],'as':_0xad83a3['as'],'attributes':_0xad83a3[_0x29f6('0x16')],'include':_0xad83a3[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0xad83a3[_0x29f6('0x18')],function(_0x4e6304){return{'model':db[_0x4e6304['model']],'as':_0x4e6304['as'],'attributes':_0x4e6304[_0x29f6('0x16')],'include':_0x4e6304[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x4e6304['include'],function(_0x3e1e25){return{'model':db[_0x3e1e25[_0x29f6('0x19')]],'as':_0x3e1e25['as'],'attributes':_0x3e1e25[_0x29f6('0x16')]};}):[]};}):[]};}):[]:[]})[_0x29f6('0x20')](function(_0x1d2b3c){logger['info'](_0x29f6('0x1e'),_0x375564);logger[_0x29f6('0x1c')](_0x29f6('0x1e'),_0x375564,JSON[_0x29f6('0x1d')](_0x1d2b3c));_0x3a7249(_0x1d2b3c);})['catch'](function(_0x30d747){logger[_0x29f6('0xd')](_0x29f6('0x1e'),_0x30d747[_0x29f6('0xe')],_0x375564);_0x5492c2(_0x218931['error'](0x1f4,_0x30d747['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b5d21cc..1e55a04 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 _0xd724=['/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index'];(function(_0x22eb60,_0x5239e3){var _0x51f15f=function(_0x1d3a76){while(--_0x1d3a76){_0x22eb60['push'](_0x22eb60['shift']());}};_0x51f15f(++_0x5239e3);}(_0xd724,0xb1));var _0x4d72=function(_0x10c05d,_0x3b50da){_0x10c05d=_0x10c05d-0x0;var _0x5edd78=_0xd724[_0x10c05d];return _0x5edd78;};'use strict';var multer=require(_0x4d72('0x0'));var util=require(_0x4d72('0x1'));var path=require(_0x4d72('0x2'));var timeout=require(_0x4d72('0x3'));var express=require(_0x4d72('0x4'));var router=express[_0x4d72('0x5')]();var auth=require(_0x4d72('0x6'));var interaction=require(_0x4d72('0x7'));var config=require(_0x4d72('0x8'));var controller=require(_0x4d72('0x9'));router[_0x4d72('0xa')]('/',auth['isAuthenticated'](),controller[_0x4d72('0xb')]);router[_0x4d72('0xa')](_0x4d72('0xc'),auth[_0x4d72('0xd')](),controller[_0x4d72('0xe')]);router['get']('/:id/fields',auth[_0x4d72('0xd')](),controller[_0x4d72('0xf')]);router['get'](_0x4d72('0x10'),auth[_0x4d72('0xd')](),controller[_0x4d72('0x11')]);router[_0x4d72('0xa')](_0x4d72('0x12'),auth[_0x4d72('0xd')](),controller[_0x4d72('0x13')]);router[_0x4d72('0x14')]('/',auth['isAuthenticated'](),controller[_0x4d72('0x15')]);router[_0x4d72('0x16')]('/:id',auth[_0x4d72('0xd')](),controller[_0x4d72('0x17')]);router[_0x4d72('0x18')](_0x4d72('0xc'),auth[_0x4d72('0xd')](),controller[_0x4d72('0x19')]);module[_0x4d72('0x1a')]=router; \ No newline at end of file +var _0x3867=['exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects','post','create','update','delete','destroy'];(function(_0x413c36,_0x4d5b2d){var _0x5052de=function(_0x5a8d2d){while(--_0x5a8d2d){_0x413c36['push'](_0x413c36['shift']());}};_0x5052de(++_0x4d5b2d);}(_0x3867,0x1e7));var _0x7386=function(_0x2a52af,_0x4794be){_0x2a52af=_0x2a52af-0x0;var _0x506694=_0x3867[_0x2a52af];return _0x506694;};'use strict';var multer=require(_0x7386('0x0'));var util=require(_0x7386('0x1'));var path=require(_0x7386('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7386('0x3')]();var auth=require(_0x7386('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7386('0x5'));var controller=require(_0x7386('0x6'));router[_0x7386('0x7')]('/',auth[_0x7386('0x8')](),controller['index']);router[_0x7386('0x7')](_0x7386('0x9'),auth[_0x7386('0x8')](),controller[_0x7386('0xa')]);router['get']('/:id/fields',auth[_0x7386('0x8')](),controller['getFields']);router[_0x7386('0x7')]('/:id/subjects',auth[_0x7386('0x8')](),controller[_0x7386('0xb')]);router[_0x7386('0x7')]('/:id/descriptions',auth[_0x7386('0x8')](),controller['getDescriptions']);router[_0x7386('0xc')]('/',auth['isAuthenticated'](),controller[_0x7386('0xd')]);router['put'](_0x7386('0x9'),auth[_0x7386('0x8')](),controller[_0x7386('0xe')]);router[_0x7386('0xf')](_0x7386('0x9'),auth['isAuthenticated'](),controller[_0x7386('0x10')]);module[_0x7386('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 6461210..d53be3e 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 _0xacb7=['STRING','ENUM','Task','contact_lead','contact','lead','nothing','sequelize'];(function(_0x1ac5c1,_0x5ceee4){var _0xc12500=function(_0x1521d2){while(--_0x1521d2){_0x1ac5c1['push'](_0x1ac5c1['shift']());}};_0xc12500(++_0x5ceee4);}(_0xacb7,0x16f));var _0x7acb=function(_0x42be19,_0x46d2b8){_0x42be19=_0x42be19-0x0;var _0xa606ae=_0xacb7[_0x42be19];return _0xa606ae;};'use strict';var Sequelize=require(_0x7acb('0x0'));module['exports']={'name':{'type':Sequelize[_0x7acb('0x1')]},'description':{'type':Sequelize[_0x7acb('0x1')]},'ticketType':{'type':Sequelize[_0x7acb('0x2')](_0x7acb('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x7acb('0x2')](_0x7acb('0x4'),_0x7acb('0x5'),_0x7acb('0x6')),'defaultValue':_0x7acb('0x4')},'moduleCreate':{'type':Sequelize[_0x7acb('0x2')](_0x7acb('0x7'),_0x7acb('0x5'),_0x7acb('0x6')),'defaultValue':_0x7acb('0x6')}}; \ No newline at end of file +var _0x9dd1=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9dd1,0xa2));var _0x19dd=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x9dd1[_0x211632];return _0x5a1da1;};'use strict';var Sequelize=require(_0x19dd('0x0'));module[_0x19dd('0x1')]={'name':{'type':Sequelize[_0x19dd('0x2')]},'description':{'type':Sequelize[_0x19dd('0x2')]},'ticketType':{'type':Sequelize[_0x19dd('0x3')](_0x19dd('0x4'),_0x19dd('0x5')),'defaultValue':_0x19dd('0x4')},'moduleSearch':{'type':Sequelize[_0x19dd('0x3')](_0x19dd('0x6'),_0x19dd('0x7'),_0x19dd('0x8')),'defaultValue':_0x19dd('0x6')},'moduleCreate':{'type':Sequelize[_0x19dd('0x3')]('nothing','contact','lead'),'defaultValue':_0x19dd('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index adfb640..87fb886 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 _0xe798=['path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','SalesforceConfiguration','rawAttributes','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','findOne','SalesforceField','length','pick','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','mustache'];(function(_0xc7fd5f,_0x292b24){var _0x5f0b28=function(_0x2e8535){while(--_0x2e8535){_0xc7fd5f['push'](_0xc7fd5f['shift']());}};_0x5f0b28(++_0x292b24);}(_0xe798,0x1b4));var _0x8e79=function(_0x5367c8,_0x3158c7){_0x5367c8=_0x5367c8-0x0;var _0x13e559=_0xe798[_0x5367c8];return _0x13e559;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8e79('0x0'));var zipdir=require(_0x8e79('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e79('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e79('0x3'));var util=require('util');var path=require(_0x8e79('0x4'));var sox=require(_0x8e79('0x5'));var csv=require(_0x8e79('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e79('0x7'));var squel=require(_0x8e79('0x8'));var crypto=require(_0x8e79('0x9'));var jsforce=require(_0x8e79('0xa'));var deskjs=require(_0x8e79('0xb'));var toCsv=require(_0x8e79('0x6'));var querystring=require(_0x8e79('0xc'));var Papa=require(_0x8e79('0xd'));var Redis=require(_0x8e79('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8e79('0xf'));var as=require(_0x8e79('0x10'));var hardwareService=require(_0x8e79('0x11'));var logger=require('../../config/logger')(_0x8e79('0x12'));var utils=require(_0x8e79('0x13'));var config=require(_0x8e79('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e79('0x15'))['db'];var jayson=require(_0x8e79('0x16'));var client=jayson[_0x8e79('0x17')][_0x8e79('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x430d1f,_0x594254,_0x24a56b,_0x1883e9){return new BPromise(function(_0x304bd9,_0x5952fb){var _0x2dd4a0=_0x1883e9||client;return _0x2dd4a0[_0x8e79('0x19')](_0x430d1f,_0x24a56b)[_0x8e79('0x1a')](function(_0x29d7bd){logger[_0x8e79('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s',_0x594254,'request\x20sent');logger['debug'](_0x8e79('0x1c'),_0x594254,_0x8e79('0x1d'),JSON[_0x8e79('0x1e')](_0x29d7bd));if(_0x29d7bd[_0x8e79('0x1f')]){if(_0x29d7bd[_0x8e79('0x1f')]['code']===0x1f4){logger[_0x8e79('0x1f')](_0x8e79('0x20'),_0x594254,_0x29d7bd[_0x8e79('0x1f')]['message']);return _0x5952fb(_0x29d7bd[_0x8e79('0x1f')]['message']);}logger[_0x8e79('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x594254,_0x29d7bd[_0x8e79('0x1f')][_0x8e79('0x21')]);return _0x304bd9(_0x29d7bd[_0x8e79('0x1f')]['message']);}else{logger[_0x8e79('0x1b')](_0x8e79('0x20'),_0x594254,_0x8e79('0x1d'));_0x304bd9(_0x29d7bd[_0x8e79('0x22')][_0x8e79('0x21')]);}})['catch'](function(_0x2f84d1){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x594254,_0x2f84d1);_0x5952fb(_0x2f84d1);});});}function respondWithStatusCode(_0x2e587e,_0x54ef97){_0x54ef97=_0x54ef97||0xcc;return function(_0x2e30de){if(_0x2e30de){return _0x2e587e[_0x8e79('0x23')](_0x54ef97);}return _0x2e587e[_0x8e79('0x24')](_0x54ef97)['end']();};}function respondWithResult(_0x175577,_0x148187){_0x148187=_0x148187||0xc8;return function(_0x5965c0){if(_0x5965c0){return _0x175577[_0x8e79('0x24')](_0x148187)[_0x8e79('0x25')](_0x5965c0);}};}function respondWithFilteredResult(_0x4eec30,_0x537f4e){return function(_0x14b37e){if(_0x14b37e){var _0x1559cb=_0x14b37e['count'],_0x57ccc4=_0x537f4e[_0x8e79('0x26')],_0x41f748=_0x537f4e[_0x8e79('0x26')]+_0x537f4e[_0x8e79('0x27')],_0x422d8d;if(_0x41f748>=_0x1559cb){_0x41f748=_0x1559cb;_0x422d8d=0xc8;}else{_0x422d8d=0xce;}_0x4eec30['status'](_0x422d8d);return _0x4eec30[_0x8e79('0x28')](_0x8e79('0x29'),_0x57ccc4+'-'+_0x41f748+'/'+_0x1559cb)[_0x8e79('0x25')](_0x14b37e);}return null;};}function patchUpdates(_0x37efa8){return function(_0x293595){try{jsonpatch[_0x8e79('0x2a')](_0x293595,_0x37efa8,!![]);}catch(_0x4e1c7b){return BPromise[_0x8e79('0x2b')](_0x4e1c7b);}return _0x293595[_0x8e79('0x2c')]();};}function saveUpdates(_0x21d097,_0x78ac7){return function(_0x22b9c0){if(_0x22b9c0){return _0x22b9c0[_0x8e79('0x2d')](_0x21d097)[_0x8e79('0x1a')](function(_0x258be3){return _0x258be3;});}return null;};}function removeEntity(_0x2e00ea,_0x5863ff){return function(_0x54747e){if(_0x54747e){return _0x54747e[_0x8e79('0x2e')]()[_0x8e79('0x1a')](function(){_0x2e00ea[_0x8e79('0x24')](0xcc)[_0x8e79('0x2f')]();});}};}function handleEntityNotFound(_0x1f5896,_0x5b05c1){return function(_0x5a7adf){if(!_0x5a7adf){_0x1f5896[_0x8e79('0x23')](0x194);}return _0x5a7adf;};}function handleError(_0x179801,_0x5c6962){_0x5c6962=_0x5c6962||0x1f4;return function(_0x5219a4){logger['error'](_0x5219a4[_0x8e79('0x30')]);if(_0x5219a4[_0x8e79('0x31')]){delete _0x5219a4[_0x8e79('0x31')];}_0x179801[_0x8e79('0x24')](_0x5c6962)['send'](_0x5219a4);};}exports[_0x8e79('0x32')]=function(_0x2a6bb0,_0x3c8938){var _0x4359fb={},_0x4add2d={},_0x3dc6c9={'count':0x0,'rows':[]};var _0x4c4c33=_[_0x8e79('0x33')](db[_0x8e79('0x34')][_0x8e79('0x35')],function(_0xdbcb1b){return{'name':_0xdbcb1b['fieldName'],'type':_0xdbcb1b[_0x8e79('0x36')]['key']};});_0x4add2d[_0x8e79('0x37')]=_[_0x8e79('0x33')](_0x4c4c33,_0x8e79('0x31'));_0x4add2d[_0x8e79('0x38')]=_['keys'](_0x2a6bb0[_0x8e79('0x38')]);_0x4add2d['filters']=_[_0x8e79('0x39')](_0x4add2d[_0x8e79('0x37')],_0x4add2d[_0x8e79('0x38')]);_0x4359fb['attributes']=_['intersection'](_0x4add2d[_0x8e79('0x37')],qs[_0x8e79('0x3a')](_0x2a6bb0['query'][_0x8e79('0x3a')]));_0x4359fb[_0x8e79('0x3b')]=_0x4359fb[_0x8e79('0x3b')]['length']?_0x4359fb[_0x8e79('0x3b')]:_0x4add2d[_0x8e79('0x37')];if(!_0x2a6bb0[_0x8e79('0x38')][_0x8e79('0x3c')](_0x8e79('0x3d'))){_0x4359fb[_0x8e79('0x27')]=qs[_0x8e79('0x27')](_0x2a6bb0[_0x8e79('0x38')][_0x8e79('0x27')]);_0x4359fb['offset']=qs['offset'](_0x2a6bb0[_0x8e79('0x38')][_0x8e79('0x26')]);}_0x4359fb[_0x8e79('0x3e')]=qs[_0x8e79('0x3f')](_0x2a6bb0[_0x8e79('0x38')][_0x8e79('0x3f')]);_0x4359fb['where']=qs[_0x8e79('0x40')](_['pick'](_0x2a6bb0[_0x8e79('0x38')],_0x4add2d['filters']),_0x4c4c33);if(_0x2a6bb0[_0x8e79('0x38')]['filter']){_0x4359fb[_0x8e79('0x41')]=_[_0x8e79('0x42')](_0x4359fb[_0x8e79('0x41')],{'$or':_[_0x8e79('0x33')](_0x4c4c33,function(_0x101673){if(_0x101673['type']!==_0x8e79('0x43')){var _0x12075a={};_0x12075a[_0x101673['name']]={'$like':'%'+_0x2a6bb0['query'][_0x8e79('0x44')]+'%'};return _0x12075a;}})});}_0x4359fb=_['merge']({},_0x4359fb,_0x2a6bb0['options']);var _0x59d4db={'where':_0x4359fb[_0x8e79('0x41')]};return db[_0x8e79('0x34')][_0x8e79('0x45')](_0x59d4db)[_0x8e79('0x1a')](function(_0x338a8e){_0x3dc6c9['count']=_0x338a8e;if(_0x2a6bb0[_0x8e79('0x38')][_0x8e79('0x46')]){_0x4359fb[_0x8e79('0x47')]=[{'all':!![]}];}return db[_0x8e79('0x34')][_0x8e79('0x48')](_0x4359fb);})[_0x8e79('0x1a')](function(_0x3a04e3){_0x3dc6c9['rows']=_0x3a04e3;return _0x3dc6c9;})[_0x8e79('0x1a')](respondWithFilteredResult(_0x3c8938,_0x4359fb))[_0x8e79('0x49')](handleError(_0x3c8938,null));};exports[_0x8e79('0x4a')]=function(_0x33d0f3,_0x40bafc){var _0x581cee={'raw':![],'where':{'id':_0x33d0f3[_0x8e79('0x4b')]['id']}},_0x5de873={};_0x5de873[_0x8e79('0x37')]=_[_0x8e79('0x4c')](db[_0x8e79('0x34')][_0x8e79('0x35')]);_0x5de873[_0x8e79('0x38')]=_['keys'](_0x33d0f3['query']);_0x5de873[_0x8e79('0x40')]=_[_0x8e79('0x39')](_0x5de873[_0x8e79('0x37')],_0x5de873[_0x8e79('0x38')]);_0x581cee[_0x8e79('0x3b')]=_[_0x8e79('0x39')](_0x5de873[_0x8e79('0x37')],qs[_0x8e79('0x3a')](_0x33d0f3[_0x8e79('0x38')][_0x8e79('0x3a')]));_0x581cee[_0x8e79('0x3b')]=_0x581cee[_0x8e79('0x3b')]['length']?_0x581cee[_0x8e79('0x3b')]:_0x5de873['model'];if(_0x33d0f3[_0x8e79('0x38')]['includeAll']){_0x581cee[_0x8e79('0x47')]=[{'all':!![]}];}_0x581cee=_[_0x8e79('0x42')]({},_0x581cee,_0x33d0f3[_0x8e79('0x4d')]);return db['SalesforceConfiguration'][_0x8e79('0x4e')](_0x581cee)['then'](handleEntityNotFound(_0x40bafc,null))[_0x8e79('0x1a')](respondWithResult(_0x40bafc,null))[_0x8e79('0x49')](handleError(_0x40bafc,null));};exports['create']=function(_0x119af8,_0x4ceba0){return db[_0x8e79('0x34')][_0x8e79('0x4f')](_0x119af8[_0x8e79('0x50')],{})['then'](respondWithResult(_0x4ceba0,0xc9))[_0x8e79('0x49')](handleError(_0x4ceba0,null));};exports[_0x8e79('0x2d')]=function(_0x6f8316,_0x448bf8){if(_0x6f8316[_0x8e79('0x50')]['id']){delete _0x6f8316[_0x8e79('0x50')]['id'];}return db['SalesforceConfiguration'][_0x8e79('0x4e')]({'where':{'id':_0x6f8316['params']['id']}})[_0x8e79('0x1a')](handleEntityNotFound(_0x448bf8,null))[_0x8e79('0x1a')](saveUpdates(_0x6f8316[_0x8e79('0x50')],null))[_0x8e79('0x1a')](respondWithResult(_0x448bf8,null))['catch'](handleError(_0x448bf8,null));};exports[_0x8e79('0x2e')]=function(_0x4a1b99,_0x46d635){return db[_0x8e79('0x34')][_0x8e79('0x4e')]({'where':{'id':_0x4a1b99[_0x8e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46d635,null))['then'](removeEntity(_0x46d635,null))[_0x8e79('0x49')](handleError(_0x46d635,null));};exports['getFields']=function(_0x335670,_0x51f000,_0x5764f0){var _0x3cc775={};var _0x284d4f={};var _0x32710f;var _0x3e3ed2;return db[_0x8e79('0x34')][_0x8e79('0x51')]({'where':{'id':_0x335670['params']['id']}})['then'](handleEntityNotFound(_0x51f000,null))['then'](function(_0x4847fb){if(_0x4847fb){_0x32710f=_0x4847fb;_0x284d4f['model']=_[_0x8e79('0x4c')](db[_0x8e79('0x52')][_0x8e79('0x35')]);_0x284d4f[_0x8e79('0x38')]=_[_0x8e79('0x4c')](_0x335670['query']);_0x284d4f[_0x8e79('0x40')]=_[_0x8e79('0x39')](_0x284d4f[_0x8e79('0x37')],_0x284d4f[_0x8e79('0x38')]);_0x3cc775[_0x8e79('0x3b')]=_[_0x8e79('0x39')](_0x284d4f[_0x8e79('0x37')],qs['fields'](_0x335670['query'][_0x8e79('0x3a')]));_0x3cc775[_0x8e79('0x3b')]=_0x3cc775[_0x8e79('0x3b')][_0x8e79('0x53')]?_0x3cc775[_0x8e79('0x3b')]:_0x284d4f[_0x8e79('0x37')];_0x3cc775[_0x8e79('0x3e')]=qs['sort'](_0x335670[_0x8e79('0x38')][_0x8e79('0x3f')]);_0x3cc775[_0x8e79('0x41')]=qs[_0x8e79('0x40')](_[_0x8e79('0x54')](_0x335670[_0x8e79('0x38')],_0x284d4f[_0x8e79('0x40')]));if(_0x335670[_0x8e79('0x38')][_0x8e79('0x44')]){_0x3cc775[_0x8e79('0x41')]=_['merge'](_0x3cc775[_0x8e79('0x41')],{'$or':_['map'](_0x3cc775['attributes'],function(_0x4b9273){var _0x50ba6e={};_0x50ba6e[_0x4b9273]={'$like':'%'+_0x335670['query']['filter']+'%'};return _0x50ba6e;})});}_0x3cc775=_[_0x8e79('0x42')]({},_0x3cc775,_0x335670[_0x8e79('0x4d')]);return _0x32710f['getFields'](_0x3cc775);}})[_0x8e79('0x1a')](function(_0x45d75f){if(_0x45d75f){_0x3e3ed2=_0x45d75f[_0x8e79('0x53')];if(!_0x335670[_0x8e79('0x38')]['hasOwnProperty'](_0x8e79('0x3d'))){_0x3cc775[_0x8e79('0x27')]=qs['limit'](_0x335670['query'][_0x8e79('0x27')]);_0x3cc775['offset']=qs[_0x8e79('0x26')](_0x335670[_0x8e79('0x38')][_0x8e79('0x26')]);}return _0x32710f[_0x8e79('0x55')](_0x3cc775);}})['then'](function(_0x53c1c0){if(_0x53c1c0){return _0x53c1c0?{'count':_0x3e3ed2,'rows':_0x53c1c0}:null;}})[_0x8e79('0x1a')](respondWithResult(_0x51f000,null))[_0x8e79('0x49')](handleError(_0x51f000,null));};exports[_0x8e79('0x56')]=function(_0x3685e6,_0x1f3079,_0x36888b){var _0x562811={};var _0x676daf={};var _0x1ba6d3;var _0x4a067b;return db[_0x8e79('0x34')]['findOne']({'where':{'id':_0x3685e6['params']['id']}})[_0x8e79('0x1a')](handleEntityNotFound(_0x1f3079,null))[_0x8e79('0x1a')](function(_0x2f9f2f){if(_0x2f9f2f){_0x1ba6d3=_0x2f9f2f;_0x676daf[_0x8e79('0x37')]=_[_0x8e79('0x4c')](db[_0x8e79('0x52')][_0x8e79('0x35')]);_0x676daf[_0x8e79('0x38')]=_['keys'](_0x3685e6['query']);_0x676daf['filters']=_[_0x8e79('0x39')](_0x676daf[_0x8e79('0x37')],_0x676daf[_0x8e79('0x38')]);_0x562811[_0x8e79('0x3b')]=_[_0x8e79('0x39')](_0x676daf[_0x8e79('0x37')],qs['fields'](_0x3685e6['query'][_0x8e79('0x3a')]));_0x562811[_0x8e79('0x3b')]=_0x562811['attributes'][_0x8e79('0x53')]?_0x562811['attributes']:_0x676daf[_0x8e79('0x37')];_0x562811[_0x8e79('0x3e')]=qs['sort'](_0x3685e6['query']['sort']);_0x562811[_0x8e79('0x41')]=qs['filters'](_['pick'](_0x3685e6[_0x8e79('0x38')],_0x676daf[_0x8e79('0x40')]));if(_0x3685e6[_0x8e79('0x38')]['filter']){_0x562811[_0x8e79('0x41')]=_[_0x8e79('0x42')](_0x562811[_0x8e79('0x41')],{'$or':_[_0x8e79('0x33')](_0x562811[_0x8e79('0x3b')],function(_0x185d5c){var _0x7fadbd={};_0x7fadbd[_0x185d5c]={'$like':'%'+_0x3685e6['query'][_0x8e79('0x44')]+'%'};return _0x7fadbd;})});}_0x562811=_[_0x8e79('0x42')]({},_0x562811,_0x3685e6['options']);return _0x1ba6d3[_0x8e79('0x56')](_0x562811);}})[_0x8e79('0x1a')](function(_0x531039){if(_0x531039){_0x4a067b=_0x531039[_0x8e79('0x53')];if(!_0x3685e6['query']['hasOwnProperty']('nolimit')){_0x562811[_0x8e79('0x27')]=qs['limit'](_0x3685e6[_0x8e79('0x38')][_0x8e79('0x27')]);_0x562811[_0x8e79('0x26')]=qs['offset'](_0x3685e6[_0x8e79('0x38')]['offset']);}return _0x1ba6d3[_0x8e79('0x56')](_0x562811);}})[_0x8e79('0x1a')](function(_0x139e68){if(_0x139e68){return _0x139e68?{'count':_0x4a067b,'rows':_0x139e68}:null;}})['then'](respondWithResult(_0x1f3079,null))['catch'](handleError(_0x1f3079,null));};exports[_0x8e79('0x57')]=function(_0x1409e0,_0x5ed2ce,_0x48dbc0){var _0x313c0d={};var _0x56dc21={};var _0x10b087;var _0x2fde8b;return db['SalesforceConfiguration'][_0x8e79('0x51')]({'where':{'id':_0x1409e0[_0x8e79('0x4b')]['id']}})[_0x8e79('0x1a')](handleEntityNotFound(_0x5ed2ce,null))[_0x8e79('0x1a')](function(_0x4fd239){if(_0x4fd239){_0x10b087=_0x4fd239;_0x56dc21[_0x8e79('0x37')]=_[_0x8e79('0x4c')](db['SalesforceField'][_0x8e79('0x35')]);_0x56dc21[_0x8e79('0x38')]=_[_0x8e79('0x4c')](_0x1409e0[_0x8e79('0x38')]);_0x56dc21[_0x8e79('0x40')]=_[_0x8e79('0x39')](_0x56dc21[_0x8e79('0x37')],_0x56dc21[_0x8e79('0x38')]);_0x313c0d[_0x8e79('0x3b')]=_[_0x8e79('0x39')](_0x56dc21['model'],qs[_0x8e79('0x3a')](_0x1409e0[_0x8e79('0x38')][_0x8e79('0x3a')]));_0x313c0d[_0x8e79('0x3b')]=_0x313c0d[_0x8e79('0x3b')][_0x8e79('0x53')]?_0x313c0d[_0x8e79('0x3b')]:_0x56dc21[_0x8e79('0x37')];_0x313c0d[_0x8e79('0x3e')]=qs[_0x8e79('0x3f')](_0x1409e0[_0x8e79('0x38')][_0x8e79('0x3f')]);_0x313c0d[_0x8e79('0x41')]=qs[_0x8e79('0x40')](_[_0x8e79('0x54')](_0x1409e0['query'],_0x56dc21['filters']));if(_0x1409e0[_0x8e79('0x38')]['filter']){_0x313c0d[_0x8e79('0x41')]=_[_0x8e79('0x42')](_0x313c0d[_0x8e79('0x41')],{'$or':_[_0x8e79('0x33')](_0x313c0d[_0x8e79('0x3b')],function(_0x2631b9){var _0x449c55={};_0x449c55[_0x2631b9]={'$like':'%'+_0x1409e0[_0x8e79('0x38')][_0x8e79('0x44')]+'%'};return _0x449c55;})});}_0x313c0d=_['merge']({},_0x313c0d,_0x1409e0[_0x8e79('0x4d')]);return _0x10b087[_0x8e79('0x57')](_0x313c0d);}})[_0x8e79('0x1a')](function(_0x2b1b67){if(_0x2b1b67){_0x2fde8b=_0x2b1b67['length'];if(!_0x1409e0['query'][_0x8e79('0x3c')]('nolimit')){_0x313c0d[_0x8e79('0x27')]=qs['limit'](_0x1409e0[_0x8e79('0x38')][_0x8e79('0x27')]);_0x313c0d[_0x8e79('0x26')]=qs['offset'](_0x1409e0[_0x8e79('0x38')]['offset']);}return _0x10b087[_0x8e79('0x57')](_0x313c0d);}})[_0x8e79('0x1a')](function(_0x56f664){if(_0x56f664){return _0x56f664?{'count':_0x2fde8b,'rows':_0x56f664}:null;}})[_0x8e79('0x1a')](respondWithResult(_0x5ed2ce,null))[_0x8e79('0x49')](handleError(_0x5ed2ce,null));}; \ No newline at end of file +var _0xdb5d=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','then','stack','name','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','keys','includeAll','find','create','update','body','getFields','getSubjects','getDescriptions','findOne','SalesforceField','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x14ab62,_0xd8b95b){var _0x2ed6f8=function(_0x1c85b9){while(--_0x1c85b9){_0x14ab62['push'](_0x14ab62['shift']());}};_0x2ed6f8(++_0xd8b95b);}(_0xdb5d,0x1ad));var _0xddb5=function(_0x4992a6,_0x3552e3){_0x4992a6=_0x4992a6-0x0;var _0x2c30c7=_0xdb5d[_0x4992a6];return _0x2c30c7;};'use strict';var pdf=require(_0xddb5('0x0'));var emlformat=require(_0xddb5('0x1'));var rimraf=require(_0xddb5('0x2'));var zipdir=require(_0xddb5('0x3'));var jsonpatch=require(_0xddb5('0x4'));var rp=require(_0xddb5('0x5'));var moment=require(_0xddb5('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xddb5('0x7'));var util=require(_0xddb5('0x8'));var path=require('path');var sox=require(_0xddb5('0x9'));var csv=require(_0xddb5('0xa'));var ejs=require(_0xddb5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xddb5('0xc'));var crypto=require(_0xddb5('0xd'));var jsforce=require(_0xddb5('0xe'));var deskjs=require(_0xddb5('0xf'));var toCsv=require(_0xddb5('0xa'));var querystring=require(_0xddb5('0x10'));var Papa=require(_0xddb5('0x11'));var Redis=require(_0xddb5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xddb5('0x13'));var as=require(_0xddb5('0x14'));var hardwareService=require(_0xddb5('0x15'));var logger=require(_0xddb5('0x16'))(_0xddb5('0x17'));var utils=require(_0xddb5('0x18'));var config=require(_0xddb5('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xddb5('0x1a'));var client=jayson['client'][_0xddb5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5a0c58,_0x59aeb4,_0x31ff6e,_0x391ff8){return new BPromise(function(_0x818f77,_0x17ea41){var _0x4a866c=_0x391ff8||client;return _0x4a866c[_0xddb5('0x1c')](_0x5a0c58,_0x31ff6e)['then'](function(_0x5333b2){logger[_0xddb5('0x1d')](_0xddb5('0x1e'),_0x59aeb4,'request\x20sent');logger[_0xddb5('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x59aeb4,_0xddb5('0x20'),JSON[_0xddb5('0x21')](_0x5333b2));if(_0x5333b2[_0xddb5('0x22')]){if(_0x5333b2[_0xddb5('0x22')][_0xddb5('0x23')]===0x1f4){logger[_0xddb5('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59aeb4,_0x5333b2[_0xddb5('0x22')][_0xddb5('0x24')]);return _0x17ea41(_0x5333b2['error'][_0xddb5('0x24')]);}logger[_0xddb5('0x22')](_0xddb5('0x1e'),_0x59aeb4,_0x5333b2[_0xddb5('0x22')][_0xddb5('0x24')]);return _0x818f77(_0x5333b2[_0xddb5('0x22')][_0xddb5('0x24')]);}else{logger['info'](_0xddb5('0x1e'),_0x59aeb4,_0xddb5('0x20'));_0x818f77(_0x5333b2['result'][_0xddb5('0x24')]);}})[_0xddb5('0x25')](function(_0x56814b){logger[_0xddb5('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59aeb4,_0x56814b);_0x17ea41(_0x56814b);});});}function respondWithStatusCode(_0x91d6e,_0x499a38){_0x499a38=_0x499a38||0xcc;return function(_0x4ee562){if(_0x4ee562){return _0x91d6e[_0xddb5('0x26')](_0x499a38);}return _0x91d6e[_0xddb5('0x27')](_0x499a38)[_0xddb5('0x28')]();};}function respondWithResult(_0x353cbb,_0x385171){_0x385171=_0x385171||0xc8;return function(_0x351bcc){if(_0x351bcc){return _0x353cbb[_0xddb5('0x27')](_0x385171)['json'](_0x351bcc);}};}function respondWithFilteredResult(_0x24a67c,_0x21244f){return function(_0x309241){if(_0x309241){var _0x4e278a=_0x309241[_0xddb5('0x29')],_0x2f0a89=_0x21244f[_0xddb5('0x2a')],_0x2a5dc4=_0x21244f[_0xddb5('0x2a')]+_0x21244f[_0xddb5('0x2b')],_0x16d41f;if(_0x2a5dc4>=_0x4e278a){_0x2a5dc4=_0x4e278a;_0x16d41f=0xc8;}else{_0x16d41f=0xce;}_0x24a67c[_0xddb5('0x27')](_0x16d41f);return _0x24a67c[_0xddb5('0x2c')](_0xddb5('0x2d'),_0x2f0a89+'-'+_0x2a5dc4+'/'+_0x4e278a)['json'](_0x309241);}return null;};}function patchUpdates(_0x203700){return function(_0x40f42b){try{jsonpatch['apply'](_0x40f42b,_0x203700,!![]);}catch(_0x320c50){return BPromise[_0xddb5('0x2e')](_0x320c50);}return _0x40f42b[_0xddb5('0x2f')]();};}function saveUpdates(_0x351c3,_0x579c09){return function(_0x5deae8){if(_0x5deae8){return _0x5deae8['update'](_0x351c3)[_0xddb5('0x30')](function(_0x79385){return _0x79385;});}return null;};}function removeEntity(_0x53a803,_0x5c82d5){return function(_0x1e69a7){if(_0x1e69a7){return _0x1e69a7['destroy']()[_0xddb5('0x30')](function(){_0x53a803[_0xddb5('0x27')](0xcc)[_0xddb5('0x28')]();});}};}function handleEntityNotFound(_0x2ef671,_0x68f47e){return function(_0x452331){if(!_0x452331){_0x2ef671['sendStatus'](0x194);}return _0x452331;};}function handleError(_0x10dfd9,_0x17e98d){_0x17e98d=_0x17e98d||0x1f4;return function(_0x5ac650){logger[_0xddb5('0x22')](_0x5ac650[_0xddb5('0x31')]);if(_0x5ac650[_0xddb5('0x32')]){delete _0x5ac650['name'];}_0x10dfd9[_0xddb5('0x27')](_0x17e98d)['send'](_0x5ac650);};}exports[_0xddb5('0x33')]=function(_0x55d76b,_0x3888c6){var _0x3706c4={},_0x30712f={},_0x192f2f={'count':0x0,'rows':[]};var _0x85df02=_['map'](db[_0xddb5('0x34')][_0xddb5('0x35')],function(_0x339cd5){return{'name':_0x339cd5[_0xddb5('0x36')],'type':_0x339cd5[_0xddb5('0x37')][_0xddb5('0x38')]};});_0x30712f[_0xddb5('0x39')]=_[_0xddb5('0x3a')](_0x85df02,_0xddb5('0x32'));_0x30712f[_0xddb5('0x3b')]=_['keys'](_0x55d76b[_0xddb5('0x3b')]);_0x30712f[_0xddb5('0x3c')]=_[_0xddb5('0x3d')](_0x30712f[_0xddb5('0x39')],_0x30712f[_0xddb5('0x3b')]);_0x3706c4[_0xddb5('0x3e')]=_['intersection'](_0x30712f[_0xddb5('0x39')],qs[_0xddb5('0x3f')](_0x55d76b[_0xddb5('0x3b')][_0xddb5('0x3f')]));_0x3706c4[_0xddb5('0x3e')]=_0x3706c4[_0xddb5('0x3e')][_0xddb5('0x40')]?_0x3706c4[_0xddb5('0x3e')]:_0x30712f[_0xddb5('0x39')];if(!_0x55d76b[_0xddb5('0x3b')][_0xddb5('0x41')](_0xddb5('0x42'))){_0x3706c4[_0xddb5('0x2b')]=qs[_0xddb5('0x2b')](_0x55d76b[_0xddb5('0x3b')][_0xddb5('0x2b')]);_0x3706c4['offset']=qs[_0xddb5('0x2a')](_0x55d76b[_0xddb5('0x3b')][_0xddb5('0x2a')]);}_0x3706c4[_0xddb5('0x43')]=qs[_0xddb5('0x44')](_0x55d76b[_0xddb5('0x3b')]['sort']);_0x3706c4[_0xddb5('0x45')]=qs[_0xddb5('0x3c')](_[_0xddb5('0x46')](_0x55d76b[_0xddb5('0x3b')],_0x30712f[_0xddb5('0x3c')]),_0x85df02);if(_0x55d76b[_0xddb5('0x3b')][_0xddb5('0x47')]){_0x3706c4[_0xddb5('0x45')]=_[_0xddb5('0x48')](_0x3706c4[_0xddb5('0x45')],{'$or':_[_0xddb5('0x3a')](_0x85df02,function(_0x4d0055){if(_0x4d0055['type']!=='VIRTUAL'){var _0x24ad0e={};_0x24ad0e[_0x4d0055[_0xddb5('0x32')]]={'$like':'%'+_0x55d76b[_0xddb5('0x3b')][_0xddb5('0x47')]+'%'};return _0x24ad0e;}})});}_0x3706c4=_[_0xddb5('0x48')]({},_0x3706c4,_0x55d76b[_0xddb5('0x49')]);var _0x8f1bb1={'where':_0x3706c4[_0xddb5('0x45')]};return db[_0xddb5('0x34')]['count'](_0x8f1bb1)[_0xddb5('0x30')](function(_0x31d45b){_0x192f2f[_0xddb5('0x29')]=_0x31d45b;if(_0x55d76b[_0xddb5('0x3b')]['includeAll']){_0x3706c4[_0xddb5('0x4a')]=[{'all':!![]}];}return db[_0xddb5('0x34')][_0xddb5('0x4b')](_0x3706c4);})[_0xddb5('0x30')](function(_0x582152){_0x192f2f[_0xddb5('0x4c')]=_0x582152;return _0x192f2f;})[_0xddb5('0x30')](respondWithFilteredResult(_0x3888c6,_0x3706c4))['catch'](handleError(_0x3888c6,null));};exports['show']=function(_0x3d6843,_0x6b9756){var _0x5db211={'raw':![],'where':{'id':_0x3d6843[_0xddb5('0x4d')]['id']}},_0x7ccd52={};_0x7ccd52[_0xddb5('0x39')]=_[_0xddb5('0x4e')](db[_0xddb5('0x34')]['rawAttributes']);_0x7ccd52[_0xddb5('0x3b')]=_[_0xddb5('0x4e')](_0x3d6843['query']);_0x7ccd52[_0xddb5('0x3c')]=_['intersection'](_0x7ccd52[_0xddb5('0x39')],_0x7ccd52[_0xddb5('0x3b')]);_0x5db211[_0xddb5('0x3e')]=_[_0xddb5('0x3d')](_0x7ccd52[_0xddb5('0x39')],qs['fields'](_0x3d6843[_0xddb5('0x3b')][_0xddb5('0x3f')]));_0x5db211['attributes']=_0x5db211[_0xddb5('0x3e')][_0xddb5('0x40')]?_0x5db211['attributes']:_0x7ccd52['model'];if(_0x3d6843[_0xddb5('0x3b')][_0xddb5('0x4f')]){_0x5db211[_0xddb5('0x4a')]=[{'all':!![]}];}_0x5db211=_[_0xddb5('0x48')]({},_0x5db211,_0x3d6843[_0xddb5('0x49')]);return db[_0xddb5('0x34')][_0xddb5('0x50')](_0x5db211)['then'](handleEntityNotFound(_0x6b9756,null))[_0xddb5('0x30')](respondWithResult(_0x6b9756,null))[_0xddb5('0x25')](handleError(_0x6b9756,null));};exports[_0xddb5('0x51')]=function(_0x4228cc,_0x3f04bc){return db[_0xddb5('0x34')]['create'](_0x4228cc['body'],{})[_0xddb5('0x30')](respondWithResult(_0x3f04bc,0xc9))['catch'](handleError(_0x3f04bc,null));};exports[_0xddb5('0x52')]=function(_0x4620e1,_0x3bb6e8){if(_0x4620e1[_0xddb5('0x53')]['id']){delete _0x4620e1[_0xddb5('0x53')]['id'];}return db['SalesforceConfiguration'][_0xddb5('0x50')]({'where':{'id':_0x4620e1[_0xddb5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bb6e8,null))[_0xddb5('0x30')](saveUpdates(_0x4620e1[_0xddb5('0x53')],null))[_0xddb5('0x30')](respondWithResult(_0x3bb6e8,null))['catch'](handleError(_0x3bb6e8,null));};exports['destroy']=function(_0x57e57d,_0x12e535){return db[_0xddb5('0x34')]['find']({'where':{'id':_0x57e57d[_0xddb5('0x4d')]['id']}})[_0xddb5('0x30')](handleEntityNotFound(_0x12e535,null))['then'](removeEntity(_0x12e535,null))[_0xddb5('0x25')](handleError(_0x12e535,null));};exports['getFields']=function(_0x1dbfad,_0x409229,_0x33b488){var _0x2a3556={};var _0x2736ba={};var _0x118ca1;var _0x3c11ef;return db[_0xddb5('0x34')]['findOne']({'where':{'id':_0x1dbfad[_0xddb5('0x4d')]['id']}})[_0xddb5('0x30')](handleEntityNotFound(_0x409229,null))[_0xddb5('0x30')](function(_0x3c89f4){if(_0x3c89f4){_0x118ca1=_0x3c89f4;_0x2736ba[_0xddb5('0x39')]=_['keys'](db['SalesforceField'][_0xddb5('0x35')]);_0x2736ba[_0xddb5('0x3b')]=_['keys'](_0x1dbfad['query']);_0x2736ba[_0xddb5('0x3c')]=_[_0xddb5('0x3d')](_0x2736ba[_0xddb5('0x39')],_0x2736ba[_0xddb5('0x3b')]);_0x2a3556[_0xddb5('0x3e')]=_[_0xddb5('0x3d')](_0x2736ba['model'],qs['fields'](_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x3f')]));_0x2a3556[_0xddb5('0x3e')]=_0x2a3556[_0xddb5('0x3e')][_0xddb5('0x40')]?_0x2a3556[_0xddb5('0x3e')]:_0x2736ba[_0xddb5('0x39')];_0x2a3556[_0xddb5('0x43')]=qs[_0xddb5('0x44')](_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x44')]);_0x2a3556[_0xddb5('0x45')]=qs['filters'](_[_0xddb5('0x46')](_0x1dbfad[_0xddb5('0x3b')],_0x2736ba[_0xddb5('0x3c')]));if(_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x47')]){_0x2a3556[_0xddb5('0x45')]=_['merge'](_0x2a3556[_0xddb5('0x45')],{'$or':_[_0xddb5('0x3a')](_0x2a3556[_0xddb5('0x3e')],function(_0x205067){var _0x44132a={};_0x44132a[_0x205067]={'$like':'%'+_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x47')]+'%'};return _0x44132a;})});}_0x2a3556=_[_0xddb5('0x48')]({},_0x2a3556,_0x1dbfad['options']);return _0x118ca1['getFields'](_0x2a3556);}})[_0xddb5('0x30')](function(_0x5dd262){if(_0x5dd262){_0x3c11ef=_0x5dd262[_0xddb5('0x40')];if(!_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x41')](_0xddb5('0x42'))){_0x2a3556[_0xddb5('0x2b')]=qs['limit'](_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x2b')]);_0x2a3556[_0xddb5('0x2a')]=qs[_0xddb5('0x2a')](_0x1dbfad[_0xddb5('0x3b')][_0xddb5('0x2a')]);}return _0x118ca1[_0xddb5('0x54')](_0x2a3556);}})['then'](function(_0x54d721){if(_0x54d721){return _0x54d721?{'count':_0x3c11ef,'rows':_0x54d721}:null;}})['then'](respondWithResult(_0x409229,null))[_0xddb5('0x25')](handleError(_0x409229,null));};exports[_0xddb5('0x55')]=function(_0x400c30,_0xe39cd9,_0x5811b8){var _0x3765f7={};var _0x5b546a={};var _0x337ae3;var _0x5cebed;return db[_0xddb5('0x34')]['findOne']({'where':{'id':_0x400c30['params']['id']}})[_0xddb5('0x30')](handleEntityNotFound(_0xe39cd9,null))[_0xddb5('0x30')](function(_0x2dbf9f){if(_0x2dbf9f){_0x337ae3=_0x2dbf9f;_0x5b546a[_0xddb5('0x39')]=_[_0xddb5('0x4e')](db['SalesforceField'][_0xddb5('0x35')]);_0x5b546a[_0xddb5('0x3b')]=_[_0xddb5('0x4e')](_0x400c30[_0xddb5('0x3b')]);_0x5b546a[_0xddb5('0x3c')]=_[_0xddb5('0x3d')](_0x5b546a['model'],_0x5b546a[_0xddb5('0x3b')]);_0x3765f7[_0xddb5('0x3e')]=_[_0xddb5('0x3d')](_0x5b546a[_0xddb5('0x39')],qs[_0xddb5('0x3f')](_0x400c30[_0xddb5('0x3b')]['fields']));_0x3765f7['attributes']=_0x3765f7['attributes']['length']?_0x3765f7['attributes']:_0x5b546a[_0xddb5('0x39')];_0x3765f7[_0xddb5('0x43')]=qs[_0xddb5('0x44')](_0x400c30[_0xddb5('0x3b')][_0xddb5('0x44')]);_0x3765f7[_0xddb5('0x45')]=qs[_0xddb5('0x3c')](_[_0xddb5('0x46')](_0x400c30[_0xddb5('0x3b')],_0x5b546a['filters']));if(_0x400c30['query']['filter']){_0x3765f7[_0xddb5('0x45')]=_['merge'](_0x3765f7[_0xddb5('0x45')],{'$or':_['map'](_0x3765f7['attributes'],function(_0x534273){var _0x144bea={};_0x144bea[_0x534273]={'$like':'%'+_0x400c30[_0xddb5('0x3b')][_0xddb5('0x47')]+'%'};return _0x144bea;})});}_0x3765f7=_[_0xddb5('0x48')]({},_0x3765f7,_0x400c30[_0xddb5('0x49')]);return _0x337ae3['getSubjects'](_0x3765f7);}})[_0xddb5('0x30')](function(_0x31d60a){if(_0x31d60a){_0x5cebed=_0x31d60a[_0xddb5('0x40')];if(!_0x400c30[_0xddb5('0x3b')]['hasOwnProperty']('nolimit')){_0x3765f7[_0xddb5('0x2b')]=qs[_0xddb5('0x2b')](_0x400c30[_0xddb5('0x3b')]['limit']);_0x3765f7['offset']=qs[_0xddb5('0x2a')](_0x400c30[_0xddb5('0x3b')][_0xddb5('0x2a')]);}return _0x337ae3[_0xddb5('0x55')](_0x3765f7);}})[_0xddb5('0x30')](function(_0x3eff7a){if(_0x3eff7a){return _0x3eff7a?{'count':_0x5cebed,'rows':_0x3eff7a}:null;}})[_0xddb5('0x30')](respondWithResult(_0xe39cd9,null))['catch'](handleError(_0xe39cd9,null));};exports[_0xddb5('0x56')]=function(_0x5093b9,_0x51cb94,_0x2bf508){var _0x40f8a6={};var _0x4d65ac={};var _0x505309;var _0x1b0998;return db[_0xddb5('0x34')][_0xddb5('0x57')]({'where':{'id':_0x5093b9['params']['id']}})[_0xddb5('0x30')](handleEntityNotFound(_0x51cb94,null))[_0xddb5('0x30')](function(_0x39e38e){if(_0x39e38e){_0x505309=_0x39e38e;_0x4d65ac[_0xddb5('0x39')]=_[_0xddb5('0x4e')](db[_0xddb5('0x58')][_0xddb5('0x35')]);_0x4d65ac['query']=_[_0xddb5('0x4e')](_0x5093b9['query']);_0x4d65ac[_0xddb5('0x3c')]=_[_0xddb5('0x3d')](_0x4d65ac[_0xddb5('0x39')],_0x4d65ac[_0xddb5('0x3b')]);_0x40f8a6[_0xddb5('0x3e')]=_[_0xddb5('0x3d')](_0x4d65ac[_0xddb5('0x39')],qs['fields'](_0x5093b9[_0xddb5('0x3b')][_0xddb5('0x3f')]));_0x40f8a6[_0xddb5('0x3e')]=_0x40f8a6['attributes'][_0xddb5('0x40')]?_0x40f8a6[_0xddb5('0x3e')]:_0x4d65ac[_0xddb5('0x39')];_0x40f8a6[_0xddb5('0x43')]=qs[_0xddb5('0x44')](_0x5093b9['query'][_0xddb5('0x44')]);_0x40f8a6['where']=qs['filters'](_[_0xddb5('0x46')](_0x5093b9[_0xddb5('0x3b')],_0x4d65ac[_0xddb5('0x3c')]));if(_0x5093b9[_0xddb5('0x3b')][_0xddb5('0x47')]){_0x40f8a6[_0xddb5('0x45')]=_[_0xddb5('0x48')](_0x40f8a6[_0xddb5('0x45')],{'$or':_[_0xddb5('0x3a')](_0x40f8a6[_0xddb5('0x3e')],function(_0xed08c5){var _0x585335={};_0x585335[_0xed08c5]={'$like':'%'+_0x5093b9['query'][_0xddb5('0x47')]+'%'};return _0x585335;})});}_0x40f8a6=_[_0xddb5('0x48')]({},_0x40f8a6,_0x5093b9[_0xddb5('0x49')]);return _0x505309['getDescriptions'](_0x40f8a6);}})[_0xddb5('0x30')](function(_0x3d9ee1){if(_0x3d9ee1){_0x1b0998=_0x3d9ee1[_0xddb5('0x40')];if(!_0x5093b9[_0xddb5('0x3b')][_0xddb5('0x41')](_0xddb5('0x42'))){_0x40f8a6[_0xddb5('0x2b')]=qs[_0xddb5('0x2b')](_0x5093b9[_0xddb5('0x3b')][_0xddb5('0x2b')]);_0x40f8a6[_0xddb5('0x2a')]=qs['offset'](_0x5093b9[_0xddb5('0x3b')][_0xddb5('0x2a')]);}return _0x505309['getDescriptions'](_0x40f8a6);}})['then'](function(_0x1b5c0b){if(_0x1b5c0b){return _0x1b5c0b?{'count':_0x1b0998,'rows':_0x1b5c0b}:null;}})['then'](respondWithResult(_0x51cb94,null))[_0xddb5('0x25')](handleError(_0x51cb94,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 57e06c5..e786b3f 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 _0x2ca2=['define','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x21d88d,_0x4ff19c){var _0x30a579=function(_0x24cf7a){while(--_0x24cf7a){_0x21d88d['push'](_0x21d88d['shift']());}};_0x30a579(++_0x4ff19c);}(_0x2ca2,0x16a));var _0x22ca=function(_0x1ad8f5,_0x56ade6){_0x1ad8f5=_0x1ad8f5-0x0;var _0x4f1c4a=_0x2ca2[_0x1ad8f5];return _0x4f1c4a;};'use strict';var _=require(_0x22ca('0x0'));var util=require(_0x22ca('0x1'));var logger=require(_0x22ca('0x2'))(_0x22ca('0x3'));var moment=require('moment');var BPromise=require(_0x22ca('0x4'));var rp=require(_0x22ca('0x5'));var fs=require('fs');var path=require(_0x22ca('0x6'));var rimraf=require('rimraf');var config=require(_0x22ca('0x7'));var attributes=require(_0x22ca('0x8'));module[_0x22ca('0x9')]=function(_0x45a3b6,_0x4e07d1){return _0x45a3b6[_0x22ca('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x22ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35db=['../../config/logger','api','request-promise','path','rimraf','exports','SalesforceConfiguration','lodash'];(function(_0x3944b3,_0xf05375){var _0xbf7a53=function(_0x1c5aa2){while(--_0x1c5aa2){_0x3944b3['push'](_0x3944b3['shift']());}};_0xbf7a53(++_0xf05375);}(_0x35db,0x1e7));var _0xb35d=function(_0x29d332,_0x30d50c){_0x29d332=_0x29d332-0x0;var _0x2c4984=_0x35db[_0x29d332];return _0x2c4984;};'use strict';var _=require(_0xb35d('0x0'));var util=require('util');var logger=require(_0xb35d('0x1'))(_0xb35d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb35d('0x3'));var fs=require('fs');var path=require(_0xb35d('0x4'));var rimraf=require(_0xb35d('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xb35d('0x6')]=function(_0x59b2e5,_0x4da783){return _0x59b2e5['define'](_0xb35d('0x7'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 3c4c340..d232353 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 _0x1aca=['http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1aca,0x1c0));var _0xa1ac=function(_0x47d10a,_0x2e7ff0){_0x47d10a=_0x47d10a-0x0;var _0x1561fb=_0x1aca[_0x47d10a];return _0x1561fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa1ac('0x0'));var BPromise=require(_0xa1ac('0x1'));var rs=require(_0xa1ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1ac('0x3'));var logger=require(_0xa1ac('0x4'))('rpc');var config=require(_0xa1ac('0x5'));var jayson=require(_0xa1ac('0x6'));var client=jayson[_0xa1ac('0x7')][_0xa1ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14eaaa,_0x57b28b,_0x482c17){return new BPromise(function(_0x4dc630,_0x452779){return client[_0xa1ac('0x9')](_0x14eaaa,_0x482c17)[_0xa1ac('0xa')](function(_0x190ff6){logger[_0xa1ac('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x57b28b,_0xa1ac('0xc'));logger[_0xa1ac('0xd')](_0xa1ac('0xe'),_0x57b28b,_0xa1ac('0xc'),JSON['stringify'](_0x190ff6));if(_0x190ff6[_0xa1ac('0xf')]){if(_0x190ff6[_0xa1ac('0xf')]['code']===0x1f4){logger[_0xa1ac('0xf')](_0xa1ac('0x10'),_0x57b28b,_0x190ff6['error']['message']);return _0x452779(_0x190ff6['error'][_0xa1ac('0x11')]);}logger[_0xa1ac('0xf')](_0xa1ac('0x10'),_0x57b28b,_0x190ff6[_0xa1ac('0xf')]['message']);return _0x4dc630(_0x190ff6[_0xa1ac('0xf')][_0xa1ac('0x11')]);}else{logger[_0xa1ac('0xb')](_0xa1ac('0x10'),_0x57b28b,_0xa1ac('0xc'));_0x4dc630(_0x190ff6['result'][_0xa1ac('0x11')]);}})[_0xa1ac('0x12')](function(_0x5657fb){logger[_0xa1ac('0xf')](_0xa1ac('0x10'),_0x57b28b,_0x5657fb);_0x452779(_0x5657fb);});});} \ No newline at end of file +var _0x9f80=['rpc','../../config/environment','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9f80,0x1da));var _0x09f8=function(_0x20bbff,_0x26da07){_0x20bbff=_0x20bbff-0x0;var _0x35109e=_0x9f80[_0x20bbff];return _0x35109e;};'use strict';var _=require(_0x09f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x09f8('0x1'));var rs=require(_0x09f8('0x2'));var fs=require('fs');var Redis=require(_0x09f8('0x3'));var db=require(_0x09f8('0x4'))['db'];var utils=require(_0x09f8('0x5'));var logger=require('../../config/logger')(_0x09f8('0x6'));var config=require(_0x09f8('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x214045,_0x565cfd,_0x1166b8){return new BPromise(function(_0x4bf5e4,_0x362c88){return client[_0x09f8('0x8')](_0x214045,_0x1166b8)['then'](function(_0x19b45d){logger[_0x09f8('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x565cfd,_0x09f8('0xa'));logger[_0x09f8('0xb')](_0x09f8('0xc'),_0x565cfd,_0x09f8('0xa'),JSON[_0x09f8('0xd')](_0x19b45d));if(_0x19b45d[_0x09f8('0xe')]){if(_0x19b45d[_0x09f8('0xe')][_0x09f8('0xf')]===0x1f4){logger['error'](_0x09f8('0x10'),_0x565cfd,_0x19b45d[_0x09f8('0xe')][_0x09f8('0x11')]);return _0x362c88(_0x19b45d[_0x09f8('0xe')]['message']);}logger['error'](_0x09f8('0x10'),_0x565cfd,_0x19b45d[_0x09f8('0xe')]['message']);return _0x4bf5e4(_0x19b45d['error']['message']);}else{logger[_0x09f8('0x9')](_0x09f8('0x10'),_0x565cfd,'request\x20sent');_0x4bf5e4(_0x19b45d[_0x09f8('0x12')][_0x09f8('0x11')]);}})[_0x09f8('0x13')](function(_0x36a115){logger[_0x09f8('0xe')](_0x09f8('0x10'),_0x565cfd,_0x36a115);_0x362c88(_0x36a115);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 198661f..60e2f4e 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 _0xa6b0=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x54ba64,_0x53b8a3){_0x54ba64=_0x54ba64-0x0;var _0x1ac7f9=_0xa6b0[_0x54ba64];return _0x1ac7f9;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var auth=require(_0x0a6b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a6b('0x5'));var controller=require(_0x0a6b('0x6'));router[_0x0a6b('0x7')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x9')]);router[_0x0a6b('0x7')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xb')]);router[_0x0a6b('0xc')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xd')]);router['put']('/:id',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xe')]);router[_0x0a6b('0xf')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x10')]);module[_0x0a6b('0x11')]=router; \ No newline at end of file +var _0xa6b0=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x102a8c,_0x480763){_0x102a8c=_0x102a8c-0x0;var _0x18085e=_0xa6b0[_0x102a8c];return _0x18085e;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var auth=require(_0x0a6b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a6b('0x5'));var controller=require(_0x0a6b('0x6'));router[_0x0a6b('0x7')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x9')]);router[_0x0a6b('0x7')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xb')]);router[_0x0a6b('0xc')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xd')]);router['put']('/:id',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xe')]);router[_0x0a6b('0xf')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x10')]);module[_0x0a6b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 89c2e11..c3bf19e 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 _0x7229=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x7229,0x148));var _0x9722=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7229[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x9722('0x0'));module[_0x9722('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9722('0x2'),_0x9722('0x3'),_0x9722('0x4'),_0x9722('0x5')),'defaultValue':_0x9722('0x2')},'content':{'type':Sequelize[_0x9722('0x6')]},'key':{'type':Sequelize[_0x9722('0x6')]},'keyType':{'type':Sequelize[_0x9722('0x7')]('string',_0x9722('0x3'),_0x9722('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9722('0x6')]},'variableName':{'type':Sequelize[_0x9722('0x6')]}}; \ No newline at end of file +var _0x7caa=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x20b3fe,_0x1c04c4){var _0x2749e0=function(_0x4cacde){while(--_0x4cacde){_0x20b3fe['push'](_0x20b3fe['shift']());}};_0x2749e0(++_0x1c04c4);}(_0x7caa,0x77));var _0xa7ca=function(_0x246663,_0x5dbfb0){_0x246663=_0x246663-0x0;var _0x404a3f=_0x7caa[_0x246663];return _0x404a3f;};'use strict';var Sequelize=require(_0xa7ca('0x0'));module['exports']={'type':{'type':Sequelize[_0xa7ca('0x1')](_0xa7ca('0x2'),_0xa7ca('0x3'),_0xa7ca('0x4'),_0xa7ca('0x5')),'defaultValue':_0xa7ca('0x2')},'content':{'type':Sequelize[_0xa7ca('0x6')]},'key':{'type':Sequelize[_0xa7ca('0x6')]},'keyType':{'type':Sequelize[_0xa7ca('0x1')]('string',_0xa7ca('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa7ca('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xa7ca('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 88a3b0c..149a15a 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 _0xdc61=['key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','then','end','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName'];(function(_0x3a1277,_0x56111c){var _0x1bdd87=function(_0x3beeab){while(--_0x3beeab){_0x3a1277['push'](_0x3a1277['shift']());}};_0x1bdd87(++_0x56111c);}(_0xdc61,0xf8));var _0x1dc6=function(_0x3345b1,_0x1f4769){_0x3345b1=_0x3345b1-0x0;var _0x9cf49d=_0xdc61[_0x3345b1];return _0x9cf49d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1dc6('0x0'));var rimraf=require(_0x1dc6('0x1'));var zipdir=require(_0x1dc6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1dc6('0x3'));var moment=require(_0x1dc6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1dc6('0x5'));var util=require(_0x1dc6('0x6'));var path=require(_0x1dc6('0x7'));var sox=require(_0x1dc6('0x8'));var csv=require('to-csv');var ejs=require(_0x1dc6('0x9'));var fs=require('fs');var _=require(_0x1dc6('0xa'));var squel=require(_0x1dc6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1dc6('0xc'));var querystring=require(_0x1dc6('0xd'));var Papa=require(_0x1dc6('0xe'));var Redis=require(_0x1dc6('0xf'));var authService=require(_0x1dc6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dc6('0x11'));var logger=require(_0x1dc6('0x12'))(_0x1dc6('0x13'));var utils=require(_0x1dc6('0x14'));var config=require(_0x1dc6('0x15'));var licenseUtil=require(_0x1dc6('0x16'));var db=require(_0x1dc6('0x17'))['db'];function respondWithStatusCode(_0x58f4a2,_0x58bcd1){_0x58bcd1=_0x58bcd1||0xcc;return function(_0xa9a44c){if(_0xa9a44c){return _0x58f4a2['sendStatus'](_0x58bcd1);}return _0x58f4a2[_0x1dc6('0x18')](_0x58bcd1)['end']();};}function respondWithResult(_0x1cf2e1,_0x71edf5){_0x71edf5=_0x71edf5||0xc8;return function(_0x3fdb41){if(_0x3fdb41){return _0x1cf2e1['status'](_0x71edf5)['json'](_0x3fdb41);}};}function respondWithFilteredResult(_0x215ea5,_0x28362b){return function(_0x1737a8){if(_0x1737a8){var _0x306855=_0x1737a8['count'],_0x5e3ca8=_0x28362b['offset'],_0x4c4cf6=_0x28362b[_0x1dc6('0x19')]+_0x28362b[_0x1dc6('0x1a')],_0x26f306;if(_0x4c4cf6>=_0x306855){_0x4c4cf6=_0x306855;_0x26f306=0xc8;}else{_0x26f306=0xce;}_0x215ea5[_0x1dc6('0x18')](_0x26f306);return _0x215ea5[_0x1dc6('0x1b')](_0x1dc6('0x1c'),_0x5e3ca8+'-'+_0x4c4cf6+'/'+_0x306855)[_0x1dc6('0x1d')](_0x1737a8);}return null;};}function patchUpdates(_0x49afb9){return function(_0x47e90b){try{jsonpatch[_0x1dc6('0x1e')](_0x47e90b,_0x49afb9,!![]);}catch(_0x556fdc){return BPromise[_0x1dc6('0x1f')](_0x556fdc);}return _0x47e90b['save']();};}function saveUpdates(_0x19f07e,_0x2cdd09){return function(_0x3906e0){if(_0x3906e0){return _0x3906e0['update'](_0x19f07e)[_0x1dc6('0x20')](function(_0x2905f7){return _0x2905f7;});}return null;};}function removeEntity(_0x26fd48,_0x3207a7){return function(_0x3badb4){if(_0x3badb4){return _0x3badb4['destroy']()[_0x1dc6('0x20')](function(){_0x26fd48['status'](0xcc)[_0x1dc6('0x21')]();});}};}function handleEntityNotFound(_0x18766c,_0x5518c8){return function(_0x4facb8){if(!_0x4facb8){_0x18766c[_0x1dc6('0x22')](0x194);}return _0x4facb8;};}function handleError(_0x3e0810,_0x32e7fd){_0x32e7fd=_0x32e7fd||0x1f4;return function(_0x2977ef){logger[_0x1dc6('0x23')](_0x2977ef[_0x1dc6('0x24')]);if(_0x2977ef[_0x1dc6('0x25')]){delete _0x2977ef[_0x1dc6('0x25')];}_0x3e0810['status'](_0x32e7fd)[_0x1dc6('0x26')](_0x2977ef);};}exports[_0x1dc6('0x27')]=function(_0x8fa9ba,_0x77b27b){var _0x1d5ddd={},_0x109586={},_0x5bd245={'count':0x0,'rows':[]};var _0x13428a=_[_0x1dc6('0x28')](db[_0x1dc6('0x29')][_0x1dc6('0x2a')],function(_0x6347bd){return{'name':_0x6347bd[_0x1dc6('0x2b')],'type':_0x6347bd['type'][_0x1dc6('0x2c')]};});_0x109586[_0x1dc6('0x2d')]=_[_0x1dc6('0x28')](_0x13428a,'name');_0x109586[_0x1dc6('0x2e')]=_[_0x1dc6('0x2f')](_0x8fa9ba['query']);_0x109586['filters']=_[_0x1dc6('0x30')](_0x109586[_0x1dc6('0x2d')],_0x109586[_0x1dc6('0x2e')]);_0x1d5ddd[_0x1dc6('0x31')]=_[_0x1dc6('0x30')](_0x109586['model'],qs[_0x1dc6('0x32')](_0x8fa9ba[_0x1dc6('0x2e')][_0x1dc6('0x32')]));_0x1d5ddd['attributes']=_0x1d5ddd[_0x1dc6('0x31')][_0x1dc6('0x33')]?_0x1d5ddd[_0x1dc6('0x31')]:_0x109586[_0x1dc6('0x2d')];if(!_0x8fa9ba[_0x1dc6('0x2e')]['hasOwnProperty'](_0x1dc6('0x34'))){_0x1d5ddd[_0x1dc6('0x1a')]=qs[_0x1dc6('0x1a')](_0x8fa9ba[_0x1dc6('0x2e')][_0x1dc6('0x1a')]);_0x1d5ddd[_0x1dc6('0x19')]=qs[_0x1dc6('0x19')](_0x8fa9ba[_0x1dc6('0x2e')][_0x1dc6('0x19')]);}_0x1d5ddd[_0x1dc6('0x35')]=qs['sort'](_0x8fa9ba[_0x1dc6('0x2e')]['sort']);_0x1d5ddd[_0x1dc6('0x36')]=qs[_0x1dc6('0x37')](_['pick'](_0x8fa9ba[_0x1dc6('0x2e')],_0x109586[_0x1dc6('0x37')]),_0x13428a);if(_0x8fa9ba[_0x1dc6('0x2e')][_0x1dc6('0x38')]){_0x1d5ddd['where']=_['merge'](_0x1d5ddd[_0x1dc6('0x36')],{'$or':_[_0x1dc6('0x28')](_0x13428a,function(_0x6659c2){if(_0x6659c2[_0x1dc6('0x39')]!==_0x1dc6('0x3a')){var _0xbcb170={};_0xbcb170[_0x6659c2['name']]={'$like':'%'+_0x8fa9ba['query'][_0x1dc6('0x38')]+'%'};return _0xbcb170;}})});}_0x1d5ddd=_[_0x1dc6('0x3b')]({},_0x1d5ddd,_0x8fa9ba[_0x1dc6('0x3c')]);var _0x380905={'where':_0x1d5ddd['where']};return db[_0x1dc6('0x29')][_0x1dc6('0x3d')](_0x380905)['then'](function(_0x450c5a){_0x5bd245['count']=_0x450c5a;if(_0x8fa9ba[_0x1dc6('0x2e')][_0x1dc6('0x3e')]){_0x1d5ddd[_0x1dc6('0x3f')]=[{'all':!![]}];}return db[_0x1dc6('0x29')][_0x1dc6('0x40')](_0x1d5ddd);})['then'](function(_0x1bb3f0){_0x5bd245[_0x1dc6('0x41')]=_0x1bb3f0;return _0x5bd245;})[_0x1dc6('0x20')](respondWithFilteredResult(_0x77b27b,_0x1d5ddd))[_0x1dc6('0x42')](handleError(_0x77b27b,null));};exports[_0x1dc6('0x43')]=function(_0x89fbf6,_0x5c3fca){var _0x55303f={'raw':!![],'where':{'id':_0x89fbf6['params']['id']}},_0x5ea837={};_0x5ea837['model']=_['keys'](db[_0x1dc6('0x29')][_0x1dc6('0x2a')]);_0x5ea837[_0x1dc6('0x2e')]=_['keys'](_0x89fbf6[_0x1dc6('0x2e')]);_0x5ea837[_0x1dc6('0x37')]=_['intersection'](_0x5ea837[_0x1dc6('0x2d')],_0x5ea837['query']);_0x55303f[_0x1dc6('0x31')]=_['intersection'](_0x5ea837[_0x1dc6('0x2d')],qs[_0x1dc6('0x32')](_0x89fbf6['query'][_0x1dc6('0x32')]));_0x55303f[_0x1dc6('0x31')]=_0x55303f[_0x1dc6('0x31')][_0x1dc6('0x33')]?_0x55303f[_0x1dc6('0x31')]:_0x5ea837['model'];if(_0x89fbf6[_0x1dc6('0x2e')][_0x1dc6('0x3e')]){_0x55303f['include']=[{'all':!![]}];}_0x55303f=_[_0x1dc6('0x3b')]({},_0x55303f,_0x89fbf6['options']);return db[_0x1dc6('0x29')][_0x1dc6('0x44')](_0x55303f)[_0x1dc6('0x20')](handleEntityNotFound(_0x5c3fca,null))['then'](respondWithResult(_0x5c3fca,null))['catch'](handleError(_0x5c3fca,null));};exports['create']=function(_0x3b77b0,_0x3ee63e){return db['SalesforceField'][_0x1dc6('0x45')](_0x3b77b0[_0x1dc6('0x46')],{})[_0x1dc6('0x20')](respondWithResult(_0x3ee63e,0xc9))[_0x1dc6('0x42')](handleError(_0x3ee63e,null));};exports['update']=function(_0xf48a64,_0x5446a8){if(_0xf48a64[_0x1dc6('0x46')]['id']){delete _0xf48a64[_0x1dc6('0x46')]['id'];}return db[_0x1dc6('0x29')][_0x1dc6('0x44')]({'where':{'id':_0xf48a64[_0x1dc6('0x47')]['id']}})[_0x1dc6('0x20')](handleEntityNotFound(_0x5446a8,null))[_0x1dc6('0x20')](saveUpdates(_0xf48a64[_0x1dc6('0x46')],null))[_0x1dc6('0x20')](respondWithResult(_0x5446a8,null))[_0x1dc6('0x42')](handleError(_0x5446a8,null));};exports[_0x1dc6('0x48')]=function(_0x2fde34,_0x317db){return db[_0x1dc6('0x29')][_0x1dc6('0x44')]({'where':{'id':_0x2fde34[_0x1dc6('0x47')]['id']}})[_0x1dc6('0x20')](handleEntityNotFound(_0x317db,null))['then'](removeEntity(_0x317db,null))[_0x1dc6('0x42')](handleError(_0x317db,null));}; \ No newline at end of file +var _0xd316=['index','map','SalesforceField','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x408fa4,_0x44c5ff){var _0x197c39=function(_0x2d485d){while(--_0x2d485d){_0x408fa4['push'](_0x408fa4['shift']());}};_0x197c39(++_0x44c5ff);}(_0xd316,0x195));var _0x6d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd316[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6d31('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6d31('0x1'));var zipdir=require(_0x6d31('0x2'));var jsonpatch=require(_0x6d31('0x3'));var rp=require('request-promise');var moment=require(_0x6d31('0x4'));var BPromise=require(_0x6d31('0x5'));var Mustache=require('mustache');var util=require(_0x6d31('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6d31('0x7'));var ejs=require(_0x6d31('0x8'));var fs=require('fs');var _=require(_0x6d31('0x9'));var squel=require(_0x6d31('0xa'));var crypto=require(_0x6d31('0xb'));var jsforce=require(_0x6d31('0xc'));var deskjs=require(_0x6d31('0xd'));var toCsv=require(_0x6d31('0x7'));var querystring=require(_0x6d31('0xe'));var Papa=require(_0x6d31('0xf'));var Redis=require(_0x6d31('0x10'));var authService=require(_0x6d31('0x11'));var qs=require(_0x6d31('0x12'));var as=require(_0x6d31('0x13'));var hardwareService=require(_0x6d31('0x14'));var logger=require('../../config/logger')(_0x6d31('0x15'));var utils=require('../../config/utils');var config=require(_0x6d31('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d31('0x17'))['db'];function respondWithStatusCode(_0x2a99a5,_0x4b38d8){_0x4b38d8=_0x4b38d8||0xcc;return function(_0x546858){if(_0x546858){return _0x2a99a5[_0x6d31('0x18')](_0x4b38d8);}return _0x2a99a5[_0x6d31('0x19')](_0x4b38d8)[_0x6d31('0x1a')]();};}function respondWithResult(_0x5260e0,_0x344e62){_0x344e62=_0x344e62||0xc8;return function(_0x1d8cb3){if(_0x1d8cb3){return _0x5260e0[_0x6d31('0x19')](_0x344e62)[_0x6d31('0x1b')](_0x1d8cb3);}};}function respondWithFilteredResult(_0x4c9e53,_0x47ab47){return function(_0x40f9bb){if(_0x40f9bb){var _0x1ec44f=_0x40f9bb[_0x6d31('0x1c')],_0x38034a=_0x47ab47[_0x6d31('0x1d')],_0x28c31e=_0x47ab47[_0x6d31('0x1d')]+_0x47ab47['limit'],_0x1f6f9b;if(_0x28c31e>=_0x1ec44f){_0x28c31e=_0x1ec44f;_0x1f6f9b=0xc8;}else{_0x1f6f9b=0xce;}_0x4c9e53[_0x6d31('0x19')](_0x1f6f9b);return _0x4c9e53['set'](_0x6d31('0x1e'),_0x38034a+'-'+_0x28c31e+'/'+_0x1ec44f)[_0x6d31('0x1b')](_0x40f9bb);}return null;};}function patchUpdates(_0x3e9723){return function(_0x5cf732){try{jsonpatch[_0x6d31('0x1f')](_0x5cf732,_0x3e9723,!![]);}catch(_0x33b151){return BPromise[_0x6d31('0x20')](_0x33b151);}return _0x5cf732[_0x6d31('0x21')]();};}function saveUpdates(_0x784397,_0x145f9c){return function(_0x3a8f34){if(_0x3a8f34){return _0x3a8f34[_0x6d31('0x22')](_0x784397)['then'](function(_0x657268){return _0x657268;});}return null;};}function removeEntity(_0x3f7e99,_0x1abbd5){return function(_0x4bd61b){if(_0x4bd61b){return _0x4bd61b['destroy']()[_0x6d31('0x23')](function(){_0x3f7e99[_0x6d31('0x19')](0xcc)[_0x6d31('0x1a')]();});}};}function handleEntityNotFound(_0x2c589a,_0x22aa2f){return function(_0x4e1666){if(!_0x4e1666){_0x2c589a[_0x6d31('0x18')](0x194);}return _0x4e1666;};}function handleError(_0xf21a87,_0x49ce3e){_0x49ce3e=_0x49ce3e||0x1f4;return function(_0x40bb51){logger[_0x6d31('0x24')](_0x40bb51['stack']);if(_0x40bb51[_0x6d31('0x25')]){delete _0x40bb51['name'];}_0xf21a87[_0x6d31('0x19')](_0x49ce3e)[_0x6d31('0x26')](_0x40bb51);};}exports[_0x6d31('0x27')]=function(_0x1b8fc8,_0x376db4){var _0xbc737a={},_0x3cdec6={},_0x195b36={'count':0x0,'rows':[]};var _0x359334=_[_0x6d31('0x28')](db[_0x6d31('0x29')]['rawAttributes'],function(_0x7fa9d6){return{'name':_0x7fa9d6['fieldName'],'type':_0x7fa9d6[_0x6d31('0x2a')][_0x6d31('0x2b')]};});_0x3cdec6[_0x6d31('0x2c')]=_[_0x6d31('0x28')](_0x359334,_0x6d31('0x25'));_0x3cdec6[_0x6d31('0x2d')]=_[_0x6d31('0x2e')](_0x1b8fc8[_0x6d31('0x2d')]);_0x3cdec6[_0x6d31('0x2f')]=_[_0x6d31('0x30')](_0x3cdec6['model'],_0x3cdec6[_0x6d31('0x2d')]);_0xbc737a[_0x6d31('0x31')]=_[_0x6d31('0x30')](_0x3cdec6[_0x6d31('0x2c')],qs[_0x6d31('0x32')](_0x1b8fc8['query']['fields']));_0xbc737a[_0x6d31('0x31')]=_0xbc737a['attributes']['length']?_0xbc737a[_0x6d31('0x31')]:_0x3cdec6[_0x6d31('0x2c')];if(!_0x1b8fc8[_0x6d31('0x2d')][_0x6d31('0x33')](_0x6d31('0x34'))){_0xbc737a[_0x6d31('0x35')]=qs[_0x6d31('0x35')](_0x1b8fc8[_0x6d31('0x2d')]['limit']);_0xbc737a['offset']=qs[_0x6d31('0x1d')](_0x1b8fc8['query'][_0x6d31('0x1d')]);}_0xbc737a[_0x6d31('0x36')]=qs[_0x6d31('0x37')](_0x1b8fc8[_0x6d31('0x2d')][_0x6d31('0x37')]);_0xbc737a[_0x6d31('0x38')]=qs[_0x6d31('0x2f')](_[_0x6d31('0x39')](_0x1b8fc8[_0x6d31('0x2d')],_0x3cdec6[_0x6d31('0x2f')]),_0x359334);if(_0x1b8fc8[_0x6d31('0x2d')][_0x6d31('0x3a')]){_0xbc737a['where']=_[_0x6d31('0x3b')](_0xbc737a[_0x6d31('0x38')],{'$or':_[_0x6d31('0x28')](_0x359334,function(_0x3370eb){if(_0x3370eb[_0x6d31('0x2a')]!==_0x6d31('0x3c')){var _0xe2df1b={};_0xe2df1b[_0x3370eb[_0x6d31('0x25')]]={'$like':'%'+_0x1b8fc8[_0x6d31('0x2d')][_0x6d31('0x3a')]+'%'};return _0xe2df1b;}})});}_0xbc737a=_[_0x6d31('0x3b')]({},_0xbc737a,_0x1b8fc8[_0x6d31('0x3d')]);var _0x112021={'where':_0xbc737a[_0x6d31('0x38')]};return db[_0x6d31('0x29')][_0x6d31('0x1c')](_0x112021)[_0x6d31('0x23')](function(_0x33a923){_0x195b36[_0x6d31('0x1c')]=_0x33a923;if(_0x1b8fc8[_0x6d31('0x2d')][_0x6d31('0x3e')]){_0xbc737a[_0x6d31('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x6d31('0x40')](_0xbc737a);})['then'](function(_0x348d71){_0x195b36[_0x6d31('0x41')]=_0x348d71;return _0x195b36;})[_0x6d31('0x23')](respondWithFilteredResult(_0x376db4,_0xbc737a))[_0x6d31('0x42')](handleError(_0x376db4,null));};exports[_0x6d31('0x43')]=function(_0x595254,_0x2e896f){var _0x1db621={'raw':!![],'where':{'id':_0x595254[_0x6d31('0x44')]['id']}},_0x525ad9={};_0x525ad9['model']=_[_0x6d31('0x2e')](db['SalesforceField'][_0x6d31('0x45')]);_0x525ad9[_0x6d31('0x2d')]=_[_0x6d31('0x2e')](_0x595254[_0x6d31('0x2d')]);_0x525ad9[_0x6d31('0x2f')]=_[_0x6d31('0x30')](_0x525ad9['model'],_0x525ad9[_0x6d31('0x2d')]);_0x1db621['attributes']=_[_0x6d31('0x30')](_0x525ad9[_0x6d31('0x2c')],qs[_0x6d31('0x32')](_0x595254[_0x6d31('0x2d')]['fields']));_0x1db621[_0x6d31('0x31')]=_0x1db621[_0x6d31('0x31')]['length']?_0x1db621[_0x6d31('0x31')]:_0x525ad9[_0x6d31('0x2c')];if(_0x595254[_0x6d31('0x2d')]['includeAll']){_0x1db621['include']=[{'all':!![]}];}_0x1db621=_[_0x6d31('0x3b')]({},_0x1db621,_0x595254[_0x6d31('0x3d')]);return db['SalesforceField'][_0x6d31('0x46')](_0x1db621)[_0x6d31('0x23')](handleEntityNotFound(_0x2e896f,null))[_0x6d31('0x23')](respondWithResult(_0x2e896f,null))[_0x6d31('0x42')](handleError(_0x2e896f,null));};exports['create']=function(_0x7c9e75,_0x1ca169){return db[_0x6d31('0x29')][_0x6d31('0x47')](_0x7c9e75['body'],{})[_0x6d31('0x23')](respondWithResult(_0x1ca169,0xc9))[_0x6d31('0x42')](handleError(_0x1ca169,null));};exports[_0x6d31('0x22')]=function(_0x247053,_0x39ccd6){if(_0x247053[_0x6d31('0x48')]['id']){delete _0x247053[_0x6d31('0x48')]['id'];}return db[_0x6d31('0x29')][_0x6d31('0x46')]({'where':{'id':_0x247053[_0x6d31('0x44')]['id']}})['then'](handleEntityNotFound(_0x39ccd6,null))[_0x6d31('0x23')](saveUpdates(_0x247053[_0x6d31('0x48')],null))[_0x6d31('0x23')](respondWithResult(_0x39ccd6,null))['catch'](handleError(_0x39ccd6,null));};exports[_0x6d31('0x49')]=function(_0x17ad39,_0x1c96a9){return db[_0x6d31('0x29')][_0x6d31('0x46')]({'where':{'id':_0x17ad39[_0x6d31('0x44')]['id']}})[_0x6d31('0x23')](handleEntityNotFound(_0x1c96a9,null))[_0x6d31('0x23')](removeEntity(_0x1c96a9,null))[_0x6d31('0x42')](handleError(_0x1c96a9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c22939f..47488c6 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 _0xcb81=['define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x1b01c4,_0x5f033d){var _0x4d5f2a=function(_0x20ce9a){while(--_0x20ce9a){_0x1b01c4['push'](_0x1b01c4['shift']());}};_0x4d5f2a(++_0x5f033d);}(_0xcb81,0x154));var _0x1cb8=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0xcb81[_0x1b8b95];return _0x3657ae;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb8('0x3'));var rimraf=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var attributes=require(_0x1cb8('0x6'));module[_0x1cb8('0x7')]=function(_0x4e5c19,_0x98d682){return _0x4e5c19[_0x1cb8('0x8')]('SalesforceField',attributes,{'tableName':_0x1cb8('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb8('0xa'),'fields':[_0x1cb8('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf961=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xf961,0x1cf));var _0x1f96=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xf961[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var logger=require(_0x1f96('0x2'))(_0x1f96('0x3'));var moment=require('moment');var BPromise=require(_0x1f96('0x4'));var rp=require(_0x1f96('0x5'));var fs=require('fs');var path=require(_0x1f96('0x6'));var rimraf=require('rimraf');var config=require(_0x1f96('0x7'));var attributes=require(_0x1f96('0x8'));module[_0x1f96('0x9')]=function(_0x518062,_0x40caad){return _0x518062['define'](_0x1f96('0xa'),attributes,{'tableName':_0x1f96('0xb'),'paranoid':![],'indexes':[{'name':_0x1f96('0xc'),'fields':[_0x1f96('0xd'),_0x1f96('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index e4c7ebb..153c0e9 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 _0xac4a=['SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xac4a,0x13f));var _0xaac4=function(_0x5dbf8f,_0x5a9ae8){_0x5dbf8f=_0x5dbf8f-0x0;var _0x437be6=_0xac4a[_0x5dbf8f];return _0x437be6;};'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')]('SalesforceField,\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')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3c81d2,_0x523595){var _0x1c8689=function(_0x1adab7){while(--_0x1adab7){_0x3c81d2['push'](_0x3c81d2['shift']());}};_0x1c8689(++_0x523595);}(_0x878f,0x173));var _0xf878=function(_0x5b0b20,_0x418b4b){_0x5b0b20=_0x5b0b20-0x0;var _0x3e231f=_0x878f[_0x5b0b20];return _0x3e231f;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cdb5d8f..a1f5b59 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 _0xe5e4=['put','update','delete','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x360af7,_0x40bc21){var _0x430720=function(_0x1a4325){while(--_0x1a4325){_0x360af7['push'](_0x360af7['shift']());}};_0x430720(++_0x40bc21);}(_0xe5e4,0xac));var _0x4e5e=function(_0x5d99b5,_0x21093f){_0x5d99b5=_0x5d99b5-0x0;var _0x4aaea8=_0xe5e4[_0x5d99b5];return _0x4aaea8;};'use strict';var multer=require(_0x4e5e('0x0'));var util=require('util');var path=require(_0x4e5e('0x1'));var timeout=require(_0x4e5e('0x2'));var express=require(_0x4e5e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4e5e('0x4'));var config=require(_0x4e5e('0x5'));var controller=require(_0x4e5e('0x6'));router[_0x4e5e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4e5e('0x7')](_0x4e5e('0x8'),auth[_0x4e5e('0x9')](),controller[_0x4e5e('0xa')]);router[_0x4e5e('0x7')](_0x4e5e('0xb'),auth['isAuthenticated'](),controller[_0x4e5e('0xc')]);router[_0x4e5e('0x7')](_0x4e5e('0xd'),auth[_0x4e5e('0x9')](),controller[_0x4e5e('0xe')]);router['post']('/',auth[_0x4e5e('0x9')](),controller[_0x4e5e('0xf')]);router[_0x4e5e('0x10')](_0x4e5e('0xb'),auth[_0x4e5e('0x9')](),controller['addConfiguration']);router[_0x4e5e('0x11')](_0x4e5e('0x8'),auth[_0x4e5e('0x9')](),controller[_0x4e5e('0x12')]);router[_0x4e5e('0x13')](_0x4e5e('0x8'),auth['isAuthenticated'](),controller[_0x4e5e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5b0a=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x169a8a,_0x3526b1){var _0x2e8502=function(_0x4c37f3){while(--_0x4c37f3){_0x169a8a['push'](_0x169a8a['shift']());}};_0x2e8502(++_0x3526b1);}(_0x5b0a,0xcd));var _0xa5b0=function(_0x1c076e,_0x5170ca){_0x1c076e=_0x1c076e-0x0;var _0x32817c=_0x5b0a[_0x1c076e];return _0x32817c;};'use strict';var multer=require(_0xa5b0('0x0'));var util=require(_0xa5b0('0x1'));var path=require(_0xa5b0('0x2'));var timeout=require(_0xa5b0('0x3'));var express=require(_0xa5b0('0x4'));var router=express[_0xa5b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa5b0('0x6'));var config=require('../../config/environment');var controller=require(_0xa5b0('0x7'));router[_0xa5b0('0x8')]('/',auth[_0xa5b0('0x9')](),controller[_0xa5b0('0xa')]);router[_0xa5b0('0x8')](_0xa5b0('0xb'),auth[_0xa5b0('0x9')](),controller['show']);router[_0xa5b0('0x8')](_0xa5b0('0xc'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0xd')]);router[_0xa5b0('0x8')](_0xa5b0('0xe'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa5b0('0x10')]);router[_0xa5b0('0x11')]('/:id/configurations',auth[_0xa5b0('0x9')](),controller[_0xa5b0('0x12')]);router[_0xa5b0('0x13')](_0xa5b0('0xb'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0x14')]);router[_0xa5b0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xa5b0('0x16')]);module[_0xa5b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d0c2931..977d906 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 _0xf61f=['sequelize','STRING','username'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0xf61f,0xf9));var _0xff61=function(_0x392aea,_0x47d79a){_0x392aea=_0x392aea-0x0;var _0x237810=_0xf61f[_0x392aea];return _0x237810;};'use strict';var Sequelize=require(_0xff61('0x0'));module['exports']={'name':{'type':Sequelize[_0xff61('0x1')]},'description':{'type':Sequelize[_0xff61('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xff61('0x2')},'password':{'type':Sequelize[_0xff61('0x1')]},'email':{'type':Sequelize[_0xff61('0x1')]},'remoteUri':{'type':Sequelize[_0xff61('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xff61('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe242=['STRING','username','remoteUri','exports'];(function(_0x279862,_0x4ecc50){var _0x186d2e=function(_0x5c588e){while(--_0x5c588e){_0x279862['push'](_0x279862['shift']());}};_0x186d2e(++_0x4ecc50);}(_0xe242,0x15f));var _0x2e24=function(_0x213938,_0x301d3b){_0x213938=_0x213938-0x0;var _0x21612c=_0xe242[_0x213938];return _0x21612c;};'use strict';var Sequelize=require('sequelize');module[_0x2e24('0x0')]={'name':{'type':Sequelize[_0x2e24('0x1')]},'description':{'type':Sequelize[_0x2e24('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2e24('0x2')},'password':{'type':Sequelize[_0x2e24('0x1')]},'email':{'type':Sequelize[_0x2e24('0x1')]},'remoteUri':{'type':Sequelize[_0x2e24('0x1')],'unique':_0x2e24('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 3c478b1..a9fdebb 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 _0xcd88=['GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','order','sort','filters','pick','filter','where','merge','options','ServicenowAccount','findAll','show','params','includeAll','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','ServicenowField','Subjects','getFields','made_sla','subcategory','close_code','notify','incident_state','severity','category','watch_list','upon_reject','sys_updated_on','hold_reason','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','password','email','remoteUri','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/'];(function(_0x3b0f42,_0x5718cb){var _0x155933=function(_0x59feb2){while(--_0x59feb2){_0x3b0f42['push'](_0x3b0f42['shift']());}};_0x155933(++_0x5718cb);}(_0xcd88,0x199));var _0x8cd8=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xcd88[_0x59d89e];return _0x554e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8cd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cd8('0x1'));var jsonpatch=require(_0x8cd8('0x2'));var rp=require(_0x8cd8('0x3'));var moment=require(_0x8cd8('0x4'));var BPromise=require(_0x8cd8('0x5'));var Mustache=require('mustache');var util=require(_0x8cd8('0x6'));var path=require(_0x8cd8('0x7'));var sox=require(_0x8cd8('0x8'));var csv=require('to-csv');var ejs=require(_0x8cd8('0x9'));var fs=require('fs');var _=require(_0x8cd8('0xa'));var squel=require(_0x8cd8('0xb'));var crypto=require(_0x8cd8('0xc'));var jsforce=require(_0x8cd8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8cd8('0xe'));var querystring=require(_0x8cd8('0xf'));var Papa=require(_0x8cd8('0x10'));var Redis=require('ioredis');var authService=require(_0x8cd8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cd8('0x12'))('api');var utils=require(_0x8cd8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8cd8('0x14'));var db=require(_0x8cd8('0x15'))['db'];var integrations=require(_0x8cd8('0x16'));var jayson=require(_0x8cd8('0x17'));var client=jayson['client'][_0x8cd8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4764fe,_0x29de94,_0x5c61ca,_0x374b91){return new BPromise(function(_0x484175,_0x18fc4c){var _0x112c1f=_0x374b91||client;return _0x112c1f[_0x8cd8('0x19')](_0x4764fe,_0x5c61ca)['then'](function(_0x2a970c){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x29de94,_0x8cd8('0x1a'));logger['debug'](_0x8cd8('0x1b'),_0x29de94,_0x8cd8('0x1a'),JSON[_0x8cd8('0x1c')](_0x2a970c));if(_0x2a970c[_0x8cd8('0x1d')]){if(_0x2a970c['error'][_0x8cd8('0x1e')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x29de94,_0x2a970c[_0x8cd8('0x1d')]['message']);return _0x18fc4c(_0x2a970c[_0x8cd8('0x1d')]['message']);}logger[_0x8cd8('0x1d')](_0x8cd8('0x1f'),_0x29de94,_0x2a970c['error'][_0x8cd8('0x20')]);return _0x484175(_0x2a970c[_0x8cd8('0x1d')][_0x8cd8('0x20')]);}else{logger[_0x8cd8('0x21')](_0x8cd8('0x1f'),_0x29de94,_0x8cd8('0x1a'));_0x484175(_0x2a970c[_0x8cd8('0x22')][_0x8cd8('0x20')]);}})[_0x8cd8('0x23')](function(_0x730f91){logger[_0x8cd8('0x1d')](_0x8cd8('0x1f'),_0x29de94,_0x730f91);_0x18fc4c(_0x730f91);});});}function respondWithStatusCode(_0x5aba11,_0x4b1ada){_0x4b1ada=_0x4b1ada||0xcc;return function(_0x3fde74){if(_0x3fde74){return _0x5aba11[_0x8cd8('0x24')](_0x4b1ada);}return _0x5aba11['status'](_0x4b1ada)[_0x8cd8('0x25')]();};}function respondWithResult(_0x5becfb,_0x199c49){_0x199c49=_0x199c49||0xc8;return function(_0x2a2dc7){if(_0x2a2dc7){return _0x5becfb[_0x8cd8('0x26')](_0x199c49)[_0x8cd8('0x27')](_0x2a2dc7);}};}function respondWithFilteredResult(_0x5e6189,_0x53ada0){return function(_0x15384b){if(_0x15384b){var _0x455474=_0x15384b[_0x8cd8('0x28')],_0x5a20da=_0x53ada0[_0x8cd8('0x29')],_0x18e68d=_0x53ada0[_0x8cd8('0x29')]+_0x53ada0[_0x8cd8('0x2a')],_0x13c879;if(_0x18e68d>=_0x455474){_0x18e68d=_0x455474;_0x13c879=0xc8;}else{_0x13c879=0xce;}_0x5e6189[_0x8cd8('0x26')](_0x13c879);return _0x5e6189['set'](_0x8cd8('0x2b'),_0x5a20da+'-'+_0x18e68d+'/'+_0x455474)[_0x8cd8('0x27')](_0x15384b);}return null;};}function patchUpdates(_0x21b703){return function(_0x488609){try{jsonpatch[_0x8cd8('0x2c')](_0x488609,_0x21b703,!![]);}catch(_0x27f480){return BPromise['reject'](_0x27f480);}return _0x488609['save']();};}function saveUpdates(_0x5250ff,_0x6b480c){return function(_0x47671b){if(_0x47671b){return _0x47671b[_0x8cd8('0x2d')](_0x5250ff)[_0x8cd8('0x2e')](function(_0x34aca6){return _0x34aca6;});}return null;};}function removeEntity(_0x365002,_0x123636){return function(_0x59fcd4){if(_0x59fcd4){return _0x59fcd4[_0x8cd8('0x2f')]()[_0x8cd8('0x2e')](function(){_0x365002[_0x8cd8('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x220b68,_0x17e526){return function(_0x196188){if(!_0x196188){_0x220b68[_0x8cd8('0x24')](0x194);}return _0x196188;};}function handleError(_0x378a10,_0x15bad5){_0x15bad5=_0x15bad5||0x1f4;return function(_0x217d48){logger[_0x8cd8('0x1d')](_0x217d48[_0x8cd8('0x30')]);if(_0x217d48['name']){delete _0x217d48['name'];}_0x378a10[_0x8cd8('0x26')](_0x15bad5)[_0x8cd8('0x31')](_0x217d48);};}exports[_0x8cd8('0x32')]=function(_0x3be92e,_0x9a40e4){var _0x5a282a={},_0x3f998c={},_0x2b20f2={'count':0x0,'rows':[]};var _0x1b95f4=_[_0x8cd8('0x33')](db['ServicenowAccount'][_0x8cd8('0x34')],function(_0x5049d1){return{'name':_0x5049d1[_0x8cd8('0x35')],'type':_0x5049d1[_0x8cd8('0x36')][_0x8cd8('0x37')]};});_0x3f998c[_0x8cd8('0x38')]=_[_0x8cd8('0x33')](_0x1b95f4,_0x8cd8('0x39'));_0x3f998c[_0x8cd8('0x3a')]=_[_0x8cd8('0x3b')](_0x3be92e[_0x8cd8('0x3a')]);_0x3f998c['filters']=_['intersection'](_0x3f998c[_0x8cd8('0x38')],_0x3f998c[_0x8cd8('0x3a')]);_0x5a282a['attributes']=_[_0x8cd8('0x3c')](_0x3f998c[_0x8cd8('0x38')],qs[_0x8cd8('0x3d')](_0x3be92e[_0x8cd8('0x3a')][_0x8cd8('0x3d')]));_0x5a282a[_0x8cd8('0x3e')]=_0x5a282a['attributes'][_0x8cd8('0x3f')]?_0x5a282a[_0x8cd8('0x3e')]:_0x3f998c[_0x8cd8('0x38')];if(!_0x3be92e[_0x8cd8('0x3a')]['hasOwnProperty']('nolimit')){_0x5a282a[_0x8cd8('0x2a')]=qs[_0x8cd8('0x2a')](_0x3be92e[_0x8cd8('0x3a')]['limit']);_0x5a282a[_0x8cd8('0x29')]=qs[_0x8cd8('0x29')](_0x3be92e[_0x8cd8('0x3a')][_0x8cd8('0x29')]);}_0x5a282a[_0x8cd8('0x40')]=qs[_0x8cd8('0x41')](_0x3be92e[_0x8cd8('0x3a')][_0x8cd8('0x41')]);_0x5a282a['where']=qs[_0x8cd8('0x42')](_[_0x8cd8('0x43')](_0x3be92e[_0x8cd8('0x3a')],_0x3f998c['filters']),_0x1b95f4);if(_0x3be92e[_0x8cd8('0x3a')][_0x8cd8('0x44')]){_0x5a282a[_0x8cd8('0x45')]=_[_0x8cd8('0x46')](_0x5a282a[_0x8cd8('0x45')],{'$or':_['map'](_0x1b95f4,function(_0xf69c88){if(_0xf69c88[_0x8cd8('0x36')]!=='VIRTUAL'){var _0x1111a0={};_0x1111a0[_0xf69c88['name']]={'$like':'%'+_0x3be92e[_0x8cd8('0x3a')]['filter']+'%'};return _0x1111a0;}})});}_0x5a282a=_[_0x8cd8('0x46')]({},_0x5a282a,_0x3be92e[_0x8cd8('0x47')]);var _0x312ebf={'where':_0x5a282a[_0x8cd8('0x45')]};return db[_0x8cd8('0x48')]['count'](_0x312ebf)[_0x8cd8('0x2e')](function(_0x39a0f0){_0x2b20f2['count']=_0x39a0f0;if(_0x3be92e[_0x8cd8('0x3a')]['includeAll']){_0x5a282a['include']=[{'all':!![]}];}return db[_0x8cd8('0x48')][_0x8cd8('0x49')](_0x5a282a);})[_0x8cd8('0x2e')](function(_0xfbcee){_0x2b20f2['rows']=_0xfbcee;return _0x2b20f2;})['then'](respondWithFilteredResult(_0x9a40e4,_0x5a282a))[_0x8cd8('0x23')](handleError(_0x9a40e4,null));};exports[_0x8cd8('0x4a')]=function(_0x2c78b2,_0x409a57){var _0x59cdf9={'raw':![],'where':{'id':_0x2c78b2[_0x8cd8('0x4b')]['id']}},_0x34ecd4={};_0x34ecd4['model']=_[_0x8cd8('0x3b')](db[_0x8cd8('0x48')]['rawAttributes']);_0x34ecd4[_0x8cd8('0x3a')]=_[_0x8cd8('0x3b')](_0x2c78b2[_0x8cd8('0x3a')]);_0x34ecd4[_0x8cd8('0x42')]=_['intersection'](_0x34ecd4[_0x8cd8('0x38')],_0x34ecd4['query']);_0x59cdf9[_0x8cd8('0x3e')]=_[_0x8cd8('0x3c')](_0x34ecd4[_0x8cd8('0x38')],qs[_0x8cd8('0x3d')](_0x2c78b2['query']['fields']));_0x59cdf9[_0x8cd8('0x3e')]=_0x59cdf9['attributes'][_0x8cd8('0x3f')]?_0x59cdf9[_0x8cd8('0x3e')]:_0x34ecd4[_0x8cd8('0x38')];if(_0x2c78b2['query'][_0x8cd8('0x4c')]){_0x59cdf9[_0x8cd8('0x4d')]=[{'all':!![]}];}_0x59cdf9=_[_0x8cd8('0x46')]({},_0x59cdf9,_0x2c78b2[_0x8cd8('0x47')]);return db[_0x8cd8('0x48')][_0x8cd8('0x4e')](_0x59cdf9)[_0x8cd8('0x2e')](handleEntityNotFound(_0x409a57,null))[_0x8cd8('0x2e')](respondWithResult(_0x409a57,null))['catch'](handleError(_0x409a57,null));};exports[_0x8cd8('0x4f')]=function(_0x527470,_0x51ef56){return db[_0x8cd8('0x48')]['create'](_0x527470['body'],{})['then'](respondWithResult(_0x51ef56,0xc9))[_0x8cd8('0x23')](handleError(_0x51ef56,null));};exports['update']=function(_0x9978bd,_0x41bac2){if(_0x9978bd['body']['id']){delete _0x9978bd[_0x8cd8('0x50')]['id'];}return db[_0x8cd8('0x48')][_0x8cd8('0x4e')]({'where':{'id':_0x9978bd[_0x8cd8('0x4b')]['id']}})[_0x8cd8('0x2e')](handleEntityNotFound(_0x41bac2,null))[_0x8cd8('0x2e')](saveUpdates(_0x9978bd[_0x8cd8('0x50')],null))[_0x8cd8('0x2e')](respondWithResult(_0x41bac2,null))[_0x8cd8('0x23')](handleError(_0x41bac2,null));};exports[_0x8cd8('0x2f')]=function(_0x55b5e3,_0x2d1d8f){return db[_0x8cd8('0x48')][_0x8cd8('0x4e')]({'where':{'id':_0x55b5e3['params']['id']}})['then'](handleEntityNotFound(_0x2d1d8f,null))['then'](removeEntity(_0x2d1d8f,null))[_0x8cd8('0x23')](handleError(_0x2d1d8f,null));};exports[_0x8cd8('0x51')]=function(_0x3089c8,_0x36ac1f,_0x2cf03f){var _0x2414b2={};var _0x3baaa3={};var _0x20ec03;var _0x2c8427;return db['ServicenowAccount'][_0x8cd8('0x52')]({'where':{'id':_0x3089c8['params']['id']}})[_0x8cd8('0x2e')](handleEntityNotFound(_0x36ac1f,null))[_0x8cd8('0x2e')](function(_0x453ce6){if(_0x453ce6){_0x20ec03=_0x453ce6;_0x3baaa3['model']=_[_0x8cd8('0x3b')](db[_0x8cd8('0x53')]['rawAttributes']);_0x3baaa3[_0x8cd8('0x3a')]=_[_0x8cd8('0x3b')](_0x3089c8[_0x8cd8('0x3a')]);_0x3baaa3[_0x8cd8('0x42')]=_[_0x8cd8('0x3c')](_0x3baaa3[_0x8cd8('0x38')],_0x3baaa3[_0x8cd8('0x3a')]);_0x2414b2['attributes']=_[_0x8cd8('0x3c')](_0x3baaa3[_0x8cd8('0x38')],qs[_0x8cd8('0x3d')](_0x3089c8[_0x8cd8('0x3a')][_0x8cd8('0x3d')]));_0x2414b2[_0x8cd8('0x3e')]=_0x2414b2[_0x8cd8('0x3e')][_0x8cd8('0x3f')]?_0x2414b2[_0x8cd8('0x3e')]:_0x3baaa3[_0x8cd8('0x38')];_0x2414b2[_0x8cd8('0x40')]=qs[_0x8cd8('0x41')](_0x3089c8[_0x8cd8('0x3a')][_0x8cd8('0x41')]);_0x2414b2[_0x8cd8('0x45')]=qs['filters'](_[_0x8cd8('0x43')](_0x3089c8[_0x8cd8('0x3a')],_0x3baaa3[_0x8cd8('0x42')]));if(_0x3089c8[_0x8cd8('0x3a')][_0x8cd8('0x44')]){_0x2414b2[_0x8cd8('0x45')]=_[_0x8cd8('0x46')](_0x2414b2[_0x8cd8('0x45')],{'$or':_[_0x8cd8('0x33')](_0x2414b2[_0x8cd8('0x3e')],function(_0x487019){var _0x4bb6ab={};_0x4bb6ab[_0x487019]={'$like':'%'+_0x3089c8[_0x8cd8('0x3a')][_0x8cd8('0x44')]+'%'};return _0x4bb6ab;})});}_0x2414b2=_[_0x8cd8('0x46')]({},_0x2414b2,_0x3089c8['options']);return _0x20ec03['getConfigurations'](_0x2414b2);}})[_0x8cd8('0x2e')](function(_0x49e504){if(_0x49e504){_0x2c8427=_0x49e504[_0x8cd8('0x3f')];if(!_0x3089c8[_0x8cd8('0x3a')][_0x8cd8('0x54')](_0x8cd8('0x55'))){_0x2414b2['limit']=qs[_0x8cd8('0x2a')](_0x3089c8['query'][_0x8cd8('0x2a')]);_0x2414b2[_0x8cd8('0x29')]=qs[_0x8cd8('0x29')](_0x3089c8[_0x8cd8('0x3a')][_0x8cd8('0x29')]);}return _0x20ec03['getConfigurations'](_0x2414b2);}})[_0x8cd8('0x2e')](function(_0xe57aa6){if(_0xe57aa6){return _0xe57aa6?{'count':_0x2c8427,'rows':_0xe57aa6}:null;}})['then'](respondWithResult(_0x36ac1f,null))[_0x8cd8('0x23')](handleError(_0x36ac1f,null));};exports[_0x8cd8('0x56')]=function(_0x323ae1,_0x491af5,_0x4b9f9e){if(_0x323ae1['body']['id']){delete _0x323ae1[_0x8cd8('0x50')]['id'];}return db['ServicenowAccount'][_0x8cd8('0x52')]({'where':{'id':_0x323ae1[_0x8cd8('0x4b')]['id']}})[_0x8cd8('0x2e')](handleEntityNotFound(_0x491af5,null))[_0x8cd8('0x2e')](function(_0x21baa4){if(_0x21baa4){_0x323ae1[_0x8cd8('0x50')][_0x8cd8('0x57')]=_0x21baa4['id'];_0x323ae1[_0x8cd8('0x50')]['Subjects']=integrations[_0x8cd8('0x58')](_0x323ae1[_0x8cd8('0x50')][_0x8cd8('0x59')],_0x323ae1[_0x8cd8('0x50')]['type']);_0x323ae1['body']['Descriptions']=integrations['getDescriptions'](_0x323ae1[_0x8cd8('0x50')][_0x8cd8('0x59')],_0x323ae1[_0x8cd8('0x50')][_0x8cd8('0x36')]);return db[_0x8cd8('0x53')][_0x8cd8('0x4f')](_0x323ae1['body'],{'include':[{'model':db[_0x8cd8('0x5a')],'as':_0x8cd8('0x5b')},{'model':db[_0x8cd8('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x491af5,null))[_0x8cd8('0x23')](handleError(_0x491af5,null));};exports[_0x8cd8('0x5c')]=function(_0x2d7d3e,_0x47683e,_0x3c9c11){var _0x340855=[_0x8cd8('0x5d'),'hold_reason','knowledge',_0x8cd8('0x5e'),_0x8cd8('0x5f'),_0x8cd8('0x60'),_0x8cd8('0x61'),_0x8cd8('0x62'),_0x8cd8('0x63')];var _0x57da8a=['parent',_0x8cd8('0x5d'),'caused_by',_0x8cd8('0x64'),_0x8cd8('0x65'),_0x8cd8('0x66'),'child_incidents',_0x8cd8('0x67'),'approval_history','number',_0x8cd8('0x68'),_0x8cd8('0x69'),_0x8cd8('0x6a'),_0x8cd8('0x6b'),_0x8cd8('0x6c'),_0x8cd8('0x6d'),_0x8cd8('0x6e'),_0x8cd8('0x6f'),'knowledge','order',_0x8cd8('0x70'),_0x8cd8('0x71'),_0x8cd8('0x72'),_0x8cd8('0x73'),_0x8cd8('0x74'),_0x8cd8('0x75'),_0x8cd8('0x76'),_0x8cd8('0x77'),'priority',_0x8cd8('0x78'),_0x8cd8('0x79'),_0x8cd8('0x7a'),_0x8cd8('0x7b'),_0x8cd8('0x7c'),'business_duration',_0x8cd8('0x7d'),_0x8cd8('0x7e'),_0x8cd8('0x7f'),_0x8cd8('0x80'),_0x8cd8('0x81'),_0x8cd8('0x82'),_0x8cd8('0x5e'),'work_notes',_0x8cd8('0x83'),_0x8cd8('0x5f'),_0x8cd8('0x84'),_0x8cd8('0x85'),_0x8cd8('0x86'),_0x8cd8('0x87'),_0x8cd8('0x88'),_0x8cd8('0x89'),_0x8cd8('0x8a'),_0x8cd8('0x8b'),_0x8cd8('0x60'),'sys_class_name',_0x8cd8('0x8c'),_0x8cd8('0x8d'),_0x8cd8('0x8e'),'parent_incident',_0x8cd8('0x8f'),_0x8cd8('0x90'),_0x8cd8('0x91'),_0x8cd8('0x61'),'urgency',_0x8cd8('0x92'),_0x8cd8('0x93'),_0x8cd8('0x94'),_0x8cd8('0x95'),_0x8cd8('0x96'),_0x8cd8('0x62'),'comments',_0x8cd8('0x97'),'approval',_0x8cd8('0x98'),_0x8cd8('0x99'),'sys_mod_count',_0x8cd8('0x9a'),_0x8cd8('0x9b'),_0x8cd8('0x9c'),_0x8cd8('0x9d'),_0x8cd8('0x9e'),'location','category'];var _0x3f4696='';var _0x3a0749='';var _0x51f545=[];var _0x8d7d26='';var _0x515f1a='';var _0x663a9d=[];var _0x3db092='';var _0x14985c='';var _0x409dab={};var _0x57596e='';return db[_0x8cd8('0x48')][_0x8cd8('0x52')]({'where':{'id':_0x2d7d3e['params']['id']},'attributes':['id',_0x8cd8('0x9f'),_0x8cd8('0xa0'),_0x8cd8('0xa1'),_0x8cd8('0xa2'),'serverUrl']})['then'](handleEntityNotFound(_0x47683e,null))[_0x8cd8('0x2e')](function(_0x1fb9b8){if(_0x1fb9b8){_0x57596e=_0x1fb9b8[_0x8cd8('0xa2')];var _0x25df85=_0x57596e['slice'](-0x1);if(_0x25df85==='/'){_0x57596e=_0x57596e[_0x8cd8('0xa3')](0x0,_0x57596e[_0x8cd8('0xa4')](_0x25df85));}_0x14985c=util['format'](_0x8cd8('0xa5'),_0x57596e);_0x3db092=util['format'](_0x8cd8('0xa6'),_0x57596e);_0x409dab={'user':_0x1fb9b8['username'],'pass':_0x1fb9b8[_0x8cd8('0xa0')]};var _0x3cb55f={'method':_0x8cd8('0xa7'),'uri':_0x14985c+_0x8cd8('0xa8'),'auth':_0x409dab,'json':!![]};return rp(_0x3cb55f);}})[_0x8cd8('0x2e')](function(_0x1177f5){if(_0x1177f5[_0x8cd8('0x22')][_0x8cd8('0x3f')]>0x0){_0x3f4696=_0x1177f5[_0x8cd8('0x22')];}console[_0x8cd8('0xa9')](_0x8cd8('0xaa'),_0x3f4696);_0x663a9d=[];_0x3a0749=Object[_0x8cd8('0xab')]([],_0x3f4696);_[_0x8cd8('0xac')](_0x3a0749,function(_0x436991){return!_0x340855[_0x8cd8('0xad')](_0x436991['name']);});_0x3a0749[_0x8cd8('0xae')](function(_0x4dfdbf){var _0x3f085a=createFieldObject(_0x3db092,_0x409dab,_0x4dfdbf['internalType'],_0x4dfdbf[_0x8cd8('0x39')],_0x4dfdbf[_0x8cd8('0xaf')],![]);_0x663a9d[_0x8cd8('0xb0')](_0x3f085a);});return Promise[_0x8cd8('0xb1')](_0x663a9d);})[_0x8cd8('0x2e')](function(_0x4204f1){_0x51f545=_0x4204f1;_0x8d7d26=Object[_0x8cd8('0xab')]([],_0x3f4696);console[_0x8cd8('0xa9')](_0x8cd8('0xb2'),_0x3f4696);_[_0x8cd8('0xac')](_0x8d7d26,function(_0x4171fa){return _0x57da8a['includes'](_0x4171fa['name']);});console[_0x8cd8('0xa9')](_0x8cd8('0xb3'),_0x8d7d26);_0x663a9d=[];_0x8d7d26[_0x8cd8('0xae')](function(_0x385986){var _0x400360=createFieldObject(_0x3db092,_0x409dab,_0x385986[_0x8cd8('0xb4')],_0x385986[_0x8cd8('0x39')],_0x385986['label'],!![]);_0x663a9d[_0x8cd8('0xb0')](_0x400360);});return Promise[_0x8cd8('0xb1')](_0x663a9d);})[_0x8cd8('0x2e')](function(_0x5abd4d){_0x515f1a=_0x5abd4d;var _0xd324b8=_0x51f545[_0x8cd8('0xb5')](_0x515f1a);return{'count':_0xd324b8['length'],'rows':_0xd324b8};})[_0x8cd8('0x2e')](respondWithResult(_0x47683e,null))[_0x8cd8('0x23')](function(_0x7ac729){console[_0x8cd8('0xa9')](_0x8cd8('0xb6')+_0x7ac729);var _0x8168d3=_0x2d7d3e[_0x8cd8('0x3a')][_0x8cd8('0xb7')]?0x1f4:_0x7ac729[_0x8cd8('0xb8')]||0x1f4;logger[_0x8cd8('0x1d')](_0x7ac729[_0x8cd8('0x30')]);delete _0x7ac729[_0x8cd8('0x39')];if(_0x8168d3===0x191){_0x8168d3=0x190;}_0x47683e[_0x8cd8('0x26')](_0x8168d3)[_0x8cd8('0x31')](_0x2d7d3e[_0x8cd8('0x3a')][_0x8cd8('0xb7')]?{'message':_0x8cd8('0xb9'),'statusCode':_0x7ac729['statusCode']}:_0x7ac729);});};function createFieldObject(_0x38bab8,_0x52c51c,_0x203c35,_0x41dc61,_0x27aefa,_0x573d2d){return new Promise(function(_0x220a4a,_0x5cad2c){var _0xe4c4cb={'id':_0x41dc61,'name':_0x27aefa,'custom':_0x573d2d};if(_0x203c35===_0x8cd8('0xba')){_0xe4c4cb['options']=[{'name':'True','value':_0x8cd8('0xbb')},{'name':'False','value':_0x8cd8('0xbc')}];_0x220a4a(_0xe4c4cb);}else{var _0x329f9a={'method':'GET','uri':_0x38bab8+_0x8cd8('0xbd')+_0x41dc61,'auth':_0x52c51c,'json':!![]};return rp(_0x329f9a)[_0x8cd8('0x2e')](function(_0x39ccd3){var _0x37111c=[];if(_0x39ccd3[_0x8cd8('0x22')][_0x8cd8('0x3f')]>0x0){_0x39ccd3[_0x8cd8('0x22')][_0x8cd8('0xae')](function(_0x4dd549){if(_0x4dd549[_0x8cd8('0xbe')]===_0x8cd8('0xbc')){var _0xf7654c={'name':_0x4dd549[_0x8cd8('0xaf')],'value':_0x4dd549[_0x8cd8('0xbf')]};_0x37111c['push'](_0xf7654c);}});}_0xe4c4cb[_0x8cd8('0x47')]=_0x37111c;if(_0xe4c4cb[_0x8cd8('0x47')][_0x8cd8('0x3f')]>0x0){_0x220a4a(_0xe4c4cb);}else{if(_0x573d2d==![]){_0x220a4a();}else{_0x220a4a(_0xe4c4cb);}}});}});} \ No newline at end of file +var _0xa063=['../../mysqldb','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','filters','filter','where','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','findOne','ServicenowConfiguration','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','knowledge','subcategory','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','sys_id','contact_type','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','true','False','inactive','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x509636,_0x78097){var _0x48793c=function(_0x1fb83a){while(--_0x1fb83a){_0x509636['push'](_0x509636['shift']());}};_0x48793c(++_0x78097);}(_0xa063,0x172));var _0x3a06=function(_0x4bb632,_0x143b41){_0x4bb632=_0x4bb632-0x0;var _0x2924b8=_0xa063[_0x4bb632];return _0x2924b8;};'use strict';var pdf=require(_0x3a06('0x0'));var emlformat=require(_0x3a06('0x1'));var rimraf=require(_0x3a06('0x2'));var zipdir=require(_0x3a06('0x3'));var jsonpatch=require(_0x3a06('0x4'));var rp=require(_0x3a06('0x5'));var moment=require('moment');var BPromise=require(_0x3a06('0x6'));var Mustache=require('mustache');var util=require(_0x3a06('0x7'));var path=require('path');var sox=require(_0x3a06('0x8'));var csv=require(_0x3a06('0x9'));var ejs=require(_0x3a06('0xa'));var fs=require('fs');var _=require(_0x3a06('0xb'));var squel=require(_0x3a06('0xc'));var crypto=require(_0x3a06('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3a06('0xe'));var toCsv=require(_0x3a06('0x9'));var querystring=require(_0x3a06('0xf'));var Papa=require(_0x3a06('0x10'));var Redis=require(_0x3a06('0x11'));var authService=require(_0x3a06('0x12'));var qs=require(_0x3a06('0x13'));var as=require(_0x3a06('0x14'));var hardwareService=require(_0x3a06('0x15'));var logger=require(_0x3a06('0x16'))(_0x3a06('0x17'));var utils=require('../../config/utils');var config=require(_0x3a06('0x18'));var licenseUtil=require(_0x3a06('0x19'));var db=require(_0x3a06('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3a06('0x1b'));var client=jayson[_0x3a06('0x1c')][_0x3a06('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x48ee93,_0x489b70,_0x5eaa6e,_0x2349c2){return new BPromise(function(_0x38ef03,_0x626198){var _0x1ad2d6=_0x2349c2||client;return _0x1ad2d6[_0x3a06('0x1e')](_0x48ee93,_0x5eaa6e)['then'](function(_0x4d62d0){logger['info'](_0x3a06('0x1f'),_0x489b70,_0x3a06('0x20'));logger[_0x3a06('0x21')](_0x3a06('0x22'),_0x489b70,'request\x20sent',JSON[_0x3a06('0x23')](_0x4d62d0));if(_0x4d62d0[_0x3a06('0x24')]){if(_0x4d62d0[_0x3a06('0x24')][_0x3a06('0x25')]===0x1f4){logger['error'](_0x3a06('0x1f'),_0x489b70,_0x4d62d0[_0x3a06('0x24')][_0x3a06('0x26')]);return _0x626198(_0x4d62d0[_0x3a06('0x24')]['message']);}logger[_0x3a06('0x24')](_0x3a06('0x1f'),_0x489b70,_0x4d62d0[_0x3a06('0x24')][_0x3a06('0x26')]);return _0x38ef03(_0x4d62d0['error']['message']);}else{logger[_0x3a06('0x27')](_0x3a06('0x1f'),_0x489b70,_0x3a06('0x20'));_0x38ef03(_0x4d62d0[_0x3a06('0x28')][_0x3a06('0x26')]);}})['catch'](function(_0x224af1){logger[_0x3a06('0x24')](_0x3a06('0x1f'),_0x489b70,_0x224af1);_0x626198(_0x224af1);});});}function respondWithStatusCode(_0x5ada15,_0xa347be){_0xa347be=_0xa347be||0xcc;return function(_0x25bfd7){if(_0x25bfd7){return _0x5ada15[_0x3a06('0x29')](_0xa347be);}return _0x5ada15[_0x3a06('0x2a')](_0xa347be)[_0x3a06('0x2b')]();};}function respondWithResult(_0x291e8f,_0x23f7b9){_0x23f7b9=_0x23f7b9||0xc8;return function(_0x4abe9e){if(_0x4abe9e){return _0x291e8f[_0x3a06('0x2a')](_0x23f7b9)['json'](_0x4abe9e);}};}function respondWithFilteredResult(_0x34f94d,_0x4775eb){return function(_0x478325){if(_0x478325){var _0x3a33ad=_0x478325[_0x3a06('0x2c')],_0x396767=_0x4775eb[_0x3a06('0x2d')],_0x3b163e=_0x4775eb[_0x3a06('0x2d')]+_0x4775eb[_0x3a06('0x2e')],_0xd718d6;if(_0x3b163e>=_0x3a33ad){_0x3b163e=_0x3a33ad;_0xd718d6=0xc8;}else{_0xd718d6=0xce;}_0x34f94d[_0x3a06('0x2a')](_0xd718d6);return _0x34f94d[_0x3a06('0x2f')](_0x3a06('0x30'),_0x396767+'-'+_0x3b163e+'/'+_0x3a33ad)[_0x3a06('0x31')](_0x478325);}return null;};}function patchUpdates(_0xbc61e1){return function(_0x888761){try{jsonpatch[_0x3a06('0x32')](_0x888761,_0xbc61e1,!![]);}catch(_0x5aff6f){return BPromise['reject'](_0x5aff6f);}return _0x888761['save']();};}function saveUpdates(_0x36a23d,_0x448ff7){return function(_0xc57f3){if(_0xc57f3){return _0xc57f3[_0x3a06('0x33')](_0x36a23d)[_0x3a06('0x34')](function(_0x43cab7){return _0x43cab7;});}return null;};}function removeEntity(_0x38dcb9,_0x47e951){return function(_0x557faa){if(_0x557faa){return _0x557faa['destroy']()[_0x3a06('0x34')](function(){_0x38dcb9[_0x3a06('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b753f,_0x333e25){return function(_0x2c4b50){if(!_0x2c4b50){_0x3b753f['sendStatus'](0x194);}return _0x2c4b50;};}function handleError(_0x3d0dae,_0x3940fb){_0x3940fb=_0x3940fb||0x1f4;return function(_0x2cca63){logger[_0x3a06('0x24')](_0x2cca63[_0x3a06('0x35')]);if(_0x2cca63['name']){delete _0x2cca63[_0x3a06('0x36')];}_0x3d0dae['status'](_0x3940fb)[_0x3a06('0x37')](_0x2cca63);};}exports['index']=function(_0x5156ea,_0x122b5d){var _0x24713a={},_0x3b762a={},_0xdc4120={'count':0x0,'rows':[]};var _0x3bd41f=_[_0x3a06('0x38')](db[_0x3a06('0x39')][_0x3a06('0x3a')],function(_0x35dffb){return{'name':_0x35dffb[_0x3a06('0x3b')],'type':_0x35dffb[_0x3a06('0x3c')][_0x3a06('0x3d')]};});_0x3b762a[_0x3a06('0x3e')]=_[_0x3a06('0x38')](_0x3bd41f,_0x3a06('0x36'));_0x3b762a[_0x3a06('0x3f')]=_[_0x3a06('0x40')](_0x5156ea['query']);_0x3b762a['filters']=_['intersection'](_0x3b762a['model'],_0x3b762a[_0x3a06('0x3f')]);_0x24713a['attributes']=_[_0x3a06('0x41')](_0x3b762a[_0x3a06('0x3e')],qs[_0x3a06('0x42')](_0x5156ea['query'][_0x3a06('0x42')]));_0x24713a[_0x3a06('0x43')]=_0x24713a[_0x3a06('0x43')]['length']?_0x24713a['attributes']:_0x3b762a[_0x3a06('0x3e')];if(!_0x5156ea[_0x3a06('0x3f')]['hasOwnProperty'](_0x3a06('0x44'))){_0x24713a[_0x3a06('0x2e')]=qs['limit'](_0x5156ea[_0x3a06('0x3f')][_0x3a06('0x2e')]);_0x24713a['offset']=qs['offset'](_0x5156ea['query'][_0x3a06('0x2d')]);}_0x24713a[_0x3a06('0x45')]=qs['sort'](_0x5156ea[_0x3a06('0x3f')]['sort']);_0x24713a['where']=qs[_0x3a06('0x46')](_['pick'](_0x5156ea[_0x3a06('0x3f')],_0x3b762a[_0x3a06('0x46')]),_0x3bd41f);if(_0x5156ea[_0x3a06('0x3f')][_0x3a06('0x47')]){_0x24713a[_0x3a06('0x48')]=_[_0x3a06('0x49')](_0x24713a[_0x3a06('0x48')],{'$or':_['map'](_0x3bd41f,function(_0x15053b){if(_0x15053b['type']!=='VIRTUAL'){var _0x3b616b={};_0x3b616b[_0x15053b[_0x3a06('0x36')]]={'$like':'%'+_0x5156ea[_0x3a06('0x3f')][_0x3a06('0x47')]+'%'};return _0x3b616b;}})});}_0x24713a=_[_0x3a06('0x49')]({},_0x24713a,_0x5156ea[_0x3a06('0x4a')]);var _0x5b1f8b={'where':_0x24713a[_0x3a06('0x48')]};return db[_0x3a06('0x39')][_0x3a06('0x2c')](_0x5b1f8b)[_0x3a06('0x34')](function(_0x7f987b){_0xdc4120[_0x3a06('0x2c')]=_0x7f987b;if(_0x5156ea['query'][_0x3a06('0x4b')]){_0x24713a[_0x3a06('0x4c')]=[{'all':!![]}];}return db[_0x3a06('0x39')]['findAll'](_0x24713a);})['then'](function(_0x2ba573){_0xdc4120[_0x3a06('0x4d')]=_0x2ba573;return _0xdc4120;})[_0x3a06('0x34')](respondWithFilteredResult(_0x122b5d,_0x24713a))[_0x3a06('0x4e')](handleError(_0x122b5d,null));};exports[_0x3a06('0x4f')]=function(_0x38b1aa,_0xaa831e){var _0x454474={'raw':![],'where':{'id':_0x38b1aa[_0x3a06('0x50')]['id']}},_0x360388={};_0x360388['model']=_[_0x3a06('0x40')](db[_0x3a06('0x39')][_0x3a06('0x3a')]);_0x360388[_0x3a06('0x3f')]=_['keys'](_0x38b1aa[_0x3a06('0x3f')]);_0x360388['filters']=_[_0x3a06('0x41')](_0x360388[_0x3a06('0x3e')],_0x360388[_0x3a06('0x3f')]);_0x454474[_0x3a06('0x43')]=_['intersection'](_0x360388[_0x3a06('0x3e')],qs[_0x3a06('0x42')](_0x38b1aa[_0x3a06('0x3f')][_0x3a06('0x42')]));_0x454474['attributes']=_0x454474[_0x3a06('0x43')][_0x3a06('0x51')]?_0x454474[_0x3a06('0x43')]:_0x360388[_0x3a06('0x3e')];if(_0x38b1aa['query'][_0x3a06('0x4b')]){_0x454474[_0x3a06('0x4c')]=[{'all':!![]}];}_0x454474=_[_0x3a06('0x49')]({},_0x454474,_0x38b1aa[_0x3a06('0x4a')]);return db[_0x3a06('0x39')][_0x3a06('0x52')](_0x454474)[_0x3a06('0x34')](handleEntityNotFound(_0xaa831e,null))[_0x3a06('0x34')](respondWithResult(_0xaa831e,null))[_0x3a06('0x4e')](handleError(_0xaa831e,null));};exports[_0x3a06('0x53')]=function(_0x434a01,_0x12c81c){return db[_0x3a06('0x39')]['create'](_0x434a01[_0x3a06('0x54')],{})[_0x3a06('0x34')](respondWithResult(_0x12c81c,0xc9))[_0x3a06('0x4e')](handleError(_0x12c81c,null));};exports[_0x3a06('0x33')]=function(_0x365914,_0x47eb88){if(_0x365914['body']['id']){delete _0x365914[_0x3a06('0x54')]['id'];}return db[_0x3a06('0x39')][_0x3a06('0x52')]({'where':{'id':_0x365914['params']['id']}})[_0x3a06('0x34')](handleEntityNotFound(_0x47eb88,null))[_0x3a06('0x34')](saveUpdates(_0x365914[_0x3a06('0x54')],null))['then'](respondWithResult(_0x47eb88,null))[_0x3a06('0x4e')](handleError(_0x47eb88,null));};exports['destroy']=function(_0x3b38cd,_0x2b82f9){return db['ServicenowAccount'][_0x3a06('0x52')]({'where':{'id':_0x3b38cd[_0x3a06('0x50')]['id']}})[_0x3a06('0x34')](handleEntityNotFound(_0x2b82f9,null))[_0x3a06('0x34')](removeEntity(_0x2b82f9,null))[_0x3a06('0x4e')](handleError(_0x2b82f9,null));};exports['getConfigurations']=function(_0x3b645d,_0x2037eb,_0x23fdf1){var _0x1fc7ce={};var _0x4696dc={};var _0x25ee60;var _0x1ee139;return db[_0x3a06('0x39')][_0x3a06('0x55')]({'where':{'id':_0x3b645d[_0x3a06('0x50')]['id']}})['then'](handleEntityNotFound(_0x2037eb,null))[_0x3a06('0x34')](function(_0x3aafea){if(_0x3aafea){_0x25ee60=_0x3aafea;_0x4696dc[_0x3a06('0x3e')]=_[_0x3a06('0x40')](db[_0x3a06('0x56')][_0x3a06('0x3a')]);_0x4696dc[_0x3a06('0x3f')]=_[_0x3a06('0x40')](_0x3b645d[_0x3a06('0x3f')]);_0x4696dc[_0x3a06('0x46')]=_[_0x3a06('0x41')](_0x4696dc[_0x3a06('0x3e')],_0x4696dc[_0x3a06('0x3f')]);_0x1fc7ce['attributes']=_['intersection'](_0x4696dc[_0x3a06('0x3e')],qs[_0x3a06('0x42')](_0x3b645d[_0x3a06('0x3f')]['fields']));_0x1fc7ce[_0x3a06('0x43')]=_0x1fc7ce[_0x3a06('0x43')]['length']?_0x1fc7ce['attributes']:_0x4696dc['model'];_0x1fc7ce[_0x3a06('0x45')]=qs['sort'](_0x3b645d['query'][_0x3a06('0x57')]);_0x1fc7ce[_0x3a06('0x48')]=qs[_0x3a06('0x46')](_['pick'](_0x3b645d['query'],_0x4696dc[_0x3a06('0x46')]));if(_0x3b645d['query'][_0x3a06('0x47')]){_0x1fc7ce[_0x3a06('0x48')]=_[_0x3a06('0x49')](_0x1fc7ce['where'],{'$or':_['map'](_0x1fc7ce['attributes'],function(_0x433b30){var _0x58926a={};_0x58926a[_0x433b30]={'$like':'%'+_0x3b645d[_0x3a06('0x3f')][_0x3a06('0x47')]+'%'};return _0x58926a;})});}_0x1fc7ce=_[_0x3a06('0x49')]({},_0x1fc7ce,_0x3b645d[_0x3a06('0x4a')]);return _0x25ee60[_0x3a06('0x58')](_0x1fc7ce);}})[_0x3a06('0x34')](function(_0x5f5902){if(_0x5f5902){_0x1ee139=_0x5f5902[_0x3a06('0x51')];if(!_0x3b645d[_0x3a06('0x3f')]['hasOwnProperty']('nolimit')){_0x1fc7ce['limit']=qs[_0x3a06('0x2e')](_0x3b645d[_0x3a06('0x3f')]['limit']);_0x1fc7ce[_0x3a06('0x2d')]=qs[_0x3a06('0x2d')](_0x3b645d[_0x3a06('0x3f')]['offset']);}return _0x25ee60[_0x3a06('0x58')](_0x1fc7ce);}})[_0x3a06('0x34')](function(_0x1ea4ab){if(_0x1ea4ab){return _0x1ea4ab?{'count':_0x1ee139,'rows':_0x1ea4ab}:null;}})['then'](respondWithResult(_0x2037eb,null))[_0x3a06('0x4e')](handleError(_0x2037eb,null));};exports[_0x3a06('0x59')]=function(_0x4178ff,_0x529d72,_0x2b7ae3){if(_0x4178ff[_0x3a06('0x54')]['id']){delete _0x4178ff['body']['id'];}return db[_0x3a06('0x39')][_0x3a06('0x55')]({'where':{'id':_0x4178ff[_0x3a06('0x50')]['id']}})[_0x3a06('0x34')](handleEntityNotFound(_0x529d72,null))[_0x3a06('0x34')](function(_0x10ab91){if(_0x10ab91){_0x4178ff[_0x3a06('0x54')][_0x3a06('0x5a')]=_0x10ab91['id'];_0x4178ff[_0x3a06('0x54')][_0x3a06('0x5b')]=integrations[_0x3a06('0x5c')](_0x4178ff[_0x3a06('0x54')][_0x3a06('0x5d')],_0x4178ff[_0x3a06('0x54')][_0x3a06('0x3c')]);_0x4178ff[_0x3a06('0x54')]['Descriptions']=integrations[_0x3a06('0x5e')](_0x4178ff['body'][_0x3a06('0x5d')],_0x4178ff['body'][_0x3a06('0x3c')]);return db[_0x3a06('0x56')]['create'](_0x4178ff[_0x3a06('0x54')],{'include':[{'model':db[_0x3a06('0x5f')],'as':'Subjects'},{'model':db[_0x3a06('0x5f')],'as':_0x3a06('0x60')}]});}return null;})[_0x3a06('0x34')](respondWithResult(_0x529d72,null))[_0x3a06('0x4e')](handleError(_0x529d72,null));};exports[_0x3a06('0x61')]=function(_0x3d4761,_0x35e1a0,_0x10c06e){var _0x3079a3=['made_sla','hold_reason',_0x3a06('0x62'),_0x3a06('0x63'),'close_code',_0x3a06('0x64'),_0x3a06('0x65'),_0x3a06('0x66'),_0x3a06('0x67')];var _0x90c5f0=[_0x3a06('0x68'),_0x3a06('0x69'),_0x3a06('0x6a'),_0x3a06('0x6b'),_0x3a06('0x6c'),_0x3a06('0x6d'),_0x3a06('0x6e'),_0x3a06('0x6f'),_0x3a06('0x70'),_0x3a06('0x71'),_0x3a06('0x72'),'sys_updated_by',_0x3a06('0x73'),_0x3a06('0x74'),_0x3a06('0x75'),_0x3a06('0x76'),_0x3a06('0x77'),_0x3a06('0x78'),_0x3a06('0x62'),_0x3a06('0x45'),_0x3a06('0x79'),_0x3a06('0x7a'),_0x3a06('0x7b'),_0x3a06('0x7c'),_0x3a06('0x7d'),_0x3a06('0x7e'),_0x3a06('0x7f'),_0x3a06('0x80'),_0x3a06('0x81'),_0x3a06('0x82'),'rfc',_0x3a06('0x83'),_0x3a06('0x84'),_0x3a06('0x85'),'business_duration','group_list',_0x3a06('0x86'),_0x3a06('0x87'),_0x3a06('0x88'),_0x3a06('0x89'),_0x3a06('0x8a'),'subcategory',_0x3a06('0x8b'),'short_description',_0x3a06('0x8c'),_0x3a06('0x8d'),_0x3a06('0x8e'),'work_start',_0x3a06('0x8f'),_0x3a06('0x90'),_0x3a06('0x91'),_0x3a06('0x92'),_0x3a06('0x93'),_0x3a06('0x64'),'sys_class_name',_0x3a06('0x94'),_0x3a06('0x95'),_0x3a06('0x96'),'parent_incident',_0x3a06('0x97'),_0x3a06('0x98'),'reopened_by',_0x3a06('0x65'),'urgency','problem_id',_0x3a06('0x99'),_0x3a06('0x9a'),_0x3a06('0x9b'),'assigned_to',_0x3a06('0x66'),_0x3a06('0x9c'),_0x3a06('0x9d'),_0x3a06('0x9e'),_0x3a06('0x9f'),_0x3a06('0xa0'),'sys_mod_count','reopen_count',_0x3a06('0xa1'),_0x3a06('0xa2'),_0x3a06('0xa3'),_0x3a06('0xa4'),_0x3a06('0xa5'),'category'];var _0x5aea09='';var _0x5cba02='';var _0x29cb8e=[];var _0x38e71e='';var _0x123522='';var _0x8df800=[];var _0x1f5d53='';var _0x93c0b1='';var _0x1cdb14={};var _0x35277c='';return db['ServicenowAccount'][_0x3a06('0x55')]({'where':{'id':_0x3d4761[_0x3a06('0x50')]['id']},'attributes':['id',_0x3a06('0xa6'),_0x3a06('0xa7'),_0x3a06('0xa8'),_0x3a06('0xa9'),_0x3a06('0xaa')]})[_0x3a06('0x34')](handleEntityNotFound(_0x35e1a0,null))[_0x3a06('0x34')](function(_0x46221b){if(_0x46221b){_0x35277c=_0x46221b[_0x3a06('0xa9')];var _0x50c356=_0x35277c['slice'](-0x1);if(_0x50c356==='/'){_0x35277c=_0x35277c[_0x3a06('0xab')](0x0,_0x35277c[_0x3a06('0xac')](_0x50c356));}_0x93c0b1=util['format'](_0x3a06('0xad'),_0x35277c);_0x1f5d53=util[_0x3a06('0xae')](_0x3a06('0xaf'),_0x35277c);_0x1cdb14={'user':_0x46221b[_0x3a06('0xa6')],'pass':_0x46221b[_0x3a06('0xa7')]};var _0x178b1c={'method':_0x3a06('0xb0'),'uri':_0x93c0b1+_0x3a06('0xb1'),'auth':_0x1cdb14,'json':!![]};return rp(_0x178b1c);}})[_0x3a06('0x34')](function(_0x22a07e){if(_0x22a07e[_0x3a06('0x28')][_0x3a06('0x51')]>0x0){_0x5aea09=_0x22a07e['result'];}console[_0x3a06('0xb2')](_0x3a06('0xb3'),_0x5aea09);_0x8df800=[];_0x5cba02=Object['assign']([],_0x5aea09);_['remove'](_0x5cba02,function(_0x519a02){return!_0x3079a3[_0x3a06('0xb4')](_0x519a02[_0x3a06('0x36')]);});_0x5cba02[_0x3a06('0xb5')](function(_0x3ce425){var _0x55e6b4=createFieldObject(_0x1f5d53,_0x1cdb14,_0x3ce425[_0x3a06('0xb6')],_0x3ce425[_0x3a06('0x36')],_0x3ce425[_0x3a06('0xb7')],![]);_0x8df800[_0x3a06('0xb8')](_0x55e6b4);});return Promise[_0x3a06('0xb9')](_0x8df800);})[_0x3a06('0x34')](function(_0x1b1b12){_0x29cb8e=_0x1b1b12;_0x38e71e=Object[_0x3a06('0xba')]([],_0x5aea09);console[_0x3a06('0xb2')](_0x3a06('0xbb'),_0x5aea09);_['remove'](_0x38e71e,function(_0xb2dd03){return _0x90c5f0['includes'](_0xb2dd03[_0x3a06('0x36')]);});console[_0x3a06('0xb2')](_0x3a06('0xbc'),_0x38e71e);_0x8df800=[];_0x38e71e[_0x3a06('0xb5')](function(_0x8cb1a9){var _0x1ab3ef=createFieldObject(_0x1f5d53,_0x1cdb14,_0x8cb1a9[_0x3a06('0xb6')],_0x8cb1a9['name'],_0x8cb1a9[_0x3a06('0xb7')],!![]);_0x8df800[_0x3a06('0xb8')](_0x1ab3ef);});return Promise['all'](_0x8df800);})[_0x3a06('0x34')](function(_0x40da1b){_0x123522=_0x40da1b;var _0x2ea234=_0x29cb8e[_0x3a06('0xbd')](_0x123522);return{'count':_0x2ea234[_0x3a06('0x51')],'rows':_0x2ea234};})[_0x3a06('0x34')](respondWithResult(_0x35e1a0,null))['catch'](function(_0x567792){console[_0x3a06('0xb2')](_0x3a06('0xbe')+_0x567792);var _0x529b1c=_0x3d4761[_0x3a06('0x3f')]['test']?0x1f4:_0x567792[_0x3a06('0xbf')]||0x1f4;logger['error'](_0x567792[_0x3a06('0x35')]);delete _0x567792[_0x3a06('0x36')];if(_0x529b1c===0x191){_0x529b1c=0x190;}_0x35e1a0[_0x3a06('0x2a')](_0x529b1c)['send'](_0x3d4761['query'][_0x3a06('0xc0')]?{'message':_0x3a06('0xc1'),'statusCode':_0x567792[_0x3a06('0xbf')]}:_0x567792);});};function createFieldObject(_0x79c73b,_0x2d9ceb,_0x5707f5,_0x23f6fa,_0x4e41ad,_0x109849){return new Promise(function(_0x5cf5d4,_0x42c7fb){var _0x343c2d={'id':_0x23f6fa,'name':_0x4e41ad,'custom':_0x109849};if(_0x5707f5===_0x3a06('0xc2')){_0x343c2d[_0x3a06('0x4a')]=[{'name':'True','value':_0x3a06('0xc3')},{'name':_0x3a06('0xc4'),'value':'false'}];_0x5cf5d4(_0x343c2d);}else{var _0x18bd56={'method':'GET','uri':_0x79c73b+'sys_choice?sysparm_query=name=incident^element='+_0x23f6fa,'auth':_0x2d9ceb,'json':!![]};return rp(_0x18bd56)[_0x3a06('0x34')](function(_0x3d637e){var _0x36f07e=[];if(_0x3d637e[_0x3a06('0x28')][_0x3a06('0x51')]>0x0){_0x3d637e['result']['forEach'](function(_0x5aad29){if(_0x5aad29[_0x3a06('0xc5')]==='false'){var _0x42ac8e={'name':_0x5aad29[_0x3a06('0xb7')],'value':_0x5aad29['value']};_0x36f07e[_0x3a06('0xb8')](_0x42ac8e);}});}_0x343c2d[_0x3a06('0x4a')]=_0x36f07e;if(_0x343c2d[_0x3a06('0x4a')][_0x3a06('0x51')]>0x0){_0x5cf5d4(_0x343c2d);}else{if(_0x109849==![]){_0x5cf5d4();}else{_0x5cf5d4(_0x343c2d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f585f6b..7c7bb59 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x5c879e,_0xe58074){var _0x30942b=function(_0x535b57){while(--_0x535b57){_0x5c879e['push'](_0x5c879e['shift']());}};_0x30942b(++_0xe58074);}(_0x1cb9,0x14e));var _0x91cb=function(_0x118a10,_0x30b6f9){_0x118a10=_0x118a10-0x0;var _0xa8c6e6=_0x1cb9[_0x118a10];return _0xa8c6e6;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));var integrations=require(_0x91cb('0x8'));module[_0x91cb('0x9')]=function(_0x28543e,_0x3b9d98){return _0x28543e[_0x91cb('0xa')]('ServicenowAccount',attributes,{'tableName':_0x91cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment'];(function(_0x27eeb0,_0x475477){var _0x185768=function(_0x2790a3){while(--_0x2790a3){_0x27eeb0['push'](_0x27eeb0['shift']());}};_0x185768(++_0x475477);}(_0x46ed,0x168));var _0xd46e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46ed[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));var integrations=require(_0xd46e('0x8'));module[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return _0x25cf78[_0xd46e('0xa')](_0xd46e('0xb'),attributes,{'tableName':_0xd46e('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 9e1c809..ada1e1f 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 _0x325b=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include','map','model','attributes','debug','stringify','ShowServicenowAccount','find'];(function(_0x22666f,_0x274571){var _0x5a4a38=function(_0x26a1d5){while(--_0x26a1d5){_0x22666f['push'](_0x22666f['shift']());}};_0x5a4a38(++_0x274571);}(_0x325b,0xf5));var _0xb325=function(_0x2ec1a9,_0x289b93){_0x2ec1a9=_0x2ec1a9-0x0;var _0x93c66f=_0x325b[_0x2ec1a9];return _0x93c66f;};'use strict';var _=require('lodash');var util=require(_0xb325('0x0'));var moment=require('moment');var BPromise=require(_0xb325('0x1'));var rs=require(_0xb325('0x2'));var fs=require('fs');var Redis=require(_0xb325('0x3'));var db=require(_0xb325('0x4'))['db'];var utils=require(_0xb325('0x5'));var logger=require(_0xb325('0x6'))(_0xb325('0x7'));var config=require(_0xb325('0x8'));var jayson=require(_0xb325('0x9'));var client=jayson[_0xb325('0xa')][_0xb325('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a83f,_0x4794e0,_0x49149f){return new BPromise(function(_0x5420c9,_0x1a3c0e){return client[_0xb325('0xc')](_0x58a83f,_0x49149f)[_0xb325('0xd')](function(_0x49ccf3){logger[_0xb325('0xe')](_0xb325('0xf'),_0x4794e0,_0xb325('0x10'));logger['debug'](_0xb325('0x11'),_0x4794e0,'request\x20sent',JSON['stringify'](_0x49ccf3));if(_0x49ccf3['error']){if(_0x49ccf3[_0xb325('0x12')]['code']===0x1f4){logger[_0xb325('0x12')](_0xb325('0xf'),_0x4794e0,_0x49ccf3[_0xb325('0x12')]['message']);return _0x1a3c0e(_0x49ccf3[_0xb325('0x12')][_0xb325('0x13')]);}logger['error'](_0xb325('0xf'),_0x4794e0,_0x49ccf3[_0xb325('0x12')][_0xb325('0x13')]);return _0x5420c9(_0x49ccf3[_0xb325('0x12')][_0xb325('0x13')]);}else{logger[_0xb325('0xe')](_0xb325('0xf'),_0x4794e0,_0xb325('0x10'));_0x5420c9(_0x49ccf3['result']['message']);}})[_0xb325('0x14')](function(_0x196b76){logger[_0xb325('0x12')](_0xb325('0xf'),_0x4794e0,_0x196b76);_0x1a3c0e(_0x196b76);});});}exports[_0xb325('0x15')]=function(_0x357a95){var _0x543ccc=this;return new Promise(function(_0xfc2f80,_0x10d45b){return db[_0xb325('0x16')]['findAll']({'raw':_0x357a95[_0xb325('0x17')]?_0x357a95['options'][_0xb325('0x18')]===undefined?!![]:![]:!![],'where':_0x357a95[_0xb325('0x17')]?_0x357a95[_0xb325('0x17')][_0xb325('0x19')]||null:null,'attributes':_0x357a95[_0xb325('0x17')]?_0x357a95[_0xb325('0x17')]['attributes']||null:null,'limit':_0x357a95['options']?_0x357a95[_0xb325('0x17')][_0xb325('0x1a')]||null:null,'include':_0x357a95[_0xb325('0x17')]?_0x357a95[_0xb325('0x17')][_0xb325('0x1b')]?_[_0xb325('0x1c')](_0x357a95['options'][_0xb325('0x1b')],function(_0x469d58){return{'model':db[_0x469d58[_0xb325('0x1d')]],'as':_0x469d58['as'],'attributes':_0x469d58[_0xb325('0x1e')],'include':_0x469d58['include']?_['map'](_0x469d58['include'],function(_0x5e5350){return{'model':db[_0x5e5350[_0xb325('0x1d')]],'as':_0x5e5350['as'],'attributes':_0x5e5350[_0xb325('0x1e')],'include':_0x5e5350['include']?_[_0xb325('0x1c')](_0x5e5350[_0xb325('0x1b')],function(_0x5dc3e4){return{'model':db[_0x5dc3e4[_0xb325('0x1d')]],'as':_0x5dc3e4['as'],'attributes':_0x5dc3e4[_0xb325('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb325('0xd')](function(_0x3539bd){logger[_0xb325('0xe')](_0xb325('0x15'),_0x357a95);logger[_0xb325('0x1f')]('GetServicenowAccount',_0x357a95,JSON[_0xb325('0x20')](_0x3539bd));_0xfc2f80(_0x3539bd);})[_0xb325('0x14')](function(_0x32c9a6){logger[_0xb325('0x12')](_0xb325('0x15'),_0x32c9a6[_0xb325('0x13')],_0x357a95);_0x10d45b(_0x543ccc[_0xb325('0x12')](0x1f4,_0x32c9a6[_0xb325('0x13')]));});});};exports[_0xb325('0x21')]=function(_0x510bc7){var _0x22d27d=this;return new Promise(function(_0x1d1016,_0x3d7436){return db['ServicenowAccount'][_0xb325('0x22')]({'raw':_0x510bc7[_0xb325('0x17')]?_0x510bc7['options'][_0xb325('0x18')]===undefined?!![]:![]:!![],'where':_0x510bc7[_0xb325('0x17')]?_0x510bc7[_0xb325('0x17')]['where']||null:null,'attributes':_0x510bc7[_0xb325('0x17')]?_0x510bc7['options'][_0xb325('0x1e')]||null:null,'include':_0x510bc7[_0xb325('0x17')]?_0x510bc7[_0xb325('0x17')][_0xb325('0x1b')]?_[_0xb325('0x1c')](_0x510bc7['options'][_0xb325('0x1b')],function(_0x566694){return{'model':db[_0x566694[_0xb325('0x1d')]],'as':_0x566694['as'],'attributes':_0x566694[_0xb325('0x1e')],'include':_0x566694['include']?_['map'](_0x566694['include'],function(_0x5334a5){return{'model':db[_0x5334a5[_0xb325('0x1d')]],'as':_0x5334a5['as'],'attributes':_0x5334a5[_0xb325('0x1e')],'include':_0x5334a5[_0xb325('0x1b')]?_['map'](_0x5334a5[_0xb325('0x1b')],function(_0x49455b){return{'model':db[_0x49455b[_0xb325('0x1d')]],'as':_0x49455b['as'],'attributes':_0x49455b[_0xb325('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb325('0xd')](function(_0x3f75c2){logger['info'](_0xb325('0x21'),_0x510bc7);logger[_0xb325('0x1f')](_0xb325('0x21'),_0x510bc7,JSON[_0xb325('0x20')](_0x3f75c2));_0x1d1016(_0x3f75c2);})[_0xb325('0x14')](function(_0x502731){logger[_0xb325('0x12')](_0xb325('0x21'),_0x502731[_0xb325('0x13')],_0x510bc7);_0x3d7436(_0x22d27d['error'](0x1f4,_0x502731[_0xb325('0x13')]));});});}; \ No newline at end of file +var _0x7dda=['../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetServicenowAccount','debug','find','ShowServicenowAccount','util','bluebird','ioredis','../../config/utils'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7dda,0x1eb));var _0xa7dd=function(_0x50f898,_0x4c6d16){_0x50f898=_0x50f898-0x0;var _0x1d3c07=_0x7dda[_0x50f898];return _0x1d3c07;};'use strict';var _=require('lodash');var util=require(_0xa7dd('0x0'));var moment=require('moment');var BPromise=require(_0xa7dd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7dd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7dd('0x3'));var logger=require(_0xa7dd('0x4'))(_0xa7dd('0x5'));var config=require(_0xa7dd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa7dd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dcfc7,_0x3f8b31,_0x4f4228){return new BPromise(function(_0x35bffb,_0x592c76){return client[_0xa7dd('0x8')](_0x1dcfc7,_0x4f4228)[_0xa7dd('0x9')](function(_0x62fcf9){logger[_0xa7dd('0xa')](_0xa7dd('0xb'),_0x3f8b31,_0xa7dd('0xc'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3f8b31,_0xa7dd('0xc'),JSON[_0xa7dd('0xd')](_0x62fcf9));if(_0x62fcf9[_0xa7dd('0xe')]){if(_0x62fcf9[_0xa7dd('0xe')][_0xa7dd('0xf')]===0x1f4){logger[_0xa7dd('0xe')](_0xa7dd('0xb'),_0x3f8b31,_0x62fcf9[_0xa7dd('0xe')][_0xa7dd('0x10')]);return _0x592c76(_0x62fcf9[_0xa7dd('0xe')]['message']);}logger['error'](_0xa7dd('0xb'),_0x3f8b31,_0x62fcf9[_0xa7dd('0xe')][_0xa7dd('0x10')]);return _0x35bffb(_0x62fcf9[_0xa7dd('0xe')][_0xa7dd('0x10')]);}else{logger[_0xa7dd('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x3f8b31,_0xa7dd('0xc'));_0x35bffb(_0x62fcf9[_0xa7dd('0x11')][_0xa7dd('0x10')]);}})[_0xa7dd('0x12')](function(_0x5ac199){logger[_0xa7dd('0xe')](_0xa7dd('0xb'),_0x3f8b31,_0x5ac199);_0x592c76(_0x5ac199);});});}exports['GetServicenowAccount']=function(_0x197025){var _0x5caf9c=this;return new Promise(function(_0x5308c3,_0x143c09){return db[_0xa7dd('0x13')][_0xa7dd('0x14')]({'raw':_0x197025[_0xa7dd('0x15')]?_0x197025['options'][_0xa7dd('0x16')]===undefined?!![]:![]:!![],'where':_0x197025[_0xa7dd('0x15')]?_0x197025[_0xa7dd('0x15')][_0xa7dd('0x17')]||null:null,'attributes':_0x197025[_0xa7dd('0x15')]?_0x197025[_0xa7dd('0x15')][_0xa7dd('0x18')]||null:null,'limit':_0x197025[_0xa7dd('0x15')]?_0x197025[_0xa7dd('0x15')][_0xa7dd('0x19')]||null:null,'include':_0x197025[_0xa7dd('0x15')]?_0x197025[_0xa7dd('0x15')][_0xa7dd('0x1a')]?_['map'](_0x197025[_0xa7dd('0x15')]['include'],function(_0x407ce5){return{'model':db[_0x407ce5[_0xa7dd('0x1b')]],'as':_0x407ce5['as'],'attributes':_0x407ce5[_0xa7dd('0x18')],'include':_0x407ce5[_0xa7dd('0x1a')]?_[_0xa7dd('0x1c')](_0x407ce5[_0xa7dd('0x1a')],function(_0x212a7a){return{'model':db[_0x212a7a[_0xa7dd('0x1b')]],'as':_0x212a7a['as'],'attributes':_0x212a7a[_0xa7dd('0x18')],'include':_0x212a7a[_0xa7dd('0x1a')]?_[_0xa7dd('0x1c')](_0x212a7a[_0xa7dd('0x1a')],function(_0x247dc7){return{'model':db[_0x247dc7[_0xa7dd('0x1b')]],'as':_0x247dc7['as'],'attributes':_0x247dc7[_0xa7dd('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa7dd('0x9')](function(_0x33235e){logger['info'](_0xa7dd('0x1d'),_0x197025);logger[_0xa7dd('0x1e')](_0xa7dd('0x1d'),_0x197025,JSON[_0xa7dd('0xd')](_0x33235e));_0x5308c3(_0x33235e);})[_0xa7dd('0x12')](function(_0x30a2f4){logger['error'](_0xa7dd('0x1d'),_0x30a2f4[_0xa7dd('0x10')],_0x197025);_0x143c09(_0x5caf9c['error'](0x1f4,_0x30a2f4[_0xa7dd('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x42474d){var _0x301c9b=this;return new Promise(function(_0xa4369f,_0x2bbc06){return db[_0xa7dd('0x13')][_0xa7dd('0x1f')]({'raw':_0x42474d['options']?_0x42474d['options'][_0xa7dd('0x16')]===undefined?!![]:![]:!![],'where':_0x42474d[_0xa7dd('0x15')]?_0x42474d['options']['where']||null:null,'attributes':_0x42474d[_0xa7dd('0x15')]?_0x42474d['options'][_0xa7dd('0x18')]||null:null,'include':_0x42474d['options']?_0x42474d[_0xa7dd('0x15')][_0xa7dd('0x1a')]?_[_0xa7dd('0x1c')](_0x42474d[_0xa7dd('0x15')][_0xa7dd('0x1a')],function(_0x2fc855){return{'model':db[_0x2fc855[_0xa7dd('0x1b')]],'as':_0x2fc855['as'],'attributes':_0x2fc855[_0xa7dd('0x18')],'include':_0x2fc855['include']?_[_0xa7dd('0x1c')](_0x2fc855[_0xa7dd('0x1a')],function(_0x279a6e){return{'model':db[_0x279a6e[_0xa7dd('0x1b')]],'as':_0x279a6e['as'],'attributes':_0x279a6e[_0xa7dd('0x18')],'include':_0x279a6e['include']?_[_0xa7dd('0x1c')](_0x279a6e[_0xa7dd('0x1a')],function(_0x2486a1){return{'model':db[_0x2486a1[_0xa7dd('0x1b')]],'as':_0x2486a1['as'],'attributes':_0x2486a1[_0xa7dd('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2498a8){logger[_0xa7dd('0xa')](_0xa7dd('0x20'),_0x42474d);logger['debug'](_0xa7dd('0x20'),_0x42474d,JSON[_0xa7dd('0xd')](_0x2498a8));_0xa4369f(_0x2498a8);})[_0xa7dd('0x12')](function(_0x381f95){logger[_0xa7dd('0xe')]('ShowServicenowAccount',_0x381f95[_0xa7dd('0x10')],_0x42474d);_0x2bbc06(_0x301c9b[_0xa7dd('0xe')](0x1f4,_0x381f95[_0xa7dd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index c57646e..66190f1 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 _0x1238=['put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','create'];(function(_0x580795,_0x90f61){var _0x20eea5=function(_0x14492b){while(--_0x14492b){_0x580795['push'](_0x580795['shift']());}};_0x20eea5(++_0x90f61);}(_0x1238,0x1d0));var _0x8123=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x1238[_0x3ec122];return _0x4ecf41;};'use strict';var multer=require(_0x8123('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8123('0x1'));var express=require(_0x8123('0x2'));var router=express[_0x8123('0x3')]();var auth=require(_0x8123('0x4'));var interaction=require(_0x8123('0x5'));var config=require(_0x8123('0x6'));var controller=require(_0x8123('0x7'));router[_0x8123('0x8')]('/',auth[_0x8123('0x9')](),controller['index']);router[_0x8123('0x8')](_0x8123('0xa'),auth[_0x8123('0x9')](),controller[_0x8123('0xb')]);router[_0x8123('0x8')](_0x8123('0xc'),auth[_0x8123('0x9')](),controller['getFields']);router[_0x8123('0x8')](_0x8123('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8123('0x8')](_0x8123('0xe'),auth[_0x8123('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x8123('0x9')](),controller[_0x8123('0xf')]);router[_0x8123('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8123('0x11')]);router['delete']('/:id',auth[_0x8123('0x9')](),controller[_0x8123('0x12')]);module[_0x8123('0x13')]=router; \ No newline at end of file +var _0xd554=['/:id/descriptions','put','update','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x3de8c3,_0x207eb7){var _0x2135c5=function(_0x5dc9fe){while(--_0x5dc9fe){_0x3de8c3['push'](_0x3de8c3['shift']());}};_0x2135c5(++_0x207eb7);}(_0xd554,0x121));var _0x4d55=function(_0x555cbd,_0x52e4b8){_0x555cbd=_0x555cbd-0x0;var _0x37e5a2=_0xd554[_0x555cbd];return _0x37e5a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d55('0x0'));var timeout=require(_0x4d55('0x1'));var express=require(_0x4d55('0x2'));var router=express['Router']();var auth=require(_0x4d55('0x3'));var interaction=require(_0x4d55('0x4'));var config=require(_0x4d55('0x5'));var controller=require(_0x4d55('0x6'));router[_0x4d55('0x7')]('/',auth[_0x4d55('0x8')](),controller[_0x4d55('0x9')]);router[_0x4d55('0x7')](_0x4d55('0xa'),auth[_0x4d55('0x8')](),controller[_0x4d55('0xb')]);router[_0x4d55('0x7')](_0x4d55('0xc'),auth['isAuthenticated'](),controller[_0x4d55('0xd')]);router[_0x4d55('0x7')]('/:id/subjects',auth[_0x4d55('0x8')](),controller[_0x4d55('0xe')]);router[_0x4d55('0x7')](_0x4d55('0xf'),auth[_0x4d55('0x8')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4d55('0x10')]('/:id',auth[_0x4d55('0x8')](),controller[_0x4d55('0x11')]);router['delete'](_0x4d55('0xa'),auth[_0x4d55('0x8')](),controller[_0x4d55('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ba1c274..23871c1 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 _0x9237=['sequelize','STRING'];(function(_0x4c94d1,_0x573a4f){var _0x48c2c3=function(_0x326bcc){while(--_0x326bcc){_0x4c94d1['push'](_0x4c94d1['shift']());}};_0x48c2c3(++_0x573a4f);}(_0x9237,0x1a6));var _0x7923=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x9237[_0x254b22];return _0x1279db;};'use strict';var Sequelize=require(_0x7923('0x0'));module['exports']={'name':{'type':Sequelize[_0x7923('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdcea=['exports','STRING','sequelize'];(function(_0x2972fd,_0x9a50cd){var _0x2b5124=function(_0x2b8a25){while(--_0x2b8a25){_0x2972fd['push'](_0x2972fd['shift']());}};_0x2b5124(++_0x9a50cd);}(_0xdcea,0x152));var _0xadce=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xdcea[_0x3c81b5];return _0x5888c4;};'use strict';var Sequelize=require(_0xadce('0x0'));module[_0xadce('0x1')]={'name':{'type':Sequelize[_0xadce('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e3eae81..dd2906d 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 _0x0000=['options','includeAll','include','findAll','rows','show','params','find','create','body','update','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','end','status','json','count','limit','reject','save','destroy','stack','name','send','ServicenowConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1fd47f,_0x36c195){var _0x5ed952=function(_0x5d3bc5){while(--_0x5d3bc5){_0x1fd47f['push'](_0x1fd47f['shift']());}};_0x5ed952(++_0x36c195);}(_0x0000,0x11b));var _0x0000=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0000[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x0000('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0000('0x1'));var zipdir=require(_0x0000('0x2'));var jsonpatch=require(_0x0000('0x3'));var rp=require(_0x0000('0x4'));var moment=require(_0x0000('0x5'));var BPromise=require(_0x0000('0x6'));var Mustache=require(_0x0000('0x7'));var util=require('util');var path=require(_0x0000('0x8'));var sox=require('sox');var csv=require(_0x0000('0x9'));var ejs=require(_0x0000('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0000('0xb'));var crypto=require(_0x0000('0xc'));var jsforce=require(_0x0000('0xd'));var deskjs=require(_0x0000('0xe'));var toCsv=require(_0x0000('0x9'));var querystring=require(_0x0000('0xf'));var Papa=require(_0x0000('0x10'));var Redis=require('ioredis');var authService=require(_0x0000('0x11'));var qs=require(_0x0000('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0000('0x13'));var logger=require(_0x0000('0x14'))(_0x0000('0x15'));var utils=require(_0x0000('0x16'));var config=require(_0x0000('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x0000('0x18'));var client=jayson[_0x0000('0x19')][_0x0000('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5c52a2,_0x469542,_0x1b3ea2,_0x470f70){return new BPromise(function(_0x1044ab,_0x5504d7){var _0x11dbf3=_0x470f70||client;return _0x11dbf3['request'](_0x5c52a2,_0x1b3ea2)[_0x0000('0x1b')](function(_0x169744){logger['info'](_0x0000('0x1c'),_0x469542,_0x0000('0x1d'));logger[_0x0000('0x1e')](_0x0000('0x1f'),_0x469542,_0x0000('0x1d'),JSON[_0x0000('0x20')](_0x169744));if(_0x169744['error']){if(_0x169744['error'][_0x0000('0x21')]===0x1f4){logger[_0x0000('0x22')](_0x0000('0x1c'),_0x469542,_0x169744[_0x0000('0x22')][_0x0000('0x23')]);return _0x5504d7(_0x169744[_0x0000('0x22')][_0x0000('0x23')]);}logger[_0x0000('0x22')](_0x0000('0x1c'),_0x469542,_0x169744[_0x0000('0x22')][_0x0000('0x23')]);return _0x1044ab(_0x169744['error'][_0x0000('0x23')]);}else{logger[_0x0000('0x24')](_0x0000('0x1c'),_0x469542,_0x0000('0x1d'));_0x1044ab(_0x169744[_0x0000('0x25')][_0x0000('0x23')]);}})[_0x0000('0x26')](function(_0xcf1c22){logger['error'](_0x0000('0x1c'),_0x469542,_0xcf1c22);_0x5504d7(_0xcf1c22);});});}function respondWithStatusCode(_0x618f6d,_0x54e808){_0x54e808=_0x54e808||0xcc;return function(_0x2907a3){if(_0x2907a3){return _0x618f6d['sendStatus'](_0x54e808);}return _0x618f6d['status'](_0x54e808)[_0x0000('0x27')]();};}function respondWithResult(_0x50adc5,_0x104374){_0x104374=_0x104374||0xc8;return function(_0x8129e8){if(_0x8129e8){return _0x50adc5[_0x0000('0x28')](_0x104374)[_0x0000('0x29')](_0x8129e8);}};}function respondWithFilteredResult(_0x5fe44d,_0x23665e){return function(_0x1bf911){if(_0x1bf911){var _0x580bf1=_0x1bf911[_0x0000('0x2a')],_0x3e6753=_0x23665e['offset'],_0x43348c=_0x23665e['offset']+_0x23665e[_0x0000('0x2b')],_0x4194c2;if(_0x43348c>=_0x580bf1){_0x43348c=_0x580bf1;_0x4194c2=0xc8;}else{_0x4194c2=0xce;}_0x5fe44d[_0x0000('0x28')](_0x4194c2);return _0x5fe44d['set']('Content-Range',_0x3e6753+'-'+_0x43348c+'/'+_0x580bf1)[_0x0000('0x29')](_0x1bf911);}return null;};}function patchUpdates(_0x5dba48){return function(_0x5b69f3){try{jsonpatch['apply'](_0x5b69f3,_0x5dba48,!![]);}catch(_0x4e6f39){return BPromise[_0x0000('0x2c')](_0x4e6f39);}return _0x5b69f3[_0x0000('0x2d')]();};}function saveUpdates(_0x451387,_0x3c88b0){return function(_0x163d75){if(_0x163d75){return _0x163d75['update'](_0x451387)[_0x0000('0x1b')](function(_0x11c6d2){return _0x11c6d2;});}return null;};}function removeEntity(_0x4cc427,_0x501117){return function(_0x4e002c){if(_0x4e002c){return _0x4e002c[_0x0000('0x2e')]()['then'](function(){_0x4cc427['status'](0xcc)[_0x0000('0x27')]();});}};}function handleEntityNotFound(_0x5a585e,_0xdbe91e){return function(_0x10073a){if(!_0x10073a){_0x5a585e['sendStatus'](0x194);}return _0x10073a;};}function handleError(_0x4c3b41,_0x46dada){_0x46dada=_0x46dada||0x1f4;return function(_0x4e131d){logger['error'](_0x4e131d[_0x0000('0x2f')]);if(_0x4e131d[_0x0000('0x30')]){delete _0x4e131d[_0x0000('0x30')];}_0x4c3b41['status'](_0x46dada)[_0x0000('0x31')](_0x4e131d);};}exports['index']=function(_0x2ae9b3,_0x29801c){var _0x447bde={},_0xdfefe5={},_0xbfcf4c={'count':0x0,'rows':[]};var _0x4956e1=_['map'](db[_0x0000('0x32')][_0x0000('0x33')],function(_0x5cc909){return{'name':_0x5cc909['fieldName'],'type':_0x5cc909[_0x0000('0x34')][_0x0000('0x35')]};});_0xdfefe5[_0x0000('0x36')]=_[_0x0000('0x37')](_0x4956e1,_0x0000('0x30'));_0xdfefe5[_0x0000('0x38')]=_[_0x0000('0x39')](_0x2ae9b3[_0x0000('0x38')]);_0xdfefe5[_0x0000('0x3a')]=_[_0x0000('0x3b')](_0xdfefe5[_0x0000('0x36')],_0xdfefe5[_0x0000('0x38')]);_0x447bde[_0x0000('0x3c')]=_[_0x0000('0x3b')](_0xdfefe5[_0x0000('0x36')],qs[_0x0000('0x3d')](_0x2ae9b3[_0x0000('0x38')]['fields']));_0x447bde['attributes']=_0x447bde[_0x0000('0x3c')][_0x0000('0x3e')]?_0x447bde[_0x0000('0x3c')]:_0xdfefe5[_0x0000('0x36')];if(!_0x2ae9b3[_0x0000('0x38')][_0x0000('0x3f')](_0x0000('0x40'))){_0x447bde['limit']=qs['limit'](_0x2ae9b3['query']['limit']);_0x447bde['offset']=qs[_0x0000('0x41')](_0x2ae9b3[_0x0000('0x38')]['offset']);}_0x447bde[_0x0000('0x42')]=qs[_0x0000('0x43')](_0x2ae9b3[_0x0000('0x38')][_0x0000('0x43')]);_0x447bde[_0x0000('0x44')]=qs[_0x0000('0x3a')](_[_0x0000('0x45')](_0x2ae9b3['query'],_0xdfefe5[_0x0000('0x3a')]),_0x4956e1);if(_0x2ae9b3[_0x0000('0x38')][_0x0000('0x46')]){_0x447bde[_0x0000('0x44')]=_[_0x0000('0x47')](_0x447bde[_0x0000('0x44')],{'$or':_['map'](_0x4956e1,function(_0x509836){if(_0x509836['type']!==_0x0000('0x48')){var _0x5aa739={};_0x5aa739[_0x509836[_0x0000('0x30')]]={'$like':'%'+_0x2ae9b3[_0x0000('0x38')][_0x0000('0x46')]+'%'};return _0x5aa739;}})});}_0x447bde=_[_0x0000('0x47')]({},_0x447bde,_0x2ae9b3[_0x0000('0x49')]);var _0x2a2631={'where':_0x447bde[_0x0000('0x44')]};return db[_0x0000('0x32')][_0x0000('0x2a')](_0x2a2631)[_0x0000('0x1b')](function(_0x1adca9){_0xbfcf4c['count']=_0x1adca9;if(_0x2ae9b3[_0x0000('0x38')][_0x0000('0x4a')]){_0x447bde[_0x0000('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x0000('0x4c')](_0x447bde);})[_0x0000('0x1b')](function(_0x10cabb){_0xbfcf4c[_0x0000('0x4d')]=_0x10cabb;return _0xbfcf4c;})[_0x0000('0x1b')](respondWithFilteredResult(_0x29801c,_0x447bde))['catch'](handleError(_0x29801c,null));};exports[_0x0000('0x4e')]=function(_0x2f5dfb,_0x408bdb){var _0x4651a1={'raw':![],'where':{'id':_0x2f5dfb[_0x0000('0x4f')]['id']}},_0x203ee0={};_0x203ee0['model']=_[_0x0000('0x39')](db['ServicenowConfiguration']['rawAttributes']);_0x203ee0[_0x0000('0x38')]=_[_0x0000('0x39')](_0x2f5dfb[_0x0000('0x38')]);_0x203ee0[_0x0000('0x3a')]=_[_0x0000('0x3b')](_0x203ee0[_0x0000('0x36')],_0x203ee0['query']);_0x4651a1[_0x0000('0x3c')]=_[_0x0000('0x3b')](_0x203ee0[_0x0000('0x36')],qs[_0x0000('0x3d')](_0x2f5dfb[_0x0000('0x38')]['fields']));_0x4651a1[_0x0000('0x3c')]=_0x4651a1[_0x0000('0x3c')][_0x0000('0x3e')]?_0x4651a1[_0x0000('0x3c')]:_0x203ee0['model'];if(_0x2f5dfb['query'][_0x0000('0x4a')]){_0x4651a1[_0x0000('0x4b')]=[{'all':!![]}];}_0x4651a1=_[_0x0000('0x47')]({},_0x4651a1,_0x2f5dfb['options']);return db[_0x0000('0x32')][_0x0000('0x50')](_0x4651a1)['then'](handleEntityNotFound(_0x408bdb,null))[_0x0000('0x1b')](respondWithResult(_0x408bdb,null))['catch'](handleError(_0x408bdb,null));};exports[_0x0000('0x51')]=function(_0x3c7f5d,_0x22a289){return db[_0x0000('0x32')]['create'](_0x3c7f5d[_0x0000('0x52')],{})['then'](respondWithResult(_0x22a289,0xc9))[_0x0000('0x26')](handleError(_0x22a289,null));};exports[_0x0000('0x53')]=function(_0x4dac0a,_0x51c95a){if(_0x4dac0a[_0x0000('0x52')]['id']){delete _0x4dac0a[_0x0000('0x52')]['id'];}return db[_0x0000('0x32')]['find']({'where':{'id':_0x4dac0a[_0x0000('0x4f')]['id']}})[_0x0000('0x1b')](handleEntityNotFound(_0x51c95a,null))[_0x0000('0x1b')](saveUpdates(_0x4dac0a[_0x0000('0x52')],null))[_0x0000('0x1b')](respondWithResult(_0x51c95a,null))[_0x0000('0x26')](handleError(_0x51c95a,null));};exports[_0x0000('0x2e')]=function(_0x1720d9,_0x212384){return db['ServicenowConfiguration'][_0x0000('0x50')]({'where':{'id':_0x1720d9['params']['id']}})[_0x0000('0x1b')](handleEntityNotFound(_0x212384,null))[_0x0000('0x1b')](removeEntity(_0x212384,null))[_0x0000('0x26')](handleError(_0x212384,null));};exports[_0x0000('0x54')]=function(_0x54a7f3,_0x105bbf,_0x31986a){var _0x55f1bb={};var _0x237f3d={};var _0x2dab18;var _0x25e60d;return db[_0x0000('0x32')][_0x0000('0x55')]({'where':{'id':_0x54a7f3['params']['id']}})[_0x0000('0x1b')](handleEntityNotFound(_0x105bbf,null))['then'](function(_0x34d17c){if(_0x34d17c){_0x2dab18=_0x34d17c;_0x237f3d[_0x0000('0x36')]=_['keys'](db[_0x0000('0x56')]['rawAttributes']);_0x237f3d[_0x0000('0x38')]=_[_0x0000('0x39')](_0x54a7f3['query']);_0x237f3d[_0x0000('0x3a')]=_[_0x0000('0x3b')](_0x237f3d[_0x0000('0x36')],_0x237f3d[_0x0000('0x38')]);_0x55f1bb[_0x0000('0x3c')]=_[_0x0000('0x3b')](_0x237f3d[_0x0000('0x36')],qs['fields'](_0x54a7f3[_0x0000('0x38')][_0x0000('0x3d')]));_0x55f1bb['attributes']=_0x55f1bb['attributes'][_0x0000('0x3e')]?_0x55f1bb[_0x0000('0x3c')]:_0x237f3d['model'];_0x55f1bb[_0x0000('0x42')]=qs[_0x0000('0x43')](_0x54a7f3[_0x0000('0x38')][_0x0000('0x43')]);_0x55f1bb[_0x0000('0x44')]=qs[_0x0000('0x3a')](_[_0x0000('0x45')](_0x54a7f3['query'],_0x237f3d[_0x0000('0x3a')]));if(_0x54a7f3[_0x0000('0x38')][_0x0000('0x46')]){_0x55f1bb[_0x0000('0x44')]=_[_0x0000('0x47')](_0x55f1bb[_0x0000('0x44')],{'$or':_[_0x0000('0x37')](_0x55f1bb[_0x0000('0x3c')],function(_0x846e39){var _0x13f875={};_0x13f875[_0x846e39]={'$like':'%'+_0x54a7f3[_0x0000('0x38')][_0x0000('0x46')]+'%'};return _0x13f875;})});}_0x55f1bb=_['merge']({},_0x55f1bb,_0x54a7f3[_0x0000('0x49')]);return _0x2dab18[_0x0000('0x54')](_0x55f1bb);}})[_0x0000('0x1b')](function(_0x477683){if(_0x477683){_0x25e60d=_0x477683[_0x0000('0x3e')];if(!_0x54a7f3[_0x0000('0x38')][_0x0000('0x3f')](_0x0000('0x40'))){_0x55f1bb[_0x0000('0x2b')]=qs[_0x0000('0x2b')](_0x54a7f3[_0x0000('0x38')][_0x0000('0x2b')]);_0x55f1bb[_0x0000('0x41')]=qs[_0x0000('0x41')](_0x54a7f3[_0x0000('0x38')][_0x0000('0x41')]);}return _0x2dab18[_0x0000('0x54')](_0x55f1bb);}})[_0x0000('0x1b')](function(_0x11995c){if(_0x11995c){return _0x11995c?{'count':_0x25e60d,'rows':_0x11995c}:null;}})[_0x0000('0x1b')](respondWithResult(_0x105bbf,null))[_0x0000('0x26')](handleError(_0x105bbf,null));};exports[_0x0000('0x57')]=function(_0x121565,_0x166a2a,_0xd72368){var _0x48eac9={};var _0x16a09f={};var _0x2344d5;var _0x270c1c;return db['ServicenowConfiguration'][_0x0000('0x55')]({'where':{'id':_0x121565['params']['id']}})[_0x0000('0x1b')](handleEntityNotFound(_0x166a2a,null))[_0x0000('0x1b')](function(_0x219955){if(_0x219955){_0x2344d5=_0x219955;_0x16a09f[_0x0000('0x36')]=_[_0x0000('0x39')](db['ServicenowField'][_0x0000('0x33')]);_0x16a09f[_0x0000('0x38')]=_[_0x0000('0x39')](_0x121565[_0x0000('0x38')]);_0x16a09f['filters']=_[_0x0000('0x3b')](_0x16a09f[_0x0000('0x36')],_0x16a09f[_0x0000('0x38')]);_0x48eac9[_0x0000('0x3c')]=_[_0x0000('0x3b')](_0x16a09f[_0x0000('0x36')],qs[_0x0000('0x3d')](_0x121565[_0x0000('0x38')]['fields']));_0x48eac9[_0x0000('0x3c')]=_0x48eac9[_0x0000('0x3c')][_0x0000('0x3e')]?_0x48eac9[_0x0000('0x3c')]:_0x16a09f[_0x0000('0x36')];_0x48eac9[_0x0000('0x42')]=qs[_0x0000('0x43')](_0x121565[_0x0000('0x38')]['sort']);_0x48eac9[_0x0000('0x44')]=qs[_0x0000('0x3a')](_[_0x0000('0x45')](_0x121565[_0x0000('0x38')],_0x16a09f[_0x0000('0x3a')]));if(_0x121565[_0x0000('0x38')][_0x0000('0x46')]){_0x48eac9[_0x0000('0x44')]=_[_0x0000('0x47')](_0x48eac9['where'],{'$or':_[_0x0000('0x37')](_0x48eac9[_0x0000('0x3c')],function(_0x2ed701){var _0xa91958={};_0xa91958[_0x2ed701]={'$like':'%'+_0x121565[_0x0000('0x38')]['filter']+'%'};return _0xa91958;})});}_0x48eac9=_[_0x0000('0x47')]({},_0x48eac9,_0x121565[_0x0000('0x49')]);return _0x2344d5[_0x0000('0x57')](_0x48eac9);}})['then'](function(_0x25a3a6){if(_0x25a3a6){_0x270c1c=_0x25a3a6['length'];if(!_0x121565[_0x0000('0x38')][_0x0000('0x3f')](_0x0000('0x40'))){_0x48eac9[_0x0000('0x2b')]=qs[_0x0000('0x2b')](_0x121565[_0x0000('0x38')][_0x0000('0x2b')]);_0x48eac9[_0x0000('0x41')]=qs[_0x0000('0x41')](_0x121565[_0x0000('0x38')][_0x0000('0x41')]);}return _0x2344d5['getSubjects'](_0x48eac9);}})[_0x0000('0x1b')](function(_0x1455ba){if(_0x1455ba){return _0x1455ba?{'count':_0x270c1c,'rows':_0x1455ba}:null;}})[_0x0000('0x1b')](respondWithResult(_0x166a2a,null))[_0x0000('0x26')](handleError(_0x166a2a,null));};exports[_0x0000('0x58')]=function(_0x56c86f,_0x581f19,_0x371367){var _0x4db1ef={};var _0x330bbc={};var _0x5a0c88;var _0x5a8e73;return db[_0x0000('0x32')]['findOne']({'where':{'id':_0x56c86f['params']['id']}})[_0x0000('0x1b')](handleEntityNotFound(_0x581f19,null))[_0x0000('0x1b')](function(_0x116594){if(_0x116594){_0x5a0c88=_0x116594;_0x330bbc[_0x0000('0x36')]=_['keys'](db[_0x0000('0x56')][_0x0000('0x33')]);_0x330bbc['query']=_['keys'](_0x56c86f['query']);_0x330bbc[_0x0000('0x3a')]=_[_0x0000('0x3b')](_0x330bbc[_0x0000('0x36')],_0x330bbc[_0x0000('0x38')]);_0x4db1ef['attributes']=_[_0x0000('0x3b')](_0x330bbc[_0x0000('0x36')],qs[_0x0000('0x3d')](_0x56c86f[_0x0000('0x38')][_0x0000('0x3d')]));_0x4db1ef[_0x0000('0x3c')]=_0x4db1ef['attributes'][_0x0000('0x3e')]?_0x4db1ef[_0x0000('0x3c')]:_0x330bbc['model'];_0x4db1ef['order']=qs[_0x0000('0x43')](_0x56c86f[_0x0000('0x38')][_0x0000('0x43')]);_0x4db1ef[_0x0000('0x44')]=qs[_0x0000('0x3a')](_[_0x0000('0x45')](_0x56c86f[_0x0000('0x38')],_0x330bbc[_0x0000('0x3a')]));if(_0x56c86f['query'][_0x0000('0x46')]){_0x4db1ef[_0x0000('0x44')]=_[_0x0000('0x47')](_0x4db1ef[_0x0000('0x44')],{'$or':_[_0x0000('0x37')](_0x4db1ef[_0x0000('0x3c')],function(_0x137e83){var _0x42031c={};_0x42031c[_0x137e83]={'$like':'%'+_0x56c86f[_0x0000('0x38')][_0x0000('0x46')]+'%'};return _0x42031c;})});}_0x4db1ef=_[_0x0000('0x47')]({},_0x4db1ef,_0x56c86f[_0x0000('0x49')]);return _0x5a0c88[_0x0000('0x58')](_0x4db1ef);}})['then'](function(_0x2ac274){if(_0x2ac274){_0x5a8e73=_0x2ac274[_0x0000('0x3e')];if(!_0x56c86f[_0x0000('0x38')][_0x0000('0x3f')](_0x0000('0x40'))){_0x4db1ef[_0x0000('0x2b')]=qs[_0x0000('0x2b')](_0x56c86f[_0x0000('0x38')][_0x0000('0x2b')]);_0x4db1ef['offset']=qs['offset'](_0x56c86f['query'][_0x0000('0x41')]);}return _0x5a0c88[_0x0000('0x58')](_0x4db1ef);}})['then'](function(_0x430742){if(_0x430742){return _0x430742?{'count':_0x5a8e73,'rows':_0x430742}:null;}})[_0x0000('0x1b')](respondWithResult(_0x581f19,null))['catch'](handleError(_0x581f19,null));}; \ No newline at end of file +var _0x7121=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','show','params','keys','model','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto'];(function(_0x1895fb,_0x2c1d92){var _0x1a5046=function(_0x51469d){while(--_0x51469d){_0x1895fb['push'](_0x1895fb['shift']());}};_0x1a5046(++_0x2c1d92);}(_0x7121,0x1b4));var _0x1712=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7121[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0x1712('0x0'));var emlformat=require(_0x1712('0x1'));var rimraf=require(_0x1712('0x2'));var zipdir=require(_0x1712('0x3'));var jsonpatch=require(_0x1712('0x4'));var rp=require(_0x1712('0x5'));var moment=require(_0x1712('0x6'));var BPromise=require(_0x1712('0x7'));var Mustache=require(_0x1712('0x8'));var util=require(_0x1712('0x9'));var path=require('path');var sox=require(_0x1712('0xa'));var csv=require(_0x1712('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1712('0xc'));var crypto=require(_0x1712('0xd'));var jsforce=require(_0x1712('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1712('0xb'));var querystring=require(_0x1712('0xf'));var Papa=require(_0x1712('0x10'));var Redis=require(_0x1712('0x11'));var authService=require(_0x1712('0x12'));var qs=require(_0x1712('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1712('0x14'));var logger=require(_0x1712('0x15'))(_0x1712('0x16'));var utils=require(_0x1712('0x17'));var config=require(_0x1712('0x18'));var licenseUtil=require(_0x1712('0x19'));var db=require(_0x1712('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7dd1,_0x232aa3,_0x3447b6,_0x1ea55e){return new BPromise(function(_0xec3af6,_0x5de357){var _0x5b3900=_0x1ea55e||client;return _0x5b3900[_0x1712('0x1b')](_0x2f7dd1,_0x3447b6)[_0x1712('0x1c')](function(_0x239009){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x232aa3,_0x1712('0x1d'));logger[_0x1712('0x1e')](_0x1712('0x1f'),_0x232aa3,'request\x20sent',JSON[_0x1712('0x20')](_0x239009));if(_0x239009['error']){if(_0x239009['error']['code']===0x1f4){logger[_0x1712('0x21')](_0x1712('0x22'),_0x232aa3,_0x239009[_0x1712('0x21')]['message']);return _0x5de357(_0x239009[_0x1712('0x21')][_0x1712('0x23')]);}logger['error'](_0x1712('0x22'),_0x232aa3,_0x239009['error'][_0x1712('0x23')]);return _0xec3af6(_0x239009[_0x1712('0x21')][_0x1712('0x23')]);}else{logger[_0x1712('0x24')](_0x1712('0x22'),_0x232aa3,_0x1712('0x1d'));_0xec3af6(_0x239009['result'][_0x1712('0x23')]);}})[_0x1712('0x25')](function(_0x3eafec){logger[_0x1712('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x232aa3,_0x3eafec);_0x5de357(_0x3eafec);});});}function respondWithStatusCode(_0x2f578c,_0x5be619){_0x5be619=_0x5be619||0xcc;return function(_0x173192){if(_0x173192){return _0x2f578c[_0x1712('0x26')](_0x5be619);}return _0x2f578c[_0x1712('0x27')](_0x5be619)[_0x1712('0x28')]();};}function respondWithResult(_0x5a5e3c,_0x45deed){_0x45deed=_0x45deed||0xc8;return function(_0x116c72){if(_0x116c72){return _0x5a5e3c[_0x1712('0x27')](_0x45deed)[_0x1712('0x29')](_0x116c72);}};}function respondWithFilteredResult(_0x5b5f08,_0x413571){return function(_0x50c9d3){if(_0x50c9d3){var _0x40a188=_0x50c9d3[_0x1712('0x2a')],_0x2566a0=_0x413571[_0x1712('0x2b')],_0x18f2e8=_0x413571['offset']+_0x413571['limit'],_0x51fa71;if(_0x18f2e8>=_0x40a188){_0x18f2e8=_0x40a188;_0x51fa71=0xc8;}else{_0x51fa71=0xce;}_0x5b5f08['status'](_0x51fa71);return _0x5b5f08[_0x1712('0x2c')](_0x1712('0x2d'),_0x2566a0+'-'+_0x18f2e8+'/'+_0x40a188)[_0x1712('0x29')](_0x50c9d3);}return null;};}function patchUpdates(_0x4dd522){return function(_0x4ffee3){try{jsonpatch[_0x1712('0x2e')](_0x4ffee3,_0x4dd522,!![]);}catch(_0x26f7d6){return BPromise[_0x1712('0x2f')](_0x26f7d6);}return _0x4ffee3['save']();};}function saveUpdates(_0x336265,_0x306cd1){return function(_0x4f7f3e){if(_0x4f7f3e){return _0x4f7f3e[_0x1712('0x30')](_0x336265)[_0x1712('0x1c')](function(_0x11ada3){return _0x11ada3;});}return null;};}function removeEntity(_0x4f7aa2,_0x3cd64d){return function(_0x37bed5){if(_0x37bed5){return _0x37bed5[_0x1712('0x31')]()[_0x1712('0x1c')](function(){_0x4f7aa2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e084f,_0x2abd06){return function(_0xa7e470){if(!_0xa7e470){_0x1e084f[_0x1712('0x26')](0x194);}return _0xa7e470;};}function handleError(_0x5c4deb,_0x24bf7c){_0x24bf7c=_0x24bf7c||0x1f4;return function(_0x516df4){logger['error'](_0x516df4[_0x1712('0x32')]);if(_0x516df4[_0x1712('0x33')]){delete _0x516df4[_0x1712('0x33')];}_0x5c4deb[_0x1712('0x27')](_0x24bf7c)[_0x1712('0x34')](_0x516df4);};}exports[_0x1712('0x35')]=function(_0x4f9b83,_0x5c0ff3){var _0x5ae969={},_0x55a84e={},_0x54d4e4={'count':0x0,'rows':[]};var _0x237153=_[_0x1712('0x36')](db[_0x1712('0x37')][_0x1712('0x38')],function(_0x2f5150){return{'name':_0x2f5150[_0x1712('0x39')],'type':_0x2f5150[_0x1712('0x3a')]['key']};});_0x55a84e['model']=_['map'](_0x237153,'name');_0x55a84e[_0x1712('0x3b')]=_['keys'](_0x4f9b83[_0x1712('0x3b')]);_0x55a84e['filters']=_[_0x1712('0x3c')](_0x55a84e['model'],_0x55a84e[_0x1712('0x3b')]);_0x5ae969[_0x1712('0x3d')]=_[_0x1712('0x3c')](_0x55a84e['model'],qs[_0x1712('0x3e')](_0x4f9b83[_0x1712('0x3b')][_0x1712('0x3e')]));_0x5ae969[_0x1712('0x3d')]=_0x5ae969['attributes'][_0x1712('0x3f')]?_0x5ae969[_0x1712('0x3d')]:_0x55a84e['model'];if(!_0x4f9b83[_0x1712('0x3b')][_0x1712('0x40')](_0x1712('0x41'))){_0x5ae969[_0x1712('0x42')]=qs[_0x1712('0x42')](_0x4f9b83['query'][_0x1712('0x42')]);_0x5ae969[_0x1712('0x2b')]=qs[_0x1712('0x2b')](_0x4f9b83[_0x1712('0x3b')][_0x1712('0x2b')]);}_0x5ae969[_0x1712('0x43')]=qs[_0x1712('0x44')](_0x4f9b83[_0x1712('0x3b')]['sort']);_0x5ae969[_0x1712('0x45')]=qs[_0x1712('0x46')](_[_0x1712('0x47')](_0x4f9b83['query'],_0x55a84e[_0x1712('0x46')]),_0x237153);if(_0x4f9b83[_0x1712('0x3b')]['filter']){_0x5ae969[_0x1712('0x45')]=_[_0x1712('0x48')](_0x5ae969[_0x1712('0x45')],{'$or':_[_0x1712('0x36')](_0x237153,function(_0x27f05f){if(_0x27f05f[_0x1712('0x3a')]!=='VIRTUAL'){var _0x5e7985={};_0x5e7985[_0x27f05f[_0x1712('0x33')]]={'$like':'%'+_0x4f9b83[_0x1712('0x3b')][_0x1712('0x49')]+'%'};return _0x5e7985;}})});}_0x5ae969=_[_0x1712('0x48')]({},_0x5ae969,_0x4f9b83[_0x1712('0x4a')]);var _0x12edad={'where':_0x5ae969[_0x1712('0x45')]};return db[_0x1712('0x37')][_0x1712('0x2a')](_0x12edad)[_0x1712('0x1c')](function(_0x40f6cd){_0x54d4e4[_0x1712('0x2a')]=_0x40f6cd;if(_0x4f9b83[_0x1712('0x3b')][_0x1712('0x4b')]){_0x5ae969[_0x1712('0x4c')]=[{'all':!![]}];}return db[_0x1712('0x37')][_0x1712('0x4d')](_0x5ae969);})[_0x1712('0x1c')](function(_0x8fa615){_0x54d4e4['rows']=_0x8fa615;return _0x54d4e4;})[_0x1712('0x1c')](respondWithFilteredResult(_0x5c0ff3,_0x5ae969))['catch'](handleError(_0x5c0ff3,null));};exports[_0x1712('0x4e')]=function(_0xe384ee,_0x2ff4f0){var _0x3ea0e2={'raw':![],'where':{'id':_0xe384ee[_0x1712('0x4f')]['id']}},_0x33cbc9={};_0x33cbc9['model']=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x33cbc9[_0x1712('0x3b')]=_[_0x1712('0x50')](_0xe384ee['query']);_0x33cbc9[_0x1712('0x46')]=_[_0x1712('0x3c')](_0x33cbc9[_0x1712('0x51')],_0x33cbc9[_0x1712('0x3b')]);_0x3ea0e2[_0x1712('0x3d')]=_[_0x1712('0x3c')](_0x33cbc9[_0x1712('0x51')],qs['fields'](_0xe384ee['query']['fields']));_0x3ea0e2['attributes']=_0x3ea0e2[_0x1712('0x3d')][_0x1712('0x3f')]?_0x3ea0e2[_0x1712('0x3d')]:_0x33cbc9['model'];if(_0xe384ee[_0x1712('0x3b')]['includeAll']){_0x3ea0e2['include']=[{'all':!![]}];}_0x3ea0e2=_[_0x1712('0x48')]({},_0x3ea0e2,_0xe384ee[_0x1712('0x4a')]);return db[_0x1712('0x37')][_0x1712('0x52')](_0x3ea0e2)[_0x1712('0x1c')](handleEntityNotFound(_0x2ff4f0,null))[_0x1712('0x1c')](respondWithResult(_0x2ff4f0,null))[_0x1712('0x25')](handleError(_0x2ff4f0,null));};exports[_0x1712('0x53')]=function(_0x5c5d16,_0x33db09){return db[_0x1712('0x37')][_0x1712('0x53')](_0x5c5d16['body'],{})[_0x1712('0x1c')](respondWithResult(_0x33db09,0xc9))['catch'](handleError(_0x33db09,null));};exports[_0x1712('0x30')]=function(_0xd6e0ac,_0x3eb547){if(_0xd6e0ac[_0x1712('0x54')]['id']){delete _0xd6e0ac['body']['id'];}return db[_0x1712('0x37')][_0x1712('0x52')]({'where':{'id':_0xd6e0ac['params']['id']}})['then'](handleEntityNotFound(_0x3eb547,null))[_0x1712('0x1c')](saveUpdates(_0xd6e0ac[_0x1712('0x54')],null))['then'](respondWithResult(_0x3eb547,null))['catch'](handleError(_0x3eb547,null));};exports['destroy']=function(_0x355558,_0x468db0){return db[_0x1712('0x37')][_0x1712('0x52')]({'where':{'id':_0x355558['params']['id']}})[_0x1712('0x1c')](handleEntityNotFound(_0x468db0,null))['then'](removeEntity(_0x468db0,null))[_0x1712('0x25')](handleError(_0x468db0,null));};exports[_0x1712('0x55')]=function(_0x66df8d,_0x109134,_0x6dd900){var _0x9dda28={};var _0x11cbb1={};var _0x109283;var _0x45bebc;return db['ServicenowConfiguration'][_0x1712('0x56')]({'where':{'id':_0x66df8d[_0x1712('0x4f')]['id']}})['then'](handleEntityNotFound(_0x109134,null))[_0x1712('0x1c')](function(_0xc7beb4){if(_0xc7beb4){_0x109283=_0xc7beb4;_0x11cbb1[_0x1712('0x51')]=_[_0x1712('0x50')](db[_0x1712('0x57')][_0x1712('0x38')]);_0x11cbb1[_0x1712('0x3b')]=_[_0x1712('0x50')](_0x66df8d[_0x1712('0x3b')]);_0x11cbb1[_0x1712('0x46')]=_[_0x1712('0x3c')](_0x11cbb1[_0x1712('0x51')],_0x11cbb1[_0x1712('0x3b')]);_0x9dda28[_0x1712('0x3d')]=_[_0x1712('0x3c')](_0x11cbb1[_0x1712('0x51')],qs[_0x1712('0x3e')](_0x66df8d['query'][_0x1712('0x3e')]));_0x9dda28['attributes']=_0x9dda28['attributes'][_0x1712('0x3f')]?_0x9dda28[_0x1712('0x3d')]:_0x11cbb1[_0x1712('0x51')];_0x9dda28[_0x1712('0x43')]=qs[_0x1712('0x44')](_0x66df8d['query'][_0x1712('0x44')]);_0x9dda28[_0x1712('0x45')]=qs[_0x1712('0x46')](_[_0x1712('0x47')](_0x66df8d[_0x1712('0x3b')],_0x11cbb1[_0x1712('0x46')]));if(_0x66df8d[_0x1712('0x3b')]['filter']){_0x9dda28['where']=_['merge'](_0x9dda28[_0x1712('0x45')],{'$or':_[_0x1712('0x36')](_0x9dda28[_0x1712('0x3d')],function(_0x58c1ba){var _0x5da5db={};_0x5da5db[_0x58c1ba]={'$like':'%'+_0x66df8d[_0x1712('0x3b')]['filter']+'%'};return _0x5da5db;})});}_0x9dda28=_[_0x1712('0x48')]({},_0x9dda28,_0x66df8d[_0x1712('0x4a')]);return _0x109283['getFields'](_0x9dda28);}})[_0x1712('0x1c')](function(_0x29f645){if(_0x29f645){_0x45bebc=_0x29f645['length'];if(!_0x66df8d[_0x1712('0x3b')][_0x1712('0x40')](_0x1712('0x41'))){_0x9dda28[_0x1712('0x42')]=qs['limit'](_0x66df8d[_0x1712('0x3b')]['limit']);_0x9dda28[_0x1712('0x2b')]=qs[_0x1712('0x2b')](_0x66df8d['query'][_0x1712('0x2b')]);}return _0x109283[_0x1712('0x55')](_0x9dda28);}})[_0x1712('0x1c')](function(_0x2064c6){if(_0x2064c6){return _0x2064c6?{'count':_0x45bebc,'rows':_0x2064c6}:null;}})[_0x1712('0x1c')](respondWithResult(_0x109134,null))[_0x1712('0x25')](handleError(_0x109134,null));};exports['getSubjects']=function(_0x8bece4,_0x2ac8ac,_0x2ef261){var _0x45f115={};var _0x287bb9={};var _0x9bb7fe;var _0x346e48;return db[_0x1712('0x37')][_0x1712('0x56')]({'where':{'id':_0x8bece4[_0x1712('0x4f')]['id']}})[_0x1712('0x1c')](handleEntityNotFound(_0x2ac8ac,null))['then'](function(_0x334eef){if(_0x334eef){_0x9bb7fe=_0x334eef;_0x287bb9[_0x1712('0x51')]=_[_0x1712('0x50')](db[_0x1712('0x57')][_0x1712('0x38')]);_0x287bb9[_0x1712('0x3b')]=_[_0x1712('0x50')](_0x8bece4['query']);_0x287bb9[_0x1712('0x46')]=_[_0x1712('0x3c')](_0x287bb9[_0x1712('0x51')],_0x287bb9[_0x1712('0x3b')]);_0x45f115['attributes']=_['intersection'](_0x287bb9[_0x1712('0x51')],qs['fields'](_0x8bece4[_0x1712('0x3b')][_0x1712('0x3e')]));_0x45f115['attributes']=_0x45f115[_0x1712('0x3d')][_0x1712('0x3f')]?_0x45f115[_0x1712('0x3d')]:_0x287bb9[_0x1712('0x51')];_0x45f115[_0x1712('0x43')]=qs[_0x1712('0x44')](_0x8bece4[_0x1712('0x3b')]['sort']);_0x45f115['where']=qs[_0x1712('0x46')](_[_0x1712('0x47')](_0x8bece4[_0x1712('0x3b')],_0x287bb9[_0x1712('0x46')]));if(_0x8bece4['query'][_0x1712('0x49')]){_0x45f115[_0x1712('0x45')]=_['merge'](_0x45f115[_0x1712('0x45')],{'$or':_[_0x1712('0x36')](_0x45f115[_0x1712('0x3d')],function(_0x9cb73c){var _0x39c9a2={};_0x39c9a2[_0x9cb73c]={'$like':'%'+_0x8bece4[_0x1712('0x3b')][_0x1712('0x49')]+'%'};return _0x39c9a2;})});}_0x45f115=_[_0x1712('0x48')]({},_0x45f115,_0x8bece4[_0x1712('0x4a')]);return _0x9bb7fe[_0x1712('0x58')](_0x45f115);}})[_0x1712('0x1c')](function(_0x517456){if(_0x517456){_0x346e48=_0x517456[_0x1712('0x3f')];if(!_0x8bece4[_0x1712('0x3b')]['hasOwnProperty'](_0x1712('0x41'))){_0x45f115['limit']=qs[_0x1712('0x42')](_0x8bece4[_0x1712('0x3b')][_0x1712('0x42')]);_0x45f115[_0x1712('0x2b')]=qs[_0x1712('0x2b')](_0x8bece4[_0x1712('0x3b')][_0x1712('0x2b')]);}return _0x9bb7fe[_0x1712('0x58')](_0x45f115);}})[_0x1712('0x1c')](function(_0x489d49){if(_0x489d49){return _0x489d49?{'count':_0x346e48,'rows':_0x489d49}:null;}})['then'](respondWithResult(_0x2ac8ac,null))['catch'](handleError(_0x2ac8ac,null));};exports[_0x1712('0x59')]=function(_0x54a9ad,_0x1c231a,_0x4ab066){var _0x503ee9={};var _0x4419f7={};var _0x10a385;var _0x51c165;return db['ServicenowConfiguration'][_0x1712('0x56')]({'where':{'id':_0x54a9ad[_0x1712('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c231a,null))[_0x1712('0x1c')](function(_0x5ec4de){if(_0x5ec4de){_0x10a385=_0x5ec4de;_0x4419f7['model']=_['keys'](db[_0x1712('0x57')]['rawAttributes']);_0x4419f7['query']=_[_0x1712('0x50')](_0x54a9ad['query']);_0x4419f7['filters']=_[_0x1712('0x3c')](_0x4419f7[_0x1712('0x51')],_0x4419f7[_0x1712('0x3b')]);_0x503ee9['attributes']=_[_0x1712('0x3c')](_0x4419f7['model'],qs[_0x1712('0x3e')](_0x54a9ad[_0x1712('0x3b')]['fields']));_0x503ee9[_0x1712('0x3d')]=_0x503ee9[_0x1712('0x3d')][_0x1712('0x3f')]?_0x503ee9[_0x1712('0x3d')]:_0x4419f7['model'];_0x503ee9[_0x1712('0x43')]=qs[_0x1712('0x44')](_0x54a9ad['query'][_0x1712('0x44')]);_0x503ee9[_0x1712('0x45')]=qs['filters'](_[_0x1712('0x47')](_0x54a9ad[_0x1712('0x3b')],_0x4419f7[_0x1712('0x46')]));if(_0x54a9ad[_0x1712('0x3b')][_0x1712('0x49')]){_0x503ee9[_0x1712('0x45')]=_[_0x1712('0x48')](_0x503ee9[_0x1712('0x45')],{'$or':_[_0x1712('0x36')](_0x503ee9[_0x1712('0x3d')],function(_0x10ddcd){var _0x381d7f={};_0x381d7f[_0x10ddcd]={'$like':'%'+_0x54a9ad[_0x1712('0x3b')][_0x1712('0x49')]+'%'};return _0x381d7f;})});}_0x503ee9=_[_0x1712('0x48')]({},_0x503ee9,_0x54a9ad[_0x1712('0x4a')]);return _0x10a385['getDescriptions'](_0x503ee9);}})[_0x1712('0x1c')](function(_0xcbfd6){if(_0xcbfd6){_0x51c165=_0xcbfd6['length'];if(!_0x54a9ad[_0x1712('0x3b')]['hasOwnProperty'](_0x1712('0x41'))){_0x503ee9['limit']=qs[_0x1712('0x42')](_0x54a9ad[_0x1712('0x3b')][_0x1712('0x42')]);_0x503ee9[_0x1712('0x2b')]=qs['offset'](_0x54a9ad['query'][_0x1712('0x2b')]);}return _0x10a385['getDescriptions'](_0x503ee9);}})[_0x1712('0x1c')](function(_0x30223e){if(_0x30223e){return _0x30223e?{'count':_0x51c165,'rows':_0x30223e}:null;}})[_0x1712('0x1c')](respondWithResult(_0x1c231a,null))[_0x1712('0x25')](handleError(_0x1c231a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d2056ff..2732d06 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 _0x2f36=['../../config/environment','./intServicenowConfiguration.attributes','exports','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fa914,_0x5645bd){var _0x5a46cd=function(_0x5b494f){while(--_0x5b494f){_0x4fa914['push'](_0x4fa914['shift']());}};_0x5a46cd(++_0x5645bd);}(_0x2f36,0x1e4));var _0x62f3=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x2f36[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x62f3('0x0'));var util=require(_0x62f3('0x1'));var logger=require(_0x62f3('0x2'))('api');var moment=require(_0x62f3('0x3'));var BPromise=require(_0x62f3('0x4'));var rp=require(_0x62f3('0x5'));var fs=require('fs');var path=require(_0x62f3('0x6'));var rimraf=require(_0x62f3('0x7'));var config=require(_0x62f3('0x8'));var attributes=require(_0x62f3('0x9'));module[_0x62f3('0xa')]=function(_0x4732e2,_0x1bf458){return _0x4732e2['define']('ServicenowConfiguration',attributes,{'tableName':_0x62f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5625=['ServicenowConfiguration','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x133767,_0x91921f){var _0x56e9ff=function(_0x45231e){while(--_0x45231e){_0x133767['push'](_0x133767['shift']());}};_0x56e9ff(++_0x91921f);}(_0x5625,0x156));var _0x5562=function(_0x434de1,_0x43a034){_0x434de1=_0x434de1-0x0;var _0x37402a=_0x5625[_0x434de1];return _0x37402a;};'use strict';var _=require(_0x5562('0x0'));var util=require(_0x5562('0x1'));var logger=require('../../config/logger')(_0x5562('0x2'));var moment=require(_0x5562('0x3'));var BPromise=require(_0x5562('0x4'));var rp=require(_0x5562('0x5'));var fs=require('fs');var path=require(_0x5562('0x6'));var rimraf=require('rimraf');var config=require(_0x5562('0x7'));var attributes=require(_0x5562('0x8'));module[_0x5562('0x9')]=function(_0x31f486,_0x2a1d1d){return _0x31f486['define'](_0x5562('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 3735778..c79c1cb 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 _0x5fb3=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x18380c,_0x5d6ed8){var _0x2f8fea=function(_0x2d8c65){while(--_0x2d8c65){_0x18380c['push'](_0x18380c['shift']());}};_0x2f8fea(++_0x5d6ed8);}(_0x5fb3,0xca));var _0x35fb=function(_0x5a0076,_0x5b042a){_0x5a0076=_0x5a0076-0x0;var _0xbb6c21=_0x5fb3[_0x5a0076];return _0xbb6c21;};'use strict';var _=require(_0x35fb('0x0'));var util=require(_0x35fb('0x1'));var moment=require(_0x35fb('0x2'));var BPromise=require(_0x35fb('0x3'));var rs=require(_0x35fb('0x4'));var fs=require('fs');var Redis=require(_0x35fb('0x5'));var db=require(_0x35fb('0x6'))['db'];var utils=require(_0x35fb('0x7'));var logger=require('../../config/logger')(_0x35fb('0x8'));var config=require(_0x35fb('0x9'));var jayson=require(_0x35fb('0xa'));var client=jayson[_0x35fb('0xb')][_0x35fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50d801,_0x53407f,_0x13e21e){return new BPromise(function(_0x5884f0,_0x41680f){return client[_0x35fb('0xd')](_0x50d801,_0x13e21e)['then'](function(_0x4f0248){logger[_0x35fb('0xe')](_0x35fb('0xf'),_0x53407f,_0x35fb('0x10'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x53407f,_0x35fb('0x10'),JSON[_0x35fb('0x11')](_0x4f0248));if(_0x4f0248[_0x35fb('0x12')]){if(_0x4f0248[_0x35fb('0x12')][_0x35fb('0x13')]===0x1f4){logger['error'](_0x35fb('0xf'),_0x53407f,_0x4f0248['error'][_0x35fb('0x14')]);return _0x41680f(_0x4f0248[_0x35fb('0x12')]['message']);}logger[_0x35fb('0x12')](_0x35fb('0xf'),_0x53407f,_0x4f0248[_0x35fb('0x12')]['message']);return _0x5884f0(_0x4f0248[_0x35fb('0x12')][_0x35fb('0x14')]);}else{logger[_0x35fb('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x53407f,_0x35fb('0x10'));_0x5884f0(_0x4f0248[_0x35fb('0x15')][_0x35fb('0x14')]);}})['catch'](function(_0x800d5f){logger[_0x35fb('0x12')](_0x35fb('0xf'),_0x53407f,_0x800d5f);_0x41680f(_0x800d5f);});});} \ No newline at end of file +var _0x3c50=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x450c37,_0x44c847){var _0x156b31=function(_0x3a1b5a){while(--_0x3a1b5a){_0x450c37['push'](_0x450c37['shift']());}};_0x156b31(++_0x44c847);}(_0x3c50,0xd7));var _0x03c5=function(_0x6b6090,_0x3d888e){_0x6b6090=_0x6b6090-0x0;var _0x1ec0cb=_0x3c50[_0x6b6090];return _0x1ec0cb;};'use strict';var _=require(_0x03c5('0x0'));var util=require(_0x03c5('0x1'));var moment=require(_0x03c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x03c5('0x3'));var fs=require('fs');var Redis=require(_0x03c5('0x4'));var db=require(_0x03c5('0x5'))['db'];var utils=require(_0x03c5('0x6'));var logger=require(_0x03c5('0x7'))('rpc');var config=require(_0x03c5('0x8'));var jayson=require(_0x03c5('0x9'));var client=jayson[_0x03c5('0xa')][_0x03c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f18eb,_0x14cf9f,_0x644e7f){return new BPromise(function(_0x577ff0,_0xd64952){return client[_0x03c5('0xc')](_0x4f18eb,_0x644e7f)[_0x03c5('0xd')](function(_0x234fbe){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x14cf9f,_0x03c5('0xe'));logger['debug'](_0x03c5('0xf'),_0x14cf9f,_0x03c5('0xe'),JSON['stringify'](_0x234fbe));if(_0x234fbe[_0x03c5('0x10')]){if(_0x234fbe[_0x03c5('0x10')][_0x03c5('0x11')]===0x1f4){logger['error'](_0x03c5('0x12'),_0x14cf9f,_0x234fbe[_0x03c5('0x10')][_0x03c5('0x13')]);return _0xd64952(_0x234fbe[_0x03c5('0x10')][_0x03c5('0x13')]);}logger[_0x03c5('0x10')](_0x03c5('0x12'),_0x14cf9f,_0x234fbe[_0x03c5('0x10')][_0x03c5('0x13')]);return _0x577ff0(_0x234fbe[_0x03c5('0x10')]['message']);}else{logger[_0x03c5('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x14cf9f,_0x03c5('0xe'));_0x577ff0(_0x234fbe[_0x03c5('0x15')][_0x03c5('0x13')]);}})[_0x03c5('0x16')](function(_0x7beca3){logger[_0x03c5('0x10')](_0x03c5('0x12'),_0x14cf9f,_0x7beca3);_0xd64952(_0x7beca3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 8a05011..4512377 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 _0x62c4=['Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x62c4,0x199));var _0x462c=function(_0xfa859b,_0x2402d8){_0xfa859b=_0xfa859b-0x0;var _0x3467da=_0x62c4[_0xfa859b];return _0x3467da;};'use strict';var multer=require(_0x462c('0x0'));var util=require(_0x462c('0x1'));var path=require(_0x462c('0x2'));var timeout=require(_0x462c('0x3'));var express=require(_0x462c('0x4'));var router=express[_0x462c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x462c('0x6'));var config=require(_0x462c('0x7'));var controller=require(_0x462c('0x8'));router[_0x462c('0x9')]('/',auth[_0x462c('0xa')](),controller['index']);router[_0x462c('0x9')]('/:id',auth[_0x462c('0xa')](),controller[_0x462c('0xb')]);router[_0x462c('0xc')]('/',auth[_0x462c('0xa')](),controller[_0x462c('0xd')]);router[_0x462c('0xe')](_0x462c('0xf'),auth[_0x462c('0xa')](),controller['update']);router['delete'](_0x462c('0xf'),auth[_0x462c('0xa')](),controller[_0x462c('0x10')]);module[_0x462c('0x11')]=router; \ No newline at end of file +var _0x9efd=['/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x1afecd,_0x5444bc){var _0x4481ff=function(_0x3d18dd){while(--_0x3d18dd){_0x1afecd['push'](_0x1afecd['shift']());}};_0x4481ff(++_0x5444bc);}(_0x9efd,0x17c));var _0xd9ef=function(_0x55d50a,_0x261a4b){_0x55d50a=_0x55d50a-0x0;var _0x48d0d2=_0x9efd[_0x55d50a];return _0x48d0d2;};'use strict';var multer=require('multer');var util=require(_0xd9ef('0x0'));var path=require(_0xd9ef('0x1'));var timeout=require(_0xd9ef('0x2'));var express=require(_0xd9ef('0x3'));var router=express[_0xd9ef('0x4')]();var auth=require(_0xd9ef('0x5'));var interaction=require(_0xd9ef('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ef('0x7'));router[_0xd9ef('0x8')]('/',auth[_0xd9ef('0x9')](),controller[_0xd9ef('0xa')]);router[_0xd9ef('0x8')](_0xd9ef('0xb'),auth[_0xd9ef('0x9')](),controller['show']);router[_0xd9ef('0xc')]('/',auth[_0xd9ef('0x9')](),controller['create']);router[_0xd9ef('0xd')](_0xd9ef('0xb'),auth[_0xd9ef('0x9')](),controller[_0xd9ef('0xe')]);router[_0xd9ef('0xf')](_0xd9ef('0xb'),auth['isAuthenticated'](),controller[_0xd9ef('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 40739ec..659f532 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 _0xecd5=['exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x174b54,_0xd94663){var _0x396da9=function(_0x2f2058){while(--_0x2f2058){_0x174b54['push'](_0x174b54['shift']());}};_0x396da9(++_0xd94663);}(_0xecd5,0x110));var _0x5ecd=function(_0x3226cd,_0x51ee01){_0x3226cd=_0x3226cd-0x0;var _0x22990e=_0xecd5[_0x3226cd];return _0x22990e;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'type':{'type':Sequelize[_0x5ecd('0x1')](_0x5ecd('0x2'),'variable',_0x5ecd('0x3'),_0x5ecd('0x4')),'defaultValue':_0x5ecd('0x2')},'content':{'type':Sequelize[_0x5ecd('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5ecd('0x1')]('string',_0x5ecd('0x6'),_0x5ecd('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5ecd('0x5')]},'nameField':{'type':Sequelize[_0x5ecd('0x5')]},'customField':{'type':Sequelize[_0x5ecd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ecd('0x5')]}}; \ No newline at end of file +var _0xdf03=['ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x340a4b,_0x4fff8a){var _0x35cf2e=function(_0xb39570){while(--_0xb39570){_0x340a4b['push'](_0x340a4b['shift']());}};_0x35cf2e(++_0x4fff8a);}(_0xdf03,0x73));var _0x3df0=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xdf03[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0x3df0('0x0'));module[_0x3df0('0x1')]={'type':{'type':Sequelize[_0x3df0('0x2')]('string',_0x3df0('0x3'),_0x3df0('0x4'),_0x3df0('0x5')),'defaultValue':_0x3df0('0x6')},'content':{'type':Sequelize[_0x3df0('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3df0('0x2')]('string',_0x3df0('0x3'),_0x3df0('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3df0('0x7')]},'nameField':{'type':Sequelize[_0x3df0('0x7')]},'customField':{'type':Sequelize[_0x3df0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3df0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index cff5707..5bc8d7e 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 _0x63ad=['../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowField','includeAll','include','findAll','rows','catch','show','intersection','fields','length','find','create','body','params','destroy','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x63ad,0x7d));var _0xd63a=function(_0x19b7d7,_0x29d335){_0x19b7d7=_0x19b7d7-0x0;var _0x29a442=_0x63ad[_0x19b7d7];return _0x29a442;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd63a('0x0'));var rimraf=require(_0xd63a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd63a('0x2'));var Mustache=require(_0xd63a('0x3'));var util=require('util');var path=require(_0xd63a('0x4'));var sox=require(_0xd63a('0x5'));var csv=require(_0xd63a('0x6'));var ejs=require(_0xd63a('0x7'));var fs=require('fs');var _=require(_0xd63a('0x8'));var squel=require(_0xd63a('0x9'));var crypto=require('crypto');var jsforce=require(_0xd63a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd63a('0x6'));var querystring=require('querystring');var Papa=require(_0xd63a('0xb'));var Redis=require(_0xd63a('0xc'));var authService=require(_0xd63a('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd63a('0xe'))('api');var utils=require(_0xd63a('0xf'));var config=require(_0xd63a('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xd63a('0x11'))['db'];function respondWithStatusCode(_0x24bc2b,_0x2d58fe){_0x2d58fe=_0x2d58fe||0xcc;return function(_0x4741f5){if(_0x4741f5){return _0x24bc2b[_0xd63a('0x12')](_0x2d58fe);}return _0x24bc2b[_0xd63a('0x13')](_0x2d58fe)[_0xd63a('0x14')]();};}function respondWithResult(_0x507082,_0x1b3551){_0x1b3551=_0x1b3551||0xc8;return function(_0x24bd46){if(_0x24bd46){return _0x507082[_0xd63a('0x13')](_0x1b3551)[_0xd63a('0x15')](_0x24bd46);}};}function respondWithFilteredResult(_0x1284cf,_0x2c4ff8){return function(_0x2d9b2b){if(_0x2d9b2b){var _0x59423d=_0x2d9b2b[_0xd63a('0x16')],_0x3a0ce1=_0x2c4ff8[_0xd63a('0x17')],_0x5f37a1=_0x2c4ff8[_0xd63a('0x17')]+_0x2c4ff8[_0xd63a('0x18')],_0x11c164;if(_0x5f37a1>=_0x59423d){_0x5f37a1=_0x59423d;_0x11c164=0xc8;}else{_0x11c164=0xce;}_0x1284cf[_0xd63a('0x13')](_0x11c164);return _0x1284cf[_0xd63a('0x19')](_0xd63a('0x1a'),_0x3a0ce1+'-'+_0x5f37a1+'/'+_0x59423d)['json'](_0x2d9b2b);}return null;};}function patchUpdates(_0xacfe33){return function(_0x5c2f07){try{jsonpatch[_0xd63a('0x1b')](_0x5c2f07,_0xacfe33,!![]);}catch(_0x4d8bd3){return BPromise['reject'](_0x4d8bd3);}return _0x5c2f07['save']();};}function saveUpdates(_0x39c30f,_0x30d7c1){return function(_0x1eccf6){if(_0x1eccf6){return _0x1eccf6[_0xd63a('0x1c')](_0x39c30f)['then'](function(_0x2a1067){return _0x2a1067;});}return null;};}function removeEntity(_0x36dd33,_0x194bac){return function(_0x1faf54){if(_0x1faf54){return _0x1faf54['destroy']()[_0xd63a('0x1d')](function(){_0x36dd33['status'](0xcc)[_0xd63a('0x14')]();});}};}function handleEntityNotFound(_0x36269c,_0x5e3148){return function(_0x22e62f){if(!_0x22e62f){_0x36269c[_0xd63a('0x12')](0x194);}return _0x22e62f;};}function handleError(_0x1924c6,_0x5689bf){_0x5689bf=_0x5689bf||0x1f4;return function(_0x50ea2d){logger[_0xd63a('0x1e')](_0x50ea2d['stack']);if(_0x50ea2d['name']){delete _0x50ea2d[_0xd63a('0x1f')];}_0x1924c6[_0xd63a('0x13')](_0x5689bf)[_0xd63a('0x20')](_0x50ea2d);};}exports[_0xd63a('0x21')]=function(_0x20fb37,_0x14ada0){var _0x48814a={},_0x2ffd64={},_0x4d2cf4={'count':0x0,'rows':[]};var _0x533370=_['map'](db['ServicenowField'][_0xd63a('0x22')],function(_0x1893ae){return{'name':_0x1893ae[_0xd63a('0x23')],'type':_0x1893ae[_0xd63a('0x24')][_0xd63a('0x25')]};});_0x2ffd64['model']=_[_0xd63a('0x26')](_0x533370,_0xd63a('0x1f'));_0x2ffd64[_0xd63a('0x27')]=_[_0xd63a('0x28')](_0x20fb37[_0xd63a('0x27')]);_0x2ffd64[_0xd63a('0x29')]=_['intersection'](_0x2ffd64['model'],_0x2ffd64[_0xd63a('0x27')]);_0x48814a[_0xd63a('0x2a')]=_['intersection'](_0x2ffd64[_0xd63a('0x2b')],qs['fields'](_0x20fb37['query']['fields']));_0x48814a['attributes']=_0x48814a[_0xd63a('0x2a')]['length']?_0x48814a[_0xd63a('0x2a')]:_0x2ffd64[_0xd63a('0x2b')];if(!_0x20fb37['query'][_0xd63a('0x2c')](_0xd63a('0x2d'))){_0x48814a['limit']=qs[_0xd63a('0x18')](_0x20fb37[_0xd63a('0x27')]['limit']);_0x48814a[_0xd63a('0x17')]=qs[_0xd63a('0x17')](_0x20fb37[_0xd63a('0x27')]['offset']);}_0x48814a[_0xd63a('0x2e')]=qs[_0xd63a('0x2f')](_0x20fb37[_0xd63a('0x27')][_0xd63a('0x2f')]);_0x48814a[_0xd63a('0x30')]=qs[_0xd63a('0x29')](_[_0xd63a('0x31')](_0x20fb37[_0xd63a('0x27')],_0x2ffd64[_0xd63a('0x29')]),_0x533370);if(_0x20fb37['query'][_0xd63a('0x32')]){_0x48814a[_0xd63a('0x30')]=_['merge'](_0x48814a[_0xd63a('0x30')],{'$or':_[_0xd63a('0x26')](_0x533370,function(_0x34efb3){if(_0x34efb3[_0xd63a('0x24')]!==_0xd63a('0x33')){var _0x20f098={};_0x20f098[_0x34efb3[_0xd63a('0x1f')]]={'$like':'%'+_0x20fb37['query']['filter']+'%'};return _0x20f098;}})});}_0x48814a=_[_0xd63a('0x34')]({},_0x48814a,_0x20fb37[_0xd63a('0x35')]);var _0x59c4e2={'where':_0x48814a[_0xd63a('0x30')]};return db[_0xd63a('0x36')]['count'](_0x59c4e2)[_0xd63a('0x1d')](function(_0x2f6963){_0x4d2cf4['count']=_0x2f6963;if(_0x20fb37[_0xd63a('0x27')][_0xd63a('0x37')]){_0x48814a[_0xd63a('0x38')]=[{'all':!![]}];}return db[_0xd63a('0x36')][_0xd63a('0x39')](_0x48814a);})[_0xd63a('0x1d')](function(_0x34fe14){_0x4d2cf4[_0xd63a('0x3a')]=_0x34fe14;return _0x4d2cf4;})[_0xd63a('0x1d')](respondWithFilteredResult(_0x14ada0,_0x48814a))[_0xd63a('0x3b')](handleError(_0x14ada0,null));};exports[_0xd63a('0x3c')]=function(_0x3f2d72,_0x2d2112){var _0x1f6a28={'raw':!![],'where':{'id':_0x3f2d72['params']['id']}},_0x118096={};_0x118096[_0xd63a('0x2b')]=_[_0xd63a('0x28')](db['ServicenowField'][_0xd63a('0x22')]);_0x118096[_0xd63a('0x27')]=_[_0xd63a('0x28')](_0x3f2d72[_0xd63a('0x27')]);_0x118096[_0xd63a('0x29')]=_[_0xd63a('0x3d')](_0x118096[_0xd63a('0x2b')],_0x118096['query']);_0x1f6a28['attributes']=_['intersection'](_0x118096['model'],qs[_0xd63a('0x3e')](_0x3f2d72[_0xd63a('0x27')][_0xd63a('0x3e')]));_0x1f6a28['attributes']=_0x1f6a28[_0xd63a('0x2a')][_0xd63a('0x3f')]?_0x1f6a28[_0xd63a('0x2a')]:_0x118096[_0xd63a('0x2b')];if(_0x3f2d72[_0xd63a('0x27')][_0xd63a('0x37')]){_0x1f6a28['include']=[{'all':!![]}];}_0x1f6a28=_[_0xd63a('0x34')]({},_0x1f6a28,_0x3f2d72[_0xd63a('0x35')]);return db[_0xd63a('0x36')][_0xd63a('0x40')](_0x1f6a28)['then'](handleEntityNotFound(_0x2d2112,null))[_0xd63a('0x1d')](respondWithResult(_0x2d2112,null))[_0xd63a('0x3b')](handleError(_0x2d2112,null));};exports[_0xd63a('0x41')]=function(_0x1d64d3,_0x3b8303){return db[_0xd63a('0x36')]['create'](_0x1d64d3[_0xd63a('0x42')],{})['then'](respondWithResult(_0x3b8303,0xc9))['catch'](handleError(_0x3b8303,null));};exports[_0xd63a('0x1c')]=function(_0x48c607,_0xfca68e){if(_0x48c607[_0xd63a('0x42')]['id']){delete _0x48c607[_0xd63a('0x42')]['id'];}return db['ServicenowField'][_0xd63a('0x40')]({'where':{'id':_0x48c607[_0xd63a('0x43')]['id']}})['then'](handleEntityNotFound(_0xfca68e,null))[_0xd63a('0x1d')](saveUpdates(_0x48c607['body'],null))['then'](respondWithResult(_0xfca68e,null))[_0xd63a('0x3b')](handleError(_0xfca68e,null));};exports[_0xd63a('0x44')]=function(_0x14a759,_0x54be53){return db[_0xd63a('0x36')][_0xd63a('0x40')]({'where':{'id':_0x14a759[_0xd63a('0x43')]['id']}})[_0xd63a('0x1d')](handleEntityNotFound(_0x54be53,null))[_0xd63a('0x1d')](removeEntity(_0x54be53,null))[_0xd63a('0x3b')](handleError(_0x54be53,null));}; \ No newline at end of file +var _0xa169=['ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','fields','merge','find','create','body','params','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','json','offset','limit','set','apply','save','then','destroy','stack','name','send','index','map'];(function(_0x1b6566,_0x1073ca){var _0x3d2fdd=function(_0x2e0028){while(--_0x2e0028){_0x1b6566['push'](_0x1b6566['shift']());}};_0x3d2fdd(++_0x1073ca);}(_0xa169,0xaa));var _0x9a16=function(_0xb68248,_0x3dd0f0){_0xb68248=_0xb68248-0x0;var _0x4b1926=_0xa169[_0xb68248];return _0x4b1926;};'use strict';var pdf=require(_0x9a16('0x0'));var emlformat=require(_0x9a16('0x1'));var rimraf=require(_0x9a16('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a16('0x3'));var moment=require(_0x9a16('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9a16('0x5'));var util=require(_0x9a16('0x6'));var path=require(_0x9a16('0x7'));var sox=require(_0x9a16('0x8'));var csv=require(_0x9a16('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a16('0xa'));var squel=require(_0x9a16('0xb'));var crypto=require(_0x9a16('0xc'));var jsforce=require(_0x9a16('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9a16('0x9'));var querystring=require('querystring');var Papa=require(_0x9a16('0xe'));var Redis=require('ioredis');var authService=require(_0x9a16('0xf'));var qs=require(_0x9a16('0x10'));var as=require(_0x9a16('0x11'));var hardwareService=require(_0x9a16('0x12'));var logger=require(_0x9a16('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x9a16('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a876a,_0x12c98c){_0x12c98c=_0x12c98c||0xcc;return function(_0x84147c){if(_0x84147c){return _0x2a876a[_0x9a16('0x15')](_0x12c98c);}return _0x2a876a['status'](_0x12c98c)[_0x9a16('0x16')]();};}function respondWithResult(_0x42672c,_0x154efb){_0x154efb=_0x154efb||0xc8;return function(_0x22cf89){if(_0x22cf89){return _0x42672c[_0x9a16('0x17')](_0x154efb)[_0x9a16('0x18')](_0x22cf89);}};}function respondWithFilteredResult(_0x1811cf,_0x15bfe6){return function(_0x5250d6){if(_0x5250d6){var _0x417220=_0x5250d6['count'],_0x15c741=_0x15bfe6['offset'],_0x13aaff=_0x15bfe6[_0x9a16('0x19')]+_0x15bfe6[_0x9a16('0x1a')],_0x33fecb;if(_0x13aaff>=_0x417220){_0x13aaff=_0x417220;_0x33fecb=0xc8;}else{_0x33fecb=0xce;}_0x1811cf['status'](_0x33fecb);return _0x1811cf[_0x9a16('0x1b')]('Content-Range',_0x15c741+'-'+_0x13aaff+'/'+_0x417220)['json'](_0x5250d6);}return null;};}function patchUpdates(_0x4fa5b6){return function(_0x571a63){try{jsonpatch[_0x9a16('0x1c')](_0x571a63,_0x4fa5b6,!![]);}catch(_0x3f684f){return BPromise['reject'](_0x3f684f);}return _0x571a63[_0x9a16('0x1d')]();};}function saveUpdates(_0x2d8950,_0xfdce31){return function(_0x3ab7e3){if(_0x3ab7e3){return _0x3ab7e3['update'](_0x2d8950)[_0x9a16('0x1e')](function(_0x38c619){return _0x38c619;});}return null;};}function removeEntity(_0x420013,_0x4095f6){return function(_0x3ede31){if(_0x3ede31){return _0x3ede31[_0x9a16('0x1f')]()['then'](function(){_0x420013['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38dcbf,_0x210600){return function(_0xdd58fa){if(!_0xdd58fa){_0x38dcbf[_0x9a16('0x15')](0x194);}return _0xdd58fa;};}function handleError(_0x500471,_0x1e648e){_0x1e648e=_0x1e648e||0x1f4;return function(_0x34397b){logger['error'](_0x34397b[_0x9a16('0x20')]);if(_0x34397b[_0x9a16('0x21')]){delete _0x34397b[_0x9a16('0x21')];}_0x500471[_0x9a16('0x17')](_0x1e648e)[_0x9a16('0x22')](_0x34397b);};}exports[_0x9a16('0x23')]=function(_0x1ac894,_0x569246){var _0x345a19={},_0x1c4bb3={},_0x326c8c={'count':0x0,'rows':[]};var _0x43786=_[_0x9a16('0x24')](db[_0x9a16('0x25')][_0x9a16('0x26')],function(_0x564d5){return{'name':_0x564d5[_0x9a16('0x27')],'type':_0x564d5['type'][_0x9a16('0x28')]};});_0x1c4bb3[_0x9a16('0x29')]=_[_0x9a16('0x24')](_0x43786,_0x9a16('0x21'));_0x1c4bb3[_0x9a16('0x2a')]=_[_0x9a16('0x2b')](_0x1ac894[_0x9a16('0x2a')]);_0x1c4bb3[_0x9a16('0x2c')]=_[_0x9a16('0x2d')](_0x1c4bb3['model'],_0x1c4bb3[_0x9a16('0x2a')]);_0x345a19[_0x9a16('0x2e')]=_[_0x9a16('0x2d')](_0x1c4bb3[_0x9a16('0x29')],qs['fields'](_0x1ac894[_0x9a16('0x2a')]['fields']));_0x345a19['attributes']=_0x345a19[_0x9a16('0x2e')][_0x9a16('0x2f')]?_0x345a19[_0x9a16('0x2e')]:_0x1c4bb3[_0x9a16('0x29')];if(!_0x1ac894[_0x9a16('0x2a')][_0x9a16('0x30')](_0x9a16('0x31'))){_0x345a19[_0x9a16('0x1a')]=qs['limit'](_0x1ac894[_0x9a16('0x2a')][_0x9a16('0x1a')]);_0x345a19['offset']=qs[_0x9a16('0x19')](_0x1ac894[_0x9a16('0x2a')][_0x9a16('0x19')]);}_0x345a19[_0x9a16('0x32')]=qs[_0x9a16('0x33')](_0x1ac894[_0x9a16('0x2a')]['sort']);_0x345a19[_0x9a16('0x34')]=qs[_0x9a16('0x2c')](_['pick'](_0x1ac894[_0x9a16('0x2a')],_0x1c4bb3[_0x9a16('0x2c')]),_0x43786);if(_0x1ac894[_0x9a16('0x2a')][_0x9a16('0x35')]){_0x345a19['where']=_['merge'](_0x345a19[_0x9a16('0x34')],{'$or':_[_0x9a16('0x24')](_0x43786,function(_0x35ca91){if(_0x35ca91[_0x9a16('0x36')]!==_0x9a16('0x37')){var _0x431112={};_0x431112[_0x35ca91[_0x9a16('0x21')]]={'$like':'%'+_0x1ac894[_0x9a16('0x2a')][_0x9a16('0x35')]+'%'};return _0x431112;}})});}_0x345a19=_['merge']({},_0x345a19,_0x1ac894[_0x9a16('0x38')]);var _0x3811d6={'where':_0x345a19[_0x9a16('0x34')]};return db[_0x9a16('0x25')][_0x9a16('0x39')](_0x3811d6)[_0x9a16('0x1e')](function(_0x5146bf){_0x326c8c[_0x9a16('0x39')]=_0x5146bf;if(_0x1ac894[_0x9a16('0x2a')][_0x9a16('0x3a')]){_0x345a19[_0x9a16('0x3b')]=[{'all':!![]}];}return db[_0x9a16('0x25')]['findAll'](_0x345a19);})[_0x9a16('0x1e')](function(_0x46eddd){_0x326c8c[_0x9a16('0x3c')]=_0x46eddd;return _0x326c8c;})[_0x9a16('0x1e')](respondWithFilteredResult(_0x569246,_0x345a19))[_0x9a16('0x3d')](handleError(_0x569246,null));};exports[_0x9a16('0x3e')]=function(_0x5bbcfb,_0x52e392){var _0x1d23a0={'raw':!![],'where':{'id':_0x5bbcfb['params']['id']}},_0x475ff5={};_0x475ff5['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x475ff5[_0x9a16('0x2a')]=_[_0x9a16('0x2b')](_0x5bbcfb[_0x9a16('0x2a')]);_0x475ff5['filters']=_[_0x9a16('0x2d')](_0x475ff5['model'],_0x475ff5[_0x9a16('0x2a')]);_0x1d23a0[_0x9a16('0x2e')]=_['intersection'](_0x475ff5['model'],qs[_0x9a16('0x3f')](_0x5bbcfb[_0x9a16('0x2a')][_0x9a16('0x3f')]));_0x1d23a0[_0x9a16('0x2e')]=_0x1d23a0['attributes']['length']?_0x1d23a0[_0x9a16('0x2e')]:_0x475ff5[_0x9a16('0x29')];if(_0x5bbcfb['query'][_0x9a16('0x3a')]){_0x1d23a0[_0x9a16('0x3b')]=[{'all':!![]}];}_0x1d23a0=_[_0x9a16('0x40')]({},_0x1d23a0,_0x5bbcfb[_0x9a16('0x38')]);return db['ServicenowField'][_0x9a16('0x41')](_0x1d23a0)[_0x9a16('0x1e')](handleEntityNotFound(_0x52e392,null))['then'](respondWithResult(_0x52e392,null))[_0x9a16('0x3d')](handleError(_0x52e392,null));};exports[_0x9a16('0x42')]=function(_0x19b3bc,_0x2dd184){return db[_0x9a16('0x25')][_0x9a16('0x42')](_0x19b3bc[_0x9a16('0x43')],{})[_0x9a16('0x1e')](respondWithResult(_0x2dd184,0xc9))['catch'](handleError(_0x2dd184,null));};exports['update']=function(_0x3d1e55,_0x397b59){if(_0x3d1e55['body']['id']){delete _0x3d1e55['body']['id'];}return db[_0x9a16('0x25')]['find']({'where':{'id':_0x3d1e55[_0x9a16('0x44')]['id']}})[_0x9a16('0x1e')](handleEntityNotFound(_0x397b59,null))[_0x9a16('0x1e')](saveUpdates(_0x3d1e55['body'],null))[_0x9a16('0x1e')](respondWithResult(_0x397b59,null))['catch'](handleError(_0x397b59,null));};exports[_0x9a16('0x1f')]=function(_0x47f5a9,_0xda579a){return db[_0x9a16('0x25')]['find']({'where':{'id':_0x47f5a9[_0x9a16('0x44')]['id']}})[_0x9a16('0x1e')](handleEntityNotFound(_0xda579a,null))[_0x9a16('0x1e')](removeEntity(_0xda579a,null))[_0x9a16('0x3d')](handleError(_0xda579a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index fe37c70..3067dcb 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 _0x5199=['servicenow_unique_index','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x16677c,_0xd59d19){var _0x259863=function(_0x3fa42b){while(--_0x3fa42b){_0x16677c['push'](_0x16677c['shift']());}};_0x259863(++_0xd59d19);}(_0x5199,0x8e));var _0x9519=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5199[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x9519('0x0'));var util=require('util');var logger=require(_0x9519('0x1'))(_0x9519('0x2'));var moment=require(_0x9519('0x3'));var BPromise=require('bluebird');var rp=require(_0x9519('0x4'));var fs=require('fs');var path=require(_0x9519('0x5'));var rimraf=require(_0x9519('0x6'));var config=require(_0x9519('0x7'));var attributes=require(_0x9519('0x8'));module[_0x9519('0x9')]=function(_0x2ed6d4,_0xf26c2c){return _0x2ed6d4[_0x9519('0xa')](_0x9519('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9519('0xc'),'fields':['idField',_0x9519('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f23=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f23,0x15c));var _0x37f2=function(_0x1badb3,_0x25bcd7){_0x1badb3=_0x1badb3-0x0;var _0x45cda1=_0x7f23[_0x1badb3];return _0x45cda1;};'use strict';var _=require(_0x37f2('0x0'));var util=require(_0x37f2('0x1'));var logger=require('../../config/logger')(_0x37f2('0x2'));var moment=require('moment');var BPromise=require(_0x37f2('0x3'));var rp=require(_0x37f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37f2('0x5'));var config=require(_0x37f2('0x6'));var attributes=require(_0x37f2('0x7'));module[_0x37f2('0x8')]=function(_0x3667a4,_0x14b1bc){return _0x3667a4[_0x37f2('0x9')]('ServicenowField',attributes,{'tableName':_0x37f2('0xa'),'paranoid':![],'indexes':[{'name':_0x37f2('0xb'),'fields':['idField','FieldId'],'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 8e72743..0e1fe5d 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 _0x6bed=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x5df74f,_0x33554d){var _0x391219=function(_0xd81f21){while(--_0xd81f21){_0x5df74f['push'](_0x5df74f['shift']());}};_0x391219(++_0x33554d);}(_0x6bed,0x1f3));var _0xd6be=function(_0x42b26c,_0x2a05bb){_0x42b26c=_0x42b26c-0x0;var _0x40b9f5=_0x6bed[_0x42b26c];return _0x40b9f5;};'use strict';var _=require(_0xd6be('0x0'));var util=require(_0xd6be('0x1'));var moment=require('moment');var BPromise=require(_0xd6be('0x2'));var rs=require(_0xd6be('0x3'));var fs=require('fs');var Redis=require(_0xd6be('0x4'));var db=require(_0xd6be('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6be('0x6'))(_0xd6be('0x7'));var config=require(_0xd6be('0x8'));var jayson=require(_0xd6be('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebcd2,_0x33defe,_0x219f7d){return new BPromise(function(_0x1df2e8,_0x1d1179){return client[_0xd6be('0xa')](_0x4ebcd2,_0x219f7d)[_0xd6be('0xb')](function(_0x4aef08){logger['info'](_0xd6be('0xc'),_0x33defe,_0xd6be('0xd'));logger[_0xd6be('0xe')](_0xd6be('0xf'),_0x33defe,_0xd6be('0xd'),JSON['stringify'](_0x4aef08));if(_0x4aef08[_0xd6be('0x10')]){if(_0x4aef08[_0xd6be('0x10')][_0xd6be('0x11')]===0x1f4){logger['error'](_0xd6be('0xc'),_0x33defe,_0x4aef08[_0xd6be('0x10')][_0xd6be('0x12')]);return _0x1d1179(_0x4aef08[_0xd6be('0x10')][_0xd6be('0x12')]);}logger[_0xd6be('0x10')]('ServicenowField,\x20%s,\x20%s',_0x33defe,_0x4aef08[_0xd6be('0x10')][_0xd6be('0x12')]);return _0x1df2e8(_0x4aef08[_0xd6be('0x10')][_0xd6be('0x12')]);}else{logger['info'](_0xd6be('0xc'),_0x33defe,_0xd6be('0xd'));_0x1df2e8(_0x4aef08[_0xd6be('0x13')][_0xd6be('0x12')]);}})['catch'](function(_0x5130f6){logger[_0xd6be('0x10')](_0xd6be('0xc'),_0x33defe,_0x5130f6);_0x1d1179(_0x5130f6);});});} \ No newline at end of file +var _0x12fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x451b1c,_0x28ad74){var _0x2d7af6=function(_0x31e994){while(--_0x31e994){_0x451b1c['push'](_0x451b1c['shift']());}};_0x2d7af6(++_0x28ad74);}(_0x12fe,0xbf));var _0xe12f=function(_0x3d75ef,_0x2efa48){_0x3d75ef=_0x3d75ef-0x0;var _0x2910da=_0x12fe[_0x3d75ef];return _0x2910da;};'use strict';var _=require(_0xe12f('0x0'));var util=require(_0xe12f('0x1'));var moment=require(_0xe12f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe12f('0x3'));var fs=require('fs');var Redis=require(_0xe12f('0x4'));var db=require(_0xe12f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe12f('0x6'));var config=require(_0xe12f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe12f('0x8')][_0xe12f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe10e07,_0x52c558,_0x5f54ca){return new BPromise(function(_0x52e5a5,_0x293734){return client[_0xe12f('0xa')](_0xe10e07,_0x5f54ca)[_0xe12f('0xb')](function(_0x1f7a92){logger[_0xe12f('0xc')](_0xe12f('0xd'),_0x52c558,_0xe12f('0xe'));logger[_0xe12f('0xf')](_0xe12f('0x10'),_0x52c558,_0xe12f('0xe'),JSON['stringify'](_0x1f7a92));if(_0x1f7a92[_0xe12f('0x11')]){if(_0x1f7a92[_0xe12f('0x11')]['code']===0x1f4){logger[_0xe12f('0x11')]('ServicenowField,\x20%s,\x20%s',_0x52c558,_0x1f7a92[_0xe12f('0x11')][_0xe12f('0x12')]);return _0x293734(_0x1f7a92[_0xe12f('0x11')][_0xe12f('0x12')]);}logger[_0xe12f('0x11')](_0xe12f('0xd'),_0x52c558,_0x1f7a92[_0xe12f('0x11')][_0xe12f('0x12')]);return _0x52e5a5(_0x1f7a92[_0xe12f('0x11')][_0xe12f('0x12')]);}else{logger[_0xe12f('0xc')]('ServicenowField,\x20%s,\x20%s',_0x52c558,_0xe12f('0xe'));_0x52e5a5(_0x1f7a92[_0xe12f('0x13')][_0xe12f('0x12')]);}})[_0xe12f('0x14')](function(_0x3082ba){logger['error'](_0xe12f('0xd'),_0x52c558,_0x3082ba);_0x293734(_0x3082ba);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4374de4..6b38092 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 _0x599f=['post','create','addConfiguration','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5ea94c,_0x19937b){var _0xededd7=function(_0x27d10e){while(--_0x27d10e){_0x5ea94c['push'](_0x5ea94c['shift']());}};_0xededd7(++_0x19937b);}(_0x599f,0x74));var _0xf599=function(_0x2e43c3,_0x22ea91){_0x2e43c3=_0x2e43c3-0x0;var _0x4698f3=_0x599f[_0x2e43c3];return _0x4698f3;};'use strict';var multer=require(_0xf599('0x0'));var util=require(_0xf599('0x1'));var path=require(_0xf599('0x2'));var timeout=require(_0xf599('0x3'));var express=require(_0xf599('0x4'));var router=express[_0xf599('0x5')]();var auth=require(_0xf599('0x6'));var interaction=require(_0xf599('0x7'));var config=require(_0xf599('0x8'));var controller=require(_0xf599('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf599('0xa')]('/:id',auth[_0xf599('0xb')](),controller[_0xf599('0xc')]);router[_0xf599('0xa')](_0xf599('0xd'),auth[_0xf599('0xb')](),controller[_0xf599('0xe')]);router[_0xf599('0xa')](_0xf599('0xf'),auth[_0xf599('0xb')](),controller['getFields']);router[_0xf599('0x10')]('/',auth[_0xf599('0xb')](),controller[_0xf599('0x11')]);router[_0xf599('0x10')](_0xf599('0xd'),auth[_0xf599('0xb')](),controller[_0xf599('0x12')]);router['put'](_0xf599('0x13'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf599('0xb')](),controller[_0xf599('0x14')]);module[_0xf599('0x15')]=router; \ No newline at end of file +var _0x05cc=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','/:id'];(function(_0x3600e4,_0x215e86){var _0x494bfa=function(_0x27c571){while(--_0x27c571){_0x3600e4['push'](_0x3600e4['shift']());}};_0x494bfa(++_0x215e86);}(_0x05cc,0xd9));var _0xc05c=function(_0x7df5a0,_0x2bd563){_0x7df5a0=_0x7df5a0-0x0;var _0x4bdadd=_0x05cc[_0x7df5a0];return _0x4bdadd;};'use strict';var multer=require(_0xc05c('0x0'));var util=require(_0xc05c('0x1'));var path=require(_0xc05c('0x2'));var timeout=require(_0xc05c('0x3'));var express=require(_0xc05c('0x4'));var router=express[_0xc05c('0x5')]();var auth=require(_0xc05c('0x6'));var interaction=require(_0xc05c('0x7'));var config=require(_0xc05c('0x8'));var controller=require(_0xc05c('0x9'));router[_0xc05c('0xa')]('/',auth[_0xc05c('0xb')](),controller[_0xc05c('0xc')]);router[_0xc05c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc05c('0xd')]);router[_0xc05c('0xa')](_0xc05c('0xe'),auth[_0xc05c('0xb')](),controller['getConfigurations']);router[_0xc05c('0xa')](_0xc05c('0xf'),auth[_0xc05c('0xb')](),controller[_0xc05c('0x10')]);router[_0xc05c('0x11')]('/',auth[_0xc05c('0xb')](),controller[_0xc05c('0x12')]);router[_0xc05c('0x11')](_0xc05c('0xe'),auth[_0xc05c('0xb')](),controller[_0xc05c('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc05c('0x14')]);router[_0xc05c('0x15')](_0xc05c('0x16'),auth['isAuthenticated'](),controller[_0xc05c('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d50d1d0..9267186 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 _0xa807=['remoteUri','sequelize','exports','STRING'];(function(_0x334a59,_0x32be2b){var _0xdc4789=function(_0x615870){while(--_0x615870){_0x334a59['push'](_0x334a59['shift']());}};_0xdc4789(++_0x32be2b);}(_0xa807,0xbd));var _0x7a80=function(_0x51c2c9,_0x3e6a2f){_0x51c2c9=_0x51c2c9-0x0;var _0x1b80f0=_0xa807[_0x51c2c9];return _0x1b80f0;};'use strict';var Sequelize=require(_0x7a80('0x0'));module[_0x7a80('0x1')]={'name':{'type':Sequelize[_0x7a80('0x2')]},'description':{'type':Sequelize[_0x7a80('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7a80('0x2')],'unique':_0x7a80('0x3')},'serverUrl':{'type':Sequelize[_0x7a80('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeca4=['exports','STRING','username','remoteUri'];(function(_0x7f105a,_0x2f0052){var _0x8a1ab8=function(_0x1c4eed){while(--_0x1c4eed){_0x7f105a['push'](_0x7f105a['shift']());}};_0x8a1ab8(++_0x2f0052);}(_0xeca4,0x158));var _0x4eca=function(_0x524fc0,_0x1544f6){_0x524fc0=_0x524fc0-0x0;var _0x2469f2=_0xeca4[_0x524fc0];return _0x2469f2;};'use strict';var Sequelize=require('sequelize');module[_0x4eca('0x0')]={'name':{'type':Sequelize[_0x4eca('0x1')]},'description':{'type':Sequelize[_0x4eca('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x4eca('0x2')},'password':{'type':Sequelize[_0x4eca('0x1')]},'remoteUri':{'type':Sequelize[_0x4eca('0x1')],'unique':_0x4eca('0x3')},'serverUrl':{'type':Sequelize[_0x4eca('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 13e0e36..2415c5a 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 _0xb2bf=['status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmAccount','includeAll','include','rows','show','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','get_module_fields','Calls','values','remove','includes','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus'];(function(_0x4ed53f,_0x55c8af){var _0x2cf586=function(_0x500553){while(--_0x500553){_0x4ed53f['push'](_0x4ed53f['shift']());}};_0x2cf586(++_0x55c8af);}(_0xb2bf,0x1e6));var _0xfb2b=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb2bf[_0x4dcc2d];return _0x1bbd79;};'use strict';var pdf=require(_0xfb2b('0x0'));var emlformat=require(_0xfb2b('0x1'));var rimraf=require(_0xfb2b('0x2'));var zipdir=require(_0xfb2b('0x3'));var jsonpatch=require(_0xfb2b('0x4'));var rp=require(_0xfb2b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb2b('0x6'));var path=require(_0xfb2b('0x7'));var sox=require(_0xfb2b('0x8'));var csv=require('to-csv');var ejs=require(_0xfb2b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb2b('0xa'));var crypto=require(_0xfb2b('0xb'));var jsforce=require(_0xfb2b('0xc'));var deskjs=require(_0xfb2b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb2b('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb2b('0xf'));var authService=require(_0xfb2b('0x10'));var qs=require(_0xfb2b('0x11'));var as=require(_0xfb2b('0x12'));var hardwareService=require(_0xfb2b('0x13'));var logger=require(_0xfb2b('0x14'))(_0xfb2b('0x15'));var utils=require(_0xfb2b('0x16'));var config=require(_0xfb2b('0x17'));var licenseUtil=require(_0xfb2b('0x18'));var db=require(_0xfb2b('0x19'))['db'];var integrations=require(_0xfb2b('0x1a'));var jayson=require(_0xfb2b('0x1b'));var client=jayson[_0xfb2b('0x1c')][_0xfb2b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x15ce6f,_0x2a7448,_0x4405ba,_0x5b1540){return new BPromise(function(_0x23b7a3,_0x13ca99){var _0xde7e70=_0x5b1540||client;return _0xde7e70[_0xfb2b('0x1e')](_0x15ce6f,_0x4405ba)[_0xfb2b('0x1f')](function(_0x1856b0){logger['info'](_0xfb2b('0x20'),_0x2a7448,_0xfb2b('0x21'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2a7448,_0xfb2b('0x21'),JSON[_0xfb2b('0x22')](_0x1856b0));if(_0x1856b0[_0xfb2b('0x23')]){if(_0x1856b0[_0xfb2b('0x23')][_0xfb2b('0x24')]===0x1f4){logger[_0xfb2b('0x23')](_0xfb2b('0x20'),_0x2a7448,_0x1856b0[_0xfb2b('0x23')][_0xfb2b('0x25')]);return _0x13ca99(_0x1856b0[_0xfb2b('0x23')][_0xfb2b('0x25')]);}logger[_0xfb2b('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a7448,_0x1856b0[_0xfb2b('0x23')]['message']);return _0x23b7a3(_0x1856b0['error'][_0xfb2b('0x25')]);}else{logger[_0xfb2b('0x26')](_0xfb2b('0x20'),_0x2a7448,_0xfb2b('0x21'));_0x23b7a3(_0x1856b0[_0xfb2b('0x27')]['message']);}})[_0xfb2b('0x28')](function(_0x152697){logger[_0xfb2b('0x23')](_0xfb2b('0x20'),_0x2a7448,_0x152697);_0x13ca99(_0x152697);});});}function respondWithStatusCode(_0x525e4a,_0x9ffdfe){_0x9ffdfe=_0x9ffdfe||0xcc;return function(_0x1f5a5d){if(_0x1f5a5d){return _0x525e4a[_0xfb2b('0x29')](_0x9ffdfe);}return _0x525e4a[_0xfb2b('0x2a')](_0x9ffdfe)[_0xfb2b('0x2b')]();};}function respondWithResult(_0x1b16f4,_0x5b21a1){_0x5b21a1=_0x5b21a1||0xc8;return function(_0x113f89){if(_0x113f89){return _0x1b16f4[_0xfb2b('0x2a')](_0x5b21a1)[_0xfb2b('0x2c')](_0x113f89);}};}function respondWithFilteredResult(_0x109609,_0x10d8dd){return function(_0x43b435){if(_0x43b435){var _0x486e7f=_0x43b435[_0xfb2b('0x2d')],_0x2f41d0=_0x10d8dd[_0xfb2b('0x2e')],_0x2e0a87=_0x10d8dd[_0xfb2b('0x2e')]+_0x10d8dd[_0xfb2b('0x2f')],_0x47ce49;if(_0x2e0a87>=_0x486e7f){_0x2e0a87=_0x486e7f;_0x47ce49=0xc8;}else{_0x47ce49=0xce;}_0x109609[_0xfb2b('0x2a')](_0x47ce49);return _0x109609[_0xfb2b('0x30')]('Content-Range',_0x2f41d0+'-'+_0x2e0a87+'/'+_0x486e7f)[_0xfb2b('0x2c')](_0x43b435);}return null;};}function patchUpdates(_0x4d2ec8){return function(_0x2d0cf0){try{jsonpatch[_0xfb2b('0x31')](_0x2d0cf0,_0x4d2ec8,!![]);}catch(_0x3361a0){return BPromise[_0xfb2b('0x32')](_0x3361a0);}return _0x2d0cf0[_0xfb2b('0x33')]();};}function saveUpdates(_0x3d4739,_0x4a7e07){return function(_0x46c5e4){if(_0x46c5e4){return _0x46c5e4[_0xfb2b('0x34')](_0x3d4739)[_0xfb2b('0x1f')](function(_0x1e7509){return _0x1e7509;});}return null;};}function removeEntity(_0x3d224b,_0x25a3a7){return function(_0x5788a8){if(_0x5788a8){return _0x5788a8[_0xfb2b('0x35')]()[_0xfb2b('0x1f')](function(){_0x3d224b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fecc,_0x59804d){return function(_0x2d4ae4){if(!_0x2d4ae4){_0x23fecc['sendStatus'](0x194);}return _0x2d4ae4;};}function handleError(_0x4a4f05,_0x1f7371){_0x1f7371=_0x1f7371||0x1f4;return function(_0x576791){logger[_0xfb2b('0x23')](_0x576791[_0xfb2b('0x36')]);if(_0x576791[_0xfb2b('0x37')]){delete _0x576791[_0xfb2b('0x37')];}_0x4a4f05['status'](_0x1f7371)[_0xfb2b('0x38')](_0x576791);};}exports[_0xfb2b('0x39')]=function(_0x38c8a3,_0x396286){var _0x49e771={},_0x326d87={},_0xb3b322={'count':0x0,'rows':[]};var _0x1883ee=_[_0xfb2b('0x3a')](db['SugarcrmAccount'][_0xfb2b('0x3b')],function(_0x36830f){return{'name':_0x36830f[_0xfb2b('0x3c')],'type':_0x36830f[_0xfb2b('0x3d')][_0xfb2b('0x3e')]};});_0x326d87[_0xfb2b('0x3f')]=_[_0xfb2b('0x3a')](_0x1883ee,_0xfb2b('0x37'));_0x326d87[_0xfb2b('0x40')]=_[_0xfb2b('0x41')](_0x38c8a3[_0xfb2b('0x40')]);_0x326d87[_0xfb2b('0x42')]=_[_0xfb2b('0x43')](_0x326d87[_0xfb2b('0x3f')],_0x326d87[_0xfb2b('0x40')]);_0x49e771[_0xfb2b('0x44')]=_[_0xfb2b('0x43')](_0x326d87[_0xfb2b('0x3f')],qs[_0xfb2b('0x45')](_0x38c8a3[_0xfb2b('0x40')]['fields']));_0x49e771[_0xfb2b('0x44')]=_0x49e771[_0xfb2b('0x44')][_0xfb2b('0x46')]?_0x49e771[_0xfb2b('0x44')]:_0x326d87[_0xfb2b('0x3f')];if(!_0x38c8a3[_0xfb2b('0x40')][_0xfb2b('0x47')](_0xfb2b('0x48'))){_0x49e771[_0xfb2b('0x2f')]=qs[_0xfb2b('0x2f')](_0x38c8a3[_0xfb2b('0x40')][_0xfb2b('0x2f')]);_0x49e771[_0xfb2b('0x2e')]=qs[_0xfb2b('0x2e')](_0x38c8a3[_0xfb2b('0x40')][_0xfb2b('0x2e')]);}_0x49e771['order']=qs[_0xfb2b('0x49')](_0x38c8a3[_0xfb2b('0x40')][_0xfb2b('0x49')]);_0x49e771[_0xfb2b('0x4a')]=qs['filters'](_[_0xfb2b('0x4b')](_0x38c8a3[_0xfb2b('0x40')],_0x326d87[_0xfb2b('0x42')]),_0x1883ee);if(_0x38c8a3[_0xfb2b('0x40')]['filter']){_0x49e771['where']=_[_0xfb2b('0x4c')](_0x49e771[_0xfb2b('0x4a')],{'$or':_[_0xfb2b('0x3a')](_0x1883ee,function(_0x45288f){if(_0x45288f[_0xfb2b('0x3d')]!==_0xfb2b('0x4d')){var _0x5ed452={};_0x5ed452[_0x45288f[_0xfb2b('0x37')]]={'$like':'%'+_0x38c8a3[_0xfb2b('0x40')][_0xfb2b('0x4e')]+'%'};return _0x5ed452;}})});}_0x49e771=_[_0xfb2b('0x4c')]({},_0x49e771,_0x38c8a3[_0xfb2b('0x4f')]);var _0xdcf029={'where':_0x49e771[_0xfb2b('0x4a')]};return db[_0xfb2b('0x50')][_0xfb2b('0x2d')](_0xdcf029)[_0xfb2b('0x1f')](function(_0x1bc9ed){_0xb3b322['count']=_0x1bc9ed;if(_0x38c8a3[_0xfb2b('0x40')][_0xfb2b('0x51')]){_0x49e771[_0xfb2b('0x52')]=[{'all':!![]}];}return db[_0xfb2b('0x50')]['findAll'](_0x49e771);})[_0xfb2b('0x1f')](function(_0x14d8ae){_0xb3b322[_0xfb2b('0x53')]=_0x14d8ae;return _0xb3b322;})[_0xfb2b('0x1f')](respondWithFilteredResult(_0x396286,_0x49e771))[_0xfb2b('0x28')](handleError(_0x396286,null));};exports[_0xfb2b('0x54')]=function(_0x42eb41,_0xeb77b9){var _0x2d50a4={'raw':![],'where':{'id':_0x42eb41['params']['id']}},_0x2037c4={};_0x2037c4['model']=_[_0xfb2b('0x41')](db[_0xfb2b('0x50')][_0xfb2b('0x3b')]);_0x2037c4[_0xfb2b('0x40')]=_['keys'](_0x42eb41[_0xfb2b('0x40')]);_0x2037c4['filters']=_[_0xfb2b('0x43')](_0x2037c4[_0xfb2b('0x3f')],_0x2037c4['query']);_0x2d50a4[_0xfb2b('0x44')]=_[_0xfb2b('0x43')](_0x2037c4[_0xfb2b('0x3f')],qs['fields'](_0x42eb41[_0xfb2b('0x40')][_0xfb2b('0x45')]));_0x2d50a4[_0xfb2b('0x44')]=_0x2d50a4[_0xfb2b('0x44')][_0xfb2b('0x46')]?_0x2d50a4['attributes']:_0x2037c4[_0xfb2b('0x3f')];if(_0x42eb41[_0xfb2b('0x40')][_0xfb2b('0x51')]){_0x2d50a4[_0xfb2b('0x52')]=[{'all':!![]}];}_0x2d50a4=_[_0xfb2b('0x4c')]({},_0x2d50a4,_0x42eb41[_0xfb2b('0x4f')]);return db[_0xfb2b('0x50')][_0xfb2b('0x55')](_0x2d50a4)[_0xfb2b('0x1f')](handleEntityNotFound(_0xeb77b9,null))['then'](respondWithResult(_0xeb77b9,null))[_0xfb2b('0x28')](handleError(_0xeb77b9,null));};exports[_0xfb2b('0x56')]=function(_0x2c9281,_0x1e58d0){return db[_0xfb2b('0x50')]['create'](_0x2c9281[_0xfb2b('0x57')],{})[_0xfb2b('0x1f')](respondWithResult(_0x1e58d0,0xc9))[_0xfb2b('0x28')](handleError(_0x1e58d0,null));};exports[_0xfb2b('0x34')]=function(_0x3e0083,_0x53e8a1){if(_0x3e0083[_0xfb2b('0x57')]['id']){delete _0x3e0083[_0xfb2b('0x57')]['id'];}return db[_0xfb2b('0x50')][_0xfb2b('0x55')]({'where':{'id':_0x3e0083[_0xfb2b('0x58')]['id']}})[_0xfb2b('0x1f')](handleEntityNotFound(_0x53e8a1,null))[_0xfb2b('0x1f')](saveUpdates(_0x3e0083[_0xfb2b('0x57')],null))['then'](respondWithResult(_0x53e8a1,null))['catch'](handleError(_0x53e8a1,null));};exports[_0xfb2b('0x35')]=function(_0x32af3f,_0x1e34cd){return db[_0xfb2b('0x50')][_0xfb2b('0x55')]({'where':{'id':_0x32af3f[_0xfb2b('0x58')]['id']}})[_0xfb2b('0x1f')](handleEntityNotFound(_0x1e34cd,null))[_0xfb2b('0x1f')](removeEntity(_0x1e34cd,null))['catch'](handleError(_0x1e34cd,null));};exports[_0xfb2b('0x59')]=function(_0x555ffe,_0x3613f2,_0x4eb683){var _0x3676f1={};var _0x50e7c3={};var _0x239903;var _0x1198e9;return db[_0xfb2b('0x50')][_0xfb2b('0x5a')]({'where':{'id':_0x555ffe['params']['id']}})['then'](handleEntityNotFound(_0x3613f2,null))[_0xfb2b('0x1f')](function(_0x5dff23){if(_0x5dff23){_0x239903=_0x5dff23;_0x50e7c3[_0xfb2b('0x3f')]=_['keys'](db[_0xfb2b('0x5b')][_0xfb2b('0x3b')]);_0x50e7c3[_0xfb2b('0x40')]=_[_0xfb2b('0x41')](_0x555ffe[_0xfb2b('0x40')]);_0x50e7c3[_0xfb2b('0x42')]=_[_0xfb2b('0x43')](_0x50e7c3[_0xfb2b('0x3f')],_0x50e7c3['query']);_0x3676f1[_0xfb2b('0x44')]=_[_0xfb2b('0x43')](_0x50e7c3['model'],qs['fields'](_0x555ffe[_0xfb2b('0x40')]['fields']));_0x3676f1['attributes']=_0x3676f1[_0xfb2b('0x44')][_0xfb2b('0x46')]?_0x3676f1['attributes']:_0x50e7c3[_0xfb2b('0x3f')];_0x3676f1[_0xfb2b('0x5c')]=qs[_0xfb2b('0x49')](_0x555ffe[_0xfb2b('0x40')][_0xfb2b('0x49')]);_0x3676f1['where']=qs[_0xfb2b('0x42')](_[_0xfb2b('0x4b')](_0x555ffe['query'],_0x50e7c3[_0xfb2b('0x42')]));if(_0x555ffe[_0xfb2b('0x40')][_0xfb2b('0x4e')]){_0x3676f1[_0xfb2b('0x4a')]=_[_0xfb2b('0x4c')](_0x3676f1['where'],{'$or':_[_0xfb2b('0x3a')](_0x3676f1[_0xfb2b('0x44')],function(_0x193d69){var _0x3de18c={};_0x3de18c[_0x193d69]={'$like':'%'+_0x555ffe[_0xfb2b('0x40')]['filter']+'%'};return _0x3de18c;})});}_0x3676f1=_[_0xfb2b('0x4c')]({},_0x3676f1,_0x555ffe[_0xfb2b('0x4f')]);return _0x239903[_0xfb2b('0x59')](_0x3676f1);}})[_0xfb2b('0x1f')](function(_0x54cb79){if(_0x54cb79){_0x1198e9=_0x54cb79['length'];if(!_0x555ffe['query'][_0xfb2b('0x47')]('nolimit')){_0x3676f1[_0xfb2b('0x2f')]=qs[_0xfb2b('0x2f')](_0x555ffe[_0xfb2b('0x40')][_0xfb2b('0x2f')]);_0x3676f1['offset']=qs[_0xfb2b('0x2e')](_0x555ffe[_0xfb2b('0x40')][_0xfb2b('0x2e')]);}return _0x239903[_0xfb2b('0x59')](_0x3676f1);}})[_0xfb2b('0x1f')](function(_0x18c384){if(_0x18c384){return _0x18c384?{'count':_0x1198e9,'rows':_0x18c384}:null;}})[_0xfb2b('0x1f')](respondWithResult(_0x3613f2,null))[_0xfb2b('0x28')](handleError(_0x3613f2,null));};exports[_0xfb2b('0x5d')]=function(_0x4dbdca,_0x33824b,_0xef98ee){if(_0x4dbdca[_0xfb2b('0x57')]['id']){delete _0x4dbdca['body']['id'];}return db[_0xfb2b('0x50')]['findOne']({'where':{'id':_0x4dbdca[_0xfb2b('0x58')]['id']}})[_0xfb2b('0x1f')](handleEntityNotFound(_0x33824b,null))[_0xfb2b('0x1f')](function(_0x4c2987){if(_0x4c2987){_0x4dbdca[_0xfb2b('0x57')]['AccountId']=_0x4c2987['id'];_0x4dbdca[_0xfb2b('0x57')]['Subjects']=integrations[_0xfb2b('0x5e')](_0x4dbdca[_0xfb2b('0x57')][_0xfb2b('0x5f')],_0x4dbdca[_0xfb2b('0x57')][_0xfb2b('0x3d')]);_0x4dbdca[_0xfb2b('0x57')][_0xfb2b('0x60')]=integrations[_0xfb2b('0x61')](_0x4dbdca[_0xfb2b('0x57')][_0xfb2b('0x5f')],_0x4dbdca[_0xfb2b('0x57')]['type']);return db[_0xfb2b('0x5b')][_0xfb2b('0x56')](_0x4dbdca['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xfb2b('0x62')},{'model':db[_0xfb2b('0x63')],'as':'Descriptions'}]});}return null;})[_0xfb2b('0x1f')](respondWithResult(_0x33824b,null))['catch'](handleError(_0x33824b,null));};exports[_0xfb2b('0x64')]=function(_0x4181cd,_0x30629c,_0x3d5118){var _0x3028f6='';var _0x46bb1f=['id',_0xfb2b('0x37'),_0xfb2b('0x65'),_0xfb2b('0x66'),'description',_0xfb2b('0x67'),_0xfb2b('0x68'),_0xfb2b('0x69'),_0xfb2b('0x6a'),_0xfb2b('0x6b'),'parent_name','direction'];return db[_0xfb2b('0x50')]['findOne']({'where':{'id':_0x4181cd[_0xfb2b('0x58')]['id']},'attributes':['id',_0xfb2b('0x6c'),_0xfb2b('0x6d'),_0xfb2b('0x6e')]})['then'](handleEntityNotFound(_0x30629c,null))[_0xfb2b('0x1f')](function(_0xd10d2f){if(_0xd10d2f){_0x3028f6=_0xd10d2f[_0xfb2b('0x6e')];var _0x35098b=_0x3028f6['slice'](-0x1);if(_0x35098b==='/'){_0x3028f6=_0x3028f6['substring'](0x0,_0x3028f6[_0xfb2b('0x6f')](_0x35098b));}return rp({'method':_0xfb2b('0x70'),'uri':util[_0xfb2b('0x71')]('%s%s',_0x3028f6,_0xfb2b('0x72')),'json':!![],'form':{'method':_0xfb2b('0x73'),'input_type':_0xfb2b('0x74'),'response_type':_0xfb2b('0x74'),'rest_data':JSON[_0xfb2b('0x22')]({'user_auth':{'user_name':_0xd10d2f[_0xfb2b('0x6c')],'password':_0xd10d2f['password'],'encryption':_0xfb2b('0x75')},'application':_0xfb2b('0x76')})}});}})['then'](function(_0x338944){if(_0x338944&&_0x338944[_0xfb2b('0x37')]!=='Invalid\x20Login'&&_0x338944[_0xfb2b('0x37')]!==_0xfb2b('0x77')){return rp({'method':_0xfb2b('0x70'),'uri':util['format'](_0xfb2b('0x78'),_0x3028f6,_0xfb2b('0x72')),'json':!![],'form':{'method':_0xfb2b('0x79'),'input_type':_0xfb2b('0x74'),'response_type':_0xfb2b('0x74'),'rest_data':JSON['stringify']({'session':_0x338944['id'],'module_name':_0xfb2b('0x7a')})}})[_0xfb2b('0x1f')](function(_0x58a1fd){if(_0x58a1fd){var _0x108568=_[_0xfb2b('0x7b')](_0x58a1fd['module_fields']);_[_0xfb2b('0x7c')](_0x108568,function(_0x5181fa){return _0x46bb1f[_0xfb2b('0x7d')](_0x5181fa['name']);});return{'count':_0x108568[_0xfb2b('0x46')],'rows':_[_0xfb2b('0x3a')](_0x108568,function(_0x693e63){return{'id':_0x693e63[_0xfb2b('0x37')],'name':_0x693e63[_0xfb2b('0x7e')],'custom':_[_0xfb2b('0x7f')](_0x693e63[_0xfb2b('0x37')],'_c')?!![]:![],'options':_0x693e63[_0xfb2b('0x4f')]?_[_0xfb2b('0x3a')](_[_0xfb2b('0x7b')](_0x693e63['options']),function(_0x2e8e4d){return{'name':_0x2e8e4d['value'],'value':_0x2e8e4d[_0xfb2b('0x37')]};}):[]};})};}})[_0xfb2b('0x1f')](respondWithResult(_0x30629c,null))[_0xfb2b('0x28')](function(_0x1fda0b){var _0x205bf2=_0x4181cd[_0xfb2b('0x40')]['test']?0x1f4:_0x1fda0b[_0xfb2b('0x80')]||0x1f4;logger[_0xfb2b('0x23')](_0xfb2b('0x81'),'getFields',_0x205bf2,JSON['stringify'](_0x1fda0b));delete _0x1fda0b['name'];if(_0x205bf2===0x191){_0x205bf2=0x190;}_0x30629c[_0xfb2b('0x2a')](_0x205bf2)['send'](_0x4181cd[_0xfb2b('0x40')][_0xfb2b('0x82')]?{'message':_0xfb2b('0x83'),'statusCode':_0x1fda0b[_0xfb2b('0x80')]}:_0x1fda0b);});}else{var _0x2d5159=0x1f4;_0x30629c[_0xfb2b('0x2a')](_0x2d5159)[_0xfb2b('0x38')]({'message':_0xfb2b('0x83'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x863c=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','create','body','findOne','options','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','direction','password','substring','lastIndexOf','POST','%s%s','login','JSON','username','PLAIN','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse'];(function(_0x435b35,_0x34a430){var _0x35ed54=function(_0x3508df){while(--_0x3508df){_0x435b35['push'](_0x435b35['shift']());}};_0x35ed54(++_0x34a430);}(_0x863c,0x70));var _0xc863=function(_0x11f7a3,_0x317249){_0x11f7a3=_0x11f7a3-0x0;var _0x3a8217=_0x863c[_0x11f7a3];return _0x3a8217;};'use strict';var pdf=require(_0xc863('0x0'));var emlformat=require(_0xc863('0x1'));var rimraf=require(_0xc863('0x2'));var zipdir=require(_0xc863('0x3'));var jsonpatch=require(_0xc863('0x4'));var rp=require('request-promise');var moment=require(_0xc863('0x5'));var BPromise=require(_0xc863('0x6'));var Mustache=require(_0xc863('0x7'));var util=require(_0xc863('0x8'));var path=require(_0xc863('0x9'));var sox=require(_0xc863('0xa'));var csv=require(_0xc863('0xb'));var ejs=require(_0xc863('0xc'));var fs=require('fs');var _=require(_0xc863('0xd'));var squel=require(_0xc863('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc863('0xf'));var toCsv=require(_0xc863('0xb'));var querystring=require('querystring');var Papa=require(_0xc863('0x10'));var Redis=require(_0xc863('0x11'));var authService=require(_0xc863('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc863('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc863('0x14'))('api');var utils=require(_0xc863('0x15'));var config=require(_0xc863('0x16'));var licenseUtil=require(_0xc863('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc863('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xc863('0x19')][_0xc863('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4d7298,_0x6d3c4,_0x5a4d1f,_0x388a47){return new BPromise(function(_0x1a617d,_0x22b419){var _0x15e4cb=_0x388a47||client;return _0x15e4cb[_0xc863('0x1b')](_0x4d7298,_0x5a4d1f)[_0xc863('0x1c')](function(_0x38aec7){logger['info'](_0xc863('0x1d'),_0x6d3c4,'request\x20sent');logger[_0xc863('0x1e')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x6d3c4,_0xc863('0x1f'),JSON[_0xc863('0x20')](_0x38aec7));if(_0x38aec7['error']){if(_0x38aec7['error'][_0xc863('0x21')]===0x1f4){logger[_0xc863('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x6d3c4,_0x38aec7['error']['message']);return _0x22b419(_0x38aec7[_0xc863('0x22')][_0xc863('0x23')]);}logger[_0xc863('0x22')](_0xc863('0x1d'),_0x6d3c4,_0x38aec7[_0xc863('0x22')][_0xc863('0x23')]);return _0x1a617d(_0x38aec7['error'][_0xc863('0x23')]);}else{logger[_0xc863('0x24')](_0xc863('0x1d'),_0x6d3c4,_0xc863('0x1f'));_0x1a617d(_0x38aec7['result'][_0xc863('0x23')]);}})[_0xc863('0x25')](function(_0x1d632f){logger[_0xc863('0x22')](_0xc863('0x1d'),_0x6d3c4,_0x1d632f);_0x22b419(_0x1d632f);});});}function respondWithStatusCode(_0x3713dc,_0x4d04e5){_0x4d04e5=_0x4d04e5||0xcc;return function(_0x18f6c2){if(_0x18f6c2){return _0x3713dc[_0xc863('0x26')](_0x4d04e5);}return _0x3713dc[_0xc863('0x27')](_0x4d04e5)[_0xc863('0x28')]();};}function respondWithResult(_0x341090,_0x3eecdc){_0x3eecdc=_0x3eecdc||0xc8;return function(_0x2055d3){if(_0x2055d3){return _0x341090[_0xc863('0x27')](_0x3eecdc)[_0xc863('0x29')](_0x2055d3);}};}function respondWithFilteredResult(_0x2cf59b,_0xe08601){return function(_0x2ccaa6){if(_0x2ccaa6){var _0x662797=_0x2ccaa6[_0xc863('0x2a')],_0x1ca9df=_0xe08601[_0xc863('0x2b')],_0xc8318e=_0xe08601[_0xc863('0x2b')]+_0xe08601['limit'],_0x52e155;if(_0xc8318e>=_0x662797){_0xc8318e=_0x662797;_0x52e155=0xc8;}else{_0x52e155=0xce;}_0x2cf59b[_0xc863('0x27')](_0x52e155);return _0x2cf59b[_0xc863('0x2c')](_0xc863('0x2d'),_0x1ca9df+'-'+_0xc8318e+'/'+_0x662797)[_0xc863('0x29')](_0x2ccaa6);}return null;};}function patchUpdates(_0x1a3932){return function(_0x4773ae){try{jsonpatch['apply'](_0x4773ae,_0x1a3932,!![]);}catch(_0x2f26b9){return BPromise[_0xc863('0x2e')](_0x2f26b9);}return _0x4773ae[_0xc863('0x2f')]();};}function saveUpdates(_0x1d5522,_0x41a303){return function(_0x34ad31){if(_0x34ad31){return _0x34ad31[_0xc863('0x30')](_0x1d5522)[_0xc863('0x1c')](function(_0x530fa2){return _0x530fa2;});}return null;};}function removeEntity(_0x277e54,_0x1d58d3){return function(_0x8f1758){if(_0x8f1758){return _0x8f1758[_0xc863('0x31')]()[_0xc863('0x1c')](function(){_0x277e54[_0xc863('0x27')](0xcc)[_0xc863('0x28')]();});}};}function handleEntityNotFound(_0x52ad84,_0x4f00ab){return function(_0x547123){if(!_0x547123){_0x52ad84[_0xc863('0x26')](0x194);}return _0x547123;};}function handleError(_0x31b949,_0x3969ad){_0x3969ad=_0x3969ad||0x1f4;return function(_0x2a8abc){logger[_0xc863('0x22')](_0x2a8abc['stack']);if(_0x2a8abc['name']){delete _0x2a8abc[_0xc863('0x32')];}_0x31b949[_0xc863('0x27')](_0x3969ad)[_0xc863('0x33')](_0x2a8abc);};}exports[_0xc863('0x34')]=function(_0x1a2b66,_0x463b9a){var _0x30aefc={},_0x2c73fc={},_0x2a5fb6={'count':0x0,'rows':[]};var _0x434a2b=_[_0xc863('0x35')](db[_0xc863('0x36')][_0xc863('0x37')],function(_0x199887){return{'name':_0x199887['fieldName'],'type':_0x199887[_0xc863('0x38')][_0xc863('0x39')]};});_0x2c73fc['model']=_['map'](_0x434a2b,_0xc863('0x32'));_0x2c73fc[_0xc863('0x3a')]=_[_0xc863('0x3b')](_0x1a2b66['query']);_0x2c73fc[_0xc863('0x3c')]=_[_0xc863('0x3d')](_0x2c73fc[_0xc863('0x3e')],_0x2c73fc[_0xc863('0x3a')]);_0x30aefc[_0xc863('0x3f')]=_[_0xc863('0x3d')](_0x2c73fc[_0xc863('0x3e')],qs[_0xc863('0x40')](_0x1a2b66['query'][_0xc863('0x40')]));_0x30aefc[_0xc863('0x3f')]=_0x30aefc['attributes']['length']?_0x30aefc[_0xc863('0x3f')]:_0x2c73fc['model'];if(!_0x1a2b66['query'][_0xc863('0x41')]('nolimit')){_0x30aefc[_0xc863('0x42')]=qs[_0xc863('0x42')](_0x1a2b66['query']['limit']);_0x30aefc[_0xc863('0x2b')]=qs[_0xc863('0x2b')](_0x1a2b66[_0xc863('0x3a')]['offset']);}_0x30aefc[_0xc863('0x43')]=qs[_0xc863('0x44')](_0x1a2b66[_0xc863('0x3a')][_0xc863('0x44')]);_0x30aefc['where']=qs['filters'](_[_0xc863('0x45')](_0x1a2b66['query'],_0x2c73fc[_0xc863('0x3c')]),_0x434a2b);if(_0x1a2b66[_0xc863('0x3a')][_0xc863('0x46')]){_0x30aefc[_0xc863('0x47')]=_[_0xc863('0x48')](_0x30aefc['where'],{'$or':_['map'](_0x434a2b,function(_0x1a4933){if(_0x1a4933[_0xc863('0x38')]!==_0xc863('0x49')){var _0x5b2897={};_0x5b2897[_0x1a4933['name']]={'$like':'%'+_0x1a2b66[_0xc863('0x3a')][_0xc863('0x46')]+'%'};return _0x5b2897;}})});}_0x30aefc=_['merge']({},_0x30aefc,_0x1a2b66['options']);var _0xed061d={'where':_0x30aefc['where']};return db['SugarcrmAccount'][_0xc863('0x2a')](_0xed061d)[_0xc863('0x1c')](function(_0x5a3219){_0x2a5fb6['count']=_0x5a3219;if(_0x1a2b66[_0xc863('0x3a')][_0xc863('0x4a')]){_0x30aefc[_0xc863('0x4b')]=[{'all':!![]}];}return db[_0xc863('0x36')][_0xc863('0x4c')](_0x30aefc);})[_0xc863('0x1c')](function(_0x26e8ca){_0x2a5fb6[_0xc863('0x4d')]=_0x26e8ca;return _0x2a5fb6;})[_0xc863('0x1c')](respondWithFilteredResult(_0x463b9a,_0x30aefc))[_0xc863('0x25')](handleError(_0x463b9a,null));};exports[_0xc863('0x4e')]=function(_0x15c7d2,_0x43d1ce){var _0xc1c161={'raw':![],'where':{'id':_0x15c7d2[_0xc863('0x4f')]['id']}},_0x19d5c2={};_0x19d5c2['model']=_['keys'](db[_0xc863('0x36')][_0xc863('0x37')]);_0x19d5c2['query']=_['keys'](_0x15c7d2['query']);_0x19d5c2[_0xc863('0x3c')]=_[_0xc863('0x3d')](_0x19d5c2[_0xc863('0x3e')],_0x19d5c2[_0xc863('0x3a')]);_0xc1c161[_0xc863('0x3f')]=_[_0xc863('0x3d')](_0x19d5c2[_0xc863('0x3e')],qs[_0xc863('0x40')](_0x15c7d2[_0xc863('0x3a')][_0xc863('0x40')]));_0xc1c161[_0xc863('0x3f')]=_0xc1c161[_0xc863('0x3f')][_0xc863('0x50')]?_0xc1c161[_0xc863('0x3f')]:_0x19d5c2[_0xc863('0x3e')];if(_0x15c7d2[_0xc863('0x3a')][_0xc863('0x4a')]){_0xc1c161['include']=[{'all':!![]}];}_0xc1c161=_[_0xc863('0x48')]({},_0xc1c161,_0x15c7d2['options']);return db[_0xc863('0x36')][_0xc863('0x51')](_0xc1c161)[_0xc863('0x1c')](handleEntityNotFound(_0x43d1ce,null))[_0xc863('0x1c')](respondWithResult(_0x43d1ce,null))['catch'](handleError(_0x43d1ce,null));};exports[_0xc863('0x52')]=function(_0x226c7c,_0x19076c){return db[_0xc863('0x36')][_0xc863('0x52')](_0x226c7c['body'],{})[_0xc863('0x1c')](respondWithResult(_0x19076c,0xc9))[_0xc863('0x25')](handleError(_0x19076c,null));};exports[_0xc863('0x30')]=function(_0x2c72ff,_0x23f0b9){if(_0x2c72ff[_0xc863('0x53')]['id']){delete _0x2c72ff[_0xc863('0x53')]['id'];}return db[_0xc863('0x36')][_0xc863('0x51')]({'where':{'id':_0x2c72ff[_0xc863('0x4f')]['id']}})['then'](handleEntityNotFound(_0x23f0b9,null))['then'](saveUpdates(_0x2c72ff[_0xc863('0x53')],null))[_0xc863('0x1c')](respondWithResult(_0x23f0b9,null))[_0xc863('0x25')](handleError(_0x23f0b9,null));};exports['destroy']=function(_0x3eec05,_0x427d5e){return db[_0xc863('0x36')]['find']({'where':{'id':_0x3eec05[_0xc863('0x4f')]['id']}})['then'](handleEntityNotFound(_0x427d5e,null))['then'](removeEntity(_0x427d5e,null))[_0xc863('0x25')](handleError(_0x427d5e,null));};exports['getConfigurations']=function(_0x1be1f,_0x2abeb6,_0x323fbf){var _0x17b048={};var _0x3dd849={};var _0x23e883;var _0x4fc6f4;return db[_0xc863('0x36')][_0xc863('0x54')]({'where':{'id':_0x1be1f[_0xc863('0x4f')]['id']}})[_0xc863('0x1c')](handleEntityNotFound(_0x2abeb6,null))[_0xc863('0x1c')](function(_0x3b7f60){if(_0x3b7f60){_0x23e883=_0x3b7f60;_0x3dd849[_0xc863('0x3e')]=_['keys'](db['SugarcrmConfiguration'][_0xc863('0x37')]);_0x3dd849[_0xc863('0x3a')]=_[_0xc863('0x3b')](_0x1be1f['query']);_0x3dd849['filters']=_[_0xc863('0x3d')](_0x3dd849[_0xc863('0x3e')],_0x3dd849['query']);_0x17b048['attributes']=_[_0xc863('0x3d')](_0x3dd849[_0xc863('0x3e')],qs[_0xc863('0x40')](_0x1be1f['query']['fields']));_0x17b048[_0xc863('0x3f')]=_0x17b048['attributes']['length']?_0x17b048[_0xc863('0x3f')]:_0x3dd849['model'];_0x17b048[_0xc863('0x43')]=qs[_0xc863('0x44')](_0x1be1f['query'][_0xc863('0x44')]);_0x17b048[_0xc863('0x47')]=qs[_0xc863('0x3c')](_['pick'](_0x1be1f[_0xc863('0x3a')],_0x3dd849[_0xc863('0x3c')]));if(_0x1be1f['query'][_0xc863('0x46')]){_0x17b048[_0xc863('0x47')]=_['merge'](_0x17b048[_0xc863('0x47')],{'$or':_[_0xc863('0x35')](_0x17b048['attributes'],function(_0x395a42){var _0x426424={};_0x426424[_0x395a42]={'$like':'%'+_0x1be1f['query'][_0xc863('0x46')]+'%'};return _0x426424;})});}_0x17b048=_[_0xc863('0x48')]({},_0x17b048,_0x1be1f[_0xc863('0x55')]);return _0x23e883['getConfigurations'](_0x17b048);}})[_0xc863('0x1c')](function(_0x4ac082){if(_0x4ac082){_0x4fc6f4=_0x4ac082[_0xc863('0x50')];if(!_0x1be1f[_0xc863('0x3a')][_0xc863('0x41')](_0xc863('0x56'))){_0x17b048['limit']=qs[_0xc863('0x42')](_0x1be1f[_0xc863('0x3a')][_0xc863('0x42')]);_0x17b048['offset']=qs['offset'](_0x1be1f['query'][_0xc863('0x2b')]);}return _0x23e883[_0xc863('0x57')](_0x17b048);}})[_0xc863('0x1c')](function(_0x2978ab){if(_0x2978ab){return _0x2978ab?{'count':_0x4fc6f4,'rows':_0x2978ab}:null;}})[_0xc863('0x1c')](respondWithResult(_0x2abeb6,null))[_0xc863('0x25')](handleError(_0x2abeb6,null));};exports[_0xc863('0x58')]=function(_0x187821,_0x41aeb1,_0x2bb308){if(_0x187821[_0xc863('0x53')]['id']){delete _0x187821[_0xc863('0x53')]['id'];}return db[_0xc863('0x36')][_0xc863('0x54')]({'where':{'id':_0x187821[_0xc863('0x4f')]['id']}})[_0xc863('0x1c')](handleEntityNotFound(_0x41aeb1,null))[_0xc863('0x1c')](function(_0x5b18a5){if(_0x5b18a5){_0x187821[_0xc863('0x53')][_0xc863('0x59')]=_0x5b18a5['id'];_0x187821[_0xc863('0x53')][_0xc863('0x5a')]=integrations[_0xc863('0x5b')](_0x187821[_0xc863('0x53')]['channel'],_0x187821[_0xc863('0x53')][_0xc863('0x38')]);_0x187821[_0xc863('0x53')]['Descriptions']=integrations[_0xc863('0x5c')](_0x187821[_0xc863('0x53')]['channel'],_0x187821[_0xc863('0x53')]['type']);return db[_0xc863('0x5d')]['create'](_0x187821[_0xc863('0x53')],{'include':[{'model':db[_0xc863('0x5e')],'as':_0xc863('0x5a')},{'model':db[_0xc863('0x5e')],'as':_0xc863('0x5f')}]});}return null;})[_0xc863('0x1c')](respondWithResult(_0x41aeb1,null))[_0xc863('0x25')](handleError(_0x41aeb1,null));};exports[_0xc863('0x60')]=function(_0x34f8e1,_0x4ab0e0,_0x348b75){var _0x1ad4da='';var _0x3bdf74=['id',_0xc863('0x32'),_0xc863('0x61'),_0xc863('0x62'),_0xc863('0x63'),_0xc863('0x64'),'duration_hours',_0xc863('0x65'),_0xc863('0x66'),_0xc863('0x67'),'parent_name',_0xc863('0x68')];return db['SugarcrmAccount'][_0xc863('0x54')]({'where':{'id':_0x34f8e1['params']['id']},'attributes':['id','username',_0xc863('0x69'),'remoteUri']})['then'](handleEntityNotFound(_0x4ab0e0,null))['then'](function(_0x429339){if(_0x429339){_0x1ad4da=_0x429339['remoteUri'];var _0x59e5d7=_0x1ad4da['slice'](-0x1);if(_0x59e5d7==='/'){_0x1ad4da=_0x1ad4da[_0xc863('0x6a')](0x0,_0x1ad4da[_0xc863('0x6b')](_0x59e5d7));}return rp({'method':_0xc863('0x6c'),'uri':util['format'](_0xc863('0x6d'),_0x1ad4da,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc863('0x6e'),'input_type':_0xc863('0x6f'),'response_type':_0xc863('0x6f'),'rest_data':JSON[_0xc863('0x20')]({'user_auth':{'user_name':_0x429339[_0xc863('0x70')],'password':_0x429339['password'],'encryption':_0xc863('0x71')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xc863('0x1c')](function(_0x44fe90){if(_0x44fe90&&_0x44fe90[_0xc863('0x32')]!==_0xc863('0x72')&&_0x44fe90[_0xc863('0x32')]!==_0xc863('0x73')){return rp({'method':_0xc863('0x6c'),'uri':util[_0xc863('0x74')](_0xc863('0x6d'),_0x1ad4da,_0xc863('0x75')),'json':!![],'form':{'method':_0xc863('0x76'),'input_type':_0xc863('0x6f'),'response_type':_0xc863('0x6f'),'rest_data':JSON['stringify']({'session':_0x44fe90['id'],'module_name':_0xc863('0x77')})}})[_0xc863('0x1c')](function(_0x8ca395){if(_0x8ca395){var _0x4c4875=_[_0xc863('0x78')](_0x8ca395[_0xc863('0x79')]);_[_0xc863('0x7a')](_0x4c4875,function(_0x3322c1){return _0x3bdf74['includes'](_0x3322c1[_0xc863('0x32')]);});return{'count':_0x4c4875['length'],'rows':_[_0xc863('0x35')](_0x4c4875,function(_0x181c90){return{'id':_0x181c90[_0xc863('0x32')],'name':_0x181c90[_0xc863('0x7b')],'custom':_[_0xc863('0x7c')](_0x181c90[_0xc863('0x32')],'_c')?!![]:![],'options':_0x181c90[_0xc863('0x55')]?_[_0xc863('0x35')](_[_0xc863('0x78')](_0x181c90['options']),function(_0xa02d3f){return{'name':_0xa02d3f['value'],'value':_0xa02d3f[_0xc863('0x32')]};}):[]};})};}})[_0xc863('0x1c')](respondWithResult(_0x4ab0e0,null))[_0xc863('0x25')](function(_0x121b60){var _0x1a07cd=_0x34f8e1[_0xc863('0x3a')][_0xc863('0x7d')]?0x1f4:_0x121b60[_0xc863('0x7e')]||0x1f4;logger[_0xc863('0x22')](_0xc863('0x7f'),_0xc863('0x60'),_0x1a07cd,JSON[_0xc863('0x20')](_0x121b60));delete _0x121b60[_0xc863('0x32')];if(_0x1a07cd===0x191){_0x1a07cd=0x190;}_0x4ab0e0['status'](_0x1a07cd)[_0xc863('0x33')](_0x34f8e1[_0xc863('0x3a')][_0xc863('0x7d')]?{'message':_0xc863('0x80'),'statusCode':_0x121b60['statusCode']}:_0x121b60);});}else{var _0x2652da=0x1f4;_0x4ab0e0['status'](_0x2652da)[_0xc863('0x33')]({'message':_0xc863('0x80'),'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 00d176b..9c916fb 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 _0xf580=['path','rimraf','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5efaf0,_0x3241b2){var _0x163ace=function(_0x4a2106){while(--_0x4a2106){_0x5efaf0['push'](_0x5efaf0['shift']());}};_0x163ace(++_0x3241b2);}(_0xf580,0x95));var _0x0f58=function(_0x1d518d,_0x33d84c){_0x1d518d=_0x1d518d-0x0;var _0x3ca949=_0xf580[_0x1d518d];return _0x3ca949;};'use strict';var _=require(_0x0f58('0x0'));var util=require(_0x0f58('0x1'));var logger=require(_0x0f58('0x2'))(_0x0f58('0x3'));var moment=require(_0x0f58('0x4'));var BPromise=require(_0x0f58('0x5'));var rp=require(_0x0f58('0x6'));var fs=require('fs');var path=require(_0x0f58('0x7'));var rimraf=require(_0x0f58('0x8'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x0f58('0x9'));module[_0x0f58('0xa')]=function(_0x3243ad,_0x56cb1a){return _0x3243ad[_0x0f58('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x0f58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56c8=['../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ed590,_0x5dccfc){var _0x5973ae=function(_0x3aaa6f){while(--_0x3aaa6f){_0x2ed590['push'](_0x2ed590['shift']());}};_0x5973ae(++_0x5dccfc);}(_0x56c8,0x12f));var _0x856c=function(_0x47c50c,_0x22f2c7){_0x47c50c=_0x47c50c-0x0;var _0x4e4f72=_0x56c8[_0x47c50c];return _0x4e4f72;};'use strict';var _=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var logger=require(_0x856c('0x2'))(_0x856c('0x3'));var moment=require('moment');var BPromise=require(_0x856c('0x4'));var rp=require(_0x856c('0x5'));var fs=require('fs');var path=require(_0x856c('0x6'));var rimraf=require(_0x856c('0x7'));var config=require(_0x856c('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x856c('0x9'));module[_0x856c('0xa')]=function(_0x413964,_0x15a17c){return _0x413964[_0x856c('0xb')](_0x856c('0xc'),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 5b58b56..56511db 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 _0x1df0=['http','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','debug','ShowSugarcrmAccount','raw','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x4aa2c9,_0x3c74e5){var _0x212e33=function(_0x20f06a){while(--_0x20f06a){_0x4aa2c9['push'](_0x4aa2c9['shift']());}};_0x212e33(++_0x3c74e5);}(_0x1df0,0x17a));var _0x01df=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x1df0[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01df('0x0'));var BPromise=require(_0x01df('0x1'));var rs=require(_0x01df('0x2'));var fs=require('fs');var Redis=require(_0x01df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x01df('0x4'));var logger=require('../../config/logger')(_0x01df('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x01df('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x401dbe,_0x4b77e0,_0x57170f){return new BPromise(function(_0x3b16ce,_0x2f7a7f){return client[_0x01df('0x7')](_0x401dbe,_0x57170f)[_0x01df('0x8')](function(_0x3215f5){logger[_0x01df('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x4b77e0,_0x01df('0xa'));logger['debug'](_0x01df('0xb'),_0x4b77e0,_0x01df('0xa'),JSON[_0x01df('0xc')](_0x3215f5));if(_0x3215f5[_0x01df('0xd')]){if(_0x3215f5[_0x01df('0xd')][_0x01df('0xe')]===0x1f4){logger[_0x01df('0xd')](_0x01df('0xf'),_0x4b77e0,_0x3215f5[_0x01df('0xd')][_0x01df('0x10')]);return _0x2f7a7f(_0x3215f5[_0x01df('0xd')][_0x01df('0x10')]);}logger[_0x01df('0xd')](_0x01df('0xf'),_0x4b77e0,_0x3215f5[_0x01df('0xd')][_0x01df('0x10')]);return _0x3b16ce(_0x3215f5[_0x01df('0xd')][_0x01df('0x10')]);}else{logger[_0x01df('0x9')](_0x01df('0xf'),_0x4b77e0,'request\x20sent');_0x3b16ce(_0x3215f5[_0x01df('0x11')][_0x01df('0x10')]);}})[_0x01df('0x12')](function(_0x56333d){logger[_0x01df('0xd')](_0x01df('0xf'),_0x4b77e0,_0x56333d);_0x2f7a7f(_0x56333d);});});}exports[_0x01df('0x13')]=function(_0x4f9edb){var _0x1b2e3d=this;return new Promise(function(_0x123b82,_0x273a1a){return db[_0x01df('0x14')][_0x01df('0x15')]({'raw':_0x4f9edb[_0x01df('0x16')]?_0x4f9edb[_0x01df('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4f9edb['options']?_0x4f9edb['options'][_0x01df('0x17')]||null:null,'attributes':_0x4f9edb['options']?_0x4f9edb[_0x01df('0x16')]['attributes']||null:null,'limit':_0x4f9edb['options']?_0x4f9edb['options'][_0x01df('0x18')]||null:null,'include':_0x4f9edb[_0x01df('0x16')]?_0x4f9edb['options'][_0x01df('0x19')]?_[_0x01df('0x1a')](_0x4f9edb['options']['include'],function(_0x375862){return{'model':db[_0x375862[_0x01df('0x1b')]],'as':_0x375862['as'],'attributes':_0x375862[_0x01df('0x1c')],'include':_0x375862['include']?_['map'](_0x375862[_0x01df('0x19')],function(_0x18a5ed){return{'model':db[_0x18a5ed[_0x01df('0x1b')]],'as':_0x18a5ed['as'],'attributes':_0x18a5ed[_0x01df('0x1c')],'include':_0x18a5ed['include']?_[_0x01df('0x1a')](_0x18a5ed['include'],function(_0x281fd8){return{'model':db[_0x281fd8[_0x01df('0x1b')]],'as':_0x281fd8['as'],'attributes':_0x281fd8[_0x01df('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01df('0x8')](function(_0x3b2b18){logger[_0x01df('0x9')](_0x01df('0x13'),_0x4f9edb);logger[_0x01df('0x1d')](_0x01df('0x13'),_0x4f9edb,JSON[_0x01df('0xc')](_0x3b2b18));_0x123b82(_0x3b2b18);})[_0x01df('0x12')](function(_0x39ed20){logger[_0x01df('0xd')](_0x01df('0x13'),_0x39ed20['message'],_0x4f9edb);_0x273a1a(_0x1b2e3d[_0x01df('0xd')](0x1f4,_0x39ed20[_0x01df('0x10')]));});});};exports[_0x01df('0x1e')]=function(_0x343509){var _0x5dbd1c=this;return new Promise(function(_0x4987eb,_0x5e6cfd){return db[_0x01df('0x14')]['find']({'raw':_0x343509[_0x01df('0x16')]?_0x343509['options'][_0x01df('0x1f')]===undefined?!![]:![]:!![],'where':_0x343509[_0x01df('0x16')]?_0x343509[_0x01df('0x16')]['where']||null:null,'attributes':_0x343509['options']?_0x343509[_0x01df('0x16')][_0x01df('0x1c')]||null:null,'include':_0x343509[_0x01df('0x16')]?_0x343509['options'][_0x01df('0x19')]?_[_0x01df('0x1a')](_0x343509[_0x01df('0x16')]['include'],function(_0x717279){return{'model':db[_0x717279[_0x01df('0x1b')]],'as':_0x717279['as'],'attributes':_0x717279[_0x01df('0x1c')],'include':_0x717279['include']?_[_0x01df('0x1a')](_0x717279[_0x01df('0x19')],function(_0x4a7d14){return{'model':db[_0x4a7d14[_0x01df('0x1b')]],'as':_0x4a7d14['as'],'attributes':_0x4a7d14['attributes'],'include':_0x4a7d14[_0x01df('0x19')]?_[_0x01df('0x1a')](_0x4a7d14[_0x01df('0x19')],function(_0x2a5c74){return{'model':db[_0x2a5c74[_0x01df('0x1b')]],'as':_0x2a5c74['as'],'attributes':_0x2a5c74[_0x01df('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24493a){logger[_0x01df('0x9')](_0x01df('0x1e'),_0x343509);logger['debug'](_0x01df('0x1e'),_0x343509,JSON['stringify'](_0x24493a));_0x4987eb(_0x24493a);})['catch'](function(_0x9b9ea4){logger[_0x01df('0xd')]('ShowSugarcrmAccount',_0x9b9ea4[_0x01df('0x10')],_0x343509);_0x5e6cfd(_0x5dbd1c['error'](0x1f4,_0x9b9ea4[_0x01df('0x10')]));});});}; \ No newline at end of file +var _0xa247=['http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ShowSugarcrmAccount','find','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0xa247,0xf9));var _0x7a24=function(_0x4b8a61,_0x1c5ad3){_0x4b8a61=_0x4b8a61-0x0;var _0x8c5b93=_0xa247[_0x4b8a61];return _0x8c5b93;};'use strict';var _=require(_0x7a24('0x0'));var util=require(_0x7a24('0x1'));var moment=require(_0x7a24('0x2'));var BPromise=require(_0x7a24('0x3'));var rs=require(_0x7a24('0x4'));var fs=require('fs');var Redis=require(_0x7a24('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a24('0x6'));var logger=require('../../config/logger')(_0x7a24('0x7'));var config=require('../../config/environment');var jayson=require(_0x7a24('0x8'));var client=jayson[_0x7a24('0x9')][_0x7a24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ee72,_0x2f5938,_0x7d552b){return new BPromise(function(_0x3f4e7,_0x523a9a){return client[_0x7a24('0xb')](_0x13ee72,_0x7d552b)[_0x7a24('0xc')](function(_0x1165a9){logger[_0x7a24('0xd')](_0x7a24('0xe'),_0x2f5938,_0x7a24('0xf'));logger['debug'](_0x7a24('0x10'),_0x2f5938,_0x7a24('0xf'),JSON['stringify'](_0x1165a9));if(_0x1165a9['error']){if(_0x1165a9[_0x7a24('0x11')][_0x7a24('0x12')]===0x1f4){logger[_0x7a24('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x2f5938,_0x1165a9['error'][_0x7a24('0x13')]);return _0x523a9a(_0x1165a9[_0x7a24('0x11')][_0x7a24('0x13')]);}logger[_0x7a24('0x11')](_0x7a24('0xe'),_0x2f5938,_0x1165a9[_0x7a24('0x11')][_0x7a24('0x13')]);return _0x3f4e7(_0x1165a9[_0x7a24('0x11')]['message']);}else{logger[_0x7a24('0xd')](_0x7a24('0xe'),_0x2f5938,'request\x20sent');_0x3f4e7(_0x1165a9[_0x7a24('0x14')][_0x7a24('0x13')]);}})['catch'](function(_0x2ab5f9){logger['error'](_0x7a24('0xe'),_0x2f5938,_0x2ab5f9);_0x523a9a(_0x2ab5f9);});});}exports[_0x7a24('0x15')]=function(_0xd0ac8){var _0x1ff5a1=this;return new Promise(function(_0x1b5aec,_0x3e124d){return db[_0x7a24('0x16')][_0x7a24('0x17')]({'raw':_0xd0ac8[_0x7a24('0x18')]?_0xd0ac8['options']['raw']===undefined?!![]:![]:!![],'where':_0xd0ac8[_0x7a24('0x18')]?_0xd0ac8[_0x7a24('0x18')][_0x7a24('0x19')]||null:null,'attributes':_0xd0ac8[_0x7a24('0x18')]?_0xd0ac8[_0x7a24('0x18')][_0x7a24('0x1a')]||null:null,'limit':_0xd0ac8[_0x7a24('0x18')]?_0xd0ac8[_0x7a24('0x18')][_0x7a24('0x1b')]||null:null,'include':_0xd0ac8[_0x7a24('0x18')]?_0xd0ac8[_0x7a24('0x18')][_0x7a24('0x1c')]?_[_0x7a24('0x1d')](_0xd0ac8[_0x7a24('0x18')][_0x7a24('0x1c')],function(_0x1ded68){return{'model':db[_0x1ded68[_0x7a24('0x1e')]],'as':_0x1ded68['as'],'attributes':_0x1ded68['attributes'],'include':_0x1ded68['include']?_[_0x7a24('0x1d')](_0x1ded68[_0x7a24('0x1c')],function(_0x40e666){return{'model':db[_0x40e666['model']],'as':_0x40e666['as'],'attributes':_0x40e666[_0x7a24('0x1a')],'include':_0x40e666[_0x7a24('0x1c')]?_[_0x7a24('0x1d')](_0x40e666['include'],function(_0x21b141){return{'model':db[_0x21b141['model']],'as':_0x21b141['as'],'attributes':_0x21b141[_0x7a24('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x285c05){logger['info']('GetSugarcrmAccount',_0xd0ac8);logger['debug'](_0x7a24('0x15'),_0xd0ac8,JSON[_0x7a24('0x1f')](_0x285c05));_0x1b5aec(_0x285c05);})[_0x7a24('0x20')](function(_0x50d00f){logger[_0x7a24('0x11')](_0x7a24('0x15'),_0x50d00f[_0x7a24('0x13')],_0xd0ac8);_0x3e124d(_0x1ff5a1[_0x7a24('0x11')](0x1f4,_0x50d00f[_0x7a24('0x13')]));});});};exports[_0x7a24('0x21')]=function(_0x35ecf1){var _0x27d9b4=this;return new Promise(function(_0x231b60,_0x4ee546){return db[_0x7a24('0x16')][_0x7a24('0x22')]({'raw':_0x35ecf1[_0x7a24('0x18')]?_0x35ecf1[_0x7a24('0x18')][_0x7a24('0x23')]===undefined?!![]:![]:!![],'where':_0x35ecf1[_0x7a24('0x18')]?_0x35ecf1[_0x7a24('0x18')]['where']||null:null,'attributes':_0x35ecf1[_0x7a24('0x18')]?_0x35ecf1[_0x7a24('0x18')]['attributes']||null:null,'include':_0x35ecf1[_0x7a24('0x18')]?_0x35ecf1[_0x7a24('0x18')][_0x7a24('0x1c')]?_[_0x7a24('0x1d')](_0x35ecf1[_0x7a24('0x18')][_0x7a24('0x1c')],function(_0x34d2d7){return{'model':db[_0x34d2d7[_0x7a24('0x1e')]],'as':_0x34d2d7['as'],'attributes':_0x34d2d7['attributes'],'include':_0x34d2d7[_0x7a24('0x1c')]?_[_0x7a24('0x1d')](_0x34d2d7[_0x7a24('0x1c')],function(_0x3e66bf){return{'model':db[_0x3e66bf[_0x7a24('0x1e')]],'as':_0x3e66bf['as'],'attributes':_0x3e66bf[_0x7a24('0x1a')],'include':_0x3e66bf[_0x7a24('0x1c')]?_[_0x7a24('0x1d')](_0x3e66bf['include'],function(_0x3792ab){return{'model':db[_0x3792ab['model']],'as':_0x3792ab['as'],'attributes':_0x3792ab[_0x7a24('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7a24('0xc')](function(_0x76406d){logger[_0x7a24('0xd')](_0x7a24('0x21'),_0x35ecf1);logger[_0x7a24('0x24')](_0x7a24('0x21'),_0x35ecf1,JSON[_0x7a24('0x1f')](_0x76406d));_0x231b60(_0x76406d);})['catch'](function(_0x3e5c01){logger[_0x7a24('0x11')](_0x7a24('0x21'),_0x3e5c01[_0x7a24('0x13')],_0x35ecf1);_0x4ee546(_0x27d9b4[_0x7a24('0x11')](0x1f4,_0x3e5c01[_0x7a24('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 771b1a9..1e58ded 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 _0x47f6=['index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x47f6,0x1b7));var _0x647f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47f6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x647f('0x0'));var util=require(_0x647f('0x1'));var path=require('path');var timeout=require(_0x647f('0x2'));var express=require(_0x647f('0x3'));var router=express[_0x647f('0x4')]();var auth=require(_0x647f('0x5'));var interaction=require(_0x647f('0x6'));var config=require(_0x647f('0x7'));var controller=require(_0x647f('0x8'));router[_0x647f('0x9')]('/',auth[_0x647f('0xa')](),controller[_0x647f('0xb')]);router[_0x647f('0x9')](_0x647f('0xc'),auth[_0x647f('0xa')](),controller[_0x647f('0xd')]);router[_0x647f('0x9')]('/:id/fields',auth[_0x647f('0xa')](),controller[_0x647f('0xe')]);router[_0x647f('0x9')](_0x647f('0xf'),auth[_0x647f('0xa')](),controller[_0x647f('0x10')]);router['get'](_0x647f('0x11'),auth[_0x647f('0xa')](),controller['getDescriptions']);router[_0x647f('0x12')]('/',auth[_0x647f('0xa')](),controller[_0x647f('0x13')]);router[_0x647f('0x14')](_0x647f('0xc'),auth[_0x647f('0xa')](),controller[_0x647f('0x15')]);router[_0x647f('0x16')](_0x647f('0xc'),auth[_0x647f('0xa')](),controller[_0x647f('0x17')]);module[_0x647f('0x18')]=router; \ No newline at end of file +var _0xa95d=['/:id/fields','getFields','getSubjects','/:id/descriptions','create','put','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x262281,_0xa0f94c){var _0x35ed7e=function(_0x5360c0){while(--_0x5360c0){_0x262281['push'](_0x262281['shift']());}};_0x35ed7e(++_0xa0f94c);}(_0xa95d,0xf2));var _0xda95=function(_0xe50651,_0x78b476){_0xe50651=_0xe50651-0x0;var _0xc8931c=_0xa95d[_0xe50651];return _0xc8931c;};'use strict';var multer=require(_0xda95('0x0'));var util=require(_0xda95('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda95('0x2'));var router=express[_0xda95('0x3')]();var auth=require(_0xda95('0x4'));var interaction=require(_0xda95('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xda95('0x6')]('/',auth[_0xda95('0x7')](),controller[_0xda95('0x8')]);router[_0xda95('0x6')](_0xda95('0x9'),auth[_0xda95('0x7')](),controller['show']);router[_0xda95('0x6')](_0xda95('0xa'),auth[_0xda95('0x7')](),controller[_0xda95('0xb')]);router[_0xda95('0x6')]('/:id/subjects',auth[_0xda95('0x7')](),controller[_0xda95('0xc')]);router[_0xda95('0x6')](_0xda95('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xda95('0x7')](),controller[_0xda95('0xe')]);router[_0xda95('0xf')](_0xda95('0x9'),auth[_0xda95('0x7')](),controller[_0xda95('0x10')]);router[_0xda95('0x11')](_0xda95('0x9'),auth[_0xda95('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c80750a..1d64efa 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 _0xc0a1=['STRING','exports'];(function(_0x480586,_0x25abcb){var _0x2c0b08=function(_0x189883){while(--_0x189883){_0x480586['push'](_0x480586['shift']());}};_0x2c0b08(++_0x25abcb);}(_0xc0a1,0x151));var _0x1c0a=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0xc0a1[_0x415f7e];return _0x311ff4;};'use strict';var Sequelize=require('sequelize');module[_0x1c0a('0x0')]={'name':{'type':Sequelize[_0x1c0a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8966=['sequelize','STRING'];(function(_0x447c0f,_0x1ef184){var _0x1ff85a=function(_0x393e25){while(--_0x393e25){_0x447c0f['push'](_0x447c0f['shift']());}};_0x1ff85a(++_0x1ef184);}(_0x8966,0x122));var _0x6896=function(_0x3e3ead,_0x526d10){_0x3e3ead=_0x3e3ead-0x0;var _0x2963d2=_0x8966[_0x3e3ead];return _0x2963d2;};'use strict';var Sequelize=require(_0x6896('0x0'));module['exports']={'name':{'type':Sequelize[_0x6896('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d0bf3f5..fba2b84 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 _0x9de8=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','SugarcrmConfiguration','rawAttributes','key','model','filters','query','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','params','keys','intersection','find','create','body','getFields','findOne','SugarcrmField','length','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x9de8,0xa7));var _0x89de=function(_0x24e8ef,_0x333613){_0x24e8ef=_0x24e8ef-0x0;var _0x4020dd=_0x9de8[_0x24e8ef];return _0x4020dd;};'use strict';var pdf=require(_0x89de('0x0'));var emlformat=require(_0x89de('0x1'));var rimraf=require(_0x89de('0x2'));var zipdir=require(_0x89de('0x3'));var jsonpatch=require(_0x89de('0x4'));var rp=require('request-promise');var moment=require(_0x89de('0x5'));var BPromise=require(_0x89de('0x6'));var Mustache=require(_0x89de('0x7'));var util=require(_0x89de('0x8'));var path=require('path');var sox=require(_0x89de('0x9'));var csv=require(_0x89de('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x89de('0xb'));var squel=require(_0x89de('0xc'));var crypto=require(_0x89de('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x89de('0xe'));var toCsv=require(_0x89de('0xa'));var querystring=require(_0x89de('0xf'));var Papa=require(_0x89de('0x10'));var Redis=require(_0x89de('0x11'));var authService=require(_0x89de('0x12'));var qs=require(_0x89de('0x13'));var as=require(_0x89de('0x14'));var hardwareService=require(_0x89de('0x15'));var logger=require(_0x89de('0x16'))('api');var utils=require(_0x89de('0x17'));var config=require(_0x89de('0x18'));var licenseUtil=require(_0x89de('0x19'));var db=require(_0x89de('0x1a'))['db'];var jayson=require(_0x89de('0x1b'));var client=jayson[_0x89de('0x1c')][_0x89de('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xdae3f8,_0x398394,_0x5d7753,_0x28ab4d){return new BPromise(function(_0x1de280,_0x550cf7){var _0x45082e=_0x28ab4d||client;return _0x45082e[_0x89de('0x1e')](_0xdae3f8,_0x5d7753)[_0x89de('0x1f')](function(_0xfacf2b){logger['info'](_0x89de('0x20'),_0x398394,_0x89de('0x21'));logger[_0x89de('0x22')](_0x89de('0x23'),_0x398394,_0x89de('0x21'),JSON['stringify'](_0xfacf2b));if(_0xfacf2b[_0x89de('0x24')]){if(_0xfacf2b[_0x89de('0x24')]['code']===0x1f4){logger[_0x89de('0x24')](_0x89de('0x20'),_0x398394,_0xfacf2b[_0x89de('0x24')][_0x89de('0x25')]);return _0x550cf7(_0xfacf2b['error'][_0x89de('0x25')]);}logger[_0x89de('0x24')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x398394,_0xfacf2b[_0x89de('0x24')][_0x89de('0x25')]);return _0x1de280(_0xfacf2b[_0x89de('0x24')]['message']);}else{logger[_0x89de('0x26')](_0x89de('0x20'),_0x398394,'request\x20sent');_0x1de280(_0xfacf2b[_0x89de('0x27')][_0x89de('0x25')]);}})[_0x89de('0x28')](function(_0x450de3){logger['error'](_0x89de('0x20'),_0x398394,_0x450de3);_0x550cf7(_0x450de3);});});}function respondWithStatusCode(_0x2764af,_0x3e5c35){_0x3e5c35=_0x3e5c35||0xcc;return function(_0x48aeab){if(_0x48aeab){return _0x2764af[_0x89de('0x29')](_0x3e5c35);}return _0x2764af[_0x89de('0x2a')](_0x3e5c35)['end']();};}function respondWithResult(_0x8d0786,_0x43ae80){_0x43ae80=_0x43ae80||0xc8;return function(_0x31e9a3){if(_0x31e9a3){return _0x8d0786[_0x89de('0x2a')](_0x43ae80)['json'](_0x31e9a3);}};}function respondWithFilteredResult(_0x378ce2,_0x415f27){return function(_0x4d70fc){if(_0x4d70fc){var _0x5c4c4c=_0x4d70fc[_0x89de('0x2b')],_0x3eb115=_0x415f27[_0x89de('0x2c')],_0x2fab48=_0x415f27['offset']+_0x415f27[_0x89de('0x2d')],_0x1856a4;if(_0x2fab48>=_0x5c4c4c){_0x2fab48=_0x5c4c4c;_0x1856a4=0xc8;}else{_0x1856a4=0xce;}_0x378ce2[_0x89de('0x2a')](_0x1856a4);return _0x378ce2[_0x89de('0x2e')](_0x89de('0x2f'),_0x3eb115+'-'+_0x2fab48+'/'+_0x5c4c4c)[_0x89de('0x30')](_0x4d70fc);}return null;};}function patchUpdates(_0x574aa5){return function(_0x53c644){try{jsonpatch[_0x89de('0x31')](_0x53c644,_0x574aa5,!![]);}catch(_0x3cef33){return BPromise[_0x89de('0x32')](_0x3cef33);}return _0x53c644[_0x89de('0x33')]();};}function saveUpdates(_0x3915f1,_0x3b793c){return function(_0x1a96ff){if(_0x1a96ff){return _0x1a96ff[_0x89de('0x34')](_0x3915f1)[_0x89de('0x1f')](function(_0x47486f){return _0x47486f;});}return null;};}function removeEntity(_0x1df779,_0x518a11){return function(_0x1302d1){if(_0x1302d1){return _0x1302d1[_0x89de('0x35')]()[_0x89de('0x1f')](function(){_0x1df779[_0x89de('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x369d05,_0x1d579b){return function(_0x152c27){if(!_0x152c27){_0x369d05[_0x89de('0x29')](0x194);}return _0x152c27;};}function handleError(_0x482474,_0x35a9f2){_0x35a9f2=_0x35a9f2||0x1f4;return function(_0x29fb63){logger[_0x89de('0x24')](_0x29fb63[_0x89de('0x36')]);if(_0x29fb63[_0x89de('0x37')]){delete _0x29fb63['name'];}_0x482474[_0x89de('0x2a')](_0x35a9f2)['send'](_0x29fb63);};}exports[_0x89de('0x38')]=function(_0x1ec9e4,_0xcaed7e){var _0x38c451={},_0x3d188e={},_0x434051={'count':0x0,'rows':[]};var _0x33d8b8=_[_0x89de('0x39')](db[_0x89de('0x3a')][_0x89de('0x3b')],function(_0x3c5b2d){return{'name':_0x3c5b2d['fieldName'],'type':_0x3c5b2d['type'][_0x89de('0x3c')]};});_0x3d188e[_0x89de('0x3d')]=_[_0x89de('0x39')](_0x33d8b8,_0x89de('0x37'));_0x3d188e['query']=_['keys'](_0x1ec9e4['query']);_0x3d188e[_0x89de('0x3e')]=_['intersection'](_0x3d188e[_0x89de('0x3d')],_0x3d188e[_0x89de('0x3f')]);_0x38c451['attributes']=_['intersection'](_0x3d188e[_0x89de('0x3d')],qs['fields'](_0x1ec9e4['query'][_0x89de('0x40')]));_0x38c451[_0x89de('0x41')]=_0x38c451['attributes']['length']?_0x38c451['attributes']:_0x3d188e[_0x89de('0x3d')];if(!_0x1ec9e4[_0x89de('0x3f')][_0x89de('0x42')]('nolimit')){_0x38c451[_0x89de('0x2d')]=qs['limit'](_0x1ec9e4[_0x89de('0x3f')]['limit']);_0x38c451['offset']=qs[_0x89de('0x2c')](_0x1ec9e4[_0x89de('0x3f')]['offset']);}_0x38c451[_0x89de('0x43')]=qs[_0x89de('0x44')](_0x1ec9e4[_0x89de('0x3f')][_0x89de('0x44')]);_0x38c451[_0x89de('0x45')]=qs[_0x89de('0x3e')](_[_0x89de('0x46')](_0x1ec9e4[_0x89de('0x3f')],_0x3d188e[_0x89de('0x3e')]),_0x33d8b8);if(_0x1ec9e4[_0x89de('0x3f')][_0x89de('0x47')]){_0x38c451[_0x89de('0x45')]=_[_0x89de('0x48')](_0x38c451['where'],{'$or':_[_0x89de('0x39')](_0x33d8b8,function(_0x400936){if(_0x400936[_0x89de('0x49')]!=='VIRTUAL'){var _0x1cd8f4={};_0x1cd8f4[_0x400936[_0x89de('0x37')]]={'$like':'%'+_0x1ec9e4['query'][_0x89de('0x47')]+'%'};return _0x1cd8f4;}})});}_0x38c451=_[_0x89de('0x48')]({},_0x38c451,_0x1ec9e4[_0x89de('0x4a')]);var _0x3e2b5e={'where':_0x38c451[_0x89de('0x45')]};return db['SugarcrmConfiguration'][_0x89de('0x2b')](_0x3e2b5e)['then'](function(_0x443d7f){_0x434051[_0x89de('0x2b')]=_0x443d7f;if(_0x1ec9e4['query'][_0x89de('0x4b')]){_0x38c451[_0x89de('0x4c')]=[{'all':!![]}];}return db[_0x89de('0x3a')]['findAll'](_0x38c451);})[_0x89de('0x1f')](function(_0x1cef21){_0x434051[_0x89de('0x4d')]=_0x1cef21;return _0x434051;})['then'](respondWithFilteredResult(_0xcaed7e,_0x38c451))[_0x89de('0x28')](handleError(_0xcaed7e,null));};exports['show']=function(_0x3251b7,_0x50b415){var _0x3ad464={'raw':![],'where':{'id':_0x3251b7[_0x89de('0x4e')]['id']}},_0x1c9e63={};_0x1c9e63[_0x89de('0x3d')]=_[_0x89de('0x4f')](db[_0x89de('0x3a')]['rawAttributes']);_0x1c9e63[_0x89de('0x3f')]=_[_0x89de('0x4f')](_0x3251b7[_0x89de('0x3f')]);_0x1c9e63[_0x89de('0x3e')]=_[_0x89de('0x50')](_0x1c9e63[_0x89de('0x3d')],_0x1c9e63['query']);_0x3ad464[_0x89de('0x41')]=_[_0x89de('0x50')](_0x1c9e63['model'],qs['fields'](_0x3251b7[_0x89de('0x3f')]['fields']));_0x3ad464['attributes']=_0x3ad464['attributes']['length']?_0x3ad464['attributes']:_0x1c9e63[_0x89de('0x3d')];if(_0x3251b7[_0x89de('0x3f')][_0x89de('0x4b')]){_0x3ad464[_0x89de('0x4c')]=[{'all':!![]}];}_0x3ad464=_['merge']({},_0x3ad464,_0x3251b7[_0x89de('0x4a')]);return db['SugarcrmConfiguration'][_0x89de('0x51')](_0x3ad464)['then'](handleEntityNotFound(_0x50b415,null))['then'](respondWithResult(_0x50b415,null))['catch'](handleError(_0x50b415,null));};exports[_0x89de('0x52')]=function(_0x2fbcee,_0x19ec91){return db[_0x89de('0x3a')][_0x89de('0x52')](_0x2fbcee[_0x89de('0x53')],{})[_0x89de('0x1f')](respondWithResult(_0x19ec91,0xc9))['catch'](handleError(_0x19ec91,null));};exports[_0x89de('0x34')]=function(_0x3a6355,_0x37225b){if(_0x3a6355['body']['id']){delete _0x3a6355[_0x89de('0x53')]['id'];}return db[_0x89de('0x3a')][_0x89de('0x51')]({'where':{'id':_0x3a6355[_0x89de('0x4e')]['id']}})[_0x89de('0x1f')](handleEntityNotFound(_0x37225b,null))[_0x89de('0x1f')](saveUpdates(_0x3a6355[_0x89de('0x53')],null))[_0x89de('0x1f')](respondWithResult(_0x37225b,null))[_0x89de('0x28')](handleError(_0x37225b,null));};exports[_0x89de('0x35')]=function(_0x226e5d,_0x715339){return db[_0x89de('0x3a')]['find']({'where':{'id':_0x226e5d[_0x89de('0x4e')]['id']}})[_0x89de('0x1f')](handleEntityNotFound(_0x715339,null))[_0x89de('0x1f')](removeEntity(_0x715339,null))['catch'](handleError(_0x715339,null));};exports[_0x89de('0x54')]=function(_0x5e1bb6,_0x32d689,_0x497f16){var _0x472f86={};var _0x1fa243={};var _0x1754ef;var _0x4be1b2;return db[_0x89de('0x3a')][_0x89de('0x55')]({'where':{'id':_0x5e1bb6[_0x89de('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32d689,null))[_0x89de('0x1f')](function(_0x54b483){if(_0x54b483){_0x1754ef=_0x54b483;_0x1fa243[_0x89de('0x3d')]=_['keys'](db[_0x89de('0x56')]['rawAttributes']);_0x1fa243['query']=_[_0x89de('0x4f')](_0x5e1bb6[_0x89de('0x3f')]);_0x1fa243[_0x89de('0x3e')]=_[_0x89de('0x50')](_0x1fa243[_0x89de('0x3d')],_0x1fa243[_0x89de('0x3f')]);_0x472f86[_0x89de('0x41')]=_[_0x89de('0x50')](_0x1fa243['model'],qs['fields'](_0x5e1bb6[_0x89de('0x3f')][_0x89de('0x40')]));_0x472f86['attributes']=_0x472f86[_0x89de('0x41')][_0x89de('0x57')]?_0x472f86[_0x89de('0x41')]:_0x1fa243[_0x89de('0x3d')];_0x472f86[_0x89de('0x43')]=qs[_0x89de('0x44')](_0x5e1bb6['query']['sort']);_0x472f86[_0x89de('0x45')]=qs[_0x89de('0x3e')](_[_0x89de('0x46')](_0x5e1bb6[_0x89de('0x3f')],_0x1fa243[_0x89de('0x3e')]));if(_0x5e1bb6['query'][_0x89de('0x47')]){_0x472f86[_0x89de('0x45')]=_['merge'](_0x472f86[_0x89de('0x45')],{'$or':_[_0x89de('0x39')](_0x472f86[_0x89de('0x41')],function(_0xc2bf35){var _0x4fb2a7={};_0x4fb2a7[_0xc2bf35]={'$like':'%'+_0x5e1bb6['query']['filter']+'%'};return _0x4fb2a7;})});}_0x472f86=_[_0x89de('0x48')]({},_0x472f86,_0x5e1bb6[_0x89de('0x4a')]);return _0x1754ef[_0x89de('0x54')](_0x472f86);}})[_0x89de('0x1f')](function(_0xb06faa){if(_0xb06faa){_0x4be1b2=_0xb06faa[_0x89de('0x57')];if(!_0x5e1bb6[_0x89de('0x3f')][_0x89de('0x42')]('nolimit')){_0x472f86[_0x89de('0x2d')]=qs['limit'](_0x5e1bb6[_0x89de('0x3f')][_0x89de('0x2d')]);_0x472f86[_0x89de('0x2c')]=qs[_0x89de('0x2c')](_0x5e1bb6[_0x89de('0x3f')][_0x89de('0x2c')]);}return _0x1754ef[_0x89de('0x54')](_0x472f86);}})[_0x89de('0x1f')](function(_0xe1aa50){if(_0xe1aa50){return _0xe1aa50?{'count':_0x4be1b2,'rows':_0xe1aa50}:null;}})[_0x89de('0x1f')](respondWithResult(_0x32d689,null))[_0x89de('0x28')](handleError(_0x32d689,null));};exports[_0x89de('0x58')]=function(_0x113ade,_0x4bb328,_0x48594e){var _0x273fc4={};var _0x45b623={};var _0x475627;var _0x224d8;return db[_0x89de('0x3a')][_0x89de('0x55')]({'where':{'id':_0x113ade[_0x89de('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4bb328,null))['then'](function(_0x57e3fd){if(_0x57e3fd){_0x475627=_0x57e3fd;_0x45b623[_0x89de('0x3d')]=_[_0x89de('0x4f')](db[_0x89de('0x56')][_0x89de('0x3b')]);_0x45b623[_0x89de('0x3f')]=_['keys'](_0x113ade[_0x89de('0x3f')]);_0x45b623[_0x89de('0x3e')]=_[_0x89de('0x50')](_0x45b623[_0x89de('0x3d')],_0x45b623[_0x89de('0x3f')]);_0x273fc4[_0x89de('0x41')]=_[_0x89de('0x50')](_0x45b623['model'],qs[_0x89de('0x40')](_0x113ade['query'][_0x89de('0x40')]));_0x273fc4[_0x89de('0x41')]=_0x273fc4[_0x89de('0x41')][_0x89de('0x57')]?_0x273fc4[_0x89de('0x41')]:_0x45b623['model'];_0x273fc4[_0x89de('0x43')]=qs[_0x89de('0x44')](_0x113ade[_0x89de('0x3f')][_0x89de('0x44')]);_0x273fc4[_0x89de('0x45')]=qs[_0x89de('0x3e')](_[_0x89de('0x46')](_0x113ade['query'],_0x45b623[_0x89de('0x3e')]));if(_0x113ade[_0x89de('0x3f')][_0x89de('0x47')]){_0x273fc4[_0x89de('0x45')]=_[_0x89de('0x48')](_0x273fc4[_0x89de('0x45')],{'$or':_[_0x89de('0x39')](_0x273fc4[_0x89de('0x41')],function(_0x80b77b){var _0x52ad43={};_0x52ad43[_0x80b77b]={'$like':'%'+_0x113ade['query'][_0x89de('0x47')]+'%'};return _0x52ad43;})});}_0x273fc4=_[_0x89de('0x48')]({},_0x273fc4,_0x113ade[_0x89de('0x4a')]);return _0x475627[_0x89de('0x58')](_0x273fc4);}})[_0x89de('0x1f')](function(_0x288967){if(_0x288967){_0x224d8=_0x288967[_0x89de('0x57')];if(!_0x113ade['query'][_0x89de('0x42')](_0x89de('0x59'))){_0x273fc4[_0x89de('0x2d')]=qs['limit'](_0x113ade[_0x89de('0x3f')][_0x89de('0x2d')]);_0x273fc4[_0x89de('0x2c')]=qs[_0x89de('0x2c')](_0x113ade[_0x89de('0x3f')][_0x89de('0x2c')]);}return _0x475627[_0x89de('0x58')](_0x273fc4);}})[_0x89de('0x1f')](function(_0xcdef38){if(_0xcdef38){return _0xcdef38?{'count':_0x224d8,'rows':_0xcdef38}:null;}})[_0x89de('0x1f')](respondWithResult(_0x4bb328,null))[_0x89de('0x28')](handleError(_0x4bb328,null));};exports[_0x89de('0x5a')]=function(_0x223233,_0x2b0187,_0x3456bd){var _0x2632d5={};var _0x157504={};var _0x4afc97;var _0x5ead19;return db[_0x89de('0x3a')][_0x89de('0x55')]({'where':{'id':_0x223233[_0x89de('0x4e')]['id']}})[_0x89de('0x1f')](handleEntityNotFound(_0x2b0187,null))['then'](function(_0x3dd329){if(_0x3dd329){_0x4afc97=_0x3dd329;_0x157504[_0x89de('0x3d')]=_['keys'](db[_0x89de('0x56')][_0x89de('0x3b')]);_0x157504['query']=_[_0x89de('0x4f')](_0x223233['query']);_0x157504[_0x89de('0x3e')]=_[_0x89de('0x50')](_0x157504[_0x89de('0x3d')],_0x157504[_0x89de('0x3f')]);_0x2632d5[_0x89de('0x41')]=_[_0x89de('0x50')](_0x157504[_0x89de('0x3d')],qs[_0x89de('0x40')](_0x223233[_0x89de('0x3f')][_0x89de('0x40')]));_0x2632d5[_0x89de('0x41')]=_0x2632d5[_0x89de('0x41')]['length']?_0x2632d5[_0x89de('0x41')]:_0x157504[_0x89de('0x3d')];_0x2632d5['order']=qs[_0x89de('0x44')](_0x223233[_0x89de('0x3f')][_0x89de('0x44')]);_0x2632d5[_0x89de('0x45')]=qs[_0x89de('0x3e')](_[_0x89de('0x46')](_0x223233[_0x89de('0x3f')],_0x157504[_0x89de('0x3e')]));if(_0x223233['query'][_0x89de('0x47')]){_0x2632d5[_0x89de('0x45')]=_[_0x89de('0x48')](_0x2632d5['where'],{'$or':_[_0x89de('0x39')](_0x2632d5[_0x89de('0x41')],function(_0x26d7b9){var _0x5568be={};_0x5568be[_0x26d7b9]={'$like':'%'+_0x223233[_0x89de('0x3f')][_0x89de('0x47')]+'%'};return _0x5568be;})});}_0x2632d5=_[_0x89de('0x48')]({},_0x2632d5,_0x223233[_0x89de('0x4a')]);return _0x4afc97[_0x89de('0x5a')](_0x2632d5);}})[_0x89de('0x1f')](function(_0x22d24d){if(_0x22d24d){_0x5ead19=_0x22d24d[_0x89de('0x57')];if(!_0x223233['query']['hasOwnProperty'](_0x89de('0x59'))){_0x2632d5[_0x89de('0x2d')]=qs[_0x89de('0x2d')](_0x223233['query']['limit']);_0x2632d5[_0x89de('0x2c')]=qs[_0x89de('0x2c')](_0x223233['query']['offset']);}return _0x4afc97[_0x89de('0x5a')](_0x2632d5);}})[_0x89de('0x1f')](function(_0x43022b){if(_0x43022b){return _0x43022b?{'count':_0x5ead19,'rows':_0x43022b}:null;}})[_0x89de('0x1f')](respondWithResult(_0x2b0187,null))[_0x89de('0x28')](handleError(_0x2b0187,null));}; \ No newline at end of file +var _0x36a5=['desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','index','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','rows','show','params','find','create','body','findOne','getFields','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x29ffee,_0x20b26a){var _0x4f797e=function(_0x1d3e18){while(--_0x1d3e18){_0x29ffee['push'](_0x29ffee['shift']());}};_0x4f797e(++_0x20b26a);}(_0x36a5,0x107));var _0x536a=function(_0x4019e3,_0x3e7ce5){_0x4019e3=_0x4019e3-0x0;var _0x1a8c81=_0x36a5[_0x4019e3];return _0x1a8c81;};'use strict';var pdf=require(_0x536a('0x0'));var emlformat=require(_0x536a('0x1'));var rimraf=require(_0x536a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x536a('0x3'));var moment=require(_0x536a('0x4'));var BPromise=require(_0x536a('0x5'));var Mustache=require('mustache');var util=require(_0x536a('0x6'));var path=require('path');var sox=require(_0x536a('0x7'));var csv=require('to-csv');var ejs=require(_0x536a('0x8'));var fs=require('fs');var _=require(_0x536a('0x9'));var squel=require(_0x536a('0xa'));var crypto=require(_0x536a('0xb'));var jsforce=require(_0x536a('0xc'));var deskjs=require(_0x536a('0xd'));var toCsv=require(_0x536a('0xe'));var querystring=require(_0x536a('0xf'));var Papa=require(_0x536a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x536a('0x11'));var as=require(_0x536a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x536a('0x13'))(_0x536a('0x14'));var utils=require(_0x536a('0x15'));var config=require(_0x536a('0x16'));var licenseUtil=require(_0x536a('0x17'));var db=require(_0x536a('0x18'))['db'];var jayson=require(_0x536a('0x19'));var client=jayson[_0x536a('0x1a')][_0x536a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d49be,_0x5cb3d5,_0x19f8dd,_0x55e0d5){return new BPromise(function(_0x4e3881,_0x2afa30){var _0x1193f8=_0x55e0d5||client;return _0x1193f8[_0x536a('0x1c')](_0x4d49be,_0x19f8dd)['then'](function(_0xda54df){logger['info'](_0x536a('0x1d'),_0x5cb3d5,_0x536a('0x1e'));logger[_0x536a('0x1f')](_0x536a('0x20'),_0x5cb3d5,_0x536a('0x1e'),JSON[_0x536a('0x21')](_0xda54df));if(_0xda54df['error']){if(_0xda54df[_0x536a('0x22')][_0x536a('0x23')]===0x1f4){logger[_0x536a('0x22')](_0x536a('0x1d'),_0x5cb3d5,_0xda54df[_0x536a('0x22')]['message']);return _0x2afa30(_0xda54df[_0x536a('0x22')][_0x536a('0x24')]);}logger[_0x536a('0x22')](_0x536a('0x1d'),_0x5cb3d5,_0xda54df['error']['message']);return _0x4e3881(_0xda54df[_0x536a('0x22')]['message']);}else{logger[_0x536a('0x25')](_0x536a('0x1d'),_0x5cb3d5,_0x536a('0x1e'));_0x4e3881(_0xda54df[_0x536a('0x26')]['message']);}})[_0x536a('0x27')](function(_0x1f0488){logger[_0x536a('0x22')](_0x536a('0x1d'),_0x5cb3d5,_0x1f0488);_0x2afa30(_0x1f0488);});});}function respondWithStatusCode(_0x1a608d,_0x47f93d){_0x47f93d=_0x47f93d||0xcc;return function(_0x205aef){if(_0x205aef){return _0x1a608d[_0x536a('0x28')](_0x47f93d);}return _0x1a608d[_0x536a('0x29')](_0x47f93d)[_0x536a('0x2a')]();};}function respondWithResult(_0x536723,_0x4359fc){_0x4359fc=_0x4359fc||0xc8;return function(_0x5ab442){if(_0x5ab442){return _0x536723[_0x536a('0x29')](_0x4359fc)[_0x536a('0x2b')](_0x5ab442);}};}function respondWithFilteredResult(_0x55bf29,_0x39095e){return function(_0x363493){if(_0x363493){var _0x22babe=_0x363493[_0x536a('0x2c')],_0x23ab3e=_0x39095e['offset'],_0xff0ee3=_0x39095e[_0x536a('0x2d')]+_0x39095e[_0x536a('0x2e')],_0x4887f2;if(_0xff0ee3>=_0x22babe){_0xff0ee3=_0x22babe;_0x4887f2=0xc8;}else{_0x4887f2=0xce;}_0x55bf29[_0x536a('0x29')](_0x4887f2);return _0x55bf29[_0x536a('0x2f')](_0x536a('0x30'),_0x23ab3e+'-'+_0xff0ee3+'/'+_0x22babe)['json'](_0x363493);}return null;};}function patchUpdates(_0x1f6b25){return function(_0x28f244){try{jsonpatch[_0x536a('0x31')](_0x28f244,_0x1f6b25,!![]);}catch(_0x3f6df8){return BPromise[_0x536a('0x32')](_0x3f6df8);}return _0x28f244['save']();};}function saveUpdates(_0x6518e5,_0x25a73f){return function(_0x455327){if(_0x455327){return _0x455327[_0x536a('0x33')](_0x6518e5)[_0x536a('0x34')](function(_0x357dc4){return _0x357dc4;});}return null;};}function removeEntity(_0x3adde3,_0x50f108){return function(_0x3dd9e0){if(_0x3dd9e0){return _0x3dd9e0[_0x536a('0x35')]()[_0x536a('0x34')](function(){_0x3adde3[_0x536a('0x29')](0xcc)[_0x536a('0x2a')]();});}};}function handleEntityNotFound(_0x5e7832,_0x325a59){return function(_0x2f1ee6){if(!_0x2f1ee6){_0x5e7832['sendStatus'](0x194);}return _0x2f1ee6;};}function handleError(_0x4bf134,_0xcdda51){_0xcdda51=_0xcdda51||0x1f4;return function(_0x2f25aa){logger[_0x536a('0x22')](_0x2f25aa['stack']);if(_0x2f25aa['name']){delete _0x2f25aa[_0x536a('0x36')];}_0x4bf134[_0x536a('0x29')](_0xcdda51)['send'](_0x2f25aa);};}exports[_0x536a('0x37')]=function(_0x33a196,_0xd1a469){var _0x26b801={},_0x79b4ec={},_0x482e1c={'count':0x0,'rows':[]};var _0x59cd67=_['map'](db['SugarcrmConfiguration'][_0x536a('0x38')],function(_0x448dcf){return{'name':_0x448dcf['fieldName'],'type':_0x448dcf[_0x536a('0x39')][_0x536a('0x3a')]};});_0x79b4ec['model']=_['map'](_0x59cd67,_0x536a('0x36'));_0x79b4ec[_0x536a('0x3b')]=_[_0x536a('0x3c')](_0x33a196[_0x536a('0x3b')]);_0x79b4ec[_0x536a('0x3d')]=_[_0x536a('0x3e')](_0x79b4ec[_0x536a('0x3f')],_0x79b4ec['query']);_0x26b801[_0x536a('0x40')]=_[_0x536a('0x3e')](_0x79b4ec[_0x536a('0x3f')],qs['fields'](_0x33a196[_0x536a('0x3b')][_0x536a('0x41')]));_0x26b801[_0x536a('0x40')]=_0x26b801[_0x536a('0x40')][_0x536a('0x42')]?_0x26b801[_0x536a('0x40')]:_0x79b4ec[_0x536a('0x3f')];if(!_0x33a196['query'][_0x536a('0x43')](_0x536a('0x44'))){_0x26b801['limit']=qs['limit'](_0x33a196['query'][_0x536a('0x2e')]);_0x26b801['offset']=qs['offset'](_0x33a196[_0x536a('0x3b')][_0x536a('0x2d')]);}_0x26b801[_0x536a('0x45')]=qs[_0x536a('0x46')](_0x33a196[_0x536a('0x3b')]['sort']);_0x26b801[_0x536a('0x47')]=qs[_0x536a('0x3d')](_[_0x536a('0x48')](_0x33a196[_0x536a('0x3b')],_0x79b4ec[_0x536a('0x3d')]),_0x59cd67);if(_0x33a196[_0x536a('0x3b')][_0x536a('0x49')]){_0x26b801['where']=_[_0x536a('0x4a')](_0x26b801[_0x536a('0x47')],{'$or':_[_0x536a('0x4b')](_0x59cd67,function(_0x18079d){if(_0x18079d[_0x536a('0x39')]!==_0x536a('0x4c')){var _0x464876={};_0x464876[_0x18079d[_0x536a('0x36')]]={'$like':'%'+_0x33a196['query']['filter']+'%'};return _0x464876;}})});}_0x26b801=_[_0x536a('0x4a')]({},_0x26b801,_0x33a196[_0x536a('0x4d')]);var _0xb9b4f3={'where':_0x26b801[_0x536a('0x47')]};return db[_0x536a('0x4e')]['count'](_0xb9b4f3)['then'](function(_0x17a443){_0x482e1c['count']=_0x17a443;if(_0x33a196[_0x536a('0x3b')][_0x536a('0x4f')]){_0x26b801[_0x536a('0x50')]=[{'all':!![]}];}return db[_0x536a('0x4e')]['findAll'](_0x26b801);})['then'](function(_0x44aead){_0x482e1c[_0x536a('0x51')]=_0x44aead;return _0x482e1c;})[_0x536a('0x34')](respondWithFilteredResult(_0xd1a469,_0x26b801))[_0x536a('0x27')](handleError(_0xd1a469,null));};exports[_0x536a('0x52')]=function(_0x1d6f4b,_0x43f707){var _0x35ed67={'raw':![],'where':{'id':_0x1d6f4b[_0x536a('0x53')]['id']}},_0x51f171={};_0x51f171['model']=_[_0x536a('0x3c')](db['SugarcrmConfiguration'][_0x536a('0x38')]);_0x51f171[_0x536a('0x3b')]=_[_0x536a('0x3c')](_0x1d6f4b[_0x536a('0x3b')]);_0x51f171[_0x536a('0x3d')]=_[_0x536a('0x3e')](_0x51f171['model'],_0x51f171[_0x536a('0x3b')]);_0x35ed67[_0x536a('0x40')]=_['intersection'](_0x51f171[_0x536a('0x3f')],qs[_0x536a('0x41')](_0x1d6f4b['query'][_0x536a('0x41')]));_0x35ed67[_0x536a('0x40')]=_0x35ed67[_0x536a('0x40')][_0x536a('0x42')]?_0x35ed67[_0x536a('0x40')]:_0x51f171[_0x536a('0x3f')];if(_0x1d6f4b[_0x536a('0x3b')]['includeAll']){_0x35ed67[_0x536a('0x50')]=[{'all':!![]}];}_0x35ed67=_[_0x536a('0x4a')]({},_0x35ed67,_0x1d6f4b[_0x536a('0x4d')]);return db[_0x536a('0x4e')][_0x536a('0x54')](_0x35ed67)['then'](handleEntityNotFound(_0x43f707,null))[_0x536a('0x34')](respondWithResult(_0x43f707,null))[_0x536a('0x27')](handleError(_0x43f707,null));};exports[_0x536a('0x55')]=function(_0x3412a3,_0x3e520f){return db[_0x536a('0x4e')]['create'](_0x3412a3['body'],{})[_0x536a('0x34')](respondWithResult(_0x3e520f,0xc9))[_0x536a('0x27')](handleError(_0x3e520f,null));};exports[_0x536a('0x33')]=function(_0x2ba3a3,_0x33ddbf){if(_0x2ba3a3[_0x536a('0x56')]['id']){delete _0x2ba3a3[_0x536a('0x56')]['id'];}return db[_0x536a('0x4e')][_0x536a('0x54')]({'where':{'id':_0x2ba3a3[_0x536a('0x53')]['id']}})[_0x536a('0x34')](handleEntityNotFound(_0x33ddbf,null))['then'](saveUpdates(_0x2ba3a3[_0x536a('0x56')],null))[_0x536a('0x34')](respondWithResult(_0x33ddbf,null))[_0x536a('0x27')](handleError(_0x33ddbf,null));};exports['destroy']=function(_0x44d2c1,_0x303e50){return db[_0x536a('0x4e')]['find']({'where':{'id':_0x44d2c1[_0x536a('0x53')]['id']}})['then'](handleEntityNotFound(_0x303e50,null))['then'](removeEntity(_0x303e50,null))[_0x536a('0x27')](handleError(_0x303e50,null));};exports['getFields']=function(_0x4dfcb1,_0x1d20bf,_0x158df8){var _0x1562de={};var _0x3fb7e0={};var _0x2b2bf2;var _0x36060f;return db[_0x536a('0x4e')][_0x536a('0x57')]({'where':{'id':_0x4dfcb1['params']['id']}})[_0x536a('0x34')](handleEntityNotFound(_0x1d20bf,null))['then'](function(_0xcc7cb4){if(_0xcc7cb4){_0x2b2bf2=_0xcc7cb4;_0x3fb7e0[_0x536a('0x3f')]=_[_0x536a('0x3c')](db['SugarcrmField'][_0x536a('0x38')]);_0x3fb7e0[_0x536a('0x3b')]=_[_0x536a('0x3c')](_0x4dfcb1[_0x536a('0x3b')]);_0x3fb7e0[_0x536a('0x3d')]=_[_0x536a('0x3e')](_0x3fb7e0[_0x536a('0x3f')],_0x3fb7e0[_0x536a('0x3b')]);_0x1562de[_0x536a('0x40')]=_[_0x536a('0x3e')](_0x3fb7e0[_0x536a('0x3f')],qs[_0x536a('0x41')](_0x4dfcb1[_0x536a('0x3b')][_0x536a('0x41')]));_0x1562de[_0x536a('0x40')]=_0x1562de[_0x536a('0x40')][_0x536a('0x42')]?_0x1562de['attributes']:_0x3fb7e0[_0x536a('0x3f')];_0x1562de[_0x536a('0x45')]=qs[_0x536a('0x46')](_0x4dfcb1[_0x536a('0x3b')][_0x536a('0x46')]);_0x1562de[_0x536a('0x47')]=qs[_0x536a('0x3d')](_[_0x536a('0x48')](_0x4dfcb1[_0x536a('0x3b')],_0x3fb7e0[_0x536a('0x3d')]));if(_0x4dfcb1['query']['filter']){_0x1562de[_0x536a('0x47')]=_['merge'](_0x1562de['where'],{'$or':_[_0x536a('0x4b')](_0x1562de[_0x536a('0x40')],function(_0x8ce94){var _0x2f5d7b={};_0x2f5d7b[_0x8ce94]={'$like':'%'+_0x4dfcb1['query'][_0x536a('0x49')]+'%'};return _0x2f5d7b;})});}_0x1562de=_[_0x536a('0x4a')]({},_0x1562de,_0x4dfcb1[_0x536a('0x4d')]);return _0x2b2bf2[_0x536a('0x58')](_0x1562de);}})[_0x536a('0x34')](function(_0x12bf8e){if(_0x12bf8e){_0x36060f=_0x12bf8e[_0x536a('0x42')];if(!_0x4dfcb1['query'][_0x536a('0x43')](_0x536a('0x44'))){_0x1562de['limit']=qs[_0x536a('0x2e')](_0x4dfcb1['query'][_0x536a('0x2e')]);_0x1562de[_0x536a('0x2d')]=qs[_0x536a('0x2d')](_0x4dfcb1[_0x536a('0x3b')]['offset']);}return _0x2b2bf2[_0x536a('0x58')](_0x1562de);}})[_0x536a('0x34')](function(_0x402a9c){if(_0x402a9c){return _0x402a9c?{'count':_0x36060f,'rows':_0x402a9c}:null;}})[_0x536a('0x34')](respondWithResult(_0x1d20bf,null))[_0x536a('0x27')](handleError(_0x1d20bf,null));};exports[_0x536a('0x59')]=function(_0x2592a8,_0x310443,_0x5f3a1c){var _0x14c804={};var _0x46a383={};var _0x5de329;var _0x14a7bc;return db[_0x536a('0x4e')][_0x536a('0x57')]({'where':{'id':_0x2592a8[_0x536a('0x53')]['id']}})['then'](handleEntityNotFound(_0x310443,null))['then'](function(_0x49bb2b){if(_0x49bb2b){_0x5de329=_0x49bb2b;_0x46a383[_0x536a('0x3f')]=_[_0x536a('0x3c')](db[_0x536a('0x5a')][_0x536a('0x38')]);_0x46a383[_0x536a('0x3b')]=_[_0x536a('0x3c')](_0x2592a8[_0x536a('0x3b')]);_0x46a383[_0x536a('0x3d')]=_[_0x536a('0x3e')](_0x46a383[_0x536a('0x3f')],_0x46a383['query']);_0x14c804[_0x536a('0x40')]=_[_0x536a('0x3e')](_0x46a383[_0x536a('0x3f')],qs['fields'](_0x2592a8[_0x536a('0x3b')][_0x536a('0x41')]));_0x14c804['attributes']=_0x14c804[_0x536a('0x40')][_0x536a('0x42')]?_0x14c804[_0x536a('0x40')]:_0x46a383['model'];_0x14c804['order']=qs[_0x536a('0x46')](_0x2592a8[_0x536a('0x3b')][_0x536a('0x46')]);_0x14c804[_0x536a('0x47')]=qs['filters'](_['pick'](_0x2592a8[_0x536a('0x3b')],_0x46a383['filters']));if(_0x2592a8['query'][_0x536a('0x49')]){_0x14c804[_0x536a('0x47')]=_[_0x536a('0x4a')](_0x14c804[_0x536a('0x47')],{'$or':_[_0x536a('0x4b')](_0x14c804[_0x536a('0x40')],function(_0x36e03a){var _0x5228c4={};_0x5228c4[_0x36e03a]={'$like':'%'+_0x2592a8[_0x536a('0x3b')][_0x536a('0x49')]+'%'};return _0x5228c4;})});}_0x14c804=_['merge']({},_0x14c804,_0x2592a8['options']);return _0x5de329[_0x536a('0x59')](_0x14c804);}})[_0x536a('0x34')](function(_0x33ba28){if(_0x33ba28){_0x14a7bc=_0x33ba28[_0x536a('0x42')];if(!_0x2592a8[_0x536a('0x3b')][_0x536a('0x43')]('nolimit')){_0x14c804[_0x536a('0x2e')]=qs[_0x536a('0x2e')](_0x2592a8['query'][_0x536a('0x2e')]);_0x14c804[_0x536a('0x2d')]=qs['offset'](_0x2592a8[_0x536a('0x3b')]['offset']);}return _0x5de329[_0x536a('0x59')](_0x14c804);}})['then'](function(_0x4aa232){if(_0x4aa232){return _0x4aa232?{'count':_0x14a7bc,'rows':_0x4aa232}:null;}})[_0x536a('0x34')](respondWithResult(_0x310443,null))['catch'](handleError(_0x310443,null));};exports['getDescriptions']=function(_0xb0fd78,_0x26ac4d,_0xba089d){var _0xdd2fcd={};var _0x1f2c6a={};var _0x54ca5a;var _0x451760;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0xb0fd78[_0x536a('0x53')]['id']}})[_0x536a('0x34')](handleEntityNotFound(_0x26ac4d,null))[_0x536a('0x34')](function(_0x2eb804){if(_0x2eb804){_0x54ca5a=_0x2eb804;_0x1f2c6a[_0x536a('0x3f')]=_[_0x536a('0x3c')](db[_0x536a('0x5a')][_0x536a('0x38')]);_0x1f2c6a[_0x536a('0x3b')]=_['keys'](_0xb0fd78[_0x536a('0x3b')]);_0x1f2c6a[_0x536a('0x3d')]=_['intersection'](_0x1f2c6a[_0x536a('0x3f')],_0x1f2c6a[_0x536a('0x3b')]);_0xdd2fcd[_0x536a('0x40')]=_[_0x536a('0x3e')](_0x1f2c6a['model'],qs['fields'](_0xb0fd78['query']['fields']));_0xdd2fcd[_0x536a('0x40')]=_0xdd2fcd[_0x536a('0x40')][_0x536a('0x42')]?_0xdd2fcd['attributes']:_0x1f2c6a[_0x536a('0x3f')];_0xdd2fcd[_0x536a('0x45')]=qs[_0x536a('0x46')](_0xb0fd78[_0x536a('0x3b')][_0x536a('0x46')]);_0xdd2fcd[_0x536a('0x47')]=qs['filters'](_[_0x536a('0x48')](_0xb0fd78[_0x536a('0x3b')],_0x1f2c6a[_0x536a('0x3d')]));if(_0xb0fd78['query'][_0x536a('0x49')]){_0xdd2fcd[_0x536a('0x47')]=_[_0x536a('0x4a')](_0xdd2fcd[_0x536a('0x47')],{'$or':_[_0x536a('0x4b')](_0xdd2fcd['attributes'],function(_0x250f21){var _0x41b8c5={};_0x41b8c5[_0x250f21]={'$like':'%'+_0xb0fd78[_0x536a('0x3b')][_0x536a('0x49')]+'%'};return _0x41b8c5;})});}_0xdd2fcd=_['merge']({},_0xdd2fcd,_0xb0fd78[_0x536a('0x4d')]);return _0x54ca5a[_0x536a('0x5b')](_0xdd2fcd);}})['then'](function(_0x1b8591){if(_0x1b8591){_0x451760=_0x1b8591['length'];if(!_0xb0fd78[_0x536a('0x3b')][_0x536a('0x43')](_0x536a('0x44'))){_0xdd2fcd[_0x536a('0x2e')]=qs[_0x536a('0x2e')](_0xb0fd78[_0x536a('0x3b')][_0x536a('0x2e')]);_0xdd2fcd['offset']=qs[_0x536a('0x2d')](_0xb0fd78['query']['offset']);}return _0x54ca5a[_0x536a('0x5b')](_0xdd2fcd);}})[_0x536a('0x34')](function(_0x28731a){if(_0x28731a){return _0x28731a?{'count':_0x451760,'rows':_0x28731a}:null;}})[_0x536a('0x34')](respondWithResult(_0x26ac4d,null))[_0x536a('0x27')](handleError(_0x26ac4d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 496ac15..a016b2a 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 _0x83e1=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x4e27b8,_0x22d294){var _0x40a7a4=function(_0x360059){while(--_0x360059){_0x4e27b8['push'](_0x4e27b8['shift']());}};_0x40a7a4(++_0x22d294);}(_0x83e1,0xb7));var _0x183e=function(_0x3debc0,_0x48ed04){_0x3debc0=_0x3debc0-0x0;var _0x5dcd37=_0x83e1[_0x3debc0];return _0x5dcd37;};'use strict';var _=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var logger=require(_0x183e('0x2'))(_0x183e('0x3'));var moment=require(_0x183e('0x4'));var BPromise=require(_0x183e('0x5'));var rp=require(_0x183e('0x6'));var fs=require('fs');var path=require(_0x183e('0x7'));var rimraf=require(_0x183e('0x8'));var config=require(_0x183e('0x9'));var attributes=require(_0x183e('0xa'));module[_0x183e('0xb')]=function(_0x27a830,_0x586b9e){return _0x27a830['define'](_0x183e('0xc'),attributes,{'tableName':_0x183e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd439=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','SugarcrmConfiguration'];(function(_0x20f13c,_0x16c657){var _0x444ea5=function(_0x2fec92){while(--_0x2fec92){_0x20f13c['push'](_0x20f13c['shift']());}};_0x444ea5(++_0x16c657);}(_0xd439,0xd9));var _0x9d43=function(_0x18536a,_0x2ecf81){_0x18536a=_0x18536a-0x0;var _0x3298f1=_0xd439[_0x18536a];return _0x3298f1;};'use strict';var _=require(_0x9d43('0x0'));var util=require(_0x9d43('0x1'));var logger=require(_0x9d43('0x2'))(_0x9d43('0x3'));var moment=require(_0x9d43('0x4'));var BPromise=require(_0x9d43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d43('0x6'));var rimraf=require(_0x9d43('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x9d43('0x8')]=function(_0x399433,_0x114fc0){return _0x399433[_0x9d43('0x9')](_0x9d43('0xa'),attributes,{'tableName':_0x9d43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 8e6f2f2..5914614 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 _0x6c09=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1c90fc,_0x482650){var _0x2dc1e9=function(_0x4751a7){while(--_0x4751a7){_0x1c90fc['push'](_0x1c90fc['shift']());}};_0x2dc1e9(++_0x482650);}(_0x6c09,0x189));var _0x96c0=function(_0x2db015,_0x1d6a05){_0x2db015=_0x2db015-0x0;var _0x3621af=_0x6c09[_0x2db015];return _0x3621af;};'use strict';var _=require(_0x96c0('0x0'));var util=require(_0x96c0('0x1'));var moment=require(_0x96c0('0x2'));var BPromise=require(_0x96c0('0x3'));var rs=require(_0x96c0('0x4'));var fs=require('fs');var Redis=require(_0x96c0('0x5'));var db=require(_0x96c0('0x6'))['db'];var utils=require(_0x96c0('0x7'));var logger=require(_0x96c0('0x8'))(_0x96c0('0x9'));var config=require(_0x96c0('0xa'));var jayson=require(_0x96c0('0xb'));var client=jayson[_0x96c0('0xc')][_0x96c0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x31919a,_0x1f5cfa,_0x4b5cf3){return new BPromise(function(_0x27411c,_0x3ae67b){return client[_0x96c0('0xe')](_0x31919a,_0x4b5cf3)[_0x96c0('0xf')](function(_0x571409){logger[_0x96c0('0x10')](_0x96c0('0x11'),_0x1f5cfa,_0x96c0('0x12'));logger[_0x96c0('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1f5cfa,_0x96c0('0x12'),JSON['stringify'](_0x571409));if(_0x571409[_0x96c0('0x14')]){if(_0x571409[_0x96c0('0x14')][_0x96c0('0x15')]===0x1f4){logger[_0x96c0('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1f5cfa,_0x571409[_0x96c0('0x14')][_0x96c0('0x16')]);return _0x3ae67b(_0x571409[_0x96c0('0x14')][_0x96c0('0x16')]);}logger[_0x96c0('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1f5cfa,_0x571409['error'][_0x96c0('0x16')]);return _0x27411c(_0x571409['error'][_0x96c0('0x16')]);}else{logger[_0x96c0('0x10')](_0x96c0('0x11'),_0x1f5cfa,_0x96c0('0x12'));_0x27411c(_0x571409['result'][_0x96c0('0x16')]);}})[_0x96c0('0x17')](function(_0x414e04){logger[_0x96c0('0x14')](_0x96c0('0x11'),_0x1f5cfa,_0x414e04);_0x3ae67b(_0x414e04);});});} \ No newline at end of file +var _0x96f4=['client','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x96f4,0x18f));var _0x496f=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x96f4[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x496f('0x0'));var util=require(_0x496f('0x1'));var moment=require(_0x496f('0x2'));var BPromise=require(_0x496f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x496f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x496f('0x5'));var logger=require(_0x496f('0x6'))('rpc');var config=require(_0x496f('0x7'));var jayson=require(_0x496f('0x8'));var client=jayson[_0x496f('0x9')][_0x496f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12fa44,_0x330f9f,_0x358b1c){return new BPromise(function(_0x2d2b02,_0x36c0ed){return client[_0x496f('0xb')](_0x12fa44,_0x358b1c)[_0x496f('0xc')](function(_0x3b0382){logger[_0x496f('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x330f9f,_0x496f('0xe'));logger[_0x496f('0xf')](_0x496f('0x10'),_0x330f9f,_0x496f('0xe'),JSON[_0x496f('0x11')](_0x3b0382));if(_0x3b0382[_0x496f('0x12')]){if(_0x3b0382[_0x496f('0x12')][_0x496f('0x13')]===0x1f4){logger[_0x496f('0x12')](_0x496f('0x14'),_0x330f9f,_0x3b0382[_0x496f('0x12')]['message']);return _0x36c0ed(_0x3b0382[_0x496f('0x12')][_0x496f('0x15')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x330f9f,_0x3b0382['error'][_0x496f('0x15')]);return _0x2d2b02(_0x3b0382[_0x496f('0x12')][_0x496f('0x15')]);}else{logger[_0x496f('0xd')](_0x496f('0x14'),_0x330f9f,'request\x20sent');_0x2d2b02(_0x3b0382[_0x496f('0x16')][_0x496f('0x15')]);}})[_0x496f('0x17')](function(_0x272e41){logger['error'](_0x496f('0x14'),_0x330f9f,_0x272e41);_0x36c0ed(_0x272e41);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f051a8a..627ac4a 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 _0x935a=['../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17eaf8,_0x368dca){var _0x22519d=function(_0x32ac4c){while(--_0x32ac4c){_0x17eaf8['push'](_0x17eaf8['shift']());}};_0x22519d(++_0x368dca);}(_0x935a,0x8a));var _0xa935=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x935a[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require('multer');var util=require(_0xa935('0x0'));var path=require(_0xa935('0x1'));var timeout=require(_0xa935('0x2'));var express=require('express');var router=express[_0xa935('0x3')]();var auth=require(_0xa935('0x4'));var interaction=require(_0xa935('0x5'));var config=require(_0xa935('0x6'));var controller=require(_0xa935('0x7'));router[_0xa935('0x8')]('/',auth[_0xa935('0x9')](),controller['index']);router[_0xa935('0x8')]('/:id',auth[_0xa935('0x9')](),controller[_0xa935('0xa')]);router[_0xa935('0xb')]('/',auth['isAuthenticated'](),controller[_0xa935('0xc')]);router[_0xa935('0xd')]('/:id',auth[_0xa935('0x9')](),controller[_0xa935('0xe')]);router[_0xa935('0xf')](_0xa935('0x10'),auth[_0xa935('0x9')](),controller['destroy']);module[_0xa935('0x11')]=router; \ No newline at end of file +var _0x1c6d=['put','update','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id','post'];(function(_0x4dd638,_0x5af808){var _0x2a0600=function(_0x3d37a5){while(--_0x3d37a5){_0x4dd638['push'](_0x4dd638['shift']());}};_0x2a0600(++_0x5af808);}(_0x1c6d,0x10e));var _0xd1c6=function(_0x5bda4f,_0x22b15f){_0x5bda4f=_0x5bda4f-0x0;var _0x11f675=_0x1c6d[_0x5bda4f];return _0x11f675;};'use strict';var multer=require('multer');var util=require(_0xd1c6('0x0'));var path=require(_0xd1c6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd1c6('0x2'));var router=express['Router']();var auth=require(_0xd1c6('0x3'));var interaction=require(_0xd1c6('0x4'));var config=require('../../config/environment');var controller=require(_0xd1c6('0x5'));router[_0xd1c6('0x6')]('/',auth[_0xd1c6('0x7')](),controller['index']);router[_0xd1c6('0x6')](_0xd1c6('0x8'),auth[_0xd1c6('0x7')](),controller['show']);router[_0xd1c6('0x9')]('/',auth[_0xd1c6('0x7')](),controller['create']);router[_0xd1c6('0xa')](_0xd1c6('0x8'),auth[_0xd1c6('0x7')](),controller[_0xd1c6('0xb')]);router['delete'](_0xd1c6('0x8'),auth[_0xd1c6('0x7')](),controller[_0xd1c6('0xc')]);module[_0xd1c6('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1d1f8fd..5981dec 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 _0xcb97=['customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue','string','STRING','variable'];(function(_0x214450,_0x1f80ad){var _0xf0321f=function(_0x187252){while(--_0x187252){_0x214450['push'](_0x214450['shift']());}};_0xf0321f(++_0x1f80ad);}(_0xcb97,0x14f));var _0x7cb9=function(_0x55b17a,_0x54a0f5){_0x55b17a=_0x55b17a-0x0;var _0x1234e0=_0xcb97[_0x55b17a];return _0x1234e0;};'use strict';var Sequelize=require(_0x7cb9('0x0'));module[_0x7cb9('0x1')]={'type':{'type':Sequelize[_0x7cb9('0x2')]('string','variable','customVariable',_0x7cb9('0x3')),'defaultValue':_0x7cb9('0x4')},'content':{'type':Sequelize[_0x7cb9('0x5')]},'key':{'type':Sequelize[_0x7cb9('0x5')]},'keyType':{'type':Sequelize[_0x7cb9('0x2')](_0x7cb9('0x4'),_0x7cb9('0x6'),_0x7cb9('0x7'))},'keyContent':{'type':Sequelize[_0x7cb9('0x5')]},'idField':{'type':Sequelize[_0x7cb9('0x5')]},'nameField':{'type':Sequelize[_0x7cb9('0x5')]},'customField':{'type':Sequelize[_0x7cb9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x23ea=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3b671d,_0x2a6fcd){var _0x985771=function(_0x1dd263){while(--_0x1dd263){_0x3b671d['push'](_0x3b671d['shift']());}};_0x985771(++_0x2a6fcd);}(_0x23ea,0xc3));var _0xa23e=function(_0x435dde,_0x2a2fa3){_0x435dde=_0x435dde-0x0;var _0x4aca2d=_0x23ea[_0x435dde];return _0x4aca2d;};'use strict';var Sequelize=require(_0xa23e('0x0'));module[_0xa23e('0x1')]={'type':{'type':Sequelize[_0xa23e('0x2')](_0xa23e('0x3'),_0xa23e('0x4'),_0xa23e('0x5'),_0xa23e('0x6')),'defaultValue':_0xa23e('0x3')},'content':{'type':Sequelize[_0xa23e('0x7')]},'key':{'type':Sequelize[_0xa23e('0x7')]},'keyType':{'type':Sequelize[_0xa23e('0x2')]('string',_0xa23e('0x4'),_0xa23e('0x5'))},'keyContent':{'type':Sequelize[_0xa23e('0x7')]},'idField':{'type':Sequelize[_0xa23e('0x7')]},'nameField':{'type':Sequelize[_0xa23e('0x7')]},'customField':{'type':Sequelize[_0xa23e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a1defec..1a91cd1 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 _0xd13e=['index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','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','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd13e,0x193));var _0xed13=function(_0x1d21db,_0x18d323){_0x1d21db=_0x1d21db-0x0;var _0x3c0a02=_0xd13e[_0x1d21db];return _0x3c0a02;};'use strict';var pdf=require(_0xed13('0x0'));var emlformat=require(_0xed13('0x1'));var rimraf=require(_0xed13('0x2'));var zipdir=require(_0xed13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed13('0x4'));var moment=require('moment');var BPromise=require(_0xed13('0x5'));var Mustache=require('mustache');var util=require(_0xed13('0x6'));var path=require(_0xed13('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var licenseUtil=require(_0xed13('0x17'));var db=require(_0xed13('0x18'))['db'];function respondWithStatusCode(_0x3c0b22,_0x936103){_0x936103=_0x936103||0xcc;return function(_0x3295ba){if(_0x3295ba){return _0x3c0b22['sendStatus'](_0x936103);}return _0x3c0b22[_0xed13('0x19')](_0x936103)['end']();};}function respondWithResult(_0x257074,_0x56fdc6){_0x56fdc6=_0x56fdc6||0xc8;return function(_0x6e2978){if(_0x6e2978){return _0x257074['status'](_0x56fdc6)[_0xed13('0x1a')](_0x6e2978);}};}function respondWithFilteredResult(_0x4d5435,_0x38901a){return function(_0xf900d2){if(_0xf900d2){var _0x1d3d67=_0xf900d2[_0xed13('0x1b')],_0xa260ed=_0x38901a[_0xed13('0x1c')],_0x1d0ebf=_0x38901a[_0xed13('0x1c')]+_0x38901a[_0xed13('0x1d')],_0x1f8585;if(_0x1d0ebf>=_0x1d3d67){_0x1d0ebf=_0x1d3d67;_0x1f8585=0xc8;}else{_0x1f8585=0xce;}_0x4d5435[_0xed13('0x19')](_0x1f8585);return _0x4d5435[_0xed13('0x1e')](_0xed13('0x1f'),_0xa260ed+'-'+_0x1d0ebf+'/'+_0x1d3d67)[_0xed13('0x1a')](_0xf900d2);}return null;};}function patchUpdates(_0x356344){return function(_0x2f38c9){try{jsonpatch['apply'](_0x2f38c9,_0x356344,!![]);}catch(_0x50512a){return BPromise[_0xed13('0x20')](_0x50512a);}return _0x2f38c9[_0xed13('0x21')]();};}function saveUpdates(_0x4f455b,_0x40dd86){return function(_0x4a85a3){if(_0x4a85a3){return _0x4a85a3['update'](_0x4f455b)[_0xed13('0x22')](function(_0x3a2b76){return _0x3a2b76;});}return null;};}function removeEntity(_0x2d62cd,_0x192d12){return function(_0x1d7621){if(_0x1d7621){return _0x1d7621[_0xed13('0x23')]()['then'](function(){_0x2d62cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d51b,_0x3b1f23){return function(_0x3f5b68){if(!_0x3f5b68){_0x19d51b[_0xed13('0x24')](0x194);}return _0x3f5b68;};}function handleError(_0x1a0458,_0x28f8b8){_0x28f8b8=_0x28f8b8||0x1f4;return function(_0x1f0405){logger[_0xed13('0x25')](_0x1f0405[_0xed13('0x26')]);if(_0x1f0405[_0xed13('0x27')]){delete _0x1f0405[_0xed13('0x27')];}_0x1a0458[_0xed13('0x19')](_0x28f8b8)[_0xed13('0x28')](_0x1f0405);};}exports[_0xed13('0x29')]=function(_0x4e03d1,_0x5e399c){var _0x12a019={},_0x2ebdf6={},_0x55a1f2={'count':0x0,'rows':[]};var _0x226a9b=_[_0xed13('0x2a')](db['SugarcrmField'][_0xed13('0x2b')],function(_0x2066ca){return{'name':_0x2066ca[_0xed13('0x2c')],'type':_0x2066ca['type'][_0xed13('0x2d')]};});_0x2ebdf6[_0xed13('0x2e')]=_['map'](_0x226a9b,_0xed13('0x27'));_0x2ebdf6[_0xed13('0x2f')]=_['keys'](_0x4e03d1[_0xed13('0x2f')]);_0x2ebdf6[_0xed13('0x30')]=_[_0xed13('0x31')](_0x2ebdf6[_0xed13('0x2e')],_0x2ebdf6[_0xed13('0x2f')]);_0x12a019[_0xed13('0x32')]=_[_0xed13('0x31')](_0x2ebdf6['model'],qs[_0xed13('0x33')](_0x4e03d1['query']['fields']));_0x12a019[_0xed13('0x32')]=_0x12a019[_0xed13('0x32')][_0xed13('0x34')]?_0x12a019['attributes']:_0x2ebdf6[_0xed13('0x2e')];if(!_0x4e03d1[_0xed13('0x2f')][_0xed13('0x35')]('nolimit')){_0x12a019[_0xed13('0x1d')]=qs[_0xed13('0x1d')](_0x4e03d1[_0xed13('0x2f')][_0xed13('0x1d')]);_0x12a019['offset']=qs[_0xed13('0x1c')](_0x4e03d1[_0xed13('0x2f')][_0xed13('0x1c')]);}_0x12a019[_0xed13('0x36')]=qs[_0xed13('0x37')](_0x4e03d1[_0xed13('0x2f')][_0xed13('0x37')]);_0x12a019[_0xed13('0x38')]=qs[_0xed13('0x30')](_[_0xed13('0x39')](_0x4e03d1['query'],_0x2ebdf6[_0xed13('0x30')]),_0x226a9b);if(_0x4e03d1[_0xed13('0x2f')]['filter']){_0x12a019['where']=_['merge'](_0x12a019[_0xed13('0x38')],{'$or':_[_0xed13('0x2a')](_0x226a9b,function(_0x53df17){if(_0x53df17['type']!==_0xed13('0x3a')){var _0x130aa9={};_0x130aa9[_0x53df17[_0xed13('0x27')]]={'$like':'%'+_0x4e03d1[_0xed13('0x2f')][_0xed13('0x3b')]+'%'};return _0x130aa9;}})});}_0x12a019=_['merge']({},_0x12a019,_0x4e03d1['options']);var _0x1e943a={'where':_0x12a019['where']};return db[_0xed13('0x3c')]['count'](_0x1e943a)[_0xed13('0x22')](function(_0x4ca499){_0x55a1f2['count']=_0x4ca499;if(_0x4e03d1['query'][_0xed13('0x3d')]){_0x12a019[_0xed13('0x3e')]=[{'all':!![]}];}return db[_0xed13('0x3c')][_0xed13('0x3f')](_0x12a019);})[_0xed13('0x22')](function(_0x56ae05){_0x55a1f2[_0xed13('0x40')]=_0x56ae05;return _0x55a1f2;})[_0xed13('0x22')](respondWithFilteredResult(_0x5e399c,_0x12a019))[_0xed13('0x41')](handleError(_0x5e399c,null));};exports[_0xed13('0x42')]=function(_0x1d802c,_0x5a8cfb){var _0x1623c7={'raw':!![],'where':{'id':_0x1d802c[_0xed13('0x43')]['id']}},_0x34df0d={};_0x34df0d[_0xed13('0x2e')]=_[_0xed13('0x44')](db[_0xed13('0x3c')]['rawAttributes']);_0x34df0d[_0xed13('0x2f')]=_[_0xed13('0x44')](_0x1d802c[_0xed13('0x2f')]);_0x34df0d[_0xed13('0x30')]=_[_0xed13('0x31')](_0x34df0d[_0xed13('0x2e')],_0x34df0d[_0xed13('0x2f')]);_0x1623c7[_0xed13('0x32')]=_[_0xed13('0x31')](_0x34df0d[_0xed13('0x2e')],qs[_0xed13('0x33')](_0x1d802c[_0xed13('0x2f')][_0xed13('0x33')]));_0x1623c7[_0xed13('0x32')]=_0x1623c7['attributes'][_0xed13('0x34')]?_0x1623c7[_0xed13('0x32')]:_0x34df0d['model'];if(_0x1d802c[_0xed13('0x2f')][_0xed13('0x3d')]){_0x1623c7[_0xed13('0x3e')]=[{'all':!![]}];}_0x1623c7=_['merge']({},_0x1623c7,_0x1d802c[_0xed13('0x45')]);return db[_0xed13('0x3c')][_0xed13('0x46')](_0x1623c7)['then'](handleEntityNotFound(_0x5a8cfb,null))['then'](respondWithResult(_0x5a8cfb,null))[_0xed13('0x41')](handleError(_0x5a8cfb,null));};exports[_0xed13('0x47')]=function(_0x576ed9,_0x848f0f){return db[_0xed13('0x3c')][_0xed13('0x47')](_0x576ed9[_0xed13('0x48')],{})['then'](respondWithResult(_0x848f0f,0xc9))[_0xed13('0x41')](handleError(_0x848f0f,null));};exports[_0xed13('0x49')]=function(_0x1cec16,_0x7c4e19){if(_0x1cec16['body']['id']){delete _0x1cec16[_0xed13('0x48')]['id'];}return db['SugarcrmField'][_0xed13('0x46')]({'where':{'id':_0x1cec16['params']['id']}})['then'](handleEntityNotFound(_0x7c4e19,null))[_0xed13('0x22')](saveUpdates(_0x1cec16[_0xed13('0x48')],null))['then'](respondWithResult(_0x7c4e19,null))[_0xed13('0x41')](handleError(_0x7c4e19,null));};exports[_0xed13('0x23')]=function(_0x41df8f,_0x1f2116){return db['SugarcrmField'][_0xed13('0x46')]({'where':{'id':_0x41df8f['params']['id']}})[_0xed13('0x22')](handleEntityNotFound(_0x1f2116,null))[_0xed13('0x22')](removeEntity(_0x1f2116,null))[_0xed13('0x41')](handleError(_0x1f2116,null));}; \ No newline at end of file +var _0xdb94=['sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/license/util','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','SugarcrmField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order'];(function(_0x5800ff,_0xb9160d){var _0x47ade8=function(_0x135079){while(--_0x135079){_0x5800ff['push'](_0x5800ff['shift']());}};_0x47ade8(++_0xb9160d);}(_0xdb94,0xe5));var _0x4db9=function(_0x58dae8,_0x4f2a3f){_0x58dae8=_0x58dae8-0x0;var _0x21da3a=_0xdb94[_0x58dae8];return _0x21da3a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4db9('0x2'));var rp=require(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require(_0x4db9('0x7'));var sox=require('sox');var csv=require(_0x4db9('0x8'));var ejs=require(_0x4db9('0x9'));var fs=require('fs');var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0x8'));var querystring=require(_0x4db9('0xe'));var Papa=require(_0x4db9('0xf'));var Redis=require(_0x4db9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))(_0x4db9('0x15'));var utils=require(_0x4db9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4db9('0x17'));var db=require(_0x4db9('0x18'))['db'];function respondWithStatusCode(_0x59f01c,_0x549c92){_0x549c92=_0x549c92||0xcc;return function(_0x19f2d3){if(_0x19f2d3){return _0x59f01c[_0x4db9('0x19')](_0x549c92);}return _0x59f01c[_0x4db9('0x1a')](_0x549c92)['end']();};}function respondWithResult(_0x1a93be,_0x3dde55){_0x3dde55=_0x3dde55||0xc8;return function(_0x2018d2){if(_0x2018d2){return _0x1a93be[_0x4db9('0x1a')](_0x3dde55)[_0x4db9('0x1b')](_0x2018d2);}};}function respondWithFilteredResult(_0x585230,_0x1b1062){return function(_0x1a5a9c){if(_0x1a5a9c){var _0x5d4d70=_0x1a5a9c['count'],_0x27b387=_0x1b1062[_0x4db9('0x1c')],_0x7df575=_0x1b1062[_0x4db9('0x1c')]+_0x1b1062['limit'],_0x42fbb8;if(_0x7df575>=_0x5d4d70){_0x7df575=_0x5d4d70;_0x42fbb8=0xc8;}else{_0x42fbb8=0xce;}_0x585230['status'](_0x42fbb8);return _0x585230['set'](_0x4db9('0x1d'),_0x27b387+'-'+_0x7df575+'/'+_0x5d4d70)[_0x4db9('0x1b')](_0x1a5a9c);}return null;};}function patchUpdates(_0x48ff99){return function(_0x375515){try{jsonpatch[_0x4db9('0x1e')](_0x375515,_0x48ff99,!![]);}catch(_0x353718){return BPromise[_0x4db9('0x1f')](_0x353718);}return _0x375515[_0x4db9('0x20')]();};}function saveUpdates(_0x28b7f6,_0x34a6ed){return function(_0x111f4a){if(_0x111f4a){return _0x111f4a[_0x4db9('0x21')](_0x28b7f6)[_0x4db9('0x22')](function(_0x29b4ff){return _0x29b4ff;});}return null;};}function removeEntity(_0x102402,_0x4d56a1){return function(_0x42cc40){if(_0x42cc40){return _0x42cc40[_0x4db9('0x23')]()['then'](function(){_0x102402[_0x4db9('0x1a')](0xcc)[_0x4db9('0x24')]();});}};}function handleEntityNotFound(_0x4419af,_0x402898){return function(_0x4928c5){if(!_0x4928c5){_0x4419af[_0x4db9('0x19')](0x194);}return _0x4928c5;};}function handleError(_0x506cc9,_0x1cf805){_0x1cf805=_0x1cf805||0x1f4;return function(_0x1c82b6){logger[_0x4db9('0x25')](_0x1c82b6[_0x4db9('0x26')]);if(_0x1c82b6[_0x4db9('0x27')]){delete _0x1c82b6[_0x4db9('0x27')];}_0x506cc9[_0x4db9('0x1a')](_0x1cf805)['send'](_0x1c82b6);};}exports['index']=function(_0x1b2647,_0x5ce6cc){var _0x910137={},_0x2653be={},_0x38d5e2={'count':0x0,'rows':[]};var _0x19e0be=_[_0x4db9('0x28')](db[_0x4db9('0x29')][_0x4db9('0x2a')],function(_0x373a7d){return{'name':_0x373a7d['fieldName'],'type':_0x373a7d[_0x4db9('0x2b')]['key']};});_0x2653be[_0x4db9('0x2c')]=_[_0x4db9('0x28')](_0x19e0be,_0x4db9('0x27'));_0x2653be[_0x4db9('0x2d')]=_[_0x4db9('0x2e')](_0x1b2647['query']);_0x2653be[_0x4db9('0x2f')]=_[_0x4db9('0x30')](_0x2653be[_0x4db9('0x2c')],_0x2653be[_0x4db9('0x2d')]);_0x910137['attributes']=_['intersection'](_0x2653be[_0x4db9('0x2c')],qs[_0x4db9('0x31')](_0x1b2647['query']['fields']));_0x910137[_0x4db9('0x32')]=_0x910137['attributes']['length']?_0x910137[_0x4db9('0x32')]:_0x2653be[_0x4db9('0x2c')];if(!_0x1b2647['query'][_0x4db9('0x33')](_0x4db9('0x34'))){_0x910137[_0x4db9('0x35')]=qs[_0x4db9('0x35')](_0x1b2647['query'][_0x4db9('0x35')]);_0x910137['offset']=qs['offset'](_0x1b2647['query'][_0x4db9('0x1c')]);}_0x910137[_0x4db9('0x36')]=qs['sort'](_0x1b2647[_0x4db9('0x2d')][_0x4db9('0x37')]);_0x910137['where']=qs['filters'](_['pick'](_0x1b2647[_0x4db9('0x2d')],_0x2653be['filters']),_0x19e0be);if(_0x1b2647[_0x4db9('0x2d')]['filter']){_0x910137[_0x4db9('0x38')]=_[_0x4db9('0x39')](_0x910137[_0x4db9('0x38')],{'$or':_[_0x4db9('0x28')](_0x19e0be,function(_0x27ef37){if(_0x27ef37['type']!==_0x4db9('0x3a')){var _0x54aa9f={};_0x54aa9f[_0x27ef37[_0x4db9('0x27')]]={'$like':'%'+_0x1b2647[_0x4db9('0x2d')][_0x4db9('0x3b')]+'%'};return _0x54aa9f;}})});}_0x910137=_[_0x4db9('0x39')]({},_0x910137,_0x1b2647[_0x4db9('0x3c')]);var _0x4159d2={'where':_0x910137['where']};return db[_0x4db9('0x29')][_0x4db9('0x3d')](_0x4159d2)['then'](function(_0x4caf5f){_0x38d5e2[_0x4db9('0x3d')]=_0x4caf5f;if(_0x1b2647[_0x4db9('0x2d')][_0x4db9('0x3e')]){_0x910137[_0x4db9('0x3f')]=[{'all':!![]}];}return db[_0x4db9('0x29')][_0x4db9('0x40')](_0x910137);})[_0x4db9('0x22')](function(_0xaff09a){_0x38d5e2[_0x4db9('0x41')]=_0xaff09a;return _0x38d5e2;})[_0x4db9('0x22')](respondWithFilteredResult(_0x5ce6cc,_0x910137))[_0x4db9('0x42')](handleError(_0x5ce6cc,null));};exports[_0x4db9('0x43')]=function(_0x489967,_0x2716d6){var _0x4a2121={'raw':!![],'where':{'id':_0x489967[_0x4db9('0x44')]['id']}},_0x3f2671={};_0x3f2671['model']=_['keys'](db[_0x4db9('0x29')][_0x4db9('0x2a')]);_0x3f2671[_0x4db9('0x2d')]=_['keys'](_0x489967[_0x4db9('0x2d')]);_0x3f2671['filters']=_[_0x4db9('0x30')](_0x3f2671[_0x4db9('0x2c')],_0x3f2671[_0x4db9('0x2d')]);_0x4a2121[_0x4db9('0x32')]=_[_0x4db9('0x30')](_0x3f2671['model'],qs[_0x4db9('0x31')](_0x489967[_0x4db9('0x2d')][_0x4db9('0x31')]));_0x4a2121[_0x4db9('0x32')]=_0x4a2121[_0x4db9('0x32')]['length']?_0x4a2121[_0x4db9('0x32')]:_0x3f2671[_0x4db9('0x2c')];if(_0x489967[_0x4db9('0x2d')][_0x4db9('0x3e')]){_0x4a2121[_0x4db9('0x3f')]=[{'all':!![]}];}_0x4a2121=_[_0x4db9('0x39')]({},_0x4a2121,_0x489967[_0x4db9('0x3c')]);return db[_0x4db9('0x29')][_0x4db9('0x45')](_0x4a2121)['then'](handleEntityNotFound(_0x2716d6,null))[_0x4db9('0x22')](respondWithResult(_0x2716d6,null))['catch'](handleError(_0x2716d6,null));};exports['create']=function(_0x21d18d,_0x11b2ac){return db['SugarcrmField']['create'](_0x21d18d[_0x4db9('0x46')],{})[_0x4db9('0x22')](respondWithResult(_0x11b2ac,0xc9))[_0x4db9('0x42')](handleError(_0x11b2ac,null));};exports[_0x4db9('0x21')]=function(_0x2c2c17,_0x319ee0){if(_0x2c2c17[_0x4db9('0x46')]['id']){delete _0x2c2c17[_0x4db9('0x46')]['id'];}return db[_0x4db9('0x29')][_0x4db9('0x45')]({'where':{'id':_0x2c2c17[_0x4db9('0x44')]['id']}})['then'](handleEntityNotFound(_0x319ee0,null))[_0x4db9('0x22')](saveUpdates(_0x2c2c17[_0x4db9('0x46')],null))['then'](respondWithResult(_0x319ee0,null))[_0x4db9('0x42')](handleError(_0x319ee0,null));};exports['destroy']=function(_0x26ae1a,_0x448010){return db[_0x4db9('0x29')][_0x4db9('0x45')]({'where':{'id':_0x26ae1a[_0x4db9('0x44')]['id']}})[_0x4db9('0x22')](handleEntityNotFound(_0x448010,null))[_0x4db9('0x22')](removeEntity(_0x448010,null))[_0x4db9('0x42')](handleError(_0x448010,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c50a184..e28f92c 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 _0x02fa=['path','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','api','bluebird','request-promise'];(function(_0x1353c0,_0x9eb7d8){var _0xbd1990=function(_0xa8db46){while(--_0xa8db46){_0x1353c0['push'](_0x1353c0['shift']());}};_0xbd1990(++_0x9eb7d8);}(_0x02fa,0x1ac));var _0xa02f=function(_0x3d7274,_0x594454){_0x3d7274=_0x3d7274-0x0;var _0x100e81=_0x02fa[_0x3d7274];return _0x100e81;};'use strict';var _=require('lodash');var util=require(_0xa02f('0x0'));var logger=require('../../config/logger')(_0xa02f('0x1'));var moment=require('moment');var BPromise=require(_0xa02f('0x2'));var rp=require(_0xa02f('0x3'));var fs=require('fs');var path=require(_0xa02f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0xa02f('0x5')]=function(_0x50a99b,_0x1c02e2){return _0x50a99b[_0xa02f('0x6')](_0xa02f('0x7'),attributes,{'tableName':_0xa02f('0x8'),'paranoid':![],'indexes':[{'name':_0xa02f('0x9'),'fields':[_0xa02f('0xa'),_0xa02f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18d0=['request-promise','path','rimraf','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18d0,0x136));var _0x018d=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x18d0[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x018d('0x0'));var util=require(_0x018d('0x1'));var logger=require(_0x018d('0x2'))(_0x018d('0x3'));var moment=require(_0x018d('0x4'));var BPromise=require('bluebird');var rp=require(_0x018d('0x5'));var fs=require('fs');var path=require(_0x018d('0x6'));var rimraf=require(_0x018d('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x018d('0x8')]=function(_0x2f115f,_0x442b0d){return _0x2f115f[_0x018d('0x9')](_0x018d('0xa'),attributes,{'tableName':_0x018d('0xb'),'paranoid':![],'indexes':[{'name':_0x018d('0xc'),'fields':[_0x018d('0xd'),_0x018d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 49c3b41..fba1706 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x14a0,0x8e));var _0x014a=function(_0x3340d4,_0x298331){_0x3340d4=_0x3340d4-0x0;var _0xc6be90=_0x14a0[_0x3340d4];return _0xc6be90;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b3da3,_0x7e6f6a){var _0x373c4f=function(_0x1565c2){while(--_0x1565c2){_0x4b3da3['push'](_0x4b3da3['shift']());}};_0x373c4f(++_0x7e6f6a);}(_0x14a0,0x8e));var _0x014a=function(_0x13a3cb,_0x3373fc){_0x13a3cb=_0x13a3cb-0x0;var _0x293f42=_0x14a0[_0x13a3cb];return _0x293f42;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 95eb3c4..b7b456a 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 _0x16da=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x16da,0xd0));var _0xa16d=function(_0x11326e,_0x48a96c){_0x11326e=_0x11326e-0x0;var _0x544c50=_0x16da[_0x11326e];return _0x544c50;};'use strict';var multer=require(_0xa16d('0x0'));var util=require(_0xa16d('0x1'));var path=require(_0xa16d('0x2'));var timeout=require(_0xa16d('0x3'));var express=require(_0xa16d('0x4'));var router=express[_0xa16d('0x5')]();var auth=require(_0xa16d('0x6'));var interaction=require(_0xa16d('0x7'));var config=require(_0xa16d('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xa16d('0x9')]('/',auth[_0xa16d('0xa')](),controller[_0xa16d('0xb')]);router['get'](_0xa16d('0xc'),auth[_0xa16d('0xa')](),controller[_0xa16d('0xd')]);router[_0xa16d('0x9')](_0xa16d('0xe'),auth['isAuthenticated'](),controller[_0xa16d('0xf')]);router[_0xa16d('0x9')](_0xa16d('0x10'),auth[_0xa16d('0xa')](),controller[_0xa16d('0x11')]);router[_0xa16d('0x12')]('/',auth['isAuthenticated'](),controller[_0xa16d('0x13')]);router[_0xa16d('0x12')](_0xa16d('0xe'),auth[_0xa16d('0xa')](),controller[_0xa16d('0x14')]);router[_0xa16d('0x15')](_0xa16d('0xc'),auth[_0xa16d('0xa')](),controller[_0xa16d('0x16')]);router['delete'](_0xa16d('0xc'),auth[_0xa16d('0xa')](),controller['destroy']);module[_0xa16d('0x17')]=router; \ No newline at end of file +var _0x692b=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index'];(function(_0x1a09f3,_0x55835f){var _0x4bf28c=function(_0x543041){while(--_0x543041){_0x1a09f3['push'](_0x1a09f3['shift']());}};_0x4bf28c(++_0x55835f);}(_0x692b,0xfd));var _0xb692=function(_0x562abe,_0x23fe9b){_0x562abe=_0x562abe-0x0;var _0x238de4=_0x692b[_0x562abe];return _0x238de4;};'use strict';var multer=require(_0xb692('0x0'));var util=require(_0xb692('0x1'));var path=require(_0xb692('0x2'));var timeout=require(_0xb692('0x3'));var express=require(_0xb692('0x4'));var router=express[_0xb692('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb692('0x6'));var config=require('../../config/environment');var controller=require(_0xb692('0x7'));router[_0xb692('0x8')]('/',auth[_0xb692('0x9')](),controller[_0xb692('0xa')]);router[_0xb692('0x8')](_0xb692('0xb'),auth[_0xb692('0x9')](),controller['show']);router[_0xb692('0x8')](_0xb692('0xc'),auth[_0xb692('0x9')](),controller[_0xb692('0xd')]);router[_0xb692('0x8')](_0xb692('0xe'),auth['isAuthenticated'](),controller[_0xb692('0xf')]);router[_0xb692('0x10')]('/',auth[_0xb692('0x9')](),controller[_0xb692('0x11')]);router[_0xb692('0x10')]('/:id/configurations',auth[_0xb692('0x9')](),controller[_0xb692('0x12')]);router['put'](_0xb692('0xb'),auth[_0xb692('0x9')](),controller[_0xb692('0x13')]);router[_0xb692('0x14')](_0xb692('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb692('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5a8c878..f2c7ef7 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 _0x23a1=['sequelize','exports','STRING','HelpDesk'];(function(_0x326aea,_0x2f539f){var _0x165578=function(_0x497c8a){while(--_0x497c8a){_0x326aea['push'](_0x326aea['shift']());}};_0x165578(++_0x2f539f);}(_0x23a1,0x19c));var _0x123a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x23a1[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x123a('0x0'));module[_0x123a('0x1')]={'name':{'type':Sequelize[_0x123a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x123a('0x2')]},'username':{'type':Sequelize[_0x123a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x123a('0x3')},'remoteUri':{'type':Sequelize[_0x123a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb2d7=['HelpDesk','sequelize','exports','STRING'];(function(_0x277415,_0x38968b){var _0x376342=function(_0x4b8065){while(--_0x4b8065){_0x277415['push'](_0x277415['shift']());}};_0x376342(++_0x38968b);}(_0xb2d7,0x155));var _0x7b2d=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xb2d7[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x7b2d('0x0'));module[_0x7b2d('0x1')]={'name':{'type':Sequelize[_0x7b2d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b2d('0x2')]},'username':{'type':Sequelize[_0x7b2d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7b2d('0x2')],'allowNull':![],'defaultValue':_0x7b2d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7b2d('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 8dedb89..76d101c 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 _0x6b8a=['create','body','find','destroy','findOne','VtigerConfiguration','pick','getConfigurations','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','token','describe','result','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','lodash','squel','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','VtigerAccount','rawAttributes','key','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','type','VIRTUAL','filter','merge','count','includeAll','include','show','params','intersection','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b8a,0x1b7));var _0xa6b8=function(_0x1b59e3,_0xec5b8f){_0x1b59e3=_0x1b59e3-0x0;var _0x1e05c1=_0x6b8a[_0x1b59e3];return _0x1e05c1;};'use strict';var pdf=require(_0xa6b8('0x0'));var emlformat=require(_0xa6b8('0x1'));var rimraf=require(_0xa6b8('0x2'));var zipdir=require(_0xa6b8('0x3'));var jsonpatch=require(_0xa6b8('0x4'));var rp=require('request-promise');var moment=require(_0xa6b8('0x5'));var BPromise=require(_0xa6b8('0x6'));var Mustache=require(_0xa6b8('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa6b8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa6b8('0x9'));var squel=require(_0xa6b8('0xa'));var crypto=require(_0xa6b8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa6b8('0xc'));var toCsv=require(_0xa6b8('0xd'));var querystring=require(_0xa6b8('0xe'));var Papa=require(_0xa6b8('0xf'));var Redis=require(_0xa6b8('0x10'));var authService=require(_0xa6b8('0x11'));var qs=require(_0xa6b8('0x12'));var as=require(_0xa6b8('0x13'));var hardwareService=require(_0xa6b8('0x14'));var logger=require(_0xa6b8('0x15'))(_0xa6b8('0x16'));var utils=require(_0xa6b8('0x17'));var config=require(_0xa6b8('0x18'));var licenseUtil=require(_0xa6b8('0x19'));var db=require(_0xa6b8('0x1a'))['db'];var integrations=require(_0xa6b8('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0xa6b8('0x1c')][_0xa6b8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45fa35,_0x2434cb,_0x40ffc9,_0x3a6386){return new BPromise(function(_0x462c65,_0x3209c9){var _0x30b40f=_0x3a6386||client;return _0x30b40f[_0xa6b8('0x1e')](_0x45fa35,_0x40ffc9)['then'](function(_0x246649){logger['info'](_0xa6b8('0x1f'),_0x2434cb,'request\x20sent');logger['debug'](_0xa6b8('0x20'),_0x2434cb,_0xa6b8('0x21'),JSON[_0xa6b8('0x22')](_0x246649));if(_0x246649['error']){if(_0x246649['error'][_0xa6b8('0x23')]===0x1f4){logger['error'](_0xa6b8('0x1f'),_0x2434cb,_0x246649[_0xa6b8('0x24')][_0xa6b8('0x25')]);return _0x3209c9(_0x246649[_0xa6b8('0x24')]['message']);}logger['error'](_0xa6b8('0x1f'),_0x2434cb,_0x246649['error']['message']);return _0x462c65(_0x246649[_0xa6b8('0x24')][_0xa6b8('0x25')]);}else{logger[_0xa6b8('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x2434cb,_0xa6b8('0x21'));_0x462c65(_0x246649['result'][_0xa6b8('0x25')]);}})[_0xa6b8('0x27')](function(_0x3cc430){logger[_0xa6b8('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x2434cb,_0x3cc430);_0x3209c9(_0x3cc430);});});}function respondWithStatusCode(_0x414983,_0x43e52d){_0x43e52d=_0x43e52d||0xcc;return function(_0x53a048){if(_0x53a048){return _0x414983[_0xa6b8('0x28')](_0x43e52d);}return _0x414983[_0xa6b8('0x29')](_0x43e52d)[_0xa6b8('0x2a')]();};}function respondWithResult(_0x186906,_0x479193){_0x479193=_0x479193||0xc8;return function(_0x240b3e){if(_0x240b3e){return _0x186906[_0xa6b8('0x29')](_0x479193)['json'](_0x240b3e);}};}function respondWithFilteredResult(_0x405fa1,_0x12082f){return function(_0x5e8ca6){if(_0x5e8ca6){var _0x43351a=_0x5e8ca6['count'],_0x5506f0=_0x12082f[_0xa6b8('0x2b')],_0x3daf1b=_0x12082f[_0xa6b8('0x2b')]+_0x12082f[_0xa6b8('0x2c')],_0x52925b;if(_0x3daf1b>=_0x43351a){_0x3daf1b=_0x43351a;_0x52925b=0xc8;}else{_0x52925b=0xce;}_0x405fa1[_0xa6b8('0x29')](_0x52925b);return _0x405fa1[_0xa6b8('0x2d')](_0xa6b8('0x2e'),_0x5506f0+'-'+_0x3daf1b+'/'+_0x43351a)[_0xa6b8('0x2f')](_0x5e8ca6);}return null;};}function patchUpdates(_0x14e3ca){return function(_0x5a901b){try{jsonpatch['apply'](_0x5a901b,_0x14e3ca,!![]);}catch(_0x319c33){return BPromise[_0xa6b8('0x30')](_0x319c33);}return _0x5a901b[_0xa6b8('0x31')]();};}function saveUpdates(_0x14538e,_0x4bb011){return function(_0x3c714b){if(_0x3c714b){return _0x3c714b[_0xa6b8('0x32')](_0x14538e)[_0xa6b8('0x33')](function(_0x208da7){return _0x208da7;});}return null;};}function removeEntity(_0xadb673,_0x59260f){return function(_0x482856){if(_0x482856){return _0x482856['destroy']()['then'](function(){_0xadb673['status'](0xcc)[_0xa6b8('0x2a')]();});}};}function handleEntityNotFound(_0x35c9dd,_0x4281aa){return function(_0x53bdb0){if(!_0x53bdb0){_0x35c9dd['sendStatus'](0x194);}return _0x53bdb0;};}function handleError(_0x2c6975,_0xe96c53){_0xe96c53=_0xe96c53||0x1f4;return function(_0x5c00f6){logger['error'](_0x5c00f6[_0xa6b8('0x34')]);if(_0x5c00f6[_0xa6b8('0x35')]){delete _0x5c00f6[_0xa6b8('0x35')];}_0x2c6975[_0xa6b8('0x29')](_0xe96c53)[_0xa6b8('0x36')](_0x5c00f6);};}exports[_0xa6b8('0x37')]=function(_0xdf348b,_0x40e4d){var _0x2bc146={},_0x31cb98={},_0x142f59={'count':0x0,'rows':[]};var _0x1c77b6=_[_0xa6b8('0x38')](db[_0xa6b8('0x39')][_0xa6b8('0x3a')],function(_0xbcc696){return{'name':_0xbcc696['fieldName'],'type':_0xbcc696['type'][_0xa6b8('0x3b')]};});_0x31cb98[_0xa6b8('0x3c')]=_['map'](_0x1c77b6,_0xa6b8('0x35'));_0x31cb98[_0xa6b8('0x3d')]=_[_0xa6b8('0x3e')](_0xdf348b[_0xa6b8('0x3d')]);_0x31cb98['filters']=_['intersection'](_0x31cb98[_0xa6b8('0x3c')],_0x31cb98[_0xa6b8('0x3d')]);_0x2bc146[_0xa6b8('0x3f')]=_['intersection'](_0x31cb98[_0xa6b8('0x3c')],qs[_0xa6b8('0x40')](_0xdf348b['query'][_0xa6b8('0x40')]));_0x2bc146[_0xa6b8('0x3f')]=_0x2bc146['attributes']['length']?_0x2bc146[_0xa6b8('0x3f')]:_0x31cb98[_0xa6b8('0x3c')];if(!_0xdf348b['query'][_0xa6b8('0x41')]('nolimit')){_0x2bc146[_0xa6b8('0x2c')]=qs['limit'](_0xdf348b[_0xa6b8('0x3d')][_0xa6b8('0x2c')]);_0x2bc146['offset']=qs[_0xa6b8('0x2b')](_0xdf348b['query'][_0xa6b8('0x2b')]);}_0x2bc146[_0xa6b8('0x42')]=qs[_0xa6b8('0x43')](_0xdf348b[_0xa6b8('0x3d')]['sort']);_0x2bc146[_0xa6b8('0x44')]=qs[_0xa6b8('0x45')](_['pick'](_0xdf348b[_0xa6b8('0x3d')],_0x31cb98['filters']),_0x1c77b6);if(_0xdf348b['query']['filter']){_0x2bc146[_0xa6b8('0x44')]=_['merge'](_0x2bc146[_0xa6b8('0x44')],{'$or':_[_0xa6b8('0x38')](_0x1c77b6,function(_0x287324){if(_0x287324[_0xa6b8('0x46')]!==_0xa6b8('0x47')){var _0x38c7f3={};_0x38c7f3[_0x287324[_0xa6b8('0x35')]]={'$like':'%'+_0xdf348b[_0xa6b8('0x3d')][_0xa6b8('0x48')]+'%'};return _0x38c7f3;}})});}_0x2bc146=_[_0xa6b8('0x49')]({},_0x2bc146,_0xdf348b['options']);var _0x34f029={'where':_0x2bc146[_0xa6b8('0x44')]};return db[_0xa6b8('0x39')][_0xa6b8('0x4a')](_0x34f029)[_0xa6b8('0x33')](function(_0x45d292){_0x142f59[_0xa6b8('0x4a')]=_0x45d292;if(_0xdf348b['query'][_0xa6b8('0x4b')]){_0x2bc146[_0xa6b8('0x4c')]=[{'all':!![]}];}return db[_0xa6b8('0x39')]['findAll'](_0x2bc146);})[_0xa6b8('0x33')](function(_0x60e6ac){_0x142f59['rows']=_0x60e6ac;return _0x142f59;})[_0xa6b8('0x33')](respondWithFilteredResult(_0x40e4d,_0x2bc146))['catch'](handleError(_0x40e4d,null));};exports[_0xa6b8('0x4d')]=function(_0x3d9109,_0xb41302){var _0x2e341f={'raw':![],'where':{'id':_0x3d9109[_0xa6b8('0x4e')]['id']}},_0x31840f={};_0x31840f['model']=_[_0xa6b8('0x3e')](db[_0xa6b8('0x39')][_0xa6b8('0x3a')]);_0x31840f[_0xa6b8('0x3d')]=_[_0xa6b8('0x3e')](_0x3d9109[_0xa6b8('0x3d')]);_0x31840f[_0xa6b8('0x45')]=_[_0xa6b8('0x4f')](_0x31840f['model'],_0x31840f[_0xa6b8('0x3d')]);_0x2e341f[_0xa6b8('0x3f')]=_['intersection'](_0x31840f[_0xa6b8('0x3c')],qs[_0xa6b8('0x40')](_0x3d9109[_0xa6b8('0x3d')]['fields']));_0x2e341f[_0xa6b8('0x3f')]=_0x2e341f[_0xa6b8('0x3f')][_0xa6b8('0x50')]?_0x2e341f['attributes']:_0x31840f[_0xa6b8('0x3c')];if(_0x3d9109[_0xa6b8('0x3d')][_0xa6b8('0x4b')]){_0x2e341f[_0xa6b8('0x4c')]=[{'all':!![]}];}_0x2e341f=_[_0xa6b8('0x49')]({},_0x2e341f,_0x3d9109['options']);return db['VtigerAccount']['find'](_0x2e341f)[_0xa6b8('0x33')](handleEntityNotFound(_0xb41302,null))['then'](respondWithResult(_0xb41302,null))[_0xa6b8('0x27')](handleError(_0xb41302,null));};exports[_0xa6b8('0x51')]=function(_0x4d60cc,_0x19e5f7){return db[_0xa6b8('0x39')][_0xa6b8('0x51')](_0x4d60cc[_0xa6b8('0x52')],{})[_0xa6b8('0x33')](respondWithResult(_0x19e5f7,0xc9))[_0xa6b8('0x27')](handleError(_0x19e5f7,null));};exports[_0xa6b8('0x32')]=function(_0x1ebf71,_0x5536af){if(_0x1ebf71[_0xa6b8('0x52')]['id']){delete _0x1ebf71[_0xa6b8('0x52')]['id'];}return db['VtigerAccount'][_0xa6b8('0x53')]({'where':{'id':_0x1ebf71[_0xa6b8('0x4e')]['id']}})[_0xa6b8('0x33')](handleEntityNotFound(_0x5536af,null))[_0xa6b8('0x33')](saveUpdates(_0x1ebf71['body'],null))[_0xa6b8('0x33')](respondWithResult(_0x5536af,null))[_0xa6b8('0x27')](handleError(_0x5536af,null));};exports[_0xa6b8('0x54')]=function(_0x5c57fd,_0x8260bb){return db['VtigerAccount'][_0xa6b8('0x53')]({'where':{'id':_0x5c57fd[_0xa6b8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8260bb,null))[_0xa6b8('0x33')](removeEntity(_0x8260bb,null))[_0xa6b8('0x27')](handleError(_0x8260bb,null));};exports['getConfigurations']=function(_0x154453,_0x556d6b,_0x410513){var _0x2d395b={};var _0x5922d3={};var _0x54846a;var _0x15486f;return db[_0xa6b8('0x39')][_0xa6b8('0x55')]({'where':{'id':_0x154453[_0xa6b8('0x4e')]['id']}})[_0xa6b8('0x33')](handleEntityNotFound(_0x556d6b,null))[_0xa6b8('0x33')](function(_0x524c7f){if(_0x524c7f){_0x54846a=_0x524c7f;_0x5922d3[_0xa6b8('0x3c')]=_[_0xa6b8('0x3e')](db[_0xa6b8('0x56')]['rawAttributes']);_0x5922d3[_0xa6b8('0x3d')]=_['keys'](_0x154453['query']);_0x5922d3['filters']=_[_0xa6b8('0x4f')](_0x5922d3[_0xa6b8('0x3c')],_0x5922d3[_0xa6b8('0x3d')]);_0x2d395b[_0xa6b8('0x3f')]=_[_0xa6b8('0x4f')](_0x5922d3[_0xa6b8('0x3c')],qs[_0xa6b8('0x40')](_0x154453[_0xa6b8('0x3d')][_0xa6b8('0x40')]));_0x2d395b['attributes']=_0x2d395b[_0xa6b8('0x3f')]['length']?_0x2d395b[_0xa6b8('0x3f')]:_0x5922d3[_0xa6b8('0x3c')];_0x2d395b[_0xa6b8('0x42')]=qs[_0xa6b8('0x43')](_0x154453[_0xa6b8('0x3d')]['sort']);_0x2d395b['where']=qs[_0xa6b8('0x45')](_[_0xa6b8('0x57')](_0x154453[_0xa6b8('0x3d')],_0x5922d3[_0xa6b8('0x45')]));if(_0x154453[_0xa6b8('0x3d')][_0xa6b8('0x48')]){_0x2d395b[_0xa6b8('0x44')]=_[_0xa6b8('0x49')](_0x2d395b[_0xa6b8('0x44')],{'$or':_[_0xa6b8('0x38')](_0x2d395b[_0xa6b8('0x3f')],function(_0x1fcfeb){var _0x315149={};_0x315149[_0x1fcfeb]={'$like':'%'+_0x154453['query'][_0xa6b8('0x48')]+'%'};return _0x315149;})});}_0x2d395b=_['merge']({},_0x2d395b,_0x154453['options']);return _0x54846a[_0xa6b8('0x58')](_0x2d395b);}})[_0xa6b8('0x33')](function(_0x3ec45c){if(_0x3ec45c){_0x15486f=_0x3ec45c[_0xa6b8('0x50')];if(!_0x154453[_0xa6b8('0x3d')][_0xa6b8('0x41')](_0xa6b8('0x59'))){_0x2d395b[_0xa6b8('0x2c')]=qs[_0xa6b8('0x2c')](_0x154453[_0xa6b8('0x3d')][_0xa6b8('0x2c')]);_0x2d395b['offset']=qs['offset'](_0x154453[_0xa6b8('0x3d')]['offset']);}return _0x54846a['getConfigurations'](_0x2d395b);}})[_0xa6b8('0x33')](function(_0x28263c){if(_0x28263c){return _0x28263c?{'count':_0x15486f,'rows':_0x28263c}:null;}})[_0xa6b8('0x33')](respondWithResult(_0x556d6b,null))[_0xa6b8('0x27')](handleError(_0x556d6b,null));};exports[_0xa6b8('0x5a')]=function(_0x15253c,_0x4290d7,_0x5bf06e){if(_0x15253c[_0xa6b8('0x52')]['id']){delete _0x15253c[_0xa6b8('0x52')]['id'];}return db[_0xa6b8('0x39')][_0xa6b8('0x55')]({'where':{'id':_0x15253c[_0xa6b8('0x4e')]['id']}})[_0xa6b8('0x33')](handleEntityNotFound(_0x4290d7,null))[_0xa6b8('0x33')](function(_0x43414b){if(_0x43414b){_0x15253c[_0xa6b8('0x52')]['AccountId']=_0x43414b['id'];_0x15253c[_0xa6b8('0x52')][_0xa6b8('0x5b')]=integrations['getSubjects'](_0x15253c[_0xa6b8('0x52')][_0xa6b8('0x5c')],_0x15253c[_0xa6b8('0x52')][_0xa6b8('0x46')]);_0x15253c[_0xa6b8('0x52')][_0xa6b8('0x5d')]=integrations[_0xa6b8('0x5e')](_0x15253c[_0xa6b8('0x52')][_0xa6b8('0x5c')],_0x15253c[_0xa6b8('0x52')]['type']);return db[_0xa6b8('0x56')][_0xa6b8('0x51')](_0x15253c[_0xa6b8('0x52')],{'include':[{'model':db[_0xa6b8('0x5f')],'as':_0xa6b8('0x5b')},{'model':db[_0xa6b8('0x5f')],'as':_0xa6b8('0x5d')}]});}return null;})[_0xa6b8('0x33')](respondWithResult(_0x4290d7,null))[_0xa6b8('0x27')](handleError(_0x4290d7,null));};var md5=require(_0xa6b8('0x60'));exports[_0xa6b8('0x61')]=function(_0x519a77,_0x55b6b9,_0x304d74){var _0x4695b8=null;var _0x19511e=null;var _0x376276=null;var _0x93d3e3=null;var _0x17c253='';return db[_0xa6b8('0x39')][_0xa6b8('0x55')]({'where':{'id':_0x519a77[_0xa6b8('0x4e')]['id']},'attributes':['id',_0xa6b8('0x35'),_0xa6b8('0x62'),_0xa6b8('0x63'),_0xa6b8('0x64'),_0xa6b8('0x65'),_0xa6b8('0x66'),'accessKey']})[_0xa6b8('0x33')](handleEntityNotFound(_0x55b6b9,null))[_0xa6b8('0x33')](function(_0x2cfbe8){if(_0x2cfbe8){_0x4695b8=_0x2cfbe8[_0xa6b8('0x62')];_0x19511e=_0x2cfbe8[_0xa6b8('0x67')];_0x376276=_0x2cfbe8[_0xa6b8('0x64')];_0x17c253=_0x2cfbe8[_0xa6b8('0x65')];var _0x5db494=_0x17c253['slice'](-0x1);if(_0x5db494==='/'){_0x17c253=_0x17c253[_0xa6b8('0x68')](0x0,_0x17c253[_0xa6b8('0x69')](_0x5db494));}_0x93d3e3=util['format'](_0xa6b8('0x6a'),_0x17c253);var _0x49831b={'method':_0xa6b8('0x6b'),'uri':_0x93d3e3,'qs':{'operation':_0xa6b8('0x6c'),'username':_0x2cfbe8['username']},'json':!![]};return rp(_0x49831b);}})[_0xa6b8('0x33')](function(_0x2795a1){if(_0x2795a1[_0xa6b8('0x6d')]){var _0x395d72={'method':_0xa6b8('0x6e'),'uri':_0x93d3e3,'form':{'operation':'login','username':_0x4695b8,'accessKey':md5(_0x2795a1['result'][_0xa6b8('0x6f')]+_0x19511e)},'json':!![]};return rp(_0x395d72);}})[_0xa6b8('0x33')](function(_0x4bc6c4){if(_0x4bc6c4[_0xa6b8('0x6d')]){var _0xfa66ea={'method':'GET','uri':_0x93d3e3,'qs':{'operation':_0xa6b8('0x70'),'username':_0x4695b8,'sessionName':_0x4bc6c4[_0xa6b8('0x71')][_0xa6b8('0x72')],'elementType':_0x376276},'json':!![]};return rp(_0xfa66ea);}})['then'](function(_0x2157ee){if(_0x2157ee[_0xa6b8('0x6d')]){var _0x3c1ce2=[_0xa6b8('0x73'),'reference',_0xa6b8('0x74')];_[_0xa6b8('0x75')](_0x2157ee[_0xa6b8('0x71')]['fields'],function(_0x2d83f0){return _0x3c1ce2[_0xa6b8('0x76')](_0x2d83f0[_0xa6b8('0x46')]['name']);});_[_0xa6b8('0x75')](_0x2157ee['result']['fields'],function(_0x1ee31e){return _0x1ee31e[_0xa6b8('0x77')]===_0xa6b8('0x78');});return{'count':_0x2157ee[_0xa6b8('0x71')][_0xa6b8('0x40')]['length'],'rows':_['map'](_0x2157ee[_0xa6b8('0x71')]['fields'],function(_0x5b0adc){return{'id':_0x5b0adc[_0xa6b8('0x35')],'name':_0x5b0adc[_0xa6b8('0x79')],'custom':_[_0xa6b8('0x7a')](_0x5b0adc['name'],_0xa6b8('0x7b'))?!![]:![],'options':_0x5b0adc['type'][_0xa6b8('0x35')]===_0xa6b8('0x7c')&&_0x5b0adc['type'][_0xa6b8('0x7d')][_0xa6b8('0x50')]>0x0?_['map'](_0x5b0adc[_0xa6b8('0x46')][_0xa6b8('0x7d')],function(_0x409df9){return{'name':_0x409df9[_0xa6b8('0x79')],'value':_0x409df9['value']};}):[]};})};}})[_0xa6b8('0x33')](respondWithResult(_0x55b6b9,null))[_0xa6b8('0x27')](function(_0x19f7a7){console[_0xa6b8('0x7e')](_0xa6b8('0x7f')+_0x19f7a7);var _0x5b7532=_0x519a77[_0xa6b8('0x3d')]['test']?0x1f4:_0x19f7a7['statusCode']||0x1f4;logger[_0xa6b8('0x24')](_0xa6b8('0x80'),_0xa6b8('0x61'),_0x5b7532,JSON[_0xa6b8('0x22')](_0x19f7a7));delete _0x19f7a7[_0xa6b8('0x35')];if(_0x5b7532===0x191){_0x5b7532=0x190;}_0x55b6b9['status'](_0x5b7532)[_0xa6b8('0x36')](_0x519a77[_0xa6b8('0x3d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x19f7a7[_0xa6b8('0x81')]}:_0x19f7a7);});}; \ No newline at end of file +var _0xf1c7=['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','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','VtigerAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','options','includeAll','include','findAll','show','params','keys','find','create','body','findOne','VtigerConfiguration','pick','getConfigurations','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','owner','remove','includes','editable','false','cf_','picklist','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5ae33d,_0x29d9a8){var _0x142e3f=function(_0x59b263){while(--_0x59b263){_0x5ae33d['push'](_0x5ae33d['shift']());}};_0x142e3f(++_0x29d9a8);}(_0xf1c7,0x193));var _0x7f1c=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf1c7[_0x31ced5];return _0x10d9e5;};'use strict';var pdf=require(_0x7f1c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7f1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f1c('0x2'));var rp=require(_0x7f1c('0x3'));var moment=require(_0x7f1c('0x4'));var BPromise=require(_0x7f1c('0x5'));var Mustache=require(_0x7f1c('0x6'));var util=require(_0x7f1c('0x7'));var path=require(_0x7f1c('0x8'));var sox=require(_0x7f1c('0x9'));var csv=require(_0x7f1c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7f1c('0xb'));var crypto=require(_0x7f1c('0xc'));var jsforce=require(_0x7f1c('0xd'));var deskjs=require(_0x7f1c('0xe'));var toCsv=require(_0x7f1c('0xa'));var querystring=require(_0x7f1c('0xf'));var Papa=require(_0x7f1c('0x10'));var Redis=require(_0x7f1c('0x11'));var authService=require(_0x7f1c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f1c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f1c('0x14'))(_0x7f1c('0x15'));var utils=require(_0x7f1c('0x16'));var config=require(_0x7f1c('0x17'));var licenseUtil=require(_0x7f1c('0x18'));var db=require(_0x7f1c('0x19'))['db'];var integrations=require(_0x7f1c('0x1a'));var jayson=require(_0x7f1c('0x1b'));var client=jayson[_0x7f1c('0x1c')][_0x7f1c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x13eb10,_0x5cf87f,_0x1b977e,_0x10a075){return new BPromise(function(_0x439ba0,_0x39a381){var _0x1eb7e6=_0x10a075||client;return _0x1eb7e6[_0x7f1c('0x1e')](_0x13eb10,_0x1b977e)[_0x7f1c('0x1f')](function(_0x10a02b){logger[_0x7f1c('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x5cf87f,_0x7f1c('0x21'));logger[_0x7f1c('0x22')](_0x7f1c('0x23'),_0x5cf87f,_0x7f1c('0x21'),JSON[_0x7f1c('0x24')](_0x10a02b));if(_0x10a02b[_0x7f1c('0x25')]){if(_0x10a02b[_0x7f1c('0x25')][_0x7f1c('0x26')]===0x1f4){logger[_0x7f1c('0x25')](_0x7f1c('0x27'),_0x5cf87f,_0x10a02b[_0x7f1c('0x25')][_0x7f1c('0x28')]);return _0x39a381(_0x10a02b[_0x7f1c('0x25')][_0x7f1c('0x28')]);}logger[_0x7f1c('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x5cf87f,_0x10a02b[_0x7f1c('0x25')][_0x7f1c('0x28')]);return _0x439ba0(_0x10a02b['error'][_0x7f1c('0x28')]);}else{logger[_0x7f1c('0x20')](_0x7f1c('0x27'),_0x5cf87f,'request\x20sent');_0x439ba0(_0x10a02b['result']['message']);}})[_0x7f1c('0x29')](function(_0x957801){logger[_0x7f1c('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x5cf87f,_0x957801);_0x39a381(_0x957801);});});}function respondWithStatusCode(_0x15f84c,_0x10c131){_0x10c131=_0x10c131||0xcc;return function(_0x4a5e3a){if(_0x4a5e3a){return _0x15f84c[_0x7f1c('0x2a')](_0x10c131);}return _0x15f84c[_0x7f1c('0x2b')](_0x10c131)[_0x7f1c('0x2c')]();};}function respondWithResult(_0x57506e,_0x1e2314){_0x1e2314=_0x1e2314||0xc8;return function(_0x1a9dc7){if(_0x1a9dc7){return _0x57506e[_0x7f1c('0x2b')](_0x1e2314)['json'](_0x1a9dc7);}};}function respondWithFilteredResult(_0x2e4001,_0x2a7928){return function(_0x1856a7){if(_0x1856a7){var _0x29ff5c=_0x1856a7[_0x7f1c('0x2d')],_0x42208a=_0x2a7928[_0x7f1c('0x2e')],_0x34f9f9=_0x2a7928[_0x7f1c('0x2e')]+_0x2a7928['limit'],_0x548f65;if(_0x34f9f9>=_0x29ff5c){_0x34f9f9=_0x29ff5c;_0x548f65=0xc8;}else{_0x548f65=0xce;}_0x2e4001[_0x7f1c('0x2b')](_0x548f65);return _0x2e4001[_0x7f1c('0x2f')](_0x7f1c('0x30'),_0x42208a+'-'+_0x34f9f9+'/'+_0x29ff5c)[_0x7f1c('0x31')](_0x1856a7);}return null;};}function patchUpdates(_0x4c0ecc){return function(_0x59e85c){try{jsonpatch[_0x7f1c('0x32')](_0x59e85c,_0x4c0ecc,!![]);}catch(_0x23f6e6){return BPromise[_0x7f1c('0x33')](_0x23f6e6);}return _0x59e85c[_0x7f1c('0x34')]();};}function saveUpdates(_0x28729b,_0x1bda00){return function(_0x1828c5){if(_0x1828c5){return _0x1828c5[_0x7f1c('0x35')](_0x28729b)[_0x7f1c('0x1f')](function(_0x1f1514){return _0x1f1514;});}return null;};}function removeEntity(_0x368047,_0xfb5294){return function(_0x22e870){if(_0x22e870){return _0x22e870[_0x7f1c('0x36')]()[_0x7f1c('0x1f')](function(){_0x368047[_0x7f1c('0x2b')](0xcc)[_0x7f1c('0x2c')]();});}};}function handleEntityNotFound(_0x14d159,_0x3c70e7){return function(_0x2452d4){if(!_0x2452d4){_0x14d159['sendStatus'](0x194);}return _0x2452d4;};}function handleError(_0x156055,_0x142400){_0x142400=_0x142400||0x1f4;return function(_0x5cc9c9){logger[_0x7f1c('0x25')](_0x5cc9c9[_0x7f1c('0x37')]);if(_0x5cc9c9[_0x7f1c('0x38')]){delete _0x5cc9c9[_0x7f1c('0x38')];}_0x156055[_0x7f1c('0x2b')](_0x142400)['send'](_0x5cc9c9);};}exports[_0x7f1c('0x39')]=function(_0x4a5bd9,_0x45ed8e){var _0x85abc3={},_0x1313e8={},_0x20b11a={'count':0x0,'rows':[]};var _0x48646b=_['map'](db[_0x7f1c('0x3a')][_0x7f1c('0x3b')],function(_0x2d743b){return{'name':_0x2d743b[_0x7f1c('0x3c')],'type':_0x2d743b[_0x7f1c('0x3d')][_0x7f1c('0x3e')]};});_0x1313e8['model']=_['map'](_0x48646b,_0x7f1c('0x38'));_0x1313e8['query']=_['keys'](_0x4a5bd9[_0x7f1c('0x3f')]);_0x1313e8[_0x7f1c('0x40')]=_['intersection'](_0x1313e8[_0x7f1c('0x41')],_0x1313e8[_0x7f1c('0x3f')]);_0x85abc3[_0x7f1c('0x42')]=_[_0x7f1c('0x43')](_0x1313e8[_0x7f1c('0x41')],qs['fields'](_0x4a5bd9[_0x7f1c('0x3f')][_0x7f1c('0x44')]));_0x85abc3[_0x7f1c('0x42')]=_0x85abc3[_0x7f1c('0x42')][_0x7f1c('0x45')]?_0x85abc3[_0x7f1c('0x42')]:_0x1313e8['model'];if(!_0x4a5bd9[_0x7f1c('0x3f')][_0x7f1c('0x46')]('nolimit')){_0x85abc3[_0x7f1c('0x47')]=qs['limit'](_0x4a5bd9[_0x7f1c('0x3f')][_0x7f1c('0x47')]);_0x85abc3[_0x7f1c('0x2e')]=qs[_0x7f1c('0x2e')](_0x4a5bd9['query'][_0x7f1c('0x2e')]);}_0x85abc3[_0x7f1c('0x48')]=qs[_0x7f1c('0x49')](_0x4a5bd9[_0x7f1c('0x3f')][_0x7f1c('0x49')]);_0x85abc3[_0x7f1c('0x4a')]=qs[_0x7f1c('0x40')](_['pick'](_0x4a5bd9[_0x7f1c('0x3f')],_0x1313e8[_0x7f1c('0x40')]),_0x48646b);if(_0x4a5bd9['query'][_0x7f1c('0x4b')]){_0x85abc3['where']=_[_0x7f1c('0x4c')](_0x85abc3[_0x7f1c('0x4a')],{'$or':_[_0x7f1c('0x4d')](_0x48646b,function(_0x3529a0){if(_0x3529a0['type']!=='VIRTUAL'){var _0x4845ea={};_0x4845ea[_0x3529a0['name']]={'$like':'%'+_0x4a5bd9[_0x7f1c('0x3f')][_0x7f1c('0x4b')]+'%'};return _0x4845ea;}})});}_0x85abc3=_[_0x7f1c('0x4c')]({},_0x85abc3,_0x4a5bd9[_0x7f1c('0x4e')]);var _0x13fc4c={'where':_0x85abc3[_0x7f1c('0x4a')]};return db[_0x7f1c('0x3a')][_0x7f1c('0x2d')](_0x13fc4c)[_0x7f1c('0x1f')](function(_0x1c8c66){_0x20b11a['count']=_0x1c8c66;if(_0x4a5bd9[_0x7f1c('0x3f')][_0x7f1c('0x4f')]){_0x85abc3[_0x7f1c('0x50')]=[{'all':!![]}];}return db[_0x7f1c('0x3a')][_0x7f1c('0x51')](_0x85abc3);})[_0x7f1c('0x1f')](function(_0x14cf7e){_0x20b11a['rows']=_0x14cf7e;return _0x20b11a;})[_0x7f1c('0x1f')](respondWithFilteredResult(_0x45ed8e,_0x85abc3))['catch'](handleError(_0x45ed8e,null));};exports[_0x7f1c('0x52')]=function(_0x5680e5,_0x105d07){var _0x197435={'raw':![],'where':{'id':_0x5680e5[_0x7f1c('0x53')]['id']}},_0x2f8e7f={};_0x2f8e7f[_0x7f1c('0x41')]=_['keys'](db['VtigerAccount'][_0x7f1c('0x3b')]);_0x2f8e7f['query']=_[_0x7f1c('0x54')](_0x5680e5[_0x7f1c('0x3f')]);_0x2f8e7f[_0x7f1c('0x40')]=_['intersection'](_0x2f8e7f[_0x7f1c('0x41')],_0x2f8e7f[_0x7f1c('0x3f')]);_0x197435[_0x7f1c('0x42')]=_[_0x7f1c('0x43')](_0x2f8e7f[_0x7f1c('0x41')],qs[_0x7f1c('0x44')](_0x5680e5[_0x7f1c('0x3f')][_0x7f1c('0x44')]));_0x197435['attributes']=_0x197435[_0x7f1c('0x42')]['length']?_0x197435[_0x7f1c('0x42')]:_0x2f8e7f[_0x7f1c('0x41')];if(_0x5680e5[_0x7f1c('0x3f')]['includeAll']){_0x197435[_0x7f1c('0x50')]=[{'all':!![]}];}_0x197435=_['merge']({},_0x197435,_0x5680e5[_0x7f1c('0x4e')]);return db[_0x7f1c('0x3a')][_0x7f1c('0x55')](_0x197435)[_0x7f1c('0x1f')](handleEntityNotFound(_0x105d07,null))[_0x7f1c('0x1f')](respondWithResult(_0x105d07,null))[_0x7f1c('0x29')](handleError(_0x105d07,null));};exports[_0x7f1c('0x56')]=function(_0xfb8d62,_0x57ae25){return db[_0x7f1c('0x3a')][_0x7f1c('0x56')](_0xfb8d62[_0x7f1c('0x57')],{})[_0x7f1c('0x1f')](respondWithResult(_0x57ae25,0xc9))[_0x7f1c('0x29')](handleError(_0x57ae25,null));};exports['update']=function(_0x10ace9,_0x7aed6){if(_0x10ace9[_0x7f1c('0x57')]['id']){delete _0x10ace9['body']['id'];}return db[_0x7f1c('0x3a')][_0x7f1c('0x55')]({'where':{'id':_0x10ace9[_0x7f1c('0x53')]['id']}})['then'](handleEntityNotFound(_0x7aed6,null))[_0x7f1c('0x1f')](saveUpdates(_0x10ace9['body'],null))[_0x7f1c('0x1f')](respondWithResult(_0x7aed6,null))[_0x7f1c('0x29')](handleError(_0x7aed6,null));};exports[_0x7f1c('0x36')]=function(_0x194a0b,_0x2dbe95){return db[_0x7f1c('0x3a')]['find']({'where':{'id':_0x194a0b[_0x7f1c('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dbe95,null))['then'](removeEntity(_0x2dbe95,null))[_0x7f1c('0x29')](handleError(_0x2dbe95,null));};exports['getConfigurations']=function(_0x549867,_0x1f8bbb,_0x3bea7d){var _0x4d1bb8={};var _0xf705a1={};var _0x38875d;var _0x386ab8;return db['VtigerAccount'][_0x7f1c('0x58')]({'where':{'id':_0x549867[_0x7f1c('0x53')]['id']}})[_0x7f1c('0x1f')](handleEntityNotFound(_0x1f8bbb,null))['then'](function(_0x5b1616){if(_0x5b1616){_0x38875d=_0x5b1616;_0xf705a1['model']=_[_0x7f1c('0x54')](db[_0x7f1c('0x59')][_0x7f1c('0x3b')]);_0xf705a1[_0x7f1c('0x3f')]=_[_0x7f1c('0x54')](_0x549867[_0x7f1c('0x3f')]);_0xf705a1[_0x7f1c('0x40')]=_['intersection'](_0xf705a1['model'],_0xf705a1[_0x7f1c('0x3f')]);_0x4d1bb8[_0x7f1c('0x42')]=_[_0x7f1c('0x43')](_0xf705a1[_0x7f1c('0x41')],qs[_0x7f1c('0x44')](_0x549867['query'][_0x7f1c('0x44')]));_0x4d1bb8[_0x7f1c('0x42')]=_0x4d1bb8[_0x7f1c('0x42')][_0x7f1c('0x45')]?_0x4d1bb8[_0x7f1c('0x42')]:_0xf705a1[_0x7f1c('0x41')];_0x4d1bb8['order']=qs[_0x7f1c('0x49')](_0x549867['query'][_0x7f1c('0x49')]);_0x4d1bb8[_0x7f1c('0x4a')]=qs['filters'](_[_0x7f1c('0x5a')](_0x549867[_0x7f1c('0x3f')],_0xf705a1[_0x7f1c('0x40')]));if(_0x549867[_0x7f1c('0x3f')][_0x7f1c('0x4b')]){_0x4d1bb8['where']=_[_0x7f1c('0x4c')](_0x4d1bb8[_0x7f1c('0x4a')],{'$or':_[_0x7f1c('0x4d')](_0x4d1bb8['attributes'],function(_0x1c230f){var _0xb6bf4a={};_0xb6bf4a[_0x1c230f]={'$like':'%'+_0x549867[_0x7f1c('0x3f')][_0x7f1c('0x4b')]+'%'};return _0xb6bf4a;})});}_0x4d1bb8=_[_0x7f1c('0x4c')]({},_0x4d1bb8,_0x549867[_0x7f1c('0x4e')]);return _0x38875d[_0x7f1c('0x5b')](_0x4d1bb8);}})['then'](function(_0x560ed8){if(_0x560ed8){_0x386ab8=_0x560ed8[_0x7f1c('0x45')];if(!_0x549867[_0x7f1c('0x3f')][_0x7f1c('0x46')](_0x7f1c('0x5c'))){_0x4d1bb8[_0x7f1c('0x47')]=qs[_0x7f1c('0x47')](_0x549867[_0x7f1c('0x3f')]['limit']);_0x4d1bb8[_0x7f1c('0x2e')]=qs['offset'](_0x549867[_0x7f1c('0x3f')][_0x7f1c('0x2e')]);}return _0x38875d['getConfigurations'](_0x4d1bb8);}})[_0x7f1c('0x1f')](function(_0x323db2){if(_0x323db2){return _0x323db2?{'count':_0x386ab8,'rows':_0x323db2}:null;}})[_0x7f1c('0x1f')](respondWithResult(_0x1f8bbb,null))[_0x7f1c('0x29')](handleError(_0x1f8bbb,null));};exports['addConfiguration']=function(_0x137566,_0x1cb40d,_0x183ac4){if(_0x137566[_0x7f1c('0x57')]['id']){delete _0x137566[_0x7f1c('0x57')]['id'];}return db[_0x7f1c('0x3a')]['findOne']({'where':{'id':_0x137566[_0x7f1c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1cb40d,null))['then'](function(_0x2b8a57){if(_0x2b8a57){_0x137566[_0x7f1c('0x57')][_0x7f1c('0x5d')]=_0x2b8a57['id'];_0x137566[_0x7f1c('0x57')][_0x7f1c('0x5e')]=integrations[_0x7f1c('0x5f')](_0x137566['body'][_0x7f1c('0x60')],_0x137566[_0x7f1c('0x57')][_0x7f1c('0x3d')]);_0x137566[_0x7f1c('0x57')][_0x7f1c('0x61')]=integrations[_0x7f1c('0x62')](_0x137566['body'][_0x7f1c('0x60')],_0x137566[_0x7f1c('0x57')][_0x7f1c('0x3d')]);return db[_0x7f1c('0x59')]['create'](_0x137566[_0x7f1c('0x57')],{'include':[{'model':db[_0x7f1c('0x63')],'as':_0x7f1c('0x5e')},{'model':db[_0x7f1c('0x63')],'as':_0x7f1c('0x61')}]});}return null;})[_0x7f1c('0x1f')](respondWithResult(_0x1cb40d,null))[_0x7f1c('0x29')](handleError(_0x1cb40d,null));};var md5=require(_0x7f1c('0x64'));exports[_0x7f1c('0x65')]=function(_0x46b1ab,_0x2b6267,_0x5b8d4e){var _0x52fa68=null;var _0x1b4963=null;var _0x564595=null;var _0x548d54=null;var _0x3ef53e='';return db[_0x7f1c('0x3a')][_0x7f1c('0x58')]({'where':{'id':_0x46b1ab[_0x7f1c('0x53')]['id']},'attributes':['id',_0x7f1c('0x38'),_0x7f1c('0x66'),_0x7f1c('0x67'),_0x7f1c('0x68'),'remoteUri',_0x7f1c('0x69'),_0x7f1c('0x6a')]})[_0x7f1c('0x1f')](handleEntityNotFound(_0x2b6267,null))[_0x7f1c('0x1f')](function(_0x20b01e){if(_0x20b01e){_0x52fa68=_0x20b01e[_0x7f1c('0x66')];_0x1b4963=_0x20b01e[_0x7f1c('0x6a')];_0x564595=_0x20b01e[_0x7f1c('0x68')];_0x3ef53e=_0x20b01e['remoteUri'];var _0x3c4610=_0x3ef53e[_0x7f1c('0x6b')](-0x1);if(_0x3c4610==='/'){_0x3ef53e=_0x3ef53e[_0x7f1c('0x6c')](0x0,_0x3ef53e[_0x7f1c('0x6d')](_0x3c4610));}_0x548d54=util[_0x7f1c('0x6e')](_0x7f1c('0x6f'),_0x3ef53e);var _0x5032e4={'method':_0x7f1c('0x70'),'uri':_0x548d54,'qs':{'operation':_0x7f1c('0x71'),'username':_0x20b01e[_0x7f1c('0x66')]},'json':!![]};return rp(_0x5032e4);}})['then'](function(_0x4b52f1){if(_0x4b52f1[_0x7f1c('0x72')]){var _0xe61169={'method':_0x7f1c('0x73'),'uri':_0x548d54,'form':{'operation':_0x7f1c('0x74'),'username':_0x52fa68,'accessKey':md5(_0x4b52f1[_0x7f1c('0x75')][_0x7f1c('0x76')]+_0x1b4963)},'json':!![]};return rp(_0xe61169);}})[_0x7f1c('0x1f')](function(_0x340b8a){if(_0x340b8a[_0x7f1c('0x72')]){var _0x4c9c08={'method':_0x7f1c('0x70'),'uri':_0x548d54,'qs':{'operation':_0x7f1c('0x77'),'username':_0x52fa68,'sessionName':_0x340b8a[_0x7f1c('0x75')][_0x7f1c('0x78')],'elementType':_0x564595},'json':!![]};return rp(_0x4c9c08);}})[_0x7f1c('0x1f')](function(_0x211f44){if(_0x211f44[_0x7f1c('0x72')]){var _0x4267ea=[_0x7f1c('0x79'),'reference',_0x7f1c('0x7a')];_[_0x7f1c('0x7b')](_0x211f44[_0x7f1c('0x75')][_0x7f1c('0x44')],function(_0x24179c){return _0x4267ea[_0x7f1c('0x7c')](_0x24179c[_0x7f1c('0x3d')][_0x7f1c('0x38')]);});_[_0x7f1c('0x7b')](_0x211f44['result'][_0x7f1c('0x44')],function(_0x2ea5c1){return _0x2ea5c1[_0x7f1c('0x7d')]===_0x7f1c('0x7e');});return{'count':_0x211f44[_0x7f1c('0x75')][_0x7f1c('0x44')][_0x7f1c('0x45')],'rows':_[_0x7f1c('0x4d')](_0x211f44[_0x7f1c('0x75')][_0x7f1c('0x44')],function(_0x33f1aa){return{'id':_0x33f1aa['name'],'name':_0x33f1aa['label'],'custom':_['startsWith'](_0x33f1aa[_0x7f1c('0x38')],_0x7f1c('0x7f'))?!![]:![],'options':_0x33f1aa['type'][_0x7f1c('0x38')]===_0x7f1c('0x80')&&_0x33f1aa[_0x7f1c('0x3d')]['picklistValues']['length']>0x0?_[_0x7f1c('0x4d')](_0x33f1aa[_0x7f1c('0x3d')]['picklistValues'],function(_0x4f27d4){return{'name':_0x4f27d4[_0x7f1c('0x81')],'value':_0x4f27d4[_0x7f1c('0x82')]};}):[]};})};}})[_0x7f1c('0x1f')](respondWithResult(_0x2b6267,null))['catch'](function(_0x38feff){console[_0x7f1c('0x83')](_0x7f1c('0x84')+_0x38feff);var _0x552cd6=_0x46b1ab['query'][_0x7f1c('0x85')]?0x1f4:_0x38feff[_0x7f1c('0x86')]||0x1f4;logger[_0x7f1c('0x25')](_0x7f1c('0x87'),'getFields',_0x552cd6,JSON[_0x7f1c('0x24')](_0x38feff));delete _0x38feff[_0x7f1c('0x38')];if(_0x552cd6===0x191){_0x552cd6=0x190;}_0x2b6267[_0x7f1c('0x2b')](_0x552cd6)[_0x7f1c('0x88')](_0x46b1ab[_0x7f1c('0x3f')]['test']?{'message':_0x7f1c('0x89'),'statusCode':_0x38feff[_0x7f1c('0x86')]}:_0x38feff);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6ebd490..ac123b9 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 _0x4bb9=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x4bb9,0x9d));var _0x94bb=function(_0x2769d2,_0x25f8f2){_0x2769d2=_0x2769d2-0x0;var _0x4396bc=_0x4bb9[_0x2769d2];return _0x4396bc;};'use strict';var _=require(_0x94bb('0x0'));var util=require(_0x94bb('0x1'));var logger=require(_0x94bb('0x2'))(_0x94bb('0x3'));var moment=require(_0x94bb('0x4'));var BPromise=require(_0x94bb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94bb('0x6'));var rimraf=require(_0x94bb('0x7'));var config=require(_0x94bb('0x8'));var attributes=require(_0x94bb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x94bb('0xa')]=function(_0x22beec,_0xc696c1){return _0x22beec[_0x94bb('0xb')](_0x94bb('0xc'),attributes,{'tableName':_0x94bb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46d5=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x51ac7c,_0x8696f2){var _0x380ee7=function(_0x285f2a){while(--_0x285f2a){_0x51ac7c['push'](_0x51ac7c['shift']());}};_0x380ee7(++_0x8696f2);}(_0x46d5,0x1e1));var _0x546d=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x46d5[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x546d('0x0'));var util=require(_0x546d('0x1'));var logger=require(_0x546d('0x2'))('api');var moment=require(_0x546d('0x3'));var BPromise=require(_0x546d('0x4'));var rp=require(_0x546d('0x5'));var fs=require('fs');var path=require(_0x546d('0x6'));var rimraf=require(_0x546d('0x7'));var config=require(_0x546d('0x8'));var attributes=require(_0x546d('0x9'));var integrations=require(_0x546d('0xa'));module[_0x546d('0xb')]=function(_0x141ff5,_0x51cee8){return _0x141ff5['define'](_0x546d('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 10cfa2c..7567d08 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 _0x44ed=['options','where','attributes','include','map','model','catch','raw','ShowVtigerAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','GetVtigerAccount','VtigerAccount'];(function(_0x275ca1,_0x3f04c1){var _0x41ad1e=function(_0x55536f){while(--_0x55536f){_0x275ca1['push'](_0x275ca1['shift']());}};_0x41ad1e(++_0x3f04c1);}(_0x44ed,0xd0));var _0xd44e=function(_0x49d6ba,_0x3a04d2){_0x49d6ba=_0x49d6ba-0x0;var _0x21202b=_0x44ed[_0x49d6ba];return _0x21202b;};'use strict';var _=require(_0xd44e('0x0'));var util=require(_0xd44e('0x1'));var moment=require(_0xd44e('0x2'));var BPromise=require(_0xd44e('0x3'));var rs=require(_0xd44e('0x4'));var fs=require('fs');var Redis=require(_0xd44e('0x5'));var db=require(_0xd44e('0x6'))['db'];var utils=require(_0xd44e('0x7'));var logger=require(_0xd44e('0x8'))(_0xd44e('0x9'));var config=require('../../config/environment');var jayson=require(_0xd44e('0xa'));var client=jayson['client'][_0xd44e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x538c55,_0x1b1f36,_0x50faaf){return new BPromise(function(_0x579d38,_0x10f6a2){return client[_0xd44e('0xc')](_0x538c55,_0x50faaf)[_0xd44e('0xd')](function(_0x38412c){logger[_0xd44e('0xe')](_0xd44e('0xf'),_0x1b1f36,_0xd44e('0x10'));logger[_0xd44e('0x11')](_0xd44e('0x12'),_0x1b1f36,_0xd44e('0x10'),JSON['stringify'](_0x38412c));if(_0x38412c[_0xd44e('0x13')]){if(_0x38412c[_0xd44e('0x13')]['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1b1f36,_0x38412c['error']['message']);return _0x10f6a2(_0x38412c['error']['message']);}logger[_0xd44e('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x1b1f36,_0x38412c[_0xd44e('0x13')]['message']);return _0x579d38(_0x38412c['error'][_0xd44e('0x14')]);}else{logger[_0xd44e('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1b1f36,'request\x20sent');_0x579d38(_0x38412c['result']['message']);}})['catch'](function(_0x1fef3d){logger[_0xd44e('0x13')](_0xd44e('0xf'),_0x1b1f36,_0x1fef3d);_0x10f6a2(_0x1fef3d);});});}exports[_0xd44e('0x15')]=function(_0x1c2fed){var _0x123cd8=this;return new Promise(function(_0x315c2b,_0xeb653){return db[_0xd44e('0x16')]['findAll']({'raw':_0x1c2fed[_0xd44e('0x17')]?_0x1c2fed[_0xd44e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c2fed['options']?_0x1c2fed[_0xd44e('0x17')][_0xd44e('0x18')]||null:null,'attributes':_0x1c2fed[_0xd44e('0x17')]?_0x1c2fed[_0xd44e('0x17')][_0xd44e('0x19')]||null:null,'limit':_0x1c2fed['options']?_0x1c2fed[_0xd44e('0x17')]['limit']||null:null,'include':_0x1c2fed[_0xd44e('0x17')]?_0x1c2fed[_0xd44e('0x17')][_0xd44e('0x1a')]?_[_0xd44e('0x1b')](_0x1c2fed[_0xd44e('0x17')][_0xd44e('0x1a')],function(_0x3dad57){return{'model':db[_0x3dad57[_0xd44e('0x1c')]],'as':_0x3dad57['as'],'attributes':_0x3dad57[_0xd44e('0x19')],'include':_0x3dad57['include']?_['map'](_0x3dad57[_0xd44e('0x1a')],function(_0x48c81a){return{'model':db[_0x48c81a[_0xd44e('0x1c')]],'as':_0x48c81a['as'],'attributes':_0x48c81a[_0xd44e('0x19')],'include':_0x48c81a[_0xd44e('0x1a')]?_[_0xd44e('0x1b')](_0x48c81a[_0xd44e('0x1a')],function(_0x2379de){return{'model':db[_0x2379de[_0xd44e('0x1c')]],'as':_0x2379de['as'],'attributes':_0x2379de[_0xd44e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd44e('0xd')](function(_0x21f5da){logger['info']('GetVtigerAccount',_0x1c2fed);logger['debug'](_0xd44e('0x15'),_0x1c2fed,JSON['stringify'](_0x21f5da));_0x315c2b(_0x21f5da);})[_0xd44e('0x1d')](function(_0x579ff8){logger[_0xd44e('0x13')](_0xd44e('0x15'),_0x579ff8['message'],_0x1c2fed);_0xeb653(_0x123cd8[_0xd44e('0x13')](0x1f4,_0x579ff8[_0xd44e('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x24ef85){var _0x228bd1=this;return new Promise(function(_0xb1d91,_0x4b7a58){return db['VtigerAccount']['find']({'raw':_0x24ef85[_0xd44e('0x17')]?_0x24ef85[_0xd44e('0x17')][_0xd44e('0x1e')]===undefined?!![]:![]:!![],'where':_0x24ef85[_0xd44e('0x17')]?_0x24ef85[_0xd44e('0x17')][_0xd44e('0x18')]||null:null,'attributes':_0x24ef85[_0xd44e('0x17')]?_0x24ef85[_0xd44e('0x17')]['attributes']||null:null,'include':_0x24ef85[_0xd44e('0x17')]?_0x24ef85[_0xd44e('0x17')][_0xd44e('0x1a')]?_[_0xd44e('0x1b')](_0x24ef85[_0xd44e('0x17')][_0xd44e('0x1a')],function(_0x3fccd4){return{'model':db[_0x3fccd4[_0xd44e('0x1c')]],'as':_0x3fccd4['as'],'attributes':_0x3fccd4[_0xd44e('0x19')],'include':_0x3fccd4[_0xd44e('0x1a')]?_[_0xd44e('0x1b')](_0x3fccd4['include'],function(_0x3c5b8b){return{'model':db[_0x3c5b8b[_0xd44e('0x1c')]],'as':_0x3c5b8b['as'],'attributes':_0x3c5b8b[_0xd44e('0x19')],'include':_0x3c5b8b[_0xd44e('0x1a')]?_[_0xd44e('0x1b')](_0x3c5b8b['include'],function(_0xcf62fc){return{'model':db[_0xcf62fc[_0xd44e('0x1c')]],'as':_0xcf62fc['as'],'attributes':_0xcf62fc[_0xd44e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd44e('0xd')](function(_0x52009b){logger['info'](_0xd44e('0x1f'),_0x24ef85);logger[_0xd44e('0x11')](_0xd44e('0x1f'),_0x24ef85,JSON[_0xd44e('0x20')](_0x52009b));_0xb1d91(_0x52009b);})[_0xd44e('0x1d')](function(_0x5d06e8){logger['error'](_0xd44e('0x1f'),_0x5d06e8[_0xd44e('0x14')],_0x24ef85);_0x4b7a58(_0x228bd1[_0xd44e('0x13')](0x1f4,_0x5d06e8[_0xd44e('0x14')]));});});}; \ No newline at end of file +var _0xb1cf=['ShowVtigerAccount','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','VtigerAccount,\x20%s,\x20%s','message','findAll','options','raw','attributes','include','map','model','GetVtigerAccount','catch','where'];(function(_0x16eadc,_0x3fc953){var _0x5b05c8=function(_0xd8b9cf){while(--_0xd8b9cf){_0x16eadc['push'](_0x16eadc['shift']());}};_0x5b05c8(++_0x3fc953);}(_0xb1cf,0x8d));var _0xfb1c=function(_0x6e5bf7,_0x2c5d6c){_0x6e5bf7=_0x6e5bf7-0x0;var _0x145f89=_0xb1cf[_0x6e5bf7];return _0x145f89;};'use strict';var _=require(_0xfb1c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1c('0x1'));var db=require(_0xfb1c('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb1c('0x3'))(_0xfb1c('0x4'));var config=require(_0xfb1c('0x5'));var jayson=require(_0xfb1c('0x6'));var client=jayson[_0xfb1c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfeb87,_0x1e4896,_0x50a152){return new BPromise(function(_0x561c68,_0x5bef51){return client[_0xfb1c('0x8')](_0xfeb87,_0x50a152)[_0xfb1c('0x9')](function(_0x2baf03){logger[_0xfb1c('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x1e4896,_0xfb1c('0xb'));logger[_0xfb1c('0xc')](_0xfb1c('0xd'),_0x1e4896,_0xfb1c('0xb'),JSON['stringify'](_0x2baf03));if(_0x2baf03[_0xfb1c('0xe')]){if(_0x2baf03[_0xfb1c('0xe')]['code']===0x1f4){logger['error'](_0xfb1c('0xf'),_0x1e4896,_0x2baf03['error'][_0xfb1c('0x10')]);return _0x5bef51(_0x2baf03[_0xfb1c('0xe')][_0xfb1c('0x10')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1e4896,_0x2baf03[_0xfb1c('0xe')]['message']);return _0x561c68(_0x2baf03[_0xfb1c('0xe')][_0xfb1c('0x10')]);}else{logger[_0xfb1c('0xa')](_0xfb1c('0xf'),_0x1e4896,'request\x20sent');_0x561c68(_0x2baf03['result']['message']);}})['catch'](function(_0x48da72){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1e4896,_0x48da72);_0x5bef51(_0x48da72);});});}exports['GetVtigerAccount']=function(_0x2782bd){var _0x2ebb07=this;return new Promise(function(_0x543f2a,_0x2ff324){return db['VtigerAccount'][_0xfb1c('0x11')]({'raw':_0x2782bd[_0xfb1c('0x12')]?_0x2782bd[_0xfb1c('0x12')][_0xfb1c('0x13')]===undefined?!![]:![]:!![],'where':_0x2782bd['options']?_0x2782bd[_0xfb1c('0x12')]['where']||null:null,'attributes':_0x2782bd['options']?_0x2782bd[_0xfb1c('0x12')][_0xfb1c('0x14')]||null:null,'limit':_0x2782bd[_0xfb1c('0x12')]?_0x2782bd[_0xfb1c('0x12')]['limit']||null:null,'include':_0x2782bd['options']?_0x2782bd[_0xfb1c('0x12')][_0xfb1c('0x15')]?_[_0xfb1c('0x16')](_0x2782bd[_0xfb1c('0x12')]['include'],function(_0x3210e0){return{'model':db[_0x3210e0[_0xfb1c('0x17')]],'as':_0x3210e0['as'],'attributes':_0x3210e0[_0xfb1c('0x14')],'include':_0x3210e0['include']?_[_0xfb1c('0x16')](_0x3210e0['include'],function(_0x35611f){return{'model':db[_0x35611f[_0xfb1c('0x17')]],'as':_0x35611f['as'],'attributes':_0x35611f['attributes'],'include':_0x35611f['include']?_[_0xfb1c('0x16')](_0x35611f[_0xfb1c('0x15')],function(_0x2959ad){return{'model':db[_0x2959ad[_0xfb1c('0x17')]],'as':_0x2959ad['as'],'attributes':_0x2959ad[_0xfb1c('0x14')]};}):[]};}):[]};}):[]:[]})[_0xfb1c('0x9')](function(_0x47d3b3){logger[_0xfb1c('0xa')]('GetVtigerAccount',_0x2782bd);logger[_0xfb1c('0xc')](_0xfb1c('0x18'),_0x2782bd,JSON['stringify'](_0x47d3b3));_0x543f2a(_0x47d3b3);})[_0xfb1c('0x19')](function(_0x59e9e6){logger[_0xfb1c('0xe')](_0xfb1c('0x18'),_0x59e9e6[_0xfb1c('0x10')],_0x2782bd);_0x2ff324(_0x2ebb07[_0xfb1c('0xe')](0x1f4,_0x59e9e6[_0xfb1c('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x5ad3e7){var _0x56c988=this;return new Promise(function(_0x4d6647,_0x5d7df3){return db['VtigerAccount']['find']({'raw':_0x5ad3e7['options']?_0x5ad3e7[_0xfb1c('0x12')][_0xfb1c('0x13')]===undefined?!![]:![]:!![],'where':_0x5ad3e7[_0xfb1c('0x12')]?_0x5ad3e7[_0xfb1c('0x12')][_0xfb1c('0x1a')]||null:null,'attributes':_0x5ad3e7[_0xfb1c('0x12')]?_0x5ad3e7[_0xfb1c('0x12')][_0xfb1c('0x14')]||null:null,'include':_0x5ad3e7['options']?_0x5ad3e7[_0xfb1c('0x12')][_0xfb1c('0x15')]?_[_0xfb1c('0x16')](_0x5ad3e7[_0xfb1c('0x12')][_0xfb1c('0x15')],function(_0x1b3b80){return{'model':db[_0x1b3b80[_0xfb1c('0x17')]],'as':_0x1b3b80['as'],'attributes':_0x1b3b80[_0xfb1c('0x14')],'include':_0x1b3b80[_0xfb1c('0x15')]?_['map'](_0x1b3b80[_0xfb1c('0x15')],function(_0x38387f){return{'model':db[_0x38387f[_0xfb1c('0x17')]],'as':_0x38387f['as'],'attributes':_0x38387f['attributes'],'include':_0x38387f[_0xfb1c('0x15')]?_[_0xfb1c('0x16')](_0x38387f[_0xfb1c('0x15')],function(_0x24e5cb){return{'model':db[_0x24e5cb[_0xfb1c('0x17')]],'as':_0x24e5cb['as'],'attributes':_0x24e5cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb1c('0x9')](function(_0x18e021){logger[_0xfb1c('0xa')](_0xfb1c('0x1b'),_0x5ad3e7);logger['debug']('ShowVtigerAccount',_0x5ad3e7,JSON['stringify'](_0x18e021));_0x4d6647(_0x18e021);})[_0xfb1c('0x19')](function(_0x163089){logger[_0xfb1c('0xe')](_0xfb1c('0x1b'),_0x163089['message'],_0x5ad3e7);_0x5d7df3(_0x56c988[_0xfb1c('0xe')](0x1f4,_0x163089[_0xfb1c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 08483a4..d9ce998 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 _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x2ef3d4,_0x37ca5e){var _0x295f47=function(_0x1d413d){while(--_0x1d413d){_0x2ef3d4['push'](_0x2ef3d4['shift']());}};_0x295f47(++_0x37ca5e);}(_0xb10b,0x12a));var _0xbb10=function(_0xf62e6c,_0x160938){_0xf62e6c=_0xf62e6c-0x0;var _0x14234f=_0xb10b[_0xf62e6c];return _0x14234f;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x1a3980,_0x4ccf72){var _0x103407=function(_0x3af454){while(--_0x3af454){_0x1a3980['push'](_0x1a3980['shift']());}};_0x103407(++_0x4ccf72);}(_0xb10b,0x12a));var _0xbb10=function(_0xd8768,_0x3fedcb){_0xd8768=_0xd8768-0x0;var _0x46228f=_0xb10b[_0xd8768];return _0x46228f;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ede5ebe..9640bd4 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 _0xffc9=['sequelize','exports'];(function(_0x2d66bc,_0x20492b){var _0x44a28a=function(_0x4ddafc){while(--_0x4ddafc){_0x2d66bc['push'](_0x2d66bc['shift']());}};_0x44a28a(++_0x20492b);}(_0xffc9,0x1b4));var _0x9ffc=function(_0x1d9283,_0x2f3703){_0x1d9283=_0x1d9283-0x0;var _0x4b3d9f=_0xffc9[_0x1d9283];return _0x4b3d9f;};'use strict';var Sequelize=require(_0x9ffc('0x0'));module[_0x9ffc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x267d=['sequelize','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x267d,0x69));var _0xd267=function(_0x2fb852,_0x2cc429){_0x2fb852=_0x2fb852-0x0;var _0x5b3529=_0x267d[_0x2fb852];return _0x5b3529;};'use strict';var Sequelize=require(_0xd267('0x0'));module[_0xd267('0x1')]={'name':{'type':Sequelize[_0xd267('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ad3d3b7..4cf135f 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 _0xadec=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','send','index','map','fieldName','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','VtigerConfiguration','rows','params','keys','rawAttributes','find','create','body','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','squel','jsforce'];(function(_0x4043bd,_0x556f02){var _0x1db889=function(_0x5ce874){while(--_0x5ce874){_0x4043bd['push'](_0x4043bd['shift']());}};_0x1db889(++_0x556f02);}(_0xadec,0x156));var _0xcade=function(_0x29b7a6,_0x71a735){_0x29b7a6=_0x29b7a6-0x0;var _0x1add01=_0xadec[_0x29b7a6];return _0x1add01;};'use strict';var pdf=require(_0xcade('0x0'));var emlformat=require(_0xcade('0x1'));var rimraf=require(_0xcade('0x2'));var zipdir=require(_0xcade('0x3'));var jsonpatch=require(_0xcade('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcade('0x5'));var util=require(_0xcade('0x6'));var path=require(_0xcade('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcade('0x8'));var crypto=require('crypto');var jsforce=require(_0xcade('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcade('0xa'));var Papa=require(_0xcade('0xb'));var Redis=require(_0xcade('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcade('0xd'));var as=require(_0xcade('0xe'));var hardwareService=require(_0xcade('0xf'));var logger=require(_0xcade('0x10'))(_0xcade('0x11'));var utils=require(_0xcade('0x12'));var config=require(_0xcade('0x13'));var licenseUtil=require(_0xcade('0x14'));var db=require(_0xcade('0x15'))['db'];var jayson=require(_0xcade('0x16'));var client=jayson[_0xcade('0x17')][_0xcade('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2e2019,_0x40c5c7,_0x5a1af6,_0x31f018){return new BPromise(function(_0x33d794,_0x2c5976){var _0x53dfb8=_0x31f018||client;return _0x53dfb8[_0xcade('0x19')](_0x2e2019,_0x5a1af6)[_0xcade('0x1a')](function(_0x4be206){logger[_0xcade('0x1b')](_0xcade('0x1c'),_0x40c5c7,_0xcade('0x1d'));logger['debug'](_0xcade('0x1e'),_0x40c5c7,_0xcade('0x1d'),JSON[_0xcade('0x1f')](_0x4be206));if(_0x4be206['error']){if(_0x4be206[_0xcade('0x20')][_0xcade('0x21')]===0x1f4){logger[_0xcade('0x20')](_0xcade('0x1c'),_0x40c5c7,_0x4be206[_0xcade('0x20')][_0xcade('0x22')]);return _0x2c5976(_0x4be206[_0xcade('0x20')]['message']);}logger[_0xcade('0x20')](_0xcade('0x1c'),_0x40c5c7,_0x4be206[_0xcade('0x20')][_0xcade('0x22')]);return _0x33d794(_0x4be206[_0xcade('0x20')]['message']);}else{logger['info'](_0xcade('0x1c'),_0x40c5c7,'request\x20sent');_0x33d794(_0x4be206[_0xcade('0x23')][_0xcade('0x22')]);}})[_0xcade('0x24')](function(_0x2a0e07){logger[_0xcade('0x20')](_0xcade('0x1c'),_0x40c5c7,_0x2a0e07);_0x2c5976(_0x2a0e07);});});}function respondWithStatusCode(_0x102e12,_0x264df7){_0x264df7=_0x264df7||0xcc;return function(_0x356c91){if(_0x356c91){return _0x102e12[_0xcade('0x25')](_0x264df7);}return _0x102e12[_0xcade('0x26')](_0x264df7)[_0xcade('0x27')]();};}function respondWithResult(_0x598a20,_0x4139b3){_0x4139b3=_0x4139b3||0xc8;return function(_0x37e1dc){if(_0x37e1dc){return _0x598a20['status'](_0x4139b3)[_0xcade('0x28')](_0x37e1dc);}};}function respondWithFilteredResult(_0x25cf6a,_0x468302){return function(_0x264f53){if(_0x264f53){var _0xca2941=_0x264f53[_0xcade('0x29')],_0x1c77f1=_0x468302[_0xcade('0x2a')],_0xf8e810=_0x468302[_0xcade('0x2a')]+_0x468302[_0xcade('0x2b')],_0x4bbe2a;if(_0xf8e810>=_0xca2941){_0xf8e810=_0xca2941;_0x4bbe2a=0xc8;}else{_0x4bbe2a=0xce;}_0x25cf6a[_0xcade('0x26')](_0x4bbe2a);return _0x25cf6a[_0xcade('0x2c')](_0xcade('0x2d'),_0x1c77f1+'-'+_0xf8e810+'/'+_0xca2941)[_0xcade('0x28')](_0x264f53);}return null;};}function patchUpdates(_0x494490){return function(_0x39ae05){try{jsonpatch[_0xcade('0x2e')](_0x39ae05,_0x494490,!![]);}catch(_0x3d1eb1){return BPromise[_0xcade('0x2f')](_0x3d1eb1);}return _0x39ae05['save']();};}function saveUpdates(_0x4d2884,_0xe83cc3){return function(_0x223622){if(_0x223622){return _0x223622[_0xcade('0x30')](_0x4d2884)[_0xcade('0x1a')](function(_0x13ac98){return _0x13ac98;});}return null;};}function removeEntity(_0x4eac69,_0x217f3d){return function(_0x40564d){if(_0x40564d){return _0x40564d[_0xcade('0x31')]()[_0xcade('0x1a')](function(){_0x4eac69['status'](0xcc)[_0xcade('0x27')]();});}};}function handleEntityNotFound(_0xbe431,_0x2f489b){return function(_0xc6fe52){if(!_0xc6fe52){_0xbe431[_0xcade('0x25')](0x194);}return _0xc6fe52;};}function handleError(_0x1abd15,_0x4821d2){_0x4821d2=_0x4821d2||0x1f4;return function(_0x5363cc){logger[_0xcade('0x20')](_0x5363cc['stack']);if(_0x5363cc[_0xcade('0x32')]){delete _0x5363cc[_0xcade('0x32')];}_0x1abd15[_0xcade('0x26')](_0x4821d2)[_0xcade('0x33')](_0x5363cc);};}exports[_0xcade('0x34')]=function(_0x2aae69,_0x3727d5){var _0x388ec4={},_0x142f04={},_0x3dc0ad={'count':0x0,'rows':[]};var _0xeb678d=_[_0xcade('0x35')](db['VtigerConfiguration']['rawAttributes'],function(_0x53d5a8){return{'name':_0x53d5a8[_0xcade('0x36')],'type':_0x53d5a8['type'][_0xcade('0x37')]};});_0x142f04['model']=_['map'](_0xeb678d,'name');_0x142f04['query']=_['keys'](_0x2aae69[_0xcade('0x38')]);_0x142f04['filters']=_[_0xcade('0x39')](_0x142f04['model'],_0x142f04[_0xcade('0x38')]);_0x388ec4[_0xcade('0x3a')]=_[_0xcade('0x39')](_0x142f04[_0xcade('0x3b')],qs[_0xcade('0x3c')](_0x2aae69[_0xcade('0x38')]['fields']));_0x388ec4[_0xcade('0x3a')]=_0x388ec4[_0xcade('0x3a')][_0xcade('0x3d')]?_0x388ec4['attributes']:_0x142f04[_0xcade('0x3b')];if(!_0x2aae69[_0xcade('0x38')]['hasOwnProperty'](_0xcade('0x3e'))){_0x388ec4[_0xcade('0x2b')]=qs['limit'](_0x2aae69[_0xcade('0x38')][_0xcade('0x2b')]);_0x388ec4['offset']=qs[_0xcade('0x2a')](_0x2aae69[_0xcade('0x38')]['offset']);}_0x388ec4[_0xcade('0x3f')]=qs[_0xcade('0x40')](_0x2aae69[_0xcade('0x38')][_0xcade('0x40')]);_0x388ec4[_0xcade('0x41')]=qs[_0xcade('0x42')](_[_0xcade('0x43')](_0x2aae69[_0xcade('0x38')],_0x142f04[_0xcade('0x42')]),_0xeb678d);if(_0x2aae69[_0xcade('0x38')][_0xcade('0x44')]){_0x388ec4['where']=_[_0xcade('0x45')](_0x388ec4['where'],{'$or':_[_0xcade('0x35')](_0xeb678d,function(_0x2efd65){if(_0x2efd65[_0xcade('0x46')]!=='VIRTUAL'){var _0xcbb5db={};_0xcbb5db[_0x2efd65[_0xcade('0x32')]]={'$like':'%'+_0x2aae69[_0xcade('0x38')][_0xcade('0x44')]+'%'};return _0xcbb5db;}})});}_0x388ec4=_[_0xcade('0x45')]({},_0x388ec4,_0x2aae69[_0xcade('0x47')]);var _0x4bee0a={'where':_0x388ec4['where']};return db['VtigerConfiguration'][_0xcade('0x29')](_0x4bee0a)[_0xcade('0x1a')](function(_0x1161d9){_0x3dc0ad[_0xcade('0x29')]=_0x1161d9;if(_0x2aae69['query'][_0xcade('0x48')]){_0x388ec4[_0xcade('0x49')]=[{'all':!![]}];}return db[_0xcade('0x4a')]['findAll'](_0x388ec4);})['then'](function(_0x44010e){_0x3dc0ad[_0xcade('0x4b')]=_0x44010e;return _0x3dc0ad;})[_0xcade('0x1a')](respondWithFilteredResult(_0x3727d5,_0x388ec4))[_0xcade('0x24')](handleError(_0x3727d5,null));};exports['show']=function(_0xab6d57,_0x18bb5a){var _0x350b01={'raw':![],'where':{'id':_0xab6d57[_0xcade('0x4c')]['id']}},_0x2a30f5={};_0x2a30f5[_0xcade('0x3b')]=_[_0xcade('0x4d')](db['VtigerConfiguration'][_0xcade('0x4e')]);_0x2a30f5[_0xcade('0x38')]=_[_0xcade('0x4d')](_0xab6d57[_0xcade('0x38')]);_0x2a30f5['filters']=_[_0xcade('0x39')](_0x2a30f5[_0xcade('0x3b')],_0x2a30f5[_0xcade('0x38')]);_0x350b01[_0xcade('0x3a')]=_[_0xcade('0x39')](_0x2a30f5[_0xcade('0x3b')],qs[_0xcade('0x3c')](_0xab6d57[_0xcade('0x38')][_0xcade('0x3c')]));_0x350b01[_0xcade('0x3a')]=_0x350b01[_0xcade('0x3a')]['length']?_0x350b01[_0xcade('0x3a')]:_0x2a30f5[_0xcade('0x3b')];if(_0xab6d57['query'][_0xcade('0x48')]){_0x350b01['include']=[{'all':!![]}];}_0x350b01=_[_0xcade('0x45')]({},_0x350b01,_0xab6d57[_0xcade('0x47')]);return db['VtigerConfiguration'][_0xcade('0x4f')](_0x350b01)[_0xcade('0x1a')](handleEntityNotFound(_0x18bb5a,null))['then'](respondWithResult(_0x18bb5a,null))[_0xcade('0x24')](handleError(_0x18bb5a,null));};exports[_0xcade('0x50')]=function(_0x380832,_0x533908){return db[_0xcade('0x4a')][_0xcade('0x50')](_0x380832[_0xcade('0x51')],{})[_0xcade('0x1a')](respondWithResult(_0x533908,0xc9))[_0xcade('0x24')](handleError(_0x533908,null));};exports[_0xcade('0x30')]=function(_0x11b6c5,_0x584f70){if(_0x11b6c5[_0xcade('0x51')]['id']){delete _0x11b6c5['body']['id'];}return db['VtigerConfiguration'][_0xcade('0x4f')]({'where':{'id':_0x11b6c5[_0xcade('0x4c')]['id']}})[_0xcade('0x1a')](handleEntityNotFound(_0x584f70,null))['then'](saveUpdates(_0x11b6c5[_0xcade('0x51')],null))[_0xcade('0x1a')](respondWithResult(_0x584f70,null))['catch'](handleError(_0x584f70,null));};exports[_0xcade('0x31')]=function(_0x196e5c,_0x13002d){return db['VtigerConfiguration'][_0xcade('0x4f')]({'where':{'id':_0x196e5c[_0xcade('0x4c')]['id']}})[_0xcade('0x1a')](handleEntityNotFound(_0x13002d,null))[_0xcade('0x1a')](removeEntity(_0x13002d,null))['catch'](handleError(_0x13002d,null));};exports[_0xcade('0x52')]=function(_0x4f6b85,_0x40ef90,_0xc8bed0){var _0x2577b7={};var _0x2198ed={};var _0x77aea3;var _0x2aa914;return db[_0xcade('0x4a')][_0xcade('0x53')]({'where':{'id':_0x4f6b85[_0xcade('0x4c')]['id']}})[_0xcade('0x1a')](handleEntityNotFound(_0x40ef90,null))['then'](function(_0x39c467){if(_0x39c467){_0x77aea3=_0x39c467;_0x2198ed[_0xcade('0x3b')]=_[_0xcade('0x4d')](db[_0xcade('0x54')][_0xcade('0x4e')]);_0x2198ed['query']=_['keys'](_0x4f6b85[_0xcade('0x38')]);_0x2198ed[_0xcade('0x42')]=_['intersection'](_0x2198ed[_0xcade('0x3b')],_0x2198ed['query']);_0x2577b7[_0xcade('0x3a')]=_[_0xcade('0x39')](_0x2198ed[_0xcade('0x3b')],qs[_0xcade('0x3c')](_0x4f6b85[_0xcade('0x38')][_0xcade('0x3c')]));_0x2577b7[_0xcade('0x3a')]=_0x2577b7[_0xcade('0x3a')][_0xcade('0x3d')]?_0x2577b7[_0xcade('0x3a')]:_0x2198ed[_0xcade('0x3b')];_0x2577b7[_0xcade('0x3f')]=qs[_0xcade('0x40')](_0x4f6b85[_0xcade('0x38')][_0xcade('0x40')]);_0x2577b7['where']=qs['filters'](_['pick'](_0x4f6b85[_0xcade('0x38')],_0x2198ed['filters']));if(_0x4f6b85['query'][_0xcade('0x44')]){_0x2577b7[_0xcade('0x41')]=_[_0xcade('0x45')](_0x2577b7[_0xcade('0x41')],{'$or':_[_0xcade('0x35')](_0x2577b7[_0xcade('0x3a')],function(_0x7a3ada){var _0x3c4af6={};_0x3c4af6[_0x7a3ada]={'$like':'%'+_0x4f6b85[_0xcade('0x38')][_0xcade('0x44')]+'%'};return _0x3c4af6;})});}_0x2577b7=_['merge']({},_0x2577b7,_0x4f6b85[_0xcade('0x47')]);return _0x77aea3[_0xcade('0x52')](_0x2577b7);}})['then'](function(_0x57620e){if(_0x57620e){_0x2aa914=_0x57620e[_0xcade('0x3d')];if(!_0x4f6b85[_0xcade('0x38')][_0xcade('0x55')]('nolimit')){_0x2577b7[_0xcade('0x2b')]=qs[_0xcade('0x2b')](_0x4f6b85[_0xcade('0x38')][_0xcade('0x2b')]);_0x2577b7['offset']=qs[_0xcade('0x2a')](_0x4f6b85[_0xcade('0x38')][_0xcade('0x2a')]);}return _0x77aea3['getFields'](_0x2577b7);}})[_0xcade('0x1a')](function(_0xa45466){if(_0xa45466){return _0xa45466?{'count':_0x2aa914,'rows':_0xa45466}:null;}})['then'](respondWithResult(_0x40ef90,null))[_0xcade('0x24')](handleError(_0x40ef90,null));};exports['getSubjects']=function(_0x29456f,_0x28e91b,_0x433eec){var _0x50cf70={};var _0xda52af={};var _0x2802a1;var _0x3b2cc2;return db[_0xcade('0x4a')][_0xcade('0x53')]({'where':{'id':_0x29456f[_0xcade('0x4c')]['id']}})[_0xcade('0x1a')](handleEntityNotFound(_0x28e91b,null))[_0xcade('0x1a')](function(_0x2d49c2){if(_0x2d49c2){_0x2802a1=_0x2d49c2;_0xda52af[_0xcade('0x3b')]=_['keys'](db[_0xcade('0x54')]['rawAttributes']);_0xda52af[_0xcade('0x38')]=_[_0xcade('0x4d')](_0x29456f[_0xcade('0x38')]);_0xda52af[_0xcade('0x42')]=_[_0xcade('0x39')](_0xda52af[_0xcade('0x3b')],_0xda52af[_0xcade('0x38')]);_0x50cf70['attributes']=_[_0xcade('0x39')](_0xda52af['model'],qs[_0xcade('0x3c')](_0x29456f['query']['fields']));_0x50cf70[_0xcade('0x3a')]=_0x50cf70[_0xcade('0x3a')][_0xcade('0x3d')]?_0x50cf70[_0xcade('0x3a')]:_0xda52af[_0xcade('0x3b')];_0x50cf70[_0xcade('0x3f')]=qs[_0xcade('0x40')](_0x29456f[_0xcade('0x38')]['sort']);_0x50cf70[_0xcade('0x41')]=qs[_0xcade('0x42')](_[_0xcade('0x43')](_0x29456f[_0xcade('0x38')],_0xda52af[_0xcade('0x42')]));if(_0x29456f[_0xcade('0x38')]['filter']){_0x50cf70[_0xcade('0x41')]=_['merge'](_0x50cf70[_0xcade('0x41')],{'$or':_[_0xcade('0x35')](_0x50cf70[_0xcade('0x3a')],function(_0x25ca25){var _0x1875aa={};_0x1875aa[_0x25ca25]={'$like':'%'+_0x29456f[_0xcade('0x38')][_0xcade('0x44')]+'%'};return _0x1875aa;})});}_0x50cf70=_[_0xcade('0x45')]({},_0x50cf70,_0x29456f[_0xcade('0x47')]);return _0x2802a1[_0xcade('0x56')](_0x50cf70);}})[_0xcade('0x1a')](function(_0x37e38c){if(_0x37e38c){_0x3b2cc2=_0x37e38c[_0xcade('0x3d')];if(!_0x29456f[_0xcade('0x38')][_0xcade('0x55')]('nolimit')){_0x50cf70[_0xcade('0x2b')]=qs[_0xcade('0x2b')](_0x29456f[_0xcade('0x38')][_0xcade('0x2b')]);_0x50cf70['offset']=qs[_0xcade('0x2a')](_0x29456f['query'][_0xcade('0x2a')]);}return _0x2802a1[_0xcade('0x56')](_0x50cf70);}})[_0xcade('0x1a')](function(_0x6620d8){if(_0x6620d8){return _0x6620d8?{'count':_0x3b2cc2,'rows':_0x6620d8}:null;}})['then'](respondWithResult(_0x28e91b,null))['catch'](handleError(_0x28e91b,null));};exports[_0xcade('0x57')]=function(_0x847f42,_0xaeb5c,_0x5ca84c){var _0x2b5575={};var _0x472bcb={};var _0x3a7e1a;var _0x5f837;return db['VtigerConfiguration'][_0xcade('0x53')]({'where':{'id':_0x847f42[_0xcade('0x4c')]['id']}})[_0xcade('0x1a')](handleEntityNotFound(_0xaeb5c,null))[_0xcade('0x1a')](function(_0x19a145){if(_0x19a145){_0x3a7e1a=_0x19a145;_0x472bcb[_0xcade('0x3b')]=_[_0xcade('0x4d')](db[_0xcade('0x54')][_0xcade('0x4e')]);_0x472bcb[_0xcade('0x38')]=_[_0xcade('0x4d')](_0x847f42[_0xcade('0x38')]);_0x472bcb[_0xcade('0x42')]=_[_0xcade('0x39')](_0x472bcb[_0xcade('0x3b')],_0x472bcb[_0xcade('0x38')]);_0x2b5575[_0xcade('0x3a')]=_['intersection'](_0x472bcb[_0xcade('0x3b')],qs['fields'](_0x847f42['query']['fields']));_0x2b5575[_0xcade('0x3a')]=_0x2b5575[_0xcade('0x3a')][_0xcade('0x3d')]?_0x2b5575[_0xcade('0x3a')]:_0x472bcb[_0xcade('0x3b')];_0x2b5575[_0xcade('0x3f')]=qs['sort'](_0x847f42[_0xcade('0x38')]['sort']);_0x2b5575[_0xcade('0x41')]=qs[_0xcade('0x42')](_['pick'](_0x847f42[_0xcade('0x38')],_0x472bcb[_0xcade('0x42')]));if(_0x847f42[_0xcade('0x38')][_0xcade('0x44')]){_0x2b5575[_0xcade('0x41')]=_[_0xcade('0x45')](_0x2b5575[_0xcade('0x41')],{'$or':_[_0xcade('0x35')](_0x2b5575[_0xcade('0x3a')],function(_0x3b290c){var _0x216324={};_0x216324[_0x3b290c]={'$like':'%'+_0x847f42['query'][_0xcade('0x44')]+'%'};return _0x216324;})});}_0x2b5575=_[_0xcade('0x45')]({},_0x2b5575,_0x847f42['options']);return _0x3a7e1a[_0xcade('0x57')](_0x2b5575);}})[_0xcade('0x1a')](function(_0x19f928){if(_0x19f928){_0x5f837=_0x19f928[_0xcade('0x3d')];if(!_0x847f42[_0xcade('0x38')][_0xcade('0x55')](_0xcade('0x3e'))){_0x2b5575[_0xcade('0x2b')]=qs[_0xcade('0x2b')](_0x847f42[_0xcade('0x38')][_0xcade('0x2b')]);_0x2b5575[_0xcade('0x2a')]=qs[_0xcade('0x2a')](_0x847f42['query']['offset']);}return _0x3a7e1a[_0xcade('0x57')](_0x2b5575);}})[_0xcade('0x1a')](function(_0x582d10){if(_0x582d10){return _0x582d10?{'count':_0x5f837,'rows':_0x582d10}:null;}})[_0xcade('0x1a')](respondWithResult(_0xaeb5c,null))[_0xcade('0x24')](handleError(_0xaeb5c,null));}; \ No newline at end of file +var _0xe713=['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','../../config/utils','../../config/license/util','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','VtigerField','sort','filter','getFields','findOne','getSubjects','hasOwnProperty','filters','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0xddae14,_0x11dacd){var _0x554a75=function(_0xa2c2ef){while(--_0xa2c2ef){_0xddae14['push'](_0xddae14['shift']());}};_0x554a75(++_0x11dacd);}(_0xe713,0x164));var _0x3e71=function(_0x5a14d2,_0x22b89a){_0x5a14d2=_0x5a14d2-0x0;var _0xb08187=_0xe713[_0x5a14d2];return _0xb08187;};'use strict';var pdf=require(_0x3e71('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e71('0x1'));var jsonpatch=require(_0x3e71('0x2'));var rp=require(_0x3e71('0x3'));var moment=require(_0x3e71('0x4'));var BPromise=require(_0x3e71('0x5'));var Mustache=require(_0x3e71('0x6'));var util=require('util');var path=require(_0x3e71('0x7'));var sox=require(_0x3e71('0x8'));var csv=require(_0x3e71('0x9'));var ejs=require(_0x3e71('0xa'));var fs=require('fs');var _=require(_0x3e71('0xb'));var squel=require(_0x3e71('0xc'));var crypto=require(_0x3e71('0xd'));var jsforce=require(_0x3e71('0xe'));var deskjs=require(_0x3e71('0xf'));var toCsv=require(_0x3e71('0x9'));var querystring=require(_0x3e71('0x10'));var Papa=require(_0x3e71('0x11'));var Redis=require(_0x3e71('0x12'));var authService=require(_0x3e71('0x13'));var qs=require(_0x3e71('0x14'));var as=require(_0x3e71('0x15'));var hardwareService=require(_0x3e71('0x16'));var logger=require(_0x3e71('0x17'))('api');var utils=require(_0x3e71('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3e71('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3e71('0x1a')][_0x3e71('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x25d95c,_0x4d51db,_0xc4c8c1,_0x5c45ec){return new BPromise(function(_0x59de69,_0x143046){var _0x59f835=_0x5c45ec||client;return _0x59f835['request'](_0x25d95c,_0xc4c8c1)[_0x3e71('0x1c')](function(_0x15a242){logger[_0x3e71('0x1d')](_0x3e71('0x1e'),_0x4d51db,'request\x20sent');logger['debug'](_0x3e71('0x1f'),_0x4d51db,_0x3e71('0x20'),JSON['stringify'](_0x15a242));if(_0x15a242[_0x3e71('0x21')]){if(_0x15a242['error']['code']===0x1f4){logger[_0x3e71('0x21')](_0x3e71('0x1e'),_0x4d51db,_0x15a242[_0x3e71('0x21')][_0x3e71('0x22')]);return _0x143046(_0x15a242[_0x3e71('0x21')][_0x3e71('0x22')]);}logger[_0x3e71('0x21')](_0x3e71('0x1e'),_0x4d51db,_0x15a242[_0x3e71('0x21')][_0x3e71('0x22')]);return _0x59de69(_0x15a242[_0x3e71('0x21')]['message']);}else{logger[_0x3e71('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d51db,'request\x20sent');_0x59de69(_0x15a242[_0x3e71('0x23')][_0x3e71('0x22')]);}})['catch'](function(_0x223afb){logger['error'](_0x3e71('0x1e'),_0x4d51db,_0x223afb);_0x143046(_0x223afb);});});}function respondWithStatusCode(_0x3a8a24,_0x1fba4d){_0x1fba4d=_0x1fba4d||0xcc;return function(_0x246ae1){if(_0x246ae1){return _0x3a8a24['sendStatus'](_0x1fba4d);}return _0x3a8a24[_0x3e71('0x24')](_0x1fba4d)['end']();};}function respondWithResult(_0xce815f,_0x55ed64){_0x55ed64=_0x55ed64||0xc8;return function(_0x1adacf){if(_0x1adacf){return _0xce815f['status'](_0x55ed64)[_0x3e71('0x25')](_0x1adacf);}};}function respondWithFilteredResult(_0x1c0ff1,_0x5edf8f){return function(_0x52f814){if(_0x52f814){var _0x408bc9=_0x52f814[_0x3e71('0x26')],_0x2712da=_0x5edf8f['offset'],_0x587f2b=_0x5edf8f[_0x3e71('0x27')]+_0x5edf8f[_0x3e71('0x28')],_0x23adb8;if(_0x587f2b>=_0x408bc9){_0x587f2b=_0x408bc9;_0x23adb8=0xc8;}else{_0x23adb8=0xce;}_0x1c0ff1['status'](_0x23adb8);return _0x1c0ff1[_0x3e71('0x29')](_0x3e71('0x2a'),_0x2712da+'-'+_0x587f2b+'/'+_0x408bc9)[_0x3e71('0x25')](_0x52f814);}return null;};}function patchUpdates(_0x200c67){return function(_0x2a9f11){try{jsonpatch['apply'](_0x2a9f11,_0x200c67,!![]);}catch(_0x14650b){return BPromise[_0x3e71('0x2b')](_0x14650b);}return _0x2a9f11[_0x3e71('0x2c')]();};}function saveUpdates(_0x5f0996,_0x2c2856){return function(_0x481f31){if(_0x481f31){return _0x481f31[_0x3e71('0x2d')](_0x5f0996)['then'](function(_0x2352b5){return _0x2352b5;});}return null;};}function removeEntity(_0x2ad954,_0x1f8d5b){return function(_0x56f30a){if(_0x56f30a){return _0x56f30a[_0x3e71('0x2e')]()[_0x3e71('0x1c')](function(){_0x2ad954[_0x3e71('0x24')](0xcc)[_0x3e71('0x2f')]();});}};}function handleEntityNotFound(_0x510339,_0xfe93ba){return function(_0x7e8b15){if(!_0x7e8b15){_0x510339[_0x3e71('0x30')](0x194);}return _0x7e8b15;};}function handleError(_0x356eed,_0xfaff23){_0xfaff23=_0xfaff23||0x1f4;return function(_0x34de6e){logger[_0x3e71('0x21')](_0x34de6e[_0x3e71('0x31')]);if(_0x34de6e[_0x3e71('0x32')]){delete _0x34de6e[_0x3e71('0x32')];}_0x356eed[_0x3e71('0x24')](_0xfaff23)[_0x3e71('0x33')](_0x34de6e);};}exports['index']=function(_0x3deb1d,_0x21e5de){var _0x18f8e2={},_0x33d46a={},_0x13d4d0={'count':0x0,'rows':[]};var _0x43a9fd=_['map'](db['VtigerConfiguration'][_0x3e71('0x34')],function(_0xda663){return{'name':_0xda663[_0x3e71('0x35')],'type':_0xda663[_0x3e71('0x36')][_0x3e71('0x37')]};});_0x33d46a[_0x3e71('0x38')]=_[_0x3e71('0x39')](_0x43a9fd,_0x3e71('0x32'));_0x33d46a[_0x3e71('0x3a')]=_[_0x3e71('0x3b')](_0x3deb1d['query']);_0x33d46a['filters']=_[_0x3e71('0x3c')](_0x33d46a[_0x3e71('0x38')],_0x33d46a[_0x3e71('0x3a')]);_0x18f8e2[_0x3e71('0x3d')]=_[_0x3e71('0x3c')](_0x33d46a[_0x3e71('0x38')],qs[_0x3e71('0x3e')](_0x3deb1d[_0x3e71('0x3a')][_0x3e71('0x3e')]));_0x18f8e2[_0x3e71('0x3d')]=_0x18f8e2[_0x3e71('0x3d')][_0x3e71('0x3f')]?_0x18f8e2[_0x3e71('0x3d')]:_0x33d46a[_0x3e71('0x38')];if(!_0x3deb1d[_0x3e71('0x3a')]['hasOwnProperty'](_0x3e71('0x40'))){_0x18f8e2[_0x3e71('0x28')]=qs[_0x3e71('0x28')](_0x3deb1d[_0x3e71('0x3a')]['limit']);_0x18f8e2[_0x3e71('0x27')]=qs[_0x3e71('0x27')](_0x3deb1d[_0x3e71('0x3a')][_0x3e71('0x27')]);}_0x18f8e2[_0x3e71('0x41')]=qs['sort'](_0x3deb1d['query']['sort']);_0x18f8e2[_0x3e71('0x42')]=qs['filters'](_[_0x3e71('0x43')](_0x3deb1d[_0x3e71('0x3a')],_0x33d46a['filters']),_0x43a9fd);if(_0x3deb1d[_0x3e71('0x3a')]['filter']){_0x18f8e2[_0x3e71('0x42')]=_[_0x3e71('0x44')](_0x18f8e2['where'],{'$or':_[_0x3e71('0x39')](_0x43a9fd,function(_0x25fcfa){if(_0x25fcfa['type']!==_0x3e71('0x45')){var _0x44ed18={};_0x44ed18[_0x25fcfa[_0x3e71('0x32')]]={'$like':'%'+_0x3deb1d[_0x3e71('0x3a')]['filter']+'%'};return _0x44ed18;}})});}_0x18f8e2=_['merge']({},_0x18f8e2,_0x3deb1d[_0x3e71('0x46')]);var _0x4ba6a3={'where':_0x18f8e2[_0x3e71('0x42')]};return db[_0x3e71('0x47')]['count'](_0x4ba6a3)['then'](function(_0x27baad){_0x13d4d0[_0x3e71('0x26')]=_0x27baad;if(_0x3deb1d['query'][_0x3e71('0x48')]){_0x18f8e2[_0x3e71('0x49')]=[{'all':!![]}];}return db[_0x3e71('0x47')][_0x3e71('0x4a')](_0x18f8e2);})[_0x3e71('0x1c')](function(_0xfcd83b){_0x13d4d0[_0x3e71('0x4b')]=_0xfcd83b;return _0x13d4d0;})['then'](respondWithFilteredResult(_0x21e5de,_0x18f8e2))[_0x3e71('0x4c')](handleError(_0x21e5de,null));};exports[_0x3e71('0x4d')]=function(_0x354a7f,_0x2014ac){var _0x5e8c6d={'raw':![],'where':{'id':_0x354a7f[_0x3e71('0x4e')]['id']}},_0x5105d9={};_0x5105d9[_0x3e71('0x38')]=_['keys'](db[_0x3e71('0x47')][_0x3e71('0x34')]);_0x5105d9[_0x3e71('0x3a')]=_[_0x3e71('0x3b')](_0x354a7f[_0x3e71('0x3a')]);_0x5105d9['filters']=_[_0x3e71('0x3c')](_0x5105d9['model'],_0x5105d9[_0x3e71('0x3a')]);_0x5e8c6d[_0x3e71('0x3d')]=_[_0x3e71('0x3c')](_0x5105d9['model'],qs['fields'](_0x354a7f[_0x3e71('0x3a')]['fields']));_0x5e8c6d[_0x3e71('0x3d')]=_0x5e8c6d['attributes']['length']?_0x5e8c6d[_0x3e71('0x3d')]:_0x5105d9[_0x3e71('0x38')];if(_0x354a7f['query'][_0x3e71('0x48')]){_0x5e8c6d[_0x3e71('0x49')]=[{'all':!![]}];}_0x5e8c6d=_[_0x3e71('0x44')]({},_0x5e8c6d,_0x354a7f[_0x3e71('0x46')]);return db[_0x3e71('0x47')][_0x3e71('0x4f')](_0x5e8c6d)[_0x3e71('0x1c')](handleEntityNotFound(_0x2014ac,null))[_0x3e71('0x1c')](respondWithResult(_0x2014ac,null))[_0x3e71('0x4c')](handleError(_0x2014ac,null));};exports[_0x3e71('0x50')]=function(_0x428c3f,_0x255410){return db[_0x3e71('0x47')][_0x3e71('0x50')](_0x428c3f[_0x3e71('0x51')],{})['then'](respondWithResult(_0x255410,0xc9))[_0x3e71('0x4c')](handleError(_0x255410,null));};exports[_0x3e71('0x2d')]=function(_0x451f44,_0x43997b){if(_0x451f44['body']['id']){delete _0x451f44[_0x3e71('0x51')]['id'];}return db[_0x3e71('0x47')]['find']({'where':{'id':_0x451f44['params']['id']}})[_0x3e71('0x1c')](handleEntityNotFound(_0x43997b,null))['then'](saveUpdates(_0x451f44[_0x3e71('0x51')],null))[_0x3e71('0x1c')](respondWithResult(_0x43997b,null))[_0x3e71('0x4c')](handleError(_0x43997b,null));};exports[_0x3e71('0x2e')]=function(_0x5dea37,_0x266b21){return db[_0x3e71('0x47')][_0x3e71('0x4f')]({'where':{'id':_0x5dea37[_0x3e71('0x4e')]['id']}})[_0x3e71('0x1c')](handleEntityNotFound(_0x266b21,null))[_0x3e71('0x1c')](removeEntity(_0x266b21,null))[_0x3e71('0x4c')](handleError(_0x266b21,null));};exports['getFields']=function(_0x18aa33,_0x2ff6e5,_0x4a4c79){var _0x33a2f8={};var _0xec2e73={};var _0x5c618f;var _0xc281c7;return db[_0x3e71('0x47')]['findOne']({'where':{'id':_0x18aa33[_0x3e71('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2ff6e5,null))[_0x3e71('0x1c')](function(_0x4aab5d){if(_0x4aab5d){_0x5c618f=_0x4aab5d;_0xec2e73[_0x3e71('0x38')]=_[_0x3e71('0x3b')](db[_0x3e71('0x52')]['rawAttributes']);_0xec2e73[_0x3e71('0x3a')]=_[_0x3e71('0x3b')](_0x18aa33[_0x3e71('0x3a')]);_0xec2e73['filters']=_[_0x3e71('0x3c')](_0xec2e73[_0x3e71('0x38')],_0xec2e73['query']);_0x33a2f8[_0x3e71('0x3d')]=_[_0x3e71('0x3c')](_0xec2e73[_0x3e71('0x38')],qs['fields'](_0x18aa33[_0x3e71('0x3a')][_0x3e71('0x3e')]));_0x33a2f8[_0x3e71('0x3d')]=_0x33a2f8[_0x3e71('0x3d')][_0x3e71('0x3f')]?_0x33a2f8['attributes']:_0xec2e73[_0x3e71('0x38')];_0x33a2f8[_0x3e71('0x41')]=qs[_0x3e71('0x53')](_0x18aa33[_0x3e71('0x3a')][_0x3e71('0x53')]);_0x33a2f8['where']=qs['filters'](_[_0x3e71('0x43')](_0x18aa33[_0x3e71('0x3a')],_0xec2e73['filters']));if(_0x18aa33[_0x3e71('0x3a')][_0x3e71('0x54')]){_0x33a2f8[_0x3e71('0x42')]=_[_0x3e71('0x44')](_0x33a2f8[_0x3e71('0x42')],{'$or':_['map'](_0x33a2f8[_0x3e71('0x3d')],function(_0x44a5d3){var _0x129551={};_0x129551[_0x44a5d3]={'$like':'%'+_0x18aa33[_0x3e71('0x3a')][_0x3e71('0x54')]+'%'};return _0x129551;})});}_0x33a2f8=_[_0x3e71('0x44')]({},_0x33a2f8,_0x18aa33['options']);return _0x5c618f[_0x3e71('0x55')](_0x33a2f8);}})[_0x3e71('0x1c')](function(_0x1955ce){if(_0x1955ce){_0xc281c7=_0x1955ce[_0x3e71('0x3f')];if(!_0x18aa33[_0x3e71('0x3a')]['hasOwnProperty']('nolimit')){_0x33a2f8[_0x3e71('0x28')]=qs[_0x3e71('0x28')](_0x18aa33[_0x3e71('0x3a')][_0x3e71('0x28')]);_0x33a2f8[_0x3e71('0x27')]=qs[_0x3e71('0x27')](_0x18aa33['query']['offset']);}return _0x5c618f['getFields'](_0x33a2f8);}})[_0x3e71('0x1c')](function(_0x2576b5){if(_0x2576b5){return _0x2576b5?{'count':_0xc281c7,'rows':_0x2576b5}:null;}})['then'](respondWithResult(_0x2ff6e5,null))[_0x3e71('0x4c')](handleError(_0x2ff6e5,null));};exports['getSubjects']=function(_0x219465,_0x1b1b1e,_0x2c4656){var _0x423d00={};var _0xad8552={};var _0x29da21;var _0x3ab349;return db[_0x3e71('0x47')][_0x3e71('0x56')]({'where':{'id':_0x219465[_0x3e71('0x4e')]['id']}})[_0x3e71('0x1c')](handleEntityNotFound(_0x1b1b1e,null))[_0x3e71('0x1c')](function(_0x5f4568){if(_0x5f4568){_0x29da21=_0x5f4568;_0xad8552[_0x3e71('0x38')]=_[_0x3e71('0x3b')](db[_0x3e71('0x52')][_0x3e71('0x34')]);_0xad8552[_0x3e71('0x3a')]=_[_0x3e71('0x3b')](_0x219465[_0x3e71('0x3a')]);_0xad8552['filters']=_[_0x3e71('0x3c')](_0xad8552[_0x3e71('0x38')],_0xad8552[_0x3e71('0x3a')]);_0x423d00['attributes']=_['intersection'](_0xad8552['model'],qs[_0x3e71('0x3e')](_0x219465[_0x3e71('0x3a')]['fields']));_0x423d00[_0x3e71('0x3d')]=_0x423d00[_0x3e71('0x3d')][_0x3e71('0x3f')]?_0x423d00[_0x3e71('0x3d')]:_0xad8552['model'];_0x423d00[_0x3e71('0x41')]=qs['sort'](_0x219465[_0x3e71('0x3a')]['sort']);_0x423d00[_0x3e71('0x42')]=qs['filters'](_[_0x3e71('0x43')](_0x219465[_0x3e71('0x3a')],_0xad8552['filters']));if(_0x219465[_0x3e71('0x3a')]['filter']){_0x423d00[_0x3e71('0x42')]=_[_0x3e71('0x44')](_0x423d00[_0x3e71('0x42')],{'$or':_[_0x3e71('0x39')](_0x423d00['attributes'],function(_0x1555e6){var _0x1924d6={};_0x1924d6[_0x1555e6]={'$like':'%'+_0x219465[_0x3e71('0x3a')][_0x3e71('0x54')]+'%'};return _0x1924d6;})});}_0x423d00=_['merge']({},_0x423d00,_0x219465[_0x3e71('0x46')]);return _0x29da21[_0x3e71('0x57')](_0x423d00);}})['then'](function(_0x2ddba5){if(_0x2ddba5){_0x3ab349=_0x2ddba5[_0x3e71('0x3f')];if(!_0x219465[_0x3e71('0x3a')][_0x3e71('0x58')](_0x3e71('0x40'))){_0x423d00[_0x3e71('0x28')]=qs[_0x3e71('0x28')](_0x219465[_0x3e71('0x3a')][_0x3e71('0x28')]);_0x423d00['offset']=qs['offset'](_0x219465[_0x3e71('0x3a')][_0x3e71('0x27')]);}return _0x29da21[_0x3e71('0x57')](_0x423d00);}})[_0x3e71('0x1c')](function(_0x249413){if(_0x249413){return _0x249413?{'count':_0x3ab349,'rows':_0x249413}:null;}})['then'](respondWithResult(_0x1b1b1e,null))[_0x3e71('0x4c')](handleError(_0x1b1b1e,null));};exports['getDescriptions']=function(_0x12f385,_0x3700e1,_0x9de305){var _0xcda74c={};var _0x6e3064={};var _0x3a41a;var _0x1d6b32;return db[_0x3e71('0x47')]['findOne']({'where':{'id':_0x12f385['params']['id']}})[_0x3e71('0x1c')](handleEntityNotFound(_0x3700e1,null))[_0x3e71('0x1c')](function(_0x14612c){if(_0x14612c){_0x3a41a=_0x14612c;_0x6e3064[_0x3e71('0x38')]=_['keys'](db['VtigerField'][_0x3e71('0x34')]);_0x6e3064[_0x3e71('0x3a')]=_[_0x3e71('0x3b')](_0x12f385[_0x3e71('0x3a')]);_0x6e3064[_0x3e71('0x59')]=_[_0x3e71('0x3c')](_0x6e3064[_0x3e71('0x38')],_0x6e3064['query']);_0xcda74c[_0x3e71('0x3d')]=_[_0x3e71('0x3c')](_0x6e3064['model'],qs['fields'](_0x12f385[_0x3e71('0x3a')]['fields']));_0xcda74c[_0x3e71('0x3d')]=_0xcda74c[_0x3e71('0x3d')][_0x3e71('0x3f')]?_0xcda74c[_0x3e71('0x3d')]:_0x6e3064['model'];_0xcda74c[_0x3e71('0x41')]=qs['sort'](_0x12f385[_0x3e71('0x3a')][_0x3e71('0x53')]);_0xcda74c[_0x3e71('0x42')]=qs[_0x3e71('0x59')](_[_0x3e71('0x43')](_0x12f385[_0x3e71('0x3a')],_0x6e3064[_0x3e71('0x59')]));if(_0x12f385[_0x3e71('0x3a')][_0x3e71('0x54')]){_0xcda74c['where']=_[_0x3e71('0x44')](_0xcda74c[_0x3e71('0x42')],{'$or':_[_0x3e71('0x39')](_0xcda74c[_0x3e71('0x3d')],function(_0x4c726d){var _0x329eee={};_0x329eee[_0x4c726d]={'$like':'%'+_0x12f385['query'][_0x3e71('0x54')]+'%'};return _0x329eee;})});}_0xcda74c=_[_0x3e71('0x44')]({},_0xcda74c,_0x12f385[_0x3e71('0x46')]);return _0x3a41a[_0x3e71('0x5a')](_0xcda74c);}})[_0x3e71('0x1c')](function(_0xafd3d){if(_0xafd3d){_0x1d6b32=_0xafd3d[_0x3e71('0x3f')];if(!_0x12f385[_0x3e71('0x3a')]['hasOwnProperty'](_0x3e71('0x40'))){_0xcda74c[_0x3e71('0x28')]=qs[_0x3e71('0x28')](_0x12f385[_0x3e71('0x3a')][_0x3e71('0x28')]);_0xcda74c['offset']=qs[_0x3e71('0x27')](_0x12f385[_0x3e71('0x3a')][_0x3e71('0x27')]);}return _0x3a41a[_0x3e71('0x5a')](_0xcda74c);}})['then'](function(_0x39dac5){if(_0x39dac5){return _0x39dac5?{'count':_0x1d6b32,'rows':_0x39dac5}:null;}})[_0x3e71('0x1c')](respondWithResult(_0x3700e1,null))[_0x3e71('0x4c')](handleError(_0x3700e1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d0c17e5..60d2a21 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 _0xaed3=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util','../../config/logger'];(function(_0x550b8f,_0x5beee6){var _0x94f30c=function(_0x53bee0){while(--_0x53bee0){_0x550b8f['push'](_0x550b8f['shift']());}};_0x94f30c(++_0x5beee6);}(_0xaed3,0x15d));var _0x3aed=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xaed3[_0x3f0b30];return _0x2748a5;};'use strict';var _=require(_0x3aed('0x0'));var util=require(_0x3aed('0x1'));var logger=require(_0x3aed('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3aed('0x3'));var rp=require(_0x3aed('0x4'));var fs=require('fs');var path=require(_0x3aed('0x5'));var rimraf=require(_0x3aed('0x6'));var config=require(_0x3aed('0x7'));var attributes=require(_0x3aed('0x8'));module['exports']=function(_0x73637c,_0x4d8d4b){return _0x73637c[_0x3aed('0x9')](_0x3aed('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3426=['path','rimraf','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird'];(function(_0x926484,_0x265657){var _0x2d9208=function(_0x49717e){while(--_0x49717e){_0x926484['push'](_0x926484['shift']());}};_0x2d9208(++_0x265657);}(_0x3426,0x1c7));var _0x6342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3426[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6342('0x0'));var util=require(_0x6342('0x1'));var logger=require('../../config/logger')(_0x6342('0x2'));var moment=require(_0x6342('0x3'));var BPromise=require(_0x6342('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6342('0x5'));var rimraf=require(_0x6342('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x6342('0x7')]=function(_0x1a53ec,_0x2a6dc7){return _0x1a53ec['define'](_0x6342('0x8'),attributes,{'tableName':_0x6342('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 5e383e0..bb406ba 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 _0x55b7=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x2b1268,_0x197a10){var _0x562d88=function(_0xf98383){while(--_0xf98383){_0x2b1268['push'](_0x2b1268['shift']());}};_0x562d88(++_0x197a10);}(_0x55b7,0x8b));var _0x755b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x55b7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x755b('0x0'));var util=require(_0x755b('0x1'));var moment=require('moment');var BPromise=require(_0x755b('0x2'));var rs=require(_0x755b('0x3'));var fs=require('fs');var Redis=require(_0x755b('0x4'));var db=require(_0x755b('0x5'))['db'];var utils=require(_0x755b('0x6'));var logger=require(_0x755b('0x7'))(_0x755b('0x8'));var config=require(_0x755b('0x9'));var jayson=require(_0x755b('0xa'));var client=jayson[_0x755b('0xb')][_0x755b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf6e798,_0x2865a1,_0x4c3d5e){return new BPromise(function(_0x3a4ae7,_0x4cc844){return client[_0x755b('0xd')](_0xf6e798,_0x4c3d5e)[_0x755b('0xe')](function(_0x3e1530){logger[_0x755b('0xf')](_0x755b('0x10'),_0x2865a1,_0x755b('0x11'));logger[_0x755b('0x12')](_0x755b('0x13'),_0x2865a1,_0x755b('0x11'),JSON[_0x755b('0x14')](_0x3e1530));if(_0x3e1530[_0x755b('0x15')]){if(_0x3e1530[_0x755b('0x15')][_0x755b('0x16')]===0x1f4){logger[_0x755b('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x2865a1,_0x3e1530[_0x755b('0x15')][_0x755b('0x17')]);return _0x4cc844(_0x3e1530['error'][_0x755b('0x17')]);}logger[_0x755b('0x15')](_0x755b('0x10'),_0x2865a1,_0x3e1530[_0x755b('0x15')]['message']);return _0x3a4ae7(_0x3e1530[_0x755b('0x15')][_0x755b('0x17')]);}else{logger[_0x755b('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x2865a1,'request\x20sent');_0x3a4ae7(_0x3e1530[_0x755b('0x18')][_0x755b('0x17')]);}})[_0x755b('0x19')](function(_0x25b11d){logger[_0x755b('0x15')](_0x755b('0x10'),_0x2865a1,_0x25b11d);_0x4cc844(_0x25b11d);});});} \ No newline at end of file +var _0xc641=['request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1490d8,_0x8d9993){var _0x5f0fd5=function(_0x14c430){while(--_0x14c430){_0x1490d8['push'](_0x1490d8['shift']());}};_0x5f0fd5(++_0x8d9993);}(_0xc641,0xd2));var _0x1c64=function(_0x5b0bb4,_0x1e6c53){_0x5b0bb4=_0x5b0bb4-0x0;var _0x57ce2f=_0xc641[_0x5b0bb4];return _0x57ce2f;};'use strict';var _=require(_0x1c64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c64('0x1'));var db=require(_0x1c64('0x2'))['db'];var utils=require(_0x1c64('0x3'));var logger=require(_0x1c64('0x4'))(_0x1c64('0x5'));var config=require(_0x1c64('0x6'));var jayson=require(_0x1c64('0x7'));var client=jayson[_0x1c64('0x8')][_0x1c64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc19a1b,_0x484e1d,_0x1405a2){return new BPromise(function(_0x5e72e1,_0xe568b8){return client[_0x1c64('0xa')](_0xc19a1b,_0x1405a2)[_0x1c64('0xb')](function(_0xe2ddb9){logger['info'](_0x1c64('0xc'),_0x484e1d,_0x1c64('0xd'));logger[_0x1c64('0xe')](_0x1c64('0xf'),_0x484e1d,_0x1c64('0xd'),JSON['stringify'](_0xe2ddb9));if(_0xe2ddb9['error']){if(_0xe2ddb9[_0x1c64('0x10')][_0x1c64('0x11')]===0x1f4){logger['error'](_0x1c64('0xc'),_0x484e1d,_0xe2ddb9[_0x1c64('0x10')]['message']);return _0xe568b8(_0xe2ddb9['error'][_0x1c64('0x12')]);}logger[_0x1c64('0x10')](_0x1c64('0xc'),_0x484e1d,_0xe2ddb9['error'][_0x1c64('0x12')]);return _0x5e72e1(_0xe2ddb9['error']['message']);}else{logger[_0x1c64('0x13')](_0x1c64('0xc'),_0x484e1d,_0x1c64('0xd'));_0x5e72e1(_0xe2ddb9[_0x1c64('0x14')][_0x1c64('0x12')]);}})[_0x1c64('0x15')](function(_0x9f9319){logger['error'](_0x1c64('0xc'),_0x484e1d,_0x9f9319);_0xe568b8(_0x9f9319);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f8254f7..34c6a90 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 _0x7834=['./intVtigerField.controller','get','isAuthenticated','/:id','create','put','update','delete','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f869c,_0x118fd4){var _0x47eb58=function(_0x402660){while(--_0x402660){_0x1f869c['push'](_0x1f869c['shift']());}};_0x47eb58(++_0x118fd4);}(_0x7834,0xa2));var _0x4783=function(_0x293130,_0x5da862){_0x293130=_0x293130-0x0;var _0x30de42=_0x7834[_0x293130];return _0x30de42;};'use strict';var multer=require('multer');var util=require(_0x4783('0x0'));var path=require('path');var timeout=require(_0x4783('0x1'));var express=require(_0x4783('0x2'));var router=express['Router']();var auth=require(_0x4783('0x3'));var interaction=require(_0x4783('0x4'));var config=require(_0x4783('0x5'));var controller=require(_0x4783('0x6'));router[_0x4783('0x7')]('/',auth[_0x4783('0x8')](),controller['index']);router['get'](_0x4783('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4783('0xa')]);router[_0x4783('0xb')](_0x4783('0x9'),auth[_0x4783('0x8')](),controller[_0x4783('0xc')]);router[_0x4783('0xd')]('/:id',auth[_0x4783('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf764=['./intVtigerField.controller','index','get','/:id','isAuthenticated','create','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xf764,0x119));var _0x4f76=function(_0x25570b,_0xaadf07){_0x25570b=_0x25570b-0x0;var _0x523940=_0xf764[_0x25570b];return _0x523940;};'use strict';var multer=require(_0x4f76('0x0'));var util=require(_0x4f76('0x1'));var path=require(_0x4f76('0x2'));var timeout=require(_0x4f76('0x3'));var express=require(_0x4f76('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4f76('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4f76('0x6')]);router[_0x4f76('0x7')](_0x4f76('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4f76('0x9')](),controller[_0x4f76('0xa')]);router['put'](_0x4f76('0x8'),auth[_0x4f76('0x9')](),controller['update']);router[_0x4f76('0xb')](_0x4f76('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f76('0xc')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index fec30d4..b130106 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 _0x9d3e=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x332e88,_0x3eb92b){var _0x24f128=function(_0x3f9668){while(--_0x3f9668){_0x332e88['push'](_0x332e88['shift']());}};_0x24f128(++_0x3eb92b);}(_0x9d3e,0xd5));var _0xe9d3=function(_0x1fd56f,_0x1dcc57){_0x1fd56f=_0x1fd56f-0x0;var _0x30bdba=_0x9d3e[_0x1fd56f];return _0x30bdba;};'use strict';var Sequelize=require(_0xe9d3('0x0'));module['exports']={'type':{'type':Sequelize[_0xe9d3('0x1')]('string',_0xe9d3('0x2'),_0xe9d3('0x3'),_0xe9d3('0x4')),'defaultValue':_0xe9d3('0x5')},'content':{'type':Sequelize[_0xe9d3('0x6')]},'key':{'type':Sequelize[_0xe9d3('0x6')]},'keyType':{'type':Sequelize[_0xe9d3('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xe9d3('0x6')]},'idField':{'type':Sequelize[_0xe9d3('0x6')]},'nameField':{'type':Sequelize[_0xe9d3('0x6')]},'customField':{'type':Sequelize[_0xe9d3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9d3('0x6')]}}; \ No newline at end of file +var _0x7aaf=['customVariable','sequelize','ENUM','string','keyValue','STRING','variable'];(function(_0x3d259e,_0xe52cd1){var _0x4e9d17=function(_0x503b66){while(--_0x503b66){_0x3d259e['push'](_0x3d259e['shift']());}};_0x4e9d17(++_0xe52cd1);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x5d33fb,_0x2617a2){_0x5d33fb=_0x5d33fb-0x0;var _0x2a6733=_0x7aaf[_0x5d33fb];return _0x2a6733;};'use strict';var Sequelize=require(_0xf7aa('0x0'));module['exports']={'type':{'type':Sequelize[_0xf7aa('0x1')](_0xf7aa('0x2'),'variable','customVariable',_0xf7aa('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf7aa('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf7aa('0x1')](_0xf7aa('0x2'),_0xf7aa('0x5'),_0xf7aa('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf7aa('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7aa('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3c55cf8..4c522a3 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 _0xdbb1=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','VtigerField','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','html-pdf','fast-json-patch','bluebird','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xd0d70c,_0x305a87){var _0x2dd127=function(_0x1ecfeb){while(--_0x1ecfeb){_0xd0d70c['push'](_0xd0d70c['shift']());}};_0x2dd127(++_0x305a87);}(_0xdbb1,0x105));var _0x1dbb=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdbb1[_0x3c8e9a];return _0x2d4c57;};'use strict';var pdf=require(_0x1dbb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1dbb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1dbb('0x2'));var Mustache=require('mustache');var util=require(_0x1dbb('0x3'));var path=require(_0x1dbb('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1dbb('0x5'));var fs=require('fs');var _=require(_0x1dbb('0x6'));var squel=require(_0x1dbb('0x7'));var crypto=require(_0x1dbb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1dbb('0x9'));var toCsv=require(_0x1dbb('0xa'));var querystring=require('querystring');var Papa=require(_0x1dbb('0xb'));var Redis=require(_0x1dbb('0xc'));var authService=require(_0x1dbb('0xd'));var qs=require(_0x1dbb('0xe'));var as=require(_0x1dbb('0xf'));var hardwareService=require(_0x1dbb('0x10'));var logger=require(_0x1dbb('0x11'))(_0x1dbb('0x12'));var utils=require(_0x1dbb('0x13'));var config=require(_0x1dbb('0x14'));var licenseUtil=require(_0x1dbb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425fef,_0x28c292){_0x28c292=_0x28c292||0xcc;return function(_0x332380){if(_0x332380){return _0x425fef[_0x1dbb('0x16')](_0x28c292);}return _0x425fef['status'](_0x28c292)['end']();};}function respondWithResult(_0x1d87b9,_0x175864){_0x175864=_0x175864||0xc8;return function(_0xf5f7ed){if(_0xf5f7ed){return _0x1d87b9[_0x1dbb('0x17')](_0x175864)[_0x1dbb('0x18')](_0xf5f7ed);}};}function respondWithFilteredResult(_0x539721,_0x15dc51){return function(_0x188515){if(_0x188515){var _0x409bee=_0x188515['count'],_0x5e1dce=_0x15dc51[_0x1dbb('0x19')],_0x5b6e42=_0x15dc51[_0x1dbb('0x19')]+_0x15dc51[_0x1dbb('0x1a')],_0x363224;if(_0x5b6e42>=_0x409bee){_0x5b6e42=_0x409bee;_0x363224=0xc8;}else{_0x363224=0xce;}_0x539721[_0x1dbb('0x17')](_0x363224);return _0x539721[_0x1dbb('0x1b')](_0x1dbb('0x1c'),_0x5e1dce+'-'+_0x5b6e42+'/'+_0x409bee)[_0x1dbb('0x18')](_0x188515);}return null;};}function patchUpdates(_0x239082){return function(_0x58aa43){try{jsonpatch['apply'](_0x58aa43,_0x239082,!![]);}catch(_0x4802ba){return BPromise[_0x1dbb('0x1d')](_0x4802ba);}return _0x58aa43[_0x1dbb('0x1e')]();};}function saveUpdates(_0x570896,_0x21e48c){return function(_0x11fefd){if(_0x11fefd){return _0x11fefd[_0x1dbb('0x1f')](_0x570896)[_0x1dbb('0x20')](function(_0x33bf12){return _0x33bf12;});}return null;};}function removeEntity(_0x3ddd80,_0x330f45){return function(_0x4b206d){if(_0x4b206d){return _0x4b206d[_0x1dbb('0x21')]()[_0x1dbb('0x20')](function(){_0x3ddd80[_0x1dbb('0x17')](0xcc)[_0x1dbb('0x22')]();});}};}function handleEntityNotFound(_0x2c0993,_0x429253){return function(_0x1e1918){if(!_0x1e1918){_0x2c0993[_0x1dbb('0x16')](0x194);}return _0x1e1918;};}function handleError(_0x2945ec,_0xc33a9f){_0xc33a9f=_0xc33a9f||0x1f4;return function(_0x18f188){logger['error'](_0x18f188[_0x1dbb('0x23')]);if(_0x18f188['name']){delete _0x18f188[_0x1dbb('0x24')];}_0x2945ec['status'](_0xc33a9f)[_0x1dbb('0x25')](_0x18f188);};}exports[_0x1dbb('0x26')]=function(_0x346372,_0x3ece10){var _0x271ee5={},_0x47057d={},_0x5e5059={'count':0x0,'rows':[]};var _0x14fca1=_[_0x1dbb('0x27')](db[_0x1dbb('0x28')]['rawAttributes'],function(_0x5557ad){return{'name':_0x5557ad[_0x1dbb('0x29')],'type':_0x5557ad['type']['key']};});_0x47057d[_0x1dbb('0x2a')]=_[_0x1dbb('0x27')](_0x14fca1,_0x1dbb('0x24'));_0x47057d[_0x1dbb('0x2b')]=_[_0x1dbb('0x2c')](_0x346372[_0x1dbb('0x2b')]);_0x47057d[_0x1dbb('0x2d')]=_[_0x1dbb('0x2e')](_0x47057d[_0x1dbb('0x2a')],_0x47057d['query']);_0x271ee5['attributes']=_[_0x1dbb('0x2e')](_0x47057d[_0x1dbb('0x2a')],qs[_0x1dbb('0x2f')](_0x346372['query']['fields']));_0x271ee5[_0x1dbb('0x30')]=_0x271ee5[_0x1dbb('0x30')][_0x1dbb('0x31')]?_0x271ee5['attributes']:_0x47057d['model'];if(!_0x346372[_0x1dbb('0x2b')][_0x1dbb('0x32')]('nolimit')){_0x271ee5[_0x1dbb('0x1a')]=qs[_0x1dbb('0x1a')](_0x346372[_0x1dbb('0x2b')][_0x1dbb('0x1a')]);_0x271ee5['offset']=qs[_0x1dbb('0x19')](_0x346372[_0x1dbb('0x2b')][_0x1dbb('0x19')]);}_0x271ee5[_0x1dbb('0x33')]=qs[_0x1dbb('0x34')](_0x346372[_0x1dbb('0x2b')]['sort']);_0x271ee5[_0x1dbb('0x35')]=qs[_0x1dbb('0x2d')](_['pick'](_0x346372[_0x1dbb('0x2b')],_0x47057d[_0x1dbb('0x2d')]),_0x14fca1);if(_0x346372[_0x1dbb('0x2b')][_0x1dbb('0x36')]){_0x271ee5[_0x1dbb('0x35')]=_['merge'](_0x271ee5[_0x1dbb('0x35')],{'$or':_[_0x1dbb('0x27')](_0x14fca1,function(_0x58536e){if(_0x58536e[_0x1dbb('0x37')]!==_0x1dbb('0x38')){var _0x158177={};_0x158177[_0x58536e['name']]={'$like':'%'+_0x346372[_0x1dbb('0x2b')][_0x1dbb('0x36')]+'%'};return _0x158177;}})});}_0x271ee5=_['merge']({},_0x271ee5,_0x346372[_0x1dbb('0x39')]);var _0x41a81b={'where':_0x271ee5[_0x1dbb('0x35')]};return db[_0x1dbb('0x28')][_0x1dbb('0x3a')](_0x41a81b)[_0x1dbb('0x20')](function(_0xbce716){_0x5e5059[_0x1dbb('0x3a')]=_0xbce716;if(_0x346372[_0x1dbb('0x2b')][_0x1dbb('0x3b')]){_0x271ee5[_0x1dbb('0x3c')]=[{'all':!![]}];}return db[_0x1dbb('0x28')][_0x1dbb('0x3d')](_0x271ee5);})['then'](function(_0x1b94ab){_0x5e5059[_0x1dbb('0x3e')]=_0x1b94ab;return _0x5e5059;})[_0x1dbb('0x20')](respondWithFilteredResult(_0x3ece10,_0x271ee5))[_0x1dbb('0x3f')](handleError(_0x3ece10,null));};exports[_0x1dbb('0x40')]=function(_0x2cad14,_0x414609){var _0x23b461={'raw':!![],'where':{'id':_0x2cad14[_0x1dbb('0x41')]['id']}},_0x3f331f={};_0x3f331f[_0x1dbb('0x2a')]=_[_0x1dbb('0x2c')](db[_0x1dbb('0x28')]['rawAttributes']);_0x3f331f[_0x1dbb('0x2b')]=_[_0x1dbb('0x2c')](_0x2cad14[_0x1dbb('0x2b')]);_0x3f331f[_0x1dbb('0x2d')]=_['intersection'](_0x3f331f[_0x1dbb('0x2a')],_0x3f331f[_0x1dbb('0x2b')]);_0x23b461[_0x1dbb('0x30')]=_[_0x1dbb('0x2e')](_0x3f331f[_0x1dbb('0x2a')],qs[_0x1dbb('0x2f')](_0x2cad14[_0x1dbb('0x2b')][_0x1dbb('0x2f')]));_0x23b461['attributes']=_0x23b461[_0x1dbb('0x30')][_0x1dbb('0x31')]?_0x23b461[_0x1dbb('0x30')]:_0x3f331f[_0x1dbb('0x2a')];if(_0x2cad14[_0x1dbb('0x2b')][_0x1dbb('0x3b')]){_0x23b461['include']=[{'all':!![]}];}_0x23b461=_[_0x1dbb('0x42')]({},_0x23b461,_0x2cad14['options']);return db[_0x1dbb('0x28')][_0x1dbb('0x43')](_0x23b461)['then'](handleEntityNotFound(_0x414609,null))[_0x1dbb('0x20')](respondWithResult(_0x414609,null))[_0x1dbb('0x3f')](handleError(_0x414609,null));};exports[_0x1dbb('0x44')]=function(_0x13972d,_0x3c76b5){return db['VtigerField'][_0x1dbb('0x44')](_0x13972d[_0x1dbb('0x45')],{})[_0x1dbb('0x20')](respondWithResult(_0x3c76b5,0xc9))[_0x1dbb('0x3f')](handleError(_0x3c76b5,null));};exports[_0x1dbb('0x1f')]=function(_0x4a9295,_0x17e8e0){if(_0x4a9295['body']['id']){delete _0x4a9295['body']['id'];}return db[_0x1dbb('0x28')]['find']({'where':{'id':_0x4a9295[_0x1dbb('0x41')]['id']}})[_0x1dbb('0x20')](handleEntityNotFound(_0x17e8e0,null))[_0x1dbb('0x20')](saveUpdates(_0x4a9295[_0x1dbb('0x45')],null))[_0x1dbb('0x20')](respondWithResult(_0x17e8e0,null))[_0x1dbb('0x3f')](handleError(_0x17e8e0,null));};exports['destroy']=function(_0x16cf4f,_0x2b2d15){return db[_0x1dbb('0x28')][_0x1dbb('0x43')]({'where':{'id':_0x16cf4f[_0x1dbb('0x41')]['id']}})[_0x1dbb('0x20')](handleEntityNotFound(_0x2b2d15,null))['then'](removeEntity(_0x2b2d15,null))['catch'](handleError(_0x2b2d15,null));}; \ No newline at end of file +var _0x9fe7=['sendStatus','status','end','json','offset','limit','reject','save','update','then','error','stack','send','index','VtigerField','map','name','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4233f7,_0x1ec488){var _0x5a49c5=function(_0x2f6b69){while(--_0x2f6b69){_0x4233f7['push'](_0x4233f7['shift']());}};_0x5a49c5(++_0x1ec488);}(_0x9fe7,0x1df));var _0x79fe=function(_0x448bc0,_0x5a768e){_0x448bc0=_0x448bc0-0x0;var _0x515687=_0x9fe7[_0x448bc0];return _0x515687;};'use strict';var pdf=require(_0x79fe('0x0'));var emlformat=require(_0x79fe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x79fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79fe('0x3'));var moment=require(_0x79fe('0x4'));var BPromise=require(_0x79fe('0x5'));var Mustache=require('mustache');var util=require(_0x79fe('0x6'));var path=require(_0x79fe('0x7'));var sox=require(_0x79fe('0x8'));var csv=require('to-csv');var ejs=require(_0x79fe('0x9'));var fs=require('fs');var _=require(_0x79fe('0xa'));var squel=require(_0x79fe('0xb'));var crypto=require('crypto');var jsforce=require(_0x79fe('0xc'));var deskjs=require(_0x79fe('0xd'));var toCsv=require(_0x79fe('0xe'));var querystring=require(_0x79fe('0xf'));var Papa=require(_0x79fe('0x10'));var Redis=require('ioredis');var authService=require(_0x79fe('0x11'));var qs=require(_0x79fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79fe('0x13'));var logger=require(_0x79fe('0x14'))(_0x79fe('0x15'));var utils=require(_0x79fe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x79fe('0x17'));var db=require(_0x79fe('0x18'))['db'];function respondWithStatusCode(_0x3e0ad8,_0x93c1a7){_0x93c1a7=_0x93c1a7||0xcc;return function(_0x1a83f2){if(_0x1a83f2){return _0x3e0ad8[_0x79fe('0x19')](_0x93c1a7);}return _0x3e0ad8[_0x79fe('0x1a')](_0x93c1a7)[_0x79fe('0x1b')]();};}function respondWithResult(_0x4be1c4,_0x3bd14a){_0x3bd14a=_0x3bd14a||0xc8;return function(_0x238e60){if(_0x238e60){return _0x4be1c4[_0x79fe('0x1a')](_0x3bd14a)[_0x79fe('0x1c')](_0x238e60);}};}function respondWithFilteredResult(_0x35fb79,_0x25e91b){return function(_0x58124b){if(_0x58124b){var _0x127ec4=_0x58124b['count'],_0xb1955f=_0x25e91b[_0x79fe('0x1d')],_0xcae4ff=_0x25e91b[_0x79fe('0x1d')]+_0x25e91b[_0x79fe('0x1e')],_0x5f0af3;if(_0xcae4ff>=_0x127ec4){_0xcae4ff=_0x127ec4;_0x5f0af3=0xc8;}else{_0x5f0af3=0xce;}_0x35fb79[_0x79fe('0x1a')](_0x5f0af3);return _0x35fb79['set']('Content-Range',_0xb1955f+'-'+_0xcae4ff+'/'+_0x127ec4)[_0x79fe('0x1c')](_0x58124b);}return null;};}function patchUpdates(_0x1a1224){return function(_0x25e51f){try{jsonpatch['apply'](_0x25e51f,_0x1a1224,!![]);}catch(_0x891611){return BPromise[_0x79fe('0x1f')](_0x891611);}return _0x25e51f[_0x79fe('0x20')]();};}function saveUpdates(_0x4c7062,_0x203405){return function(_0x57192e){if(_0x57192e){return _0x57192e[_0x79fe('0x21')](_0x4c7062)[_0x79fe('0x22')](function(_0x3f1b15){return _0x3f1b15;});}return null;};}function removeEntity(_0x191bd8,_0x1ac8d7){return function(_0x23bff8){if(_0x23bff8){return _0x23bff8['destroy']()['then'](function(){_0x191bd8[_0x79fe('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aa35,_0x3721bc){return function(_0x4cac70){if(!_0x4cac70){_0x16aa35['sendStatus'](0x194);}return _0x4cac70;};}function handleError(_0x454e93,_0x321778){_0x321778=_0x321778||0x1f4;return function(_0x59339b){logger[_0x79fe('0x23')](_0x59339b[_0x79fe('0x24')]);if(_0x59339b['name']){delete _0x59339b['name'];}_0x454e93['status'](_0x321778)[_0x79fe('0x25')](_0x59339b);};}exports[_0x79fe('0x26')]=function(_0x36ead5,_0x4ac913){var _0x47786f={},_0x43782e={},_0x3bc5bc={'count':0x0,'rows':[]};var _0x4de5cc=_['map'](db[_0x79fe('0x27')]['rawAttributes'],function(_0x196215){return{'name':_0x196215['fieldName'],'type':_0x196215['type']['key']};});_0x43782e['model']=_[_0x79fe('0x28')](_0x4de5cc,_0x79fe('0x29'));_0x43782e['query']=_[_0x79fe('0x2a')](_0x36ead5['query']);_0x43782e[_0x79fe('0x2b')]=_[_0x79fe('0x2c')](_0x43782e[_0x79fe('0x2d')],_0x43782e[_0x79fe('0x2e')]);_0x47786f[_0x79fe('0x2f')]=_['intersection'](_0x43782e[_0x79fe('0x2d')],qs[_0x79fe('0x30')](_0x36ead5[_0x79fe('0x2e')][_0x79fe('0x30')]));_0x47786f[_0x79fe('0x2f')]=_0x47786f[_0x79fe('0x2f')]['length']?_0x47786f[_0x79fe('0x2f')]:_0x43782e[_0x79fe('0x2d')];if(!_0x36ead5[_0x79fe('0x2e')][_0x79fe('0x31')](_0x79fe('0x32'))){_0x47786f[_0x79fe('0x1e')]=qs['limit'](_0x36ead5[_0x79fe('0x2e')]['limit']);_0x47786f[_0x79fe('0x1d')]=qs['offset'](_0x36ead5[_0x79fe('0x2e')]['offset']);}_0x47786f[_0x79fe('0x33')]=qs[_0x79fe('0x34')](_0x36ead5[_0x79fe('0x2e')]['sort']);_0x47786f[_0x79fe('0x35')]=qs[_0x79fe('0x2b')](_[_0x79fe('0x36')](_0x36ead5[_0x79fe('0x2e')],_0x43782e[_0x79fe('0x2b')]),_0x4de5cc);if(_0x36ead5['query']['filter']){_0x47786f[_0x79fe('0x35')]=_['merge'](_0x47786f[_0x79fe('0x35')],{'$or':_[_0x79fe('0x28')](_0x4de5cc,function(_0x497a02){if(_0x497a02[_0x79fe('0x37')]!==_0x79fe('0x38')){var _0xfa1cc={};_0xfa1cc[_0x497a02[_0x79fe('0x29')]]={'$like':'%'+_0x36ead5[_0x79fe('0x2e')][_0x79fe('0x39')]+'%'};return _0xfa1cc;}})});}_0x47786f=_['merge']({},_0x47786f,_0x36ead5[_0x79fe('0x3a')]);var _0x30b8c3={'where':_0x47786f[_0x79fe('0x35')]};return db[_0x79fe('0x27')]['count'](_0x30b8c3)[_0x79fe('0x22')](function(_0x49d107){_0x3bc5bc[_0x79fe('0x3b')]=_0x49d107;if(_0x36ead5['query'][_0x79fe('0x3c')]){_0x47786f['include']=[{'all':!![]}];}return db[_0x79fe('0x27')][_0x79fe('0x3d')](_0x47786f);})['then'](function(_0x5e27bc){_0x3bc5bc[_0x79fe('0x3e')]=_0x5e27bc;return _0x3bc5bc;})[_0x79fe('0x22')](respondWithFilteredResult(_0x4ac913,_0x47786f))[_0x79fe('0x3f')](handleError(_0x4ac913,null));};exports[_0x79fe('0x40')]=function(_0x522241,_0x5698a2){var _0x37c37b={'raw':!![],'where':{'id':_0x522241[_0x79fe('0x41')]['id']}},_0x31b15e={};_0x31b15e[_0x79fe('0x2d')]=_[_0x79fe('0x2a')](db[_0x79fe('0x27')][_0x79fe('0x42')]);_0x31b15e[_0x79fe('0x2e')]=_['keys'](_0x522241[_0x79fe('0x2e')]);_0x31b15e[_0x79fe('0x2b')]=_[_0x79fe('0x2c')](_0x31b15e[_0x79fe('0x2d')],_0x31b15e[_0x79fe('0x2e')]);_0x37c37b[_0x79fe('0x2f')]=_['intersection'](_0x31b15e[_0x79fe('0x2d')],qs[_0x79fe('0x30')](_0x522241[_0x79fe('0x2e')][_0x79fe('0x30')]));_0x37c37b[_0x79fe('0x2f')]=_0x37c37b[_0x79fe('0x2f')]['length']?_0x37c37b[_0x79fe('0x2f')]:_0x31b15e[_0x79fe('0x2d')];if(_0x522241[_0x79fe('0x2e')]['includeAll']){_0x37c37b[_0x79fe('0x43')]=[{'all':!![]}];}_0x37c37b=_['merge']({},_0x37c37b,_0x522241['options']);return db[_0x79fe('0x27')][_0x79fe('0x44')](_0x37c37b)[_0x79fe('0x22')](handleEntityNotFound(_0x5698a2,null))['then'](respondWithResult(_0x5698a2,null))[_0x79fe('0x3f')](handleError(_0x5698a2,null));};exports[_0x79fe('0x45')]=function(_0x42c5af,_0x4d698d){return db['VtigerField'][_0x79fe('0x45')](_0x42c5af[_0x79fe('0x46')],{})[_0x79fe('0x22')](respondWithResult(_0x4d698d,0xc9))[_0x79fe('0x3f')](handleError(_0x4d698d,null));};exports[_0x79fe('0x21')]=function(_0x144a97,_0x734513){if(_0x144a97[_0x79fe('0x46')]['id']){delete _0x144a97[_0x79fe('0x46')]['id'];}return db['VtigerField'][_0x79fe('0x44')]({'where':{'id':_0x144a97[_0x79fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x734513,null))[_0x79fe('0x22')](saveUpdates(_0x144a97['body'],null))[_0x79fe('0x22')](respondWithResult(_0x734513,null))[_0x79fe('0x3f')](handleError(_0x734513,null));};exports[_0x79fe('0x47')]=function(_0x1761d7,_0x4b82eb){return db[_0x79fe('0x27')][_0x79fe('0x44')]({'where':{'id':_0x1761d7[_0x79fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b82eb,null))['then'](removeEntity(_0x4b82eb,null))[_0x79fe('0x3f')](handleError(_0x4b82eb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a0be4ea..e81a557 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x3dab7b,_0x37a9c7){var _0xd406d4=function(_0x1a28d3){while(--_0x1a28d3){_0x3dab7b['push'](_0x3dab7b['shift']());}};_0xd406d4(++_0x37a9c7);}(_0x7a54,0x106));var _0x47a5=function(_0x265ae0,_0x32a4df){_0x265ae0=_0x265ae0-0x0;var _0x4fcaf9=_0x7a54[_0x265ae0];return _0x4fcaf9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index f575e5d..dcf16bd 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 _0xb6b8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','util'];(function(_0x3c3fc9,_0x19452a){var _0x34debd=function(_0x2ec1f2){while(--_0x2ec1f2){_0x3c3fc9['push'](_0x3c3fc9['shift']());}};_0x34debd(++_0x19452a);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x5c856e,_0x31b9bd){_0x5c856e=_0x5c856e-0x0;var _0x3410a3=_0xb6b8[_0x5c856e];return _0x3410a3;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));var moment=require(_0x8b6b('0x1'));var BPromise=require(_0x8b6b('0x2'));var rs=require(_0x8b6b('0x3'));var fs=require('fs');var Redis=require(_0x8b6b('0x4'));var db=require(_0x8b6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b6b('0x6'))(_0x8b6b('0x7'));var config=require(_0x8b6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b6b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56da2a,_0x21bbc2,_0x303c21){return new BPromise(function(_0x142239,_0x21c84e){return client[_0x8b6b('0xa')](_0x56da2a,_0x303c21)[_0x8b6b('0xb')](function(_0x1f2c39){logger[_0x8b6b('0xc')]('VtigerField,\x20%s,\x20%s',_0x21bbc2,'request\x20sent');logger['debug'](_0x8b6b('0xd'),_0x21bbc2,_0x8b6b('0xe'),JSON[_0x8b6b('0xf')](_0x1f2c39));if(_0x1f2c39['error']){if(_0x1f2c39[_0x8b6b('0x10')][_0x8b6b('0x11')]===0x1f4){logger['error'](_0x8b6b('0x12'),_0x21bbc2,_0x1f2c39['error'][_0x8b6b('0x13')]);return _0x21c84e(_0x1f2c39[_0x8b6b('0x10')]['message']);}logger['error'](_0x8b6b('0x12'),_0x21bbc2,_0x1f2c39['error'][_0x8b6b('0x13')]);return _0x142239(_0x1f2c39[_0x8b6b('0x10')][_0x8b6b('0x13')]);}else{logger[_0x8b6b('0xc')](_0x8b6b('0x12'),_0x21bbc2,'request\x20sent');_0x142239(_0x1f2c39[_0x8b6b('0x14')][_0x8b6b('0x13')]);}})[_0x8b6b('0x15')](function(_0x2d16c7){logger[_0x8b6b('0x10')](_0x8b6b('0x12'),_0x21bbc2,_0x2d16c7);_0x21c84e(_0x2d16c7);});});} \ No newline at end of file +var _0x867f=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x35462d,_0x5aff24){var _0x1952da=function(_0x4ea6cc){while(--_0x4ea6cc){_0x35462d['push'](_0x35462d['shift']());}};_0x1952da(++_0x5aff24);}(_0x867f,0xdc));var _0xf867=function(_0x2e5636,_0x2b9540){_0x2e5636=_0x2e5636-0x0;var _0x4d7371=_0x867f[_0x2e5636];return _0x4d7371;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var moment=require(_0xf867('0x2'));var BPromise=require('bluebird');var rs=require(_0xf867('0x3'));var fs=require('fs');var Redis=require(_0xf867('0x4'));var db=require(_0xf867('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf867('0x6'))('rpc');var config=require(_0xf867('0x7'));var jayson=require(_0xf867('0x8'));var client=jayson[_0xf867('0x9')][_0xf867('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x333ea2,_0x390ca5,_0xd82c8c){return new BPromise(function(_0x3cf8db,_0x2324d1){return client[_0xf867('0xb')](_0x333ea2,_0xd82c8c)['then'](function(_0x48fec9){logger[_0xf867('0xc')](_0xf867('0xd'),_0x390ca5,_0xf867('0xe'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x390ca5,_0xf867('0xe'),JSON[_0xf867('0xf')](_0x48fec9));if(_0x48fec9['error']){if(_0x48fec9[_0xf867('0x10')][_0xf867('0x11')]===0x1f4){logger[_0xf867('0x10')](_0xf867('0xd'),_0x390ca5,_0x48fec9['error'][_0xf867('0x12')]);return _0x2324d1(_0x48fec9[_0xf867('0x10')][_0xf867('0x12')]);}logger[_0xf867('0x10')](_0xf867('0xd'),_0x390ca5,_0x48fec9[_0xf867('0x10')][_0xf867('0x12')]);return _0x3cf8db(_0x48fec9[_0xf867('0x10')][_0xf867('0x12')]);}else{logger[_0xf867('0xc')]('VtigerField,\x20%s,\x20%s',_0x390ca5,'request\x20sent');_0x3cf8db(_0x48fec9['result'][_0xf867('0x12')]);}})[_0xf867('0x13')](function(_0x42179b){logger[_0xf867('0x10')](_0xf867('0xd'),_0x390ca5,_0x42179b);_0x2324d1(_0x42179b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9e9b499..f3401a7 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 _0xccdd=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','path'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xccdd,0x71));var _0xdccd=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xccdd[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xdccd('0x0'));var util=require('util');var path=require(_0xdccd('0x1'));var timeout=require(_0xdccd('0x2'));var express=require(_0xdccd('0x3'));var router=express[_0xdccd('0x4')]();var auth=require(_0xdccd('0x5'));var interaction=require(_0xdccd('0x6'));var config=require(_0xdccd('0x7'));var controller=require(_0xdccd('0x8'));router[_0xdccd('0x9')]('/',auth[_0xdccd('0xa')](),controller[_0xdccd('0xb')]);router[_0xdccd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdccd('0xc')]);router[_0xdccd('0x9')](_0xdccd('0xd'),auth[_0xdccd('0xa')](),controller['getConfigurations']);router[_0xdccd('0x9')](_0xdccd('0xe'),auth[_0xdccd('0xa')](),controller[_0xdccd('0xf')]);router['post']('/',auth[_0xdccd('0xa')](),controller['create']);router[_0xdccd('0x10')](_0xdccd('0xd'),auth['isAuthenticated'](),controller[_0xdccd('0x11')]);router[_0xdccd('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdccd('0x13')]);router[_0xdccd('0x14')]('/:id',auth[_0xdccd('0xa')](),controller[_0xdccd('0x15')]);module[_0xdccd('0x16')]=router; \ No newline at end of file +var _0x14a4=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index'];(function(_0x3d5f64,_0x34b024){var _0x57ca5d=function(_0x126284){while(--_0x126284){_0x3d5f64['push'](_0x3d5f64['shift']());}};_0x57ca5d(++_0x34b024);}(_0x14a4,0x147));var _0x414a=function(_0x365bc6,_0x2f4052){_0x365bc6=_0x365bc6-0x0;var _0x26f659=_0x14a4[_0x365bc6];return _0x26f659;};'use strict';var multer=require(_0x414a('0x0'));var util=require(_0x414a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x414a('0x2')]();var auth=require(_0x414a('0x3'));var interaction=require(_0x414a('0x4'));var config=require('../../config/environment');var controller=require(_0x414a('0x5'));router[_0x414a('0x6')]('/',auth[_0x414a('0x7')](),controller[_0x414a('0x8')]);router[_0x414a('0x6')](_0x414a('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x414a('0xa'),auth[_0x414a('0x7')](),controller[_0x414a('0xb')]);router[_0x414a('0x6')](_0x414a('0xc'),auth['isAuthenticated'](),controller[_0x414a('0xd')]);router[_0x414a('0xe')]('/',auth[_0x414a('0x7')](),controller[_0x414a('0xf')]);router[_0x414a('0xe')](_0x414a('0xa'),auth['isAuthenticated'](),controller[_0x414a('0x10')]);router[_0x414a('0x11')](_0x414a('0x9'),auth['isAuthenticated'](),controller[_0x414a('0x12')]);router['delete'](_0x414a('0x9'),auth[_0x414a('0x7')](),controller[_0x414a('0x13')]);module[_0x414a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0c63667..c85f018 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 _0x2791=['exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x511a1b,_0x3fcd0a){var _0x37cdf1=function(_0x3b8f47){while(--_0x3b8f47){_0x511a1b['push'](_0x511a1b['shift']());}};_0x37cdf1(++_0x3fcd0a);}(_0x2791,0x1e9));var _0x1279=function(_0x4555d6,_0x4a7c6b){_0x4555d6=_0x4555d6-0x0;var _0x39479c=_0x2791[_0x4555d6];return _0x39479c;};'use strict';var Sequelize=require(_0x1279('0x0'));module[_0x1279('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1279('0x2')]},'username':{'type':Sequelize[_0x1279('0x2')],'unique':_0x1279('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1279('0x2')],'unique':_0x1279('0x4')},'authType':{'type':Sequelize[_0x1279('0x5')](_0x1279('0x6'),_0x1279('0x7')),'defaultValue':_0x1279('0x6')},'serverUrl':{'type':Sequelize[_0x1279('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1279('0x5')](_0x1279('0x8'),_0x1279('0x9')),'defaultValue':_0x1279('0x8')}}; \ No newline at end of file +var _0x6e9f=['ENUM','password','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x1f5057,_0x359308){var _0x29a63b=function(_0x33ccd7){while(--_0x33ccd7){_0x1f5057['push'](_0x1f5057['shift']());}};_0x29a63b(++_0x359308);}(_0x6e9f,0x1d8));var _0xf6e9=function(_0x508a6d,_0x194dee){_0x508a6d=_0x508a6d-0x0;var _0x592b2b=_0x6e9f[_0x508a6d];return _0x592b2b;};'use strict';var Sequelize=require(_0xf6e9('0x0'));module[_0xf6e9('0x1')]={'name':{'type':Sequelize[_0xf6e9('0x2')]},'description':{'type':Sequelize[_0xf6e9('0x2')]},'username':{'type':Sequelize[_0xf6e9('0x2')],'unique':_0xf6e9('0x3')},'password':{'type':Sequelize[_0xf6e9('0x2')]},'token':{'type':Sequelize[_0xf6e9('0x2')]},'remoteUri':{'type':Sequelize[_0xf6e9('0x2')],'unique':_0xf6e9('0x4')},'authType':{'type':Sequelize[_0xf6e9('0x5')](_0xf6e9('0x6'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xf6e9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf6e9('0x5')](_0xf6e9('0x7'),_0xf6e9('0x8')),'defaultValue':_0xf6e9('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d805b42..541cbd2 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 _0x8ba2=['findAll','rows','params','keys','include','options','find','create','body','getConfigurations','ZendeskConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','ZendeskField','Subjects','username','password','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','token','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll'];(function(_0x552804,_0x3c3d1e){var _0x32be66=function(_0x14c213){while(--_0x14c213){_0x552804['push'](_0x552804['shift']());}};_0x32be66(++_0x3c3d1e);}(_0x8ba2,0x13f));var _0x28ba=function(_0x2d133b,_0x15b607){_0x2d133b=_0x2d133b-0x0;var _0x4fe8ca=_0x8ba2[_0x2d133b];return _0x4fe8ca;};'use strict';var pdf=require(_0x28ba('0x0'));var emlformat=require(_0x28ba('0x1'));var rimraf=require(_0x28ba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28ba('0x3'));var rp=require(_0x28ba('0x4'));var moment=require(_0x28ba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x28ba('0x6'));var util=require(_0x28ba('0x7'));var path=require(_0x28ba('0x8'));var sox=require(_0x28ba('0x9'));var csv=require(_0x28ba('0xa'));var ejs=require(_0x28ba('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28ba('0xc'));var crypto=require(_0x28ba('0xd'));var jsforce=require(_0x28ba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28ba('0xa'));var querystring=require(_0x28ba('0xf'));var Papa=require(_0x28ba('0x10'));var Redis=require(_0x28ba('0x11'));var authService=require(_0x28ba('0x12'));var qs=require(_0x28ba('0x13'));var as=require(_0x28ba('0x14'));var hardwareService=require(_0x28ba('0x15'));var logger=require(_0x28ba('0x16'))(_0x28ba('0x17'));var utils=require('../../config/utils');var config=require(_0x28ba('0x18'));var licenseUtil=require(_0x28ba('0x19'));var db=require(_0x28ba('0x1a'))['db'];var integrations=require(_0x28ba('0x1b'));var jayson=require(_0x28ba('0x1c'));var client=jayson[_0x28ba('0x1d')][_0x28ba('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5dfa28,_0x305deb,_0x3cf923,_0x4ebcd6){return new BPromise(function(_0x29cd51,_0x291be0){var _0x1eb5e5=_0x4ebcd6||client;return _0x1eb5e5[_0x28ba('0x1f')](_0x5dfa28,_0x3cf923)['then'](function(_0x24b3f3){logger[_0x28ba('0x20')](_0x28ba('0x21'),_0x305deb,_0x28ba('0x22'));logger[_0x28ba('0x23')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x305deb,'request\x20sent',JSON[_0x28ba('0x24')](_0x24b3f3));if(_0x24b3f3[_0x28ba('0x25')]){if(_0x24b3f3[_0x28ba('0x25')][_0x28ba('0x26')]===0x1f4){logger[_0x28ba('0x25')](_0x28ba('0x21'),_0x305deb,_0x24b3f3[_0x28ba('0x25')][_0x28ba('0x27')]);return _0x291be0(_0x24b3f3[_0x28ba('0x25')]['message']);}logger['error'](_0x28ba('0x21'),_0x305deb,_0x24b3f3[_0x28ba('0x25')]['message']);return _0x29cd51(_0x24b3f3['error'][_0x28ba('0x27')]);}else{logger[_0x28ba('0x20')](_0x28ba('0x21'),_0x305deb,_0x28ba('0x22'));_0x29cd51(_0x24b3f3[_0x28ba('0x28')]['message']);}})[_0x28ba('0x29')](function(_0x3cc604){logger[_0x28ba('0x25')](_0x28ba('0x21'),_0x305deb,_0x3cc604);_0x291be0(_0x3cc604);});});}function respondWithStatusCode(_0x27a579,_0x256892){_0x256892=_0x256892||0xcc;return function(_0x5d6f70){if(_0x5d6f70){return _0x27a579[_0x28ba('0x2a')](_0x256892);}return _0x27a579[_0x28ba('0x2b')](_0x256892)[_0x28ba('0x2c')]();};}function respondWithResult(_0x1d3fd1,_0x43e6c1){_0x43e6c1=_0x43e6c1||0xc8;return function(_0x35ed28){if(_0x35ed28){return _0x1d3fd1['status'](_0x43e6c1)[_0x28ba('0x2d')](_0x35ed28);}};}function respondWithFilteredResult(_0x362254,_0x599b88){return function(_0x47da7d){if(_0x47da7d){var _0x36dc29=_0x47da7d[_0x28ba('0x2e')],_0x3e1ce7=_0x599b88[_0x28ba('0x2f')],_0x5b9237=_0x599b88[_0x28ba('0x2f')]+_0x599b88[_0x28ba('0x30')],_0x55d82f;if(_0x5b9237>=_0x36dc29){_0x5b9237=_0x36dc29;_0x55d82f=0xc8;}else{_0x55d82f=0xce;}_0x362254[_0x28ba('0x2b')](_0x55d82f);return _0x362254[_0x28ba('0x31')](_0x28ba('0x32'),_0x3e1ce7+'-'+_0x5b9237+'/'+_0x36dc29)[_0x28ba('0x2d')](_0x47da7d);}return null;};}function patchUpdates(_0x51dc98){return function(_0xa7fdf1){try{jsonpatch[_0x28ba('0x33')](_0xa7fdf1,_0x51dc98,!![]);}catch(_0x32ab4b){return BPromise[_0x28ba('0x34')](_0x32ab4b);}return _0xa7fdf1[_0x28ba('0x35')]();};}function saveUpdates(_0x5f0202,_0x13dfd4){return function(_0x2f6d5f){if(_0x2f6d5f){return _0x2f6d5f[_0x28ba('0x36')](_0x5f0202)['then'](function(_0x2c32f3){return _0x2c32f3;});}return null;};}function removeEntity(_0x1e7bcf,_0x2e31b1){return function(_0x4b45fe){if(_0x4b45fe){return _0x4b45fe[_0x28ba('0x37')]()[_0x28ba('0x38')](function(){_0x1e7bcf[_0x28ba('0x2b')](0xcc)[_0x28ba('0x2c')]();});}};}function handleEntityNotFound(_0x10850a,_0x2c206b){return function(_0x35f8b5){if(!_0x35f8b5){_0x10850a[_0x28ba('0x2a')](0x194);}return _0x35f8b5;};}function handleError(_0x29b2a0,_0x3c4a2c){_0x3c4a2c=_0x3c4a2c||0x1f4;return function(_0x497b75){logger[_0x28ba('0x25')](_0x497b75[_0x28ba('0x39')]);if(_0x497b75[_0x28ba('0x3a')]){delete _0x497b75['name'];}_0x29b2a0[_0x28ba('0x2b')](_0x3c4a2c)[_0x28ba('0x3b')](_0x497b75);};}exports[_0x28ba('0x3c')]=function(_0x3618f6,_0x2db25d){var _0x1f69af={},_0x4033e6={},_0xd4806f={'count':0x0,'rows':[]};var _0x149f30=_[_0x28ba('0x3d')](db[_0x28ba('0x3e')][_0x28ba('0x3f')],function(_0x5b3630){return{'name':_0x5b3630['fieldName'],'type':_0x5b3630['type'][_0x28ba('0x40')]};});_0x4033e6[_0x28ba('0x41')]=_['map'](_0x149f30,_0x28ba('0x3a'));_0x4033e6[_0x28ba('0x42')]=_['keys'](_0x3618f6['query']);_0x4033e6[_0x28ba('0x43')]=_[_0x28ba('0x44')](_0x4033e6['model'],_0x4033e6['query']);_0x1f69af[_0x28ba('0x45')]=_[_0x28ba('0x44')](_0x4033e6[_0x28ba('0x41')],qs[_0x28ba('0x46')](_0x3618f6[_0x28ba('0x42')][_0x28ba('0x46')]));_0x1f69af[_0x28ba('0x45')]=_0x1f69af[_0x28ba('0x45')][_0x28ba('0x47')]?_0x1f69af['attributes']:_0x4033e6['model'];if(!_0x3618f6['query'][_0x28ba('0x48')](_0x28ba('0x49'))){_0x1f69af[_0x28ba('0x30')]=qs[_0x28ba('0x30')](_0x3618f6[_0x28ba('0x42')]['limit']);_0x1f69af['offset']=qs['offset'](_0x3618f6[_0x28ba('0x42')][_0x28ba('0x2f')]);}_0x1f69af[_0x28ba('0x4a')]=qs[_0x28ba('0x4b')](_0x3618f6[_0x28ba('0x42')]['sort']);_0x1f69af[_0x28ba('0x4c')]=qs[_0x28ba('0x43')](_[_0x28ba('0x4d')](_0x3618f6[_0x28ba('0x42')],_0x4033e6[_0x28ba('0x43')]),_0x149f30);if(_0x3618f6[_0x28ba('0x42')][_0x28ba('0x4e')]){_0x1f69af[_0x28ba('0x4c')]=_[_0x28ba('0x4f')](_0x1f69af['where'],{'$or':_['map'](_0x149f30,function(_0x46815d){if(_0x46815d[_0x28ba('0x50')]!==_0x28ba('0x51')){var _0x21aef5={};_0x21aef5[_0x46815d[_0x28ba('0x3a')]]={'$like':'%'+_0x3618f6['query']['filter']+'%'};return _0x21aef5;}})});}_0x1f69af=_['merge']({},_0x1f69af,_0x3618f6['options']);var _0x44cb25={'where':_0x1f69af[_0x28ba('0x4c')]};return db[_0x28ba('0x3e')][_0x28ba('0x2e')](_0x44cb25)[_0x28ba('0x38')](function(_0xac9e65){_0xd4806f['count']=_0xac9e65;if(_0x3618f6[_0x28ba('0x42')][_0x28ba('0x52')]){_0x1f69af['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x28ba('0x53')](_0x1f69af);})['then'](function(_0x22e7b7){_0xd4806f[_0x28ba('0x54')]=_0x22e7b7;return _0xd4806f;})['then'](respondWithFilteredResult(_0x2db25d,_0x1f69af))[_0x28ba('0x29')](handleError(_0x2db25d,null));};exports['show']=function(_0x52b4ed,_0x4c6383){var _0x212b2f={'raw':![],'where':{'id':_0x52b4ed[_0x28ba('0x55')]['id']}},_0x2a20d3={};_0x2a20d3[_0x28ba('0x41')]=_[_0x28ba('0x56')](db[_0x28ba('0x3e')]['rawAttributes']);_0x2a20d3[_0x28ba('0x42')]=_['keys'](_0x52b4ed['query']);_0x2a20d3[_0x28ba('0x43')]=_[_0x28ba('0x44')](_0x2a20d3[_0x28ba('0x41')],_0x2a20d3[_0x28ba('0x42')]);_0x212b2f['attributes']=_[_0x28ba('0x44')](_0x2a20d3['model'],qs['fields'](_0x52b4ed[_0x28ba('0x42')][_0x28ba('0x46')]));_0x212b2f[_0x28ba('0x45')]=_0x212b2f[_0x28ba('0x45')][_0x28ba('0x47')]?_0x212b2f[_0x28ba('0x45')]:_0x2a20d3[_0x28ba('0x41')];if(_0x52b4ed[_0x28ba('0x42')]['includeAll']){_0x212b2f[_0x28ba('0x57')]=[{'all':!![]}];}_0x212b2f=_[_0x28ba('0x4f')]({},_0x212b2f,_0x52b4ed[_0x28ba('0x58')]);return db[_0x28ba('0x3e')][_0x28ba('0x59')](_0x212b2f)['then'](handleEntityNotFound(_0x4c6383,null))[_0x28ba('0x38')](respondWithResult(_0x4c6383,null))[_0x28ba('0x29')](handleError(_0x4c6383,null));};exports[_0x28ba('0x5a')]=function(_0x4f948a,_0x177ceb){return db[_0x28ba('0x3e')][_0x28ba('0x5a')](_0x4f948a[_0x28ba('0x5b')],{})[_0x28ba('0x38')](respondWithResult(_0x177ceb,0xc9))['catch'](handleError(_0x177ceb,null));};exports[_0x28ba('0x36')]=function(_0x1a27fc,_0x4ec37b){if(_0x1a27fc[_0x28ba('0x5b')]['id']){delete _0x1a27fc[_0x28ba('0x5b')]['id'];}return db[_0x28ba('0x3e')][_0x28ba('0x59')]({'where':{'id':_0x1a27fc[_0x28ba('0x55')]['id']}})[_0x28ba('0x38')](handleEntityNotFound(_0x4ec37b,null))[_0x28ba('0x38')](saveUpdates(_0x1a27fc[_0x28ba('0x5b')],null))[_0x28ba('0x38')](respondWithResult(_0x4ec37b,null))[_0x28ba('0x29')](handleError(_0x4ec37b,null));};exports[_0x28ba('0x37')]=function(_0x4e9258,_0x122aea){return db[_0x28ba('0x3e')][_0x28ba('0x59')]({'where':{'id':_0x4e9258[_0x28ba('0x55')]['id']}})[_0x28ba('0x38')](handleEntityNotFound(_0x122aea,null))['then'](removeEntity(_0x122aea,null))[_0x28ba('0x29')](handleError(_0x122aea,null));};exports[_0x28ba('0x5c')]=function(_0x28a1ba,_0x21c843,_0x2432c4){var _0x346b95={};var _0xb70fd6={};var _0x5b4fcb;var _0x271f89;return db[_0x28ba('0x3e')]['findOne']({'where':{'id':_0x28a1ba[_0x28ba('0x55')]['id']}})[_0x28ba('0x38')](handleEntityNotFound(_0x21c843,null))['then'](function(_0x50b4c7){if(_0x50b4c7){_0x5b4fcb=_0x50b4c7;_0xb70fd6['model']=_['keys'](db[_0x28ba('0x5d')][_0x28ba('0x3f')]);_0xb70fd6['query']=_['keys'](_0x28a1ba[_0x28ba('0x42')]);_0xb70fd6[_0x28ba('0x43')]=_[_0x28ba('0x44')](_0xb70fd6['model'],_0xb70fd6[_0x28ba('0x42')]);_0x346b95[_0x28ba('0x45')]=_[_0x28ba('0x44')](_0xb70fd6[_0x28ba('0x41')],qs[_0x28ba('0x46')](_0x28a1ba[_0x28ba('0x42')][_0x28ba('0x46')]));_0x346b95[_0x28ba('0x45')]=_0x346b95[_0x28ba('0x45')]['length']?_0x346b95[_0x28ba('0x45')]:_0xb70fd6['model'];_0x346b95[_0x28ba('0x4a')]=qs['sort'](_0x28a1ba[_0x28ba('0x42')]['sort']);_0x346b95[_0x28ba('0x4c')]=qs[_0x28ba('0x43')](_['pick'](_0x28a1ba['query'],_0xb70fd6[_0x28ba('0x43')]));if(_0x28a1ba[_0x28ba('0x42')][_0x28ba('0x4e')]){_0x346b95[_0x28ba('0x4c')]=_[_0x28ba('0x4f')](_0x346b95['where'],{'$or':_['map'](_0x346b95[_0x28ba('0x45')],function(_0x3a309a){var _0xd602a4={};_0xd602a4[_0x3a309a]={'$like':'%'+_0x28a1ba['query']['filter']+'%'};return _0xd602a4;})});}_0x346b95=_[_0x28ba('0x4f')]({},_0x346b95,_0x28a1ba['options']);return _0x5b4fcb[_0x28ba('0x5c')](_0x346b95);}})[_0x28ba('0x38')](function(_0x2e0536){if(_0x2e0536){_0x271f89=_0x2e0536[_0x28ba('0x47')];if(!_0x28a1ba['query'][_0x28ba('0x48')](_0x28ba('0x49'))){_0x346b95['limit']=qs['limit'](_0x28a1ba[_0x28ba('0x42')][_0x28ba('0x30')]);_0x346b95[_0x28ba('0x2f')]=qs[_0x28ba('0x2f')](_0x28a1ba['query'][_0x28ba('0x2f')]);}return _0x5b4fcb[_0x28ba('0x5c')](_0x346b95);}})['then'](function(_0x20a8af){if(_0x20a8af){return _0x20a8af?{'count':_0x271f89,'rows':_0x20a8af}:null;}})[_0x28ba('0x38')](respondWithResult(_0x21c843,null))[_0x28ba('0x29')](handleError(_0x21c843,null));};exports['addConfiguration']=function(_0x4cad66,_0x4aa658,_0x52184e){if(_0x4cad66[_0x28ba('0x5b')]['id']){delete _0x4cad66[_0x28ba('0x5b')]['id'];}return db[_0x28ba('0x3e')][_0x28ba('0x5e')]({'where':{'id':_0x4cad66['params']['id']}})[_0x28ba('0x38')](handleEntityNotFound(_0x4aa658,null))[_0x28ba('0x38')](function(_0xf4d918){if(_0xf4d918){_0x4cad66['body'][_0x28ba('0x5f')]=_0xf4d918['id'];_0x4cad66[_0x28ba('0x5b')]['Subjects']=integrations[_0x28ba('0x60')](_0x4cad66[_0x28ba('0x5b')][_0x28ba('0x61')],_0x4cad66[_0x28ba('0x5b')][_0x28ba('0x50')]);_0x4cad66['body'][_0x28ba('0x62')]=integrations['getDescriptions'](_0x4cad66[_0x28ba('0x5b')][_0x28ba('0x61')],_0x4cad66[_0x28ba('0x5b')][_0x28ba('0x50')]);return db[_0x28ba('0x5d')][_0x28ba('0x5a')](_0x4cad66[_0x28ba('0x5b')],{'include':[{'model':db[_0x28ba('0x63')],'as':_0x28ba('0x64')},{'model':db[_0x28ba('0x63')],'as':_0x28ba('0x62')}]});}return null;})['then'](respondWithResult(_0x4aa658,null))[_0x28ba('0x29')](handleError(_0x4aa658,null));};exports['getFields']=function(_0x31025d,_0xf9df3d,_0x22d5d7){var _0x5904b3='';return db[_0x28ba('0x3e')][_0x28ba('0x5e')]({'where':{'id':_0x31025d[_0x28ba('0x55')]['id']},'attributes':['id',_0x28ba('0x65'),_0x28ba('0x66'),'token','authType','remoteUri']})['then'](handleEntityNotFound(_0xf9df3d,null))[_0x28ba('0x38')](function(_0x261cdb){if(_0x261cdb){_0x5904b3=_0x261cdb['remoteUri'];var _0x5dec3a=_0x5904b3['slice'](-0x1);if(_0x5dec3a==='/'){_0x5904b3=_0x5904b3[_0x28ba('0x67')](0x0,_0x5904b3[_0x28ba('0x68')](_0x5dec3a));}var _0x594eda={'method':_0x28ba('0x69'),'uri':util[_0x28ba('0x6a')](_0x28ba('0x6b'),_0x5904b3,_0x28ba('0x6c')),'json':!![]};switch(_0x261cdb[_0x28ba('0x6d')]){case _0x28ba('0x66'):_0x594eda[_0x28ba('0x6e')]={'Authorization':util[_0x28ba('0x6a')]('Basic\x20%s',new Buffer(util['format'](_0x28ba('0x6f'),_0x261cdb[_0x28ba('0x65')],_0x261cdb['password']))['toString'](_0x28ba('0x70')))};break;case'token':_0x594eda[_0x28ba('0x6e')]={'Authorization':util['format'](_0x28ba('0x71'),new Buffer(util[_0x28ba('0x6a')](_0x28ba('0x72'),_0x261cdb[_0x28ba('0x65')],_0x261cdb[_0x28ba('0x73')]))[_0x28ba('0x74')](_0x28ba('0x70')))};break;default:throw new db['Sequelize'][(_0x28ba('0x75'))](_0x28ba('0x76'));}return rp(_0x594eda);}})[_0x28ba('0x38')](function(_0x2c173a){if(_0x2c173a){var _0x4c9ad7=[_0x28ba('0x77'),_0x28ba('0x78'),_0x28ba('0x79'),_0x28ba('0x7a')];_[_0x28ba('0x7b')](_0x2c173a[_0x28ba('0x6c')],function(_0xbb4c9f){return _0x4c9ad7[_0x28ba('0x7c')](_0xbb4c9f[_0x28ba('0x50')]);});return{'count':_0x2c173a['ticket_fields'][_0x28ba('0x47')],'rows':_[_0x28ba('0x3d')](_0x2c173a[_0x28ba('0x6c')],function(_0x4e920f){return{'id':_0x4e920f['id'],'name':_0x4e920f[_0x28ba('0x7d')]>0x7?_0x4e920f[_0x28ba('0x7e')]:_0x4e920f[_0x28ba('0x50')],'custom':_0x4e920f[_0x28ba('0x7d')]>0x7?!![]:![],'options':_0x4e920f['system_field_options']?_0x4e920f[_0x28ba('0x7f')]:_0x4e920f[_0x28ba('0x80')]?_0x4e920f['custom_field_options']:[]};})};}})[_0x28ba('0x38')](respondWithResult(_0xf9df3d,null))[_0x28ba('0x29')](function(_0x3a93fe){var _0x3038fd=_0x31025d[_0x28ba('0x42')][_0x28ba('0x81')]?0x1f4:_0x3a93fe[_0x28ba('0x82')]||0x1f4;logger['error'](_0x28ba('0x83'),_0x28ba('0x84'),_0x3038fd,JSON[_0x28ba('0x24')](_0x3a93fe));delete _0x3a93fe[_0x28ba('0x3a')];if(_0x3038fd===0x191){_0x3038fd=0x190;}_0xf9df3d['status'](_0x3038fd)[_0x28ba('0x3b')](_0x31025d[_0x28ba('0x42')][_0x28ba('0x81')]?{'message':_0x28ba('0x85'),'statusCode':_0x3a93fe[_0x28ba('0x82')]}:_0x3a93fe);});}; \ No newline at end of file +var _0xd87e=['filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','keys','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','%s:%s','toString','base64','headers','%s/token:%s','Unknown\x20authentication\x20type','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','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','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','map','rawAttributes','fieldName','type','key','query'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xd87e,0x1bf));var _0xed87=function(_0x538b27,_0x5af68f){_0x538b27=_0x538b27-0x0;var _0x4b4cc3=_0xd87e[_0x538b27];return _0x4b4cc3;};'use strict';var pdf=require(_0xed87('0x0'));var emlformat=require(_0xed87('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed87('0x2'));var jsonpatch=require(_0xed87('0x3'));var rp=require(_0xed87('0x4'));var moment=require('moment');var BPromise=require(_0xed87('0x5'));var Mustache=require('mustache');var util=require(_0xed87('0x6'));var path=require(_0xed87('0x7'));var sox=require('sox');var csv=require(_0xed87('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xed87('0x18')][_0xed87('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x353d46,_0x24fc2a,_0x16bfd6,_0x3865c5){return new BPromise(function(_0x52dfe8,_0x4494da){var _0x19b283=_0x3865c5||client;return _0x19b283[_0xed87('0x1a')](_0x353d46,_0x16bfd6)[_0xed87('0x1b')](function(_0x2f2fd3){logger[_0xed87('0x1c')](_0xed87('0x1d'),_0x24fc2a,_0xed87('0x1e'));logger[_0xed87('0x1f')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x24fc2a,_0xed87('0x1e'),JSON[_0xed87('0x20')](_0x2f2fd3));if(_0x2f2fd3[_0xed87('0x21')]){if(_0x2f2fd3[_0xed87('0x21')]['code']===0x1f4){logger[_0xed87('0x21')](_0xed87('0x1d'),_0x24fc2a,_0x2f2fd3[_0xed87('0x21')][_0xed87('0x22')]);return _0x4494da(_0x2f2fd3[_0xed87('0x21')][_0xed87('0x22')]);}logger[_0xed87('0x21')](_0xed87('0x1d'),_0x24fc2a,_0x2f2fd3[_0xed87('0x21')]['message']);return _0x52dfe8(_0x2f2fd3['error']['message']);}else{logger['info'](_0xed87('0x1d'),_0x24fc2a,'request\x20sent');_0x52dfe8(_0x2f2fd3[_0xed87('0x23')][_0xed87('0x22')]);}})['catch'](function(_0x2bab5b){logger['error'](_0xed87('0x1d'),_0x24fc2a,_0x2bab5b);_0x4494da(_0x2bab5b);});});}function respondWithStatusCode(_0x24962e,_0x27799a){_0x27799a=_0x27799a||0xcc;return function(_0x2a8733){if(_0x2a8733){return _0x24962e[_0xed87('0x24')](_0x27799a);}return _0x24962e['status'](_0x27799a)[_0xed87('0x25')]();};}function respondWithResult(_0x3c22b7,_0x41e0d4){_0x41e0d4=_0x41e0d4||0xc8;return function(_0x320bcc){if(_0x320bcc){return _0x3c22b7[_0xed87('0x26')](_0x41e0d4)[_0xed87('0x27')](_0x320bcc);}};}function respondWithFilteredResult(_0x25a6f7,_0x4735b3){return function(_0x40b2fa){if(_0x40b2fa){var _0x38f5c=_0x40b2fa[_0xed87('0x28')],_0x469181=_0x4735b3['offset'],_0x341a35=_0x4735b3[_0xed87('0x29')]+_0x4735b3[_0xed87('0x2a')],_0x16a541;if(_0x341a35>=_0x38f5c){_0x341a35=_0x38f5c;_0x16a541=0xc8;}else{_0x16a541=0xce;}_0x25a6f7['status'](_0x16a541);return _0x25a6f7[_0xed87('0x2b')](_0xed87('0x2c'),_0x469181+'-'+_0x341a35+'/'+_0x38f5c)[_0xed87('0x27')](_0x40b2fa);}return null;};}function patchUpdates(_0x4b259e){return function(_0x4f015c){try{jsonpatch[_0xed87('0x2d')](_0x4f015c,_0x4b259e,!![]);}catch(_0x428b75){return BPromise[_0xed87('0x2e')](_0x428b75);}return _0x4f015c['save']();};}function saveUpdates(_0x37d45a,_0x3b87e3){return function(_0x44bb05){if(_0x44bb05){return _0x44bb05[_0xed87('0x2f')](_0x37d45a)[_0xed87('0x1b')](function(_0x46b9f9){return _0x46b9f9;});}return null;};}function removeEntity(_0x137891,_0x10509d){return function(_0xfdcba4){if(_0xfdcba4){return _0xfdcba4['destroy']()[_0xed87('0x1b')](function(){_0x137891[_0xed87('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b0f,_0x59d84b){return function(_0x4430aa){if(!_0x4430aa){_0x47b0f[_0xed87('0x24')](0x194);}return _0x4430aa;};}function handleError(_0x43b749,_0x46b41b){_0x46b41b=_0x46b41b||0x1f4;return function(_0x103b34){logger[_0xed87('0x21')](_0x103b34[_0xed87('0x30')]);if(_0x103b34[_0xed87('0x31')]){delete _0x103b34[_0xed87('0x31')];}_0x43b749[_0xed87('0x26')](_0x46b41b)[_0xed87('0x32')](_0x103b34);};}exports['index']=function(_0x3763a9,_0x167de8){var _0x584918={},_0x2513bf={},_0x54f6cb={'count':0x0,'rows':[]};var _0x1fe9b3=_[_0xed87('0x33')](db['ZendeskAccount'][_0xed87('0x34')],function(_0x118259){return{'name':_0x118259[_0xed87('0x35')],'type':_0x118259[_0xed87('0x36')][_0xed87('0x37')]};});_0x2513bf['model']=_[_0xed87('0x33')](_0x1fe9b3,'name');_0x2513bf[_0xed87('0x38')]=_['keys'](_0x3763a9[_0xed87('0x38')]);_0x2513bf[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x2513bf[_0xed87('0x3b')],_0x2513bf[_0xed87('0x38')]);_0x584918[_0xed87('0x3c')]=_[_0xed87('0x3a')](_0x2513bf[_0xed87('0x3b')],qs[_0xed87('0x3d')](_0x3763a9['query']['fields']));_0x584918[_0xed87('0x3c')]=_0x584918[_0xed87('0x3c')][_0xed87('0x3e')]?_0x584918[_0xed87('0x3c')]:_0x2513bf[_0xed87('0x3b')];if(!_0x3763a9[_0xed87('0x38')]['hasOwnProperty'](_0xed87('0x3f'))){_0x584918[_0xed87('0x2a')]=qs[_0xed87('0x2a')](_0x3763a9['query'][_0xed87('0x2a')]);_0x584918[_0xed87('0x29')]=qs[_0xed87('0x29')](_0x3763a9[_0xed87('0x38')][_0xed87('0x29')]);}_0x584918[_0xed87('0x40')]=qs[_0xed87('0x41')](_0x3763a9[_0xed87('0x38')][_0xed87('0x41')]);_0x584918[_0xed87('0x42')]=qs['filters'](_[_0xed87('0x43')](_0x3763a9[_0xed87('0x38')],_0x2513bf[_0xed87('0x39')]),_0x1fe9b3);if(_0x3763a9['query']['filter']){_0x584918[_0xed87('0x42')]=_[_0xed87('0x44')](_0x584918[_0xed87('0x42')],{'$or':_[_0xed87('0x33')](_0x1fe9b3,function(_0x59cf18){if(_0x59cf18[_0xed87('0x36')]!==_0xed87('0x45')){var _0x57fa19={};_0x57fa19[_0x59cf18[_0xed87('0x31')]]={'$like':'%'+_0x3763a9[_0xed87('0x38')][_0xed87('0x46')]+'%'};return _0x57fa19;}})});}_0x584918=_[_0xed87('0x44')]({},_0x584918,_0x3763a9[_0xed87('0x47')]);var _0x2770e5={'where':_0x584918[_0xed87('0x42')]};return db[_0xed87('0x48')][_0xed87('0x28')](_0x2770e5)[_0xed87('0x1b')](function(_0x133b8d){_0x54f6cb['count']=_0x133b8d;if(_0x3763a9[_0xed87('0x38')][_0xed87('0x49')]){_0x584918[_0xed87('0x4a')]=[{'all':!![]}];}return db[_0xed87('0x48')][_0xed87('0x4b')](_0x584918);})[_0xed87('0x1b')](function(_0x1d0962){_0x54f6cb[_0xed87('0x4c')]=_0x1d0962;return _0x54f6cb;})[_0xed87('0x1b')](respondWithFilteredResult(_0x167de8,_0x584918))[_0xed87('0x4d')](handleError(_0x167de8,null));};exports[_0xed87('0x4e')]=function(_0x26c8f4,_0x27ed22){var _0x244e18={'raw':![],'where':{'id':_0x26c8f4[_0xed87('0x4f')]['id']}},_0x2ed9c3={};_0x2ed9c3[_0xed87('0x3b')]=_['keys'](db[_0xed87('0x48')][_0xed87('0x34')]);_0x2ed9c3[_0xed87('0x38')]=_['keys'](_0x26c8f4[_0xed87('0x38')]);_0x2ed9c3[_0xed87('0x39')]=_['intersection'](_0x2ed9c3[_0xed87('0x3b')],_0x2ed9c3[_0xed87('0x38')]);_0x244e18[_0xed87('0x3c')]=_[_0xed87('0x3a')](_0x2ed9c3['model'],qs[_0xed87('0x3d')](_0x26c8f4[_0xed87('0x38')][_0xed87('0x3d')]));_0x244e18[_0xed87('0x3c')]=_0x244e18[_0xed87('0x3c')][_0xed87('0x3e')]?_0x244e18[_0xed87('0x3c')]:_0x2ed9c3[_0xed87('0x3b')];if(_0x26c8f4[_0xed87('0x38')][_0xed87('0x49')]){_0x244e18[_0xed87('0x4a')]=[{'all':!![]}];}_0x244e18=_[_0xed87('0x44')]({},_0x244e18,_0x26c8f4[_0xed87('0x47')]);return db['ZendeskAccount'][_0xed87('0x50')](_0x244e18)['then'](handleEntityNotFound(_0x27ed22,null))[_0xed87('0x1b')](respondWithResult(_0x27ed22,null))[_0xed87('0x4d')](handleError(_0x27ed22,null));};exports[_0xed87('0x51')]=function(_0x27ad77,_0x18a3cf){return db[_0xed87('0x48')][_0xed87('0x51')](_0x27ad77[_0xed87('0x52')],{})[_0xed87('0x1b')](respondWithResult(_0x18a3cf,0xc9))[_0xed87('0x4d')](handleError(_0x18a3cf,null));};exports['update']=function(_0x15bc21,_0x279897){if(_0x15bc21[_0xed87('0x52')]['id']){delete _0x15bc21[_0xed87('0x52')]['id'];}return db[_0xed87('0x48')][_0xed87('0x50')]({'where':{'id':_0x15bc21[_0xed87('0x4f')]['id']}})[_0xed87('0x1b')](handleEntityNotFound(_0x279897,null))[_0xed87('0x1b')](saveUpdates(_0x15bc21[_0xed87('0x52')],null))[_0xed87('0x1b')](respondWithResult(_0x279897,null))['catch'](handleError(_0x279897,null));};exports['destroy']=function(_0x152eec,_0x1615ee){return db[_0xed87('0x48')][_0xed87('0x50')]({'where':{'id':_0x152eec[_0xed87('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1615ee,null))[_0xed87('0x1b')](removeEntity(_0x1615ee,null))[_0xed87('0x4d')](handleError(_0x1615ee,null));};exports[_0xed87('0x53')]=function(_0x13e0b8,_0x2ebd80,_0x43034f){var _0x15e3bc={};var _0x1391a2={};var _0x2ffffa;var _0xf4ec55;return db[_0xed87('0x48')][_0xed87('0x54')]({'where':{'id':_0x13e0b8[_0xed87('0x4f')]['id']}})[_0xed87('0x1b')](handleEntityNotFound(_0x2ebd80,null))['then'](function(_0x374333){if(_0x374333){_0x2ffffa=_0x374333;_0x1391a2[_0xed87('0x3b')]=_[_0xed87('0x55')](db[_0xed87('0x56')][_0xed87('0x34')]);_0x1391a2[_0xed87('0x38')]=_[_0xed87('0x55')](_0x13e0b8[_0xed87('0x38')]);_0x1391a2['filters']=_[_0xed87('0x3a')](_0x1391a2[_0xed87('0x3b')],_0x1391a2[_0xed87('0x38')]);_0x15e3bc[_0xed87('0x3c')]=_[_0xed87('0x3a')](_0x1391a2[_0xed87('0x3b')],qs['fields'](_0x13e0b8['query'][_0xed87('0x3d')]));_0x15e3bc[_0xed87('0x3c')]=_0x15e3bc[_0xed87('0x3c')][_0xed87('0x3e')]?_0x15e3bc[_0xed87('0x3c')]:_0x1391a2[_0xed87('0x3b')];_0x15e3bc[_0xed87('0x40')]=qs[_0xed87('0x41')](_0x13e0b8['query'][_0xed87('0x41')]);_0x15e3bc['where']=qs[_0xed87('0x39')](_[_0xed87('0x43')](_0x13e0b8['query'],_0x1391a2[_0xed87('0x39')]));if(_0x13e0b8[_0xed87('0x38')]['filter']){_0x15e3bc[_0xed87('0x42')]=_[_0xed87('0x44')](_0x15e3bc[_0xed87('0x42')],{'$or':_[_0xed87('0x33')](_0x15e3bc[_0xed87('0x3c')],function(_0x593542){var _0x307068={};_0x307068[_0x593542]={'$like':'%'+_0x13e0b8[_0xed87('0x38')][_0xed87('0x46')]+'%'};return _0x307068;})});}_0x15e3bc=_[_0xed87('0x44')]({},_0x15e3bc,_0x13e0b8['options']);return _0x2ffffa['getConfigurations'](_0x15e3bc);}})[_0xed87('0x1b')](function(_0xf8b1e3){if(_0xf8b1e3){_0xf4ec55=_0xf8b1e3['length'];if(!_0x13e0b8[_0xed87('0x38')][_0xed87('0x57')](_0xed87('0x3f'))){_0x15e3bc[_0xed87('0x2a')]=qs[_0xed87('0x2a')](_0x13e0b8[_0xed87('0x38')][_0xed87('0x2a')]);_0x15e3bc[_0xed87('0x29')]=qs[_0xed87('0x29')](_0x13e0b8[_0xed87('0x38')][_0xed87('0x29')]);}return _0x2ffffa[_0xed87('0x53')](_0x15e3bc);}})[_0xed87('0x1b')](function(_0x156ef0){if(_0x156ef0){return _0x156ef0?{'count':_0xf4ec55,'rows':_0x156ef0}:null;}})['then'](respondWithResult(_0x2ebd80,null))[_0xed87('0x4d')](handleError(_0x2ebd80,null));};exports[_0xed87('0x58')]=function(_0x566ace,_0x4f7b92,_0x5136c9){if(_0x566ace[_0xed87('0x52')]['id']){delete _0x566ace[_0xed87('0x52')]['id'];}return db[_0xed87('0x48')][_0xed87('0x54')]({'where':{'id':_0x566ace[_0xed87('0x4f')]['id']}})[_0xed87('0x1b')](handleEntityNotFound(_0x4f7b92,null))[_0xed87('0x1b')](function(_0x48fcc7){if(_0x48fcc7){_0x566ace[_0xed87('0x52')][_0xed87('0x59')]=_0x48fcc7['id'];_0x566ace[_0xed87('0x52')][_0xed87('0x5a')]=integrations[_0xed87('0x5b')](_0x566ace[_0xed87('0x52')][_0xed87('0x5c')],_0x566ace[_0xed87('0x52')][_0xed87('0x36')]);_0x566ace[_0xed87('0x52')]['Descriptions']=integrations['getDescriptions'](_0x566ace['body'][_0xed87('0x5c')],_0x566ace[_0xed87('0x52')][_0xed87('0x36')]);return db[_0xed87('0x56')][_0xed87('0x51')](_0x566ace['body'],{'include':[{'model':db[_0xed87('0x5d')],'as':_0xed87('0x5a')},{'model':db[_0xed87('0x5d')],'as':_0xed87('0x5e')}]});}return null;})[_0xed87('0x1b')](respondWithResult(_0x4f7b92,null))[_0xed87('0x4d')](handleError(_0x4f7b92,null));};exports['getFields']=function(_0x559b52,_0x2f5b5b,_0xb45c32){var _0x8d803='';return db[_0xed87('0x48')][_0xed87('0x54')]({'where':{'id':_0x559b52[_0xed87('0x4f')]['id']},'attributes':['id',_0xed87('0x5f'),_0xed87('0x60'),_0xed87('0x61'),_0xed87('0x62'),_0xed87('0x63')]})[_0xed87('0x1b')](handleEntityNotFound(_0x2f5b5b,null))['then'](function(_0x315617){if(_0x315617){_0x8d803=_0x315617[_0xed87('0x63')];var _0x1511f3=_0x8d803[_0xed87('0x64')](-0x1);if(_0x1511f3==='/'){_0x8d803=_0x8d803[_0xed87('0x65')](0x0,_0x8d803[_0xed87('0x66')](_0x1511f3));}var _0x4ae84c={'method':_0xed87('0x67'),'uri':util[_0xed87('0x68')](_0xed87('0x69'),_0x8d803,_0xed87('0x6a')),'json':!![]};switch(_0x315617['authType']){case'password':_0x4ae84c['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xed87('0x68')](_0xed87('0x6b'),_0x315617[_0xed87('0x5f')],_0x315617[_0xed87('0x60')]))[_0xed87('0x6c')](_0xed87('0x6d')))};break;case _0xed87('0x61'):_0x4ae84c[_0xed87('0x6e')]={'Authorization':util[_0xed87('0x68')]('Basic\x20%s',new Buffer(util['format'](_0xed87('0x6f'),_0x315617[_0xed87('0x5f')],_0x315617[_0xed87('0x61')]))[_0xed87('0x6c')](_0xed87('0x6d')))};break;default:throw new db['Sequelize']['ValidationError'](_0xed87('0x70'));}return rp(_0x4ae84c);}})[_0xed87('0x1b')](function(_0x487a63){if(_0x487a63){var _0x59f4bd=['subject',_0xed87('0x71'),'group',_0xed87('0x72')];_[_0xed87('0x73')](_0x487a63[_0xed87('0x6a')],function(_0x1940cd){return _0x59f4bd[_0xed87('0x74')](_0x1940cd['type']);});return{'count':_0x487a63[_0xed87('0x6a')][_0xed87('0x3e')],'rows':_['map'](_0x487a63[_0xed87('0x6a')],function(_0x5c2be3){return{'id':_0x5c2be3['id'],'name':_0x5c2be3[_0xed87('0x75')]>0x7?_0x5c2be3[_0xed87('0x76')]:_0x5c2be3['type'],'custom':_0x5c2be3[_0xed87('0x75')]>0x7?!![]:![],'options':_0x5c2be3[_0xed87('0x77')]?_0x5c2be3['system_field_options']:_0x5c2be3[_0xed87('0x78')]?_0x5c2be3[_0xed87('0x78')]:[]};})};}})[_0xed87('0x1b')](respondWithResult(_0x2f5b5b,null))[_0xed87('0x4d')](function(_0x517b0e){var _0x3d596c=_0x559b52[_0xed87('0x38')][_0xed87('0x79')]?0x1f4:_0x517b0e[_0xed87('0x7a')]||0x1f4;logger[_0xed87('0x21')](_0xed87('0x7b'),_0xed87('0x7c'),_0x3d596c,JSON[_0xed87('0x20')](_0x517b0e));delete _0x517b0e[_0xed87('0x31')];if(_0x3d596c===0x191){_0x3d596c=0x190;}_0x2f5b5b[_0xed87('0x26')](_0x3d596c)[_0xed87('0x32')](_0x559b52[_0xed87('0x38')][_0xed87('0x79')]?{'message':_0xed87('0x7d'),'statusCode':_0x517b0e[_0xed87('0x7a')]}:_0x517b0e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b2a9a4c..60dda88 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 _0xb2cb=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5398d8,_0x4c51ce){var _0x1e1bdc=function(_0x12c557){while(--_0x12c557){_0x5398d8['push'](_0x5398d8['shift']());}};_0x1e1bdc(++_0x4c51ce);}(_0xb2cb,0x87));var _0xbb2c=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xb2cb[_0x29db36];return _0x234e87;};'use strict';var _=require(_0xbb2c('0x0'));var util=require('util');var logger=require(_0xbb2c('0x1'))(_0xbb2c('0x2'));var moment=require(_0xbb2c('0x3'));var BPromise=require(_0xbb2c('0x4'));var rp=require(_0xbb2c('0x5'));var fs=require('fs');var path=require(_0xbb2c('0x6'));var rimraf=require(_0xbb2c('0x7'));var config=require(_0xbb2c('0x8'));var attributes=require(_0xbb2c('0x9'));var integrations=require(_0xbb2c('0xa'));module[_0xbb2c('0xb')]=function(_0x354c58,_0x3eeda3){return _0x354c58['define']('ZendeskAccount',attributes,{'tableName':_0xbb2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95ea=['request-promise','path','rimraf','./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','util','../../config/logger','api','moment'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x95ea,0xa1));var _0xa95e=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x95ea[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0xa95e('0x0'));var logger=require(_0xa95e('0x1'))(_0xa95e('0x2'));var moment=require(_0xa95e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa95e('0x4'));var fs=require('fs');var path=require(_0xa95e('0x5'));var rimraf=require(_0xa95e('0x6'));var config=require('../../config/environment');var attributes=require(_0xa95e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa95e('0x8')]=function(_0x295241,_0x266b9f){return _0x295241[_0xa95e('0x9')]('ZendeskAccount',attributes,{'tableName':_0xa95e('0xa'),'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 7ba93a1..9968f40 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xcb91[_0x1928c9];return _0x51b5fb;};'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')]('ZendeskAccount,\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);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x61bb09,_0x4b6e71){var _0x2e1fab=function(_0x4269e5){while(--_0x4269e5){_0x61bb09['push'](_0x61bb09['shift']());}};_0x2e1fab(++_0x4b6e71);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 07cdbb6..00b1be5 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 _0xb535=['getDescriptions','create','post','/:id/tags','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects'];(function(_0x33bb0d,_0x546529){var _0x1efcb7=function(_0xf4a621){while(--_0xf4a621){_0x33bb0d['push'](_0x33bb0d['shift']());}};_0x1efcb7(++_0x546529);}(_0xb535,0x111));var _0x5b53=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xb535[_0x4d7116];return _0x4593dc;};'use strict';var multer=require(_0x5b53('0x0'));var util=require(_0x5b53('0x1'));var path=require('path');var timeout=require(_0x5b53('0x2'));var express=require('express');var router=express[_0x5b53('0x3')]();var auth=require(_0x5b53('0x4'));var interaction=require(_0x5b53('0x5'));var config=require(_0x5b53('0x6'));var controller=require(_0x5b53('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5b53('0x8')]);router[_0x5b53('0x9')](_0x5b53('0xa'),auth['isAuthenticated'](),controller[_0x5b53('0xb')]);router[_0x5b53('0x9')](_0x5b53('0xc'),auth[_0x5b53('0xd')](),controller['getFields']);router[_0x5b53('0x9')](_0x5b53('0xe'),auth[_0x5b53('0xd')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5b53('0xf')]);router[_0x5b53('0x9')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x5b53('0x10')]);router[_0x5b53('0x11')](_0x5b53('0x12'),auth[_0x5b53('0xd')](),controller['setTags']);router[_0x5b53('0x13')](_0x5b53('0xa'),auth[_0x5b53('0xd')](),controller[_0x5b53('0x14')]);router[_0x5b53('0x15')](_0x5b53('0xa'),auth[_0x5b53('0xd')](),controller[_0x5b53('0x16')]);module[_0x5b53('0x17')]=router; \ No newline at end of file +var _0x80b6=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','express'];(function(_0x43841f,_0x4df0c4){var _0x417f61=function(_0x4a354e){while(--_0x4a354e){_0x43841f['push'](_0x43841f['shift']());}};_0x417f61(++_0x4df0c4);}(_0x80b6,0x1b4));var _0x680b=function(_0x36e1b1,_0x315ec4){_0x36e1b1=_0x36e1b1-0x0;var _0x57b6ab=_0x80b6[_0x36e1b1];return _0x57b6ab;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x680b('0x0'));var router=express[_0x680b('0x1')]();var auth=require(_0x680b('0x2'));var interaction=require(_0x680b('0x3'));var config=require(_0x680b('0x4'));var controller=require(_0x680b('0x5'));router[_0x680b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x680b('0x6')]('/:id',auth[_0x680b('0x7')](),controller[_0x680b('0x8')]);router['get'](_0x680b('0x9'),auth[_0x680b('0x7')](),controller[_0x680b('0xa')]);router[_0x680b('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x680b('0xb')]);router[_0x680b('0x6')]('/:id/descriptions',auth[_0x680b('0x7')](),controller[_0x680b('0xc')]);router[_0x680b('0x6')]('/:id/tags',auth[_0x680b('0x7')](),controller[_0x680b('0xd')]);router['post']('/',auth[_0x680b('0x7')](),controller[_0x680b('0xe')]);router[_0x680b('0xf')]('/:id/tags',auth[_0x680b('0x7')](),controller[_0x680b('0x10')]);router[_0x680b('0x11')](_0x680b('0x12'),auth['isAuthenticated'](),controller[_0x680b('0x13')]);router[_0x680b('0x14')](_0x680b('0x12'),auth['isAuthenticated'](),controller[_0x680b('0x15')]);module[_0x680b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 98b702d..6a82301 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 _0x6b7b=['STRING'];(function(_0x3b2d17,_0x2e7ad5){var _0x34c9a7=function(_0x5a7c0e){while(--_0x5a7c0e){_0x3b2d17['push'](_0x3b2d17['shift']());}};_0x34c9a7(++_0x2e7ad5);}(_0x6b7b,0x1a9));var _0xb6b7=function(_0x4d2626,_0x59624c){_0x4d2626=_0x4d2626-0x0;var _0x1d8e3a=_0x6b7b[_0x4d2626];return _0x1d8e3a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb6b7('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86f8=['sequelize','exports','STRING'];(function(_0x371583,_0x272bd4){var _0x20e01e=function(_0x55d097){while(--_0x55d097){_0x371583['push'](_0x371583['shift']());}};_0x20e01e(++_0x272bd4);}(_0x86f8,0xff));var _0x886f=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x86f8[_0xcaf223];return _0x17e00d;};'use strict';var Sequelize=require(_0x886f('0x0'));module[_0x886f('0x1')]={'name':{'type':Sequelize[_0x886f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 87b7e5c..43007b0 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 _0xad18=['index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','show','params','keys','find','create','body','destroy','getFields','ZendeskField','order','pick','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','name','send'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0xad18,0x8a));var _0x8ad1=function(_0x83609a,_0x4623de){_0x83609a=_0x83609a-0x0;var _0x3de3aa=_0xad18[_0x83609a];return _0x3de3aa;};'use strict';var pdf=require(_0x8ad1('0x0'));var emlformat=require(_0x8ad1('0x1'));var rimraf=require(_0x8ad1('0x2'));var zipdir=require(_0x8ad1('0x3'));var jsonpatch=require(_0x8ad1('0x4'));var rp=require(_0x8ad1('0x5'));var moment=require(_0x8ad1('0x6'));var BPromise=require(_0x8ad1('0x7'));var Mustache=require('mustache');var util=require(_0x8ad1('0x8'));var path=require(_0x8ad1('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ad1('0xa'));var fs=require('fs');var _=require(_0x8ad1('0xb'));var squel=require('squel');var crypto=require(_0x8ad1('0xc'));var jsforce=require(_0x8ad1('0xd'));var deskjs=require(_0x8ad1('0xe'));var toCsv=require(_0x8ad1('0xf'));var querystring=require(_0x8ad1('0x10'));var Papa=require(_0x8ad1('0x11'));var Redis=require(_0x8ad1('0x12'));var authService=require(_0x8ad1('0x13'));var qs=require(_0x8ad1('0x14'));var as=require(_0x8ad1('0x15'));var hardwareService=require(_0x8ad1('0x16'));var logger=require(_0x8ad1('0x17'))(_0x8ad1('0x18'));var utils=require(_0x8ad1('0x19'));var config=require(_0x8ad1('0x1a'));var licenseUtil=require(_0x8ad1('0x1b'));var db=require(_0x8ad1('0x1c'))['db'];var jayson=require(_0x8ad1('0x1d'));var client=jayson['client'][_0x8ad1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x449653,_0x571294,_0x2e23fa,_0x3d2863){return new BPromise(function(_0x3e538d,_0x573cb5){var _0x1b1396=_0x3d2863||client;return _0x1b1396[_0x8ad1('0x1f')](_0x449653,_0x2e23fa)[_0x8ad1('0x20')](function(_0x57c487){logger[_0x8ad1('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x571294,_0x8ad1('0x22'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x571294,'request\x20sent',JSON[_0x8ad1('0x23')](_0x57c487));if(_0x57c487[_0x8ad1('0x24')]){if(_0x57c487[_0x8ad1('0x24')][_0x8ad1('0x25')]===0x1f4){logger[_0x8ad1('0x24')](_0x8ad1('0x26'),_0x571294,_0x57c487[_0x8ad1('0x24')]['message']);return _0x573cb5(_0x57c487[_0x8ad1('0x24')]['message']);}logger[_0x8ad1('0x24')](_0x8ad1('0x26'),_0x571294,_0x57c487['error']['message']);return _0x3e538d(_0x57c487[_0x8ad1('0x24')]['message']);}else{logger[_0x8ad1('0x21')](_0x8ad1('0x26'),_0x571294,'request\x20sent');_0x3e538d(_0x57c487[_0x8ad1('0x27')]['message']);}})[_0x8ad1('0x28')](function(_0x4ff7c4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x571294,_0x4ff7c4);_0x573cb5(_0x4ff7c4);});});}function respondWithStatusCode(_0x1b71fc,_0xabaf86){_0xabaf86=_0xabaf86||0xcc;return function(_0xb95a58){if(_0xb95a58){return _0x1b71fc['sendStatus'](_0xabaf86);}return _0x1b71fc[_0x8ad1('0x29')](_0xabaf86)[_0x8ad1('0x2a')]();};}function respondWithResult(_0x2115b8,_0x4be8da){_0x4be8da=_0x4be8da||0xc8;return function(_0x110370){if(_0x110370){return _0x2115b8['status'](_0x4be8da)['json'](_0x110370);}};}function respondWithFilteredResult(_0xdacbbd,_0x39cb29){return function(_0x1ecd36){if(_0x1ecd36){var _0xd9990b=_0x1ecd36[_0x8ad1('0x2b')],_0x1bdabb=_0x39cb29[_0x8ad1('0x2c')],_0x299ffa=_0x39cb29[_0x8ad1('0x2c')]+_0x39cb29[_0x8ad1('0x2d')],_0x46acb1;if(_0x299ffa>=_0xd9990b){_0x299ffa=_0xd9990b;_0x46acb1=0xc8;}else{_0x46acb1=0xce;}_0xdacbbd[_0x8ad1('0x29')](_0x46acb1);return _0xdacbbd[_0x8ad1('0x2e')](_0x8ad1('0x2f'),_0x1bdabb+'-'+_0x299ffa+'/'+_0xd9990b)[_0x8ad1('0x30')](_0x1ecd36);}return null;};}function patchUpdates(_0x926095){return function(_0x5b8d13){try{jsonpatch[_0x8ad1('0x31')](_0x5b8d13,_0x926095,!![]);}catch(_0x24bca0){return BPromise['reject'](_0x24bca0);}return _0x5b8d13[_0x8ad1('0x32')]();};}function saveUpdates(_0x2f7b46,_0x76b785){return function(_0x32746d){if(_0x32746d){return _0x32746d[_0x8ad1('0x33')](_0x2f7b46)[_0x8ad1('0x20')](function(_0x481baa){return _0x481baa;});}return null;};}function removeEntity(_0x27ed01,_0x51e7f2){return function(_0x297969){if(_0x297969){return _0x297969['destroy']()[_0x8ad1('0x20')](function(){_0x27ed01[_0x8ad1('0x29')](0xcc)[_0x8ad1('0x2a')]();});}};}function handleEntityNotFound(_0x34c2dc,_0x501219){return function(_0x5baf3d){if(!_0x5baf3d){_0x34c2dc['sendStatus'](0x194);}return _0x5baf3d;};}function handleError(_0xc0a9ca,_0x4ddc04){_0x4ddc04=_0x4ddc04||0x1f4;return function(_0x311194){logger[_0x8ad1('0x24')](_0x311194['stack']);if(_0x311194[_0x8ad1('0x34')]){delete _0x311194[_0x8ad1('0x34')];}_0xc0a9ca[_0x8ad1('0x29')](_0x4ddc04)[_0x8ad1('0x35')](_0x311194);};}exports[_0x8ad1('0x36')]=function(_0x5de612,_0x2716f3){var _0x487c35={},_0x35ffa1={},_0x124694={'count':0x0,'rows':[]};var _0x1a7128=_[_0x8ad1('0x37')](db[_0x8ad1('0x38')][_0x8ad1('0x39')],function(_0x501150){return{'name':_0x501150[_0x8ad1('0x3a')],'type':_0x501150[_0x8ad1('0x3b')][_0x8ad1('0x3c')]};});_0x35ffa1[_0x8ad1('0x3d')]=_[_0x8ad1('0x37')](_0x1a7128,_0x8ad1('0x34'));_0x35ffa1[_0x8ad1('0x3e')]=_['keys'](_0x5de612[_0x8ad1('0x3e')]);_0x35ffa1['filters']=_['intersection'](_0x35ffa1[_0x8ad1('0x3d')],_0x35ffa1[_0x8ad1('0x3e')]);_0x487c35[_0x8ad1('0x3f')]=_[_0x8ad1('0x40')](_0x35ffa1[_0x8ad1('0x3d')],qs[_0x8ad1('0x41')](_0x5de612[_0x8ad1('0x3e')]['fields']));_0x487c35[_0x8ad1('0x3f')]=_0x487c35[_0x8ad1('0x3f')][_0x8ad1('0x42')]?_0x487c35[_0x8ad1('0x3f')]:_0x35ffa1[_0x8ad1('0x3d')];if(!_0x5de612[_0x8ad1('0x3e')][_0x8ad1('0x43')](_0x8ad1('0x44'))){_0x487c35[_0x8ad1('0x2d')]=qs[_0x8ad1('0x2d')](_0x5de612[_0x8ad1('0x3e')][_0x8ad1('0x2d')]);_0x487c35[_0x8ad1('0x2c')]=qs[_0x8ad1('0x2c')](_0x5de612[_0x8ad1('0x3e')][_0x8ad1('0x2c')]);}_0x487c35['order']=qs[_0x8ad1('0x45')](_0x5de612[_0x8ad1('0x3e')][_0x8ad1('0x45')]);_0x487c35[_0x8ad1('0x46')]=qs[_0x8ad1('0x47')](_['pick'](_0x5de612[_0x8ad1('0x3e')],_0x35ffa1['filters']),_0x1a7128);if(_0x5de612[_0x8ad1('0x3e')][_0x8ad1('0x48')]){_0x487c35[_0x8ad1('0x46')]=_[_0x8ad1('0x49')](_0x487c35[_0x8ad1('0x46')],{'$or':_[_0x8ad1('0x37')](_0x1a7128,function(_0x4ecc88){if(_0x4ecc88['type']!=='VIRTUAL'){var _0x60d132={};_0x60d132[_0x4ecc88[_0x8ad1('0x34')]]={'$like':'%'+_0x5de612['query'][_0x8ad1('0x48')]+'%'};return _0x60d132;}})});}_0x487c35=_[_0x8ad1('0x49')]({},_0x487c35,_0x5de612[_0x8ad1('0x4a')]);var _0x38c0ef={'where':_0x487c35[_0x8ad1('0x46')]};return db['ZendeskConfiguration'][_0x8ad1('0x2b')](_0x38c0ef)[_0x8ad1('0x20')](function(_0x23e202){_0x124694[_0x8ad1('0x2b')]=_0x23e202;if(_0x5de612[_0x8ad1('0x3e')][_0x8ad1('0x4b')]){_0x487c35[_0x8ad1('0x4c')]=[{'all':!![]}];}return db[_0x8ad1('0x38')]['findAll'](_0x487c35);})[_0x8ad1('0x20')](function(_0x51f76e){_0x124694[_0x8ad1('0x4d')]=_0x51f76e;return _0x124694;})['then'](respondWithFilteredResult(_0x2716f3,_0x487c35))[_0x8ad1('0x28')](handleError(_0x2716f3,null));};exports[_0x8ad1('0x4e')]=function(_0x521351,_0x35f288){var _0x4570b3={'raw':![],'where':{'id':_0x521351[_0x8ad1('0x4f')]['id']}},_0x2e0db7={};_0x2e0db7[_0x8ad1('0x3d')]=_[_0x8ad1('0x50')](db[_0x8ad1('0x38')][_0x8ad1('0x39')]);_0x2e0db7[_0x8ad1('0x3e')]=_[_0x8ad1('0x50')](_0x521351[_0x8ad1('0x3e')]);_0x2e0db7[_0x8ad1('0x47')]=_[_0x8ad1('0x40')](_0x2e0db7[_0x8ad1('0x3d')],_0x2e0db7[_0x8ad1('0x3e')]);_0x4570b3[_0x8ad1('0x3f')]=_[_0x8ad1('0x40')](_0x2e0db7[_0x8ad1('0x3d')],qs['fields'](_0x521351['query'][_0x8ad1('0x41')]));_0x4570b3[_0x8ad1('0x3f')]=_0x4570b3['attributes'][_0x8ad1('0x42')]?_0x4570b3['attributes']:_0x2e0db7[_0x8ad1('0x3d')];if(_0x521351[_0x8ad1('0x3e')][_0x8ad1('0x4b')]){_0x4570b3['include']=[{'all':!![]}];}_0x4570b3=_['merge']({},_0x4570b3,_0x521351['options']);return db['ZendeskConfiguration'][_0x8ad1('0x51')](_0x4570b3)[_0x8ad1('0x20')](handleEntityNotFound(_0x35f288,null))[_0x8ad1('0x20')](respondWithResult(_0x35f288,null))[_0x8ad1('0x28')](handleError(_0x35f288,null));};exports[_0x8ad1('0x52')]=function(_0xc85708,_0x118893){return db[_0x8ad1('0x38')][_0x8ad1('0x52')](_0xc85708[_0x8ad1('0x53')],{})[_0x8ad1('0x20')](respondWithResult(_0x118893,0xc9))[_0x8ad1('0x28')](handleError(_0x118893,null));};exports['update']=function(_0x5d379b,_0x288e26){if(_0x5d379b[_0x8ad1('0x53')]['id']){delete _0x5d379b[_0x8ad1('0x53')]['id'];}return db[_0x8ad1('0x38')]['find']({'where':{'id':_0x5d379b['params']['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x288e26,null))[_0x8ad1('0x20')](saveUpdates(_0x5d379b['body'],null))[_0x8ad1('0x20')](respondWithResult(_0x288e26,null))[_0x8ad1('0x28')](handleError(_0x288e26,null));};exports[_0x8ad1('0x54')]=function(_0x135c2b,_0x255af2){return db[_0x8ad1('0x38')][_0x8ad1('0x51')]({'where':{'id':_0x135c2b[_0x8ad1('0x4f')]['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x255af2,null))['then'](removeEntity(_0x255af2,null))[_0x8ad1('0x28')](handleError(_0x255af2,null));};exports[_0x8ad1('0x55')]=function(_0x236ef4,_0x2ecb81,_0x482a7f){var _0x34a3ee={};var _0x4cb96e={};var _0x510253;var _0x3373fa;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x236ef4['params']['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x2ecb81,null))[_0x8ad1('0x20')](function(_0x8ccbef){if(_0x8ccbef){_0x510253=_0x8ccbef;_0x4cb96e['model']=_[_0x8ad1('0x50')](db[_0x8ad1('0x56')][_0x8ad1('0x39')]);_0x4cb96e[_0x8ad1('0x3e')]=_[_0x8ad1('0x50')](_0x236ef4[_0x8ad1('0x3e')]);_0x4cb96e[_0x8ad1('0x47')]=_[_0x8ad1('0x40')](_0x4cb96e[_0x8ad1('0x3d')],_0x4cb96e[_0x8ad1('0x3e')]);_0x34a3ee[_0x8ad1('0x3f')]=_[_0x8ad1('0x40')](_0x4cb96e[_0x8ad1('0x3d')],qs['fields'](_0x236ef4['query'][_0x8ad1('0x41')]));_0x34a3ee[_0x8ad1('0x3f')]=_0x34a3ee[_0x8ad1('0x3f')][_0x8ad1('0x42')]?_0x34a3ee[_0x8ad1('0x3f')]:_0x4cb96e[_0x8ad1('0x3d')];_0x34a3ee[_0x8ad1('0x57')]=qs[_0x8ad1('0x45')](_0x236ef4[_0x8ad1('0x3e')][_0x8ad1('0x45')]);_0x34a3ee[_0x8ad1('0x46')]=qs['filters'](_[_0x8ad1('0x58')](_0x236ef4[_0x8ad1('0x3e')],_0x4cb96e[_0x8ad1('0x47')]));if(_0x236ef4['query'][_0x8ad1('0x48')]){_0x34a3ee[_0x8ad1('0x46')]=_[_0x8ad1('0x49')](_0x34a3ee[_0x8ad1('0x46')],{'$or':_['map'](_0x34a3ee[_0x8ad1('0x3f')],function(_0x2d591d){var _0x8d8834={};_0x8d8834[_0x2d591d]={'$like':'%'+_0x236ef4[_0x8ad1('0x3e')][_0x8ad1('0x48')]+'%'};return _0x8d8834;})});}_0x34a3ee=_[_0x8ad1('0x49')]({},_0x34a3ee,_0x236ef4[_0x8ad1('0x4a')]);return _0x510253['getFields'](_0x34a3ee);}})[_0x8ad1('0x20')](function(_0x38e16f){if(_0x38e16f){_0x3373fa=_0x38e16f[_0x8ad1('0x42')];if(!_0x236ef4[_0x8ad1('0x3e')][_0x8ad1('0x43')](_0x8ad1('0x44'))){_0x34a3ee[_0x8ad1('0x2d')]=qs[_0x8ad1('0x2d')](_0x236ef4[_0x8ad1('0x3e')][_0x8ad1('0x2d')]);_0x34a3ee['offset']=qs[_0x8ad1('0x2c')](_0x236ef4[_0x8ad1('0x3e')][_0x8ad1('0x2c')]);}return _0x510253[_0x8ad1('0x55')](_0x34a3ee);}})[_0x8ad1('0x20')](function(_0x52e108){if(_0x52e108){return _0x52e108?{'count':_0x3373fa,'rows':_0x52e108}:null;}})['then'](respondWithResult(_0x2ecb81,null))[_0x8ad1('0x28')](handleError(_0x2ecb81,null));};exports[_0x8ad1('0x59')]=function(_0x524120,_0x4bf4ea,_0x11944e){var _0x87e39b={};var _0x22d8ed={};var _0x21280c;var _0x5cbc4b;return db[_0x8ad1('0x38')]['findOne']({'where':{'id':_0x524120[_0x8ad1('0x4f')]['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x4bf4ea,null))[_0x8ad1('0x20')](function(_0x20b472){if(_0x20b472){_0x21280c=_0x20b472;_0x22d8ed['model']=_['keys'](db[_0x8ad1('0x56')][_0x8ad1('0x39')]);_0x22d8ed[_0x8ad1('0x3e')]=_['keys'](_0x524120[_0x8ad1('0x3e')]);_0x22d8ed['filters']=_[_0x8ad1('0x40')](_0x22d8ed[_0x8ad1('0x3d')],_0x22d8ed[_0x8ad1('0x3e')]);_0x87e39b[_0x8ad1('0x3f')]=_[_0x8ad1('0x40')](_0x22d8ed[_0x8ad1('0x3d')],qs[_0x8ad1('0x41')](_0x524120[_0x8ad1('0x3e')][_0x8ad1('0x41')]));_0x87e39b['attributes']=_0x87e39b[_0x8ad1('0x3f')]['length']?_0x87e39b[_0x8ad1('0x3f')]:_0x22d8ed['model'];_0x87e39b[_0x8ad1('0x57')]=qs[_0x8ad1('0x45')](_0x524120[_0x8ad1('0x3e')][_0x8ad1('0x45')]);_0x87e39b[_0x8ad1('0x46')]=qs[_0x8ad1('0x47')](_[_0x8ad1('0x58')](_0x524120[_0x8ad1('0x3e')],_0x22d8ed[_0x8ad1('0x47')]));if(_0x524120[_0x8ad1('0x3e')]['filter']){_0x87e39b[_0x8ad1('0x46')]=_[_0x8ad1('0x49')](_0x87e39b['where'],{'$or':_[_0x8ad1('0x37')](_0x87e39b[_0x8ad1('0x3f')],function(_0x1828cc){var _0x5efd38={};_0x5efd38[_0x1828cc]={'$like':'%'+_0x524120[_0x8ad1('0x3e')][_0x8ad1('0x48')]+'%'};return _0x5efd38;})});}_0x87e39b=_[_0x8ad1('0x49')]({},_0x87e39b,_0x524120[_0x8ad1('0x4a')]);return _0x21280c['getSubjects'](_0x87e39b);}})[_0x8ad1('0x20')](function(_0x304435){if(_0x304435){_0x5cbc4b=_0x304435[_0x8ad1('0x42')];if(!_0x524120[_0x8ad1('0x3e')][_0x8ad1('0x43')]('nolimit')){_0x87e39b[_0x8ad1('0x2d')]=qs[_0x8ad1('0x2d')](_0x524120['query'][_0x8ad1('0x2d')]);_0x87e39b[_0x8ad1('0x2c')]=qs[_0x8ad1('0x2c')](_0x524120[_0x8ad1('0x3e')][_0x8ad1('0x2c')]);}return _0x21280c[_0x8ad1('0x59')](_0x87e39b);}})[_0x8ad1('0x20')](function(_0x7e18bb){if(_0x7e18bb){return _0x7e18bb?{'count':_0x5cbc4b,'rows':_0x7e18bb}:null;}})['then'](respondWithResult(_0x4bf4ea,null))[_0x8ad1('0x28')](handleError(_0x4bf4ea,null));};exports[_0x8ad1('0x5a')]=function(_0x56b767,_0x201ac6,_0x2bd2f9){var _0x3a69c8={};var _0x4658c8={};var _0x36fe4b;var _0x1f4878;return db[_0x8ad1('0x38')][_0x8ad1('0x5b')]({'where':{'id':_0x56b767[_0x8ad1('0x4f')]['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x201ac6,null))[_0x8ad1('0x20')](function(_0x27a36b){if(_0x27a36b){_0x36fe4b=_0x27a36b;_0x4658c8[_0x8ad1('0x3d')]=_['keys'](db[_0x8ad1('0x56')]['rawAttributes']);_0x4658c8[_0x8ad1('0x3e')]=_[_0x8ad1('0x50')](_0x56b767['query']);_0x4658c8[_0x8ad1('0x47')]=_[_0x8ad1('0x40')](_0x4658c8[_0x8ad1('0x3d')],_0x4658c8[_0x8ad1('0x3e')]);_0x3a69c8['attributes']=_['intersection'](_0x4658c8[_0x8ad1('0x3d')],qs[_0x8ad1('0x41')](_0x56b767['query'][_0x8ad1('0x41')]));_0x3a69c8[_0x8ad1('0x3f')]=_0x3a69c8[_0x8ad1('0x3f')][_0x8ad1('0x42')]?_0x3a69c8[_0x8ad1('0x3f')]:_0x4658c8['model'];_0x3a69c8[_0x8ad1('0x57')]=qs['sort'](_0x56b767[_0x8ad1('0x3e')][_0x8ad1('0x45')]);_0x3a69c8[_0x8ad1('0x46')]=qs[_0x8ad1('0x47')](_[_0x8ad1('0x58')](_0x56b767[_0x8ad1('0x3e')],_0x4658c8['filters']));if(_0x56b767['query'][_0x8ad1('0x48')]){_0x3a69c8[_0x8ad1('0x46')]=_['merge'](_0x3a69c8[_0x8ad1('0x46')],{'$or':_[_0x8ad1('0x37')](_0x3a69c8[_0x8ad1('0x3f')],function(_0x24856a){var _0x103b10={};_0x103b10[_0x24856a]={'$like':'%'+_0x56b767[_0x8ad1('0x3e')][_0x8ad1('0x48')]+'%'};return _0x103b10;})});}_0x3a69c8=_[_0x8ad1('0x49')]({},_0x3a69c8,_0x56b767[_0x8ad1('0x4a')]);return _0x36fe4b[_0x8ad1('0x5a')](_0x3a69c8);}})['then'](function(_0x301e1e){if(_0x301e1e){_0x1f4878=_0x301e1e[_0x8ad1('0x42')];if(!_0x56b767[_0x8ad1('0x3e')][_0x8ad1('0x43')](_0x8ad1('0x44'))){_0x3a69c8[_0x8ad1('0x2d')]=qs['limit'](_0x56b767[_0x8ad1('0x3e')][_0x8ad1('0x2d')]);_0x3a69c8[_0x8ad1('0x2c')]=qs[_0x8ad1('0x2c')](_0x56b767['query'][_0x8ad1('0x2c')]);}return _0x36fe4b[_0x8ad1('0x5a')](_0x3a69c8);}})[_0x8ad1('0x20')](function(_0xe2e599){if(_0xe2e599){return _0xe2e599?{'count':_0x1f4878,'rows':_0xe2e599}:null;}})[_0x8ad1('0x20')](respondWithResult(_0x201ac6,null))['catch'](handleError(_0x201ac6,null));};exports[_0x8ad1('0x5c')]=function(_0xc23c6b,_0x2dd0ba,_0x1651cc){var _0x592da0={};var _0x2029ba={};var _0x47b3e7;var _0x45bc2e;return db[_0x8ad1('0x38')]['findOne']({'where':{'id':_0xc23c6b[_0x8ad1('0x4f')]['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x2dd0ba,null))['then'](function(_0x17cee7){if(_0x17cee7){_0x47b3e7=_0x17cee7;_0x2029ba['model']=_[_0x8ad1('0x50')](db[_0x8ad1('0x5d')][_0x8ad1('0x39')]);_0x2029ba[_0x8ad1('0x3e')]=_[_0x8ad1('0x50')](_0xc23c6b[_0x8ad1('0x3e')]);_0x2029ba[_0x8ad1('0x47')]=_['intersection'](_0x2029ba[_0x8ad1('0x3d')],_0x2029ba['query']);_0x592da0['attributes']=_[_0x8ad1('0x40')](_0x2029ba[_0x8ad1('0x3d')],qs[_0x8ad1('0x41')](_0xc23c6b[_0x8ad1('0x3e')][_0x8ad1('0x41')]));_0x592da0['attributes']=_0x592da0[_0x8ad1('0x3f')]['length']?_0x592da0[_0x8ad1('0x3f')]:_0x2029ba[_0x8ad1('0x3d')];_0x592da0[_0x8ad1('0x57')]=qs[_0x8ad1('0x45')](_0xc23c6b[_0x8ad1('0x3e')]['sort']);_0x592da0['where']=qs[_0x8ad1('0x47')](_[_0x8ad1('0x58')](_0xc23c6b[_0x8ad1('0x3e')],_0x2029ba[_0x8ad1('0x47')]));if(_0xc23c6b[_0x8ad1('0x3e')]['filter']){_0x592da0[_0x8ad1('0x46')]=_['merge'](_0x592da0['where'],{'$or':_[_0x8ad1('0x37')](_0x592da0['attributes'],function(_0x300c11){var _0x614c96={};_0x614c96[_0x300c11]={'$like':'%'+_0xc23c6b[_0x8ad1('0x3e')][_0x8ad1('0x48')]+'%'};return _0x614c96;})});}_0x592da0=_[_0x8ad1('0x49')]({},_0x592da0,_0xc23c6b[_0x8ad1('0x4a')]);return _0x47b3e7[_0x8ad1('0x5c')](_0x592da0);}})[_0x8ad1('0x20')](function(_0x275f3a){if(_0x275f3a){_0x45bc2e=_0x275f3a[_0x8ad1('0x42')];if(!_0xc23c6b['query'][_0x8ad1('0x43')](_0x8ad1('0x44'))){_0x592da0[_0x8ad1('0x2d')]=qs[_0x8ad1('0x2d')](_0xc23c6b[_0x8ad1('0x3e')][_0x8ad1('0x2d')]);_0x592da0[_0x8ad1('0x2c')]=qs[_0x8ad1('0x2c')](_0xc23c6b[_0x8ad1('0x3e')][_0x8ad1('0x2c')]);}return _0x47b3e7['getTags'](_0x592da0);}})[_0x8ad1('0x20')](function(_0x53edce){if(_0x53edce){return _0x53edce?{'count':_0x45bc2e,'rows':_0x53edce}:null;}})[_0x8ad1('0x20')](respondWithResult(_0x2dd0ba,null))['catch'](handleError(_0x2dd0ba,null));};exports[_0x8ad1('0x5e')]=function(_0x198016,_0x5ebad8,_0x4dc7dc){if(_0x198016['body']['id']){delete _0x198016[_0x8ad1('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x198016[_0x8ad1('0x4f')]['id']}})[_0x8ad1('0x20')](handleEntityNotFound(_0x5ebad8,null))[_0x8ad1('0x20')](function(_0x2ed05c){if(_0x2ed05c){return _0x2ed05c[_0x8ad1('0x5e')](_0x198016[_0x8ad1('0x53')][_0x8ad1('0x5f')]||[]);}return null;})[_0x8ad1('0x20')](respondWithResult(_0x5ebad8,null))[_0x8ad1('0x28')](handleError(_0x5ebad8,null));}; \ No newline at end of file +var _0x8403=['json','apply','reject','then','destroy','name','send','index','map','ZendeskConfiguration','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','keys','rawAttributes','includeAll','create','body','find','params','getFields','hasOwnProperty','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range'];(function(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0x8403,0x190));var _0x3840=function(_0x2df73a,_0xa87abb){_0x2df73a=_0x2df73a-0x0;var _0x3e43dc=_0x8403[_0x2df73a];return _0x3e43dc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3840('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3840('0x1'));var moment=require(_0x3840('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3840('0x3'));var util=require(_0x3840('0x4'));var path=require('path');var sox=require(_0x3840('0x5'));var csv=require('to-csv');var ejs=require(_0x3840('0x6'));var fs=require('fs');var _=require(_0x3840('0x7'));var squel=require('squel');var crypto=require(_0x3840('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3840('0x9'));var toCsv=require(_0x3840('0xa'));var querystring=require(_0x3840('0xb'));var Papa=require(_0x3840('0xc'));var Redis=require(_0x3840('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3840('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3840('0xf'));var logger=require(_0x3840('0x10'))(_0x3840('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3840('0x12'));var db=require(_0x3840('0x13'))['db'];var jayson=require(_0x3840('0x14'));var client=jayson[_0x3840('0x15')][_0x3840('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x382523,_0x7458cd,_0x45f20f,_0x460712){return new BPromise(function(_0x2d72b1,_0x27f0b1){var _0x13e86d=_0x460712||client;return _0x13e86d['request'](_0x382523,_0x45f20f)['then'](function(_0x30f8b2){logger[_0x3840('0x17')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7458cd,_0x3840('0x18'));logger['debug'](_0x3840('0x19'),_0x7458cd,_0x3840('0x18'),JSON[_0x3840('0x1a')](_0x30f8b2));if(_0x30f8b2[_0x3840('0x1b')]){if(_0x30f8b2[_0x3840('0x1b')][_0x3840('0x1c')]===0x1f4){logger[_0x3840('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7458cd,_0x30f8b2[_0x3840('0x1b')]['message']);return _0x27f0b1(_0x30f8b2[_0x3840('0x1b')]['message']);}logger['error'](_0x3840('0x1d'),_0x7458cd,_0x30f8b2[_0x3840('0x1b')]['message']);return _0x2d72b1(_0x30f8b2['error'][_0x3840('0x1e')]);}else{logger[_0x3840('0x17')](_0x3840('0x1d'),_0x7458cd,_0x3840('0x18'));_0x2d72b1(_0x30f8b2[_0x3840('0x1f')][_0x3840('0x1e')]);}})[_0x3840('0x20')](function(_0x1d5162){logger[_0x3840('0x1b')](_0x3840('0x1d'),_0x7458cd,_0x1d5162);_0x27f0b1(_0x1d5162);});});}function respondWithStatusCode(_0x1ad19c,_0xda5545){_0xda5545=_0xda5545||0xcc;return function(_0x2a889c){if(_0x2a889c){return _0x1ad19c[_0x3840('0x21')](_0xda5545);}return _0x1ad19c[_0x3840('0x22')](_0xda5545)[_0x3840('0x23')]();};}function respondWithResult(_0x1e86d4,_0x182a28){_0x182a28=_0x182a28||0xc8;return function(_0x50dace){if(_0x50dace){return _0x1e86d4[_0x3840('0x22')](_0x182a28)['json'](_0x50dace);}};}function respondWithFilteredResult(_0x3756ab,_0x4dd24d){return function(_0x5b28a0){if(_0x5b28a0){var _0x2a150e=_0x5b28a0[_0x3840('0x24')],_0x1da31=_0x4dd24d[_0x3840('0x25')],_0x57b5a0=_0x4dd24d[_0x3840('0x25')]+_0x4dd24d['limit'],_0x31e981;if(_0x57b5a0>=_0x2a150e){_0x57b5a0=_0x2a150e;_0x31e981=0xc8;}else{_0x31e981=0xce;}_0x3756ab[_0x3840('0x22')](_0x31e981);return _0x3756ab[_0x3840('0x26')](_0x3840('0x27'),_0x1da31+'-'+_0x57b5a0+'/'+_0x2a150e)[_0x3840('0x28')](_0x5b28a0);}return null;};}function patchUpdates(_0x4877de){return function(_0x32c2a6){try{jsonpatch[_0x3840('0x29')](_0x32c2a6,_0x4877de,!![]);}catch(_0x93ae02){return BPromise[_0x3840('0x2a')](_0x93ae02);}return _0x32c2a6['save']();};}function saveUpdates(_0x11b1fd,_0xd63809){return function(_0x595545){if(_0x595545){return _0x595545['update'](_0x11b1fd)[_0x3840('0x2b')](function(_0x4fa62a){return _0x4fa62a;});}return null;};}function removeEntity(_0x30b842,_0x14b6fd){return function(_0x500024){if(_0x500024){return _0x500024[_0x3840('0x2c')]()[_0x3840('0x2b')](function(){_0x30b842[_0x3840('0x22')](0xcc)[_0x3840('0x23')]();});}};}function handleEntityNotFound(_0x12a8d3,_0x24d76d){return function(_0x97ec1f){if(!_0x97ec1f){_0x12a8d3[_0x3840('0x21')](0x194);}return _0x97ec1f;};}function handleError(_0x173a0c,_0x3deef3){_0x3deef3=_0x3deef3||0x1f4;return function(_0x26c4ff){logger[_0x3840('0x1b')](_0x26c4ff['stack']);if(_0x26c4ff[_0x3840('0x2d')]){delete _0x26c4ff[_0x3840('0x2d')];}_0x173a0c[_0x3840('0x22')](_0x3deef3)[_0x3840('0x2e')](_0x26c4ff);};}exports[_0x3840('0x2f')]=function(_0x464340,_0x2b7014){var _0x416549={},_0x550e8a={},_0x211d45={'count':0x0,'rows':[]};var _0x3e1d04=_[_0x3840('0x30')](db[_0x3840('0x31')]['rawAttributes'],function(_0x22a104){return{'name':_0x22a104[_0x3840('0x32')],'type':_0x22a104[_0x3840('0x33')][_0x3840('0x34')]};});_0x550e8a['model']=_[_0x3840('0x30')](_0x3e1d04,_0x3840('0x2d'));_0x550e8a['query']=_['keys'](_0x464340[_0x3840('0x35')]);_0x550e8a[_0x3840('0x36')]=_[_0x3840('0x37')](_0x550e8a['model'],_0x550e8a[_0x3840('0x35')]);_0x416549['attributes']=_[_0x3840('0x37')](_0x550e8a[_0x3840('0x38')],qs[_0x3840('0x39')](_0x464340[_0x3840('0x35')][_0x3840('0x39')]));_0x416549[_0x3840('0x3a')]=_0x416549[_0x3840('0x3a')][_0x3840('0x3b')]?_0x416549[_0x3840('0x3a')]:_0x550e8a[_0x3840('0x38')];if(!_0x464340[_0x3840('0x35')]['hasOwnProperty'](_0x3840('0x3c'))){_0x416549[_0x3840('0x3d')]=qs[_0x3840('0x3d')](_0x464340[_0x3840('0x35')][_0x3840('0x3d')]);_0x416549[_0x3840('0x25')]=qs[_0x3840('0x25')](_0x464340['query'][_0x3840('0x25')]);}_0x416549[_0x3840('0x3e')]=qs[_0x3840('0x3f')](_0x464340['query'][_0x3840('0x3f')]);_0x416549[_0x3840('0x40')]=qs['filters'](_[_0x3840('0x41')](_0x464340[_0x3840('0x35')],_0x550e8a[_0x3840('0x36')]),_0x3e1d04);if(_0x464340[_0x3840('0x35')][_0x3840('0x42')]){_0x416549[_0x3840('0x40')]=_[_0x3840('0x43')](_0x416549[_0x3840('0x40')],{'$or':_['map'](_0x3e1d04,function(_0x416799){if(_0x416799[_0x3840('0x33')]!=='VIRTUAL'){var _0x516a44={};_0x516a44[_0x416799[_0x3840('0x2d')]]={'$like':'%'+_0x464340[_0x3840('0x35')][_0x3840('0x42')]+'%'};return _0x516a44;}})});}_0x416549=_[_0x3840('0x43')]({},_0x416549,_0x464340[_0x3840('0x44')]);var _0x37d51b={'where':_0x416549['where']};return db['ZendeskConfiguration'][_0x3840('0x24')](_0x37d51b)[_0x3840('0x2b')](function(_0x384fc9){_0x211d45[_0x3840('0x24')]=_0x384fc9;if(_0x464340[_0x3840('0x35')]['includeAll']){_0x416549[_0x3840('0x45')]=[{'all':!![]}];}return db[_0x3840('0x31')]['findAll'](_0x416549);})['then'](function(_0x4e7e53){_0x211d45[_0x3840('0x46')]=_0x4e7e53;return _0x211d45;})['then'](respondWithFilteredResult(_0x2b7014,_0x416549))[_0x3840('0x20')](handleError(_0x2b7014,null));};exports['show']=function(_0x1b07aa,_0x249a17){var _0x1cec45={'raw':![],'where':{'id':_0x1b07aa['params']['id']}},_0x54019d={};_0x54019d['model']=_[_0x3840('0x47')](db[_0x3840('0x31')][_0x3840('0x48')]);_0x54019d[_0x3840('0x35')]=_[_0x3840('0x47')](_0x1b07aa['query']);_0x54019d[_0x3840('0x36')]=_['intersection'](_0x54019d['model'],_0x54019d[_0x3840('0x35')]);_0x1cec45[_0x3840('0x3a')]=_[_0x3840('0x37')](_0x54019d[_0x3840('0x38')],qs[_0x3840('0x39')](_0x1b07aa[_0x3840('0x35')][_0x3840('0x39')]));_0x1cec45[_0x3840('0x3a')]=_0x1cec45[_0x3840('0x3a')][_0x3840('0x3b')]?_0x1cec45['attributes']:_0x54019d['model'];if(_0x1b07aa[_0x3840('0x35')][_0x3840('0x49')]){_0x1cec45['include']=[{'all':!![]}];}_0x1cec45=_['merge']({},_0x1cec45,_0x1b07aa[_0x3840('0x44')]);return db[_0x3840('0x31')]['find'](_0x1cec45)[_0x3840('0x2b')](handleEntityNotFound(_0x249a17,null))[_0x3840('0x2b')](respondWithResult(_0x249a17,null))[_0x3840('0x20')](handleError(_0x249a17,null));};exports[_0x3840('0x4a')]=function(_0x51e805,_0x36f7a4){return db[_0x3840('0x31')][_0x3840('0x4a')](_0x51e805['body'],{})[_0x3840('0x2b')](respondWithResult(_0x36f7a4,0xc9))[_0x3840('0x20')](handleError(_0x36f7a4,null));};exports['update']=function(_0x4c01ac,_0x1894ac){if(_0x4c01ac[_0x3840('0x4b')]['id']){delete _0x4c01ac[_0x3840('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x3840('0x4c')]({'where':{'id':_0x4c01ac['params']['id']}})[_0x3840('0x2b')](handleEntityNotFound(_0x1894ac,null))[_0x3840('0x2b')](saveUpdates(_0x4c01ac['body'],null))[_0x3840('0x2b')](respondWithResult(_0x1894ac,null))[_0x3840('0x20')](handleError(_0x1894ac,null));};exports['destroy']=function(_0x5bdaec,_0xe8e69a){return db[_0x3840('0x31')]['find']({'where':{'id':_0x5bdaec[_0x3840('0x4d')]['id']}})[_0x3840('0x2b')](handleEntityNotFound(_0xe8e69a,null))[_0x3840('0x2b')](removeEntity(_0xe8e69a,null))['catch'](handleError(_0xe8e69a,null));};exports[_0x3840('0x4e')]=function(_0x3e0c8c,_0x507ac0,_0x265e58){var _0x2ae361={};var _0x4d47a0={};var _0x41ad08;var _0x22d0b4;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3e0c8c[_0x3840('0x4d')]['id']}})[_0x3840('0x2b')](handleEntityNotFound(_0x507ac0,null))['then'](function(_0x34d5fb){if(_0x34d5fb){_0x41ad08=_0x34d5fb;_0x4d47a0[_0x3840('0x38')]=_[_0x3840('0x47')](db['ZendeskField'][_0x3840('0x48')]);_0x4d47a0[_0x3840('0x35')]=_[_0x3840('0x47')](_0x3e0c8c['query']);_0x4d47a0[_0x3840('0x36')]=_['intersection'](_0x4d47a0['model'],_0x4d47a0[_0x3840('0x35')]);_0x2ae361['attributes']=_[_0x3840('0x37')](_0x4d47a0[_0x3840('0x38')],qs[_0x3840('0x39')](_0x3e0c8c[_0x3840('0x35')][_0x3840('0x39')]));_0x2ae361[_0x3840('0x3a')]=_0x2ae361[_0x3840('0x3a')][_0x3840('0x3b')]?_0x2ae361[_0x3840('0x3a')]:_0x4d47a0[_0x3840('0x38')];_0x2ae361[_0x3840('0x3e')]=qs[_0x3840('0x3f')](_0x3e0c8c[_0x3840('0x35')][_0x3840('0x3f')]);_0x2ae361[_0x3840('0x40')]=qs[_0x3840('0x36')](_[_0x3840('0x41')](_0x3e0c8c[_0x3840('0x35')],_0x4d47a0[_0x3840('0x36')]));if(_0x3e0c8c['query'][_0x3840('0x42')]){_0x2ae361['where']=_[_0x3840('0x43')](_0x2ae361[_0x3840('0x40')],{'$or':_[_0x3840('0x30')](_0x2ae361[_0x3840('0x3a')],function(_0x10c044){var _0x15f019={};_0x15f019[_0x10c044]={'$like':'%'+_0x3e0c8c[_0x3840('0x35')]['filter']+'%'};return _0x15f019;})});}_0x2ae361=_['merge']({},_0x2ae361,_0x3e0c8c['options']);return _0x41ad08['getFields'](_0x2ae361);}})[_0x3840('0x2b')](function(_0x15b746){if(_0x15b746){_0x22d0b4=_0x15b746['length'];if(!_0x3e0c8c[_0x3840('0x35')][_0x3840('0x4f')]('nolimit')){_0x2ae361[_0x3840('0x3d')]=qs[_0x3840('0x3d')](_0x3e0c8c[_0x3840('0x35')]['limit']);_0x2ae361[_0x3840('0x25')]=qs['offset'](_0x3e0c8c['query'][_0x3840('0x25')]);}return _0x41ad08[_0x3840('0x4e')](_0x2ae361);}})[_0x3840('0x2b')](function(_0x20db19){if(_0x20db19){return _0x20db19?{'count':_0x22d0b4,'rows':_0x20db19}:null;}})[_0x3840('0x2b')](respondWithResult(_0x507ac0,null))[_0x3840('0x20')](handleError(_0x507ac0,null));};exports['getSubjects']=function(_0x4f84c8,_0x19c6d6,_0x1a4252){var _0x3c96ce={};var _0x26cccc={};var _0x5bd6e8;var _0x4ce36e;return db[_0x3840('0x31')][_0x3840('0x50')]({'where':{'id':_0x4f84c8[_0x3840('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19c6d6,null))[_0x3840('0x2b')](function(_0x9cf24d){if(_0x9cf24d){_0x5bd6e8=_0x9cf24d;_0x26cccc['model']=_[_0x3840('0x47')](db[_0x3840('0x51')][_0x3840('0x48')]);_0x26cccc[_0x3840('0x35')]=_[_0x3840('0x47')](_0x4f84c8[_0x3840('0x35')]);_0x26cccc[_0x3840('0x36')]=_[_0x3840('0x37')](_0x26cccc[_0x3840('0x38')],_0x26cccc[_0x3840('0x35')]);_0x3c96ce['attributes']=_[_0x3840('0x37')](_0x26cccc['model'],qs[_0x3840('0x39')](_0x4f84c8[_0x3840('0x35')][_0x3840('0x39')]));_0x3c96ce[_0x3840('0x3a')]=_0x3c96ce['attributes'][_0x3840('0x3b')]?_0x3c96ce[_0x3840('0x3a')]:_0x26cccc[_0x3840('0x38')];_0x3c96ce[_0x3840('0x3e')]=qs['sort'](_0x4f84c8[_0x3840('0x35')]['sort']);_0x3c96ce[_0x3840('0x40')]=qs[_0x3840('0x36')](_['pick'](_0x4f84c8['query'],_0x26cccc[_0x3840('0x36')]));if(_0x4f84c8['query']['filter']){_0x3c96ce[_0x3840('0x40')]=_['merge'](_0x3c96ce[_0x3840('0x40')],{'$or':_[_0x3840('0x30')](_0x3c96ce[_0x3840('0x3a')],function(_0x57dc11){var _0x3f81cc={};_0x3f81cc[_0x57dc11]={'$like':'%'+_0x4f84c8[_0x3840('0x35')][_0x3840('0x42')]+'%'};return _0x3f81cc;})});}_0x3c96ce=_[_0x3840('0x43')]({},_0x3c96ce,_0x4f84c8[_0x3840('0x44')]);return _0x5bd6e8[_0x3840('0x52')](_0x3c96ce);}})['then'](function(_0x1141a7){if(_0x1141a7){_0x4ce36e=_0x1141a7['length'];if(!_0x4f84c8[_0x3840('0x35')][_0x3840('0x4f')](_0x3840('0x3c'))){_0x3c96ce['limit']=qs[_0x3840('0x3d')](_0x4f84c8[_0x3840('0x35')][_0x3840('0x3d')]);_0x3c96ce[_0x3840('0x25')]=qs['offset'](_0x4f84c8[_0x3840('0x35')][_0x3840('0x25')]);}return _0x5bd6e8['getSubjects'](_0x3c96ce);}})[_0x3840('0x2b')](function(_0x55bf0e){if(_0x55bf0e){return _0x55bf0e?{'count':_0x4ce36e,'rows':_0x55bf0e}:null;}})['then'](respondWithResult(_0x19c6d6,null))[_0x3840('0x20')](handleError(_0x19c6d6,null));};exports[_0x3840('0x53')]=function(_0x38b2d2,_0x200f1e,_0x5b88e4){var _0x41856e={};var _0x530c77={};var _0x285400;var _0x21fa66;return db[_0x3840('0x31')][_0x3840('0x50')]({'where':{'id':_0x38b2d2[_0x3840('0x4d')]['id']}})[_0x3840('0x2b')](handleEntityNotFound(_0x200f1e,null))['then'](function(_0x3e9d69){if(_0x3e9d69){_0x285400=_0x3e9d69;_0x530c77[_0x3840('0x38')]=_[_0x3840('0x47')](db[_0x3840('0x51')][_0x3840('0x48')]);_0x530c77['query']=_[_0x3840('0x47')](_0x38b2d2[_0x3840('0x35')]);_0x530c77[_0x3840('0x36')]=_[_0x3840('0x37')](_0x530c77['model'],_0x530c77[_0x3840('0x35')]);_0x41856e[_0x3840('0x3a')]=_[_0x3840('0x37')](_0x530c77[_0x3840('0x38')],qs['fields'](_0x38b2d2[_0x3840('0x35')][_0x3840('0x39')]));_0x41856e[_0x3840('0x3a')]=_0x41856e['attributes'][_0x3840('0x3b')]?_0x41856e['attributes']:_0x530c77[_0x3840('0x38')];_0x41856e[_0x3840('0x3e')]=qs[_0x3840('0x3f')](_0x38b2d2['query']['sort']);_0x41856e[_0x3840('0x40')]=qs[_0x3840('0x36')](_[_0x3840('0x41')](_0x38b2d2['query'],_0x530c77[_0x3840('0x36')]));if(_0x38b2d2[_0x3840('0x35')][_0x3840('0x42')]){_0x41856e[_0x3840('0x40')]=_['merge'](_0x41856e['where'],{'$or':_['map'](_0x41856e['attributes'],function(_0x2cdd3c){var _0x2d7dca={};_0x2d7dca[_0x2cdd3c]={'$like':'%'+_0x38b2d2['query'][_0x3840('0x42')]+'%'};return _0x2d7dca;})});}_0x41856e=_[_0x3840('0x43')]({},_0x41856e,_0x38b2d2[_0x3840('0x44')]);return _0x285400['getDescriptions'](_0x41856e);}})[_0x3840('0x2b')](function(_0x4a0a89){if(_0x4a0a89){_0x21fa66=_0x4a0a89[_0x3840('0x3b')];if(!_0x38b2d2[_0x3840('0x35')]['hasOwnProperty'](_0x3840('0x3c'))){_0x41856e[_0x3840('0x3d')]=qs[_0x3840('0x3d')](_0x38b2d2[_0x3840('0x35')]['limit']);_0x41856e['offset']=qs['offset'](_0x38b2d2[_0x3840('0x35')][_0x3840('0x25')]);}return _0x285400['getDescriptions'](_0x41856e);}})[_0x3840('0x2b')](function(_0xc5bec3){if(_0xc5bec3){return _0xc5bec3?{'count':_0x21fa66,'rows':_0xc5bec3}:null;}})[_0x3840('0x2b')](respondWithResult(_0x200f1e,null))['catch'](handleError(_0x200f1e,null));};exports[_0x3840('0x54')]=function(_0x2f0321,_0x555baa,_0x32e6ee){var _0x115bec={};var _0xbcbbc2={};var _0x531e78;var _0x392b10;return db[_0x3840('0x31')][_0x3840('0x50')]({'where':{'id':_0x2f0321[_0x3840('0x4d')]['id']}})[_0x3840('0x2b')](handleEntityNotFound(_0x555baa,null))[_0x3840('0x2b')](function(_0x54830b){if(_0x54830b){_0x531e78=_0x54830b;_0xbcbbc2['model']=_[_0x3840('0x47')](db[_0x3840('0x55')][_0x3840('0x48')]);_0xbcbbc2[_0x3840('0x35')]=_['keys'](_0x2f0321[_0x3840('0x35')]);_0xbcbbc2[_0x3840('0x36')]=_['intersection'](_0xbcbbc2['model'],_0xbcbbc2[_0x3840('0x35')]);_0x115bec['attributes']=_[_0x3840('0x37')](_0xbcbbc2[_0x3840('0x38')],qs['fields'](_0x2f0321[_0x3840('0x35')]['fields']));_0x115bec[_0x3840('0x3a')]=_0x115bec['attributes'][_0x3840('0x3b')]?_0x115bec['attributes']:_0xbcbbc2[_0x3840('0x38')];_0x115bec[_0x3840('0x3e')]=qs['sort'](_0x2f0321[_0x3840('0x35')][_0x3840('0x3f')]);_0x115bec['where']=qs[_0x3840('0x36')](_[_0x3840('0x41')](_0x2f0321[_0x3840('0x35')],_0xbcbbc2['filters']));if(_0x2f0321[_0x3840('0x35')]['filter']){_0x115bec['where']=_['merge'](_0x115bec[_0x3840('0x40')],{'$or':_[_0x3840('0x30')](_0x115bec[_0x3840('0x3a')],function(_0x49258b){var _0xe7745a={};_0xe7745a[_0x49258b]={'$like':'%'+_0x2f0321['query'][_0x3840('0x42')]+'%'};return _0xe7745a;})});}_0x115bec=_['merge']({},_0x115bec,_0x2f0321['options']);return _0x531e78[_0x3840('0x54')](_0x115bec);}})['then'](function(_0x27e3d8){if(_0x27e3d8){_0x392b10=_0x27e3d8[_0x3840('0x3b')];if(!_0x2f0321[_0x3840('0x35')]['hasOwnProperty'](_0x3840('0x3c'))){_0x115bec[_0x3840('0x3d')]=qs['limit'](_0x2f0321[_0x3840('0x35')]['limit']);_0x115bec[_0x3840('0x25')]=qs['offset'](_0x2f0321[_0x3840('0x35')][_0x3840('0x25')]);}return _0x531e78[_0x3840('0x54')](_0x115bec);}})[_0x3840('0x2b')](function(_0x43d920){if(_0x43d920){return _0x43d920?{'count':_0x392b10,'rows':_0x43d920}:null;}})[_0x3840('0x2b')](respondWithResult(_0x555baa,null))['catch'](handleError(_0x555baa,null));};exports['setTags']=function(_0x378aea,_0x42de00,_0x8301c7){if(_0x378aea[_0x3840('0x4b')]['id']){delete _0x378aea[_0x3840('0x4b')]['id'];}return db[_0x3840('0x31')][_0x3840('0x50')]({'where':{'id':_0x378aea[_0x3840('0x4d')]['id']}})[_0x3840('0x2b')](handleEntityNotFound(_0x42de00,null))['then'](function(_0x60b354){if(_0x60b354){return _0x60b354[_0x3840('0x56')](_0x378aea['body'][_0x3840('0x57')]||[]);}return null;})['then'](respondWithResult(_0x42de00,null))['catch'](handleError(_0x42de00,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e1faeda..aecff43 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 _0x7894=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','path','rimraf','exports'];(function(_0x3fa8e9,_0x1a2dd2){var _0x425d0e=function(_0x40f9b2){while(--_0x40f9b2){_0x3fa8e9['push'](_0x3fa8e9['shift']());}};_0x425d0e(++_0x1a2dd2);}(_0x7894,0x1e3));var _0x4789=function(_0x5ec1ab,_0x11536a){_0x5ec1ab=_0x5ec1ab-0x0;var _0xec525b=_0x7894[_0x5ec1ab];return _0xec525b;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var logger=require(_0x4789('0x2'))(_0x4789('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4789('0x4'));var rimraf=require(_0x4789('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x4789('0x6')]=function(_0x59f7e7,_0x5344b0){return _0x59f7e7[_0x4789('0x7')](_0x4789('0x8'),attributes,{'tableName':_0x4789('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e75=['./intZendeskConfiguration.attributes','exports','lodash','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x7fa3ff,_0x139d6a){var _0x27103d=function(_0x3f369c){while(--_0x3f369c){_0x7fa3ff['push'](_0x7fa3ff['shift']());}};_0x27103d(++_0x139d6a);}(_0x0e75,0x1ba));var _0x50e7=function(_0x47b928,_0x13ac85){_0x47b928=_0x47b928-0x0;var _0x52dec1=_0x0e75[_0x47b928];return _0x52dec1;};'use strict';var _=require(_0x50e7('0x0'));var util=require('util');var logger=require(_0x50e7('0x1'))(_0x50e7('0x2'));var moment=require(_0x50e7('0x3'));var BPromise=require('bluebird');var rp=require(_0x50e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50e7('0x5'));var attributes=require(_0x50e7('0x6'));module[_0x50e7('0x7')]=function(_0x4e7d94,_0xc588f7){return _0x4e7d94['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','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 4fb483c..48c319a 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 _0x2724=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2724,0x149));var _0x4272=function(_0x28b3f8,_0x47764e){_0x28b3f8=_0x28b3f8-0x0;var _0x4fd20e=_0x2724[_0x28b3f8];return _0x4fd20e;};'use strict';var _=require(_0x4272('0x0'));var util=require(_0x4272('0x1'));var moment=require(_0x4272('0x2'));var BPromise=require(_0x4272('0x3'));var rs=require(_0x4272('0x4'));var fs=require('fs');var Redis=require(_0x4272('0x5'));var db=require(_0x4272('0x6'))['db'];var utils=require(_0x4272('0x7'));var logger=require(_0x4272('0x8'))(_0x4272('0x9'));var config=require(_0x4272('0xa'));var jayson=require(_0x4272('0xb'));var client=jayson[_0x4272('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27f329,_0x2d3174,_0x885035){return new BPromise(function(_0x4dc880,_0x4cf1cd){return client[_0x4272('0xd')](_0x27f329,_0x885035)[_0x4272('0xe')](function(_0x463935){logger[_0x4272('0xf')](_0x4272('0x10'),_0x2d3174,_0x4272('0x11'));logger[_0x4272('0x12')](_0x4272('0x13'),_0x2d3174,_0x4272('0x11'),JSON['stringify'](_0x463935));if(_0x463935[_0x4272('0x14')]){if(_0x463935['error'][_0x4272('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2d3174,_0x463935['error']['message']);return _0x4cf1cd(_0x463935['error'][_0x4272('0x16')]);}logger[_0x4272('0x14')](_0x4272('0x10'),_0x2d3174,_0x463935[_0x4272('0x14')][_0x4272('0x16')]);return _0x4dc880(_0x463935[_0x4272('0x14')]['message']);}else{logger[_0x4272('0xf')](_0x4272('0x10'),_0x2d3174,_0x4272('0x11'));_0x4dc880(_0x463935[_0x4272('0x17')][_0x4272('0x16')]);}})[_0x4272('0x18')](function(_0x2859e0){logger[_0x4272('0x14')](_0x4272('0x10'),_0x2d3174,_0x2859e0);_0x4cf1cd(_0x2859e0);});});} \ No newline at end of file +var _0x9690=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x9690,0x9c));var _0x0969=function(_0x1296a1,_0x57ae6f){_0x1296a1=_0x1296a1-0x0;var _0x46c1b8=_0x9690[_0x1296a1];return _0x46c1b8;};'use strict';var _=require(_0x0969('0x0'));var util=require(_0x0969('0x1'));var moment=require(_0x0969('0x2'));var BPromise=require(_0x0969('0x3'));var rs=require(_0x0969('0x4'));var fs=require('fs');var Redis=require(_0x0969('0x5'));var db=require(_0x0969('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0969('0x7'))(_0x0969('0x8'));var config=require(_0x0969('0x9'));var jayson=require(_0x0969('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8430,_0xf0c742,_0x5b68da){return new BPromise(function(_0x1bdb94,_0x39d63e){return client[_0x0969('0xb')](_0x3e8430,_0x5b68da)[_0x0969('0xc')](function(_0x587ea4){logger[_0x0969('0xd')](_0x0969('0xe'),_0xf0c742,_0x0969('0xf'));logger[_0x0969('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xf0c742,_0x0969('0xf'),JSON['stringify'](_0x587ea4));if(_0x587ea4['error']){if(_0x587ea4[_0x0969('0x11')][_0x0969('0x12')]===0x1f4){logger[_0x0969('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf0c742,_0x587ea4['error'][_0x0969('0x13')]);return _0x39d63e(_0x587ea4[_0x0969('0x11')]['message']);}logger[_0x0969('0x11')](_0x0969('0xe'),_0xf0c742,_0x587ea4[_0x0969('0x11')][_0x0969('0x13')]);return _0x1bdb94(_0x587ea4[_0x0969('0x11')][_0x0969('0x13')]);}else{logger[_0x0969('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf0c742,_0x0969('0xf'));_0x1bdb94(_0x587ea4[_0x0969('0x14')][_0x0969('0x13')]);}})[_0x0969('0x15')](function(_0x309de5){logger[_0x0969('0x11')](_0x0969('0xe'),_0xf0c742,_0x309de5);_0x39d63e(_0x309de5);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index a900196..55f630d 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 _0x1f39=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x1f39,0x1bf));var _0x91f3=function(_0x4aa12d,_0x2d57fa){_0x4aa12d=_0x4aa12d-0x0;var _0x3e642c=_0x1f39[_0x4aa12d];return _0x3e642c;};'use strict';var multer=require(_0x91f3('0x0'));var util=require('util');var path=require(_0x91f3('0x1'));var timeout=require(_0x91f3('0x2'));var express=require(_0x91f3('0x3'));var router=express[_0x91f3('0x4')]();var auth=require(_0x91f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x91f3('0x6'));var controller=require(_0x91f3('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x91f3('0x8')](_0x91f3('0x9'),auth['isAuthenticated'](),controller[_0x91f3('0xa')]);router[_0x91f3('0xb')]('/',auth[_0x91f3('0xc')](),controller[_0x91f3('0xd')]);router[_0x91f3('0xe')]('/:id',auth[_0x91f3('0xc')](),controller[_0x91f3('0xf')]);router[_0x91f3('0x10')](_0x91f3('0x9'),auth['isAuthenticated'](),controller[_0x91f3('0x11')]);module[_0x91f3('0x12')]=router; \ No newline at end of file +var _0x848d=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x43d481,_0x26fb70){var _0x153c26=function(_0x7df73c){while(--_0x7df73c){_0x43d481['push'](_0x43d481['shift']());}};_0x153c26(++_0x26fb70);}(_0x848d,0x1d5));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd848('0x0'));var util=require(_0xd848('0x1'));var path=require(_0xd848('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd848('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd848('0x4'));var config=require(_0xd848('0x5'));var controller=require(_0xd848('0x6'));router[_0xd848('0x7')]('/',auth[_0xd848('0x8')](),controller[_0xd848('0x9')]);router[_0xd848('0x7')](_0xd848('0xa'),auth[_0xd848('0x8')](),controller[_0xd848('0xb')]);router[_0xd848('0xc')]('/',auth[_0xd848('0x8')](),controller[_0xd848('0xd')]);router[_0xd848('0xe')](_0xd848('0xa'),auth['isAuthenticated'](),controller[_0xd848('0xf')]);router[_0xd848('0x10')](_0xd848('0xa'),auth[_0xd848('0x8')](),controller['destroy']);module[_0xd848('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 9cc7fd9..bc88a56 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 _0xa73a=['string','variable','customVariable','STRING','exports','ENUM'];(function(_0x440937,_0x236261){var _0x83e86c=function(_0x291a5a){while(--_0x291a5a){_0x440937['push'](_0x440937['shift']());}};_0x83e86c(++_0x236261);}(_0xa73a,0x82));var _0xaa73=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xa73a[_0x2338fa];return _0x42df9b;};'use strict';var Sequelize=require('sequelize');module[_0xaa73('0x0')]={'type':{'type':Sequelize[_0xaa73('0x1')](_0xaa73('0x2'),_0xaa73('0x3'),_0xaa73('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaa73('0x5')]},'keyType':{'type':Sequelize[_0xaa73('0x1')](_0xaa73('0x2'),_0xaa73('0x3'),_0xaa73('0x4'))},'keyContent':{'type':Sequelize[_0xaa73('0x5')]},'idField':{'type':Sequelize[_0xaa73('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa73('0x5')]}}; \ No newline at end of file +var _0xa234=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x80759c,_0x471d58){var _0x1b8979=function(_0x1b1df3){while(--_0x1b1df3){_0x80759c['push'](_0x80759c['shift']());}};_0x1b8979(++_0x471d58);}(_0xa234,0x142));var _0x4a23=function(_0x4cbbea,_0x18dbd4){_0x4cbbea=_0x4cbbea-0x0;var _0x21e2b9=_0xa234[_0x4cbbea];return _0x21e2b9;};'use strict';var Sequelize=require(_0x4a23('0x0'));module[_0x4a23('0x1')]={'type':{'type':Sequelize[_0x4a23('0x2')](_0x4a23('0x3'),_0x4a23('0x4'),'customVariable',_0x4a23('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a23('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4a23('0x2')](_0x4a23('0x3'),_0x4a23('0x4'),_0x4a23('0x7'))},'keyContent':{'type':Sequelize[_0x4a23('0x6')]},'idField':{'type':Sequelize[_0x4a23('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4a23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a23('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b62efb4..2ef5fac 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 _0xf4f4=['create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','ZendeskField','includeAll','include','rows','catch','params','keys','rawAttributes','find'];(function(_0x282764,_0x9b5de0){var _0x19feac=function(_0x2cee16){while(--_0x2cee16){_0x282764['push'](_0x282764['shift']());}};_0x19feac(++_0x9b5de0);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1e99b6,_0x4136dc){_0x1e99b6=_0x1e99b6-0x0;var _0x53e2a8=_0xf4f4[_0x1e99b6];return _0x53e2a8;};'use strict';var pdf=require(_0x4f4f('0x0'));var emlformat=require(_0x4f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require(_0x4f4f('0x4'));var moment=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var Mustache=require('mustache');var util=require(_0x4f4f('0x7'));var path=require('path');var sox=require(_0x4f4f('0x8'));var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=_0x47ab66[_0x4f4f('0x1c')],_0x422894=_0x4c68f4[_0x4f4f('0x1d')],_0x8d65a2=_0x4c68f4[_0x4f4f('0x1d')]+_0x4c68f4[_0x4f4f('0x1e')],_0x2d21ed;if(_0x8d65a2>=_0x58de77){_0x8d65a2=_0x58de77;_0x2d21ed=0xc8;}else{_0x2d21ed=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x2d21ed);return _0x19f2fd[_0x4f4f('0x1f')](_0x4f4f('0x20'),_0x422894+'-'+_0x8d65a2+'/'+_0x58de77)[_0x4f4f('0x21')](_0x47ab66);}return null;};}function patchUpdates(_0x43f43b){return function(_0x499277){try{jsonpatch[_0x4f4f('0x22')](_0x499277,_0x43f43b,!![]);}catch(_0x4622c2){return BPromise[_0x4f4f('0x23')](_0x4622c2);}return _0x499277[_0x4f4f('0x24')]();};}function saveUpdates(_0x302a79,_0x460b4d){return function(_0x2eedcc){if(_0x2eedcc){return _0x2eedcc[_0x4f4f('0x25')](_0x302a79)[_0x4f4f('0x26')](function(_0x2509a8){return _0x2509a8;});}return null;};}function removeEntity(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x27')]()['then'](function(){_0x469a1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272125,_0x43e661){return function(_0x5186ac){if(!_0x5186ac){_0x272125[_0x4f4f('0x28')](0x194);}return _0x5186ac;};}function handleError(_0x15859c,_0xcf19ac){_0xcf19ac=_0xcf19ac||0x1f4;return function(_0x2ec92a){logger[_0x4f4f('0x29')](_0x2ec92a[_0x4f4f('0x2a')]);if(_0x2ec92a[_0x4f4f('0x2b')]){delete _0x2ec92a['name'];}_0x15859c[_0x4f4f('0x1b')](_0xcf19ac)[_0x4f4f('0x2c')](_0x2ec92a);};}exports[_0x4f4f('0x2d')]=function(_0x15c79c,_0x18e864){var _0x4ad33d={},_0x23df57={},_0xaf3de1={'count':0x0,'rows':[]};var _0x7180f8=_['map'](db['ZendeskField']['rawAttributes'],function(_0x73b8bb){return{'name':_0x73b8bb['fieldName'],'type':_0x73b8bb[_0x4f4f('0x2e')][_0x4f4f('0x2f')]};});_0x23df57[_0x4f4f('0x30')]=_['map'](_0x7180f8,_0x4f4f('0x2b'));_0x23df57[_0x4f4f('0x31')]=_['keys'](_0x15c79c[_0x4f4f('0x31')]);_0x23df57[_0x4f4f('0x32')]=_[_0x4f4f('0x33')](_0x23df57['model'],_0x23df57[_0x4f4f('0x31')]);_0x4ad33d[_0x4f4f('0x34')]=_['intersection'](_0x23df57['model'],qs[_0x4f4f('0x35')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x35')]));_0x4ad33d[_0x4f4f('0x34')]=_0x4ad33d[_0x4f4f('0x34')][_0x4f4f('0x36')]?_0x4ad33d[_0x4f4f('0x34')]:_0x23df57[_0x4f4f('0x30')];if(!_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x37')]('nolimit')){_0x4ad33d['limit']=qs[_0x4f4f('0x1e')](_0x15c79c['query'][_0x4f4f('0x1e')]);_0x4ad33d[_0x4f4f('0x1d')]=qs[_0x4f4f('0x1d')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x1d')]);}_0x4ad33d[_0x4f4f('0x38')]=qs[_0x4f4f('0x39')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x39')]);_0x4ad33d[_0x4f4f('0x3a')]=qs[_0x4f4f('0x32')](_[_0x4f4f('0x3b')](_0x15c79c['query'],_0x23df57[_0x4f4f('0x32')]),_0x7180f8);if(_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x3c')]){_0x4ad33d[_0x4f4f('0x3a')]=_[_0x4f4f('0x3d')](_0x4ad33d[_0x4f4f('0x3a')],{'$or':_[_0x4f4f('0x3e')](_0x7180f8,function(_0x32b077){if(_0x32b077[_0x4f4f('0x2e')]!=='VIRTUAL'){var _0xbd62c5={};_0xbd62c5[_0x32b077[_0x4f4f('0x2b')]]={'$like':'%'+_0x15c79c[_0x4f4f('0x31')]['filter']+'%'};return _0xbd62c5;}})});}_0x4ad33d=_['merge']({},_0x4ad33d,_0x15c79c[_0x4f4f('0x3f')]);var _0x95a296={'where':_0x4ad33d[_0x4f4f('0x3a')]};return db[_0x4f4f('0x40')][_0x4f4f('0x1c')](_0x95a296)[_0x4f4f('0x26')](function(_0x1c012d){_0xaf3de1[_0x4f4f('0x1c')]=_0x1c012d;if(_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x41')]){_0x4ad33d[_0x4f4f('0x42')]=[{'all':!![]}];}return db[_0x4f4f('0x40')]['findAll'](_0x4ad33d);})[_0x4f4f('0x26')](function(_0x1b031e){_0xaf3de1[_0x4f4f('0x43')]=_0x1b031e;return _0xaf3de1;})[_0x4f4f('0x26')](respondWithFilteredResult(_0x18e864,_0x4ad33d))[_0x4f4f('0x44')](handleError(_0x18e864,null));};exports['show']=function(_0x5c06a1,_0x134710){var _0xa070ad={'raw':!![],'where':{'id':_0x5c06a1[_0x4f4f('0x45')]['id']}},_0x2064e9={};_0x2064e9['model']=_[_0x4f4f('0x46')](db['ZendeskField'][_0x4f4f('0x47')]);_0x2064e9['query']=_['keys'](_0x5c06a1[_0x4f4f('0x31')]);_0x2064e9['filters']=_[_0x4f4f('0x33')](_0x2064e9[_0x4f4f('0x30')],_0x2064e9['query']);_0xa070ad[_0x4f4f('0x34')]=_[_0x4f4f('0x33')](_0x2064e9['model'],qs[_0x4f4f('0x35')](_0x5c06a1[_0x4f4f('0x31')][_0x4f4f('0x35')]));_0xa070ad[_0x4f4f('0x34')]=_0xa070ad[_0x4f4f('0x34')][_0x4f4f('0x36')]?_0xa070ad[_0x4f4f('0x34')]:_0x2064e9[_0x4f4f('0x30')];if(_0x5c06a1[_0x4f4f('0x31')][_0x4f4f('0x41')]){_0xa070ad[_0x4f4f('0x42')]=[{'all':!![]}];}_0xa070ad=_[_0x4f4f('0x3d')]({},_0xa070ad,_0x5c06a1[_0x4f4f('0x3f')]);return db[_0x4f4f('0x40')][_0x4f4f('0x48')](_0xa070ad)['then'](handleEntityNotFound(_0x134710,null))[_0x4f4f('0x26')](respondWithResult(_0x134710,null))['catch'](handleError(_0x134710,null));};exports['create']=function(_0x31349a,_0x4363c9){return db['ZendeskField'][_0x4f4f('0x49')](_0x31349a[_0x4f4f('0x4a')],{})[_0x4f4f('0x26')](respondWithResult(_0x4363c9,0xc9))[_0x4f4f('0x44')](handleError(_0x4363c9,null));};exports[_0x4f4f('0x25')]=function(_0x545dd6,_0xd4625a){if(_0x545dd6[_0x4f4f('0x4a')]['id']){delete _0x545dd6[_0x4f4f('0x4a')]['id'];}return db[_0x4f4f('0x40')][_0x4f4f('0x48')]({'where':{'id':_0x545dd6[_0x4f4f('0x45')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0xd4625a,null))[_0x4f4f('0x26')](saveUpdates(_0x545dd6[_0x4f4f('0x4a')],null))['then'](respondWithResult(_0xd4625a,null))[_0x4f4f('0x44')](handleError(_0xd4625a,null));};exports[_0x4f4f('0x27')]=function(_0x4b33a5,_0x5ac4df){return db['ZendeskField'][_0x4f4f('0x48')]({'where':{'id':_0x4b33a5[_0x4f4f('0x45')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x5ac4df,null))['then'](removeEntity(_0x5ac4df,null))[_0x4f4f('0x44')](handleError(_0x5ac4df,null));}; \ No newline at end of file +var _0xc2c7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','body'];(function(_0x439065,_0x321d65){var _0x163bd3=function(_0x2d88b0){while(--_0x2d88b0){_0x439065['push'](_0x439065['shift']());}};_0x163bd3(++_0x321d65);}(_0xc2c7,0x134));var _0x7c2c=function(_0x28522a,_0x3ac30b){_0x28522a=_0x28522a-0x0;var _0x3043d9=_0xc2c7[_0x28522a];return _0x3043d9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c2c('0x0'));var rimraf=require(_0x7c2c('0x1'));var zipdir=require(_0x7c2c('0x2'));var jsonpatch=require(_0x7c2c('0x3'));var rp=require(_0x7c2c('0x4'));var moment=require(_0x7c2c('0x5'));var BPromise=require(_0x7c2c('0x6'));var Mustache=require(_0x7c2c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7c2c('0x8'));var csv=require(_0x7c2c('0x9'));var ejs=require(_0x7c2c('0xa'));var fs=require('fs');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('0x9'));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=_0x206ecd['count'],_0x88f54b=_0x11424c[_0x7c2c('0x1d')],_0x5a5fe2=_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')],_0x1aa355;if(_0x5a5fe2>=_0x5e55e0){_0x5a5fe2=_0x5e55e0;_0x1aa355=0xc8;}else{_0x1aa355=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x1aa355);return _0x5ae94f[_0x7c2c('0x1f')](_0x7c2c('0x20'),_0x88f54b+'-'+_0x5a5fe2+'/'+_0x5e55e0)[_0x7c2c('0x1c')](_0x206ecd);}return null;};}function patchUpdates(_0x1ce7e1){return function(_0x2d356e){try{jsonpatch[_0x7c2c('0x21')](_0x2d356e,_0x1ce7e1,!![]);}catch(_0x40eaef){return BPromise[_0x7c2c('0x22')](_0x40eaef);}return _0x2d356e['save']();};}function saveUpdates(_0x1c5491,_0x4adb62){return function(_0x506d47){if(_0x506d47){return _0x506d47[_0x7c2c('0x23')](_0x1c5491)[_0x7c2c('0x24')](function(_0x2a9ae2){return _0x2a9ae2;});}return null;};}function removeEntity(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x25')]()['then'](function(){_0x38ae30[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302c93,_0x57f510){return function(_0x3d4387){if(!_0x3d4387){_0x302c93[_0x7c2c('0x19')](0x194);}return _0x3d4387;};}function handleError(_0x3126d,_0x481867){_0x481867=_0x481867||0x1f4;return function(_0x4d6ec7){logger[_0x7c2c('0x26')](_0x4d6ec7[_0x7c2c('0x27')]);if(_0x4d6ec7[_0x7c2c('0x28')]){delete _0x4d6ec7[_0x7c2c('0x28')];}_0x3126d[_0x7c2c('0x1a')](_0x481867)[_0x7c2c('0x29')](_0x4d6ec7);};}exports[_0x7c2c('0x2a')]=function(_0x4b1dd0,_0x358c67){var _0xf39941={},_0x3b2652={},_0x22d03f={'count':0x0,'rows':[]};var _0x145788=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0xa040ff){return{'name':_0xa040ff['fieldName'],'type':_0xa040ff[_0x7c2c('0x2e')][_0x7c2c('0x2f')]};});_0x3b2652[_0x7c2c('0x30')]=_[_0x7c2c('0x2b')](_0x145788,'name');_0x3b2652[_0x7c2c('0x31')]=_[_0x7c2c('0x32')](_0x4b1dd0[_0x7c2c('0x31')]);_0x3b2652[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x3b2652[_0x7c2c('0x30')],_0x3b2652[_0x7c2c('0x31')]);_0xf39941['attributes']=_[_0x7c2c('0x34')](_0x3b2652[_0x7c2c('0x30')],qs[_0x7c2c('0x35')](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x35')]));_0xf39941['attributes']=_0xf39941['attributes'][_0x7c2c('0x36')]?_0xf39941['attributes']:_0x3b2652['model'];if(!_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x37')](_0x7c2c('0x38'))){_0xf39941[_0x7c2c('0x1e')]=qs['limit'](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x1e')]);_0xf39941[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x1d')]);}_0xf39941[_0x7c2c('0x39')]=qs[_0x7c2c('0x3a')](_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x3a')]);_0xf39941[_0x7c2c('0x3b')]=qs[_0x7c2c('0x33')](_[_0x7c2c('0x3c')](_0x4b1dd0['query'],_0x3b2652['filters']),_0x145788);if(_0x4b1dd0[_0x7c2c('0x31')]['filter']){_0xf39941['where']=_['merge'](_0xf39941[_0x7c2c('0x3b')],{'$or':_[_0x7c2c('0x2b')](_0x145788,function(_0x129bf0){if(_0x129bf0[_0x7c2c('0x2e')]!==_0x7c2c('0x3d')){var _0x151eb2={};_0x151eb2[_0x129bf0[_0x7c2c('0x28')]]={'$like':'%'+_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x3e')]+'%'};return _0x151eb2;}})});}_0xf39941=_[_0x7c2c('0x3f')]({},_0xf39941,_0x4b1dd0[_0x7c2c('0x40')]);var _0x58696a={'where':_0xf39941['where']};return db[_0x7c2c('0x2c')][_0x7c2c('0x41')](_0x58696a)[_0x7c2c('0x24')](function(_0x57bead){_0x22d03f['count']=_0x57bead;if(_0x4b1dd0[_0x7c2c('0x31')][_0x7c2c('0x42')]){_0xf39941[_0x7c2c('0x43')]=[{'all':!![]}];}return db[_0x7c2c('0x2c')][_0x7c2c('0x44')](_0xf39941);})[_0x7c2c('0x24')](function(_0x12c9cd){_0x22d03f[_0x7c2c('0x45')]=_0x12c9cd;return _0x22d03f;})[_0x7c2c('0x24')](respondWithFilteredResult(_0x358c67,_0xf39941))['catch'](handleError(_0x358c67,null));};exports[_0x7c2c('0x46')]=function(_0x5aba9a,_0x2c3f40){var _0x322704={'raw':!![],'where':{'id':_0x5aba9a[_0x7c2c('0x47')]['id']}},_0x51e150={};_0x51e150['model']=_[_0x7c2c('0x32')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')]);_0x51e150[_0x7c2c('0x31')]=_['keys'](_0x5aba9a[_0x7c2c('0x31')]);_0x51e150['filters']=_['intersection'](_0x51e150[_0x7c2c('0x30')],_0x51e150[_0x7c2c('0x31')]);_0x322704[_0x7c2c('0x48')]=_['intersection'](_0x51e150[_0x7c2c('0x30')],qs[_0x7c2c('0x35')](_0x5aba9a['query'][_0x7c2c('0x35')]));_0x322704['attributes']=_0x322704[_0x7c2c('0x48')][_0x7c2c('0x36')]?_0x322704['attributes']:_0x51e150['model'];if(_0x5aba9a[_0x7c2c('0x31')][_0x7c2c('0x42')]){_0x322704['include']=[{'all':!![]}];}_0x322704=_[_0x7c2c('0x3f')]({},_0x322704,_0x5aba9a['options']);return db['ZendeskField'][_0x7c2c('0x49')](_0x322704)[_0x7c2c('0x24')](handleEntityNotFound(_0x2c3f40,null))[_0x7c2c('0x24')](respondWithResult(_0x2c3f40,null))[_0x7c2c('0x4a')](handleError(_0x2c3f40,null));};exports[_0x7c2c('0x4b')]=function(_0x23121f,_0x2b0781){return db[_0x7c2c('0x2c')][_0x7c2c('0x4b')](_0x23121f['body'],{})['then'](respondWithResult(_0x2b0781,0xc9))[_0x7c2c('0x4a')](handleError(_0x2b0781,null));};exports[_0x7c2c('0x23')]=function(_0x3ce2fb,_0x4f95a1){if(_0x3ce2fb['body']['id']){delete _0x3ce2fb[_0x7c2c('0x4c')]['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x49')]({'where':{'id':_0x3ce2fb[_0x7c2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f95a1,null))['then'](saveUpdates(_0x3ce2fb['body'],null))[_0x7c2c('0x24')](respondWithResult(_0x4f95a1,null))[_0x7c2c('0x4a')](handleError(_0x4f95a1,null));};exports[_0x7c2c('0x25')]=function(_0x27a096,_0x438cbd){return db['ZendeskField'][_0x7c2c('0x49')]({'where':{'id':_0x27a096[_0x7c2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x438cbd,null))[_0x7c2c('0x24')](removeEntity(_0x438cbd,null))['catch'](handleError(_0x438cbd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d95b1dc..e9bfe13 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 _0x61a5=['api','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','lodash','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x61a5,0x19e));var _0x561a=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x61a5[_0x10c16d];return _0x5896f4;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require('moment');var BPromise=require(_0x561a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x561a('0x4'));var rimraf=require(_0x561a('0x5'));var config=require(_0x561a('0x6'));var attributes=require(_0x561a('0x7'));module[_0x561a('0x8')]=function(_0x28ff42,_0x1e2ce1){return _0x28ff42[_0x561a('0x9')]('ZendeskField',attributes,{'tableName':_0x561a('0xa'),'paranoid':![],'indexes':[{'name':_0x561a('0xb'),'fields':[_0x561a('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1020=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x3c2e21,_0x18769a){var _0x38ee6e=function(_0x8ad74a){while(--_0x8ad74a){_0x3c2e21['push'](_0x3c2e21['shift']());}};_0x38ee6e(++_0x18769a);}(_0x1020,0x1a4));var _0x0102=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x1020[_0x592d48];return _0x5d789e;};'use strict';var _=require(_0x0102('0x0'));var util=require('util');var logger=require(_0x0102('0x1'))(_0x0102('0x2'));var moment=require(_0x0102('0x3'));var BPromise=require(_0x0102('0x4'));var rp=require(_0x0102('0x5'));var fs=require('fs');var path=require(_0x0102('0x6'));var rimraf=require(_0x0102('0x7'));var config=require(_0x0102('0x8'));var attributes=require(_0x0102('0x9'));module[_0x0102('0xa')]=function(_0x27dd86,_0x3afe31){return _0x27dd86['define'](_0x0102('0xb'),attributes,{'tableName':_0x0102('0xc'),'paranoid':![],'indexes':[{'name':_0x0102('0xd'),'fields':['idField','FieldId'],'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 f456cf4..f700be3 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 _0x759f=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x759f,0xe7));var _0xf759=function(_0x504cab,_0x559e50){_0x504cab=_0x504cab-0x0;var _0x5425e0=_0x759f[_0x504cab];return _0x5425e0;};'use strict';var _=require('lodash');var util=require(_0xf759('0x0'));var moment=require(_0xf759('0x1'));var BPromise=require('bluebird');var rs=require(_0xf759('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf759('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf759('0x4'));var jayson=require(_0xf759('0x5'));var client=jayson[_0xf759('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4f271,_0x1aeb13,_0x26fdee){return new BPromise(function(_0x1dbcfb,_0xf7b5f9){return client[_0xf759('0x7')](_0xa4f271,_0x26fdee)[_0xf759('0x8')](function(_0x2a44a5){logger[_0xf759('0x9')](_0xf759('0xa'),_0x1aeb13,_0xf759('0xb'));logger[_0xf759('0xc')](_0xf759('0xd'),_0x1aeb13,_0xf759('0xb'),JSON['stringify'](_0x2a44a5));if(_0x2a44a5[_0xf759('0xe')]){if(_0x2a44a5['error']['code']===0x1f4){logger['error'](_0xf759('0xa'),_0x1aeb13,_0x2a44a5['error'][_0xf759('0xf')]);return _0xf7b5f9(_0x2a44a5['error']['message']);}logger[_0xf759('0xe')](_0xf759('0xa'),_0x1aeb13,_0x2a44a5['error']['message']);return _0x1dbcfb(_0x2a44a5[_0xf759('0xe')][_0xf759('0xf')]);}else{logger['info'](_0xf759('0xa'),_0x1aeb13,_0xf759('0xb'));_0x1dbcfb(_0x2a44a5['result'][_0xf759('0xf')]);}})[_0xf759('0x10')](function(_0x1da961){logger[_0xf759('0xe')](_0xf759('0xa'),_0x1aeb13,_0x1da961);_0xf7b5f9(_0x1da961);});});} \ No newline at end of file +var _0x6892=['debug','request\x20sent','error','code','message','ZendeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x36eb44,_0x366971){var _0x1374ef=function(_0x289c99){while(--_0x289c99){_0x36eb44['push'](_0x36eb44['shift']());}};_0x1374ef(++_0x366971);}(_0x6892,0x161));var _0x2689=function(_0x14514c,_0x5c5ca8){_0x14514c=_0x14514c-0x0;var _0x3cd12d=_0x6892[_0x14514c];return _0x3cd12d;};'use strict';var _=require(_0x2689('0x0'));var util=require(_0x2689('0x1'));var moment=require(_0x2689('0x2'));var BPromise=require(_0x2689('0x3'));var rs=require(_0x2689('0x4'));var fs=require('fs');var Redis=require(_0x2689('0x5'));var db=require(_0x2689('0x6'))['db'];var utils=require(_0x2689('0x7'));var logger=require(_0x2689('0x8'))(_0x2689('0x9'));var config=require(_0x2689('0xa'));var jayson=require(_0x2689('0xb'));var client=jayson[_0x2689('0xc')][_0x2689('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5d72eb,_0x597a23,_0x37208f){return new BPromise(function(_0x479ddb,_0x89510c){return client['request'](_0x5d72eb,_0x37208f)['then'](function(_0x3f03ca){logger[_0x2689('0xe')]('ZendeskField,\x20%s,\x20%s',_0x597a23,'request\x20sent');logger[_0x2689('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x597a23,_0x2689('0x10'),JSON['stringify'](_0x3f03ca));if(_0x3f03ca[_0x2689('0x11')]){if(_0x3f03ca[_0x2689('0x11')][_0x2689('0x12')]===0x1f4){logger[_0x2689('0x11')]('ZendeskField,\x20%s,\x20%s',_0x597a23,_0x3f03ca['error'][_0x2689('0x13')]);return _0x89510c(_0x3f03ca[_0x2689('0x11')][_0x2689('0x13')]);}logger[_0x2689('0x11')]('ZendeskField,\x20%s,\x20%s',_0x597a23,_0x3f03ca['error'][_0x2689('0x13')]);return _0x479ddb(_0x3f03ca[_0x2689('0x11')][_0x2689('0x13')]);}else{logger[_0x2689('0xe')](_0x2689('0x14'),_0x597a23,'request\x20sent');_0x479ddb(_0x3f03ca[_0x2689('0x15')][_0x2689('0x13')]);}})[_0x2689('0x16')](function(_0x2fdf26){logger[_0x2689('0x11')](_0x2689('0x14'),_0x597a23,_0x2fdf26);_0x89510c(_0x2fdf26);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d9689ff..303ff43 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 _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x493fca,_0x1720a8){var _0x22a9a4=function(_0x2f6e28){while(--_0x2f6e28){_0x493fca['push'](_0x493fca['shift']());}};_0x22a9a4(++_0x1720a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0xe37a34,_0x301c1d){var _0x19fe67=function(_0x370922){while(--_0x370922){_0xe37a34['push'](_0xe37a34['shift']());}};_0x19fe67(++_0x301c1d);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 66d910c..d20c5cd 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 _0x51af=['exports','STRING','sequelize'];(function(_0x16b030,_0x2e0a77){var _0x46a461=function(_0x585ad6){while(--_0x585ad6){_0x16b030['push'](_0x16b030['shift']());}};_0x46a461(++_0x2e0a77);}(_0x51af,0x95));var _0xf51a=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x51af[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0xf51a('0x0'));module[_0xf51a('0x1')]={'name':{'type':Sequelize[_0xf51a('0x2')]},'description':{'type':Sequelize[_0xf51a('0x2')]},'host':{'type':Sequelize[_0xf51a('0x2')]},'zone':{'type':Sequelize[_0xf51a('0x2')]},'clientId':{'type':Sequelize[_0xf51a('0x2')]},'clientSecret':{'type':Sequelize[_0xf51a('0x2')]},'serverUrl':{'type':Sequelize[_0xf51a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf51a('0x2')]},'refreshToken':{'type':Sequelize[_0xf51a('0x2')]}}; \ No newline at end of file +var _0x856e=['STRING','sequelize','exports'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0x856e,0xa0));var _0xe856=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x856e[_0x15d18f];return _0xd12bf7;};'use strict';var Sequelize=require(_0xe856('0x0'));module[_0xe856('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe856('0x2')]},'host':{'type':Sequelize[_0xe856('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe856('0x2')]},'serverUrl':{'type':Sequelize[_0xe856('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe856('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 1e33391..5cccaa9 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 _0x38b8=['ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','set','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','index','ZohoAccount','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','rows','show','params','rawAttributes','options','find','create','update','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','mustache','util','to-csv'];(function(_0x3d035e,_0x104579){var _0x1dce02=function(_0x3f070f){while(--_0x3f070f){_0x3d035e['push'](_0x3d035e['shift']());}};_0x1dce02(++_0x104579);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x838b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x838b('0x1'));var zipdir=require(_0x838b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x838b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x838b('0x4'));var util=require(_0x838b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x838b('0x6'));var ejs=require(_0x838b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0x6'));var querystring=require(_0x838b('0xa'));var Papa=require(_0x838b('0xb'));var Redis=require('ioredis');var authService=require(_0x838b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xd'));var hardwareService=require(_0x838b('0xe'));var logger=require(_0x838b('0xf'))(_0x838b('0x10'));var utils=require(_0x838b('0x11'));var config=require(_0x838b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x838b('0x13'))['db'];var integrations=require(_0x838b('0x14'));var jayson=require(_0x838b('0x15'));var client=jayson[_0x838b('0x16')][_0x838b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x21cc45,_0xba19e4,_0x3324de,_0x1ddf43){return new BPromise(function(_0x525c60,_0x13344){var _0x5497fd=_0x1ddf43||client;return _0x5497fd['request'](_0x21cc45,_0x3324de)['then'](function(_0x450b9b){logger[_0x838b('0x18')](_0x838b('0x19'),_0xba19e4,_0x838b('0x1a'));logger[_0x838b('0x1b')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xba19e4,_0x838b('0x1a'),JSON[_0x838b('0x1c')](_0x450b9b));if(_0x450b9b[_0x838b('0x1d')]){if(_0x450b9b[_0x838b('0x1d')]['code']===0x1f4){logger[_0x838b('0x1d')](_0x838b('0x19'),_0xba19e4,_0x450b9b['error'][_0x838b('0x1e')]);return _0x13344(_0x450b9b[_0x838b('0x1d')]['message']);}logger[_0x838b('0x1d')](_0x838b('0x19'),_0xba19e4,_0x450b9b[_0x838b('0x1d')]['message']);return _0x525c60(_0x450b9b[_0x838b('0x1d')][_0x838b('0x1e')]);}else{logger[_0x838b('0x18')](_0x838b('0x19'),_0xba19e4,_0x838b('0x1a'));_0x525c60(_0x450b9b[_0x838b('0x1f')][_0x838b('0x1e')]);}})[_0x838b('0x20')](function(_0x17a0eb){logger[_0x838b('0x1d')](_0x838b('0x19'),_0xba19e4,_0x17a0eb);_0x13344(_0x17a0eb);});});}function respondWithStatusCode(_0xba76,_0x451089){_0x451089=_0x451089||0xcc;return function(_0x2d9d12){if(_0x2d9d12){return _0xba76['sendStatus'](_0x451089);}return _0xba76[_0x838b('0x21')](_0x451089)['end']();};}function respondWithResult(_0x51adc6,_0x430400){_0x430400=_0x430400||0xc8;return function(_0x2bc24c){if(_0x2bc24c){return _0x51adc6[_0x838b('0x21')](_0x430400)['json'](_0x2bc24c);}};}function respondWithFilteredResult(_0x302445,_0x27f385){return function(_0x47d239){if(_0x47d239){var _0x19fc7b=_0x47d239['count'],_0x322e3f=_0x27f385['offset'],_0x59fa16=_0x27f385['offset']+_0x27f385['limit'],_0x576bfa;if(_0x59fa16>=_0x19fc7b){_0x59fa16=_0x19fc7b;_0x576bfa=0xc8;}else{_0x576bfa=0xce;}_0x302445[_0x838b('0x21')](_0x576bfa);return _0x302445[_0x838b('0x22')]('Content-Range',_0x322e3f+'-'+_0x59fa16+'/'+_0x19fc7b)['json'](_0x47d239);}return null;};}function patchUpdates(_0xc9ebfd){return function(_0x4081b1){try{jsonpatch[_0x838b('0x23')](_0x4081b1,_0xc9ebfd,!![]);}catch(_0x29e161){return BPromise[_0x838b('0x24')](_0x29e161);}return _0x4081b1[_0x838b('0x25')]();};}function saveUpdates(_0xc7b054,_0x3ebc0c){return function(_0x3e1407){if(_0x3e1407){return _0x3e1407['update'](_0xc7b054)[_0x838b('0x26')](function(_0x756dcc){return _0x756dcc;});}return null;};}function removeEntity(_0xd4f382,_0x294ae0){return function(_0x55f36a){if(_0x55f36a){return _0x55f36a[_0x838b('0x27')]()[_0x838b('0x26')](function(){_0xd4f382[_0x838b('0x21')](0xcc)[_0x838b('0x28')]();});}};}function handleEntityNotFound(_0x44d037,_0x4fd48b){return function(_0x43ca2f){if(!_0x43ca2f){_0x44d037[_0x838b('0x29')](0x194);}return _0x43ca2f;};}function handleError(_0x13a3df,_0x4599f3){_0x4599f3=_0x4599f3||0x1f4;return function(_0x489637){logger[_0x838b('0x1d')](_0x489637[_0x838b('0x2a')]);if(_0x489637['name']){delete _0x489637[_0x838b('0x2b')];}_0x13a3df[_0x838b('0x21')](_0x4599f3)[_0x838b('0x2c')](_0x489637);};}exports[_0x838b('0x2d')]=function(_0x3008fa,_0x4bf515){var _0x1e9405={},_0x38c3a3={},_0x5e42ad={'count':0x0,'rows':[]};var _0x2eff71=_['map'](db[_0x838b('0x2e')]['rawAttributes'],function(_0x26e428){return{'name':_0x26e428['fieldName'],'type':_0x26e428[_0x838b('0x2f')][_0x838b('0x30')]};});_0x38c3a3[_0x838b('0x31')]=_[_0x838b('0x32')](_0x2eff71,_0x838b('0x2b'));_0x38c3a3[_0x838b('0x33')]=_[_0x838b('0x34')](_0x3008fa[_0x838b('0x33')]);_0x38c3a3[_0x838b('0x35')]=_[_0x838b('0x36')](_0x38c3a3['model'],_0x38c3a3[_0x838b('0x33')]);_0x1e9405['attributes']=_[_0x838b('0x36')](_0x38c3a3[_0x838b('0x31')],qs[_0x838b('0x37')](_0x3008fa[_0x838b('0x33')][_0x838b('0x37')]));_0x1e9405[_0x838b('0x38')]=_0x1e9405[_0x838b('0x38')][_0x838b('0x39')]?_0x1e9405['attributes']:_0x38c3a3[_0x838b('0x31')];if(!_0x3008fa[_0x838b('0x33')][_0x838b('0x3a')](_0x838b('0x3b'))){_0x1e9405[_0x838b('0x3c')]=qs[_0x838b('0x3c')](_0x3008fa['query'][_0x838b('0x3c')]);_0x1e9405['offset']=qs[_0x838b('0x3d')](_0x3008fa[_0x838b('0x33')]['offset']);}_0x1e9405[_0x838b('0x3e')]=qs[_0x838b('0x3f')](_0x3008fa[_0x838b('0x33')][_0x838b('0x3f')]);_0x1e9405['where']=qs['filters'](_[_0x838b('0x40')](_0x3008fa[_0x838b('0x33')],_0x38c3a3['filters']),_0x2eff71);if(_0x3008fa[_0x838b('0x33')]['filter']){_0x1e9405[_0x838b('0x41')]=_[_0x838b('0x42')](_0x1e9405[_0x838b('0x41')],{'$or':_[_0x838b('0x32')](_0x2eff71,function(_0xece006){if(_0xece006['type']!==_0x838b('0x43')){var _0x5f42a7={};_0x5f42a7[_0xece006[_0x838b('0x2b')]]={'$like':'%'+_0x3008fa['query'][_0x838b('0x44')]+'%'};return _0x5f42a7;}})});}_0x1e9405=_[_0x838b('0x42')]({},_0x1e9405,_0x3008fa['options']);var _0x1e936b={'where':_0x1e9405[_0x838b('0x41')]};return db['ZohoAccount'][_0x838b('0x45')](_0x1e936b)['then'](function(_0xa66be5){_0x5e42ad[_0x838b('0x45')]=_0xa66be5;if(_0x3008fa['query'][_0x838b('0x46')]){_0x1e9405['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x1e9405);})['then'](function(_0x2aa6b7){_0x5e42ad[_0x838b('0x47')]=_0x2aa6b7;return _0x5e42ad;})[_0x838b('0x26')](respondWithFilteredResult(_0x4bf515,_0x1e9405))[_0x838b('0x20')](handleError(_0x4bf515,null));};exports[_0x838b('0x48')]=function(_0x1aaeb2,_0x5ebde7){var _0x1a816f={'raw':![],'where':{'id':_0x1aaeb2[_0x838b('0x49')]['id']}},_0x53a25b={};_0x53a25b['model']=_[_0x838b('0x34')](db[_0x838b('0x2e')][_0x838b('0x4a')]);_0x53a25b[_0x838b('0x33')]=_[_0x838b('0x34')](_0x1aaeb2['query']);_0x53a25b['filters']=_[_0x838b('0x36')](_0x53a25b[_0x838b('0x31')],_0x53a25b['query']);_0x1a816f['attributes']=_[_0x838b('0x36')](_0x53a25b[_0x838b('0x31')],qs[_0x838b('0x37')](_0x1aaeb2[_0x838b('0x33')][_0x838b('0x37')]));_0x1a816f[_0x838b('0x38')]=_0x1a816f[_0x838b('0x38')][_0x838b('0x39')]?_0x1a816f[_0x838b('0x38')]:_0x53a25b[_0x838b('0x31')];if(_0x1aaeb2['query']['includeAll']){_0x1a816f['include']=[{'all':!![]}];}_0x1a816f=_[_0x838b('0x42')]({},_0x1a816f,_0x1aaeb2[_0x838b('0x4b')]);return db[_0x838b('0x2e')][_0x838b('0x4c')](_0x1a816f)[_0x838b('0x26')](handleEntityNotFound(_0x5ebde7,null))['then'](respondWithResult(_0x5ebde7,null))[_0x838b('0x20')](handleError(_0x5ebde7,null));};exports['create']=function(_0x59ebde,_0x27ee83){return db[_0x838b('0x2e')][_0x838b('0x4d')](_0x59ebde['body'],{})[_0x838b('0x26')](respondWithResult(_0x27ee83,0xc9))[_0x838b('0x20')](handleError(_0x27ee83,null));};exports[_0x838b('0x4e')]=function(_0x12180b,_0x28d753){if(_0x12180b[_0x838b('0x4f')]['id']){delete _0x12180b['body']['id'];}return db[_0x838b('0x2e')][_0x838b('0x4c')]({'where':{'id':_0x12180b[_0x838b('0x49')]['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x28d753,null))[_0x838b('0x26')](saveUpdates(_0x12180b[_0x838b('0x4f')],null))[_0x838b('0x26')](respondWithResult(_0x28d753,null))['catch'](handleError(_0x28d753,null));};exports[_0x838b('0x27')]=function(_0xf115f8,_0x6c68e2){return db[_0x838b('0x2e')][_0x838b('0x4c')]({'where':{'id':_0xf115f8[_0x838b('0x49')]['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x6c68e2,null))[_0x838b('0x26')](removeEntity(_0x6c68e2,null))[_0x838b('0x20')](handleError(_0x6c68e2,null));};exports[_0x838b('0x50')]=function(_0x4a170c,_0x781e1e,_0x5025c2){var _0x3c501c={};var _0x43a95d={};var _0x12c565;var _0x164e01;return db[_0x838b('0x2e')][_0x838b('0x51')]({'where':{'id':_0x4a170c['params']['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x781e1e,null))[_0x838b('0x26')](function(_0x1321e1){if(_0x1321e1){_0x12c565=_0x1321e1;_0x43a95d[_0x838b('0x31')]=_[_0x838b('0x34')](db[_0x838b('0x52')][_0x838b('0x4a')]);_0x43a95d[_0x838b('0x33')]=_[_0x838b('0x34')](_0x4a170c[_0x838b('0x33')]);_0x43a95d[_0x838b('0x35')]=_[_0x838b('0x36')](_0x43a95d[_0x838b('0x31')],_0x43a95d[_0x838b('0x33')]);_0x3c501c['attributes']=_[_0x838b('0x36')](_0x43a95d['model'],qs['fields'](_0x4a170c[_0x838b('0x33')]['fields']));_0x3c501c[_0x838b('0x38')]=_0x3c501c[_0x838b('0x38')][_0x838b('0x39')]?_0x3c501c[_0x838b('0x38')]:_0x43a95d[_0x838b('0x31')];_0x3c501c[_0x838b('0x3e')]=qs['sort'](_0x4a170c['query'][_0x838b('0x3f')]);_0x3c501c[_0x838b('0x41')]=qs[_0x838b('0x35')](_[_0x838b('0x40')](_0x4a170c['query'],_0x43a95d['filters']));if(_0x4a170c['query'][_0x838b('0x44')]){_0x3c501c[_0x838b('0x41')]=_['merge'](_0x3c501c[_0x838b('0x41')],{'$or':_['map'](_0x3c501c[_0x838b('0x38')],function(_0x5ab860){var _0x54e502={};_0x54e502[_0x5ab860]={'$like':'%'+_0x4a170c['query']['filter']+'%'};return _0x54e502;})});}_0x3c501c=_[_0x838b('0x42')]({},_0x3c501c,_0x4a170c[_0x838b('0x4b')]);return _0x12c565['getConfigurations'](_0x3c501c);}})[_0x838b('0x26')](function(_0x4d03b8){if(_0x4d03b8){_0x164e01=_0x4d03b8[_0x838b('0x39')];if(!_0x4a170c[_0x838b('0x33')][_0x838b('0x3a')](_0x838b('0x3b'))){_0x3c501c[_0x838b('0x3c')]=qs[_0x838b('0x3c')](_0x4a170c[_0x838b('0x33')][_0x838b('0x3c')]);_0x3c501c['offset']=qs[_0x838b('0x3d')](_0x4a170c[_0x838b('0x33')][_0x838b('0x3d')]);}return _0x12c565[_0x838b('0x50')](_0x3c501c);}})['then'](function(_0x59e508){if(_0x59e508){return _0x59e508?{'count':_0x164e01,'rows':_0x59e508}:null;}})[_0x838b('0x26')](respondWithResult(_0x781e1e,null))['catch'](handleError(_0x781e1e,null));};exports[_0x838b('0x53')]=function(_0x3ecfbe,_0x29fa16,_0x42c321){if(_0x3ecfbe[_0x838b('0x4f')]['id']){delete _0x3ecfbe[_0x838b('0x4f')]['id'];}return db[_0x838b('0x2e')][_0x838b('0x51')]({'where':{'id':_0x3ecfbe[_0x838b('0x49')]['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x29fa16,null))[_0x838b('0x26')](function(_0x5e37e1){if(_0x5e37e1){_0x3ecfbe[_0x838b('0x4f')]['AccountId']=_0x5e37e1['id'];_0x3ecfbe['body'][_0x838b('0x54')]=integrations[_0x838b('0x55')](_0x3ecfbe[_0x838b('0x4f')][_0x838b('0x56')],_0x3ecfbe['body'][_0x838b('0x2f')]);_0x3ecfbe[_0x838b('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x3ecfbe[_0x838b('0x4f')][_0x838b('0x56')],_0x3ecfbe['body'][_0x838b('0x2f')]);return db[_0x838b('0x52')]['create'](_0x3ecfbe['body'],{'include':[{'model':db['ZohoField'],'as':_0x838b('0x54')},{'model':db['ZohoField'],'as':_0x838b('0x57')}]});}return null;})['then'](respondWithResult(_0x29fa16,null))[_0x838b('0x20')](handleError(_0x29fa16,null));};function getAccessToken(_0x2c8ea5){return new Promise(function(_0x2cf9be,_0x272d2b){var _0x31e780;switch(_0x2c8ea5[_0x838b('0x58')]){case'US':_0x31e780=_0x838b('0x59');break;case'AU':_0x31e780=_0x838b('0x5a');break;case'EU':_0x31e780=_0x838b('0x5b');break;case'IN':_0x31e780='https://accounts.zoho.in';break;case'CN':_0x31e780='https://accounts.zoho.com.cn';break;default:_0x31e780=_0x838b('0x5b');break;}var _0x1241df={'method':_0x838b('0x5c'),'uri':_0x31e780+_0x838b('0x5d'),'qs':{'refresh_token':_0x2c8ea5[_0x838b('0x5e')],'client_id':_0x2c8ea5['clientId'],'client_secret':_0x2c8ea5[_0x838b('0x5f')],'grant_type':_0x838b('0x60')},'json':!![]};return rp(_0x1241df)['then'](function(_0x4e82aa){if(_0x4e82aa[_0x838b('0x61')]){_0x2cf9be(_0x4e82aa[_0x838b('0x61')]);}else{_0x272d2b(_0x838b('0x62'));}})[_0x838b('0x20')](function(_0x57ff74){_0x272d2b(_0x57ff74);});});}exports[_0x838b('0x63')]=function(_0x243eaa,_0x3f28da,_0x440a4c){var _0x3d4fce,_0x44a251,_0xa3f233,_0x505f2,_0x359753;return db[_0x838b('0x2e')][_0x838b('0x51')]({'where':{'id':_0x243eaa[_0x838b('0x49')]['id']},'attributes':['id',_0x838b('0x64'),'zone','clientId',_0x838b('0x5f'),'serverUrl',_0x838b('0x65'),_0x838b('0x5e')]})[_0x838b('0x26')](handleEntityNotFound(_0x3f28da,null))['then'](function(_0x40ba64){_0x359753=_0x40ba64;_0x3d4fce=_0x359753[_0x838b('0x64')];_0x44a251=_0x3d4fce===_0x838b('0x66')?'eu':_0x838b('0x67');_0xa3f233=_0x359753[_0x838b('0x68')];var _0x5a3d0f=_0xa3f233[_0x838b('0x69')](-0x1);if(_0x5a3d0f==='/'||_0x5a3d0f==='\x5c'||_0x5a3d0f===':'){_0xa3f233=_0xa3f233[_0x838b('0x6a')](0x0,_0xa3f233[_0x838b('0x6b')](_0x5a3d0f));}if(!_0x359753[_0x838b('0x5e')]){throw new Error(_0x838b('0x6c'));}return getAccessToken(_0x359753);})['then'](function(_0x81909e){if(_0x81909e){return rp({'method':_0x838b('0x6d'),'uri':util[_0x838b('0x6e')](_0x838b('0x6f'),_0x44a251),'qs':{'module':_0x838b('0x70')},'headers':{'Authorization':_0x838b('0x71')+_0x81909e},'json':!![]});}})[_0x838b('0x26')](function(_0x3a97d4){if(_0x3a97d4){if(_0x3a97d4[_0x838b('0x72')]&&_0x3a97d4['response'][_0x838b('0x1d')]){throw new Error(_0x3a97d4[_0x838b('0x72')][_0x838b('0x1d')][_0x838b('0x1e')]);}var _0x54e3b8=[];var _0x3ab270=[];var _0xd52bf8=[_0x838b('0x73'),_0x838b('0x74'),'Description',_0x838b('0x75'),_0x838b('0x76'),_0x838b('0x77'),_0x838b('0x78'),_0x838b('0x79')];_0x3ab270=_[_0x838b('0x7a')](_0x3a97d4['fields'],function(_0x1f0d31){return _0xd52bf8['includes'](_0x1f0d31['api_name']);});for(var _0x29c148=0x0;_0x29c148<_0x3ab270[_0x838b('0x39')];_0x29c148++){if(_0x3ab270[_0x29c148][_0x838b('0x7b')]===![]){_0x54e3b8[_0x838b('0x7c')]({'id':_0x3ab270[_0x29c148]['id'],'name':_0x3ab270[_0x29c148][_0x838b('0x7d')],'custom':_0x3ab270[_0x29c148][_0x838b('0x7e')],'options':_0x3ab270[_0x29c148][_0x838b('0x7f')]===_0x838b('0x80')&&_0x3ab270[_0x29c148][_0x838b('0x81')]['length']>-0x1?_[_0x838b('0x32')](_0x3ab270[_0x29c148][_0x838b('0x81')],function(_0x50fbec){return{'name':_0x50fbec,'value':_0x50fbec};}):[]});}}return{'count':_0x54e3b8[_0x838b('0x39')],'rows':_0x54e3b8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3f28da,null))['catch'](function(_0x846cf1){var _0x527c30=_0x243eaa[_0x838b('0x33')][_0x838b('0x82')]?0x1f4:_0x846cf1[_0x838b('0x83')]||0x1f4;logger[_0x838b('0x1d')](_0x838b('0x84'),_0x838b('0x63'),_0x527c30,JSON[_0x838b('0x1c')](_0x846cf1));delete _0x846cf1[_0x838b('0x2b')];if(_0x527c30===0x191){_0x527c30=0x190;}_0x3f28da[_0x838b('0x21')](_0x527c30)[_0x838b('0x2c')](_0x243eaa[_0x838b('0x33')][_0x838b('0x82')]?{'message':_0x838b('0x85'),'statusCode':_0x846cf1[_0x838b('0x83')]}:_0x846cf1);});}; \ No newline at end of file +var _0x96d8=['filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','body','find','findOne','pick','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','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','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','end','stack','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL'];(function(_0xa52927,_0x30e2c0){var _0x197216=function(_0x5a0383){while(--_0x5a0383){_0xa52927['push'](_0xa52927['shift']());}};_0x197216(++_0x30e2c0);}(_0x96d8,0x1e2));var _0x896d=function(_0x445ac4,_0x5f0abb){_0x445ac4=_0x445ac4-0x0;var _0x5d6e45=_0x96d8[_0x445ac4];return _0x5d6e45;};'use strict';var pdf=require(_0x896d('0x0'));var emlformat=require(_0x896d('0x1'));var rimraf=require(_0x896d('0x2'));var zipdir=require(_0x896d('0x3'));var jsonpatch=require(_0x896d('0x4'));var rp=require(_0x896d('0x5'));var moment=require(_0x896d('0x6'));var BPromise=require(_0x896d('0x7'));var Mustache=require(_0x896d('0x8'));var util=require(_0x896d('0x9'));var path=require(_0x896d('0xa'));var sox=require(_0x896d('0xb'));var csv=require(_0x896d('0xc'));var ejs=require(_0x896d('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x896d('0xe'));var crypto=require(_0x896d('0xf'));var jsforce=require(_0x896d('0x10'));var deskjs=require(_0x896d('0x11'));var toCsv=require(_0x896d('0xc'));var querystring=require(_0x896d('0x12'));var Papa=require(_0x896d('0x13'));var Redis=require(_0x896d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x896d('0x15'));var as=require(_0x896d('0x16'));var hardwareService=require(_0x896d('0x17'));var logger=require(_0x896d('0x18'))(_0x896d('0x19'));var utils=require('../../config/utils');var config=require(_0x896d('0x1a'));var licenseUtil=require(_0x896d('0x1b'));var db=require(_0x896d('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x896d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4a392f,_0x72d0d1,_0x5301bc,_0x4adcbe){return new BPromise(function(_0x10cf46,_0x10d472){var _0x5a3674=_0x4adcbe||client;return _0x5a3674[_0x896d('0x1e')](_0x4a392f,_0x5301bc)[_0x896d('0x1f')](function(_0x544be0){logger[_0x896d('0x20')](_0x896d('0x21'),_0x72d0d1,_0x896d('0x22'));logger[_0x896d('0x23')](_0x896d('0x24'),_0x72d0d1,_0x896d('0x22'),JSON['stringify'](_0x544be0));if(_0x544be0[_0x896d('0x25')]){if(_0x544be0[_0x896d('0x25')]['code']===0x1f4){logger[_0x896d('0x25')](_0x896d('0x21'),_0x72d0d1,_0x544be0[_0x896d('0x25')]['message']);return _0x10d472(_0x544be0[_0x896d('0x25')][_0x896d('0x26')]);}logger[_0x896d('0x25')](_0x896d('0x21'),_0x72d0d1,_0x544be0['error'][_0x896d('0x26')]);return _0x10cf46(_0x544be0[_0x896d('0x25')][_0x896d('0x26')]);}else{logger[_0x896d('0x20')](_0x896d('0x21'),_0x72d0d1,_0x896d('0x22'));_0x10cf46(_0x544be0[_0x896d('0x27')][_0x896d('0x26')]);}})[_0x896d('0x28')](function(_0xe43752){logger['error'](_0x896d('0x21'),_0x72d0d1,_0xe43752);_0x10d472(_0xe43752);});});}function respondWithStatusCode(_0x35dbeb,_0x2d550c){_0x2d550c=_0x2d550c||0xcc;return function(_0xcd926){if(_0xcd926){return _0x35dbeb[_0x896d('0x29')](_0x2d550c);}return _0x35dbeb['status'](_0x2d550c)['end']();};}function respondWithResult(_0x1ed355,_0x5acbea){_0x5acbea=_0x5acbea||0xc8;return function(_0x49985f){if(_0x49985f){return _0x1ed355[_0x896d('0x2a')](_0x5acbea)['json'](_0x49985f);}};}function respondWithFilteredResult(_0x5f2f39,_0x47737c){return function(_0x1914ce){if(_0x1914ce){var _0x36a04e=_0x1914ce[_0x896d('0x2b')],_0x2a58a4=_0x47737c['offset'],_0x2b3d4=_0x47737c[_0x896d('0x2c')]+_0x47737c[_0x896d('0x2d')],_0x449667;if(_0x2b3d4>=_0x36a04e){_0x2b3d4=_0x36a04e;_0x449667=0xc8;}else{_0x449667=0xce;}_0x5f2f39[_0x896d('0x2a')](_0x449667);return _0x5f2f39[_0x896d('0x2e')]('Content-Range',_0x2a58a4+'-'+_0x2b3d4+'/'+_0x36a04e)[_0x896d('0x2f')](_0x1914ce);}return null;};}function patchUpdates(_0x174a3d){return function(_0xe4a8ee){try{jsonpatch[_0x896d('0x30')](_0xe4a8ee,_0x174a3d,!![]);}catch(_0x221545){return BPromise[_0x896d('0x31')](_0x221545);}return _0xe4a8ee[_0x896d('0x32')]();};}function saveUpdates(_0x4aa97b,_0x5bf090){return function(_0x537b4c){if(_0x537b4c){return _0x537b4c[_0x896d('0x33')](_0x4aa97b)['then'](function(_0xde98cb){return _0xde98cb;});}return null;};}function removeEntity(_0x236f34,_0x346f0a){return function(_0x175239){if(_0x175239){return _0x175239['destroy']()[_0x896d('0x1f')](function(){_0x236f34[_0x896d('0x2a')](0xcc)[_0x896d('0x34')]();});}};}function handleEntityNotFound(_0x1676f0,_0x3a0241){return function(_0x2a551f){if(!_0x2a551f){_0x1676f0[_0x896d('0x29')](0x194);}return _0x2a551f;};}function handleError(_0x1a6e08,_0x33fa4e){_0x33fa4e=_0x33fa4e||0x1f4;return function(_0x414cc7){logger[_0x896d('0x25')](_0x414cc7[_0x896d('0x35')]);if(_0x414cc7[_0x896d('0x36')]){delete _0x414cc7['name'];}_0x1a6e08[_0x896d('0x2a')](_0x33fa4e)[_0x896d('0x37')](_0x414cc7);};}exports['index']=function(_0x21f32a,_0x450bbc){var _0x432b1a={},_0x54f253={},_0x4b8515={'count':0x0,'rows':[]};var _0x3a8e07=_[_0x896d('0x38')](db[_0x896d('0x39')]['rawAttributes'],function(_0x322435){return{'name':_0x322435[_0x896d('0x3a')],'type':_0x322435[_0x896d('0x3b')][_0x896d('0x3c')]};});_0x54f253[_0x896d('0x3d')]=_[_0x896d('0x38')](_0x3a8e07,_0x896d('0x36'));_0x54f253[_0x896d('0x3e')]=_[_0x896d('0x3f')](_0x21f32a['query']);_0x54f253['filters']=_['intersection'](_0x54f253[_0x896d('0x3d')],_0x54f253[_0x896d('0x3e')]);_0x432b1a[_0x896d('0x40')]=_[_0x896d('0x41')](_0x54f253['model'],qs['fields'](_0x21f32a[_0x896d('0x3e')][_0x896d('0x42')]));_0x432b1a['attributes']=_0x432b1a['attributes'][_0x896d('0x43')]?_0x432b1a[_0x896d('0x40')]:_0x54f253['model'];if(!_0x21f32a[_0x896d('0x3e')][_0x896d('0x44')](_0x896d('0x45'))){_0x432b1a[_0x896d('0x2d')]=qs[_0x896d('0x2d')](_0x21f32a[_0x896d('0x3e')]['limit']);_0x432b1a['offset']=qs[_0x896d('0x2c')](_0x21f32a[_0x896d('0x3e')][_0x896d('0x2c')]);}_0x432b1a['order']=qs[_0x896d('0x46')](_0x21f32a['query'][_0x896d('0x46')]);_0x432b1a[_0x896d('0x47')]=qs[_0x896d('0x48')](_['pick'](_0x21f32a[_0x896d('0x3e')],_0x54f253[_0x896d('0x48')]),_0x3a8e07);if(_0x21f32a[_0x896d('0x3e')]['filter']){_0x432b1a[_0x896d('0x47')]=_['merge'](_0x432b1a[_0x896d('0x47')],{'$or':_[_0x896d('0x38')](_0x3a8e07,function(_0x22d45d){if(_0x22d45d[_0x896d('0x3b')]!==_0x896d('0x49')){var _0x38bac4={};_0x38bac4[_0x22d45d['name']]={'$like':'%'+_0x21f32a[_0x896d('0x3e')][_0x896d('0x4a')]+'%'};return _0x38bac4;}})});}_0x432b1a=_[_0x896d('0x4b')]({},_0x432b1a,_0x21f32a['options']);var _0x1f15fc={'where':_0x432b1a['where']};return db[_0x896d('0x39')]['count'](_0x1f15fc)[_0x896d('0x1f')](function(_0x11e6aa){_0x4b8515[_0x896d('0x2b')]=_0x11e6aa;if(_0x21f32a[_0x896d('0x3e')][_0x896d('0x4c')]){_0x432b1a[_0x896d('0x4d')]=[{'all':!![]}];}return db[_0x896d('0x39')][_0x896d('0x4e')](_0x432b1a);})[_0x896d('0x1f')](function(_0x2d2594){_0x4b8515[_0x896d('0x4f')]=_0x2d2594;return _0x4b8515;})[_0x896d('0x1f')](respondWithFilteredResult(_0x450bbc,_0x432b1a))[_0x896d('0x28')](handleError(_0x450bbc,null));};exports[_0x896d('0x50')]=function(_0x7860dc,_0x4a36b4){var _0x24c24d={'raw':![],'where':{'id':_0x7860dc[_0x896d('0x51')]['id']}},_0x4649cb={};_0x4649cb[_0x896d('0x3d')]=_[_0x896d('0x3f')](db[_0x896d('0x39')][_0x896d('0x52')]);_0x4649cb[_0x896d('0x3e')]=_[_0x896d('0x3f')](_0x7860dc[_0x896d('0x3e')]);_0x4649cb[_0x896d('0x48')]=_[_0x896d('0x41')](_0x4649cb[_0x896d('0x3d')],_0x4649cb[_0x896d('0x3e')]);_0x24c24d['attributes']=_['intersection'](_0x4649cb[_0x896d('0x3d')],qs[_0x896d('0x42')](_0x7860dc['query'][_0x896d('0x42')]));_0x24c24d[_0x896d('0x40')]=_0x24c24d[_0x896d('0x40')]['length']?_0x24c24d[_0x896d('0x40')]:_0x4649cb[_0x896d('0x3d')];if(_0x7860dc['query'][_0x896d('0x4c')]){_0x24c24d[_0x896d('0x4d')]=[{'all':!![]}];}_0x24c24d=_[_0x896d('0x4b')]({},_0x24c24d,_0x7860dc[_0x896d('0x53')]);return db[_0x896d('0x39')]['find'](_0x24c24d)[_0x896d('0x1f')](handleEntityNotFound(_0x4a36b4,null))[_0x896d('0x1f')](respondWithResult(_0x4a36b4,null))[_0x896d('0x28')](handleError(_0x4a36b4,null));};exports['create']=function(_0x38a728,_0x194dd8){return db[_0x896d('0x39')][_0x896d('0x54')](_0x38a728[_0x896d('0x55')],{})[_0x896d('0x1f')](respondWithResult(_0x194dd8,0xc9))['catch'](handleError(_0x194dd8,null));};exports[_0x896d('0x33')]=function(_0x1aec7a,_0x6e8e7c){if(_0x1aec7a['body']['id']){delete _0x1aec7a[_0x896d('0x55')]['id'];}return db['ZohoAccount'][_0x896d('0x56')]({'where':{'id':_0x1aec7a[_0x896d('0x51')]['id']}})[_0x896d('0x1f')](handleEntityNotFound(_0x6e8e7c,null))[_0x896d('0x1f')](saveUpdates(_0x1aec7a[_0x896d('0x55')],null))[_0x896d('0x1f')](respondWithResult(_0x6e8e7c,null))['catch'](handleError(_0x6e8e7c,null));};exports['destroy']=function(_0x413081,_0x34c211){return db['ZohoAccount']['find']({'where':{'id':_0x413081['params']['id']}})[_0x896d('0x1f')](handleEntityNotFound(_0x34c211,null))['then'](removeEntity(_0x34c211,null))[_0x896d('0x28')](handleError(_0x34c211,null));};exports['getConfigurations']=function(_0x3ade02,_0x5489d0,_0x507c01){var _0x2ac4d8={};var _0xb3aa71={};var _0x2d8f18;var _0x543f92;return db[_0x896d('0x39')][_0x896d('0x57')]({'where':{'id':_0x3ade02[_0x896d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5489d0,null))['then'](function(_0x2e6101){if(_0x2e6101){_0x2d8f18=_0x2e6101;_0xb3aa71[_0x896d('0x3d')]=_[_0x896d('0x3f')](db['ZohoConfiguration'][_0x896d('0x52')]);_0xb3aa71[_0x896d('0x3e')]=_[_0x896d('0x3f')](_0x3ade02['query']);_0xb3aa71[_0x896d('0x48')]=_[_0x896d('0x41')](_0xb3aa71[_0x896d('0x3d')],_0xb3aa71['query']);_0x2ac4d8[_0x896d('0x40')]=_[_0x896d('0x41')](_0xb3aa71[_0x896d('0x3d')],qs[_0x896d('0x42')](_0x3ade02[_0x896d('0x3e')][_0x896d('0x42')]));_0x2ac4d8[_0x896d('0x40')]=_0x2ac4d8[_0x896d('0x40')]['length']?_0x2ac4d8[_0x896d('0x40')]:_0xb3aa71[_0x896d('0x3d')];_0x2ac4d8['order']=qs[_0x896d('0x46')](_0x3ade02[_0x896d('0x3e')][_0x896d('0x46')]);_0x2ac4d8['where']=qs['filters'](_[_0x896d('0x58')](_0x3ade02[_0x896d('0x3e')],_0xb3aa71[_0x896d('0x48')]));if(_0x3ade02['query']['filter']){_0x2ac4d8[_0x896d('0x47')]=_[_0x896d('0x4b')](_0x2ac4d8[_0x896d('0x47')],{'$or':_[_0x896d('0x38')](_0x2ac4d8[_0x896d('0x40')],function(_0x1eaaea){var _0x4d78e5={};_0x4d78e5[_0x1eaaea]={'$like':'%'+_0x3ade02[_0x896d('0x3e')][_0x896d('0x4a')]+'%'};return _0x4d78e5;})});}_0x2ac4d8=_['merge']({},_0x2ac4d8,_0x3ade02[_0x896d('0x53')]);return _0x2d8f18[_0x896d('0x59')](_0x2ac4d8);}})[_0x896d('0x1f')](function(_0x53fcc2){if(_0x53fcc2){_0x543f92=_0x53fcc2[_0x896d('0x43')];if(!_0x3ade02[_0x896d('0x3e')][_0x896d('0x44')](_0x896d('0x45'))){_0x2ac4d8[_0x896d('0x2d')]=qs[_0x896d('0x2d')](_0x3ade02['query'][_0x896d('0x2d')]);_0x2ac4d8[_0x896d('0x2c')]=qs[_0x896d('0x2c')](_0x3ade02['query'][_0x896d('0x2c')]);}return _0x2d8f18[_0x896d('0x59')](_0x2ac4d8);}})[_0x896d('0x1f')](function(_0x3da584){if(_0x3da584){return _0x3da584?{'count':_0x543f92,'rows':_0x3da584}:null;}})[_0x896d('0x1f')](respondWithResult(_0x5489d0,null))[_0x896d('0x28')](handleError(_0x5489d0,null));};exports[_0x896d('0x5a')]=function(_0x267a38,_0x591f4a,_0x227d05){if(_0x267a38[_0x896d('0x55')]['id']){delete _0x267a38[_0x896d('0x55')]['id'];}return db['ZohoAccount'][_0x896d('0x57')]({'where':{'id':_0x267a38[_0x896d('0x51')]['id']}})[_0x896d('0x1f')](handleEntityNotFound(_0x591f4a,null))['then'](function(_0x300b18){if(_0x300b18){_0x267a38[_0x896d('0x55')][_0x896d('0x5b')]=_0x300b18['id'];_0x267a38[_0x896d('0x55')][_0x896d('0x5c')]=integrations['getSubjects'](_0x267a38[_0x896d('0x55')]['channel'],_0x267a38[_0x896d('0x55')][_0x896d('0x3b')]);_0x267a38[_0x896d('0x55')]['Descriptions']=integrations[_0x896d('0x5d')](_0x267a38[_0x896d('0x55')]['channel'],_0x267a38[_0x896d('0x55')][_0x896d('0x3b')]);return db['ZohoConfiguration'][_0x896d('0x54')](_0x267a38[_0x896d('0x55')],{'include':[{'model':db[_0x896d('0x5e')],'as':'Subjects'},{'model':db[_0x896d('0x5e')],'as':'Descriptions'}]});}return null;})[_0x896d('0x1f')](respondWithResult(_0x591f4a,null))[_0x896d('0x28')](handleError(_0x591f4a,null));};function getAccessToken(_0x98243d){return new Promise(function(_0x5d356a,_0x523d97){var _0x446786;switch(_0x98243d[_0x896d('0x5f')]){case'US':_0x446786=_0x896d('0x60');break;case'AU':_0x446786=_0x896d('0x61');break;case'EU':_0x446786=_0x896d('0x62');break;case'IN':_0x446786=_0x896d('0x63');break;case'CN':_0x446786='https://accounts.zoho.com.cn';break;default:_0x446786=_0x896d('0x62');break;}var _0x39ee9c={'method':_0x896d('0x64'),'uri':_0x446786+'/oauth/v2/token','qs':{'refresh_token':_0x98243d[_0x896d('0x65')],'client_id':_0x98243d[_0x896d('0x66')],'client_secret':_0x98243d[_0x896d('0x67')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x39ee9c)[_0x896d('0x1f')](function(_0x12cbb5){if(_0x12cbb5[_0x896d('0x68')]){_0x5d356a(_0x12cbb5[_0x896d('0x68')]);}else{_0x523d97(_0x896d('0x69'));}})[_0x896d('0x28')](function(_0x37951c){_0x523d97(_0x37951c);});});}exports['getFields']=function(_0x2ee2ea,_0x2e448a,_0x14a3e8){var _0x37b0d7,_0x3d8530,_0x17dfde,_0x3eaf47,_0x276542;return db[_0x896d('0x39')][_0x896d('0x57')]({'where':{'id':_0x2ee2ea['params']['id']},'attributes':['id',_0x896d('0x6a'),'zone',_0x896d('0x66'),'clientSecret',_0x896d('0x6b'),_0x896d('0x6c'),_0x896d('0x65')]})['then'](handleEntityNotFound(_0x2e448a,null))[_0x896d('0x1f')](function(_0x37c32a){_0x276542=_0x37c32a;_0x37b0d7=_0x276542['host'];_0x3d8530=_0x37b0d7==='zoho.eu'?'eu':_0x896d('0x6d');_0x17dfde=_0x276542[_0x896d('0x6b')];var _0x2aa49c=_0x17dfde[_0x896d('0x6e')](-0x1);if(_0x2aa49c==='/'||_0x2aa49c==='\x5c'||_0x2aa49c===':'){_0x17dfde=_0x17dfde[_0x896d('0x6f')](0x0,_0x17dfde[_0x896d('0x70')](_0x2aa49c));}if(!_0x276542[_0x896d('0x65')]){throw new Error(_0x896d('0x71'));}return getAccessToken(_0x276542);})[_0x896d('0x1f')](function(_0x13b825){if(_0x13b825){return rp({'method':_0x896d('0x72'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3d8530),'qs':{'module':_0x896d('0x73')},'headers':{'Authorization':_0x896d('0x74')+_0x13b825},'json':!![]});}})['then'](function(_0x484499){if(_0x484499){if(_0x484499['response']&&_0x484499['response'][_0x896d('0x25')]){throw new Error(_0x484499['response'][_0x896d('0x25')][_0x896d('0x26')]);}var _0x387353=[];var _0x521432=[];var _0xe15c3=[_0x896d('0x75'),_0x896d('0x76'),_0x896d('0x77'),_0x896d('0x78'),_0x896d('0x79'),_0x896d('0x7a'),_0x896d('0x7b'),_0x896d('0x7c')];_0x521432=_[_0x896d('0x7d')](_0x484499[_0x896d('0x42')],function(_0x555714){return _0xe15c3['includes'](_0x555714[_0x896d('0x7e')]);});for(var _0x4a2ea7=0x0;_0x4a2ea7<_0x521432['length'];_0x4a2ea7++){if(_0x521432[_0x4a2ea7][_0x896d('0x7f')]===![]){_0x387353['push']({'id':_0x521432[_0x4a2ea7]['id'],'name':_0x521432[_0x4a2ea7][_0x896d('0x80')],'custom':_0x521432[_0x4a2ea7][_0x896d('0x81')],'options':_0x521432[_0x4a2ea7][_0x896d('0x82')]===_0x896d('0x83')&&_0x521432[_0x4a2ea7][_0x896d('0x84')][_0x896d('0x43')]>-0x1?_['map'](_0x521432[_0x4a2ea7][_0x896d('0x84')],function(_0x5dcaeb){return{'name':_0x5dcaeb,'value':_0x5dcaeb};}):[]});}}return{'count':_0x387353[_0x896d('0x43')],'rows':_0x387353};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2e448a,null))[_0x896d('0x28')](function(_0x9e8272){var _0x35ac0b=_0x2ee2ea['query']['test']?0x1f4:_0x9e8272[_0x896d('0x85')]||0x1f4;logger[_0x896d('0x25')](_0x896d('0x86'),_0x896d('0x87'),_0x35ac0b,JSON[_0x896d('0x88')](_0x9e8272));delete _0x9e8272[_0x896d('0x36')];if(_0x35ac0b===0x191){_0x35ac0b=0x190;}_0x2e448a[_0x896d('0x2a')](_0x35ac0b)[_0x896d('0x37')](_0x2ee2ea['query'][_0x896d('0x89')]?{'message':_0x896d('0x8a'),'statusCode':_0x9e8272[_0x896d('0x85')]}:_0x9e8272);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 19119ce..4c43a6f 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 _0x7a25=['error','inspect','https://accounts.zoho.com.cn','then','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch'];(function(_0x5369cf,_0x13f61d){var _0x4f0ce0=function(_0x109fa1){while(--_0x109fa1){_0x5369cf['push'](_0x5369cf['shift']());}};_0x4f0ce0(++_0x13f61d);}(_0x7a25,0xe7));var _0x57a2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7a25[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x57a2('0x0'));var util=require(_0x57a2('0x1'));var logger=require(_0x57a2('0x2'))(_0x57a2('0x3'));var moment=require(_0x57a2('0x4'));var BPromise=require(_0x57a2('0x5'));var rp=require(_0x57a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57a2('0x7'));var config=require('../../config/environment');var attributes=require(_0x57a2('0x8'));var integrations=require(_0x57a2('0x9'));module[_0x57a2('0xa')]=function(_0x244225,_0x308929){return _0x244225[_0x57a2('0xb')](_0x57a2('0xc'),attributes,{'tableName':_0x57a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xae36f0,_0x2b2077,_0x26e092){if(_0xae36f0['changed'](_0x57a2('0xe'))||_0xae36f0[_0x57a2('0xf')](_0x57a2('0x10'))||_0xae36f0[_0x57a2('0xf')](_0x57a2('0x11'))||_0xae36f0[_0x57a2('0xf')]('clientSecret')||_0xae36f0[_0x57a2('0xf')](_0x57a2('0x12'))||_0xae36f0[_0x57a2('0xf')](_0x57a2('0x13'))){var _0x5377f7,_0x985d5a;_0x5377f7=_0xae36f0[_0x57a2('0x10')];var _0x3fde34=_0x5377f7[_0x57a2('0x14')](-0x1);if(_0x3fde34==='/'||_0x3fde34==='\x5c'||_0x3fde34===':'){_0x5377f7=_0x5377f7[_0x57a2('0x15')](0x0,_0x5377f7[_0x57a2('0x16')](_0x3fde34));}switch(_0xae36f0[_0x57a2('0xe')]){case'US':_0x985d5a=_0x57a2('0x17');break;case'AU':_0x985d5a=_0x57a2('0x18');break;case'IN':_0x985d5a=_0x57a2('0x19');break;case'CN':_0x985d5a='https://accounts.zoho.com.cn';break;default:_0x985d5a=_0x57a2('0x1a');break;}var _0x47489c={'method':_0x57a2('0x1b'),'uri':_0x985d5a+_0x57a2('0x1c'),'form':{'grant_type':_0x57a2('0x1d'),'client_id':_0xae36f0[_0x57a2('0x11')],'client_secret':_0xae36f0[_0x57a2('0x1e')],'redirect_uri':_0xae36f0[_0x57a2('0x10')],'code':_0xae36f0['code']},'headers':{'Content-Type':_0x57a2('0x1f')}};return rp(_0x47489c)['then'](function(_0x39c5fa){var _0x16c9c3=JSON['parse'](_0x39c5fa);if(_0x16c9c3[_0x57a2('0x20')]){_0xae36f0[_0x57a2('0x21')]=_0x16c9c3['refresh_token'];logger[_0x57a2('0x22')](util[_0x57a2('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xae36f0['name'],_0xae36f0['id']));}else{logger['error'](util['format'](_0x57a2('0x24'),_0xae36f0[_0x57a2('0x25')],_0xae36f0['id']),util['inspect'](_0x16c9c3,{'showHidden':![],'depth':null}));}return _0x26e092(null,_0x2b2077);})[_0x57a2('0x26')](function(_0x395fa6){logger[_0x57a2('0x27')](util[_0x57a2('0x23')](_0x57a2('0x24'),_0xae36f0[_0x57a2('0x25')],_0xae36f0['id']),util[_0x57a2('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x26e092(_0x395fa6);});}else{return _0x26e092(null,_0x2b2077);}},'beforeUpdate':function(_0x1d3fd3,_0xb85e12,_0x18717b){if(_0x1d3fd3[_0x57a2('0xf')](_0x57a2('0xe'))||_0x1d3fd3[_0x57a2('0xf')](_0x57a2('0x10'))||_0x1d3fd3['changed'](_0x57a2('0x11'))||_0x1d3fd3['changed'](_0x57a2('0x1e'))||_0x1d3fd3[_0x57a2('0xf')](_0x57a2('0x12'))||_0x1d3fd3[_0x57a2('0xf')](_0x57a2('0x13'))){var _0x39e59a,_0xc75401;_0x39e59a=_0x1d3fd3[_0x57a2('0x10')];var _0x220b73=_0x39e59a[_0x57a2('0x14')](-0x1);if(_0x220b73==='/'||_0x220b73==='\x5c'||_0x220b73===':'){_0x39e59a=_0x39e59a['substring'](0x0,_0x39e59a[_0x57a2('0x16')](_0x220b73));}switch(_0x1d3fd3[_0x57a2('0xe')]){case'US':_0xc75401=_0x57a2('0x17');break;case'AU':_0xc75401=_0x57a2('0x18');break;case'IN':_0xc75401=_0x57a2('0x19');break;case'CN':_0xc75401=_0x57a2('0x29');break;default:_0xc75401=_0x57a2('0x1a');break;}var _0x4934f3={'method':_0x57a2('0x1b'),'uri':_0xc75401+_0x57a2('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x1d3fd3[_0x57a2('0x11')],'client_secret':_0x1d3fd3['clientSecret'],'redirect_uri':_0x1d3fd3[_0x57a2('0x10')],'code':_0x1d3fd3['code']},'headers':{'Content-Type':_0x57a2('0x1f')}};return rp(_0x4934f3)[_0x57a2('0x2a')](function(_0x30bf80){var _0x2bb46c=JSON[_0x57a2('0x2b')](_0x30bf80);if(_0x2bb46c['refresh_token']){_0x1d3fd3[_0x57a2('0x21')]=_0x2bb46c['refresh_token'];logger[_0x57a2('0x22')](util[_0x57a2('0x23')](_0x57a2('0x2c'),_0x1d3fd3[_0x57a2('0x25')],_0x1d3fd3['id']));}else{logger[_0x57a2('0x27')](util[_0x57a2('0x23')](_0x57a2('0x24'),_0x1d3fd3[_0x57a2('0x25')],_0x1d3fd3['id']),util[_0x57a2('0x28')](_0x2bb46c,{'showHidden':![],'depth':null}));}return _0x18717b(null,_0xb85e12);})[_0x57a2('0x26')](function(_0x465fe2){logger[_0x57a2('0x27')](util[_0x57a2('0x23')](_0x57a2('0x24'),_0x1d3fd3[_0x57a2('0x25')],_0x1d3fd3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x18717b(_0x465fe2);});}else{return _0x18717b(null,_0xb85e12);}}}});}; \ No newline at end of file +var _0xd632=['catch','zone','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com.cn','parse','refreshToken','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','define','int_zoho_accounts','changed','serverUrl','clientId','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','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'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0xd632,0x100));var _0x2d63=function(_0x2250da,_0xdb9fe6){_0x2250da=_0x2250da-0x0;var _0x573dc5=_0xd632[_0x2250da];return _0x573dc5;};'use strict';var _=require(_0x2d63('0x0'));var util=require('util');var logger=require(_0x2d63('0x1'))(_0x2d63('0x2'));var moment=require(_0x2d63('0x3'));var BPromise=require(_0x2d63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d63('0x5'));var config=require(_0x2d63('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x2d63('0x7'));module['exports']=function(_0x4a8988,_0x171ce0){return _0x4a8988[_0x2d63('0x8')]('ZohoAccount',attributes,{'tableName':_0x2d63('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4cacbb,_0x242b59,_0x4a388a){if(_0x4cacbb['changed']('zone')||_0x4cacbb[_0x2d63('0xa')](_0x2d63('0xb'))||_0x4cacbb['changed'](_0x2d63('0xc'))||_0x4cacbb[_0x2d63('0xa')]('clientSecret')||_0x4cacbb[_0x2d63('0xa')]('code')||_0x4cacbb['changed']('host')){var _0x312ad3,_0xe7a0e2;_0x312ad3=_0x4cacbb[_0x2d63('0xb')];var _0x2da979=_0x312ad3['slice'](-0x1);if(_0x2da979==='/'||_0x2da979==='\x5c'||_0x2da979===':'){_0x312ad3=_0x312ad3[_0x2d63('0xd')](0x0,_0x312ad3['lastIndexOf'](_0x2da979));}switch(_0x4cacbb['zone']){case'US':_0xe7a0e2=_0x2d63('0xe');break;case'AU':_0xe7a0e2=_0x2d63('0xf');break;case'IN':_0xe7a0e2=_0x2d63('0x10');break;case'CN':_0xe7a0e2='https://accounts.zoho.com.cn';break;default:_0xe7a0e2=_0x2d63('0x11');break;}var _0x2c9c65={'method':_0x2d63('0x12'),'uri':_0xe7a0e2+_0x2d63('0x13'),'form':{'grant_type':_0x2d63('0x14'),'client_id':_0x4cacbb[_0x2d63('0xc')],'client_secret':_0x4cacbb['clientSecret'],'redirect_uri':_0x4cacbb[_0x2d63('0xb')],'code':_0x4cacbb['code']},'headers':{'Content-Type':_0x2d63('0x15')}};return rp(_0x2c9c65)[_0x2d63('0x16')](function(_0x18519f){var _0x1e9ef2=JSON['parse'](_0x18519f);if(_0x1e9ef2[_0x2d63('0x17')]){_0x4cacbb['refreshToken']=_0x1e9ef2[_0x2d63('0x17')];logger[_0x2d63('0x18')](util[_0x2d63('0x19')](_0x2d63('0x1a'),_0x4cacbb[_0x2d63('0x1b')],_0x4cacbb['id']));}else{logger[_0x2d63('0x1c')](util[_0x2d63('0x19')](_0x2d63('0x1d'),_0x4cacbb[_0x2d63('0x1b')],_0x4cacbb['id']),util[_0x2d63('0x1e')](_0x1e9ef2,{'showHidden':![],'depth':null}));}return _0x4a388a(null,_0x242b59);})[_0x2d63('0x1f')](function(_0x1636c3){logger[_0x2d63('0x1c')](util[_0x2d63('0x19')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4cacbb[_0x2d63('0x1b')],_0x4cacbb['id']),util[_0x2d63('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a388a(_0x1636c3);});}else{return _0x4a388a(null,_0x242b59);}},'beforeUpdate':function(_0x3757d1,_0x1ffb85,_0xc16943){if(_0x3757d1[_0x2d63('0xa')](_0x2d63('0x20'))||_0x3757d1[_0x2d63('0xa')]('serverUrl')||_0x3757d1[_0x2d63('0xa')](_0x2d63('0xc'))||_0x3757d1['changed'](_0x2d63('0x21'))||_0x3757d1['changed'](_0x2d63('0x22'))||_0x3757d1[_0x2d63('0xa')](_0x2d63('0x23'))){var _0x1d065e,_0x4aa206;_0x1d065e=_0x3757d1['serverUrl'];var _0x22f96f=_0x1d065e[_0x2d63('0x24')](-0x1);if(_0x22f96f==='/'||_0x22f96f==='\x5c'||_0x22f96f===':'){_0x1d065e=_0x1d065e['substring'](0x0,_0x1d065e[_0x2d63('0x25')](_0x22f96f));}switch(_0x3757d1['zone']){case'US':_0x4aa206=_0x2d63('0xe');break;case'AU':_0x4aa206=_0x2d63('0xf');break;case'IN':_0x4aa206=_0x2d63('0x10');break;case'CN':_0x4aa206=_0x2d63('0x26');break;default:_0x4aa206=_0x2d63('0x11');break;}var _0x568fcc={'method':'POST','uri':_0x4aa206+_0x2d63('0x13'),'form':{'grant_type':'authorization_code','client_id':_0x3757d1[_0x2d63('0xc')],'client_secret':_0x3757d1[_0x2d63('0x21')],'redirect_uri':_0x3757d1[_0x2d63('0xb')],'code':_0x3757d1[_0x2d63('0x22')]},'headers':{'Content-Type':_0x2d63('0x15')}};return rp(_0x568fcc)[_0x2d63('0x16')](function(_0x39cee2){var _0x245da6=JSON[_0x2d63('0x27')](_0x39cee2);if(_0x245da6[_0x2d63('0x17')]){_0x3757d1[_0x2d63('0x28')]=_0x245da6[_0x2d63('0x17')];logger[_0x2d63('0x18')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3757d1[_0x2d63('0x1b')],_0x3757d1['id']));}else{logger[_0x2d63('0x1c')](util[_0x2d63('0x19')](_0x2d63('0x1d'),_0x3757d1['name'],_0x3757d1['id']),util[_0x2d63('0x1e')](_0x245da6,{'showHidden':![],'depth':null}));}return _0xc16943(null,_0x1ffb85);})['catch'](function(_0x23103d){logger[_0x2d63('0x1c')](util['format'](_0x2d63('0x1d'),_0x3757d1[_0x2d63('0x1b')],_0x3757d1['id']),util[_0x2d63('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0xc16943(_0x23103d);});}else{return _0xc16943(null,_0x1ffb85);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index d97460d..970b7ef 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 _0x70d7=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','ZohoAccount','findAll','options','limit','include','attributes','map','model','then','ShowZohoAccount','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e1826,_0x22d466){var _0x1b7396=function(_0x4498e9){while(--_0x4498e9){_0x4e1826['push'](_0x4e1826['shift']());}};_0x1b7396(++_0x22d466);}(_0x70d7,0x1ee));var _0x770d=function(_0xfd80d5,_0x303f80){_0xfd80d5=_0xfd80d5-0x0;var _0xeb957d=_0x70d7[_0xfd80d5];return _0xeb957d;};'use strict';var _=require(_0x770d('0x0'));var util=require(_0x770d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x770d('0x2'));var fs=require('fs');var Redis=require(_0x770d('0x3'));var db=require(_0x770d('0x4'))['db'];var utils=require(_0x770d('0x5'));var logger=require(_0x770d('0x6'))(_0x770d('0x7'));var config=require('../../config/environment');var jayson=require(_0x770d('0x8'));var client=jayson[_0x770d('0x9')][_0x770d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3e613,_0x2d81c5,_0x172189){return new BPromise(function(_0x407209,_0x29bf29){return client[_0x770d('0xb')](_0xd3e613,_0x172189)['then'](function(_0x36ea81){logger[_0x770d('0xc')](_0x770d('0xd'),_0x2d81c5,_0x770d('0xe'));logger[_0x770d('0xf')](_0x770d('0x10'),_0x2d81c5,'request\x20sent',JSON[_0x770d('0x11')](_0x36ea81));if(_0x36ea81['error']){if(_0x36ea81['error']['code']===0x1f4){logger[_0x770d('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2d81c5,_0x36ea81['error'][_0x770d('0x13')]);return _0x29bf29(_0x36ea81[_0x770d('0x12')][_0x770d('0x13')]);}logger[_0x770d('0x12')](_0x770d('0xd'),_0x2d81c5,_0x36ea81[_0x770d('0x12')][_0x770d('0x13')]);return _0x407209(_0x36ea81['error']['message']);}else{logger[_0x770d('0xc')](_0x770d('0xd'),_0x2d81c5,_0x770d('0xe'));_0x407209(_0x36ea81['result'][_0x770d('0x13')]);}})[_0x770d('0x14')](function(_0x542d52){logger['error'](_0x770d('0xd'),_0x2d81c5,_0x542d52);_0x29bf29(_0x542d52);});});}exports[_0x770d('0x15')]=function(_0x25ec70){var _0x23d608=this;return new Promise(function(_0x49d0b8,_0x561f99){return db[_0x770d('0x16')][_0x770d('0x17')]({'raw':_0x25ec70['options']?_0x25ec70[_0x770d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x25ec70[_0x770d('0x18')]?_0x25ec70['options']['where']||null:null,'attributes':_0x25ec70[_0x770d('0x18')]?_0x25ec70['options']['attributes']||null:null,'limit':_0x25ec70[_0x770d('0x18')]?_0x25ec70[_0x770d('0x18')][_0x770d('0x19')]||null:null,'include':_0x25ec70[_0x770d('0x18')]?_0x25ec70[_0x770d('0x18')][_0x770d('0x1a')]?_['map'](_0x25ec70[_0x770d('0x18')][_0x770d('0x1a')],function(_0xf55aca){return{'model':db[_0xf55aca['model']],'as':_0xf55aca['as'],'attributes':_0xf55aca[_0x770d('0x1b')],'include':_0xf55aca[_0x770d('0x1a')]?_[_0x770d('0x1c')](_0xf55aca['include'],function(_0x18430f){return{'model':db[_0x18430f[_0x770d('0x1d')]],'as':_0x18430f['as'],'attributes':_0x18430f[_0x770d('0x1b')],'include':_0x18430f['include']?_[_0x770d('0x1c')](_0x18430f['include'],function(_0x37db35){return{'model':db[_0x37db35['model']],'as':_0x37db35['as'],'attributes':_0x37db35[_0x770d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x770d('0x1e')](function(_0x5cec41){logger[_0x770d('0xc')]('GetZohoAccount',_0x25ec70);logger[_0x770d('0xf')](_0x770d('0x15'),_0x25ec70,JSON[_0x770d('0x11')](_0x5cec41));_0x49d0b8(_0x5cec41);})['catch'](function(_0x3753ac){logger['error']('GetZohoAccount',_0x3753ac[_0x770d('0x13')],_0x25ec70);_0x561f99(_0x23d608[_0x770d('0x12')](0x1f4,_0x3753ac[_0x770d('0x13')]));});});};exports[_0x770d('0x1f')]=function(_0x994434){var _0x1cfee9=this;return new Promise(function(_0x46e5f4,_0x2ed893){return db[_0x770d('0x16')][_0x770d('0x20')]({'raw':_0x994434[_0x770d('0x18')]?_0x994434[_0x770d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x994434[_0x770d('0x18')]?_0x994434[_0x770d('0x18')][_0x770d('0x21')]||null:null,'attributes':_0x994434[_0x770d('0x18')]?_0x994434[_0x770d('0x18')][_0x770d('0x1b')]||null:null,'include':_0x994434['options']?_0x994434[_0x770d('0x18')][_0x770d('0x1a')]?_[_0x770d('0x1c')](_0x994434[_0x770d('0x18')][_0x770d('0x1a')],function(_0x27d318){return{'model':db[_0x27d318[_0x770d('0x1d')]],'as':_0x27d318['as'],'attributes':_0x27d318[_0x770d('0x1b')],'include':_0x27d318['include']?_[_0x770d('0x1c')](_0x27d318[_0x770d('0x1a')],function(_0xc1e9e6){return{'model':db[_0xc1e9e6[_0x770d('0x1d')]],'as':_0xc1e9e6['as'],'attributes':_0xc1e9e6[_0x770d('0x1b')],'include':_0xc1e9e6[_0x770d('0x1a')]?_[_0x770d('0x1c')](_0xc1e9e6[_0x770d('0x1a')],function(_0x407a48){return{'model':db[_0x407a48[_0x770d('0x1d')]],'as':_0x407a48['as'],'attributes':_0x407a48[_0x770d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x770d('0x1e')](function(_0x108e03){logger[_0x770d('0xc')](_0x770d('0x1f'),_0x994434);logger['debug']('ShowZohoAccount',_0x994434,JSON[_0x770d('0x11')](_0x108e03));_0x46e5f4(_0x108e03);})[_0x770d('0x14')](function(_0x1aadda){logger[_0x770d('0x12')](_0x770d('0x1f'),_0x1aadda[_0x770d('0x13')],_0x994434);_0x2ed893(_0x1cfee9[_0x770d('0x12')](0x1f4,_0x1aadda[_0x770d('0x13')]));});});}; \ No newline at end of file +var _0x122c=['message','result','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowZohoAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x54691d,_0x391ae4){var _0x4636bd=function(_0x4972a7){while(--_0x4972a7){_0x54691d['push'](_0x54691d['shift']());}};_0x4636bd(++_0x391ae4);}(_0x122c,0x1dd));var _0xc122=function(_0x429230,_0xac45ff){_0x429230=_0x429230-0x0;var _0x20a2a3=_0x122c[_0x429230];return _0x20a2a3;};'use strict';var _=require(_0xc122('0x0'));var util=require(_0xc122('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc122('0x2'));var fs=require('fs');var Redis=require(_0xc122('0x3'));var db=require(_0xc122('0x4'))['db'];var utils=require(_0xc122('0x5'));var logger=require('../../config/logger')(_0xc122('0x6'));var config=require(_0xc122('0x7'));var jayson=require(_0xc122('0x8'));var client=jayson[_0xc122('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fc76e,_0x14a235,_0x4ebb91){return new BPromise(function(_0x3ca19d,_0x3d440c){return client[_0xc122('0xa')](_0x2fc76e,_0x4ebb91)[_0xc122('0xb')](function(_0x5ebf6a){logger[_0xc122('0xc')](_0xc122('0xd'),_0x14a235,'request\x20sent');logger[_0xc122('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x14a235,_0xc122('0xf'),JSON['stringify'](_0x5ebf6a));if(_0x5ebf6a[_0xc122('0x10')]){if(_0x5ebf6a['error'][_0xc122('0x11')]===0x1f4){logger[_0xc122('0x10')](_0xc122('0xd'),_0x14a235,_0x5ebf6a[_0xc122('0x10')][_0xc122('0x12')]);return _0x3d440c(_0x5ebf6a['error'][_0xc122('0x12')]);}logger[_0xc122('0x10')](_0xc122('0xd'),_0x14a235,_0x5ebf6a[_0xc122('0x10')]['message']);return _0x3ca19d(_0x5ebf6a[_0xc122('0x10')][_0xc122('0x12')]);}else{logger[_0xc122('0xc')](_0xc122('0xd'),_0x14a235,'request\x20sent');_0x3ca19d(_0x5ebf6a[_0xc122('0x13')][_0xc122('0x12')]);}})['catch'](function(_0xade2cb){logger[_0xc122('0x10')](_0xc122('0xd'),_0x14a235,_0xade2cb);_0x3d440c(_0xade2cb);});});}exports[_0xc122('0x14')]=function(_0x31a98e){var _0x16f994=this;return new Promise(function(_0x2d994c,_0x47c82b){return db[_0xc122('0x15')]['findAll']({'raw':_0x31a98e['options']?_0x31a98e[_0xc122('0x16')][_0xc122('0x17')]===undefined?!![]:![]:!![],'where':_0x31a98e[_0xc122('0x16')]?_0x31a98e[_0xc122('0x16')][_0xc122('0x18')]||null:null,'attributes':_0x31a98e['options']?_0x31a98e[_0xc122('0x16')][_0xc122('0x19')]||null:null,'limit':_0x31a98e['options']?_0x31a98e[_0xc122('0x16')][_0xc122('0x1a')]||null:null,'include':_0x31a98e[_0xc122('0x16')]?_0x31a98e[_0xc122('0x16')][_0xc122('0x1b')]?_[_0xc122('0x1c')](_0x31a98e['options']['include'],function(_0x1bb363){return{'model':db[_0x1bb363['model']],'as':_0x1bb363['as'],'attributes':_0x1bb363[_0xc122('0x19')],'include':_0x1bb363[_0xc122('0x1b')]?_['map'](_0x1bb363[_0xc122('0x1b')],function(_0x5437b0){return{'model':db[_0x5437b0[_0xc122('0x1d')]],'as':_0x5437b0['as'],'attributes':_0x5437b0[_0xc122('0x19')],'include':_0x5437b0['include']?_[_0xc122('0x1c')](_0x5437b0[_0xc122('0x1b')],function(_0x512019){return{'model':db[_0x512019[_0xc122('0x1d')]],'as':_0x512019['as'],'attributes':_0x512019['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47202e){logger['info']('GetZohoAccount',_0x31a98e);logger['debug'](_0xc122('0x14'),_0x31a98e,JSON['stringify'](_0x47202e));_0x2d994c(_0x47202e);})[_0xc122('0x1e')](function(_0x469a1f){logger[_0xc122('0x10')]('GetZohoAccount',_0x469a1f[_0xc122('0x12')],_0x31a98e);_0x47c82b(_0x16f994[_0xc122('0x10')](0x1f4,_0x469a1f[_0xc122('0x12')]));});});};exports[_0xc122('0x1f')]=function(_0x5a9b12){var _0x336237=this;return new Promise(function(_0x1896be,_0x4882a1){return db[_0xc122('0x15')]['find']({'raw':_0x5a9b12[_0xc122('0x16')]?_0x5a9b12['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a9b12['options']?_0x5a9b12[_0xc122('0x16')][_0xc122('0x18')]||null:null,'attributes':_0x5a9b12[_0xc122('0x16')]?_0x5a9b12[_0xc122('0x16')]['attributes']||null:null,'include':_0x5a9b12[_0xc122('0x16')]?_0x5a9b12[_0xc122('0x16')][_0xc122('0x1b')]?_[_0xc122('0x1c')](_0x5a9b12[_0xc122('0x16')][_0xc122('0x1b')],function(_0x4ee2d7){return{'model':db[_0x4ee2d7['model']],'as':_0x4ee2d7['as'],'attributes':_0x4ee2d7[_0xc122('0x19')],'include':_0x4ee2d7[_0xc122('0x1b')]?_[_0xc122('0x1c')](_0x4ee2d7[_0xc122('0x1b')],function(_0x11add1){return{'model':db[_0x11add1[_0xc122('0x1d')]],'as':_0x11add1['as'],'attributes':_0x11add1[_0xc122('0x19')],'include':_0x11add1[_0xc122('0x1b')]?_[_0xc122('0x1c')](_0x11add1['include'],function(_0xd3c271){return{'model':db[_0xd3c271['model']],'as':_0xd3c271['as'],'attributes':_0xd3c271['attributes']};}):[]};}):[]};}):[]:[]})[_0xc122('0xb')](function(_0x1f1266){logger[_0xc122('0xc')](_0xc122('0x1f'),_0x5a9b12);logger[_0xc122('0xe')](_0xc122('0x1f'),_0x5a9b12,JSON[_0xc122('0x20')](_0x1f1266));_0x1896be(_0x1f1266);})['catch'](function(_0x54dade){logger[_0xc122('0x10')](_0xc122('0x1f'),_0x54dade[_0xc122('0x12')],_0x5a9b12);_0x4882a1(_0x336237[_0xc122('0x10')](0x1f4,_0x54dade[_0xc122('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fb82f4a..ef016ae 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 _0x132f=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update'];(function(_0x33ebbc,_0x2edf62){var _0x1f93ec=function(_0x58f482){while(--_0x58f482){_0x33ebbc['push'](_0x33ebbc['shift']());}};_0x1f93ec(++_0x2edf62);}(_0x132f,0x182));var _0xf132=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x132f[_0x5a27e8];return _0x4e38f7;};'use strict';var multer=require(_0xf132('0x0'));var util=require(_0xf132('0x1'));var path=require(_0xf132('0x2'));var timeout=require(_0xf132('0x3'));var express=require(_0xf132('0x4'));var router=express[_0xf132('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf132('0x6'));var config=require(_0xf132('0x7'));var controller=require(_0xf132('0x8'));router[_0xf132('0x9')]('/',auth[_0xf132('0xa')](),controller['index']);router[_0xf132('0x9')](_0xf132('0xb'),auth['isAuthenticated'](),controller[_0xf132('0xc')]);router['get'](_0xf132('0xd'),auth[_0xf132('0xa')](),controller[_0xf132('0xe')]);router[_0xf132('0x9')](_0xf132('0xf'),auth[_0xf132('0xa')](),controller[_0xf132('0x10')]);router['get']('/:id/descriptions',auth[_0xf132('0xa')](),controller[_0xf132('0x11')]);router[_0xf132('0x12')]('/',auth[_0xf132('0xa')](),controller[_0xf132('0x13')]);router[_0xf132('0x14')](_0xf132('0xb'),auth[_0xf132('0xa')](),controller[_0xf132('0x15')]);router[_0xf132('0x16')](_0xf132('0xb'),auth[_0xf132('0xa')](),controller['destroy']);module[_0xf132('0x17')]=router; \ No newline at end of file +var _0xe1aa=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','/:id','update','delete','destroy'];(function(_0x1d8d25,_0x242388){var _0x123ae7=function(_0x1872cd){while(--_0x1872cd){_0x1d8d25['push'](_0x1d8d25['shift']());}};_0x123ae7(++_0x242388);}(_0xe1aa,0xfc));var _0xae1a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe1aa[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae1a('0x2'));var router=express[_0xae1a('0x3')]();var auth=require(_0xae1a('0x4'));var interaction=require(_0xae1a('0x5'));var config=require(_0xae1a('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xae1a('0x7')]('/',auth['isAuthenticated'](),controller[_0xae1a('0x8')]);router[_0xae1a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xae1a('0x9')]);router[_0xae1a('0x7')]('/:id/fields',auth[_0xae1a('0xa')](),controller[_0xae1a('0xb')]);router['get'](_0xae1a('0xc'),auth[_0xae1a('0xa')](),controller[_0xae1a('0xd')]);router[_0xae1a('0x7')]('/:id/descriptions',auth[_0xae1a('0xa')](),controller[_0xae1a('0xe')]);router['post']('/',auth[_0xae1a('0xa')](),controller[_0xae1a('0xf')]);router[_0xae1a('0x10')](_0xae1a('0x11'),auth[_0xae1a('0xa')](),controller[_0xae1a('0x12')]);router[_0xae1a('0x13')](_0xae1a('0x11'),auth[_0xae1a('0xa')](),controller[_0xae1a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 1d6a627..24a7fc9 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 _0x7814=['exports','STRING','ENUM','lead','nothing','contact_lead','contact','sequelize'];(function(_0x932429,_0x29c5d5){var _0x375a74=function(_0x2ecf62){while(--_0x2ecf62){_0x932429['push'](_0x932429['shift']());}};_0x375a74(++_0x29c5d5);}(_0x7814,0x107));var _0x4781=function(_0x5e40e2,_0x3e9a64){_0x5e40e2=_0x5e40e2-0x0;var _0x569f8b=_0x7814[_0x5e40e2];return _0x569f8b;};'use strict';var Sequelize=require(_0x4781('0x0'));module[_0x4781('0x1')]={'name':{'type':Sequelize[_0x4781('0x2')]},'moduleCreate':{'type':Sequelize[_0x4781('0x3')](_0x4781('0x4'),'contact',_0x4781('0x5')),'defaultValue':_0x4781('0x4')},'moduleSearch':{'type':Sequelize[_0x4781('0x3')](_0x4781('0x6'),_0x4781('0x7'),_0x4781('0x4')),'defaultValue':_0x4781('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe6d0=['sequelize','exports','STRING','ENUM','lead','contact','contact_lead'];(function(_0x13ce6d,_0x5984bf){var _0x397a06=function(_0x57c4bf){while(--_0x57c4bf){_0x13ce6d['push'](_0x13ce6d['shift']());}};_0x397a06(++_0x5984bf);}(_0xe6d0,0x1ea));var _0x0e6d=function(_0x266742,_0x425689){_0x266742=_0x266742-0x0;var _0x30a923=_0xe6d0[_0x266742];return _0x30a923;};'use strict';var Sequelize=require(_0x0e6d('0x0'));module[_0x0e6d('0x1')]={'name':{'type':Sequelize[_0x0e6d('0x2')]},'moduleCreate':{'type':Sequelize[_0x0e6d('0x3')](_0x0e6d('0x4'),_0x0e6d('0x5'),'nothing'),'defaultValue':_0x0e6d('0x4')},'moduleSearch':{'type':Sequelize[_0x0e6d('0x3')](_0x0e6d('0x6'),_0x0e6d('0x5'),_0x0e6d('0x4')),'defaultValue':_0x0e6d('0x6')},'description':{'type':Sequelize[_0x0e6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 084095f..4735084 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 _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 615c298..938dae9 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 _0x3775=['api','moment','bluebird','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x4d1bba,_0x398d69){var _0x37e3a3=function(_0x4b6cb2){while(--_0x4b6cb2){_0x4d1bba['push'](_0x4d1bba['shift']());}};_0x37e3a3(++_0x398d69);}(_0x3775,0x1b7));var _0x5377=function(_0x21535f,_0x411810){_0x21535f=_0x21535f-0x0;var _0x55076c=_0x3775[_0x21535f];return _0x55076c;};'use strict';var _=require(_0x5377('0x0'));var util=require(_0x5377('0x1'));var logger=require(_0x5377('0x2'))(_0x5377('0x3'));var moment=require(_0x5377('0x4'));var BPromise=require(_0x5377('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5377('0x6'));var rimraf=require(_0x5377('0x7'));var config=require('../../config/environment');var attributes=require(_0x5377('0x8'));module[_0x5377('0x9')]=function(_0x2c446b,_0x4d268b){return _0x2c446b[_0x5377('0xa')](_0x5377('0xb'),attributes,{'tableName':_0x5377('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb907=['rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ff44c,_0x6347bb){var _0x358854=function(_0x2b25c4){while(--_0x2b25c4){_0x1ff44c['push'](_0x1ff44c['shift']());}};_0x358854(++_0x6347bb);}(_0xb907,0xca));var _0x7b90=function(_0xd8e4bb,_0x3154da){_0xd8e4bb=_0xd8e4bb-0x0;var _0x4ecc61=_0xb907[_0xd8e4bb];return _0x4ecc61;};'use strict';var _=require(_0x7b90('0x0'));var util=require(_0x7b90('0x1'));var logger=require(_0x7b90('0x2'))(_0x7b90('0x3'));var moment=require(_0x7b90('0x4'));var BPromise=require(_0x7b90('0x5'));var rp=require(_0x7b90('0x6'));var fs=require('fs');var path=require(_0x7b90('0x7'));var rimraf=require(_0x7b90('0x8'));var config=require('../../config/environment');var attributes=require(_0x7b90('0x9'));module[_0x7b90('0xa')]=function(_0xc66111,_0xf646fc){return _0xc66111[_0x7b90('0xb')](_0x7b90('0xc'),attributes,{'tableName':_0x7b90('0xd'),'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 416de9d..73bed25 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 _0x37dc=['ZohoConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5edcd8,_0xd8a6ca){var _0x2263cc=function(_0x17df45){while(--_0x17df45){_0x5edcd8['push'](_0x5edcd8['shift']());}};_0x2263cc(++_0xd8a6ca);}(_0x37dc,0x136));var _0xc37d=function(_0x4afee1,_0x590539){_0x4afee1=_0x4afee1-0x0;var _0x4a7087=_0x37dc[_0x4afee1];return _0x4a7087;};'use strict';var _=require(_0xc37d('0x0'));var util=require(_0xc37d('0x1'));var moment=require(_0xc37d('0x2'));var BPromise=require(_0xc37d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc37d('0x4'));var db=require(_0xc37d('0x5'))['db'];var utils=require(_0xc37d('0x6'));var logger=require(_0xc37d('0x7'))(_0xc37d('0x8'));var config=require(_0xc37d('0x9'));var jayson=require(_0xc37d('0xa'));var client=jayson[_0xc37d('0xb')][_0xc37d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x397f96,_0x15b8b8,_0x3926b7){return new BPromise(function(_0x1a290f,_0x2746e9){return client[_0xc37d('0xd')](_0x397f96,_0x3926b7)[_0xc37d('0xe')](function(_0x8d53d1){logger['info'](_0xc37d('0xf'),_0x15b8b8,'request\x20sent');logger[_0xc37d('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x15b8b8,'request\x20sent',JSON[_0xc37d('0x11')](_0x8d53d1));if(_0x8d53d1[_0xc37d('0x12')]){if(_0x8d53d1[_0xc37d('0x12')][_0xc37d('0x13')]===0x1f4){logger[_0xc37d('0x12')](_0xc37d('0xf'),_0x15b8b8,_0x8d53d1[_0xc37d('0x12')][_0xc37d('0x14')]);return _0x2746e9(_0x8d53d1[_0xc37d('0x12')][_0xc37d('0x14')]);}logger[_0xc37d('0x12')](_0xc37d('0xf'),_0x15b8b8,_0x8d53d1[_0xc37d('0x12')][_0xc37d('0x14')]);return _0x1a290f(_0x8d53d1[_0xc37d('0x12')]['message']);}else{logger[_0xc37d('0x15')](_0xc37d('0xf'),_0x15b8b8,_0xc37d('0x16'));_0x1a290f(_0x8d53d1[_0xc37d('0x17')]['message']);}})[_0xc37d('0x18')](function(_0x5208b0){logger[_0xc37d('0x12')](_0xc37d('0xf'),_0x15b8b8,_0x5208b0);_0x2746e9(_0x5208b0);});});} \ No newline at end of file +var _0xeff0=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2234bd,_0x259d9d){var _0x2aa4bd=function(_0x418403){while(--_0x418403){_0x2234bd['push'](_0x2234bd['shift']());}};_0x2aa4bd(++_0x259d9d);}(_0xeff0,0x164));var _0x0eff=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xeff0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0eff('0x0'));var util=require('util');var moment=require(_0x0eff('0x1'));var BPromise=require(_0x0eff('0x2'));var rs=require(_0x0eff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eff('0x4'))['db'];var utils=require(_0x0eff('0x5'));var logger=require(_0x0eff('0x6'))(_0x0eff('0x7'));var config=require(_0x0eff('0x8'));var jayson=require(_0x0eff('0x9'));var client=jayson['client'][_0x0eff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa9d345,_0x483a82,_0x53e974){return new BPromise(function(_0x7a02af,_0x2458e0){return client[_0x0eff('0xb')](_0xa9d345,_0x53e974)[_0x0eff('0xc')](function(_0x56f88d){logger[_0x0eff('0xd')](_0x0eff('0xe'),_0x483a82,'request\x20sent');logger[_0x0eff('0xf')](_0x0eff('0x10'),_0x483a82,_0x0eff('0x11'),JSON[_0x0eff('0x12')](_0x56f88d));if(_0x56f88d[_0x0eff('0x13')]){if(_0x56f88d[_0x0eff('0x13')]['code']===0x1f4){logger[_0x0eff('0x13')](_0x0eff('0xe'),_0x483a82,_0x56f88d['error'][_0x0eff('0x14')]);return _0x2458e0(_0x56f88d[_0x0eff('0x13')][_0x0eff('0x14')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x483a82,_0x56f88d['error'][_0x0eff('0x14')]);return _0x7a02af(_0x56f88d[_0x0eff('0x13')][_0x0eff('0x14')]);}else{logger[_0x0eff('0xd')](_0x0eff('0xe'),_0x483a82,'request\x20sent');_0x7a02af(_0x56f88d[_0x0eff('0x15')]['message']);}})['catch'](function(_0x127f91){logger[_0x0eff('0x13')](_0x0eff('0xe'),_0x483a82,_0x127f91);_0x2458e0(_0x127f91);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 702881c..580fd1b 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 _0x583c=['../../components/auth/service','./intZohoField.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x57aa2a,_0x4b7ed0){var _0x457f31=function(_0x472442){while(--_0x472442){_0x57aa2a['push'](_0x57aa2a['shift']());}};_0x457f31(++_0x4b7ed0);}(_0x583c,0x12b));var _0xc583=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x583c[_0x50a004];return _0x5e9992;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var auth=require(_0xc583('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc583('0x6'));router[_0xc583('0x7')]('/',auth['isAuthenticated'](),controller[_0xc583('0x8')]);router[_0xc583('0x7')](_0xc583('0x9'),auth[_0xc583('0xa')](),controller['show']);router[_0xc583('0xb')]('/',auth[_0xc583('0xa')](),controller['create']);router[_0xc583('0xc')](_0xc583('0x9'),auth[_0xc583('0xa')](),controller[_0xc583('0xd')]);router[_0xc583('0xe')]('/:id',auth[_0xc583('0xa')](),controller[_0xc583('0xf')]);module['exports']=router; \ No newline at end of file +var _0x47c5=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x47c5,0x165));var _0x547c=function(_0x28d71d,_0x3f8321){_0x28d71d=_0x28d71d-0x0;var _0x4c5c0e=_0x47c5[_0x28d71d];return _0x4c5c0e;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x547c('0x6'));var config=require(_0x547c('0x7'));var controller=require('./intZohoField.controller');router[_0x547c('0x8')]('/',auth[_0x547c('0x9')](),controller['index']);router[_0x547c('0x8')](_0x547c('0xa'),auth[_0x547c('0x9')](),controller[_0x547c('0xb')]);router[_0x547c('0xc')]('/',auth[_0x547c('0x9')](),controller[_0x547c('0xd')]);router[_0x547c('0xe')](_0x547c('0xa'),auth[_0x547c('0x9')](),controller[_0x547c('0xf')]);router[_0x547c('0x10')](_0x547c('0xa'),auth[_0x547c('0x9')](),controller[_0x547c('0x11')]);module[_0x547c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index de21f84..b9ed788 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 _0xdedc=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x2438f1,_0x259bc5){var _0x5344de=function(_0x42590a){while(--_0x42590a){_0x2438f1['push'](_0x2438f1['shift']());}};_0x5344de(++_0x259bc5);}(_0xdedc,0xb8));var _0xcded=function(_0x5a0383,_0x312ffe){_0x5a0383=_0x5a0383-0x0;var _0x1adda7=_0xdedc[_0x5a0383];return _0x1adda7;};'use strict';var Sequelize=require(_0xcded('0x0'));module[_0xcded('0x1')]={'type':{'type':Sequelize[_0xcded('0x2')](_0xcded('0x3'),_0xcded('0x4'),'customVariable',_0xcded('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcded('0x6')]},'key':{'type':Sequelize[_0xcded('0x6')]},'keyType':{'type':Sequelize[_0xcded('0x2')](_0xcded('0x3'),'variable',_0xcded('0x7'))},'keyContent':{'type':Sequelize[_0xcded('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcded('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe8eb=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x584283,_0x1032da){var _0x47beaf=function(_0x3c1365){while(--_0x3c1365){_0x584283['push'](_0x584283['shift']());}};_0x47beaf(++_0x1032da);}(_0xe8eb,0xce));var _0xbe8e=function(_0x35c9ee,_0x58521a){_0x35c9ee=_0x35c9ee-0x0;var _0x1d2f71=_0xe8eb[_0x35c9ee];return _0x1d2f71;};'use strict';var Sequelize=require(_0xbe8e('0x0'));module[_0xbe8e('0x1')]={'type':{'type':Sequelize[_0xbe8e('0x2')]('string',_0xbe8e('0x3'),_0xbe8e('0x4'),_0xbe8e('0x5')),'defaultValue':_0xbe8e('0x6')},'content':{'type':Sequelize[_0xbe8e('0x7')]},'key':{'type':Sequelize[_0xbe8e('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xbe8e('0x6'),_0xbe8e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xbe8e('0x7')]},'idField':{'type':Sequelize[_0xbe8e('0x7')]},'nameField':{'type':Sequelize[_0xbe8e('0x7')]},'customField':{'type':Sequelize[_0xbe8e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7512bc8..9535a26 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 _0x2a9a=['then','error','stack','name','send','index','ZohoField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy'];(function(_0x5a1dd9,_0x23f1b1){var _0x30c2b2=function(_0x396e71){while(--_0x396e71){_0x5a1dd9['push'](_0x5a1dd9['shift']());}};_0x30c2b2(++_0x23f1b1);}(_0x2a9a,0x1c2));var _0xa2a9=function(_0x202a53,_0x5ca576){_0x202a53=_0x202a53-0x0;var _0x568f62=_0x2a9a[_0x202a53];return _0x568f62;};'use strict';var pdf=require(_0xa2a9('0x0'));var emlformat=require(_0xa2a9('0x1'));var rimraf=require(_0xa2a9('0x2'));var zipdir=require(_0xa2a9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2a9('0x4'));var moment=require(_0xa2a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa2a9('0x6'));var util=require('util');var path=require(_0xa2a9('0x7'));var sox=require('sox');var csv=require(_0xa2a9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa2a9('0x9'));var squel=require('squel');var crypto=require(_0xa2a9('0xa'));var jsforce=require(_0xa2a9('0xb'));var deskjs=require(_0xa2a9('0xc'));var toCsv=require(_0xa2a9('0x8'));var querystring=require(_0xa2a9('0xd'));var Papa=require(_0xa2a9('0xe'));var Redis=require('ioredis');var authService=require(_0xa2a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa2a9('0x10'));var hardwareService=require(_0xa2a9('0x11'));var logger=require('../../config/logger')(_0xa2a9('0x12'));var utils=require('../../config/utils');var config=require(_0xa2a9('0x13'));var licenseUtil=require(_0xa2a9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f5291,_0x1c3328){_0x1c3328=_0x1c3328||0xcc;return function(_0x4fdb12){if(_0x4fdb12){return _0x5f5291[_0xa2a9('0x15')](_0x1c3328);}return _0x5f5291[_0xa2a9('0x16')](_0x1c3328)[_0xa2a9('0x17')]();};}function respondWithResult(_0x1ab577,_0x381ede){_0x381ede=_0x381ede||0xc8;return function(_0x44dd38){if(_0x44dd38){return _0x1ab577[_0xa2a9('0x16')](_0x381ede)[_0xa2a9('0x18')](_0x44dd38);}};}function respondWithFilteredResult(_0x317cd7,_0x51ae1f){return function(_0x31a955){if(_0x31a955){var _0x4e89c6=_0x31a955[_0xa2a9('0x19')],_0x59817c=_0x51ae1f[_0xa2a9('0x1a')],_0x18e1ba=_0x51ae1f['offset']+_0x51ae1f[_0xa2a9('0x1b')],_0x495ea1;if(_0x18e1ba>=_0x4e89c6){_0x18e1ba=_0x4e89c6;_0x495ea1=0xc8;}else{_0x495ea1=0xce;}_0x317cd7[_0xa2a9('0x16')](_0x495ea1);return _0x317cd7[_0xa2a9('0x1c')]('Content-Range',_0x59817c+'-'+_0x18e1ba+'/'+_0x4e89c6)['json'](_0x31a955);}return null;};}function patchUpdates(_0xee7072){return function(_0x9f8ab2){try{jsonpatch[_0xa2a9('0x1d')](_0x9f8ab2,_0xee7072,!![]);}catch(_0x47b4b7){return BPromise[_0xa2a9('0x1e')](_0x47b4b7);}return _0x9f8ab2['save']();};}function saveUpdates(_0x507195,_0x5e7501){return function(_0x163870){if(_0x163870){return _0x163870[_0xa2a9('0x1f')](_0x507195)['then'](function(_0x507767){return _0x507767;});}return null;};}function removeEntity(_0x370ad9,_0x5372c4){return function(_0x34d0f6){if(_0x34d0f6){return _0x34d0f6[_0xa2a9('0x20')]()[_0xa2a9('0x21')](function(){_0x370ad9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b956,_0x6ac0a1){return function(_0x7a950d){if(!_0x7a950d){_0x12b956[_0xa2a9('0x15')](0x194);}return _0x7a950d;};}function handleError(_0x68d53d,_0x4bedc6){_0x4bedc6=_0x4bedc6||0x1f4;return function(_0x2b7e84){logger[_0xa2a9('0x22')](_0x2b7e84[_0xa2a9('0x23')]);if(_0x2b7e84[_0xa2a9('0x24')]){delete _0x2b7e84[_0xa2a9('0x24')];}_0x68d53d[_0xa2a9('0x16')](_0x4bedc6)[_0xa2a9('0x25')](_0x2b7e84);};}exports[_0xa2a9('0x26')]=function(_0x5a7c48,_0x4dbbfe){var _0x56f28f={},_0x407da8={},_0x15eae2={'count':0x0,'rows':[]};var _0x4f073a=_['map'](db[_0xa2a9('0x27')][_0xa2a9('0x28')],function(_0x234257){return{'name':_0x234257['fieldName'],'type':_0x234257[_0xa2a9('0x29')][_0xa2a9('0x2a')]};});_0x407da8[_0xa2a9('0x2b')]=_[_0xa2a9('0x2c')](_0x4f073a,_0xa2a9('0x24'));_0x407da8[_0xa2a9('0x2d')]=_[_0xa2a9('0x2e')](_0x5a7c48[_0xa2a9('0x2d')]);_0x407da8[_0xa2a9('0x2f')]=_[_0xa2a9('0x30')](_0x407da8[_0xa2a9('0x2b')],_0x407da8[_0xa2a9('0x2d')]);_0x56f28f[_0xa2a9('0x31')]=_['intersection'](_0x407da8[_0xa2a9('0x2b')],qs[_0xa2a9('0x32')](_0x5a7c48['query'][_0xa2a9('0x32')]));_0x56f28f[_0xa2a9('0x31')]=_0x56f28f[_0xa2a9('0x31')][_0xa2a9('0x33')]?_0x56f28f[_0xa2a9('0x31')]:_0x407da8[_0xa2a9('0x2b')];if(!_0x5a7c48['query'][_0xa2a9('0x34')](_0xa2a9('0x35'))){_0x56f28f['limit']=qs['limit'](_0x5a7c48['query']['limit']);_0x56f28f[_0xa2a9('0x1a')]=qs[_0xa2a9('0x1a')](_0x5a7c48[_0xa2a9('0x2d')]['offset']);}_0x56f28f[_0xa2a9('0x36')]=qs[_0xa2a9('0x37')](_0x5a7c48[_0xa2a9('0x2d')][_0xa2a9('0x37')]);_0x56f28f[_0xa2a9('0x38')]=qs[_0xa2a9('0x2f')](_[_0xa2a9('0x39')](_0x5a7c48['query'],_0x407da8[_0xa2a9('0x2f')]),_0x4f073a);if(_0x5a7c48['query']['filter']){_0x56f28f[_0xa2a9('0x38')]=_[_0xa2a9('0x3a')](_0x56f28f[_0xa2a9('0x38')],{'$or':_[_0xa2a9('0x2c')](_0x4f073a,function(_0x2ca024){if(_0x2ca024[_0xa2a9('0x29')]!==_0xa2a9('0x3b')){var _0x1a7e4d={};_0x1a7e4d[_0x2ca024['name']]={'$like':'%'+_0x5a7c48[_0xa2a9('0x2d')][_0xa2a9('0x3c')]+'%'};return _0x1a7e4d;}})});}_0x56f28f=_[_0xa2a9('0x3a')]({},_0x56f28f,_0x5a7c48[_0xa2a9('0x3d')]);var _0x11b9d5={'where':_0x56f28f[_0xa2a9('0x38')]};return db[_0xa2a9('0x27')][_0xa2a9('0x19')](_0x11b9d5)['then'](function(_0x2cfc86){_0x15eae2[_0xa2a9('0x19')]=_0x2cfc86;if(_0x5a7c48['query'][_0xa2a9('0x3e')]){_0x56f28f[_0xa2a9('0x3f')]=[{'all':!![]}];}return db[_0xa2a9('0x27')]['findAll'](_0x56f28f);})[_0xa2a9('0x21')](function(_0x1ac792){_0x15eae2['rows']=_0x1ac792;return _0x15eae2;})[_0xa2a9('0x21')](respondWithFilteredResult(_0x4dbbfe,_0x56f28f))[_0xa2a9('0x40')](handleError(_0x4dbbfe,null));};exports['show']=function(_0x2f6c07,_0x3969d3){var _0x4db4bf={'raw':!![],'where':{'id':_0x2f6c07[_0xa2a9('0x41')]['id']}},_0x28b1c7={};_0x28b1c7[_0xa2a9('0x2b')]=_['keys'](db[_0xa2a9('0x27')][_0xa2a9('0x28')]);_0x28b1c7[_0xa2a9('0x2d')]=_[_0xa2a9('0x2e')](_0x2f6c07[_0xa2a9('0x2d')]);_0x28b1c7[_0xa2a9('0x2f')]=_['intersection'](_0x28b1c7[_0xa2a9('0x2b')],_0x28b1c7[_0xa2a9('0x2d')]);_0x4db4bf[_0xa2a9('0x31')]=_[_0xa2a9('0x30')](_0x28b1c7[_0xa2a9('0x2b')],qs[_0xa2a9('0x32')](_0x2f6c07[_0xa2a9('0x2d')][_0xa2a9('0x32')]));_0x4db4bf['attributes']=_0x4db4bf[_0xa2a9('0x31')][_0xa2a9('0x33')]?_0x4db4bf['attributes']:_0x28b1c7[_0xa2a9('0x2b')];if(_0x2f6c07[_0xa2a9('0x2d')][_0xa2a9('0x3e')]){_0x4db4bf[_0xa2a9('0x3f')]=[{'all':!![]}];}_0x4db4bf=_[_0xa2a9('0x3a')]({},_0x4db4bf,_0x2f6c07[_0xa2a9('0x3d')]);return db[_0xa2a9('0x27')]['find'](_0x4db4bf)[_0xa2a9('0x21')](handleEntityNotFound(_0x3969d3,null))[_0xa2a9('0x21')](respondWithResult(_0x3969d3,null))[_0xa2a9('0x40')](handleError(_0x3969d3,null));};exports[_0xa2a9('0x42')]=function(_0x1c3338,_0x44f075){return db['ZohoField'][_0xa2a9('0x42')](_0x1c3338[_0xa2a9('0x43')],{})[_0xa2a9('0x21')](respondWithResult(_0x44f075,0xc9))['catch'](handleError(_0x44f075,null));};exports[_0xa2a9('0x1f')]=function(_0x50367f,_0x344daf){if(_0x50367f[_0xa2a9('0x43')]['id']){delete _0x50367f[_0xa2a9('0x43')]['id'];}return db[_0xa2a9('0x27')][_0xa2a9('0x44')]({'where':{'id':_0x50367f[_0xa2a9('0x41')]['id']}})[_0xa2a9('0x21')](handleEntityNotFound(_0x344daf,null))[_0xa2a9('0x21')](saveUpdates(_0x50367f['body'],null))['then'](respondWithResult(_0x344daf,null))[_0xa2a9('0x40')](handleError(_0x344daf,null));};exports[_0xa2a9('0x20')]=function(_0x3a92d8,_0x49bb9a){return db[_0xa2a9('0x27')][_0xa2a9('0x44')]({'where':{'id':_0x3a92d8[_0xa2a9('0x41')]['id']}})['then'](handleEntityNotFound(_0x49bb9a,null))[_0xa2a9('0x21')](removeEntity(_0x49bb9a,null))['catch'](handleError(_0x49bb9a,null));}; \ No newline at end of file +var _0xaba9=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','update','then','end','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x258e2a,_0x5bbe38){var _0x358c15=function(_0xf683ea){while(--_0xf683ea){_0x258e2a['push'](_0x258e2a['shift']());}};_0x358c15(++_0x5bbe38);}(_0xaba9,0xcb));var _0x9aba=function(_0x571723,_0x31aa85){_0x571723=_0x571723-0x0;var _0x37bc70=_0xaba9[_0x571723];return _0x37bc70;};'use strict';var pdf=require(_0x9aba('0x0'));var emlformat=require(_0x9aba('0x1'));var rimraf=require(_0x9aba('0x2'));var zipdir=require(_0x9aba('0x3'));var jsonpatch=require(_0x9aba('0x4'));var rp=require(_0x9aba('0x5'));var moment=require(_0x9aba('0x6'));var BPromise=require(_0x9aba('0x7'));var Mustache=require(_0x9aba('0x8'));var util=require(_0x9aba('0x9'));var path=require('path');var sox=require(_0x9aba('0xa'));var csv=require(_0x9aba('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9aba('0xc'));var squel=require(_0x9aba('0xd'));var crypto=require('crypto');var jsforce=require(_0x9aba('0xe'));var deskjs=require(_0x9aba('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9aba('0x10'));var Papa=require(_0x9aba('0x11'));var Redis=require(_0x9aba('0x12'));var authService=require(_0x9aba('0x13'));var qs=require(_0x9aba('0x14'));var as=require(_0x9aba('0x15'));var hardwareService=require(_0x9aba('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9aba('0x17'));var config=require(_0x9aba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9aba('0x19'))['db'];function respondWithStatusCode(_0x1f9eb8,_0x699859){_0x699859=_0x699859||0xcc;return function(_0x46927d){if(_0x46927d){return _0x1f9eb8[_0x9aba('0x1a')](_0x699859);}return _0x1f9eb8['status'](_0x699859)['end']();};}function respondWithResult(_0x30743b,_0x21abd8){_0x21abd8=_0x21abd8||0xc8;return function(_0x41ec73){if(_0x41ec73){return _0x30743b['status'](_0x21abd8)[_0x9aba('0x1b')](_0x41ec73);}};}function respondWithFilteredResult(_0x59cd1f,_0x900b4c){return function(_0x373ff7){if(_0x373ff7){var _0x4aec05=_0x373ff7['count'],_0x411a67=_0x900b4c[_0x9aba('0x1c')],_0x53f36f=_0x900b4c['offset']+_0x900b4c[_0x9aba('0x1d')],_0x19b0be;if(_0x53f36f>=_0x4aec05){_0x53f36f=_0x4aec05;_0x19b0be=0xc8;}else{_0x19b0be=0xce;}_0x59cd1f[_0x9aba('0x1e')](_0x19b0be);return _0x59cd1f[_0x9aba('0x1f')](_0x9aba('0x20'),_0x411a67+'-'+_0x53f36f+'/'+_0x4aec05)[_0x9aba('0x1b')](_0x373ff7);}return null;};}function patchUpdates(_0x58f6d5){return function(_0x15dd71){try{jsonpatch[_0x9aba('0x21')](_0x15dd71,_0x58f6d5,!![]);}catch(_0x4ae33b){return BPromise['reject'](_0x4ae33b);}return _0x15dd71['save']();};}function saveUpdates(_0x1240bd,_0x1c030d){return function(_0x368185){if(_0x368185){return _0x368185[_0x9aba('0x22')](_0x1240bd)[_0x9aba('0x23')](function(_0x75e216){return _0x75e216;});}return null;};}function removeEntity(_0x12b0d1,_0x559812){return function(_0xd37403){if(_0xd37403){return _0xd37403['destroy']()[_0x9aba('0x23')](function(){_0x12b0d1['status'](0xcc)[_0x9aba('0x24')]();});}};}function handleEntityNotFound(_0x19ab3d,_0x219b67){return function(_0x503d5d){if(!_0x503d5d){_0x19ab3d[_0x9aba('0x1a')](0x194);}return _0x503d5d;};}function handleError(_0x10bfff,_0x97d8dd){_0x97d8dd=_0x97d8dd||0x1f4;return function(_0x2ad497){logger[_0x9aba('0x25')](_0x2ad497[_0x9aba('0x26')]);if(_0x2ad497[_0x9aba('0x27')]){delete _0x2ad497[_0x9aba('0x27')];}_0x10bfff[_0x9aba('0x1e')](_0x97d8dd)[_0x9aba('0x28')](_0x2ad497);};}exports[_0x9aba('0x29')]=function(_0x70f299,_0x589643){var _0x273e85={},_0x492654={},_0x566313={'count':0x0,'rows':[]};var _0x4a926f=_[_0x9aba('0x2a')](db[_0x9aba('0x2b')][_0x9aba('0x2c')],function(_0x1991c7){return{'name':_0x1991c7[_0x9aba('0x2d')],'type':_0x1991c7[_0x9aba('0x2e')]['key']};});_0x492654[_0x9aba('0x2f')]=_[_0x9aba('0x2a')](_0x4a926f,_0x9aba('0x27'));_0x492654['query']=_[_0x9aba('0x30')](_0x70f299[_0x9aba('0x31')]);_0x492654[_0x9aba('0x32')]=_[_0x9aba('0x33')](_0x492654[_0x9aba('0x2f')],_0x492654[_0x9aba('0x31')]);_0x273e85[_0x9aba('0x34')]=_[_0x9aba('0x33')](_0x492654['model'],qs['fields'](_0x70f299[_0x9aba('0x31')][_0x9aba('0x35')]));_0x273e85[_0x9aba('0x34')]=_0x273e85[_0x9aba('0x34')][_0x9aba('0x36')]?_0x273e85[_0x9aba('0x34')]:_0x492654[_0x9aba('0x2f')];if(!_0x70f299[_0x9aba('0x31')][_0x9aba('0x37')](_0x9aba('0x38'))){_0x273e85[_0x9aba('0x1d')]=qs[_0x9aba('0x1d')](_0x70f299[_0x9aba('0x31')][_0x9aba('0x1d')]);_0x273e85[_0x9aba('0x1c')]=qs[_0x9aba('0x1c')](_0x70f299[_0x9aba('0x31')]['offset']);}_0x273e85[_0x9aba('0x39')]=qs['sort'](_0x70f299[_0x9aba('0x31')][_0x9aba('0x3a')]);_0x273e85[_0x9aba('0x3b')]=qs[_0x9aba('0x32')](_['pick'](_0x70f299[_0x9aba('0x31')],_0x492654['filters']),_0x4a926f);if(_0x70f299[_0x9aba('0x31')][_0x9aba('0x3c')]){_0x273e85[_0x9aba('0x3b')]=_[_0x9aba('0x3d')](_0x273e85[_0x9aba('0x3b')],{'$or':_[_0x9aba('0x2a')](_0x4a926f,function(_0x4872b5){if(_0x4872b5[_0x9aba('0x2e')]!==_0x9aba('0x3e')){var _0x230283={};_0x230283[_0x4872b5[_0x9aba('0x27')]]={'$like':'%'+_0x70f299['query'][_0x9aba('0x3c')]+'%'};return _0x230283;}})});}_0x273e85=_[_0x9aba('0x3d')]({},_0x273e85,_0x70f299[_0x9aba('0x3f')]);var _0x4d4394={'where':_0x273e85[_0x9aba('0x3b')]};return db[_0x9aba('0x2b')][_0x9aba('0x40')](_0x4d4394)[_0x9aba('0x23')](function(_0x44141d){_0x566313[_0x9aba('0x40')]=_0x44141d;if(_0x70f299['query'][_0x9aba('0x41')]){_0x273e85[_0x9aba('0x42')]=[{'all':!![]}];}return db[_0x9aba('0x2b')]['findAll'](_0x273e85);})[_0x9aba('0x23')](function(_0x2bd72a){_0x566313[_0x9aba('0x43')]=_0x2bd72a;return _0x566313;})[_0x9aba('0x23')](respondWithFilteredResult(_0x589643,_0x273e85))[_0x9aba('0x44')](handleError(_0x589643,null));};exports[_0x9aba('0x45')]=function(_0x4a9398,_0x434878){var _0x5a0c0c={'raw':!![],'where':{'id':_0x4a9398[_0x9aba('0x46')]['id']}},_0x93469d={};_0x93469d[_0x9aba('0x2f')]=_['keys'](db[_0x9aba('0x2b')]['rawAttributes']);_0x93469d['query']=_['keys'](_0x4a9398[_0x9aba('0x31')]);_0x93469d[_0x9aba('0x32')]=_[_0x9aba('0x33')](_0x93469d['model'],_0x93469d[_0x9aba('0x31')]);_0x5a0c0c['attributes']=_['intersection'](_0x93469d[_0x9aba('0x2f')],qs['fields'](_0x4a9398[_0x9aba('0x31')][_0x9aba('0x35')]));_0x5a0c0c[_0x9aba('0x34')]=_0x5a0c0c[_0x9aba('0x34')][_0x9aba('0x36')]?_0x5a0c0c[_0x9aba('0x34')]:_0x93469d['model'];if(_0x4a9398[_0x9aba('0x31')][_0x9aba('0x41')]){_0x5a0c0c[_0x9aba('0x42')]=[{'all':!![]}];}_0x5a0c0c=_['merge']({},_0x5a0c0c,_0x4a9398['options']);return db[_0x9aba('0x2b')]['find'](_0x5a0c0c)[_0x9aba('0x23')](handleEntityNotFound(_0x434878,null))[_0x9aba('0x23')](respondWithResult(_0x434878,null))[_0x9aba('0x44')](handleError(_0x434878,null));};exports['create']=function(_0x30c38b,_0x1a1e3c){return db[_0x9aba('0x2b')][_0x9aba('0x47')](_0x30c38b['body'],{})['then'](respondWithResult(_0x1a1e3c,0xc9))[_0x9aba('0x44')](handleError(_0x1a1e3c,null));};exports[_0x9aba('0x22')]=function(_0x4f174d,_0x1ad351){if(_0x4f174d[_0x9aba('0x48')]['id']){delete _0x4f174d[_0x9aba('0x48')]['id'];}return db['ZohoField'][_0x9aba('0x49')]({'where':{'id':_0x4f174d[_0x9aba('0x46')]['id']}})[_0x9aba('0x23')](handleEntityNotFound(_0x1ad351,null))[_0x9aba('0x23')](saveUpdates(_0x4f174d[_0x9aba('0x48')],null))[_0x9aba('0x23')](respondWithResult(_0x1ad351,null))[_0x9aba('0x44')](handleError(_0x1ad351,null));};exports['destroy']=function(_0x4c2a9d,_0x4c2fe0){return db[_0x9aba('0x2b')][_0x9aba('0x49')]({'where':{'id':_0x4c2a9d['params']['id']}})[_0x9aba('0x23')](handleEntityNotFound(_0x4c2fe0,null))[_0x9aba('0x23')](removeEntity(_0x4c2fe0,null))[_0x9aba('0x44')](handleError(_0x4c2fe0,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a88e6bf..fac200a 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 _0xadf4=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util'];(function(_0x347343,_0x213c66){var _0x37444e=function(_0x32bc77){while(--_0x32bc77){_0x347343['push'](_0x347343['shift']());}};_0x37444e(++_0x213c66);}(_0xadf4,0x141));var _0x4adf=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0xadf4[_0x334651];return _0x29657c;};'use strict';var _=require('lodash');var util=require(_0x4adf('0x0'));var logger=require(_0x4adf('0x1'))(_0x4adf('0x2'));var moment=require('moment');var BPromise=require(_0x4adf('0x3'));var rp=require(_0x4adf('0x4'));var fs=require('fs');var path=require(_0x4adf('0x5'));var rimraf=require(_0x4adf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4adf('0x7'));module[_0x4adf('0x8')]=function(_0x37fe5b,_0x33bd7d){return _0x37fe5b['define'](_0x4adf('0x9'),attributes,{'tableName':_0x4adf('0xa'),'paranoid':![],'indexes':[{'name':_0x4adf('0xb'),'fields':[_0x4adf('0xc'),_0x4adf('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a38=['rimraf','../../config/environment','exports','ZohoField','idField','FieldId','lodash','util','api','moment','request-promise','path'];(function(_0x4a8371,_0x2d445b){var _0x37d3b0=function(_0xd69ba5){while(--_0xd69ba5){_0x4a8371['push'](_0x4a8371['shift']());}};_0x37d3b0(++_0x2d445b);}(_0x3a38,0x14a));var _0x83a3=function(_0x140678,_0x5cf31f){_0x140678=_0x140678-0x0;var _0x1bbf48=_0x3a38[_0x140678];return _0x1bbf48;};'use strict';var _=require(_0x83a3('0x0'));var util=require(_0x83a3('0x1'));var logger=require('../../config/logger')(_0x83a3('0x2'));var moment=require(_0x83a3('0x3'));var BPromise=require('bluebird');var rp=require(_0x83a3('0x4'));var fs=require('fs');var path=require(_0x83a3('0x5'));var rimraf=require(_0x83a3('0x6'));var config=require(_0x83a3('0x7'));var attributes=require('./intZohoField.attributes');module[_0x83a3('0x8')]=function(_0x2a2fe1,_0x4cc5b5){return _0x2a2fe1['define'](_0x83a3('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x83a3('0xa'),_0x83a3('0xb')],'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 e8e170c..c4e56e7 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 _0x33c5=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x33c5,0xe6));var _0x533c=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x33c5[_0x400b43];return _0x3c330f;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('ZohoField,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ 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','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1287ad,_0x28385a){var _0x42a12c=function(_0x5379a9){while(--_0x5379a9){_0x1287ad['push'](_0x1287ad['shift']());}};_0x42a12c(++_0x28385a);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('ZohoField,\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/integration/index.js b/server/api/integration/index.js index 5392b6c..d275e75 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 _0x870c=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x870c,0x1b9));var _0xc870=function(_0x3dd8ae,_0x1ae442){_0x3dd8ae=_0x3dd8ae-0x0;var _0x249b60=_0x870c[_0x3dd8ae];return _0x249b60;};'use strict';var multer=require(_0xc870('0x0'));var util=require(_0xc870('0x1'));var path=require('path');var timeout=require(_0xc870('0x2'));var express=require(_0xc870('0x3'));var router=express[_0xc870('0x4')]();var auth=require(_0xc870('0x5'));var interaction=require(_0xc870('0x6'));var config=require(_0xc870('0x7'));module[_0xc870('0x8')]=router; \ No newline at end of file +var _0x6c42=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x1e4296,_0x47b40c){var _0x36fae6=function(_0x57f86b){while(--_0x57f86b){_0x1e4296['push'](_0x1e4296['shift']());}};_0x36fae6(++_0x47b40c);}(_0x6c42,0x189));var _0x26c4=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0x6c42[_0x5a26db];return _0x4619dd;};'use strict';var multer=require(_0x26c4('0x0'));var util=require(_0x26c4('0x1'));var path=require(_0x26c4('0x2'));var timeout=require(_0x26c4('0x3'));var express=require(_0x26c4('0x4'));var router=express[_0x26c4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x26c4('0x6'));var config=require(_0x26c4('0x7'));module[_0x26c4('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4914d15..3661d12 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 _0xa38b=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x42f3c8,_0x13990c){var _0x259936=function(_0x1a522d){while(--_0x1a522d){_0x42f3c8['push'](_0x42f3c8['shift']());}};_0x259936(++_0x13990c);}(_0xa38b,0x98));var _0xba38=function(_0x557aa9,_0x5116ca){_0x557aa9=_0x557aa9-0x0;var _0x358901=_0xa38b[_0x557aa9];return _0x358901;};'use strict';var Sequelize=require(_0xba38('0x0'));module[_0xba38('0x1')]={'name':{'type':Sequelize[_0xba38('0x2')],'allowNull':![],'unique':_0xba38('0x3')},'version':{'type':Sequelize[_0xba38('0x2')],'allowNull':![],'unique':_0xba38('0x3')},'main':{'type':Sequelize[_0xba38('0x2')],'defaultValue':_0xba38('0x4')},'filename':{'type':Sequelize[_0xba38('0x2')]},'path':{'type':Sequelize[_0xba38('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xba38('0x5')]},'active':{'type':Sequelize[_0xba38('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xba38('0x2')]},'state':{'type':Sequelize[_0xba38('0x2')],'unique':_0xba38('0x7')},'description':{'type':Sequelize[_0xba38('0x2')]},'title':{'type':Sequelize[_0xba38('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xba38('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x726f=['sequelize','unique_name_and_version','STRING','app.js','BOOLEAN','state'];(function(_0x22c680,_0x114cc1){var _0x5b8c4c=function(_0x193b8c){while(--_0x193b8c){_0x22c680['push'](_0x22c680['shift']());}};_0x5b8c4c(++_0x114cc1);}(_0x726f,0x174));var _0xf726=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x726f[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xf726('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf726('0x1')},'version':{'type':Sequelize[_0xf726('0x2')],'allowNull':![],'unique':_0xf726('0x1')},'main':{'type':Sequelize[_0xf726('0x2')],'defaultValue':_0xf726('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf726('0x2')]},'type':{'type':Sequelize[_0xf726('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf726('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xf726('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xf726('0x2')],'unique':_0xf726('0x5')},'description':{'type':Sequelize[_0xf726('0x2')]},'title':{'type':Sequelize[_0xf726('0x2')]},'remoteUri':{'type':Sequelize[_0xf726('0x2')]},'link':{'type':Sequelize[_0xf726('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ceda05d..4b778c7 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 _0x9498=['desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Integration','rows','params','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x9498,0x105));var _0x8949=function(_0x2eaad1,_0x4aa838){_0x2eaad1=_0x2eaad1-0x0;var _0x48a111=_0x9498[_0x2eaad1];return _0x48a111;};'use strict';var pdf=require(_0x8949('0x0'));var emlformat=require(_0x8949('0x1'));var rimraf=require(_0x8949('0x2'));var zipdir=require(_0x8949('0x3'));var jsonpatch=require(_0x8949('0x4'));var rp=require(_0x8949('0x5'));var moment=require(_0x8949('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8949('0x7'));var util=require('util');var path=require(_0x8949('0x8'));var sox=require(_0x8949('0x9'));var csv=require(_0x8949('0xa'));var ejs=require(_0x8949('0xb'));var fs=require('fs');var _=require(_0x8949('0xc'));var squel=require(_0x8949('0xd'));var crypto=require(_0x8949('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8949('0xf'));var toCsv=require(_0x8949('0xa'));var querystring=require(_0x8949('0x10'));var Papa=require(_0x8949('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8949('0x12'));var as=require(_0x8949('0x13'));var hardwareService=require(_0x8949('0x14'));var logger=require('../../config/logger')(_0x8949('0x15'));var utils=require('../../config/utils');var config=require(_0x8949('0x16'));var licenseUtil=require(_0x8949('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a1dba,_0x277eed){_0x277eed=_0x277eed||0xcc;return function(_0x41fc12){if(_0x41fc12){return _0x1a1dba[_0x8949('0x18')](_0x277eed);}return _0x1a1dba[_0x8949('0x19')](_0x277eed)[_0x8949('0x1a')]();};}function respondWithResult(_0x23dbca,_0xf36c8f){_0xf36c8f=_0xf36c8f||0xc8;return function(_0xd0dd59){if(_0xd0dd59){return _0x23dbca[_0x8949('0x19')](_0xf36c8f)[_0x8949('0x1b')](_0xd0dd59);}};}function respondWithFilteredResult(_0xf32ae6,_0x1b0bea){return function(_0x45d49b){if(_0x45d49b){var _0x1aa0ab=_0x45d49b[_0x8949('0x1c')],_0x175e46=_0x1b0bea[_0x8949('0x1d')],_0x47e52b=_0x1b0bea['offset']+_0x1b0bea['limit'],_0x5e4bc8;if(_0x47e52b>=_0x1aa0ab){_0x47e52b=_0x1aa0ab;_0x5e4bc8=0xc8;}else{_0x5e4bc8=0xce;}_0xf32ae6[_0x8949('0x19')](_0x5e4bc8);return _0xf32ae6['set'](_0x8949('0x1e'),_0x175e46+'-'+_0x47e52b+'/'+_0x1aa0ab)[_0x8949('0x1b')](_0x45d49b);}return null;};}function patchUpdates(_0x5b108a){return function(_0x255fbb){try{jsonpatch['apply'](_0x255fbb,_0x5b108a,!![]);}catch(_0x5104c3){return BPromise[_0x8949('0x1f')](_0x5104c3);}return _0x255fbb['save']();};}function saveUpdates(_0x5b0dc3,_0x2c2c70){return function(_0x52b59e){if(_0x52b59e){return _0x52b59e[_0x8949('0x20')](_0x5b0dc3)[_0x8949('0x21')](function(_0x17e504){return _0x17e504;});}return null;};}function removeEntity(_0x2138aa,_0x53526d){return function(_0x12d3df){if(_0x12d3df){return _0x12d3df['destroy']()[_0x8949('0x21')](function(){_0x2138aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc1c,_0x9d6a80){return function(_0x5f25c8){if(!_0x5f25c8){_0xdc1c['sendStatus'](0x194);}return _0x5f25c8;};}function handleError(_0x4a5890,_0x4f2a88){_0x4f2a88=_0x4f2a88||0x1f4;return function(_0x219339){logger[_0x8949('0x22')](_0x219339[_0x8949('0x23')]);if(_0x219339['name']){delete _0x219339[_0x8949('0x24')];}_0x4a5890[_0x8949('0x19')](_0x4f2a88)[_0x8949('0x25')](_0x219339);};}exports['index']=function(_0xed844e,_0x515c65){var _0x18e5f9={},_0x194162={},_0x471834={'count':0x0,'rows':[]};var _0x316754=_[_0x8949('0x26')](db['Integration'][_0x8949('0x27')],function(_0x1282c1){return{'name':_0x1282c1[_0x8949('0x28')],'type':_0x1282c1['type'][_0x8949('0x29')]};});_0x194162[_0x8949('0x2a')]=_[_0x8949('0x26')](_0x316754,'name');_0x194162[_0x8949('0x2b')]=_[_0x8949('0x2c')](_0xed844e[_0x8949('0x2b')]);_0x194162[_0x8949('0x2d')]=_[_0x8949('0x2e')](_0x194162[_0x8949('0x2a')],_0x194162['query']);_0x18e5f9[_0x8949('0x2f')]=_['intersection'](_0x194162[_0x8949('0x2a')],qs[_0x8949('0x30')](_0xed844e['query'][_0x8949('0x30')]));_0x18e5f9[_0x8949('0x2f')]=_0x18e5f9[_0x8949('0x2f')]['length']?_0x18e5f9['attributes']:_0x194162[_0x8949('0x2a')];if(!_0xed844e[_0x8949('0x2b')][_0x8949('0x31')]('nolimit')){_0x18e5f9[_0x8949('0x32')]=qs[_0x8949('0x32')](_0xed844e[_0x8949('0x2b')]['limit']);_0x18e5f9[_0x8949('0x1d')]=qs[_0x8949('0x1d')](_0xed844e[_0x8949('0x2b')]['offset']);}_0x18e5f9['order']=qs[_0x8949('0x33')](_0xed844e[_0x8949('0x2b')][_0x8949('0x33')]);_0x18e5f9[_0x8949('0x34')]=qs['filters'](_[_0x8949('0x35')](_0xed844e[_0x8949('0x2b')],_0x194162[_0x8949('0x2d')]),_0x316754);if(_0xed844e[_0x8949('0x2b')][_0x8949('0x36')]){_0x18e5f9[_0x8949('0x34')]=_[_0x8949('0x37')](_0x18e5f9[_0x8949('0x34')],{'$or':_[_0x8949('0x26')](_0x316754,function(_0x464ec7){if(_0x464ec7[_0x8949('0x38')]!==_0x8949('0x39')){var _0x4caf3f={};_0x4caf3f[_0x464ec7[_0x8949('0x24')]]={'$like':'%'+_0xed844e['query'][_0x8949('0x36')]+'%'};return _0x4caf3f;}})});}_0x18e5f9=_[_0x8949('0x37')]({},_0x18e5f9,_0xed844e[_0x8949('0x3a')]);var _0x4cc023={'where':_0x18e5f9[_0x8949('0x34')]};return db['Integration'][_0x8949('0x1c')](_0x4cc023)[_0x8949('0x21')](function(_0x3e278d){_0x471834[_0x8949('0x1c')]=_0x3e278d;if(_0xed844e[_0x8949('0x2b')][_0x8949('0x3b')]){_0x18e5f9[_0x8949('0x3c')]=[{'all':!![]}];}return db[_0x8949('0x3d')]['findAll'](_0x18e5f9);})['then'](function(_0x4fb263){_0x471834[_0x8949('0x3e')]=_0x4fb263;return _0x471834;})[_0x8949('0x21')](respondWithFilteredResult(_0x515c65,_0x18e5f9))['catch'](handleError(_0x515c65,null));};exports['show']=function(_0x5dffe4,_0x53f6e5){var _0x4c890c={'raw':![],'where':{'id':_0x5dffe4[_0x8949('0x3f')]['id']}},_0xc0a1d1={};_0xc0a1d1[_0x8949('0x2a')]=_[_0x8949('0x2c')](db[_0x8949('0x3d')][_0x8949('0x27')]);_0xc0a1d1[_0x8949('0x2b')]=_['keys'](_0x5dffe4['query']);_0xc0a1d1['filters']=_[_0x8949('0x2e')](_0xc0a1d1['model'],_0xc0a1d1[_0x8949('0x2b')]);_0x4c890c['attributes']=_[_0x8949('0x2e')](_0xc0a1d1[_0x8949('0x2a')],qs[_0x8949('0x30')](_0x5dffe4[_0x8949('0x2b')][_0x8949('0x30')]));_0x4c890c[_0x8949('0x2f')]=_0x4c890c[_0x8949('0x2f')]['length']?_0x4c890c[_0x8949('0x2f')]:_0xc0a1d1[_0x8949('0x2a')];if(_0x5dffe4['query']['includeAll']){_0x4c890c[_0x8949('0x3c')]=[{'all':!![]}];}_0x4c890c=_[_0x8949('0x37')]({},_0x4c890c,_0x5dffe4[_0x8949('0x3a')]);return db[_0x8949('0x3d')][_0x8949('0x40')](_0x4c890c)[_0x8949('0x21')](handleEntityNotFound(_0x53f6e5,null))[_0x8949('0x21')](respondWithResult(_0x53f6e5,null))[_0x8949('0x41')](handleError(_0x53f6e5,null));};exports[_0x8949('0x42')]=function(_0x123d61,_0x12f2ad){return db[_0x8949('0x3d')]['create'](_0x123d61[_0x8949('0x43')],{})[_0x8949('0x21')](respondWithResult(_0x12f2ad,0xc9))[_0x8949('0x41')](handleError(_0x12f2ad,null));};exports[_0x8949('0x20')]=function(_0x50cf5e,_0x331c04){if(_0x50cf5e[_0x8949('0x43')]['id']){delete _0x50cf5e[_0x8949('0x43')]['id'];}return db['Integration'][_0x8949('0x40')]({'where':{'id':_0x50cf5e[_0x8949('0x3f')]['id']}})[_0x8949('0x21')](handleEntityNotFound(_0x331c04,null))['then'](saveUpdates(_0x50cf5e['body'],null))[_0x8949('0x21')](respondWithResult(_0x331c04,null))[_0x8949('0x41')](handleError(_0x331c04,null));};exports[_0x8949('0x44')]=function(_0x76621f,_0x43d0d3){return db['Integration'][_0x8949('0x40')]({'where':{'id':_0x76621f['params']['id']}})['then'](handleEntityNotFound(_0x43d0d3,null))['then'](removeEntity(_0x43d0d3,null))[_0x8949('0x41')](handleError(_0x43d0d3,null));}; \ No newline at end of file +var _0xa2b8=['then','destroy','sendStatus','error','name','send','index','rawAttributes','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','type','VIRTUAL','options','where','Integration','includeAll','findAll','catch','show','params','length','find','create','body','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x2efeb3,_0x435b78){var _0x5e3126=function(_0x290681){while(--_0x290681){_0x2efeb3['push'](_0x2efeb3['shift']());}};_0x5e3126(++_0x435b78);}(_0xa2b8,0x14d));var _0x8a2b=function(_0xe758a4,_0x409e90){_0xe758a4=_0xe758a4-0x0;var _0x587ae3=_0xa2b8[_0xe758a4];return _0x587ae3;};'use strict';var pdf=require(_0x8a2b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a2b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a2b('0x2'));var moment=require(_0x8a2b('0x3'));var BPromise=require(_0x8a2b('0x4'));var Mustache=require(_0x8a2b('0x5'));var util=require(_0x8a2b('0x6'));var path=require('path');var sox=require(_0x8a2b('0x7'));var csv=require(_0x8a2b('0x8'));var ejs=require(_0x8a2b('0x9'));var fs=require('fs');var _=require(_0x8a2b('0xa'));var squel=require(_0x8a2b('0xb'));var crypto=require(_0x8a2b('0xc'));var jsforce=require(_0x8a2b('0xd'));var deskjs=require(_0x8a2b('0xe'));var toCsv=require(_0x8a2b('0x8'));var querystring=require(_0x8a2b('0xf'));var Papa=require(_0x8a2b('0x10'));var Redis=require(_0x8a2b('0x11'));var authService=require(_0x8a2b('0x12'));var qs=require(_0x8a2b('0x13'));var as=require(_0x8a2b('0x14'));var hardwareService=require(_0x8a2b('0x15'));var logger=require('../../config/logger')(_0x8a2b('0x16'));var utils=require('../../config/utils');var config=require(_0x8a2b('0x17'));var licenseUtil=require(_0x8a2b('0x18'));var db=require(_0x8a2b('0x19'))['db'];function respondWithStatusCode(_0x374cc2,_0x5579ef){_0x5579ef=_0x5579ef||0xcc;return function(_0x254e2a){if(_0x254e2a){return _0x374cc2['sendStatus'](_0x5579ef);}return _0x374cc2[_0x8a2b('0x1a')](_0x5579ef)[_0x8a2b('0x1b')]();};}function respondWithResult(_0x565c98,_0x5a9c41){_0x5a9c41=_0x5a9c41||0xc8;return function(_0x5bad60){if(_0x5bad60){return _0x565c98[_0x8a2b('0x1a')](_0x5a9c41)[_0x8a2b('0x1c')](_0x5bad60);}};}function respondWithFilteredResult(_0x39e71e,_0x4d6644){return function(_0x36a59a){if(_0x36a59a){var _0x5b5e12=_0x36a59a[_0x8a2b('0x1d')],_0x539832=_0x4d6644[_0x8a2b('0x1e')],_0x4b054c=_0x4d6644[_0x8a2b('0x1e')]+_0x4d6644[_0x8a2b('0x1f')],_0x47a7c0;if(_0x4b054c>=_0x5b5e12){_0x4b054c=_0x5b5e12;_0x47a7c0=0xc8;}else{_0x47a7c0=0xce;}_0x39e71e[_0x8a2b('0x1a')](_0x47a7c0);return _0x39e71e[_0x8a2b('0x20')]('Content-Range',_0x539832+'-'+_0x4b054c+'/'+_0x5b5e12)['json'](_0x36a59a);}return null;};}function patchUpdates(_0x5ab9ae){return function(_0x4bcd84){try{jsonpatch[_0x8a2b('0x21')](_0x4bcd84,_0x5ab9ae,!![]);}catch(_0x490219){return BPromise[_0x8a2b('0x22')](_0x490219);}return _0x4bcd84[_0x8a2b('0x23')]();};}function saveUpdates(_0x5bdc24,_0x3f70d2){return function(_0x1cd65a){if(_0x1cd65a){return _0x1cd65a[_0x8a2b('0x24')](_0x5bdc24)[_0x8a2b('0x25')](function(_0x55e1a9){return _0x55e1a9;});}return null;};}function removeEntity(_0x80c6e1,_0x5d8c5f){return function(_0x2c0a2b){if(_0x2c0a2b){return _0x2c0a2b[_0x8a2b('0x26')]()[_0x8a2b('0x25')](function(){_0x80c6e1[_0x8a2b('0x1a')](0xcc)[_0x8a2b('0x1b')]();});}};}function handleEntityNotFound(_0x15373f,_0x160897){return function(_0x49de29){if(!_0x49de29){_0x15373f[_0x8a2b('0x27')](0x194);}return _0x49de29;};}function handleError(_0x7eec19,_0x5aa550){_0x5aa550=_0x5aa550||0x1f4;return function(_0x317923){logger[_0x8a2b('0x28')](_0x317923['stack']);if(_0x317923['name']){delete _0x317923[_0x8a2b('0x29')];}_0x7eec19['status'](_0x5aa550)[_0x8a2b('0x2a')](_0x317923);};}exports[_0x8a2b('0x2b')]=function(_0x2a5007,_0x480c00){var _0x42df76={},_0x4e001e={},_0x26c084={'count':0x0,'rows':[]};var _0x45b46d=_['map'](db['Integration'][_0x8a2b('0x2c')],function(_0x365a93){return{'name':_0x365a93['fieldName'],'type':_0x365a93['type']['key']};});_0x4e001e[_0x8a2b('0x2d')]=_[_0x8a2b('0x2e')](_0x45b46d,_0x8a2b('0x29'));_0x4e001e[_0x8a2b('0x2f')]=_[_0x8a2b('0x30')](_0x2a5007[_0x8a2b('0x2f')]);_0x4e001e['filters']=_['intersection'](_0x4e001e[_0x8a2b('0x2d')],_0x4e001e[_0x8a2b('0x2f')]);_0x42df76[_0x8a2b('0x31')]=_[_0x8a2b('0x32')](_0x4e001e['model'],qs['fields'](_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x33')]));_0x42df76[_0x8a2b('0x31')]=_0x42df76[_0x8a2b('0x31')]['length']?_0x42df76[_0x8a2b('0x31')]:_0x4e001e[_0x8a2b('0x2d')];if(!_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x34')](_0x8a2b('0x35'))){_0x42df76[_0x8a2b('0x1f')]=qs['limit'](_0x2a5007['query'][_0x8a2b('0x1f')]);_0x42df76[_0x8a2b('0x1e')]=qs[_0x8a2b('0x1e')](_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x1e')]);}_0x42df76[_0x8a2b('0x36')]=qs['sort'](_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x37')]);_0x42df76['where']=qs[_0x8a2b('0x38')](_[_0x8a2b('0x39')](_0x2a5007[_0x8a2b('0x2f')],_0x4e001e[_0x8a2b('0x38')]),_0x45b46d);if(_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x3a')]){_0x42df76['where']=_[_0x8a2b('0x3b')](_0x42df76['where'],{'$or':_[_0x8a2b('0x2e')](_0x45b46d,function(_0x3cf0cf){if(_0x3cf0cf[_0x8a2b('0x3c')]!==_0x8a2b('0x3d')){var _0xe02c52={};_0xe02c52[_0x3cf0cf[_0x8a2b('0x29')]]={'$like':'%'+_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x3a')]+'%'};return _0xe02c52;}})});}_0x42df76=_[_0x8a2b('0x3b')]({},_0x42df76,_0x2a5007[_0x8a2b('0x3e')]);var _0x2ad8bc={'where':_0x42df76[_0x8a2b('0x3f')]};return db[_0x8a2b('0x40')][_0x8a2b('0x1d')](_0x2ad8bc)[_0x8a2b('0x25')](function(_0xdb01a2){_0x26c084['count']=_0xdb01a2;if(_0x2a5007[_0x8a2b('0x2f')][_0x8a2b('0x41')]){_0x42df76['include']=[{'all':!![]}];}return db[_0x8a2b('0x40')][_0x8a2b('0x42')](_0x42df76);})[_0x8a2b('0x25')](function(_0x2bd211){_0x26c084['rows']=_0x2bd211;return _0x26c084;})[_0x8a2b('0x25')](respondWithFilteredResult(_0x480c00,_0x42df76))[_0x8a2b('0x43')](handleError(_0x480c00,null));};exports[_0x8a2b('0x44')]=function(_0x10bde8,_0x4f9a04){var _0x29f7db={'raw':![],'where':{'id':_0x10bde8[_0x8a2b('0x45')]['id']}},_0x3f5656={};_0x3f5656[_0x8a2b('0x2d')]=_[_0x8a2b('0x30')](db[_0x8a2b('0x40')]['rawAttributes']);_0x3f5656[_0x8a2b('0x2f')]=_[_0x8a2b('0x30')](_0x10bde8[_0x8a2b('0x2f')]);_0x3f5656[_0x8a2b('0x38')]=_[_0x8a2b('0x32')](_0x3f5656[_0x8a2b('0x2d')],_0x3f5656[_0x8a2b('0x2f')]);_0x29f7db[_0x8a2b('0x31')]=_[_0x8a2b('0x32')](_0x3f5656[_0x8a2b('0x2d')],qs[_0x8a2b('0x33')](_0x10bde8[_0x8a2b('0x2f')][_0x8a2b('0x33')]));_0x29f7db[_0x8a2b('0x31')]=_0x29f7db[_0x8a2b('0x31')][_0x8a2b('0x46')]?_0x29f7db[_0x8a2b('0x31')]:_0x3f5656[_0x8a2b('0x2d')];if(_0x10bde8[_0x8a2b('0x2f')][_0x8a2b('0x41')]){_0x29f7db['include']=[{'all':!![]}];}_0x29f7db=_[_0x8a2b('0x3b')]({},_0x29f7db,_0x10bde8[_0x8a2b('0x3e')]);return db[_0x8a2b('0x40')][_0x8a2b('0x47')](_0x29f7db)[_0x8a2b('0x25')](handleEntityNotFound(_0x4f9a04,null))[_0x8a2b('0x25')](respondWithResult(_0x4f9a04,null))[_0x8a2b('0x43')](handleError(_0x4f9a04,null));};exports[_0x8a2b('0x48')]=function(_0x1ba57f,_0x131b51){return db[_0x8a2b('0x40')][_0x8a2b('0x48')](_0x1ba57f[_0x8a2b('0x49')],{})[_0x8a2b('0x25')](respondWithResult(_0x131b51,0xc9))[_0x8a2b('0x43')](handleError(_0x131b51,null));};exports['update']=function(_0x35f94e,_0x5eedaf){if(_0x35f94e[_0x8a2b('0x49')]['id']){delete _0x35f94e[_0x8a2b('0x49')]['id'];}return db[_0x8a2b('0x40')]['find']({'where':{'id':_0x35f94e[_0x8a2b('0x45')]['id']}})[_0x8a2b('0x25')](handleEntityNotFound(_0x5eedaf,null))['then'](saveUpdates(_0x35f94e['body'],null))[_0x8a2b('0x25')](respondWithResult(_0x5eedaf,null))[_0x8a2b('0x43')](handleError(_0x5eedaf,null));};exports['destroy']=function(_0x4b6123,_0x2a3d46){return db[_0x8a2b('0x40')]['find']({'where':{'id':_0x4b6123[_0x8a2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a3d46,null))[_0x8a2b('0x25')](removeEntity(_0x2a3d46,null))['catch'](handleError(_0x2a3d46,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b6a8e07..f514fab 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 _0x813b=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash'];(function(_0x5cdff2,_0x178c4f){var _0x365490=function(_0xf2f380){while(--_0xf2f380){_0x5cdff2['push'](_0x5cdff2['shift']());}};_0x365490(++_0x178c4f);}(_0x813b,0x1af));var _0xb813=function(_0x2c7c1d,_0x5bdd21){_0x2c7c1d=_0x2c7c1d-0x0;var _0x37f3fb=_0x813b[_0x2c7c1d];return _0x37f3fb;};'use strict';var _=require(_0xb813('0x0'));var util=require(_0xb813('0x1'));var logger=require(_0xb813('0x2'))('api');var moment=require(_0xb813('0x3'));var BPromise=require('bluebird');var rp=require(_0xb813('0x4'));var fs=require('fs');var path=require(_0xb813('0x5'));var rimraf=require(_0xb813('0x6'));var config=require(_0xb813('0x7'));var attributes=require(_0xb813('0x8'));module['exports']=function(_0x129317,_0x2c1b1e){return _0x129317[_0xb813('0x9')](_0xb813('0xa'),attributes,{'tableName':_0xb813('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x470f=['./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x38c0d1,_0x56e89a){var _0x4dfa74=function(_0x4a2271){while(--_0x4a2271){_0x38c0d1['push'](_0x38c0d1['shift']());}};_0x4dfa74(++_0x56e89a);}(_0x470f,0x185));var _0xf470=function(_0x5241ba,_0x41a1d4){_0x5241ba=_0x5241ba-0x0;var _0x26e7c5=_0x470f[_0x5241ba];return _0x26e7c5;};'use strict';var _=require('lodash');var util=require(_0xf470('0x0'));var logger=require(_0xf470('0x1'))(_0xf470('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf470('0x3'));var fs=require('fs');var path=require(_0xf470('0x4'));var rimraf=require(_0xf470('0x5'));var config=require(_0xf470('0x6'));var attributes=require(_0xf470('0x7'));module[_0xf470('0x8')]=function(_0x3045c5,_0x4a5d01){return _0x3045c5[_0xf470('0x9')](_0xf470('0xa'),attributes,{'tableName':_0xf470('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 99906dc..5a635da 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 _0xb7b6=['then','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Integration,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x22f1dd,_0x51a08b){var _0x45b375=function(_0x72d64e){while(--_0x72d64e){_0x22f1dd['push'](_0x22f1dd['shift']());}};_0x45b375(++_0x51a08b);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x502de5,_0x33bb0f){_0x502de5=_0x502de5-0x0;var _0x30ddb4=_0xb7b6[_0x502de5];return _0x30ddb4;};'use strict';var _=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b7b('0x2'));var fs=require('fs');var Redis=require(_0x6b7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b7b('0x4'));var logger=require(_0x6b7b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b7b('0x6'));var client=jayson[_0x6b7b('0x7')][_0x6b7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xff519e,_0x24359f,_0x483b9c){return new BPromise(function(_0x49a6c8,_0x2bb86d){return client[_0x6b7b('0x9')](_0xff519e,_0x483b9c)[_0x6b7b('0xa')](function(_0x115f2d){logger['info']('Integration,\x20%s,\x20%s',_0x24359f,'request\x20sent');logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0x24359f,_0x6b7b('0xd'),JSON[_0x6b7b('0xe')](_0x115f2d));if(_0x115f2d[_0x6b7b('0xf')]){if(_0x115f2d[_0x6b7b('0xf')]['code']===0x1f4){logger[_0x6b7b('0xf')](_0x6b7b('0x10'),_0x24359f,_0x115f2d['error'][_0x6b7b('0x11')]);return _0x2bb86d(_0x115f2d[_0x6b7b('0xf')]['message']);}logger[_0x6b7b('0xf')]('Integration,\x20%s,\x20%s',_0x24359f,_0x115f2d[_0x6b7b('0xf')][_0x6b7b('0x11')]);return _0x49a6c8(_0x115f2d[_0x6b7b('0xf')]['message']);}else{logger['info'](_0x6b7b('0x10'),_0x24359f,'request\x20sent');_0x49a6c8(_0x115f2d['result'][_0x6b7b('0x11')]);}})[_0x6b7b('0x12')](function(_0x4ef35b){logger[_0x6b7b('0xf')](_0x6b7b('0x10'),_0x24359f,_0x4ef35b);_0x2bb86d(_0x4ef35b);});});} \ No newline at end of file +var _0xc492=['jayson/promise','http','request','then','info','request\x20sent','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc'];(function(_0x5a3bb9,_0x5180f6){var _0x2f76b7=function(_0x2ca84d){while(--_0x2ca84d){_0x5a3bb9['push'](_0x5a3bb9['shift']());}};_0x2f76b7(++_0x5180f6);}(_0xc492,0xd7));var _0x2c49=function(_0x50e933,_0x4a1370){_0x50e933=_0x50e933-0x0;var _0x4cd477=_0xc492[_0x50e933];return _0x4cd477;};'use strict';var _=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var moment=require(_0x2c49('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c49('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c49('0x4'))(_0x2c49('0x5'));var config=require('../../config/environment');var jayson=require(_0x2c49('0x6'));var client=jayson['client'][_0x2c49('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9c10f7,_0x4c76dd,_0xe7b4cb){return new BPromise(function(_0x17f596,_0x26f8c1){return client[_0x2c49('0x8')](_0x9c10f7,_0xe7b4cb)[_0x2c49('0x9')](function(_0x5684e5){logger[_0x2c49('0xa')]('Integration,\x20%s,\x20%s',_0x4c76dd,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x4c76dd,_0x2c49('0xb'),JSON['stringify'](_0x5684e5));if(_0x5684e5[_0x2c49('0xc')]){if(_0x5684e5[_0x2c49('0xc')]['code']===0x1f4){logger[_0x2c49('0xc')](_0x2c49('0xd'),_0x4c76dd,_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);return _0x26f8c1(_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);}logger['error'](_0x2c49('0xd'),_0x4c76dd,_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);return _0x17f596(_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);}else{logger['info'](_0x2c49('0xd'),_0x4c76dd,_0x2c49('0xb'));_0x17f596(_0x5684e5[_0x2c49('0xf')][_0x2c49('0xe')]);}})[_0x2c49('0x10')](function(_0x88e972){logger[_0x2c49('0xc')](_0x2c49('0xd'),_0x4c76dd,_0x88e972);_0x26f8c1(_0x88e972);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4114961..15aef72 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 _0x54aa=['describe','/:id','isAuthenticated','show','post','create','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe'];(function(_0x20a919,_0x58a7eb){var _0x151f54=function(_0x11a401){while(--_0x11a401){_0x20a919['push'](_0x20a919['shift']());}};_0x151f54(++_0x58a7eb);}(_0x54aa,0x116));var _0xa54a=function(_0x1f4765,_0x5425ed){_0x1f4765=_0x1f4765-0x0;var _0x311da9=_0x54aa[_0x1f4765];return _0x311da9;};'use strict';var multer=require(_0xa54a('0x0'));var util=require(_0xa54a('0x1'));var path=require(_0xa54a('0x2'));var timeout=require(_0xa54a('0x3'));var express=require('express');var router=express[_0xa54a('0x4')]();var auth=require(_0xa54a('0x5'));var interaction=require(_0xa54a('0x6'));var config=require('../../config/environment');var controller=require(_0xa54a('0x7'));router[_0xa54a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa54a('0x8')](_0xa54a('0x9'),auth['isAuthenticated'](),controller[_0xa54a('0xa')]);router[_0xa54a('0x8')](_0xa54a('0xb'),auth[_0xa54a('0xc')](),controller[_0xa54a('0xd')]);router[_0xa54a('0xe')]('/',auth[_0xa54a('0xc')](),controller[_0xa54a('0xf')]);router['put'](_0xa54a('0xb'),auth[_0xa54a('0xc')](),controller[_0xa54a('0x10')]);router[_0xa54a('0x11')]('/:id',auth[_0xa54a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x39cb=['../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','show','post','update','delete','/:id','destroy','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x5814ea,_0x4a517){var _0x5a4a6c=function(_0xbb30e8){while(--_0xbb30e8){_0x5814ea['push'](_0x5814ea['shift']());}};_0x5a4a6c(++_0x4a517);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'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 auth=require('../../components/auth/service');var interaction=require(_0xb39c('0x4'));var config=require(_0xb39c('0x5'));var controller=require(_0xb39c('0x6'));router[_0xb39c('0x7')]('/',auth[_0xb39c('0x8')](),controller['index']);router[_0xb39c('0x7')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller[_0xb39c('0xa')]);router['get']('/:id',auth[_0xb39c('0x8')](),controller[_0xb39c('0xb')]);router[_0xb39c('0xc')]('/',auth[_0xb39c('0x8')](),controller['create']);router['put']('/:id',auth[_0xb39c('0x8')](),controller[_0xb39c('0xd')]);router[_0xb39c('0xe')](_0xb39c('0xf'),auth[_0xb39c('0x8')](),controller[_0xb39c('0x10')]);module[_0xb39c('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index ef1231e..2336a6e 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 _0x60fd=['TEXT','ENUM','SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4d38b0,_0x154f85){var _0x2bbe27=function(_0x400c98){while(--_0x400c98){_0x4d38b0['push'](_0x4d38b0['shift']());}};_0x2bbe27(++_0x154f85);}(_0x60fd,0x19a));var _0xd60f=function(_0x56d112,_0x2f5534){_0x56d112=_0x56d112-0x0;var _0x1cdf82=_0x60fd[_0x56d112];return _0x1cdf82;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0xd60f('0x0')]},'eventChannel':{'type':Sequelize[_0xd60f('0x0')]},'exitStatus':{'type':Sequelize[_0xd60f('0x0')]},'ticketId':{'type':Sequelize[_0xd60f('0x0')]},'integrationId':{'type':Sequelize[_0xd60f('0x1')]},'contacts':{'type':Sequelize[_0xd60f('0x0')]},'uniqueid':{'type':Sequelize[_0xd60f('0x0')]},'calleridnum':{'type':Sequelize[_0xd60f('0x0')]},'calleridname':{'type':Sequelize[_0xd60f('0x0')]},'queue':{'type':Sequelize[_0xd60f('0x0')]},'interface':{'type':Sequelize[_0xd60f('0x0')]},'membername':{'type':Sequelize[_0xd60f('0x0')]},'agentcalledAt':{'type':Sequelize[_0xd60f('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd60f('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd60f('0x2')]},'talktime':{'type':Sequelize[_0xd60f('0x1')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd60f('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd60f('0x2')]},'agentdump':{'type':Sequelize[_0xd60f('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd60f('0x2')]},'lastevent':{'type':Sequelize[_0xd60f('0x0')]},'channel':{'type':Sequelize[_0xd60f('0x0')]},'channelstate':{'type':Sequelize[_0xd60f('0x1')]},'channelstatedesc':{'type':Sequelize[_0xd60f('0x0')]},'connectedlinenum':{'type':Sequelize[_0xd60f('0x0')]},'connectedlinename':{'type':Sequelize[_0xd60f('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd60f('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd60f('0x0')]},'priority':{'type':Sequelize[_0xd60f('0x0')]},'destchannel':{'type':Sequelize[_0xd60f('0x0')]},'destchannelstate':{'type':Sequelize[_0xd60f('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd60f('0x0')]},'destcalleridname':{'type':Sequelize[_0xd60f('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xd60f('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xd60f('0x0')]},'destlanguage':{'type':Sequelize[_0xd60f('0x0')]},'destaccountcode':{'type':Sequelize[_0xd60f('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd60f('0x0')]},'destpriority':{'type':Sequelize[_0xd60f('0x0')]},'destuniqueid':{'type':Sequelize[_0xd60f('0x0')]},'messageId':{'type':Sequelize[_0xd60f('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd60f('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd60f('0x0')]},'attachment':{'type':Sequelize[_0xd60f('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xd60f('0x5')]('SENT',_0xd60f('0x6'),_0xd60f('0x7'),_0xd60f('0x8'))},'url':{'type':Sequelize[_0xd60f('0x0')]},'app':{'type':Sequelize[_0xd60f('0x0')]},'appdata':{'type':Sequelize[_0xd60f('0x0')]},'projectId':{'type':Sequelize[_0xd60f('0x1')]}}; \ No newline at end of file +var _0x1a08=['RECEIVED','FAILED','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','SENDING'];(function(_0x46fc1e,_0x2cab53){var _0x5d033f=function(_0x601672){while(--_0x601672){_0x46fc1e['push'](_0x46fc1e['shift']());}};_0x5d033f(++_0x2cab53);}(_0x1a08,0x80));var _0x81a0=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x1a08[_0x3b90ab];return _0x206e92;};'use strict';var Sequelize=require('sequelize');module[_0x81a0('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x81a0('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x81a0('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x81a0('0x1')]},'uniqueid':{'type':Sequelize[_0x81a0('0x1')]},'calleridnum':{'type':Sequelize[_0x81a0('0x1')]},'calleridname':{'type':Sequelize[_0x81a0('0x1')]},'queue':{'type':Sequelize[_0x81a0('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x81a0('0x2')]},'agentconnectAt':{'type':Sequelize[_0x81a0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x81a0('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x81a0('0x2')]},'talktime':{'type':Sequelize[_0x81a0('0x4')]},'agentacw':{'type':Sequelize[_0x81a0('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x81a0('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x81a0('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x81a0('0x2')]},'agentdump':{'type':Sequelize[_0x81a0('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x81a0('0x1')]},'channelstate':{'type':Sequelize[_0x81a0('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x81a0('0x1')]},'connectedlinename':{'type':Sequelize[_0x81a0('0x1')]},'language':{'type':Sequelize[_0x81a0('0x1')]},'accountcode':{'type':Sequelize[_0x81a0('0x1')]},'context':{'type':Sequelize[_0x81a0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x81a0('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x81a0('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x81a0('0x1')]},'destcalleridnum':{'type':Sequelize[_0x81a0('0x1')]},'destcalleridname':{'type':Sequelize[_0x81a0('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x81a0('0x1')]},'destlanguage':{'type':Sequelize[_0x81a0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x81a0('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x81a0('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x81a0('0x1')]},'inReplyTo':{'type':Sequelize[_0x81a0('0x1')]},'subject':{'type':Sequelize[_0x81a0('0x1')]},'from':{'type':Sequelize[_0x81a0('0x1')]},'to':{'type':Sequelize[_0x81a0('0x1')]},'cc':{'type':Sequelize[_0x81a0('0x1')]},'attachment':{'type':Sequelize[_0x81a0('0x5')]},'html':{'type':Sequelize[_0x81a0('0x5')]},'text':{'type':Sequelize[_0x81a0('0x5')]},'status':{'type':Sequelize['ENUM']('SENT',_0x81a0('0x6'),_0x81a0('0x7'),_0x81a0('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x81a0('0x1')]},'projectId':{'type':Sequelize[_0x81a0('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9778cfe..03b3a1e 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 _0x3f3e=['describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','include','rows','catch','show','params','fields','includeAll','options','find','body','destroy'];(function(_0x3460c9,_0x565510){var _0x1d8283=function(_0x8a51bd){while(--_0x8a51bd){_0x3460c9['push'](_0x3460c9['shift']());}};_0x1d8283(++_0x565510);}(_0x3f3e,0x1b1));var _0xe3f3=function(_0x8fca0e,_0x3c5174){_0x8fca0e=_0x8fca0e-0x0;var _0x160c9b=_0x3f3e[_0x8fca0e];return _0x160c9b;};'use strict';var pdf=require(_0xe3f3('0x0'));var emlformat=require(_0xe3f3('0x1'));var rimraf=require(_0xe3f3('0x2'));var zipdir=require(_0xe3f3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3f3('0x4'));var moment=require(_0xe3f3('0x5'));var BPromise=require(_0xe3f3('0x6'));var Mustache=require('mustache');var util=require(_0xe3f3('0x7'));var path=require(_0xe3f3('0x8'));var sox=require(_0xe3f3('0x9'));var csv=require(_0xe3f3('0xa'));var ejs=require(_0xe3f3('0xb'));var fs=require('fs');var _=require(_0xe3f3('0xc'));var squel=require('squel');var crypto=require(_0xe3f3('0xd'));var jsforce=require(_0xe3f3('0xe'));var deskjs=require(_0xe3f3('0xf'));var toCsv=require(_0xe3f3('0xa'));var querystring=require(_0xe3f3('0x10'));var Papa=require('papaparse');var Redis=require(_0xe3f3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe3f3('0x12'));var as=require(_0xe3f3('0x13'));var hardwareService=require(_0xe3f3('0x14'));var logger=require(_0xe3f3('0x15'))('api');var utils=require(_0xe3f3('0x16'));var config=require(_0xe3f3('0x17'));var licenseUtil=require(_0xe3f3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x347488,_0x3953db){_0x3953db=_0x3953db||0xcc;return function(_0x52e689){if(_0x52e689){return _0x347488[_0xe3f3('0x19')](_0x3953db);}return _0x347488[_0xe3f3('0x1a')](_0x3953db)[_0xe3f3('0x1b')]();};}function respondWithResult(_0x395190,_0x346ad3){_0x346ad3=_0x346ad3||0xc8;return function(_0x983653){if(_0x983653){return _0x395190[_0xe3f3('0x1a')](_0x346ad3)[_0xe3f3('0x1c')](_0x983653);}};}function respondWithFilteredResult(_0x820e9,_0x2b3b92){return function(_0x4fade2){if(_0x4fade2){var _0x53a2f3=_0x4fade2[_0xe3f3('0x1d')],_0x23cf6d=_0x2b3b92['offset'],_0x5a4db8=_0x2b3b92[_0xe3f3('0x1e')]+_0x2b3b92[_0xe3f3('0x1f')],_0x46302a;if(_0x5a4db8>=_0x53a2f3){_0x5a4db8=_0x53a2f3;_0x46302a=0xc8;}else{_0x46302a=0xce;}_0x820e9[_0xe3f3('0x1a')](_0x46302a);return _0x820e9['set'](_0xe3f3('0x20'),_0x23cf6d+'-'+_0x5a4db8+'/'+_0x53a2f3)['json'](_0x4fade2);}return null;};}function patchUpdates(_0x5a220e){return function(_0x53cb3f){try{jsonpatch[_0xe3f3('0x21')](_0x53cb3f,_0x5a220e,!![]);}catch(_0x4f0b23){return BPromise[_0xe3f3('0x22')](_0x4f0b23);}return _0x53cb3f[_0xe3f3('0x23')]();};}function saveUpdates(_0xc694f5,_0x11bf25){return function(_0x40447b){if(_0x40447b){return _0x40447b[_0xe3f3('0x24')](_0xc694f5)['then'](function(_0x2589fc){return _0x2589fc;});}return null;};}function removeEntity(_0xb41c63,_0x183f10){return function(_0x56188b){if(_0x56188b){return _0x56188b['destroy']()[_0xe3f3('0x25')](function(){_0xb41c63[_0xe3f3('0x1a')](0xcc)[_0xe3f3('0x1b')]();});}};}function handleEntityNotFound(_0x8b9f80,_0x294e94){return function(_0x4fad1a){if(!_0x4fad1a){_0x8b9f80[_0xe3f3('0x19')](0x194);}return _0x4fad1a;};}function handleError(_0x2b7898,_0x192c75){_0x192c75=_0x192c75||0x1f4;return function(_0x313485){logger[_0xe3f3('0x26')](_0x313485['stack']);if(_0x313485[_0xe3f3('0x27')]){delete _0x313485['name'];}_0x2b7898[_0xe3f3('0x1a')](_0x192c75)[_0xe3f3('0x28')](_0x313485);};}exports['index']=function(_0xfade04,_0x49e2d9){var _0x138d34={},_0x357929={},_0xb54f1c={'count':0x0,'rows':[]};var _0x276658=_[_0xe3f3('0x29')](db[_0xe3f3('0x2a')][_0xe3f3('0x2b')],function(_0x596a73){return{'name':_0x596a73[_0xe3f3('0x2c')],'type':_0x596a73['type'][_0xe3f3('0x2d')]};});_0x357929[_0xe3f3('0x2e')]=_[_0xe3f3('0x29')](_0x276658,_0xe3f3('0x27'));_0x357929[_0xe3f3('0x2f')]=_[_0xe3f3('0x30')](_0xfade04[_0xe3f3('0x2f')]);_0x357929['filters']=_[_0xe3f3('0x31')](_0x357929['model'],_0x357929[_0xe3f3('0x2f')]);_0x138d34[_0xe3f3('0x32')]=_[_0xe3f3('0x31')](_0x357929[_0xe3f3('0x2e')],qs['fields'](_0xfade04[_0xe3f3('0x2f')]['fields']));_0x138d34[_0xe3f3('0x32')]=_0x138d34[_0xe3f3('0x32')][_0xe3f3('0x33')]?_0x138d34[_0xe3f3('0x32')]:_0x357929[_0xe3f3('0x2e')];if(!_0xfade04[_0xe3f3('0x2f')][_0xe3f3('0x34')](_0xe3f3('0x35'))){_0x138d34[_0xe3f3('0x1f')]=qs[_0xe3f3('0x1f')](_0xfade04[_0xe3f3('0x2f')][_0xe3f3('0x1f')]);_0x138d34[_0xe3f3('0x1e')]=qs[_0xe3f3('0x1e')](_0xfade04[_0xe3f3('0x2f')][_0xe3f3('0x1e')]);}_0x138d34[_0xe3f3('0x36')]=qs[_0xe3f3('0x37')](_0xfade04['query'][_0xe3f3('0x37')]);_0x138d34[_0xe3f3('0x38')]=qs[_0xe3f3('0x39')](_['pick'](_0xfade04[_0xe3f3('0x2f')],_0x357929[_0xe3f3('0x39')]),_0x276658);if(_0xfade04['query'][_0xe3f3('0x3a')]){_0x138d34[_0xe3f3('0x38')]=_['merge'](_0x138d34[_0xe3f3('0x38')],{'$or':_[_0xe3f3('0x29')](_0x276658,function(_0x3ef741){if(_0x3ef741['type']!=='VIRTUAL'){var _0x4f5275={};_0x4f5275[_0x3ef741[_0xe3f3('0x27')]]={'$like':'%'+_0xfade04['query'][_0xe3f3('0x3a')]+'%'};return _0x4f5275;}})});}_0x138d34=_[_0xe3f3('0x3b')]({},_0x138d34,_0xfade04['options']);var _0x435f8a={'where':_0x138d34[_0xe3f3('0x38')]};return db[_0xe3f3('0x2a')][_0xe3f3('0x1d')](_0x435f8a)[_0xe3f3('0x25')](function(_0x1b46a1){_0xb54f1c['count']=_0x1b46a1;if(_0xfade04[_0xe3f3('0x2f')]['includeAll']){_0x138d34[_0xe3f3('0x3c')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x138d34);})[_0xe3f3('0x25')](function(_0x3170cf){_0xb54f1c[_0xe3f3('0x3d')]=_0x3170cf;return _0xb54f1c;})['then'](respondWithFilteredResult(_0x49e2d9,_0x138d34))[_0xe3f3('0x3e')](handleError(_0x49e2d9,null));};exports[_0xe3f3('0x3f')]=function(_0x4db6da,_0x27ebf0){var _0x265527={'raw':![],'where':{'id':_0x4db6da[_0xe3f3('0x40')]['id']}},_0x416069={};_0x416069[_0xe3f3('0x2e')]=_['keys'](db[_0xe3f3('0x2a')][_0xe3f3('0x2b')]);_0x416069[_0xe3f3('0x2f')]=_[_0xe3f3('0x30')](_0x4db6da[_0xe3f3('0x2f')]);_0x416069[_0xe3f3('0x39')]=_[_0xe3f3('0x31')](_0x416069[_0xe3f3('0x2e')],_0x416069[_0xe3f3('0x2f')]);_0x265527['attributes']=_['intersection'](_0x416069[_0xe3f3('0x2e')],qs[_0xe3f3('0x41')](_0x4db6da[_0xe3f3('0x2f')]['fields']));_0x265527[_0xe3f3('0x32')]=_0x265527[_0xe3f3('0x32')]['length']?_0x265527['attributes']:_0x416069[_0xe3f3('0x2e')];if(_0x4db6da['query'][_0xe3f3('0x42')]){_0x265527[_0xe3f3('0x3c')]=[{'all':!![]}];}_0x265527=_[_0xe3f3('0x3b')]({},_0x265527,_0x4db6da[_0xe3f3('0x43')]);return db['IntegrationReport'][_0xe3f3('0x44')](_0x265527)['then'](handleEntityNotFound(_0x27ebf0,null))['then'](respondWithResult(_0x27ebf0,null))[_0xe3f3('0x3e')](handleError(_0x27ebf0,null));};exports['create']=function(_0x3257ca,_0x188aa6){return db['IntegrationReport']['create'](_0x3257ca['body'],{})['then'](respondWithResult(_0x188aa6,0xc9))[_0xe3f3('0x3e')](handleError(_0x188aa6,null));};exports['update']=function(_0x24289c,_0x2cd644){if(_0x24289c['body']['id']){delete _0x24289c[_0xe3f3('0x45')]['id'];}return db[_0xe3f3('0x2a')][_0xe3f3('0x44')]({'where':{'id':_0x24289c['params']['id']}})[_0xe3f3('0x25')](handleEntityNotFound(_0x2cd644,null))[_0xe3f3('0x25')](saveUpdates(_0x24289c[_0xe3f3('0x45')],null))[_0xe3f3('0x25')](respondWithResult(_0x2cd644,null))[_0xe3f3('0x3e')](handleError(_0x2cd644,null));};exports[_0xe3f3('0x46')]=function(_0x5e4d70,_0x24663b){return db['IntegrationReport'][_0xe3f3('0x44')]({'where':{'id':_0x5e4d70[_0xe3f3('0x40')]['id']}})['then'](handleEntityNotFound(_0x24663b,null))['then'](removeEntity(_0x24663b,null))[_0xe3f3('0x3e')](handleError(_0x24663b,null));};exports[_0xe3f3('0x47')]=function(_0x39d123,_0x205d1a){return db['IntegrationReport'][_0xe3f3('0x47')]()[_0xe3f3('0x25')](respondWithResult(_0x205d1a,null))[_0xe3f3('0x3e')](handleError(_0x205d1a,null));}; \ No newline at end of file +var _0x66d2=['order','sort','where','pick','filter','merge','type','options','includeAll','include','IntegrationReport','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset'];(function(_0x59e174,_0x43a286){var _0x2d581f=function(_0xfdc0a9){while(--_0xfdc0a9){_0x59e174['push'](_0x59e174['shift']());}};_0x2d581f(++_0x43a286);}(_0x66d2,0x1da));var _0x266d=function(_0x4aa1ee,_0x4087f7){_0x4aa1ee=_0x4aa1ee-0x0;var _0x13a95b=_0x66d2[_0x4aa1ee];return _0x13a95b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x266d('0x0'));var rimraf=require(_0x266d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x266d('0x2'));var rp=require(_0x266d('0x3'));var moment=require('moment');var BPromise=require(_0x266d('0x4'));var Mustache=require(_0x266d('0x5'));var util=require('util');var path=require(_0x266d('0x6'));var sox=require('sox');var csv=require(_0x266d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x266d('0x8'));var squel=require('squel');var crypto=require(_0x266d('0x9'));var jsforce=require(_0x266d('0xa'));var deskjs=require(_0x266d('0xb'));var toCsv=require(_0x266d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x266d('0xc'));var qs=require(_0x266d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x266d('0xe'));var logger=require(_0x266d('0xf'))(_0x266d('0x10'));var utils=require('../../config/utils');var config=require(_0x266d('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3faef6,_0x1d8061){_0x1d8061=_0x1d8061||0xcc;return function(_0x4d87a0){if(_0x4d87a0){return _0x3faef6[_0x266d('0x12')](_0x1d8061);}return _0x3faef6[_0x266d('0x13')](_0x1d8061)[_0x266d('0x14')]();};}function respondWithResult(_0x8f79b7,_0x8dcfd2){_0x8dcfd2=_0x8dcfd2||0xc8;return function(_0x3bae4a){if(_0x3bae4a){return _0x8f79b7['status'](_0x8dcfd2)[_0x266d('0x15')](_0x3bae4a);}};}function respondWithFilteredResult(_0x5a609b,_0x3fd282){return function(_0xf59b29){if(_0xf59b29){var _0x134e9c=_0xf59b29[_0x266d('0x16')],_0x52f97d=_0x3fd282['offset'],_0x3ef94f=_0x3fd282['offset']+_0x3fd282['limit'],_0x82f118;if(_0x3ef94f>=_0x134e9c){_0x3ef94f=_0x134e9c;_0x82f118=0xc8;}else{_0x82f118=0xce;}_0x5a609b['status'](_0x82f118);return _0x5a609b[_0x266d('0x17')](_0x266d('0x18'),_0x52f97d+'-'+_0x3ef94f+'/'+_0x134e9c)['json'](_0xf59b29);}return null;};}function patchUpdates(_0x35af3d){return function(_0x17fd21){try{jsonpatch[_0x266d('0x19')](_0x17fd21,_0x35af3d,!![]);}catch(_0xc21d5){return BPromise[_0x266d('0x1a')](_0xc21d5);}return _0x17fd21[_0x266d('0x1b')]();};}function saveUpdates(_0x2cd424,_0x29c6a9){return function(_0x23ee3a){if(_0x23ee3a){return _0x23ee3a['update'](_0x2cd424)[_0x266d('0x1c')](function(_0x2c4ad5){return _0x2c4ad5;});}return null;};}function removeEntity(_0x3f04cb,_0x478d2a){return function(_0x5da356){if(_0x5da356){return _0x5da356[_0x266d('0x1d')]()[_0x266d('0x1c')](function(){_0x3f04cb[_0x266d('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4050f0,_0x449c27){return function(_0x325023){if(!_0x325023){_0x4050f0[_0x266d('0x12')](0x194);}return _0x325023;};}function handleError(_0x1377ab,_0x3840f7){_0x3840f7=_0x3840f7||0x1f4;return function(_0x10888f){logger[_0x266d('0x1e')](_0x10888f['stack']);if(_0x10888f['name']){delete _0x10888f[_0x266d('0x1f')];}_0x1377ab[_0x266d('0x13')](_0x3840f7)['send'](_0x10888f);};}exports[_0x266d('0x20')]=function(_0x270a66,_0x18bb9d){var _0x5549e5={},_0x426405={},_0x184101={'count':0x0,'rows':[]};var _0x478341=_[_0x266d('0x21')](db['IntegrationReport']['rawAttributes'],function(_0x480e3c){return{'name':_0x480e3c[_0x266d('0x22')],'type':_0x480e3c['type']['key']};});_0x426405[_0x266d('0x23')]=_['map'](_0x478341,_0x266d('0x1f'));_0x426405[_0x266d('0x24')]=_[_0x266d('0x25')](_0x270a66['query']);_0x426405[_0x266d('0x26')]=_['intersection'](_0x426405['model'],_0x426405[_0x266d('0x24')]);_0x5549e5[_0x266d('0x27')]=_[_0x266d('0x28')](_0x426405[_0x266d('0x23')],qs[_0x266d('0x29')](_0x270a66[_0x266d('0x24')][_0x266d('0x29')]));_0x5549e5['attributes']=_0x5549e5[_0x266d('0x27')]['length']?_0x5549e5[_0x266d('0x27')]:_0x426405['model'];if(!_0x270a66[_0x266d('0x24')][_0x266d('0x2a')](_0x266d('0x2b'))){_0x5549e5[_0x266d('0x2c')]=qs['limit'](_0x270a66[_0x266d('0x24')][_0x266d('0x2c')]);_0x5549e5[_0x266d('0x2d')]=qs[_0x266d('0x2d')](_0x270a66['query'][_0x266d('0x2d')]);}_0x5549e5[_0x266d('0x2e')]=qs[_0x266d('0x2f')](_0x270a66[_0x266d('0x24')][_0x266d('0x2f')]);_0x5549e5[_0x266d('0x30')]=qs[_0x266d('0x26')](_[_0x266d('0x31')](_0x270a66['query'],_0x426405[_0x266d('0x26')]),_0x478341);if(_0x270a66[_0x266d('0x24')][_0x266d('0x32')]){_0x5549e5[_0x266d('0x30')]=_[_0x266d('0x33')](_0x5549e5['where'],{'$or':_[_0x266d('0x21')](_0x478341,function(_0x324167){if(_0x324167[_0x266d('0x34')]!=='VIRTUAL'){var _0x1e2325={};_0x1e2325[_0x324167[_0x266d('0x1f')]]={'$like':'%'+_0x270a66[_0x266d('0x24')][_0x266d('0x32')]+'%'};return _0x1e2325;}})});}_0x5549e5=_['merge']({},_0x5549e5,_0x270a66[_0x266d('0x35')]);var _0x55f850={'where':_0x5549e5[_0x266d('0x30')]};return db['IntegrationReport'][_0x266d('0x16')](_0x55f850)[_0x266d('0x1c')](function(_0x4cf985){_0x184101[_0x266d('0x16')]=_0x4cf985;if(_0x270a66[_0x266d('0x24')][_0x266d('0x36')]){_0x5549e5[_0x266d('0x37')]=[{'all':!![]}];}return db[_0x266d('0x38')]['findAll'](_0x5549e5);})[_0x266d('0x1c')](function(_0x885262){_0x184101[_0x266d('0x39')]=_0x885262;return _0x184101;})[_0x266d('0x1c')](respondWithFilteredResult(_0x18bb9d,_0x5549e5))[_0x266d('0x3a')](handleError(_0x18bb9d,null));};exports['show']=function(_0x133e76,_0x5577e7){var _0xc91ab7={'raw':![],'where':{'id':_0x133e76[_0x266d('0x3b')]['id']}},_0x4f63d1={};_0x4f63d1[_0x266d('0x23')]=_[_0x266d('0x25')](db[_0x266d('0x38')]['rawAttributes']);_0x4f63d1[_0x266d('0x24')]=_['keys'](_0x133e76[_0x266d('0x24')]);_0x4f63d1[_0x266d('0x26')]=_[_0x266d('0x28')](_0x4f63d1[_0x266d('0x23')],_0x4f63d1['query']);_0xc91ab7['attributes']=_[_0x266d('0x28')](_0x4f63d1[_0x266d('0x23')],qs[_0x266d('0x29')](_0x133e76[_0x266d('0x24')]['fields']));_0xc91ab7[_0x266d('0x27')]=_0xc91ab7['attributes'][_0x266d('0x3c')]?_0xc91ab7[_0x266d('0x27')]:_0x4f63d1[_0x266d('0x23')];if(_0x133e76[_0x266d('0x24')][_0x266d('0x36')]){_0xc91ab7[_0x266d('0x37')]=[{'all':!![]}];}_0xc91ab7=_[_0x266d('0x33')]({},_0xc91ab7,_0x133e76[_0x266d('0x35')]);return db[_0x266d('0x38')][_0x266d('0x3d')](_0xc91ab7)['then'](handleEntityNotFound(_0x5577e7,null))[_0x266d('0x1c')](respondWithResult(_0x5577e7,null))['catch'](handleError(_0x5577e7,null));};exports['create']=function(_0x19071f,_0x2d482e){return db['IntegrationReport'][_0x266d('0x3e')](_0x19071f[_0x266d('0x3f')],{})['then'](respondWithResult(_0x2d482e,0xc9))[_0x266d('0x3a')](handleError(_0x2d482e,null));};exports['update']=function(_0x434147,_0x23a56e){if(_0x434147['body']['id']){delete _0x434147[_0x266d('0x3f')]['id'];}return db[_0x266d('0x38')]['find']({'where':{'id':_0x434147[_0x266d('0x3b')]['id']}})[_0x266d('0x1c')](handleEntityNotFound(_0x23a56e,null))['then'](saveUpdates(_0x434147['body'],null))[_0x266d('0x1c')](respondWithResult(_0x23a56e,null))[_0x266d('0x3a')](handleError(_0x23a56e,null));};exports[_0x266d('0x1d')]=function(_0x2ff420,_0xa3b208){return db[_0x266d('0x38')][_0x266d('0x3d')]({'where':{'id':_0x2ff420['params']['id']}})['then'](handleEntityNotFound(_0xa3b208,null))[_0x266d('0x1c')](removeEntity(_0xa3b208,null))[_0x266d('0x3a')](handleError(_0xa3b208,null));};exports['describe']=function(_0x135b4c,_0x2fab70){return db[_0x266d('0x38')][_0x266d('0x40')]()[_0x266d('0x1c')](respondWithResult(_0x2fab70,null))[_0x266d('0x3a')](handleError(_0x2fab70,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 4463149..8282506 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 _0x5210=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash'];(function(_0x40af0b,_0x4795fe){var _0xe3de8e=function(_0x50bc27){while(--_0x50bc27){_0x40af0b['push'](_0x40af0b['shift']());}};_0xe3de8e(++_0x4795fe);}(_0x5210,0x1ee));var _0x0521=function(_0x5d9179,_0x244d3d){_0x5d9179=_0x5d9179-0x0;var _0x4dfa25=_0x5210[_0x5d9179];return _0x4dfa25;};'use strict';var _=require(_0x0521('0x0'));var util=require('util');var logger=require(_0x0521('0x1'))('api');var moment=require(_0x0521('0x2'));var BPromise=require('bluebird');var rp=require(_0x0521('0x3'));var fs=require('fs');var path=require(_0x0521('0x4'));var rimraf=require(_0x0521('0x5'));var config=require(_0x0521('0x6'));var attributes=require(_0x0521('0x7'));module['exports']=function(_0x1dca34,_0x2a0297){return _0x1dca34[_0x0521('0x8')](_0x0521('0x9'),attributes,{'tableName':_0x0521('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfbc=['./integrationReport.attributes','IntegrationReport','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x25f59d,_0x40563f){var _0x164cd1=function(_0x596e98){while(--_0x596e98){_0x25f59d['push'](_0x25f59d['shift']());}};_0x164cd1(++_0x40563f);}(_0xbfbc,0x1ba));var _0xcbfb=function(_0x396dd8,_0x233657){_0x396dd8=_0x396dd8-0x0;var _0x35da1d=_0xbfbc[_0x396dd8];return _0x35da1d;};'use strict';var _=require('lodash');var util=require(_0xcbfb('0x0'));var logger=require(_0xcbfb('0x1'))(_0xcbfb('0x2'));var moment=require(_0xcbfb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbfb('0x4'));var rimraf=require('rimraf');var config=require(_0xcbfb('0x5'));var attributes=require(_0xcbfb('0x6'));module['exports']=function(_0x507dfd,_0x401c6a){return _0x507dfd['define'](_0xcbfb('0x7'),attributes,{'tableName':'report_integration','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 e036f5d..949dec4 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 _0xbaf0=['client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x540a2c,_0x197b53){var _0x498326=function(_0x1c8e1f){while(--_0x1c8e1f){_0x540a2c['push'](_0x540a2c['shift']());}};_0x498326(++_0x197b53);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0xb10b[_0x2e2c1b];return _0x43a4f2;};'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);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 37b7b11..73311f1 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 _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x311bbd,_0x2a49eb){var _0x4f9e51=function(_0x413e28){while(--_0x413e28){_0x311bbd['push'](_0x311bbd['shift']());}};_0x4f9e51(++_0x2a49eb);}(_0x008c,0x188));var _0xc008=function(_0x501f4d,_0x51b9d9){_0x501f4d=_0x501f4d-0x0;var _0x199d85=_0x008c[_0x501f4d];return _0x199d85;};'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 auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file +var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x201030,_0x48e372){var _0x29c3b1=function(_0x3e3a38){while(--_0x3e3a38){_0x201030['push'](_0x201030['shift']());}};_0x29c3b1(++_0x48e372);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f4fad94..52433be 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 _0x3021=['sequelize','exports','STRING'];(function(_0x457ca6,_0x1edad8){var _0x32a931=function(_0x339827){while(--_0x339827){_0x457ca6['push'](_0x457ca6['shift']());}};_0x32a931(++_0x1edad8);}(_0x3021,0x81));var _0x1302=function(_0x16f57a,_0x3c2da7){_0x16f57a=_0x16f57a-0x0;var _0x15a426=_0x3021[_0x16f57a];return _0x15a426;};'use strict';var Sequelize=require(_0x1302('0x0'));module[_0x1302('0x1')]={'name':{'type':Sequelize[_0x1302('0x2')]},'description':{'type':Sequelize[_0x1302('0x2')]},'interval':{'type':Sequelize[_0x1302('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9738=['sequelize','exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9738,0xb4));var _0x8973=function(_0xd64d78,_0x50ef0b){_0xd64d78=_0xd64d78-0x0;var _0x48402a=_0x9738[_0xd64d78];return _0x48402a;};'use strict';var Sequelize=require(_0x8973('0x0'));module[_0x8973('0x1')]={'name':{'type':Sequelize[_0x8973('0x2')]},'description':{'type':Sequelize[_0x8973('0x2')]},'interval':{'type':Sequelize[_0x8973('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c857723..58caf74 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 _0x4876=['order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','rawAttributes','type','model','intersection','query','fields','attributes','length','hasOwnProperty'];(function(_0xbc1b9e,_0x331ff5){var _0x28c6ad=function(_0x26b9a3){while(--_0x26b9a3){_0xbc1b9e['push'](_0xbc1b9e['shift']());}};_0x28c6ad(++_0x331ff5);}(_0x4876,0x181));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6487('0x0'));var rimraf=require(_0x6487('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6487('0x2'));var rp=require(_0x6487('0x3'));var moment=require(_0x6487('0x4'));var BPromise=require(_0x6487('0x5'));var Mustache=require(_0x6487('0x6'));var util=require('util');var path=require(_0x6487('0x7'));var sox=require(_0x6487('0x8'));var csv=require(_0x6487('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6487('0xa'));var deskjs=require(_0x6487('0xb'));var toCsv=require(_0x6487('0x9'));var querystring=require(_0x6487('0xc'));var Papa=require(_0x6487('0xd'));var Redis=require(_0x6487('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6487('0xf'));var as=require(_0x6487('0x10'));var hardwareService=require(_0x6487('0x11'));var logger=require(_0x6487('0x12'))(_0x6487('0x13'));var utils=require('../../config/utils');var config=require(_0x6487('0x14'));var licenseUtil=require(_0x6487('0x15'));var db=require(_0x6487('0x16'))['db'];var extensions=require(_0x6487('0x17'));function respondWithStatusCode(_0x5e61e0,_0x3e7e85){_0x3e7e85=_0x3e7e85||0xcc;return function(_0x27ba3f){if(_0x27ba3f){return _0x5e61e0['sendStatus'](_0x3e7e85);}return _0x5e61e0[_0x6487('0x18')](_0x3e7e85)[_0x6487('0x19')]();};}function respondWithResult(_0x139c4f,_0x480e24){_0x480e24=_0x480e24||0xc8;return function(_0x53268d){if(_0x53268d){return _0x139c4f[_0x6487('0x18')](_0x480e24)[_0x6487('0x1a')](_0x53268d);}};}function respondWithFilteredResult(_0xef2f2f,_0x2a02d5){return function(_0x27116b){if(_0x27116b){var _0x18ae1c=_0x27116b[_0x6487('0x1b')],_0x5e6d80=_0x2a02d5[_0x6487('0x1c')],_0x1e5667=_0x2a02d5[_0x6487('0x1c')]+_0x2a02d5[_0x6487('0x1d')],_0x3323ff;if(_0x1e5667>=_0x18ae1c){_0x1e5667=_0x18ae1c;_0x3323ff=0xc8;}else{_0x3323ff=0xce;}_0xef2f2f[_0x6487('0x18')](_0x3323ff);return _0xef2f2f['set'](_0x6487('0x1e'),_0x5e6d80+'-'+_0x1e5667+'/'+_0x18ae1c)[_0x6487('0x1a')](_0x27116b);}return null;};}function patchUpdates(_0x1d2153){return function(_0x41b7b7){try{jsonpatch[_0x6487('0x1f')](_0x41b7b7,_0x1d2153,!![]);}catch(_0x10543a){return BPromise[_0x6487('0x20')](_0x10543a);}return _0x41b7b7[_0x6487('0x21')]();};}function saveUpdates(_0x4522f4,_0x3b3c4){return function(_0x38df51){if(_0x38df51){return _0x38df51[_0x6487('0x22')](_0x4522f4)[_0x6487('0x23')](function(_0x53a90d){return _0x53a90d;});}return null;};}function removeEntity(_0x2fd3ed,_0x4887b3){return function(_0x15788c){if(_0x15788c){return _0x15788c[_0x6487('0x24')]()[_0x6487('0x23')](function(){var _0x41f001=_0x15788c[_0x6487('0x25')]({'plain':!![]});var _0x8fcebb=_0x6487('0x26');return db[_0x6487('0x27')][_0x6487('0x24')]({'where':{'type':_0x8fcebb,'resourceId':_0x41f001['id']}})['then'](function(){return _0x15788c;});})[_0x6487('0x23')](function(){_0x2fd3ed[_0x6487('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f032a,_0x353097){return function(_0x42e63f){if(!_0x42e63f){_0x1f032a['sendStatus'](0x194);}return _0x42e63f;};}function handleError(_0x4e0d2b,_0x3c01d1){_0x3c01d1=_0x3c01d1||0x1f4;return function(_0x1daced){logger[_0x6487('0x28')](_0x1daced['stack']);if(_0x1daced[_0x6487('0x29')]){delete _0x1daced[_0x6487('0x29')];}_0x4e0d2b[_0x6487('0x18')](_0x3c01d1)[_0x6487('0x2a')](_0x1daced);};}exports[_0x6487('0x2b')]=function(_0x303841,_0x4b8602){var _0x404c39={},_0x4a1944={},_0x2a9be1={'count':0x0,'rows':[]};var _0x1240ea=_[_0x6487('0x2c')](db[_0x6487('0x2d')][_0x6487('0x2e')],function(_0x242ffc){return{'name':_0x242ffc['fieldName'],'type':_0x242ffc[_0x6487('0x2f')]['key']};});_0x4a1944[_0x6487('0x30')]=_[_0x6487('0x2c')](_0x1240ea,_0x6487('0x29'));_0x4a1944['query']=_['keys'](_0x303841['query']);_0x4a1944['filters']=_[_0x6487('0x31')](_0x4a1944[_0x6487('0x30')],_0x4a1944[_0x6487('0x32')]);_0x404c39['attributes']=_[_0x6487('0x31')](_0x4a1944['model'],qs[_0x6487('0x33')](_0x303841[_0x6487('0x32')][_0x6487('0x33')]));_0x404c39[_0x6487('0x34')]=_0x404c39[_0x6487('0x34')][_0x6487('0x35')]?_0x404c39['attributes']:_0x4a1944[_0x6487('0x30')];if(!_0x303841['query'][_0x6487('0x36')]('nolimit')){_0x404c39[_0x6487('0x1d')]=qs[_0x6487('0x1d')](_0x303841[_0x6487('0x32')][_0x6487('0x1d')]);_0x404c39[_0x6487('0x1c')]=qs['offset'](_0x303841[_0x6487('0x32')][_0x6487('0x1c')]);}_0x404c39[_0x6487('0x37')]=qs[_0x6487('0x38')](_0x303841['query'][_0x6487('0x38')]);_0x404c39[_0x6487('0x39')]=qs[_0x6487('0x3a')](_[_0x6487('0x3b')](_0x303841[_0x6487('0x32')],_0x4a1944['filters']),_0x1240ea);if(_0x303841[_0x6487('0x32')][_0x6487('0x3c')]){_0x404c39[_0x6487('0x39')]=_[_0x6487('0x3d')](_0x404c39[_0x6487('0x39')],{'$or':_[_0x6487('0x2c')](_0x1240ea,function(_0x477989){if(_0x477989[_0x6487('0x2f')]!==_0x6487('0x3e')){var _0x61af9={};_0x61af9[_0x477989[_0x6487('0x29')]]={'$like':'%'+_0x303841[_0x6487('0x32')][_0x6487('0x3c')]+'%'};return _0x61af9;}})});}_0x404c39=_[_0x6487('0x3d')]({},_0x404c39,_0x303841['options']);var _0x4456ad={'where':_0x404c39[_0x6487('0x39')]};return db['Interval'][_0x6487('0x1b')](_0x4456ad)['then'](function(_0x3b0870){_0x2a9be1[_0x6487('0x1b')]=_0x3b0870;if(_0x303841[_0x6487('0x32')][_0x6487('0x3f')]){_0x404c39[_0x6487('0x40')]=[{'all':!![]}];}return db[_0x6487('0x2d')][_0x6487('0x41')](_0x404c39);})[_0x6487('0x23')](function(_0x645312){_0x2a9be1['rows']=_0x645312;return _0x2a9be1;})[_0x6487('0x23')](respondWithFilteredResult(_0x4b8602,_0x404c39))['catch'](handleError(_0x4b8602,null));};exports['show']=function(_0xa2ed07,_0x2cffdf){var _0x4bc441={'raw':!![],'where':{'id':_0xa2ed07[_0x6487('0x42')]['id']}},_0x2f7bb5={};_0x2f7bb5['model']=_[_0x6487('0x43')](db[_0x6487('0x2d')][_0x6487('0x2e')]);_0x2f7bb5[_0x6487('0x32')]=_['keys'](_0xa2ed07[_0x6487('0x32')]);_0x2f7bb5[_0x6487('0x3a')]=_[_0x6487('0x31')](_0x2f7bb5[_0x6487('0x30')],_0x2f7bb5[_0x6487('0x32')]);_0x4bc441[_0x6487('0x34')]=_['intersection'](_0x2f7bb5[_0x6487('0x30')],qs[_0x6487('0x33')](_0xa2ed07[_0x6487('0x32')][_0x6487('0x33')]));_0x4bc441[_0x6487('0x34')]=_0x4bc441['attributes']['length']?_0x4bc441[_0x6487('0x34')]:_0x2f7bb5[_0x6487('0x30')];if(_0xa2ed07[_0x6487('0x32')]['includeAll']){_0x4bc441['include']=[{'all':!![]}];}_0x4bc441=_[_0x6487('0x3d')]({},_0x4bc441,_0xa2ed07[_0x6487('0x44')]);return db[_0x6487('0x2d')][_0x6487('0x45')](_0x4bc441)[_0x6487('0x23')](handleEntityNotFound(_0x2cffdf,null))['then'](respondWithResult(_0x2cffdf,null))['catch'](handleError(_0x2cffdf,null));};exports[_0x6487('0x46')]=function(_0x23c9e7,_0x2e9e37){return db[_0x6487('0x2d')][_0x6487('0x46')](_0x23c9e7[_0x6487('0x47')],{})[_0x6487('0x23')](function(_0x4fb01f){var _0x48011a=_0x23c9e7['user'][_0x6487('0x25')]({'plain':!![]});if(!_0x48011a)throw new Error(_0x6487('0x48'));if(_0x48011a[_0x6487('0x49')]===_0x6487('0x4a')){var _0xae572=_0x4fb01f[_0x6487('0x25')]({'plain':!![]});var _0x19aa5f=_0x6487('0x26');return db[_0x6487('0x4b')]['find']({'where':{'name':_0x19aa5f,'userProfileId':_0x48011a[_0x6487('0x4c')]},'raw':!![]})[_0x6487('0x23')](function(_0x1a01bc){if(_0x1a01bc&&_0x1a01bc[_0x6487('0x4d')]===0x0){return db[_0x6487('0x27')][_0x6487('0x46')]({'name':_0xae572[_0x6487('0x29')],'resourceId':_0xae572['id'],'type':_0x1a01bc[_0x6487('0x29')],'sectionId':_0x1a01bc['id']},{})['then'](function(){return _0x4fb01f;});}else{return _0x4fb01f;}})['catch'](function(_0x19f449){logger[_0x6487('0x28')](_0x6487('0x4e'),_0x19f449);throw _0x19f449;});}return _0x4fb01f;})['then'](respondWithResult(_0x2e9e37,0xc9))[_0x6487('0x4f')](handleError(_0x2e9e37,null));};exports[_0x6487('0x22')]=function(_0x102494,_0x190265){if(_0x102494['body']['id']){delete _0x102494[_0x6487('0x47')]['id'];}return db[_0x6487('0x2d')][_0x6487('0x45')]({'where':{'id':_0x102494['params']['id']}})[_0x6487('0x23')](handleEntityNotFound(_0x190265,null))[_0x6487('0x23')](saveUpdates(_0x102494[_0x6487('0x47')],null))[_0x6487('0x23')](respondWithResult(_0x190265,null))[_0x6487('0x4f')](handleError(_0x190265,null));};exports['destroy']=function(_0x3f04f1,_0x38a79a){return db['Interval'][_0x6487('0x45')]({'where':{'id':_0x3f04f1['params']['id']}})[_0x6487('0x23')](handleEntityNotFound(_0x38a79a,null))[_0x6487('0x23')](removeEntity(_0x38a79a,null))[_0x6487('0x4f')](handleError(_0x38a79a,null));};exports[_0x6487('0x50')]=function(_0x4d8250,_0x1ad101,_0x16639b){if(_0x4d8250['body']['id']){delete _0x4d8250[_0x6487('0x47')]['id'];}return db['Interval'][_0x6487('0x45')]({'where':{'id':_0x4d8250[_0x6487('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ad101,null))['then'](function(_0x2c29a7){if(_0x2c29a7){_0x4d8250[_0x6487('0x47')][_0x6487('0x51')]=_0x2c29a7['id'];return db[_0x6487('0x2d')]['create'](_0x4d8250[_0x6487('0x47')]);}})[_0x6487('0x23')](respondWithResult(_0x1ad101,null))['catch'](handleError(_0x1ad101,null));};exports[_0x6487('0x52')]=function(_0x1708bb,_0x39f29f,_0xa6fb33){var _0x43678c={};var _0x3c2497={};var _0x1a5834;var _0x247477;return db[_0x6487('0x2d')][_0x6487('0x53')]({'where':{'id':_0x1708bb[_0x6487('0x42')]['id']}})[_0x6487('0x23')](handleEntityNotFound(_0x39f29f,null))[_0x6487('0x23')](function(_0x1fa51d){if(_0x1fa51d){_0x1a5834=_0x1fa51d;_0x3c2497[_0x6487('0x30')]=_[_0x6487('0x43')](db['Interval'][_0x6487('0x2e')]);_0x3c2497['query']=_[_0x6487('0x43')](_0x1708bb['query']);_0x3c2497['filters']=_[_0x6487('0x31')](_0x3c2497['model'],_0x3c2497['query']);_0x43678c[_0x6487('0x34')]=_[_0x6487('0x31')](_0x3c2497[_0x6487('0x30')],qs[_0x6487('0x33')](_0x1708bb['query'][_0x6487('0x33')]));_0x43678c[_0x6487('0x34')]=_0x43678c[_0x6487('0x34')][_0x6487('0x35')]?_0x43678c[_0x6487('0x34')]:_0x3c2497['model'];_0x43678c[_0x6487('0x37')]=qs['sort'](_0x1708bb[_0x6487('0x32')][_0x6487('0x38')]);_0x43678c['where']=qs['filters'](_[_0x6487('0x3b')](_0x1708bb[_0x6487('0x32')],_0x3c2497[_0x6487('0x3a')]));if(_0x1708bb[_0x6487('0x32')][_0x6487('0x3c')]){_0x43678c[_0x6487('0x39')]=_['merge'](_0x43678c[_0x6487('0x39')],{'$or':_[_0x6487('0x2c')](_0x43678c[_0x6487('0x34')],function(_0x40c47c){var _0x5f3424={};_0x5f3424[_0x40c47c]={'$like':'%'+_0x1708bb[_0x6487('0x32')]['filter']+'%'};return _0x5f3424;})});}_0x43678c=_['merge']({},_0x43678c,_0x1708bb[_0x6487('0x44')]);return _0x1a5834[_0x6487('0x52')](_0x43678c);}})[_0x6487('0x23')](function(_0x43e27a){if(_0x43e27a){_0x247477=_0x43e27a[_0x6487('0x35')];if(!_0x1708bb[_0x6487('0x32')]['hasOwnProperty'](_0x6487('0x54'))){_0x43678c['limit']=qs[_0x6487('0x1d')](_0x1708bb[_0x6487('0x32')][_0x6487('0x1d')]);_0x43678c[_0x6487('0x1c')]=qs[_0x6487('0x1c')](_0x1708bb[_0x6487('0x32')]['offset']);}return _0x1a5834[_0x6487('0x52')](_0x43678c);}})[_0x6487('0x23')](function(_0x47a819){if(_0x47a819){return _0x47a819?{'count':_0x247477,'rows':_0x47a819}:null;}})[_0x6487('0x23')](respondWithResult(_0x39f29f,null))['catch'](handleError(_0x39f29f,null));};exports[_0x6487('0x55')]=function(_0x28fb19,_0x796da2,_0x3f4b45){return db[_0x6487('0x2d')][_0x6487('0x53')]({'where':{'id':_0x28fb19['params']['id']}})[_0x6487('0x23')](handleEntityNotFound(_0x796da2,null))[_0x6487('0x23')](function(_0x179855){if(_0x179855){return db[_0x6487('0x56')][_0x6487('0x57')](function(_0x16c868){return db['Interval'][_0x6487('0x24')]({'where':{'IntervalId':_0x28fb19[_0x6487('0x42')]['id']},'transaction':_0x16c868})[_0x6487('0x23')](function(_0x4e4219){var _0x25cb58=_[_0x6487('0x2c')](_0x28fb19['body'],function(_0x35fb37){delete _0x35fb37['id'];_0x35fb37[_0x6487('0x51')]=_0x28fb19[_0x6487('0x42')]['id'];return _0x35fb37;});return db[_0x6487('0x2d')]['bulkCreate'](_0x25cb58,{'transaction':_0x16c868});});})[_0x6487('0x23')](function(){return db[_0x6487('0x2d')][_0x6487('0x41')]({'where':{'IntervalId':_0x28fb19[_0x6487('0x42')]['id']}});});}})['then'](respondWithResult(_0x796da2,null))[_0x6487('0x4f')](handleError(_0x796da2,null));}; \ No newline at end of file +var _0x6212=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Intervals','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','Interval','findAll','rows','catch','params','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x6212,0x1d2));var _0x2621=function(_0x1fd8cc,_0x133f3c){_0x1fd8cc=_0x1fd8cc-0x0;var _0x2df006=_0x6212[_0x1fd8cc];return _0x2df006;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2621('0x0'));var rimraf=require(_0x2621('0x1'));var zipdir=require(_0x2621('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2621('0x3'));var moment=require(_0x2621('0x4'));var BPromise=require(_0x2621('0x5'));var Mustache=require(_0x2621('0x6'));var util=require(_0x2621('0x7'));var path=require(_0x2621('0x8'));var sox=require(_0x2621('0x9'));var csv=require(_0x2621('0xa'));var ejs=require(_0x2621('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2621('0xc'));var crypto=require(_0x2621('0xd'));var jsforce=require(_0x2621('0xe'));var deskjs=require(_0x2621('0xf'));var toCsv=require(_0x2621('0xa'));var querystring=require(_0x2621('0x10'));var Papa=require(_0x2621('0x11'));var Redis=require(_0x2621('0x12'));var authService=require(_0x2621('0x13'));var qs=require(_0x2621('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2621('0x15'));var logger=require(_0x2621('0x16'))(_0x2621('0x17'));var utils=require(_0x2621('0x18'));var config=require(_0x2621('0x19'));var licenseUtil=require(_0x2621('0x1a'));var db=require(_0x2621('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x484b19,_0x27d0e5){_0x27d0e5=_0x27d0e5||0xcc;return function(_0x2faaeb){if(_0x2faaeb){return _0x484b19[_0x2621('0x1c')](_0x27d0e5);}return _0x484b19['status'](_0x27d0e5)[_0x2621('0x1d')]();};}function respondWithResult(_0x52b1c3,_0x5daeeb){_0x5daeeb=_0x5daeeb||0xc8;return function(_0x34f16f){if(_0x34f16f){return _0x52b1c3[_0x2621('0x1e')](_0x5daeeb)[_0x2621('0x1f')](_0x34f16f);}};}function respondWithFilteredResult(_0x1783e1,_0x5b58be){return function(_0x4ac7c8){if(_0x4ac7c8){var _0x23dee9=_0x4ac7c8[_0x2621('0x20')],_0x4c57fe=_0x5b58be['offset'],_0x4defc9=_0x5b58be[_0x2621('0x21')]+_0x5b58be[_0x2621('0x22')],_0x201f55;if(_0x4defc9>=_0x23dee9){_0x4defc9=_0x23dee9;_0x201f55=0xc8;}else{_0x201f55=0xce;}_0x1783e1[_0x2621('0x1e')](_0x201f55);return _0x1783e1[_0x2621('0x23')](_0x2621('0x24'),_0x4c57fe+'-'+_0x4defc9+'/'+_0x23dee9)[_0x2621('0x1f')](_0x4ac7c8);}return null;};}function patchUpdates(_0x547dcb){return function(_0x220993){try{jsonpatch[_0x2621('0x25')](_0x220993,_0x547dcb,!![]);}catch(_0x19c54a){return BPromise['reject'](_0x19c54a);}return _0x220993[_0x2621('0x26')]();};}function saveUpdates(_0xe299cd,_0x4e7b3d){return function(_0x19bfb1){if(_0x19bfb1){return _0x19bfb1['update'](_0xe299cd)[_0x2621('0x27')](function(_0x1906bf){return _0x1906bf;});}return null;};}function removeEntity(_0x149858,_0x22bf21){return function(_0x4fc976){if(_0x4fc976){return _0x4fc976[_0x2621('0x28')]()[_0x2621('0x27')](function(){var _0x2419b6=_0x4fc976[_0x2621('0x29')]({'plain':!![]});var _0x1f4147=_0x2621('0x2a');return db['UserProfileResource'][_0x2621('0x28')]({'where':{'type':_0x1f4147,'resourceId':_0x2419b6['id']}})[_0x2621('0x27')](function(){return _0x4fc976;});})[_0x2621('0x27')](function(){_0x149858[_0x2621('0x1e')](0xcc)[_0x2621('0x1d')]();});}};}function handleEntityNotFound(_0x488d06,_0x4b26fd){return function(_0xc0ddae){if(!_0xc0ddae){_0x488d06[_0x2621('0x1c')](0x194);}return _0xc0ddae;};}function handleError(_0x2bb371,_0x320bd0){_0x320bd0=_0x320bd0||0x1f4;return function(_0x527b9f){logger[_0x2621('0x2b')](_0x527b9f[_0x2621('0x2c')]);if(_0x527b9f[_0x2621('0x2d')]){delete _0x527b9f[_0x2621('0x2d')];}_0x2bb371[_0x2621('0x1e')](_0x320bd0)[_0x2621('0x2e')](_0x527b9f);};}exports[_0x2621('0x2f')]=function(_0x1e7670,_0x58148f){var _0x441fb1={},_0x39886a={},_0x212637={'count':0x0,'rows':[]};var _0x45cebe=_['map'](db['Interval'][_0x2621('0x30')],function(_0x200032){return{'name':_0x200032[_0x2621('0x31')],'type':_0x200032[_0x2621('0x32')][_0x2621('0x33')]};});_0x39886a['model']=_[_0x2621('0x34')](_0x45cebe,_0x2621('0x2d'));_0x39886a['query']=_[_0x2621('0x35')](_0x1e7670[_0x2621('0x36')]);_0x39886a['filters']=_['intersection'](_0x39886a[_0x2621('0x37')],_0x39886a['query']);_0x441fb1['attributes']=_[_0x2621('0x38')](_0x39886a[_0x2621('0x37')],qs[_0x2621('0x39')](_0x1e7670[_0x2621('0x36')][_0x2621('0x39')]));_0x441fb1[_0x2621('0x3a')]=_0x441fb1[_0x2621('0x3a')][_0x2621('0x3b')]?_0x441fb1[_0x2621('0x3a')]:_0x39886a[_0x2621('0x37')];if(!_0x1e7670[_0x2621('0x36')][_0x2621('0x3c')](_0x2621('0x3d'))){_0x441fb1[_0x2621('0x22')]=qs[_0x2621('0x22')](_0x1e7670[_0x2621('0x36')][_0x2621('0x22')]);_0x441fb1[_0x2621('0x21')]=qs[_0x2621('0x21')](_0x1e7670[_0x2621('0x36')][_0x2621('0x21')]);}_0x441fb1[_0x2621('0x3e')]=qs[_0x2621('0x3f')](_0x1e7670['query'][_0x2621('0x3f')]);_0x441fb1[_0x2621('0x40')]=qs[_0x2621('0x41')](_[_0x2621('0x42')](_0x1e7670[_0x2621('0x36')],_0x39886a[_0x2621('0x41')]),_0x45cebe);if(_0x1e7670['query'][_0x2621('0x43')]){_0x441fb1['where']=_['merge'](_0x441fb1[_0x2621('0x40')],{'$or':_[_0x2621('0x34')](_0x45cebe,function(_0x3d4e19){if(_0x3d4e19[_0x2621('0x32')]!==_0x2621('0x44')){var _0x279d2b={};_0x279d2b[_0x3d4e19[_0x2621('0x2d')]]={'$like':'%'+_0x1e7670[_0x2621('0x36')][_0x2621('0x43')]+'%'};return _0x279d2b;}})});}_0x441fb1=_['merge']({},_0x441fb1,_0x1e7670[_0x2621('0x45')]);var _0x4bbd07={'where':_0x441fb1['where']};return db['Interval'][_0x2621('0x20')](_0x4bbd07)[_0x2621('0x27')](function(_0x480d0e){_0x212637[_0x2621('0x20')]=_0x480d0e;if(_0x1e7670['query'][_0x2621('0x46')]){_0x441fb1[_0x2621('0x47')]=[{'all':!![]}];}return db[_0x2621('0x48')][_0x2621('0x49')](_0x441fb1);})[_0x2621('0x27')](function(_0x5b4a19){_0x212637[_0x2621('0x4a')]=_0x5b4a19;return _0x212637;})[_0x2621('0x27')](respondWithFilteredResult(_0x58148f,_0x441fb1))[_0x2621('0x4b')](handleError(_0x58148f,null));};exports['show']=function(_0x1ed860,_0x40afeb){var _0x525a93={'raw':!![],'where':{'id':_0x1ed860[_0x2621('0x4c')]['id']}},_0x276d45={};_0x276d45[_0x2621('0x37')]=_[_0x2621('0x35')](db[_0x2621('0x48')][_0x2621('0x30')]);_0x276d45['query']=_[_0x2621('0x35')](_0x1ed860[_0x2621('0x36')]);_0x276d45[_0x2621('0x41')]=_[_0x2621('0x38')](_0x276d45[_0x2621('0x37')],_0x276d45[_0x2621('0x36')]);_0x525a93[_0x2621('0x3a')]=_[_0x2621('0x38')](_0x276d45[_0x2621('0x37')],qs[_0x2621('0x39')](_0x1ed860[_0x2621('0x36')]['fields']));_0x525a93[_0x2621('0x3a')]=_0x525a93[_0x2621('0x3a')][_0x2621('0x3b')]?_0x525a93[_0x2621('0x3a')]:_0x276d45['model'];if(_0x1ed860[_0x2621('0x36')][_0x2621('0x46')]){_0x525a93[_0x2621('0x47')]=[{'all':!![]}];}_0x525a93=_[_0x2621('0x4d')]({},_0x525a93,_0x1ed860[_0x2621('0x45')]);return db[_0x2621('0x48')]['find'](_0x525a93)[_0x2621('0x27')](handleEntityNotFound(_0x40afeb,null))[_0x2621('0x27')](respondWithResult(_0x40afeb,null))['catch'](handleError(_0x40afeb,null));};exports[_0x2621('0x4e')]=function(_0x32ca6a,_0x36d57d){return db[_0x2621('0x48')][_0x2621('0x4e')](_0x32ca6a[_0x2621('0x4f')],{})[_0x2621('0x27')](function(_0x55d83b){var _0x4c86ed=_0x32ca6a[_0x2621('0x50')]['get']({'plain':!![]});if(!_0x4c86ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c86ed[_0x2621('0x51')]===_0x2621('0x50')){var _0x10e850=_0x55d83b[_0x2621('0x29')]({'plain':!![]});var _0x2f7ebc=_0x2621('0x2a');return db[_0x2621('0x52')][_0x2621('0x53')]({'where':{'name':_0x2f7ebc,'userProfileId':_0x4c86ed[_0x2621('0x54')]},'raw':!![]})['then'](function(_0x323139){if(_0x323139&&_0x323139[_0x2621('0x55')]===0x0){return db[_0x2621('0x56')][_0x2621('0x4e')]({'name':_0x10e850['name'],'resourceId':_0x10e850['id'],'type':_0x323139['name'],'sectionId':_0x323139['id']},{})['then'](function(){return _0x55d83b;});}else{return _0x55d83b;}})[_0x2621('0x4b')](function(_0x364c9e){logger[_0x2621('0x2b')](_0x2621('0x57'),_0x364c9e);throw _0x364c9e;});}return _0x55d83b;})[_0x2621('0x27')](respondWithResult(_0x36d57d,0xc9))[_0x2621('0x4b')](handleError(_0x36d57d,null));};exports[_0x2621('0x58')]=function(_0x1e1877,_0x30ca13){if(_0x1e1877['body']['id']){delete _0x1e1877[_0x2621('0x4f')]['id'];}return db[_0x2621('0x48')][_0x2621('0x53')]({'where':{'id':_0x1e1877['params']['id']}})[_0x2621('0x27')](handleEntityNotFound(_0x30ca13,null))[_0x2621('0x27')](saveUpdates(_0x1e1877[_0x2621('0x4f')],null))['then'](respondWithResult(_0x30ca13,null))[_0x2621('0x4b')](handleError(_0x30ca13,null));};exports[_0x2621('0x28')]=function(_0xf54506,_0x59c9d2){return db[_0x2621('0x48')][_0x2621('0x53')]({'where':{'id':_0xf54506[_0x2621('0x4c')]['id']}})[_0x2621('0x27')](handleEntityNotFound(_0x59c9d2,null))[_0x2621('0x27')](removeEntity(_0x59c9d2,null))['catch'](handleError(_0x59c9d2,null));};exports[_0x2621('0x59')]=function(_0x149768,_0x1d8eec,_0x652657){if(_0x149768[_0x2621('0x4f')]['id']){delete _0x149768[_0x2621('0x4f')]['id'];}return db[_0x2621('0x48')]['find']({'where':{'id':_0x149768['params']['id']}})[_0x2621('0x27')](handleEntityNotFound(_0x1d8eec,null))[_0x2621('0x27')](function(_0x1c4a87){if(_0x1c4a87){_0x149768[_0x2621('0x4f')][_0x2621('0x5a')]=_0x1c4a87['id'];return db[_0x2621('0x48')][_0x2621('0x4e')](_0x149768['body']);}})[_0x2621('0x27')](respondWithResult(_0x1d8eec,null))[_0x2621('0x4b')](handleError(_0x1d8eec,null));};exports[_0x2621('0x5b')]=function(_0x34b50c,_0x59feec,_0x275a21){var _0x3b6b03={};var _0x577c39={};var _0x4f754d;var _0x23d10b;return db[_0x2621('0x48')][_0x2621('0x5c')]({'where':{'id':_0x34b50c[_0x2621('0x4c')]['id']}})[_0x2621('0x27')](handleEntityNotFound(_0x59feec,null))[_0x2621('0x27')](function(_0x12d745){if(_0x12d745){_0x4f754d=_0x12d745;_0x577c39['model']=_[_0x2621('0x35')](db[_0x2621('0x48')]['rawAttributes']);_0x577c39['query']=_[_0x2621('0x35')](_0x34b50c[_0x2621('0x36')]);_0x577c39[_0x2621('0x41')]=_['intersection'](_0x577c39[_0x2621('0x37')],_0x577c39[_0x2621('0x36')]);_0x3b6b03[_0x2621('0x3a')]=_['intersection'](_0x577c39['model'],qs[_0x2621('0x39')](_0x34b50c[_0x2621('0x36')][_0x2621('0x39')]));_0x3b6b03['attributes']=_0x3b6b03['attributes']['length']?_0x3b6b03[_0x2621('0x3a')]:_0x577c39['model'];_0x3b6b03[_0x2621('0x3e')]=qs['sort'](_0x34b50c[_0x2621('0x36')]['sort']);_0x3b6b03[_0x2621('0x40')]=qs[_0x2621('0x41')](_[_0x2621('0x42')](_0x34b50c['query'],_0x577c39[_0x2621('0x41')]));if(_0x34b50c[_0x2621('0x36')][_0x2621('0x43')]){_0x3b6b03[_0x2621('0x40')]=_[_0x2621('0x4d')](_0x3b6b03[_0x2621('0x40')],{'$or':_['map'](_0x3b6b03['attributes'],function(_0x3e4ea1){var _0x120c7a={};_0x120c7a[_0x3e4ea1]={'$like':'%'+_0x34b50c[_0x2621('0x36')]['filter']+'%'};return _0x120c7a;})});}_0x3b6b03=_[_0x2621('0x4d')]({},_0x3b6b03,_0x34b50c[_0x2621('0x45')]);return _0x4f754d['getIntervals'](_0x3b6b03);}})[_0x2621('0x27')](function(_0x8cef93){if(_0x8cef93){_0x23d10b=_0x8cef93[_0x2621('0x3b')];if(!_0x34b50c['query'][_0x2621('0x3c')](_0x2621('0x3d'))){_0x3b6b03['limit']=qs['limit'](_0x34b50c[_0x2621('0x36')][_0x2621('0x22')]);_0x3b6b03[_0x2621('0x21')]=qs[_0x2621('0x21')](_0x34b50c[_0x2621('0x36')][_0x2621('0x21')]);}return _0x4f754d[_0x2621('0x5b')](_0x3b6b03);}})['then'](function(_0x57dcd4){if(_0x57dcd4){return _0x57dcd4?{'count':_0x23d10b,'rows':_0x57dcd4}:null;}})[_0x2621('0x27')](respondWithResult(_0x59feec,null))[_0x2621('0x4b')](handleError(_0x59feec,null));};exports[_0x2621('0x5d')]=function(_0x3de74b,_0xb3d463,_0x297ccd){return db[_0x2621('0x48')]['findOne']({'where':{'id':_0x3de74b[_0x2621('0x4c')]['id']}})[_0x2621('0x27')](handleEntityNotFound(_0xb3d463,null))[_0x2621('0x27')](function(_0x5add37){if(_0x5add37){return db[_0x2621('0x5e')]['transaction'](function(_0x3a5a02){return db[_0x2621('0x48')]['destroy']({'where':{'IntervalId':_0x3de74b['params']['id']},'transaction':_0x3a5a02})[_0x2621('0x27')](function(_0x4523ac){var _0x45ba01=_[_0x2621('0x34')](_0x3de74b[_0x2621('0x4f')],function(_0x58d1dd){delete _0x58d1dd['id'];_0x58d1dd[_0x2621('0x5a')]=_0x3de74b[_0x2621('0x4c')]['id'];return _0x58d1dd;});return db[_0x2621('0x48')][_0x2621('0x5f')](_0x45ba01,{'transaction':_0x3a5a02});});})[_0x2621('0x27')](function(){return db[_0x2621('0x48')][_0x2621('0x49')]({'where':{'IntervalId':_0x3de74b['params']['id']}});});}})[_0x2621('0x27')](respondWithResult(_0xb3d463,null))[_0x2621('0x4b')](handleError(_0xb3d463,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bb191fe..d4d9315 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 _0x5a8c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util'];(function(_0x32ed89,_0x11d953){var _0x262961=function(_0x29727c){while(--_0x29727c){_0x32ed89['push'](_0x32ed89['shift']());}};_0x262961(++_0x11d953);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0x5a8c[_0x3355c0];return _0x5a3288;};'use strict';var _=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var logger=require('../../config/logger')(_0xc5a8('0x2'));var moment=require(_0xc5a8('0x3'));var BPromise=require(_0xc5a8('0x4'));var rp=require(_0xc5a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0xc5a8('0x8'));module[_0xc5a8('0x9')]=function(_0x373d40,_0x20e700){return _0x373d40[_0xc5a8('0xa')](_0xc5a8('0xb'),attributes,{'tableName':_0xc5a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe7ce8f,_0x36e265){extensions[_0xc5a8('0xd')](_0x373d40,_0xe7ce8f);},'afterBulkCreate':function(_0x46e3b7,_0x4e0029,_0x42487e){_0x42487e();extensions['rewrite'](_0x373d40,_0x46e3b7[0x0]);},'afterUpdate':function(_0x170c34,_0xc775a6){extensions[_0xc5a8('0xd')](_0x373d40,_0x170c34);},'afterDestroy':function(_0x55283c,_0x4b28d8){extensions[_0xc5a8('0xd')](_0x373d40,_0x55283c);}}});}; \ No newline at end of file +var _0x684c=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite'];(function(_0x434954,_0x310696){var _0x156e4e=function(_0x27f354){while(--_0x27f354){_0x434954['push'](_0x434954['shift']());}};_0x156e4e(++_0x310696);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var logger=require('../../config/logger')(_0xc684('0x2'));var moment=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var rp=require(_0xc684('0x5'));var fs=require('fs');var path=require(_0xc684('0x6'));var rimraf=require('rimraf');var config=require(_0xc684('0x7'));var attributes=require(_0xc684('0x8'));var extensions=require(_0xc684('0x9'));module[_0xc684('0xa')]=function(_0x46cb0e,_0x57a63c){return _0x46cb0e[_0xc684('0xb')](_0xc684('0xc'),attributes,{'tableName':_0xc684('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xccb771,_0x3d9282){extensions[_0xc684('0xe')](_0x46cb0e,_0xccb771);},'afterBulkCreate':function(_0x3b3bc0,_0x31cd11,_0x11e848){_0x11e848();extensions[_0xc684('0xe')](_0x46cb0e,_0x3b3bc0[0x0]);},'afterUpdate':function(_0x1736ac,_0x5bc2be){extensions[_0xc684('0xe')](_0x46cb0e,_0x1736ac);},'afterDestroy':function(_0x365990,_0x3ee263){extensions[_0xc684('0xe')](_0x46cb0e,_0x365990);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 31a3915..3c911d3 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 _0x69ba=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetInterval','Interval','options','limit','include','map','attributes','model','debug','stringify','ShowInterval','find','raw','lodash'];(function(_0x7d97cb,_0x319449){var _0x41a626=function(_0x11a679){while(--_0x11a679){_0x7d97cb['push'](_0x7d97cb['shift']());}};_0x41a626(++_0x319449);}(_0x69ba,0x131));var _0xa69b=function(_0xb412d9,_0x3f182e){_0xb412d9=_0xb412d9-0x0;var _0x5db67d=_0x69ba[_0xb412d9];return _0x5db67d;};'use strict';var _=require(_0xa69b('0x0'));var util=require(_0xa69b('0x1'));var moment=require(_0xa69b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa69b('0x3'));var fs=require('fs');var Redis=require(_0xa69b('0x4'));var db=require(_0xa69b('0x5'))['db'];var utils=require(_0xa69b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa69b('0x7'));var jayson=require(_0xa69b('0x8'));var client=jayson[_0xa69b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3581,_0x430f58,_0x4ed9a5){return new BPromise(function(_0x441107,_0x184da3){return client[_0xa69b('0xa')](_0x2c3581,_0x4ed9a5)[_0xa69b('0xb')](function(_0x12c109){logger[_0xa69b('0xc')](_0xa69b('0xd'),_0x430f58,_0xa69b('0xe'));logger['debug'](_0xa69b('0xf'),_0x430f58,_0xa69b('0xe'),JSON['stringify'](_0x12c109));if(_0x12c109[_0xa69b('0x10')]){if(_0x12c109[_0xa69b('0x10')][_0xa69b('0x11')]===0x1f4){logger[_0xa69b('0x10')](_0xa69b('0xd'),_0x430f58,_0x12c109[_0xa69b('0x10')][_0xa69b('0x12')]);return _0x184da3(_0x12c109[_0xa69b('0x10')][_0xa69b('0x12')]);}logger[_0xa69b('0x10')]('Interval,\x20%s,\x20%s',_0x430f58,_0x12c109[_0xa69b('0x10')]['message']);return _0x441107(_0x12c109[_0xa69b('0x10')][_0xa69b('0x12')]);}else{logger['info'](_0xa69b('0xd'),_0x430f58,'request\x20sent');_0x441107(_0x12c109[_0xa69b('0x13')][_0xa69b('0x12')]);}})[_0xa69b('0x14')](function(_0x3bae6f){logger['error'](_0xa69b('0xd'),_0x430f58,_0x3bae6f);_0x184da3(_0x3bae6f);});});}exports[_0xa69b('0x15')]=function(_0x2f9035){var _0x2bcd98=this;return new Promise(function(_0x134ddc,_0x231e08){return db[_0xa69b('0x16')]['findAll']({'raw':_0x2f9035[_0xa69b('0x17')]?_0x2f9035[_0xa69b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2f9035[_0xa69b('0x17')]?_0x2f9035['options']['where']||null:null,'attributes':_0x2f9035[_0xa69b('0x17')]?_0x2f9035[_0xa69b('0x17')]['attributes']||null:null,'limit':_0x2f9035['options']?_0x2f9035[_0xa69b('0x17')][_0xa69b('0x18')]||null:null,'include':_0x2f9035[_0xa69b('0x17')]?_0x2f9035[_0xa69b('0x17')][_0xa69b('0x19')]?_[_0xa69b('0x1a')](_0x2f9035[_0xa69b('0x17')][_0xa69b('0x19')],function(_0x1cc84d){return{'model':db[_0x1cc84d['model']],'as':_0x1cc84d['as'],'attributes':_0x1cc84d[_0xa69b('0x1b')],'include':_0x1cc84d[_0xa69b('0x19')]?_[_0xa69b('0x1a')](_0x1cc84d['include'],function(_0x2d2724){return{'model':db[_0x2d2724[_0xa69b('0x1c')]],'as':_0x2d2724['as'],'attributes':_0x2d2724[_0xa69b('0x1b')],'include':_0x2d2724[_0xa69b('0x19')]?_[_0xa69b('0x1a')](_0x2d2724['include'],function(_0x1dc649){return{'model':db[_0x1dc649[_0xa69b('0x1c')]],'as':_0x1dc649['as'],'attributes':_0x1dc649[_0xa69b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa69b('0xb')](function(_0x2722a5){logger[_0xa69b('0xc')](_0xa69b('0x15'),_0x2f9035);logger[_0xa69b('0x1d')](_0xa69b('0x15'),_0x2f9035,JSON[_0xa69b('0x1e')](_0x2722a5));_0x134ddc(_0x2722a5);})['catch'](function(_0xae24ba){logger[_0xa69b('0x10')]('GetInterval',_0xae24ba['message'],_0x2f9035);_0x231e08(_0x2bcd98[_0xa69b('0x10')](0x1f4,_0xae24ba[_0xa69b('0x12')]));});});};exports[_0xa69b('0x1f')]=function(_0x5ba58c){var _0x39a861=this;return new Promise(function(_0x163699,_0x4e6c56){return db[_0xa69b('0x16')][_0xa69b('0x20')]({'raw':_0x5ba58c[_0xa69b('0x17')]?_0x5ba58c[_0xa69b('0x17')][_0xa69b('0x21')]===undefined?!![]:![]:!![],'where':_0x5ba58c[_0xa69b('0x17')]?_0x5ba58c[_0xa69b('0x17')]['where']||null:null,'attributes':_0x5ba58c['options']?_0x5ba58c[_0xa69b('0x17')][_0xa69b('0x1b')]||null:null,'include':_0x5ba58c[_0xa69b('0x17')]?_0x5ba58c['options'][_0xa69b('0x19')]?_[_0xa69b('0x1a')](_0x5ba58c[_0xa69b('0x17')][_0xa69b('0x19')],function(_0x40fbd6){return{'model':db[_0x40fbd6['model']],'as':_0x40fbd6['as'],'attributes':_0x40fbd6[_0xa69b('0x1b')],'include':_0x40fbd6[_0xa69b('0x19')]?_[_0xa69b('0x1a')](_0x40fbd6[_0xa69b('0x19')],function(_0x3c7120){return{'model':db[_0x3c7120[_0xa69b('0x1c')]],'as':_0x3c7120['as'],'attributes':_0x3c7120[_0xa69b('0x1b')],'include':_0x3c7120[_0xa69b('0x19')]?_[_0xa69b('0x1a')](_0x3c7120[_0xa69b('0x19')],function(_0x2a1981){return{'model':db[_0x2a1981[_0xa69b('0x1c')]],'as':_0x2a1981['as'],'attributes':_0x2a1981[_0xa69b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa69b('0xb')](function(_0x425c9b){logger[_0xa69b('0xc')](_0xa69b('0x1f'),_0x5ba58c);logger['debug']('ShowInterval',_0x5ba58c,JSON['stringify'](_0x425c9b));_0x163699(_0x425c9b);})[_0xa69b('0x14')](function(_0x231fee){logger[_0xa69b('0x10')](_0xa69b('0x1f'),_0x231fee[_0xa69b('0x12')],_0x5ba58c);_0x4e6c56(_0x39a861[_0xa69b('0x10')](0x1f4,_0x231fee[_0xa69b('0x12')]));});});}; \ No newline at end of file +var _0x8736=['options','where','limit','include','map','model','attributes','ShowInterval','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','Interval,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetInterval','Interval','findAll'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x8736,0x1e9));var _0x6873=function(_0x175fbe,_0xad639a){_0x175fbe=_0x175fbe-0x0;var _0x5be67e=_0x8736[_0x175fbe];return _0x5be67e;};'use strict';var _=require(_0x6873('0x0'));var util=require(_0x6873('0x1'));var moment=require('moment');var BPromise=require(_0x6873('0x2'));var rs=require(_0x6873('0x3'));var fs=require('fs');var Redis=require(_0x6873('0x4'));var db=require(_0x6873('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6873('0x6'));var config=require(_0x6873('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6873('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bfc51,_0x32f67f,_0x476cf6){return new BPromise(function(_0x3b355f,_0x590a51){return client[_0x6873('0x9')](_0x4bfc51,_0x476cf6)[_0x6873('0xa')](function(_0x58598d){logger[_0x6873('0xb')](_0x6873('0xc'),_0x32f67f,'request\x20sent');logger[_0x6873('0xd')]('Interval,\x20%s,\x20%s,\x20%s',_0x32f67f,_0x6873('0xe'),JSON[_0x6873('0xf')](_0x58598d));if(_0x58598d[_0x6873('0x10')]){if(_0x58598d[_0x6873('0x10')]['code']===0x1f4){logger['error'](_0x6873('0xc'),_0x32f67f,_0x58598d[_0x6873('0x10')][_0x6873('0x11')]);return _0x590a51(_0x58598d['error'][_0x6873('0x11')]);}logger[_0x6873('0x10')](_0x6873('0xc'),_0x32f67f,_0x58598d[_0x6873('0x10')]['message']);return _0x3b355f(_0x58598d[_0x6873('0x10')][_0x6873('0x11')]);}else{logger[_0x6873('0xb')]('Interval,\x20%s,\x20%s',_0x32f67f,'request\x20sent');_0x3b355f(_0x58598d[_0x6873('0x12')][_0x6873('0x11')]);}})[_0x6873('0x13')](function(_0x42041){logger['error']('Interval,\x20%s,\x20%s',_0x32f67f,_0x42041);_0x590a51(_0x42041);});});}exports[_0x6873('0x14')]=function(_0x20ba84){var _0x3e56df=this;return new Promise(function(_0x1e3881,_0x19728d){return db[_0x6873('0x15')][_0x6873('0x16')]({'raw':_0x20ba84['options']?_0x20ba84['options']['raw']===undefined?!![]:![]:!![],'where':_0x20ba84[_0x6873('0x17')]?_0x20ba84[_0x6873('0x17')][_0x6873('0x18')]||null:null,'attributes':_0x20ba84[_0x6873('0x17')]?_0x20ba84[_0x6873('0x17')]['attributes']||null:null,'limit':_0x20ba84['options']?_0x20ba84['options'][_0x6873('0x19')]||null:null,'include':_0x20ba84['options']?_0x20ba84[_0x6873('0x17')][_0x6873('0x1a')]?_[_0x6873('0x1b')](_0x20ba84[_0x6873('0x17')]['include'],function(_0x413e58){return{'model':db[_0x413e58[_0x6873('0x1c')]],'as':_0x413e58['as'],'attributes':_0x413e58[_0x6873('0x1d')],'include':_0x413e58[_0x6873('0x1a')]?_[_0x6873('0x1b')](_0x413e58['include'],function(_0x4dca1a){return{'model':db[_0x4dca1a['model']],'as':_0x4dca1a['as'],'attributes':_0x4dca1a[_0x6873('0x1d')],'include':_0x4dca1a[_0x6873('0x1a')]?_['map'](_0x4dca1a[_0x6873('0x1a')],function(_0xd1914f){return{'model':db[_0xd1914f[_0x6873('0x1c')]],'as':_0xd1914f['as'],'attributes':_0xd1914f[_0x6873('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6873('0xa')](function(_0x396b0e){logger[_0x6873('0xb')](_0x6873('0x14'),_0x20ba84);logger[_0x6873('0xd')](_0x6873('0x14'),_0x20ba84,JSON['stringify'](_0x396b0e));_0x1e3881(_0x396b0e);})[_0x6873('0x13')](function(_0x477bc7){logger['error'](_0x6873('0x14'),_0x477bc7['message'],_0x20ba84);_0x19728d(_0x3e56df[_0x6873('0x10')](0x1f4,_0x477bc7['message']));});});};exports[_0x6873('0x1e')]=function(_0x34b254){var _0x218e56=this;return new Promise(function(_0x2b517b,_0x382565){return db['Interval'][_0x6873('0x1f')]({'raw':_0x34b254['options']?_0x34b254[_0x6873('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x34b254['options']?_0x34b254['options'][_0x6873('0x18')]||null:null,'attributes':_0x34b254[_0x6873('0x17')]?_0x34b254[_0x6873('0x17')]['attributes']||null:null,'include':_0x34b254[_0x6873('0x17')]?_0x34b254[_0x6873('0x17')][_0x6873('0x1a')]?_[_0x6873('0x1b')](_0x34b254[_0x6873('0x17')][_0x6873('0x1a')],function(_0x320725){return{'model':db[_0x320725[_0x6873('0x1c')]],'as':_0x320725['as'],'attributes':_0x320725[_0x6873('0x1d')],'include':_0x320725['include']?_['map'](_0x320725[_0x6873('0x1a')],function(_0x4bb03f){return{'model':db[_0x4bb03f['model']],'as':_0x4bb03f['as'],'attributes':_0x4bb03f['attributes'],'include':_0x4bb03f['include']?_['map'](_0x4bb03f['include'],function(_0xaf89fa){return{'model':db[_0xaf89fa[_0x6873('0x1c')]],'as':_0xaf89fa['as'],'attributes':_0xaf89fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x6873('0xa')](function(_0x1ee2c4){logger['info'](_0x6873('0x1e'),_0x34b254);logger['debug'](_0x6873('0x1e'),_0x34b254,JSON[_0x6873('0xf')](_0x1ee2c4));_0x2b517b(_0x1ee2c4);})[_0x6873('0x13')](function(_0x4950e8){logger['error'](_0x6873('0x1e'),_0x4950e8[_0x6873('0x11')],_0x34b254);_0x382565(_0x218e56[_0x6873('0x10')](0x1f4,_0x4950e8[_0x6873('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 80c47b3..2238f05 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 _0x106f=['Router','./jira.controller','post','send','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x106f,0x162));var _0xf106=function(_0x5220e6,_0x445188){_0x5220e6=_0x5220e6-0x0;var _0xa71e2e=_0x106f[_0x5220e6];return _0xa71e2e;};'use strict';var express=require(_0xf106('0x0'));var router=express[_0xf106('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf106('0x2'));router[_0xf106('0x3')]('/',auth['isAuthenticated'](),controller[_0xf106('0x4')]);module['exports']=router; \ No newline at end of file +var _0xe551=['isAuthenticated','exports','Router','../../components/auth/service','post'];(function(_0x1cbd05,_0x3a37dc){var _0x4bc802=function(_0xa44884){while(--_0xa44884){_0x1cbd05['push'](_0x1cbd05['shift']());}};_0x4bc802(++_0x3a37dc);}(_0xe551,0xc5));var _0x1e55=function(_0x60bc59,_0x2be885){_0x60bc59=_0x60bc59-0x0;var _0x39c5dd=_0xe551[_0x60bc59];return _0x39c5dd;};'use strict';var express=require('express');var router=express[_0x1e55('0x0')]();var auth=require(_0x1e55('0x1'));var controller=require('./jira.controller');router[_0x1e55('0x2')]('/',auth[_0x1e55('0x3')](),controller['send']);module[_0x1e55('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 b4d1d54..50187ae 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 _0xbfb3=['status','parse','error','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end'];(function(_0x51aee3,_0x30c7e4){var _0x346280=function(_0x456939){while(--_0x456939){_0x51aee3['push'](_0x51aee3['shift']());}};_0x346280(++_0x30c7e4);}(_0xbfb3,0x99));var _0x3bfb=function(_0x35312b,_0x129987){_0x35312b=_0x35312b-0x0;var _0x44193a=_0xbfb3[_0x35312b];return _0x44193a;};'use strict';var BPromise=require(_0x3bfb('0x0'));var https=require(_0x3bfb('0x1'));var logger=require(_0x3bfb('0x2'))('api');var USERNAME=_0x3bfb('0x3');var PASSWORD=_0x3bfb('0x4');function openIssue(_0xf33b8f,_0x1c8adf){var _0x18a0e4={'fields':{'project':{'key':_0xf33b8f[_0x3bfb('0x5')]||_0x3bfb('0x6')},'summary':(_0xf33b8f[_0x3bfb('0x7')]||_0x3bfb('0x8'))+_0x3bfb('0x9')+_0xf33b8f['ip'],'description':_0xf33b8f[_0x3bfb('0xa')]||JSON[_0x3bfb('0xb')](_0xf33b8f),'issuetype':{'name':_0xf33b8f['issuetype']||_0x3bfb('0xc')}}};_0x18a0e4['fields'][_0x3bfb('0xd')]=_0xf33b8f[_0x3bfb('0xe')];_0x18a0e4[_0x3bfb('0xf')][_0x3bfb('0x10')]=_0xf33b8f[_0x3bfb('0x11')];_0x18a0e4[_0x3bfb('0xf')]['customfield_11502']=_0xf33b8f[_0x3bfb('0x12')];_0x18a0e4[_0x3bfb('0xf')][_0x3bfb('0x13')]=_0xf33b8f[_0x3bfb('0x14')];_0x18a0e4[_0x3bfb('0xf')][_0x3bfb('0x15')]=_0xf33b8f[_0x3bfb('0x16')];_0x18a0e4['fields'][_0x3bfb('0x17')]=_0xf33b8f['ip'];var _0x5ae086={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x3bfb('0x18'),'method':_0x3bfb('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x3bfb('0x1a'),'Authorization':_0x3bfb('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x3bfb('0x1c')](_0x3bfb('0x1d'))}};var _0x59bdee=JSON[_0x3bfb('0xb')](_0x18a0e4);var _0x1adf21=https[_0x3bfb('0x1e')](_0x5ae086,function(_0x3875a7){_0x3875a7[_0x3bfb('0x1f')](_0x3bfb('0x20'));var _0x3017a6='';_0x3875a7['on'](_0x3bfb('0x21'),function(_0x4bfda3){_0x3017a6+=_0x4bfda3;});_0x3875a7['on'](_0x3bfb('0x22'),function(){if(_0x1c8adf){return _0x1c8adf[_0x3bfb('0x23')](_0x3875a7['statusCode'])['json'](JSON[_0x3bfb('0x24')](_0x3017a6));}});});_0x1adf21['on'](_0x3bfb('0x25'),function(_0x3607b5){if(_0x1c8adf){return _0x1c8adf[_0x3bfb('0x23')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3bfb('0x26')}]});}});_0x1adf21[_0x3bfb('0x27')](_0x59bdee);_0x1adf21[_0x3bfb('0x22')]();}exports[_0x3bfb('0x28')]=openIssue;exports['send']=function(_0x4ee58d,_0x49f871){_0x4ee58d[_0x3bfb('0x29')]['ip']=_0x4ee58d[_0x3bfb('0x2a')][_0x3bfb('0x2b')]||_0x4ee58d[_0x3bfb('0x2c')][_0x3bfb('0x2d')]||_0x4ee58d['socket'][_0x3bfb('0x2d')]||_0x4ee58d[_0x3bfb('0x2c')][_0x3bfb('0x2e')][_0x3bfb('0x2d')];return openIssue(_0x4ee58d[_0x3bfb('0x29')],_0x49f871);}; \ No newline at end of file +var _0x7134=['track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','api.jira','write','send','body','headers','connection','remoteAddress','socket','bluebird','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504'];(function(_0x2d26f3,_0x3ce1e4){var _0x548c87=function(_0x13e34f){while(--_0x13e34f){_0x2d26f3['push'](_0x2d26f3['shift']());}};_0x548c87(++_0x3ce1e4);}(_0x7134,0x118));var _0x4713=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7134[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x4713('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x4713('0x1'));var USERNAME=_0x4713('0x2');var PASSWORD=_0x4713('0x3');function openIssue(_0x1e979a,_0x4821a4){var _0x19bf00={'fields':{'project':{'key':_0x1e979a['key']||_0x4713('0x4')},'summary':(_0x1e979a[_0x4713('0x5')]||_0x4713('0x6'))+_0x4713('0x7')+_0x1e979a['ip'],'description':_0x1e979a[_0x4713('0x8')]||JSON[_0x4713('0x9')](_0x1e979a),'issuetype':{'name':_0x1e979a[_0x4713('0xa')]||_0x4713('0xb')}}};_0x19bf00[_0x4713('0xc')][_0x4713('0xd')]=_0x1e979a[_0x4713('0xe')];_0x19bf00[_0x4713('0xc')][_0x4713('0xf')]=_0x1e979a[_0x4713('0x10')];_0x19bf00[_0x4713('0xc')][_0x4713('0x11')]=_0x1e979a[_0x4713('0x12')];_0x19bf00[_0x4713('0xc')][_0x4713('0x13')]=_0x1e979a['name'];_0x19bf00[_0x4713('0xc')][_0x4713('0x14')]=_0x1e979a['reason'];_0x19bf00[_0x4713('0xc')]['customfield_10102']=_0x1e979a['ip'];var _0x240b7f={'host':_0x4713('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x4713('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x4713('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x4713('0x18')](_0x4713('0x19'))}};var _0x1c771a=JSON[_0x4713('0x9')](_0x19bf00);var _0x490958=https[_0x4713('0x1a')](_0x240b7f,function(_0x5cab6b){_0x5cab6b[_0x4713('0x1b')](_0x4713('0x1c'));var _0x9a33f9='';_0x5cab6b['on'](_0x4713('0x1d'),function(_0x474728){_0x9a33f9+=_0x474728;});_0x5cab6b['on'](_0x4713('0x1e'),function(){if(_0x4821a4){return _0x4821a4[_0x4713('0x1f')](_0x5cab6b[_0x4713('0x20')])[_0x4713('0x21')](JSON[_0x4713('0x22')](_0x9a33f9));}});});_0x490958['on']('error',function(_0x1a3277){if(_0x4821a4){return _0x4821a4[_0x4713('0x1f')](0x1f4)[_0x4713('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x4713('0x23')}]});}});_0x490958[_0x4713('0x24')](_0x1c771a);_0x490958[_0x4713('0x1e')]();}exports['openIssue']=openIssue;exports[_0x4713('0x25')]=function(_0x297ebc,_0x3d3370){_0x297ebc[_0x4713('0x26')]['ip']=_0x297ebc[_0x4713('0x27')]['x-forwarded-for']||_0x297ebc[_0x4713('0x28')]['remoteAddress']||_0x297ebc['socket'][_0x4713('0x29')]||_0x297ebc['connection'][_0x4713('0x2a')][_0x4713('0x29')];return openIssue(_0x297ebc['body'],_0x3d3370);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 54590af..52c140d 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 _0xa346=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0xa346,0x124));var _0x6a34=function(_0xf246a3,_0x26c4f5){_0xf246a3=_0xf246a3-0x0;var _0x31418f=_0xa346[_0xf246a3];return _0x31418f;};'use strict';var multer=require(_0x6a34('0x0'));var util=require(_0x6a34('0x1'));var path=require(_0x6a34('0x2'));var timeout=require(_0x6a34('0x3'));var express=require('express');var router=express[_0x6a34('0x4')]();var auth=require(_0x6a34('0x5'));var interaction=require(_0x6a34('0x6'));var config=require(_0x6a34('0x7'));var controller=require(_0x6a34('0x8'));router[_0x6a34('0x9')]('/',auth[_0x6a34('0xa')](),controller[_0x6a34('0xb')]);router[_0x6a34('0x9')](_0x6a34('0xc'),auth[_0x6a34('0xa')](),controller['describe']);router[_0x6a34('0x9')](_0x6a34('0xd'),auth[_0x6a34('0xa')](),controller[_0x6a34('0xe')]);router[_0x6a34('0xf')]('/',auth[_0x6a34('0xa')](),controller[_0x6a34('0x10')]);router[_0x6a34('0x11')](_0x6a34('0xd'),auth['isAuthenticated'](),controller[_0x6a34('0x12')]);router[_0x6a34('0x13')](_0x6a34('0xd'),auth[_0x6a34('0xa')](),controller[_0x6a34('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1b32=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','post','create','update','delete','/:id','multer','util'];(function(_0x23da6b,_0x173cf1){var _0x5a9880=function(_0x1bcf3a){while(--_0x1bcf3a){_0x23da6b['push'](_0x23da6b['shift']());}};_0x5a9880(++_0x173cf1);}(_0x1b32,0x11e));var _0x21b3=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x1b32[_0x3ea913];return _0x2b4f28;};'use strict';var multer=require(_0x21b3('0x0'));var util=require(_0x21b3('0x1'));var path=require(_0x21b3('0x2'));var timeout=require(_0x21b3('0x3'));var express=require('express');var router=express[_0x21b3('0x4')]();var auth=require(_0x21b3('0x5'));var interaction=require(_0x21b3('0x6'));var config=require('../../config/environment');var controller=require(_0x21b3('0x7'));router[_0x21b3('0x8')]('/',auth[_0x21b3('0x9')](),controller[_0x21b3('0xa')]);router['get'](_0x21b3('0xb'),auth['isAuthenticated'](),controller[_0x21b3('0xc')]);router[_0x21b3('0x8')]('/:id',auth[_0x21b3('0x9')](),controller['show']);router[_0x21b3('0xd')]('/',auth[_0x21b3('0x9')](),controller[_0x21b3('0xe')]);router['put']('/:id',auth[_0x21b3('0x9')](),controller[_0x21b3('0xf')]);router[_0x21b3('0x10')](_0x21b3('0x11'),auth[_0x21b3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8ca4e79..eea8ad1 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 _0x236c=['STRING','sequelize','TEXT','long'];(function(_0x4b2ef6,_0x1a8d7a){var _0x7e9c5c=function(_0x14a795){while(--_0x14a795){_0x4b2ef6['push'](_0x4b2ef6['shift']());}};_0x7e9c5c(++_0x1a8d7a);}(_0x236c,0x155));var _0xc236=function(_0x4cb902,_0x51b507){_0x4cb902=_0x4cb902-0x0;var _0x56b785=_0x236c[_0x4cb902];return _0x56b785;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'question':{'type':Sequelize[_0xc236('0x1')]},'answer':{'type':Sequelize[_0xc236('0x1')](_0xc236('0x2'))},'membername':{'type':Sequelize[_0xc236('0x3')]},'projectname':{'type':Sequelize[_0xc236('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc236('0x3')]},'calleridname':{'type':Sequelize[_0xc236('0x3')]},'calleridnum':{'type':Sequelize[_0xc236('0x3')]},'questionId':{'type':Sequelize[_0xc236('0x3')]}}; \ No newline at end of file +var _0xbdb7=['long','STRING','sequelize','exports','TEXT'];(function(_0x11c334,_0x3dc51c){var _0xbb3182=function(_0x3fe73a){while(--_0x3fe73a){_0x11c334['push'](_0x11c334['shift']());}};_0xbb3182(++_0x3dc51c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x30bd01,_0x557a2c){_0x30bd01=_0x30bd01-0x0;var _0x44cdc3=_0xbdb7[_0x30bd01];return _0x44cdc3;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'question':{'type':Sequelize[_0x7bdb('0x2')]},'answer':{'type':Sequelize[_0x7bdb('0x2')](_0x7bdb('0x3'))},'membername':{'type':Sequelize[_0x7bdb('0x4')]},'projectname':{'type':Sequelize[_0x7bdb('0x4')]},'queue':{'type':Sequelize[_0x7bdb('0x4')]},'uniqueid':{'type':Sequelize[_0x7bdb('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7bdb('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 6222f8b..b900d7f 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 _0x6de2=['jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','status','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs'];(function(_0x37d470,_0x55516d){var _0x490f88=function(_0x9b7697){while(--_0x9b7697){_0x37d470['push'](_0x37d470['shift']());}};_0x490f88(++_0x55516d);}(_0x6de2,0x85));var _0x26de=function(_0x15fb19,_0x4aeabd){_0x15fb19=_0x15fb19-0x0;var _0x5ab5ed=_0x6de2[_0x15fb19];return _0x5ab5ed;};'use strict';var pdf=require(_0x26de('0x0'));var emlformat=require(_0x26de('0x1'));var rimraf=require(_0x26de('0x2'));var zipdir=require(_0x26de('0x3'));var jsonpatch=require(_0x26de('0x4'));var rp=require(_0x26de('0x5'));var moment=require(_0x26de('0x6'));var BPromise=require(_0x26de('0x7'));var Mustache=require('mustache');var util=require(_0x26de('0x8'));var path=require(_0x26de('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x26de('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x26de('0xb'));var deskjs=require(_0x26de('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x26de('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x26de('0xe'));var hardwareService=require(_0x26de('0xf'));var logger=require(_0x26de('0x10'))(_0x26de('0x11'));var utils=require(_0x26de('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x26de('0x13'));var db=require(_0x26de('0x14'))['db'];function respondWithStatusCode(_0x325443,_0x38754b){_0x38754b=_0x38754b||0xcc;return function(_0x40d451){if(_0x40d451){return _0x325443[_0x26de('0x15')](_0x38754b);}return _0x325443['status'](_0x38754b)[_0x26de('0x16')]();};}function respondWithResult(_0x2ca11e,_0x18a867){_0x18a867=_0x18a867||0xc8;return function(_0x191ef9){if(_0x191ef9){return _0x2ca11e['status'](_0x18a867)[_0x26de('0x17')](_0x191ef9);}};}function respondWithFilteredResult(_0x23b7b2,_0x48cc74){return function(_0x559d49){if(_0x559d49){var _0x5ba4ef=_0x559d49[_0x26de('0x18')],_0x591e3a=_0x48cc74['offset'],_0xeb0a67=_0x48cc74['offset']+_0x48cc74[_0x26de('0x19')],_0x39a55b;if(_0xeb0a67>=_0x5ba4ef){_0xeb0a67=_0x5ba4ef;_0x39a55b=0xc8;}else{_0x39a55b=0xce;}_0x23b7b2['status'](_0x39a55b);return _0x23b7b2[_0x26de('0x1a')](_0x26de('0x1b'),_0x591e3a+'-'+_0xeb0a67+'/'+_0x5ba4ef)[_0x26de('0x17')](_0x559d49);}return null;};}function patchUpdates(_0x4aeac7){return function(_0x36f31d){try{jsonpatch[_0x26de('0x1c')](_0x36f31d,_0x4aeac7,!![]);}catch(_0x535fc8){return BPromise[_0x26de('0x1d')](_0x535fc8);}return _0x36f31d[_0x26de('0x1e')]();};}function saveUpdates(_0x33a395,_0x4fcea1){return function(_0x26e1ac){if(_0x26e1ac){return _0x26e1ac['update'](_0x33a395)[_0x26de('0x1f')](function(_0x14d61f){return _0x14d61f;});}return null;};}function removeEntity(_0x2c2cc5,_0x5bc065){return function(_0x9aaaed){if(_0x9aaaed){return _0x9aaaed[_0x26de('0x20')]()[_0x26de('0x1f')](function(){_0x2c2cc5['status'](0xcc)[_0x26de('0x16')]();});}};}function handleEntityNotFound(_0x37d1c2,_0x4d6a90){return function(_0x1ef130){if(!_0x1ef130){_0x37d1c2[_0x26de('0x15')](0x194);}return _0x1ef130;};}function handleError(_0xe08d0c,_0x1a8ede){_0x1a8ede=_0x1a8ede||0x1f4;return function(_0x4a3474){logger['error'](_0x4a3474[_0x26de('0x21')]);if(_0x4a3474[_0x26de('0x22')]){delete _0x4a3474['name'];}_0xe08d0c[_0x26de('0x23')](_0x1a8ede)[_0x26de('0x24')](_0x4a3474);};}exports[_0x26de('0x25')]=function(_0x1096cb,_0x19400c){var _0x5b624a={},_0x5a1c2b={},_0x55765a={'count':0x0,'rows':[]};var _0x281464=_[_0x26de('0x26')](db[_0x26de('0x27')][_0x26de('0x28')],function(_0xc93cf1){return{'name':_0xc93cf1[_0x26de('0x29')],'type':_0xc93cf1[_0x26de('0x2a')][_0x26de('0x2b')]};});_0x5a1c2b['model']=_['map'](_0x281464,_0x26de('0x22'));_0x5a1c2b[_0x26de('0x2c')]=_[_0x26de('0x2d')](_0x1096cb['query']);_0x5a1c2b['filters']=_[_0x26de('0x2e')](_0x5a1c2b[_0x26de('0x2f')],_0x5a1c2b['query']);_0x5b624a[_0x26de('0x30')]=_['intersection'](_0x5a1c2b[_0x26de('0x2f')],qs[_0x26de('0x31')](_0x1096cb[_0x26de('0x2c')]['fields']));_0x5b624a[_0x26de('0x30')]=_0x5b624a['attributes'][_0x26de('0x32')]?_0x5b624a['attributes']:_0x5a1c2b[_0x26de('0x2f')];if(!_0x1096cb[_0x26de('0x2c')][_0x26de('0x33')]('nolimit')){_0x5b624a[_0x26de('0x19')]=qs[_0x26de('0x19')](_0x1096cb[_0x26de('0x2c')]['limit']);_0x5b624a[_0x26de('0x34')]=qs['offset'](_0x1096cb['query'][_0x26de('0x34')]);}_0x5b624a[_0x26de('0x35')]=qs[_0x26de('0x36')](_0x1096cb['query'][_0x26de('0x36')]);_0x5b624a[_0x26de('0x37')]=qs[_0x26de('0x38')](_[_0x26de('0x39')](_0x1096cb[_0x26de('0x2c')],_0x5a1c2b['filters']),_0x281464);if(_0x1096cb[_0x26de('0x2c')][_0x26de('0x3a')]){_0x5b624a['where']=_[_0x26de('0x3b')](_0x5b624a[_0x26de('0x37')],{'$or':_[_0x26de('0x26')](_0x281464,function(_0x48bf91){if(_0x48bf91[_0x26de('0x2a')]!==_0x26de('0x3c')){var _0x21afdf={};_0x21afdf[_0x48bf91['name']]={'$like':'%'+_0x1096cb[_0x26de('0x2c')][_0x26de('0x3a')]+'%'};return _0x21afdf;}})});}_0x5b624a=_['merge']({},_0x5b624a,_0x1096cb[_0x26de('0x3d')]);var _0x3611b2={'where':_0x5b624a[_0x26de('0x37')]};return db[_0x26de('0x27')]['count'](_0x3611b2)['then'](function(_0x3d488b){_0x55765a[_0x26de('0x18')]=_0x3d488b;if(_0x1096cb[_0x26de('0x2c')][_0x26de('0x3e')]){_0x5b624a[_0x26de('0x3f')]=[{'all':!![]}];}return db[_0x26de('0x27')][_0x26de('0x40')](_0x5b624a);})[_0x26de('0x1f')](function(_0x8cc123){_0x55765a[_0x26de('0x41')]=_0x8cc123;return _0x55765a;})[_0x26de('0x1f')](respondWithFilteredResult(_0x19400c,_0x5b624a))['catch'](handleError(_0x19400c,null));};exports[_0x26de('0x42')]=function(_0x127b4e,_0x33e883){var _0x2d7e4c={'raw':!![],'where':{'id':_0x127b4e['params']['id']}},_0x4a7bbf={};_0x4a7bbf['model']=_[_0x26de('0x2d')](db[_0x26de('0x27')][_0x26de('0x28')]);_0x4a7bbf[_0x26de('0x2c')]=_[_0x26de('0x2d')](_0x127b4e[_0x26de('0x2c')]);_0x4a7bbf[_0x26de('0x38')]=_[_0x26de('0x2e')](_0x4a7bbf['model'],_0x4a7bbf[_0x26de('0x2c')]);_0x2d7e4c[_0x26de('0x30')]=_[_0x26de('0x2e')](_0x4a7bbf[_0x26de('0x2f')],qs[_0x26de('0x31')](_0x127b4e[_0x26de('0x2c')][_0x26de('0x31')]));_0x2d7e4c[_0x26de('0x30')]=_0x2d7e4c['attributes'][_0x26de('0x32')]?_0x2d7e4c[_0x26de('0x30')]:_0x4a7bbf[_0x26de('0x2f')];if(_0x127b4e['query']['includeAll']){_0x2d7e4c[_0x26de('0x3f')]=[{'all':!![]}];}_0x2d7e4c=_[_0x26de('0x3b')]({},_0x2d7e4c,_0x127b4e[_0x26de('0x3d')]);return db[_0x26de('0x27')][_0x26de('0x43')](_0x2d7e4c)['then'](handleEntityNotFound(_0x33e883,null))[_0x26de('0x1f')](respondWithResult(_0x33e883,null))['catch'](handleError(_0x33e883,null));};exports[_0x26de('0x44')]=function(_0x159a7e,_0x5794bc){return db[_0x26de('0x27')][_0x26de('0x44')](_0x159a7e[_0x26de('0x45')],{})['then'](respondWithResult(_0x5794bc,0xc9))['catch'](handleError(_0x5794bc,null));};exports['update']=function(_0x48a933,_0x5b2358){if(_0x48a933['body']['id']){delete _0x48a933['body']['id'];}return db[_0x26de('0x27')][_0x26de('0x43')]({'where':{'id':_0x48a933['params']['id']}})[_0x26de('0x1f')](handleEntityNotFound(_0x5b2358,null))[_0x26de('0x1f')](saveUpdates(_0x48a933[_0x26de('0x45')],null))['then'](respondWithResult(_0x5b2358,null))[_0x26de('0x46')](handleError(_0x5b2358,null));};exports[_0x26de('0x20')]=function(_0x189264,_0x2dc90d){return db[_0x26de('0x27')][_0x26de('0x43')]({'where':{'id':_0x189264['params']['id']}})[_0x26de('0x1f')](handleEntityNotFound(_0x2dc90d,null))[_0x26de('0x1f')](removeEntity(_0x2dc90d,null))[_0x26de('0x46')](handleError(_0x2dc90d,null));};exports[_0x26de('0x47')]=function(_0x5b21e4,_0x5cb55a){return db['JscriptyAnswerReport'][_0x26de('0x47')]()[_0x26de('0x1f')](respondWithResult(_0x5cb55a,null))[_0x26de('0x46')](handleError(_0x5cb55a,null));}; \ No newline at end of file +var _0x9f0a=['moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','JscriptyAnswerReport','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5d2842,_0x38d835){var _0x57f72b=function(_0x5370ea){while(--_0x5370ea){_0x5d2842['push'](_0x5d2842['shift']());}};_0x57f72b(++_0x38d835);}(_0x9f0a,0xca));var _0xa9f0=function(_0xbfbccf,_0x1f41f9){_0xbfbccf=_0xbfbccf-0x0;var _0x5b8daa=_0x9f0a[_0xbfbccf];return _0x5b8daa;};'use strict';var pdf=require(_0xa9f0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa9f0('0x1'));var zipdir=require(_0xa9f0('0x2'));var jsonpatch=require(_0xa9f0('0x3'));var rp=require(_0xa9f0('0x4'));var moment=require(_0xa9f0('0x5'));var BPromise=require(_0xa9f0('0x6'));var Mustache=require('mustache');var util=require(_0xa9f0('0x7'));var path=require(_0xa9f0('0x8'));var sox=require('sox');var csv=require(_0xa9f0('0x9'));var ejs=require(_0xa9f0('0xa'));var fs=require('fs');var _=require(_0xa9f0('0xb'));var squel=require(_0xa9f0('0xc'));var crypto=require('crypto');var jsforce=require(_0xa9f0('0xd'));var deskjs=require(_0xa9f0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9f0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa9f0('0x10'));var as=require(_0xa9f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9f0('0x12'))('api');var utils=require(_0xa9f0('0x13'));var config=require(_0xa9f0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d4069,_0x4e70e9){_0x4e70e9=_0x4e70e9||0xcc;return function(_0x504250){if(_0x504250){return _0x1d4069[_0xa9f0('0x15')](_0x4e70e9);}return _0x1d4069[_0xa9f0('0x16')](_0x4e70e9)[_0xa9f0('0x17')]();};}function respondWithResult(_0x4dd691,_0x269396){_0x269396=_0x269396||0xc8;return function(_0x24314c){if(_0x24314c){return _0x4dd691[_0xa9f0('0x16')](_0x269396)[_0xa9f0('0x18')](_0x24314c);}};}function respondWithFilteredResult(_0x4c37c7,_0xaf2f73){return function(_0x8c646a){if(_0x8c646a){var _0xd84226=_0x8c646a['count'],_0x429587=_0xaf2f73[_0xa9f0('0x19')],_0x26358d=_0xaf2f73[_0xa9f0('0x19')]+_0xaf2f73[_0xa9f0('0x1a')],_0x32834c;if(_0x26358d>=_0xd84226){_0x26358d=_0xd84226;_0x32834c=0xc8;}else{_0x32834c=0xce;}_0x4c37c7[_0xa9f0('0x16')](_0x32834c);return _0x4c37c7['set'](_0xa9f0('0x1b'),_0x429587+'-'+_0x26358d+'/'+_0xd84226)['json'](_0x8c646a);}return null;};}function patchUpdates(_0x173165){return function(_0x506dbf){try{jsonpatch[_0xa9f0('0x1c')](_0x506dbf,_0x173165,!![]);}catch(_0xa8c70a){return BPromise['reject'](_0xa8c70a);}return _0x506dbf[_0xa9f0('0x1d')]();};}function saveUpdates(_0x3edfdc,_0x30ca92){return function(_0x326e05){if(_0x326e05){return _0x326e05[_0xa9f0('0x1e')](_0x3edfdc)['then'](function(_0x5114d9){return _0x5114d9;});}return null;};}function removeEntity(_0x14a3ab,_0x2ecb6c){return function(_0x1820ff){if(_0x1820ff){return _0x1820ff['destroy']()[_0xa9f0('0x1f')](function(){_0x14a3ab[_0xa9f0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e107c,_0x10608b){return function(_0x3850f2){if(!_0x3850f2){_0x3e107c['sendStatus'](0x194);}return _0x3850f2;};}function handleError(_0x28146e,_0x5a8d03){_0x5a8d03=_0x5a8d03||0x1f4;return function(_0x3d8556){logger['error'](_0x3d8556[_0xa9f0('0x20')]);if(_0x3d8556[_0xa9f0('0x21')]){delete _0x3d8556[_0xa9f0('0x21')];}_0x28146e[_0xa9f0('0x16')](_0x5a8d03)['send'](_0x3d8556);};}exports[_0xa9f0('0x22')]=function(_0x3695a5,_0x13a511){var _0x2092f8={},_0x5a1502={},_0x5ce7ff={'count':0x0,'rows':[]};var _0x39f7b4=_[_0xa9f0('0x23')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x415855){return{'name':_0x415855[_0xa9f0('0x24')],'type':_0x415855[_0xa9f0('0x25')]['key']};});_0x5a1502[_0xa9f0('0x26')]=_[_0xa9f0('0x23')](_0x39f7b4,_0xa9f0('0x21'));_0x5a1502[_0xa9f0('0x27')]=_[_0xa9f0('0x28')](_0x3695a5[_0xa9f0('0x27')]);_0x5a1502[_0xa9f0('0x29')]=_[_0xa9f0('0x2a')](_0x5a1502['model'],_0x5a1502[_0xa9f0('0x27')]);_0x2092f8[_0xa9f0('0x2b')]=_[_0xa9f0('0x2a')](_0x5a1502['model'],qs[_0xa9f0('0x2c')](_0x3695a5[_0xa9f0('0x27')][_0xa9f0('0x2c')]));_0x2092f8[_0xa9f0('0x2b')]=_0x2092f8[_0xa9f0('0x2b')][_0xa9f0('0x2d')]?_0x2092f8[_0xa9f0('0x2b')]:_0x5a1502[_0xa9f0('0x26')];if(!_0x3695a5[_0xa9f0('0x27')][_0xa9f0('0x2e')](_0xa9f0('0x2f'))){_0x2092f8[_0xa9f0('0x1a')]=qs[_0xa9f0('0x1a')](_0x3695a5[_0xa9f0('0x27')][_0xa9f0('0x1a')]);_0x2092f8[_0xa9f0('0x19')]=qs['offset'](_0x3695a5[_0xa9f0('0x27')][_0xa9f0('0x19')]);}_0x2092f8[_0xa9f0('0x30')]=qs[_0xa9f0('0x31')](_0x3695a5[_0xa9f0('0x27')][_0xa9f0('0x31')]);_0x2092f8['where']=qs[_0xa9f0('0x29')](_[_0xa9f0('0x32')](_0x3695a5['query'],_0x5a1502[_0xa9f0('0x29')]),_0x39f7b4);if(_0x3695a5[_0xa9f0('0x27')][_0xa9f0('0x33')]){_0x2092f8[_0xa9f0('0x34')]=_[_0xa9f0('0x35')](_0x2092f8[_0xa9f0('0x34')],{'$or':_['map'](_0x39f7b4,function(_0x337482){if(_0x337482[_0xa9f0('0x25')]!==_0xa9f0('0x36')){var _0xbd2892={};_0xbd2892[_0x337482[_0xa9f0('0x21')]]={'$like':'%'+_0x3695a5['query'][_0xa9f0('0x33')]+'%'};return _0xbd2892;}})});}_0x2092f8=_['merge']({},_0x2092f8,_0x3695a5[_0xa9f0('0x37')]);var _0x267519={'where':_0x2092f8[_0xa9f0('0x34')]};return db['JscriptyAnswerReport'][_0xa9f0('0x38')](_0x267519)[_0xa9f0('0x1f')](function(_0x511458){_0x5ce7ff[_0xa9f0('0x38')]=_0x511458;if(_0x3695a5[_0xa9f0('0x27')]['includeAll']){_0x2092f8[_0xa9f0('0x39')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa9f0('0x3a')](_0x2092f8);})['then'](function(_0x2bdd19){_0x5ce7ff[_0xa9f0('0x3b')]=_0x2bdd19;return _0x5ce7ff;})[_0xa9f0('0x1f')](respondWithFilteredResult(_0x13a511,_0x2092f8))[_0xa9f0('0x3c')](handleError(_0x13a511,null));};exports['show']=function(_0x595e8d,_0x4b3ae8){var _0x2f5827={'raw':!![],'where':{'id':_0x595e8d[_0xa9f0('0x3d')]['id']}},_0x5dcd35={};_0x5dcd35[_0xa9f0('0x26')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x5dcd35[_0xa9f0('0x27')]=_[_0xa9f0('0x28')](_0x595e8d[_0xa9f0('0x27')]);_0x5dcd35[_0xa9f0('0x29')]=_['intersection'](_0x5dcd35[_0xa9f0('0x26')],_0x5dcd35[_0xa9f0('0x27')]);_0x2f5827[_0xa9f0('0x2b')]=_[_0xa9f0('0x2a')](_0x5dcd35[_0xa9f0('0x26')],qs[_0xa9f0('0x2c')](_0x595e8d[_0xa9f0('0x27')]['fields']));_0x2f5827[_0xa9f0('0x2b')]=_0x2f5827[_0xa9f0('0x2b')][_0xa9f0('0x2d')]?_0x2f5827['attributes']:_0x5dcd35['model'];if(_0x595e8d[_0xa9f0('0x27')][_0xa9f0('0x3e')]){_0x2f5827[_0xa9f0('0x39')]=[{'all':!![]}];}_0x2f5827=_['merge']({},_0x2f5827,_0x595e8d[_0xa9f0('0x37')]);return db[_0xa9f0('0x3f')][_0xa9f0('0x40')](_0x2f5827)['then'](handleEntityNotFound(_0x4b3ae8,null))[_0xa9f0('0x1f')](respondWithResult(_0x4b3ae8,null))['catch'](handleError(_0x4b3ae8,null));};exports[_0xa9f0('0x41')]=function(_0x2899f6,_0x30f40e){return db[_0xa9f0('0x3f')][_0xa9f0('0x41')](_0x2899f6[_0xa9f0('0x42')],{})[_0xa9f0('0x1f')](respondWithResult(_0x30f40e,0xc9))[_0xa9f0('0x3c')](handleError(_0x30f40e,null));};exports[_0xa9f0('0x1e')]=function(_0x5489db,_0x233c79){if(_0x5489db[_0xa9f0('0x42')]['id']){delete _0x5489db['body']['id'];}return db[_0xa9f0('0x3f')][_0xa9f0('0x40')]({'where':{'id':_0x5489db[_0xa9f0('0x3d')]['id']}})[_0xa9f0('0x1f')](handleEntityNotFound(_0x233c79,null))[_0xa9f0('0x1f')](saveUpdates(_0x5489db[_0xa9f0('0x42')],null))['then'](respondWithResult(_0x233c79,null))[_0xa9f0('0x3c')](handleError(_0x233c79,null));};exports[_0xa9f0('0x43')]=function(_0x10d299,_0x3f13ab){return db[_0xa9f0('0x3f')][_0xa9f0('0x40')]({'where':{'id':_0x10d299[_0xa9f0('0x3d')]['id']}})[_0xa9f0('0x1f')](handleEntityNotFound(_0x3f13ab,null))[_0xa9f0('0x1f')](removeEntity(_0x3f13ab,null))[_0xa9f0('0x3c')](handleError(_0x3f13ab,null));};exports[_0xa9f0('0x44')]=function(_0x25256f,_0x4bb7c2){return db[_0xa9f0('0x3f')][_0xa9f0('0x44')]()['then'](respondWithResult(_0x4bb7c2,null))[_0xa9f0('0x3c')](handleError(_0x4bb7c2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9ebcdb7..5be5bf2 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 _0x26ed=['JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0xe3907d,_0x5f3ad0){var _0x2b331c=function(_0x3d7894){while(--_0x3d7894){_0xe3907d['push'](_0xe3907d['shift']());}};_0x2b331c(++_0x5f3ad0);}(_0x26ed,0x1f0));var _0xd26e=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x26ed[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require(_0xd26e('0x0'));var util=require('util');var logger=require(_0xd26e('0x1'))(_0xd26e('0x2'));var moment=require('moment');var BPromise=require(_0xd26e('0x3'));var rp=require(_0xd26e('0x4'));var fs=require('fs');var path=require(_0xd26e('0x5'));var rimraf=require(_0xd26e('0x6'));var config=require(_0xd26e('0x7'));var attributes=require(_0xd26e('0x8'));module[_0xd26e('0x9')]=function(_0x260b31,_0x4b94f3){return _0x260b31[_0xd26e('0xa')](_0xd26e('0xb'),attributes,{'tableName':_0xd26e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ec=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x49fcfc,_0x104175){var _0x4ab162=function(_0x2fb28b){while(--_0x2fb28b){_0x49fcfc['push'](_0x49fcfc['shift']());}};_0x4ab162(++_0x104175);}(_0x90ec,0x139));var _0xc90e=function(_0x7ef41e,_0x1da6c4){_0x7ef41e=_0x7ef41e-0x0;var _0x1cfb32=_0x90ec[_0x7ef41e];return _0x1cfb32;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require(_0xc90e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc90e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc90e('0x4'));var rimraf=require(_0xc90e('0x5'));var config=require(_0xc90e('0x6'));var attributes=require(_0xc90e('0x7'));module[_0xc90e('0x8')]=function(_0x433459,_0x10b1a3){return _0x433459['define'](_0xc90e('0x9'),attributes,{'tableName':_0xc90e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 9f69f28..2426e8d 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 _0xcb4e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x539e65,_0x51dcba){var _0x4c1d70=function(_0x2dfc2b){while(--_0x2dfc2b){_0x539e65['push'](_0x539e65['shift']());}};_0x4c1d70(++_0x51dcba);}(_0xcb4e,0x133));var _0xecb4=function(_0x5e2756,_0x334878){_0x5e2756=_0x5e2756-0x0;var _0x260c52=_0xcb4e[_0x5e2756];return _0x260c52;};'use strict';var _=require(_0xecb4('0x0'));var util=require(_0xecb4('0x1'));var moment=require(_0xecb4('0x2'));var BPromise=require(_0xecb4('0x3'));var rs=require(_0xecb4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecb4('0x5'))['db'];var utils=require(_0xecb4('0x6'));var logger=require(_0xecb4('0x7'))(_0xecb4('0x8'));var config=require(_0xecb4('0x9'));var jayson=require(_0xecb4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x574c11,_0x3cf105,_0xc5bc48){return new BPromise(function(_0xb6086e,_0x1f24cb){return client[_0xecb4('0xb')](_0x574c11,_0xc5bc48)[_0xecb4('0xc')](function(_0x325a11){logger[_0xecb4('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cf105,'request\x20sent');logger[_0xecb4('0xe')](_0xecb4('0xf'),_0x3cf105,_0xecb4('0x10'),JSON[_0xecb4('0x11')](_0x325a11));if(_0x325a11[_0xecb4('0x12')]){if(_0x325a11[_0xecb4('0x12')][_0xecb4('0x13')]===0x1f4){logger[_0xecb4('0x12')](_0xecb4('0x14'),_0x3cf105,_0x325a11[_0xecb4('0x12')][_0xecb4('0x15')]);return _0x1f24cb(_0x325a11['error'][_0xecb4('0x15')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cf105,_0x325a11[_0xecb4('0x12')][_0xecb4('0x15')]);return _0xb6086e(_0x325a11['error'][_0xecb4('0x15')]);}else{logger['info'](_0xecb4('0x14'),_0x3cf105,_0xecb4('0x10'));_0xb6086e(_0x325a11[_0xecb4('0x16')][_0xecb4('0x15')]);}})[_0xecb4('0x17')](function(_0xb87bbd){logger[_0xecb4('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cf105,_0xb87bbd);_0x1f24cb(_0xb87bbd);});});} \ No newline at end of file +var _0xa6b7=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','JscriptyAnswerReport,\x20%s,\x20%s','lodash','util','moment','ioredis','../../config/utils','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x8f9831,_0x43e0a8){var _0x3b8b43=function(_0x12f4c0){while(--_0x12f4c0){_0x8f9831['push'](_0x8f9831['shift']());}};_0x3b8b43(++_0x43e0a8);}(_0xa6b7,0x1cf));var _0x7a6b=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xa6b7[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x7a6b('0x0'));var util=require(_0x7a6b('0x1'));var moment=require(_0x7a6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a6b('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7a6b('0x5'));var client=jayson[_0x7a6b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538d67,_0xd60486,_0x30bdef){return new BPromise(function(_0xdf78fb,_0x649d32){return client[_0x7a6b('0x7')](_0x538d67,_0x30bdef)[_0x7a6b('0x8')](function(_0x392aa1){logger[_0x7a6b('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xd60486,_0x7a6b('0xa'));logger[_0x7a6b('0xb')](_0x7a6b('0xc'),_0xd60486,_0x7a6b('0xa'),JSON[_0x7a6b('0xd')](_0x392aa1));if(_0x392aa1['error']){if(_0x392aa1['error'][_0x7a6b('0xe')]===0x1f4){logger[_0x7a6b('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xd60486,_0x392aa1[_0x7a6b('0xf')][_0x7a6b('0x10')]);return _0x649d32(_0x392aa1['error'][_0x7a6b('0x10')]);}logger[_0x7a6b('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xd60486,_0x392aa1[_0x7a6b('0xf')][_0x7a6b('0x10')]);return _0xdf78fb(_0x392aa1[_0x7a6b('0xf')]['message']);}else{logger[_0x7a6b('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xd60486,_0x7a6b('0xa'));_0xdf78fb(_0x392aa1['result'][_0x7a6b('0x10')]);}})[_0x7a6b('0x11')](function(_0x1ad55c){logger[_0x7a6b('0xf')](_0x7a6b('0x12'),_0xd60486,_0x1ad55c);_0x649d32(_0x1ad55c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 65d783a..9ade14c 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 _0xc671=['update','delete','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone','put','/:id'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xc671,0x1e2));var _0x1c67=function(_0x52dff8,_0x924832){_0x52dff8=_0x52dff8-0x0;var _0x5f1c49=_0xc671[_0x52dff8];return _0x5f1c49;};'use strict';var multer=require('multer');var util=require(_0x1c67('0x0'));var path=require('path');var timeout=require(_0x1c67('0x1'));var express=require('express');var router=express[_0x1c67('0x2')]();var auth=require(_0x1c67('0x3'));var interaction=require(_0x1c67('0x4'));var config=require('../../config/environment');var controller=require(_0x1c67('0x5'));router[_0x1c67('0x6')]('/',auth['isAuthenticated'](),controller[_0x1c67('0x7')]);router[_0x1c67('0x6')]('/:id',auth[_0x1c67('0x8')](),controller[_0x1c67('0x9')]);router['get'](_0x1c67('0xa'),auth[_0x1c67('0x8')](),controller[_0x1c67('0xb')]);router[_0x1c67('0x6')](_0x1c67('0xc'),auth[_0x1c67('0x8')](),controller[_0x1c67('0xd')]);router['get'](_0x1c67('0xe'),auth[_0x1c67('0x8')](),timeout(_0x1c67('0xf')),controller['getSummary']);router['post']('/',auth[_0x1c67('0x8')](),controller[_0x1c67('0x10')]);router[_0x1c67('0x11')](_0x1c67('0x12'),auth[_0x1c67('0x8')](),controller[_0x1c67('0x13')]);router[_0x1c67('0x14')](_0x1c67('0x15'),auth[_0x1c67('0x8')](),controller[_0x1c67('0x16')]);router[_0x1c67('0x17')](_0x1c67('0x15'),auth[_0x1c67('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0739=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','clone','/:id','update','delete','destroy'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0739,0x15f));var _0x9073=function(_0x4fd82c,_0x223393){_0x4fd82c=_0x4fd82c-0x0;var _0x6f5261=_0x0739[_0x4fd82c];return _0x6f5261;};'use strict';var multer=require(_0x9073('0x0'));var util=require(_0x9073('0x1'));var path=require('path');var timeout=require(_0x9073('0x2'));var express=require('express');var router=express[_0x9073('0x3')]();var auth=require(_0x9073('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9073('0x5'));var controller=require(_0x9073('0x6'));router[_0x9073('0x7')]('/',auth[_0x9073('0x8')](),controller[_0x9073('0x9')]);router[_0x9073('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9073('0xa')]);router[_0x9073('0x7')](_0x9073('0xb'),auth[_0x9073('0x8')](),controller['getSessions']);router[_0x9073('0x7')](_0x9073('0xc'),auth[_0x9073('0x8')](),controller[_0x9073('0xd')]);router[_0x9073('0x7')](_0x9073('0xe'),auth['isAuthenticated'](),timeout(_0x9073('0xf')),controller[_0x9073('0x10')]);router[_0x9073('0x11')]('/',auth[_0x9073('0x8')](),controller[_0x9073('0x12')]);router['post']('/:id/clone',auth[_0x9073('0x8')](),controller[_0x9073('0x13')]);router['put'](_0x9073('0x14'),auth[_0x9073('0x8')](),controller[_0x9073('0x15')]);router[_0x9073('0x16')](_0x9073('0x14'),auth['isAuthenticated'](),controller[_0x9073('0x17')]);module[_0x9073('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 2243959..254ffd6 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 _0x646a=['BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x18505e,_0x53446a){var _0x16f708=function(_0x385c4e){while(--_0x385c4e){_0x18505e['push'](_0x18505e['shift']());}};_0x16f708(++_0x53446a);}(_0x646a,0x91));var _0xa646=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x646a[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xa646('0x0'));var _=require(_0xa646('0x1'));var util=require(_0xa646('0x2'));module[_0xa646('0x3')]={'name':{'type':Sequelize[_0xa646('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xa646('0x4')]},'formData':{'type':Sequelize[_0xa646('0x5')](_0xa646('0x6')),'set':function(_0x1949a5){if(_['isObjectLike'](_0x1949a5)){this[_0xa646('0x7')](_0xa646('0x8'),JSON[_0xa646('0x9')](_0x1949a5));}else if(_[_0xa646('0xa')](_0x1949a5)){this['setDataValue'](_0xa646('0x8'),_0x1949a5);}else{this[_0xa646('0x7')](_0xa646('0x8'),util[_0xa646('0xb')](_0xa646('0xc'),this[_0xa646('0xd')]('name')||'',this[_0xa646('0xd')](_0xa646('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa646('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa646('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x6a15=['exports','name','STRING','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x3647f3,_0x3f8aa9){var _0x13cadd=function(_0x5ede2b){while(--_0x5ede2b){_0x3647f3['push'](_0x3647f3['shift']());}};_0x13cadd(++_0x3f8aa9);}(_0x6a15,0x9d));var _0x56a1=function(_0x334e2d,_0x3cb7f5){_0x334e2d=_0x334e2d-0x0;var _0x59ed08=_0x6a15[_0x334e2d];return _0x59ed08;};'use strict';var Sequelize=require(_0x56a1('0x0'));var _=require(_0x56a1('0x1'));var util=require(_0x56a1('0x2'));module[_0x56a1('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x56a1('0x4')},'description':{'type':Sequelize[_0x56a1('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x56a1('0x6')),'set':function(_0x4c6b81){if(_[_0x56a1('0x7')](_0x4c6b81)){this[_0x56a1('0x8')](_0x56a1('0x9'),JSON['stringify'](_0x4c6b81));}else if(_[_0x56a1('0xa')](_0x4c6b81)){this['setDataValue'](_0x56a1('0x9'),_0x4c6b81);}else{this[_0x56a1('0x8')](_0x56a1('0x9'),util[_0x56a1('0xb')](_0x56a1('0xc'),this[_0x56a1('0xd')]('name')||'',this[_0x56a1('0xd')](_0x56a1('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x56a1('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x56a1('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index bb361d6..d0a14ce 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 _0xcaf0=['merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','userProfileId','autoAssociation','findOne','order','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','Projects','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter'];(function(_0x125430,_0x4046a2){var _0xa1a407=function(_0x5f0ec1){while(--_0x5f0ec1){_0x125430['push'](_0x125430['shift']());}};_0xa1a407(++_0x4046a2);}(_0xcaf0,0x128));var _0x0caf=function(_0x1d6cb8,_0x31a3f3){_0x1d6cb8=_0x1d6cb8-0x0;var _0x38a43f=_0xcaf0[_0x1d6cb8];return _0x38a43f;};'use strict';var pdf=require(_0x0caf('0x0'));var emlformat=require(_0x0caf('0x1'));var rimraf=require(_0x0caf('0x2'));var zipdir=require(_0x0caf('0x3'));var jsonpatch=require(_0x0caf('0x4'));var rp=require(_0x0caf('0x5'));var moment=require(_0x0caf('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0caf('0x7'));var util=require(_0x0caf('0x8'));var path=require('path');var sox=require(_0x0caf('0x9'));var csv=require(_0x0caf('0xa'));var ejs=require(_0x0caf('0xb'));var fs=require('fs');var _=require(_0x0caf('0xc'));var squel=require(_0x0caf('0xd'));var crypto=require(_0x0caf('0xe'));var jsforce=require(_0x0caf('0xf'));var deskjs=require(_0x0caf('0x10'));var toCsv=require(_0x0caf('0xa'));var querystring=require('querystring');var Papa=require(_0x0caf('0x11'));var Redis=require(_0x0caf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0caf('0x13'));var as=require(_0x0caf('0x14'));var hardwareService=require(_0x0caf('0x15'));var logger=require(_0x0caf('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0caf('0x17'));var db=require(_0x0caf('0x18'))['db'];function respondWithStatusCode(_0x3b8ce6,_0x5402ad){_0x5402ad=_0x5402ad||0xcc;return function(_0x36b55f){if(_0x36b55f){return _0x3b8ce6[_0x0caf('0x19')](_0x5402ad);}return _0x3b8ce6[_0x0caf('0x1a')](_0x5402ad)[_0x0caf('0x1b')]();};}function respondWithResult(_0x8acdf6,_0x6557b6){_0x6557b6=_0x6557b6||0xc8;return function(_0x49d6df){if(_0x49d6df){return _0x8acdf6[_0x0caf('0x1a')](_0x6557b6)[_0x0caf('0x1c')](_0x49d6df);}};}function respondWithFilteredResult(_0x1e490e,_0x55112c){return function(_0xe4d8a7){if(_0xe4d8a7){var _0x7b4cae=_0xe4d8a7[_0x0caf('0x1d')],_0x39fc57=_0x55112c['offset'],_0xab2f6f=_0x55112c[_0x0caf('0x1e')]+_0x55112c['limit'],_0x5d7348;if(_0xab2f6f>=_0x7b4cae){_0xab2f6f=_0x7b4cae;_0x5d7348=0xc8;}else{_0x5d7348=0xce;}_0x1e490e[_0x0caf('0x1a')](_0x5d7348);return _0x1e490e[_0x0caf('0x1f')](_0x0caf('0x20'),_0x39fc57+'-'+_0xab2f6f+'/'+_0x7b4cae)['json'](_0xe4d8a7);}return null;};}function patchUpdates(_0x9f00fa){return function(_0x1e0b60){try{jsonpatch[_0x0caf('0x21')](_0x1e0b60,_0x9f00fa,!![]);}catch(_0x33ce24){return BPromise[_0x0caf('0x22')](_0x33ce24);}return _0x1e0b60[_0x0caf('0x23')]();};}function saveUpdates(_0x4a7a42,_0x279c84){return function(_0x39b6fa){if(_0x39b6fa){return _0x39b6fa[_0x0caf('0x24')](_0x4a7a42)[_0x0caf('0x25')](function(_0x21c7cb){return _0x21c7cb;});}return null;};}function removeEntity(_0xd829fc,_0x15168f){return function(_0x3a84d0){if(_0x3a84d0){return _0x3a84d0['destroy']()[_0x0caf('0x25')](function(){var _0x239c65=_0x3a84d0[_0x0caf('0x26')]({'plain':!![]});var _0x3d5496=_0x0caf('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d5496,'resourceId':_0x239c65['id']}})['then'](function(){return _0x3a84d0;});})[_0x0caf('0x25')](function(){_0xd829fc[_0x0caf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x596671,_0x40f880){return function(_0x26965b){if(!_0x26965b){_0x596671[_0x0caf('0x19')](0x194);}return _0x26965b;};}function handleError(_0x46aed0,_0x2c7c6c){_0x2c7c6c=_0x2c7c6c||0x1f4;return function(_0x2b1282){logger['error'](_0x2b1282[_0x0caf('0x28')]);if(_0x2b1282[_0x0caf('0x29')]){delete _0x2b1282[_0x0caf('0x29')];}_0x46aed0[_0x0caf('0x1a')](_0x2c7c6c)[_0x0caf('0x2a')](_0x2b1282);};}exports[_0x0caf('0x2b')]=function(_0xeaad81,_0x49d787){var _0x531523={},_0x28022a={},_0xe6b0f8={'count':0x0,'rows':[]};var _0x4b8fcb=_[_0x0caf('0x2c')](db[_0x0caf('0x2d')][_0x0caf('0x2e')],function(_0x4940c){return{'name':_0x4940c[_0x0caf('0x2f')],'type':_0x4940c[_0x0caf('0x30')][_0x0caf('0x31')]};});_0x28022a[_0x0caf('0x32')]=_[_0x0caf('0x2c')](_0x4b8fcb,_0x0caf('0x29'));_0x28022a[_0x0caf('0x33')]=_[_0x0caf('0x34')](_0xeaad81[_0x0caf('0x33')]);_0x28022a[_0x0caf('0x35')]=_[_0x0caf('0x36')](_0x28022a[_0x0caf('0x32')],_0x28022a[_0x0caf('0x33')]);_0x531523[_0x0caf('0x37')]=_[_0x0caf('0x36')](_0x28022a['model'],qs['fields'](_0xeaad81['query'][_0x0caf('0x38')]));_0x531523['attributes']=_0x531523[_0x0caf('0x37')][_0x0caf('0x39')]?_0x531523['attributes']:_0x28022a[_0x0caf('0x32')];if(!_0xeaad81[_0x0caf('0x33')][_0x0caf('0x3a')](_0x0caf('0x3b'))){_0x531523[_0x0caf('0x3c')]=qs['limit'](_0xeaad81[_0x0caf('0x33')]['limit']);_0x531523[_0x0caf('0x1e')]=qs[_0x0caf('0x1e')](_0xeaad81[_0x0caf('0x33')][_0x0caf('0x1e')]);}_0x531523['order']=qs['sort'](_0xeaad81[_0x0caf('0x33')][_0x0caf('0x3d')]);_0x531523['where']=qs[_0x0caf('0x35')](_[_0x0caf('0x3e')](_0xeaad81[_0x0caf('0x33')],_0x28022a['filters']),_0x4b8fcb);if(_0xeaad81['query'][_0x0caf('0x3f')]){_0x531523['where']=_[_0x0caf('0x40')](_0x531523[_0x0caf('0x41')],{'$or':_[_0x0caf('0x2c')](_0x4b8fcb,function(_0x613e33){if(_0x613e33[_0x0caf('0x30')]!==_0x0caf('0x42')){var _0x2bff0b={};_0x2bff0b[_0x613e33['name']]={'$like':'%'+_0xeaad81[_0x0caf('0x33')][_0x0caf('0x3f')]+'%'};return _0x2bff0b;}})});}_0x531523=_[_0x0caf('0x40')]({},_0x531523,_0xeaad81[_0x0caf('0x43')]);var _0x27c572={'where':_0x531523[_0x0caf('0x41')]};return db[_0x0caf('0x2d')][_0x0caf('0x1d')](_0x27c572)[_0x0caf('0x25')](function(_0x5bef9e){_0xe6b0f8[_0x0caf('0x1d')]=_0x5bef9e;if(_0xeaad81['query'][_0x0caf('0x44')]){_0x531523['include']=[{'all':!![]}];}return db[_0x0caf('0x2d')][_0x0caf('0x45')](_0x531523);})[_0x0caf('0x25')](function(_0x490cf3){_0xe6b0f8[_0x0caf('0x46')]=_0x490cf3;return _0xe6b0f8;})[_0x0caf('0x25')](respondWithFilteredResult(_0x49d787,_0x531523))[_0x0caf('0x47')](handleError(_0x49d787,null));};exports[_0x0caf('0x48')]=function(_0x3adaeb,_0x5aac0b){var _0x35bd68={'raw':![],'where':{'id':_0x3adaeb[_0x0caf('0x49')]['id']}},_0x591e4a={};_0x591e4a[_0x0caf('0x32')]=_[_0x0caf('0x34')](db[_0x0caf('0x2d')][_0x0caf('0x2e')]);_0x591e4a['query']=_[_0x0caf('0x34')](_0x3adaeb['query']);_0x591e4a[_0x0caf('0x35')]=_[_0x0caf('0x36')](_0x591e4a[_0x0caf('0x32')],_0x591e4a[_0x0caf('0x33')]);_0x35bd68[_0x0caf('0x37')]=_[_0x0caf('0x36')](_0x591e4a['model'],qs[_0x0caf('0x38')](_0x3adaeb['query']['fields']));_0x35bd68[_0x0caf('0x37')]=_0x35bd68[_0x0caf('0x37')][_0x0caf('0x39')]?_0x35bd68[_0x0caf('0x37')]:_0x591e4a[_0x0caf('0x32')];if(_0x3adaeb['query']['includeAll']){_0x35bd68[_0x0caf('0x4a')]=[{'all':!![]}];}_0x35bd68=_[_0x0caf('0x40')]({},_0x35bd68,_0x3adaeb[_0x0caf('0x43')]);return db[_0x0caf('0x2d')][_0x0caf('0x4b')](_0x35bd68)[_0x0caf('0x25')](handleEntityNotFound(_0x5aac0b,null))[_0x0caf('0x25')](respondWithResult(_0x5aac0b,null))[_0x0caf('0x47')](handleError(_0x5aac0b,null));};exports['create']=function(_0x55e211,_0x1f89bd){return db[_0x0caf('0x2d')][_0x0caf('0x4c')](_0x55e211['body'],{})[_0x0caf('0x25')](function(_0x3db294){var _0x401848=_0x55e211[_0x0caf('0x4d')][_0x0caf('0x26')]({'plain':!![]});if(!_0x401848)throw new Error(_0x0caf('0x4e'));if(_0x401848['role']===_0x0caf('0x4d')){var _0x16d381=_0x3db294[_0x0caf('0x26')]({'plain':!![]});var _0x56255b=_0x0caf('0x27');return db[_0x0caf('0x4f')][_0x0caf('0x4b')]({'where':{'name':_0x56255b,'userProfileId':_0x401848['userProfileId']},'raw':!![]})[_0x0caf('0x25')](function(_0x4e79f9){if(_0x4e79f9&&_0x4e79f9['autoAssociation']===0x0){return db[_0x0caf('0x50')][_0x0caf('0x4c')]({'name':_0x16d381['name'],'resourceId':_0x16d381['id'],'type':_0x4e79f9[_0x0caf('0x29')],'sectionId':_0x4e79f9['id']},{})[_0x0caf('0x25')](function(){return _0x3db294;});}else{return _0x3db294;}})[_0x0caf('0x47')](function(_0x4fb6ea){logger[_0x0caf('0x51')](_0x0caf('0x52'),_0x4fb6ea);throw _0x4fb6ea;});}return _0x3db294;})[_0x0caf('0x25')](respondWithResult(_0x1f89bd,0xc9))[_0x0caf('0x47')](handleError(_0x1f89bd,null));};exports[_0x0caf('0x53')]=function(_0x1692e5,_0xc42c1){var _0x1aab0d={'where':{'id':_0x1692e5[_0x0caf('0x49')]['id']}},_0x2c73f8={};_0x2c73f8['model']=_[_0x0caf('0x34')](db[_0x0caf('0x2d')]['rawAttributes']);_0x1aab0d['attributes']=_[_0x0caf('0x36')](_0x2c73f8['model'],qs[_0x0caf('0x38')](_0x1692e5[_0x0caf('0x33')][_0x0caf('0x38')]));_0x1aab0d[_0x0caf('0x37')]=_0x1aab0d[_0x0caf('0x37')][_0x0caf('0x39')]?_0x1aab0d[_0x0caf('0x37')]:_0x2c73f8[_0x0caf('0x32')];if(_0x1692e5[_0x0caf('0x33')]['includeAll']){_0x1aab0d['include']=[{'all':!![]}];}_0x1aab0d=_[_0x0caf('0x40')]({},_0x1aab0d,_0x1692e5[_0x0caf('0x43')]);return db[_0x0caf('0x2d')][_0x0caf('0x4b')](_0x1aab0d)['then'](handleEntityNotFound(_0xc42c1,null))['then'](function(_0x248af1){if(_0x248af1){var _0x3da5e3=_0x248af1[_0x0caf('0x26')]({'plain':!![]});_0x3da5e3=qs[_0x0caf('0x54')](_0x3da5e3,['id','createdAt',_0x0caf('0x55')]);_0x1692e5['body']=_[_0x0caf('0x54')](_0x1692e5[_0x0caf('0x56')],['id',_0x0caf('0x57'),'updatedAt']);return db[_0x0caf('0x2d')]['create'](_[_0x0caf('0x40')](_0x3da5e3,_0x1692e5[_0x0caf('0x56')]),{'include':_0x1692e5['query'][_0x0caf('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x6f5f6b){var _0x44b3e0=_0x1692e5[_0x0caf('0x4d')][_0x0caf('0x26')]({'plain':!![]});if(!_0x44b3e0)throw new Error(_0x0caf('0x4e'));if(_0x44b3e0['role']===_0x0caf('0x4d')){var _0x1b58a2=_0x6f5f6b['get']({'plain':!![]});var _0x32fc65=_0x0caf('0x27');return db['UserProfileSection'][_0x0caf('0x4b')]({'where':{'name':_0x32fc65,'userProfileId':_0x44b3e0[_0x0caf('0x58')]},'raw':!![]})[_0x0caf('0x25')](function(_0x47d9ae){if(_0x47d9ae&&_0x47d9ae[_0x0caf('0x59')]===0x0){return db[_0x0caf('0x50')][_0x0caf('0x4c')]({'name':_0x1b58a2[_0x0caf('0x29')],'resourceId':_0x1b58a2['id'],'type':_0x47d9ae[_0x0caf('0x29')],'sectionId':_0x47d9ae['id']},{})[_0x0caf('0x25')](function(){return _0x6f5f6b;});}else{return _0x6f5f6b;}})[_0x0caf('0x47')](function(_0xc586a2){logger[_0x0caf('0x51')](_0x0caf('0x52'),_0xc586a2);throw _0xc586a2;});}return _0x6f5f6b;});}})[_0x0caf('0x25')](respondWithResult(_0xc42c1,0xc9))[_0x0caf('0x47')](handleError(_0xc42c1,null));};exports[_0x0caf('0x24')]=function(_0x306da5,_0x32ecdb){if(_0x306da5[_0x0caf('0x56')]['id']){delete _0x306da5[_0x0caf('0x56')]['id'];}return db[_0x0caf('0x2d')][_0x0caf('0x4b')]({'where':{'id':_0x306da5[_0x0caf('0x49')]['id']}})[_0x0caf('0x25')](handleEntityNotFound(_0x32ecdb,null))['then'](saveUpdates(_0x306da5[_0x0caf('0x56')],null))['then'](respondWithResult(_0x32ecdb,null))['catch'](handleError(_0x32ecdb,null));};exports['destroy']=function(_0x331900,_0x1d5eaa){return db[_0x0caf('0x2d')]['find']({'where':{'id':_0x331900['params']['id']}})[_0x0caf('0x25')](handleEntityNotFound(_0x1d5eaa,null))[_0x0caf('0x25')](removeEntity(_0x1d5eaa,null))[_0x0caf('0x47')](handleError(_0x1d5eaa,null));};exports['getSessions']=function(_0x1cbb47,_0x1810b2,_0x179bb2){var _0x285530={'raw':!![],'where':{}};var _0xafadf={};var _0x2e0558={'count':0x0,'rows':[]};return db[_0x0caf('0x2d')][_0x0caf('0x5a')]({'where':{'id':_0x1cbb47[_0x0caf('0x49')]['id']}})[_0x0caf('0x25')](handleEntityNotFound(_0x1810b2,null))['then'](function(_0x245e7c){if(_0x245e7c){_0xafadf[_0x0caf('0x32')]=_[_0x0caf('0x34')](db['JscriptySessionReport'][_0x0caf('0x2e')]);_0xafadf[_0x0caf('0x33')]=_[_0x0caf('0x34')](_0x1cbb47['query']);_0xafadf['filters']=_['intersection'](_0xafadf[_0x0caf('0x32')],_0xafadf[_0x0caf('0x33')]);_0x285530[_0x0caf('0x37')]=_['intersection'](_0xafadf['model'],qs[_0x0caf('0x38')](_0x1cbb47['query'][_0x0caf('0x38')]));_0x285530[_0x0caf('0x37')]=_0x285530[_0x0caf('0x37')][_0x0caf('0x39')]?_0x285530[_0x0caf('0x37')]:_0xafadf['model'];if(!_0x1cbb47[_0x0caf('0x33')]['hasOwnProperty'](_0x0caf('0x3b'))){_0x285530[_0x0caf('0x3c')]=qs[_0x0caf('0x3c')](_0x1cbb47['query'][_0x0caf('0x3c')]);_0x285530[_0x0caf('0x1e')]=qs[_0x0caf('0x1e')](_0x1cbb47[_0x0caf('0x33')][_0x0caf('0x1e')]);}_0x285530[_0x0caf('0x5b')]=qs[_0x0caf('0x3d')](_0x1cbb47[_0x0caf('0x33')][_0x0caf('0x3d')]);_0x285530[_0x0caf('0x41')]=qs[_0x0caf('0x35')](_[_0x0caf('0x3e')](_0x1cbb47['query'],_0xafadf['filters']));_0x285530[_0x0caf('0x41')][_0x0caf('0x5c')]=_0x245e7c['id'];if(_0x1cbb47[_0x0caf('0x33')][_0x0caf('0x3f')]){_0x285530[_0x0caf('0x41')]=_[_0x0caf('0x40')](_0x285530[_0x0caf('0x41')],{'$or':_[_0x0caf('0x2c')](_0x285530[_0x0caf('0x37')],function(_0x3a8b62){var _0x37dc5a={};_0x37dc5a[_0x3a8b62]={'$like':'%'+_0x1cbb47[_0x0caf('0x33')][_0x0caf('0x3f')]+'%'};return _0x37dc5a;})});}_0x285530=_[_0x0caf('0x40')]({},_0x285530,_0x1cbb47[_0x0caf('0x43')]);return db[_0x0caf('0x5d')][_0x0caf('0x1d')]({'where':_0x285530[_0x0caf('0x41')]})[_0x0caf('0x25')](function(_0x2ed86e){_0x2e0558['count']=_0x2ed86e;if(_0x1cbb47[_0x0caf('0x33')]['includeAll']){_0x285530['include']=[{'all':!![]}];}return db[_0x0caf('0x5d')]['findAll'](_0x285530);})[_0x0caf('0x25')](function(_0x51c9ff){_0x2e0558[_0x0caf('0x46')]=_0x51c9ff;return _0x2e0558;});}})[_0x0caf('0x25')](respondWithFilteredResult(_0x1810b2,_0x285530))[_0x0caf('0x47')](handleError(_0x1810b2,null));};exports[_0x0caf('0x5e')]=function(_0x259265,_0x3105f2,_0x218c26){var _0x1a31e0={'raw':!![],'where':{}};var _0x7a8bc4={};var _0x4e29a0={'count':0x0,'rows':[]};return db[_0x0caf('0x2d')][_0x0caf('0x5a')]({'where':{'id':_0x259265['params']['id']}})[_0x0caf('0x25')](handleEntityNotFound(_0x3105f2,null))[_0x0caf('0x25')](function(_0x213691){if(_0x213691){_0x7a8bc4[_0x0caf('0x32')]=_['keys'](db['JscriptyAnswerReport'][_0x0caf('0x2e')]);_0x7a8bc4[_0x0caf('0x33')]=_['keys'](_0x259265['query']);_0x7a8bc4['filters']=_['intersection'](_0x7a8bc4[_0x0caf('0x32')],_0x7a8bc4[_0x0caf('0x33')]);_0x1a31e0[_0x0caf('0x37')]=_[_0x0caf('0x36')](_0x7a8bc4[_0x0caf('0x32')],qs['fields'](_0x259265[_0x0caf('0x33')][_0x0caf('0x38')]));_0x1a31e0[_0x0caf('0x37')]=_0x1a31e0[_0x0caf('0x37')][_0x0caf('0x39')]?_0x1a31e0[_0x0caf('0x37')]:_0x7a8bc4[_0x0caf('0x32')];if(!_0x259265['query']['hasOwnProperty'](_0x0caf('0x3b'))){_0x1a31e0['limit']=qs[_0x0caf('0x3c')](_0x259265[_0x0caf('0x33')][_0x0caf('0x3c')]);_0x1a31e0[_0x0caf('0x1e')]=qs[_0x0caf('0x1e')](_0x259265[_0x0caf('0x33')][_0x0caf('0x1e')]);}_0x1a31e0[_0x0caf('0x5b')]=qs[_0x0caf('0x3d')](_0x259265[_0x0caf('0x33')][_0x0caf('0x3d')]);_0x1a31e0[_0x0caf('0x41')]=qs[_0x0caf('0x35')](_[_0x0caf('0x3e')](_0x259265[_0x0caf('0x33')],_0x7a8bc4[_0x0caf('0x35')]));_0x1a31e0['where'][_0x0caf('0x5c')]=_0x213691['id'];if(_0x259265['query'][_0x0caf('0x3f')]){_0x1a31e0[_0x0caf('0x41')]=_['merge'](_0x1a31e0[_0x0caf('0x41')],{'$or':_[_0x0caf('0x2c')](_0x1a31e0[_0x0caf('0x37')],function(_0x5e2ac1){var _0x3698f1={};_0x3698f1[_0x5e2ac1]={'$like':'%'+_0x259265[_0x0caf('0x33')][_0x0caf('0x3f')]+'%'};return _0x3698f1;})});}_0x1a31e0=_['merge']({},_0x1a31e0,_0x259265[_0x0caf('0x43')]);return db[_0x0caf('0x5f')][_0x0caf('0x1d')]({'where':_0x1a31e0[_0x0caf('0x41')]})[_0x0caf('0x25')](function(_0x3d5acf){_0x4e29a0[_0x0caf('0x1d')]=_0x3d5acf;if(_0x259265[_0x0caf('0x33')][_0x0caf('0x44')]){_0x1a31e0[_0x0caf('0x4a')]=[{'all':!![]}];}return db[_0x0caf('0x5f')][_0x0caf('0x45')](_0x1a31e0);})['then'](function(_0x369d72){_0x4e29a0[_0x0caf('0x46')]=_0x369d72;return _0x4e29a0;});}})[_0x0caf('0x25')](respondWithFilteredResult(_0x3105f2,_0x1a31e0))[_0x0caf('0x47')](handleError(_0x3105f2,null));};function char(_0x4b8274){return'number'===typeof _0x4b8274?String[_0x0caf('0x60')][_0x0caf('0x21')](null,arguments):_0x4b8274;}function needsEncapsulation(_0x5d1f05){return!!_0x5d1f05&&(_0x5d1f05[_0x0caf('0x61')]()['indexOf'](char(0xd))>=0x0||_0x5d1f05[_0x0caf('0x61')]()[_0x0caf('0x62')](char(0xa))>=0x0||_0x5d1f05[_0x0caf('0x61')]()['indexOf'](char(0x2c))>=0x0||_0x5d1f05[_0x0caf('0x61')]()[_0x0caf('0x62')](char(0x22))>=0x0);}function encapsulate(_0x45cc70){var _0x17a019=char(0x22),_0x411a53='\x5c'+char(0x22),_0x52ad67=_0x45cc70['toString']()[_0x0caf('0x63')](new RegExp(_0x17a019,'g'),_0x411a53);return _0x17a019+_0x52ad67+_0x17a019;}exports[_0x0caf('0x64')]=function(_0x6ff507,_0xe38fcf,_0xcee82a){var _0x40b83c,_0x7d954;var _0x486be0={'where':{'ProjectId':_0x6ff507['params']['id']}};if(_0x6ff507[_0x0caf('0x33')][_0x0caf('0x65')]){_0x486be0['where']['starttime']=JSON[_0x0caf('0x66')](_0x6ff507['query'][_0x0caf('0x65')]);}return db[_0x0caf('0x5d')][_0x0caf('0x45')](_0x486be0)[_0x0caf('0x25')](handleEntityNotFound(_0xe38fcf,null))[_0x0caf('0x25')](function(_0x2dfb7a){if(_0x2dfb7a){_0x40b83c=_0x2dfb7a;return db[_0x0caf('0x67')][_0x0caf('0x45')]({'where':{'SessionId':{'$in':_[_0x0caf('0x2c')](_0x40b83c,'id')},'ProjectId':_0x6ff507[_0x0caf('0x49')]['id']},'order':'-createdAt'});}})[_0x0caf('0x25')](handleEntityNotFound(_0xe38fcf,null))[_0x0caf('0x25')](function(_0x258c82){if(_0x258c82){_0x7d954=_0x258c82;var _0x431309={};for(var _0x40b58f=0x0,_0x35f1a8=_0x7d954['length'];_0x40b58f<_0x35f1a8;_0x40b58f++){if(!_0x431309['hasOwnProperty'](_0x7d954[_0x40b58f][_0x0caf('0x68')])){_0x431309[_0x7d954[_0x40b58f]['questionId']]=needsEncapsulation(_0x7d954[_0x40b58f][_0x0caf('0x69')])?encapsulate(_0x7d954[_0x40b58f][_0x0caf('0x69')]):_0x7d954[_0x40b58f][_0x0caf('0x69')];}}var _0x47bce5=[],_0x13cc9f={};for(var _0x5a027e=0x0,_0xcde8b9=_0x40b83c[_0x0caf('0x39')];_0x5a027e<_0xcde8b9;_0x5a027e++){_0x13cc9f={'ProjectId':_0x6ff507['params']['id'],'SessionId':_0x40b83c[_0x5a027e]['id'],'StartTime':moment(_0x40b83c[_0x5a027e]['starttime'])[_0x0caf('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x49da85=0x0,_0x42d5ab=_0x7d954['length'];_0x49da85<_0x42d5ab;_0x49da85++){if(_0x7d954[_0x49da85][_0x0caf('0x6b')]==_0x40b83c[_0x5a027e]['id']&&_0x431309[_0x0caf('0x3a')](_0x7d954[_0x49da85][_0x0caf('0x68')])){_0x13cc9f[_0x431309[_0x7d954[_0x49da85]['questionId']]]=_0x7d954[_0x49da85][_0x0caf('0x6c')];}}for(var _0x37ef78 in _0x431309){if(!_0x13cc9f['hasOwnProperty'](_0x431309[_0x37ef78])){_0x13cc9f[_0x431309[_0x37ef78]]=null;}}_0x47bce5[_0x0caf('0x6d')](_0x13cc9f);}return _0x47bce5;}})[_0x0caf('0x25')](function(_0x5e7a03){if(!_['isEmpty'](_0x5e7a03)){var _0x4bdf08=toCsv(_0x5e7a03);var _0x3ee557=Date[_0x0caf('0x6e')]();fs[_0x0caf('0x6f')](util[_0x0caf('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6ff507[_0x0caf('0x49')]['id'],_0x3ee557),_0x4bdf08);_0xe38fcf[_0x0caf('0x70')](_0x0caf('0x71'),_0x0caf('0x72')+util[_0x0caf('0x6a')](_0x0caf('0x73'),_0x6ff507[_0x0caf('0x49')]['id'],_0x3ee557));_0xe38fcf[_0x0caf('0x70')](_0x0caf('0x74'),_0x0caf('0x75'));return _0xe38fcf[_0x0caf('0x76')](util[_0x0caf('0x6a')](_0x0caf('0x77'),_0x6ff507[_0x0caf('0x49')]['id'],_0x3ee557));}else{return _0xe38fcf[_0x0caf('0x19')](0xcc);}})[_0x0caf('0x47')](handleError(_0xe38fcf,null));}; \ No newline at end of file +var _0xddf4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','JscriptyProject','count','includeAll','include','rows','catch','show','params','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','getSessions','findOne','JscriptySessionReport','findAll','ProjectId','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','format','attachment;\x20filename=','setHeader','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x439b15,_0x440327){var _0x489977=function(_0x27c9c8){while(--_0x27c9c8){_0x439b15['push'](_0x439b15['shift']());}};_0x489977(++_0x440327);}(_0xddf4,0x14d));var _0x4ddf=function(_0x7ba218,_0x4c6fc6){_0x7ba218=_0x7ba218-0x0;var _0x34e436=_0xddf4[_0x7ba218];return _0x34e436;};'use strict';var pdf=require(_0x4ddf('0x0'));var emlformat=require(_0x4ddf('0x1'));var rimraf=require(_0x4ddf('0x2'));var zipdir=require(_0x4ddf('0x3'));var jsonpatch=require(_0x4ddf('0x4'));var rp=require('request-promise');var moment=require(_0x4ddf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4ddf('0x6'));var util=require(_0x4ddf('0x7'));var path=require(_0x4ddf('0x8'));var sox=require(_0x4ddf('0x9'));var csv=require(_0x4ddf('0xa'));var ejs=require(_0x4ddf('0xb'));var fs=require('fs');var _=require(_0x4ddf('0xc'));var squel=require(_0x4ddf('0xd'));var crypto=require(_0x4ddf('0xe'));var jsforce=require(_0x4ddf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4ddf('0xa'));var querystring=require(_0x4ddf('0x10'));var Papa=require('papaparse');var Redis=require(_0x4ddf('0x11'));var authService=require(_0x4ddf('0x12'));var qs=require(_0x4ddf('0x13'));var as=require(_0x4ddf('0x14'));var hardwareService=require(_0x4ddf('0x15'));var logger=require(_0x4ddf('0x16'))(_0x4ddf('0x17'));var utils=require(_0x4ddf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4ddf('0x19'));var db=require(_0x4ddf('0x1a'))['db'];function respondWithStatusCode(_0x256b06,_0x2f7b80){_0x2f7b80=_0x2f7b80||0xcc;return function(_0x742df){if(_0x742df){return _0x256b06[_0x4ddf('0x1b')](_0x2f7b80);}return _0x256b06['status'](_0x2f7b80)[_0x4ddf('0x1c')]();};}function respondWithResult(_0x2d1c3e,_0xa6214e){_0xa6214e=_0xa6214e||0xc8;return function(_0x4e80db){if(_0x4e80db){return _0x2d1c3e[_0x4ddf('0x1d')](_0xa6214e)['json'](_0x4e80db);}};}function respondWithFilteredResult(_0x246c30,_0x3503b8){return function(_0x171f36){if(_0x171f36){var _0x107d2d=_0x171f36['count'],_0x5cacff=_0x3503b8[_0x4ddf('0x1e')],_0x507c18=_0x3503b8['offset']+_0x3503b8[_0x4ddf('0x1f')],_0x1d1ed2;if(_0x507c18>=_0x107d2d){_0x507c18=_0x107d2d;_0x1d1ed2=0xc8;}else{_0x1d1ed2=0xce;}_0x246c30[_0x4ddf('0x1d')](_0x1d1ed2);return _0x246c30[_0x4ddf('0x20')](_0x4ddf('0x21'),_0x5cacff+'-'+_0x507c18+'/'+_0x107d2d)['json'](_0x171f36);}return null;};}function patchUpdates(_0xf3ac8b){return function(_0x44145b){try{jsonpatch[_0x4ddf('0x22')](_0x44145b,_0xf3ac8b,!![]);}catch(_0xc65f7e){return BPromise[_0x4ddf('0x23')](_0xc65f7e);}return _0x44145b[_0x4ddf('0x24')]();};}function saveUpdates(_0x3d6eb3,_0x2b7233){return function(_0x35a80f){if(_0x35a80f){return _0x35a80f[_0x4ddf('0x25')](_0x3d6eb3)[_0x4ddf('0x26')](function(_0x128b67){return _0x128b67;});}return null;};}function removeEntity(_0x407d8e,_0x1068ad){return function(_0x3e9df9){if(_0x3e9df9){return _0x3e9df9[_0x4ddf('0x27')]()[_0x4ddf('0x26')](function(){var _0x470c01=_0x3e9df9[_0x4ddf('0x28')]({'plain':!![]});var _0x37f5e3=_0x4ddf('0x29');return db['UserProfileResource'][_0x4ddf('0x27')]({'where':{'type':_0x37f5e3,'resourceId':_0x470c01['id']}})[_0x4ddf('0x26')](function(){return _0x3e9df9;});})[_0x4ddf('0x26')](function(){_0x407d8e['status'](0xcc)[_0x4ddf('0x1c')]();});}};}function handleEntityNotFound(_0x367974,_0x2e87a6){return function(_0x3096b4){if(!_0x3096b4){_0x367974[_0x4ddf('0x1b')](0x194);}return _0x3096b4;};}function handleError(_0x106bfc,_0x3eccd4){_0x3eccd4=_0x3eccd4||0x1f4;return function(_0x2a2284){logger[_0x4ddf('0x2a')](_0x2a2284[_0x4ddf('0x2b')]);if(_0x2a2284['name']){delete _0x2a2284[_0x4ddf('0x2c')];}_0x106bfc[_0x4ddf('0x1d')](_0x3eccd4)['send'](_0x2a2284);};}exports['index']=function(_0x364e5e,_0x35fddd){var _0x2088f8={},_0x4a058e={},_0x48ccea={'count':0x0,'rows':[]};var _0x135d55=_[_0x4ddf('0x2d')](db['JscriptyProject'][_0x4ddf('0x2e')],function(_0x465579){return{'name':_0x465579[_0x4ddf('0x2f')],'type':_0x465579[_0x4ddf('0x30')][_0x4ddf('0x31')]};});_0x4a058e[_0x4ddf('0x32')]=_[_0x4ddf('0x2d')](_0x135d55,_0x4ddf('0x2c'));_0x4a058e[_0x4ddf('0x33')]=_[_0x4ddf('0x34')](_0x364e5e[_0x4ddf('0x33')]);_0x4a058e['filters']=_[_0x4ddf('0x35')](_0x4a058e[_0x4ddf('0x32')],_0x4a058e[_0x4ddf('0x33')]);_0x2088f8[_0x4ddf('0x36')]=_['intersection'](_0x4a058e[_0x4ddf('0x32')],qs[_0x4ddf('0x37')](_0x364e5e[_0x4ddf('0x33')][_0x4ddf('0x37')]));_0x2088f8['attributes']=_0x2088f8[_0x4ddf('0x36')][_0x4ddf('0x38')]?_0x2088f8[_0x4ddf('0x36')]:_0x4a058e[_0x4ddf('0x32')];if(!_0x364e5e[_0x4ddf('0x33')][_0x4ddf('0x39')](_0x4ddf('0x3a'))){_0x2088f8[_0x4ddf('0x1f')]=qs[_0x4ddf('0x1f')](_0x364e5e['query'][_0x4ddf('0x1f')]);_0x2088f8[_0x4ddf('0x1e')]=qs[_0x4ddf('0x1e')](_0x364e5e[_0x4ddf('0x33')]['offset']);}_0x2088f8[_0x4ddf('0x3b')]=qs[_0x4ddf('0x3c')](_0x364e5e['query'][_0x4ddf('0x3c')]);_0x2088f8['where']=qs[_0x4ddf('0x3d')](_[_0x4ddf('0x3e')](_0x364e5e['query'],_0x4a058e['filters']),_0x135d55);if(_0x364e5e[_0x4ddf('0x33')][_0x4ddf('0x3f')]){_0x2088f8[_0x4ddf('0x40')]=_[_0x4ddf('0x41')](_0x2088f8[_0x4ddf('0x40')],{'$or':_[_0x4ddf('0x2d')](_0x135d55,function(_0x23a050){if(_0x23a050[_0x4ddf('0x30')]!==_0x4ddf('0x42')){var _0x360821={};_0x360821[_0x23a050[_0x4ddf('0x2c')]]={'$like':'%'+_0x364e5e[_0x4ddf('0x33')][_0x4ddf('0x3f')]+'%'};return _0x360821;}})});}_0x2088f8=_[_0x4ddf('0x41')]({},_0x2088f8,_0x364e5e['options']);var _0x9a9c9c={'where':_0x2088f8['where']};return db[_0x4ddf('0x43')][_0x4ddf('0x44')](_0x9a9c9c)[_0x4ddf('0x26')](function(_0x53e911){_0x48ccea[_0x4ddf('0x44')]=_0x53e911;if(_0x364e5e[_0x4ddf('0x33')][_0x4ddf('0x45')]){_0x2088f8[_0x4ddf('0x46')]=[{'all':!![]}];}return db[_0x4ddf('0x43')]['findAll'](_0x2088f8);})[_0x4ddf('0x26')](function(_0x39d56f){_0x48ccea[_0x4ddf('0x47')]=_0x39d56f;return _0x48ccea;})[_0x4ddf('0x26')](respondWithFilteredResult(_0x35fddd,_0x2088f8))[_0x4ddf('0x48')](handleError(_0x35fddd,null));};exports[_0x4ddf('0x49')]=function(_0x5872a6,_0x1a9c2f){var _0x43ed90={'raw':![],'where':{'id':_0x5872a6[_0x4ddf('0x4a')]['id']}},_0x5b1fba={};_0x5b1fba[_0x4ddf('0x32')]=_[_0x4ddf('0x34')](db[_0x4ddf('0x43')][_0x4ddf('0x2e')]);_0x5b1fba[_0x4ddf('0x33')]=_[_0x4ddf('0x34')](_0x5872a6['query']);_0x5b1fba['filters']=_[_0x4ddf('0x35')](_0x5b1fba[_0x4ddf('0x32')],_0x5b1fba[_0x4ddf('0x33')]);_0x43ed90['attributes']=_[_0x4ddf('0x35')](_0x5b1fba[_0x4ddf('0x32')],qs[_0x4ddf('0x37')](_0x5872a6['query'][_0x4ddf('0x37')]));_0x43ed90['attributes']=_0x43ed90[_0x4ddf('0x36')][_0x4ddf('0x38')]?_0x43ed90['attributes']:_0x5b1fba['model'];if(_0x5872a6['query'][_0x4ddf('0x45')]){_0x43ed90[_0x4ddf('0x46')]=[{'all':!![]}];}_0x43ed90=_[_0x4ddf('0x41')]({},_0x43ed90,_0x5872a6[_0x4ddf('0x4b')]);return db[_0x4ddf('0x43')][_0x4ddf('0x4c')](_0x43ed90)[_0x4ddf('0x26')](handleEntityNotFound(_0x1a9c2f,null))[_0x4ddf('0x26')](respondWithResult(_0x1a9c2f,null))[_0x4ddf('0x48')](handleError(_0x1a9c2f,null));};exports[_0x4ddf('0x4d')]=function(_0x58a63f,_0x3d77f3){return db[_0x4ddf('0x43')][_0x4ddf('0x4d')](_0x58a63f[_0x4ddf('0x4e')],{})[_0x4ddf('0x26')](function(_0x3570de){var _0x240140=_0x58a63f[_0x4ddf('0x4f')]['get']({'plain':!![]});if(!_0x240140)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x240140['role']===_0x4ddf('0x4f')){var _0x31cb88=_0x3570de['get']({'plain':!![]});var _0x10430b='Projects';return db[_0x4ddf('0x50')]['find']({'where':{'name':_0x10430b,'userProfileId':_0x240140['userProfileId']},'raw':!![]})['then'](function(_0x4092db){if(_0x4092db&&_0x4092db[_0x4ddf('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x31cb88[_0x4ddf('0x2c')],'resourceId':_0x31cb88['id'],'type':_0x4092db[_0x4ddf('0x2c')],'sectionId':_0x4092db['id']},{})[_0x4ddf('0x26')](function(){return _0x3570de;});}else{return _0x3570de;}})[_0x4ddf('0x48')](function(_0x4dd8a9){logger[_0x4ddf('0x2a')](_0x4ddf('0x52'),_0x4dd8a9);throw _0x4dd8a9;});}return _0x3570de;})[_0x4ddf('0x26')](respondWithResult(_0x3d77f3,0xc9))['catch'](handleError(_0x3d77f3,null));};exports[_0x4ddf('0x53')]=function(_0x2472fb,_0x721656){var _0x932bc1={'where':{'id':_0x2472fb[_0x4ddf('0x4a')]['id']}},_0x1f7d51={};_0x1f7d51[_0x4ddf('0x32')]=_[_0x4ddf('0x34')](db['JscriptyProject']['rawAttributes']);_0x932bc1[_0x4ddf('0x36')]=_[_0x4ddf('0x35')](_0x1f7d51[_0x4ddf('0x32')],qs[_0x4ddf('0x37')](_0x2472fb['query']['fields']));_0x932bc1[_0x4ddf('0x36')]=_0x932bc1['attributes'][_0x4ddf('0x38')]?_0x932bc1[_0x4ddf('0x36')]:_0x1f7d51[_0x4ddf('0x32')];if(_0x2472fb[_0x4ddf('0x33')]['includeAll']){_0x932bc1['include']=[{'all':!![]}];}_0x932bc1=_['merge']({},_0x932bc1,_0x2472fb[_0x4ddf('0x4b')]);return db[_0x4ddf('0x43')]['find'](_0x932bc1)[_0x4ddf('0x26')](handleEntityNotFound(_0x721656,null))['then'](function(_0x2cdf09){if(_0x2cdf09){var _0x2345f4=_0x2cdf09['get']({'plain':!![]});_0x2345f4=qs[_0x4ddf('0x54')](_0x2345f4,['id',_0x4ddf('0x55'),_0x4ddf('0x56')]);_0x2472fb['body']=_[_0x4ddf('0x54')](_0x2472fb[_0x4ddf('0x4e')],['id',_0x4ddf('0x55'),_0x4ddf('0x56')]);return db['JscriptyProject'][_0x4ddf('0x4d')](_['merge'](_0x2345f4,_0x2472fb[_0x4ddf('0x4e')]),{'include':_0x2472fb['query'][_0x4ddf('0x45')]?[{'all':!![]}]:undefined})[_0x4ddf('0x26')](function(_0x3f6e98){var _0x104460=_0x2472fb['user'][_0x4ddf('0x28')]({'plain':!![]});if(!_0x104460)throw new Error(_0x4ddf('0x57'));if(_0x104460[_0x4ddf('0x58')]===_0x4ddf('0x4f')){var _0x4518ec=_0x3f6e98[_0x4ddf('0x28')]({'plain':!![]});var _0x8edd87='Projects';return db['UserProfileSection'][_0x4ddf('0x4c')]({'where':{'name':_0x8edd87,'userProfileId':_0x104460[_0x4ddf('0x59')]},'raw':!![]})[_0x4ddf('0x26')](function(_0xa954b8){if(_0xa954b8&&_0xa954b8[_0x4ddf('0x51')]===0x0){return db[_0x4ddf('0x5a')][_0x4ddf('0x4d')]({'name':_0x4518ec[_0x4ddf('0x2c')],'resourceId':_0x4518ec['id'],'type':_0xa954b8[_0x4ddf('0x2c')],'sectionId':_0xa954b8['id']},{})[_0x4ddf('0x26')](function(){return _0x3f6e98;});}else{return _0x3f6e98;}})['catch'](function(_0xac9d07){logger['error'](_0x4ddf('0x52'),_0xac9d07);throw _0xac9d07;});}return _0x3f6e98;});}})['then'](respondWithResult(_0x721656,0xc9))[_0x4ddf('0x48')](handleError(_0x721656,null));};exports[_0x4ddf('0x25')]=function(_0x1dfbc8,_0xa3fac0){if(_0x1dfbc8[_0x4ddf('0x4e')]['id']){delete _0x1dfbc8[_0x4ddf('0x4e')]['id'];}return db['JscriptyProject'][_0x4ddf('0x4c')]({'where':{'id':_0x1dfbc8[_0x4ddf('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa3fac0,null))[_0x4ddf('0x26')](saveUpdates(_0x1dfbc8['body'],null))[_0x4ddf('0x26')](respondWithResult(_0xa3fac0,null))['catch'](handleError(_0xa3fac0,null));};exports[_0x4ddf('0x27')]=function(_0x2d9b35,_0x19b035){return db[_0x4ddf('0x43')][_0x4ddf('0x4c')]({'where':{'id':_0x2d9b35[_0x4ddf('0x4a')]['id']}})[_0x4ddf('0x26')](handleEntityNotFound(_0x19b035,null))['then'](removeEntity(_0x19b035,null))[_0x4ddf('0x48')](handleError(_0x19b035,null));};exports[_0x4ddf('0x5b')]=function(_0xe693df,_0x56b31a,_0x4bb967){var _0x17ac8f={'raw':!![],'where':{}};var _0x4d0782={};var _0x4537b1={'count':0x0,'rows':[]};return db[_0x4ddf('0x43')][_0x4ddf('0x5c')]({'where':{'id':_0xe693df[_0x4ddf('0x4a')]['id']}})[_0x4ddf('0x26')](handleEntityNotFound(_0x56b31a,null))[_0x4ddf('0x26')](function(_0x46b4f4){if(_0x46b4f4){_0x4d0782[_0x4ddf('0x32')]=_['keys'](db[_0x4ddf('0x5d')][_0x4ddf('0x2e')]);_0x4d0782['query']=_[_0x4ddf('0x34')](_0xe693df[_0x4ddf('0x33')]);_0x4d0782['filters']=_['intersection'](_0x4d0782[_0x4ddf('0x32')],_0x4d0782[_0x4ddf('0x33')]);_0x17ac8f[_0x4ddf('0x36')]=_['intersection'](_0x4d0782[_0x4ddf('0x32')],qs['fields'](_0xe693df[_0x4ddf('0x33')]['fields']));_0x17ac8f[_0x4ddf('0x36')]=_0x17ac8f[_0x4ddf('0x36')][_0x4ddf('0x38')]?_0x17ac8f[_0x4ddf('0x36')]:_0x4d0782[_0x4ddf('0x32')];if(!_0xe693df[_0x4ddf('0x33')][_0x4ddf('0x39')](_0x4ddf('0x3a'))){_0x17ac8f[_0x4ddf('0x1f')]=qs[_0x4ddf('0x1f')](_0xe693df['query'][_0x4ddf('0x1f')]);_0x17ac8f[_0x4ddf('0x1e')]=qs['offset'](_0xe693df['query'][_0x4ddf('0x1e')]);}_0x17ac8f['order']=qs['sort'](_0xe693df['query']['sort']);_0x17ac8f[_0x4ddf('0x40')]=qs[_0x4ddf('0x3d')](_[_0x4ddf('0x3e')](_0xe693df[_0x4ddf('0x33')],_0x4d0782[_0x4ddf('0x3d')]));_0x17ac8f[_0x4ddf('0x40')]['ProjectId']=_0x46b4f4['id'];if(_0xe693df[_0x4ddf('0x33')][_0x4ddf('0x3f')]){_0x17ac8f[_0x4ddf('0x40')]=_[_0x4ddf('0x41')](_0x17ac8f[_0x4ddf('0x40')],{'$or':_['map'](_0x17ac8f['attributes'],function(_0x432dbf){var _0x494cc6={};_0x494cc6[_0x432dbf]={'$like':'%'+_0xe693df[_0x4ddf('0x33')][_0x4ddf('0x3f')]+'%'};return _0x494cc6;})});}_0x17ac8f=_[_0x4ddf('0x41')]({},_0x17ac8f,_0xe693df[_0x4ddf('0x4b')]);return db[_0x4ddf('0x5d')][_0x4ddf('0x44')]({'where':_0x17ac8f[_0x4ddf('0x40')]})[_0x4ddf('0x26')](function(_0x3a65ac){_0x4537b1[_0x4ddf('0x44')]=_0x3a65ac;if(_0xe693df[_0x4ddf('0x33')][_0x4ddf('0x45')]){_0x17ac8f[_0x4ddf('0x46')]=[{'all':!![]}];}return db[_0x4ddf('0x5d')][_0x4ddf('0x5e')](_0x17ac8f);})[_0x4ddf('0x26')](function(_0x1d075d){_0x4537b1[_0x4ddf('0x47')]=_0x1d075d;return _0x4537b1;});}})[_0x4ddf('0x26')](respondWithFilteredResult(_0x56b31a,_0x17ac8f))[_0x4ddf('0x48')](handleError(_0x56b31a,null));};exports['getAnswers']=function(_0x4d14d,_0xd5219f,_0x249a12){var _0x49a824={'raw':!![],'where':{}};var _0x467c04={};var _0x32c685={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x4ddf('0x5c')]({'where':{'id':_0x4d14d[_0x4ddf('0x4a')]['id']}})[_0x4ddf('0x26')](handleEntityNotFound(_0xd5219f,null))['then'](function(_0x435cc1){if(_0x435cc1){_0x467c04['model']=_[_0x4ddf('0x34')](db['JscriptyAnswerReport'][_0x4ddf('0x2e')]);_0x467c04[_0x4ddf('0x33')]=_[_0x4ddf('0x34')](_0x4d14d[_0x4ddf('0x33')]);_0x467c04[_0x4ddf('0x3d')]=_[_0x4ddf('0x35')](_0x467c04[_0x4ddf('0x32')],_0x467c04[_0x4ddf('0x33')]);_0x49a824[_0x4ddf('0x36')]=_[_0x4ddf('0x35')](_0x467c04['model'],qs['fields'](_0x4d14d[_0x4ddf('0x33')][_0x4ddf('0x37')]));_0x49a824['attributes']=_0x49a824['attributes'][_0x4ddf('0x38')]?_0x49a824[_0x4ddf('0x36')]:_0x467c04[_0x4ddf('0x32')];if(!_0x4d14d['query'][_0x4ddf('0x39')](_0x4ddf('0x3a'))){_0x49a824[_0x4ddf('0x1f')]=qs['limit'](_0x4d14d[_0x4ddf('0x33')][_0x4ddf('0x1f')]);_0x49a824[_0x4ddf('0x1e')]=qs[_0x4ddf('0x1e')](_0x4d14d['query'][_0x4ddf('0x1e')]);}_0x49a824['order']=qs['sort'](_0x4d14d[_0x4ddf('0x33')][_0x4ddf('0x3c')]);_0x49a824[_0x4ddf('0x40')]=qs[_0x4ddf('0x3d')](_[_0x4ddf('0x3e')](_0x4d14d['query'],_0x467c04[_0x4ddf('0x3d')]));_0x49a824[_0x4ddf('0x40')][_0x4ddf('0x5f')]=_0x435cc1['id'];if(_0x4d14d[_0x4ddf('0x33')][_0x4ddf('0x3f')]){_0x49a824[_0x4ddf('0x40')]=_[_0x4ddf('0x41')](_0x49a824[_0x4ddf('0x40')],{'$or':_[_0x4ddf('0x2d')](_0x49a824[_0x4ddf('0x36')],function(_0x523bb7){var _0x532342={};_0x532342[_0x523bb7]={'$like':'%'+_0x4d14d[_0x4ddf('0x33')][_0x4ddf('0x3f')]+'%'};return _0x532342;})});}_0x49a824=_['merge']({},_0x49a824,_0x4d14d[_0x4ddf('0x4b')]);return db[_0x4ddf('0x60')][_0x4ddf('0x44')]({'where':_0x49a824[_0x4ddf('0x40')]})[_0x4ddf('0x26')](function(_0x8c6ecd){_0x32c685[_0x4ddf('0x44')]=_0x8c6ecd;if(_0x4d14d[_0x4ddf('0x33')][_0x4ddf('0x45')]){_0x49a824[_0x4ddf('0x46')]=[{'all':!![]}];}return db[_0x4ddf('0x60')][_0x4ddf('0x5e')](_0x49a824);})['then'](function(_0x13ae33){_0x32c685[_0x4ddf('0x47')]=_0x13ae33;return _0x32c685;});}})[_0x4ddf('0x26')](respondWithFilteredResult(_0xd5219f,_0x49a824))[_0x4ddf('0x48')](handleError(_0xd5219f,null));};function char(_0x5d01bf){return'number'===typeof _0x5d01bf?String[_0x4ddf('0x61')][_0x4ddf('0x22')](null,arguments):_0x5d01bf;}function needsEncapsulation(_0x1030fa){return!!_0x1030fa&&(_0x1030fa[_0x4ddf('0x62')]()['indexOf'](char(0xd))>=0x0||_0x1030fa[_0x4ddf('0x62')]()[_0x4ddf('0x63')](char(0xa))>=0x0||_0x1030fa[_0x4ddf('0x62')]()[_0x4ddf('0x63')](char(0x2c))>=0x0||_0x1030fa[_0x4ddf('0x62')]()[_0x4ddf('0x63')](char(0x22))>=0x0);}function encapsulate(_0x3d8b01){var _0x2bb3fa=char(0x22),_0x23f5cc='\x5c'+char(0x22),_0x41e3ab=_0x3d8b01[_0x4ddf('0x62')]()[_0x4ddf('0x64')](new RegExp(_0x2bb3fa,'g'),_0x23f5cc);return _0x2bb3fa+_0x41e3ab+_0x2bb3fa;}exports[_0x4ddf('0x65')]=function(_0x1cbfc0,_0x58f611,_0x2acf98){var _0x2e4571,_0x248f0c;var _0x27a5ce={'where':{'ProjectId':_0x1cbfc0[_0x4ddf('0x4a')]['id']}};if(_0x1cbfc0[_0x4ddf('0x33')][_0x4ddf('0x66')]){_0x27a5ce[_0x4ddf('0x40')][_0x4ddf('0x67')]=JSON[_0x4ddf('0x68')](_0x1cbfc0[_0x4ddf('0x33')]['startTime']);}return db['JscriptySessionReport'][_0x4ddf('0x5e')](_0x27a5ce)[_0x4ddf('0x26')](handleEntityNotFound(_0x58f611,null))['then'](function(_0x5aebc7){if(_0x5aebc7){_0x2e4571=_0x5aebc7;return db[_0x4ddf('0x69')]['findAll']({'where':{'SessionId':{'$in':_[_0x4ddf('0x2d')](_0x2e4571,'id')},'ProjectId':_0x1cbfc0[_0x4ddf('0x4a')]['id']},'order':'-createdAt'});}})[_0x4ddf('0x26')](handleEntityNotFound(_0x58f611,null))[_0x4ddf('0x26')](function(_0x5d0323){if(_0x5d0323){_0x248f0c=_0x5d0323;var _0xb434f6={};for(var _0x149239=0x0,_0x32f0cf=_0x248f0c[_0x4ddf('0x38')];_0x149239<_0x32f0cf;_0x149239++){if(!_0xb434f6[_0x4ddf('0x39')](_0x248f0c[_0x149239]['questionId'])){_0xb434f6[_0x248f0c[_0x149239][_0x4ddf('0x6a')]]=needsEncapsulation(_0x248f0c[_0x149239]['question'])?encapsulate(_0x248f0c[_0x149239]['question']):_0x248f0c[_0x149239][_0x4ddf('0x6b')];}}var _0x3c6abd=[],_0x111254={};for(var _0x4f3b25=0x0,_0x3284a8=_0x2e4571[_0x4ddf('0x38')];_0x4f3b25<_0x3284a8;_0x4f3b25++){_0x111254={'ProjectId':_0x1cbfc0[_0x4ddf('0x4a')]['id'],'SessionId':_0x2e4571[_0x4f3b25]['id'],'StartTime':moment(_0x2e4571[_0x4f3b25][_0x4ddf('0x67')])['format'](_0x4ddf('0x6c'))};for(var _0x5d6f3a=0x0,_0x3e87d1=_0x248f0c[_0x4ddf('0x38')];_0x5d6f3a<_0x3e87d1;_0x5d6f3a++){if(_0x248f0c[_0x5d6f3a][_0x4ddf('0x6d')]==_0x2e4571[_0x4f3b25]['id']&&_0xb434f6['hasOwnProperty'](_0x248f0c[_0x5d6f3a]['questionId'])){_0x111254[_0xb434f6[_0x248f0c[_0x5d6f3a][_0x4ddf('0x6a')]]]=_0x248f0c[_0x5d6f3a]['answer'];}}for(var _0x2b80ff in _0xb434f6){if(!_0x111254['hasOwnProperty'](_0xb434f6[_0x2b80ff])){_0x111254[_0xb434f6[_0x2b80ff]]=null;}}_0x3c6abd[_0x4ddf('0x6e')](_0x111254);}return _0x3c6abd;}})[_0x4ddf('0x26')](function(_0x483087){if(!_[_0x4ddf('0x6f')](_0x483087)){var _0x50cfcc=toCsv(_0x483087);var _0x4149be=Date[_0x4ddf('0x70')]();fs[_0x4ddf('0x71')](util[_0x4ddf('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1cbfc0[_0x4ddf('0x4a')]['id'],_0x4149be),_0x50cfcc);_0x58f611['setHeader']('Content-disposition',_0x4ddf('0x73')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x1cbfc0['params']['id'],_0x4149be));_0x58f611[_0x4ddf('0x74')]('Content-type',_0x4ddf('0x75'));return _0x58f611['download'](util['format'](_0x4ddf('0x76'),_0x1cbfc0[_0x4ddf('0x4a')]['id'],_0x4149be));}else{return _0x58f611['sendStatus'](0xcc);}})[_0x4ddf('0x48')](handleError(_0x58f611,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1b919f1..94dd34f 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 _0xadf5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','JscriptyProject','jscripty_projects'];(function(_0x1185e9,_0x34e1a5){var _0x91cf24=function(_0x39deb3){while(--_0x39deb3){_0x1185e9['push'](_0x1185e9['shift']());}};_0x91cf24(++_0x34e1a5);}(_0xadf5,0x136));var _0x5adf=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xadf5[_0x2576d7];return _0x16a08c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5adf('0x0'))(_0x5adf('0x1'));var moment=require(_0x5adf('0x2'));var BPromise=require(_0x5adf('0x3'));var rp=require(_0x5adf('0x4'));var fs=require('fs');var path=require(_0x5adf('0x5'));var rimraf=require(_0x5adf('0x6'));var config=require(_0x5adf('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x230edf,_0x7ee78c){return _0x230edf['define'](_0x5adf('0x8'),attributes,{'tableName':_0x5adf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24fb=['rimraf','exports','define','JscriptyProject','jscripty_projects','util','moment','bluebird','request-promise','path'];(function(_0x354b79,_0x246003){var _0x389a17=function(_0x4f2a1f){while(--_0x4f2a1f){_0x354b79['push'](_0x354b79['shift']());}};_0x389a17(++_0x246003);}(_0x24fb,0x145));var _0xb24f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x24fb[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xb24f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb24f('0x1'));var BPromise=require(_0xb24f('0x2'));var rp=require(_0xb24f('0x3'));var fs=require('fs');var path=require(_0xb24f('0x4'));var rimraf=require(_0xb24f('0x5'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xb24f('0x6')]=function(_0x368e9a,_0x15a351){return _0x368e9a[_0xb24f('0x7')](_0xb24f('0x8'),attributes,{'tableName':_0xb24f('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 6a4d2de..dd8e29b 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 _0x4101=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x50d970,_0x47689a){var _0x2f90e9=function(_0x346d93){while(--_0x346d93){_0x50d970['push'](_0x50d970['shift']());}};_0x2f90e9(++_0x47689a);}(_0x4101,0xeb));var _0x1410=function(_0x4390f7,_0x38b36f){_0x4390f7=_0x4390f7-0x0;var _0x322888=_0x4101[_0x4390f7];return _0x322888;};'use strict';var _=require(_0x1410('0x0'));var util=require(_0x1410('0x1'));var moment=require(_0x1410('0x2'));var BPromise=require(_0x1410('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1410('0x4'));var db=require(_0x1410('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1410('0x6'))(_0x1410('0x7'));var config=require(_0x1410('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1410('0x9')][_0x1410('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f7d21,_0x3370af,_0x166c4a){return new BPromise(function(_0x3626c4,_0xd96cc4){return client[_0x1410('0xb')](_0x5f7d21,_0x166c4a)[_0x1410('0xc')](function(_0x41546a){logger[_0x1410('0xd')](_0x1410('0xe'),_0x3370af,_0x1410('0xf'));logger[_0x1410('0x10')](_0x1410('0x11'),_0x3370af,_0x1410('0xf'),JSON[_0x1410('0x12')](_0x41546a));if(_0x41546a[_0x1410('0x13')]){if(_0x41546a[_0x1410('0x13')][_0x1410('0x14')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x3370af,_0x41546a[_0x1410('0x13')][_0x1410('0x15')]);return _0xd96cc4(_0x41546a[_0x1410('0x13')]['message']);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x3370af,_0x41546a[_0x1410('0x13')][_0x1410('0x15')]);return _0x3626c4(_0x41546a['error'][_0x1410('0x15')]);}else{logger['info'](_0x1410('0xe'),_0x3370af,_0x1410('0xf'));_0x3626c4(_0x41546a[_0x1410('0x16')]['message']);}})[_0x1410('0x17')](function(_0x76bc51){logger['error'](_0x1410('0xe'),_0x3370af,_0x76bc51);_0xd96cc4(_0x76bc51);});});} \ No newline at end of file +var _0xa033=['then','info','JscriptyProject,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','request'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0xa033,0xc8));var _0x3a03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa033[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a03('0x2'));var db=require(_0x3a03('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a03('0x4'));var config=require('../../config/environment');var jayson=require(_0x3a03('0x5'));var client=jayson['client'][_0x3a03('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49e1a9,_0x78c71d,_0x34b4e5){return new BPromise(function(_0x209cf2,_0xa527cd){return client[_0x3a03('0x7')](_0x49e1a9,_0x34b4e5)[_0x3a03('0x8')](function(_0x337999){logger[_0x3a03('0x9')](_0x3a03('0xa'),_0x78c71d,'request\x20sent');logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x78c71d,'request\x20sent',JSON['stringify'](_0x337999));if(_0x337999['error']){if(_0x337999[_0x3a03('0xb')][_0x3a03('0xc')]===0x1f4){logger[_0x3a03('0xb')](_0x3a03('0xa'),_0x78c71d,_0x337999[_0x3a03('0xb')]['message']);return _0xa527cd(_0x337999['error'][_0x3a03('0xd')]);}logger['error'](_0x3a03('0xa'),_0x78c71d,_0x337999[_0x3a03('0xb')][_0x3a03('0xd')]);return _0x209cf2(_0x337999[_0x3a03('0xb')][_0x3a03('0xd')]);}else{logger[_0x3a03('0x9')](_0x3a03('0xa'),_0x78c71d,'request\x20sent');_0x209cf2(_0x337999[_0x3a03('0xe')][_0x3a03('0xd')]);}})[_0x3a03('0xf')](function(_0x7706c2){logger[_0x3a03('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x78c71d,_0x7706c2);_0xa527cd(_0x7706c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index eabd4ab..cdd4660 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 _0xf132=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x1a95b9,_0x4eb4dc){var _0xc47480=function(_0x3c6ba0){while(--_0x3c6ba0){_0x1a95b9['push'](_0x1a95b9['shift']());}};_0xc47480(++_0x4eb4dc);}(_0xf132,0xaa));var _0x2f13=function(_0x3631b0,_0x17d21f){_0x3631b0=_0x3631b0-0x0;var _0x3ab4a1=_0xf132[_0x3631b0];return _0x3ab4a1;};'use strict';var multer=require(_0x2f13('0x0'));var util=require('util');var path=require(_0x2f13('0x1'));var timeout=require('connect-timeout');var express=require(_0x2f13('0x2'));var router=express[_0x2f13('0x3')]();var auth=require(_0x2f13('0x4'));var interaction=require(_0x2f13('0x5'));var config=require(_0x2f13('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x2f13('0x7')]('/',auth[_0x2f13('0x8')](),controller['index']);router['get'](_0x2f13('0x9'),auth[_0x2f13('0x8')](),controller[_0x2f13('0xa')]);router[_0x2f13('0x7')](_0x2f13('0xb'),auth['isAuthenticated'](),controller[_0x2f13('0xc')]);router[_0x2f13('0xd')]('/',auth[_0x2f13('0x8')](),controller[_0x2f13('0xe')]);router[_0x2f13('0xf')](_0x2f13('0xb'),auth['isAuthenticated'](),controller[_0x2f13('0x10')]);router[_0x2f13('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2f13('0x12')]);module[_0x2f13('0x13')]=router; \ No newline at end of file +var _0x91d2=['get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller'];(function(_0x10a2ea,_0x487cf2){var _0x347b66=function(_0x592edb){while(--_0x592edb){_0x10a2ea['push'](_0x10a2ea['shift']());}};_0x347b66(++_0x487cf2);}(_0x91d2,0x188));var _0x291d=function(_0x1bb9a3,_0x11d873){_0x1bb9a3=_0x1bb9a3-0x0;var _0x36e207=_0x91d2[_0x1bb9a3];return _0x36e207;};'use strict';var multer=require(_0x291d('0x0'));var util=require(_0x291d('0x1'));var path=require(_0x291d('0x2'));var timeout=require('connect-timeout');var express=require(_0x291d('0x3'));var router=express[_0x291d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x291d('0x5'));var config=require('../../config/environment');var controller=require(_0x291d('0x6'));router[_0x291d('0x7')]('/',auth[_0x291d('0x8')](),controller['index']);router[_0x291d('0x7')](_0x291d('0x9'),auth[_0x291d('0x8')](),controller[_0x291d('0xa')]);router[_0x291d('0x7')](_0x291d('0xb'),auth[_0x291d('0x8')](),controller['show']);router[_0x291d('0xc')]('/',auth[_0x291d('0x8')](),controller[_0x291d('0xd')]);router[_0x291d('0xe')](_0x291d('0xb'),auth[_0x291d('0x8')](),controller[_0x291d('0xf')]);router[_0x291d('0x10')](_0x291d('0xb'),auth['isAuthenticated'](),controller[_0x291d('0x11')]);module[_0x291d('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index c592f93..1c38a8f 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 _0x01d3=['TEXT','STRING','sequelize','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x01d3,0xa2));var _0x301d=function(_0x16c1a5,_0x17dfb0){_0x16c1a5=_0x16c1a5-0x0;var _0x421b5e=_0x01d3[_0x16c1a5];return _0x421b5e;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'question':{'type':Sequelize[_0x301d('0x2')]},'answer':{'type':Sequelize[_0x301d('0x2')]('long')},'membername':{'type':Sequelize[_0x301d('0x3')]},'projectname':{'type':Sequelize[_0x301d('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x301d('0x3')]},'calleridname':{'type':Sequelize[_0x301d('0x3')]},'calleridnum':{'type':Sequelize[_0x301d('0x3')]},'questionId':{'type':Sequelize[_0x301d('0x3')]}}; \ No newline at end of file +var _0x9e0d=['exports','TEXT','STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x427b05,_0x33838c){_0x427b05=_0x427b05-0x0;var _0x376e9d=_0x9e0d[_0x427b05];return _0x376e9d;};'use strict';var Sequelize=require(_0xd9e0('0x0'));module[_0xd9e0('0x1')]={'question':{'type':Sequelize[_0xd9e0('0x2')]},'answer':{'type':Sequelize[_0xd9e0('0x2')]('long')},'membername':{'type':Sequelize[_0xd9e0('0x3')]},'projectname':{'type':Sequelize[_0xd9e0('0x3')]},'queue':{'type':Sequelize[_0xd9e0('0x3')]},'uniqueid':{'type':Sequelize[_0xd9e0('0x3')]},'calleridname':{'type':Sequelize[_0xd9e0('0x3')]},'calleridnum':{'type':Sequelize[_0xd9e0('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 09d4665..d874a4a 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 _0xb673=['VIRTUAL','options','include','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where'];(function(_0x4f4aa2,_0x53eb4c){var _0x11f09a=function(_0x582470){while(--_0x582470){_0x4f4aa2['push'](_0x4f4aa2['shift']());}};_0x11f09a(++_0x53eb4c);}(_0xb673,0x137));var _0x3b67=function(_0x61f83b,_0x3561ff){_0x61f83b=_0x61f83b-0x0;var _0x468bcf=_0xb673[_0x61f83b];return _0x468bcf;};'use strict';var pdf=require(_0x3b67('0x0'));var emlformat=require(_0x3b67('0x1'));var rimraf=require(_0x3b67('0x2'));var zipdir=require(_0x3b67('0x3'));var jsonpatch=require(_0x3b67('0x4'));var rp=require('request-promise');var moment=require(_0x3b67('0x5'));var BPromise=require(_0x3b67('0x6'));var Mustache=require('mustache');var util=require(_0x3b67('0x7'));var path=require('path');var sox=require(_0x3b67('0x8'));var csv=require(_0x3b67('0x9'));var ejs=require(_0x3b67('0xa'));var fs=require('fs');var _=require(_0x3b67('0xb'));var squel=require(_0x3b67('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b67('0xd'));var deskjs=require(_0x3b67('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b67('0xf'));var Redis=require(_0x3b67('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b67('0x11'));var as=require(_0x3b67('0x12'));var hardwareService=require(_0x3b67('0x13'));var logger=require(_0x3b67('0x14'))('api');var utils=require(_0x3b67('0x15'));var config=require(_0x3b67('0x16'));var licenseUtil=require(_0x3b67('0x17'));var db=require(_0x3b67('0x18'))['db'];function respondWithStatusCode(_0x4f2d9d,_0x4bb2e8){_0x4bb2e8=_0x4bb2e8||0xcc;return function(_0x26be9f){if(_0x26be9f){return _0x4f2d9d['sendStatus'](_0x4bb2e8);}return _0x4f2d9d[_0x3b67('0x19')](_0x4bb2e8)[_0x3b67('0x1a')]();};}function respondWithResult(_0x19c82d,_0x3a4a15){_0x3a4a15=_0x3a4a15||0xc8;return function(_0x18be08){if(_0x18be08){return _0x19c82d[_0x3b67('0x19')](_0x3a4a15)[_0x3b67('0x1b')](_0x18be08);}};}function respondWithFilteredResult(_0x556a74,_0x1b3815){return function(_0x2a9b4d){if(_0x2a9b4d){var _0x3a6311=_0x2a9b4d[_0x3b67('0x1c')],_0x238639=_0x1b3815[_0x3b67('0x1d')],_0x3e5075=_0x1b3815[_0x3b67('0x1d')]+_0x1b3815[_0x3b67('0x1e')],_0x1ba843;if(_0x3e5075>=_0x3a6311){_0x3e5075=_0x3a6311;_0x1ba843=0xc8;}else{_0x1ba843=0xce;}_0x556a74[_0x3b67('0x19')](_0x1ba843);return _0x556a74['set'](_0x3b67('0x1f'),_0x238639+'-'+_0x3e5075+'/'+_0x3a6311)[_0x3b67('0x1b')](_0x2a9b4d);}return null;};}function patchUpdates(_0x25ccac){return function(_0x331ee6){try{jsonpatch[_0x3b67('0x20')](_0x331ee6,_0x25ccac,!![]);}catch(_0x5daad5){return BPromise[_0x3b67('0x21')](_0x5daad5);}return _0x331ee6[_0x3b67('0x22')]();};}function saveUpdates(_0x348430,_0x36a29d){return function(_0x36ec2d){if(_0x36ec2d){return _0x36ec2d['update'](_0x348430)['then'](function(_0x1ee2f5){return _0x1ee2f5;});}return null;};}function removeEntity(_0x7a08f0,_0x4afe98){return function(_0x14f9d4){if(_0x14f9d4){return _0x14f9d4[_0x3b67('0x23')]()[_0x3b67('0x24')](function(){_0x7a08f0[_0x3b67('0x19')](0xcc)[_0x3b67('0x1a')]();});}};}function handleEntityNotFound(_0x20ce55,_0x3b104f){return function(_0x2b2d7a){if(!_0x2b2d7a){_0x20ce55[_0x3b67('0x25')](0x194);}return _0x2b2d7a;};}function handleError(_0x22e0b5,_0x589b04){_0x589b04=_0x589b04||0x1f4;return function(_0x2863bd){logger[_0x3b67('0x26')](_0x2863bd[_0x3b67('0x27')]);if(_0x2863bd[_0x3b67('0x28')]){delete _0x2863bd[_0x3b67('0x28')];}_0x22e0b5[_0x3b67('0x19')](_0x589b04)[_0x3b67('0x29')](_0x2863bd);};}exports[_0x3b67('0x2a')]=function(_0x4fd797,_0x38278e){var _0x2ed3a7={},_0x496637={},_0x35d979={'count':0x0,'rows':[]};var _0x420beb=_[_0x3b67('0x2b')](db[_0x3b67('0x2c')][_0x3b67('0x2d')],function(_0x7bf41c){return{'name':_0x7bf41c[_0x3b67('0x2e')],'type':_0x7bf41c[_0x3b67('0x2f')][_0x3b67('0x30')]};});_0x496637['model']=_[_0x3b67('0x2b')](_0x420beb,'name');_0x496637[_0x3b67('0x31')]=_[_0x3b67('0x32')](_0x4fd797[_0x3b67('0x31')]);_0x496637[_0x3b67('0x33')]=_[_0x3b67('0x34')](_0x496637['model'],_0x496637[_0x3b67('0x31')]);_0x2ed3a7['attributes']=_[_0x3b67('0x34')](_0x496637[_0x3b67('0x35')],qs[_0x3b67('0x36')](_0x4fd797[_0x3b67('0x31')][_0x3b67('0x36')]));_0x2ed3a7[_0x3b67('0x37')]=_0x2ed3a7[_0x3b67('0x37')][_0x3b67('0x38')]?_0x2ed3a7[_0x3b67('0x37')]:_0x496637['model'];if(!_0x4fd797[_0x3b67('0x31')][_0x3b67('0x39')]('nolimit')){_0x2ed3a7['limit']=qs[_0x3b67('0x1e')](_0x4fd797[_0x3b67('0x31')][_0x3b67('0x1e')]);_0x2ed3a7[_0x3b67('0x1d')]=qs['offset'](_0x4fd797[_0x3b67('0x31')][_0x3b67('0x1d')]);}_0x2ed3a7[_0x3b67('0x3a')]=qs[_0x3b67('0x3b')](_0x4fd797[_0x3b67('0x31')]['sort']);_0x2ed3a7['where']=qs['filters'](_[_0x3b67('0x3c')](_0x4fd797['query'],_0x496637[_0x3b67('0x33')]),_0x420beb);if(_0x4fd797[_0x3b67('0x31')][_0x3b67('0x3d')]){_0x2ed3a7['where']=_[_0x3b67('0x3e')](_0x2ed3a7[_0x3b67('0x3f')],{'$or':_['map'](_0x420beb,function(_0x54cb2b){if(_0x54cb2b[_0x3b67('0x2f')]!==_0x3b67('0x40')){var _0x5cd286={};_0x5cd286[_0x54cb2b[_0x3b67('0x28')]]={'$like':'%'+_0x4fd797[_0x3b67('0x31')][_0x3b67('0x3d')]+'%'};return _0x5cd286;}})});}_0x2ed3a7=_['merge']({},_0x2ed3a7,_0x4fd797[_0x3b67('0x41')]);var _0x46d874={'where':_0x2ed3a7[_0x3b67('0x3f')]};return db[_0x3b67('0x2c')][_0x3b67('0x1c')](_0x46d874)[_0x3b67('0x24')](function(_0x2372d3){_0x35d979[_0x3b67('0x1c')]=_0x2372d3;if(_0x4fd797['query']['includeAll']){_0x2ed3a7[_0x3b67('0x42')]=[{'all':!![]}];}return db[_0x3b67('0x2c')]['findAll'](_0x2ed3a7);})[_0x3b67('0x24')](function(_0x3c1ad5){_0x35d979['rows']=_0x3c1ad5;return _0x35d979;})[_0x3b67('0x24')](respondWithFilteredResult(_0x38278e,_0x2ed3a7))[_0x3b67('0x43')](handleError(_0x38278e,null));};exports[_0x3b67('0x44')]=function(_0x2aa07e,_0x4a8a84){var _0xf05821={'raw':!![],'where':{'id':_0x2aa07e[_0x3b67('0x45')]['id']}},_0xb87242={};_0xb87242[_0x3b67('0x35')]=_[_0x3b67('0x32')](db[_0x3b67('0x2c')]['rawAttributes']);_0xb87242[_0x3b67('0x31')]=_['keys'](_0x2aa07e['query']);_0xb87242[_0x3b67('0x33')]=_['intersection'](_0xb87242[_0x3b67('0x35')],_0xb87242[_0x3b67('0x31')]);_0xf05821[_0x3b67('0x37')]=_[_0x3b67('0x34')](_0xb87242[_0x3b67('0x35')],qs[_0x3b67('0x36')](_0x2aa07e['query'][_0x3b67('0x36')]));_0xf05821[_0x3b67('0x37')]=_0xf05821[_0x3b67('0x37')][_0x3b67('0x38')]?_0xf05821['attributes']:_0xb87242['model'];if(_0x2aa07e[_0x3b67('0x31')]['includeAll']){_0xf05821['include']=[{'all':!![]}];}_0xf05821=_['merge']({},_0xf05821,_0x2aa07e[_0x3b67('0x41')]);return db['JscriptyQuestionReport'][_0x3b67('0x46')](_0xf05821)['then'](handleEntityNotFound(_0x4a8a84,null))[_0x3b67('0x24')](respondWithResult(_0x4a8a84,null))[_0x3b67('0x43')](handleError(_0x4a8a84,null));};exports[_0x3b67('0x47')]=function(_0x3d7310,_0x1dff43){return db['JscriptyQuestionReport'][_0x3b67('0x47')](_0x3d7310[_0x3b67('0x48')],{})[_0x3b67('0x24')](respondWithResult(_0x1dff43,0xc9))[_0x3b67('0x43')](handleError(_0x1dff43,null));};exports[_0x3b67('0x49')]=function(_0x47a634,_0x3603ba){if(_0x47a634[_0x3b67('0x48')]['id']){delete _0x47a634['body']['id'];}return db['JscriptyQuestionReport'][_0x3b67('0x46')]({'where':{'id':_0x47a634[_0x3b67('0x45')]['id']}})[_0x3b67('0x24')](handleEntityNotFound(_0x3603ba,null))[_0x3b67('0x24')](saveUpdates(_0x47a634['body'],null))[_0x3b67('0x24')](respondWithResult(_0x3603ba,null))[_0x3b67('0x43')](handleError(_0x3603ba,null));};exports[_0x3b67('0x23')]=function(_0x37071e,_0x1644fa){return db[_0x3b67('0x2c')][_0x3b67('0x46')]({'where':{'id':_0x37071e[_0x3b67('0x45')]['id']}})[_0x3b67('0x24')](handleEntityNotFound(_0x1644fa,null))[_0x3b67('0x24')](removeEntity(_0x1644fa,null))[_0x3b67('0x43')](handleError(_0x1644fa,null));};exports[_0x3b67('0x4a')]=function(_0x1bad19,_0x260c95){return db[_0x3b67('0x2c')][_0x3b67('0x4a')]()[_0x3b67('0x24')](respondWithResult(_0x260c95,null))[_0x3b67('0x43')](handleError(_0x260c95,null));}; \ No newline at end of file +var _0x6bf9=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','include','catch','show','params','JscriptyQuestionReport','create','body','update','find','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis'];(function(_0x20dfe1,_0x14cbf3){var _0x25feb0=function(_0x2dfc74){while(--_0x2dfc74){_0x20dfe1['push'](_0x20dfe1['shift']());}};_0x25feb0(++_0x14cbf3);}(_0x6bf9,0x1b1));var _0x96bf=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0x6bf9[_0x3e0dc4];return _0x586111;};'use strict';var pdf=require(_0x96bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x96bf('0x1'));var zipdir=require(_0x96bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96bf('0x3'));var moment=require(_0x96bf('0x4'));var BPromise=require(_0x96bf('0x5'));var Mustache=require(_0x96bf('0x6'));var util=require(_0x96bf('0x7'));var path=require(_0x96bf('0x8'));var sox=require(_0x96bf('0x9'));var csv=require(_0x96bf('0xa'));var ejs=require(_0x96bf('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x96bf('0xc'));var crypto=require(_0x96bf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x96bf('0xe'));var toCsv=require(_0x96bf('0xa'));var querystring=require('querystring');var Papa=require(_0x96bf('0xf'));var Redis=require(_0x96bf('0x10'));var authService=require(_0x96bf('0x11'));var qs=require(_0x96bf('0x12'));var as=require(_0x96bf('0x13'));var hardwareService=require(_0x96bf('0x14'));var logger=require(_0x96bf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x96bf('0x16'));var licenseUtil=require(_0x96bf('0x17'));var db=require(_0x96bf('0x18'))['db'];function respondWithStatusCode(_0x3df7fb,_0x2b5e30){_0x2b5e30=_0x2b5e30||0xcc;return function(_0x1f2073){if(_0x1f2073){return _0x3df7fb[_0x96bf('0x19')](_0x2b5e30);}return _0x3df7fb[_0x96bf('0x1a')](_0x2b5e30)[_0x96bf('0x1b')]();};}function respondWithResult(_0x198271,_0x2d13f5){_0x2d13f5=_0x2d13f5||0xc8;return function(_0x5e3c05){if(_0x5e3c05){return _0x198271[_0x96bf('0x1a')](_0x2d13f5)[_0x96bf('0x1c')](_0x5e3c05);}};}function respondWithFilteredResult(_0x3c59ab,_0x167038){return function(_0x42d539){if(_0x42d539){var _0x3e7e82=_0x42d539['count'],_0x16d9a7=_0x167038['offset'],_0x10b116=_0x167038[_0x96bf('0x1d')]+_0x167038[_0x96bf('0x1e')],_0x57884e;if(_0x10b116>=_0x3e7e82){_0x10b116=_0x3e7e82;_0x57884e=0xc8;}else{_0x57884e=0xce;}_0x3c59ab['status'](_0x57884e);return _0x3c59ab[_0x96bf('0x1f')](_0x96bf('0x20'),_0x16d9a7+'-'+_0x10b116+'/'+_0x3e7e82)[_0x96bf('0x1c')](_0x42d539);}return null;};}function patchUpdates(_0x3ecea0){return function(_0x43bc1f){try{jsonpatch[_0x96bf('0x21')](_0x43bc1f,_0x3ecea0,!![]);}catch(_0x3f4cb3){return BPromise[_0x96bf('0x22')](_0x3f4cb3);}return _0x43bc1f[_0x96bf('0x23')]();};}function saveUpdates(_0x19103e,_0xdb98e7){return function(_0x3da3f3){if(_0x3da3f3){return _0x3da3f3['update'](_0x19103e)[_0x96bf('0x24')](function(_0x5145bd){return _0x5145bd;});}return null;};}function removeEntity(_0x1b19a0,_0x7425e8){return function(_0x42736b){if(_0x42736b){return _0x42736b['destroy']()[_0x96bf('0x24')](function(){_0x1b19a0[_0x96bf('0x1a')](0xcc)[_0x96bf('0x1b')]();});}};}function handleEntityNotFound(_0x2f466a,_0x3038dc){return function(_0x27e183){if(!_0x27e183){_0x2f466a[_0x96bf('0x19')](0x194);}return _0x27e183;};}function handleError(_0x22ac51,_0x179e37){_0x179e37=_0x179e37||0x1f4;return function(_0x55b9af){logger['error'](_0x55b9af[_0x96bf('0x25')]);if(_0x55b9af[_0x96bf('0x26')]){delete _0x55b9af[_0x96bf('0x26')];}_0x22ac51[_0x96bf('0x1a')](_0x179e37)[_0x96bf('0x27')](_0x55b9af);};}exports[_0x96bf('0x28')]=function(_0x46366d,_0x59bf18){var _0x130dd2={},_0x55bb3e={},_0x177295={'count':0x0,'rows':[]};var _0x4d0c79=_['map'](db['JscriptyQuestionReport'][_0x96bf('0x29')],function(_0x4cd11f){return{'name':_0x4cd11f['fieldName'],'type':_0x4cd11f[_0x96bf('0x2a')][_0x96bf('0x2b')]};});_0x55bb3e[_0x96bf('0x2c')]=_['map'](_0x4d0c79,_0x96bf('0x26'));_0x55bb3e['query']=_[_0x96bf('0x2d')](_0x46366d[_0x96bf('0x2e')]);_0x55bb3e[_0x96bf('0x2f')]=_[_0x96bf('0x30')](_0x55bb3e[_0x96bf('0x2c')],_0x55bb3e[_0x96bf('0x2e')]);_0x130dd2[_0x96bf('0x31')]=_['intersection'](_0x55bb3e[_0x96bf('0x2c')],qs[_0x96bf('0x32')](_0x46366d[_0x96bf('0x2e')][_0x96bf('0x32')]));_0x130dd2['attributes']=_0x130dd2['attributes'][_0x96bf('0x33')]?_0x130dd2[_0x96bf('0x31')]:_0x55bb3e[_0x96bf('0x2c')];if(!_0x46366d[_0x96bf('0x2e')][_0x96bf('0x34')](_0x96bf('0x35'))){_0x130dd2[_0x96bf('0x1e')]=qs[_0x96bf('0x1e')](_0x46366d[_0x96bf('0x2e')][_0x96bf('0x1e')]);_0x130dd2[_0x96bf('0x1d')]=qs[_0x96bf('0x1d')](_0x46366d[_0x96bf('0x2e')][_0x96bf('0x1d')]);}_0x130dd2[_0x96bf('0x36')]=qs[_0x96bf('0x37')](_0x46366d[_0x96bf('0x2e')][_0x96bf('0x37')]);_0x130dd2['where']=qs['filters'](_[_0x96bf('0x38')](_0x46366d[_0x96bf('0x2e')],_0x55bb3e[_0x96bf('0x2f')]),_0x4d0c79);if(_0x46366d[_0x96bf('0x2e')][_0x96bf('0x39')]){_0x130dd2[_0x96bf('0x3a')]=_[_0x96bf('0x3b')](_0x130dd2[_0x96bf('0x3a')],{'$or':_[_0x96bf('0x3c')](_0x4d0c79,function(_0x2322cf){if(_0x2322cf['type']!=='VIRTUAL'){var _0x1db61a={};_0x1db61a[_0x2322cf[_0x96bf('0x26')]]={'$like':'%'+_0x46366d[_0x96bf('0x2e')][_0x96bf('0x39')]+'%'};return _0x1db61a;}})});}_0x130dd2=_[_0x96bf('0x3b')]({},_0x130dd2,_0x46366d[_0x96bf('0x3d')]);var _0x7af1d4={'where':_0x130dd2[_0x96bf('0x3a')]};return db['JscriptyQuestionReport'][_0x96bf('0x3e')](_0x7af1d4)['then'](function(_0xdf9e8f){_0x177295[_0x96bf('0x3e')]=_0xdf9e8f;if(_0x46366d['query'][_0x96bf('0x3f')]){_0x130dd2[_0x96bf('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x130dd2);})['then'](function(_0x26f2bb){_0x177295['rows']=_0x26f2bb;return _0x177295;})[_0x96bf('0x24')](respondWithFilteredResult(_0x59bf18,_0x130dd2))[_0x96bf('0x41')](handleError(_0x59bf18,null));};exports[_0x96bf('0x42')]=function(_0x3491dc,_0x5ca74b){var _0x3036f1={'raw':!![],'where':{'id':_0x3491dc[_0x96bf('0x43')]['id']}},_0x241b95={};_0x241b95['model']=_[_0x96bf('0x2d')](db[_0x96bf('0x44')][_0x96bf('0x29')]);_0x241b95[_0x96bf('0x2e')]=_['keys'](_0x3491dc[_0x96bf('0x2e')]);_0x241b95['filters']=_[_0x96bf('0x30')](_0x241b95['model'],_0x241b95[_0x96bf('0x2e')]);_0x3036f1[_0x96bf('0x31')]=_[_0x96bf('0x30')](_0x241b95[_0x96bf('0x2c')],qs[_0x96bf('0x32')](_0x3491dc[_0x96bf('0x2e')][_0x96bf('0x32')]));_0x3036f1[_0x96bf('0x31')]=_0x3036f1[_0x96bf('0x31')][_0x96bf('0x33')]?_0x3036f1['attributes']:_0x241b95[_0x96bf('0x2c')];if(_0x3491dc['query'][_0x96bf('0x3f')]){_0x3036f1[_0x96bf('0x40')]=[{'all':!![]}];}_0x3036f1=_[_0x96bf('0x3b')]({},_0x3036f1,_0x3491dc[_0x96bf('0x3d')]);return db[_0x96bf('0x44')]['find'](_0x3036f1)[_0x96bf('0x24')](handleEntityNotFound(_0x5ca74b,null))[_0x96bf('0x24')](respondWithResult(_0x5ca74b,null))[_0x96bf('0x41')](handleError(_0x5ca74b,null));};exports[_0x96bf('0x45')]=function(_0x3b8e72,_0x57f36e){return db[_0x96bf('0x44')][_0x96bf('0x45')](_0x3b8e72[_0x96bf('0x46')],{})[_0x96bf('0x24')](respondWithResult(_0x57f36e,0xc9))[_0x96bf('0x41')](handleError(_0x57f36e,null));};exports[_0x96bf('0x47')]=function(_0x190737,_0x48dea0){if(_0x190737[_0x96bf('0x46')]['id']){delete _0x190737[_0x96bf('0x46')]['id'];}return db[_0x96bf('0x44')][_0x96bf('0x48')]({'where':{'id':_0x190737[_0x96bf('0x43')]['id']}})[_0x96bf('0x24')](handleEntityNotFound(_0x48dea0,null))[_0x96bf('0x24')](saveUpdates(_0x190737[_0x96bf('0x46')],null))[_0x96bf('0x24')](respondWithResult(_0x48dea0,null))[_0x96bf('0x41')](handleError(_0x48dea0,null));};exports[_0x96bf('0x49')]=function(_0x319457,_0x1b1906){return db[_0x96bf('0x44')][_0x96bf('0x48')]({'where':{'id':_0x319457[_0x96bf('0x43')]['id']}})[_0x96bf('0x24')](handleEntityNotFound(_0x1b1906,null))['then'](removeEntity(_0x1b1906,null))[_0x96bf('0x41')](handleError(_0x1b1906,null));};exports['describe']=function(_0x1378a7,_0x1d46bc){return db[_0x96bf('0x44')][_0x96bf('0x4a')]()[_0x96bf('0x24')](respondWithResult(_0x1d46bc,null))[_0x96bf('0x41')](handleError(_0x1d46bc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8840eab..f5b626d 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 _0x1799=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x43c4d6,_0x5b9173){var _0x3f1353=function(_0x2ce7c6){while(--_0x2ce7c6){_0x43c4d6['push'](_0x43c4d6['shift']());}};_0x3f1353(++_0x5b9173);}(_0x1799,0x191));var _0x9179=function(_0xd56b1f,_0xfe26b0){_0xd56b1f=_0xd56b1f-0x0;var _0x442fa4=_0x1799[_0xd56b1f];return _0x442fa4;};'use strict';var _=require('lodash');var util=require(_0x9179('0x0'));var logger=require(_0x9179('0x1'))('api');var moment=require(_0x9179('0x2'));var BPromise=require(_0x9179('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9179('0x4'));var rimraf=require(_0x9179('0x5'));var config=require(_0x9179('0x6'));var attributes=require(_0x9179('0x7'));module[_0x9179('0x8')]=function(_0x4208b5,_0x39ed8f){return _0x4208b5[_0x9179('0x9')](_0x9179('0xa'),attributes,{'tableName':_0x9179('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x25c182,_0x4fa8fa){var _0x184b2f=function(_0x406978){while(--_0x406978){_0x25c182['push'](_0x25c182['shift']());}};_0x184b2f(++_0x4fa8fa);}(_0xb7e7,0x1e6));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x7b7e('0x0'));var util=require(_0x7b7e('0x1'));var logger=require('../../config/logger')(_0x7b7e('0x2'));var moment=require(_0x7b7e('0x3'));var BPromise=require(_0x7b7e('0x4'));var rp=require(_0x7b7e('0x5'));var fs=require('fs');var path=require(_0x7b7e('0x6'));var rimraf=require(_0x7b7e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7b7e('0x8'));module['exports']=function(_0xfbe451,_0x3beb43){return _0xfbe451['define'](_0x7b7e('0x9'),attributes,{'tableName':_0x7b7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 90fd6e0..e1e3846 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 _0xeda8=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0xeda8,0x15c));var _0x8eda=function(_0x82a223,_0x5418bb){_0x82a223=_0x82a223-0x0;var _0x124599=_0xeda8[_0x82a223];return _0x124599;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require(_0x8eda('0x2'));var BPromise=require('bluebird');var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8eda('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eda('0x5'))(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var jayson=require(_0x8eda('0x8'));var client=jayson['client'][_0x8eda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530781,_0x349ed4,_0x4062c5){return new BPromise(function(_0x4adffc,_0x2bd3c6){return client['request'](_0x530781,_0x4062c5)['then'](function(_0x5ca018){logger[_0x8eda('0xa')](_0x8eda('0xb'),_0x349ed4,_0x8eda('0xc'));logger[_0x8eda('0xd')](_0x8eda('0xe'),_0x349ed4,_0x8eda('0xc'),JSON['stringify'](_0x5ca018));if(_0x5ca018[_0x8eda('0xf')]){if(_0x5ca018[_0x8eda('0xf')][_0x8eda('0x10')]===0x1f4){logger[_0x8eda('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x349ed4,_0x5ca018[_0x8eda('0xf')][_0x8eda('0x11')]);return _0x2bd3c6(_0x5ca018[_0x8eda('0xf')][_0x8eda('0x11')]);}logger[_0x8eda('0xf')](_0x8eda('0xb'),_0x349ed4,_0x5ca018[_0x8eda('0xf')]['message']);return _0x4adffc(_0x5ca018['error'][_0x8eda('0x11')]);}else{logger['info'](_0x8eda('0xb'),_0x349ed4,_0x8eda('0xc'));_0x4adffc(_0x5ca018[_0x8eda('0x12')][_0x8eda('0x11')]);}})[_0x8eda('0x13')](function(_0x268c71){logger[_0x8eda('0xf')](_0x8eda('0xb'),_0x349ed4,_0x268c71);_0x2bd3c6(_0x268c71);});});} \ No newline at end of file +var _0x6e0f=['info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xb1b7b,_0x13eaa0){var _0x339c3b=function(_0x5ca153){while(--_0x5ca153){_0xb1b7b['push'](_0xb1b7b['shift']());}};_0x339c3b(++_0x13eaa0);}(_0x6e0f,0x17a));var _0xf6e0=function(_0x23902e,_0x2bcb4e){_0x23902e=_0x23902e-0x0;var _0x28f007=_0x6e0f[_0x23902e];return _0x28f007;};'use strict';var _=require(_0xf6e0('0x0'));var util=require(_0xf6e0('0x1'));var moment=require('moment');var BPromise=require(_0xf6e0('0x2'));var rs=require(_0xf6e0('0x3'));var fs=require('fs');var Redis=require(_0xf6e0('0x4'));var db=require(_0xf6e0('0x5'))['db'];var utils=require(_0xf6e0('0x6'));var logger=require(_0xf6e0('0x7'))(_0xf6e0('0x8'));var config=require('../../config/environment');var jayson=require(_0xf6e0('0x9'));var client=jayson[_0xf6e0('0xa')][_0xf6e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5279ec,_0x4c6e03,_0x1a12b0){return new BPromise(function(_0x3bf3d9,_0x2037b4){return client[_0xf6e0('0xc')](_0x5279ec,_0x1a12b0)['then'](function(_0x52771c){logger[_0xf6e0('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4c6e03,_0xf6e0('0xe'));logger['debug'](_0xf6e0('0xf'),_0x4c6e03,'request\x20sent',JSON[_0xf6e0('0x10')](_0x52771c));if(_0x52771c[_0xf6e0('0x11')]){if(_0x52771c[_0xf6e0('0x11')][_0xf6e0('0x12')]===0x1f4){logger['error'](_0xf6e0('0x13'),_0x4c6e03,_0x52771c[_0xf6e0('0x11')][_0xf6e0('0x14')]);return _0x2037b4(_0x52771c[_0xf6e0('0x11')][_0xf6e0('0x14')]);}logger[_0xf6e0('0x11')](_0xf6e0('0x13'),_0x4c6e03,_0x52771c[_0xf6e0('0x11')][_0xf6e0('0x14')]);return _0x3bf3d9(_0x52771c[_0xf6e0('0x11')]['message']);}else{logger[_0xf6e0('0xd')](_0xf6e0('0x13'),_0x4c6e03,'request\x20sent');_0x3bf3d9(_0x52771c[_0xf6e0('0x15')][_0xf6e0('0x14')]);}})[_0xf6e0('0x16')](function(_0x1c253c){logger['error'](_0xf6e0('0x13'),_0x4c6e03,_0x1c253c);_0x2037b4(_0x1c253c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 452f378..3cec894 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 _0x0e17=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','getQuestions','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x424bbe,_0x8cd05f){var _0x34ab2e=function(_0x389931){while(--_0x389931){_0x424bbe['push'](_0x424bbe['shift']());}};_0x34ab2e(++_0x8cd05f);}(_0x0e17,0xd6));var _0x70e1=function(_0x4bf5c5,_0x4d96d0){_0x4bf5c5=_0x4bf5c5-0x0;var _0x30551c=_0x0e17[_0x4bf5c5];return _0x30551c;};'use strict';var multer=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var path=require(_0x70e1('0x2'));var timeout=require(_0x70e1('0x3'));var express=require(_0x70e1('0x4'));var router=express[_0x70e1('0x5')]();var auth=require(_0x70e1('0x6'));var interaction=require(_0x70e1('0x7'));var config=require(_0x70e1('0x8'));var controller=require(_0x70e1('0x9'));router[_0x70e1('0xa')]('/',auth[_0x70e1('0xb')](),controller['index']);router[_0x70e1('0xa')](_0x70e1('0xc'),auth[_0x70e1('0xb')](),controller[_0x70e1('0xd')]);router[_0x70e1('0xa')](_0x70e1('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x70e1('0xa')]('/:id/questions',auth[_0x70e1('0xb')](),controller[_0x70e1('0xf')]);router['post']('/',auth[_0x70e1('0xb')](),controller[_0x70e1('0x10')]);router['put'](_0x70e1('0xe'),auth['isAuthenticated'](),controller[_0x70e1('0x11')]);router['delete'](_0x70e1('0xe'),auth[_0x70e1('0xb')](),controller[_0x70e1('0x12')]);module[_0x70e1('0x13')]=router; \ No newline at end of file +var _0xac95=['connect-timeout','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','post','create','update','delete','multer','util','path'];(function(_0x74658d,_0x2e04ca){var _0x2c5d24=function(_0x187c6e){while(--_0x187c6e){_0x74658d['push'](_0x74658d['shift']());}};_0x2c5d24(++_0x2e04ca);}(_0xac95,0xa8));var _0x5ac9=function(_0x1ade5a,_0x116c19){_0x1ade5a=_0x1ade5a-0x0;var _0x3ed804=_0xac95[_0x1ade5a];return _0x3ed804;};'use strict';var multer=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var path=require(_0x5ac9('0x2'));var timeout=require(_0x5ac9('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5ac9('0x4'));var interaction=require(_0x5ac9('0x5'));var config=require('../../config/environment');var controller=require(_0x5ac9('0x6'));router[_0x5ac9('0x7')]('/',auth['isAuthenticated'](),controller[_0x5ac9('0x8')]);router[_0x5ac9('0x7')](_0x5ac9('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x5ac9('0x7')](_0x5ac9('0xa'),auth[_0x5ac9('0xb')](),controller[_0x5ac9('0xc')]);router[_0x5ac9('0x7')](_0x5ac9('0xd'),auth['isAuthenticated'](),controller[_0x5ac9('0xe')]);router[_0x5ac9('0xf')]('/',auth['isAuthenticated'](),controller[_0x5ac9('0x10')]);router['put'](_0x5ac9('0xa'),auth['isAuthenticated'](),controller[_0x5ac9('0x11')]);router[_0x5ac9('0x12')](_0x5ac9('0xa'),auth[_0x5ac9('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cf49163..7d9c9df 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 _0x8081=['BOOLEAN','sequelize','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x34a009,_0x52d78a){var _0x2e8c82=function(_0x2fc59e){while(--_0x2fc59e){_0x34a009['push'](_0x34a009['shift']());}};_0x2e8c82(++_0x52d78a);}(_0x8081,0xcc));var _0x1808=function(_0x16cdf6,_0x2d89ff){_0x16cdf6=_0x16cdf6-0x0;var _0xe5090d=_0x8081[_0x16cdf6];return _0xe5090d;};'use strict';var moment=require('moment');var Sequelize=require(_0x1808('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x1808('0x1')],'set':function(_0x806030){this[_0x1808('0x2')]('starttime',_0x806030);this['setDataValue'](_0x1808('0x3'),moment()['format'](_0x1808('0x4')));}},'endtime':{'type':Sequelize[_0x1808('0x1')]},'membername':{'type':Sequelize[_0x1808('0x5')]},'projectname':{'type':Sequelize[_0x1808('0x5')]},'queue':{'type':Sequelize[_0x1808('0x5')]},'uniqueid':{'type':Sequelize[_0x1808('0x5')]},'calleridname':{'type':Sequelize[_0x1808('0x5')]},'calleridnum':{'type':Sequelize[_0x1808('0x5')]},'completed':{'type':Sequelize[_0x1808('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x714d=['exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize'];(function(_0xc905bf,_0x3fb45d){var _0x3ffd14=function(_0x3d3d02){while(--_0x3d3d02){_0xc905bf['push'](_0xc905bf['shift']());}};_0x3ffd14(++_0x3fb45d);}(_0x714d,0x1c1));var _0xd714=function(_0x137947,_0x21abb9){_0x137947=_0x137947-0x0;var _0x2d957d=_0x714d[_0x137947];return _0x2d957d;};'use strict';var moment=require(_0xd714('0x0'));var Sequelize=require(_0xd714('0x1'));module[_0xd714('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x243bbb){this[_0xd714('0x3')](_0xd714('0x4'),_0x243bbb);this['setDataValue'](_0xd714('0x5'),moment()[_0xd714('0x6')](_0xd714('0x7')));}},'endtime':{'type':Sequelize[_0xd714('0x8')]},'membername':{'type':Sequelize[_0xd714('0x9')]},'projectname':{'type':Sequelize[_0xd714('0x9')]},'queue':{'type':Sequelize[_0xd714('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd714('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xd714('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 197c047..99d56c6 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 _0x0173=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','findOne','JscriptyQuestionReport','order','SessionId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5f0b8e,_0x59919b){var _0x4a5a71=function(_0x2ce23f){while(--_0x2ce23f){_0x5f0b8e['push'](_0x5f0b8e['shift']());}};_0x4a5a71(++_0x59919b);}(_0x0173,0x197));var _0x3017=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0173[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3017('0x0'));var emlformat=require(_0x3017('0x1'));var rimraf=require(_0x3017('0x2'));var zipdir=require(_0x3017('0x3'));var jsonpatch=require(_0x3017('0x4'));var rp=require('request-promise');var moment=require(_0x3017('0x5'));var BPromise=require(_0x3017('0x6'));var Mustache=require(_0x3017('0x7'));var util=require(_0x3017('0x8'));var path=require(_0x3017('0x9'));var sox=require(_0x3017('0xa'));var csv=require(_0x3017('0xb'));var ejs=require(_0x3017('0xc'));var fs=require('fs');var _=require(_0x3017('0xd'));var squel=require(_0x3017('0xe'));var crypto=require(_0x3017('0xf'));var jsforce=require(_0x3017('0x10'));var deskjs=require(_0x3017('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3017('0x12'));var Papa=require(_0x3017('0x13'));var Redis=require(_0x3017('0x14'));var authService=require(_0x3017('0x15'));var qs=require(_0x3017('0x16'));var as=require(_0x3017('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3017('0x18'))(_0x3017('0x19'));var utils=require(_0x3017('0x1a'));var config=require(_0x3017('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3017('0x1c'))['db'];function respondWithStatusCode(_0x2a236a,_0x16ef85){_0x16ef85=_0x16ef85||0xcc;return function(_0x544039){if(_0x544039){return _0x2a236a[_0x3017('0x1d')](_0x16ef85);}return _0x2a236a[_0x3017('0x1e')](_0x16ef85)[_0x3017('0x1f')]();};}function respondWithResult(_0xd86376,_0x8a4b71){_0x8a4b71=_0x8a4b71||0xc8;return function(_0x1d5063){if(_0x1d5063){return _0xd86376['status'](_0x8a4b71)[_0x3017('0x20')](_0x1d5063);}};}function respondWithFilteredResult(_0x454688,_0x4d489a){return function(_0x32793c){if(_0x32793c){var _0xb4a697=_0x32793c[_0x3017('0x21')],_0x59099c=_0x4d489a[_0x3017('0x22')],_0x5bf756=_0x4d489a[_0x3017('0x22')]+_0x4d489a[_0x3017('0x23')],_0x1e237b;if(_0x5bf756>=_0xb4a697){_0x5bf756=_0xb4a697;_0x1e237b=0xc8;}else{_0x1e237b=0xce;}_0x454688[_0x3017('0x1e')](_0x1e237b);return _0x454688[_0x3017('0x24')](_0x3017('0x25'),_0x59099c+'-'+_0x5bf756+'/'+_0xb4a697)['json'](_0x32793c);}return null;};}function patchUpdates(_0x19a863){return function(_0x2bd66f){try{jsonpatch[_0x3017('0x26')](_0x2bd66f,_0x19a863,!![]);}catch(_0x4fd651){return BPromise['reject'](_0x4fd651);}return _0x2bd66f[_0x3017('0x27')]();};}function saveUpdates(_0x2e8fdc,_0x29ce32){return function(_0x53815e){if(_0x53815e){return _0x53815e[_0x3017('0x28')](_0x2e8fdc)[_0x3017('0x29')](function(_0x268add){return _0x268add;});}return null;};}function removeEntity(_0x56248e,_0xa7c14f){return function(_0x211680){if(_0x211680){return _0x211680[_0x3017('0x2a')]()[_0x3017('0x29')](function(){_0x56248e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2afb64,_0x860b52){return function(_0x111567){if(!_0x111567){_0x2afb64[_0x3017('0x1d')](0x194);}return _0x111567;};}function handleError(_0x261c16,_0x5d8818){_0x5d8818=_0x5d8818||0x1f4;return function(_0x1d58d4){logger[_0x3017('0x2b')](_0x1d58d4[_0x3017('0x2c')]);if(_0x1d58d4[_0x3017('0x2d')]){delete _0x1d58d4[_0x3017('0x2d')];}_0x261c16[_0x3017('0x1e')](_0x5d8818)[_0x3017('0x2e')](_0x1d58d4);};}exports[_0x3017('0x2f')]=function(_0x1dcccf,_0x16ce94){var _0x4d407f={},_0x268030={},_0x3d6742={'count':0x0,'rows':[]};var _0x4f091b=_[_0x3017('0x30')](db[_0x3017('0x31')][_0x3017('0x32')],function(_0x465d03){return{'name':_0x465d03[_0x3017('0x33')],'type':_0x465d03[_0x3017('0x34')][_0x3017('0x35')]};});_0x268030[_0x3017('0x36')]=_['map'](_0x4f091b,'name');_0x268030[_0x3017('0x37')]=_[_0x3017('0x38')](_0x1dcccf[_0x3017('0x37')]);_0x268030[_0x3017('0x39')]=_[_0x3017('0x3a')](_0x268030[_0x3017('0x36')],_0x268030[_0x3017('0x37')]);_0x4d407f[_0x3017('0x3b')]=_['intersection'](_0x268030[_0x3017('0x36')],qs[_0x3017('0x3c')](_0x1dcccf[_0x3017('0x37')][_0x3017('0x3c')]));_0x4d407f[_0x3017('0x3b')]=_0x4d407f[_0x3017('0x3b')][_0x3017('0x3d')]?_0x4d407f[_0x3017('0x3b')]:_0x268030['model'];if(!_0x1dcccf[_0x3017('0x37')]['hasOwnProperty'](_0x3017('0x3e'))){_0x4d407f[_0x3017('0x23')]=qs[_0x3017('0x23')](_0x1dcccf[_0x3017('0x37')]['limit']);_0x4d407f[_0x3017('0x22')]=qs[_0x3017('0x22')](_0x1dcccf[_0x3017('0x37')][_0x3017('0x22')]);}_0x4d407f['order']=qs[_0x3017('0x3f')](_0x1dcccf[_0x3017('0x37')][_0x3017('0x3f')]);_0x4d407f[_0x3017('0x40')]=qs[_0x3017('0x39')](_[_0x3017('0x41')](_0x1dcccf['query'],_0x268030[_0x3017('0x39')]),_0x4f091b);if(_0x1dcccf[_0x3017('0x37')]['filter']){_0x4d407f[_0x3017('0x40')]=_[_0x3017('0x42')](_0x4d407f[_0x3017('0x40')],{'$or':_[_0x3017('0x30')](_0x4f091b,function(_0x1719a4){if(_0x1719a4[_0x3017('0x34')]!=='VIRTUAL'){var _0x27d570={};_0x27d570[_0x1719a4[_0x3017('0x2d')]]={'$like':'%'+_0x1dcccf[_0x3017('0x37')][_0x3017('0x43')]+'%'};return _0x27d570;}})});}_0x4d407f=_[_0x3017('0x42')]({},_0x4d407f,_0x1dcccf[_0x3017('0x44')]);var _0x179fa7={'where':_0x4d407f[_0x3017('0x40')]};return db[_0x3017('0x31')][_0x3017('0x21')](_0x179fa7)['then'](function(_0x59a519){_0x3d6742[_0x3017('0x21')]=_0x59a519;if(_0x1dcccf['query']['includeAll']){_0x4d407f[_0x3017('0x45')]=[{'all':!![]}];}return db[_0x3017('0x31')][_0x3017('0x46')](_0x4d407f);})[_0x3017('0x29')](function(_0x7f9525){_0x3d6742[_0x3017('0x47')]=_0x7f9525;return _0x3d6742;})[_0x3017('0x29')](respondWithFilteredResult(_0x16ce94,_0x4d407f))[_0x3017('0x48')](handleError(_0x16ce94,null));};exports[_0x3017('0x49')]=function(_0x538173,_0x50047e){var _0x174338={'raw':!![],'where':{'id':_0x538173[_0x3017('0x4a')]['id']}},_0x5ac0b6={};_0x5ac0b6[_0x3017('0x36')]=_[_0x3017('0x38')](db[_0x3017('0x31')][_0x3017('0x32')]);_0x5ac0b6[_0x3017('0x37')]=_['keys'](_0x538173['query']);_0x5ac0b6[_0x3017('0x39')]=_[_0x3017('0x3a')](_0x5ac0b6[_0x3017('0x36')],_0x5ac0b6[_0x3017('0x37')]);_0x174338['attributes']=_[_0x3017('0x3a')](_0x5ac0b6['model'],qs[_0x3017('0x3c')](_0x538173[_0x3017('0x37')][_0x3017('0x3c')]));_0x174338['attributes']=_0x174338[_0x3017('0x3b')]['length']?_0x174338[_0x3017('0x3b')]:_0x5ac0b6['model'];if(_0x538173[_0x3017('0x37')][_0x3017('0x4b')]){_0x174338[_0x3017('0x45')]=[{'all':!![]}];}_0x174338=_['merge']({},_0x174338,_0x538173['options']);return db[_0x3017('0x31')][_0x3017('0x4c')](_0x174338)[_0x3017('0x29')](handleEntityNotFound(_0x50047e,null))[_0x3017('0x29')](respondWithResult(_0x50047e,null))[_0x3017('0x48')](handleError(_0x50047e,null));};exports[_0x3017('0x4d')]=function(_0x1efb28,_0x1d4eb9){return db[_0x3017('0x31')][_0x3017('0x4d')](_0x1efb28[_0x3017('0x4e')],{})[_0x3017('0x29')](respondWithResult(_0x1d4eb9,0xc9))[_0x3017('0x48')](handleError(_0x1d4eb9,null));};exports['update']=function(_0xf46420,_0x976a2c){if(_0xf46420[_0x3017('0x4e')]['id']){delete _0xf46420[_0x3017('0x4e')]['id'];}return db[_0x3017('0x31')]['find']({'where':{'id':_0xf46420['params']['id']}})[_0x3017('0x29')](handleEntityNotFound(_0x976a2c,null))[_0x3017('0x29')](saveUpdates(_0xf46420[_0x3017('0x4e')],null))[_0x3017('0x29')](respondWithResult(_0x976a2c,null))[_0x3017('0x48')](handleError(_0x976a2c,null));};exports['destroy']=function(_0x4ef84e,_0x18461b){return db[_0x3017('0x31')][_0x3017('0x4c')]({'where':{'id':_0x4ef84e['params']['id']}})[_0x3017('0x29')](handleEntityNotFound(_0x18461b,null))[_0x3017('0x29')](removeEntity(_0x18461b,null))[_0x3017('0x48')](handleError(_0x18461b,null));};exports[_0x3017('0x4f')]=function(_0x298087,_0x2ca172){return db[_0x3017('0x31')][_0x3017('0x4f')]()[_0x3017('0x29')](respondWithResult(_0x2ca172,null))[_0x3017('0x48')](handleError(_0x2ca172,null));};exports['getQuestions']=function(_0xac72dd,_0x53e320,_0x3b0d4e){var _0x111ebb={'raw':!![],'where':{}};var _0x3f2408={};var _0x39a34e={'count':0x0,'rows':[]};return db[_0x3017('0x31')][_0x3017('0x50')]({'where':{'id':_0xac72dd[_0x3017('0x4a')]['id']}})[_0x3017('0x29')](handleEntityNotFound(_0x53e320,null))['then'](function(_0x368c0d){if(_0x368c0d){_0x3f2408[_0x3017('0x36')]=_[_0x3017('0x38')](db[_0x3017('0x51')]['rawAttributes']);_0x3f2408[_0x3017('0x37')]=_[_0x3017('0x38')](_0xac72dd[_0x3017('0x37')]);_0x3f2408[_0x3017('0x39')]=_[_0x3017('0x3a')](_0x3f2408[_0x3017('0x36')],_0x3f2408['query']);_0x111ebb[_0x3017('0x3b')]=_[_0x3017('0x3a')](_0x3f2408[_0x3017('0x36')],qs[_0x3017('0x3c')](_0xac72dd['query']['fields']));_0x111ebb[_0x3017('0x3b')]=_0x111ebb['attributes']['length']?_0x111ebb[_0x3017('0x3b')]:_0x3f2408[_0x3017('0x36')];if(!_0xac72dd[_0x3017('0x37')]['hasOwnProperty']('nolimit')){_0x111ebb[_0x3017('0x23')]=qs['limit'](_0xac72dd[_0x3017('0x37')][_0x3017('0x23')]);_0x111ebb[_0x3017('0x22')]=qs[_0x3017('0x22')](_0xac72dd['query']['offset']);}_0x111ebb[_0x3017('0x52')]=qs[_0x3017('0x3f')](_0xac72dd['query'][_0x3017('0x3f')]);_0x111ebb['where']=qs[_0x3017('0x39')](_[_0x3017('0x41')](_0xac72dd[_0x3017('0x37')],_0x3f2408[_0x3017('0x39')]));_0x111ebb[_0x3017('0x40')][_0x3017('0x53')]=_0x368c0d['id'];if(_0xac72dd[_0x3017('0x37')][_0x3017('0x43')]){_0x111ebb['where']=_[_0x3017('0x42')](_0x111ebb[_0x3017('0x40')],{'$or':_[_0x3017('0x30')](_0x111ebb[_0x3017('0x3b')],function(_0x54a6fb){var _0x2efea3={};_0x2efea3[_0x54a6fb]={'$like':'%'+_0xac72dd['query']['filter']+'%'};return _0x2efea3;})});}_0x111ebb=_[_0x3017('0x42')]({},_0x111ebb,_0xac72dd[_0x3017('0x44')]);return db[_0x3017('0x51')][_0x3017('0x21')]({'where':_0x111ebb[_0x3017('0x40')]})[_0x3017('0x29')](function(_0x5995af){_0x39a34e[_0x3017('0x21')]=_0x5995af;if(_0xac72dd['query']['includeAll']){_0x111ebb['include']=[{'all':!![]}];}return db[_0x3017('0x51')]['findAll'](_0x111ebb);})[_0x3017('0x29')](function(_0x598877){_0x39a34e[_0x3017('0x47')]=_0x598877;return _0x39a34e;});}})[_0x3017('0x29')](respondWithFilteredResult(_0x53e320,_0x111ebb))['catch'](handleError(_0x53e320,null));}; \ No newline at end of file +var _0xfe12=['filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','type','key','model','keys'];(function(_0x5c5916,_0xb684f0){var _0xeeacf0=function(_0x1df3c5){while(--_0x1df3c5){_0x5c5916['push'](_0x5c5916['shift']());}};_0xeeacf0(++_0xb684f0);}(_0xfe12,0xb6));var _0x2fe1=function(_0x4fda38,_0x44c823){_0x4fda38=_0x4fda38-0x0;var _0x16c06b=_0xfe12[_0x4fda38];return _0x16c06b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2fe1('0x0'));var zipdir=require(_0x2fe1('0x1'));var jsonpatch=require(_0x2fe1('0x2'));var rp=require(_0x2fe1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2fe1('0x4'));var util=require(_0x2fe1('0x5'));var path=require(_0x2fe1('0x6'));var sox=require('sox');var csv=require(_0x2fe1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2fe1('0x8'));var squel=require('squel');var crypto=require(_0x2fe1('0x9'));var jsforce=require(_0x2fe1('0xa'));var deskjs=require(_0x2fe1('0xb'));var toCsv=require(_0x2fe1('0x7'));var querystring=require(_0x2fe1('0xc'));var Papa=require(_0x2fe1('0xd'));var Redis=require(_0x2fe1('0xe'));var authService=require(_0x2fe1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fe1('0x10'));var logger=require(_0x2fe1('0x11'))(_0x2fe1('0x12'));var utils=require(_0x2fe1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2fe1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21eaf3,_0x441033){_0x441033=_0x441033||0xcc;return function(_0xa46ba4){if(_0xa46ba4){return _0x21eaf3[_0x2fe1('0x15')](_0x441033);}return _0x21eaf3[_0x2fe1('0x16')](_0x441033)[_0x2fe1('0x17')]();};}function respondWithResult(_0x2e7e99,_0x385b31){_0x385b31=_0x385b31||0xc8;return function(_0x5e864b){if(_0x5e864b){return _0x2e7e99[_0x2fe1('0x16')](_0x385b31)['json'](_0x5e864b);}};}function respondWithFilteredResult(_0x30e412,_0xdb545c){return function(_0x2d5f97){if(_0x2d5f97){var _0x3af0d3=_0x2d5f97[_0x2fe1('0x18')],_0x474231=_0xdb545c[_0x2fe1('0x19')],_0x2183aa=_0xdb545c[_0x2fe1('0x19')]+_0xdb545c[_0x2fe1('0x1a')],_0x2cbf5a;if(_0x2183aa>=_0x3af0d3){_0x2183aa=_0x3af0d3;_0x2cbf5a=0xc8;}else{_0x2cbf5a=0xce;}_0x30e412[_0x2fe1('0x16')](_0x2cbf5a);return _0x30e412['set'](_0x2fe1('0x1b'),_0x474231+'-'+_0x2183aa+'/'+_0x3af0d3)[_0x2fe1('0x1c')](_0x2d5f97);}return null;};}function patchUpdates(_0x5a022d){return function(_0x389425){try{jsonpatch['apply'](_0x389425,_0x5a022d,!![]);}catch(_0x400ff2){return BPromise['reject'](_0x400ff2);}return _0x389425['save']();};}function saveUpdates(_0x21aeaa,_0x191832){return function(_0x2909a5){if(_0x2909a5){return _0x2909a5[_0x2fe1('0x1d')](_0x21aeaa)[_0x2fe1('0x1e')](function(_0x4c8561){return _0x4c8561;});}return null;};}function removeEntity(_0x29989b,_0xaac2c){return function(_0x546dbe){if(_0x546dbe){return _0x546dbe[_0x2fe1('0x1f')]()[_0x2fe1('0x1e')](function(){_0x29989b[_0x2fe1('0x16')](0xcc)[_0x2fe1('0x17')]();});}};}function handleEntityNotFound(_0x8eba17,_0x50525c){return function(_0x12b892){if(!_0x12b892){_0x8eba17['sendStatus'](0x194);}return _0x12b892;};}function handleError(_0x4f5cbb,_0x5e4076){_0x5e4076=_0x5e4076||0x1f4;return function(_0x11fd30){logger[_0x2fe1('0x20')](_0x11fd30[_0x2fe1('0x21')]);if(_0x11fd30[_0x2fe1('0x22')]){delete _0x11fd30['name'];}_0x4f5cbb[_0x2fe1('0x16')](_0x5e4076)[_0x2fe1('0x23')](_0x11fd30);};}exports[_0x2fe1('0x24')]=function(_0x5cfcd3,_0x2b2899){var _0x33ca19={},_0x5404a5={},_0x4573ab={'count':0x0,'rows':[]};var _0x59d1af=_[_0x2fe1('0x25')](db[_0x2fe1('0x26')]['rawAttributes'],function(_0x2ac19b){return{'name':_0x2ac19b['fieldName'],'type':_0x2ac19b[_0x2fe1('0x27')][_0x2fe1('0x28')]};});_0x5404a5[_0x2fe1('0x29')]=_[_0x2fe1('0x25')](_0x59d1af,_0x2fe1('0x22'));_0x5404a5['query']=_[_0x2fe1('0x2a')](_0x5cfcd3['query']);_0x5404a5[_0x2fe1('0x2b')]=_[_0x2fe1('0x2c')](_0x5404a5[_0x2fe1('0x29')],_0x5404a5[_0x2fe1('0x2d')]);_0x33ca19[_0x2fe1('0x2e')]=_[_0x2fe1('0x2c')](_0x5404a5['model'],qs[_0x2fe1('0x2f')](_0x5cfcd3[_0x2fe1('0x2d')][_0x2fe1('0x2f')]));_0x33ca19[_0x2fe1('0x2e')]=_0x33ca19[_0x2fe1('0x2e')][_0x2fe1('0x30')]?_0x33ca19[_0x2fe1('0x2e')]:_0x5404a5['model'];if(!_0x5cfcd3[_0x2fe1('0x2d')][_0x2fe1('0x31')](_0x2fe1('0x32'))){_0x33ca19['limit']=qs['limit'](_0x5cfcd3[_0x2fe1('0x2d')][_0x2fe1('0x1a')]);_0x33ca19[_0x2fe1('0x19')]=qs[_0x2fe1('0x19')](_0x5cfcd3[_0x2fe1('0x2d')][_0x2fe1('0x19')]);}_0x33ca19[_0x2fe1('0x33')]=qs[_0x2fe1('0x34')](_0x5cfcd3[_0x2fe1('0x2d')][_0x2fe1('0x34')]);_0x33ca19['where']=qs[_0x2fe1('0x2b')](_[_0x2fe1('0x35')](_0x5cfcd3[_0x2fe1('0x2d')],_0x5404a5['filters']),_0x59d1af);if(_0x5cfcd3['query'][_0x2fe1('0x36')]){_0x33ca19['where']=_['merge'](_0x33ca19[_0x2fe1('0x37')],{'$or':_[_0x2fe1('0x25')](_0x59d1af,function(_0x3eee90){if(_0x3eee90['type']!==_0x2fe1('0x38')){var _0x4f3190={};_0x4f3190[_0x3eee90['name']]={'$like':'%'+_0x5cfcd3[_0x2fe1('0x2d')]['filter']+'%'};return _0x4f3190;}})});}_0x33ca19=_[_0x2fe1('0x39')]({},_0x33ca19,_0x5cfcd3[_0x2fe1('0x3a')]);var _0x48e7df={'where':_0x33ca19['where']};return db['JscriptySessionReport'][_0x2fe1('0x18')](_0x48e7df)[_0x2fe1('0x1e')](function(_0x54a2b9){_0x4573ab[_0x2fe1('0x18')]=_0x54a2b9;if(_0x5cfcd3[_0x2fe1('0x2d')][_0x2fe1('0x3b')]){_0x33ca19['include']=[{'all':!![]}];}return db[_0x2fe1('0x26')][_0x2fe1('0x3c')](_0x33ca19);})['then'](function(_0x4b636e){_0x4573ab[_0x2fe1('0x3d')]=_0x4b636e;return _0x4573ab;})[_0x2fe1('0x1e')](respondWithFilteredResult(_0x2b2899,_0x33ca19))[_0x2fe1('0x3e')](handleError(_0x2b2899,null));};exports[_0x2fe1('0x3f')]=function(_0x2d1911,_0x3f8f69){var _0x42ff77={'raw':!![],'where':{'id':_0x2d1911['params']['id']}},_0x3851bb={};_0x3851bb[_0x2fe1('0x29')]=_['keys'](db['JscriptySessionReport'][_0x2fe1('0x40')]);_0x3851bb[_0x2fe1('0x2d')]=_[_0x2fe1('0x2a')](_0x2d1911[_0x2fe1('0x2d')]);_0x3851bb[_0x2fe1('0x2b')]=_['intersection'](_0x3851bb['model'],_0x3851bb[_0x2fe1('0x2d')]);_0x42ff77['attributes']=_[_0x2fe1('0x2c')](_0x3851bb[_0x2fe1('0x29')],qs[_0x2fe1('0x2f')](_0x2d1911[_0x2fe1('0x2d')][_0x2fe1('0x2f')]));_0x42ff77[_0x2fe1('0x2e')]=_0x42ff77[_0x2fe1('0x2e')]['length']?_0x42ff77[_0x2fe1('0x2e')]:_0x3851bb[_0x2fe1('0x29')];if(_0x2d1911[_0x2fe1('0x2d')][_0x2fe1('0x3b')]){_0x42ff77[_0x2fe1('0x41')]=[{'all':!![]}];}_0x42ff77=_[_0x2fe1('0x39')]({},_0x42ff77,_0x2d1911[_0x2fe1('0x3a')]);return db[_0x2fe1('0x26')][_0x2fe1('0x42')](_0x42ff77)[_0x2fe1('0x1e')](handleEntityNotFound(_0x3f8f69,null))[_0x2fe1('0x1e')](respondWithResult(_0x3f8f69,null))[_0x2fe1('0x3e')](handleError(_0x3f8f69,null));};exports[_0x2fe1('0x43')]=function(_0x436f17,_0x1fa486){return db[_0x2fe1('0x26')]['create'](_0x436f17['body'],{})[_0x2fe1('0x1e')](respondWithResult(_0x1fa486,0xc9))[_0x2fe1('0x3e')](handleError(_0x1fa486,null));};exports[_0x2fe1('0x1d')]=function(_0x53d6fb,_0x150a1a){if(_0x53d6fb[_0x2fe1('0x44')]['id']){delete _0x53d6fb[_0x2fe1('0x44')]['id'];}return db[_0x2fe1('0x26')][_0x2fe1('0x42')]({'where':{'id':_0x53d6fb[_0x2fe1('0x45')]['id']}})[_0x2fe1('0x1e')](handleEntityNotFound(_0x150a1a,null))[_0x2fe1('0x1e')](saveUpdates(_0x53d6fb[_0x2fe1('0x44')],null))['then'](respondWithResult(_0x150a1a,null))[_0x2fe1('0x3e')](handleError(_0x150a1a,null));};exports['destroy']=function(_0x2cde4c,_0x3c2337){return db['JscriptySessionReport']['find']({'where':{'id':_0x2cde4c['params']['id']}})[_0x2fe1('0x1e')](handleEntityNotFound(_0x3c2337,null))[_0x2fe1('0x1e')](removeEntity(_0x3c2337,null))[_0x2fe1('0x3e')](handleError(_0x3c2337,null));};exports[_0x2fe1('0x46')]=function(_0x296225,_0x379c00){return db['JscriptySessionReport'][_0x2fe1('0x46')]()[_0x2fe1('0x1e')](respondWithResult(_0x379c00,null))[_0x2fe1('0x3e')](handleError(_0x379c00,null));};exports[_0x2fe1('0x47')]=function(_0x11cad6,_0x223046,_0x3e946b){var _0x5d9fa1={'raw':!![],'where':{}};var _0x2c1935={};var _0x47a746={'count':0x0,'rows':[]};return db[_0x2fe1('0x26')][_0x2fe1('0x48')]({'where':{'id':_0x11cad6[_0x2fe1('0x45')]['id']}})[_0x2fe1('0x1e')](handleEntityNotFound(_0x223046,null))[_0x2fe1('0x1e')](function(_0x59f714){if(_0x59f714){_0x2c1935[_0x2fe1('0x29')]=_[_0x2fe1('0x2a')](db[_0x2fe1('0x49')][_0x2fe1('0x40')]);_0x2c1935['query']=_[_0x2fe1('0x2a')](_0x11cad6['query']);_0x2c1935['filters']=_[_0x2fe1('0x2c')](_0x2c1935[_0x2fe1('0x29')],_0x2c1935[_0x2fe1('0x2d')]);_0x5d9fa1[_0x2fe1('0x2e')]=_[_0x2fe1('0x2c')](_0x2c1935['model'],qs[_0x2fe1('0x2f')](_0x11cad6[_0x2fe1('0x2d')]['fields']));_0x5d9fa1[_0x2fe1('0x2e')]=_0x5d9fa1[_0x2fe1('0x2e')][_0x2fe1('0x30')]?_0x5d9fa1['attributes']:_0x2c1935[_0x2fe1('0x29')];if(!_0x11cad6[_0x2fe1('0x2d')][_0x2fe1('0x31')](_0x2fe1('0x32'))){_0x5d9fa1['limit']=qs['limit'](_0x11cad6[_0x2fe1('0x2d')][_0x2fe1('0x1a')]);_0x5d9fa1[_0x2fe1('0x19')]=qs[_0x2fe1('0x19')](_0x11cad6[_0x2fe1('0x2d')][_0x2fe1('0x19')]);}_0x5d9fa1[_0x2fe1('0x33')]=qs[_0x2fe1('0x34')](_0x11cad6['query'][_0x2fe1('0x34')]);_0x5d9fa1[_0x2fe1('0x37')]=qs[_0x2fe1('0x2b')](_[_0x2fe1('0x35')](_0x11cad6['query'],_0x2c1935['filters']));_0x5d9fa1[_0x2fe1('0x37')][_0x2fe1('0x4a')]=_0x59f714['id'];if(_0x11cad6[_0x2fe1('0x2d')]['filter']){_0x5d9fa1[_0x2fe1('0x37')]=_[_0x2fe1('0x39')](_0x5d9fa1['where'],{'$or':_[_0x2fe1('0x25')](_0x5d9fa1[_0x2fe1('0x2e')],function(_0x38f454){var _0x4e584f={};_0x4e584f[_0x38f454]={'$like':'%'+_0x11cad6[_0x2fe1('0x2d')][_0x2fe1('0x36')]+'%'};return _0x4e584f;})});}_0x5d9fa1=_[_0x2fe1('0x39')]({},_0x5d9fa1,_0x11cad6[_0x2fe1('0x3a')]);return db[_0x2fe1('0x49')]['count']({'where':_0x5d9fa1[_0x2fe1('0x37')]})[_0x2fe1('0x1e')](function(_0x4d2324){_0x47a746[_0x2fe1('0x18')]=_0x4d2324;if(_0x11cad6[_0x2fe1('0x2d')]['includeAll']){_0x5d9fa1[_0x2fe1('0x41')]=[{'all':!![]}];}return db[_0x2fe1('0x49')][_0x2fe1('0x3c')](_0x5d9fa1);})[_0x2fe1('0x1e')](function(_0x2b3f97){_0x47a746[_0x2fe1('0x3d')]=_0x2b3f97;return _0x47a746;});}})[_0x2fe1('0x1e')](respondWithFilteredResult(_0x223046,_0x5d9fa1))[_0x2fe1('0x3e')](handleError(_0x223046,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 02fca83..402d2c1 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 _0x24ac=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa0396f,_0x516ee7){var _0x113cb8=function(_0x4fbd23){while(--_0x4fbd23){_0xa0396f['push'](_0xa0396f['shift']());}};_0x113cb8(++_0x516ee7);}(_0x24ac,0x120));var _0xc24a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc24a('0x0'));var util=require(_0xc24a('0x1'));var logger=require(_0xc24a('0x2'))(_0xc24a('0x3'));var moment=require(_0xc24a('0x4'));var BPromise=require(_0xc24a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc24a('0x6'));var rimraf=require(_0xc24a('0x7'));var config=require(_0xc24a('0x8'));var attributes=require(_0xc24a('0x9'));module[_0xc24a('0xa')]=function(_0x485f00,_0x34e303){return _0x485f00[_0xc24a('0xb')](_0xc24a('0xc'),attributes,{'tableName':_0xc24a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a3b=['../../config/environment','./jscriptySessionReport.attributes','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5a3b,0xbf));var _0xb5a3=function(_0x7e466f,_0x50d7ee){_0x7e466f=_0x7e466f-0x0;var _0x3de853=_0x5a3b[_0x7e466f];return _0x3de853;};'use strict';var _=require('lodash');var util=require(_0xb5a3('0x0'));var logger=require(_0xb5a3('0x1'))(_0xb5a3('0x2'));var moment=require('moment');var BPromise=require(_0xb5a3('0x3'));var rp=require(_0xb5a3('0x4'));var fs=require('fs');var path=require(_0xb5a3('0x5'));var rimraf=require(_0xb5a3('0x6'));var config=require(_0xb5a3('0x7'));var attributes=require(_0xb5a3('0x8'));module['exports']=function(_0x2c5051,_0x5c32dc){return _0x2c5051['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 04b45f9..a465467 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 _0xb3a3=['debug','stringify','code','error','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x51fd5b,_0x37f63b){var _0x59a7fc=function(_0x431f18){while(--_0x431f18){_0x51fd5b['push'](_0x51fd5b['shift']());}};_0x59a7fc(++_0x37f63b);}(_0xb3a3,0x132));var _0x3b3a=function(_0x56a270,_0x11529a){_0x56a270=_0x56a270-0x0;var _0xd0071a=_0xb3a3[_0x56a270];return _0xd0071a;};'use strict';var _=require(_0x3b3a('0x0'));var util=require('util');var moment=require(_0x3b3a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b3a('0x2'));var db=require(_0x3b3a('0x3'))['db'];var utils=require(_0x3b3a('0x4'));var logger=require(_0x3b3a('0x5'))('rpc');var config=require(_0x3b3a('0x6'));var jayson=require(_0x3b3a('0x7'));var client=jayson['client'][_0x3b3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f52ad,_0x35a8c3,_0x3f3c7a){return new BPromise(function(_0x199e08,_0x5bc20b){return client[_0x3b3a('0x9')](_0x2f52ad,_0x3f3c7a)[_0x3b3a('0xa')](function(_0x2aa1af){logger[_0x3b3a('0xb')](_0x3b3a('0xc'),_0x35a8c3,_0x3b3a('0xd'));logger[_0x3b3a('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x35a8c3,_0x3b3a('0xd'),JSON[_0x3b3a('0xf')](_0x2aa1af));if(_0x2aa1af['error']){if(_0x2aa1af['error'][_0x3b3a('0x10')]===0x1f4){logger[_0x3b3a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x35a8c3,_0x2aa1af[_0x3b3a('0x11')]['message']);return _0x5bc20b(_0x2aa1af['error'][_0x3b3a('0x12')]);}logger[_0x3b3a('0x11')](_0x3b3a('0xc'),_0x35a8c3,_0x2aa1af['error'][_0x3b3a('0x12')]);return _0x199e08(_0x2aa1af[_0x3b3a('0x11')][_0x3b3a('0x12')]);}else{logger[_0x3b3a('0xb')](_0x3b3a('0xc'),_0x35a8c3,'request\x20sent');_0x199e08(_0x2aa1af['result'][_0x3b3a('0x12')]);}})[_0x3b3a('0x13')](function(_0x58dea2){logger[_0x3b3a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x35a8c3,_0x58dea2);_0x5bc20b(_0x58dea2);});});} \ No newline at end of file +var _0x1b4a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x1b4a,0x1a1));var _0xa1b4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1b4a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa1b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa1b4('0x1'));var rs=require(_0xa1b4('0x2'));var fs=require('fs');var Redis=require(_0xa1b4('0x3'));var db=require(_0xa1b4('0x4'))['db'];var utils=require(_0xa1b4('0x5'));var logger=require(_0xa1b4('0x6'))('rpc');var config=require(_0xa1b4('0x7'));var jayson=require(_0xa1b4('0x8'));var client=jayson[_0xa1b4('0x9')][_0xa1b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539f4f,_0x434e9f,_0x4d709f){return new BPromise(function(_0x200e25,_0x5724bd){return client[_0xa1b4('0xb')](_0x539f4f,_0x4d709f)[_0xa1b4('0xc')](function(_0x182520){logger['info'](_0xa1b4('0xd'),_0x434e9f,_0xa1b4('0xe'));logger[_0xa1b4('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x434e9f,_0xa1b4('0xe'),JSON['stringify'](_0x182520));if(_0x182520[_0xa1b4('0x10')]){if(_0x182520[_0xa1b4('0x10')][_0xa1b4('0x11')]===0x1f4){logger[_0xa1b4('0x10')](_0xa1b4('0xd'),_0x434e9f,_0x182520[_0xa1b4('0x10')][_0xa1b4('0x12')]);return _0x5724bd(_0x182520[_0xa1b4('0x10')]['message']);}logger[_0xa1b4('0x10')](_0xa1b4('0xd'),_0x434e9f,_0x182520[_0xa1b4('0x10')][_0xa1b4('0x12')]);return _0x200e25(_0x182520[_0xa1b4('0x10')]['message']);}else{logger[_0xa1b4('0x13')](_0xa1b4('0xd'),_0x434e9f,_0xa1b4('0xe'));_0x200e25(_0x182520[_0xa1b4('0x14')][_0xa1b4('0x12')]);}})[_0xa1b4('0x15')](function(_0x2df541){logger[_0xa1b4('0x10')](_0xa1b4('0xd'),_0x434e9f,_0x2df541);_0x5724bd(_0x2df541);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 606b2ad..58bff85 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 _0x5ddc=['put','/:id','update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./license.controller','index'];(function(_0x5464d8,_0x3d5cb1){var _0x156af2=function(_0x123b4b){while(--_0x123b4b){_0x5464d8['push'](_0x5464d8['shift']());}};_0x156af2(++_0x3d5cb1);}(_0x5ddc,0x64));var _0xc5dd=function(_0x28b329,_0x1e2522){_0x28b329=_0x28b329-0x0;var _0x42601f=_0x5ddc[_0x28b329];return _0x42601f;};'use strict';var multer=require(_0xc5dd('0x0'));var util=require('util');var path=require(_0xc5dd('0x1'));var timeout=require(_0xc5dd('0x2'));var express=require(_0xc5dd('0x3'));var router=express['Router']();var auth=require(_0xc5dd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc5dd('0x5'));var controller=require(_0xc5dd('0x6'));router['get']('/',controller[_0xc5dd('0x7')]);router[_0xc5dd('0x8')](_0xc5dd('0x9'),auth['isAuthenticated'](),controller[_0xc5dd('0xa')]);module[_0xc5dd('0xb')]=router; \ No newline at end of file +var _0x5860=['Router','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','update','exports','multer','path','connect-timeout','express'];(function(_0x5ad625,_0x4f6da5){var _0x14e232=function(_0x454a9e){while(--_0x454a9e){_0x5ad625['push'](_0x5ad625['shift']());}};_0x14e232(++_0x4f6da5);}(_0x5860,0x18f));var _0x0586=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0x5860[_0x108d5f];return _0x456ea3;};'use strict';var multer=require(_0x0586('0x0'));var util=require('util');var path=require(_0x0586('0x1'));var timeout=require(_0x0586('0x2'));var express=require(_0x0586('0x3'));var router=express[_0x0586('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0586('0x5'));var controller=require(_0x0586('0x6'));router['get']('/',controller[_0x0586('0x7')]);router[_0x0586('0x8')](_0x0586('0x9'),auth[_0x0586('0xa')](),controller[_0x0586('0xb')]);module[_0x0586('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ad318b7..5bd0d6b 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 _0x687b=['TEXT','STRING','sequelize','exports'];(function(_0x223248,_0x2d555d){var _0x286608=function(_0x388ddc){while(--_0x388ddc){_0x223248['push'](_0x223248['shift']());}};_0x286608(++_0x2d555d);}(_0x687b,0x14a));var _0xb687=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x687b[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'license':{'type':Sequelize[_0xb687('0x2')]},'data1':{'type':Sequelize[_0xb687('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d38=['exports','TEXT','STRING'];(function(_0x49406b,_0x4374a0){var _0x447d17=function(_0x584010){while(--_0x584010){_0x49406b['push'](_0x49406b['shift']());}};_0x447d17(++_0x4374a0);}(_0x6d38,0x1ef));var _0x86d3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6d38[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'license':{'type':Sequelize[_0x86d3('0x1')]},'data1':{'type':Sequelize[_0x86d3('0x2')]},'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 a29105b..a6116a7 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 _0x39c7=['getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options'];(function(_0x241161,_0x3589e0){var _0x4d6dfb=function(_0x36cd25){while(--_0x36cd25){_0x241161['push'](_0x241161['shift']());}};_0x4d6dfb(++_0x3589e0);}(_0x39c7,0x85));var _0x739c=function(_0x53f6a0,_0x16d576){_0x53f6a0=_0x53f6a0-0x0;var _0x3e6f05=_0x39c7[_0x53f6a0];return _0x3e6f05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x739c('0x0'));var rimraf=require(_0x739c('0x1'));var zipdir=require(_0x739c('0x2'));var jsonpatch=require(_0x739c('0x3'));var rp=require(_0x739c('0x4'));var moment=require(_0x739c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x739c('0x6'));var util=require(_0x739c('0x7'));var path=require(_0x739c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x739c('0x9'));var fs=require('fs');var _=require(_0x739c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x739c('0xb'));var deskjs=require(_0x739c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x739c('0xd'));var Papa=require(_0x739c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x739c('0xf'));var as=require(_0x739c('0x10'));var hardwareService=require(_0x739c('0x11'));var logger=require(_0x739c('0x12'))(_0x739c('0x13'));var utils=require(_0x739c('0x14'));var config=require(_0x739c('0x15'));var licenseUtil=require(_0x739c('0x16'));var db=require(_0x739c('0x17'))['db'];function respondWithStatusCode(_0x46177c,_0x1a831f){_0x1a831f=_0x1a831f||0xcc;return function(_0x16e6b5){if(_0x16e6b5){return _0x46177c['sendStatus'](_0x1a831f);}return _0x46177c[_0x739c('0x18')](_0x1a831f)[_0x739c('0x19')]();};}function respondWithResult(_0x211418,_0x2d4939){_0x2d4939=_0x2d4939||0xc8;return function(_0x298049){if(_0x298049){return _0x211418[_0x739c('0x18')](_0x2d4939)[_0x739c('0x1a')](_0x298049);}};}function respondWithFilteredResult(_0xe6a26d,_0x2083f8){return function(_0x1a97c1){if(_0x1a97c1){var _0x4cc36c=_0x1a97c1[_0x739c('0x1b')],_0x50ee8d=_0x2083f8['offset'],_0x362095=_0x2083f8[_0x739c('0x1c')]+_0x2083f8[_0x739c('0x1d')],_0x23888d;if(_0x362095>=_0x4cc36c){_0x362095=_0x4cc36c;_0x23888d=0xc8;}else{_0x23888d=0xce;}_0xe6a26d[_0x739c('0x18')](_0x23888d);return _0xe6a26d[_0x739c('0x1e')](_0x739c('0x1f'),_0x50ee8d+'-'+_0x362095+'/'+_0x4cc36c)['json'](_0x1a97c1);}return null;};}function patchUpdates(_0x42c706){return function(_0x30259e){try{jsonpatch[_0x739c('0x20')](_0x30259e,_0x42c706,!![]);}catch(_0x4fc201){return BPromise[_0x739c('0x21')](_0x4fc201);}return _0x30259e['save']();};}function saveUpdates(_0x4a02b9,_0xd5592a){return function(_0x4df4cd){if(_0x4df4cd){return _0x4df4cd[_0x739c('0x22')](_0x4a02b9)[_0x739c('0x23')](function(_0x4ec24a){return _0x4ec24a;});}return null;};}function removeEntity(_0x43edec,_0x4ab72d){return function(_0x147baf){if(_0x147baf){return _0x147baf['destroy']()[_0x739c('0x23')](function(){_0x43edec[_0x739c('0x18')](0xcc)[_0x739c('0x19')]();});}};}function handleEntityNotFound(_0x3baad0,_0x3799ef){return function(_0xc138ce){if(!_0xc138ce){_0x3baad0[_0x739c('0x24')](0x194);}return _0xc138ce;};}function handleError(_0xd4fcb0,_0x5d404c){_0x5d404c=_0x5d404c||0x1f4;return function(_0x384bc5){logger[_0x739c('0x25')](_0x384bc5['stack']);if(_0x384bc5[_0x739c('0x26')]){delete _0x384bc5['name'];}_0xd4fcb0['status'](_0x5d404c)[_0x739c('0x27')](_0x384bc5);};}var utilLicense=require(_0x739c('0x16'));exports[_0x739c('0x28')]=function(_0x141807,_0x2053a5){var _0x4b81ce={'raw':!![],'where':{'id':0x1}},_0x45a9be={};_0x45a9be['model']=_[_0x739c('0x29')](db[_0x739c('0x2a')][_0x739c('0x2b')]);_0x45a9be[_0x739c('0x2c')]=_[_0x739c('0x29')](_0x141807[_0x739c('0x2c')]);_0x45a9be[_0x739c('0x2d')]=_['intersection'](_0x45a9be['model'],_0x45a9be['query']);_0x4b81ce['attributes']=_[_0x739c('0x2e')](_0x45a9be[_0x739c('0x2f')],qs[_0x739c('0x30')](_0x141807[_0x739c('0x2c')][_0x739c('0x30')]));_0x4b81ce[_0x739c('0x31')]=_0x4b81ce[_0x739c('0x31')][_0x739c('0x32')]?_0x4b81ce[_0x739c('0x31')]:_0x45a9be[_0x739c('0x2f')];_0x4b81ce=_[_0x739c('0x33')]({},_0x4b81ce,_0x141807[_0x739c('0x34')]);return utilLicense[_0x739c('0x35')](_0x4b81ce)[_0x739c('0x23')](respondWithResult(_0x2053a5,null))[_0x739c('0x36')](handleError(_0x2053a5,null));};exports[_0x739c('0x22')]=function(_0x3130e2,_0x358e9f){if(_0x3130e2[_0x739c('0x37')]['id']){delete _0x3130e2[_0x739c('0x37')]['id'];}return db[_0x739c('0x2a')][_0x739c('0x38')]({'where':{'id':_0x3130e2[_0x739c('0x39')]['id']}})[_0x739c('0x23')](handleEntityNotFound(_0x358e9f,null))[_0x739c('0x23')](function(_0x36eec6){var _0x3a4fec=_0x36eec6[_0x739c('0x3a')]({'plain':!![]});return utilLicense[_0x739c('0x3b')](_0x3a4fec,_0x3130e2[_0x739c('0x37')][_0x739c('0x3c')]);})[_0x739c('0x23')](function(_0x387276){if(!_0x387276[_0x739c('0x3d')]){return saveUpdates(_0x3130e2[_0x739c('0x37')],null);}return _0x387276;})['then'](respondWithResult(_0x358e9f,null))[_0x739c('0x36')](handleError(_0x358e9f,null));}; \ No newline at end of file +var _0xc03e=['querystring','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','count','offset','apply','reject','update','then','destroy','error','stack','name','send','index','model','rawAttributes','query','keys','filters','intersection','fields','attributes','length','getLicense','catch','License','find','params','get','checkLicense','body','key','demo','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x83d0ad,_0x36efe7){var _0x5077aa=function(_0x240784){while(--_0x240784){_0x83d0ad['push'](_0x83d0ad['shift']());}};_0x5077aa(++_0x36efe7);}(_0xc03e,0x15a));var _0xec03=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0xc03e[_0x1a3cc7];return _0x338438;};'use strict';var pdf=require(_0xec03('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec03('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec03('0x2'));var moment=require('moment');var BPromise=require(_0xec03('0x3'));var Mustache=require(_0xec03('0x4'));var util=require(_0xec03('0x5'));var path=require(_0xec03('0x6'));var sox=require(_0xec03('0x7'));var csv=require(_0xec03('0x8'));var ejs=require(_0xec03('0x9'));var fs=require('fs');var _=require(_0xec03('0xa'));var squel=require(_0xec03('0xb'));var crypto=require('crypto');var jsforce=require(_0xec03('0xc'));var deskjs=require(_0xec03('0xd'));var toCsv=require(_0xec03('0x8'));var querystring=require(_0xec03('0xe'));var Papa=require('papaparse');var Redis=require(_0xec03('0xf'));var authService=require(_0xec03('0x10'));var qs=require(_0xec03('0x11'));var as=require(_0xec03('0x12'));var hardwareService=require(_0xec03('0x13'));var logger=require(_0xec03('0x14'))(_0xec03('0x15'));var utils=require(_0xec03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xec03('0x17'));var db=require(_0xec03('0x18'))['db'];function respondWithStatusCode(_0x398720,_0x2f65a1){_0x2f65a1=_0x2f65a1||0xcc;return function(_0x9908ef){if(_0x9908ef){return _0x398720[_0xec03('0x19')](_0x2f65a1);}return _0x398720[_0xec03('0x1a')](_0x2f65a1)[_0xec03('0x1b')]();};}function respondWithResult(_0x4ba43a,_0x555447){_0x555447=_0x555447||0xc8;return function(_0x5ca0e2){if(_0x5ca0e2){return _0x4ba43a[_0xec03('0x1a')](_0x555447)[_0xec03('0x1c')](_0x5ca0e2);}};}function respondWithFilteredResult(_0x3501ab,_0x515680){return function(_0x28bb4f){if(_0x28bb4f){var _0xbe85e6=_0x28bb4f[_0xec03('0x1d')],_0x452323=_0x515680['offset'],_0x1d1b45=_0x515680[_0xec03('0x1e')]+_0x515680['limit'],_0x5c2f1a;if(_0x1d1b45>=_0xbe85e6){_0x1d1b45=_0xbe85e6;_0x5c2f1a=0xc8;}else{_0x5c2f1a=0xce;}_0x3501ab[_0xec03('0x1a')](_0x5c2f1a);return _0x3501ab['set']('Content-Range',_0x452323+'-'+_0x1d1b45+'/'+_0xbe85e6)[_0xec03('0x1c')](_0x28bb4f);}return null;};}function patchUpdates(_0x327167){return function(_0xefa268){try{jsonpatch[_0xec03('0x1f')](_0xefa268,_0x327167,!![]);}catch(_0x4b9df8){return BPromise[_0xec03('0x20')](_0x4b9df8);}return _0xefa268['save']();};}function saveUpdates(_0x16ade3,_0x253910){return function(_0x345113){if(_0x345113){return _0x345113[_0xec03('0x21')](_0x16ade3)[_0xec03('0x22')](function(_0x41b729){return _0x41b729;});}return null;};}function removeEntity(_0x3a44df,_0x3b6ddf){return function(_0x5df6cc){if(_0x5df6cc){return _0x5df6cc[_0xec03('0x23')]()[_0xec03('0x22')](function(){_0x3a44df[_0xec03('0x1a')](0xcc)[_0xec03('0x1b')]();});}};}function handleEntityNotFound(_0x33de1e,_0x15ef87){return function(_0x59936d){if(!_0x59936d){_0x33de1e[_0xec03('0x19')](0x194);}return _0x59936d;};}function handleError(_0x3ab7a1,_0x4f35c9){_0x4f35c9=_0x4f35c9||0x1f4;return function(_0x2bfcf6){logger[_0xec03('0x24')](_0x2bfcf6[_0xec03('0x25')]);if(_0x2bfcf6[_0xec03('0x26')]){delete _0x2bfcf6[_0xec03('0x26')];}_0x3ab7a1['status'](_0x4f35c9)[_0xec03('0x27')](_0x2bfcf6);};}var utilLicense=require(_0xec03('0x17'));exports[_0xec03('0x28')]=function(_0x11a6b6,_0x29e904){var _0x58621e={'raw':!![],'where':{'id':0x1}},_0x15cb11={};_0x15cb11[_0xec03('0x29')]=_['keys'](db['License'][_0xec03('0x2a')]);_0x15cb11[_0xec03('0x2b')]=_[_0xec03('0x2c')](_0x11a6b6[_0xec03('0x2b')]);_0x15cb11[_0xec03('0x2d')]=_[_0xec03('0x2e')](_0x15cb11[_0xec03('0x29')],_0x15cb11[_0xec03('0x2b')]);_0x58621e['attributes']=_[_0xec03('0x2e')](_0x15cb11[_0xec03('0x29')],qs[_0xec03('0x2f')](_0x11a6b6[_0xec03('0x2b')][_0xec03('0x2f')]));_0x58621e[_0xec03('0x30')]=_0x58621e[_0xec03('0x30')][_0xec03('0x31')]?_0x58621e[_0xec03('0x30')]:_0x15cb11['model'];_0x58621e=_['merge']({},_0x58621e,_0x11a6b6['options']);return utilLicense[_0xec03('0x32')](_0x58621e)[_0xec03('0x22')](respondWithResult(_0x29e904,null))[_0xec03('0x33')](handleError(_0x29e904,null));};exports[_0xec03('0x21')]=function(_0x5b9549,_0x576d5e){if(_0x5b9549['body']['id']){delete _0x5b9549['body']['id'];}return db[_0xec03('0x34')][_0xec03('0x35')]({'where':{'id':_0x5b9549[_0xec03('0x36')]['id']}})[_0xec03('0x22')](handleEntityNotFound(_0x576d5e,null))[_0xec03('0x22')](function(_0x3d7d98){var _0x23a26b=_0x3d7d98[_0xec03('0x37')]({'plain':!![]});return utilLicense[_0xec03('0x38')](_0x23a26b,_0x5b9549[_0xec03('0x39')][_0xec03('0x3a')]);})[_0xec03('0x22')](function(_0x5b9267){if(!_0x5b9267[_0xec03('0x3b')]){return saveUpdates(_0x5b9549[_0xec03('0x39')],null);}return _0x5b9267;})[_0xec03('0x22')](respondWithResult(_0x576d5e,null))['catch'](handleError(_0x576d5e,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7b80fe9..5807d90 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 _0x448a=['./license.attributes','exports','define','License','license','util','../../config/logger','moment','path','rimraf'];(function(_0x11e327,_0x473c86){var _0x4b3c3b=function(_0x106f4c){while(--_0x106f4c){_0x11e327['push'](_0x11e327['shift']());}};_0x4b3c3b(++_0x473c86);}(_0x448a,0x1ef));var _0xa448=function(_0xffc809,_0x1d0346){_0xffc809=_0xffc809-0x0;var _0x565c72=_0x448a[_0xffc809];return _0x565c72;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var logger=require(_0xa448('0x1'))('api');var moment=require(_0xa448('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa448('0x3'));var rimraf=require(_0xa448('0x4'));var config=require('../../config/environment');var attributes=require(_0xa448('0x5'));module[_0xa448('0x6')]=function(_0x343b79,_0x2c16e3){return _0x343b79[_0xa448('0x7')](_0xa448('0x8'),attributes,{'tableName':_0xa448('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe343=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./license.attributes','exports','define','license'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe343,0x6e));var _0x3e34=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xe343[_0xf2f332];return _0x56cce3;};'use strict';var _=require(_0x3e34('0x0'));var util=require(_0x3e34('0x1'));var logger=require(_0x3e34('0x2'))('api');var moment=require(_0x3e34('0x3'));var BPromise=require(_0x3e34('0x4'));var rp=require(_0x3e34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e34('0x6'));var attributes=require(_0x3e34('0x7'));module[_0x3e34('0x8')]=function(_0x2b0223,_0x418c19){return _0x2b0223[_0x3e34('0x9')]('License',attributes,{'tableName':_0x3e34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index e9d06fb..99cc6f2 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 _0x342e=['result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x349ab8,_0x26b23a){var _0x76bc72=function(_0x3ba73f){while(--_0x3ba73f){_0x349ab8['push'](_0x349ab8['shift']());}};_0x76bc72(++_0x26b23a);}(_0x342e,0xde));var _0xe342=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x342e[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe342('0x3'));var db=require(_0xe342('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe342('0x5'));var config=require(_0xe342('0x6'));var jayson=require(_0xe342('0x7'));var client=jayson[_0xe342('0x8')][_0xe342('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e643a,_0x57895b,_0x3457ac){return new BPromise(function(_0x36bb18,_0x54868d){return client['request'](_0x5e643a,_0x3457ac)[_0xe342('0xa')](function(_0x2b2e82){logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));logger[_0xe342('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x57895b,_0xe342('0xd'),JSON[_0xe342('0xf')](_0x2b2e82));if(_0x2b2e82[_0xe342('0x10')]){if(_0x2b2e82[_0xe342('0x10')]['code']===0x1f4){logger[_0xe342('0x10')]('License,\x20%s,\x20%s',_0x57895b,_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);return _0x54868d(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}logger['error'](_0xe342('0xc'),_0x57895b,_0x2b2e82[_0xe342('0x10')]['message']);return _0x36bb18(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}else{logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));_0x36bb18(_0x2b2e82[_0xe342('0x12')][_0xe342('0x11')]);}})[_0xe342('0x13')](function(_0x190a90){logger[_0xe342('0x10')](_0xe342('0xc'),_0x57895b,_0x190a90);_0x54868d(_0x190a90);});});} \ No newline at end of file +var _0x5127=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x5127,0x18f));var _0x7512=function(_0xab58e1,_0x5d47ce){_0xab58e1=_0xab58e1-0x0;var _0x295351=_0x5127[_0xab58e1];return _0x295351;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7512('0x5'))(_0x7512('0x6'));var config=require(_0x7512('0x7'));var jayson=require(_0x7512('0x8'));var client=jayson[_0x7512('0x9')][_0x7512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6779,_0x4d0765,_0x2d2e88){return new BPromise(function(_0x543586,_0x43ce62){return client['request'](_0x4e6779,_0x2d2e88)[_0x7512('0xb')](function(_0x1e41b5){logger[_0x7512('0xc')](_0x7512('0xd'),_0x4d0765,_0x7512('0xe'));logger[_0x7512('0xf')](_0x7512('0x10'),_0x4d0765,_0x7512('0xe'),JSON[_0x7512('0x11')](_0x1e41b5));if(_0x1e41b5[_0x7512('0x12')]){if(_0x1e41b5[_0x7512('0x12')][_0x7512('0x13')]===0x1f4){logger[_0x7512('0x12')](_0x7512('0xd'),_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x43ce62(_0x1e41b5[_0x7512('0x12')]['message']);}logger[_0x7512('0x12')]('License,\x20%s,\x20%s',_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x543586(_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);}else{logger[_0x7512('0xc')]('License,\x20%s,\x20%s',_0x4d0765,'request\x20sent');_0x543586(_0x1e41b5[_0x7512('0x15')][_0x7512('0x14')]);}})[_0x7512('0x16')](function(_0x3f8f8f){logger['error'](_0x7512('0xd'),_0x4d0765,_0x3f8f8f);_0x43ce62(_0x3f8f8f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index dec4531..97239da 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 _0x3d49=['verifySmtp','/:id/users','post','addAnswer','create','/:id/in_servers','addImap','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/verify'];(function(_0x522476,_0x5d186c){var _0x2f7450=function(_0x4e18c6){while(--_0x4e18c6){_0x522476['push'](_0x522476['shift']());}};_0x2f7450(++_0x5d186c);}(_0x3d49,0x151));var _0x93d4=function(_0xe75d24,_0x54f93b){_0xe75d24=_0xe75d24-0x0;var _0x4d2587=_0x3d49[_0xe75d24];return _0x4d2587;};'use strict';var multer=require('multer');var util=require(_0x93d4('0x0'));var path=require(_0x93d4('0x1'));var timeout=require(_0x93d4('0x2'));var express=require(_0x93d4('0x3'));var router=express['Router']();var auth=require(_0x93d4('0x4'));var interaction=require(_0x93d4('0x5'));var config=require(_0x93d4('0x6'));var controller=require(_0x93d4('0x7'));router[_0x93d4('0x8')]('/',auth[_0x93d4('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x93d4('0xa'),auth[_0x93d4('0x9')](),controller[_0x93d4('0xb')]);router[_0x93d4('0x8')](_0x93d4('0xc'),auth[_0x93d4('0x9')](),controller[_0x93d4('0xd')]);router[_0x93d4('0x8')](_0x93d4('0xe'),auth[_0x93d4('0x9')](),controller[_0x93d4('0xf')]);router[_0x93d4('0x8')]('/:id/in_servers',auth[_0x93d4('0x9')](),controller['getImap']);router[_0x93d4('0x8')](_0x93d4('0x10'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x11')]);router['get'](_0x93d4('0x12'),auth[_0x93d4('0x9')](),controller['getInteractions']);router[_0x93d4('0x8')](_0x93d4('0x13'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x14')]);router[_0x93d4('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x93d4('0x15')]);router['get'](_0x93d4('0x16'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x17')]);router[_0x93d4('0x8')](_0x93d4('0x18'),auth[_0x93d4('0x9')](),controller['getAgents']);router[_0x93d4('0x19')](_0x93d4('0xc'),auth[_0x93d4('0x9')](),controller['addDisposition']);router[_0x93d4('0x19')]('/:id/canned_answers',auth[_0x93d4('0x9')](),controller[_0x93d4('0x1a')]);router[_0x93d4('0x19')]('/',auth[_0x93d4('0x9')](),controller[_0x93d4('0x1b')]);router['post'](_0x93d4('0x1c'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x1d')]);router[_0x93d4('0x19')](_0x93d4('0x10'),auth[_0x93d4('0x9')](),controller['addSmtp']);router[_0x93d4('0x19')](_0x93d4('0x12'),auth[_0x93d4('0x9')](),controller['addInteraction']);router[_0x93d4('0x19')]('/:id/applications',auth[_0x93d4('0x9')](),controller[_0x93d4('0x1e')]);router['post'](_0x93d4('0x1f'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x20')]);router['post']('/:id/users',auth[_0x93d4('0x9')](),controller['addAgents']);router[_0x93d4('0x21')](_0x93d4('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x93d4('0x22')](_0x93d4('0xc'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x23')]);router[_0x93d4('0x22')](_0x93d4('0xe'),auth[_0x93d4('0x9')](),controller[_0x93d4('0x24')]);router[_0x93d4('0x22')]('/:id/in_servers',auth[_0x93d4('0x9')](),controller[_0x93d4('0x25')]);router[_0x93d4('0x22')]('/:id/out_servers',auth[_0x93d4('0x9')](),controller[_0x93d4('0x26')]);router[_0x93d4('0x22')](_0x93d4('0xa'),auth[_0x93d4('0x9')](),controller['destroy']);router[_0x93d4('0x22')](_0x93d4('0x18'),auth[_0x93d4('0x9')](),controller['removeAgents']);module[_0x93d4('0x27')]=router; \ No newline at end of file +var _0x9219=['/describe','describe','/:id','getAnswers','/:id/in_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','addApplications','send','/:id/users','put','update','delete','removeImap','removeSmtp','removeAgents','exports','express','../../components/interaction/service','get','isAuthenticated'];(function(_0x39b282,_0x2063c2){var _0x2f841e=function(_0x24d62a){while(--_0x24d62a){_0x39b282['push'](_0x39b282['shift']());}};_0x2f841e(++_0x2063c2);}(_0x9219,0x19e));var _0x9921=function(_0x5a6011,_0x15033e){_0x5a6011=_0x5a6011-0x0;var _0x445055=_0x9219[_0x5a6011];return _0x445055;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9921('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9921('0x1'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x9921('0x2')]('/',auth[_0x9921('0x3')](),controller['index']);router[_0x9921('0x2')](_0x9921('0x4'),auth[_0x9921('0x3')](),controller[_0x9921('0x5')]);router[_0x9921('0x2')](_0x9921('0x6'),auth[_0x9921('0x3')](),controller['show']);router['get']('/:id/dispositions',auth[_0x9921('0x3')](),controller['getDispositions']);router[_0x9921('0x2')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9921('0x7')]);router[_0x9921('0x2')](_0x9921('0x8'),auth[_0x9921('0x3')](),controller['getImap']);router[_0x9921('0x2')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x9921('0x9')]);router[_0x9921('0x2')]('/:id/interactions',auth[_0x9921('0x3')](),controller[_0x9921('0xa')]);router['get'](_0x9921('0xb'),auth[_0x9921('0x3')](),controller[_0x9921('0xc')]);router['get'](_0x9921('0xd'),auth[_0x9921('0x3')](),controller[_0x9921('0xe')]);router['get'](_0x9921('0xf'),auth[_0x9921('0x3')](),controller[_0x9921('0x10')]);router[_0x9921('0x2')]('/:id/users',auth[_0x9921('0x3')](),controller[_0x9921('0x11')]);router[_0x9921('0x12')]('/:id/dispositions',auth[_0x9921('0x3')](),controller[_0x9921('0x13')]);router[_0x9921('0x12')](_0x9921('0x14'),auth[_0x9921('0x3')](),controller[_0x9921('0x15')]);router['post']('/',auth[_0x9921('0x3')](),controller[_0x9921('0x16')]);router[_0x9921('0x12')](_0x9921('0x8'),auth['isAuthenticated'](),controller[_0x9921('0x17')]);router[_0x9921('0x12')](_0x9921('0x18'),auth[_0x9921('0x3')](),controller[_0x9921('0x19')]);router[_0x9921('0x12')](_0x9921('0x1a'),auth[_0x9921('0x3')](),controller[_0x9921('0x1b')]);router[_0x9921('0x12')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9921('0x1c')]);router[_0x9921('0x12')]('/:id/send',auth['isAuthenticated'](),controller[_0x9921('0x1d')]);router[_0x9921('0x12')](_0x9921('0x1e'),auth[_0x9921('0x3')](),controller['addAgents']);router[_0x9921('0x1f')]('/:id',auth[_0x9921('0x3')](),controller[_0x9921('0x20')]);router[_0x9921('0x21')]('/:id/dispositions',auth[_0x9921('0x3')](),controller['removeDispositions']);router[_0x9921('0x21')](_0x9921('0x14'),auth[_0x9921('0x3')](),controller['removeAnswers']);router[_0x9921('0x21')](_0x9921('0x8'),auth['isAuthenticated'](),controller[_0x9921('0x22')]);router[_0x9921('0x21')](_0x9921('0x18'),auth[_0x9921('0x3')](),controller[_0x9921('0x23')]);router[_0x9921('0x21')](_0x9921('0x6'),auth[_0x9921('0x3')](),controller['destroy']);router[_0x9921('0x21')](_0x9921('0x1e'),auth['isAuthenticated'](),controller[_0x9921('0x24')]);module[_0x9921('0x25')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 9d68917..b8f9092 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 _0x92e5=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x1a4498,_0x10a01a){var _0x396976=function(_0xf6ed2a){while(--_0xf6ed2a){_0x1a4498['push'](_0x1a4498['shift']());}};_0x396976(++_0x10a01a);}(_0x92e5,0x125));var _0x592e=function(_0x41481a,_0x306810){_0x41481a=_0x41481a-0x0;var _0x53d2a4=_0x92e5[_0x41481a];return _0x53d2a4;};'use strict';var Sequelize=require(_0x592e('0x0'));module[_0x592e('0x1')]={'description':{'type':Sequelize[_0x592e('0x2')]},'name':{'type':Sequelize[_0x592e('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x592e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x592e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x592e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x592e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x592e('0x4')]},'markAsUnread':{'type':Sequelize[_0x592e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x592e('0x2')],'allowNull':![],'defaultValue':_0x592e('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x592e('0x4')],'defaultValue':function(){return _0x592e('0x6');}},'notificationSound':{'type':Sequelize[_0x592e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x592e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x592e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x592e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x592e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x592e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x592e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x592e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x592e('0x3')],'defaultValue':![],'comment':_0x592e('0x9'),'set':function(_0x35f7d4){if(!_0x35f7d4)this[_0x592e('0xa')](_0x592e('0xb'),null);this['setDataValue'](_0x592e('0xc'),_0x35f7d4);}}}; \ No newline at end of file +var _0x7b71=['sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x533437,_0x4d59d1){var _0x53f4ce=function(_0x483f6b){while(--_0x483f6b){_0x533437['push'](_0x533437['shift']());}};_0x53f4ce(++_0x4d59d1);}(_0x7b71,0xc6));var _0x17b7=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0x7b71[_0x100e0c];return _0x4db1aa;};'use strict';var Sequelize=require(_0x17b7('0x0'));module['exports']={'description':{'type':Sequelize[_0x17b7('0x1')]},'name':{'type':Sequelize[_0x17b7('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x17b7('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x17b7('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x17b7('0x4')](0x2)[_0x17b7('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x17b7('0x3')],'defaultValue':function(){return _0x17b7('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x17b7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17b7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17b7('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':![],'comment':_0x17b7('0x7'),'set':function(_0x329353){if(!_0x329353)this[_0x17b7('0x8')](_0x17b7('0x9'),null);this[_0x17b7('0x8')](_0x17b7('0xa'),_0x329353);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 22814f8..f285fe7 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 _0x90c7=['map','MailAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerIn','keys','body','find','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','description','user','password','pass','authentication','host','port','service','cservice','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','MailInteraction','omit','CmContact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause'];(function(_0x10ebc2,_0xbdc946){var _0x549930=function(_0x44a9dd){while(--_0x44a9dd){_0x10ebc2['push'](_0x10ebc2['shift']());}};_0x549930(++_0xbdc946);}(_0x90c7,0x80));var _0x790c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x90c7[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x790c('0x0'));var rimraf=require(_0x790c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x790c('0x2'));var rp=require(_0x790c('0x3'));var moment=require('moment');var BPromise=require(_0x790c('0x4'));var Mustache=require(_0x790c('0x5'));var util=require(_0x790c('0x6'));var path=require(_0x790c('0x7'));var sox=require(_0x790c('0x8'));var csv=require(_0x790c('0x9'));var ejs=require(_0x790c('0xa'));var fs=require('fs');var _=require(_0x790c('0xb'));var squel=require(_0x790c('0xc'));var crypto=require(_0x790c('0xd'));var jsforce=require(_0x790c('0xe'));var deskjs=require(_0x790c('0xf'));var toCsv=require(_0x790c('0x9'));var querystring=require('querystring');var Papa=require(_0x790c('0x10'));var htmlToText=require(_0x790c('0x11'));var juice=require(_0x790c('0x12'));var Redis=require(_0x790c('0x13'));var authService=require(_0x790c('0x14'));var qs=require(_0x790c('0x15'));var as=require(_0x790c('0x16'));var hardwareService=require(_0x790c('0x17'));var logger=require(_0x790c('0x18'))(_0x790c('0x19'));var utils=require(_0x790c('0x1a'));var config=require(_0x790c('0x1b'));var licenseUtil=require(_0x790c('0x1c'));var db=require(_0x790c('0x1d'))['db'];config[_0x790c('0x1e')]=_['defaults'](config['redis'],{'host':_0x790c('0x1f'),'port':0x18eb});var socket=require(_0x790c('0x20'))(new Redis(config[_0x790c('0x1e')]));require(_0x790c('0x21'))[_0x790c('0x22')](socket);var jayson=require(_0x790c('0x23'));var client=jayson[_0x790c('0x24')][_0x790c('0x25')]({'port':0x232b});function respondWithRpcPromise(_0x29dc26,_0x55a98a,_0x57ec07,_0x5c8a62){return new BPromise(function(_0x36131c,_0x33c1bf){var _0xa9287e=_0x5c8a62||client;return _0xa9287e[_0x790c('0x26')](_0x29dc26,_0x57ec07)[_0x790c('0x27')](function(_0x2b8573){logger['info']('MailAccount,\x20%s,\x20%s',_0x55a98a,_0x790c('0x28'));logger[_0x790c('0x29')](_0x790c('0x2a'),_0x55a98a,_0x790c('0x28'),JSON['stringify'](_0x2b8573));if(_0x2b8573['error']){if(_0x2b8573[_0x790c('0x2b')][_0x790c('0x2c')]===0x1f4){logger[_0x790c('0x2b')](_0x790c('0x2d'),_0x55a98a,_0x2b8573['error'][_0x790c('0x2e')]);return _0x33c1bf(_0x2b8573[_0x790c('0x2b')][_0x790c('0x2e')]);}logger[_0x790c('0x2b')](_0x790c('0x2d'),_0x55a98a,_0x2b8573['error'][_0x790c('0x2e')]);return _0x36131c(_0x2b8573['error'][_0x790c('0x2e')]);}else{logger[_0x790c('0x2f')](_0x790c('0x2d'),_0x55a98a,'request\x20sent');_0x36131c(_0x2b8573[_0x790c('0x30')]['message']);}})[_0x790c('0x31')](function(_0x16a37a){logger['error'](_0x790c('0x2d'),_0x55a98a,_0x16a37a);_0x33c1bf(_0x16a37a);});});}function respondWithStatusCode(_0xec24e0,_0x12513a){_0x12513a=_0x12513a||0xcc;return function(_0x51bf74){if(_0x51bf74){return _0xec24e0[_0x790c('0x32')](_0x12513a);}return _0xec24e0['status'](_0x12513a)[_0x790c('0x33')]();};}function respondWithResult(_0x4926ac,_0x2c5d5e){_0x2c5d5e=_0x2c5d5e||0xc8;return function(_0x23051b){if(_0x23051b){return _0x4926ac[_0x790c('0x34')](_0x2c5d5e)['json'](_0x23051b);}};}function respondWithFilteredResult(_0x3d514f,_0x44d1b1){return function(_0x28f1f2){if(_0x28f1f2){var _0x26ba74=_0x28f1f2[_0x790c('0x35')],_0x31f9a9=_0x44d1b1[_0x790c('0x36')],_0x35ce3c=_0x44d1b1[_0x790c('0x36')]+_0x44d1b1[_0x790c('0x37')],_0x5419b8;if(_0x35ce3c>=_0x26ba74){_0x35ce3c=_0x26ba74;_0x5419b8=0xc8;}else{_0x5419b8=0xce;}_0x3d514f[_0x790c('0x34')](_0x5419b8);return _0x3d514f[_0x790c('0x38')](_0x790c('0x39'),_0x31f9a9+'-'+_0x35ce3c+'/'+_0x26ba74)['json'](_0x28f1f2);}return null;};}function patchUpdates(_0xe3656c){return function(_0x2db013){try{jsonpatch['apply'](_0x2db013,_0xe3656c,!![]);}catch(_0x1970dc){return BPromise[_0x790c('0x3a')](_0x1970dc);}return _0x2db013[_0x790c('0x3b')]();};}function saveUpdates(_0x1ebc79,_0x1511a0){return function(_0xdd3877){if(_0xdd3877){return _0xdd3877[_0x790c('0x3c')](_0x1ebc79)[_0x790c('0x27')](function(_0x301ef1){return _0x301ef1;});}return null;};}function removeEntity(_0x384d9,_0x38c4fa){return function(_0x191604){if(_0x191604){return _0x191604[_0x790c('0x3d')]()['then'](function(){var _0xaabbdc=_0x191604[_0x790c('0x3e')]({'plain':!![]});var _0x305375=_0x790c('0x3f');return db[_0x790c('0x40')]['destroy']({'where':{'type':_0x305375,'resourceId':_0xaabbdc['id']}})[_0x790c('0x27')](function(){return _0x191604;});})[_0x790c('0x27')](function(){_0x384d9[_0x790c('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11dd6c,_0x5f4af2){return function(_0x4a824e){if(!_0x4a824e){_0x11dd6c[_0x790c('0x32')](0x194);}return _0x4a824e;};}function handleError(_0x21d795,_0x231a96){_0x231a96=_0x231a96||0x1f4;return function(_0x186885){logger['error'](_0x186885[_0x790c('0x41')]);if(_0x186885['name']){delete _0x186885[_0x790c('0x42')];}_0x21d795['status'](_0x231a96)[_0x790c('0x43')](_0x186885);};}exports[_0x790c('0x44')]=function(_0x89734d,_0x37ec7d){var _0x19adb9={'include':[{'model':db['MailServerIn'],'as':_0x790c('0x45')},{'model':db[_0x790c('0x46')],'as':_0x790c('0x47')},{'model':db[_0x790c('0x48')],'as':_0x790c('0x49')}]},_0x41c0d7={},_0x2ae845={'count':0x0,'rows':[]};var _0x5140ab=_[_0x790c('0x4a')](db[_0x790c('0x4b')][_0x790c('0x4c')],function(_0x5c6d58){return{'name':_0x5c6d58['fieldName'],'type':_0x5c6d58['type'][_0x790c('0x4d')]};});_0x41c0d7[_0x790c('0x4e')]=_[_0x790c('0x4a')](_0x5140ab,_0x790c('0x42'));_0x41c0d7[_0x790c('0x4f')]=_['keys'](_0x89734d[_0x790c('0x4f')]);_0x41c0d7[_0x790c('0x50')]=_[_0x790c('0x51')](_0x41c0d7['model'],_0x41c0d7['query']);_0x19adb9[_0x790c('0x52')]=_[_0x790c('0x51')](_0x41c0d7[_0x790c('0x4e')],qs[_0x790c('0x53')](_0x89734d[_0x790c('0x4f')][_0x790c('0x53')]));_0x19adb9['attributes']=_0x19adb9[_0x790c('0x52')][_0x790c('0x54')]?_0x19adb9[_0x790c('0x52')]:_0x41c0d7[_0x790c('0x4e')];if(!_0x89734d[_0x790c('0x4f')]['hasOwnProperty'](_0x790c('0x55'))){_0x19adb9[_0x790c('0x37')]=qs['limit'](_0x89734d[_0x790c('0x4f')][_0x790c('0x37')]);_0x19adb9[_0x790c('0x36')]=qs[_0x790c('0x36')](_0x89734d[_0x790c('0x4f')]['offset']);}_0x19adb9[_0x790c('0x56')]=qs[_0x790c('0x57')](_0x89734d['query'][_0x790c('0x57')]);_0x19adb9[_0x790c('0x58')]=qs['filters'](_[_0x790c('0x59')](_0x89734d[_0x790c('0x4f')],_0x41c0d7['filters']),_0x5140ab);if(_0x89734d[_0x790c('0x4f')][_0x790c('0x5a')]){_0x19adb9[_0x790c('0x58')]=_[_0x790c('0x5b')](_0x19adb9[_0x790c('0x58')],{'$or':_[_0x790c('0x4a')](_0x5140ab,function(_0x1fd732){if(_0x1fd732[_0x790c('0x5c')]!==_0x790c('0x5d')){var _0x3c7531={};_0x3c7531[_0x1fd732['name']]={'$like':'%'+_0x89734d['query'][_0x790c('0x5a')]+'%'};return _0x3c7531;}})});}_0x19adb9=_[_0x790c('0x5b')]({},_0x19adb9,_0x89734d[_0x790c('0x5e')]);var _0x18cd47={'where':_0x19adb9[_0x790c('0x58')]};return db[_0x790c('0x4b')][_0x790c('0x35')](_0x18cd47)['then'](function(_0x343fe7){_0x2ae845['count']=_0x343fe7;if(_0x89734d[_0x790c('0x4f')][_0x790c('0x5f')]){_0x19adb9[_0x790c('0x60')]=[{'all':!![]}];}return db[_0x790c('0x4b')][_0x790c('0x61')](_0x19adb9);})[_0x790c('0x27')](function(_0x3cbaa5){_0x2ae845[_0x790c('0x62')]=_0x3cbaa5;return _0x2ae845;})[_0x790c('0x27')](respondWithFilteredResult(_0x37ec7d,_0x19adb9))[_0x790c('0x31')](handleError(_0x37ec7d,null));};exports[_0x790c('0x63')]=function(_0x51429c,_0x2a6b8d){var _0x250374={'raw':![],'where':{'id':_0x51429c[_0x790c('0x64')]['id']},'include':[{'model':db[_0x790c('0x65')],'as':_0x790c('0x45')},{'model':db['MailServerOut'],'as':_0x790c('0x47')},{'model':db['Pause'],'as':_0x790c('0x49')}]},_0x23465b={};_0x23465b[_0x790c('0x4e')]=_[_0x790c('0x66')](db[_0x790c('0x4b')][_0x790c('0x4c')]);_0x23465b[_0x790c('0x4f')]=_['keys'](_0x51429c[_0x790c('0x4f')]);_0x23465b['filters']=_[_0x790c('0x51')](_0x23465b[_0x790c('0x4e')],_0x23465b['query']);_0x250374[_0x790c('0x52')]=_['intersection'](_0x23465b[_0x790c('0x4e')],qs['fields'](_0x51429c[_0x790c('0x4f')][_0x790c('0x53')]));_0x250374[_0x790c('0x52')]=_0x250374['attributes']['length']?_0x250374[_0x790c('0x52')]:_0x23465b[_0x790c('0x4e')];if(_0x51429c['query'][_0x790c('0x5f')]){_0x250374[_0x790c('0x60')]=[{'all':!![]}];}_0x250374=_[_0x790c('0x5b')]({},_0x250374,_0x51429c['options']);return db['MailAccount']['find'](_0x250374)[_0x790c('0x27')](handleEntityNotFound(_0x2a6b8d,null))[_0x790c('0x27')](respondWithResult(_0x2a6b8d,null))['catch'](handleError(_0x2a6b8d,null));};exports[_0x790c('0x3c')]=function(_0x4a68b3,_0x5b8bf8){if(_0x4a68b3[_0x790c('0x67')]['id']){delete _0x4a68b3[_0x790c('0x67')]['id'];}return db[_0x790c('0x4b')][_0x790c('0x68')]({'where':{'id':_0x4a68b3['params']['id']},'include':[{'model':db[_0x790c('0x65')],'as':_0x790c('0x45')},{'model':db[_0x790c('0x46')],'as':_0x790c('0x47')},{'model':db[_0x790c('0x48')],'as':'mandatoryDispositionPause'}]})[_0x790c('0x27')](handleEntityNotFound(_0x5b8bf8,null))[_0x790c('0x27')](saveUpdates(_0x4a68b3[_0x790c('0x67')],null))[_0x790c('0x27')](function(_0x5493a2){if(_0x5493a2&&_0x4a68b3[_0x790c('0x67')][_0x790c('0x45')]){return db[_0x790c('0x65')][_0x790c('0x3c')](_0x4a68b3[_0x790c('0x67')][_0x790c('0x45')],{'where':{'MailAccountId':_0x5493a2['id']}})[_0x790c('0x27')](function(){return _0x5493a2;});}return _0x5493a2;})[_0x790c('0x27')](function(_0x4c1b9c){if(_0x4c1b9c&&_0x4a68b3[_0x790c('0x67')][_0x790c('0x47')]){return db[_0x790c('0x46')][_0x790c('0x3c')](_0x4a68b3[_0x790c('0x67')]['Smtp'],{'where':{'MailAccountId':_0x4c1b9c['id']}})[_0x790c('0x27')](function(){return _0x4c1b9c;});}return _0x4c1b9c;})[_0x790c('0x27')](respondWithResult(_0x5b8bf8,null))[_0x790c('0x31')](handleError(_0x5b8bf8,null));};exports['describe']=function(_0x4e1ece,_0x531022){return db[_0x790c('0x4b')][_0x790c('0x69')]()['then'](respondWithResult(_0x531022,null))[_0x790c('0x31')](handleError(_0x531022,null));};exports[_0x790c('0x6a')]=function(_0xfefa35,_0x2e782c,_0x2c6bcb){if(_0xfefa35['body']['id']){delete _0xfefa35[_0x790c('0x67')]['id'];}return db['MailAccount'][_0x790c('0x68')]({'where':{'id':_0xfefa35['params']['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x2e782c,null))[_0x790c('0x27')](function(_0xb7ee4a){if(_0xb7ee4a){_0xfefa35[_0x790c('0x67')][_0x790c('0x6b')]=_0xb7ee4a['id'];return db[_0x790c('0x6c')][_0x790c('0x6d')](_0xfefa35[_0x790c('0x67')]);}})[_0x790c('0x27')](respondWithResult(_0x2e782c,null))[_0x790c('0x31')](handleError(_0x2e782c,null));};exports[_0x790c('0x6e')]=function(_0x57f30e,_0x4b6933,_0x5a6e9a){var _0x344b6b={'raw':![],'where':{}};var _0x382db8={};var _0x558155={'count':0x0,'rows':[]};return db[_0x790c('0x4b')][_0x790c('0x6f')]({'where':{'id':_0x57f30e[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x4b6933,null))[_0x790c('0x27')](function(_0x31d46a){if(_0x31d46a){_0x382db8[_0x790c('0x4e')]=_[_0x790c('0x66')](db[_0x790c('0x6c')]['rawAttributes']);_0x382db8['query']=_['keys'](_0x57f30e[_0x790c('0x4f')]);_0x382db8[_0x790c('0x50')]=_[_0x790c('0x51')](_0x382db8[_0x790c('0x4e')],_0x382db8[_0x790c('0x4f')]);_0x344b6b[_0x790c('0x52')]=_[_0x790c('0x51')](_0x382db8[_0x790c('0x4e')],qs[_0x790c('0x53')](_0x57f30e[_0x790c('0x4f')]['fields']));_0x344b6b[_0x790c('0x52')]=_0x344b6b['attributes'][_0x790c('0x54')]?_0x344b6b[_0x790c('0x52')]:_0x382db8[_0x790c('0x4e')];if(!_0x57f30e[_0x790c('0x4f')][_0x790c('0x70')]('nolimit')){_0x344b6b[_0x790c('0x37')]=qs[_0x790c('0x37')](_0x57f30e[_0x790c('0x4f')][_0x790c('0x37')]);_0x344b6b['offset']=qs[_0x790c('0x36')](_0x57f30e[_0x790c('0x4f')]['offset']);}_0x344b6b[_0x790c('0x56')]=qs[_0x790c('0x57')](_0x57f30e[_0x790c('0x4f')][_0x790c('0x57')]);_0x344b6b[_0x790c('0x58')]=qs[_0x790c('0x50')](_[_0x790c('0x59')](_0x57f30e[_0x790c('0x4f')],_0x382db8[_0x790c('0x50')]));_0x344b6b[_0x790c('0x58')]['MailAccountId']=_0x31d46a['id'];if(_0x57f30e[_0x790c('0x4f')][_0x790c('0x5a')]){_0x344b6b[_0x790c('0x58')]=_[_0x790c('0x5b')](_0x344b6b['where'],{'$or':_[_0x790c('0x4a')](_0x344b6b[_0x790c('0x52')],function(_0x50b799){var _0x2f0cdc={};_0x2f0cdc[_0x50b799]={'$like':'%'+_0x57f30e['query']['filter']+'%'};return _0x2f0cdc;})});}_0x344b6b=_[_0x790c('0x5b')]({},_0x344b6b,_0x57f30e[_0x790c('0x5e')]);return db[_0x790c('0x6c')]['count']({'where':_0x344b6b[_0x790c('0x58')]})[_0x790c('0x27')](function(_0x544d5d){_0x558155[_0x790c('0x35')]=_0x544d5d;if(_0x57f30e['query'][_0x790c('0x5f')]){_0x344b6b['include']=[{'all':!![]}];}return db[_0x790c('0x6c')]['findAll'](_0x344b6b);})[_0x790c('0x27')](function(_0x409bc9){_0x558155[_0x790c('0x62')]=_0x409bc9;return _0x558155;});}})[_0x790c('0x27')](respondWithFilteredResult(_0x4b6933,_0x344b6b))[_0x790c('0x31')](handleError(_0x4b6933,null));};exports['removeDispositions']=function(_0xd16bbb,_0x1d4e07,_0x4be352){return db[_0x790c('0x4b')]['find']({'where':{'id':_0xd16bbb[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x1d4e07,null))[_0x790c('0x27')](function(_0x928f25){if(_0x928f25){return _0x928f25[_0x790c('0x71')](_0xd16bbb[_0x790c('0x4f')]['ids']);}})[_0x790c('0x27')](respondWithStatusCode(_0x1d4e07,null))[_0x790c('0x31')](handleError(_0x1d4e07,null));};exports[_0x790c('0x72')]=function(_0x11e55b,_0x46113e,_0x56a025){if(_0x11e55b[_0x790c('0x67')]['id']){delete _0x11e55b['body']['id'];}return db['MailAccount'][_0x790c('0x68')]({'where':{'id':_0x11e55b[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x46113e,null))[_0x790c('0x27')](function(_0x42b1b9){if(_0x42b1b9){_0x11e55b[_0x790c('0x67')]['MailAccountId']=_0x42b1b9['id'];return db[_0x790c('0x73')][_0x790c('0x6d')](_0x11e55b[_0x790c('0x67')]);}})[_0x790c('0x27')](respondWithResult(_0x46113e,null))[_0x790c('0x31')](handleError(_0x46113e,null));};exports[_0x790c('0x74')]=function(_0x48a923,_0x57fe1d,_0x20d1d5){var _0x49d19e={'raw':![],'where':{}};var _0x32f195={};var _0x10297e={'count':0x0,'rows':[]};return db[_0x790c('0x4b')][_0x790c('0x6f')]({'where':{'id':_0x48a923[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x57fe1d,null))['then'](function(_0x1b8da8){if(_0x1b8da8){_0x32f195[_0x790c('0x4e')]=_[_0x790c('0x66')](db[_0x790c('0x73')][_0x790c('0x4c')]);_0x32f195[_0x790c('0x4f')]=_[_0x790c('0x66')](_0x48a923['query']);_0x32f195[_0x790c('0x50')]=_[_0x790c('0x51')](_0x32f195[_0x790c('0x4e')],_0x32f195[_0x790c('0x4f')]);_0x49d19e['attributes']=_[_0x790c('0x51')](_0x32f195[_0x790c('0x4e')],qs[_0x790c('0x53')](_0x48a923[_0x790c('0x4f')][_0x790c('0x53')]));_0x49d19e[_0x790c('0x52')]=_0x49d19e[_0x790c('0x52')][_0x790c('0x54')]?_0x49d19e[_0x790c('0x52')]:_0x32f195['model'];if(!_0x48a923[_0x790c('0x4f')][_0x790c('0x70')]('nolimit')){_0x49d19e[_0x790c('0x37')]=qs[_0x790c('0x37')](_0x48a923[_0x790c('0x4f')][_0x790c('0x37')]);_0x49d19e['offset']=qs['offset'](_0x48a923[_0x790c('0x4f')][_0x790c('0x36')]);}_0x49d19e[_0x790c('0x56')]=qs[_0x790c('0x57')](_0x48a923[_0x790c('0x4f')][_0x790c('0x57')]);_0x49d19e[_0x790c('0x58')]=qs[_0x790c('0x50')](_[_0x790c('0x59')](_0x48a923[_0x790c('0x4f')],_0x32f195['filters']));_0x49d19e[_0x790c('0x58')][_0x790c('0x6b')]=_0x1b8da8['id'];if(_0x48a923[_0x790c('0x4f')][_0x790c('0x5a')]){_0x49d19e[_0x790c('0x58')]=_[_0x790c('0x5b')](_0x49d19e[_0x790c('0x58')],{'$or':_['map'](_0x49d19e[_0x790c('0x52')],function(_0x2190ae){var _0x32ec70={};_0x32ec70[_0x2190ae]={'$like':'%'+_0x48a923[_0x790c('0x4f')][_0x790c('0x5a')]+'%'};return _0x32ec70;})});}_0x49d19e=_[_0x790c('0x5b')]({},_0x49d19e,_0x48a923[_0x790c('0x5e')]);return db[_0x790c('0x73')]['count']({'where':_0x49d19e[_0x790c('0x58')]})['then'](function(_0x29d8c4){_0x10297e[_0x790c('0x35')]=_0x29d8c4;if(_0x48a923[_0x790c('0x4f')][_0x790c('0x5f')]){_0x49d19e[_0x790c('0x60')]=[{'all':!![]}];}return db[_0x790c('0x73')]['findAll'](_0x49d19e);})['then'](function(_0x244111){_0x10297e[_0x790c('0x62')]=_0x244111;return _0x10297e;});}})[_0x790c('0x27')](respondWithFilteredResult(_0x57fe1d,_0x49d19e))[_0x790c('0x31')](handleError(_0x57fe1d,null));};exports[_0x790c('0x75')]=function(_0x2a138c,_0x588db8,_0x49d772){return db[_0x790c('0x4b')][_0x790c('0x68')]({'where':{'id':_0x2a138c[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x588db8,null))[_0x790c('0x27')](function(_0x1e6542){if(_0x1e6542){return _0x1e6542[_0x790c('0x75')](_0x2a138c[_0x790c('0x4f')][_0x790c('0x76')]);}})['then'](respondWithStatusCode(_0x588db8,null))[_0x790c('0x31')](handleError(_0x588db8,null));};exports[_0x790c('0x6d')]=function(_0x4840ff,_0x4f0d21){var _0x3a98b9={'name':_0x4840ff['body'][_0x790c('0x42')],'key':_0x4840ff[_0x790c('0x67')][_0x790c('0x4d')],'email':_0x4840ff[_0x790c('0x67')][_0x790c('0x77')],'ListId':_0x4840ff[_0x790c('0x67')]['ListId'],'active':!_[_0x790c('0x78')](_0x4840ff['body'][_0x790c('0x79')])?_0x4840ff[_0x790c('0x67')][_0x790c('0x79')]:!![],'description':_0x4840ff['body'][_0x790c('0x7a')]||null,'Imap':{},'Smtp':{}};if(_[_0x790c('0x78')](_0x4840ff[_0x790c('0x67')]['cservice'])){if(_0x4840ff[_0x790c('0x67')]['cauthentication']){_0x3a98b9[_0x790c('0x45')][_0x790c('0x7b')]=_0x3a98b9['Smtp'][_0x790c('0x7b')]=_0x4840ff[_0x790c('0x67')]['cuser'];_0x3a98b9[_0x790c('0x45')][_0x790c('0x7c')]=_0x3a98b9['Smtp'][_0x790c('0x7d')]=_0x4840ff[_0x790c('0x67')]['cpassword'];}else{_0x3a98b9[_0x790c('0x45')][_0x790c('0x7e')]=_0x3a98b9['Smtp'][_0x790c('0x7e')]=![];}_0x3a98b9['Imap'][_0x790c('0x7f')]=_0x4840ff[_0x790c('0x67')][_0x790c('0x45')][_0x790c('0x7f')];_0x3a98b9['Imap'][_0x790c('0x80')]=_0x4840ff['body'][_0x790c('0x45')][_0x790c('0x80')];_0x3a98b9['Smtp']['host']=_0x4840ff['body'][_0x790c('0x47')]['host'];_0x3a98b9[_0x790c('0x47')][_0x790c('0x80')]=_0x4840ff[_0x790c('0x67')][_0x790c('0x47')][_0x790c('0x80')];}else{_0x3a98b9[_0x790c('0x45')]['service']=_0x3a98b9[_0x790c('0x47')][_0x790c('0x81')]=_0x4840ff[_0x790c('0x67')][_0x790c('0x82')];_0x3a98b9['Imap'][_0x790c('0x7b')]=_0x3a98b9[_0x790c('0x47')][_0x790c('0x7b')]=_0x4840ff[_0x790c('0x67')]['cuser'];_0x3a98b9['Imap'][_0x790c('0x7c')]=_0x3a98b9[_0x790c('0x47')]['pass']=_0x4840ff[_0x790c('0x67')][_0x790c('0x83')];}return db[_0x790c('0x4b')][_0x790c('0x6d')](_0x3a98b9,{'include':[{'model':db[_0x790c('0x46')],'as':'Smtp'},{'model':db[_0x790c('0x65')],'as':_0x790c('0x45')}]})[_0x790c('0x27')](function(_0x52616e){var _0x43fffc=_0x4840ff[_0x790c('0x7b')][_0x790c('0x3e')]({'plain':!![]});if(!_0x43fffc)throw new Error(_0x790c('0x84'));if(_0x43fffc[_0x790c('0x85')]===_0x790c('0x7b')){var _0x4909d4=_0x52616e[_0x790c('0x3e')]({'plain':!![]});return db[_0x790c('0x86')][_0x790c('0x68')]({'where':{'name':'MailAccounts','userProfileId':_0x43fffc[_0x790c('0x87')]},'raw':!![]})['then'](function(_0x4901b9){if(_0x4901b9&&_0x4901b9[_0x790c('0x88')]===0x0){return db[_0x790c('0x40')][_0x790c('0x6d')]({'name':_0x4909d4['name'],'resourceId':_0x4909d4['id'],'type':_0x4901b9[_0x790c('0x42')],'sectionId':_0x4901b9['id']},{})['then'](function(){return _0x52616e;});}else{return _0x52616e;}})[_0x790c('0x31')](function(_0x1e0460){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e0460);throw _0x1e0460;});}return _0x52616e;})[_0x790c('0x27')](respondWithResult(_0x4f0d21,0xc9))[_0x790c('0x31')](handleError(_0x4f0d21,null));};exports[_0x790c('0x89')]=function(_0x2b16ff,_0x585813,_0xb98604){return db[_0x790c('0x4b')]['findOne']({'where':{'id':_0x2b16ff[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x585813,null))[_0x790c('0x27')](function(_0x1df7c2){if(_0x1df7c2){return _0x1df7c2[_0x790c('0x89')]();}return null;})[_0x790c('0x27')](respondWithResult(_0x585813,null))[_0x790c('0x31')](handleError(_0x585813,null));};exports[_0x790c('0x8a')]=function(_0xd8703d,_0xe3dfad,_0x29b40c){if(_0xd8703d[_0x790c('0x67')]['id']){delete _0xd8703d[_0x790c('0x67')]['id'];}return db['MailAccount'][_0x790c('0x68')]({'where':{'id':_0xd8703d[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0xe3dfad,null))[_0x790c('0x27')](function(_0x1ede1e){if(_0x1ede1e){_0xd8703d[_0x790c('0x67')]['MailAccountId']=_0x1ede1e['id'];return db[_0x790c('0x65')]['create'](_0xd8703d[_0x790c('0x67')]);}})['then'](respondWithResult(_0xe3dfad,null))[_0x790c('0x31')](handleError(_0xe3dfad,null));};exports[_0x790c('0x8b')]=function(_0x5a4559,_0x262ed6,_0xaaa9a6){return db[_0x790c('0x4b')][_0x790c('0x6f')]({'where':{'id':_0x5a4559[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x262ed6,null))[_0x790c('0x27')](function(_0xdde1f0){if(_0xdde1f0){return _0xdde1f0[_0x790c('0x8c')](null);}return null;})[_0x790c('0x27')](respondWithStatusCode(_0x262ed6,null))[_0x790c('0x31')](handleError(_0x262ed6,null));};exports[_0x790c('0x8d')]=function(_0x3f5e3c,_0x4efa07,_0x34d513){return db['MailAccount']['findOne']({'where':{'id':_0x3f5e3c[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x4efa07,null))[_0x790c('0x27')](function(_0x22e201){if(_0x22e201){return _0x22e201[_0x790c('0x8d')]();}return null;})['then'](respondWithResult(_0x4efa07,null))[_0x790c('0x31')](handleError(_0x4efa07,null));};exports[_0x790c('0x8e')]=function(_0x4c6b33,_0x4f4dfc,_0x8053d8){if(_0x4c6b33[_0x790c('0x67')]['id']){delete _0x4c6b33['body']['id'];}return db[_0x790c('0x4b')][_0x790c('0x68')]({'where':{'id':_0x4c6b33[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x4f4dfc,null))[_0x790c('0x27')](function(_0x3028ce){if(_0x3028ce){_0x4c6b33[_0x790c('0x67')][_0x790c('0x6b')]=_0x3028ce['id'];return db[_0x790c('0x46')]['create'](_0x4c6b33[_0x790c('0x67')]);}})[_0x790c('0x27')](respondWithResult(_0x4f4dfc,null))['catch'](handleError(_0x4f4dfc,null));};exports['removeSmtp']=function(_0x258360,_0x340d34,_0x66dab1){return db[_0x790c('0x4b')][_0x790c('0x6f')]({'where':{'id':_0x258360[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x340d34,null))[_0x790c('0x27')](function(_0x1a32e1){if(_0x1a32e1){return _0x1a32e1['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x340d34,null))[_0x790c('0x31')](handleError(_0x340d34,null));};exports['addInteraction']=function(_0x5c76d4,_0x1b51a8,_0x396c49){return db[_0x790c('0x8f')][_0x790c('0x68')]({'where':{'id':_0x5c76d4[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x1b51a8,null))['then'](function(_0x40450f){if(_0x40450f){return _0x40450f['addInteraction'](_0x5c76d4[_0x790c('0x67')][_0x790c('0x76')],_[_0x790c('0x90')](_0x5c76d4[_0x790c('0x67')],[_0x790c('0x76'),'id'])||{});}})[_0x790c('0x27')](respondWithResult(_0x1b51a8,null))[_0x790c('0x31')](handleError(_0x1b51a8,null));};exports['getInteractions']=function(_0x1568ac,_0x1e76d4,_0x261da3){var _0x2e786c={'raw':![],'where':{}};var _0x5162ea={};var _0x17ef4f={'count':0x0,'rows':[]};return db[_0x790c('0x4b')][_0x790c('0x6f')]({'where':{'id':_0x1568ac[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x1e76d4,null))['then'](function(_0x3c525d){if(_0x3c525d){_0x5162ea[_0x790c('0x4e')]=_[_0x790c('0x66')](db[_0x790c('0x8f')][_0x790c('0x4c')]);_0x5162ea[_0x790c('0x4f')]=_[_0x790c('0x66')](_0x1568ac['query']);_0x5162ea[_0x790c('0x50')]=_['intersection'](_0x5162ea[_0x790c('0x4e')],_0x5162ea['query']);_0x2e786c[_0x790c('0x52')]=_[_0x790c('0x51')](_0x5162ea[_0x790c('0x4e')],qs[_0x790c('0x53')](_0x1568ac[_0x790c('0x4f')][_0x790c('0x53')]));_0x2e786c['attributes']=_0x2e786c[_0x790c('0x52')]['length']?_0x2e786c[_0x790c('0x52')]:_0x5162ea[_0x790c('0x4e')];if(!_0x1568ac['query']['hasOwnProperty'](_0x790c('0x55'))){_0x2e786c[_0x790c('0x37')]=qs[_0x790c('0x37')](_0x1568ac['query']['limit']);_0x2e786c[_0x790c('0x36')]=qs['offset'](_0x1568ac[_0x790c('0x4f')]['offset']);}_0x2e786c['order']=qs[_0x790c('0x57')](_0x1568ac[_0x790c('0x4f')][_0x790c('0x57')]);_0x2e786c[_0x790c('0x58')]=qs[_0x790c('0x50')](_['pick'](_0x1568ac[_0x790c('0x4f')],_0x5162ea[_0x790c('0x50')]));_0x2e786c[_0x790c('0x58')][_0x790c('0x6b')]=_0x3c525d['id'];if(_0x1568ac['query'][_0x790c('0x5a')]){_0x2e786c['where']=_['merge'](_0x2e786c[_0x790c('0x58')],{'$or':_[_0x790c('0x4a')](_0x2e786c['attributes'],function(_0x1a2b00){var _0x3d6fb4={};_0x3d6fb4[_0x1a2b00]={'$like':'%'+_0x1568ac[_0x790c('0x4f')][_0x790c('0x5a')]+'%'};return _0x3d6fb4;})});}_0x2e786c=_[_0x790c('0x5b')]({},_0x2e786c,_0x1568ac[_0x790c('0x5e')]);return db[_0x790c('0x8f')][_0x790c('0x35')]({'where':_0x2e786c[_0x790c('0x58')]})[_0x790c('0x27')](function(_0x2d2841){_0x17ef4f[_0x790c('0x35')]=_0x2d2841;if(_0x1568ac[_0x790c('0x4f')][_0x790c('0x5f')]){_0x2e786c[_0x790c('0x60')]=[{'model':db[_0x790c('0x91')],'as':'Contact','required':![]},{'model':db[_0x790c('0x92')],'as':_0x790c('0x93'),'attributes':[_0x790c('0x42'),_0x790c('0x94'),'internal'],'required':![]},{'model':db[_0x790c('0x95')],'as':_0x790c('0x96'),'attributes':['id',_0x790c('0x42'),_0x790c('0x97')],'where':_0x1568ac[_0x790c('0x4f')][_0x790c('0x98')]?{'id':_0x1568ac[_0x790c('0x4f')][_0x790c('0x98')]}:undefined,'required':_0x1568ac[_0x790c('0x4f')]['tag']?!![]:![]}];}return db[_0x790c('0x8f')][_0x790c('0x61')](_0x2e786c);})[_0x790c('0x27')](function(_0x2af4bc){_0x17ef4f[_0x790c('0x62')]=_0x2af4bc;return _0x17ef4f;});}})[_0x790c('0x27')](respondWithFilteredResult(_0x1e76d4,_0x2e786c))['catch'](handleError(_0x1e76d4,null));};exports[_0x790c('0x99')]=function(_0x832b28,_0x1db39d,_0x52cca9){return db['MailAccount']['findOne']({'where':{'id':_0x832b28[_0x790c('0x64')]['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x1db39d,null))[_0x790c('0x27')](function(_0x4f0a0b){if(_0x4f0a0b){return db[_0x790c('0x9a')][_0x790c('0x9b')](function(_0x7a82d8){return db[_0x790c('0x9c')][_0x790c('0x3d')]({'where':{'MailAccountId':_0x832b28[_0x790c('0x64')]['id']},'transaction':_0x7a82d8})['then'](function(_0x4636c4){var _0x496583=_['map'](_0x832b28[_0x790c('0x67')],function(_0x2fc6dc){_0x2fc6dc[_0x790c('0x6b')]=_0x832b28[_0x790c('0x64')]['id'];return _0x2fc6dc;});return db['MailApplication'][_0x790c('0x9d')](_0x496583,{'transaction':_0x7a82d8});});})[_0x790c('0x27')](function(){return db[_0x790c('0x9c')][_0x790c('0x9e')]({'where':{'MailAccountId':_0x832b28[_0x790c('0x64')]['id']},'order':_0x790c('0x9f')});});}})['then'](respondWithResult(_0x1db39d,null))[_0x790c('0x31')](handleError(_0x1db39d,null));};exports['getApplications']=function(_0xc51082,_0x5256f5,_0x360937){var _0x18c20e={};var _0x50db1f={};var _0x1073c3;var _0x3dcd2b;return db[_0x790c('0x4b')]['findOne']({'where':{'id':_0xc51082['params']['id']}})['then'](handleEntityNotFound(_0x5256f5,null))[_0x790c('0x27')](function(_0x21a1f8){if(_0x21a1f8){_0x1073c3=_0x21a1f8;_0x50db1f['model']=_[_0x790c('0x66')](db[_0x790c('0x9c')][_0x790c('0x4c')]);_0x50db1f[_0x790c('0x4f')]=_[_0x790c('0x66')](_0xc51082[_0x790c('0x4f')]);_0x50db1f['filters']=_[_0x790c('0x51')](_0x50db1f[_0x790c('0x4e')],_0x50db1f[_0x790c('0x4f')]);_0x18c20e[_0x790c('0x52')]=_[_0x790c('0x51')](_0x50db1f[_0x790c('0x4e')],qs['fields'](_0xc51082['query'][_0x790c('0x53')]));_0x18c20e[_0x790c('0x52')]=_0x18c20e[_0x790c('0x52')][_0x790c('0x54')]?_0x18c20e['attributes']:_0x50db1f['model'];_0x18c20e[_0x790c('0x56')]=qs[_0x790c('0x57')](_0xc51082['query'][_0x790c('0x57')]);_0x18c20e[_0x790c('0x58')]=qs['filters'](_[_0x790c('0x59')](_0xc51082[_0x790c('0x4f')],_0x50db1f[_0x790c('0x50')]));if(_0xc51082[_0x790c('0x4f')][_0x790c('0x5a')]){_0x18c20e[_0x790c('0x58')]=_['merge'](_0x18c20e[_0x790c('0x58')],{'$or':_[_0x790c('0x4a')](_0x18c20e[_0x790c('0x52')],function(_0x20bf4e){var _0x41a5ed={};_0x41a5ed[_0x20bf4e]={'$like':'%'+_0xc51082[_0x790c('0x4f')][_0x790c('0x5a')]+'%'};return _0x41a5ed;})});}_0x18c20e=_['merge']({},_0x18c20e,_0xc51082[_0x790c('0x5e')]);return _0x1073c3[_0x790c('0xa0')](_0x18c20e);}})['then'](function(_0x5bb18c){if(_0x5bb18c){_0x3dcd2b=_0x5bb18c[_0x790c('0x54')];if(!_0xc51082[_0x790c('0x4f')][_0x790c('0x70')]('nolimit')){_0x18c20e['limit']=qs['limit'](_0xc51082[_0x790c('0x4f')][_0x790c('0x37')]);_0x18c20e[_0x790c('0x36')]=qs[_0x790c('0x36')](_0xc51082['query'][_0x790c('0x36')]);}return _0x1073c3[_0x790c('0xa0')](_0x18c20e);}})['then'](function(_0x3eab5d){if(_0x3eab5d){return _0x3eab5d?{'count':_0x3dcd2b,'rows':_0x3eab5d}:null;}})[_0x790c('0x27')](respondWithResult(_0x5256f5,null))[_0x790c('0x31')](handleError(_0x5256f5,null));};exports[_0x790c('0xa1')]=function(_0x2fb059,_0x3e9b52,_0x4294d0){var _0x15f435={'raw':!![],'where':{}};var _0x18b11a={};var _0x3fa63a={'count':0x0,'rows':[]};return db[_0x790c('0x4b')]['findOne']({'where':{'id':_0x2fb059[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x3e9b52,null))[_0x790c('0x27')](function(_0x3d5596){if(_0x3d5596){_0x18b11a[_0x790c('0x4e')]=_[_0x790c('0x66')](db[_0x790c('0xa2')]['rawAttributes']);_0x18b11a[_0x790c('0x4f')]=_[_0x790c('0x66')](_0x2fb059[_0x790c('0x4f')]);_0x18b11a[_0x790c('0x50')]=_[_0x790c('0x51')](_0x18b11a[_0x790c('0x4e')],_0x18b11a[_0x790c('0x4f')]);_0x15f435[_0x790c('0x52')]=_[_0x790c('0x51')](_0x18b11a[_0x790c('0x4e')],qs['fields'](_0x2fb059[_0x790c('0x4f')]['fields']));_0x15f435['attributes']=_0x15f435['attributes'][_0x790c('0x54')]?_0x15f435['attributes']:_0x18b11a[_0x790c('0x4e')];if(!_0x2fb059[_0x790c('0x4f')][_0x790c('0x70')]('nolimit')){_0x15f435[_0x790c('0x37')]=qs[_0x790c('0x37')](_0x2fb059['query']['limit']);_0x15f435[_0x790c('0x36')]=qs['offset'](_0x2fb059[_0x790c('0x4f')][_0x790c('0x36')]);}_0x15f435['order']=qs[_0x790c('0x57')](_0x2fb059['query']['sort']);_0x15f435[_0x790c('0x58')]=qs['filters'](_[_0x790c('0x59')](_0x2fb059[_0x790c('0x4f')],_0x18b11a[_0x790c('0x50')]));_0x15f435[_0x790c('0x58')][_0x790c('0x6b')]=_0x3d5596['id'];if(_0x2fb059[_0x790c('0x4f')]['filter']){_0x15f435[_0x790c('0x58')]=_[_0x790c('0x5b')](_0x15f435[_0x790c('0x58')],{'$or':_[_0x790c('0x4a')](_0x15f435[_0x790c('0x52')],function(_0xf6da6e){var _0x591b6f={};_0x591b6f[_0xf6da6e]={'$like':'%'+_0x2fb059[_0x790c('0x4f')]['filter']+'%'};return _0x591b6f;})});}if(_0x2fb059[_0x790c('0x4f')][_0x790c('0xa3')]){var _0x14aedd=_0x2fb059[_0x790c('0x4f')][_0x790c('0xa3')][_0x790c('0xa4')](',');var _0x562aea={};_0x562aea[_0x14aedd[0x0]]={'$gte':moment(_0x14aedd[0x1])[_0x790c('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15f435['where']=_[_0x790c('0x5b')](_0x15f435[_0x790c('0x58')],_0x562aea);}_0x15f435=_[_0x790c('0x5b')]({},_0x15f435,_0x2fb059['options']);return db[_0x790c('0xa2')][_0x790c('0x35')]({'where':_0x15f435[_0x790c('0x58')]})[_0x790c('0x27')](function(_0x2a7751){_0x3fa63a[_0x790c('0x35')]=_0x2a7751;if(_0x2fb059[_0x790c('0x4f')][_0x790c('0x5f')]){_0x15f435['include']=[{'all':!![]}];}return db[_0x790c('0xa2')][_0x790c('0x61')](_0x15f435);})[_0x790c('0x27')](function(_0x1eb3fc){if(_0x2fb059['query'][_0x790c('0xa6')]==='true'){for(var _0x388360=0x0;_0x388360<_0x1eb3fc['length'];_0x388360++){_0x1eb3fc[_0x388360][_0x790c('0x67')]=juice(_0x1eb3fc[_0x388360][_0x790c('0x67')]);}}_0x3fa63a[_0x790c('0x62')]=_0x1eb3fc;return _0x3fa63a;});}})[_0x790c('0x27')](respondWithFilteredResult(_0x3e9b52,_0x15f435))[_0x790c('0x31')](handleError(_0x3e9b52,null));};exports['send']=function(_0x53aab6,_0x46ebfa,_0x38fdca){var _0x366b58,_0x24c5f9={},_0x1fc983;if(_0x53aab6[_0x790c('0x67')]['to']){_0x1fc983=_0x53aab6['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x790c('0x68')]({'where':{'id':_0x53aab6['params']['id']},'include':[{'model':db[_0x790c('0xa7')],'as':_0x790c('0xa8'),'include':[{'model':db[_0x790c('0x91')],'as':_0x790c('0xa9'),'where':{'email':_0x1fc983},'limit':0x1,'order':[[_0x790c('0xaa'),_0x790c('0xab')]]}]},{'model':db[_0x790c('0x46')],'as':_0x790c('0x47'),'raw':!![]}]})['then'](handleEntityNotFound(_0x46ebfa,null))['then'](function(_0x1b3483){if(_0x1b3483){_0x366b58=_0x1b3483;if(_0x1b3483['Smtp']){if(_['isNil'](_0x53aab6['body'][_0x790c('0xac')])){_0x53aab6['body']['from']=util[_0x790c('0xa5')](_0x790c('0xad'),_0x1b3483[_0x790c('0x42')],_0x1b3483[_0x790c('0x77')]||_0x1b3483[_0x790c('0x47')][_0x790c('0x7b')]);}if(_0x53aab6[_0x790c('0x67')][_0x790c('0xae')]&&_0x53aab6[_0x790c('0x67')][_0x790c('0xae')][_0x790c('0x54')]){for(var _0x209a7a=0x0;_0x209a7a<_0x53aab6['body']['attachments'][_0x790c('0x54')];_0x209a7a+=0x1){_0x53aab6[_0x790c('0x67')]['attachments'][_0x209a7a]={'filename':_0x53aab6['body'][_0x790c('0xae')][_0x209a7a]['name'],'path':path['join'](config['root'],_0x790c('0xaf'),_0x53aab6[_0x790c('0x67')]['attachments'][_0x209a7a][_0x790c('0xb0')])};}}var _0x1cb073={'tls':{'rejectUnauthorized':![]}};if(_[_0x790c('0x78')](_0x1b3483['Smtp']['service'])){if(_0x1b3483[_0x790c('0x47')][_0x790c('0x7e')]){_0x1cb073[_0x790c('0xb1')]={'user':_0x1b3483[_0x790c('0x47')][_0x790c('0x7b')],'pass':_0x1b3483[_0x790c('0x47')]['pass']};}_0x1cb073[_0x790c('0x7f')]=_0x1b3483[_0x790c('0x47')][_0x790c('0x7f')];_0x1cb073[_0x790c('0x80')]=_0x1b3483[_0x790c('0x47')]['port'];_0x1cb073[_0x790c('0xb2')]=_0x1b3483[_0x790c('0x47')][_0x790c('0xb2')];}else{_0x1cb073[_0x790c('0x81')]=_0x1b3483['Smtp'][_0x790c('0x81')];_0x1cb073[_0x790c('0xb1')]={'user':_0x1b3483[_0x790c('0x47')][_0x790c('0x7b')],'pass':_0x1b3483[_0x790c('0x47')]['pass']};}return respondWithRpcPromise(_0x790c('0xb3'),_0x790c('0xb4'),{'account':_0x1cb073,'message':_0x53aab6[_0x790c('0x67')]});}else{throw new Error(_0x790c('0xb5'));}}})[_0x790c('0x27')](function(_0x1a08fc){if(_0x1a08fc){_0x24c5f9=_0x1a08fc;if(_0x366b58[_0x790c('0xa8')]){if(_0x366b58[_0x790c('0xa8')]['Contacts'][_0x790c('0x54')]){return _0x366b58[_0x790c('0xa8')][_0x790c('0xa9')][0x0];}else{return db[_0x790c('0x91')][_0x790c('0x6d')](_[_0x790c('0xb6')](_0x53aab6[_0x790c('0x67')],{'firstName':_0x53aab6[_0x790c('0x67')]['to'],'email':_0x53aab6[_0x790c('0x67')]['to'],'phone':_0x53aab6['body']['to'],'ListId':_0x366b58[_0x790c('0xb7')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x790c('0x27')](function(_0x2ca0fc){if(_0x2ca0fc){var _0x3b5a63={'UserId':_0x53aab6['user']['id'],'ContactId':_0x2ca0fc['id'],'MailAccountId':_0x366b58['id'],'inReplyTo':_0x24c5f9[_0x790c('0xb8')],'to':_0x53aab6[_0x790c('0x67')]['from'],'cc':_0x53aab6[_0x790c('0x67')]['cc'],'subject':_0x53aab6[_0x790c('0x67')][_0x790c('0xb9')],'attach':_0x53aab6[_0x790c('0x67')]['attach'],'firstMsgDirection':_0x790c('0xba'),'lastMsgAt':moment()[_0x790c('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0x53aab6['body']['body'],'Messages':[_[_0x790c('0x5b')](_0x53aab6['body'],{'messageId':_0x24c5f9[_0x790c('0xb8')],'sentAt':moment()[_0x790c('0xa5')](_0x790c('0xbb')),'read':!![],'MailAccountId':_0x366b58['id'],'UserId':_0x53aab6[_0x790c('0x7b')]['id'],'ContactId':_0x2ca0fc['id']})]};if(_0x53aab6[_0x790c('0x67')][_0x790c('0xbc')]){_0x3b5a63=_[_0x790c('0x5b')](_0x3b5a63,_0x53aab6['body']['Interaction']);}return db[_0x790c('0x8f')][_0x790c('0x6d')](_0x3b5a63,{'include':[{'model':db[_0x790c('0xa2')],'as':_0x790c('0xbd')}]});}})[_0x790c('0x27')](respondWithResult(_0x46ebfa,null))[_0x790c('0x31')](handleError(_0x46ebfa,null));};exports[_0x790c('0xbe')]=function(_0x6faf30,_0x685b92,_0x1c34f8){return db[_0x790c('0x4b')]['find']({'where':{'id':_0x6faf30[_0x790c('0x64')]['id']},'include':[{'model':db[_0x790c('0x46')],'as':_0x790c('0x47'),'raw':!![]}]})[_0x790c('0x27')](handleEntityNotFound(_0x685b92,null))[_0x790c('0x27')](function(_0x527d13){if(_0x527d13&&_0x527d13[_0x790c('0x47')]){var _0x3a4e7a={'id':_0x527d13['id'],'tls':{'rejectUnauthorized':![]}};if(_0x527d13[_0x790c('0x47')][_0x790c('0x81')]){_0x3a4e7a['service']=_0x527d13[_0x790c('0x47')][_0x790c('0x81')];}else{_0x3a4e7a['host']=_0x527d13[_0x790c('0x47')]['host'];_0x3a4e7a['port']=_0x527d13['Smtp'][_0x790c('0x80')];_0x3a4e7a[_0x790c('0xb2')]=_0x527d13[_0x790c('0x47')][_0x790c('0xb2')];}if(_0x527d13['Smtp']['authentication']){_0x3a4e7a[_0x790c('0xb1')]={'user':_0x527d13[_0x790c('0x47')]['user'],'pass':_0x527d13[_0x790c('0x47')]['pass']};}return respondWithRpcPromise(_0x790c('0xbf'),'verifySmtp',{'account':_0x3a4e7a});}})[_0x790c('0x27')](respondWithResult(_0x685b92,null))[_0x790c('0x31')](handleError(_0x685b92,null));};exports[_0x790c('0x3d')]=function(_0x212af5,_0x39044a){return db[_0x790c('0x4b')][_0x790c('0x68')]({'where':{'id':_0x212af5[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x39044a,null))['then'](function(_0x5e13db){if(_0x5e13db&&_0x5e13db[_0x790c('0x81')]){throw new db[(_0x790c('0xc0'))][(_0x790c('0xc1'))](_0x790c('0xc2'));}return _0x5e13db;})[_0x790c('0x27')](removeEntity(_0x39044a,null))[_0x790c('0x31')](handleError(_0x39044a,null));};exports[_0x790c('0xc3')]=function(_0xeeeb9b,_0x4c0adc,_0x5b9535){return db['MailAccount'][_0x790c('0x68')]({'where':{'id':_0xeeeb9b['params']['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x4c0adc,null))['then'](function(_0x57bc4e){if(_0x57bc4e){return _0x57bc4e[_0x790c('0xc3')](_0xeeeb9b[_0x790c('0x67')][_0x790c('0x76')],_[_0x790c('0x90')](_0xeeeb9b['body'],[_0x790c('0x76'),'id'])||{})[_0x790c('0xc4')](function(_0x1e47ce){for(var _0x3a8c8f=0x0;_0x3a8c8f<_0xeeeb9b[_0x790c('0x67')]['ids'][_0x790c('0x54')];_0x3a8c8f+=0x1){socket[_0x790c('0xc5')]('userMailAccount:save',{'UserId':_0xeeeb9b[_0x790c('0x67')][_0x790c('0x76')][_0x3a8c8f],'MailAccountId':_0xeeeb9b[_0x790c('0x64')]['id']});}return _0x1e47ce;});}})[_0x790c('0x27')](respondWithResult(_0x4c0adc,null))[_0x790c('0x31')](handleError(_0x4c0adc,null));};exports[_0x790c('0xc6')]=function(_0x37fde0,_0x237634,_0x1d2d54){return db[_0x790c('0x4b')]['find']({'where':{'id':_0x37fde0['params']['id']}})[_0x790c('0x27')](handleEntityNotFound(_0x237634,null))['then'](function(_0xe3fb66){if(_0xe3fb66){return _0xe3fb66[_0x790c('0xc6')](_0x37fde0['query'][_0x790c('0x76')])[_0x790c('0x27')](function(){if(_[_0x790c('0xc7')](_0x37fde0[_0x790c('0x4f')][_0x790c('0x76')])){for(var _0x283269=0x0;_0x283269<_0x37fde0[_0x790c('0x4f')][_0x790c('0x76')][_0x790c('0x54')];_0x283269+=0x1){socket[_0x790c('0xc5')](_0x790c('0xc8'),{'UserId':Number(_0x37fde0[_0x790c('0x4f')][_0x790c('0x76')][_0x283269]),'MailAccountId':Number(_0x37fde0[_0x790c('0x64')]['id'])});}}else{socket['emit'](_0x790c('0xc8'),{'UserId':Number(_0x37fde0[_0x790c('0x4f')][_0x790c('0x76')]),'MailAccountId':Number(_0x37fde0[_0x790c('0x64')]['id'])});}});}})[_0x790c('0x27')](respondWithStatusCode(_0x237634,null))[_0x790c('0x31')](handleError(_0x237634,null));};exports['getAgents']=function(_0x58ffb1,_0x47b6ae,_0x6c9d50){var _0x541c4b={};var _0x72cae3={};var _0x3a21bc;var _0x26042c;return db[_0x790c('0x4b')][_0x790c('0x6f')]({'where':{'id':_0x58ffb1[_0x790c('0x64')]['id']}})['then'](handleEntityNotFound(_0x47b6ae,null))[_0x790c('0x27')](function(_0x52b774){if(_0x52b774){_0x3a21bc=_0x52b774;_0x72cae3[_0x790c('0x4e')]=_[_0x790c('0x66')](db[_0x790c('0x92')][_0x790c('0x4c')]);_0x72cae3[_0x790c('0x4f')]=_[_0x790c('0x66')](_0x58ffb1[_0x790c('0x4f')]);_0x72cae3[_0x790c('0x50')]=_['intersection'](_0x72cae3[_0x790c('0x4e')],_0x72cae3['query']);_0x541c4b[_0x790c('0x52')]=_['intersection'](_0x72cae3[_0x790c('0x4e')],qs[_0x790c('0x53')](_0x58ffb1[_0x790c('0x4f')][_0x790c('0x53')]));_0x541c4b['attributes']=_0x541c4b[_0x790c('0x52')][_0x790c('0x54')]?_0x541c4b[_0x790c('0x52')]:_0x72cae3[_0x790c('0x4e')];_0x541c4b[_0x790c('0x56')]=qs[_0x790c('0x57')](_0x58ffb1[_0x790c('0x4f')][_0x790c('0x57')]);_0x541c4b['where']=qs[_0x790c('0x50')](_[_0x790c('0x59')](_0x58ffb1[_0x790c('0x4f')],_0x72cae3['filters']));if(_0x58ffb1['query'][_0x790c('0x5a')]){_0x541c4b[_0x790c('0x58')]=_[_0x790c('0x5b')](_0x541c4b[_0x790c('0x58')],{'$or':_[_0x790c('0x4a')](_0x541c4b[_0x790c('0x52')],function(_0x25b17e){var _0x5bac28={};_0x5bac28[_0x25b17e]={'$like':'%'+_0x58ffb1['query'][_0x790c('0x5a')]+'%'};return _0x5bac28;})});}_0x541c4b=_[_0x790c('0x5b')]({},_0x541c4b,_0x58ffb1['options']);return _0x3a21bc[_0x790c('0xc9')](_0x541c4b);}})[_0x790c('0x27')](function(_0x8c67b2){if(_0x8c67b2){_0x26042c=_0x8c67b2[_0x790c('0x54')];if(!_0x58ffb1[_0x790c('0x4f')][_0x790c('0x70')](_0x790c('0x55'))){_0x541c4b[_0x790c('0x37')]=qs[_0x790c('0x37')](_0x58ffb1['query'][_0x790c('0x37')]);_0x541c4b[_0x790c('0x36')]=qs[_0x790c('0x36')](_0x58ffb1[_0x790c('0x4f')]['offset']);}return _0x3a21bc['getAgents'](_0x541c4b);}})['then'](function(_0x52ed1c){if(_0x52ed1c){return _0x52ed1c?{'count':_0x26042c,'rows':_0x52ed1c}:null;}})[_0x790c('0x27')](respondWithResult(_0x47b6ae,null))[_0x790c('0x31')](handleError(_0x47b6ae,null));}; \ No newline at end of file +var _0xdb57=['order','removeAnswers','email','isNil','active','description','cservice','user','cpassword','authentication','host','port','service','cuser','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','ids','omit','MailInteraction','CmContact','Contact','User','fullname','Tag','Tags','color','tag','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','pass','secure','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','reject','save','update','destroy','get','MailAccounts','end','stack','name','send','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','count','include','findAll','rows','show','Imap','keys','includeAll','find','body','params','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','removeDispositions','getAnswers','CannedAnswer'];(function(_0xe02eb6,_0x19757b){var _0x13643b=function(_0x13565d){while(--_0x13565d){_0xe02eb6['push'](_0xe02eb6['shift']());}};_0x13643b(++_0x19757b);}(_0xdb57,0x11c));var _0x7db5=function(_0x69f3fa,_0x2d749a){_0x69f3fa=_0x69f3fa-0x0;var _0xd24408=_0xdb57[_0x69f3fa];return _0xd24408;};'use strict';var pdf=require(_0x7db5('0x0'));var emlformat=require(_0x7db5('0x1'));var rimraf=require(_0x7db5('0x2'));var zipdir=require(_0x7db5('0x3'));var jsonpatch=require(_0x7db5('0x4'));var rp=require('request-promise');var moment=require(_0x7db5('0x5'));var BPromise=require(_0x7db5('0x6'));var Mustache=require(_0x7db5('0x7'));var util=require(_0x7db5('0x8'));var path=require('path');var sox=require(_0x7db5('0x9'));var csv=require('to-csv');var ejs=require(_0x7db5('0xa'));var fs=require('fs');var _=require(_0x7db5('0xb'));var squel=require(_0x7db5('0xc'));var crypto=require('crypto');var jsforce=require(_0x7db5('0xd'));var deskjs=require(_0x7db5('0xe'));var toCsv=require(_0x7db5('0xf'));var querystring=require(_0x7db5('0x10'));var Papa=require('papaparse');var htmlToText=require(_0x7db5('0x11'));var juice=require(_0x7db5('0x12'));var Redis=require(_0x7db5('0x13'));var authService=require(_0x7db5('0x14'));var qs=require(_0x7db5('0x15'));var as=require(_0x7db5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7db5('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7db5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7db5('0x19'))['db'];config[_0x7db5('0x1a')]=_[_0x7db5('0x1b')](config[_0x7db5('0x1a')],{'host':_0x7db5('0x1c'),'port':0x18eb});var socket=require(_0x7db5('0x1d'))(new Redis(config[_0x7db5('0x1a')]));require(_0x7db5('0x1e'))[_0x7db5('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7db5('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x1104b3,_0xabc5b2,_0x3d1799,_0x4cedc3){return new BPromise(function(_0x6de984,_0x24dbe5){var _0xa33988=_0x4cedc3||client;return _0xa33988[_0x7db5('0x21')](_0x1104b3,_0x3d1799)[_0x7db5('0x22')](function(_0x95e217){logger[_0x7db5('0x23')](_0x7db5('0x24'),_0xabc5b2,_0x7db5('0x25'));logger[_0x7db5('0x26')](_0x7db5('0x27'),_0xabc5b2,_0x7db5('0x25'),JSON['stringify'](_0x95e217));if(_0x95e217[_0x7db5('0x28')]){if(_0x95e217[_0x7db5('0x28')][_0x7db5('0x29')]===0x1f4){logger[_0x7db5('0x28')](_0x7db5('0x24'),_0xabc5b2,_0x95e217[_0x7db5('0x28')][_0x7db5('0x2a')]);return _0x24dbe5(_0x95e217[_0x7db5('0x28')][_0x7db5('0x2a')]);}logger[_0x7db5('0x28')]('MailAccount,\x20%s,\x20%s',_0xabc5b2,_0x95e217['error'][_0x7db5('0x2a')]);return _0x6de984(_0x95e217[_0x7db5('0x28')][_0x7db5('0x2a')]);}else{logger[_0x7db5('0x23')]('MailAccount,\x20%s,\x20%s',_0xabc5b2,_0x7db5('0x25'));_0x6de984(_0x95e217[_0x7db5('0x2b')][_0x7db5('0x2a')]);}})[_0x7db5('0x2c')](function(_0x5d819d){logger[_0x7db5('0x28')](_0x7db5('0x24'),_0xabc5b2,_0x5d819d);_0x24dbe5(_0x5d819d);});});}function respondWithStatusCode(_0x4346f3,_0x5c2834){_0x5c2834=_0x5c2834||0xcc;return function(_0x3b484d){if(_0x3b484d){return _0x4346f3[_0x7db5('0x2d')](_0x5c2834);}return _0x4346f3['status'](_0x5c2834)['end']();};}function respondWithResult(_0x2db99a,_0x1c7a0c){_0x1c7a0c=_0x1c7a0c||0xc8;return function(_0x14ba85){if(_0x14ba85){return _0x2db99a[_0x7db5('0x2e')](_0x1c7a0c)['json'](_0x14ba85);}};}function respondWithFilteredResult(_0x4a2105,_0x290d87){return function(_0x237b7e){if(_0x237b7e){var _0x3657ef=_0x237b7e['count'],_0x32ce3c=_0x290d87[_0x7db5('0x2f')],_0x33d240=_0x290d87['offset']+_0x290d87[_0x7db5('0x30')],_0xcd4beb;if(_0x33d240>=_0x3657ef){_0x33d240=_0x3657ef;_0xcd4beb=0xc8;}else{_0xcd4beb=0xce;}_0x4a2105[_0x7db5('0x2e')](_0xcd4beb);return _0x4a2105[_0x7db5('0x31')](_0x7db5('0x32'),_0x32ce3c+'-'+_0x33d240+'/'+_0x3657ef)[_0x7db5('0x33')](_0x237b7e);}return null;};}function patchUpdates(_0x4f47c1){return function(_0x5547fe){try{jsonpatch['apply'](_0x5547fe,_0x4f47c1,!![]);}catch(_0x14f0cf){return BPromise[_0x7db5('0x34')](_0x14f0cf);}return _0x5547fe[_0x7db5('0x35')]();};}function saveUpdates(_0x3567de,_0x19abd6){return function(_0xad6aa){if(_0xad6aa){return _0xad6aa[_0x7db5('0x36')](_0x3567de)[_0x7db5('0x22')](function(_0x278ba1){return _0x278ba1;});}return null;};}function removeEntity(_0x3014a3,_0x27c8d5){return function(_0x4cffd0){if(_0x4cffd0){return _0x4cffd0[_0x7db5('0x37')]()[_0x7db5('0x22')](function(){var _0x1dfc23=_0x4cffd0[_0x7db5('0x38')]({'plain':!![]});var _0x1f09e8=_0x7db5('0x39');return db['UserProfileResource'][_0x7db5('0x37')]({'where':{'type':_0x1f09e8,'resourceId':_0x1dfc23['id']}})['then'](function(){return _0x4cffd0;});})[_0x7db5('0x22')](function(){_0x3014a3[_0x7db5('0x2e')](0xcc)[_0x7db5('0x3a')]();});}};}function handleEntityNotFound(_0x4b5a08,_0x389ffe){return function(_0x587836){if(!_0x587836){_0x4b5a08[_0x7db5('0x2d')](0x194);}return _0x587836;};}function handleError(_0x504b85,_0xb74e1a){_0xb74e1a=_0xb74e1a||0x1f4;return function(_0x357190){logger[_0x7db5('0x28')](_0x357190[_0x7db5('0x3b')]);if(_0x357190[_0x7db5('0x3c')]){delete _0x357190[_0x7db5('0x3c')];}_0x504b85[_0x7db5('0x2e')](_0xb74e1a)[_0x7db5('0x3d')](_0x357190);};}exports['index']=function(_0x510f47,_0x3fed98){var _0x2db5a8={'include':[{'model':db[_0x7db5('0x3e')],'as':'Imap'},{'model':db[_0x7db5('0x3f')],'as':_0x7db5('0x40')},{'model':db[_0x7db5('0x41')],'as':_0x7db5('0x42')}]},_0x2f952d={},_0x56b5f6={'count':0x0,'rows':[]};var _0x571f14=_[_0x7db5('0x43')](db[_0x7db5('0x44')][_0x7db5('0x45')],function(_0x1eb6bc){return{'name':_0x1eb6bc[_0x7db5('0x46')],'type':_0x1eb6bc['type'][_0x7db5('0x47')]};});_0x2f952d[_0x7db5('0x48')]=_[_0x7db5('0x43')](_0x571f14,_0x7db5('0x3c'));_0x2f952d[_0x7db5('0x49')]=_['keys'](_0x510f47[_0x7db5('0x49')]);_0x2f952d[_0x7db5('0x4a')]=_[_0x7db5('0x4b')](_0x2f952d['model'],_0x2f952d[_0x7db5('0x49')]);_0x2db5a8[_0x7db5('0x4c')]=_['intersection'](_0x2f952d[_0x7db5('0x48')],qs[_0x7db5('0x4d')](_0x510f47[_0x7db5('0x49')][_0x7db5('0x4d')]));_0x2db5a8[_0x7db5('0x4c')]=_0x2db5a8['attributes'][_0x7db5('0x4e')]?_0x2db5a8[_0x7db5('0x4c')]:_0x2f952d[_0x7db5('0x48')];if(!_0x510f47['query'][_0x7db5('0x4f')](_0x7db5('0x50'))){_0x2db5a8[_0x7db5('0x30')]=qs[_0x7db5('0x30')](_0x510f47[_0x7db5('0x49')][_0x7db5('0x30')]);_0x2db5a8['offset']=qs[_0x7db5('0x2f')](_0x510f47['query'][_0x7db5('0x2f')]);}_0x2db5a8['order']=qs['sort'](_0x510f47[_0x7db5('0x49')][_0x7db5('0x51')]);_0x2db5a8['where']=qs[_0x7db5('0x4a')](_[_0x7db5('0x52')](_0x510f47[_0x7db5('0x49')],_0x2f952d['filters']),_0x571f14);if(_0x510f47[_0x7db5('0x49')][_0x7db5('0x53')]){_0x2db5a8['where']=_['merge'](_0x2db5a8[_0x7db5('0x54')],{'$or':_[_0x7db5('0x43')](_0x571f14,function(_0x22c72e){if(_0x22c72e['type']!=='VIRTUAL'){var _0x77d375={};_0x77d375[_0x22c72e['name']]={'$like':'%'+_0x510f47[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0x77d375;}})});}_0x2db5a8=_[_0x7db5('0x55')]({},_0x2db5a8,_0x510f47[_0x7db5('0x56')]);var _0x5a05c3={'where':_0x2db5a8[_0x7db5('0x54')]};return db['MailAccount'][_0x7db5('0x57')](_0x5a05c3)[_0x7db5('0x22')](function(_0x54af81){_0x56b5f6[_0x7db5('0x57')]=_0x54af81;if(_0x510f47[_0x7db5('0x49')]['includeAll']){_0x2db5a8[_0x7db5('0x58')]=[{'all':!![]}];}return db[_0x7db5('0x44')][_0x7db5('0x59')](_0x2db5a8);})[_0x7db5('0x22')](function(_0x1dc7e5){_0x56b5f6[_0x7db5('0x5a')]=_0x1dc7e5;return _0x56b5f6;})[_0x7db5('0x22')](respondWithFilteredResult(_0x3fed98,_0x2db5a8))[_0x7db5('0x2c')](handleError(_0x3fed98,null));};exports[_0x7db5('0x5b')]=function(_0x32a827,_0x4677cf){var _0x114cbb={'raw':![],'where':{'id':_0x32a827['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x7db5('0x5c')},{'model':db[_0x7db5('0x3f')],'as':_0x7db5('0x40')},{'model':db[_0x7db5('0x41')],'as':_0x7db5('0x42')}]},_0x553cf6={};_0x553cf6[_0x7db5('0x48')]=_[_0x7db5('0x5d')](db[_0x7db5('0x44')][_0x7db5('0x45')]);_0x553cf6[_0x7db5('0x49')]=_['keys'](_0x32a827[_0x7db5('0x49')]);_0x553cf6[_0x7db5('0x4a')]=_[_0x7db5('0x4b')](_0x553cf6['model'],_0x553cf6[_0x7db5('0x49')]);_0x114cbb[_0x7db5('0x4c')]=_[_0x7db5('0x4b')](_0x553cf6[_0x7db5('0x48')],qs['fields'](_0x32a827[_0x7db5('0x49')]['fields']));_0x114cbb[_0x7db5('0x4c')]=_0x114cbb[_0x7db5('0x4c')]['length']?_0x114cbb[_0x7db5('0x4c')]:_0x553cf6[_0x7db5('0x48')];if(_0x32a827[_0x7db5('0x49')][_0x7db5('0x5e')]){_0x114cbb[_0x7db5('0x58')]=[{'all':!![]}];}_0x114cbb=_[_0x7db5('0x55')]({},_0x114cbb,_0x32a827[_0x7db5('0x56')]);return db[_0x7db5('0x44')][_0x7db5('0x5f')](_0x114cbb)['then'](handleEntityNotFound(_0x4677cf,null))[_0x7db5('0x22')](respondWithResult(_0x4677cf,null))[_0x7db5('0x2c')](handleError(_0x4677cf,null));};exports['update']=function(_0x1b8f99,_0x33493d){if(_0x1b8f99[_0x7db5('0x60')]['id']){delete _0x1b8f99[_0x7db5('0x60')]['id'];}return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x1b8f99[_0x7db5('0x61')]['id']},'include':[{'model':db[_0x7db5('0x3e')],'as':_0x7db5('0x5c')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7db5('0x41')],'as':'mandatoryDispositionPause'}]})[_0x7db5('0x22')](handleEntityNotFound(_0x33493d,null))['then'](saveUpdates(_0x1b8f99[_0x7db5('0x60')],null))[_0x7db5('0x22')](function(_0x39e7b1){if(_0x39e7b1&&_0x1b8f99[_0x7db5('0x60')][_0x7db5('0x5c')]){return db[_0x7db5('0x3e')][_0x7db5('0x36')](_0x1b8f99['body'][_0x7db5('0x5c')],{'where':{'MailAccountId':_0x39e7b1['id']}})[_0x7db5('0x22')](function(){return _0x39e7b1;});}return _0x39e7b1;})[_0x7db5('0x22')](function(_0x220b51){if(_0x220b51&&_0x1b8f99['body'][_0x7db5('0x40')]){return db[_0x7db5('0x3f')][_0x7db5('0x36')](_0x1b8f99[_0x7db5('0x60')][_0x7db5('0x40')],{'where':{'MailAccountId':_0x220b51['id']}})[_0x7db5('0x22')](function(){return _0x220b51;});}return _0x220b51;})[_0x7db5('0x22')](respondWithResult(_0x33493d,null))[_0x7db5('0x2c')](handleError(_0x33493d,null));};exports[_0x7db5('0x62')]=function(_0x1dd0e5,_0x53dfb2){return db[_0x7db5('0x44')][_0x7db5('0x62')]()[_0x7db5('0x22')](respondWithResult(_0x53dfb2,null))[_0x7db5('0x2c')](handleError(_0x53dfb2,null));};exports[_0x7db5('0x63')]=function(_0x33eb90,_0x5ea191,_0x3afc98){if(_0x33eb90[_0x7db5('0x60')]['id']){delete _0x33eb90[_0x7db5('0x60')]['id'];}return db['MailAccount'][_0x7db5('0x5f')]({'where':{'id':_0x33eb90[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x5ea191,null))[_0x7db5('0x22')](function(_0x5bfec7){if(_0x5bfec7){_0x33eb90[_0x7db5('0x60')][_0x7db5('0x64')]=_0x5bfec7['id'];return db['Disposition'][_0x7db5('0x65')](_0x33eb90['body']);}})[_0x7db5('0x22')](respondWithResult(_0x5ea191,null))[_0x7db5('0x2c')](handleError(_0x5ea191,null));};exports[_0x7db5('0x66')]=function(_0x5e1b8f,_0x1d0ff3,_0x2bb0b7){var _0x32d246={'raw':![],'where':{}};var _0x3b7e0a={};var _0x1ee4a5={'count':0x0,'rows':[]};return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x5e1b8f[_0x7db5('0x61')]['id']}})['then'](handleEntityNotFound(_0x1d0ff3,null))[_0x7db5('0x22')](function(_0x5f35bb){if(_0x5f35bb){_0x3b7e0a[_0x7db5('0x48')]=_['keys'](db[_0x7db5('0x68')][_0x7db5('0x45')]);_0x3b7e0a[_0x7db5('0x49')]=_[_0x7db5('0x5d')](_0x5e1b8f[_0x7db5('0x49')]);_0x3b7e0a[_0x7db5('0x4a')]=_[_0x7db5('0x4b')](_0x3b7e0a[_0x7db5('0x48')],_0x3b7e0a[_0x7db5('0x49')]);_0x32d246[_0x7db5('0x4c')]=_[_0x7db5('0x4b')](_0x3b7e0a['model'],qs[_0x7db5('0x4d')](_0x5e1b8f[_0x7db5('0x49')]['fields']));_0x32d246[_0x7db5('0x4c')]=_0x32d246[_0x7db5('0x4c')][_0x7db5('0x4e')]?_0x32d246[_0x7db5('0x4c')]:_0x3b7e0a[_0x7db5('0x48')];if(!_0x5e1b8f[_0x7db5('0x49')][_0x7db5('0x4f')]('nolimit')){_0x32d246['limit']=qs['limit'](_0x5e1b8f[_0x7db5('0x49')]['limit']);_0x32d246[_0x7db5('0x2f')]=qs['offset'](_0x5e1b8f[_0x7db5('0x49')][_0x7db5('0x2f')]);}_0x32d246['order']=qs[_0x7db5('0x51')](_0x5e1b8f[_0x7db5('0x49')][_0x7db5('0x51')]);_0x32d246[_0x7db5('0x54')]=qs[_0x7db5('0x4a')](_[_0x7db5('0x52')](_0x5e1b8f[_0x7db5('0x49')],_0x3b7e0a[_0x7db5('0x4a')]));_0x32d246[_0x7db5('0x54')][_0x7db5('0x64')]=_0x5f35bb['id'];if(_0x5e1b8f[_0x7db5('0x49')][_0x7db5('0x53')]){_0x32d246[_0x7db5('0x54')]=_['merge'](_0x32d246[_0x7db5('0x54')],{'$or':_[_0x7db5('0x43')](_0x32d246[_0x7db5('0x4c')],function(_0x1e690b){var _0x3f82a5={};_0x3f82a5[_0x1e690b]={'$like':'%'+_0x5e1b8f[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0x3f82a5;})});}_0x32d246=_['merge']({},_0x32d246,_0x5e1b8f[_0x7db5('0x56')]);return db[_0x7db5('0x68')][_0x7db5('0x57')]({'where':_0x32d246[_0x7db5('0x54')]})[_0x7db5('0x22')](function(_0x19278c){_0x1ee4a5['count']=_0x19278c;if(_0x5e1b8f[_0x7db5('0x49')][_0x7db5('0x5e')]){_0x32d246[_0x7db5('0x58')]=[{'all':!![]}];}return db[_0x7db5('0x68')][_0x7db5('0x59')](_0x32d246);})[_0x7db5('0x22')](function(_0x7988c5){_0x1ee4a5[_0x7db5('0x5a')]=_0x7988c5;return _0x1ee4a5;});}})[_0x7db5('0x22')](respondWithFilteredResult(_0x1d0ff3,_0x32d246))['catch'](handleError(_0x1d0ff3,null));};exports[_0x7db5('0x69')]=function(_0x5e8859,_0x2b139f,_0x571af4){return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x5e8859['params']['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x2b139f,null))['then'](function(_0x1added){if(_0x1added){return _0x1added['removeDispositions'](_0x5e8859[_0x7db5('0x49')]['ids']);}})[_0x7db5('0x22')](respondWithStatusCode(_0x2b139f,null))[_0x7db5('0x2c')](handleError(_0x2b139f,null));};exports['addAnswer']=function(_0x59dbe7,_0x243a08,_0x1ef826){if(_0x59dbe7[_0x7db5('0x60')]['id']){delete _0x59dbe7[_0x7db5('0x60')]['id'];}return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x59dbe7[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x243a08,null))['then'](function(_0xf614e3){if(_0xf614e3){_0x59dbe7[_0x7db5('0x60')][_0x7db5('0x64')]=_0xf614e3['id'];return db['CannedAnswer']['create'](_0x59dbe7[_0x7db5('0x60')]);}})[_0x7db5('0x22')](respondWithResult(_0x243a08,null))[_0x7db5('0x2c')](handleError(_0x243a08,null));};exports[_0x7db5('0x6a')]=function(_0x12e4d9,_0x2c9ea6,_0x42668d){var _0xf27024={'raw':![],'where':{}};var _0x3265ad={};var _0x1a308b={'count':0x0,'rows':[]};return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x12e4d9[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x2c9ea6,null))[_0x7db5('0x22')](function(_0x5e4c5c){if(_0x5e4c5c){_0x3265ad[_0x7db5('0x48')]=_['keys'](db[_0x7db5('0x6b')]['rawAttributes']);_0x3265ad['query']=_[_0x7db5('0x5d')](_0x12e4d9[_0x7db5('0x49')]);_0x3265ad['filters']=_['intersection'](_0x3265ad[_0x7db5('0x48')],_0x3265ad[_0x7db5('0x49')]);_0xf27024[_0x7db5('0x4c')]=_[_0x7db5('0x4b')](_0x3265ad['model'],qs[_0x7db5('0x4d')](_0x12e4d9[_0x7db5('0x49')][_0x7db5('0x4d')]));_0xf27024['attributes']=_0xf27024['attributes']['length']?_0xf27024[_0x7db5('0x4c')]:_0x3265ad[_0x7db5('0x48')];if(!_0x12e4d9[_0x7db5('0x49')][_0x7db5('0x4f')](_0x7db5('0x50'))){_0xf27024['limit']=qs[_0x7db5('0x30')](_0x12e4d9[_0x7db5('0x49')][_0x7db5('0x30')]);_0xf27024[_0x7db5('0x2f')]=qs['offset'](_0x12e4d9[_0x7db5('0x49')]['offset']);}_0xf27024[_0x7db5('0x6c')]=qs[_0x7db5('0x51')](_0x12e4d9[_0x7db5('0x49')]['sort']);_0xf27024[_0x7db5('0x54')]=qs[_0x7db5('0x4a')](_['pick'](_0x12e4d9[_0x7db5('0x49')],_0x3265ad['filters']));_0xf27024[_0x7db5('0x54')][_0x7db5('0x64')]=_0x5e4c5c['id'];if(_0x12e4d9[_0x7db5('0x49')][_0x7db5('0x53')]){_0xf27024[_0x7db5('0x54')]=_['merge'](_0xf27024[_0x7db5('0x54')],{'$or':_[_0x7db5('0x43')](_0xf27024[_0x7db5('0x4c')],function(_0x4fad55){var _0x44d67f={};_0x44d67f[_0x4fad55]={'$like':'%'+_0x12e4d9[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0x44d67f;})});}_0xf27024=_['merge']({},_0xf27024,_0x12e4d9[_0x7db5('0x56')]);return db['CannedAnswer'][_0x7db5('0x57')]({'where':_0xf27024[_0x7db5('0x54')]})[_0x7db5('0x22')](function(_0x30109c){_0x1a308b[_0x7db5('0x57')]=_0x30109c;if(_0x12e4d9[_0x7db5('0x49')][_0x7db5('0x5e')]){_0xf27024[_0x7db5('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7db5('0x59')](_0xf27024);})[_0x7db5('0x22')](function(_0x4d5fb3){_0x1a308b[_0x7db5('0x5a')]=_0x4d5fb3;return _0x1a308b;});}})['then'](respondWithFilteredResult(_0x2c9ea6,_0xf27024))[_0x7db5('0x2c')](handleError(_0x2c9ea6,null));};exports[_0x7db5('0x6d')]=function(_0x351c2a,_0xb03d7a,_0x588b62){return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x351c2a[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0xb03d7a,null))['then'](function(_0x52be4e){if(_0x52be4e){return _0x52be4e[_0x7db5('0x6d')](_0x351c2a[_0x7db5('0x49')]['ids']);}})['then'](respondWithStatusCode(_0xb03d7a,null))[_0x7db5('0x2c')](handleError(_0xb03d7a,null));};exports[_0x7db5('0x65')]=function(_0x4068cb,_0x309fb2){var _0x2a8755={'name':_0x4068cb[_0x7db5('0x60')]['name'],'key':_0x4068cb[_0x7db5('0x60')][_0x7db5('0x47')],'email':_0x4068cb[_0x7db5('0x60')][_0x7db5('0x6e')],'ListId':_0x4068cb[_0x7db5('0x60')]['ListId'],'active':!_[_0x7db5('0x6f')](_0x4068cb[_0x7db5('0x60')][_0x7db5('0x70')])?_0x4068cb[_0x7db5('0x60')][_0x7db5('0x70')]:!![],'description':_0x4068cb[_0x7db5('0x60')][_0x7db5('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4068cb[_0x7db5('0x60')][_0x7db5('0x72')])){if(_0x4068cb[_0x7db5('0x60')]['cauthentication']){_0x2a8755[_0x7db5('0x5c')][_0x7db5('0x73')]=_0x2a8755[_0x7db5('0x40')]['user']=_0x4068cb['body']['cuser'];_0x2a8755['Imap']['password']=_0x2a8755[_0x7db5('0x40')]['pass']=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x74')];}else{_0x2a8755['Imap']['authentication']=_0x2a8755[_0x7db5('0x40')][_0x7db5('0x75')]=![];}_0x2a8755[_0x7db5('0x5c')][_0x7db5('0x76')]=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x5c')][_0x7db5('0x76')];_0x2a8755[_0x7db5('0x5c')][_0x7db5('0x77')]=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x5c')][_0x7db5('0x77')];_0x2a8755[_0x7db5('0x40')]['host']=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x40')][_0x7db5('0x76')];_0x2a8755[_0x7db5('0x40')][_0x7db5('0x77')]=_0x4068cb[_0x7db5('0x60')]['Smtp'][_0x7db5('0x77')];}else{_0x2a8755['Imap']['service']=_0x2a8755[_0x7db5('0x40')][_0x7db5('0x78')]=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x72')];_0x2a8755[_0x7db5('0x5c')][_0x7db5('0x73')]=_0x2a8755[_0x7db5('0x40')]['user']=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x79')];_0x2a8755[_0x7db5('0x5c')][_0x7db5('0x7a')]=_0x2a8755[_0x7db5('0x40')]['pass']=_0x4068cb[_0x7db5('0x60')][_0x7db5('0x74')];}return db[_0x7db5('0x44')][_0x7db5('0x65')](_0x2a8755,{'include':[{'model':db[_0x7db5('0x3f')],'as':_0x7db5('0x40')},{'model':db[_0x7db5('0x3e')],'as':_0x7db5('0x5c')}]})[_0x7db5('0x22')](function(_0x173fa3){var _0x5caa82=_0x4068cb[_0x7db5('0x73')][_0x7db5('0x38')]({'plain':!![]});if(!_0x5caa82)throw new Error(_0x7db5('0x7b'));if(_0x5caa82['role']===_0x7db5('0x73')){var _0xc8b84b=_0x173fa3[_0x7db5('0x38')]({'plain':!![]});return db[_0x7db5('0x7c')]['find']({'where':{'name':_0x7db5('0x39'),'userProfileId':_0x5caa82[_0x7db5('0x7d')]},'raw':!![]})[_0x7db5('0x22')](function(_0x14df9c){if(_0x14df9c&&_0x14df9c[_0x7db5('0x7e')]===0x0){return db[_0x7db5('0x7f')]['create']({'name':_0xc8b84b[_0x7db5('0x3c')],'resourceId':_0xc8b84b['id'],'type':_0x14df9c['name'],'sectionId':_0x14df9c['id']},{})[_0x7db5('0x22')](function(){return _0x173fa3;});}else{return _0x173fa3;}})[_0x7db5('0x2c')](function(_0x49e6dc){logger[_0x7db5('0x28')](_0x7db5('0x80'),_0x49e6dc);throw _0x49e6dc;});}return _0x173fa3;})[_0x7db5('0x22')](respondWithResult(_0x309fb2,0xc9))[_0x7db5('0x2c')](handleError(_0x309fb2,null));};exports['getImap']=function(_0x36e07f,_0x34dced,_0x216b2e){return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x36e07f[_0x7db5('0x61')]['id']}})['then'](handleEntityNotFound(_0x34dced,null))[_0x7db5('0x22')](function(_0x1c1432){if(_0x1c1432){return _0x1c1432['getImap']();}return null;})[_0x7db5('0x22')](respondWithResult(_0x34dced,null))[_0x7db5('0x2c')](handleError(_0x34dced,null));};exports[_0x7db5('0x81')]=function(_0x6bab27,_0x22fb9c,_0x1b49b9){if(_0x6bab27['body']['id']){delete _0x6bab27[_0x7db5('0x60')]['id'];}return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x6bab27[_0x7db5('0x61')]['id']}})['then'](handleEntityNotFound(_0x22fb9c,null))['then'](function(_0xe90e75){if(_0xe90e75){_0x6bab27[_0x7db5('0x60')][_0x7db5('0x64')]=_0xe90e75['id'];return db[_0x7db5('0x3e')][_0x7db5('0x65')](_0x6bab27[_0x7db5('0x60')]);}})[_0x7db5('0x22')](respondWithResult(_0x22fb9c,null))[_0x7db5('0x2c')](handleError(_0x22fb9c,null));};exports[_0x7db5('0x82')]=function(_0x5b8272,_0x127744,_0xa8dd47){return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x5b8272[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x127744,null))[_0x7db5('0x22')](function(_0x527154){if(_0x527154){return _0x527154['setImap'](null);}return null;})[_0x7db5('0x22')](respondWithStatusCode(_0x127744,null))[_0x7db5('0x2c')](handleError(_0x127744,null));};exports['getSmtp']=function(_0x2d056e,_0x99a6a7,_0x662d9f){return db['MailAccount'][_0x7db5('0x67')]({'where':{'id':_0x2d056e[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x99a6a7,null))[_0x7db5('0x22')](function(_0x238e97){if(_0x238e97){return _0x238e97[_0x7db5('0x83')]();}return null;})[_0x7db5('0x22')](respondWithResult(_0x99a6a7,null))['catch'](handleError(_0x99a6a7,null));};exports[_0x7db5('0x84')]=function(_0x12cad7,_0x43de25,_0x14b0b5){if(_0x12cad7[_0x7db5('0x60')]['id']){delete _0x12cad7[_0x7db5('0x60')]['id'];}return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x12cad7[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x43de25,null))['then'](function(_0x58113e){if(_0x58113e){_0x12cad7[_0x7db5('0x60')][_0x7db5('0x64')]=_0x58113e['id'];return db[_0x7db5('0x3f')][_0x7db5('0x65')](_0x12cad7[_0x7db5('0x60')]);}})[_0x7db5('0x22')](respondWithResult(_0x43de25,null))[_0x7db5('0x2c')](handleError(_0x43de25,null));};exports[_0x7db5('0x85')]=function(_0x7162ed,_0x425021,_0x590d06){return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x7162ed[_0x7db5('0x61')]['id']}})['then'](handleEntityNotFound(_0x425021,null))[_0x7db5('0x22')](function(_0x5b8cc7){if(_0x5b8cc7){return _0x5b8cc7[_0x7db5('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x425021,null))['catch'](handleError(_0x425021,null));};exports['addInteraction']=function(_0x56e76b,_0x1919ee,_0x532d78){return db['MailInteraction'][_0x7db5('0x5f')]({'where':{'id':_0x56e76b[_0x7db5('0x61')]['id']}})['then'](handleEntityNotFound(_0x1919ee,null))['then'](function(_0x2375a6){if(_0x2375a6){return _0x2375a6[_0x7db5('0x87')](_0x56e76b['body'][_0x7db5('0x88')],_[_0x7db5('0x89')](_0x56e76b['body'],[_0x7db5('0x88'),'id'])||{});}})[_0x7db5('0x22')](respondWithResult(_0x1919ee,null))[_0x7db5('0x2c')](handleError(_0x1919ee,null));};exports['getInteractions']=function(_0x470c6b,_0x5081e6,_0x3a6b01){var _0x3ba9bc={'raw':![],'where':{}};var _0x364adf={};var _0x4d5842={'count':0x0,'rows':[]};return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x470c6b[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x5081e6,null))[_0x7db5('0x22')](function(_0x546d1d){if(_0x546d1d){_0x364adf[_0x7db5('0x48')]=_[_0x7db5('0x5d')](db['MailInteraction'][_0x7db5('0x45')]);_0x364adf[_0x7db5('0x49')]=_['keys'](_0x470c6b[_0x7db5('0x49')]);_0x364adf[_0x7db5('0x4a')]=_[_0x7db5('0x4b')](_0x364adf['model'],_0x364adf[_0x7db5('0x49')]);_0x3ba9bc[_0x7db5('0x4c')]=_['intersection'](_0x364adf[_0x7db5('0x48')],qs[_0x7db5('0x4d')](_0x470c6b['query']['fields']));_0x3ba9bc[_0x7db5('0x4c')]=_0x3ba9bc['attributes'][_0x7db5('0x4e')]?_0x3ba9bc[_0x7db5('0x4c')]:_0x364adf[_0x7db5('0x48')];if(!_0x470c6b[_0x7db5('0x49')][_0x7db5('0x4f')](_0x7db5('0x50'))){_0x3ba9bc[_0x7db5('0x30')]=qs[_0x7db5('0x30')](_0x470c6b[_0x7db5('0x49')][_0x7db5('0x30')]);_0x3ba9bc[_0x7db5('0x2f')]=qs[_0x7db5('0x2f')](_0x470c6b[_0x7db5('0x49')][_0x7db5('0x2f')]);}_0x3ba9bc[_0x7db5('0x6c')]=qs[_0x7db5('0x51')](_0x470c6b['query'][_0x7db5('0x51')]);_0x3ba9bc[_0x7db5('0x54')]=qs['filters'](_[_0x7db5('0x52')](_0x470c6b[_0x7db5('0x49')],_0x364adf[_0x7db5('0x4a')]));_0x3ba9bc[_0x7db5('0x54')][_0x7db5('0x64')]=_0x546d1d['id'];if(_0x470c6b['query']['filter']){_0x3ba9bc[_0x7db5('0x54')]=_[_0x7db5('0x55')](_0x3ba9bc[_0x7db5('0x54')],{'$or':_[_0x7db5('0x43')](_0x3ba9bc[_0x7db5('0x4c')],function(_0x24ac0d){var _0x49f193={};_0x49f193[_0x24ac0d]={'$like':'%'+_0x470c6b[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0x49f193;})});}_0x3ba9bc=_[_0x7db5('0x55')]({},_0x3ba9bc,_0x470c6b[_0x7db5('0x56')]);return db[_0x7db5('0x8a')][_0x7db5('0x57')]({'where':_0x3ba9bc['where']})[_0x7db5('0x22')](function(_0x2303c4){_0x4d5842[_0x7db5('0x57')]=_0x2303c4;if(_0x470c6b['query'][_0x7db5('0x5e')]){_0x3ba9bc[_0x7db5('0x58')]=[{'model':db[_0x7db5('0x8b')],'as':_0x7db5('0x8c'),'required':![]},{'model':db[_0x7db5('0x8d')],'as':'Owner','attributes':['name',_0x7db5('0x8e'),'internal'],'required':![]},{'model':db[_0x7db5('0x8f')],'as':_0x7db5('0x90'),'attributes':['id',_0x7db5('0x3c'),_0x7db5('0x91')],'where':_0x470c6b[_0x7db5('0x49')][_0x7db5('0x92')]?{'id':_0x470c6b[_0x7db5('0x49')][_0x7db5('0x92')]}:undefined,'required':_0x470c6b['query'][_0x7db5('0x92')]?!![]:![]}];}return db[_0x7db5('0x8a')]['findAll'](_0x3ba9bc);})['then'](function(_0x31943c){_0x4d5842[_0x7db5('0x5a')]=_0x31943c;return _0x4d5842;});}})[_0x7db5('0x22')](respondWithFilteredResult(_0x5081e6,_0x3ba9bc))['catch'](handleError(_0x5081e6,null));};exports['addApplications']=function(_0x4cd087,_0x447461,_0x3ba6b9){return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x4cd087[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x447461,null))[_0x7db5('0x22')](function(_0x2cce25){if(_0x2cce25){return db[_0x7db5('0x93')][_0x7db5('0x94')](function(_0x4b1b28){return db[_0x7db5('0x95')][_0x7db5('0x37')]({'where':{'MailAccountId':_0x4cd087[_0x7db5('0x61')]['id']},'transaction':_0x4b1b28})['then'](function(_0x1579f5){var _0x1beda6=_[_0x7db5('0x43')](_0x4cd087[_0x7db5('0x60')],function(_0x5d850a){_0x5d850a[_0x7db5('0x64')]=_0x4cd087[_0x7db5('0x61')]['id'];return _0x5d850a;});return db[_0x7db5('0x95')]['bulkCreate'](_0x1beda6,{'transaction':_0x4b1b28});});})['then'](function(){return db[_0x7db5('0x95')][_0x7db5('0x96')]({'where':{'MailAccountId':_0x4cd087[_0x7db5('0x61')]['id']},'order':_0x7db5('0x97')});});}})['then'](respondWithResult(_0x447461,null))[_0x7db5('0x2c')](handleError(_0x447461,null));};exports[_0x7db5('0x98')]=function(_0x53ad2e,_0x288cc1,_0x8269ac){var _0x1953c4={};var _0x2146ae={};var _0x3ae5eb;var _0x2be22c;return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x53ad2e['params']['id']}})['then'](handleEntityNotFound(_0x288cc1,null))[_0x7db5('0x22')](function(_0x3e760c){if(_0x3e760c){_0x3ae5eb=_0x3e760c;_0x2146ae['model']=_[_0x7db5('0x5d')](db['MailApplication'][_0x7db5('0x45')]);_0x2146ae[_0x7db5('0x49')]=_['keys'](_0x53ad2e['query']);_0x2146ae[_0x7db5('0x4a')]=_['intersection'](_0x2146ae[_0x7db5('0x48')],_0x2146ae[_0x7db5('0x49')]);_0x1953c4[_0x7db5('0x4c')]=_[_0x7db5('0x4b')](_0x2146ae[_0x7db5('0x48')],qs[_0x7db5('0x4d')](_0x53ad2e[_0x7db5('0x49')][_0x7db5('0x4d')]));_0x1953c4[_0x7db5('0x4c')]=_0x1953c4[_0x7db5('0x4c')]['length']?_0x1953c4[_0x7db5('0x4c')]:_0x2146ae['model'];_0x1953c4[_0x7db5('0x6c')]=qs[_0x7db5('0x51')](_0x53ad2e[_0x7db5('0x49')][_0x7db5('0x51')]);_0x1953c4['where']=qs[_0x7db5('0x4a')](_[_0x7db5('0x52')](_0x53ad2e[_0x7db5('0x49')],_0x2146ae[_0x7db5('0x4a')]));if(_0x53ad2e['query']['filter']){_0x1953c4[_0x7db5('0x54')]=_[_0x7db5('0x55')](_0x1953c4[_0x7db5('0x54')],{'$or':_[_0x7db5('0x43')](_0x1953c4[_0x7db5('0x4c')],function(_0x4e3a09){var _0x4d351a={};_0x4d351a[_0x4e3a09]={'$like':'%'+_0x53ad2e[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0x4d351a;})});}_0x1953c4=_[_0x7db5('0x55')]({},_0x1953c4,_0x53ad2e['options']);return _0x3ae5eb[_0x7db5('0x98')](_0x1953c4);}})[_0x7db5('0x22')](function(_0x385a50){if(_0x385a50){_0x2be22c=_0x385a50[_0x7db5('0x4e')];if(!_0x53ad2e[_0x7db5('0x49')][_0x7db5('0x4f')](_0x7db5('0x50'))){_0x1953c4[_0x7db5('0x30')]=qs[_0x7db5('0x30')](_0x53ad2e[_0x7db5('0x49')][_0x7db5('0x30')]);_0x1953c4[_0x7db5('0x2f')]=qs['offset'](_0x53ad2e[_0x7db5('0x49')]['offset']);}return _0x3ae5eb[_0x7db5('0x98')](_0x1953c4);}})[_0x7db5('0x22')](function(_0x12dd52){if(_0x12dd52){return _0x12dd52?{'count':_0x2be22c,'rows':_0x12dd52}:null;}})[_0x7db5('0x22')](respondWithResult(_0x288cc1,null))[_0x7db5('0x2c')](handleError(_0x288cc1,null));};exports[_0x7db5('0x99')]=function(_0x3141a3,_0x1dcee7,_0x3e81e7){var _0x102972={'raw':!![],'where':{}};var _0x339634={};var _0x3bcfed={'count':0x0,'rows':[]};return db[_0x7db5('0x44')][_0x7db5('0x67')]({'where':{'id':_0x3141a3['params']['id']}})['then'](handleEntityNotFound(_0x1dcee7,null))[_0x7db5('0x22')](function(_0x505429){if(_0x505429){_0x339634[_0x7db5('0x48')]=_[_0x7db5('0x5d')](db[_0x7db5('0x9a')][_0x7db5('0x45')]);_0x339634[_0x7db5('0x49')]=_['keys'](_0x3141a3['query']);_0x339634[_0x7db5('0x4a')]=_['intersection'](_0x339634[_0x7db5('0x48')],_0x339634[_0x7db5('0x49')]);_0x102972['attributes']=_[_0x7db5('0x4b')](_0x339634[_0x7db5('0x48')],qs[_0x7db5('0x4d')](_0x3141a3[_0x7db5('0x49')]['fields']));_0x102972[_0x7db5('0x4c')]=_0x102972[_0x7db5('0x4c')]['length']?_0x102972[_0x7db5('0x4c')]:_0x339634['model'];if(!_0x3141a3[_0x7db5('0x49')][_0x7db5('0x4f')]('nolimit')){_0x102972[_0x7db5('0x30')]=qs[_0x7db5('0x30')](_0x3141a3[_0x7db5('0x49')][_0x7db5('0x30')]);_0x102972['offset']=qs[_0x7db5('0x2f')](_0x3141a3[_0x7db5('0x49')][_0x7db5('0x2f')]);}_0x102972[_0x7db5('0x6c')]=qs[_0x7db5('0x51')](_0x3141a3[_0x7db5('0x49')][_0x7db5('0x51')]);_0x102972['where']=qs[_0x7db5('0x4a')](_[_0x7db5('0x52')](_0x3141a3['query'],_0x339634[_0x7db5('0x4a')]));_0x102972[_0x7db5('0x54')][_0x7db5('0x64')]=_0x505429['id'];if(_0x3141a3[_0x7db5('0x49')][_0x7db5('0x53')]){_0x102972[_0x7db5('0x54')]=_[_0x7db5('0x55')](_0x102972[_0x7db5('0x54')],{'$or':_[_0x7db5('0x43')](_0x102972['attributes'],function(_0x2985e1){var _0xf4ddc2={};_0xf4ddc2[_0x2985e1]={'$like':'%'+_0x3141a3[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0xf4ddc2;})});}if(_0x3141a3['query'][_0x7db5('0x9b')]){var _0x591ae5=_0x3141a3[_0x7db5('0x49')][_0x7db5('0x9b')]['split'](',');var _0x5e9376={};_0x5e9376[_0x591ae5[0x0]]={'$gte':moment(_0x591ae5[0x1])[_0x7db5('0x9c')](_0x7db5('0x9d'))};_0x102972[_0x7db5('0x54')]=_['merge'](_0x102972[_0x7db5('0x54')],_0x5e9376);}_0x102972=_[_0x7db5('0x55')]({},_0x102972,_0x3141a3[_0x7db5('0x56')]);return db['MailMessage'][_0x7db5('0x57')]({'where':_0x102972[_0x7db5('0x54')]})[_0x7db5('0x22')](function(_0x5b4645){_0x3bcfed[_0x7db5('0x57')]=_0x5b4645;if(_0x3141a3[_0x7db5('0x49')]['includeAll']){_0x102972[_0x7db5('0x58')]=[{'all':!![]}];}return db[_0x7db5('0x9a')][_0x7db5('0x59')](_0x102972);})[_0x7db5('0x22')](function(_0x17613e){if(_0x3141a3['query'][_0x7db5('0x9e')]===_0x7db5('0x9f')){for(var _0x5e6e5f=0x0;_0x5e6e5f<_0x17613e['length'];_0x5e6e5f++){_0x17613e[_0x5e6e5f][_0x7db5('0x60')]=juice(_0x17613e[_0x5e6e5f][_0x7db5('0x60')]);}}_0x3bcfed[_0x7db5('0x5a')]=_0x17613e;return _0x3bcfed;});}})[_0x7db5('0x22')](respondWithFilteredResult(_0x1dcee7,_0x102972))[_0x7db5('0x2c')](handleError(_0x1dcee7,null));};exports[_0x7db5('0x3d')]=function(_0x5646fc,_0x1d397b,_0x10413d){var _0x386304,_0x1053f5={},_0x445710;if(_0x5646fc[_0x7db5('0x60')]['to']){_0x445710=_0x5646fc['body']['to'][_0x7db5('0xa0')](',')[0x0];}return db[_0x7db5('0x44')]['find']({'where':{'id':_0x5646fc[_0x7db5('0x61')]['id']},'include':[{'model':db[_0x7db5('0xa1')],'as':_0x7db5('0xa2'),'include':[{'model':db[_0x7db5('0x8b')],'as':_0x7db5('0xa3'),'where':{'email':_0x445710},'limit':0x1,'order':[[_0x7db5('0xa4'),_0x7db5('0xa5')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x7db5('0x22')](handleEntityNotFound(_0x1d397b,null))[_0x7db5('0x22')](function(_0x22ce48){if(_0x22ce48){_0x386304=_0x22ce48;if(_0x22ce48[_0x7db5('0x40')]){if(_['isNil'](_0x5646fc[_0x7db5('0x60')]['from'])){_0x5646fc['body'][_0x7db5('0xa6')]=util['format'](_0x7db5('0xa7'),_0x22ce48[_0x7db5('0x3c')],_0x22ce48[_0x7db5('0x6e')]||_0x22ce48[_0x7db5('0x40')][_0x7db5('0x73')]);}if(_0x5646fc['body'][_0x7db5('0xa8')]&&_0x5646fc[_0x7db5('0x60')][_0x7db5('0xa8')][_0x7db5('0x4e')]){for(var _0x32f62d=0x0;_0x32f62d<_0x5646fc['body']['attachments'][_0x7db5('0x4e')];_0x32f62d+=0x1){_0x5646fc[_0x7db5('0x60')][_0x7db5('0xa8')][_0x32f62d]={'filename':_0x5646fc[_0x7db5('0x60')][_0x7db5('0xa8')][_0x32f62d][_0x7db5('0x3c')],'path':path['join'](config[_0x7db5('0xa9')],_0x7db5('0xaa'),_0x5646fc[_0x7db5('0x60')][_0x7db5('0xa8')][_0x32f62d][_0x7db5('0xab')])};}}var _0x44db24={'tls':{'rejectUnauthorized':![]}};if(_[_0x7db5('0x6f')](_0x22ce48[_0x7db5('0x40')][_0x7db5('0x78')])){if(_0x22ce48['Smtp'][_0x7db5('0x75')]){_0x44db24[_0x7db5('0xac')]={'user':_0x22ce48['Smtp']['user'],'pass':_0x22ce48[_0x7db5('0x40')][_0x7db5('0xad')]};}_0x44db24[_0x7db5('0x76')]=_0x22ce48['Smtp'][_0x7db5('0x76')];_0x44db24['port']=_0x22ce48['Smtp'][_0x7db5('0x77')];_0x44db24[_0x7db5('0xae')]=_0x22ce48[_0x7db5('0x40')][_0x7db5('0xae')];}else{_0x44db24[_0x7db5('0x78')]=_0x22ce48[_0x7db5('0x40')][_0x7db5('0x78')];_0x44db24['auth']={'user':_0x22ce48[_0x7db5('0x40')]['user'],'pass':_0x22ce48[_0x7db5('0x40')]['pass']};}return respondWithRpcPromise('SendMail',_0x7db5('0xaf'),{'account':_0x44db24,'message':_0x5646fc[_0x7db5('0x60')]});}else{throw new Error(_0x7db5('0xb0'));}}})[_0x7db5('0x22')](function(_0x191716){if(_0x191716){_0x1053f5=_0x191716;if(_0x386304[_0x7db5('0xa2')]){if(_0x386304[_0x7db5('0xa2')][_0x7db5('0xa3')][_0x7db5('0x4e')]){return _0x386304[_0x7db5('0xa2')][_0x7db5('0xa3')][0x0];}else{return db[_0x7db5('0x8b')][_0x7db5('0x65')](_[_0x7db5('0x1b')](_0x5646fc['body'],{'firstName':_0x5646fc['body']['to'],'email':_0x5646fc[_0x7db5('0x60')]['to'],'phone':_0x5646fc[_0x7db5('0x60')]['to'],'ListId':_0x386304[_0x7db5('0xb1')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x7db5('0x22')](function(_0x25a409){if(_0x25a409){var _0x5868e9={'UserId':_0x5646fc[_0x7db5('0x73')]['id'],'ContactId':_0x25a409['id'],'MailAccountId':_0x386304['id'],'inReplyTo':_0x1053f5[_0x7db5('0xb2')],'to':_0x5646fc[_0x7db5('0x60')]['from'],'cc':_0x5646fc[_0x7db5('0x60')]['cc'],'subject':_0x5646fc[_0x7db5('0x60')][_0x7db5('0xb3')],'attach':_0x5646fc[_0x7db5('0x60')][_0x7db5('0xb4')],'firstMsgDirection':_0x7db5('0xb5'),'lastMsgAt':moment()[_0x7db5('0x9c')](_0x7db5('0x9d')),'lastMsgDirection':'out','lastMsgBody':_0x5646fc[_0x7db5('0x60')]['body'],'Messages':[_['merge'](_0x5646fc[_0x7db5('0x60')],{'messageId':_0x1053f5[_0x7db5('0xb2')],'sentAt':moment()[_0x7db5('0x9c')](_0x7db5('0x9d')),'read':!![],'MailAccountId':_0x386304['id'],'UserId':_0x5646fc[_0x7db5('0x73')]['id'],'ContactId':_0x25a409['id']})]};if(_0x5646fc['body'][_0x7db5('0xb6')]){_0x5868e9=_['merge'](_0x5868e9,_0x5646fc[_0x7db5('0x60')][_0x7db5('0xb6')]);}return db['MailInteraction'][_0x7db5('0x65')](_0x5868e9,{'include':[{'model':db[_0x7db5('0x9a')],'as':'Messages'}]});}})[_0x7db5('0x22')](respondWithResult(_0x1d397b,null))[_0x7db5('0x2c')](handleError(_0x1d397b,null));};exports[_0x7db5('0xb7')]=function(_0x1b3126,_0x23d915,_0x3b21d4){return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x1b3126[_0x7db5('0x61')]['id']},'include':[{'model':db[_0x7db5('0x3f')],'as':_0x7db5('0x40'),'raw':!![]}]})[_0x7db5('0x22')](handleEntityNotFound(_0x23d915,null))[_0x7db5('0x22')](function(_0x14a20c){if(_0x14a20c&&_0x14a20c[_0x7db5('0x40')]){var _0x394a8a={'id':_0x14a20c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14a20c[_0x7db5('0x40')][_0x7db5('0x78')]){_0x394a8a['service']=_0x14a20c['Smtp'][_0x7db5('0x78')];}else{_0x394a8a[_0x7db5('0x76')]=_0x14a20c['Smtp'][_0x7db5('0x76')];_0x394a8a[_0x7db5('0x77')]=_0x14a20c[_0x7db5('0x40')][_0x7db5('0x77')];_0x394a8a[_0x7db5('0xae')]=_0x14a20c[_0x7db5('0x40')][_0x7db5('0xae')];}if(_0x14a20c['Smtp']['authentication']){_0x394a8a[_0x7db5('0xac')]={'user':_0x14a20c[_0x7db5('0x40')][_0x7db5('0x73')],'pass':_0x14a20c[_0x7db5('0x40')][_0x7db5('0xad')]};}return respondWithRpcPromise(_0x7db5('0xb8'),_0x7db5('0xb7'),{'account':_0x394a8a});}})[_0x7db5('0x22')](respondWithResult(_0x23d915,null))[_0x7db5('0x2c')](handleError(_0x23d915,null));};exports[_0x7db5('0x37')]=function(_0x4c5faf,_0xf36e3a){return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x4c5faf[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0xf36e3a,null))[_0x7db5('0x22')](function(_0x585020){if(_0x585020&&_0x585020[_0x7db5('0x78')]){throw new db[(_0x7db5('0xb9'))][(_0x7db5('0xba'))](_0x7db5('0xbb'));}return _0x585020;})['then'](removeEntity(_0xf36e3a,null))[_0x7db5('0x2c')](handleError(_0xf36e3a,null));};exports[_0x7db5('0xbc')]=function(_0x19c483,_0x7edb90,_0x35470c){return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x19c483[_0x7db5('0x61')]['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x7edb90,null))[_0x7db5('0x22')](function(_0x97237e){if(_0x97237e){return _0x97237e[_0x7db5('0xbc')](_0x19c483[_0x7db5('0x60')]['ids'],_[_0x7db5('0x89')](_0x19c483[_0x7db5('0x60')],[_0x7db5('0x88'),'id'])||{})[_0x7db5('0xbd')](function(_0x552b1f){for(var _0x359291=0x0;_0x359291<_0x19c483[_0x7db5('0x60')][_0x7db5('0x88')][_0x7db5('0x4e')];_0x359291+=0x1){socket[_0x7db5('0xbe')](_0x7db5('0xbf'),{'UserId':_0x19c483['body'][_0x7db5('0x88')][_0x359291],'MailAccountId':_0x19c483['params']['id']});}return _0x552b1f;});}})[_0x7db5('0x22')](respondWithResult(_0x7edb90,null))[_0x7db5('0x2c')](handleError(_0x7edb90,null));};exports[_0x7db5('0xc0')]=function(_0x3dd1d5,_0x296cf4,_0x3efff7){return db[_0x7db5('0x44')][_0x7db5('0x5f')]({'where':{'id':_0x3dd1d5['params']['id']}})['then'](handleEntityNotFound(_0x296cf4,null))[_0x7db5('0x22')](function(_0x26c621){if(_0x26c621){return _0x26c621[_0x7db5('0xc0')](_0x3dd1d5[_0x7db5('0x49')][_0x7db5('0x88')])[_0x7db5('0x22')](function(){if(_[_0x7db5('0xc1')](_0x3dd1d5[_0x7db5('0x49')][_0x7db5('0x88')])){for(var _0x4645df=0x0;_0x4645df<_0x3dd1d5[_0x7db5('0x49')][_0x7db5('0x88')][_0x7db5('0x4e')];_0x4645df+=0x1){socket[_0x7db5('0xbe')](_0x7db5('0xc2'),{'UserId':Number(_0x3dd1d5[_0x7db5('0x49')][_0x7db5('0x88')][_0x4645df]),'MailAccountId':Number(_0x3dd1d5[_0x7db5('0x61')]['id'])});}}else{socket[_0x7db5('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x3dd1d5[_0x7db5('0x49')][_0x7db5('0x88')]),'MailAccountId':Number(_0x3dd1d5[_0x7db5('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x296cf4,null))[_0x7db5('0x2c')](handleError(_0x296cf4,null));};exports[_0x7db5('0xc3')]=function(_0x4d06a7,_0x1871a7,_0x39f110){var _0x1d0313={};var _0x5c1a89={};var _0x1bf457;var _0x2ede41;return db['MailAccount'][_0x7db5('0x67')]({'where':{'id':_0x4d06a7['params']['id']}})[_0x7db5('0x22')](handleEntityNotFound(_0x1871a7,null))['then'](function(_0x5c3ef6){if(_0x5c3ef6){_0x1bf457=_0x5c3ef6;_0x5c1a89[_0x7db5('0x48')]=_[_0x7db5('0x5d')](db[_0x7db5('0x8d')][_0x7db5('0x45')]);_0x5c1a89[_0x7db5('0x49')]=_[_0x7db5('0x5d')](_0x4d06a7[_0x7db5('0x49')]);_0x5c1a89[_0x7db5('0x4a')]=_[_0x7db5('0x4b')](_0x5c1a89[_0x7db5('0x48')],_0x5c1a89[_0x7db5('0x49')]);_0x1d0313[_0x7db5('0x4c')]=_[_0x7db5('0x4b')](_0x5c1a89[_0x7db5('0x48')],qs[_0x7db5('0x4d')](_0x4d06a7[_0x7db5('0x49')][_0x7db5('0x4d')]));_0x1d0313[_0x7db5('0x4c')]=_0x1d0313[_0x7db5('0x4c')]['length']?_0x1d0313['attributes']:_0x5c1a89[_0x7db5('0x48')];_0x1d0313[_0x7db5('0x6c')]=qs[_0x7db5('0x51')](_0x4d06a7[_0x7db5('0x49')]['sort']);_0x1d0313[_0x7db5('0x54')]=qs['filters'](_['pick'](_0x4d06a7[_0x7db5('0x49')],_0x5c1a89[_0x7db5('0x4a')]));if(_0x4d06a7['query'][_0x7db5('0x53')]){_0x1d0313[_0x7db5('0x54')]=_[_0x7db5('0x55')](_0x1d0313[_0x7db5('0x54')],{'$or':_['map'](_0x1d0313['attributes'],function(_0x521fe7){var _0x29dd85={};_0x29dd85[_0x521fe7]={'$like':'%'+_0x4d06a7[_0x7db5('0x49')][_0x7db5('0x53')]+'%'};return _0x29dd85;})});}_0x1d0313=_[_0x7db5('0x55')]({},_0x1d0313,_0x4d06a7[_0x7db5('0x56')]);return _0x1bf457[_0x7db5('0xc3')](_0x1d0313);}})[_0x7db5('0x22')](function(_0x33e99a){if(_0x33e99a){_0x2ede41=_0x33e99a[_0x7db5('0x4e')];if(!_0x4d06a7[_0x7db5('0x49')][_0x7db5('0x4f')](_0x7db5('0x50'))){_0x1d0313[_0x7db5('0x30')]=qs[_0x7db5('0x30')](_0x4d06a7['query'][_0x7db5('0x30')]);_0x1d0313[_0x7db5('0x2f')]=qs['offset'](_0x4d06a7['query'][_0x7db5('0x2f')]);}return _0x1bf457[_0x7db5('0xc3')](_0x1d0313);}})[_0x7db5('0x22')](function(_0x2d7608){if(_0x2d7608){return _0x2d7608?{'count':_0x2ede41,'rows':_0x2d7608}:null;}})[_0x7db5('0x22')](respondWithResult(_0x1871a7,null))[_0x7db5('0x2c')](handleError(_0x1871a7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 17a890e..6992127 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 _0xe534=['MailAccount','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xe534,0x1de));var _0x4e53=function(_0x318cf9,_0x211c1d){_0x318cf9=_0x318cf9-0x0;var _0x3f5157=_0xe534[_0x318cf9];return _0x3f5157;};'use strict';var EventEmitter=require(_0x4e53('0x0'));var MailAccount=require(_0x4e53('0x1'))['db'][_0x4e53('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4e53('0x3')](0x0);var events={'afterCreate':_0x4e53('0x4'),'afterUpdate':'update','afterDestroy':_0x4e53('0x5')};function emitEvent(_0x51b970){return function(_0x2f2ee0,_0x20247a,_0x2e52fa){MailAccountEvents[_0x4e53('0x6')](_0x51b970+':'+_0x2f2ee0['id'],_0x2f2ee0);MailAccountEvents[_0x4e53('0x6')](_0x51b970,_0x2f2ee0);_0x2e52fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4e53('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x36fc=['remove','emit','hook','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x45449e,_0x54218a){var _0x23119f=function(_0x837d24){while(--_0x837d24){_0x45449e['push'](_0x45449e['shift']());}};_0x23119f(++_0x54218a);}(_0x36fc,0x161));var _0xc36f=function(_0x293b23,_0x2de1f9){_0x293b23=_0x293b23-0x0;var _0x62d976=_0x36fc[_0x293b23];return _0x62d976;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xc36f('0x0'))['db'][_0xc36f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc36f('0x2')](0x0);var events={'afterCreate':_0xc36f('0x3'),'afterUpdate':'update','afterDestroy':_0xc36f('0x4')};function emitEvent(_0x82dff){return function(_0x2c24d3,_0x47d396,_0x3d6a5a){MailAccountEvents[_0xc36f('0x5')](_0x82dff+':'+_0x2c24d3['id'],_0x2c24d3);MailAccountEvents[_0xc36f('0x5')](_0x82dff,_0x2c24d3);_0x3d6a5a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xc36f('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4930ce4..7cc79c4 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 _0xbed6=['util','../../config/logger','api','path','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x4d7745,_0x9e5377){var _0x39e099=function(_0x50a7ca){while(--_0x50a7ca){_0x4d7745['push'](_0x4d7745['shift']());}};_0x39e099(++_0x9e5377);}(_0xbed6,0x172));var _0x6bed=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xbed6[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x6bed('0x0'));var logger=require(_0x6bed('0x1'))(_0x6bed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bed('0x3'));var rimraf=require(_0x6bed('0x4'));var config=require(_0x6bed('0x5'));var attributes=require(_0x6bed('0x6'));module[_0x6bed('0x7')]=function(_0x216710,_0x359ca9){return _0x216710['define'](_0x6bed('0x8'),attributes,{'tableName':_0x6bed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6836=['../../config/logger','moment','request-promise','rimraf','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util'];(function(_0x4d6675,_0x23beaa){var _0x2bd5bc=function(_0x573d07){while(--_0x573d07){_0x4d6675['push'](_0x4d6675['shift']());}};_0x2bd5bc(++_0x23beaa);}(_0x6836,0x1c0));var _0x6683=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x6836[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var logger=require(_0x6683('0x2'))('api');var moment=require(_0x6683('0x3'));var BPromise=require('bluebird');var rp=require(_0x6683('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6683('0x5'));var config=require('../../config/environment');var attributes=require(_0x6683('0x6'));module[_0x6683('0x7')]=function(_0xd59091,_0x452f17){return _0xd59091['define'](_0x6683('0x8'),attributes,{'tableName':_0x6683('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 85e0d21..7fb044a 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 _0x6584=['debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','MailAccount,\x20%s,\x20%s','result','catch','GetMailAccount','findAll','options','where','attributes','limit','include','map','model','ShowMailAccount','find','raw','body','mail','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','MailAccount','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','get','omit','list','applications','orderBy','autoclose','push','close','*,*,*,*','length','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','spread','subject','interaction','attachments','originCc','bcc','Attachment','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','request\x20sent'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6584,0x175));var _0x4658=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x6584[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0x4658('0x0'));var util=require(_0x4658('0x1'));var moment=require(_0x4658('0x2'));var BPromise=require(_0x4658('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4658('0x4'));var db=require(_0x4658('0x5'))['db'];var utils=require(_0x4658('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4658('0x7'));var jayson=require(_0x4658('0x8'));var client=jayson[_0x4658('0x9')][_0x4658('0xa')]({'port':0x232c});config[_0x4658('0xb')]=_['defaults'](config[_0x4658('0xb')],{'host':_0x4658('0xc'),'port':0x18eb});var socket=require(_0x4658('0xd'))(new Redis(config['redis']));require(_0x4658('0xe'))[_0x4658('0xf')](socket);function respondWithRpcPromise(_0x570ef0,_0x5117fc,_0x429f7a){return new BPromise(function(_0x49ec37,_0x309489){return client['request'](_0x570ef0,_0x429f7a)[_0x4658('0x10')](function(_0x5b0145){logger[_0x4658('0x11')]('MailAccount,\x20%s,\x20%s',_0x5117fc,_0x4658('0x12'));logger[_0x4658('0x13')](_0x4658('0x14'),_0x5117fc,_0x4658('0x12'),JSON[_0x4658('0x15')](_0x5b0145));if(_0x5b0145[_0x4658('0x16')]){if(_0x5b0145['error']['code']===0x1f4){logger[_0x4658('0x16')]('MailAccount,\x20%s,\x20%s',_0x5117fc,_0x5b0145[_0x4658('0x16')]['message']);return _0x309489(_0x5b0145[_0x4658('0x16')][_0x4658('0x17')]);}logger['error'](_0x4658('0x18'),_0x5117fc,_0x5b0145['error']['message']);return _0x49ec37(_0x5b0145['error'][_0x4658('0x17')]);}else{logger['info'](_0x4658('0x18'),_0x5117fc,_0x4658('0x12'));_0x49ec37(_0x5b0145[_0x4658('0x19')][_0x4658('0x17')]);}})[_0x4658('0x1a')](function(_0x30bf0d){logger['error'](_0x4658('0x18'),_0x5117fc,_0x30bf0d);_0x309489(_0x30bf0d);});});}exports[_0x4658('0x1b')]=function(_0x27cde7){var _0xb5b83e=this;return new Promise(function(_0x18581f,_0x2e926f){return db['MailAccount'][_0x4658('0x1c')]({'raw':_0x27cde7[_0x4658('0x1d')]?_0x27cde7[_0x4658('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x27cde7[_0x4658('0x1d')]?_0x27cde7[_0x4658('0x1d')][_0x4658('0x1e')]||null:null,'attributes':_0x27cde7[_0x4658('0x1d')]?_0x27cde7[_0x4658('0x1d')][_0x4658('0x1f')]||null:null,'limit':_0x27cde7[_0x4658('0x1d')]?_0x27cde7['options'][_0x4658('0x20')]||null:null,'include':_0x27cde7['options']?_0x27cde7[_0x4658('0x1d')][_0x4658('0x21')]?_[_0x4658('0x22')](_0x27cde7[_0x4658('0x1d')][_0x4658('0x21')],function(_0x58f99a){return{'model':db[_0x58f99a[_0x4658('0x23')]],'as':_0x58f99a['as'],'attributes':_0x58f99a[_0x4658('0x1f')],'include':_0x58f99a[_0x4658('0x21')]?_[_0x4658('0x22')](_0x58f99a[_0x4658('0x21')],function(_0x2e8dc8){return{'model':db[_0x2e8dc8[_0x4658('0x23')]],'as':_0x2e8dc8['as'],'attributes':_0x2e8dc8[_0x4658('0x1f')],'include':_0x2e8dc8[_0x4658('0x21')]?_['map'](_0x2e8dc8[_0x4658('0x21')],function(_0x274edd){return{'model':db[_0x274edd[_0x4658('0x23')]],'as':_0x274edd['as'],'attributes':_0x274edd[_0x4658('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb2a131){logger[_0x4658('0x11')](_0x4658('0x1b'),_0x27cde7);logger[_0x4658('0x13')](_0x4658('0x1b'),_0x27cde7,JSON['stringify'](_0xb2a131));_0x18581f(_0xb2a131);})[_0x4658('0x1a')](function(_0x57653e){logger[_0x4658('0x16')](_0x4658('0x1b'),_0x57653e[_0x4658('0x17')],_0x27cde7);_0x2e926f(_0xb5b83e['error'](0x1f4,_0x57653e[_0x4658('0x17')]));});});};exports[_0x4658('0x24')]=function(_0x2fd873){var _0x12db43=this;return new Promise(function(_0x29ff03,_0x44a88b){return db['MailAccount'][_0x4658('0x25')]({'raw':_0x2fd873[_0x4658('0x1d')]?_0x2fd873[_0x4658('0x1d')][_0x4658('0x26')]===undefined?!![]:![]:!![],'where':_0x2fd873['options']?_0x2fd873[_0x4658('0x1d')][_0x4658('0x1e')]||null:null,'attributes':_0x2fd873[_0x4658('0x1d')]?_0x2fd873['options']['attributes']||null:null,'include':_0x2fd873[_0x4658('0x1d')]?_0x2fd873[_0x4658('0x1d')][_0x4658('0x21')]?_['map'](_0x2fd873[_0x4658('0x1d')][_0x4658('0x21')],function(_0x108fa6){return{'model':db[_0x108fa6['model']],'as':_0x108fa6['as'],'attributes':_0x108fa6[_0x4658('0x1f')],'include':_0x108fa6[_0x4658('0x21')]?_[_0x4658('0x22')](_0x108fa6[_0x4658('0x21')],function(_0x21910c){return{'model':db[_0x21910c[_0x4658('0x23')]],'as':_0x21910c['as'],'attributes':_0x21910c[_0x4658('0x1f')],'include':_0x21910c[_0x4658('0x21')]?_[_0x4658('0x22')](_0x21910c[_0x4658('0x21')],function(_0x38bfb7){return{'model':db[_0x38bfb7[_0x4658('0x23')]],'as':_0x38bfb7['as'],'attributes':_0x38bfb7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4658('0x10')](function(_0x3dd9a7){logger[_0x4658('0x11')]('ShowMailAccount',_0x2fd873);logger[_0x4658('0x13')]('ShowMailAccount',_0x2fd873,JSON[_0x4658('0x15')](_0x3dd9a7));_0x29ff03(_0x3dd9a7);})[_0x4658('0x1a')](function(_0x5a2d1a){logger[_0x4658('0x16')](_0x4658('0x24'),_0x5a2d1a[_0x4658('0x17')],_0x2fd873);_0x44a88b(_0x12db43[_0x4658('0x16')](0x1f4,_0x5a2d1a[_0x4658('0x17')]));});});};exports['NotifyMailAccount']=function(_0x169602){var _0x5c8f7d=this;return new Promise(function(_0x205918,_0x34ebc0){var _0xe69f16={'body':_0x169602[_0x4658('0x27')],'channel':_0x4658('0x28')};var _0x5dc236=_[_0x4658('0x29')](_['keys'](db[_0x4658('0x2a')]['rawAttributes']),[_0x4658('0x2b'),_0x4658('0x2c'),_0x4658('0x2d'),_0x4658('0x2e')]);var _0x1eca32=![];if(_0x169602[_0x4658('0x27')]['id']){delete _0x169602[_0x4658('0x27')]['id'];}if(_['isNil'](_0x169602[_0x4658('0x27')]['from'])){return _0x34ebc0(_0x5c8f7d[_0x4658('0x16')](0x1f4,_0x4658('0x2f')));}if(_[_0x4658('0x30')](_0x169602['body'][_0x4658('0x27')])||_0x169602['body']['body']===''){return _0x34ebc0(_0x5c8f7d[_0x4658('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4658('0x30')](_0x169602['body'][_0x4658('0x31')])){return _0x34ebc0(_0x5c8f7d['error'](0x1f4,_0x4658('0x32')+_0x5dc236));}if(!_[_0x4658('0x33')](_0x5dc236,_0x169602['body'][_0x4658('0x31')])){return _0x34ebc0(_0x5c8f7d[_0x4658('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dc236));}var _0xf20b57={};_0xf20b57[_0x169602[_0x4658('0x27')]['mapKey']]=_0x169602[_0x4658('0x27')][_0x4658('0x34')];return db[_0x4658('0x35')][_0x4658('0x25')]({'where':{'id':_0x169602[_0x4658('0x36')]['id']},'include':[{'model':db[_0x4658('0x37')],'as':_0x4658('0x38'),'include':[{'model':db[_0x4658('0x2a')],'as':_0x4658('0x39'),'where':_0xf20b57,'limit':0x1,'order':[[_0x4658('0x2c'),_0x4658('0x3a')]]}]},{'model':db[_0x4658('0x3b')],'as':_0x4658('0x3c')},{'model':db['MailServerOut'],'as':_0x4658('0x3d')}]})['then'](function(_0x5c93c0){if(_0x5c93c0&&_0x5c93c0['List']){var _0x47f7fe=_0x5c93c0[_0x4658('0x3e')]({'plain':!![]});_0xe69f16[_0x4658('0x36')]=_[_0x4658('0x3f')](_0x47f7fe,[_0x4658('0x3c'),_0x4658('0x38')]);_0xe69f16['applications']=_0x47f7fe[_0x4658('0x3c')];_0xe69f16[_0x4658('0x40')]=_0x47f7fe['List'];_0xe69f16[_0x4658('0x41')]=_[_0x4658('0x42')](_0xe69f16['applications'],['priority'],['asc']);if(_0xe69f16[_0x4658('0x36')]&&_0xe69f16[_0x4658('0x36')][_0x4658('0x43')]){_0xe69f16[_0x4658('0x41')][_0x4658('0x44')]({'id':0x0,'priority':_0xe69f16[_0x4658('0x41')]['length']+0x1,'app':_0x4658('0x45'),'appdata':_0x4658('0x43'),'interval':_0x4658('0x46')});}if(_0xe69f16[_0x4658('0x36')][_0x4658('0x3c')]){delete _0xe69f16[_0x4658('0x36')]['Applications'];}if(_0xe69f16[_0x4658('0x36')][_0x4658('0x38')]){delete _0xe69f16[_0x4658('0x36')][_0x4658('0x38')];}if(_0x47f7fe[_0x4658('0x38')][_0x4658('0x39')][_0x4658('0x47')]){return _0x47f7fe[_0x4658('0x38')][_0x4658('0x39')][0x0];}var _0x2abc78=_['defaults'](_0x169602[_0x4658('0x27')],{'firstName':_0x169602[_0x4658('0x27')]['from'],'ListId':_0x47f7fe[_0x4658('0x2e')]});_0x2abc78[_0x169602[_0x4658('0x27')][_0x4658('0x31')]]=_0x169602[_0x4658('0x27')][_0x4658('0x34')];return db[_0x4658('0x2a')]['create'](_0x2abc78);}else{throw new Error(_0x4658('0x48'));}})['then'](function(_0x4ccccd){_0xe69f16[_0x4658('0x49')]=_0x4ccccd;if(_0x4ccccd){if(!_0x169602['body']['message'][_0x4658('0x4a')]){_0x169602[_0x4658('0x27')][_0x4658('0x17')]['messageId']=rs['generate']()+'\x20'+_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x34')];}var _0x4ba45b={'ContactId':_0x4ccccd['id'],'MailAccountId':_0x169602[_0x4658('0x36')]['id'],'inReplyTo':_0x169602[_0x4658('0x27')]['message'][_0x4658('0x4a')],'to':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x34')],'cc':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['cc'],'subject':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['subject'],'attach':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x4b')],'lastMsgAt':moment()[_0x4658('0x4c')](_0x4658('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x169602[_0x4658('0x27')][_0x4658('0x27')]};return db[_0x4658('0x4e')][_0x4658('0x25')]({'where':{'closed':![],'MailAccountId':_0x169602['account']['id']},'include':[{'model':db[_0x4658('0x4f')],'as':_0x4658('0x50'),'attributes':[_0x4658('0x4a')],'where':{'messageId':_0x169602[_0x4658('0x27')]['message'][_0x4658('0x51')]}}]})['then'](function(_0x5b0a63){if(_0x5b0a63){return[_0x5b0a63,![]];}return db[_0x4658('0x4e')][_0x4658('0x52')](_0x4ba45b)['then'](function(_0x5e7b6a){return[_0x5e7b6a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4658('0x53')](function(_0x1ab4b4,_0x3fa0ec){if(_0x1ab4b4){_0x1eca32=_0x3fa0ec;if(!_0x3fa0ec){return _0x1ab4b4['update']({'inReplyTo':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['messageId'],'to':_0x169602['body']['message'][_0x4658('0x34')],'cc':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['cc'],'subject':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x54')],'attach':_0x1ab4b4['attach']?_0x1ab4b4['attach']:_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x4b')],'substatus':null,'substatusAt':moment()['format'](_0x4658('0x4d')),'lastMsgAt':moment()['format'](_0x4658('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x169602[_0x4658('0x27')]['body']});}else{return _0x1ab4b4;}}})['then'](function(_0x590b25){_0xe69f16['interaction']=_0x590b25['get']({'plain':!![]});_0xe69f16[_0x4658('0x55')]['created']=_0x1eca32;return db[_0x4658('0x4f')][_0x4658('0x52')]({'body':_0x169602['body'][_0x4658('0x27')],'MailAccountId':_0x169602['account']['id'],'MailInteractionId':_0x590b25['id'],'direction':'in','ContactId':_0xe69f16['contact']['id'],'messageId':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x4a')],'from':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x34')],'to':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['to'],'cc':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['cc'],'subject':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x54')],'attach':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['attach'],'Attachments':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x56')],'originTo':_0x169602[_0x4658('0x27')][_0x4658('0x17')]['originTo'],'originCc':_0x169602['body'][_0x4658('0x17')][_0x4658('0x57')],'bcc':_0x169602[_0x4658('0x27')][_0x4658('0x17')][_0x4658('0x58')]},{'include':[{'model':db[_0x4658('0x59')],'as':'Attachments'}]});})['then'](function(_0x33ee49){_0xe69f16[_0x4658('0x17')]=_0x33ee49;if(_0xe69f16[_0x4658('0x55')][_0x4658('0x5a')]){return db[_0x4658('0x5b')][_0x4658('0x25')]({'attributes':['id','name'],'where':{'id':_0xe69f16[_0x4658('0x55')][_0x4658('0x5a')]}})[_0x4658('0x10')](function(_0xb30c31){if(_0xb30c31){_0xe69f16[_0x4658('0x41')][_0x4658('0x5c')]({'id':0x0,'priority':0x0,'app':_0x4658('0x5d'),'appdata':_0xb30c31[_0x4658('0x5e')]+','+(_0xe69f16[_0x4658('0x36')][_0x4658('0x5f')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4658('0x60'),_0x4658('0x61'),_0xe69f16);});}return respondWithRpcPromise(_0x4658('0x60'),'startRouting',_0xe69f16);})[_0x4658('0x10')](function(_0x217056){_0x205918(_0x217056);})[_0x4658('0x1a')](function(_0x1d4e2e){_0x34ebc0(_0x5c8f7d['error'](0x1f4,_0x1d4e2e[_0x4658('0x17')]));});});}; \ No newline at end of file +var _0xfa20=['length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','originTo','originCc','bcc','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','MailAccount','findAll','options','raw','attributes','include','map','model','GetMailAccount','find','where','ShowMailAccount','stringify','body','mail','keys','CmContact','rawAttributes','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','Contacts','MailApplication','Applications','Smtp','List','get','omit','applications','list','orderBy','priority','asc','push','close','*,*,*,*'];(function(_0x5da5bc,_0x1f422c){var _0x5ae2a8=function(_0x179112){while(--_0x179112){_0x5da5bc['push'](_0x5da5bc['shift']());}};_0x5ae2a8(++_0x1f422c);}(_0xfa20,0x141));var _0x0fa2=function(_0xe850e8,_0x3f0e95){_0xe850e8=_0xe850e8-0x0;var _0x2532ac=_0xfa20[_0xe850e8];return _0x2532ac;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var moment=require(_0x0fa2('0x2'));var BPromise=require(_0x0fa2('0x3'));var rs=require(_0x0fa2('0x4'));var fs=require('fs');var Redis=require(_0x0fa2('0x5'));var db=require(_0x0fa2('0x6'))['db'];var utils=require(_0x0fa2('0x7'));var logger=require(_0x0fa2('0x8'))(_0x0fa2('0x9'));var config=require(_0x0fa2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0fa2('0xb')][_0x0fa2('0xc')]({'port':0x232c});config['redis']=_[_0x0fa2('0xd')](config[_0x0fa2('0xe')],{'host':_0x0fa2('0xf'),'port':0x18eb});var socket=require(_0x0fa2('0x10'))(new Redis(config[_0x0fa2('0xe')]));require(_0x0fa2('0x11'))[_0x0fa2('0x12')](socket);function respondWithRpcPromise(_0x373af0,_0x108f55,_0x445a5d){return new BPromise(function(_0x5c59dc,_0xd34dd5){return client[_0x0fa2('0x13')](_0x373af0,_0x445a5d)[_0x0fa2('0x14')](function(_0x434f22){logger[_0x0fa2('0x15')](_0x0fa2('0x16'),_0x108f55,_0x0fa2('0x17'));logger[_0x0fa2('0x18')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x108f55,_0x0fa2('0x17'),JSON['stringify'](_0x434f22));if(_0x434f22[_0x0fa2('0x19')]){if(_0x434f22['error']['code']===0x1f4){logger['error'](_0x0fa2('0x16'),_0x108f55,_0x434f22[_0x0fa2('0x19')][_0x0fa2('0x1a')]);return _0xd34dd5(_0x434f22[_0x0fa2('0x19')][_0x0fa2('0x1a')]);}logger[_0x0fa2('0x19')](_0x0fa2('0x16'),_0x108f55,_0x434f22[_0x0fa2('0x19')]['message']);return _0x5c59dc(_0x434f22[_0x0fa2('0x19')][_0x0fa2('0x1a')]);}else{logger[_0x0fa2('0x15')](_0x0fa2('0x16'),_0x108f55,_0x0fa2('0x17'));_0x5c59dc(_0x434f22[_0x0fa2('0x1b')][_0x0fa2('0x1a')]);}})[_0x0fa2('0x1c')](function(_0x73fca5){logger[_0x0fa2('0x19')]('MailAccount,\x20%s,\x20%s',_0x108f55,_0x73fca5);_0xd34dd5(_0x73fca5);});});}exports['GetMailAccount']=function(_0x13b72e){var _0x22cca6=this;return new Promise(function(_0x47c72b,_0x383ebd){return db[_0x0fa2('0x1d')][_0x0fa2('0x1e')]({'raw':_0x13b72e['options']?_0x13b72e[_0x0fa2('0x1f')][_0x0fa2('0x20')]===undefined?!![]:![]:!![],'where':_0x13b72e['options']?_0x13b72e[_0x0fa2('0x1f')]['where']||null:null,'attributes':_0x13b72e[_0x0fa2('0x1f')]?_0x13b72e[_0x0fa2('0x1f')][_0x0fa2('0x21')]||null:null,'limit':_0x13b72e[_0x0fa2('0x1f')]?_0x13b72e[_0x0fa2('0x1f')]['limit']||null:null,'include':_0x13b72e[_0x0fa2('0x1f')]?_0x13b72e[_0x0fa2('0x1f')][_0x0fa2('0x22')]?_[_0x0fa2('0x23')](_0x13b72e[_0x0fa2('0x1f')][_0x0fa2('0x22')],function(_0x38a2c4){return{'model':db[_0x38a2c4['model']],'as':_0x38a2c4['as'],'attributes':_0x38a2c4[_0x0fa2('0x21')],'include':_0x38a2c4['include']?_[_0x0fa2('0x23')](_0x38a2c4['include'],function(_0x1a8832){return{'model':db[_0x1a8832[_0x0fa2('0x24')]],'as':_0x1a8832['as'],'attributes':_0x1a8832[_0x0fa2('0x21')],'include':_0x1a8832[_0x0fa2('0x22')]?_[_0x0fa2('0x23')](_0x1a8832[_0x0fa2('0x22')],function(_0x50779a){return{'model':db[_0x50779a[_0x0fa2('0x24')]],'as':_0x50779a['as'],'attributes':_0x50779a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12b59a){logger[_0x0fa2('0x15')](_0x0fa2('0x25'),_0x13b72e);logger['debug']('GetMailAccount',_0x13b72e,JSON['stringify'](_0x12b59a));_0x47c72b(_0x12b59a);})['catch'](function(_0x4de0e7){logger[_0x0fa2('0x19')](_0x0fa2('0x25'),_0x4de0e7[_0x0fa2('0x1a')],_0x13b72e);_0x383ebd(_0x22cca6[_0x0fa2('0x19')](0x1f4,_0x4de0e7['message']));});});};exports['ShowMailAccount']=function(_0x47af3a){var _0x107d8e=this;return new Promise(function(_0x59bfbb,_0x3b5d3d){return db[_0x0fa2('0x1d')][_0x0fa2('0x26')]({'raw':_0x47af3a['options']?_0x47af3a['options'][_0x0fa2('0x20')]===undefined?!![]:![]:!![],'where':_0x47af3a[_0x0fa2('0x1f')]?_0x47af3a[_0x0fa2('0x1f')][_0x0fa2('0x27')]||null:null,'attributes':_0x47af3a[_0x0fa2('0x1f')]?_0x47af3a[_0x0fa2('0x1f')][_0x0fa2('0x21')]||null:null,'include':_0x47af3a[_0x0fa2('0x1f')]?_0x47af3a[_0x0fa2('0x1f')][_0x0fa2('0x22')]?_[_0x0fa2('0x23')](_0x47af3a[_0x0fa2('0x1f')][_0x0fa2('0x22')],function(_0x2a6317){return{'model':db[_0x2a6317[_0x0fa2('0x24')]],'as':_0x2a6317['as'],'attributes':_0x2a6317[_0x0fa2('0x21')],'include':_0x2a6317[_0x0fa2('0x22')]?_[_0x0fa2('0x23')](_0x2a6317['include'],function(_0x52ed7a){return{'model':db[_0x52ed7a[_0x0fa2('0x24')]],'as':_0x52ed7a['as'],'attributes':_0x52ed7a[_0x0fa2('0x21')],'include':_0x52ed7a[_0x0fa2('0x22')]?_[_0x0fa2('0x23')](_0x52ed7a[_0x0fa2('0x22')],function(_0x4526e7){return{'model':db[_0x4526e7['model']],'as':_0x4526e7['as'],'attributes':_0x4526e7[_0x0fa2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fa2('0x14')](function(_0x3659aa){logger[_0x0fa2('0x15')](_0x0fa2('0x28'),_0x47af3a);logger['debug'](_0x0fa2('0x28'),_0x47af3a,JSON[_0x0fa2('0x29')](_0x3659aa));_0x59bfbb(_0x3659aa);})['catch'](function(_0x15e04f){logger[_0x0fa2('0x19')](_0x0fa2('0x28'),_0x15e04f['message'],_0x47af3a);_0x3b5d3d(_0x107d8e['error'](0x1f4,_0x15e04f['message']));});});};exports['NotifyMailAccount']=function(_0x123155){var _0x25b5cb=this;return new Promise(function(_0x43dc89,_0x481e1e){var _0x5084f6={'body':_0x123155[_0x0fa2('0x2a')],'channel':_0x0fa2('0x2b')};var _0x196297=_['difference'](_[_0x0fa2('0x2c')](db[_0x0fa2('0x2d')][_0x0fa2('0x2e')]),['createdAt',_0x0fa2('0x2f'),'CompanyId',_0x0fa2('0x30')]);var _0x5c4324=![];if(_0x123155['body']['id']){delete _0x123155[_0x0fa2('0x2a')]['id'];}if(_[_0x0fa2('0x31')](_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x32')])){return _0x481e1e(_0x25b5cb['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0fa2('0x31')](_0x123155['body'][_0x0fa2('0x2a')])||_0x123155[_0x0fa2('0x2a')]['body']===''){return _0x481e1e(_0x25b5cb[_0x0fa2('0x19')](0x1f4,_0x0fa2('0x33')));}if(_[_0x0fa2('0x31')](_0x123155[_0x0fa2('0x2a')]['mapKey'])){return _0x481e1e(_0x25b5cb['error'](0x1f4,_0x0fa2('0x34')+_0x196297));}if(!_['includes'](_0x196297,_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x35')])){return _0x481e1e(_0x25b5cb[_0x0fa2('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x196297));}var _0x17f916={};_0x17f916[_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x35')]]=_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x32')];return db[_0x0fa2('0x1d')][_0x0fa2('0x26')]({'where':{'id':_0x123155[_0x0fa2('0x36')]['id']},'include':[{'model':db[_0x0fa2('0x37')],'as':'List','include':[{'model':db[_0x0fa2('0x2d')],'as':_0x0fa2('0x38'),'where':_0x17f916,'limit':0x1,'order':[[_0x0fa2('0x2f'),'DESC']]}]},{'model':db[_0x0fa2('0x39')],'as':_0x0fa2('0x3a')},{'model':db['MailServerOut'],'as':_0x0fa2('0x3b')}]})['then'](function(_0x2ed220){if(_0x2ed220&&_0x2ed220[_0x0fa2('0x3c')]){var _0x1d3eeb=_0x2ed220[_0x0fa2('0x3d')]({'plain':!![]});_0x5084f6[_0x0fa2('0x36')]=_[_0x0fa2('0x3e')](_0x1d3eeb,[_0x0fa2('0x3a'),_0x0fa2('0x3c')]);_0x5084f6[_0x0fa2('0x3f')]=_0x1d3eeb['Applications'];_0x5084f6[_0x0fa2('0x40')]=_0x1d3eeb['List'];_0x5084f6[_0x0fa2('0x3f')]=_[_0x0fa2('0x41')](_0x5084f6[_0x0fa2('0x3f')],[_0x0fa2('0x42')],[_0x0fa2('0x43')]);if(_0x5084f6['account']&&_0x5084f6['account']['autoclose']){_0x5084f6[_0x0fa2('0x3f')][_0x0fa2('0x44')]({'id':0x0,'priority':_0x5084f6['applications']['length']+0x1,'app':_0x0fa2('0x45'),'appdata':'autoclose','interval':_0x0fa2('0x46')});}if(_0x5084f6[_0x0fa2('0x36')]['Applications']){delete _0x5084f6[_0x0fa2('0x36')][_0x0fa2('0x3a')];}if(_0x5084f6[_0x0fa2('0x36')][_0x0fa2('0x3c')]){delete _0x5084f6[_0x0fa2('0x36')][_0x0fa2('0x3c')];}if(_0x1d3eeb[_0x0fa2('0x3c')][_0x0fa2('0x38')][_0x0fa2('0x47')]){return _0x1d3eeb[_0x0fa2('0x3c')]['Contacts'][0x0];}var _0x2c5a45=_[_0x0fa2('0xd')](_0x123155[_0x0fa2('0x2a')],{'firstName':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x32')],'ListId':_0x1d3eeb[_0x0fa2('0x30')]});_0x2c5a45[_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x35')]]=_0x123155['body'][_0x0fa2('0x32')];return db['CmContact'][_0x0fa2('0x48')](_0x2c5a45);}else{throw new Error(_0x0fa2('0x49'));}})[_0x0fa2('0x14')](function(_0xd2c3ed){_0x5084f6[_0x0fa2('0x4a')]=_0xd2c3ed;if(_0xd2c3ed){if(!_0x123155['body'][_0x0fa2('0x1a')]['messageId']){_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x4b')]=rs[_0x0fa2('0x4c')]()+'\x20'+_0x123155[_0x0fa2('0x2a')]['message'][_0x0fa2('0x32')];}var _0x322477={'ContactId':_0xd2c3ed['id'],'MailAccountId':_0x123155[_0x0fa2('0x36')]['id'],'inReplyTo':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x4b')],'to':_0x123155['body'][_0x0fa2('0x1a')][_0x0fa2('0x32')],'cc':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')]['cc'],'subject':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x4d')],'attach':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x4e')],'lastMsgAt':moment()[_0x0fa2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x123155['body'][_0x0fa2('0x2a')]};return db[_0x0fa2('0x50')][_0x0fa2('0x26')]({'where':{'closed':![],'MailAccountId':_0x123155['account']['id']},'include':[{'model':db[_0x0fa2('0x51')],'as':_0x0fa2('0x52'),'attributes':[_0x0fa2('0x4b')],'where':{'messageId':_0x123155['body'][_0x0fa2('0x1a')]['inReplyTo']}}]})['then'](function(_0x5a48a5){if(_0x5a48a5){return[_0x5a48a5,![]];}return db[_0x0fa2('0x50')][_0x0fa2('0x48')](_0x322477)[_0x0fa2('0x14')](function(_0x47687d){return[_0x47687d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0fa2('0x53')](function(_0x3be41a,_0x3e978a){if(_0x3be41a){_0x5c4324=_0x3e978a;if(!_0x3e978a){return _0x3be41a[_0x0fa2('0x54')]({'inReplyTo':_0x123155['body'][_0x0fa2('0x1a')][_0x0fa2('0x4b')],'to':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')]['from'],'cc':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')]['cc'],'subject':_0x123155[_0x0fa2('0x2a')]['message'][_0x0fa2('0x4d')],'attach':_0x3be41a[_0x0fa2('0x4e')]?_0x3be41a[_0x0fa2('0x4e')]:_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x4e')],'substatus':null,'substatusAt':moment()[_0x0fa2('0x4f')](_0x0fa2('0x55')),'lastMsgAt':moment()[_0x0fa2('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x123155['body'][_0x0fa2('0x2a')]});}else{return _0x3be41a;}}})[_0x0fa2('0x14')](function(_0x5930e5){_0x5084f6[_0x0fa2('0x56')]=_0x5930e5[_0x0fa2('0x3d')]({'plain':!![]});_0x5084f6[_0x0fa2('0x56')]['created']=_0x5c4324;return db[_0x0fa2('0x51')][_0x0fa2('0x48')]({'body':_0x123155[_0x0fa2('0x2a')]['body'],'MailAccountId':_0x123155['account']['id'],'MailInteractionId':_0x5930e5['id'],'direction':'in','ContactId':_0x5084f6['contact']['id'],'messageId':_0x123155['body'][_0x0fa2('0x1a')]['messageId'],'from':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x32')],'to':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')]['to'],'cc':_0x123155['body'][_0x0fa2('0x1a')]['cc'],'subject':_0x123155[_0x0fa2('0x2a')]['message']['subject'],'attach':_0x123155[_0x0fa2('0x2a')]['message'][_0x0fa2('0x4e')],'Attachments':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')]['attachments'],'originTo':_0x123155[_0x0fa2('0x2a')][_0x0fa2('0x1a')][_0x0fa2('0x57')],'originCc':_0x123155[_0x0fa2('0x2a')]['message'][_0x0fa2('0x58')],'bcc':_0x123155['body']['message'][_0x0fa2('0x59')]},{'include':[{'model':db['Attachment'],'as':_0x0fa2('0x5a')}]});})[_0x0fa2('0x14')](function(_0x83fdc3){_0x5084f6['message']=_0x83fdc3;if(_0x5084f6[_0x0fa2('0x56')][_0x0fa2('0x5b')]){return db[_0x0fa2('0x5c')][_0x0fa2('0x26')]({'attributes':['id',_0x0fa2('0x5d')],'where':{'id':_0x5084f6[_0x0fa2('0x56')][_0x0fa2('0x5b')]}})[_0x0fa2('0x14')](function(_0x4f0e54){if(_0x4f0e54){_0x5084f6[_0x0fa2('0x3f')][_0x0fa2('0x5e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4f0e54['name']+','+(_0x5084f6[_0x0fa2('0x36')][_0x0fa2('0x5f')]||0xa),'interval':_0x0fa2('0x46')});}return respondWithRpcPromise(_0x0fa2('0x60'),_0x0fa2('0x61'),_0x5084f6);});}return respondWithRpcPromise(_0x0fa2('0x60'),_0x0fa2('0x61'),_0x5084f6);})[_0x0fa2('0x14')](function(_0x20bce0){_0x43dc89(_0x20bce0);})[_0x0fa2('0x1c')](function(_0xd2140){_0x481e1e(_0x25b5cb[_0x0fa2('0x19')](0x1f4,_0xd2140[_0x0fa2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a62d249..02b3c6c 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 _0x291c=['save','remove','update','emit','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x291c,0x137));var _0xc291=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x291c[_0x59ee6f];return _0x4c0979;};'use strict';var MailAccountEvents=require(_0xc291('0x0'));var events=[_0xc291('0x1'),_0xc291('0x2'),_0xc291('0x3')];function createListener(_0xfdfc37,_0x253ebb){return function(_0xc32916){_0x253ebb[_0xc291('0x4')](_0xfdfc37,_0xc32916);};}function removeListener(_0xafdfee,_0x118ddf){return function(){MailAccountEvents[_0xc291('0x5')](_0xafdfee,_0x118ddf);};}exports['register']=function(_0x2c96a8){for(var _0x5f2563=0x0,_0x5a7459=events[_0xc291('0x6')];_0x5f2563<_0x5a7459;_0x5f2563++){var _0x2d3526=events[_0x5f2563];var _0x42a6ac=createListener(_0xc291('0x7')+_0x2d3526,_0x2c96a8);MailAccountEvents['on'](_0x2d3526,_0x42a6ac);}}; \ No newline at end of file +var _0x812d=['update','emit','removeListener','register','length','mailAccount:','save','remove'];(function(_0xea4633,_0x595928){var _0x2e7e83=function(_0x100b6a){while(--_0x100b6a){_0xea4633['push'](_0xea4633['shift']());}};_0x2e7e83(++_0x595928);}(_0x812d,0x6e));var _0xd812=function(_0x5227df,_0x43f4e9){_0x5227df=_0x5227df-0x0;var _0xad59d4=_0x812d[_0x5227df];return _0xad59d4;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xd812('0x0'),_0xd812('0x1'),_0xd812('0x2')];function createListener(_0x200a29,_0x510c9d){return function(_0x263692){_0x510c9d[_0xd812('0x3')](_0x200a29,_0x263692);};}function removeListener(_0x2fba72,_0x47efde){return function(){MailAccountEvents[_0xd812('0x4')](_0x2fba72,_0x47efde);};}exports[_0xd812('0x5')]=function(_0x3aa86b){for(var _0x4c946f=0x0,_0x4ce265=events[_0xd812('0x6')];_0x4c946f<_0x4ce265;_0x4c946f++){var _0x41ed78=events[_0x4c946f];var _0x56a715=createListener(_0xd812('0x7')+_0x41ed78,_0x3aa86b);MailAccountEvents['on'](_0x41ed78,_0x56a715);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c7360da..544cd77 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 _0x5423=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','delete'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5423,0xe3));var _0x3542=function(_0x41636f,_0x2b51fd){_0x41636f=_0x41636f-0x0;var _0x110abc=_0x5423[_0x41636f];return _0x110abc;};'use strict';var multer=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var path=require('path');var timeout=require(_0x3542('0x2'));var express=require(_0x3542('0x3'));var router=express['Router']();var auth=require(_0x3542('0x4'));var interaction=require(_0x3542('0x5'));var config=require(_0x3542('0x6'));var controller=require(_0x3542('0x7'));router['get'](_0x3542('0x8'),auth[_0x3542('0x9')](),controller[_0x3542('0xa')]);router[_0x3542('0xb')](_0x3542('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3542('0xc')](_0x3542('0x8'),auth['isAuthenticated'](),controller[_0x3542('0xd')]);module[_0x3542('0xe')]=router; \ No newline at end of file +var _0x6c76=['Router','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x16c4af,_0x38c104){var _0x999ad=function(_0x1ba213){while(--_0x1ba213){_0x16c4af['push'](_0x16c4af['shift']());}};_0x999ad(++_0x38c104);}(_0x6c76,0x184));var _0x66c7=function(_0x2f2d3,_0x49ecce){_0x2f2d3=_0x2f2d3-0x0;var _0x507550=_0x6c76[_0x2f2d3];return _0x507550;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66c7('0x5'));var controller=require(_0x66c7('0x6'));router['get'](_0x66c7('0x7'),auth[_0x66c7('0x8')](),controller['show']);router[_0x66c7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0xa')]);router[_0x66c7('0xb')](_0x66c7('0x7'),auth['isAuthenticated'](),controller[_0x66c7('0xc')]);module[_0x66c7('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ad317c1..a9f33e1 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 _0x1da7=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1da7,0xbc));var _0x71da=function(_0x37162e,_0xbdc7e0){_0x37162e=_0x37162e-0x0;var _0x46a802=_0x1da7[_0x37162e];return _0x46a802;};'use strict';var Sequelize=require(_0x71da('0x0'));module['exports']={'priority':{'type':Sequelize[_0x71da('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x71da('0x2')],'allowNull':![],'defaultValue':_0x71da('0x3')},'appdata':{'type':Sequelize[_0x71da('0x4')]()},'description':{'type':Sequelize[_0x71da('0x2')]},'interval':{'type':Sequelize[_0x71da('0x2')],'defaultValue':_0x71da('0x5')}}; \ No newline at end of file +var _0x979a=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x46b31c,_0x442cb1){var _0x37d986=function(_0xf164b0){while(--_0xf164b0){_0x46b31c['push'](_0x46b31c['shift']());}};_0x37d986(++_0x442cb1);}(_0x979a,0xd8));var _0xa979=function(_0x40b7fc,_0x51c685){_0x40b7fc=_0x40b7fc-0x0;var _0xe7387a=_0x979a[_0x40b7fc];return _0xe7387a;};'use strict';var Sequelize=require(_0xa979('0x0'));module[_0xa979('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa979('0x2')],'allowNull':![],'defaultValue':_0xa979('0x3')},'appdata':{'type':Sequelize[_0xa979('0x4')]()},'description':{'type':Sequelize[_0xa979('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa979('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a619082..014dc06 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 _0xc750=['merge','options','find','catch','body','MailApplication','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll'];(function(_0x5f24ec,_0x47b103){var _0x2c8b8d=function(_0x4b7dde){while(--_0x4b7dde){_0x5f24ec['push'](_0x5f24ec['shift']());}};_0x2c8b8d(++_0x47b103);}(_0xc750,0x150));var _0x0c75=function(_0x48d6a2,_0x14eaa7){_0x48d6a2=_0x48d6a2-0x0;var _0x4053c1=_0xc750[_0x48d6a2];return _0x4053c1;};'use strict';var pdf=require(_0x0c75('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c75('0x2'));var moment=require(_0x0c75('0x3'));var BPromise=require(_0x0c75('0x4'));var Mustache=require(_0x0c75('0x5'));var util=require('util');var path=require(_0x0c75('0x6'));var sox=require('sox');var csv=require(_0x0c75('0x7'));var ejs=require(_0x0c75('0x8'));var fs=require('fs');var _=require(_0x0c75('0x9'));var squel=require('squel');var crypto=require(_0x0c75('0xa'));var jsforce=require(_0x0c75('0xb'));var deskjs=require(_0x0c75('0xc'));var toCsv=require(_0x0c75('0x7'));var querystring=require(_0x0c75('0xd'));var Papa=require('papaparse');var Redis=require(_0x0c75('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c75('0xf'));var logger=require(_0x0c75('0x10'))(_0x0c75('0x11'));var utils=require(_0x0c75('0x12'));var config=require(_0x0c75('0x13'));var licenseUtil=require(_0x0c75('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5c2c,_0x117906){_0x117906=_0x117906||0xcc;return function(_0x14ad30){if(_0x14ad30){return _0x5c5c2c[_0x0c75('0x15')](_0x117906);}return _0x5c5c2c['status'](_0x117906)[_0x0c75('0x16')]();};}function respondWithResult(_0x26260c,_0xf329f0){_0xf329f0=_0xf329f0||0xc8;return function(_0x53201d){if(_0x53201d){return _0x26260c[_0x0c75('0x17')](_0xf329f0)['json'](_0x53201d);}};}function respondWithFilteredResult(_0x2e37e9,_0x217d19){return function(_0xff482f){if(_0xff482f){var _0x6d3b20=_0xff482f[_0x0c75('0x18')],_0x2849ce=_0x217d19[_0x0c75('0x19')],_0x4126e9=_0x217d19['offset']+_0x217d19[_0x0c75('0x1a')],_0x2984fb;if(_0x4126e9>=_0x6d3b20){_0x4126e9=_0x6d3b20;_0x2984fb=0xc8;}else{_0x2984fb=0xce;}_0x2e37e9[_0x0c75('0x17')](_0x2984fb);return _0x2e37e9[_0x0c75('0x1b')](_0x0c75('0x1c'),_0x2849ce+'-'+_0x4126e9+'/'+_0x6d3b20)['json'](_0xff482f);}return null;};}function patchUpdates(_0x28036c){return function(_0x22d428){try{jsonpatch[_0x0c75('0x1d')](_0x22d428,_0x28036c,!![]);}catch(_0x2a582c){return BPromise[_0x0c75('0x1e')](_0x2a582c);}return _0x22d428[_0x0c75('0x1f')]();};}function saveUpdates(_0xdc43db,_0x21289a){return function(_0x2d43c7){if(_0x2d43c7){return _0x2d43c7[_0x0c75('0x20')](_0xdc43db)['then'](function(_0x24bc9e){return _0x24bc9e;});}return null;};}function removeEntity(_0x4bdee9,_0x3abd8f){return function(_0x537079){if(_0x537079){return _0x537079[_0x0c75('0x21')]()[_0x0c75('0x22')](function(){_0x4bdee9[_0x0c75('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x456f5a,_0xf2f1a){return function(_0x21885f){if(!_0x21885f){_0x456f5a[_0x0c75('0x15')](0x194);}return _0x21885f;};}function handleError(_0x10f120,_0xbccb5a){_0xbccb5a=_0xbccb5a||0x1f4;return function(_0x526e11){logger['error'](_0x526e11['stack']);if(_0x526e11[_0x0c75('0x23')]){delete _0x526e11[_0x0c75('0x23')];}_0x10f120['status'](_0xbccb5a)[_0x0c75('0x24')](_0x526e11);};}exports[_0x0c75('0x25')]=function(_0x15a48c,_0x34cd1d){var _0xe90e3d={'raw':!![],'where':{'id':_0x15a48c[_0x0c75('0x26')]['id']}},_0x2bd74b={};_0x2bd74b[_0x0c75('0x27')]=_[_0x0c75('0x28')](db['MailApplication'][_0x0c75('0x29')]);_0x2bd74b[_0x0c75('0x2a')]=_[_0x0c75('0x28')](_0x15a48c[_0x0c75('0x2a')]);_0x2bd74b[_0x0c75('0x2b')]=_[_0x0c75('0x2c')](_0x2bd74b[_0x0c75('0x27')],_0x2bd74b['query']);_0xe90e3d[_0x0c75('0x2d')]=_[_0x0c75('0x2c')](_0x2bd74b[_0x0c75('0x27')],qs[_0x0c75('0x2e')](_0x15a48c['query'][_0x0c75('0x2e')]));_0xe90e3d['attributes']=_0xe90e3d['attributes'][_0x0c75('0x2f')]?_0xe90e3d[_0x0c75('0x2d')]:_0x2bd74b['model'];if(_0x15a48c[_0x0c75('0x2a')][_0x0c75('0x30')]){_0xe90e3d['include']=[{'all':!![]}];}_0xe90e3d=_[_0x0c75('0x31')]({},_0xe90e3d,_0x15a48c[_0x0c75('0x32')]);return db['MailApplication'][_0x0c75('0x33')](_0xe90e3d)[_0x0c75('0x22')](handleEntityNotFound(_0x34cd1d,null))[_0x0c75('0x22')](respondWithResult(_0x34cd1d,null))[_0x0c75('0x34')](handleError(_0x34cd1d,null));};exports[_0x0c75('0x20')]=function(_0x7079d8,_0x42f6a0){if(_0x7079d8[_0x0c75('0x35')]['id']){delete _0x7079d8[_0x0c75('0x35')]['id'];}return db[_0x0c75('0x36')]['find']({'where':{'id':_0x7079d8[_0x0c75('0x26')]['id']}})['then'](handleEntityNotFound(_0x42f6a0,null))[_0x0c75('0x22')](saveUpdates(_0x7079d8['body'],null))['then'](respondWithResult(_0x42f6a0,null))['catch'](handleError(_0x42f6a0,null));};exports[_0x0c75('0x21')]=function(_0xec49cb,_0x36e81d){return db[_0x0c75('0x36')][_0x0c75('0x33')]({'where':{'id':_0xec49cb[_0x0c75('0x26')]['id']}})[_0x0c75('0x22')](handleEntityNotFound(_0x36e81d,null))[_0x0c75('0x22')](removeEntity(_0x36e81d,null))[_0x0c75('0x34')](handleError(_0x36e81d,null));}; \ No newline at end of file +var _0x6f22=['../../mysqldb','end','status','count','offset','limit','set','reject','save','then','destroy','sendStatus','error','stack','name','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x134f0f,_0x695ae9){var _0xc7b842=function(_0x24f362){while(--_0x24f362){_0x134f0f['push'](_0x134f0f['shift']());}};_0xc7b842(++_0x695ae9);}(_0x6f22,0x1b7));var _0x26f2=function(_0xec3fac,_0x232243){_0xec3fac=_0xec3fac-0x0;var _0x4f6c69=_0x6f22[_0xec3fac];return _0x4f6c69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x26f2('0x0'));var rimraf=require(_0x26f2('0x1'));var zipdir=require(_0x26f2('0x2'));var jsonpatch=require(_0x26f2('0x3'));var rp=require(_0x26f2('0x4'));var moment=require(_0x26f2('0x5'));var BPromise=require(_0x26f2('0x6'));var Mustache=require('mustache');var util=require(_0x26f2('0x7'));var path=require(_0x26f2('0x8'));var sox=require(_0x26f2('0x9'));var csv=require('to-csv');var ejs=require(_0x26f2('0xa'));var fs=require('fs');var _=require(_0x26f2('0xb'));var squel=require(_0x26f2('0xc'));var crypto=require(_0x26f2('0xd'));var jsforce=require(_0x26f2('0xe'));var deskjs=require(_0x26f2('0xf'));var toCsv=require(_0x26f2('0x10'));var querystring=require(_0x26f2('0x11'));var Papa=require(_0x26f2('0x12'));var Redis=require('ioredis');var authService=require(_0x26f2('0x13'));var qs=require(_0x26f2('0x14'));var as=require(_0x26f2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26f2('0x16'))(_0x26f2('0x17'));var utils=require('../../config/utils');var config=require(_0x26f2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x26f2('0x19'))['db'];function respondWithStatusCode(_0x3c0776,_0x4a9054){_0x4a9054=_0x4a9054||0xcc;return function(_0x2aef7d){if(_0x2aef7d){return _0x3c0776['sendStatus'](_0x4a9054);}return _0x3c0776['status'](_0x4a9054)[_0x26f2('0x1a')]();};}function respondWithResult(_0xc2d05b,_0x116378){_0x116378=_0x116378||0xc8;return function(_0x2ca59e){if(_0x2ca59e){return _0xc2d05b[_0x26f2('0x1b')](_0x116378)['json'](_0x2ca59e);}};}function respondWithFilteredResult(_0x4b2d3e,_0x2d7b3c){return function(_0x281b2e){if(_0x281b2e){var _0x4c81ac=_0x281b2e[_0x26f2('0x1c')],_0xf7036c=_0x2d7b3c['offset'],_0xd64ed4=_0x2d7b3c[_0x26f2('0x1d')]+_0x2d7b3c[_0x26f2('0x1e')],_0x69c8cc;if(_0xd64ed4>=_0x4c81ac){_0xd64ed4=_0x4c81ac;_0x69c8cc=0xc8;}else{_0x69c8cc=0xce;}_0x4b2d3e[_0x26f2('0x1b')](_0x69c8cc);return _0x4b2d3e[_0x26f2('0x1f')]('Content-Range',_0xf7036c+'-'+_0xd64ed4+'/'+_0x4c81ac)['json'](_0x281b2e);}return null;};}function patchUpdates(_0x184c35){return function(_0x1b9590){try{jsonpatch['apply'](_0x1b9590,_0x184c35,!![]);}catch(_0xe9342e){return BPromise[_0x26f2('0x20')](_0xe9342e);}return _0x1b9590[_0x26f2('0x21')]();};}function saveUpdates(_0x2809e3,_0x1efc8d){return function(_0x99e854){if(_0x99e854){return _0x99e854['update'](_0x2809e3)[_0x26f2('0x22')](function(_0x759371){return _0x759371;});}return null;};}function removeEntity(_0x1bd7d4,_0x18d31e){return function(_0xd022d0){if(_0xd022d0){return _0xd022d0[_0x26f2('0x23')]()[_0x26f2('0x22')](function(){_0x1bd7d4[_0x26f2('0x1b')](0xcc)[_0x26f2('0x1a')]();});}};}function handleEntityNotFound(_0x2dd557,_0x9d982e){return function(_0x211aa9){if(!_0x211aa9){_0x2dd557[_0x26f2('0x24')](0x194);}return _0x211aa9;};}function handleError(_0x48da74,_0x30b651){_0x30b651=_0x30b651||0x1f4;return function(_0x369478){logger[_0x26f2('0x25')](_0x369478[_0x26f2('0x26')]);if(_0x369478['name']){delete _0x369478[_0x26f2('0x27')];}_0x48da74[_0x26f2('0x1b')](_0x30b651)['send'](_0x369478);};}exports[_0x26f2('0x28')]=function(_0x28c375,_0x328e16){var _0x1f09d6={'raw':!![],'where':{'id':_0x28c375[_0x26f2('0x29')]['id']}},_0x4d420c={};_0x4d420c[_0x26f2('0x2a')]=_[_0x26f2('0x2b')](db[_0x26f2('0x2c')]['rawAttributes']);_0x4d420c[_0x26f2('0x2d')]=_[_0x26f2('0x2b')](_0x28c375[_0x26f2('0x2d')]);_0x4d420c[_0x26f2('0x2e')]=_[_0x26f2('0x2f')](_0x4d420c[_0x26f2('0x2a')],_0x4d420c[_0x26f2('0x2d')]);_0x1f09d6['attributes']=_[_0x26f2('0x2f')](_0x4d420c[_0x26f2('0x2a')],qs[_0x26f2('0x30')](_0x28c375[_0x26f2('0x2d')][_0x26f2('0x30')]));_0x1f09d6['attributes']=_0x1f09d6[_0x26f2('0x31')][_0x26f2('0x32')]?_0x1f09d6[_0x26f2('0x31')]:_0x4d420c[_0x26f2('0x2a')];if(_0x28c375['query'][_0x26f2('0x33')]){_0x1f09d6[_0x26f2('0x34')]=[{'all':!![]}];}_0x1f09d6=_['merge']({},_0x1f09d6,_0x28c375[_0x26f2('0x35')]);return db[_0x26f2('0x2c')][_0x26f2('0x36')](_0x1f09d6)['then'](handleEntityNotFound(_0x328e16,null))['then'](respondWithResult(_0x328e16,null))[_0x26f2('0x37')](handleError(_0x328e16,null));};exports[_0x26f2('0x38')]=function(_0x5c83e3,_0x5d3d82){if(_0x5c83e3[_0x26f2('0x39')]['id']){delete _0x5c83e3['body']['id'];}return db[_0x26f2('0x2c')][_0x26f2('0x36')]({'where':{'id':_0x5c83e3[_0x26f2('0x29')]['id']}})['then'](handleEntityNotFound(_0x5d3d82,null))[_0x26f2('0x22')](saveUpdates(_0x5c83e3[_0x26f2('0x39')],null))[_0x26f2('0x22')](respondWithResult(_0x5d3d82,null))['catch'](handleError(_0x5d3d82,null));};exports[_0x26f2('0x23')]=function(_0x534b58,_0x134db9){return db[_0x26f2('0x2c')][_0x26f2('0x36')]({'where':{'id':_0x534b58[_0x26f2('0x29')]['id']}})['then'](handleEntityNotFound(_0x134db9,null))[_0x26f2('0x22')](removeEntity(_0x134db9,null))['catch'](handleError(_0x134db9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7a4e670..5598c67 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 _0x6b1b=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5a46f7,_0x2f624a){var _0x2204a9=function(_0x26b55d){while(--_0x26b55d){_0x5a46f7['push'](_0x5a46f7['shift']());}};_0x2204a9(++_0x2f624a);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x6b1b[_0x521929];return _0x632436;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require('moment');var BPromise=require(_0xb6b1('0x3'));var rp=require(_0xb6b1('0x4'));var fs=require('fs');var path=require(_0xb6b1('0x5'));var rimraf=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var attributes=require(_0xb6b1('0x8'));module[_0xb6b1('0x9')]=function(_0x113a39,_0x1ff716){return _0x113a39[_0xb6b1('0xa')](_0xb6b1('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6b1('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd945=['./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x137c34,_0x2ebd98){var _0x145d9b=function(_0x1b7701){while(--_0x1b7701){_0x137c34['push'](_0x137c34['shift']());}};_0x145d9b(++_0x2ebd98);}(_0xd945,0x84));var _0x5d94=function(_0x5e228d,_0x5a7806){_0x5e228d=_0x5e228d-0x0;var _0x397a1d=_0xd945[_0x5e228d];return _0x397a1d;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var logger=require(_0x5d94('0x2'))('api');var moment=require(_0x5d94('0x3'));var BPromise=require(_0x5d94('0x4'));var rp=require(_0x5d94('0x5'));var fs=require('fs');var path=require(_0x5d94('0x6'));var rimraf=require(_0x5d94('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d94('0x8'));module[_0x5d94('0x9')]=function(_0x30b667,_0x3056d3){return _0x30b667[_0x5d94('0xa')]('MailApplication',attributes,{'tableName':_0x5d94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d94('0xc'),'collate':_0x5d94('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 79c91d4..2cabae6 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 _0x293b=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','limit','debug','moment'];(function(_0x363842,_0x369636){var _0x257bc2=function(_0x2516cf){while(--_0x2516cf){_0x363842['push'](_0x363842['shift']());}};_0x257bc2(++_0x369636);}(_0x293b,0x1a3));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb293('0x0'));var BPromise=require(_0xb293('0x1'));var rs=require(_0xb293('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb293('0x3'))['db'];var utils=require(_0xb293('0x4'));var logger=require('../../config/logger')(_0xb293('0x5'));var config=require(_0xb293('0x6'));var jayson=require(_0xb293('0x7'));var client=jayson[_0xb293('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5034,_0x36e2ac,_0xda2bbb){return new BPromise(function(_0x1e534d,_0x4cfaf1){return client[_0xb293('0x9')](_0x2b5034,_0xda2bbb)[_0xb293('0xa')](function(_0x3b0e43){logger[_0xb293('0xb')](_0xb293('0xc'),_0x36e2ac,_0xb293('0xd'));logger['debug'](_0xb293('0xe'),_0x36e2ac,_0xb293('0xd'),JSON[_0xb293('0xf')](_0x3b0e43));if(_0x3b0e43[_0xb293('0x10')]){if(_0x3b0e43[_0xb293('0x10')][_0xb293('0x11')]===0x1f4){logger[_0xb293('0x10')]('MailApplication,\x20%s,\x20%s',_0x36e2ac,_0x3b0e43['error'][_0xb293('0x12')]);return _0x4cfaf1(_0x3b0e43['error'][_0xb293('0x12')]);}logger[_0xb293('0x10')]('MailApplication,\x20%s,\x20%s',_0x36e2ac,_0x3b0e43[_0xb293('0x10')]['message']);return _0x1e534d(_0x3b0e43[_0xb293('0x10')][_0xb293('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x36e2ac,_0xb293('0xd'));_0x1e534d(_0x3b0e43[_0xb293('0x13')][_0xb293('0x12')]);}})[_0xb293('0x14')](function(_0x98cd39){logger[_0xb293('0x10')](_0xb293('0xc'),_0x36e2ac,_0x98cd39);_0x4cfaf1(_0x98cd39);});});}exports[_0xb293('0x15')]=function(_0x1068b5){var _0x2eeabe=this;return new Promise(function(_0x40d0f9,_0xd5eba){return db[_0xb293('0x16')]['update'](_0x1068b5[_0xb293('0x17')],{'raw':_0x1068b5[_0xb293('0x18')]?_0x1068b5[_0xb293('0x18')][_0xb293('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1068b5['options']?_0x1068b5[_0xb293('0x18')]['where']||null:null,'attributes':_0x1068b5[_0xb293('0x18')]?_0x1068b5[_0xb293('0x18')]['attributes']||null:null,'limit':_0x1068b5[_0xb293('0x18')]?_0x1068b5[_0xb293('0x18')][_0xb293('0x1a')]||null:null})[_0xb293('0xa')](function(_0x225ea5){logger[_0xb293('0xb')](_0xb293('0x15'),_0x1068b5);logger[_0xb293('0x1b')]('UpdateMailApplication',_0x1068b5,JSON['stringify'](_0x225ea5));_0x40d0f9(_0x225ea5);})[_0xb293('0x14')](function(_0x206449){logger[_0xb293('0x10')](_0xb293('0x15'),_0x206449[_0xb293('0x12')],_0x1068b5);_0xd5eba(_0x2eeabe[_0xb293('0x10')](0x1f4,_0x206449[_0xb293('0x12')]));});});}; \ No newline at end of file +var _0x3f54=['code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d81fa,_0x40fa05){var _0x103a56=function(_0x54f642){while(--_0x54f642){_0x1d81fa['push'](_0x1d81fa['shift']());}};_0x103a56(++_0x40fa05);}(_0x3f54,0x137));var _0x43f5=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x3f54[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0x43f5('0x0'));var moment=require(_0x43f5('0x1'));var BPromise=require(_0x43f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x43f5('0x4'));var logger=require(_0x43f5('0x5'))(_0x43f5('0x6'));var config=require(_0x43f5('0x7'));var jayson=require(_0x43f5('0x8'));var client=jayson['client'][_0x43f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2037b5,_0x18f77a,_0x44e4f1){return new BPromise(function(_0x2f0ab5,_0x42419c){return client[_0x43f5('0xa')](_0x2037b5,_0x44e4f1)[_0x43f5('0xb')](function(_0x4042ae){logger[_0x43f5('0xc')](_0x43f5('0xd'),_0x18f77a,_0x43f5('0xe'));logger[_0x43f5('0xf')](_0x43f5('0x10'),_0x18f77a,_0x43f5('0xe'),JSON[_0x43f5('0x11')](_0x4042ae));if(_0x4042ae[_0x43f5('0x12')]){if(_0x4042ae[_0x43f5('0x12')][_0x43f5('0x13')]===0x1f4){logger['error'](_0x43f5('0xd'),_0x18f77a,_0x4042ae[_0x43f5('0x12')][_0x43f5('0x14')]);return _0x42419c(_0x4042ae[_0x43f5('0x12')]['message']);}logger[_0x43f5('0x12')](_0x43f5('0xd'),_0x18f77a,_0x4042ae['error'][_0x43f5('0x14')]);return _0x2f0ab5(_0x4042ae[_0x43f5('0x12')][_0x43f5('0x14')]);}else{logger[_0x43f5('0xc')](_0x43f5('0xd'),_0x18f77a,'request\x20sent');_0x2f0ab5(_0x4042ae[_0x43f5('0x15')][_0x43f5('0x14')]);}})[_0x43f5('0x16')](function(_0x21f68f){logger[_0x43f5('0x12')](_0x43f5('0xd'),_0x18f77a,_0x21f68f);_0x42419c(_0x21f68f);});});}exports[_0x43f5('0x17')]=function(_0x3af9fb){var _0x591431=this;return new Promise(function(_0x1c0755,_0x4affc4){return db[_0x43f5('0x18')]['update'](_0x3af9fb[_0x43f5('0x19')],{'raw':_0x3af9fb[_0x43f5('0x1a')]?_0x3af9fb[_0x43f5('0x1a')][_0x43f5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3af9fb[_0x43f5('0x1a')]?_0x3af9fb[_0x43f5('0x1a')]['where']||null:null,'attributes':_0x3af9fb[_0x43f5('0x1a')]?_0x3af9fb[_0x43f5('0x1a')][_0x43f5('0x1c')]||null:null,'limit':_0x3af9fb['options']?_0x3af9fb[_0x43f5('0x1a')][_0x43f5('0x1d')]||null:null})[_0x43f5('0xb')](function(_0x3ab988){logger['info']('UpdateMailApplication',_0x3af9fb);logger['debug']('UpdateMailApplication',_0x3af9fb,JSON[_0x43f5('0x11')](_0x3ab988));_0x1c0755(_0x3ab988);})[_0x43f5('0x16')](function(_0x23cbd2){logger[_0x43f5('0x12')]('UpdateMailApplication',_0x23cbd2[_0x43f5('0x14')],_0x3af9fb);_0x4affc4(_0x591431['error'](0x1f4,_0x23cbd2[_0x43f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ddcc2b3..19468a7 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 _0x5089=['mailinteraction:addtags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','mail'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x5089,0x1bb));var _0x9508=function(_0x4a9fb7,_0x4cbfd7){_0x4a9fb7=_0x4a9fb7-0x0;var _0x40b90e=_0x5089[_0x4a9fb7];return _0x40b90e;};'use strict';var multer=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var path=require('path');var timeout=require(_0x9508('0x2'));var express=require(_0x9508('0x3'));var router=express[_0x9508('0x4')]();var auth=require(_0x9508('0x5'));var interaction=require(_0x9508('0x6'));var config=require('../../config/environment');var controller=require(_0x9508('0x7'));router['get']('/',auth[_0x9508('0x8')](),controller[_0x9508('0x9')]);router[_0x9508('0xa')]('/describe',auth[_0x9508('0x8')](),controller[_0x9508('0xb')]);router['get'](_0x9508('0xc'),auth[_0x9508('0x8')](),controller['show']);router[_0x9508('0xa')]('/:id/messages',auth[_0x9508('0x8')](),controller[_0x9508('0xd')]);router[_0x9508('0xa')](_0x9508('0xe'),auth[_0x9508('0x8')](),controller[_0x9508('0xf')]);router['post']('/',auth[_0x9508('0x8')](),controller['create']);router[_0x9508('0x10')](_0x9508('0x11'),auth['isAuthenticated'](),controller[_0x9508('0x12')]);router[_0x9508('0x10')](_0x9508('0x13'),auth[_0x9508('0x8')](),interaction['tracked'](_0x9508('0x14'),_0x9508('0x15')),controller['addTags']);router[_0x9508('0x16')]('/:id',auth[_0x9508('0x8')](),interaction[_0x9508('0x17')](_0x9508('0x14'),_0x9508('0x18')),controller[_0x9508('0x19')]);router[_0x9508('0x1a')](_0x9508('0xc'),auth[_0x9508('0x8')](),interaction['tracked'](_0x9508('0x14'),_0x9508('0x1b')),controller[_0x9508('0x1c')]);router[_0x9508('0x1a')](_0x9508('0x13'),auth[_0x9508('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc6d8=['mailinteraction:addtags','addTags','mailinteraction:update','update','delete','removeTags','exports','multer','path','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','addMessage','post','/:id/tags','tracked','mail'];(function(_0x4b9a46,_0x4812bb){var _0x3a7334=function(_0x3a3336){while(--_0x3a3336){_0x4b9a46['push'](_0x4b9a46['shift']());}};_0x3a7334(++_0x4812bb);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2b7c38,_0x496d14){_0x2b7c38=_0x2b7c38-0x0;var _0x313fcc=_0xc6d8[_0x2b7c38];return _0x313fcc;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var auth=require(_0x8c6d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c6d('0x4'));router[_0x8c6d('0x5')]('/',auth[_0x8c6d('0x6')](),controller[_0x8c6d('0x7')]);router[_0x8c6d('0x5')](_0x8c6d('0x8'),auth[_0x8c6d('0x6')](),controller['describe']);router[_0x8c6d('0x5')](_0x8c6d('0x9'),auth[_0x8c6d('0x6')](),controller['show']);router[_0x8c6d('0x5')](_0x8c6d('0xa'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xb')]);router[_0x8c6d('0x5')](_0x8c6d('0xc'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xd')]);router['post']('/',auth[_0x8c6d('0x6')](),controller['create']);router['post'](_0x8c6d('0xa'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')](_0x8c6d('0x10'),auth[_0x8c6d('0x6')](),interaction[_0x8c6d('0x11')](_0x8c6d('0x12'),_0x8c6d('0x13')),controller[_0x8c6d('0x14')]);router['put'](_0x8c6d('0x9'),auth['isAuthenticated'](),interaction[_0x8c6d('0x11')]('mail',_0x8c6d('0x15')),controller[_0x8c6d('0x16')]);router['delete'](_0x8c6d('0x9'),auth[_0x8c6d('0x6')](),interaction['tracked'](_0x8c6d('0x12'),'mailinteraction:destroy'),controller['destroy']);router[_0x8c6d('0x17')]('/:id/tags',auth[_0x8c6d('0x6')](),controller[_0x8c6d('0x18')]);module[_0x8c6d('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 388524d..2477423 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 _0x8c99=['long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x8c99,0x175));var _0x98c9=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x8c99[_0x37756b];return _0x46efec;};'use strict';var Sequelize=require(_0x98c9('0x0'));var iconv=require(_0x98c9('0x1'));module[_0x98c9('0x2')]={'closed':{'type':Sequelize[_0x98c9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x98c9('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x98c9('0x5')]},'thirdDisposition':{'type':Sequelize[_0x98c9('0x5')]},'note':{'type':Sequelize[_0x98c9('0x5')]},'inReplyTo':{'type':Sequelize[_0x98c9('0x5')](0x1fe)},'to':{'type':Sequelize[_0x98c9('0x5')]},'cc':{'type':Sequelize[_0x98c9('0x6')](_0x98c9('0x7'))},'subject':{'type':Sequelize[_0x98c9('0x6')]()},'attach':{'type':Sequelize[_0x98c9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x98c9('0x4')]},'substatus':{'type':Sequelize[_0x98c9('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x98c9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x98c9('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x98c9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x98c9('0x8')]('in',_0x98c9('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x98c9('0x6')](_0x98c9('0x7'))},'lastMsgText':{'type':Sequelize[_0x98c9('0x6')](_0x98c9('0x7'))}}; \ No newline at end of file +var _0xcc8a=['TEXT','long','BOOLEAN','out','ENUM','sequelize','iconv','exports','DATE','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcc8a,0x1a9));var _0xacc8=function(_0x426b27,_0x5918de){_0x426b27=_0x426b27-0x0;var _0xbf309b=_0xcc8a[_0x426b27];return _0xbf309b;};'use strict';var Sequelize=require(_0xacc8('0x0'));var iconv=require(_0xacc8('0x1'));module[_0xacc8('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xacc8('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xacc8('0x4')]},'note':{'type':Sequelize[_0xacc8('0x4')]},'inReplyTo':{'type':Sequelize[_0xacc8('0x4')](0x1fe)},'to':{'type':Sequelize[_0xacc8('0x4')]},'cc':{'type':Sequelize[_0xacc8('0x5')](_0xacc8('0x6'))},'subject':{'type':Sequelize[_0xacc8('0x5')]()},'attach':{'type':Sequelize[_0xacc8('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xacc8('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xacc8('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xacc8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xacc8('0x9')]('in',_0xacc8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xacc8('0x5')](_0xacc8('0x6'))},'lastMsgText':{'type':Sequelize[_0xacc8('0x5')](_0xacc8('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 01b564a..7974923 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 _0x5b12=['mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','c.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','fields','include','options','create','body','describe','addMessage','ids','getMessages','MailMessage','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','addTags','setTags','omit','findAll','emit','mailInteractionTags:save','removeTags','download','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','build','log','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','count','offset','Content-Range','reject','save','update','then','destroy','end','error','name','send','Users','fullname','TagIds','Tags','split','MailInteraction','findOne','lastMsgBody','lastMsgText','fromString','catch','index','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','field','color','from','select','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users'];(function(_0x42e2d9,_0x3159da){var _0x355022=function(_0x135c93){while(--_0x135c93){_0x42e2d9['push'](_0x42e2d9['shift']());}};_0x355022(++_0x3159da);}(_0x5b12,0xa3));var _0x25b1=function(_0x5c394c,_0x360230){_0x5c394c=_0x5c394c-0x0;var _0x51dd98=_0x5b12[_0x5c394c];return _0x51dd98;};'use strict';var pdf=require(_0x25b1('0x0'));var emlformat=require(_0x25b1('0x1'));var rimraf=require(_0x25b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25b1('0x3'));var rp=require('request-promise');var moment=require(_0x25b1('0x4'));var BPromise=require(_0x25b1('0x5'));var Mustache=require('mustache');var util=require(_0x25b1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x25b1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0x7'));var querystring=require(_0x25b1('0xc'));var Papa=require(_0x25b1('0xd'));var htmlToText=require(_0x25b1('0xe'));var juice=require('juice');var Redis=require(_0x25b1('0xf'));var authService=require(_0x25b1('0x10'));var qs=require(_0x25b1('0x11'));var as=require(_0x25b1('0x12'));var hardwareService=require(_0x25b1('0x13'));var logger=require(_0x25b1('0x14'))(_0x25b1('0x15'));var utils=require(_0x25b1('0x16'));var config=require(_0x25b1('0x17'));var licenseUtil=require(_0x25b1('0x18'));var db=require(_0x25b1('0x19'))['db'];config[_0x25b1('0x1a')]=_[_0x25b1('0x1b')](config[_0x25b1('0x1a')],{'host':_0x25b1('0x1c'),'port':0x18eb});var socket=require(_0x25b1('0x1d'))(new Redis(config['redis']));require(_0x25b1('0x1e'))[_0x25b1('0x1f')](socket);function respondWithStatusCode(_0x4de13f,_0xb5b9cf){_0xb5b9cf=_0xb5b9cf||0xcc;return function(_0x4bb1bb){if(_0x4bb1bb){return _0x4de13f[_0x25b1('0x20')](_0xb5b9cf);}return _0x4de13f['status'](_0xb5b9cf)['end']();};}function respondWithResult(_0x7b50ab,_0x573ec2){_0x573ec2=_0x573ec2||0xc8;return function(_0xd8fee){if(_0xd8fee){return _0x7b50ab[_0x25b1('0x21')](_0x573ec2)[_0x25b1('0x22')](_0xd8fee);}};}function respondWithFilteredResult(_0x27ccc9,_0x1f78c2){return function(_0x2a7d14){if(_0x2a7d14){var _0x17024a=_0x2a7d14[_0x25b1('0x23')],_0x292463=_0x1f78c2['offset'],_0x53ce1b=_0x1f78c2[_0x25b1('0x24')]+_0x1f78c2['limit'],_0x4ecff1;if(_0x53ce1b>=_0x17024a){_0x53ce1b=_0x17024a;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0x27ccc9[_0x25b1('0x21')](_0x4ecff1);return _0x27ccc9['set'](_0x25b1('0x25'),_0x292463+'-'+_0x53ce1b+'/'+_0x17024a)['json'](_0x2a7d14);}return null;};}function patchUpdates(_0xb61b1){return function(_0x5b0be0){try{jsonpatch['apply'](_0x5b0be0,_0xb61b1,!![]);}catch(_0x565cfd){return BPromise[_0x25b1('0x26')](_0x565cfd);}return _0x5b0be0[_0x25b1('0x27')]();};}function saveUpdates(_0x4affba,_0x19bab8){return function(_0x26b555){if(_0x26b555){return _0x26b555[_0x25b1('0x28')](_0x4affba)[_0x25b1('0x29')](function(_0x1aabbb){return _0x1aabbb;});}return null;};}function removeEntity(_0x5e6b6b,_0x3fa043){return function(_0x23f20e){if(_0x23f20e){return _0x23f20e[_0x25b1('0x2a')]()[_0x25b1('0x29')](function(){_0x5e6b6b[_0x25b1('0x21')](0xcc)[_0x25b1('0x2b')]();});}};}function handleEntityNotFound(_0x5d9ed7,_0x3c05c6){return function(_0x27dd68){if(!_0x27dd68){_0x5d9ed7[_0x25b1('0x20')](0x194);}return _0x27dd68;};}function handleError(_0x5bc8fc,_0x20a218){_0x20a218=_0x20a218||0x1f4;return function(_0x9e175f){logger[_0x25b1('0x2c')](_0x9e175f['stack']);if(_0x9e175f[_0x25b1('0x2d')]){delete _0x9e175f['name'];}_0x5bc8fc[_0x25b1('0x21')](_0x20a218)[_0x25b1('0x2e')](_0x9e175f);};}function getInteractionUsers(_0x3a4475,_0x293413){return new BPromise(function(_0x362118,_0x300a14){try{if(_0x293413[_0x3a4475['id']]){_0x3a4475[_0x25b1('0x2f')]=_['map'](_0x293413[_0x3a4475['id']],function(_0x30d455){return{'id':_0x30d455['id'],'fullname':_0x30d455[_0x25b1('0x30')]};});}}catch(_0x925e99){_0x300a14(_0x925e99);}_0x362118(_0x3a4475);});}function getInteractionTags(_0x26f323,_0x274205){return new BPromise(function(_0x4840ea,_0x389f62){try{if(_0x26f323[_0x25b1('0x31')]){_0x26f323[_0x25b1('0x32')]=[];_0x26f323[_0x25b1('0x31')][_0x25b1('0x33')](',')['forEach'](function(_0x5cbde5){_0x26f323[_0x25b1('0x32')]['push'](_0x274205[_0x5cbde5]);});}delete _0x26f323[_0x25b1('0x31')];}catch(_0x391713){_0x389f62(_0x391713);}_0x4840ea(_0x26f323);});}function getLastMessageText(_0x1fbde6){return new BPromise(function(_0x5706d0,_0x5b6176){return db[_0x25b1('0x34')][_0x25b1('0x35')]({'where':{'id':_0x1fbde6['id']},'attributes':[_0x25b1('0x36'),'lastMsgText'],'raw':!![]})[_0x25b1('0x29')](function(_0x2e5014){if(!_0x2e5014[_0x25b1('0x37')]){_0x1fbde6[_0x25b1('0x37')]=_['trimStart'](htmlToText[_0x25b1('0x38')](_0x2e5014[_0x25b1('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x1fbde6[_0x25b1('0x37')]=_0x2e5014['lastMsgText'];}_0x5706d0(_0x1fbde6);})['catch'](function(_0x357b50){_0x5b6176(_0x357b50);});});}function updateMailInteraction(_0x59732e,_0x169b03,_0x2b44b0,_0x3ea659){return new BPromise(function(_0x5fdded,_0x1f5d8b){return getInteractionUsers(_0x59732e,_0x2b44b0)[_0x25b1('0x29')](function(_0x1ef8a8){return getInteractionTags(_0x1ef8a8,_0x169b03);})[_0x25b1('0x29')](function(_0x28f8a6){if(_0x3ea659){_0x5fdded(getLastMessageText(_0x28f8a6));}else{_0x5fdded(_0x28f8a6);}})[_0x25b1('0x39')](function(_0x44d5e5){_0x1f5d8b(_0x44d5e5);});});}exports[_0x25b1('0x3a')]=function(_0xcd2917,_0x2359ac){var _0x162727={},_0x4837d5={},_0x472ed3={'count':0x0,'rows':[]};var _0x3e23f7=_['map'](db[_0x25b1('0x34')][_0x25b1('0x3b')],function(_0x30ea0f){return{'name':_0x30ea0f[_0x25b1('0x3c')],'type':_0x30ea0f[_0x25b1('0x3d')]['key']};});_0x4837d5[_0x25b1('0x3e')]=_['map'](_0x3e23f7,_0x25b1('0x2d'));_0x4837d5['query']=_[_0x25b1('0x3f')](_0xcd2917[_0x25b1('0x40')]);_0x4837d5[_0x25b1('0x41')]=_[_0x25b1('0x42')](_0x4837d5[_0x25b1('0x3e')],_0x4837d5[_0x25b1('0x40')]);_0x162727[_0x25b1('0x43')]=_[_0x25b1('0x42')](_0x4837d5[_0x25b1('0x3e')],qs['fields'](_0xcd2917[_0x25b1('0x40')]['fields']));_0x162727[_0x25b1('0x43')]=_0x162727[_0x25b1('0x43')]['length']?_0x162727[_0x25b1('0x43')]:_0x4837d5[_0x25b1('0x3e')];if(!_0xcd2917[_0x25b1('0x40')][_0x25b1('0x44')](_0x25b1('0x45'))){_0x162727[_0x25b1('0x46')]=qs[_0x25b1('0x46')](_0xcd2917[_0x25b1('0x40')][_0x25b1('0x46')]);_0x162727[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0xcd2917[_0x25b1('0x40')][_0x25b1('0x24')]);}_0x162727[_0x25b1('0x47')]=qs[_0x25b1('0x48')](_0xcd2917[_0x25b1('0x40')][_0x25b1('0x48')]);_0x162727[_0x25b1('0x49')]=qs['filters'](_['pick'](_0xcd2917['query'],_0x4837d5[_0x25b1('0x41')]),_0x3e23f7);var _0x526e55=[];var _0x435483=squel['select']()[_0x25b1('0x4a')]('id')[_0x25b1('0x4a')](_0x25b1('0x2d'))[_0x25b1('0x4a')](_0x25b1('0x4b'))[_0x25b1('0x4c')]('tools_tags');var _0x45559a=squel[_0x25b1('0x4d')]()[_0x25b1('0x4a')](_0x25b1('0x4e'))['field'](_0x25b1('0x4f'))[_0x25b1('0x4a')](_0x25b1('0x50'))['from'](_0x25b1('0x51'),'ui')['left_join'](_0x25b1('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x543f9b=squel[_0x25b1('0x4d')]()[_0x25b1('0x4c')](_0x25b1('0x53'),'i')[_0x25b1('0x54')]('cm_contacts','c',_0x25b1('0x55'))['left_join'](_0x25b1('0x52'),'o','o.id\x20=\x20i.UserId')[_0x25b1('0x54')](_0x25b1('0x56'),'a',_0x25b1('0x57'))['left_join'](_0x25b1('0x58'),'me',_0x25b1('0x59'))[_0x25b1('0x54')](_0x25b1('0x5a'),'it',_0x25b1('0x5b'))[_0x25b1('0x54')]('tools_tags','t',_0x25b1('0x5c'));var _0x133f50=squel[_0x25b1('0x5d')]();var _0x2311da=[];var _0x5e367=squel[_0x25b1('0x5d')]();var _0x291dac;if(_0xcd2917[_0x25b1('0x40')][_0x25b1('0x5e')]){_0x291dac=as[_0x25b1('0x5f')](_0xcd2917[_0x25b1('0x40')][_0x25b1('0x5e')]);var _0x4190a1=_0x291dac[_0x25b1('0x60')];for(var _0x3191d7=0x0;_0x3191d7<_0x291dac[_0x25b1('0x61')][_0x25b1('0x62')];_0x3191d7++){var _0x289db8=_0x291dac['conditions'][_0x3191d7];var _0x3c6658='i';var _0x16e61e=_[_0x25b1('0x63')](_0x3e23f7,[_0x25b1('0x2d'),_0x289db8[_0x25b1('0x4a')]]);if(!_0x16e61e){switch(_0x289db8[_0x25b1('0x4a')]){case'unreadMessages':if(_0x289db8[_0x25b1('0x64')]==0x1){_0x543f9b[_0x25b1('0x65')]('`'+_0x289db8[_0x25b1('0x4a')]+'`\x20=\x200');}else{_0x543f9b[_0x25b1('0x65')]('`'+_0x289db8['field']+'`\x20>\x200');}break;case'Contact':if(_0x289db8['operator']===_0x25b1('0x66')){if(_0x289db8['value'][_0x25b1('0x33')]('\x20')[_0x25b1('0x62')]>0x1){_0x133f50[_0x4190a1](_0x25b1('0x67'),qs[_0x25b1('0x68')](_0x289db8[_0x25b1('0x64')]),null);}else{var _0x4ea777='%'+_0x289db8[_0x25b1('0x64')]+'%';_0x133f50[_0x4190a1](_0x25b1('0x69'),_0x4ea777,_0x4ea777,_0x4ea777);}}else{_0x16e61e=_[_0x25b1('0x63')](_0x3e23f7,[_0x25b1('0x2d'),'ContactId']);_0x289db8[_0x25b1('0x4a')]=_0x25b1('0x6a');_0x31b92e=as[_0x25b1('0x6b')](_0x3c6658,_0x16e61e[_0x25b1('0x3d')],_0x289db8);_0x133f50[_0x4190a1](_0x31b92e[_0x25b1('0x6c')],_0x31b92e[_0x25b1('0x64')]['start'],_0x31b92e[_0x25b1('0x64')]['end']);}break;case _0x25b1('0x6d'):var _0x28bc79=_0x289db8['value'][_0x25b1('0x33')](',')[_0x25b1('0x6e')](function(_0x551bed){return Number(_0x551bed);});_0x28bc79[_0x25b1('0x6f')](function(_0x303049){_0x5e367['or'](_0x25b1('0x70'),'%,'+_0x303049+',%');});_0x2311da=_[_0x25b1('0x71')](_0x2311da,_0x28bc79);break;case _0x25b1('0x72'):if(_0x289db8[_0x25b1('0x73')]===_0x25b1('0x66')){_0x133f50[_0x4190a1](_0x25b1('0x74'),'%'+_0x289db8['value']+'%',null);}else{_0x16e61e=_[_0x25b1('0x63')](_0x3e23f7,[_0x25b1('0x2d'),_0x25b1('0x75')]);_0x289db8[_0x25b1('0x4a')]=_0x25b1('0x75');_0x31b92e=as[_0x25b1('0x6b')](_0x3c6658,_0x16e61e[_0x25b1('0x3d')],_0x289db8);_0x133f50[_0x4190a1](_0x31b92e[_0x25b1('0x6c')],_0x31b92e['value'][_0x25b1('0x76')],_0x31b92e[_0x25b1('0x64')]['end']);}break;case _0x25b1('0x77'):_0x31b92e=as[_0x25b1('0x6b')]('me',null,_0x289db8);_0x133f50[_0x4190a1](_0x31b92e['text'],_0x31b92e[_0x25b1('0x64')]['start'],_0x31b92e[_0x25b1('0x64')]['end']);break;}}else{var _0x31b92e=as['buildExpression'](_0x3c6658,_0x16e61e[_0x25b1('0x3d')],_0x289db8);_0x133f50[_0x4190a1](_0x31b92e[_0x25b1('0x6c')],_0x31b92e[_0x25b1('0x64')]['start'],_0x31b92e['value'][_0x25b1('0x2b')]);}}}else{var _0x25f68c=_(_0xcd2917[_0x25b1('0x40')])[_0x25b1('0x3f')]()[_0x25b1('0x6e')](function(_0x15ea73){return _[_0x25b1('0x78')](_0x3e23f7,[_0x25b1('0x2d'),_0x15ea73])?_0x15ea73:undefined;})[_0x25b1('0x79')]()[_0x25b1('0x64')]();if(!_[_0x25b1('0x7a')](_0x25f68c)){_0x25f68c[_0x25b1('0x6f')](function(_0x3d06ab){if(_0x3d06ab===_0x25b1('0x7b')){_0x543f9b[_0x25b1('0x49')](_0x25b1('0x7c'),[][_0x25b1('0x7d')](_0xcd2917[_0x25b1('0x40')][_0x3d06ab]));}else if(_0x3d06ab===_0x25b1('0x7e')){var _0x3afef9=JSON[_0x25b1('0x7f')](_0xcd2917[_0x25b1('0x40')][_0x3d06ab])['$gte'];var _0x1a3368=JSON['parse'](_0xcd2917[_0x25b1('0x40')][_0x3d06ab])[_0x25b1('0x80')];_0x543f9b[_0x25b1('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3afef9,_0x1a3368);}else{if(_0xcd2917['query'][_0x3d06ab]===_0x25b1('0x81')){_0x543f9b[_0x25b1('0x49')]('i.'+_0x3d06ab+'\x20IS\x20NULL');}else{_0x543f9b[_0x25b1('0x49')]('i.'+_0x3d06ab+_0x25b1('0x82'),_0xcd2917[_0x25b1('0x40')][_0x3d06ab]);}}});}if(_0xcd2917['query'][_0x25b1('0x83')]){if(_0xcd2917[_0x25b1('0x40')][_0x25b1('0x83')]==0x1){_0x543f9b[_0x25b1('0x65')]('`unreadMessages`\x20=\x200');}else{_0x543f9b[_0x25b1('0x65')](_0x25b1('0x84'));}}if(_0xcd2917[_0x25b1('0x40')][_0x25b1('0x85')]){_0x2311da=_[_0x25b1('0x86')](_0xcd2917[_0x25b1('0x40')]['tag'])?_0xcd2917[_0x25b1('0x40')][_0x25b1('0x85')]:new Array(_0xcd2917['query']['tag']);_0x2311da[_0x25b1('0x6f')](function(_0x3aea3a){_0x5e367['or'](_0x25b1('0x70'),'%,'+_0x3aea3a+',%');});}if(_0xcd2917[_0x25b1('0x40')][_0x25b1('0x87')]){var _0x1d92bc=_0xcd2917[_0x25b1('0x40')]['filter'][_0x25b1('0x88')]('\x5c','\x5c\x5c')[_0x25b1('0x88')](/'/g,'\x27\x27');if(qs[_0x25b1('0x89')](_0x1d92bc)){_0x133f50['or'](_0x25b1('0x8a'),_0x1d92bc+'%');}else if(qs[_0x25b1('0x8b')](_0x1d92bc)){_0x133f50['or'](_0x25b1('0x8c'),_0x1d92bc+'%');}else{_0x133f50['or'](_0x25b1('0x8d'),qs['getFullTextValue'](_0x1d92bc))['or'](_0x25b1('0x8e'),qs[_0x25b1('0x68')](_0x1d92bc));}}}_0x543f9b[_0x25b1('0x49')](_0x133f50);_0x543f9b[_0x25b1('0x8f')](_0x25b1('0x90'));var _0xe2a561={'type':db[_0x25b1('0x91')][_0x25b1('0x92')][_0x25b1('0x93')],'raw':!![]};var _0x18021f=_0x543f9b[_0x25b1('0x94')]();_0x18021f['field'](_0x25b1('0x90'));_0x18021f[_0x25b1('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x25b1('0x95'));if(_0x162727[_0x25b1('0x47')]){_0x162727[_0x25b1('0x47')][_0x25b1('0x6f')](function(_0x1afa81){var _0x518d36=_0x1afa81[0x0]==='contactName'?_0x1afa81[0x0]:'i.'+_0x1afa81[0x0];_0x543f9b[_0x25b1('0x47')](_0x518d36,_0x1afa81[0x1]==='DESC'?![]:!![]);});}if(!_[_0x25b1('0x7a')](_0x2311da)){_0x543f9b[_0x25b1('0x65')](_0x5e367);_0x18021f[_0x25b1('0x49')](_0x25b1('0x96'),_0x2311da);}BPromise[_0x25b1('0x97')]()[_0x25b1('0x29')](function(){if(!_0x291dac){if(_0xcd2917['query'][_0x25b1('0x7b')])return;_0x18021f[_0x25b1('0x49')](_0x25b1('0x98'));_0x543f9b[_0x25b1('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xcd2917['user']['role']!==_0x25b1('0x99'))return;return _0xcd2917[_0x25b1('0x9a')]['getMailAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x271837){if(_[_0x25b1('0x7a')](_0x271837)){_0x18021f[_0x25b1('0x49')](_0x25b1('0x9b'));_0x543f9b['where'](_0x25b1('0x9b'));}else{_0x18021f[_0x25b1('0x49')](_0x25b1('0x7c'),_[_0x25b1('0x6e')](_0x271837,'id'));_0x543f9b[_0x25b1('0x49')](_0x25b1('0x7c'),_[_0x25b1('0x6e')](_0x271837,'id'));}});})[_0x25b1('0x29')](function(){if(_0xcd2917['user']['role']===_0x25b1('0x99')&&!_0x291dac&&!_0xcd2917[_0x25b1('0x40')]['MailAccountId'])return[];return db['sequelize'][_0x25b1('0x40')](_0x18021f[_0x25b1('0x9c')](),_0xe2a561);})['then'](function(_0x360bdb){_0x472ed3[_0x25b1('0x23')]=_0x360bdb[_0x25b1('0x62')];if(_0x472ed3[_0x25b1('0x23')]===0x0)return[];return db[_0x25b1('0x9d')][_0x25b1('0x40')](_0x435483[_0x25b1('0x9c')](),_0xe2a561)['then'](function(_0x3db302){_0x526e55=_[_0x25b1('0x9e')](_0x3db302,'id');_0xe2a561=_[_0x25b1('0x9f')](_0xe2a561,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xcd2917['query']['fields']){_0x162727[_0x25b1('0x43')][_0x25b1('0x6f')](function(_0x2c0a56){_0x543f9b['field']('i.'+_0x2c0a56);});}else{_0x543f9b['field'](_0x25b1('0xa0'),_0x25b1('0x95'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xa1'),_0x25b1('0xa2'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xa3'),_0x25b1('0xa4'));_0x543f9b[_0x25b1('0x4a')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x25b1('0xa5'));_0x543f9b[_0x25b1('0x4a')]('i.id');_0x543f9b['field'](_0x25b1('0xa6'));_0x543f9b['field'](_0x25b1('0xa7'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xa8'));_0x543f9b['field']('i.closedAt');_0x543f9b['field'](_0x25b1('0xa9'));_0x543f9b[_0x25b1('0x4a')]('i.lastMsgAt');_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xaa'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xab'));_0x543f9b[_0x25b1('0x4a')]('i.disposition');_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xac'));_0x543f9b['field'](_0x25b1('0xad'));_0x543f9b['field'](_0x25b1('0xae'));_0x543f9b['field']('i.to');_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xaf'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xb0'));_0x543f9b[_0x25b1('0x4a')]('i.UserId');_0x543f9b['field'](_0x25b1('0xb1'),'Contact.firstName');_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xb2'),_0x25b1('0xb3'));_0x543f9b['field'](_0x25b1('0xb4'),'Contact.email');_0x543f9b['field']('c.phone',_0x25b1('0xb5'));_0x543f9b['field'](_0x25b1('0xb6'),_0x25b1('0xb7'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xb8'),_0x25b1('0xb9'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xba'),_0x25b1('0xbb'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xbc'),_0x25b1('0xbd'));_0x543f9b[_0x25b1('0x4a')](_0x25b1('0xbe'),_0x25b1('0x31'));}if(_0x162727[_0x25b1('0x46')])_0x543f9b[_0x25b1('0x46')](_0x162727[_0x25b1('0x46')]);if(_0x162727['offset'])_0x543f9b[_0x25b1('0x24')](_0x162727['offset']);return db[_0x25b1('0x9d')][_0x25b1('0x40')](_0x543f9b[_0x25b1('0x9c')](),_0xe2a561);})[_0x25b1('0x29')](function(_0x209d54){_0x45559a['where'](_0x25b1('0xbf'),_[_0x25b1('0x6e')](_0x209d54,'id'));return db[_0x25b1('0x9d')]['query'](_0x45559a[_0x25b1('0x9c')](),_0xe2a561)[_0x25b1('0x29')](function(_0x3aa734){var _0x110962=_['groupBy'](_0x3aa734,_0x25b1('0xc0'));var _0x22c25a=[];return db[_0x25b1('0xc1')]['findOne']({'attributes':[_0x25b1('0xc2')],'raw':!![]})[_0x25b1('0x29')](function(_0xba11fa){var _0x4f9a85=_0xba11fa[_0x25b1('0xc2')];_0x209d54[_0x25b1('0x6f')](function(_0x53bbf1){_0x22c25a[_0x25b1('0xc3')](updateMailInteraction(_0x53bbf1,_0x526e55,_0x110962,_0x4f9a85));});return BPromise[_0x25b1('0xc4')](_0x22c25a);});});});})['then'](function(_0x10105f){_0x472ed3[_0x25b1('0xc5')]=_0x10105f;return _0x472ed3;})[_0x25b1('0x29')](respondWithFilteredResult(_0x2359ac,_0x162727))[_0x25b1('0x39')](handleError(_0x2359ac,null));};exports[_0x25b1('0xc6')]=function(_0x3ba918,_0x5948a1){var _0x3496a9={'raw':![],'where':{'id':_0x3ba918[_0x25b1('0xc7')]['id']}},_0x30f1e9={};_0x30f1e9[_0x25b1('0x3e')]=_[_0x25b1('0x3f')](db[_0x25b1('0x34')][_0x25b1('0x3b')]);_0x30f1e9[_0x25b1('0x40')]=_[_0x25b1('0x3f')](_0x3ba918[_0x25b1('0x40')]);_0x30f1e9['filters']=_[_0x25b1('0x42')](_0x30f1e9[_0x25b1('0x3e')],_0x30f1e9['query']);_0x3496a9['attributes']=_[_0x25b1('0x42')](_0x30f1e9[_0x25b1('0x3e')],qs[_0x25b1('0xc8')](_0x3ba918[_0x25b1('0x40')][_0x25b1('0xc8')]));_0x3496a9['attributes']=_0x3496a9['attributes'][_0x25b1('0x62')]?_0x3496a9[_0x25b1('0x43')]:_0x30f1e9[_0x25b1('0x3e')];if(_0x3ba918['query']['includeAll']){_0x3496a9[_0x25b1('0xc9')]=[{'all':!![]}];}_0x3496a9=_[_0x25b1('0x9f')]({},_0x3496a9,_0x3ba918[_0x25b1('0xca')]);return db['MailInteraction'][_0x25b1('0x63')](_0x3496a9)[_0x25b1('0x29')](handleEntityNotFound(_0x5948a1,null))[_0x25b1('0x29')](respondWithResult(_0x5948a1,null))[_0x25b1('0x39')](handleError(_0x5948a1,null));};exports[_0x25b1('0xcb')]=function(_0x151c69,_0x2029cb){return db[_0x25b1('0x34')][_0x25b1('0xcb')](_0x151c69['body'],{})[_0x25b1('0x29')](respondWithResult(_0x2029cb,0xc9))[_0x25b1('0x39')](handleError(_0x2029cb,null));};exports[_0x25b1('0x28')]=function(_0x25bbc0,_0x442931){if(_0x25bbc0[_0x25b1('0xcc')]['id']){delete _0x25bbc0[_0x25b1('0xcc')]['id'];}return db['MailInteraction'][_0x25b1('0x63')]({'where':{'id':_0x25bbc0['params']['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x442931,null))[_0x25b1('0x29')](saveUpdates(_0x25bbc0[_0x25b1('0xcc')],null))[_0x25b1('0x29')](respondWithResult(_0x442931,null))['catch'](handleError(_0x442931,null));};exports['destroy']=function(_0x2f2d9a,_0x241491){return db['MailInteraction']['find']({'where':{'id':_0x2f2d9a['params']['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x241491,null))[_0x25b1('0x29')](removeEntity(_0x241491,null))[_0x25b1('0x39')](handleError(_0x241491,null));};exports[_0x25b1('0xcd')]=function(_0x1041d1,_0x1f1160){return db[_0x25b1('0x34')][_0x25b1('0xcd')]()[_0x25b1('0x29')](respondWithResult(_0x1f1160,null))[_0x25b1('0x39')](handleError(_0x1f1160,null));};exports[_0x25b1('0xce')]=function(_0x294e51,_0x5d1e39,_0x183a4a){return db['MailMessage'][_0x25b1('0x63')]({'where':{'id':_0x294e51[_0x25b1('0xc7')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x5d1e39,null))[_0x25b1('0x29')](function(_0x33819e){if(_0x33819e){return _0x33819e[_0x25b1('0xce')](_0x294e51[_0x25b1('0xcc')][_0x25b1('0xcf')],_['omit'](_0x294e51[_0x25b1('0xcc')],[_0x25b1('0xcf'),'id'])||{});}})[_0x25b1('0x29')](respondWithResult(_0x5d1e39,null))[_0x25b1('0x39')](handleError(_0x5d1e39,null));};exports[_0x25b1('0xd0')]=function(_0xc05e90,_0x1e1aac,_0x49e7d6){var _0x274746={'raw':![],'where':{}};var _0x217c30={};var _0x1a3b60={'count':0x0,'rows':[]};return db[_0x25b1('0x34')][_0x25b1('0x35')]({'where':{'id':_0xc05e90['params']['id']}})['then'](handleEntityNotFound(_0x1e1aac,null))[_0x25b1('0x29')](function(_0x2e924b){if(_0x2e924b){_0x217c30['model']=_['keys'](db[_0x25b1('0xd1')][_0x25b1('0x3b')]);_0x217c30[_0x25b1('0x40')]=_[_0x25b1('0x3f')](_0xc05e90[_0x25b1('0x40')]);_0x217c30[_0x25b1('0x41')]=_[_0x25b1('0x42')](_0x217c30[_0x25b1('0x3e')],_0x217c30['query']);_0x274746[_0x25b1('0x43')]=_['intersection'](_0x217c30['model'],qs[_0x25b1('0xc8')](_0xc05e90['query'][_0x25b1('0xc8')]));_0x274746[_0x25b1('0x43')]=_0x274746[_0x25b1('0x43')][_0x25b1('0x62')]?_0x274746[_0x25b1('0x43')]:_0x217c30[_0x25b1('0x3e')];if(!_0xc05e90[_0x25b1('0x40')]['hasOwnProperty'](_0x25b1('0x45'))){_0x274746[_0x25b1('0x46')]=qs[_0x25b1('0x46')](_0xc05e90[_0x25b1('0x40')][_0x25b1('0x46')]);_0x274746[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0xc05e90[_0x25b1('0x40')]['offset']);}_0x274746[_0x25b1('0x47')]=qs[_0x25b1('0x48')](_0xc05e90[_0x25b1('0x40')]['sort']);_0x274746[_0x25b1('0x49')]=qs[_0x25b1('0x41')](_[_0x25b1('0xd2')](_0xc05e90[_0x25b1('0x40')],_0x217c30[_0x25b1('0x41')]));_0x274746['where'][_0x25b1('0xc0')]=_0x2e924b['id'];if(_0xc05e90[_0x25b1('0x40')][_0x25b1('0x87')]){_0x274746['where']=_['merge'](_0x274746['where'],{'$or':_[_0x25b1('0x6e')](_0x274746['attributes'],function(_0x351f4e){var _0x4cd432={};_0x4cd432[_0x351f4e]={'$like':'%'+_0xc05e90[_0x25b1('0x40')][_0x25b1('0x87')]+'%'};return _0x4cd432;})});}if(_0xc05e90[_0x25b1('0x40')][_0x25b1('0xd3')]){var _0x25a665=_0xc05e90[_0x25b1('0x40')][_0x25b1('0xd3')]['split'](',');var _0xe484af={};_0xe484af[_0x25a665[0x0]]={'$gte':moment(_0x25a665[0x1])[_0x25b1('0xd4')](_0x25b1('0xd5'))};_0x274746['where']=_[_0x25b1('0x9f')](_0x274746[_0x25b1('0x49')],_0xe484af);}_0x274746=_[_0x25b1('0x9f')]({},_0x274746,_0xc05e90[_0x25b1('0xca')]);return db['MailMessage'][_0x25b1('0x23')]({'where':_0x274746[_0x25b1('0x49')]})[_0x25b1('0x29')](function(_0x2f3d55){_0x1a3b60[_0x25b1('0x23')]=_0x2f3d55;if(_0xc05e90['query'][_0x25b1('0xd6')]){_0x274746[_0x25b1('0xc9')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x274746);})['then'](function(_0x1ec8ea){if(_0xc05e90['query'][_0x25b1('0xd7')]===_0x25b1('0xd8')){for(var _0x1d7ffe=0x0;_0x1d7ffe<_0x1ec8ea[_0x25b1('0x62')];_0x1d7ffe++){_0x1ec8ea[_0x1d7ffe][_0x25b1('0xcc')]=juice(_0x1ec8ea[_0x1d7ffe][_0x25b1('0xcc')]);}}_0x1a3b60[_0x25b1('0xc5')]=_0x1ec8ea;return _0x1a3b60;});}})[_0x25b1('0x29')](respondWithFilteredResult(_0x1e1aac,_0x274746))['catch'](handleError(_0x1e1aac,null));};exports[_0x25b1('0xd9')]=function(_0x531744,_0x3d5840,_0x7e3867){return db[_0x25b1('0x34')]['find']({'where':{'id':_0x531744[_0x25b1('0xc7')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x3d5840,null))[_0x25b1('0x29')](function(_0x112806){if(_0x112806){return _0x112806[_0x25b1('0xda')](_0x531744[_0x25b1('0xcc')]['ids'],_[_0x25b1('0xdb')](_0x531744[_0x25b1('0xcc')],[_0x25b1('0xcf'),'id'])||{})['spread'](function(){return db[_0x25b1('0x6d')][_0x25b1('0xdc')]({'attributes':['id',_0x25b1('0x2d'),_0x25b1('0x4b')],'where':{'id':_0x531744['body'][_0x25b1('0xcf')]}});})[_0x25b1('0x29')](function(_0xb39a94){socket[_0x25b1('0xdd')](_0x25b1('0xde'),{'id':Number(_0x531744[_0x25b1('0xc7')]['id']),'tags':_0xb39a94||[]});return{'id':Number(_0x531744[_0x25b1('0xc7')]['id']),'tags':_0xb39a94||[]};});}})[_0x25b1('0x29')](respondWithResult(_0x3d5840,null))[_0x25b1('0x39')](handleError(_0x3d5840,null));};exports[_0x25b1('0xdf')]=function(_0x3722cc,_0x56fa01,_0x3a8c36){return db[_0x25b1('0x34')][_0x25b1('0x63')]({'where':{'id':_0x3722cc['params']['id']}})['then'](handleEntityNotFound(_0x56fa01,null))[_0x25b1('0x29')](function(_0x239506){if(_0x239506){return _0x239506['removeTags'](_0x3722cc['query'][_0x25b1('0xcf')]);}})['then'](respondWithStatusCode(_0x56fa01,null))[_0x25b1('0x39')](handleError(_0x56fa01,null));};exports[_0x25b1('0xe0')]=function(_0x273a58,_0x1e6870){var _0x65aa37=moment()['unix']()[_0x25b1('0x9c')]();var _0x33fa42=path['join'](config[_0x25b1('0xe1')],_0x25b1('0xe2'),'files',_0x25b1('0xe3'));var _0x4b85d2=path[_0x25b1('0xe4')](config[_0x25b1('0xe1')],_0x25b1('0xe2'),_0x25b1('0xe5'),_0x25b1('0xe6'));var _0x23c014=path[_0x25b1('0xe4')](_0x33fa42,_0x65aa37);var _0x1c3ae0=util['format'](_0x25b1('0xe7'),_0x273a58[_0x25b1('0xc7')]['id'],_0x65aa37);var _0x580c02=path[_0x25b1('0xe4')](_0x33fa42,_0x1c3ae0);var _0x41e2d4=[];if(_0x273a58[_0x25b1('0x40')][_0x25b1('0xe6')]){_0x41e2d4[_0x25b1('0xc3')]({'model':db[_0x25b1('0xe8')],'as':'Attachments','raw':!![]});}var _0x381039=[{'model':db[_0x25b1('0xd1')],'as':_0x25b1('0xe9'),'attributes':['id','body',_0x25b1('0x4c'),'to','cc',_0x25b1('0xea'),_0x25b1('0xeb'),_0x25b1('0x7e')],'where':{'secret':![]},'order':qs[_0x25b1('0x48')]('id'),'include':_0x41e2d4}];return db[_0x25b1('0x34')]['find']({'where':{'id':_0x273a58[_0x25b1('0xc7')]['id']},'include':_0x381039})['then'](handleEntityNotFound(_0x1e6870,null))[_0x25b1('0x29')](function(_0x5d2808){if(_0x5d2808&&_0x5d2808[_0x25b1('0xe9')]){var _0x1765da=_0x5d2808[_0x25b1('0xec')]({'plain':!![]});fs[_0x25b1('0xed')](_0x23c014);return BPromise['each'](_0x1765da[_0x25b1('0xe9')],function(_0x43ba85,_0x2876d6){var _0x3f3dc2={'from':_0x43ba85[_0x25b1('0x4c')],'to':_0x43ba85['to'],'subject':_0x43ba85['subject'],'html':_0x43ba85[_0x25b1('0xcc')],'headers':{'Date':moment(_0x43ba85['createdAt'])[_0x25b1('0xd4')](_0x25b1('0xee'))},'attachments':[]};if(_0x43ba85['cc']){_0x3f3dc2[_0x25b1('0xef')]['Cc']=_0x43ba85['cc'];}if(_0x43ba85[_0x25b1('0xea')]){_0x3f3dc2['headers'][_0x25b1('0xf0')]=_0x43ba85[_0x25b1('0xea')];}return new BPromise(function(_0x22e8f5,_0x12e9fa){if(_0x43ba85['Attachments']){for(var _0x208315=0x0;_0x208315<_0x43ba85[_0x25b1('0xf1')][_0x25b1('0x62')];_0x208315++){var _0x27d544=_0x43ba85[_0x25b1('0xf1')][_0x208315];var _0x116c78=path[_0x25b1('0xe4')](_0x4b85d2,_0x27d544[_0x25b1('0xf2')]);if(fs['existsSync'](_0x116c78)){_0x3f3dc2[_0x25b1('0xe6')][_0x25b1('0xc3')]({'name':_0x27d544[_0x25b1('0x2d')],'contentType':_0x27d544['type'],'data':fs['readFileSync'](_0x116c78)});}}}emlformat[_0x25b1('0xf3')](_0x3f3dc2,function(_0x19294a,_0x2a9a49){if(_0x19294a)return _0x12e9fa(_0x19294a);fs['writeFileSync'](path[_0x25b1('0xe4')](_0x23c014,util['format']('message%d.eml',_0x2876d6)),_0x2a9a49);return _0x22e8f5(_0x2a9a49);});});})[_0x25b1('0x29')](function(){return new BPromise(function(_0x3168d6,_0x57d764){zipdir(_0x23c014,{'saveTo':_0x580c02},function(_0x2591e6,_0x10aa4b){if(_0x2591e6)return _0x57d764(_0x2591e6);return _0x3168d6(_0x10aa4b);});})[_0x25b1('0x29')](function(){return new BPromise(function(_0x3d9754,_0x1a4a40){rimraf(_0x23c014,function(_0x1f71d9){if(_0x1f71d9)_0x1a4a40(_0x1f71d9);return _0x3d9754();});});})[_0x25b1('0x29')](function(){return _0x1e6870[_0x25b1('0xe0')](_0x580c02,_0x1c3ae0,function(_0x43b2a9){if(_0x43b2a9){console[_0x25b1('0xf4')]('err',_0x43b2a9);}else{fs[_0x25b1('0xf5')](_0x580c02);}});});});}else{return _0x1e6870[_0x25b1('0x20')](0xc8);}})[_0x25b1('0x39')](handleError(_0x1e6870,null));}; \ No newline at end of file +var _0xda3f=['rimraf','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgText','trimStart','fromString','catch','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','plainBody','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','MailAccountId','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closedAt','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','all','rows','show','params','rawAttributes','includeAll','include','create','body','destroy','describe','MailMessage','ids','getMessages','nolimit','options','findAll','true','setTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','download','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','get','mkdirSync','subject','format','headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','eml-format'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0xda3f,0xec));var _0xfda3=function(_0x3f8a49,_0x5b41f4){_0x3f8a49=_0x3f8a49-0x0;var _0x384a9a=_0xda3f[_0x3f8a49];return _0x384a9a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfda3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfda3('0x3'));var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x6'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var htmlToText=require(_0xfda3('0xd'));var juice=require(_0xfda3('0xe'));var Redis=require(_0xfda3('0xf'));var authService=require(_0xfda3('0x10'));var qs=require(_0xfda3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfda3('0x12'));var logger=require(_0xfda3('0x13'))(_0xfda3('0x14'));var utils=require(_0xfda3('0x15'));var config=require(_0xfda3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfda3('0x17'))['db'];config['redis']=_[_0xfda3('0x18')](config[_0xfda3('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfda3('0x1a'))[_0xfda3('0x1b')](socket);function respondWithStatusCode(_0x5ea793,_0x57a229){_0x57a229=_0x57a229||0xcc;return function(_0x533365){if(_0x533365){return _0x5ea793[_0xfda3('0x1c')](_0x57a229);}return _0x5ea793[_0xfda3('0x1d')](_0x57a229)[_0xfda3('0x1e')]();};}function respondWithResult(_0x3d8bcd,_0x34900d){_0x34900d=_0x34900d||0xc8;return function(_0x40d702){if(_0x40d702){return _0x3d8bcd[_0xfda3('0x1d')](_0x34900d)[_0xfda3('0x1f')](_0x40d702);}};}function respondWithFilteredResult(_0x4680bf,_0xc62ae6){return function(_0x54a7c6){if(_0x54a7c6){var _0x15ddb9=_0x54a7c6['count'],_0x1bbdda=_0xc62ae6[_0xfda3('0x20')],_0x12d568=_0xc62ae6[_0xfda3('0x20')]+_0xc62ae6[_0xfda3('0x21')],_0x32855a;if(_0x12d568>=_0x15ddb9){_0x12d568=_0x15ddb9;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x4680bf['status'](_0x32855a);return _0x4680bf['set'](_0xfda3('0x22'),_0x1bbdda+'-'+_0x12d568+'/'+_0x15ddb9)[_0xfda3('0x1f')](_0x54a7c6);}return null;};}function patchUpdates(_0x4ea9f5){return function(_0x545320){try{jsonpatch[_0xfda3('0x23')](_0x545320,_0x4ea9f5,!![]);}catch(_0xef2535){return BPromise[_0xfda3('0x24')](_0xef2535);}return _0x545320[_0xfda3('0x25')]();};}function saveUpdates(_0xfb4ee9,_0x2b84b7){return function(_0x2677f6){if(_0x2677f6){return _0x2677f6[_0xfda3('0x26')](_0xfb4ee9)[_0xfda3('0x27')](function(_0x5499f5){return _0x5499f5;});}return null;};}function removeEntity(_0x82341b,_0x2d5b44){return function(_0x2e8bf8){if(_0x2e8bf8){return _0x2e8bf8['destroy']()[_0xfda3('0x27')](function(){_0x82341b[_0xfda3('0x1d')](0xcc)[_0xfda3('0x1e')]();});}};}function handleEntityNotFound(_0x38946d,_0x1cb831){return function(_0xad9f7b){if(!_0xad9f7b){_0x38946d['sendStatus'](0x194);}return _0xad9f7b;};}function handleError(_0x3c6d7d,_0x1e87fe){_0x1e87fe=_0x1e87fe||0x1f4;return function(_0x2bef2b){logger[_0xfda3('0x28')](_0x2bef2b[_0xfda3('0x29')]);if(_0x2bef2b['name']){delete _0x2bef2b[_0xfda3('0x2a')];}_0x3c6d7d[_0xfda3('0x1d')](_0x1e87fe)[_0xfda3('0x2b')](_0x2bef2b);};}function getInteractionUsers(_0x474992,_0xe21ec6){return new BPromise(function(_0x3cfeb2,_0x26e544){try{if(_0xe21ec6[_0x474992['id']]){_0x474992['Users']=_['map'](_0xe21ec6[_0x474992['id']],function(_0x3aef3c){return{'id':_0x3aef3c['id'],'fullname':_0x3aef3c['fullname']};});}}catch(_0x4b9d90){_0x26e544(_0x4b9d90);}_0x3cfeb2(_0x474992);});}function getInteractionTags(_0x16b4a2,_0x2a5971){return new BPromise(function(_0x34f9d2,_0xd7e1d6){try{if(_0x16b4a2[_0xfda3('0x2c')]){_0x16b4a2[_0xfda3('0x2d')]=[];_0x16b4a2[_0xfda3('0x2c')][_0xfda3('0x2e')](',')[_0xfda3('0x2f')](function(_0x5825bd){_0x16b4a2[_0xfda3('0x2d')][_0xfda3('0x30')](_0x2a5971[_0x5825bd]);});}delete _0x16b4a2[_0xfda3('0x2c')];}catch(_0x227357){_0xd7e1d6(_0x227357);}_0x34f9d2(_0x16b4a2);});}function getLastMessageText(_0x2b64a1){return new BPromise(function(_0xd6969e,_0x2b3afb){return db[_0xfda3('0x31')][_0xfda3('0x32')]({'where':{'id':_0x2b64a1['id']},'attributes':['lastMsgBody','lastMsgText'],'raw':!![]})[_0xfda3('0x27')](function(_0x17cccb){if(!_0x17cccb['lastMsgText']){_0x2b64a1[_0xfda3('0x33')]=_[_0xfda3('0x34')](htmlToText[_0xfda3('0x35')](_0x17cccb['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2b64a1[_0xfda3('0x33')]=_0x17cccb[_0xfda3('0x33')];}_0xd6969e(_0x2b64a1);})[_0xfda3('0x36')](function(_0x3151e6){_0x2b3afb(_0x3151e6);});});}function updateMailInteraction(_0x1ab9b1,_0x5ae650,_0xc6dd4e,_0x2d2043){return new BPromise(function(_0x33bdfb,_0x56bed2){return getInteractionUsers(_0x1ab9b1,_0xc6dd4e)[_0xfda3('0x27')](function(_0x4854b1){return getInteractionTags(_0x4854b1,_0x5ae650);})[_0xfda3('0x27')](function(_0x5469df){if(_0x2d2043){_0x33bdfb(getLastMessageText(_0x5469df));}else{_0x33bdfb(_0x5469df);}})[_0xfda3('0x36')](function(_0x36a506){_0x56bed2(_0x36a506);});});}exports[_0xfda3('0x37')]=function(_0x2074e7,_0x151f32){var _0x3d1cb2={},_0x577be8={},_0x24c7ad={'count':0x0,'rows':[]};var _0xbfbc01=_[_0xfda3('0x38')](db[_0xfda3('0x31')]['rawAttributes'],function(_0x2425f9){return{'name':_0x2425f9[_0xfda3('0x39')],'type':_0x2425f9[_0xfda3('0x3a')]['key']};});_0x577be8['model']=_[_0xfda3('0x38')](_0xbfbc01,_0xfda3('0x2a'));_0x577be8[_0xfda3('0x3b')]=_[_0xfda3('0x3c')](_0x2074e7[_0xfda3('0x3b')]);_0x577be8[_0xfda3('0x3d')]=_[_0xfda3('0x3e')](_0x577be8[_0xfda3('0x3f')],_0x577be8[_0xfda3('0x3b')]);_0x3d1cb2[_0xfda3('0x40')]=_['intersection'](_0x577be8[_0xfda3('0x3f')],qs[_0xfda3('0x41')](_0x2074e7['query'][_0xfda3('0x41')]));_0x3d1cb2['attributes']=_0x3d1cb2['attributes']['length']?_0x3d1cb2[_0xfda3('0x40')]:_0x577be8[_0xfda3('0x3f')];if(!_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x42')]('nolimit')){_0x3d1cb2[_0xfda3('0x21')]=qs[_0xfda3('0x21')](_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x21')]);_0x3d1cb2['offset']=qs[_0xfda3('0x20')](_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x20')]);}_0x3d1cb2['order']=qs['sort'](_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x43')]);_0x3d1cb2[_0xfda3('0x44')]=qs[_0xfda3('0x3d')](_[_0xfda3('0x45')](_0x2074e7[_0xfda3('0x3b')],_0x577be8[_0xfda3('0x3d')]),_0xbfbc01);var _0x1bd0d8=[];var _0x12b533=squel[_0xfda3('0x46')]()[_0xfda3('0x47')]('id')[_0xfda3('0x47')](_0xfda3('0x2a'))[_0xfda3('0x47')]('color')['from'](_0xfda3('0x48'));var _0x2acde1=squel[_0xfda3('0x46')]()[_0xfda3('0x47')](_0xfda3('0x49'))[_0xfda3('0x47')](_0xfda3('0x4a'))[_0xfda3('0x47')](_0xfda3('0x4b'))[_0xfda3('0x4c')]('user_has_mail_interactions','ui')[_0xfda3('0x4d')](_0xfda3('0x4e'),'u',_0xfda3('0x4f'));var _0x36aa3a=squel[_0xfda3('0x46')]()['from'](_0xfda3('0x50'),'i')[_0xfda3('0x4d')](_0xfda3('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfda3('0x4d')](_0xfda3('0x4e'),'o',_0xfda3('0x52'))['left_join'](_0xfda3('0x53'),'a',_0xfda3('0x54'))[_0xfda3('0x4d')](_0xfda3('0x55'),'me',_0xfda3('0x56'))['left_join'](_0xfda3('0x57'),'it','it.MailInteractionId\x20=\x20i.id')[_0xfda3('0x4d')]('tools_tags','t',_0xfda3('0x58'));var _0x6447=squel[_0xfda3('0x59')]();var _0x26ffee=[];var _0x574f02=squel[_0xfda3('0x59')]();var _0x3b430d;if(_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x5a')]){_0x3b430d=as[_0xfda3('0x5b')](_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x5a')]);var _0x54fba2=_0x3b430d['sqlOperator'];for(var _0x4fb214=0x0;_0x4fb214<_0x3b430d[_0xfda3('0x5c')][_0xfda3('0x5d')];_0x4fb214++){var _0x5489f5=_0x3b430d['conditions'][_0x4fb214];var _0x258dd4='i';var _0x1d6606=_[_0xfda3('0x5e')](_0xbfbc01,[_0xfda3('0x2a'),_0x5489f5[_0xfda3('0x47')]]);if(!_0x1d6606){switch(_0x5489f5['field']){case _0xfda3('0x5f'):if(_0x5489f5[_0xfda3('0x60')]==0x1){_0x36aa3a[_0xfda3('0x61')]('`'+_0x5489f5[_0xfda3('0x47')]+_0xfda3('0x62'));}else{_0x36aa3a[_0xfda3('0x61')]('`'+_0x5489f5[_0xfda3('0x47')]+_0xfda3('0x63'));}break;case _0xfda3('0x64'):if(_0x5489f5[_0xfda3('0x65')]===_0xfda3('0x66')){if(_0x5489f5[_0xfda3('0x60')]['split']('\x20')[_0xfda3('0x5d')]>0x1){_0x6447[_0x54fba2](_0xfda3('0x67'),qs[_0xfda3('0x68')](_0x5489f5[_0xfda3('0x60')]),null);}else{var _0x3e674e='%'+_0x5489f5[_0xfda3('0x60')]+'%';_0x6447[_0x54fba2](_0xfda3('0x69'),_0x3e674e,_0x3e674e,_0x3e674e);}}else{_0x1d6606=_['find'](_0xbfbc01,['name',_0xfda3('0x6a')]);_0x5489f5[_0xfda3('0x47')]='ContactId';_0xc9878d=as[_0xfda3('0x6b')](_0x258dd4,_0x1d6606[_0xfda3('0x3a')],_0x5489f5);_0x6447[_0x54fba2](_0xc9878d[_0xfda3('0x6c')],_0xc9878d[_0xfda3('0x60')]['start'],_0xc9878d['value'][_0xfda3('0x1e')]);}break;case _0xfda3('0x6d'):var _0x18e53e=_0x5489f5['value'][_0xfda3('0x2e')](',')['map'](function(_0x3452cf){return Number(_0x3452cf);});_0x18e53e[_0xfda3('0x2f')](function(_0x1cc5b2){_0x574f02['or'](_0xfda3('0x6e'),'%,'+_0x1cc5b2+',%');});_0x26ffee=_[_0xfda3('0x6f')](_0x26ffee,_0x18e53e);break;case _0xfda3('0x70'):if(_0x5489f5['operator']===_0xfda3('0x66')){_0x6447[_0x54fba2](_0xfda3('0x71'),'%'+_0x5489f5[_0xfda3('0x60')]+'%',null);}else{_0x1d6606=_[_0xfda3('0x5e')](_0xbfbc01,[_0xfda3('0x2a'),'UserId']);_0x5489f5['field']=_0xfda3('0x72');_0xc9878d=as[_0xfda3('0x6b')](_0x258dd4,_0x1d6606['type'],_0x5489f5);_0x6447[_0x54fba2](_0xc9878d['text'],_0xc9878d['value'][_0xfda3('0x73')],_0xc9878d[_0xfda3('0x60')]['end']);}break;case _0xfda3('0x74'):_0xc9878d=as[_0xfda3('0x6b')]('me',null,_0x5489f5);_0x6447[_0x54fba2](_0xc9878d[_0xfda3('0x6c')],_0xc9878d[_0xfda3('0x60')]['start'],_0xc9878d[_0xfda3('0x60')][_0xfda3('0x1e')]);break;}}else{var _0xc9878d=as[_0xfda3('0x6b')](_0x258dd4,_0x1d6606[_0xfda3('0x3a')],_0x5489f5);_0x6447[_0x54fba2](_0xc9878d[_0xfda3('0x6c')],_0xc9878d['value']['start'],_0xc9878d[_0xfda3('0x60')]['end']);}}}else{var _0x238329=_(_0x2074e7[_0xfda3('0x3b')])[_0xfda3('0x3c')]()[_0xfda3('0x38')](function(_0x1d6547){return _[_0xfda3('0x75')](_0xbfbc01,[_0xfda3('0x2a'),_0x1d6547])?_0x1d6547:undefined;})[_0xfda3('0x76')]()[_0xfda3('0x60')]();if(!_[_0xfda3('0x77')](_0x238329)){_0x238329['forEach'](function(_0xee8462){if(_0xee8462==='MailAccountId'){_0x36aa3a['where'](_0xfda3('0x78'),[][_0xfda3('0x79')](_0x2074e7['query'][_0xee8462]));}else if(_0xee8462===_0xfda3('0x7a')){var _0x26e1f5=JSON[_0xfda3('0x7b')](_0x2074e7['query'][_0xee8462])[_0xfda3('0x7c')];var _0x3fe104=JSON[_0xfda3('0x7b')](_0x2074e7[_0xfda3('0x3b')][_0xee8462])[_0xfda3('0x7d')];_0x36aa3a['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x26e1f5,_0x3fe104);}else{if(_0x2074e7['query'][_0xee8462]===_0xfda3('0x7e')){_0x36aa3a[_0xfda3('0x44')]('i.'+_0xee8462+_0xfda3('0x7f'));}else{_0x36aa3a[_0xfda3('0x44')]('i.'+_0xee8462+_0xfda3('0x80'),_0x2074e7[_0xfda3('0x3b')][_0xee8462]);}}});}if(_0x2074e7['query'][_0xfda3('0x81')]){if(_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x81')]==0x1){_0x36aa3a[_0xfda3('0x61')]('`unreadMessages`\x20=\x200');}else{_0x36aa3a[_0xfda3('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x82')]){_0x26ffee=_[_0xfda3('0x83')](_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x82')])?_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x82')]:new Array(_0x2074e7['query'][_0xfda3('0x82')]);_0x26ffee[_0xfda3('0x2f')](function(_0x33535d){_0x574f02['or'](_0xfda3('0x6e'),'%,'+_0x33535d+',%');});}if(_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x84')]){var _0x5a44ce=_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x84')][_0xfda3('0x85')]('\x5c','\x5c\x5c')[_0xfda3('0x85')](/'/g,'\x27\x27');if(qs[_0xfda3('0x86')](_0x5a44ce)){_0x6447['or']('i.id\x20LIKE\x20?',_0x5a44ce+'%');}else if(qs[_0xfda3('0x87')](_0x5a44ce)){_0x6447['or'](_0xfda3('0x88'),_0x5a44ce+'%');}else{_0x6447['or'](_0xfda3('0x89'),qs[_0xfda3('0x68')](_0x5a44ce))['or'](_0xfda3('0x8a'),qs[_0xfda3('0x68')](_0x5a44ce));}}}_0x36aa3a[_0xfda3('0x44')](_0x6447);_0x36aa3a[_0xfda3('0x8b')](_0xfda3('0x8c'));var _0x8b758f={'type':db['Sequelize'][_0xfda3('0x8d')][_0xfda3('0x8e')],'raw':!![]};var _0x46210d=_0x36aa3a[_0xfda3('0x8f')]();_0x46210d[_0xfda3('0x47')]('i.id');_0x46210d['field'](_0xfda3('0x90'),_0xfda3('0x5f'));if(_0x3d1cb2[_0xfda3('0x91')]){_0x3d1cb2[_0xfda3('0x91')][_0xfda3('0x2f')](function(_0x402d0d){var _0x38e5d5=_0x402d0d[0x0]===_0xfda3('0x92')?_0x402d0d[0x0]:'i.'+_0x402d0d[0x0];_0x36aa3a[_0xfda3('0x91')](_0x38e5d5,_0x402d0d[0x1]===_0xfda3('0x93')?![]:!![]);});}if(!_[_0xfda3('0x77')](_0x26ffee)){_0x36aa3a['having'](_0x574f02);_0x46210d[_0xfda3('0x44')]('t.id\x20IN\x20?',_0x26ffee);}BPromise['resolve']()['then'](function(){if(!_0x3b430d){if(_0x2074e7[_0xfda3('0x3b')]['MailAccountId'])return;_0x46210d[_0xfda3('0x44')](_0xfda3('0x94'));_0x36aa3a['where'](_0xfda3('0x94'));return;}if(_0x2074e7[_0xfda3('0x95')]['role']!==_0xfda3('0x96'))return;return _0x2074e7['user'][_0xfda3('0x97')]({'attributes':['id'],'raw':!![]})[_0xfda3('0x27')](function(_0x5ee695){if(_[_0xfda3('0x77')](_0x5ee695)){_0x46210d[_0xfda3('0x44')](_0xfda3('0x98'));_0x36aa3a[_0xfda3('0x44')](_0xfda3('0x98'));}else{_0x46210d['where'](_0xfda3('0x78'),_[_0xfda3('0x38')](_0x5ee695,'id'));_0x36aa3a[_0xfda3('0x44')](_0xfda3('0x78'),_[_0xfda3('0x38')](_0x5ee695,'id'));}});})['then'](function(){if(_0x2074e7['user']['role']===_0xfda3('0x96')&&!_0x3b430d&&!_0x2074e7[_0xfda3('0x3b')][_0xfda3('0x99')])return[];return db[_0xfda3('0x9a')][_0xfda3('0x3b')](_0x46210d[_0xfda3('0x9b')](),_0x8b758f);})[_0xfda3('0x27')](function(_0xeb8e37){_0x24c7ad['count']=_0xeb8e37[_0xfda3('0x5d')];if(_0x24c7ad[_0xfda3('0x9c')]===0x0)return[];return db['sequelize'][_0xfda3('0x3b')](_0x12b533[_0xfda3('0x9b')](),_0x8b758f)['then'](function(_0x4cd3bd){_0x1bd0d8=_[_0xfda3('0x9d')](_0x4cd3bd,'id');_0x8b758f=_[_0xfda3('0x9e')](_0x8b758f,{'model':db[_0xfda3('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2074e7[_0xfda3('0x3b')]['fields']){_0x3d1cb2[_0xfda3('0x40')][_0xfda3('0x2f')](function(_0x53575b){_0x36aa3a[_0xfda3('0x47')]('i.'+_0x53575b);});}else{_0x36aa3a['field'](_0xfda3('0x90'),_0xfda3('0x5f'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0x9f'),_0xfda3('0xa0'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xa1'),_0xfda3('0xa2'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xa3'),_0xfda3('0x92'));_0x36aa3a['field']('i.id');_0x36aa3a[_0xfda3('0x47')]('i.createdAt');_0x36aa3a[_0xfda3('0x47')]('i.updatedAt');_0x36aa3a['field']('i.closed');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xa4'));_0x36aa3a['field']('i.attach');_0x36aa3a['field']('i.lastMsgAt');_0x36aa3a['field']('i.lastMsgDirection');_0x36aa3a[_0xfda3('0x47')]('i.subject');_0x36aa3a['field'](_0xfda3('0xa5'));_0x36aa3a['field']('i.secondDisposition');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xa6'));_0x36aa3a[_0xfda3('0x47')]('i.substatus');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xa7'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xa8'));_0x36aa3a['field'](_0xfda3('0xa9'));_0x36aa3a[_0xfda3('0x47')]('i.UserId');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xaa'),_0xfda3('0xab'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xac'),'Contact.lastName');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xad'),'Contact.email');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xae'),'Contact.phone');_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xaf'),'Contact.mobile');_0x36aa3a['field'](_0xfda3('0xb0'),_0xfda3('0xb1'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xb2'),_0xfda3('0xb3'));_0x36aa3a[_0xfda3('0x47')](_0xfda3('0xb4'),'Owner.internal');_0x36aa3a['field'](_0xfda3('0xb5'),_0xfda3('0x2c'));}if(_0x3d1cb2[_0xfda3('0x21')])_0x36aa3a['limit'](_0x3d1cb2[_0xfda3('0x21')]);if(_0x3d1cb2[_0xfda3('0x20')])_0x36aa3a[_0xfda3('0x20')](_0x3d1cb2['offset']);return db['sequelize'][_0xfda3('0x3b')](_0x36aa3a[_0xfda3('0x9b')](),_0x8b758f);})[_0xfda3('0x27')](function(_0x4e2d0d){_0x2acde1[_0xfda3('0x44')](_0xfda3('0xb6'),_['map'](_0x4e2d0d,'id'));return db[_0xfda3('0x9a')][_0xfda3('0x3b')](_0x2acde1['toString'](),_0x8b758f)[_0xfda3('0x27')](function(_0x1b1e75){var _0x349072=_[_0xfda3('0xb7')](_0x1b1e75,_0xfda3('0xb8'));var _0x8d19b8=[];return db[_0xfda3('0xb9')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0xfda3('0x27')](function(_0x1710f1){var _0x3e19e0=_0x1710f1['enableEmailPreview'];_0x4e2d0d[_0xfda3('0x2f')](function(_0x534144){_0x8d19b8['push'](updateMailInteraction(_0x534144,_0x1bd0d8,_0x349072,_0x3e19e0));});return BPromise[_0xfda3('0xba')](_0x8d19b8);});});});})[_0xfda3('0x27')](function(_0x3d1cb3){_0x24c7ad[_0xfda3('0xbb')]=_0x3d1cb3;return _0x24c7ad;})['then'](respondWithFilteredResult(_0x151f32,_0x3d1cb2))[_0xfda3('0x36')](handleError(_0x151f32,null));};exports[_0xfda3('0xbc')]=function(_0xca77d4,_0x451f56){var _0x509a1e={'raw':![],'where':{'id':_0xca77d4[_0xfda3('0xbd')]['id']}},_0x524d9d={};_0x524d9d[_0xfda3('0x3f')]=_[_0xfda3('0x3c')](db[_0xfda3('0x31')][_0xfda3('0xbe')]);_0x524d9d[_0xfda3('0x3b')]=_['keys'](_0xca77d4[_0xfda3('0x3b')]);_0x524d9d[_0xfda3('0x3d')]=_[_0xfda3('0x3e')](_0x524d9d[_0xfda3('0x3f')],_0x524d9d[_0xfda3('0x3b')]);_0x509a1e[_0xfda3('0x40')]=_[_0xfda3('0x3e')](_0x524d9d['model'],qs[_0xfda3('0x41')](_0xca77d4[_0xfda3('0x3b')][_0xfda3('0x41')]));_0x509a1e[_0xfda3('0x40')]=_0x509a1e[_0xfda3('0x40')][_0xfda3('0x5d')]?_0x509a1e[_0xfda3('0x40')]:_0x524d9d[_0xfda3('0x3f')];if(_0xca77d4['query'][_0xfda3('0xbf')]){_0x509a1e[_0xfda3('0xc0')]=[{'all':!![]}];}_0x509a1e=_[_0xfda3('0x9e')]({},_0x509a1e,_0xca77d4['options']);return db[_0xfda3('0x31')][_0xfda3('0x5e')](_0x509a1e)[_0xfda3('0x27')](handleEntityNotFound(_0x451f56,null))[_0xfda3('0x27')](respondWithResult(_0x451f56,null))[_0xfda3('0x36')](handleError(_0x451f56,null));};exports[_0xfda3('0xc1')]=function(_0x2229b8,_0x4e4ab1){return db['MailInteraction'][_0xfda3('0xc1')](_0x2229b8[_0xfda3('0xc2')],{})[_0xfda3('0x27')](respondWithResult(_0x4e4ab1,0xc9))[_0xfda3('0x36')](handleError(_0x4e4ab1,null));};exports[_0xfda3('0x26')]=function(_0x5dec3b,_0x518ebd){if(_0x5dec3b[_0xfda3('0xc2')]['id']){delete _0x5dec3b['body']['id'];}return db[_0xfda3('0x31')][_0xfda3('0x5e')]({'where':{'id':_0x5dec3b[_0xfda3('0xbd')]['id']}})[_0xfda3('0x27')](handleEntityNotFound(_0x518ebd,null))[_0xfda3('0x27')](saveUpdates(_0x5dec3b[_0xfda3('0xc2')],null))['then'](respondWithResult(_0x518ebd,null))['catch'](handleError(_0x518ebd,null));};exports[_0xfda3('0xc3')]=function(_0x1c8f32,_0x52c629){return db[_0xfda3('0x31')][_0xfda3('0x5e')]({'where':{'id':_0x1c8f32['params']['id']}})[_0xfda3('0x27')](handleEntityNotFound(_0x52c629,null))['then'](removeEntity(_0x52c629,null))[_0xfda3('0x36')](handleError(_0x52c629,null));};exports[_0xfda3('0xc4')]=function(_0x4da655,_0x1fcb88){return db[_0xfda3('0x31')]['describe']()[_0xfda3('0x27')](respondWithResult(_0x1fcb88,null))[_0xfda3('0x36')](handleError(_0x1fcb88,null));};exports['addMessage']=function(_0x408d3e,_0x13cb24,_0x1c02fa){return db[_0xfda3('0xc5')][_0xfda3('0x5e')]({'where':{'id':_0x408d3e[_0xfda3('0xbd')]['id']}})['then'](handleEntityNotFound(_0x13cb24,null))[_0xfda3('0x27')](function(_0x1d1974){if(_0x1d1974){return _0x1d1974['addMessage'](_0x408d3e['body'][_0xfda3('0xc6')],_['omit'](_0x408d3e['body'],[_0xfda3('0xc6'),'id'])||{});}})['then'](respondWithResult(_0x13cb24,null))[_0xfda3('0x36')](handleError(_0x13cb24,null));};exports[_0xfda3('0xc7')]=function(_0x30f340,_0x4c06eb,_0x36ba8a){var _0x58318f={'raw':![],'where':{}};var _0x5541e8={};var _0x137605={'count':0x0,'rows':[]};return db[_0xfda3('0x31')][_0xfda3('0x32')]({'where':{'id':_0x30f340[_0xfda3('0xbd')]['id']}})[_0xfda3('0x27')](handleEntityNotFound(_0x4c06eb,null))['then'](function(_0x445b15){if(_0x445b15){_0x5541e8[_0xfda3('0x3f')]=_['keys'](db[_0xfda3('0xc5')]['rawAttributes']);_0x5541e8[_0xfda3('0x3b')]=_[_0xfda3('0x3c')](_0x30f340[_0xfda3('0x3b')]);_0x5541e8['filters']=_[_0xfda3('0x3e')](_0x5541e8['model'],_0x5541e8['query']);_0x58318f[_0xfda3('0x40')]=_[_0xfda3('0x3e')](_0x5541e8[_0xfda3('0x3f')],qs['fields'](_0x30f340[_0xfda3('0x3b')][_0xfda3('0x41')]));_0x58318f[_0xfda3('0x40')]=_0x58318f['attributes'][_0xfda3('0x5d')]?_0x58318f['attributes']:_0x5541e8[_0xfda3('0x3f')];if(!_0x30f340[_0xfda3('0x3b')][_0xfda3('0x42')](_0xfda3('0xc8'))){_0x58318f['limit']=qs[_0xfda3('0x21')](_0x30f340['query'][_0xfda3('0x21')]);_0x58318f[_0xfda3('0x20')]=qs[_0xfda3('0x20')](_0x30f340['query']['offset']);}_0x58318f[_0xfda3('0x91')]=qs[_0xfda3('0x43')](_0x30f340[_0xfda3('0x3b')][_0xfda3('0x43')]);_0x58318f[_0xfda3('0x44')]=qs['filters'](_['pick'](_0x30f340[_0xfda3('0x3b')],_0x5541e8[_0xfda3('0x3d')]));_0x58318f['where'][_0xfda3('0xb8')]=_0x445b15['id'];if(_0x30f340[_0xfda3('0x3b')][_0xfda3('0x84')]){_0x58318f[_0xfda3('0x44')]=_[_0xfda3('0x9e')](_0x58318f[_0xfda3('0x44')],{'$or':_[_0xfda3('0x38')](_0x58318f[_0xfda3('0x40')],function(_0x62f9bb){var _0x55bbab={};_0x55bbab[_0x62f9bb]={'$like':'%'+_0x30f340[_0xfda3('0x3b')][_0xfda3('0x84')]+'%'};return _0x55bbab;})});}if(_0x30f340[_0xfda3('0x3b')]['$gte']){var _0x26e4db=_0x30f340[_0xfda3('0x3b')][_0xfda3('0x7c')][_0xfda3('0x2e')](',');var _0x5e091c={};_0x5e091c[_0x26e4db[0x0]]={'$gte':moment(_0x26e4db[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58318f[_0xfda3('0x44')]=_[_0xfda3('0x9e')](_0x58318f[_0xfda3('0x44')],_0x5e091c);}_0x58318f=_[_0xfda3('0x9e')]({},_0x58318f,_0x30f340[_0xfda3('0xc9')]);return db['MailMessage']['count']({'where':_0x58318f['where']})[_0xfda3('0x27')](function(_0x239b92){_0x137605[_0xfda3('0x9c')]=_0x239b92;if(_0x30f340[_0xfda3('0x3b')][_0xfda3('0xbf')]){_0x58318f[_0xfda3('0xc0')]=[{'all':!![]}];}return db[_0xfda3('0xc5')][_0xfda3('0xca')](_0x58318f);})[_0xfda3('0x27')](function(_0xf87691){if(_0x30f340[_0xfda3('0x3b')]['inlineCss']===_0xfda3('0xcb')){for(var _0x355f69=0x0;_0x355f69<_0xf87691[_0xfda3('0x5d')];_0x355f69++){_0xf87691[_0x355f69]['body']=juice(_0xf87691[_0x355f69]['body']);}}_0x137605[_0xfda3('0xbb')]=_0xf87691;return _0x137605;});}})[_0xfda3('0x27')](respondWithFilteredResult(_0x4c06eb,_0x58318f))[_0xfda3('0x36')](handleError(_0x4c06eb,null));};exports['addTags']=function(_0x411d85,_0x107129,_0x4a7ed7){return db['MailInteraction'][_0xfda3('0x5e')]({'where':{'id':_0x411d85[_0xfda3('0xbd')]['id']}})['then'](handleEntityNotFound(_0x107129,null))[_0xfda3('0x27')](function(_0x46463b){if(_0x46463b){return _0x46463b[_0xfda3('0xcc')](_0x411d85['body'][_0xfda3('0xc6')],_[_0xfda3('0xcd')](_0x411d85[_0xfda3('0xc2')],[_0xfda3('0xc6'),'id'])||{})[_0xfda3('0xce')](function(){return db[_0xfda3('0x6d')][_0xfda3('0xca')]({'attributes':['id','name',_0xfda3('0xcf')],'where':{'id':_0x411d85[_0xfda3('0xc2')][_0xfda3('0xc6')]}});})[_0xfda3('0x27')](function(_0x597660){socket[_0xfda3('0xd0')](_0xfda3('0xd1'),{'id':Number(_0x411d85['params']['id']),'tags':_0x597660||[]});return{'id':Number(_0x411d85['params']['id']),'tags':_0x597660||[]};});}})[_0xfda3('0x27')](respondWithResult(_0x107129,null))[_0xfda3('0x36')](handleError(_0x107129,null));};exports[_0xfda3('0xd2')]=function(_0x493aea,_0x3f3834,_0x39f666){return db[_0xfda3('0x31')]['find']({'where':{'id':_0x493aea[_0xfda3('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3f3834,null))['then'](function(_0x51ac2e){if(_0x51ac2e){return _0x51ac2e[_0xfda3('0xd2')](_0x493aea[_0xfda3('0x3b')][_0xfda3('0xc6')]);}})[_0xfda3('0x27')](respondWithStatusCode(_0x3f3834,null))['catch'](handleError(_0x3f3834,null));};exports[_0xfda3('0xd3')]=function(_0x16d11c,_0x55b13b){var _0x132c7b=moment()['unix']()[_0xfda3('0x9b')]();var _0x13fa31=path[_0xfda3('0xd4')](config[_0xfda3('0xd5')],_0xfda3('0xd6'),'files',_0xfda3('0xd7'));var _0x1d48a1=path[_0xfda3('0xd4')](config[_0xfda3('0xd5')],'server',_0xfda3('0xd8'),_0xfda3('0xd9'));var _0x44bcb8=path[_0xfda3('0xd4')](_0x13fa31,_0x132c7b);var _0x444cd0=util['format'](_0xfda3('0xda'),_0x16d11c[_0xfda3('0xbd')]['id'],_0x132c7b);var _0x291a71=path['join'](_0x13fa31,_0x444cd0);var _0x4ee582=[];if(_0x16d11c[_0xfda3('0x3b')][_0xfda3('0xd9')]){_0x4ee582[_0xfda3('0x30')]({'model':db[_0xfda3('0xdb')],'as':'Attachments','raw':!![]});}var _0x129e42=[{'model':db[_0xfda3('0xc5')],'as':_0xfda3('0xdc'),'attributes':['id',_0xfda3('0xc2'),_0xfda3('0x4c'),'to','cc',_0xfda3('0xdd'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0xfda3('0x43')]('id'),'include':_0x4ee582}];return db[_0xfda3('0x31')]['find']({'where':{'id':_0x16d11c[_0xfda3('0xbd')]['id']},'include':_0x129e42})[_0xfda3('0x27')](handleEntityNotFound(_0x55b13b,null))[_0xfda3('0x27')](function(_0x5213a0){if(_0x5213a0&&_0x5213a0[_0xfda3('0xdc')]){var _0x1e8268=_0x5213a0[_0xfda3('0xde')]({'plain':!![]});fs[_0xfda3('0xdf')](_0x44bcb8);return BPromise['each'](_0x1e8268[_0xfda3('0xdc')],function(_0x1aea3a,_0x4bf33b){var _0x5a7b97={'from':_0x1aea3a[_0xfda3('0x4c')],'to':_0x1aea3a['to'],'subject':_0x1aea3a[_0xfda3('0xe0')],'html':_0x1aea3a[_0xfda3('0xc2')],'headers':{'Date':moment(_0x1aea3a[_0xfda3('0x7a')])[_0xfda3('0xe1')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1aea3a['cc']){_0x5a7b97[_0xfda3('0xe2')]['Cc']=_0x1aea3a['cc'];}if(_0x1aea3a[_0xfda3('0xdd')]){_0x5a7b97['headers']['Bcc']=_0x1aea3a[_0xfda3('0xdd')];}return new BPromise(function(_0x491e4a,_0x4ac25c){if(_0x1aea3a[_0xfda3('0xe3')]){for(var _0x4a1223=0x0;_0x4a1223<_0x1aea3a['Attachments'][_0xfda3('0x5d')];_0x4a1223++){var _0x24e9ea=_0x1aea3a[_0xfda3('0xe3')][_0x4a1223];var _0x48652e=path['join'](_0x1d48a1,_0x24e9ea[_0xfda3('0xe4')]);if(fs[_0xfda3('0xe5')](_0x48652e)){_0x5a7b97['attachments'][_0xfda3('0x30')]({'name':_0x24e9ea[_0xfda3('0x2a')],'contentType':_0x24e9ea[_0xfda3('0x3a')],'data':fs[_0xfda3('0xe6')](_0x48652e)});}}}emlformat[_0xfda3('0xe7')](_0x5a7b97,function(_0x9c7fc4,_0x49e3db){if(_0x9c7fc4)return _0x4ac25c(_0x9c7fc4);fs[_0xfda3('0xe8')](path['join'](_0x44bcb8,util[_0xfda3('0xe1')](_0xfda3('0xe9'),_0x4bf33b)),_0x49e3db);return _0x491e4a(_0x49e3db);});});})[_0xfda3('0x27')](function(){return new BPromise(function(_0x1f634a,_0xaf416b){zipdir(_0x44bcb8,{'saveTo':_0x291a71},function(_0x2b69a4,_0x5cfd3a){if(_0x2b69a4)return _0xaf416b(_0x2b69a4);return _0x1f634a(_0x5cfd3a);});})[_0xfda3('0x27')](function(){return new BPromise(function(_0x26311f,_0x43ec4d){rimraf(_0x44bcb8,function(_0x3b1d2a){if(_0x3b1d2a)_0x43ec4d(_0x3b1d2a);return _0x26311f();});});})[_0xfda3('0x27')](function(){return _0x55b13b[_0xfda3('0xd3')](_0x291a71,_0x444cd0,function(_0x2e3604){if(_0x2e3604){console[_0xfda3('0xea')](_0xfda3('0xeb'),_0x2e3604);}else{fs[_0xfda3('0xec')](_0x291a71);}});});});}else{return _0x55b13b[_0xfda3('0x1c')](0xc8);}})['catch'](handleError(_0x55b13b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index aa40416..b596572 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 _0x266b=['setDataValue','Users','map','findAll','unreadMessages','emit','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','getUsers','then'];(function(_0x3d3a25,_0x3496d8){var _0x13aa47=function(_0x454e5d){while(--_0x454e5d){_0x3d3a25['push'](_0x3d3a25['shift']());}};_0x13aa47(++_0x3496d8);}(_0x266b,0xad));var _0xb266=function(_0x10e9b2,_0x120293){_0x10e9b2=_0x10e9b2-0x0;var _0x4df1a8=_0x266b[_0x10e9b2];return _0x4df1a8;};'use strict';var EventEmitter=require(_0xb266('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xb266('0x1')];var MailMessage=require(_0xb266('0x2'))['db'][_0xb266('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xb266('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x24c0e1){return function(_0x47130e,_0x8f5a93,_0x36ed05){_0x47130e[_0xb266('0x5')]({'attributes':['id'],'raw':!![]})[_0xb266('0x6')](function(_0x141b99){_0x47130e[_0xb266('0x7')](_0xb266('0x8'),_0x141b99[_0xb266('0x9')](function(_0x195e44){return{'id':_0x195e44['id']};}));return MailMessage[_0xb266('0xa')]({'where':{'MailInteractionId':_0x47130e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x319227){_0x47130e['setDataValue'](_0xb266('0xb'),_0x319227['length']);MailInteractionEvents[_0xb266('0xc')](_0x24c0e1+':'+_0x47130e['id'],_0x47130e);MailInteractionEvents['emit'](_0x24c0e1,_0x47130e);_0x36ed05(null);})['catch'](_0x36ed05(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb266('0xd')](e,emitEvent(event));}}module[_0xb266('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x7500=['setMaxListeners','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7500,0x115));var _0x0750=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7500[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x0750('0x0'));var MailInteraction=require(_0x0750('0x1'))['db'][_0x0750('0x2')];var MailMessage=require(_0x0750('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0750('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0750('0x4')};function emitEvent(_0x39cade){return function(_0x486477,_0x4ac863,_0x434ae8){_0x486477[_0x0750('0x5')]({'attributes':['id'],'raw':!![]})[_0x0750('0x6')](function(_0x20aca4){_0x486477[_0x0750('0x7')]('Users',_0x20aca4['map'](function(_0x4c7d2a){return{'id':_0x4c7d2a['id']};}));return MailMessage[_0x0750('0x8')]({'where':{'MailInteractionId':_0x486477['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0750('0x6')](function(_0x8c4964){_0x486477[_0x0750('0x7')](_0x0750('0x9'),_0x8c4964['length']);MailInteractionEvents[_0x0750('0xa')](_0x39cade+':'+_0x486477['id'],_0x486477);MailInteractionEvents[_0x0750('0xa')](_0x39cade,_0x486477);_0x434ae8(null);})[_0x0750('0xb')](_0x434ae8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0750('0xc')](e,emitEvent(event));}}module[_0x0750('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index dd6f86f..6a8a998 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 _0xa4e9=['subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','catch','utf8mb4','lodash','util','moment','request-promise','../../config/environment','./mailInteraction.attributes','MailInteraction','fti_mail_interactions'];(function(_0x5a2cad,_0x323a31){var _0x3ee6f2=function(_0x519915){while(--_0x519915){_0x5a2cad['push'](_0x5a2cad['shift']());}};_0x3ee6f2(++_0x323a31);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0xa2c084,_0x4ede18){_0xa2c084=_0xa2c084-0x0;var _0x38df1c=_0xa4e9[_0xa2c084];return _0x38df1c;};'use strict';var _=require(_0x9a4e('0x0'));var util=require(_0x9a4e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a4e('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a4e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a4e('0x4'));var attributes=require(_0x9a4e('0x5'));module['exports']=function(_0x4c78cd,_0x5dcbc7){return _0x4c78cd['define'](_0x9a4e('0x6'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x9a4e('0x7'),'fields':[_0x9a4e('0x8'),'to'],'type':_0x9a4e('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49bd7b,_0xfec7bb,_0x4fb7b7){if(_0x49bd7b[_0x9a4e('0xa')]){_0x49bd7b['substatusAt']=moment()[_0x9a4e('0xb')](_0x9a4e('0xc'));}if(_0x49bd7b[_0x9a4e('0xd')]){_0x49bd7b[_0x9a4e('0xe')]=moment()[_0x9a4e('0xb')](_0x9a4e('0xc'));}_0x4fb7b7(null,_0xfec7bb);},'beforeUpdate':function(_0x500e12,_0x56205a,_0x382718){if(_0x500e12[_0x9a4e('0xf')](_0x9a4e('0xa'))){_0x500e12['substatusAt']=_0x500e12['substatus']?moment()[_0x9a4e('0xb')](_0x9a4e('0xc')):null;}if(_0x500e12[_0x9a4e('0xf')]('closed')){_0x500e12['closedAt']=moment()[_0x9a4e('0xb')]('YYYY-MM-DD\x20HH:mm:ss');_0x500e12[_0x9a4e('0xa')]=null;_0x500e12['substatusAt']=null;}_0x382718(null,_0x500e12);},'afterUpdate':function(_0x2a538b,_0x4a2ac9,_0x5cd3c4){var _0x828965=_0x4c78cd['models'];var _0x773e39=_0x2a538b[_0x9a4e('0x10')]({'plain':!![]});if(_0x773e39[_0x9a4e('0xd')]){return _0x828965[_0x9a4e('0x11')][_0x9a4e('0x12')]({'read':!![]},{'where':{'MailInteractionId':_0x773e39['id']}})['then'](function(){_0x5cd3c4();})[_0x9a4e('0x13')](function(_0x4b2ff0){_0x5cd3c4(_0x4b2ff0);});}else{_0x5cd3c4();}}},'charset':_0x9a4e('0x14'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8bf7=['rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatus','substatusAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4abc3b,_0x50fbd1){var _0x49c2a5=function(_0x2f7114){while(--_0x2f7114){_0x4abc3b['push'](_0x4abc3b['shift']());}};_0x49c2a5(++_0x50fbd1);}(_0x8bf7,0x139));var _0x78bf=function(_0x5da057,_0x5946bc){_0x5da057=_0x5da057-0x0;var _0x24305d=_0x8bf7[_0x5da057];return _0x24305d;};'use strict';var _=require(_0x78bf('0x0'));var util=require(_0x78bf('0x1'));var logger=require(_0x78bf('0x2'))('api');var moment=require(_0x78bf('0x3'));var BPromise=require(_0x78bf('0x4'));var rp=require(_0x78bf('0x5'));var fs=require('fs');var path=require(_0x78bf('0x6'));var rimraf=require(_0x78bf('0x7'));var config=require(_0x78bf('0x8'));var attributes=require(_0x78bf('0x9'));module[_0x78bf('0xa')]=function(_0x2d8b0a,_0x85fc98){return _0x2d8b0a[_0x78bf('0xb')](_0x78bf('0xc'),attributes,{'tableName':_0x78bf('0xd'),'paranoid':![],'indexes':[{'name':_0x78bf('0xe'),'fields':[_0x78bf('0xf'),'to'],'type':_0x78bf('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb2e15,_0x39314d,_0x3d40aa){if(_0xb2e15['substatus']){_0xb2e15['substatusAt']=moment()['format'](_0x78bf('0x11'));}if(_0xb2e15[_0x78bf('0x12')]){_0xb2e15[_0x78bf('0x13')]=moment()[_0x78bf('0x14')](_0x78bf('0x11'));}_0x3d40aa(null,_0x39314d);},'beforeUpdate':function(_0x586f56,_0x29c2dd,_0x53dd39){if(_0x586f56[_0x78bf('0x15')](_0x78bf('0x16'))){_0x586f56[_0x78bf('0x17')]=_0x586f56[_0x78bf('0x16')]?moment()[_0x78bf('0x14')](_0x78bf('0x11')):null;}if(_0x586f56[_0x78bf('0x15')](_0x78bf('0x12'))){_0x586f56[_0x78bf('0x13')]=moment()[_0x78bf('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x586f56[_0x78bf('0x16')]=null;_0x586f56[_0x78bf('0x17')]=null;}_0x53dd39(null,_0x586f56);},'afterUpdate':function(_0x2ad79a,_0x14f99b,_0x70640a){var _0x4d1801=_0x2d8b0a[_0x78bf('0x18')];var _0x2bf908=_0x2ad79a[_0x78bf('0x19')]({'plain':!![]});if(_0x2bf908[_0x78bf('0x12')]){return _0x4d1801[_0x78bf('0x1a')][_0x78bf('0x1b')]({'read':!![]},{'where':{'MailInteractionId':_0x2bf908['id']}})[_0x78bf('0x1c')](function(){_0x70640a();})[_0x78bf('0x1d')](function(_0x6f222c){_0x70640a(_0x6f222c);});}else{_0x70640a();}}},'charset':_0x78bf('0x1e'),'collate':_0x78bf('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b69f3c7..8d378fc 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 _0x843b=['stringify','error','message','info','result','catch','UpdateMailInteraction','update','body','options','raw','limit','AddTagsToMailInteraction','MailInteraction','find','where','then','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5837d1,_0x4661e0){var _0x43b3b7=function(_0x22c638){while(--_0x22c638){_0x5837d1['push'](_0x5837d1['shift']());}};_0x43b3b7(++_0x4661e0);}(_0x843b,0xc5));var _0xb843=function(_0x311df7,_0x48a281){_0x311df7=_0x311df7-0x0;var _0x103376=_0x843b[_0x311df7];return _0x103376;};'use strict';var _=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var moment=require(_0xb843('0x2'));var BPromise=require('bluebird');var rs=require(_0xb843('0x3'));var fs=require('fs');var Redis=require(_0xb843('0x4'));var db=require(_0xb843('0x5'))['db'];var utils=require(_0xb843('0x6'));var logger=require(_0xb843('0x7'))(_0xb843('0x8'));var config=require(_0xb843('0x9'));var jayson=require(_0xb843('0xa'));var client=jayson[_0xb843('0xb')][_0xb843('0xc')]({'port':0x232a});config[_0xb843('0xd')]=_[_0xb843('0xe')](config[_0xb843('0xd')],{'host':_0xb843('0xf'),'port':0x18eb});var socket=require(_0xb843('0x10'))(new Redis(config[_0xb843('0xd')]));require('./mailInteraction.socket')[_0xb843('0x11')](socket);function respondWithRpcPromise(_0x3ce424,_0x1b9b02,_0x31f6c1){return new BPromise(function(_0xc427dd,_0x192ea0){return client[_0xb843('0x12')](_0x3ce424,_0x31f6c1)['then'](function(_0x5e1355){logger['info'](_0xb843('0x13'),_0x1b9b02,_0xb843('0x14'));logger[_0xb843('0x15')](_0xb843('0x16'),_0x1b9b02,_0xb843('0x14'),JSON[_0xb843('0x17')](_0x5e1355));if(_0x5e1355[_0xb843('0x18')]){if(_0x5e1355['error']['code']===0x1f4){logger[_0xb843('0x18')](_0xb843('0x13'),_0x1b9b02,_0x5e1355['error']['message']);return _0x192ea0(_0x5e1355[_0xb843('0x18')][_0xb843('0x19')]);}logger[_0xb843('0x18')]('MailInteraction,\x20%s,\x20%s',_0x1b9b02,_0x5e1355[_0xb843('0x18')][_0xb843('0x19')]);return _0xc427dd(_0x5e1355[_0xb843('0x18')][_0xb843('0x19')]);}else{logger[_0xb843('0x1a')](_0xb843('0x13'),_0x1b9b02,_0xb843('0x14'));_0xc427dd(_0x5e1355[_0xb843('0x1b')]['message']);}})[_0xb843('0x1c')](function(_0x103674){logger[_0xb843('0x18')](_0xb843('0x13'),_0x1b9b02,_0x103674);_0x192ea0(_0x103674);});});}exports[_0xb843('0x1d')]=function(_0x54953e){var _0x4b5c36=this;return new Promise(function(_0x25a0a5,_0x33abbb){return db['MailInteraction'][_0xb843('0x1e')](_0x54953e[_0xb843('0x1f')],{'raw':_0x54953e[_0xb843('0x20')]?_0x54953e[_0xb843('0x20')][_0xb843('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54953e[_0xb843('0x20')]?_0x54953e[_0xb843('0x20')]['where']||null:null,'attributes':_0x54953e[_0xb843('0x20')]?_0x54953e[_0xb843('0x20')]['attributes']||null:null,'limit':_0x54953e[_0xb843('0x20')]?_0x54953e[_0xb843('0x20')][_0xb843('0x22')]||null:null})['then'](function(_0x218816){logger[_0xb843('0x1a')](_0xb843('0x1d'),_0x54953e);logger['debug']('UpdateMailInteraction',_0x54953e,JSON['stringify'](_0x218816));_0x25a0a5(_0x218816);})[_0xb843('0x1c')](function(_0x39ade6){logger['error'](_0xb843('0x1d'),_0x39ade6[_0xb843('0x19')],_0x54953e);_0x33abbb(_0x4b5c36[_0xb843('0x18')](0x1f4,_0x39ade6[_0xb843('0x19')]));});});};exports[_0xb843('0x23')]=function(_0x16a692){return new Promise(function(_0x4e4b9f,_0xd9565c){return db[_0xb843('0x24')][_0xb843('0x25')]({'where':_0x16a692['options']?_0x16a692[_0xb843('0x20')][_0xb843('0x26')]||null:null})[_0xb843('0x27')](function(_0x1e9202){if(_0x1e9202){return _0x1e9202[_0xb843('0x28')](_0x16a692['body'][_0xb843('0x29')],_[_0xb843('0x2a')](_0x16a692['body'],[_0xb843('0x29'),'id'])||{});}})['spread'](function(_0x3420a6){logger[_0xb843('0x1a')]('AddTags',_0x16a692);logger['debug']('AddTags',_0x16a692,JSON[_0xb843('0x17')](_0x3420a6));_0x4e4b9f(_0x3420a6);})[_0xb843('0x1c')](function(_0x5c71d1){logger[_0xb843('0x18')](_0xb843('0x2b'),_0x5c71d1[_0xb843('0x19')],_0x16a692);_0xd9565c(_this[_0xb843('0x18')](0x1f4,_0x5c71d1[_0xb843('0x19')]));});});}; \ No newline at end of file +var _0x8cc8=['result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','catch','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x385145,_0x4a490c){var _0x4eedcb=function(_0x3e1e8b){while(--_0x3e1e8b){_0x385145['push'](_0x385145['shift']());}};_0x4eedcb(++_0x4a490c);}(_0x8cc8,0x177));var _0x88cc=function(_0x4dc3af,_0x232b52){_0x4dc3af=_0x4dc3af-0x0;var _0x5334dd=_0x8cc8[_0x4dc3af];return _0x5334dd;};'use strict';var _=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var moment=require(_0x88cc('0x2'));var BPromise=require(_0x88cc('0x3'));var rs=require(_0x88cc('0x4'));var fs=require('fs');var Redis=require(_0x88cc('0x5'));var db=require(_0x88cc('0x6'))['db'];var utils=require(_0x88cc('0x7'));var logger=require(_0x88cc('0x8'))(_0x88cc('0x9'));var config=require(_0x88cc('0xa'));var jayson=require(_0x88cc('0xb'));var client=jayson[_0x88cc('0xc')]['http']({'port':0x232a});config['redis']=_[_0x88cc('0xd')](config[_0x88cc('0xe')],{'host':_0x88cc('0xf'),'port':0x18eb});var socket=require(_0x88cc('0x10'))(new Redis(config['redis']));require(_0x88cc('0x11'))[_0x88cc('0x12')](socket);function respondWithRpcPromise(_0x574946,_0x349991,_0x5586aa){return new BPromise(function(_0x379c2a,_0x23aee8){return client[_0x88cc('0x13')](_0x574946,_0x5586aa)[_0x88cc('0x14')](function(_0x5a70a9){logger[_0x88cc('0x15')](_0x88cc('0x16'),_0x349991,_0x88cc('0x17'));logger[_0x88cc('0x18')](_0x88cc('0x19'),_0x349991,_0x88cc('0x17'),JSON[_0x88cc('0x1a')](_0x5a70a9));if(_0x5a70a9[_0x88cc('0x1b')]){if(_0x5a70a9['error'][_0x88cc('0x1c')]===0x1f4){logger[_0x88cc('0x1b')](_0x88cc('0x16'),_0x349991,_0x5a70a9[_0x88cc('0x1b')][_0x88cc('0x1d')]);return _0x23aee8(_0x5a70a9[_0x88cc('0x1b')]['message']);}logger[_0x88cc('0x1b')](_0x88cc('0x16'),_0x349991,_0x5a70a9[_0x88cc('0x1b')][_0x88cc('0x1d')]);return _0x379c2a(_0x5a70a9[_0x88cc('0x1b')]['message']);}else{logger[_0x88cc('0x15')](_0x88cc('0x16'),_0x349991,_0x88cc('0x17'));_0x379c2a(_0x5a70a9[_0x88cc('0x1e')][_0x88cc('0x1d')]);}})['catch'](function(_0x2a08a4){logger[_0x88cc('0x1b')]('MailInteraction,\x20%s,\x20%s',_0x349991,_0x2a08a4);_0x23aee8(_0x2a08a4);});});}exports[_0x88cc('0x1f')]=function(_0x5ed326){var _0x38cee4=this;return new Promise(function(_0x2a88c4,_0x50cdaf){return db[_0x88cc('0x20')][_0x88cc('0x21')](_0x5ed326[_0x88cc('0x22')],{'raw':_0x5ed326[_0x88cc('0x23')]?_0x5ed326[_0x88cc('0x23')][_0x88cc('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ed326['options']?_0x5ed326[_0x88cc('0x23')][_0x88cc('0x25')]||null:null,'attributes':_0x5ed326[_0x88cc('0x23')]?_0x5ed326[_0x88cc('0x23')][_0x88cc('0x26')]||null:null,'limit':_0x5ed326[_0x88cc('0x23')]?_0x5ed326[_0x88cc('0x23')][_0x88cc('0x27')]||null:null})[_0x88cc('0x14')](function(_0x359dd8){logger[_0x88cc('0x15')](_0x88cc('0x1f'),_0x5ed326);logger[_0x88cc('0x18')]('UpdateMailInteraction',_0x5ed326,JSON[_0x88cc('0x1a')](_0x359dd8));_0x2a88c4(_0x359dd8);})[_0x88cc('0x28')](function(_0x44ae48){logger[_0x88cc('0x1b')](_0x88cc('0x1f'),_0x44ae48[_0x88cc('0x1d')],_0x5ed326);_0x50cdaf(_0x38cee4[_0x88cc('0x1b')](0x1f4,_0x44ae48[_0x88cc('0x1d')]));});});};exports['AddTagsToMailInteraction']=function(_0x53b48d){return new Promise(function(_0x401df8,_0x45f1c6){return db[_0x88cc('0x20')]['find']({'where':_0x53b48d['options']?_0x53b48d[_0x88cc('0x23')][_0x88cc('0x25')]||null:null})['then'](function(_0x3d2e96){if(_0x3d2e96){return _0x3d2e96[_0x88cc('0x29')](_0x53b48d[_0x88cc('0x22')]['ids'],_[_0x88cc('0x2a')](_0x53b48d[_0x88cc('0x22')],[_0x88cc('0x2b'),'id'])||{});}})['spread'](function(_0x2a9de4){logger[_0x88cc('0x15')](_0x88cc('0x2c'),_0x53b48d);logger[_0x88cc('0x18')](_0x88cc('0x2c'),_0x53b48d,JSON[_0x88cc('0x1a')](_0x2a9de4));_0x401df8(_0x2a9de4);})['catch'](function(_0x216cac){logger[_0x88cc('0x1b')](_0x88cc('0x2c'),_0x216cac[_0x88cc('0x1d')],_0x53b48d);_0x45f1c6(_this[_0x88cc('0x1b')](0x1f4,_0x216cac[_0x88cc('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 7873248..7f84040 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 _0x18f1=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x585257,_0x14f43c){var _0x52a536=function(_0x58455){while(--_0x58455){_0x585257['push'](_0x585257['shift']());}};_0x52a536(++_0x14f43c);}(_0x18f1,0x93));var _0x118f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x18f1[_0x4e676e];return _0x336a3c;};'use strict';var MailInteractionEvents=require(_0x118f('0x0'));var events=[_0x118f('0x1'),_0x118f('0x2'),_0x118f('0x3')];function createListener(_0x264587,_0x2acb6b){return function(_0x1ba431){_0x2acb6b[_0x118f('0x4')](_0x264587,_0x1ba431);};}function removeListener(_0x185276,_0x153c9e){return function(){MailInteractionEvents[_0x118f('0x5')](_0x185276,_0x153c9e);};}exports[_0x118f('0x6')]=function(_0x192164){for(var _0x3155b1=0x0,_0x556a8c=events[_0x118f('0x7')];_0x3155b1<_0x556a8c;_0x3155b1++){var _0x5b1ae8=events[_0x3155b1];var _0x309425=createListener(_0x118f('0x8')+_0x5b1ae8,_0x192164);MailInteractionEvents['on'](_0x5b1ae8,_0x309425);}}; \ No newline at end of file +var _0xc3f2=['register','mailInteraction:','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x5890db,_0x4aff2e){var _0x3a133e=function(_0x1dc9dd){while(--_0x1dc9dd){_0x5890db['push'](_0x5890db['shift']());}};_0x3a133e(++_0x4aff2e);}(_0xc3f2,0x1f3));var _0x2c3f=function(_0x43171a,_0x3d028e){_0x43171a=_0x43171a-0x0;var _0x3b90b9=_0xc3f2[_0x43171a];return _0x3b90b9;};'use strict';var MailInteractionEvents=require(_0x2c3f('0x0'));var events=[_0x2c3f('0x1'),_0x2c3f('0x2'),_0x2c3f('0x3')];function createListener(_0x5d875a,_0xb37302){return function(_0x3c0370){_0xb37302['emit'](_0x5d875a,_0x3c0370);};}function removeListener(_0x2f98eb,_0x1dfb96){return function(){MailInteractionEvents[_0x2c3f('0x4')](_0x2f98eb,_0x1dfb96);};}exports[_0x2c3f('0x5')]=function(_0x258e3a){for(var _0x2e862c=0x0,_0x577369=events['length'];_0x2e862c<_0x577369;_0x2e862c++){var _0x35f9eb=events[_0x2e862c];var _0x56d6ab=createListener(_0x2c3f('0x6')+_0x35f9eb,_0x258e3a);MailInteractionEvents['on'](_0x35f9eb,_0x56d6ab);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a6e5b43..b67e0b7 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 _0xbec5=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','accept'];(function(_0x59e0f0,_0x1201bc){var _0x59e8f5=function(_0x188624){while(--_0x188624){_0x59e0f0['push'](_0x59e0f0['shift']());}};_0x59e8f5(++_0x1201bc);}(_0xbec5,0xe5));var _0x5bec=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0xbec5[_0x1dd82f];return _0x353ca4;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['get'](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0xf')]);router[_0x5bec('0x10')]('/',auth[_0x5bec('0x9')](),interaction['tracked'](_0x5bec('0x11'),_0x5bec('0x12')),controller[_0x5bec('0x13')]);router['put'](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x14')](_0x5bec('0x15'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x16')]);router[_0x5bec('0x14')](_0x5bec('0x17'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x18')]);router[_0x5bec('0x19')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x1a')]);module[_0x5bec('0x1b')]=router; \ No newline at end of file +var _0x7fbe=['update','/:id/accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','mail','mailmessage:create','create','put'];(function(_0x24cfd1,_0x371132){var _0x426d59=function(_0x7ef0b5){while(--_0x7ef0b5){_0x24cfd1['push'](_0x24cfd1['shift']());}};_0x426d59(++_0x371132);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0x7fbe[_0x585d09];return _0x7d9a14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/:id/download',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')]('/',auth[_0xe7fb('0x9')](),interaction[_0xe7fb('0x10')](_0xe7fb('0x11'),_0xe7fb('0x12')),controller[_0xe7fb('0x13')]);router[_0xe7fb('0x14')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x15')]);router[_0xe7fb('0x14')](_0xe7fb('0x16'),auth[_0xe7fb('0x9')](),controller['accept']);router[_0xe7fb('0x14')](_0xe7fb('0x17'),auth['isAuthenticated'](),controller[_0xe7fb('0x18')]);router[_0xe7fb('0x19')]('/:id',auth[_0xe7fb('0x9')](),controller['destroy']);module[_0xe7fb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8b9f7af..2053e17 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 _0x6132=['STRING','DATE','BOOLEAN','lodash','TEXT','long','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6132,0xf3));var _0x2613=function(_0x31e0b8,_0x3310ef){_0x31e0b8=_0x31e0b8-0x0;var _0x56a40b=_0x6132[_0x31e0b8];return _0x56a40b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2613('0x0'));module['exports']={'body':{'type':Sequelize[_0x2613('0x1')](_0x2613('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2613('0x1')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2613('0x3')]('in','out'),'defaultValue':_0x2613('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2613('0x5')]},'to':{'type':Sequelize[_0x2613('0x1')](_0x2613('0x2'))},'cc':{'type':Sequelize['TEXT'](_0x2613('0x2'))},'bcc':{'type':Sequelize[_0x2613('0x1')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x2613('0x6')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2613('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2613('0x6')]},'originTo':{'type':Sequelize[_0x2613('0x1')](_0x2613('0x2'))},'originCc':{'type':Sequelize[_0x2613('0x1')](_0x2613('0x2'))}}; \ No newline at end of file +var _0x5d4e=['DATE','INTEGER','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING'];(function(_0x1fcf13,_0xbafbc7){var _0x4d7d97=function(_0x12c0cf){while(--_0x12c0cf){_0x1fcf13['push'](_0x1fcf13['shift']());}};_0x4d7d97(++_0xbafbc7);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe5d4('0x0'));module[_0xe5d4('0x1')]={'body':{'type':Sequelize[_0xe5d4('0x2')](_0xe5d4('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe5d4('0x2')]('medium')},'read':{'type':Sequelize[_0xe5d4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe5d4('0x5')]('in',_0xe5d4('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe5d4('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xe5d4('0x2')](_0xe5d4('0x3'))},'bcc':{'type':Sequelize[_0xe5d4('0x2')](_0xe5d4('0x3'))},'subject':{'type':Sequelize[_0xe5d4('0x2')]},'sentAt':{'type':Sequelize[_0xe5d4('0x8')]},'attach':{'type':Sequelize[_0xe5d4('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe5d4('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe5d4('0x8')]},'originTo':{'type':Sequelize[_0xe5d4('0x2')](_0xe5d4('0x3'))},'originCc':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3104172..b4e461a 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 _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./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','code','message','result'];(function(_0x212725,_0x552e4e){var _0x23b06b=function(_0x5720b7){while(--_0x5720b7){_0x212725['push'](_0x212725['shift']());}};_0x23b06b(++_0x552e4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./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','code','message','result'];(function(_0x2fcdd6,_0x451678){var _0x3fff65=function(_0x59fd37){while(--_0x59fd37){_0x2fcdd6['push'](_0x2fcdd6['shift']());}};_0x3fff65(++_0x451678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 396b2bd..a0d61fd 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 _0x43ca=['remove','emit','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x4272ea,_0x426a10){var _0x402f0b=function(_0x240717){while(--_0x240717){_0x4272ea['push'](_0x4272ea['shift']());}};_0x402f0b(++_0x426a10);}(_0x43ca,0xa6));var _0xa43c=function(_0x36fe46,_0x40010c){_0x36fe46=_0x36fe46-0x0;var _0x4d2e9c=_0x43ca[_0x36fe46];return _0x4d2e9c;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xa43c('0x0'))['db'][_0xa43c('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa43c('0x2')](0x0);var events={'afterCreate':_0xa43c('0x3'),'afterUpdate':_0xa43c('0x4'),'afterDestroy':_0xa43c('0x5')};function emitEvent(_0x36d119){return function(_0x27ae76,_0x4abe2b,_0x30b3a6){MailMessageEvents[_0xa43c('0x6')](_0x36d119+':'+_0x27ae76['id'],_0x27ae76);MailMessageEvents[_0xa43c('0x6')](_0x36d119,_0x27ae76);_0x30b3a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa43c('0x7')](e,emitEvent(event));}}module[_0xa43c('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x11f8=['update','remove','emit','exports','events','../../mysqldb','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11f8,0x6d));var _0x811f=function(_0x2d3246,_0x168d75){_0x2d3246=_0x2d3246-0x0;var _0x193d46=_0x11f8[_0x2d3246];return _0x193d46;};'use strict';var EventEmitter=require(_0x811f('0x0'));var MailMessage=require(_0x811f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x811f('0x2'),'afterUpdate':_0x811f('0x3'),'afterDestroy':_0x811f('0x4')};function emitEvent(_0x17f044){return function(_0x3a0a0e,_0x1b44e2,_0x5ca9b8){MailMessageEvents[_0x811f('0x5')](_0x17f044+':'+_0x3a0a0e['id'],_0x3a0a0e);MailMessageEvents[_0x811f('0x5')](_0x17f044,_0x3a0a0e);_0x5ca9b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x811f('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 b3207d5..c31c2d3 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 _0x669c=['bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','fromString','models','direction','toLowerCase','out','secret','MailInteraction','MailInteractionId','then','createdAt','body','error','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x669c,0x170));var _0xc669=function(_0x374d93,_0x3ff575){_0x374d93=_0x374d93-0x0;var _0x2bcde2=_0x669c[_0x374d93];return _0x2bcde2;};'use strict';var _=require(_0xc669('0x0'));var util=require(_0xc669('0x1'));var logger=require(_0xc669('0x2'))('api');var moment=require(_0xc669('0x3'));var BPromise=require(_0xc669('0x4'));var rp=require(_0xc669('0x5'));var htmlToText=require(_0xc669('0x6'));var fs=require('fs');var path=require(_0xc669('0x7'));var rimraf=require(_0xc669('0x8'));var config=require(_0xc669('0x9'));var attributes=require(_0xc669('0xa'));module[_0xc669('0xb')]=function(_0x486712,_0x25105c){return _0x486712[_0xc669('0xc')](_0xc669('0xd'),attributes,{'tableName':_0xc669('0xe'),'paranoid':![],'indexes':[{'name':_0xc669('0xf'),'fields':[_0xc669('0xf')]},{'name':'fti_mail_messages','fields':[_0xc669('0x10'),'subject'],'type':_0xc669('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x520772,_0x2efa20,_0x4ea3d7){if(_0x520772['body']){_0x520772[_0xc669('0x10')]=htmlToText[_0xc669('0x12')](_0x520772['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4ea3d7(null,_0x2efa20);},'afterCreate':function(_0x387183,_0x59b6d0,_0x2f86e8){var _0x3eb8f3=_0x486712[_0xc669('0x13')];var _0x1db4bd=_0x387183['get']({'plain':!![]});if(_0x1db4bd[_0xc669('0x14')][_0xc669('0x15')]()==='in'||_0x1db4bd[_0xc669('0x14')][_0xc669('0x15')]()===_0xc669('0x16')&&!_0x1db4bd[_0xc669('0x17')]&&!_['isNil'](_0x1db4bd['UserId'])){_0x3eb8f3[_0xc669('0x18')]['findOne']({'where':{'id':_0x1db4bd[_0xc669('0x19')]}})[_0xc669('0x1a')](function(_0x54ac7e){if(_0x54ac7e){_0x54ac7e['update']({'lastMsgAt':_0x1db4bd[_0xc669('0x1b')],'lastMsgDirection':_0x1db4bd[_0xc669('0x14')][_0xc669('0x15')](),'lastMsgBody':_0x1db4bd[_0xc669('0x1c')]});}})['catch'](function(_0x1048ef){console[_0xc669('0x1d')](_0x1048ef);});}_0x2f86e8();}},'charset':_0xc669('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe8f3=['path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','then','update','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','html-to-text'];(function(_0x48cb2b,_0x3b0835){var _0x3f3488=function(_0x23592e){while(--_0x23592e){_0x48cb2b['push'](_0x48cb2b['shift']());}};_0x3f3488(++_0x3b0835);}(_0xe8f3,0x12c));var _0x3e8f=function(_0x513430,_0x1a7cdf){_0x513430=_0x513430-0x0;var _0x4b3dea=_0xe8f3[_0x513430];return _0x4b3dea;};'use strict';var _=require('lodash');var util=require(_0x3e8f('0x0'));var logger=require('../../config/logger')(_0x3e8f('0x1'));var moment=require(_0x3e8f('0x2'));var BPromise=require(_0x3e8f('0x3'));var rp=require(_0x3e8f('0x4'));var htmlToText=require(_0x3e8f('0x5'));var fs=require('fs');var path=require(_0x3e8f('0x6'));var rimraf=require(_0x3e8f('0x7'));var config=require(_0x3e8f('0x8'));var attributes=require(_0x3e8f('0x9'));module[_0x3e8f('0xa')]=function(_0x1f6f2e,_0x4ee2fb){return _0x1f6f2e[_0x3e8f('0xb')](_0x3e8f('0xc'),attributes,{'tableName':_0x3e8f('0xd'),'paranoid':![],'indexes':[{'name':_0x3e8f('0xe'),'fields':['messageId']},{'name':_0x3e8f('0xf'),'fields':[_0x3e8f('0x10'),_0x3e8f('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4c2e8e,_0x4045e3,_0x12d305){if(_0x4c2e8e[_0x3e8f('0x12')]){_0x4c2e8e[_0x3e8f('0x10')]=htmlToText[_0x3e8f('0x13')](_0x4c2e8e[_0x3e8f('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x12d305(null,_0x4045e3);},'afterCreate':function(_0x339f9e,_0x37fa96,_0xb7cfa6){var _0xb58cc7=_0x1f6f2e[_0x3e8f('0x14')];var _0x1c02ed=_0x339f9e[_0x3e8f('0x15')]({'plain':!![]});if(_0x1c02ed['direction'][_0x3e8f('0x16')]()==='in'||_0x1c02ed[_0x3e8f('0x17')][_0x3e8f('0x16')]()==='out'&&!_0x1c02ed[_0x3e8f('0x18')]&&!_[_0x3e8f('0x19')](_0x1c02ed[_0x3e8f('0x1a')])){_0xb58cc7[_0x3e8f('0x1b')][_0x3e8f('0x1c')]({'where':{'id':_0x1c02ed['MailInteractionId']}})[_0x3e8f('0x1d')](function(_0x36cb02){if(_0x36cb02){_0x36cb02[_0x3e8f('0x1e')]({'lastMsgAt':_0x1c02ed['createdAt'],'lastMsgDirection':_0x1c02ed[_0x3e8f('0x17')][_0x3e8f('0x16')](),'lastMsgBody':_0x1c02ed['body']});}})['catch'](function(_0x34cf43){console[_0x3e8f('0x1f')](_0x34cf43);});}_0xb7cfa6();}},'charset':_0x3e8f('0x20'),'collate':_0x3e8f('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b3180fc..8fa6c9d 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 _0x36aa=['message','result','CreateMailMessage','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','defaults','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s'];(function(_0x581778,_0x316706){var _0x14867c=function(_0x352def){while(--_0x352def){_0x581778['push'](_0x581778['shift']());}};_0x14867c(++_0x316706);}(_0x36aa,0x170));var _0xa36a=function(_0x4fdaaf,_0x4ac59d){_0x4fdaaf=_0x4fdaaf-0x0;var _0xa4a27e=_0x36aa[_0x4fdaaf];return _0xa4a27e;};'use strict';var _=require(_0xa36a('0x0'));var util=require('util');var moment=require(_0xa36a('0x1'));var BPromise=require(_0xa36a('0x2'));var rs=require(_0xa36a('0x3'));var fs=require('fs');var Redis=require(_0xa36a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa36a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa36a('0x6'));var client=jayson[_0xa36a('0x7')]['http']({'port':0x232a});config['redis']=_[_0xa36a('0x8')](config[_0xa36a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa36a('0xa'))(new Redis(config[_0xa36a('0x9')]));require(_0xa36a('0xb'))[_0xa36a('0xc')](socket);function respondWithRpcPromise(_0x3fd878,_0x20063b,_0x11595f){return new BPromise(function(_0x31b317,_0x44787a){return client[_0xa36a('0xd')](_0x3fd878,_0x11595f)[_0xa36a('0xe')](function(_0xe82efc){logger[_0xa36a('0xf')]('MailMessage,\x20%s,\x20%s',_0x20063b,_0xa36a('0x10'));logger[_0xa36a('0x11')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x20063b,'request\x20sent',JSON[_0xa36a('0x12')](_0xe82efc));if(_0xe82efc[_0xa36a('0x13')]){if(_0xe82efc[_0xa36a('0x13')][_0xa36a('0x14')]===0x1f4){logger[_0xa36a('0x13')](_0xa36a('0x15'),_0x20063b,_0xe82efc[_0xa36a('0x13')][_0xa36a('0x16')]);return _0x44787a(_0xe82efc['error']['message']);}logger[_0xa36a('0x13')](_0xa36a('0x15'),_0x20063b,_0xe82efc[_0xa36a('0x13')][_0xa36a('0x16')]);return _0x31b317(_0xe82efc[_0xa36a('0x13')][_0xa36a('0x16')]);}else{logger[_0xa36a('0xf')]('MailMessage,\x20%s,\x20%s',_0x20063b,_0xa36a('0x10'));_0x31b317(_0xe82efc[_0xa36a('0x17')][_0xa36a('0x16')]);}})['catch'](function(_0x3151d2){logger['error'](_0xa36a('0x15'),_0x20063b,_0x3151d2);_0x44787a(_0x3151d2);});});}exports[_0xa36a('0x18')]=function(_0x1014f8){var _0x53d6d4=this;return new Promise(function(_0xa960c6,_0x4d3bd7){return db['MailMessage'][_0xa36a('0x19')](_0x1014f8[_0xa36a('0x1a')],{'raw':_0x1014f8['options']?_0x1014f8[_0xa36a('0x1b')][_0xa36a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x50c371){logger[_0xa36a('0xf')]('CreateMailMessage',_0x1014f8);logger[_0xa36a('0x11')](_0xa36a('0x18'),_0x1014f8,JSON[_0xa36a('0x12')](_0x50c371));_0xa960c6(_0x50c371);})[_0xa36a('0x1d')](function(_0x3b73e2){logger[_0xa36a('0x13')](_0xa36a('0x18'),_0x3b73e2[_0xa36a('0x16')],_0x1014f8);_0x4d3bd7(_0x53d6d4['error'](0x1f4,_0x3b73e2[_0xa36a('0x16')]));});});}; \ No newline at end of file +var _0xe526=['body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe526,0x6c));var _0x6e52=function(_0x1fc595,_0x24b5ba){_0x1fc595=_0x1fc595-0x0;var _0x48b65c=_0xe526[_0x1fc595];return _0x48b65c;};'use strict';var _=require('lodash');var util=require(_0x6e52('0x0'));var moment=require('moment');var BPromise=require(_0x6e52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e52('0x2'));var db=require(_0x6e52('0x3'))['db'];var utils=require(_0x6e52('0x4'));var logger=require(_0x6e52('0x5'))(_0x6e52('0x6'));var config=require(_0x6e52('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e52('0x8')][_0x6e52('0x9')]({'port':0x232a});config[_0x6e52('0xa')]=_[_0x6e52('0xb')](config['redis'],{'host':_0x6e52('0xc'),'port':0x18eb});var socket=require(_0x6e52('0xd'))(new Redis(config[_0x6e52('0xa')]));require(_0x6e52('0xe'))[_0x6e52('0xf')](socket);function respondWithRpcPromise(_0x9a9083,_0x1bd7cd,_0x19152f){return new BPromise(function(_0x23d2c7,_0x41ffc4){return client[_0x6e52('0x10')](_0x9a9083,_0x19152f)[_0x6e52('0x11')](function(_0x502341){logger[_0x6e52('0x12')](_0x6e52('0x13'),_0x1bd7cd,_0x6e52('0x14'));logger[_0x6e52('0x15')](_0x6e52('0x16'),_0x1bd7cd,_0x6e52('0x14'),JSON[_0x6e52('0x17')](_0x502341));if(_0x502341[_0x6e52('0x18')]){if(_0x502341[_0x6e52('0x18')][_0x6e52('0x19')]===0x1f4){logger[_0x6e52('0x18')](_0x6e52('0x13'),_0x1bd7cd,_0x502341[_0x6e52('0x18')]['message']);return _0x41ffc4(_0x502341[_0x6e52('0x18')][_0x6e52('0x1a')]);}logger[_0x6e52('0x18')](_0x6e52('0x13'),_0x1bd7cd,_0x502341[_0x6e52('0x18')][_0x6e52('0x1a')]);return _0x23d2c7(_0x502341[_0x6e52('0x18')]['message']);}else{logger[_0x6e52('0x12')](_0x6e52('0x13'),_0x1bd7cd,'request\x20sent');_0x23d2c7(_0x502341[_0x6e52('0x1b')][_0x6e52('0x1a')]);}})[_0x6e52('0x1c')](function(_0x1114dd){logger[_0x6e52('0x18')]('MailMessage,\x20%s,\x20%s',_0x1bd7cd,_0x1114dd);_0x41ffc4(_0x1114dd);});});}exports[_0x6e52('0x1d')]=function(_0x188a07){var _0x295e6a=this;return new Promise(function(_0x457f70,_0x4668f2){return db[_0x6e52('0x1e')][_0x6e52('0x1f')](_0x188a07[_0x6e52('0x20')],{'raw':_0x188a07[_0x6e52('0x21')]?_0x188a07['options'][_0x6e52('0x22')]===undefined?!![]:![]:!![]})[_0x6e52('0x11')](function(_0x14dc6b){logger['info'](_0x6e52('0x1d'),_0x188a07);logger[_0x6e52('0x15')](_0x6e52('0x1d'),_0x188a07,JSON['stringify'](_0x14dc6b));_0x457f70(_0x14dc6b);})[_0x6e52('0x1c')](function(_0x115784){logger[_0x6e52('0x18')]('CreateMailMessage',_0x115784[_0x6e52('0x1a')],_0x188a07);_0x4668f2(_0x295e6a[_0x6e52('0x18')](0x1f4,_0x115784['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2a6e511..b304fe6 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 _0x65a4=['remove','update','emit','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x158935,_0xeacf46){var _0x149252=function(_0x7bb615){while(--_0x7bb615){_0x158935['push'](_0x158935['shift']());}};_0x149252(++_0xeacf46);}(_0x65a4,0x166));var _0x465a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x65a4[_0x501510];return _0x1e6ee5;};'use strict';var MailMessageEvents=require(_0x465a('0x0'));var events=[_0x465a('0x1'),_0x465a('0x2'),_0x465a('0x3')];function createListener(_0x86ea7f,_0xb198ec){return function(_0x4bcc87){_0xb198ec[_0x465a('0x4')](_0x86ea7f,_0x4bcc87);};}function removeListener(_0x5649c6,_0x32c54c){return function(){MailMessageEvents['removeListener'](_0x5649c6,_0x32c54c);};}exports[_0x465a('0x5')]=function(_0x2d8378){for(var _0x16dc5d=0x0,_0x470952=events[_0x465a('0x6')];_0x16dc5d<_0x470952;_0x16dc5d++){var _0x16480c=events[_0x16dc5d];var _0x1247f0=createListener(_0x465a('0x7')+_0x16480c,_0x2d8378);MailMessageEvents['on'](_0x16480c,_0x1247f0);}}; \ No newline at end of file +var _0x64b3=['length','mailMessage:','./mailMessage.events','update','emit','removeListener','register'];(function(_0x4d79a1,_0x3bc3f2){var _0x37747c=function(_0x162806){while(--_0x162806){_0x4d79a1['push'](_0x4d79a1['shift']());}};_0x37747c(++_0x3bc3f2);}(_0x64b3,0x1de));var _0x364b=function(_0x5bcec5,_0x3d0a6e){_0x5bcec5=_0x5bcec5-0x0;var _0x178247=_0x64b3[_0x5bcec5];return _0x178247;};'use strict';var MailMessageEvents=require(_0x364b('0x0'));var events=['save','remove',_0x364b('0x1')];function createListener(_0x1f0c59,_0x2a8c1c){return function(_0x5d8809){_0x2a8c1c[_0x364b('0x2')](_0x1f0c59,_0x5d8809);};}function removeListener(_0x30611a,_0x2e4eed){return function(){MailMessageEvents[_0x364b('0x3')](_0x30611a,_0x2e4eed);};}exports[_0x364b('0x4')]=function(_0x42092d){for(var _0x53ae27=0x0,_0x5a2100=events[_0x364b('0x5')];_0x53ae27<_0x5a2100;_0x53ae27++){var _0x325e14=events[_0x53ae27];var _0x3f6653=createListener(_0x364b('0x6')+_0x325e14,_0x42092d);MailMessageEvents['on'](_0x325e14,_0x3f6653);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b8423a1..f5c3a36 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 _0xd4ae=['put','update','delete','destroy','removeTeams','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','/:id/users','addAgents'];(function(_0x3498f5,_0x35cbaf){var _0x2273da=function(_0x51b358){while(--_0x51b358){_0x3498f5['push'](_0x3498f5['shift']());}};_0x2273da(++_0x35cbaf);}(_0xd4ae,0x6d));var _0xed4a=function(_0x4380e2,_0x4834fe){_0x4380e2=_0x4380e2-0x0;var _0x339df9=_0xd4ae[_0x4380e2];return _0x339df9;};'use strict';var multer=require(_0xed4a('0x0'));var util=require('util');var path=require(_0xed4a('0x1'));var timeout=require(_0xed4a('0x2'));var express=require('express');var router=express[_0xed4a('0x3')]();var auth=require(_0xed4a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xed4a('0x5'));var controller=require('./mailQueue.controller');router[_0xed4a('0x6')]('/',auth[_0xed4a('0x7')](),controller[_0xed4a('0x8')]);router[_0xed4a('0x6')](_0xed4a('0x9'),auth[_0xed4a('0x7')](),controller['describe']);router['get'](_0xed4a('0xa'),auth[_0xed4a('0x7')](),controller[_0xed4a('0xb')]);router['get'](_0xed4a('0xc'),auth[_0xed4a('0x7')](),controller[_0xed4a('0xd')]);router[_0xed4a('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0xed4a('0xe')]);router[_0xed4a('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xed4a('0xf')]);router[_0xed4a('0x10')]('/',auth[_0xed4a('0x7')](),controller[_0xed4a('0x11')]);router[_0xed4a('0x10')](_0xed4a('0x12'),auth[_0xed4a('0x7')](),controller['addTeams']);router[_0xed4a('0x10')](_0xed4a('0x13'),auth[_0xed4a('0x7')](),controller[_0xed4a('0x14')]);router[_0xed4a('0x15')](_0xed4a('0xa'),auth['isAuthenticated'](),controller[_0xed4a('0x16')]);router[_0xed4a('0x17')](_0xed4a('0xa'),auth[_0xed4a('0x7')](),controller[_0xed4a('0x18')]);router['delete'](_0xed4a('0x12'),auth['isAuthenticated'](),controller[_0xed4a('0x19')]);router[_0xed4a('0x17')](_0xed4a('0x13'),auth[_0xed4a('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x25a2=['./mailQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','/:id/teams','put','delete','destroy','removeTeams','exports','multer','util','path','express','../../components/auth/service','../../config/environment'];(function(_0x1b3a14,_0x5d54b3){var _0x39c132=function(_0x410dab){while(--_0x410dab){_0x1b3a14['push'](_0x1b3a14['shift']());}};_0x39c132(++_0x5d54b3);}(_0x25a2,0x15f));var _0x225a=function(_0xa8a09f,_0x6ee2df){_0xa8a09f=_0xa8a09f-0x0;var _0x4495f0=_0x25a2[_0xa8a09f];return _0x4495f0;};'use strict';var multer=require(_0x225a('0x0'));var util=require(_0x225a('0x1'));var path=require(_0x225a('0x2'));var timeout=require('connect-timeout');var express=require(_0x225a('0x3'));var router=express['Router']();var auth=require(_0x225a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x225a('0x5'));var controller=require(_0x225a('0x6'));router[_0x225a('0x7')]('/',auth[_0x225a('0x8')](),controller['index']);router[_0x225a('0x7')]('/describe',auth[_0x225a('0x8')](),controller[_0x225a('0x9')]);router[_0x225a('0x7')](_0x225a('0xa'),auth[_0x225a('0x8')](),controller[_0x225a('0xb')]);router[_0x225a('0x7')]('/:id/members',auth[_0x225a('0x8')](),controller['getMembers']);router[_0x225a('0x7')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x225a('0xc'),auth[_0x225a('0x8')](),controller[_0x225a('0xd')]);router[_0x225a('0xe')]('/',auth[_0x225a('0x8')](),controller['create']);router['post'](_0x225a('0xf'),auth[_0x225a('0x8')](),controller['addTeams']);router[_0x225a('0xe')](_0x225a('0xc'),auth[_0x225a('0x8')](),controller['addAgents']);router[_0x225a('0x10')](_0x225a('0xa'),auth[_0x225a('0x8')](),controller['update']);router[_0x225a('0x11')](_0x225a('0xa'),auth[_0x225a('0x8')](),controller[_0x225a('0x12')]);router[_0x225a('0x11')](_0x225a('0xf'),auth['isAuthenticated'](),controller[_0x225a('0x13')]);router[_0x225a('0x11')](_0x225a('0xc'),auth[_0x225a('0x8')](),controller['removeAgents']);module[_0x225a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index bb7455e..55def12 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 _0x67d5=['ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x44c96d,_0x1abc18){var _0x50cf9c=function(_0x5748c6){while(--_0x5748c6){_0x44c96d['push'](_0x44c96d['shift']());}};_0x50cf9c(++_0x1abc18);}(_0x67d5,0x18a));var _0x567d=function(_0x10872f,_0xed16a3){_0x10872f=_0x10872f-0x0;var _0x5d585e=_0x67d5[_0x10872f];return _0x5d585e;};'use strict';var Sequelize=require('sequelize');module[_0x567d('0x0')]={'name':{'type':Sequelize[_0x567d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x567d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x567d('0x2')](_0x567d('0x3'),_0x567d('0x4'),_0x567d('0x5'))}}; \ No newline at end of file +var _0xcac2=['sequelize','exports','STRING','INTEGER'];(function(_0x27bd77,_0xbd1e00){var _0x22ce43=function(_0xce930c){while(--_0xce930c){_0x27bd77['push'](_0x27bd77['shift']());}};_0x22ce43(++_0xbd1e00);}(_0xcac2,0x1e8));var _0x2cac=function(_0x135670,_0x4e71b8){_0x135670=_0x135670-0x0;var _0x2f7b12=_0xcac2[_0x135670];return _0x2f7b12;};'use strict';var Sequelize=require(_0x2cac('0x0'));module[_0x2cac('0x1')]={'name':{'type':Sequelize[_0x2cac('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2cac('0x2')]},'timeout':{'type':Sequelize[_0x2cac('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7faecb1..70db67a 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 _0x5eed=['ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','end','status','json','offset','limit','set','apply','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','sendStatus','error','name','send','index','map','MailQueue','fieldName','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','count','includeAll','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','rawAttributes','pick','MailQueueId','findAndCountAll','UserId','agent','mailPause','createdAt','format','getTeams','addTeams','ids','Team','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x5eed,0x10a));var _0xd5ee=function(_0x42a212,_0x4817db){_0x42a212=_0x42a212-0x0;var _0x2e7630=_0x5eed[_0x42a212];return _0x2e7630;};'use strict';var pdf=require(_0xd5ee('0x0'));var emlformat=require(_0xd5ee('0x1'));var rimraf=require(_0xd5ee('0x2'));var zipdir=require(_0xd5ee('0x3'));var jsonpatch=require(_0xd5ee('0x4'));var rp=require(_0xd5ee('0x5'));var moment=require(_0xd5ee('0x6'));var BPromise=require(_0xd5ee('0x7'));var Mustache=require(_0xd5ee('0x8'));var util=require(_0xd5ee('0x9'));var path=require('path');var sox=require(_0xd5ee('0xa'));var csv=require(_0xd5ee('0xb'));var ejs=require(_0xd5ee('0xc'));var fs=require('fs');var _=require(_0xd5ee('0xd'));var squel=require(_0xd5ee('0xe'));var crypto=require(_0xd5ee('0xf'));var jsforce=require(_0xd5ee('0x10'));var deskjs=require(_0xd5ee('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd5ee('0x12'));var authService=require(_0xd5ee('0x13'));var qs=require(_0xd5ee('0x14'));var as=require(_0xd5ee('0x15'));var hardwareService=require(_0xd5ee('0x16'));var logger=require(_0xd5ee('0x17'))(_0xd5ee('0x18'));var utils=require(_0xd5ee('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd5ee('0x1a'));var db=require(_0xd5ee('0x1b'))['db'];config['redis']=_[_0xd5ee('0x1c')](config[_0xd5ee('0x1d')],{'host':_0xd5ee('0x1e'),'port':0x18eb});var socket=require(_0xd5ee('0x1f'))(new Redis(config[_0xd5ee('0x1d')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x51a9bc,_0xc7f206){_0xc7f206=_0xc7f206||0xcc;return function(_0x30a4d2){if(_0x30a4d2){return _0x51a9bc['sendStatus'](_0xc7f206);}return _0x51a9bc['status'](_0xc7f206)[_0xd5ee('0x20')]();};}function respondWithResult(_0x28baf5,_0x555c3a){_0x555c3a=_0x555c3a||0xc8;return function(_0xa0862d){if(_0xa0862d){return _0x28baf5[_0xd5ee('0x21')](_0x555c3a)[_0xd5ee('0x22')](_0xa0862d);}};}function respondWithFilteredResult(_0x234bed,_0x2b71e8){return function(_0x39799c){if(_0x39799c){var _0x13c899=_0x39799c['count'],_0x699a56=_0x2b71e8[_0xd5ee('0x23')],_0x2690d9=_0x2b71e8[_0xd5ee('0x23')]+_0x2b71e8[_0xd5ee('0x24')],_0x343e0a;if(_0x2690d9>=_0x13c899){_0x2690d9=_0x13c899;_0x343e0a=0xc8;}else{_0x343e0a=0xce;}_0x234bed[_0xd5ee('0x21')](_0x343e0a);return _0x234bed[_0xd5ee('0x25')]('Content-Range',_0x699a56+'-'+_0x2690d9+'/'+_0x13c899)[_0xd5ee('0x22')](_0x39799c);}return null;};}function patchUpdates(_0xa41969){return function(_0x5cb6c1){try{jsonpatch[_0xd5ee('0x26')](_0x5cb6c1,_0xa41969,!![]);}catch(_0x3e868f){return BPromise[_0xd5ee('0x27')](_0x3e868f);}return _0x5cb6c1[_0xd5ee('0x28')]();};}function saveUpdates(_0x432a2b,_0x3fa9b7){return function(_0x2bfdec){if(_0x2bfdec){return _0x2bfdec[_0xd5ee('0x29')](_0x432a2b)[_0xd5ee('0x2a')](function(_0x25aa7b){return _0x25aa7b;});}return null;};}function removeEntity(_0x608bbc,_0x49558c){return function(_0x62a274){if(_0x62a274){return _0x62a274['destroy']()[_0xd5ee('0x2a')](function(){var _0x18d53=_0x62a274[_0xd5ee('0x2b')]({'plain':!![]});var _0xd35299=_0xd5ee('0x2c');return db[_0xd5ee('0x2d')][_0xd5ee('0x2e')]({'where':{'type':_0xd35299,'resourceId':_0x18d53['id']}})[_0xd5ee('0x2a')](function(){return _0x62a274;});})[_0xd5ee('0x2a')](function(){_0x608bbc['status'](0xcc)[_0xd5ee('0x20')]();});}};}function handleEntityNotFound(_0x586d7d,_0x3ac130){return function(_0x48106e){if(!_0x48106e){_0x586d7d[_0xd5ee('0x2f')](0x194);}return _0x48106e;};}function handleError(_0x315b55,_0x2e4a2b){_0x2e4a2b=_0x2e4a2b||0x1f4;return function(_0x4ca688){logger[_0xd5ee('0x30')](_0x4ca688['stack']);if(_0x4ca688[_0xd5ee('0x31')]){delete _0x4ca688[_0xd5ee('0x31')];}_0x315b55[_0xd5ee('0x21')](_0x2e4a2b)[_0xd5ee('0x32')](_0x4ca688);};}exports[_0xd5ee('0x33')]=function(_0xa8bba3,_0x1a38f7){var _0x4ae18b={},_0x1075f2={},_0x1238bf={'count':0x0,'rows':[]};var _0x4f7333=_[_0xd5ee('0x34')](db[_0xd5ee('0x35')]['rawAttributes'],function(_0x688ba5){return{'name':_0x688ba5[_0xd5ee('0x36')],'type':_0x688ba5['type']['key']};});_0x1075f2[_0xd5ee('0x37')]=_['map'](_0x4f7333,_0xd5ee('0x31'));_0x1075f2['query']=_[_0xd5ee('0x38')](_0xa8bba3['query']);_0x1075f2[_0xd5ee('0x39')]=_['intersection'](_0x1075f2[_0xd5ee('0x37')],_0x1075f2[_0xd5ee('0x3a')]);_0x4ae18b[_0xd5ee('0x3b')]=_[_0xd5ee('0x3c')](_0x1075f2[_0xd5ee('0x37')],qs[_0xd5ee('0x3d')](_0xa8bba3['query'][_0xd5ee('0x3d')]));_0x4ae18b[_0xd5ee('0x3b')]=_0x4ae18b[_0xd5ee('0x3b')][_0xd5ee('0x3e')]?_0x4ae18b[_0xd5ee('0x3b')]:_0x1075f2[_0xd5ee('0x37')];if(!_0xa8bba3[_0xd5ee('0x3a')][_0xd5ee('0x3f')](_0xd5ee('0x40'))){_0x4ae18b['limit']=qs[_0xd5ee('0x24')](_0xa8bba3['query'][_0xd5ee('0x24')]);_0x4ae18b[_0xd5ee('0x23')]=qs[_0xd5ee('0x23')](_0xa8bba3[_0xd5ee('0x3a')]['offset']);}_0x4ae18b[_0xd5ee('0x41')]=qs['sort'](_0xa8bba3[_0xd5ee('0x3a')][_0xd5ee('0x42')]);_0x4ae18b[_0xd5ee('0x43')]=qs[_0xd5ee('0x39')](_['pick'](_0xa8bba3[_0xd5ee('0x3a')],_0x1075f2[_0xd5ee('0x39')]),_0x4f7333);if(_0xa8bba3[_0xd5ee('0x3a')][_0xd5ee('0x44')]){_0x4ae18b[_0xd5ee('0x43')]=_[_0xd5ee('0x45')](_0x4ae18b[_0xd5ee('0x43')],{'$or':_[_0xd5ee('0x34')](_0x4f7333,function(_0x54a9c4){if(_0x54a9c4[_0xd5ee('0x46')]!=='VIRTUAL'){var _0x20a79c={};_0x20a79c[_0x54a9c4[_0xd5ee('0x31')]]={'$like':'%'+_0xa8bba3[_0xd5ee('0x3a')]['filter']+'%'};return _0x20a79c;}})});}_0x4ae18b=_['merge']({},_0x4ae18b,_0xa8bba3[_0xd5ee('0x47')]);var _0x23ace8={'where':_0x4ae18b['where']};return db['MailQueue'][_0xd5ee('0x48')](_0x23ace8)[_0xd5ee('0x2a')](function(_0x36d7de){_0x1238bf[_0xd5ee('0x48')]=_0x36d7de;if(_0xa8bba3['query'][_0xd5ee('0x49')]){_0x4ae18b['include']=[{'all':!![]}];}return db[_0xd5ee('0x35')][_0xd5ee('0x4a')](_0x4ae18b);})[_0xd5ee('0x2a')](function(_0x110add){_0x1238bf[_0xd5ee('0x4b')]=_0x110add;return _0x1238bf;})[_0xd5ee('0x2a')](respondWithFilteredResult(_0x1a38f7,_0x4ae18b))[_0xd5ee('0x4c')](handleError(_0x1a38f7,null));};exports['show']=function(_0x4cd580,_0x41ee7b){var _0x692b5f={'raw':!![],'where':{'id':_0x4cd580['params']['id']}},_0x318698={};_0x318698[_0xd5ee('0x37')]=_['keys'](db['MailQueue']['rawAttributes']);_0x318698[_0xd5ee('0x3a')]=_['keys'](_0x4cd580[_0xd5ee('0x3a')]);_0x318698['filters']=_[_0xd5ee('0x3c')](_0x318698[_0xd5ee('0x37')],_0x318698['query']);_0x692b5f[_0xd5ee('0x3b')]=_[_0xd5ee('0x3c')](_0x318698['model'],qs[_0xd5ee('0x3d')](_0x4cd580['query'][_0xd5ee('0x3d')]));_0x692b5f[_0xd5ee('0x3b')]=_0x692b5f['attributes'][_0xd5ee('0x3e')]?_0x692b5f[_0xd5ee('0x3b')]:_0x318698[_0xd5ee('0x37')];if(_0x4cd580['query']['includeAll']){_0x692b5f['include']=[{'all':!![]}];}_0x692b5f=_['merge']({},_0x692b5f,_0x4cd580['options']);return db[_0xd5ee('0x35')][_0xd5ee('0x4d')](_0x692b5f)[_0xd5ee('0x2a')](handleEntityNotFound(_0x41ee7b,null))[_0xd5ee('0x2a')](respondWithResult(_0x41ee7b,null))[_0xd5ee('0x4c')](handleError(_0x41ee7b,null));};exports[_0xd5ee('0x4e')]=function(_0x3bdcfc,_0x2af949){return db[_0xd5ee('0x35')]['create'](_0x3bdcfc[_0xd5ee('0x4f')],{})[_0xd5ee('0x2a')](function(_0x21e494){var _0x4b8b33=_0x3bdcfc[_0xd5ee('0x50')][_0xd5ee('0x2b')]({'plain':!![]});if(!_0x4b8b33)throw new Error(_0xd5ee('0x51'));if(_0x4b8b33[_0xd5ee('0x52')]==='user'){var _0x115299=_0x21e494[_0xd5ee('0x2b')]({'plain':!![]});var _0xef2585=_0xd5ee('0x2c');return db[_0xd5ee('0x53')][_0xd5ee('0x4d')]({'where':{'name':_0xef2585,'userProfileId':_0x4b8b33['userProfileId']},'raw':!![]})['then'](function(_0x3b1a58){if(_0x3b1a58&&_0x3b1a58[_0xd5ee('0x54')]===0x0){return db[_0xd5ee('0x2d')][_0xd5ee('0x4e')]({'name':_0x115299[_0xd5ee('0x31')],'resourceId':_0x115299['id'],'type':_0x3b1a58['name'],'sectionId':_0x3b1a58['id']},{})['then'](function(){return _0x21e494;});}else{return _0x21e494;}})[_0xd5ee('0x4c')](function(_0x5b4aa7){logger[_0xd5ee('0x30')](_0xd5ee('0x55'),_0x5b4aa7);throw _0x5b4aa7;});}return _0x21e494;})[_0xd5ee('0x2a')](respondWithResult(_0x2af949,0xc9))[_0xd5ee('0x4c')](handleError(_0x2af949,null));};exports['update']=function(_0x55bd57,_0x16c01d){if(_0x55bd57[_0xd5ee('0x4f')]['id']){delete _0x55bd57[_0xd5ee('0x4f')]['id'];}return db[_0xd5ee('0x35')][_0xd5ee('0x4d')]({'where':{'id':_0x55bd57[_0xd5ee('0x56')]['id']}})[_0xd5ee('0x2a')](handleEntityNotFound(_0x16c01d,null))['then'](saveUpdates(_0x55bd57[_0xd5ee('0x4f')],null))['then'](respondWithResult(_0x16c01d,null))[_0xd5ee('0x4c')](handleError(_0x16c01d,null));};exports['destroy']=function(_0x578158,_0x34810b){return db[_0xd5ee('0x35')][_0xd5ee('0x4d')]({'where':{'id':_0x578158[_0xd5ee('0x56')]['id']}})[_0xd5ee('0x2a')](handleEntityNotFound(_0x34810b,null))[_0xd5ee('0x2a')](removeEntity(_0x34810b,null))[_0xd5ee('0x4c')](handleError(_0x34810b,null));};exports[_0xd5ee('0x57')]=function(_0x187ff5,_0x4598f7){return db[_0xd5ee('0x35')][_0xd5ee('0x57')]()['then'](respondWithResult(_0x4598f7,null))[_0xd5ee('0x4c')](handleError(_0x4598f7,null));};exports[_0xd5ee('0x58')]=function(_0x109252,_0x49c8ac,_0x1e02ef){var _0x209ff3={'raw':!![],'where':{}},_0x5ba7a3={},_0x378d76;return db['MailQueue'][_0xd5ee('0x59')]({'where':{'id':_0x109252[_0xd5ee('0x56')]['id']}})['then'](handleEntityNotFound(_0x49c8ac,null))[_0xd5ee('0x2a')](function(_0x11b9b5){if(_0x11b9b5){_0x378d76=_0x11b9b5[_0xd5ee('0x2b')]({'plain':!![]});_0x5ba7a3['model']=_[_0xd5ee('0x38')](db[_0xd5ee('0x5a')][_0xd5ee('0x5b')]);_0x5ba7a3['query']=_[_0xd5ee('0x38')](_0x109252['query']);_0x5ba7a3[_0xd5ee('0x39')]=_[_0xd5ee('0x3c')](_0x5ba7a3['model'],_0x5ba7a3[_0xd5ee('0x3a')]);_0x209ff3['attributes']=_['intersection'](_0x5ba7a3[_0xd5ee('0x37')],qs['fields'](_0x109252[_0xd5ee('0x3a')]['fields']));_0x209ff3[_0xd5ee('0x3b')]=_0x209ff3[_0xd5ee('0x3b')]['length']?_0x209ff3[_0xd5ee('0x3b')]:_0x5ba7a3[_0xd5ee('0x37')];if(!_0x109252[_0xd5ee('0x3a')][_0xd5ee('0x3f')](_0xd5ee('0x40'))){_0x209ff3[_0xd5ee('0x24')]=qs[_0xd5ee('0x24')](_0x109252[_0xd5ee('0x3a')]['limit']);_0x209ff3[_0xd5ee('0x23')]=qs[_0xd5ee('0x23')](_0x109252['query'][_0xd5ee('0x23')]);}_0x209ff3[_0xd5ee('0x41')]=qs[_0xd5ee('0x42')](_0x109252[_0xd5ee('0x3a')][_0xd5ee('0x42')]);_0x209ff3['where']=qs['filters'](_[_0xd5ee('0x5c')](_0x109252['query'],_0x5ba7a3['filters']));_0x209ff3[_0xd5ee('0x43')][_0xd5ee('0x5d')]=_0x11b9b5['id'];if(_0x109252[_0xd5ee('0x3a')][_0xd5ee('0x44')]){_0x209ff3[_0xd5ee('0x43')]=_[_0xd5ee('0x45')](_0x209ff3['where'],{'$or':_['map'](_0x209ff3[_0xd5ee('0x3b')],function(_0x30ba7b){var _0x5b2453={};_0x5b2453[_0x30ba7b]={'$like':'%'+_0x109252[_0xd5ee('0x3a')]['filter']+'%'};return _0x5b2453;})});}_0x209ff3=_[_0xd5ee('0x45')]({},_0x209ff3,_0x109252['options']);return db[_0xd5ee('0x5a')][_0xd5ee('0x4a')](_0x209ff3);}})[_0xd5ee('0x2a')](function(_0x4a371c){if(_0x4a371c){return db['User'][_0xd5ee('0x5e')]({'where':{'id':_[_0xd5ee('0x34')](_0x4a371c,_0xd5ee('0x5f')),'role':_0xd5ee('0x60')},'attributes':['id','name',_0xd5ee('0x61'),'updatedAt',_0xd5ee('0x62')]});}})[_0xd5ee('0x2a')](function(_0xbcdd74){if(_0xbcdd74){return{'count':_0xbcdd74[_0xd5ee('0x48')],'rows':_[_0xd5ee('0x34')](_0xbcdd74['rows'],function(_0x171b2c){return{'membername':_0x171b2c[_0xd5ee('0x31')],'UserId':_0x171b2c['id'],'queue_name':_0x378d76[_0xd5ee('0x31')],'MailQueueId':_0x378d76['id'],'interface':util[_0xd5ee('0x63')]('%s/%s','SIP',_0x171b2c['name']),'penalty':0x0,'paused':_0x171b2c[_0xd5ee('0x61')],'createdAt':_0x171b2c['createdAt'],'updatedAt':_0x171b2c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd5ee('0x2a')](respondWithFilteredResult(_0x49c8ac,_0x209ff3))[_0xd5ee('0x4c')](handleError(_0x49c8ac,null));};exports[_0xd5ee('0x64')]=function(_0x56b4e7,_0x128546,_0x288249){var _0x3110d6={};var _0x54d9bf={};var _0x18ae58;var _0x3d8c0f;return db[_0xd5ee('0x35')]['findOne']({'where':{'id':_0x56b4e7['params']['id']}})[_0xd5ee('0x2a')](handleEntityNotFound(_0x128546,null))[_0xd5ee('0x2a')](function(_0x3c2c93){if(_0x3c2c93){_0x18ae58=_0x3c2c93;_0x54d9bf['model']=_[_0xd5ee('0x38')](db['Team'][_0xd5ee('0x5b')]);_0x54d9bf[_0xd5ee('0x3a')]=_[_0xd5ee('0x38')](_0x56b4e7[_0xd5ee('0x3a')]);_0x54d9bf[_0xd5ee('0x39')]=_[_0xd5ee('0x3c')](_0x54d9bf[_0xd5ee('0x37')],_0x54d9bf[_0xd5ee('0x3a')]);_0x3110d6[_0xd5ee('0x3b')]=_['intersection'](_0x54d9bf[_0xd5ee('0x37')],qs[_0xd5ee('0x3d')](_0x56b4e7['query']['fields']));_0x3110d6[_0xd5ee('0x3b')]=_0x3110d6[_0xd5ee('0x3b')][_0xd5ee('0x3e')]?_0x3110d6[_0xd5ee('0x3b')]:_0x54d9bf[_0xd5ee('0x37')];_0x3110d6[_0xd5ee('0x41')]=qs['sort'](_0x56b4e7[_0xd5ee('0x3a')][_0xd5ee('0x42')]);_0x3110d6['where']=qs[_0xd5ee('0x39')](_[_0xd5ee('0x5c')](_0x56b4e7[_0xd5ee('0x3a')],_0x54d9bf[_0xd5ee('0x39')]));if(_0x56b4e7['query'][_0xd5ee('0x44')]){_0x3110d6[_0xd5ee('0x43')]=_[_0xd5ee('0x45')](_0x3110d6['where'],{'$or':_[_0xd5ee('0x34')](_0x3110d6[_0xd5ee('0x3b')],function(_0xf8b09a){var _0x330506={};_0x330506[_0xf8b09a]={'$like':'%'+_0x56b4e7['query'][_0xd5ee('0x44')]+'%'};return _0x330506;})});}_0x3110d6=_['merge']({},_0x3110d6,_0x56b4e7[_0xd5ee('0x47')]);return _0x18ae58[_0xd5ee('0x64')](_0x3110d6);}})['then'](function(_0x47b0f0){if(_0x47b0f0){_0x3d8c0f=_0x47b0f0[_0xd5ee('0x3e')];if(!_0x56b4e7[_0xd5ee('0x3a')]['hasOwnProperty'](_0xd5ee('0x40'))){_0x3110d6['limit']=qs[_0xd5ee('0x24')](_0x56b4e7[_0xd5ee('0x3a')][_0xd5ee('0x24')]);_0x3110d6[_0xd5ee('0x23')]=qs[_0xd5ee('0x23')](_0x56b4e7[_0xd5ee('0x3a')][_0xd5ee('0x23')]);}return _0x18ae58['getTeams'](_0x3110d6);}})[_0xd5ee('0x2a')](function(_0xaabe85){if(_0xaabe85){return _0xaabe85?{'count':_0x3d8c0f,'rows':_0xaabe85}:null;}})[_0xd5ee('0x2a')](respondWithResult(_0x128546,null))[_0xd5ee('0x4c')](handleError(_0x128546,null));};exports[_0xd5ee('0x65')]=function(_0x46ba21,_0x74d81c,_0x5d387e){var _0x399e4a=_0x46ba21['body'][_0xd5ee('0x66')];return db[_0xd5ee('0x67')][_0xd5ee('0x4a')]({'where':{'id':_0x399e4a},'attributes':['id'],'include':[{'model':db[_0xd5ee('0x68')],'as':_0xd5ee('0x69'),'attributes':['id',_0xd5ee('0x31'),'online',_0xd5ee('0x6a'),_0xd5ee('0x6b')],'raw':!![]}]})[_0xd5ee('0x2a')](function(_0x4c045e){if(_0x4c045e){var _0x5260d6=_[_0xd5ee('0x6c')](_0x4c045e,function(_0x4e353d){var _0x4fb14b=_0x4e353d[_0xd5ee('0x2b')]({'plain':!![]});return _0x4fb14b[_0xd5ee('0x69')];});return db[_0xd5ee('0x35')]['find']({'where':{'id':_0x46ba21['params']['id']}})[_0xd5ee('0x2a')](function(_0x5bb657){return db[_0xd5ee('0x6d')][_0xd5ee('0x6e')](function(_0x263cce){return _0x5bb657[_0xd5ee('0x65')](_0x399e4a,{'transaction':_0x263cce})[_0xd5ee('0x2a')](function(){return BPromise[_0xd5ee('0x6f')](_0x5260d6,function(_0x1951b7){return db[_0xd5ee('0x5a')]['findOrCreate']({'where':{'UserId':_0x1951b7['id'],'MailQueueId':_0x46ba21[_0xd5ee('0x56')]['id']},'transaction':_0x263cce});});})['then'](function(){_0x5260d6[_0xd5ee('0x70')](function(_0x18b729){socket[_0xd5ee('0x71')](_0xd5ee('0x72'),{'UserId':_0x18b729['id'],'MailQueueId':_0x5bb657['id']});});});});});}})[_0xd5ee('0x2a')](respondWithStatusCode(_0x74d81c,null))[_0xd5ee('0x4c')](handleError(_0x74d81c,null));};exports[_0xd5ee('0x73')]=function(_0x43c891,_0x5b1fa4,_0x1caef1){return db[_0xd5ee('0x67')][_0xd5ee('0x4a')]({'where':{'id':_0x43c891[_0xd5ee('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd5ee('0x68')],'as':_0xd5ee('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b1fa4,null))['then'](function(_0xb23e45){var _0x3450e4=_[_0xd5ee('0x34')](_0xb23e45,'id');var _0x4d5178=[];var _0x41ec47=[];var _0x23f03f=squel[_0xd5ee('0x74')]();_0x23f03f['field']('tq.TeamId')[_0xd5ee('0x75')](_0xd5ee('0x76'),'tq')[_0xd5ee('0x77')]('user_has_teams','ut',_0xd5ee('0x78'))[_0xd5ee('0x43')]('MailQueueId\x20=\x20?',_0x43c891[_0xd5ee('0x56')]['id']);for(var _0x143939=0x0;_0x143939<_0xb23e45['length'];_0x143939+=0x1){let _0x3d27f3=_0xb23e45[_0x143939];for(var _0x45bdf5=0x0;_0x45bdf5<_0x3d27f3[_0xd5ee('0x69')][_0xd5ee('0x3e')];_0x45bdf5+=0x1){let _0x43be83=_0x3d27f3['Agents'][_0x45bdf5];var _0x28e816=_0x23f03f['clone']();_0x28e816['where'](_0xd5ee('0x79'),_0x43be83['id']);_0x41ec47[_0xd5ee('0x7a')](db[_0xd5ee('0x6d')]['query'](_0x28e816[_0xd5ee('0x7b')](),{'type':db[_0xd5ee('0x6d')][_0xd5ee('0x7c')][_0xd5ee('0x7d')]})[_0xd5ee('0x2a')](function(_0x3c5cdf){if(_0x3c5cdf[_0xd5ee('0x3e')]===0x1){return _0x43be83['id'];}else{var _0x79118=_[_0xd5ee('0x7e')](_[_0xd5ee('0x34')](_0x3c5cdf,_0xd5ee('0x7f')),function(_0x16fbab){return _[_0xd5ee('0x80')](_0x3450e4,_0x16fbab);});if(_0x79118){return _0x43be83['id'];}}}));}}return BPromise[_0xd5ee('0x81')](_0x41ec47)[_0xd5ee('0x2a')](function(_0x2761cb){_0x4d5178=_(_0x4d5178)[_0xd5ee('0x82')](_0x2761cb)['compact']()['value']();return db['MailQueue'][_0xd5ee('0x4d')]({'where':{'id':_0x43c891[_0xd5ee('0x56')]['id']}})[_0xd5ee('0x2a')](function(_0x4cd80d){return db[_0xd5ee('0x6d')][_0xd5ee('0x6e')](function(_0x560f2b){return _0x4cd80d[_0xd5ee('0x73')](_0x43c891[_0xd5ee('0x3a')][_0xd5ee('0x66')],{'transaction':_0x560f2b})[_0xd5ee('0x2a')](function(){if(!_[_0xd5ee('0x83')](_0x4d5178)){return _0x4cd80d[_0xd5ee('0x84')](_0x4d5178,{'transaction':_0x560f2b});}})[_0xd5ee('0x2a')](function(){_0x4d5178['forEach'](function(_0x389d92){socket[_0xd5ee('0x71')]('userMailQueue:remove',{'UserId':_0x389d92,'MailQueueId':_0x4cd80d['id']});});});});});});})[_0xd5ee('0x2a')](respondWithStatusCode(_0x5b1fa4,null))[_0xd5ee('0x4c')](handleError(_0x5b1fa4,null));};exports['addAgents']=function(_0x3748c1,_0x274917,_0x16d875){return db['MailQueue'][_0xd5ee('0x4d')]({'where':{'id':_0x3748c1[_0xd5ee('0x56')]['id']}})[_0xd5ee('0x2a')](handleEntityNotFound(_0x274917,null))[_0xd5ee('0x2a')](function(_0x570116){if(_0x570116){return _0x570116[_0xd5ee('0x85')](_0x3748c1[_0xd5ee('0x4f')]['ids'],_[_0xd5ee('0x86')](_0x3748c1[_0xd5ee('0x4f')],[_0xd5ee('0x66'),'id'])||{})[_0xd5ee('0x87')](function(_0xd7bb76){for(var _0x58079d=0x0;_0x58079d<_0x3748c1[_0xd5ee('0x4f')]['ids'][_0xd5ee('0x3e')];_0x58079d+=0x1){socket[_0xd5ee('0x71')](_0xd5ee('0x72'),{'UserId':_0x3748c1[_0xd5ee('0x4f')][_0xd5ee('0x66')][_0x58079d],'MailQueueId':_0x3748c1[_0xd5ee('0x56')]['id']});}return _0xd7bb76;});}})['then'](respondWithResult(_0x274917,null))[_0xd5ee('0x4c')](handleError(_0x274917,null));};exports['removeAgents']=function(_0x5cff61,_0x21621c,_0x81afd5){return db[_0xd5ee('0x35')][_0xd5ee('0x4d')]({'where':{'id':_0x5cff61[_0xd5ee('0x56')]['id']}})[_0xd5ee('0x2a')](handleEntityNotFound(_0x21621c,null))['then'](function(_0x3e92e4){if(_0x3e92e4){return _0x3e92e4[_0xd5ee('0x84')](_0x5cff61[_0xd5ee('0x3a')][_0xd5ee('0x66')])[_0xd5ee('0x2a')](function(){if(_[_0xd5ee('0x88')](_0x5cff61[_0xd5ee('0x3a')][_0xd5ee('0x66')])){for(var _0xffae04=0x0;_0xffae04<_0x5cff61['query'][_0xd5ee('0x66')][_0xd5ee('0x3e')];_0xffae04+=0x1){socket[_0xd5ee('0x71')]('userMailQueue:remove',{'UserId':Number(_0x5cff61['query'][_0xd5ee('0x66')][_0xffae04]),'MailQueueId':Number(_0x5cff61[_0xd5ee('0x56')]['id'])});}}else{socket[_0xd5ee('0x71')](_0xd5ee('0x89'),{'UserId':Number(_0x5cff61['query']['ids']),'MailQueueId':Number(_0x5cff61[_0xd5ee('0x56')]['id'])});}});}})[_0xd5ee('0x2a')](respondWithStatusCode(_0x21621c,null))['catch'](handleError(_0x21621c,null));};exports['getAgents']=function(_0x41af2c,_0x1be085,_0x1eb46f){var _0x32337d={};var _0x34559f={};var _0x25da6f;var _0x2e75cf;return db[_0xd5ee('0x35')][_0xd5ee('0x59')]({'where':{'id':_0x41af2c[_0xd5ee('0x56')]['id']}})[_0xd5ee('0x2a')](handleEntityNotFound(_0x1be085,null))[_0xd5ee('0x2a')](function(_0x46c56e){if(_0x46c56e){_0x25da6f=_0x46c56e;_0x34559f[_0xd5ee('0x37')]=_[_0xd5ee('0x38')](db[_0xd5ee('0x68')][_0xd5ee('0x5b')]);_0x34559f[_0xd5ee('0x3a')]=_[_0xd5ee('0x38')](_0x41af2c['query']);_0x34559f[_0xd5ee('0x39')]=_['intersection'](_0x34559f['model'],_0x34559f['query']);_0x32337d['attributes']=_[_0xd5ee('0x3c')](_0x34559f[_0xd5ee('0x37')],qs[_0xd5ee('0x3d')](_0x41af2c['query'][_0xd5ee('0x3d')]));_0x32337d['attributes']=_0x32337d['attributes'][_0xd5ee('0x3e')]?_0x32337d[_0xd5ee('0x3b')]:_0x34559f[_0xd5ee('0x37')];_0x32337d['order']=qs[_0xd5ee('0x42')](_0x41af2c[_0xd5ee('0x3a')]['sort']);_0x32337d[_0xd5ee('0x43')]=qs['filters'](_[_0xd5ee('0x5c')](_0x41af2c[_0xd5ee('0x3a')],_0x34559f[_0xd5ee('0x39')]));if(_0x41af2c['query'][_0xd5ee('0x44')]){_0x32337d[_0xd5ee('0x43')]=_[_0xd5ee('0x45')](_0x32337d['where'],{'$or':_['map'](_0x32337d[_0xd5ee('0x3b')],function(_0x22de0e){var _0x1269ac={};_0x1269ac[_0x22de0e]={'$like':'%'+_0x41af2c[_0xd5ee('0x3a')]['filter']+'%'};return _0x1269ac;})});}_0x32337d=_[_0xd5ee('0x45')]({},_0x32337d,_0x41af2c['options']);return _0x25da6f[_0xd5ee('0x8a')](_0x32337d);}})[_0xd5ee('0x2a')](function(_0x1c612b){if(_0x1c612b){_0x2e75cf=_0x1c612b[_0xd5ee('0x3e')];if(!_0x41af2c['query']['hasOwnProperty'](_0xd5ee('0x40'))){_0x32337d[_0xd5ee('0x24')]=qs[_0xd5ee('0x24')](_0x41af2c[_0xd5ee('0x3a')]['limit']);_0x32337d[_0xd5ee('0x23')]=qs['offset'](_0x41af2c[_0xd5ee('0x3a')][_0xd5ee('0x23')]);}return _0x25da6f[_0xd5ee('0x8a')](_0x32337d);}})[_0xd5ee('0x2a')](function(_0xd8ede9){if(_0xd8ede9){return _0xd8ede9?{'count':_0x2e75cf,'rows':_0xd8ede9}:null;}})[_0xd5ee('0x2a')](respondWithResult(_0x1be085,null))[_0xd5ee('0x4c')](handleError(_0x1be085,null));}; \ No newline at end of file +var _0xb8cb=['rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','intersection','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','UserId','agent','mailPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','userMailQueue:remove','spread','removeAgents','isArray','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','error','stack','name','send','index','map','MailQueue'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x502d92,_0x12aae0){_0x502d92=_0x502d92-0x0;var _0x305ada=_0xb8cb[_0x502d92];return _0x305ada;};'use strict';var pdf=require(_0xbb8c('0x0'));var emlformat=require(_0xbb8c('0x1'));var rimraf=require(_0xbb8c('0x2'));var zipdir=require(_0xbb8c('0x3'));var jsonpatch=require(_0xbb8c('0x4'));var rp=require(_0xbb8c('0x5'));var moment=require(_0xbb8c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbb8c('0x7'));var util=require(_0xbb8c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbb8c('0x9'));var ejs=require(_0xbb8c('0xa'));var fs=require('fs');var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0x9'));var querystring=require(_0xbb8c('0xf'));var Papa=require(_0xbb8c('0x10'));var Redis=require(_0xbb8c('0x11'));var authService=require(_0xbb8c('0x12'));var qs=require(_0xbb8c('0x13'));var as=require(_0xbb8c('0x14'));var hardwareService=require(_0xbb8c('0x15'));var logger=require(_0xbb8c('0x16'))('api');var utils=require(_0xbb8c('0x17'));var config=require(_0xbb8c('0x18'));var licenseUtil=require(_0xbb8c('0x19'));var db=require(_0xbb8c('0x1a'))['db'];config[_0xbb8c('0x1b')]=_['defaults'](config[_0xbb8c('0x1b')],{'host':_0xbb8c('0x1c'),'port':0x18eb});var socket=require(_0xbb8c('0x1d'))(new Redis(config[_0xbb8c('0x1b')]));require(_0xbb8c('0x1e'))[_0xbb8c('0x1f')](socket);function respondWithStatusCode(_0x1de932,_0x47c7c2){_0x47c7c2=_0x47c7c2||0xcc;return function(_0x9d06b6){if(_0x9d06b6){return _0x1de932[_0xbb8c('0x20')](_0x47c7c2);}return _0x1de932[_0xbb8c('0x21')](_0x47c7c2)[_0xbb8c('0x22')]();};}function respondWithResult(_0x2cc079,_0x3a695d){_0x3a695d=_0x3a695d||0xc8;return function(_0x2c04d1){if(_0x2c04d1){return _0x2cc079[_0xbb8c('0x21')](_0x3a695d)[_0xbb8c('0x23')](_0x2c04d1);}};}function respondWithFilteredResult(_0x187ee5,_0x4d19c7){return function(_0x67712e){if(_0x67712e){var _0x394ab7=_0x67712e[_0xbb8c('0x24')],_0x2a02c9=_0x4d19c7['offset'],_0x171cd8=_0x4d19c7[_0xbb8c('0x25')]+_0x4d19c7[_0xbb8c('0x26')],_0x3bdaca;if(_0x171cd8>=_0x394ab7){_0x171cd8=_0x394ab7;_0x3bdaca=0xc8;}else{_0x3bdaca=0xce;}_0x187ee5['status'](_0x3bdaca);return _0x187ee5[_0xbb8c('0x27')]('Content-Range',_0x2a02c9+'-'+_0x171cd8+'/'+_0x394ab7)[_0xbb8c('0x23')](_0x67712e);}return null;};}function patchUpdates(_0x570c0b){return function(_0x32b961){try{jsonpatch[_0xbb8c('0x28')](_0x32b961,_0x570c0b,!![]);}catch(_0x1e2539){return BPromise['reject'](_0x1e2539);}return _0x32b961['save']();};}function saveUpdates(_0x10f265,_0x54459d){return function(_0x171530){if(_0x171530){return _0x171530[_0xbb8c('0x29')](_0x10f265)[_0xbb8c('0x2a')](function(_0xec7fb5){return _0xec7fb5;});}return null;};}function removeEntity(_0x362a2f,_0x582c05){return function(_0xf5a529){if(_0xf5a529){return _0xf5a529['destroy']()[_0xbb8c('0x2a')](function(){var _0x5f4f96=_0xf5a529['get']({'plain':!![]});var _0xe7475d='MailQueues';return db['UserProfileResource'][_0xbb8c('0x2b')]({'where':{'type':_0xe7475d,'resourceId':_0x5f4f96['id']}})[_0xbb8c('0x2a')](function(){return _0xf5a529;});})[_0xbb8c('0x2a')](function(){_0x362a2f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17576b,_0x2aed0b){return function(_0x4cb223){if(!_0x4cb223){_0x17576b[_0xbb8c('0x20')](0x194);}return _0x4cb223;};}function handleError(_0x23bf3d,_0x292f11){_0x292f11=_0x292f11||0x1f4;return function(_0x4f0f13){logger[_0xbb8c('0x2c')](_0x4f0f13[_0xbb8c('0x2d')]);if(_0x4f0f13[_0xbb8c('0x2e')]){delete _0x4f0f13[_0xbb8c('0x2e')];}_0x23bf3d[_0xbb8c('0x21')](_0x292f11)[_0xbb8c('0x2f')](_0x4f0f13);};}exports[_0xbb8c('0x30')]=function(_0xb8a3df,_0x3b4bac){var _0x7b5b0d={},_0x4cb494={},_0x5d465b={'count':0x0,'rows':[]};var _0x1ee36d=_[_0xbb8c('0x31')](db[_0xbb8c('0x32')][_0xbb8c('0x33')],function(_0x3f60fc){return{'name':_0x3f60fc['fieldName'],'type':_0x3f60fc[_0xbb8c('0x34')][_0xbb8c('0x35')]};});_0x4cb494[_0xbb8c('0x36')]=_[_0xbb8c('0x31')](_0x1ee36d,_0xbb8c('0x2e'));_0x4cb494[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0xb8a3df[_0xbb8c('0x37')]);_0x4cb494[_0xbb8c('0x39')]=_['intersection'](_0x4cb494[_0xbb8c('0x36')],_0x4cb494[_0xbb8c('0x37')]);_0x7b5b0d[_0xbb8c('0x3a')]=_['intersection'](_0x4cb494['model'],qs[_0xbb8c('0x3b')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x3b')]));_0x7b5b0d[_0xbb8c('0x3a')]=_0x7b5b0d['attributes'][_0xbb8c('0x3c')]?_0x7b5b0d[_0xbb8c('0x3a')]:_0x4cb494[_0xbb8c('0x36')];if(!_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x3d')]('nolimit')){_0x7b5b0d[_0xbb8c('0x26')]=qs[_0xbb8c('0x26')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x26')]);_0x7b5b0d['offset']=qs[_0xbb8c('0x25')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x25')]);}_0x7b5b0d[_0xbb8c('0x3e')]=qs[_0xbb8c('0x3f')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x3f')]);_0x7b5b0d[_0xbb8c('0x40')]=qs[_0xbb8c('0x39')](_[_0xbb8c('0x41')](_0xb8a3df[_0xbb8c('0x37')],_0x4cb494[_0xbb8c('0x39')]),_0x1ee36d);if(_0xb8a3df['query'][_0xbb8c('0x42')]){_0x7b5b0d[_0xbb8c('0x40')]=_[_0xbb8c('0x43')](_0x7b5b0d[_0xbb8c('0x40')],{'$or':_['map'](_0x1ee36d,function(_0x3ca105){if(_0x3ca105['type']!=='VIRTUAL'){var _0x234f1f={};_0x234f1f[_0x3ca105[_0xbb8c('0x2e')]]={'$like':'%'+_0xb8a3df[_0xbb8c('0x37')]['filter']+'%'};return _0x234f1f;}})});}_0x7b5b0d=_[_0xbb8c('0x43')]({},_0x7b5b0d,_0xb8a3df[_0xbb8c('0x44')]);var _0x4c8165={'where':_0x7b5b0d[_0xbb8c('0x40')]};return db[_0xbb8c('0x32')][_0xbb8c('0x24')](_0x4c8165)[_0xbb8c('0x2a')](function(_0x4800a3){_0x5d465b[_0xbb8c('0x24')]=_0x4800a3;if(_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x45')]){_0x7b5b0d['include']=[{'all':!![]}];}return db[_0xbb8c('0x32')][_0xbb8c('0x46')](_0x7b5b0d);})['then'](function(_0x4b6861){_0x5d465b[_0xbb8c('0x47')]=_0x4b6861;return _0x5d465b;})[_0xbb8c('0x2a')](respondWithFilteredResult(_0x3b4bac,_0x7b5b0d))['catch'](handleError(_0x3b4bac,null));};exports['show']=function(_0x2f9034,_0x5d83ff){var _0x405241={'raw':!![],'where':{'id':_0x2f9034[_0xbb8c('0x48')]['id']}},_0x558dee={};_0x558dee['model']=_[_0xbb8c('0x38')](db[_0xbb8c('0x32')][_0xbb8c('0x33')]);_0x558dee[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0x2f9034[_0xbb8c('0x37')]);_0x558dee['filters']=_[_0xbb8c('0x49')](_0x558dee['model'],_0x558dee[_0xbb8c('0x37')]);_0x405241[_0xbb8c('0x3a')]=_[_0xbb8c('0x49')](_0x558dee[_0xbb8c('0x36')],qs[_0xbb8c('0x3b')](_0x2f9034[_0xbb8c('0x37')]['fields']));_0x405241['attributes']=_0x405241[_0xbb8c('0x3a')][_0xbb8c('0x3c')]?_0x405241['attributes']:_0x558dee[_0xbb8c('0x36')];if(_0x2f9034[_0xbb8c('0x37')][_0xbb8c('0x45')]){_0x405241['include']=[{'all':!![]}];}_0x405241=_[_0xbb8c('0x43')]({},_0x405241,_0x2f9034['options']);return db[_0xbb8c('0x32')][_0xbb8c('0x4a')](_0x405241)[_0xbb8c('0x2a')](handleEntityNotFound(_0x5d83ff,null))['then'](respondWithResult(_0x5d83ff,null))[_0xbb8c('0x4b')](handleError(_0x5d83ff,null));};exports[_0xbb8c('0x4c')]=function(_0x32f054,_0x118565){return db[_0xbb8c('0x32')][_0xbb8c('0x4c')](_0x32f054[_0xbb8c('0x4d')],{})[_0xbb8c('0x2a')](function(_0x83b509){var _0x415374=_0x32f054['user'][_0xbb8c('0x4e')]({'plain':!![]});if(!_0x415374)throw new Error(_0xbb8c('0x4f'));if(_0x415374[_0xbb8c('0x50')]==='user'){var _0x4320a0=_0x83b509[_0xbb8c('0x4e')]({'plain':!![]});var _0x83c1f9=_0xbb8c('0x51');return db[_0xbb8c('0x52')][_0xbb8c('0x4a')]({'where':{'name':_0x83c1f9,'userProfileId':_0x415374[_0xbb8c('0x53')]},'raw':!![]})[_0xbb8c('0x2a')](function(_0x1d08f0){if(_0x1d08f0&&_0x1d08f0[_0xbb8c('0x54')]===0x0){return db['UserProfileResource'][_0xbb8c('0x4c')]({'name':_0x4320a0['name'],'resourceId':_0x4320a0['id'],'type':_0x1d08f0[_0xbb8c('0x2e')],'sectionId':_0x1d08f0['id']},{})[_0xbb8c('0x2a')](function(){return _0x83b509;});}else{return _0x83b509;}})[_0xbb8c('0x4b')](function(_0x37d391){logger[_0xbb8c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d391);throw _0x37d391;});}return _0x83b509;})[_0xbb8c('0x2a')](respondWithResult(_0x118565,0xc9))['catch'](handleError(_0x118565,null));};exports[_0xbb8c('0x29')]=function(_0x1ff96f,_0x2c7516){if(_0x1ff96f['body']['id']){delete _0x1ff96f[_0xbb8c('0x4d')]['id'];}return db[_0xbb8c('0x32')][_0xbb8c('0x4a')]({'where':{'id':_0x1ff96f[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x2c7516,null))[_0xbb8c('0x2a')](saveUpdates(_0x1ff96f[_0xbb8c('0x4d')],null))[_0xbb8c('0x2a')](respondWithResult(_0x2c7516,null))[_0xbb8c('0x4b')](handleError(_0x2c7516,null));};exports[_0xbb8c('0x2b')]=function(_0x34ba09,_0x1f52c0){return db[_0xbb8c('0x32')]['find']({'where':{'id':_0x34ba09['params']['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x1f52c0,null))[_0xbb8c('0x2a')](removeEntity(_0x1f52c0,null))['catch'](handleError(_0x1f52c0,null));};exports[_0xbb8c('0x55')]=function(_0x4244cf,_0x5e8832){return db[_0xbb8c('0x32')]['describe']()[_0xbb8c('0x2a')](respondWithResult(_0x5e8832,null))[_0xbb8c('0x4b')](handleError(_0x5e8832,null));};exports[_0xbb8c('0x56')]=function(_0x3de836,_0x4e812d,_0x2cd38c){var _0x5a2e76={'raw':!![],'where':{}},_0x3eccad={},_0x559c52;return db['MailQueue'][_0xbb8c('0x57')]({'where':{'id':_0x3de836['params']['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x4e812d,null))[_0xbb8c('0x2a')](function(_0x11864c){if(_0x11864c){_0x559c52=_0x11864c[_0xbb8c('0x4e')]({'plain':!![]});_0x3eccad[_0xbb8c('0x36')]=_[_0xbb8c('0x38')](db[_0xbb8c('0x58')][_0xbb8c('0x33')]);_0x3eccad[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0x3de836[_0xbb8c('0x37')]);_0x3eccad[_0xbb8c('0x39')]=_[_0xbb8c('0x49')](_0x3eccad[_0xbb8c('0x36')],_0x3eccad[_0xbb8c('0x37')]);_0x5a2e76[_0xbb8c('0x3a')]=_['intersection'](_0x3eccad[_0xbb8c('0x36')],qs['fields'](_0x3de836[_0xbb8c('0x37')][_0xbb8c('0x3b')]));_0x5a2e76[_0xbb8c('0x3a')]=_0x5a2e76['attributes'][_0xbb8c('0x3c')]?_0x5a2e76[_0xbb8c('0x3a')]:_0x3eccad['model'];if(!_0x3de836[_0xbb8c('0x37')]['hasOwnProperty']('nolimit')){_0x5a2e76[_0xbb8c('0x26')]=qs['limit'](_0x3de836[_0xbb8c('0x37')]['limit']);_0x5a2e76[_0xbb8c('0x25')]=qs['offset'](_0x3de836[_0xbb8c('0x37')][_0xbb8c('0x25')]);}_0x5a2e76['order']=qs[_0xbb8c('0x3f')](_0x3de836[_0xbb8c('0x37')][_0xbb8c('0x3f')]);_0x5a2e76[_0xbb8c('0x40')]=qs[_0xbb8c('0x39')](_['pick'](_0x3de836[_0xbb8c('0x37')],_0x3eccad[_0xbb8c('0x39')]));_0x5a2e76['where'][_0xbb8c('0x59')]=_0x11864c['id'];if(_0x3de836[_0xbb8c('0x37')]['filter']){_0x5a2e76[_0xbb8c('0x40')]=_[_0xbb8c('0x43')](_0x5a2e76[_0xbb8c('0x40')],{'$or':_['map'](_0x5a2e76[_0xbb8c('0x3a')],function(_0x341322){var _0x19c811={};_0x19c811[_0x341322]={'$like':'%'+_0x3de836[_0xbb8c('0x37')][_0xbb8c('0x42')]+'%'};return _0x19c811;})});}_0x5a2e76=_[_0xbb8c('0x43')]({},_0x5a2e76,_0x3de836[_0xbb8c('0x44')]);return db[_0xbb8c('0x58')][_0xbb8c('0x46')](_0x5a2e76);}})['then'](function(_0x3178e6){if(_0x3178e6){return db[_0xbb8c('0x5a')]['findAndCountAll']({'where':{'id':_[_0xbb8c('0x31')](_0x3178e6,_0xbb8c('0x5b')),'role':_0xbb8c('0x5c')},'attributes':['id',_0xbb8c('0x2e'),_0xbb8c('0x5d'),_0xbb8c('0x5e'),_0xbb8c('0x5f')]});}})[_0xbb8c('0x2a')](function(_0x117b19){if(_0x117b19){return{'count':_0x117b19['count'],'rows':_[_0xbb8c('0x31')](_0x117b19[_0xbb8c('0x47')],function(_0x11e6d4){return{'membername':_0x11e6d4[_0xbb8c('0x2e')],'UserId':_0x11e6d4['id'],'queue_name':_0x559c52[_0xbb8c('0x2e')],'MailQueueId':_0x559c52['id'],'interface':util['format']('%s/%s',_0xbb8c('0x60'),_0x11e6d4[_0xbb8c('0x2e')]),'penalty':0x0,'paused':_0x11e6d4[_0xbb8c('0x5d')],'createdAt':_0x11e6d4[_0xbb8c('0x5f')],'updatedAt':_0x11e6d4[_0xbb8c('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbb8c('0x2a')](respondWithFilteredResult(_0x4e812d,_0x5a2e76))[_0xbb8c('0x4b')](handleError(_0x4e812d,null));};exports[_0xbb8c('0x61')]=function(_0x5b77bf,_0x2bd09d,_0x496407){var _0x34270f={};var _0x426317={};var _0x57c635;var _0x506d66;return db[_0xbb8c('0x32')]['findOne']({'where':{'id':_0x5b77bf['params']['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x2bd09d,null))[_0xbb8c('0x2a')](function(_0x150b69){if(_0x150b69){_0x57c635=_0x150b69;_0x426317[_0xbb8c('0x36')]=_[_0xbb8c('0x38')](db[_0xbb8c('0x62')][_0xbb8c('0x33')]);_0x426317[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0x5b77bf[_0xbb8c('0x37')]);_0x426317[_0xbb8c('0x39')]=_['intersection'](_0x426317[_0xbb8c('0x36')],_0x426317[_0xbb8c('0x37')]);_0x34270f[_0xbb8c('0x3a')]=_[_0xbb8c('0x49')](_0x426317['model'],qs['fields'](_0x5b77bf[_0xbb8c('0x37')][_0xbb8c('0x3b')]));_0x34270f[_0xbb8c('0x3a')]=_0x34270f['attributes'][_0xbb8c('0x3c')]?_0x34270f[_0xbb8c('0x3a')]:_0x426317['model'];_0x34270f[_0xbb8c('0x3e')]=qs[_0xbb8c('0x3f')](_0x5b77bf['query'][_0xbb8c('0x3f')]);_0x34270f[_0xbb8c('0x40')]=qs[_0xbb8c('0x39')](_[_0xbb8c('0x41')](_0x5b77bf[_0xbb8c('0x37')],_0x426317['filters']));if(_0x5b77bf['query'][_0xbb8c('0x42')]){_0x34270f[_0xbb8c('0x40')]=_[_0xbb8c('0x43')](_0x34270f[_0xbb8c('0x40')],{'$or':_[_0xbb8c('0x31')](_0x34270f[_0xbb8c('0x3a')],function(_0xa12e32){var _0x1cebba={};_0x1cebba[_0xa12e32]={'$like':'%'+_0x5b77bf['query'][_0xbb8c('0x42')]+'%'};return _0x1cebba;})});}_0x34270f=_[_0xbb8c('0x43')]({},_0x34270f,_0x5b77bf[_0xbb8c('0x44')]);return _0x57c635[_0xbb8c('0x61')](_0x34270f);}})[_0xbb8c('0x2a')](function(_0x14e8fb){if(_0x14e8fb){_0x506d66=_0x14e8fb[_0xbb8c('0x3c')];if(!_0x5b77bf[_0xbb8c('0x37')][_0xbb8c('0x3d')]('nolimit')){_0x34270f[_0xbb8c('0x26')]=qs[_0xbb8c('0x26')](_0x5b77bf[_0xbb8c('0x37')]['limit']);_0x34270f[_0xbb8c('0x25')]=qs[_0xbb8c('0x25')](_0x5b77bf[_0xbb8c('0x37')][_0xbb8c('0x25')]);}return _0x57c635[_0xbb8c('0x61')](_0x34270f);}})[_0xbb8c('0x2a')](function(_0x4ef5bd){if(_0x4ef5bd){return _0x4ef5bd?{'count':_0x506d66,'rows':_0x4ef5bd}:null;}})[_0xbb8c('0x2a')](respondWithResult(_0x2bd09d,null))[_0xbb8c('0x4b')](handleError(_0x2bd09d,null));};exports[_0xbb8c('0x63')]=function(_0x1aa192,_0x93623f,_0x43a81b){var _0x1e730c=_0x1aa192[_0xbb8c('0x4d')][_0xbb8c('0x64')];return db[_0xbb8c('0x62')]['findAll']({'where':{'id':_0x1e730c},'attributes':['id'],'include':[{'model':db[_0xbb8c('0x5a')],'as':_0xbb8c('0x65'),'attributes':['id',_0xbb8c('0x2e'),_0xbb8c('0x66'),_0xbb8c('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x2e591c){if(_0x2e591c){var _0x1146d2=_['flatMap'](_0x2e591c,function(_0x2d6714){var _0x268548=_0x2d6714[_0xbb8c('0x4e')]({'plain':!![]});return _0x268548[_0xbb8c('0x65')];});return db['MailQueue'][_0xbb8c('0x4a')]({'where':{'id':_0x1aa192[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](function(_0x301f3){return db[_0xbb8c('0x68')][_0xbb8c('0x69')](function(_0x5a7f6f){return _0x301f3[_0xbb8c('0x63')](_0x1e730c,{'transaction':_0x5a7f6f})['then'](function(){return BPromise['each'](_0x1146d2,function(_0x58d23e){return db['UserMailQueue'][_0xbb8c('0x6a')]({'where':{'UserId':_0x58d23e['id'],'MailQueueId':_0x1aa192[_0xbb8c('0x48')]['id']},'transaction':_0x5a7f6f});});})[_0xbb8c('0x2a')](function(){_0x1146d2[_0xbb8c('0x6b')](function(_0x47adcc){socket[_0xbb8c('0x6c')]('userMailQueue:save',{'UserId':_0x47adcc['id'],'MailQueueId':_0x301f3['id']});});});});});}})[_0xbb8c('0x2a')](respondWithStatusCode(_0x93623f,null))[_0xbb8c('0x4b')](handleError(_0x93623f,null));};exports[_0xbb8c('0x6d')]=function(_0x2cc2ed,_0x2cadb9,_0x2d99a5){return db[_0xbb8c('0x62')][_0xbb8c('0x46')]({'where':{'id':_0x2cc2ed[_0xbb8c('0x37')][_0xbb8c('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbb8c('0x65'),'attributes':['id'],'raw':!![]}]})[_0xbb8c('0x2a')](handleEntityNotFound(_0x2cadb9,null))[_0xbb8c('0x2a')](function(_0x38beba){var _0x445bfd=_[_0xbb8c('0x31')](_0x38beba,'id');var _0x2327df=[];var _0xca354=[];var _0x2cd6b7=squel[_0xbb8c('0x6e')]();_0x2cd6b7[_0xbb8c('0x6f')](_0xbb8c('0x70'))[_0xbb8c('0x71')](_0xbb8c('0x72'),'tq')[_0xbb8c('0x73')](_0xbb8c('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbb8c('0x40')](_0xbb8c('0x75'),_0x2cc2ed[_0xbb8c('0x48')]['id']);for(var _0x4086c6=0x0;_0x4086c6<_0x38beba[_0xbb8c('0x3c')];_0x4086c6+=0x1){let _0x1e22ec=_0x38beba[_0x4086c6];for(var _0x16b587=0x0;_0x16b587<_0x1e22ec['Agents'][_0xbb8c('0x3c')];_0x16b587+=0x1){let _0xdf7b1e=_0x1e22ec[_0xbb8c('0x65')][_0x16b587];var _0x4a64ff=_0x2cd6b7[_0xbb8c('0x76')]();_0x4a64ff[_0xbb8c('0x40')](_0xbb8c('0x77'),_0xdf7b1e['id']);_0xca354['push'](db[_0xbb8c('0x68')]['query'](_0x4a64ff['toString'](),{'type':db[_0xbb8c('0x68')][_0xbb8c('0x78')][_0xbb8c('0x79')]})[_0xbb8c('0x2a')](function(_0x3edda7){if(_0x3edda7['length']===0x1){return _0xdf7b1e['id'];}else{var _0xd8e065=_[_0xbb8c('0x7a')](_[_0xbb8c('0x31')](_0x3edda7,_0xbb8c('0x7b')),function(_0x4edf85){return _['includes'](_0x445bfd,_0x4edf85);});if(_0xd8e065){return _0xdf7b1e['id'];}}}));}}return BPromise[_0xbb8c('0x7c')](_0xca354)[_0xbb8c('0x2a')](function(_0x1ed4ad){_0x2327df=_(_0x2327df)[_0xbb8c('0x7d')](_0x1ed4ad)[_0xbb8c('0x7e')]()[_0xbb8c('0x7f')]();return db[_0xbb8c('0x32')][_0xbb8c('0x4a')]({'where':{'id':_0x2cc2ed[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](function(_0x296af8){return db['sequelize'][_0xbb8c('0x69')](function(_0x51cd6a){return _0x296af8['removeTeams'](_0x2cc2ed[_0xbb8c('0x37')][_0xbb8c('0x64')],{'transaction':_0x51cd6a})[_0xbb8c('0x2a')](function(){if(!_['isEmpty'](_0x2327df)){return _0x296af8['removeAgents'](_0x2327df,{'transaction':_0x51cd6a});}})[_0xbb8c('0x2a')](function(){_0x2327df['forEach'](function(_0x7dff84){socket[_0xbb8c('0x6c')](_0xbb8c('0x80'),{'UserId':_0x7dff84,'MailQueueId':_0x296af8['id']});});});});});});})[_0xbb8c('0x2a')](respondWithStatusCode(_0x2cadb9,null))[_0xbb8c('0x4b')](handleError(_0x2cadb9,null));};exports['addAgents']=function(_0x286950,_0x40f1a5,_0x3e0f30){return db[_0xbb8c('0x32')][_0xbb8c('0x4a')]({'where':{'id':_0x286950[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x40f1a5,null))[_0xbb8c('0x2a')](function(_0x4edfb6){if(_0x4edfb6){return _0x4edfb6['addAgents'](_0x286950['body'][_0xbb8c('0x64')],_['omit'](_0x286950['body'],[_0xbb8c('0x64'),'id'])||{})[_0xbb8c('0x81')](function(_0x165e95){for(var _0x10efc6=0x0;_0x10efc6<_0x286950['body'][_0xbb8c('0x64')]['length'];_0x10efc6+=0x1){socket[_0xbb8c('0x6c')]('userMailQueue:save',{'UserId':_0x286950['body']['ids'][_0x10efc6],'MailQueueId':_0x286950[_0xbb8c('0x48')]['id']});}return _0x165e95;});}})['then'](respondWithResult(_0x40f1a5,null))[_0xbb8c('0x4b')](handleError(_0x40f1a5,null));};exports[_0xbb8c('0x82')]=function(_0x2bce76,_0x124b05,_0x47991c){return db[_0xbb8c('0x32')]['find']({'where':{'id':_0x2bce76[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x124b05,null))[_0xbb8c('0x2a')](function(_0x5c7f7a){if(_0x5c7f7a){return _0x5c7f7a[_0xbb8c('0x82')](_0x2bce76[_0xbb8c('0x37')]['ids'])[_0xbb8c('0x2a')](function(){if(_[_0xbb8c('0x83')](_0x2bce76['query']['ids'])){for(var _0x3f6d85=0x0;_0x3f6d85<_0x2bce76[_0xbb8c('0x37')][_0xbb8c('0x64')][_0xbb8c('0x3c')];_0x3f6d85+=0x1){socket[_0xbb8c('0x6c')]('userMailQueue:remove',{'UserId':Number(_0x2bce76[_0xbb8c('0x37')][_0xbb8c('0x64')][_0x3f6d85]),'MailQueueId':Number(_0x2bce76['params']['id'])});}}else{socket[_0xbb8c('0x6c')](_0xbb8c('0x80'),{'UserId':Number(_0x2bce76[_0xbb8c('0x37')][_0xbb8c('0x64')]),'MailQueueId':Number(_0x2bce76[_0xbb8c('0x48')]['id'])});}});}})[_0xbb8c('0x2a')](respondWithStatusCode(_0x124b05,null))[_0xbb8c('0x4b')](handleError(_0x124b05,null));};exports[_0xbb8c('0x84')]=function(_0x3bd765,_0xa54a2b,_0x347516){var _0x31bc8f={};var _0x51cbaa={};var _0x181f92;var _0x13f581;return db['MailQueue'][_0xbb8c('0x57')]({'where':{'id':_0x3bd765[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0xa54a2b,null))[_0xbb8c('0x2a')](function(_0x569b1e){if(_0x569b1e){_0x181f92=_0x569b1e;_0x51cbaa[_0xbb8c('0x36')]=_[_0xbb8c('0x38')](db[_0xbb8c('0x5a')][_0xbb8c('0x33')]);_0x51cbaa[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0x3bd765[_0xbb8c('0x37')]);_0x51cbaa[_0xbb8c('0x39')]=_['intersection'](_0x51cbaa['model'],_0x51cbaa['query']);_0x31bc8f[_0xbb8c('0x3a')]=_['intersection'](_0x51cbaa[_0xbb8c('0x36')],qs[_0xbb8c('0x3b')](_0x3bd765[_0xbb8c('0x37')][_0xbb8c('0x3b')]));_0x31bc8f[_0xbb8c('0x3a')]=_0x31bc8f[_0xbb8c('0x3a')][_0xbb8c('0x3c')]?_0x31bc8f['attributes']:_0x51cbaa[_0xbb8c('0x36')];_0x31bc8f[_0xbb8c('0x3e')]=qs[_0xbb8c('0x3f')](_0x3bd765[_0xbb8c('0x37')][_0xbb8c('0x3f')]);_0x31bc8f[_0xbb8c('0x40')]=qs['filters'](_[_0xbb8c('0x41')](_0x3bd765['query'],_0x51cbaa[_0xbb8c('0x39')]));if(_0x3bd765['query'][_0xbb8c('0x42')]){_0x31bc8f['where']=_[_0xbb8c('0x43')](_0x31bc8f[_0xbb8c('0x40')],{'$or':_[_0xbb8c('0x31')](_0x31bc8f[_0xbb8c('0x3a')],function(_0x2bf2bc){var _0x37ff1d={};_0x37ff1d[_0x2bf2bc]={'$like':'%'+_0x3bd765[_0xbb8c('0x37')][_0xbb8c('0x42')]+'%'};return _0x37ff1d;})});}_0x31bc8f=_[_0xbb8c('0x43')]({},_0x31bc8f,_0x3bd765[_0xbb8c('0x44')]);return _0x181f92['getAgents'](_0x31bc8f);}})['then'](function(_0x4a45d8){if(_0x4a45d8){_0x13f581=_0x4a45d8[_0xbb8c('0x3c')];if(!_0x3bd765[_0xbb8c('0x37')][_0xbb8c('0x3d')](_0xbb8c('0x85'))){_0x31bc8f[_0xbb8c('0x26')]=qs[_0xbb8c('0x26')](_0x3bd765[_0xbb8c('0x37')][_0xbb8c('0x26')]);_0x31bc8f[_0xbb8c('0x25')]=qs['offset'](_0x3bd765[_0xbb8c('0x37')][_0xbb8c('0x25')]);}return _0x181f92[_0xbb8c('0x84')](_0x31bc8f);}})[_0xbb8c('0x2a')](function(_0x14cb9e){if(_0x14cb9e){return _0x14cb9e?{'count':_0x13f581,'rows':_0x14cb9e}:null;}})[_0xbb8c('0x2a')](respondWithResult(_0xa54a2b,null))[_0xbb8c('0x4b')](handleError(_0xa54a2b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index fa9c0ac..9d59817 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 _0x183e=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x4b25e7,_0x3db264){var _0x25f88a=function(_0x31abf6){while(--_0x31abf6){_0x4b25e7['push'](_0x4b25e7['shift']());}};_0x25f88a(++_0x3db264);}(_0x183e,0x140));var _0xe183=function(_0x5bc9c4,_0x326bf0){_0x5bc9c4=_0x5bc9c4-0x0;var _0xa020f7=_0x183e[_0x5bc9c4];return _0xa020f7;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xe183('0x0'))['db'][_0xe183('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe183('0x2')](0x0);var events={'afterCreate':_0xe183('0x3'),'afterUpdate':'update','afterDestroy':_0xe183('0x4')};function emitEvent(_0xca8b4c){return function(_0x2d622c,_0x53ada7,_0x3fd519){MailQueueEvents['emit'](_0xca8b4c+':'+_0x2d622c['id'],_0x2d622c);MailQueueEvents[_0xe183('0x5')](_0xca8b4c,_0x2d622c);_0x3fd519(null);};}for(var e in events){if(events[_0xe183('0x6')](e)){var event=events[e];MailQueue[_0xe183('0x7')](e,emitEvent(event));}}module[_0xe183('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xe3e9=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0xe10383,_0x21fba1){var _0x3d4d1c=function(_0x90cd2d){while(--_0x90cd2d){_0xe10383['push'](_0xe10383['shift']());}};_0x3d4d1c(++_0x21fba1);}(_0xe3e9,0x9c));var _0x9e3e=function(_0x206df4,_0x44ec3e){_0x206df4=_0x206df4-0x0;var _0x46ecfd=_0xe3e9[_0x206df4];return _0x46ecfd;};'use strict';var EventEmitter=require(_0x9e3e('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9e3e('0x1')](0x0);var events={'afterCreate':_0x9e3e('0x2'),'afterUpdate':_0x9e3e('0x3'),'afterDestroy':_0x9e3e('0x4')};function emitEvent(_0x44500a){return function(_0x3416e2,_0x3342f9,_0x416b76){MailQueueEvents[_0x9e3e('0x5')](_0x44500a+':'+_0x3416e2['id'],_0x3416e2);MailQueueEvents[_0x9e3e('0x5')](_0x44500a,_0x3416e2);_0x416b76(null);};}for(var e in events){if(events[_0x9e3e('0x6')](e)){var event=events[e];MailQueue[_0x9e3e('0x7')](e,emitEvent(event));}}module[_0x9e3e('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 70ae80b..fb3c4f5 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 _0xe5d7=['request-promise','path','rimraf','./mailQueue.attributes','exports','define','util','api','moment','bluebird'];(function(_0x4e2bc0,_0x2334b0){var _0x36fca9=function(_0x22cca0){while(--_0x22cca0){_0x4e2bc0['push'](_0x4e2bc0['shift']());}};_0x36fca9(++_0x2334b0);}(_0xe5d7,0xba));var _0x7e5d=function(_0x414b2a,_0x413502){_0x414b2a=_0x414b2a-0x0;var _0x3ee042=_0xe5d7[_0x414b2a];return _0x3ee042;};'use strict';var _=require('lodash');var util=require(_0x7e5d('0x0'));var logger=require('../../config/logger')(_0x7e5d('0x1'));var moment=require(_0x7e5d('0x2'));var BPromise=require(_0x7e5d('0x3'));var rp=require(_0x7e5d('0x4'));var fs=require('fs');var path=require(_0x7e5d('0x5'));var rimraf=require(_0x7e5d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e5d('0x7'));module[_0x7e5d('0x8')]=function(_0x4dfb91,_0xf58b00){return _0x4dfb91[_0x7e5d('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd60=['bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','lodash','util','../../config/logger','moment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xfd60,0xec));var _0x0fd6=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xfd60[_0x37a79c];return _0x561d89;};'use strict';var _=require(_0x0fd6('0x0'));var util=require(_0x0fd6('0x1'));var logger=require(_0x0fd6('0x2'))('api');var moment=require(_0x0fd6('0x3'));var BPromise=require(_0x0fd6('0x4'));var rp=require(_0x0fd6('0x5'));var fs=require('fs');var path=require(_0x0fd6('0x6'));var rimraf=require('rimraf');var config=require(_0x0fd6('0x7'));var attributes=require(_0x0fd6('0x8'));module[_0x0fd6('0x9')]=function(_0x39f87d,_0x166f3c){return _0x39f87d[_0x0fd6('0xa')](_0x0fd6('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 0dc55e4..95b7ab5 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 _0x7be3=['include','model','ShowMailQueue','find','where','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','map'];(function(_0xac729a,_0x3f767c){var _0x3e1b94=function(_0x380163){while(--_0x380163){_0xac729a['push'](_0xac729a['shift']());}};_0x3e1b94(++_0x3f767c);}(_0x7be3,0x95));var _0x37be=function(_0x52c8d3,_0x15009a){_0x52c8d3=_0x52c8d3-0x0;var _0x4b7f9d=_0x7be3[_0x52c8d3];return _0x4b7f9d;};'use strict';var _=require(_0x37be('0x0'));var util=require(_0x37be('0x1'));var moment=require(_0x37be('0x2'));var BPromise=require(_0x37be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37be('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x37be('0x5'));var jayson=require(_0x37be('0x6'));var client=jayson['client'][_0x37be('0x7')]({'port':0x232a});config['redis']=_[_0x37be('0x8')](config[_0x37be('0x9')],{'host':_0x37be('0xa'),'port':0x18eb});var socket=require(_0x37be('0xb'))(new Redis(config['redis']));require(_0x37be('0xc'))['register'](socket);function respondWithRpcPromise(_0x591f12,_0x599a6d,_0xbc2623){return new BPromise(function(_0x49f662,_0x12d600){return client[_0x37be('0xd')](_0x591f12,_0xbc2623)[_0x37be('0xe')](function(_0x222e01){logger[_0x37be('0xf')](_0x37be('0x10'),_0x599a6d,_0x37be('0x11'));logger[_0x37be('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x599a6d,'request\x20sent',JSON[_0x37be('0x13')](_0x222e01));if(_0x222e01['error']){if(_0x222e01[_0x37be('0x14')]['code']===0x1f4){logger[_0x37be('0x14')](_0x37be('0x10'),_0x599a6d,_0x222e01['error'][_0x37be('0x15')]);return _0x12d600(_0x222e01[_0x37be('0x14')][_0x37be('0x15')]);}logger[_0x37be('0x14')](_0x37be('0x10'),_0x599a6d,_0x222e01[_0x37be('0x14')][_0x37be('0x15')]);return _0x49f662(_0x222e01[_0x37be('0x14')][_0x37be('0x15')]);}else{logger[_0x37be('0xf')](_0x37be('0x10'),_0x599a6d,_0x37be('0x11'));_0x49f662(_0x222e01[_0x37be('0x16')][_0x37be('0x15')]);}})[_0x37be('0x17')](function(_0x4613e7){logger[_0x37be('0x14')]('MailQueue,\x20%s,\x20%s',_0x599a6d,_0x4613e7);_0x12d600(_0x4613e7);});});}exports[_0x37be('0x18')]=function(_0x170e02){var _0x4f5da2=this;return new Promise(function(_0x5d8fb5,_0x40aa2d){return db[_0x37be('0x19')]['findAll']({'raw':_0x170e02['options']?_0x170e02[_0x37be('0x1a')][_0x37be('0x1b')]===undefined?!![]:![]:!![],'where':_0x170e02[_0x37be('0x1a')]?_0x170e02['options']['where']||null:null,'attributes':_0x170e02[_0x37be('0x1a')]?_0x170e02['options'][_0x37be('0x1c')]||null:null,'limit':_0x170e02[_0x37be('0x1a')]?_0x170e02[_0x37be('0x1a')][_0x37be('0x1d')]||null:null,'include':_0x170e02['options']?_0x170e02['options']['include']?_[_0x37be('0x1e')](_0x170e02[_0x37be('0x1a')][_0x37be('0x1f')],function(_0x50347a){return{'model':db[_0x50347a[_0x37be('0x20')]],'as':_0x50347a['as'],'attributes':_0x50347a[_0x37be('0x1c')],'include':_0x50347a[_0x37be('0x1f')]?_[_0x37be('0x1e')](_0x50347a[_0x37be('0x1f')],function(_0x5356aa){return{'model':db[_0x5356aa['model']],'as':_0x5356aa['as'],'attributes':_0x5356aa['attributes'],'include':_0x5356aa[_0x37be('0x1f')]?_[_0x37be('0x1e')](_0x5356aa['include'],function(_0x5050a0){return{'model':db[_0x5050a0[_0x37be('0x20')]],'as':_0x5050a0['as'],'attributes':_0x5050a0[_0x37be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x37be('0xe')](function(_0x40fc39){logger[_0x37be('0xf')](_0x37be('0x18'),_0x170e02);logger[_0x37be('0x12')]('GetMailQueue',_0x170e02,JSON[_0x37be('0x13')](_0x40fc39));_0x5d8fb5(_0x40fc39);})[_0x37be('0x17')](function(_0x632b13){logger[_0x37be('0x14')](_0x37be('0x18'),_0x632b13[_0x37be('0x15')],_0x170e02);_0x40aa2d(_0x4f5da2[_0x37be('0x14')](0x1f4,_0x632b13['message']));});});};exports[_0x37be('0x21')]=function(_0x2127ff){var _0x401c38=this;return new Promise(function(_0x5a8a55,_0x300b32){return db[_0x37be('0x19')][_0x37be('0x22')]({'raw':_0x2127ff[_0x37be('0x1a')]?_0x2127ff[_0x37be('0x1a')][_0x37be('0x1b')]===undefined?!![]:![]:!![],'where':_0x2127ff[_0x37be('0x1a')]?_0x2127ff[_0x37be('0x1a')][_0x37be('0x23')]||null:null,'attributes':_0x2127ff[_0x37be('0x1a')]?_0x2127ff[_0x37be('0x1a')]['attributes']||null:null,'include':_0x2127ff[_0x37be('0x1a')]?_0x2127ff['options']['include']?_[_0x37be('0x1e')](_0x2127ff['options'][_0x37be('0x1f')],function(_0x40175e){return{'model':db[_0x40175e['model']],'as':_0x40175e['as'],'attributes':_0x40175e[_0x37be('0x1c')],'include':_0x40175e[_0x37be('0x1f')]?_[_0x37be('0x1e')](_0x40175e[_0x37be('0x1f')],function(_0x182f6d){return{'model':db[_0x182f6d[_0x37be('0x20')]],'as':_0x182f6d['as'],'attributes':_0x182f6d[_0x37be('0x1c')],'include':_0x182f6d['include']?_[_0x37be('0x1e')](_0x182f6d['include'],function(_0x26cb28){return{'model':db[_0x26cb28['model']],'as':_0x26cb28['as'],'attributes':_0x26cb28[_0x37be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x37be('0xe')](function(_0x18b6fa){logger[_0x37be('0xf')](_0x37be('0x21'),_0x2127ff);logger[_0x37be('0x12')](_0x37be('0x21'),_0x2127ff,JSON[_0x37be('0x13')](_0x18b6fa));_0x5a8a55(_0x18b6fa);})[_0x37be('0x17')](function(_0x574cc1){logger['error'](_0x37be('0x21'),_0x574cc1['message'],_0x2127ff);_0x300b32(_0x401c38[_0x37be('0x14')](0x1f4,_0x574cc1[_0x37be('0x15')]));});});}; \ No newline at end of file +var _0x92d2=['../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','request','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowMailQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x92d2,0x1c2));var _0x292d=function(_0x37886e,_0x259485){_0x37886e=_0x37886e-0x0;var _0x1f71b8=_0x92d2[_0x37886e];return _0x1f71b8;};'use strict';var _=require(_0x292d('0x0'));var util=require('util');var moment=require(_0x292d('0x1'));var BPromise=require(_0x292d('0x2'));var rs=require(_0x292d('0x3'));var fs=require('fs');var Redis=require(_0x292d('0x4'));var db=require(_0x292d('0x5'))['db'];var utils=require(_0x292d('0x6'));var logger=require(_0x292d('0x7'))(_0x292d('0x8'));var config=require('../../config/environment');var jayson=require(_0x292d('0x9'));var client=jayson[_0x292d('0xa')]['http']({'port':0x232a});config['redis']=_[_0x292d('0xb')](config['redis'],{'host':_0x292d('0xc'),'port':0x18eb});var socket=require(_0x292d('0xd'))(new Redis(config[_0x292d('0xe')]));require('./mailQueue.socket')[_0x292d('0xf')](socket);function respondWithRpcPromise(_0x36717f,_0x2d10fd,_0x36224e){return new BPromise(function(_0x3996fa,_0x8eec34){return client[_0x292d('0x10')](_0x36717f,_0x36224e)['then'](function(_0x4bdb00){logger['info'](_0x292d('0x11'),_0x2d10fd,'request\x20sent');logger[_0x292d('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2d10fd,_0x292d('0x13'),JSON['stringify'](_0x4bdb00));if(_0x4bdb00[_0x292d('0x14')]){if(_0x4bdb00[_0x292d('0x14')][_0x292d('0x15')]===0x1f4){logger[_0x292d('0x14')](_0x292d('0x11'),_0x2d10fd,_0x4bdb00[_0x292d('0x14')][_0x292d('0x16')]);return _0x8eec34(_0x4bdb00[_0x292d('0x14')]['message']);}logger[_0x292d('0x14')](_0x292d('0x11'),_0x2d10fd,_0x4bdb00[_0x292d('0x14')][_0x292d('0x16')]);return _0x3996fa(_0x4bdb00[_0x292d('0x14')]['message']);}else{logger[_0x292d('0x17')](_0x292d('0x11'),_0x2d10fd,'request\x20sent');_0x3996fa(_0x4bdb00[_0x292d('0x18')][_0x292d('0x16')]);}})['catch'](function(_0x26c835){logger[_0x292d('0x14')]('MailQueue,\x20%s,\x20%s',_0x2d10fd,_0x26c835);_0x8eec34(_0x26c835);});});}exports[_0x292d('0x19')]=function(_0x4bbb7a){var _0x4ff83b=this;return new Promise(function(_0x1d7b48,_0x59e81a){return db['MailQueue'][_0x292d('0x1a')]({'raw':_0x4bbb7a[_0x292d('0x1b')]?_0x4bbb7a[_0x292d('0x1b')][_0x292d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bbb7a['options']?_0x4bbb7a[_0x292d('0x1b')][_0x292d('0x1d')]||null:null,'attributes':_0x4bbb7a[_0x292d('0x1b')]?_0x4bbb7a[_0x292d('0x1b')][_0x292d('0x1e')]||null:null,'limit':_0x4bbb7a[_0x292d('0x1b')]?_0x4bbb7a[_0x292d('0x1b')][_0x292d('0x1f')]||null:null,'include':_0x4bbb7a[_0x292d('0x1b')]?_0x4bbb7a[_0x292d('0x1b')]['include']?_[_0x292d('0x20')](_0x4bbb7a[_0x292d('0x1b')]['include'],function(_0x16795c){return{'model':db[_0x16795c['model']],'as':_0x16795c['as'],'attributes':_0x16795c[_0x292d('0x1e')],'include':_0x16795c[_0x292d('0x21')]?_[_0x292d('0x20')](_0x16795c[_0x292d('0x21')],function(_0x39ea04){return{'model':db[_0x39ea04[_0x292d('0x22')]],'as':_0x39ea04['as'],'attributes':_0x39ea04[_0x292d('0x1e')],'include':_0x39ea04[_0x292d('0x21')]?_['map'](_0x39ea04[_0x292d('0x21')],function(_0x31d9ab){return{'model':db[_0x31d9ab[_0x292d('0x22')]],'as':_0x31d9ab['as'],'attributes':_0x31d9ab[_0x292d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x325c4e){logger[_0x292d('0x17')](_0x292d('0x19'),_0x4bbb7a);logger['debug'](_0x292d('0x19'),_0x4bbb7a,JSON[_0x292d('0x23')](_0x325c4e));_0x1d7b48(_0x325c4e);})[_0x292d('0x24')](function(_0x2a2e6c){logger['error'](_0x292d('0x19'),_0x2a2e6c[_0x292d('0x16')],_0x4bbb7a);_0x59e81a(_0x4ff83b[_0x292d('0x14')](0x1f4,_0x2a2e6c[_0x292d('0x16')]));});});};exports[_0x292d('0x25')]=function(_0x29754a){var _0x37360f=this;return new Promise(function(_0xc2bfdb,_0x505b29){return db['MailQueue']['find']({'raw':_0x29754a[_0x292d('0x1b')]?_0x29754a['options'][_0x292d('0x1c')]===undefined?!![]:![]:!![],'where':_0x29754a[_0x292d('0x1b')]?_0x29754a['options'][_0x292d('0x1d')]||null:null,'attributes':_0x29754a['options']?_0x29754a['options'][_0x292d('0x1e')]||null:null,'include':_0x29754a['options']?_0x29754a[_0x292d('0x1b')][_0x292d('0x21')]?_[_0x292d('0x20')](_0x29754a[_0x292d('0x1b')]['include'],function(_0x379dee){return{'model':db[_0x379dee[_0x292d('0x22')]],'as':_0x379dee['as'],'attributes':_0x379dee[_0x292d('0x1e')],'include':_0x379dee[_0x292d('0x21')]?_[_0x292d('0x20')](_0x379dee['include'],function(_0x3dda44){return{'model':db[_0x3dda44[_0x292d('0x22')]],'as':_0x3dda44['as'],'attributes':_0x3dda44[_0x292d('0x1e')],'include':_0x3dda44['include']?_[_0x292d('0x20')](_0x3dda44[_0x292d('0x21')],function(_0x2ea6a4){return{'model':db[_0x2ea6a4[_0x292d('0x22')]],'as':_0x2ea6a4['as'],'attributes':_0x2ea6a4[_0x292d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ed6f8){logger['info']('ShowMailQueue',_0x29754a);logger['debug'](_0x292d('0x25'),_0x29754a,JSON[_0x292d('0x23')](_0x1ed6f8));_0xc2bfdb(_0x1ed6f8);})['catch'](function(_0x105929){logger[_0x292d('0x14')](_0x292d('0x25'),_0x105929['message'],_0x29754a);_0x505b29(_0x37360f[_0x292d('0x14')](0x1f4,_0x105929[_0x292d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 51dde67..d20a513 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 _0xa08a=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x16f579,_0x62597c){var _0x1361c3=function(_0x2f791e){while(--_0x2f791e){_0x16f579['push'](_0x16f579['shift']());}};_0x1361c3(++_0x62597c);}(_0xa08a,0x1cd));var _0xaa08=function(_0x32c8ed,_0x45fef2){_0x32c8ed=_0x32c8ed-0x0;var _0x580764=_0xa08a[_0x32c8ed];return _0x580764;};'use strict';var MailQueueEvents=require(_0xaa08('0x0'));var events=[_0xaa08('0x1'),_0xaa08('0x2'),_0xaa08('0x3')];function createListener(_0x105e2f,_0x4c609b){return function(_0x2225de){_0x4c609b[_0xaa08('0x4')](_0x105e2f,_0x2225de);};}function removeListener(_0x504428,_0x24119e){return function(){MailQueueEvents[_0xaa08('0x5')](_0x504428,_0x24119e);};}exports[_0xaa08('0x6')]=function(_0x4c4f3c){for(var _0x192c38=0x0,_0x4c9ea2=events[_0xaa08('0x7')];_0x192c38<_0x4c9ea2;_0x192c38++){var _0x4c39ad=events[_0x192c38];var _0x3d262b=createListener(_0xaa08('0x8')+_0x4c39ad,_0x4c4f3c);MailQueueEvents['on'](_0x4c39ad,_0x3d262b);}}; \ No newline at end of file +var _0xc1ad=['mailQueue:','./mailQueue.events','remove','update','emit','removeListener','register'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0xc1ad,0x7f));var _0xdc1a=function(_0x4dd848,_0x43eec8){_0x4dd848=_0x4dd848-0x0;var _0x2c35ae=_0xc1ad[_0x4dd848];return _0x2c35ae;};'use strict';var MailQueueEvents=require(_0xdc1a('0x0'));var events=['save',_0xdc1a('0x1'),_0xdc1a('0x2')];function createListener(_0x4d31f2,_0x6dfe50){return function(_0xb8f8b2){_0x6dfe50[_0xdc1a('0x3')](_0x4d31f2,_0xb8f8b2);};}function removeListener(_0x2af6c6,_0x1a2f01){return function(){MailQueueEvents[_0xdc1a('0x4')](_0x2af6c6,_0x1a2f01);};}exports[_0xdc1a('0x5')]=function(_0x546186){for(var _0x3f7a41=0x0,_0x4a0cee=events['length'];_0x3f7a41<_0x4a0cee;_0x3f7a41++){var _0x54a614=events[_0x3f7a41];var _0x4c3071=createListener(_0xdc1a('0x6')+_0x54a614,_0x546186);MailQueueEvents['on'](_0x54a614,_0x4c3071);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index acfb232..929863c 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 _0x39fd=['update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39fd,0x101));var _0xd39f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x39fd[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xd39f('0x0'));var util=require(_0xd39f('0x1'));var path=require(_0xd39f('0x2'));var timeout=require(_0xd39f('0x3'));var express=require(_0xd39f('0x4'));var router=express[_0xd39f('0x5')]();var auth=require(_0xd39f('0x6'));var interaction=require(_0xd39f('0x7'));var config=require(_0xd39f('0x8'));var controller=require(_0xd39f('0x9'));router[_0xd39f('0xa')]('/',auth[_0xd39f('0xb')](),controller[_0xd39f('0xc')]);router['get'](_0xd39f('0xd'),auth[_0xd39f('0xb')](),controller[_0xd39f('0xe')]);router[_0xd39f('0xa')]('/:id',auth[_0xd39f('0xb')](),controller[_0xd39f('0xf')]);router[_0xd39f('0x10')]('/',auth[_0xd39f('0xb')](),controller[_0xd39f('0x11')]);router[_0xd39f('0x12')]('/:id',auth[_0xd39f('0xb')](),controller[_0xd39f('0x13')]);router[_0xd39f('0x14')](_0xd39f('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0xd39f('0x16')]=router; \ No newline at end of file +var _0x293c=['../../config/environment','get','isAuthenticated','describe','/:id','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1925fc,_0x178385){var _0x45ea79=function(_0x391ab8){while(--_0x391ab8){_0x1925fc['push'](_0x1925fc['shift']());}};_0x45ea79(++_0x178385);}(_0x293c,0x132));var _0xc293=function(_0x5ce6f5,_0x3b072e){_0x5ce6f5=_0x5ce6f5-0x0;var _0x1633b4=_0x293c[_0x5ce6f5];return _0x1633b4;};'use strict';var multer=require(_0xc293('0x0'));var util=require('util');var path=require(_0xc293('0x1'));var timeout=require('connect-timeout');var express=require(_0xc293('0x2'));var router=express[_0xc293('0x3')]();var auth=require(_0xc293('0x4'));var interaction=require(_0xc293('0x5'));var config=require(_0xc293('0x6'));var controller=require('./mailQueueReport.controller');router[_0xc293('0x7')]('/',auth[_0xc293('0x8')](),controller['index']);router[_0xc293('0x7')]('/describe',auth[_0xc293('0x8')](),controller[_0xc293('0x9')]);router[_0xc293('0x7')](_0xc293('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc293('0x8')](),controller['create']);router['put']('/:id',auth[_0xc293('0x8')](),controller['update']);router[_0xc293('0xb')](_0xc293('0xa'),auth[_0xc293('0x8')](),controller['destroy']);module[_0xc293('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 87d679c..e45b803 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 _0x4fd7=['STRING','DATE','moment','sequelize','exports'];(function(_0x4f08bf,_0x479616){var _0x5e9507=function(_0x4f4d76){while(--_0x4f4d76){_0x4f08bf['push'](_0x4f08bf['shift']());}};_0x5e9507(++_0x479616);}(_0x4fd7,0x1c4));var _0x74fd=function(_0x3ea03c,_0x224ac1){_0x3ea03c=_0x3ea03c-0x0;var _0x47fb63=_0x4fd7[_0x3ea03c];return _0x47fb63;};'use strict';var moment=require(_0x74fd('0x0'));var Sequelize=require(_0x74fd('0x1'));module[_0x74fd('0x2')]={'uniqueid':{'type':Sequelize[_0x74fd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x74fd('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x74fd('0x4')]},'acceptAt':{'type':Sequelize[_0x74fd('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x74fd('0x3')]}}; \ No newline at end of file +var _0x9094=['moment','STRING','DATE'];(function(_0x166a9e,_0x27c5b5){var _0x2478cf=function(_0x5c32d5){while(--_0x5c32d5){_0x166a9e['push'](_0x166a9e['shift']());}};_0x2478cf(++_0x27c5b5);}(_0x9094,0x12f));var _0x4909=function(_0x3e4b82,_0x294091){_0x3e4b82=_0x3e4b82-0x0;var _0x35f56a=_0x9094[_0x3e4b82];return _0x35f56a;};'use strict';var moment=require(_0x4909('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4909('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4909('0x1')]},'joinAt':{'type':Sequelize[_0x4909('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4909('0x2')]},'exitAt':{'type':Sequelize[_0x4909('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3b9cb6d..9e15de8 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 _0xab1c=['reject','save','then','destroy','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','offset','order','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','catch','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','limit','set','Content-Range','json','apply'];(function(_0xea9e1c,_0x577088){var _0x3bdb61=function(_0x35e3c1){while(--_0x35e3c1){_0xea9e1c['push'](_0xea9e1c['shift']());}};_0x3bdb61(++_0x577088);}(_0xab1c,0x155));var _0xcab1=function(_0x42aff1,_0x279acb){_0x42aff1=_0x42aff1-0x0;var _0x102349=_0xab1c[_0x42aff1];return _0x102349;};'use strict';var pdf=require(_0xcab1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcab1('0x1'));var zipdir=require(_0xcab1('0x2'));var jsonpatch=require(_0xcab1('0x3'));var rp=require(_0xcab1('0x4'));var moment=require(_0xcab1('0x5'));var BPromise=require(_0xcab1('0x6'));var Mustache=require(_0xcab1('0x7'));var util=require(_0xcab1('0x8'));var path=require('path');var sox=require(_0xcab1('0x9'));var csv=require(_0xcab1('0xa'));var ejs=require(_0xcab1('0xb'));var fs=require('fs');var _=require(_0xcab1('0xc'));var squel=require(_0xcab1('0xd'));var crypto=require(_0xcab1('0xe'));var jsforce=require(_0xcab1('0xf'));var deskjs=require(_0xcab1('0x10'));var toCsv=require(_0xcab1('0xa'));var querystring=require(_0xcab1('0x11'));var Papa=require(_0xcab1('0x12'));var Redis=require('ioredis');var authService=require(_0xcab1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcab1('0x14'));var hardwareService=require(_0xcab1('0x15'));var logger=require('../../config/logger')(_0xcab1('0x16'));var utils=require(_0xcab1('0x17'));var config=require(_0xcab1('0x18'));var licenseUtil=require(_0xcab1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bba10,_0x478d06){_0x478d06=_0x478d06||0xcc;return function(_0x4a6686){if(_0x4a6686){return _0x1bba10['sendStatus'](_0x478d06);}return _0x1bba10[_0xcab1('0x1a')](_0x478d06)[_0xcab1('0x1b')]();};}function respondWithResult(_0xcfeac6,_0x2bc4c4){_0x2bc4c4=_0x2bc4c4||0xc8;return function(_0x248a15){if(_0x248a15){return _0xcfeac6[_0xcab1('0x1a')](_0x2bc4c4)['json'](_0x248a15);}};}function respondWithFilteredResult(_0x1bfdd4,_0x89529e){return function(_0x1e5417){if(_0x1e5417){var _0x20f9df=_0x1e5417[_0xcab1('0x1c')],_0x198bfa=_0x89529e['offset'],_0x241ebd=_0x89529e['offset']+_0x89529e[_0xcab1('0x1d')],_0x35dc6c;if(_0x241ebd>=_0x20f9df){_0x241ebd=_0x20f9df;_0x35dc6c=0xc8;}else{_0x35dc6c=0xce;}_0x1bfdd4[_0xcab1('0x1a')](_0x35dc6c);return _0x1bfdd4[_0xcab1('0x1e')](_0xcab1('0x1f'),_0x198bfa+'-'+_0x241ebd+'/'+_0x20f9df)[_0xcab1('0x20')](_0x1e5417);}return null;};}function patchUpdates(_0xee7946){return function(_0x5bce7d){try{jsonpatch[_0xcab1('0x21')](_0x5bce7d,_0xee7946,!![]);}catch(_0x1e4ca6){return BPromise[_0xcab1('0x22')](_0x1e4ca6);}return _0x5bce7d[_0xcab1('0x23')]();};}function saveUpdates(_0x4c817a,_0x1f5e7b){return function(_0x330783){if(_0x330783){return _0x330783['update'](_0x4c817a)[_0xcab1('0x24')](function(_0x40ff30){return _0x40ff30;});}return null;};}function removeEntity(_0x37c484,_0x4be422){return function(_0x1a45e7){if(_0x1a45e7){return _0x1a45e7[_0xcab1('0x25')]()[_0xcab1('0x24')](function(){_0x37c484[_0xcab1('0x1a')](0xcc)[_0xcab1('0x1b')]();});}};}function handleEntityNotFound(_0x5357cf,_0x1b177a){return function(_0x4f24b2){if(!_0x4f24b2){_0x5357cf[_0xcab1('0x26')](0x194);}return _0x4f24b2;};}function handleError(_0x48b13f,_0xf7b040){_0xf7b040=_0xf7b040||0x1f4;return function(_0x1bcdac){logger[_0xcab1('0x27')](_0x1bcdac['stack']);if(_0x1bcdac[_0xcab1('0x28')]){delete _0x1bcdac[_0xcab1('0x28')];}_0x48b13f['status'](_0xf7b040)[_0xcab1('0x29')](_0x1bcdac);};}exports[_0xcab1('0x2a')]=function(_0x3e050e,_0x58259a){var _0x82761={},_0x4c8fe5={},_0x41c41d={'count':0x0,'rows':[]};var _0x5e06b3=_[_0xcab1('0x2b')](db[_0xcab1('0x2c')][_0xcab1('0x2d')],function(_0x20360e){return{'name':_0x20360e[_0xcab1('0x2e')],'type':_0x20360e['type'][_0xcab1('0x2f')]};});_0x4c8fe5['model']=_[_0xcab1('0x2b')](_0x5e06b3,_0xcab1('0x28'));_0x4c8fe5[_0xcab1('0x30')]=_[_0xcab1('0x31')](_0x3e050e[_0xcab1('0x30')]);_0x4c8fe5[_0xcab1('0x32')]=_[_0xcab1('0x33')](_0x4c8fe5[_0xcab1('0x34')],_0x4c8fe5[_0xcab1('0x30')]);_0x82761[_0xcab1('0x35')]=_[_0xcab1('0x33')](_0x4c8fe5['model'],qs['fields'](_0x3e050e[_0xcab1('0x30')][_0xcab1('0x36')]));_0x82761[_0xcab1('0x35')]=_0x82761[_0xcab1('0x35')][_0xcab1('0x37')]?_0x82761[_0xcab1('0x35')]:_0x4c8fe5['model'];if(!_0x3e050e[_0xcab1('0x30')]['hasOwnProperty']('nolimit')){_0x82761[_0xcab1('0x1d')]=qs[_0xcab1('0x1d')](_0x3e050e['query'][_0xcab1('0x1d')]);_0x82761['offset']=qs[_0xcab1('0x38')](_0x3e050e[_0xcab1('0x30')][_0xcab1('0x38')]);}_0x82761[_0xcab1('0x39')]=qs['sort'](_0x3e050e[_0xcab1('0x30')]['sort']);_0x82761['where']=qs[_0xcab1('0x32')](_[_0xcab1('0x3a')](_0x3e050e['query'],_0x4c8fe5[_0xcab1('0x32')]),_0x5e06b3);if(_0x3e050e[_0xcab1('0x30')][_0xcab1('0x3b')]){_0x82761[_0xcab1('0x3c')]=_[_0xcab1('0x3d')](_0x82761['where'],{'$or':_['map'](_0x5e06b3,function(_0x4b2c58){if(_0x4b2c58['type']!==_0xcab1('0x3e')){var _0x567ee7={};_0x567ee7[_0x4b2c58[_0xcab1('0x28')]]={'$like':'%'+_0x3e050e['query'][_0xcab1('0x3b')]+'%'};return _0x567ee7;}})});}_0x82761=_[_0xcab1('0x3d')]({},_0x82761,_0x3e050e['options']);var _0x2d283a={'where':_0x82761['where']};return db[_0xcab1('0x2c')][_0xcab1('0x1c')](_0x2d283a)[_0xcab1('0x24')](function(_0x4baffd){_0x41c41d[_0xcab1('0x1c')]=_0x4baffd;if(_0x3e050e[_0xcab1('0x30')]['includeAll']){_0x82761[_0xcab1('0x3f')]=[{'all':!![]}];}return db[_0xcab1('0x2c')][_0xcab1('0x40')](_0x82761);})[_0xcab1('0x24')](function(_0x386c89){_0x41c41d[_0xcab1('0x41')]=_0x386c89;return _0x41c41d;})[_0xcab1('0x24')](respondWithFilteredResult(_0x58259a,_0x82761))['catch'](handleError(_0x58259a,null));};exports[_0xcab1('0x42')]=function(_0x186189,_0x1eee3d){var _0x179679={'raw':!![],'where':{'id':_0x186189[_0xcab1('0x43')]['id']}},_0xfe2b96={};_0xfe2b96[_0xcab1('0x34')]=_[_0xcab1('0x31')](db['MailQueueReport'][_0xcab1('0x2d')]);_0xfe2b96[_0xcab1('0x30')]=_[_0xcab1('0x31')](_0x186189[_0xcab1('0x30')]);_0xfe2b96[_0xcab1('0x32')]=_[_0xcab1('0x33')](_0xfe2b96[_0xcab1('0x34')],_0xfe2b96[_0xcab1('0x30')]);_0x179679['attributes']=_[_0xcab1('0x33')](_0xfe2b96[_0xcab1('0x34')],qs['fields'](_0x186189['query'][_0xcab1('0x36')]));_0x179679[_0xcab1('0x35')]=_0x179679[_0xcab1('0x35')][_0xcab1('0x37')]?_0x179679[_0xcab1('0x35')]:_0xfe2b96[_0xcab1('0x34')];if(_0x186189[_0xcab1('0x30')][_0xcab1('0x44')]){_0x179679[_0xcab1('0x3f')]=[{'all':!![]}];}_0x179679=_[_0xcab1('0x3d')]({},_0x179679,_0x186189[_0xcab1('0x45')]);return db['MailQueueReport']['find'](_0x179679)[_0xcab1('0x24')](handleEntityNotFound(_0x1eee3d,null))[_0xcab1('0x24')](respondWithResult(_0x1eee3d,null))[_0xcab1('0x46')](handleError(_0x1eee3d,null));};exports[_0xcab1('0x47')]=function(_0x1d4a05,_0x16d9f7){return db[_0xcab1('0x2c')][_0xcab1('0x47')](_0x1d4a05['body'],{})[_0xcab1('0x24')](respondWithResult(_0x16d9f7,0xc9))[_0xcab1('0x46')](handleError(_0x16d9f7,null));};exports['update']=function(_0x425a8c,_0x247826){if(_0x425a8c['body']['id']){delete _0x425a8c[_0xcab1('0x48')]['id'];}return db[_0xcab1('0x2c')][_0xcab1('0x49')]({'where':{'id':_0x425a8c[_0xcab1('0x43')]['id']}})['then'](handleEntityNotFound(_0x247826,null))[_0xcab1('0x24')](saveUpdates(_0x425a8c[_0xcab1('0x48')],null))[_0xcab1('0x24')](respondWithResult(_0x247826,null))['catch'](handleError(_0x247826,null));};exports['destroy']=function(_0x3397aa,_0x226d30){return db[_0xcab1('0x2c')][_0xcab1('0x49')]({'where':{'id':_0x3397aa[_0xcab1('0x43')]['id']}})[_0xcab1('0x24')](handleEntityNotFound(_0x226d30,null))[_0xcab1('0x24')](removeEntity(_0x226d30,null))[_0xcab1('0x46')](handleError(_0x226d30,null));};exports[_0xcab1('0x4a')]=function(_0x2c69ac,_0x2de826){return db[_0xcab1('0x2c')][_0xcab1('0x4a')]()[_0xcab1('0x24')](respondWithResult(_0x2de826,null))[_0xcab1('0x46')](handleError(_0x2de826,null));}; \ No newline at end of file +var _0x8883=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x32fe44,_0x3b604a){var _0x409a5e=function(_0x14cc53){while(--_0x14cc53){_0x32fe44['push'](_0x32fe44['shift']());}};_0x409a5e(++_0x3b604a);}(_0x8883,0xfa));var _0x3888=function(_0x1a2895,_0x48b8e2){_0x1a2895=_0x1a2895-0x0;var _0x36bf9d=_0x8883[_0x1a2895];return _0x36bf9d;};'use strict';var pdf=require(_0x3888('0x0'));var emlformat=require(_0x3888('0x1'));var rimraf=require(_0x3888('0x2'));var zipdir=require(_0x3888('0x3'));var jsonpatch=require(_0x3888('0x4'));var rp=require(_0x3888('0x5'));var moment=require('moment');var BPromise=require(_0x3888('0x6'));var Mustache=require(_0x3888('0x7'));var util=require(_0x3888('0x8'));var path=require(_0x3888('0x9'));var sox=require(_0x3888('0xa'));var csv=require(_0x3888('0xb'));var ejs=require(_0x3888('0xc'));var fs=require('fs');var _=require(_0x3888('0xd'));var squel=require(_0x3888('0xe'));var crypto=require(_0x3888('0xf'));var jsforce=require(_0x3888('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3888('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3888('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3888('0x12'));var logger=require(_0x3888('0x13'))('api');var utils=require(_0x3888('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3888('0x15'));var db=require(_0x3888('0x16'))['db'];function respondWithStatusCode(_0x2300c6,_0x344312){_0x344312=_0x344312||0xcc;return function(_0x5cd730){if(_0x5cd730){return _0x2300c6['sendStatus'](_0x344312);}return _0x2300c6['status'](_0x344312)[_0x3888('0x17')]();};}function respondWithResult(_0x42d96e,_0x54e4d5){_0x54e4d5=_0x54e4d5||0xc8;return function(_0x22c1dd){if(_0x22c1dd){return _0x42d96e[_0x3888('0x18')](_0x54e4d5)[_0x3888('0x19')](_0x22c1dd);}};}function respondWithFilteredResult(_0x18f418,_0x8c945d){return function(_0x4ef97f){if(_0x4ef97f){var _0x4affcb=_0x4ef97f['count'],_0x1a6fcb=_0x8c945d[_0x3888('0x1a')],_0x17c805=_0x8c945d[_0x3888('0x1a')]+_0x8c945d[_0x3888('0x1b')],_0x400428;if(_0x17c805>=_0x4affcb){_0x17c805=_0x4affcb;_0x400428=0xc8;}else{_0x400428=0xce;}_0x18f418[_0x3888('0x18')](_0x400428);return _0x18f418[_0x3888('0x1c')](_0x3888('0x1d'),_0x1a6fcb+'-'+_0x17c805+'/'+_0x4affcb)[_0x3888('0x19')](_0x4ef97f);}return null;};}function patchUpdates(_0x447017){return function(_0x276c76){try{jsonpatch[_0x3888('0x1e')](_0x276c76,_0x447017,!![]);}catch(_0x1a47f1){return BPromise[_0x3888('0x1f')](_0x1a47f1);}return _0x276c76[_0x3888('0x20')]();};}function saveUpdates(_0x20be33,_0x4933fa){return function(_0x430201){if(_0x430201){return _0x430201['update'](_0x20be33)[_0x3888('0x21')](function(_0x41382d){return _0x41382d;});}return null;};}function removeEntity(_0x28ad0d,_0x45e3c9){return function(_0x5d4b2){if(_0x5d4b2){return _0x5d4b2['destroy']()[_0x3888('0x21')](function(){_0x28ad0d[_0x3888('0x18')](0xcc)[_0x3888('0x17')]();});}};}function handleEntityNotFound(_0x432d35,_0x2529e8){return function(_0x3b5dbe){if(!_0x3b5dbe){_0x432d35[_0x3888('0x22')](0x194);}return _0x3b5dbe;};}function handleError(_0x1ed566,_0x31a7dd){_0x31a7dd=_0x31a7dd||0x1f4;return function(_0x5bbd39){logger['error'](_0x5bbd39[_0x3888('0x23')]);if(_0x5bbd39['name']){delete _0x5bbd39[_0x3888('0x24')];}_0x1ed566[_0x3888('0x18')](_0x31a7dd)[_0x3888('0x25')](_0x5bbd39);};}exports[_0x3888('0x26')]=function(_0x105357,_0xcc1d05){var _0x4fe76a={},_0x24c6c7={},_0x4cc90e={'count':0x0,'rows':[]};var _0x5cd24f=_[_0x3888('0x27')](db[_0x3888('0x28')][_0x3888('0x29')],function(_0x49d444){return{'name':_0x49d444[_0x3888('0x2a')],'type':_0x49d444[_0x3888('0x2b')][_0x3888('0x2c')]};});_0x24c6c7[_0x3888('0x2d')]=_[_0x3888('0x27')](_0x5cd24f,_0x3888('0x24'));_0x24c6c7[_0x3888('0x2e')]=_[_0x3888('0x2f')](_0x105357[_0x3888('0x2e')]);_0x24c6c7[_0x3888('0x30')]=_[_0x3888('0x31')](_0x24c6c7[_0x3888('0x2d')],_0x24c6c7[_0x3888('0x2e')]);_0x4fe76a[_0x3888('0x32')]=_[_0x3888('0x31')](_0x24c6c7[_0x3888('0x2d')],qs[_0x3888('0x33')](_0x105357['query'][_0x3888('0x33')]));_0x4fe76a[_0x3888('0x32')]=_0x4fe76a['attributes'][_0x3888('0x34')]?_0x4fe76a['attributes']:_0x24c6c7['model'];if(!_0x105357[_0x3888('0x2e')][_0x3888('0x35')]('nolimit')){_0x4fe76a['limit']=qs[_0x3888('0x1b')](_0x105357[_0x3888('0x2e')][_0x3888('0x1b')]);_0x4fe76a[_0x3888('0x1a')]=qs['offset'](_0x105357[_0x3888('0x2e')]['offset']);}_0x4fe76a[_0x3888('0x36')]=qs[_0x3888('0x37')](_0x105357[_0x3888('0x2e')][_0x3888('0x37')]);_0x4fe76a[_0x3888('0x38')]=qs[_0x3888('0x30')](_[_0x3888('0x39')](_0x105357[_0x3888('0x2e')],_0x24c6c7[_0x3888('0x30')]),_0x5cd24f);if(_0x105357[_0x3888('0x2e')][_0x3888('0x3a')]){_0x4fe76a[_0x3888('0x38')]=_[_0x3888('0x3b')](_0x4fe76a[_0x3888('0x38')],{'$or':_[_0x3888('0x27')](_0x5cd24f,function(_0x32e558){if(_0x32e558[_0x3888('0x2b')]!==_0x3888('0x3c')){var _0x3f7671={};_0x3f7671[_0x32e558[_0x3888('0x24')]]={'$like':'%'+_0x105357[_0x3888('0x2e')][_0x3888('0x3a')]+'%'};return _0x3f7671;}})});}_0x4fe76a=_[_0x3888('0x3b')]({},_0x4fe76a,_0x105357[_0x3888('0x3d')]);var _0x51c073={'where':_0x4fe76a[_0x3888('0x38')]};return db[_0x3888('0x28')]['count'](_0x51c073)[_0x3888('0x21')](function(_0x1c82fb){_0x4cc90e[_0x3888('0x3e')]=_0x1c82fb;if(_0x105357[_0x3888('0x2e')][_0x3888('0x3f')]){_0x4fe76a[_0x3888('0x40')]=[{'all':!![]}];}return db[_0x3888('0x28')][_0x3888('0x41')](_0x4fe76a);})[_0x3888('0x21')](function(_0x30bb4b){_0x4cc90e[_0x3888('0x42')]=_0x30bb4b;return _0x4cc90e;})[_0x3888('0x21')](respondWithFilteredResult(_0xcc1d05,_0x4fe76a))[_0x3888('0x43')](handleError(_0xcc1d05,null));};exports['show']=function(_0x32ec99,_0x128fd3){var _0x347eb8={'raw':!![],'where':{'id':_0x32ec99[_0x3888('0x44')]['id']}},_0x38dc38={};_0x38dc38[_0x3888('0x2d')]=_[_0x3888('0x2f')](db[_0x3888('0x28')]['rawAttributes']);_0x38dc38[_0x3888('0x2e')]=_[_0x3888('0x2f')](_0x32ec99[_0x3888('0x2e')]);_0x38dc38[_0x3888('0x30')]=_[_0x3888('0x31')](_0x38dc38[_0x3888('0x2d')],_0x38dc38[_0x3888('0x2e')]);_0x347eb8['attributes']=_[_0x3888('0x31')](_0x38dc38[_0x3888('0x2d')],qs[_0x3888('0x33')](_0x32ec99['query'][_0x3888('0x33')]));_0x347eb8['attributes']=_0x347eb8[_0x3888('0x32')][_0x3888('0x34')]?_0x347eb8['attributes']:_0x38dc38[_0x3888('0x2d')];if(_0x32ec99['query'][_0x3888('0x3f')]){_0x347eb8['include']=[{'all':!![]}];}_0x347eb8=_[_0x3888('0x3b')]({},_0x347eb8,_0x32ec99[_0x3888('0x3d')]);return db[_0x3888('0x28')][_0x3888('0x45')](_0x347eb8)[_0x3888('0x21')](handleEntityNotFound(_0x128fd3,null))['then'](respondWithResult(_0x128fd3,null))[_0x3888('0x43')](handleError(_0x128fd3,null));};exports[_0x3888('0x46')]=function(_0x27a946,_0x43c56d){return db['MailQueueReport']['create'](_0x27a946[_0x3888('0x47')],{})['then'](respondWithResult(_0x43c56d,0xc9))[_0x3888('0x43')](handleError(_0x43c56d,null));};exports['update']=function(_0x28a763,_0x1e2826){if(_0x28a763[_0x3888('0x47')]['id']){delete _0x28a763[_0x3888('0x47')]['id'];}return db[_0x3888('0x28')][_0x3888('0x45')]({'where':{'id':_0x28a763[_0x3888('0x44')]['id']}})[_0x3888('0x21')](handleEntityNotFound(_0x1e2826,null))[_0x3888('0x21')](saveUpdates(_0x28a763[_0x3888('0x47')],null))[_0x3888('0x21')](respondWithResult(_0x1e2826,null))[_0x3888('0x43')](handleError(_0x1e2826,null));};exports[_0x3888('0x48')]=function(_0x34fb8d,_0x17ef45){return db['MailQueueReport'][_0x3888('0x45')]({'where':{'id':_0x34fb8d[_0x3888('0x44')]['id']}})['then'](handleEntityNotFound(_0x17ef45,null))['then'](removeEntity(_0x17ef45,null))['catch'](handleError(_0x17ef45,null));};exports[_0x3888('0x49')]=function(_0x3b8c30,_0x485c36){return db['MailQueueReport'][_0x3888('0x49')]()['then'](respondWithResult(_0x485c36,null))[_0x3888('0x43')](handleError(_0x485c36,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 00143af..9964335 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 _0x1312=['../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xd57fab,_0x5df0b8){var _0x232946=function(_0x5ae0c4){while(--_0x5ae0c4){_0xd57fab['push'](_0xd57fab['shift']());}};_0x232946(++_0x5df0b8);}(_0x1312,0x18c));var _0x2131=function(_0x5e9b23,_0x3069fd){_0x5e9b23=_0x5e9b23-0x0;var _0x27501f=_0x1312[_0x5e9b23];return _0x27501f;};'use strict';var _=require(_0x2131('0x0'));var util=require('util');var logger=require(_0x2131('0x1'))(_0x2131('0x2'));var moment=require('moment');var BPromise=require(_0x2131('0x3'));var rp=require(_0x2131('0x4'));var fs=require('fs');var path=require(_0x2131('0x5'));var rimraf=require(_0x2131('0x6'));var config=require(_0x2131('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x2131('0x8')]=function(_0x530bcd,_0x2635c8){return _0x530bcd[_0x2131('0x9')](_0x2131('0xa'),attributes,{'tableName':_0x2131('0xb'),'paranoid':![],'indexes':[{'name':_0x2131('0xc'),'fields':[_0x2131('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63be=['../../config/environment','exports','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x63be,0xd7));var _0xe63b=function(_0x4edb08,_0x10e233){_0x4edb08=_0x4edb08-0x0;var _0x1e31a4=_0x63be[_0x4edb08];return _0x1e31a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe63b('0x0'))(_0xe63b('0x1'));var moment=require('moment');var BPromise=require(_0xe63b('0x2'));var rp=require(_0xe63b('0x3'));var fs=require('fs');var path=require(_0xe63b('0x4'));var rimraf=require('rimraf');var config=require(_0xe63b('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0xe63b('0x6')]=function(_0x19cf80,_0x3cc298){return _0x19cf80['define'](_0xe63b('0x7'),attributes,{'tableName':_0xe63b('0x8'),'paranoid':![],'indexes':[{'name':_0xe63b('0x9'),'fields':[_0xe63b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ca6d811..21319d6 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 _0x6446=['MailQueueReport','create','body','options','UpdateMailQueueReport','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateMailQueueReport'];(function(_0x3e4abb,_0xef4571){var _0x50569f=function(_0x4555ba){while(--_0x4555ba){_0x3e4abb['push'](_0x3e4abb['shift']());}};_0x50569f(++_0xef4571);}(_0x6446,0xbd));var _0x6644=function(_0x173ec0,_0x4374db){_0x173ec0=_0x173ec0-0x0;var _0xcbf53d=_0x6446[_0x173ec0];return _0xcbf53d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6644('0x0'));var BPromise=require(_0x6644('0x1'));var rs=require(_0x6644('0x2'));var fs=require('fs');var Redis=require(_0x6644('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6644('0x4'));var logger=require(_0x6644('0x5'))(_0x6644('0x6'));var config=require(_0x6644('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6644('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40e4bb,_0x1b23be,_0x516005){return new BPromise(function(_0x365c10,_0x7532fd){return client[_0x6644('0x9')](_0x40e4bb,_0x516005)[_0x6644('0xa')](function(_0x2778f2){logger[_0x6644('0xb')](_0x6644('0xc'),_0x1b23be,_0x6644('0xd'));logger[_0x6644('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x1b23be,'request\x20sent',JSON[_0x6644('0xf')](_0x2778f2));if(_0x2778f2[_0x6644('0x10')]){if(_0x2778f2[_0x6644('0x10')][_0x6644('0x11')]===0x1f4){logger[_0x6644('0x10')](_0x6644('0xc'),_0x1b23be,_0x2778f2['error'][_0x6644('0x12')]);return _0x7532fd(_0x2778f2['error'][_0x6644('0x12')]);}logger['error'](_0x6644('0xc'),_0x1b23be,_0x2778f2[_0x6644('0x10')][_0x6644('0x12')]);return _0x365c10(_0x2778f2[_0x6644('0x10')][_0x6644('0x12')]);}else{logger['info'](_0x6644('0xc'),_0x1b23be,_0x6644('0xd'));_0x365c10(_0x2778f2['result'][_0x6644('0x12')]);}})[_0x6644('0x13')](function(_0x21d653){logger[_0x6644('0x10')](_0x6644('0xc'),_0x1b23be,_0x21d653);_0x7532fd(_0x21d653);});});}exports[_0x6644('0x14')]=function(_0x17b19b){var _0x2a978f=this;return new Promise(function(_0x404beb,_0x280312){return db[_0x6644('0x15')][_0x6644('0x16')](_0x17b19b[_0x6644('0x17')],{'raw':_0x17b19b[_0x6644('0x18')]?_0x17b19b[_0x6644('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6644('0xa')](function(_0x87d683){logger['info'](_0x6644('0x14'),_0x17b19b);logger['debug'](_0x6644('0x14'),_0x17b19b,JSON[_0x6644('0xf')](_0x87d683));_0x404beb(_0x87d683);})['catch'](function(_0x566cc2){logger['error'](_0x6644('0x14'),_0x566cc2['message'],_0x17b19b);_0x280312(_0x2a978f[_0x6644('0x10')](0x1f4,_0x566cc2[_0x6644('0x12')]));});});};exports[_0x6644('0x19')]=function(_0x2833c3){var _0x14da0c=this;return new Promise(function(_0x6d89c6,_0x13aaaa){return db[_0x6644('0x15')]['update'](_0x2833c3[_0x6644('0x17')],{'raw':_0x2833c3[_0x6644('0x18')]?_0x2833c3[_0x6644('0x18')][_0x6644('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2833c3[_0x6644('0x18')]?_0x2833c3[_0x6644('0x18')][_0x6644('0x1b')]||null:null,'attributes':_0x2833c3[_0x6644('0x18')]?_0x2833c3['options'][_0x6644('0x1c')]||null:null,'limit':_0x2833c3['options']?_0x2833c3[_0x6644('0x18')][_0x6644('0x1d')]||null:null})['then'](function(_0x28badb){logger[_0x6644('0xb')](_0x6644('0x19'),_0x2833c3);logger['debug'](_0x6644('0x19'),_0x2833c3,JSON[_0x6644('0xf')](_0x28badb));_0x6d89c6(_0x28badb);})[_0x6644('0x13')](function(_0x456bfb){logger[_0x6644('0x10')](_0x6644('0x19'),_0x456bfb[_0x6644('0x12')],_0x2833c3);_0x13aaaa(_0x14da0c[_0x6644('0x10')](0x1f4,_0x456bfb[_0x6644('0x12')]));});});}; \ No newline at end of file +var _0x18e4=['where','UpdateMailQueueReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','body','options','raw','then','CreateMailQueueReport','MailQueueReport','update'];(function(_0x3ab0ac,_0x1ea9cf){var _0x1f743d=function(_0x45fb92){while(--_0x45fb92){_0x3ab0ac['push'](_0x3ab0ac['shift']());}};_0x1f743d(++_0x1ea9cf);}(_0x18e4,0x1c4));var _0x418e=function(_0x4d32e9,_0x390d44){_0x4d32e9=_0x4d32e9-0x0;var _0x2d9ece=_0x18e4[_0x4d32e9];return _0x2d9ece;};'use strict';var _=require(_0x418e('0x0'));var util=require(_0x418e('0x1'));var moment=require(_0x418e('0x2'));var BPromise=require('bluebird');var rs=require(_0x418e('0x3'));var fs=require('fs');var Redis=require(_0x418e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x418e('0x5'))(_0x418e('0x6'));var config=require(_0x418e('0x7'));var jayson=require(_0x418e('0x8'));var client=jayson[_0x418e('0x9')][_0x418e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35eab0,_0xe37dff,_0xd85ffd){return new BPromise(function(_0x36fd46,_0x1ded45){return client['request'](_0x35eab0,_0xd85ffd)['then'](function(_0x4e5a58){logger[_0x418e('0xb')](_0x418e('0xc'),_0xe37dff,'request\x20sent');logger[_0x418e('0xd')](_0x418e('0xe'),_0xe37dff,_0x418e('0xf'),JSON[_0x418e('0x10')](_0x4e5a58));if(_0x4e5a58[_0x418e('0x11')]){if(_0x4e5a58[_0x418e('0x11')]['code']===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0xe37dff,_0x4e5a58[_0x418e('0x11')][_0x418e('0x12')]);return _0x1ded45(_0x4e5a58[_0x418e('0x11')][_0x418e('0x12')]);}logger[_0x418e('0x11')](_0x418e('0xc'),_0xe37dff,_0x4e5a58[_0x418e('0x11')][_0x418e('0x12')]);return _0x36fd46(_0x4e5a58[_0x418e('0x11')][_0x418e('0x12')]);}else{logger[_0x418e('0xb')]('MailQueueReport,\x20%s,\x20%s',_0xe37dff,_0x418e('0xf'));_0x36fd46(_0x4e5a58[_0x418e('0x13')][_0x418e('0x12')]);}})[_0x418e('0x14')](function(_0x5a701a){logger['error']('MailQueueReport,\x20%s,\x20%s',_0xe37dff,_0x5a701a);_0x1ded45(_0x5a701a);});});}exports['CreateMailQueueReport']=function(_0x4ad190){var _0x5587ba=this;return new Promise(function(_0x5bf2e3,_0x31b087){return db['MailQueueReport']['create'](_0x4ad190[_0x418e('0x15')],{'raw':_0x4ad190[_0x418e('0x16')]?_0x4ad190['options'][_0x418e('0x17')]===undefined?!![]:![]:!![]})[_0x418e('0x18')](function(_0x2ca696){logger['info'](_0x418e('0x19'),_0x4ad190);logger[_0x418e('0xd')](_0x418e('0x19'),_0x4ad190,JSON[_0x418e('0x10')](_0x2ca696));_0x5bf2e3(_0x2ca696);})[_0x418e('0x14')](function(_0x33652b){logger['error'](_0x418e('0x19'),_0x33652b[_0x418e('0x12')],_0x4ad190);_0x31b087(_0x5587ba[_0x418e('0x11')](0x1f4,_0x33652b['message']));});});};exports['UpdateMailQueueReport']=function(_0x18452b){var _0x55145f=this;return new Promise(function(_0x39737a,_0x288dcd){return db[_0x418e('0x1a')][_0x418e('0x1b')](_0x18452b[_0x418e('0x15')],{'raw':_0x18452b[_0x418e('0x16')]?_0x18452b[_0x418e('0x16')][_0x418e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18452b[_0x418e('0x16')]?_0x18452b[_0x418e('0x16')][_0x418e('0x1c')]||null:null,'attributes':_0x18452b['options']?_0x18452b[_0x418e('0x16')]['attributes']||null:null,'limit':_0x18452b[_0x418e('0x16')]?_0x18452b[_0x418e('0x16')]['limit']||null:null})[_0x418e('0x18')](function(_0x2d5a02){logger[_0x418e('0xb')](_0x418e('0x1d'),_0x18452b);logger[_0x418e('0xd')](_0x418e('0x1d'),_0x18452b,JSON[_0x418e('0x10')](_0x2d5a02));_0x39737a(_0x2d5a02);})['catch'](function(_0x26b624){logger[_0x418e('0x11')]('UpdateMailQueueReport',_0x26b624[_0x418e('0x12')],_0x18452b);_0x288dcd(_0x55145f[_0x418e('0x11')](0x1f4,_0x26b624['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2a920c7..9862c09 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 _0x0154=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4d5c53,_0x2f11de){var _0x372920=function(_0x26adf7){while(--_0x26adf7){_0x4d5c53['push'](_0x4d5c53['shift']());}};_0x372920(++_0x2f11de);}(_0x0154,0xf5));var _0x4015=function(_0x18a45,_0x2cadeb){_0x18a45=_0x18a45-0x0;var _0x35cf29=_0x0154[_0x18a45];return _0x35cf29;};'use strict';var multer=require(_0x4015('0x0'));var util=require(_0x4015('0x1'));var path=require(_0x4015('0x2'));var timeout=require(_0x4015('0x3'));var express=require(_0x4015('0x4'));var router=express[_0x4015('0x5')]();var auth=require(_0x4015('0x6'));var interaction=require(_0x4015('0x7'));var config=require('../../config/environment');module[_0x4015('0x8')]=router; \ No newline at end of file +var _0x63bf=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3391fe,_0x5c24d9){var _0x1ae383=function(_0x5e71a4){while(--_0x5e71a4){_0x3391fe['push'](_0x3391fe['shift']());}};_0x1ae383(++_0x5c24d9);}(_0x63bf,0x66));var _0xf63b=function(_0x368f85,_0x383394){_0x368f85=_0x368f85-0x0;var _0x34a15a=_0x63bf[_0x368f85];return _0x34a15a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf63b('0x0'));var timeout=require(_0xf63b('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf63b('0x2'));var interaction=require(_0xf63b('0x3'));var config=require(_0xf63b('0x4'));module[_0xf63b('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index bfc7d15..3e504ba 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 _0xcc45=['INBOX','exports','STRING','username','INTEGER','BOOLEAN'];(function(_0xc5fa7c,_0x38c8cf){var _0x3ab33c=function(_0x3ad5e5){while(--_0x3ad5e5){_0xc5fa7c['push'](_0xc5fa7c['shift']());}};_0x3ab33c(++_0x38c8cf);}(_0xcc45,0x169));var _0x5cc4=function(_0x646ba3,_0x242d56){_0x646ba3=_0x646ba3-0x0;var _0x32352e=_0xcc45[_0x646ba3];return _0x32352e;};'use strict';var Sequelize=require('sequelize');module[_0x5cc4('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5cc4('0x1')],'unique':_0x5cc4('0x2')},'password':{'type':Sequelize[_0x5cc4('0x1')]},'port':{'type':Sequelize[_0x5cc4('0x3')]},'tls':{'type':Sequelize[_0x5cc4('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5cc4('0x1')],'defaultValue':_0x5cc4('0x5')},'connTimeout':{'type':Sequelize[_0x5cc4('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5726=['INTEGER','sequelize','exports','STRING','BOOLEAN','username'];(function(_0x55b998,_0xf956d4){var _0x2d398a=function(_0x436b5b){while(--_0x436b5b){_0x55b998['push'](_0x55b998['shift']());}};_0x2d398a(++_0xf956d4);}(_0x5726,0xfd));var _0x6572=function(_0x25caf8,_0x5809cc){_0x25caf8=_0x25caf8-0x0;var _0x5e24ab=_0x5726[_0x25caf8];return _0x5e24ab;};'use strict';var Sequelize=require(_0x6572('0x0'));module[_0x6572('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6572('0x2')]},'authentication':{'type':Sequelize[_0x6572('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x6572('0x4')},'password':{'type':Sequelize[_0x6572('0x2')]},'port':{'type':Sequelize[_0x6572('0x5')]},'tls':{'type':Sequelize[_0x6572('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6572('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x6572('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index aa1dc3f..af463b7 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 _0x0b0e=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x7bdd96,_0x1b5e29){var _0x36e84f=function(_0x9c02d1){while(--_0x9c02d1){_0x7bdd96['push'](_0x7bdd96['shift']());}};_0x36e84f(++_0x1b5e29);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x0b0e[_0x1147ab];return _0x55cb5a;};'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')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0x3de3,0x1ce));var _0x33de=function(_0x408414,_0x13805b){_0x408414=_0x408414-0x0;var _0xe7719c=_0x3de3[_0x408414];return _0xe7719c;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var logger=require(_0x33de('0x1'))(_0x33de('0x2'));var moment=require('moment');var BPromise=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var fs=require('fs');var path=require(_0x33de('0x5'));var rimraf=require(_0x33de('0x6'));var config=require('../../config/environment');var attributes=require(_0x33de('0x7'));module[_0x33de('0x8')]=function(_0x558f98,_0x142716){return _0x558f98['define'](_0x33de('0x9'),attributes,{'tableName':_0x33de('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 7d27c21..8f77801 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 _0x4a0b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x4a0b,0x1c1));var _0xb4a0=function(_0x193c2d,_0x2ffba6){_0x193c2d=_0x193c2d-0x0;var _0xc86526=_0x4a0b[_0x193c2d];return _0xc86526;};'use strict';var _=require(_0xb4a0('0x0'));var util=require(_0xb4a0('0x1'));var moment=require(_0xb4a0('0x2'));var BPromise=require(_0xb4a0('0x3'));var rs=require(_0xb4a0('0x4'));var fs=require('fs');var Redis=require(_0xb4a0('0x5'));var db=require(_0xb4a0('0x6'))['db'];var utils=require(_0xb4a0('0x7'));var logger=require(_0xb4a0('0x8'))(_0xb4a0('0x9'));var config=require(_0xb4a0('0xa'));var jayson=require(_0xb4a0('0xb'));var client=jayson[_0xb4a0('0xc')][_0xb4a0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x546c3c,_0x695a43,_0x5b4cbe){return new BPromise(function(_0x1bae61,_0x36089e){return client[_0xb4a0('0xe')](_0x546c3c,_0x5b4cbe)[_0xb4a0('0xf')](function(_0x5c2016){logger[_0xb4a0('0x10')](_0xb4a0('0x11'),_0x695a43,_0xb4a0('0x12'));logger[_0xb4a0('0x13')](_0xb4a0('0x14'),_0x695a43,'request\x20sent',JSON[_0xb4a0('0x15')](_0x5c2016));if(_0x5c2016[_0xb4a0('0x16')]){if(_0x5c2016[_0xb4a0('0x16')][_0xb4a0('0x17')]===0x1f4){logger[_0xb4a0('0x16')]('MailServerIn,\x20%s,\x20%s',_0x695a43,_0x5c2016[_0xb4a0('0x16')][_0xb4a0('0x18')]);return _0x36089e(_0x5c2016[_0xb4a0('0x16')][_0xb4a0('0x18')]);}logger[_0xb4a0('0x16')]('MailServerIn,\x20%s,\x20%s',_0x695a43,_0x5c2016[_0xb4a0('0x16')][_0xb4a0('0x18')]);return _0x1bae61(_0x5c2016[_0xb4a0('0x16')][_0xb4a0('0x18')]);}else{logger[_0xb4a0('0x10')]('MailServerIn,\x20%s,\x20%s',_0x695a43,_0xb4a0('0x12'));_0x1bae61(_0x5c2016[_0xb4a0('0x19')]['message']);}})[_0xb4a0('0x1a')](function(_0x5446db){logger['error'](_0xb4a0('0x11'),_0x695a43,_0x5446db);_0x36089e(_0x5446db);});});}exports[_0xb4a0('0x1b')]=function(_0x54e0c1){var _0x457c8d=this;return new Promise(function(_0x47d58b,_0x546e07){return db[_0xb4a0('0x1c')][_0xb4a0('0x1d')]({'raw':_0x54e0c1[_0xb4a0('0x1e')]?_0x54e0c1['options'][_0xb4a0('0x1f')]===undefined?!![]:![]:!![],'where':_0x54e0c1[_0xb4a0('0x1e')]?_0x54e0c1[_0xb4a0('0x1e')][_0xb4a0('0x20')]||null:null,'attributes':_0x54e0c1[_0xb4a0('0x1e')]?_0x54e0c1[_0xb4a0('0x1e')]['attributes']||null:null,'limit':_0x54e0c1['options']?_0x54e0c1[_0xb4a0('0x1e')][_0xb4a0('0x21')]||null:null,'include':_0x54e0c1[_0xb4a0('0x1e')]?_0x54e0c1[_0xb4a0('0x1e')][_0xb4a0('0x22')]?_[_0xb4a0('0x23')](_0x54e0c1[_0xb4a0('0x1e')][_0xb4a0('0x22')],function(_0x4c6ce1){return{'model':db[_0x4c6ce1[_0xb4a0('0x24')]],'as':_0x4c6ce1['as'],'attributes':_0x4c6ce1[_0xb4a0('0x25')],'include':_0x4c6ce1[_0xb4a0('0x22')]?_[_0xb4a0('0x23')](_0x4c6ce1[_0xb4a0('0x22')],function(_0x459be6){return{'model':db[_0x459be6[_0xb4a0('0x24')]],'as':_0x459be6['as'],'attributes':_0x459be6[_0xb4a0('0x25')],'include':_0x459be6[_0xb4a0('0x22')]?_['map'](_0x459be6[_0xb4a0('0x22')],function(_0xa20a7f){return{'model':db[_0xa20a7f['model']],'as':_0xa20a7f['as'],'attributes':_0xa20a7f[_0xb4a0('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32696d){logger[_0xb4a0('0x10')](_0xb4a0('0x1b'),_0x54e0c1);logger[_0xb4a0('0x13')]('GetMailServerIn',_0x54e0c1,JSON[_0xb4a0('0x15')](_0x32696d));_0x47d58b(_0x32696d);})[_0xb4a0('0x1a')](function(_0x285801){logger[_0xb4a0('0x16')](_0xb4a0('0x1b'),_0x285801[_0xb4a0('0x18')],_0x54e0c1);_0x546e07(_0x457c8d[_0xb4a0('0x16')](0x1f4,_0x285801[_0xb4a0('0x18')]));});});}; \ No newline at end of file +var _0x1269=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','MailServerIn','options','raw','where','attributes','include','map','model','GetMailServerIn','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x85254f,_0x180eb1){var _0x8fc621=function(_0x1ad097){while(--_0x1ad097){_0x85254f['push'](_0x85254f['shift']());}};_0x8fc621(++_0x180eb1);}(_0x1269,0x1d5));var _0x9126=function(_0xf670f0,_0x353747){_0xf670f0=_0xf670f0-0x0;var _0x3c21c6=_0x1269[_0xf670f0];return _0x3c21c6;};'use strict';var _=require(_0x9126('0x0'));var util=require('util');var moment=require(_0x9126('0x1'));var BPromise=require(_0x9126('0x2'));var rs=require(_0x9126('0x3'));var fs=require('fs');var Redis=require(_0x9126('0x4'));var db=require(_0x9126('0x5'))['db'];var utils=require(_0x9126('0x6'));var logger=require(_0x9126('0x7'))(_0x9126('0x8'));var config=require(_0x9126('0x9'));var jayson=require(_0x9126('0xa'));var client=jayson[_0x9126('0xb')][_0x9126('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5604f9,_0x30b134,_0x23ec8e){return new BPromise(function(_0x3cc39b,_0x451a1d){return client[_0x9126('0xd')](_0x5604f9,_0x23ec8e)[_0x9126('0xe')](function(_0x552ef8){logger[_0x9126('0xf')](_0x9126('0x10'),_0x30b134,_0x9126('0x11'));logger[_0x9126('0x12')](_0x9126('0x13'),_0x30b134,_0x9126('0x11'),JSON['stringify'](_0x552ef8));if(_0x552ef8['error']){if(_0x552ef8[_0x9126('0x14')]['code']===0x1f4){logger[_0x9126('0x14')]('MailServerIn,\x20%s,\x20%s',_0x30b134,_0x552ef8['error'][_0x9126('0x15')]);return _0x451a1d(_0x552ef8[_0x9126('0x14')][_0x9126('0x15')]);}logger[_0x9126('0x14')](_0x9126('0x10'),_0x30b134,_0x552ef8[_0x9126('0x14')][_0x9126('0x15')]);return _0x3cc39b(_0x552ef8['error'][_0x9126('0x15')]);}else{logger[_0x9126('0xf')](_0x9126('0x10'),_0x30b134,'request\x20sent');_0x3cc39b(_0x552ef8[_0x9126('0x16')][_0x9126('0x15')]);}})[_0x9126('0x17')](function(_0x220ccd){logger['error'](_0x9126('0x10'),_0x30b134,_0x220ccd);_0x451a1d(_0x220ccd);});});}exports['GetMailServerIn']=function(_0x4639c9){var _0x2c0067=this;return new Promise(function(_0x5b8f3d,_0x208569){return db[_0x9126('0x18')]['findAll']({'raw':_0x4639c9['options']?_0x4639c9[_0x9126('0x19')][_0x9126('0x1a')]===undefined?!![]:![]:!![],'where':_0x4639c9[_0x9126('0x19')]?_0x4639c9['options'][_0x9126('0x1b')]||null:null,'attributes':_0x4639c9[_0x9126('0x19')]?_0x4639c9['options'][_0x9126('0x1c')]||null:null,'limit':_0x4639c9[_0x9126('0x19')]?_0x4639c9[_0x9126('0x19')]['limit']||null:null,'include':_0x4639c9[_0x9126('0x19')]?_0x4639c9[_0x9126('0x19')][_0x9126('0x1d')]?_[_0x9126('0x1e')](_0x4639c9[_0x9126('0x19')]['include'],function(_0xacbcd1){return{'model':db[_0xacbcd1[_0x9126('0x1f')]],'as':_0xacbcd1['as'],'attributes':_0xacbcd1[_0x9126('0x1c')],'include':_0xacbcd1[_0x9126('0x1d')]?_[_0x9126('0x1e')](_0xacbcd1[_0x9126('0x1d')],function(_0x5b0e0b){return{'model':db[_0x5b0e0b[_0x9126('0x1f')]],'as':_0x5b0e0b['as'],'attributes':_0x5b0e0b[_0x9126('0x1c')],'include':_0x5b0e0b[_0x9126('0x1d')]?_[_0x9126('0x1e')](_0x5b0e0b[_0x9126('0x1d')],function(_0x3aa5f7){return{'model':db[_0x3aa5f7[_0x9126('0x1f')]],'as':_0x3aa5f7['as'],'attributes':_0x3aa5f7[_0x9126('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9126('0xe')](function(_0xa0ede9){logger[_0x9126('0xf')](_0x9126('0x20'),_0x4639c9);logger['debug']('GetMailServerIn',_0x4639c9,JSON[_0x9126('0x21')](_0xa0ede9));_0x5b8f3d(_0xa0ede9);})[_0x9126('0x17')](function(_0x4a6e82){logger[_0x9126('0x14')](_0x9126('0x20'),_0x4a6e82[_0x9126('0x15')],_0x4639c9);_0x208569(_0x2c0067[_0x9126('0x14')](0x1f4,_0x4a6e82['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 01d1bc5..f7c5052 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 _0xd6c3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','show','create','put','exports','multer','path','connect-timeout'];(function(_0xe19894,_0xeb8230){var _0x1cf68c=function(_0x2d8aee){while(--_0x2d8aee){_0xe19894['push'](_0xe19894['shift']());}};_0x1cf68c(++_0xeb8230);}(_0xd6c3,0x16d));var _0x3d6c=function(_0x4eac02,_0x9703db){_0x4eac02=_0x4eac02-0x0;var _0x579c3a=_0xd6c3[_0x4eac02];return _0x579c3a;};'use strict';var multer=require(_0x3d6c('0x0'));var util=require('util');var path=require(_0x3d6c('0x1'));var timeout=require(_0x3d6c('0x2'));var express=require(_0x3d6c('0x3'));var router=express[_0x3d6c('0x4')]();var auth=require(_0x3d6c('0x5'));var interaction=require(_0x3d6c('0x6'));var config=require(_0x3d6c('0x7'));var controller=require(_0x3d6c('0x8'));router[_0x3d6c('0x9')]('/',auth[_0x3d6c('0xa')](),controller['index']);router[_0x3d6c('0x9')](_0x3d6c('0xb'),auth[_0x3d6c('0xa')](),controller[_0x3d6c('0xc')]);router['post']('/',auth[_0x3d6c('0xa')](),controller[_0x3d6c('0xd')]);router[_0x3d6c('0xe')](_0x3d6c('0xb'),auth[_0x3d6c('0xa')](),controller['update']);router['delete'](_0x3d6c('0xb'),auth[_0x3d6c('0xa')](),controller['destroy']);module[_0x3d6c('0xf')]=router; \ No newline at end of file +var _0xe708=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x383b77,_0xf87faf){var _0x1b2504=function(_0x2a0803){while(--_0x2a0803){_0x383b77['push'](_0x383b77['shift']());}};_0x1b2504(++_0xf87faf);}(_0xe708,0x1dd));var _0x8e70=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xe708[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x8e70('0x0'));var util=require(_0x8e70('0x1'));var path=require('path');var timeout=require(_0x8e70('0x2'));var express=require(_0x8e70('0x3'));var router=express[_0x8e70('0x4')]();var auth=require(_0x8e70('0x5'));var interaction=require(_0x8e70('0x6'));var config=require(_0x8e70('0x7'));var controller=require('./mailServerOut.controller');router[_0x8e70('0x8')]('/',auth[_0x8e70('0x9')](),controller[_0x8e70('0xa')]);router[_0x8e70('0x8')](_0x8e70('0xb'),auth[_0x8e70('0x9')](),controller[_0x8e70('0xc')]);router['post']('/',auth[_0x8e70('0x9')](),controller[_0x8e70('0xd')]);router[_0x8e70('0xe')]('/:id',auth[_0x8e70('0x9')](),controller[_0x8e70('0xf')]);router[_0x8e70('0x10')](_0x8e70('0xb'),auth[_0x8e70('0x9')](),controller[_0x8e70('0x11')]);module[_0x8e70('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 58dedc1..84793ed 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 _0x323f=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x12c5c1,_0x46a54a){var _0x46e346=function(_0x58d949){while(--_0x58d949){_0x12c5c1['push'](_0x12c5c1['shift']());}};_0x46e346(++_0x46a54a);}(_0x323f,0x1ee));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xf323('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf323('0x1')]},'user':{'type':Sequelize[_0xf323('0x1')]},'pass':{'type':Sequelize[_0xf323('0x1')]},'port':{'type':Sequelize[_0xf323('0x2')]},'secure':{'type':Sequelize[_0xf323('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf323('0x1')]},'authentication':{'type':Sequelize[_0xf323('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x01db=['sequelize','STRING','BOOLEAN'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x01db,0x171));var _0xb01d=function(_0x502a21,_0x2c973f){_0x502a21=_0x502a21-0x0;var _0x5d5849=_0x01db[_0x502a21];return _0x5d5849;};'use strict';var Sequelize=require(_0xb01d('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb01d('0x1')]},'user':{'type':Sequelize[_0xb01d('0x1')]},'pass':{'type':Sequelize[_0xb01d('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb01d('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 87dd14e..a59ebb9 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 _0x9d86=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9d86,0x11a));var _0x69d8=function(_0x14b6ba,_0x169741){_0x14b6ba=_0x14b6ba-0x0;var _0x46fa70=_0x9d86[_0x14b6ba];return _0x46fa70;};'use strict';var pdf=require(_0x69d8('0x0'));var emlformat=require(_0x69d8('0x1'));var rimraf=require(_0x69d8('0x2'));var zipdir=require(_0x69d8('0x3'));var jsonpatch=require(_0x69d8('0x4'));var rp=require(_0x69d8('0x5'));var moment=require(_0x69d8('0x6'));var BPromise=require(_0x69d8('0x7'));var Mustache=require(_0x69d8('0x8'));var util=require(_0x69d8('0x9'));var path=require('path');var sox=require(_0x69d8('0xa'));var csv=require(_0x69d8('0xb'));var ejs=require(_0x69d8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x69d8('0xd'));var crypto=require(_0x69d8('0xe'));var jsforce=require(_0x69d8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x69d8('0xb'));var querystring=require(_0x69d8('0x10'));var Papa=require(_0x69d8('0x11'));var Redis=require(_0x69d8('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x69d8('0x13'));var hardwareService=require(_0x69d8('0x14'));var logger=require('../../config/logger')(_0x69d8('0x15'));var utils=require(_0x69d8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x69d8('0x17'));var db=require(_0x69d8('0x18'))['db'];function respondWithStatusCode(_0x7c78ab,_0xc01e4b){_0xc01e4b=_0xc01e4b||0xcc;return function(_0x3558e7){if(_0x3558e7){return _0x7c78ab['sendStatus'](_0xc01e4b);}return _0x7c78ab[_0x69d8('0x19')](_0xc01e4b)['end']();};}function respondWithResult(_0x435406,_0x19068e){_0x19068e=_0x19068e||0xc8;return function(_0x5a88de){if(_0x5a88de){return _0x435406['status'](_0x19068e)['json'](_0x5a88de);}};}function respondWithFilteredResult(_0x5eef75,_0x4abbfe){return function(_0x3d763a){if(_0x3d763a){var _0x2722d6=_0x3d763a[_0x69d8('0x1a')],_0x20dcf0=_0x4abbfe['offset'],_0x215029=_0x4abbfe[_0x69d8('0x1b')]+_0x4abbfe[_0x69d8('0x1c')],_0xaaf198;if(_0x215029>=_0x2722d6){_0x215029=_0x2722d6;_0xaaf198=0xc8;}else{_0xaaf198=0xce;}_0x5eef75[_0x69d8('0x19')](_0xaaf198);return _0x5eef75[_0x69d8('0x1d')](_0x69d8('0x1e'),_0x20dcf0+'-'+_0x215029+'/'+_0x2722d6)[_0x69d8('0x1f')](_0x3d763a);}return null;};}function patchUpdates(_0x1db984){return function(_0x54e04c){try{jsonpatch[_0x69d8('0x20')](_0x54e04c,_0x1db984,!![]);}catch(_0x4d26c7){return BPromise[_0x69d8('0x21')](_0x4d26c7);}return _0x54e04c[_0x69d8('0x22')]();};}function saveUpdates(_0x39b8e3,_0x4f693d){return function(_0x428fbf){if(_0x428fbf){return _0x428fbf[_0x69d8('0x23')](_0x39b8e3)['then'](function(_0x2cc0b0){return _0x2cc0b0;});}return null;};}function removeEntity(_0xd2ca64,_0x463e16){return function(_0x21f271){if(_0x21f271){return _0x21f271[_0x69d8('0x24')]()[_0x69d8('0x25')](function(){_0xd2ca64[_0x69d8('0x19')](0xcc)[_0x69d8('0x26')]();});}};}function handleEntityNotFound(_0x30b651,_0x216826){return function(_0x4678dd){if(!_0x4678dd){_0x30b651['sendStatus'](0x194);}return _0x4678dd;};}function handleError(_0x4802aa,_0x4988d0){_0x4988d0=_0x4988d0||0x1f4;return function(_0x428c30){logger[_0x69d8('0x27')](_0x428c30[_0x69d8('0x28')]);if(_0x428c30[_0x69d8('0x29')]){delete _0x428c30[_0x69d8('0x29')];}_0x4802aa['status'](_0x4988d0)['send'](_0x428c30);};}exports[_0x69d8('0x2a')]=function(_0x294343,_0x39f156){var _0x4d8e14={},_0x4bed72={},_0x4cd9ed={'count':0x0,'rows':[]};var _0x1a9130=_[_0x69d8('0x2b')](db[_0x69d8('0x2c')][_0x69d8('0x2d')],function(_0x30e4f2){return{'name':_0x30e4f2[_0x69d8('0x2e')],'type':_0x30e4f2[_0x69d8('0x2f')][_0x69d8('0x30')]};});_0x4bed72[_0x69d8('0x31')]=_[_0x69d8('0x2b')](_0x1a9130,_0x69d8('0x29'));_0x4bed72[_0x69d8('0x32')]=_[_0x69d8('0x33')](_0x294343[_0x69d8('0x32')]);_0x4bed72[_0x69d8('0x34')]=_['intersection'](_0x4bed72['model'],_0x4bed72[_0x69d8('0x32')]);_0x4d8e14[_0x69d8('0x35')]=_[_0x69d8('0x36')](_0x4bed72[_0x69d8('0x31')],qs['fields'](_0x294343[_0x69d8('0x32')][_0x69d8('0x37')]));_0x4d8e14[_0x69d8('0x35')]=_0x4d8e14[_0x69d8('0x35')][_0x69d8('0x38')]?_0x4d8e14[_0x69d8('0x35')]:_0x4bed72[_0x69d8('0x31')];if(!_0x294343[_0x69d8('0x32')][_0x69d8('0x39')](_0x69d8('0x3a'))){_0x4d8e14[_0x69d8('0x1c')]=qs[_0x69d8('0x1c')](_0x294343[_0x69d8('0x32')][_0x69d8('0x1c')]);_0x4d8e14['offset']=qs[_0x69d8('0x1b')](_0x294343[_0x69d8('0x32')][_0x69d8('0x1b')]);}_0x4d8e14[_0x69d8('0x3b')]=qs[_0x69d8('0x3c')](_0x294343[_0x69d8('0x32')][_0x69d8('0x3c')]);_0x4d8e14[_0x69d8('0x3d')]=qs['filters'](_[_0x69d8('0x3e')](_0x294343[_0x69d8('0x32')],_0x4bed72[_0x69d8('0x34')]),_0x1a9130);if(_0x294343[_0x69d8('0x32')][_0x69d8('0x3f')]){_0x4d8e14['where']=_[_0x69d8('0x40')](_0x4d8e14[_0x69d8('0x3d')],{'$or':_[_0x69d8('0x2b')](_0x1a9130,function(_0x49cc4c){if(_0x49cc4c[_0x69d8('0x2f')]!=='VIRTUAL'){var _0x1e9dc5={};_0x1e9dc5[_0x49cc4c[_0x69d8('0x29')]]={'$like':'%'+_0x294343[_0x69d8('0x32')][_0x69d8('0x3f')]+'%'};return _0x1e9dc5;}})});}_0x4d8e14=_[_0x69d8('0x40')]({},_0x4d8e14,_0x294343['options']);var _0x411a0e={'where':_0x4d8e14[_0x69d8('0x3d')]};return db[_0x69d8('0x2c')][_0x69d8('0x1a')](_0x411a0e)[_0x69d8('0x25')](function(_0x2057a0){_0x4cd9ed[_0x69d8('0x1a')]=_0x2057a0;if(_0x294343['query'][_0x69d8('0x41')]){_0x4d8e14[_0x69d8('0x42')]=[{'all':!![]}];}return db[_0x69d8('0x2c')][_0x69d8('0x43')](_0x4d8e14);})[_0x69d8('0x25')](function(_0x5cb009){_0x4cd9ed[_0x69d8('0x44')]=_0x5cb009;return _0x4cd9ed;})[_0x69d8('0x25')](respondWithFilteredResult(_0x39f156,_0x4d8e14))[_0x69d8('0x45')](handleError(_0x39f156,null));};exports['show']=function(_0x7873ce,_0x4d28f3){var _0x42a26c={'raw':!![],'where':{'id':_0x7873ce['params']['id']}},_0x5f452a={};_0x5f452a['model']=_[_0x69d8('0x33')](db[_0x69d8('0x2c')]['rawAttributes']);_0x5f452a['query']=_[_0x69d8('0x33')](_0x7873ce['query']);_0x5f452a[_0x69d8('0x34')]=_[_0x69d8('0x36')](_0x5f452a[_0x69d8('0x31')],_0x5f452a['query']);_0x42a26c[_0x69d8('0x35')]=_[_0x69d8('0x36')](_0x5f452a[_0x69d8('0x31')],qs[_0x69d8('0x37')](_0x7873ce[_0x69d8('0x32')][_0x69d8('0x37')]));_0x42a26c['attributes']=_0x42a26c[_0x69d8('0x35')][_0x69d8('0x38')]?_0x42a26c[_0x69d8('0x35')]:_0x5f452a[_0x69d8('0x31')];if(_0x7873ce[_0x69d8('0x32')][_0x69d8('0x41')]){_0x42a26c['include']=[{'all':!![]}];}_0x42a26c=_[_0x69d8('0x40')]({},_0x42a26c,_0x7873ce['options']);return db[_0x69d8('0x2c')][_0x69d8('0x46')](_0x42a26c)[_0x69d8('0x25')](handleEntityNotFound(_0x4d28f3,null))['then'](respondWithResult(_0x4d28f3,null))[_0x69d8('0x45')](handleError(_0x4d28f3,null));};exports['create']=function(_0x3eda36,_0x280993){return db[_0x69d8('0x2c')][_0x69d8('0x47')](_0x3eda36[_0x69d8('0x48')],{})[_0x69d8('0x25')](respondWithResult(_0x280993,0xc9))[_0x69d8('0x45')](handleError(_0x280993,null));};exports[_0x69d8('0x23')]=function(_0x3bbbc3,_0x29611b){if(_0x3bbbc3['body']['id']){delete _0x3bbbc3['body']['id'];}return db[_0x69d8('0x2c')][_0x69d8('0x46')]({'where':{'id':_0x3bbbc3[_0x69d8('0x49')]['id']}})[_0x69d8('0x25')](handleEntityNotFound(_0x29611b,null))['then'](saveUpdates(_0x3bbbc3[_0x69d8('0x48')],null))[_0x69d8('0x25')](respondWithResult(_0x29611b,null))[_0x69d8('0x45')](handleError(_0x29611b,null));};exports['destroy']=function(_0x2ed39b,_0x48c9b0){return db['MailServerOut'][_0x69d8('0x46')]({'where':{'id':_0x2ed39b[_0x69d8('0x49')]['id']}})[_0x69d8('0x25')](handleEntityNotFound(_0x48c9b0,null))[_0x69d8('0x25')](removeEntity(_0x48c9b0,null))[_0x69d8('0x45')](handleError(_0x48c9b0,null));}; \ No newline at end of file +var _0x5e6d=['status','json','count','offset','limit','apply','save','then','destroy','error','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','map','keys','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','update','params','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x5e6d,0xbf));var _0xd5e6=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x5e6d[_0x4ae6ef];return _0x3cbb4e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd5e6('0x0'));var rimraf=require(_0xd5e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e6('0x2'));var moment=require(_0xd5e6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd5e6('0x4'));var path=require(_0xd5e6('0x5'));var sox=require(_0xd5e6('0x6'));var csv=require(_0xd5e6('0x7'));var ejs=require(_0xd5e6('0x8'));var fs=require('fs');var _=require(_0xd5e6('0x9'));var squel=require('squel');var crypto=require(_0xd5e6('0xa'));var jsforce=require(_0xd5e6('0xb'));var deskjs=require(_0xd5e6('0xc'));var toCsv=require(_0xd5e6('0x7'));var querystring=require(_0xd5e6('0xd'));var Papa=require('papaparse');var Redis=require(_0xd5e6('0xe'));var authService=require(_0xd5e6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5e6('0x10'));var hardwareService=require(_0xd5e6('0x11'));var logger=require('../../config/logger')(_0xd5e6('0x12'));var utils=require(_0xd5e6('0x13'));var config=require(_0xd5e6('0x14'));var licenseUtil=require(_0xd5e6('0x15'));var db=require(_0xd5e6('0x16'))['db'];function respondWithStatusCode(_0x5d8e47,_0x19bcf4){_0x19bcf4=_0x19bcf4||0xcc;return function(_0xe9efcc){if(_0xe9efcc){return _0x5d8e47[_0xd5e6('0x17')](_0x19bcf4);}return _0x5d8e47['status'](_0x19bcf4)[_0xd5e6('0x18')]();};}function respondWithResult(_0x48d074,_0x540bc5){_0x540bc5=_0x540bc5||0xc8;return function(_0x57ff62){if(_0x57ff62){return _0x48d074[_0xd5e6('0x19')](_0x540bc5)[_0xd5e6('0x1a')](_0x57ff62);}};}function respondWithFilteredResult(_0x48ebec,_0x421660){return function(_0x529c7c){if(_0x529c7c){var _0x3c472b=_0x529c7c[_0xd5e6('0x1b')],_0x5b6870=_0x421660[_0xd5e6('0x1c')],_0x4d4753=_0x421660['offset']+_0x421660[_0xd5e6('0x1d')],_0x13756a;if(_0x4d4753>=_0x3c472b){_0x4d4753=_0x3c472b;_0x13756a=0xc8;}else{_0x13756a=0xce;}_0x48ebec[_0xd5e6('0x19')](_0x13756a);return _0x48ebec['set']('Content-Range',_0x5b6870+'-'+_0x4d4753+'/'+_0x3c472b)['json'](_0x529c7c);}return null;};}function patchUpdates(_0x2b6e49){return function(_0x2c8cdc){try{jsonpatch[_0xd5e6('0x1e')](_0x2c8cdc,_0x2b6e49,!![]);}catch(_0x3e2e50){return BPromise['reject'](_0x3e2e50);}return _0x2c8cdc[_0xd5e6('0x1f')]();};}function saveUpdates(_0x4e7a0a,_0x12e7d8){return function(_0x557ed6){if(_0x557ed6){return _0x557ed6['update'](_0x4e7a0a)[_0xd5e6('0x20')](function(_0x21bd15){return _0x21bd15;});}return null;};}function removeEntity(_0x5579dc,_0x148aab){return function(_0x2aed9d){if(_0x2aed9d){return _0x2aed9d[_0xd5e6('0x21')]()[_0xd5e6('0x20')](function(){_0x5579dc[_0xd5e6('0x19')](0xcc)[_0xd5e6('0x18')]();});}};}function handleEntityNotFound(_0x93e02,_0x55d454){return function(_0x565994){if(!_0x565994){_0x93e02[_0xd5e6('0x17')](0x194);}return _0x565994;};}function handleError(_0x47e025,_0x99ace5){_0x99ace5=_0x99ace5||0x1f4;return function(_0x463ce1){logger[_0xd5e6('0x22')](_0x463ce1['stack']);if(_0x463ce1[_0xd5e6('0x23')]){delete _0x463ce1[_0xd5e6('0x23')];}_0x47e025[_0xd5e6('0x19')](_0x99ace5)[_0xd5e6('0x24')](_0x463ce1);};}exports[_0xd5e6('0x25')]=function(_0x2f6199,_0x3203e8){var _0x4e0fc0={},_0x340e80={},_0x20f194={'count':0x0,'rows':[]};var _0x29ebbc=_['map'](db[_0xd5e6('0x26')][_0xd5e6('0x27')],function(_0x58defc){return{'name':_0x58defc[_0xd5e6('0x28')],'type':_0x58defc[_0xd5e6('0x29')][_0xd5e6('0x2a')]};});_0x340e80['model']=_[_0xd5e6('0x2b')](_0x29ebbc,_0xd5e6('0x23'));_0x340e80['query']=_[_0xd5e6('0x2c')](_0x2f6199['query']);_0x340e80[_0xd5e6('0x2d')]=_['intersection'](_0x340e80['model'],_0x340e80[_0xd5e6('0x2e')]);_0x4e0fc0['attributes']=_[_0xd5e6('0x2f')](_0x340e80[_0xd5e6('0x30')],qs[_0xd5e6('0x31')](_0x2f6199[_0xd5e6('0x2e')][_0xd5e6('0x31')]));_0x4e0fc0[_0xd5e6('0x32')]=_0x4e0fc0[_0xd5e6('0x32')][_0xd5e6('0x33')]?_0x4e0fc0[_0xd5e6('0x32')]:_0x340e80[_0xd5e6('0x30')];if(!_0x2f6199[_0xd5e6('0x2e')][_0xd5e6('0x34')](_0xd5e6('0x35'))){_0x4e0fc0['limit']=qs[_0xd5e6('0x1d')](_0x2f6199[_0xd5e6('0x2e')][_0xd5e6('0x1d')]);_0x4e0fc0[_0xd5e6('0x1c')]=qs[_0xd5e6('0x1c')](_0x2f6199[_0xd5e6('0x2e')][_0xd5e6('0x1c')]);}_0x4e0fc0[_0xd5e6('0x36')]=qs[_0xd5e6('0x37')](_0x2f6199[_0xd5e6('0x2e')]['sort']);_0x4e0fc0[_0xd5e6('0x38')]=qs[_0xd5e6('0x2d')](_['pick'](_0x2f6199[_0xd5e6('0x2e')],_0x340e80[_0xd5e6('0x2d')]),_0x29ebbc);if(_0x2f6199[_0xd5e6('0x2e')][_0xd5e6('0x39')]){_0x4e0fc0[_0xd5e6('0x38')]=_[_0xd5e6('0x3a')](_0x4e0fc0[_0xd5e6('0x38')],{'$or':_[_0xd5e6('0x2b')](_0x29ebbc,function(_0x12d176){if(_0x12d176[_0xd5e6('0x29')]!==_0xd5e6('0x3b')){var _0x51d359={};_0x51d359[_0x12d176['name']]={'$like':'%'+_0x2f6199['query'][_0xd5e6('0x39')]+'%'};return _0x51d359;}})});}_0x4e0fc0=_[_0xd5e6('0x3a')]({},_0x4e0fc0,_0x2f6199[_0xd5e6('0x3c')]);var _0x496895={'where':_0x4e0fc0[_0xd5e6('0x38')]};return db[_0xd5e6('0x26')]['count'](_0x496895)[_0xd5e6('0x20')](function(_0x299959){_0x20f194[_0xd5e6('0x1b')]=_0x299959;if(_0x2f6199[_0xd5e6('0x2e')][_0xd5e6('0x3d')]){_0x4e0fc0[_0xd5e6('0x3e')]=[{'all':!![]}];}return db[_0xd5e6('0x26')][_0xd5e6('0x3f')](_0x4e0fc0);})[_0xd5e6('0x20')](function(_0x55004d){_0x20f194[_0xd5e6('0x40')]=_0x55004d;return _0x20f194;})[_0xd5e6('0x20')](respondWithFilteredResult(_0x3203e8,_0x4e0fc0))['catch'](handleError(_0x3203e8,null));};exports[_0xd5e6('0x41')]=function(_0x28179d,_0x3b77){var _0x21c786={'raw':!![],'where':{'id':_0x28179d['params']['id']}},_0x5c0717={};_0x5c0717[_0xd5e6('0x30')]=_[_0xd5e6('0x2c')](db[_0xd5e6('0x26')]['rawAttributes']);_0x5c0717[_0xd5e6('0x2e')]=_[_0xd5e6('0x2c')](_0x28179d[_0xd5e6('0x2e')]);_0x5c0717[_0xd5e6('0x2d')]=_[_0xd5e6('0x2f')](_0x5c0717[_0xd5e6('0x30')],_0x5c0717[_0xd5e6('0x2e')]);_0x21c786[_0xd5e6('0x32')]=_[_0xd5e6('0x2f')](_0x5c0717['model'],qs['fields'](_0x28179d[_0xd5e6('0x2e')]['fields']));_0x21c786[_0xd5e6('0x32')]=_0x21c786[_0xd5e6('0x32')]['length']?_0x21c786[_0xd5e6('0x32')]:_0x5c0717[_0xd5e6('0x30')];if(_0x28179d[_0xd5e6('0x2e')][_0xd5e6('0x3d')]){_0x21c786[_0xd5e6('0x3e')]=[{'all':!![]}];}_0x21c786=_['merge']({},_0x21c786,_0x28179d[_0xd5e6('0x3c')]);return db[_0xd5e6('0x26')][_0xd5e6('0x42')](_0x21c786)[_0xd5e6('0x20')](handleEntityNotFound(_0x3b77,null))[_0xd5e6('0x20')](respondWithResult(_0x3b77,null))['catch'](handleError(_0x3b77,null));};exports[_0xd5e6('0x43')]=function(_0x546148,_0x1a9d02){return db[_0xd5e6('0x26')][_0xd5e6('0x43')](_0x546148[_0xd5e6('0x44')],{})['then'](respondWithResult(_0x1a9d02,0xc9))[_0xd5e6('0x45')](handleError(_0x1a9d02,null));};exports[_0xd5e6('0x46')]=function(_0x59879c,_0x2172bd){if(_0x59879c[_0xd5e6('0x44')]['id']){delete _0x59879c[_0xd5e6('0x44')]['id'];}return db[_0xd5e6('0x26')][_0xd5e6('0x42')]({'where':{'id':_0x59879c[_0xd5e6('0x47')]['id']}})[_0xd5e6('0x20')](handleEntityNotFound(_0x2172bd,null))[_0xd5e6('0x20')](saveUpdates(_0x59879c[_0xd5e6('0x44')],null))[_0xd5e6('0x20')](respondWithResult(_0x2172bd,null))[_0xd5e6('0x45')](handleError(_0x2172bd,null));};exports['destroy']=function(_0x282d65,_0x6d28ee){return db[_0xd5e6('0x26')][_0xd5e6('0x42')]({'where':{'id':_0x282d65[_0xd5e6('0x47')]['id']}})[_0xd5e6('0x20')](handleEntityNotFound(_0x6d28ee,null))[_0xd5e6('0x20')](removeEntity(_0x6d28ee,null))[_0xd5e6('0x45')](handleError(_0x6d28ee,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f93c594..9f493fb 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util'];(function(_0x96c1ec,_0x112bf5){var _0x29af13=function(_0x4cce1a){while(--_0x4cce1a){_0x96c1ec['push'](_0x96c1ec['shift']());}};_0x29af13(++_0x112bf5);}(_0x5fab,0x177));var _0xb5fa=function(_0x3559c4,_0x47580b){_0x3559c4=_0x3559c4-0x0;var _0x124053=_0x5fab[_0x3559c4];return _0x124053;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','mail_servers_out','lodash'];(function(_0x1f478e,_0x14a546){var _0x5dc6b3=function(_0x2d68e9){while(--_0x2d68e9){_0x1f478e['push'](_0x1f478e['shift']());}};_0x5dc6b3(++_0x14a546);}(_0xabce,0x103));var _0xeabc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xabce[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('MailServerOut',attributes,{'tableName':_0xeabc('0x9'),'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 accc41a..c4940f0 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 _0x2153=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x4b1df4,_0xb31a4a){var _0x54a49d=function(_0x206192){while(--_0x206192){_0x4b1df4['push'](_0x4b1df4['shift']());}};_0x54a49d(++_0xb31a4a);}(_0x2153,0x111));var _0x3215=function(_0x4eae13,_0xe4a006){_0x4eae13=_0x4eae13-0x0;var _0x50900d=_0x2153[_0x4eae13];return _0x50900d;};'use strict';var _=require(_0x3215('0x0'));var util=require(_0x3215('0x1'));var moment=require(_0x3215('0x2'));var BPromise=require('bluebird');var rs=require(_0x3215('0x3'));var fs=require('fs');var Redis=require(_0x3215('0x4'));var db=require(_0x3215('0x5'))['db'];var utils=require(_0x3215('0x6'));var logger=require(_0x3215('0x7'))(_0x3215('0x8'));var config=require(_0x3215('0x9'));var jayson=require(_0x3215('0xa'));var client=jayson[_0x3215('0xb')][_0x3215('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d4b14,_0x47cae6,_0x1dc3c2){return new BPromise(function(_0x572f43,_0xce85db){return client[_0x3215('0xd')](_0x1d4b14,_0x1dc3c2)[_0x3215('0xe')](function(_0x3037a2){logger[_0x3215('0xf')]('MailServerOut,\x20%s,\x20%s',_0x47cae6,_0x3215('0x10'));logger[_0x3215('0x11')](_0x3215('0x12'),_0x47cae6,_0x3215('0x10'),JSON[_0x3215('0x13')](_0x3037a2));if(_0x3037a2[_0x3215('0x14')]){if(_0x3037a2[_0x3215('0x14')][_0x3215('0x15')]===0x1f4){logger[_0x3215('0x14')](_0x3215('0x16'),_0x47cae6,_0x3037a2[_0x3215('0x14')]['message']);return _0xce85db(_0x3037a2[_0x3215('0x14')][_0x3215('0x17')]);}logger[_0x3215('0x14')](_0x3215('0x16'),_0x47cae6,_0x3037a2[_0x3215('0x14')][_0x3215('0x17')]);return _0x572f43(_0x3037a2['error'][_0x3215('0x17')]);}else{logger[_0x3215('0xf')](_0x3215('0x16'),_0x47cae6,_0x3215('0x10'));_0x572f43(_0x3037a2[_0x3215('0x18')][_0x3215('0x17')]);}})['catch'](function(_0x5dd09d){logger['error']('MailServerOut,\x20%s,\x20%s',_0x47cae6,_0x5dd09d);_0xce85db(_0x5dd09d);});});} \ No newline at end of file +var _0x7de0=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3877cc,_0x25db37){var _0xb788e5=function(_0x39eafa){while(--_0x39eafa){_0x3877cc['push'](_0x3877cc['shift']());}};_0xb788e5(++_0x25db37);}(_0x7de0,0xb1));var _0x07de=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7de0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x07de('0x0'));var util=require(_0x07de('0x1'));var moment=require(_0x07de('0x2'));var BPromise=require(_0x07de('0x3'));var rs=require(_0x07de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x07de('0x6'))('rpc');var config=require(_0x07de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x07de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d62df,_0x8f1cf,_0x12d393){return new BPromise(function(_0x3fcf5d,_0x280000){return client[_0x07de('0x9')](_0x4d62df,_0x12d393)[_0x07de('0xa')](function(_0x1f1816){logger[_0x07de('0xb')](_0x07de('0xc'),_0x8f1cf,'request\x20sent');logger[_0x07de('0xd')](_0x07de('0xe'),_0x8f1cf,_0x07de('0xf'),JSON[_0x07de('0x10')](_0x1f1816));if(_0x1f1816[_0x07de('0x11')]){if(_0x1f1816['error'][_0x07de('0x12')]===0x1f4){logger[_0x07de('0x11')](_0x07de('0xc'),_0x8f1cf,_0x1f1816[_0x07de('0x11')][_0x07de('0x13')]);return _0x280000(_0x1f1816[_0x07de('0x11')]['message']);}logger[_0x07de('0x11')](_0x07de('0xc'),_0x8f1cf,_0x1f1816[_0x07de('0x11')][_0x07de('0x13')]);return _0x3fcf5d(_0x1f1816[_0x07de('0x11')]['message']);}else{logger[_0x07de('0xb')](_0x07de('0xc'),_0x8f1cf,_0x07de('0xf'));_0x3fcf5d(_0x1f1816[_0x07de('0x14')][_0x07de('0x13')]);}})[_0x07de('0x15')](function(_0x58a1cd){logger[_0x07de('0x11')](_0x07de('0xc'),_0x8f1cf,_0x58a1cd);_0x280000(_0x58a1cd);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2a77524..bcb2fb6 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 _0x913f=['/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','create','put'];(function(_0x37ab82,_0x4c0156){var _0x558074=function(_0x1c49a8){while(--_0x1c49a8){_0x37ab82['push'](_0x37ab82['shift']());}};_0x558074(++_0x4c0156);}(_0x913f,0x6e));var _0xf913=function(_0x58c3e6,_0x54ed99){_0x58c3e6=_0x58c3e6-0x0;var _0x1c0f96=_0x913f[_0x58c3e6];return _0x1c0f96;};'use strict';var multer=require(_0xf913('0x0'));var util=require('util');var path=require(_0xf913('0x1'));var timeout=require('connect-timeout');var express=require(_0xf913('0x2'));var router=express[_0xf913('0x3')]();var auth=require(_0xf913('0x4'));var interaction=require(_0xf913('0x5'));var config=require(_0xf913('0x6'));var controller=require(_0xf913('0x7'));router[_0xf913('0x8')]('/',auth[_0xf913('0x9')](),controller[_0xf913('0xa')]);router[_0xf913('0x8')](_0xf913('0xb'),auth['isAuthenticated'](),controller[_0xf913('0xc')]);router[_0xf913('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf913('0xd')]);router['post']('/',auth[_0xf913('0x9')](),controller[_0xf913('0xe')]);router[_0xf913('0xf')](_0xf913('0x10'),auth['isAuthenticated'](),controller[_0xf913('0x11')]);router[_0xf913('0x12')](_0xf913('0x10'),auth[_0xf913('0x9')](),controller[_0xf913('0x13')]);module[_0xf913('0x14')]=router; \ No newline at end of file +var _0xdbdf=['index','get','describe','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated'];(function(_0xe50f2d,_0xd5a50a){var _0x4587a1=function(_0x4ee0fd){while(--_0x4ee0fd){_0xe50f2d['push'](_0xe50f2d['shift']());}};_0x4587a1(++_0xd5a50a);}(_0xdbdf,0x8f));var _0xfdbd=function(_0x2afaaf,_0x28a58c){_0x2afaaf=_0x2afaaf-0x0;var _0x5362ec=_0xdbdf[_0x2afaaf];return _0x5362ec;};'use strict';var multer=require('multer');var util=require(_0xfdbd('0x0'));var path=require(_0xfdbd('0x1'));var timeout=require(_0xfdbd('0x2'));var express=require(_0xfdbd('0x3'));var router=express[_0xfdbd('0x4')]();var auth=require(_0xfdbd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfdbd('0x6'));var controller=require(_0xfdbd('0x7'));router['get']('/',auth[_0xfdbd('0x8')](),controller[_0xfdbd('0x9')]);router[_0xfdbd('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xfdbd('0xb')]);router[_0xfdbd('0xa')](_0xfdbd('0xc'),auth[_0xfdbd('0x8')](),controller[_0xfdbd('0xd')]);router[_0xfdbd('0xe')]('/',auth[_0xfdbd('0x8')](),controller[_0xfdbd('0xf')]);router[_0xfdbd('0x10')](_0xfdbd('0xc'),auth[_0xfdbd('0x8')](),controller[_0xfdbd('0x11')]);router['delete'](_0xfdbd('0xc'),auth[_0xfdbd('0x8')](),controller[_0xfdbd('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 44570bb..7948cae 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 _0xa3eb=['STRING','sequelize','exports'];(function(_0x1d0a84,_0x5b74c0){var _0xc51c70=function(_0x36cabc){while(--_0x36cabc){_0x1d0a84['push'](_0x1d0a84['shift']());}};_0xc51c70(++_0x5b74c0);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xa3eb[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0xba3e('0x0'));module[_0xba3e('0x1')]={'name':{'type':Sequelize[_0xba3e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xba3e('0x2')]}}; \ No newline at end of file +var _0x202a=['exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xa202('0x0')]={'name':{'type':Sequelize[_0xa202('0x1')],'unique':_0xa202('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b339c33..f839984 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 _0x077f=['query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model'];(function(_0x382b16,_0x588254){var _0xcfa26f=function(_0x33a49f){while(--_0x33a49f){_0x382b16['push'](_0x382b16['shift']());}};_0xcfa26f(++_0x588254);}(_0x077f,0x100));var _0xf077=function(_0x2b13da,_0x45065d){_0x2b13da=_0x2b13da-0x0;var _0x254b84=_0x077f[_0x2b13da];return _0x254b84;};'use strict';var pdf=require(_0xf077('0x0'));var emlformat=require(_0xf077('0x1'));var rimraf=require(_0xf077('0x2'));var zipdir=require(_0xf077('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf077('0x4'));var moment=require(_0xf077('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf077('0x6'));var util=require(_0xf077('0x7'));var path=require(_0xf077('0x8'));var sox=require(_0xf077('0x9'));var csv=require(_0xf077('0xa'));var ejs=require(_0xf077('0xb'));var fs=require('fs');var _=require(_0xf077('0xc'));var squel=require('squel');var crypto=require(_0xf077('0xd'));var jsforce=require(_0xf077('0xe'));var deskjs=require(_0xf077('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf077('0x10'));var Papa=require(_0xf077('0x11'));var Redis=require('ioredis');var authService=require(_0xf077('0x12'));var qs=require(_0xf077('0x13'));var as=require(_0xf077('0x14'));var hardwareService=require(_0xf077('0x15'));var logger=require(_0xf077('0x16'))(_0xf077('0x17'));var utils=require(_0xf077('0x18'));var config=require(_0xf077('0x19'));var licenseUtil=require(_0xf077('0x1a'));var db=require(_0xf077('0x1b'))['db'];function respondWithStatusCode(_0x20faa1,_0x25ec48){_0x25ec48=_0x25ec48||0xcc;return function(_0x4ebc1d){if(_0x4ebc1d){return _0x20faa1[_0xf077('0x1c')](_0x25ec48);}return _0x20faa1[_0xf077('0x1d')](_0x25ec48)['end']();};}function respondWithResult(_0x273865,_0xa8c684){_0xa8c684=_0xa8c684||0xc8;return function(_0x47c493){if(_0x47c493){return _0x273865[_0xf077('0x1d')](_0xa8c684)[_0xf077('0x1e')](_0x47c493);}};}function respondWithFilteredResult(_0x3103b7,_0x273da2){return function(_0x2e9bf2){if(_0x2e9bf2){var _0x32af23=_0x2e9bf2[_0xf077('0x1f')],_0xa1410d=_0x273da2[_0xf077('0x20')],_0x3ff7d5=_0x273da2[_0xf077('0x20')]+_0x273da2[_0xf077('0x21')],_0x2216c5;if(_0x3ff7d5>=_0x32af23){_0x3ff7d5=_0x32af23;_0x2216c5=0xc8;}else{_0x2216c5=0xce;}_0x3103b7['status'](_0x2216c5);return _0x3103b7[_0xf077('0x22')]('Content-Range',_0xa1410d+'-'+_0x3ff7d5+'/'+_0x32af23)[_0xf077('0x1e')](_0x2e9bf2);}return null;};}function patchUpdates(_0x54487a){return function(_0x55432d){try{jsonpatch['apply'](_0x55432d,_0x54487a,!![]);}catch(_0x5435f4){return BPromise[_0xf077('0x23')](_0x5435f4);}return _0x55432d[_0xf077('0x24')]();};}function saveUpdates(_0x3f04bb,_0x4ab108){return function(_0x5272c4){if(_0x5272c4){return _0x5272c4[_0xf077('0x25')](_0x3f04bb)[_0xf077('0x26')](function(_0x459d90){return _0x459d90;});}return null;};}function removeEntity(_0x49a7bd,_0x229f44){return function(_0x20114d){if(_0x20114d){return _0x20114d[_0xf077('0x27')]()['then'](function(){_0x49a7bd[_0xf077('0x1d')](0xcc)[_0xf077('0x28')]();});}};}function handleEntityNotFound(_0x31fd73,_0x47e347){return function(_0xcc3fab){if(!_0xcc3fab){_0x31fd73[_0xf077('0x1c')](0x194);}return _0xcc3fab;};}function handleError(_0x6dc46d,_0x4af9e4){_0x4af9e4=_0x4af9e4||0x1f4;return function(_0x8071ec){logger[_0xf077('0x29')](_0x8071ec[_0xf077('0x2a')]);if(_0x8071ec['name']){delete _0x8071ec[_0xf077('0x2b')];}_0x6dc46d['status'](_0x4af9e4)[_0xf077('0x2c')](_0x8071ec);};}exports[_0xf077('0x2d')]=function(_0x1decf5,_0x359c58){var _0x1f4d03={},_0x25e196={},_0x389f5d={'count':0x0,'rows':[]};var _0x4f8447=_[_0xf077('0x2e')](db[_0xf077('0x2f')][_0xf077('0x30')],function(_0x3619ff){return{'name':_0x3619ff['fieldName'],'type':_0x3619ff[_0xf077('0x31')][_0xf077('0x32')]};});_0x25e196[_0xf077('0x33')]=_[_0xf077('0x2e')](_0x4f8447,'name');_0x25e196[_0xf077('0x34')]=_[_0xf077('0x35')](_0x1decf5[_0xf077('0x34')]);_0x25e196['filters']=_[_0xf077('0x36')](_0x25e196[_0xf077('0x33')],_0x25e196[_0xf077('0x34')]);_0x1f4d03['attributes']=_[_0xf077('0x36')](_0x25e196[_0xf077('0x33')],qs['fields'](_0x1decf5[_0xf077('0x34')][_0xf077('0x37')]));_0x1f4d03[_0xf077('0x38')]=_0x1f4d03[_0xf077('0x38')]['length']?_0x1f4d03[_0xf077('0x38')]:_0x25e196[_0xf077('0x33')];if(!_0x1decf5['query'][_0xf077('0x39')](_0xf077('0x3a'))){_0x1f4d03[_0xf077('0x21')]=qs[_0xf077('0x21')](_0x1decf5[_0xf077('0x34')][_0xf077('0x21')]);_0x1f4d03[_0xf077('0x20')]=qs[_0xf077('0x20')](_0x1decf5[_0xf077('0x34')][_0xf077('0x20')]);}_0x1f4d03['order']=qs[_0xf077('0x3b')](_0x1decf5[_0xf077('0x34')][_0xf077('0x3b')]);_0x1f4d03[_0xf077('0x3c')]=qs[_0xf077('0x3d')](_['pick'](_0x1decf5['query'],_0x25e196[_0xf077('0x3d')]),_0x4f8447);if(_0x1decf5['query'][_0xf077('0x3e')]){_0x1f4d03[_0xf077('0x3c')]=_[_0xf077('0x3f')](_0x1f4d03['where'],{'$or':_[_0xf077('0x2e')](_0x4f8447,function(_0x209a34){if(_0x209a34[_0xf077('0x31')]!==_0xf077('0x40')){var _0x575bc3={};_0x575bc3[_0x209a34[_0xf077('0x2b')]]={'$like':'%'+_0x1decf5[_0xf077('0x34')]['filter']+'%'};return _0x575bc3;}})});}_0x1f4d03=_[_0xf077('0x3f')]({},_0x1f4d03,_0x1decf5[_0xf077('0x41')]);var _0xa55f0a={'where':_0x1f4d03[_0xf077('0x3c')]};return db[_0xf077('0x2f')][_0xf077('0x1f')](_0xa55f0a)['then'](function(_0x8a78e8){_0x389f5d[_0xf077('0x1f')]=_0x8a78e8;if(_0x1decf5['query']['includeAll']){_0x1f4d03[_0xf077('0x42')]=[{'all':!![]}];}return db['MailSubstatus'][_0xf077('0x43')](_0x1f4d03);})['then'](function(_0x73ea5f){_0x389f5d['rows']=_0x73ea5f;return _0x389f5d;})[_0xf077('0x26')](respondWithFilteredResult(_0x359c58,_0x1f4d03))[_0xf077('0x44')](handleError(_0x359c58,null));};exports[_0xf077('0x45')]=function(_0x3e1f7a,_0x51bc73){var _0x438a6e={'raw':!![],'where':{'id':_0x3e1f7a[_0xf077('0x46')]['id']}},_0x8e0ad={};_0x8e0ad[_0xf077('0x33')]=_[_0xf077('0x35')](db['MailSubstatus'][_0xf077('0x30')]);_0x8e0ad['query']=_['keys'](_0x3e1f7a[_0xf077('0x34')]);_0x8e0ad[_0xf077('0x3d')]=_['intersection'](_0x8e0ad['model'],_0x8e0ad[_0xf077('0x34')]);_0x438a6e[_0xf077('0x38')]=_['intersection'](_0x8e0ad[_0xf077('0x33')],qs[_0xf077('0x37')](_0x3e1f7a[_0xf077('0x34')][_0xf077('0x37')]));_0x438a6e[_0xf077('0x38')]=_0x438a6e[_0xf077('0x38')][_0xf077('0x47')]?_0x438a6e[_0xf077('0x38')]:_0x8e0ad['model'];if(_0x3e1f7a[_0xf077('0x34')][_0xf077('0x48')]){_0x438a6e[_0xf077('0x42')]=[{'all':!![]}];}_0x438a6e=_[_0xf077('0x3f')]({},_0x438a6e,_0x3e1f7a[_0xf077('0x41')]);return db['MailSubstatus'][_0xf077('0x49')](_0x438a6e)[_0xf077('0x26')](handleEntityNotFound(_0x51bc73,null))[_0xf077('0x26')](respondWithResult(_0x51bc73,null))[_0xf077('0x44')](handleError(_0x51bc73,null));};exports['create']=function(_0x3e7d08,_0x23a1ea){return db[_0xf077('0x2f')][_0xf077('0x4a')](_0x3e7d08[_0xf077('0x4b')],{})[_0xf077('0x26')](respondWithResult(_0x23a1ea,0xc9))[_0xf077('0x44')](handleError(_0x23a1ea,null));};exports[_0xf077('0x25')]=function(_0x2bdf4d,_0x6fab26){if(_0x2bdf4d['body']['id']){delete _0x2bdf4d[_0xf077('0x4b')]['id'];}return db['MailSubstatus'][_0xf077('0x49')]({'where':{'id':_0x2bdf4d[_0xf077('0x46')]['id']}})[_0xf077('0x26')](handleEntityNotFound(_0x6fab26,null))[_0xf077('0x26')](saveUpdates(_0x2bdf4d[_0xf077('0x4b')],null))[_0xf077('0x26')](respondWithResult(_0x6fab26,null))['catch'](handleError(_0x6fab26,null));};exports[_0xf077('0x27')]=function(_0x35a786,_0x4487d9){return db[_0xf077('0x2f')][_0xf077('0x49')]({'where':{'id':_0x35a786[_0xf077('0x46')]['id']}})[_0xf077('0x26')](handleEntityNotFound(_0x4487d9,null))[_0xf077('0x26')](removeEntity(_0x4487d9,null))[_0xf077('0x44')](handleError(_0x4487d9,null));};exports['describe']=function(_0x3a3faf,_0x141fe1){return db[_0xf077('0x2f')][_0xf077('0x4c')]()[_0xf077('0x26')](respondWithResult(_0x141fe1,null))[_0xf077('0x44')](handleError(_0x141fe1,null));}; \ No newline at end of file +var _0x07e7=['body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','MailSubstatus','count','includeAll','include','rows','catch','show','keys','find','create'];(function(_0x39affa,_0x49d88d){var _0x38c31e=function(_0x544b57){while(--_0x544b57){_0x39affa['push'](_0x39affa['shift']());}};_0x38c31e(++_0x49d88d);}(_0x07e7,0x166));var _0x707e=function(_0x1305fd,_0x24f6b7){_0x1305fd=_0x1305fd-0x0;var _0x35672f=_0x07e7[_0x1305fd];return _0x35672f;};'use strict';var pdf=require(_0x707e('0x0'));var emlformat=require(_0x707e('0x1'));var rimraf=require(_0x707e('0x2'));var zipdir=require(_0x707e('0x3'));var jsonpatch=require(_0x707e('0x4'));var rp=require(_0x707e('0x5'));var moment=require('moment');var BPromise=require(_0x707e('0x6'));var Mustache=require(_0x707e('0x7'));var util=require(_0x707e('0x8'));var path=require(_0x707e('0x9'));var sox=require(_0x707e('0xa'));var csv=require('to-csv');var ejs=require(_0x707e('0xb'));var fs=require('fs');var _=require(_0x707e('0xc'));var squel=require(_0x707e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x707e('0xe'));var querystring=require(_0x707e('0xf'));var Papa=require(_0x707e('0x10'));var Redis=require('ioredis');var authService=require(_0x707e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x707e('0x12'))(_0x707e('0x13'));var utils=require(_0x707e('0x14'));var config=require(_0x707e('0x15'));var licenseUtil=require(_0x707e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b63ca,_0x4a72e0){_0x4a72e0=_0x4a72e0||0xcc;return function(_0x5e9d38){if(_0x5e9d38){return _0x1b63ca['sendStatus'](_0x4a72e0);}return _0x1b63ca[_0x707e('0x17')](_0x4a72e0)[_0x707e('0x18')]();};}function respondWithResult(_0x18020d,_0xbd9cc0){_0xbd9cc0=_0xbd9cc0||0xc8;return function(_0x22b135){if(_0x22b135){return _0x18020d[_0x707e('0x17')](_0xbd9cc0)[_0x707e('0x19')](_0x22b135);}};}function respondWithFilteredResult(_0x28da36,_0x493400){return function(_0x59de60){if(_0x59de60){var _0x127508=_0x59de60['count'],_0x27f4f9=_0x493400[_0x707e('0x1a')],_0x4b0f02=_0x493400[_0x707e('0x1a')]+_0x493400[_0x707e('0x1b')],_0x5c785d;if(_0x4b0f02>=_0x127508){_0x4b0f02=_0x127508;_0x5c785d=0xc8;}else{_0x5c785d=0xce;}_0x28da36[_0x707e('0x17')](_0x5c785d);return _0x28da36[_0x707e('0x1c')](_0x707e('0x1d'),_0x27f4f9+'-'+_0x4b0f02+'/'+_0x127508)[_0x707e('0x19')](_0x59de60);}return null;};}function patchUpdates(_0x697ba2){return function(_0x16ec95){try{jsonpatch[_0x707e('0x1e')](_0x16ec95,_0x697ba2,!![]);}catch(_0x4d134e){return BPromise['reject'](_0x4d134e);}return _0x16ec95['save']();};}function saveUpdates(_0x1468bf,_0x3bb9e5){return function(_0x27dda8){if(_0x27dda8){return _0x27dda8['update'](_0x1468bf)[_0x707e('0x1f')](function(_0x226255){return _0x226255;});}return null;};}function removeEntity(_0x58f4c6,_0x42c82b){return function(_0x3e1bfe){if(_0x3e1bfe){return _0x3e1bfe[_0x707e('0x20')]()[_0x707e('0x1f')](function(){_0x58f4c6[_0x707e('0x17')](0xcc)[_0x707e('0x18')]();});}};}function handleEntityNotFound(_0x14dbb0,_0x4ce796){return function(_0x4e5d26){if(!_0x4e5d26){_0x14dbb0[_0x707e('0x21')](0x194);}return _0x4e5d26;};}function handleError(_0x4d72b,_0x54c4d5){_0x54c4d5=_0x54c4d5||0x1f4;return function(_0x480adc){logger[_0x707e('0x22')](_0x480adc[_0x707e('0x23')]);if(_0x480adc['name']){delete _0x480adc['name'];}_0x4d72b['status'](_0x54c4d5)[_0x707e('0x24')](_0x480adc);};}exports[_0x707e('0x25')]=function(_0x5a96ca,_0x578ca1){var _0x18efcf={},_0x4c2f6a={},_0x98da50={'count':0x0,'rows':[]};var _0x1091e9=_[_0x707e('0x26')](db['MailSubstatus'][_0x707e('0x27')],function(_0x10ebb7){return{'name':_0x10ebb7[_0x707e('0x28')],'type':_0x10ebb7[_0x707e('0x29')]['key']};});_0x4c2f6a[_0x707e('0x2a')]=_[_0x707e('0x26')](_0x1091e9,_0x707e('0x2b'));_0x4c2f6a[_0x707e('0x2c')]=_['keys'](_0x5a96ca['query']);_0x4c2f6a[_0x707e('0x2d')]=_[_0x707e('0x2e')](_0x4c2f6a[_0x707e('0x2a')],_0x4c2f6a[_0x707e('0x2c')]);_0x18efcf[_0x707e('0x2f')]=_[_0x707e('0x2e')](_0x4c2f6a['model'],qs[_0x707e('0x30')](_0x5a96ca[_0x707e('0x2c')][_0x707e('0x30')]));_0x18efcf[_0x707e('0x2f')]=_0x18efcf['attributes'][_0x707e('0x31')]?_0x18efcf['attributes']:_0x4c2f6a['model'];if(!_0x5a96ca['query'][_0x707e('0x32')]('nolimit')){_0x18efcf['limit']=qs[_0x707e('0x1b')](_0x5a96ca[_0x707e('0x2c')][_0x707e('0x1b')]);_0x18efcf[_0x707e('0x1a')]=qs[_0x707e('0x1a')](_0x5a96ca[_0x707e('0x2c')][_0x707e('0x1a')]);}_0x18efcf[_0x707e('0x33')]=qs[_0x707e('0x34')](_0x5a96ca['query']['sort']);_0x18efcf['where']=qs[_0x707e('0x2d')](_[_0x707e('0x35')](_0x5a96ca[_0x707e('0x2c')],_0x4c2f6a['filters']),_0x1091e9);if(_0x5a96ca[_0x707e('0x2c')][_0x707e('0x36')]){_0x18efcf[_0x707e('0x37')]=_[_0x707e('0x38')](_0x18efcf[_0x707e('0x37')],{'$or':_[_0x707e('0x26')](_0x1091e9,function(_0x566702){if(_0x566702[_0x707e('0x29')]!=='VIRTUAL'){var _0x3d472d={};_0x3d472d[_0x566702[_0x707e('0x2b')]]={'$like':'%'+_0x5a96ca[_0x707e('0x2c')]['filter']+'%'};return _0x3d472d;}})});}_0x18efcf=_['merge']({},_0x18efcf,_0x5a96ca[_0x707e('0x39')]);var _0x2681bb={'where':_0x18efcf[_0x707e('0x37')]};return db[_0x707e('0x3a')][_0x707e('0x3b')](_0x2681bb)[_0x707e('0x1f')](function(_0x7eef2d){_0x98da50[_0x707e('0x3b')]=_0x7eef2d;if(_0x5a96ca[_0x707e('0x2c')][_0x707e('0x3c')]){_0x18efcf[_0x707e('0x3d')]=[{'all':!![]}];}return db[_0x707e('0x3a')]['findAll'](_0x18efcf);})['then'](function(_0x596395){_0x98da50[_0x707e('0x3e')]=_0x596395;return _0x98da50;})[_0x707e('0x1f')](respondWithFilteredResult(_0x578ca1,_0x18efcf))[_0x707e('0x3f')](handleError(_0x578ca1,null));};exports[_0x707e('0x40')]=function(_0x374b06,_0x9193a8){var _0xc21bb0={'raw':!![],'where':{'id':_0x374b06['params']['id']}},_0xda98f9={};_0xda98f9['model']=_['keys'](db[_0x707e('0x3a')]['rawAttributes']);_0xda98f9[_0x707e('0x2c')]=_[_0x707e('0x41')](_0x374b06[_0x707e('0x2c')]);_0xda98f9[_0x707e('0x2d')]=_[_0x707e('0x2e')](_0xda98f9[_0x707e('0x2a')],_0xda98f9[_0x707e('0x2c')]);_0xc21bb0[_0x707e('0x2f')]=_['intersection'](_0xda98f9[_0x707e('0x2a')],qs[_0x707e('0x30')](_0x374b06['query'][_0x707e('0x30')]));_0xc21bb0[_0x707e('0x2f')]=_0xc21bb0[_0x707e('0x2f')][_0x707e('0x31')]?_0xc21bb0['attributes']:_0xda98f9[_0x707e('0x2a')];if(_0x374b06[_0x707e('0x2c')]['includeAll']){_0xc21bb0[_0x707e('0x3d')]=[{'all':!![]}];}_0xc21bb0=_[_0x707e('0x38')]({},_0xc21bb0,_0x374b06[_0x707e('0x39')]);return db[_0x707e('0x3a')][_0x707e('0x42')](_0xc21bb0)[_0x707e('0x1f')](handleEntityNotFound(_0x9193a8,null))[_0x707e('0x1f')](respondWithResult(_0x9193a8,null))[_0x707e('0x3f')](handleError(_0x9193a8,null));};exports['create']=function(_0x50352d,_0x35d60c){return db[_0x707e('0x3a')][_0x707e('0x43')](_0x50352d['body'],{})['then'](respondWithResult(_0x35d60c,0xc9))['catch'](handleError(_0x35d60c,null));};exports['update']=function(_0x2cae2f,_0x1451b5){if(_0x2cae2f['body']['id']){delete _0x2cae2f[_0x707e('0x44')]['id'];}return db[_0x707e('0x3a')][_0x707e('0x42')]({'where':{'id':_0x2cae2f[_0x707e('0x45')]['id']}})[_0x707e('0x1f')](handleEntityNotFound(_0x1451b5,null))[_0x707e('0x1f')](saveUpdates(_0x2cae2f[_0x707e('0x44')],null))['then'](respondWithResult(_0x1451b5,null))['catch'](handleError(_0x1451b5,null));};exports['destroy']=function(_0xde0a79,_0x1e3d61){return db[_0x707e('0x3a')][_0x707e('0x42')]({'where':{'id':_0xde0a79['params']['id']}})[_0x707e('0x1f')](handleEntityNotFound(_0x1e3d61,null))[_0x707e('0x1f')](removeEntity(_0x1e3d61,null))['catch'](handleError(_0x1e3d61,null));};exports[_0x707e('0x46')]=function(_0x10fa3b,_0x5cf7a9){return db[_0x707e('0x3a')][_0x707e('0x46')]()[_0x707e('0x1f')](respondWithResult(_0x5cf7a9,null))[_0x707e('0x3f')](handleError(_0x5cf7a9,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 707e2c1..aff13c0 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 _0x38b2=['request-promise','rimraf','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x38b2,0xf6));var _0x238b=function(_0xa8cd29,_0x132455){_0xa8cd29=_0xa8cd29-0x0;var _0x23fb20=_0x38b2[_0xa8cd29];return _0x23fb20;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var logger=require(_0x238b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x238b('0x5'));var config=require('../../config/environment');var attributes=require(_0x238b('0x6'));module[_0x238b('0x7')]=function(_0x2fb980,_0xb6f089){return _0x2fb980['define'](_0x238b('0x8'),attributes,{'tableName':_0x238b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab95=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','MailSubstatus','lodash'];(function(_0x5d5263,_0x23889e){var _0x3aad39=function(_0x4626b6){while(--_0x4626b6){_0x5d5263['push'](_0x5d5263['shift']());}};_0x3aad39(++_0x23889e);}(_0xab95,0x1d5));var _0x5ab9=function(_0x3812cf,_0x52ed87){_0x3812cf=_0x3812cf-0x0;var _0x3259fa=_0xab95[_0x3812cf];return _0x3259fa;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var logger=require(_0x5ab9('0x2'))('api');var moment=require(_0x5ab9('0x3'));var BPromise=require(_0x5ab9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ab9('0x5'));var config=require(_0x5ab9('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x5ab9('0x7')]=function(_0x40d6c2,_0x4c1360){return _0x40d6c2[_0x5ab9('0x8')](_0x5ab9('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8450d18..e628be0 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 _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x1be1,0x192));var _0x11be=function(_0x2cf18b,_0x2dffc1){_0x2cf18b=_0x2cf18b-0x0;var _0x1ac3f3=_0x1be1[_0x2cf18b];return _0x1ac3f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0xb4e6[_0x3b87f4];return _0x63d16e;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fdbf5d4..5a44886 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 _0x7419=['delete','destroy','exports','multer','util','path','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x7419,0xd4));var _0x9741=function(_0x49b884,_0x1343ac){_0x49b884=_0x49b884-0x0;var _0x3f8211=_0x7419[_0x49b884];return _0x3f8211;};'use strict';var multer=require(_0x9741('0x0'));var util=require(_0x9741('0x1'));var path=require(_0x9741('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9741('0x3'));var config=require(_0x9741('0x4'));var controller=require(_0x9741('0x5'));router[_0x9741('0x6')]('/',auth[_0x9741('0x7')](),controller[_0x9741('0x8')]);router['get'](_0x9741('0x9'),auth['isAuthenticated'](),controller[_0x9741('0xa')]);router[_0x9741('0x6')](_0x9741('0xb'),auth[_0x9741('0x7')](),controller[_0x9741('0xc')]);router[_0x9741('0xd')]('/',auth['isAuthenticated'](),controller[_0x9741('0xe')]);router[_0x9741('0xf')](_0x9741('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9741('0x10')](_0x9741('0xb'),auth[_0x9741('0x7')](),controller[_0x9741('0x11')]);module[_0x9741('0x12')]=router; \ No newline at end of file +var _0xf789=['show','post','create','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x2dde55,_0x43dbff){var _0x47715a=function(_0x2e86cd){while(--_0x2e86cd){_0x2dde55['push'](_0x2dde55['shift']());}};_0x47715a(++_0x43dbff);}(_0xf789,0x8b));var _0x9f78=function(_0x29567f,_0x217351){_0x29567f=_0x29567f-0x0;var _0x5d7eac=_0xf789[_0x29567f];return _0x5d7eac;};'use strict';var multer=require('multer');var util=require(_0x9f78('0x0'));var path=require(_0x9f78('0x1'));var timeout=require(_0x9f78('0x2'));var express=require('express');var router=express[_0x9f78('0x3')]();var auth=require(_0x9f78('0x4'));var interaction=require(_0x9f78('0x5'));var config=require(_0x9f78('0x6'));var controller=require(_0x9f78('0x7'));router[_0x9f78('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f78('0x9')]);router[_0x9f78('0x8')]('/describe',auth[_0x9f78('0xa')](),controller[_0x9f78('0xb')]);router[_0x9f78('0x8')](_0x9f78('0xc'),auth[_0x9f78('0xa')](),controller[_0x9f78('0xd')]);router[_0x9f78('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f78('0xf')]);router[_0x9f78('0x10')](_0x9f78('0xc'),auth['isAuthenticated'](),controller[_0x9f78('0x11')]);router['delete'](_0x9f78('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9f78('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 adfc404..e2d9960 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 _0x23c9=['agent','queue','DATE','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x23c9,0x1bc));var _0x923c=function(_0x332862,_0x374c82){_0x332862=_0x332862-0x0;var _0xa37e14=_0x23c9[_0x332862];return _0xa37e14;};'use strict';var moment=require(_0x923c('0x0'));var Sequelize=require(_0x923c('0x1'));module[_0x923c('0x2')]={'uniqueid':{'type':Sequelize[_0x923c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x923c('0x4')](_0x923c('0x5'),_0x923c('0x6'),_0x923c('0x7')),'allowNull':![],'defaultValue':_0x923c('0x7')},'transferredAt':{'type':Sequelize[_0x923c('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x5f2f=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f2f,0x123));var _0xf5f2=function(_0x304634,_0x3cb0fe){_0x304634=_0x304634-0x0;var _0x10ce68=_0x5f2f[_0x304634];return _0x10ce68;};'use strict';var moment=require('moment');var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),'queue'),'allowNull':![],'defaultValue':_0xf5f2('0x6')},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf5f2('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ffcd983..7318dec 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 _0x06d9=['filter','options','count','includeAll','include','findAll','rows','catch','params','keys','find','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06d9,0xab));var _0x906d=function(_0x116af1,_0x3fcbe2){_0x116af1=_0x116af1-0x0;var _0x2097d5=_0x06d9[_0x116af1];return _0x2097d5;};'use strict';var pdf=require(_0x906d('0x0'));var emlformat=require(_0x906d('0x1'));var rimraf=require(_0x906d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x906d('0x3'));var rp=require(_0x906d('0x4'));var moment=require(_0x906d('0x5'));var BPromise=require(_0x906d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x906d('0x7'));var sox=require(_0x906d('0x8'));var csv=require(_0x906d('0x9'));var ejs=require(_0x906d('0xa'));var fs=require('fs');var _=require(_0x906d('0xb'));var squel=require(_0x906d('0xc'));var crypto=require(_0x906d('0xd'));var jsforce=require(_0x906d('0xe'));var deskjs=require(_0x906d('0xf'));var toCsv=require(_0x906d('0x9'));var querystring=require(_0x906d('0x10'));var Papa=require(_0x906d('0x11'));var Redis=require(_0x906d('0x12'));var authService=require(_0x906d('0x13'));var qs=require(_0x906d('0x14'));var as=require(_0x906d('0x15'));var hardwareService=require(_0x906d('0x16'));var logger=require(_0x906d('0x17'))(_0x906d('0x18'));var utils=require('../../config/utils');var config=require(_0x906d('0x19'));var licenseUtil=require(_0x906d('0x1a'));var db=require(_0x906d('0x1b'))['db'];function respondWithStatusCode(_0x466eb8,_0x167462){_0x167462=_0x167462||0xcc;return function(_0x5167c1){if(_0x5167c1){return _0x466eb8[_0x906d('0x1c')](_0x167462);}return _0x466eb8[_0x906d('0x1d')](_0x167462)[_0x906d('0x1e')]();};}function respondWithResult(_0x303842,_0x461cd2){_0x461cd2=_0x461cd2||0xc8;return function(_0x394481){if(_0x394481){return _0x303842[_0x906d('0x1d')](_0x461cd2)[_0x906d('0x1f')](_0x394481);}};}function respondWithFilteredResult(_0x4c6b26,_0x2a76d1){return function(_0x51e8f2){if(_0x51e8f2){var _0x5d1e86=_0x51e8f2['count'],_0x708c18=_0x2a76d1['offset'],_0x21de10=_0x2a76d1[_0x906d('0x20')]+_0x2a76d1[_0x906d('0x21')],_0x56ea2b;if(_0x21de10>=_0x5d1e86){_0x21de10=_0x5d1e86;_0x56ea2b=0xc8;}else{_0x56ea2b=0xce;}_0x4c6b26[_0x906d('0x1d')](_0x56ea2b);return _0x4c6b26[_0x906d('0x22')](_0x906d('0x23'),_0x708c18+'-'+_0x21de10+'/'+_0x5d1e86)[_0x906d('0x1f')](_0x51e8f2);}return null;};}function patchUpdates(_0x3b741e){return function(_0x50d821){try{jsonpatch[_0x906d('0x24')](_0x50d821,_0x3b741e,!![]);}catch(_0x43e6c6){return BPromise[_0x906d('0x25')](_0x43e6c6);}return _0x50d821[_0x906d('0x26')]();};}function saveUpdates(_0x55736a,_0x39e81a){return function(_0x2dfb8e){if(_0x2dfb8e){return _0x2dfb8e[_0x906d('0x27')](_0x55736a)['then'](function(_0x152f07){return _0x152f07;});}return null;};}function removeEntity(_0x67bdb2,_0x2a902d){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x906d('0x28')]()[_0x906d('0x29')](function(){_0x67bdb2[_0x906d('0x1d')](0xcc)[_0x906d('0x1e')]();});}};}function handleEntityNotFound(_0x291e53,_0x2e22d4){return function(_0x39d891){if(!_0x39d891){_0x291e53[_0x906d('0x1c')](0x194);}return _0x39d891;};}function handleError(_0x15b22f,_0x3505f4){_0x3505f4=_0x3505f4||0x1f4;return function(_0x3028a2){logger[_0x906d('0x2a')](_0x3028a2['stack']);if(_0x3028a2[_0x906d('0x2b')]){delete _0x3028a2[_0x906d('0x2b')];}_0x15b22f['status'](_0x3505f4)[_0x906d('0x2c')](_0x3028a2);};}exports['index']=function(_0x606266,_0x2c7398){var _0x5904d1={},_0x2530c3={},_0xda367a={'count':0x0,'rows':[]};var _0x48e8de=_[_0x906d('0x2d')](db[_0x906d('0x2e')][_0x906d('0x2f')],function(_0x1d41fe){return{'name':_0x1d41fe[_0x906d('0x30')],'type':_0x1d41fe[_0x906d('0x31')][_0x906d('0x32')]};});_0x2530c3[_0x906d('0x33')]=_[_0x906d('0x2d')](_0x48e8de,_0x906d('0x2b'));_0x2530c3[_0x906d('0x34')]=_['keys'](_0x606266[_0x906d('0x34')]);_0x2530c3[_0x906d('0x35')]=_[_0x906d('0x36')](_0x2530c3[_0x906d('0x33')],_0x2530c3[_0x906d('0x34')]);_0x5904d1[_0x906d('0x37')]=_[_0x906d('0x36')](_0x2530c3[_0x906d('0x33')],qs[_0x906d('0x38')](_0x606266[_0x906d('0x34')][_0x906d('0x38')]));_0x5904d1[_0x906d('0x37')]=_0x5904d1[_0x906d('0x37')][_0x906d('0x39')]?_0x5904d1['attributes']:_0x2530c3['model'];if(!_0x606266['query'][_0x906d('0x3a')](_0x906d('0x3b'))){_0x5904d1[_0x906d('0x21')]=qs['limit'](_0x606266[_0x906d('0x34')]['limit']);_0x5904d1[_0x906d('0x20')]=qs['offset'](_0x606266[_0x906d('0x34')]['offset']);}_0x5904d1[_0x906d('0x3c')]=qs[_0x906d('0x3d')](_0x606266[_0x906d('0x34')][_0x906d('0x3d')]);_0x5904d1[_0x906d('0x3e')]=qs['filters'](_[_0x906d('0x3f')](_0x606266['query'],_0x2530c3[_0x906d('0x35')]),_0x48e8de);if(_0x606266[_0x906d('0x34')]['filter']){_0x5904d1['where']=_[_0x906d('0x40')](_0x5904d1[_0x906d('0x3e')],{'$or':_[_0x906d('0x2d')](_0x48e8de,function(_0x4b7a83){if(_0x4b7a83[_0x906d('0x31')]!==_0x906d('0x41')){var _0x3f6b91={};_0x3f6b91[_0x4b7a83[_0x906d('0x2b')]]={'$like':'%'+_0x606266[_0x906d('0x34')][_0x906d('0x42')]+'%'};return _0x3f6b91;}})});}_0x5904d1=_[_0x906d('0x40')]({},_0x5904d1,_0x606266[_0x906d('0x43')]);var _0x5e721d={'where':_0x5904d1[_0x906d('0x3e')]};return db[_0x906d('0x2e')][_0x906d('0x44')](_0x5e721d)[_0x906d('0x29')](function(_0x4c0fac){_0xda367a['count']=_0x4c0fac;if(_0x606266['query'][_0x906d('0x45')]){_0x5904d1[_0x906d('0x46')]=[{'all':!![]}];}return db[_0x906d('0x2e')][_0x906d('0x47')](_0x5904d1);})[_0x906d('0x29')](function(_0x24086c){_0xda367a[_0x906d('0x48')]=_0x24086c;return _0xda367a;})[_0x906d('0x29')](respondWithFilteredResult(_0x2c7398,_0x5904d1))[_0x906d('0x49')](handleError(_0x2c7398,null));};exports['show']=function(_0x3d3c5d,_0x23d703){var _0x4ffedb={'raw':!![],'where':{'id':_0x3d3c5d[_0x906d('0x4a')]['id']}},_0x59aa11={};_0x59aa11[_0x906d('0x33')]=_[_0x906d('0x4b')](db[_0x906d('0x2e')][_0x906d('0x2f')]);_0x59aa11[_0x906d('0x34')]=_[_0x906d('0x4b')](_0x3d3c5d[_0x906d('0x34')]);_0x59aa11[_0x906d('0x35')]=_['intersection'](_0x59aa11['model'],_0x59aa11[_0x906d('0x34')]);_0x4ffedb[_0x906d('0x37')]=_[_0x906d('0x36')](_0x59aa11[_0x906d('0x33')],qs['fields'](_0x3d3c5d['query'][_0x906d('0x38')]));_0x4ffedb[_0x906d('0x37')]=_0x4ffedb[_0x906d('0x37')]['length']?_0x4ffedb[_0x906d('0x37')]:_0x59aa11['model'];if(_0x3d3c5d[_0x906d('0x34')][_0x906d('0x45')]){_0x4ffedb[_0x906d('0x46')]=[{'all':!![]}];}_0x4ffedb=_[_0x906d('0x40')]({},_0x4ffedb,_0x3d3c5d[_0x906d('0x43')]);return db[_0x906d('0x2e')][_0x906d('0x4c')](_0x4ffedb)[_0x906d('0x29')](handleEntityNotFound(_0x23d703,null))['then'](respondWithResult(_0x23d703,null))[_0x906d('0x49')](handleError(_0x23d703,null));};exports['create']=function(_0x2bb845,_0x37dea3){return db[_0x906d('0x2e')]['create'](_0x2bb845[_0x906d('0x4d')],{})[_0x906d('0x29')](respondWithResult(_0x37dea3,0xc9))[_0x906d('0x49')](handleError(_0x37dea3,null));};exports[_0x906d('0x27')]=function(_0x2c6cf8,_0x23a748){if(_0x2c6cf8['body']['id']){delete _0x2c6cf8[_0x906d('0x4d')]['id'];}return db[_0x906d('0x2e')][_0x906d('0x4c')]({'where':{'id':_0x2c6cf8[_0x906d('0x4a')]['id']}})[_0x906d('0x29')](handleEntityNotFound(_0x23a748,null))[_0x906d('0x29')](saveUpdates(_0x2c6cf8[_0x906d('0x4d')],null))[_0x906d('0x29')](respondWithResult(_0x23a748,null))[_0x906d('0x49')](handleError(_0x23a748,null));};exports[_0x906d('0x28')]=function(_0x232bfe,_0x41741d){return db[_0x906d('0x2e')][_0x906d('0x4c')]({'where':{'id':_0x232bfe[_0x906d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x41741d,null))[_0x906d('0x29')](removeEntity(_0x41741d,null))[_0x906d('0x49')](handleError(_0x41741d,null));};exports[_0x906d('0x4e')]=function(_0x5c59be,_0x45c16f){return db[_0x906d('0x2e')][_0x906d('0x4e')]()[_0x906d('0x29')](respondWithResult(_0x45c16f,null))[_0x906d('0x49')](handleError(_0x45c16f,null));}; \ No newline at end of file +var _0x1794=['apply','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','MailTransferReport','rawAttributes','merge','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0x51f61d,_0xe09ec2){var _0x5ef5f3=function(_0x56ed94){while(--_0x56ed94){_0x51f61d['push'](_0x51f61d['shift']());}};_0x5ef5f3(++_0xe09ec2);}(_0x1794,0xc2));var _0x4179=function(_0x3487c6,_0x29f7f7){_0x3487c6=_0x3487c6-0x0;var _0x297c2a=_0x1794[_0x3487c6];return _0x297c2a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4179('0x0'));var rimraf=require(_0x4179('0x1'));var zipdir=require(_0x4179('0x2'));var jsonpatch=require(_0x4179('0x3'));var rp=require(_0x4179('0x4'));var moment=require(_0x4179('0x5'));var BPromise=require(_0x4179('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4179('0x7'));var fs=require('fs');var _=require(_0x4179('0x8'));var squel=require(_0x4179('0x9'));var crypto=require(_0x4179('0xa'));var jsforce=require(_0x4179('0xb'));var deskjs=require(_0x4179('0xc'));var toCsv=require(_0x4179('0xd'));var querystring=require(_0x4179('0xe'));var Papa=require(_0x4179('0xf'));var Redis=require(_0x4179('0x10'));var authService=require(_0x4179('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4179('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4179('0x13'));var utils=require(_0x4179('0x14'));var config=require(_0x4179('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4179('0x16'))['db'];function respondWithStatusCode(_0x2bb05a,_0x5b1bf5){_0x5b1bf5=_0x5b1bf5||0xcc;return function(_0x4336e9){if(_0x4336e9){return _0x2bb05a[_0x4179('0x17')](_0x5b1bf5);}return _0x2bb05a[_0x4179('0x18')](_0x5b1bf5)['end']();};}function respondWithResult(_0x448dbc,_0x58a9c9){_0x58a9c9=_0x58a9c9||0xc8;return function(_0x12a7e9){if(_0x12a7e9){return _0x448dbc[_0x4179('0x18')](_0x58a9c9)[_0x4179('0x19')](_0x12a7e9);}};}function respondWithFilteredResult(_0x36e28d,_0xe603d7){return function(_0x44d964){if(_0x44d964){var _0x2d90f2=_0x44d964[_0x4179('0x1a')],_0x453be7=_0xe603d7[_0x4179('0x1b')],_0x3744b3=_0xe603d7[_0x4179('0x1b')]+_0xe603d7[_0x4179('0x1c')],_0x287390;if(_0x3744b3>=_0x2d90f2){_0x3744b3=_0x2d90f2;_0x287390=0xc8;}else{_0x287390=0xce;}_0x36e28d[_0x4179('0x18')](_0x287390);return _0x36e28d[_0x4179('0x1d')](_0x4179('0x1e'),_0x453be7+'-'+_0x3744b3+'/'+_0x2d90f2)[_0x4179('0x19')](_0x44d964);}return null;};}function patchUpdates(_0x262876){return function(_0xc7220f){try{jsonpatch[_0x4179('0x1f')](_0xc7220f,_0x262876,!![]);}catch(_0x247ee6){return BPromise[_0x4179('0x20')](_0x247ee6);}return _0xc7220f[_0x4179('0x21')]();};}function saveUpdates(_0x5af669,_0x36c6f4){return function(_0x3c8aa8){if(_0x3c8aa8){return _0x3c8aa8[_0x4179('0x22')](_0x5af669)[_0x4179('0x23')](function(_0x44a33f){return _0x44a33f;});}return null;};}function removeEntity(_0x171f14,_0x2ce496){return function(_0x3ad396){if(_0x3ad396){return _0x3ad396['destroy']()[_0x4179('0x23')](function(){_0x171f14[_0x4179('0x18')](0xcc)[_0x4179('0x24')]();});}};}function handleEntityNotFound(_0x1af32f,_0x5e88a2){return function(_0x151230){if(!_0x151230){_0x1af32f[_0x4179('0x17')](0x194);}return _0x151230;};}function handleError(_0xbd76cc,_0x1f8ccd){_0x1f8ccd=_0x1f8ccd||0x1f4;return function(_0x1f0426){logger[_0x4179('0x25')](_0x1f0426[_0x4179('0x26')]);if(_0x1f0426[_0x4179('0x27')]){delete _0x1f0426['name'];}_0xbd76cc[_0x4179('0x18')](_0x1f8ccd)[_0x4179('0x28')](_0x1f0426);};}exports[_0x4179('0x29')]=function(_0x28174f,_0x2ddfbf){var _0x1bc8ed={},_0x1ef262={},_0x58f2a7={'count':0x0,'rows':[]};var _0x3665f=_[_0x4179('0x2a')](db['MailTransferReport']['rawAttributes'],function(_0x2d1cf4){return{'name':_0x2d1cf4[_0x4179('0x2b')],'type':_0x2d1cf4[_0x4179('0x2c')]['key']};});_0x1ef262[_0x4179('0x2d')]=_[_0x4179('0x2a')](_0x3665f,_0x4179('0x27'));_0x1ef262[_0x4179('0x2e')]=_['keys'](_0x28174f[_0x4179('0x2e')]);_0x1ef262[_0x4179('0x2f')]=_[_0x4179('0x30')](_0x1ef262[_0x4179('0x2d')],_0x1ef262[_0x4179('0x2e')]);_0x1bc8ed[_0x4179('0x31')]=_[_0x4179('0x30')](_0x1ef262['model'],qs[_0x4179('0x32')](_0x28174f[_0x4179('0x2e')]['fields']));_0x1bc8ed[_0x4179('0x31')]=_0x1bc8ed[_0x4179('0x31')][_0x4179('0x33')]?_0x1bc8ed[_0x4179('0x31')]:_0x1ef262['model'];if(!_0x28174f[_0x4179('0x2e')]['hasOwnProperty'](_0x4179('0x34'))){_0x1bc8ed[_0x4179('0x1c')]=qs[_0x4179('0x1c')](_0x28174f[_0x4179('0x2e')][_0x4179('0x1c')]);_0x1bc8ed[_0x4179('0x1b')]=qs[_0x4179('0x1b')](_0x28174f[_0x4179('0x2e')][_0x4179('0x1b')]);}_0x1bc8ed[_0x4179('0x35')]=qs[_0x4179('0x36')](_0x28174f[_0x4179('0x2e')]['sort']);_0x1bc8ed[_0x4179('0x37')]=qs[_0x4179('0x2f')](_['pick'](_0x28174f[_0x4179('0x2e')],_0x1ef262[_0x4179('0x2f')]),_0x3665f);if(_0x28174f[_0x4179('0x2e')][_0x4179('0x38')]){_0x1bc8ed[_0x4179('0x37')]=_['merge'](_0x1bc8ed['where'],{'$or':_['map'](_0x3665f,function(_0x36e4ac){if(_0x36e4ac['type']!==_0x4179('0x39')){var _0xc92031={};_0xc92031[_0x36e4ac['name']]={'$like':'%'+_0x28174f['query'][_0x4179('0x38')]+'%'};return _0xc92031;}})});}_0x1bc8ed=_['merge']({},_0x1bc8ed,_0x28174f['options']);var _0x3cb84d={'where':_0x1bc8ed[_0x4179('0x37')]};return db['MailTransferReport']['count'](_0x3cb84d)['then'](function(_0x3556f0){_0x58f2a7[_0x4179('0x1a')]=_0x3556f0;if(_0x28174f[_0x4179('0x2e')][_0x4179('0x3a')]){_0x1bc8ed[_0x4179('0x3b')]=[{'all':!![]}];}return db['MailTransferReport'][_0x4179('0x3c')](_0x1bc8ed);})[_0x4179('0x23')](function(_0x1fc5c3){_0x58f2a7[_0x4179('0x3d')]=_0x1fc5c3;return _0x58f2a7;})[_0x4179('0x23')](respondWithFilteredResult(_0x2ddfbf,_0x1bc8ed))[_0x4179('0x3e')](handleError(_0x2ddfbf,null));};exports[_0x4179('0x3f')]=function(_0x3c93cd,_0x3795cd){var _0x2b509c={'raw':!![],'where':{'id':_0x3c93cd[_0x4179('0x40')]['id']}},_0x36b691={};_0x36b691['model']=_[_0x4179('0x41')](db[_0x4179('0x42')][_0x4179('0x43')]);_0x36b691[_0x4179('0x2e')]=_[_0x4179('0x41')](_0x3c93cd[_0x4179('0x2e')]);_0x36b691[_0x4179('0x2f')]=_[_0x4179('0x30')](_0x36b691['model'],_0x36b691[_0x4179('0x2e')]);_0x2b509c[_0x4179('0x31')]=_['intersection'](_0x36b691[_0x4179('0x2d')],qs['fields'](_0x3c93cd[_0x4179('0x2e')]['fields']));_0x2b509c['attributes']=_0x2b509c[_0x4179('0x31')][_0x4179('0x33')]?_0x2b509c[_0x4179('0x31')]:_0x36b691[_0x4179('0x2d')];if(_0x3c93cd[_0x4179('0x2e')][_0x4179('0x3a')]){_0x2b509c[_0x4179('0x3b')]=[{'all':!![]}];}_0x2b509c=_[_0x4179('0x44')]({},_0x2b509c,_0x3c93cd[_0x4179('0x45')]);return db['MailTransferReport'][_0x4179('0x46')](_0x2b509c)['then'](handleEntityNotFound(_0x3795cd,null))[_0x4179('0x23')](respondWithResult(_0x3795cd,null))[_0x4179('0x3e')](handleError(_0x3795cd,null));};exports[_0x4179('0x47')]=function(_0x42684e,_0x468fc3){return db[_0x4179('0x42')]['create'](_0x42684e[_0x4179('0x48')],{})[_0x4179('0x23')](respondWithResult(_0x468fc3,0xc9))['catch'](handleError(_0x468fc3,null));};exports[_0x4179('0x22')]=function(_0x13f497,_0x3d0ef0){if(_0x13f497[_0x4179('0x48')]['id']){delete _0x13f497['body']['id'];}return db[_0x4179('0x42')]['find']({'where':{'id':_0x13f497[_0x4179('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d0ef0,null))['then'](saveUpdates(_0x13f497[_0x4179('0x48')],null))[_0x4179('0x23')](respondWithResult(_0x3d0ef0,null))[_0x4179('0x3e')](handleError(_0x3d0ef0,null));};exports[_0x4179('0x49')]=function(_0x474e8e,_0x5f12c2){return db[_0x4179('0x42')][_0x4179('0x46')]({'where':{'id':_0x474e8e[_0x4179('0x40')]['id']}})[_0x4179('0x23')](handleEntityNotFound(_0x5f12c2,null))[_0x4179('0x23')](removeEntity(_0x5f12c2,null))[_0x4179('0x3e')](handleError(_0x5f12c2,null));};exports[_0x4179('0x4a')]=function(_0x3aac39,_0x37b25b){return db[_0x4179('0x42')]['describe']()[_0x4179('0x23')](respondWithResult(_0x37b25b,null))[_0x4179('0x3e')](handleError(_0x37b25b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d0d58b7..1d7598a 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 _0xe86e=['report_mail_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define'];(function(_0x2d98f1,_0x21174b){var _0x701cc7=function(_0x24dd62){while(--_0x24dd62){_0x2d98f1['push'](_0x2d98f1['shift']());}};_0x701cc7(++_0x21174b);}(_0xe86e,0x199));var _0xee86=function(_0x1962a8,_0x22bb73){_0x1962a8=_0x1962a8-0x0;var _0x8a19ca=_0xe86e[_0x1962a8];return _0x8a19ca;};'use strict';var _=require('lodash');var util=require(_0xee86('0x0'));var logger=require('../../config/logger')(_0xee86('0x1'));var moment=require(_0xee86('0x2'));var BPromise=require(_0xee86('0x3'));var rp=require(_0xee86('0x4'));var fs=require('fs');var path=require(_0xee86('0x5'));var rimraf=require(_0xee86('0x6'));var config=require('../../config/environment');var attributes=require(_0xee86('0x7'));module['exports']=function(_0x520efb,_0x4b34bf){return _0x520efb[_0xee86('0x8')]('MailTransferReport',attributes,{'tableName':_0xee86('0x9'),'paranoid':![],'indexes':[{'name':_0xee86('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9589=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3d2ce3,_0x2ba821){var _0x5a67cb=function(_0x18e86d){while(--_0x18e86d){_0x3d2ce3['push'](_0x3d2ce3['shift']());}};_0x5a67cb(++_0x2ba821);}(_0x9589,0x148));var _0x9958=function(_0x5908fd,_0x51bfa3){_0x5908fd=_0x5908fd-0x0;var _0x36a15b=_0x9589[_0x5908fd];return _0x36a15b;};'use strict';var _=require('lodash');var util=require(_0x9958('0x0'));var logger=require(_0x9958('0x1'))(_0x9958('0x2'));var moment=require(_0x9958('0x3'));var BPromise=require(_0x9958('0x4'));var rp=require(_0x9958('0x5'));var fs=require('fs');var path=require(_0x9958('0x6'));var rimraf=require(_0x9958('0x7'));var config=require('../../config/environment');var attributes=require(_0x9958('0x8'));module[_0x9958('0x9')]=function(_0x698af1,_0x246474){return _0x698af1[_0x9958('0xa')](_0x9958('0xb'),attributes,{'tableName':_0x9958('0xc'),'paranoid':![],'indexes':[{'name':_0x9958('0xd'),'fields':[_0x9958('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 802668e..edf1478 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 _0x5818=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x342696,_0x146f50){var _0x15b8e4=function(_0x591e2a){while(--_0x591e2a){_0x342696['push'](_0x342696['shift']());}};_0x15b8e4(++_0x146f50);}(_0x5818,0x111));var _0x8581=function(_0x4d7471,_0x30160d){_0x4d7471=_0x4d7471-0x0;var _0x4e0b49=_0x5818[_0x4d7471];return _0x4e0b49;};'use strict';var _=require(_0x8581('0x0'));var util=require(_0x8581('0x1'));var moment=require(_0x8581('0x2'));var BPromise=require(_0x8581('0x3'));var rs=require(_0x8581('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8581('0x5'))['db'];var utils=require(_0x8581('0x6'));var logger=require(_0x8581('0x7'))(_0x8581('0x8'));var config=require(_0x8581('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8581('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335a6,_0x4d2171,_0x7a4be7){return new BPromise(function(_0x52832,_0x48023d){return client['request'](_0x335a6,_0x7a4be7)['then'](function(_0x23076a){logger[_0x8581('0xb')](_0x8581('0xc'),_0x4d2171,_0x8581('0xd'));logger[_0x8581('0xe')](_0x8581('0xf'),_0x4d2171,_0x8581('0xd'),JSON[_0x8581('0x10')](_0x23076a));if(_0x23076a[_0x8581('0x11')]){if(_0x23076a['error']['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4d2171,_0x23076a[_0x8581('0x11')][_0x8581('0x12')]);return _0x48023d(_0x23076a[_0x8581('0x11')]['message']);}logger[_0x8581('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4d2171,_0x23076a[_0x8581('0x11')][_0x8581('0x12')]);return _0x52832(_0x23076a[_0x8581('0x11')][_0x8581('0x12')]);}else{logger[_0x8581('0xb')](_0x8581('0xc'),_0x4d2171,_0x8581('0xd'));_0x52832(_0x23076a[_0x8581('0x13')]['message']);}})[_0x8581('0x14')](function(_0x244dd2){logger[_0x8581('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4d2171,_0x244dd2);_0x48023d(_0x244dd2);});});} \ No newline at end of file +var _0x475a=['util','moment','bluebird','randomstring','rpc','client','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x475a,0xe3));var _0xa475=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x475a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa475('0x0'));var util=require(_0xa475('0x1'));var moment=require(_0xa475('0x2'));var BPromise=require(_0xa475('0x3'));var rs=require(_0xa475('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa475('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa475('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9d45,_0x486e44,_0x4ed01d){return new BPromise(function(_0x11f05f,_0x45cf20){return client[_0xa475('0x7')](_0x4e9d45,_0x4ed01d)[_0xa475('0x8')](function(_0x3cbd35){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x486e44,_0xa475('0x9'));logger[_0xa475('0xa')](_0xa475('0xb'),_0x486e44,_0xa475('0x9'),JSON['stringify'](_0x3cbd35));if(_0x3cbd35[_0xa475('0xc')]){if(_0x3cbd35[_0xa475('0xc')][_0xa475('0xd')]===0x1f4){logger['error'](_0xa475('0xe'),_0x486e44,_0x3cbd35[_0xa475('0xc')][_0xa475('0xf')]);return _0x45cf20(_0x3cbd35[_0xa475('0xc')]['message']);}logger[_0xa475('0xc')](_0xa475('0xe'),_0x486e44,_0x3cbd35[_0xa475('0xc')][_0xa475('0xf')]);return _0x11f05f(_0x3cbd35[_0xa475('0xc')][_0xa475('0xf')]);}else{logger[_0xa475('0x10')](_0xa475('0xe'),_0x486e44,_0xa475('0x9'));_0x11f05f(_0x3cbd35[_0xa475('0x11')][_0xa475('0xf')]);}})[_0xa475('0x12')](function(_0x1702c9){logger[_0xa475('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x486e44,_0x1702c9);_0x45cf20(_0x1702c9);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dcaa266..fb03cd3 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 _0x2ff7=['Router','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x7607c0,_0x1da561){var _0x22298a=function(_0x1e32d0){while(--_0x1e32d0){_0x7607c0['push'](_0x7607c0['shift']());}};_0x22298a(++_0x1da561);}(_0x2ff7,0xc2));var _0x72ff=function(_0x346ed0,_0x3961e0){_0x346ed0=_0x346ed0-0x0;var _0x518822=_0x2ff7[_0x346ed0];return _0x518822;};'use strict';var multer=require(_0x72ff('0x0'));var util=require('util');var path=require(_0x72ff('0x1'));var timeout=require(_0x72ff('0x2'));var express=require(_0x72ff('0x3'));var router=express[_0x72ff('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x72ff('0x5'));var config=require(_0x72ff('0x6'));var controller=require(_0x72ff('0x7'));router[_0x72ff('0x8')]('/',auth['isAuthenticated'](),controller[_0x72ff('0x9')]);router[_0x72ff('0x8')](_0x72ff('0xa'),auth[_0x72ff('0xb')](),controller[_0x72ff('0xc')]);router[_0x72ff('0x8')](_0x72ff('0xd'),auth['isAuthenticated'](),controller[_0x72ff('0xe')]);router[_0x72ff('0xf')]('/',auth['isAuthenticated'](),controller[_0x72ff('0x10')]);router[_0x72ff('0x11')](_0x72ff('0xd'),auth['isAuthenticated'](),controller[_0x72ff('0x12')]);router[_0x72ff('0x13')](_0x72ff('0xd'),auth[_0x72ff('0xb')](),controller[_0x72ff('0x14')]);module[_0x72ff('0x15')]=router; \ No newline at end of file +var _0x8d3e=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x3ee99e,_0x4affec){var _0x1b56e1=function(_0x3857a2){while(--_0x3857a2){_0x3ee99e['push'](_0x3ee99e['shift']());}};_0x1b56e1(++_0x4affec);}(_0x8d3e,0x1ce));var _0xe8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe8d3('0x0'));var util=require('util');var path=require(_0xe8d3('0x1'));var timeout=require(_0xe8d3('0x2'));var express=require(_0xe8d3('0x3'));var router=express[_0xe8d3('0x4')]();var auth=require(_0xe8d3('0x5'));var interaction=require(_0xe8d3('0x6'));var config=require(_0xe8d3('0x7'));var controller=require(_0xe8d3('0x8'));router[_0xe8d3('0x9')]('/',auth[_0xe8d3('0xa')](),controller['index']);router[_0xe8d3('0x9')]('/describe',auth[_0xe8d3('0xa')](),controller[_0xe8d3('0xb')]);router['get']('/:id',auth[_0xe8d3('0xa')](),controller[_0xe8d3('0xc')]);router[_0xe8d3('0xd')]('/',auth['isAuthenticated'](),controller[_0xe8d3('0xe')]);router[_0xe8d3('0xf')](_0xe8d3('0x10'),auth['isAuthenticated'](),controller[_0xe8d3('0x11')]);router[_0xe8d3('0x12')](_0xe8d3('0x10'),auth[_0xe8d3('0xa')](),controller[_0xe8d3('0x13')]);module[_0xe8d3('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f522daa..f24b464 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 _0xc82f=['setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','exitAt'];(function(_0xf2718f,_0x23c0bb){var _0x59a974=function(_0x2c984d){while(--_0x2c984d){_0xf2718f['push'](_0xf2718f['shift']());}};_0x59a974(++_0x23c0bb);}(_0xc82f,0x187));var _0xfc82=function(_0x37042a,_0x170e96){_0x37042a=_0x37042a-0x0;var _0x1da4de=_0xc82f[_0x37042a];return _0x1da4de;};'use strict';var Sequelize=require(_0xfc82('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfc82('0x1')]},'type':{'type':Sequelize[_0xfc82('0x1')],'defaultValue':_0xfc82('0x2'),'comment':_0xfc82('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xfc82('0x4')]},'exitAt':{'type':Sequelize[_0xfc82('0x4')],'set':function(_0x31ef34){var _0x124716=moment(_0x31ef34);var _0x27e946=moment(this[_0xfc82('0x5')](_0xfc82('0x6')));var _0x35979e=_0x124716['diff'](_0x27e946,_0xfc82('0x7'));this['setDataValue'](_0xfc82('0x8'),_0x31ef34);this[_0xfc82('0x9')]('duration',_0x35979e||null);}},'data1':{'type':Sequelize[_0xfc82('0x1')],'comment':_0xfc82('0xa')},'data2':{'type':Sequelize[_0xfc82('0x1')],'comment':_0xfc82('0xb')},'data3':{'type':Sequelize[_0xfc82('0x1')],'comment':_0xfc82('0xc')},'data4':{'type':Sequelize[_0xfc82('0x1')],'comment':_0xfc82('0xd')},'data5':{'type':Sequelize[_0xfc82('0x1')],'comment':_0xfc82('0xe')},'role':{'type':Sequelize[_0xfc82('0x1')]},'internal':{'type':Sequelize[_0xfc82('0xf')]},'uniqueid':{'type':Sequelize[_0xfc82('0x1')]}}; \ No newline at end of file +var _0xc00c=['sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x507126,_0x3dd5c3){var _0x5ca642=function(_0x3e56c9){while(--_0x3e56c9){_0x507126['push'](_0x507126['shift']());}};_0x5ca642(++_0x3dd5c3);}(_0xc00c,0xa0));var _0xcc00=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xc00c[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0xcc00('0x0'));var moment=require('moment');module[_0xcc00('0x1')]={'channel':{'type':Sequelize[_0xcc00('0x2')]},'membername':{'type':Sequelize[_0xcc00('0x2')]},'interface':{'type':Sequelize[_0xcc00('0x2')]},'type':{'type':Sequelize[_0xcc00('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xcc00('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xcc00('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4d2b55){var _0x217333=moment(_0x4d2b55);var _0x3aff04=moment(this[_0xcc00('0x5')](_0xcc00('0x6')));var _0x42690b=_0x217333[_0xcc00('0x7')](_0x3aff04,_0xcc00('0x8'));this[_0xcc00('0x9')](_0xcc00('0xa'),_0x4d2b55);this[_0xcc00('0x9')](_0xcc00('0xb'),_0x42690b||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xcc00('0x2')],'comment':_0xcc00('0xc')},'data3':{'type':Sequelize[_0xcc00('0x2')],'comment':_0xcc00('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xcc00('0xe')},'data5':{'type':Sequelize[_0xcc00('0x2')],'comment':_0xcc00('0xf')},'role':{'type':Sequelize[_0xcc00('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xcc00('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 891a4c1..88ee09d 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 _0x428d=['show','rawAttributes','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','MemberReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x428d,0xd7));var _0xd428=function(_0x4b6576,_0x44c2d8){_0x4b6576=_0x4b6576-0x0;var _0x30b384=_0x428d[_0x4b6576];return _0x30b384;};'use strict';var pdf=require(_0xd428('0x0'));var emlformat=require(_0xd428('0x1'));var rimraf=require(_0xd428('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd428('0x3'));var moment=require(_0xd428('0x4'));var BPromise=require(_0xd428('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd428('0x6'));var csv=require(_0xd428('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd428('0x8'));var crypto=require(_0xd428('0x9'));var jsforce=require(_0xd428('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd428('0x7'));var querystring=require(_0xd428('0xb'));var Papa=require(_0xd428('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd428('0xd'));var as=require(_0xd428('0xe'));var hardwareService=require(_0xd428('0xf'));var logger=require(_0xd428('0x10'))(_0xd428('0x11'));var utils=require('../../config/utils');var config=require(_0xd428('0x12'));var licenseUtil=require(_0xd428('0x13'));var db=require(_0xd428('0x14'))['db'];function respondWithStatusCode(_0x3e5595,_0x5c2cbd){_0x5c2cbd=_0x5c2cbd||0xcc;return function(_0xb0cfa6){if(_0xb0cfa6){return _0x3e5595[_0xd428('0x15')](_0x5c2cbd);}return _0x3e5595[_0xd428('0x16')](_0x5c2cbd)['end']();};}function respondWithResult(_0x34ce06,_0x244928){_0x244928=_0x244928||0xc8;return function(_0x2b9a48){if(_0x2b9a48){return _0x34ce06[_0xd428('0x16')](_0x244928)[_0xd428('0x17')](_0x2b9a48);}};}function respondWithFilteredResult(_0x99c76a,_0x22b0ae){return function(_0x7fd1d3){if(_0x7fd1d3){var _0x57901f=_0x7fd1d3[_0xd428('0x18')],_0x1f36a1=_0x22b0ae[_0xd428('0x19')],_0x4bfe8a=_0x22b0ae[_0xd428('0x19')]+_0x22b0ae[_0xd428('0x1a')],_0x29fc10;if(_0x4bfe8a>=_0x57901f){_0x4bfe8a=_0x57901f;_0x29fc10=0xc8;}else{_0x29fc10=0xce;}_0x99c76a[_0xd428('0x16')](_0x29fc10);return _0x99c76a[_0xd428('0x1b')](_0xd428('0x1c'),_0x1f36a1+'-'+_0x4bfe8a+'/'+_0x57901f)['json'](_0x7fd1d3);}return null;};}function patchUpdates(_0x4a3f72){return function(_0xd64b11){try{jsonpatch[_0xd428('0x1d')](_0xd64b11,_0x4a3f72,!![]);}catch(_0x5218bd){return BPromise['reject'](_0x5218bd);}return _0xd64b11['save']();};}function saveUpdates(_0x43c2aa,_0x21fd10){return function(_0x3812b5){if(_0x3812b5){return _0x3812b5[_0xd428('0x1e')](_0x43c2aa)[_0xd428('0x1f')](function(_0x21d76a){return _0x21d76a;});}return null;};}function removeEntity(_0x4fd1d2,_0x105ce9){return function(_0x39398b){if(_0x39398b){return _0x39398b[_0xd428('0x20')]()[_0xd428('0x1f')](function(){_0x4fd1d2[_0xd428('0x16')](0xcc)[_0xd428('0x21')]();});}};}function handleEntityNotFound(_0x2c2dc,_0x260d6f){return function(_0x3c2f95){if(!_0x3c2f95){_0x2c2dc[_0xd428('0x15')](0x194);}return _0x3c2f95;};}function handleError(_0x48b968,_0x3acf92){_0x3acf92=_0x3acf92||0x1f4;return function(_0x1b439f){logger[_0xd428('0x22')](_0x1b439f['stack']);if(_0x1b439f['name']){delete _0x1b439f[_0xd428('0x23')];}_0x48b968[_0xd428('0x16')](_0x3acf92)[_0xd428('0x24')](_0x1b439f);};}exports[_0xd428('0x25')]=function(_0x4954fb,_0x46f369){var _0x363e04={},_0x143b0f={},_0x5d6414={'count':0x0,'rows':[]};var _0x479234=_[_0xd428('0x26')](db[_0xd428('0x27')]['rawAttributes'],function(_0x29150e){return{'name':_0x29150e['fieldName'],'type':_0x29150e[_0xd428('0x28')][_0xd428('0x29')]};});_0x143b0f['model']=_['map'](_0x479234,_0xd428('0x23'));_0x143b0f[_0xd428('0x2a')]=_[_0xd428('0x2b')](_0x4954fb[_0xd428('0x2a')]);_0x143b0f[_0xd428('0x2c')]=_[_0xd428('0x2d')](_0x143b0f[_0xd428('0x2e')],_0x143b0f[_0xd428('0x2a')]);_0x363e04[_0xd428('0x2f')]=_[_0xd428('0x2d')](_0x143b0f[_0xd428('0x2e')],qs[_0xd428('0x30')](_0x4954fb['query']['fields']));_0x363e04['attributes']=_0x363e04[_0xd428('0x2f')][_0xd428('0x31')]?_0x363e04['attributes']:_0x143b0f['model'];if(!_0x4954fb[_0xd428('0x2a')]['hasOwnProperty']('nolimit')){_0x363e04[_0xd428('0x1a')]=qs[_0xd428('0x1a')](_0x4954fb['query']['limit']);_0x363e04['offset']=qs[_0xd428('0x19')](_0x4954fb[_0xd428('0x2a')][_0xd428('0x19')]);}_0x363e04[_0xd428('0x32')]=qs['sort'](_0x4954fb[_0xd428('0x2a')][_0xd428('0x33')]);_0x363e04[_0xd428('0x34')]=qs[_0xd428('0x2c')](_[_0xd428('0x35')](_0x4954fb['query'],_0x143b0f[_0xd428('0x2c')]),_0x479234);if(_0x4954fb[_0xd428('0x2a')][_0xd428('0x36')]){_0x363e04['where']=_[_0xd428('0x37')](_0x363e04[_0xd428('0x34')],{'$or':_[_0xd428('0x26')](_0x479234,function(_0x268410){if(_0x268410[_0xd428('0x28')]!=='VIRTUAL'){var _0x334d1c={};_0x334d1c[_0x268410['name']]={'$like':'%'+_0x4954fb[_0xd428('0x2a')][_0xd428('0x36')]+'%'};return _0x334d1c;}})});}_0x363e04=_['merge']({},_0x363e04,_0x4954fb['options']);var _0x5281e3={'where':_0x363e04[_0xd428('0x34')]};return db[_0xd428('0x27')][_0xd428('0x18')](_0x5281e3)[_0xd428('0x1f')](function(_0x20711a){_0x5d6414['count']=_0x20711a;if(_0x4954fb[_0xd428('0x2a')][_0xd428('0x38')]){_0x363e04[_0xd428('0x39')]=[{'all':!![]}];}return db['MemberReport'][_0xd428('0x3a')](_0x363e04);})['then'](function(_0x313faa){_0x5d6414[_0xd428('0x3b')]=_0x313faa;return _0x5d6414;})[_0xd428('0x1f')](respondWithFilteredResult(_0x46f369,_0x363e04))[_0xd428('0x3c')](handleError(_0x46f369,null));};exports[_0xd428('0x3d')]=function(_0x377628,_0x13dd04){var _0x59951a={'raw':!![],'where':{'id':_0x377628['params']['id']}},_0x21ce43={};_0x21ce43[_0xd428('0x2e')]=_[_0xd428('0x2b')](db[_0xd428('0x27')][_0xd428('0x3e')]);_0x21ce43[_0xd428('0x2a')]=_[_0xd428('0x2b')](_0x377628[_0xd428('0x2a')]);_0x21ce43[_0xd428('0x2c')]=_[_0xd428('0x2d')](_0x21ce43[_0xd428('0x2e')],_0x21ce43[_0xd428('0x2a')]);_0x59951a['attributes']=_[_0xd428('0x2d')](_0x21ce43[_0xd428('0x2e')],qs[_0xd428('0x30')](_0x377628['query'][_0xd428('0x30')]));_0x59951a[_0xd428('0x2f')]=_0x59951a[_0xd428('0x2f')]['length']?_0x59951a[_0xd428('0x2f')]:_0x21ce43['model'];if(_0x377628[_0xd428('0x2a')][_0xd428('0x38')]){_0x59951a[_0xd428('0x39')]=[{'all':!![]}];}_0x59951a=_['merge']({},_0x59951a,_0x377628[_0xd428('0x3f')]);return db['MemberReport'][_0xd428('0x40')](_0x59951a)[_0xd428('0x1f')](handleEntityNotFound(_0x13dd04,null))[_0xd428('0x1f')](respondWithResult(_0x13dd04,null))[_0xd428('0x3c')](handleError(_0x13dd04,null));};exports[_0xd428('0x41')]=function(_0x541f39,_0x36b543){return db[_0xd428('0x27')][_0xd428('0x41')](_0x541f39[_0xd428('0x42')],{})['then'](respondWithResult(_0x36b543,0xc9))[_0xd428('0x3c')](handleError(_0x36b543,null));};exports[_0xd428('0x1e')]=function(_0x357292,_0x44f5bc){if(_0x357292[_0xd428('0x42')]['id']){delete _0x357292[_0xd428('0x42')]['id'];}return db[_0xd428('0x27')]['find']({'where':{'id':_0x357292[_0xd428('0x43')]['id']}})['then'](handleEntityNotFound(_0x44f5bc,null))[_0xd428('0x1f')](saveUpdates(_0x357292[_0xd428('0x42')],null))[_0xd428('0x1f')](respondWithResult(_0x44f5bc,null))['catch'](handleError(_0x44f5bc,null));};exports[_0xd428('0x20')]=function(_0x5543d6,_0x5d90f9){return db[_0xd428('0x27')][_0xd428('0x40')]({'where':{'id':_0x5543d6['params']['id']}})[_0xd428('0x1f')](handleEntityNotFound(_0x5d90f9,null))[_0xd428('0x1f')](removeEntity(_0x5d90f9,null))['catch'](handleError(_0x5d90f9,null));};exports[_0xd428('0x44')]=function(_0x3ec53c,_0x1b74fe){return db[_0xd428('0x27')][_0xd428('0x44')]()[_0xd428('0x1f')](respondWithResult(_0x1b74fe,null))[_0xd428('0x3c')](handleError(_0x1b74fe,null));}; \ No newline at end of file +var _0x4659=['MemberReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','params','find','body','describe','html-pdf','rimraf','zip-dir','moment','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','update','destroy','then','end','error','name','index','map'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4659,0x1ae));var _0x9465=function(_0x3ee1e1,_0x5d79c3){_0x3ee1e1=_0x3ee1e1-0x0;var _0x1b8406=_0x4659[_0x3ee1e1];return _0x1b8406;};'use strict';var pdf=require(_0x9465('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9465('0x1'));var zipdir=require(_0x9465('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9465('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9465('0x4'));var util=require(_0x9465('0x5'));var path=require('path');var sox=require(_0x9465('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9465('0x7'));var squel=require(_0x9465('0x8'));var crypto=require('crypto');var jsforce=require(_0x9465('0x9'));var deskjs=require(_0x9465('0xa'));var toCsv=require(_0x9465('0xb'));var querystring=require('querystring');var Papa=require(_0x9465('0xc'));var Redis=require(_0x9465('0xd'));var authService=require(_0x9465('0xe'));var qs=require(_0x9465('0xf'));var as=require(_0x9465('0x10'));var hardwareService=require(_0x9465('0x11'));var logger=require('../../config/logger')(_0x9465('0x12'));var utils=require(_0x9465('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9465('0x14'));var db=require(_0x9465('0x15'))['db'];function respondWithStatusCode(_0x14e227,_0x31425d){_0x31425d=_0x31425d||0xcc;return function(_0x37ca61){if(_0x37ca61){return _0x14e227[_0x9465('0x16')](_0x31425d);}return _0x14e227['status'](_0x31425d)['end']();};}function respondWithResult(_0x2016d2,_0x1b2c23){_0x1b2c23=_0x1b2c23||0xc8;return function(_0x54e8cc){if(_0x54e8cc){return _0x2016d2['status'](_0x1b2c23)[_0x9465('0x17')](_0x54e8cc);}};}function respondWithFilteredResult(_0x4bd45e,_0xa5e9bf){return function(_0x1fe8be){if(_0x1fe8be){var _0x3d3614=_0x1fe8be[_0x9465('0x18')],_0x3ad365=_0xa5e9bf[_0x9465('0x19')],_0x2b2871=_0xa5e9bf[_0x9465('0x19')]+_0xa5e9bf[_0x9465('0x1a')],_0xafe12b;if(_0x2b2871>=_0x3d3614){_0x2b2871=_0x3d3614;_0xafe12b=0xc8;}else{_0xafe12b=0xce;}_0x4bd45e[_0x9465('0x1b')](_0xafe12b);return _0x4bd45e[_0x9465('0x1c')](_0x9465('0x1d'),_0x3ad365+'-'+_0x2b2871+'/'+_0x3d3614)[_0x9465('0x17')](_0x1fe8be);}return null;};}function patchUpdates(_0x55549c){return function(_0x1176f1){try{jsonpatch['apply'](_0x1176f1,_0x55549c,!![]);}catch(_0x3d3af3){return BPromise[_0x9465('0x1e')](_0x3d3af3);}return _0x1176f1['save']();};}function saveUpdates(_0x15076a,_0x49259d){return function(_0x6c595d){if(_0x6c595d){return _0x6c595d[_0x9465('0x1f')](_0x15076a)['then'](function(_0x6a1a1f){return _0x6a1a1f;});}return null;};}function removeEntity(_0x41fcdd,_0x273282){return function(_0x5c4157){if(_0x5c4157){return _0x5c4157[_0x9465('0x20')]()[_0x9465('0x21')](function(){_0x41fcdd[_0x9465('0x1b')](0xcc)[_0x9465('0x22')]();});}};}function handleEntityNotFound(_0x5656bc,_0xae63fc){return function(_0x2c794c){if(!_0x2c794c){_0x5656bc[_0x9465('0x16')](0x194);}return _0x2c794c;};}function handleError(_0x3a4010,_0x425fdf){_0x425fdf=_0x425fdf||0x1f4;return function(_0x2ed665){logger[_0x9465('0x23')](_0x2ed665['stack']);if(_0x2ed665[_0x9465('0x24')]){delete _0x2ed665['name'];}_0x3a4010['status'](_0x425fdf)['send'](_0x2ed665);};}exports[_0x9465('0x25')]=function(_0x362d4c,_0x520d78){var _0x29eb98={},_0x31fbab={},_0x218c2d={'count':0x0,'rows':[]};var _0x5347dc=_[_0x9465('0x26')](db[_0x9465('0x27')][_0x9465('0x28')],function(_0x4b6272){return{'name':_0x4b6272[_0x9465('0x29')],'type':_0x4b6272[_0x9465('0x2a')][_0x9465('0x2b')]};});_0x31fbab[_0x9465('0x2c')]=_[_0x9465('0x26')](_0x5347dc,'name');_0x31fbab[_0x9465('0x2d')]=_[_0x9465('0x2e')](_0x362d4c[_0x9465('0x2d')]);_0x31fbab[_0x9465('0x2f')]=_['intersection'](_0x31fbab['model'],_0x31fbab[_0x9465('0x2d')]);_0x29eb98['attributes']=_[_0x9465('0x30')](_0x31fbab[_0x9465('0x2c')],qs['fields'](_0x362d4c[_0x9465('0x2d')][_0x9465('0x31')]));_0x29eb98[_0x9465('0x32')]=_0x29eb98[_0x9465('0x32')][_0x9465('0x33')]?_0x29eb98['attributes']:_0x31fbab[_0x9465('0x2c')];if(!_0x362d4c[_0x9465('0x2d')][_0x9465('0x34')]('nolimit')){_0x29eb98[_0x9465('0x1a')]=qs[_0x9465('0x1a')](_0x362d4c['query'][_0x9465('0x1a')]);_0x29eb98[_0x9465('0x19')]=qs['offset'](_0x362d4c[_0x9465('0x2d')][_0x9465('0x19')]);}_0x29eb98[_0x9465('0x35')]=qs['sort'](_0x362d4c[_0x9465('0x2d')][_0x9465('0x36')]);_0x29eb98[_0x9465('0x37')]=qs[_0x9465('0x2f')](_['pick'](_0x362d4c[_0x9465('0x2d')],_0x31fbab[_0x9465('0x2f')]),_0x5347dc);if(_0x362d4c['query'][_0x9465('0x38')]){_0x29eb98['where']=_[_0x9465('0x39')](_0x29eb98[_0x9465('0x37')],{'$or':_[_0x9465('0x26')](_0x5347dc,function(_0x3d79e3){if(_0x3d79e3['type']!==_0x9465('0x3a')){var _0x37dc27={};_0x37dc27[_0x3d79e3['name']]={'$like':'%'+_0x362d4c[_0x9465('0x2d')][_0x9465('0x38')]+'%'};return _0x37dc27;}})});}_0x29eb98=_['merge']({},_0x29eb98,_0x362d4c[_0x9465('0x3b')]);var _0x1d1810={'where':_0x29eb98[_0x9465('0x37')]};return db[_0x9465('0x27')][_0x9465('0x18')](_0x1d1810)[_0x9465('0x21')](function(_0x58bbdb){_0x218c2d[_0x9465('0x18')]=_0x58bbdb;if(_0x362d4c[_0x9465('0x2d')][_0x9465('0x3c')]){_0x29eb98['include']=[{'all':!![]}];}return db[_0x9465('0x27')]['findAll'](_0x29eb98);})[_0x9465('0x21')](function(_0x5eb998){_0x218c2d['rows']=_0x5eb998;return _0x218c2d;})['then'](respondWithFilteredResult(_0x520d78,_0x29eb98))[_0x9465('0x3d')](handleError(_0x520d78,null));};exports[_0x9465('0x3e')]=function(_0x503286,_0xf2e106){var _0x2914a9={'raw':!![],'where':{'id':_0x503286[_0x9465('0x3f')]['id']}},_0x273539={};_0x273539[_0x9465('0x2c')]=_[_0x9465('0x2e')](db[_0x9465('0x27')]['rawAttributes']);_0x273539['query']=_[_0x9465('0x2e')](_0x503286[_0x9465('0x2d')]);_0x273539[_0x9465('0x2f')]=_[_0x9465('0x30')](_0x273539['model'],_0x273539['query']);_0x2914a9[_0x9465('0x32')]=_['intersection'](_0x273539[_0x9465('0x2c')],qs['fields'](_0x503286[_0x9465('0x2d')][_0x9465('0x31')]));_0x2914a9[_0x9465('0x32')]=_0x2914a9[_0x9465('0x32')][_0x9465('0x33')]?_0x2914a9[_0x9465('0x32')]:_0x273539[_0x9465('0x2c')];if(_0x503286[_0x9465('0x2d')]['includeAll']){_0x2914a9['include']=[{'all':!![]}];}_0x2914a9=_[_0x9465('0x39')]({},_0x2914a9,_0x503286[_0x9465('0x3b')]);return db[_0x9465('0x27')][_0x9465('0x40')](_0x2914a9)[_0x9465('0x21')](handleEntityNotFound(_0xf2e106,null))[_0x9465('0x21')](respondWithResult(_0xf2e106,null))[_0x9465('0x3d')](handleError(_0xf2e106,null));};exports['create']=function(_0x4bf0f8,_0x26313d){return db['MemberReport']['create'](_0x4bf0f8['body'],{})[_0x9465('0x21')](respondWithResult(_0x26313d,0xc9))[_0x9465('0x3d')](handleError(_0x26313d,null));};exports[_0x9465('0x1f')]=function(_0x4c076c,_0x421030){if(_0x4c076c[_0x9465('0x41')]['id']){delete _0x4c076c['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x4c076c[_0x9465('0x3f')]['id']}})['then'](handleEntityNotFound(_0x421030,null))['then'](saveUpdates(_0x4c076c[_0x9465('0x41')],null))[_0x9465('0x21')](respondWithResult(_0x421030,null))[_0x9465('0x3d')](handleError(_0x421030,null));};exports[_0x9465('0x20')]=function(_0x128309,_0x4501ab){return db[_0x9465('0x27')][_0x9465('0x40')]({'where':{'id':_0x128309[_0x9465('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4501ab,null))['then'](removeEntity(_0x4501ab,null))[_0x9465('0x3d')](handleError(_0x4501ab,null));};exports[_0x9465('0x42')]=function(_0x43fd8c,_0x3719f5){return db[_0x9465('0x27')][_0x9465('0x42')]()[_0x9465('0x21')](respondWithResult(_0x3719f5,null))[_0x9465('0x3d')](handleError(_0x3719f5,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index adf0e0b..e1d4994 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 _0x7899=['interface','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername'];(function(_0x445cb4,_0x1aff06){var _0x43c5c8=function(_0x90eafa){while(--_0x90eafa){_0x445cb4['push'](_0x445cb4['shift']());}};_0x43c5c8(++_0x1aff06);}(_0x7899,0xd1));var _0x9789=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x7899[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0x9789('0x0'));var util=require('util');var logger=require(_0x9789('0x1'))(_0x9789('0x2'));var moment=require(_0x9789('0x3'));var BPromise=require(_0x9789('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9789('0x5'));var rimraf=require(_0x9789('0x6'));var config=require(_0x9789('0x7'));var attributes=require(_0x9789('0x8'));module[_0x9789('0x9')]=function(_0x4584e6,_0x1d765a){return _0x4584e6[_0x9789('0xa')](_0x9789('0xb'),attributes,{'tableName':_0x9789('0xc'),'paranoid':![],'indexes':[{'name':_0x9789('0xd'),'fields':[_0x9789('0xe'),_0x9789('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe905=['rimraf','../../config/environment','exports','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x26ffb6,_0x6e5d57){var _0x1cb990=function(_0x2e8c09){while(--_0x2e8c09){_0x26ffb6['push'](_0x26ffb6['shift']());}};_0x1cb990(++_0x6e5d57);}(_0xe905,0x103));var _0x5e90=function(_0x1df52e,_0x296536){_0x1df52e=_0x1df52e-0x0;var _0x3a85d6=_0xe905[_0x1df52e];return _0x3a85d6;};'use strict';var _=require(_0x5e90('0x0'));var util=require(_0x5e90('0x1'));var logger=require(_0x5e90('0x2'))('api');var moment=require(_0x5e90('0x3'));var BPromise=require(_0x5e90('0x4'));var rp=require(_0x5e90('0x5'));var fs=require('fs');var path=require(_0x5e90('0x6'));var rimraf=require(_0x5e90('0x7'));var config=require(_0x5e90('0x8'));var attributes=require('./memberReport.attributes');module[_0x5e90('0x9')]=function(_0x6e1a6a,_0x36307f){return _0x6e1a6a['define']('MemberReport',attributes,{'tableName':_0x5e90('0xa'),'paranoid':![],'indexes':[{'name':_0x5e90('0xb'),'fields':[_0x5e90('0xc'),_0x5e90('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 e4df6b4..a746ae0 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 _0x2d51=['catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','create','CreateMemberReport','UpdateMemberReport','body','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3620f3,_0x5ef1f7){var _0x51e748=function(_0x432e1b){while(--_0x432e1b){_0x3620f3['push'](_0x3620f3['shift']());}};_0x51e748(++_0x5ef1f7);}(_0x2d51,0xb4));var _0x12d5=function(_0x5b27f2,_0x2b6b67){_0x5b27f2=_0x5b27f2-0x0;var _0x4a4b85=_0x2d51[_0x5b27f2];return _0x4a4b85;};'use strict';var _=require(_0x12d5('0x0'));var util=require(_0x12d5('0x1'));var moment=require(_0x12d5('0x2'));var BPromise=require(_0x12d5('0x3'));var rs=require(_0x12d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12d5('0x5'))['db'];var utils=require(_0x12d5('0x6'));var logger=require(_0x12d5('0x7'))(_0x12d5('0x8'));var config=require(_0x12d5('0x9'));var jayson=require(_0x12d5('0xa'));var client=jayson[_0x12d5('0xb')][_0x12d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36990b,_0x3d67c4,_0x4d38e8){return new BPromise(function(_0x298ef4,_0xe1ad95){return client[_0x12d5('0xd')](_0x36990b,_0x4d38e8)[_0x12d5('0xe')](function(_0x215fd9){logger[_0x12d5('0xf')](_0x12d5('0x10'),_0x3d67c4,_0x12d5('0x11'));logger[_0x12d5('0x12')](_0x12d5('0x13'),_0x3d67c4,'request\x20sent',JSON[_0x12d5('0x14')](_0x215fd9));if(_0x215fd9['error']){if(_0x215fd9[_0x12d5('0x15')][_0x12d5('0x16')]===0x1f4){logger[_0x12d5('0x15')](_0x12d5('0x10'),_0x3d67c4,_0x215fd9['error'][_0x12d5('0x17')]);return _0xe1ad95(_0x215fd9[_0x12d5('0x15')]['message']);}logger['error']('MemberReport,\x20%s,\x20%s',_0x3d67c4,_0x215fd9[_0x12d5('0x15')][_0x12d5('0x17')]);return _0x298ef4(_0x215fd9[_0x12d5('0x15')]['message']);}else{logger[_0x12d5('0xf')](_0x12d5('0x10'),_0x3d67c4,_0x12d5('0x11'));_0x298ef4(_0x215fd9[_0x12d5('0x18')][_0x12d5('0x17')]);}})[_0x12d5('0x19')](function(_0x4d10e1){logger[_0x12d5('0x15')](_0x12d5('0x10'),_0x3d67c4,_0x4d10e1);_0xe1ad95(_0x4d10e1);});});}exports[_0x12d5('0x1a')]=function(_0x177d0d){var _0x380f4e=this;return new Promise(function(_0x1dbbd3,_0x14a762){return db[_0x12d5('0x1b')][_0x12d5('0x1c')]({'raw':_0x177d0d[_0x12d5('0x1d')]?_0x177d0d[_0x12d5('0x1d')][_0x12d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x177d0d[_0x12d5('0x1d')]?_0x177d0d[_0x12d5('0x1d')][_0x12d5('0x1f')]||null:null,'attributes':_0x177d0d[_0x12d5('0x1d')]?_0x177d0d[_0x12d5('0x1d')]['attributes']||null:null,'limit':_0x177d0d['options']?_0x177d0d['options'][_0x12d5('0x20')]||null:null,'include':_0x177d0d[_0x12d5('0x1d')]?_0x177d0d['options'][_0x12d5('0x21')]?_[_0x12d5('0x22')](_0x177d0d[_0x12d5('0x1d')]['include'],function(_0x4034d0){return{'model':db[_0x4034d0[_0x12d5('0x23')]],'as':_0x4034d0['as'],'attributes':_0x4034d0[_0x12d5('0x24')],'include':_0x4034d0[_0x12d5('0x21')]?_[_0x12d5('0x22')](_0x4034d0['include'],function(_0xfecda6){return{'model':db[_0xfecda6[_0x12d5('0x23')]],'as':_0xfecda6['as'],'attributes':_0xfecda6[_0x12d5('0x24')],'include':_0xfecda6[_0x12d5('0x21')]?_[_0x12d5('0x22')](_0xfecda6[_0x12d5('0x21')],function(_0x21ef52){return{'model':db[_0x21ef52['model']],'as':_0x21ef52['as'],'attributes':_0x21ef52[_0x12d5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x12d5('0xe')](function(_0x59e117){logger[_0x12d5('0xf')](_0x12d5('0x1a'),_0x177d0d);logger['debug'](_0x12d5('0x1a'),_0x177d0d,JSON['stringify'](_0x59e117));_0x1dbbd3(_0x59e117);})['catch'](function(_0x186d1e){logger[_0x12d5('0x15')]('GetMemberReport',_0x186d1e[_0x12d5('0x17')],_0x177d0d);_0x14a762(_0x380f4e[_0x12d5('0x15')](0x1f4,_0x186d1e['message']));});});};exports['CreateMemberReport']=function(_0x2baae0){var _0x28e88e=this;return new Promise(function(_0x13a4ac,_0x5d9be2){return db['MemberReport'][_0x12d5('0x25')](_0x2baae0['body'],{'raw':_0x2baae0[_0x12d5('0x1d')]?_0x2baae0[_0x12d5('0x1d')][_0x12d5('0x1e')]===undefined?!![]:![]:!![]})[_0x12d5('0xe')](function(_0xd0e27e){logger['info']('CreateMemberReport',_0x2baae0);logger[_0x12d5('0x12')]('CreateMemberReport',_0x2baae0,JSON[_0x12d5('0x14')](_0xd0e27e));_0x13a4ac(_0xd0e27e);})[_0x12d5('0x19')](function(_0x36502f){logger[_0x12d5('0x15')](_0x12d5('0x26'),_0x36502f['message'],_0x2baae0);_0x5d9be2(_0x28e88e[_0x12d5('0x15')](0x1f4,_0x36502f[_0x12d5('0x17')]));});});};exports[_0x12d5('0x27')]=function(_0x93476e){var _0x34a231=this;return new Promise(function(_0x218df9,_0x2a0581){return db['MemberReport']['update'](_0x93476e[_0x12d5('0x28')],{'raw':_0x93476e[_0x12d5('0x1d')]?_0x93476e[_0x12d5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x93476e[_0x12d5('0x1d')]?_0x93476e[_0x12d5('0x1d')][_0x12d5('0x1f')]||null:null,'attributes':_0x93476e[_0x12d5('0x1d')]?_0x93476e[_0x12d5('0x1d')][_0x12d5('0x24')]||null:null,'limit':_0x93476e[_0x12d5('0x1d')]?_0x93476e[_0x12d5('0x1d')][_0x12d5('0x20')]||null:null})['then'](function(_0x2d0708){logger[_0x12d5('0xf')](_0x12d5('0x27'),_0x93476e);logger[_0x12d5('0x12')](_0x12d5('0x27'),_0x93476e,JSON[_0x12d5('0x14')](_0x2d0708));_0x218df9(_0x2d0708);})[_0x12d5('0x19')](function(_0x3a21b8){logger[_0x12d5('0x15')]('UpdateMemberReport',_0x3a21b8[_0x12d5('0x17')],_0x93476e);_0x2a0581(_0x34a231[_0x12d5('0x15')](0x1f4,_0x3a21b8[_0x12d5('0x17')]));});});}; \ No newline at end of file +var _0x0da8=['options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MemberReport','findAll'];(function(_0x4e7f1b,_0x59090b){var _0x28c9c3=function(_0xae6eb0){while(--_0xae6eb0){_0x4e7f1b['push'](_0x4e7f1b['shift']());}};_0x28c9c3(++_0x59090b);}(_0x0da8,0x78));var _0x80da=function(_0x1d0764,_0x2beb7c){_0x1d0764=_0x1d0764-0x0;var _0x423f49=_0x0da8[_0x1d0764];return _0x423f49;};'use strict';var _=require(_0x80da('0x0'));var util=require(_0x80da('0x1'));var moment=require(_0x80da('0x2'));var BPromise=require('bluebird');var rs=require(_0x80da('0x3'));var fs=require('fs');var Redis=require(_0x80da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x80da('0x5'));var logger=require(_0x80da('0x6'))(_0x80da('0x7'));var config=require(_0x80da('0x8'));var jayson=require(_0x80da('0x9'));var client=jayson[_0x80da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee0f1,_0x1f6d90,_0x4420a3){return new BPromise(function(_0x2e4c5e,_0x5040f1){return client['request'](_0x1ee0f1,_0x4420a3)[_0x80da('0xb')](function(_0x1fc908){logger['info'](_0x80da('0xc'),_0x1f6d90,_0x80da('0xd'));logger[_0x80da('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x1f6d90,'request\x20sent',JSON[_0x80da('0xf')](_0x1fc908));if(_0x1fc908[_0x80da('0x10')]){if(_0x1fc908[_0x80da('0x10')][_0x80da('0x11')]===0x1f4){logger[_0x80da('0x10')](_0x80da('0xc'),_0x1f6d90,_0x1fc908[_0x80da('0x10')]['message']);return _0x5040f1(_0x1fc908[_0x80da('0x10')]['message']);}logger[_0x80da('0x10')](_0x80da('0xc'),_0x1f6d90,_0x1fc908['error']['message']);return _0x2e4c5e(_0x1fc908[_0x80da('0x10')][_0x80da('0x12')]);}else{logger[_0x80da('0x13')](_0x80da('0xc'),_0x1f6d90,'request\x20sent');_0x2e4c5e(_0x1fc908[_0x80da('0x14')][_0x80da('0x12')]);}})[_0x80da('0x15')](function(_0x1f2c69){logger['error'](_0x80da('0xc'),_0x1f6d90,_0x1f2c69);_0x5040f1(_0x1f2c69);});});}exports['GetMemberReport']=function(_0x220dec){var _0x5b9bca=this;return new Promise(function(_0x2243ed,_0x138659){return db[_0x80da('0x16')][_0x80da('0x17')]({'raw':_0x220dec[_0x80da('0x18')]?_0x220dec[_0x80da('0x18')][_0x80da('0x19')]===undefined?!![]:![]:!![],'where':_0x220dec[_0x80da('0x18')]?_0x220dec['options']['where']||null:null,'attributes':_0x220dec[_0x80da('0x18')]?_0x220dec[_0x80da('0x18')][_0x80da('0x1a')]||null:null,'limit':_0x220dec[_0x80da('0x18')]?_0x220dec['options'][_0x80da('0x1b')]||null:null,'include':_0x220dec[_0x80da('0x18')]?_0x220dec[_0x80da('0x18')][_0x80da('0x1c')]?_[_0x80da('0x1d')](_0x220dec[_0x80da('0x18')][_0x80da('0x1c')],function(_0x270d42){return{'model':db[_0x270d42['model']],'as':_0x270d42['as'],'attributes':_0x270d42[_0x80da('0x1a')],'include':_0x270d42[_0x80da('0x1c')]?_[_0x80da('0x1d')](_0x270d42[_0x80da('0x1c')],function(_0x33ff92){return{'model':db[_0x33ff92[_0x80da('0x1e')]],'as':_0x33ff92['as'],'attributes':_0x33ff92['attributes'],'include':_0x33ff92[_0x80da('0x1c')]?_[_0x80da('0x1d')](_0x33ff92['include'],function(_0x379d88){return{'model':db[_0x379d88[_0x80da('0x1e')]],'as':_0x379d88['as'],'attributes':_0x379d88[_0x80da('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47f661){logger[_0x80da('0x13')](_0x80da('0x1f'),_0x220dec);logger[_0x80da('0xe')](_0x80da('0x1f'),_0x220dec,JSON[_0x80da('0xf')](_0x47f661));_0x2243ed(_0x47f661);})[_0x80da('0x15')](function(_0x4b7af3){logger['error'](_0x80da('0x1f'),_0x4b7af3[_0x80da('0x12')],_0x220dec);_0x138659(_0x5b9bca[_0x80da('0x10')](0x1f4,_0x4b7af3[_0x80da('0x12')]));});});};exports[_0x80da('0x20')]=function(_0x482f3d){var _0xb25af8=this;return new Promise(function(_0x1602e9,_0x2692ed){return db[_0x80da('0x16')][_0x80da('0x21')](_0x482f3d[_0x80da('0x22')],{'raw':_0x482f3d['options']?_0x482f3d[_0x80da('0x18')][_0x80da('0x19')]===undefined?!![]:![]:!![]})[_0x80da('0xb')](function(_0x19fbf6){logger['info']('CreateMemberReport',_0x482f3d);logger[_0x80da('0xe')](_0x80da('0x20'),_0x482f3d,JSON[_0x80da('0xf')](_0x19fbf6));_0x1602e9(_0x19fbf6);})[_0x80da('0x15')](function(_0x4dadfc){logger[_0x80da('0x10')](_0x80da('0x20'),_0x4dadfc[_0x80da('0x12')],_0x482f3d);_0x2692ed(_0xb25af8[_0x80da('0x10')](0x1f4,_0x4dadfc[_0x80da('0x12')]));});});};exports[_0x80da('0x23')]=function(_0x3a036d){var _0x4cd58a=this;return new Promise(function(_0x9f55d3,_0x18a0f0){return db['MemberReport']['update'](_0x3a036d[_0x80da('0x22')],{'raw':_0x3a036d[_0x80da('0x18')]?_0x3a036d[_0x80da('0x18')][_0x80da('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a036d[_0x80da('0x18')]?_0x3a036d[_0x80da('0x18')]['where']||null:null,'attributes':_0x3a036d[_0x80da('0x18')]?_0x3a036d[_0x80da('0x18')][_0x80da('0x1a')]||null:null,'limit':_0x3a036d[_0x80da('0x18')]?_0x3a036d[_0x80da('0x18')][_0x80da('0x1b')]||null:null})[_0x80da('0xb')](function(_0x537eac){logger[_0x80da('0x13')](_0x80da('0x23'),_0x3a036d);logger['debug'](_0x80da('0x23'),_0x3a036d,JSON['stringify'](_0x537eac));_0x9f55d3(_0x537eac);})[_0x80da('0x15')](function(_0x31ad9a){logger[_0x80da('0x10')](_0x80da('0x23'),_0x31ad9a[_0x80da('0x12')],_0x3a036d);_0x18a0f0(_0x4cd58a[_0x80da('0x10')](0x1f4,_0x31ad9a['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1a5e76a..0280729 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 _0x58a4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout'];(function(_0x5c6696,_0x1e1607){var _0x2ad7a0=function(_0x2450a8){while(--_0x2450a8){_0x5c6696['push'](_0x5c6696['shift']());}};_0x2ad7a0(++_0x1e1607);}(_0x58a4,0xbf));var _0x458a=function(_0x17f2b7,_0x32a8b0){_0x17f2b7=_0x17f2b7-0x0;var _0x4164f6=_0x58a4[_0x17f2b7];return _0x4164f6;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var auth=require(_0x458a('0x6'));var interaction=require(_0x458a('0x7'));var config=require(_0x458a('0x8'));var controller=require(_0x458a('0x9'));router[_0x458a('0xa')]('/',controller[_0x458a('0xb')]);module[_0x458a('0xc')]=router; \ No newline at end of file +var _0xe2cf=['index','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x27a848,_0x2dfc9a){_0x27a848=_0x27a848-0x0;var _0x57dbb0=_0xe2cf[_0x27a848];return _0x57dbb0;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var auth=require(_0xfe2c('0x3'));var interaction=require(_0xfe2c('0x4'));var config=require(_0xfe2c('0x5'));var controller=require('./migration.controller');router[_0xfe2c('0x6')]('/',controller[_0xfe2c('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9356d56..0c00bc6 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 _0x54df=['sequelize','STRING'];(function(_0x12bb06,_0x12f4fd){var _0x3a942e=function(_0x579842){while(--_0x579842){_0x12bb06['push'](_0x12bb06['shift']());}};_0x3a942e(++_0x12f4fd);}(_0x54df,0xd6));var _0xf54d=function(_0x1effa9,_0x2de36c){_0x1effa9=_0x1effa9-0x0;var _0x1dd1ff=_0x54df[_0x1effa9];return _0x1dd1ff;};'use strict';var Sequelize=require(_0xf54d('0x0'));module['exports']={'version':{'type':Sequelize[_0xf54d('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x0ae4=['sequelize','exports','STRING'];(function(_0x1237f8,_0x4ea75a){var _0x3c2984=function(_0x578510){while(--_0x578510){_0x1237f8['push'](_0x1237f8['shift']());}};_0x3c2984(++_0x4ea75a);}(_0x0ae4,0x1e6));var _0x40ae=function(_0x2d2c32,_0x19bf14){_0x2d2c32=_0x2d2c32-0x0;var _0x4805fb=_0x0ae4[_0x2d2c32];return _0x4805fb;};'use strict';var Sequelize=require(_0x40ae('0x0'));module[_0x40ae('0x1')]={'version':{'type':Sequelize[_0x40ae('0x2')],'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 1798323..5e40fba 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 _0xb18f=['json','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Migration','include','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status'];(function(_0x349e64,_0x20cbbf){var _0x5ececa=function(_0x587199){while(--_0x587199){_0x349e64['push'](_0x349e64['shift']());}};_0x5ececa(++_0x20cbbf);}(_0xb18f,0x134));var _0xfb18=function(_0x543a5e,_0x33dd65){_0x543a5e=_0x543a5e-0x0;var _0x29afa6=_0xb18f[_0x543a5e];return _0x29afa6;};'use strict';var pdf=require(_0xfb18('0x0'));var emlformat=require(_0xfb18('0x1'));var rimraf=require(_0xfb18('0x2'));var zipdir=require(_0xfb18('0x3'));var jsonpatch=require(_0xfb18('0x4'));var rp=require(_0xfb18('0x5'));var moment=require(_0xfb18('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb18('0x7'));var path=require(_0xfb18('0x8'));var sox=require(_0xfb18('0x9'));var csv=require(_0xfb18('0xa'));var ejs=require(_0xfb18('0xb'));var fs=require('fs');var _=require(_0xfb18('0xc'));var squel=require(_0xfb18('0xd'));var crypto=require(_0xfb18('0xe'));var jsforce=require(_0xfb18('0xf'));var deskjs=require(_0xfb18('0x10'));var toCsv=require(_0xfb18('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb18('0x11'));var authService=require(_0xfb18('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfb18('0x13'));var hardwareService=require(_0xfb18('0x14'));var logger=require(_0xfb18('0x15'))(_0xfb18('0x16'));var utils=require('../../config/utils');var config=require(_0xfb18('0x17'));var licenseUtil=require(_0xfb18('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e98fa,_0x414d28){_0x414d28=_0x414d28||0xcc;return function(_0xdef9d7){if(_0xdef9d7){return _0x5e98fa['sendStatus'](_0x414d28);}return _0x5e98fa['status'](_0x414d28)[_0xfb18('0x19')]();};}function respondWithResult(_0x3f7198,_0x5b5672){_0x5b5672=_0x5b5672||0xc8;return function(_0x44cf5e){if(_0x44cf5e){return _0x3f7198[_0xfb18('0x1a')](_0x5b5672)[_0xfb18('0x1b')](_0x44cf5e);}};}function respondWithFilteredResult(_0x33749b,_0x4f40b){return function(_0x1c7f36){if(_0x1c7f36){var _0x465db0=_0x1c7f36[_0xfb18('0x1c')],_0x37beca=_0x4f40b[_0xfb18('0x1d')],_0x11cf6b=_0x4f40b[_0xfb18('0x1d')]+_0x4f40b['limit'],_0x24ea1a;if(_0x11cf6b>=_0x465db0){_0x11cf6b=_0x465db0;_0x24ea1a=0xc8;}else{_0x24ea1a=0xce;}_0x33749b[_0xfb18('0x1a')](_0x24ea1a);return _0x33749b['set'](_0xfb18('0x1e'),_0x37beca+'-'+_0x11cf6b+'/'+_0x465db0)['json'](_0x1c7f36);}return null;};}function patchUpdates(_0x5aeecc){return function(_0x5948c3){try{jsonpatch['apply'](_0x5948c3,_0x5aeecc,!![]);}catch(_0x138a39){return BPromise[_0xfb18('0x1f')](_0x138a39);}return _0x5948c3[_0xfb18('0x20')]();};}function saveUpdates(_0x3e8013,_0x101cef){return function(_0x50ec85){if(_0x50ec85){return _0x50ec85[_0xfb18('0x21')](_0x3e8013)[_0xfb18('0x22')](function(_0x2b87f4){return _0x2b87f4;});}return null;};}function removeEntity(_0x4539f9,_0xb2d475){return function(_0x1afadc){if(_0x1afadc){return _0x1afadc[_0xfb18('0x23')]()[_0xfb18('0x22')](function(){_0x4539f9[_0xfb18('0x1a')](0xcc)[_0xfb18('0x19')]();});}};}function handleEntityNotFound(_0x3b0124,_0x511741){return function(_0x28e172){if(!_0x28e172){_0x3b0124[_0xfb18('0x24')](0x194);}return _0x28e172;};}function handleError(_0x534270,_0x8bb20d){_0x8bb20d=_0x8bb20d||0x1f4;return function(_0x1f6d4d){logger[_0xfb18('0x25')](_0x1f6d4d[_0xfb18('0x26')]);if(_0x1f6d4d[_0xfb18('0x27')]){delete _0x1f6d4d['name'];}_0x534270[_0xfb18('0x1a')](_0x8bb20d)[_0xfb18('0x28')](_0x1f6d4d);};}exports['index']=function(_0x17e165,_0x3ab8aa){var _0x5bc264={},_0x5240c7={},_0x2bab49={'count':0x0,'rows':[]};var _0x5b98e3=_[_0xfb18('0x29')](db['Migration']['rawAttributes'],function(_0x23d6f9){return{'name':_0x23d6f9[_0xfb18('0x2a')],'type':_0x23d6f9[_0xfb18('0x2b')][_0xfb18('0x2c')]};});_0x5240c7[_0xfb18('0x2d')]=_['map'](_0x5b98e3,_0xfb18('0x27'));_0x5240c7[_0xfb18('0x2e')]=_[_0xfb18('0x2f')](_0x17e165[_0xfb18('0x2e')]);_0x5240c7['filters']=_[_0xfb18('0x30')](_0x5240c7[_0xfb18('0x2d')],_0x5240c7[_0xfb18('0x2e')]);_0x5bc264[_0xfb18('0x31')]=_[_0xfb18('0x30')](_0x5240c7[_0xfb18('0x2d')],qs[_0xfb18('0x32')](_0x17e165[_0xfb18('0x2e')][_0xfb18('0x32')]));_0x5bc264[_0xfb18('0x31')]=_0x5bc264['attributes'][_0xfb18('0x33')]?_0x5bc264[_0xfb18('0x31')]:_0x5240c7[_0xfb18('0x2d')];if(!_0x17e165['query'][_0xfb18('0x34')](_0xfb18('0x35'))){_0x5bc264['limit']=qs[_0xfb18('0x36')](_0x17e165[_0xfb18('0x2e')][_0xfb18('0x36')]);_0x5bc264['offset']=qs['offset'](_0x17e165[_0xfb18('0x2e')]['offset']);}_0x5bc264[_0xfb18('0x37')]=qs[_0xfb18('0x38')](_0x17e165['query'][_0xfb18('0x38')]);_0x5bc264[_0xfb18('0x39')]=qs[_0xfb18('0x3a')](_[_0xfb18('0x3b')](_0x17e165[_0xfb18('0x2e')],_0x5240c7[_0xfb18('0x3a')]),_0x5b98e3);if(_0x17e165[_0xfb18('0x2e')]['filter']){_0x5bc264[_0xfb18('0x39')]=_[_0xfb18('0x3c')](_0x5bc264['where'],{'$or':_[_0xfb18('0x29')](_0x5b98e3,function(_0x50c7c4){if(_0x50c7c4[_0xfb18('0x2b')]!==_0xfb18('0x3d')){var _0x27e669={};_0x27e669[_0x50c7c4[_0xfb18('0x27')]]={'$like':'%'+_0x17e165[_0xfb18('0x2e')][_0xfb18('0x3e')]+'%'};return _0x27e669;}})});}_0x5bc264=_[_0xfb18('0x3c')]({},_0x5bc264,_0x17e165[_0xfb18('0x3f')]);var _0x3f1dd8={'where':_0x5bc264[_0xfb18('0x39')]};return db[_0xfb18('0x40')]['count'](_0x3f1dd8)[_0xfb18('0x22')](function(_0x2d611b){_0x2bab49[_0xfb18('0x1c')]=_0x2d611b;if(_0x17e165[_0xfb18('0x2e')]['includeAll']){_0x5bc264[_0xfb18('0x41')]=[{'all':!![]}];}return db[_0xfb18('0x40')]['findAll'](_0x5bc264);})[_0xfb18('0x22')](function(_0x1eed8f){_0x2bab49['rows']=_0x1eed8f;return _0x2bab49;})[_0xfb18('0x22')](respondWithFilteredResult(_0x3ab8aa,_0x5bc264))[_0xfb18('0x42')](handleError(_0x3ab8aa,null));}; \ No newline at end of file +var _0x8f59=['nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','Migration','rawAttributes','type','query','filters','model','attributes','intersection','fields'];(function(_0x21459c,_0x5cab60){var _0x850934=function(_0x3c9480){while(--_0x3c9480){_0x21459c['push'](_0x21459c['shift']());}};_0x850934(++_0x5cab60);}(_0x8f59,0xf9));var _0x98f5=function(_0x325743,_0x139dd6){_0x325743=_0x325743-0x0;var _0xf742b9=_0x8f59[_0x325743];return _0xf742b9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x98f5('0x0'));var zipdir=require(_0x98f5('0x1'));var jsonpatch=require(_0x98f5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98f5('0x3'));var Mustache=require(_0x98f5('0x4'));var util=require(_0x98f5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x98f5('0x6'));var ejs=require(_0x98f5('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x98f5('0x8'));var crypto=require('crypto');var jsforce=require(_0x98f5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x98f5('0x6'));var querystring=require('querystring');var Papa=require(_0x98f5('0xa'));var Redis=require(_0x98f5('0xb'));var authService=require(_0x98f5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x98f5('0xd'));var hardwareService=require(_0x98f5('0xe'));var logger=require(_0x98f5('0xf'))(_0x98f5('0x10'));var utils=require(_0x98f5('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x98f5('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a311d,_0x110b2e){_0x110b2e=_0x110b2e||0xcc;return function(_0x4ae7d2){if(_0x4ae7d2){return _0x1a311d['sendStatus'](_0x110b2e);}return _0x1a311d[_0x98f5('0x13')](_0x110b2e)[_0x98f5('0x14')]();};}function respondWithResult(_0x56519f,_0x27cf07){_0x27cf07=_0x27cf07||0xc8;return function(_0x24ba4f){if(_0x24ba4f){return _0x56519f[_0x98f5('0x13')](_0x27cf07)[_0x98f5('0x15')](_0x24ba4f);}};}function respondWithFilteredResult(_0x4a39a8,_0x350128){return function(_0x3009d1){if(_0x3009d1){var _0x188c38=_0x3009d1[_0x98f5('0x16')],_0x307020=_0x350128['offset'],_0x4761fc=_0x350128[_0x98f5('0x17')]+_0x350128[_0x98f5('0x18')],_0x1d6fa8;if(_0x4761fc>=_0x188c38){_0x4761fc=_0x188c38;_0x1d6fa8=0xc8;}else{_0x1d6fa8=0xce;}_0x4a39a8[_0x98f5('0x13')](_0x1d6fa8);return _0x4a39a8[_0x98f5('0x19')](_0x98f5('0x1a'),_0x307020+'-'+_0x4761fc+'/'+_0x188c38)[_0x98f5('0x15')](_0x3009d1);}return null;};}function patchUpdates(_0x282e84){return function(_0x129601){try{jsonpatch[_0x98f5('0x1b')](_0x129601,_0x282e84,!![]);}catch(_0x4322e9){return BPromise[_0x98f5('0x1c')](_0x4322e9);}return _0x129601[_0x98f5('0x1d')]();};}function saveUpdates(_0x3e6feb,_0x34f985){return function(_0x3f5f3){if(_0x3f5f3){return _0x3f5f3['update'](_0x3e6feb)[_0x98f5('0x1e')](function(_0x43ede5){return _0x43ede5;});}return null;};}function removeEntity(_0x17afb7,_0x327b02){return function(_0x3f1db8){if(_0x3f1db8){return _0x3f1db8[_0x98f5('0x1f')]()[_0x98f5('0x1e')](function(){_0x17afb7[_0x98f5('0x13')](0xcc)[_0x98f5('0x14')]();});}};}function handleEntityNotFound(_0x39859b,_0x136aec){return function(_0x5eb793){if(!_0x5eb793){_0x39859b['sendStatus'](0x194);}return _0x5eb793;};}function handleError(_0x310834,_0x223ace){_0x223ace=_0x223ace||0x1f4;return function(_0x5461cb){logger[_0x98f5('0x20')](_0x5461cb['stack']);if(_0x5461cb[_0x98f5('0x21')]){delete _0x5461cb[_0x98f5('0x21')];}_0x310834['status'](_0x223ace)[_0x98f5('0x22')](_0x5461cb);};}exports[_0x98f5('0x23')]=function(_0x597f93,_0x4648e9){var _0x56be73={},_0x310b9a={},_0x224970={'count':0x0,'rows':[]};var _0x93f83d=_[_0x98f5('0x24')](db[_0x98f5('0x25')][_0x98f5('0x26')],function(_0xc1edb5){return{'name':_0xc1edb5['fieldName'],'type':_0xc1edb5[_0x98f5('0x27')]['key']};});_0x310b9a['model']=_[_0x98f5('0x24')](_0x93f83d,_0x98f5('0x21'));_0x310b9a[_0x98f5('0x28')]=_['keys'](_0x597f93[_0x98f5('0x28')]);_0x310b9a[_0x98f5('0x29')]=_['intersection'](_0x310b9a[_0x98f5('0x2a')],_0x310b9a[_0x98f5('0x28')]);_0x56be73[_0x98f5('0x2b')]=_[_0x98f5('0x2c')](_0x310b9a[_0x98f5('0x2a')],qs[_0x98f5('0x2d')](_0x597f93[_0x98f5('0x28')][_0x98f5('0x2d')]));_0x56be73['attributes']=_0x56be73[_0x98f5('0x2b')]['length']?_0x56be73['attributes']:_0x310b9a[_0x98f5('0x2a')];if(!_0x597f93[_0x98f5('0x28')]['hasOwnProperty'](_0x98f5('0x2e'))){_0x56be73[_0x98f5('0x18')]=qs[_0x98f5('0x18')](_0x597f93[_0x98f5('0x28')][_0x98f5('0x18')]);_0x56be73[_0x98f5('0x17')]=qs[_0x98f5('0x17')](_0x597f93[_0x98f5('0x28')]['offset']);}_0x56be73[_0x98f5('0x2f')]=qs[_0x98f5('0x30')](_0x597f93[_0x98f5('0x28')][_0x98f5('0x30')]);_0x56be73['where']=qs['filters'](_['pick'](_0x597f93[_0x98f5('0x28')],_0x310b9a['filters']),_0x93f83d);if(_0x597f93[_0x98f5('0x28')]['filter']){_0x56be73[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x56be73['where'],{'$or':_[_0x98f5('0x24')](_0x93f83d,function(_0x30b118){if(_0x30b118[_0x98f5('0x27')]!==_0x98f5('0x33')){var _0x4c0341={};_0x4c0341[_0x30b118[_0x98f5('0x21')]]={'$like':'%'+_0x597f93[_0x98f5('0x28')][_0x98f5('0x34')]+'%'};return _0x4c0341;}})});}_0x56be73=_['merge']({},_0x56be73,_0x597f93[_0x98f5('0x35')]);var _0x326ed3={'where':_0x56be73[_0x98f5('0x31')]};return db[_0x98f5('0x25')]['count'](_0x326ed3)['then'](function(_0x49b612){_0x224970[_0x98f5('0x16')]=_0x49b612;if(_0x597f93[_0x98f5('0x28')][_0x98f5('0x36')]){_0x56be73[_0x98f5('0x37')]=[{'all':!![]}];}return db[_0x98f5('0x25')][_0x98f5('0x38')](_0x56be73);})[_0x98f5('0x1e')](function(_0x52e270){_0x224970[_0x98f5('0x39')]=_0x52e270;return _0x224970;})[_0x98f5('0x1e')](respondWithFilteredResult(_0x4648e9,_0x56be73))[_0x98f5('0x3a')](handleError(_0x4648e9,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index eca4ad5..69e7c1f 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 _0x7363=['request-promise','path','rimraf','Migration','lodash'];(function(_0x494991,_0x2197ca){var _0x48c2c7=function(_0x29679e){while(--_0x29679e){_0x494991['push'](_0x494991['shift']());}};_0x48c2c7(++_0x2197ca);}(_0x7363,0xae));var _0x3736=function(_0x39aaa7,_0x51d803){_0x39aaa7=_0x39aaa7-0x0;var _0x26fb82=_0x7363[_0x39aaa7];return _0x26fb82;};'use strict';var _=require(_0x3736('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3736('0x1'));var fs=require('fs');var path=require(_0x3736('0x2'));var rimraf=require(_0x3736('0x3'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module['exports']=function(_0xcffd96,_0x4621a1){return _0xcffd96['define'](_0x3736('0x4'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0e5=['lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations'];(function(_0x9e1d73,_0xcf6479){var _0x1ba603=function(_0x689c74){while(--_0x689c74){_0x9e1d73['push'](_0x9e1d73['shift']());}};_0x1ba603(++_0xcf6479);}(_0xe0e5,0x82));var _0x5e0e=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0xe0e5[_0x57eb2d];return _0xd8e18;};'use strict';var _=require(_0x5e0e('0x0'));var util=require('util');var logger=require(_0x5e0e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5e0e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e0e('0x3'));var rimraf=require(_0x5e0e('0x4'));var config=require(_0x5e0e('0x5'));var attributes=require(_0x5e0e('0x6'));module[_0x5e0e('0x7')]=function(_0x4b6c46,_0x6fa158){return _0x4b6c46['define'](_0x5e0e('0x8'),attributes,{'tableName':_0x5e0e('0x9'),'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 2c82926..c5c7153 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 _0x6c54=['Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x13211b,_0x38f424){var _0x26f1a9=function(_0x55b006){while(--_0x55b006){_0x13211b['push'](_0x13211b['shift']());}};_0x26f1a9(++_0x38f424);}(_0x6c54,0xe4));var _0x46c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c54[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x46c5('0x0'));var util=require(_0x46c5('0x1'));var moment=require(_0x46c5('0x2'));var BPromise=require(_0x46c5('0x3'));var rs=require(_0x46c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c5('0x5'))['db'];var utils=require(_0x46c5('0x6'));var logger=require('../../config/logger')(_0x46c5('0x7'));var config=require('../../config/environment');var jayson=require(_0x46c5('0x8'));var client=jayson[_0x46c5('0x9')][_0x46c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16cea6,_0x187ec9,_0x2aa9c5){return new BPromise(function(_0x1cd663,_0x5ec9a6){return client[_0x46c5('0xb')](_0x16cea6,_0x2aa9c5)[_0x46c5('0xc')](function(_0x28bf02){logger[_0x46c5('0xd')](_0x46c5('0xe'),_0x187ec9,_0x46c5('0xf'));logger[_0x46c5('0x10')](_0x46c5('0x11'),_0x187ec9,_0x46c5('0xf'),JSON[_0x46c5('0x12')](_0x28bf02));if(_0x28bf02['error']){if(_0x28bf02[_0x46c5('0x13')]['code']===0x1f4){logger[_0x46c5('0x13')](_0x46c5('0xe'),_0x187ec9,_0x28bf02[_0x46c5('0x13')][_0x46c5('0x14')]);return _0x5ec9a6(_0x28bf02[_0x46c5('0x13')]['message']);}logger[_0x46c5('0x13')](_0x46c5('0xe'),_0x187ec9,_0x28bf02[_0x46c5('0x13')]['message']);return _0x1cd663(_0x28bf02[_0x46c5('0x13')][_0x46c5('0x14')]);}else{logger['info'](_0x46c5('0xe'),_0x187ec9,'request\x20sent');_0x1cd663(_0x28bf02[_0x46c5('0x15')][_0x46c5('0x14')]);}})['catch'](function(_0x42dbd1){logger['error']('Migration,\x20%s,\x20%s',_0x187ec9,_0x42dbd1);_0x5ec9a6(_0x42dbd1);});});} \ No newline at end of file +var _0x1aa9=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xb63cc3,_0x5c7eb5){var _0x21d6c9=function(_0x50bf07){while(--_0x50bf07){_0xb63cc3['push'](_0xb63cc3['shift']());}};_0x21d6c9(++_0x5c7eb5);}(_0x1aa9,0x1a3));var _0x91aa=function(_0x263a16,_0x489c01){_0x263a16=_0x263a16-0x0;var _0x251824=_0x1aa9[_0x263a16];return _0x251824;};'use strict';var _=require(_0x91aa('0x0'));var util=require(_0x91aa('0x1'));var moment=require(_0x91aa('0x2'));var BPromise=require(_0x91aa('0x3'));var rs=require(_0x91aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x91aa('0x6'))(_0x91aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x91aa('0x8'));var client=jayson['client'][_0x91aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cc17e,_0x4c44fc,_0x440cce){return new BPromise(function(_0x594301,_0x24caf9){return client['request'](_0x2cc17e,_0x440cce)[_0x91aa('0xa')](function(_0x3060b7){logger[_0x91aa('0xb')](_0x91aa('0xc'),_0x4c44fc,_0x91aa('0xd'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x4c44fc,'request\x20sent',JSON[_0x91aa('0xe')](_0x3060b7));if(_0x3060b7[_0x91aa('0xf')]){if(_0x3060b7[_0x91aa('0xf')][_0x91aa('0x10')]===0x1f4){logger[_0x91aa('0xf')](_0x91aa('0xc'),_0x4c44fc,_0x3060b7[_0x91aa('0xf')][_0x91aa('0x11')]);return _0x24caf9(_0x3060b7[_0x91aa('0xf')]['message']);}logger[_0x91aa('0xf')](_0x91aa('0xc'),_0x4c44fc,_0x3060b7['error'][_0x91aa('0x11')]);return _0x594301(_0x3060b7[_0x91aa('0xf')][_0x91aa('0x11')]);}else{logger[_0x91aa('0xb')](_0x91aa('0xc'),_0x4c44fc,_0x91aa('0xd'));_0x594301(_0x3060b7['result'][_0x91aa('0x11')]);}})[_0x91aa('0x12')](function(_0x1843cd){logger['error'](_0x91aa('0xc'),_0x4c44fc,_0x1843cd);_0x24caf9(_0x1843cd);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 221d887..0faeeff 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 _0x62f1=['update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x5c7ccd,_0x5e8ba5){var _0x1a37e5=function(_0x52c364){while(--_0x52c364){_0x5c7ccd['push'](_0x5c7ccd['shift']());}};_0x1a37e5(++_0x5e8ba5);}(_0x62f1,0x112));var _0x162f=function(_0x338259,_0x3015e9){_0x338259=_0x338259-0x0;var _0x4725d6=_0x62f1[_0x338259];return _0x4725d6;};'use strict';var multer=require(_0x162f('0x0'));var util=require('util');var path=require(_0x162f('0x1'));var timeout=require(_0x162f('0x2'));var express=require(_0x162f('0x3'));var router=express[_0x162f('0x4')]();var auth=require(_0x162f('0x5'));var interaction=require(_0x162f('0x6'));var config=require(_0x162f('0x7'));var controller=require(_0x162f('0x8'));router[_0x162f('0x9')]('/',auth[_0x162f('0xa')](),controller['index']);router[_0x162f('0x9')](_0x162f('0xb'),auth['isAuthenticated'](),controller[_0x162f('0xc')]);router[_0x162f('0xd')]('/',auth[_0x162f('0xa')](),controller['create']);router[_0x162f('0xe')](_0x162f('0xb'),auth[_0x162f('0xa')](),controller[_0x162f('0xf')]);router['delete'](_0x162f('0xb'),auth[_0x162f('0xa')](),controller[_0x162f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbffe=['/:id','show','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x32358b,_0x5c7c35){var _0x58c21d=function(_0x238a63){while(--_0x238a63){_0x32358b['push'](_0x32358b['shift']());}};_0x58c21d(++_0x5c7c35);}(_0xbffe,0x1d4));var _0xebff=function(_0x45ed71,_0x3695bb){_0x45ed71=_0x45ed71-0x0;var _0x3ee81a=_0xbffe[_0x45ed71];return _0x3ee81a;};'use strict';var multer=require(_0xebff('0x0'));var util=require('util');var path=require(_0xebff('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xebff('0x2')]();var auth=require(_0xebff('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xebff('0x4'));var controller=require('./network.controller');router['get']('/',auth[_0xebff('0x5')](),controller[_0xebff('0x6')]);router[_0xebff('0x7')](_0xebff('0x8'),auth[_0xebff('0x5')](),controller[_0xebff('0x9')]);router['post']('/',auth[_0xebff('0x5')](),controller['create']);router[_0xebff('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xebff('0xb')]);router[_0xebff('0xc')](_0xebff('0x8'),auth[_0xebff('0x5')](),controller['destroy']);module[_0xebff('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0bde40d..57ddbd7 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x153639,_0x29441d){var _0x1c3f5c=function(_0x5863cf){while(--_0x5863cf){_0x153639['push'](_0x153639['shift']());}};_0x1c3f5c(++_0x29441d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x234818,_0x154047){var _0x223489=function(_0x38b265){while(--_0x38b265){_0x234818['push'](_0x234818['shift']());}};_0x223489(++_0x154047);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index e7cf10a..acf44c1 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 _0x3f5d=['include','findAll','show','params','keys','options','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','format','chan_sip.so','STUN','server/files/templates/stun_multiple.ejs','TURN','server/files/templates/network.ejs','toLowerCase','destroy','/etc/asterisk/sip_xcally_%s.conf','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','map','Network','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x3a9532,_0xc6f76f){var _0x5ed762=function(_0x3f3734){while(--_0x3f3734){_0x3a9532['push'](_0x3a9532['shift']());}};_0x5ed762(++_0xc6f76f);}(_0x3f5d,0x15e));var _0xd3f5=function(_0x2715bb,_0x445bd5){_0x2715bb=_0x2715bb-0x0;var _0x1dce0a=_0x3f5d[_0x2715bb];return _0x1dce0a;};'use strict';var pdf=require(_0xd3f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd3f5('0x1'));var zipdir=require(_0xd3f5('0x2'));var jsonpatch=require(_0xd3f5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3f5('0x4'));var util=require(_0xd3f5('0x5'));var path=require(_0xd3f5('0x6'));var sox=require(_0xd3f5('0x7'));var csv=require('to-csv');var ejs=require(_0xd3f5('0x8'));var fs=require('fs');var _=require(_0xd3f5('0x9'));var squel=require(_0xd3f5('0xa'));var crypto=require(_0xd3f5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd3f5('0xc'));var toCsv=require(_0xd3f5('0xd'));var querystring=require('querystring');var Papa=require(_0xd3f5('0xe'));var Redis=require(_0xd3f5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd3f5('0x10'));var as=require(_0xd3f5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3f5('0x12'))(_0xd3f5('0x13'));var utils=require('../../config/utils');var config=require(_0xd3f5('0x14'));var licenseUtil=require(_0xd3f5('0x15'));var db=require(_0xd3f5('0x16'))['db'];var jayson=require(_0xd3f5('0x17'));var client=jayson['client'][_0xd3f5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x541e57,_0x2b100a,_0x565963,_0x3d42c2){return new BPromise(function(_0x2ec9dc,_0x39973f){var _0x47c6f6=_0x3d42c2||client;return _0x47c6f6[_0xd3f5('0x19')](_0x541e57,_0x565963)[_0xd3f5('0x1a')](function(_0x8162ba){logger['info']('Network,\x20%s,\x20%s',_0x2b100a,_0xd3f5('0x1b'));logger[_0xd3f5('0x1c')](_0xd3f5('0x1d'),_0x2b100a,_0xd3f5('0x1b'),JSON[_0xd3f5('0x1e')](_0x8162ba));if(_0x8162ba[_0xd3f5('0x1f')]){if(_0x8162ba[_0xd3f5('0x1f')][_0xd3f5('0x20')]===0x1f4){logger['error'](_0xd3f5('0x21'),_0x2b100a,_0x8162ba[_0xd3f5('0x1f')][_0xd3f5('0x22')]);return _0x39973f(_0x8162ba[_0xd3f5('0x1f')][_0xd3f5('0x22')]);}logger[_0xd3f5('0x1f')](_0xd3f5('0x21'),_0x2b100a,_0x8162ba[_0xd3f5('0x1f')]['message']);return _0x2ec9dc(_0x8162ba['error'][_0xd3f5('0x22')]);}else{logger[_0xd3f5('0x23')](_0xd3f5('0x21'),_0x2b100a,_0xd3f5('0x1b'));_0x2ec9dc(_0x8162ba[_0xd3f5('0x24')][_0xd3f5('0x22')]);}})[_0xd3f5('0x25')](function(_0x54eed6){logger[_0xd3f5('0x1f')](_0xd3f5('0x21'),_0x2b100a,_0x54eed6);_0x39973f(_0x54eed6);});});}function respondWithStatusCode(_0x2f37b5,_0x39a618){_0x39a618=_0x39a618||0xcc;return function(_0x1fb3fd){if(_0x1fb3fd){return _0x2f37b5[_0xd3f5('0x26')](_0x39a618);}return _0x2f37b5[_0xd3f5('0x27')](_0x39a618)['end']();};}function respondWithResult(_0xd26de5,_0x2501ad){_0x2501ad=_0x2501ad||0xc8;return function(_0x5499d2){if(_0x5499d2){return _0xd26de5['status'](_0x2501ad)[_0xd3f5('0x28')](_0x5499d2);}};}function respondWithFilteredResult(_0x4afca3,_0x1c5a5c){return function(_0x1aeaea){if(_0x1aeaea){var _0x1d5575=_0x1aeaea[_0xd3f5('0x29')],_0xf1d8e5=_0x1c5a5c[_0xd3f5('0x2a')],_0x5e2a97=_0x1c5a5c[_0xd3f5('0x2a')]+_0x1c5a5c[_0xd3f5('0x2b')],_0x5a9577;if(_0x5e2a97>=_0x1d5575){_0x5e2a97=_0x1d5575;_0x5a9577=0xc8;}else{_0x5a9577=0xce;}_0x4afca3[_0xd3f5('0x27')](_0x5a9577);return _0x4afca3[_0xd3f5('0x2c')](_0xd3f5('0x2d'),_0xf1d8e5+'-'+_0x5e2a97+'/'+_0x1d5575)[_0xd3f5('0x28')](_0x1aeaea);}return null;};}function patchUpdates(_0x10d3fb){return function(_0x4cd810){try{jsonpatch[_0xd3f5('0x2e')](_0x4cd810,_0x10d3fb,!![]);}catch(_0x280e7c){return BPromise[_0xd3f5('0x2f')](_0x280e7c);}return _0x4cd810[_0xd3f5('0x30')]();};}function saveUpdates(_0x2947c1,_0x42b335){return function(_0xc05dd3){if(_0xc05dd3){return _0xc05dd3[_0xd3f5('0x31')](_0x2947c1)['then'](function(_0xf97d66){return _0xf97d66;});}return null;};}function removeEntity(_0x4f3498,_0x5cfcdb){return function(_0x15815d){if(_0x15815d){return _0x15815d['destroy']()[_0xd3f5('0x1a')](function(){_0x4f3498[_0xd3f5('0x27')](0xcc)[_0xd3f5('0x32')]();});}};}function handleEntityNotFound(_0x55ac86,_0x5263cd){return function(_0x34c339){if(!_0x34c339){_0x55ac86[_0xd3f5('0x26')](0x194);}return _0x34c339;};}function handleError(_0x4bca62,_0x41d755){_0x41d755=_0x41d755||0x1f4;return function(_0x377b83){logger['error'](_0x377b83[_0xd3f5('0x33')]);if(_0x377b83['name']){delete _0x377b83[_0xd3f5('0x34')];}_0x4bca62[_0xd3f5('0x27')](_0x41d755)['send'](_0x377b83);};}exports['index']=function(_0x2cc40e,_0x30aa20){var _0x1a7ed2={},_0x312760={},_0x4e41bd={'count':0x0,'rows':[]};var _0xc0c946=_[_0xd3f5('0x35')](db[_0xd3f5('0x36')][_0xd3f5('0x37')],function(_0x43676b){return{'name':_0x43676b['fieldName'],'type':_0x43676b[_0xd3f5('0x38')][_0xd3f5('0x39')]};});_0x312760[_0xd3f5('0x3a')]=_[_0xd3f5('0x35')](_0xc0c946,'name');_0x312760['query']=_['keys'](_0x2cc40e[_0xd3f5('0x3b')]);_0x312760[_0xd3f5('0x3c')]=_[_0xd3f5('0x3d')](_0x312760['model'],_0x312760[_0xd3f5('0x3b')]);_0x1a7ed2[_0xd3f5('0x3e')]=_[_0xd3f5('0x3d')](_0x312760['model'],qs[_0xd3f5('0x3f')](_0x2cc40e[_0xd3f5('0x3b')][_0xd3f5('0x3f')]));_0x1a7ed2[_0xd3f5('0x3e')]=_0x1a7ed2[_0xd3f5('0x3e')][_0xd3f5('0x40')]?_0x1a7ed2[_0xd3f5('0x3e')]:_0x312760[_0xd3f5('0x3a')];if(!_0x2cc40e[_0xd3f5('0x3b')][_0xd3f5('0x41')]('nolimit')){_0x1a7ed2[_0xd3f5('0x2b')]=qs[_0xd3f5('0x2b')](_0x2cc40e[_0xd3f5('0x3b')][_0xd3f5('0x2b')]);_0x1a7ed2['offset']=qs[_0xd3f5('0x2a')](_0x2cc40e[_0xd3f5('0x3b')][_0xd3f5('0x2a')]);}_0x1a7ed2[_0xd3f5('0x42')]=qs[_0xd3f5('0x43')](_0x2cc40e[_0xd3f5('0x3b')][_0xd3f5('0x43')]);_0x1a7ed2[_0xd3f5('0x44')]=qs[_0xd3f5('0x3c')](_[_0xd3f5('0x45')](_0x2cc40e['query'],_0x312760['filters']),_0xc0c946);if(_0x2cc40e[_0xd3f5('0x3b')][_0xd3f5('0x46')]){_0x1a7ed2[_0xd3f5('0x44')]=_[_0xd3f5('0x47')](_0x1a7ed2[_0xd3f5('0x44')],{'$or':_[_0xd3f5('0x35')](_0xc0c946,function(_0x31bbe5){if(_0x31bbe5[_0xd3f5('0x38')]!==_0xd3f5('0x48')){var _0x1d09c3={};_0x1d09c3[_0x31bbe5['name']]={'$like':'%'+_0x2cc40e['query'][_0xd3f5('0x46')]+'%'};return _0x1d09c3;}})});}_0x1a7ed2=_[_0xd3f5('0x47')]({},_0x1a7ed2,_0x2cc40e['options']);var _0x39a130={'where':_0x1a7ed2[_0xd3f5('0x44')]};return db[_0xd3f5('0x36')][_0xd3f5('0x29')](_0x39a130)['then'](function(_0x322a96){_0x4e41bd[_0xd3f5('0x29')]=_0x322a96;if(_0x2cc40e['query'][_0xd3f5('0x49')]){_0x1a7ed2[_0xd3f5('0x4a')]=[{'all':!![]}];}return db[_0xd3f5('0x36')][_0xd3f5('0x4b')](_0x1a7ed2);})[_0xd3f5('0x1a')](function(_0x3d3f75){_0x4e41bd['rows']=_0x3d3f75;return _0x4e41bd;})[_0xd3f5('0x1a')](respondWithFilteredResult(_0x30aa20,_0x1a7ed2))[_0xd3f5('0x25')](handleError(_0x30aa20,null));};exports[_0xd3f5('0x4c')]=function(_0x458c83,_0xa8fe12){var _0x3a2f5a={'raw':!![],'where':{'id':_0x458c83[_0xd3f5('0x4d')]['id']}},_0x52bed={};_0x52bed[_0xd3f5('0x3a')]=_['keys'](db['Network'][_0xd3f5('0x37')]);_0x52bed[_0xd3f5('0x3b')]=_[_0xd3f5('0x4e')](_0x458c83[_0xd3f5('0x3b')]);_0x52bed['filters']=_[_0xd3f5('0x3d')](_0x52bed[_0xd3f5('0x3a')],_0x52bed[_0xd3f5('0x3b')]);_0x3a2f5a['attributes']=_['intersection'](_0x52bed[_0xd3f5('0x3a')],qs[_0xd3f5('0x3f')](_0x458c83[_0xd3f5('0x3b')][_0xd3f5('0x3f')]));_0x3a2f5a[_0xd3f5('0x3e')]=_0x3a2f5a[_0xd3f5('0x3e')][_0xd3f5('0x40')]?_0x3a2f5a[_0xd3f5('0x3e')]:_0x52bed[_0xd3f5('0x3a')];if(_0x458c83[_0xd3f5('0x3b')][_0xd3f5('0x49')]){_0x3a2f5a[_0xd3f5('0x4a')]=[{'all':!![]}];}_0x3a2f5a=_[_0xd3f5('0x47')]({},_0x3a2f5a,_0x458c83[_0xd3f5('0x4f')]);return db[_0xd3f5('0x36')][_0xd3f5('0x50')](_0x3a2f5a)[_0xd3f5('0x1a')](handleEntityNotFound(_0xa8fe12,null))[_0xd3f5('0x1a')](respondWithResult(_0xa8fe12,null))['catch'](handleError(_0xa8fe12,null));};exports[_0xd3f5('0x51')]=function(_0x336568,_0x4a1ce6,_0x1e96d5){var _0x3367d5;return db[_0xd3f5('0x52')][_0xd3f5('0x53')](function(_0x5ecccf){return db['Network'][_0xd3f5('0x51')](_0x336568['body'],{'raw':!![]})[_0xd3f5('0x1a')](function(_0x35b271){_0x3367d5=_0x35b271;return db['Network'][_0xd3f5('0x4b')]({'where':{'type':_0x336568[_0xd3f5('0x54')]['type']},'raw':!![]});})[_0xd3f5('0x1a')](function(_0x3528be){if(_0x3367d5[_0xd3f5('0x38')][_0xd3f5('0x55')]()=='STUN'){var _0x230214=fs[_0xd3f5('0x56')](path[_0xd3f5('0x57')](config[_0xd3f5('0x58')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x3f54ac=ejs[_0xd3f5('0x59')](_0x230214,{'networks':_0x3528be||[]});fs[_0xd3f5('0x5a')](_0xd3f5('0x5b'),_0x3f54ac);return respondWithRpcPromise('Reload','create',{'module':_0xd3f5('0x5c')});}else if(_0x3367d5[_0xd3f5('0x38')][_0xd3f5('0x55')]()=='TURN'){var _0x46e5b4=fs[_0xd3f5('0x56')](path['join'](config['root'],_0xd3f5('0x5d')),_0xd3f5('0x5e'));var _0x4945e7=ejs[_0xd3f5('0x59')](_0x46e5b4,{'networks':_0x3528be||[]});fs['writeFileSync'](_0xd3f5('0x5f'),_0x4945e7);return respondWithRpcPromise(_0xd3f5('0x60'),_0xd3f5('0x51'),{'module':_0xd3f5('0x5c')});}else{var _0x321be2=fs['readFileSync'](path['join'](config[_0xd3f5('0x58')],'server/files/templates/network.ejs'),_0xd3f5('0x5e'));var _0x549116=ejs['render'](_0x321be2,{'networks':_0x3528be||[]});fs[_0xd3f5('0x5a')](util[_0xd3f5('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x336568['body'][_0xd3f5('0x38')]['toLowerCase']()),_0x549116);return respondWithRpcPromise(_0xd3f5('0x60'),'create',{'module':_0xd3f5('0x62')});}return null;})[_0xd3f5('0x1a')](function(){return _0x3367d5;});})[_0xd3f5('0x1a')](respondWithResult(_0x4a1ce6,0xc9))[_0xd3f5('0x25')](handleError(_0x4a1ce6,null));};exports[_0xd3f5('0x31')]=function(_0x437c7c,_0x4a9dfc,_0x5b6480){var _0x54dfef;return db['sequelize'][_0xd3f5('0x53')](function(_0x509187){return db[_0xd3f5('0x36')][_0xd3f5('0x50')]({'where':{'id':_0x437c7c[_0xd3f5('0x4d')]['id']}})[_0xd3f5('0x1a')](handleEntityNotFound(_0x4a9dfc,null))['then'](saveUpdates(_0x437c7c[_0xd3f5('0x54')],null))[_0xd3f5('0x1a')](function(_0x224dbc){if(_0x224dbc){_0x54dfef=_0x224dbc;return db[_0xd3f5('0x36')][_0xd3f5('0x4b')]({'where':{'type':_0x54dfef[_0xd3f5('0x38')]},'raw':!![]});}return null;})['then'](function(_0x374396){if(_0x54dfef[_0xd3f5('0x38')][_0xd3f5('0x55')]()==_0xd3f5('0x63')){var _0x282d71=fs['readFileSync'](path[_0xd3f5('0x57')](config['root'],_0xd3f5('0x64')),_0xd3f5('0x5e'));var _0x1ee62f=ejs['render'](_0x282d71,{'networks':_0x374396||[]});fs[_0xd3f5('0x5a')](_0xd3f5('0x5b'),_0x1ee62f);return respondWithRpcPromise(_0xd3f5('0x60'),'update',{'module':'res_stun_monitor.so'});}else if(_0x54dfef[_0xd3f5('0x38')]['toUpperCase']()==_0xd3f5('0x65')){var _0x2e3d0e=fs[_0xd3f5('0x56')](path[_0xd3f5('0x57')](config[_0xd3f5('0x58')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4ab32f=ejs['render'](_0x2e3d0e,{'networks':_0x374396||[]});fs[_0xd3f5('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x4ab32f);return respondWithRpcPromise(_0xd3f5('0x60'),_0xd3f5('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x1bd437=fs['readFileSync'](path['join'](config['root'],_0xd3f5('0x66')),_0xd3f5('0x5e'));var _0xd7daa5=ejs[_0xd3f5('0x59')](_0x1bd437,{'networks':_0x374396||[]});fs[_0xd3f5('0x5a')](util[_0xd3f5('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x437c7c['body'][_0xd3f5('0x38')][_0xd3f5('0x67')]()),_0xd7daa5);return respondWithRpcPromise(_0xd3f5('0x60'),_0xd3f5('0x31'),{'module':_0xd3f5('0x62')});}return null;})[_0xd3f5('0x1a')](function(_0x2acd22){if(_0x2acd22){return _0x54dfef;}return null;});})[_0xd3f5('0x1a')](respondWithResult(_0x4a9dfc,null))[_0xd3f5('0x25')](handleError(_0x4a9dfc,null));};exports[_0xd3f5('0x68')]=function(_0x1bf1bc,_0x4704a7,_0x17146e){var _0x2cebb4;return db['Network'][_0xd3f5('0x50')]({'where':{'id':_0x1bf1bc['params']['id']}})[_0xd3f5('0x1a')](function(_0x3f6175){_0x2cebb4=_0x3f6175;return _0x3f6175;})[_0xd3f5('0x1a')](handleEntityNotFound(_0x4704a7,null))[_0xd3f5('0x1a')](removeEntity(_0x4704a7,null))[_0xd3f5('0x1a')](function(){if(_0x2cebb4){return db[_0xd3f5('0x36')]['findAll']({'where':{'type':_0x2cebb4[_0xd3f5('0x38')]},'raw':!![]});}})[_0xd3f5('0x1a')](function(_0x22bdcf){if(_0x2cebb4[_0xd3f5('0x38')][_0xd3f5('0x55')]()==_0xd3f5('0x63')){var _0x29ef8e=fs[_0xd3f5('0x56')](path['join'](config[_0xd3f5('0x58')],_0xd3f5('0x64')),'utf8');var _0x32abd1=ejs[_0xd3f5('0x59')](_0x29ef8e,{'networks':_0x22bdcf||[]});fs['writeFileSync'](_0xd3f5('0x5b'),_0x32abd1);return respondWithRpcPromise(_0xd3f5('0x60'),_0xd3f5('0x68'),{'module':_0xd3f5('0x5c')});}else if(_0x2cebb4[_0xd3f5('0x38')][_0xd3f5('0x55')]()==_0xd3f5('0x65')){var _0x200583=fs[_0xd3f5('0x56')](path[_0xd3f5('0x57')](config[_0xd3f5('0x58')],'server/files/templates/turn_multiple.ejs'),_0xd3f5('0x5e'));var _0x2e8244=ejs[_0xd3f5('0x59')](_0x200583,{'networks':_0x22bdcf||[]});fs[_0xd3f5('0x5a')](_0xd3f5('0x5f'),_0x2e8244);return respondWithRpcPromise(_0xd3f5('0x60'),_0xd3f5('0x68'),{'module':_0xd3f5('0x5c')});}else{var _0x26af74=fs['readFileSync'](path[_0xd3f5('0x57')](config[_0xd3f5('0x58')],'server/files/templates/network.ejs'),_0xd3f5('0x5e'));var _0x4d2148=ejs[_0xd3f5('0x59')](_0x26af74,{'networks':_0x22bdcf||[]});fs[_0xd3f5('0x5a')](util[_0xd3f5('0x61')](_0xd3f5('0x69'),_0x1bf1bc[_0xd3f5('0x54')][_0xd3f5('0x38')][_0xd3f5('0x67')]()),_0x4d2148);return respondWithRpcPromise(_0xd3f5('0x60'),_0xd3f5('0x68'),{'module':'chan_sip.so'});}return null;})[_0xd3f5('0x25')](handleError(_0x4704a7,null));}; \ No newline at end of file +var _0x4661=['offset','limit','set','reject','save','update','stack','name','send','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','params','include','find','sequelize','transaction','body','findAll','toUpperCase','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','create','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','STUN','server/files/templates/stun_multiple.ejs','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x4661,0x183));var _0x1466=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4661[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x1466('0x0'));var emlformat=require(_0x1466('0x1'));var rimraf=require(_0x1466('0x2'));var zipdir=require(_0x1466('0x3'));var jsonpatch=require(_0x1466('0x4'));var rp=require('request-promise');var moment=require(_0x1466('0x5'));var BPromise=require(_0x1466('0x6'));var Mustache=require(_0x1466('0x7'));var util=require(_0x1466('0x8'));var path=require('path');var sox=require(_0x1466('0x9'));var csv=require(_0x1466('0xa'));var ejs=require(_0x1466('0xb'));var fs=require('fs');var _=require(_0x1466('0xc'));var squel=require('squel');var crypto=require(_0x1466('0xd'));var jsforce=require(_0x1466('0xe'));var deskjs=require(_0x1466('0xf'));var toCsv=require(_0x1466('0xa'));var querystring=require(_0x1466('0x10'));var Papa=require(_0x1466('0x11'));var Redis=require(_0x1466('0x12'));var authService=require(_0x1466('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1466('0x14'));var hardwareService=require(_0x1466('0x15'));var logger=require(_0x1466('0x16'))(_0x1466('0x17'));var utils=require(_0x1466('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1466('0x19'))['db'];var jayson=require(_0x1466('0x1a'));var client=jayson[_0x1466('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ae218,_0x362296,_0xb9e3a4,_0x1e98bc){return new BPromise(function(_0x26b168,_0x1cf7f4){var _0x5b019b=_0x1e98bc||client;return _0x5b019b[_0x1466('0x1c')](_0x4ae218,_0xb9e3a4)[_0x1466('0x1d')](function(_0x3101e7){logger[_0x1466('0x1e')](_0x1466('0x1f'),_0x362296,_0x1466('0x20'));logger[_0x1466('0x21')](_0x1466('0x22'),_0x362296,_0x1466('0x20'),JSON['stringify'](_0x3101e7));if(_0x3101e7[_0x1466('0x23')]){if(_0x3101e7[_0x1466('0x23')][_0x1466('0x24')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x362296,_0x3101e7[_0x1466('0x23')][_0x1466('0x25')]);return _0x1cf7f4(_0x3101e7[_0x1466('0x23')][_0x1466('0x25')]);}logger[_0x1466('0x23')](_0x1466('0x1f'),_0x362296,_0x3101e7[_0x1466('0x23')][_0x1466('0x25')]);return _0x26b168(_0x3101e7[_0x1466('0x23')][_0x1466('0x25')]);}else{logger[_0x1466('0x1e')](_0x1466('0x1f'),_0x362296,'request\x20sent');_0x26b168(_0x3101e7[_0x1466('0x26')]['message']);}})[_0x1466('0x27')](function(_0x298f05){logger[_0x1466('0x23')]('Network,\x20%s,\x20%s',_0x362296,_0x298f05);_0x1cf7f4(_0x298f05);});});}function respondWithStatusCode(_0x59246f,_0x2eefc4){_0x2eefc4=_0x2eefc4||0xcc;return function(_0x4d513b){if(_0x4d513b){return _0x59246f[_0x1466('0x28')](_0x2eefc4);}return _0x59246f[_0x1466('0x29')](_0x2eefc4)[_0x1466('0x2a')]();};}function respondWithResult(_0x52f9f7,_0x12d63d){_0x12d63d=_0x12d63d||0xc8;return function(_0x2391f5){if(_0x2391f5){return _0x52f9f7[_0x1466('0x29')](_0x12d63d)[_0x1466('0x2b')](_0x2391f5);}};}function respondWithFilteredResult(_0x7a6357,_0x22c417){return function(_0xd94a9a){if(_0xd94a9a){var _0x71c544=_0xd94a9a[_0x1466('0x2c')],_0x50f601=_0x22c417[_0x1466('0x2d')],_0x137de4=_0x22c417[_0x1466('0x2d')]+_0x22c417[_0x1466('0x2e')],_0xa59c03;if(_0x137de4>=_0x71c544){_0x137de4=_0x71c544;_0xa59c03=0xc8;}else{_0xa59c03=0xce;}_0x7a6357[_0x1466('0x29')](_0xa59c03);return _0x7a6357[_0x1466('0x2f')]('Content-Range',_0x50f601+'-'+_0x137de4+'/'+_0x71c544)[_0x1466('0x2b')](_0xd94a9a);}return null;};}function patchUpdates(_0x424003){return function(_0x2cb0bd){try{jsonpatch['apply'](_0x2cb0bd,_0x424003,!![]);}catch(_0xd98d00){return BPromise[_0x1466('0x30')](_0xd98d00);}return _0x2cb0bd[_0x1466('0x31')]();};}function saveUpdates(_0x51e066,_0xe674f8){return function(_0x1e24d1){if(_0x1e24d1){return _0x1e24d1[_0x1466('0x32')](_0x51e066)['then'](function(_0x3f0b4f){return _0x3f0b4f;});}return null;};}function removeEntity(_0x48a6ab,_0x7897c2){return function(_0x4dbe44){if(_0x4dbe44){return _0x4dbe44['destroy']()['then'](function(){_0x48a6ab[_0x1466('0x29')](0xcc)[_0x1466('0x2a')]();});}};}function handleEntityNotFound(_0x2f5821,_0x33ca24){return function(_0x135569){if(!_0x135569){_0x2f5821[_0x1466('0x28')](0x194);}return _0x135569;};}function handleError(_0x2f6965,_0x389acd){_0x389acd=_0x389acd||0x1f4;return function(_0x3b1397){logger[_0x1466('0x23')](_0x3b1397[_0x1466('0x33')]);if(_0x3b1397[_0x1466('0x34')]){delete _0x3b1397['name'];}_0x2f6965[_0x1466('0x29')](_0x389acd)[_0x1466('0x35')](_0x3b1397);};}exports['index']=function(_0x1aee84,_0x7278ec){var _0x2967a6={},_0x11104a={},_0x50ae2a={'count':0x0,'rows':[]};var _0x20e736=_[_0x1466('0x36')](db[_0x1466('0x37')][_0x1466('0x38')],function(_0x347d29){return{'name':_0x347d29[_0x1466('0x39')],'type':_0x347d29[_0x1466('0x3a')][_0x1466('0x3b')]};});_0x11104a['model']=_['map'](_0x20e736,_0x1466('0x34'));_0x11104a[_0x1466('0x3c')]=_[_0x1466('0x3d')](_0x1aee84[_0x1466('0x3c')]);_0x11104a[_0x1466('0x3e')]=_[_0x1466('0x3f')](_0x11104a[_0x1466('0x40')],_0x11104a['query']);_0x2967a6[_0x1466('0x41')]=_[_0x1466('0x3f')](_0x11104a['model'],qs[_0x1466('0x42')](_0x1aee84[_0x1466('0x3c')][_0x1466('0x42')]));_0x2967a6['attributes']=_0x2967a6[_0x1466('0x41')][_0x1466('0x43')]?_0x2967a6[_0x1466('0x41')]:_0x11104a[_0x1466('0x40')];if(!_0x1aee84[_0x1466('0x3c')][_0x1466('0x44')](_0x1466('0x45'))){_0x2967a6[_0x1466('0x2e')]=qs[_0x1466('0x2e')](_0x1aee84[_0x1466('0x3c')][_0x1466('0x2e')]);_0x2967a6['offset']=qs[_0x1466('0x2d')](_0x1aee84[_0x1466('0x3c')][_0x1466('0x2d')]);}_0x2967a6[_0x1466('0x46')]=qs[_0x1466('0x47')](_0x1aee84[_0x1466('0x3c')][_0x1466('0x47')]);_0x2967a6[_0x1466('0x48')]=qs[_0x1466('0x3e')](_[_0x1466('0x49')](_0x1aee84[_0x1466('0x3c')],_0x11104a['filters']),_0x20e736);if(_0x1aee84[_0x1466('0x3c')]['filter']){_0x2967a6['where']=_[_0x1466('0x4a')](_0x2967a6['where'],{'$or':_[_0x1466('0x36')](_0x20e736,function(_0x4d3299){if(_0x4d3299[_0x1466('0x3a')]!==_0x1466('0x4b')){var _0xba0105={};_0xba0105[_0x4d3299[_0x1466('0x34')]]={'$like':'%'+_0x1aee84[_0x1466('0x3c')][_0x1466('0x4c')]+'%'};return _0xba0105;}})});}_0x2967a6=_[_0x1466('0x4a')]({},_0x2967a6,_0x1aee84[_0x1466('0x4d')]);var _0x3eb0b6={'where':_0x2967a6[_0x1466('0x48')]};return db[_0x1466('0x37')][_0x1466('0x2c')](_0x3eb0b6)[_0x1466('0x1d')](function(_0x3d520d){_0x50ae2a[_0x1466('0x2c')]=_0x3d520d;if(_0x1aee84['query'][_0x1466('0x4e')]){_0x2967a6['include']=[{'all':!![]}];}return db[_0x1466('0x37')]['findAll'](_0x2967a6);})[_0x1466('0x1d')](function(_0x209ea2){_0x50ae2a['rows']=_0x209ea2;return _0x50ae2a;})[_0x1466('0x1d')](respondWithFilteredResult(_0x7278ec,_0x2967a6))['catch'](handleError(_0x7278ec,null));};exports['show']=function(_0x43bf03,_0x484c31){var _0x4f3144={'raw':!![],'where':{'id':_0x43bf03[_0x1466('0x4f')]['id']}},_0x282e1e={};_0x282e1e[_0x1466('0x40')]=_[_0x1466('0x3d')](db[_0x1466('0x37')][_0x1466('0x38')]);_0x282e1e[_0x1466('0x3c')]=_[_0x1466('0x3d')](_0x43bf03[_0x1466('0x3c')]);_0x282e1e[_0x1466('0x3e')]=_[_0x1466('0x3f')](_0x282e1e[_0x1466('0x40')],_0x282e1e[_0x1466('0x3c')]);_0x4f3144['attributes']=_['intersection'](_0x282e1e[_0x1466('0x40')],qs[_0x1466('0x42')](_0x43bf03[_0x1466('0x3c')][_0x1466('0x42')]));_0x4f3144[_0x1466('0x41')]=_0x4f3144[_0x1466('0x41')][_0x1466('0x43')]?_0x4f3144[_0x1466('0x41')]:_0x282e1e[_0x1466('0x40')];if(_0x43bf03['query']['includeAll']){_0x4f3144[_0x1466('0x50')]=[{'all':!![]}];}_0x4f3144=_[_0x1466('0x4a')]({},_0x4f3144,_0x43bf03[_0x1466('0x4d')]);return db[_0x1466('0x37')][_0x1466('0x51')](_0x4f3144)[_0x1466('0x1d')](handleEntityNotFound(_0x484c31,null))[_0x1466('0x1d')](respondWithResult(_0x484c31,null))[_0x1466('0x27')](handleError(_0x484c31,null));};exports['create']=function(_0x40b622,_0x7cce71,_0x1ca018){var _0x15f464;return db[_0x1466('0x52')][_0x1466('0x53')](function(_0x43fea1){return db[_0x1466('0x37')]['create'](_0x40b622[_0x1466('0x54')],{'raw':!![]})[_0x1466('0x1d')](function(_0xb87c6d){_0x15f464=_0xb87c6d;return db[_0x1466('0x37')][_0x1466('0x55')]({'where':{'type':_0x40b622['body']['type']},'raw':!![]});})[_0x1466('0x1d')](function(_0x6aa871){if(_0x15f464[_0x1466('0x3a')][_0x1466('0x56')]()=='STUN'){var _0x4b95b7=fs[_0x1466('0x57')](path['join'](config[_0x1466('0x58')],'server/files/templates/stun_multiple.ejs'),_0x1466('0x59'));var _0x4287ef=ejs[_0x1466('0x5a')](_0x4b95b7,{'networks':_0x6aa871||[]});fs[_0x1466('0x5b')](_0x1466('0x5c'),_0x4287ef);return respondWithRpcPromise('Reload',_0x1466('0x5d'),{'module':_0x1466('0x5e')});}else if(_0x15f464['type']['toUpperCase']()==_0x1466('0x5f')){var _0x1d1385=fs[_0x1466('0x57')](path['join'](config[_0x1466('0x58')],_0x1466('0x60')),'utf8');var _0x4ee950=ejs[_0x1466('0x5a')](_0x1d1385,{'networks':_0x6aa871||[]});fs[_0x1466('0x5b')](_0x1466('0x61'),_0x4ee950);return respondWithRpcPromise(_0x1466('0x62'),_0x1466('0x5d'),{'module':_0x1466('0x5e')});}else{var _0x5d375f=fs[_0x1466('0x57')](path[_0x1466('0x63')](config['root'],_0x1466('0x64')),_0x1466('0x59'));var _0xa36122=ejs[_0x1466('0x5a')](_0x5d375f,{'networks':_0x6aa871||[]});fs[_0x1466('0x5b')](util[_0x1466('0x65')](_0x1466('0x66'),_0x40b622[_0x1466('0x54')][_0x1466('0x3a')][_0x1466('0x67')]()),_0xa36122);return respondWithRpcPromise(_0x1466('0x62'),_0x1466('0x5d'),{'module':_0x1466('0x68')});}return null;})[_0x1466('0x1d')](function(){return _0x15f464;});})[_0x1466('0x1d')](respondWithResult(_0x7cce71,0xc9))['catch'](handleError(_0x7cce71,null));};exports['update']=function(_0x546cb1,_0x4cb9ea,_0x164799){var _0x43f8b5;return db['sequelize'][_0x1466('0x53')](function(_0x183957){return db[_0x1466('0x37')]['find']({'where':{'id':_0x546cb1['params']['id']}})[_0x1466('0x1d')](handleEntityNotFound(_0x4cb9ea,null))[_0x1466('0x1d')](saveUpdates(_0x546cb1[_0x1466('0x54')],null))[_0x1466('0x1d')](function(_0x4d8106){if(_0x4d8106){_0x43f8b5=_0x4d8106;return db[_0x1466('0x37')][_0x1466('0x55')]({'where':{'type':_0x43f8b5['type']},'raw':!![]});}return null;})[_0x1466('0x1d')](function(_0x2584e3){if(_0x43f8b5[_0x1466('0x3a')]['toUpperCase']()==_0x1466('0x69')){var _0x561fe=fs['readFileSync'](path[_0x1466('0x63')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1466('0x59'));var _0x34f018=ejs[_0x1466('0x5a')](_0x561fe,{'networks':_0x2584e3||[]});fs[_0x1466('0x5b')](_0x1466('0x5c'),_0x34f018);return respondWithRpcPromise('Reload','update',{'module':_0x1466('0x5e')});}else if(_0x43f8b5['type']['toUpperCase']()=='TURN'){var _0x3c6bae=fs['readFileSync'](path[_0x1466('0x63')](config[_0x1466('0x58')],_0x1466('0x60')),_0x1466('0x59'));var _0x10e8be=ejs[_0x1466('0x5a')](_0x3c6bae,{'networks':_0x2584e3||[]});fs[_0x1466('0x5b')](_0x1466('0x61'),_0x10e8be);return respondWithRpcPromise(_0x1466('0x62'),'update',{'module':_0x1466('0x5e')});}else{var _0x194bb4=fs[_0x1466('0x57')](path[_0x1466('0x63')](config[_0x1466('0x58')],'server/files/templates/network.ejs'),_0x1466('0x59'));var _0x5784b1=ejs[_0x1466('0x5a')](_0x194bb4,{'networks':_0x2584e3||[]});fs[_0x1466('0x5b')](util[_0x1466('0x65')](_0x1466('0x66'),_0x546cb1[_0x1466('0x54')][_0x1466('0x3a')]['toLowerCase']()),_0x5784b1);return respondWithRpcPromise(_0x1466('0x62'),'update',{'module':_0x1466('0x68')});}return null;})['then'](function(_0x347fb0){if(_0x347fb0){return _0x43f8b5;}return null;});})[_0x1466('0x1d')](respondWithResult(_0x4cb9ea,null))[_0x1466('0x27')](handleError(_0x4cb9ea,null));};exports['destroy']=function(_0x5da0ab,_0x5eb4cb,_0xbfa293){var _0x3b060a;return db[_0x1466('0x37')][_0x1466('0x51')]({'where':{'id':_0x5da0ab[_0x1466('0x4f')]['id']}})['then'](function(_0x47dbd0){_0x3b060a=_0x47dbd0;return _0x47dbd0;})[_0x1466('0x1d')](handleEntityNotFound(_0x5eb4cb,null))[_0x1466('0x1d')](removeEntity(_0x5eb4cb,null))[_0x1466('0x1d')](function(){if(_0x3b060a){return db[_0x1466('0x37')][_0x1466('0x55')]({'where':{'type':_0x3b060a[_0x1466('0x3a')]},'raw':!![]});}})[_0x1466('0x1d')](function(_0x50e82d){if(_0x3b060a[_0x1466('0x3a')][_0x1466('0x56')]()=='STUN'){var _0x8e8042=fs[_0x1466('0x57')](path[_0x1466('0x63')](config[_0x1466('0x58')],_0x1466('0x6a')),_0x1466('0x59'));var _0x299b52=ejs[_0x1466('0x5a')](_0x8e8042,{'networks':_0x50e82d||[]});fs[_0x1466('0x5b')](_0x1466('0x5c'),_0x299b52);return respondWithRpcPromise(_0x1466('0x62'),_0x1466('0x6b'),{'module':_0x1466('0x5e')});}else if(_0x3b060a[_0x1466('0x3a')][_0x1466('0x56')]()==_0x1466('0x5f')){var _0x172f22=fs[_0x1466('0x57')](path[_0x1466('0x63')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x1466('0x59'));var _0x42ca5c=ejs['render'](_0x172f22,{'networks':_0x50e82d||[]});fs[_0x1466('0x5b')](_0x1466('0x61'),_0x42ca5c);return respondWithRpcPromise(_0x1466('0x62'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x27145f=fs['readFileSync'](path[_0x1466('0x63')](config[_0x1466('0x58')],_0x1466('0x64')),'utf8');var _0x2a7ab4=ejs['render'](_0x27145f,{'networks':_0x50e82d||[]});fs[_0x1466('0x5b')](util[_0x1466('0x65')](_0x1466('0x66'),_0x5da0ab[_0x1466('0x54')][_0x1466('0x3a')][_0x1466('0x67')]()),_0x2a7ab4);return respondWithRpcPromise('Reload','destroy',{'module':_0x1466('0x68')});}return null;})[_0x1466('0x27')](handleError(_0x5eb4cb,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8941ec5..e286e34 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 _0xefb4=['bluebird','request-promise','path','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment'];(function(_0x18b8b7,_0x10eb33){var _0xbd131f=function(_0x2e0b2c){while(--_0x2e0b2c){_0x18b8b7['push'](_0x18b8b7['shift']());}};_0xbd131f(++_0x10eb33);}(_0xefb4,0x119));var _0x4efb=function(_0x189881,_0x334cc9){_0x189881=_0x189881-0x0;var _0x38b580=_0xefb4[_0x189881];return _0x38b580;};'use strict';var _=require(_0x4efb('0x0'));var util=require(_0x4efb('0x1'));var logger=require(_0x4efb('0x2'))(_0x4efb('0x3'));var moment=require(_0x4efb('0x4'));var BPromise=require(_0x4efb('0x5'));var rp=require(_0x4efb('0x6'));var fs=require('fs');var path=require(_0x4efb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4efb('0x8'));module[_0x4efb('0x9')]=function(_0x873785,_0x34843c){return _0x873785[_0x4efb('0xa')](_0x4efb('0xb'),attributes,{'tableName':_0x4efb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b11=['network','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network'];(function(_0x834cce,_0x596d61){var _0x3dea43=function(_0x1e03bc){while(--_0x1e03bc){_0x834cce['push'](_0x834cce['shift']());}};_0x3dea43(++_0x596d61);}(_0x2b11,0x17a));var _0x12b1=function(_0x5de8bf,_0x24e115){_0x5de8bf=_0x5de8bf-0x0;var _0x2be3e3=_0x2b11[_0x5de8bf];return _0x2be3e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x12b1('0x0'))(_0x12b1('0x1'));var moment=require(_0x12b1('0x2'));var BPromise=require(_0x12b1('0x3'));var rp=require(_0x12b1('0x4'));var fs=require('fs');var path=require(_0x12b1('0x5'));var rimraf=require(_0x12b1('0x6'));var config=require(_0x12b1('0x7'));var attributes=require(_0x12b1('0x8'));module[_0x12b1('0x9')]=function(_0x565e4f,_0x182dbf){return _0x565e4f[_0x12b1('0xa')](_0x12b1('0xb'),attributes,{'tableName':_0x12b1('0xc'),'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 2a7ac79..ff594c9 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 _0xb64b=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb64b,0xcc));var _0xbb64=function(_0x522c1a,_0x1299ed){_0x522c1a=_0x522c1a-0x0;var _0x5807ee=_0xb64b[_0x522c1a];return _0x5807ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbb64('0x0'));var BPromise=require(_0xbb64('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb64('0x2'));var db=require(_0xbb64('0x3'))['db'];var utils=require(_0xbb64('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbb64('0x5'));var client=jayson[_0xbb64('0x6')][_0xbb64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x140918,_0x5aa9ee,_0xfe43f5){return new BPromise(function(_0x23cfe2,_0x156f6f){return client['request'](_0x140918,_0xfe43f5)[_0xbb64('0x8')](function(_0x40be6e){logger['info'](_0xbb64('0x9'),_0x5aa9ee,_0xbb64('0xa'));logger[_0xbb64('0xb')](_0xbb64('0xc'),_0x5aa9ee,_0xbb64('0xa'),JSON[_0xbb64('0xd')](_0x40be6e));if(_0x40be6e[_0xbb64('0xe')]){if(_0x40be6e[_0xbb64('0xe')][_0xbb64('0xf')]===0x1f4){logger[_0xbb64('0xe')](_0xbb64('0x9'),_0x5aa9ee,_0x40be6e['error']['message']);return _0x156f6f(_0x40be6e[_0xbb64('0xe')][_0xbb64('0x10')]);}logger[_0xbb64('0xe')](_0xbb64('0x9'),_0x5aa9ee,_0x40be6e[_0xbb64('0xe')]['message']);return _0x23cfe2(_0x40be6e[_0xbb64('0xe')][_0xbb64('0x10')]);}else{logger['info'](_0xbb64('0x9'),_0x5aa9ee,_0xbb64('0xa'));_0x23cfe2(_0x40be6e['result'][_0xbb64('0x10')]);}})[_0xbb64('0x11')](function(_0x2d7c4d){logger['error']('Network,\x20%s,\x20%s',_0x5aa9ee,_0x2d7c4d);_0x156f6f(_0x2d7c4d);});});} \ No newline at end of file +var _0x2f01=['message','result','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4166f9,_0x3cf0c4){var _0x55a968=function(_0x405b28){while(--_0x405b28){_0x4166f9['push'](_0x4166f9['shift']());}};_0x55a968(++_0x3cf0c4);}(_0x2f01,0x19a));var _0x12f0=function(_0x4ca68c,_0x4e88c7){_0x4ca68c=_0x4ca68c-0x0;var _0x36ad2a=_0x2f01[_0x4ca68c];return _0x36ad2a;};'use strict';var _=require('lodash');var util=require(_0x12f0('0x0'));var moment=require('moment');var BPromise=require(_0x12f0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x12f0('0x2'));var logger=require(_0x12f0('0x3'))(_0x12f0('0x4'));var config=require('../../config/environment');var jayson=require(_0x12f0('0x5'));var client=jayson[_0x12f0('0x6')][_0x12f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a33a8,_0x464d83,_0x1f9f7f){return new BPromise(function(_0x385f2a,_0x55d774){return client['request'](_0x3a33a8,_0x1f9f7f)[_0x12f0('0x8')](function(_0x5dd30e){logger[_0x12f0('0x9')](_0x12f0('0xa'),_0x464d83,_0x12f0('0xb'));logger[_0x12f0('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x464d83,'request\x20sent',JSON[_0x12f0('0xd')](_0x5dd30e));if(_0x5dd30e[_0x12f0('0xe')]){if(_0x5dd30e[_0x12f0('0xe')]['code']===0x1f4){logger[_0x12f0('0xe')](_0x12f0('0xa'),_0x464d83,_0x5dd30e['error'][_0x12f0('0xf')]);return _0x55d774(_0x5dd30e[_0x12f0('0xe')][_0x12f0('0xf')]);}logger[_0x12f0('0xe')](_0x12f0('0xa'),_0x464d83,_0x5dd30e[_0x12f0('0xe')][_0x12f0('0xf')]);return _0x385f2a(_0x5dd30e[_0x12f0('0xe')][_0x12f0('0xf')]);}else{logger['info'](_0x12f0('0xa'),_0x464d83,_0x12f0('0xb'));_0x385f2a(_0x5dd30e[_0x12f0('0x10')][_0x12f0('0xf')]);}})['catch'](function(_0x1dabd7){logger[_0x12f0('0xe')](_0x12f0('0xa'),_0x464d83,_0x1dabd7);_0x55d774(_0x1dabd7);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index b53e6e3..9239dcd 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80a6=['Router','../../components/auth/service','../../components/interaction/service','./notification.controller','post','isAuthenticated','exports','util','path','connect-timeout','express'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x80a6,0x1ca));var _0x680a=function(_0x35ae7c,_0x4a08f0){_0x35ae7c=_0x35ae7c-0x0;var _0x1aa486=_0x80a6[_0x35ae7c];return _0x1aa486;};'use strict';var multer=require('multer');var util=require(_0x680a('0x0'));var path=require(_0x680a('0x1'));var timeout=require(_0x680a('0x2'));var express=require(_0x680a('0x3'));var router=express[_0x680a('0x4')]();var auth=require(_0x680a('0x5'));var interaction=require(_0x680a('0x6'));var config=require('../../config/environment');var controller=require(_0x680a('0x7'));router[_0x680a('0x8')]('/',auth[_0x680a('0x9')](),controller['sendNotification']);module[_0x680a('0xa')]=router; \ No newline at end of file +var _0x2510=['exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./notification.controller','post'];(function(_0x35b2a1,_0x4cdca8){var _0x6023da=function(_0x10cd9f){while(--_0x10cd9f){_0x35b2a1['push'](_0x35b2a1['shift']());}};_0x6023da(++_0x4cdca8);}(_0x2510,0x169));var _0x0251=function(_0x5412d4,_0x487fe6){_0x5412d4=_0x5412d4-0x0;var _0x1d3dcb=_0x2510[_0x5412d4];return _0x1d3dcb;};'use strict';var multer=require(_0x0251('0x0'));var util=require(_0x0251('0x1'));var path=require(_0x0251('0x2'));var timeout=require('connect-timeout');var express=require(_0x0251('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0251('0x4'));var config=require(_0x0251('0x5'));var controller=require(_0x0251('0x6'));router[_0x0251('0x7')]('/',auth['isAuthenticated'](),controller['sendNotification']);module[_0x0251('0x8')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 5e7ff2c..846e1c6 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51f6=['TEXT','STRING','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x51f6,0x14e));var _0x651f=function(_0x2f3939,_0x58f2cc){_0x2f3939=_0x2f3939-0x0;var _0x1caaa0=_0x51f6[_0x2f3939];return _0x1caaa0;};'use strict';var Sequelize=require(_0x651f('0x0'));module[_0x651f('0x1')]={'body':{'type':Sequelize[_0x651f('0x2')]},'senderName':{'type':Sequelize[_0x651f('0x3')]},'recipientsId':{'type':Sequelize[_0x651f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x651f('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x1212=['sequelize','exports','TEXT','BOOLEAN'];(function(_0x5bdfa8,_0x1f9651){var _0x3cdaf3=function(_0x316246){while(--_0x316246){_0x5bdfa8['push'](_0x5bdfa8['shift']());}};_0x3cdaf3(++_0x1f9651);}(_0x1212,0x184));var _0x2121=function(_0x421ff6,_0x40f195){_0x421ff6=_0x421ff6-0x0;var _0x177051=_0x1212[_0x421ff6];return _0x177051;};'use strict';var Sequelize=require(_0x2121('0x0'));module[_0x2121('0x1')]={'body':{'type':Sequelize[_0x2121('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2121('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 0fdd414..06237f5 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac80=['join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue','Queue','push','flatten','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','then','stack','name','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xac80,0x19c));var _0x0ac8=function(_0x5ece49,_0x129b36){_0x5ece49=_0x5ece49-0x0;var _0x58921a=_0xac80[_0x5ece49];return _0x58921a;};'use strict';var pdf=require(_0x0ac8('0x0'));var emlformat=require(_0x0ac8('0x1'));var rimraf=require(_0x0ac8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ac8('0x3'));var rp=require(_0x0ac8('0x4'));var moment=require(_0x0ac8('0x5'));var BPromise=require(_0x0ac8('0x6'));var Mustache=require(_0x0ac8('0x7'));var util=require('util');var path=require(_0x0ac8('0x8'));var sox=require('sox');var csv=require(_0x0ac8('0x9'));var ejs=require(_0x0ac8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0ac8('0xb'));var deskjs=require(_0x0ac8('0xc'));var toCsv=require(_0x0ac8('0x9'));var querystring=require('querystring');var Papa=require(_0x0ac8('0xd'));var Redis=require(_0x0ac8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0ac8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ac8('0x10'));var utils=require('../../config/utils');var config=require(_0x0ac8('0x11'));var licenseUtil=require(_0x0ac8('0x12'));var db=require(_0x0ac8('0x13'))['db'];config[_0x0ac8('0x14')]=_[_0x0ac8('0x15')](config[_0x0ac8('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ac8('0x16'))(new Redis(config[_0x0ac8('0x14')]));require(_0x0ac8('0x17'))['register'](socket);function respondWithStatusCode(_0x1f3610,_0x50fa2f){_0x50fa2f=_0x50fa2f||0xcc;return function(_0x596fd6){if(_0x596fd6){return _0x1f3610[_0x0ac8('0x18')](_0x50fa2f);}return _0x1f3610[_0x0ac8('0x19')](_0x50fa2f)[_0x0ac8('0x1a')]();};}function respondWithResult(_0x30b75c,_0x132507){_0x132507=_0x132507||0xc8;return function(_0xa82d94){if(_0xa82d94){return _0x30b75c['status'](_0x132507)[_0x0ac8('0x1b')](_0xa82d94);}};}function respondWithFilteredResult(_0x40fd4b,_0x53d121){return function(_0x23b950){if(_0x23b950){var _0x128f1d=_0x23b950[_0x0ac8('0x1c')],_0x5403c8=_0x53d121[_0x0ac8('0x1d')],_0x3d1c14=_0x53d121[_0x0ac8('0x1d')]+_0x53d121['limit'],_0x501741;if(_0x3d1c14>=_0x128f1d){_0x3d1c14=_0x128f1d;_0x501741=0xc8;}else{_0x501741=0xce;}_0x40fd4b['status'](_0x501741);return _0x40fd4b[_0x0ac8('0x1e')](_0x0ac8('0x1f'),_0x5403c8+'-'+_0x3d1c14+'/'+_0x128f1d)[_0x0ac8('0x1b')](_0x23b950);}return null;};}function patchUpdates(_0x187a29){return function(_0x46c020){try{jsonpatch[_0x0ac8('0x20')](_0x46c020,_0x187a29,!![]);}catch(_0x293a26){return BPromise['reject'](_0x293a26);}return _0x46c020[_0x0ac8('0x21')]();};}function saveUpdates(_0x2c5d41,_0x5bdf87){return function(_0x4631d7){if(_0x4631d7){return _0x4631d7[_0x0ac8('0x22')](_0x2c5d41)['then'](function(_0x5c904e){return _0x5c904e;});}return null;};}function removeEntity(_0x14be3a,_0x3d0e5f){return function(_0x8c140d){if(_0x8c140d){return _0x8c140d[_0x0ac8('0x23')]()[_0x0ac8('0x24')](function(){_0x14be3a[_0x0ac8('0x19')](0xcc)[_0x0ac8('0x1a')]();});}};}function handleEntityNotFound(_0xcf9a67,_0x25940b){return function(_0x296228){if(!_0x296228){_0xcf9a67[_0x0ac8('0x18')](0x194);}return _0x296228;};}function handleError(_0x4cbf33,_0x56545a){_0x56545a=_0x56545a||0x1f4;return function(_0x53c5b){logger['error'](_0x53c5b[_0x0ac8('0x25')]);if(_0x53c5b[_0x0ac8('0x26')]){delete _0x53c5b[_0x0ac8('0x26')];}_0x4cbf33['status'](_0x56545a)['send'](_0x53c5b);};}exports[_0x0ac8('0x27')]=function(_0x255ac5,_0x5d3b28,_0x427a85){if(!_0x255ac5['body'][_0x0ac8('0x28')](_0x0ac8('0x29'))&&!_0x255ac5[_0x0ac8('0x2a')][_0x0ac8('0x28')](_0x0ac8('0x2b'))){throw new db[(_0x0ac8('0x2c'))][(_0x0ac8('0x2d'))](_0x0ac8('0x2e'));}else{if(_0x255ac5['body']['hasOwnProperty'](_0x0ac8('0x2b'))&&!_0x255ac5[_0x0ac8('0x2a')][_0x0ac8('0x28')]('view')){throw new db[(_0x0ac8('0x2c'))][(_0x0ac8('0x2d'))](_0x0ac8('0x2f'));}if(!_0x255ac5[_0x0ac8('0x2a')][_0x0ac8('0x28')](_0x0ac8('0x30'))){throw new db[(_0x0ac8('0x2c'))][(_0x0ac8('0x2d'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5eb4bc=JSON[_0x0ac8('0x31')](_0x255ac5[_0x0ac8('0x2a')]['recipients']);}catch(_0x124faa){logger['error'](_0x124faa);throw new db[(_0x0ac8('0x2c'))][(_0x0ac8('0x2d'))](_0x0ac8('0x32'));}var _0x561712=[_0x0ac8('0x33'),_0x0ac8('0x34'),_0x0ac8('0x35'),_0x0ac8('0x36'),_0x0ac8('0x37'),_0x0ac8('0x38'),_0x0ac8('0x39'),_0x0ac8('0x3a'),'user'];if(_[_0x0ac8('0x3b')](_0x5eb4bc,function(_0x1d36c7){return!_[_0x0ac8('0x3c')](_0x561712,_0x1d36c7[_0x0ac8('0x3d')][_0x0ac8('0x3e')]());})){throw new db['Sequelize']['ValidationError'](_0x0ac8('0x3f'));}}}var _0x50e6bc={};_0x50e6bc['senderName']=_0x255ac5[_0x0ac8('0x2a')]['hasOwnProperty'](_0x0ac8('0x40'))?_0x255ac5[_0x0ac8('0x2a')]['senderName']:_0x255ac5[_0x0ac8('0x41')][_0x0ac8('0x42')];_0x50e6bc[_0x0ac8('0x43')]=_[_0x0ac8('0x44')](_0x255ac5[_0x0ac8('0x2a')]['recipientsDescription'])?null:_0x255ac5['body']['recipientsDescription'];_0x50e6bc[_0x0ac8('0x45')]=_0x255ac5['body'][_0x0ac8('0x45')]||![];_0x50e6bc[_0x0ac8('0x46')]=_0x255ac5[_0x0ac8('0x41')]['id'];return getContent(_0x255ac5[_0x0ac8('0x2a')])[_0x0ac8('0x24')](function(_0x1b654b){_0x50e6bc[_0x0ac8('0x2a')]=_0x1b654b;return getRecipients(_0x5eb4bc);})[_0x0ac8('0x24')](function(_0x2a214e){_0x50e6bc[_0x0ac8('0x47')]=_[_0x0ac8('0x48')](_0x2a214e)[_0x0ac8('0x49')](',');return db[_0x0ac8('0x4a')][_0x0ac8('0x4b')](function(_0x389d9b){return db[_0x0ac8('0x4c')][_0x0ac8('0x4d')](_0x50e6bc,{'raw':!![],'transaction':_0x389d9b})[_0x0ac8('0x24')](function(_0x86c9cd){var _0x3599e7={'sender':_0x50e6bc['senderName'],'description':_0x50e6bc['recipientsDescription'],'content':_0x50e6bc['body'],'beep':_0x50e6bc[_0x0ac8('0x45')]};_0x2a214e[_0x0ac8('0x4e')](function(_0x44d615){_0x3599e7[_0x0ac8('0x4f')]=_0x44d615;socket[_0x0ac8('0x50')](_0x0ac8('0x51'),_0x3599e7);});return _0x86c9cd;});});})['then'](respondWithResult(_0x5d3b28,0xc9))[_0x0ac8('0x52')](handleError(_0x5d3b28,null));};function getContent(_0x17f57b){return new BPromise(function(_0x5c95e9,_0x3f1315){if(_0x17f57b[_0x0ac8('0x29')]){_0x5c95e9(_0x17f57b[_0x0ac8('0x29')]);return;}return db['Template'][_0x0ac8('0x53')]({'attributes':[_0x0ac8('0x54')],'where':{'id':_0x17f57b['TemplateId']},'raw':!![]})[_0x0ac8('0x24')](function(_0x48a524){if(!_0x48a524)throw new db[(_0x0ac8('0x2c'))][(_0x0ac8('0x2d'))](_0x0ac8('0x55'));var _0x303dc1=Mustache[_0x0ac8('0x56')](_0x48a524[_0x0ac8('0x54')],_0x17f57b[_0x0ac8('0x57')]);_0x5c95e9(_0x303dc1);})[_0x0ac8('0x52')](function(_0xc77b65){_0x3f1315(_0xc77b65);});});}function getRecipients(_0x8ca7ef){return new BPromise(function(_0x3afc8e,_0x3979ed){var _0x3da717=[];var _0x4d1800=[];_0x8ca7ef[_0x0ac8('0x4e')](function(_0x582a7c){var _0x1d9682=_[_0x0ac8('0x58')](_0x582a7c[_0x0ac8('0x3d')][_0x0ac8('0x3e')]());if(_0x1d9682===_0x0ac8('0x59')){_0x3da717=_[_0x0ac8('0x5a')](_0x3da717,_0x582a7c[_0x0ac8('0x5b')]);}else{if(_[_0x0ac8('0x3c')](_0x1d9682,_0x0ac8('0x5c')))_0x1d9682=_0x1d9682['replace'](_0x0ac8('0x5c'),_0x0ac8('0x5d'));_0x582a7c['ids'][_0x0ac8('0x4e')](function(_0x53bc32){_0x4d1800[_0x0ac8('0x5e')](getAgents(_0x1d9682,_0x53bc32));});}});return BPromise['all'](_0x4d1800)['then'](function(_0x5dcf02){_0x3da717=_[_0x0ac8('0x5a')](_0x3da717,_[_0x0ac8('0x5f')](_0x5dcf02));_0x3afc8e(_0x3da717);})[_0x0ac8('0x52')](function(_0x5b9448){_0x3979ed(_0x5b9448);});});}function getAgents(_0x28472d,_0x427982){return new BPromise(function(_0x494000,_0x2f97a0){return db[_0x28472d][_0x0ac8('0x53')]({'where':{'id':_0x427982}})[_0x0ac8('0x24')](function(_0x1b922c){return _0x1b922c['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x30c54b){var _0x4d7be1=_[_0x0ac8('0x60')](_0x30c54b,'id');_0x494000(_0x4d7be1);});})[_0x0ac8('0x52')](function(_0x5384d9){_0x2f97a0(_0x5384d9);});});} \ No newline at end of file +var _0x6525=['defaults','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','sendNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','recipient','emit','notification:send','catch','Template','findOne','html','render','startCase','ids','queue','replace','Queue','forEach','push','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x12db71,_0x4ac41b){var _0x2dacbd=function(_0x5b94c1){while(--_0x5b94c1){_0x12db71['push'](_0x12db71['shift']());}};_0x2dacbd(++_0x4ac41b);}(_0x6525,0xb8));var _0x5652=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x6525[_0x3d5df9];return _0x50ba39;};'use strict';var pdf=require(_0x5652('0x0'));var emlformat=require(_0x5652('0x1'));var rimraf=require(_0x5652('0x2'));var zipdir=require(_0x5652('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5652('0x4'));var moment=require(_0x5652('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5652('0x6'));var path=require(_0x5652('0x7'));var sox=require(_0x5652('0x8'));var csv=require(_0x5652('0x9'));var ejs=require(_0x5652('0xa'));var fs=require('fs');var _=require(_0x5652('0xb'));var squel=require(_0x5652('0xc'));var crypto=require(_0x5652('0xd'));var jsforce=require(_0x5652('0xe'));var deskjs=require(_0x5652('0xf'));var toCsv=require(_0x5652('0x9'));var querystring=require(_0x5652('0x10'));var Papa=require(_0x5652('0x11'));var Redis=require('ioredis');var authService=require(_0x5652('0x12'));var qs=require(_0x5652('0x13'));var as=require(_0x5652('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5652('0x15'))(_0x5652('0x16'));var utils=require(_0x5652('0x17'));var config=require(_0x5652('0x18'));var licenseUtil=require(_0x5652('0x19'));var db=require(_0x5652('0x1a'))['db'];config[_0x5652('0x1b')]=_[_0x5652('0x1c')](config[_0x5652('0x1b')],{'host':_0x5652('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./notification.socket')[_0x5652('0x1e')](socket);function respondWithStatusCode(_0xb5ef91,_0x4831ad){_0x4831ad=_0x4831ad||0xcc;return function(_0x379bba){if(_0x379bba){return _0xb5ef91[_0x5652('0x1f')](_0x4831ad);}return _0xb5ef91[_0x5652('0x20')](_0x4831ad)[_0x5652('0x21')]();};}function respondWithResult(_0x119648,_0x46d121){_0x46d121=_0x46d121||0xc8;return function(_0x242b4a){if(_0x242b4a){return _0x119648[_0x5652('0x20')](_0x46d121)['json'](_0x242b4a);}};}function respondWithFilteredResult(_0x475a24,_0x51dfa3){return function(_0x4ce056){if(_0x4ce056){var _0x2e8aba=_0x4ce056[_0x5652('0x22')],_0x1380b8=_0x51dfa3['offset'],_0x54c751=_0x51dfa3[_0x5652('0x23')]+_0x51dfa3[_0x5652('0x24')],_0x34128a;if(_0x54c751>=_0x2e8aba){_0x54c751=_0x2e8aba;_0x34128a=0xc8;}else{_0x34128a=0xce;}_0x475a24['status'](_0x34128a);return _0x475a24[_0x5652('0x25')](_0x5652('0x26'),_0x1380b8+'-'+_0x54c751+'/'+_0x2e8aba)[_0x5652('0x27')](_0x4ce056);}return null;};}function patchUpdates(_0x3e1fd2){return function(_0xf80301){try{jsonpatch[_0x5652('0x28')](_0xf80301,_0x3e1fd2,!![]);}catch(_0x45bb37){return BPromise[_0x5652('0x29')](_0x45bb37);}return _0xf80301[_0x5652('0x2a')]();};}function saveUpdates(_0x906b57,_0xf72707){return function(_0xeed188){if(_0xeed188){return _0xeed188[_0x5652('0x2b')](_0x906b57)[_0x5652('0x2c')](function(_0x4f607d){return _0x4f607d;});}return null;};}function removeEntity(_0x3becfc,_0x5855b9){return function(_0x5be13a){if(_0x5be13a){return _0x5be13a[_0x5652('0x2d')]()[_0x5652('0x2c')](function(){_0x3becfc[_0x5652('0x20')](0xcc)[_0x5652('0x21')]();});}};}function handleEntityNotFound(_0x374120,_0x5e3e81){return function(_0x1586f8){if(!_0x1586f8){_0x374120['sendStatus'](0x194);}return _0x1586f8;};}function handleError(_0x203abd,_0x321eee){_0x321eee=_0x321eee||0x1f4;return function(_0x7dea85){logger['error'](_0x7dea85[_0x5652('0x2e')]);if(_0x7dea85['name']){delete _0x7dea85[_0x5652('0x2f')];}_0x203abd[_0x5652('0x20')](_0x321eee)[_0x5652('0x30')](_0x7dea85);};}exports[_0x5652('0x31')]=function(_0x2590ed,_0x3868f5,_0x5cd92c){if(!_0x2590ed[_0x5652('0x32')]['hasOwnProperty'](_0x5652('0x33'))&&!_0x2590ed[_0x5652('0x32')][_0x5652('0x34')](_0x5652('0x35'))){throw new db['Sequelize'][(_0x5652('0x36'))](_0x5652('0x37'));}else{if(_0x2590ed[_0x5652('0x32')][_0x5652('0x34')]('TemplateId')&&!_0x2590ed['body'][_0x5652('0x34')](_0x5652('0x38'))){throw new db[(_0x5652('0x39'))][(_0x5652('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2590ed[_0x5652('0x32')][_0x5652('0x34')](_0x5652('0x3a'))){throw new db[(_0x5652('0x39'))][(_0x5652('0x36'))](_0x5652('0x3b'));}else{try{var _0x464234=JSON[_0x5652('0x3c')](_0x2590ed[_0x5652('0x32')]['recipients']);}catch(_0x219642){logger[_0x5652('0x3d')](_0x219642);throw new db[(_0x5652('0x39'))][(_0x5652('0x36'))](_0x5652('0x3e'));}var _0x3eb1e9=[_0x5652('0x3f'),_0x5652('0x40'),_0x5652('0x41'),'openchannelqueue',_0x5652('0x42'),_0x5652('0x43'),_0x5652('0x44'),_0x5652('0x45'),_0x5652('0x46')];if(_[_0x5652('0x47')](_0x464234,function(_0xfe9432){return!_[_0x5652('0x48')](_0x3eb1e9,_0xfe9432[_0x5652('0x49')][_0x5652('0x4a')]());})){throw new db[(_0x5652('0x39'))]['ValidationError'](_0x5652('0x4b'));}}}var _0x49e165={};_0x49e165[_0x5652('0x4c')]=_0x2590ed[_0x5652('0x32')][_0x5652('0x34')](_0x5652('0x4c'))?_0x2590ed['body']['senderName']:_0x2590ed['user'][_0x5652('0x4d')];_0x49e165[_0x5652('0x4e')]=_[_0x5652('0x4f')](_0x2590ed[_0x5652('0x32')][_0x5652('0x4e')])?null:_0x2590ed[_0x5652('0x32')][_0x5652('0x4e')];_0x49e165[_0x5652('0x50')]=_0x2590ed[_0x5652('0x32')][_0x5652('0x50')]||![];_0x49e165[_0x5652('0x51')]=_0x2590ed[_0x5652('0x46')]['id'];return getContent(_0x2590ed[_0x5652('0x32')])[_0x5652('0x2c')](function(_0x479f7e){_0x49e165[_0x5652('0x32')]=_0x479f7e;return getRecipients(_0x464234);})[_0x5652('0x2c')](function(_0x5b52a6){_0x49e165[_0x5652('0x52')]=_[_0x5652('0x53')](_0x5b52a6)['join'](',');return db[_0x5652('0x54')][_0x5652('0x55')](function(_0x56f66f){return db['Notification'][_0x5652('0x56')](_0x49e165,{'raw':!![],'transaction':_0x56f66f})['then'](function(_0xde5e7b){var _0x414d5a={'sender':_0x49e165[_0x5652('0x4c')],'description':_0x49e165[_0x5652('0x4e')],'content':_0x49e165[_0x5652('0x32')],'beep':_0x49e165[_0x5652('0x50')]};_0x5b52a6['forEach'](function(_0x2c08ac){_0x414d5a[_0x5652('0x57')]=_0x2c08ac;socket[_0x5652('0x58')](_0x5652('0x59'),_0x414d5a);});return _0xde5e7b;});});})[_0x5652('0x2c')](respondWithResult(_0x3868f5,0xc9))[_0x5652('0x5a')](handleError(_0x3868f5,null));};function getContent(_0x29379c){return new BPromise(function(_0x438b43,_0x121739){if(_0x29379c[_0x5652('0x33')]){_0x438b43(_0x29379c[_0x5652('0x33')]);return;}return db[_0x5652('0x5b')][_0x5652('0x5c')]({'attributes':[_0x5652('0x5d')],'where':{'id':_0x29379c[_0x5652('0x35')]},'raw':!![]})['then'](function(_0x2a3be8){if(!_0x2a3be8)throw new db[(_0x5652('0x39'))][(_0x5652('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x35362e=Mustache[_0x5652('0x5e')](_0x2a3be8[_0x5652('0x5d')],_0x29379c[_0x5652('0x38')]);_0x438b43(_0x35362e);})[_0x5652('0x5a')](function(_0x1fed22){_0x121739(_0x1fed22);});});}function getRecipients(_0x2bf108){return new BPromise(function(_0x2021e2,_0xa443d0){var _0x5773cf=[];var _0x528457=[];_0x2bf108['forEach'](function(_0x5a7499){var _0x24630a=_[_0x5652('0x5f')](_0x5a7499[_0x5652('0x49')]['toLowerCase']());if(_0x24630a==='User'){_0x5773cf=_['union'](_0x5773cf,_0x5a7499[_0x5652('0x60')]);}else{if(_[_0x5652('0x48')](_0x24630a,_0x5652('0x61')))_0x24630a=_0x24630a[_0x5652('0x62')](_0x5652('0x61'),_0x5652('0x63'));_0x5a7499[_0x5652('0x60')][_0x5652('0x64')](function(_0x395074){_0x528457[_0x5652('0x65')](getAgents(_0x24630a,_0x395074));});}});return BPromise['all'](_0x528457)['then'](function(_0x108409){_0x5773cf=_[_0x5652('0x66')](_0x5773cf,_[_0x5652('0x67')](_0x108409));_0x2021e2(_0x5773cf);})[_0x5652('0x5a')](function(_0x45501d){_0xa443d0(_0x45501d);});});}function getAgents(_0x5a6168,_0x2f7cf8){return new BPromise(function(_0x3f921e,_0x220d30){return db[_0x5a6168][_0x5652('0x5c')]({'where':{'id':_0x2f7cf8}})['then'](function(_0x293587){return _0x293587[_0x5652('0x68')]({'attributes':['id'],'raw':!![]})[_0x5652('0x2c')](function(_0x1c0118){var _0x3477fb=_[_0x5652('0x69')](_0x1c0118,'id');_0x3f921e(_0x3477fb);});})[_0x5652('0x5a')](function(_0xf79406){_0x220d30(_0xf79406);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index bdbf11d..ea70190 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['Notification','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4789ee,_0x371f2e){var _0x31d364=function(_0x17c9bf){while(--_0x17c9bf){_0x4789ee['push'](_0x4789ee['shift']());}};_0x31d364(++_0x371f2e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x0b0e[_0x17a32f];return _0x15a293;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var Notification=require('../../mysqldb')['db'][_0xe0b0('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){NotificationEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);NotificationEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];Notification[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x32adcb,_0xb8324){var _0x520fae=function(_0x4a7d56){while(--_0x4a7d56){_0x32adcb['push'](_0x32adcb['shift']());}};_0x520fae(++_0xb8324);}(_0x5f2f,0x73));var _0xf5f2=function(_0x43fb15,_0x4b3f5b){_0x43fb15=_0x43fb15-0x0;var _0x42d47a=_0x5f2f[_0x43fb15];return _0x42d47a;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 804e260..4126f26 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a11=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4'];(function(_0xddb92c,_0x3ef53f){var _0x1d62a3=function(_0x22b284){while(--_0x22b284){_0xddb92c['push'](_0xddb92c['shift']());}};_0x1d62a3(++_0x3ef53f);}(_0x6a11,0xf1));var _0x16a1=function(_0x595ddf,_0x372ccb){_0x595ddf=_0x595ddf-0x0;var _0x1cb08e=_0x6a11[_0x595ddf];return _0x1cb08e;};'use strict';var _=require(_0x16a1('0x0'));var util=require(_0x16a1('0x1'));var logger=require(_0x16a1('0x2'))(_0x16a1('0x3'));var moment=require(_0x16a1('0x4'));var BPromise=require(_0x16a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16a1('0x6'));var rimraf=require(_0x16a1('0x7'));var config=require(_0x16a1('0x8'));var attributes=require(_0x16a1('0x9'));module[_0x16a1('0xa')]=function(_0x53c393,_0x209294){return _0x53c393[_0x16a1('0xb')](_0x16a1('0xc'),attributes,{'tableName':_0x16a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x16a1('0xe'),'collate':_0x16a1('0xf')});}; \ No newline at end of file +var _0x504f=['notifications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Notification'];(function(_0x253804,_0x4101e2){var _0x26cb31=function(_0xfdc5b0){while(--_0xfdc5b0){_0x253804['push'](_0x253804['shift']());}};_0x26cb31(++_0x4101e2);}(_0x504f,0x17b));var _0xf504=function(_0x1b498f,_0x483697){_0x1b498f=_0x1b498f-0x0;var _0x2312bf=_0x504f[_0x1b498f];return _0x2312bf;};'use strict';var _=require(_0xf504('0x0'));var util=require('util');var logger=require(_0xf504('0x1'))(_0xf504('0x2'));var moment=require(_0xf504('0x3'));var BPromise=require(_0xf504('0x4'));var rp=require(_0xf504('0x5'));var fs=require('fs');var path=require(_0xf504('0x6'));var rimraf=require(_0xf504('0x7'));var config=require('../../config/environment');var attributes=require('./notification.attributes');module[_0xf504('0x8')]=function(_0x57a5cf,_0xe33f0d){return _0x57a5cf[_0xf504('0x9')](_0xf504('0xa'),attributes,{'tableName':_0xf504('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf504('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index c17f74f..f3a37b1 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fd6=['then','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','code','error','message','Notification,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request'];(function(_0x22c352,_0x30e2ef){var _0x34fa85=function(_0x2acbc7){while(--_0x2acbc7){_0x22c352['push'](_0x22c352['shift']());}};_0x34fa85(++_0x30e2ef);}(_0x8fd6,0xdd));var _0x68fd=function(_0x4b2b3e,_0x720687){_0x4b2b3e=_0x4b2b3e-0x0;var _0x2f59a6=_0x8fd6[_0x4b2b3e];return _0x2f59a6;};'use strict';var _=require(_0x68fd('0x0'));var util=require(_0x68fd('0x1'));var moment=require('moment');var BPromise=require(_0x68fd('0x2'));var rs=require(_0x68fd('0x3'));var fs=require('fs');var Redis=require(_0x68fd('0x4'));var db=require(_0x68fd('0x5'))['db'];var utils=require(_0x68fd('0x6'));var logger=require(_0x68fd('0x7'))(_0x68fd('0x8'));var config=require(_0x68fd('0x9'));var jayson=require(_0x68fd('0xa'));var client=jayson['client'][_0x68fd('0xb')]({'port':0x232a});config[_0x68fd('0xc')]=_[_0x68fd('0xd')](config[_0x68fd('0xc')],{'host':_0x68fd('0xe'),'port':0x18eb});var socket=require(_0x68fd('0xf'))(new Redis(config[_0x68fd('0xc')]));require(_0x68fd('0x10'))[_0x68fd('0x11')](socket);function respondWithRpcPromise(_0x4bde0f,_0x22ec59,_0x6cc8b9){return new BPromise(function(_0xefd29d,_0x59c79e){return client[_0x68fd('0x12')](_0x4bde0f,_0x6cc8b9)[_0x68fd('0x13')](function(_0x44fc92){logger['info']('Notification,\x20%s,\x20%s',_0x22ec59,_0x68fd('0x14'));logger[_0x68fd('0x15')](_0x68fd('0x16'),_0x22ec59,_0x68fd('0x14'),JSON['stringify'](_0x44fc92));if(_0x44fc92['error']){if(_0x44fc92['error'][_0x68fd('0x17')]===0x1f4){logger[_0x68fd('0x18')]('Notification,\x20%s,\x20%s',_0x22ec59,_0x44fc92['error'][_0x68fd('0x19')]);return _0x59c79e(_0x44fc92[_0x68fd('0x18')][_0x68fd('0x19')]);}logger[_0x68fd('0x18')](_0x68fd('0x1a'),_0x22ec59,_0x44fc92[_0x68fd('0x18')][_0x68fd('0x19')]);return _0xefd29d(_0x44fc92[_0x68fd('0x18')][_0x68fd('0x19')]);}else{logger[_0x68fd('0x1b')](_0x68fd('0x1a'),_0x22ec59,_0x68fd('0x14'));_0xefd29d(_0x44fc92[_0x68fd('0x1c')][_0x68fd('0x19')]);}})[_0x68fd('0x1d')](function(_0x2a84df){logger['error']('Notification,\x20%s,\x20%s',_0x22ec59,_0x2a84df);_0x59c79e(_0x2a84df);});});} \ No newline at end of file +var _0x0c56=['http','redis','defaults','./notification.socket','register','then','info','request\x20sent','stringify','error','Notification,\x20%s,\x20%s','message','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c56,0xf4));var _0x60c5=function(_0xf6499d,_0xdb03df){_0xf6499d=_0xf6499d-0x0;var _0x18fd22=_0x0c56[_0xf6499d];return _0x18fd22;};'use strict';var _=require('lodash');var util=require(_0x60c5('0x0'));var moment=require('moment');var BPromise=require(_0x60c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60c5('0x2'))['db'];var utils=require(_0x60c5('0x3'));var logger=require(_0x60c5('0x4'))(_0x60c5('0x5'));var config=require(_0x60c5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x60c5('0x7')][_0x60c5('0x8')]({'port':0x232a});config[_0x60c5('0x9')]=_[_0x60c5('0xa')](config[_0x60c5('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x60c5('0xb'))[_0x60c5('0xc')](socket);function respondWithRpcPromise(_0x379b21,_0x30df56,_0x636012){return new BPromise(function(_0x1416bd,_0x51cc3f){return client['request'](_0x379b21,_0x636012)[_0x60c5('0xd')](function(_0x20e22b){logger[_0x60c5('0xe')]('Notification,\x20%s,\x20%s',_0x30df56,'request\x20sent');logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x30df56,_0x60c5('0xf'),JSON[_0x60c5('0x10')](_0x20e22b));if(_0x20e22b[_0x60c5('0x11')]){if(_0x20e22b[_0x60c5('0x11')]['code']===0x1f4){logger['error'](_0x60c5('0x12'),_0x30df56,_0x20e22b[_0x60c5('0x11')][_0x60c5('0x13')]);return _0x51cc3f(_0x20e22b[_0x60c5('0x11')][_0x60c5('0x13')]);}logger['error'](_0x60c5('0x12'),_0x30df56,_0x20e22b[_0x60c5('0x11')][_0x60c5('0x13')]);return _0x1416bd(_0x20e22b[_0x60c5('0x11')][_0x60c5('0x13')]);}else{logger[_0x60c5('0xe')](_0x60c5('0x12'),_0x30df56,_0x60c5('0xf'));_0x1416bd(_0x20e22b['result'][_0x60c5('0x13')]);}})[_0x60c5('0x14')](function(_0x4c1b96){logger[_0x60c5('0x11')](_0x60c5('0x12'),_0x30df56,_0x4c1b96);_0x51cc3f(_0x4c1b96);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 507111d..75b70e0 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b1e=['./notification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b1e,0xf0));var _0xe1b1=function(_0x31ed74,_0x96d0de){_0x31ed74=_0x31ed74-0x0;var _0x260f84=_0x1b1e[_0x31ed74];return _0x260f84;};'use strict';var NotificationEvents=require(_0xe1b1('0x0'));var events=[_0xe1b1('0x1'),_0xe1b1('0x2'),_0xe1b1('0x3')];function createListener(_0x1fedef,_0x2b2020){return function(_0xd68d71){_0x2b2020[_0xe1b1('0x4')](_0x1fedef,_0xd68d71);};}function removeListener(_0x3cb24f,_0x99d63b){return function(){NotificationEvents[_0xe1b1('0x5')](_0x3cb24f,_0x99d63b);};}exports[_0xe1b1('0x6')]=function(_0x108c07){for(var _0x43c58c=0x0,_0x2ad52a=events[_0xe1b1('0x7')];_0x43c58c<_0x2ad52a;_0x43c58c++){var _0x2ae9b2=events[_0x43c58c];var _0x44694f=createListener('notification:'+_0x2ae9b2,_0x108c07);NotificationEvents['on'](_0x2ae9b2,_0x44694f);}}; \ No newline at end of file +var _0x79a8=['remove','update','emit','removeListener','register','length','notification:','save'];(function(_0x34c3ac,_0x40a7f4){var _0x6661a1=function(_0x14f2ec){while(--_0x14f2ec){_0x34c3ac['push'](_0x34c3ac['shift']());}};_0x6661a1(++_0x40a7f4);}(_0x79a8,0xe7));var _0x879a=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0x79a8[_0x1fb9d2];return _0x4a8916;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x879a('0x0'),_0x879a('0x1'),_0x879a('0x2')];function createListener(_0x3f335e,_0x3092b1){return function(_0x23c9e4){_0x3092b1[_0x879a('0x3')](_0x3f335e,_0x23c9e4);};}function removeListener(_0x3d5958,_0x4e9fa4){return function(){NotificationEvents[_0x879a('0x4')](_0x3d5958,_0x4e9fa4);};}exports[_0x879a('0x5')]=function(_0x5c0fe2){for(var _0x44a804=0x0,_0x4e6b36=events[_0x879a('0x6')];_0x44a804<_0x4e6b36;_0x44a804++){var _0x3e9f82=events[_0x44a804];var _0x24bd54=createListener(_0x879a('0x7')+_0x3e9f82,_0x5c0fe2);NotificationEvents['on'](_0x3e9f82,_0x24bd54);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b8dd127..126f380 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 _0x65f1=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','send','put','/:id','update','removeDispositions','removeAnswers','removeAgents','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','describe','getDispositions'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x65f1,0x181));var _0x165f=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x65f1[_0x2e8418];return _0x548fe6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x165f('0x0'));var express=require('express');var router=express[_0x165f('0x1')]();var auth=require(_0x165f('0x2'));var interaction=require(_0x165f('0x3'));var config=require(_0x165f('0x4'));var controller=require(_0x165f('0x5'));router['get']('/',auth[_0x165f('0x6')](),controller['index']);router[_0x165f('0x7')](_0x165f('0x8'),auth[_0x165f('0x6')](),controller[_0x165f('0x9')]);router[_0x165f('0x7')]('/:id',auth[_0x165f('0x6')](),controller['show']);router[_0x165f('0x7')]('/:id/dispositions',auth[_0x165f('0x6')](),controller[_0x165f('0xa')]);router[_0x165f('0x7')](_0x165f('0xb'),auth[_0x165f('0x6')](),controller[_0x165f('0xc')]);router[_0x165f('0x7')]('/:id/applications',auth[_0x165f('0x6')](),controller[_0x165f('0xd')]);router['get'](_0x165f('0xe'),auth[_0x165f('0x6')](),controller[_0x165f('0xf')]);router['get'](_0x165f('0x10'),auth[_0x165f('0x6')](),controller[_0x165f('0x11')]);router[_0x165f('0x12')]('/',auth[_0x165f('0x6')](),controller[_0x165f('0x13')]);router[_0x165f('0x12')](_0x165f('0x14'),auth[_0x165f('0x6')](),controller['addDisposition']);router[_0x165f('0x12')](_0x165f('0xb'),auth[_0x165f('0x6')](),controller[_0x165f('0x15')]);router[_0x165f('0x12')](_0x165f('0x16'),controller[_0x165f('0x17')]);router[_0x165f('0x12')](_0x165f('0x18'),auth[_0x165f('0x6')](),controller['addApplications']);router[_0x165f('0x12')]('/:id/users',auth[_0x165f('0x6')](),controller['addAgents']);router[_0x165f('0x12')](_0x165f('0x19'),auth[_0x165f('0x6')](),controller[_0x165f('0x1a')]);router[_0x165f('0x1b')](_0x165f('0x1c'),auth[_0x165f('0x6')](),controller[_0x165f('0x1d')]);router['delete'](_0x165f('0x1c'),auth[_0x165f('0x6')](),controller['destroy']);router['delete'](_0x165f('0x14'),auth[_0x165f('0x6')](),controller[_0x165f('0x1e')]);router['delete'](_0x165f('0xb'),auth[_0x165f('0x6')](),controller[_0x165f('0x1f')]);router['delete']('/:id/users',auth[_0x165f('0x6')](),controller[_0x165f('0x20')]);module['exports']=router; \ No newline at end of file +var _0x514f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addAgents','/:id/send','send','/:id','delete','removeDispositions','removeAnswers','removeAgents','multer','util'];(function(_0xbc3ff0,_0x3eaaca){var _0x4cf6b5=function(_0x103b97){while(--_0x103b97){_0xbc3ff0['push'](_0xbc3ff0['shift']());}};_0x4cf6b5(++_0x3eaaca);}(_0x514f,0xfe));var _0xf514=function(_0x25295d,_0x400fb9){_0x25295d=_0x25295d-0x0;var _0x210130=_0x514f[_0x25295d];return _0x210130;};'use strict';var multer=require(_0xf514('0x0'));var util=require(_0xf514('0x1'));var path=require(_0xf514('0x2'));var timeout=require(_0xf514('0x3'));var express=require('express');var router=express[_0xf514('0x4')]();var auth=require(_0xf514('0x5'));var interaction=require(_0xf514('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xf514('0x7')](),controller[_0xf514('0x8')]);router[_0xf514('0x9')](_0xf514('0xa'),auth[_0xf514('0x7')](),controller['describe']);router[_0xf514('0x9')]('/:id',auth[_0xf514('0x7')](),controller['show']);router[_0xf514('0x9')](_0xf514('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xf514('0xc'),auth[_0xf514('0x7')](),controller[_0xf514('0xd')]);router[_0xf514('0x9')]('/:id/applications',auth[_0xf514('0x7')](),controller['getApplications']);router[_0xf514('0x9')](_0xf514('0xe'),auth[_0xf514('0x7')](),controller[_0xf514('0xf')]);router[_0xf514('0x9')](_0xf514('0x10'),auth[_0xf514('0x7')](),controller[_0xf514('0x11')]);router['post']('/',auth[_0xf514('0x7')](),controller['create']);router[_0xf514('0x12')](_0xf514('0xb'),auth[_0xf514('0x7')](),controller[_0xf514('0x13')]);router['post']('/:id/canned_answers',auth[_0xf514('0x7')](),controller[_0xf514('0x14')]);router[_0xf514('0x12')](_0xf514('0x15'),controller[_0xf514('0x16')]);router[_0xf514('0x12')](_0xf514('0x17'),auth[_0xf514('0x7')](),controller['addApplications']);router[_0xf514('0x12')]('/:id/users',auth[_0xf514('0x7')](),controller[_0xf514('0x18')]);router['post'](_0xf514('0x19'),auth[_0xf514('0x7')](),controller[_0xf514('0x1a')]);router['put'](_0xf514('0x1b'),auth[_0xf514('0x7')](),controller['update']);router[_0xf514('0x1c')](_0xf514('0x1b'),auth[_0xf514('0x7')](),controller['destroy']);router[_0xf514('0x1c')]('/:id/dispositions',auth[_0xf514('0x7')](),controller[_0xf514('0x1d')]);router['delete'](_0xf514('0xc'),auth[_0xf514('0x7')](),controller[_0xf514('0x1e')]);router[_0xf514('0x1c')](_0xf514('0x10'),auth[_0xf514('0x7')](),controller[_0xf514('0x1f')]);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 a535930..154f723 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 _0xeb75=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xeb75,0xd1));var _0x5eb7=function(_0x5e12b1,_0x493b0b){_0x5e12b1=_0x5e12b1-0x0;var _0x467766=_0xeb75[_0x5e12b1];return _0x467766;};'use strict';var Sequelize=require(_0x5eb7('0x0'));var rs=require('randomstring');module[_0x5eb7('0x1')]={'name':{'type':Sequelize[_0x5eb7('0x2')],'unique':_0x5eb7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5eb7('0x2')]},'token':{'type':Sequelize[_0x5eb7('0x2')],'defaultValue':function(){return rs[_0x5eb7('0x4')]();}},'replyUri':{'type':Sequelize[_0x5eb7('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5eb7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5eb7('0x5');}},'notificationSound':{'type':Sequelize[_0x5eb7('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5eb7('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5eb7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5eb7('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5eb7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5eb7('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5eb7('0x6')],'defaultValue':![],'comment':_0x5eb7('0x9'),'set':function(_0xec42f0){if(!_0xec42f0)this[_0x5eb7('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5eb7('0xb'),_0xec42f0);}}}; \ No newline at end of file +var _0x7025=['exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x2f20f7,_0x457b20){var _0x425435=function(_0x384b58){while(--_0x384b58){_0x2f20f7['push'](_0x2f20f7['shift']());}};_0x425435(++_0x457b20);}(_0x7025,0x132));var _0x5702=function(_0x10e809,_0x5107cd){_0x10e809=_0x10e809-0x0;var _0xba24f9=_0x7025[_0x10e809];return _0xba24f9;};'use strict';var Sequelize=require(_0x5702('0x0'));var rs=require(_0x5702('0x1'));module[_0x5702('0x2')]={'name':{'type':Sequelize[_0x5702('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5702('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5702('0x4')]();}},'replyUri':{'type':Sequelize[_0x5702('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5702('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5702('0x5')],'defaultValue':function(){return _0x5702('0x6');}},'notificationSound':{'type':Sequelize[_0x5702('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5702('0x3')]},'queueTransfer':{'type':Sequelize[_0x5702('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5702('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5702('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5702('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5702('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x5702('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x5702('0x7')],'defaultValue':![],'comment':_0x5702('0xa'),'set':function(_0x236c94){if(!_0x236c94)this[_0x5702('0xb')](_0x5702('0xc'),null);this[_0x5702('0xb')](_0x5702('0xd'),_0x236c94);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 8258f22..08a4645 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 _0x27f8=['getAgents','User','ListId','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','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','describe','addDisposition','findOne','order','OpenchannelAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','account','Applications','list','applications','orderBy','priority','asc','List','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','notify','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove'];(function(_0x25b2a0,_0x4aaf17){var _0x2b7e0a=function(_0x584051){while(--_0x584051){_0x25b2a0['push'](_0x25b2a0['shift']());}};_0x2b7e0a(++_0x4aaf17);}(_0x27f8,0x180));var _0x827f=function(_0x4ffc34,_0x5db65f){_0x4ffc34=_0x4ffc34-0x0;var _0x46b4df=_0x27f8[_0x4ffc34];return _0x46b4df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x827f('0x0'));var rimraf=require(_0x827f('0x1'));var zipdir=require(_0x827f('0x2'));var jsonpatch=require(_0x827f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x827f('0x4'));var Mustache=require('mustache');var util=require(_0x827f('0x5'));var path=require('path');var sox=require(_0x827f('0x6'));var csv=require(_0x827f('0x7'));var ejs=require(_0x827f('0x8'));var fs=require('fs');var _=require(_0x827f('0x9'));var squel=require(_0x827f('0xa'));var crypto=require(_0x827f('0xb'));var jsforce=require(_0x827f('0xc'));var deskjs=require(_0x827f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x827f('0xe'));var Papa=require(_0x827f('0xf'));var Redis=require(_0x827f('0x10'));var authService=require(_0x827f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x827f('0x12'));var hardwareService=require(_0x827f('0x13'));var logger=require('../../config/logger')(_0x827f('0x14'));var utils=require('../../config/utils');var config=require(_0x827f('0x15'));var licenseUtil=require(_0x827f('0x16'));var db=require('../../mysqldb')['db'];config[_0x827f('0x17')]=_[_0x827f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x827f('0x19'))(new Redis(config[_0x827f('0x17')]));require(_0x827f('0x1a'))['register'](socket);var jayson=require(_0x827f('0x1b'));var client=jayson[_0x827f('0x1c')][_0x827f('0x1d')]({'port':0x232c});var client9002=jayson[_0x827f('0x1c')][_0x827f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x28d8fe,_0x5aa8f3,_0x1e37f4,_0x50fa23){return new BPromise(function(_0x2667ed,_0x481fd1){var _0x5a64c1=_0x50fa23||client;return _0x5a64c1[_0x827f('0x1e')](_0x28d8fe,_0x1e37f4)[_0x827f('0x1f')](function(_0x1703b2){logger[_0x827f('0x20')](_0x827f('0x21'),_0x5aa8f3,_0x827f('0x22'));logger[_0x827f('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5aa8f3,_0x827f('0x22'),JSON[_0x827f('0x24')](_0x1703b2));if(_0x1703b2[_0x827f('0x25')]){if(_0x1703b2[_0x827f('0x25')][_0x827f('0x26')]===0x1f4){logger[_0x827f('0x25')](_0x827f('0x21'),_0x5aa8f3,_0x1703b2['error'][_0x827f('0x27')]);return _0x481fd1(_0x1703b2[_0x827f('0x25')][_0x827f('0x27')]);}logger[_0x827f('0x25')](_0x827f('0x21'),_0x5aa8f3,_0x1703b2[_0x827f('0x25')]['message']);return _0x2667ed(_0x1703b2[_0x827f('0x25')][_0x827f('0x27')]);}else{logger[_0x827f('0x20')](_0x827f('0x21'),_0x5aa8f3,'request\x20sent');_0x2667ed(_0x1703b2[_0x827f('0x28')][_0x827f('0x27')]);}})[_0x827f('0x29')](function(_0x78b3ad){logger['error'](_0x827f('0x21'),_0x5aa8f3,_0x78b3ad);_0x481fd1(_0x78b3ad);});});}function respondWithStatusCode(_0x2a98f8,_0x1f6a96){_0x1f6a96=_0x1f6a96||0xcc;return function(_0x9756bd){if(_0x9756bd){return _0x2a98f8[_0x827f('0x2a')](_0x1f6a96);}return _0x2a98f8[_0x827f('0x2b')](_0x1f6a96)[_0x827f('0x2c')]();};}function respondWithResult(_0x26b05f,_0x5e5d29){_0x5e5d29=_0x5e5d29||0xc8;return function(_0x185757){if(_0x185757){return _0x26b05f[_0x827f('0x2b')](_0x5e5d29)[_0x827f('0x2d')](_0x185757);}};}function respondWithFilteredResult(_0x179763,_0x58dd7e){return function(_0x5d7b88){if(_0x5d7b88){var _0x3e9055=_0x5d7b88[_0x827f('0x2e')],_0x4e513f=_0x58dd7e[_0x827f('0x2f')],_0x3f4cb6=_0x58dd7e[_0x827f('0x2f')]+_0x58dd7e[_0x827f('0x30')],_0x50fed8;if(_0x3f4cb6>=_0x3e9055){_0x3f4cb6=_0x3e9055;_0x50fed8=0xc8;}else{_0x50fed8=0xce;}_0x179763[_0x827f('0x2b')](_0x50fed8);return _0x179763[_0x827f('0x31')](_0x827f('0x32'),_0x4e513f+'-'+_0x3f4cb6+'/'+_0x3e9055)['json'](_0x5d7b88);}return null;};}function patchUpdates(_0x13543d){return function(_0x2ea4db){try{jsonpatch['apply'](_0x2ea4db,_0x13543d,!![]);}catch(_0x4aa6ed){return BPromise[_0x827f('0x33')](_0x4aa6ed);}return _0x2ea4db[_0x827f('0x34')]();};}function saveUpdates(_0x48dfaa,_0xcd6986){return function(_0x579c53){if(_0x579c53){return _0x579c53[_0x827f('0x35')](_0x48dfaa)[_0x827f('0x1f')](function(_0x58f72b){return _0x58f72b;});}return null;};}function removeEntity(_0x24cedf,_0x2dc25f){return function(_0x5c5807){if(_0x5c5807){return _0x5c5807[_0x827f('0x36')]()[_0x827f('0x1f')](function(){var _0x339c75=_0x5c5807[_0x827f('0x37')]({'plain':!![]});var _0x394860=_0x827f('0x38');return db[_0x827f('0x39')][_0x827f('0x36')]({'where':{'type':_0x394860,'resourceId':_0x339c75['id']}})[_0x827f('0x1f')](function(){return _0x5c5807;});})['then'](function(){_0x24cedf[_0x827f('0x2b')](0xcc)[_0x827f('0x2c')]();});}};}function handleEntityNotFound(_0x5adf43,_0x24b4e2){return function(_0x2809d9){if(!_0x2809d9){_0x5adf43['sendStatus'](0x194);}return _0x2809d9;};}function handleError(_0x42aeb1,_0x30aba6){_0x30aba6=_0x30aba6||0x1f4;return function(_0x59988b){logger[_0x827f('0x25')](_0x59988b[_0x827f('0x3a')]);if(_0x59988b['name']){delete _0x59988b[_0x827f('0x3b')];}_0x42aeb1['status'](_0x30aba6)[_0x827f('0x3c')](_0x59988b);};}exports[_0x827f('0x3d')]=function(_0x139734,_0x3a3453){var _0x4f293e={'include':[{'model':db[_0x827f('0x3e')],'as':_0x827f('0x3f')}]},_0x58dc30={},_0x52920f={'count':0x0,'rows':[]};var _0x41d034=_['map'](db[_0x827f('0x40')]['rawAttributes'],function(_0x1bbb8a){return{'name':_0x1bbb8a['fieldName'],'type':_0x1bbb8a[_0x827f('0x41')][_0x827f('0x42')]};});_0x58dc30[_0x827f('0x43')]=_[_0x827f('0x44')](_0x41d034,_0x827f('0x3b'));_0x58dc30[_0x827f('0x45')]=_[_0x827f('0x46')](_0x139734[_0x827f('0x45')]);_0x58dc30['filters']=_[_0x827f('0x47')](_0x58dc30[_0x827f('0x43')],_0x58dc30[_0x827f('0x45')]);_0x4f293e['attributes']=_[_0x827f('0x47')](_0x58dc30[_0x827f('0x43')],qs[_0x827f('0x48')](_0x139734['query'][_0x827f('0x48')]));_0x4f293e[_0x827f('0x49')]=_0x4f293e[_0x827f('0x49')][_0x827f('0x4a')]?_0x4f293e[_0x827f('0x49')]:_0x58dc30['model'];if(!_0x139734['query'][_0x827f('0x4b')](_0x827f('0x4c'))){_0x4f293e['limit']=qs[_0x827f('0x30')](_0x139734[_0x827f('0x45')]['limit']);_0x4f293e[_0x827f('0x2f')]=qs[_0x827f('0x2f')](_0x139734[_0x827f('0x45')][_0x827f('0x2f')]);}_0x4f293e['order']=qs[_0x827f('0x4d')](_0x139734['query'][_0x827f('0x4d')]);_0x4f293e[_0x827f('0x4e')]=qs[_0x827f('0x4f')](_[_0x827f('0x50')](_0x139734[_0x827f('0x45')],_0x58dc30[_0x827f('0x4f')]),_0x41d034);if(_0x139734[_0x827f('0x45')][_0x827f('0x51')]){_0x4f293e['where']=_[_0x827f('0x52')](_0x4f293e[_0x827f('0x4e')],{'$or':_['map'](_0x41d034,function(_0x1fcc51){if(_0x1fcc51[_0x827f('0x41')]!==_0x827f('0x53')){var _0x46ff9f={};_0x46ff9f[_0x1fcc51[_0x827f('0x3b')]]={'$like':'%'+_0x139734[_0x827f('0x45')][_0x827f('0x51')]+'%'};return _0x46ff9f;}})});}_0x4f293e=_[_0x827f('0x52')]({},_0x4f293e,_0x139734[_0x827f('0x54')]);var _0x40ce5a={'where':_0x4f293e[_0x827f('0x4e')]};return db[_0x827f('0x40')][_0x827f('0x2e')](_0x40ce5a)[_0x827f('0x1f')](function(_0x242887){_0x52920f[_0x827f('0x2e')]=_0x242887;if(_0x139734['query'][_0x827f('0x55')]){_0x4f293e[_0x827f('0x56')]=[{'all':!![]}];}return db[_0x827f('0x40')][_0x827f('0x57')](_0x4f293e);})[_0x827f('0x1f')](function(_0x2af22f){_0x52920f['rows']=_0x2af22f;return _0x52920f;})[_0x827f('0x1f')](respondWithFilteredResult(_0x3a3453,_0x4f293e))[_0x827f('0x29')](handleError(_0x3a3453,null));};exports['show']=function(_0x57a750,_0x216536){var _0x270411={'raw':![],'where':{'id':_0x57a750[_0x827f('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x827f('0x3f')}]},_0x38a62d={};_0x38a62d[_0x827f('0x43')]=_['keys'](db['OpenchannelAccount'][_0x827f('0x59')]);_0x38a62d[_0x827f('0x45')]=_[_0x827f('0x46')](_0x57a750[_0x827f('0x45')]);_0x38a62d[_0x827f('0x4f')]=_[_0x827f('0x47')](_0x38a62d[_0x827f('0x43')],_0x38a62d['query']);_0x270411[_0x827f('0x49')]=_['intersection'](_0x38a62d[_0x827f('0x43')],qs['fields'](_0x57a750[_0x827f('0x45')][_0x827f('0x48')]));_0x270411['attributes']=_0x270411['attributes'][_0x827f('0x4a')]?_0x270411[_0x827f('0x49')]:_0x38a62d['model'];if(_0x57a750['query'][_0x827f('0x55')]){_0x270411[_0x827f('0x56')]=[{'all':!![]}];}_0x270411=_['merge']({},_0x270411,_0x57a750[_0x827f('0x54')]);return db[_0x827f('0x40')][_0x827f('0x5a')](_0x270411)[_0x827f('0x1f')](handleEntityNotFound(_0x216536,null))[_0x827f('0x1f')](respondWithResult(_0x216536,null))[_0x827f('0x29')](handleError(_0x216536,null));};exports[_0x827f('0x5b')]=function(_0xeff028,_0x57a8f5){return db[_0x827f('0x40')][_0x827f('0x5b')](_0xeff028[_0x827f('0x5c')],{})['then'](function(_0x12c6e1){var _0x2e5c34=_0xeff028[_0x827f('0x5d')][_0x827f('0x37')]({'plain':!![]});if(!_0x2e5c34)throw new Error(_0x827f('0x5e'));if(_0x2e5c34[_0x827f('0x5f')]==='user'){var _0x1cc131=_0x12c6e1['get']({'plain':!![]});var _0x11e859=_0x827f('0x38');return db[_0x827f('0x60')][_0x827f('0x5a')]({'where':{'name':_0x11e859,'userProfileId':_0x2e5c34[_0x827f('0x61')]},'raw':!![]})[_0x827f('0x1f')](function(_0x63c127){if(_0x63c127&&_0x63c127[_0x827f('0x62')]===0x0){return db[_0x827f('0x39')][_0x827f('0x5b')]({'name':_0x1cc131[_0x827f('0x3b')],'resourceId':_0x1cc131['id'],'type':_0x63c127['name'],'sectionId':_0x63c127['id']},{})[_0x827f('0x1f')](function(){return _0x12c6e1;});}else{return _0x12c6e1;}})[_0x827f('0x29')](function(_0x36dc60){logger[_0x827f('0x25')](_0x827f('0x63'),_0x36dc60);throw _0x36dc60;});}return _0x12c6e1;})['then'](respondWithResult(_0x57a8f5,0xc9))['catch'](handleError(_0x57a8f5,null));};exports[_0x827f('0x35')]=function(_0x2d15dd,_0x5e6314){if(_0x2d15dd[_0x827f('0x5c')]['id']){delete _0x2d15dd[_0x827f('0x5c')]['id'];}return db['OpenchannelAccount'][_0x827f('0x5a')]({'where':{'id':_0x2d15dd['params']['id']},'include':[{'model':db[_0x827f('0x3e')],'as':_0x827f('0x3f')}]})[_0x827f('0x1f')](handleEntityNotFound(_0x5e6314,null))[_0x827f('0x1f')](saveUpdates(_0x2d15dd['body'],null))[_0x827f('0x1f')](respondWithResult(_0x5e6314,null))['catch'](handleError(_0x5e6314,null));};exports[_0x827f('0x36')]=function(_0x15b1cd,_0x4cf58d){return db[_0x827f('0x40')][_0x827f('0x5a')]({'where':{'id':_0x15b1cd[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x4cf58d,null))[_0x827f('0x1f')](removeEntity(_0x4cf58d,null))[_0x827f('0x29')](handleError(_0x4cf58d,null));};exports[_0x827f('0x64')]=function(_0x216d84,_0x483133){return db[_0x827f('0x40')][_0x827f('0x64')]()['then'](respondWithResult(_0x483133,null))[_0x827f('0x29')](handleError(_0x483133,null));};exports[_0x827f('0x65')]=function(_0x53868e,_0x294e50,_0x523f2e){if(_0x53868e[_0x827f('0x5c')]['id']){delete _0x53868e[_0x827f('0x5c')]['id'];}return db[_0x827f('0x40')]['find']({'where':{'id':_0x53868e[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x294e50,null))[_0x827f('0x1f')](function(_0x224ba1){if(_0x224ba1){_0x53868e[_0x827f('0x5c')]['OpenchannelAccountId']=_0x224ba1['id'];return db['Disposition'][_0x827f('0x5b')](_0x53868e[_0x827f('0x5c')]);}})[_0x827f('0x1f')](respondWithResult(_0x294e50,null))[_0x827f('0x29')](handleError(_0x294e50,null));};exports['getDispositions']=function(_0x193996,_0x34a444,_0x26b0f0){var _0xfa15fb={'raw':![],'where':{}};var _0x18d13a={};var _0x1a0271={'count':0x0,'rows':[]};return db[_0x827f('0x40')][_0x827f('0x66')]({'where':{'id':_0x193996[_0x827f('0x58')]['id']}})['then'](handleEntityNotFound(_0x34a444,null))[_0x827f('0x1f')](function(_0x3f8109){if(_0x3f8109){_0x18d13a[_0x827f('0x43')]=_[_0x827f('0x46')](db['Disposition'][_0x827f('0x59')]);_0x18d13a[_0x827f('0x45')]=_[_0x827f('0x46')](_0x193996[_0x827f('0x45')]);_0x18d13a[_0x827f('0x4f')]=_['intersection'](_0x18d13a[_0x827f('0x43')],_0x18d13a[_0x827f('0x45')]);_0xfa15fb['attributes']=_[_0x827f('0x47')](_0x18d13a[_0x827f('0x43')],qs[_0x827f('0x48')](_0x193996[_0x827f('0x45')][_0x827f('0x48')]));_0xfa15fb[_0x827f('0x49')]=_0xfa15fb[_0x827f('0x49')][_0x827f('0x4a')]?_0xfa15fb['attributes']:_0x18d13a['model'];if(!_0x193996['query']['hasOwnProperty'](_0x827f('0x4c'))){_0xfa15fb[_0x827f('0x30')]=qs['limit'](_0x193996[_0x827f('0x45')][_0x827f('0x30')]);_0xfa15fb[_0x827f('0x2f')]=qs[_0x827f('0x2f')](_0x193996['query'][_0x827f('0x2f')]);}_0xfa15fb[_0x827f('0x67')]=qs[_0x827f('0x4d')](_0x193996[_0x827f('0x45')][_0x827f('0x4d')]);_0xfa15fb[_0x827f('0x4e')]=qs[_0x827f('0x4f')](_[_0x827f('0x50')](_0x193996[_0x827f('0x45')],_0x18d13a['filters']));_0xfa15fb[_0x827f('0x4e')][_0x827f('0x68')]=_0x3f8109['id'];if(_0x193996['query']['filter']){_0xfa15fb[_0x827f('0x4e')]=_['merge'](_0xfa15fb[_0x827f('0x4e')],{'$or':_[_0x827f('0x44')](_0xfa15fb[_0x827f('0x49')],function(_0x700457){var _0x49bf3b={};_0x49bf3b[_0x700457]={'$like':'%'+_0x193996['query'][_0x827f('0x51')]+'%'};return _0x49bf3b;})});}_0xfa15fb=_['merge']({},_0xfa15fb,_0x193996[_0x827f('0x54')]);return db['Disposition']['count']({'where':_0xfa15fb[_0x827f('0x4e')]})[_0x827f('0x1f')](function(_0x501dd6){_0x1a0271[_0x827f('0x2e')]=_0x501dd6;if(_0x193996[_0x827f('0x45')][_0x827f('0x55')]){_0xfa15fb[_0x827f('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x827f('0x57')](_0xfa15fb);})['then'](function(_0x3653a3){_0x1a0271[_0x827f('0x69')]=_0x3653a3;return _0x1a0271;});}})['then'](respondWithFilteredResult(_0x34a444,_0xfa15fb))[_0x827f('0x29')](handleError(_0x34a444,null));};exports['removeDispositions']=function(_0x1a3f56,_0x517586,_0x4978b5){return db[_0x827f('0x40')][_0x827f('0x5a')]({'where':{'id':_0x1a3f56[_0x827f('0x58')]['id']}})['then'](handleEntityNotFound(_0x517586,null))[_0x827f('0x1f')](function(_0x4c6bf7){if(_0x4c6bf7){return _0x4c6bf7[_0x827f('0x6a')](_0x1a3f56['query'][_0x827f('0x6b')]);}})[_0x827f('0x1f')](respondWithStatusCode(_0x517586,null))[_0x827f('0x29')](handleError(_0x517586,null));};exports[_0x827f('0x6c')]=function(_0x33681f,_0x12f47b,_0x449b81){if(_0x33681f[_0x827f('0x5c')]['id']){delete _0x33681f[_0x827f('0x5c')]['id'];}return db['OpenchannelAccount'][_0x827f('0x5a')]({'where':{'id':_0x33681f[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x12f47b,null))[_0x827f('0x1f')](function(_0x549775){if(_0x549775){_0x33681f[_0x827f('0x5c')][_0x827f('0x68')]=_0x549775['id'];return db['CannedAnswer'][_0x827f('0x5b')](_0x33681f['body']);}})[_0x827f('0x1f')](respondWithResult(_0x12f47b,null))[_0x827f('0x29')](handleError(_0x12f47b,null));};exports['getAnswers']=function(_0x2b5e36,_0x19e890,_0x220938){var _0x20c7dc={'raw':![],'where':{}};var _0x21fcc3={};var _0x522a00={'count':0x0,'rows':[]};return db[_0x827f('0x40')][_0x827f('0x66')]({'where':{'id':_0x2b5e36[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x19e890,null))[_0x827f('0x1f')](function(_0x577a6d){if(_0x577a6d){_0x21fcc3[_0x827f('0x43')]=_[_0x827f('0x46')](db['CannedAnswer'][_0x827f('0x59')]);_0x21fcc3['query']=_['keys'](_0x2b5e36[_0x827f('0x45')]);_0x21fcc3[_0x827f('0x4f')]=_[_0x827f('0x47')](_0x21fcc3[_0x827f('0x43')],_0x21fcc3[_0x827f('0x45')]);_0x20c7dc[_0x827f('0x49')]=_['intersection'](_0x21fcc3[_0x827f('0x43')],qs['fields'](_0x2b5e36[_0x827f('0x45')]['fields']));_0x20c7dc[_0x827f('0x49')]=_0x20c7dc[_0x827f('0x49')][_0x827f('0x4a')]?_0x20c7dc[_0x827f('0x49')]:_0x21fcc3['model'];if(!_0x2b5e36[_0x827f('0x45')][_0x827f('0x4b')](_0x827f('0x4c'))){_0x20c7dc[_0x827f('0x30')]=qs[_0x827f('0x30')](_0x2b5e36[_0x827f('0x45')][_0x827f('0x30')]);_0x20c7dc[_0x827f('0x2f')]=qs[_0x827f('0x2f')](_0x2b5e36[_0x827f('0x45')]['offset']);}_0x20c7dc['order']=qs[_0x827f('0x4d')](_0x2b5e36[_0x827f('0x45')][_0x827f('0x4d')]);_0x20c7dc['where']=qs['filters'](_[_0x827f('0x50')](_0x2b5e36['query'],_0x21fcc3['filters']));_0x20c7dc[_0x827f('0x4e')][_0x827f('0x68')]=_0x577a6d['id'];if(_0x2b5e36['query']['filter']){_0x20c7dc[_0x827f('0x4e')]=_[_0x827f('0x52')](_0x20c7dc[_0x827f('0x4e')],{'$or':_['map'](_0x20c7dc[_0x827f('0x49')],function(_0x3bcc34){var _0x31e05b={};_0x31e05b[_0x3bcc34]={'$like':'%'+_0x2b5e36[_0x827f('0x45')][_0x827f('0x51')]+'%'};return _0x31e05b;})});}_0x20c7dc=_[_0x827f('0x52')]({},_0x20c7dc,_0x2b5e36['options']);return db[_0x827f('0x6d')]['count']({'where':_0x20c7dc[_0x827f('0x4e')]})[_0x827f('0x1f')](function(_0x5291e3){_0x522a00[_0x827f('0x2e')]=_0x5291e3;if(_0x2b5e36[_0x827f('0x45')]['includeAll']){_0x20c7dc['include']=[{'all':!![]}];}return db[_0x827f('0x6d')][_0x827f('0x57')](_0x20c7dc);})[_0x827f('0x1f')](function(_0x31732d){_0x522a00[_0x827f('0x69')]=_0x31732d;return _0x522a00;});}})['then'](respondWithFilteredResult(_0x19e890,_0x20c7dc))[_0x827f('0x29')](handleError(_0x19e890,null));};exports[_0x827f('0x6e')]=function(_0x2d690e,_0x18d318,_0x24a78a){return db['OpenchannelAccount'][_0x827f('0x5a')]({'where':{'id':_0x2d690e[_0x827f('0x58')]['id']}})['then'](handleEntityNotFound(_0x18d318,null))[_0x827f('0x1f')](function(_0x9f69cc){if(_0x9f69cc){return _0x9f69cc['removeAnswers'](_0x2d690e[_0x827f('0x45')][_0x827f('0x6b')]);}})['then'](respondWithStatusCode(_0x18d318,null))[_0x827f('0x29')](handleError(_0x18d318,null));};exports['notify']=function(_0x5b4b27,_0x583466,_0x4075ee){var _0x346ba6={'body':_0x5b4b27[_0x827f('0x5c')],'channel':_0x827f('0x6f')};var _0x30f51c=[];var _0xd23339=[];var _0x2f0218={};var _0x12ba60=![];return db[_0x827f('0x70')][_0x827f('0x64')]()[_0x827f('0x1f')](function(_0x62c1c7){if(!_0x62c1c7){throw new db['Sequelize'][(_0x827f('0x71'))]('no\x20available\x20attributes');}_0x30f51c=_[_0x827f('0x72')](_[_0x827f('0x46')](_0x62c1c7),[_0x827f('0x73'),_0x827f('0x74')]);_0xd23339=_[_0x827f('0x72')](_[_0x827f('0x46')](_0x62c1c7),[_0x827f('0x73'),_0x827f('0x74'),_0x827f('0x75'),'ListId']);if(_0x5b4b27[_0x827f('0x5c')]['id']){delete _0x5b4b27[_0x827f('0x5c')]['id'];}if(_[_0x827f('0x76')](_0x5b4b27[_0x827f('0x5c')][_0x827f('0x77')])){throw new db[(_0x827f('0x78'))][(_0x827f('0x71'))](_0x827f('0x79'));}if(_['isNil'](_0x5b4b27[_0x827f('0x5c')][_0x827f('0x5c')])||_0x5b4b27['body'][_0x827f('0x5c')]===''){throw new db[(_0x827f('0x78'))][(_0x827f('0x71'))](_0x827f('0x7a'));}if(_[_0x827f('0x76')](_0x5b4b27[_0x827f('0x5c')][_0x827f('0x7b')])){throw new db[(_0x827f('0x78'))]['ValidationError'](_0x827f('0x7c')+_0xd23339);}if(!_['includes'](_0xd23339,_0x5b4b27[_0x827f('0x5c')][_0x827f('0x7b')])){throw new db[(_0x827f('0x78'))][(_0x827f('0x71'))](_0x827f('0x7d')+_0xd23339);}_0x2f0218[_0x5b4b27[_0x827f('0x5c')]['mapKey']]=_0x5b4b27['body']['from'];})[_0x827f('0x1f')](function(){return db[_0x827f('0x40')][_0x827f('0x5a')]({'where':{'id':_0x5b4b27[_0x827f('0x58')]['id']},'include':[{'model':db[_0x827f('0x7e')],'as':'List','include':[{'model':db[_0x827f('0x70')],'as':_0x827f('0x7f'),'where':_0x2f0218,'limit':0x1,'order':[[_0x827f('0x74'),_0x827f('0x80')]]}]},{'model':db[_0x827f('0x81')],'as':'Applications'}]});})[_0x827f('0x1f')](handleEntityNotFound(_0x583466,null))['then'](function(_0x1b386e){if(_0x1b386e&&_0x1b386e['List']){_0x346ba6[_0x827f('0x82')]=_0x1b386e;_0x346ba6['applications']=_0x1b386e[_0x827f('0x83')];_0x346ba6[_0x827f('0x84')]=_0x1b386e['List'];_0x346ba6[_0x827f('0x85')]=_[_0x827f('0x86')](_0x346ba6[_0x827f('0x85')],[_0x827f('0x87')],[_0x827f('0x88')]);if(_0x346ba6['account']['Applications']){delete _0x346ba6['account'][_0x827f('0x83')];}if(_0x346ba6['account']['List']&&_0x346ba6[_0x827f('0x82')]['List'][_0x827f('0x7f')][_0x827f('0x4a')]){return _0x346ba6[_0x827f('0x82')][_0x827f('0x89')][_0x827f('0x7f')][0x0];}var _0x455ab8=_[_0x827f('0x18')](_0x5b4b27[_0x827f('0x5c')],{'firstName':_0x5b4b27[_0x827f('0x5c')][_0x827f('0x77')],'ListId':_0x1b386e['ListId']});_0x455ab8[_0x5b4b27[_0x827f('0x5c')][_0x827f('0x7b')]]=_0x5b4b27[_0x827f('0x5c')]['from'];return db[_0x827f('0x70')][_0x827f('0x5b')](_0x455ab8,{'fields':_0x30f51c,'raw':!![]});}})[_0x827f('0x1f')](handleEntityNotFound(_0x583466,null))[_0x827f('0x1f')](function(_0x377733){_0x346ba6[_0x827f('0x8a')]=_0x377733;if(_0x377733){var _0xd6ee33={'ContactId':_0x377733['id'],'OpenchannelAccountId':_0x5b4b27['params']['id'],'from':(_0x377733[_0x827f('0x8b')]||'')+'\x20'+(_0x377733[_0x827f('0x8c')]||'')};var _0x4b3720={'OpenchannelAccountId':_0x5b4b27[_0x827f('0x58')]['id'],'closed':![]};if(_0x5b4b27[_0x827f('0x5c')][_0x827f('0x8d')]){_0x4b3720[_0x827f('0x8d')]=_0x5b4b27['body'][_0x827f('0x8d')];return db[_0x827f('0x8e')]['find']({'where':_0x4b3720})['then'](function(_0x26ad45){if(_0x26ad45){return[_0x26ad45,![]];}_0xd6ee33[_0x827f('0x8d')]=_0x5b4b27[_0x827f('0x5c')][_0x827f('0x8d')];_0xd6ee33[_0x827f('0x8f')]=_0x5b4b27[_0x827f('0x5c')][_0x827f('0x8f')];return db[_0x827f('0x8e')][_0x827f('0x5b')](_0xd6ee33)[_0x827f('0x1f')](function(_0xb02f53){return[_0xb02f53,!![]];});});}else{_0x4b3720['threadId']=null;}_0x4b3720[_0x827f('0x90')]=_0x377733['id'];return db[_0x827f('0x8e')][_0x827f('0x5a')]({'where':_0x4b3720})[_0x827f('0x1f')](function(_0x518c94){if(_0x518c94){return[_0x518c94,![]];}return db[_0x827f('0x8e')]['create'](_0xd6ee33)[_0x827f('0x1f')](function(_0x4de2b7){return[_0x4de2b7,!![]];});});}})[_0x827f('0x91')](function(_0xb26df5,_0x28ac65){if(_0xb26df5){_0x12ba60=_0x28ac65;if(!_0x28ac65){var _0x1d9234={'from':(_0x346ba6[_0x827f('0x8a')][_0x827f('0x8b')]||'')+'\x20'+(_0x346ba6[_0x827f('0x8a')]['lastName']||'')};if(_0x5b4b27[_0x827f('0x5c')][_0x827f('0x8d')]&&_0x5b4b27[_0x827f('0x5c')][_0x827f('0x92')]&&_0x5b4b27[_0x827f('0x5c')][_0x827f('0x8d')]!=_0x5b4b27[_0x827f('0x5c')][_0x827f('0x92')]){_0x1d9234[_0x827f('0x8d')]=_0x5b4b27[_0x827f('0x5c')][_0x827f('0x92')];}return _0xb26df5[_0x827f('0x35')](_0x1d9234);}else{return _0xb26df5;}}})['then'](function(_0xda8543){_0x346ba6[_0x827f('0x93')]=_0xda8543['get']({'plain':!![]});_0x346ba6['interaction'][_0x827f('0x94')]=_0x12ba60;if(_0x346ba6[_0x827f('0x93')]['created']){if(_0x346ba6[_0x827f('0x82')][_0x827f('0x95')]){_0x346ba6[_0x827f('0x85')][_0x827f('0x96')]({'id':0x0,'priority':_0x346ba6[_0x827f('0x85')][_0x827f('0x4a')]+0x1,'app':_0x827f('0x97'),'appdata':_0x827f('0x98'),'interval':'*,*,*,*'});}}return db[_0x827f('0x99')][_0x827f('0x5b')]({'body':_0x5b4b27[_0x827f('0x5c')][_0x827f('0x5c')],'OpenchannelAccountId':_0x5b4b27['params']['id'],'OpenchannelInteractionId':_0xda8543['id'],'direction':'in','ContactId':_0x346ba6[_0x827f('0x8a')]['id'],'AttachmentId':_0x5b4b27['body']['AttachmentId']});})['then'](function(_0x5b4f2c){_0x346ba6[_0x827f('0x27')]=_0x5b4f2c;if(_0x346ba6[_0x827f('0x93')][_0x827f('0x9a')]){return db['User']['find']({'attributes':['id',_0x827f('0x3b')],'where':{'id':_0x346ba6[_0x827f('0x93')]['UserId']}})[_0x827f('0x1f')](function(_0xf1d30e){if(_0xf1d30e){_0x346ba6[_0x827f('0x85')][_0x827f('0x9b')]({'id':0x0,'priority':0x0,'app':_0x827f('0x9c'),'appdata':_0xf1d30e[_0x827f('0x3b')]+','+(_0x346ba6['account'][_0x827f('0x9d')]||0xa),'interval':_0x827f('0x9e')});_0x346ba6[_0x827f('0x9f')]=![];}return respondWithRpcPromise(_0x827f('0xa0'),_0x827f('0xa1'),_0x346ba6);});}return respondWithRpcPromise(_0x827f('0xa0'),_0x827f('0xa1'),_0x346ba6);})[_0x827f('0x1f')](function(_0x553639){respondWithRpcPromise('EventManager','EventManager',{'event':_0x827f('0xa2'),'message':_0x553639},client9002);return _0x553639;})[_0x827f('0x1f')](respondWithResult(_0x583466,null))[_0x827f('0x29')](handleError(_0x583466,null));};exports[_0x827f('0xa3')]=function(_0x254610,_0x6bace3,_0x1d5ae5){return db[_0x827f('0x40')]['findOne']({'where':{'id':_0x254610[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x6bace3,null))[_0x827f('0x1f')](function(_0x5888e0){if(_0x5888e0){return db[_0x827f('0xa4')][_0x827f('0xa5')](function(_0x5d18d5){return db['OpenchannelApplication'][_0x827f('0x36')]({'where':{'OpenchannelAccountId':_0x254610[_0x827f('0x58')]['id']},'transaction':_0x5d18d5})[_0x827f('0x1f')](function(_0x5bab15){var _0x4d9caa=_[_0x827f('0x44')](_0x254610[_0x827f('0x5c')],function(_0x39c2cc){_0x39c2cc[_0x827f('0x68')]=_0x254610[_0x827f('0x58')]['id'];return _0x39c2cc;});return db[_0x827f('0x81')]['bulkCreate'](_0x4d9caa,{'transaction':_0x5d18d5});});})['then'](function(){return db[_0x827f('0x81')][_0x827f('0xa6')]({'where':{'OpenchannelAccountId':_0x254610[_0x827f('0x58')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x6bace3,null))[_0x827f('0x29')](handleError(_0x6bace3,null));};exports[_0x827f('0xa7')]=function(_0x5c71fc,_0x4fe67f,_0x2597bf){var _0x55b264={};var _0x2561c4={};var _0x311620;var _0x139189;return db[_0x827f('0x40')][_0x827f('0x66')]({'where':{'id':_0x5c71fc[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x4fe67f,null))['then'](function(_0x36af95){if(_0x36af95){_0x311620=_0x36af95;_0x2561c4[_0x827f('0x43')]=_[_0x827f('0x46')](db[_0x827f('0x81')][_0x827f('0x59')]);_0x2561c4[_0x827f('0x45')]=_[_0x827f('0x46')](_0x5c71fc['query']);_0x2561c4['filters']=_[_0x827f('0x47')](_0x2561c4[_0x827f('0x43')],_0x2561c4['query']);_0x55b264['attributes']=_['intersection'](_0x2561c4['model'],qs[_0x827f('0x48')](_0x5c71fc['query'][_0x827f('0x48')]));_0x55b264[_0x827f('0x49')]=_0x55b264['attributes'][_0x827f('0x4a')]?_0x55b264[_0x827f('0x49')]:_0x2561c4['model'];_0x55b264[_0x827f('0x67')]=qs[_0x827f('0x4d')](_0x5c71fc[_0x827f('0x45')][_0x827f('0x4d')]);_0x55b264[_0x827f('0x4e')]=qs[_0x827f('0x4f')](_[_0x827f('0x50')](_0x5c71fc[_0x827f('0x45')],_0x2561c4['filters']));if(_0x5c71fc[_0x827f('0x45')]['filter']){_0x55b264[_0x827f('0x4e')]=_[_0x827f('0x52')](_0x55b264[_0x827f('0x4e')],{'$or':_['map'](_0x55b264[_0x827f('0x49')],function(_0x52db20){var _0x46c445={};_0x46c445[_0x52db20]={'$like':'%'+_0x5c71fc['query'][_0x827f('0x51')]+'%'};return _0x46c445;})});}_0x55b264=_[_0x827f('0x52')]({},_0x55b264,_0x5c71fc[_0x827f('0x54')]);return _0x311620[_0x827f('0xa7')](_0x55b264);}})[_0x827f('0x1f')](function(_0x23d340){if(_0x23d340){_0x139189=_0x23d340[_0x827f('0x4a')];if(!_0x5c71fc[_0x827f('0x45')][_0x827f('0x4b')](_0x827f('0x4c'))){_0x55b264[_0x827f('0x30')]=qs['limit'](_0x5c71fc[_0x827f('0x45')]['limit']);_0x55b264[_0x827f('0x2f')]=qs[_0x827f('0x2f')](_0x5c71fc[_0x827f('0x45')][_0x827f('0x2f')]);}return _0x311620[_0x827f('0xa7')](_0x55b264);}})['then'](function(_0xcb5c9b){if(_0xcb5c9b){return _0xcb5c9b?{'count':_0x139189,'rows':_0xcb5c9b}:null;}})[_0x827f('0x1f')](respondWithResult(_0x4fe67f,null))[_0x827f('0x29')](handleError(_0x4fe67f,null));};exports[_0x827f('0xa8')]=function(_0x425969,_0x24d7f3,_0x3b9b03){var _0x359e76={'raw':![],'where':{}};var _0x479d35={};var _0x16aef6={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x827f('0x66')]({'where':{'id':_0x425969[_0x827f('0x58')]['id']}})['then'](handleEntityNotFound(_0x24d7f3,null))[_0x827f('0x1f')](function(_0x34738d){if(_0x34738d){_0x479d35[_0x827f('0x43')]=_[_0x827f('0x46')](db[_0x827f('0x8e')][_0x827f('0x59')]);_0x479d35[_0x827f('0x45')]=_['keys'](_0x425969[_0x827f('0x45')]);_0x479d35[_0x827f('0x4f')]=_[_0x827f('0x47')](_0x479d35[_0x827f('0x43')],_0x479d35[_0x827f('0x45')]);_0x359e76[_0x827f('0x49')]=_[_0x827f('0x47')](_0x479d35[_0x827f('0x43')],qs['fields'](_0x425969[_0x827f('0x45')][_0x827f('0x48')]));_0x359e76['attributes']=_0x359e76[_0x827f('0x49')][_0x827f('0x4a')]?_0x359e76[_0x827f('0x49')]:_0x479d35[_0x827f('0x43')];if(!_0x425969[_0x827f('0x45')][_0x827f('0x4b')](_0x827f('0x4c'))){_0x359e76['limit']=qs[_0x827f('0x30')](_0x425969[_0x827f('0x45')][_0x827f('0x30')]);_0x359e76[_0x827f('0x2f')]=qs[_0x827f('0x2f')](_0x425969[_0x827f('0x45')][_0x827f('0x2f')]);}_0x359e76[_0x827f('0x67')]=qs[_0x827f('0x4d')](_0x425969[_0x827f('0x45')][_0x827f('0x4d')]);_0x359e76['where']=qs[_0x827f('0x4f')](_[_0x827f('0x50')](_0x425969[_0x827f('0x45')],_0x479d35[_0x827f('0x4f')]));_0x359e76['where'][_0x827f('0x68')]=_0x34738d['id'];if(_0x425969[_0x827f('0x45')][_0x827f('0x51')]){_0x359e76[_0x827f('0x4e')]=_[_0x827f('0x52')](_0x359e76[_0x827f('0x4e')],{'$or':_[_0x827f('0x44')](_0x359e76['attributes'],function(_0x366eb7){var _0xb4646d={};_0xb4646d[_0x366eb7]={'$like':'%'+_0x425969[_0x827f('0x45')][_0x827f('0x51')]+'%'};return _0xb4646d;})});}_0x359e76=_[_0x827f('0x52')]({},_0x359e76,_0x425969[_0x827f('0x54')]);return db[_0x827f('0x8e')][_0x827f('0x2e')]({'where':_0x359e76[_0x827f('0x4e')]})[_0x827f('0x1f')](function(_0x23b7b0){_0x16aef6[_0x827f('0x2e')]=_0x23b7b0;if(_0x425969[_0x827f('0x45')][_0x827f('0x55')]){_0x359e76[_0x827f('0x56')]=[{'model':db[_0x827f('0x70')],'as':_0x827f('0xa9'),'required':![]},{'model':db['User'],'as':_0x827f('0xaa'),'attributes':[_0x827f('0x3b'),'fullname',_0x827f('0xab')],'required':![]},{'model':db[_0x827f('0xac')],'as':_0x827f('0xad'),'attributes':['id','name',_0x827f('0xae')],'where':_0x425969[_0x827f('0x45')][_0x827f('0xaf')]?{'id':_0x425969[_0x827f('0x45')][_0x827f('0xaf')]}:undefined,'required':_0x425969['query']['tag']?!![]:![]}];}return db[_0x827f('0x8e')][_0x827f('0x57')](_0x359e76);})['then'](function(_0xc5fb88){_0x16aef6[_0x827f('0x69')]=_0xc5fb88;return _0x16aef6;});}})['then'](respondWithFilteredResult(_0x24d7f3,_0x359e76))['catch'](handleError(_0x24d7f3,null));};exports['addAgents']=function(_0x307e33,_0x48468a,_0xca3312){return db[_0x827f('0x40')][_0x827f('0x5a')]({'where':{'id':_0x307e33[_0x827f('0x58')]['id']}})['then'](handleEntityNotFound(_0x48468a,null))['then'](function(_0x7064b8){if(_0x7064b8){return _0x7064b8[_0x827f('0xb0')](_0x307e33[_0x827f('0x5c')][_0x827f('0x6b')],_[_0x827f('0xb1')](_0x307e33[_0x827f('0x5c')],[_0x827f('0x6b'),'id'])||{})[_0x827f('0x91')](function(_0xfe007b){for(var _0x3a23d9=0x0;_0x3a23d9<_0x307e33[_0x827f('0x5c')][_0x827f('0x6b')][_0x827f('0x4a')];_0x3a23d9+=0x1){socket['emit'](_0x827f('0xb2'),{'UserId':_0x307e33[_0x827f('0x5c')][_0x827f('0x6b')][_0x3a23d9],'OpenchannelAccountId':_0x307e33[_0x827f('0x58')]['id']});}return _0xfe007b;});}})[_0x827f('0x1f')](respondWithResult(_0x48468a,null))[_0x827f('0x29')](handleError(_0x48468a,null));};exports[_0x827f('0xb3')]=function(_0x527591,_0x3a9579,_0xceacf5){return db[_0x827f('0x40')][_0x827f('0x5a')]({'where':{'id':_0x527591[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x3a9579,null))[_0x827f('0x1f')](function(_0x2cdf39){if(_0x2cdf39){return _0x2cdf39[_0x827f('0xb3')](_0x527591[_0x827f('0x45')]['ids'])['then'](function(){if(_[_0x827f('0xb4')](_0x527591['query'][_0x827f('0x6b')])){for(var _0x32ac70=0x0;_0x32ac70<_0x527591[_0x827f('0x45')][_0x827f('0x6b')][_0x827f('0x4a')];_0x32ac70+=0x1){socket[_0x827f('0xb5')](_0x827f('0xb6'),{'UserId':Number(_0x527591[_0x827f('0x45')]['ids'][_0x32ac70]),'OpenchannelAccountId':Number(_0x527591[_0x827f('0x58')]['id'])});}}else{socket['emit'](_0x827f('0xb6'),{'UserId':Number(_0x527591[_0x827f('0x45')][_0x827f('0x6b')]),'OpenchannelAccountId':Number(_0x527591[_0x827f('0x58')]['id'])});}});}})[_0x827f('0x1f')](respondWithStatusCode(_0x3a9579,null))[_0x827f('0x29')](handleError(_0x3a9579,null));};exports[_0x827f('0xb7')]=function(_0xb74643,_0x1a6dc5,_0x553dae){var _0x30af03={};var _0x2fe300={};var _0x395cbe;var _0x5f15b3;return db['OpenchannelAccount']['findOne']({'where':{'id':_0xb74643[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x1a6dc5,null))[_0x827f('0x1f')](function(_0x8ee79e){if(_0x8ee79e){_0x395cbe=_0x8ee79e;_0x2fe300[_0x827f('0x43')]=_[_0x827f('0x46')](db[_0x827f('0xb8')]['rawAttributes']);_0x2fe300[_0x827f('0x45')]=_['keys'](_0xb74643['query']);_0x2fe300[_0x827f('0x4f')]=_[_0x827f('0x47')](_0x2fe300['model'],_0x2fe300['query']);_0x30af03[_0x827f('0x49')]=_[_0x827f('0x47')](_0x2fe300[_0x827f('0x43')],qs[_0x827f('0x48')](_0xb74643['query'][_0x827f('0x48')]));_0x30af03[_0x827f('0x49')]=_0x30af03[_0x827f('0x49')][_0x827f('0x4a')]?_0x30af03['attributes']:_0x2fe300[_0x827f('0x43')];_0x30af03[_0x827f('0x67')]=qs['sort'](_0xb74643['query'][_0x827f('0x4d')]);_0x30af03['where']=qs['filters'](_[_0x827f('0x50')](_0xb74643[_0x827f('0x45')],_0x2fe300[_0x827f('0x4f')]));if(_0xb74643[_0x827f('0x45')][_0x827f('0x51')]){_0x30af03[_0x827f('0x4e')]=_[_0x827f('0x52')](_0x30af03[_0x827f('0x4e')],{'$or':_[_0x827f('0x44')](_0x30af03['attributes'],function(_0x2e1e9b){var _0x39bde6={};_0x39bde6[_0x2e1e9b]={'$like':'%'+_0xb74643[_0x827f('0x45')][_0x827f('0x51')]+'%'};return _0x39bde6;})});}_0x30af03=_[_0x827f('0x52')]({},_0x30af03,_0xb74643[_0x827f('0x54')]);return _0x395cbe[_0x827f('0xb7')](_0x30af03);}})[_0x827f('0x1f')](function(_0x5cb3e6){if(_0x5cb3e6){_0x5f15b3=_0x5cb3e6[_0x827f('0x4a')];if(!_0xb74643[_0x827f('0x45')][_0x827f('0x4b')](_0x827f('0x4c'))){_0x30af03['limit']=qs[_0x827f('0x30')](_0xb74643[_0x827f('0x45')][_0x827f('0x30')]);_0x30af03[_0x827f('0x2f')]=qs[_0x827f('0x2f')](_0xb74643['query']['offset']);}return _0x395cbe['getAgents'](_0x30af03);}})[_0x827f('0x1f')](function(_0x88d4fb){if(_0x88d4fb){return _0x88d4fb?{'count':_0x5f15b3,'rows':_0x88d4fb}:null;}})[_0x827f('0x1f')](respondWithResult(_0x1a6dc5,null))[_0x827f('0x29')](handleError(_0x1a6dc5,null));};exports[_0x827f('0x3c')]=function(_0x5729e6,_0x163291,_0x599a5f){var _0x501046,_0x288218,_0xccd56c;if(_[_0x827f('0x76')](_0x5729e6[_0x827f('0x5c')]['body'])||_0x5729e6[_0x827f('0x5c')][_0x827f('0x5c')]===''){throw new db[(_0x827f('0x78'))][(_0x827f('0x71'))](_0x827f('0x7a'));}if(_[_0x827f('0x76')](_0x5729e6[_0x827f('0x5c')]['to'])){}_0x501046=_0x5729e6[_0x827f('0x5c')]['to'];return db[_0x827f('0x40')]['findOne']({'where':{'id':_0x5729e6[_0x827f('0x58')]['id']}})[_0x827f('0x1f')](handleEntityNotFound(_0x163291,null))[_0x827f('0x1f')](function(_0x39202f){if(_0x39202f){return db[_0x827f('0x40')][_0x827f('0x5a')]({'where':{'id':_0x39202f['id']},'include':[{'model':db[_0x827f('0x7e')],'as':_0x827f('0x89'),'include':[{'model':db[_0x827f('0x70')],'as':'Contacts','where':{[_0x39202f[_0x827f('0x7b')]]:_0x501046},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x827f('0x1f')](handleEntityNotFound(_0x163291,null))[_0x827f('0x1f')](function(_0x2e27a9){if(_0x2e27a9&&_0x2e27a9[_0x827f('0x89')]){_0x288218=_0x2e27a9[_0x827f('0x37')]({'plain':!![]});if(_0x288218['List']&&_0x288218[_0x827f('0x89')]['Contacts'][_0x827f('0x4a')]){return _0x288218[_0x827f('0x89')][_0x827f('0x7f')][0x0];}return db[_0x827f('0x70')][_0x827f('0x5b')](_[_0x827f('0x18')](_0x5729e6[_0x827f('0x5c')],{'firstName':_0x501046,[_0x2e27a9[_0x827f('0x7b')]]:_0x501046,'phone':_0x501046,'ListId':_0x288218[_0x827f('0xb9')]}));}})[_0x827f('0x1f')](handleEntityNotFound(_0x163291,null))[_0x827f('0x1f')](function(_0x3cf60d){if(_0x3cf60d){_0xccd56c=_0x3cf60d;return db[_0x827f('0x8e')][_0x827f('0x5a')]({'where':{'ContactId':_0xccd56c['id'],'closed':![],'OpenchannelAccountId':_0x288218['id']}})[_0x827f('0x1f')](function(_0x3f0bc0){if(_0x3f0bc0){return[_0x3f0bc0,![]];}return db[_0x827f('0x8e')][_0x827f('0x5b')]({'UserId':_0x5729e6['user']['id'],'ContactId':_0xccd56c['id'],'OpenchannelAccountId':_0x288218['id'],'lastMsgDirection':_0x827f('0xba'),'Messages':[_[_0x827f('0x52')](_0x5729e6['body'],{'read':![],'body':_0x5729e6[_0x827f('0x5c')][_0x827f('0x5c')],'OpenchannelAccountId':_0x288218['id'],'UserId':_0x5729e6[_0x827f('0x5d')]['id'],'ContactId':_0xccd56c['id']})]},{'include':[{'model':db[_0x827f('0x99')],'as':_0x827f('0xbb')}]})[_0x827f('0x1f')](function(_0x1bf253){return[_0x1bf253,!![]];});});}})[_0x827f('0x91')](function(_0x56ae14,_0x256b6c){if(_0x256b6c){return _0x56ae14;}return db[_0x827f('0x99')][_0x827f('0x5b')](_[_0x827f('0x52')](_0x5729e6[_0x827f('0x5c')],{'read':![],'body':_0x5729e6[_0x827f('0x5c')]['body'],'OpenchannelAccountId':_0x288218['id'],'OpenchannelInteractionId':_0x56ae14['id'],'UserId':_0x5729e6[_0x827f('0x5d')]['id'],'ContactId':_0xccd56c['id']}))[_0x827f('0x1f')](function(_0x14a99b){_0x56ae14[_0x827f('0xbc')][_0x827f('0xbb')]=[];_0x56ae14[_0x827f('0xbc')][_0x827f('0xbb')]['push'](_0x14a99b['dataValues']);return _0x56ae14;});});}})[_0x827f('0x1f')](respondWithResult(_0x163291,null))[_0x827f('0x29')](handleError(_0x163291,null));}; \ No newline at end of file +var _0xd96d=['rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','UserId','agent','*,*,*,*','Start','startRouting','EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','ids','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','socket.io-emitter','register','http','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','get','OpenchannelAccounts','UserProfileResource','name','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause'];(function(_0x368467,_0x4f4c1e){var _0x1c8f4d=function(_0x2dcb6f){while(--_0x2dcb6f){_0x368467['push'](_0x368467['shift']());}};_0x1c8f4d(++_0x4f4c1e);}(_0xd96d,0x1d4));var _0xdd96=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xd96d[_0x1b349a];return _0x5d1f7c;};'use strict';var pdf=require(_0xdd96('0x0'));var emlformat=require(_0xdd96('0x1'));var rimraf=require(_0xdd96('0x2'));var zipdir=require(_0xdd96('0x3'));var jsonpatch=require(_0xdd96('0x4'));var rp=require(_0xdd96('0x5'));var moment=require(_0xdd96('0x6'));var BPromise=require(_0xdd96('0x7'));var Mustache=require(_0xdd96('0x8'));var util=require(_0xdd96('0x9'));var path=require(_0xdd96('0xa'));var sox=require(_0xdd96('0xb'));var csv=require(_0xdd96('0xc'));var ejs=require(_0xdd96('0xd'));var fs=require('fs');var _=require(_0xdd96('0xe'));var squel=require(_0xdd96('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd96('0x10'));var toCsv=require(_0xdd96('0xc'));var querystring=require(_0xdd96('0x11'));var Papa=require('papaparse');var Redis=require(_0xdd96('0x12'));var authService=require(_0xdd96('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdd96('0x14'));var hardwareService=require(_0xdd96('0x15'));var logger=require(_0xdd96('0x16'))(_0xdd96('0x17'));var utils=require(_0xdd96('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdd96('0x19')]=_['defaults'](config[_0xdd96('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd96('0x1a'))(new Redis(config[_0xdd96('0x19')]));require('./openchannelAccount.socket')[_0xdd96('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdd96('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xdd96('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4e4aa7,_0x38c634,_0x42f2d7,_0x54d1ef){return new BPromise(function(_0x5851c6,_0x521b81){var _0x21b9f1=_0x54d1ef||client;return _0x21b9f1[_0xdd96('0x1d')](_0x4e4aa7,_0x42f2d7)[_0xdd96('0x1e')](function(_0x96b6d7){logger[_0xdd96('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x38c634,'request\x20sent');logger[_0xdd96('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x38c634,_0xdd96('0x21'),JSON[_0xdd96('0x22')](_0x96b6d7));if(_0x96b6d7[_0xdd96('0x23')]){if(_0x96b6d7[_0xdd96('0x23')][_0xdd96('0x24')]===0x1f4){logger['error'](_0xdd96('0x25'),_0x38c634,_0x96b6d7['error']['message']);return _0x521b81(_0x96b6d7[_0xdd96('0x23')][_0xdd96('0x26')]);}logger['error'](_0xdd96('0x25'),_0x38c634,_0x96b6d7['error'][_0xdd96('0x26')]);return _0x5851c6(_0x96b6d7['error'][_0xdd96('0x26')]);}else{logger['info'](_0xdd96('0x25'),_0x38c634,'request\x20sent');_0x5851c6(_0x96b6d7[_0xdd96('0x27')][_0xdd96('0x26')]);}})['catch'](function(_0x5c7113){logger['error'](_0xdd96('0x25'),_0x38c634,_0x5c7113);_0x521b81(_0x5c7113);});});}function respondWithStatusCode(_0xb64da7,_0x1cf9fd){_0x1cf9fd=_0x1cf9fd||0xcc;return function(_0x2f11dc){if(_0x2f11dc){return _0xb64da7[_0xdd96('0x28')](_0x1cf9fd);}return _0xb64da7[_0xdd96('0x29')](_0x1cf9fd)[_0xdd96('0x2a')]();};}function respondWithResult(_0x231a13,_0x1a090c){_0x1a090c=_0x1a090c||0xc8;return function(_0x255a6d){if(_0x255a6d){return _0x231a13[_0xdd96('0x29')](_0x1a090c)[_0xdd96('0x2b')](_0x255a6d);}};}function respondWithFilteredResult(_0x56039c,_0x159925){return function(_0x393a7b){if(_0x393a7b){var _0x1ff168=_0x393a7b[_0xdd96('0x2c')],_0x2a9ec2=_0x159925[_0xdd96('0x2d')],_0x2f324c=_0x159925[_0xdd96('0x2d')]+_0x159925[_0xdd96('0x2e')],_0x2194e9;if(_0x2f324c>=_0x1ff168){_0x2f324c=_0x1ff168;_0x2194e9=0xc8;}else{_0x2194e9=0xce;}_0x56039c[_0xdd96('0x29')](_0x2194e9);return _0x56039c['set'](_0xdd96('0x2f'),_0x2a9ec2+'-'+_0x2f324c+'/'+_0x1ff168)[_0xdd96('0x2b')](_0x393a7b);}return null;};}function patchUpdates(_0x258f61){return function(_0x5dde24){try{jsonpatch['apply'](_0x5dde24,_0x258f61,!![]);}catch(_0x51daa7){return BPromise['reject'](_0x51daa7);}return _0x5dde24[_0xdd96('0x30')]();};}function saveUpdates(_0x55eeca,_0x1dd679){return function(_0x496b1e){if(_0x496b1e){return _0x496b1e[_0xdd96('0x31')](_0x55eeca)['then'](function(_0x2a7999){return _0x2a7999;});}return null;};}function removeEntity(_0x1996c5,_0x104e05){return function(_0x3444f7){if(_0x3444f7){return _0x3444f7['destroy']()[_0xdd96('0x1e')](function(){var _0x2114a3=_0x3444f7[_0xdd96('0x32')]({'plain':!![]});var _0x15e06e=_0xdd96('0x33');return db[_0xdd96('0x34')]['destroy']({'where':{'type':_0x15e06e,'resourceId':_0x2114a3['id']}})['then'](function(){return _0x3444f7;});})[_0xdd96('0x1e')](function(){_0x1996c5[_0xdd96('0x29')](0xcc)[_0xdd96('0x2a')]();});}};}function handleEntityNotFound(_0x3f57c5,_0x572da7){return function(_0x987808){if(!_0x987808){_0x3f57c5[_0xdd96('0x28')](0x194);}return _0x987808;};}function handleError(_0x33fafe,_0x26202f){_0x26202f=_0x26202f||0x1f4;return function(_0x38461c){logger[_0xdd96('0x23')](_0x38461c['stack']);if(_0x38461c[_0xdd96('0x35')]){delete _0x38461c['name'];}_0x33fafe[_0xdd96('0x29')](_0x26202f)['send'](_0x38461c);};}exports[_0xdd96('0x36')]=function(_0x3a9ee2,_0x192b8c){var _0x11e76f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2b21e6={},_0x51a88b={'count':0x0,'rows':[]};var _0x23e2b1=_[_0xdd96('0x37')](db['OpenchannelAccount']['rawAttributes'],function(_0x57fd13){return{'name':_0x57fd13[_0xdd96('0x38')],'type':_0x57fd13['type'][_0xdd96('0x39')]};});_0x2b21e6[_0xdd96('0x3a')]=_[_0xdd96('0x37')](_0x23e2b1,_0xdd96('0x35'));_0x2b21e6['query']=_[_0xdd96('0x3b')](_0x3a9ee2[_0xdd96('0x3c')]);_0x2b21e6[_0xdd96('0x3d')]=_[_0xdd96('0x3e')](_0x2b21e6[_0xdd96('0x3a')],_0x2b21e6['query']);_0x11e76f[_0xdd96('0x3f')]=_[_0xdd96('0x3e')](_0x2b21e6['model'],qs[_0xdd96('0x40')](_0x3a9ee2[_0xdd96('0x3c')][_0xdd96('0x40')]));_0x11e76f[_0xdd96('0x3f')]=_0x11e76f['attributes']['length']?_0x11e76f[_0xdd96('0x3f')]:_0x2b21e6['model'];if(!_0x3a9ee2['query'][_0xdd96('0x41')](_0xdd96('0x42'))){_0x11e76f[_0xdd96('0x2e')]=qs[_0xdd96('0x2e')](_0x3a9ee2[_0xdd96('0x3c')][_0xdd96('0x2e')]);_0x11e76f['offset']=qs[_0xdd96('0x2d')](_0x3a9ee2[_0xdd96('0x3c')][_0xdd96('0x2d')]);}_0x11e76f[_0xdd96('0x43')]=qs[_0xdd96('0x44')](_0x3a9ee2['query'][_0xdd96('0x44')]);_0x11e76f[_0xdd96('0x45')]=qs[_0xdd96('0x3d')](_[_0xdd96('0x46')](_0x3a9ee2['query'],_0x2b21e6[_0xdd96('0x3d')]),_0x23e2b1);if(_0x3a9ee2[_0xdd96('0x3c')]['filter']){_0x11e76f[_0xdd96('0x45')]=_['merge'](_0x11e76f[_0xdd96('0x45')],{'$or':_['map'](_0x23e2b1,function(_0x142dd3){if(_0x142dd3[_0xdd96('0x47')]!==_0xdd96('0x48')){var _0x45a375={};_0x45a375[_0x142dd3[_0xdd96('0x35')]]={'$like':'%'+_0x3a9ee2['query'][_0xdd96('0x49')]+'%'};return _0x45a375;}})});}_0x11e76f=_[_0xdd96('0x4a')]({},_0x11e76f,_0x3a9ee2[_0xdd96('0x4b')]);var _0x38e051={'where':_0x11e76f[_0xdd96('0x45')]};return db[_0xdd96('0x4c')][_0xdd96('0x2c')](_0x38e051)[_0xdd96('0x1e')](function(_0x382569){_0x51a88b[_0xdd96('0x2c')]=_0x382569;if(_0x3a9ee2[_0xdd96('0x3c')][_0xdd96('0x4d')]){_0x11e76f[_0xdd96('0x4e')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xdd96('0x4f')](_0x11e76f);})['then'](function(_0x107b31){_0x51a88b[_0xdd96('0x50')]=_0x107b31;return _0x51a88b;})[_0xdd96('0x1e')](respondWithFilteredResult(_0x192b8c,_0x11e76f))['catch'](handleError(_0x192b8c,null));};exports[_0xdd96('0x51')]=function(_0x572aaf,_0x24ef4d){var _0x32e1c9={'raw':![],'where':{'id':_0x572aaf[_0xdd96('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xdd96('0x53')}]},_0x23bb98={};_0x23bb98[_0xdd96('0x3a')]=_[_0xdd96('0x3b')](db['OpenchannelAccount'][_0xdd96('0x54')]);_0x23bb98[_0xdd96('0x3c')]=_[_0xdd96('0x3b')](_0x572aaf[_0xdd96('0x3c')]);_0x23bb98[_0xdd96('0x3d')]=_[_0xdd96('0x3e')](_0x23bb98['model'],_0x23bb98[_0xdd96('0x3c')]);_0x32e1c9['attributes']=_[_0xdd96('0x3e')](_0x23bb98[_0xdd96('0x3a')],qs[_0xdd96('0x40')](_0x572aaf[_0xdd96('0x3c')][_0xdd96('0x40')]));_0x32e1c9[_0xdd96('0x3f')]=_0x32e1c9['attributes'][_0xdd96('0x55')]?_0x32e1c9[_0xdd96('0x3f')]:_0x23bb98['model'];if(_0x572aaf['query'][_0xdd96('0x4d')]){_0x32e1c9[_0xdd96('0x4e')]=[{'all':!![]}];}_0x32e1c9=_[_0xdd96('0x4a')]({},_0x32e1c9,_0x572aaf[_0xdd96('0x4b')]);return db[_0xdd96('0x4c')][_0xdd96('0x56')](_0x32e1c9)['then'](handleEntityNotFound(_0x24ef4d,null))['then'](respondWithResult(_0x24ef4d,null))[_0xdd96('0x57')](handleError(_0x24ef4d,null));};exports['create']=function(_0x4fec07,_0x17f739){return db['OpenchannelAccount'][_0xdd96('0x58')](_0x4fec07[_0xdd96('0x59')],{})[_0xdd96('0x1e')](function(_0x3bbc47){var _0x4736b7=_0x4fec07[_0xdd96('0x5a')][_0xdd96('0x32')]({'plain':!![]});if(!_0x4736b7)throw new Error(_0xdd96('0x5b'));if(_0x4736b7[_0xdd96('0x5c')]===_0xdd96('0x5a')){var _0x479bc5=_0x3bbc47[_0xdd96('0x32')]({'plain':!![]});var _0x528587=_0xdd96('0x33');return db[_0xdd96('0x5d')][_0xdd96('0x56')]({'where':{'name':_0x528587,'userProfileId':_0x4736b7[_0xdd96('0x5e')]},'raw':!![]})['then'](function(_0x168608){if(_0x168608&&_0x168608[_0xdd96('0x5f')]===0x0){return db[_0xdd96('0x34')][_0xdd96('0x58')]({'name':_0x479bc5[_0xdd96('0x35')],'resourceId':_0x479bc5['id'],'type':_0x168608[_0xdd96('0x35')],'sectionId':_0x168608['id']},{})[_0xdd96('0x1e')](function(){return _0x3bbc47;});}else{return _0x3bbc47;}})[_0xdd96('0x57')](function(_0x4f373e){logger[_0xdd96('0x23')](_0xdd96('0x60'),_0x4f373e);throw _0x4f373e;});}return _0x3bbc47;})['then'](respondWithResult(_0x17f739,0xc9))[_0xdd96('0x57')](handleError(_0x17f739,null));};exports['update']=function(_0x60b6ad,_0x1708c7){if(_0x60b6ad[_0xdd96('0x59')]['id']){delete _0x60b6ad['body']['id'];}return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x60b6ad[_0xdd96('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xdd96('0x53')}]})[_0xdd96('0x1e')](handleEntityNotFound(_0x1708c7,null))[_0xdd96('0x1e')](saveUpdates(_0x60b6ad[_0xdd96('0x59')],null))['then'](respondWithResult(_0x1708c7,null))[_0xdd96('0x57')](handleError(_0x1708c7,null));};exports[_0xdd96('0x61')]=function(_0x4f293b,_0x22b45d){return db['OpenchannelAccount'][_0xdd96('0x56')]({'where':{'id':_0x4f293b['params']['id']}})['then'](handleEntityNotFound(_0x22b45d,null))[_0xdd96('0x1e')](removeEntity(_0x22b45d,null))[_0xdd96('0x57')](handleError(_0x22b45d,null));};exports[_0xdd96('0x62')]=function(_0x3fee62,_0x3599d6){return db[_0xdd96('0x4c')]['describe']()[_0xdd96('0x1e')](respondWithResult(_0x3599d6,null))[_0xdd96('0x57')](handleError(_0x3599d6,null));};exports[_0xdd96('0x63')]=function(_0x18eb40,_0x4fdb59,_0x4beb15){if(_0x18eb40['body']['id']){delete _0x18eb40[_0xdd96('0x59')]['id'];}return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x18eb40[_0xdd96('0x52')]['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x4fdb59,null))['then'](function(_0x25677b){if(_0x25677b){_0x18eb40[_0xdd96('0x59')]['OpenchannelAccountId']=_0x25677b['id'];return db[_0xdd96('0x64')][_0xdd96('0x58')](_0x18eb40[_0xdd96('0x59')]);}})[_0xdd96('0x1e')](respondWithResult(_0x4fdb59,null))[_0xdd96('0x57')](handleError(_0x4fdb59,null));};exports[_0xdd96('0x65')]=function(_0x159e6a,_0x24f2fa,_0x294bfe){var _0x10400b={'raw':![],'where':{}};var _0x4d2cdd={};var _0x367193={'count':0x0,'rows':[]};return db[_0xdd96('0x4c')][_0xdd96('0x66')]({'where':{'id':_0x159e6a[_0xdd96('0x52')]['id']}})['then'](handleEntityNotFound(_0x24f2fa,null))[_0xdd96('0x1e')](function(_0x2fa19e){if(_0x2fa19e){_0x4d2cdd['model']=_[_0xdd96('0x3b')](db[_0xdd96('0x64')][_0xdd96('0x54')]);_0x4d2cdd[_0xdd96('0x3c')]=_[_0xdd96('0x3b')](_0x159e6a['query']);_0x4d2cdd['filters']=_[_0xdd96('0x3e')](_0x4d2cdd[_0xdd96('0x3a')],_0x4d2cdd['query']);_0x10400b[_0xdd96('0x3f')]=_['intersection'](_0x4d2cdd[_0xdd96('0x3a')],qs['fields'](_0x159e6a['query']['fields']));_0x10400b[_0xdd96('0x3f')]=_0x10400b['attributes'][_0xdd96('0x55')]?_0x10400b[_0xdd96('0x3f')]:_0x4d2cdd[_0xdd96('0x3a')];if(!_0x159e6a[_0xdd96('0x3c')]['hasOwnProperty'](_0xdd96('0x42'))){_0x10400b[_0xdd96('0x2e')]=qs['limit'](_0x159e6a['query'][_0xdd96('0x2e')]);_0x10400b[_0xdd96('0x2d')]=qs['offset'](_0x159e6a[_0xdd96('0x3c')]['offset']);}_0x10400b[_0xdd96('0x43')]=qs[_0xdd96('0x44')](_0x159e6a[_0xdd96('0x3c')][_0xdd96('0x44')]);_0x10400b[_0xdd96('0x45')]=qs['filters'](_[_0xdd96('0x46')](_0x159e6a[_0xdd96('0x3c')],_0x4d2cdd[_0xdd96('0x3d')]));_0x10400b['where'][_0xdd96('0x67')]=_0x2fa19e['id'];if(_0x159e6a['query'][_0xdd96('0x49')]){_0x10400b[_0xdd96('0x45')]=_[_0xdd96('0x4a')](_0x10400b[_0xdd96('0x45')],{'$or':_['map'](_0x10400b[_0xdd96('0x3f')],function(_0x1a3ba1){var _0x265dbc={};_0x265dbc[_0x1a3ba1]={'$like':'%'+_0x159e6a[_0xdd96('0x3c')]['filter']+'%'};return _0x265dbc;})});}_0x10400b=_[_0xdd96('0x4a')]({},_0x10400b,_0x159e6a[_0xdd96('0x4b')]);return db[_0xdd96('0x64')]['count']({'where':_0x10400b['where']})[_0xdd96('0x1e')](function(_0x5d74cc){_0x367193[_0xdd96('0x2c')]=_0x5d74cc;if(_0x159e6a['query'][_0xdd96('0x4d')]){_0x10400b['include']=[{'all':!![]}];}return db[_0xdd96('0x64')]['findAll'](_0x10400b);})[_0xdd96('0x1e')](function(_0x2ad13e){_0x367193[_0xdd96('0x50')]=_0x2ad13e;return _0x367193;});}})[_0xdd96('0x1e')](respondWithFilteredResult(_0x24f2fa,_0x10400b))[_0xdd96('0x57')](handleError(_0x24f2fa,null));};exports[_0xdd96('0x68')]=function(_0x15576a,_0x2469e2,_0x41fdad){return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x15576a[_0xdd96('0x52')]['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x2469e2,null))['then'](function(_0x3656bd){if(_0x3656bd){return _0x3656bd[_0xdd96('0x68')](_0x15576a[_0xdd96('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x2469e2,null))[_0xdd96('0x57')](handleError(_0x2469e2,null));};exports[_0xdd96('0x69')]=function(_0x5dbc77,_0x199cf6,_0xcb3c66){if(_0x5dbc77[_0xdd96('0x59')]['id']){delete _0x5dbc77[_0xdd96('0x59')]['id'];}return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x5dbc77[_0xdd96('0x52')]['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x199cf6,null))[_0xdd96('0x1e')](function(_0x4038b0){if(_0x4038b0){_0x5dbc77[_0xdd96('0x59')][_0xdd96('0x67')]=_0x4038b0['id'];return db[_0xdd96('0x6a')][_0xdd96('0x58')](_0x5dbc77['body']);}})[_0xdd96('0x1e')](respondWithResult(_0x199cf6,null))[_0xdd96('0x57')](handleError(_0x199cf6,null));};exports['getAnswers']=function(_0x44cf3c,_0x23ac51,_0x56e705){var _0x17db31={'raw':![],'where':{}};var _0x2ff14b={};var _0x29db99={'count':0x0,'rows':[]};return db[_0xdd96('0x4c')][_0xdd96('0x66')]({'where':{'id':_0x44cf3c['params']['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x23ac51,null))['then'](function(_0x4a16bd){if(_0x4a16bd){_0x2ff14b[_0xdd96('0x3a')]=_[_0xdd96('0x3b')](db[_0xdd96('0x6a')][_0xdd96('0x54')]);_0x2ff14b['query']=_[_0xdd96('0x3b')](_0x44cf3c[_0xdd96('0x3c')]);_0x2ff14b['filters']=_[_0xdd96('0x3e')](_0x2ff14b['model'],_0x2ff14b[_0xdd96('0x3c')]);_0x17db31[_0xdd96('0x3f')]=_[_0xdd96('0x3e')](_0x2ff14b[_0xdd96('0x3a')],qs[_0xdd96('0x40')](_0x44cf3c[_0xdd96('0x3c')][_0xdd96('0x40')]));_0x17db31[_0xdd96('0x3f')]=_0x17db31[_0xdd96('0x3f')][_0xdd96('0x55')]?_0x17db31[_0xdd96('0x3f')]:_0x2ff14b[_0xdd96('0x3a')];if(!_0x44cf3c['query'][_0xdd96('0x41')](_0xdd96('0x42'))){_0x17db31['limit']=qs['limit'](_0x44cf3c[_0xdd96('0x3c')][_0xdd96('0x2e')]);_0x17db31['offset']=qs[_0xdd96('0x2d')](_0x44cf3c[_0xdd96('0x3c')][_0xdd96('0x2d')]);}_0x17db31['order']=qs[_0xdd96('0x44')](_0x44cf3c[_0xdd96('0x3c')]['sort']);_0x17db31[_0xdd96('0x45')]=qs[_0xdd96('0x3d')](_['pick'](_0x44cf3c[_0xdd96('0x3c')],_0x2ff14b['filters']));_0x17db31[_0xdd96('0x45')][_0xdd96('0x67')]=_0x4a16bd['id'];if(_0x44cf3c[_0xdd96('0x3c')][_0xdd96('0x49')]){_0x17db31[_0xdd96('0x45')]=_[_0xdd96('0x4a')](_0x17db31[_0xdd96('0x45')],{'$or':_[_0xdd96('0x37')](_0x17db31[_0xdd96('0x3f')],function(_0x1e5aaf){var _0x41d003={};_0x41d003[_0x1e5aaf]={'$like':'%'+_0x44cf3c['query'][_0xdd96('0x49')]+'%'};return _0x41d003;})});}_0x17db31=_[_0xdd96('0x4a')]({},_0x17db31,_0x44cf3c[_0xdd96('0x4b')]);return db[_0xdd96('0x6a')][_0xdd96('0x2c')]({'where':_0x17db31[_0xdd96('0x45')]})[_0xdd96('0x1e')](function(_0x248065){_0x29db99['count']=_0x248065;if(_0x44cf3c[_0xdd96('0x3c')]['includeAll']){_0x17db31['include']=[{'all':!![]}];}return db[_0xdd96('0x6a')][_0xdd96('0x4f')](_0x17db31);})[_0xdd96('0x1e')](function(_0x2f3857){_0x29db99[_0xdd96('0x50')]=_0x2f3857;return _0x29db99;});}})[_0xdd96('0x1e')](respondWithFilteredResult(_0x23ac51,_0x17db31))[_0xdd96('0x57')](handleError(_0x23ac51,null));};exports[_0xdd96('0x6b')]=function(_0x3ec329,_0x539f62,_0x4ad005){return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x3ec329['params']['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x539f62,null))[_0xdd96('0x1e')](function(_0x151a55){if(_0x151a55){return _0x151a55[_0xdd96('0x6b')](_0x3ec329[_0xdd96('0x3c')]['ids']);}})[_0xdd96('0x1e')](respondWithStatusCode(_0x539f62,null))[_0xdd96('0x57')](handleError(_0x539f62,null));};exports[_0xdd96('0x6c')]=function(_0x234a97,_0x4a6d55,_0x259df2){var _0x340069={'body':_0x234a97[_0xdd96('0x59')],'channel':_0xdd96('0x6d')};var _0x2b0401=[];var _0x450d21=[];var _0x1d8478={};var _0x33ea99=![];return db[_0xdd96('0x6e')]['describe']()[_0xdd96('0x1e')](function(_0x1a3707){if(!_0x1a3707){throw new db[(_0xdd96('0x6f'))][(_0xdd96('0x70'))]('no\x20available\x20attributes');}_0x2b0401=_['difference'](_[_0xdd96('0x3b')](_0x1a3707),[_0xdd96('0x71'),'updatedAt']);_0x450d21=_[_0xdd96('0x72')](_[_0xdd96('0x3b')](_0x1a3707),[_0xdd96('0x71'),_0xdd96('0x73'),_0xdd96('0x74'),_0xdd96('0x75')]);if(_0x234a97[_0xdd96('0x59')]['id']){delete _0x234a97[_0xdd96('0x59')]['id'];}if(_['isNil'](_0x234a97[_0xdd96('0x59')]['from'])){throw new db[(_0xdd96('0x6f'))][(_0xdd96('0x70'))](_0xdd96('0x76'));}if(_[_0xdd96('0x77')](_0x234a97['body'][_0xdd96('0x59')])||_0x234a97['body'][_0xdd96('0x59')]===''){throw new db[(_0xdd96('0x6f'))][(_0xdd96('0x70'))](_0xdd96('0x78'));}if(_[_0xdd96('0x77')](_0x234a97[_0xdd96('0x59')][_0xdd96('0x79')])){throw new db['Sequelize'][(_0xdd96('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x450d21);}if(!_[_0xdd96('0x7a')](_0x450d21,_0x234a97[_0xdd96('0x59')]['mapKey'])){throw new db['Sequelize'][(_0xdd96('0x70'))](_0xdd96('0x7b')+_0x450d21);}_0x1d8478[_0x234a97[_0xdd96('0x59')][_0xdd96('0x79')]]=_0x234a97[_0xdd96('0x59')][_0xdd96('0x7c')];})[_0xdd96('0x1e')](function(){return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x234a97['params']['id']},'include':[{'model':db[_0xdd96('0x7d')],'as':_0xdd96('0x7e'),'include':[{'model':db['CmContact'],'as':_0xdd96('0x7f'),'where':_0x1d8478,'limit':0x1,'order':[[_0xdd96('0x73'),_0xdd96('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0xdd96('0x81')}]});})[_0xdd96('0x1e')](handleEntityNotFound(_0x4a6d55,null))[_0xdd96('0x1e')](function(_0x415479){if(_0x415479&&_0x415479[_0xdd96('0x7e')]){_0x340069[_0xdd96('0x82')]=_0x415479;_0x340069[_0xdd96('0x83')]=_0x415479['Applications'];_0x340069['list']=_0x415479['List'];_0x340069[_0xdd96('0x83')]=_[_0xdd96('0x84')](_0x340069[_0xdd96('0x83')],[_0xdd96('0x85')],[_0xdd96('0x86')]);if(_0x340069[_0xdd96('0x82')][_0xdd96('0x81')]){delete _0x340069[_0xdd96('0x82')][_0xdd96('0x81')];}if(_0x340069[_0xdd96('0x82')]['List']&&_0x340069[_0xdd96('0x82')][_0xdd96('0x7e')][_0xdd96('0x7f')][_0xdd96('0x55')]){return _0x340069[_0xdd96('0x82')]['List']['Contacts'][0x0];}var _0x1a1d88=_[_0xdd96('0x87')](_0x234a97[_0xdd96('0x59')],{'firstName':_0x234a97[_0xdd96('0x59')][_0xdd96('0x7c')],'ListId':_0x415479['ListId']});_0x1a1d88[_0x234a97['body'][_0xdd96('0x79')]]=_0x234a97[_0xdd96('0x59')]['from'];return db['CmContact']['create'](_0x1a1d88,{'fields':_0x2b0401,'raw':!![]});}})[_0xdd96('0x1e')](handleEntityNotFound(_0x4a6d55,null))['then'](function(_0x67be4){_0x340069[_0xdd96('0x88')]=_0x67be4;if(_0x67be4){var _0x3aa688={'ContactId':_0x67be4['id'],'OpenchannelAccountId':_0x234a97['params']['id'],'from':(_0x67be4[_0xdd96('0x89')]||'')+'\x20'+(_0x67be4[_0xdd96('0x8a')]||'')};var _0x129de2={'OpenchannelAccountId':_0x234a97[_0xdd96('0x52')]['id'],'closed':![]};if(_0x234a97[_0xdd96('0x59')]['threadId']){_0x129de2['threadId']=_0x234a97[_0xdd96('0x59')][_0xdd96('0x8b')];return db[_0xdd96('0x8c')][_0xdd96('0x56')]({'where':_0x129de2})['then'](function(_0x1aff6e){if(_0x1aff6e){return[_0x1aff6e,![]];}_0x3aa688['threadId']=_0x234a97[_0xdd96('0x59')]['threadId'];_0x3aa688['externalUrl']=_0x234a97[_0xdd96('0x59')][_0xdd96('0x8d')];return db['OpenchannelInteraction'][_0xdd96('0x58')](_0x3aa688)[_0xdd96('0x1e')](function(_0x5341b1){return[_0x5341b1,!![]];});});}else{_0x129de2[_0xdd96('0x8b')]=null;}_0x129de2[_0xdd96('0x8e')]=_0x67be4['id'];return db[_0xdd96('0x8c')][_0xdd96('0x56')]({'where':_0x129de2})[_0xdd96('0x1e')](function(_0x51a3cb){if(_0x51a3cb){return[_0x51a3cb,![]];}return db[_0xdd96('0x8c')][_0xdd96('0x58')](_0x3aa688)[_0xdd96('0x1e')](function(_0xc3e0a5){return[_0xc3e0a5,!![]];});});}})['spread'](function(_0x2190ff,_0x168314){if(_0x2190ff){_0x33ea99=_0x168314;if(!_0x168314){var _0x23facd={'from':(_0x340069[_0xdd96('0x88')][_0xdd96('0x89')]||'')+'\x20'+(_0x340069[_0xdd96('0x88')][_0xdd96('0x8a')]||'')};if(_0x234a97[_0xdd96('0x59')][_0xdd96('0x8b')]&&_0x234a97[_0xdd96('0x59')][_0xdd96('0x8f')]&&_0x234a97[_0xdd96('0x59')]['threadId']!=_0x234a97['body'][_0xdd96('0x8f')]){_0x23facd[_0xdd96('0x8b')]=_0x234a97[_0xdd96('0x59')][_0xdd96('0x8f')];}return _0x2190ff[_0xdd96('0x31')](_0x23facd);}else{return _0x2190ff;}}})[_0xdd96('0x1e')](function(_0x20efc3){_0x340069[_0xdd96('0x90')]=_0x20efc3[_0xdd96('0x32')]({'plain':!![]});_0x340069['interaction'][_0xdd96('0x91')]=_0x33ea99;if(_0x340069[_0xdd96('0x90')][_0xdd96('0x91')]){if(_0x340069[_0xdd96('0x82')][_0xdd96('0x92')]){_0x340069['applications'][_0xdd96('0x93')]({'id':0x0,'priority':_0x340069[_0xdd96('0x83')][_0xdd96('0x55')]+0x1,'app':_0xdd96('0x94'),'appdata':_0xdd96('0x95'),'interval':'*,*,*,*'});}}return db[_0xdd96('0x96')][_0xdd96('0x58')]({'body':_0x234a97[_0xdd96('0x59')][_0xdd96('0x59')],'OpenchannelAccountId':_0x234a97[_0xdd96('0x52')]['id'],'OpenchannelInteractionId':_0x20efc3['id'],'direction':'in','ContactId':_0x340069[_0xdd96('0x88')]['id'],'AttachmentId':_0x234a97[_0xdd96('0x59')]['AttachmentId']});})[_0xdd96('0x1e')](function(_0xd721f4){_0x340069[_0xdd96('0x26')]=_0xd721f4;if(_0x340069['interaction']['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x340069[_0xdd96('0x90')][_0xdd96('0x97')]}})[_0xdd96('0x1e')](function(_0x3e83cb){if(_0x3e83cb){_0x340069[_0xdd96('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdd96('0x98'),'appdata':_0x3e83cb[_0xdd96('0x35')]+','+(_0x340069[_0xdd96('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0xdd96('0x99')});_0x340069['forcedOwnership']=![];}return respondWithRpcPromise(_0xdd96('0x9a'),_0xdd96('0x9b'),_0x340069);});}return respondWithRpcPromise('Start',_0xdd96('0x9b'),_0x340069);})[_0xdd96('0x1e')](function(_0xc5bbb4){respondWithRpcPromise(_0xdd96('0x9c'),_0xdd96('0x9c'),{'event':_0xdd96('0x6c'),'message':_0xc5bbb4},client9002);return _0xc5bbb4;})[_0xdd96('0x1e')](respondWithResult(_0x4a6d55,null))['catch'](handleError(_0x4a6d55,null));};exports[_0xdd96('0x9d')]=function(_0x296cb5,_0x5f4a08,_0x417fd9){return db[_0xdd96('0x4c')][_0xdd96('0x66')]({'where':{'id':_0x296cb5[_0xdd96('0x52')]['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x5f4a08,null))['then'](function(_0x108d48){if(_0x108d48){return db['sequelize'][_0xdd96('0x9e')](function(_0x2317f5){return db['OpenchannelApplication'][_0xdd96('0x61')]({'where':{'OpenchannelAccountId':_0x296cb5[_0xdd96('0x52')]['id']},'transaction':_0x2317f5})[_0xdd96('0x1e')](function(_0x4ebb43){var _0x502431=_[_0xdd96('0x37')](_0x296cb5[_0xdd96('0x59')],function(_0x5e4968){_0x5e4968[_0xdd96('0x67')]=_0x296cb5[_0xdd96('0x52')]['id'];return _0x5e4968;});return db[_0xdd96('0x9f')][_0xdd96('0xa0')](_0x502431,{'transaction':_0x2317f5});});})[_0xdd96('0x1e')](function(){return db[_0xdd96('0x9f')][_0xdd96('0xa1')]({'where':{'OpenchannelAccountId':_0x296cb5[_0xdd96('0x52')]['id']},'order':_0xdd96('0x85')});});}})['then'](respondWithResult(_0x5f4a08,null))[_0xdd96('0x57')](handleError(_0x5f4a08,null));};exports[_0xdd96('0xa2')]=function(_0x3398ee,_0x38b0fb,_0x554667){var _0x51b30a={};var _0x5e61fc={};var _0x56d2fa;var _0x48442d;return db['OpenchannelAccount'][_0xdd96('0x66')]({'where':{'id':_0x3398ee[_0xdd96('0x52')]['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x38b0fb,null))['then'](function(_0xa6a98c){if(_0xa6a98c){_0x56d2fa=_0xa6a98c;_0x5e61fc[_0xdd96('0x3a')]=_[_0xdd96('0x3b')](db[_0xdd96('0x9f')][_0xdd96('0x54')]);_0x5e61fc['query']=_[_0xdd96('0x3b')](_0x3398ee[_0xdd96('0x3c')]);_0x5e61fc[_0xdd96('0x3d')]=_[_0xdd96('0x3e')](_0x5e61fc['model'],_0x5e61fc[_0xdd96('0x3c')]);_0x51b30a[_0xdd96('0x3f')]=_[_0xdd96('0x3e')](_0x5e61fc[_0xdd96('0x3a')],qs[_0xdd96('0x40')](_0x3398ee[_0xdd96('0x3c')][_0xdd96('0x40')]));_0x51b30a[_0xdd96('0x3f')]=_0x51b30a['attributes']['length']?_0x51b30a[_0xdd96('0x3f')]:_0x5e61fc[_0xdd96('0x3a')];_0x51b30a[_0xdd96('0x43')]=qs[_0xdd96('0x44')](_0x3398ee[_0xdd96('0x3c')]['sort']);_0x51b30a[_0xdd96('0x45')]=qs[_0xdd96('0x3d')](_[_0xdd96('0x46')](_0x3398ee[_0xdd96('0x3c')],_0x5e61fc[_0xdd96('0x3d')]));if(_0x3398ee[_0xdd96('0x3c')]['filter']){_0x51b30a[_0xdd96('0x45')]=_[_0xdd96('0x4a')](_0x51b30a['where'],{'$or':_[_0xdd96('0x37')](_0x51b30a[_0xdd96('0x3f')],function(_0x235c78){var _0x50a91e={};_0x50a91e[_0x235c78]={'$like':'%'+_0x3398ee[_0xdd96('0x3c')][_0xdd96('0x49')]+'%'};return _0x50a91e;})});}_0x51b30a=_[_0xdd96('0x4a')]({},_0x51b30a,_0x3398ee['options']);return _0x56d2fa['getApplications'](_0x51b30a);}})[_0xdd96('0x1e')](function(_0x19403c){if(_0x19403c){_0x48442d=_0x19403c['length'];if(!_0x3398ee[_0xdd96('0x3c')][_0xdd96('0x41')](_0xdd96('0x42'))){_0x51b30a[_0xdd96('0x2e')]=qs[_0xdd96('0x2e')](_0x3398ee[_0xdd96('0x3c')][_0xdd96('0x2e')]);_0x51b30a['offset']=qs[_0xdd96('0x2d')](_0x3398ee[_0xdd96('0x3c')][_0xdd96('0x2d')]);}return _0x56d2fa[_0xdd96('0xa2')](_0x51b30a);}})[_0xdd96('0x1e')](function(_0x4e7d54){if(_0x4e7d54){return _0x4e7d54?{'count':_0x48442d,'rows':_0x4e7d54}:null;}})[_0xdd96('0x1e')](respondWithResult(_0x38b0fb,null))[_0xdd96('0x57')](handleError(_0x38b0fb,null));};exports['getInteractions']=function(_0x278d4e,_0x28d65b,_0x317766){var _0x67413b={'raw':![],'where':{}};var _0xae2f35={};var _0x1e9437={'count':0x0,'rows':[]};return db[_0xdd96('0x4c')]['findOne']({'where':{'id':_0x278d4e['params']['id']}})['then'](handleEntityNotFound(_0x28d65b,null))[_0xdd96('0x1e')](function(_0x5ce750){if(_0x5ce750){_0xae2f35[_0xdd96('0x3a')]=_[_0xdd96('0x3b')](db[_0xdd96('0x8c')][_0xdd96('0x54')]);_0xae2f35[_0xdd96('0x3c')]=_[_0xdd96('0x3b')](_0x278d4e[_0xdd96('0x3c')]);_0xae2f35['filters']=_[_0xdd96('0x3e')](_0xae2f35[_0xdd96('0x3a')],_0xae2f35[_0xdd96('0x3c')]);_0x67413b['attributes']=_['intersection'](_0xae2f35[_0xdd96('0x3a')],qs[_0xdd96('0x40')](_0x278d4e[_0xdd96('0x3c')]['fields']));_0x67413b[_0xdd96('0x3f')]=_0x67413b[_0xdd96('0x3f')][_0xdd96('0x55')]?_0x67413b[_0xdd96('0x3f')]:_0xae2f35[_0xdd96('0x3a')];if(!_0x278d4e[_0xdd96('0x3c')]['hasOwnProperty'](_0xdd96('0x42'))){_0x67413b[_0xdd96('0x2e')]=qs[_0xdd96('0x2e')](_0x278d4e['query'][_0xdd96('0x2e')]);_0x67413b[_0xdd96('0x2d')]=qs['offset'](_0x278d4e[_0xdd96('0x3c')][_0xdd96('0x2d')]);}_0x67413b[_0xdd96('0x43')]=qs[_0xdd96('0x44')](_0x278d4e[_0xdd96('0x3c')][_0xdd96('0x44')]);_0x67413b[_0xdd96('0x45')]=qs[_0xdd96('0x3d')](_[_0xdd96('0x46')](_0x278d4e[_0xdd96('0x3c')],_0xae2f35[_0xdd96('0x3d')]));_0x67413b[_0xdd96('0x45')][_0xdd96('0x67')]=_0x5ce750['id'];if(_0x278d4e[_0xdd96('0x3c')]['filter']){_0x67413b[_0xdd96('0x45')]=_[_0xdd96('0x4a')](_0x67413b['where'],{'$or':_[_0xdd96('0x37')](_0x67413b[_0xdd96('0x3f')],function(_0x428ed1){var _0x33e95d={};_0x33e95d[_0x428ed1]={'$like':'%'+_0x278d4e[_0xdd96('0x3c')][_0xdd96('0x49')]+'%'};return _0x33e95d;})});}_0x67413b=_[_0xdd96('0x4a')]({},_0x67413b,_0x278d4e[_0xdd96('0x4b')]);return db[_0xdd96('0x8c')][_0xdd96('0x2c')]({'where':_0x67413b[_0xdd96('0x45')]})[_0xdd96('0x1e')](function(_0x50d49b){_0x1e9437[_0xdd96('0x2c')]=_0x50d49b;if(_0x278d4e[_0xdd96('0x3c')][_0xdd96('0x4d')]){_0x67413b[_0xdd96('0x4e')]=[{'model':db[_0xdd96('0x6e')],'as':_0xdd96('0xa3'),'required':![]},{'model':db[_0xdd96('0xa4')],'as':_0xdd96('0xa5'),'attributes':[_0xdd96('0x35'),'fullname',_0xdd96('0xa6')],'required':![]},{'model':db[_0xdd96('0xa7')],'as':_0xdd96('0xa8'),'attributes':['id',_0xdd96('0x35'),_0xdd96('0xa9')],'where':_0x278d4e[_0xdd96('0x3c')][_0xdd96('0xaa')]?{'id':_0x278d4e[_0xdd96('0x3c')][_0xdd96('0xaa')]}:undefined,'required':_0x278d4e[_0xdd96('0x3c')]['tag']?!![]:![]}];}return db[_0xdd96('0x8c')][_0xdd96('0x4f')](_0x67413b);})['then'](function(_0x31661f){_0x1e9437[_0xdd96('0x50')]=_0x31661f;return _0x1e9437;});}})[_0xdd96('0x1e')](respondWithFilteredResult(_0x28d65b,_0x67413b))[_0xdd96('0x57')](handleError(_0x28d65b,null));};exports[_0xdd96('0xab')]=function(_0x46db6a,_0x51e745,_0x119858){return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x46db6a['params']['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x51e745,null))[_0xdd96('0x1e')](function(_0x5cc902){if(_0x5cc902){return _0x5cc902[_0xdd96('0xab')](_0x46db6a[_0xdd96('0x59')][_0xdd96('0xac')],_[_0xdd96('0xad')](_0x46db6a[_0xdd96('0x59')],[_0xdd96('0xac'),'id'])||{})[_0xdd96('0xae')](function(_0x7d9415){for(var _0x5b14c0=0x0;_0x5b14c0<_0x46db6a['body']['ids'][_0xdd96('0x55')];_0x5b14c0+=0x1){socket['emit'](_0xdd96('0xaf'),{'UserId':_0x46db6a['body'][_0xdd96('0xac')][_0x5b14c0],'OpenchannelAccountId':_0x46db6a[_0xdd96('0x52')]['id']});}return _0x7d9415;});}})[_0xdd96('0x1e')](respondWithResult(_0x51e745,null))[_0xdd96('0x57')](handleError(_0x51e745,null));};exports[_0xdd96('0xb0')]=function(_0x72262d,_0x1ca9f2,_0x499022){return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0x72262d['params']['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x1ca9f2,null))[_0xdd96('0x1e')](function(_0x2ea1ce){if(_0x2ea1ce){return _0x2ea1ce[_0xdd96('0xb0')](_0x72262d[_0xdd96('0x3c')]['ids'])[_0xdd96('0x1e')](function(){if(_[_0xdd96('0xb1')](_0x72262d[_0xdd96('0x3c')]['ids'])){for(var _0x12dec1=0x0;_0x12dec1<_0x72262d[_0xdd96('0x3c')][_0xdd96('0xac')][_0xdd96('0x55')];_0x12dec1+=0x1){socket[_0xdd96('0xb2')](_0xdd96('0xb3'),{'UserId':Number(_0x72262d['query'][_0xdd96('0xac')][_0x12dec1]),'OpenchannelAccountId':Number(_0x72262d[_0xdd96('0x52')]['id'])});}}else{socket[_0xdd96('0xb2')](_0xdd96('0xb3'),{'UserId':Number(_0x72262d[_0xdd96('0x3c')][_0xdd96('0xac')]),'OpenchannelAccountId':Number(_0x72262d[_0xdd96('0x52')]['id'])});}});}})[_0xdd96('0x1e')](respondWithStatusCode(_0x1ca9f2,null))[_0xdd96('0x57')](handleError(_0x1ca9f2,null));};exports[_0xdd96('0xb4')]=function(_0x11c617,_0x34b8d3,_0x19966f){var _0x170285={};var _0x2ce0ae={};var _0x5bc2de;var _0x2d97c2;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x11c617[_0xdd96('0x52')]['id']}})['then'](handleEntityNotFound(_0x34b8d3,null))[_0xdd96('0x1e')](function(_0x630f33){if(_0x630f33){_0x5bc2de=_0x630f33;_0x2ce0ae['model']=_['keys'](db[_0xdd96('0xa4')][_0xdd96('0x54')]);_0x2ce0ae[_0xdd96('0x3c')]=_[_0xdd96('0x3b')](_0x11c617[_0xdd96('0x3c')]);_0x2ce0ae['filters']=_[_0xdd96('0x3e')](_0x2ce0ae[_0xdd96('0x3a')],_0x2ce0ae[_0xdd96('0x3c')]);_0x170285[_0xdd96('0x3f')]=_['intersection'](_0x2ce0ae[_0xdd96('0x3a')],qs[_0xdd96('0x40')](_0x11c617[_0xdd96('0x3c')]['fields']));_0x170285[_0xdd96('0x3f')]=_0x170285[_0xdd96('0x3f')][_0xdd96('0x55')]?_0x170285['attributes']:_0x2ce0ae[_0xdd96('0x3a')];_0x170285[_0xdd96('0x43')]=qs['sort'](_0x11c617[_0xdd96('0x3c')]['sort']);_0x170285['where']=qs['filters'](_[_0xdd96('0x46')](_0x11c617[_0xdd96('0x3c')],_0x2ce0ae[_0xdd96('0x3d')]));if(_0x11c617[_0xdd96('0x3c')][_0xdd96('0x49')]){_0x170285['where']=_['merge'](_0x170285[_0xdd96('0x45')],{'$or':_[_0xdd96('0x37')](_0x170285[_0xdd96('0x3f')],function(_0x2b337e){var _0x72b99c={};_0x72b99c[_0x2b337e]={'$like':'%'+_0x11c617[_0xdd96('0x3c')]['filter']+'%'};return _0x72b99c;})});}_0x170285=_[_0xdd96('0x4a')]({},_0x170285,_0x11c617['options']);return _0x5bc2de['getAgents'](_0x170285);}})[_0xdd96('0x1e')](function(_0x2c4ebe){if(_0x2c4ebe){_0x2d97c2=_0x2c4ebe['length'];if(!_0x11c617['query']['hasOwnProperty'](_0xdd96('0x42'))){_0x170285['limit']=qs[_0xdd96('0x2e')](_0x11c617['query'][_0xdd96('0x2e')]);_0x170285[_0xdd96('0x2d')]=qs[_0xdd96('0x2d')](_0x11c617[_0xdd96('0x3c')][_0xdd96('0x2d')]);}return _0x5bc2de[_0xdd96('0xb4')](_0x170285);}})[_0xdd96('0x1e')](function(_0x2f9091){if(_0x2f9091){return _0x2f9091?{'count':_0x2d97c2,'rows':_0x2f9091}:null;}})[_0xdd96('0x1e')](respondWithResult(_0x34b8d3,null))['catch'](handleError(_0x34b8d3,null));};exports[_0xdd96('0xb5')]=function(_0x526aca,_0x2418ce,_0xbe4c59){var _0x5c3fd4,_0x2b8480,_0x1f5b5a;if(_['isNil'](_0x526aca[_0xdd96('0x59')]['body'])||_0x526aca[_0xdd96('0x59')][_0xdd96('0x59')]===''){throw new db[(_0xdd96('0x6f'))][(_0xdd96('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdd96('0x77')](_0x526aca[_0xdd96('0x59')]['to'])){}_0x5c3fd4=_0x526aca[_0xdd96('0x59')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x526aca[_0xdd96('0x52')]['id']}})[_0xdd96('0x1e')](handleEntityNotFound(_0x2418ce,null))[_0xdd96('0x1e')](function(_0xd6f477){if(_0xd6f477){return db[_0xdd96('0x4c')][_0xdd96('0x56')]({'where':{'id':_0xd6f477['id']},'include':[{'model':db['CmList'],'as':_0xdd96('0x7e'),'include':[{'model':db[_0xdd96('0x6e')],'as':_0xdd96('0x7f'),'where':{[_0xd6f477[_0xdd96('0x79')]]:_0x5c3fd4},'limit':0x1,'order':[[_0xdd96('0x73'),_0xdd96('0x80')]]}]}]})['then'](handleEntityNotFound(_0x2418ce,null))['then'](function(_0x1ed244){if(_0x1ed244&&_0x1ed244[_0xdd96('0x7e')]){_0x2b8480=_0x1ed244[_0xdd96('0x32')]({'plain':!![]});if(_0x2b8480[_0xdd96('0x7e')]&&_0x2b8480['List'][_0xdd96('0x7f')][_0xdd96('0x55')]){return _0x2b8480[_0xdd96('0x7e')][_0xdd96('0x7f')][0x0];}return db[_0xdd96('0x6e')][_0xdd96('0x58')](_[_0xdd96('0x87')](_0x526aca[_0xdd96('0x59')],{'firstName':_0x5c3fd4,[_0x1ed244[_0xdd96('0x79')]]:_0x5c3fd4,'phone':_0x5c3fd4,'ListId':_0x2b8480['ListId']}));}})['then'](handleEntityNotFound(_0x2418ce,null))['then'](function(_0x479423){if(_0x479423){_0x1f5b5a=_0x479423;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x1f5b5a['id'],'closed':![],'OpenchannelAccountId':_0x2b8480['id']}})[_0xdd96('0x1e')](function(_0x491289){if(_0x491289){return[_0x491289,![]];}return db[_0xdd96('0x8c')][_0xdd96('0x58')]({'UserId':_0x526aca[_0xdd96('0x5a')]['id'],'ContactId':_0x1f5b5a['id'],'OpenchannelAccountId':_0x2b8480['id'],'lastMsgDirection':'out','Messages':[_[_0xdd96('0x4a')](_0x526aca['body'],{'read':![],'body':_0x526aca[_0xdd96('0x59')][_0xdd96('0x59')],'OpenchannelAccountId':_0x2b8480['id'],'UserId':_0x526aca[_0xdd96('0x5a')]['id'],'ContactId':_0x1f5b5a['id']})]},{'include':[{'model':db[_0xdd96('0x96')],'as':_0xdd96('0xb6')}]})[_0xdd96('0x1e')](function(_0xdc9909){return[_0xdc9909,!![]];});});}})[_0xdd96('0xae')](function(_0xf36818,_0x1788ae){if(_0x1788ae){return _0xf36818;}return db['OpenchannelMessage'][_0xdd96('0x58')](_[_0xdd96('0x4a')](_0x526aca[_0xdd96('0x59')],{'read':![],'body':_0x526aca['body'][_0xdd96('0x59')],'OpenchannelAccountId':_0x2b8480['id'],'OpenchannelInteractionId':_0xf36818['id'],'UserId':_0x526aca['user']['id'],'ContactId':_0x1f5b5a['id']}))[_0xdd96('0x1e')](function(_0x20cf2b){_0xf36818[_0xdd96('0xb7')]['Messages']=[];_0xf36818[_0xdd96('0xb7')][_0xdd96('0xb6')]['push'](_0x20cf2b[_0xdd96('0xb7')]);return _0xf36818;});});}})[_0xdd96('0x1e')](respondWithResult(_0x2418ce,null))[_0xdd96('0x57')](handleError(_0x2418ce,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ecdd8e5..46ebcf3 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 _0xcb71=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x61592,_0x3298b7){var _0x59a63d=function(_0x251eb0){while(--_0x251eb0){_0x61592['push'](_0x61592['shift']());}};_0x59a63d(++_0x3298b7);}(_0xcb71,0x1b9));var _0x1cb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb71[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1cb7('0x0'));var OpenchannelAccount=require(_0x1cb7('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cb7('0x2'),'afterUpdate':_0x1cb7('0x3'),'afterDestroy':_0x1cb7('0x4')};function emitEvent(_0x4d8c99){return function(_0x1af662,_0x45c82b,_0x2e98bc){OpenchannelAccountEvents[_0x1cb7('0x5')](_0x4d8c99+':'+_0x1af662['id'],_0x1af662);OpenchannelAccountEvents['emit'](_0x4d8c99,_0x1af662);_0x2e98bc(null);};}for(var e in events){if(events[_0x1cb7('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xa019=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit'];(function(_0x409176,_0x17b4a9){var _0x7e9804=function(_0x4fc097){while(--_0x4fc097){_0x409176['push'](_0x409176['shift']());}};_0x7e9804(++_0x17b4a9);}(_0xa019,0x197));var _0x9a01=function(_0xc5604f,_0x30cc26){_0xc5604f=_0xc5604f-0x0;var _0x953664=_0xa019[_0xc5604f];return _0x953664;};'use strict';var EventEmitter=require(_0x9a01('0x0'));var OpenchannelAccount=require(_0x9a01('0x1'))['db'][_0x9a01('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9a01('0x3')](0x0);var events={'afterCreate':_0x9a01('0x4'),'afterUpdate':_0x9a01('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d11e3){return function(_0x3c4476,_0x423db6,_0x57a6c7){OpenchannelAccountEvents[_0x9a01('0x6')](_0x5d11e3+':'+_0x3c4476['id'],_0x3c4476);OpenchannelAccountEvents[_0x9a01('0x6')](_0x5d11e3,_0x3c4476);_0x57a6c7(null);};}for(var e in events){if(events[_0x9a01('0x7')](e)){var event=events[e];OpenchannelAccount[_0x9a01('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 848984a..e80d4a4 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 _0xbe7d=['bluebird','request-promise','path','../../config/environment','./openchannelAccount.attributes','define','openchannel_accounts','util','api','moment'];(function(_0x238882,_0x194162){var _0x4528ac=function(_0x902cca){while(--_0x902cca){_0x238882['push'](_0x238882['shift']());}};_0x4528ac(++_0x194162);}(_0xbe7d,0xcf));var _0xdbe7=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0xbe7d[_0x5e2862];return _0x8dcad4;};'use strict';var _=require('lodash');var util=require(_0xdbe7('0x0'));var logger=require('../../config/logger')(_0xdbe7('0x1'));var moment=require(_0xdbe7('0x2'));var BPromise=require(_0xdbe7('0x3'));var rp=require(_0xdbe7('0x4'));var fs=require('fs');var path=require(_0xdbe7('0x5'));var rimraf=require('rimraf');var config=require(_0xdbe7('0x6'));var attributes=require(_0xdbe7('0x7'));module['exports']=function(_0xc7bbfa,_0x550b4c){return _0xc7bbfa[_0xdbe7('0x8')]('OpenchannelAccount',attributes,{'tableName':_0xdbe7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0773=['rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3bf23d,_0x484e8b){var _0x44e17f=function(_0x2c90b1){while(--_0x2c90b1){_0x3bf23d['push'](_0x3bf23d['shift']());}};_0x44e17f(++_0x484e8b);}(_0x0773,0x1da));var _0x3077=function(_0x24a57f,_0x4d53e7){_0x24a57f=_0x24a57f-0x0;var _0x39ea56=_0x0773[_0x24a57f];return _0x39ea56;};'use strict';var _=require(_0x3077('0x0'));var util=require(_0x3077('0x1'));var logger=require(_0x3077('0x2'))(_0x3077('0x3'));var moment=require(_0x3077('0x4'));var BPromise=require(_0x3077('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3077('0x6'));var rimraf=require(_0x3077('0x7'));var config=require(_0x3077('0x8'));var attributes=require(_0x3077('0x9'));module[_0x3077('0xa')]=function(_0x45a3c4,_0x47cb09){return _0x45a3c4[_0x3077('0xb')]('OpenchannelAccount',attributes,{'tableName':_0x3077('0xc'),'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 1b9e4b2..9941350 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 _0x5e5d=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e053f,_0x59eca5){var _0x60e4d1=function(_0x5a5f07){while(--_0x5a5f07){_0x1e053f['push'](_0x1e053f['shift']());}};_0x60e4d1(++_0x59eca5);}(_0x5e5d,0x123));var _0xd5e5=function(_0x5687e7,_0x140fe7){_0x5687e7=_0x5687e7-0x0;var _0x33b721=_0x5e5d[_0x5687e7];return _0x33b721;};'use strict';var _=require(_0xd5e5('0x0'));var util=require(_0xd5e5('0x1'));var moment=require(_0xd5e5('0x2'));var BPromise=require(_0xd5e5('0x3'));var rs=require(_0xd5e5('0x4'));var fs=require('fs');var Redis=require(_0xd5e5('0x5'));var db=require(_0xd5e5('0x6'))['db'];var utils=require(_0xd5e5('0x7'));var logger=require(_0xd5e5('0x8'))('rpc');var config=require(_0xd5e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd5e5('0xa')][_0xd5e5('0xb')]({'port':0x232a});config[_0xd5e5('0xc')]=_['defaults'](config[_0xd5e5('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5e5('0xc')]));require(_0xd5e5('0xd'))[_0xd5e5('0xe')](socket);function respondWithRpcPromise(_0x3abbdc,_0x56c574,_0x54d9f3){return new BPromise(function(_0x85ffa,_0x209f04){return client['request'](_0x3abbdc,_0x54d9f3)[_0xd5e5('0xf')](function(_0x1793cf){logger['info'](_0xd5e5('0x10'),_0x56c574,_0xd5e5('0x11'));logger['debug'](_0xd5e5('0x12'),_0x56c574,_0xd5e5('0x11'),JSON[_0xd5e5('0x13')](_0x1793cf));if(_0x1793cf[_0xd5e5('0x14')]){if(_0x1793cf[_0xd5e5('0x14')][_0xd5e5('0x15')]===0x1f4){logger['error'](_0xd5e5('0x10'),_0x56c574,_0x1793cf[_0xd5e5('0x14')][_0xd5e5('0x16')]);return _0x209f04(_0x1793cf['error'][_0xd5e5('0x16')]);}logger['error'](_0xd5e5('0x10'),_0x56c574,_0x1793cf[_0xd5e5('0x14')][_0xd5e5('0x16')]);return _0x85ffa(_0x1793cf[_0xd5e5('0x14')][_0xd5e5('0x16')]);}else{logger[_0xd5e5('0x17')](_0xd5e5('0x10'),_0x56c574,_0xd5e5('0x11'));_0x85ffa(_0x1793cf[_0xd5e5('0x18')][_0xd5e5('0x16')]);}})[_0xd5e5('0x19')](function(_0x4069c8){logger['error'](_0xd5e5('0x10'),_0x56c574,_0x4069c8);_0x209f04(_0x4069c8);});});} \ No newline at end of file +var _0x4f47=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x593f13,_0x4301b0){var _0x5e702c=function(_0x4b16c7){while(--_0x4b16c7){_0x593f13['push'](_0x593f13['shift']());}};_0x5e702c(++_0x4301b0);}(_0x4f47,0xcc));var _0x74f4=function(_0x4e22e8,_0x4e29d6){_0x4e22e8=_0x4e22e8-0x0;var _0x4b3e6f=_0x4f47[_0x4e22e8];return _0x4b3e6f;};'use strict';var _=require(_0x74f4('0x0'));var util=require(_0x74f4('0x1'));var moment=require(_0x74f4('0x2'));var BPromise=require(_0x74f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74f4('0x5'))('rpc');var config=require(_0x74f4('0x6'));var jayson=require(_0x74f4('0x7'));var client=jayson[_0x74f4('0x8')][_0x74f4('0x9')]({'port':0x232a});config[_0x74f4('0xa')]=_['defaults'](config['redis'],{'host':_0x74f4('0xb'),'port':0x18eb});var socket=require(_0x74f4('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x74f4('0xd')](socket);function respondWithRpcPromise(_0x138f09,_0x2bf7f5,_0x2df09d){return new BPromise(function(_0x181fdd,_0x539d9c){return client[_0x74f4('0xe')](_0x138f09,_0x2df09d)[_0x74f4('0xf')](function(_0x503376){logger[_0x74f4('0x10')](_0x74f4('0x11'),_0x2bf7f5,_0x74f4('0x12'));logger['debug'](_0x74f4('0x13'),_0x2bf7f5,'request\x20sent',JSON[_0x74f4('0x14')](_0x503376));if(_0x503376[_0x74f4('0x15')]){if(_0x503376[_0x74f4('0x15')][_0x74f4('0x16')]===0x1f4){logger['error'](_0x74f4('0x11'),_0x2bf7f5,_0x503376[_0x74f4('0x15')][_0x74f4('0x17')]);return _0x539d9c(_0x503376[_0x74f4('0x15')][_0x74f4('0x17')]);}logger[_0x74f4('0x15')](_0x74f4('0x11'),_0x2bf7f5,_0x503376[_0x74f4('0x15')]['message']);return _0x181fdd(_0x503376[_0x74f4('0x15')][_0x74f4('0x17')]);}else{logger[_0x74f4('0x10')](_0x74f4('0x11'),_0x2bf7f5,_0x74f4('0x12'));_0x181fdd(_0x503376[_0x74f4('0x18')][_0x74f4('0x17')]);}})[_0x74f4('0x19')](function(_0x4463eb){logger[_0x74f4('0x15')](_0x74f4('0x11'),_0x2bf7f5,_0x4463eb);_0x539d9c(_0x4463eb);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 42551b5..2945d46 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 _0xd9f9=['update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x4814e9,_0x4a071f){var _0x449043=function(_0x14e4f6){while(--_0x14e4f6){_0x4814e9['push'](_0x4814e9['shift']());}};_0x449043(++_0x4a071f);}(_0xd9f9,0xb1));var _0x9d9f=function(_0x1102c7,_0x336ffd){_0x1102c7=_0x1102c7-0x0;var _0x47c91b=_0xd9f9[_0x1102c7];return _0x47c91b;};'use strict';var OpenchannelAccountEvents=require(_0x9d9f('0x0'));var events=[_0x9d9f('0x1'),_0x9d9f('0x2'),_0x9d9f('0x3')];function createListener(_0x1b7b8c,_0x3d2074){return function(_0x341b71){_0x3d2074[_0x9d9f('0x4')](_0x1b7b8c,_0x341b71);};}function removeListener(_0x2010c4,_0x2036a9){return function(){OpenchannelAccountEvents[_0x9d9f('0x5')](_0x2010c4,_0x2036a9);};}exports[_0x9d9f('0x6')]=function(_0x38a1b2){for(var _0x3e6be2=0x0,_0x5f4c0b=events[_0x9d9f('0x7')];_0x3e6be2<_0x5f4c0b;_0x3e6be2++){var _0x15b83e=events[_0x3e6be2];var _0x3dfea4=createListener(_0x9d9f('0x8')+_0x15b83e,_0x38a1b2);OpenchannelAccountEvents['on'](_0x15b83e,_0x3dfea4);}}; \ No newline at end of file +var _0x146d=['update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events','remove'];(function(_0x240aba,_0x4a50d9){var _0x54fb56=function(_0x50d546){while(--_0x50d546){_0x240aba['push'](_0x240aba['shift']());}};_0x54fb56(++_0x4a50d9);}(_0x146d,0x91));var _0xd146=function(_0x54ff2e,_0x1ddddf){_0x54ff2e=_0x54ff2e-0x0;var _0x13d69e=_0x146d[_0x54ff2e];return _0x13d69e;};'use strict';var OpenchannelAccountEvents=require(_0xd146('0x0'));var events=['save',_0xd146('0x1'),_0xd146('0x2')];function createListener(_0x5eeef3,_0x539260){return function(_0x1d4534){_0x539260[_0xd146('0x3')](_0x5eeef3,_0x1d4534);};}function removeListener(_0x399804,_0x44287a){return function(){OpenchannelAccountEvents[_0xd146('0x4')](_0x399804,_0x44287a);};}exports['register']=function(_0x5adec8){for(var _0x47bc9b=0x0,_0x36cbf4=events[_0xd146('0x5')];_0x47bc9b<_0x36cbf4;_0x47bc9b++){var _0x24973e=events[_0x47bc9b];var _0x48cb51=createListener(_0xd146('0x6')+_0x24973e,_0x5adec8);OpenchannelAccountEvents['on'](_0x24973e,_0x48cb51);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index acae2e4..757e907 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 _0x6c2a=['connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x5d2b89,_0x5a5817){var _0x58c152=function(_0x27bf7a){while(--_0x27bf7a){_0x5d2b89['push'](_0x5d2b89['shift']());}};_0x58c152(++_0x5a5817);}(_0x6c2a,0x6f));var _0xa6c2=function(_0x2ddddf,_0xd3a013){_0x2ddddf=_0x2ddddf-0x0;var _0x133dd2=_0x6c2a[_0x2ddddf];return _0x133dd2;};'use strict';var multer=require(_0xa6c2('0x0'));var util=require(_0xa6c2('0x1'));var path=require(_0xa6c2('0x2'));var timeout=require(_0xa6c2('0x3'));var express=require('express');var router=express[_0xa6c2('0x4')]();var auth=require(_0xa6c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa6c2('0x6'));var controller=require(_0xa6c2('0x7'));router[_0xa6c2('0x8')]('/',auth[_0xa6c2('0x9')](),controller[_0xa6c2('0xa')]);router['get'](_0xa6c2('0xb'),auth[_0xa6c2('0x9')](),controller[_0xa6c2('0xc')]);router[_0xa6c2('0xd')]('/',auth[_0xa6c2('0x9')](),controller[_0xa6c2('0xe')]);router[_0xa6c2('0xf')](_0xa6c2('0xb'),auth[_0xa6c2('0x9')](),controller[_0xa6c2('0x10')]);router[_0xa6c2('0x11')](_0xa6c2('0xb'),auth[_0xa6c2('0x9')](),controller['destroy']);module[_0xa6c2('0x12')]=router; \ No newline at end of file +var _0x7a21=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x29fe70,_0x56a233){var _0x18c06f=function(_0x1e2b1c){while(--_0x1e2b1c){_0x29fe70['push'](_0x29fe70['shift']());}};_0x18c06f(++_0x56a233);}(_0x7a21,0x1e7));var _0x17a2=function(_0x1934a0,_0x28f426){_0x1934a0=_0x1934a0-0x0;var _0x3ac91b=_0x7a21[_0x1934a0];return _0x3ac91b;};'use strict';var multer=require(_0x17a2('0x0'));var util=require(_0x17a2('0x1'));var path=require(_0x17a2('0x2'));var timeout=require(_0x17a2('0x3'));var express=require(_0x17a2('0x4'));var router=express['Router']();var auth=require(_0x17a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x17a2('0x6'));var controller=require(_0x17a2('0x7'));router[_0x17a2('0x8')]('/',auth[_0x17a2('0x9')](),controller[_0x17a2('0xa')]);router[_0x17a2('0x8')](_0x17a2('0xb'),auth[_0x17a2('0x9')](),controller['show']);router[_0x17a2('0xc')]('/',auth[_0x17a2('0x9')](),controller[_0x17a2('0xd')]);router[_0x17a2('0xe')]('/:id',auth[_0x17a2('0x9')](),controller[_0x17a2('0xf')]);router[_0x17a2('0x10')](_0x17a2('0xb'),auth[_0x17a2('0x9')](),controller[_0x17a2('0x11')]);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 05981d8..d7bef71 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 _0x3567=['INTEGER','STRING'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3567,0x1b6));var _0x7356=function(_0x188ff7,_0x59a659){_0x188ff7=_0x188ff7-0x0;var _0xb8e9af=_0x3567[_0x188ff7];return _0xb8e9af;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7356('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7356('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7356('0x1')]},'interval':{'type':Sequelize[_0x7356('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf5dd=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5398b5,_0x5ce8bc){var _0x35b8d7=function(_0x21b12b){while(--_0x21b12b){_0x5398b5['push'](_0x5398b5['shift']());}};_0x35b8d7(++_0x5ce8bc);}(_0xf5dd,0x110));var _0xdf5d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf5dd[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xdf5d('0x0'));module[_0xdf5d('0x1')]={'priority':{'type':Sequelize[_0xdf5d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdf5d('0x3')],'allowNull':![],'defaultValue':_0xdf5d('0x4')},'appdata':{'type':Sequelize[_0xdf5d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xdf5d('0x3')],'defaultValue':_0xdf5d('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 88f102a..fe3fd38 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 _0xf817=['show','includeAll','find','create','params','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','map','OpenchannelApplication','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x3f967a,_0x5361a6){var _0x33847c=function(_0x2c3f66){while(--_0x2c3f66){_0x3f967a['push'](_0x3f967a['shift']());}};_0x33847c(++_0x5361a6);}(_0xf817,0x12f));var _0x7f81=function(_0x4dca9d,_0x5f5615){_0x4dca9d=_0x4dca9d-0x0;var _0xba7c85=_0xf817[_0x4dca9d];return _0xba7c85;};'use strict';var pdf=require(_0x7f81('0x0'));var emlformat=require(_0x7f81('0x1'));var rimraf=require(_0x7f81('0x2'));var zipdir=require(_0x7f81('0x3'));var jsonpatch=require(_0x7f81('0x4'));var rp=require(_0x7f81('0x5'));var moment=require('moment');var BPromise=require(_0x7f81('0x6'));var Mustache=require('mustache');var util=require(_0x7f81('0x7'));var path=require(_0x7f81('0x8'));var sox=require('sox');var csv=require(_0x7f81('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7f81('0xa'));var crypto=require(_0x7f81('0xb'));var jsforce=require(_0x7f81('0xc'));var deskjs=require(_0x7f81('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f81('0xe'));var Redis=require('ioredis');var authService=require(_0x7f81('0xf'));var qs=require(_0x7f81('0x10'));var as=require(_0x7f81('0x11'));var hardwareService=require(_0x7f81('0x12'));var logger=require(_0x7f81('0x13'))(_0x7f81('0x14'));var utils=require(_0x7f81('0x15'));var config=require(_0x7f81('0x16'));var licenseUtil=require(_0x7f81('0x17'));var db=require(_0x7f81('0x18'))['db'];function respondWithStatusCode(_0x2c6c43,_0x84d53){_0x84d53=_0x84d53||0xcc;return function(_0x318975){if(_0x318975){return _0x2c6c43[_0x7f81('0x19')](_0x84d53);}return _0x2c6c43[_0x7f81('0x1a')](_0x84d53)[_0x7f81('0x1b')]();};}function respondWithResult(_0x295912,_0x22ea5b){_0x22ea5b=_0x22ea5b||0xc8;return function(_0x5570bc){if(_0x5570bc){return _0x295912[_0x7f81('0x1a')](_0x22ea5b)[_0x7f81('0x1c')](_0x5570bc);}};}function respondWithFilteredResult(_0x27636a,_0x36c6eb){return function(_0x3aea30){if(_0x3aea30){var _0xedb0ac=_0x3aea30[_0x7f81('0x1d')],_0x4b589a=_0x36c6eb['offset'],_0x2a2b9f=_0x36c6eb[_0x7f81('0x1e')]+_0x36c6eb[_0x7f81('0x1f')],_0x3f69b2;if(_0x2a2b9f>=_0xedb0ac){_0x2a2b9f=_0xedb0ac;_0x3f69b2=0xc8;}else{_0x3f69b2=0xce;}_0x27636a['status'](_0x3f69b2);return _0x27636a[_0x7f81('0x20')]('Content-Range',_0x4b589a+'-'+_0x2a2b9f+'/'+_0xedb0ac)[_0x7f81('0x1c')](_0x3aea30);}return null;};}function patchUpdates(_0x5c4f71){return function(_0x3ff1ff){try{jsonpatch[_0x7f81('0x21')](_0x3ff1ff,_0x5c4f71,!![]);}catch(_0x3ffb5d){return BPromise[_0x7f81('0x22')](_0x3ffb5d);}return _0x3ff1ff[_0x7f81('0x23')]();};}function saveUpdates(_0x561001,_0x4aae56){return function(_0x9fdea7){if(_0x9fdea7){return _0x9fdea7[_0x7f81('0x24')](_0x561001)['then'](function(_0x553903){return _0x553903;});}return null;};}function removeEntity(_0x3b7f25,_0x4e96c1){return function(_0xb0dacf){if(_0xb0dacf){return _0xb0dacf['destroy']()[_0x7f81('0x25')](function(){_0x3b7f25[_0x7f81('0x1a')](0xcc)[_0x7f81('0x1b')]();});}};}function handleEntityNotFound(_0x5726c4,_0x1c4123){return function(_0x389d5b){if(!_0x389d5b){_0x5726c4['sendStatus'](0x194);}return _0x389d5b;};}function handleError(_0x292d7e,_0xf644ad){_0xf644ad=_0xf644ad||0x1f4;return function(_0x2eb38e){logger[_0x7f81('0x26')](_0x2eb38e[_0x7f81('0x27')]);if(_0x2eb38e[_0x7f81('0x28')]){delete _0x2eb38e[_0x7f81('0x28')];}_0x292d7e['status'](_0xf644ad)[_0x7f81('0x29')](_0x2eb38e);};}exports['index']=function(_0x588a17,_0x53a811){var _0x2f263e={},_0xf85b2f={},_0x1611ed={'count':0x0,'rows':[]};var _0x2d5eb7=_[_0x7f81('0x2a')](db[_0x7f81('0x2b')]['rawAttributes'],function(_0x25055b){return{'name':_0x25055b['fieldName'],'type':_0x25055b[_0x7f81('0x2c')][_0x7f81('0x2d')]};});_0xf85b2f[_0x7f81('0x2e')]=_[_0x7f81('0x2a')](_0x2d5eb7,_0x7f81('0x28'));_0xf85b2f[_0x7f81('0x2f')]=_[_0x7f81('0x30')](_0x588a17[_0x7f81('0x2f')]);_0xf85b2f['filters']=_[_0x7f81('0x31')](_0xf85b2f['model'],_0xf85b2f[_0x7f81('0x2f')]);_0x2f263e[_0x7f81('0x32')]=_[_0x7f81('0x31')](_0xf85b2f[_0x7f81('0x2e')],qs[_0x7f81('0x33')](_0x588a17[_0x7f81('0x2f')]['fields']));_0x2f263e[_0x7f81('0x32')]=_0x2f263e[_0x7f81('0x32')][_0x7f81('0x34')]?_0x2f263e['attributes']:_0xf85b2f[_0x7f81('0x2e')];if(!_0x588a17[_0x7f81('0x2f')][_0x7f81('0x35')]('nolimit')){_0x2f263e[_0x7f81('0x1f')]=qs['limit'](_0x588a17[_0x7f81('0x2f')]['limit']);_0x2f263e[_0x7f81('0x1e')]=qs[_0x7f81('0x1e')](_0x588a17[_0x7f81('0x2f')][_0x7f81('0x1e')]);}_0x2f263e[_0x7f81('0x36')]=qs['sort'](_0x588a17[_0x7f81('0x2f')][_0x7f81('0x37')]);_0x2f263e[_0x7f81('0x38')]=qs[_0x7f81('0x39')](_[_0x7f81('0x3a')](_0x588a17[_0x7f81('0x2f')],_0xf85b2f[_0x7f81('0x39')]),_0x2d5eb7);if(_0x588a17[_0x7f81('0x2f')][_0x7f81('0x3b')]){_0x2f263e['where']=_[_0x7f81('0x3c')](_0x2f263e[_0x7f81('0x38')],{'$or':_['map'](_0x2d5eb7,function(_0x1ee162){if(_0x1ee162['type']!==_0x7f81('0x3d')){var _0x1e64a8={};_0x1e64a8[_0x1ee162['name']]={'$like':'%'+_0x588a17[_0x7f81('0x2f')][_0x7f81('0x3b')]+'%'};return _0x1e64a8;}})});}_0x2f263e=_[_0x7f81('0x3c')]({},_0x2f263e,_0x588a17[_0x7f81('0x3e')]);var _0x47c414={'where':_0x2f263e[_0x7f81('0x38')]};return db[_0x7f81('0x2b')]['count'](_0x47c414)[_0x7f81('0x25')](function(_0x12d747){_0x1611ed[_0x7f81('0x1d')]=_0x12d747;if(_0x588a17[_0x7f81('0x2f')]['includeAll']){_0x2f263e[_0x7f81('0x3f')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x7f81('0x40')](_0x2f263e);})[_0x7f81('0x25')](function(_0x4767fc){_0x1611ed[_0x7f81('0x41')]=_0x4767fc;return _0x1611ed;})[_0x7f81('0x25')](respondWithFilteredResult(_0x53a811,_0x2f263e))[_0x7f81('0x42')](handleError(_0x53a811,null));};exports[_0x7f81('0x43')]=function(_0x400403,_0x37e4e0){var _0x34b41a={'raw':!![],'where':{'id':_0x400403['params']['id']}},_0x4f1b67={};_0x4f1b67[_0x7f81('0x2e')]=_[_0x7f81('0x30')](db[_0x7f81('0x2b')]['rawAttributes']);_0x4f1b67[_0x7f81('0x2f')]=_[_0x7f81('0x30')](_0x400403[_0x7f81('0x2f')]);_0x4f1b67['filters']=_[_0x7f81('0x31')](_0x4f1b67[_0x7f81('0x2e')],_0x4f1b67[_0x7f81('0x2f')]);_0x34b41a[_0x7f81('0x32')]=_['intersection'](_0x4f1b67[_0x7f81('0x2e')],qs[_0x7f81('0x33')](_0x400403[_0x7f81('0x2f')][_0x7f81('0x33')]));_0x34b41a[_0x7f81('0x32')]=_0x34b41a['attributes']['length']?_0x34b41a[_0x7f81('0x32')]:_0x4f1b67[_0x7f81('0x2e')];if(_0x400403[_0x7f81('0x2f')][_0x7f81('0x44')]){_0x34b41a['include']=[{'all':!![]}];}_0x34b41a=_[_0x7f81('0x3c')]({},_0x34b41a,_0x400403[_0x7f81('0x3e')]);return db[_0x7f81('0x2b')][_0x7f81('0x45')](_0x34b41a)['then'](handleEntityNotFound(_0x37e4e0,null))['then'](respondWithResult(_0x37e4e0,null))[_0x7f81('0x42')](handleError(_0x37e4e0,null));};exports[_0x7f81('0x46')]=function(_0x37e96d,_0x2a869f){return db[_0x7f81('0x2b')]['create'](_0x37e96d['body'],{})[_0x7f81('0x25')](respondWithResult(_0x2a869f,0xc9))[_0x7f81('0x42')](handleError(_0x2a869f,null));};exports[_0x7f81('0x24')]=function(_0x20192b,_0x1b2f65){if(_0x20192b['body']['id']){delete _0x20192b['body']['id'];}return db[_0x7f81('0x2b')][_0x7f81('0x45')]({'where':{'id':_0x20192b[_0x7f81('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b2f65,null))['then'](saveUpdates(_0x20192b[_0x7f81('0x48')],null))[_0x7f81('0x25')](respondWithResult(_0x1b2f65,null))[_0x7f81('0x42')](handleError(_0x1b2f65,null));};exports[_0x7f81('0x49')]=function(_0x33e729,_0x5153df){return db[_0x7f81('0x2b')][_0x7f81('0x45')]({'where':{'id':_0x33e729[_0x7f81('0x47')]['id']}})[_0x7f81('0x25')](handleEntityNotFound(_0x5153df,null))[_0x7f81('0x25')](removeEntity(_0x5153df,null))[_0x7f81('0x42')](handleError(_0x5153df,null));}; \ No newline at end of file +var _0xae06=['ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x25e9bd,_0x141153){var _0x3a627d=function(_0x42a328){while(--_0x42a328){_0x25e9bd['push'](_0x25e9bd['shift']());}};_0x3a627d(++_0x141153);}(_0xae06,0x135));var _0x6ae0=function(_0x329115,_0x54359e){_0x329115=_0x329115-0x0;var _0x417e8a=_0xae06[_0x329115];return _0x417e8a;};'use strict';var pdf=require(_0x6ae0('0x0'));var emlformat=require(_0x6ae0('0x1'));var rimraf=require(_0x6ae0('0x2'));var zipdir=require(_0x6ae0('0x3'));var jsonpatch=require(_0x6ae0('0x4'));var rp=require('request-promise');var moment=require(_0x6ae0('0x5'));var BPromise=require(_0x6ae0('0x6'));var Mustache=require(_0x6ae0('0x7'));var util=require(_0x6ae0('0x8'));var path=require(_0x6ae0('0x9'));var sox=require(_0x6ae0('0xa'));var csv=require('to-csv');var ejs=require(_0x6ae0('0xb'));var fs=require('fs');var _=require(_0x6ae0('0xc'));var squel=require(_0x6ae0('0xd'));var crypto=require(_0x6ae0('0xe'));var jsforce=require(_0x6ae0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6ae0('0x10'));var querystring=require(_0x6ae0('0x11'));var Papa=require('papaparse');var Redis=require(_0x6ae0('0x12'));var authService=require(_0x6ae0('0x13'));var qs=require(_0x6ae0('0x14'));var as=require(_0x6ae0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ae0('0x16'))(_0x6ae0('0x17'));var utils=require(_0x6ae0('0x18'));var config=require(_0x6ae0('0x19'));var licenseUtil=require(_0x6ae0('0x1a'));var db=require(_0x6ae0('0x1b'))['db'];function respondWithStatusCode(_0x5a6ad8,_0x33fced){_0x33fced=_0x33fced||0xcc;return function(_0x7c4ea5){if(_0x7c4ea5){return _0x5a6ad8[_0x6ae0('0x1c')](_0x33fced);}return _0x5a6ad8[_0x6ae0('0x1d')](_0x33fced)[_0x6ae0('0x1e')]();};}function respondWithResult(_0xf13d2c,_0xffa4ce){_0xffa4ce=_0xffa4ce||0xc8;return function(_0x4e312f){if(_0x4e312f){return _0xf13d2c[_0x6ae0('0x1d')](_0xffa4ce)[_0x6ae0('0x1f')](_0x4e312f);}};}function respondWithFilteredResult(_0x16ce4f,_0x1b7b08){return function(_0x475fd0){if(_0x475fd0){var _0x35515c=_0x475fd0[_0x6ae0('0x20')],_0x1d2c8a=_0x1b7b08['offset'],_0x42cb9d=_0x1b7b08[_0x6ae0('0x21')]+_0x1b7b08[_0x6ae0('0x22')],_0x290360;if(_0x42cb9d>=_0x35515c){_0x42cb9d=_0x35515c;_0x290360=0xc8;}else{_0x290360=0xce;}_0x16ce4f[_0x6ae0('0x1d')](_0x290360);return _0x16ce4f[_0x6ae0('0x23')](_0x6ae0('0x24'),_0x1d2c8a+'-'+_0x42cb9d+'/'+_0x35515c)[_0x6ae0('0x1f')](_0x475fd0);}return null;};}function patchUpdates(_0x3219d1){return function(_0x26eca7){try{jsonpatch[_0x6ae0('0x25')](_0x26eca7,_0x3219d1,!![]);}catch(_0x4386e7){return BPromise[_0x6ae0('0x26')](_0x4386e7);}return _0x26eca7[_0x6ae0('0x27')]();};}function saveUpdates(_0x383101,_0x4858e9){return function(_0x4ac848){if(_0x4ac848){return _0x4ac848['update'](_0x383101)[_0x6ae0('0x28')](function(_0x5c3d22){return _0x5c3d22;});}return null;};}function removeEntity(_0x3b9ef7,_0x209973){return function(_0x20f4cd){if(_0x20f4cd){return _0x20f4cd['destroy']()[_0x6ae0('0x28')](function(){_0x3b9ef7[_0x6ae0('0x1d')](0xcc)[_0x6ae0('0x1e')]();});}};}function handleEntityNotFound(_0x56b80c,_0xae3394){return function(_0x2bf437){if(!_0x2bf437){_0x56b80c[_0x6ae0('0x1c')](0x194);}return _0x2bf437;};}function handleError(_0x2cf741,_0x2e448c){_0x2e448c=_0x2e448c||0x1f4;return function(_0x5194f7){logger[_0x6ae0('0x29')](_0x5194f7['stack']);if(_0x5194f7[_0x6ae0('0x2a')]){delete _0x5194f7[_0x6ae0('0x2a')];}_0x2cf741[_0x6ae0('0x1d')](_0x2e448c)[_0x6ae0('0x2b')](_0x5194f7);};}exports[_0x6ae0('0x2c')]=function(_0xfb1e08,_0x1abb88){var _0x1fb4b9={},_0x2a6010={},_0x3b9188={'count':0x0,'rows':[]};var _0x41124b=_[_0x6ae0('0x2d')](db[_0x6ae0('0x2e')][_0x6ae0('0x2f')],function(_0xa57867){return{'name':_0xa57867[_0x6ae0('0x30')],'type':_0xa57867[_0x6ae0('0x31')][_0x6ae0('0x32')]};});_0x2a6010[_0x6ae0('0x33')]=_[_0x6ae0('0x2d')](_0x41124b,'name');_0x2a6010[_0x6ae0('0x34')]=_[_0x6ae0('0x35')](_0xfb1e08[_0x6ae0('0x34')]);_0x2a6010[_0x6ae0('0x36')]=_[_0x6ae0('0x37')](_0x2a6010[_0x6ae0('0x33')],_0x2a6010[_0x6ae0('0x34')]);_0x1fb4b9[_0x6ae0('0x38')]=_[_0x6ae0('0x37')](_0x2a6010['model'],qs[_0x6ae0('0x39')](_0xfb1e08['query'][_0x6ae0('0x39')]));_0x1fb4b9[_0x6ae0('0x38')]=_0x1fb4b9['attributes'][_0x6ae0('0x3a')]?_0x1fb4b9[_0x6ae0('0x38')]:_0x2a6010[_0x6ae0('0x33')];if(!_0xfb1e08[_0x6ae0('0x34')][_0x6ae0('0x3b')](_0x6ae0('0x3c'))){_0x1fb4b9['limit']=qs[_0x6ae0('0x22')](_0xfb1e08[_0x6ae0('0x34')]['limit']);_0x1fb4b9[_0x6ae0('0x21')]=qs[_0x6ae0('0x21')](_0xfb1e08[_0x6ae0('0x34')][_0x6ae0('0x21')]);}_0x1fb4b9['order']=qs[_0x6ae0('0x3d')](_0xfb1e08['query']['sort']);_0x1fb4b9[_0x6ae0('0x3e')]=qs[_0x6ae0('0x36')](_[_0x6ae0('0x3f')](_0xfb1e08['query'],_0x2a6010['filters']),_0x41124b);if(_0xfb1e08[_0x6ae0('0x34')][_0x6ae0('0x40')]){_0x1fb4b9[_0x6ae0('0x3e')]=_['merge'](_0x1fb4b9[_0x6ae0('0x3e')],{'$or':_[_0x6ae0('0x2d')](_0x41124b,function(_0x16b2cf){if(_0x16b2cf['type']!==_0x6ae0('0x41')){var _0x282d8e={};_0x282d8e[_0x16b2cf[_0x6ae0('0x2a')]]={'$like':'%'+_0xfb1e08[_0x6ae0('0x34')]['filter']+'%'};return _0x282d8e;}})});}_0x1fb4b9=_[_0x6ae0('0x42')]({},_0x1fb4b9,_0xfb1e08[_0x6ae0('0x43')]);var _0x2e55fd={'where':_0x1fb4b9[_0x6ae0('0x3e')]};return db['OpenchannelApplication'][_0x6ae0('0x20')](_0x2e55fd)['then'](function(_0x54ffdc){_0x3b9188['count']=_0x54ffdc;if(_0xfb1e08[_0x6ae0('0x34')][_0x6ae0('0x44')]){_0x1fb4b9[_0x6ae0('0x45')]=[{'all':!![]}];}return db[_0x6ae0('0x2e')][_0x6ae0('0x46')](_0x1fb4b9);})['then'](function(_0x2ecf68){_0x3b9188[_0x6ae0('0x47')]=_0x2ecf68;return _0x3b9188;})[_0x6ae0('0x28')](respondWithFilteredResult(_0x1abb88,_0x1fb4b9))[_0x6ae0('0x48')](handleError(_0x1abb88,null));};exports[_0x6ae0('0x49')]=function(_0x19f68f,_0x5a6a8e){var _0x14c748={'raw':!![],'where':{'id':_0x19f68f[_0x6ae0('0x4a')]['id']}},_0x2c5f8f={};_0x2c5f8f[_0x6ae0('0x33')]=_[_0x6ae0('0x35')](db[_0x6ae0('0x2e')][_0x6ae0('0x2f')]);_0x2c5f8f[_0x6ae0('0x34')]=_[_0x6ae0('0x35')](_0x19f68f[_0x6ae0('0x34')]);_0x2c5f8f[_0x6ae0('0x36')]=_['intersection'](_0x2c5f8f['model'],_0x2c5f8f['query']);_0x14c748[_0x6ae0('0x38')]=_[_0x6ae0('0x37')](_0x2c5f8f[_0x6ae0('0x33')],qs[_0x6ae0('0x39')](_0x19f68f[_0x6ae0('0x34')][_0x6ae0('0x39')]));_0x14c748[_0x6ae0('0x38')]=_0x14c748['attributes'][_0x6ae0('0x3a')]?_0x14c748[_0x6ae0('0x38')]:_0x2c5f8f[_0x6ae0('0x33')];if(_0x19f68f[_0x6ae0('0x34')][_0x6ae0('0x44')]){_0x14c748[_0x6ae0('0x45')]=[{'all':!![]}];}_0x14c748=_[_0x6ae0('0x42')]({},_0x14c748,_0x19f68f['options']);return db[_0x6ae0('0x2e')][_0x6ae0('0x4b')](_0x14c748)['then'](handleEntityNotFound(_0x5a6a8e,null))[_0x6ae0('0x28')](respondWithResult(_0x5a6a8e,null))[_0x6ae0('0x48')](handleError(_0x5a6a8e,null));};exports[_0x6ae0('0x4c')]=function(_0x591347,_0x4a2f39){return db[_0x6ae0('0x2e')][_0x6ae0('0x4c')](_0x591347[_0x6ae0('0x4d')],{})['then'](respondWithResult(_0x4a2f39,0xc9))[_0x6ae0('0x48')](handleError(_0x4a2f39,null));};exports[_0x6ae0('0x4e')]=function(_0x15d75f,_0x4cb3bb){if(_0x15d75f['body']['id']){delete _0x15d75f[_0x6ae0('0x4d')]['id'];}return db['OpenchannelApplication'][_0x6ae0('0x4b')]({'where':{'id':_0x15d75f[_0x6ae0('0x4a')]['id']}})[_0x6ae0('0x28')](handleEntityNotFound(_0x4cb3bb,null))[_0x6ae0('0x28')](saveUpdates(_0x15d75f[_0x6ae0('0x4d')],null))[_0x6ae0('0x28')](respondWithResult(_0x4cb3bb,null))[_0x6ae0('0x48')](handleError(_0x4cb3bb,null));};exports[_0x6ae0('0x4f')]=function(_0xace402,_0x5a1100){return db[_0x6ae0('0x2e')][_0x6ae0('0x4b')]({'where':{'id':_0xace402[_0x6ae0('0x4a')]['id']}})[_0x6ae0('0x28')](handleEntityNotFound(_0x5a1100,null))['then'](removeEntity(_0x5a1100,null))[_0x6ae0('0x48')](handleError(_0x5a1100,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 68238fe..0b02e69 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 _0x5243=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication'];(function(_0x132886,_0x1b56cb){var _0x333c46=function(_0x28aa59){while(--_0x28aa59){_0x132886['push'](_0x132886['shift']());}};_0x333c46(++_0x1b56cb);}(_0x5243,0xd5));var _0x3524=function(_0x1ba38b,_0x303257){_0x1ba38b=_0x1ba38b-0x0;var _0x3f8a63=_0x5243[_0x1ba38b];return _0x3f8a63;};'use strict';var _=require(_0x3524('0x0'));var util=require('util');var logger=require(_0x3524('0x1'))(_0x3524('0x2'));var moment=require('moment');var BPromise=require(_0x3524('0x3'));var rp=require(_0x3524('0x4'));var fs=require('fs');var path=require(_0x3524('0x5'));var rimraf=require(_0x3524('0x6'));var config=require(_0x3524('0x7'));var attributes=require(_0x3524('0x8'));module[_0x3524('0x9')]=function(_0x4d530a,_0x10d35c){return _0x4d530a['define'](_0x3524('0xa'),attributes,{'tableName':_0x3524('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3524('0xc'),'collate':_0x3524('0xd')});}; \ No newline at end of file +var _0x25de=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x12d0eb,_0x1b7090){var _0xce6381=function(_0x224464){while(--_0x224464){_0x12d0eb['push'](_0x12d0eb['shift']());}};_0xce6381(++_0x1b7090);}(_0x25de,0x82));var _0xe25d=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x25de[_0x2ce6d5];return _0x32d272;};'use strict';var _=require('lodash');var util=require(_0xe25d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe25d('0x1'));var BPromise=require(_0xe25d('0x2'));var rp=require(_0xe25d('0x3'));var fs=require('fs');var path=require(_0xe25d('0x4'));var rimraf=require(_0xe25d('0x5'));var config=require(_0xe25d('0x6'));var attributes=require(_0xe25d('0x7'));module[_0xe25d('0x8')]=function(_0x3b0a87,_0x3f9d8d){return _0x3b0a87[_0xe25d('0x9')](_0xe25d('0xa'),attributes,{'tableName':_0xe25d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe25d('0xc'),'collate':_0xe25d('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b4a2ba8..4393004 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x396ab4,_0x1c5ac7){var _0x1b48db=function(_0x468382){while(--_0x468382){_0x396ab4['push'](_0x396ab4['shift']());}};_0x1b48db(++_0x1c5ac7);}(_0xb10b,0x12a));var _0xbb10=function(_0x155af3,_0x4b7f9a){_0x155af3=_0x155af3-0x0;var _0x15a675=_0xb10b[_0x155af3];return _0x15a675;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d4af5f0..aff3777 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 _0xe33d=['show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','/:id','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x8c8dcf,_0xeccd30){var _0x3a1595=function(_0x58e599){while(--_0x58e599){_0x8c8dcf['push'](_0x8c8dcf['shift']());}};_0x3a1595(++_0xeccd30);}(_0xe33d,0x1ab));var _0xde33=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe33d[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xde33('0x0'));var util=require(_0xde33('0x1'));var path=require(_0xde33('0x2'));var timeout=require(_0xde33('0x3'));var express=require(_0xde33('0x4'));var router=express[_0xde33('0x5')]();var auth=require(_0xde33('0x6'));var interaction=require(_0xde33('0x7'));var config=require(_0xde33('0x8'));var controller=require(_0xde33('0x9'));router[_0xde33('0xa')]('/',auth[_0xde33('0xb')](),controller[_0xde33('0xc')]);router[_0xde33('0xa')](_0xde33('0xd'),auth[_0xde33('0xb')](),controller[_0xde33('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xde33('0xf')]);router[_0xde33('0xa')](_0xde33('0x10'),auth[_0xde33('0xb')](),controller[_0xde33('0x11')]);router[_0xde33('0xa')]('/:id/download',auth[_0xde33('0xb')](),controller[_0xde33('0x12')]);router[_0xde33('0x13')]('/',auth[_0xde33('0xb')](),controller[_0xde33('0x14')]);router[_0xde33('0x13')](_0xde33('0x10'),auth[_0xde33('0xb')](),controller['addMessage']);router['post'](_0xde33('0x15'),auth[_0xde33('0xb')](),interaction[_0xde33('0x16')]('openchannel',_0xde33('0x17')),controller[_0xde33('0x18')]);router[_0xde33('0x19')]('/:id',auth[_0xde33('0xb')](),interaction['tracked']('openchannel',_0xde33('0x1a')),controller[_0xde33('0x1b')]);router[_0xde33('0x1c')](_0xde33('0x1d'),auth[_0xde33('0xb')](),interaction[_0xde33('0x16')]('openchannel',_0xde33('0x1e')),controller[_0xde33('0x1f')]);router[_0xde33('0x1c')](_0xde33('0x15'),auth[_0xde33('0xb')](),controller[_0xde33('0x20')]);module[_0xde33('0x21')]=router; \ No newline at end of file +var _0x1c2a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe','isAuthenticated','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','update','delete','tracked','exports','multer','util','path','express'];(function(_0x247c4f,_0x5d581d){var _0x5cc068=function(_0x515314){while(--_0x515314){_0x247c4f['push'](_0x247c4f['shift']());}};_0x5cc068(++_0x5d581d);}(_0x1c2a,0x113));var _0xa1c2=function(_0x7a7a40,_0x24a0fd){_0x7a7a40=_0x7a7a40-0x0;var _0x2031e4=_0x1c2a[_0x7a7a40];return _0x2031e4;};'use strict';var multer=require(_0xa1c2('0x0'));var util=require(_0xa1c2('0x1'));var path=require(_0xa1c2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1c2('0x3'));var router=express[_0xa1c2('0x4')]();var auth=require(_0xa1c2('0x5'));var interaction=require(_0xa1c2('0x6'));var config=require(_0xa1c2('0x7'));var controller=require(_0xa1c2('0x8'));router[_0xa1c2('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1c2('0xa')]);router['get'](_0xa1c2('0xb'),auth['isAuthenticated'](),controller[_0xa1c2('0xc')]);router[_0xa1c2('0x9')]('/:id',auth[_0xa1c2('0xd')](),controller[_0xa1c2('0xe')]);router[_0xa1c2('0x9')](_0xa1c2('0xf'),auth[_0xa1c2('0xd')](),controller['getMessages']);router[_0xa1c2('0x9')](_0xa1c2('0x10'),auth['isAuthenticated'](),controller[_0xa1c2('0x11')]);router[_0xa1c2('0x12')]('/',auth[_0xa1c2('0xd')](),controller['create']);router[_0xa1c2('0x12')](_0xa1c2('0xf'),auth[_0xa1c2('0xd')](),controller[_0xa1c2('0x13')]);router['post'](_0xa1c2('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0xa1c2('0x15'),_0xa1c2('0x16')),controller[_0xa1c2('0x17')]);router[_0xa1c2('0x18')](_0xa1c2('0x19'),auth[_0xa1c2('0xd')](),interaction['tracked'](_0xa1c2('0x15'),_0xa1c2('0x1a')),controller[_0xa1c2('0x1b')]);router[_0xa1c2('0x1c')](_0xa1c2('0x19'),auth[_0xa1c2('0xd')](),interaction[_0xa1c2('0x1d')](_0xa1c2('0x15'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xa1c2('0x1c')](_0xa1c2('0x14'),auth[_0xa1c2('0xd')](),controller['removeTags']);module[_0xa1c2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 2b8655d..7a203d8 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 _0x34eb=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x3d8d0a,_0x11bb87){var _0x5b9df5=function(_0x3ecba2){while(--_0x3ecba2){_0x3d8d0a['push'](_0x3d8d0a['shift']());}};_0x5b9df5(++_0x11bb87);}(_0x34eb,0x180));var _0xb34e=function(_0x5b95d5,_0x1cb420){_0x5b95d5=_0x5b95d5-0x0;var _0x4bda68=_0x34eb[_0x5b95d5];return _0x4bda68;};'use strict';var Sequelize=require(_0xb34e('0x0'));module[_0xb34e('0x1')]={'closed':{'type':Sequelize[_0xb34e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb34e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb34e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb34e('0x4')]},'read1stAt':{'type':Sequelize[_0xb34e('0x3')]},'threadId':{'type':Sequelize[_0xb34e('0x4')]},'externalUrl':{'type':Sequelize[_0xb34e('0x4')]},'lastMsgAt':{'type':Sequelize[_0xb34e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb34e('0x5')]('in',_0xb34e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe66d=['out','sequelize','exports','DATE','STRING'];(function(_0x56a6f1,_0x581b82){var _0x4cebed=function(_0x3c94c1){while(--_0x3c94c1){_0x56a6f1['push'](_0x56a6f1['shift']());}};_0x4cebed(++_0x581b82);}(_0xe66d,0x14b));var _0xde66=function(_0x49b9ef,_0x55547f){_0x49b9ef=_0x49b9ef-0x0;var _0x4de813=_0xe66d[_0x49b9ef];return _0x4de813;};'use strict';var Sequelize=require(_0xde66('0x0'));module[_0xde66('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xde66('0x2')]},'disposition':{'type':Sequelize[_0xde66('0x3')]},'secondDisposition':{'type':Sequelize[_0xde66('0x3')]},'thirdDisposition':{'type':Sequelize[_0xde66('0x3')]},'note':{'type':Sequelize[_0xde66('0x3')]},'read1stAt':{'type':Sequelize[_0xde66('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xde66('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xde66('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xde66('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 12fc424..9bb73d5 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 _0x1d52=['i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','length','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','rows','params','rawAttributes','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','format','transcript-%d-%s.zip','User','CmContact','firstName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','Public','Private','basename','existsSync','pipe','createWriteStream','out','System','lastName','direction','downloadInteraction.html','log','sendStatus','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','fullname','Tags','split','push','TagIds','catch','OpenchannelInteraction','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','select','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','some','compact','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric'];(function(_0x1a450c,_0xdec617){var _0x5b68a7=function(_0x3814e0){while(--_0x3814e0){_0x1a450c['push'](_0x1a450c['shift']());}};_0x5b68a7(++_0xdec617);}(_0x1d52,0x6b));var _0x21d5=function(_0x539e28,_0x8f2deb){_0x539e28=_0x539e28-0x0;var _0x10bcd4=_0x1d52[_0x539e28];return _0x10bcd4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21d5('0x0'));var rimraf=require(_0x21d5('0x1'));var zipdir=require(_0x21d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21d5('0x3'));var moment=require('moment');var BPromise=require(_0x21d5('0x4'));var Mustache=require(_0x21d5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x21d5('0x6'));var csv=require(_0x21d5('0x7'));var ejs=require(_0x21d5('0x8'));var fs=require('fs');var _=require(_0x21d5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21d5('0xa'));var deskjs=require(_0x21d5('0xb'));var toCsv=require(_0x21d5('0x7'));var querystring=require(_0x21d5('0xc'));var Papa=require(_0x21d5('0xd'));var Redis=require(_0x21d5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x21d5('0xf'));var as=require(_0x21d5('0x10'));var hardwareService=require(_0x21d5('0x11'));var logger=require(_0x21d5('0x12'))(_0x21d5('0x13'));var utils=require(_0x21d5('0x14'));var config=require(_0x21d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x21d5('0x16'))['db'];config['redis']=_[_0x21d5('0x17')](config[_0x21d5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x21d5('0x19'))(new Redis(config['redis']));require(_0x21d5('0x1a'))[_0x21d5('0x1b')](socket);function respondWithStatusCode(_0x454f8d,_0x36cb24){_0x36cb24=_0x36cb24||0xcc;return function(_0x2d84a0){if(_0x2d84a0){return _0x454f8d['sendStatus'](_0x36cb24);}return _0x454f8d[_0x21d5('0x1c')](_0x36cb24)[_0x21d5('0x1d')]();};}function respondWithResult(_0x10bd07,_0x4b6caa){_0x4b6caa=_0x4b6caa||0xc8;return function(_0x27763c){if(_0x27763c){return _0x10bd07['status'](_0x4b6caa)[_0x21d5('0x1e')](_0x27763c);}};}function respondWithFilteredResult(_0x3a811e,_0x5ae33b){return function(_0x562be8){if(_0x562be8){var _0x21c0b7=_0x562be8[_0x21d5('0x1f')],_0x1449a8=_0x5ae33b[_0x21d5('0x20')],_0x330043=_0x5ae33b[_0x21d5('0x20')]+_0x5ae33b[_0x21d5('0x21')],_0x1c47c5;if(_0x330043>=_0x21c0b7){_0x330043=_0x21c0b7;_0x1c47c5=0xc8;}else{_0x1c47c5=0xce;}_0x3a811e['status'](_0x1c47c5);return _0x3a811e[_0x21d5('0x22')](_0x21d5('0x23'),_0x1449a8+'-'+_0x330043+'/'+_0x21c0b7)[_0x21d5('0x1e')](_0x562be8);}return null;};}function patchUpdates(_0x5d4c8e){return function(_0x40dbd6){try{jsonpatch[_0x21d5('0x24')](_0x40dbd6,_0x5d4c8e,!![]);}catch(_0x473155){return BPromise[_0x21d5('0x25')](_0x473155);}return _0x40dbd6['save']();};}function saveUpdates(_0x2ea358,_0x70a36e){return function(_0x46080e){if(_0x46080e){return _0x46080e[_0x21d5('0x26')](_0x2ea358)[_0x21d5('0x27')](function(_0x4e5217){return _0x4e5217;});}return null;};}function removeEntity(_0x490cb4,_0x3356c4){return function(_0x3fe9d6){if(_0x3fe9d6){return _0x3fe9d6[_0x21d5('0x28')]()[_0x21d5('0x27')](function(){_0x490cb4[_0x21d5('0x1c')](0xcc)[_0x21d5('0x1d')]();});}};}function handleEntityNotFound(_0x1957fb,_0x3e6a7a){return function(_0x25992e){if(!_0x25992e){_0x1957fb['sendStatus'](0x194);}return _0x25992e;};}function handleError(_0x128850,_0x49906a){_0x49906a=_0x49906a||0x1f4;return function(_0x465292){logger[_0x21d5('0x29')](_0x465292[_0x21d5('0x2a')]);if(_0x465292[_0x21d5('0x2b')]){delete _0x465292[_0x21d5('0x2b')];}_0x128850[_0x21d5('0x1c')](_0x49906a)[_0x21d5('0x2c')](_0x465292);};}function getInteractionUsers(_0x5bf542,_0x2f11f3){return new BPromise(function(_0x5b8c1b,_0x10f612){try{if(_0x2f11f3[_0x5bf542['id']]){_0x5bf542['Users']=_['map'](_0x2f11f3[_0x5bf542['id']],function(_0x523437){return{'id':_0x523437['id'],'fullname':_0x523437[_0x21d5('0x2d')]};});}}catch(_0x44135c){_0x10f612(_0x44135c);}_0x5b8c1b(_0x5bf542);});}function getInteractionTags(_0x43db36,_0x4dda4a){return new BPromise(function(_0x2b6abb,_0x4aa9eb){try{if(_0x43db36['TagIds']){_0x43db36[_0x21d5('0x2e')]=[];_0x43db36['TagIds'][_0x21d5('0x2f')](',')['forEach'](function(_0x59e2f8){_0x43db36[_0x21d5('0x2e')][_0x21d5('0x30')](_0x4dda4a[_0x59e2f8]);});}delete _0x43db36[_0x21d5('0x31')];}catch(_0x41287b){_0x4aa9eb(_0x41287b);}_0x2b6abb(_0x43db36);});}function updateOpenchannelInteraction(_0xd43fd5,_0x3547fa,_0x233a54){return new BPromise(function(_0xe7a138,_0x48a38){return getInteractionUsers(_0xd43fd5,_0x233a54)[_0x21d5('0x27')](function(_0x49b3ac){return getInteractionTags(_0x49b3ac,_0x3547fa);})[_0x21d5('0x27')](function(_0x51d845){_0xe7a138(_0x51d845);})[_0x21d5('0x32')](function(_0x5cfee6){_0x48a38(_0x5cfee6);});});}exports['index']=function(_0x469dde,_0x68e1b0){var _0x4fef76={},_0x4edbc5={},_0x3ef882={'count':0x0,'rows':[]};var _0x157044=_['map'](db[_0x21d5('0x33')]['rawAttributes'],function(_0x54f1a4){return{'name':_0x54f1a4[_0x21d5('0x34')],'type':_0x54f1a4['type'][_0x21d5('0x35')]};});_0x4edbc5[_0x21d5('0x36')]=_[_0x21d5('0x37')](_0x157044,_0x21d5('0x2b'));_0x4edbc5['query']=_[_0x21d5('0x38')](_0x469dde[_0x21d5('0x39')]);_0x4edbc5[_0x21d5('0x3a')]=_[_0x21d5('0x3b')](_0x4edbc5[_0x21d5('0x36')],_0x4edbc5['query']);_0x4fef76[_0x21d5('0x3c')]=_[_0x21d5('0x3b')](_0x4edbc5[_0x21d5('0x36')],qs[_0x21d5('0x3d')](_0x469dde['query'][_0x21d5('0x3d')]));_0x4fef76[_0x21d5('0x3c')]=_0x4fef76[_0x21d5('0x3c')]['length']?_0x4fef76['attributes']:_0x4edbc5['model'];if(!_0x469dde[_0x21d5('0x39')][_0x21d5('0x3e')](_0x21d5('0x3f'))){_0x4fef76[_0x21d5('0x21')]=qs[_0x21d5('0x21')](_0x469dde[_0x21d5('0x39')][_0x21d5('0x21')]);_0x4fef76[_0x21d5('0x20')]=qs[_0x21d5('0x20')](_0x469dde[_0x21d5('0x39')][_0x21d5('0x20')]);}_0x4fef76['order']=qs['sort'](_0x469dde[_0x21d5('0x39')][_0x21d5('0x40')]);_0x4fef76['where']=qs[_0x21d5('0x3a')](_['pick'](_0x469dde[_0x21d5('0x39')],_0x4edbc5[_0x21d5('0x3a')]),_0x157044);var _0x5bf36d=[];var _0x1b0c31=squel[_0x21d5('0x41')]()[_0x21d5('0x42')]('id')[_0x21d5('0x42')](_0x21d5('0x2b'))[_0x21d5('0x42')](_0x21d5('0x43'))[_0x21d5('0x44')]('tools_tags');var _0x30e333=squel[_0x21d5('0x41')]()[_0x21d5('0x42')](_0x21d5('0x45'))[_0x21d5('0x42')]('u.fullname')[_0x21d5('0x42')](_0x21d5('0x46'))['from'](_0x21d5('0x47'),'ui')[_0x21d5('0x48')](_0x21d5('0x49'),'u',_0x21d5('0x4a'));var _0xf3dc97=squel[_0x21d5('0x41')]()[_0x21d5('0x44')](_0x21d5('0x4b'),'i')[_0x21d5('0x48')](_0x21d5('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x21d5('0x48')](_0x21d5('0x49'),'o',_0x21d5('0x4d'))[_0x21d5('0x48')](_0x21d5('0x4e'),'a',_0x21d5('0x4f'))[_0x21d5('0x48')](_0x21d5('0x50'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join']('openchannel_interaction_has_tags','it',_0x21d5('0x51'))['left_join']('tools_tags','t',_0x21d5('0x52'));var _0x44d135=squel[_0x21d5('0x53')]();var _0x2ef4be=[];var _0x46bfc7=squel[_0x21d5('0x53')]();var _0x419974;if(_0x469dde[_0x21d5('0x39')][_0x21d5('0x54')]){_0x419974=as[_0x21d5('0x55')](_0x469dde[_0x21d5('0x39')][_0x21d5('0x54')]);var _0x4b7b3d=_0x419974[_0x21d5('0x56')];for(var _0x37b574=0x0;_0x37b574<_0x419974[_0x21d5('0x57')]['length'];_0x37b574++){var _0x4d10a5=_0x419974[_0x21d5('0x57')][_0x37b574];var _0x520dcf='i';var _0x5b8801=_['find'](_0x157044,[_0x21d5('0x2b'),_0x4d10a5[_0x21d5('0x42')]]);if(!_0x5b8801){switch(_0x4d10a5[_0x21d5('0x42')]){case _0x21d5('0x58'):if(_0x4d10a5[_0x21d5('0x59')]==0x1){_0xf3dc97['having']('`'+_0x4d10a5[_0x21d5('0x42')]+_0x21d5('0x5a'));}else{_0xf3dc97[_0x21d5('0x5b')]('`'+_0x4d10a5['field']+_0x21d5('0x5c'));}break;case _0x21d5('0x5d'):if(_0x4d10a5['operator']==='$substring'){if(_0x4d10a5[_0x21d5('0x59')][_0x21d5('0x2f')]('\x20')['length']>0x1){_0x44d135[_0x4b7b3d](_0x21d5('0x5e'),qs[_0x21d5('0x5f')](_0x4d10a5[_0x21d5('0x59')]),null);}else{var _0x442346='%'+_0x4d10a5['value']+'%';_0x44d135[_0x4b7b3d](_0x21d5('0x60'),_0x442346,_0x442346,_0x442346);}}else{_0x5b8801=_['find'](_0x157044,[_0x21d5('0x2b'),_0x21d5('0x61')]);_0x4d10a5[_0x21d5('0x42')]=_0x21d5('0x61');_0x2d96e9=as[_0x21d5('0x62')](_0x520dcf,_0x5b8801[_0x21d5('0x63')],_0x4d10a5);_0x44d135[_0x4b7b3d](_0x2d96e9[_0x21d5('0x64')],_0x2d96e9[_0x21d5('0x59')][_0x21d5('0x65')],_0x2d96e9[_0x21d5('0x59')][_0x21d5('0x1d')]);}break;case'Tag':var _0x418da0=_0x4d10a5[_0x21d5('0x59')][_0x21d5('0x2f')](',')[_0x21d5('0x37')](function(_0x141902){return Number(_0x141902);});_0x418da0[_0x21d5('0x66')](function(_0x2c4fd1){_0x46bfc7['or'](_0x21d5('0x67'),'%,'+_0x2c4fd1+',%');});_0x2ef4be=_['union'](_0x2ef4be,_0x418da0);break;case'User':if(_0x4d10a5['operator']==='$substring'){_0x44d135[_0x4b7b3d](_0x21d5('0x68'),'%'+_0x4d10a5[_0x21d5('0x59')]+'%',null);}else{_0x5b8801=_[_0x21d5('0x69')](_0x157044,[_0x21d5('0x2b'),_0x21d5('0x6a')]);_0x4d10a5['field']='UserId';_0x2d96e9=as[_0x21d5('0x62')](_0x520dcf,_0x5b8801[_0x21d5('0x63')],_0x4d10a5);_0x44d135[_0x4b7b3d](_0x2d96e9[_0x21d5('0x64')],_0x2d96e9[_0x21d5('0x59')][_0x21d5('0x65')],_0x2d96e9[_0x21d5('0x59')][_0x21d5('0x1d')]);}break;case _0x21d5('0x6b'):_0x2d96e9=as[_0x21d5('0x62')]('me',null,_0x4d10a5);_0x44d135[_0x4b7b3d](_0x2d96e9[_0x21d5('0x64')],_0x2d96e9[_0x21d5('0x59')][_0x21d5('0x65')],_0x2d96e9[_0x21d5('0x59')]['end']);break;}}else{var _0x2d96e9=as['buildExpression'](_0x520dcf,_0x5b8801[_0x21d5('0x63')],_0x4d10a5);_0x44d135[_0x4b7b3d](_0x2d96e9['text'],_0x2d96e9[_0x21d5('0x59')]['start'],_0x2d96e9['value'][_0x21d5('0x1d')]);}}}else{var _0xac38fb=_(_0x469dde[_0x21d5('0x39')])['keys']()['map'](function(_0x1e7ea4){return _[_0x21d5('0x6c')](_0x157044,['name',_0x1e7ea4])?_0x1e7ea4:undefined;})[_0x21d5('0x6d')]()[_0x21d5('0x59')]();if(!_['isEmpty'](_0xac38fb)){_0xac38fb[_0x21d5('0x66')](function(_0x2e4d49){if(_0x2e4d49===_0x21d5('0x6e')){_0xf3dc97[_0x21d5('0x6f')](_0x21d5('0x70'),[][_0x21d5('0x71')](_0x469dde[_0x21d5('0x39')][_0x2e4d49]));}else if(_0x2e4d49===_0x21d5('0x72')){var _0x4cce79=JSON[_0x21d5('0x73')](_0x469dde['query'][_0x2e4d49])['$gte'];var _0x1a0af6=JSON['parse'](_0x469dde['query'][_0x2e4d49])[_0x21d5('0x74')];_0xf3dc97['where'](_0x21d5('0x75'),_0x4cce79,_0x1a0af6);}else{if(_0x469dde['query'][_0x2e4d49]===_0x21d5('0x76')){_0xf3dc97[_0x21d5('0x6f')]('i.'+_0x2e4d49+_0x21d5('0x77'));}else{_0xf3dc97[_0x21d5('0x6f')]('i.'+_0x2e4d49+'\x20=\x20?',_0x469dde[_0x21d5('0x39')][_0x2e4d49]);}}});}if(_0x469dde[_0x21d5('0x39')]['read']){if(_0x469dde[_0x21d5('0x39')]['read']==0x1){_0xf3dc97[_0x21d5('0x5b')](_0x21d5('0x78'));}else{_0xf3dc97[_0x21d5('0x5b')](_0x21d5('0x79'));}}if(_0x469dde[_0x21d5('0x39')][_0x21d5('0x7a')]){_0x2ef4be=_[_0x21d5('0x7b')](_0x469dde[_0x21d5('0x39')]['tag'])?_0x469dde[_0x21d5('0x39')][_0x21d5('0x7a')]:new Array(_0x469dde[_0x21d5('0x39')][_0x21d5('0x7a')]);_0x2ef4be[_0x21d5('0x66')](function(_0x5a1e76){_0x46bfc7['or'](_0x21d5('0x67'),'%,'+_0x5a1e76+',%');});}if(_0x469dde['query'][_0x21d5('0x7c')]){var _0x4d9129=_0x469dde[_0x21d5('0x39')][_0x21d5('0x7c')][_0x21d5('0x7d')]('\x5c','\x5c\x5c')[_0x21d5('0x7d')](/'/g,'\x27\x27');if(qs[_0x21d5('0x7e')](_0x4d9129)){_0x44d135['or'](_0x21d5('0x7f'),_0x4d9129+'%');}else{_0x44d135['or'](_0x21d5('0x80'),qs[_0x21d5('0x5f')](_0x4d9129))['or']('i.from\x20LIKE\x20?',_0x4d9129+'%')['or'](_0x21d5('0x81'),_0x4d9129+'%');}}}_0xf3dc97[_0x21d5('0x6f')](_0x44d135);_0xf3dc97[_0x21d5('0x82')](_0x21d5('0x83'));var _0x5a15f7={'type':db[_0x21d5('0x84')][_0x21d5('0x85')]['SELECT'],'raw':!![]};var _0xf74beb=_0xf3dc97['clone']();_0xf74beb[_0x21d5('0x42')]('i.id');_0xf74beb[_0x21d5('0x42')](_0x21d5('0x86'),'unreadMessages');if(_0x4fef76['order']){_0x4fef76[_0x21d5('0x87')][_0x21d5('0x66')](function(_0x3757d3){var _0x463f45=_0x3757d3[0x0]==='contactName'?_0x3757d3[0x0]:'i.'+_0x3757d3[0x0];_0xf3dc97['order'](_0x463f45,_0x3757d3[0x1]===_0x21d5('0x88')?![]:!![]);});}if(!_[_0x21d5('0x89')](_0x2ef4be)){_0xf3dc97['having'](_0x46bfc7);_0xf74beb[_0x21d5('0x6f')](_0x21d5('0x8a'),_0x2ef4be);}BPromise[_0x21d5('0x8b')]()[_0x21d5('0x27')](function(){if(!_0x419974){if(_0x469dde[_0x21d5('0x39')]['OpenchannelAccountId'])return;_0xf74beb['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0xf3dc97['where'](_0x21d5('0x8c'));return;}if(_0x469dde[_0x21d5('0x8d')][_0x21d5('0x8e')]!=='agent')return;return _0x469dde['user'][_0x21d5('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x236598){if(_[_0x21d5('0x89')](_0x236598)){_0xf74beb[_0x21d5('0x6f')](_0x21d5('0x90'));_0xf3dc97['where'](_0x21d5('0x90'));}else{_0xf74beb[_0x21d5('0x6f')](_0x21d5('0x70'),_[_0x21d5('0x37')](_0x236598,'id'));_0xf3dc97[_0x21d5('0x6f')](_0x21d5('0x70'),_['map'](_0x236598,'id'));}});})[_0x21d5('0x27')](function(){if(_0x469dde[_0x21d5('0x8d')][_0x21d5('0x8e')]===_0x21d5('0x91')&&!_0x419974&&!_0x469dde[_0x21d5('0x39')][_0x21d5('0x6e')])return[];return db['sequelize']['query'](_0xf74beb['toString'](),_0x5a15f7);})[_0x21d5('0x27')](function(_0x4848e2){_0x3ef882[_0x21d5('0x1f')]=_0x4848e2[_0x21d5('0x92')];if(_0x3ef882[_0x21d5('0x1f')]===0x0)return[];return db[_0x21d5('0x93')]['query'](_0x1b0c31[_0x21d5('0x94')](),_0x5a15f7)[_0x21d5('0x27')](function(_0x2ec602){_0x5bf36d=_[_0x21d5('0x95')](_0x2ec602,'id');_0x5a15f7=_[_0x21d5('0x96')](_0x5a15f7,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x469dde['query'][_0x21d5('0x3d')]){_0x4fef76[_0x21d5('0x3c')]['forEach'](function(_0x24d978){_0xf3dc97['field']('i.'+_0x24d978);});}else{_0xf3dc97['field'](_0x21d5('0x86'),_0x21d5('0x58'));_0xf3dc97[_0x21d5('0x42')](_0x21d5('0x97'),_0x21d5('0x98'));_0xf3dc97[_0x21d5('0x42')](_0x21d5('0x99'),_0x21d5('0x9a'));_0xf3dc97[_0x21d5('0x42')](_0x21d5('0x9b'),_0x21d5('0x9c'));_0xf3dc97[_0x21d5('0x42')]('i.*');_0xf3dc97[_0x21d5('0x42')](_0x21d5('0x9d'),_0x21d5('0x9e'));_0xf3dc97[_0x21d5('0x42')]('c.lastName',_0x21d5('0x9f'));_0xf3dc97[_0x21d5('0x42')](_0x21d5('0xa0'),_0x21d5('0xa1'));_0xf3dc97[_0x21d5('0x42')]('c.phone','Contact.phone');_0xf3dc97[_0x21d5('0x42')]('c.mobile',_0x21d5('0xa2'));_0xf3dc97[_0x21d5('0x42')](_0x21d5('0xa3'),'Contact.fax');_0xf3dc97['field']('o.fullname',_0x21d5('0xa4'));_0xf3dc97[_0x21d5('0x42')](_0x21d5('0xa5'),_0x21d5('0xa6'));_0xf3dc97['field'](_0x21d5('0xa7'),_0x21d5('0x31'));}if(_0x4fef76[_0x21d5('0x21')])_0xf3dc97[_0x21d5('0x21')](_0x4fef76['limit']);if(_0x4fef76[_0x21d5('0x20')])_0xf3dc97['offset'](_0x4fef76[_0x21d5('0x20')]);return db[_0x21d5('0x93')]['query'](_0xf3dc97['toString'](),_0x5a15f7);})[_0x21d5('0x27')](function(_0x5e1143){_0x30e333[_0x21d5('0x6f')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x21d5('0x37')](_0x5e1143,'id'));return db[_0x21d5('0x93')]['query'](_0x30e333[_0x21d5('0x94')](),_0x5a15f7)['then'](function(_0x3848f6){var _0x50ba6d=_['groupBy'](_0x3848f6,_0x21d5('0xa8'));var _0x45ca54=[];_0x5e1143['forEach'](function(_0x690c0b){_0x45ca54[_0x21d5('0x30')](updateOpenchannelInteraction(_0x690c0b,_0x5bf36d,_0x50ba6d));});return BPromise['all'](_0x45ca54);});});})[_0x21d5('0x27')](function(_0x198664){_0x3ef882[_0x21d5('0xa9')]=_0x198664;return _0x3ef882;})[_0x21d5('0x27')](respondWithFilteredResult(_0x68e1b0,_0x4fef76))['catch'](handleError(_0x68e1b0,null));};exports['show']=function(_0x2ae030,_0x31efab){var _0x4a80c7={};if(_0x2ae030['query']['type']&&_0x2ae030[_0x21d5('0x39')][_0x21d5('0x63')]===_0x21d5('0x44')){_0x4a80c7[_0x21d5('0x44')]=_0x2ae030[_0x21d5('0xaa')]['id'];}else{_0x4a80c7['id']=_0x2ae030[_0x21d5('0xaa')]['id'];}var _0x263f8b={'raw':![],'where':_0x4a80c7},_0x5eabbd={};_0x5eabbd[_0x21d5('0x36')]=_[_0x21d5('0x38')](db['OpenchannelInteraction'][_0x21d5('0xab')]);_0x5eabbd[_0x21d5('0x39')]=_[_0x21d5('0x38')](_0x2ae030[_0x21d5('0x39')]);_0x5eabbd[_0x21d5('0x3a')]=_[_0x21d5('0x3b')](_0x5eabbd[_0x21d5('0x36')],_0x5eabbd['query']);_0x263f8b['attributes']=_[_0x21d5('0x3b')](_0x5eabbd[_0x21d5('0x36')],qs[_0x21d5('0x3d')](_0x2ae030[_0x21d5('0x39')]['fields']));_0x263f8b[_0x21d5('0x3c')]=_0x263f8b[_0x21d5('0x3c')][_0x21d5('0x92')]?_0x263f8b[_0x21d5('0x3c')]:_0x5eabbd['model'];if(_0x2ae030[_0x21d5('0x39')][_0x21d5('0xac')]){_0x263f8b[_0x21d5('0xad')]=[{'all':!![]}];}_0x263f8b=_[_0x21d5('0x96')]({},_0x263f8b,_0x2ae030[_0x21d5('0xae')]);return db[_0x21d5('0x33')]['find'](_0x263f8b)[_0x21d5('0x27')](handleEntityNotFound(_0x31efab,null))[_0x21d5('0x27')](respondWithResult(_0x31efab,null))['catch'](handleError(_0x31efab,null));};exports[_0x21d5('0xaf')]=function(_0x1ca887,_0x2921c0){return db[_0x21d5('0x33')][_0x21d5('0xaf')](_0x1ca887[_0x21d5('0x6b')],{})[_0x21d5('0x27')](respondWithResult(_0x2921c0,0xc9))['catch'](handleError(_0x2921c0,null));};exports['update']=function(_0x3dcafd,_0x55d88c){if(_0x3dcafd[_0x21d5('0x6b')]['id']){delete _0x3dcafd[_0x21d5('0x6b')]['id'];}return db[_0x21d5('0x33')][_0x21d5('0x69')]({'where':{'id':_0x3dcafd[_0x21d5('0xaa')]['id']}})[_0x21d5('0x27')](handleEntityNotFound(_0x55d88c,null))[_0x21d5('0x27')](saveUpdates(_0x3dcafd['body'],null))[_0x21d5('0x27')](respondWithResult(_0x55d88c,null))[_0x21d5('0x32')](handleError(_0x55d88c,null));};exports[_0x21d5('0x28')]=function(_0x29512f,_0x373159){return db['OpenchannelInteraction'][_0x21d5('0x69')]({'where':{'id':_0x29512f[_0x21d5('0xaa')]['id']}})[_0x21d5('0x27')](handleEntityNotFound(_0x373159,null))[_0x21d5('0x27')](removeEntity(_0x373159,null))[_0x21d5('0x32')](handleError(_0x373159,null));};exports['describe']=function(_0x411aea,_0x3ac9c9){return db['OpenchannelInteraction'][_0x21d5('0xb0')]()[_0x21d5('0x27')](respondWithResult(_0x3ac9c9,null))['catch'](handleError(_0x3ac9c9,null));};exports[_0x21d5('0xb1')]=function(_0x477a73,_0x189d6e,_0x412d3a){return db[_0x21d5('0xb2')][_0x21d5('0x69')]({'where':{'id':_0x477a73['params']['id']}})[_0x21d5('0x27')](handleEntityNotFound(_0x189d6e,null))['then'](function(_0x180826){if(_0x180826){return _0x180826['addMessage'](_0x477a73[_0x21d5('0x6b')][_0x21d5('0xb3')],_[_0x21d5('0xb4')](_0x477a73[_0x21d5('0x6b')],[_0x21d5('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x189d6e,null))[_0x21d5('0x32')](handleError(_0x189d6e,null));};exports['getMessages']=function(_0x419206,_0x2377f3,_0x2e0794){var _0x2ec50b={'raw':![],'where':{}};var _0x165b30={};var _0x258643={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x21d5('0xb5')]({'where':{'id':_0x419206[_0x21d5('0xaa')]['id']}})[_0x21d5('0x27')](handleEntityNotFound(_0x2377f3,null))[_0x21d5('0x27')](function(_0x535bd6){if(_0x535bd6){_0x165b30[_0x21d5('0x36')]=_[_0x21d5('0x38')](db[_0x21d5('0xb2')][_0x21d5('0xab')]);_0x165b30[_0x21d5('0x39')]=_[_0x21d5('0x38')](_0x419206['query']);_0x165b30['filters']=_[_0x21d5('0x3b')](_0x165b30['model'],_0x165b30['query']);_0x2ec50b[_0x21d5('0x3c')]=_[_0x21d5('0x3b')](_0x165b30[_0x21d5('0x36')],qs['fields'](_0x419206[_0x21d5('0x39')][_0x21d5('0x3d')]));_0x2ec50b[_0x21d5('0x3c')]=_0x2ec50b[_0x21d5('0x3c')]['length']?_0x2ec50b[_0x21d5('0x3c')]:_0x165b30[_0x21d5('0x36')];if(!_0x419206[_0x21d5('0x39')][_0x21d5('0x3e')](_0x21d5('0x3f'))){_0x2ec50b[_0x21d5('0x21')]=qs[_0x21d5('0x21')](_0x419206[_0x21d5('0x39')][_0x21d5('0x21')]);_0x2ec50b['offset']=qs[_0x21d5('0x20')](_0x419206['query']['offset']);}_0x2ec50b[_0x21d5('0x87')]=qs[_0x21d5('0x40')](_0x419206[_0x21d5('0x39')]['sort']);_0x2ec50b[_0x21d5('0x6f')]=qs['filters'](_[_0x21d5('0xb6')](_0x419206['query'],_0x165b30[_0x21d5('0x3a')]));_0x2ec50b[_0x21d5('0x6f')][_0x21d5('0xa8')]=_0x535bd6['id'];if(_0x419206[_0x21d5('0x39')][_0x21d5('0x7c')]){_0x2ec50b[_0x21d5('0x6f')]=_[_0x21d5('0x96')](_0x2ec50b[_0x21d5('0x6f')],{'$or':_['map'](_0x2ec50b[_0x21d5('0x3c')],function(_0x378a86){var _0x4211b2={};_0x4211b2[_0x378a86]={'$like':'%'+_0x419206[_0x21d5('0x39')]['filter']+'%'};return _0x4211b2;})});}if(_0x419206[_0x21d5('0x39')][_0x21d5('0xb7')]){var _0x56a95a=_0x419206[_0x21d5('0x39')]['$gte']['split'](',');var _0x279942={};_0x279942[_0x56a95a[0x0]]={'$gte':moment(_0x56a95a[0x1])['format'](_0x21d5('0xb8'))};_0x2ec50b[_0x21d5('0x6f')]=_[_0x21d5('0x96')](_0x2ec50b['where'],_0x279942);}_0x2ec50b=_[_0x21d5('0x96')]({},_0x2ec50b,_0x419206[_0x21d5('0xae')]);return db[_0x21d5('0xb2')]['count']({'where':_0x2ec50b['where']})['then'](function(_0x57514f){_0x258643[_0x21d5('0x1f')]=_0x57514f;if(_0x419206[_0x21d5('0x39')]['includeAll']){_0x2ec50b[_0x21d5('0xad')]=[{'all':!![]}];}return db[_0x21d5('0xb2')]['findAll'](_0x2ec50b);})[_0x21d5('0x27')](function(_0x305405){_0x258643['rows']=_0x305405;return _0x258643;});}})[_0x21d5('0x27')](respondWithFilteredResult(_0x2377f3,_0x2ec50b))[_0x21d5('0x32')](handleError(_0x2377f3,null));};exports['addTags']=function(_0x3d2fa7,_0x297c05,_0x1e7e9b){return db[_0x21d5('0x33')][_0x21d5('0x69')]({'where':{'id':_0x3d2fa7[_0x21d5('0xaa')]['id']}})['then'](handleEntityNotFound(_0x297c05,null))[_0x21d5('0x27')](function(_0x2f028e){if(_0x2f028e){return _0x2f028e[_0x21d5('0xb9')](_0x3d2fa7[_0x21d5('0x6b')]['ids'],_[_0x21d5('0xb4')](_0x3d2fa7[_0x21d5('0x6b')],['ids','id'])||{})[_0x21d5('0xba')](function(){return db[_0x21d5('0xbb')][_0x21d5('0xbc')]({'attributes':['id','name','color'],'where':{'id':_0x3d2fa7[_0x21d5('0x6b')][_0x21d5('0xb3')]}});})['then'](function(_0x9963ef){socket[_0x21d5('0xbd')](_0x21d5('0xbe'),{'id':Number(_0x3d2fa7['params']['id']),'tags':_0x9963ef||[]});return{'id':Number(_0x3d2fa7['params']['id']),'tags':_0x9963ef||[]};});}})[_0x21d5('0x27')](respondWithResult(_0x297c05,null))[_0x21d5('0x32')](handleError(_0x297c05,null));};exports[_0x21d5('0xbf')]=function(_0x1253c7,_0x248ebe,_0x1754d8){return db[_0x21d5('0x33')][_0x21d5('0x69')]({'where':{'id':_0x1253c7['params']['id']}})['then'](handleEntityNotFound(_0x248ebe,null))['then'](function(_0x2d4873){if(_0x2d4873){return _0x2d4873[_0x21d5('0xbf')](_0x1253c7[_0x21d5('0x39')]['ids']);}})[_0x21d5('0x27')](respondWithStatusCode(_0x248ebe,null))[_0x21d5('0x32')](handleError(_0x248ebe,null));};exports[_0x21d5('0xc0')]=function(_0x90c947,_0x34d55c){var _0x983303=moment()[_0x21d5('0xc1')]()[_0x21d5('0x94')]();var _0x2237d7=path[_0x21d5('0xc2')](config['root'],_0x21d5('0xc3'),_0x21d5('0xc4'),_0x21d5('0xc5'));var _0xe6f619=path['join'](config[_0x21d5('0xc6')],_0x21d5('0xc3'),_0x21d5('0xc4'),'attachments');var _0x44a92f=path['join'](_0x2237d7,_0x983303);var _0x441a77=util[_0x21d5('0xc7')](_0x21d5('0xc8'),_0x90c947['params']['id'],_0x983303);var _0x51f2b0=path[_0x21d5('0xc2')](_0x2237d7,_0x441a77);var _0x5d2969=[];_0x5d2969['push']({'model':db[_0x21d5('0xc9')],'as':_0x21d5('0xc9'),'attributes':['id',_0x21d5('0x2d')],'raw':!![]});_0x5d2969[_0x21d5('0x30')]({'model':db[_0x21d5('0xca')],'as':_0x21d5('0x5d'),'attributes':['id',_0x21d5('0xcb'),'lastName'],'raw':!![]});if(_0x90c947[_0x21d5('0x39')]['attachments']){_0x5d2969[_0x21d5('0x30')]({'model':db[_0x21d5('0xcc')],'as':_0x21d5('0xcc'),'raw':!![]});}var _0x17ba41=[{'model':db[_0x21d5('0xb2')],'as':_0x21d5('0xcd'),'attributes':['id',_0x21d5('0x6b'),_0x21d5('0x72'),'direction',_0x21d5('0xce'),'read'],'include':_0x5d2969}];_0x17ba41[_0x21d5('0x30')]({'model':db[_0x21d5('0xcf')],'as':_0x21d5('0xd0'),'attributes':['id',_0x21d5('0x2b')]});_0x17ba41[_0x21d5('0x30')]({'model':db[_0x21d5('0xc9')],'as':_0x21d5('0xd1'),'attributes':['id',_0x21d5('0x2d')]});return db['OpenchannelInteraction'][_0x21d5('0x69')]({'where':{'id':_0x90c947['params']['id']},'include':_0x17ba41})[_0x21d5('0x27')](handleEntityNotFound(_0x34d55c,null))[_0x21d5('0x27')](function(_0x2a67dc){if(_0x2a67dc){var _0x6ac30c=_0x2a67dc['get']({'plain':!![]});fs[_0x21d5('0xd2')](_0x44a92f);var _0x4355de={'format':'A4','border':_0x21d5('0xd3'),'header':{'height':_0x21d5('0xd4'),'contents':{'first':_0x21d5('0xd5')}},'footer':{'height':_0x21d5('0xd6'),'contents':{'default':util['format'](_0x21d5('0xd7'),util[_0x21d5('0xc7')](_0x21d5('0xd8'),_0x21d5('0xd9'),_0x6ac30c['id']),moment()[_0x21d5('0xc7')](_0x21d5('0xda'))[_0x21d5('0x94')]())}}};var _0x5ddc2f={'channel':_0x21d5('0xd9'),'account':_0x6ac30c[_0x21d5('0xd0')]['name'],'agent':_0x6ac30c[_0x21d5('0xd1')]?_0x6ac30c[_0x21d5('0xd1')][_0x21d5('0x2d')]:_0x21d5('0xdb'),'createdAt':moment(_0x6ac30c[_0x21d5('0x72')])[_0x21d5('0xc7')](_0x21d5('0xb8'))[_0x21d5('0x94')](),'closedAt':_0x6ac30c[_0x21d5('0xdc')]?moment(_0x6ac30c['closedAt'])[_0x21d5('0xc7')](_0x21d5('0xb8'))[_0x21d5('0x94')]():'','disposition':_0x6ac30c['disposition'],'visibility':_0x6ac30c['threadId']?_0x21d5('0xdd'):_0x21d5('0xde'),'messages':_(_0x6ac30c[_0x21d5('0xcd')])[_0x21d5('0x7c')]({'secret':![]})[_0x21d5('0x37')](function(_0x4b7975){if(_0x4b7975[_0x21d5('0xcc')]){var _0x5ae040=path[_0x21d5('0xc2')](_0xe6f619,_0x4b7975['Attachment'][_0x21d5('0xdf')]);if(fs[_0x21d5('0xe0')](_0x5ae040)){fs['createReadStream'](_0x5ae040)[_0x21d5('0xe1')](fs[_0x21d5('0xe2')](path['join'](_0x44a92f,_0x4b7975['Attachment']['basename'])));}}return{'date':moment(_0x4b7975[_0x21d5('0x72')])[_0x21d5('0xc7')](_0x21d5('0xb8'))['toString'](),'sender':_0x4b7975['direction']===_0x21d5('0xe3')?_0x4b7975[_0x21d5('0xc9')]?_0x4b7975[_0x21d5('0xc9')][_0x21d5('0x2d')]:_0x21d5('0xe4'):_0x4b7975[_0x21d5('0x5d')]['firstName']+(_0x4b7975[_0x21d5('0x5d')][_0x21d5('0xe5')]?'\x20'+_0x4b7975[_0x21d5('0x5d')][_0x21d5('0xe5')]:''),'body':_0x4b7975[_0x21d5('0xcc')]?_0x4b7975[_0x21d5('0xcc')][_0x21d5('0xdf')]:_0x4b7975[_0x21d5('0x6b')],'direction':_0x4b7975[_0x21d5('0xe6')]==='out'?'A':'C','secret':_0x4b7975[_0x21d5('0xce')],'read':_0x4b7975['read'],'attachment':_0x4b7975['Attachment']};})[_0x21d5('0x59')]()};return ejs['renderFile'](path[_0x21d5('0xc2')](config[_0x21d5('0xc6')],_0x21d5('0xc3'),'views',_0x21d5('0xe7')),{'interaction':_0x5ddc2f})['then'](function(_0x5c07da){return new BPromise(function(_0x1f6cc2,_0x217b44){pdf['create'](_0x5c07da,_0x4355de)['toFile'](path[_0x21d5('0xc2')](_0x44a92f,'transcript-'+_0x6ac30c['id']+'-'+_0x983303+'.pdf'),function(_0x1d0108,_0xc2afe7){if(_0x1d0108)return _0x217b44(_0x1d0108);_0x1f6cc2(_0xc2afe7);});});})['then'](function(){return new BPromise(function(_0x249571,_0x8bcf44){zipdir(_0x44a92f,{'saveTo':_0x51f2b0},function(_0x34f72f,_0x1c0df8){if(_0x34f72f)return _0x8bcf44(_0x34f72f);return _0x249571(_0x1c0df8);});})[_0x21d5('0x27')](function(){return new BPromise(function(_0x59da6a,_0x2f4b10){rimraf(_0x44a92f,function(_0xfa68d5){if(_0xfa68d5)_0x2f4b10(_0xfa68d5);return _0x59da6a();});});})[_0x21d5('0x27')](function(){return _0x34d55c['download'](_0x51f2b0,_0x441a77,function(_0x53ac42){if(_0x53ac42){console[_0x21d5('0xe8')]('err',_0x53ac42);}else{fs['unlinkSync'](_0x51f2b0);}});});});}else{return _0x34d55c[_0x21d5('0xe9')](0xc8);}})['catch'](handleError(_0x34d55c,null));}; \ No newline at end of file +var _0x3b76=['reject','save','then','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','where','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','sequelize','count','toString','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','keys','includeAll','include','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','User','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','Private','basename','pipe','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x3b76,0x1b1));var _0x63b7=function(_0x470018,_0x3ea184){_0x470018=_0x470018-0x0;var _0x28954d=_0x3b76[_0x470018];return _0x28954d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x63b7('0x0'));var zipdir=require(_0x63b7('0x1'));var jsonpatch=require(_0x63b7('0x2'));var rp=require(_0x63b7('0x3'));var moment=require(_0x63b7('0x4'));var BPromise=require(_0x63b7('0x5'));var Mustache=require('mustache');var util=require(_0x63b7('0x6'));var path=require(_0x63b7('0x7'));var sox=require(_0x63b7('0x8'));var csv=require(_0x63b7('0x9'));var ejs=require(_0x63b7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x63b7('0xb'));var crypto=require(_0x63b7('0xc'));var jsforce=require(_0x63b7('0xd'));var deskjs=require(_0x63b7('0xe'));var toCsv=require(_0x63b7('0x9'));var querystring=require(_0x63b7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x63b7('0x10'));var qs=require(_0x63b7('0x11'));var as=require(_0x63b7('0x12'));var hardwareService=require(_0x63b7('0x13'));var logger=require(_0x63b7('0x14'))(_0x63b7('0x15'));var utils=require(_0x63b7('0x16'));var config=require(_0x63b7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x63b7('0x18'))['db'];config[_0x63b7('0x19')]=_[_0x63b7('0x1a')](config[_0x63b7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x63b7('0x1b'))(new Redis(config['redis']));require(_0x63b7('0x1c'))[_0x63b7('0x1d')](socket);function respondWithStatusCode(_0x3144f6,_0x485696){_0x485696=_0x485696||0xcc;return function(_0x4a5c84){if(_0x4a5c84){return _0x3144f6[_0x63b7('0x1e')](_0x485696);}return _0x3144f6['status'](_0x485696)[_0x63b7('0x1f')]();};}function respondWithResult(_0x3dab06,_0x108820){_0x108820=_0x108820||0xc8;return function(_0x283a87){if(_0x283a87){return _0x3dab06[_0x63b7('0x20')](_0x108820)[_0x63b7('0x21')](_0x283a87);}};}function respondWithFilteredResult(_0x5ad27e,_0xe2800){return function(_0x4141e7){if(_0x4141e7){var _0x3e21d4=_0x4141e7['count'],_0x18a4ac=_0xe2800['offset'],_0x53cc08=_0xe2800[_0x63b7('0x22')]+_0xe2800[_0x63b7('0x23')],_0x22991e;if(_0x53cc08>=_0x3e21d4){_0x53cc08=_0x3e21d4;_0x22991e=0xc8;}else{_0x22991e=0xce;}_0x5ad27e[_0x63b7('0x20')](_0x22991e);return _0x5ad27e[_0x63b7('0x24')](_0x63b7('0x25'),_0x18a4ac+'-'+_0x53cc08+'/'+_0x3e21d4)[_0x63b7('0x21')](_0x4141e7);}return null;};}function patchUpdates(_0x56a435){return function(_0x370fd1){try{jsonpatch[_0x63b7('0x26')](_0x370fd1,_0x56a435,!![]);}catch(_0x547462){return BPromise[_0x63b7('0x27')](_0x547462);}return _0x370fd1[_0x63b7('0x28')]();};}function saveUpdates(_0xd91e80,_0x5173a8){return function(_0xfff8dd){if(_0xfff8dd){return _0xfff8dd['update'](_0xd91e80)[_0x63b7('0x29')](function(_0x20cacb){return _0x20cacb;});}return null;};}function removeEntity(_0x23b622,_0x320a10){return function(_0x5e584e){if(_0x5e584e){return _0x5e584e['destroy']()[_0x63b7('0x29')](function(){_0x23b622[_0x63b7('0x20')](0xcc)[_0x63b7('0x1f')]();});}};}function handleEntityNotFound(_0x5c0422,_0x4d889b){return function(_0x304ada){if(!_0x304ada){_0x5c0422[_0x63b7('0x1e')](0x194);}return _0x304ada;};}function handleError(_0x34238f,_0x1431ec){_0x1431ec=_0x1431ec||0x1f4;return function(_0x37e3d0){logger[_0x63b7('0x2a')](_0x37e3d0[_0x63b7('0x2b')]);if(_0x37e3d0[_0x63b7('0x2c')]){delete _0x37e3d0[_0x63b7('0x2c')];}_0x34238f[_0x63b7('0x20')](_0x1431ec)[_0x63b7('0x2d')](_0x37e3d0);};}function getInteractionUsers(_0x1e9ee3,_0x477bdb){return new BPromise(function(_0x2d687b,_0x33fb3e){try{if(_0x477bdb[_0x1e9ee3['id']]){_0x1e9ee3['Users']=_[_0x63b7('0x2e')](_0x477bdb[_0x1e9ee3['id']],function(_0x14346b){return{'id':_0x14346b['id'],'fullname':_0x14346b[_0x63b7('0x2f')]};});}}catch(_0x1d0033){_0x33fb3e(_0x1d0033);}_0x2d687b(_0x1e9ee3);});}function getInteractionTags(_0x44fd9f,_0x4a7b89){return new BPromise(function(_0x3d246d,_0x2be398){try{if(_0x44fd9f[_0x63b7('0x30')]){_0x44fd9f[_0x63b7('0x31')]=[];_0x44fd9f[_0x63b7('0x30')]['split'](',')[_0x63b7('0x32')](function(_0x3722c0){_0x44fd9f[_0x63b7('0x31')][_0x63b7('0x33')](_0x4a7b89[_0x3722c0]);});}delete _0x44fd9f['TagIds'];}catch(_0x58ea42){_0x2be398(_0x58ea42);}_0x3d246d(_0x44fd9f);});}function updateOpenchannelInteraction(_0x39c717,_0x1044a7,_0x1b1ac9){return new BPromise(function(_0x2b2e21,_0x18f894){return getInteractionUsers(_0x39c717,_0x1b1ac9)[_0x63b7('0x29')](function(_0x406d78){return getInteractionTags(_0x406d78,_0x1044a7);})[_0x63b7('0x29')](function(_0x2d0a53){_0x2b2e21(_0x2d0a53);})['catch'](function(_0x54b946){_0x18f894(_0x54b946);});});}exports['index']=function(_0x5e3cd4,_0x2f099a){var _0x66c06f={},_0x4629cb={},_0xe90ecc={'count':0x0,'rows':[]};var _0x34c0c2=_[_0x63b7('0x2e')](db[_0x63b7('0x34')][_0x63b7('0x35')],function(_0x2108b4){return{'name':_0x2108b4[_0x63b7('0x36')],'type':_0x2108b4[_0x63b7('0x37')]['key']};});_0x4629cb[_0x63b7('0x38')]=_[_0x63b7('0x2e')](_0x34c0c2,_0x63b7('0x2c'));_0x4629cb[_0x63b7('0x39')]=_['keys'](_0x5e3cd4[_0x63b7('0x39')]);_0x4629cb['filters']=_[_0x63b7('0x3a')](_0x4629cb['model'],_0x4629cb[_0x63b7('0x39')]);_0x66c06f[_0x63b7('0x3b')]=_[_0x63b7('0x3a')](_0x4629cb['model'],qs[_0x63b7('0x3c')](_0x5e3cd4['query'][_0x63b7('0x3c')]));_0x66c06f[_0x63b7('0x3b')]=_0x66c06f[_0x63b7('0x3b')][_0x63b7('0x3d')]?_0x66c06f['attributes']:_0x4629cb[_0x63b7('0x38')];if(!_0x5e3cd4['query'][_0x63b7('0x3e')](_0x63b7('0x3f'))){_0x66c06f[_0x63b7('0x23')]=qs[_0x63b7('0x23')](_0x5e3cd4['query'][_0x63b7('0x23')]);_0x66c06f[_0x63b7('0x22')]=qs[_0x63b7('0x22')](_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x22')]);}_0x66c06f[_0x63b7('0x40')]=qs['sort'](_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x41')]);_0x66c06f['where']=qs[_0x63b7('0x42')](_[_0x63b7('0x43')](_0x5e3cd4['query'],_0x4629cb[_0x63b7('0x42')]),_0x34c0c2);var _0x23a373=[];var _0x29ea1d=squel[_0x63b7('0x44')]()['field']('id')[_0x63b7('0x45')](_0x63b7('0x2c'))[_0x63b7('0x45')]('color')[_0x63b7('0x46')](_0x63b7('0x47'));var _0x5c631c=squel[_0x63b7('0x44')]()[_0x63b7('0x45')](_0x63b7('0x48'))['field']('u.fullname')[_0x63b7('0x45')]('ui.OpenchannelInteractionId')[_0x63b7('0x46')](_0x63b7('0x49'),'ui')[_0x63b7('0x4a')]('users','u',_0x63b7('0x4b'));var _0x3820c7=squel[_0x63b7('0x44')]()[_0x63b7('0x46')](_0x63b7('0x4c'),'i')[_0x63b7('0x4a')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x63b7('0x4a')](_0x63b7('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x63b7('0x4a')](_0x63b7('0x4e'),'a',_0x63b7('0x4f'))[_0x63b7('0x4a')](_0x63b7('0x50'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x63b7('0x4a')](_0x63b7('0x51'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x63b7('0x4a')](_0x63b7('0x47'),'t','t.id\x20=\x20it.TagId');var _0x1605d8=squel[_0x63b7('0x52')]();var _0x4cf915=[];var _0x56408e=squel['expr']();var _0x5b7a9e;if(_0x5e3cd4['query'][_0x63b7('0x53')]){_0x5b7a9e=as[_0x63b7('0x54')](_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x53')]);var _0xcc2f41=_0x5b7a9e[_0x63b7('0x55')];for(var _0x265716=0x0;_0x265716<_0x5b7a9e[_0x63b7('0x56')][_0x63b7('0x3d')];_0x265716++){var _0x231c32=_0x5b7a9e[_0x63b7('0x56')][_0x265716];var _0x2cad13='i';var _0x358730=_['find'](_0x34c0c2,['name',_0x231c32[_0x63b7('0x45')]]);if(!_0x358730){switch(_0x231c32[_0x63b7('0x45')]){case'unreadMessages':if(_0x231c32[_0x63b7('0x57')]==0x1){_0x3820c7[_0x63b7('0x58')]('`'+_0x231c32[_0x63b7('0x45')]+_0x63b7('0x59'));}else{_0x3820c7['having']('`'+_0x231c32['field']+_0x63b7('0x5a'));}break;case _0x63b7('0x5b'):if(_0x231c32[_0x63b7('0x5c')]==='$substring'){if(_0x231c32[_0x63b7('0x57')][_0x63b7('0x5d')]('\x20')[_0x63b7('0x3d')]>0x1){_0x1605d8[_0xcc2f41](_0x63b7('0x5e'),qs['getFullTextValue'](_0x231c32['value']),null);}else{var _0x5ef38c='%'+_0x231c32[_0x63b7('0x57')]+'%';_0x1605d8[_0xcc2f41]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5ef38c,_0x5ef38c,_0x5ef38c);}}else{_0x358730=_[_0x63b7('0x5f')](_0x34c0c2,[_0x63b7('0x2c'),_0x63b7('0x60')]);_0x231c32[_0x63b7('0x45')]=_0x63b7('0x60');_0x5d108f=as[_0x63b7('0x61')](_0x2cad13,_0x358730[_0x63b7('0x37')],_0x231c32);_0x1605d8[_0xcc2f41](_0x5d108f[_0x63b7('0x62')],_0x5d108f[_0x63b7('0x57')][_0x63b7('0x63')],_0x5d108f['value'][_0x63b7('0x1f')]);}break;case'Tag':var _0x57e216=_0x231c32['value'][_0x63b7('0x5d')](',')[_0x63b7('0x2e')](function(_0x10034d){return Number(_0x10034d);});_0x57e216[_0x63b7('0x32')](function(_0x4b8dad){_0x56408e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b8dad+',%');});_0x4cf915=_[_0x63b7('0x64')](_0x4cf915,_0x57e216);break;case'User':if(_0x231c32[_0x63b7('0x5c')]===_0x63b7('0x65')){_0x1605d8[_0xcc2f41](_0x63b7('0x66'),'%'+_0x231c32[_0x63b7('0x57')]+'%',null);}else{_0x358730=_[_0x63b7('0x5f')](_0x34c0c2,[_0x63b7('0x2c'),_0x63b7('0x67')]);_0x231c32[_0x63b7('0x45')]=_0x63b7('0x67');_0x5d108f=as[_0x63b7('0x61')](_0x2cad13,_0x358730[_0x63b7('0x37')],_0x231c32);_0x1605d8[_0xcc2f41](_0x5d108f[_0x63b7('0x62')],_0x5d108f[_0x63b7('0x57')][_0x63b7('0x63')],_0x5d108f[_0x63b7('0x57')][_0x63b7('0x1f')]);}break;case'body':_0x5d108f=as['buildExpression']('me',null,_0x231c32);_0x1605d8[_0xcc2f41](_0x5d108f[_0x63b7('0x62')],_0x5d108f[_0x63b7('0x57')][_0x63b7('0x63')],_0x5d108f['value'][_0x63b7('0x1f')]);break;}}else{var _0x5d108f=as[_0x63b7('0x61')](_0x2cad13,_0x358730[_0x63b7('0x37')],_0x231c32);_0x1605d8[_0xcc2f41](_0x5d108f[_0x63b7('0x62')],_0x5d108f[_0x63b7('0x57')][_0x63b7('0x63')],_0x5d108f['value'][_0x63b7('0x1f')]);}}}else{var _0x1915fb=_(_0x5e3cd4[_0x63b7('0x39')])['keys']()[_0x63b7('0x2e')](function(_0x3be967){return _[_0x63b7('0x68')](_0x34c0c2,[_0x63b7('0x2c'),_0x3be967])?_0x3be967:undefined;})[_0x63b7('0x69')]()['value']();if(!_[_0x63b7('0x6a')](_0x1915fb)){_0x1915fb[_0x63b7('0x32')](function(_0x10c919){if(_0x10c919===_0x63b7('0x6b')){_0x3820c7['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x63b7('0x6c')](_0x5e3cd4[_0x63b7('0x39')][_0x10c919]));}else if(_0x10c919==='createdAt'){var _0x2cfd42=JSON[_0x63b7('0x6d')](_0x5e3cd4[_0x63b7('0x39')][_0x10c919])[_0x63b7('0x6e')];var _0xaa4e25=JSON['parse'](_0x5e3cd4[_0x63b7('0x39')][_0x10c919])[_0x63b7('0x6f')];_0x3820c7[_0x63b7('0x70')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2cfd42,_0xaa4e25);}else{if(_0x5e3cd4[_0x63b7('0x39')][_0x10c919]==='null'){_0x3820c7[_0x63b7('0x70')]('i.'+_0x10c919+_0x63b7('0x71'));}else{_0x3820c7['where']('i.'+_0x10c919+'\x20=\x20?',_0x5e3cd4[_0x63b7('0x39')][_0x10c919]);}}});}if(_0x5e3cd4[_0x63b7('0x39')]['read']){if(_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x72')]==0x1){_0x3820c7[_0x63b7('0x58')](_0x63b7('0x73'));}else{_0x3820c7[_0x63b7('0x58')](_0x63b7('0x74'));}}if(_0x5e3cd4[_0x63b7('0x39')]['tag']){_0x4cf915=_['isArray'](_0x5e3cd4['query'][_0x63b7('0x75')])?_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x75')]:new Array(_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x75')]);_0x4cf915[_0x63b7('0x32')](function(_0x7ee0c4){_0x56408e['or'](_0x63b7('0x76'),'%,'+_0x7ee0c4+',%');});}if(_0x5e3cd4[_0x63b7('0x39')]['filter']){var _0x50a4f7=_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x77')]['replace']('\x5c','\x5c\x5c')[_0x63b7('0x78')](/'/g,'\x27\x27');if(qs[_0x63b7('0x79')](_0x50a4f7)){_0x1605d8['or'](_0x63b7('0x7a'),_0x50a4f7+'%');}else{_0x1605d8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x50a4f7))['or'](_0x63b7('0x7b'),_0x50a4f7+'%')['or'](_0x63b7('0x7c'),_0x50a4f7+'%');}}}_0x3820c7[_0x63b7('0x70')](_0x1605d8);_0x3820c7['group'](_0x63b7('0x7d'));var _0x29fe9f={'type':db['Sequelize'][_0x63b7('0x7e')][_0x63b7('0x7f')],'raw':!![]};var _0x37f535=_0x3820c7[_0x63b7('0x80')]();_0x37f535[_0x63b7('0x45')]('i.id');_0x37f535[_0x63b7('0x45')](_0x63b7('0x81'),'unreadMessages');if(_0x66c06f['order']){_0x66c06f[_0x63b7('0x40')][_0x63b7('0x32')](function(_0x486635){var _0x5874e2=_0x486635[0x0]===_0x63b7('0x82')?_0x486635[0x0]:'i.'+_0x486635[0x0];_0x3820c7['order'](_0x5874e2,_0x486635[0x1]===_0x63b7('0x83')?![]:!![]);});}if(!_[_0x63b7('0x6a')](_0x4cf915)){_0x3820c7[_0x63b7('0x58')](_0x56408e);_0x37f535[_0x63b7('0x70')](_0x63b7('0x84'),_0x4cf915);}BPromise[_0x63b7('0x85')]()[_0x63b7('0x29')](function(){if(!_0x5b7a9e){if(_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x6b')])return;_0x37f535[_0x63b7('0x70')](_0x63b7('0x86'));_0x3820c7[_0x63b7('0x70')](_0x63b7('0x86'));return;}if(_0x5e3cd4[_0x63b7('0x87')]['role']!==_0x63b7('0x88'))return;return _0x5e3cd4[_0x63b7('0x87')][_0x63b7('0x89')]({'attributes':['id'],'raw':!![]})[_0x63b7('0x29')](function(_0x23e904){if(_[_0x63b7('0x6a')](_0x23e904)){_0x37f535[_0x63b7('0x70')](_0x63b7('0x8a'));_0x3820c7['where'](_0x63b7('0x8a'));}else{_0x37f535[_0x63b7('0x70')](_0x63b7('0x8b'),_['map'](_0x23e904,'id'));_0x3820c7['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x63b7('0x2e')](_0x23e904,'id'));}});})[_0x63b7('0x29')](function(){if(_0x5e3cd4['user'][_0x63b7('0x8c')]===_0x63b7('0x88')&&!_0x5b7a9e&&!_0x5e3cd4[_0x63b7('0x39')][_0x63b7('0x6b')])return[];return db[_0x63b7('0x8d')][_0x63b7('0x39')](_0x37f535['toString'](),_0x29fe9f);})[_0x63b7('0x29')](function(_0x4d1814){_0xe90ecc[_0x63b7('0x8e')]=_0x4d1814[_0x63b7('0x3d')];if(_0xe90ecc[_0x63b7('0x8e')]===0x0)return[];return db[_0x63b7('0x8d')][_0x63b7('0x39')](_0x29ea1d[_0x63b7('0x8f')](),_0x29fe9f)[_0x63b7('0x29')](function(_0xe2eaa8){_0x23a373=_['keyBy'](_0xe2eaa8,'id');_0x29fe9f=_[_0x63b7('0x90')](_0x29fe9f,{'model':db[_0x63b7('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e3cd4['query']['fields']){_0x66c06f[_0x63b7('0x3b')]['forEach'](function(_0x158ef4){_0x3820c7['field']('i.'+_0x158ef4);});}else{_0x3820c7[_0x63b7('0x45')](_0x63b7('0x81'),_0x63b7('0x91'));_0x3820c7[_0x63b7('0x45')]('a.key',_0x63b7('0x92'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0x93'),_0x63b7('0x94'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0x95'),'contactName');_0x3820c7[_0x63b7('0x45')](_0x63b7('0x96'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0x97'),_0x63b7('0x98'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0x99'),_0x63b7('0x9a'));_0x3820c7[_0x63b7('0x45')]('c.email',_0x63b7('0x9b'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0x9c'),_0x63b7('0x9d'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0x9e'),_0x63b7('0x9f'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0xa0'),_0x63b7('0xa1'));_0x3820c7[_0x63b7('0x45')]('o.fullname',_0x63b7('0xa2'));_0x3820c7[_0x63b7('0x45')](_0x63b7('0xa3'),_0x63b7('0xa4'));_0x3820c7['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x63b7('0x30'));}if(_0x66c06f[_0x63b7('0x23')])_0x3820c7[_0x63b7('0x23')](_0x66c06f[_0x63b7('0x23')]);if(_0x66c06f[_0x63b7('0x22')])_0x3820c7[_0x63b7('0x22')](_0x66c06f[_0x63b7('0x22')]);return db[_0x63b7('0x8d')][_0x63b7('0x39')](_0x3820c7[_0x63b7('0x8f')](),_0x29fe9f);})['then'](function(_0x166cf5){_0x5c631c['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x63b7('0x2e')](_0x166cf5,'id'));return db[_0x63b7('0x8d')][_0x63b7('0x39')](_0x5c631c['toString'](),_0x29fe9f)['then'](function(_0x7012b0){var _0x182b9d=_[_0x63b7('0xa5')](_0x7012b0,_0x63b7('0xa6'));var _0x5bc1a4=[];_0x166cf5['forEach'](function(_0x5e6e5f){_0x5bc1a4[_0x63b7('0x33')](updateOpenchannelInteraction(_0x5e6e5f,_0x23a373,_0x182b9d));});return BPromise[_0x63b7('0xa7')](_0x5bc1a4);});});})['then'](function(_0x4f31ca){_0xe90ecc[_0x63b7('0xa8')]=_0x4f31ca;return _0xe90ecc;})[_0x63b7('0x29')](respondWithFilteredResult(_0x2f099a,_0x66c06f))[_0x63b7('0xa9')](handleError(_0x2f099a,null));};exports[_0x63b7('0xaa')]=function(_0x4a2a78,_0x303848){var _0x1c8f10={};if(_0x4a2a78['query'][_0x63b7('0x37')]&&_0x4a2a78[_0x63b7('0x39')]['type']==='from'){_0x1c8f10[_0x63b7('0x46')]=_0x4a2a78[_0x63b7('0xab')]['id'];}else{_0x1c8f10['id']=_0x4a2a78[_0x63b7('0xab')]['id'];}var _0x32fc8a={'raw':![],'where':_0x1c8f10},_0x30b7e8={};_0x30b7e8[_0x63b7('0x38')]=_['keys'](db[_0x63b7('0x34')][_0x63b7('0x35')]);_0x30b7e8[_0x63b7('0x39')]=_[_0x63b7('0xac')](_0x4a2a78[_0x63b7('0x39')]);_0x30b7e8[_0x63b7('0x42')]=_[_0x63b7('0x3a')](_0x30b7e8[_0x63b7('0x38')],_0x30b7e8[_0x63b7('0x39')]);_0x32fc8a['attributes']=_[_0x63b7('0x3a')](_0x30b7e8[_0x63b7('0x38')],qs[_0x63b7('0x3c')](_0x4a2a78[_0x63b7('0x39')][_0x63b7('0x3c')]));_0x32fc8a[_0x63b7('0x3b')]=_0x32fc8a['attributes'][_0x63b7('0x3d')]?_0x32fc8a[_0x63b7('0x3b')]:_0x30b7e8[_0x63b7('0x38')];if(_0x4a2a78[_0x63b7('0x39')][_0x63b7('0xad')]){_0x32fc8a[_0x63b7('0xae')]=[{'all':!![]}];}_0x32fc8a=_[_0x63b7('0x90')]({},_0x32fc8a,_0x4a2a78['options']);return db[_0x63b7('0x34')]['find'](_0x32fc8a)['then'](handleEntityNotFound(_0x303848,null))[_0x63b7('0x29')](respondWithResult(_0x303848,null))[_0x63b7('0xa9')](handleError(_0x303848,null));};exports[_0x63b7('0xaf')]=function(_0x54841f,_0x3342ae){return db[_0x63b7('0x34')][_0x63b7('0xaf')](_0x54841f[_0x63b7('0xb0')],{})['then'](respondWithResult(_0x3342ae,0xc9))['catch'](handleError(_0x3342ae,null));};exports[_0x63b7('0xb1')]=function(_0x28d6cd,_0x598f8e){if(_0x28d6cd[_0x63b7('0xb0')]['id']){delete _0x28d6cd[_0x63b7('0xb0')]['id'];}return db[_0x63b7('0x34')][_0x63b7('0x5f')]({'where':{'id':_0x28d6cd[_0x63b7('0xab')]['id']}})[_0x63b7('0x29')](handleEntityNotFound(_0x598f8e,null))[_0x63b7('0x29')](saveUpdates(_0x28d6cd[_0x63b7('0xb0')],null))[_0x63b7('0x29')](respondWithResult(_0x598f8e,null))[_0x63b7('0xa9')](handleError(_0x598f8e,null));};exports['destroy']=function(_0x3efd36,_0x38c5d9){return db[_0x63b7('0x34')]['find']({'where':{'id':_0x3efd36[_0x63b7('0xab')]['id']}})[_0x63b7('0x29')](handleEntityNotFound(_0x38c5d9,null))['then'](removeEntity(_0x38c5d9,null))['catch'](handleError(_0x38c5d9,null));};exports[_0x63b7('0xb2')]=function(_0xb0d98c,_0x5c303f){return db[_0x63b7('0x34')]['describe']()[_0x63b7('0x29')](respondWithResult(_0x5c303f,null))['catch'](handleError(_0x5c303f,null));};exports[_0x63b7('0xb3')]=function(_0x331345,_0x4d3f93,_0x110754){return db[_0x63b7('0xb4')]['find']({'where':{'id':_0x331345[_0x63b7('0xab')]['id']}})[_0x63b7('0x29')](handleEntityNotFound(_0x4d3f93,null))[_0x63b7('0x29')](function(_0x5adb6a){if(_0x5adb6a){return _0x5adb6a[_0x63b7('0xb3')](_0x331345[_0x63b7('0xb0')][_0x63b7('0xb5')],_[_0x63b7('0xb6')](_0x331345[_0x63b7('0xb0')],[_0x63b7('0xb5'),'id'])||{});}})[_0x63b7('0x29')](respondWithResult(_0x4d3f93,null))['catch'](handleError(_0x4d3f93,null));};exports[_0x63b7('0xb7')]=function(_0x4ed2ba,_0x3be1f6,_0x2c9420){var _0x5d43cc={'raw':![],'where':{}};var _0x130e4a={};var _0x258955={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x63b7('0xb8')]({'where':{'id':_0x4ed2ba[_0x63b7('0xab')]['id']}})[_0x63b7('0x29')](handleEntityNotFound(_0x3be1f6,null))[_0x63b7('0x29')](function(_0x41d507){if(_0x41d507){_0x130e4a[_0x63b7('0x38')]=_[_0x63b7('0xac')](db[_0x63b7('0xb4')][_0x63b7('0x35')]);_0x130e4a['query']=_[_0x63b7('0xac')](_0x4ed2ba[_0x63b7('0x39')]);_0x130e4a[_0x63b7('0x42')]=_[_0x63b7('0x3a')](_0x130e4a[_0x63b7('0x38')],_0x130e4a[_0x63b7('0x39')]);_0x5d43cc[_0x63b7('0x3b')]=_[_0x63b7('0x3a')](_0x130e4a[_0x63b7('0x38')],qs[_0x63b7('0x3c')](_0x4ed2ba[_0x63b7('0x39')]['fields']));_0x5d43cc[_0x63b7('0x3b')]=_0x5d43cc[_0x63b7('0x3b')][_0x63b7('0x3d')]?_0x5d43cc[_0x63b7('0x3b')]:_0x130e4a[_0x63b7('0x38')];if(!_0x4ed2ba[_0x63b7('0x39')][_0x63b7('0x3e')](_0x63b7('0x3f'))){_0x5d43cc[_0x63b7('0x23')]=qs[_0x63b7('0x23')](_0x4ed2ba[_0x63b7('0x39')][_0x63b7('0x23')]);_0x5d43cc[_0x63b7('0x22')]=qs[_0x63b7('0x22')](_0x4ed2ba['query']['offset']);}_0x5d43cc[_0x63b7('0x40')]=qs[_0x63b7('0x41')](_0x4ed2ba[_0x63b7('0x39')][_0x63b7('0x41')]);_0x5d43cc[_0x63b7('0x70')]=qs[_0x63b7('0x42')](_['pick'](_0x4ed2ba[_0x63b7('0x39')],_0x130e4a[_0x63b7('0x42')]));_0x5d43cc['where'][_0x63b7('0xa6')]=_0x41d507['id'];if(_0x4ed2ba[_0x63b7('0x39')][_0x63b7('0x77')]){_0x5d43cc[_0x63b7('0x70')]=_[_0x63b7('0x90')](_0x5d43cc[_0x63b7('0x70')],{'$or':_[_0x63b7('0x2e')](_0x5d43cc['attributes'],function(_0x450bac){var _0x9ad8ea={};_0x9ad8ea[_0x450bac]={'$like':'%'+_0x4ed2ba[_0x63b7('0x39')]['filter']+'%'};return _0x9ad8ea;})});}if(_0x4ed2ba[_0x63b7('0x39')][_0x63b7('0x6e')]){var _0x2444f2=_0x4ed2ba['query']['$gte'][_0x63b7('0x5d')](',');var _0x2116eb={};_0x2116eb[_0x2444f2[0x0]]={'$gte':moment(_0x2444f2[0x1])[_0x63b7('0xb9')](_0x63b7('0xba'))};_0x5d43cc[_0x63b7('0x70')]=_[_0x63b7('0x90')](_0x5d43cc[_0x63b7('0x70')],_0x2116eb);}_0x5d43cc=_[_0x63b7('0x90')]({},_0x5d43cc,_0x4ed2ba[_0x63b7('0xbb')]);return db['OpenchannelMessage'][_0x63b7('0x8e')]({'where':_0x5d43cc['where']})[_0x63b7('0x29')](function(_0x2ea4b6){_0x258955[_0x63b7('0x8e')]=_0x2ea4b6;if(_0x4ed2ba[_0x63b7('0x39')]['includeAll']){_0x5d43cc[_0x63b7('0xae')]=[{'all':!![]}];}return db[_0x63b7('0xb4')][_0x63b7('0xbc')](_0x5d43cc);})[_0x63b7('0x29')](function(_0x4fb6de){_0x258955[_0x63b7('0xa8')]=_0x4fb6de;return _0x258955;});}})[_0x63b7('0x29')](respondWithFilteredResult(_0x3be1f6,_0x5d43cc))[_0x63b7('0xa9')](handleError(_0x3be1f6,null));};exports[_0x63b7('0xbd')]=function(_0x419fab,_0x180878,_0x3603e3){return db[_0x63b7('0x34')][_0x63b7('0x5f')]({'where':{'id':_0x419fab['params']['id']}})[_0x63b7('0x29')](handleEntityNotFound(_0x180878,null))['then'](function(_0x1f8b2c){if(_0x1f8b2c){return _0x1f8b2c[_0x63b7('0xbe')](_0x419fab[_0x63b7('0xb0')][_0x63b7('0xb5')],_[_0x63b7('0xb6')](_0x419fab[_0x63b7('0xb0')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x63b7('0x2c'),_0x63b7('0xbf')],'where':{'id':_0x419fab[_0x63b7('0xb0')][_0x63b7('0xb5')]}});})['then'](function(_0xb750f1){socket[_0x63b7('0xc0')](_0x63b7('0xc1'),{'id':Number(_0x419fab[_0x63b7('0xab')]['id']),'tags':_0xb750f1||[]});return{'id':Number(_0x419fab[_0x63b7('0xab')]['id']),'tags':_0xb750f1||[]};});}})[_0x63b7('0x29')](respondWithResult(_0x180878,null))[_0x63b7('0xa9')](handleError(_0x180878,null));};exports[_0x63b7('0xc2')]=function(_0x37905c,_0x49c487,_0x5f84bb){return db[_0x63b7('0x34')][_0x63b7('0x5f')]({'where':{'id':_0x37905c[_0x63b7('0xab')]['id']}})[_0x63b7('0x29')](handleEntityNotFound(_0x49c487,null))['then'](function(_0x1a772f){if(_0x1a772f){return _0x1a772f[_0x63b7('0xc2')](_0x37905c[_0x63b7('0x39')]['ids']);}})[_0x63b7('0x29')](respondWithStatusCode(_0x49c487,null))[_0x63b7('0xa9')](handleError(_0x49c487,null));};exports[_0x63b7('0xc3')]=function(_0x238ac8,_0x17440f){var _0x1bb82c=moment()[_0x63b7('0xc4')]()[_0x63b7('0x8f')]();var _0x3bb955=path[_0x63b7('0xc5')](config[_0x63b7('0xc6')],_0x63b7('0xc7'),_0x63b7('0xc8'),_0x63b7('0xc9'));var _0x3e74d0=path[_0x63b7('0xc5')](config[_0x63b7('0xc6')],_0x63b7('0xc7'),_0x63b7('0xc8'),'attachments');var _0x1e77d7=path[_0x63b7('0xc5')](_0x3bb955,_0x1bb82c);var _0x358f3a=util[_0x63b7('0xb9')]('transcript-%d-%s.zip',_0x238ac8[_0x63b7('0xab')]['id'],_0x1bb82c);var _0x10452a=path[_0x63b7('0xc5')](_0x3bb955,_0x358f3a);var _0x56a310=[];_0x56a310[_0x63b7('0x33')]({'model':db[_0x63b7('0xca')],'as':_0x63b7('0xca'),'attributes':['id',_0x63b7('0x2f')],'raw':!![]});_0x56a310[_0x63b7('0x33')]({'model':db['CmContact'],'as':_0x63b7('0x5b'),'attributes':['id',_0x63b7('0xcb'),_0x63b7('0xcc')],'raw':!![]});if(_0x238ac8['query']['attachments']){_0x56a310[_0x63b7('0x33')]({'model':db['Attachment'],'as':_0x63b7('0xcd'),'raw':!![]});}var _0x7685e7=[{'model':db['OpenchannelMessage'],'as':_0x63b7('0xce'),'attributes':['id',_0x63b7('0xb0'),_0x63b7('0xcf'),_0x63b7('0xd0'),_0x63b7('0xd1'),_0x63b7('0x72')],'include':_0x56a310}];_0x7685e7['push']({'model':db[_0x63b7('0xd2')],'as':'Account','attributes':['id',_0x63b7('0x2c')]});_0x7685e7[_0x63b7('0x33')]({'model':db[_0x63b7('0xca')],'as':_0x63b7('0xd3'),'attributes':['id','fullname']});return db[_0x63b7('0x34')][_0x63b7('0x5f')]({'where':{'id':_0x238ac8['params']['id']},'include':_0x7685e7})[_0x63b7('0x29')](handleEntityNotFound(_0x17440f,null))[_0x63b7('0x29')](function(_0x10f1a0){if(_0x10f1a0){var _0x82efa2=_0x10f1a0[_0x63b7('0xd4')]({'plain':!![]});fs[_0x63b7('0xd5')](_0x1e77d7);var _0x39edcf={'format':'A4','border':_0x63b7('0xd6'),'header':{'height':_0x63b7('0xd7'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':'30px','contents':{'default':util[_0x63b7('0xb9')](_0x63b7('0xd8'),util[_0x63b7('0xb9')]('%s\x20#%d',_0x63b7('0xd9'),_0x82efa2['id']),moment()[_0x63b7('0xb9')](_0x63b7('0xda'))['toString']())}}};var _0x487cd7={'channel':_0x63b7('0xd9'),'account':_0x82efa2[_0x63b7('0xdb')]['name'],'agent':_0x82efa2[_0x63b7('0xd3')]?_0x82efa2[_0x63b7('0xd3')][_0x63b7('0x2f')]:_0x63b7('0xdc'),'createdAt':moment(_0x82efa2[_0x63b7('0xcf')])['format'](_0x63b7('0xba'))['toString'](),'closedAt':_0x82efa2[_0x63b7('0xdd')]?moment(_0x82efa2[_0x63b7('0xde')])[_0x63b7('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x63b7('0x8f')]():'','disposition':_0x82efa2[_0x63b7('0xdf')],'visibility':_0x82efa2['threadId']?'Public':_0x63b7('0xe0'),'messages':_(_0x82efa2[_0x63b7('0xce')])[_0x63b7('0x77')]({'secret':![]})[_0x63b7('0x2e')](function(_0x5e91c4){if(_0x5e91c4[_0x63b7('0xcd')]){var _0x202b42=path[_0x63b7('0xc5')](_0x3e74d0,_0x5e91c4[_0x63b7('0xcd')][_0x63b7('0xe1')]);if(fs['existsSync'](_0x202b42)){fs['createReadStream'](_0x202b42)[_0x63b7('0xe2')](fs['createWriteStream'](path[_0x63b7('0xc5')](_0x1e77d7,_0x5e91c4[_0x63b7('0xcd')][_0x63b7('0xe1')])));}}return{'date':moment(_0x5e91c4[_0x63b7('0xcf')])['format'](_0x63b7('0xba'))[_0x63b7('0x8f')](),'sender':_0x5e91c4[_0x63b7('0xd0')]==='out'?_0x5e91c4['User']?_0x5e91c4[_0x63b7('0xca')][_0x63b7('0x2f')]:_0x63b7('0xe3'):_0x5e91c4[_0x63b7('0x5b')][_0x63b7('0xcb')]+(_0x5e91c4[_0x63b7('0x5b')][_0x63b7('0xcc')]?'\x20'+_0x5e91c4[_0x63b7('0x5b')]['lastName']:''),'body':_0x5e91c4['Attachment']?_0x5e91c4[_0x63b7('0xcd')][_0x63b7('0xe1')]:_0x5e91c4[_0x63b7('0xb0')],'direction':_0x5e91c4[_0x63b7('0xd0')]==='out'?'A':'C','secret':_0x5e91c4['secret'],'read':_0x5e91c4[_0x63b7('0x72')],'attachment':_0x5e91c4[_0x63b7('0xcd')]};})['value']()};return ejs[_0x63b7('0xe4')](path[_0x63b7('0xc5')](config[_0x63b7('0xc6')],_0x63b7('0xc7'),'views',_0x63b7('0xe5')),{'interaction':_0x487cd7})[_0x63b7('0x29')](function(_0x359b74){return new BPromise(function(_0xb3cd6e,_0x3f5a0f){pdf[_0x63b7('0xaf')](_0x359b74,_0x39edcf)[_0x63b7('0xe6')](path['join'](_0x1e77d7,_0x63b7('0xe7')+_0x82efa2['id']+'-'+_0x1bb82c+_0x63b7('0xe8')),function(_0x506c15,_0x57951d){if(_0x506c15)return _0x3f5a0f(_0x506c15);_0xb3cd6e(_0x57951d);});});})['then'](function(){return new BPromise(function(_0x5ce7de,_0x5d281a){zipdir(_0x1e77d7,{'saveTo':_0x10452a},function(_0x4c11e2,_0x4fb890){if(_0x4c11e2)return _0x5d281a(_0x4c11e2);return _0x5ce7de(_0x4fb890);});})[_0x63b7('0x29')](function(){return new BPromise(function(_0x284c47,_0x3640de){rimraf(_0x1e77d7,function(_0x144568){if(_0x144568)_0x3640de(_0x144568);return _0x284c47();});});})[_0x63b7('0x29')](function(){return _0x17440f['download'](_0x10452a,_0x358f3a,function(_0x3e15bf){if(_0x3e15bf){console[_0x63b7('0xe9')](_0x63b7('0xea'),_0x3e15bf);}else{fs[_0x63b7('0xeb')](_0x10452a);}});});});}else{return _0x17440f[_0x63b7('0x1e')](0xc8);}})[_0x63b7('0xa9')](handleError(_0x17440f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0c65894..f427f35 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 _0x43f9=['setDataValue','Users','unreadMessages','length','hasOwnProperty','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x43f9,0xf7));var _0x943f=function(_0x2c3325,_0x305418){_0x2c3325=_0x2c3325-0x0;var _0x525546=_0x43f9[_0x2c3325];return _0x525546;};'use strict';var EventEmitter=require(_0x943f('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x943f('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x943f('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x943f('0x3')](0x0);var events={'afterCreate':_0x943f('0x4'),'afterUpdate':_0x943f('0x5'),'afterDestroy':_0x943f('0x6')};function emitEvent(_0x143f1a){return function(_0x27b59a,_0x1c8448,_0x55f535){_0x27b59a['getUsers']({'attributes':['id'],'raw':!![]})[_0x943f('0x7')](function(_0xc2a56f){_0x27b59a[_0x943f('0x8')](_0x943f('0x9'),_0xc2a56f['map'](function(_0x1bbc5f){return{'id':_0x1bbc5f['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x27b59a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x173277){_0x27b59a['setDataValue'](_0x943f('0xa'),_0x173277[_0x943f('0xb')]);OpenchannelInteractionEvents['emit'](_0x143f1a+':'+_0x27b59a['id'],_0x27b59a);OpenchannelInteractionEvents['emit'](_0x143f1a,_0x27b59a);_0x55f535(null);})['catch'](_0x55f535(null));};}for(var e in events){if(events[_0x943f('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x943f('0xd')](e,emitEvent(event));}}module[_0x943f('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x8429=['events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x589860,_0x206af2){var _0x16a8e9=function(_0x3d5508){while(--_0x3d5508){_0x589860['push'](_0x589860['shift']());}};_0x16a8e9(++_0x206af2);}(_0x8429,0xf7));var _0x9842=function(_0x68b05e,_0x33cd4f){_0x68b05e=_0x68b05e-0x0;var _0x461c60=_0x8429[_0x68b05e];return _0x461c60;};'use strict';var EventEmitter=require(_0x9842('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x9842('0x1')];var OpenchannelMessage=require(_0x9842('0x2'))['db'][_0x9842('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9842('0x4'),'afterUpdate':_0x9842('0x5'),'afterDestroy':_0x9842('0x6')};function emitEvent(_0x5a49bf){return function(_0x3f0b33,_0x257a19,_0x812ba){_0x3f0b33['getUsers']({'attributes':['id'],'raw':!![]})[_0x9842('0x7')](function(_0x20bdab){_0x3f0b33[_0x9842('0x8')](_0x9842('0x9'),_0x20bdab[_0x9842('0xa')](function(_0x13adb7){return{'id':_0x13adb7['id']};}));return OpenchannelMessage[_0x9842('0xb')]({'where':{'OpenchannelInteractionId':_0x3f0b33['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9842('0x7')](function(_0x36de6e){_0x3f0b33['setDataValue'](_0x9842('0xc'),_0x36de6e[_0x9842('0xd')]);OpenchannelInteractionEvents[_0x9842('0xe')](_0x5a49bf+':'+_0x3f0b33['id'],_0x3f0b33);OpenchannelInteractionEvents['emit'](_0x5a49bf,_0x3f0b33);_0x812ba(null);})[_0x9842('0xf')](_0x812ba(null));};}for(var e in events){if(events[_0x9842('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x9842('0x11')](e,emitEvent(event));}}module[_0x9842('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 6c12070..4e16e40 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 _0xe181=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt'];(function(_0x54c2fa,_0x2ca5d0){var _0x15ffd0=function(_0x522acc){while(--_0x522acc){_0x54c2fa['push'](_0x54c2fa['shift']());}};_0x15ffd0(++_0x2ca5d0);}(_0xe181,0x68));var _0x1e18=function(_0x3805e9,_0x33a4ed){_0x3805e9=_0x3805e9-0x0;var _0x207e20=_0xe181[_0x3805e9];return _0x207e20;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var logger=require(_0x1e18('0x1'))(_0x1e18('0x2'));var moment=require(_0x1e18('0x3'));var BPromise=require(_0x1e18('0x4'));var rp=require(_0x1e18('0x5'));var fs=require('fs');var path=require(_0x1e18('0x6'));var rimraf=require(_0x1e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e18('0x8'));module['exports']=function(_0x512343,_0x18fabb){return _0x512343[_0x1e18('0x9')](_0x1e18('0xa'),attributes,{'tableName':_0x1e18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9f9541,_0x398f77,_0x5e6cd3){if(_0x9f9541[_0x1e18('0xc')](_0x1e18('0xd'))){_0x9f9541[_0x1e18('0xe')]=moment()[_0x1e18('0xf')](_0x1e18('0x10'));}_0x5e6cd3(null,_0x9f9541);}}});}; \ No newline at end of file +var _0xafdd=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','closed','closedAt'];(function(_0x11e722,_0x1413c5){var _0x282979=function(_0x5d9128){while(--_0x5d9128){_0x11e722['push'](_0x11e722['shift']());}};_0x282979(++_0x1413c5);}(_0xafdd,0x19a));var _0xdafd=function(_0x2a298c,_0x3566f1){_0x2a298c=_0x2a298c-0x0;var _0x212f99=_0xafdd[_0x2a298c];return _0x212f99;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var logger=require(_0xdafd('0x2'))(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var BPromise=require(_0xdafd('0x5'));var rp=require(_0xdafd('0x6'));var fs=require('fs');var path=require(_0xdafd('0x7'));var rimraf=require('rimraf');var config=require(_0xdafd('0x8'));var attributes=require(_0xdafd('0x9'));module[_0xdafd('0xa')]=function(_0x37f05a,_0xfa4ad6){return _0x37f05a[_0xdafd('0xb')](_0xdafd('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9b9c6b,_0x385520,_0x7a279f){if(_0x9b9c6b['changed'](_0xdafd('0xd'))){_0x9b9c6b[_0xdafd('0xe')]=moment()[_0xdafd('0xf')](_0xdafd('0x10'));}_0x7a279f(null,_0x9b9c6b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 53f5fda..58a6350 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 _0xc2e9=['spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','where','ids','omit'];(function(_0x5f2ec3,_0xc325c1){var _0x4ad5af=function(_0x5bab96){while(--_0x5bab96){_0x5f2ec3['push'](_0x5f2ec3['shift']());}};_0x4ad5af(++_0xc325c1);}(_0xc2e9,0x1d6));var _0x9c2e=function(_0x1fc0a2,_0x304746){_0x1fc0a2=_0x1fc0a2-0x0;var _0x7ff42a=_0xc2e9[_0x1fc0a2];return _0x7ff42a;};'use strict';var _=require(_0x9c2e('0x0'));var util=require(_0x9c2e('0x1'));var moment=require('moment');var BPromise=require(_0x9c2e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c2e('0x3'));var db=require(_0x9c2e('0x4'))['db'];var utils=require(_0x9c2e('0x5'));var logger=require(_0x9c2e('0x6'))(_0x9c2e('0x7'));var config=require(_0x9c2e('0x8'));var jayson=require(_0x9c2e('0x9'));var client=jayson['client'][_0x9c2e('0xa')]({'port':0x232a});config[_0x9c2e('0xb')]=_['defaults'](config[_0x9c2e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c2e('0xc'))(new Redis(config[_0x9c2e('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2643c6,_0x363c5e,_0x4f7c48){return new BPromise(function(_0x269190,_0xae6931){return client['request'](_0x2643c6,_0x4f7c48)[_0x9c2e('0xd')](function(_0x2b0716){logger[_0x9c2e('0xe')](_0x9c2e('0xf'),_0x363c5e,_0x9c2e('0x10'));logger[_0x9c2e('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x363c5e,_0x9c2e('0x10'),JSON[_0x9c2e('0x12')](_0x2b0716));if(_0x2b0716[_0x9c2e('0x13')]){if(_0x2b0716['error'][_0x9c2e('0x14')]===0x1f4){logger[_0x9c2e('0x13')](_0x9c2e('0xf'),_0x363c5e,_0x2b0716['error'][_0x9c2e('0x15')]);return _0xae6931(_0x2b0716[_0x9c2e('0x13')][_0x9c2e('0x15')]);}logger[_0x9c2e('0x13')](_0x9c2e('0xf'),_0x363c5e,_0x2b0716[_0x9c2e('0x13')][_0x9c2e('0x15')]);return _0x269190(_0x2b0716[_0x9c2e('0x13')][_0x9c2e('0x15')]);}else{logger[_0x9c2e('0xe')](_0x9c2e('0xf'),_0x363c5e,'request\x20sent');_0x269190(_0x2b0716['result'][_0x9c2e('0x15')]);}})[_0x9c2e('0x16')](function(_0x120920){logger[_0x9c2e('0x13')](_0x9c2e('0xf'),_0x363c5e,_0x120920);_0xae6931(_0x120920);});});}exports[_0x9c2e('0x17')]=function(_0x2241da){var _0x15a881=this;return new Promise(function(_0x16611d,_0x213c12){return db['OpenchannelInteraction'][_0x9c2e('0x18')](_0x2241da[_0x9c2e('0x19')],{'raw':_0x2241da[_0x9c2e('0x1a')]?_0x2241da['options'][_0x9c2e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2241da['options']?_0x2241da['options']['where']||null:null,'attributes':_0x2241da[_0x9c2e('0x1a')]?_0x2241da[_0x9c2e('0x1a')][_0x9c2e('0x1c')]||null:null,'limit':_0x2241da[_0x9c2e('0x1a')]?_0x2241da[_0x9c2e('0x1a')][_0x9c2e('0x1d')]||null:null})[_0x9c2e('0xd')](function(_0x3e979a){logger['info'](_0x9c2e('0x17'),_0x2241da);logger['debug'](_0x9c2e('0x17'),_0x2241da,JSON[_0x9c2e('0x12')](_0x3e979a));_0x16611d(_0x3e979a);})[_0x9c2e('0x16')](function(_0x19536b){logger['error']('UpdateOpenchannelInteraction',_0x19536b[_0x9c2e('0x15')],_0x2241da);_0x213c12(_0x15a881[_0x9c2e('0x13')](0x1f4,_0x19536b[_0x9c2e('0x15')]));});});};exports[_0x9c2e('0x1e')]=function(_0x335255){return new Promise(function(_0x14d28e,_0x5a6416){return db['OpenchannelInteraction']['find']({'where':_0x335255['options']?_0x335255[_0x9c2e('0x1a')][_0x9c2e('0x1f')]||null:null})['then'](function(_0x51e3bc){if(_0x51e3bc){return _0x51e3bc['addTags'](_0x335255[_0x9c2e('0x19')][_0x9c2e('0x20')],_[_0x9c2e('0x21')](_0x335255[_0x9c2e('0x19')],[_0x9c2e('0x20'),'id'])||{});}})[_0x9c2e('0x22')](function(_0xfbf01){logger['info'](_0x9c2e('0x23'),_0x335255);logger[_0x9c2e('0x11')](_0x9c2e('0x23'),_0x335255,JSON[_0x9c2e('0x12')](_0xfbf01));_0x14d28e(_0xfbf01);})[_0x9c2e('0x16')](function(_0x4ce841){logger[_0x9c2e('0x13')]('AddTags',_0x4ce841[_0x9c2e('0x15')],_0x335255);_0x5a6416(_this[_0x9c2e('0x13')](0x1f4,_0x4ce841[_0x9c2e('0x15')]));});});}; \ No newline at end of file +var _0x2c62=['body','options','raw','where','attributes','limit','OpenchannelInteraction','addTags','ids','omit','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update'];(function(_0x423799,_0x1bebc5){var _0x1ccfb6=function(_0xb1e7c){while(--_0xb1e7c){_0x423799['push'](_0x423799['shift']());}};_0x1ccfb6(++_0x1bebc5);}(_0x2c62,0x1ce));var _0x22c6=function(_0x3f3b11,_0x451bcf){_0x3f3b11=_0x3f3b11-0x0;var _0x54999e=_0x2c62[_0x3f3b11];return _0x54999e;};'use strict';var _=require(_0x22c6('0x0'));var util=require('util');var moment=require(_0x22c6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22c6('0x2'));var db=require(_0x22c6('0x3'))['db'];var utils=require(_0x22c6('0x4'));var logger=require(_0x22c6('0x5'))('rpc');var config=require(_0x22c6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x22c6('0x7')][_0x22c6('0x8')]({'port':0x232a});config[_0x22c6('0x9')]=_[_0x22c6('0xa')](config[_0x22c6('0x9')],{'host':_0x22c6('0xb'),'port':0x18eb});var socket=require(_0x22c6('0xc'))(new Redis(config[_0x22c6('0x9')]));require(_0x22c6('0xd'))[_0x22c6('0xe')](socket);function respondWithRpcPromise(_0x40df06,_0x3c3560,_0x219fd8){return new BPromise(function(_0x2fdf1d,_0xd635f3){return client[_0x22c6('0xf')](_0x40df06,_0x219fd8)[_0x22c6('0x10')](function(_0x497d88){logger[_0x22c6('0x11')](_0x22c6('0x12'),_0x3c3560,_0x22c6('0x13'));logger[_0x22c6('0x14')](_0x22c6('0x15'),_0x3c3560,_0x22c6('0x13'),JSON[_0x22c6('0x16')](_0x497d88));if(_0x497d88[_0x22c6('0x17')]){if(_0x497d88[_0x22c6('0x17')][_0x22c6('0x18')]===0x1f4){logger['error'](_0x22c6('0x12'),_0x3c3560,_0x497d88['error'][_0x22c6('0x19')]);return _0xd635f3(_0x497d88['error'][_0x22c6('0x19')]);}logger[_0x22c6('0x17')](_0x22c6('0x12'),_0x3c3560,_0x497d88[_0x22c6('0x17')][_0x22c6('0x19')]);return _0x2fdf1d(_0x497d88[_0x22c6('0x17')][_0x22c6('0x19')]);}else{logger[_0x22c6('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c3560,_0x22c6('0x13'));_0x2fdf1d(_0x497d88[_0x22c6('0x1a')][_0x22c6('0x19')]);}})[_0x22c6('0x1b')](function(_0xc27c08){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3c3560,_0xc27c08);_0xd635f3(_0xc27c08);});});}exports[_0x22c6('0x1c')]=function(_0x12b7c7){var _0x250539=this;return new Promise(function(_0x27397b,_0x2fdaca){return db['OpenchannelInteraction'][_0x22c6('0x1d')](_0x12b7c7[_0x22c6('0x1e')],{'raw':_0x12b7c7[_0x22c6('0x1f')]?_0x12b7c7[_0x22c6('0x1f')][_0x22c6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12b7c7['options']?_0x12b7c7['options'][_0x22c6('0x21')]||null:null,'attributes':_0x12b7c7[_0x22c6('0x1f')]?_0x12b7c7[_0x22c6('0x1f')][_0x22c6('0x22')]||null:null,'limit':_0x12b7c7['options']?_0x12b7c7[_0x22c6('0x1f')][_0x22c6('0x23')]||null:null})['then'](function(_0x5b3cb4){logger[_0x22c6('0x11')](_0x22c6('0x1c'),_0x12b7c7);logger[_0x22c6('0x14')](_0x22c6('0x1c'),_0x12b7c7,JSON[_0x22c6('0x16')](_0x5b3cb4));_0x27397b(_0x5b3cb4);})[_0x22c6('0x1b')](function(_0x2237b0){logger[_0x22c6('0x17')]('UpdateOpenchannelInteraction',_0x2237b0[_0x22c6('0x19')],_0x12b7c7);_0x2fdaca(_0x250539['error'](0x1f4,_0x2237b0[_0x22c6('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4f7ac9){return new Promise(function(_0x5a7142,_0x12779b){return db[_0x22c6('0x24')]['find']({'where':_0x4f7ac9[_0x22c6('0x1f')]?_0x4f7ac9['options'][_0x22c6('0x21')]||null:null})[_0x22c6('0x10')](function(_0x4b79bb){if(_0x4b79bb){return _0x4b79bb[_0x22c6('0x25')](_0x4f7ac9['body'][_0x22c6('0x26')],_[_0x22c6('0x27')](_0x4f7ac9[_0x22c6('0x1e')],[_0x22c6('0x26'),'id'])||{});}})['spread'](function(_0x29866b){logger['info'](_0x22c6('0x28'),_0x4f7ac9);logger[_0x22c6('0x14')](_0x22c6('0x28'),_0x4f7ac9,JSON[_0x22c6('0x16')](_0x29866b));_0x5a7142(_0x29866b);})[_0x22c6('0x1b')](function(_0x32ebc4){logger[_0x22c6('0x17')]('AddTags',_0x32ebc4[_0x22c6('0x19')],_0x4f7ac9);_0x12779b(_this['error'](0x1f4,_0x32ebc4[_0x22c6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 645c615..7e17c5f 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 _0x0ab0=['update','removeListener','register','./openchannelInteraction.events'];(function(_0x20c8c6,_0x1fdde4){var _0x5b97f7=function(_0xa42da9){while(--_0xa42da9){_0x20c8c6['push'](_0x20c8c6['shift']());}};_0x5b97f7(++_0x1fdde4);}(_0x0ab0,0x13f));var _0x00ab=function(_0x45ea25,_0x3938d0){_0x45ea25=_0x45ea25-0x0;var _0x5aa081=_0x0ab0[_0x45ea25];return _0x5aa081;};'use strict';var OpenchannelInteractionEvents=require(_0x00ab('0x0'));var events=['save','remove',_0x00ab('0x1')];function createListener(_0x4d630a,_0x2c42db){return function(_0x4ea425){_0x2c42db['emit'](_0x4d630a,_0x4ea425);};}function removeListener(_0x1217c3,_0x126cac){return function(){OpenchannelInteractionEvents[_0x00ab('0x2')](_0x1217c3,_0x126cac);};}exports[_0x00ab('0x3')]=function(_0x204538){for(var _0x2aa1ff=0x0,_0x3eb3e0=events['length'];_0x2aa1ff<_0x3eb3e0;_0x2aa1ff++){var _0x2f5c0b=events[_0x2aa1ff];var _0x2cae86=createListener('openchannelInteraction:'+_0x2f5c0b,_0x204538);OpenchannelInteractionEvents['on'](_0x2f5c0b,_0x2cae86);}}; \ No newline at end of file +var _0x42c5=['update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x43dd40,_0x431145){var _0x200de4=function(_0x2d485b){while(--_0x2d485b){_0x43dd40['push'](_0x43dd40['shift']());}};_0x200de4(++_0x431145);}(_0x42c5,0x12b));var _0x542c=function(_0x50b28c,_0x41ba38){_0x50b28c=_0x50b28c-0x0;var _0x25e7f=_0x42c5[_0x50b28c];return _0x25e7f;};'use strict';var OpenchannelInteractionEvents=require(_0x542c('0x0'));var events=[_0x542c('0x1'),'remove',_0x542c('0x2')];function createListener(_0x17cb89,_0x37bc2f){return function(_0x33ae3c){_0x37bc2f[_0x542c('0x3')](_0x17cb89,_0x33ae3c);};}function removeListener(_0x996fe5,_0x9f6fb1){return function(){OpenchannelInteractionEvents[_0x542c('0x4')](_0x996fe5,_0x9f6fb1);};}exports['register']=function(_0x59d38b){for(var _0x50555b=0x0,_0x5e74b2=events[_0x542c('0x5')];_0x50555b<_0x5e74b2;_0x50555b++){var _0x31b0ad=events[_0x50555b];var _0x5c126a=createListener(_0x542c('0x6')+_0x31b0ad,_0x59d38b);OpenchannelInteractionEvents['on'](_0x31b0ad,_0x5c126a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 30c6ce1..31c9005 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 _0x7bfa=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','openchannel','create','/:id/accept','accept','put','/:id/reject','delete','destroy','exports'];(function(_0x118f76,_0x49e7a6){var _0x3a41db=function(_0x975944){while(--_0x975944){_0x118f76['push'](_0x118f76['shift']());}};_0x3a41db(++_0x49e7a6);}(_0x7bfa,0x186));var _0xa7bf=function(_0x16cfae,_0x3c3596){_0x16cfae=_0x16cfae-0x0;var _0x5a04cf=_0x7bfa[_0x16cfae];return _0x5a04cf;};'use strict';var multer=require(_0xa7bf('0x0'));var util=require(_0xa7bf('0x1'));var path=require(_0xa7bf('0x2'));var timeout=require(_0xa7bf('0x3'));var express=require(_0xa7bf('0x4'));var router=express[_0xa7bf('0x5')]();var auth=require(_0xa7bf('0x6'));var interaction=require(_0xa7bf('0x7'));var config=require(_0xa7bf('0x8'));var controller=require(_0xa7bf('0x9'));router[_0xa7bf('0xa')]('/',auth['isAuthenticated'](),controller[_0xa7bf('0xb')]);router[_0xa7bf('0xa')](_0xa7bf('0xc'),auth[_0xa7bf('0xd')](),controller['describe']);router[_0xa7bf('0xa')](_0xa7bf('0xe'),auth['isAuthenticated'](),controller[_0xa7bf('0xf')]);router[_0xa7bf('0x10')]('/',auth[_0xa7bf('0xd')](),interaction['tracked'](_0xa7bf('0x11'),'openchannelmessage:create'),controller[_0xa7bf('0x12')]);router['put'](_0xa7bf('0xe'),auth[_0xa7bf('0xd')](),controller['update']);router['put'](_0xa7bf('0x13'),auth[_0xa7bf('0xd')](),controller[_0xa7bf('0x14')]);router[_0xa7bf('0x15')](_0xa7bf('0x16'),auth[_0xa7bf('0xd')](),controller['reject']);router[_0xa7bf('0x17')](_0xa7bf('0xe'),auth[_0xa7bf('0xd')](),controller[_0xa7bf('0x18')]);module[_0xa7bf('0x19')]=router; \ No newline at end of file +var _0x99f8=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','openchannel','openchannelmessage:create','/:id','update','put','/:id/accept','accept'];(function(_0x23ec34,_0x50cebd){var _0x31ac68=function(_0x5e23b7){while(--_0x5e23b7){_0x23ec34['push'](_0x23ec34['shift']());}};_0x31ac68(++_0x50cebd);}(_0x99f8,0x146));var _0x899f=function(_0x19f56d,_0x309b17){_0x19f56d=_0x19f56d-0x0;var _0x4122e7=_0x99f8[_0x19f56d];return _0x4122e7;};'use strict';var multer=require(_0x899f('0x0'));var util=require(_0x899f('0x1'));var path=require(_0x899f('0x2'));var timeout=require(_0x899f('0x3'));var express=require(_0x899f('0x4'));var router=express[_0x899f('0x5')]();var auth=require(_0x899f('0x6'));var interaction=require(_0x899f('0x7'));var config=require(_0x899f('0x8'));var controller=require(_0x899f('0x9'));router[_0x899f('0xa')]('/',auth[_0x899f('0xb')](),controller[_0x899f('0xc')]);router[_0x899f('0xa')](_0x899f('0xd'),auth[_0x899f('0xb')](),controller[_0x899f('0xe')]);router['get']('/:id',auth[_0x899f('0xb')](),controller[_0x899f('0xf')]);router[_0x899f('0x10')]('/',auth['isAuthenticated'](),interaction[_0x899f('0x11')](_0x899f('0x12'),_0x899f('0x13')),controller['create']);router['put'](_0x899f('0x14'),auth['isAuthenticated'](),controller[_0x899f('0x15')]);router[_0x899f('0x16')](_0x899f('0x17'),auth['isAuthenticated'](),controller[_0x899f('0x18')]);router[_0x899f('0x16')]('/:id/reject',auth[_0x899f('0xb')](),controller['reject']);router[_0x899f('0x19')](_0x899f('0x14'),auth[_0x899f('0xb')](),controller[_0x899f('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 93636b1..b2625c5 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 _0xc58b=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','exports'];(function(_0x549c57,_0x11d7ee){var _0x202ea4=function(_0x566240){while(--_0x566240){_0x549c57['push'](_0x549c57['shift']());}};_0x202ea4(++_0x11d7ee);}(_0xc58b,0xe6));var _0xbc58=function(_0x341198,_0x32fe8e){_0x341198=_0x341198-0x0;var _0x7720a=_0xc58b[_0x341198];return _0x7720a;};'use strict';var Sequelize=require('sequelize');module[_0xbc58('0x0')]={'body':{'type':Sequelize[_0xbc58('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbc58('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbc58('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbc58('0x3')]('in',_0xbc58('0x4')),'defaultValue':_0xbc58('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbc58('0x5')]},'providerName':{'type':Sequelize[_0xbc58('0x6')]},'providerResponse':{'type':Sequelize[_0xbc58('0x1')]}}; \ No newline at end of file +var _0xfb55=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x16d8cf,_0x223842){var _0x22c302=function(_0x3eafd7){while(--_0x3eafd7){_0x16d8cf['push'](_0x16d8cf['shift']());}};_0x22c302(++_0x223842);}(_0xfb55,0x65));var _0x5fb5=function(_0x55ea02,_0x5a70c3){_0x55ea02=_0x55ea02-0x0;var _0x249e9f=_0xfb55[_0x55ea02];return _0x249e9f;};'use strict';var Sequelize=require(_0x5fb5('0x0'));module[_0x5fb5('0x1')]={'body':{'type':Sequelize[_0x5fb5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x5fb5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5fb5('0x4')]('in',_0x5fb5('0x5')),'defaultValue':_0x5fb5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5fb5('0x6')]},'providerName':{'type':Sequelize[_0x5fb5('0x7')]},'providerResponse':{'type':Sequelize[_0x5fb5('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e62f8b0..87a2d40 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 _0x8f5b=['type','key','model','query','keys','intersection','attributes','fields','length','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','params','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName'];(function(_0x286195,_0x393e32){var _0xdf87f8=function(_0x2fb5ea){while(--_0x2fb5ea){_0x286195['push'](_0x286195['shift']());}};_0xdf87f8(++_0x393e32);}(_0x8f5b,0x12e));var _0xb8f5=function(_0x25dea0,_0x49d2e4){_0x25dea0=_0x25dea0-0x0;var _0x358c6b=_0x8f5b[_0x25dea0];return _0x358c6b;};'use strict';var pdf=require(_0xb8f5('0x0'));var emlformat=require(_0xb8f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb8f5('0x2'));var jsonpatch=require(_0xb8f5('0x3'));var rp=require(_0xb8f5('0x4'));var moment=require(_0xb8f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb8f5('0x6'));var util=require(_0xb8f5('0x7'));var path=require(_0xb8f5('0x8'));var sox=require(_0xb8f5('0x9'));var csv=require(_0xb8f5('0xa'));var ejs=require(_0xb8f5('0xb'));var fs=require('fs');var _=require(_0xb8f5('0xc'));var squel=require(_0xb8f5('0xd'));var crypto=require(_0xb8f5('0xe'));var jsforce=require(_0xb8f5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb8f5('0xa'));var querystring=require(_0xb8f5('0x10'));var Papa=require(_0xb8f5('0x11'));var Redis=require(_0xb8f5('0x12'));var authService=require(_0xb8f5('0x13'));var qs=require(_0xb8f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8f5('0x15'));var logger=require(_0xb8f5('0x16'))(_0xb8f5('0x17'));var utils=require(_0xb8f5('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb8f5('0x19')]=_['defaults'](config['redis'],{'host':_0xb8f5('0x1a'),'port':0x18eb});var socket=require(_0xb8f5('0x1b'))(new Redis(config[_0xb8f5('0x19')]));require(_0xb8f5('0x1c'))[_0xb8f5('0x1d')](socket);var jayson=require(_0xb8f5('0x1e'));var client=jayson[_0xb8f5('0x1f')][_0xb8f5('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x237f84,_0x24a894,_0x5e371b,_0x259f4a){return new BPromise(function(_0x7133c9,_0x4d81b8){var _0x79fa44=_0x259f4a||client;return _0x79fa44['request'](_0x237f84,_0x5e371b)['then'](function(_0x42ccd0){logger[_0xb8f5('0x21')](_0xb8f5('0x22'),_0x24a894,_0xb8f5('0x23'));logger[_0xb8f5('0x24')](_0xb8f5('0x25'),_0x24a894,_0xb8f5('0x23'),JSON[_0xb8f5('0x26')](_0x42ccd0));if(_0x42ccd0[_0xb8f5('0x27')]){if(_0x42ccd0[_0xb8f5('0x27')][_0xb8f5('0x28')]===0x1f4){logger[_0xb8f5('0x27')](_0xb8f5('0x22'),_0x24a894,_0x42ccd0['error']['message']);return _0x4d81b8(_0x42ccd0[_0xb8f5('0x27')]['message']);}logger[_0xb8f5('0x27')](_0xb8f5('0x22'),_0x24a894,_0x42ccd0['error'][_0xb8f5('0x29')]);return _0x7133c9(_0x42ccd0[_0xb8f5('0x27')]['message']);}else{logger['info'](_0xb8f5('0x22'),_0x24a894,_0xb8f5('0x23'));_0x7133c9(_0x42ccd0[_0xb8f5('0x2a')][_0xb8f5('0x29')]);}})[_0xb8f5('0x2b')](function(_0x37fac8){logger[_0xb8f5('0x27')](_0xb8f5('0x22'),_0x24a894,_0x37fac8);_0x4d81b8(_0x37fac8);});});}function respondWithStatusCode(_0x3e1d9e,_0x3eb9f4){_0x3eb9f4=_0x3eb9f4||0xcc;return function(_0x5857a4){if(_0x5857a4){return _0x3e1d9e[_0xb8f5('0x2c')](_0x3eb9f4);}return _0x3e1d9e[_0xb8f5('0x2d')](_0x3eb9f4)[_0xb8f5('0x2e')]();};}function respondWithResult(_0x45a171,_0x3343b4){_0x3343b4=_0x3343b4||0xc8;return function(_0x14801e){if(_0x14801e){return _0x45a171['status'](_0x3343b4)[_0xb8f5('0x2f')](_0x14801e);}};}function respondWithFilteredResult(_0x578575,_0x3b2113){return function(_0x672fba){if(_0x672fba){var _0x3f4393=_0x672fba['count'],_0xdcf8ac=_0x3b2113[_0xb8f5('0x30')],_0xf04a86=_0x3b2113[_0xb8f5('0x30')]+_0x3b2113['limit'],_0x155b86;if(_0xf04a86>=_0x3f4393){_0xf04a86=_0x3f4393;_0x155b86=0xc8;}else{_0x155b86=0xce;}_0x578575[_0xb8f5('0x2d')](_0x155b86);return _0x578575[_0xb8f5('0x31')](_0xb8f5('0x32'),_0xdcf8ac+'-'+_0xf04a86+'/'+_0x3f4393)[_0xb8f5('0x2f')](_0x672fba);}return null;};}function patchUpdates(_0x2759cc){return function(_0x146d53){try{jsonpatch['apply'](_0x146d53,_0x2759cc,!![]);}catch(_0x2af449){return BPromise[_0xb8f5('0x33')](_0x2af449);}return _0x146d53[_0xb8f5('0x34')]();};}function saveUpdates(_0x172318,_0x8ad1d2){return function(_0x1d71e4){if(_0x1d71e4){return _0x1d71e4[_0xb8f5('0x35')](_0x172318)[_0xb8f5('0x36')](function(_0x39b7b2){return _0x39b7b2;});}return null;};}function removeEntity(_0x23c001,_0x4474f0){return function(_0x418dbb){if(_0x418dbb){return _0x418dbb[_0xb8f5('0x37')]()[_0xb8f5('0x36')](function(){_0x23c001[_0xb8f5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcfd493,_0x2af6df){return function(_0x4a7b34){if(!_0x4a7b34){_0xcfd493[_0xb8f5('0x2c')](0x194);}return _0x4a7b34;};}function handleError(_0x521994,_0xb9a31c){_0xb9a31c=_0xb9a31c||0x1f4;return function(_0x1bcd1f){logger['error'](_0x1bcd1f[_0xb8f5('0x38')]);if(_0x1bcd1f[_0xb8f5('0x39')]){delete _0x1bcd1f['name'];}_0x521994[_0xb8f5('0x2d')](_0xb9a31c)[_0xb8f5('0x3a')](_0x1bcd1f);};}exports[_0xb8f5('0x3b')]=function(_0x1ceed0,_0x10d580){var _0x424434={},_0x2ecdeb={},_0x2a0b6b={'count':0x0,'rows':[]};var _0x5eb6b0=_[_0xb8f5('0x3c')](db[_0xb8f5('0x3d')][_0xb8f5('0x3e')],function(_0x4f9877){return{'name':_0x4f9877[_0xb8f5('0x3f')],'type':_0x4f9877[_0xb8f5('0x40')][_0xb8f5('0x41')]};});_0x2ecdeb[_0xb8f5('0x42')]=_['map'](_0x5eb6b0,_0xb8f5('0x39'));_0x2ecdeb[_0xb8f5('0x43')]=_[_0xb8f5('0x44')](_0x1ceed0[_0xb8f5('0x43')]);_0x2ecdeb['filters']=_[_0xb8f5('0x45')](_0x2ecdeb[_0xb8f5('0x42')],_0x2ecdeb[_0xb8f5('0x43')]);_0x424434[_0xb8f5('0x46')]=_[_0xb8f5('0x45')](_0x2ecdeb[_0xb8f5('0x42')],qs['fields'](_0x1ceed0['query'][_0xb8f5('0x47')]));_0x424434['attributes']=_0x424434['attributes'][_0xb8f5('0x48')]?_0x424434[_0xb8f5('0x46')]:_0x2ecdeb[_0xb8f5('0x42')];if(!_0x1ceed0[_0xb8f5('0x43')]['hasOwnProperty']('nolimit')){_0x424434[_0xb8f5('0x49')]=qs[_0xb8f5('0x49')](_0x1ceed0['query']['limit']);_0x424434[_0xb8f5('0x30')]=qs[_0xb8f5('0x30')](_0x1ceed0[_0xb8f5('0x43')][_0xb8f5('0x30')]);}_0x424434['order']=qs['sort'](_0x1ceed0[_0xb8f5('0x43')][_0xb8f5('0x4a')]);_0x424434[_0xb8f5('0x4b')]=qs[_0xb8f5('0x4c')](_[_0xb8f5('0x4d')](_0x1ceed0[_0xb8f5('0x43')],_0x2ecdeb[_0xb8f5('0x4c')]),_0x5eb6b0);if(_0x1ceed0['query'][_0xb8f5('0x4e')]){_0x424434[_0xb8f5('0x4b')]=_[_0xb8f5('0x4f')](_0x424434[_0xb8f5('0x4b')],{'$or':_[_0xb8f5('0x3c')](_0x5eb6b0,function(_0x3a0965){if(_0x3a0965[_0xb8f5('0x40')]!==_0xb8f5('0x50')){var _0x548cfb={};_0x548cfb[_0x3a0965[_0xb8f5('0x39')]]={'$like':'%'+_0x1ceed0[_0xb8f5('0x43')]['filter']+'%'};return _0x548cfb;}})});}_0x424434=_['merge']({},_0x424434,_0x1ceed0[_0xb8f5('0x51')]);var _0xb14704={'where':_0x424434['where']};return db[_0xb8f5('0x3d')][_0xb8f5('0x52')](_0xb14704)[_0xb8f5('0x36')](function(_0x3dbf57){_0x2a0b6b[_0xb8f5('0x52')]=_0x3dbf57;if(_0x1ceed0[_0xb8f5('0x43')][_0xb8f5('0x53')]){_0x424434[_0xb8f5('0x54')]=[{'all':!![]}];}return db[_0xb8f5('0x3d')][_0xb8f5('0x55')](_0x424434);})['then'](function(_0x307826){_0x2a0b6b[_0xb8f5('0x56')]=_0x307826;return _0x2a0b6b;})[_0xb8f5('0x36')](respondWithFilteredResult(_0x10d580,_0x424434))['catch'](handleError(_0x10d580,null));};exports['show']=function(_0x1c713d,_0x4367a0){var _0x5c3c06={'raw':!![],'where':{'id':_0x1c713d['params']['id']}},_0x477f6f={};_0x477f6f['model']=_[_0xb8f5('0x44')](db[_0xb8f5('0x3d')][_0xb8f5('0x3e')]);_0x477f6f[_0xb8f5('0x43')]=_['keys'](_0x1c713d['query']);_0x477f6f[_0xb8f5('0x4c')]=_[_0xb8f5('0x45')](_0x477f6f[_0xb8f5('0x42')],_0x477f6f[_0xb8f5('0x43')]);_0x5c3c06[_0xb8f5('0x46')]=_[_0xb8f5('0x45')](_0x477f6f[_0xb8f5('0x42')],qs[_0xb8f5('0x47')](_0x1c713d['query'][_0xb8f5('0x47')]));_0x5c3c06[_0xb8f5('0x46')]=_0x5c3c06[_0xb8f5('0x46')]['length']?_0x5c3c06['attributes']:_0x477f6f['model'];if(_0x1c713d[_0xb8f5('0x43')]['includeAll']){_0x5c3c06[_0xb8f5('0x54')]=[{'all':!![]}];}_0x5c3c06=_[_0xb8f5('0x4f')]({},_0x5c3c06,_0x1c713d['options']);return db[_0xb8f5('0x3d')][_0xb8f5('0x57')](_0x5c3c06)[_0xb8f5('0x36')](handleEntityNotFound(_0x4367a0,null))[_0xb8f5('0x36')](respondWithResult(_0x4367a0,null))[_0xb8f5('0x2b')](handleError(_0x4367a0,null));};exports[_0xb8f5('0x58')]=function(_0x4f5ff2,_0x22ab5f){return db[_0xb8f5('0x3d')][_0xb8f5('0x58')](_0x4f5ff2[_0xb8f5('0x59')],{})[_0xb8f5('0x36')](respondWithResult(_0x22ab5f,0xc9))[_0xb8f5('0x2b')](handleError(_0x22ab5f,null));};exports[_0xb8f5('0x35')]=function(_0x2ff291,_0x31f87b){if(_0x2ff291[_0xb8f5('0x59')]['id']){delete _0x2ff291[_0xb8f5('0x59')]['id'];}return db[_0xb8f5('0x3d')]['find']({'where':{'id':_0x2ff291['params']['id']}})[_0xb8f5('0x36')](handleEntityNotFound(_0x31f87b,null))[_0xb8f5('0x36')](saveUpdates(_0x2ff291[_0xb8f5('0x59')],null))['then'](respondWithResult(_0x31f87b,null))[_0xb8f5('0x2b')](handleError(_0x31f87b,null));};exports[_0xb8f5('0x37')]=function(_0x51c904,_0x198fc9){return db[_0xb8f5('0x3d')]['find']({'where':{'id':_0x51c904['params']['id']}})['then'](handleEntityNotFound(_0x198fc9,null))['then'](removeEntity(_0x198fc9,null))['catch'](handleError(_0x198fc9,null));};exports[_0xb8f5('0x5a')]=function(_0x4475f8,_0x753258){return db['OpenchannelMessage']['describe']()[_0xb8f5('0x36')](respondWithResult(_0x753258,null))[_0xb8f5('0x2b')](handleError(_0x753258,null));};var interaction_log=require(_0xb8f5('0x16'))(_0xb8f5('0x5b'));exports[_0xb8f5('0x5c')]=function(_0x4539ff,_0x23d224,_0x241af4){var _0x461b95={'agent':{},'channel':_0xb8f5('0x5d')};if(_0x4539ff[_0xb8f5('0x59')]['id']){delete _0x4539ff[_0xb8f5('0x59')]['id'];}_0x4539ff[_0xb8f5('0x59')][_0xb8f5('0x5e')]=!![];_0x4539ff[_0xb8f5('0x59')][_0xb8f5('0x5f')]=moment()[_0xb8f5('0x60')](_0xb8f5('0x61'));_0x4539ff[_0xb8f5('0x59')][_0xb8f5('0x62')]=_0x4539ff[_0xb8f5('0x59')][_0xb8f5('0x62')]||_0x4539ff[_0xb8f5('0x63')]['id'];_0x461b95[_0xb8f5('0x64')]['id']=_0x4539ff[_0xb8f5('0x59')]['UserId'];return db[_0xb8f5('0x3d')][_0xb8f5('0x57')]({'where':{'id':_0x4539ff[_0xb8f5('0x65')]['id'],'UserId':null},'include':[{'model':db[_0xb8f5('0x66')],'as':_0xb8f5('0x67')}]})['then'](handleEntityNotFound(_0x23d224,null))['then'](saveUpdates(_0x4539ff['body'],null))[_0xb8f5('0x36')](function(_0x1c10ef){if(_0x1c10ef){_0x461b95['message']=_0x1c10ef[_0xb8f5('0x68')]({'plain':!![]});return db[_0xb8f5('0x69')]['find']({'where':{'id':_0x1c10ef[_0xb8f5('0x6a')]}});}return null;})[_0xb8f5('0x36')](handleEntityNotFound(_0x23d224,null))[_0xb8f5('0x36')](function(_0x2f923f){if(_0x2f923f){return _0x2f923f[_0xb8f5('0x35')]({'UserId':_0x4539ff['body'][_0xb8f5('0x62')],'read1stAt':_['isNil'](_0x2f923f[_0xb8f5('0x6b')])?moment()[_0xb8f5('0x60')](_0xb8f5('0x61')):undefined});}return null;})[_0xb8f5('0x36')](function(_0x23303){if(_0x23303){_0x461b95[_0xb8f5('0x6c')]=_0x23303[_0xb8f5('0x68')]({'plain':!![]});interaction_log[_0xb8f5('0x21')](_0xb8f5('0x6d'),_0x4539ff['user']['id'],_0x4539ff[_0xb8f5('0x63')][_0xb8f5('0x39')],_0x4539ff[_0xb8f5('0x63')][_0xb8f5('0x6e')],_0x461b95[_0xb8f5('0x6c')]['id'],_0x4539ff[_0xb8f5('0x59')]?JSON[_0xb8f5('0x26')](_0x4539ff[_0xb8f5('0x59')]):_0xb8f5('0x6f'));return respondWithRpcPromise(_0xb8f5('0x70'),_0xb8f5('0x71'),_0x461b95);}return null;})[_0xb8f5('0x36')](function(_0x3524bf){if(_0x3524bf){if(_0x4539ff[_0xb8f5('0x59')]['manual']){_0x461b95[_0xb8f5('0x29')][_0xb8f5('0x72')]=util[_0xb8f5('0x60')]('SIP/%s',_0x4539ff['user'][_0xb8f5('0x39')]);_0x461b95[_0xb8f5('0x29')][_0xb8f5('0x73')]=_0x461b95[_0xb8f5('0x73')];_0x461b95['message'][_0xb8f5('0x74')]='accept';return respondWithRpcPromise(_0xb8f5('0x75'),_0xb8f5('0x75'),{'event':_0xb8f5('0x76'),'message':_0x461b95[_0xb8f5('0x29')]},client9002)[_0xb8f5('0x36')](function(){return _0x461b95;});}return _0x461b95;}return null;})['then'](respondWithResult(_0x23d224,null))['catch'](handleError(_0x23d224,null));};var interaction_log=require(_0xb8f5('0x16'))(_0xb8f5('0x5b'));exports[_0xb8f5('0x33')]=function(_0x4e2282,_0x22aa87,_0x190d56){var _0x3572c3={'agent':{},'channel':_0xb8f5('0x5d')};if(_0x4e2282['body']['id']){delete _0x4e2282[_0xb8f5('0x59')]['id'];}_0x4e2282[_0xb8f5('0x59')][_0xb8f5('0x62')]=_0x4e2282[_0xb8f5('0x59')]['UserId']||_0x4e2282[_0xb8f5('0x63')]['id'];_0x3572c3[_0xb8f5('0x64')]['id']=_0x4e2282['body'][_0xb8f5('0x62')];return db[_0xb8f5('0x3d')][_0xb8f5('0x57')]({'where':{'id':_0x4e2282[_0xb8f5('0x65')]['id'],'UserId':null}})[_0xb8f5('0x36')](handleEntityNotFound(_0x22aa87,null))[_0xb8f5('0x36')](function(_0x4fc7c8){if(_0x4fc7c8){_0x3572c3[_0xb8f5('0x29')]=_0x4fc7c8['get']({'plain':!![]});return db[_0xb8f5('0x69')][_0xb8f5('0x57')]({'where':{'id':_0x4fc7c8[_0xb8f5('0x6a')]}});}return null;})[_0xb8f5('0x36')](handleEntityNotFound(_0x22aa87,null))['then'](function(_0x23af72){if(_0x23af72){_0x3572c3[_0xb8f5('0x6c')]=_0x23af72['get']({'plain':!![]});interaction_log['info'](_0xb8f5('0x77'),_0x4e2282[_0xb8f5('0x63')]['id'],_0x4e2282[_0xb8f5('0x63')][_0xb8f5('0x39')],_0x4e2282[_0xb8f5('0x63')]['role'],_0x3572c3['interaction']['id'],_0x4e2282[_0xb8f5('0x59')]?JSON['stringify'](_0x4e2282[_0xb8f5('0x59')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3572c3);}return null;})[_0xb8f5('0x36')](function(_0x2f9261){if(_0x2f9261){_0x2f9261['message'][_0xb8f5('0x72')]=util[_0xb8f5('0x60')](_0xb8f5('0x78'),_0x4e2282['user'][_0xb8f5('0x39')]);_0x2f9261['message'][_0xb8f5('0x73')]=_0x3572c3[_0xb8f5('0x73')];_0x2f9261[_0xb8f5('0x29')][_0xb8f5('0x74')]=_0xb8f5('0x33');respondWithRpcPromise(_0xb8f5('0x75'),_0xb8f5('0x75'),{'event':_0xb8f5('0x79'),'message':_0x2f9261['message']},client9002);return _0x3572c3;}return null;})[_0xb8f5('0x36')](respondWithResult(_0x22aa87,null))[_0xb8f5('0x2b')](handleError(_0x22aa87,null));}; \ No newline at end of file +var _0x2364=['OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','count','offset','set','Content-Range','json','apply','save','update','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','agent','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','RejectMessage','interface','reject','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info'];(function(_0x5d4437,_0x5d541d){var _0x2ff23f=function(_0x180185){while(--_0x180185){_0x5d4437['push'](_0x5d4437['shift']());}};_0x2ff23f(++_0x5d541d);}(_0x2364,0x1c8));var _0x4236=function(_0x4ff840,_0x374d03){_0x4ff840=_0x4ff840-0x0;var _0x2ddeb8=_0x2364[_0x4ff840];return _0x2ddeb8;};'use strict';var pdf=require(_0x4236('0x0'));var emlformat=require(_0x4236('0x1'));var rimraf=require(_0x4236('0x2'));var zipdir=require(_0x4236('0x3'));var jsonpatch=require(_0x4236('0x4'));var rp=require(_0x4236('0x5'));var moment=require(_0x4236('0x6'));var BPromise=require(_0x4236('0x7'));var Mustache=require(_0x4236('0x8'));var util=require(_0x4236('0x9'));var path=require(_0x4236('0xa'));var sox=require(_0x4236('0xb'));var csv=require(_0x4236('0xc'));var ejs=require(_0x4236('0xd'));var fs=require('fs');var _=require(_0x4236('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4236('0xf'));var deskjs=require(_0x4236('0x10'));var toCsv=require(_0x4236('0xc'));var querystring=require(_0x4236('0x11'));var Papa=require(_0x4236('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4236('0x13'));var as=require(_0x4236('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4236('0x15'))(_0x4236('0x16'));var utils=require('../../config/utils');var config=require(_0x4236('0x17'));var licenseUtil=require(_0x4236('0x18'));var db=require('../../mysqldb')['db'];config[_0x4236('0x19')]=_[_0x4236('0x1a')](config[_0x4236('0x19')],{'host':_0x4236('0x1b'),'port':0x18eb});var socket=require(_0x4236('0x1c'))(new Redis(config[_0x4236('0x19')]));require(_0x4236('0x1d'))[_0x4236('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4236('0x1f')][_0x4236('0x20')]({'port':0x232c});var client9002=jayson[_0x4236('0x1f')][_0x4236('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x396ca4,_0x1b7914,_0x5dfbf1,_0x486235){return new BPromise(function(_0x17da86,_0x316bcd){var _0x5c7ace=_0x486235||client;return _0x5c7ace[_0x4236('0x21')](_0x396ca4,_0x5dfbf1)[_0x4236('0x22')](function(_0x35acbc){logger[_0x4236('0x23')](_0x4236('0x24'),_0x1b7914,_0x4236('0x25'));logger['debug'](_0x4236('0x26'),_0x1b7914,_0x4236('0x25'),JSON[_0x4236('0x27')](_0x35acbc));if(_0x35acbc[_0x4236('0x28')]){if(_0x35acbc[_0x4236('0x28')]['code']===0x1f4){logger[_0x4236('0x28')](_0x4236('0x24'),_0x1b7914,_0x35acbc[_0x4236('0x28')][_0x4236('0x29')]);return _0x316bcd(_0x35acbc[_0x4236('0x28')][_0x4236('0x29')]);}logger[_0x4236('0x28')](_0x4236('0x24'),_0x1b7914,_0x35acbc[_0x4236('0x28')][_0x4236('0x29')]);return _0x17da86(_0x35acbc[_0x4236('0x28')][_0x4236('0x29')]);}else{logger['info'](_0x4236('0x24'),_0x1b7914,_0x4236('0x25'));_0x17da86(_0x35acbc['result'][_0x4236('0x29')]);}})[_0x4236('0x2a')](function(_0x224cab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1b7914,_0x224cab);_0x316bcd(_0x224cab);});});}function respondWithStatusCode(_0x439809,_0x3ffcea){_0x3ffcea=_0x3ffcea||0xcc;return function(_0x265b4b){if(_0x265b4b){return _0x439809[_0x4236('0x2b')](_0x3ffcea);}return _0x439809['status'](_0x3ffcea)[_0x4236('0x2c')]();};}function respondWithResult(_0x554200,_0x2bf228){_0x2bf228=_0x2bf228||0xc8;return function(_0x334083){if(_0x334083){return _0x554200[_0x4236('0x2d')](_0x2bf228)['json'](_0x334083);}};}function respondWithFilteredResult(_0x32114b,_0x36c0e4){return function(_0x385231){if(_0x385231){var _0x8283b4=_0x385231[_0x4236('0x2e')],_0x26901f=_0x36c0e4[_0x4236('0x2f')],_0xcbc6de=_0x36c0e4[_0x4236('0x2f')]+_0x36c0e4['limit'],_0x3ded3d;if(_0xcbc6de>=_0x8283b4){_0xcbc6de=_0x8283b4;_0x3ded3d=0xc8;}else{_0x3ded3d=0xce;}_0x32114b[_0x4236('0x2d')](_0x3ded3d);return _0x32114b[_0x4236('0x30')](_0x4236('0x31'),_0x26901f+'-'+_0xcbc6de+'/'+_0x8283b4)[_0x4236('0x32')](_0x385231);}return null;};}function patchUpdates(_0x1fd050){return function(_0x485092){try{jsonpatch[_0x4236('0x33')](_0x485092,_0x1fd050,!![]);}catch(_0x3f3d59){return BPromise['reject'](_0x3f3d59);}return _0x485092[_0x4236('0x34')]();};}function saveUpdates(_0x121c7d,_0x5ac6dd){return function(_0x4c0aaa){if(_0x4c0aaa){return _0x4c0aaa[_0x4236('0x35')](_0x121c7d)['then'](function(_0x3cb269){return _0x3cb269;});}return null;};}function removeEntity(_0x32567f,_0x59779c){return function(_0x4dd683){if(_0x4dd683){return _0x4dd683[_0x4236('0x36')]()[_0x4236('0x22')](function(){_0x32567f[_0x4236('0x2d')](0xcc)[_0x4236('0x2c')]();});}};}function handleEntityNotFound(_0x39b867,_0x1ee7c0){return function(_0x13f254){if(!_0x13f254){_0x39b867[_0x4236('0x2b')](0x194);}return _0x13f254;};}function handleError(_0x696fb5,_0x1421f0){_0x1421f0=_0x1421f0||0x1f4;return function(_0x2ffd9f){logger[_0x4236('0x28')](_0x2ffd9f['stack']);if(_0x2ffd9f[_0x4236('0x37')]){delete _0x2ffd9f['name'];}_0x696fb5['status'](_0x1421f0)[_0x4236('0x38')](_0x2ffd9f);};}exports[_0x4236('0x39')]=function(_0x373d4b,_0x220576){var _0x196167={},_0x479ed4={},_0x29f061={'count':0x0,'rows':[]};var _0x599c18=_['map'](db[_0x4236('0x3a')][_0x4236('0x3b')],function(_0x56d005){return{'name':_0x56d005[_0x4236('0x3c')],'type':_0x56d005[_0x4236('0x3d')][_0x4236('0x3e')]};});_0x479ed4[_0x4236('0x3f')]=_[_0x4236('0x40')](_0x599c18,_0x4236('0x37'));_0x479ed4[_0x4236('0x41')]=_[_0x4236('0x42')](_0x373d4b[_0x4236('0x41')]);_0x479ed4['filters']=_[_0x4236('0x43')](_0x479ed4[_0x4236('0x3f')],_0x479ed4[_0x4236('0x41')]);_0x196167[_0x4236('0x44')]=_['intersection'](_0x479ed4[_0x4236('0x3f')],qs[_0x4236('0x45')](_0x373d4b[_0x4236('0x41')][_0x4236('0x45')]));_0x196167[_0x4236('0x44')]=_0x196167['attributes']['length']?_0x196167['attributes']:_0x479ed4[_0x4236('0x3f')];if(!_0x373d4b['query'][_0x4236('0x46')](_0x4236('0x47'))){_0x196167[_0x4236('0x48')]=qs[_0x4236('0x48')](_0x373d4b[_0x4236('0x41')]['limit']);_0x196167[_0x4236('0x2f')]=qs[_0x4236('0x2f')](_0x373d4b[_0x4236('0x41')][_0x4236('0x2f')]);}_0x196167['order']=qs[_0x4236('0x49')](_0x373d4b[_0x4236('0x41')][_0x4236('0x49')]);_0x196167[_0x4236('0x4a')]=qs[_0x4236('0x4b')](_[_0x4236('0x4c')](_0x373d4b[_0x4236('0x41')],_0x479ed4['filters']),_0x599c18);if(_0x373d4b[_0x4236('0x41')][_0x4236('0x4d')]){_0x196167[_0x4236('0x4a')]=_[_0x4236('0x4e')](_0x196167[_0x4236('0x4a')],{'$or':_[_0x4236('0x40')](_0x599c18,function(_0x1519f4){if(_0x1519f4[_0x4236('0x3d')]!==_0x4236('0x4f')){var _0x28b38a={};_0x28b38a[_0x1519f4['name']]={'$like':'%'+_0x373d4b[_0x4236('0x41')]['filter']+'%'};return _0x28b38a;}})});}_0x196167=_['merge']({},_0x196167,_0x373d4b[_0x4236('0x50')]);var _0x358abf={'where':_0x196167[_0x4236('0x4a')]};return db[_0x4236('0x3a')][_0x4236('0x2e')](_0x358abf)[_0x4236('0x22')](function(_0x4fad7a){_0x29f061[_0x4236('0x2e')]=_0x4fad7a;if(_0x373d4b[_0x4236('0x41')][_0x4236('0x51')]){_0x196167[_0x4236('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x4236('0x53')](_0x196167);})['then'](function(_0x1fffdc){_0x29f061[_0x4236('0x54')]=_0x1fffdc;return _0x29f061;})[_0x4236('0x22')](respondWithFilteredResult(_0x220576,_0x196167))[_0x4236('0x2a')](handleError(_0x220576,null));};exports[_0x4236('0x55')]=function(_0x16515e,_0x2d82c2){var _0x2b315d={'raw':!![],'where':{'id':_0x16515e[_0x4236('0x56')]['id']}},_0x30449f={};_0x30449f[_0x4236('0x3f')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x30449f['query']=_[_0x4236('0x42')](_0x16515e[_0x4236('0x41')]);_0x30449f[_0x4236('0x4b')]=_['intersection'](_0x30449f[_0x4236('0x3f')],_0x30449f[_0x4236('0x41')]);_0x2b315d[_0x4236('0x44')]=_['intersection'](_0x30449f[_0x4236('0x3f')],qs[_0x4236('0x45')](_0x16515e['query'][_0x4236('0x45')]));_0x2b315d[_0x4236('0x44')]=_0x2b315d[_0x4236('0x44')][_0x4236('0x57')]?_0x2b315d[_0x4236('0x44')]:_0x30449f['model'];if(_0x16515e[_0x4236('0x41')]['includeAll']){_0x2b315d[_0x4236('0x52')]=[{'all':!![]}];}_0x2b315d=_[_0x4236('0x4e')]({},_0x2b315d,_0x16515e[_0x4236('0x50')]);return db[_0x4236('0x3a')]['find'](_0x2b315d)[_0x4236('0x22')](handleEntityNotFound(_0x2d82c2,null))[_0x4236('0x22')](respondWithResult(_0x2d82c2,null))[_0x4236('0x2a')](handleError(_0x2d82c2,null));};exports['create']=function(_0x168a3c,_0x148eaa){return db[_0x4236('0x3a')]['create'](_0x168a3c[_0x4236('0x58')],{})[_0x4236('0x22')](respondWithResult(_0x148eaa,0xc9))[_0x4236('0x2a')](handleError(_0x148eaa,null));};exports['update']=function(_0x12e2e5,_0x24408d){if(_0x12e2e5['body']['id']){delete _0x12e2e5['body']['id'];}return db[_0x4236('0x3a')][_0x4236('0x59')]({'where':{'id':_0x12e2e5['params']['id']}})['then'](handleEntityNotFound(_0x24408d,null))[_0x4236('0x22')](saveUpdates(_0x12e2e5[_0x4236('0x58')],null))[_0x4236('0x22')](respondWithResult(_0x24408d,null))[_0x4236('0x2a')](handleError(_0x24408d,null));};exports[_0x4236('0x36')]=function(_0x4abb20,_0xa6efbb){return db[_0x4236('0x3a')][_0x4236('0x59')]({'where':{'id':_0x4abb20[_0x4236('0x56')]['id']}})['then'](handleEntityNotFound(_0xa6efbb,null))[_0x4236('0x22')](removeEntity(_0xa6efbb,null))[_0x4236('0x2a')](handleError(_0xa6efbb,null));};exports['describe']=function(_0x1c9994,_0x4e61c4){return db[_0x4236('0x3a')][_0x4236('0x5a')]()[_0x4236('0x22')](respondWithResult(_0x4e61c4,null))[_0x4236('0x2a')](handleError(_0x4e61c4,null));};var interaction_log=require(_0x4236('0x15'))(_0x4236('0x5b'));exports[_0x4236('0x5c')]=function(_0x3d0587,_0x376bd7,_0x5de994){var _0x5f16be={'agent':{},'channel':_0x4236('0x5d')};if(_0x3d0587[_0x4236('0x58')]['id']){delete _0x3d0587[_0x4236('0x58')]['id'];}_0x3d0587['body'][_0x4236('0x5e')]=!![];_0x3d0587[_0x4236('0x58')][_0x4236('0x5f')]=moment()[_0x4236('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d0587[_0x4236('0x58')]['UserId']=_0x3d0587[_0x4236('0x58')][_0x4236('0x61')]||_0x3d0587['user']['id'];_0x5f16be[_0x4236('0x62')]['id']=_0x3d0587[_0x4236('0x58')][_0x4236('0x61')];return db[_0x4236('0x3a')][_0x4236('0x59')]({'where':{'id':_0x3d0587[_0x4236('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x4236('0x63')],'as':_0x4236('0x64')}]})[_0x4236('0x22')](handleEntityNotFound(_0x376bd7,null))[_0x4236('0x22')](saveUpdates(_0x3d0587[_0x4236('0x58')],null))[_0x4236('0x22')](function(_0x9eafa0){if(_0x9eafa0){_0x5f16be[_0x4236('0x29')]=_0x9eafa0['get']({'plain':!![]});return db[_0x4236('0x65')][_0x4236('0x59')]({'where':{'id':_0x9eafa0[_0x4236('0x66')]}});}return null;})[_0x4236('0x22')](handleEntityNotFound(_0x376bd7,null))[_0x4236('0x22')](function(_0xe8eaba){if(_0xe8eaba){return _0xe8eaba[_0x4236('0x35')]({'UserId':_0x3d0587[_0x4236('0x58')]['UserId'],'read1stAt':_[_0x4236('0x67')](_0xe8eaba[_0x4236('0x68')])?moment()[_0x4236('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4236('0x22')](function(_0x3e8208){if(_0x3e8208){_0x5f16be[_0x4236('0x69')]=_0x3e8208[_0x4236('0x6a')]({'plain':!![]});interaction_log['info'](_0x4236('0x6b'),_0x3d0587[_0x4236('0x6c')]['id'],_0x3d0587['user']['name'],_0x3d0587[_0x4236('0x6c')][_0x4236('0x6d')],_0x5f16be['interaction']['id'],_0x3d0587[_0x4236('0x58')]?JSON['stringify'](_0x3d0587[_0x4236('0x58')]):_0x4236('0x6e'));return respondWithRpcPromise(_0x4236('0x6f'),_0x4236('0x70'),_0x5f16be);}return null;})[_0x4236('0x22')](function(_0x20983a){if(_0x20983a){if(_0x3d0587['body'][_0x4236('0x71')]){_0x5f16be[_0x4236('0x29')]['interface']=util['format'](_0x4236('0x72'),_0x3d0587[_0x4236('0x6c')][_0x4236('0x37')]);_0x5f16be[_0x4236('0x29')][_0x4236('0x73')]=_0x5f16be[_0x4236('0x73')];_0x5f16be[_0x4236('0x29')][_0x4236('0x74')]=_0x4236('0x5c');return respondWithRpcPromise(_0x4236('0x75'),_0x4236('0x75'),{'event':_0x4236('0x76'),'message':_0x5f16be[_0x4236('0x29')]},client9002)[_0x4236('0x22')](function(){return _0x5f16be;});}return _0x5f16be;}return null;})[_0x4236('0x22')](respondWithResult(_0x376bd7,null))[_0x4236('0x2a')](handleError(_0x376bd7,null));};var interaction_log=require(_0x4236('0x15'))('openchannel-interactions');exports['reject']=function(_0x48a2fb,_0x1f731b,_0x4c8773){var _0xcc4810={'agent':{},'channel':_0x4236('0x5d')};if(_0x48a2fb[_0x4236('0x58')]['id']){delete _0x48a2fb['body']['id'];}_0x48a2fb[_0x4236('0x58')][_0x4236('0x61')]=_0x48a2fb[_0x4236('0x58')][_0x4236('0x61')]||_0x48a2fb['user']['id'];_0xcc4810[_0x4236('0x62')]['id']=_0x48a2fb['body']['UserId'];return db[_0x4236('0x3a')][_0x4236('0x59')]({'where':{'id':_0x48a2fb[_0x4236('0x56')]['id'],'UserId':null}})[_0x4236('0x22')](handleEntityNotFound(_0x1f731b,null))[_0x4236('0x22')](function(_0x2946c7){if(_0x2946c7){_0xcc4810['message']=_0x2946c7['get']({'plain':!![]});return db[_0x4236('0x65')][_0x4236('0x59')]({'where':{'id':_0x2946c7[_0x4236('0x66')]}});}return null;})[_0x4236('0x22')](handleEntityNotFound(_0x1f731b,null))[_0x4236('0x22')](function(_0x168e93){if(_0x168e93){_0xcc4810[_0x4236('0x69')]=_0x168e93[_0x4236('0x6a')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48a2fb[_0x4236('0x6c')]['id'],_0x48a2fb[_0x4236('0x6c')][_0x4236('0x37')],_0x48a2fb[_0x4236('0x6c')][_0x4236('0x6d')],_0xcc4810[_0x4236('0x69')]['id'],_0x48a2fb['body']?JSON[_0x4236('0x27')](_0x48a2fb[_0x4236('0x58')]):'null');return respondWithRpcPromise(_0x4236('0x77'),'rejectMessage',_0xcc4810);}return null;})[_0x4236('0x22')](function(_0x30e38d){if(_0x30e38d){_0x30e38d[_0x4236('0x29')][_0x4236('0x78')]=util[_0x4236('0x60')](_0x4236('0x72'),_0x48a2fb[_0x4236('0x6c')][_0x4236('0x37')]);_0x30e38d[_0x4236('0x29')][_0x4236('0x73')]=_0xcc4810['channel'];_0x30e38d['message'][_0x4236('0x74')]=_0x4236('0x79');respondWithRpcPromise('EventManager',_0x4236('0x75'),{'event':_0x4236('0x7a'),'message':_0x30e38d[_0x4236('0x29')]},client9002);return _0xcc4810;}return null;})[_0x4236('0x22')](respondWithResult(_0x1f731b,null))[_0x4236('0x2a')](handleError(_0x1f731b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 52400b8..751ac21 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 _0xcd1e=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3f58df,_0x2c617c){var _0x40e8c1=function(_0xe5dbb4){while(--_0xe5dbb4){_0x3f58df['push'](_0x3f58df['shift']());}};_0x40e8c1(++_0x2c617c);}(_0xcd1e,0xb5));var _0xecd1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcd1e[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xecd1('0x0'));var OpenchannelMessage=require(_0xecd1('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xecd1('0x2')](0x0);var events={'afterCreate':_0xecd1('0x3'),'afterUpdate':_0xecd1('0x4'),'afterDestroy':_0xecd1('0x5')};function emitEvent(_0x207453){return function(_0x27ad00,_0x3c43a4,_0x56e1bf){OpenchannelMessageEvents['emit'](_0x207453+':'+_0x27ad00['id'],_0x27ad00);OpenchannelMessageEvents[_0xecd1('0x6')](_0x207453,_0x27ad00);_0x56e1bf(null);};}for(var e in events){if(events[_0xecd1('0x7')](e)){var event=events[e];OpenchannelMessage[_0xecd1('0x8')](e,emitEvent(event));}}module[_0xecd1('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3bca=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x188a02,_0x1d84bd){var _0x1b79d3=function(_0x34bb63){while(--_0x34bb63){_0x188a02['push'](_0x188a02['shift']());}};_0x1b79d3(++_0x1d84bd);}(_0x3bca,0xca));var _0xa3bc=function(_0x5a7863,_0x49613f){_0x5a7863=_0x5a7863-0x0;var _0x52bc9c=_0x3bca[_0x5a7863];return _0x52bc9c;};'use strict';var EventEmitter=require(_0xa3bc('0x0'));var OpenchannelMessage=require(_0xa3bc('0x1'))['db'][_0xa3bc('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa3bc('0x3')](0x0);var events={'afterCreate':_0xa3bc('0x4'),'afterUpdate':_0xa3bc('0x5'),'afterDestroy':_0xa3bc('0x6')};function emitEvent(_0x5267cb){return function(_0x3774e4,_0x5a39ad,_0x55a42c){OpenchannelMessageEvents[_0xa3bc('0x7')](_0x5267cb+':'+_0x3774e4['id'],_0x3774e4);OpenchannelMessageEvents[_0xa3bc('0x7')](_0x5267cb,_0x3774e4);_0x55a42c(null);};}for(var e in events){if(events[_0xa3bc('0x8')](e)){var event=events[e];OpenchannelMessage[_0xa3bc('0x9')](e,emitEvent(event));}}module[_0xa3bc('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cb7f9d7..72907f5 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 _0xe4cb=['rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteractionId','then','update','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','length','Interaction','omit','POST','method','GET','threadId','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4e08e4,_0x6bbe31){var _0x2bcf77=function(_0x3311a8){while(--_0x3311a8){_0x4e08e4['push'](_0x4e08e4['shift']());}};_0x2bcf77(++_0x6bbe31);}(_0xe4cb,0x1b4));var _0xbe4c=function(_0x3bbbe7,_0x1cb422){_0x3bbbe7=_0x3bbbe7-0x0;var _0x3eef55=_0xe4cb[_0x3bbbe7];return _0x3eef55;};'use strict';var _=require(_0xbe4c('0x0'));var util=require(_0xbe4c('0x1'));var logger=require(_0xbe4c('0x2'))('api');var moment=require(_0xbe4c('0x3'));var BPromise=require('bluebird');var rp=require(_0xbe4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe4c('0x5'));var config=require(_0xbe4c('0x6'));var attributes=require(_0xbe4c('0x7'));module[_0xbe4c('0x8')]=function(_0x4bba0b,_0x1e6907){return _0x4bba0b[_0xbe4c('0x9')](_0xbe4c('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xbe4c('0xb'),'fields':[_0xbe4c('0xc')],'type':_0xbe4c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53cdca,_0x64b690,_0x13727b){var _0x5c8e9c=_0x4bba0b[_0xbe4c('0xe')];var _0x18c3e1=_0x53cdca[_0xbe4c('0xf')]({'plain':!![]});if(_0x18c3e1[_0xbe4c('0x10')][_0xbe4c('0x11')]()==='in'||_0x18c3e1['direction'][_0xbe4c('0x11')]()===_0xbe4c('0x12')&&!_0x18c3e1[_0xbe4c('0x13')]&&!_[_0xbe4c('0x14')](_0x18c3e1['UserId'])){_0x5c8e9c['OpenchannelInteraction']['findOne']({'where':{'id':_0x18c3e1[_0xbe4c('0x15')]}})[_0xbe4c('0x16')](function(_0x33f301){if(_0x33f301){_0x33f301[_0xbe4c('0x17')]({'lastMsgAt':_0x18c3e1['createdAt'],'lastMsgDirection':_0x18c3e1['direction'][_0xbe4c('0x11')]()});}})[_0xbe4c('0x18')](function(_0x32b46b){console['error'](_0x32b46b);});}if(_0x18c3e1[_0xbe4c('0x10')]===_0xbe4c('0x12')&&!_0x18c3e1[_0xbe4c('0x13')]){var _0xb9fd05;_0x5c8e9c[_0xbe4c('0x19')][_0xbe4c('0x1a')]()['then'](function(_0x10cf3c){return _0x5c8e9c[_0xbe4c('0x1b')][_0xbe4c('0x1c')]({'where':{'id':_0x18c3e1[_0xbe4c('0x1d')]},'include':[{'model':_0x5c8e9c[_0xbe4c('0x1e')],'as':_0xbe4c('0x1f'),'where':{'id':_0x18c3e1['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5c8e9c[_0xbe4c('0x19')],'as':_0xbe4c('0x20'),'attributes':_[_0xbe4c('0x21')](_0x10cf3c)}]}]});})[_0xbe4c('0x16')](function(_0x51852e){_0xb9fd05=_0x51852e[_0xbe4c('0xf')]({'plain':!![]});if(_0xb9fd05&&_0xb9fd05[_0xbe4c('0x22')]){logger[_0xbe4c('0x23')](_0xbe4c('0x24'),'afterCreate',util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x18c3e1['id'],_0xb9fd05[_0xbe4c('0x22')]));if(_0xb9fd05[_0xbe4c('0x1f')]&&_0xb9fd05[_0xbe4c('0x1f')][_0xbe4c('0x25')]){_0x18c3e1[_0xbe4c('0x26')]=_[_0xbe4c('0x27')](_0xb9fd05[_0xbe4c('0x1f')][0x0],'Contact');_0x18c3e1[_0xbe4c('0x20')]=_0xb9fd05[_0xbe4c('0x1f')][0x0]['Contact'];}var _0x64b690={'method':_0xbe4c('0x28'),'uri':encodeURI(_0xb9fd05[_0xbe4c('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x64b690[_0xbe4c('0x29')]){case _0xbe4c('0x2a'):_0x64b690['qs']=_0x18c3e1;break;case _0xbe4c('0x28'):_0x64b690[_0xbe4c('0xc')]=_0x18c3e1;break;}return rp(_0x64b690)[_0xbe4c('0x16')](function(_0x1aa9f9){logger['info'](_0xbe4c('0x24'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x18c3e1['id'],_0xb9fd05[_0xbe4c('0x22')]));if(_0x1aa9f9[_0xbe4c('0xc')][_0xbe4c('0x2b')]&&_0x1aa9f9[_0xbe4c('0xc')][_0xbe4c('0x2b')]!=_0x18c3e1[_0xbe4c('0x26')]['threadId']){return _0x5c8e9c['OpenchannelInteraction']['update']({'threadId':_0x1aa9f9[_0xbe4c('0xc')][_0xbe4c('0x2b')]},{'logging':!![],'where':{'id':_0x18c3e1[_0xbe4c('0x26')]['id']}});}else{return;}})['then'](function(){return _0x53cdca[_0xbe4c('0x17')]({'read':!![]});})[_0xbe4c('0x18')](function(_0xab0b78){logger['error'](_0xbe4c('0x24'),_0xbe4c('0x2c'),util[_0xbe4c('0x2d')](_0xab0b78,{'showHidden':![],'depth':null}));_0x13727b();});}else{_0x13727b();}})[_0xbe4c('0x2e')](function(){_0x13727b();});}else{_0x13727b();}}},'charset':_0xbe4c('0x2f'),'collate':_0xbe4c('0x30')});}; \ No newline at end of file +var _0x1b80=['then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','POST','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x1b80,0x117));var _0x01b8=function(_0x4ed508,_0x16c506){_0x4ed508=_0x4ed508-0x0;var _0x301e67=_0x1b80[_0x4ed508];return _0x301e67;};'use strict';var _=require(_0x01b8('0x0'));var util=require(_0x01b8('0x1'));var logger=require('../../config/logger')(_0x01b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01b8('0x4'));var config=require(_0x01b8('0x5'));var attributes=require(_0x01b8('0x6'));module[_0x01b8('0x7')]=function(_0x2ca851,_0x359ee9){return _0x2ca851[_0x01b8('0x8')](_0x01b8('0x9'),attributes,{'tableName':_0x01b8('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x01b8('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38ca5d,_0xc5e351,_0x484495){var _0x47bd65=_0x2ca851[_0x01b8('0xc')];var _0x5a3ee0=_0x38ca5d['get']({'plain':!![]});if(_0x5a3ee0[_0x01b8('0xd')][_0x01b8('0xe')]()==='in'||_0x5a3ee0[_0x01b8('0xd')][_0x01b8('0xe')]()==='out'&&!_0x5a3ee0[_0x01b8('0xf')]&&!_[_0x01b8('0x10')](_0x5a3ee0[_0x01b8('0x11')])){_0x47bd65[_0x01b8('0x12')][_0x01b8('0x13')]({'where':{'id':_0x5a3ee0[_0x01b8('0x14')]}})[_0x01b8('0x15')](function(_0x337fdd){if(_0x337fdd){_0x337fdd[_0x01b8('0x16')]({'lastMsgAt':_0x5a3ee0[_0x01b8('0x17')],'lastMsgDirection':_0x5a3ee0[_0x01b8('0xd')][_0x01b8('0xe')]()});}})[_0x01b8('0x18')](function(_0xbca823){console[_0x01b8('0x19')](_0xbca823);});}if(_0x5a3ee0[_0x01b8('0xd')]==='out'&&!_0x5a3ee0[_0x01b8('0xf')]){var _0x3473f9;_0x47bd65[_0x01b8('0x1a')][_0x01b8('0x1b')]()[_0x01b8('0x15')](function(_0x4c4386){return _0x47bd65[_0x01b8('0x1c')][_0x01b8('0x1d')]({'where':{'id':_0x5a3ee0[_0x01b8('0x1e')]},'include':[{'model':_0x47bd65[_0x01b8('0x12')],'as':_0x01b8('0x1f'),'where':{'id':_0x5a3ee0[_0x01b8('0x14')]},'limit':0x1,'include':[{'model':_0x47bd65['CmContact'],'as':_0x01b8('0x20'),'attributes':_['keys'](_0x4c4386)}]}]});})['then'](function(_0x3543f3){_0x3473f9=_0x3543f3['get']({'plain':!![]});if(_0x3473f9&&_0x3473f9[_0x01b8('0x21')]){logger[_0x01b8('0x22')](_0x01b8('0x23'),'afterCreate',util['format'](_0x01b8('0x24'),_0x5a3ee0['id'],_0x3473f9[_0x01b8('0x21')]));if(_0x3473f9['Interactions']&&_0x3473f9[_0x01b8('0x1f')][_0x01b8('0x25')]){_0x5a3ee0[_0x01b8('0x26')]=_[_0x01b8('0x27')](_0x3473f9[_0x01b8('0x1f')][0x0],_0x01b8('0x20'));_0x5a3ee0[_0x01b8('0x20')]=_0x3473f9[_0x01b8('0x1f')][0x0][_0x01b8('0x20')];}var _0xc5e351={'method':'POST','uri':encodeURI(_0x3473f9[_0x01b8('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xc5e351[_0x01b8('0x28')]){case'GET':_0xc5e351['qs']=_0x5a3ee0;break;case _0x01b8('0x29'):_0xc5e351['body']=_0x5a3ee0;break;}return rp(_0xc5e351)[_0x01b8('0x15')](function(_0x47c9d9){logger[_0x01b8('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x01b8('0x2a'),util[_0x01b8('0x2b')](_0x01b8('0x2c'),_0x5a3ee0['id'],_0x3473f9[_0x01b8('0x21')]));if(_0x47c9d9[_0x01b8('0x2d')]['threadId']&&_0x47c9d9[_0x01b8('0x2d')]['threadId']!=_0x5a3ee0[_0x01b8('0x26')][_0x01b8('0x2e')]){return _0x47bd65[_0x01b8('0x12')]['update']({'threadId':_0x47c9d9[_0x01b8('0x2d')][_0x01b8('0x2e')]},{'logging':!![],'where':{'id':_0x5a3ee0[_0x01b8('0x26')]['id']}});}else{return;}})[_0x01b8('0x15')](function(){return _0x38ca5d[_0x01b8('0x16')]({'read':!![]});})['catch'](function(_0x1f31a4){logger[_0x01b8('0x19')](_0x01b8('0x23'),'afterCreate',util[_0x01b8('0x2f')](_0x1f31a4,{'showHidden':![],'depth':null}));_0x484495();});}else{_0x484495();}})[_0x01b8('0x30')](function(){_0x484495();});}else{_0x484495();}}},'charset':'utf8mb4','collate':_0x01b8('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 140afcf..c1a16aa 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x7ad192,_0x3dd0ae){var _0x187d3d=function(_0x4126aa){while(--_0x4126aa){_0x7ad192['push'](_0x7ad192['shift']());}};_0x187d3d(++_0x3dd0ae);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ce3fa,_0x2a15c2){_0x1ce3fa=_0x1ce3fa-0x0;var _0x27a3b5=_0xb10b[_0x1ce3fa];return _0x27a3b5;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x2d4c40,_0x53b0c0){var _0x3bb389=function(_0x8761f1){while(--_0x8761f1){_0x2d4c40['push'](_0x2d4c40['shift']());}};_0x3bb389(++_0x53b0c0);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ee748,_0x552a2b){_0x5ee748=_0x5ee748-0x0;var _0x36da37=_0xb10b[_0x5ee748];return _0x36da37;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 86ea40e..1ad628c 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 _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x472aa5,_0x3603a0){var _0x119db6=function(_0x4882af){while(--_0x4882af){_0x472aa5['push'](_0x472aa5['shift']());}};_0x119db6(++_0x3603a0);}(_0xaa88,0x137));var _0x8aa8=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0xaa88[_0x5a27e8];return _0x4e38f7;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file +var _0xbdb7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x399d76,_0xdc4493){_0x399d76=_0x399d76-0x0;var _0x3b19a1=_0xbdb7[_0x399d76];return _0x3b19a1;};'use strict';var OpenchannelMessageEvents=require(_0x7bdb('0x0'));var events=[_0x7bdb('0x1'),_0x7bdb('0x2'),_0x7bdb('0x3')];function createListener(_0x23c326,_0x433850){return function(_0x4496ac){_0x433850[_0x7bdb('0x4')](_0x23c326,_0x4496ac);};}function removeListener(_0x46c068,_0x47aec5){return function(){OpenchannelMessageEvents[_0x7bdb('0x5')](_0x46c068,_0x47aec5);};}exports['register']=function(_0x4b5fff){for(var _0xffdc86=0x0,_0x1e23a3=events['length'];_0xffdc86<_0x1e23a3;_0xffdc86++){var _0x513cba=events[_0xffdc86];var _0x468041=createListener(_0x7bdb('0x6')+_0x513cba,_0x4b5fff);OpenchannelMessageEvents['on'](_0x513cba,_0x468041);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 1a3de46..9a7c1b7 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 _0xd9ef=['util','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','delete','removeTeams','exports','multer'];(function(_0x23dda3,_0x3b639b){var _0x2b2e22=function(_0x267769){while(--_0x267769){_0x23dda3['push'](_0x23dda3['shift']());}};_0x2b2e22(++_0x3b639b);}(_0xd9ef,0x95));var _0xfd9e=function(_0x2578fd,_0x1dc018){_0x2578fd=_0x2578fd-0x0;var _0xc22c1a=_0xd9ef[_0x2578fd];return _0xc22c1a;};'use strict';var multer=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var path=require('path');var timeout=require(_0xfd9e('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfd9e('0x3'));var config=require(_0xfd9e('0x4'));var controller=require(_0xfd9e('0x5'));router[_0xfd9e('0x6')]('/',auth[_0xfd9e('0x7')](),controller[_0xfd9e('0x8')]);router[_0xfd9e('0x6')](_0xfd9e('0x9'),auth[_0xfd9e('0x7')](),controller[_0xfd9e('0xa')]);router[_0xfd9e('0x6')](_0xfd9e('0xb'),auth[_0xfd9e('0x7')](),controller['show']);router[_0xfd9e('0x6')](_0xfd9e('0xc'),auth['isAuthenticated'](),controller[_0xfd9e('0xd')]);router[_0xfd9e('0x6')](_0xfd9e('0xe'),auth['isAuthenticated'](),controller[_0xfd9e('0xf')]);router[_0xfd9e('0x6')](_0xfd9e('0x10'),auth[_0xfd9e('0x7')](),controller[_0xfd9e('0x11')]);router['post']('/',auth[_0xfd9e('0x7')](),controller[_0xfd9e('0x12')]);router[_0xfd9e('0x13')](_0xfd9e('0xe'),auth[_0xfd9e('0x7')](),controller[_0xfd9e('0x14')]);router[_0xfd9e('0x13')](_0xfd9e('0x10'),auth[_0xfd9e('0x7')](),controller[_0xfd9e('0x15')]);router['put'](_0xfd9e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfd9e('0x16')](_0xfd9e('0xb'),auth[_0xfd9e('0x7')](),controller['destroy']);router[_0xfd9e('0x16')](_0xfd9e('0xe'),auth[_0xfd9e('0x7')](),controller[_0xfd9e('0x17')]);router[_0xfd9e('0x16')](_0xfd9e('0x10'),auth[_0xfd9e('0x7')](),controller['removeAgents']);module[_0xfd9e('0x18')]=router; \ No newline at end of file +var _0x8375=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x8375,0xa8));var _0x5837=function(_0x15851e,_0x1e0cd0){_0x15851e=_0x15851e-0x0;var _0xe6b78d=_0x8375[_0x15851e];return _0xe6b78d;};'use strict';var multer=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var path=require(_0x5837('0x2'));var timeout=require('connect-timeout');var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var auth=require(_0x5837('0x5'));var interaction=require(_0x5837('0x6'));var config=require(_0x5837('0x7'));var controller=require(_0x5837('0x8'));router['get']('/',auth[_0x5837('0x9')](),controller[_0x5837('0xa')]);router[_0x5837('0xb')](_0x5837('0xc'),auth[_0x5837('0x9')](),controller['describe']);router['get'](_0x5837('0xd'),auth[_0x5837('0x9')](),controller['show']);router[_0x5837('0xb')]('/:id/members',auth[_0x5837('0x9')](),controller[_0x5837('0xe')]);router[_0x5837('0xb')](_0x5837('0xf'),auth[_0x5837('0x9')](),controller[_0x5837('0x10')]);router['get'](_0x5837('0x11'),auth[_0x5837('0x9')](),controller[_0x5837('0x12')]);router[_0x5837('0x13')]('/',auth[_0x5837('0x9')](),controller['create']);router['post']('/:id/teams',auth[_0x5837('0x9')](),controller[_0x5837('0x14')]);router[_0x5837('0x13')](_0x5837('0x11'),auth[_0x5837('0x9')](),controller[_0x5837('0x15')]);router[_0x5837('0x16')](_0x5837('0xd'),auth[_0x5837('0x9')](),controller['update']);router[_0x5837('0x17')](_0x5837('0xd'),auth['isAuthenticated'](),controller[_0x5837('0x18')]);router[_0x5837('0x17')](_0x5837('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x5837('0x11'),auth[_0x5837('0x9')](),controller[_0x5837('0x19')]);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 a17ec4b..1fabc5e 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 _0x539f=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x153e72,_0x1cde75){var _0x2d060f=function(_0xdfa3b0){while(--_0xdfa3b0){_0x153e72['push'](_0x153e72['shift']());}};_0x2d060f(++_0x1cde75);}(_0x539f,0xa2));var _0xf539=function(_0x2d58a2,_0x4541e9){_0x2d58a2=_0x2d58a2-0x0;var _0x5b759a=_0x539f[_0x2d58a2];return _0x5b759a;};'use strict';var Sequelize=require(_0xf539('0x0'));module[_0xf539('0x1')]={'name':{'type':Sequelize[_0xf539('0x2')],'unique':_0xf539('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf539('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf539('0x5')](_0xf539('0x6'),_0xf539('0x7'),_0xf539('0x8'))}}; \ No newline at end of file +var _0xd237=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x5020b0,_0x218f95){var _0x1b88a8=function(_0x138681){while(--_0x138681){_0x5020b0['push'](_0x5020b0['shift']());}};_0x1b88a8(++_0x218f95);}(_0xd237,0x12b));var _0x7d23=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xd237[_0x303c30];return _0x43161b;};'use strict';var Sequelize=require(_0x7d23('0x0'));module[_0x7d23('0x1')]={'name':{'type':Sequelize[_0x7d23('0x2')],'unique':_0x7d23('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7d23('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7d23('0x5'),_0x7d23('0x6'),_0x7d23('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ba65bef..0e9eebe 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 _0xccb8=['flatMap','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','html-pdf','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','limit','set','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','index','map','OpenchannelQueue','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','merge','find','create','body','user','role','UserProfileSection','autoAssociation','describe','findOne','OpenchannelQueueId','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','User','Agents','voicePause','interface'];(function(_0x4d6cf6,_0x53ec4e){var _0x5129eb=function(_0x3cb5bc){while(--_0x3cb5bc){_0x4d6cf6['push'](_0x4d6cf6['shift']());}};_0x5129eb(++_0x53ec4e);}(_0xccb8,0x12a));var _0x8ccb=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xccb8[_0x257642];return _0x3d813b;};'use strict';var pdf=require(_0x8ccb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8ccb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ccb('0x2'));var rp=require('request-promise');var moment=require(_0x8ccb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8ccb('0x4'));var path=require(_0x8ccb('0x5'));var sox=require(_0x8ccb('0x6'));var csv=require(_0x8ccb('0x7'));var ejs=require(_0x8ccb('0x8'));var fs=require('fs');var _=require(_0x8ccb('0x9'));var squel=require(_0x8ccb('0xa'));var crypto=require(_0x8ccb('0xb'));var jsforce=require(_0x8ccb('0xc'));var deskjs=require(_0x8ccb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8ccb('0xe'));var Papa=require(_0x8ccb('0xf'));var Redis=require(_0x8ccb('0x10'));var authService=require(_0x8ccb('0x11'));var qs=require(_0x8ccb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ccb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8ccb('0x14'));var config=require(_0x8ccb('0x15'));var licenseUtil=require(_0x8ccb('0x16'));var db=require(_0x8ccb('0x17'))['db'];config[_0x8ccb('0x18')]=_[_0x8ccb('0x19')](config[_0x8ccb('0x18')],{'host':_0x8ccb('0x1a'),'port':0x18eb});var socket=require(_0x8ccb('0x1b'))(new Redis(config[_0x8ccb('0x18')]));require(_0x8ccb('0x1c'))[_0x8ccb('0x1d')](socket);function respondWithStatusCode(_0x3624ef,_0x28c1af){_0x28c1af=_0x28c1af||0xcc;return function(_0x279c87){if(_0x279c87){return _0x3624ef['sendStatus'](_0x28c1af);}return _0x3624ef[_0x8ccb('0x1e')](_0x28c1af)[_0x8ccb('0x1f')]();};}function respondWithResult(_0x27b94c,_0x3137d1){_0x3137d1=_0x3137d1||0xc8;return function(_0x56d594){if(_0x56d594){return _0x27b94c[_0x8ccb('0x1e')](_0x3137d1)[_0x8ccb('0x20')](_0x56d594);}};}function respondWithFilteredResult(_0x3b082a,_0x520203){return function(_0x1259e8){if(_0x1259e8){var _0x1d215d=_0x1259e8['count'],_0x54e48b=_0x520203[_0x8ccb('0x21')],_0x52ae30=_0x520203['offset']+_0x520203[_0x8ccb('0x22')],_0x5c97fe;if(_0x52ae30>=_0x1d215d){_0x52ae30=_0x1d215d;_0x5c97fe=0xc8;}else{_0x5c97fe=0xce;}_0x3b082a['status'](_0x5c97fe);return _0x3b082a[_0x8ccb('0x23')]('Content-Range',_0x54e48b+'-'+_0x52ae30+'/'+_0x1d215d)['json'](_0x1259e8);}return null;};}function patchUpdates(_0x4ca348){return function(_0x3290d9){try{jsonpatch['apply'](_0x3290d9,_0x4ca348,!![]);}catch(_0x5278e2){return BPromise[_0x8ccb('0x24')](_0x5278e2);}return _0x3290d9['save']();};}function saveUpdates(_0x3f5416,_0x1e2722){return function(_0x52f25b){if(_0x52f25b){return _0x52f25b[_0x8ccb('0x25')](_0x3f5416)[_0x8ccb('0x26')](function(_0x31996f){return _0x31996f;});}return null;};}function removeEntity(_0x1a7402,_0x266754){return function(_0x53f8b7){if(_0x53f8b7){return _0x53f8b7[_0x8ccb('0x27')]()[_0x8ccb('0x26')](function(){var _0x5d9aad=_0x53f8b7[_0x8ccb('0x28')]({'plain':!![]});var _0x54ac33=_0x8ccb('0x29');return db[_0x8ccb('0x2a')]['destroy']({'where':{'type':_0x54ac33,'resourceId':_0x5d9aad['id']}})['then'](function(){return _0x53f8b7;});})[_0x8ccb('0x26')](function(){_0x1a7402['status'](0xcc)[_0x8ccb('0x1f')]();});}};}function handleEntityNotFound(_0x45add3,_0x30afbe){return function(_0x27a195){if(!_0x27a195){_0x45add3[_0x8ccb('0x2b')](0x194);}return _0x27a195;};}function handleError(_0xab102a,_0xbde86b){_0xbde86b=_0xbde86b||0x1f4;return function(_0x266241){logger[_0x8ccb('0x2c')](_0x266241['stack']);if(_0x266241['name']){delete _0x266241['name'];}_0xab102a[_0x8ccb('0x1e')](_0xbde86b)['send'](_0x266241);};}exports[_0x8ccb('0x2d')]=function(_0x297ae6,_0x676322){var _0xeb8e1={},_0x45e8bd={},_0xdf2b7c={'count':0x0,'rows':[]};var _0x3e77db=_[_0x8ccb('0x2e')](db[_0x8ccb('0x2f')][_0x8ccb('0x30')],function(_0x34c80f){return{'name':_0x34c80f['fieldName'],'type':_0x34c80f[_0x8ccb('0x31')][_0x8ccb('0x32')]};});_0x45e8bd[_0x8ccb('0x33')]=_['map'](_0x3e77db,_0x8ccb('0x34'));_0x45e8bd[_0x8ccb('0x35')]=_[_0x8ccb('0x36')](_0x297ae6[_0x8ccb('0x35')]);_0x45e8bd[_0x8ccb('0x37')]=_[_0x8ccb('0x38')](_0x45e8bd[_0x8ccb('0x33')],_0x45e8bd[_0x8ccb('0x35')]);_0xeb8e1[_0x8ccb('0x39')]=_['intersection'](_0x45e8bd[_0x8ccb('0x33')],qs['fields'](_0x297ae6[_0x8ccb('0x35')]['fields']));_0xeb8e1['attributes']=_0xeb8e1[_0x8ccb('0x39')][_0x8ccb('0x3a')]?_0xeb8e1[_0x8ccb('0x39')]:_0x45e8bd[_0x8ccb('0x33')];if(!_0x297ae6[_0x8ccb('0x35')][_0x8ccb('0x3b')](_0x8ccb('0x3c'))){_0xeb8e1[_0x8ccb('0x22')]=qs['limit'](_0x297ae6[_0x8ccb('0x35')][_0x8ccb('0x22')]);_0xeb8e1[_0x8ccb('0x21')]=qs['offset'](_0x297ae6[_0x8ccb('0x35')]['offset']);}_0xeb8e1[_0x8ccb('0x3d')]=qs[_0x8ccb('0x3e')](_0x297ae6[_0x8ccb('0x35')]['sort']);_0xeb8e1[_0x8ccb('0x3f')]=qs[_0x8ccb('0x37')](_[_0x8ccb('0x40')](_0x297ae6[_0x8ccb('0x35')],_0x45e8bd[_0x8ccb('0x37')]),_0x3e77db);if(_0x297ae6[_0x8ccb('0x35')][_0x8ccb('0x41')]){_0xeb8e1['where']=_['merge'](_0xeb8e1[_0x8ccb('0x3f')],{'$or':_[_0x8ccb('0x2e')](_0x3e77db,function(_0x37efa7){if(_0x37efa7[_0x8ccb('0x31')]!==_0x8ccb('0x42')){var _0x359596={};_0x359596[_0x37efa7['name']]={'$like':'%'+_0x297ae6[_0x8ccb('0x35')]['filter']+'%'};return _0x359596;}})});}_0xeb8e1=_['merge']({},_0xeb8e1,_0x297ae6[_0x8ccb('0x43')]);var _0xd7143f={'where':_0xeb8e1[_0x8ccb('0x3f')]};return db['OpenchannelQueue'][_0x8ccb('0x44')](_0xd7143f)[_0x8ccb('0x26')](function(_0x1aa306){_0xdf2b7c[_0x8ccb('0x44')]=_0x1aa306;if(_0x297ae6[_0x8ccb('0x35')][_0x8ccb('0x45')]){_0xeb8e1[_0x8ccb('0x46')]=[{'all':!![]}];}return db[_0x8ccb('0x2f')][_0x8ccb('0x47')](_0xeb8e1);})['then'](function(_0x5efa40){_0xdf2b7c[_0x8ccb('0x48')]=_0x5efa40;return _0xdf2b7c;})[_0x8ccb('0x26')](respondWithFilteredResult(_0x676322,_0xeb8e1))[_0x8ccb('0x49')](handleError(_0x676322,null));};exports[_0x8ccb('0x4a')]=function(_0x5c5217,_0x3691dd){var _0x24fc7e={'raw':!![],'where':{'id':_0x5c5217[_0x8ccb('0x4b')]['id']}},_0xc50936={};_0xc50936[_0x8ccb('0x33')]=_[_0x8ccb('0x36')](db['OpenchannelQueue'][_0x8ccb('0x30')]);_0xc50936['query']=_[_0x8ccb('0x36')](_0x5c5217['query']);_0xc50936[_0x8ccb('0x37')]=_[_0x8ccb('0x38')](_0xc50936[_0x8ccb('0x33')],_0xc50936[_0x8ccb('0x35')]);_0x24fc7e['attributes']=_[_0x8ccb('0x38')](_0xc50936[_0x8ccb('0x33')],qs[_0x8ccb('0x4c')](_0x5c5217[_0x8ccb('0x35')][_0x8ccb('0x4c')]));_0x24fc7e['attributes']=_0x24fc7e['attributes'][_0x8ccb('0x3a')]?_0x24fc7e[_0x8ccb('0x39')]:_0xc50936['model'];if(_0x5c5217[_0x8ccb('0x35')][_0x8ccb('0x45')]){_0x24fc7e[_0x8ccb('0x46')]=[{'all':!![]}];}_0x24fc7e=_[_0x8ccb('0x4d')]({},_0x24fc7e,_0x5c5217[_0x8ccb('0x43')]);return db['OpenchannelQueue'][_0x8ccb('0x4e')](_0x24fc7e)[_0x8ccb('0x26')](handleEntityNotFound(_0x3691dd,null))['then'](respondWithResult(_0x3691dd,null))[_0x8ccb('0x49')](handleError(_0x3691dd,null));};exports[_0x8ccb('0x4f')]=function(_0x4a7ecc,_0x274942){return db[_0x8ccb('0x2f')][_0x8ccb('0x4f')](_0x4a7ecc[_0x8ccb('0x50')],{})['then'](function(_0xf6d2b){var _0x5d8211=_0x4a7ecc[_0x8ccb('0x51')][_0x8ccb('0x28')]({'plain':!![]});if(!_0x5d8211)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d8211[_0x8ccb('0x52')]==='user'){var _0x18f5d9=_0xf6d2b['get']({'plain':!![]});var _0x557b3d=_0x8ccb('0x29');return db[_0x8ccb('0x53')][_0x8ccb('0x4e')]({'where':{'name':_0x557b3d,'userProfileId':_0x5d8211['userProfileId']},'raw':!![]})['then'](function(_0x26ae49){if(_0x26ae49&&_0x26ae49[_0x8ccb('0x54')]===0x0){return db[_0x8ccb('0x2a')]['create']({'name':_0x18f5d9[_0x8ccb('0x34')],'resourceId':_0x18f5d9['id'],'type':_0x26ae49['name'],'sectionId':_0x26ae49['id']},{})['then'](function(){return _0xf6d2b;});}else{return _0xf6d2b;}})[_0x8ccb('0x49')](function(_0x21891d){logger[_0x8ccb('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21891d);throw _0x21891d;});}return _0xf6d2b;})[_0x8ccb('0x26')](respondWithResult(_0x274942,0xc9))[_0x8ccb('0x49')](handleError(_0x274942,null));};exports[_0x8ccb('0x25')]=function(_0x1fed1a,_0x1eabd0){if(_0x1fed1a['body']['id']){delete _0x1fed1a[_0x8ccb('0x50')]['id'];}return db[_0x8ccb('0x2f')][_0x8ccb('0x4e')]({'where':{'id':_0x1fed1a[_0x8ccb('0x4b')]['id']}})[_0x8ccb('0x26')](handleEntityNotFound(_0x1eabd0,null))[_0x8ccb('0x26')](saveUpdates(_0x1fed1a[_0x8ccb('0x50')],null))[_0x8ccb('0x26')](respondWithResult(_0x1eabd0,null))[_0x8ccb('0x49')](handleError(_0x1eabd0,null));};exports[_0x8ccb('0x27')]=function(_0xdb87c9,_0x3a20e2){return db[_0x8ccb('0x2f')]['find']({'where':{'id':_0xdb87c9[_0x8ccb('0x4b')]['id']}})[_0x8ccb('0x26')](handleEntityNotFound(_0x3a20e2,null))[_0x8ccb('0x26')](removeEntity(_0x3a20e2,null))[_0x8ccb('0x49')](handleError(_0x3a20e2,null));};exports[_0x8ccb('0x55')]=function(_0x1cdb04,_0x4cdca2){return db[_0x8ccb('0x2f')][_0x8ccb('0x55')]()[_0x8ccb('0x26')](respondWithResult(_0x4cdca2,null))[_0x8ccb('0x49')](handleError(_0x4cdca2,null));};exports['getMembers']=function(_0xbcc1e2,_0x3ecd51,_0x12245c){var _0x42293e={'raw':!![],'where':{}},_0x448251={},_0x296b41;return db[_0x8ccb('0x2f')][_0x8ccb('0x56')]({'where':{'id':_0xbcc1e2[_0x8ccb('0x4b')]['id']}})[_0x8ccb('0x26')](handleEntityNotFound(_0x3ecd51,null))['then'](function(_0x139771){if(_0x139771){_0x296b41=_0x139771[_0x8ccb('0x28')]({'plain':!![]});_0x448251['model']=_['keys'](db['UserOpenchannelQueue'][_0x8ccb('0x30')]);_0x448251[_0x8ccb('0x35')]=_[_0x8ccb('0x36')](_0xbcc1e2['query']);_0x448251[_0x8ccb('0x37')]=_[_0x8ccb('0x38')](_0x448251[_0x8ccb('0x33')],_0x448251[_0x8ccb('0x35')]);_0x42293e[_0x8ccb('0x39')]=_['intersection'](_0x448251[_0x8ccb('0x33')],qs[_0x8ccb('0x4c')](_0xbcc1e2[_0x8ccb('0x35')][_0x8ccb('0x4c')]));_0x42293e[_0x8ccb('0x39')]=_0x42293e[_0x8ccb('0x39')][_0x8ccb('0x3a')]?_0x42293e['attributes']:_0x448251['model'];if(!_0xbcc1e2[_0x8ccb('0x35')][_0x8ccb('0x3b')](_0x8ccb('0x3c'))){_0x42293e[_0x8ccb('0x22')]=qs[_0x8ccb('0x22')](_0xbcc1e2['query']['limit']);_0x42293e['offset']=qs['offset'](_0xbcc1e2[_0x8ccb('0x35')][_0x8ccb('0x21')]);}_0x42293e['order']=qs[_0x8ccb('0x3e')](_0xbcc1e2['query'][_0x8ccb('0x3e')]);_0x42293e['where']=qs[_0x8ccb('0x37')](_[_0x8ccb('0x40')](_0xbcc1e2[_0x8ccb('0x35')],_0x448251[_0x8ccb('0x37')]));_0x42293e[_0x8ccb('0x3f')][_0x8ccb('0x57')]=_0x139771['id'];if(_0xbcc1e2[_0x8ccb('0x35')][_0x8ccb('0x41')]){_0x42293e[_0x8ccb('0x3f')]=_['merge'](_0x42293e[_0x8ccb('0x3f')],{'$or':_[_0x8ccb('0x2e')](_0x42293e[_0x8ccb('0x39')],function(_0x16420c){var _0x229431={};_0x229431[_0x16420c]={'$like':'%'+_0xbcc1e2['query'][_0x8ccb('0x41')]+'%'};return _0x229431;})});}_0x42293e=_[_0x8ccb('0x4d')]({},_0x42293e,_0xbcc1e2[_0x8ccb('0x43')]);return db['UserOpenchannelQueue'][_0x8ccb('0x47')](_0x42293e);}})[_0x8ccb('0x26')](function(_0x30c916){if(_0x30c916){return db['User']['findAndCountAll']({'where':{'id':_[_0x8ccb('0x2e')](_0x30c916,_0x8ccb('0x58')),'role':_0x8ccb('0x59')},'attributes':['id',_0x8ccb('0x34'),_0x8ccb('0x5a'),'updatedAt',_0x8ccb('0x5b')]});}})[_0x8ccb('0x26')](function(_0x5ebe9e){if(_0x5ebe9e){return{'count':_0x5ebe9e[_0x8ccb('0x44')],'rows':_[_0x8ccb('0x2e')](_0x5ebe9e[_0x8ccb('0x48')],function(_0x586014){return{'membername':_0x586014[_0x8ccb('0x34')],'UserId':_0x586014['id'],'queue_name':_0x296b41[_0x8ccb('0x34')],'OpenchannelQueueId':_0x296b41['id'],'interface':util[_0x8ccb('0x5c')](_0x8ccb('0x5d'),_0x8ccb('0x5e'),_0x586014[_0x8ccb('0x34')]),'penalty':0x0,'paused':_0x586014[_0x8ccb('0x5a')],'createdAt':_0x586014[_0x8ccb('0x5b')],'updatedAt':_0x586014[_0x8ccb('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8ccb('0x26')](respondWithFilteredResult(_0x3ecd51,_0x42293e))['catch'](handleError(_0x3ecd51,null));};exports[_0x8ccb('0x60')]=function(_0x1432b7,_0x5f592f,_0x31ebc1){var _0x59a0a9={};var _0x23b725={};var _0x24e3cc;var _0x43dad9;return db[_0x8ccb('0x2f')][_0x8ccb('0x56')]({'where':{'id':_0x1432b7[_0x8ccb('0x4b')]['id']}})[_0x8ccb('0x26')](handleEntityNotFound(_0x5f592f,null))[_0x8ccb('0x26')](function(_0x1efbb){if(_0x1efbb){_0x24e3cc=_0x1efbb;_0x23b725[_0x8ccb('0x33')]=_[_0x8ccb('0x36')](db['Team'][_0x8ccb('0x30')]);_0x23b725[_0x8ccb('0x35')]=_[_0x8ccb('0x36')](_0x1432b7[_0x8ccb('0x35')]);_0x23b725[_0x8ccb('0x37')]=_[_0x8ccb('0x38')](_0x23b725[_0x8ccb('0x33')],_0x23b725['query']);_0x59a0a9[_0x8ccb('0x39')]=_[_0x8ccb('0x38')](_0x23b725['model'],qs[_0x8ccb('0x4c')](_0x1432b7['query']['fields']));_0x59a0a9[_0x8ccb('0x39')]=_0x59a0a9['attributes'][_0x8ccb('0x3a')]?_0x59a0a9[_0x8ccb('0x39')]:_0x23b725['model'];_0x59a0a9['order']=qs[_0x8ccb('0x3e')](_0x1432b7[_0x8ccb('0x35')][_0x8ccb('0x3e')]);_0x59a0a9['where']=qs[_0x8ccb('0x37')](_[_0x8ccb('0x40')](_0x1432b7['query'],_0x23b725[_0x8ccb('0x37')]));if(_0x1432b7[_0x8ccb('0x35')][_0x8ccb('0x41')]){_0x59a0a9[_0x8ccb('0x3f')]=_[_0x8ccb('0x4d')](_0x59a0a9['where'],{'$or':_[_0x8ccb('0x2e')](_0x59a0a9[_0x8ccb('0x39')],function(_0xc4daa1){var _0x17ba97={};_0x17ba97[_0xc4daa1]={'$like':'%'+_0x1432b7['query'][_0x8ccb('0x41')]+'%'};return _0x17ba97;})});}_0x59a0a9=_[_0x8ccb('0x4d')]({},_0x59a0a9,_0x1432b7[_0x8ccb('0x43')]);return _0x24e3cc[_0x8ccb('0x60')](_0x59a0a9);}})[_0x8ccb('0x26')](function(_0x2ae1e8){if(_0x2ae1e8){_0x43dad9=_0x2ae1e8[_0x8ccb('0x3a')];if(!_0x1432b7['query'][_0x8ccb('0x3b')](_0x8ccb('0x3c'))){_0x59a0a9[_0x8ccb('0x22')]=qs['limit'](_0x1432b7[_0x8ccb('0x35')][_0x8ccb('0x22')]);_0x59a0a9['offset']=qs[_0x8ccb('0x21')](_0x1432b7[_0x8ccb('0x35')]['offset']);}return _0x24e3cc[_0x8ccb('0x60')](_0x59a0a9);}})[_0x8ccb('0x26')](function(_0x3df974){if(_0x3df974){return _0x3df974?{'count':_0x43dad9,'rows':_0x3df974}:null;}})[_0x8ccb('0x26')](respondWithResult(_0x5f592f,null))['catch'](handleError(_0x5f592f,null));};exports[_0x8ccb('0x61')]=function(_0x1a8452,_0x484f52,_0x25a2bf){var _0x596101=_0x1a8452[_0x8ccb('0x50')][_0x8ccb('0x62')];return db[_0x8ccb('0x63')][_0x8ccb('0x47')]({'where':{'id':_0x596101},'attributes':['id'],'include':[{'model':db[_0x8ccb('0x64')],'as':_0x8ccb('0x65'),'attributes':['id',_0x8ccb('0x34'),'online',_0x8ccb('0x66'),_0x8ccb('0x67')],'raw':!![]}]})['then'](function(_0x4ac01e){if(_0x4ac01e){var _0x5e62dc=_[_0x8ccb('0x68')](_0x4ac01e,function(_0x55a121){var _0xdd1387=_0x55a121[_0x8ccb('0x28')]({'plain':!![]});return _0xdd1387[_0x8ccb('0x65')];});return db[_0x8ccb('0x2f')][_0x8ccb('0x4e')]({'where':{'id':_0x1a8452[_0x8ccb('0x4b')]['id']}})[_0x8ccb('0x26')](function(_0x194f54){return db['sequelize']['transaction'](function(_0x427e5e){return _0x194f54[_0x8ccb('0x61')](_0x596101,{'transaction':_0x427e5e})[_0x8ccb('0x26')](function(){return BPromise[_0x8ccb('0x69')](_0x5e62dc,function(_0x391368){return db['UserOpenchannelQueue'][_0x8ccb('0x6a')]({'where':{'UserId':_0x391368['id'],'OpenchannelQueueId':_0x1a8452[_0x8ccb('0x4b')]['id']},'transaction':_0x427e5e});});})[_0x8ccb('0x26')](function(){_0x5e62dc[_0x8ccb('0x6b')](function(_0x3bf11c){socket[_0x8ccb('0x6c')](_0x8ccb('0x6d'),{'UserId':_0x3bf11c['id'],'OpenchannelQueueId':_0x194f54['id']});});});});});}})[_0x8ccb('0x26')](respondWithStatusCode(_0x484f52,null))[_0x8ccb('0x49')](handleError(_0x484f52,null));};exports[_0x8ccb('0x6e')]=function(_0x5a401f,_0x55726f,_0x11fd6a){return db['Team'][_0x8ccb('0x47')]({'where':{'id':_0x5a401f[_0x8ccb('0x35')][_0x8ccb('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8ccb('0x65'),'attributes':['id'],'raw':!![]}]})[_0x8ccb('0x26')](handleEntityNotFound(_0x55726f,null))[_0x8ccb('0x26')](function(_0x1bff44){var _0x1780a8=_['map'](_0x1bff44,'id');var _0x3a030b=[];var _0x2dc421=[];var _0x330d4d=squel[_0x8ccb('0x6f')]();_0x330d4d[_0x8ccb('0x70')]('tq.TeamId')[_0x8ccb('0x71')](_0x8ccb('0x72'),'tq')[_0x8ccb('0x73')](_0x8ccb('0x74'),'ut',_0x8ccb('0x75'))[_0x8ccb('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x5a401f[_0x8ccb('0x4b')]['id']);for(var _0x4d3c93=0x0;_0x4d3c93<_0x1bff44['length'];_0x4d3c93+=0x1){let _0x220716=_0x1bff44[_0x4d3c93];for(var _0x1a5646=0x0;_0x1a5646<_0x220716[_0x8ccb('0x65')]['length'];_0x1a5646+=0x1){let _0x576d4a=_0x220716[_0x8ccb('0x65')][_0x1a5646];var _0x47e214=_0x330d4d[_0x8ccb('0x76')]();_0x47e214[_0x8ccb('0x3f')](_0x8ccb('0x77'),_0x576d4a['id']);_0x2dc421[_0x8ccb('0x78')](db[_0x8ccb('0x79')][_0x8ccb('0x35')](_0x47e214[_0x8ccb('0x7a')](),{'type':db[_0x8ccb('0x79')][_0x8ccb('0x7b')]['SELECT']})[_0x8ccb('0x26')](function(_0x25c3de){if(_0x25c3de[_0x8ccb('0x3a')]===0x1){return _0x576d4a['id'];}else{var _0x21c518=_['every'](_['map'](_0x25c3de,_0x8ccb('0x7c')),function(_0x571d2a){return _['includes'](_0x1780a8,_0x571d2a);});if(_0x21c518){return _0x576d4a['id'];}}}));}}return BPromise[_0x8ccb('0x7d')](_0x2dc421)['then'](function(_0x1baeab){_0x3a030b=_(_0x3a030b)[_0x8ccb('0x7e')](_0x1baeab)[_0x8ccb('0x7f')]()[_0x8ccb('0x80')]();return db[_0x8ccb('0x2f')][_0x8ccb('0x4e')]({'where':{'id':_0x5a401f[_0x8ccb('0x4b')]['id']}})['then'](function(_0x13646c){return db[_0x8ccb('0x79')]['transaction'](function(_0x5489cf){return _0x13646c[_0x8ccb('0x6e')](_0x5a401f[_0x8ccb('0x35')][_0x8ccb('0x62')],{'transaction':_0x5489cf})['then'](function(){if(!_['isEmpty'](_0x3a030b)){return _0x13646c[_0x8ccb('0x81')](_0x3a030b,{'transaction':_0x5489cf});}})[_0x8ccb('0x26')](function(){_0x3a030b['forEach'](function(_0x169b39){socket[_0x8ccb('0x6c')](_0x8ccb('0x82'),{'UserId':_0x169b39,'OpenchannelQueueId':_0x13646c['id']});});});});});});})['then'](respondWithStatusCode(_0x55726f,null))[_0x8ccb('0x49')](handleError(_0x55726f,null));};exports[_0x8ccb('0x83')]=function(_0x28a386,_0x70ca82,_0x566cb8){return db['OpenchannelQueue']['find']({'where':{'id':_0x28a386[_0x8ccb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x70ca82,null))[_0x8ccb('0x26')](function(_0x12bc03){if(_0x12bc03){return _0x12bc03[_0x8ccb('0x83')](_0x28a386[_0x8ccb('0x50')]['ids'],_['omit'](_0x28a386[_0x8ccb('0x50')],['ids','id'])||{})['spread'](function(_0x28f28b){for(var _0x729875=0x0;_0x729875<_0x28a386[_0x8ccb('0x50')]['ids'][_0x8ccb('0x3a')];_0x729875+=0x1){socket[_0x8ccb('0x6c')](_0x8ccb('0x6d'),{'UserId':_0x28a386[_0x8ccb('0x50')][_0x8ccb('0x62')][_0x729875],'OpenchannelQueueId':_0x28a386[_0x8ccb('0x4b')]['id']});}return _0x28f28b;});}})[_0x8ccb('0x26')](respondWithResult(_0x70ca82,null))[_0x8ccb('0x49')](handleError(_0x70ca82,null));};exports['removeAgents']=function(_0x5596eb,_0x118c60,_0x5a53ed){return db['OpenchannelQueue'][_0x8ccb('0x4e')]({'where':{'id':_0x5596eb['params']['id']}})[_0x8ccb('0x26')](handleEntityNotFound(_0x118c60,null))[_0x8ccb('0x26')](function(_0x422d65){if(_0x422d65){return _0x422d65[_0x8ccb('0x81')](_0x5596eb['query']['ids'])[_0x8ccb('0x26')](function(){if(_[_0x8ccb('0x84')](_0x5596eb[_0x8ccb('0x35')]['ids'])){for(var _0x486b6f=0x0;_0x486b6f<_0x5596eb['query']['ids'][_0x8ccb('0x3a')];_0x486b6f+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5596eb['query'][_0x8ccb('0x62')][_0x486b6f]),'OpenchannelQueueId':Number(_0x5596eb[_0x8ccb('0x4b')]['id'])});}}else{socket[_0x8ccb('0x6c')](_0x8ccb('0x82'),{'UserId':Number(_0x5596eb['query']['ids']),'OpenchannelQueueId':Number(_0x5596eb[_0x8ccb('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x118c60,null))[_0x8ccb('0x49')](handleError(_0x118c60,null));};exports['getAgents']=function(_0x35033c,_0x780a5e,_0x21fe3d){var _0x4fc829={};var _0x537526={};var _0x13e77a;var _0x595203;return db[_0x8ccb('0x2f')][_0x8ccb('0x56')]({'where':{'id':_0x35033c[_0x8ccb('0x4b')]['id']}})[_0x8ccb('0x26')](handleEntityNotFound(_0x780a5e,null))[_0x8ccb('0x26')](function(_0x58b941){if(_0x58b941){_0x13e77a=_0x58b941;_0x537526[_0x8ccb('0x33')]=_[_0x8ccb('0x36')](db[_0x8ccb('0x64')]['rawAttributes']);_0x537526[_0x8ccb('0x35')]=_[_0x8ccb('0x36')](_0x35033c['query']);_0x537526[_0x8ccb('0x37')]=_[_0x8ccb('0x38')](_0x537526['model'],_0x537526['query']);_0x4fc829[_0x8ccb('0x39')]=_[_0x8ccb('0x38')](_0x537526['model'],qs[_0x8ccb('0x4c')](_0x35033c[_0x8ccb('0x35')][_0x8ccb('0x4c')]));_0x4fc829[_0x8ccb('0x39')]=_0x4fc829[_0x8ccb('0x39')][_0x8ccb('0x3a')]?_0x4fc829[_0x8ccb('0x39')]:_0x537526[_0x8ccb('0x33')];_0x4fc829[_0x8ccb('0x3d')]=qs[_0x8ccb('0x3e')](_0x35033c[_0x8ccb('0x35')][_0x8ccb('0x3e')]);_0x4fc829[_0x8ccb('0x3f')]=qs[_0x8ccb('0x37')](_['pick'](_0x35033c['query'],_0x537526[_0x8ccb('0x37')]));if(_0x35033c[_0x8ccb('0x35')][_0x8ccb('0x41')]){_0x4fc829[_0x8ccb('0x3f')]=_[_0x8ccb('0x4d')](_0x4fc829['where'],{'$or':_['map'](_0x4fc829[_0x8ccb('0x39')],function(_0x475104){var _0x187afb={};_0x187afb[_0x475104]={'$like':'%'+_0x35033c[_0x8ccb('0x35')][_0x8ccb('0x41')]+'%'};return _0x187afb;})});}_0x4fc829=_[_0x8ccb('0x4d')]({},_0x4fc829,_0x35033c[_0x8ccb('0x43')]);return _0x13e77a[_0x8ccb('0x85')](_0x4fc829);}})['then'](function(_0x163afa){if(_0x163afa){_0x595203=_0x163afa[_0x8ccb('0x3a')];if(!_0x35033c['query']['hasOwnProperty'](_0x8ccb('0x3c'))){_0x4fc829['limit']=qs['limit'](_0x35033c[_0x8ccb('0x35')][_0x8ccb('0x22')]);_0x4fc829[_0x8ccb('0x21')]=qs[_0x8ccb('0x21')](_0x35033c[_0x8ccb('0x35')][_0x8ccb('0x21')]);}return _0x13e77a['getAgents'](_0x4fc829);}})[_0x8ccb('0x26')](function(_0x8399f4){if(_0x8399f4){return _0x8399f4?{'count':_0x595203,'rows':_0x8399f4}:null;}})['then'](respondWithResult(_0x780a5e,null))[_0x8ccb('0x49')](handleError(_0x780a5e,null));}; \ No newline at end of file +var _0xd9c9=['html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','offset','Content-Range','json','apply','reject','destroy','then','get','OpenchannelQueues','error','stack','name','send','index','map','OpenchannelQueue','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','length','sort','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents'];(function(_0x413e2f,_0x4ae98c){var _0x110e87=function(_0x16de3c){while(--_0x16de3c){_0x413e2f['push'](_0x413e2f['shift']());}};_0x110e87(++_0x4ae98c);}(_0xd9c9,0x8d));var _0x9d9c=function(_0x4a5cce,_0x34265f){_0x4a5cce=_0x4a5cce-0x0;var _0x347252=_0xd9c9[_0x4a5cce];return _0x347252;};'use strict';var pdf=require(_0x9d9c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d9c('0x1'));var jsonpatch=require(_0x9d9c('0x2'));var rp=require(_0x9d9c('0x3'));var moment=require(_0x9d9c('0x4'));var BPromise=require(_0x9d9c('0x5'));var Mustache=require(_0x9d9c('0x6'));var util=require(_0x9d9c('0x7'));var path=require(_0x9d9c('0x8'));var sox=require(_0x9d9c('0x9'));var csv=require(_0x9d9c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9d9c('0xb'));var squel=require(_0x9d9c('0xc'));var crypto=require(_0x9d9c('0xd'));var jsforce=require(_0x9d9c('0xe'));var deskjs=require(_0x9d9c('0xf'));var toCsv=require(_0x9d9c('0xa'));var querystring=require(_0x9d9c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9d9c('0x11'));var hardwareService=require(_0x9d9c('0x12'));var logger=require('../../config/logger')(_0x9d9c('0x13'));var utils=require(_0x9d9c('0x14'));var config=require(_0x9d9c('0x15'));var licenseUtil=require(_0x9d9c('0x16'));var db=require(_0x9d9c('0x17'))['db'];config[_0x9d9c('0x18')]=_[_0x9d9c('0x19')](config[_0x9d9c('0x18')],{'host':_0x9d9c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d9c('0x18')]));require(_0x9d9c('0x1b'))[_0x9d9c('0x1c')](socket);function respondWithStatusCode(_0x18adff,_0x233a96){_0x233a96=_0x233a96||0xcc;return function(_0x174504){if(_0x174504){return _0x18adff[_0x9d9c('0x1d')](_0x233a96);}return _0x18adff[_0x9d9c('0x1e')](_0x233a96)[_0x9d9c('0x1f')]();};}function respondWithResult(_0x33900d,_0x36dc82){_0x36dc82=_0x36dc82||0xc8;return function(_0x7be298){if(_0x7be298){return _0x33900d[_0x9d9c('0x1e')](_0x36dc82)['json'](_0x7be298);}};}function respondWithFilteredResult(_0x439a50,_0x356a50){return function(_0xae63c2){if(_0xae63c2){var _0x3d53a1=_0xae63c2['count'],_0x26913c=_0x356a50['offset'],_0x3811ac=_0x356a50[_0x9d9c('0x20')]+_0x356a50['limit'],_0x18fd87;if(_0x3811ac>=_0x3d53a1){_0x3811ac=_0x3d53a1;_0x18fd87=0xc8;}else{_0x18fd87=0xce;}_0x439a50[_0x9d9c('0x1e')](_0x18fd87);return _0x439a50['set'](_0x9d9c('0x21'),_0x26913c+'-'+_0x3811ac+'/'+_0x3d53a1)[_0x9d9c('0x22')](_0xae63c2);}return null;};}function patchUpdates(_0x1fada8){return function(_0x6156f8){try{jsonpatch[_0x9d9c('0x23')](_0x6156f8,_0x1fada8,!![]);}catch(_0x41a014){return BPromise[_0x9d9c('0x24')](_0x41a014);}return _0x6156f8['save']();};}function saveUpdates(_0x516635,_0x5f3ee5){return function(_0xf3815d){if(_0xf3815d){return _0xf3815d['update'](_0x516635)['then'](function(_0x415574){return _0x415574;});}return null;};}function removeEntity(_0x11954e,_0x2e3926){return function(_0x32e0c1){if(_0x32e0c1){return _0x32e0c1[_0x9d9c('0x25')]()[_0x9d9c('0x26')](function(){var _0x11fd29=_0x32e0c1[_0x9d9c('0x27')]({'plain':!![]});var _0x5a286d=_0x9d9c('0x28');return db['UserProfileResource'][_0x9d9c('0x25')]({'where':{'type':_0x5a286d,'resourceId':_0x11fd29['id']}})[_0x9d9c('0x26')](function(){return _0x32e0c1;});})[_0x9d9c('0x26')](function(){_0x11954e[_0x9d9c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf54f42,_0x360c59){return function(_0x4a6196){if(!_0x4a6196){_0xf54f42['sendStatus'](0x194);}return _0x4a6196;};}function handleError(_0x5a0b76,_0x23a726){_0x23a726=_0x23a726||0x1f4;return function(_0x5dc224){logger[_0x9d9c('0x29')](_0x5dc224[_0x9d9c('0x2a')]);if(_0x5dc224[_0x9d9c('0x2b')]){delete _0x5dc224[_0x9d9c('0x2b')];}_0x5a0b76[_0x9d9c('0x1e')](_0x23a726)[_0x9d9c('0x2c')](_0x5dc224);};}exports[_0x9d9c('0x2d')]=function(_0x22b8bb,_0x189e32){var _0x2444cb={},_0x3bf66a={},_0x1aa268={'count':0x0,'rows':[]};var _0x1d6ce3=_[_0x9d9c('0x2e')](db[_0x9d9c('0x2f')]['rawAttributes'],function(_0x1f9676){return{'name':_0x1f9676[_0x9d9c('0x30')],'type':_0x1f9676[_0x9d9c('0x31')][_0x9d9c('0x32')]};});_0x3bf66a[_0x9d9c('0x33')]=_['map'](_0x1d6ce3,'name');_0x3bf66a['query']=_[_0x9d9c('0x34')](_0x22b8bb[_0x9d9c('0x35')]);_0x3bf66a[_0x9d9c('0x36')]=_[_0x9d9c('0x37')](_0x3bf66a[_0x9d9c('0x33')],_0x3bf66a['query']);_0x2444cb[_0x9d9c('0x38')]=_['intersection'](_0x3bf66a['model'],qs[_0x9d9c('0x39')](_0x22b8bb[_0x9d9c('0x35')]['fields']));_0x2444cb[_0x9d9c('0x38')]=_0x2444cb[_0x9d9c('0x38')]['length']?_0x2444cb[_0x9d9c('0x38')]:_0x3bf66a[_0x9d9c('0x33')];if(!_0x22b8bb['query'][_0x9d9c('0x3a')](_0x9d9c('0x3b'))){_0x2444cb[_0x9d9c('0x3c')]=qs[_0x9d9c('0x3c')](_0x22b8bb[_0x9d9c('0x35')][_0x9d9c('0x3c')]);_0x2444cb[_0x9d9c('0x20')]=qs[_0x9d9c('0x20')](_0x22b8bb[_0x9d9c('0x35')][_0x9d9c('0x20')]);}_0x2444cb[_0x9d9c('0x3d')]=qs['sort'](_0x22b8bb[_0x9d9c('0x35')]['sort']);_0x2444cb[_0x9d9c('0x3e')]=qs[_0x9d9c('0x36')](_[_0x9d9c('0x3f')](_0x22b8bb[_0x9d9c('0x35')],_0x3bf66a['filters']),_0x1d6ce3);if(_0x22b8bb[_0x9d9c('0x35')][_0x9d9c('0x40')]){_0x2444cb[_0x9d9c('0x3e')]=_['merge'](_0x2444cb[_0x9d9c('0x3e')],{'$or':_[_0x9d9c('0x2e')](_0x1d6ce3,function(_0x80ed27){if(_0x80ed27['type']!=='VIRTUAL'){var _0x10c1d9={};_0x10c1d9[_0x80ed27[_0x9d9c('0x2b')]]={'$like':'%'+_0x22b8bb[_0x9d9c('0x35')][_0x9d9c('0x40')]+'%'};return _0x10c1d9;}})});}_0x2444cb=_[_0x9d9c('0x41')]({},_0x2444cb,_0x22b8bb[_0x9d9c('0x42')]);var _0x17e8cc={'where':_0x2444cb[_0x9d9c('0x3e')]};return db[_0x9d9c('0x2f')][_0x9d9c('0x43')](_0x17e8cc)[_0x9d9c('0x26')](function(_0x15646e){_0x1aa268['count']=_0x15646e;if(_0x22b8bb[_0x9d9c('0x35')]['includeAll']){_0x2444cb['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x9d9c('0x44')](_0x2444cb);})['then'](function(_0x3d3a65){_0x1aa268[_0x9d9c('0x45')]=_0x3d3a65;return _0x1aa268;})[_0x9d9c('0x26')](respondWithFilteredResult(_0x189e32,_0x2444cb))[_0x9d9c('0x46')](handleError(_0x189e32,null));};exports[_0x9d9c('0x47')]=function(_0x12781e,_0x5f3524){var _0x1de227={'raw':!![],'where':{'id':_0x12781e[_0x9d9c('0x48')]['id']}},_0xbe8a37={};_0xbe8a37[_0x9d9c('0x33')]=_[_0x9d9c('0x34')](db[_0x9d9c('0x2f')][_0x9d9c('0x49')]);_0xbe8a37[_0x9d9c('0x35')]=_['keys'](_0x12781e['query']);_0xbe8a37[_0x9d9c('0x36')]=_[_0x9d9c('0x37')](_0xbe8a37[_0x9d9c('0x33')],_0xbe8a37[_0x9d9c('0x35')]);_0x1de227[_0x9d9c('0x38')]=_['intersection'](_0xbe8a37[_0x9d9c('0x33')],qs[_0x9d9c('0x39')](_0x12781e[_0x9d9c('0x35')][_0x9d9c('0x39')]));_0x1de227[_0x9d9c('0x38')]=_0x1de227[_0x9d9c('0x38')]['length']?_0x1de227[_0x9d9c('0x38')]:_0xbe8a37['model'];if(_0x12781e[_0x9d9c('0x35')][_0x9d9c('0x4a')]){_0x1de227['include']=[{'all':!![]}];}_0x1de227=_[_0x9d9c('0x41')]({},_0x1de227,_0x12781e[_0x9d9c('0x42')]);return db['OpenchannelQueue'][_0x9d9c('0x4b')](_0x1de227)[_0x9d9c('0x26')](handleEntityNotFound(_0x5f3524,null))[_0x9d9c('0x26')](respondWithResult(_0x5f3524,null))['catch'](handleError(_0x5f3524,null));};exports[_0x9d9c('0x4c')]=function(_0x564177,_0x543c92){return db['OpenchannelQueue'][_0x9d9c('0x4c')](_0x564177[_0x9d9c('0x4d')],{})[_0x9d9c('0x26')](function(_0x376ce4){var _0x5d73c9=_0x564177[_0x9d9c('0x4e')]['get']({'plain':!![]});if(!_0x5d73c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d73c9[_0x9d9c('0x4f')]===_0x9d9c('0x4e')){var _0x54d2ba=_0x376ce4[_0x9d9c('0x27')]({'plain':!![]});var _0x18bb07='OpenchannelQueues';return db[_0x9d9c('0x50')]['find']({'where':{'name':_0x18bb07,'userProfileId':_0x5d73c9[_0x9d9c('0x51')]},'raw':!![]})[_0x9d9c('0x26')](function(_0x3b4163){if(_0x3b4163&&_0x3b4163['autoAssociation']===0x0){return db[_0x9d9c('0x52')]['create']({'name':_0x54d2ba['name'],'resourceId':_0x54d2ba['id'],'type':_0x3b4163[_0x9d9c('0x2b')],'sectionId':_0x3b4163['id']},{})[_0x9d9c('0x26')](function(){return _0x376ce4;});}else{return _0x376ce4;}})[_0x9d9c('0x46')](function(_0x6f4da3){logger[_0x9d9c('0x29')](_0x9d9c('0x53'),_0x6f4da3);throw _0x6f4da3;});}return _0x376ce4;})[_0x9d9c('0x26')](respondWithResult(_0x543c92,0xc9))[_0x9d9c('0x46')](handleError(_0x543c92,null));};exports['update']=function(_0x4859b3,_0x2793c4){if(_0x4859b3[_0x9d9c('0x4d')]['id']){delete _0x4859b3[_0x9d9c('0x4d')]['id'];}return db['OpenchannelQueue'][_0x9d9c('0x4b')]({'where':{'id':_0x4859b3[_0x9d9c('0x48')]['id']}})[_0x9d9c('0x26')](handleEntityNotFound(_0x2793c4,null))[_0x9d9c('0x26')](saveUpdates(_0x4859b3[_0x9d9c('0x4d')],null))['then'](respondWithResult(_0x2793c4,null))[_0x9d9c('0x46')](handleError(_0x2793c4,null));};exports[_0x9d9c('0x25')]=function(_0x4157b9,_0x23c4ce){return db[_0x9d9c('0x2f')][_0x9d9c('0x4b')]({'where':{'id':_0x4157b9['params']['id']}})[_0x9d9c('0x26')](handleEntityNotFound(_0x23c4ce,null))[_0x9d9c('0x26')](removeEntity(_0x23c4ce,null))['catch'](handleError(_0x23c4ce,null));};exports[_0x9d9c('0x54')]=function(_0x1ffc4f,_0x2ba83d){return db[_0x9d9c('0x2f')][_0x9d9c('0x54')]()[_0x9d9c('0x26')](respondWithResult(_0x2ba83d,null))[_0x9d9c('0x46')](handleError(_0x2ba83d,null));};exports[_0x9d9c('0x55')]=function(_0x3c7634,_0x44f435,_0x54e88c){var _0x3cb8d9={'raw':!![],'where':{}},_0x9df55d={},_0x2f9f0d;return db[_0x9d9c('0x2f')][_0x9d9c('0x56')]({'where':{'id':_0x3c7634[_0x9d9c('0x48')]['id']}})[_0x9d9c('0x26')](handleEntityNotFound(_0x44f435,null))[_0x9d9c('0x26')](function(_0x3e4f9e){if(_0x3e4f9e){_0x2f9f0d=_0x3e4f9e['get']({'plain':!![]});_0x9df55d[_0x9d9c('0x33')]=_[_0x9d9c('0x34')](db[_0x9d9c('0x57')]['rawAttributes']);_0x9df55d[_0x9d9c('0x35')]=_[_0x9d9c('0x34')](_0x3c7634[_0x9d9c('0x35')]);_0x9df55d[_0x9d9c('0x36')]=_[_0x9d9c('0x37')](_0x9df55d['model'],_0x9df55d[_0x9d9c('0x35')]);_0x3cb8d9['attributes']=_[_0x9d9c('0x37')](_0x9df55d[_0x9d9c('0x33')],qs['fields'](_0x3c7634[_0x9d9c('0x35')]['fields']));_0x3cb8d9[_0x9d9c('0x38')]=_0x3cb8d9[_0x9d9c('0x38')][_0x9d9c('0x58')]?_0x3cb8d9[_0x9d9c('0x38')]:_0x9df55d[_0x9d9c('0x33')];if(!_0x3c7634['query'][_0x9d9c('0x3a')]('nolimit')){_0x3cb8d9[_0x9d9c('0x3c')]=qs[_0x9d9c('0x3c')](_0x3c7634[_0x9d9c('0x35')][_0x9d9c('0x3c')]);_0x3cb8d9[_0x9d9c('0x20')]=qs[_0x9d9c('0x20')](_0x3c7634[_0x9d9c('0x35')]['offset']);}_0x3cb8d9[_0x9d9c('0x3d')]=qs[_0x9d9c('0x59')](_0x3c7634[_0x9d9c('0x35')][_0x9d9c('0x59')]);_0x3cb8d9[_0x9d9c('0x3e')]=qs['filters'](_[_0x9d9c('0x3f')](_0x3c7634['query'],_0x9df55d['filters']));_0x3cb8d9[_0x9d9c('0x3e')]['OpenchannelQueueId']=_0x3e4f9e['id'];if(_0x3c7634[_0x9d9c('0x35')]['filter']){_0x3cb8d9[_0x9d9c('0x3e')]=_[_0x9d9c('0x41')](_0x3cb8d9[_0x9d9c('0x3e')],{'$or':_[_0x9d9c('0x2e')](_0x3cb8d9[_0x9d9c('0x38')],function(_0x1568b4){var _0x4157d6={};_0x4157d6[_0x1568b4]={'$like':'%'+_0x3c7634[_0x9d9c('0x35')]['filter']+'%'};return _0x4157d6;})});}_0x3cb8d9=_[_0x9d9c('0x41')]({},_0x3cb8d9,_0x3c7634[_0x9d9c('0x42')]);return db['UserOpenchannelQueue'][_0x9d9c('0x44')](_0x3cb8d9);}})['then'](function(_0x107246){if(_0x107246){return db[_0x9d9c('0x5a')][_0x9d9c('0x5b')]({'where':{'id':_[_0x9d9c('0x2e')](_0x107246,_0x9d9c('0x5c')),'role':_0x9d9c('0x5d')},'attributes':['id',_0x9d9c('0x2b'),_0x9d9c('0x5e'),_0x9d9c('0x5f'),'createdAt']});}})['then'](function(_0x59ca1e){if(_0x59ca1e){return{'count':_0x59ca1e[_0x9d9c('0x43')],'rows':_[_0x9d9c('0x2e')](_0x59ca1e[_0x9d9c('0x45')],function(_0x220dbb){return{'membername':_0x220dbb[_0x9d9c('0x2b')],'UserId':_0x220dbb['id'],'queue_name':_0x2f9f0d[_0x9d9c('0x2b')],'OpenchannelQueueId':_0x2f9f0d['id'],'interface':util[_0x9d9c('0x60')](_0x9d9c('0x61'),_0x9d9c('0x62'),_0x220dbb[_0x9d9c('0x2b')]),'penalty':0x0,'paused':_0x220dbb[_0x9d9c('0x5e')],'createdAt':_0x220dbb[_0x9d9c('0x63')],'updatedAt':_0x220dbb[_0x9d9c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d9c('0x26')](respondWithFilteredResult(_0x44f435,_0x3cb8d9))['catch'](handleError(_0x44f435,null));};exports[_0x9d9c('0x64')]=function(_0x1ec859,_0x18b485,_0x397921){var _0x19a740={};var _0x5e9623={};var _0x3fe3c7;var _0x49c4e9;return db[_0x9d9c('0x2f')]['findOne']({'where':{'id':_0x1ec859[_0x9d9c('0x48')]['id']}})['then'](handleEntityNotFound(_0x18b485,null))[_0x9d9c('0x26')](function(_0x23ec6c){if(_0x23ec6c){_0x3fe3c7=_0x23ec6c;_0x5e9623[_0x9d9c('0x33')]=_['keys'](db[_0x9d9c('0x65')]['rawAttributes']);_0x5e9623[_0x9d9c('0x35')]=_[_0x9d9c('0x34')](_0x1ec859[_0x9d9c('0x35')]);_0x5e9623[_0x9d9c('0x36')]=_['intersection'](_0x5e9623['model'],_0x5e9623[_0x9d9c('0x35')]);_0x19a740[_0x9d9c('0x38')]=_[_0x9d9c('0x37')](_0x5e9623[_0x9d9c('0x33')],qs[_0x9d9c('0x39')](_0x1ec859[_0x9d9c('0x35')][_0x9d9c('0x39')]));_0x19a740[_0x9d9c('0x38')]=_0x19a740['attributes'][_0x9d9c('0x58')]?_0x19a740[_0x9d9c('0x38')]:_0x5e9623['model'];_0x19a740[_0x9d9c('0x3d')]=qs[_0x9d9c('0x59')](_0x1ec859[_0x9d9c('0x35')]['sort']);_0x19a740[_0x9d9c('0x3e')]=qs['filters'](_[_0x9d9c('0x3f')](_0x1ec859[_0x9d9c('0x35')],_0x5e9623[_0x9d9c('0x36')]));if(_0x1ec859[_0x9d9c('0x35')][_0x9d9c('0x40')]){_0x19a740[_0x9d9c('0x3e')]=_[_0x9d9c('0x41')](_0x19a740['where'],{'$or':_[_0x9d9c('0x2e')](_0x19a740[_0x9d9c('0x38')],function(_0x149e4d){var _0x3be116={};_0x3be116[_0x149e4d]={'$like':'%'+_0x1ec859[_0x9d9c('0x35')][_0x9d9c('0x40')]+'%'};return _0x3be116;})});}_0x19a740=_[_0x9d9c('0x41')]({},_0x19a740,_0x1ec859[_0x9d9c('0x42')]);return _0x3fe3c7[_0x9d9c('0x64')](_0x19a740);}})[_0x9d9c('0x26')](function(_0x43d769){if(_0x43d769){_0x49c4e9=_0x43d769[_0x9d9c('0x58')];if(!_0x1ec859[_0x9d9c('0x35')]['hasOwnProperty'](_0x9d9c('0x3b'))){_0x19a740['limit']=qs[_0x9d9c('0x3c')](_0x1ec859[_0x9d9c('0x35')]['limit']);_0x19a740[_0x9d9c('0x20')]=qs[_0x9d9c('0x20')](_0x1ec859['query'][_0x9d9c('0x20')]);}return _0x3fe3c7[_0x9d9c('0x64')](_0x19a740);}})['then'](function(_0xd00e50){if(_0xd00e50){return _0xd00e50?{'count':_0x49c4e9,'rows':_0xd00e50}:null;}})['then'](respondWithResult(_0x18b485,null))[_0x9d9c('0x46')](handleError(_0x18b485,null));};exports[_0x9d9c('0x66')]=function(_0x5ab844,_0x1badc6,_0x18ffe1){var _0x26786b=_0x5ab844[_0x9d9c('0x4d')][_0x9d9c('0x67')];return db['Team'][_0x9d9c('0x44')]({'where':{'id':_0x26786b},'attributes':['id'],'include':[{'model':db[_0x9d9c('0x5a')],'as':_0x9d9c('0x68'),'attributes':['id','name',_0x9d9c('0x69'),_0x9d9c('0x6a'),'interface'],'raw':!![]}]})[_0x9d9c('0x26')](function(_0x5d3f26){if(_0x5d3f26){var _0x3152de=_[_0x9d9c('0x6b')](_0x5d3f26,function(_0x480bec){var _0x18541d=_0x480bec[_0x9d9c('0x27')]({'plain':!![]});return _0x18541d[_0x9d9c('0x68')];});return db[_0x9d9c('0x2f')][_0x9d9c('0x4b')]({'where':{'id':_0x5ab844[_0x9d9c('0x48')]['id']}})[_0x9d9c('0x26')](function(_0x3611d2){return db[_0x9d9c('0x6c')][_0x9d9c('0x6d')](function(_0x4a9949){return _0x3611d2['addTeams'](_0x26786b,{'transaction':_0x4a9949})[_0x9d9c('0x26')](function(){return BPromise[_0x9d9c('0x6e')](_0x3152de,function(_0x943b73){return db[_0x9d9c('0x57')][_0x9d9c('0x6f')]({'where':{'UserId':_0x943b73['id'],'OpenchannelQueueId':_0x5ab844[_0x9d9c('0x48')]['id']},'transaction':_0x4a9949});});})[_0x9d9c('0x26')](function(){_0x3152de[_0x9d9c('0x70')](function(_0x3ff07f){socket[_0x9d9c('0x71')](_0x9d9c('0x72'),{'UserId':_0x3ff07f['id'],'OpenchannelQueueId':_0x3611d2['id']});});});});});}})[_0x9d9c('0x26')](respondWithStatusCode(_0x1badc6,null))[_0x9d9c('0x46')](handleError(_0x1badc6,null));};exports[_0x9d9c('0x73')]=function(_0x20546d,_0x5a3c3e,_0x38748b){return db['Team'][_0x9d9c('0x44')]({'where':{'id':_0x20546d[_0x9d9c('0x35')][_0x9d9c('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9d9c('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a3c3e,null))[_0x9d9c('0x26')](function(_0xb0e957){var _0x39c90d=_['map'](_0xb0e957,'id');var _0x5a1509=[];var _0x1ece01=[];var _0x489b85=squel[_0x9d9c('0x74')]();_0x489b85[_0x9d9c('0x75')](_0x9d9c('0x76'))['from'](_0x9d9c('0x77'),'tq')[_0x9d9c('0x78')](_0x9d9c('0x79'),'ut',_0x9d9c('0x7a'))[_0x9d9c('0x3e')](_0x9d9c('0x7b'),_0x20546d[_0x9d9c('0x48')]['id']);for(var _0x22a81f=0x0;_0x22a81f<_0xb0e957[_0x9d9c('0x58')];_0x22a81f+=0x1){let _0x4aaebc=_0xb0e957[_0x22a81f];for(var _0x3c9389=0x0;_0x3c9389<_0x4aaebc[_0x9d9c('0x68')][_0x9d9c('0x58')];_0x3c9389+=0x1){let _0x3f575c=_0x4aaebc[_0x9d9c('0x68')][_0x3c9389];var _0x23eb21=_0x489b85[_0x9d9c('0x7c')]();_0x23eb21[_0x9d9c('0x3e')](_0x9d9c('0x7d'),_0x3f575c['id']);_0x1ece01[_0x9d9c('0x7e')](db['sequelize'][_0x9d9c('0x35')](_0x23eb21[_0x9d9c('0x7f')](),{'type':db[_0x9d9c('0x6c')][_0x9d9c('0x80')]['SELECT']})[_0x9d9c('0x26')](function(_0x460848){if(_0x460848[_0x9d9c('0x58')]===0x1){return _0x3f575c['id'];}else{var _0x581b89=_['every'](_[_0x9d9c('0x2e')](_0x460848,'TeamId'),function(_0x50d539){return _[_0x9d9c('0x81')](_0x39c90d,_0x50d539);});if(_0x581b89){return _0x3f575c['id'];}}}));}}return BPromise['all'](_0x1ece01)['then'](function(_0x3e5d3a){_0x5a1509=_(_0x5a1509)[_0x9d9c('0x82')](_0x3e5d3a)[_0x9d9c('0x83')]()[_0x9d9c('0x84')]();return db[_0x9d9c('0x2f')][_0x9d9c('0x4b')]({'where':{'id':_0x20546d[_0x9d9c('0x48')]['id']}})[_0x9d9c('0x26')](function(_0x17ea08){return db[_0x9d9c('0x6c')][_0x9d9c('0x6d')](function(_0x207ac7){return _0x17ea08['removeTeams'](_0x20546d['query'][_0x9d9c('0x67')],{'transaction':_0x207ac7})['then'](function(){if(!_[_0x9d9c('0x85')](_0x5a1509)){return _0x17ea08[_0x9d9c('0x86')](_0x5a1509,{'transaction':_0x207ac7});}})[_0x9d9c('0x26')](function(){_0x5a1509[_0x9d9c('0x70')](function(_0x45f862){socket['emit'](_0x9d9c('0x87'),{'UserId':_0x45f862,'OpenchannelQueueId':_0x17ea08['id']});});});});});});})['then'](respondWithStatusCode(_0x5a3c3e,null))['catch'](handleError(_0x5a3c3e,null));};exports[_0x9d9c('0x88')]=function(_0x48ac77,_0x965de4,_0x54d373){return db[_0x9d9c('0x2f')][_0x9d9c('0x4b')]({'where':{'id':_0x48ac77['params']['id']}})[_0x9d9c('0x26')](handleEntityNotFound(_0x965de4,null))[_0x9d9c('0x26')](function(_0x390e76){if(_0x390e76){return _0x390e76[_0x9d9c('0x88')](_0x48ac77['body'][_0x9d9c('0x67')],_[_0x9d9c('0x89')](_0x48ac77[_0x9d9c('0x4d')],[_0x9d9c('0x67'),'id'])||{})[_0x9d9c('0x8a')](function(_0x1ef5dc){for(var _0x478bca=0x0;_0x478bca<_0x48ac77[_0x9d9c('0x4d')][_0x9d9c('0x67')]['length'];_0x478bca+=0x1){socket[_0x9d9c('0x71')](_0x9d9c('0x72'),{'UserId':_0x48ac77[_0x9d9c('0x4d')][_0x9d9c('0x67')][_0x478bca],'OpenchannelQueueId':_0x48ac77[_0x9d9c('0x48')]['id']});}return _0x1ef5dc;});}})['then'](respondWithResult(_0x965de4,null))[_0x9d9c('0x46')](handleError(_0x965de4,null));};exports['removeAgents']=function(_0x47c1cb,_0x2274f9,_0xab9dc5){return db[_0x9d9c('0x2f')][_0x9d9c('0x4b')]({'where':{'id':_0x47c1cb[_0x9d9c('0x48')]['id']}})[_0x9d9c('0x26')](handleEntityNotFound(_0x2274f9,null))[_0x9d9c('0x26')](function(_0x1738c4){if(_0x1738c4){return _0x1738c4['removeAgents'](_0x47c1cb['query'][_0x9d9c('0x67')])[_0x9d9c('0x26')](function(){if(_[_0x9d9c('0x8b')](_0x47c1cb[_0x9d9c('0x35')][_0x9d9c('0x67')])){for(var _0x1966ae=0x0;_0x1966ae<_0x47c1cb['query'][_0x9d9c('0x67')][_0x9d9c('0x58')];_0x1966ae+=0x1){socket[_0x9d9c('0x71')](_0x9d9c('0x87'),{'UserId':Number(_0x47c1cb['query'][_0x9d9c('0x67')][_0x1966ae]),'OpenchannelQueueId':Number(_0x47c1cb['params']['id'])});}}else{socket['emit'](_0x9d9c('0x87'),{'UserId':Number(_0x47c1cb[_0x9d9c('0x35')]['ids']),'OpenchannelQueueId':Number(_0x47c1cb[_0x9d9c('0x48')]['id'])});}});}})[_0x9d9c('0x26')](respondWithStatusCode(_0x2274f9,null))[_0x9d9c('0x46')](handleError(_0x2274f9,null));};exports[_0x9d9c('0x8c')]=function(_0x26a138,_0x5c84b1,_0x342dc2){var _0x250416={};var _0x3bf5b8={};var _0x171972;var _0x15ba86;return db[_0x9d9c('0x2f')][_0x9d9c('0x56')]({'where':{'id':_0x26a138[_0x9d9c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c84b1,null))[_0x9d9c('0x26')](function(_0x2fcd61){if(_0x2fcd61){_0x171972=_0x2fcd61;_0x3bf5b8[_0x9d9c('0x33')]=_[_0x9d9c('0x34')](db[_0x9d9c('0x5a')][_0x9d9c('0x49')]);_0x3bf5b8[_0x9d9c('0x35')]=_[_0x9d9c('0x34')](_0x26a138[_0x9d9c('0x35')]);_0x3bf5b8[_0x9d9c('0x36')]=_[_0x9d9c('0x37')](_0x3bf5b8[_0x9d9c('0x33')],_0x3bf5b8['query']);_0x250416[_0x9d9c('0x38')]=_['intersection'](_0x3bf5b8[_0x9d9c('0x33')],qs[_0x9d9c('0x39')](_0x26a138[_0x9d9c('0x35')][_0x9d9c('0x39')]));_0x250416[_0x9d9c('0x38')]=_0x250416[_0x9d9c('0x38')][_0x9d9c('0x58')]?_0x250416[_0x9d9c('0x38')]:_0x3bf5b8['model'];_0x250416[_0x9d9c('0x3d')]=qs[_0x9d9c('0x59')](_0x26a138['query']['sort']);_0x250416[_0x9d9c('0x3e')]=qs[_0x9d9c('0x36')](_[_0x9d9c('0x3f')](_0x26a138[_0x9d9c('0x35')],_0x3bf5b8[_0x9d9c('0x36')]));if(_0x26a138[_0x9d9c('0x35')][_0x9d9c('0x40')]){_0x250416['where']=_[_0x9d9c('0x41')](_0x250416[_0x9d9c('0x3e')],{'$or':_[_0x9d9c('0x2e')](_0x250416['attributes'],function(_0x499ecc){var _0x45d83e={};_0x45d83e[_0x499ecc]={'$like':'%'+_0x26a138[_0x9d9c('0x35')]['filter']+'%'};return _0x45d83e;})});}_0x250416=_['merge']({},_0x250416,_0x26a138[_0x9d9c('0x42')]);return _0x171972[_0x9d9c('0x8c')](_0x250416);}})[_0x9d9c('0x26')](function(_0x40d761){if(_0x40d761){_0x15ba86=_0x40d761[_0x9d9c('0x58')];if(!_0x26a138['query'][_0x9d9c('0x3a')]('nolimit')){_0x250416['limit']=qs[_0x9d9c('0x3c')](_0x26a138[_0x9d9c('0x35')][_0x9d9c('0x3c')]);_0x250416[_0x9d9c('0x20')]=qs['offset'](_0x26a138[_0x9d9c('0x35')]['offset']);}return _0x171972[_0x9d9c('0x8c')](_0x250416);}})[_0x9d9c('0x26')](function(_0x35d7af){if(_0x35d7af){return _0x35d7af?{'count':_0x15ba86,'rows':_0x35d7af}:null;}})[_0x9d9c('0x26')](respondWithResult(_0x5c84b1,null))[_0x9d9c('0x46')](handleError(_0x5c84b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1ff4fc3..75570b1 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 _0x8268=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x8268,0xea));var _0x8826=function(_0x2dced0,_0x592342){_0x2dced0=_0x2dced0-0x0;var _0x2d71c9=_0x8268[_0x2dced0];return _0x2d71c9;};'use strict';var EventEmitter=require(_0x8826('0x0'));var OpenchannelQueue=require(_0x8826('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8826('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8826('0x3'),'afterDestroy':_0x8826('0x4')};function emitEvent(_0x1a5d14){return function(_0x3e61f,_0x4f4b75,_0xff79bc){OpenchannelQueueEvents[_0x8826('0x5')](_0x1a5d14+':'+_0x3e61f['id'],_0x3e61f);OpenchannelQueueEvents['emit'](_0x1a5d14,_0x3e61f);_0xff79bc(null);};}for(var e in events){if(events[_0x8826('0x6')](e)){var event=events[e];OpenchannelQueue[_0x8826('0x7')](e,emitEvent(event));}}module[_0x8826('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3959=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x205755,_0x306ce4){var _0x5b6ca8=function(_0x46a531){while(--_0x46a531){_0x205755['push'](_0x205755['shift']());}};_0x5b6ca8(++_0x306ce4);}(_0x3959,0x1eb));var _0x9395=function(_0x33cda2,_0x41711a){_0x33cda2=_0x33cda2-0x0;var _0x46a232=_0x3959[_0x33cda2];return _0x46a232;};'use strict';var EventEmitter=require(_0x9395('0x0'));var OpenchannelQueue=require(_0x9395('0x1'))['db'][_0x9395('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9395('0x3')](0x0);var events={'afterCreate':_0x9395('0x4'),'afterUpdate':_0x9395('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8e236e){return function(_0x5c3754,_0x473a4e,_0x2e4f14){OpenchannelQueueEvents[_0x9395('0x6')](_0x8e236e+':'+_0x5c3754['id'],_0x5c3754);OpenchannelQueueEvents[_0x9395('0x6')](_0x8e236e,_0x5c3754);_0x2e4f14(null);};}for(var e in events){if(events[_0x9395('0x7')](e)){var event=events[e];OpenchannelQueue[_0x9395('0x8')](e,emitEvent(event));}}module[_0x9395('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 b8d7ec0..5166347 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 _0x9956=['moment','request-promise','path','../../config/environment','exports','define','lodash','../../config/logger','api'];(function(_0x37d0a7,_0x3800a8){var _0x140f7e=function(_0x29fdc4){while(--_0x29fdc4){_0x37d0a7['push'](_0x37d0a7['shift']());}};_0x140f7e(++_0x3800a8);}(_0x9956,0x1b6));var _0x6995=function(_0x8d50d,_0x255141){_0x8d50d=_0x8d50d-0x0;var _0x35718e=_0x9956[_0x8d50d];return _0x35718e;};'use strict';var _=require(_0x6995('0x0'));var util=require('util');var logger=require(_0x6995('0x1'))(_0x6995('0x2'));var moment=require(_0x6995('0x3'));var BPromise=require('bluebird');var rp=require(_0x6995('0x4'));var fs=require('fs');var path=require(_0x6995('0x5'));var rimraf=require('rimraf');var config=require(_0x6995('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x6995('0x7')]=function(_0x5a7bfd,_0x521a48){return _0x5a7bfd[_0x6995('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x135b=['request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0xa4ac5e,_0x593dbf){var _0x435694=function(_0x46faa3){while(--_0x46faa3){_0xa4ac5e['push'](_0xa4ac5e['shift']());}};_0x435694(++_0x593dbf);}(_0x135b,0xaf));var _0xb135=function(_0x490d29,_0x5c227f){_0x490d29=_0x490d29-0x0;var _0x5cd549=_0x135b[_0x490d29];return _0x5cd549;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var moment=require('moment');var BPromise=require(_0xb135('0x4'));var rp=require(_0xb135('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));var attributes=require(_0xb135('0x8'));module['exports']=function(_0x51a09c,_0x5b96fe){return _0x51a09c[_0xb135('0x9')](_0xb135('0xa'),attributes,{'tableName':_0xb135('0xb'),'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 e656ae4..918e649 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 _0xda5e=['debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','map','include','model','catch','find','raw','then','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./openchannelQueue.socket','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2b53c5,_0x12fa06){var _0x1b847e=function(_0x1af5e9){while(--_0x1af5e9){_0x2b53c5['push'](_0x2b53c5['shift']());}};_0x1b847e(++_0x12fa06);}(_0xda5e,0x106));var _0xeda5=function(_0xb507bf,_0x599140){_0xb507bf=_0xb507bf-0x0;var _0x479de0=_0xda5e[_0xb507bf];return _0x479de0;};'use strict';var _=require('lodash');var util=require(_0xeda5('0x0'));var moment=require(_0xeda5('0x1'));var BPromise=require(_0xeda5('0x2'));var rs=require(_0xeda5('0x3'));var fs=require('fs');var Redis=require(_0xeda5('0x4'));var db=require(_0xeda5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeda5('0x6'))(_0xeda5('0x7'));var config=require(_0xeda5('0x8'));var jayson=require(_0xeda5('0x9'));var client=jayson[_0xeda5('0xa')][_0xeda5('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xeda5('0xc'),'port':0x18eb});var socket=require(_0xeda5('0xd'))(new Redis(config[_0xeda5('0xe')]));require(_0xeda5('0xf'))['register'](socket);function respondWithRpcPromise(_0x298c9d,_0x192226,_0x294c00){return new BPromise(function(_0x2ae931,_0x25e536){return client['request'](_0x298c9d,_0x294c00)['then'](function(_0x3b02a2){logger['info'](_0xeda5('0x10'),_0x192226,_0xeda5('0x11'));logger[_0xeda5('0x12')](_0xeda5('0x13'),_0x192226,_0xeda5('0x11'),JSON[_0xeda5('0x14')](_0x3b02a2));if(_0x3b02a2[_0xeda5('0x15')]){if(_0x3b02a2[_0xeda5('0x15')][_0xeda5('0x16')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x192226,_0x3b02a2[_0xeda5('0x15')][_0xeda5('0x17')]);return _0x25e536(_0x3b02a2[_0xeda5('0x15')][_0xeda5('0x17')]);}logger['error'](_0xeda5('0x10'),_0x192226,_0x3b02a2[_0xeda5('0x15')][_0xeda5('0x17')]);return _0x2ae931(_0x3b02a2[_0xeda5('0x15')][_0xeda5('0x17')]);}else{logger[_0xeda5('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x192226,_0xeda5('0x11'));_0x2ae931(_0x3b02a2[_0xeda5('0x19')][_0xeda5('0x17')]);}})['catch'](function(_0x4b75e9){logger[_0xeda5('0x15')](_0xeda5('0x10'),_0x192226,_0x4b75e9);_0x25e536(_0x4b75e9);});});}exports[_0xeda5('0x1a')]=function(_0x397e7e){var _0x1d9af7=this;return new Promise(function(_0xf6514e,_0x33da8c){return db[_0xeda5('0x1b')]['findAll']({'raw':_0x397e7e[_0xeda5('0x1c')]?_0x397e7e[_0xeda5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x397e7e[_0xeda5('0x1c')]?_0x397e7e[_0xeda5('0x1c')][_0xeda5('0x1d')]||null:null,'attributes':_0x397e7e[_0xeda5('0x1c')]?_0x397e7e[_0xeda5('0x1c')][_0xeda5('0x1e')]||null:null,'limit':_0x397e7e[_0xeda5('0x1c')]?_0x397e7e[_0xeda5('0x1c')][_0xeda5('0x1f')]||null:null,'include':_0x397e7e[_0xeda5('0x1c')]?_0x397e7e[_0xeda5('0x1c')]['include']?_[_0xeda5('0x20')](_0x397e7e[_0xeda5('0x1c')][_0xeda5('0x21')],function(_0x168b00){return{'model':db[_0x168b00[_0xeda5('0x22')]],'as':_0x168b00['as'],'attributes':_0x168b00[_0xeda5('0x1e')],'include':_0x168b00[_0xeda5('0x21')]?_[_0xeda5('0x20')](_0x168b00[_0xeda5('0x21')],function(_0xfc54b2){return{'model':db[_0xfc54b2[_0xeda5('0x22')]],'as':_0xfc54b2['as'],'attributes':_0xfc54b2[_0xeda5('0x1e')],'include':_0xfc54b2[_0xeda5('0x21')]?_['map'](_0xfc54b2[_0xeda5('0x21')],function(_0x23fedc){return{'model':db[_0x23fedc[_0xeda5('0x22')]],'as':_0x23fedc['as'],'attributes':_0x23fedc[_0xeda5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43dca5){logger['info'](_0xeda5('0x1a'),_0x397e7e);logger[_0xeda5('0x12')](_0xeda5('0x1a'),_0x397e7e,JSON[_0xeda5('0x14')](_0x43dca5));_0xf6514e(_0x43dca5);})[_0xeda5('0x23')](function(_0x4aab7c){logger[_0xeda5('0x15')](_0xeda5('0x1a'),_0x4aab7c['message'],_0x397e7e);_0x33da8c(_0x1d9af7[_0xeda5('0x15')](0x1f4,_0x4aab7c['message']));});});};exports['ShowOpenchannelQueue']=function(_0x563965){var _0x5ef74b=this;return new Promise(function(_0x25e876,_0x4f8434){return db[_0xeda5('0x1b')][_0xeda5('0x24')]({'raw':_0x563965[_0xeda5('0x1c')]?_0x563965[_0xeda5('0x1c')][_0xeda5('0x25')]===undefined?!![]:![]:!![],'where':_0x563965[_0xeda5('0x1c')]?_0x563965['options'][_0xeda5('0x1d')]||null:null,'attributes':_0x563965['options']?_0x563965[_0xeda5('0x1c')][_0xeda5('0x1e')]||null:null,'include':_0x563965['options']?_0x563965[_0xeda5('0x1c')]['include']?_[_0xeda5('0x20')](_0x563965[_0xeda5('0x1c')][_0xeda5('0x21')],function(_0xc5d354){return{'model':db[_0xc5d354[_0xeda5('0x22')]],'as':_0xc5d354['as'],'attributes':_0xc5d354[_0xeda5('0x1e')],'include':_0xc5d354[_0xeda5('0x21')]?_[_0xeda5('0x20')](_0xc5d354[_0xeda5('0x21')],function(_0x2a9205){return{'model':db[_0x2a9205['model']],'as':_0x2a9205['as'],'attributes':_0x2a9205[_0xeda5('0x1e')],'include':_0x2a9205['include']?_[_0xeda5('0x20')](_0x2a9205[_0xeda5('0x21')],function(_0x43a070){return{'model':db[_0x43a070[_0xeda5('0x22')]],'as':_0x43a070['as'],'attributes':_0x43a070[_0xeda5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeda5('0x26')](function(_0x454c48){logger[_0xeda5('0x18')]('ShowOpenchannelQueue',_0x563965);logger[_0xeda5('0x12')](_0xeda5('0x27'),_0x563965,JSON[_0xeda5('0x14')](_0x454c48));_0x25e876(_0x454c48);})[_0xeda5('0x23')](function(_0x21c2f2){logger['error'](_0xeda5('0x27'),_0x21c2f2[_0xeda5('0x17')],_0x563965);_0x4f8434(_0x5ef74b[_0xeda5('0x15')](0x1f4,_0x21c2f2[_0xeda5('0x17')]));});});}; \ No newline at end of file +var _0x10d4=['socket.io-emitter','redis','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','then','GetOpenchannelQueue','debug','catch','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10d4,0x1b6));var _0x410d=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x10d4[_0x2567f0];return _0x14852a;};'use strict';var _=require(_0x410d('0x0'));var util=require('util');var moment=require(_0x410d('0x1'));var BPromise=require(_0x410d('0x2'));var rs=require(_0x410d('0x3'));var fs=require('fs');var Redis=require(_0x410d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x410d('0x5'));var logger=require(_0x410d('0x6'))(_0x410d('0x7'));var config=require('../../config/environment');var jayson=require(_0x410d('0x8'));var client=jayson[_0x410d('0x9')][_0x410d('0xa')]({'port':0x232a});config['redis']=_[_0x410d('0xb')](config['redis'],{'host':_0x410d('0xc'),'port':0x18eb});var socket=require(_0x410d('0xd'))(new Redis(config[_0x410d('0xe')]));require(_0x410d('0xf'))[_0x410d('0x10')](socket);function respondWithRpcPromise(_0x1d0b23,_0x441d3a,_0x5d28ba){return new BPromise(function(_0x5313b1,_0x557f6b){return client['request'](_0x1d0b23,_0x5d28ba)['then'](function(_0x2830c9){logger[_0x410d('0x11')](_0x410d('0x12'),_0x441d3a,_0x410d('0x13'));logger['debug'](_0x410d('0x14'),_0x441d3a,_0x410d('0x13'),JSON[_0x410d('0x15')](_0x2830c9));if(_0x2830c9[_0x410d('0x16')]){if(_0x2830c9['error'][_0x410d('0x17')]===0x1f4){logger[_0x410d('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x441d3a,_0x2830c9['error'][_0x410d('0x18')]);return _0x557f6b(_0x2830c9['error'][_0x410d('0x18')]);}logger[_0x410d('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x441d3a,_0x2830c9[_0x410d('0x16')][_0x410d('0x18')]);return _0x5313b1(_0x2830c9[_0x410d('0x16')][_0x410d('0x18')]);}else{logger[_0x410d('0x11')](_0x410d('0x12'),_0x441d3a,_0x410d('0x13'));_0x5313b1(_0x2830c9[_0x410d('0x19')][_0x410d('0x18')]);}})['catch'](function(_0x4c32bd){logger[_0x410d('0x16')](_0x410d('0x12'),_0x441d3a,_0x4c32bd);_0x557f6b(_0x4c32bd);});});}exports['GetOpenchannelQueue']=function(_0x15838e){var _0x16642e=this;return new Promise(function(_0x58a1fa,_0x488558){return db[_0x410d('0x1a')][_0x410d('0x1b')]({'raw':_0x15838e[_0x410d('0x1c')]?_0x15838e[_0x410d('0x1c')][_0x410d('0x1d')]===undefined?!![]:![]:!![],'where':_0x15838e[_0x410d('0x1c')]?_0x15838e[_0x410d('0x1c')]['where']||null:null,'attributes':_0x15838e[_0x410d('0x1c')]?_0x15838e[_0x410d('0x1c')][_0x410d('0x1e')]||null:null,'limit':_0x15838e['options']?_0x15838e[_0x410d('0x1c')]['limit']||null:null,'include':_0x15838e['options']?_0x15838e[_0x410d('0x1c')][_0x410d('0x1f')]?_[_0x410d('0x20')](_0x15838e[_0x410d('0x1c')][_0x410d('0x1f')],function(_0x24d804){return{'model':db[_0x24d804[_0x410d('0x21')]],'as':_0x24d804['as'],'attributes':_0x24d804[_0x410d('0x1e')],'include':_0x24d804['include']?_[_0x410d('0x20')](_0x24d804[_0x410d('0x1f')],function(_0x4f903c){return{'model':db[_0x4f903c[_0x410d('0x21')]],'as':_0x4f903c['as'],'attributes':_0x4f903c['attributes'],'include':_0x4f903c[_0x410d('0x1f')]?_['map'](_0x4f903c['include'],function(_0x4425c1){return{'model':db[_0x4425c1[_0x410d('0x21')]],'as':_0x4425c1['as'],'attributes':_0x4425c1[_0x410d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x410d('0x22')](function(_0x25e829){logger[_0x410d('0x11')](_0x410d('0x23'),_0x15838e);logger[_0x410d('0x24')](_0x410d('0x23'),_0x15838e,JSON['stringify'](_0x25e829));_0x58a1fa(_0x25e829);})[_0x410d('0x25')](function(_0x3e95c4){logger[_0x410d('0x16')](_0x410d('0x23'),_0x3e95c4['message'],_0x15838e);_0x488558(_0x16642e[_0x410d('0x16')](0x1f4,_0x3e95c4[_0x410d('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0x20b5c4){var _0x233825=this;return new Promise(function(_0x971e0e,_0x5a92e7){return db[_0x410d('0x1a')][_0x410d('0x26')]({'raw':_0x20b5c4['options']?_0x20b5c4[_0x410d('0x1c')][_0x410d('0x1d')]===undefined?!![]:![]:!![],'where':_0x20b5c4[_0x410d('0x1c')]?_0x20b5c4[_0x410d('0x1c')][_0x410d('0x27')]||null:null,'attributes':_0x20b5c4[_0x410d('0x1c')]?_0x20b5c4[_0x410d('0x1c')][_0x410d('0x1e')]||null:null,'include':_0x20b5c4['options']?_0x20b5c4[_0x410d('0x1c')][_0x410d('0x1f')]?_[_0x410d('0x20')](_0x20b5c4[_0x410d('0x1c')]['include'],function(_0x3c437d){return{'model':db[_0x3c437d[_0x410d('0x21')]],'as':_0x3c437d['as'],'attributes':_0x3c437d[_0x410d('0x1e')],'include':_0x3c437d[_0x410d('0x1f')]?_['map'](_0x3c437d[_0x410d('0x1f')],function(_0x20c053){return{'model':db[_0x20c053[_0x410d('0x21')]],'as':_0x20c053['as'],'attributes':_0x20c053['attributes'],'include':_0x20c053['include']?_[_0x410d('0x20')](_0x20c053['include'],function(_0xf75bdd){return{'model':db[_0xf75bdd[_0x410d('0x21')]],'as':_0xf75bdd['as'],'attributes':_0xf75bdd[_0x410d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x410d('0x22')](function(_0x275dbd){logger[_0x410d('0x11')](_0x410d('0x28'),_0x20b5c4);logger['debug'](_0x410d('0x28'),_0x20b5c4,JSON[_0x410d('0x15')](_0x275dbd));_0x971e0e(_0x275dbd);})[_0x410d('0x25')](function(_0x4ba8c7){logger[_0x410d('0x16')](_0x410d('0x28'),_0x4ba8c7[_0x410d('0x18')],_0x20b5c4);_0x5a92e7(_0x233825[_0x410d('0x16')](0x1f4,_0x4ba8c7[_0x410d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 985e61b..9a13f3e 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 _0x241b=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','openchannelQueue:'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x241b,0x80));var _0xb241=function(_0x4f2401,_0x1d8441){_0x4f2401=_0x4f2401-0x0;var _0x2c9d08=_0x241b[_0x4f2401];return _0x2c9d08;};'use strict';var OpenchannelQueueEvents=require(_0xb241('0x0'));var events=[_0xb241('0x1'),_0xb241('0x2'),_0xb241('0x3')];function createListener(_0x3f4bff,_0x5de38c){return function(_0x53679f){_0x5de38c[_0xb241('0x4')](_0x3f4bff,_0x53679f);};}function removeListener(_0x1c465e,_0xe02684){return function(){OpenchannelQueueEvents[_0xb241('0x5')](_0x1c465e,_0xe02684);};}exports[_0xb241('0x6')]=function(_0x290481){for(var _0x1fd238=0x0,_0x57dad2=events['length'];_0x1fd238<_0x57dad2;_0x1fd238++){var _0x286451=events[_0x1fd238];var _0x547257=createListener(_0xb241('0x7')+_0x286451,_0x290481);OpenchannelQueueEvents['on'](_0x286451,_0x547257);}}; \ No newline at end of file +var _0xd2be=['./openchannelQueue.events','save','update','emit','register','length'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xd2be,0x1e0));var _0xed2b=function(_0x4db474,_0x2e74de){_0x4db474=_0x4db474-0x0;var _0x22520=_0xd2be[_0x4db474];return _0x22520;};'use strict';var OpenchannelQueueEvents=require(_0xed2b('0x0'));var events=[_0xed2b('0x1'),'remove',_0xed2b('0x2')];function createListener(_0x268cb0,_0x412529){return function(_0x54e4e7){_0x412529[_0xed2b('0x3')](_0x268cb0,_0x54e4e7);};}function removeListener(_0xc37782,_0x35e83c){return function(){OpenchannelQueueEvents['removeListener'](_0xc37782,_0x35e83c);};}exports[_0xed2b('0x4')]=function(_0x324760){for(var _0x1a9de7=0x0,_0x2c0fb1=events[_0xed2b('0x5')];_0x1a9de7<_0x2c0fb1;_0x1a9de7++){var _0x53dc7f=events[_0x1a9de7];var _0x5eb786=createListener('openchannelQueue:'+_0x53dc7f,_0x324760);OpenchannelQueueEvents['on'](_0x53dc7f,_0x5eb786);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7bef860..3729ed8 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 _0xa930=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show'];(function(_0x45e54e,_0x5b45cd){var _0x2785b2=function(_0x19d125){while(--_0x19d125){_0x45e54e['push'](_0x45e54e['shift']());}};_0x2785b2(++_0x5b45cd);}(_0xa930,0xe1));var _0x0a93=function(_0x5a388c,_0x554b96){_0x5a388c=_0x5a388c-0x0;var _0xc29f0d=_0xa930[_0x5a388c];return _0xc29f0d;};'use strict';var multer=require(_0x0a93('0x0'));var util=require(_0x0a93('0x1'));var path=require('path');var timeout=require(_0x0a93('0x2'));var express=require(_0x0a93('0x3'));var router=express[_0x0a93('0x4')]();var auth=require(_0x0a93('0x5'));var interaction=require(_0x0a93('0x6'));var config=require(_0x0a93('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x0a93('0x8')]('/',auth[_0x0a93('0x9')](),controller['index']);router['get'](_0x0a93('0xa'),auth['isAuthenticated'](),controller[_0x0a93('0xb')]);router['get']('/:id',auth[_0x0a93('0x9')](),controller[_0x0a93('0xc')]);router['post']('/',auth[_0x0a93('0x9')](),controller['create']);router['put']('/:id',auth[_0x0a93('0x9')](),controller[_0x0a93('0xd')]);router[_0x0a93('0xe')]('/:id',auth[_0x0a93('0x9')](),controller[_0x0a93('0xf')]);module[_0x0a93('0x10')]=router; \ No newline at end of file +var _0x92d1=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x21eb21,_0x223fa2){var _0x3a8b1f=function(_0x2ba4a4){while(--_0x2ba4a4){_0x21eb21['push'](_0x21eb21['shift']());}};_0x3a8b1f(++_0x223fa2);}(_0x92d1,0x16c));var _0x192d=function(_0x37a053,_0x37b997){_0x37a053=_0x37a053-0x0;var _0x13651f=_0x92d1[_0x37a053];return _0x13651f;};'use strict';var multer=require(_0x192d('0x0'));var util=require(_0x192d('0x1'));var path=require(_0x192d('0x2'));var timeout=require(_0x192d('0x3'));var express=require(_0x192d('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x192d('0x5'));var config=require(_0x192d('0x6'));var controller=require(_0x192d('0x7'));router[_0x192d('0x8')]('/',auth[_0x192d('0x9')](),controller[_0x192d('0xa')]);router['get'](_0x192d('0xb'),auth[_0x192d('0x9')](),controller['describe']);router[_0x192d('0x8')](_0x192d('0xc'),auth['isAuthenticated'](),controller[_0x192d('0xd')]);router[_0x192d('0xe')]('/',auth['isAuthenticated'](),controller[_0x192d('0xf')]);router[_0x192d('0x10')](_0x192d('0xc'),auth[_0x192d('0x9')](),controller[_0x192d('0x11')]);router[_0x192d('0x12')](_0x192d('0xc'),auth[_0x192d('0x9')](),controller[_0x192d('0x13')]);module[_0x192d('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5d019a0..4adc501 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 _0x15a4=['DATE','exports','STRING'];(function(_0x2f4685,_0x2fd125){var _0x53fa5a=function(_0x2257c0){while(--_0x2257c0){_0x2f4685['push'](_0x2f4685['shift']());}};_0x53fa5a(++_0x2fd125);}(_0x15a4,0x133));var _0x415a=function(_0x17772f,_0xa0deb9){_0x17772f=_0x17772f-0x0;var _0x3a9463=_0x15a4[_0x17772f];return _0x3a9463;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x415a('0x0')]={'uniqueid':{'type':Sequelize[_0x415a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x415a('0x1')]},'joinAt':{'type':Sequelize[_0x415a('0x2')]},'leaveAt':{'type':Sequelize[_0x415a('0x2')]},'acceptAt':{'type':Sequelize[_0x415a('0x2')]},'exitAt':{'type':Sequelize[_0x415a('0x2')]},'reason':{'type':Sequelize[_0x415a('0x1')]}}; \ No newline at end of file +var _0x6b72=['STRING','DATE','moment','exports'];(function(_0x401322,_0x5e14ad){var _0x156e6a=function(_0x226467){while(--_0x226467){_0x401322['push'](_0x401322['shift']());}};_0x156e6a(++_0x5e14ad);}(_0x6b72,0x156));var _0x26b7=function(_0x42be48,_0x243c89){_0x42be48=_0x42be48-0x0;var _0x3d826e=_0x6b72[_0x42be48];return _0x3d826e;};'use strict';var moment=require(_0x26b7('0x0'));var Sequelize=require('sequelize');module[_0x26b7('0x1')]={'uniqueid':{'type':Sequelize[_0x26b7('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x26b7('0x3')]},'leaveAt':{'type':Sequelize[_0x26b7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x26b7('0x3')]},'reason':{'type':Sequelize[_0x26b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f1b8251..01f4db9 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 _0x87ae=['then','destroy','status','stack','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','filter','map','type','VIRTUAL','OpenchannelQueueReport','includeAll','include','findAll','catch','show','params','merge','options','create','body','find','describe','rimraf','request-promise','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','count','limit','set','Content-Range','json','reject','save','update'];(function(_0x26dd9a,_0x28a8e1){var _0x32c5f8=function(_0x2c7f12){while(--_0x2c7f12){_0x26dd9a['push'](_0x26dd9a['shift']());}};_0x32c5f8(++_0x28a8e1);}(_0x87ae,0xf5));var _0xe87a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x87ae[_0x3b0731];return _0x4204d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe87a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe87a('0x1'));var moment=require(_0xe87a('0x2'));var BPromise=require(_0xe87a('0x3'));var Mustache=require('mustache');var util=require(_0xe87a('0x4'));var path=require(_0xe87a('0x5'));var sox=require(_0xe87a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe87a('0x7'));var squel=require(_0xe87a('0x8'));var crypto=require('crypto');var jsforce=require(_0xe87a('0x9'));var deskjs=require(_0xe87a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xb'));var Papa=require(_0xe87a('0xc'));var Redis=require('ioredis');var authService=require(_0xe87a('0xd'));var qs=require(_0xe87a('0xe'));var as=require(_0xe87a('0xf'));var hardwareService=require(_0xe87a('0x10'));var logger=require(_0xe87a('0x11'))(_0xe87a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe87a('0x13'));var db=require(_0xe87a('0x14'))['db'];function respondWithStatusCode(_0x3e990c,_0x4db185){_0x4db185=_0x4db185||0xcc;return function(_0x1a725a){if(_0x1a725a){return _0x3e990c[_0xe87a('0x15')](_0x4db185);}return _0x3e990c['status'](_0x4db185)[_0xe87a('0x16')]();};}function respondWithResult(_0x353c52,_0x136340){_0x136340=_0x136340||0xc8;return function(_0x5032c5){if(_0x5032c5){return _0x353c52['status'](_0x136340)['json'](_0x5032c5);}};}function respondWithFilteredResult(_0x53a4f7,_0x44474f){return function(_0x1fa2cd){if(_0x1fa2cd){var _0xd2ca53=_0x1fa2cd[_0xe87a('0x17')],_0x175626=_0x44474f['offset'],_0x4d66ce=_0x44474f['offset']+_0x44474f[_0xe87a('0x18')],_0x415147;if(_0x4d66ce>=_0xd2ca53){_0x4d66ce=_0xd2ca53;_0x415147=0xc8;}else{_0x415147=0xce;}_0x53a4f7['status'](_0x415147);return _0x53a4f7[_0xe87a('0x19')](_0xe87a('0x1a'),_0x175626+'-'+_0x4d66ce+'/'+_0xd2ca53)[_0xe87a('0x1b')](_0x1fa2cd);}return null;};}function patchUpdates(_0x5471b0){return function(_0x444eeb){try{jsonpatch['apply'](_0x444eeb,_0x5471b0,!![]);}catch(_0x1267ac){return BPromise[_0xe87a('0x1c')](_0x1267ac);}return _0x444eeb[_0xe87a('0x1d')]();};}function saveUpdates(_0x4059e1,_0x104f67){return function(_0x5be8f6){if(_0x5be8f6){return _0x5be8f6[_0xe87a('0x1e')](_0x4059e1)[_0xe87a('0x1f')](function(_0x5dd73f){return _0x5dd73f;});}return null;};}function removeEntity(_0x59c17c,_0x42ba03){return function(_0x363c6a){if(_0x363c6a){return _0x363c6a[_0xe87a('0x20')]()[_0xe87a('0x1f')](function(){_0x59c17c[_0xe87a('0x21')](0xcc)[_0xe87a('0x16')]();});}};}function handleEntityNotFound(_0x56eba0,_0x59d9f7){return function(_0x54e386){if(!_0x54e386){_0x56eba0['sendStatus'](0x194);}return _0x54e386;};}function handleError(_0x328921,_0x5206c5){_0x5206c5=_0x5206c5||0x1f4;return function(_0x1108d0){logger['error'](_0x1108d0[_0xe87a('0x22')]);if(_0x1108d0[_0xe87a('0x23')]){delete _0x1108d0[_0xe87a('0x23')];}_0x328921[_0xe87a('0x21')](_0x5206c5)[_0xe87a('0x24')](_0x1108d0);};}exports[_0xe87a('0x25')]=function(_0x4fe080,_0x3fc24e){var _0x5b984f={},_0x58f10a={},_0x39ec27={'count':0x0,'rows':[]};var _0x48511b=_['map'](db['OpenchannelQueueReport'][_0xe87a('0x26')],function(_0x6feaf6){return{'name':_0x6feaf6[_0xe87a('0x27')],'type':_0x6feaf6['type']['key']};});_0x58f10a[_0xe87a('0x28')]=_['map'](_0x48511b,'name');_0x58f10a[_0xe87a('0x29')]=_[_0xe87a('0x2a')](_0x4fe080[_0xe87a('0x29')]);_0x58f10a[_0xe87a('0x2b')]=_[_0xe87a('0x2c')](_0x58f10a['model'],_0x58f10a[_0xe87a('0x29')]);_0x5b984f['attributes']=_[_0xe87a('0x2c')](_0x58f10a['model'],qs[_0xe87a('0x2d')](_0x4fe080[_0xe87a('0x29')][_0xe87a('0x2d')]));_0x5b984f[_0xe87a('0x2e')]=_0x5b984f[_0xe87a('0x2e')][_0xe87a('0x2f')]?_0x5b984f[_0xe87a('0x2e')]:_0x58f10a[_0xe87a('0x28')];if(!_0x4fe080[_0xe87a('0x29')][_0xe87a('0x30')]('nolimit')){_0x5b984f['limit']=qs['limit'](_0x4fe080[_0xe87a('0x29')]['limit']);_0x5b984f[_0xe87a('0x31')]=qs[_0xe87a('0x31')](_0x4fe080['query'][_0xe87a('0x31')]);}_0x5b984f['order']=qs['sort'](_0x4fe080[_0xe87a('0x29')][_0xe87a('0x32')]);_0x5b984f[_0xe87a('0x33')]=qs[_0xe87a('0x2b')](_['pick'](_0x4fe080[_0xe87a('0x29')],_0x58f10a[_0xe87a('0x2b')]),_0x48511b);if(_0x4fe080['query'][_0xe87a('0x34')]){_0x5b984f[_0xe87a('0x33')]=_['merge'](_0x5b984f[_0xe87a('0x33')],{'$or':_[_0xe87a('0x35')](_0x48511b,function(_0x436eb0){if(_0x436eb0[_0xe87a('0x36')]!==_0xe87a('0x37')){var _0x54ca0d={};_0x54ca0d[_0x436eb0[_0xe87a('0x23')]]={'$like':'%'+_0x4fe080['query'][_0xe87a('0x34')]+'%'};return _0x54ca0d;}})});}_0x5b984f=_['merge']({},_0x5b984f,_0x4fe080['options']);var _0x4315f5={'where':_0x5b984f[_0xe87a('0x33')]};return db[_0xe87a('0x38')][_0xe87a('0x17')](_0x4315f5)[_0xe87a('0x1f')](function(_0x1109b9){_0x39ec27[_0xe87a('0x17')]=_0x1109b9;if(_0x4fe080[_0xe87a('0x29')][_0xe87a('0x39')]){_0x5b984f[_0xe87a('0x3a')]=[{'all':!![]}];}return db[_0xe87a('0x38')][_0xe87a('0x3b')](_0x5b984f);})[_0xe87a('0x1f')](function(_0x429fd0){_0x39ec27['rows']=_0x429fd0;return _0x39ec27;})[_0xe87a('0x1f')](respondWithFilteredResult(_0x3fc24e,_0x5b984f))[_0xe87a('0x3c')](handleError(_0x3fc24e,null));};exports[_0xe87a('0x3d')]=function(_0xc621c9,_0x5eb4e1){var _0x590a49={'raw':!![],'where':{'id':_0xc621c9[_0xe87a('0x3e')]['id']}},_0x4f92e0={};_0x4f92e0['model']=_['keys'](db[_0xe87a('0x38')]['rawAttributes']);_0x4f92e0['query']=_[_0xe87a('0x2a')](_0xc621c9[_0xe87a('0x29')]);_0x4f92e0['filters']=_[_0xe87a('0x2c')](_0x4f92e0['model'],_0x4f92e0['query']);_0x590a49['attributes']=_[_0xe87a('0x2c')](_0x4f92e0[_0xe87a('0x28')],qs['fields'](_0xc621c9[_0xe87a('0x29')][_0xe87a('0x2d')]));_0x590a49[_0xe87a('0x2e')]=_0x590a49['attributes']['length']?_0x590a49['attributes']:_0x4f92e0['model'];if(_0xc621c9[_0xe87a('0x29')]['includeAll']){_0x590a49[_0xe87a('0x3a')]=[{'all':!![]}];}_0x590a49=_[_0xe87a('0x3f')]({},_0x590a49,_0xc621c9[_0xe87a('0x40')]);return db[_0xe87a('0x38')]['find'](_0x590a49)[_0xe87a('0x1f')](handleEntityNotFound(_0x5eb4e1,null))[_0xe87a('0x1f')](respondWithResult(_0x5eb4e1,null))['catch'](handleError(_0x5eb4e1,null));};exports[_0xe87a('0x41')]=function(_0x3e325d,_0x40bf40){return db[_0xe87a('0x38')][_0xe87a('0x41')](_0x3e325d[_0xe87a('0x42')],{})[_0xe87a('0x1f')](respondWithResult(_0x40bf40,0xc9))[_0xe87a('0x3c')](handleError(_0x40bf40,null));};exports[_0xe87a('0x1e')]=function(_0x5e25ce,_0x344521){if(_0x5e25ce[_0xe87a('0x42')]['id']){delete _0x5e25ce[_0xe87a('0x42')]['id'];}return db[_0xe87a('0x38')]['find']({'where':{'id':_0x5e25ce[_0xe87a('0x3e')]['id']}})[_0xe87a('0x1f')](handleEntityNotFound(_0x344521,null))[_0xe87a('0x1f')](saveUpdates(_0x5e25ce[_0xe87a('0x42')],null))[_0xe87a('0x1f')](respondWithResult(_0x344521,null))[_0xe87a('0x3c')](handleError(_0x344521,null));};exports[_0xe87a('0x20')]=function(_0x324d97,_0x57e781){return db[_0xe87a('0x38')][_0xe87a('0x43')]({'where':{'id':_0x324d97[_0xe87a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x57e781,null))[_0xe87a('0x1f')](removeEntity(_0x57e781,null))[_0xe87a('0x3c')](handleError(_0x57e781,null));};exports[_0xe87a('0x44')]=function(_0x19a52b,_0x10b523){return db[_0xe87a('0x38')][_0xe87a('0x44')]()[_0xe87a('0x1f')](respondWithResult(_0x10b523,null))[_0xe87a('0x3c')](handleError(_0x10b523,null));}; \ No newline at end of file +var _0xcfac=['name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','count','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','then','destroy','error','stack'];(function(_0x3b24f0,_0x5c3115){var _0x561bf3=function(_0x53b6ce){while(--_0x53b6ce){_0x3b24f0['push'](_0x3b24f0['shift']());}};_0x561bf3(++_0x5c3115);}(_0xcfac,0x105));var _0xccfa=function(_0x211bf0,_0x5e8d12){_0x211bf0=_0x211bf0-0x0;var _0x3716f1=_0xcfac[_0x211bf0];return _0x3716f1;};'use strict';var pdf=require(_0xccfa('0x0'));var emlformat=require(_0xccfa('0x1'));var rimraf=require(_0xccfa('0x2'));var zipdir=require(_0xccfa('0x3'));var jsonpatch=require(_0xccfa('0x4'));var rp=require(_0xccfa('0x5'));var moment=require(_0xccfa('0x6'));var BPromise=require(_0xccfa('0x7'));var Mustache=require(_0xccfa('0x8'));var util=require('util');var path=require(_0xccfa('0x9'));var sox=require(_0xccfa('0xa'));var csv=require(_0xccfa('0xb'));var ejs=require(_0xccfa('0xc'));var fs=require('fs');var _=require(_0xccfa('0xd'));var squel=require(_0xccfa('0xe'));var crypto=require(_0xccfa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xccfa('0x10'));var toCsv=require(_0xccfa('0xb'));var querystring=require(_0xccfa('0x11'));var Papa=require(_0xccfa('0x12'));var Redis=require(_0xccfa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xccfa('0x14'));var as=require(_0xccfa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccfa('0x16'))(_0xccfa('0x17'));var utils=require(_0xccfa('0x18'));var config=require(_0xccfa('0x19'));var licenseUtil=require(_0xccfa('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29d643,_0x28d4e9){_0x28d4e9=_0x28d4e9||0xcc;return function(_0x73ab6d){if(_0x73ab6d){return _0x29d643[_0xccfa('0x1b')](_0x28d4e9);}return _0x29d643[_0xccfa('0x1c')](_0x28d4e9)[_0xccfa('0x1d')]();};}function respondWithResult(_0x11e577,_0xc43ebe){_0xc43ebe=_0xc43ebe||0xc8;return function(_0x411a73){if(_0x411a73){return _0x11e577[_0xccfa('0x1c')](_0xc43ebe)[_0xccfa('0x1e')](_0x411a73);}};}function respondWithFilteredResult(_0x2bcf8e,_0x4e83d6){return function(_0x89103f){if(_0x89103f){var _0x258db6=_0x89103f['count'],_0x53416b=_0x4e83d6[_0xccfa('0x1f')],_0x513e25=_0x4e83d6[_0xccfa('0x1f')]+_0x4e83d6['limit'],_0x475607;if(_0x513e25>=_0x258db6){_0x513e25=_0x258db6;_0x475607=0xc8;}else{_0x475607=0xce;}_0x2bcf8e['status'](_0x475607);return _0x2bcf8e[_0xccfa('0x20')](_0xccfa('0x21'),_0x53416b+'-'+_0x513e25+'/'+_0x258db6)[_0xccfa('0x1e')](_0x89103f);}return null;};}function patchUpdates(_0x14171e){return function(_0x3cc107){try{jsonpatch[_0xccfa('0x22')](_0x3cc107,_0x14171e,!![]);}catch(_0x4f1d12){return BPromise['reject'](_0x4f1d12);}return _0x3cc107['save']();};}function saveUpdates(_0x23d235,_0x4bdb04){return function(_0x5e0c63){if(_0x5e0c63){return _0x5e0c63['update'](_0x23d235)[_0xccfa('0x23')](function(_0x5ba856){return _0x5ba856;});}return null;};}function removeEntity(_0x5abfb6,_0x471e59){return function(_0x39b373){if(_0x39b373){return _0x39b373[_0xccfa('0x24')]()[_0xccfa('0x23')](function(){_0x5abfb6['status'](0xcc)[_0xccfa('0x1d')]();});}};}function handleEntityNotFound(_0x485e6f,_0x58cc2c){return function(_0x4b8714){if(!_0x4b8714){_0x485e6f[_0xccfa('0x1b')](0x194);}return _0x4b8714;};}function handleError(_0x2b4a96,_0x1f0bef){_0x1f0bef=_0x1f0bef||0x1f4;return function(_0x5cae20){logger[_0xccfa('0x25')](_0x5cae20[_0xccfa('0x26')]);if(_0x5cae20[_0xccfa('0x27')]){delete _0x5cae20[_0xccfa('0x27')];}_0x2b4a96[_0xccfa('0x1c')](_0x1f0bef)[_0xccfa('0x28')](_0x5cae20);};}exports[_0xccfa('0x29')]=function(_0x40b2a4,_0x5c843c){var _0x113ef1={},_0x2a5d63={},_0x18dccb={'count':0x0,'rows':[]};var _0xae8934=_[_0xccfa('0x2a')](db[_0xccfa('0x2b')][_0xccfa('0x2c')],function(_0x3e8a05){return{'name':_0x3e8a05[_0xccfa('0x2d')],'type':_0x3e8a05['type'][_0xccfa('0x2e')]};});_0x2a5d63[_0xccfa('0x2f')]=_[_0xccfa('0x2a')](_0xae8934,_0xccfa('0x27'));_0x2a5d63[_0xccfa('0x30')]=_[_0xccfa('0x31')](_0x40b2a4[_0xccfa('0x30')]);_0x2a5d63[_0xccfa('0x32')]=_[_0xccfa('0x33')](_0x2a5d63[_0xccfa('0x2f')],_0x2a5d63[_0xccfa('0x30')]);_0x113ef1[_0xccfa('0x34')]=_[_0xccfa('0x33')](_0x2a5d63[_0xccfa('0x2f')],qs[_0xccfa('0x35')](_0x40b2a4[_0xccfa('0x30')][_0xccfa('0x35')]));_0x113ef1[_0xccfa('0x34')]=_0x113ef1['attributes']['length']?_0x113ef1['attributes']:_0x2a5d63[_0xccfa('0x2f')];if(!_0x40b2a4[_0xccfa('0x30')][_0xccfa('0x36')](_0xccfa('0x37'))){_0x113ef1['limit']=qs['limit'](_0x40b2a4[_0xccfa('0x30')][_0xccfa('0x38')]);_0x113ef1['offset']=qs['offset'](_0x40b2a4['query'][_0xccfa('0x1f')]);}_0x113ef1['order']=qs['sort'](_0x40b2a4[_0xccfa('0x30')][_0xccfa('0x39')]);_0x113ef1[_0xccfa('0x3a')]=qs[_0xccfa('0x32')](_[_0xccfa('0x3b')](_0x40b2a4[_0xccfa('0x30')],_0x2a5d63[_0xccfa('0x32')]),_0xae8934);if(_0x40b2a4[_0xccfa('0x30')][_0xccfa('0x3c')]){_0x113ef1[_0xccfa('0x3a')]=_[_0xccfa('0x3d')](_0x113ef1['where'],{'$or':_[_0xccfa('0x2a')](_0xae8934,function(_0x5378a1){if(_0x5378a1['type']!=='VIRTUAL'){var _0x12709f={};_0x12709f[_0x5378a1[_0xccfa('0x27')]]={'$like':'%'+_0x40b2a4[_0xccfa('0x30')]['filter']+'%'};return _0x12709f;}})});}_0x113ef1=_['merge']({},_0x113ef1,_0x40b2a4['options']);var _0xb5b894={'where':_0x113ef1[_0xccfa('0x3a')]};return db[_0xccfa('0x2b')][_0xccfa('0x3e')](_0xb5b894)[_0xccfa('0x23')](function(_0x122fc7){_0x18dccb[_0xccfa('0x3e')]=_0x122fc7;if(_0x40b2a4[_0xccfa('0x30')][_0xccfa('0x3f')]){_0x113ef1[_0xccfa('0x40')]=[{'all':!![]}];}return db[_0xccfa('0x2b')]['findAll'](_0x113ef1);})['then'](function(_0x4bc2a5){_0x18dccb[_0xccfa('0x41')]=_0x4bc2a5;return _0x18dccb;})[_0xccfa('0x23')](respondWithFilteredResult(_0x5c843c,_0x113ef1))[_0xccfa('0x42')](handleError(_0x5c843c,null));};exports[_0xccfa('0x43')]=function(_0x1eea6d,_0x51b0a0){var _0x20df08={'raw':!![],'where':{'id':_0x1eea6d[_0xccfa('0x44')]['id']}},_0x1ec543={};_0x1ec543[_0xccfa('0x2f')]=_['keys'](db['OpenchannelQueueReport'][_0xccfa('0x2c')]);_0x1ec543[_0xccfa('0x30')]=_[_0xccfa('0x31')](_0x1eea6d[_0xccfa('0x30')]);_0x1ec543[_0xccfa('0x32')]=_['intersection'](_0x1ec543[_0xccfa('0x2f')],_0x1ec543[_0xccfa('0x30')]);_0x20df08[_0xccfa('0x34')]=_['intersection'](_0x1ec543[_0xccfa('0x2f')],qs['fields'](_0x1eea6d['query'][_0xccfa('0x35')]));_0x20df08[_0xccfa('0x34')]=_0x20df08[_0xccfa('0x34')][_0xccfa('0x45')]?_0x20df08[_0xccfa('0x34')]:_0x1ec543[_0xccfa('0x2f')];if(_0x1eea6d['query'][_0xccfa('0x3f')]){_0x20df08['include']=[{'all':!![]}];}_0x20df08=_['merge']({},_0x20df08,_0x1eea6d[_0xccfa('0x46')]);return db[_0xccfa('0x2b')][_0xccfa('0x47')](_0x20df08)[_0xccfa('0x23')](handleEntityNotFound(_0x51b0a0,null))[_0xccfa('0x23')](respondWithResult(_0x51b0a0,null))[_0xccfa('0x42')](handleError(_0x51b0a0,null));};exports[_0xccfa('0x48')]=function(_0x45d525,_0x2ebac1){return db[_0xccfa('0x2b')][_0xccfa('0x48')](_0x45d525[_0xccfa('0x49')],{})[_0xccfa('0x23')](respondWithResult(_0x2ebac1,0xc9))[_0xccfa('0x42')](handleError(_0x2ebac1,null));};exports['update']=function(_0x3e4770,_0x261300){if(_0x3e4770[_0xccfa('0x49')]['id']){delete _0x3e4770['body']['id'];}return db['OpenchannelQueueReport'][_0xccfa('0x47')]({'where':{'id':_0x3e4770[_0xccfa('0x44')]['id']}})[_0xccfa('0x23')](handleEntityNotFound(_0x261300,null))['then'](saveUpdates(_0x3e4770['body'],null))[_0xccfa('0x23')](respondWithResult(_0x261300,null))['catch'](handleError(_0x261300,null));};exports[_0xccfa('0x24')]=function(_0x5c2fa8,_0xe470f8){return db[_0xccfa('0x2b')][_0xccfa('0x47')]({'where':{'id':_0x5c2fa8[_0xccfa('0x44')]['id']}})[_0xccfa('0x23')](handleEntityNotFound(_0xe470f8,null))[_0xccfa('0x23')](removeEntity(_0xe470f8,null))[_0xccfa('0x42')](handleError(_0xe470f8,null));};exports[_0xccfa('0x4a')]=function(_0x2428e7,_0x26c7c9){return db['OpenchannelQueueReport'][_0xccfa('0x4a')]()[_0xccfa('0x23')](respondWithResult(_0x26c7c9,null))['catch'](handleError(_0x26c7c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 344fe4e..740f941 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 _0x07b9=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util'];(function(_0x58e7f0,_0x16c23d){var _0x3f6360=function(_0x3e3c83){while(--_0x3e3c83){_0x58e7f0['push'](_0x58e7f0['shift']());}};_0x3f6360(++_0x16c23d);}(_0x07b9,0x143));var _0x907b=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x07b9[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var logger=require(_0x907b('0x2'))(_0x907b('0x3'));var moment=require('moment');var BPromise=require(_0x907b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x907b('0x5'));var rimraf=require(_0x907b('0x6'));var config=require(_0x907b('0x7'));var attributes=require(_0x907b('0x8'));module[_0x907b('0x9')]=function(_0x1f27e9,_0x4440af){return _0x1f27e9['define'](_0x907b('0xa'),attributes,{'tableName':_0x907b('0xb'),'paranoid':![],'indexes':[{'name':_0x907b('0xc'),'fields':[_0x907b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f90=['../../config/environment','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2c9c70,_0x4ab4cb){var _0x3546bf=function(_0x318108){while(--_0x318108){_0x2c9c70['push'](_0x2c9c70['shift']());}};_0x3546bf(++_0x4ab4cb);}(_0x5f90,0xae));var _0x05f9=function(_0x3ed818,_0x13a2ef){_0x3ed818=_0x3ed818-0x0;var _0x1467ec=_0x5f90[_0x3ed818];return _0x1467ec;};'use strict';var _=require(_0x05f9('0x0'));var util=require('util');var logger=require(_0x05f9('0x1'))('api');var moment=require(_0x05f9('0x2'));var BPromise=require('bluebird');var rp=require(_0x05f9('0x3'));var fs=require('fs');var path=require(_0x05f9('0x4'));var rimraf=require(_0x05f9('0x5'));var config=require(_0x05f9('0x6'));var attributes=require(_0x05f9('0x7'));module['exports']=function(_0x179f3e,_0x707ae3){return _0x179f3e[_0x05f9('0x8')](_0x05f9('0x9'),attributes,{'tableName':_0x05f9('0xa'),'paranoid':![],'indexes':[{'name':_0x05f9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a0785dc..00e5970 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 _0x0100=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x570a80,_0x364a8b){var _0x51432e=function(_0x3af38c){while(--_0x3af38c){_0x570a80['push'](_0x570a80['shift']());}};_0x51432e(++_0x364a8b);}(_0x0100,0x1a7));var _0x0010=function(_0xe323e3,_0x110473){_0xe323e3=_0xe323e3-0x0;var _0x208a43=_0x0100[_0xe323e3];return _0x208a43;};'use strict';var _=require(_0x0010('0x0'));var util=require('util');var moment=require(_0x0010('0x1'));var BPromise=require(_0x0010('0x2'));var rs=require(_0x0010('0x3'));var fs=require('fs');var Redis=require(_0x0010('0x4'));var db=require(_0x0010('0x5'))['db'];var utils=require(_0x0010('0x6'));var logger=require(_0x0010('0x7'))(_0x0010('0x8'));var config=require(_0x0010('0x9'));var jayson=require(_0x0010('0xa'));var client=jayson['client'][_0x0010('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8696a,_0x3b2d8d,_0x1b89fe){return new BPromise(function(_0x34d66e,_0x1f6d83){return client[_0x0010('0xc')](_0x8696a,_0x1b89fe)[_0x0010('0xd')](function(_0x918a35){logger['info'](_0x0010('0xe'),_0x3b2d8d,'request\x20sent');logger[_0x0010('0xf')](_0x0010('0x10'),_0x3b2d8d,_0x0010('0x11'),JSON[_0x0010('0x12')](_0x918a35));if(_0x918a35[_0x0010('0x13')]){if(_0x918a35[_0x0010('0x13')][_0x0010('0x14')]===0x1f4){logger[_0x0010('0x13')](_0x0010('0xe'),_0x3b2d8d,_0x918a35[_0x0010('0x13')]['message']);return _0x1f6d83(_0x918a35[_0x0010('0x13')]['message']);}logger[_0x0010('0x13')](_0x0010('0xe'),_0x3b2d8d,_0x918a35[_0x0010('0x13')][_0x0010('0x15')]);return _0x34d66e(_0x918a35[_0x0010('0x13')]['message']);}else{logger[_0x0010('0x16')](_0x0010('0xe'),_0x3b2d8d,_0x0010('0x11'));_0x34d66e(_0x918a35['result'][_0x0010('0x15')]);}})[_0x0010('0x17')](function(_0x412f67){logger['error'](_0x0010('0xe'),_0x3b2d8d,_0x412f67);_0x1f6d83(_0x412f67);});});}exports[_0x0010('0x18')]=function(_0x29bfb3){var _0x40f4cf=this;return new Promise(function(_0x532e3d,_0x27475d){return db['OpenchannelQueueReport'][_0x0010('0x19')](_0x29bfb3[_0x0010('0x1a')],{'raw':_0x29bfb3[_0x0010('0x1b')]?_0x29bfb3['options'][_0x0010('0x1c')]===undefined?!![]:![]:!![]})[_0x0010('0xd')](function(_0x15fef8){logger['info'](_0x0010('0x18'),_0x29bfb3);logger[_0x0010('0xf')](_0x0010('0x18'),_0x29bfb3,JSON[_0x0010('0x12')](_0x15fef8));_0x532e3d(_0x15fef8);})[_0x0010('0x17')](function(_0x4eb514){logger['error'](_0x0010('0x18'),_0x4eb514[_0x0010('0x15')],_0x29bfb3);_0x27475d(_0x40f4cf[_0x0010('0x13')](0x1f4,_0x4eb514['message']));});});};exports[_0x0010('0x1d')]=function(_0x266ed0){var _0x6c6a73=this;return new Promise(function(_0x430ed3,_0x1b9a3d){return db[_0x0010('0x1e')][_0x0010('0x1f')](_0x266ed0[_0x0010('0x1a')],{'raw':_0x266ed0[_0x0010('0x1b')]?_0x266ed0[_0x0010('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x266ed0[_0x0010('0x1b')]?_0x266ed0['options']['where']||null:null,'attributes':_0x266ed0[_0x0010('0x1b')]?_0x266ed0[_0x0010('0x1b')]['attributes']||null:null,'limit':_0x266ed0['options']?_0x266ed0[_0x0010('0x1b')][_0x0010('0x20')]||null:null})[_0x0010('0xd')](function(_0x456147){logger[_0x0010('0x16')](_0x0010('0x1d'),_0x266ed0);logger[_0x0010('0xf')](_0x0010('0x1d'),_0x266ed0,JSON[_0x0010('0x12')](_0x456147));_0x430ed3(_0x456147);})[_0x0010('0x17')](function(_0x50a17a){logger['error']('UpdateOpenchannelQueueReport',_0x50a17a[_0x0010('0x15')],_0x266ed0);_0x1b9a3d(_0x6c6a73['error'](0x1f4,_0x50a17a['message']));});});}; \ No newline at end of file +var _0xedc8=['rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','UpdateOpenchannelQueueReport','update','body','attributes','limit','randomstring','../../mysqldb','../../config/logger'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0xedc8,0x176));var _0x8edc=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xedc8[_0x486f4a];return _0x135d99;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8edc('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8edc('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8edc('0x2'))(_0x8edc('0x3'));var config=require(_0x8edc('0x4'));var jayson=require(_0x8edc('0x5'));var client=jayson[_0x8edc('0x6')][_0x8edc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x587b88,_0x17cf8f,_0x1a3639){return new BPromise(function(_0x5510df,_0x21a9a3){return client['request'](_0x587b88,_0x1a3639)[_0x8edc('0x8')](function(_0x8d7834){logger[_0x8edc('0x9')](_0x8edc('0xa'),_0x17cf8f,'request\x20sent');logger[_0x8edc('0xb')](_0x8edc('0xc'),_0x17cf8f,'request\x20sent',JSON[_0x8edc('0xd')](_0x8d7834));if(_0x8d7834['error']){if(_0x8d7834[_0x8edc('0xe')][_0x8edc('0xf')]===0x1f4){logger[_0x8edc('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x17cf8f,_0x8d7834['error']['message']);return _0x21a9a3(_0x8d7834[_0x8edc('0xe')]['message']);}logger[_0x8edc('0xe')](_0x8edc('0xa'),_0x17cf8f,_0x8d7834['error'][_0x8edc('0x10')]);return _0x5510df(_0x8d7834[_0x8edc('0xe')][_0x8edc('0x10')]);}else{logger[_0x8edc('0x9')](_0x8edc('0xa'),_0x17cf8f,_0x8edc('0x11'));_0x5510df(_0x8d7834[_0x8edc('0x12')][_0x8edc('0x10')]);}})[_0x8edc('0x13')](function(_0x6cbe9d){logger[_0x8edc('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x17cf8f,_0x6cbe9d);_0x21a9a3(_0x6cbe9d);});});}exports[_0x8edc('0x14')]=function(_0x35514d){var _0x597bc3=this;return new Promise(function(_0x56bcc4,_0x17ed1d){return db[_0x8edc('0x15')]['create'](_0x35514d['body'],{'raw':_0x35514d[_0x8edc('0x16')]?_0x35514d[_0x8edc('0x16')][_0x8edc('0x17')]===undefined?!![]:![]:!![]})[_0x8edc('0x8')](function(_0x5138cd){logger[_0x8edc('0x9')](_0x8edc('0x14'),_0x35514d);logger[_0x8edc('0xb')](_0x8edc('0x14'),_0x35514d,JSON['stringify'](_0x5138cd));_0x56bcc4(_0x5138cd);})['catch'](function(_0x1adef3){logger[_0x8edc('0xe')](_0x8edc('0x14'),_0x1adef3[_0x8edc('0x10')],_0x35514d);_0x17ed1d(_0x597bc3[_0x8edc('0xe')](0x1f4,_0x1adef3['message']));});});};exports[_0x8edc('0x18')]=function(_0x4ebbf2){var _0x28e949=this;return new Promise(function(_0x5f43c3,_0x307b04){return db['OpenchannelQueueReport'][_0x8edc('0x19')](_0x4ebbf2[_0x8edc('0x1a')],{'raw':_0x4ebbf2[_0x8edc('0x16')]?_0x4ebbf2[_0x8edc('0x16')][_0x8edc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ebbf2[_0x8edc('0x16')]?_0x4ebbf2[_0x8edc('0x16')]['where']||null:null,'attributes':_0x4ebbf2[_0x8edc('0x16')]?_0x4ebbf2[_0x8edc('0x16')][_0x8edc('0x1b')]||null:null,'limit':_0x4ebbf2[_0x8edc('0x16')]?_0x4ebbf2['options'][_0x8edc('0x1c')]||null:null})[_0x8edc('0x8')](function(_0x2ae482){logger[_0x8edc('0x9')](_0x8edc('0x18'),_0x4ebbf2);logger[_0x8edc('0xb')](_0x8edc('0x18'),_0x4ebbf2,JSON[_0x8edc('0xd')](_0x2ae482));_0x5f43c3(_0x2ae482);})[_0x8edc('0x13')](function(_0x292a6a){logger['error']('UpdateOpenchannelQueueReport',_0x292a6a['message'],_0x4ebbf2);_0x307b04(_0x28e949[_0x8edc('0xe')](0x1f4,_0x292a6a[_0x8edc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 80ef407..7ec97d1 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0bec36c..b3a24b2 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 _0xb905=['sequelize','exports','STRING','ENUM','agent','queue','NOW','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb905,0x10f));var _0x5b90=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb905[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0x5b90('0x0'));var Sequelize=require(_0x5b90('0x1'));module[_0x5b90('0x2')]={'uniqueid':{'type':Sequelize[_0x5b90('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5b90('0x4')]('account',_0x5b90('0x5'),_0x5b90('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5b90('0x7')]}}; \ No newline at end of file +var _0x757a=['account','agent','DATE','NOW','moment','sequelize','STRING'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x757a,0x1af));var _0xa757=function(_0x1cde78,_0x5d39d0){_0x1cde78=_0x1cde78-0x0;var _0x859f7b=_0x757a[_0x1cde78];return _0x859f7b;};'use strict';var moment=require(_0xa757('0x0'));var Sequelize=require(_0xa757('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa757('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa757('0x3'),_0xa757('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa757('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xa757('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 60fdd7c..b5dd71e 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 _0x69cb=['status','json','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','html-pdf','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xe2ff0e,_0x493602){var _0x44a147=function(_0x1c3865){while(--_0x1c3865){_0xe2ff0e['push'](_0xe2ff0e['shift']());}};_0x44a147(++_0x493602);}(_0x69cb,0x70));var _0xb69c=function(_0x145b1e,_0x3e089c){_0x145b1e=_0x145b1e-0x0;var _0x5db350=_0x69cb[_0x145b1e];return _0x5db350;};'use strict';var pdf=require(_0xb69c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb69c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb69c('0x2'));var BPromise=require(_0xb69c('0x3'));var Mustache=require('mustache');var util=require(_0xb69c('0x4'));var path=require(_0xb69c('0x5'));var sox=require(_0xb69c('0x6'));var csv=require(_0xb69c('0x7'));var ejs=require(_0xb69c('0x8'));var fs=require('fs');var _=require(_0xb69c('0x9'));var squel=require(_0xb69c('0xa'));var crypto=require('crypto');var jsforce=require(_0xb69c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb69c('0x7'));var querystring=require('querystring');var Papa=require(_0xb69c('0xc'));var Redis=require(_0xb69c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb69c('0xe'));var as=require(_0xb69c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb69c('0x10'));var utils=require(_0xb69c('0x11'));var config=require(_0xb69c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb69c('0x13'))['db'];function respondWithStatusCode(_0x1257ca,_0x3051ee){_0x3051ee=_0x3051ee||0xcc;return function(_0x21bf47){if(_0x21bf47){return _0x1257ca['sendStatus'](_0x3051ee);}return _0x1257ca[_0xb69c('0x14')](_0x3051ee)['end']();};}function respondWithResult(_0x581cf6,_0x12bfd4){_0x12bfd4=_0x12bfd4||0xc8;return function(_0x1cd2d9){if(_0x1cd2d9){return _0x581cf6[_0xb69c('0x14')](_0x12bfd4)[_0xb69c('0x15')](_0x1cd2d9);}};}function respondWithFilteredResult(_0x3859cf,_0x54a3f2){return function(_0x4146ac){if(_0x4146ac){var _0x1da0d9=_0x4146ac[_0xb69c('0x16')],_0x1c53fa=_0x54a3f2[_0xb69c('0x17')],_0x11dfff=_0x54a3f2[_0xb69c('0x17')]+_0x54a3f2['limit'],_0xc67d3b;if(_0x11dfff>=_0x1da0d9){_0x11dfff=_0x1da0d9;_0xc67d3b=0xc8;}else{_0xc67d3b=0xce;}_0x3859cf[_0xb69c('0x14')](_0xc67d3b);return _0x3859cf[_0xb69c('0x18')](_0xb69c('0x19'),_0x1c53fa+'-'+_0x11dfff+'/'+_0x1da0d9)[_0xb69c('0x15')](_0x4146ac);}return null;};}function patchUpdates(_0x41c40b){return function(_0xec013){try{jsonpatch['apply'](_0xec013,_0x41c40b,!![]);}catch(_0x213681){return BPromise[_0xb69c('0x1a')](_0x213681);}return _0xec013['save']();};}function saveUpdates(_0x46e832,_0x3c51f7){return function(_0x3362cd){if(_0x3362cd){return _0x3362cd[_0xb69c('0x1b')](_0x46e832)[_0xb69c('0x1c')](function(_0x42f6d4){return _0x42f6d4;});}return null;};}function removeEntity(_0x249c17,_0xa4172f){return function(_0x42e7c0){if(_0x42e7c0){return _0x42e7c0[_0xb69c('0x1d')]()[_0xb69c('0x1c')](function(){_0x249c17['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3082ab,_0x4925ce){return function(_0x28489c){if(!_0x28489c){_0x3082ab[_0xb69c('0x1e')](0x194);}return _0x28489c;};}function handleError(_0x56cd03,_0x1a1180){_0x1a1180=_0x1a1180||0x1f4;return function(_0x206f22){logger['error'](_0x206f22[_0xb69c('0x1f')]);if(_0x206f22[_0xb69c('0x20')]){delete _0x206f22['name'];}_0x56cd03['status'](_0x1a1180)['send'](_0x206f22);};}exports[_0xb69c('0x21')]=function(_0x565cb2,_0x3cc781){var _0x5dca92={},_0x2f34e1={},_0x125db9={'count':0x0,'rows':[]};var _0x3e6e7f=_[_0xb69c('0x22')](db[_0xb69c('0x23')][_0xb69c('0x24')],function(_0x478e3e){return{'name':_0x478e3e[_0xb69c('0x25')],'type':_0x478e3e['type'][_0xb69c('0x26')]};});_0x2f34e1[_0xb69c('0x27')]=_[_0xb69c('0x22')](_0x3e6e7f,_0xb69c('0x20'));_0x2f34e1[_0xb69c('0x28')]=_[_0xb69c('0x29')](_0x565cb2[_0xb69c('0x28')]);_0x2f34e1[_0xb69c('0x2a')]=_[_0xb69c('0x2b')](_0x2f34e1[_0xb69c('0x27')],_0x2f34e1[_0xb69c('0x28')]);_0x5dca92[_0xb69c('0x2c')]=_['intersection'](_0x2f34e1['model'],qs[_0xb69c('0x2d')](_0x565cb2[_0xb69c('0x28')][_0xb69c('0x2d')]));_0x5dca92['attributes']=_0x5dca92[_0xb69c('0x2c')][_0xb69c('0x2e')]?_0x5dca92[_0xb69c('0x2c')]:_0x2f34e1[_0xb69c('0x27')];if(!_0x565cb2['query']['hasOwnProperty'](_0xb69c('0x2f'))){_0x5dca92['limit']=qs[_0xb69c('0x30')](_0x565cb2[_0xb69c('0x28')]['limit']);_0x5dca92[_0xb69c('0x17')]=qs['offset'](_0x565cb2[_0xb69c('0x28')][_0xb69c('0x17')]);}_0x5dca92[_0xb69c('0x31')]=qs[_0xb69c('0x32')](_0x565cb2[_0xb69c('0x28')]['sort']);_0x5dca92['where']=qs[_0xb69c('0x2a')](_['pick'](_0x565cb2['query'],_0x2f34e1[_0xb69c('0x2a')]),_0x3e6e7f);if(_0x565cb2['query']['filter']){_0x5dca92['where']=_['merge'](_0x5dca92[_0xb69c('0x33')],{'$or':_[_0xb69c('0x22')](_0x3e6e7f,function(_0x453838){if(_0x453838[_0xb69c('0x34')]!==_0xb69c('0x35')){var _0x24e65a={};_0x24e65a[_0x453838['name']]={'$like':'%'+_0x565cb2['query'][_0xb69c('0x36')]+'%'};return _0x24e65a;}})});}_0x5dca92=_[_0xb69c('0x37')]({},_0x5dca92,_0x565cb2[_0xb69c('0x38')]);var _0x592730={'where':_0x5dca92[_0xb69c('0x33')]};return db[_0xb69c('0x23')]['count'](_0x592730)[_0xb69c('0x1c')](function(_0x518a98){_0x125db9[_0xb69c('0x16')]=_0x518a98;if(_0x565cb2[_0xb69c('0x28')][_0xb69c('0x39')]){_0x5dca92[_0xb69c('0x3a')]=[{'all':!![]}];}return db[_0xb69c('0x23')][_0xb69c('0x3b')](_0x5dca92);})[_0xb69c('0x1c')](function(_0x387686){_0x125db9[_0xb69c('0x3c')]=_0x387686;return _0x125db9;})['then'](respondWithFilteredResult(_0x3cc781,_0x5dca92))['catch'](handleError(_0x3cc781,null));};exports['show']=function(_0x21ad78,_0x130a00){var _0x5245c6={'raw':!![],'where':{'id':_0x21ad78[_0xb69c('0x3d')]['id']}},_0x95ab2b={};_0x95ab2b[_0xb69c('0x27')]=_[_0xb69c('0x29')](db['OpenchannelTransferReport'][_0xb69c('0x24')]);_0x95ab2b[_0xb69c('0x28')]=_['keys'](_0x21ad78[_0xb69c('0x28')]);_0x95ab2b[_0xb69c('0x2a')]=_[_0xb69c('0x2b')](_0x95ab2b[_0xb69c('0x27')],_0x95ab2b[_0xb69c('0x28')]);_0x5245c6[_0xb69c('0x2c')]=_[_0xb69c('0x2b')](_0x95ab2b['model'],qs[_0xb69c('0x2d')](_0x21ad78[_0xb69c('0x28')]['fields']));_0x5245c6[_0xb69c('0x2c')]=_0x5245c6['attributes'][_0xb69c('0x2e')]?_0x5245c6[_0xb69c('0x2c')]:_0x95ab2b[_0xb69c('0x27')];if(_0x21ad78[_0xb69c('0x28')][_0xb69c('0x39')]){_0x5245c6[_0xb69c('0x3a')]=[{'all':!![]}];}_0x5245c6=_[_0xb69c('0x37')]({},_0x5245c6,_0x21ad78['options']);return db[_0xb69c('0x23')][_0xb69c('0x3e')](_0x5245c6)[_0xb69c('0x1c')](handleEntityNotFound(_0x130a00,null))[_0xb69c('0x1c')](respondWithResult(_0x130a00,null))[_0xb69c('0x3f')](handleError(_0x130a00,null));};exports[_0xb69c('0x40')]=function(_0x2f6d14,_0x1129b9){return db['OpenchannelTransferReport'][_0xb69c('0x40')](_0x2f6d14['body'],{})[_0xb69c('0x1c')](respondWithResult(_0x1129b9,0xc9))['catch'](handleError(_0x1129b9,null));};exports[_0xb69c('0x1b')]=function(_0x2cba88,_0x51530a){if(_0x2cba88[_0xb69c('0x41')]['id']){delete _0x2cba88['body']['id'];}return db[_0xb69c('0x23')][_0xb69c('0x3e')]({'where':{'id':_0x2cba88[_0xb69c('0x3d')]['id']}})[_0xb69c('0x1c')](handleEntityNotFound(_0x51530a,null))[_0xb69c('0x1c')](saveUpdates(_0x2cba88[_0xb69c('0x41')],null))['then'](respondWithResult(_0x51530a,null))[_0xb69c('0x3f')](handleError(_0x51530a,null));};exports[_0xb69c('0x1d')]=function(_0x3a813d,_0x59f46){return db[_0xb69c('0x23')][_0xb69c('0x3e')]({'where':{'id':_0x3a813d[_0xb69c('0x3d')]['id']}})[_0xb69c('0x1c')](handleEntityNotFound(_0x59f46,null))[_0xb69c('0x1c')](removeEntity(_0x59f46,null))[_0xb69c('0x3f')](handleError(_0x59f46,null));};exports['describe']=function(_0x9c3272,_0x4dafd8){return db[_0xb69c('0x23')]['describe']()['then'](respondWithResult(_0x4dafd8,null))['catch'](handleError(_0x4dafd8,null));}; \ No newline at end of file +var _0x3987=['where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x1e11ac,_0x594f8d){var _0x2dd8cb=function(_0x3699a8){while(--_0x3699a8){_0x1e11ac['push'](_0x1e11ac['shift']());}};_0x2dd8cb(++_0x594f8d);}(_0x3987,0x190));var _0x7398=function(_0x1d9080,_0x16b4dc){_0x1d9080=_0x1d9080-0x0;var _0x420761=_0x3987[_0x1d9080];return _0x420761;};'use strict';var pdf=require(_0x7398('0x0'));var emlformat=require(_0x7398('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7398('0x2'));var rp=require(_0x7398('0x3'));var moment=require(_0x7398('0x4'));var BPromise=require(_0x7398('0x5'));var Mustache=require(_0x7398('0x6'));var util=require(_0x7398('0x7'));var path=require(_0x7398('0x8'));var sox=require(_0x7398('0x9'));var csv=require(_0x7398('0xa'));var ejs=require(_0x7398('0xb'));var fs=require('fs');var _=require(_0x7398('0xc'));var squel=require(_0x7398('0xd'));var crypto=require(_0x7398('0xe'));var jsforce=require(_0x7398('0xf'));var deskjs=require(_0x7398('0x10'));var toCsv=require(_0x7398('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7398('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7398('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7398('0x13'))(_0x7398('0x14'));var utils=require(_0x7398('0x15'));var config=require(_0x7398('0x16'));var licenseUtil=require(_0x7398('0x17'));var db=require(_0x7398('0x18'))['db'];function respondWithStatusCode(_0x1e0696,_0x49a36e){_0x49a36e=_0x49a36e||0xcc;return function(_0x4b0bd7){if(_0x4b0bd7){return _0x1e0696['sendStatus'](_0x49a36e);}return _0x1e0696[_0x7398('0x19')](_0x49a36e)[_0x7398('0x1a')]();};}function respondWithResult(_0x21506c,_0x427ad5){_0x427ad5=_0x427ad5||0xc8;return function(_0x44029b){if(_0x44029b){return _0x21506c[_0x7398('0x19')](_0x427ad5)[_0x7398('0x1b')](_0x44029b);}};}function respondWithFilteredResult(_0x1a925d,_0x510c99){return function(_0x33ff4b){if(_0x33ff4b){var _0x385ac7=_0x33ff4b[_0x7398('0x1c')],_0x8f2c62=_0x510c99['offset'],_0x13553e=_0x510c99[_0x7398('0x1d')]+_0x510c99[_0x7398('0x1e')],_0x2505e2;if(_0x13553e>=_0x385ac7){_0x13553e=_0x385ac7;_0x2505e2=0xc8;}else{_0x2505e2=0xce;}_0x1a925d['status'](_0x2505e2);return _0x1a925d['set'](_0x7398('0x1f'),_0x8f2c62+'-'+_0x13553e+'/'+_0x385ac7)[_0x7398('0x1b')](_0x33ff4b);}return null;};}function patchUpdates(_0x23a4ab){return function(_0x419427){try{jsonpatch[_0x7398('0x20')](_0x419427,_0x23a4ab,!![]);}catch(_0x26982e){return BPromise[_0x7398('0x21')](_0x26982e);}return _0x419427[_0x7398('0x22')]();};}function saveUpdates(_0x24e627,_0x6e8ff7){return function(_0x2f3613){if(_0x2f3613){return _0x2f3613['update'](_0x24e627)['then'](function(_0x11b953){return _0x11b953;});}return null;};}function removeEntity(_0x3e47ae,_0x536ba6){return function(_0x12075a){if(_0x12075a){return _0x12075a[_0x7398('0x23')]()[_0x7398('0x24')](function(){_0x3e47ae[_0x7398('0x19')](0xcc)[_0x7398('0x1a')]();});}};}function handleEntityNotFound(_0x15ea65,_0x289310){return function(_0x387c27){if(!_0x387c27){_0x15ea65[_0x7398('0x25')](0x194);}return _0x387c27;};}function handleError(_0x18619f,_0x1448ac){_0x1448ac=_0x1448ac||0x1f4;return function(_0x1b8547){logger[_0x7398('0x26')](_0x1b8547[_0x7398('0x27')]);if(_0x1b8547[_0x7398('0x28')]){delete _0x1b8547[_0x7398('0x28')];}_0x18619f[_0x7398('0x19')](_0x1448ac)['send'](_0x1b8547);};}exports[_0x7398('0x29')]=function(_0x18b6f4,_0x2612ac){var _0x51fa7f={},_0x327de2={},_0x5accbf={'count':0x0,'rows':[]};var _0x283b00=_[_0x7398('0x2a')](db[_0x7398('0x2b')][_0x7398('0x2c')],function(_0x460b25){return{'name':_0x460b25[_0x7398('0x2d')],'type':_0x460b25['type'][_0x7398('0x2e')]};});_0x327de2[_0x7398('0x2f')]=_[_0x7398('0x2a')](_0x283b00,_0x7398('0x28'));_0x327de2[_0x7398('0x30')]=_['keys'](_0x18b6f4[_0x7398('0x30')]);_0x327de2['filters']=_[_0x7398('0x31')](_0x327de2[_0x7398('0x2f')],_0x327de2[_0x7398('0x30')]);_0x51fa7f[_0x7398('0x32')]=_['intersection'](_0x327de2[_0x7398('0x2f')],qs[_0x7398('0x33')](_0x18b6f4[_0x7398('0x30')][_0x7398('0x33')]));_0x51fa7f[_0x7398('0x32')]=_0x51fa7f[_0x7398('0x32')][_0x7398('0x34')]?_0x51fa7f[_0x7398('0x32')]:_0x327de2[_0x7398('0x2f')];if(!_0x18b6f4[_0x7398('0x30')][_0x7398('0x35')]('nolimit')){_0x51fa7f[_0x7398('0x1e')]=qs[_0x7398('0x1e')](_0x18b6f4[_0x7398('0x30')]['limit']);_0x51fa7f[_0x7398('0x1d')]=qs['offset'](_0x18b6f4[_0x7398('0x30')][_0x7398('0x1d')]);}_0x51fa7f[_0x7398('0x36')]=qs[_0x7398('0x37')](_0x18b6f4[_0x7398('0x30')][_0x7398('0x37')]);_0x51fa7f[_0x7398('0x38')]=qs[_0x7398('0x39')](_['pick'](_0x18b6f4[_0x7398('0x30')],_0x327de2[_0x7398('0x39')]),_0x283b00);if(_0x18b6f4[_0x7398('0x30')][_0x7398('0x3a')]){_0x51fa7f[_0x7398('0x38')]=_[_0x7398('0x3b')](_0x51fa7f['where'],{'$or':_['map'](_0x283b00,function(_0x1f8ba7){if(_0x1f8ba7[_0x7398('0x3c')]!==_0x7398('0x3d')){var _0x5571c1={};_0x5571c1[_0x1f8ba7[_0x7398('0x28')]]={'$like':'%'+_0x18b6f4['query'][_0x7398('0x3a')]+'%'};return _0x5571c1;}})});}_0x51fa7f=_[_0x7398('0x3b')]({},_0x51fa7f,_0x18b6f4[_0x7398('0x3e')]);var _0x52c9d5={'where':_0x51fa7f[_0x7398('0x38')]};return db[_0x7398('0x2b')][_0x7398('0x1c')](_0x52c9d5)[_0x7398('0x24')](function(_0x6f3057){_0x5accbf[_0x7398('0x1c')]=_0x6f3057;if(_0x18b6f4[_0x7398('0x30')][_0x7398('0x3f')]){_0x51fa7f[_0x7398('0x40')]=[{'all':!![]}];}return db[_0x7398('0x2b')][_0x7398('0x41')](_0x51fa7f);})[_0x7398('0x24')](function(_0xf0979a){_0x5accbf[_0x7398('0x42')]=_0xf0979a;return _0x5accbf;})[_0x7398('0x24')](respondWithFilteredResult(_0x2612ac,_0x51fa7f))[_0x7398('0x43')](handleError(_0x2612ac,null));};exports[_0x7398('0x44')]=function(_0x5c363b,_0x185e02){var _0x4f3121={'raw':!![],'where':{'id':_0x5c363b[_0x7398('0x45')]['id']}},_0x1da924={};_0x1da924[_0x7398('0x2f')]=_[_0x7398('0x46')](db[_0x7398('0x2b')]['rawAttributes']);_0x1da924['query']=_[_0x7398('0x46')](_0x5c363b[_0x7398('0x30')]);_0x1da924[_0x7398('0x39')]=_[_0x7398('0x31')](_0x1da924[_0x7398('0x2f')],_0x1da924[_0x7398('0x30')]);_0x4f3121[_0x7398('0x32')]=_[_0x7398('0x31')](_0x1da924[_0x7398('0x2f')],qs[_0x7398('0x33')](_0x5c363b[_0x7398('0x30')]['fields']));_0x4f3121[_0x7398('0x32')]=_0x4f3121[_0x7398('0x32')][_0x7398('0x34')]?_0x4f3121[_0x7398('0x32')]:_0x1da924[_0x7398('0x2f')];if(_0x5c363b[_0x7398('0x30')][_0x7398('0x3f')]){_0x4f3121['include']=[{'all':!![]}];}_0x4f3121=_[_0x7398('0x3b')]({},_0x4f3121,_0x5c363b[_0x7398('0x3e')]);return db[_0x7398('0x2b')][_0x7398('0x47')](_0x4f3121)[_0x7398('0x24')](handleEntityNotFound(_0x185e02,null))[_0x7398('0x24')](respondWithResult(_0x185e02,null))[_0x7398('0x43')](handleError(_0x185e02,null));};exports['create']=function(_0x50acf9,_0x21c649){return db[_0x7398('0x2b')][_0x7398('0x48')](_0x50acf9[_0x7398('0x49')],{})[_0x7398('0x24')](respondWithResult(_0x21c649,0xc9))[_0x7398('0x43')](handleError(_0x21c649,null));};exports[_0x7398('0x4a')]=function(_0xd104dc,_0x245824){if(_0xd104dc[_0x7398('0x49')]['id']){delete _0xd104dc[_0x7398('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x7398('0x47')]({'where':{'id':_0xd104dc[_0x7398('0x45')]['id']}})[_0x7398('0x24')](handleEntityNotFound(_0x245824,null))['then'](saveUpdates(_0xd104dc['body'],null))[_0x7398('0x24')](respondWithResult(_0x245824,null))['catch'](handleError(_0x245824,null));};exports[_0x7398('0x23')]=function(_0x124e74,_0x262055){return db[_0x7398('0x2b')][_0x7398('0x47')]({'where':{'id':_0x124e74[_0x7398('0x45')]['id']}})['then'](handleEntityNotFound(_0x262055,null))['then'](removeEntity(_0x262055,null))[_0x7398('0x43')](handleError(_0x262055,null));};exports['describe']=function(_0x41ffa2,_0x64150e){return db[_0x7398('0x2b')][_0x7398('0x4b')]()[_0x7398('0x24')](respondWithResult(_0x64150e,null))[_0x7398('0x43')](handleError(_0x64150e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d7798f0..b4670e7 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 _0x8824=['bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4e5505,_0x48822b){var _0x329278=function(_0x13d761){while(--_0x13d761){_0x4e5505['push'](_0x4e5505['shift']());}};_0x329278(++_0x48822b);}(_0x8824,0xcd));var _0x4882=function(_0x42f75b,_0x51fe4c){_0x42f75b=_0x42f75b-0x0;var _0x1900ea=_0x8824[_0x42f75b];return _0x1900ea;};'use strict';var _=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var logger=require(_0x4882('0x2'))(_0x4882('0x3'));var moment=require(_0x4882('0x4'));var BPromise=require(_0x4882('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4882('0x6'));var rimraf=require('rimraf');var config=require(_0x4882('0x7'));var attributes=require(_0x4882('0x8'));module[_0x4882('0x9')]=function(_0x2ffa5d,_0x3a868b){return _0x2ffa5d[_0x4882('0xa')](_0x4882('0xb'),attributes,{'tableName':_0x4882('0xc'),'paranoid':![],'indexes':[{'name':_0x4882('0xd'),'fields':[_0x4882('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa50a=['bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','util','api','moment'];(function(_0x44018b,_0x1d8fa4){var _0x3e1e36=function(_0x5d26cb){while(--_0x5d26cb){_0x44018b['push'](_0x44018b['shift']());}};_0x3e1e36(++_0x1d8fa4);}(_0xa50a,0x89));var _0xaa50=function(_0x23f50a,_0x1e0fbc){_0x23f50a=_0x23f50a-0x0;var _0x3d48e2=_0xa50a[_0x23f50a];return _0x3d48e2;};'use strict';var _=require('lodash');var util=require(_0xaa50('0x0'));var logger=require('../../config/logger')(_0xaa50('0x1'));var moment=require(_0xaa50('0x2'));var BPromise=require(_0xaa50('0x3'));var rp=require(_0xaa50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa50('0x5'));var config=require('../../config/environment');var attributes=require(_0xaa50('0x6'));module['exports']=function(_0x43a1d8,_0x3a7888){return _0x43a1d8[_0xaa50('0x7')](_0xaa50('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xaa50('0x9'),'fields':[_0xaa50('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1f129ed..92488ba 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 _0x0096=['bluebird','randomstring','../../config/logger','jayson/promise','client','http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x1b95e7,_0x518379){var _0xb2b038=function(_0x676d18){while(--_0x676d18){_0x1b95e7['push'](_0x1b95e7['shift']());}};_0xb2b038(++_0x518379);}(_0x0096,0x11c));var _0x6009=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x0096[_0x5a92ad];return _0x2466f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6009('0x0'));var BPromise=require(_0x6009('0x1'));var rs=require(_0x6009('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6009('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6009('0x4'));var client=jayson[_0x6009('0x5')][_0x6009('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5e3056,_0x123497,_0x35344b){return new BPromise(function(_0x56f8d9,_0x452554){return client[_0x6009('0x7')](_0x5e3056,_0x35344b)[_0x6009('0x8')](function(_0xfbe62d){logger[_0x6009('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x123497,'request\x20sent');logger[_0x6009('0xa')](_0x6009('0xb'),_0x123497,_0x6009('0xc'),JSON[_0x6009('0xd')](_0xfbe62d));if(_0xfbe62d['error']){if(_0xfbe62d[_0x6009('0xe')]['code']===0x1f4){logger[_0x6009('0xe')](_0x6009('0xf'),_0x123497,_0xfbe62d['error'][_0x6009('0x10')]);return _0x452554(_0xfbe62d[_0x6009('0xe')][_0x6009('0x10')]);}logger['error'](_0x6009('0xf'),_0x123497,_0xfbe62d[_0x6009('0xe')][_0x6009('0x10')]);return _0x56f8d9(_0xfbe62d[_0x6009('0xe')][_0x6009('0x10')]);}else{logger[_0x6009('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x123497,_0x6009('0xc'));_0x56f8d9(_0xfbe62d[_0x6009('0x11')]['message']);}})[_0x6009('0x12')](function(_0x1958ca){logger[_0x6009('0xe')](_0x6009('0xf'),_0x123497,_0x1958ca);_0x452554(_0x1958ca);});});} \ No newline at end of file +var _0xda9d=['request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xda9d,0x85));var _0xdda9=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0xda9d[_0x55c485];return _0x6bb521;};'use strict';var _=require('lodash');var util=require(_0xdda9('0x0'));var moment=require(_0xdda9('0x1'));var BPromise=require(_0xdda9('0x2'));var rs=require(_0xdda9('0x3'));var fs=require('fs');var Redis=require(_0xdda9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdda9('0x5'));var logger=require('../../config/logger')(_0xdda9('0x6'));var config=require('../../config/environment');var jayson=require(_0xdda9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9ba7,_0x78319,_0x144e33){return new BPromise(function(_0x46d8f2,_0x3060e0){return client['request'](_0x4e9ba7,_0x144e33)[_0xdda9('0x8')](function(_0x45e6c3){logger[_0xdda9('0x9')](_0xdda9('0xa'),_0x78319,_0xdda9('0xb'));logger[_0xdda9('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x78319,'request\x20sent',JSON['stringify'](_0x45e6c3));if(_0x45e6c3[_0xdda9('0xd')]){if(_0x45e6c3[_0xdda9('0xd')][_0xdda9('0xe')]===0x1f4){logger['error'](_0xdda9('0xa'),_0x78319,_0x45e6c3[_0xdda9('0xd')][_0xdda9('0xf')]);return _0x3060e0(_0x45e6c3['error']['message']);}logger[_0xdda9('0xd')](_0xdda9('0xa'),_0x78319,_0x45e6c3[_0xdda9('0xd')][_0xdda9('0xf')]);return _0x46d8f2(_0x45e6c3[_0xdda9('0xd')][_0xdda9('0xf')]);}else{logger[_0xdda9('0x9')](_0xdda9('0xa'),_0x78319,_0xdda9('0xb'));_0x46d8f2(_0x45e6c3[_0xdda9('0x10')][_0xdda9('0xf')]);}})[_0xdda9('0x11')](function(_0x2da172){logger[_0xdda9('0xd')](_0xdda9('0xa'),_0x78319,_0x2da172);_0x3060e0(_0x2da172);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 68c88af..a2f0bef 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 _0x6857=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','create','put','update'];(function(_0x3c64d7,_0x56c799){var _0x55c201=function(_0x4cdc9b){while(--_0x4cdc9b){_0x3c64d7['push'](_0x3c64d7['shift']());}};_0x55c201(++_0x56c799);}(_0x6857,0xa4));var _0x7685=function(_0x58a318,_0x592764){_0x58a318=_0x58a318-0x0;var _0x254d35=_0x6857[_0x58a318];return _0x254d35;};'use strict';var multer=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var path=require(_0x7685('0x2'));var timeout=require(_0x7685('0x3'));var express=require(_0x7685('0x4'));var router=express[_0x7685('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7685('0x6'));var config=require(_0x7685('0x7'));var controller=require(_0x7685('0x8'));router[_0x7685('0x9')]('/',auth[_0x7685('0xa')](),controller['index']);router['get']('/:id',auth[_0x7685('0xa')](),controller[_0x7685('0xb')]);router[_0x7685('0xc')]('/',auth['isAuthenticated'](),controller[_0x7685('0xd')]);router[_0x7685('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7685('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7685('0x10')]);module[_0x7685('0x11')]=router; \ No newline at end of file +var _0x2820=['create','delete','destroy','exports','util','path','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2820,0x1d8));var _0x0282=function(_0x59efa,_0x5e53c8){_0x59efa=_0x59efa-0x0;var _0x2ac989=_0x2820[_0x59efa];return _0x2ac989;};'use strict';var multer=require('multer');var util=require(_0x0282('0x0'));var path=require(_0x0282('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0282('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0282('0x3'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0x0282('0x4')](),controller[_0x0282('0x5')]);router[_0x0282('0x6')](_0x0282('0x7'),auth[_0x0282('0x4')](),controller[_0x0282('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0282('0x9')]);router['put'](_0x0282('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x0282('0xa')](_0x0282('0x7'),auth[_0x0282('0x4')](),controller[_0x0282('0xb')]);module[_0x0282('0xc')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9983439..7d8d588 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 _0xcc75=['exports','STRING','name'];(function(_0x657e67,_0x518f58){var _0x29e86d=function(_0x3afc81){while(--_0x3afc81){_0x657e67['push'](_0x657e67['shift']());}};_0x29e86d(++_0x518f58);}(_0xcc75,0x1d4));var _0x5cc7=function(_0x3dd24,_0x2b16b5){_0x3dd24=_0x3dd24-0x0;var _0x583f8a=_0xcc75[_0x3dd24];return _0x583f8a;};'use strict';var Sequelize=require('sequelize');module[_0x5cc7('0x0')]={'name':{'type':Sequelize[_0x5cc7('0x1')],'unique':_0x5cc7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5cc7('0x1')]}}; \ No newline at end of file +var _0x536c=['exports','STRING','name'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x536c,0x1dd));var _0xc536=function(_0x2b9028,_0x1780e2){_0x2b9028=_0x2b9028-0x0;var _0x36032b=_0x536c[_0x2b9028];return _0x36032b;};'use strict';var Sequelize=require('sequelize');module[_0xc536('0x0')]={'name':{'type':Sequelize[_0xc536('0x1')],'unique':_0xc536('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc536('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9363db8..a47af94 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 _0x6cc1=['Content-Range','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0x6cc1,0x118));var _0x16cc=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0x6cc1[_0x415603];return _0x131e72;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x16cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16cc('0x1'));var jsonpatch=require(_0x16cc('0x2'));var rp=require('request-promise');var moment=require(_0x16cc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x16cc('0x4'));var util=require(_0x16cc('0x5'));var path=require(_0x16cc('0x6'));var sox=require(_0x16cc('0x7'));var csv=require(_0x16cc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x16cc('0x9'));var squel=require(_0x16cc('0xa'));var crypto=require(_0x16cc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x16cc('0xc'));var toCsv=require(_0x16cc('0x8'));var querystring=require(_0x16cc('0xd'));var Papa=require('papaparse');var Redis=require(_0x16cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x16cc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16cc('0x10'))(_0x16cc('0x11'));var utils=require(_0x16cc('0x12'));var config=require(_0x16cc('0x13'));var licenseUtil=require(_0x16cc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139750,_0x3e9e2e){_0x3e9e2e=_0x3e9e2e||0xcc;return function(_0x4f2b1b){if(_0x4f2b1b){return _0x139750[_0x16cc('0x15')](_0x3e9e2e);}return _0x139750[_0x16cc('0x16')](_0x3e9e2e)[_0x16cc('0x17')]();};}function respondWithResult(_0x26ea87,_0x6dcf){_0x6dcf=_0x6dcf||0xc8;return function(_0x904c71){if(_0x904c71){return _0x26ea87['status'](_0x6dcf)[_0x16cc('0x18')](_0x904c71);}};}function respondWithFilteredResult(_0x2b6e80,_0x3ed9bf){return function(_0x11c196){if(_0x11c196){var _0x2d6821=_0x11c196[_0x16cc('0x19')],_0x4e8d11=_0x3ed9bf[_0x16cc('0x1a')],_0x5c9154=_0x3ed9bf[_0x16cc('0x1a')]+_0x3ed9bf[_0x16cc('0x1b')],_0x5a0563;if(_0x5c9154>=_0x2d6821){_0x5c9154=_0x2d6821;_0x5a0563=0xc8;}else{_0x5a0563=0xce;}_0x2b6e80[_0x16cc('0x16')](_0x5a0563);return _0x2b6e80['set'](_0x16cc('0x1c'),_0x4e8d11+'-'+_0x5c9154+'/'+_0x2d6821)[_0x16cc('0x18')](_0x11c196);}return null;};}function patchUpdates(_0x73935f){return function(_0x1b4000){try{jsonpatch['apply'](_0x1b4000,_0x73935f,!![]);}catch(_0x268d6f){return BPromise['reject'](_0x268d6f);}return _0x1b4000[_0x16cc('0x1d')]();};}function saveUpdates(_0x22ce7d,_0xdc0b96){return function(_0x41aa18){if(_0x41aa18){return _0x41aa18[_0x16cc('0x1e')](_0x22ce7d)[_0x16cc('0x1f')](function(_0x280854){return _0x280854;});}return null;};}function removeEntity(_0x485d8c,_0x5c8588){return function(_0x2af845){if(_0x2af845){return _0x2af845[_0x16cc('0x20')]()['then'](function(){var _0xa74314=_0x2af845[_0x16cc('0x21')]({'plain':!![]});var _0x96ac48=_0x16cc('0x22');return db[_0x16cc('0x23')][_0x16cc('0x20')]({'where':{'type':_0x96ac48,'resourceId':_0xa74314['id']}})[_0x16cc('0x1f')](function(){return _0x2af845;});})[_0x16cc('0x1f')](function(){_0x485d8c[_0x16cc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196e0b,_0x16b771){return function(_0x572a74){if(!_0x572a74){_0x196e0b['sendStatus'](0x194);}return _0x572a74;};}function handleError(_0x27665e,_0x3f602c){_0x3f602c=_0x3f602c||0x1f4;return function(_0x4a4dc1){logger[_0x16cc('0x24')](_0x4a4dc1[_0x16cc('0x25')]);if(_0x4a4dc1[_0x16cc('0x26')]){delete _0x4a4dc1[_0x16cc('0x26')];}_0x27665e['status'](_0x3f602c)[_0x16cc('0x27')](_0x4a4dc1);};}exports[_0x16cc('0x28')]=function(_0x3bd315,_0x193654){var _0x78c69f={},_0x25fd9b={},_0x110d6c={'count':0x0,'rows':[]};var _0x3b5a65=_['map'](db[_0x16cc('0x29')][_0x16cc('0x2a')],function(_0x3d80ac){return{'name':_0x3d80ac[_0x16cc('0x2b')],'type':_0x3d80ac[_0x16cc('0x2c')]['key']};});_0x25fd9b[_0x16cc('0x2d')]=_[_0x16cc('0x2e')](_0x3b5a65,_0x16cc('0x26'));_0x25fd9b[_0x16cc('0x2f')]=_[_0x16cc('0x30')](_0x3bd315[_0x16cc('0x2f')]);_0x25fd9b[_0x16cc('0x31')]=_[_0x16cc('0x32')](_0x25fd9b[_0x16cc('0x2d')],_0x25fd9b['query']);_0x78c69f[_0x16cc('0x33')]=_[_0x16cc('0x32')](_0x25fd9b['model'],qs[_0x16cc('0x34')](_0x3bd315[_0x16cc('0x2f')][_0x16cc('0x34')]));_0x78c69f[_0x16cc('0x33')]=_0x78c69f[_0x16cc('0x33')][_0x16cc('0x35')]?_0x78c69f[_0x16cc('0x33')]:_0x25fd9b[_0x16cc('0x2d')];if(!_0x3bd315[_0x16cc('0x2f')][_0x16cc('0x36')]('nolimit')){_0x78c69f[_0x16cc('0x1b')]=qs[_0x16cc('0x1b')](_0x3bd315['query']['limit']);_0x78c69f[_0x16cc('0x1a')]=qs[_0x16cc('0x1a')](_0x3bd315[_0x16cc('0x2f')][_0x16cc('0x1a')]);}_0x78c69f[_0x16cc('0x37')]=qs[_0x16cc('0x38')](_0x3bd315[_0x16cc('0x2f')]['sort']);_0x78c69f[_0x16cc('0x39')]=qs[_0x16cc('0x31')](_['pick'](_0x3bd315[_0x16cc('0x2f')],_0x25fd9b[_0x16cc('0x31')]),_0x3b5a65);if(_0x3bd315[_0x16cc('0x2f')][_0x16cc('0x3a')]){_0x78c69f['where']=_['merge'](_0x78c69f[_0x16cc('0x39')],{'$or':_[_0x16cc('0x2e')](_0x3b5a65,function(_0x17b3d8){if(_0x17b3d8[_0x16cc('0x2c')]!==_0x16cc('0x3b')){var _0x1def82={};_0x1def82[_0x17b3d8[_0x16cc('0x26')]]={'$like':'%'+_0x3bd315[_0x16cc('0x2f')][_0x16cc('0x3a')]+'%'};return _0x1def82;}})});}_0x78c69f=_[_0x16cc('0x3c')]({},_0x78c69f,_0x3bd315['options']);var _0x35af32={'where':_0x78c69f[_0x16cc('0x39')]};return db[_0x16cc('0x29')]['count'](_0x35af32)['then'](function(_0x4b05fe){_0x110d6c[_0x16cc('0x19')]=_0x4b05fe;if(_0x3bd315[_0x16cc('0x2f')][_0x16cc('0x3d')]){_0x78c69f[_0x16cc('0x3e')]=[{'all':!![]}];}return db[_0x16cc('0x29')]['findAll'](_0x78c69f);})[_0x16cc('0x1f')](function(_0x280a98){_0x110d6c[_0x16cc('0x3f')]=_0x280a98;return _0x110d6c;})[_0x16cc('0x1f')](respondWithFilteredResult(_0x193654,_0x78c69f))[_0x16cc('0x40')](handleError(_0x193654,null));};exports[_0x16cc('0x41')]=function(_0x32853a,_0x198f73){var _0x11a3ac={'raw':!![],'where':{'id':_0x32853a[_0x16cc('0x42')]['id']}},_0x4ea206={};_0x4ea206[_0x16cc('0x2d')]=_[_0x16cc('0x30')](db[_0x16cc('0x29')][_0x16cc('0x2a')]);_0x4ea206[_0x16cc('0x2f')]=_[_0x16cc('0x30')](_0x32853a[_0x16cc('0x2f')]);_0x4ea206['filters']=_[_0x16cc('0x32')](_0x4ea206[_0x16cc('0x2d')],_0x4ea206[_0x16cc('0x2f')]);_0x11a3ac[_0x16cc('0x33')]=_[_0x16cc('0x32')](_0x4ea206[_0x16cc('0x2d')],qs[_0x16cc('0x34')](_0x32853a[_0x16cc('0x2f')][_0x16cc('0x34')]));_0x11a3ac[_0x16cc('0x33')]=_0x11a3ac[_0x16cc('0x33')][_0x16cc('0x35')]?_0x11a3ac['attributes']:_0x4ea206[_0x16cc('0x2d')];if(_0x32853a[_0x16cc('0x2f')][_0x16cc('0x3d')]){_0x11a3ac[_0x16cc('0x3e')]=[{'all':!![]}];}_0x11a3ac=_[_0x16cc('0x3c')]({},_0x11a3ac,_0x32853a[_0x16cc('0x43')]);return db[_0x16cc('0x29')][_0x16cc('0x44')](_0x11a3ac)[_0x16cc('0x1f')](handleEntityNotFound(_0x198f73,null))[_0x16cc('0x1f')](respondWithResult(_0x198f73,null))['catch'](handleError(_0x198f73,null));};exports[_0x16cc('0x45')]=function(_0x1e68b8,_0x443199){return db[_0x16cc('0x29')][_0x16cc('0x45')](_0x1e68b8[_0x16cc('0x46')],{})[_0x16cc('0x1f')](function(_0x63a39d){var _0x30c13b=_0x1e68b8[_0x16cc('0x47')][_0x16cc('0x21')]({'plain':!![]});if(!_0x30c13b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30c13b[_0x16cc('0x48')]===_0x16cc('0x47')){var _0x31302d=_0x63a39d[_0x16cc('0x21')]({'plain':!![]});var _0x4f2790=_0x16cc('0x22');return db[_0x16cc('0x49')]['find']({'where':{'name':_0x4f2790,'userProfileId':_0x30c13b[_0x16cc('0x4a')]},'raw':!![]})['then'](function(_0x468699){if(_0x468699&&_0x468699[_0x16cc('0x4b')]===0x0){return db[_0x16cc('0x23')][_0x16cc('0x45')]({'name':_0x31302d['name'],'resourceId':_0x31302d['id'],'type':_0x468699[_0x16cc('0x26')],'sectionId':_0x468699['id']},{})[_0x16cc('0x1f')](function(){return _0x63a39d;});}else{return _0x63a39d;}})[_0x16cc('0x40')](function(_0x2a2810){logger['error'](_0x16cc('0x4c'),_0x2a2810);throw _0x2a2810;});}return _0x63a39d;})[_0x16cc('0x1f')](respondWithResult(_0x443199,0xc9))['catch'](handleError(_0x443199,null));};exports[_0x16cc('0x1e')]=function(_0x44f6c1,_0x1c368c){if(_0x44f6c1['body']['id']){delete _0x44f6c1[_0x16cc('0x46')]['id'];}return db['Pause'][_0x16cc('0x44')]({'where':{'id':_0x44f6c1[_0x16cc('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c368c,null))[_0x16cc('0x1f')](saveUpdates(_0x44f6c1['body'],null))[_0x16cc('0x1f')](respondWithResult(_0x1c368c,null))[_0x16cc('0x40')](handleError(_0x1c368c,null));};exports[_0x16cc('0x20')]=function(_0x502c5a,_0x2d2078){return db[_0x16cc('0x29')][_0x16cc('0x44')]({'where':{'id':_0x502c5a[_0x16cc('0x42')]['id']}})[_0x16cc('0x1f')](handleEntityNotFound(_0x2d2078,null))[_0x16cc('0x1f')](removeEntity(_0x2d2078,null))[_0x16cc('0x40')](handleError(_0x2d2078,null));}; \ No newline at end of file +var _0xd6d6=['model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x41ea67,_0x334254){_0x41ea67=_0x41ea67-0x0;var _0x54b2b0=_0xd6d6[_0x41ea67];return _0x54b2b0;};'use strict';var pdf=require(_0x6d6d('0x0'));var emlformat=require(_0x6d6d('0x1'));var rimraf=require(_0x6d6d('0x2'));var zipdir=require(_0x6d6d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d6d('0x4'));var moment=require(_0x6d6d('0x5'));var BPromise=require(_0x6d6d('0x6'));var Mustache=require(_0x6d6d('0x7'));var util=require(_0x6d6d('0x8'));var path=require(_0x6d6d('0x9'));var sox=require(_0x6d6d('0xa'));var csv=require('to-csv');var ejs=require(_0x6d6d('0xb'));var fs=require('fs');var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x12'));var authService=require(_0x6d6d('0x13'));var qs=require(_0x6d6d('0x14'));var as=require(_0x6d6d('0x15'));var hardwareService=require(_0x6d6d('0x16'));var logger=require('../../config/logger')(_0x6d6d('0x17'));var utils=require(_0x6d6d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x19'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x1a')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1b')](_0xe61c36)[_0x6d6d('0x1c')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1b')](_0x5f4154)[_0x6d6d('0x1d')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=_0x5d80c0[_0x6d6d('0x1e')],_0x587338=_0x29cbd8['offset'],_0x27830d=_0x29cbd8['offset']+_0x29cbd8[_0x6d6d('0x1f')],_0x2cbc86;if(_0x27830d>=_0x2e6fdb){_0x27830d=_0x2e6fdb;_0x2cbc86=0xc8;}else{_0x2cbc86=0xce;}_0xa3b05d[_0x6d6d('0x1b')](_0x2cbc86);return _0xa3b05d[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x587338+'-'+_0x27830d+'/'+_0x2e6fdb)['json'](_0x5d80c0);}return null;};}function patchUpdates(_0x554392){return function(_0x474873){try{jsonpatch['apply'](_0x474873,_0x554392,!![]);}catch(_0x26f631){return BPromise[_0x6d6d('0x22')](_0x26f631);}return _0x474873[_0x6d6d('0x23')]();};}function saveUpdates(_0x450352,_0x40d35b){return function(_0x3242d8){if(_0x3242d8){return _0x3242d8[_0x6d6d('0x24')](_0x450352)[_0x6d6d('0x25')](function(_0x115a3c){return _0x115a3c;});}return null;};}function removeEntity(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')]()[_0x6d6d('0x25')](function(){var _0x1f7f88=_0x6e58e3[_0x6d6d('0x27')]({'plain':!![]});var _0xced622='Pauses';return db[_0x6d6d('0x28')][_0x6d6d('0x26')]({'where':{'type':_0xced622,'resourceId':_0x1f7f88['id']}})[_0x6d6d('0x25')](function(){return _0x6e58e3;});})[_0x6d6d('0x25')](function(){_0x6f64e3[_0x6d6d('0x1b')](0xcc)[_0x6d6d('0x1c')]();});}};}function handleEntityNotFound(_0x554f8e,_0x2851dd){return function(_0x2b5e31){if(!_0x2b5e31){_0x554f8e[_0x6d6d('0x1a')](0x194);}return _0x2b5e31;};}function handleError(_0x126ac8,_0x25c121){_0x25c121=_0x25c121||0x1f4;return function(_0x408f98){logger[_0x6d6d('0x29')](_0x408f98['stack']);if(_0x408f98[_0x6d6d('0x2a')]){delete _0x408f98[_0x6d6d('0x2a')];}_0x126ac8['status'](_0x25c121)['send'](_0x408f98);};}exports[_0x6d6d('0x2b')]=function(_0x5273cd,_0x8a9a84){var _0x57341f={},_0xde3272={},_0x20255e={'count':0x0,'rows':[]};var _0x3851d1=_[_0x6d6d('0x2c')](db[_0x6d6d('0x2d')][_0x6d6d('0x2e')],function(_0xdda3f2){return{'name':_0xdda3f2[_0x6d6d('0x2f')],'type':_0xdda3f2[_0x6d6d('0x30')][_0x6d6d('0x31')]};});_0xde3272['model']=_[_0x6d6d('0x2c')](_0x3851d1,'name');_0xde3272[_0x6d6d('0x32')]=_[_0x6d6d('0x33')](_0x5273cd[_0x6d6d('0x32')]);_0xde3272[_0x6d6d('0x34')]=_['intersection'](_0xde3272[_0x6d6d('0x35')],_0xde3272['query']);_0x57341f[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0xde3272['model'],qs[_0x6d6d('0x38')](_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x38')]));_0x57341f[_0x6d6d('0x36')]=_0x57341f[_0x6d6d('0x36')][_0x6d6d('0x39')]?_0x57341f[_0x6d6d('0x36')]:_0xde3272[_0x6d6d('0x35')];if(!_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x57341f[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x5273cd[_0x6d6d('0x32')]['limit']);_0x57341f[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3c')](_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x3c')]);}_0x57341f['order']=qs['sort'](_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x3d')]);_0x57341f[_0x6d6d('0x3e')]=qs['filters'](_[_0x6d6d('0x3f')](_0x5273cd[_0x6d6d('0x32')],_0xde3272[_0x6d6d('0x34')]),_0x3851d1);if(_0x5273cd[_0x6d6d('0x32')]['filter']){_0x57341f['where']=_['merge'](_0x57341f[_0x6d6d('0x3e')],{'$or':_[_0x6d6d('0x2c')](_0x3851d1,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x30')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2a')]]={'$like':'%'+_0x5273cd[_0x6d6d('0x32')][_0x6d6d('0x40')]+'%'};return _0x253416;}})});}_0x57341f=_[_0x6d6d('0x41')]({},_0x57341f,_0x5273cd[_0x6d6d('0x42')]);var _0x4b457d={'where':_0x57341f[_0x6d6d('0x3e')]};return db[_0x6d6d('0x2d')][_0x6d6d('0x1e')](_0x4b457d)[_0x6d6d('0x25')](function(_0x32275b){_0x20255e[_0x6d6d('0x1e')]=_0x32275b;if(_0x5273cd[_0x6d6d('0x32')]['includeAll']){_0x57341f[_0x6d6d('0x43')]=[{'all':!![]}];}return db[_0x6d6d('0x2d')][_0x6d6d('0x44')](_0x57341f);})[_0x6d6d('0x25')](function(_0xe1aa77){_0x20255e['rows']=_0xe1aa77;return _0x20255e;})[_0x6d6d('0x25')](respondWithFilteredResult(_0x8a9a84,_0x57341f))[_0x6d6d('0x45')](handleError(_0x8a9a84,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':!![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x35')]=_[_0x6d6d('0x33')](db[_0x6d6d('0x2d')][_0x6d6d('0x2e')]);_0x43c03c[_0x6d6d('0x32')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x34')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x32')]);_0x15bf62[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0x43c03c['model'],qs[_0x6d6d('0x38')](_0x452de2['query'][_0x6d6d('0x38')]));_0x15bf62[_0x6d6d('0x36')]=_0x15bf62[_0x6d6d('0x36')][_0x6d6d('0x39')]?_0x15bf62[_0x6d6d('0x36')]:_0x43c03c[_0x6d6d('0x35')];if(_0x452de2[_0x6d6d('0x32')]['includeAll']){_0x15bf62[_0x6d6d('0x43')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x41')]({},_0x15bf62,_0x452de2[_0x6d6d('0x42')]);return db[_0x6d6d('0x2d')][_0x6d6d('0x46')](_0x15bf62)[_0x6d6d('0x25')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x25')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x45')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x47')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2d')][_0x6d6d('0x47')](_0x5e4c04[_0x6d6d('0x48')],{})[_0x6d6d('0x25')](function(_0xe2a20e){var _0x492834=_0x5e4c04[_0x6d6d('0x49')][_0x6d6d('0x27')]({'plain':!![]});if(!_0x492834)throw new Error(_0x6d6d('0x4a'));if(_0x492834[_0x6d6d('0x4b')]===_0x6d6d('0x49')){var _0x23c2db=_0xe2a20e[_0x6d6d('0x27')]({'plain':!![]});var _0x39ec2a=_0x6d6d('0x4c');return db[_0x6d6d('0x4d')][_0x6d6d('0x46')]({'where':{'name':_0x39ec2a,'userProfileId':_0x492834[_0x6d6d('0x4e')]},'raw':!![]})['then'](function(_0x190786){if(_0x190786&&_0x190786[_0x6d6d('0x4f')]===0x0){return db[_0x6d6d('0x28')][_0x6d6d('0x47')]({'name':_0x23c2db[_0x6d6d('0x2a')],'resourceId':_0x23c2db['id'],'type':_0x190786['name'],'sectionId':_0x190786['id']},{})[_0x6d6d('0x25')](function(){return _0xe2a20e;});}else{return _0xe2a20e;}})[_0x6d6d('0x45')](function(_0x45340b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45340b);throw _0x45340b;});}return _0xe2a20e;})[_0x6d6d('0x25')](respondWithResult(_0x4d78bb,0xc9))['catch'](handleError(_0x4d78bb,null));};exports[_0x6d6d('0x24')]=function(_0x995fe2,_0x32aaae){if(_0x995fe2[_0x6d6d('0x48')]['id']){delete _0x995fe2[_0x6d6d('0x48')]['id'];}return db[_0x6d6d('0x2d')][_0x6d6d('0x46')]({'where':{'id':_0x995fe2[_0x6d6d('0x50')]['id']}})[_0x6d6d('0x25')](handleEntityNotFound(_0x32aaae,null))[_0x6d6d('0x25')](saveUpdates(_0x995fe2['body'],null))[_0x6d6d('0x25')](respondWithResult(_0x32aaae,null))[_0x6d6d('0x45')](handleError(_0x32aaae,null));};exports[_0x6d6d('0x26')]=function(_0x8000b6,_0x1f98d4){return db[_0x6d6d('0x2d')][_0x6d6d('0x46')]({'where':{'id':_0x8000b6['params']['id']}})['then'](handleEntityNotFound(_0x1f98d4,null))[_0x6d6d('0x25')](removeEntity(_0x1f98d4,null))[_0x6d6d('0x45')](handleError(_0x1f98d4,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 91b8e2a..c234725 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 _0x5a13=['define','Pause','tools_pauses','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x3c6774,_0x7d92f3){var _0x25897e=function(_0x4231c3){while(--_0x4231c3){_0x3c6774['push'](_0x3c6774['shift']());}};_0x25897e(++_0x7d92f3);}(_0x5a13,0x145));var _0x35a1=function(_0xc67de1,_0x146103){_0xc67de1=_0xc67de1-0x0;var _0x16d915=_0x5a13[_0xc67de1];return _0x16d915;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var logger=require('../../config/logger')(_0x35a1('0x2'));var moment=require(_0x35a1('0x3'));var BPromise=require(_0x35a1('0x4'));var rp=require(_0x35a1('0x5'));var fs=require('fs');var path=require(_0x35a1('0x6'));var rimraf=require(_0x35a1('0x7'));var config=require(_0x35a1('0x8'));var attributes=require(_0x35a1('0x9'));module[_0x35a1('0xa')]=function(_0x1a4d3c,_0x1ac21e){return _0x1a4d3c[_0x35a1('0xb')](_0x35a1('0xc'),attributes,{'tableName':_0x35a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ffe=['bluebird','path','rimraf','exports','Pause','tools_pauses','util','../../config/logger','api','moment'];(function(_0x9b1553,_0x21aed9){var _0x39696b=function(_0x3122d8){while(--_0x3122d8){_0x9b1553['push'](_0x9b1553['shift']());}};_0x39696b(++_0x21aed9);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x2b7815,_0x4be572){_0x2b7815=_0x2b7815-0x0;var _0x4ad4cf=_0x2ffe[_0x2b7815];return _0x4ad4cf;};'use strict';var _=require('lodash');var util=require(_0xe2ff('0x0'));var logger=require(_0xe2ff('0x1'))(_0xe2ff('0x2'));var moment=require(_0xe2ff('0x3'));var BPromise=require(_0xe2ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ff('0x5'));var rimraf=require(_0xe2ff('0x6'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0xe2ff('0x7')]=function(_0xc562df,_0xa461e7){return _0xc562df['define'](_0xe2ff('0x8'),attributes,{'tableName':_0xe2ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e77d16d..11ef807 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 _0x95ca=['Pause','find','options','where','attributes','include','model','map','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowPause'];(function(_0x3cfc01,_0x4ea6b9){var _0x52d02c=function(_0x375398){while(--_0x375398){_0x3cfc01['push'](_0x3cfc01['shift']());}};_0x52d02c(++_0x4ea6b9);}(_0x95ca,0x1ac));var _0xa95c=function(_0x43a035,_0x37cca2){_0x43a035=_0x43a035-0x0;var _0x4f31dd=_0x95ca[_0x43a035];return _0x4f31dd;};'use strict';var _=require(_0xa95c('0x0'));var util=require(_0xa95c('0x1'));var moment=require(_0xa95c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa95c('0x3'));var db=require(_0xa95c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa95c('0x5'))('rpc');var config=require(_0xa95c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa95c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20391d,_0x35871a,_0x490e44){return new BPromise(function(_0x474f06,_0x2f5f97){return client[_0xa95c('0x8')](_0x20391d,_0x490e44)[_0xa95c('0x9')](function(_0xb2ec77){logger[_0xa95c('0xa')](_0xa95c('0xb'),_0x35871a,_0xa95c('0xc'));logger['debug'](_0xa95c('0xd'),_0x35871a,_0xa95c('0xc'),JSON[_0xa95c('0xe')](_0xb2ec77));if(_0xb2ec77[_0xa95c('0xf')]){if(_0xb2ec77[_0xa95c('0xf')][_0xa95c('0x10')]===0x1f4){logger[_0xa95c('0xf')]('Pause,\x20%s,\x20%s',_0x35871a,_0xb2ec77['error'][_0xa95c('0x11')]);return _0x2f5f97(_0xb2ec77[_0xa95c('0xf')][_0xa95c('0x11')]);}logger[_0xa95c('0xf')](_0xa95c('0xb'),_0x35871a,_0xb2ec77[_0xa95c('0xf')]['message']);return _0x474f06(_0xb2ec77['error']['message']);}else{logger[_0xa95c('0xa')](_0xa95c('0xb'),_0x35871a,'request\x20sent');_0x474f06(_0xb2ec77['result'][_0xa95c('0x11')]);}})[_0xa95c('0x12')](function(_0x3eb556){logger[_0xa95c('0xf')]('Pause,\x20%s,\x20%s',_0x35871a,_0x3eb556);_0x2f5f97(_0x3eb556);});});}exports[_0xa95c('0x13')]=function(_0x589187){var _0x273074=this;return new Promise(function(_0x33bbc0,_0x5b393b){return db[_0xa95c('0x14')][_0xa95c('0x15')]({'raw':_0x589187[_0xa95c('0x16')]?_0x589187['options']['raw']===undefined?!![]:![]:!![],'where':_0x589187[_0xa95c('0x16')]?_0x589187[_0xa95c('0x16')][_0xa95c('0x17')]||null:null,'attributes':_0x589187[_0xa95c('0x16')]?_0x589187[_0xa95c('0x16')][_0xa95c('0x18')]||null:null,'include':_0x589187[_0xa95c('0x16')]?_0x589187[_0xa95c('0x16')][_0xa95c('0x19')]?_['map'](_0x589187[_0xa95c('0x16')][_0xa95c('0x19')],function(_0x4ff206){return{'model':db[_0x4ff206[_0xa95c('0x1a')]],'as':_0x4ff206['as'],'attributes':_0x4ff206[_0xa95c('0x18')],'include':_0x4ff206[_0xa95c('0x19')]?_['map'](_0x4ff206['include'],function(_0x500076){return{'model':db[_0x500076[_0xa95c('0x1a')]],'as':_0x500076['as'],'attributes':_0x500076[_0xa95c('0x18')],'include':_0x500076[_0xa95c('0x19')]?_[_0xa95c('0x1b')](_0x500076['include'],function(_0x1351ee){return{'model':db[_0x1351ee[_0xa95c('0x1a')]],'as':_0x1351ee['as'],'attributes':_0x1351ee[_0xa95c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa95c('0x9')](function(_0x8bbe5){logger['info'](_0xa95c('0x13'),_0x589187);logger['debug'](_0xa95c('0x13'),_0x589187,JSON[_0xa95c('0xe')](_0x8bbe5));_0x33bbc0(_0x8bbe5);})[_0xa95c('0x12')](function(_0x3656fd){logger[_0xa95c('0xf')](_0xa95c('0x13'),_0x3656fd[_0xa95c('0x11')],_0x589187);_0x5b393b(_0x273074[_0xa95c('0xf')](0x1f4,_0x3656fd[_0xa95c('0x11')]));});});}; \ No newline at end of file +var _0xdf8a=['find','options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','ShowPause','Pause'];(function(_0x1c784c,_0x80371){var _0x4f5242=function(_0x51d634){while(--_0x51d634){_0x1c784c['push'](_0x1c784c['shift']());}};_0x4f5242(++_0x80371);}(_0xdf8a,0xe1));var _0xadf8=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xdf8a[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xadf8('0x0'));var BPromise=require(_0xadf8('0x1'));var rs=require(_0xadf8('0x2'));var fs=require('fs');var Redis=require(_0xadf8('0x3'));var db=require(_0xadf8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xadf8('0x5'))(_0xadf8('0x6'));var config=require(_0xadf8('0x7'));var jayson=require(_0xadf8('0x8'));var client=jayson[_0xadf8('0x9')][_0xadf8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30cbc7,_0x2e9bbf,_0x2ef3a7){return new BPromise(function(_0x1babb6,_0x3f638c){return client[_0xadf8('0xb')](_0x30cbc7,_0x2ef3a7)[_0xadf8('0xc')](function(_0x276f97){logger[_0xadf8('0xd')](_0xadf8('0xe'),_0x2e9bbf,_0xadf8('0xf'));logger[_0xadf8('0x10')](_0xadf8('0x11'),_0x2e9bbf,_0xadf8('0xf'),JSON['stringify'](_0x276f97));if(_0x276f97['error']){if(_0x276f97[_0xadf8('0x12')][_0xadf8('0x13')]===0x1f4){logger['error'](_0xadf8('0xe'),_0x2e9bbf,_0x276f97[_0xadf8('0x12')][_0xadf8('0x14')]);return _0x3f638c(_0x276f97[_0xadf8('0x12')][_0xadf8('0x14')]);}logger[_0xadf8('0x12')](_0xadf8('0xe'),_0x2e9bbf,_0x276f97['error'][_0xadf8('0x14')]);return _0x1babb6(_0x276f97[_0xadf8('0x12')][_0xadf8('0x14')]);}else{logger[_0xadf8('0xd')]('Pause,\x20%s,\x20%s',_0x2e9bbf,_0xadf8('0xf'));_0x1babb6(_0x276f97['result'][_0xadf8('0x14')]);}})['catch'](function(_0xe446e7){logger[_0xadf8('0x12')](_0xadf8('0xe'),_0x2e9bbf,_0xe446e7);_0x3f638c(_0xe446e7);});});}exports[_0xadf8('0x15')]=function(_0xe8fcb7){var _0x49a891=this;return new Promise(function(_0x4671d8,_0x3c09b5){return db[_0xadf8('0x16')][_0xadf8('0x17')]({'raw':_0xe8fcb7['options']?_0xe8fcb7[_0xadf8('0x18')][_0xadf8('0x19')]===undefined?!![]:![]:!![],'where':_0xe8fcb7[_0xadf8('0x18')]?_0xe8fcb7[_0xadf8('0x18')][_0xadf8('0x1a')]||null:null,'attributes':_0xe8fcb7[_0xadf8('0x18')]?_0xe8fcb7['options'][_0xadf8('0x1b')]||null:null,'include':_0xe8fcb7[_0xadf8('0x18')]?_0xe8fcb7['options'][_0xadf8('0x1c')]?_[_0xadf8('0x1d')](_0xe8fcb7[_0xadf8('0x18')][_0xadf8('0x1c')],function(_0x5b915f){return{'model':db[_0x5b915f[_0xadf8('0x1e')]],'as':_0x5b915f['as'],'attributes':_0x5b915f[_0xadf8('0x1b')],'include':_0x5b915f['include']?_[_0xadf8('0x1d')](_0x5b915f[_0xadf8('0x1c')],function(_0x593ed5){return{'model':db[_0x593ed5[_0xadf8('0x1e')]],'as':_0x593ed5['as'],'attributes':_0x593ed5[_0xadf8('0x1b')],'include':_0x593ed5[_0xadf8('0x1c')]?_['map'](_0x593ed5['include'],function(_0x36cf70){return{'model':db[_0x36cf70[_0xadf8('0x1e')]],'as':_0x36cf70['as'],'attributes':_0x36cf70[_0xadf8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xadf8('0xc')](function(_0x5c0168){logger[_0xadf8('0xd')](_0xadf8('0x15'),_0xe8fcb7);logger[_0xadf8('0x10')](_0xadf8('0x15'),_0xe8fcb7,JSON['stringify'](_0x5c0168));_0x4671d8(_0x5c0168);})['catch'](function(_0x778189){logger[_0xadf8('0x12')](_0xadf8('0x15'),_0x778189[_0xadf8('0x14')],_0xe8fcb7);_0x3c09b5(_0x49a891[_0xadf8('0x12')](0x1f4,_0x778189['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5ebfd66..6e16e2f 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 _0x80f8=['put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','file','upload','webhookPost'];(function(_0x70fc3d,_0x2accfb){var _0xec815a=function(_0x1fc9c4){while(--_0x1fc9c4){_0x70fc3d['push'](_0x70fc3d['shift']());}};_0xec815a(++_0x2accfb);}(_0x80f8,0x114));var _0x880f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x80f8[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x880f('0x0'));var path=require('path');var timeout=require(_0x880f('0x1'));var express=require(_0x880f('0x2'));var router=express[_0x880f('0x3')]();var auth=require(_0x880f('0x4'));var interaction=require(_0x880f('0x5'));var config=require(_0x880f('0x6'));var controller=require(_0x880f('0x7'));router[_0x880f('0x8')]('/',auth[_0x880f('0x9')](),controller[_0x880f('0xa')]);router[_0x880f('0x8')](_0x880f('0xb'),controller[_0x880f('0xc')]);router[_0x880f('0x8')](_0x880f('0xd'),auth[_0x880f('0x9')](),controller[_0x880f('0xe')]);router['get'](_0x880f('0xf'),auth['isAuthenticated'](),controller[_0x880f('0x10')]);var upload=multer({'storage':multer[_0x880f('0x11')]({'destination':function(_0x1e348f,_0x53c997,_0x23f460){_0x23f460(null,path[_0x880f('0x12')](config[_0x880f('0x13')],_0x880f('0x14')));},'filename':function(_0x3fbcec,_0x4aaf28,_0x1c56f5){_0x4aaf28[_0x880f('0x15')]=_0x4aaf28[_0x880f('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c56f5(null,util[_0x880f('0x16')](_0x880f('0x17'),path['basename'](_0x4aaf28['originalname'],path[_0x880f('0x18')](_0x4aaf28[_0x880f('0x15')])),Date[_0x880f('0x19')](),path[_0x880f('0x18')](_0x4aaf28['originalname'])));}})});router[_0x880f('0x1a')]('/',upload['single'](_0x880f('0x1b')),controller[_0x880f('0x1c')]);router[_0x880f('0x1a')](_0x880f('0xb'),controller[_0x880f('0x1d')]);router[_0x880f('0x1e')](_0x880f('0xd'),auth['isAuthenticated'](),controller[_0x880f('0x1f')]);router[_0x880f('0x20')](_0x880f('0xd'),auth[_0x880f('0x9')](),controller[_0x880f('0x20')]);module[_0x880f('0x21')]=router; \ No newline at end of file +var _0xa442=['/webhook','webhookGet','show','/:id/download','download','diskStorage','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','file','upload','post','webhookPost','put','/:id','update','multer','path','connect-timeout','express','../../components/interaction/service','./plugin.controller','isAuthenticated','get'];(function(_0x5d8ca6,_0x51bf65){var _0x2c7dca=function(_0x4abe0e){while(--_0x4abe0e){_0x5d8ca6['push'](_0x5d8ca6['shift']());}};_0x2c7dca(++_0x51bf65);}(_0xa442,0x89));var _0x2a44=function(_0x1fbe08,_0x45dfa4){_0x1fbe08=_0x1fbe08-0x0;var _0x425579=_0xa442[_0x1fbe08];return _0x425579;};'use strict';var multer=require(_0x2a44('0x0'));var util=require('util');var path=require(_0x2a44('0x1'));var timeout=require(_0x2a44('0x2'));var express=require(_0x2a44('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2a44('0x4'));var config=require('../../config/environment');var controller=require(_0x2a44('0x5'));router['get']('/',auth[_0x2a44('0x6')](),controller['index']);router[_0x2a44('0x7')](_0x2a44('0x8'),controller[_0x2a44('0x9')]);router[_0x2a44('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2a44('0xa')]);router[_0x2a44('0x7')](_0x2a44('0xb'),auth['isAuthenticated'](),controller[_0x2a44('0xc')]);var upload=multer({'storage':multer[_0x2a44('0xd')]({'destination':function(_0x56cfbc,_0x2c418e,_0x29e999){_0x29e999(null,path['join'](config[_0x2a44('0xe')],_0x2a44('0xf')));},'filename':function(_0x19ca3f,_0x5be60b,_0x2be1c6){_0x5be60b['originalname']=_0x5be60b['originalname'][_0x2a44('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2be1c6(null,util[_0x2a44('0x11')](_0x2a44('0x12'),path[_0x2a44('0x13')](_0x5be60b[_0x2a44('0x14')],path[_0x2a44('0x15')](_0x5be60b['originalname'])),Date['now'](),path['extname'](_0x5be60b[_0x2a44('0x14')])));}})});router['post']('/',upload['single'](_0x2a44('0x16')),controller[_0x2a44('0x17')]);router[_0x2a44('0x18')](_0x2a44('0x8'),controller[_0x2a44('0x19')]);router[_0x2a44('0x1a')](_0x2a44('0x1b'),auth[_0x2a44('0x6')](),controller[_0x2a44('0x1c')]);router['delete'](_0x2a44('0x1b'),auth[_0x2a44('0x6')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a075869..18e194c 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 _0xbe77=['STRING','sequelize','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x21daea,_0x15cecb){var _0x146981=function(_0x239160){while(--_0x239160){_0x21daea['push'](_0x21daea['shift']());}};_0x146981(++_0x15cecb);}(_0xbe77,0x16d));var _0x7be7=function(_0x13a693,_0x128c4e){_0x13a693=_0x13a693-0x0;var _0x36f612=_0xbe77[_0x13a693];return _0x36f612;};'use strict';var Sequelize=require(_0x7be7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7be7('0x1')](_0x7be7('0x2'),_0x7be7('0x3'))},'description':{'type':Sequelize[_0x7be7('0x4')]},'version':{'type':Sequelize[_0x7be7('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x7be7('0x5')},'active':{'type':Sequelize[_0x7be7('0x6')],'defaultValue':0x0,'comment':_0x7be7('0x7')},'sidebar':{'type':Sequelize[_0x7be7('0x1')](_0x7be7('0x8'),_0x7be7('0x9'),_0x7be7('0xa'),_0x7be7('0xb')),'defaultValue':_0x7be7('0xa'),'comment':_0x7be7('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x7be7('0xd')]},'agentUrl':{'type':Sequelize[_0x7be7('0xd')]},'scriptName':{'type':Sequelize[_0x7be7('0xd')]},'scriptPath':{'type':Sequelize[_0x7be7('0xd')]}}; \ No newline at end of file +var _0x094c=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x5304c5,_0x5787bb){var _0x3131fa=function(_0xa283de){while(--_0xa283de){_0x5304c5['push'](_0x5304c5['shift']());}};_0x3131fa(++_0x5787bb);}(_0x094c,0xc5));var _0xc094=function(_0x446789,_0x40aa74){_0x446789=_0x446789-0x0;var _0x534e45=_0x094c[_0x446789];return _0x534e45;};'use strict';var Sequelize=require(_0xc094('0x0'));module[_0xc094('0x1')]={'name':{'type':Sequelize[_0xc094('0x2')]},'type':{'type':Sequelize[_0xc094('0x3')](_0xc094('0x4'),_0xc094('0x5'))},'description':{'type':Sequelize[_0xc094('0x6')]},'version':{'type':Sequelize[_0xc094('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0xc094('0x7')},'active':{'type':Sequelize[_0xc094('0x8')],'defaultValue':0x0,'comment':_0xc094('0x9')},'sidebar':{'type':Sequelize[_0xc094('0x3')](_0xc094('0xa'),_0xc094('0xb'),_0xc094('0xc'),'never'),'defaultValue':_0xc094('0xc'),'comment':_0xc094('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xc094('0x2')]},'agentUrl':{'type':Sequelize[_0xc094('0x2')]},'scriptName':{'type':Sequelize[_0xc094('0x2')]},'scriptPath':{'type':Sequelize[_0xc094('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b1bdbd3..b7740d2 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 _0x7517=['agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','userProfileId','role','UserProfileSection','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','http://localhost:','content-length','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','map','query','keys','filters','model','fields','length','attributes','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','ENOENT','Error','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing'];(function(_0xdefac,_0x5342f2){var _0x4801ed=function(_0x364594){while(--_0x364594){_0xdefac['push'](_0xdefac['shift']());}};_0x4801ed(++_0x5342f2);}(_0x7517,0xd1));var _0x7751=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7517[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0x7751('0x0'));var emlformat=require(_0x7751('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7751('0x2'));var jsonpatch=require(_0x7751('0x3'));var rp=require('request-promise');var moment=require(_0x7751('0x4'));var BPromise=require(_0x7751('0x5'));var Mustache=require(_0x7751('0x6'));var util=require(_0x7751('0x7'));var path=require(_0x7751('0x8'));var sox=require(_0x7751('0x9'));var csv=require(_0x7751('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7751('0xb'));var squel=require('squel');var crypto=require(_0x7751('0xc'));var jsforce=require(_0x7751('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7751('0xa'));var querystring=require(_0x7751('0xe'));var Papa=require(_0x7751('0xf'));var extract=require(_0x7751('0x10'));var rimraf=require(_0x7751('0x11'));var archiver=require(_0x7751('0x12'));var Redis=require(_0x7751('0x13'));var authService=require(_0x7751('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7751('0x15'));var hardwareService=require(_0x7751('0x16'));var logger=require(_0x7751('0x17'))(_0x7751('0x18'));var utils=require('../../config/utils');var config=require(_0x7751('0x19'));var licenseUtil=require(_0x7751('0x1a'));var db=require('../../mysqldb')['db'];config[_0x7751('0x1b')]=_[_0x7751('0x1c')](config[_0x7751('0x1b')],{'host':_0x7751('0x1d'),'port':0x18eb});var socket=require(_0x7751('0x1e'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x275585,_0x36aef2){_0x36aef2=_0x36aef2||0xcc;return function(_0x2f9420){if(_0x2f9420){return _0x275585[_0x7751('0x1f')](_0x36aef2);}return _0x275585[_0x7751('0x20')](_0x36aef2)[_0x7751('0x21')]();};}function respondWithResult(_0x315493,_0x3914e4){_0x3914e4=_0x3914e4||0xc8;return function(_0x5c0fb5){if(_0x5c0fb5){return _0x315493[_0x7751('0x20')](_0x3914e4)[_0x7751('0x22')](_0x5c0fb5);}};}function respondWithFilteredResult(_0x163a84,_0xc4da04){return function(_0x120c82){if(_0x120c82){var _0x3eb9f3=_0x120c82[_0x7751('0x23')],_0x4d7716=_0xc4da04[_0x7751('0x24')],_0x4e9b77=_0xc4da04[_0x7751('0x24')]+_0xc4da04[_0x7751('0x25')],_0x3d5f4d;if(_0x4e9b77>=_0x3eb9f3){_0x4e9b77=_0x3eb9f3;_0x3d5f4d=0xc8;}else{_0x3d5f4d=0xce;}_0x163a84['status'](_0x3d5f4d);return _0x163a84[_0x7751('0x26')](_0x7751('0x27'),_0x4d7716+'-'+_0x4e9b77+'/'+_0x3eb9f3)[_0x7751('0x22')](_0x120c82);}return null;};}function patchUpdates(_0x55141e){return function(_0x3ccb20){try{jsonpatch[_0x7751('0x28')](_0x3ccb20,_0x55141e,!![]);}catch(_0x37d899){return BPromise[_0x7751('0x29')](_0x37d899);}return _0x3ccb20['save']();};}function saveUpdates(_0xe85125,_0x45cf2c){return function(_0x3f5f96){if(_0x3f5f96){return _0x3f5f96[_0x7751('0x2a')](_0xe85125)[_0x7751('0x2b')](function(_0x6616eb){return _0x6616eb;});}return null;};}function removeEntity(_0x5df3d2,_0x395800){return function(_0x8b9a20){if(_0x8b9a20){return _0x8b9a20[_0x7751('0x2c')]()[_0x7751('0x2b')](function(){var _0x21c366=_0x8b9a20[_0x7751('0x2d')]({'plain':!![]});var _0x582907='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x582907,'resourceId':_0x21c366['id']}})['then'](function(){return _0x8b9a20;});})[_0x7751('0x2b')](function(){_0x5df3d2[_0x7751('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x539426,_0x29719a){return function(_0x31cbb1){if(!_0x31cbb1){_0x539426['sendStatus'](0x194);}return _0x31cbb1;};}function handleError(_0x567d51,_0x3c48c9){_0x3c48c9=_0x3c48c9||0x1f4;return function(_0x40cb26){logger[_0x7751('0x2e')](_0x40cb26[_0x7751('0x2f')]);if(_0x40cb26[_0x7751('0x30')]){delete _0x40cb26[_0x7751('0x30')];}_0x567d51[_0x7751('0x20')](_0x3c48c9)[_0x7751('0x31')](_0x40cb26);};}exports[_0x7751('0x32')]=function(_0x5ade6d,_0x1b2b0e){var _0x134fd2={},_0x1b261c={},_0x3dd7ab={'count':0x0,'rows':[]};var _0x49cc75=_['map'](db[_0x7751('0x33')][_0x7751('0x34')],function(_0x1eb588){return{'name':_0x1eb588[_0x7751('0x35')],'type':_0x1eb588[_0x7751('0x36')][_0x7751('0x37')]};});_0x1b261c['model']=_[_0x7751('0x38')](_0x49cc75,_0x7751('0x30'));_0x1b261c[_0x7751('0x39')]=_[_0x7751('0x3a')](_0x5ade6d[_0x7751('0x39')]);_0x1b261c[_0x7751('0x3b')]=_['intersection'](_0x1b261c['model'],_0x1b261c['query']);_0x134fd2['attributes']=_['intersection'](_0x1b261c[_0x7751('0x3c')],qs['fields'](_0x5ade6d[_0x7751('0x39')][_0x7751('0x3d')]));_0x134fd2['attributes']=_0x134fd2['attributes'][_0x7751('0x3e')]?_0x134fd2[_0x7751('0x3f')]:_0x1b261c[_0x7751('0x3c')];if(!_0x5ade6d['query']['hasOwnProperty']('nolimit')){_0x134fd2[_0x7751('0x25')]=qs[_0x7751('0x25')](_0x5ade6d[_0x7751('0x39')][_0x7751('0x25')]);_0x134fd2[_0x7751('0x24')]=qs[_0x7751('0x24')](_0x5ade6d[_0x7751('0x39')]['offset']);}_0x134fd2[_0x7751('0x40')]=qs[_0x7751('0x41')](_0x5ade6d['query']['sort']);_0x134fd2[_0x7751('0x42')]=qs['filters'](_[_0x7751('0x43')](_0x5ade6d['query'],_0x1b261c[_0x7751('0x3b')]),_0x49cc75);if(_0x5ade6d['query']['filter']){_0x134fd2[_0x7751('0x42')]=_[_0x7751('0x44')](_0x134fd2[_0x7751('0x42')],{'$or':_['map'](_0x49cc75,function(_0x30ab05){if(_0x30ab05[_0x7751('0x36')]!==_0x7751('0x45')){var _0x159325={};_0x159325[_0x30ab05[_0x7751('0x30')]]={'$like':'%'+_0x5ade6d['query'][_0x7751('0x46')]+'%'};return _0x159325;}})});}_0x134fd2=_[_0x7751('0x44')]({},_0x134fd2,_0x5ade6d[_0x7751('0x47')]);var _0x371b51={'where':_0x134fd2[_0x7751('0x42')]};return db[_0x7751('0x33')][_0x7751('0x23')](_0x371b51)[_0x7751('0x2b')](function(_0x1097ec){_0x3dd7ab['count']=_0x1097ec;if(_0x5ade6d[_0x7751('0x39')][_0x7751('0x48')]){_0x134fd2[_0x7751('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x7751('0x4a')](_0x134fd2);})[_0x7751('0x2b')](function(_0x583892){_0x3dd7ab[_0x7751('0x4b')]=_0x583892;return _0x3dd7ab;})['then'](respondWithFilteredResult(_0x1b2b0e,_0x134fd2))[_0x7751('0x4c')](handleError(_0x1b2b0e,null));};exports[_0x7751('0x4d')]=function(_0x3ab5a2,_0x5a8ba8){var _0x4aa08d={'raw':!![],'where':{'id':_0x3ab5a2[_0x7751('0x4e')]['id']}},_0x1dbe3d={};_0x1dbe3d[_0x7751('0x3c')]=_[_0x7751('0x3a')](db[_0x7751('0x33')]['rawAttributes']);_0x1dbe3d[_0x7751('0x39')]=_[_0x7751('0x3a')](_0x3ab5a2[_0x7751('0x39')]);_0x1dbe3d['filters']=_[_0x7751('0x4f')](_0x1dbe3d[_0x7751('0x3c')],_0x1dbe3d[_0x7751('0x39')]);_0x4aa08d[_0x7751('0x3f')]=_[_0x7751('0x4f')](_0x1dbe3d['model'],qs[_0x7751('0x3d')](_0x3ab5a2[_0x7751('0x39')][_0x7751('0x3d')]));_0x4aa08d[_0x7751('0x3f')]=_0x4aa08d['attributes'][_0x7751('0x3e')]?_0x4aa08d[_0x7751('0x3f')]:_0x1dbe3d[_0x7751('0x3c')];if(_0x3ab5a2[_0x7751('0x39')]['includeAll']){_0x4aa08d[_0x7751('0x49')]=[{'all':!![]}];}_0x4aa08d=_['merge']({},_0x4aa08d,_0x3ab5a2['options']);return db[_0x7751('0x33')][_0x7751('0x50')](_0x4aa08d)[_0x7751('0x2b')](handleEntityNotFound(_0x5a8ba8,null))['then'](respondWithResult(_0x5a8ba8,null))[_0x7751('0x4c')](handleError(_0x5a8ba8,null));};exports[_0x7751('0x51')]=function(_0x22be1f,_0x5b469a,_0xcfc0cb){return db[_0x7751('0x33')][_0x7751('0x50')]({'where':{'id':_0x22be1f[_0x7751('0x4e')]['id']},'attributes':['name','path'],'raw':!![]})[_0x7751('0x2b')](handleEntityNotFound(_0x5b469a,null))['then'](function(_0x112267){if(_0x112267){var _0x475962=path['join'](config[_0x7751('0x52')],_0x7751('0x53'),util[_0x7751('0x54')](_0x7751('0x55'),path[_0x7751('0x56')](_0x112267[_0x7751('0x8')])));var _0x1b6baa=fs[_0x7751('0x57')](_0x475962);var _0x57be49=archiver(_0x7751('0x58'),{'zlib':{'level':0x9}});_0x57be49['on']('warning',function(_0x5afe72){if(_0x5afe72['code']===_0x7751('0x59')){logger[_0x7751('0x2e')](_0x5afe72);}else{throw new db['Sequelize'][(_0x7751('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x57be49['on'](_0x7751('0x2e'),function(_0x586afb){throw new db['Sequelize'][(_0x7751('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x57be49[_0x7751('0x5b')](_0x1b6baa);_0x57be49[_0x7751('0x5c')](_0x7751('0x5d'),{'cwd':path[_0x7751('0x5e')](config[_0x7751('0x52')],_0x7751('0x53'),path[_0x7751('0x5f')](_0x112267[_0x7751('0x8')])),'ignore':[path[_0x7751('0x5e')](path[_0x7751('0x56')](_0x112267[_0x7751('0x8')]),_0x7751('0x60')),path[_0x7751('0x5e')](path[_0x7751('0x56')](_0x112267[_0x7751('0x8')]),_0x7751('0x61'))],'nodir':!![]})[_0x7751('0x62')]();_0x1b6baa['on']('close',function(){if(!fs['existsSync'](_0x475962)){throw new db['Sequelize'][(_0x7751('0x5a'))]('Plugin\x20not\x20found');}return _0x5b469a[_0x7751('0x51')](_0x475962,util[_0x7751('0x54')]('%s.zip',path[_0x7751('0x56')](_0x112267[_0x7751('0x8')])),function(_0x5d368b){if(_0x5d368b){throw new db[(_0x7751('0x63'))][(_0x7751('0x5a'))](_0x7751('0x64'));}fs[_0x7751('0x65')](_0x475962);logger[_0x7751('0x66')](_0x7751('0x67'));logger[_0x7751('0x66')](_0x7751('0x68'));});});}return null;})['catch'](handleError(_0x5b469a,null));};exports['upload']=function(_0x5279fc,_0x31b92b,_0x5d4ce6){var _0x3479f6=path[_0x7751('0x56')](_0x5279fc['file']['filename'],path[_0x7751('0x69')](_0x5279fc['file']['filename']));var _0x2115a4=path[_0x7751('0x5e')](config[_0x7751('0x52')],'server/files/plugins',_0x5279fc[_0x7751('0x6a')][_0x7751('0x6b')]);var _0x50d4ea=path[_0x7751('0x5e')](config['root'],'server/files/plugins',_0x3479f6);logger[_0x7751('0x66')](_0x7751('0x6c'),_0x2115a4);logger[_0x7751('0x66')](_0x7751('0x6d'),_0x50d4ea);try{fs[_0x7751('0x6e')](_0x2115a4,parseInt('0777',0x8));extract(_0x2115a4,{'dir':_0x50d4ea},function(_0x1d571e){if(_0x1d571e){logger['error'](_0x1d571e);handleError(_0x1d571e,!![]);};var _0x38e1ee=fs['readdirSync'](_0x50d4ea);if(_0x38e1ee[_0x7751('0x3e')]>0x1){removeReferences(_0x2115a4,_0x50d4ea);logger['error']('Invalid\x20plugin\x20structure');return _0x5d4ce6(new Error(_0x7751('0x6f')));}var _0x51f12c=fs[_0x7751('0x70')](path[_0x7751('0x5e')](_0x50d4ea,_0x38e1ee[0x0]));if(_0x51f12c[_0x7751('0x71')]()){removeReferences(_0x2115a4,_0x50d4ea);logger[_0x7751('0x2e')](_0x7751('0x6f'));return _0x5d4ce6(new Error(_0x7751('0x6f')));}if(_0x51f12c[_0x7751('0x72')]()){var _0x2cc5e1=fs[_0x7751('0x73')](path[_0x7751('0x5e')](_0x50d4ea,_0x38e1ee[0x0]));if(_0x2cc5e1[_0x7751('0x3e')]===0x0){removeReferences(_0x2115a4,_0x50d4ea);logger[_0x7751('0x2e')](_0x7751('0x6f'));return _0x5d4ce6(new Error(_0x7751('0x6f')));}var _0x359a00=_0x2cc5e1[_0x7751('0x74')](function(_0x16b4b3){return _0x16b4b3===_0x7751('0x75');});if(!_0x359a00){return _0x5d4ce6(new Error('Plugin\x20manifest\x20missing'));}var _0x5155f8=fs['readFileSync'](path[_0x7751('0x5e')](_0x50d4ea,_0x38e1ee[0x0],_0x7751('0x75')));var _0x443154=JSON[_0x7751('0x76')](_0x5155f8);if('undefined'==typeof _0x443154[_0x7751('0x30')]){return _0x5d4ce6(new Error(_0x7751('0x77')));}if(_0x7751('0x78')==typeof _0x443154[_0x7751('0x36')]){return _0x5d4ce6(new Error(_0x7751('0x79')));}if(_0x7751('0x78')==typeof _0x443154[_0x7751('0x7a')]){return _0x5d4ce6(new Error(_0x7751('0x7b')));}if('undefined'==typeof _0x443154[_0x7751('0x7c')]){return _0x5d4ce6(new Error(_0x7751('0x7d')));}if(_0x443154['type']===_0x7751('0x7e')){if(_0x7751('0x78')==typeof _0x443154[_0x7751('0x7c')][_0x7751('0x7f')]){return _0x5d4ce6(new Error(_0x7751('0x80')));}if(_0x7751('0x78')==typeof _0x443154[_0x7751('0x7c')][_0x7751('0x7f')]['admin']&&'undefined'==typeof _0x443154[_0x7751('0x7c')]['views'][_0x7751('0x81')]){return _0x5d4ce6(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x443154[_0x7751('0x36')]==='script'){if(_0x7751('0x78')==typeof _0x443154[_0x7751('0x7c')][_0x7751('0x82')]){return _0x5d4ce6(new Error(_0x7751('0x83')));}if('undefined'==typeof _0x443154[_0x7751('0x7c')][_0x7751('0x84')]){return _0x5d4ce6(new Error(_0x7751('0x85')));}}else{return _0x5d4ce6(new Error(_0x7751('0x86')));}var _0x1d5a56=_0x443154[_0x7751('0x30')];var _0x90bbcc=_0x443154[_0x7751('0x87')];var _0x421304=_0x443154[_0x7751('0x36')];var _0x26c9b0=_0x443154[_0x7751('0x88')]?_0x443154[_0x7751('0x88')]:'always';var _0x474ee4=_0x443154['icon']?_0x443154[_0x7751('0x89')]:_0x7751('0x8a');var _0x43311f='';var _0x1c9cf5='';var _0x2233dc='';var _0xfb9844='';var _0x194209=_0x443154[_0x7751('0x7a')];if(_0x421304==='html'){if(_0x7751('0x78')!=typeof _0x443154[_0x7751('0x7c')][_0x7751('0x7f')][_0x7751('0x8b')]){var _0x17f403=_0x443154['parameters'][_0x7751('0x7f')][_0x7751('0x8b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x17f403)){_0x43311f=path[_0x7751('0x5e')](_0x7751('0x8c'),_0x3479f6,_0x38e1ee[0x0],_0x17f403);}else{_0x43311f=_0x17f403;}}else{logger['info'](_0x7751('0x8d'));}if(_0x7751('0x78')!=typeof _0x443154[_0x7751('0x7c')][_0x7751('0x7f')]['agent']){var _0x1e57c3=_0x443154[_0x7751('0x7c')][_0x7751('0x7f')][_0x7751('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x7751('0x8e')](_0x1e57c3)){_0x1c9cf5=path[_0x7751('0x5e')]('plugins',_0x3479f6,_0x38e1ee[0x0],_0x1e57c3);}else{_0x1c9cf5=_0x1e57c3;}}else{logger['info'](_0x7751('0x8f'));}}else if(_0x421304===_0x7751('0x90')){_0x2233dc=_0x443154[_0x7751('0x7c')][_0x7751('0x82')];_0xfb9844=_0x443154[_0x7751('0x7c')][_0x7751('0x84')];if('undefined'!=typeof _0x443154[_0x7751('0x7c')][_0x7751('0x7f')]){if('undefined'!=typeof _0x443154['parameters'][_0x7751('0x7f')][_0x7751('0x8b')]){var _0x17f403=_0x443154[_0x7751('0x7c')][_0x7751('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x17f403)){_0x43311f=path[_0x7751('0x5e')](_0x7751('0x8c'),_0x3479f6,_0x38e1ee[0x0],_0x17f403);}else{_0x43311f=_0x17f403;}}if(_0x7751('0x78')!=typeof _0x443154[_0x7751('0x7c')][_0x7751('0x7f')][_0x7751('0x81')]){var _0x1e57c3=_0x443154[_0x7751('0x7c')][_0x7751('0x7f')][_0x7751('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x7751('0x8e')](_0x1e57c3)){_0x1c9cf5=path[_0x7751('0x5e')](_0x7751('0x8c'),_0x3479f6,_0x38e1ee[0x0],_0x1e57c3);}else{_0x1c9cf5=_0x1e57c3;}}}}var _0x2279fa={'name':_0x1d5a56,'description':_0x90bbcc,'path':path[_0x7751('0x5e')](_0x3479f6,_0x38e1ee[0x0]),'type':_0x421304,'sidebar':_0x26c9b0,'icon':_0x474ee4,'adminUrl':_0x43311f,'agentUrl':_0x1c9cf5,'scriptName':_0x2233dc,'scriptPath':_0xfb9844,'version':_0x194209};removeReferences(_0x2115a4,null);return db[_0x7751('0x33')][_0x7751('0x91')](_0x2279fa)['then'](function(_0x1bb377){var _0x574a79={'role':_0x5279fc['body']['role'],'userProfileId':_0x5279fc[_0x7751('0x92')][_0x7751('0x93')]};if(!_0x574a79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x574a79[_0x7751('0x94')]==='user'){var _0x160ab9=_0x1bb377[_0x7751('0x2d')]({'plain':!![]});return db[_0x7751('0x95')][_0x7751('0x50')]({'where':{'name':_0x7751('0x96'),'userProfileId':_0x574a79[_0x7751('0x93')]},'raw':!![]})[_0x7751('0x2b')](function(_0x561d4d){if(_0x561d4d&&_0x561d4d[_0x7751('0x97')]===0x0){return db['UserProfileResource']['create']({'name':_0x160ab9[_0x7751('0x30')],'resourceId':_0x160ab9['id'],'type':_0x561d4d[_0x7751('0x30')],'sectionId':_0x561d4d['id']},{})['then'](function(){return _0x1bb377;});}else{return _0x1bb377;}})[_0x7751('0x4c')](function(_0x1000c7){logger[_0x7751('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1000c7);throw _0x1000c7;});}return _0x1bb377;})[_0x7751('0x2b')](respondWithResult(_0x31b92b,null))[_0x7751('0x4c')](handleError(_0x31b92b,null));}});}catch(_0xe2be21){_0x31b92b[_0x7751('0x20')](0x1f4)[_0x7751('0x31')](_0xe2be21);}};function removeReferences(_0x51bd0c,_0x5684b8){try{if(_0x51bd0c){fs['unlinkSync'](_0x51bd0c);logger[_0x7751('0x66')](_0x7751('0x98'));}if(_0x5684b8){rimraf(_0x5684b8,function(){});logger['info'](_0x7751('0x99'));}}catch(_0x1a1bc9){logger['error'](_0x1a1bc9);}}exports[_0x7751('0x2a')]=function(_0x30155e,_0x256f05,_0x2ca14c){return db['Plugin'][_0x7751('0x50')]({'where':{'id':_0x30155e[_0x7751('0x4e')]['id']}})['then'](handleEntityNotFound(_0x256f05,null))[_0x7751('0x2b')](saveUpdates(_0x30155e[_0x7751('0x92')],null))[_0x7751('0x2b')](respondWithResult(_0x256f05,null))[_0x7751('0x4c')](handleError(_0x256f05,null));};exports[_0x7751('0x9a')]=function(_0x480347,_0x3157ff,_0x2ef2a4){return db['Plugin'][_0x7751('0x50')]({'where':{'id':_0x480347[_0x7751('0x4e')]['id']}})[_0x7751('0x2b')](function(_0x1d84f8){if(_0x1d84f8){return _0x1d84f8[_0x7751('0x2c')]();}})['then'](function(_0x4ee8b1){rimraf(path[_0x7751('0x5e')](config[_0x7751('0x52')],_0x7751('0x53'),path[_0x7751('0x5f')](_0x4ee8b1[_0x7751('0x8')])),function(){});return _0x4ee8b1;})[_0x7751('0x2b')](handleEntityNotFound(_0x3157ff,null))[_0x7751('0x2b')](respondWithStatusCode(_0x3157ff,null))['catch'](handleError(_0x3157ff,null));};exports['webhookGet']=function(_0x3008e9,_0x496a68,_0x3d416a){return BPromise[_0x7751('0x9b')]()['then'](function(){if(!_0x3008e9[_0x7751('0x39')][_0x7751('0x8')]){throw new Error(_0x7751('0x9c'));}if(!_0x3008e9[_0x7751('0x39')][_0x7751('0x9d')]){throw new Error(_0x7751('0x9e'));}var _0x4a5eb8=_0x3008e9['query']['hostname']?_0x3008e9[_0x7751('0x39')]['hostname']+':'+_0x3008e9[_0x7751('0x39')][_0x7751('0x9d')]:'http://localhost:'+_0x3008e9[_0x7751('0x39')][_0x7751('0x9d')];var _0x42bd97=_0x3008e9[_0x7751('0x39')][_0x7751('0x22')]?_0x3008e9[_0x7751('0x39')][_0x7751('0x22')]:!![];var _0x5bab08=_0x3008e9[_0x7751('0x39')][_0x7751('0x9f')]?_0x3008e9[_0x7751('0x39')]['encoding']:null;var _0x2ddf40={'method':_0x3008e9[_0x7751('0xa0')],'uri':util[_0x7751('0x54')](_0x7751('0xa1'),_0x4a5eb8,_0x3008e9[_0x7751('0x39')][_0x7751('0x8')]),'json':_0x42bd97,'resolveWithFullResponse':!![],'encoding':_0x5bab08,'qs':_0x3008e9[_0x7751('0x39')]};if(_0x3008e9[_0x7751('0xa2')]){_0x2ddf40[_0x7751('0xa2')]=_0x3008e9['headers'];if(_0x2ddf40['headers']['content-length']){delete _0x2ddf40['headers']['content-length'];}}if(_0x2ddf40['headers']['content-type']){delete _0x2ddf40[_0x7751('0xa2')][_0x7751('0xa3')];}return rp(_0x2ddf40);})['then'](function(_0x7ca078){if(_0x7ca078){_0x496a68[_0x7751('0x26')](_0x7ca078['headers']);logger[_0x7751('0x66')](_0x7ca078['body']);if(_[_0x7751('0xa4')](_0x3008e9[_0x7751('0x39')]['path'],_0x7751('0x51'))&&_0x7ca078[_0x7751('0xa5')]==0x1f4){return _0x496a68[_0x7751('0x1f')](_0x7ca078['statusCode']);}else{return _0x496a68[_0x7751('0x20')](_0x7ca078[_0x7751('0xa5')])['send'](_0x7ca078['body']);}}else{return _0x496a68[_0x7751('0x1f')](0xc8);}})[_0x7751('0x4c')](handleError(_0x496a68,null));};exports[_0x7751('0xa6')]=function(_0x25c5c6,_0x5455ec,_0x33cfb3){return BPromise[_0x7751('0x9b')]()[_0x7751('0x2b')](function(){if(!_0x25c5c6[_0x7751('0x39')]['path']){throw new Error(_0x7751('0x9c'));}if(!_0x25c5c6['query'][_0x7751('0x9d')]){throw new Error(_0x7751('0x9e'));}var _0x2a046f=_0x25c5c6[_0x7751('0x39')]['hostname']?_0x25c5c6[_0x7751('0x39')]['hostname']+':'+_0x25c5c6[_0x7751('0x39')][_0x7751('0x9d')]:_0x7751('0xa7')+_0x25c5c6[_0x7751('0x39')][_0x7751('0x9d')];var _0x1fff30=_0x25c5c6[_0x7751('0x39')][_0x7751('0x22')]?_0x25c5c6[_0x7751('0x39')][_0x7751('0x22')]:!![];var _0x5b08da=_0x25c5c6[_0x7751('0x39')][_0x7751('0x9f')]?_0x25c5c6[_0x7751('0x39')][_0x7751('0x9f')]:null;var _0x3c7686={'method':_0x25c5c6[_0x7751('0xa0')],'uri':util[_0x7751('0x54')](_0x7751('0xa1'),_0x2a046f,_0x25c5c6[_0x7751('0x39')]['path']),'json':_0x1fff30,'resolveWithFullResponse':!![],'encoding':_0x5b08da,'body':_0x25c5c6[_0x7751('0x92')]};if(_0x25c5c6[_0x7751('0xa2')]){_0x3c7686['headers']=_0x25c5c6[_0x7751('0xa2')];if(_0x3c7686[_0x7751('0xa2')][_0x7751('0xa8')]){delete _0x3c7686[_0x7751('0xa2')][_0x7751('0xa8')];}}if(_0x3c7686[_0x7751('0xa2')][_0x7751('0xa3')]){delete _0x3c7686[_0x7751('0xa2')][_0x7751('0xa3')];}return rp(_0x3c7686);})[_0x7751('0x2b')](function(_0x2ef14a){if(_0x2ef14a){_0x5455ec[_0x7751('0x26')](_0x2ef14a[_0x7751('0xa2')]);logger['info'](_0x2ef14a[_0x7751('0x92')]);return _0x5455ec[_0x7751('0x20')](_0x2ef14a[_0x7751('0xa5')])[_0x7751('0x31')](_0x2ef14a[_0x7751('0x92')]);}else{return _0x5455ec[_0x7751('0x1f')](0xc8);}})[_0x7751('0x4c')](handleError(_0x5455ec,null));}; \ No newline at end of file +var _0x0bf9=['\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','extract-zip','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','keys','Plugin','rawAttributes','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','basename','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','version','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','dirname','resolve'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0bf9,0x1f3));var _0x90bf=function(_0x3b9bf4,_0xb9dc3c){_0x3b9bf4=_0x3b9bf4-0x0;var _0x3ddc9a=_0x0bf9[_0x3b9bf4];return _0x3ddc9a;};'use strict';var pdf=require(_0x90bf('0x0'));var emlformat=require(_0x90bf('0x1'));var rimraf=require(_0x90bf('0x2'));var zipdir=require(_0x90bf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x90bf('0x4'));var BPromise=require(_0x90bf('0x5'));var Mustache=require('mustache');var util=require(_0x90bf('0x6'));var path=require(_0x90bf('0x7'));var sox=require(_0x90bf('0x8'));var csv=require(_0x90bf('0x9'));var ejs=require(_0x90bf('0xa'));var fs=require('fs');var _=require(_0x90bf('0xb'));var squel=require(_0x90bf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x90bf('0x9'));var querystring=require(_0x90bf('0xd'));var Papa=require(_0x90bf('0xe'));var extract=require(_0x90bf('0xf'));var rimraf=require(_0x90bf('0x2'));var archiver=require('archiver');var Redis=require(_0x90bf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x90bf('0x11'));var as=require(_0x90bf('0x12'));var hardwareService=require(_0x90bf('0x13'));var logger=require(_0x90bf('0x14'))(_0x90bf('0x15'));var utils=require(_0x90bf('0x16'));var config=require(_0x90bf('0x17'));var licenseUtil=require(_0x90bf('0x18'));var db=require(_0x90bf('0x19'))['db'];config[_0x90bf('0x1a')]=_[_0x90bf('0x1b')](config[_0x90bf('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x90bf('0x1c'))(new Redis(config['redis']));require(_0x90bf('0x1d'))[_0x90bf('0x1e')](socket);function respondWithStatusCode(_0x41dbf6,_0x494362){_0x494362=_0x494362||0xcc;return function(_0x1edcf4){if(_0x1edcf4){return _0x41dbf6[_0x90bf('0x1f')](_0x494362);}return _0x41dbf6[_0x90bf('0x20')](_0x494362)[_0x90bf('0x21')]();};}function respondWithResult(_0x27db78,_0x5eee20){_0x5eee20=_0x5eee20||0xc8;return function(_0x4a8876){if(_0x4a8876){return _0x27db78[_0x90bf('0x20')](_0x5eee20)['json'](_0x4a8876);}};}function respondWithFilteredResult(_0x1da2f8,_0x271c0d){return function(_0x3ef86a){if(_0x3ef86a){var _0x21f117=_0x3ef86a[_0x90bf('0x22')],_0x4b4d42=_0x271c0d[_0x90bf('0x23')],_0x56efde=_0x271c0d['offset']+_0x271c0d[_0x90bf('0x24')],_0x3d6cf4;if(_0x56efde>=_0x21f117){_0x56efde=_0x21f117;_0x3d6cf4=0xc8;}else{_0x3d6cf4=0xce;}_0x1da2f8[_0x90bf('0x20')](_0x3d6cf4);return _0x1da2f8[_0x90bf('0x25')](_0x90bf('0x26'),_0x4b4d42+'-'+_0x56efde+'/'+_0x21f117)['json'](_0x3ef86a);}return null;};}function patchUpdates(_0x1fb510){return function(_0x4bdddd){try{jsonpatch['apply'](_0x4bdddd,_0x1fb510,!![]);}catch(_0x396607){return BPromise['reject'](_0x396607);}return _0x4bdddd['save']();};}function saveUpdates(_0x1a9dec,_0x2faaff){return function(_0x3a7bbc){if(_0x3a7bbc){return _0x3a7bbc[_0x90bf('0x27')](_0x1a9dec)[_0x90bf('0x28')](function(_0x4754a7){return _0x4754a7;});}return null;};}function removeEntity(_0x591c38,_0x370f64){return function(_0xd22852){if(_0xd22852){return _0xd22852[_0x90bf('0x29')]()[_0x90bf('0x28')](function(){var _0x4f4f8b=_0xd22852['get']({'plain':!![]});var _0x4868df='Plugins';return db[_0x90bf('0x2a')][_0x90bf('0x29')]({'where':{'type':_0x4868df,'resourceId':_0x4f4f8b['id']}})[_0x90bf('0x28')](function(){return _0xd22852;});})['then'](function(){_0x591c38[_0x90bf('0x20')](0xcc)[_0x90bf('0x21')]();});}};}function handleEntityNotFound(_0xf18c99,_0x468468){return function(_0x346f5f){if(!_0x346f5f){_0xf18c99[_0x90bf('0x1f')](0x194);}return _0x346f5f;};}function handleError(_0x1b2feb,_0x163e98){_0x163e98=_0x163e98||0x1f4;return function(_0x3ca0bd){logger[_0x90bf('0x2b')](_0x3ca0bd[_0x90bf('0x2c')]);if(_0x3ca0bd[_0x90bf('0x2d')]){delete _0x3ca0bd[_0x90bf('0x2d')];}_0x1b2feb[_0x90bf('0x20')](_0x163e98)[_0x90bf('0x2e')](_0x3ca0bd);};}exports[_0x90bf('0x2f')]=function(_0x306a81,_0x4c0440){var _0x46511d={},_0x2ac390={},_0x4fc8e0={'count':0x0,'rows':[]};var _0x50c3f1=_[_0x90bf('0x30')](db['Plugin']['rawAttributes'],function(_0x4adfc5){return{'name':_0x4adfc5[_0x90bf('0x31')],'type':_0x4adfc5[_0x90bf('0x32')][_0x90bf('0x33')]};});_0x2ac390[_0x90bf('0x34')]=_[_0x90bf('0x30')](_0x50c3f1,_0x90bf('0x2d'));_0x2ac390[_0x90bf('0x35')]=_['keys'](_0x306a81[_0x90bf('0x35')]);_0x2ac390[_0x90bf('0x36')]=_[_0x90bf('0x37')](_0x2ac390[_0x90bf('0x34')],_0x2ac390[_0x90bf('0x35')]);_0x46511d[_0x90bf('0x38')]=_[_0x90bf('0x37')](_0x2ac390[_0x90bf('0x34')],qs[_0x90bf('0x39')](_0x306a81[_0x90bf('0x35')][_0x90bf('0x39')]));_0x46511d[_0x90bf('0x38')]=_0x46511d['attributes'][_0x90bf('0x3a')]?_0x46511d['attributes']:_0x2ac390[_0x90bf('0x34')];if(!_0x306a81[_0x90bf('0x35')][_0x90bf('0x3b')](_0x90bf('0x3c'))){_0x46511d[_0x90bf('0x24')]=qs[_0x90bf('0x24')](_0x306a81['query'][_0x90bf('0x24')]);_0x46511d['offset']=qs[_0x90bf('0x23')](_0x306a81['query']['offset']);}_0x46511d[_0x90bf('0x3d')]=qs[_0x90bf('0x3e')](_0x306a81[_0x90bf('0x35')][_0x90bf('0x3e')]);_0x46511d[_0x90bf('0x3f')]=qs[_0x90bf('0x36')](_['pick'](_0x306a81['query'],_0x2ac390[_0x90bf('0x36')]),_0x50c3f1);if(_0x306a81['query'][_0x90bf('0x40')]){_0x46511d[_0x90bf('0x3f')]=_[_0x90bf('0x41')](_0x46511d[_0x90bf('0x3f')],{'$or':_[_0x90bf('0x30')](_0x50c3f1,function(_0x42de6d){if(_0x42de6d['type']!=='VIRTUAL'){var _0x4528cd={};_0x4528cd[_0x42de6d['name']]={'$like':'%'+_0x306a81[_0x90bf('0x35')][_0x90bf('0x40')]+'%'};return _0x4528cd;}})});}_0x46511d=_['merge']({},_0x46511d,_0x306a81['options']);var _0x1fe634={'where':_0x46511d[_0x90bf('0x3f')]};return db['Plugin']['count'](_0x1fe634)[_0x90bf('0x28')](function(_0x519b8c){_0x4fc8e0['count']=_0x519b8c;if(_0x306a81[_0x90bf('0x35')][_0x90bf('0x42')]){_0x46511d[_0x90bf('0x43')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x46511d);})['then'](function(_0x394c7e){_0x4fc8e0[_0x90bf('0x44')]=_0x394c7e;return _0x4fc8e0;})[_0x90bf('0x28')](respondWithFilteredResult(_0x4c0440,_0x46511d))[_0x90bf('0x45')](handleError(_0x4c0440,null));};exports[_0x90bf('0x46')]=function(_0x442827,_0x425b4d){var _0x20775f={'raw':!![],'where':{'id':_0x442827[_0x90bf('0x47')]['id']}},_0x5688cc={};_0x5688cc['model']=_[_0x90bf('0x48')](db[_0x90bf('0x49')][_0x90bf('0x4a')]);_0x5688cc[_0x90bf('0x35')]=_[_0x90bf('0x48')](_0x442827[_0x90bf('0x35')]);_0x5688cc[_0x90bf('0x36')]=_['intersection'](_0x5688cc[_0x90bf('0x34')],_0x5688cc[_0x90bf('0x35')]);_0x20775f[_0x90bf('0x38')]=_[_0x90bf('0x37')](_0x5688cc[_0x90bf('0x34')],qs[_0x90bf('0x39')](_0x442827[_0x90bf('0x35')]['fields']));_0x20775f[_0x90bf('0x38')]=_0x20775f['attributes']['length']?_0x20775f['attributes']:_0x5688cc[_0x90bf('0x34')];if(_0x442827[_0x90bf('0x35')][_0x90bf('0x42')]){_0x20775f[_0x90bf('0x43')]=[{'all':!![]}];}_0x20775f=_[_0x90bf('0x41')]({},_0x20775f,_0x442827['options']);return db[_0x90bf('0x49')][_0x90bf('0x4b')](_0x20775f)[_0x90bf('0x28')](handleEntityNotFound(_0x425b4d,null))[_0x90bf('0x28')](respondWithResult(_0x425b4d,null))[_0x90bf('0x45')](handleError(_0x425b4d,null));};exports[_0x90bf('0x4c')]=function(_0x1c823f,_0x1b56b2,_0x23c0b0){return db[_0x90bf('0x49')][_0x90bf('0x4b')]({'where':{'id':_0x1c823f[_0x90bf('0x47')]['id']},'attributes':[_0x90bf('0x2d'),_0x90bf('0x7')],'raw':!![]})[_0x90bf('0x28')](handleEntityNotFound(_0x1b56b2,null))[_0x90bf('0x28')](function(_0xcf2db6){if(_0xcf2db6){var _0xebccf2=path[_0x90bf('0x4d')](config[_0x90bf('0x4e')],_0x90bf('0x4f'),util[_0x90bf('0x50')](_0x90bf('0x51'),path['basename'](_0xcf2db6['path'])));var _0x4a7fdb=fs[_0x90bf('0x52')](_0xebccf2);var _0x364951=archiver(_0x90bf('0x53'),{'zlib':{'level':0x9}});_0x364951['on']('warning',function(_0x46d6e9){if(_0x46d6e9[_0x90bf('0x54')]===_0x90bf('0x55')){logger[_0x90bf('0x2b')](_0x46d6e9);}else{throw new db[(_0x90bf('0x56'))][(_0x90bf('0x57'))](_0x90bf('0x58'));}});_0x364951['on']('error',function(_0x62190c){throw new db[(_0x90bf('0x56'))]['Error'](_0x90bf('0x58'));});_0x364951['pipe'](_0x4a7fdb);_0x364951[_0x90bf('0x59')](_0x90bf('0x5a'),{'cwd':path[_0x90bf('0x4d')](config[_0x90bf('0x4e')],_0x90bf('0x4f'),path['dirname'](_0xcf2db6[_0x90bf('0x7')])),'ignore':[path[_0x90bf('0x4d')](path[_0x90bf('0x5b')](_0xcf2db6[_0x90bf('0x7')]),_0x90bf('0x5c')),path[_0x90bf('0x4d')](path[_0x90bf('0x5b')](_0xcf2db6[_0x90bf('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x90bf('0x5d')]();_0x4a7fdb['on']('close',function(){if(!fs[_0x90bf('0x5e')](_0xebccf2)){throw new db[(_0x90bf('0x56'))][(_0x90bf('0x57'))](_0x90bf('0x5f'));}return _0x1b56b2[_0x90bf('0x4c')](_0xebccf2,util[_0x90bf('0x50')](_0x90bf('0x51'),path[_0x90bf('0x5b')](_0xcf2db6[_0x90bf('0x7')])),function(_0x1a46b9){if(_0x1a46b9){throw new db[(_0x90bf('0x56'))][(_0x90bf('0x57'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x90bf('0x60')](_0xebccf2);logger[_0x90bf('0x61')](_0x90bf('0x62'));logger[_0x90bf('0x61')]('Temporary\x20file\x20removed');});});}return null;})[_0x90bf('0x45')](handleError(_0x1b56b2,null));};exports[_0x90bf('0x63')]=function(_0x261084,_0x4e0da2,_0x1a79ef){var _0x5f1ce4=path[_0x90bf('0x5b')](_0x261084[_0x90bf('0x64')][_0x90bf('0x65')],path['extname'](_0x261084['file'][_0x90bf('0x65')]));var _0x18c944=path['join'](config[_0x90bf('0x4e')],_0x90bf('0x4f'),_0x261084['file'][_0x90bf('0x65')]);var _0x19d1c2=path[_0x90bf('0x4d')](config[_0x90bf('0x4e')],'server/files/plugins',_0x5f1ce4);logger['info'](_0x90bf('0x66'),_0x18c944);logger['info'](_0x90bf('0x67'),_0x19d1c2);try{fs['chmodSync'](_0x18c944,parseInt(_0x90bf('0x68'),0x8));extract(_0x18c944,{'dir':_0x19d1c2},function(_0x2d8249){if(_0x2d8249){logger['error'](_0x2d8249);handleError(_0x2d8249,!![]);};var _0x244f50=fs[_0x90bf('0x69')](_0x19d1c2);if(_0x244f50[_0x90bf('0x3a')]>0x1){removeReferences(_0x18c944,_0x19d1c2);logger['error'](_0x90bf('0x6a'));return _0x1a79ef(new Error(_0x90bf('0x6a')));}var _0x1a9350=fs[_0x90bf('0x6b')](path['join'](_0x19d1c2,_0x244f50[0x0]));if(_0x1a9350[_0x90bf('0x6c')]()){removeReferences(_0x18c944,_0x19d1c2);logger['error'](_0x90bf('0x6a'));return _0x1a79ef(new Error(_0x90bf('0x6a')));}if(_0x1a9350[_0x90bf('0x6d')]()){var _0x493e37=fs['readdirSync'](path[_0x90bf('0x4d')](_0x19d1c2,_0x244f50[0x0]));if(_0x493e37[_0x90bf('0x3a')]===0x0){removeReferences(_0x18c944,_0x19d1c2);logger[_0x90bf('0x2b')]('Invalid\x20plugin\x20structure');return _0x1a79ef(new Error('Invalid\x20plugin\x20structure'));}var _0x5921d3=_0x493e37[_0x90bf('0x6e')](function(_0x59f039){return _0x59f039==='manifest.json';});if(!_0x5921d3){return _0x1a79ef(new Error(_0x90bf('0x6f')));}var _0xb8c576=fs[_0x90bf('0x70')](path[_0x90bf('0x4d')](_0x19d1c2,_0x244f50[0x0],_0x90bf('0x71')));var _0x4ed8ff=JSON['parse'](_0xb8c576);if(_0x90bf('0x72')==typeof _0x4ed8ff[_0x90bf('0x2d')]){return _0x1a79ef(new Error(_0x90bf('0x73')));}if('undefined'==typeof _0x4ed8ff[_0x90bf('0x32')]){return _0x1a79ef(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x4ed8ff['version']){return _0x1a79ef(new Error(_0x90bf('0x74')));}if('undefined'==typeof _0x4ed8ff[_0x90bf('0x75')]){return _0x1a79ef(new Error(_0x90bf('0x76')));}if(_0x4ed8ff[_0x90bf('0x32')]==='html'){if('undefined'==typeof _0x4ed8ff['parameters'][_0x90bf('0x77')]){return _0x1a79ef(new Error(_0x90bf('0x78')));}if(_0x90bf('0x72')==typeof _0x4ed8ff[_0x90bf('0x75')][_0x90bf('0x77')][_0x90bf('0x79')]&&_0x90bf('0x72')==typeof _0x4ed8ff[_0x90bf('0x75')][_0x90bf('0x77')][_0x90bf('0x7a')]){return _0x1a79ef(new Error(_0x90bf('0x7b')));}}else if(_0x4ed8ff[_0x90bf('0x32')]===_0x90bf('0x7c')){if(_0x90bf('0x72')==typeof _0x4ed8ff['parameters'][_0x90bf('0x7d')]){return _0x1a79ef(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x90bf('0x72')==typeof _0x4ed8ff[_0x90bf('0x75')][_0x90bf('0x7e')]){return _0x1a79ef(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1a79ef(new Error(_0x90bf('0x7f')));}var _0x419c24=_0x4ed8ff['name'];var _0x4bd9e8=_0x4ed8ff[_0x90bf('0x80')];var _0x16079c=_0x4ed8ff['type'];var _0x13cc9b=_0x4ed8ff[_0x90bf('0x81')]?_0x4ed8ff[_0x90bf('0x81')]:'always';var _0x324086=_0x4ed8ff[_0x90bf('0x82')]?_0x4ed8ff[_0x90bf('0x82')]:'icon-apps';var _0x1dfdba='';var _0x306927='';var _0x51200e='';var _0x5c0cff='';var _0xeb91cd=_0x4ed8ff[_0x90bf('0x83')];if(_0x16079c===_0x90bf('0x84')){if(_0x90bf('0x72')!=typeof _0x4ed8ff[_0x90bf('0x75')]['views'][_0x90bf('0x79')]){var _0x59ab68=_0x4ed8ff[_0x90bf('0x75')][_0x90bf('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x90bf('0x85')](_0x59ab68)){_0x1dfdba=path[_0x90bf('0x4d')](_0x90bf('0x86'),_0x5f1ce4,_0x244f50[0x0],_0x59ab68);}else{_0x1dfdba=_0x59ab68;}}else{logger['info'](_0x90bf('0x87'));}if(_0x90bf('0x72')!=typeof _0x4ed8ff['parameters'][_0x90bf('0x77')]['agent']){var _0x3db3ba=_0x4ed8ff['parameters'][_0x90bf('0x77')][_0x90bf('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x90bf('0x85')](_0x3db3ba)){_0x306927=path[_0x90bf('0x4d')](_0x90bf('0x86'),_0x5f1ce4,_0x244f50[0x0],_0x3db3ba);}else{_0x306927=_0x3db3ba;}}else{logger[_0x90bf('0x61')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x16079c===_0x90bf('0x7c')){_0x51200e=_0x4ed8ff['parameters'][_0x90bf('0x7d')];_0x5c0cff=_0x4ed8ff['parameters'][_0x90bf('0x7e')];if('undefined'!=typeof _0x4ed8ff['parameters'][_0x90bf('0x77')]){if(_0x90bf('0x72')!=typeof _0x4ed8ff['parameters'][_0x90bf('0x77')][_0x90bf('0x79')]){var _0x59ab68=_0x4ed8ff['parameters'][_0x90bf('0x77')][_0x90bf('0x79')];if(!/^(f|ht)tps?:\/\//i['test'](_0x59ab68)){_0x1dfdba=path[_0x90bf('0x4d')](_0x90bf('0x86'),_0x5f1ce4,_0x244f50[0x0],_0x59ab68);}else{_0x1dfdba=_0x59ab68;}}if(_0x90bf('0x72')!=typeof _0x4ed8ff[_0x90bf('0x75')][_0x90bf('0x77')][_0x90bf('0x7a')]){var _0x3db3ba=_0x4ed8ff[_0x90bf('0x75')][_0x90bf('0x77')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3db3ba)){_0x306927=path[_0x90bf('0x4d')]('plugins',_0x5f1ce4,_0x244f50[0x0],_0x3db3ba);}else{_0x306927=_0x3db3ba;}}}}var _0x3b7a72={'name':_0x419c24,'description':_0x4bd9e8,'path':path['join'](_0x5f1ce4,_0x244f50[0x0]),'type':_0x16079c,'sidebar':_0x13cc9b,'icon':_0x324086,'adminUrl':_0x1dfdba,'agentUrl':_0x306927,'scriptName':_0x51200e,'scriptPath':_0x5c0cff,'version':_0xeb91cd};removeReferences(_0x18c944,null);return db[_0x90bf('0x49')][_0x90bf('0x88')](_0x3b7a72)['then'](function(_0x4aba0f){var _0x4fad89={'role':_0x261084[_0x90bf('0x89')]['role'],'userProfileId':_0x261084['body'][_0x90bf('0x8a')]};if(!_0x4fad89)throw new Error(_0x90bf('0x8b'));if(_0x4fad89['role']==='user'){var _0x603810=_0x4aba0f[_0x90bf('0x8c')]({'plain':!![]});return db[_0x90bf('0x8d')]['find']({'where':{'name':_0x90bf('0x8e'),'userProfileId':_0x4fad89[_0x90bf('0x8a')]},'raw':!![]})['then'](function(_0x4a66ff){if(_0x4a66ff&&_0x4a66ff[_0x90bf('0x8f')]===0x0){return db[_0x90bf('0x2a')]['create']({'name':_0x603810[_0x90bf('0x2d')],'resourceId':_0x603810['id'],'type':_0x4a66ff[_0x90bf('0x2d')],'sectionId':_0x4a66ff['id']},{})[_0x90bf('0x28')](function(){return _0x4aba0f;});}else{return _0x4aba0f;}})[_0x90bf('0x45')](function(_0x34ed84){logger[_0x90bf('0x2b')](_0x90bf('0x90'),_0x34ed84);throw _0x34ed84;});}return _0x4aba0f;})['then'](respondWithResult(_0x4e0da2,null))['catch'](handleError(_0x4e0da2,null));}});}catch(_0x2cf865){_0x4e0da2[_0x90bf('0x20')](0x1f4)[_0x90bf('0x2e')](_0x2cf865);}};function removeReferences(_0x49afc2,_0x162c99){try{if(_0x49afc2){fs[_0x90bf('0x60')](_0x49afc2);logger[_0x90bf('0x61')]('Zip\x20archive\x20removed');}if(_0x162c99){rimraf(_0x162c99,function(){});logger[_0x90bf('0x61')](_0x90bf('0x91'));}}catch(_0x251c11){logger[_0x90bf('0x2b')](_0x251c11);}}exports[_0x90bf('0x27')]=function(_0x56ffd0,_0x438991,_0x346b7a){return db[_0x90bf('0x49')][_0x90bf('0x4b')]({'where':{'id':_0x56ffd0[_0x90bf('0x47')]['id']}})[_0x90bf('0x28')](handleEntityNotFound(_0x438991,null))[_0x90bf('0x28')](saveUpdates(_0x56ffd0[_0x90bf('0x89')],null))['then'](respondWithResult(_0x438991,null))[_0x90bf('0x45')](handleError(_0x438991,null));};exports[_0x90bf('0x92')]=function(_0x9d0e3f,_0x3577bd,_0x537c95){return db[_0x90bf('0x49')][_0x90bf('0x4b')]({'where':{'id':_0x9d0e3f[_0x90bf('0x47')]['id']}})['then'](function(_0x4a173b){if(_0x4a173b){return _0x4a173b[_0x90bf('0x29')]();}})[_0x90bf('0x28')](function(_0x47f8e4){rimraf(path[_0x90bf('0x4d')](config['root'],'server/files/plugins',path[_0x90bf('0x93')](_0x47f8e4[_0x90bf('0x7')])),function(){});return _0x47f8e4;})[_0x90bf('0x28')](handleEntityNotFound(_0x3577bd,null))[_0x90bf('0x28')](respondWithStatusCode(_0x3577bd,null))[_0x90bf('0x45')](handleError(_0x3577bd,null));};exports['webhookGet']=function(_0x224105,_0x123d6b,_0x500b4b){return BPromise[_0x90bf('0x94')]()[_0x90bf('0x28')](function(){if(!_0x224105['query']['path']){throw new Error(_0x90bf('0x95'));}if(!_0x224105[_0x90bf('0x35')][_0x90bf('0x96')]){throw new Error(_0x90bf('0x97'));}var _0x149a2f=_0x224105[_0x90bf('0x35')]['hostname']?_0x224105['query']['hostname']+':'+_0x224105[_0x90bf('0x35')]['port']:_0x90bf('0x98')+_0x224105[_0x90bf('0x35')]['port'];var _0x25c5f3=_0x224105[_0x90bf('0x35')][_0x90bf('0x99')]?_0x224105[_0x90bf('0x35')][_0x90bf('0x99')]:!![];var _0x4dc819=_0x224105[_0x90bf('0x35')][_0x90bf('0x9a')]?_0x224105[_0x90bf('0x35')][_0x90bf('0x9a')]:null;var _0x1884a1={'method':_0x224105[_0x90bf('0x9b')],'uri':util[_0x90bf('0x50')](_0x90bf('0x9c'),_0x149a2f,_0x224105[_0x90bf('0x35')]['path']),'json':_0x25c5f3,'resolveWithFullResponse':!![],'encoding':_0x4dc819,'qs':_0x224105[_0x90bf('0x35')]};if(_0x224105['headers']){_0x1884a1['headers']=_0x224105[_0x90bf('0x9d')];if(_0x1884a1['headers']['content-length']){delete _0x1884a1[_0x90bf('0x9d')][_0x90bf('0x9e')];}}if(_0x1884a1[_0x90bf('0x9d')][_0x90bf('0x9f')]){delete _0x1884a1[_0x90bf('0x9d')][_0x90bf('0x9f')];}return rp(_0x1884a1);})[_0x90bf('0x28')](function(_0x4d13cf){if(_0x4d13cf){_0x123d6b[_0x90bf('0x25')](_0x4d13cf[_0x90bf('0x9d')]);logger[_0x90bf('0x61')](_0x4d13cf[_0x90bf('0x89')]);if(_[_0x90bf('0xa0')](_0x224105[_0x90bf('0x35')][_0x90bf('0x7')],'download')&&_0x4d13cf[_0x90bf('0xa1')]==0x1f4){return _0x123d6b['sendStatus'](_0x4d13cf[_0x90bf('0xa1')]);}else{return _0x123d6b[_0x90bf('0x20')](_0x4d13cf['statusCode'])[_0x90bf('0x2e')](_0x4d13cf['body']);}}else{return _0x123d6b[_0x90bf('0x1f')](0xc8);}})[_0x90bf('0x45')](handleError(_0x123d6b,null));};exports['webhookPost']=function(_0xfdf481,_0x35b51a,_0x548a79){return BPromise[_0x90bf('0x94')]()[_0x90bf('0x28')](function(){if(!_0xfdf481[_0x90bf('0x35')]['path']){throw new Error(_0x90bf('0x95'));}if(!_0xfdf481[_0x90bf('0x35')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3e0ea9=_0xfdf481[_0x90bf('0x35')]['hostname']?_0xfdf481[_0x90bf('0x35')]['hostname']+':'+_0xfdf481[_0x90bf('0x35')][_0x90bf('0x96')]:_0x90bf('0x98')+_0xfdf481['query'][_0x90bf('0x96')];var _0x47b1b5=_0xfdf481[_0x90bf('0x35')]['json']?_0xfdf481[_0x90bf('0x35')]['json']:!![];var _0x120be0=_0xfdf481[_0x90bf('0x35')][_0x90bf('0x9a')]?_0xfdf481[_0x90bf('0x35')][_0x90bf('0x9a')]:null;var _0x7f62={'method':_0xfdf481[_0x90bf('0x9b')],'uri':util[_0x90bf('0x50')](_0x90bf('0x9c'),_0x3e0ea9,_0xfdf481['query'][_0x90bf('0x7')]),'json':_0x47b1b5,'resolveWithFullResponse':!![],'encoding':_0x120be0,'body':_0xfdf481['body']};if(_0xfdf481['headers']){_0x7f62['headers']=_0xfdf481[_0x90bf('0x9d')];if(_0x7f62['headers']['content-length']){delete _0x7f62['headers'][_0x90bf('0x9e')];}}if(_0x7f62[_0x90bf('0x9d')][_0x90bf('0x9f')]){delete _0x7f62[_0x90bf('0x9d')][_0x90bf('0x9f')];}return rp(_0x7f62);})[_0x90bf('0x28')](function(_0x1fa43d){if(_0x1fa43d){_0x35b51a[_0x90bf('0x25')](_0x1fa43d[_0x90bf('0x9d')]);logger[_0x90bf('0x61')](_0x1fa43d['body']);return _0x35b51a[_0x90bf('0x20')](_0x1fa43d[_0x90bf('0xa1')])[_0x90bf('0x2e')](_0x1fa43d[_0x90bf('0x89')]);}else{return _0x35b51a[_0x90bf('0x1f')](0xc8);}})[_0x90bf('0x45')](handleError(_0x35b51a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a0597dc..70bff64 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 _0xda2d=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda2d,0x102));var _0xdda2=function(_0x11b52b,_0x1fe1be){_0x11b52b=_0x11b52b-0x0;var _0x1fb6b2=_0xda2d[_0x11b52b];return _0x1fb6b2;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xdda2('0x0'))['db'][_0xdda2('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xdda2('0x2')](0x0);var events={'afterCreate':_0xdda2('0x3'),'afterUpdate':_0xdda2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5ef049){return function(_0x5a5f9f,_0x357e97,_0x319129){PluginEvents[_0xdda2('0x5')](_0x5ef049+':'+_0x5a5f9f['id'],_0x5a5f9f);PluginEvents[_0xdda2('0x5')](_0x5ef049,_0x5a5f9f);_0x319129(null);};}for(var e in events){if(events[_0xdda2('0x6')](e)){var event=events[e];Plugin[_0xdda2('0x7')](e,emitEvent(event));}}module[_0xdda2('0x8')]=PluginEvents; \ No newline at end of file +var _0x3423=['remove','emit','hasOwnProperty','hook','exports','Plugin','setMaxListeners','save','update'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x3342('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x3342('0x1')](0x0);var events={'afterCreate':_0x3342('0x2'),'afterUpdate':_0x3342('0x3'),'afterDestroy':_0x3342('0x4')};function emitEvent(_0x28aad1){return function(_0x2207ce,_0x3c5d8d,_0x3075f8){PluginEvents[_0x3342('0x5')](_0x28aad1+':'+_0x2207ce['id'],_0x2207ce);PluginEvents[_0x3342('0x5')](_0x28aad1,_0x2207ce);_0x3075f8(null);};}for(var e in events){if(events[_0x3342('0x6')](e)){var event=events[e];Plugin[_0x3342('0x7')](e,emitEvent(event));}}module[_0x3342('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f934f12..8e1418e 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['define','Plugin','plugins','util','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0xc03f60,_0x4b1aa2){var _0x17d6cb=function(_0x2305b8){while(--_0x2305b8){_0xc03f60['push'](_0xc03f60['shift']());}};_0x17d6cb(++_0x4b1aa2);}(_0x8958,0x93));var _0x8895=function(_0x5a04cd,_0x3c2206){_0x5a04cd=_0x5a04cd-0x0;var _0xd2d6c8=_0x8958[_0x5a04cd];return _0xd2d6c8;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1ed39c,_0x1d179f){var _0x26d616=function(_0x3f1074){while(--_0x3f1074){_0x1ed39c['push'](_0x1ed39c['shift']());}};_0x26d616(++_0x1d179f);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5abcd9,_0x59a9ce){_0x5abcd9=_0x5abcd9-0x0;var _0xbcd11d=_0xd6d6[_0x5abcd9];return _0xbcd11d;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'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 33465f9..3487ef8 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 _0x12c5=['Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x12c5,0xbe));var _0x512c=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x12c5[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x512c('0x0'));var util=require(_0x512c('0x1'));var moment=require('moment');var BPromise=require(_0x512c('0x2'));var rs=require(_0x512c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x512c('0x4'))['db'];var utils=require(_0x512c('0x5'));var logger=require(_0x512c('0x6'))(_0x512c('0x7'));var config=require('../../config/environment');var jayson=require(_0x512c('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x512c('0x9')](config[_0x512c('0xa')],{'host':_0x512c('0xb'),'port':0x18eb});var socket=require(_0x512c('0xc'))(new Redis(config[_0x512c('0xa')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x2c7f5a,_0x23e7da,_0x4a3cba){return new BPromise(function(_0x5c54cd,_0x2970a7){return client['request'](_0x2c7f5a,_0x4a3cba)[_0x512c('0xd')](function(_0x41be4a){logger['info']('Plugin,\x20%s,\x20%s',_0x23e7da,_0x512c('0xe'));logger[_0x512c('0xf')](_0x512c('0x10'),_0x23e7da,_0x512c('0xe'),JSON[_0x512c('0x11')](_0x41be4a));if(_0x41be4a['error']){if(_0x41be4a['error'][_0x512c('0x12')]===0x1f4){logger[_0x512c('0x13')](_0x512c('0x14'),_0x23e7da,_0x41be4a[_0x512c('0x13')][_0x512c('0x15')]);return _0x2970a7(_0x41be4a[_0x512c('0x13')]['message']);}logger['error'](_0x512c('0x14'),_0x23e7da,_0x41be4a[_0x512c('0x13')][_0x512c('0x15')]);return _0x5c54cd(_0x41be4a[_0x512c('0x13')][_0x512c('0x15')]);}else{logger[_0x512c('0x16')](_0x512c('0x14'),_0x23e7da,_0x512c('0xe'));_0x5c54cd(_0x41be4a[_0x512c('0x17')]['message']);}})[_0x512c('0x18')](function(_0x1cb977){logger[_0x512c('0x13')](_0x512c('0x14'),_0x23e7da,_0x1cb977);_0x2970a7(_0x1cb977);});});}exports[_0x512c('0x19')]=function(_0x5dbdd3){var _0xcc7970=this;return new Promise(function(_0x1c293,_0x3504be){return db[_0x512c('0x1a')][_0x512c('0x1b')](_0x5dbdd3['body'],{'raw':_0x5dbdd3[_0x512c('0x1c')]?_0x5dbdd3[_0x512c('0x1c')][_0x512c('0x1d')]===undefined?!![]:![]:!![]})[_0x512c('0xd')](function(_0x27aa3d){logger[_0x512c('0x16')](_0x512c('0x19'),_0x5dbdd3);logger[_0x512c('0xf')](_0x512c('0x19'),_0x5dbdd3,JSON['stringify'](_0x27aa3d));_0x1c293(_0x27aa3d);})[_0x512c('0x18')](function(_0xeff137){logger[_0x512c('0x13')](_0x512c('0x19'),_0xeff137[_0x512c('0x15')],_0x5dbdd3);_0x3504be(_0xcc7970[_0x512c('0x13')](0x1f4,_0xeff137[_0x512c('0x15')]));});});}; \ No newline at end of file +var _0xe6d8=['localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6d8,0x13f));var _0x8e6d=function(_0x37cca8,_0x14827c){_0x37cca8=_0x37cca8-0x0;var _0x594b79=_0xe6d8[_0x37cca8];return _0x594b79;};'use strict';var _=require(_0x8e6d('0x0'));var util=require(_0x8e6d('0x1'));var moment=require(_0x8e6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e6d('0x3'));var fs=require('fs');var Redis=require(_0x8e6d('0x4'));var db=require(_0x8e6d('0x5'))['db'];var utils=require(_0x8e6d('0x6'));var logger=require(_0x8e6d('0x7'))(_0x8e6d('0x8'));var config=require(_0x8e6d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e6d('0xa')][_0x8e6d('0xb')]({'port':0x232a});config['redis']=_[_0x8e6d('0xc')](config[_0x8e6d('0xd')],{'host':_0x8e6d('0xe'),'port':0x18eb});var socket=require(_0x8e6d('0xf'))(new Redis(config[_0x8e6d('0xd')]));require(_0x8e6d('0x10'))[_0x8e6d('0x11')](socket);function respondWithRpcPromise(_0x43ea5c,_0x79ff58,_0x3113bc){return new BPromise(function(_0x4e99de,_0x173e5d){return client[_0x8e6d('0x12')](_0x43ea5c,_0x3113bc)[_0x8e6d('0x13')](function(_0x39a5c3){logger[_0x8e6d('0x14')](_0x8e6d('0x15'),_0x79ff58,'request\x20sent');logger[_0x8e6d('0x16')](_0x8e6d('0x17'),_0x79ff58,_0x8e6d('0x18'),JSON['stringify'](_0x39a5c3));if(_0x39a5c3[_0x8e6d('0x19')]){if(_0x39a5c3[_0x8e6d('0x19')][_0x8e6d('0x1a')]===0x1f4){logger[_0x8e6d('0x19')](_0x8e6d('0x15'),_0x79ff58,_0x39a5c3[_0x8e6d('0x19')][_0x8e6d('0x1b')]);return _0x173e5d(_0x39a5c3[_0x8e6d('0x19')][_0x8e6d('0x1b')]);}logger['error'](_0x8e6d('0x15'),_0x79ff58,_0x39a5c3[_0x8e6d('0x19')][_0x8e6d('0x1b')]);return _0x4e99de(_0x39a5c3[_0x8e6d('0x19')][_0x8e6d('0x1b')]);}else{logger[_0x8e6d('0x14')](_0x8e6d('0x15'),_0x79ff58,_0x8e6d('0x18'));_0x4e99de(_0x39a5c3[_0x8e6d('0x1c')]['message']);}})[_0x8e6d('0x1d')](function(_0x2cd7da){logger[_0x8e6d('0x19')]('Plugin,\x20%s,\x20%s',_0x79ff58,_0x2cd7da);_0x173e5d(_0x2cd7da);});});}exports[_0x8e6d('0x1e')]=function(_0x216543){var _0x43ae33=this;return new Promise(function(_0x153a18,_0x5684d2){return db[_0x8e6d('0x1f')][_0x8e6d('0x20')](_0x216543[_0x8e6d('0x21')],{'raw':_0x216543['options']?_0x216543[_0x8e6d('0x22')][_0x8e6d('0x23')]===undefined?!![]:![]:!![]})[_0x8e6d('0x13')](function(_0x5b012e){logger[_0x8e6d('0x14')](_0x8e6d('0x1e'),_0x216543);logger[_0x8e6d('0x16')](_0x8e6d('0x1e'),_0x216543,JSON[_0x8e6d('0x24')](_0x5b012e));_0x153a18(_0x5b012e);})[_0x8e6d('0x1d')](function(_0x111a06){logger[_0x8e6d('0x19')](_0x8e6d('0x1e'),_0x111a06[_0x8e6d('0x1b')],_0x216543);_0x5684d2(_0x43ae33[_0x8e6d('0x19')](0x1f4,_0x111a06['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index afa1445..da9e273 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 _0xd2f3=['register','save','remove','update','emit','removeListener'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xd2f3,0x169));var _0x3d2f=function(_0x270cb7,_0x5c6449){_0x270cb7=_0x270cb7-0x0;var _0x3ba5fa=_0xd2f3[_0x270cb7];return _0x3ba5fa;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x3d2f('0x0'),_0x3d2f('0x1'),_0x3d2f('0x2')];function createListener(_0x5c70e4,_0x531532){return function(_0x2e70fd){_0x531532[_0x3d2f('0x3')](_0x5c70e4,_0x2e70fd);};}function removeListener(_0x1c3f30,_0x4fa112){return function(){PluginEvents[_0x3d2f('0x4')](_0x1c3f30,_0x4fa112);};}exports[_0x3d2f('0x5')]=function(_0x4a19d5){for(var _0x863ab5=0x0,_0x49c075=events['length'];_0x863ab5<_0x49c075;_0x863ab5++){var _0x4a66b7=events[_0x863ab5];var _0x479e39=createListener('plugin:'+_0x4a66b7,_0x4a19d5);PluginEvents['on'](_0x4a66b7,_0x479e39);}}; \ No newline at end of file +var _0x349f=['./plugin.events','save','remove','emit','removeListener','register','length','plugin:'];(function(_0xd6df5e,_0x4a4e46){var _0x155b12=function(_0x368fb6){while(--_0x368fb6){_0xd6df5e['push'](_0xd6df5e['shift']());}};_0x155b12(++_0x4a4e46);}(_0x349f,0xa8));var _0xf349=function(_0x244a69,_0x36799e){_0x244a69=_0x244a69-0x0;var _0x15e989=_0x349f[_0x244a69];return _0x15e989;};'use strict';var PluginEvents=require(_0xf349('0x0'));var events=[_0xf349('0x1'),_0xf349('0x2'),'update'];function createListener(_0x261a27,_0x3b0c16){return function(_0xebfbee){_0x3b0c16[_0xf349('0x3')](_0x261a27,_0xebfbee);};}function removeListener(_0x2c3a22,_0x39b8aa){return function(){PluginEvents[_0xf349('0x4')](_0x2c3a22,_0x39b8aa);};}exports[_0xf349('0x5')]=function(_0x28b227){for(var _0x1af89b=0x0,_0x4c6f4c=events[_0xf349('0x6')];_0x1af89b<_0x4c6f4c;_0x1af89b++){var _0x23fb4b=events[_0x1af89b];var _0x6c6cd2=createListener(_0xf349('0x7')+_0x23fb4b,_0x28b227);PluginEvents['on'](_0x23fb4b,_0x6c6cd2);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b568ab5..35ec9bf 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 _0xe266=['create','put','/:id','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','index','isAuthenticated','show','post'];(function(_0x2c6bb2,_0x30d59e){var _0x1d0a76=function(_0x38682b){while(--_0x38682b){_0x2c6bb2['push'](_0x2c6bb2['shift']());}};_0x1d0a76(++_0x30d59e);}(_0xe266,0x141));var _0x6e26=function(_0x4c9a56,_0x1f060a){_0x4c9a56=_0x4c9a56-0x0;var _0xfef63f=_0xe266[_0x4c9a56];return _0xfef63f;};'use strict';var express=require(_0x6e26('0x0'));var router=express[_0x6e26('0x1')]();var auth=require(_0x6e26('0x2'));var controller=require(_0x6e26('0x3'));router[_0x6e26('0x4')]('/',auth['isAuthenticated'](),controller[_0x6e26('0x5')]);router[_0x6e26('0x4')]('/:id',auth[_0x6e26('0x6')](),controller[_0x6e26('0x7')]);router[_0x6e26('0x8')]('/',auth[_0x6e26('0x6')](),controller[_0x6e26('0x9')]);router[_0x6e26('0xa')](_0x6e26('0xb'),auth[_0x6e26('0x6')](),controller['update']);router[_0x6e26('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6e26('0xd')]);module[_0x6e26('0xe')]=router; \ No newline at end of file +var _0x0fe8=['show','post','create','put','delete','exports','Router','./pm2.controller','get','isAuthenticated','/:id'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x0fe8,0x95));var _0x80fe=function(_0x16c3bd,_0xd00b68){_0x16c3bd=_0x16c3bd-0x0;var _0x2dba2a=_0x0fe8[_0x16c3bd];return _0x2dba2a;};'use strict';var express=require('express');var router=express[_0x80fe('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x80fe('0x1'));router[_0x80fe('0x2')]('/',auth[_0x80fe('0x3')](),controller['index']);router[_0x80fe('0x2')](_0x80fe('0x4'),auth[_0x80fe('0x3')](),controller[_0x80fe('0x5')]);router[_0x80fe('0x6')]('/',auth[_0x80fe('0x3')](),controller[_0x80fe('0x7')]);router[_0x80fe('0x8')]('/:id',auth[_0x80fe('0x3')](),controller['update']);router[_0x80fe('0x9')](_0x80fe('0x4'),auth['isAuthenticated'](),controller['destroy']);module[_0x80fe('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 73336ad..31ed070 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 _0xfd9a=['api','path','child_process','exec','bluebird','status','json','error','stack','send','info','list','then','reject','express','name','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id'];(function(_0xc0e4a5,_0x27865a){var _0xe061eb=function(_0x2c28bc){while(--_0x2c28bc){_0xc0e4a5['push'](_0xc0e4a5['shift']());}};_0xe061eb(++_0x27865a);}(_0xfd9a,0x1c8));var _0xafd9=function(_0xdcfa3,_0x426d85){_0xdcfa3=_0xdcfa3-0x0;var _0x64a7f1=_0xfd9a[_0xdcfa3];return _0x64a7f1;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xafd9('0x0'));var path=require(_0xafd9('0x1'));var exec=require(_0xafd9('0x2'))[_0xafd9('0x3')];var BPromise=require(_0xafd9('0x4'));function handleEntityNotFound(_0xecc0b1,_0x37404e){return function(_0x3ac059){if(!_0x3ac059){_0xecc0b1['sendStatus'](0x194);;}return _0x3ac059;};}function respondWithResult(_0x1bdce2,_0x567302){_0x567302=_0x567302||0xc8;return function(_0x14ef32){if(_0x14ef32){return _0x1bdce2[_0xafd9('0x5')](_0x567302)[_0xafd9('0x6')](_0x14ef32);}return null;};}function handleError(_0xac8d95,_0x2c8c16){_0x2c8c16=_0x2c8c16||0x1f4;return function(_0x2cf792){logger[_0xafd9('0x7')](_0x2cf792[_0xafd9('0x8')]);if(_0x2cf792['name']){delete _0x2cf792['name'];}_0xac8d95['status'](_0x2c8c16)[_0xafd9('0x9')](_0x2cf792);};}function execChildProcess(){return new BPromise(function(_0x170b81,_0x1781c5){exec('npm\x20install',function(_0x552f05,_0x5eebc3,_0x219192){logger[_0xafd9('0xa')](_0x5eebc3);logger[_0xafd9('0xa')](_0x219192);if(_0x552f05){logger[_0xafd9('0x7')](_0x552f05);return _0x1781c5(_0x552f05);}return _0x170b81(_0x5eebc3);});});}exports['index']=function(_0x14074c,_0x1556bd){return pm2[_0xafd9('0xb')]()[_0xafd9('0xc')](function(_0x374b96){if(_0x374b96){var _0xc8b1a5=_[_0xafd9('0xd')](_0x374b96,function(_0x5e9de0){return _0x5e9de0['name']===_0xafd9('0xe')||_0x5e9de0[_0xafd9('0xf')]===_0xafd9('0x10');});return{'rows':_0xc8b1a5,'count':_0xc8b1a5[_0xafd9('0x11')]};}return null;})[_0xafd9('0xc')](respondWithResult(_0x1556bd,null))[_0xafd9('0x12')](handleError(_0x1556bd,null));};exports[_0xafd9('0x13')]=function(_0x3411e4,_0x4d2c57){return pm2[_0xafd9('0x14')](_0x3411e4[_0xafd9('0x15')]['id'])[_0xafd9('0xc')](respondWithResult(_0x4d2c57,null))['then'](handleEntityNotFound(_0x4d2c57,null))['catch'](handleError(_0x4d2c57,null));};exports['create']=function(_0x341925,_0x5ccc0e){if(_0x341925[_0xafd9('0x16')][_0xafd9('0xf')]&&_0x341925[_0xafd9('0x16')][_0xafd9('0x17')]){var _0x5a3a77=path[_0xafd9('0x18')](__dirname,_0xafd9('0x19'),_0x341925[_0xafd9('0x16')][_0xafd9('0x17')]);var _0x181a06=process[_0xafd9('0x1a')]();process[_0xafd9('0x1b')](path[_0xafd9('0x1c')](_0x5a3a77));return execChildProcess()[_0xafd9('0xc')](function(_0x13dd6a){process['chdir'](_0x181a06);return pm2[_0xafd9('0x1d')]({'name':_0x341925[_0xafd9('0x16')]['name'],'script':_0x5a3a77});})['then'](function(_0x1ee487){pm2[_0xafd9('0x1e')]();return _0x1ee487[0x0];})[_0xafd9('0xc')](respondWithResult(_0x5ccc0e,0xc9))[_0xafd9('0x12')](handleError(_0x5ccc0e,null));}else{return _0x5ccc0e[_0xafd9('0x5')](0x1f4)[_0xafd9('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xafd9('0x1f')]=function(_0x4bae9f,_0x5a3c9e){if(_0x4bae9f[_0xafd9('0x16')]['id']){delete _0x4bae9f[_0xafd9('0x16')]['id'];}var _0x2d8e1e={'online':_0xafd9('0x20'),'stopped':'stop'};if(_0x2d8e1e[_0xafd9('0x21')](_0x4bae9f[_0xafd9('0x16')][_0xafd9('0x5')])){return pm2[_0x2d8e1e[_0x4bae9f[_0xafd9('0x16')][_0xafd9('0x5')]]](_0x4bae9f[_0xafd9('0x15')]['id'])[_0xafd9('0xc')](respondWithResult(_0x5a3c9e,0xc8))[_0xafd9('0x12')](handleError(_0x5a3c9e,null));}else{return _0x5a3c9e['status'](0x1f4)[_0xafd9('0x9')]({'message':_0xafd9('0x22')});}};exports[_0xafd9('0x23')]=function(_0x2f1054,_0x3c64d4){if(_0x2f1054['body']['id']){delete _0x2f1054[_0xafd9('0x16')]['id'];}if(_0x2f1054[_0xafd9('0x15')]['id']){return pm2[_0xafd9('0x24')](_0x2f1054[_0xafd9('0x15')]['id'])['then'](function(_0x2ca614){pm2[_0xafd9('0x1e')]();return _0x2ca614[0x0];})[_0xafd9('0xc')](respondWithResult(_0x3c64d4,null))['catch'](handleError(_0x3c64d4,null));}else{return _0x3c64d4[_0xafd9('0x5')](0x1f4)[_0xafd9('0x9')]({'message':_0xafd9('0x25')});}}; \ No newline at end of file +var _0xe854=['delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status'];(function(_0x364855,_0x3a4a47){var _0x4e78ed=function(_0x53e92a){while(--_0x53e92a){_0x364855['push'](_0x364855['shift']());}};_0x4e78ed(++_0x3a4a47);}(_0xe854,0x1c5));var _0x4e85=function(_0x369829,_0x5149ad){_0x369829=_0x369829-0x0;var _0xb9c603=_0xe854[_0x369829];return _0xb9c603;};'use strict';var _=require(_0x4e85('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x4e85('0x1'))(_0x4e85('0x2'));var path=require(_0x4e85('0x3'));var exec=require(_0x4e85('0x4'))[_0x4e85('0x5')];var BPromise=require(_0x4e85('0x6'));function handleEntityNotFound(_0x5b51a3,_0x49a7d6){return function(_0x9527d){if(!_0x9527d){_0x5b51a3[_0x4e85('0x7')](0x194);;}return _0x9527d;};}function respondWithResult(_0x4ac02d,_0x3e7f22){_0x3e7f22=_0x3e7f22||0xc8;return function(_0x59a246){if(_0x59a246){return _0x4ac02d[_0x4e85('0x8')](_0x3e7f22)[_0x4e85('0x9')](_0x59a246);}return null;};}function handleError(_0x5a2d0e,_0x4c767c){_0x4c767c=_0x4c767c||0x1f4;return function(_0x476319){logger[_0x4e85('0xa')](_0x476319[_0x4e85('0xb')]);if(_0x476319[_0x4e85('0xc')]){delete _0x476319[_0x4e85('0xc')];}_0x5a2d0e[_0x4e85('0x8')](_0x4c767c)[_0x4e85('0xd')](_0x476319);};}function execChildProcess(){return new BPromise(function(_0x581d00,_0x400592){exec(_0x4e85('0xe'),function(_0x4a2124,_0x568328,_0x527b6a){logger[_0x4e85('0xf')](_0x568328);logger['info'](_0x527b6a);if(_0x4a2124){logger[_0x4e85('0xa')](_0x4a2124);return _0x400592(_0x4a2124);}return _0x581d00(_0x568328);});});}exports[_0x4e85('0x10')]=function(_0x5a0de8,_0x44c81e){return pm2[_0x4e85('0x11')]()[_0x4e85('0x12')](function(_0xa2d128){if(_0xa2d128){var _0x5481e8=_['reject'](_0xa2d128,function(_0x54b739){return _0x54b739[_0x4e85('0xc')]===_0x4e85('0x13')||_0x54b739['name']===_0x4e85('0x14');});return{'rows':_0x5481e8,'count':_0x5481e8[_0x4e85('0x15')]};}return null;})[_0x4e85('0x12')](respondWithResult(_0x44c81e,null))[_0x4e85('0x16')](handleError(_0x44c81e,null));};exports[_0x4e85('0x17')]=function(_0xf9a639,_0x8fc00c){return pm2[_0x4e85('0x18')](_0xf9a639[_0x4e85('0x19')]['id'])['then'](respondWithResult(_0x8fc00c,null))['then'](handleEntityNotFound(_0x8fc00c,null))[_0x4e85('0x16')](handleError(_0x8fc00c,null));};exports[_0x4e85('0x1a')]=function(_0x34d28e,_0x28c2c2){if(_0x34d28e[_0x4e85('0x1b')][_0x4e85('0xc')]&&_0x34d28e[_0x4e85('0x1b')][_0x4e85('0x1c')]){var _0x4371a8=path['join'](__dirname,_0x4e85('0x1d'),_0x34d28e['body'][_0x4e85('0x1c')]);var _0x411ce6=process[_0x4e85('0x1e')]();process[_0x4e85('0x1f')](path[_0x4e85('0x20')](_0x4371a8));return execChildProcess()['then'](function(_0x5ad168){process[_0x4e85('0x1f')](_0x411ce6);return pm2[_0x4e85('0x21')]({'name':_0x34d28e[_0x4e85('0x1b')][_0x4e85('0xc')],'script':_0x4371a8});})['then'](function(_0x2e4285){pm2['dump']();return _0x2e4285[0x0];})[_0x4e85('0x12')](respondWithResult(_0x28c2c2,0xc9))['catch'](handleError(_0x28c2c2,null));}else{return _0x28c2c2['status'](0x1f4)[_0x4e85('0xd')]({'message':_0x4e85('0x22')});}};exports[_0x4e85('0x23')]=function(_0x524bcc,_0x4dc579){if(_0x524bcc['body']['id']){delete _0x524bcc[_0x4e85('0x1b')]['id'];}var _0x606aed={'online':_0x4e85('0x24'),'stopped':'stop'};if(_0x606aed[_0x4e85('0x25')](_0x524bcc[_0x4e85('0x1b')][_0x4e85('0x8')])){return pm2[_0x606aed[_0x524bcc[_0x4e85('0x1b')][_0x4e85('0x8')]]](_0x524bcc[_0x4e85('0x19')]['id'])[_0x4e85('0x12')](respondWithResult(_0x4dc579,0xc8))[_0x4e85('0x16')](handleError(_0x4dc579,null));}else{return _0x4dc579['status'](0x1f4)[_0x4e85('0xd')]({'message':_0x4e85('0x26')});}};exports['destroy']=function(_0x465662,_0x20c118){if(_0x465662[_0x4e85('0x1b')]['id']){delete _0x465662['body']['id'];}if(_0x465662['params']['id']){return pm2[_0x4e85('0x27')](_0x465662[_0x4e85('0x19')]['id'])[_0x4e85('0x12')](function(_0x2fb3fb){pm2['dump']();return _0x2fb3fb[0x0];})[_0x4e85('0x12')](respondWithResult(_0x20c118,null))['catch'](handleError(_0x20c118,null));}else{return _0x20c118['status'](0x1f4)['send']({'message':_0x4e85('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 07802bd..6595d67 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 _0x7cec=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x4b3813,_0x648f53){var _0x24008c=function(_0x25d126){while(--_0x25d126){_0x4b3813['push'](_0x4b3813['shift']());}};_0x24008c(++_0x648f53);}(_0x7cec,0x140));var _0xc7ce=function(_0xecb6a2,_0x478f20){_0xecb6a2=_0xecb6a2-0x0;var _0x3c43f9=_0x7cec[_0xecb6a2];return _0x3c43f9;};'use strict';var multer=require(_0xc7ce('0x0'));var util=require(_0xc7ce('0x1'));var path=require('path');var timeout=require(_0xc7ce('0x2'));var express=require(_0xc7ce('0x3'));var router=express[_0xc7ce('0x4')]();var auth=require(_0xc7ce('0x5'));var interaction=require(_0xc7ce('0x6'));var config=require(_0xc7ce('0x7'));module[_0xc7ce('0x8')]=router; \ No newline at end of file +var _0x78b5=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x78b5,0x116));var _0x578b=function(_0x4b4cc4,_0x5d220){_0x4b4cc4=_0x4b4cc4-0x0;var _0x2a1d0b=_0x78b5[_0x4b4cc4];return _0x2a1d0b;};'use strict';var multer=require(_0x578b('0x0'));var util=require(_0x578b('0x1'));var path=require(_0x578b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x578b('0x3')]();var auth=require(_0x578b('0x4'));var interaction=require(_0x578b('0x5'));var config=require(_0x578b('0x6'));module[_0x578b('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 d1bbb3c..e250de5 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 _0xf966=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x5adeea,_0x5a7061){var _0x1b9f50=function(_0x521a13){while(--_0x521a13){_0x5adeea['push'](_0x5adeea['shift']());}};_0x1b9f50(++_0x5a7061);}(_0xf966,0x196));var _0x6f96=function(_0x1925a7,_0x46dd8e){_0x1925a7=_0x1925a7-0x0;var _0x39202d=_0xf966[_0x1925a7];return _0x39202d;};'use strict';var Sequelize=require(_0x6f96('0x0'));module[_0x6f96('0x1')]={'state':{'type':Sequelize[_0x6f96('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6f96('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x6f96('0x3')]},'starttime':{'type':Sequelize[_0x6f96('0x4')]},'responsetime':{'type':Sequelize[_0x6f96('0x4')]},'ringtime':{'type':Sequelize[_0x6f96('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6f96('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6f96('0x3')]}}; \ No newline at end of file +var _0x6f24=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0x6f24,0x1dd));var _0x46f2=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x6f24[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x46f2('0x0'));module[_0x46f2('0x1')]={'state':{'type':Sequelize[_0x46f2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x46f2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x46f2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x46f2('0x4')]},'ringtime':{'type':Sequelize[_0x46f2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x46f2('0x3')]},'membername':{'type':Sequelize[_0x46f2('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4ef204d..a786c96 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 _0x9431=['moment','bluebird','request-promise','path','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api'];(function(_0x2cd684,_0x48d8ce){var _0x53ad6e=function(_0x236333){while(--_0x236333){_0x2cd684['push'](_0x2cd684['shift']());}};_0x53ad6e(++_0x48d8ce);}(_0x9431,0x105));var _0x1943=function(_0xf7a147,_0x1fae25){_0xf7a147=_0xf7a147-0x0;var _0x4937c3=_0x9431[_0xf7a147];return _0x4937c3;};'use strict';var _=require(_0x1943('0x0'));var util=require('util');var logger=require(_0x1943('0x1'))(_0x1943('0x2'));var moment=require(_0x1943('0x3'));var BPromise=require(_0x1943('0x4'));var rp=require(_0x1943('0x5'));var fs=require('fs');var path=require(_0x1943('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1943('0x7'));module[_0x1943('0x8')]=function(_0x14b467,_0x1a8999){return _0x14b467[_0x1943('0x9')](_0x1943('0xa'),attributes,{'tableName':_0x1943('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x384c=['./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5a8164,_0x4d4154){var _0x185423=function(_0x56b55b){while(--_0x56b55b){_0x5a8164['push'](_0x5a8164['shift']());}};_0x185423(++_0x4d4154);}(_0x384c,0x72));var _0xc384=function(_0x449f13,_0x2e5654){_0x449f13=_0x449f13-0x0;var _0x19f173=_0x384c[_0x449f13];return _0x19f173;};'use strict';var _=require(_0xc384('0x0'));var util=require(_0xc384('0x1'));var logger=require('../../config/logger')(_0xc384('0x2'));var moment=require(_0xc384('0x3'));var BPromise=require('bluebird');var rp=require(_0xc384('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc384('0x5'));var config=require(_0xc384('0x6'));var attributes=require(_0xc384('0x7'));module[_0xc384('0x8')]=function(_0x3bac81,_0x567827){return _0x3bac81['define'](_0xc384('0x9'),attributes,{'tableName':_0xc384('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index ba4559c..cd6da81 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 _0xb6ae=['info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','then'];(function(_0x18d8a1,_0xe60295){var _0x52e184=function(_0x49eb54){while(--_0x49eb54){_0x18d8a1['push'](_0x18d8a1['shift']());}};_0x52e184(++_0xe60295);}(_0xb6ae,0x92));var _0xeb6a=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xb6ae[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0xeb6a('0x0'));var util=require(_0xeb6a('0x1'));var moment=require(_0xeb6a('0x2'));var BPromise=require(_0xeb6a('0x3'));var rs=require(_0xeb6a('0x4'));var fs=require('fs');var Redis=require(_0xeb6a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xeb6a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeb6a('0x7')][_0xeb6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x299c00,_0x4467e2,_0x3b4c5d){return new BPromise(function(_0x4e77ce,_0x1bf272){return client['request'](_0x299c00,_0x3b4c5d)[_0xeb6a('0x9')](function(_0x3f8905){logger[_0xeb6a('0xa')](_0xeb6a('0xb'),_0x4467e2,_0xeb6a('0xc'));logger[_0xeb6a('0xd')](_0xeb6a('0xe'),_0x4467e2,'request\x20sent',JSON[_0xeb6a('0xf')](_0x3f8905));if(_0x3f8905[_0xeb6a('0x10')]){if(_0x3f8905[_0xeb6a('0x10')][_0xeb6a('0x11')]===0x1f4){logger['error'](_0xeb6a('0xb'),_0x4467e2,_0x3f8905[_0xeb6a('0x10')]['message']);return _0x1bf272(_0x3f8905[_0xeb6a('0x10')][_0xeb6a('0x12')]);}logger[_0xeb6a('0x10')](_0xeb6a('0xb'),_0x4467e2,_0x3f8905[_0xeb6a('0x10')][_0xeb6a('0x12')]);return _0x4e77ce(_0x3f8905[_0xeb6a('0x10')][_0xeb6a('0x12')]);}else{logger[_0xeb6a('0xa')](_0xeb6a('0xb'),_0x4467e2,_0xeb6a('0xc'));_0x4e77ce(_0x3f8905['result'][_0xeb6a('0x12')]);}})[_0xeb6a('0x13')](function(_0x1e16a9){logger[_0xeb6a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x4467e2,_0x1e16a9);_0x1bf272(_0x1e16a9);});});}exports['CreateReportAgentPreview']=function(_0x2ec258){var _0xe5b324=this;return new Promise(function(_0x9d54d3,_0x4961e2){return db[_0xeb6a('0x14')][_0xeb6a('0x15')](_0x2ec258[_0xeb6a('0x16')],{'raw':_0x2ec258['options']?_0x2ec258[_0xeb6a('0x17')][_0xeb6a('0x18')]===undefined?!![]:![]:!![]})[_0xeb6a('0x9')](function(_0x4cacab){logger[_0xeb6a('0xa')]('CreateReportAgentPreview',_0x2ec258);logger['debug'](_0xeb6a('0x19'),_0x2ec258,JSON[_0xeb6a('0xf')](_0x4cacab));_0x9d54d3(_0x4cacab);})[_0xeb6a('0x13')](function(_0x11ff7f){logger[_0xeb6a('0x10')]('CreateReportAgentPreview',_0x11ff7f[_0xeb6a('0x12')],_0x2ec258);_0x4961e2(_0xe5b324[_0xeb6a('0x10')](0x1f4,_0x11ff7f[_0xeb6a('0x12')]));});});}; \ No newline at end of file +var _0x4864=['body','options','CreateReportAgentPreview','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview'];(function(_0x246db6,_0x322afe){var _0x1e32cd=function(_0x161526){while(--_0x161526){_0x246db6['push'](_0x246db6['shift']());}};_0x1e32cd(++_0x322afe);}(_0x4864,0x112));var _0x4486=function(_0x207d4e,_0x5158dc){_0x207d4e=_0x207d4e-0x0;var _0x24b6f4=_0x4864[_0x207d4e];return _0x24b6f4;};'use strict';var _=require(_0x4486('0x0'));var util=require(_0x4486('0x1'));var moment=require(_0x4486('0x2'));var BPromise=require(_0x4486('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4486('0x4'));var db=require(_0x4486('0x5'))['db'];var utils=require(_0x4486('0x6'));var logger=require(_0x4486('0x7'))(_0x4486('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4486('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x131291,_0x34641e,_0x3459bc){return new BPromise(function(_0x20c3cb,_0x330364){return client[_0x4486('0xa')](_0x131291,_0x3459bc)[_0x4486('0xb')](function(_0x5479a4){logger[_0x4486('0xc')](_0x4486('0xd'),_0x34641e,_0x4486('0xe'));logger['debug'](_0x4486('0xf'),_0x34641e,_0x4486('0xe'),JSON[_0x4486('0x10')](_0x5479a4));if(_0x5479a4['error']){if(_0x5479a4[_0x4486('0x11')][_0x4486('0x12')]===0x1f4){logger[_0x4486('0x11')](_0x4486('0xd'),_0x34641e,_0x5479a4[_0x4486('0x11')][_0x4486('0x13')]);return _0x330364(_0x5479a4[_0x4486('0x11')][_0x4486('0x13')]);}logger[_0x4486('0x11')](_0x4486('0xd'),_0x34641e,_0x5479a4[_0x4486('0x11')][_0x4486('0x13')]);return _0x20c3cb(_0x5479a4[_0x4486('0x11')][_0x4486('0x13')]);}else{logger[_0x4486('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x34641e,'request\x20sent');_0x20c3cb(_0x5479a4[_0x4486('0x14')]['message']);}})[_0x4486('0x15')](function(_0x450eb0){logger['error'](_0x4486('0xd'),_0x34641e,_0x450eb0);_0x330364(_0x450eb0);});});}exports['CreateReportAgentPreview']=function(_0xcaa2ad){var _0x4a7a15=this;return new Promise(function(_0x840f6d,_0xb1f58d){return db[_0x4486('0x16')]['create'](_0xcaa2ad[_0x4486('0x17')],{'raw':_0xcaa2ad[_0x4486('0x18')]?_0xcaa2ad[_0x4486('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1fff4f){logger[_0x4486('0xc')](_0x4486('0x19'),_0xcaa2ad);logger[_0x4486('0x1a')](_0x4486('0x19'),_0xcaa2ad,JSON[_0x4486('0x10')](_0x1fff4f));_0x840f6d(_0x1fff4f);})[_0x4486('0x15')](function(_0x1391c6){logger['error'](_0x4486('0x19'),_0x1391c6[_0x4486('0x13')],_0xcaa2ad);_0xb1f58d(_0x4a7a15[_0x4486('0x11')](0x1f4,_0x1391c6[_0x4486('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8d21e18..6ab99ba 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 _0xed4a=['/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xed4a,0x1d1));var _0xaed4=function(_0xf48b1e,_0xd1673a){_0xf48b1e=_0xf48b1e-0x0;var _0x50b98f=_0xed4a[_0xf48b1e];return _0x50b98f;};'use strict';var multer=require(_0xaed4('0x0'));var util=require(_0xaed4('0x1'));var path=require('path');var express=require('express');var router=express[_0xaed4('0x2')]();var auth=require(_0xaed4('0x3'));var controller=require(_0xaed4('0x4'));router[_0xaed4('0x5')]('/voice/channels',auth[_0xaed4('0x6')](),controller[_0xaed4('0x7')]);router[_0xaed4('0x5')](_0xaed4('0x8'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x9')]);router[_0xaed4('0x5')](_0xaed4('0xa'),auth[_0xaed4('0x6')](),controller[_0xaed4('0xb')]);router[_0xaed4('0x5')](_0xaed4('0xc'),auth[_0xaed4('0x6')](),controller[_0xaed4('0xd')]);router[_0xaed4('0x5')](_0xaed4('0xe'),auth[_0xaed4('0x6')](),controller[_0xaed4('0xf')]);router[_0xaed4('0x5')]('/mail/queues',auth[_0xaed4('0x6')](),controller['mailQueues']);router['get']('/mail/accounts',auth[_0xaed4('0x6')](),controller['mailAccounts']);router[_0xaed4('0x5')](_0xaed4('0x10'),auth['isAuthenticated'](),controller[_0xaed4('0x11')]);router[_0xaed4('0x5')](_0xaed4('0x12'),auth['isAuthenticated'](),controller[_0xaed4('0x13')]);router['get'](_0xaed4('0x14'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x15')]);router[_0xaed4('0x5')](_0xaed4('0x16'),auth['isAuthenticated'](),controller[_0xaed4('0x17')]);router[_0xaed4('0x5')](_0xaed4('0x18'),auth[_0xaed4('0x6')](),controller['voiceQueuesPreview']);router['get'](_0xaed4('0x19'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x1a')]);router[_0xaed4('0x5')](_0xaed4('0x1b'),auth['isAuthenticated'](),controller[_0xaed4('0x1c')]);router[_0xaed4('0x5')](_0xaed4('0x1d'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x1e')]);router[_0xaed4('0x5')](_0xaed4('0x1f'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x20')]);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xaed4('0x5')](_0xaed4('0x21'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x22')]);router[_0xaed4('0x5')](_0xaed4('0x23'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x24')]);router[_0xaed4('0x5')]('/agents',auth[_0xaed4('0x6')](),controller[_0xaed4('0x25')]);router[_0xaed4('0x26')](_0xaed4('0x27'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x28')]);router[_0xaed4('0x5')](_0xaed4('0x29'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x2a')]);router[_0xaed4('0x5')](_0xaed4('0x2b'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x2c')]);router['get'](_0xaed4('0x2d'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x2e')]);router[_0xaed4('0x5')](_0xaed4('0x2f'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x30')]);router['get'](_0xaed4('0x31'),auth['isAuthenticated'](),controller[_0xaed4('0x32')]);router['get']('/mail/queues/waitinginteractions',auth[_0xaed4('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xaed4('0x5')](_0xaed4('0x33'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x34')]);router[_0xaed4('0x5')](_0xaed4('0x35'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x36')]);router['get'](_0xaed4('0x37'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x38')]);router[_0xaed4('0x5')](_0xaed4('0x39'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x3a')]);router[_0xaed4('0x5')]('/fax/queues/waitinginteractions',auth[_0xaed4('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0xaed4('0x3b')](_0xaed4('0x3c'),auth[_0xaed4('0x6')](),controller['queueNotify']('mail'));router[_0xaed4('0x5')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0xaed4('0x3d')]);router['post'](_0xaed4('0x3e'),auth['isAuthenticated'](),controller[_0xaed4('0x3f')](_0xaed4('0x40')));router[_0xaed4('0x5')](_0xaed4('0x41'),auth['isAuthenticated'](),controller[_0xaed4('0x42')]);router[_0xaed4('0x3b')](_0xaed4('0x43'),auth[_0xaed4('0x6')](),controller['queueNotify'](_0xaed4('0x44')));router[_0xaed4('0x5')]('/fax/queues/:id',auth[_0xaed4('0x6')](),controller[_0xaed4('0x45')]);router[_0xaed4('0x3b')](_0xaed4('0x46'),auth[_0xaed4('0x6')](),controller['queueNotify'](_0xaed4('0x47')));router[_0xaed4('0x5')](_0xaed4('0x48'),auth[_0xaed4('0x6')](),controller['showOpenchannelQueues']);router['post'](_0xaed4('0x49'),auth['isAuthenticated'](),controller[_0xaed4('0x3f')]('sms'));router[_0xaed4('0x3b')](_0xaed4('0x4a'),auth['isAuthenticated'](),controller[_0xaed4('0x3f')](_0xaed4('0x4b')));router[_0xaed4('0x5')](_0xaed4('0x4c'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x4d')]);router['get'](_0xaed4('0x4e'),auth[_0xaed4('0x6')](),controller[_0xaed4('0x4f')]);router['post'](_0xaed4('0x50'),auth[_0xaed4('0x6')](),controller['agentNotify']);module[_0xaed4('0x51')]=router; \ No newline at end of file +var _0x1a50=['trunks','/campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','/telephones','/trunks'];(function(_0x289842,_0x2d9db4){var _0x16155a=function(_0x1d0510){while(--_0x1d0510){_0x289842['push'](_0x289842['shift']());}};_0x16155a(++_0x2d9db4);}(_0x1a50,0x68));var _0x01a5=function(_0x3642e7,_0x16358e){_0x3642e7=_0x3642e7-0x0;var _0x31e3dd=_0x1a50[_0x3642e7];return _0x31e3dd;};'use strict';var multer=require(_0x01a5('0x0'));var util=require(_0x01a5('0x1'));var path=require('path');var express=require(_0x01a5('0x2'));var router=express[_0x01a5('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x01a5('0x4'));router[_0x01a5('0x5')](_0x01a5('0x6'),auth[_0x01a5('0x7')](),controller['voiceChannels']);router[_0x01a5('0x5')](_0x01a5('0x8'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x9')]);router[_0x01a5('0x5')](_0x01a5('0xa'),auth['isAuthenticated'](),controller[_0x01a5('0xb')]);router[_0x01a5('0x5')](_0x01a5('0xc'),auth[_0x01a5('0x7')](),controller['voiceQueues']);router[_0x01a5('0x5')](_0x01a5('0xd'),auth['isAuthenticated'](),controller[_0x01a5('0xe')]);router[_0x01a5('0x5')](_0x01a5('0xf'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x10')]);router['get'](_0x01a5('0x11'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x12')]);router[_0x01a5('0x5')](_0x01a5('0x13'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x14')]);router[_0x01a5('0x5')]('/sms/queues',auth[_0x01a5('0x7')](),controller['smsQueues']);router['get']('/whatsapp/queues',auth[_0x01a5('0x7')](),controller[_0x01a5('0x15')]);router[_0x01a5('0x5')]('/fax/queues',auth[_0x01a5('0x7')](),controller[_0x01a5('0x16')]);router[_0x01a5('0x5')](_0x01a5('0x17'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x18')]);router[_0x01a5('0x5')]('/voice/queues/channels',auth[_0x01a5('0x7')](),controller['voiceQueuesChannels']);router[_0x01a5('0x5')](_0x01a5('0x19'),auth['isAuthenticated'](),controller[_0x01a5('0x1a')]);router[_0x01a5('0x5')](_0x01a5('0x1b'),auth[_0x01a5('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x01a5('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x01a5('0x7')](),controller[_0x01a5('0x1c')]);router[_0x01a5('0x5')](_0x01a5('0x1d'),auth[_0x01a5('0x7')](),controller['showVoiceQueues']);router[_0x01a5('0x5')](_0x01a5('0x1e'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x1f')]);router[_0x01a5('0x5')](_0x01a5('0x20'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x21')]);router[_0x01a5('0x5')]('/agents',auth['isAuthenticated'](),controller[_0x01a5('0x22')]);router['put'](_0x01a5('0x23'),auth[_0x01a5('0x7')](),controller['agentCapacity']);router['get'](_0x01a5('0x24'),auth[_0x01a5('0x7')](),controller['telephones']);router['get'](_0x01a5('0x25'),auth['isAuthenticated'](),controller[_0x01a5('0x26')]);router[_0x01a5('0x5')](_0x01a5('0x27'),auth[_0x01a5('0x7')](),controller['campaigns']);router[_0x01a5('0x5')]('/fax/accounts',auth[_0x01a5('0x7')](),controller[_0x01a5('0x28')]);router[_0x01a5('0x5')]('/chat/queues/waitinginteractions',auth[_0x01a5('0x7')](),controller[_0x01a5('0x29')]);router[_0x01a5('0x5')](_0x01a5('0x2a'),auth['isAuthenticated'](),controller[_0x01a5('0x2b')]);router[_0x01a5('0x5')](_0x01a5('0x2c'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x2d')]);router[_0x01a5('0x5')](_0x01a5('0x2e'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x2f')]);router[_0x01a5('0x5')](_0x01a5('0x30'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x31')]);router[_0x01a5('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x01a5('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x01a5('0x5')](_0x01a5('0x32'),auth[_0x01a5('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x01a5('0x33')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x01a5('0x34')));router[_0x01a5('0x5')](_0x01a5('0x35'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x01a5('0x33')](_0x01a5('0x36'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x37')]('chat'));router[_0x01a5('0x5')](_0x01a5('0x38'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x39')]);router['post'](_0x01a5('0x3a'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x37')](_0x01a5('0x3b')));router[_0x01a5('0x5')](_0x01a5('0x3c'),auth[_0x01a5('0x7')](),controller['showFaxQueues']);router[_0x01a5('0x33')](_0x01a5('0x3d'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x37')](_0x01a5('0x3e')));router[_0x01a5('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x01a5('0x3f')]);router[_0x01a5('0x33')](_0x01a5('0x40'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x37')]('sms'));router['post'](_0x01a5('0x41'),auth[_0x01a5('0x7')](),controller[_0x01a5('0x37')](_0x01a5('0x42')));router[_0x01a5('0x5')](_0x01a5('0x43'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x01a5('0x5')](_0x01a5('0x44'),auth['isAuthenticated'](),controller[_0x01a5('0x45')]);router[_0x01a5('0x33')]('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module[_0x01a5('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 d1a8348..e3a0af9 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 _0x1767=['VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','INTERACTION','interface','SIP/%s','internal','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','uniq','value','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','User','agent','Agent\x20not\x20found','agentTransferTimeout','bluebird','moment','jayson/promise','http','client','request','then','error','code','json','stack','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels'];(function(_0x2526af,_0x565c8b){var _0x583584=function(_0x44994a){while(--_0x44994a){_0x2526af['push'](_0x2526af['shift']());}};_0x583584(++_0x565c8b);}(_0x1767,0x14f));var _0x7176=function(_0x314cdb,_0x39595c){_0x314cdb=_0x314cdb-0x0;var _0x586c99=_0x1767[_0x314cdb];return _0x586c99;};'use strict';var BPromise=require(_0x7176('0x0'));var moment=require(_0x7176('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x7176('0x2'));var amiClient=jayson['client'][_0x7176('0x3')]({'port':0x232a});var mailClient=jayson[_0x7176('0x4')]['http']({'port':0x232b});var routingClient=jayson[_0x7176('0x4')][_0x7176('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x4a3cdc,_0x32b01f,_0x3aa828){return new BPromise(function(_0x45ed75,_0x300ad0){var _0x4bfd38=_0x3aa828?_0x3aa828:amiClient;return _0x4bfd38[_0x7176('0x5')](_0x4a3cdc,_0x32b01f)[_0x7176('0x6')](function(_0x36146e){if(_0x36146e[_0x7176('0x7')]){if(_0x36146e[_0x7176('0x7')][_0x7176('0x8')]===0x1f4){return _0x300ad0(_0x36146e[_0x7176('0x7')]['message']);}return _0x45ed75(_0x36146e[_0x7176('0x7')]['message']);}else{_0x45ed75(_0x36146e['result']);}})['catch'](function(_0x20ad8f){_0x300ad0(_0x20ad8f);});});}function respondWithResult(_0x5b3fab,_0x7821a9){_0x7821a9=_0x7821a9||0xc8;return function(_0x21bd20){if(_0x21bd20){return _0x5b3fab['status'](_0x7821a9)[_0x7176('0x9')](_0x21bd20);}return _0x5b3fab['sendStatus'](0x194);};}function handleError(_0x4ee1c7,_0xf5da8c){_0xf5da8c=_0xf5da8c||0x1f4;return function(_0x664228){logger['error'](_0x664228[_0x7176('0xa')]);if(_0x664228[_0x7176('0xb')]){delete _0x664228[_0x7176('0xb')];}_0x4ee1c7[_0x7176('0xc')](_0xf5da8c)[_0x7176('0xd')](_0x664228);};}function findById(_0x1158fc){return function(_0x23ba22){if(!_[_0x7176('0xe')](_0x1158fc)&&!_[_0x7176('0xe')](_0x23ba22)&&!_[_0x7176('0xe')](_0x23ba22[_0x7176('0xf')])){return _[_0x7176('0x10')](_0x23ba22[_0x7176('0xf')],function(_0x46ba2b){return _0x46ba2b['id']==_0x1158fc;});}return null;};}exports[_0x7176('0x11')]=function(_0x15388e,_0x34d2b3){return respondWithRpcPromise(_0x7176('0x12'),_0x15388e['query'])[_0x7176('0x6')](respondWithResult(_0x34d2b3,null))[_0x7176('0x13')](handleError(_0x34d2b3,null));};exports[_0x7176('0x14')]=function(_0x1517d7,_0x539d79){return respondWithRpcPromise(_0x7176('0x15'),_[_0x7176('0x16')](_0x1517d7[_0x7176('0x17')],_0x1517d7['params']))[_0x7176('0x6')](respondWithResult(_0x539d79,null))[_0x7176('0x13')](handleError(_0x539d79,null));};exports[_0x7176('0x18')]=function(_0x102cfc,_0x36a2d3){return respondWithRpcPromise(_0x7176('0x19'),_[_0x7176('0x16')](_0x102cfc[_0x7176('0x17')],_0x102cfc[_0x7176('0x1a')]))[_0x7176('0x6')](respondWithResult(_0x36a2d3,null))[_0x7176('0x13')](handleError(_0x36a2d3,null));};exports['voiceQueues']=function(_0x17edb8,_0x3b731b){return respondWithRpcPromise(_0x7176('0x1b'),_0x17edb8[_0x7176('0x17')])[_0x7176('0x6')](respondWithResult(_0x3b731b,null))['catch'](handleError(_0x3b731b,null));};exports['showVoiceQueues']=function(_0x2125d4,_0x37691d){return respondWithRpcPromise(_0x7176('0x1b'),_0x2125d4[_0x7176('0x17')])[_0x7176('0x6')](findById(_0x2125d4[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0x37691d,null))[_0x7176('0x13')](handleError(_0x37691d,null));};exports['voiceQueuesPreview']=function(_0x3937f1,_0x197496){return respondWithRpcPromise(_0x7176('0x1c'),_[_0x7176('0x16')](_0x3937f1[_0x7176('0x17')],_0x3937f1[_0x7176('0x1a')]))[_0x7176('0x6')](respondWithResult(_0x197496,null))[_0x7176('0x13')](handleError(_0x197496,null));};exports[_0x7176('0x1d')]=function(_0x100fed,_0x2a4c55){return respondWithRpcPromise(_0x7176('0x1e'),_0x100fed[_0x7176('0x17')])[_0x7176('0x6')](respondWithResult(_0x2a4c55,null))[_0x7176('0x13')](handleError(_0x2a4c55,null));};exports['voiceQueuesChannel']=function(_0x490d40,_0x54427e){return respondWithRpcPromise(_0x7176('0x1f'),_['merge'](_0x490d40[_0x7176('0x17')],_0x490d40[_0x7176('0x1a')]))['then'](respondWithResult(_0x54427e,null))[_0x7176('0x13')](handleError(_0x54427e,null));};exports['voiceQueuesChannelHangup']=function(_0x4428a9,_0x42db1f){return respondWithRpcPromise(_0x7176('0x20'),_['merge'](_0x4428a9[_0x7176('0x17')],_0x4428a9[_0x7176('0x1a')]))[_0x7176('0x6')](respondWithResult(_0x42db1f,null))[_0x7176('0x13')](handleError(_0x42db1f,null));};exports[_0x7176('0x21')]=function(_0x3f3536,_0x4d3c85){return respondWithRpcPromise(_0x7176('0x22'),_[_0x7176('0x16')](_0x3f3536['query'],_0x3f3536[_0x7176('0x1a')]))['then'](respondWithResult(_0x4d3c85,null))[_0x7176('0x13')](handleError(_0x4d3c85,null));};exports[_0x7176('0x23')]=function(_0x4acd06,_0x59b707){return respondWithRpcPromise(_0x7176('0x24'),_0x4acd06[_0x7176('0x17')])[_0x7176('0x6')](respondWithResult(_0x59b707,null))[_0x7176('0x13')](handleError(_0x59b707,null));};exports[_0x7176('0x25')]=function(_0x50d231,_0x450aee){return respondWithRpcPromise(_0x7176('0x26'),_0x50d231[_0x7176('0x17')])[_0x7176('0x6')](respondWithResult(_0x450aee,null))[_0x7176('0x13')](handleError(_0x450aee,null));};exports[_0x7176('0x27')]=function(_0x253356,_0x3ca415){var _0x342e69;return respondWithRpcPromise(_0x7176('0x28'),_0x253356[_0x7176('0x17')])[_0x7176('0x6')](function(_0x2d2155){_0x342e69=_0x2d2155;return respondWithRpcPromise(_0x7176('0x28'),_0x253356[_0x7176('0x17')],routingClient);})[_0x7176('0x6')](function(_0x854a1d){return _[_0x7176('0x16')]({},_0x854a1d,_0x342e69);})[_0x7176('0x6')](respondWithResult(_0x3ca415,null))['catch'](handleError(_0x3ca415,null));};exports[_0x7176('0x29')]=function(_0x251347,_0x115708){if(_0x251347[_0x7176('0x2a')]&&_0x251347[_0x7176('0x2a')][_0x7176('0x2b')]&&_0x251347[_0x7176('0x2c')]&&_0x251347[_0x7176('0x2c')][_0x7176('0xb')]){for(var _0xfa36c2 in _0x251347['body']['interaction']){if(_0x251347[_0x7176('0x2a')][_0x7176('0x2b')][_0x7176('0x2d')](_0xfa36c2)){db['MemberReport']['findAll']({'where':{'channel':_0xfa36c2,'membername':_0x251347[_0x7176('0x2c')][_0x7176('0xb')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x251347['body'][_0x7176('0x2b')][_0xfa36c2]&&_0x251347[_0x7176('0x2a')]['interaction'][_0xfa36c2][_0x7176('0x2e')]?{'$notIn':_0x251347[_0x7176('0x2a')][_0x7176('0x2b')][_0xfa36c2]}:{'$ne':null}}})[_0x7176('0x6')](function(_0x32e5ea){var _0x5d1bb7=moment()[_0x7176('0x2f')](_0x7176('0x30'));for(var _0x2474d1=0x0,_0x1ffe77=_0x32e5ea[_0x7176('0x2e')];_0x2474d1<_0x1ffe77;_0x2474d1+=0x1){_0x32e5ea[_0x2474d1][_0x7176('0x31')]({'exitAt':_0x5d1bb7});}});for(var _0xb99057=0x0;_0xb99057<_0x251347[_0x7176('0x2a')][_0x7176('0x2b')][_0xfa36c2]['length'];_0xb99057+=0x1){db[_0x7176('0x32')]['findOrCreate']({'where':{'channel':_0xfa36c2,'membername':_0x251347['user'][_0x7176('0xb')],'type':_0x7176('0x33'),'uniqueid':_0x251347['body']['interaction'][_0xfa36c2][_0xb99057],'exitAt':null},'defaults':{'channel':_0xfa36c2,'membername':_0x251347[_0x7176('0x2c')][_0x7176('0xb')],'interface':_['isNil'](_0x251347[_0x7176('0x2c')][_0x7176('0x34')])?util['format'](_0x7176('0x35'),_0x251347[_0x7176('0x2c')]['name']):_0x251347['user'][_0x7176('0x34')],'type':'INTERACTION','enterAt':moment()[_0x7176('0x2f')](_0x7176('0x30')),'role':'agent','internal':_0x251347[_0x7176('0x2c')][_0x7176('0x36')],'uniqueid':_0x251347['body'][_0x7176('0x2b')][_0xfa36c2][_0xb99057]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x251347[_0x7176('0x1a')]['id'],'capacity':_0x251347[_0x7176('0x2a')][_0x7176('0x37')]},routingClient)['then'](respondWithResult(_0x115708,null))[_0x7176('0x13')](handleError(_0x115708,null));};exports[_0x7176('0x38')]=function(_0x5af025,_0x1dd82e){return respondWithRpcPromise(_0x7176('0x39'),_0x5af025['query'])[_0x7176('0x6')](respondWithResult(_0x1dd82e,null))[_0x7176('0x13')](handleError(_0x1dd82e,null));};exports[_0x7176('0x3a')]=function(_0x5a580b,_0x4ae38e){return respondWithRpcPromise(_0x7176('0x3b'),_0x5a580b['query'])['then'](respondWithResult(_0x4ae38e,null))['catch'](handleError(_0x4ae38e,null));};exports['campaigns']=function(_0xcdbbff,_0x286645){return respondWithRpcPromise(_0x7176('0x3c'),_0xcdbbff['query'])[_0x7176('0x6')](respondWithResult(_0x286645,null))[_0x7176('0x13')](handleError(_0x286645,null));};exports[_0x7176('0x3d')]=function(_0x24736c,_0x5d6889){return respondWithRpcPromise(_0x7176('0x3e'),_0x24736c[_0x7176('0x17')],routingClient)['then'](respondWithResult(_0x5d6889,null))['catch'](handleError(_0x5d6889,null));};exports[_0x7176('0x3f')]=function(_0x109428,_0xa86c5e){return respondWithRpcPromise(_0x7176('0x3e'),_0x109428['query'],routingClient)[_0x7176('0x6')](findById(_0x109428[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0xa86c5e,null))['catch'](handleError(_0xa86c5e,null));};exports['mailQueues']=function(_0x472167,_0x19f8c4){return respondWithRpcPromise(_0x7176('0x40'),_0x472167[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x19f8c4,null))[_0x7176('0x13')](handleError(_0x19f8c4,null));};exports[_0x7176('0x41')]=function(_0x593e52,_0x2bab47){return respondWithRpcPromise(_0x7176('0x40'),_0x593e52[_0x7176('0x17')],routingClient)['then'](findById(_0x593e52[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0x2bab47,null))[_0x7176('0x13')](handleError(_0x2bab47,null));};exports['mailAccounts']=function(_0x323b46,_0xb18426){return respondWithRpcPromise(_0x7176('0x42'),_0x323b46['query'],mailClient)[_0x7176('0x6')](respondWithResult(_0xb18426,null))[_0x7176('0x13')](handleError(_0xb18426,null));};exports[_0x7176('0x43')]=function(_0x1ecbd8,_0x5a3073){return respondWithRpcPromise(_0x7176('0x44'),_0x1ecbd8[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x5a3073,null))['catch'](handleError(_0x5a3073,null));};exports['showOpenchannelQueues']=function(_0x13904b,_0x3be92c){return respondWithRpcPromise('OpenchannelQueues',_0x13904b[_0x7176('0x17')],routingClient)[_0x7176('0x6')](findById(_0x13904b[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0x3be92c,null))[_0x7176('0x13')](handleError(_0x3be92c,null));};exports['smsQueues']=function(_0x58b6bb,_0x21be95){return respondWithRpcPromise('SmsQueues',_0x58b6bb[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x21be95,null))['catch'](handleError(_0x21be95,null));};exports[_0x7176('0x45')]=function(_0x2185ee,_0x45ca36){return respondWithRpcPromise(_0x7176('0x46'),_0x2185ee[_0x7176('0x17')],routingClient)[_0x7176('0x6')](findById(_0x2185ee[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0x45ca36,null))[_0x7176('0x13')](handleError(_0x45ca36,null));};exports[_0x7176('0x47')]=function(_0x30cb31,_0x1a3aef){return respondWithRpcPromise(_0x7176('0x48'),_0x30cb31['query'],routingClient)['then'](respondWithResult(_0x1a3aef,null))[_0x7176('0x13')](handleError(_0x1a3aef,null));};exports['showWhatsappQueues']=function(_0x5df745,_0x13ecc3){return respondWithRpcPromise(_0x7176('0x48'),_0x5df745[_0x7176('0x17')],routingClient)[_0x7176('0x6')](findById(_0x5df745[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0x13ecc3,null))[_0x7176('0x13')](handleError(_0x13ecc3,null));};exports['faxQueues']=function(_0xef2791,_0x5954e0){return respondWithRpcPromise(_0x7176('0x49'),_0xef2791[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x5954e0,null))[_0x7176('0x13')](handleError(_0x5954e0,null));};exports['showFaxQueues']=function(_0x3c6d1f,_0x1d91bf){return respondWithRpcPromise('FaxQueues',_0x3c6d1f['query'],routingClient)[_0x7176('0x6')](findById(_0x3c6d1f[_0x7176('0x1a')]['id']))[_0x7176('0x6')](respondWithResult(_0x1d91bf,null))['catch'](handleError(_0x1d91bf,null));};exports[_0x7176('0x4a')]=function(_0x4ed0fb,_0x20ea02){return respondWithRpcPromise('FaxAccounts',_0x4ed0fb['query'])[_0x7176('0x6')](respondWithResult(_0x20ea02,null))['catch'](handleError(_0x20ea02,null));};exports[_0x7176('0x4b')]=function(_0x581e2c,_0x12565d){return respondWithRpcPromise(_0x7176('0x4c'),_0x581e2c[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x12565d,null))[_0x7176('0x13')](handleError(_0x12565d,null));};exports[_0x7176('0x4d')]=function(_0x3316c0,_0x4d5a6f){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x3316c0[_0x7176('0x17')],routingClient)['then'](respondWithResult(_0x4d5a6f,null))['catch'](handleError(_0x4d5a6f,null));};exports[_0x7176('0x4e')]=function(_0x4250a0,_0x465f81){return respondWithRpcPromise(_0x7176('0x4f'),_0x4250a0[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x465f81,null))[_0x7176('0x13')](handleError(_0x465f81,null));};exports[_0x7176('0x50')]=function(_0x49ce46,_0x571747){return respondWithRpcPromise(_0x7176('0x4f'),_0x49ce46[_0x7176('0x17')],routingClient)[_0x7176('0x6')](function(_0x42b185){if(_0x49ce46[_0x7176('0x17')][_0x7176('0x51')]!==undefined){var _0x263205=_(_0x42b185[_0x7176('0xf')])[_0x7176('0x52')]([_0x49ce46['query'][_0x7176('0x51')],_0x49ce46['params']['id']])[_0x7176('0x53')]('queue_id')[_0x7176('0x54')]()[_0x7176('0x55')]();return _0x42b185[_0x7176('0xf')]['filter'](function(_0x4f06b8){return _0x263205['indexOf'](_0x4f06b8[_0x7176('0x56')])>-0x1;});}else{return _0x42b185[_0x7176('0xf')]['filter'](function(_0x553d1d){return _0x553d1d[_0x7176('0x56')]===parseInt(_0x49ce46[_0x7176('0x1a')]['id']);});}})[_0x7176('0x6')](respondWithResult(_0x571747,null))[_0x7176('0x13')](handleError(_0x571747,null));};exports['smsQueuesWaitingInteractions']=function(_0x3e921e,_0x2163b7){return respondWithRpcPromise(_0x7176('0x57'),_0x3e921e[_0x7176('0x17')],routingClient)['then'](respondWithResult(_0x2163b7,null))[_0x7176('0x13')](handleError(_0x2163b7,null));};exports[_0x7176('0x58')]=function(_0x2e352b,_0x37f332){return respondWithRpcPromise(_0x7176('0x59'),_0x2e352b[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0x37f332,null))['catch'](handleError(_0x37f332,null));};exports[_0x7176('0x5a')]=function(_0x27a248,_0xbe127e){return respondWithRpcPromise(_0x7176('0x5b'),_0x27a248[_0x7176('0x17')],routingClient)[_0x7176('0x6')](respondWithResult(_0xbe127e,null))['catch'](handleError(_0xbe127e,null));};exports[_0x7176('0x5c')]=function(_0x4e9653){return function(_0x4e1f24,_0x4d4d68){var _0x51142d,_0x190c32;var _0x57e862=_[_0x7176('0x5d')](_0x4e9653);var _0x222351=_0x4e9653==='chat'?_0x7176('0x5e'):_0x7176('0x5f');return db[_0x57e862+_0x7176('0x60')][_0x7176('0x61')]({'raw':!![],'where':{'id':_0x4e1f24[_0x7176('0x1a')]['id']}})[_0x7176('0x6')](function(_0x5b7971){if(_[_0x7176('0xe')](_0x5b7971)){throw new Error(_0x57e862+_0x7176('0x62'));}_0x51142d=_0x5b7971;return db[_0x57e862+_0x7176('0x63')][_0x7176('0x61')]({'where':{'id':_0x4e1f24[_0x7176('0x2a')][_0x7176('0x64')]},'include':[{'model':db[_0x57e862+_0x7176('0x65')],'as':_0x7176('0x65')},{'model':db[_0x57e862+_0x222351],'as':_0x7176('0x5f')}]});})[_0x7176('0x6')](function(_0x525e40){if(_[_0x7176('0xe')](_0x525e40)){throw new Error(_0x57e862+_0x7176('0x66'));}_0x190c32=_0x525e40;return _0x525e40[_0x7176('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7176('0x6')](function(){var _0x5cbf5c={'uniqueid':_0x4e9653+'.'+_0x190c32['id']+'.'+_0x190c32[_0x7176('0x65')]['id'],'FromUserId':_0x4e1f24['user']['id'],'type':_0x7176('0x68')};_0x5cbf5c[_0x57e862+_0x7176('0x69')]=_0x190c32['id'];_0x5cbf5c[_0x57e862+_0x7176('0x6a')]=_0x190c32[_0x7176('0x65')]['id'];_0x5cbf5c[_0x7176('0x6b')+_0x57e862+_0x222351+'Id']=_0x190c32['Account']['id'];_0x5cbf5c['To'+_0x57e862+_0x7176('0x6c')]=_0x51142d['id'];return db[_0x57e862+_0x7176('0x6d')][_0x7176('0x6e')](_0x5cbf5c);})[_0x7176('0x6')](function(){return respondWithRpcPromise(_0x7176('0x6f'),{'channel':_0x4e9653,'interaction':_0x190c32[_0x7176('0x65')],'message':_0x190c32,'account':_0x190c32[_0x7176('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7176('0x68'),'appdata':_0x51142d[_0x7176('0xb')]+','+(_0x190c32[_0x7176('0x5f')][_0x7176('0x70')]||0x12c),'interval':_0x7176('0x71')}]},routingClient);})[_0x7176('0x6')](respondWithResult(_0x4d4d68,null))[_0x7176('0x13')](handleError(_0x4d4d68,null));};};exports[_0x7176('0x72')]=function(_0x33631e,_0x41d255){var _0x38792f,_0x170231;if(_[_0x7176('0xe')](_0x33631e[_0x7176('0x2a')]['channel'])){throw new Error(_0x7176('0x73'));}var _0x435135=_0x33631e[_0x7176('0x2a')][_0x7176('0x74')];var _0x4dffeb=_[_0x7176('0x5d')](_0x435135);var _0x329d68=_0x435135===_0x7176('0x75')?'Website':_0x7176('0x5f');return db[_0x7176('0x76')][_0x7176('0x61')]({'raw':!![],'where':{'id':_0x33631e[_0x7176('0x1a')]['id'],'role':_0x7176('0x77')}})[_0x7176('0x6')](function(_0x160d5a){if(_[_0x7176('0xe')](_0x160d5a)){throw new Error(_0x7176('0x78'));}_0x38792f=_0x160d5a;return db[_0x4dffeb+'Message'][_0x7176('0x61')]({'where':{'id':_0x33631e[_0x7176('0x2a')]['messageId']},'include':[{'model':db[_0x4dffeb+_0x7176('0x65')],'as':_0x7176('0x65')},{'model':db[_0x4dffeb+_0x329d68],'as':_0x7176('0x5f')}]});})[_0x7176('0x6')](function(_0x246189){if(_[_0x7176('0xe')](_0x246189)){throw new Error(_0x4dffeb+'\x20Message\x20not\x20found');}_0x170231=_0x246189;return _0x246189[_0x7176('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7176('0x6')](function(){var _0x24a2e9={'uniqueid':_0x435135+'.'+_0x170231['id']+'.'+_0x170231['Interaction']['id'],'FromUserId':_0x33631e[_0x7176('0x2c')]['id'],'type':_0x7176('0x68'),'ToUserId':_0x38792f['id']};_0x24a2e9[_0x4dffeb+_0x7176('0x69')]=_0x170231['id'];_0x24a2e9[_0x4dffeb+_0x7176('0x6a')]=_0x170231[_0x7176('0x65')]['id'];_0x24a2e9['From'+_0x4dffeb+_0x329d68+'Id']=_0x170231[_0x7176('0x5f')]['id'];return db[_0x4dffeb+_0x7176('0x6d')][_0x7176('0x6e')](_0x24a2e9);})[_0x7176('0x6')](function(){return respondWithRpcPromise('Start',{'channel':_0x435135,'interaction':_0x170231[_0x7176('0x65')],'message':_0x170231,'account':_0x170231[_0x7176('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7176('0x77'),'appdata':_0x38792f[_0x7176('0xb')]+','+(_0x170231['Account'][_0x7176('0x79')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x7176('0x6')](respondWithResult(_0x41d255,null))[_0x7176('0x13')](handleError(_0x41d255,null));}; \ No newline at end of file +var _0x6d71=['capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','\x20Message\x20not\x20found','update','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','client','http','then','error','message','result','json','sendStatus','stack','name','send','isNil','rows','VoiceChannels','query','VoiceChannelMixMonitor','merge','catch','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','format','SIP/%s','agent','internal','AgentCapacity'];(function(_0x4c71a8,_0x486185){var _0x2687bc=function(_0x86bb27){while(--_0x86bb27){_0x4c71a8['push'](_0x4c71a8['shift']());}};_0x2687bc(++_0x486185);}(_0x6d71,0xbe));var _0x16d7=function(_0x29dcae,_0x2171d4){_0x29dcae=_0x29dcae-0x0;var _0x46f095=_0x6d71[_0x29dcae];return _0x46f095;};'use strict';var BPromise=require(_0x16d7('0x0'));var moment=require(_0x16d7('0x1'));var _=require(_0x16d7('0x2'));var util=require('util');var db=require(_0x16d7('0x3'))['db'];var logger=require(_0x16d7('0x4'))(_0x16d7('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x16d7('0x6')][_0x16d7('0x7')]({'port':0x232a});var mailClient=jayson[_0x16d7('0x6')][_0x16d7('0x7')]({'port':0x232b});var routingClient=jayson[_0x16d7('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2ce80b,_0x1d8a56,_0x514a3e){return new BPromise(function(_0xb2182f,_0x2ec701){var _0x3d590a=_0x514a3e?_0x514a3e:amiClient;return _0x3d590a['request'](_0x2ce80b,_0x1d8a56)[_0x16d7('0x8')](function(_0x2e5b94){if(_0x2e5b94['error']){if(_0x2e5b94[_0x16d7('0x9')]['code']===0x1f4){return _0x2ec701(_0x2e5b94[_0x16d7('0x9')][_0x16d7('0xa')]);}return _0xb2182f(_0x2e5b94[_0x16d7('0x9')][_0x16d7('0xa')]);}else{_0xb2182f(_0x2e5b94[_0x16d7('0xb')]);}})['catch'](function(_0x1bb331){_0x2ec701(_0x1bb331);});});}function respondWithResult(_0x557de1,_0x289a42){_0x289a42=_0x289a42||0xc8;return function(_0x148cd9){if(_0x148cd9){return _0x557de1['status'](_0x289a42)[_0x16d7('0xc')](_0x148cd9);}return _0x557de1[_0x16d7('0xd')](0x194);};}function handleError(_0x1b8663,_0x488f68){_0x488f68=_0x488f68||0x1f4;return function(_0x1ab76d){logger[_0x16d7('0x9')](_0x1ab76d[_0x16d7('0xe')]);if(_0x1ab76d['name']){delete _0x1ab76d[_0x16d7('0xf')];}_0x1b8663['status'](_0x488f68)[_0x16d7('0x10')](_0x1ab76d);};}function findById(_0x76e977){return function(_0x49e461){if(!_['isNil'](_0x76e977)&&!_[_0x16d7('0x11')](_0x49e461)&&!_[_0x16d7('0x11')](_0x49e461[_0x16d7('0x12')])){return _['find'](_0x49e461[_0x16d7('0x12')],function(_0x4f8bfd){return _0x4f8bfd['id']==_0x76e977;});}return null;};}exports['voiceChannels']=function(_0xd2d319,_0x52cb35){return respondWithRpcPromise(_0x16d7('0x13'),_0xd2d319[_0x16d7('0x14')])['then'](respondWithResult(_0x52cb35,null))['catch'](handleError(_0x52cb35,null));};exports['voiceChannelMixMonitor']=function(_0x3cc958,_0x2f15ab){return respondWithRpcPromise(_0x16d7('0x15'),_[_0x16d7('0x16')](_0x3cc958[_0x16d7('0x14')],_0x3cc958['params']))[_0x16d7('0x8')](respondWithResult(_0x2f15ab,null))[_0x16d7('0x17')](handleError(_0x2f15ab,null));};exports['voiceChannelStopMixMonitor']=function(_0x3e271c,_0x1df507){return respondWithRpcPromise(_0x16d7('0x18'),_[_0x16d7('0x16')](_0x3e271c[_0x16d7('0x14')],_0x3e271c[_0x16d7('0x19')]))[_0x16d7('0x8')](respondWithResult(_0x1df507,null))[_0x16d7('0x17')](handleError(_0x1df507,null));};exports[_0x16d7('0x1a')]=function(_0x3d8ba6,_0x549671){return respondWithRpcPromise(_0x16d7('0x1b'),_0x3d8ba6['query'])[_0x16d7('0x8')](respondWithResult(_0x549671,null))[_0x16d7('0x17')](handleError(_0x549671,null));};exports['showVoiceQueues']=function(_0xcc0265,_0x294f98){return respondWithRpcPromise('VoiceQueues',_0xcc0265[_0x16d7('0x14')])['then'](findById(_0xcc0265[_0x16d7('0x19')]['id']))[_0x16d7('0x8')](respondWithResult(_0x294f98,null))[_0x16d7('0x17')](handleError(_0x294f98,null));};exports[_0x16d7('0x1c')]=function(_0x3a4971,_0x1389e2){return respondWithRpcPromise(_0x16d7('0x1d'),_[_0x16d7('0x16')](_0x3a4971[_0x16d7('0x14')],_0x3a4971[_0x16d7('0x19')]))[_0x16d7('0x8')](respondWithResult(_0x1389e2,null))['catch'](handleError(_0x1389e2,null));};exports[_0x16d7('0x1e')]=function(_0x229376,_0x2ec8b8){return respondWithRpcPromise(_0x16d7('0x1f'),_0x229376[_0x16d7('0x14')])[_0x16d7('0x8')](respondWithResult(_0x2ec8b8,null))[_0x16d7('0x17')](handleError(_0x2ec8b8,null));};exports[_0x16d7('0x20')]=function(_0x2bdcc9,_0x2b6aa5){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x16d7('0x16')](_0x2bdcc9[_0x16d7('0x14')],_0x2bdcc9[_0x16d7('0x19')]))[_0x16d7('0x8')](respondWithResult(_0x2b6aa5,null))[_0x16d7('0x17')](handleError(_0x2b6aa5,null));};exports['voiceQueuesChannelHangup']=function(_0x30723c,_0x523f94){return respondWithRpcPromise(_0x16d7('0x21'),_['merge'](_0x30723c[_0x16d7('0x14')],_0x30723c[_0x16d7('0x19')]))[_0x16d7('0x8')](respondWithResult(_0x523f94,null))[_0x16d7('0x17')](handleError(_0x523f94,null));};exports['voiceQueuesChannelRedirect']=function(_0x5341ea,_0x3c174d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x16d7('0x16')](_0x5341ea[_0x16d7('0x14')],_0x5341ea[_0x16d7('0x19')]))['then'](respondWithResult(_0x3c174d,null))[_0x16d7('0x17')](handleError(_0x3c174d,null));};exports['outbound']=function(_0x53caf8,_0xf28839){return respondWithRpcPromise(_0x16d7('0x22'),_0x53caf8[_0x16d7('0x14')])['then'](respondWithResult(_0xf28839,null))[_0x16d7('0x17')](handleError(_0xf28839,null));};exports[_0x16d7('0x23')]=function(_0x284c5a,_0x3a5cb0){return respondWithRpcPromise(_0x16d7('0x24'),_0x284c5a['query'])['then'](respondWithResult(_0x3a5cb0,null))[_0x16d7('0x17')](handleError(_0x3a5cb0,null));};exports[_0x16d7('0x25')]=function(_0x3e103f,_0x3d7c04){var _0xfd9315;return respondWithRpcPromise(_0x16d7('0x26'),_0x3e103f[_0x16d7('0x14')])['then'](function(_0x5902b3){_0xfd9315=_0x5902b3;return respondWithRpcPromise('Agents',_0x3e103f[_0x16d7('0x14')],routingClient);})[_0x16d7('0x8')](function(_0x5c1907){return _[_0x16d7('0x16')]({},_0x5c1907,_0xfd9315);})[_0x16d7('0x8')](respondWithResult(_0x3d7c04,null))['catch'](handleError(_0x3d7c04,null));};exports[_0x16d7('0x27')]=function(_0x31059c,_0x42d610){if(_0x31059c[_0x16d7('0x28')]&&_0x31059c[_0x16d7('0x28')][_0x16d7('0x29')]&&_0x31059c[_0x16d7('0x2a')]&&_0x31059c[_0x16d7('0x2a')][_0x16d7('0xf')]){for(var _0x3010a4 in _0x31059c[_0x16d7('0x28')][_0x16d7('0x29')]){if(_0x31059c['body'][_0x16d7('0x29')]['hasOwnProperty'](_0x3010a4)){db[_0x16d7('0x2b')][_0x16d7('0x2c')]({'where':{'channel':_0x3010a4,'membername':_0x31059c[_0x16d7('0x2a')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x31059c['body']['interaction'][_0x3010a4]&&_0x31059c[_0x16d7('0x28')][_0x16d7('0x29')][_0x3010a4][_0x16d7('0x2d')]?{'$notIn':_0x31059c[_0x16d7('0x28')]['interaction'][_0x3010a4]}:{'$ne':null}}})['then'](function(_0x5be21e){var _0x37a6f5=moment()['format'](_0x16d7('0x2e'));for(var _0x32cf49=0x0,_0x33dfcb=_0x5be21e[_0x16d7('0x2d')];_0x32cf49<_0x33dfcb;_0x32cf49+=0x1){_0x5be21e[_0x32cf49][_0x16d7('0x2f')]({'exitAt':_0x37a6f5});}});for(var _0x57051c=0x0;_0x57051c<_0x31059c[_0x16d7('0x28')][_0x16d7('0x29')][_0x3010a4][_0x16d7('0x2d')];_0x57051c+=0x1){db[_0x16d7('0x2b')][_0x16d7('0x30')]({'where':{'channel':_0x3010a4,'membername':_0x31059c[_0x16d7('0x2a')]['name'],'type':_0x16d7('0x31'),'uniqueid':_0x31059c[_0x16d7('0x28')][_0x16d7('0x29')][_0x3010a4][_0x57051c],'exitAt':null},'defaults':{'channel':_0x3010a4,'membername':_0x31059c[_0x16d7('0x2a')][_0x16d7('0xf')],'interface':_[_0x16d7('0x11')](_0x31059c[_0x16d7('0x2a')][_0x16d7('0x32')])?util[_0x16d7('0x33')](_0x16d7('0x34'),_0x31059c[_0x16d7('0x2a')][_0x16d7('0xf')]):_0x31059c['user'][_0x16d7('0x32')],'type':_0x16d7('0x31'),'enterAt':moment()[_0x16d7('0x33')](_0x16d7('0x2e')),'role':_0x16d7('0x35'),'internal':_0x31059c[_0x16d7('0x2a')][_0x16d7('0x36')],'uniqueid':_0x31059c[_0x16d7('0x28')][_0x16d7('0x29')][_0x3010a4][_0x57051c]}});}}}}return respondWithRpcPromise(_0x16d7('0x37'),{'id':_0x31059c[_0x16d7('0x19')]['id'],'capacity':_0x31059c[_0x16d7('0x28')][_0x16d7('0x38')]},routingClient)[_0x16d7('0x8')](respondWithResult(_0x42d610,null))['catch'](handleError(_0x42d610,null));};exports[_0x16d7('0x39')]=function(_0x308459,_0x2d2982){return respondWithRpcPromise('Telephones',_0x308459[_0x16d7('0x14')])[_0x16d7('0x8')](respondWithResult(_0x2d2982,null))[_0x16d7('0x17')](handleError(_0x2d2982,null));};exports[_0x16d7('0x3a')]=function(_0x3ad7ef,_0x14ab00){return respondWithRpcPromise(_0x16d7('0x3b'),_0x3ad7ef['query'])['then'](respondWithResult(_0x14ab00,null))[_0x16d7('0x17')](handleError(_0x14ab00,null));};exports[_0x16d7('0x3c')]=function(_0x40c492,_0x177fd1){return respondWithRpcPromise(_0x16d7('0x3d'),_0x40c492[_0x16d7('0x14')])['then'](respondWithResult(_0x177fd1,null))[_0x16d7('0x17')](handleError(_0x177fd1,null));};exports[_0x16d7('0x3e')]=function(_0x2d6987,_0x182a91){return respondWithRpcPromise('ChatQueues',_0x2d6987[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x182a91,null))[_0x16d7('0x17')](handleError(_0x182a91,null));};exports[_0x16d7('0x3f')]=function(_0x506000,_0xe07d86){return respondWithRpcPromise(_0x16d7('0x40'),_0x506000[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](findById(_0x506000[_0x16d7('0x19')]['id']))['then'](respondWithResult(_0xe07d86,null))[_0x16d7('0x17')](handleError(_0xe07d86,null));};exports[_0x16d7('0x41')]=function(_0x58cfc2,_0x5ad326){return respondWithRpcPromise(_0x16d7('0x42'),_0x58cfc2[_0x16d7('0x14')],routingClient)['then'](respondWithResult(_0x5ad326,null))[_0x16d7('0x17')](handleError(_0x5ad326,null));};exports[_0x16d7('0x43')]=function(_0x28e943,_0x8583f6){return respondWithRpcPromise(_0x16d7('0x42'),_0x28e943[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](findById(_0x28e943['params']['id']))[_0x16d7('0x8')](respondWithResult(_0x8583f6,null))[_0x16d7('0x17')](handleError(_0x8583f6,null));};exports[_0x16d7('0x44')]=function(_0x3e0060,_0x307036){return respondWithRpcPromise(_0x16d7('0x45'),_0x3e0060[_0x16d7('0x14')],mailClient)[_0x16d7('0x8')](respondWithResult(_0x307036,null))[_0x16d7('0x17')](handleError(_0x307036,null));};exports['openchannelQueues']=function(_0x1fbdee,_0x2423de){return respondWithRpcPromise(_0x16d7('0x46'),_0x1fbdee[_0x16d7('0x14')],routingClient)['then'](respondWithResult(_0x2423de,null))[_0x16d7('0x17')](handleError(_0x2423de,null));};exports[_0x16d7('0x47')]=function(_0x4373e1,_0x463b62){return respondWithRpcPromise(_0x16d7('0x46'),_0x4373e1[_0x16d7('0x14')],routingClient)['then'](findById(_0x4373e1[_0x16d7('0x19')]['id']))[_0x16d7('0x8')](respondWithResult(_0x463b62,null))['catch'](handleError(_0x463b62,null));};exports['smsQueues']=function(_0x1501f1,_0x29b5bc){return respondWithRpcPromise(_0x16d7('0x48'),_0x1501f1[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x29b5bc,null))[_0x16d7('0x17')](handleError(_0x29b5bc,null));};exports[_0x16d7('0x49')]=function(_0x4545ea,_0x5999c2){return respondWithRpcPromise(_0x16d7('0x48'),_0x4545ea[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](findById(_0x4545ea[_0x16d7('0x19')]['id']))['then'](respondWithResult(_0x5999c2,null))[_0x16d7('0x17')](handleError(_0x5999c2,null));};exports[_0x16d7('0x4a')]=function(_0x3d3d9b,_0x20373b){return respondWithRpcPromise(_0x16d7('0x4b'),_0x3d3d9b[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x20373b,null))[_0x16d7('0x17')](handleError(_0x20373b,null));};exports[_0x16d7('0x4c')]=function(_0x4a7963,_0xd85293){return respondWithRpcPromise(_0x16d7('0x4b'),_0x4a7963['query'],routingClient)['then'](findById(_0x4a7963[_0x16d7('0x19')]['id']))['then'](respondWithResult(_0xd85293,null))[_0x16d7('0x17')](handleError(_0xd85293,null));};exports['faxQueues']=function(_0x563e61,_0x5a273f){return respondWithRpcPromise(_0x16d7('0x4d'),_0x563e61[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x5a273f,null))[_0x16d7('0x17')](handleError(_0x5a273f,null));};exports[_0x16d7('0x4e')]=function(_0x3b701c,_0x49674b){return respondWithRpcPromise(_0x16d7('0x4d'),_0x3b701c['query'],routingClient)[_0x16d7('0x8')](findById(_0x3b701c[_0x16d7('0x19')]['id']))['then'](respondWithResult(_0x49674b,null))[_0x16d7('0x17')](handleError(_0x49674b,null));};exports[_0x16d7('0x4f')]=function(_0x3bb0fb,_0x5b9b55){return respondWithRpcPromise(_0x16d7('0x50'),_0x3bb0fb[_0x16d7('0x14')])[_0x16d7('0x8')](respondWithResult(_0x5b9b55,null))['catch'](handleError(_0x5b9b55,null));};exports[_0x16d7('0x51')]=function(_0x54ef8a,_0x1bec09){return respondWithRpcPromise(_0x16d7('0x52'),_0x54ef8a[_0x16d7('0x14')],routingClient)['then'](respondWithResult(_0x1bec09,null))[_0x16d7('0x17')](handleError(_0x1bec09,null));};exports[_0x16d7('0x53')]=function(_0x56a6da,_0x57f43f){return respondWithRpcPromise(_0x16d7('0x54'),_0x56a6da[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x57f43f,null))[_0x16d7('0x17')](handleError(_0x57f43f,null));};exports[_0x16d7('0x55')]=function(_0x2fec30,_0x2e3825){return respondWithRpcPromise(_0x16d7('0x56'),_0x2fec30[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x2e3825,null))['catch'](handleError(_0x2e3825,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x35e347,_0x2249b2){return respondWithRpcPromise(_0x16d7('0x56'),_0x35e347[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](function(_0x48a991){if(_0x35e347[_0x16d7('0x14')][_0x16d7('0x57')]!==undefined){var _0x120207=_(_0x48a991['rows'])[_0x16d7('0x58')]([_0x35e347[_0x16d7('0x14')][_0x16d7('0x57')],_0x35e347[_0x16d7('0x19')]['id']])['map'](_0x16d7('0x59'))[_0x16d7('0x5a')]()[_0x16d7('0x5b')]();return _0x48a991['rows']['filter'](function(_0x554e3c){return _0x120207[_0x16d7('0x5c')](_0x554e3c[_0x16d7('0x59')])>-0x1;});}else{return _0x48a991[_0x16d7('0x12')]['filter'](function(_0xee2d27){return _0xee2d27['queue_id']===parseInt(_0x35e347[_0x16d7('0x19')]['id']);});}})[_0x16d7('0x8')](respondWithResult(_0x2249b2,null))[_0x16d7('0x17')](handleError(_0x2249b2,null));};exports[_0x16d7('0x5d')]=function(_0x59d79c,_0x465cad){return respondWithRpcPromise(_0x16d7('0x5e'),_0x59d79c[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0x465cad,null))[_0x16d7('0x17')](handleError(_0x465cad,null));};exports[_0x16d7('0x5f')]=function(_0xb36007,_0xf81163){return respondWithRpcPromise(_0x16d7('0x60'),_0xb36007[_0x16d7('0x14')],routingClient)[_0x16d7('0x8')](respondWithResult(_0xf81163,null))['catch'](handleError(_0xf81163,null));};exports[_0x16d7('0x61')]=function(_0x2168f6,_0x353a20){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2168f6['query'],routingClient)[_0x16d7('0x8')](respondWithResult(_0x353a20,null))[_0x16d7('0x17')](handleError(_0x353a20,null));};exports[_0x16d7('0x62')]=function(_0x569346){return function(_0x44963e,_0x1f3771){var _0x5a262c,_0x3b21f6;var _0x12eaae=_[_0x16d7('0x63')](_0x569346);var _0x534658=_0x569346===_0x16d7('0x64')?_0x16d7('0x65'):_0x16d7('0x66');return db[_0x12eaae+'Queue'][_0x16d7('0x67')]({'raw':!![],'where':{'id':_0x44963e[_0x16d7('0x19')]['id']}})[_0x16d7('0x8')](function(_0x454b8b){if(_[_0x16d7('0x11')](_0x454b8b)){throw new Error(_0x12eaae+_0x16d7('0x68'));}_0x5a262c=_0x454b8b;return db[_0x12eaae+_0x16d7('0x69')][_0x16d7('0x67')]({'where':{'id':_0x44963e[_0x16d7('0x28')]['messageId']},'include':[{'model':db[_0x12eaae+'Interaction'],'as':_0x16d7('0x6a')},{'model':db[_0x12eaae+_0x534658],'as':_0x16d7('0x66')}]});})[_0x16d7('0x8')](function(_0x45f9d3){if(_['isNil'](_0x45f9d3)){throw new Error(_0x12eaae+'\x20Message\x20not\x20found');}_0x3b21f6=_0x45f9d3;return _0x45f9d3['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x16d7('0x8')](function(){var _0x2523d6={'uniqueid':_0x569346+'.'+_0x3b21f6['id']+'.'+_0x3b21f6[_0x16d7('0x6a')]['id'],'FromUserId':_0x44963e[_0x16d7('0x2a')]['id'],'type':_0x16d7('0x6b')};_0x2523d6[_0x12eaae+_0x16d7('0x6c')]=_0x3b21f6['id'];_0x2523d6[_0x12eaae+_0x16d7('0x6d')]=_0x3b21f6[_0x16d7('0x6a')]['id'];_0x2523d6[_0x16d7('0x6e')+_0x12eaae+_0x534658+'Id']=_0x3b21f6['Account']['id'];_0x2523d6['To'+_0x12eaae+_0x16d7('0x6f')]=_0x5a262c['id'];return db[_0x12eaae+_0x16d7('0x70')][_0x16d7('0x71')](_0x2523d6);})[_0x16d7('0x8')](function(){return respondWithRpcPromise(_0x16d7('0x72'),{'channel':_0x569346,'interaction':_0x3b21f6['Interaction'],'message':_0x3b21f6,'account':_0x3b21f6[_0x16d7('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x16d7('0x6b'),'appdata':_0x5a262c[_0x16d7('0xf')]+','+(_0x3b21f6['Account'][_0x16d7('0x73')]||0x12c),'interval':_0x16d7('0x74')}]},routingClient);})[_0x16d7('0x8')](respondWithResult(_0x1f3771,null))[_0x16d7('0x17')](handleError(_0x1f3771,null));};};exports[_0x16d7('0x75')]=function(_0x361c91,_0x4cfbfa){var _0x146758,_0x457ba4;if(_[_0x16d7('0x11')](_0x361c91[_0x16d7('0x28')][_0x16d7('0x76')])){throw new Error(_0x16d7('0x77'));}var _0x2c4f30=_0x361c91[_0x16d7('0x28')][_0x16d7('0x76')];var _0x10d464=_[_0x16d7('0x63')](_0x2c4f30);var _0x12e1cb=_0x2c4f30===_0x16d7('0x64')?_0x16d7('0x65'):_0x16d7('0x66');return db['User'][_0x16d7('0x67')]({'raw':!![],'where':{'id':_0x361c91['params']['id'],'role':'agent'}})[_0x16d7('0x8')](function(_0x11a522){if(_['isNil'](_0x11a522)){throw new Error(_0x16d7('0x78'));}_0x146758=_0x11a522;return db[_0x10d464+_0x16d7('0x69')]['findOne']({'where':{'id':_0x361c91[_0x16d7('0x28')]['messageId']},'include':[{'model':db[_0x10d464+'Interaction'],'as':_0x16d7('0x6a')},{'model':db[_0x10d464+_0x12e1cb],'as':_0x16d7('0x66')}]});})['then'](function(_0xce982b){if(_[_0x16d7('0x11')](_0xce982b)){throw new Error(_0x10d464+_0x16d7('0x79'));}_0x457ba4=_0xce982b;return _0xce982b[_0x16d7('0x7a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x16d7('0x8')](function(){var _0x294f29={'uniqueid':_0x2c4f30+'.'+_0x457ba4['id']+'.'+_0x457ba4['Interaction']['id'],'FromUserId':_0x361c91[_0x16d7('0x2a')]['id'],'type':_0x16d7('0x6b'),'ToUserId':_0x146758['id']};_0x294f29[_0x10d464+_0x16d7('0x6c')]=_0x457ba4['id'];_0x294f29[_0x10d464+'InteractionId']=_0x457ba4[_0x16d7('0x6a')]['id'];_0x294f29[_0x16d7('0x6e')+_0x10d464+_0x12e1cb+'Id']=_0x457ba4[_0x16d7('0x66')]['id'];return db[_0x10d464+_0x16d7('0x70')][_0x16d7('0x71')](_0x294f29);})[_0x16d7('0x8')](function(){return respondWithRpcPromise(_0x16d7('0x72'),{'channel':_0x2c4f30,'interaction':_0x457ba4[_0x16d7('0x6a')],'message':_0x457ba4,'account':_0x457ba4[_0x16d7('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x16d7('0x35'),'appdata':_0x146758[_0x16d7('0xf')]+','+(_0x457ba4[_0x16d7('0x66')]['agentTransferTimeout']||0x12c),'interval':_0x16d7('0x74')}]},routingClient);})[_0x16d7('0x8')](respondWithResult(_0x4cfbfa,null))[_0x16d7('0x17')](handleError(_0x4cfbfa,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 890e87b..43e944d 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 _0x5c09=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','post','put','update','delete','destroy','exports','multer'];(function(_0x1b6415,_0x5dcc64){var _0x470518=function(_0x11f9c3){while(--_0x11f9c3){_0x1b6415['push'](_0x1b6415['shift']());}};_0x470518(++_0x5dcc64);}(_0x5c09,0x18e));var _0x95c0=function(_0x51223d,_0x260ed0){_0x51223d=_0x51223d-0x0;var _0x5ecc88=_0x5c09[_0x51223d];return _0x5ecc88;};'use strict';var multer=require(_0x95c0('0x0'));var util=require(_0x95c0('0x1'));var path=require('path');var timeout=require(_0x95c0('0x2'));var express=require('express');var router=express[_0x95c0('0x3')]();var auth=require(_0x95c0('0x4'));var interaction=require(_0x95c0('0x5'));var config=require(_0x95c0('0x6'));var controller=require(_0x95c0('0x7'));router['get']('/',auth[_0x95c0('0x8')](),controller[_0x95c0('0x9')]);router[_0x95c0('0xa')](_0x95c0('0xb'),auth['isAuthenticated'](),controller[_0x95c0('0xc')]);router[_0x95c0('0xa')](_0x95c0('0xd'),auth['isAuthenticated'](),controller[_0x95c0('0xe')]);router[_0x95c0('0xf')]('/',auth[_0x95c0('0x8')](),controller['create']);router[_0x95c0('0x10')](_0x95c0('0xb'),auth[_0x95c0('0x8')](),controller[_0x95c0('0x11')]);router[_0x95c0('0x12')](_0x95c0('0xb'),auth[_0x95c0('0x8')](),controller[_0x95c0('0x13')]);module[_0x95c0('0x14')]=router; \ No newline at end of file +var _0x1c22=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','run','post','create','put','delete','destroy','multer','util'];(function(_0x4276f9,_0x5e6dd7){var _0x2af1d3=function(_0x53e581){while(--_0x53e581){_0x4276f9['push'](_0x4276f9['shift']());}};_0x2af1d3(++_0x5e6dd7);}(_0x1c22,0x18d));var _0x21c2=function(_0x18390d,_0x22e408){_0x18390d=_0x18390d-0x0;var _0x69a59f=_0x1c22[_0x18390d];return _0x69a59f;};'use strict';var multer=require(_0x21c2('0x0'));var util=require(_0x21c2('0x1'));var path=require(_0x21c2('0x2'));var timeout=require(_0x21c2('0x3'));var express=require(_0x21c2('0x4'));var router=express[_0x21c2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x21c2('0x6'));var config=require(_0x21c2('0x7'));var controller=require(_0x21c2('0x8'));router[_0x21c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x21c2('0xa')]);router['get'](_0x21c2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x21c2('0x9')]('/:id/run',auth[_0x21c2('0xc')](),controller[_0x21c2('0xd')]);router[_0x21c2('0xe')]('/',auth[_0x21c2('0xc')](),controller[_0x21c2('0xf')]);router[_0x21c2('0x10')]('/:id',auth[_0x21c2('0xc')](),controller['update']);router[_0x21c2('0x11')](_0x21c2('0xb'),auth['isAuthenticated'](),controller[_0x21c2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index da14d6f..b105349 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 _0xb091=['weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','quarters','months'];(function(_0x3891eb,_0x53b9a1){var _0xd1d119=function(_0x476aa6){while(--_0x476aa6){_0x3891eb['push'](_0x3891eb['shift']());}};_0xd1d119(++_0x53b9a1);}(_0xb091,0x16e));var _0x1b09=function(_0x578c0f,_0x286827){_0x578c0f=_0x578c0f-0x0;var _0x563a2f=_0xb091[_0x578c0f];return _0x563a2f;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1b09('0x1')]},'active':{'type':Sequelize[_0x1b09('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1b09('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1b09('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1b09('0x5')]('years',_0x1b09('0x6'),_0x1b09('0x7'),_0x1b09('0x8'),'days',_0x1b09('0x9'),_0x1b09('0xa')),'allowNull':![],'defaultValue':_0x1b09('0xb')},'output':{'type':Sequelize[_0x1b09('0x5')](_0x1b09('0xc'),_0x1b09('0xd'),_0x1b09('0xe')),'allowNull':![],'defaultValue':_0x1b09('0xc')},'type':{'type':Sequelize[_0x1b09('0x5')](_0x1b09('0xf'),_0x1b09('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x1b09('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1b09('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x1b09('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6657=['custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx'];(function(_0x34f3eb,_0x522515){var _0x29c6fe=function(_0x17745e){while(--_0x17745e){_0x34f3eb['push'](_0x34f3eb['shift']());}};_0x29c6fe(++_0x522515);}(_0x6657,0x17f));var _0x7665=function(_0x47c933,_0x17a669){_0x47c933=_0x47c933-0x0;var _0x19ecd7=_0x6657[_0x47c933];return _0x19ecd7;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7665('0x1')]},'active':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7665('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x7665('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7665('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7665('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7665('0x5')](_0x7665('0x6'),_0x7665('0x7'),_0x7665('0x8'),_0x7665('0x9'),'days',_0x7665('0xa'),_0x7665('0xb')),'allowNull':![],'defaultValue':_0x7665('0xc')},'output':{'type':Sequelize[_0x7665('0x5')](_0x7665('0xd'),_0x7665('0xe'),_0x7665('0xf')),'allowNull':![],'defaultValue':_0x7665('0xd')},'type':{'type':Sequelize['ENUM'](_0x7665('0x10'),_0x7665('0x11')),'allowNull':![],'defaultValue':_0x7665('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7665('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x7665('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x7665('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 7ab9080..acf84af 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 _0x82ab=['bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','set','apply','reject','save','then','Scheduler','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','VIRTUAL','options','include','Schedule','findAll','rows','show','params','includeAll','merge','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','run','../../config/schedule','html-pdf','rimraf','fast-json-patch','request-promise','moment'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x82ab,0x14b));var _0xb82a=function(_0x1cfba1,_0xceafc){_0x1cfba1=_0x1cfba1-0x0;var _0x4fd6aa=_0x82ab[_0x1cfba1];return _0x4fd6aa;};'use strict';var pdf=require(_0xb82a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb82a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb82a('0x2'));var rp=require(_0xb82a('0x3'));var moment=require(_0xb82a('0x4'));var BPromise=require(_0xb82a('0x5'));var Mustache=require(_0xb82a('0x6'));var util=require(_0xb82a('0x7'));var path=require(_0xb82a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb82a('0x9'));var fs=require('fs');var _=require(_0xb82a('0xa'));var squel=require(_0xb82a('0xb'));var crypto=require('crypto');var jsforce=require(_0xb82a('0xc'));var deskjs=require(_0xb82a('0xd'));var toCsv=require(_0xb82a('0xe'));var querystring=require(_0xb82a('0xf'));var Papa=require(_0xb82a('0x10'));var Redis=require('ioredis');var authService=require(_0xb82a('0x11'));var qs=require(_0xb82a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb82a('0x13'));var logger=require(_0xb82a('0x14'))('api');var utils=require(_0xb82a('0x15'));var config=require(_0xb82a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb82a('0x17'))['db'];function respondWithStatusCode(_0x27937c,_0x321eb6){_0x321eb6=_0x321eb6||0xcc;return function(_0xb0d331){if(_0xb0d331){return _0x27937c['sendStatus'](_0x321eb6);}return _0x27937c[_0xb82a('0x18')](_0x321eb6)['end']();};}function respondWithResult(_0x18060f,_0x382e2d){_0x382e2d=_0x382e2d||0xc8;return function(_0x59593e){if(_0x59593e){return _0x18060f['status'](_0x382e2d)['json'](_0x59593e);}};}function respondWithFilteredResult(_0x323c27,_0x7f89c7){return function(_0x3a8498){if(_0x3a8498){var _0x26ab32=_0x3a8498[_0xb82a('0x19')],_0x44cc4e=_0x7f89c7[_0xb82a('0x1a')],_0x15436e=_0x7f89c7[_0xb82a('0x1a')]+_0x7f89c7['limit'],_0x4c83cc;if(_0x15436e>=_0x26ab32){_0x15436e=_0x26ab32;_0x4c83cc=0xc8;}else{_0x4c83cc=0xce;}_0x323c27[_0xb82a('0x18')](_0x4c83cc);return _0x323c27[_0xb82a('0x1b')]('Content-Range',_0x44cc4e+'-'+_0x15436e+'/'+_0x26ab32)['json'](_0x3a8498);}return null;};}function patchUpdates(_0x3ffd7c){return function(_0x4be1e8){try{jsonpatch[_0xb82a('0x1c')](_0x4be1e8,_0x3ffd7c,!![]);}catch(_0x5d71a4){return BPromise[_0xb82a('0x1d')](_0x5d71a4);}return _0x4be1e8[_0xb82a('0x1e')]();};}function saveUpdates(_0x3faa33,_0x345e7c){return function(_0x35afb5){if(_0x35afb5){return _0x35afb5['update'](_0x3faa33)[_0xb82a('0x1f')](function(_0x24af52){return _0x24af52;});}return null;};}function removeEntity(_0x493714,_0x1cdf97){return function(_0x156cc4){if(_0x156cc4){return _0x156cc4['destroy']()[_0xb82a('0x1f')](function(){var _0x4b7f6a=_0x156cc4['get']({'plain':!![]});var _0x5b5267=_0xb82a('0x20');return db[_0xb82a('0x21')][_0xb82a('0x22')]({'where':{'type':_0x5b5267,'resourceId':_0x4b7f6a['id']}})[_0xb82a('0x1f')](function(){return _0x156cc4;});})[_0xb82a('0x1f')](function(){_0x493714[_0xb82a('0x18')](0xcc)[_0xb82a('0x23')]();});}};}function handleEntityNotFound(_0x51c57d,_0x58742b){return function(_0x5df25f){if(!_0x5df25f){_0x51c57d[_0xb82a('0x24')](0x194);}return _0x5df25f;};}function handleError(_0x267ab9,_0x313906){_0x313906=_0x313906||0x1f4;return function(_0x3448e5){logger[_0xb82a('0x25')](_0x3448e5[_0xb82a('0x26')]);if(_0x3448e5[_0xb82a('0x27')]){delete _0x3448e5['name'];}_0x267ab9[_0xb82a('0x18')](_0x313906)[_0xb82a('0x28')](_0x3448e5);};}exports['index']=function(_0x337d22,_0x18b355){var _0x328660={},_0x3de09a={},_0x5a061c={'count':0x0,'rows':[]};var _0x2c5d84=_[_0xb82a('0x29')](db['Schedule'][_0xb82a('0x2a')],function(_0x57bf57){return{'name':_0x57bf57[_0xb82a('0x2b')],'type':_0x57bf57['type'][_0xb82a('0x2c')]};});_0x3de09a[_0xb82a('0x2d')]=_['map'](_0x2c5d84,_0xb82a('0x27'));_0x3de09a['query']=_[_0xb82a('0x2e')](_0x337d22[_0xb82a('0x2f')]);_0x3de09a[_0xb82a('0x30')]=_[_0xb82a('0x31')](_0x3de09a[_0xb82a('0x2d')],_0x3de09a[_0xb82a('0x2f')]);_0x328660[_0xb82a('0x32')]=_[_0xb82a('0x31')](_0x3de09a[_0xb82a('0x2d')],qs[_0xb82a('0x33')](_0x337d22['query'][_0xb82a('0x33')]));_0x328660[_0xb82a('0x32')]=_0x328660[_0xb82a('0x32')][_0xb82a('0x34')]?_0x328660[_0xb82a('0x32')]:_0x3de09a[_0xb82a('0x2d')];if(!_0x337d22[_0xb82a('0x2f')][_0xb82a('0x35')](_0xb82a('0x36'))){_0x328660[_0xb82a('0x37')]=qs[_0xb82a('0x37')](_0x337d22['query']['limit']);_0x328660[_0xb82a('0x1a')]=qs[_0xb82a('0x1a')](_0x337d22[_0xb82a('0x2f')][_0xb82a('0x1a')]);}_0x328660[_0xb82a('0x38')]=qs[_0xb82a('0x39')](_0x337d22[_0xb82a('0x2f')]['sort']);_0x328660['where']=qs['filters'](_[_0xb82a('0x3a')](_0x337d22[_0xb82a('0x2f')],_0x3de09a[_0xb82a('0x30')]),_0x2c5d84);if(_0x337d22[_0xb82a('0x2f')][_0xb82a('0x3b')]){_0x328660['where']=_['merge'](_0x328660['where'],{'$or':_[_0xb82a('0x29')](_0x2c5d84,function(_0x368bdf){if(_0x368bdf['type']!==_0xb82a('0x3c')){var _0x3464a0={};_0x3464a0[_0x368bdf['name']]={'$like':'%'+_0x337d22[_0xb82a('0x2f')][_0xb82a('0x3b')]+'%'};return _0x3464a0;}})});}_0x328660=_['merge']({},_0x328660,_0x337d22[_0xb82a('0x3d')]);var _0x3fb2cf={'where':_0x328660['where']};return db['Schedule']['count'](_0x3fb2cf)[_0xb82a('0x1f')](function(_0x1f4ed5){_0x5a061c[_0xb82a('0x19')]=_0x1f4ed5;if(_0x337d22[_0xb82a('0x2f')]['includeAll']){_0x328660[_0xb82a('0x3e')]=[{'all':!![]}];}return db[_0xb82a('0x3f')][_0xb82a('0x40')](_0x328660);})[_0xb82a('0x1f')](function(_0x43589b){_0x5a061c[_0xb82a('0x41')]=_0x43589b;return _0x5a061c;})[_0xb82a('0x1f')](respondWithFilteredResult(_0x18b355,_0x328660))['catch'](handleError(_0x18b355,null));};exports[_0xb82a('0x42')]=function(_0x3d3922,_0x16524b){var _0x3a9150={'raw':![],'where':{'id':_0x3d3922[_0xb82a('0x43')]['id']}},_0x273377={};_0x273377[_0xb82a('0x2d')]=_['keys'](db['Schedule']['rawAttributes']);_0x273377['query']=_[_0xb82a('0x2e')](_0x3d3922[_0xb82a('0x2f')]);_0x273377[_0xb82a('0x30')]=_[_0xb82a('0x31')](_0x273377[_0xb82a('0x2d')],_0x273377[_0xb82a('0x2f')]);_0x3a9150['attributes']=_[_0xb82a('0x31')](_0x273377['model'],qs[_0xb82a('0x33')](_0x3d3922['query'][_0xb82a('0x33')]));_0x3a9150[_0xb82a('0x32')]=_0x3a9150[_0xb82a('0x32')][_0xb82a('0x34')]?_0x3a9150[_0xb82a('0x32')]:_0x273377[_0xb82a('0x2d')];if(_0x3d3922[_0xb82a('0x2f')][_0xb82a('0x44')]){_0x3a9150[_0xb82a('0x3e')]=[{'all':!![]}];}_0x3a9150=_[_0xb82a('0x45')]({},_0x3a9150,_0x3d3922[_0xb82a('0x3d')]);return db[_0xb82a('0x3f')]['find'](_0x3a9150)[_0xb82a('0x1f')](handleEntityNotFound(_0x16524b,null))['then'](respondWithResult(_0x16524b,null))[_0xb82a('0x46')](handleError(_0x16524b,null));};exports['create']=function(_0x25d430,_0x3a38b0){return db[_0xb82a('0x3f')][_0xb82a('0x47')](_0x25d430[_0xb82a('0x48')],{})['then'](function(_0x1a5d69){var _0x166e1f=_0x25d430[_0xb82a('0x49')][_0xb82a('0x4a')]({'plain':!![]});if(!_0x166e1f)throw new Error(_0xb82a('0x4b'));if(_0x166e1f['role']===_0xb82a('0x49')){var _0x221de5=_0x1a5d69[_0xb82a('0x4a')]({'plain':!![]});var _0x2e40a1=_0xb82a('0x20');return db[_0xb82a('0x4c')]['find']({'where':{'name':_0x2e40a1,'userProfileId':_0x166e1f[_0xb82a('0x4d')]},'raw':!![]})[_0xb82a('0x1f')](function(_0x36a60c){if(_0x36a60c&&_0x36a60c[_0xb82a('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x221de5['name'],'resourceId':_0x221de5['id'],'type':_0x36a60c['name'],'sectionId':_0x36a60c['id']},{})['then'](function(){return _0x1a5d69;});}else{return _0x1a5d69;}})['catch'](function(_0x5d33a9){logger[_0xb82a('0x25')](_0xb82a('0x4f'),_0x5d33a9);throw _0x5d33a9;});}return _0x1a5d69;})[_0xb82a('0x1f')](respondWithResult(_0x3a38b0,0xc9))[_0xb82a('0x46')](handleError(_0x3a38b0,null));};exports[_0xb82a('0x50')]=function(_0x469310,_0x11e705){if(_0x469310[_0xb82a('0x48')]['id']){delete _0x469310[_0xb82a('0x48')]['id'];}return db[_0xb82a('0x3f')]['find']({'where':{'id':_0x469310['params']['id']}})[_0xb82a('0x1f')](handleEntityNotFound(_0x11e705,null))[_0xb82a('0x1f')](saveUpdates(_0x469310[_0xb82a('0x48')],null))[_0xb82a('0x1f')](respondWithResult(_0x11e705,null))[_0xb82a('0x46')](handleError(_0x11e705,null));};exports[_0xb82a('0x22')]=function(_0x5f34b0,_0x575013){return db[_0xb82a('0x3f')][_0xb82a('0x51')]({'where':{'id':_0x5f34b0[_0xb82a('0x43')]['id']}})['then'](handleEntityNotFound(_0x575013,null))[_0xb82a('0x1f')](removeEntity(_0x575013,null))[_0xb82a('0x46')](handleError(_0x575013,null));};exports[_0xb82a('0x52')]=function(_0x32b3a8,_0x4414aa,_0x6f6d5c){var _0xc70653=require(_0xb82a('0x53'));return db['Schedule'][_0xb82a('0x51')]({'where':{'id':_0x32b3a8[_0xb82a('0x43')]['id']},'raw':!![]})[_0xb82a('0x1f')](handleEntityNotFound(_0x4414aa,null))[_0xb82a('0x1f')](function(){_0xc70653[_0xb82a('0x52')](_0x32b3a8[_0xb82a('0x43')]['id']);})['then'](respondWithStatusCode(_0x4414aa,null))[_0xb82a('0x46')](handleError(_0x4414aa,null));}; \ No newline at end of file +var _0x320d=['apply','reject','update','then','get','Scheduler','UserProfileResource','destroy','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','catch','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json'];(function(_0x4e878e,_0x203120){var _0x4aa603=function(_0x61aa2e){while(--_0x61aa2e){_0x4e878e['push'](_0x4e878e['shift']());}};_0x4aa603(++_0x203120);}(_0x320d,0x12f));var _0xd320=function(_0x5343cc,_0x3c7dba){_0x5343cc=_0x5343cc-0x0;var _0x4c99bc=_0x320d[_0x5343cc];return _0x4c99bc;};'use strict';var pdf=require(_0xd320('0x0'));var emlformat=require(_0xd320('0x1'));var rimraf=require(_0xd320('0x2'));var zipdir=require(_0xd320('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd320('0x4'));var moment=require(_0xd320('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd320('0x6'));var util=require(_0xd320('0x7'));var path=require(_0xd320('0x8'));var sox=require(_0xd320('0x9'));var csv=require(_0xd320('0xa'));var ejs=require(_0xd320('0xb'));var fs=require('fs');var _=require(_0xd320('0xc'));var squel=require('squel');var crypto=require(_0xd320('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd320('0xe'));var toCsv=require(_0xd320('0xa'));var querystring=require('querystring');var Papa=require(_0xd320('0xf'));var Redis=require(_0xd320('0x10'));var authService=require(_0xd320('0x11'));var qs=require(_0xd320('0x12'));var as=require(_0xd320('0x13'));var hardwareService=require(_0xd320('0x14'));var logger=require('../../config/logger')(_0xd320('0x15'));var utils=require('../../config/utils');var config=require(_0xd320('0x16'));var licenseUtil=require(_0xd320('0x17'));var db=require(_0xd320('0x18'))['db'];function respondWithStatusCode(_0x3fde51,_0xd7dcf1){_0xd7dcf1=_0xd7dcf1||0xcc;return function(_0x24b941){if(_0x24b941){return _0x3fde51[_0xd320('0x19')](_0xd7dcf1);}return _0x3fde51[_0xd320('0x1a')](_0xd7dcf1)[_0xd320('0x1b')]();};}function respondWithResult(_0x19774b,_0x3006da){_0x3006da=_0x3006da||0xc8;return function(_0x88c9fe){if(_0x88c9fe){return _0x19774b[_0xd320('0x1a')](_0x3006da)['json'](_0x88c9fe);}};}function respondWithFilteredResult(_0x51f7f7,_0x807bc2){return function(_0x2ed1e5){if(_0x2ed1e5){var _0x100c2d=_0x2ed1e5[_0xd320('0x1c')],_0x55d7ee=_0x807bc2[_0xd320('0x1d')],_0x4c8059=_0x807bc2[_0xd320('0x1d')]+_0x807bc2[_0xd320('0x1e')],_0x3c8bd5;if(_0x4c8059>=_0x100c2d){_0x4c8059=_0x100c2d;_0x3c8bd5=0xc8;}else{_0x3c8bd5=0xce;}_0x51f7f7[_0xd320('0x1a')](_0x3c8bd5);return _0x51f7f7['set'](_0xd320('0x1f'),_0x55d7ee+'-'+_0x4c8059+'/'+_0x100c2d)[_0xd320('0x20')](_0x2ed1e5);}return null;};}function patchUpdates(_0x41f2c5){return function(_0x5390d4){try{jsonpatch[_0xd320('0x21')](_0x5390d4,_0x41f2c5,!![]);}catch(_0x7ccace){return BPromise[_0xd320('0x22')](_0x7ccace);}return _0x5390d4['save']();};}function saveUpdates(_0x1f2f72,_0x270ea8){return function(_0x355ecc){if(_0x355ecc){return _0x355ecc[_0xd320('0x23')](_0x1f2f72)['then'](function(_0x266d04){return _0x266d04;});}return null;};}function removeEntity(_0x40a7e7,_0x10d876){return function(_0x4b6183){if(_0x4b6183){return _0x4b6183['destroy']()[_0xd320('0x24')](function(){var _0x1c4cf5=_0x4b6183[_0xd320('0x25')]({'plain':!![]});var _0x3aaf16=_0xd320('0x26');return db[_0xd320('0x27')][_0xd320('0x28')]({'where':{'type':_0x3aaf16,'resourceId':_0x1c4cf5['id']}})[_0xd320('0x24')](function(){return _0x4b6183;});})[_0xd320('0x24')](function(){_0x40a7e7[_0xd320('0x1a')](0xcc)[_0xd320('0x1b')]();});}};}function handleEntityNotFound(_0x18cb13,_0x253708){return function(_0x2629a6){if(!_0x2629a6){_0x18cb13[_0xd320('0x19')](0x194);}return _0x2629a6;};}function handleError(_0x4c9c88,_0x32647e){_0x32647e=_0x32647e||0x1f4;return function(_0x329734){logger['error'](_0x329734[_0xd320('0x29')]);if(_0x329734[_0xd320('0x2a')]){delete _0x329734[_0xd320('0x2a')];}_0x4c9c88[_0xd320('0x1a')](_0x32647e)[_0xd320('0x2b')](_0x329734);};}exports[_0xd320('0x2c')]=function(_0x6e8e27,_0x53bd0d){var _0x137b6c={},_0x45af4f={},_0x2b89bc={'count':0x0,'rows':[]};var _0x3ec32c=_[_0xd320('0x2d')](db[_0xd320('0x2e')]['rawAttributes'],function(_0x2f8836){return{'name':_0x2f8836[_0xd320('0x2f')],'type':_0x2f8836[_0xd320('0x30')][_0xd320('0x31')]};});_0x45af4f[_0xd320('0x32')]=_[_0xd320('0x2d')](_0x3ec32c,_0xd320('0x2a'));_0x45af4f[_0xd320('0x33')]=_[_0xd320('0x34')](_0x6e8e27['query']);_0x45af4f['filters']=_[_0xd320('0x35')](_0x45af4f[_0xd320('0x32')],_0x45af4f[_0xd320('0x33')]);_0x137b6c[_0xd320('0x36')]=_[_0xd320('0x35')](_0x45af4f[_0xd320('0x32')],qs[_0xd320('0x37')](_0x6e8e27['query']['fields']));_0x137b6c[_0xd320('0x36')]=_0x137b6c[_0xd320('0x36')]['length']?_0x137b6c[_0xd320('0x36')]:_0x45af4f[_0xd320('0x32')];if(!_0x6e8e27[_0xd320('0x33')][_0xd320('0x38')](_0xd320('0x39'))){_0x137b6c['limit']=qs[_0xd320('0x1e')](_0x6e8e27[_0xd320('0x33')][_0xd320('0x1e')]);_0x137b6c[_0xd320('0x1d')]=qs[_0xd320('0x1d')](_0x6e8e27['query'][_0xd320('0x1d')]);}_0x137b6c[_0xd320('0x3a')]=qs[_0xd320('0x3b')](_0x6e8e27['query']['sort']);_0x137b6c[_0xd320('0x3c')]=qs['filters'](_[_0xd320('0x3d')](_0x6e8e27[_0xd320('0x33')],_0x45af4f[_0xd320('0x3e')]),_0x3ec32c);if(_0x6e8e27[_0xd320('0x33')][_0xd320('0x3f')]){_0x137b6c[_0xd320('0x3c')]=_['merge'](_0x137b6c[_0xd320('0x3c')],{'$or':_[_0xd320('0x2d')](_0x3ec32c,function(_0x1cf114){if(_0x1cf114[_0xd320('0x30')]!==_0xd320('0x40')){var _0x44a91b={};_0x44a91b[_0x1cf114[_0xd320('0x2a')]]={'$like':'%'+_0x6e8e27[_0xd320('0x33')][_0xd320('0x3f')]+'%'};return _0x44a91b;}})});}_0x137b6c=_[_0xd320('0x41')]({},_0x137b6c,_0x6e8e27[_0xd320('0x42')]);var _0xa2f1d5={'where':_0x137b6c['where']};return db[_0xd320('0x2e')]['count'](_0xa2f1d5)[_0xd320('0x24')](function(_0x998556){_0x2b89bc[_0xd320('0x1c')]=_0x998556;if(_0x6e8e27['query'][_0xd320('0x43')]){_0x137b6c['include']=[{'all':!![]}];}return db[_0xd320('0x2e')]['findAll'](_0x137b6c);})[_0xd320('0x24')](function(_0x973740){_0x2b89bc['rows']=_0x973740;return _0x2b89bc;})[_0xd320('0x24')](respondWithFilteredResult(_0x53bd0d,_0x137b6c))[_0xd320('0x44')](handleError(_0x53bd0d,null));};exports['show']=function(_0x1b9dee,_0x143386){var _0x127f33={'raw':![],'where':{'id':_0x1b9dee[_0xd320('0x45')]['id']}},_0x467a62={};_0x467a62[_0xd320('0x32')]=_[_0xd320('0x34')](db[_0xd320('0x2e')][_0xd320('0x46')]);_0x467a62['query']=_[_0xd320('0x34')](_0x1b9dee[_0xd320('0x33')]);_0x467a62[_0xd320('0x3e')]=_[_0xd320('0x35')](_0x467a62[_0xd320('0x32')],_0x467a62['query']);_0x127f33[_0xd320('0x36')]=_[_0xd320('0x35')](_0x467a62['model'],qs[_0xd320('0x37')](_0x1b9dee[_0xd320('0x33')][_0xd320('0x37')]));_0x127f33['attributes']=_0x127f33[_0xd320('0x36')][_0xd320('0x47')]?_0x127f33[_0xd320('0x36')]:_0x467a62[_0xd320('0x32')];if(_0x1b9dee[_0xd320('0x33')][_0xd320('0x43')]){_0x127f33[_0xd320('0x48')]=[{'all':!![]}];}_0x127f33=_[_0xd320('0x41')]({},_0x127f33,_0x1b9dee[_0xd320('0x42')]);return db[_0xd320('0x2e')][_0xd320('0x49')](_0x127f33)['then'](handleEntityNotFound(_0x143386,null))['then'](respondWithResult(_0x143386,null))[_0xd320('0x44')](handleError(_0x143386,null));};exports[_0xd320('0x4a')]=function(_0x11fcec,_0x3ddc87){return db[_0xd320('0x2e')]['create'](_0x11fcec[_0xd320('0x4b')],{})['then'](function(_0x306865){var _0x202fe9=_0x11fcec[_0xd320('0x4c')][_0xd320('0x25')]({'plain':!![]});if(!_0x202fe9)throw new Error(_0xd320('0x4d'));if(_0x202fe9[_0xd320('0x4e')]===_0xd320('0x4c')){var _0x3a13b4=_0x306865[_0xd320('0x25')]({'plain':!![]});var _0x387810=_0xd320('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x387810,'userProfileId':_0x202fe9[_0xd320('0x4f')]},'raw':!![]})[_0xd320('0x24')](function(_0x4f3cdf){if(_0x4f3cdf&&_0x4f3cdf['autoAssociation']===0x0){return db[_0xd320('0x27')][_0xd320('0x4a')]({'name':_0x3a13b4[_0xd320('0x2a')],'resourceId':_0x3a13b4['id'],'type':_0x4f3cdf[_0xd320('0x2a')],'sectionId':_0x4f3cdf['id']},{})[_0xd320('0x24')](function(){return _0x306865;});}else{return _0x306865;}})[_0xd320('0x44')](function(_0x4db3d8){logger[_0xd320('0x50')](_0xd320('0x51'),_0x4db3d8);throw _0x4db3d8;});}return _0x306865;})[_0xd320('0x24')](respondWithResult(_0x3ddc87,0xc9))[_0xd320('0x44')](handleError(_0x3ddc87,null));};exports[_0xd320('0x23')]=function(_0x12a1b5,_0x54db6f){if(_0x12a1b5[_0xd320('0x4b')]['id']){delete _0x12a1b5[_0xd320('0x4b')]['id'];}return db[_0xd320('0x2e')][_0xd320('0x49')]({'where':{'id':_0x12a1b5[_0xd320('0x45')]['id']}})['then'](handleEntityNotFound(_0x54db6f,null))[_0xd320('0x24')](saveUpdates(_0x12a1b5[_0xd320('0x4b')],null))[_0xd320('0x24')](respondWithResult(_0x54db6f,null))[_0xd320('0x44')](handleError(_0x54db6f,null));};exports['destroy']=function(_0x25410a,_0x28e267){return db[_0xd320('0x2e')][_0xd320('0x49')]({'where':{'id':_0x25410a[_0xd320('0x45')]['id']}})['then'](handleEntityNotFound(_0x28e267,null))['then'](removeEntity(_0x28e267,null))[_0xd320('0x44')](handleError(_0x28e267,null));};exports[_0xd320('0x52')]=function(_0x4680c0,_0x470a44,_0x376259){var _0x432c73=require(_0xd320('0x53'));return db[_0xd320('0x2e')][_0xd320('0x49')]({'where':{'id':_0x4680c0[_0xd320('0x45')]['id']},'raw':!![]})[_0xd320('0x24')](handleEntityNotFound(_0x470a44,null))[_0xd320('0x24')](function(){_0x432c73[_0xd320('0x52')](_0x4680c0[_0xd320('0x45')]['id']);})[_0xd320('0x24')](respondWithStatusCode(_0x470a44,null))[_0xd320('0x44')](handleError(_0x470a44,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 74404ba..868347e 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 _0xb441=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb441,0x1e6));var _0x1b44=function(_0x2b136f,_0xc0b6e4){_0x2b136f=_0x2b136f-0x0;var _0x35a30b=_0xb441[_0x2b136f];return _0x35a30b;};'use strict';var _=require(_0x1b44('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1b44('0x1'));var BPromise=require(_0x1b44('0x2'));var rp=require(_0x1b44('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b44('0x4'));var config=require(_0x1b44('0x5'));var attributes=require(_0x1b44('0x6'));module[_0x1b44('0x7')]=function(_0x2f0654,_0x1d3aa9){return _0x2f0654[_0x1b44('0x8')](_0x1b44('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee4d=['exports','Schedule','util','../../config/logger','api','bluebird','request-promise','path','./schedule.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xee4d,0x9b));var _0xdee4=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xee4d[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0xdee4('0x0'));var logger=require(_0xdee4('0x1'))(_0xdee4('0x2'));var moment=require('moment');var BPromise=require(_0xdee4('0x3'));var rp=require(_0xdee4('0x4'));var fs=require('fs');var path=require(_0xdee4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdee4('0x6'));module[_0xdee4('0x7')]=function(_0x18678e,_0x35c0ec){return _0x18678e['define'](_0xdee4('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 67338cc..8aae8ae 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 _0x90a7=['then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x640383,_0x25c5e8){var _0x3673ff=function(_0x14e651){while(--_0x14e651){_0x640383['push'](_0x640383['shift']());}};_0x3673ff(++_0x25c5e8);}(_0x90a7,0x79));var _0x790a=function(_0x323ba9,_0xd97d64){_0x323ba9=_0x323ba9-0x0;var _0x2aca3b=_0x90a7[_0x323ba9];return _0x2aca3b;};'use strict';var _=require(_0x790a('0x0'));var util=require(_0x790a('0x1'));var moment=require(_0x790a('0x2'));var BPromise=require('bluebird');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(_0x790a('0x6'))('rpc');var config=require(_0x790a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x790a('0x8')][_0x790a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301a7e,_0x1a2a87,_0x82d1c5){return new BPromise(function(_0xde07f2,_0x365a94){return client[_0x790a('0xa')](_0x301a7e,_0x82d1c5)[_0x790a('0xb')](function(_0x301895){logger[_0x790a('0xc')]('Schedule,\x20%s,\x20%s',_0x1a2a87,_0x790a('0xd'));logger[_0x790a('0xe')](_0x790a('0xf'),_0x1a2a87,_0x790a('0xd'),JSON[_0x790a('0x10')](_0x301895));if(_0x301895[_0x790a('0x11')]){if(_0x301895[_0x790a('0x11')]['code']===0x1f4){logger[_0x790a('0x11')](_0x790a('0x12'),_0x1a2a87,_0x301895[_0x790a('0x11')][_0x790a('0x13')]);return _0x365a94(_0x301895[_0x790a('0x11')][_0x790a('0x13')]);}logger[_0x790a('0x11')](_0x790a('0x12'),_0x1a2a87,_0x301895[_0x790a('0x11')]['message']);return _0xde07f2(_0x301895[_0x790a('0x11')]['message']);}else{logger[_0x790a('0xc')](_0x790a('0x12'),_0x1a2a87,_0x790a('0xd'));_0xde07f2(_0x301895[_0x790a('0x14')][_0x790a('0x13')]);}})[_0x790a('0x15')](function(_0x4aa5f6){logger[_0x790a('0x11')](_0x790a('0x12'),_0x1a2a87,_0x4aa5f6);_0x365a94(_0x4aa5f6);});});} \ No newline at end of file +var _0x90a9=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird'];(function(_0x909dfe,_0x36e38a){var _0x5cb58f=function(_0x3f3000){while(--_0x3f3000){_0x909dfe['push'](_0x909dfe['shift']());}};_0x5cb58f(++_0x36e38a);}(_0x90a9,0x163));var _0x990a=function(_0x472449,_0x4fc0f1){_0x472449=_0x472449-0x0;var _0x477ddc=_0x90a9[_0x472449];return _0x477ddc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x990a('0x0'));var BPromise=require(_0x990a('0x1'));var rs=require(_0x990a('0x2'));var fs=require('fs');var Redis=require(_0x990a('0x3'));var db=require(_0x990a('0x4'))['db'];var utils=require(_0x990a('0x5'));var logger=require('../../config/logger')(_0x990a('0x6'));var config=require(_0x990a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x990a('0x8')][_0x990a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x197801,_0x573c3a,_0x158bf9){return new BPromise(function(_0x370ff9,_0x8f345f){return client[_0x990a('0xa')](_0x197801,_0x158bf9)[_0x990a('0xb')](function(_0x2e8219){logger[_0x990a('0xc')](_0x990a('0xd'),_0x573c3a,_0x990a('0xe'));logger[_0x990a('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x573c3a,'request\x20sent',JSON[_0x990a('0x10')](_0x2e8219));if(_0x2e8219['error']){if(_0x2e8219[_0x990a('0x11')][_0x990a('0x12')]===0x1f4){logger[_0x990a('0x11')](_0x990a('0xd'),_0x573c3a,_0x2e8219[_0x990a('0x11')][_0x990a('0x13')]);return _0x8f345f(_0x2e8219[_0x990a('0x11')][_0x990a('0x13')]);}logger[_0x990a('0x11')](_0x990a('0xd'),_0x573c3a,_0x2e8219[_0x990a('0x11')][_0x990a('0x13')]);return _0x370ff9(_0x2e8219['error'][_0x990a('0x13')]);}else{logger['info'](_0x990a('0xd'),_0x573c3a,_0x990a('0xe'));_0x370ff9(_0x2e8219['result'][_0x990a('0x13')]);}})[_0x990a('0x14')](function(_0x28dab){logger[_0x990a('0x11')](_0x990a('0xd'),_0x573c3a,_0x28dab);_0x8f345f(_0x28dab);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f2bce6c..9c51103 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 _0x5248=['/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x574192,_0x3aed6b){var _0x3db63d=function(_0x35d4f9){while(--_0x35d4f9){_0x574192['push'](_0x574192['shift']());}};_0x3db63d(++_0x3aed6b);}(_0x5248,0xf0));var _0x8524=function(_0x1e689b,_0x55556c){_0x1e689b=_0x1e689b-0x0;var _0x5e3a21=_0x5248[_0x1e689b];return _0x5e3a21;};'use strict';var multer=require(_0x8524('0x0'));var util=require(_0x8524('0x1'));var path=require(_0x8524('0x2'));var timeout=require(_0x8524('0x3'));var express=require('express');var router=express[_0x8524('0x4')]();var auth=require(_0x8524('0x5'));var interaction=require(_0x8524('0x6'));var config=require('../../config/environment');var controller=require(_0x8524('0x7'));router[_0x8524('0x8')]('/',auth['isAuthenticated'](),controller[_0x8524('0x9')]);router[_0x8524('0x8')](_0x8524('0xa'),auth[_0x8524('0xb')](),controller[_0x8524('0xc')]);router['get'](_0x8524('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8524('0x8')](_0x8524('0xe'),auth[_0x8524('0xb')](),controller[_0x8524('0xf')]);router[_0x8524('0x10')]('/',auth[_0x8524('0xb')](),controller[_0x8524('0x11')]);router[_0x8524('0x12')](_0x8524('0xd'),auth[_0x8524('0xb')](),controller[_0x8524('0x13')]);router[_0x8524('0x14')](_0x8524('0xd'),auth[_0x8524('0xb')](),controller[_0x8524('0x15')]);module[_0x8524('0x16')]=router; \ No newline at end of file +var _0xcda6=['./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0xcda6,0x12d));var _0x6cda=function(_0x15573c,_0xe3b170){_0x15573c=_0x15573c-0x0;var _0x49a2f0=_0xcda6[_0x15573c];return _0x49a2f0;};'use strict';var multer=require(_0x6cda('0x0'));var util=require(_0x6cda('0x1'));var path=require('path');var timeout=require(_0x6cda('0x2'));var express=require(_0x6cda('0x3'));var router=express['Router']();var auth=require(_0x6cda('0x4'));var interaction=require(_0x6cda('0x5'));var config=require(_0x6cda('0x6'));var controller=require(_0x6cda('0x7'));router[_0x6cda('0x8')]('/',auth[_0x6cda('0x9')](),controller['index']);router[_0x6cda('0x8')](_0x6cda('0xa'),auth[_0x6cda('0x9')](),controller[_0x6cda('0xb')]);router[_0x6cda('0x8')](_0x6cda('0xc'),auth[_0x6cda('0x9')](),controller[_0x6cda('0xd')]);router[_0x6cda('0x8')](_0x6cda('0xe'),auth[_0x6cda('0x9')](),controller[_0x6cda('0xf')]);router[_0x6cda('0x10')]('/',auth[_0x6cda('0x9')](),controller[_0x6cda('0x11')]);router[_0x6cda('0x12')]('/:id',auth[_0x6cda('0x9')](),controller[_0x6cda('0x13')]);router[_0x6cda('0x14')](_0x6cda('0xc'),auth[_0x6cda('0x9')](),controller['destroy']);module[_0x6cda('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 23f98a6..2cd1cb4 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 _0xbd50=['setDataValue','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x2c643e,_0x1df76e){_0x2c643e=_0x2c643e-0x0;var _0x5107db=_0xbd50[_0x2c643e];return _0x5107db;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var moment=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var config=require('../../config/environment');module[_0x0bd5('0x3')]={'format':{'type':Sequelize[_0x0bd5('0x4')],'get':function(){return this[_0x0bd5('0x5')](_0x0bd5('0x6'))?path[_0x0bd5('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0bd5('0x8')]},'value':{'type':Sequelize[_0x0bd5('0x8')],'set':function(_0xcc6cfa){var _0x2c0db1=_0xcc6cfa[_0x0bd5('0x9')](/\\/g,'/');this['setDataValue']('value',_0x2c0db1);}},'rating':{'type':Sequelize[_0x0bd5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0bd5('0xa')],'set':function(_0x259f4c){this['setDataValue'](_0x0bd5('0xb'),moment()[_0x0bd5('0xc')](_0x259f4c,'ms'));this['setDataValue'](_0x0bd5('0xd'),moment());this[_0x0bd5('0xe')]('duration',_0x259f4c);}},'startedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xb')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'closedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xd')))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0x13')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')]('updatedAt'))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}}}; \ No newline at end of file +var _0x6aa7=['../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','format','updatedAt','toString','sequelize','path'];(function(_0x296c1a,_0xa87d73){var _0x273bf6=function(_0x48bc52){while(--_0x48bc52){_0x296c1a['push'](_0x296c1a['shift']());}};_0x273bf6(++_0xa87d73);}(_0x6aa7,0x178));var _0x76aa=function(_0x13015c,_0x4ebb51){_0x13015c=_0x13015c-0x0;var _0x30a9ac=_0x6aa7[_0x13015c];return _0x30a9ac;};'use strict';var Sequelize=require(_0x76aa('0x0'));var moment=require('moment');var path=require(_0x76aa('0x1'));var config=require(_0x76aa('0x2'));module[_0x76aa('0x3')]={'format':{'type':Sequelize[_0x76aa('0x4')],'get':function(){return this['getDataValue'](_0x76aa('0x5'))?path[_0x76aa('0x6')](this[_0x76aa('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x76aa('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x32dee5){var _0x36d12b=_0x32dee5[_0x76aa('0x9')](/\\/g,'/');this['setDataValue'](_0x76aa('0x5'),_0x36d12b);}},'rating':{'type':Sequelize[_0x76aa('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x76aa('0xa')],'set':function(_0x557d69){this[_0x76aa('0xb')](_0x76aa('0xc'),moment()[_0x76aa('0xd')](_0x557d69,'ms'));this[_0x76aa('0xb')](_0x76aa('0xe'),moment());this[_0x76aa('0xb')](_0x76aa('0xf'),_0x557d69);}},'startedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this[_0x76aa('0x7')](_0x76aa('0xc')))['format'](_0x76aa('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this[_0x76aa('0x7')](_0x76aa('0xe')))[_0x76aa('0x12')](_0x76aa('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x76aa('0x7')]('createdAt'))[_0x76aa('0x12')](_0x76aa('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this['getDataValue'](_0x76aa('0x13')))['format'](_0x76aa('0x11'))[_0x76aa('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3fcbb87..a294496 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 _0x2a9c=['describe','download','../../components/encryptor','uniqueid','join','%s.cypher','secrets','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','root','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','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','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value'];(function(_0x3f5124,_0xe17bb0){var _0x34d098=function(_0x2be10a){while(--_0x2be10a){_0x3f5124['push'](_0x3f5124['shift']());}};_0x34d098(++_0xe17bb0);}(_0x2a9c,0x1b1));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc2a9('0x0'));var emlformat=require(_0xc2a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc2a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2a9('0x3'));var moment=require(_0xc2a9('0x4'));var BPromise=require(_0xc2a9('0x5'));var Mustache=require(_0xc2a9('0x6'));var util=require(_0xc2a9('0x7'));var path=require(_0xc2a9('0x8'));var sox=require(_0xc2a9('0x9'));var csv=require('to-csv');var ejs=require(_0xc2a9('0xa'));var fs=require('fs');var _=require(_0xc2a9('0xb'));var squel=require(_0xc2a9('0xc'));var crypto=require(_0xc2a9('0xd'));var jsforce=require(_0xc2a9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc2a9('0xf'));var querystring=require('querystring');var Papa=require(_0xc2a9('0x10'));var Redis=require(_0xc2a9('0x11'));var authService=require(_0xc2a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc2a9('0x13'));var hardwareService=require(_0xc2a9('0x14'));var logger=require(_0xc2a9('0x15'))(_0xc2a9('0x16'));var utils=require(_0xc2a9('0x17'));var config=require(_0xc2a9('0x18'));var licenseUtil=require(_0xc2a9('0x19'));var db=require(_0xc2a9('0x1a'))['db'];function respondWithStatusCode(_0x5d3947,_0x27d125){_0x27d125=_0x27d125||0xcc;return function(_0x1757f5){if(_0x1757f5){return _0x5d3947['sendStatus'](_0x27d125);}return _0x5d3947[_0xc2a9('0x1b')](_0x27d125)[_0xc2a9('0x1c')]();};}function respondWithResult(_0x5da8dc,_0x48c7b3){_0x48c7b3=_0x48c7b3||0xc8;return function(_0x4bd4d8){if(_0x4bd4d8){return _0x5da8dc[_0xc2a9('0x1b')](_0x48c7b3)[_0xc2a9('0x1d')](_0x4bd4d8);}};}function respondWithFilteredResult(_0x59e560,_0x86ccb7){return function(_0x217a14){if(_0x217a14){var _0x130b77=_0x217a14['count'],_0xc06f59=_0x86ccb7[_0xc2a9('0x1e')],_0x39445c=_0x86ccb7[_0xc2a9('0x1e')]+_0x86ccb7['limit'],_0x5085a9;if(_0x39445c>=_0x130b77){_0x39445c=_0x130b77;_0x5085a9=0xc8;}else{_0x5085a9=0xce;}_0x59e560[_0xc2a9('0x1b')](_0x5085a9);return _0x59e560[_0xc2a9('0x1f')](_0xc2a9('0x20'),_0xc06f59+'-'+_0x39445c+'/'+_0x130b77)[_0xc2a9('0x1d')](_0x217a14);}return null;};}function patchUpdates(_0x45b043){return function(_0x59b7a2){try{jsonpatch[_0xc2a9('0x21')](_0x59b7a2,_0x45b043,!![]);}catch(_0x42ae7a){return BPromise['reject'](_0x42ae7a);}return _0x59b7a2[_0xc2a9('0x22')]();};}function saveUpdates(_0x188ca6,_0x3d6485){return function(_0x56316e){if(_0x56316e){return _0x56316e[_0xc2a9('0x23')](_0x188ca6)[_0xc2a9('0x24')](function(_0x5d4ee1){return _0x5d4ee1;});}return null;};}function removeEntity(_0x25772c,_0x281f57){return function(_0x5ef8d4){if(_0x5ef8d4){return _0x5ef8d4[_0xc2a9('0x25')]()[_0xc2a9('0x24')](function(){_0x25772c[_0xc2a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2109bf,_0x32f03f){return function(_0x18f910){if(!_0x18f910){_0x2109bf[_0xc2a9('0x26')](0x194);}return _0x18f910;};}function handleError(_0x5f3444,_0x1194b6){_0x1194b6=_0x1194b6||0x1f4;return function(_0x5e40a3){logger[_0xc2a9('0x27')](_0x5e40a3[_0xc2a9('0x28')]);if(_0x5e40a3[_0xc2a9('0x29')]){delete _0x5e40a3[_0xc2a9('0x29')];}_0x5f3444[_0xc2a9('0x1b')](_0x1194b6)['send'](_0x5e40a3);};}exports['index']=function(_0x2e872f,_0x51864e){var _0x365ecd={},_0x287788={},_0x19e71b={'count':0x0,'rows':[]};var _0x5a62d4=_[_0xc2a9('0x2a')](db[_0xc2a9('0x2b')][_0xc2a9('0x2c')],function(_0x5a80e0){return{'name':_0x5a80e0['fieldName'],'type':_0x5a80e0[_0xc2a9('0x2d')]['key']};});_0x287788[_0xc2a9('0x2e')]=_[_0xc2a9('0x2f')](_[_0xc2a9('0x2a')](_0x5a62d4,_0xc2a9('0x29')),[_0xc2a9('0x30')]);_0x287788['query']=_[_0xc2a9('0x31')](_0x2e872f[_0xc2a9('0x32')]);_0x287788['filters']=_[_0xc2a9('0x33')](_0x287788[_0xc2a9('0x2e')],_0x287788[_0xc2a9('0x32')]);_0x365ecd[_0xc2a9('0x34')]=_[_0xc2a9('0x33')](_0x287788[_0xc2a9('0x2e')],qs[_0xc2a9('0x35')](_0x2e872f[_0xc2a9('0x32')][_0xc2a9('0x35')]));_0x365ecd['attributes']=_0x365ecd['attributes'][_0xc2a9('0x36')]?_0x365ecd['attributes']:_0x287788['model'];if(!_0x2e872f[_0xc2a9('0x32')][_0xc2a9('0x37')](_0xc2a9('0x38'))){_0x365ecd[_0xc2a9('0x39')]=qs[_0xc2a9('0x39')](_0x2e872f[_0xc2a9('0x32')][_0xc2a9('0x39')]);_0x365ecd[_0xc2a9('0x1e')]=qs[_0xc2a9('0x1e')](_0x2e872f['query'][_0xc2a9('0x1e')]);}_0x365ecd['order']=qs['sort'](_0x2e872f['query'][_0xc2a9('0x3a')]);_0x365ecd[_0xc2a9('0x3b')]=qs[_0xc2a9('0x3c')](_['pick'](_0x2e872f[_0xc2a9('0x32')],_0x287788['filters']),_0x5a62d4);if(_0x2e872f[_0xc2a9('0x32')][_0xc2a9('0x3d')]){_0x365ecd['where']=_[_0xc2a9('0x3e')](_0x365ecd[_0xc2a9('0x3b')],{'$or':_[_0xc2a9('0x2a')](_0x5a62d4,function(_0x223a5b){if(_0x223a5b[_0xc2a9('0x2d')]!=='VIRTUAL'){var _0xfa0fa9={};_0xfa0fa9[_0x223a5b[_0xc2a9('0x29')]]={'$like':'%'+_0x2e872f[_0xc2a9('0x32')]['filter']+'%'};return _0xfa0fa9;}})});}_0x365ecd=_[_0xc2a9('0x3e')]({},_0x365ecd,_0x2e872f[_0xc2a9('0x3f')]);var _0x236577={'where':_0x365ecd[_0xc2a9('0x3b')]};return db[_0xc2a9('0x2b')]['count'](_0x236577)[_0xc2a9('0x24')](function(_0x29edc7){_0x19e71b['count']=_0x29edc7;if(_0x2e872f['query'][_0xc2a9('0x40')]){_0x365ecd[_0xc2a9('0x41')]=[{'all':!![]}];}return db[_0xc2a9('0x2b')]['findAll'](_0x365ecd);})[_0xc2a9('0x24')](function(_0x5b7a36){_0x19e71b[_0xc2a9('0x42')]=_0x5b7a36;return _0x19e71b;})[_0xc2a9('0x24')](respondWithFilteredResult(_0x51864e,_0x365ecd))[_0xc2a9('0x43')](handleError(_0x51864e,null));};exports[_0xc2a9('0x44')]=function(_0x35a79a,_0x159ab3){var _0x5b7741={'raw':![],'where':{'id':_0x35a79a[_0xc2a9('0x45')]['id']}},_0x35e570={};_0x35e570[_0xc2a9('0x2e')]=_['keys'](db['ScreenRecording'][_0xc2a9('0x2c')]);_0x35e570[_0xc2a9('0x32')]=_[_0xc2a9('0x31')](_0x35a79a[_0xc2a9('0x32')]);_0x35e570[_0xc2a9('0x3c')]=_[_0xc2a9('0x33')](_0x35e570[_0xc2a9('0x2e')],_0x35e570[_0xc2a9('0x32')]);_0x5b7741['attributes']=_[_0xc2a9('0x33')](_0x35e570[_0xc2a9('0x2e')],qs['fields'](_0x35a79a[_0xc2a9('0x32')][_0xc2a9('0x35')]));_0x5b7741[_0xc2a9('0x34')]=_0x5b7741[_0xc2a9('0x34')][_0xc2a9('0x36')]?_0x5b7741[_0xc2a9('0x34')]:_0x35e570[_0xc2a9('0x2e')];if(_0x35a79a[_0xc2a9('0x32')]['includeAll']){_0x5b7741[_0xc2a9('0x41')]=[{'all':!![]}];}_0x5b7741=_[_0xc2a9('0x3e')]({},_0x5b7741,_0x35a79a[_0xc2a9('0x3f')]);return db['ScreenRecording'][_0xc2a9('0x46')](_0x5b7741)['then'](handleEntityNotFound(_0x159ab3,null))[_0xc2a9('0x24')](respondWithResult(_0x159ab3,null))[_0xc2a9('0x43')](handleError(_0x159ab3,null));};exports[_0xc2a9('0x47')]=function(_0x8eedd7,_0x485399){return db['ScreenRecording'][_0xc2a9('0x47')](_0x8eedd7['body'],{})[_0xc2a9('0x24')](respondWithResult(_0x485399,0xc9))[_0xc2a9('0x43')](handleError(_0x485399,null));};exports[_0xc2a9('0x23')]=function(_0x584de0,_0xeca3c8){if(_0x584de0[_0xc2a9('0x48')]['id']){delete _0x584de0[_0xc2a9('0x48')]['id'];}delete _0x584de0['body'][_0xc2a9('0x49')];delete _0x584de0[_0xc2a9('0x48')][_0xc2a9('0x4a')];delete _0x584de0[_0xc2a9('0x48')][_0xc2a9('0x4b')];delete _0x584de0['body'][_0xc2a9('0x4c')];return db['ScreenRecording']['find']({'where':{'id':_0x584de0[_0xc2a9('0x45')]['id']}})[_0xc2a9('0x24')](handleEntityNotFound(_0xeca3c8,null))['then'](saveUpdates(_0x584de0[_0xc2a9('0x48')],null))[_0xc2a9('0x24')](respondWithResult(_0xeca3c8,null))[_0xc2a9('0x43')](handleError(_0xeca3c8,null));};exports[_0xc2a9('0x4d')]=function(_0x5e8670,_0x49d6ca){return db[_0xc2a9('0x2b')][_0xc2a9('0x4d')]()[_0xc2a9('0x24')](respondWithResult(_0x49d6ca,null))[_0xc2a9('0x43')](handleError(_0x49d6ca,null));};exports[_0xc2a9('0x4e')]=function(_0x5c73ae,_0x56746e,_0x41b0cf){var _0xacbd7f=require(_0xc2a9('0x4f'));var _0x21e36a=![];var _0x117ab9={};if(_0x5c73ae['query'][_0xc2a9('0x2d')]&&_0x5c73ae[_0xc2a9('0x32')][_0xc2a9('0x2d')]===_0xc2a9('0x50')){_0x117ab9['uniqueid']=_0x5c73ae[_0xc2a9('0x45')]['id'];}else{_0x117ab9['id']=_0x5c73ae[_0xc2a9('0x45')]['id'];}return db['ScreenRecording'][_0xc2a9('0x46')]({'where':_0x117ab9,'attributes':['id',_0xc2a9('0x4c')],'raw':!![]})[_0xc2a9('0x24')](handleEntityNotFound(_0x56746e,null))[_0xc2a9('0x24')](function(_0x521f1f){if(_0x521f1f){var _0x37a44e=path[_0xc2a9('0x51')](config['root'],'server/files/screen_recordings',_0x521f1f['value']);var _0x2462df=util[_0xc2a9('0x30')](_0xc2a9('0x52'),_0x37a44e);if(fs['existsSync'](_0x2462df)){_0x21e36a=!![];return _0xacbd7f['decryptFile'](_0x2462df,_0x37a44e,config[_0xc2a9('0x53')]['recording'])[_0xc2a9('0x24')](function(){return _0x521f1f;});}return _0x521f1f;}})[_0xc2a9('0x24')](function(_0x39c775){if(_0x39c775){var _0x4acfe9=path['join'](config['root'],_0xc2a9('0x54'),_0x39c775[_0xc2a9('0x4c')]);if(!fs[_0xc2a9('0x55')](_0x4acfe9)){throw new db['Sequelize'][(_0xc2a9('0x56'))](_0xc2a9('0x57'));}if(_0x39c775['filename']){return _0x56746e[_0xc2a9('0x4e')](_0x4acfe9,_0x39c775[_0xc2a9('0x58')]+path[_0xc2a9('0x59')](_0x4acfe9),function(){if(_0x21e36a){fs['unlink'](_0x4acfe9);}});}else{return _0x56746e[_0xc2a9('0x4e')](_0x4acfe9,function(_0x3f7597){if(_0x21e36a){fs[_0xc2a9('0x5a')](_0x4acfe9);}});}}})['catch'](function(_0x9d228a){if(_0x9d228a[_0xc2a9('0x5b')]===_0xc2a9('0x57')){_0x56746e[_0xc2a9('0x1b')](0x194)[_0xc2a9('0x5c')](_0xc2a9('0x5d'));}else{return handleError(_0x56746e,null);}});};exports[_0xc2a9('0x25')]=function(_0x41041c,_0x2394ba){return db[_0xc2a9('0x2b')][_0xc2a9('0x46')]({'where':{'id':_0x41041c[_0xc2a9('0x45')]['id']}})['then'](function(_0xc8ae80){if(!_0xc8ae80)throw new ReferenceError('Entity\x20not\x20found');return _0xc8ae80;})[_0xc2a9('0x24')](function(_0x2fbddf){var _0x4172fd=path['join'](config[_0xc2a9('0x5e')],_0xc2a9('0x54'),_0x2fbddf[_0xc2a9('0x4c')]);logger['info'](_0xc2a9('0x5f'),_0x4172fd);if(!_['isNil'](_0x2fbddf[_0xc2a9('0x4c')])&&fs[_0xc2a9('0x55')](_0x4172fd)){logger[_0xc2a9('0x60')]('File:\x20\x22'+_0x4172fd+_0xc2a9('0x61'));fs[_0xc2a9('0x62')](_0x4172fd);}_0x4172fd=_0x4172fd+_0xc2a9('0x63');if(!_[_0xc2a9('0x64')](_0x2fbddf[_0xc2a9('0x4c')])&&fs['existsSync'](_0x4172fd)){logger[_0xc2a9('0x60')](_0xc2a9('0x65')+_0x4172fd+_0xc2a9('0x61'));fs[_0xc2a9('0x62')](_0x4172fd);}return _0x2fbddf;})['then'](function(_0x55ef74){if(!_0x55ef74)throw new InternalError();return _0x55ef74['destroy']();})[_0xc2a9('0x24')](function(){_0x2394ba[_0xc2a9('0x1b')](0xcc)[_0xc2a9('0x1c')]();})['catch'](handleError(_0x2394ba,null));}; \ No newline at end of file +var _0xf67f=['limit','apply','reject','update','then','sendStatus','error','name','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','catch','show','intersection','includeAll','options','find','create','body','duration','createdAt','params','describe','download','../../components/encryptor','uniqueid','join','root','value','format','%s.cypher','existsSync','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x40c007,_0x38872d){var _0x368548=function(_0x39594b){while(--_0x39594b){_0x40c007['push'](_0x40c007['shift']());}};_0x368548(++_0x38872d);}(_0xf67f,0x1df));var _0xff67=function(_0x2bcdf4,_0x1a2f20){_0x2bcdf4=_0x2bcdf4-0x0;var _0x4a0f7a=_0xf67f[_0x2bcdf4];return _0x4a0f7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff67('0x1'));var jsonpatch=require(_0xff67('0x2'));var rp=require(_0xff67('0x3'));var moment=require(_0xff67('0x4'));var BPromise=require(_0xff67('0x5'));var Mustache=require(_0xff67('0x6'));var util=require(_0xff67('0x7'));var path=require('path');var sox=require(_0xff67('0x8'));var csv=require(_0xff67('0x9'));var ejs=require(_0xff67('0xa'));var fs=require('fs');var _=require(_0xff67('0xb'));var squel=require(_0xff67('0xc'));var crypto=require('crypto');var jsforce=require(_0xff67('0xd'));var deskjs=require(_0xff67('0xe'));var toCsv=require(_0xff67('0x9'));var querystring=require(_0xff67('0xf'));var Papa=require(_0xff67('0x10'));var Redis=require(_0xff67('0x11'));var authService=require(_0xff67('0x12'));var qs=require(_0xff67('0x13'));var as=require(_0xff67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff67('0x15'))(_0xff67('0x16'));var utils=require(_0xff67('0x17'));var config=require(_0xff67('0x18'));var licenseUtil=require(_0xff67('0x19'));var db=require(_0xff67('0x1a'))['db'];function respondWithStatusCode(_0x54eead,_0x25a01f){_0x25a01f=_0x25a01f||0xcc;return function(_0x301293){if(_0x301293){return _0x54eead['sendStatus'](_0x25a01f);}return _0x54eead[_0xff67('0x1b')](_0x25a01f)[_0xff67('0x1c')]();};}function respondWithResult(_0x367216,_0x1d4629){_0x1d4629=_0x1d4629||0xc8;return function(_0x445862){if(_0x445862){return _0x367216[_0xff67('0x1b')](_0x1d4629)[_0xff67('0x1d')](_0x445862);}};}function respondWithFilteredResult(_0x16c819,_0xfa9a4){return function(_0x25d57d){if(_0x25d57d){var _0x1b1569=_0x25d57d['count'],_0x57cd01=_0xfa9a4['offset'],_0x175948=_0xfa9a4[_0xff67('0x1e')]+_0xfa9a4[_0xff67('0x1f')],_0x4c9600;if(_0x175948>=_0x1b1569){_0x175948=_0x1b1569;_0x4c9600=0xc8;}else{_0x4c9600=0xce;}_0x16c819[_0xff67('0x1b')](_0x4c9600);return _0x16c819['set']('Content-Range',_0x57cd01+'-'+_0x175948+'/'+_0x1b1569)[_0xff67('0x1d')](_0x25d57d);}return null;};}function patchUpdates(_0x4da1e2){return function(_0x267f07){try{jsonpatch[_0xff67('0x20')](_0x267f07,_0x4da1e2,!![]);}catch(_0x17ab98){return BPromise[_0xff67('0x21')](_0x17ab98);}return _0x267f07['save']();};}function saveUpdates(_0xd60dfa,_0x12da8d){return function(_0x359daf){if(_0x359daf){return _0x359daf[_0xff67('0x22')](_0xd60dfa)['then'](function(_0x518728){return _0x518728;});}return null;};}function removeEntity(_0x43ce88,_0x171cae){return function(_0x4fac29){if(_0x4fac29){return _0x4fac29['destroy']()[_0xff67('0x23')](function(){_0x43ce88['status'](0xcc)[_0xff67('0x1c')]();});}};}function handleEntityNotFound(_0x68b92,_0x3d7944){return function(_0x5e091f){if(!_0x5e091f){_0x68b92[_0xff67('0x24')](0x194);}return _0x5e091f;};}function handleError(_0x254b45,_0x3f26d4){_0x3f26d4=_0x3f26d4||0x1f4;return function(_0x35cd5b){logger[_0xff67('0x25')](_0x35cd5b['stack']);if(_0x35cd5b[_0xff67('0x26')]){delete _0x35cd5b[_0xff67('0x26')];}_0x254b45[_0xff67('0x1b')](_0x3f26d4)['send'](_0x35cd5b);};}exports['index']=function(_0x290901,_0x3fb163){var _0x358313={},_0x574b2a={},_0x1cae61={'count':0x0,'rows':[]};var _0x31e31b=_['map'](db[_0xff67('0x27')][_0xff67('0x28')],function(_0x27ce8a){return{'name':_0x27ce8a[_0xff67('0x29')],'type':_0x27ce8a[_0xff67('0x2a')][_0xff67('0x2b')]};});_0x574b2a[_0xff67('0x2c')]=_[_0xff67('0x2d')](_[_0xff67('0x2e')](_0x31e31b,_0xff67('0x26')),['format']);_0x574b2a['query']=_[_0xff67('0x2f')](_0x290901[_0xff67('0x30')]);_0x574b2a[_0xff67('0x31')]=_['intersection'](_0x574b2a[_0xff67('0x2c')],_0x574b2a[_0xff67('0x30')]);_0x358313[_0xff67('0x32')]=_['intersection'](_0x574b2a[_0xff67('0x2c')],qs[_0xff67('0x33')](_0x290901[_0xff67('0x30')][_0xff67('0x33')]));_0x358313[_0xff67('0x32')]=_0x358313[_0xff67('0x32')][_0xff67('0x34')]?_0x358313['attributes']:_0x574b2a[_0xff67('0x2c')];if(!_0x290901[_0xff67('0x30')]['hasOwnProperty'](_0xff67('0x35'))){_0x358313[_0xff67('0x1f')]=qs[_0xff67('0x1f')](_0x290901[_0xff67('0x30')][_0xff67('0x1f')]);_0x358313[_0xff67('0x1e')]=qs[_0xff67('0x1e')](_0x290901[_0xff67('0x30')]['offset']);}_0x358313[_0xff67('0x36')]=qs[_0xff67('0x37')](_0x290901[_0xff67('0x30')][_0xff67('0x37')]);_0x358313[_0xff67('0x38')]=qs[_0xff67('0x31')](_[_0xff67('0x39')](_0x290901[_0xff67('0x30')],_0x574b2a[_0xff67('0x31')]),_0x31e31b);if(_0x290901[_0xff67('0x30')][_0xff67('0x3a')]){_0x358313['where']=_[_0xff67('0x3b')](_0x358313['where'],{'$or':_[_0xff67('0x2e')](_0x31e31b,function(_0x1b4aba){if(_0x1b4aba[_0xff67('0x2a')]!==_0xff67('0x3c')){var _0x538b5f={};_0x538b5f[_0x1b4aba[_0xff67('0x26')]]={'$like':'%'+_0x290901[_0xff67('0x30')][_0xff67('0x3a')]+'%'};return _0x538b5f;}})});}_0x358313=_[_0xff67('0x3b')]({},_0x358313,_0x290901['options']);var _0x4843e6={'where':_0x358313[_0xff67('0x38')]};return db[_0xff67('0x27')][_0xff67('0x3d')](_0x4843e6)['then'](function(_0x26ce36){_0x1cae61[_0xff67('0x3d')]=_0x26ce36;if(_0x290901[_0xff67('0x30')]['includeAll']){_0x358313[_0xff67('0x3e')]=[{'all':!![]}];}return db[_0xff67('0x27')][_0xff67('0x3f')](_0x358313);})['then'](function(_0x4b323a){_0x1cae61['rows']=_0x4b323a;return _0x1cae61;})['then'](respondWithFilteredResult(_0x3fb163,_0x358313))[_0xff67('0x40')](handleError(_0x3fb163,null));};exports[_0xff67('0x41')]=function(_0x3bac9c,_0x358ccc){var _0x13717={'raw':![],'where':{'id':_0x3bac9c['params']['id']}},_0xfaafc9={};_0xfaafc9[_0xff67('0x2c')]=_[_0xff67('0x2f')](db[_0xff67('0x27')]['rawAttributes']);_0xfaafc9[_0xff67('0x30')]=_[_0xff67('0x2f')](_0x3bac9c['query']);_0xfaafc9[_0xff67('0x31')]=_[_0xff67('0x42')](_0xfaafc9[_0xff67('0x2c')],_0xfaafc9[_0xff67('0x30')]);_0x13717['attributes']=_[_0xff67('0x42')](_0xfaafc9[_0xff67('0x2c')],qs['fields'](_0x3bac9c[_0xff67('0x30')][_0xff67('0x33')]));_0x13717[_0xff67('0x32')]=_0x13717[_0xff67('0x32')][_0xff67('0x34')]?_0x13717['attributes']:_0xfaafc9[_0xff67('0x2c')];if(_0x3bac9c['query'][_0xff67('0x43')]){_0x13717['include']=[{'all':!![]}];}_0x13717=_['merge']({},_0x13717,_0x3bac9c[_0xff67('0x44')]);return db[_0xff67('0x27')][_0xff67('0x45')](_0x13717)[_0xff67('0x23')](handleEntityNotFound(_0x358ccc,null))[_0xff67('0x23')](respondWithResult(_0x358ccc,null))[_0xff67('0x40')](handleError(_0x358ccc,null));};exports[_0xff67('0x46')]=function(_0x33f283,_0x2fe55f){return db[_0xff67('0x27')]['create'](_0x33f283[_0xff67('0x47')],{})[_0xff67('0x23')](respondWithResult(_0x2fe55f,0xc9))[_0xff67('0x40')](handleError(_0x2fe55f,null));};exports[_0xff67('0x22')]=function(_0x3e5e6e,_0xa611a2){if(_0x3e5e6e['body']['id']){delete _0x3e5e6e[_0xff67('0x47')]['id'];}delete _0x3e5e6e['body'][_0xff67('0x48')];delete _0x3e5e6e[_0xff67('0x47')][_0xff67('0x49')];delete _0x3e5e6e[_0xff67('0x47')]['closedAt'];delete _0x3e5e6e[_0xff67('0x47')]['value'];return db[_0xff67('0x27')][_0xff67('0x45')]({'where':{'id':_0x3e5e6e[_0xff67('0x4a')]['id']}})[_0xff67('0x23')](handleEntityNotFound(_0xa611a2,null))[_0xff67('0x23')](saveUpdates(_0x3e5e6e[_0xff67('0x47')],null))[_0xff67('0x23')](respondWithResult(_0xa611a2,null))[_0xff67('0x40')](handleError(_0xa611a2,null));};exports[_0xff67('0x4b')]=function(_0x325971,_0x50355a){return db[_0xff67('0x27')]['describe']()['then'](respondWithResult(_0x50355a,null))[_0xff67('0x40')](handleError(_0x50355a,null));};exports[_0xff67('0x4c')]=function(_0x58d135,_0x3b1c2a,_0x516720){var _0x3f9197=require(_0xff67('0x4d'));var _0x2e7fb0=![];var _0x39eaed={};if(_0x58d135['query']['type']&&_0x58d135[_0xff67('0x30')][_0xff67('0x2a')]===_0xff67('0x4e')){_0x39eaed['uniqueid']=_0x58d135['params']['id'];}else{_0x39eaed['id']=_0x58d135[_0xff67('0x4a')]['id'];}return db[_0xff67('0x27')][_0xff67('0x45')]({'where':_0x39eaed,'attributes':['id','value'],'raw':!![]})[_0xff67('0x23')](handleEntityNotFound(_0x3b1c2a,null))[_0xff67('0x23')](function(_0x22c64d){if(_0x22c64d){var _0x2907b2=path[_0xff67('0x4f')](config[_0xff67('0x50')],'server/files/screen_recordings',_0x22c64d[_0xff67('0x51')]);var _0x393b78=util[_0xff67('0x52')](_0xff67('0x53'),_0x2907b2);if(fs[_0xff67('0x54')](_0x393b78)){_0x2e7fb0=!![];return _0x3f9197['decryptFile'](_0x393b78,_0x2907b2,config[_0xff67('0x55')]['recording'])[_0xff67('0x23')](function(){return _0x22c64d;});}return _0x22c64d;}})['then'](function(_0x173a5f){if(_0x173a5f){var _0x146fb1=path[_0xff67('0x4f')](config[_0xff67('0x50')],'server/files/screen_recordings',_0x173a5f['value']);if(!fs[_0xff67('0x54')](_0x146fb1)){throw new db[(_0xff67('0x56'))][(_0xff67('0x57'))](_0xff67('0x58'));}if(_0x173a5f['filename']){return _0x3b1c2a[_0xff67('0x4c')](_0x146fb1,_0x173a5f[_0xff67('0x59')]+path[_0xff67('0x5a')](_0x146fb1),function(){if(_0x2e7fb0){fs['unlink'](_0x146fb1);}});}else{return _0x3b1c2a[_0xff67('0x4c')](_0x146fb1,function(_0x1ce22c){if(_0x2e7fb0){fs[_0xff67('0x5b')](_0x146fb1);}});}}})[_0xff67('0x40')](function(_0x2e5431){if(_0x2e5431['message']===_0xff67('0x58')){_0x3b1c2a[_0xff67('0x1b')](0x194)[_0xff67('0x5c')]('Not\x20found');}else{return handleError(_0x3b1c2a,null);}});};exports['destroy']=function(_0x538d12,_0x1e063f){return db[_0xff67('0x27')][_0xff67('0x45')]({'where':{'id':_0x538d12[_0xff67('0x4a')]['id']}})[_0xff67('0x23')](function(_0x2fed28){if(!_0x2fed28)throw new ReferenceError('Entity\x20not\x20found');return _0x2fed28;})[_0xff67('0x23')](function(_0x3b7bc7){var _0x3fd410=path[_0xff67('0x4f')](config['root'],_0xff67('0x5d'),_0x3b7bc7['value']);logger['info'](_0xff67('0x5e'),_0x3fd410);if(!_[_0xff67('0x5f')](_0x3b7bc7[_0xff67('0x51')])&&fs[_0xff67('0x54')](_0x3fd410)){logger['info'](_0xff67('0x60')+_0x3fd410+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xff67('0x61')](_0x3fd410);}_0x3fd410=_0x3fd410+_0xff67('0x62');if(!_[_0xff67('0x5f')](_0x3b7bc7[_0xff67('0x51')])&&fs[_0xff67('0x54')](_0x3fd410)){logger[_0xff67('0x63')](_0xff67('0x60')+_0x3fd410+_0xff67('0x64'));fs[_0xff67('0x61')](_0x3fd410);}return _0x3b7bc7;})[_0xff67('0x23')](function(_0x23b987){if(!_0x23b987)throw new InternalError();return _0x23b987[_0xff67('0x65')]();})['then'](function(){_0x1e063f[_0xff67('0x1b')](0xcc)[_0xff67('0x1c')]();})[_0xff67('0x40')](handleError(_0x1e063f,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 470700e..2311230 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 _0xfa47=['interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xfa47,0x139));var _0x7fa4=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0xfa47[_0x404eed];return _0xd45887;};'use strict';var _=require(_0x7fa4('0x0'));var util=require('util');var logger=require(_0x7fa4('0x1'))(_0x7fa4('0x2'));var moment=require(_0x7fa4('0x3'));var BPromise=require(_0x7fa4('0x4'));var rp=require(_0x7fa4('0x5'));var fs=require('fs');var path=require(_0x7fa4('0x6'));var rimraf=require(_0x7fa4('0x7'));var config=require('../../config/environment');var attributes=require(_0x7fa4('0x8'));module[_0x7fa4('0x9')]=function(_0x54da63,_0x4419c7){return _0x54da63[_0x7fa4('0xa')](_0x7fa4('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x7fa4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfff9=['exports','define','ScreenRecording','screen_recordings','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x454309,_0x4c4041){var _0x5ebb89=function(_0x558ea9){while(--_0x558ea9){_0x454309['push'](_0x454309['shift']());}};_0x5ebb89(++_0x4c4041);}(_0xfff9,0x100));var _0x9fff=function(_0x48ada8,_0x578d35){_0x48ada8=_0x48ada8-0x0;var _0x178ad1=_0xfff9[_0x48ada8];return _0x178ad1;};'use strict';var _=require(_0x9fff('0x0'));var util=require(_0x9fff('0x1'));var logger=require(_0x9fff('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9fff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fff('0x4'));var rimraf=require(_0x9fff('0x5'));var config=require(_0x9fff('0x6'));var attributes=require(_0x9fff('0x7'));module[_0x9fff('0x8')]=function(_0xc87b85,_0x1bb186){return _0xc87b85[_0x9fff('0x9')](_0x9fff('0xa'),attributes,{'tableName':_0x9fff('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 70a062e..9c65258 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3a4f7a,_0x1d8ce){var _0x3b57bd=function(_0x4a0f51){while(--_0x4a0f51){_0x3a4f7a['push'](_0x3a4f7a['shift']());}};_0x3b57bd(++_0x1d8ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5aa3f5,_0xa2fe2){var _0x24b052=function(_0x24551a){while(--_0x24551a){_0x5aa3f5['push'](_0x5aa3f5['shift']());}};_0x24b052(++_0xa2fe2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d6850ce..d1f0314 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 _0xf4be=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','join','single','addLogoLogin','preferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util'];(function(_0x32b919,_0x88b414){var _0x30e5e4=function(_0x1531b4){while(--_0x1531b4){_0x32b919['push'](_0x32b919['shift']());}};_0x30e5e4(++_0x88b414);}(_0xf4be,0x12b));var _0xef4b=function(_0x1025b2,_0x29f383){_0x1025b2=_0x1025b2-0x0;var _0x648986=_0xf4be[_0x1025b2];return _0x648986;};'use strict';var multer=require(_0xef4b('0x0'));var util=require(_0xef4b('0x1'));var path=require(_0xef4b('0x2'));var timeout=require(_0xef4b('0x3'));var express=require(_0xef4b('0x4'));var router=express[_0xef4b('0x5')]();var auth=require(_0xef4b('0x6'));var interaction=require(_0xef4b('0x7'));var config=require(_0xef4b('0x8'));var controller=require(_0xef4b('0x9'));router[_0xef4b('0xa')]('/',auth['isAuthenticated'](),controller[_0xef4b('0xb')]);router['get']('/now',controller[_0xef4b('0xc')]);router[_0xef4b('0xa')](_0xef4b('0xd'),controller[_0xef4b('0xe')]);router[_0xef4b('0xa')](_0xef4b('0xf'),controller['getLogo']);router[_0xef4b('0xa')](_0xef4b('0x10'),controller[_0xef4b('0x11')]);router['get'](_0xef4b('0x12'),controller[_0xef4b('0x13')]);router[_0xef4b('0xa')](_0xef4b('0x14'),controller[_0xef4b('0x15')]);router[_0xef4b('0xa')](_0xef4b('0x16'),controller[_0xef4b('0x17')]);var upload=multer({'storage':multer[_0xef4b('0x18')]({'destination':function(_0x5d9908,_0x256090,_0x5cedd0){_0x5cedd0(null,path['join'](config[_0xef4b('0x19')],_0xef4b('0x1a')));},'filename':function(_0x573947,_0x2cee7f,_0x782f91){_0x782f91(null,util[_0xef4b('0x1b')](_0xef4b('0x1c'),_0xef4b('0x1d'),path[_0xef4b('0x1e')](_0x2cee7f[_0xef4b('0x1f')])));}})});router[_0xef4b('0x20')](_0xef4b('0xf'),upload['single'](_0xef4b('0x21')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xad05da,_0xba8c81,_0x116b61){_0x116b61(null,path[_0xef4b('0x22')](config[_0xef4b('0x19')],'server/files/images/logos/'));},'filename':function(_0x59a2c1,_0x541656,_0x580a98){_0x580a98(null,util[_0xef4b('0x1b')](_0xef4b('0x1c'),'logologin',path[_0xef4b('0x1e')](_0x541656[_0xef4b('0x1f')])));}})});router[_0xef4b('0x20')]('/:id/logo_login',upload[_0xef4b('0x23')](_0xef4b('0x21')),controller[_0xef4b('0x24')]);var upload=multer({'storage':multer[_0xef4b('0x18')]({'destination':function(_0x237262,_0x1fa4c4,_0x3a9bea){_0x3a9bea(null,path[_0xef4b('0x22')](config[_0xef4b('0x19')],'server/files/images/logos/'));},'filename':function(_0x57cc5d,_0x2727f7,_0x25093d){_0x25093d(null,util[_0xef4b('0x1b')]('%s%s',_0xef4b('0x25'),path[_0xef4b('0x1e')](_0x2727f7[_0xef4b('0x1f')])));}})});router['post'](_0xef4b('0x14'),upload[_0xef4b('0x23')](_0xef4b('0x21')),controller['addPreferred']);var upload=multer({'storage':multer[_0xef4b('0x18')]({'destination':function(_0x25d7df,_0x4a6fd8,_0x578180){_0x578180(null,path[_0xef4b('0x22')](config['root'],_0xef4b('0x1a')));},'filename':function(_0x3acf7f,_0x2266f8,_0x548d67){_0x548d67(null,util[_0xef4b('0x1b')](_0xef4b('0x1c'),_0xef4b('0x26'),path[_0xef4b('0x1e')](_0x2266f8['originalname'])));}})});router['post'](_0xef4b('0x16'),upload[_0xef4b('0x23')]('file'),controller[_0xef4b('0x27')]);router['put'](_0xef4b('0xd'),auth[_0xef4b('0x28')](),controller[_0xef4b('0x29')]);module[_0xef4b('0x2a')]=router; \ No newline at end of file +var _0x5176=['extname','originalname','single','file','addLogo','diskStorage','server/files/images/logos/','logologin','addLogoLogin','favicon','post','put','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','getPreferred','/:id/favicon','getFavicon','join','root','format','%s%s','logo'];(function(_0x7f0a18,_0x3ccd89){var _0x348d54=function(_0x189ad5){while(--_0x189ad5){_0x7f0a18['push'](_0x7f0a18['shift']());}};_0x348d54(++_0x3ccd89);}(_0x5176,0x76));var _0x6517=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x5176[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0x6517('0x0'));var path=require('path');var timeout=require(_0x6517('0x1'));var express=require('express');var router=express[_0x6517('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x6517('0x3'));var config=require(_0x6517('0x4'));var controller=require(_0x6517('0x5'));router[_0x6517('0x6')]('/',auth['isAuthenticated'](),controller[_0x6517('0x7')]);router[_0x6517('0x6')](_0x6517('0x8'),controller[_0x6517('0x9')]);router[_0x6517('0x6')](_0x6517('0xa'),controller[_0x6517('0xb')]);router[_0x6517('0x6')](_0x6517('0xc'),controller[_0x6517('0xd')]);router[_0x6517('0x6')]('/:id/logo_login',controller['getLogoLogin']);router[_0x6517('0x6')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x6517('0xe')]);router[_0x6517('0x6')](_0x6517('0xf'),controller[_0x6517('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ea356,_0x5e9bd9,_0xae8bf3){_0xae8bf3(null,path[_0x6517('0x11')](config[_0x6517('0x12')],'server/files/images/logos/'));},'filename':function(_0x147a09,_0x3e8ea8,_0x5367f8){_0x5367f8(null,util[_0x6517('0x13')](_0x6517('0x14'),_0x6517('0x15'),path[_0x6517('0x16')](_0x3e8ea8[_0x6517('0x17')])));}})});router['post']('/:id/logo',upload[_0x6517('0x18')](_0x6517('0x19')),controller[_0x6517('0x1a')]);var upload=multer({'storage':multer[_0x6517('0x1b')]({'destination':function(_0x2bee23,_0x2e85a8,_0x4a9cb3){_0x4a9cb3(null,path['join'](config[_0x6517('0x12')],_0x6517('0x1c')));},'filename':function(_0x3896c5,_0x19c0a4,_0x4e6eb1){_0x4e6eb1(null,util[_0x6517('0x13')](_0x6517('0x14'),_0x6517('0x1d'),path['extname'](_0x19c0a4[_0x6517('0x17')])));}})});router['post']('/:id/logo_login',upload['single']('file'),controller[_0x6517('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49938d,_0x2c29df,_0x532185){_0x532185(null,path[_0x6517('0x11')](config[_0x6517('0x12')],_0x6517('0x1c')));},'filename':function(_0x27d5b2,_0x29290e,_0x4b54d0){_0x4b54d0(null,util[_0x6517('0x13')](_0x6517('0x14'),'preferred',path[_0x6517('0x16')](_0x29290e[_0x6517('0x17')])));}})});router['post']('/:id/preferred',upload[_0x6517('0x18')](_0x6517('0x19')),controller['addPreferred']);var upload=multer({'storage':multer[_0x6517('0x1b')]({'destination':function(_0x47e55d,_0x593603,_0x36eccf){_0x36eccf(null,path['join'](config[_0x6517('0x12')],_0x6517('0x1c')));},'filename':function(_0x3eebc5,_0x33ffa8,_0x156111){_0x156111(null,util['format'](_0x6517('0x14'),_0x6517('0x1f'),path[_0x6517('0x16')](_0x33ffa8['originalname'])));}})});router[_0x6517('0x20')](_0x6517('0xf'),upload[_0x6517('0x18')](_0x6517('0x19')),controller['addFavicon']);router[_0x6517('0x21')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x6517('0x22')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 36a699d..aa07400 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 _0x6720=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','sequelize','exports','INTEGER','min_internal'];(function(_0x238ecc,_0x45075d){var _0x36fc83=function(_0x2934b2){while(--_0x2934b2){_0x238ecc['push'](_0x238ecc['shift']());}};_0x36fc83(++_0x45075d);}(_0x6720,0xef));var _0x0672=function(_0x2c33b7,_0x2e8d20){_0x2c33b7=_0x2c33b7-0x0;var _0x43823a=_0x6720[_0x2c33b7];return _0x43823a;};'use strict';var Sequelize=require(_0x0672('0x0'));module[_0x0672('0x1')]={'min_internal':{'type':Sequelize[_0x0672('0x2')](0xb),'unique':_0x0672('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0672('0x2')](0xb),'unique':_0x0672('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0672('0x5')],'defaultValue':_0x0672('0x6')},'logo':{'type':Sequelize[_0x0672('0x5')]},'defaultLogo':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0672('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0672('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0672('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x0672('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0672('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0672('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0672('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0672('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0672('0x5')],'defaultValue':_0x0672('0x8')},'chatTimeout':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0672('0x5')]},'defaultPreferred':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0672('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0672('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0672('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0672('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0672('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0672('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0672('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0672('0x5')]},'bucket':{'type':Sequelize[_0x0672('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0672('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0672('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x0672('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x79fb=['UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN'];(function(_0x3439fd,_0x432e7d){var _0x53a9bc=function(_0xfea845){while(--_0xfea845){_0x3439fd['push'](_0x3439fd['shift']());}};_0x53a9bc(++_0x432e7d);}(_0x79fb,0x159));var _0xb79f=function(_0x367954,_0x430dbf){_0x367954=_0x367954-0x0;var _0x5ab925=_0x79fb[_0x367954];return _0x5ab925;};'use strict';var Sequelize=require(_0xb79f('0x0'));module[_0xb79f('0x1')]={'min_internal':{'type':Sequelize[_0xb79f('0x2')](0xb),'unique':_0xb79f('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb79f('0x2')](0xb),'unique':_0xb79f('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb79f('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb79f('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xb79f('0x5')]},'defaultLogo':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb79f('0x5')]},'turnaddr':{'type':Sequelize[_0xb79f('0x5')]},'turnusername':{'type':Sequelize[_0xb79f('0x5')]},'turnpassword':{'type':Sequelize[_0xb79f('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb79f('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb79f('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb79f('0x5')]},'defaultPreferred':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb79f('0x5')]},'defaultFavicon':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb79f('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb79f('0x2')]},'sentimentRegion':{'type':Sequelize[_0xb79f('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xb79f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xb79f('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb79f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index f3033e9..8420ae7 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 _0xd97a=['show','params','keys','rawAttributes','include','find','catch','update','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','root','toLower','join','upperFirst','existsSync','\x20not\x20found','getLogoLogin','defaultFavicon','default_loginLogo.svg','custom','download','gdpr','addPreferred','default','default_preferred.png','Sequelize','ValidationError','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','name','send','map','Setting','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd97a,0x110));var _0xad97=function(_0x8d475f,_0x2e4053){_0x8d475f=_0x8d475f-0x0;var _0x409fde=_0xd97a[_0x8d475f];return _0x409fde;};'use strict';var pdf=require(_0xad97('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xad97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad97('0x2'));var rp=require(_0xad97('0x3'));var moment=require(_0xad97('0x4'));var BPromise=require(_0xad97('0x5'));var Mustache=require(_0xad97('0x6'));var util=require('util');var path=require('path');var sox=require(_0xad97('0x7'));var csv=require(_0xad97('0x8'));var ejs=require(_0xad97('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xad97('0xa'));var crypto=require('crypto');var jsforce=require(_0xad97('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xad97('0x8'));var querystring=require(_0xad97('0xc'));var Papa=require(_0xad97('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad97('0xe'));var as=require(_0xad97('0xf'));var hardwareService=require(_0xad97('0x10'));var logger=require(_0xad97('0x11'))(_0xad97('0x12'));var utils=require(_0xad97('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xad97('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xad97('0x15'));var client=jayson['client'][_0xad97('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x32a774,_0x3c0e11,_0x3932ee,_0xac3c84){return new BPromise(function(_0x4a43c4,_0x476bad){var _0x359321=_0xac3c84||client;return _0x359321[_0xad97('0x17')](_0x32a774,_0x3932ee)[_0xad97('0x18')](function(_0x43e02a){logger['info'](_0xad97('0x19'),_0x3c0e11,_0xad97('0x1a'));logger[_0xad97('0x1b')](_0xad97('0x1c'),_0x3c0e11,_0xad97('0x1a'),JSON['stringify'](_0x43e02a));if(_0x43e02a[_0xad97('0x1d')]){if(_0x43e02a[_0xad97('0x1d')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3c0e11,_0x43e02a['error'][_0xad97('0x1e')]);return _0x476bad(_0x43e02a[_0xad97('0x1d')][_0xad97('0x1e')]);}logger[_0xad97('0x1d')]('Setting,\x20%s,\x20%s',_0x3c0e11,_0x43e02a[_0xad97('0x1d')][_0xad97('0x1e')]);return _0x4a43c4(_0x43e02a['error'][_0xad97('0x1e')]);}else{logger[_0xad97('0x1f')](_0xad97('0x19'),_0x3c0e11,'request\x20sent');_0x4a43c4(_0x43e02a['result'][_0xad97('0x1e')]);}})['catch'](function(_0x1c5318){logger[_0xad97('0x1d')](_0xad97('0x19'),_0x3c0e11,_0x1c5318);_0x476bad(_0x1c5318);});});}function respondWithStatusCode(_0x1b99d4,_0x5de972){_0x5de972=_0x5de972||0xcc;return function(_0x4a50bf){if(_0x4a50bf){return _0x1b99d4[_0xad97('0x20')](_0x5de972);}return _0x1b99d4['status'](_0x5de972)[_0xad97('0x21')]();};}function respondWithResult(_0x468850,_0x71e99e){_0x71e99e=_0x71e99e||0xc8;return function(_0x42ff4e){if(_0x42ff4e){return _0x468850[_0xad97('0x22')](_0x71e99e)['json'](_0x42ff4e);}};}function respondWithFilteredResult(_0x3d97be,_0x92c3ee){return function(_0xb28db1){if(_0xb28db1){var _0x2d1e6e=_0xb28db1[_0xad97('0x23')],_0x5813c5=_0x92c3ee[_0xad97('0x24')],_0x198a20=_0x92c3ee['offset']+_0x92c3ee[_0xad97('0x25')],_0x32cfaf;if(_0x198a20>=_0x2d1e6e){_0x198a20=_0x2d1e6e;_0x32cfaf=0xc8;}else{_0x32cfaf=0xce;}_0x3d97be[_0xad97('0x22')](_0x32cfaf);return _0x3d97be[_0xad97('0x26')](_0xad97('0x27'),_0x5813c5+'-'+_0x198a20+'/'+_0x2d1e6e)[_0xad97('0x28')](_0xb28db1);}return null;};}function patchUpdates(_0x32ba20){return function(_0x1e1662){try{jsonpatch[_0xad97('0x29')](_0x1e1662,_0x32ba20,!![]);}catch(_0x9b63f){return BPromise[_0xad97('0x2a')](_0x9b63f);}return _0x1e1662[_0xad97('0x2b')]();};}function saveUpdates(_0x5aafb0,_0x528629){return function(_0x4947ba){if(_0x4947ba){return _0x4947ba['update'](_0x5aafb0)[_0xad97('0x18')](function(_0x22d1f0){return _0x22d1f0;});}return null;};}function removeEntity(_0x4bc7c5,_0x2501ff){return function(_0x4a4f9a){if(_0x4a4f9a){return _0x4a4f9a['destroy']()[_0xad97('0x18')](function(){_0x4bc7c5[_0xad97('0x22')](0xcc)[_0xad97('0x21')]();});}};}function handleEntityNotFound(_0x537f72,_0x59ac14){return function(_0x3f5b33){if(!_0x3f5b33){_0x537f72[_0xad97('0x20')](0x194);}return _0x3f5b33;};}function handleError(_0x2ff7ef,_0x36ba2e){_0x36ba2e=_0x36ba2e||0x1f4;return function(_0x1683cb){logger['error'](_0x1683cb['stack']);if(_0x1683cb['name']){delete _0x1683cb[_0xad97('0x2c')];}_0x2ff7ef[_0xad97('0x22')](_0x36ba2e)[_0xad97('0x2d')](_0x1683cb);};}exports['index']=function(_0x1b0453,_0x2b28a1){var _0x2e0738={},_0x2e5620={},_0x12d283={'count':0x0,'rows':[]};var _0xd65171=_[_0xad97('0x2e')](db[_0xad97('0x2f')]['rawAttributes'],function(_0x385357){return{'name':_0x385357[_0xad97('0x30')],'type':_0x385357[_0xad97('0x31')][_0xad97('0x32')]};});_0x2e5620[_0xad97('0x33')]=_[_0xad97('0x2e')](_0xd65171,_0xad97('0x2c'));_0x2e5620['query']=_['keys'](_0x1b0453['query']);_0x2e5620[_0xad97('0x34')]=_[_0xad97('0x35')](_0x2e5620[_0xad97('0x33')],_0x2e5620[_0xad97('0x36')]);_0x2e0738[_0xad97('0x37')]=_[_0xad97('0x35')](_0x2e5620['model'],qs[_0xad97('0x38')](_0x1b0453['query'][_0xad97('0x38')]));_0x2e0738['attributes']=_0x2e0738['attributes'][_0xad97('0x39')]?_0x2e0738[_0xad97('0x37')]:_0x2e5620[_0xad97('0x33')];if(!_0x1b0453['query'][_0xad97('0x3a')](_0xad97('0x3b'))){_0x2e0738['limit']=qs[_0xad97('0x25')](_0x1b0453[_0xad97('0x36')][_0xad97('0x25')]);_0x2e0738[_0xad97('0x24')]=qs[_0xad97('0x24')](_0x1b0453[_0xad97('0x36')][_0xad97('0x24')]);}_0x2e0738[_0xad97('0x3c')]=qs['sort'](_0x1b0453[_0xad97('0x36')][_0xad97('0x3d')]);_0x2e0738[_0xad97('0x3e')]=qs['filters'](_[_0xad97('0x3f')](_0x1b0453[_0xad97('0x36')],_0x2e5620[_0xad97('0x34')]),_0xd65171);if(_0x1b0453['query']['filter']){_0x2e0738['where']=_[_0xad97('0x40')](_0x2e0738[_0xad97('0x3e')],{'$or':_[_0xad97('0x2e')](_0xd65171,function(_0x51f540){if(_0x51f540[_0xad97('0x31')]!==_0xad97('0x41')){var _0x3c19f3={};_0x3c19f3[_0x51f540['name']]={'$like':'%'+_0x1b0453[_0xad97('0x36')]['filter']+'%'};return _0x3c19f3;}})});}_0x2e0738=_[_0xad97('0x40')]({},_0x2e0738,_0x1b0453[_0xad97('0x42')]);var _0x10effb={'where':_0x2e0738[_0xad97('0x3e')]};return db[_0xad97('0x2f')][_0xad97('0x23')](_0x10effb)[_0xad97('0x18')](function(_0x4a8045){_0x12d283[_0xad97('0x23')]=_0x4a8045;if(_0x1b0453[_0xad97('0x36')][_0xad97('0x43')]){_0x2e0738['include']=[{'all':!![]}];}return db[_0xad97('0x2f')][_0xad97('0x44')](_0x2e0738);})[_0xad97('0x18')](function(_0x14e484){_0x12d283[_0xad97('0x45')]=_0x14e484;return _0x12d283;})['then'](respondWithFilteredResult(_0x2b28a1,_0x2e0738))['catch'](handleError(_0x2b28a1,null));};exports[_0xad97('0x46')]=function(_0x440e10,_0x40841a){var _0x294887={'raw':![],'where':{'id':_0x440e10[_0xad97('0x47')]['id']}},_0x530680={};_0x530680[_0xad97('0x33')]=_[_0xad97('0x48')](db[_0xad97('0x2f')][_0xad97('0x49')]);_0x530680[_0xad97('0x36')]=_[_0xad97('0x48')](_0x440e10['query']);_0x530680[_0xad97('0x34')]=_['intersection'](_0x530680[_0xad97('0x33')],_0x530680[_0xad97('0x36')]);_0x294887[_0xad97('0x37')]=_[_0xad97('0x35')](_0x530680['model'],qs[_0xad97('0x38')](_0x440e10[_0xad97('0x36')][_0xad97('0x38')]));_0x294887[_0xad97('0x37')]=_0x294887['attributes'][_0xad97('0x39')]?_0x294887[_0xad97('0x37')]:_0x530680['model'];if(_0x440e10['query']['includeAll']){_0x294887[_0xad97('0x4a')]=[{'all':!![]}];}_0x294887=_[_0xad97('0x40')]({},_0x294887,_0x440e10[_0xad97('0x42')]);return db[_0xad97('0x2f')][_0xad97('0x4b')](_0x294887)['then'](handleEntityNotFound(_0x40841a,null))[_0xad97('0x18')](respondWithResult(_0x40841a,null))[_0xad97('0x4c')](handleError(_0x40841a,null));};exports[_0xad97('0x4d')]=function(_0x41d9b2,_0x220e06){if(_0x41d9b2[_0xad97('0x4e')]['id']){delete _0x41d9b2[_0xad97('0x4e')]['id'];}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x41d9b2[_0xad97('0x47')]['id']}})['then'](handleEntityNotFound(_0x220e06,null))[_0xad97('0x18')](saveUpdates(_0x41d9b2[_0xad97('0x4e')],null))[_0xad97('0x18')](respondWithResult(_0x220e06,null))[_0xad97('0x4c')](handleError(_0x220e06,null));};exports[_0xad97('0x4f')]=function(_0x228d13,_0x184efb,_0x3badfe){if(_0x228d13[_0xad97('0x50')]&&_0x228d13[_0xad97('0x50')][_0xad97('0x51')]){_0x228d13[_0xad97('0x4e')][_0xad97('0x52')]=_0x228d13[_0xad97('0x50')][_0xad97('0x51')];}return db['Setting'][_0xad97('0x4b')]({'where':{'id':_0x228d13[_0xad97('0x47')]['id']}})['then'](handleEntityNotFound(_0x184efb,null))['then'](saveUpdates(_0x228d13[_0xad97('0x4e')],null))['then'](respondWithResult(_0x184efb,null))[_0xad97('0x4c')](handleError(_0x184efb,null));};exports['addLogoLogin']=function(_0x13d52f,_0x4036c8,_0x3a8f4d){if(_0x13d52f[_0xad97('0x50')]&&_0x13d52f[_0xad97('0x50')][_0xad97('0x51')]){_0x13d52f[_0xad97('0x4e')][_0xad97('0x53')]=_0x13d52f[_0xad97('0x50')][_0xad97('0x51')];}return db[_0xad97('0x2f')]['find']({'where':{'id':_0x13d52f[_0xad97('0x47')]['id']}})[_0xad97('0x18')](handleEntityNotFound(_0x4036c8,null))['then'](saveUpdates(_0x13d52f['body'],null))[_0xad97('0x18')](respondWithResult(_0x4036c8,null))['catch'](handleError(_0x4036c8,null));};var utilLicense=require('../../config/license/util');exports[_0xad97('0x54')]=function(_0x12e993,_0x478973,_0x105abc){var _0x5341ee=_0xad97('0x55');var _0x27cf69={'custom':![]};return utilLicense[_0xad97('0x56')]()['then'](function(_0x13e1db){if(_0x13e1db){_0x27cf69=_0x13e1db;}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x12e993['params']['id']},'attributes':[_0xad97('0x52'),'loginLogo',_0xad97('0x57'),_0xad97('0x58'),'defaultLogo',_0xad97('0x59'),_0xad97('0x5a'),'defaultFavicon'],'raw':!![]});})[_0xad97('0x18')](handleEntityNotFound(_0x478973,null))[_0xad97('0x18')](function(_0x21ce57){if(_0x21ce57){var _0x3d4e61=_0x21ce57[_0xad97('0x52')]&&fs['existsSync'](path['join'](config[_0xad97('0x5b')],_0x5341ee,_[_0xad97('0x5c')](_0x21ce57[_0xad97('0x52')])))?path[_0xad97('0x5d')](config[_0xad97('0x5b')],_0x5341ee,_[_0xad97('0x5c')](_0x21ce57['logo'])):path[_0xad97('0x5d')](config['root'],_0x5341ee,_['toLower']('default_logo.svg'));var _0x4370ce='default'+_[_0xad97('0x5e')](_0xad97('0x52'));if(_0x21ce57[_0x4370ce]||!_0x27cf69['custom']){_0x3d4e61=path[_0xad97('0x5d')](config[_0xad97('0x5b')],_0x5341ee,_[_0xad97('0x5c')]('default_logo.svg'));}if(!fs[_0xad97('0x5f')](_0x3d4e61)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0xad97('0x52'))+_0xad97('0x60'));}return _0x478973['download'](_0x3d4e61);}})[_0xad97('0x4c')](handleError(_0x478973,null));};var utilLicense=require(_0xad97('0x14'));exports[_0xad97('0x61')]=function(_0x1522e1,_0x4ee560,_0x5b1507){var _0x40df8b='server/files/images/logos';var _0x526534={'custom':![]};return utilLicense['getLicense']()[_0xad97('0x18')](function(_0x4823e3){if(_0x4823e3){_0x526534=_0x4823e3;}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x1522e1[_0xad97('0x47')]['id']},'attributes':[_0xad97('0x52'),'loginLogo',_0xad97('0x57'),_0xad97('0x58'),'defaultLogo',_0xad97('0x59'),'defaultPreferred',_0xad97('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x4ee560,null))[_0xad97('0x18')](function(_0x504013){if(_0x504013){var _0x18726b=_0x504013[_0xad97('0x53')]&&fs[_0xad97('0x5f')](path['join'](config[_0xad97('0x5b')],_0x40df8b,_[_0xad97('0x5c')](_0x504013[_0xad97('0x53')])))?path['join'](config['root'],_0x40df8b,_['toLower'](_0x504013[_0xad97('0x53')])):path[_0xad97('0x5d')](config[_0xad97('0x5b')],_0x40df8b,_[_0xad97('0x5c')](_0xad97('0x63')));var _0x50eca7='default'+_[_0xad97('0x5e')]('loginLogo');if(_0x504013[_0x50eca7]||!_0x526534[_0xad97('0x64')]){_0x18726b=path[_0xad97('0x5d')](config[_0xad97('0x5b')],_0x40df8b,_[_0xad97('0x5c')]('default_loginLogo.svg'));}if(!fs[_0xad97('0x5f')](_0x18726b)){throw new db['Sequelize']['ValidationError'](_[_0xad97('0x5e')](_0xad97('0x53'))+'\x20not\x20found');}return _0x4ee560[_0xad97('0x65')](_0x18726b);}})['catch'](handleError(_0x4ee560,null));};exports[_0xad97('0x66')]=function(_0x2f43e5,_0x55e561){return db[_0xad97('0x2f')]['find']({'where':{'id':_0x2f43e5[_0xad97('0x47')]['id']},'attributes':['securePassword']})[_0xad97('0x18')](respondWithResult(_0x55e561,null))[_0xad97('0x4c')](handleError(_0x55e561,null));};exports[_0xad97('0x67')]=function(_0x102768,_0x59db2d,_0x2ee519){if(_0x102768[_0xad97('0x50')]&&_0x102768[_0xad97('0x50')][_0xad97('0x51')]){_0x102768[_0xad97('0x4e')][_0xad97('0x57')]=_0x102768[_0xad97('0x50')][_0xad97('0x51')];}return db['Setting']['find']({'where':{'id':_0x102768[_0xad97('0x47')]['id']}})[_0xad97('0x18')](handleEntityNotFound(_0x59db2d,null))[_0xad97('0x18')](saveUpdates(_0x102768[_0xad97('0x4e')],null))[_0xad97('0x18')](respondWithResult(_0x59db2d,null))[_0xad97('0x4c')](handleError(_0x59db2d,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x387eb6,_0x58ba5f,_0x225314){var _0x224fde=_0xad97('0x55');var _0x262f74={'custom':![]};return utilLicense[_0xad97('0x56')]()[_0xad97('0x18')](function(_0x5b05a2){if(_0x5b05a2){_0x262f74=_0x5b05a2;}return db['Setting']['find']({'where':{'id':_0x387eb6[_0xad97('0x47')]['id']},'attributes':['logo',_0xad97('0x53'),_0xad97('0x57'),'favicon','defaultLogo',_0xad97('0x59'),_0xad97('0x5a'),_0xad97('0x62')],'raw':!![]});})[_0xad97('0x18')](handleEntityNotFound(_0x58ba5f,null))['then'](function(_0x53560a){if(_0x53560a){var _0x50aa50=_0x53560a[_0xad97('0x57')]&&fs[_0xad97('0x5f')](path[_0xad97('0x5d')](config['root'],_0x224fde,_[_0xad97('0x5c')](_0x53560a[_0xad97('0x57')])))?path['join'](config[_0xad97('0x5b')],_0x224fde,_[_0xad97('0x5c')](_0x53560a[_0xad97('0x57')])):path[_0xad97('0x5d')](config[_0xad97('0x5b')],_0x224fde,_['toLower']('default_preferred.png'));var _0x559e12=_0xad97('0x68')+_[_0xad97('0x5e')](_0xad97('0x57'));if(_0x53560a[_0x559e12]||!_0x262f74[_0xad97('0x64')]||!_0x262f74['preferred']){_0x50aa50=path['join'](config['root'],_0x224fde,_[_0xad97('0x5c')](_0xad97('0x69')));}if(!fs['existsSync'](_0x50aa50)){throw new db[(_0xad97('0x6a'))][(_0xad97('0x6b'))](_[_0xad97('0x5e')]('preferred')+_0xad97('0x60'));}return _0x58ba5f[_0xad97('0x65')](_0x50aa50);}})[_0xad97('0x4c')](handleError(_0x58ba5f,null));};exports[_0xad97('0x6c')]=function(_0x3ff13e,_0x5e34c9,_0x4440b9){if(_0x3ff13e[_0xad97('0x50')]&&_0x3ff13e[_0xad97('0x50')][_0xad97('0x51')]){_0x3ff13e['body'][_0xad97('0x58')]=_0x3ff13e[_0xad97('0x50')][_0xad97('0x51')];}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x3ff13e[_0xad97('0x47')]['id']}})[_0xad97('0x18')](handleEntityNotFound(_0x5e34c9,null))['then'](saveUpdates(_0x3ff13e[_0xad97('0x4e')],null))[_0xad97('0x18')](respondWithResult(_0x5e34c9,null))[_0xad97('0x4c')](handleError(_0x5e34c9,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x4e31f0,_0x223470,_0x582d92){var _0x779e3e=_0xad97('0x55');var _0x4acdaa={'custom':![]};return utilLicense[_0xad97('0x56')]()['then'](function(_0x16303f){if(_0x16303f){_0x4acdaa=_0x16303f;}return db[_0xad97('0x2f')][_0xad97('0x4b')]({'where':{'id':_0x4e31f0[_0xad97('0x47')]['id']},'attributes':['logo',_0xad97('0x53'),_0xad97('0x57'),'favicon','defaultLogo',_0xad97('0x59'),'defaultPreferred',_0xad97('0x62')],'raw':!![]});})[_0xad97('0x18')](handleEntityNotFound(_0x223470,null))['then'](function(_0x146087){if(_0x146087){var _0x5abc13=_0x146087[_0xad97('0x58')]&&fs[_0xad97('0x5f')](path[_0xad97('0x5d')](config['root'],_0x779e3e,_[_0xad97('0x5c')](_0x146087[_0xad97('0x58')])))?path[_0xad97('0x5d')](config['root'],_0x779e3e,_[_0xad97('0x5c')](_0x146087[_0xad97('0x58')])):path[_0xad97('0x5d')](config[_0xad97('0x5b')],_0x779e3e,_['toLower']('default_favicon.ico'));var _0x4298c9='default'+_[_0xad97('0x5e')](_0xad97('0x58'));if(_0x146087[_0x4298c9]||!_0x4acdaa[_0xad97('0x64')]){_0x5abc13=path[_0xad97('0x5d')](config['root'],_0x779e3e,_[_0xad97('0x5c')](_0xad97('0x6d')));}if(!fs[_0xad97('0x5f')](_0x5abc13)){throw new db[(_0xad97('0x6a'))][(_0xad97('0x6b'))](_[_0xad97('0x5e')](_0xad97('0x58'))+_0xad97('0x60'));}return _0x223470[_0xad97('0x65')](_0x5abc13);}})[_0xad97('0x4c')](handleError(_0x223470,null));};exports[_0xad97('0x6e')]=function(_0x293bb8,_0x25e977){var _0x33c62b={'offset':moment()[_0xad97('0x6f')]()};_0x33c62b[_0xad97('0x70')]=moment()[_0xad97('0x6f')](_0x33c62b[_0xad97('0x24')])[_0xad97('0x71')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x25e977[_0xad97('0x22')](0xc8)[_0xad97('0x2d')](_0x33c62b);}; \ No newline at end of file +var _0x7f52=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','index','map','Setting','rawAttributes','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','find','body','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','favicon','default_loginLogo.svg','custom','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x7f52,0xde));var _0x27f5=function(_0xb02eed,_0x13d074){_0xb02eed=_0xb02eed-0x0;var _0x43455b=_0x7f52[_0xb02eed];return _0x43455b;};'use strict';var pdf=require(_0x27f5('0x0'));var emlformat=require(_0x27f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x27f5('0x2'));var jsonpatch=require(_0x27f5('0x3'));var rp=require(_0x27f5('0x4'));var moment=require(_0x27f5('0x5'));var BPromise=require(_0x27f5('0x6'));var Mustache=require(_0x27f5('0x7'));var util=require('util');var path=require(_0x27f5('0x8'));var sox=require('sox');var csv=require(_0x27f5('0x9'));var ejs=require(_0x27f5('0xa'));var fs=require('fs');var _=require(_0x27f5('0xb'));var squel=require(_0x27f5('0xc'));var crypto=require(_0x27f5('0xd'));var jsforce=require(_0x27f5('0xe'));var deskjs=require(_0x27f5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27f5('0x10'));var Papa=require(_0x27f5('0x11'));var Redis=require(_0x27f5('0x12'));var authService=require(_0x27f5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x27f5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27f5('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x27f5('0x16'));var db=require(_0x27f5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x27f5('0x18')][_0x27f5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x153628,_0xec2efa,_0x22fb74,_0x49c7d2){return new BPromise(function(_0x209018,_0x6bec84){var _0x29b357=_0x49c7d2||client;return _0x29b357['request'](_0x153628,_0x22fb74)[_0x27f5('0x1a')](function(_0x5659dc){logger['info'](_0x27f5('0x1b'),_0xec2efa,_0x27f5('0x1c'));logger[_0x27f5('0x1d')](_0x27f5('0x1e'),_0xec2efa,_0x27f5('0x1c'),JSON[_0x27f5('0x1f')](_0x5659dc));if(_0x5659dc['error']){if(_0x5659dc[_0x27f5('0x20')][_0x27f5('0x21')]===0x1f4){logger[_0x27f5('0x20')](_0x27f5('0x1b'),_0xec2efa,_0x5659dc[_0x27f5('0x20')]['message']);return _0x6bec84(_0x5659dc[_0x27f5('0x20')][_0x27f5('0x22')]);}logger[_0x27f5('0x20')]('Setting,\x20%s,\x20%s',_0xec2efa,_0x5659dc[_0x27f5('0x20')][_0x27f5('0x22')]);return _0x209018(_0x5659dc[_0x27f5('0x20')][_0x27f5('0x22')]);}else{logger[_0x27f5('0x23')](_0x27f5('0x1b'),_0xec2efa,_0x27f5('0x1c'));_0x209018(_0x5659dc[_0x27f5('0x24')][_0x27f5('0x22')]);}})[_0x27f5('0x25')](function(_0x5d3dbf){logger['error'](_0x27f5('0x1b'),_0xec2efa,_0x5d3dbf);_0x6bec84(_0x5d3dbf);});});}function respondWithStatusCode(_0x3fc576,_0x85c596){_0x85c596=_0x85c596||0xcc;return function(_0x18fedd){if(_0x18fedd){return _0x3fc576['sendStatus'](_0x85c596);}return _0x3fc576[_0x27f5('0x26')](_0x85c596)[_0x27f5('0x27')]();};}function respondWithResult(_0x11a18e,_0x1a1f92){_0x1a1f92=_0x1a1f92||0xc8;return function(_0x49fc6a){if(_0x49fc6a){return _0x11a18e[_0x27f5('0x26')](_0x1a1f92)[_0x27f5('0x28')](_0x49fc6a);}};}function respondWithFilteredResult(_0x4ae3de,_0x46e276){return function(_0x3f1999){if(_0x3f1999){var _0x3b50ac=_0x3f1999[_0x27f5('0x29')],_0x37b098=_0x46e276['offset'],_0x451e41=_0x46e276[_0x27f5('0x2a')]+_0x46e276[_0x27f5('0x2b')],_0x26032d;if(_0x451e41>=_0x3b50ac){_0x451e41=_0x3b50ac;_0x26032d=0xc8;}else{_0x26032d=0xce;}_0x4ae3de[_0x27f5('0x26')](_0x26032d);return _0x4ae3de[_0x27f5('0x2c')](_0x27f5('0x2d'),_0x37b098+'-'+_0x451e41+'/'+_0x3b50ac)['json'](_0x3f1999);}return null;};}function patchUpdates(_0x30e9a8){return function(_0x568bd1){try{jsonpatch[_0x27f5('0x2e')](_0x568bd1,_0x30e9a8,!![]);}catch(_0x8b1f99){return BPromise[_0x27f5('0x2f')](_0x8b1f99);}return _0x568bd1[_0x27f5('0x30')]();};}function saveUpdates(_0x12f99d,_0x11dee5){return function(_0x65c169){if(_0x65c169){return _0x65c169[_0x27f5('0x31')](_0x12f99d)[_0x27f5('0x1a')](function(_0x3edc10){return _0x3edc10;});}return null;};}function removeEntity(_0x2e7fdf,_0x5781ff){return function(_0x3ccc67){if(_0x3ccc67){return _0x3ccc67['destroy']()['then'](function(){_0x2e7fdf[_0x27f5('0x26')](0xcc)[_0x27f5('0x27')]();});}};}function handleEntityNotFound(_0x4fbe5e,_0x8b3033){return function(_0xd1156c){if(!_0xd1156c){_0x4fbe5e[_0x27f5('0x32')](0x194);}return _0xd1156c;};}function handleError(_0x13d941,_0x5324f2){_0x5324f2=_0x5324f2||0x1f4;return function(_0x25bb6c){logger['error'](_0x25bb6c[_0x27f5('0x33')]);if(_0x25bb6c[_0x27f5('0x34')]){delete _0x25bb6c['name'];}_0x13d941[_0x27f5('0x26')](_0x5324f2)['send'](_0x25bb6c);};}exports[_0x27f5('0x35')]=function(_0x1fbc6c,_0x46f52f){var _0x54746e={},_0x16dcc0={},_0x1ec314={'count':0x0,'rows':[]};var _0x50adc9=_[_0x27f5('0x36')](db[_0x27f5('0x37')][_0x27f5('0x38')],function(_0x4f900d){return{'name':_0x4f900d['fieldName'],'type':_0x4f900d[_0x27f5('0x39')]['key']};});_0x16dcc0[_0x27f5('0x3a')]=_[_0x27f5('0x36')](_0x50adc9,'name');_0x16dcc0['query']=_[_0x27f5('0x3b')](_0x1fbc6c['query']);_0x16dcc0[_0x27f5('0x3c')]=_[_0x27f5('0x3d')](_0x16dcc0['model'],_0x16dcc0['query']);_0x54746e[_0x27f5('0x3e')]=_['intersection'](_0x16dcc0[_0x27f5('0x3a')],qs[_0x27f5('0x3f')](_0x1fbc6c[_0x27f5('0x40')][_0x27f5('0x3f')]));_0x54746e[_0x27f5('0x3e')]=_0x54746e[_0x27f5('0x3e')][_0x27f5('0x41')]?_0x54746e['attributes']:_0x16dcc0[_0x27f5('0x3a')];if(!_0x1fbc6c['query'][_0x27f5('0x42')](_0x27f5('0x43'))){_0x54746e[_0x27f5('0x2b')]=qs[_0x27f5('0x2b')](_0x1fbc6c[_0x27f5('0x40')]['limit']);_0x54746e[_0x27f5('0x2a')]=qs[_0x27f5('0x2a')](_0x1fbc6c[_0x27f5('0x40')][_0x27f5('0x2a')]);}_0x54746e[_0x27f5('0x44')]=qs['sort'](_0x1fbc6c['query'][_0x27f5('0x45')]);_0x54746e[_0x27f5('0x46')]=qs[_0x27f5('0x3c')](_[_0x27f5('0x47')](_0x1fbc6c[_0x27f5('0x40')],_0x16dcc0[_0x27f5('0x3c')]),_0x50adc9);if(_0x1fbc6c[_0x27f5('0x40')][_0x27f5('0x48')]){_0x54746e[_0x27f5('0x46')]=_[_0x27f5('0x49')](_0x54746e['where'],{'$or':_['map'](_0x50adc9,function(_0x45b47d){if(_0x45b47d['type']!==_0x27f5('0x4a')){var _0x194258={};_0x194258[_0x45b47d['name']]={'$like':'%'+_0x1fbc6c[_0x27f5('0x40')][_0x27f5('0x48')]+'%'};return _0x194258;}})});}_0x54746e=_[_0x27f5('0x49')]({},_0x54746e,_0x1fbc6c[_0x27f5('0x4b')]);var _0x31d64e={'where':_0x54746e['where']};return db[_0x27f5('0x37')][_0x27f5('0x29')](_0x31d64e)[_0x27f5('0x1a')](function(_0x3fe6c0){_0x1ec314[_0x27f5('0x29')]=_0x3fe6c0;if(_0x1fbc6c[_0x27f5('0x40')][_0x27f5('0x4c')]){_0x54746e[_0x27f5('0x4d')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x54746e);})['then'](function(_0x55c133){_0x1ec314['rows']=_0x55c133;return _0x1ec314;})['then'](respondWithFilteredResult(_0x46f52f,_0x54746e))['catch'](handleError(_0x46f52f,null));};exports['show']=function(_0x4f52d6,_0x2386d3){var _0x2c79ac={'raw':![],'where':{'id':_0x4f52d6[_0x27f5('0x4e')]['id']}},_0x252fc3={};_0x252fc3['model']=_['keys'](db[_0x27f5('0x37')][_0x27f5('0x38')]);_0x252fc3[_0x27f5('0x40')]=_['keys'](_0x4f52d6[_0x27f5('0x40')]);_0x252fc3[_0x27f5('0x3c')]=_['intersection'](_0x252fc3[_0x27f5('0x3a')],_0x252fc3[_0x27f5('0x40')]);_0x2c79ac['attributes']=_[_0x27f5('0x3d')](_0x252fc3[_0x27f5('0x3a')],qs[_0x27f5('0x3f')](_0x4f52d6[_0x27f5('0x40')][_0x27f5('0x3f')]));_0x2c79ac[_0x27f5('0x3e')]=_0x2c79ac['attributes']['length']?_0x2c79ac[_0x27f5('0x3e')]:_0x252fc3[_0x27f5('0x3a')];if(_0x4f52d6[_0x27f5('0x40')][_0x27f5('0x4c')]){_0x2c79ac['include']=[{'all':!![]}];}_0x2c79ac=_['merge']({},_0x2c79ac,_0x4f52d6[_0x27f5('0x4b')]);return db['Setting'][_0x27f5('0x4f')](_0x2c79ac)[_0x27f5('0x1a')](handleEntityNotFound(_0x2386d3,null))[_0x27f5('0x1a')](respondWithResult(_0x2386d3,null))[_0x27f5('0x25')](handleError(_0x2386d3,null));};exports[_0x27f5('0x31')]=function(_0x4788d6,_0x2429ee){if(_0x4788d6['body']['id']){delete _0x4788d6[_0x27f5('0x50')]['id'];}return db[_0x27f5('0x37')]['find']({'where':{'id':_0x4788d6[_0x27f5('0x4e')]['id']}})[_0x27f5('0x1a')](handleEntityNotFound(_0x2429ee,null))[_0x27f5('0x1a')](saveUpdates(_0x4788d6['body'],null))[_0x27f5('0x1a')](respondWithResult(_0x2429ee,null))[_0x27f5('0x25')](handleError(_0x2429ee,null));};exports['addLogo']=function(_0x1cd8b4,_0xb938d9,_0xdd55f4){if(_0x1cd8b4[_0x27f5('0x51')]&&_0x1cd8b4[_0x27f5('0x51')]['filename']){_0x1cd8b4[_0x27f5('0x50')][_0x27f5('0x52')]=_0x1cd8b4[_0x27f5('0x51')][_0x27f5('0x53')];}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0x1cd8b4[_0x27f5('0x4e')]['id']}})[_0x27f5('0x1a')](handleEntityNotFound(_0xb938d9,null))[_0x27f5('0x1a')](saveUpdates(_0x1cd8b4[_0x27f5('0x50')],null))[_0x27f5('0x1a')](respondWithResult(_0xb938d9,null))[_0x27f5('0x25')](handleError(_0xb938d9,null));};exports[_0x27f5('0x54')]=function(_0xdb8cc7,_0x44799c,_0x3dac00){if(_0xdb8cc7[_0x27f5('0x51')]&&_0xdb8cc7[_0x27f5('0x51')]['filename']){_0xdb8cc7[_0x27f5('0x50')][_0x27f5('0x55')]=_0xdb8cc7[_0x27f5('0x51')]['filename'];}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0xdb8cc7[_0x27f5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x44799c,null))[_0x27f5('0x1a')](saveUpdates(_0xdb8cc7[_0x27f5('0x50')],null))[_0x27f5('0x1a')](respondWithResult(_0x44799c,null))['catch'](handleError(_0x44799c,null));};var utilLicense=require('../../config/license/util');exports[_0x27f5('0x56')]=function(_0x5ed9c0,_0x10dedb,_0x46d4c3){var _0x11397b=_0x27f5('0x57');var _0x302fa3={'custom':![]};return utilLicense[_0x27f5('0x58')]()[_0x27f5('0x1a')](function(_0x4dd2fc){if(_0x4dd2fc){_0x302fa3=_0x4dd2fc;}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0x5ed9c0[_0x27f5('0x4e')]['id']},'attributes':[_0x27f5('0x52'),_0x27f5('0x55'),_0x27f5('0x59'),'favicon',_0x27f5('0x5a'),_0x27f5('0x5b'),_0x27f5('0x5c'),_0x27f5('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x10dedb,null))[_0x27f5('0x1a')](function(_0x65a01a){if(_0x65a01a){var _0x4782d9=_0x65a01a[_0x27f5('0x52')]&&fs[_0x27f5('0x5e')](path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x11397b,_[_0x27f5('0x61')](_0x65a01a[_0x27f5('0x52')])))?path['join'](config['root'],_0x11397b,_[_0x27f5('0x61')](_0x65a01a['logo'])):path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x11397b,_[_0x27f5('0x61')](_0x27f5('0x62')));var _0xf86428=_0x27f5('0x63')+_[_0x27f5('0x64')](_0x27f5('0x52'));if(_0x65a01a[_0xf86428]||!_0x302fa3['custom']){_0x4782d9=path['join'](config[_0x27f5('0x60')],_0x11397b,_[_0x27f5('0x61')](_0x27f5('0x62')));}if(!fs[_0x27f5('0x5e')](_0x4782d9)){throw new db[(_0x27f5('0x65'))][(_0x27f5('0x66'))](_['upperFirst'](_0x27f5('0x52'))+_0x27f5('0x67'));}return _0x10dedb[_0x27f5('0x68')](_0x4782d9);}})['catch'](handleError(_0x10dedb,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x53aa17,_0x36743b,_0x1856ec){var _0x2fed03='server/files/images/logos';var _0xfd7954={'custom':![]};return utilLicense[_0x27f5('0x58')]()[_0x27f5('0x1a')](function(_0x4d73c4){if(_0x4d73c4){_0xfd7954=_0x4d73c4;}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0x53aa17[_0x27f5('0x4e')]['id']},'attributes':['logo',_0x27f5('0x55'),_0x27f5('0x59'),_0x27f5('0x69'),_0x27f5('0x5a'),_0x27f5('0x5b'),_0x27f5('0x5c'),_0x27f5('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x36743b,null))[_0x27f5('0x1a')](function(_0x1d14ad){if(_0x1d14ad){var _0x4efc63=_0x1d14ad[_0x27f5('0x55')]&&fs[_0x27f5('0x5e')](path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x2fed03,_[_0x27f5('0x61')](_0x1d14ad[_0x27f5('0x55')])))?path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x2fed03,_[_0x27f5('0x61')](_0x1d14ad[_0x27f5('0x55')])):path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x2fed03,_[_0x27f5('0x61')](_0x27f5('0x6a')));var _0x284640=_0x27f5('0x63')+_[_0x27f5('0x64')](_0x27f5('0x55'));if(_0x1d14ad[_0x284640]||!_0xfd7954[_0x27f5('0x6b')]){_0x4efc63=path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x2fed03,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x27f5('0x5e')](_0x4efc63)){throw new db[(_0x27f5('0x65'))][(_0x27f5('0x66'))](_[_0x27f5('0x64')]('loginLogo')+_0x27f5('0x67'));}return _0x36743b[_0x27f5('0x68')](_0x4efc63);}})[_0x27f5('0x25')](handleError(_0x36743b,null));};exports['gdpr']=function(_0xcd55c7,_0x380801){return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0xcd55c7['params']['id']},'attributes':[_0x27f5('0x6c')]})[_0x27f5('0x1a')](respondWithResult(_0x380801,null))[_0x27f5('0x25')](handleError(_0x380801,null));};exports[_0x27f5('0x6d')]=function(_0x4bc0db,_0x1bee31,_0x33620c){if(_0x4bc0db['file']&&_0x4bc0db['file'][_0x27f5('0x53')]){_0x4bc0db[_0x27f5('0x50')][_0x27f5('0x59')]=_0x4bc0db[_0x27f5('0x51')]['filename'];}return db[_0x27f5('0x37')]['find']({'where':{'id':_0x4bc0db[_0x27f5('0x4e')]['id']}})[_0x27f5('0x1a')](handleEntityNotFound(_0x1bee31,null))['then'](saveUpdates(_0x4bc0db[_0x27f5('0x50')],null))['then'](respondWithResult(_0x1bee31,null))[_0x27f5('0x25')](handleError(_0x1bee31,null));};var utilLicense=require(_0x27f5('0x16'));exports[_0x27f5('0x6e')]=function(_0x3de7f9,_0x5bc14c,_0x5506b3){var _0xa155c4=_0x27f5('0x57');var _0x280047={'custom':![]};return utilLicense[_0x27f5('0x58')]()[_0x27f5('0x1a')](function(_0x2bc66d){if(_0x2bc66d){_0x280047=_0x2bc66d;}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0x3de7f9[_0x27f5('0x4e')]['id']},'attributes':[_0x27f5('0x52'),_0x27f5('0x55'),'preferred',_0x27f5('0x69'),_0x27f5('0x5a'),_0x27f5('0x5b'),_0x27f5('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x27f5('0x1a')](handleEntityNotFound(_0x5bc14c,null))[_0x27f5('0x1a')](function(_0x383db1){if(_0x383db1){var _0x270b1e=_0x383db1['preferred']&&fs[_0x27f5('0x5e')](path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0xa155c4,_[_0x27f5('0x61')](_0x383db1['preferred'])))?path['join'](config[_0x27f5('0x60')],_0xa155c4,_[_0x27f5('0x61')](_0x383db1[_0x27f5('0x59')])):path['join'](config[_0x27f5('0x60')],_0xa155c4,_[_0x27f5('0x61')](_0x27f5('0x6f')));var _0x542fb7=_0x27f5('0x63')+_['upperFirst'](_0x27f5('0x59'));if(_0x383db1[_0x542fb7]||!_0x280047[_0x27f5('0x6b')]||!_0x280047[_0x27f5('0x59')]){_0x270b1e=path[_0x27f5('0x5f')](config['root'],_0xa155c4,_[_0x27f5('0x61')](_0x27f5('0x6f')));}if(!fs[_0x27f5('0x5e')](_0x270b1e)){throw new db[(_0x27f5('0x65'))]['ValidationError'](_[_0x27f5('0x64')](_0x27f5('0x59'))+_0x27f5('0x67'));}return _0x5bc14c['download'](_0x270b1e);}})[_0x27f5('0x25')](handleError(_0x5bc14c,null));};exports[_0x27f5('0x70')]=function(_0x195bf3,_0x15463b,_0x1ce921){if(_0x195bf3[_0x27f5('0x51')]&&_0x195bf3[_0x27f5('0x51')]['filename']){_0x195bf3[_0x27f5('0x50')]['favicon']=_0x195bf3['file'][_0x27f5('0x53')];}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0x195bf3['params']['id']}})[_0x27f5('0x1a')](handleEntityNotFound(_0x15463b,null))[_0x27f5('0x1a')](saveUpdates(_0x195bf3[_0x27f5('0x50')],null))[_0x27f5('0x1a')](respondWithResult(_0x15463b,null))[_0x27f5('0x25')](handleError(_0x15463b,null));};var utilLicense=require(_0x27f5('0x16'));exports[_0x27f5('0x71')]=function(_0x4459db,_0x3a3d13,_0x9b7f8a){var _0x11cb94=_0x27f5('0x57');var _0xf8b1f1={'custom':![]};return utilLicense['getLicense']()[_0x27f5('0x1a')](function(_0x219366){if(_0x219366){_0xf8b1f1=_0x219366;}return db[_0x27f5('0x37')][_0x27f5('0x4f')]({'where':{'id':_0x4459db[_0x27f5('0x4e')]['id']},'attributes':[_0x27f5('0x52'),'loginLogo','preferred','favicon',_0x27f5('0x5a'),_0x27f5('0x5b'),_0x27f5('0x5c'),_0x27f5('0x5d')],'raw':!![]});})[_0x27f5('0x1a')](handleEntityNotFound(_0x3a3d13,null))[_0x27f5('0x1a')](function(_0x353940){if(_0x353940){var _0x440731=_0x353940[_0x27f5('0x69')]&&fs[_0x27f5('0x5e')](path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x11cb94,_[_0x27f5('0x61')](_0x353940[_0x27f5('0x69')])))?path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x11cb94,_[_0x27f5('0x61')](_0x353940[_0x27f5('0x69')])):path['join'](config[_0x27f5('0x60')],_0x11cb94,_['toLower'](_0x27f5('0x72')));var _0x415876=_0x27f5('0x63')+_[_0x27f5('0x64')](_0x27f5('0x69'));if(_0x353940[_0x415876]||!_0xf8b1f1[_0x27f5('0x6b')]){_0x440731=path[_0x27f5('0x5f')](config[_0x27f5('0x60')],_0x11cb94,_[_0x27f5('0x61')]('default_favicon.ico'));}if(!fs[_0x27f5('0x5e')](_0x440731)){throw new db[(_0x27f5('0x65'))][(_0x27f5('0x66'))](_[_0x27f5('0x64')](_0x27f5('0x69'))+_0x27f5('0x67'));}return _0x3a3d13[_0x27f5('0x68')](_0x440731);}})[_0x27f5('0x25')](handleError(_0x3a3d13,null));};exports[_0x27f5('0x73')]=function(_0x29fe76,_0x1c0c3d){var _0x203484={'offset':moment()[_0x27f5('0x74')]()};_0x203484['now']=moment()[_0x27f5('0x74')](_0x203484[_0x27f5('0x2a')])[_0x27f5('0x75')](_0x27f5('0x76'));return _0x1c0c3d['status'](0xc8)[_0x27f5('0x77')](_0x203484);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9a335a5..1b2b74e 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 _0x5164=['bluebird','request-promise','path','exports','Setting','settings','lodash','util','../../config/logger','api','moment'];(function(_0x27f9bd,_0xf08f8f){var _0x5e9f65=function(_0x4022ff){while(--_0x4022ff){_0x27f9bd['push'](_0x27f9bd['shift']());}};_0x5e9f65(++_0xf08f8f);}(_0x5164,0xcc));var _0x4516=function(_0x132990,_0x1370c9){_0x132990=_0x132990-0x0;var _0x2aa89d=_0x5164[_0x132990];return _0x2aa89d;};'use strict';var _=require(_0x4516('0x0'));var util=require(_0x4516('0x1'));var logger=require(_0x4516('0x2'))(_0x4516('0x3'));var moment=require(_0x4516('0x4'));var BPromise=require(_0x4516('0x5'));var rp=require(_0x4516('0x6'));var fs=require('fs');var path=require(_0x4516('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0x4516('0x8')]=function(_0x44363d,_0x21d3ab){return _0x44363d['define'](_0x4516('0x9'),attributes,{'tableName':_0x4516('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x840a=['./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x840a,0x123));var _0xa840=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x840a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa840('0x0'));var util=require(_0xa840('0x1'));var logger=require(_0xa840('0x2'))('api');var moment=require(_0xa840('0x3'));var BPromise=require(_0xa840('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa840('0x5'));var rimraf=require(_0xa840('0x6'));var config=require(_0xa840('0x7'));var attributes=require(_0xa840('0x8'));module[_0xa840('0x9')]=function(_0x1e1f3c,_0xefe97c){return _0x1e1f3c[_0xa840('0xa')](_0xa840('0xb'),attributes,{'tableName':_0xa840('0xc'),'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 ce75412..24d5bd1 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 _0xefd1=['stringify','error','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x586f41,_0x1a52a9){var _0x3c774a=function(_0x242cbc){while(--_0x242cbc){_0x586f41['push'](_0x586f41['shift']());}};_0x3c774a(++_0x1a52a9);}(_0xefd1,0x1a9));var _0x1efd=function(_0x470122,_0x4c5c34){_0x470122=_0x470122-0x0;var _0x550eec=_0xefd1[_0x470122];return _0x550eec;};'use strict';var _=require('lodash');var util=require(_0x1efd('0x0'));var moment=require(_0x1efd('0x1'));var BPromise=require(_0x1efd('0x2'));var rs=require(_0x1efd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1efd('0x4'))['db'];var utils=require(_0x1efd('0x5'));var logger=require('../../config/logger')(_0x1efd('0x6'));var config=require(_0x1efd('0x7'));var jayson=require(_0x1efd('0x8'));var client=jayson['client'][_0x1efd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ee2bd,_0x55fee0,_0x5e95cf){return new BPromise(function(_0x756f61,_0x2cac1e){return client[_0x1efd('0xa')](_0x2ee2bd,_0x5e95cf)[_0x1efd('0xb')](function(_0x5ee718){logger['info'](_0x1efd('0xc'),_0x55fee0,_0x1efd('0xd'));logger[_0x1efd('0xe')](_0x1efd('0xf'),_0x55fee0,_0x1efd('0xd'),JSON[_0x1efd('0x10')](_0x5ee718));if(_0x5ee718[_0x1efd('0x11')]){if(_0x5ee718['error']['code']===0x1f4){logger['error'](_0x1efd('0xc'),_0x55fee0,_0x5ee718[_0x1efd('0x11')][_0x1efd('0x12')]);return _0x2cac1e(_0x5ee718[_0x1efd('0x11')][_0x1efd('0x12')]);}logger['error']('Setting,\x20%s,\x20%s',_0x55fee0,_0x5ee718['error'][_0x1efd('0x12')]);return _0x756f61(_0x5ee718[_0x1efd('0x11')][_0x1efd('0x12')]);}else{logger[_0x1efd('0x13')](_0x1efd('0xc'),_0x55fee0,_0x1efd('0xd'));_0x756f61(_0x5ee718['result'][_0x1efd('0x12')]);}})[_0x1efd('0x14')](function(_0x4decfd){logger[_0x1efd('0x11')](_0x1efd('0xc'),_0x55fee0,_0x4decfd);_0x2cac1e(_0x4decfd);});});} \ No newline at end of file +var _0x6b55=['then','info','request\x20sent','debug','error','Setting,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6b55,0x149));var _0x56b5=function(_0x3344ca,_0x46ed78){_0x3344ca=_0x3344ca-0x0;var _0x321312=_0x6b55[_0x3344ca];return _0x321312;};'use strict';var _=require(_0x56b5('0x0'));var util=require(_0x56b5('0x1'));var moment=require(_0x56b5('0x2'));var BPromise=require(_0x56b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x56b5('0x5'));var logger=require(_0x56b5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x56b5('0x7'));var client=jayson[_0x56b5('0x8')][_0x56b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x568e24,_0x2ee0d5,_0x411f2f){return new BPromise(function(_0x3b2e62,_0x4c24bd){return client[_0x56b5('0xa')](_0x568e24,_0x411f2f)[_0x56b5('0xb')](function(_0x2a7554){logger[_0x56b5('0xc')]('Setting,\x20%s,\x20%s',_0x2ee0d5,_0x56b5('0xd'));logger[_0x56b5('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x2ee0d5,_0x56b5('0xd'),JSON['stringify'](_0x2a7554));if(_0x2a7554['error']){if(_0x2a7554[_0x56b5('0xf')]['code']===0x1f4){logger[_0x56b5('0xf')](_0x56b5('0x10'),_0x2ee0d5,_0x2a7554['error'][_0x56b5('0x11')]);return _0x4c24bd(_0x2a7554[_0x56b5('0xf')]['message']);}logger[_0x56b5('0xf')]('Setting,\x20%s,\x20%s',_0x2ee0d5,_0x2a7554[_0x56b5('0xf')][_0x56b5('0x11')]);return _0x3b2e62(_0x2a7554[_0x56b5('0xf')][_0x56b5('0x11')]);}else{logger['info'](_0x56b5('0x10'),_0x2ee0d5,'request\x20sent');_0x3b2e62(_0x2a7554[_0x56b5('0x12')][_0x56b5('0x11')]);}})[_0x56b5('0x13')](function(_0x2f4c4a){logger[_0x56b5('0xf')](_0x56b5('0x10'),_0x2ee0d5,_0x2f4c4a);_0x4c24bd(_0x2f4c4a);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4f51248..c724b7c 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 _0xdc5a=['./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','send','status','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5f035d,_0x27e513){var _0x49e75b=function(_0x274d14){while(--_0x274d14){_0x5f035d['push'](_0x5f035d['shift']());}};_0x49e75b(++_0x27e513);}(_0xdc5a,0x19b));var _0xadc5=function(_0x3a7d66,_0x1c0f27){_0x3a7d66=_0x3a7d66-0x0;var _0x1a21de=_0xdc5a[_0x3a7d66];return _0x1a21de;};'use strict';var multer=require(_0xadc5('0x0'));var util=require(_0xadc5('0x1'));var path=require(_0xadc5('0x2'));var timeout=require(_0xadc5('0x3'));var express=require(_0xadc5('0x4'));var router=express['Router']();var auth=require(_0xadc5('0x5'));var interaction=require(_0xadc5('0x6'));var config=require('../../config/environment');var controller=require(_0xadc5('0x7'));router[_0xadc5('0x8')]('/',auth[_0xadc5('0x9')](),controller[_0xadc5('0xa')]);router['get']('/describe',auth[_0xadc5('0x9')](),controller[_0xadc5('0xb')]);router[_0xadc5('0x8')](_0xadc5('0xc'),auth[_0xadc5('0x9')](),controller[_0xadc5('0xd')]);router['get'](_0xadc5('0xe'),auth[_0xadc5('0x9')](),controller[_0xadc5('0xf')]);router[_0xadc5('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xadc5('0x10')]);router['get'](_0xadc5('0x11'),auth['isAuthenticated'](),controller[_0xadc5('0x12')]);router[_0xadc5('0x8')](_0xadc5('0x13'),auth[_0xadc5('0x9')](),controller['getInteractions']);router[_0xadc5('0x8')](_0xadc5('0x14'),controller[_0xadc5('0x15')]);router[_0xadc5('0x8')](_0xadc5('0x16'),auth[_0xadc5('0x9')](),controller[_0xadc5('0x17')]);router[_0xadc5('0x18')]('/',auth[_0xadc5('0x9')](),controller[_0xadc5('0x19')]);router[_0xadc5('0x18')]('/:id/dispositions',auth[_0xadc5('0x9')](),controller[_0xadc5('0x1a')]);router[_0xadc5('0x18')](_0xadc5('0x1b'),auth['isAuthenticated'](),controller[_0xadc5('0x1c')]);router['post']('/:id/notify',controller['notify']);router[_0xadc5('0x18')](_0xadc5('0x11'),auth[_0xadc5('0x9')](),controller['addApplications']);router[_0xadc5('0x18')]('/:id/send',auth['isAuthenticated'](),controller[_0xadc5('0x1d')]);router[_0xadc5('0x18')]('/:id/status',controller[_0xadc5('0x1e')]);router[_0xadc5('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xadc5('0x1f')]('/:id',auth[_0xadc5('0x9')](),controller['update']);router[_0xadc5('0x20')]('/:id',auth[_0xadc5('0x9')](),controller[_0xadc5('0x21')]);router[_0xadc5('0x20')](_0xadc5('0xe'),auth[_0xadc5('0x9')](),controller[_0xadc5('0x22')]);router[_0xadc5('0x20')](_0xadc5('0x1b'),auth[_0xadc5('0x9')](),controller[_0xadc5('0x23')]);router[_0xadc5('0x20')](_0xadc5('0x16'),auth[_0xadc5('0x9')](),controller[_0xadc5('0x24')]);module[_0xadc5('0x25')]=router; \ No newline at end of file +var _0x83cc=['index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','send','status','put','destroy','delete','removeDispositions','removeAgents','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','isAuthenticated'];(function(_0x2a0580,_0xdc730f){var _0x3409d5=function(_0x7035c2){while(--_0x7035c2){_0x2a0580['push'](_0x2a0580['shift']());}};_0x3409d5(++_0xdc730f);}(_0x83cc,0x90));var _0xc83c=function(_0x5d672b,_0x28f0e4){_0x5d672b=_0x5d672b-0x0;var _0x3268fc=_0x83cc[_0x5d672b];return _0x3268fc;};'use strict';var multer=require(_0xc83c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc83c('0x1'));var express=require(_0xc83c('0x2'));var router=express[_0xc83c('0x3')]();var auth=require(_0xc83c('0x4'));var interaction=require(_0xc83c('0x5'));var config=require('../../config/environment');var controller=require(_0xc83c('0x6'));router['get']('/',auth[_0xc83c('0x7')](),controller[_0xc83c('0x8')]);router[_0xc83c('0x9')](_0xc83c('0xa'),auth[_0xc83c('0x7')](),controller[_0xc83c('0xb')]);router[_0xc83c('0x9')](_0xc83c('0xc'),auth[_0xc83c('0x7')](),controller[_0xc83c('0xd')]);router[_0xc83c('0x9')](_0xc83c('0xe'),auth[_0xc83c('0x7')](),controller[_0xc83c('0xf')]);router['get'](_0xc83c('0x10'),auth[_0xc83c('0x7')](),controller[_0xc83c('0x11')]);router['get']('/:id/applications',auth[_0xc83c('0x7')](),controller[_0xc83c('0x12')]);router['get'](_0xc83c('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xc83c('0x9')](_0xc83c('0x14'),controller['statusGet']);router['get'](_0xc83c('0x15'),auth[_0xc83c('0x7')](),controller[_0xc83c('0x16')]);router[_0xc83c('0x17')]('/',auth[_0xc83c('0x7')](),controller[_0xc83c('0x18')]);router[_0xc83c('0x17')](_0xc83c('0xe'),auth['isAuthenticated'](),controller[_0xc83c('0x19')]);router[_0xc83c('0x17')](_0xc83c('0x10'),auth[_0xc83c('0x7')](),controller[_0xc83c('0x1a')]);router[_0xc83c('0x17')](_0xc83c('0x1b'),controller[_0xc83c('0x1c')]);router['post'](_0xc83c('0x1d'),auth[_0xc83c('0x7')](),controller['addApplications']);router[_0xc83c('0x17')](_0xc83c('0x1e'),auth[_0xc83c('0x7')](),controller[_0xc83c('0x1f')]);router['post']('/:id/status',controller[_0xc83c('0x20')]);router[_0xc83c('0x17')](_0xc83c('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xc83c('0x21')](_0xc83c('0xc'),auth[_0xc83c('0x7')](),controller['update']);router['delete'](_0xc83c('0xc'),auth['isAuthenticated'](),controller[_0xc83c('0x22')]);router[_0xc83c('0x23')](_0xc83c('0xe'),auth[_0xc83c('0x7')](),controller[_0xc83c('0x24')]);router['delete'](_0xc83c('0x10'),auth[_0xc83c('0x7')](),controller['removeAnswers']);router['delete'](_0xc83c('0x15'),auth[_0xc83c('0x7')](),controller[_0xc83c('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index cf5b268..c9d71d6 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 _0x9af1=['clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','randomstring','exports','name','STRING','twilio','skebby','connectel'];(function(_0x1e3069,_0x4e064d){var _0x45c282=function(_0x5b3c7f){while(--_0x5b3c7f){_0x1e3069['push'](_0x1e3069['shift']());}};_0x45c282(++_0x4e064d);}(_0x9af1,0x68));var _0x19af=function(_0x21417b,_0x49805b){_0x21417b=_0x21417b-0x0;var _0xb08fcc=_0x9af1[_0x21417b];return _0xb08fcc;};'use strict';var Sequelize=require(_0x19af('0x0'));var rs=require(_0x19af('0x1'));module[_0x19af('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x19af('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x19af('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x19af('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x19af('0x4')]},'type':{'type':Sequelize['ENUM'](_0x19af('0x5'),_0x19af('0x6'),_0x19af('0x7'),_0x19af('0x8'),_0x19af('0x9'),'clickatell',_0x19af('0xa'),_0x19af('0xb'),_0x19af('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x19af('0x4')]},'authId':{'type':Sequelize[_0x19af('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x19af('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x19af('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x19af('0x4')]},'senderString':{'type':Sequelize[_0x19af('0x4')]},'deliveryReport':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x19af('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x19af('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x19af('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x19af('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1c2ac2){if(!_0x1c2ac2)this[_0x19af('0xf')]('mandatoryDispositionPauseId',null);this[_0x19af('0xf')]('mandatoryDisposition',_0x1c2ac2);}}}; \ No newline at end of file +var _0x34bd=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate','twilio','plivo','clickatell','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x34bd,0x1d2));var _0xd34b=function(_0x498381,_0x122bfc){_0x498381=_0x498381-0x0;var _0x7e0ae8=_0x34bd[_0x498381];return _0x7e0ae8;};'use strict';var Sequelize=require(_0xd34b('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xd34b('0x1')],'unique':_0xd34b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xd34b('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xd34b('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xd34b('0x1')],'defaultValue':function(){return rs[_0xd34b('0x3')]();}},'phone':{'type':Sequelize[_0xd34b('0x1')]},'type':{'type':Sequelize['ENUM'](_0xd34b('0x4'),'skebby','connectel','clicksend',_0xd34b('0x5'),_0xd34b('0x6'),_0xd34b('0x7'),_0xd34b('0x8'),_0xd34b('0x9'),_0xd34b('0xa'))},'accountSid':{'type':Sequelize[_0xd34b('0x1')]},'authId':{'type':Sequelize[_0xd34b('0x1')]},'authToken':{'type':Sequelize[_0xd34b('0x1')]},'smsMethod':{'type':Sequelize[_0xd34b('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd34b('0x1')]},'password':{'type':Sequelize[_0xd34b('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xd34b('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xd34b('0x1')]},'deliveryReport':{'type':Sequelize[_0xd34b('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xd34b('0x1')]},'notificationTemplate':{'type':Sequelize[_0xd34b('0xd')],'defaultValue':function(){return _0xd34b('0xe');}},'notificationSound':{'type':Sequelize[_0xd34b('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd34b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd34b('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd34b('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd34b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd34b('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd34b('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xd34b('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c74e2){if(!_0x3c74e2)this['setDataValue'](_0xd34b('0x11'),null);this[_0xd34b('0x12')](_0xd34b('0x13'),_0x3c74e2);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 8283bc6..41a5fa1 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 _0x1e86=['addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','client','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','name','send','index','map','SmsAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','Pause','include','find','create','body','role','user','autoAssociation','mandatoryDispositionPause','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','orderBy','Applications','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','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','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','sequelize','transaction','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','state'];(function(_0x20510e,_0x34f705){var _0x50f7fa=function(_0x420470){while(--_0x420470){_0x20510e['push'](_0x20510e['shift']());}};_0x50f7fa(++_0x34f705);}(_0x1e86,0x1c9));var _0x61e8=function(_0xbb9ff2,_0x371e82){_0xbb9ff2=_0xbb9ff2-0x0;var _0x39c5b9=_0x1e86[_0xbb9ff2];return _0x39c5b9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x61e8('0x0'));var zipdir=require(_0x61e8('0x1'));var jsonpatch=require(_0x61e8('0x2'));var rp=require('request-promise');var moment=require(_0x61e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x61e8('0x4'));var util=require('util');var path=require(_0x61e8('0x5'));var sox=require(_0x61e8('0x6'));var csv=require(_0x61e8('0x7'));var ejs=require(_0x61e8('0x8'));var fs=require('fs');var _=require(_0x61e8('0x9'));var squel=require(_0x61e8('0xa'));var crypto=require(_0x61e8('0xb'));var jsforce=require(_0x61e8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x61e8('0x7'));var querystring=require(_0x61e8('0xd'));var Papa=require(_0x61e8('0xe'));var Redis=require(_0x61e8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x61e8('0x10'));var as=require(_0x61e8('0x11'));var hardwareService=require(_0x61e8('0x12'));var logger=require(_0x61e8('0x13'))(_0x61e8('0x14'));var utils=require(_0x61e8('0x15'));var config=require(_0x61e8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x61e8('0x17'))['db'];config[_0x61e8('0x18')]=_[_0x61e8('0x19')](config[_0x61e8('0x18')],{'host':_0x61e8('0x1a'),'port':0x18eb});var socket=require(_0x61e8('0x1b'))(new Redis(config['redis']));require(_0x61e8('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x61e8('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1f7d0,_0x45e004,_0x5e98f1,_0x317979){return new BPromise(function(_0x4c766c,_0x2d0b7c){var _0x26459d=_0x317979||client;return _0x26459d['request'](_0x1f7d0,_0x5e98f1)['then'](function(_0x3af66f){logger['info']('SmsAccount,\x20%s,\x20%s',_0x45e004,_0x61e8('0x1e'));logger[_0x61e8('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x45e004,'request\x20sent',JSON[_0x61e8('0x20')](_0x3af66f));if(_0x3af66f[_0x61e8('0x21')]){if(_0x3af66f[_0x61e8('0x21')][_0x61e8('0x22')]===0x1f4){logger['error'](_0x61e8('0x23'),_0x45e004,_0x3af66f[_0x61e8('0x21')][_0x61e8('0x24')]);return _0x2d0b7c(_0x3af66f[_0x61e8('0x21')][_0x61e8('0x24')]);}logger['error'](_0x61e8('0x23'),_0x45e004,_0x3af66f[_0x61e8('0x21')][_0x61e8('0x24')]);return _0x4c766c(_0x3af66f[_0x61e8('0x21')][_0x61e8('0x24')]);}else{logger[_0x61e8('0x25')](_0x61e8('0x23'),_0x45e004,_0x61e8('0x1e'));_0x4c766c(_0x3af66f[_0x61e8('0x26')][_0x61e8('0x24')]);}})[_0x61e8('0x27')](function(_0x166923){logger[_0x61e8('0x21')](_0x61e8('0x23'),_0x45e004,_0x166923);_0x2d0b7c(_0x166923);});});}function respondWithStatusCode(_0x471e84,_0x100ae8){_0x100ae8=_0x100ae8||0xcc;return function(_0x594dd9){if(_0x594dd9){return _0x471e84[_0x61e8('0x28')](_0x100ae8);}return _0x471e84['status'](_0x100ae8)[_0x61e8('0x29')]();};}function respondWithResult(_0x1d2c20,_0x4a674e){_0x4a674e=_0x4a674e||0xc8;return function(_0x444040){if(_0x444040){return _0x1d2c20[_0x61e8('0x2a')](_0x4a674e)[_0x61e8('0x2b')](_0x444040);}};}function respondWithFilteredResult(_0x4ec6da,_0x11ecc0){return function(_0x4d19c1){if(_0x4d19c1){var _0x36d7a7=_0x4d19c1[_0x61e8('0x2c')],_0x4140e5=_0x11ecc0[_0x61e8('0x2d')],_0x24392f=_0x11ecc0[_0x61e8('0x2d')]+_0x11ecc0[_0x61e8('0x2e')],_0x3501ff;if(_0x24392f>=_0x36d7a7){_0x24392f=_0x36d7a7;_0x3501ff=0xc8;}else{_0x3501ff=0xce;}_0x4ec6da['status'](_0x3501ff);return _0x4ec6da[_0x61e8('0x2f')](_0x61e8('0x30'),_0x4140e5+'-'+_0x24392f+'/'+_0x36d7a7)['json'](_0x4d19c1);}return null;};}function patchUpdates(_0x5b7aae){return function(_0x5a2f25){try{jsonpatch[_0x61e8('0x31')](_0x5a2f25,_0x5b7aae,!![]);}catch(_0x49144b){return BPromise[_0x61e8('0x32')](_0x49144b);}return _0x5a2f25[_0x61e8('0x33')]();};}function saveUpdates(_0x3ac763,_0x43031c){return function(_0x298e1c){if(_0x298e1c){return _0x298e1c[_0x61e8('0x34')](_0x3ac763)['then'](function(_0x1d51a7){return _0x1d51a7;});}return null;};}function removeEntity(_0x4ac619,_0x2effab){return function(_0x15904c){if(_0x15904c){return _0x15904c['destroy']()[_0x61e8('0x35')](function(){var _0x106046=_0x15904c[_0x61e8('0x36')]({'plain':!![]});var _0x33ba5b=_0x61e8('0x37');return db[_0x61e8('0x38')][_0x61e8('0x39')]({'where':{'type':_0x33ba5b,'resourceId':_0x106046['id']}})[_0x61e8('0x35')](function(){return _0x15904c;});})[_0x61e8('0x35')](function(){_0x4ac619[_0x61e8('0x2a')](0xcc)[_0x61e8('0x29')]();});}};}function handleEntityNotFound(_0x3561e4,_0x5346ed){return function(_0x3dd2fa){if(!_0x3dd2fa){_0x3561e4[_0x61e8('0x28')](0x194);}return _0x3dd2fa;};}function handleError(_0x3add89,_0x297156){_0x297156=_0x297156||0x1f4;return function(_0x3e7bd0){logger[_0x61e8('0x21')](_0x3e7bd0['stack']);if(_0x3e7bd0[_0x61e8('0x3a')]){delete _0x3e7bd0[_0x61e8('0x3a')];}_0x3add89[_0x61e8('0x2a')](_0x297156)[_0x61e8('0x3b')](_0x3e7bd0);};}exports[_0x61e8('0x3c')]=function(_0x58511b,_0x8a90e6){var _0x3b6ee1={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x19f05f={},_0x57e13d={'count':0x0,'rows':[]};var _0x5107c1=_[_0x61e8('0x3d')](db[_0x61e8('0x3e')][_0x61e8('0x3f')],function(_0x51b21d){return{'name':_0x51b21d[_0x61e8('0x40')],'type':_0x51b21d[_0x61e8('0x41')]['key']};});_0x19f05f['model']=_[_0x61e8('0x3d')](_0x5107c1,_0x61e8('0x3a'));_0x19f05f[_0x61e8('0x42')]=_[_0x61e8('0x43')](_0x58511b[_0x61e8('0x42')]);_0x19f05f[_0x61e8('0x44')]=_[_0x61e8('0x45')](_0x19f05f[_0x61e8('0x46')],_0x19f05f[_0x61e8('0x42')]);_0x3b6ee1['attributes']=_[_0x61e8('0x45')](_0x19f05f[_0x61e8('0x46')],qs[_0x61e8('0x47')](_0x58511b[_0x61e8('0x42')]['fields']));_0x3b6ee1['attributes']=_0x3b6ee1['attributes'][_0x61e8('0x48')]?_0x3b6ee1[_0x61e8('0x49')]:_0x19f05f['model'];if(!_0x58511b[_0x61e8('0x42')][_0x61e8('0x4a')]('nolimit')){_0x3b6ee1[_0x61e8('0x2e')]=qs[_0x61e8('0x2e')](_0x58511b[_0x61e8('0x42')][_0x61e8('0x2e')]);_0x3b6ee1[_0x61e8('0x2d')]=qs[_0x61e8('0x2d')](_0x58511b['query'][_0x61e8('0x2d')]);}_0x3b6ee1[_0x61e8('0x4b')]=qs['sort'](_0x58511b[_0x61e8('0x42')][_0x61e8('0x4c')]);_0x3b6ee1[_0x61e8('0x4d')]=qs['filters'](_[_0x61e8('0x4e')](_0x58511b[_0x61e8('0x42')],_0x19f05f[_0x61e8('0x44')]),_0x5107c1);if(_0x58511b['query'][_0x61e8('0x4f')]){_0x3b6ee1[_0x61e8('0x4d')]=_[_0x61e8('0x50')](_0x3b6ee1['where'],{'$or':_['map'](_0x5107c1,function(_0x4afb64){if(_0x4afb64['type']!==_0x61e8('0x51')){var _0x28106b={};_0x28106b[_0x4afb64[_0x61e8('0x3a')]]={'$like':'%'+_0x58511b[_0x61e8('0x42')][_0x61e8('0x4f')]+'%'};return _0x28106b;}})});}_0x3b6ee1=_[_0x61e8('0x50')]({},_0x3b6ee1,_0x58511b[_0x61e8('0x52')]);var _0xb28dd6={'where':_0x3b6ee1[_0x61e8('0x4d')]};return db['SmsAccount'][_0x61e8('0x2c')](_0xb28dd6)[_0x61e8('0x35')](function(_0x5cd1f5){_0x57e13d[_0x61e8('0x2c')]=_0x5cd1f5;if(_0x58511b[_0x61e8('0x42')][_0x61e8('0x53')]){_0x3b6ee1['include']=[{'all':!![]}];}return db[_0x61e8('0x3e')][_0x61e8('0x54')](_0x3b6ee1);})[_0x61e8('0x35')](function(_0x154a90){_0x57e13d[_0x61e8('0x55')]=_0x154a90;return _0x57e13d;})[_0x61e8('0x35')](respondWithFilteredResult(_0x8a90e6,_0x3b6ee1))[_0x61e8('0x27')](handleError(_0x8a90e6,null));};exports[_0x61e8('0x56')]=function(_0x348e17,_0x420c98){var _0x1eca8c={'raw':![],'where':{'id':_0x348e17[_0x61e8('0x57')]['id']},'include':[{'model':db[_0x61e8('0x58')],'as':'mandatoryDispositionPause'}]},_0x118c96={};_0x118c96[_0x61e8('0x46')]=_[_0x61e8('0x43')](db[_0x61e8('0x3e')][_0x61e8('0x3f')]);_0x118c96[_0x61e8('0x42')]=_[_0x61e8('0x43')](_0x348e17[_0x61e8('0x42')]);_0x118c96[_0x61e8('0x44')]=_[_0x61e8('0x45')](_0x118c96[_0x61e8('0x46')],_0x118c96[_0x61e8('0x42')]);_0x1eca8c[_0x61e8('0x49')]=_[_0x61e8('0x45')](_0x118c96['model'],qs[_0x61e8('0x47')](_0x348e17[_0x61e8('0x42')][_0x61e8('0x47')]));_0x1eca8c[_0x61e8('0x49')]=_0x1eca8c[_0x61e8('0x49')]['length']?_0x1eca8c['attributes']:_0x118c96['model'];if(_0x348e17[_0x61e8('0x42')]['includeAll']){_0x1eca8c[_0x61e8('0x59')]=[{'all':!![]}];}_0x1eca8c=_[_0x61e8('0x50')]({},_0x1eca8c,_0x348e17[_0x61e8('0x52')]);return db['SmsAccount'][_0x61e8('0x5a')](_0x1eca8c)[_0x61e8('0x35')](handleEntityNotFound(_0x420c98,null))['then'](respondWithResult(_0x420c98,null))['catch'](handleError(_0x420c98,null));};exports[_0x61e8('0x5b')]=function(_0x3a365e,_0x37eacf){return db[_0x61e8('0x3e')][_0x61e8('0x5b')](_0x3a365e[_0x61e8('0x5c')],{})[_0x61e8('0x35')](function(_0x5ac666){var _0x174a45=_0x3a365e['user'][_0x61e8('0x36')]({'plain':!![]});if(!_0x174a45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174a45[_0x61e8('0x5d')]===_0x61e8('0x5e')){var _0x4c14d9=_0x5ac666['get']({'plain':!![]});var _0x1cf664='SmsAccounts';return db['UserProfileSection'][_0x61e8('0x5a')]({'where':{'name':_0x1cf664,'userProfileId':_0x174a45['userProfileId']},'raw':!![]})['then'](function(_0x339e91){if(_0x339e91&&_0x339e91[_0x61e8('0x5f')]===0x0){return db[_0x61e8('0x38')][_0x61e8('0x5b')]({'name':_0x4c14d9[_0x61e8('0x3a')],'resourceId':_0x4c14d9['id'],'type':_0x339e91[_0x61e8('0x3a')],'sectionId':_0x339e91['id']},{})[_0x61e8('0x35')](function(){return _0x5ac666;});}else{return _0x5ac666;}})[_0x61e8('0x27')](function(_0x19633c){logger[_0x61e8('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19633c);throw _0x19633c;});}return _0x5ac666;})[_0x61e8('0x35')](respondWithResult(_0x37eacf,0xc9))[_0x61e8('0x27')](handleError(_0x37eacf,null));};exports[_0x61e8('0x34')]=function(_0x1186ff,_0x4183c4){if(_0x1186ff[_0x61e8('0x5c')]['id']){delete _0x1186ff[_0x61e8('0x5c')]['id'];}return db['SmsAccount'][_0x61e8('0x5a')]({'where':{'id':_0x1186ff[_0x61e8('0x57')]['id']},'include':[{'model':db[_0x61e8('0x58')],'as':_0x61e8('0x60')}]})['then'](handleEntityNotFound(_0x4183c4,null))['then'](saveUpdates(_0x1186ff[_0x61e8('0x5c')],null))[_0x61e8('0x35')](respondWithResult(_0x4183c4,null))['catch'](handleError(_0x4183c4,null));};exports[_0x61e8('0x39')]=function(_0x9763ed,_0xb1eca4){return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x9763ed[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0xb1eca4,null))[_0x61e8('0x35')](removeEntity(_0xb1eca4,null))[_0x61e8('0x27')](handleError(_0xb1eca4,null));};exports['describe']=function(_0x1c8e39,_0x1943c6){return db[_0x61e8('0x3e')][_0x61e8('0x61')]()[_0x61e8('0x35')](respondWithResult(_0x1943c6,null))[_0x61e8('0x27')](handleError(_0x1943c6,null));};exports['addDisposition']=function(_0x28d471,_0x1841de,_0x4d457a){if(_0x28d471[_0x61e8('0x5c')]['id']){delete _0x28d471[_0x61e8('0x5c')]['id'];}return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x28d471[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x1841de,null))[_0x61e8('0x35')](function(_0x386599){if(_0x386599){_0x28d471[_0x61e8('0x5c')][_0x61e8('0x62')]=_0x386599['id'];return db[_0x61e8('0x63')][_0x61e8('0x5b')](_0x28d471[_0x61e8('0x5c')]);}})[_0x61e8('0x35')](respondWithResult(_0x1841de,null))[_0x61e8('0x27')](handleError(_0x1841de,null));};exports[_0x61e8('0x64')]=function(_0x191e60,_0x598e58,_0x1b6e52){var _0x37a015={'raw':![],'where':{}};var _0x85bc3c={};var _0x44dae0={'count':0x0,'rows':[]};return db[_0x61e8('0x3e')][_0x61e8('0x65')]({'where':{'id':_0x191e60[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x598e58,null))[_0x61e8('0x35')](function(_0x3e1279){if(_0x3e1279){_0x85bc3c[_0x61e8('0x46')]=_[_0x61e8('0x43')](db[_0x61e8('0x63')]['rawAttributes']);_0x85bc3c['query']=_[_0x61e8('0x43')](_0x191e60[_0x61e8('0x42')]);_0x85bc3c[_0x61e8('0x44')]=_[_0x61e8('0x45')](_0x85bc3c[_0x61e8('0x46')],_0x85bc3c['query']);_0x37a015[_0x61e8('0x49')]=_[_0x61e8('0x45')](_0x85bc3c[_0x61e8('0x46')],qs[_0x61e8('0x47')](_0x191e60[_0x61e8('0x42')]['fields']));_0x37a015[_0x61e8('0x49')]=_0x37a015[_0x61e8('0x49')][_0x61e8('0x48')]?_0x37a015[_0x61e8('0x49')]:_0x85bc3c['model'];if(!_0x191e60[_0x61e8('0x42')]['hasOwnProperty'](_0x61e8('0x66'))){_0x37a015[_0x61e8('0x2e')]=qs[_0x61e8('0x2e')](_0x191e60[_0x61e8('0x42')][_0x61e8('0x2e')]);_0x37a015['offset']=qs[_0x61e8('0x2d')](_0x191e60['query'][_0x61e8('0x2d')]);}_0x37a015[_0x61e8('0x4b')]=qs[_0x61e8('0x4c')](_0x191e60[_0x61e8('0x42')][_0x61e8('0x4c')]);_0x37a015['where']=qs[_0x61e8('0x44')](_[_0x61e8('0x4e')](_0x191e60['query'],_0x85bc3c[_0x61e8('0x44')]));_0x37a015['where'][_0x61e8('0x62')]=_0x3e1279['id'];if(_0x191e60[_0x61e8('0x42')]['filter']){_0x37a015[_0x61e8('0x4d')]=_[_0x61e8('0x50')](_0x37a015[_0x61e8('0x4d')],{'$or':_[_0x61e8('0x3d')](_0x37a015[_0x61e8('0x49')],function(_0xaf12a5){var _0x457fe3={};_0x457fe3[_0xaf12a5]={'$like':'%'+_0x191e60['query'][_0x61e8('0x4f')]+'%'};return _0x457fe3;})});}_0x37a015=_[_0x61e8('0x50')]({},_0x37a015,_0x191e60[_0x61e8('0x52')]);return db[_0x61e8('0x63')][_0x61e8('0x2c')]({'where':_0x37a015['where']})[_0x61e8('0x35')](function(_0x127dc5){_0x44dae0[_0x61e8('0x2c')]=_0x127dc5;if(_0x191e60['query'][_0x61e8('0x53')]){_0x37a015['include']=[{'all':!![]}];}return db[_0x61e8('0x63')][_0x61e8('0x54')](_0x37a015);})[_0x61e8('0x35')](function(_0x5a6918){_0x44dae0[_0x61e8('0x55')]=_0x5a6918;return _0x44dae0;});}})[_0x61e8('0x35')](respondWithFilteredResult(_0x598e58,_0x37a015))['catch'](handleError(_0x598e58,null));};exports[_0x61e8('0x67')]=function(_0x15f9b0,_0x40b3af,_0x2bfc3b){return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x15f9b0[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x40b3af,null))[_0x61e8('0x35')](function(_0x2ba397){if(_0x2ba397){return _0x2ba397['removeDispositions'](_0x15f9b0['query'][_0x61e8('0x68')]);}})[_0x61e8('0x35')](respondWithStatusCode(_0x40b3af,null))['catch'](handleError(_0x40b3af,null));};exports[_0x61e8('0x69')]=function(_0x2eae03,_0x2558bd,_0x3e9e28){if(_0x2eae03[_0x61e8('0x5c')]['id']){delete _0x2eae03['body']['id'];}return db[_0x61e8('0x3e')]['find']({'where':{'id':_0x2eae03[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x2558bd,null))[_0x61e8('0x35')](function(_0x5bfb8a){if(_0x5bfb8a){_0x2eae03[_0x61e8('0x5c')][_0x61e8('0x62')]=_0x5bfb8a['id'];return db[_0x61e8('0x6a')]['create'](_0x2eae03['body']);}})['then'](respondWithResult(_0x2558bd,null))[_0x61e8('0x27')](handleError(_0x2558bd,null));};exports[_0x61e8('0x6b')]=function(_0x40b331,_0x37c405,_0x1fd82e){var _0x3f449b={'raw':![],'where':{}};var _0x3ec766={};var _0x4a3e6b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x61e8('0x65')]({'where':{'id':_0x40b331[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x37c405,null))['then'](function(_0x3b53da){if(_0x3b53da){_0x3ec766[_0x61e8('0x46')]=_['keys'](db[_0x61e8('0x6a')][_0x61e8('0x3f')]);_0x3ec766[_0x61e8('0x42')]=_['keys'](_0x40b331['query']);_0x3ec766[_0x61e8('0x44')]=_[_0x61e8('0x45')](_0x3ec766['model'],_0x3ec766[_0x61e8('0x42')]);_0x3f449b[_0x61e8('0x49')]=_['intersection'](_0x3ec766[_0x61e8('0x46')],qs[_0x61e8('0x47')](_0x40b331[_0x61e8('0x42')]['fields']));_0x3f449b[_0x61e8('0x49')]=_0x3f449b[_0x61e8('0x49')][_0x61e8('0x48')]?_0x3f449b[_0x61e8('0x49')]:_0x3ec766[_0x61e8('0x46')];if(!_0x40b331[_0x61e8('0x42')][_0x61e8('0x4a')](_0x61e8('0x66'))){_0x3f449b[_0x61e8('0x2e')]=qs[_0x61e8('0x2e')](_0x40b331['query'][_0x61e8('0x2e')]);_0x3f449b[_0x61e8('0x2d')]=qs[_0x61e8('0x2d')](_0x40b331[_0x61e8('0x42')]['offset']);}_0x3f449b[_0x61e8('0x4b')]=qs[_0x61e8('0x4c')](_0x40b331[_0x61e8('0x42')][_0x61e8('0x4c')]);_0x3f449b['where']=qs[_0x61e8('0x44')](_['pick'](_0x40b331['query'],_0x3ec766[_0x61e8('0x44')]));_0x3f449b[_0x61e8('0x4d')]['SmsAccountId']=_0x3b53da['id'];if(_0x40b331[_0x61e8('0x42')][_0x61e8('0x4f')]){_0x3f449b[_0x61e8('0x4d')]=_[_0x61e8('0x50')](_0x3f449b['where'],{'$or':_['map'](_0x3f449b['attributes'],function(_0x4915fa){var _0x331ef4={};_0x331ef4[_0x4915fa]={'$like':'%'+_0x40b331[_0x61e8('0x42')][_0x61e8('0x4f')]+'%'};return _0x331ef4;})});}_0x3f449b=_['merge']({},_0x3f449b,_0x40b331[_0x61e8('0x52')]);return db[_0x61e8('0x6a')]['count']({'where':_0x3f449b[_0x61e8('0x4d')]})[_0x61e8('0x35')](function(_0x5ca506){_0x4a3e6b['count']=_0x5ca506;if(_0x40b331[_0x61e8('0x42')]['includeAll']){_0x3f449b[_0x61e8('0x59')]=[{'all':!![]}];}return db[_0x61e8('0x6a')][_0x61e8('0x54')](_0x3f449b);})['then'](function(_0x34ae39){_0x4a3e6b[_0x61e8('0x55')]=_0x34ae39;return _0x4a3e6b;});}})[_0x61e8('0x35')](respondWithFilteredResult(_0x37c405,_0x3f449b))[_0x61e8('0x27')](handleError(_0x37c405,null));};exports[_0x61e8('0x6c')]=function(_0x41579b,_0xf7ed53,_0x1e930c){return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x41579b[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0xf7ed53,null))[_0x61e8('0x35')](function(_0x2f10dc){if(_0x2f10dc){return _0x2f10dc[_0x61e8('0x6c')](_0x41579b[_0x61e8('0x42')][_0x61e8('0x68')]);}})[_0x61e8('0x35')](respondWithStatusCode(_0xf7ed53,null))[_0x61e8('0x27')](handleError(_0xf7ed53,null));};exports[_0x61e8('0x6d')]=function(_0x34345f,_0x13e1b3,_0x4a2d2f){var _0x2df457={'channel':_0x61e8('0x6e')};var _0x29e4c1=[];var _0x28c812=[];var _0x19de95={};return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x34345f[_0x61e8('0x57')]['id']},'include':[{'model':db[_0x61e8('0x6f')],'as':'Applications'}]})[_0x61e8('0x35')](handleEntityNotFound(_0x13e1b3,null))['then'](function(_0x445f4c){_0x2df457['account']=_0x445f4c;_0x2df457['applications']=_[_0x61e8('0x70')](_0x445f4c[_0x61e8('0x71')],[_0x61e8('0x72')],[_0x61e8('0x73')]);if(_0x2df457[_0x61e8('0x74')][_0x61e8('0x71')]){delete _0x2df457[_0x61e8('0x74')][_0x61e8('0x71')];}return db[_0x61e8('0x75')][_0x61e8('0x61')]();})[_0x61e8('0x35')](function(_0xef4be8){if(!_0xef4be8){throw new db[(_0x61e8('0x76'))]['ValidationError'](_0x61e8('0x77'));}_0x29e4c1=_['difference'](_[_0x61e8('0x43')](_0xef4be8),['createdAt',_0x61e8('0x78')]);_0x28c812=_[_0x61e8('0x79')](_[_0x61e8('0x43')](_0xef4be8),['createdAt',_0x61e8('0x78'),_0x61e8('0x7a'),_0x61e8('0x7b')]);_0x2df457[_0x61e8('0x5c')]={'mapKey':_0x61e8('0x7c')};if(_0x2df457[_0x61e8('0x74')][_0x61e8('0x41')]){switch(_0x2df457['account'][_0x61e8('0x41')]){case _0x61e8('0x7d'):_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x7f')];_0x2df457[_0x61e8('0x5c')]['body']=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x80')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x81')]=_0x34345f['body'][_0x61e8('0x82')];break;case _0x61e8('0x83'):_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')]='+'+_0x34345f[_0x61e8('0x5c')][_0x61e8('0x84')];_0x2df457['body'][_0x61e8('0x5c')]=_0x34345f[_0x61e8('0x5c')]['text'];break;case _0x61e8('0x85'):_0x2df457['body'][_0x61e8('0x7e')]=_0x34345f['body'][_0x61e8('0x7e')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x24')];break;case _0x61e8('0x86'):_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x7e')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x5c')];_0x2df457['body'][_0x61e8('0x81')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x87')];break;case'plivo':_0x2df457['body'][_0x61e8('0x7e')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x7f')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f['body'][_0x61e8('0x88')];_0x2df457['body']['messageId']=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x89')];break;case _0x61e8('0x8a'):_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')]='+'+_0x34345f[_0x61e8('0x5c')]['results'][0x0][_0x61e8('0x7e')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f['body'][_0x61e8('0x8b')][0x0][_0x61e8('0x8c')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x81')]=_0x34345f[_0x61e8('0x5c')]['results'][0x0]['messageId'];break;case _0x61e8('0x8d'):_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')]=_0x34345f['body']['originatingAddress'];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x8e')][_0x61e8('0x24')];break;case _0x61e8('0x8f'):_0x2df457['body'][_0x61e8('0x7e')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x90')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x8c')];_0x2df457['body'][_0x61e8('0x81')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x91')];break;case _0x61e8('0x92'):_0x2df457[_0x61e8('0x5c')][_0x61e8('0x81')]=_0x34345f[_0x61e8('0x5c')][0x0][_0x61e8('0x24')]['id'];_0x2df457[_0x61e8('0x5c')]['from']=_0x34345f[_0x61e8('0x5c')][0x0]['message'][_0x61e8('0x7e')];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f['body'][0x0]['message'][_0x61e8('0x8c')];break;case _0x61e8('0x93'):_0x2df457['body'][_0x61e8('0x7e')]=_0x34345f[_0x61e8('0x5c')]['from'];_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x24')];_0x2df457['body'][_0x61e8('0x81')]=_0x34345f[_0x61e8('0x5c')][_0x61e8('0x94')];break;}}if(_0x2df457[_0x61e8('0x5c')]['id']){delete _0x2df457[_0x61e8('0x5c')]['id'];}if(_[_0x61e8('0x95')](_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')])){throw new db['Sequelize'][(_0x61e8('0x96'))](_0x61e8('0x97'));}if(_[_0x61e8('0x95')](_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')])||_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')]===''){throw new db['Sequelize'][(_0x61e8('0x96'))](_0x61e8('0x98'));}if(_[_0x61e8('0x95')](_0x2df457[_0x61e8('0x5c')]['mapKey'])){throw new db[(_0x61e8('0x76'))]['ValidationError'](_0x61e8('0x99')+_0x28c812);}if(!_[_0x61e8('0x9a')](_0x28c812,_0x2df457[_0x61e8('0x5c')][_0x61e8('0x9b')])){throw new db[(_0x61e8('0x76'))]['ValidationError'](_0x61e8('0x9c')+_0x28c812);}_0x19de95[_0x2df457[_0x61e8('0x5c')][_0x61e8('0x9b')]]=_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')];return db[_0x61e8('0x9d')][_0x61e8('0x5a')]({'where':{'id':_0x2df457['account'][_0x61e8('0x7b')]},'include':[{'model':db[_0x61e8('0x75')],'as':_0x61e8('0x9e'),'where':_0x19de95,'limit':0x1,'order':[[_0x61e8('0x78'),_0x61e8('0x9f')]]}]});})[_0x61e8('0x35')](handleEntityNotFound(_0x13e1b3,null))['then'](function(_0x3b7c9d){if(_0x3b7c9d){_0x2df457[_0x61e8('0xa0')]=_[_0x61e8('0xa1')](_0x3b7c9d,['Contacts']);if(_0x3b7c9d[_0x61e8('0x9e')][_0x61e8('0x48')]){return _0x3b7c9d['Contacts'][0x0];}var _0xcc9de8=_[_0x61e8('0x19')](_0x2df457[_0x61e8('0x5c')],{'firstName':_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')],'ListId':_0x3b7c9d['id']});_0xcc9de8[_0x2df457[_0x61e8('0x5c')][_0x61e8('0x9b')]]=_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')];return db[_0x61e8('0x75')]['create'](_0xcc9de8,{'fields':_0x29e4c1,'raw':!![]});}})[_0x61e8('0x35')](handleEntityNotFound(_0x13e1b3,null))[_0x61e8('0x35')](function(_0x422c53){if(_0x422c53){_0x2df457[_0x61e8('0xa2')]=_0x422c53;var _0x249e72={'ContactId':_0x422c53['id'],'phone':_0x2df457[_0x61e8('0x5c')][_0x61e8('0x7e')],'SmsAccountId':_0x34345f[_0x61e8('0x57')]['id']};var _0x4405d8={'ContactId':_0x422c53['id'],'SmsAccountId':_0x34345f[_0x61e8('0x57')]['id'],'closed':![]};return db[_0x61e8('0xa3')][_0x61e8('0x5a')]({'where':_0x4405d8})['then'](function(_0x3e7e79){if(_0x3e7e79){return[_0x3e7e79,![]];}return db['SmsInteraction'][_0x61e8('0x5b')](_0x249e72)[_0x61e8('0x35')](function(_0x6fee46){return[_0x6fee46,!![]];});});}})[_0x61e8('0xa4')](function(_0x244542,_0x4b34e0){_0x2df457[_0x61e8('0xa5')]=_0x244542[_0x61e8('0x36')]({'plain':!![]});_0x2df457[_0x61e8('0xa5')][_0x61e8('0xa6')]=![];if(_0x4b34e0){if(_0x2df457[_0x61e8('0x74')][_0x61e8('0xa7')]){_0x2df457[_0x61e8('0xa8')][_0x61e8('0xa9')]({'id':0x0,'priority':_0x2df457['applications'][_0x61e8('0x48')]+0x1,'app':_0x61e8('0xaa'),'appdata':_0x61e8('0xab'),'interval':'*,*,*,*'});}_0x2df457[_0x61e8('0xa5')]['created']=!![];}return db[_0x61e8('0xac')][_0x61e8('0x5b')]({'phone':_0x2df457[_0x61e8('0x5c')]['from'],'messageId':_0x2df457[_0x61e8('0x5c')][_0x61e8('0x81')],'body':_0x2df457[_0x61e8('0x5c')][_0x61e8('0x5c')],'SmsAccountId':_0x34345f['params']['id'],'SmsInteractionId':_0x244542['id'],'direction':'in','ContactId':_0x244542['ContactId'],'AttachmentId':_0x2df457['body'][_0x61e8('0xad')]});})['then'](function(_0x5ee377){_0x2df457[_0x61e8('0x24')]=_0x5ee377;if(_0x2df457['interaction'][_0x61e8('0xae')]){return db[_0x61e8('0xaf')][_0x61e8('0x5a')]({'attributes':['id',_0x61e8('0x3a')],'where':{'id':_0x2df457['interaction'][_0x61e8('0xae')]}})[_0x61e8('0x35')](function(_0x430d7e){if(_0x430d7e){_0x2df457[_0x61e8('0xa8')][_0x61e8('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x430d7e[_0x61e8('0x3a')]+','+(_0x2df457[_0x61e8('0x74')][_0x61e8('0xb1')]||0xa),'interval':_0x61e8('0xb2')});}return respondWithRpcPromise(_0x61e8('0xb3'),_0x61e8('0xb4'),_0x2df457);});}return respondWithRpcPromise(_0x61e8('0xb3'),_0x61e8('0xb4'),_0x2df457);})[_0x61e8('0x35')](function(_0x5c385f){if(_0x5c385f){var _0x16ec50=0xc8;var _0x45e598=_0x61e8('0xb5');logger[_0x61e8('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x45e598,_0x16ec50,_0x61e8('0xb6'));logger['debug'](_0x61e8('0xb7'),_0x45e598,_0x16ec50,_0x61e8('0xb6'),JSON[_0x61e8('0x20')](_0x5c385f));if(_0x2df457['account']['type']===_0x61e8('0x7d')){return _0x13e1b3[_0x61e8('0x2a')](_0x16ec50)[_0x61e8('0x2f')]('Content-Type',_0x61e8('0xb8'))[_0x61e8('0x3b')](_0x61e8('0xb9'));}else{return _0x13e1b3[_0x61e8('0x2a')](_0x16ec50)[_0x61e8('0x2b')](_0x5c385f);}}})[_0x61e8('0x27')](handleError(_0x13e1b3,null));};exports[_0x61e8('0xba')]=function(_0x41c10b,_0x2f4d5f,_0x361b0c){return db[_0x61e8('0x3e')][_0x61e8('0x65')]({'where':{'id':_0x41c10b[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x2f4d5f,null))['then'](function(_0x3b4845){if(_0x3b4845){return db[_0x61e8('0xbb')][_0x61e8('0xbc')](function(_0x547e11){return db[_0x61e8('0x6f')][_0x61e8('0x39')]({'where':{'SmsAccountId':_0x41c10b[_0x61e8('0x57')]['id']},'transaction':_0x547e11})[_0x61e8('0x35')](function(_0x39a685){var _0x2502ec=_[_0x61e8('0x3d')](_0x41c10b['body'],function(_0x3fe0e8){_0x3fe0e8[_0x61e8('0x62')]=_0x41c10b['params']['id'];return _0x3fe0e8;});return db['SmsApplication']['bulkCreate'](_0x2502ec,{'transaction':_0x547e11});});})[_0x61e8('0x35')](function(){return db[_0x61e8('0x6f')][_0x61e8('0xbd')]({'where':{'SmsAccountId':_0x41c10b[_0x61e8('0x57')]['id']},'order':_0x61e8('0x72')});});}})[_0x61e8('0x35')](respondWithResult(_0x2f4d5f,null))[_0x61e8('0x27')](handleError(_0x2f4d5f,null));};exports[_0x61e8('0xbe')]=function(_0x5f3885,_0x27f40e,_0x127a1d){var _0x4bdbb0={};var _0x766f58={};var _0xe5670a;var _0x571e69;return db['SmsAccount'][_0x61e8('0x65')]({'where':{'id':_0x5f3885[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x27f40e,null))[_0x61e8('0x35')](function(_0x1623e0){if(_0x1623e0){_0xe5670a=_0x1623e0;_0x766f58[_0x61e8('0x46')]=_[_0x61e8('0x43')](db[_0x61e8('0x6f')][_0x61e8('0x3f')]);_0x766f58[_0x61e8('0x42')]=_[_0x61e8('0x43')](_0x5f3885['query']);_0x766f58['filters']=_[_0x61e8('0x45')](_0x766f58[_0x61e8('0x46')],_0x766f58[_0x61e8('0x42')]);_0x4bdbb0['attributes']=_[_0x61e8('0x45')](_0x766f58[_0x61e8('0x46')],qs['fields'](_0x5f3885[_0x61e8('0x42')][_0x61e8('0x47')]));_0x4bdbb0[_0x61e8('0x49')]=_0x4bdbb0[_0x61e8('0x49')][_0x61e8('0x48')]?_0x4bdbb0[_0x61e8('0x49')]:_0x766f58[_0x61e8('0x46')];_0x4bdbb0[_0x61e8('0x4b')]=qs[_0x61e8('0x4c')](_0x5f3885[_0x61e8('0x42')]['sort']);_0x4bdbb0[_0x61e8('0x4d')]=qs[_0x61e8('0x44')](_[_0x61e8('0x4e')](_0x5f3885[_0x61e8('0x42')],_0x766f58[_0x61e8('0x44')]));if(_0x5f3885[_0x61e8('0x42')][_0x61e8('0x4f')]){_0x4bdbb0[_0x61e8('0x4d')]=_['merge'](_0x4bdbb0[_0x61e8('0x4d')],{'$or':_[_0x61e8('0x3d')](_0x4bdbb0[_0x61e8('0x49')],function(_0x2e863c){var _0x3316f2={};_0x3316f2[_0x2e863c]={'$like':'%'+_0x5f3885['query'][_0x61e8('0x4f')]+'%'};return _0x3316f2;})});}_0x4bdbb0=_[_0x61e8('0x50')]({},_0x4bdbb0,_0x5f3885[_0x61e8('0x52')]);return _0xe5670a[_0x61e8('0xbe')](_0x4bdbb0);}})[_0x61e8('0x35')](function(_0x420707){if(_0x420707){_0x571e69=_0x420707['length'];if(!_0x5f3885[_0x61e8('0x42')][_0x61e8('0x4a')](_0x61e8('0x66'))){_0x4bdbb0[_0x61e8('0x2e')]=qs['limit'](_0x5f3885[_0x61e8('0x42')][_0x61e8('0x2e')]);_0x4bdbb0[_0x61e8('0x2d')]=qs[_0x61e8('0x2d')](_0x5f3885[_0x61e8('0x42')][_0x61e8('0x2d')]);}return _0xe5670a[_0x61e8('0xbe')](_0x4bdbb0);}})[_0x61e8('0x35')](function(_0x57a888){if(_0x57a888){return _0x57a888?{'count':_0x571e69,'rows':_0x57a888}:null;}})[_0x61e8('0x35')](respondWithResult(_0x27f40e,null))[_0x61e8('0x27')](handleError(_0x27f40e,null));};exports['getInteractions']=function(_0x391932,_0x57f28c,_0x34d6d7){var _0x2ac3b={'raw':![],'where':{}};var _0x475684={};var _0x539835={'count':0x0,'rows':[]};return db[_0x61e8('0x3e')][_0x61e8('0x65')]({'where':{'id':_0x391932['params']['id']}})['then'](handleEntityNotFound(_0x57f28c,null))['then'](function(_0xf2541c){if(_0xf2541c){_0x475684[_0x61e8('0x46')]=_['keys'](db[_0x61e8('0xa3')]['rawAttributes']);_0x475684[_0x61e8('0x42')]=_['keys'](_0x391932[_0x61e8('0x42')]);_0x475684[_0x61e8('0x44')]=_['intersection'](_0x475684[_0x61e8('0x46')],_0x475684['query']);_0x2ac3b[_0x61e8('0x49')]=_[_0x61e8('0x45')](_0x475684[_0x61e8('0x46')],qs[_0x61e8('0x47')](_0x391932[_0x61e8('0x42')][_0x61e8('0x47')]));_0x2ac3b[_0x61e8('0x49')]=_0x2ac3b[_0x61e8('0x49')]['length']?_0x2ac3b[_0x61e8('0x49')]:_0x475684['model'];if(!_0x391932[_0x61e8('0x42')]['hasOwnProperty'](_0x61e8('0x66'))){_0x2ac3b['limit']=qs[_0x61e8('0x2e')](_0x391932[_0x61e8('0x42')]['limit']);_0x2ac3b[_0x61e8('0x2d')]=qs[_0x61e8('0x2d')](_0x391932[_0x61e8('0x42')]['offset']);}_0x2ac3b[_0x61e8('0x4b')]=qs['sort'](_0x391932[_0x61e8('0x42')][_0x61e8('0x4c')]);_0x2ac3b[_0x61e8('0x4d')]=qs[_0x61e8('0x44')](_[_0x61e8('0x4e')](_0x391932[_0x61e8('0x42')],_0x475684[_0x61e8('0x44')]));_0x2ac3b[_0x61e8('0x4d')][_0x61e8('0x62')]=_0xf2541c['id'];if(_0x391932[_0x61e8('0x42')][_0x61e8('0x4f')]){_0x2ac3b[_0x61e8('0x4d')]=_[_0x61e8('0x50')](_0x2ac3b[_0x61e8('0x4d')],{'$or':_[_0x61e8('0x3d')](_0x2ac3b[_0x61e8('0x49')],function(_0x4a4ae5){var _0x586e55={};_0x586e55[_0x4a4ae5]={'$like':'%'+_0x391932['query']['filter']+'%'};return _0x586e55;})});}_0x2ac3b=_[_0x61e8('0x50')]({},_0x2ac3b,_0x391932[_0x61e8('0x52')]);return db[_0x61e8('0xa3')]['count']({'where':_0x2ac3b[_0x61e8('0x4d')]})['then'](function(_0x5af764){_0x539835[_0x61e8('0x2c')]=_0x5af764;if(_0x391932[_0x61e8('0x42')][_0x61e8('0x53')]){_0x2ac3b[_0x61e8('0x59')]=[{'model':db['CmContact'],'as':_0x61e8('0xbf'),'required':![]},{'model':db['User'],'as':_0x61e8('0xc0'),'attributes':[_0x61e8('0x3a'),_0x61e8('0xc1'),_0x61e8('0xc2')],'required':![]},{'model':db[_0x61e8('0xc3')],'as':'Tags','attributes':['id','name',_0x61e8('0xc4')],'where':_0x391932['query'][_0x61e8('0xc5')]?{'id':_0x391932[_0x61e8('0x42')]['tag']}:undefined,'required':_0x391932[_0x61e8('0x42')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x2ac3b);})[_0x61e8('0x35')](function(_0x417a03){_0x539835[_0x61e8('0x55')]=_0x417a03;return _0x539835;});}})['then'](respondWithFilteredResult(_0x57f28c,_0x2ac3b))[_0x61e8('0x27')](handleError(_0x57f28c,null));};exports[_0x61e8('0x3b')]=function(_0x58c1d4,_0x4758ea,_0x4165ca){var _0x59b6f0,_0x2761ee,_0x12a093;if(_['isNil'](_0x58c1d4[_0x61e8('0x5c')][_0x61e8('0x5c')])||_0x58c1d4['body'][_0x61e8('0x5c')]===''){throw new db[(_0x61e8('0x76'))][(_0x61e8('0x96'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x61e8('0x95')](_0x58c1d4[_0x61e8('0x5c')]['to'])){throw new db['Sequelize'][(_0x61e8('0x96'))](_0x61e8('0xc6'));}_0x59b6f0=_0x58c1d4['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x58c1d4['params']['id']},'include':[{'model':db[_0x61e8('0x9d')],'as':_0x61e8('0xc7'),'include':[{'model':db[_0x61e8('0x75')],'as':_0x61e8('0x9e'),'where':{'mobile':_0x59b6f0},'limit':0x1,'order':[[_0x61e8('0x78'),'DESC']]}]}]})[_0x61e8('0x35')](handleEntityNotFound(_0x4758ea,null))[_0x61e8('0x35')](function(_0x4a87ad){if(_0x4a87ad&&_0x4a87ad[_0x61e8('0xc7')]){_0x2761ee=_0x4a87ad['get']({'plain':!![]});if(_0x2761ee[_0x61e8('0xc7')]&&_0x2761ee[_0x61e8('0xc7')][_0x61e8('0x9e')][_0x61e8('0x48')]){return _0x2761ee[_0x61e8('0xc7')]['Contacts'][0x0];}return db[_0x61e8('0x75')][_0x61e8('0x5b')](_[_0x61e8('0x19')](_0x58c1d4['body'],{'firstName':_0x59b6f0,'mobile':_0x59b6f0,'phone':_0x59b6f0,'ListId':_0x2761ee[_0x61e8('0x7b')]}));}})[_0x61e8('0x35')](handleEntityNotFound(_0x4758ea,null))[_0x61e8('0x35')](function(_0x474702){if(_0x474702){_0x12a093=_0x474702;return db['SmsInteraction'][_0x61e8('0x5a')]({'where':{'ContactId':_0x12a093['id'],'closed':![],'SmsAccountId':_0x2761ee['id']}})['then'](function(_0x1e72ac){if(_0x1e72ac){return[_0x1e72ac,![]];}return db['SmsInteraction']['create']({'UserId':_0x58c1d4[_0x61e8('0x5e')]['id'],'ContactId':_0x12a093['id'],'SmsAccountId':_0x2761ee['id'],'phone':_0x59b6f0,'firstMsgDirection':'out','Messages':[_['merge'](_0x58c1d4['body'],{'read':![],'body':_0x58c1d4[_0x61e8('0x5c')][_0x61e8('0x5c')],'phone':_0x59b6f0,'SmsAccountId':_0x2761ee['id'],'UserId':_0x58c1d4[_0x61e8('0x5e')]['id'],'ContactId':_0x12a093['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x61e8('0xc8')}]})['then'](function(_0x4f2086){return[_0x4f2086,!![]];});});}})[_0x61e8('0xa4')](function(_0x24c559,_0x29fe65){if(_0x29fe65){return _0x24c559;}return db[_0x61e8('0xac')]['create'](_[_0x61e8('0x50')](_0x58c1d4['body'],{'read':![],'body':_0x58c1d4['body'][_0x61e8('0x5c')],'phone':_0x59b6f0,'SmsAccountId':_0x2761ee['id'],'SmsInteractionId':_0x24c559['id'],'UserId':_0x58c1d4[_0x61e8('0x5e')]['id'],'ContactId':_0x12a093['id']}))[_0x61e8('0x35')](function(_0x59ae42){_0x24c559[_0x61e8('0xc9')][_0x61e8('0xc8')]=[];_0x24c559['dataValues'][_0x61e8('0xc8')][_0x61e8('0xa9')](_0x59ae42[_0x61e8('0xc9')]);return _0x24c559;});})[_0x61e8('0x35')](respondWithResult(_0x4758ea,null))[_0x61e8('0x27')](handleError(_0x4758ea,null));};exports[_0x61e8('0x2a')]=function(_0x5367ae,_0x7b04d5,_0x2ce1ec){if(_0x5367ae[_0x61e8('0x5c')]['id']){delete _0x5367ae[_0x61e8('0x5c')]['id'];}var _0x4306de,_0x2f5cc1,_0x384e4f;return db['SmsAccount']['find']({'where':{'id':_0x5367ae[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x7b04d5,null))[_0x61e8('0x35')](function(_0xba9a7c){if(_0xba9a7c){_0x384e4f=_0xba9a7c;logger[_0x61e8('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x61e8('0x2a'),_0x61e8('0xca'),_0xba9a7c[_0x61e8('0x41')],util[_0x61e8('0xcb')](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));switch(_0xba9a7c['type']){case'skebby':if(_0x5367ae[_0x61e8('0x5c')][_0x61e8('0xcc')]&&_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x2a')]){_0x2f5cc1=_0x5367ae['body'][_0x61e8('0x2a')];return db[_0x61e8('0xac')][_0x61e8('0x5a')]({'where':{'messageId':_0x5367ae[_0x61e8('0x5c')]['skebby_dispatch_id']}});}break;case _0x61e8('0x85'):if(_0x5367ae[_0x61e8('0x5c')][_0x61e8('0xcd')]&&_0x5367ae['body'][_0x61e8('0xce')]){_0x2f5cc1=_0x5367ae['body'][_0x61e8('0xce')];return db[_0x61e8('0xac')][_0x61e8('0x5a')]({'where':{'messageId':_0x5367ae[_0x61e8('0x5c')][_0x61e8('0xcd')]}});}break;case _0x61e8('0x86'):if(_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x87')]&&_0x5367ae[_0x61e8('0x5c')][_0x61e8('0xcf')]){_0x2f5cc1=_0x5367ae[_0x61e8('0x5c')][_0x61e8('0xcf')];return db['SmsMessage'][_0x61e8('0x5a')]({'where':{'messageId':_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x87')]}});}break;case'infobip':var _0x237db7=_0x5367ae[_0x61e8('0x5c')]['results'][0x0];if(_0x237db7[_0x61e8('0x81')]&&_0x237db7[_0x61e8('0x2a')][_0x61e8('0xd0')]===_0x61e8('0xd1')){_0x2f5cc1=_0x237db7[_0x61e8('0x2a')][_0x61e8('0xd0')];return db[_0x61e8('0xac')]['find']({'where':{'messageId':_0x237db7['messageId']}});}break;case _0x61e8('0x8f'):if(_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x81')]&&_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x2a')]){_0x2f5cc1=_0x5367ae['body'][_0x61e8('0x2a')];return db[_0x61e8('0xac')][_0x61e8('0x5a')]({'where':{'messageId':_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x81')]}});}break;case'bandwidth':if(_0x5367ae[_0x61e8('0x5c')][0x0][_0x61e8('0x24')]['id']){_0x2f5cc1=_0x5367ae[_0x61e8('0x5c')][0x0][_0x61e8('0x41')];return db[_0x61e8('0xac')][_0x61e8('0x5a')]({'where':{'messageId':_0x5367ae[_0x61e8('0x5c')][0x0][_0x61e8('0x24')]['id']}});}break;case _0x61e8('0x93'):if(_0x5367ae['body']['redif']&&_0x5367ae['body'][_0x61e8('0x2a')]){_0x2f5cc1=_0x5367ae[_0x61e8('0x5c')][_0x61e8('0x2a')];return db[_0x61e8('0xac')][_0x61e8('0x5a')]({'where':{'messageId':_0x5367ae[_0x61e8('0x5c')]['redif']}});}break;}}})[_0x61e8('0x35')](handleEntityNotFound(_0x7b04d5,null))[_0x61e8('0x35')](function(_0x1af85f){if(_0x1af85f){_0x4306de=_0x1af85f;switch(_0x384e4f[_0x61e8('0x41')]){case'skebby':if(_0x2f5cc1===_0x61e8('0xd1')){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x61e8('0x2a'),_0x61e8('0x83'),util[_0x61e8('0xcb')](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2f5cc1==='1'){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger[_0x61e8('0x21')](_0x61e8('0xd2'),_0x61e8('0x2a'),_0x61e8('0x83'),util[_0x61e8('0xcb')](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x61e8('0x86'):if(!_0x5367ae[_0x61e8('0x5c')][_0x61e8('0xd3')]&&_0x2f5cc1>=0xc8&&_0x2f5cc1<=0xce){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger[_0x61e8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x61e8('0x2a'),'clicksend',util['inspect'](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x61e8('0x8a'):var _0x2003d5=_0x5367ae['body'][_0x61e8('0x8b')][0x0];if(_0x2003d5[_0x61e8('0x2a')][_0x61e8('0xd0')]===_0x61e8('0xd1')){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger['error'](_0x61e8('0xd2'),_0x61e8('0x2a'),_0x61e8('0x8a'),util[_0x61e8('0xcb')](_0x5367ae['body'],{'showHidden':![],'depth':null}));}break;case _0x61e8('0x8f'):if(_0x2f5cc1==_0x61e8('0xd4')||_0x2f5cc1=='RECEIVED_BY_RECIPIENT'){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger[_0x61e8('0x21')](_0x61e8('0xd2'),_0x61e8('0x2a'),_0x61e8('0x8f'),util[_0x61e8('0xcb')](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x61e8('0x92'):if(_0x2f5cc1==_0x61e8('0xd5')){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger[_0x61e8('0x21')](_0x61e8('0xd2'),_0x61e8('0x2a'),'bandwidth',util[_0x61e8('0xcb')](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x61e8('0x93'):if(_0x2f5cc1===_0x61e8('0xd6')||_0x2f5cc1===_0x61e8('0xd7')){return _0x4306de[_0x61e8('0x34')]({'read':!![]});}else{logger['error'](_0x61e8('0xd2'),_0x61e8('0x2a'),_0x61e8('0x93'),util['inspect'](_0x5367ae[_0x61e8('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4306de;}})[_0x61e8('0x35')](respondWithResult(_0x7b04d5,null))[_0x61e8('0x27')](handleError(_0x7b04d5,null));};exports[_0x61e8('0xd8')]=function(_0x5f0eee,_0x562359,_0xa89e41){var _0x551c6e,_0x76cb77,_0x24b4e7;return db['SmsAccount'][_0x61e8('0x5a')]({'where':{'id':_0x5f0eee[_0x61e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x562359,null))['then'](function(_0x23ec3e){if(_0x23ec3e){_0x24b4e7=_0x23ec3e;logger[_0x61e8('0x1f')](_0x61e8('0xd2'),_0x61e8('0x2a'),_0x61e8('0xca'),_0x23ec3e[_0x61e8('0x41')],util[_0x61e8('0xcb')](_0x5f0eee[_0x61e8('0x42')],{'showHidden':![],'depth':null}));switch(_0x23ec3e['type']){case _0x61e8('0x8d'):if(_0x5f0eee[_0x61e8('0x42')]['message-id']&&_0x5f0eee['query'][_0x61e8('0xd9')]){_0x76cb77=_0x5f0eee['query'][_0x61e8('0xd9')];return db[_0x61e8('0xac')][_0x61e8('0x5a')]({'where':{'messageId':_0x5f0eee['query']['message-id']}});}break;}}})[_0x61e8('0x35')](handleEntityNotFound(_0x562359,null))[_0x61e8('0x35')](function(_0x119d5a){if(_0x119d5a){_0x551c6e=_0x119d5a;switch(_0x24b4e7[_0x61e8('0x41')]){case _0x61e8('0x8d'):if(_0x76cb77==='2'||_0x76cb77==='6'){return _0x551c6e[_0x61e8('0x34')]({'read':!![]});}else{logger['error'](_0x61e8('0xd2'),_0x61e8('0x2a'),_0x61e8('0x8d'),util[_0x61e8('0xcb')](_0x5f0eee['query'],{'showHidden':![],'depth':null}));};break;}return _0x551c6e;}})[_0x61e8('0x35')](respondWithResult(_0x562359,null))[_0x61e8('0x27')](handleError(_0x562359,null));};exports['addAgents']=function(_0x4c59a9,_0x3111c7,_0x25906a){return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x4c59a9[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x3111c7,null))[_0x61e8('0x35')](function(_0x35e553){if(_0x35e553){return _0x35e553[_0x61e8('0xda')](_0x4c59a9[_0x61e8('0x5c')][_0x61e8('0x68')],_[_0x61e8('0xa1')](_0x4c59a9[_0x61e8('0x5c')],[_0x61e8('0x68'),'id'])||{})[_0x61e8('0xa4')](function(_0x44abef){for(var _0x37a546=0x0;_0x37a546<_0x4c59a9[_0x61e8('0x5c')][_0x61e8('0x68')][_0x61e8('0x48')];_0x37a546+=0x1){socket[_0x61e8('0xdb')](_0x61e8('0xdc'),{'UserId':_0x4c59a9[_0x61e8('0x5c')][_0x61e8('0x68')][_0x37a546],'SmsAccountId':_0x4c59a9['params']['id']});}return _0x44abef;});}})[_0x61e8('0x35')](respondWithResult(_0x3111c7,null))['catch'](handleError(_0x3111c7,null));};exports[_0x61e8('0xdd')]=function(_0x2db482,_0x458ee7,_0x136200){return db[_0x61e8('0x3e')][_0x61e8('0x5a')]({'where':{'id':_0x2db482[_0x61e8('0x57')]['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x458ee7,null))[_0x61e8('0x35')](function(_0x76262){if(_0x76262){return _0x76262['removeAgents'](_0x2db482[_0x61e8('0x42')][_0x61e8('0x68')])[_0x61e8('0x35')](function(){if(_[_0x61e8('0xde')](_0x2db482[_0x61e8('0x42')][_0x61e8('0x68')])){for(var _0x35cc9d=0x0;_0x35cc9d<_0x2db482[_0x61e8('0x42')][_0x61e8('0x68')][_0x61e8('0x48')];_0x35cc9d+=0x1){socket[_0x61e8('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x2db482[_0x61e8('0x42')][_0x61e8('0x68')][_0x35cc9d]),'SmsAccountId':Number(_0x2db482[_0x61e8('0x57')]['id'])});}}else{socket[_0x61e8('0xdb')](_0x61e8('0xdf'),{'UserId':Number(_0x2db482[_0x61e8('0x42')]['ids']),'SmsAccountId':Number(_0x2db482[_0x61e8('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x458ee7,null))[_0x61e8('0x27')](handleError(_0x458ee7,null));};exports['getAgents']=function(_0x24b902,_0x3ebf8f,_0x39d6f4){var _0x80a87f={};var _0xcdd134={};var _0x1ae1c8;var _0x5901e7;return db['SmsAccount']['findOne']({'where':{'id':_0x24b902['params']['id']}})[_0x61e8('0x35')](handleEntityNotFound(_0x3ebf8f,null))[_0x61e8('0x35')](function(_0xa1ad36){if(_0xa1ad36){_0x1ae1c8=_0xa1ad36;_0xcdd134[_0x61e8('0x46')]=_[_0x61e8('0x43')](db['User'][_0x61e8('0x3f')]);_0xcdd134[_0x61e8('0x42')]=_[_0x61e8('0x43')](_0x24b902[_0x61e8('0x42')]);_0xcdd134[_0x61e8('0x44')]=_['intersection'](_0xcdd134['model'],_0xcdd134[_0x61e8('0x42')]);_0x80a87f['attributes']=_['intersection'](_0xcdd134[_0x61e8('0x46')],qs[_0x61e8('0x47')](_0x24b902[_0x61e8('0x42')][_0x61e8('0x47')]));_0x80a87f[_0x61e8('0x49')]=_0x80a87f['attributes'][_0x61e8('0x48')]?_0x80a87f[_0x61e8('0x49')]:_0xcdd134['model'];_0x80a87f[_0x61e8('0x4b')]=qs[_0x61e8('0x4c')](_0x24b902[_0x61e8('0x42')][_0x61e8('0x4c')]);_0x80a87f[_0x61e8('0x4d')]=qs[_0x61e8('0x44')](_[_0x61e8('0x4e')](_0x24b902[_0x61e8('0x42')],_0xcdd134['filters']));if(_0x24b902[_0x61e8('0x42')][_0x61e8('0x4f')]){_0x80a87f[_0x61e8('0x4d')]=_['merge'](_0x80a87f['where'],{'$or':_[_0x61e8('0x3d')](_0x80a87f['attributes'],function(_0x3e2356){var _0x216bff={};_0x216bff[_0x3e2356]={'$like':'%'+_0x24b902[_0x61e8('0x42')][_0x61e8('0x4f')]+'%'};return _0x216bff;})});}_0x80a87f=_['merge']({},_0x80a87f,_0x24b902[_0x61e8('0x52')]);return _0x1ae1c8[_0x61e8('0xe0')](_0x80a87f);}})['then'](function(_0x442018){if(_0x442018){_0x5901e7=_0x442018[_0x61e8('0x48')];if(!_0x24b902[_0x61e8('0x42')][_0x61e8('0x4a')](_0x61e8('0x66'))){_0x80a87f['limit']=qs[_0x61e8('0x2e')](_0x24b902[_0x61e8('0x42')][_0x61e8('0x2e')]);_0x80a87f[_0x61e8('0x2d')]=qs[_0x61e8('0x2d')](_0x24b902['query'][_0x61e8('0x2d')]);}return _0x1ae1c8[_0x61e8('0xe0')](_0x80a87f);}})[_0x61e8('0x35')](function(_0xc17ba5){if(_0xc17ba5){return _0xc17ba5?{'count':_0x5901e7,'rows':_0xc17ba5}:null;}})['then'](respondWithResult(_0x3ebf8f,null))[_0x61e8('0x27')](handleError(_0x3ebf8f,null));}; \ No newline at end of file +var _0x7bd6=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end','status','count','set','Content-Range','json','apply','reject','then','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','send','Pause','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsAccount','include','rows','show','params','mandatoryDispositionPause','includeAll','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','Disposition','SmsAccountId','findAll','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','startRouting','info','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','SmsMessage','statusInt','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','addAgents','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf'];(function(_0x199f88,_0x5c5b06){var _0x37a532=function(_0x47bcd4){while(--_0x47bcd4){_0x199f88['push'](_0x199f88['shift']());}};_0x37a532(++_0x5c5b06);}(_0x7bd6,0xe2));var _0x67bd=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x7bd6[_0x5fa520];return _0x1bf6c4;};'use strict';var pdf=require(_0x67bd('0x0'));var emlformat=require(_0x67bd('0x1'));var rimraf=require(_0x67bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67bd('0x3'));var rp=require(_0x67bd('0x4'));var moment=require(_0x67bd('0x5'));var BPromise=require(_0x67bd('0x6'));var Mustache=require(_0x67bd('0x7'));var util=require(_0x67bd('0x8'));var path=require(_0x67bd('0x9'));var sox=require(_0x67bd('0xa'));var csv=require(_0x67bd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x67bd('0xc'));var crypto=require(_0x67bd('0xd'));var jsforce=require(_0x67bd('0xe'));var deskjs=require(_0x67bd('0xf'));var toCsv=require(_0x67bd('0xb'));var querystring=require('querystring');var Papa=require(_0x67bd('0x10'));var Redis=require(_0x67bd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x67bd('0x12'));var as=require(_0x67bd('0x13'));var hardwareService=require(_0x67bd('0x14'));var logger=require(_0x67bd('0x15'))('api');var utils=require(_0x67bd('0x16'));var config=require(_0x67bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x67bd('0x18')]=_[_0x67bd('0x19')](config['redis'],{'host':_0x67bd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67bd('0x18')]));require(_0x67bd('0x1b'))[_0x67bd('0x1c')](socket);var jayson=require(_0x67bd('0x1d'));var client=jayson[_0x67bd('0x1e')][_0x67bd('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x298de7,_0x4c1cb9,_0x390f2b,_0x10356a){return new BPromise(function(_0x159bf3,_0x1ea903){var _0x97d574=_0x10356a||client;return _0x97d574[_0x67bd('0x20')](_0x298de7,_0x390f2b)['then'](function(_0x531598){logger['info'](_0x67bd('0x21'),_0x4c1cb9,_0x67bd('0x22'));logger[_0x67bd('0x23')](_0x67bd('0x24'),_0x4c1cb9,'request\x20sent',JSON[_0x67bd('0x25')](_0x531598));if(_0x531598[_0x67bd('0x26')]){if(_0x531598[_0x67bd('0x26')]['code']===0x1f4){logger[_0x67bd('0x26')](_0x67bd('0x21'),_0x4c1cb9,_0x531598['error'][_0x67bd('0x27')]);return _0x1ea903(_0x531598[_0x67bd('0x26')][_0x67bd('0x27')]);}logger[_0x67bd('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4c1cb9,_0x531598[_0x67bd('0x26')]['message']);return _0x159bf3(_0x531598[_0x67bd('0x26')][_0x67bd('0x27')]);}else{logger['info'](_0x67bd('0x21'),_0x4c1cb9,_0x67bd('0x22'));_0x159bf3(_0x531598[_0x67bd('0x28')][_0x67bd('0x27')]);}})['catch'](function(_0x4c4f95){logger[_0x67bd('0x26')](_0x67bd('0x21'),_0x4c1cb9,_0x4c4f95);_0x1ea903(_0x4c4f95);});});}function respondWithStatusCode(_0x5adf11,_0x2ff1b0){_0x2ff1b0=_0x2ff1b0||0xcc;return function(_0x3a590b){if(_0x3a590b){return _0x5adf11['sendStatus'](_0x2ff1b0);}return _0x5adf11['status'](_0x2ff1b0)[_0x67bd('0x29')]();};}function respondWithResult(_0x843b17,_0x28973d){_0x28973d=_0x28973d||0xc8;return function(_0x566100){if(_0x566100){return _0x843b17[_0x67bd('0x2a')](_0x28973d)['json'](_0x566100);}};}function respondWithFilteredResult(_0x396f50,_0x3696d5){return function(_0x11cb72){if(_0x11cb72){var _0x573840=_0x11cb72[_0x67bd('0x2b')],_0x4e0d03=_0x3696d5['offset'],_0x14f3a3=_0x3696d5['offset']+_0x3696d5['limit'],_0x964257;if(_0x14f3a3>=_0x573840){_0x14f3a3=_0x573840;_0x964257=0xc8;}else{_0x964257=0xce;}_0x396f50[_0x67bd('0x2a')](_0x964257);return _0x396f50[_0x67bd('0x2c')](_0x67bd('0x2d'),_0x4e0d03+'-'+_0x14f3a3+'/'+_0x573840)[_0x67bd('0x2e')](_0x11cb72);}return null;};}function patchUpdates(_0x155a89){return function(_0x761067){try{jsonpatch[_0x67bd('0x2f')](_0x761067,_0x155a89,!![]);}catch(_0x33e062){return BPromise[_0x67bd('0x30')](_0x33e062);}return _0x761067['save']();};}function saveUpdates(_0x4c3ad9,_0x5e3073){return function(_0x4df8b8){if(_0x4df8b8){return _0x4df8b8['update'](_0x4c3ad9)[_0x67bd('0x31')](function(_0x3e2950){return _0x3e2950;});}return null;};}function removeEntity(_0x5477af,_0x1ff3e6){return function(_0x3e5ce6){if(_0x3e5ce6){return _0x3e5ce6[_0x67bd('0x32')]()['then'](function(){var _0x587d63=_0x3e5ce6[_0x67bd('0x33')]({'plain':!![]});var _0x1cb465=_0x67bd('0x34');return db[_0x67bd('0x35')][_0x67bd('0x32')]({'where':{'type':_0x1cb465,'resourceId':_0x587d63['id']}})[_0x67bd('0x31')](function(){return _0x3e5ce6;});})['then'](function(){_0x5477af[_0x67bd('0x2a')](0xcc)[_0x67bd('0x29')]();});}};}function handleEntityNotFound(_0x346b3d,_0x3a870c){return function(_0x408891){if(!_0x408891){_0x346b3d[_0x67bd('0x36')](0x194);}return _0x408891;};}function handleError(_0x10dee9,_0x200b9a){_0x200b9a=_0x200b9a||0x1f4;return function(_0x4ec4cd){logger[_0x67bd('0x26')](_0x4ec4cd[_0x67bd('0x37')]);if(_0x4ec4cd['name']){delete _0x4ec4cd['name'];}_0x10dee9['status'](_0x200b9a)[_0x67bd('0x38')](_0x4ec4cd);};}exports['index']=function(_0x45234a,_0x40ccd8){var _0x442f99={'include':[{'model':db[_0x67bd('0x39')],'as':'mandatoryDispositionPause'}]},_0x5c52b6={},_0x18ec77={'count':0x0,'rows':[]};var _0x22d5d0=_[_0x67bd('0x3a')](db['SmsAccount'][_0x67bd('0x3b')],function(_0x5d2fbc){return{'name':_0x5d2fbc[_0x67bd('0x3c')],'type':_0x5d2fbc[_0x67bd('0x3d')][_0x67bd('0x3e')]};});_0x5c52b6[_0x67bd('0x3f')]=_[_0x67bd('0x3a')](_0x22d5d0,_0x67bd('0x40'));_0x5c52b6[_0x67bd('0x41')]=_[_0x67bd('0x42')](_0x45234a[_0x67bd('0x41')]);_0x5c52b6[_0x67bd('0x43')]=_[_0x67bd('0x44')](_0x5c52b6[_0x67bd('0x3f')],_0x5c52b6[_0x67bd('0x41')]);_0x442f99[_0x67bd('0x45')]=_[_0x67bd('0x44')](_0x5c52b6['model'],qs[_0x67bd('0x46')](_0x45234a[_0x67bd('0x41')][_0x67bd('0x46')]));_0x442f99[_0x67bd('0x45')]=_0x442f99[_0x67bd('0x45')][_0x67bd('0x47')]?_0x442f99[_0x67bd('0x45')]:_0x5c52b6[_0x67bd('0x3f')];if(!_0x45234a[_0x67bd('0x41')][_0x67bd('0x48')](_0x67bd('0x49'))){_0x442f99['limit']=qs[_0x67bd('0x4a')](_0x45234a[_0x67bd('0x41')][_0x67bd('0x4a')]);_0x442f99[_0x67bd('0x4b')]=qs['offset'](_0x45234a[_0x67bd('0x41')][_0x67bd('0x4b')]);}_0x442f99[_0x67bd('0x4c')]=qs[_0x67bd('0x4d')](_0x45234a[_0x67bd('0x41')][_0x67bd('0x4d')]);_0x442f99[_0x67bd('0x4e')]=qs['filters'](_[_0x67bd('0x4f')](_0x45234a['query'],_0x5c52b6[_0x67bd('0x43')]),_0x22d5d0);if(_0x45234a['query'][_0x67bd('0x50')]){_0x442f99[_0x67bd('0x4e')]=_[_0x67bd('0x51')](_0x442f99['where'],{'$or':_[_0x67bd('0x3a')](_0x22d5d0,function(_0x1a73fa){if(_0x1a73fa[_0x67bd('0x3d')]!==_0x67bd('0x52')){var _0x50ca58={};_0x50ca58[_0x1a73fa[_0x67bd('0x40')]]={'$like':'%'+_0x45234a['query'][_0x67bd('0x50')]+'%'};return _0x50ca58;}})});}_0x442f99=_[_0x67bd('0x51')]({},_0x442f99,_0x45234a[_0x67bd('0x53')]);var _0x15f0db={'where':_0x442f99[_0x67bd('0x4e')]};return db[_0x67bd('0x54')][_0x67bd('0x2b')](_0x15f0db)['then'](function(_0x502cff){_0x18ec77[_0x67bd('0x2b')]=_0x502cff;if(_0x45234a[_0x67bd('0x41')]['includeAll']){_0x442f99[_0x67bd('0x55')]=[{'all':!![]}];}return db[_0x67bd('0x54')]['findAll'](_0x442f99);})[_0x67bd('0x31')](function(_0x42cec1){_0x18ec77[_0x67bd('0x56')]=_0x42cec1;return _0x18ec77;})[_0x67bd('0x31')](respondWithFilteredResult(_0x40ccd8,_0x442f99))['catch'](handleError(_0x40ccd8,null));};exports[_0x67bd('0x57')]=function(_0x4ed090,_0x5c07d8){var _0xcc5bb={'raw':![],'where':{'id':_0x4ed090[_0x67bd('0x58')]['id']},'include':[{'model':db[_0x67bd('0x39')],'as':_0x67bd('0x59')}]},_0x274f7d={};_0x274f7d[_0x67bd('0x3f')]=_[_0x67bd('0x42')](db['SmsAccount'][_0x67bd('0x3b')]);_0x274f7d[_0x67bd('0x41')]=_[_0x67bd('0x42')](_0x4ed090['query']);_0x274f7d[_0x67bd('0x43')]=_[_0x67bd('0x44')](_0x274f7d[_0x67bd('0x3f')],_0x274f7d['query']);_0xcc5bb['attributes']=_[_0x67bd('0x44')](_0x274f7d[_0x67bd('0x3f')],qs['fields'](_0x4ed090[_0x67bd('0x41')][_0x67bd('0x46')]));_0xcc5bb[_0x67bd('0x45')]=_0xcc5bb[_0x67bd('0x45')]['length']?_0xcc5bb[_0x67bd('0x45')]:_0x274f7d['model'];if(_0x4ed090[_0x67bd('0x41')][_0x67bd('0x5a')]){_0xcc5bb['include']=[{'all':!![]}];}_0xcc5bb=_['merge']({},_0xcc5bb,_0x4ed090['options']);return db[_0x67bd('0x54')][_0x67bd('0x5b')](_0xcc5bb)[_0x67bd('0x31')](handleEntityNotFound(_0x5c07d8,null))[_0x67bd('0x31')](respondWithResult(_0x5c07d8,null))[_0x67bd('0x5c')](handleError(_0x5c07d8,null));};exports[_0x67bd('0x5d')]=function(_0x656c5e,_0x333e09){return db[_0x67bd('0x54')][_0x67bd('0x5d')](_0x656c5e[_0x67bd('0x5e')],{})[_0x67bd('0x31')](function(_0x11f2a9){var _0x3af6e2=_0x656c5e[_0x67bd('0x5f')][_0x67bd('0x33')]({'plain':!![]});if(!_0x3af6e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af6e2[_0x67bd('0x60')]===_0x67bd('0x5f')){var _0x55d8c2=_0x11f2a9[_0x67bd('0x33')]({'plain':!![]});var _0x456194=_0x67bd('0x34');return db['UserProfileSection'][_0x67bd('0x5b')]({'where':{'name':_0x456194,'userProfileId':_0x3af6e2[_0x67bd('0x61')]},'raw':!![]})[_0x67bd('0x31')](function(_0x4aba96){if(_0x4aba96&&_0x4aba96[_0x67bd('0x62')]===0x0){return db['UserProfileResource'][_0x67bd('0x5d')]({'name':_0x55d8c2[_0x67bd('0x40')],'resourceId':_0x55d8c2['id'],'type':_0x4aba96[_0x67bd('0x40')],'sectionId':_0x4aba96['id']},{})[_0x67bd('0x31')](function(){return _0x11f2a9;});}else{return _0x11f2a9;}})[_0x67bd('0x5c')](function(_0x2b7669){logger[_0x67bd('0x26')](_0x67bd('0x63'),_0x2b7669);throw _0x2b7669;});}return _0x11f2a9;})[_0x67bd('0x31')](respondWithResult(_0x333e09,0xc9))['catch'](handleError(_0x333e09,null));};exports[_0x67bd('0x64')]=function(_0x44f6b7,_0x51e0b9){if(_0x44f6b7[_0x67bd('0x5e')]['id']){delete _0x44f6b7[_0x67bd('0x5e')]['id'];}return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0x44f6b7['params']['id']},'include':[{'model':db[_0x67bd('0x39')],'as':_0x67bd('0x59')}]})[_0x67bd('0x31')](handleEntityNotFound(_0x51e0b9,null))[_0x67bd('0x31')](saveUpdates(_0x44f6b7[_0x67bd('0x5e')],null))[_0x67bd('0x31')](respondWithResult(_0x51e0b9,null))[_0x67bd('0x5c')](handleError(_0x51e0b9,null));};exports[_0x67bd('0x32')]=function(_0x440a6b,_0x360807){return db['SmsAccount'][_0x67bd('0x5b')]({'where':{'id':_0x440a6b['params']['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x360807,null))[_0x67bd('0x31')](removeEntity(_0x360807,null))[_0x67bd('0x5c')](handleError(_0x360807,null));};exports[_0x67bd('0x65')]=function(_0x39aadc,_0x5cf5eb){return db['SmsAccount'][_0x67bd('0x65')]()[_0x67bd('0x31')](respondWithResult(_0x5cf5eb,null))[_0x67bd('0x5c')](handleError(_0x5cf5eb,null));};exports[_0x67bd('0x66')]=function(_0x5144d3,_0x2acadd,_0x4e89a6){if(_0x5144d3['body']['id']){delete _0x5144d3[_0x67bd('0x5e')]['id'];}return db['SmsAccount'][_0x67bd('0x5b')]({'where':{'id':_0x5144d3['params']['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x2acadd,null))[_0x67bd('0x31')](function(_0x42f4a8){if(_0x42f4a8){_0x5144d3[_0x67bd('0x5e')]['SmsAccountId']=_0x42f4a8['id'];return db['Disposition'][_0x67bd('0x5d')](_0x5144d3['body']);}})['then'](respondWithResult(_0x2acadd,null))[_0x67bd('0x5c')](handleError(_0x2acadd,null));};exports[_0x67bd('0x67')]=function(_0x6e30a7,_0x1ac4f2,_0x26fcea){var _0x2a0be4={'raw':![],'where':{}};var _0x1b76b2={};var _0x3f4478={'count':0x0,'rows':[]};return db[_0x67bd('0x54')]['findOne']({'where':{'id':_0x6e30a7[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x1ac4f2,null))[_0x67bd('0x31')](function(_0xd74003){if(_0xd74003){_0x1b76b2['model']=_[_0x67bd('0x42')](db[_0x67bd('0x68')]['rawAttributes']);_0x1b76b2[_0x67bd('0x41')]=_['keys'](_0x6e30a7['query']);_0x1b76b2[_0x67bd('0x43')]=_[_0x67bd('0x44')](_0x1b76b2['model'],_0x1b76b2['query']);_0x2a0be4['attributes']=_[_0x67bd('0x44')](_0x1b76b2[_0x67bd('0x3f')],qs[_0x67bd('0x46')](_0x6e30a7[_0x67bd('0x41')][_0x67bd('0x46')]));_0x2a0be4[_0x67bd('0x45')]=_0x2a0be4['attributes']['length']?_0x2a0be4[_0x67bd('0x45')]:_0x1b76b2['model'];if(!_0x6e30a7[_0x67bd('0x41')][_0x67bd('0x48')](_0x67bd('0x49'))){_0x2a0be4[_0x67bd('0x4a')]=qs[_0x67bd('0x4a')](_0x6e30a7['query'][_0x67bd('0x4a')]);_0x2a0be4[_0x67bd('0x4b')]=qs['offset'](_0x6e30a7[_0x67bd('0x41')][_0x67bd('0x4b')]);}_0x2a0be4[_0x67bd('0x4c')]=qs[_0x67bd('0x4d')](_0x6e30a7['query'][_0x67bd('0x4d')]);_0x2a0be4['where']=qs[_0x67bd('0x43')](_[_0x67bd('0x4f')](_0x6e30a7[_0x67bd('0x41')],_0x1b76b2[_0x67bd('0x43')]));_0x2a0be4[_0x67bd('0x4e')][_0x67bd('0x69')]=_0xd74003['id'];if(_0x6e30a7[_0x67bd('0x41')][_0x67bd('0x50')]){_0x2a0be4[_0x67bd('0x4e')]=_['merge'](_0x2a0be4[_0x67bd('0x4e')],{'$or':_[_0x67bd('0x3a')](_0x2a0be4['attributes'],function(_0x3f0c91){var _0x2096fc={};_0x2096fc[_0x3f0c91]={'$like':'%'+_0x6e30a7[_0x67bd('0x41')]['filter']+'%'};return _0x2096fc;})});}_0x2a0be4=_[_0x67bd('0x51')]({},_0x2a0be4,_0x6e30a7[_0x67bd('0x53')]);return db['Disposition'][_0x67bd('0x2b')]({'where':_0x2a0be4['where']})[_0x67bd('0x31')](function(_0x348c36){_0x3f4478['count']=_0x348c36;if(_0x6e30a7[_0x67bd('0x41')]['includeAll']){_0x2a0be4[_0x67bd('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x67bd('0x6a')](_0x2a0be4);})['then'](function(_0x25c390){_0x3f4478[_0x67bd('0x56')]=_0x25c390;return _0x3f4478;});}})[_0x67bd('0x31')](respondWithFilteredResult(_0x1ac4f2,_0x2a0be4))[_0x67bd('0x5c')](handleError(_0x1ac4f2,null));};exports[_0x67bd('0x6b')]=function(_0xb0e1ec,_0x38c767,_0x2beae){return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0xb0e1ec[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x38c767,null))[_0x67bd('0x31')](function(_0x14ee5e){if(_0x14ee5e){return _0x14ee5e[_0x67bd('0x6b')](_0xb0e1ec[_0x67bd('0x41')][_0x67bd('0x6c')]);}})[_0x67bd('0x31')](respondWithStatusCode(_0x38c767,null))[_0x67bd('0x5c')](handleError(_0x38c767,null));};exports[_0x67bd('0x6d')]=function(_0x42dff5,_0x3ea4e3,_0x3339dd){if(_0x42dff5['body']['id']){delete _0x42dff5[_0x67bd('0x5e')]['id'];}return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0x42dff5[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x3ea4e3,null))['then'](function(_0x2ecb94){if(_0x2ecb94){_0x42dff5[_0x67bd('0x5e')]['SmsAccountId']=_0x2ecb94['id'];return db['CannedAnswer']['create'](_0x42dff5[_0x67bd('0x5e')]);}})['then'](respondWithResult(_0x3ea4e3,null))[_0x67bd('0x5c')](handleError(_0x3ea4e3,null));};exports[_0x67bd('0x6e')]=function(_0x2bc970,_0x2cda51,_0x5e5712){var _0x4001ab={'raw':![],'where':{}};var _0x560f52={};var _0xdc839b={'count':0x0,'rows':[]};return db[_0x67bd('0x54')][_0x67bd('0x6f')]({'where':{'id':_0x2bc970['params']['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x2cda51,null))[_0x67bd('0x31')](function(_0x4b542a){if(_0x4b542a){_0x560f52['model']=_[_0x67bd('0x42')](db[_0x67bd('0x70')]['rawAttributes']);_0x560f52[_0x67bd('0x41')]=_['keys'](_0x2bc970[_0x67bd('0x41')]);_0x560f52['filters']=_[_0x67bd('0x44')](_0x560f52[_0x67bd('0x3f')],_0x560f52[_0x67bd('0x41')]);_0x4001ab[_0x67bd('0x45')]=_[_0x67bd('0x44')](_0x560f52['model'],qs[_0x67bd('0x46')](_0x2bc970[_0x67bd('0x41')]['fields']));_0x4001ab['attributes']=_0x4001ab['attributes']['length']?_0x4001ab[_0x67bd('0x45')]:_0x560f52['model'];if(!_0x2bc970[_0x67bd('0x41')][_0x67bd('0x48')](_0x67bd('0x49'))){_0x4001ab[_0x67bd('0x4a')]=qs[_0x67bd('0x4a')](_0x2bc970[_0x67bd('0x41')][_0x67bd('0x4a')]);_0x4001ab[_0x67bd('0x4b')]=qs['offset'](_0x2bc970[_0x67bd('0x41')]['offset']);}_0x4001ab[_0x67bd('0x4c')]=qs[_0x67bd('0x4d')](_0x2bc970['query'][_0x67bd('0x4d')]);_0x4001ab[_0x67bd('0x4e')]=qs[_0x67bd('0x43')](_['pick'](_0x2bc970['query'],_0x560f52[_0x67bd('0x43')]));_0x4001ab[_0x67bd('0x4e')][_0x67bd('0x69')]=_0x4b542a['id'];if(_0x2bc970[_0x67bd('0x41')][_0x67bd('0x50')]){_0x4001ab[_0x67bd('0x4e')]=_[_0x67bd('0x51')](_0x4001ab[_0x67bd('0x4e')],{'$or':_[_0x67bd('0x3a')](_0x4001ab[_0x67bd('0x45')],function(_0x5c9793){var _0x1adb70={};_0x1adb70[_0x5c9793]={'$like':'%'+_0x2bc970['query']['filter']+'%'};return _0x1adb70;})});}_0x4001ab=_[_0x67bd('0x51')]({},_0x4001ab,_0x2bc970[_0x67bd('0x53')]);return db[_0x67bd('0x70')][_0x67bd('0x2b')]({'where':_0x4001ab[_0x67bd('0x4e')]})['then'](function(_0x35bb9e){_0xdc839b[_0x67bd('0x2b')]=_0x35bb9e;if(_0x2bc970[_0x67bd('0x41')][_0x67bd('0x5a')]){_0x4001ab['include']=[{'all':!![]}];}return db[_0x67bd('0x70')][_0x67bd('0x6a')](_0x4001ab);})['then'](function(_0x573617){_0xdc839b[_0x67bd('0x56')]=_0x573617;return _0xdc839b;});}})[_0x67bd('0x31')](respondWithFilteredResult(_0x2cda51,_0x4001ab))[_0x67bd('0x5c')](handleError(_0x2cda51,null));};exports[_0x67bd('0x71')]=function(_0x286700,_0x3b90ea,_0x4a21f4){return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0x286700[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x3b90ea,null))[_0x67bd('0x31')](function(_0x353639){if(_0x353639){return _0x353639[_0x67bd('0x71')](_0x286700[_0x67bd('0x41')]['ids']);}})[_0x67bd('0x31')](respondWithStatusCode(_0x3b90ea,null))[_0x67bd('0x5c')](handleError(_0x3b90ea,null));};exports[_0x67bd('0x72')]=function(_0x9625e0,_0xde11e6,_0x5dce83){var _0x45070c={'channel':_0x67bd('0x73')};var _0x1c6d37=[];var _0x94e853=[];var _0x4f978f={};return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0x9625e0[_0x67bd('0x58')]['id']},'include':[{'model':db[_0x67bd('0x74')],'as':_0x67bd('0x75')}]})[_0x67bd('0x31')](handleEntityNotFound(_0xde11e6,null))['then'](function(_0x5bdf34){_0x45070c[_0x67bd('0x76')]=_0x5bdf34;_0x45070c[_0x67bd('0x77')]=_[_0x67bd('0x78')](_0x5bdf34[_0x67bd('0x75')],[_0x67bd('0x79')],[_0x67bd('0x7a')]);if(_0x45070c[_0x67bd('0x76')][_0x67bd('0x75')]){delete _0x45070c[_0x67bd('0x76')][_0x67bd('0x75')];}return db[_0x67bd('0x7b')][_0x67bd('0x65')]();})['then'](function(_0x4ee970){if(!_0x4ee970){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x1c6d37=_[_0x67bd('0x7c')](_['keys'](_0x4ee970),['createdAt',_0x67bd('0x7d')]);_0x94e853=_['difference'](_[_0x67bd('0x42')](_0x4ee970),[_0x67bd('0x7e'),_0x67bd('0x7d'),_0x67bd('0x7f'),_0x67bd('0x80')]);_0x45070c['body']={'mapKey':_0x67bd('0x81')};if(_0x45070c[_0x67bd('0x76')][_0x67bd('0x3d')]){switch(_0x45070c[_0x67bd('0x76')][_0x67bd('0x3d')]){case'twilio':_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x83')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x84')];_0x45070c['body'][_0x67bd('0x85')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x86')];break;case _0x67bd('0x87'):_0x45070c['body'][_0x67bd('0x82')]='+'+_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x88')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x89')];break;case _0x67bd('0x8a'):_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x82')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x27')];break;case'clicksend':_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x82')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')]['body'];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x85')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x8b')];break;case'plivo':_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')]['From'];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x8c')];_0x45070c['body'][_0x67bd('0x85')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x8d')];break;case'infobip':_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]='+'+_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x8e')][0x0][_0x67bd('0x82')];_0x45070c[_0x67bd('0x5e')]['body']=_0x9625e0['body'][_0x67bd('0x8e')][0x0][_0x67bd('0x89')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x85')]=_0x9625e0['body']['results'][0x0][_0x67bd('0x85')];break;case _0x67bd('0x8f'):_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0['body']['originatingAddress'];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x90')][_0x67bd('0x27')];break;case _0x67bd('0x91'):_0x45070c['body'][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x92')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x89')];_0x45070c['body'][_0x67bd('0x85')]=_0x9625e0['body']['replyMessageId'];break;case _0x67bd('0x93'):_0x45070c['body'][_0x67bd('0x85')]=_0x9625e0['body'][0x0]['message']['id'];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')][0x0]['message'][_0x67bd('0x82')];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][0x0][_0x67bd('0x27')]['text'];break;case _0x67bd('0x94'):_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')]=_0x9625e0[_0x67bd('0x5e')]['from'];_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x27')];_0x45070c['body'][_0x67bd('0x85')]=_0x9625e0[_0x67bd('0x5e')][_0x67bd('0x95')];break;}}if(_0x45070c[_0x67bd('0x5e')]['id']){delete _0x45070c[_0x67bd('0x5e')]['id'];}if(_[_0x67bd('0x96')](_0x45070c['body'][_0x67bd('0x82')])){throw new db[(_0x67bd('0x97'))]['ValidationError'](_0x67bd('0x98'));}if(_[_0x67bd('0x96')](_0x45070c[_0x67bd('0x5e')]['body'])||_0x45070c[_0x67bd('0x5e')][_0x67bd('0x5e')]===''){throw new db[(_0x67bd('0x97'))]['ValidationError'](_0x67bd('0x99'));}if(_['isNil'](_0x45070c[_0x67bd('0x5e')][_0x67bd('0x9a')])){throw new db[(_0x67bd('0x97'))][(_0x67bd('0x9b'))](_0x67bd('0x9c')+_0x94e853);}if(!_['includes'](_0x94e853,_0x45070c[_0x67bd('0x5e')][_0x67bd('0x9a')])){throw new db[(_0x67bd('0x97'))][(_0x67bd('0x9b'))](_0x67bd('0x9d')+_0x94e853);}_0x4f978f[_0x45070c[_0x67bd('0x5e')][_0x67bd('0x9a')]]=_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')];return db['CmList']['find']({'where':{'id':_0x45070c[_0x67bd('0x76')][_0x67bd('0x80')]},'include':[{'model':db[_0x67bd('0x7b')],'as':_0x67bd('0x9e'),'where':_0x4f978f,'limit':0x1,'order':[['updatedAt',_0x67bd('0x9f')]]}]});})[_0x67bd('0x31')](handleEntityNotFound(_0xde11e6,null))[_0x67bd('0x31')](function(_0x1bab62){if(_0x1bab62){_0x45070c[_0x67bd('0xa0')]=_[_0x67bd('0xa1')](_0x1bab62,[_0x67bd('0x9e')]);if(_0x1bab62[_0x67bd('0x9e')][_0x67bd('0x47')]){return _0x1bab62[_0x67bd('0x9e')][0x0];}var _0x2e5988=_[_0x67bd('0x19')](_0x45070c[_0x67bd('0x5e')],{'firstName':_0x45070c[_0x67bd('0x5e')][_0x67bd('0x82')],'ListId':_0x1bab62['id']});_0x2e5988[_0x45070c['body'][_0x67bd('0x9a')]]=_0x45070c[_0x67bd('0x5e')]['from'];return db['CmContact'][_0x67bd('0x5d')](_0x2e5988,{'fields':_0x1c6d37,'raw':!![]});}})[_0x67bd('0x31')](handleEntityNotFound(_0xde11e6,null))[_0x67bd('0x31')](function(_0x36e341){if(_0x36e341){_0x45070c[_0x67bd('0xa2')]=_0x36e341;var _0x229acf={'ContactId':_0x36e341['id'],'phone':_0x45070c['body'][_0x67bd('0x82')],'SmsAccountId':_0x9625e0['params']['id']};var _0x3a4eb8={'ContactId':_0x36e341['id'],'SmsAccountId':_0x9625e0['params']['id'],'closed':![]};return db['SmsInteraction'][_0x67bd('0x5b')]({'where':_0x3a4eb8})['then'](function(_0x4cb229){if(_0x4cb229){return[_0x4cb229,![]];}return db[_0x67bd('0xa3')][_0x67bd('0x5d')](_0x229acf)['then'](function(_0xf2501f){return[_0xf2501f,!![]];});});}})['spread'](function(_0x3be927,_0x930d32){_0x45070c['interaction']=_0x3be927['get']({'plain':!![]});_0x45070c[_0x67bd('0xa4')][_0x67bd('0xa5')]=![];if(_0x930d32){if(_0x45070c[_0x67bd('0x76')][_0x67bd('0xa6')]){_0x45070c[_0x67bd('0x77')][_0x67bd('0xa7')]({'id':0x0,'priority':_0x45070c['applications']['length']+0x1,'app':_0x67bd('0xa8'),'appdata':_0x67bd('0xa9'),'interval':_0x67bd('0xaa')});}_0x45070c[_0x67bd('0xa4')][_0x67bd('0xa5')]=!![];}return db['SmsMessage'][_0x67bd('0x5d')]({'phone':_0x45070c[_0x67bd('0x5e')]['from'],'messageId':_0x45070c[_0x67bd('0x5e')][_0x67bd('0x85')],'body':_0x45070c[_0x67bd('0x5e')]['body'],'SmsAccountId':_0x9625e0[_0x67bd('0x58')]['id'],'SmsInteractionId':_0x3be927['id'],'direction':'in','ContactId':_0x3be927[_0x67bd('0xab')],'AttachmentId':_0x45070c[_0x67bd('0x5e')][_0x67bd('0xac')]});})[_0x67bd('0x31')](function(_0x30e86c){_0x45070c[_0x67bd('0x27')]=_0x30e86c;if(_0x45070c['interaction'][_0x67bd('0xad')]){return db[_0x67bd('0xae')][_0x67bd('0x5b')]({'attributes':['id',_0x67bd('0x40')],'where':{'id':_0x45070c[_0x67bd('0xa4')][_0x67bd('0xad')]}})[_0x67bd('0x31')](function(_0x480c32){if(_0x480c32){_0x45070c[_0x67bd('0x77')][_0x67bd('0xaf')]({'id':0x0,'priority':0x0,'app':_0x67bd('0xb0'),'appdata':_0x480c32[_0x67bd('0x40')]+','+(_0x45070c[_0x67bd('0x76')]['waitForTheAssignedAgent']||0xa),'interval':_0x67bd('0xaa')});}return respondWithRpcPromise('Start',_0x67bd('0xb1'),_0x45070c);});}return respondWithRpcPromise('Start','startRouting',_0x45070c);})[_0x67bd('0x31')](function(_0x1d96aa){if(_0x1d96aa){var _0x29cb29=0xc8;var _0xf2c522='receiveMessage';logger[_0x67bd('0xb2')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf2c522,_0x29cb29,'entity\x20found');logger[_0x67bd('0x23')](_0x67bd('0xb3'),_0xf2c522,_0x29cb29,_0x67bd('0xb4'),JSON[_0x67bd('0x25')](_0x1d96aa));if(_0x45070c[_0x67bd('0x76')][_0x67bd('0x3d')]==='twilio'){return _0xde11e6[_0x67bd('0x2a')](_0x29cb29)[_0x67bd('0x2c')](_0x67bd('0xb5'),'text/xml')[_0x67bd('0x38')]('\x0a');}else{return _0xde11e6[_0x67bd('0x2a')](_0x29cb29)['json'](_0x1d96aa);}}})[_0x67bd('0x5c')](handleError(_0xde11e6,null));};exports[_0x67bd('0xb6')]=function(_0x4a6dd4,_0x3745d,_0x298a53){return db[_0x67bd('0x54')]['findOne']({'where':{'id':_0x4a6dd4[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x3745d,null))[_0x67bd('0x31')](function(_0x5a16a8){if(_0x5a16a8){return db[_0x67bd('0xb7')][_0x67bd('0xb8')](function(_0x4deeb4){return db[_0x67bd('0x74')]['destroy']({'where':{'SmsAccountId':_0x4a6dd4[_0x67bd('0x58')]['id']},'transaction':_0x4deeb4})['then'](function(_0x41a018){var _0x5a489c=_['map'](_0x4a6dd4[_0x67bd('0x5e')],function(_0x4ea9e5){_0x4ea9e5['SmsAccountId']=_0x4a6dd4[_0x67bd('0x58')]['id'];return _0x4ea9e5;});return db[_0x67bd('0x74')][_0x67bd('0xb9')](_0x5a489c,{'transaction':_0x4deeb4});});})[_0x67bd('0x31')](function(){return db[_0x67bd('0x74')][_0x67bd('0xba')]({'where':{'SmsAccountId':_0x4a6dd4[_0x67bd('0x58')]['id']},'order':_0x67bd('0x79')});});}})[_0x67bd('0x31')](respondWithResult(_0x3745d,null))[_0x67bd('0x5c')](handleError(_0x3745d,null));};exports[_0x67bd('0xbb')]=function(_0xea4009,_0x1ef1f2,_0x15bafc){var _0x19f96e={};var _0xdaffbb={};var _0x5a1a5b;var _0x558011;return db[_0x67bd('0x54')][_0x67bd('0x6f')]({'where':{'id':_0xea4009[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x1ef1f2,null))['then'](function(_0x4c856e){if(_0x4c856e){_0x5a1a5b=_0x4c856e;_0xdaffbb[_0x67bd('0x3f')]=_[_0x67bd('0x42')](db[_0x67bd('0x74')][_0x67bd('0x3b')]);_0xdaffbb[_0x67bd('0x41')]=_[_0x67bd('0x42')](_0xea4009[_0x67bd('0x41')]);_0xdaffbb['filters']=_[_0x67bd('0x44')](_0xdaffbb['model'],_0xdaffbb[_0x67bd('0x41')]);_0x19f96e[_0x67bd('0x45')]=_['intersection'](_0xdaffbb['model'],qs[_0x67bd('0x46')](_0xea4009['query'][_0x67bd('0x46')]));_0x19f96e[_0x67bd('0x45')]=_0x19f96e[_0x67bd('0x45')][_0x67bd('0x47')]?_0x19f96e[_0x67bd('0x45')]:_0xdaffbb[_0x67bd('0x3f')];_0x19f96e[_0x67bd('0x4c')]=qs[_0x67bd('0x4d')](_0xea4009['query']['sort']);_0x19f96e[_0x67bd('0x4e')]=qs['filters'](_[_0x67bd('0x4f')](_0xea4009['query'],_0xdaffbb[_0x67bd('0x43')]));if(_0xea4009[_0x67bd('0x41')][_0x67bd('0x50')]){_0x19f96e[_0x67bd('0x4e')]=_[_0x67bd('0x51')](_0x19f96e['where'],{'$or':_[_0x67bd('0x3a')](_0x19f96e[_0x67bd('0x45')],function(_0x4cda37){var _0x3e618c={};_0x3e618c[_0x4cda37]={'$like':'%'+_0xea4009[_0x67bd('0x41')][_0x67bd('0x50')]+'%'};return _0x3e618c;})});}_0x19f96e=_['merge']({},_0x19f96e,_0xea4009[_0x67bd('0x53')]);return _0x5a1a5b[_0x67bd('0xbb')](_0x19f96e);}})[_0x67bd('0x31')](function(_0x50438f){if(_0x50438f){_0x558011=_0x50438f[_0x67bd('0x47')];if(!_0xea4009[_0x67bd('0x41')][_0x67bd('0x48')]('nolimit')){_0x19f96e[_0x67bd('0x4a')]=qs[_0x67bd('0x4a')](_0xea4009[_0x67bd('0x41')]['limit']);_0x19f96e['offset']=qs[_0x67bd('0x4b')](_0xea4009[_0x67bd('0x41')][_0x67bd('0x4b')]);}return _0x5a1a5b['getApplications'](_0x19f96e);}})[_0x67bd('0x31')](function(_0x24b091){if(_0x24b091){return _0x24b091?{'count':_0x558011,'rows':_0x24b091}:null;}})[_0x67bd('0x31')](respondWithResult(_0x1ef1f2,null))[_0x67bd('0x5c')](handleError(_0x1ef1f2,null));};exports[_0x67bd('0xbc')]=function(_0x3b2b60,_0x1c3506,_0x169296){var _0x32a34f={'raw':![],'where':{}};var _0x546b16={};var _0x1cdf20={'count':0x0,'rows':[]};return db[_0x67bd('0x54')][_0x67bd('0x6f')]({'where':{'id':_0x3b2b60[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x1c3506,null))[_0x67bd('0x31')](function(_0x4b4c8a){if(_0x4b4c8a){_0x546b16[_0x67bd('0x3f')]=_[_0x67bd('0x42')](db[_0x67bd('0xa3')][_0x67bd('0x3b')]);_0x546b16[_0x67bd('0x41')]=_[_0x67bd('0x42')](_0x3b2b60['query']);_0x546b16[_0x67bd('0x43')]=_[_0x67bd('0x44')](_0x546b16[_0x67bd('0x3f')],_0x546b16[_0x67bd('0x41')]);_0x32a34f['attributes']=_[_0x67bd('0x44')](_0x546b16['model'],qs[_0x67bd('0x46')](_0x3b2b60['query'][_0x67bd('0x46')]));_0x32a34f[_0x67bd('0x45')]=_0x32a34f['attributes']['length']?_0x32a34f[_0x67bd('0x45')]:_0x546b16[_0x67bd('0x3f')];if(!_0x3b2b60['query'][_0x67bd('0x48')](_0x67bd('0x49'))){_0x32a34f['limit']=qs['limit'](_0x3b2b60['query'][_0x67bd('0x4a')]);_0x32a34f[_0x67bd('0x4b')]=qs[_0x67bd('0x4b')](_0x3b2b60[_0x67bd('0x41')][_0x67bd('0x4b')]);}_0x32a34f['order']=qs[_0x67bd('0x4d')](_0x3b2b60[_0x67bd('0x41')][_0x67bd('0x4d')]);_0x32a34f[_0x67bd('0x4e')]=qs[_0x67bd('0x43')](_['pick'](_0x3b2b60[_0x67bd('0x41')],_0x546b16['filters']));_0x32a34f['where'][_0x67bd('0x69')]=_0x4b4c8a['id'];if(_0x3b2b60['query'][_0x67bd('0x50')]){_0x32a34f['where']=_[_0x67bd('0x51')](_0x32a34f[_0x67bd('0x4e')],{'$or':_['map'](_0x32a34f['attributes'],function(_0x5dfdbf){var _0xd0404c={};_0xd0404c[_0x5dfdbf]={'$like':'%'+_0x3b2b60['query'][_0x67bd('0x50')]+'%'};return _0xd0404c;})});}_0x32a34f=_[_0x67bd('0x51')]({},_0x32a34f,_0x3b2b60['options']);return db[_0x67bd('0xa3')][_0x67bd('0x2b')]({'where':_0x32a34f[_0x67bd('0x4e')]})[_0x67bd('0x31')](function(_0x4e0678){_0x1cdf20['count']=_0x4e0678;if(_0x3b2b60[_0x67bd('0x41')][_0x67bd('0x5a')]){_0x32a34f[_0x67bd('0x55')]=[{'model':db[_0x67bd('0x7b')],'as':_0x67bd('0xbd'),'required':![]},{'model':db[_0x67bd('0xae')],'as':_0x67bd('0xbe'),'attributes':[_0x67bd('0x40'),'fullname',_0x67bd('0xbf')],'required':![]},{'model':db[_0x67bd('0xc0')],'as':_0x67bd('0xc1'),'attributes':['id',_0x67bd('0x40'),'color'],'where':_0x3b2b60[_0x67bd('0x41')][_0x67bd('0xc2')]?{'id':_0x3b2b60['query'][_0x67bd('0xc2')]}:undefined,'required':_0x3b2b60[_0x67bd('0x41')][_0x67bd('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x67bd('0x6a')](_0x32a34f);})[_0x67bd('0x31')](function(_0x2ebb17){_0x1cdf20[_0x67bd('0x56')]=_0x2ebb17;return _0x1cdf20;});}})[_0x67bd('0x31')](respondWithFilteredResult(_0x1c3506,_0x32a34f))[_0x67bd('0x5c')](handleError(_0x1c3506,null));};exports[_0x67bd('0x38')]=function(_0x145c9c,_0x1dbf4c,_0x2145cb){var _0x286a5b,_0x568499,_0x1facc9;if(_[_0x67bd('0x96')](_0x145c9c['body'][_0x67bd('0x5e')])||_0x145c9c[_0x67bd('0x5e')][_0x67bd('0x5e')]===''){throw new db[(_0x67bd('0x97'))][(_0x67bd('0x9b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x67bd('0x96')](_0x145c9c[_0x67bd('0x5e')]['to'])){throw new db[(_0x67bd('0x97'))]['ValidationError'](_0x67bd('0xc3'));}_0x286a5b=_0x145c9c[_0x67bd('0x5e')]['to'];return db['SmsAccount'][_0x67bd('0x5b')]({'where':{'id':_0x145c9c[_0x67bd('0x58')]['id']},'include':[{'model':db[_0x67bd('0xc4')],'as':_0x67bd('0xc5'),'include':[{'model':db['CmContact'],'as':_0x67bd('0x9e'),'where':{'mobile':_0x286a5b},'limit':0x1,'order':[[_0x67bd('0x7d'),'DESC']]}]}]})[_0x67bd('0x31')](handleEntityNotFound(_0x1dbf4c,null))[_0x67bd('0x31')](function(_0x3e68d9){if(_0x3e68d9&&_0x3e68d9['List']){_0x568499=_0x3e68d9[_0x67bd('0x33')]({'plain':!![]});if(_0x568499[_0x67bd('0xc5')]&&_0x568499[_0x67bd('0xc5')][_0x67bd('0x9e')][_0x67bd('0x47')]){return _0x568499[_0x67bd('0xc5')][_0x67bd('0x9e')][0x0];}return db[_0x67bd('0x7b')][_0x67bd('0x5d')](_[_0x67bd('0x19')](_0x145c9c[_0x67bd('0x5e')],{'firstName':_0x286a5b,'mobile':_0x286a5b,'phone':_0x286a5b,'ListId':_0x568499[_0x67bd('0x80')]}));}})[_0x67bd('0x31')](handleEntityNotFound(_0x1dbf4c,null))['then'](function(_0x4f5680){if(_0x4f5680){_0x1facc9=_0x4f5680;return db['SmsInteraction'][_0x67bd('0x5b')]({'where':{'ContactId':_0x1facc9['id'],'closed':![],'SmsAccountId':_0x568499['id']}})['then'](function(_0x10c37b){if(_0x10c37b){return[_0x10c37b,![]];}return db[_0x67bd('0xa3')][_0x67bd('0x5d')]({'UserId':_0x145c9c['user']['id'],'ContactId':_0x1facc9['id'],'SmsAccountId':_0x568499['id'],'phone':_0x286a5b,'firstMsgDirection':_0x67bd('0xc6'),'Messages':[_[_0x67bd('0x51')](_0x145c9c[_0x67bd('0x5e')],{'read':![],'body':_0x145c9c[_0x67bd('0x5e')][_0x67bd('0x5e')],'phone':_0x286a5b,'SmsAccountId':_0x568499['id'],'UserId':_0x145c9c[_0x67bd('0x5f')]['id'],'ContactId':_0x1facc9['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x67bd('0xc7')}]})[_0x67bd('0x31')](function(_0x2f151e){return[_0x2f151e,!![]];});});}})['spread'](function(_0x2212d9,_0x59bfc5){if(_0x59bfc5){return _0x2212d9;}return db['SmsMessage'][_0x67bd('0x5d')](_[_0x67bd('0x51')](_0x145c9c[_0x67bd('0x5e')],{'read':![],'body':_0x145c9c[_0x67bd('0x5e')]['body'],'phone':_0x286a5b,'SmsAccountId':_0x568499['id'],'SmsInteractionId':_0x2212d9['id'],'UserId':_0x145c9c[_0x67bd('0x5f')]['id'],'ContactId':_0x1facc9['id']}))['then'](function(_0xe1fa77){_0x2212d9['dataValues'][_0x67bd('0xc7')]=[];_0x2212d9[_0x67bd('0xc8')]['Messages']['push'](_0xe1fa77[_0x67bd('0xc8')]);return _0x2212d9;});})['then'](respondWithResult(_0x1dbf4c,null))['catch'](handleError(_0x1dbf4c,null));};exports[_0x67bd('0x2a')]=function(_0x3facac,_0x39778c,_0x57e89b){if(_0x3facac[_0x67bd('0x5e')]['id']){delete _0x3facac[_0x67bd('0x5e')]['id'];}var _0x5580f9,_0xfbf10b,_0x281a31;return db['SmsAccount'][_0x67bd('0x5b')]({'where':{'id':_0x3facac[_0x67bd('0x58')]['id']}})['then'](handleEntityNotFound(_0x39778c,null))['then'](function(_0x5b32a0){if(_0x5b32a0){_0x281a31=_0x5b32a0;logger[_0x67bd('0x23')](_0x67bd('0x24'),_0x67bd('0x2a'),_0x67bd('0xc9'),_0x5b32a0[_0x67bd('0x3d')],util['inspect'](_0x3facac[_0x67bd('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5b32a0[_0x67bd('0x3d')]){case _0x67bd('0x87'):if(_0x3facac[_0x67bd('0x5e')][_0x67bd('0xca')]&&_0x3facac[_0x67bd('0x5e')][_0x67bd('0x2a')]){_0xfbf10b=_0x3facac['body'][_0x67bd('0x2a')];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x3facac[_0x67bd('0x5e')]['skebby_dispatch_id']}});}break;case _0x67bd('0x8a'):if(_0x3facac['body']['requestid']&&_0x3facac['body'][_0x67bd('0xcc')]){_0xfbf10b=_0x3facac[_0x67bd('0x5e')][_0x67bd('0xcc')];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x3facac[_0x67bd('0x5e')]['requestid']}});}break;case _0x67bd('0xcd'):if(_0x3facac['body'][_0x67bd('0x8b')]&&_0x3facac[_0x67bd('0x5e')][_0x67bd('0xce')]){_0xfbf10b=_0x3facac[_0x67bd('0x5e')]['status_code'];return db['SmsMessage'][_0x67bd('0x5b')]({'where':{'messageId':_0x3facac[_0x67bd('0x5e')][_0x67bd('0x8b')]}});}break;case'infobip':var _0x68ecfe=_0x3facac[_0x67bd('0x5e')][_0x67bd('0x8e')][0x0];if(_0x68ecfe[_0x67bd('0x85')]&&_0x68ecfe[_0x67bd('0x2a')][_0x67bd('0xcf')]===_0x67bd('0xd0')){_0xfbf10b=_0x68ecfe[_0x67bd('0x2a')][_0x67bd('0xcf')];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x68ecfe['messageId']}});}break;case _0x67bd('0x91'):if(_0x3facac['body'][_0x67bd('0x85')]&&_0x3facac[_0x67bd('0x5e')][_0x67bd('0x2a')]){_0xfbf10b=_0x3facac[_0x67bd('0x5e')]['status'];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x3facac[_0x67bd('0x5e')]['messageId']}});}break;case _0x67bd('0x93'):if(_0x3facac[_0x67bd('0x5e')][0x0][_0x67bd('0x27')]['id']){_0xfbf10b=_0x3facac[_0x67bd('0x5e')][0x0][_0x67bd('0x3d')];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x3facac[_0x67bd('0x5e')][0x0][_0x67bd('0x27')]['id']}});}break;case _0x67bd('0x94'):if(_0x3facac[_0x67bd('0x5e')][_0x67bd('0xd1')]&&_0x3facac['body']['status']){_0xfbf10b=_0x3facac[_0x67bd('0x5e')][_0x67bd('0x2a')];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x3facac[_0x67bd('0x5e')][_0x67bd('0xd1')]}});}break;}}})[_0x67bd('0x31')](handleEntityNotFound(_0x39778c,null))[_0x67bd('0x31')](function(_0x3cf05b){if(_0x3cf05b){_0x5580f9=_0x3cf05b;switch(_0x281a31['type']){case'skebby':if(_0xfbf10b==='DELIVERED'){return _0x5580f9[_0x67bd('0x64')]({'read':!![]});}else{logger[_0x67bd('0x26')](_0x67bd('0x24'),_0x67bd('0x2a'),'skebby',util[_0x67bd('0xd2')](_0x3facac['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0xfbf10b==='1'){return _0x5580f9[_0x67bd('0x64')]({'read':!![]});}else{logger['error'](_0x67bd('0x24'),'status',_0x67bd('0x87'),util[_0x67bd('0xd2')](_0x3facac[_0x67bd('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3facac['body'][_0x67bd('0xd3')]&&_0xfbf10b>=0xc8&&_0xfbf10b<=0xce){return _0x5580f9[_0x67bd('0x64')]({'read':!![]});}else{logger[_0x67bd('0x26')](_0x67bd('0x24'),_0x67bd('0x2a'),_0x67bd('0xcd'),util[_0x67bd('0xd2')](_0x3facac['body'],{'showHidden':![],'depth':null}));}break;case _0x67bd('0xd4'):var _0x36cc50=_0x3facac[_0x67bd('0x5e')][_0x67bd('0x8e')][0x0];if(_0x36cc50[_0x67bd('0x2a')][_0x67bd('0xcf')]===_0x67bd('0xd0')){return _0x5580f9['update']({'read':!![]});}else{logger[_0x67bd('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x67bd('0x2a'),'infobip',util[_0x67bd('0xd2')](_0x3facac['body'],{'showHidden':![],'depth':null}));}break;case _0x67bd('0x91'):if(_0xfbf10b==_0x67bd('0xd5')||_0xfbf10b==_0x67bd('0xd6')){return _0x5580f9[_0x67bd('0x64')]({'read':!![]});}else{logger[_0x67bd('0x26')](_0x67bd('0x24'),_0x67bd('0x2a'),'clickatell',util[_0x67bd('0xd2')](_0x3facac[_0x67bd('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x67bd('0x93'):if(_0xfbf10b==_0x67bd('0xd7')){return _0x5580f9[_0x67bd('0x64')]({'read':!![]});}else{logger[_0x67bd('0x26')](_0x67bd('0x24'),_0x67bd('0x2a'),_0x67bd('0x93'),util['inspect'](_0x3facac[_0x67bd('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x67bd('0x94'):if(_0xfbf10b===_0x67bd('0xd8')||_0xfbf10b===_0x67bd('0xd9')){return _0x5580f9[_0x67bd('0x64')]({'read':!![]});}else{logger['error'](_0x67bd('0x24'),'status',_0x67bd('0x94'),util[_0x67bd('0xd2')](_0x3facac[_0x67bd('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x5580f9;}})[_0x67bd('0x31')](respondWithResult(_0x39778c,null))[_0x67bd('0x5c')](handleError(_0x39778c,null));};exports['statusGet']=function(_0x3fbcc3,_0x432cc9,_0x412bdf){var _0x52d337,_0x3702ff,_0x40996f;return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0x3fbcc3[_0x67bd('0x58')]['id']}})['then'](handleEntityNotFound(_0x432cc9,null))[_0x67bd('0x31')](function(_0xa1b037){if(_0xa1b037){_0x40996f=_0xa1b037;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x67bd('0x2a'),'received\x20delivery\x20report\x20from',_0xa1b037[_0x67bd('0x3d')],util[_0x67bd('0xd2')](_0x3fbcc3[_0x67bd('0x41')],{'showHidden':![],'depth':null}));switch(_0xa1b037[_0x67bd('0x3d')]){case _0x67bd('0x8f'):if(_0x3fbcc3[_0x67bd('0x41')][_0x67bd('0xda')]&&_0x3fbcc3['query']['state']){_0x3702ff=_0x3fbcc3[_0x67bd('0x41')]['state'];return db[_0x67bd('0xcb')][_0x67bd('0x5b')]({'where':{'messageId':_0x3fbcc3[_0x67bd('0x41')][_0x67bd('0xda')]}});}break;}}})[_0x67bd('0x31')](handleEntityNotFound(_0x432cc9,null))[_0x67bd('0x31')](function(_0x385dc3){if(_0x385dc3){_0x52d337=_0x385dc3;switch(_0x40996f[_0x67bd('0x3d')]){case _0x67bd('0x8f'):if(_0x3702ff==='2'||_0x3702ff==='6'){return _0x52d337[_0x67bd('0x64')]({'read':!![]});}else{logger[_0x67bd('0x26')](_0x67bd('0x24'),_0x67bd('0x2a'),_0x67bd('0x8f'),util[_0x67bd('0xd2')](_0x3fbcc3[_0x67bd('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x52d337;}})[_0x67bd('0x31')](respondWithResult(_0x432cc9,null))[_0x67bd('0x5c')](handleError(_0x432cc9,null));};exports[_0x67bd('0xdb')]=function(_0x49c575,_0x1b1e3a,_0x439eb8){return db[_0x67bd('0x54')][_0x67bd('0x5b')]({'where':{'id':_0x49c575[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x1b1e3a,null))[_0x67bd('0x31')](function(_0x4b1817){if(_0x4b1817){return _0x4b1817[_0x67bd('0xdb')](_0x49c575['body'][_0x67bd('0x6c')],_['omit'](_0x49c575[_0x67bd('0x5e')],[_0x67bd('0x6c'),'id'])||{})[_0x67bd('0xdc')](function(_0x5b5056){for(var _0x1e47ec=0x0;_0x1e47ec<_0x49c575['body']['ids'][_0x67bd('0x47')];_0x1e47ec+=0x1){socket[_0x67bd('0xdd')](_0x67bd('0xde'),{'UserId':_0x49c575[_0x67bd('0x5e')][_0x67bd('0x6c')][_0x1e47ec],'SmsAccountId':_0x49c575['params']['id']});}return _0x5b5056;});}})[_0x67bd('0x31')](respondWithResult(_0x1b1e3a,null))[_0x67bd('0x5c')](handleError(_0x1b1e3a,null));};exports[_0x67bd('0xdf')]=function(_0x5792b2,_0x2ca409,_0x5d3e6e){return db['SmsAccount'][_0x67bd('0x5b')]({'where':{'id':_0x5792b2[_0x67bd('0x58')]['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x2ca409,null))[_0x67bd('0x31')](function(_0x174184){if(_0x174184){return _0x174184[_0x67bd('0xdf')](_0x5792b2[_0x67bd('0x41')][_0x67bd('0x6c')])[_0x67bd('0x31')](function(){if(_[_0x67bd('0xe0')](_0x5792b2[_0x67bd('0x41')][_0x67bd('0x6c')])){for(var _0x322c2b=0x0;_0x322c2b<_0x5792b2[_0x67bd('0x41')][_0x67bd('0x6c')][_0x67bd('0x47')];_0x322c2b+=0x1){socket[_0x67bd('0xdd')](_0x67bd('0xe1'),{'UserId':Number(_0x5792b2[_0x67bd('0x41')][_0x67bd('0x6c')][_0x322c2b]),'SmsAccountId':Number(_0x5792b2[_0x67bd('0x58')]['id'])});}}else{socket[_0x67bd('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x5792b2[_0x67bd('0x41')][_0x67bd('0x6c')]),'SmsAccountId':Number(_0x5792b2['params']['id'])});}});}})[_0x67bd('0x31')](respondWithStatusCode(_0x2ca409,null))[_0x67bd('0x5c')](handleError(_0x2ca409,null));};exports['getAgents']=function(_0x3549a2,_0x57c981,_0x3f4855){var _0x231117={};var _0x2faa2b={};var _0x132c73;var _0x548de4;return db[_0x67bd('0x54')]['findOne']({'where':{'id':_0x3549a2['params']['id']}})[_0x67bd('0x31')](handleEntityNotFound(_0x57c981,null))['then'](function(_0x4f836d){if(_0x4f836d){_0x132c73=_0x4f836d;_0x2faa2b[_0x67bd('0x3f')]=_[_0x67bd('0x42')](db[_0x67bd('0xae')][_0x67bd('0x3b')]);_0x2faa2b[_0x67bd('0x41')]=_[_0x67bd('0x42')](_0x3549a2[_0x67bd('0x41')]);_0x2faa2b[_0x67bd('0x43')]=_[_0x67bd('0x44')](_0x2faa2b[_0x67bd('0x3f')],_0x2faa2b[_0x67bd('0x41')]);_0x231117[_0x67bd('0x45')]=_[_0x67bd('0x44')](_0x2faa2b[_0x67bd('0x3f')],qs[_0x67bd('0x46')](_0x3549a2[_0x67bd('0x41')][_0x67bd('0x46')]));_0x231117[_0x67bd('0x45')]=_0x231117[_0x67bd('0x45')][_0x67bd('0x47')]?_0x231117['attributes']:_0x2faa2b[_0x67bd('0x3f')];_0x231117[_0x67bd('0x4c')]=qs[_0x67bd('0x4d')](_0x3549a2['query'][_0x67bd('0x4d')]);_0x231117[_0x67bd('0x4e')]=qs[_0x67bd('0x43')](_[_0x67bd('0x4f')](_0x3549a2['query'],_0x2faa2b[_0x67bd('0x43')]));if(_0x3549a2[_0x67bd('0x41')][_0x67bd('0x50')]){_0x231117['where']=_[_0x67bd('0x51')](_0x231117['where'],{'$or':_[_0x67bd('0x3a')](_0x231117[_0x67bd('0x45')],function(_0xc59bd8){var _0x21bda2={};_0x21bda2[_0xc59bd8]={'$like':'%'+_0x3549a2[_0x67bd('0x41')][_0x67bd('0x50')]+'%'};return _0x21bda2;})});}_0x231117=_[_0x67bd('0x51')]({},_0x231117,_0x3549a2['options']);return _0x132c73[_0x67bd('0xe2')](_0x231117);}})['then'](function(_0x228051){if(_0x228051){_0x548de4=_0x228051[_0x67bd('0x47')];if(!_0x3549a2[_0x67bd('0x41')][_0x67bd('0x48')]('nolimit')){_0x231117[_0x67bd('0x4a')]=qs[_0x67bd('0x4a')](_0x3549a2[_0x67bd('0x41')][_0x67bd('0x4a')]);_0x231117['offset']=qs[_0x67bd('0x4b')](_0x3549a2[_0x67bd('0x41')][_0x67bd('0x4b')]);}return _0x132c73['getAgents'](_0x231117);}})[_0x67bd('0x31')](function(_0x117066){if(_0x117066){return _0x117066?{'count':_0x548de4,'rows':_0x117066}:null;}})['then'](respondWithResult(_0x57c981,null))[_0x67bd('0x5c')](handleError(_0x57c981,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a30af58..43c5822 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 _0x1301=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save'];(function(_0x4678c9,_0x525ab6){var _0x5cbe95=function(_0x31a09b){while(--_0x31a09b){_0x4678c9['push'](_0x4678c9['shift']());}};_0x5cbe95(++_0x525ab6);}(_0x1301,0xb0));var _0x1130=function(_0x330a59,_0x295300){_0x330a59=_0x330a59-0x0;var _0x29ccb0=_0x1301[_0x330a59];return _0x29ccb0;};'use strict';var EventEmitter=require(_0x1130('0x0'));var SmsAccount=require(_0x1130('0x1'))['db'][_0x1130('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1130('0x3'),'afterUpdate':'update','afterDestroy':_0x1130('0x4')};function emitEvent(_0x75f034){return function(_0x4710a9,_0x31f240,_0xf85968){SmsAccountEvents[_0x1130('0x5')](_0x75f034+':'+_0x4710a9['id'],_0x4710a9);SmsAccountEvents[_0x1130('0x5')](_0x75f034,_0x4710a9);_0xf85968(null);};}for(var e in events){if(events[_0x1130('0x6')](e)){var event=events[e];SmsAccount[_0x1130('0x7')](e,emitEvent(event));}}module[_0x1130('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xe990=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0xe990,0x8d));var _0x0e99=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe990[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require(_0x0e99('0x0'));var SmsAccount=require(_0x0e99('0x1'))['db'][_0x0e99('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0e99('0x3')](0x0);var events={'afterCreate':_0x0e99('0x4'),'afterUpdate':'update','afterDestroy':_0x0e99('0x5')};function emitEvent(_0x33c95f){return function(_0x29db93,_0x344688,_0x1a9b70){SmsAccountEvents[_0x0e99('0x6')](_0x33c95f+':'+_0x29db93['id'],_0x29db93);SmsAccountEvents[_0x0e99('0x6')](_0x33c95f,_0x29db93);_0x1a9b70(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x0e99('0x7')](e,emitEvent(event));}}module[_0x0e99('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index aa1420e..30fad48 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 _0xf3bd=['exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0xf3bd,0x156));var _0xdf3b=function(_0xdd6a7f,_0x2b37ad){_0xdd6a7f=_0xdd6a7f-0x0;var _0x1b6cca=_0xf3bd[_0xdd6a7f];return _0x1b6cca;};'use strict';var _=require(_0xdf3b('0x0'));var util=require(_0xdf3b('0x1'));var logger=require(_0xdf3b('0x2'))('api');var moment=require(_0xdf3b('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf3b('0x4'));var fs=require('fs');var path=require(_0xdf3b('0x5'));var rimraf=require(_0xdf3b('0x6'));var config=require(_0xdf3b('0x7'));var attributes=require(_0xdf3b('0x8'));module[_0xdf3b('0x9')]=function(_0x2783df,_0x555fd8){return _0x2783df[_0xdf3b('0xa')](_0xdf3b('0xb'),attributes,{'tableName':_0xdf3b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21ae=['../../config/logger','request-promise','path','rimraf','exports','define','SmsAccount','sms_accounts','util'];(function(_0x1f711f,_0x3fa652){var _0x31be40=function(_0x1d22ad){while(--_0x1d22ad){_0x1f711f['push'](_0x1f711f['shift']());}};_0x31be40(++_0x3fa652);}(_0x21ae,0x98));var _0xe21a=function(_0x3d79fc,_0x28b55a){_0x3d79fc=_0x3d79fc-0x0;var _0x554ea3=_0x21ae[_0x3d79fc];return _0x554ea3;};'use strict';var _=require('lodash');var util=require(_0xe21a('0x0'));var logger=require(_0xe21a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe21a('0x2'));var fs=require('fs');var path=require(_0xe21a('0x3'));var rimraf=require(_0xe21a('0x4'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xe21a('0x5')]=function(_0x4d8c0e,_0x3a5008){return _0x4d8c0e[_0xe21a('0x6')](_0xe21a('0x7'),attributes,{'tableName':_0xe21a('0x8'),'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 b6ecf5f..5eea063 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 _0x5194=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','ShowSmsAccount','SmsAccount','find','raw','options','include','map','model','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x363daa,_0x2efc0c){var _0x51e5ed=function(_0x5700a9){while(--_0x5700a9){_0x363daa['push'](_0x363daa['shift']());}};_0x51e5ed(++_0x2efc0c);}(_0x5194,0x16c));var _0x4519=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5194[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x4519('0x0'));var util=require('util');var moment=require(_0x4519('0x1'));var BPromise=require(_0x4519('0x2'));var rs=require(_0x4519('0x3'));var fs=require('fs');var Redis=require(_0x4519('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4519('0x5'));var logger=require(_0x4519('0x6'))(_0x4519('0x7'));var config=require(_0x4519('0x8'));var jayson=require(_0x4519('0x9'));var client=jayson[_0x4519('0xa')][_0x4519('0xb')]({'port':0x232a});config[_0x4519('0xc')]=_[_0x4519('0xd')](config[_0x4519('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4519('0xe'))(new Redis(config[_0x4519('0xc')]));require(_0x4519('0xf'))['register'](socket);function respondWithRpcPromise(_0x3acb2d,_0x1b5c3b,_0x4aab83){return new BPromise(function(_0x521328,_0x1a4c80){return client['request'](_0x3acb2d,_0x4aab83)[_0x4519('0x10')](function(_0x56b11d){logger[_0x4519('0x11')](_0x4519('0x12'),_0x1b5c3b,_0x4519('0x13'));logger[_0x4519('0x14')](_0x4519('0x15'),_0x1b5c3b,_0x4519('0x13'),JSON[_0x4519('0x16')](_0x56b11d));if(_0x56b11d['error']){if(_0x56b11d['error'][_0x4519('0x17')]===0x1f4){logger[_0x4519('0x18')](_0x4519('0x12'),_0x1b5c3b,_0x56b11d['error'][_0x4519('0x19')]);return _0x1a4c80(_0x56b11d[_0x4519('0x18')][_0x4519('0x19')]);}logger[_0x4519('0x18')](_0x4519('0x12'),_0x1b5c3b,_0x56b11d[_0x4519('0x18')][_0x4519('0x19')]);return _0x521328(_0x56b11d[_0x4519('0x18')][_0x4519('0x19')]);}else{logger['info'](_0x4519('0x12'),_0x1b5c3b,_0x4519('0x13'));_0x521328(_0x56b11d[_0x4519('0x1a')][_0x4519('0x19')]);}})['catch'](function(_0x321c9e){logger['error'](_0x4519('0x12'),_0x1b5c3b,_0x321c9e);_0x1a4c80(_0x321c9e);});});}exports[_0x4519('0x1b')]=function(_0x2e3d1a){var _0x3a6b2e=this;return new Promise(function(_0x3f1008,_0x486ed2){return db[_0x4519('0x1c')][_0x4519('0x1d')]({'raw':_0x2e3d1a['options']?_0x2e3d1a['options'][_0x4519('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e3d1a['options']?_0x2e3d1a[_0x4519('0x1f')]['where']||null:null,'attributes':_0x2e3d1a['options']?_0x2e3d1a[_0x4519('0x1f')]['attributes']||null:null,'include':_0x2e3d1a[_0x4519('0x1f')]?_0x2e3d1a[_0x4519('0x1f')][_0x4519('0x20')]?_[_0x4519('0x21')](_0x2e3d1a['options'][_0x4519('0x20')],function(_0x441383){return{'model':db[_0x441383[_0x4519('0x22')]],'as':_0x441383['as'],'attributes':_0x441383[_0x4519('0x23')],'include':_0x441383[_0x4519('0x20')]?_['map'](_0x441383[_0x4519('0x20')],function(_0x12b17a){return{'model':db[_0x12b17a[_0x4519('0x22')]],'as':_0x12b17a['as'],'attributes':_0x12b17a[_0x4519('0x23')],'include':_0x12b17a[_0x4519('0x20')]?_[_0x4519('0x21')](_0x12b17a[_0x4519('0x20')],function(_0x16b659){return{'model':db[_0x16b659[_0x4519('0x22')]],'as':_0x16b659['as'],'attributes':_0x16b659['attributes']};}):[]};}):[]};}):[]:[]})[_0x4519('0x10')](function(_0x555d07){logger[_0x4519('0x11')](_0x4519('0x1b'),_0x2e3d1a);logger[_0x4519('0x14')](_0x4519('0x1b'),_0x2e3d1a,JSON['stringify'](_0x555d07));_0x3f1008(_0x555d07);})[_0x4519('0x24')](function(_0x4bb16d){logger[_0x4519('0x18')](_0x4519('0x1b'),_0x4bb16d[_0x4519('0x19')],_0x2e3d1a);_0x486ed2(_0x3a6b2e[_0x4519('0x18')](0x1f4,_0x4bb16d[_0x4519('0x19')]));});});}; \ No newline at end of file +var _0x0118=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0118,0x1a4));var _0x8011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0118[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8011('0x0'));var util=require(_0x8011('0x1'));var moment=require(_0x8011('0x2'));var BPromise=require(_0x8011('0x3'));var rs=require(_0x8011('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8011('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8011('0x6'))(_0x8011('0x7'));var config=require(_0x8011('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8011('0x9')][_0x8011('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8011('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8011('0xc'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x8011('0xd')](socket);function respondWithRpcPromise(_0x5f1578,_0x56d0ae,_0x5323ea){return new BPromise(function(_0x209a24,_0x14fbc8){return client[_0x8011('0xe')](_0x5f1578,_0x5323ea)['then'](function(_0x1d7f78){logger[_0x8011('0xf')](_0x8011('0x10'),_0x56d0ae,_0x8011('0x11'));logger[_0x8011('0x12')](_0x8011('0x13'),_0x56d0ae,'request\x20sent',JSON[_0x8011('0x14')](_0x1d7f78));if(_0x1d7f78[_0x8011('0x15')]){if(_0x1d7f78[_0x8011('0x15')][_0x8011('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x56d0ae,_0x1d7f78[_0x8011('0x15')]['message']);return _0x14fbc8(_0x1d7f78[_0x8011('0x15')][_0x8011('0x17')]);}logger[_0x8011('0x15')]('SmsAccount,\x20%s,\x20%s',_0x56d0ae,_0x1d7f78['error'][_0x8011('0x17')]);return _0x209a24(_0x1d7f78[_0x8011('0x15')][_0x8011('0x17')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x56d0ae,_0x8011('0x11'));_0x209a24(_0x1d7f78[_0x8011('0x18')]['message']);}})[_0x8011('0x19')](function(_0x17e975){logger[_0x8011('0x15')](_0x8011('0x10'),_0x56d0ae,_0x17e975);_0x14fbc8(_0x17e975);});});}exports[_0x8011('0x1a')]=function(_0xc6014){var _0x282b9d=this;return new Promise(function(_0x998c3d,_0x5b9ddb){return db[_0x8011('0x1b')]['find']({'raw':_0xc6014[_0x8011('0x1c')]?_0xc6014[_0x8011('0x1c')][_0x8011('0x1d')]===undefined?!![]:![]:!![],'where':_0xc6014[_0x8011('0x1c')]?_0xc6014['options'][_0x8011('0x1e')]||null:null,'attributes':_0xc6014[_0x8011('0x1c')]?_0xc6014[_0x8011('0x1c')][_0x8011('0x1f')]||null:null,'include':_0xc6014[_0x8011('0x1c')]?_0xc6014[_0x8011('0x1c')][_0x8011('0x20')]?_[_0x8011('0x21')](_0xc6014[_0x8011('0x1c')]['include'],function(_0x57dd48){return{'model':db[_0x57dd48[_0x8011('0x22')]],'as':_0x57dd48['as'],'attributes':_0x57dd48['attributes'],'include':_0x57dd48[_0x8011('0x20')]?_[_0x8011('0x21')](_0x57dd48['include'],function(_0x18240a){return{'model':db[_0x18240a['model']],'as':_0x18240a['as'],'attributes':_0x18240a[_0x8011('0x1f')],'include':_0x18240a[_0x8011('0x20')]?_[_0x8011('0x21')](_0x18240a[_0x8011('0x20')],function(_0x208ed4){return{'model':db[_0x208ed4[_0x8011('0x22')]],'as':_0x208ed4['as'],'attributes':_0x208ed4[_0x8011('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc059d8){logger[_0x8011('0xf')]('ShowSmsAccount',_0xc6014);logger[_0x8011('0x12')]('ShowSmsAccount',_0xc6014,JSON['stringify'](_0xc059d8));_0x998c3d(_0xc059d8);})[_0x8011('0x19')](function(_0x24766d){logger[_0x8011('0x15')](_0x8011('0x1a'),_0x24766d['message'],_0xc6014);_0x5b9ddb(_0x282b9d['error'](0x1f4,_0x24766d[_0x8011('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 45591ad..ee52b39 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 _0xe491=['save','remove','emit','register','length','smsAccount:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe491,0x18c));var _0x1e49=function(_0x24602f,_0x1afeab){_0x24602f=_0x24602f-0x0;var _0x98db03=_0xe491[_0x24602f];return _0x98db03;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x1e49('0x0'),_0x1e49('0x1'),'update'];function createListener(_0x2560fa,_0x42ace1){return function(_0x3a961e){_0x42ace1[_0x1e49('0x2')](_0x2560fa,_0x3a961e);};}function removeListener(_0x553219,_0x4fd484){return function(){SmsAccountEvents['removeListener'](_0x553219,_0x4fd484);};}exports[_0x1e49('0x3')]=function(_0x4d8825){for(var _0x956d4a=0x0,_0x2ec7e3=events[_0x1e49('0x4')];_0x956d4a<_0x2ec7e3;_0x956d4a++){var _0xcae7c9=events[_0x956d4a];var _0x195961=createListener(_0x1e49('0x5')+_0xcae7c9,_0x4d8825);SmsAccountEvents['on'](_0xcae7c9,_0x195961);}}; \ No newline at end of file +var _0xf608=['save','remove','update','removeListener','register','smsAccount:'];(function(_0x4bce8b,_0x5dae42){var _0x688138=function(_0xa84341){while(--_0xa84341){_0x4bce8b['push'](_0x4bce8b['shift']());}};_0x688138(++_0x5dae42);}(_0xf608,0x1a4));var _0x8f60=function(_0x7c2035,_0x13334){_0x7c2035=_0x7c2035-0x0;var _0x50f5c1=_0xf608[_0x7c2035];return _0x50f5c1;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x8f60('0x0'),_0x8f60('0x1'),_0x8f60('0x2')];function createListener(_0x1d5320,_0x2c1afb){return function(_0x58befe){_0x2c1afb['emit'](_0x1d5320,_0x58befe);};}function removeListener(_0x54e5a7,_0x47ac9d){return function(){SmsAccountEvents[_0x8f60('0x3')](_0x54e5a7,_0x47ac9d);};}exports[_0x8f60('0x4')]=function(_0x3f50f9){for(var _0x5513a6=0x0,_0x5a0a29=events['length'];_0x5513a6<_0x5a0a29;_0x5513a6++){var _0x1624c5=events[_0x5513a6];var _0x19034c=createListener(_0x8f60('0x5')+_0x1624c5,_0x3f50f9);SmsAccountEvents['on'](_0x1624c5,_0x19034c);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 89e671e..f534c88 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 _0x2df0=['../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x2df0,0xa5));var _0x02df=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x2df0[_0x209fcd];return _0x501d5e;};'use strict';var multer=require('multer');var util=require(_0x02df('0x0'));var path=require(_0x02df('0x1'));var timeout=require(_0x02df('0x2'));var express=require(_0x02df('0x3'));var router=express[_0x02df('0x4')]();var auth=require(_0x02df('0x5'));var interaction=require(_0x02df('0x6'));var config=require(_0x02df('0x7'));var controller=require(_0x02df('0x8'));router[_0x02df('0x9')]('/',auth[_0x02df('0xa')](),controller[_0x02df('0xb')]);router[_0x02df('0x9')](_0x02df('0xc'),auth[_0x02df('0xa')](),controller['show']);router[_0x02df('0xd')]('/',auth[_0x02df('0xa')](),controller[_0x02df('0xe')]);router['put'](_0x02df('0xc'),auth[_0x02df('0xa')](),controller[_0x02df('0xf')]);router[_0x02df('0x10')](_0x02df('0xc'),auth['isAuthenticated'](),controller[_0x02df('0x11')]);module[_0x02df('0x12')]=router; \ No newline at end of file +var _0xea2a=['../../config/environment','./smsApplication.controller','get','index','/:id','show','post','put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x19e584,_0x51e0bc){var _0x46871b=function(_0x54cfc1){while(--_0x54cfc1){_0x19e584['push'](_0x19e584['shift']());}};_0x46871b(++_0x51e0bc);}(_0xea2a,0x102));var _0xaea2=function(_0x2ac8f0,_0x21d3df){_0x2ac8f0=_0x2ac8f0-0x0;var _0x4e9e93=_0xea2a[_0x2ac8f0];return _0x4e9e93;};'use strict';var multer=require(_0xaea2('0x0'));var util=require(_0xaea2('0x1'));var path=require(_0xaea2('0x2'));var timeout=require(_0xaea2('0x3'));var express=require(_0xaea2('0x4'));var router=express[_0xaea2('0x5')]();var auth=require(_0xaea2('0x6'));var interaction=require(_0xaea2('0x7'));var config=require(_0xaea2('0x8'));var controller=require(_0xaea2('0x9'));router[_0xaea2('0xa')]('/',auth['isAuthenticated'](),controller[_0xaea2('0xb')]);router[_0xaea2('0xa')](_0xaea2('0xc'),auth['isAuthenticated'](),controller[_0xaea2('0xd')]);router[_0xaea2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaea2('0xf')](_0xaea2('0xc'),auth[_0xaea2('0x10')](),controller['update']);router[_0xaea2('0x11')](_0xaea2('0xc'),auth['isAuthenticated'](),controller[_0xaea2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index a3e7011..124c877 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 _0x8437=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x4b3675,_0x475a31){var _0x1b0b3d=function(_0x5426c1){while(--_0x5426c1){_0x4b3675['push'](_0x4b3675['shift']());}};_0x1b0b3d(++_0x475a31);}(_0x8437,0x149));var _0x7843=function(_0x561d48,_0x554dbd){_0x561d48=_0x561d48-0x0;var _0x45f845=_0x8437[_0x561d48];return _0x45f845;};'use strict';var Sequelize=require(_0x7843('0x0'));module[_0x7843('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7843('0x2')},'appdata':{'type':Sequelize[_0x7843('0x3')]()},'description':{'type':Sequelize[_0x7843('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7843('0x5')}}; \ No newline at end of file +var _0x5656=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x4299fa,_0x11c1e2){var _0x305a51=function(_0x2bf5df){while(--_0x2bf5df){_0x4299fa['push'](_0x4299fa['shift']());}};_0x305a51(++_0x11c1e2);}(_0x5656,0x12d));var _0x6565=function(_0x5117d1,_0x224c53){_0x5117d1=_0x5117d1-0x0;var _0x137ce0=_0x5656[_0x5117d1];return _0x137ce0;};'use strict';var Sequelize=require(_0x6565('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6565('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6565('0x2')],'allowNull':![],'defaultValue':_0x6565('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6565('0x2')]},'interval':{'type':Sequelize[_0x6565('0x2')],'defaultValue':_0x6565('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d9c418a..3090104 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 _0xe6b0=['../../config/utils','../../config/license/util','../../mysqldb','end','status','count','limit','set','apply','reject','save','then','sendStatus','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','params','includeAll','find','catch','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x450aaa,_0x86639e){var _0xf6c79=function(_0x519cdc){while(--_0x519cdc){_0x450aaa['push'](_0x450aaa['shift']());}};_0xf6c79(++_0x86639e);}(_0xe6b0,0x18b));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0e6b('0x0'));var emlformat=require(_0x0e6b('0x1'));var rimraf=require(_0x0e6b('0x2'));var zipdir=require(_0x0e6b('0x3'));var jsonpatch=require(_0x0e6b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0e6b('0x5'));var util=require(_0x0e6b('0x6'));var path=require('path');var sox=require(_0x0e6b('0x7'));var csv=require(_0x0e6b('0x8'));var ejs=require(_0x0e6b('0x9'));var fs=require('fs');var _=require(_0x0e6b('0xa'));var squel=require('squel');var crypto=require(_0x0e6b('0xb'));var jsforce=require(_0x0e6b('0xc'));var deskjs=require(_0x0e6b('0xd'));var toCsv=require(_0x0e6b('0x8'));var querystring=require(_0x0e6b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0e6b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e6b('0x11'))(_0x0e6b('0x12'));var utils=require(_0x0e6b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0e6b('0x14'));var db=require(_0x0e6b('0x15'))['db'];function respondWithStatusCode(_0x21e4ef,_0x1b6497){_0x1b6497=_0x1b6497||0xcc;return function(_0x108895){if(_0x108895){return _0x21e4ef['sendStatus'](_0x1b6497);}return _0x21e4ef['status'](_0x1b6497)[_0x0e6b('0x16')]();};}function respondWithResult(_0x712bc1,_0x55fa6d){_0x55fa6d=_0x55fa6d||0xc8;return function(_0x58cf9e){if(_0x58cf9e){return _0x712bc1[_0x0e6b('0x17')](_0x55fa6d)['json'](_0x58cf9e);}};}function respondWithFilteredResult(_0x4f1736,_0x4074be){return function(_0x11fd9a){if(_0x11fd9a){var _0x1908e9=_0x11fd9a[_0x0e6b('0x18')],_0x263d84=_0x4074be['offset'],_0x38f44c=_0x4074be['offset']+_0x4074be[_0x0e6b('0x19')],_0x3821a6;if(_0x38f44c>=_0x1908e9){_0x38f44c=_0x1908e9;_0x3821a6=0xc8;}else{_0x3821a6=0xce;}_0x4f1736['status'](_0x3821a6);return _0x4f1736[_0x0e6b('0x1a')]('Content-Range',_0x263d84+'-'+_0x38f44c+'/'+_0x1908e9)['json'](_0x11fd9a);}return null;};}function patchUpdates(_0x193adb){return function(_0xf44742){try{jsonpatch[_0x0e6b('0x1b')](_0xf44742,_0x193adb,!![]);}catch(_0x516e3a){return BPromise[_0x0e6b('0x1c')](_0x516e3a);}return _0xf44742[_0x0e6b('0x1d')]();};}function saveUpdates(_0xf72673,_0x3e66c8){return function(_0x28f1ad){if(_0x28f1ad){return _0x28f1ad['update'](_0xf72673)['then'](function(_0x37a0fb){return _0x37a0fb;});}return null;};}function removeEntity(_0x2aa695,_0x6f0662){return function(_0x1487e9){if(_0x1487e9){return _0x1487e9['destroy']()[_0x0e6b('0x1e')](function(){_0x2aa695[_0x0e6b('0x17')](0xcc)[_0x0e6b('0x16')]();});}};}function handleEntityNotFound(_0x3f17dc,_0x5e3d47){return function(_0x2ebdce){if(!_0x2ebdce){_0x3f17dc[_0x0e6b('0x1f')](0x194);}return _0x2ebdce;};}function handleError(_0x1ac0be,_0x528073){_0x528073=_0x528073||0x1f4;return function(_0x3e8e2a){logger[_0x0e6b('0x20')](_0x3e8e2a['stack']);if(_0x3e8e2a[_0x0e6b('0x21')]){delete _0x3e8e2a[_0x0e6b('0x21')];}_0x1ac0be['status'](_0x528073)[_0x0e6b('0x22')](_0x3e8e2a);};}exports[_0x0e6b('0x23')]=function(_0x14ca08,_0x53babc){var _0x2aee43={},_0x4d005a={},_0xe8dfe0={'count':0x0,'rows':[]};var _0x1f5963=_[_0x0e6b('0x24')](db[_0x0e6b('0x25')][_0x0e6b('0x26')],function(_0x4040fd){return{'name':_0x4040fd[_0x0e6b('0x27')],'type':_0x4040fd[_0x0e6b('0x28')]['key']};});_0x4d005a['model']=_[_0x0e6b('0x24')](_0x1f5963,_0x0e6b('0x21'));_0x4d005a[_0x0e6b('0x29')]=_[_0x0e6b('0x2a')](_0x14ca08[_0x0e6b('0x29')]);_0x4d005a['filters']=_[_0x0e6b('0x2b')](_0x4d005a['model'],_0x4d005a['query']);_0x2aee43[_0x0e6b('0x2c')]=_[_0x0e6b('0x2b')](_0x4d005a[_0x0e6b('0x2d')],qs['fields'](_0x14ca08[_0x0e6b('0x29')][_0x0e6b('0x2e')]));_0x2aee43[_0x0e6b('0x2c')]=_0x2aee43['attributes'][_0x0e6b('0x2f')]?_0x2aee43[_0x0e6b('0x2c')]:_0x4d005a[_0x0e6b('0x2d')];if(!_0x14ca08['query'][_0x0e6b('0x30')](_0x0e6b('0x31'))){_0x2aee43[_0x0e6b('0x19')]=qs[_0x0e6b('0x19')](_0x14ca08[_0x0e6b('0x29')][_0x0e6b('0x19')]);_0x2aee43[_0x0e6b('0x32')]=qs['offset'](_0x14ca08[_0x0e6b('0x29')]['offset']);}_0x2aee43['order']=qs[_0x0e6b('0x33')](_0x14ca08[_0x0e6b('0x29')]['sort']);_0x2aee43[_0x0e6b('0x34')]=qs[_0x0e6b('0x35')](_[_0x0e6b('0x36')](_0x14ca08[_0x0e6b('0x29')],_0x4d005a[_0x0e6b('0x35')]),_0x1f5963);if(_0x14ca08['query'][_0x0e6b('0x37')]){_0x2aee43['where']=_[_0x0e6b('0x38')](_0x2aee43[_0x0e6b('0x34')],{'$or':_[_0x0e6b('0x24')](_0x1f5963,function(_0x143268){if(_0x143268[_0x0e6b('0x28')]!==_0x0e6b('0x39')){var _0x462097={};_0x462097[_0x143268[_0x0e6b('0x21')]]={'$like':'%'+_0x14ca08['query'][_0x0e6b('0x37')]+'%'};return _0x462097;}})});}_0x2aee43=_[_0x0e6b('0x38')]({},_0x2aee43,_0x14ca08['options']);var _0xa599de={'where':_0x2aee43[_0x0e6b('0x34')]};return db[_0x0e6b('0x25')][_0x0e6b('0x18')](_0xa599de)[_0x0e6b('0x1e')](function(_0x3c34a2){_0xe8dfe0[_0x0e6b('0x18')]=_0x3c34a2;if(_0x14ca08['query']['includeAll']){_0x2aee43[_0x0e6b('0x3a')]=[{'all':!![]}];}return db[_0x0e6b('0x25')][_0x0e6b('0x3b')](_0x2aee43);})[_0x0e6b('0x1e')](function(_0x20623b){_0xe8dfe0[_0x0e6b('0x3c')]=_0x20623b;return _0xe8dfe0;})['then'](respondWithFilteredResult(_0x53babc,_0x2aee43))['catch'](handleError(_0x53babc,null));};exports['show']=function(_0xa732d1,_0x273c93){var _0x5d1ea8={'raw':!![],'where':{'id':_0xa732d1[_0x0e6b('0x3d')]['id']}},_0x53bd7b={};_0x53bd7b[_0x0e6b('0x2d')]=_[_0x0e6b('0x2a')](db[_0x0e6b('0x25')][_0x0e6b('0x26')]);_0x53bd7b[_0x0e6b('0x29')]=_[_0x0e6b('0x2a')](_0xa732d1[_0x0e6b('0x29')]);_0x53bd7b[_0x0e6b('0x35')]=_[_0x0e6b('0x2b')](_0x53bd7b[_0x0e6b('0x2d')],_0x53bd7b[_0x0e6b('0x29')]);_0x5d1ea8[_0x0e6b('0x2c')]=_[_0x0e6b('0x2b')](_0x53bd7b[_0x0e6b('0x2d')],qs[_0x0e6b('0x2e')](_0xa732d1[_0x0e6b('0x29')][_0x0e6b('0x2e')]));_0x5d1ea8[_0x0e6b('0x2c')]=_0x5d1ea8[_0x0e6b('0x2c')][_0x0e6b('0x2f')]?_0x5d1ea8[_0x0e6b('0x2c')]:_0x53bd7b[_0x0e6b('0x2d')];if(_0xa732d1['query'][_0x0e6b('0x3e')]){_0x5d1ea8['include']=[{'all':!![]}];}_0x5d1ea8=_[_0x0e6b('0x38')]({},_0x5d1ea8,_0xa732d1['options']);return db[_0x0e6b('0x25')][_0x0e6b('0x3f')](_0x5d1ea8)[_0x0e6b('0x1e')](handleEntityNotFound(_0x273c93,null))[_0x0e6b('0x1e')](respondWithResult(_0x273c93,null))[_0x0e6b('0x40')](handleError(_0x273c93,null));};exports[_0x0e6b('0x41')]=function(_0x3855d4,_0x2219d5){return db[_0x0e6b('0x25')][_0x0e6b('0x41')](_0x3855d4[_0x0e6b('0x42')],{})[_0x0e6b('0x1e')](respondWithResult(_0x2219d5,0xc9))[_0x0e6b('0x40')](handleError(_0x2219d5,null));};exports[_0x0e6b('0x43')]=function(_0x70f5fb,_0x415a2e){if(_0x70f5fb['body']['id']){delete _0x70f5fb[_0x0e6b('0x42')]['id'];}return db['SmsApplication'][_0x0e6b('0x3f')]({'where':{'id':_0x70f5fb[_0x0e6b('0x3d')]['id']}})[_0x0e6b('0x1e')](handleEntityNotFound(_0x415a2e,null))[_0x0e6b('0x1e')](saveUpdates(_0x70f5fb[_0x0e6b('0x42')],null))[_0x0e6b('0x1e')](respondWithResult(_0x415a2e,null))[_0x0e6b('0x40')](handleError(_0x415a2e,null));};exports[_0x0e6b('0x44')]=function(_0xfbb78b,_0x20a238){return db[_0x0e6b('0x25')][_0x0e6b('0x3f')]({'where':{'id':_0xfbb78b[_0x0e6b('0x3d')]['id']}})[_0x0e6b('0x1e')](handleEntityNotFound(_0x20a238,null))[_0x0e6b('0x1e')](removeEntity(_0x20a238,null))[_0x0e6b('0x40')](handleError(_0x20a238,null));}; \ No newline at end of file +var _0x4045=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4045,0x7e));var _0x5404=function(_0x45f117,_0x37455d){_0x45f117=_0x45f117-0x0;var _0xaece9e=_0x4045[_0x45f117];return _0xaece9e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5404('0x0'));var rimraf=require(_0x5404('0x1'));var zipdir=require(_0x5404('0x2'));var jsonpatch=require(_0x5404('0x3'));var rp=require(_0x5404('0x4'));var moment=require(_0x5404('0x5'));var BPromise=require(_0x5404('0x6'));var Mustache=require(_0x5404('0x7'));var util=require(_0x5404('0x8'));var path=require(_0x5404('0x9'));var sox=require(_0x5404('0xa'));var csv=require('to-csv');var ejs=require(_0x5404('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5404('0xc'));var crypto=require('crypto');var jsforce=require(_0x5404('0xd'));var deskjs=require(_0x5404('0xe'));var toCsv=require(_0x5404('0xf'));var querystring=require(_0x5404('0x10'));var Papa=require(_0x5404('0x11'));var Redis=require(_0x5404('0x12'));var authService=require(_0x5404('0x13'));var qs=require(_0x5404('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5404('0x15'));var logger=require(_0x5404('0x16'))(_0x5404('0x17'));var utils=require('../../config/utils');var config=require(_0x5404('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5404('0x19'))['db'];function respondWithStatusCode(_0x40ad56,_0x29f5c6){_0x29f5c6=_0x29f5c6||0xcc;return function(_0x350cec){if(_0x350cec){return _0x40ad56[_0x5404('0x1a')](_0x29f5c6);}return _0x40ad56[_0x5404('0x1b')](_0x29f5c6)[_0x5404('0x1c')]();};}function respondWithResult(_0x1b4be0,_0x3bc81b){_0x3bc81b=_0x3bc81b||0xc8;return function(_0x366298){if(_0x366298){return _0x1b4be0[_0x5404('0x1b')](_0x3bc81b)[_0x5404('0x1d')](_0x366298);}};}function respondWithFilteredResult(_0xd84947,_0xbe7469){return function(_0x5d4638){if(_0x5d4638){var _0x590693=_0x5d4638[_0x5404('0x1e')],_0x181483=_0xbe7469[_0x5404('0x1f')],_0x22d636=_0xbe7469[_0x5404('0x1f')]+_0xbe7469['limit'],_0x3ce146;if(_0x22d636>=_0x590693){_0x22d636=_0x590693;_0x3ce146=0xc8;}else{_0x3ce146=0xce;}_0xd84947[_0x5404('0x1b')](_0x3ce146);return _0xd84947[_0x5404('0x20')](_0x5404('0x21'),_0x181483+'-'+_0x22d636+'/'+_0x590693)[_0x5404('0x1d')](_0x5d4638);}return null;};}function patchUpdates(_0x3302cb){return function(_0x56ae7a){try{jsonpatch[_0x5404('0x22')](_0x56ae7a,_0x3302cb,!![]);}catch(_0x529961){return BPromise[_0x5404('0x23')](_0x529961);}return _0x56ae7a['save']();};}function saveUpdates(_0x53b084,_0xaa01f6){return function(_0x22a55a){if(_0x22a55a){return _0x22a55a[_0x5404('0x24')](_0x53b084)[_0x5404('0x25')](function(_0xa501d9){return _0xa501d9;});}return null;};}function removeEntity(_0x6214f4,_0x260771){return function(_0x4644c9){if(_0x4644c9){return _0x4644c9[_0x5404('0x26')]()['then'](function(){_0x6214f4[_0x5404('0x1b')](0xcc)[_0x5404('0x1c')]();});}};}function handleEntityNotFound(_0xcc1978,_0x5c8f0b){return function(_0x2e3a25){if(!_0x2e3a25){_0xcc1978[_0x5404('0x1a')](0x194);}return _0x2e3a25;};}function handleError(_0x38ebd2,_0x499b1a){_0x499b1a=_0x499b1a||0x1f4;return function(_0x59e6f5){logger[_0x5404('0x27')](_0x59e6f5['stack']);if(_0x59e6f5[_0x5404('0x28')]){delete _0x59e6f5['name'];}_0x38ebd2[_0x5404('0x1b')](_0x499b1a)[_0x5404('0x29')](_0x59e6f5);};}exports[_0x5404('0x2a')]=function(_0xff0026,_0x371833){var _0x388ac2={},_0x15c56f={},_0x49395c={'count':0x0,'rows':[]};var _0x1fdc57=_[_0x5404('0x2b')](db[_0x5404('0x2c')][_0x5404('0x2d')],function(_0x8620bd){return{'name':_0x8620bd[_0x5404('0x2e')],'type':_0x8620bd[_0x5404('0x2f')][_0x5404('0x30')]};});_0x15c56f[_0x5404('0x31')]=_[_0x5404('0x2b')](_0x1fdc57,_0x5404('0x28'));_0x15c56f['query']=_[_0x5404('0x32')](_0xff0026[_0x5404('0x33')]);_0x15c56f[_0x5404('0x34')]=_[_0x5404('0x35')](_0x15c56f['model'],_0x15c56f[_0x5404('0x33')]);_0x388ac2['attributes']=_['intersection'](_0x15c56f[_0x5404('0x31')],qs[_0x5404('0x36')](_0xff0026[_0x5404('0x33')][_0x5404('0x36')]));_0x388ac2[_0x5404('0x37')]=_0x388ac2[_0x5404('0x37')][_0x5404('0x38')]?_0x388ac2[_0x5404('0x37')]:_0x15c56f[_0x5404('0x31')];if(!_0xff0026[_0x5404('0x33')]['hasOwnProperty']('nolimit')){_0x388ac2[_0x5404('0x39')]=qs[_0x5404('0x39')](_0xff0026[_0x5404('0x33')]['limit']);_0x388ac2[_0x5404('0x1f')]=qs[_0x5404('0x1f')](_0xff0026[_0x5404('0x33')][_0x5404('0x1f')]);}_0x388ac2[_0x5404('0x3a')]=qs[_0x5404('0x3b')](_0xff0026[_0x5404('0x33')][_0x5404('0x3b')]);_0x388ac2[_0x5404('0x3c')]=qs[_0x5404('0x34')](_[_0x5404('0x3d')](_0xff0026[_0x5404('0x33')],_0x15c56f[_0x5404('0x34')]),_0x1fdc57);if(_0xff0026[_0x5404('0x33')][_0x5404('0x3e')]){_0x388ac2[_0x5404('0x3c')]=_[_0x5404('0x3f')](_0x388ac2[_0x5404('0x3c')],{'$or':_['map'](_0x1fdc57,function(_0x4af80f){if(_0x4af80f[_0x5404('0x2f')]!==_0x5404('0x40')){var _0x395ad1={};_0x395ad1[_0x4af80f[_0x5404('0x28')]]={'$like':'%'+_0xff0026[_0x5404('0x33')]['filter']+'%'};return _0x395ad1;}})});}_0x388ac2=_[_0x5404('0x3f')]({},_0x388ac2,_0xff0026['options']);var _0x284d84={'where':_0x388ac2['where']};return db['SmsApplication'][_0x5404('0x1e')](_0x284d84)[_0x5404('0x25')](function(_0x55cb86){_0x49395c['count']=_0x55cb86;if(_0xff0026[_0x5404('0x33')][_0x5404('0x41')]){_0x388ac2[_0x5404('0x42')]=[{'all':!![]}];}return db[_0x5404('0x2c')][_0x5404('0x43')](_0x388ac2);})['then'](function(_0x14c1b9){_0x49395c[_0x5404('0x44')]=_0x14c1b9;return _0x49395c;})[_0x5404('0x25')](respondWithFilteredResult(_0x371833,_0x388ac2))[_0x5404('0x45')](handleError(_0x371833,null));};exports[_0x5404('0x46')]=function(_0x13f7be,_0x41f896){var _0xb33858={'raw':!![],'where':{'id':_0x13f7be[_0x5404('0x47')]['id']}},_0x2af627={};_0x2af627[_0x5404('0x31')]=_[_0x5404('0x32')](db['SmsApplication'][_0x5404('0x2d')]);_0x2af627[_0x5404('0x33')]=_['keys'](_0x13f7be[_0x5404('0x33')]);_0x2af627[_0x5404('0x34')]=_[_0x5404('0x35')](_0x2af627['model'],_0x2af627[_0x5404('0x33')]);_0xb33858['attributes']=_[_0x5404('0x35')](_0x2af627[_0x5404('0x31')],qs['fields'](_0x13f7be['query']['fields']));_0xb33858[_0x5404('0x37')]=_0xb33858[_0x5404('0x37')][_0x5404('0x38')]?_0xb33858[_0x5404('0x37')]:_0x2af627[_0x5404('0x31')];if(_0x13f7be[_0x5404('0x33')]['includeAll']){_0xb33858[_0x5404('0x42')]=[{'all':!![]}];}_0xb33858=_[_0x5404('0x3f')]({},_0xb33858,_0x13f7be[_0x5404('0x48')]);return db['SmsApplication'][_0x5404('0x49')](_0xb33858)['then'](handleEntityNotFound(_0x41f896,null))[_0x5404('0x25')](respondWithResult(_0x41f896,null))['catch'](handleError(_0x41f896,null));};exports['create']=function(_0x49a6da,_0x5d5f5c){return db[_0x5404('0x2c')][_0x5404('0x4a')](_0x49a6da[_0x5404('0x4b')],{})[_0x5404('0x25')](respondWithResult(_0x5d5f5c,0xc9))['catch'](handleError(_0x5d5f5c,null));};exports[_0x5404('0x24')]=function(_0x3d042b,_0x56fed2){if(_0x3d042b[_0x5404('0x4b')]['id']){delete _0x3d042b['body']['id'];}return db['SmsApplication'][_0x5404('0x49')]({'where':{'id':_0x3d042b[_0x5404('0x47')]['id']}})['then'](handleEntityNotFound(_0x56fed2,null))[_0x5404('0x25')](saveUpdates(_0x3d042b['body'],null))[_0x5404('0x25')](respondWithResult(_0x56fed2,null))[_0x5404('0x45')](handleError(_0x56fed2,null));};exports[_0x5404('0x26')]=function(_0x41e753,_0x3237c9){return db[_0x5404('0x2c')][_0x5404('0x49')]({'where':{'id':_0x41e753[_0x5404('0x47')]['id']}})[_0x5404('0x25')](handleEntityNotFound(_0x3237c9,null))[_0x5404('0x25')](removeEntity(_0x3237c9,null))[_0x5404('0x45')](handleError(_0x3237c9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 310a083..f501c95 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 _0x8f32=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x4eec31,_0x501eee){var _0x180095=function(_0x9b55f4){while(--_0x9b55f4){_0x4eec31['push'](_0x4eec31['shift']());}};_0x180095(++_0x501eee);}(_0x8f32,0x66));var _0x28f3=function(_0x4fe21c,_0x3d2578){_0x4fe21c=_0x4fe21c-0x0;var _0x6f3786=_0x8f32[_0x4fe21c];return _0x6f3786;};'use strict';var _=require('lodash');var util=require(_0x28f3('0x0'));var logger=require(_0x28f3('0x1'))(_0x28f3('0x2'));var moment=require('moment');var BPromise=require(_0x28f3('0x3'));var rp=require(_0x28f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28f3('0x5'));var config=require(_0x28f3('0x6'));var attributes=require(_0x28f3('0x7'));module[_0x28f3('0x8')]=function(_0xc44a53,_0x307f5c){return _0xc44a53[_0x28f3('0x9')](_0x28f3('0xa'),attributes,{'tableName':_0x28f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28f3('0xc'),'collate':_0x28f3('0xd')});}; \ No newline at end of file +var _0xde76=['bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xde76,0x80));var _0x6de7=function(_0x3496d4,_0x590cb5){_0x3496d4=_0x3496d4-0x0;var _0x442b3c=_0xde76[_0x3496d4];return _0x442b3c;};'use strict';var _=require(_0x6de7('0x0'));var util=require('util');var logger=require(_0x6de7('0x1'))(_0x6de7('0x2'));var moment=require(_0x6de7('0x3'));var BPromise=require(_0x6de7('0x4'));var rp=require(_0x6de7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6de7('0x6'));var config=require(_0x6de7('0x7'));var attributes=require(_0x6de7('0x8'));module[_0x6de7('0x9')]=function(_0x5cdb02,_0x5a960d){return _0x5cdb02['define'](_0x6de7('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6de7('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f94cc4d..290ed6e 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 _0x1dcc=['error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25e30f,_0x3ea59b){var _0x195a65=function(_0x26ef79){while(--_0x26ef79){_0x25e30f['push'](_0x25e30f['shift']());}};_0x195a65(++_0x3ea59b);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x192f9b,_0xd713f){_0x192f9b=_0x192f9b-0x0;var _0x3f5f91=_0x1dcc[_0x192f9b];return _0x3f5f91;};'use strict';var _=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var moment=require(_0xc1dc('0x2'));var BPromise=require(_0xc1dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1dc('0x5'));var logger=require(_0xc1dc('0x6'))(_0xc1dc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc1dc('0x8')][_0xc1dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41b667,_0x4dab41,_0x3ef050){return new BPromise(function(_0x3deb94,_0x597ba8){return client[_0xc1dc('0xa')](_0x41b667,_0x3ef050)['then'](function(_0x2e606d){logger['info'](_0xc1dc('0xb'),_0x4dab41,_0xc1dc('0xc'));logger[_0xc1dc('0xd')](_0xc1dc('0xe'),_0x4dab41,_0xc1dc('0xc'),JSON[_0xc1dc('0xf')](_0x2e606d));if(_0x2e606d[_0xc1dc('0x10')]){if(_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x11')]===0x1f4){logger['error'](_0xc1dc('0xb'),_0x4dab41,_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x12')]);return _0x597ba8(_0x2e606d['error'][_0xc1dc('0x12')]);}logger[_0xc1dc('0x10')](_0xc1dc('0xb'),_0x4dab41,_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x12')]);return _0x3deb94(_0x2e606d[_0xc1dc('0x10')][_0xc1dc('0x12')]);}else{logger[_0xc1dc('0x13')](_0xc1dc('0xb'),_0x4dab41,_0xc1dc('0xc'));_0x3deb94(_0x2e606d[_0xc1dc('0x14')]['message']);}})[_0xc1dc('0x15')](function(_0x3533a9){logger[_0xc1dc('0x10')](_0xc1dc('0xb'),_0x4dab41,_0x3533a9);_0x597ba8(_0x3533a9);});});} \ No newline at end of file +var _0x4af9=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x30b7bc,_0x3d83d1){var _0x34b954=function(_0x46c462){while(--_0x46c462){_0x30b7bc['push'](_0x30b7bc['shift']());}};_0x34b954(++_0x3d83d1);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94af('0x2'));var fs=require('fs');var Redis=require(_0x94af('0x3'));var db=require(_0x94af('0x4'))['db'];var utils=require(_0x94af('0x5'));var logger=require(_0x94af('0x6'))(_0x94af('0x7'));var config=require(_0x94af('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94af('0x9')][_0x94af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e19c9,_0x3a64fa,_0x5ad956){return new BPromise(function(_0x2f84d4,_0x68da0f){return client[_0x94af('0xb')](_0x3e19c9,_0x5ad956)['then'](function(_0x5bfc7c){logger[_0x94af('0xc')](_0x94af('0xd'),_0x3a64fa,_0x94af('0xe'));logger[_0x94af('0xf')](_0x94af('0x10'),_0x3a64fa,_0x94af('0xe'),JSON['stringify'](_0x5bfc7c));if(_0x5bfc7c[_0x94af('0x11')]){if(_0x5bfc7c[_0x94af('0x11')]['code']===0x1f4){logger[_0x94af('0x11')](_0x94af('0xd'),_0x3a64fa,_0x5bfc7c[_0x94af('0x11')][_0x94af('0x12')]);return _0x68da0f(_0x5bfc7c[_0x94af('0x11')]['message']);}logger[_0x94af('0x11')]('SmsApplication,\x20%s,\x20%s',_0x3a64fa,_0x5bfc7c['error']['message']);return _0x2f84d4(_0x5bfc7c[_0x94af('0x11')][_0x94af('0x12')]);}else{logger[_0x94af('0xc')](_0x94af('0xd'),_0x3a64fa,'request\x20sent');_0x2f84d4(_0x5bfc7c[_0x94af('0x13')][_0x94af('0x12')]);}})['catch'](function(_0x3dadcd){logger[_0x94af('0x11')](_0x94af('0xd'),_0x3a64fa,_0x3dadcd);_0x68da0f(_0x3dadcd);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 61f25fe..f8a2523 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 _0x865d=['put','smsinteraction:update','delete','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x2730ef,_0x298a59){var _0x593e10=function(_0x5363dc){while(--_0x5363dc){_0x2730ef['push'](_0x2730ef['shift']());}};_0x593e10(++_0x298a59);}(_0x865d,0xd8));var _0xd865=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x865d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd865('0x0'));var util=require(_0xd865('0x1'));var path=require(_0xd865('0x2'));var timeout=require('connect-timeout');var express=require(_0xd865('0x3'));var router=express[_0xd865('0x4')]();var auth=require(_0xd865('0x5'));var interaction=require(_0xd865('0x6'));var config=require(_0xd865('0x7'));var controller=require(_0xd865('0x8'));router[_0xd865('0x9')]('/',auth[_0xd865('0xa')](),controller[_0xd865('0xb')]);router[_0xd865('0x9')]('/describe',auth[_0xd865('0xa')](),controller[_0xd865('0xc')]);router[_0xd865('0x9')](_0xd865('0xd'),auth[_0xd865('0xa')](),controller[_0xd865('0xe')]);router['get'](_0xd865('0xf'),auth[_0xd865('0xa')](),controller[_0xd865('0x10')]);router[_0xd865('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xd865('0x11')]);router[_0xd865('0x12')]('/',auth[_0xd865('0xa')](),controller[_0xd865('0x13')]);router[_0xd865('0x12')]('/:id/messages',auth[_0xd865('0xa')](),controller[_0xd865('0x14')]);router[_0xd865('0x12')](_0xd865('0x15'),auth[_0xd865('0xa')](),interaction[_0xd865('0x16')](_0xd865('0x17'),'smsinteraction:addtags'),controller['addTags']);router[_0xd865('0x18')](_0xd865('0xd'),auth[_0xd865('0xa')](),interaction[_0xd865('0x16')](_0xd865('0x17'),_0xd865('0x19')),controller['update']);router[_0xd865('0x1a')]('/:id',auth[_0xd865('0xa')](),interaction['tracked']('sms','smsinteraction:destroy'),controller[_0xd865('0x1b')]);router['delete'](_0xd865('0x15'),auth['isAuthenticated'](),controller[_0xd865('0x1c')]);module[_0xd865('0x1d')]=router; \ No newline at end of file +var _0xc4c0=['Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xc4c0,0x96));var _0x0c4c=function(_0x5e8460,_0x2003b5){_0x5e8460=_0x5e8460-0x0;var _0x3d50fd=_0xc4c0[_0x5e8460];return _0x3d50fd;};'use strict';var multer=require(_0x0c4c('0x0'));var util=require(_0x0c4c('0x1'));var path=require(_0x0c4c('0x2'));var timeout=require(_0x0c4c('0x3'));var express=require(_0x0c4c('0x4'));var router=express[_0x0c4c('0x5')]();var auth=require(_0x0c4c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c4c('0x7'));var controller=require(_0x0c4c('0x8'));router[_0x0c4c('0x9')]('/',auth[_0x0c4c('0xa')](),controller[_0x0c4c('0xb')]);router[_0x0c4c('0x9')]('/describe',auth[_0x0c4c('0xa')](),controller[_0x0c4c('0xc')]);router[_0x0c4c('0x9')](_0x0c4c('0xd'),auth[_0x0c4c('0xa')](),controller[_0x0c4c('0xe')]);router['get'](_0x0c4c('0xf'),auth[_0x0c4c('0xa')](),controller[_0x0c4c('0x10')]);router[_0x0c4c('0x9')]('/:id/download',auth[_0x0c4c('0xa')](),controller[_0x0c4c('0x11')]);router['post']('/',auth[_0x0c4c('0xa')](),controller['create']);router[_0x0c4c('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0c4c('0x13')]);router[_0x0c4c('0x12')](_0x0c4c('0x14'),auth[_0x0c4c('0xa')](),interaction[_0x0c4c('0x15')](_0x0c4c('0x16'),_0x0c4c('0x17')),controller['addTags']);router[_0x0c4c('0x18')](_0x0c4c('0xd'),auth[_0x0c4c('0xa')](),interaction[_0x0c4c('0x15')](_0x0c4c('0x16'),_0x0c4c('0x19')),controller[_0x0c4c('0x1a')]);router[_0x0c4c('0x1b')](_0x0c4c('0xd'),auth[_0x0c4c('0xa')](),interaction[_0x0c4c('0x15')](_0x0c4c('0x16'),_0x0c4c('0x1c')),controller[_0x0c4c('0x1d')]);router[_0x0c4c('0x1b')](_0x0c4c('0x14'),auth[_0x0c4c('0xa')](),controller[_0x0c4c('0x1e')]);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 0c2b978..c2d8f7a 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 _0xcda7=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x79e1d7,_0x32f216){var _0x2be355=function(_0x15989b){while(--_0x15989b){_0x79e1d7['push'](_0x79e1d7['shift']());}};_0x2be355(++_0x32f216);}(_0xcda7,0x1de));var _0x7cda=function(_0x314f46,_0x22c471){_0x314f46=_0x314f46-0x0;var _0x3c3d62=_0xcda7[_0x314f46];return _0x3c3d62;};'use strict';var Sequelize=require(_0x7cda('0x0'));var moment=require(_0x7cda('0x1'));module[_0x7cda('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7cda('0x3')]},'disposition':{'type':Sequelize[_0x7cda('0x4')]},'secondDisposition':{'type':Sequelize[_0x7cda('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7cda('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7cda('0x5')]('in',_0x7cda('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7cda('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7cda('0x5')]('in',_0x7cda('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2006=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x35a7aa,_0x334ea3){var _0x52f4f4=function(_0x1fa018){while(--_0x1fa018){_0x35a7aa['push'](_0x35a7aa['shift']());}};_0x52f4f4(++_0x334ea3);}(_0x2006,0xb6));var _0x6200=function(_0x32a4e6,_0x121efa){_0x32a4e6=_0x32a4e6-0x0;var _0x1e13fb=_0x2006[_0x32a4e6];return _0x1e13fb;};'use strict';var Sequelize=require(_0x6200('0x0'));var moment=require(_0x6200('0x1'));module[_0x6200('0x2')]={'closed':{'type':Sequelize[_0x6200('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6200('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6200('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6200('0x5')]},'note':{'type':Sequelize[_0x6200('0x5')]},'phone':{'type':Sequelize[_0x6200('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6200('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6200('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6200('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3b90faa..e60d128 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 _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 078fd55..76aa7fc 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 _0x5292=['setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','then','map'];(function(_0x3f731c,_0x57727d){var _0x4c91bb=function(_0x27c08e){while(--_0x27c08e){_0x3f731c['push'](_0x3f731c['shift']());}};_0x4c91bb(++_0x57727d);}(_0x5292,0xf7));var _0x2529=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x5292[_0x3bab09];return _0x164376;};'use strict';var EventEmitter=require(_0x2529('0x0'));var SmsInteraction=require(_0x2529('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x2529('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2529('0x2')](0x0);var events={'afterCreate':_0x2529('0x3'),'afterUpdate':_0x2529('0x4'),'afterDestroy':_0x2529('0x5')};function emitEvent(_0x5d25dc){return function(_0x28c08d,_0x482dba,_0x4c9b4c){_0x28c08d['getUsers']({'attributes':['id'],'raw':!![]})[_0x2529('0x6')](function(_0x43cbef){_0x28c08d['setDataValue']('Users',_0x43cbef[_0x2529('0x7')](function(_0x2a0306){return{'id':_0x2a0306['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x28c08d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2529('0x6')](function(_0x44c8da){_0x28c08d[_0x2529('0x8')](_0x2529('0x9'),_0x44c8da[_0x2529('0xa')]);SmsInteractionEvents[_0x2529('0xb')](_0x5d25dc+':'+_0x28c08d['id'],_0x28c08d);SmsInteractionEvents[_0x2529('0xb')](_0x5d25dc,_0x28c08d);_0x4c9b4c(null);})[_0x2529('0xc')](_0x4c9b4c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x2529('0xd')](e,emitEvent(event));}}module[_0x2529('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x3435=['update','remove','setDataValue','Users','map','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3435,0xfa));var _0x5343=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x3435[_0x2272b5];return _0x110156;};'use strict';var EventEmitter=require(_0x5343('0x0'));var SmsInteraction=require(_0x5343('0x1'))['db'][_0x5343('0x2')];var SmsMessage=require(_0x5343('0x1'))['db'][_0x5343('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5343('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5343('0x5'),'afterDestroy':_0x5343('0x6')};function emitEvent(_0x578a24){return function(_0x4ca9ba,_0x1f0046,_0x28f0f3){_0x4ca9ba['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x13641f){_0x4ca9ba[_0x5343('0x7')](_0x5343('0x8'),_0x13641f[_0x5343('0x9')](function(_0x41673f){return{'id':_0x41673f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4ca9ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5343('0xa')](function(_0x50d857){_0x4ca9ba[_0x5343('0x7')](_0x5343('0xb'),_0x50d857[_0x5343('0xc')]);SmsInteractionEvents[_0x5343('0xd')](_0x578a24+':'+_0x4ca9ba['id'],_0x4ca9ba);SmsInteractionEvents[_0x5343('0xd')](_0x578a24,_0x4ca9ba);_0x28f0f3(null);})['catch'](_0x28f0f3(null));};}for(var e in events){if(events[_0x5343('0xe')](e)){var event=events[e];SmsInteraction[_0x5343('0xf')](e,emitEvent(event));}}module[_0x5343('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c616789..60cdaa0 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 _0x7c6b=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x7c6b,0x9b));var _0xb7c6=function(_0x4bb234,_0x105f9b){_0x4bb234=_0x4bb234-0x0;var _0x2f2db7=_0x7c6b[_0x4bb234];return _0x2f2db7;};'use strict';var _=require(_0xb7c6('0x0'));var util=require(_0xb7c6('0x1'));var logger=require(_0xb7c6('0x2'))('api');var moment=require(_0xb7c6('0x3'));var BPromise=require(_0xb7c6('0x4'));var rp=require(_0xb7c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7c6('0x6'));var config=require(_0xb7c6('0x7'));var attributes=require(_0xb7c6('0x8'));module[_0xb7c6('0x9')]=function(_0x509c1e,_0x475e4b){return _0x509c1e[_0xb7c6('0xa')](_0xb7c6('0xb'),attributes,{'tableName':_0xb7c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x311e29,_0x682626,_0x40edf2){if(_0x311e29[_0xb7c6('0xd')]('closed')){_0x311e29[_0xb7c6('0xe')]=moment()[_0xb7c6('0xf')](_0xb7c6('0x10'));}_0x40edf2(null,_0x311e29);}}});}; \ No newline at end of file +var _0xc321=['SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x36695f,_0x283fdb){var _0x256717=function(_0x5aa5af){while(--_0x5aa5af){_0x36695f['push'](_0x36695f['shift']());}};_0x256717(++_0x283fdb);}(_0xc321,0x1c6));var _0x1c32=function(_0x590fef,_0x5e678a){_0x590fef=_0x590fef-0x0;var _0x12d344=_0xc321[_0x590fef];return _0x12d344;};'use strict';var _=require(_0x1c32('0x0'));var util=require(_0x1c32('0x1'));var logger=require(_0x1c32('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c32('0x3'));var rp=require(_0x1c32('0x4'));var fs=require('fs');var path=require(_0x1c32('0x5'));var rimraf=require('rimraf');var config=require(_0x1c32('0x6'));var attributes=require(_0x1c32('0x7'));module[_0x1c32('0x8')]=function(_0x50149e,_0x415f64){return _0x50149e[_0x1c32('0x9')](_0x1c32('0xa'),attributes,{'tableName':_0x1c32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22f3a3,_0x4456e7,_0x56eca5){if(_0x22f3a3[_0x1c32('0xc')]('closed')){_0x22f3a3[_0x1c32('0xd')]=moment()[_0x1c32('0xe')](_0x1c32('0xf'));}_0x56eca5(null,_0x22f3a3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 1ed38f4..1f28d24 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 _0x2c8d=['error','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags','debug','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','message'];(function(_0x59bd2d,_0x307929){var _0x572487=function(_0x217fec){while(--_0x217fec){_0x59bd2d['push'](_0x59bd2d['shift']());}};_0x572487(++_0x307929);}(_0x2c8d,0xf1));var _0xd2c8=function(_0x12b80f,_0x561bd1){_0x12b80f=_0x12b80f-0x0;var _0xa3c80f=_0x2c8d[_0x12b80f];return _0xa3c80f;};'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(_0xd2c8('0x0'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd2c8('0x1'));var config=require(_0xd2c8('0x2'));var jayson=require(_0xd2c8('0x3'));var client=jayson['client'][_0xd2c8('0x4')]({'port':0x232a});config[_0xd2c8('0x5')]=_[_0xd2c8('0x6')](config[_0xd2c8('0x5')],{'host':_0xd2c8('0x7'),'port':0x18eb});var socket=require(_0xd2c8('0x8'))(new Redis(config[_0xd2c8('0x5')]));require(_0xd2c8('0x9'))[_0xd2c8('0xa')](socket);function respondWithRpcPromise(_0x349012,_0xc8e82e,_0x221897){return new BPromise(function(_0x4e68f5,_0xde743d){return client[_0xd2c8('0xb')](_0x349012,_0x221897)[_0xd2c8('0xc')](function(_0x4a435e){logger['info'](_0xd2c8('0xd'),_0xc8e82e,_0xd2c8('0xe'));logger['debug'](_0xd2c8('0xf'),_0xc8e82e,'request\x20sent',JSON[_0xd2c8('0x10')](_0x4a435e));if(_0x4a435e['error']){if(_0x4a435e['error']['code']===0x1f4){logger['error'](_0xd2c8('0xd'),_0xc8e82e,_0x4a435e['error'][_0xd2c8('0x11')]);return _0xde743d(_0x4a435e[_0xd2c8('0x12')][_0xd2c8('0x11')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0xc8e82e,_0x4a435e['error'][_0xd2c8('0x11')]);return _0x4e68f5(_0x4a435e['error']['message']);}else{logger[_0xd2c8('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xc8e82e,'request\x20sent');_0x4e68f5(_0x4a435e[_0xd2c8('0x14')]['message']);}})[_0xd2c8('0x15')](function(_0x164c8d){logger[_0xd2c8('0x12')](_0xd2c8('0xd'),_0xc8e82e,_0x164c8d);_0xde743d(_0x164c8d);});});}exports[_0xd2c8('0x16')]=function(_0x5aa923){var _0x195548=this;return new Promise(function(_0x526029,_0x50910f){return db[_0xd2c8('0x17')][_0xd2c8('0x18')](_0x5aa923[_0xd2c8('0x19')],{'raw':_0x5aa923['options']?_0x5aa923[_0xd2c8('0x1a')][_0xd2c8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aa923[_0xd2c8('0x1a')]?_0x5aa923[_0xd2c8('0x1a')][_0xd2c8('0x1c')]||null:null,'attributes':_0x5aa923['options']?_0x5aa923[_0xd2c8('0x1a')][_0xd2c8('0x1d')]||null:null,'limit':_0x5aa923[_0xd2c8('0x1a')]?_0x5aa923[_0xd2c8('0x1a')][_0xd2c8('0x1e')]||null:null})[_0xd2c8('0xc')](function(_0x3bdc82){logger['info'](_0xd2c8('0x16'),_0x5aa923);logger['debug']('UpdateSmsInteraction',_0x5aa923,JSON[_0xd2c8('0x10')](_0x3bdc82));_0x526029(_0x3bdc82);})[_0xd2c8('0x15')](function(_0x1a1635){logger[_0xd2c8('0x12')]('UpdateSmsInteraction',_0x1a1635[_0xd2c8('0x11')],_0x5aa923);_0x50910f(_0x195548[_0xd2c8('0x12')](0x1f4,_0x1a1635[_0xd2c8('0x11')]));});});};exports['AddTagsToSmsInteraction']=function(_0x531186){return new Promise(function(_0xfc62bc,_0x1a40ff){return db[_0xd2c8('0x17')][_0xd2c8('0x1f')]({'where':_0x531186['options']?_0x531186['options'][_0xd2c8('0x1c')]||null:null})['then'](function(_0x2bd26e){if(_0x2bd26e){return _0x2bd26e['addTags'](_0x531186[_0xd2c8('0x19')][_0xd2c8('0x20')],_[_0xd2c8('0x21')](_0x531186['body'],[_0xd2c8('0x20'),'id'])||{});}})[_0xd2c8('0x22')](function(_0x2369f8){logger['info'](_0xd2c8('0x23'),_0x531186);logger[_0xd2c8('0x24')]('AddTags',_0x531186,JSON[_0xd2c8('0x10')](_0x2369f8));_0xfc62bc(_0x2369f8);})[_0xd2c8('0x15')](function(_0x42c8ac){logger[_0xd2c8('0x12')]('AddTags',_0x42c8ac['message'],_0x531186);_0x1a40ff(_this[_0xd2c8('0x12')](0x1f4,_0x42c8ac[_0xd2c8('0x11')]));});});}; \ No newline at end of file +var _0xe414=['SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','SmsInteraction','body','options','raw','where','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x580268,_0x20265a){var _0x1254f6=function(_0x57147d){while(--_0x57147d){_0x580268['push'](_0x580268['shift']());}};_0x1254f6(++_0x20265a);}(_0xe414,0x8f));var _0x4e41=function(_0x12e095,_0x166f6a){_0x12e095=_0x12e095-0x0;var _0xb33507=_0xe414[_0x12e095];return _0xb33507;};'use strict';var _=require(_0x4e41('0x0'));var util=require(_0x4e41('0x1'));var moment=require(_0x4e41('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e41('0x3'));var fs=require('fs');var Redis=require(_0x4e41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e41('0x5'));var logger=require(_0x4e41('0x6'))(_0x4e41('0x7'));var config=require(_0x4e41('0x8'));var jayson=require(_0x4e41('0x9'));var client=jayson['client'][_0x4e41('0xa')]({'port':0x232a});config[_0x4e41('0xb')]=_[_0x4e41('0xc')](config[_0x4e41('0xb')],{'host':_0x4e41('0xd'),'port':0x18eb});var socket=require(_0x4e41('0xe'))(new Redis(config[_0x4e41('0xb')]));require(_0x4e41('0xf'))[_0x4e41('0x10')](socket);function respondWithRpcPromise(_0x3f6593,_0x5ef7fc,_0x5a2c49){return new BPromise(function(_0xbb7556,_0x5d85c6){return client['request'](_0x3f6593,_0x5a2c49)['then'](function(_0x3c59db){logger[_0x4e41('0x11')](_0x4e41('0x12'),_0x5ef7fc,_0x4e41('0x13'));logger[_0x4e41('0x14')](_0x4e41('0x15'),_0x5ef7fc,'request\x20sent',JSON['stringify'](_0x3c59db));if(_0x3c59db[_0x4e41('0x16')]){if(_0x3c59db[_0x4e41('0x16')][_0x4e41('0x17')]===0x1f4){logger[_0x4e41('0x16')](_0x4e41('0x12'),_0x5ef7fc,_0x3c59db[_0x4e41('0x16')][_0x4e41('0x18')]);return _0x5d85c6(_0x3c59db[_0x4e41('0x16')]['message']);}logger['error'](_0x4e41('0x12'),_0x5ef7fc,_0x3c59db[_0x4e41('0x16')]['message']);return _0xbb7556(_0x3c59db[_0x4e41('0x16')]['message']);}else{logger[_0x4e41('0x11')](_0x4e41('0x12'),_0x5ef7fc,_0x4e41('0x13'));_0xbb7556(_0x3c59db['result']['message']);}})[_0x4e41('0x19')](function(_0x21eba0){logger[_0x4e41('0x16')](_0x4e41('0x12'),_0x5ef7fc,_0x21eba0);_0x5d85c6(_0x21eba0);});});}exports['UpdateSmsInteraction']=function(_0x2b784c){var _0x4041d1=this;return new Promise(function(_0x57376f,_0x10be8b){return db[_0x4e41('0x1a')]['update'](_0x2b784c[_0x4e41('0x1b')],{'raw':_0x2b784c['options']?_0x2b784c[_0x4e41('0x1c')][_0x4e41('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b784c['options']?_0x2b784c[_0x4e41('0x1c')][_0x4e41('0x1e')]||null:null,'attributes':_0x2b784c[_0x4e41('0x1c')]?_0x2b784c['options']['attributes']||null:null,'limit':_0x2b784c[_0x4e41('0x1c')]?_0x2b784c['options'][_0x4e41('0x1f')]||null:null})[_0x4e41('0x20')](function(_0x76a68e){logger[_0x4e41('0x11')](_0x4e41('0x21'),_0x2b784c);logger['debug'](_0x4e41('0x21'),_0x2b784c,JSON['stringify'](_0x76a68e));_0x57376f(_0x76a68e);})[_0x4e41('0x19')](function(_0x159130){logger['error'](_0x4e41('0x21'),_0x159130[_0x4e41('0x18')],_0x2b784c);_0x10be8b(_0x4041d1['error'](0x1f4,_0x159130[_0x4e41('0x18')]));});});};exports[_0x4e41('0x22')]=function(_0x7ddf4b){return new Promise(function(_0x29fe4c,_0x1af72f){return db[_0x4e41('0x1a')][_0x4e41('0x23')]({'where':_0x7ddf4b['options']?_0x7ddf4b['options'][_0x4e41('0x1e')]||null:null})[_0x4e41('0x20')](function(_0x4575c3){if(_0x4575c3){return _0x4575c3[_0x4e41('0x24')](_0x7ddf4b['body'][_0x4e41('0x25')],_['omit'](_0x7ddf4b[_0x4e41('0x1b')],[_0x4e41('0x25'),'id'])||{});}})[_0x4e41('0x26')](function(_0x44f1bf){logger[_0x4e41('0x11')](_0x4e41('0x27'),_0x7ddf4b);logger[_0x4e41('0x14')]('AddTags',_0x7ddf4b,JSON[_0x4e41('0x28')](_0x44f1bf));_0x29fe4c(_0x44f1bf);})[_0x4e41('0x19')](function(_0x2c702c){logger[_0x4e41('0x16')]('AddTags',_0x2c702c['message'],_0x7ddf4b);_0x1af72f(_this['error'](0x1f4,_0x2c702c[_0x4e41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 886dc5b..a9aadac 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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x517406,_0x4b9434){var _0x476cdc=function(_0x584e68){while(--_0x584e68){_0x517406['push'](_0x517406['shift']());}};_0x476cdc(++_0x4b9434);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb7e7[_0x17d9e3];return _0x14192d;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x31138c,_0x1afd18){var _0x4a9929=function(_0x3ab44f){while(--_0x3ab44f){_0x31138c['push'](_0x31138c['shift']());}};_0x4a9929(++_0x1afd18);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 93f9592..d97912c 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 _0xc633=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/:id','show','tracked','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0xc633,0xd4));var _0x3c63=function(_0x4c9f70,_0x53990b){_0x4c9f70=_0x4c9f70-0x0;var _0x3b1dd9=_0xc633[_0x4c9f70];return _0x3b1dd9;};'use strict';var multer=require(_0x3c63('0x0'));var util=require(_0x3c63('0x1'));var path=require(_0x3c63('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c63('0x3'));var router=express[_0x3c63('0x4')]();var auth=require(_0x3c63('0x5'));var interaction=require(_0x3c63('0x6'));var config=require(_0x3c63('0x7'));var controller=require(_0x3c63('0x8'));router[_0x3c63('0x9')]('/',auth[_0x3c63('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3c63('0x9')](_0x3c63('0xb'),auth['isAuthenticated'](),controller[_0x3c63('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3c63('0xd')]('sms',_0x3c63('0xe')),controller[_0x3c63('0xf')]);router[_0x3c63('0x10')](_0x3c63('0x11'),controller[_0x3c63('0x12')]);router[_0x3c63('0x13')](_0x3c63('0xb'),auth[_0x3c63('0xa')](),controller[_0x3c63('0x14')]);router[_0x3c63('0x13')](_0x3c63('0x15'),auth[_0x3c63('0xa')](),controller[_0x3c63('0x16')]);router[_0x3c63('0x13')](_0x3c63('0x17'),auth[_0x3c63('0xa')](),controller['reject']);router[_0x3c63('0x18')](_0x3c63('0xb'),auth['isAuthenticated'](),controller[_0x3c63('0x19')]);module[_0x3c63('0x1a')]=router; \ No newline at end of file +var _0xa580=['/describe','/:id','show','tracked','smsmessage:create','create','post','/:id/status','put','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x204033,_0x276938){var _0x561428=function(_0x24fdbf){while(--_0x24fdbf){_0x204033['push'](_0x204033['shift']());}};_0x561428(++_0x276938);}(_0xa580,0x1ab));var _0x0a58=function(_0x1901b0,_0x5737a9){_0x1901b0=_0x1901b0-0x0;var _0x587135=_0xa580[_0x1901b0];return _0x587135;};'use strict';var multer=require(_0x0a58('0x0'));var util=require(_0x0a58('0x1'));var path=require(_0x0a58('0x2'));var timeout=require(_0x0a58('0x3'));var express=require(_0x0a58('0x4'));var router=express[_0x0a58('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a58('0x6'));var controller=require(_0x0a58('0x7'));router[_0x0a58('0x8')]('/',auth[_0x0a58('0x9')](),controller['index']);router['get'](_0x0a58('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a58('0x8')](_0x0a58('0xb'),auth[_0x0a58('0x9')](),controller[_0x0a58('0xc')]);router['post']('/',auth[_0x0a58('0x9')](),interaction[_0x0a58('0xd')]('sms',_0x0a58('0xe')),controller[_0x0a58('0xf')]);router[_0x0a58('0x10')](_0x0a58('0x11'),controller['status']);router[_0x0a58('0x12')](_0x0a58('0xb'),auth[_0x0a58('0x9')](),controller['update']);router[_0x0a58('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x0a58('0x12')](_0x0a58('0x13'),auth[_0x0a58('0x9')](),controller[_0x0a58('0x14')]);router[_0x0a58('0x15')](_0x0a58('0xb'),auth[_0x0a58('0x9')](),controller[_0x0a58('0x16')]);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 c224753..91855a8 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 _0x1085=['medium','BOOLEAN','ENUM','STRING','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1085,0x82));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5108('0x0')]={'body':{'type':Sequelize[_0x5108('0x1')](_0x5108('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5108('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5108('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5108('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5108('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5108('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5108('0x1')]}}; \ No newline at end of file +var _0xde3d=['out','STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x2242a1,_0x38f44d){var _0x2c298b=function(_0x4f4246){while(--_0x4f4246){_0x2242a1['push'](_0x2242a1['shift']());}};_0x2c298b(++_0x38f44d);}(_0xde3d,0x1a3));var _0xdde3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde3d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xdde3('0x0'));module[_0xdde3('0x1')]={'body':{'type':Sequelize['TEXT'](_0xdde3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdde3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdde3('0x4')]('in',_0xdde3('0x5')),'defaultValue':_0xdde3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdde3('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdde3('0x6')]},'readAt':{'type':Sequelize[_0xdde3('0x7')]},'secret':{'type':Sequelize[_0xdde3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdde3('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index d2d3c78..ba57f03 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 _0x13cc=['SmsInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','SmsMessage','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','rawAttributes','include','options','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','agent','CmContact','Contact'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x13cc,0xb2));var _0xc13c=function(_0x24681b,_0x31424e){_0x24681b=_0x24681b-0x0;var _0x10d992=_0x13cc[_0x24681b];return _0x10d992;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc13c('0x0'));var rimraf=require(_0xc13c('0x1'));var zipdir=require(_0xc13c('0x2'));var jsonpatch=require(_0xc13c('0x3'));var rp=require(_0xc13c('0x4'));var moment=require(_0xc13c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc13c('0x6'));var util=require(_0xc13c('0x7'));var path=require(_0xc13c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc13c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc13c('0xa'));var jsforce=require(_0xc13c('0xb'));var deskjs=require(_0xc13c('0xc'));var toCsv=require(_0xc13c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc13c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc13c('0xf'));var as=require(_0xc13c('0x10'));var hardwareService=require(_0xc13c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc13c('0x12'));var config=require(_0xc13c('0x13'));var licenseUtil=require(_0xc13c('0x14'));var db=require(_0xc13c('0x15'))['db'];config[_0xc13c('0x16')]=_[_0xc13c('0x17')](config[_0xc13c('0x16')],{'host':_0xc13c('0x18'),'port':0x18eb});var socket=require(_0xc13c('0x19'))(new Redis(config[_0xc13c('0x16')]));require('./smsMessage.socket')[_0xc13c('0x1a')](socket);var jayson=require(_0xc13c('0x1b'));var client=jayson['client'][_0xc13c('0x1c')]({'port':0x232c});var client9002=jayson[_0xc13c('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd0871,_0x5be646,_0xa5c2f4,_0x3d7eed){return new BPromise(function(_0xf9eeeb,_0x5e3a16){var _0x428efd=_0x3d7eed||client;return _0x428efd[_0xc13c('0x1e')](_0xcd0871,_0xa5c2f4)['then'](function(_0x56c99f){logger[_0xc13c('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x5be646,'request\x20sent');logger[_0xc13c('0x20')](_0xc13c('0x21'),_0x5be646,_0xc13c('0x22'),JSON['stringify'](_0x56c99f));if(_0x56c99f[_0xc13c('0x23')]){if(_0x56c99f[_0xc13c('0x23')][_0xc13c('0x24')]===0x1f4){logger[_0xc13c('0x23')](_0xc13c('0x25'),_0x5be646,_0x56c99f[_0xc13c('0x23')][_0xc13c('0x26')]);return _0x5e3a16(_0x56c99f[_0xc13c('0x23')][_0xc13c('0x26')]);}logger[_0xc13c('0x23')]('SmsMessage,\x20%s,\x20%s',_0x5be646,_0x56c99f[_0xc13c('0x23')]['message']);return _0xf9eeeb(_0x56c99f[_0xc13c('0x23')][_0xc13c('0x26')]);}else{logger[_0xc13c('0x1f')](_0xc13c('0x25'),_0x5be646,_0xc13c('0x22'));_0xf9eeeb(_0x56c99f['result'][_0xc13c('0x26')]);}})[_0xc13c('0x27')](function(_0x16f879){logger[_0xc13c('0x23')]('SmsMessage,\x20%s,\x20%s',_0x5be646,_0x16f879);_0x5e3a16(_0x16f879);});});}function respondWithStatusCode(_0x4f73d5,_0x518dd8){_0x518dd8=_0x518dd8||0xcc;return function(_0x271042){if(_0x271042){return _0x4f73d5[_0xc13c('0x28')](_0x518dd8);}return _0x4f73d5[_0xc13c('0x29')](_0x518dd8)[_0xc13c('0x2a')]();};}function respondWithResult(_0x302803,_0x525940){_0x525940=_0x525940||0xc8;return function(_0x7bdbb9){if(_0x7bdbb9){return _0x302803['status'](_0x525940)[_0xc13c('0x2b')](_0x7bdbb9);}};}function respondWithFilteredResult(_0x37ef38,_0x19c28d){return function(_0x1fb660){if(_0x1fb660){var _0x7cbce0=_0x1fb660['count'],_0x264386=_0x19c28d[_0xc13c('0x2c')],_0x7d405f=_0x19c28d[_0xc13c('0x2c')]+_0x19c28d[_0xc13c('0x2d')],_0x330c02;if(_0x7d405f>=_0x7cbce0){_0x7d405f=_0x7cbce0;_0x330c02=0xc8;}else{_0x330c02=0xce;}_0x37ef38[_0xc13c('0x29')](_0x330c02);return _0x37ef38[_0xc13c('0x2e')](_0xc13c('0x2f'),_0x264386+'-'+_0x7d405f+'/'+_0x7cbce0)[_0xc13c('0x2b')](_0x1fb660);}return null;};}function patchUpdates(_0x5b184e){return function(_0x575687){try{jsonpatch[_0xc13c('0x30')](_0x575687,_0x5b184e,!![]);}catch(_0x6c23fb){return BPromise[_0xc13c('0x31')](_0x6c23fb);}return _0x575687[_0xc13c('0x32')]();};}function saveUpdates(_0x2ef31a,_0x11f92f){return function(_0x20b890){if(_0x20b890){return _0x20b890[_0xc13c('0x33')](_0x2ef31a)[_0xc13c('0x34')](function(_0x2c8a06){return _0x2c8a06;});}return null;};}function removeEntity(_0x402af9,_0x3755df){return function(_0x2b4bd7){if(_0x2b4bd7){return _0x2b4bd7[_0xc13c('0x35')]()['then'](function(){_0x402af9[_0xc13c('0x29')](0xcc)[_0xc13c('0x2a')]();});}};}function handleEntityNotFound(_0x17d4d9,_0x83d024){return function(_0x1e1771){if(!_0x1e1771){_0x17d4d9['sendStatus'](0x194);}return _0x1e1771;};}function handleError(_0x4a943b,_0x16fbf8){_0x16fbf8=_0x16fbf8||0x1f4;return function(_0x233755){logger[_0xc13c('0x23')](_0x233755['stack']);if(_0x233755[_0xc13c('0x36')]){delete _0x233755[_0xc13c('0x36')];}_0x4a943b[_0xc13c('0x29')](_0x16fbf8)[_0xc13c('0x37')](_0x233755);};}exports['index']=function(_0x551dba,_0x2747b6){var _0x131ded={},_0x51c3ed={},_0x36b29b={'count':0x0,'rows':[]};var _0x46777a=_[_0xc13c('0x38')](db[_0xc13c('0x39')]['rawAttributes'],function(_0x1fe007){return{'name':_0x1fe007['fieldName'],'type':_0x1fe007[_0xc13c('0x3a')][_0xc13c('0x3b')]};});_0x51c3ed[_0xc13c('0x3c')]=_[_0xc13c('0x38')](_0x46777a,_0xc13c('0x36'));_0x51c3ed[_0xc13c('0x3d')]=_['keys'](_0x551dba[_0xc13c('0x3d')]);_0x51c3ed[_0xc13c('0x3e')]=_[_0xc13c('0x3f')](_0x51c3ed['model'],_0x51c3ed['query']);_0x131ded['attributes']=_['intersection'](_0x51c3ed[_0xc13c('0x3c')],qs[_0xc13c('0x40')](_0x551dba['query'][_0xc13c('0x40')]));_0x131ded['attributes']=_0x131ded[_0xc13c('0x41')]['length']?_0x131ded[_0xc13c('0x41')]:_0x51c3ed[_0xc13c('0x3c')];if(!_0x551dba[_0xc13c('0x3d')][_0xc13c('0x42')](_0xc13c('0x43'))){_0x131ded[_0xc13c('0x2d')]=qs[_0xc13c('0x2d')](_0x551dba['query'][_0xc13c('0x2d')]);_0x131ded[_0xc13c('0x2c')]=qs['offset'](_0x551dba[_0xc13c('0x3d')]['offset']);}_0x131ded['order']=qs[_0xc13c('0x44')](_0x551dba[_0xc13c('0x3d')]['sort']);_0x131ded[_0xc13c('0x45')]=qs[_0xc13c('0x3e')](_[_0xc13c('0x46')](_0x551dba[_0xc13c('0x3d')],_0x51c3ed[_0xc13c('0x3e')]),_0x46777a);if(_0x551dba[_0xc13c('0x3d')][_0xc13c('0x47')]){_0x131ded[_0xc13c('0x45')]=_['merge'](_0x131ded['where'],{'$or':_[_0xc13c('0x38')](_0x46777a,function(_0x183e2d){if(_0x183e2d[_0xc13c('0x3a')]!==_0xc13c('0x48')){var _0x315828={};_0x315828[_0x183e2d[_0xc13c('0x36')]]={'$like':'%'+_0x551dba['query'][_0xc13c('0x47')]+'%'};return _0x315828;}})});}_0x131ded=_[_0xc13c('0x49')]({},_0x131ded,_0x551dba['options']);var _0x2c5b4f={'where':_0x131ded[_0xc13c('0x45')]};return db['SmsMessage']['count'](_0x2c5b4f)[_0xc13c('0x34')](function(_0x4e331b){_0x36b29b['count']=_0x4e331b;if(_0x551dba[_0xc13c('0x3d')][_0xc13c('0x4a')]){_0x131ded['include']=[{'all':!![]}];}return db['SmsMessage'][_0xc13c('0x4b')](_0x131ded);})[_0xc13c('0x34')](function(_0x344eb1){_0x36b29b[_0xc13c('0x4c')]=_0x344eb1;return _0x36b29b;})[_0xc13c('0x34')](respondWithFilteredResult(_0x2747b6,_0x131ded))[_0xc13c('0x27')](handleError(_0x2747b6,null));};exports[_0xc13c('0x4d')]=function(_0x536a7a,_0x3614ec){var _0x14a32a={'raw':!![],'where':{'id':_0x536a7a[_0xc13c('0x4e')]['id']}},_0x4f342f={};_0x4f342f[_0xc13c('0x3c')]=_[_0xc13c('0x4f')](db[_0xc13c('0x39')][_0xc13c('0x50')]);_0x4f342f[_0xc13c('0x3d')]=_['keys'](_0x536a7a['query']);_0x4f342f[_0xc13c('0x3e')]=_[_0xc13c('0x3f')](_0x4f342f[_0xc13c('0x3c')],_0x4f342f['query']);_0x14a32a['attributes']=_['intersection'](_0x4f342f[_0xc13c('0x3c')],qs['fields'](_0x536a7a[_0xc13c('0x3d')]['fields']));_0x14a32a[_0xc13c('0x41')]=_0x14a32a[_0xc13c('0x41')]['length']?_0x14a32a['attributes']:_0x4f342f[_0xc13c('0x3c')];if(_0x536a7a[_0xc13c('0x3d')]['includeAll']){_0x14a32a[_0xc13c('0x51')]=[{'all':!![]}];}_0x14a32a=_[_0xc13c('0x49')]({},_0x14a32a,_0x536a7a[_0xc13c('0x52')]);return db['SmsMessage'][_0xc13c('0x53')](_0x14a32a)[_0xc13c('0x34')](handleEntityNotFound(_0x3614ec,null))[_0xc13c('0x34')](respondWithResult(_0x3614ec,null))[_0xc13c('0x27')](handleError(_0x3614ec,null));};exports[_0xc13c('0x54')]=function(_0x4bd696,_0xbd4aa1){return db[_0xc13c('0x39')][_0xc13c('0x54')](_0x4bd696[_0xc13c('0x55')],{})[_0xc13c('0x34')](respondWithResult(_0xbd4aa1,0xc9))['catch'](handleError(_0xbd4aa1,null));};exports['update']=function(_0x5c9a84,_0x1855ad){if(_0x5c9a84[_0xc13c('0x55')]['id']){delete _0x5c9a84[_0xc13c('0x55')]['id'];}return db['SmsMessage'][_0xc13c('0x53')]({'where':{'id':_0x5c9a84[_0xc13c('0x4e')]['id']}})[_0xc13c('0x34')](handleEntityNotFound(_0x1855ad,null))[_0xc13c('0x34')](saveUpdates(_0x5c9a84[_0xc13c('0x55')],null))[_0xc13c('0x34')](respondWithResult(_0x1855ad,null))[_0xc13c('0x27')](handleError(_0x1855ad,null));};exports[_0xc13c('0x35')]=function(_0x487daf,_0x21bdcd){return db[_0xc13c('0x39')][_0xc13c('0x53')]({'where':{'id':_0x487daf[_0xc13c('0x4e')]['id']}})[_0xc13c('0x34')](handleEntityNotFound(_0x21bdcd,null))['then'](removeEntity(_0x21bdcd,null))['catch'](handleError(_0x21bdcd,null));};exports[_0xc13c('0x56')]=function(_0x5ca741,_0x33d10d){return db[_0xc13c('0x39')][_0xc13c('0x56')]()[_0xc13c('0x34')](respondWithResult(_0x33d10d,null))[_0xc13c('0x27')](handleError(_0x33d10d,null));};var interaction_log=require(_0xc13c('0x57'))(_0xc13c('0x58'));exports[_0xc13c('0x59')]=function(_0x11ce6a,_0x19ab70,_0x358ca7){var _0x293b20={'agent':{},'channel':_0xc13c('0x5a')};if(_0x11ce6a[_0xc13c('0x55')]['id']){delete _0x11ce6a[_0xc13c('0x55')]['id'];}_0x11ce6a['body'][_0xc13c('0x5b')]=!![];_0x11ce6a['body'][_0xc13c('0x5c')]=moment()[_0xc13c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x11ce6a[_0xc13c('0x55')][_0xc13c('0x5e')]=_0x11ce6a[_0xc13c('0x55')][_0xc13c('0x5e')]||_0x11ce6a['user']['id'];_0x293b20[_0xc13c('0x5f')]['id']=_0x11ce6a[_0xc13c('0x55')][_0xc13c('0x5e')];return db[_0xc13c('0x39')]['find']({'where':{'id':_0x11ce6a[_0xc13c('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0xc13c('0x60')],'as':_0xc13c('0x61')}]})[_0xc13c('0x34')](handleEntityNotFound(_0x19ab70,null))['then'](saveUpdates(_0x11ce6a['body'],null))[_0xc13c('0x34')](function(_0x11e208){if(_0x11e208){_0x293b20[_0xc13c('0x26')]=_0x11e208['get']({'plain':!![]});return db[_0xc13c('0x62')]['find']({'where':{'id':_0x11e208['SmsInteractionId']}});}return null;})[_0xc13c('0x34')](handleEntityNotFound(_0x19ab70,null))[_0xc13c('0x34')](function(_0x4c3608){if(_0x4c3608){return _0x4c3608[_0xc13c('0x33')]({'UserId':_0x11ce6a[_0xc13c('0x55')][_0xc13c('0x5e')],'read1stAt':_['isNil'](_0x4c3608[_0xc13c('0x63')])?moment()[_0xc13c('0x5d')](_0xc13c('0x64')):undefined});}return null;})[_0xc13c('0x34')](function(_0x771113){if(_0x771113){_0x293b20['interaction']=_0x771113[_0xc13c('0x65')]({'plain':!![]});interaction_log[_0xc13c('0x1f')](_0xc13c('0x66'),_0x11ce6a['user']['id'],_0x11ce6a['user']['name'],_0x11ce6a[_0xc13c('0x67')][_0xc13c('0x68')],_0x293b20['interaction']['id'],_0x11ce6a['body']?JSON[_0xc13c('0x69')](_0x11ce6a['body']):_0xc13c('0x6a'));return respondWithRpcPromise(_0xc13c('0x6b'),_0xc13c('0x6c'),_0x293b20);}return null;})[_0xc13c('0x34')](function(_0xce7a6a){if(_0xce7a6a){if(_0x11ce6a[_0xc13c('0x55')][_0xc13c('0x6d')]){_0x293b20[_0xc13c('0x26')]['interface']=util[_0xc13c('0x5d')](_0xc13c('0x6e'),_0x11ce6a[_0xc13c('0x67')][_0xc13c('0x36')]);_0x293b20[_0xc13c('0x26')][_0xc13c('0x6f')]=_0x293b20[_0xc13c('0x6f')];_0x293b20[_0xc13c('0x26')][_0xc13c('0x70')]=_0xc13c('0x59');return respondWithRpcPromise(_0xc13c('0x71'),'EventManager',{'event':_0xc13c('0x72'),'message':_0x293b20[_0xc13c('0x26')]},client9002)['then'](function(){return _0x293b20;});}return _0x293b20;}return null;})['then'](respondWithResult(_0x19ab70,null))[_0xc13c('0x27')](handleError(_0x19ab70,null));};var interaction_log=require(_0xc13c('0x57'))(_0xc13c('0x58'));exports['reject']=function(_0x343202,_0x1d2f61,_0x371704){var _0x525ce5={'agent':{},'channel':_0xc13c('0x5a')};if(_0x343202[_0xc13c('0x55')]['id']){delete _0x343202['body']['id'];}_0x343202['body']['UserId']=_0x343202[_0xc13c('0x55')][_0xc13c('0x5e')]||_0x343202[_0xc13c('0x67')]['id'];_0x525ce5['agent']['id']=_0x343202[_0xc13c('0x55')][_0xc13c('0x5e')];return db['SmsMessage'][_0xc13c('0x53')]({'where':{'id':_0x343202['params']['id'],'UserId':null}})[_0xc13c('0x34')](handleEntityNotFound(_0x1d2f61,null))[_0xc13c('0x34')](function(_0x4f6b24){if(_0x4f6b24){_0x525ce5[_0xc13c('0x26')]=_0x4f6b24[_0xc13c('0x65')]({'plain':!![]});return db[_0xc13c('0x62')][_0xc13c('0x53')]({'where':{'id':_0x4f6b24['SmsInteractionId']}});}return null;})[_0xc13c('0x34')](handleEntityNotFound(_0x1d2f61,null))[_0xc13c('0x34')](function(_0x11954e){if(_0x11954e){_0x525ce5[_0xc13c('0x73')]=_0x11954e['get']({'plain':!![]});interaction_log[_0xc13c('0x1f')](_0xc13c('0x74'),_0x343202[_0xc13c('0x67')]['id'],_0x343202[_0xc13c('0x67')][_0xc13c('0x36')],_0x343202[_0xc13c('0x67')][_0xc13c('0x68')],_0x525ce5[_0xc13c('0x73')]['id'],_0x343202['body']?JSON['stringify'](_0x343202['body']):_0xc13c('0x6a'));return respondWithRpcPromise(_0xc13c('0x75'),_0xc13c('0x76'),_0x525ce5);}return null;})[_0xc13c('0x34')](function(_0x5dae6d){if(_0x5dae6d){_0x5dae6d[_0xc13c('0x26')][_0xc13c('0x77')]=util[_0xc13c('0x5d')](_0xc13c('0x6e'),_0x343202['user']['name']);_0x5dae6d[_0xc13c('0x26')]['channel']=_0x525ce5['channel'];_0x5dae6d[_0xc13c('0x26')][_0xc13c('0x70')]='reject';respondWithRpcPromise(_0xc13c('0x71'),_0xc13c('0x71'),{'event':_0xc13c('0x78'),'message':_0x5dae6d[_0xc13c('0x26')]},client9002);return _0x525ce5;}return null;})[_0xc13c('0x34')](respondWithResult(_0x1d2f61,null))[_0xc13c('0x27')](handleError(_0x1d2f61,null));};exports[_0xc13c('0x29')]=function(_0x24c0bc,_0x10c669,_0xa601e6){if(_0x24c0bc[_0xc13c('0x55')]['id']){delete _0x24c0bc[_0xc13c('0x55')]['id'];}var _0x3a8f92;return db['SmsMessage'][_0xc13c('0x53')]({'where':{'id':_0x24c0bc[_0xc13c('0x4e')]['id']}})[_0xc13c('0x34')](handleEntityNotFound(_0x10c669,null))[_0xc13c('0x34')](function(_0x89d75){if(_0x89d75){_0x3a8f92=_0x89d75;return db[_0xc13c('0x79')][_0xc13c('0x53')]({'where':{'id':_0x89d75[_0xc13c('0x7a')]}});}})[_0xc13c('0x34')](handleEntityNotFound(_0x10c669,null))[_0xc13c('0x34')](function(_0x995a9b){if(_0x995a9b){logger[_0xc13c('0x20')](_0xc13c('0x21'),_0xc13c('0x29'),'received\x20delivery\x20report\x20from',_0x995a9b['type'],util[_0xc13c('0x7b')](_0x24c0bc['body'],{'showHidden':![],'depth':null}));switch(_0x995a9b[_0xc13c('0x3a')]){case _0xc13c('0x7c'):if(_0x24c0bc[_0xc13c('0x55')][_0xc13c('0x7d')]&&_0x24c0bc[_0xc13c('0x55')][_0xc13c('0x7d')]===_0x3a8f92[_0xc13c('0x7e')]){return _0x3a8f92[_0xc13c('0x33')]({'read':!![]});}else{logger['error'](_0xc13c('0x7f'),_0xc13c('0x29'),_0xc13c('0x7c'),util['inspect'](_0x24c0bc[_0xc13c('0x55')],{'showHidden':![],'depth':null}));}break;case _0xc13c('0x80'):if(_0x24c0bc[_0xc13c('0x55')]['MessageUUID']&&_0x24c0bc[_0xc13c('0x55')]['MessageUUID']===_0x3a8f92[_0xc13c('0x7e')]&&_[_0xc13c('0x81')]([_0xc13c('0x82'),_0xc13c('0x83')],_0x24c0bc[_0xc13c('0x55')][_0xc13c('0x84')])>=0x0){return _0x3a8f92[_0xc13c('0x33')]({'read':!![]});}else{logger[_0xc13c('0x23')](_0xc13c('0x7f'),_0xc13c('0x29'),_0xc13c('0x85'),util['inspect'](_0x24c0bc[_0xc13c('0x55')],{'showHidden':![],'depth':null}));}break;case _0xc13c('0x86'):var _0x1acda7=_0x24c0bc['body'][_0xc13c('0x87')][0x0];if(_0x1acda7[_0xc13c('0x29')][_0xc13c('0x88')]===_0xc13c('0x89')){return _0x3a8f92['update']({'read':!![]});}else{logger[_0xc13c('0x23')](_0xc13c('0x7f'),'status',_0xc13c('0x86'),util[_0xc13c('0x7b')](_0x24c0bc[_0xc13c('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x3a8f92;}})['then'](respondWithResult(_0x10c669,null))[_0xc13c('0x27')](handleError(_0x10c669,null));}; \ No newline at end of file +var _0x0da5=['MessageUUID','messageId','indexOf','delivered','Status','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','status','set','apply','reject','save','stack','name','send','map','SmsMessage','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','destroy','../../config/logger','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','interface','channel','EventManager','agent','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','update','SmsAccount,\x20%s,\x20%s,\x20%s','plivo'];(function(_0x32765b,_0xa49238){var _0x2824d5=function(_0x2e3be1){while(--_0x2e3be1){_0x32765b['push'](_0x32765b['shift']());}};_0x2824d5(++_0xa49238);}(_0x0da5,0x198));var _0x50da=function(_0x505f6e,_0x1a23ca){_0x505f6e=_0x505f6e-0x0;var _0x3a570e=_0x0da5[_0x505f6e];return _0x3a570e;};'use strict';var pdf=require(_0x50da('0x0'));var emlformat=require(_0x50da('0x1'));var rimraf=require(_0x50da('0x2'));var zipdir=require(_0x50da('0x3'));var jsonpatch=require(_0x50da('0x4'));var rp=require('request-promise');var moment=require(_0x50da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x50da('0x6'));var util=require(_0x50da('0x7'));var path=require(_0x50da('0x8'));var sox=require('sox');var csv=require(_0x50da('0x9'));var ejs=require(_0x50da('0xa'));var fs=require('fs');var _=require(_0x50da('0xb'));var squel=require(_0x50da('0xc'));var crypto=require(_0x50da('0xd'));var jsforce=require(_0x50da('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x50da('0x9'));var querystring=require(_0x50da('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x50da('0x10'));var qs=require(_0x50da('0x11'));var as=require(_0x50da('0x12'));var hardwareService=require(_0x50da('0x13'));var logger=require('../../config/logger')(_0x50da('0x14'));var utils=require(_0x50da('0x15'));var config=require(_0x50da('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x50da('0x17'))['db'];config[_0x50da('0x18')]=_[_0x50da('0x19')](config['redis'],{'host':_0x50da('0x1a'),'port':0x18eb});var socket=require(_0x50da('0x1b'))(new Redis(config[_0x50da('0x18')]));require(_0x50da('0x1c'))[_0x50da('0x1d')](socket);var jayson=require(_0x50da('0x1e'));var client=jayson[_0x50da('0x1f')][_0x50da('0x20')]({'port':0x232c});var client9002=jayson[_0x50da('0x1f')][_0x50da('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x236b9c,_0x31f4f0,_0x1c0ad3,_0x5ad38f){return new BPromise(function(_0x589990,_0x4d47bc){var _0x43f4e3=_0x5ad38f||client;return _0x43f4e3['request'](_0x236b9c,_0x1c0ad3)[_0x50da('0x21')](function(_0x42bb0b){logger[_0x50da('0x22')](_0x50da('0x23'),_0x31f4f0,_0x50da('0x24'));logger[_0x50da('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x31f4f0,'request\x20sent',JSON[_0x50da('0x26')](_0x42bb0b));if(_0x42bb0b['error']){if(_0x42bb0b[_0x50da('0x27')][_0x50da('0x28')]===0x1f4){logger[_0x50da('0x27')](_0x50da('0x23'),_0x31f4f0,_0x42bb0b['error'][_0x50da('0x29')]);return _0x4d47bc(_0x42bb0b['error']['message']);}logger[_0x50da('0x27')](_0x50da('0x23'),_0x31f4f0,_0x42bb0b[_0x50da('0x27')][_0x50da('0x29')]);return _0x589990(_0x42bb0b[_0x50da('0x27')]['message']);}else{logger['info'](_0x50da('0x23'),_0x31f4f0,_0x50da('0x24'));_0x589990(_0x42bb0b[_0x50da('0x2a')][_0x50da('0x29')]);}})[_0x50da('0x2b')](function(_0x43b2d7){logger[_0x50da('0x27')](_0x50da('0x23'),_0x31f4f0,_0x43b2d7);_0x4d47bc(_0x43b2d7);});});}function respondWithStatusCode(_0x293f23,_0x5a6c8a){_0x5a6c8a=_0x5a6c8a||0xcc;return function(_0x13c716){if(_0x13c716){return _0x293f23[_0x50da('0x2c')](_0x5a6c8a);}return _0x293f23['status'](_0x5a6c8a)[_0x50da('0x2d')]();};}function respondWithResult(_0x5149f8,_0x3d785b){_0x3d785b=_0x3d785b||0xc8;return function(_0x58a10f){if(_0x58a10f){return _0x5149f8['status'](_0x3d785b)[_0x50da('0x2e')](_0x58a10f);}};}function respondWithFilteredResult(_0x3834d4,_0x1c4e28){return function(_0x16be3e){if(_0x16be3e){var _0x38c0d5=_0x16be3e[_0x50da('0x2f')],_0x22463f=_0x1c4e28[_0x50da('0x30')],_0x41c681=_0x1c4e28[_0x50da('0x30')]+_0x1c4e28['limit'],_0x156df5;if(_0x41c681>=_0x38c0d5){_0x41c681=_0x38c0d5;_0x156df5=0xc8;}else{_0x156df5=0xce;}_0x3834d4[_0x50da('0x31')](_0x156df5);return _0x3834d4[_0x50da('0x32')]('Content-Range',_0x22463f+'-'+_0x41c681+'/'+_0x38c0d5)[_0x50da('0x2e')](_0x16be3e);}return null;};}function patchUpdates(_0x215c38){return function(_0x330129){try{jsonpatch[_0x50da('0x33')](_0x330129,_0x215c38,!![]);}catch(_0x2ab86e){return BPromise[_0x50da('0x34')](_0x2ab86e);}return _0x330129[_0x50da('0x35')]();};}function saveUpdates(_0x94deae,_0x20de55){return function(_0x476a85){if(_0x476a85){return _0x476a85['update'](_0x94deae)[_0x50da('0x21')](function(_0x4b67b9){return _0x4b67b9;});}return null;};}function removeEntity(_0x145145,_0x4460ce){return function(_0x57e149){if(_0x57e149){return _0x57e149['destroy']()[_0x50da('0x21')](function(){_0x145145[_0x50da('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf1253,_0x5ac74b){return function(_0xdbac6){if(!_0xdbac6){_0xdf1253[_0x50da('0x2c')](0x194);}return _0xdbac6;};}function handleError(_0x11055b,_0x4eeabf){_0x4eeabf=_0x4eeabf||0x1f4;return function(_0x260c38){logger[_0x50da('0x27')](_0x260c38[_0x50da('0x36')]);if(_0x260c38[_0x50da('0x37')]){delete _0x260c38[_0x50da('0x37')];}_0x11055b['status'](_0x4eeabf)[_0x50da('0x38')](_0x260c38);};}exports['index']=function(_0x3944bb,_0xe891c0){var _0x217e92={},_0x198f2b={},_0x46957b={'count':0x0,'rows':[]};var _0x10b450=_[_0x50da('0x39')](db[_0x50da('0x3a')]['rawAttributes'],function(_0x2c9cd2){return{'name':_0x2c9cd2['fieldName'],'type':_0x2c9cd2[_0x50da('0x3b')]['key']};});_0x198f2b['model']=_[_0x50da('0x39')](_0x10b450,_0x50da('0x37'));_0x198f2b[_0x50da('0x3c')]=_[_0x50da('0x3d')](_0x3944bb['query']);_0x198f2b[_0x50da('0x3e')]=_[_0x50da('0x3f')](_0x198f2b[_0x50da('0x40')],_0x198f2b[_0x50da('0x3c')]);_0x217e92[_0x50da('0x41')]=_[_0x50da('0x3f')](_0x198f2b[_0x50da('0x40')],qs[_0x50da('0x42')](_0x3944bb['query']['fields']));_0x217e92[_0x50da('0x41')]=_0x217e92[_0x50da('0x41')][_0x50da('0x43')]?_0x217e92[_0x50da('0x41')]:_0x198f2b[_0x50da('0x40')];if(!_0x3944bb[_0x50da('0x3c')][_0x50da('0x44')](_0x50da('0x45'))){_0x217e92['limit']=qs['limit'](_0x3944bb[_0x50da('0x3c')][_0x50da('0x46')]);_0x217e92[_0x50da('0x30')]=qs[_0x50da('0x30')](_0x3944bb[_0x50da('0x3c')][_0x50da('0x30')]);}_0x217e92[_0x50da('0x47')]=qs[_0x50da('0x48')](_0x3944bb['query']['sort']);_0x217e92[_0x50da('0x49')]=qs['filters'](_['pick'](_0x3944bb[_0x50da('0x3c')],_0x198f2b[_0x50da('0x3e')]),_0x10b450);if(_0x3944bb[_0x50da('0x3c')][_0x50da('0x4a')]){_0x217e92[_0x50da('0x49')]=_[_0x50da('0x4b')](_0x217e92[_0x50da('0x49')],{'$or':_[_0x50da('0x39')](_0x10b450,function(_0x270813){if(_0x270813['type']!=='VIRTUAL'){var _0x550a35={};_0x550a35[_0x270813[_0x50da('0x37')]]={'$like':'%'+_0x3944bb[_0x50da('0x3c')][_0x50da('0x4a')]+'%'};return _0x550a35;}})});}_0x217e92=_[_0x50da('0x4b')]({},_0x217e92,_0x3944bb['options']);var _0x39ae45={'where':_0x217e92[_0x50da('0x49')]};return db[_0x50da('0x3a')][_0x50da('0x2f')](_0x39ae45)[_0x50da('0x21')](function(_0x4ead34){_0x46957b[_0x50da('0x2f')]=_0x4ead34;if(_0x3944bb[_0x50da('0x3c')][_0x50da('0x4c')]){_0x217e92[_0x50da('0x4d')]=[{'all':!![]}];}return db['SmsMessage'][_0x50da('0x4e')](_0x217e92);})[_0x50da('0x21')](function(_0x6b9af5){_0x46957b[_0x50da('0x4f')]=_0x6b9af5;return _0x46957b;})[_0x50da('0x21')](respondWithFilteredResult(_0xe891c0,_0x217e92))[_0x50da('0x2b')](handleError(_0xe891c0,null));};exports[_0x50da('0x50')]=function(_0x34ab34,_0x2c446c){var _0x50243a={'raw':!![],'where':{'id':_0x34ab34['params']['id']}},_0x3fa343={};_0x3fa343[_0x50da('0x40')]=_['keys'](db[_0x50da('0x3a')][_0x50da('0x51')]);_0x3fa343[_0x50da('0x3c')]=_['keys'](_0x34ab34[_0x50da('0x3c')]);_0x3fa343[_0x50da('0x3e')]=_[_0x50da('0x3f')](_0x3fa343['model'],_0x3fa343[_0x50da('0x3c')]);_0x50243a[_0x50da('0x41')]=_[_0x50da('0x3f')](_0x3fa343['model'],qs['fields'](_0x34ab34[_0x50da('0x3c')][_0x50da('0x42')]));_0x50243a[_0x50da('0x41')]=_0x50243a[_0x50da('0x41')][_0x50da('0x43')]?_0x50243a[_0x50da('0x41')]:_0x3fa343[_0x50da('0x40')];if(_0x34ab34[_0x50da('0x3c')][_0x50da('0x4c')]){_0x50243a[_0x50da('0x4d')]=[{'all':!![]}];}_0x50243a=_['merge']({},_0x50243a,_0x34ab34['options']);return db[_0x50da('0x3a')][_0x50da('0x52')](_0x50243a)[_0x50da('0x21')](handleEntityNotFound(_0x2c446c,null))['then'](respondWithResult(_0x2c446c,null))[_0x50da('0x2b')](handleError(_0x2c446c,null));};exports['create']=function(_0x172a45,_0x3768de){return db[_0x50da('0x3a')][_0x50da('0x53')](_0x172a45['body'],{})[_0x50da('0x21')](respondWithResult(_0x3768de,0xc9))[_0x50da('0x2b')](handleError(_0x3768de,null));};exports['update']=function(_0x46053f,_0x58d5b6){if(_0x46053f[_0x50da('0x54')]['id']){delete _0x46053f[_0x50da('0x54')]['id'];}return db[_0x50da('0x3a')][_0x50da('0x52')]({'where':{'id':_0x46053f[_0x50da('0x55')]['id']}})[_0x50da('0x21')](handleEntityNotFound(_0x58d5b6,null))[_0x50da('0x21')](saveUpdates(_0x46053f[_0x50da('0x54')],null))[_0x50da('0x21')](respondWithResult(_0x58d5b6,null))[_0x50da('0x2b')](handleError(_0x58d5b6,null));};exports[_0x50da('0x56')]=function(_0x9cd757,_0x59787e){return db[_0x50da('0x3a')][_0x50da('0x52')]({'where':{'id':_0x9cd757[_0x50da('0x55')]['id']}})[_0x50da('0x21')](handleEntityNotFound(_0x59787e,null))[_0x50da('0x21')](removeEntity(_0x59787e,null))[_0x50da('0x2b')](handleError(_0x59787e,null));};exports['describe']=function(_0x35191a,_0xf13841){return db[_0x50da('0x3a')]['describe']()[_0x50da('0x21')](respondWithResult(_0xf13841,null))['catch'](handleError(_0xf13841,null));};var interaction_log=require(_0x50da('0x57'))(_0x50da('0x58'));exports[_0x50da('0x59')]=function(_0x3f7d80,_0x4763a6,_0x33e60c){var _0x2e9ffe={'agent':{},'channel':_0x50da('0x5a')};if(_0x3f7d80[_0x50da('0x54')]['id']){delete _0x3f7d80[_0x50da('0x54')]['id'];}_0x3f7d80[_0x50da('0x54')][_0x50da('0x5b')]=!![];_0x3f7d80[_0x50da('0x54')][_0x50da('0x5c')]=moment()['format'](_0x50da('0x5d'));_0x3f7d80['body'][_0x50da('0x5e')]=_0x3f7d80[_0x50da('0x54')]['UserId']||_0x3f7d80[_0x50da('0x5f')]['id'];_0x2e9ffe['agent']['id']=_0x3f7d80['body'][_0x50da('0x5e')];return db[_0x50da('0x3a')][_0x50da('0x52')]({'where':{'id':_0x3f7d80[_0x50da('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x50da('0x60')],'as':_0x50da('0x61')}]})[_0x50da('0x21')](handleEntityNotFound(_0x4763a6,null))['then'](saveUpdates(_0x3f7d80[_0x50da('0x54')],null))[_0x50da('0x21')](function(_0x49a5fb){if(_0x49a5fb){_0x2e9ffe[_0x50da('0x29')]=_0x49a5fb[_0x50da('0x62')]({'plain':!![]});return db[_0x50da('0x63')][_0x50da('0x52')]({'where':{'id':_0x49a5fb[_0x50da('0x64')]}});}return null;})[_0x50da('0x21')](handleEntityNotFound(_0x4763a6,null))[_0x50da('0x21')](function(_0x4b9c02){if(_0x4b9c02){return _0x4b9c02['update']({'UserId':_0x3f7d80[_0x50da('0x54')][_0x50da('0x5e')],'read1stAt':_[_0x50da('0x65')](_0x4b9c02[_0x50da('0x66')])?moment()[_0x50da('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x50da('0x21')](function(_0x25e68a){if(_0x25e68a){_0x2e9ffe[_0x50da('0x68')]=_0x25e68a['get']({'plain':!![]});interaction_log[_0x50da('0x22')](_0x50da('0x69'),_0x3f7d80[_0x50da('0x5f')]['id'],_0x3f7d80['user'][_0x50da('0x37')],_0x3f7d80[_0x50da('0x5f')]['role'],_0x2e9ffe[_0x50da('0x68')]['id'],_0x3f7d80[_0x50da('0x54')]?JSON[_0x50da('0x26')](_0x3f7d80['body']):_0x50da('0x6a'));return respondWithRpcPromise(_0x50da('0x6b'),'acceptMessage',_0x2e9ffe);}return null;})[_0x50da('0x21')](function(_0x3e1cad){if(_0x3e1cad){if(_0x3f7d80[_0x50da('0x54')]['manual']){_0x2e9ffe[_0x50da('0x29')][_0x50da('0x6c')]=util[_0x50da('0x67')]('SIP/%s',_0x3f7d80[_0x50da('0x5f')]['name']);_0x2e9ffe[_0x50da('0x29')][_0x50da('0x6d')]=_0x2e9ffe[_0x50da('0x6d')];_0x2e9ffe['message']['event']=_0x50da('0x59');return respondWithRpcPromise(_0x50da('0x6e'),_0x50da('0x6e'),{'event':'acceptmessage','message':_0x2e9ffe['message']},client9002)[_0x50da('0x21')](function(){return _0x2e9ffe;});}return _0x2e9ffe;}return null;})['then'](respondWithResult(_0x4763a6,null))['catch'](handleError(_0x4763a6,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x50da('0x34')]=function(_0x451b10,_0x146739,_0x23b462){var _0x2b6d32={'agent':{},'channel':'sms'};if(_0x451b10[_0x50da('0x54')]['id']){delete _0x451b10[_0x50da('0x54')]['id'];}_0x451b10[_0x50da('0x54')][_0x50da('0x5e')]=_0x451b10[_0x50da('0x54')][_0x50da('0x5e')]||_0x451b10[_0x50da('0x5f')]['id'];_0x2b6d32[_0x50da('0x6f')]['id']=_0x451b10['body'][_0x50da('0x5e')];return db[_0x50da('0x3a')][_0x50da('0x52')]({'where':{'id':_0x451b10['params']['id'],'UserId':null}})[_0x50da('0x21')](handleEntityNotFound(_0x146739,null))[_0x50da('0x21')](function(_0x232855){if(_0x232855){_0x2b6d32[_0x50da('0x29')]=_0x232855[_0x50da('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x50da('0x52')]({'where':{'id':_0x232855[_0x50da('0x64')]}});}return null;})[_0x50da('0x21')](handleEntityNotFound(_0x146739,null))['then'](function(_0x388016){if(_0x388016){_0x2b6d32[_0x50da('0x68')]=_0x388016['get']({'plain':!![]});interaction_log[_0x50da('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x451b10['user']['id'],_0x451b10[_0x50da('0x5f')][_0x50da('0x37')],_0x451b10[_0x50da('0x5f')][_0x50da('0x70')],_0x2b6d32[_0x50da('0x68')]['id'],_0x451b10['body']?JSON[_0x50da('0x26')](_0x451b10[_0x50da('0x54')]):_0x50da('0x6a'));return respondWithRpcPromise(_0x50da('0x71'),_0x50da('0x72'),_0x2b6d32);}return null;})[_0x50da('0x21')](function(_0x13dd74){if(_0x13dd74){_0x13dd74[_0x50da('0x29')]['interface']=util['format'](_0x50da('0x73'),_0x451b10['user'][_0x50da('0x37')]);_0x13dd74[_0x50da('0x29')][_0x50da('0x6d')]=_0x2b6d32[_0x50da('0x6d')];_0x13dd74[_0x50da('0x29')]['event']=_0x50da('0x34');respondWithRpcPromise(_0x50da('0x6e'),_0x50da('0x6e'),{'event':_0x50da('0x74'),'message':_0x13dd74[_0x50da('0x29')]},client9002);return _0x2b6d32;}return null;})[_0x50da('0x21')](respondWithResult(_0x146739,null))[_0x50da('0x2b')](handleError(_0x146739,null));};exports[_0x50da('0x31')]=function(_0x43cff0,_0x296ddc,_0x230b1e){if(_0x43cff0[_0x50da('0x54')]['id']){delete _0x43cff0['body']['id'];}var _0x1c9570;return db['SmsMessage'][_0x50da('0x52')]({'where':{'id':_0x43cff0[_0x50da('0x55')]['id']}})['then'](handleEntityNotFound(_0x296ddc,null))['then'](function(_0x28ca4d){if(_0x28ca4d){_0x1c9570=_0x28ca4d;return db['SmsAccount'][_0x50da('0x52')]({'where':{'id':_0x28ca4d[_0x50da('0x75')]}});}})[_0x50da('0x21')](handleEntityNotFound(_0x296ddc,null))[_0x50da('0x21')](function(_0xf6dca4){if(_0xf6dca4){logger[_0x50da('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0xf6dca4[_0x50da('0x3b')],util[_0x50da('0x76')](_0x43cff0[_0x50da('0x54')],{'showHidden':![],'depth':null}));switch(_0xf6dca4[_0x50da('0x3b')]){case _0x50da('0x77'):if(_0x43cff0[_0x50da('0x54')][_0x50da('0x78')]&&_0x43cff0[_0x50da('0x54')][_0x50da('0x78')]===_0x1c9570['messageId']){return _0x1c9570[_0x50da('0x79')]({'read':!![]});}else{logger[_0x50da('0x27')](_0x50da('0x7a'),_0x50da('0x31'),_0x50da('0x77'),util[_0x50da('0x76')](_0x43cff0[_0x50da('0x54')],{'showHidden':![],'depth':null}));}break;case _0x50da('0x7b'):if(_0x43cff0[_0x50da('0x54')][_0x50da('0x7c')]&&_0x43cff0[_0x50da('0x54')][_0x50da('0x7c')]===_0x1c9570[_0x50da('0x7d')]&&_[_0x50da('0x7e')](['sent',_0x50da('0x7f')],_0x43cff0['body'][_0x50da('0x80')])>=0x0){return _0x1c9570[_0x50da('0x79')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x50da('0x31'),_0x50da('0x81'),util[_0x50da('0x76')](_0x43cff0['body'],{'showHidden':![],'depth':null}));}break;case _0x50da('0x82'):var _0x1f2df6=_0x43cff0[_0x50da('0x54')]['results'][0x0];if(_0x1f2df6[_0x50da('0x31')][_0x50da('0x83')]===_0x50da('0x84')){return _0x1c9570[_0x50da('0x79')]({'read':!![]});}else{logger[_0x50da('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0x50da('0x76')](_0x43cff0['body'],{'showHidden':![],'depth':null}));}break;}return _0x1c9570;}})['then'](respondWithResult(_0x296ddc,null))['catch'](handleError(_0x296ddc,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7345cbb..a65585d 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 _0x727e=['hasOwnProperty','hook','events','../../mysqldb','SmsMessage','save','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x727e,0xfa));var _0xe727=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x727e[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xe727('0x0'));var SmsMessage=require(_0xe727('0x1'))['db'][_0xe727('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe727('0x3'),'afterUpdate':'update','afterDestroy':_0xe727('0x4')};function emitEvent(_0x4d0911){return function(_0x2841e4,_0x1747ee,_0x43c542){SmsMessageEvents[_0xe727('0x5')](_0x4d0911+':'+_0x2841e4['id'],_0x2841e4);SmsMessageEvents[_0xe727('0x5')](_0x4d0911,_0x2841e4);_0x43c542(null);};}for(var e in events){if(events[_0xe727('0x6')](e)){var event=events[e];SmsMessage[_0xe727('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x4510=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','SmsMessage'];(function(_0x23f7ca,_0x3263ea){var _0x131569=function(_0x1dcae0){while(--_0x1dcae0){_0x23f7ca['push'](_0x23f7ca['shift']());}};_0x131569(++_0x3263ea);}(_0x4510,0xcf));var _0x0451=function(_0x446d3d,_0xfa37a3){_0x446d3d=_0x446d3d-0x0;var _0x1bf53d=_0x4510[_0x446d3d];return _0x1bf53d;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x0451('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0451('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0451('0x2'),'afterDestroy':_0x0451('0x3')};function emitEvent(_0x17d65f){return function(_0x10cbfd,_0x3de6d9,_0x60f834){SmsMessageEvents[_0x0451('0x4')](_0x17d65f+':'+_0x10cbfd['id'],_0x10cbfd);SmsMessageEvents[_0x0451('0x4')](_0x17d65f,_0x10cbfd);_0x60f834(null);};}for(var e in events){if(events[_0x0451('0x5')](e)){var event=events[e];SmsMessage[_0x0451('0x6')](e,emitEvent(event));}}module[_0x0451('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d9f55c5..09098cc 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 _0x1b5a=['SmsInteraction','findOne','SmsInteractionId','then','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','username','password','smsMethod','sender','login?username=','&password=','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','keys','length','apiKey','createHash','digest','hex','GET','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','accountId','/messages','applicationId','bandwidth','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId'];(function(_0x350446,_0x317bea){var _0x1af614=function(_0x159fa4){while(--_0x159fa4){_0x350446['push'](_0x350446['shift']());}};_0x1af614(++_0x317bea);}(_0x1b5a,0x156));var _0xa1b5=function(_0x4d93d6,_0x103130){_0x4d93d6=_0x4d93d6-0x0;var _0x1c0ea2=_0x1b5a[_0x4d93d6];return _0x1c0ea2;};'use strict';var _=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var logger=require(_0xa1b5('0x2'))(_0xa1b5('0x3'));var moment=require(_0xa1b5('0x4'));var BPromise=require(_0xa1b5('0x5'));var rp=require(_0xa1b5('0x6'));var fs=require('fs');var path=require(_0xa1b5('0x7'));var rimraf=require(_0xa1b5('0x8'));var config=require(_0xa1b5('0x9'));var attributes=require('./smsMessage.attributes');module[_0xa1b5('0xa')]=function(_0x5091e9,_0xc9710a){return _0x5091e9[_0xa1b5('0xb')](_0xa1b5('0xc'),attributes,{'tableName':_0xa1b5('0xd'),'paranoid':![],'indexes':[{'name':_0xa1b5('0xe'),'fields':[_0xa1b5('0xe')]},{'name':_0xa1b5('0xf'),'fields':[_0xa1b5('0x10')],'type':_0xa1b5('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c9a8b,_0x1d5080,_0x340573){var _0xeb057b=_0x5091e9['models'];var _0x4a9a09=_0x4c9a8b[_0xa1b5('0x12')]({'plain':!![]});if(_0x4a9a09[_0xa1b5('0x13')][_0xa1b5('0x14')]()==='in'||_0x4a9a09['direction']['toLowerCase']()===_0xa1b5('0x15')&&!_0x4a9a09[_0xa1b5('0x16')]&&!_['isNil'](_0x4a9a09[_0xa1b5('0x17')])){_0xeb057b[_0xa1b5('0x18')][_0xa1b5('0x19')]({'where':{'id':_0x4a9a09[_0xa1b5('0x1a')]}})[_0xa1b5('0x1b')](function(_0x2ac19f){if(_0x2ac19f){_0x2ac19f['update']({'lastMsgAt':_0x4a9a09[_0xa1b5('0x1c')],'lastMsgDirection':_0x4a9a09[_0xa1b5('0x13')][_0xa1b5('0x14')]()});}})['catch'](function(_0x1dacf4){console[_0xa1b5('0x1d')](_0x1dacf4);});}if(_0x4a9a09['direction']===_0xa1b5('0x15')&&!_0x4a9a09[_0xa1b5('0x16')]){var _0x346bc7;_0xeb057b[_0xa1b5('0x1e')][_0xa1b5('0x1f')]({'where':{'id':_0x4a9a09[_0xa1b5('0x20')]},'raw':!![]})[_0xa1b5('0x1b')](function(_0x6dee41){_0x346bc7=_0x6dee41;if(_0x346bc7&&_0x346bc7[_0xa1b5('0x21')]){switch(_0x346bc7[_0xa1b5('0x21')]){case _0xa1b5('0x22'):var _0x598f3d=require(_0xa1b5('0x22'));if(_0x346bc7['accountSid']&&_0x346bc7[_0xa1b5('0x23')]&&_0x346bc7['phone']){var _0x471b6a=new _0x598f3d(_0x346bc7['accountSid'],_0x346bc7['authToken']);_0x471b6a[_0xa1b5('0x24')][_0xa1b5('0x25')]({'body':_0x4a9a09['body'],'to':_0x4a9a09[_0xa1b5('0x26')],'from':_0x346bc7[_0xa1b5('0x26')],'statusCallback':_0x346bc7[_0xa1b5('0x27')]+_0xa1b5('0x28')+_0x4a9a09['id']+_0xa1b5('0x29')+_0x346bc7[_0xa1b5('0x2a')]})['then'](function(_0x51350f){if(_0x51350f[_0xa1b5('0x2b')]){return _0x4c9a8b['update']({'messageId':_0x51350f[_0xa1b5('0x2b')]});}})[_0xa1b5('0x2c')](function(_0x9b288f){logger['error'](_0xa1b5('0x2d'),_0xa1b5('0x2e'),'twilio',util[_0xa1b5('0x2f')](_0x9b288f,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1b5('0x2e'),_0xa1b5('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa1b5('0x30'):var _0x46c6e1='https://api.skebby.it/API/v1.0/REST/';if(_0x346bc7[_0xa1b5('0x31')]&&_0x346bc7[_0xa1b5('0x32')]){var _0x84858c={'recipient':[_0x4a9a09[_0xa1b5('0x26')]],'message':_0x4a9a09[_0xa1b5('0x10')],'message_type':_0x346bc7[_0xa1b5('0x33')]};if(_0x346bc7[_0xa1b5('0x33')]&&_0x346bc7[_0xa1b5('0x33')]!=='SI'){_0x84858c[_0xa1b5('0x34')]=_0x346bc7['phone'];}var _0x128dbf={'url':_0x46c6e1+_0xa1b5('0x35')+_0x346bc7[_0xa1b5('0x31')]+_0xa1b5('0x36')+_0x346bc7[_0xa1b5('0x32')],'method':'GET'};rp(_0x128dbf)[_0xa1b5('0x1b')](function(_0x44d4df){var _0x5164fe=_0x44d4df['split'](';');var _0x32847d={'user_key':_0x5164fe[0x0],'session_key':_0x5164fe[0x1]};_0x128dbf={'url':_0x46c6e1+_0xa1b5('0x37'),'method':_0xa1b5('0x38'),'headers':{'user_key':_0x32847d['user_key'],'Session_key':_0x32847d[_0xa1b5('0x39')]},'json':!![],'body':_0x84858c};return rp(_0x128dbf);})[_0xa1b5('0x1b')](function(_0x1120b1){if(_0x1120b1[_0xa1b5('0x3a')]>=0x1){var _0x2d7779={'messageId':_0x1120b1[_0xa1b5('0x3b')]};if(_0x346bc7[_0xa1b5('0x33')]!=='GP'||!_0x346bc7[_0xa1b5('0x3c')]){_0x2d7779[_0xa1b5('0x3d')]=!![];}return _0x4c9a8b[_0xa1b5('0x3e')](_0x2d7779);}else{return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x30'),util[_0xa1b5('0x2f')](_0x1120b1,{'showHidden':![],'depth':null}));}})[_0xa1b5('0x2c')](function(_0x57ac23){return logger['error'](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x30'),util['inspect'](_0x57ac23,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa1b5('0x2d'),_0xa1b5('0x2e'),'skebby',_0xa1b5('0x3f'));}break;case'connectel':if(_0x346bc7['authToken']){var _0x1b3c5d={'recipient':_0x4a9a09['phone'],'message':_0x4a9a09['body'],'sender':_0x346bc7['senderString']||_0x346bc7[_0xa1b5('0x26')],'authorization':_0x346bc7[_0xa1b5('0x23')]};var _0x1d5080={'method':'POST','uri':_0xa1b5('0x40'),'body':_0x1b3c5d,'json':!![]};rp(_0x1d5080)['then'](function(_0x2d9ae8){var _0xf54cb1={'messageId':_0x2d9ae8[_0xa1b5('0x41')]};if(!_0x346bc7[_0xa1b5('0x3c')]){_0xf54cb1[_0xa1b5('0x3d')]=!![];}return _0x4c9a8b['update'](_0xf54cb1);})['catch'](function(_0x5bac92){logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate','connectel',util[_0xa1b5('0x2f')](_0x5bac92,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),'connectel',_0xa1b5('0x42'));}break;case _0xa1b5('0x43'):if(_0x346bc7[_0xa1b5('0x31')]&&_0x346bc7['password']){var _0x1b3c5d={'messages':[{'source':'xCALLY\x20Motion','to':_0x4a9a09[_0xa1b5('0x26')],'body':_0x4a9a09[_0xa1b5('0x10')],'from':_0x346bc7[_0xa1b5('0x44')]||_0x346bc7[_0xa1b5('0x26')]}]};var _0x774176=util['format'](_0xa1b5('0x45'),_0x346bc7[_0xa1b5('0x31')],_0x346bc7['password']);var _0x1d5080={'method':_0xa1b5('0x38'),'uri':_0xa1b5('0x46'),'body':_0x1b3c5d,'headers':{'Authorization':util[_0xa1b5('0x47')](_0xa1b5('0x48'),new Buffer(_0x774176)[_0xa1b5('0x49')](_0xa1b5('0x4a')))},'json':!![]};rp(_0x1d5080)['then'](function(_0x3ecd2f){if(_0x3ecd2f[_0xa1b5('0x4b')]>=0xc8&&_0x3ecd2f['http_code']<=0xce){if(_0x3ecd2f[_0xa1b5('0x4c')]&&_0x3ecd2f[_0xa1b5('0x4c')][_0xa1b5('0x4d')]>0x0){var _0x5aa7e3=_[_0xa1b5('0x4e')](_0x3ecd2f[_0xa1b5('0x4c')][_0xa1b5('0x24')]);var _0x45a881={'messageId':_0x5aa7e3['message_id']};if(!_0x346bc7[_0xa1b5('0x3c')]){_0x45a881[_0xa1b5('0x3d')]=!![];}return _0x4c9a8b['update'](_0x45a881);}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate',_0xa1b5('0x4f'),util[_0xa1b5('0x2f')](_0x3ecd2f,{'showHidden':![],'depth':null}));}}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate','clickSend',util[_0xa1b5('0x2f')](_0x3ecd2f,{'showHidden':![],'depth':null}));}})['catch'](function(_0xf01d14){logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x4f'),util[_0xa1b5('0x2f')](_0xf01d14,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x4f'),_0xa1b5('0x3f'));}break;case _0xa1b5('0x50'):if(_0x346bc7['authId']&&_0x346bc7[_0xa1b5('0x23')]){var _0x1b3c5d={'dst':_0x4a9a09[_0xa1b5('0x26')],'text':_0x4a9a09[_0xa1b5('0x10')],'src':_0x346bc7[_0xa1b5('0x44')]||_0x346bc7[_0xa1b5('0x26')],'url':_0x346bc7[_0xa1b5('0x27')]+'/api/sms/messages/'+_0x4a9a09['id']+_0xa1b5('0x29')+_0x346bc7[_0xa1b5('0x2a')]};var _0x774176=util[_0xa1b5('0x47')](_0xa1b5('0x45'),_0x346bc7[_0xa1b5('0x51')],_0x346bc7['authToken']);var _0x1d5080={'method':_0xa1b5('0x38'),'uri':util[_0xa1b5('0x47')](_0xa1b5('0x52'),_0x346bc7['authId']),'body':_0x1b3c5d,'headers':{'Authorization':util[_0xa1b5('0x47')](_0xa1b5('0x48'),new Buffer(_0x774176)[_0xa1b5('0x49')](_0xa1b5('0x4a')))},'json':!![]};rp(_0x1d5080)['then'](function(_0xe25aa4){var _0x12a5bb={'messageId':_0xe25aa4[_0xa1b5('0x53')][0x0]};return _0x4c9a8b[_0xa1b5('0x3e')](_0x12a5bb);})[_0xa1b5('0x2c')](function(_0x4c5d76){logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x50'),util['inspect'](_0x4c5d76,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate',_0xa1b5('0x50'),_0xa1b5('0x54'));}break;case _0xa1b5('0x55'):if(_0x346bc7[_0xa1b5('0x31')]&&_0x346bc7['password']){if(_0x346bc7[_0xa1b5('0x56')]){var _0x50b149={'method':_0xa1b5('0x38'),'uri':_0x346bc7[_0xa1b5('0x56')]+_0xa1b5('0x57'),'body':{'username':_0x346bc7[_0xa1b5('0x31')],'password':_0x346bc7[_0xa1b5('0x32')]},'json':!![]};return rp(_0x50b149)['then'](function(_0x3b232a){var _0x25535c={'method':'POST','uri':_0x346bc7[_0xa1b5('0x56')]+_0xa1b5('0x58'),'body':{'messages':[{'from':_0x346bc7['phone'],'destinations':[{'to':_0x4a9a09[_0xa1b5('0x26')]}],'text':_0x4a9a09[_0xa1b5('0x10')],'notifyUrl':_0x346bc7[_0xa1b5('0x27')]+'/api/sms/messages/'+_0x4a9a09['id']+_0xa1b5('0x29')+_0x346bc7[_0xa1b5('0x2a')],'notifyContentType':_0xa1b5('0x59'),'callbackData':_0x346bc7[_0xa1b5('0x26')]+';'+_0x4a9a09[_0xa1b5('0x10')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3b232a[_0xa1b5('0x2a')]},'json':!![]};return rp(_0x25535c)[_0xa1b5('0x1b')](function(_0x2115b5){if(_0x2115b5['messages']){var _0x35f662={'messageId':_0x2115b5[_0xa1b5('0x24')][0x0][_0xa1b5('0xe')]};if(!_0x346bc7['deliveryReport']){_0x35f662[_0xa1b5('0x3d')]=!![];}return _0x4c9a8b[_0xa1b5('0x3e')](_0x35f662);}else{return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate',_0xa1b5('0x55'),util[_0xa1b5('0x2f')](_0x2115b5,{'showHidden':![],'depth':null}));}});})[_0xa1b5('0x2c')](function(_0x312836){return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate','infobip',util['inspect'](_0x312836,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),'infobip',_0xa1b5('0x5a'));}}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate','infobip',_0xa1b5('0x3f'));}break;case _0xa1b5('0x5b'):var _0x562128=require(_0xa1b5('0x5c'));if(_0x346bc7['apiKey']){var _0x53cbc1={};_0x53cbc1[_0xa1b5('0x5d')]=_0x346bc7[_0xa1b5('0x31')];_0x53cbc1['phone']=_0x4a9a09[_0xa1b5('0x26')];_0x53cbc1['sender']=_0x346bc7[_0xa1b5('0x26')];_0x53cbc1['text']=_0x4a9a09['body'];_0x53cbc1[_0xa1b5('0x5e')]=+new Date();var _0x18c173='';var _0x133356='';var _0x2c9310=Object[_0xa1b5('0x5f')](_0x53cbc1);_0x2c9310['sort']();for(var _0x291d1d=0x0;_0x291d1d<_0x2c9310[_0xa1b5('0x60')];_0x291d1d++){if(_0x18c173!=''){_0x18c173+='&';}_0x18c173+=_0x2c9310[_0x291d1d]+'='+encodeURIComponent(_0x53cbc1[_0x2c9310[_0x291d1d]]);_0x133356+=_0x53cbc1[_0x2c9310[_0x291d1d]];}_0x133356+=_0x346bc7[_0xa1b5('0x61')];_0x133356=_0x562128[_0xa1b5('0x62')]('md5')[_0xa1b5('0x3e')](_0x133356)[_0xa1b5('0x63')](_0xa1b5('0x64'));if(_0x18c173!==''){_0x18c173+='&';}_0x18c173+='signature='+_0x133356;var _0x128dbf={'method':_0xa1b5('0x65'),'uri':_0x346bc7[_0xa1b5('0x56')]+_0xa1b5('0x66')+_0x18c173,'json':!![]};return rp(_0x128dbf)[_0xa1b5('0x1b')](function(_0x1baa36){var _0x50da05=Object[_0xa1b5('0x5f')](_0x1baa36);if(_0x1baa36[_0x50da05[0x0]][_0xa1b5('0x1d')]&&parseInt(_0x1baa36[_0x50da05[0x0]][_0xa1b5('0x1d')])===0x0){var _0x267928={'messageId':_0x1baa36[_0x50da05[0x0]]['id_sms']};if(!_0x346bc7[_0xa1b5('0x3c')]){_0x267928['read']=!![];}return _0x4c9a8b[_0xa1b5('0x3e')](_0x267928);}else{return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x5b'),util[_0xa1b5('0x2f')](_0x1baa36[_0xa1b5('0x1d')],{'showHidden':![],'depth':null}));}})[_0xa1b5('0x2c')](function(_0x50d03d){return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x5b'),util['inspect'](_0x50d03d,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1b5('0x2e'),_0xa1b5('0x5b'),_0xa1b5('0x67'));}break;case _0xa1b5('0x68'):if(_0x346bc7['apiKey']){var _0x1c309d={'method':_0xa1b5('0x38'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x346bc7[_0xa1b5('0x61')]},'body':{'content':_0x4a9a09['body'],'to':[_0x4a9a09[_0xa1b5('0x26')]],'from':_0x346bc7['phone'],'binary':![],'clientMessageId':_0xa1b5('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x1c309d)['then'](function(_0x3125b7){if(!_0x3125b7[_0xa1b5('0x1d')]){var _0x1ecabb={'messageId':_0x3125b7[_0xa1b5('0x24')][0x0][_0xa1b5('0x6a')]};if(!_0x346bc7['deliveryReport']){_0x1ecabb[_0xa1b5('0x3d')]=!![];}return _0x4c9a8b[_0xa1b5('0x3e')](_0x1ecabb);}else{return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x68'),util[_0xa1b5('0x2f')](_0x3125b7[_0xa1b5('0x1d')],{'showHidden':![],'depth':null}));}})[_0xa1b5('0x2c')](function(_0x1cff1f){return logger['error'](_0xa1b5('0x2d'),_0xa1b5('0x2e'),'clickatell',util[_0xa1b5('0x2f')](_0x1cff1f,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x68'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x346bc7[_0xa1b5('0x31')]&&_0x346bc7[_0xa1b5('0x32')]){var _0x774176=util[_0xa1b5('0x47')]('%s:%s',_0x346bc7[_0xa1b5('0x31')],_0x346bc7[_0xa1b5('0x32')]);var _0x1d5080={'method':_0xa1b5('0x38'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x346bc7[_0xa1b5('0x6b')]+_0xa1b5('0x6c'),'body':{'to':[_0x4a9a09[_0xa1b5('0x26')]],'text':_0x4a9a09[_0xa1b5('0x10')],'from':_0x346bc7['phone'],'applicationId':_0x346bc7[_0xa1b5('0x6d')]},'headers':{'Authorization':util[_0xa1b5('0x47')](_0xa1b5('0x48'),new Buffer(_0x774176)[_0xa1b5('0x49')](_0xa1b5('0x4a')))},'json':!![]};rp(_0x1d5080)['then'](function(_0x3dc5d0){if(_0x3dc5d0['id']){var _0x42cd2d={'messageId':_0x3dc5d0['id']};return _0x4c9a8b['update'](_0x42cd2d);}else{logger[_0xa1b5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1b5('0x2e'),'bandwidth',util['inspect'](_0x3dc5d0,{'showHidden':![],'depth':null}));}})[_0xa1b5('0x2c')](function(_0x4ae8e4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1b5('0x2e'),_0xa1b5('0x6e'),util[_0xa1b5('0x2f')](_0x4ae8e4,{'showHidden':![],'depth':null}));});}else{logger[_0xa1b5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1b5('0x2e'),_0xa1b5('0x6e'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x346bc7[_0xa1b5('0x61')]){var _0x3653b5={};var _0x128dbf={'method':_0xa1b5('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xa1b5('0x6f')+_0x346bc7[_0xa1b5('0x61')],'Content-Type':'application/json'},'body':{'from':_0x346bc7[_0xa1b5('0x26')],'to':_0x4a9a09[_0xa1b5('0x26')],'text':_0x4a9a09[_0xa1b5('0x10')]},'json':!![]};return rp(_0x128dbf)[_0xa1b5('0x1b')](function(_0x1c94ef){if(_0x1c94ef[_0xa1b5('0x70')]==0xca){_0x3653b5['message']=_0x1c94ef;var _0x2953a5={'method':_0xa1b5('0x38'),'uri':_0xa1b5('0x71'),'headers':{'Authorization':_0xa1b5('0x6f')+_0x346bc7[_0xa1b5('0x61')],'Content-Type':_0xa1b5('0x59')},'body':{'refid':_0x3653b5['message'][_0xa1b5('0x72')]},'json':!![]};return rp(_0x2953a5)[_0xa1b5('0x1b')](function(_0x1dde48){_0x3653b5[_0xa1b5('0x73')]=_0x1dde48;var _0x570571={'messageId':_0x3653b5[_0xa1b5('0x74')]['refid'],'read':!![]};return _0x4c9a8b['update'](_0x570571);});}else{return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),'afterCreate','intelepeer',util['inspect'](_0x1c94ef,{'showHidden':![],'depth':null}));}})[_0xa1b5('0x2c')](function(_0x20f3b0){return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x75'),util[_0xa1b5('0x2f')](_0x20f3b0,{'showHidden':![],'depth':null}));});}else{return logger[_0xa1b5('0x1d')](_0xa1b5('0x2d'),_0xa1b5('0x2e'),_0xa1b5('0x75'),_0xa1b5('0x76'));}break;}}})[_0xa1b5('0x77')](function(){_0x340573();});}else{_0x340573();}}},'charset':_0xa1b5('0x78'),'collate':_0xa1b5('0x79')});}; \ No newline at end of file +var _0x2495=['clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','get','direction','toLowerCase','secret','isNil','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','out','SmsAccount','find','SmsAccountId','type','twilio','phone','accountSid','authToken','messages','create','/status?token=','token','sid','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','GET','split','sms','user_key','session_key','total_sent','internal_order_id','read','error','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','queued_count','head','message_id','clickSend','plivo','authId','remote','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp','keys','createHash','hex','signature=','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','apiMessageId'];(function(_0x41f5ba,_0xd0ffa8){var _0x535e03=function(_0x7b8c37){while(--_0x7b8c37){_0x41f5ba['push'](_0x41f5ba['shift']());}};_0x535e03(++_0xd0ffa8);}(_0x2495,0x82));var _0x5249=function(_0x3a0c7c,_0xcd2b82){_0x3a0c7c=_0x3a0c7c-0x0;var _0x349e74=_0x2495[_0x3a0c7c];return _0x349e74;};'use strict';var _=require(_0x5249('0x0'));var util=require(_0x5249('0x1'));var logger=require(_0x5249('0x2'))(_0x5249('0x3'));var moment=require(_0x5249('0x4'));var BPromise=require('bluebird');var rp=require(_0x5249('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5249('0x6'));var config=require(_0x5249('0x7'));var attributes=require(_0x5249('0x8'));module[_0x5249('0x9')]=function(_0x23fc5b,_0x478602){return _0x23fc5b[_0x5249('0xa')]('SmsMessage',attributes,{'tableName':_0x5249('0xb'),'paranoid':![],'indexes':[{'name':_0x5249('0xc'),'fields':[_0x5249('0xc')]},{'name':'fti_sms_messages','fields':[_0x5249('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x422bbe,_0x5ada2c,_0x4fff23){var _0x1835a5=_0x23fc5b['models'];var _0x13c837=_0x422bbe[_0x5249('0xe')]({'plain':!![]});if(_0x13c837[_0x5249('0xf')][_0x5249('0x10')]()==='in'||_0x13c837[_0x5249('0xf')][_0x5249('0x10')]()==='out'&&!_0x13c837[_0x5249('0x11')]&&!_[_0x5249('0x12')](_0x13c837[_0x5249('0x13')])){_0x1835a5['SmsInteraction'][_0x5249('0x14')]({'where':{'id':_0x13c837[_0x5249('0x15')]}})[_0x5249('0x16')](function(_0x3a1c77){if(_0x3a1c77){_0x3a1c77[_0x5249('0x17')]({'lastMsgAt':_0x13c837[_0x5249('0x18')],'lastMsgDirection':_0x13c837['direction']['toLowerCase']()});}})[_0x5249('0x19')](function(_0x12c683){console['error'](_0x12c683);});}if(_0x13c837['direction']===_0x5249('0x1a')&&!_0x13c837[_0x5249('0x11')]){var _0x43d01b;_0x1835a5[_0x5249('0x1b')][_0x5249('0x1c')]({'where':{'id':_0x13c837[_0x5249('0x1d')]},'raw':!![]})[_0x5249('0x16')](function(_0xf625a3){_0x43d01b=_0xf625a3;if(_0x43d01b&&_0x43d01b[_0x5249('0x1e')]){switch(_0x43d01b['type']){case _0x5249('0x1f'):var _0x44400e=require(_0x5249('0x1f'));if(_0x43d01b['accountSid']&&_0x43d01b['authToken']&&_0x43d01b[_0x5249('0x20')]){var _0x3618b6=new _0x44400e(_0x43d01b[_0x5249('0x21')],_0x43d01b[_0x5249('0x22')]);_0x3618b6[_0x5249('0x23')][_0x5249('0x24')]({'body':_0x13c837['body'],'to':_0x13c837['phone'],'from':_0x43d01b[_0x5249('0x20')],'statusCallback':_0x43d01b['remote']+'/api/sms/messages/'+_0x13c837['id']+_0x5249('0x25')+_0x43d01b[_0x5249('0x26')]})['then'](function(_0x546fbd){if(_0x546fbd[_0x5249('0x27')]){return _0x422bbe['update']({'messageId':_0x546fbd[_0x5249('0x27')]});}})['catch'](function(_0x46646f){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x28'),_0x5249('0x1f'),util[_0x5249('0x29')](_0x46646f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5249('0x2a'):var _0x66b7ab=_0x5249('0x2b');if(_0x43d01b['username']&&_0x43d01b[_0x5249('0x2c')]){var _0x709a19={'recipient':[_0x13c837[_0x5249('0x20')]],'message':_0x13c837[_0x5249('0xd')],'message_type':_0x43d01b[_0x5249('0x2d')]};if(_0x43d01b[_0x5249('0x2d')]&&_0x43d01b[_0x5249('0x2d')]!=='SI'){_0x709a19[_0x5249('0x2e')]=_0x43d01b[_0x5249('0x20')];}var _0x3e89ad={'url':_0x66b7ab+_0x5249('0x2f')+_0x43d01b[_0x5249('0x30')]+'&password='+_0x43d01b[_0x5249('0x2c')],'method':_0x5249('0x31')};rp(_0x3e89ad)[_0x5249('0x16')](function(_0xd60881){var _0x198eea=_0xd60881[_0x5249('0x32')](';');var _0x1b49c3={'user_key':_0x198eea[0x0],'session_key':_0x198eea[0x1]};_0x3e89ad={'url':_0x66b7ab+_0x5249('0x33'),'method':'POST','headers':{'user_key':_0x1b49c3[_0x5249('0x34')],'Session_key':_0x1b49c3[_0x5249('0x35')]},'json':!![],'body':_0x709a19};return rp(_0x3e89ad);})[_0x5249('0x16')](function(_0x5d816f){if(_0x5d816f[_0x5249('0x36')]>=0x1){var _0x394417={'messageId':_0x5d816f[_0x5249('0x37')]};if(_0x43d01b[_0x5249('0x2d')]!=='GP'||!_0x43d01b['deliveryReport']){_0x394417[_0x5249('0x38')]=!![];}return _0x422bbe[_0x5249('0x17')](_0x394417);}else{return logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate',_0x5249('0x2a'),util[_0x5249('0x29')](_0x5d816f,{'showHidden':![],'depth':null}));}})[_0x5249('0x19')](function(_0x5d41ff){return logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate',_0x5249('0x2a'),util[_0x5249('0x29')](_0x5d41ff,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x2a'),_0x5249('0x3b'));}break;case _0x5249('0x3c'):if(_0x43d01b['authToken']){var _0x4f1a43={'recipient':_0x13c837[_0x5249('0x20')],'message':_0x13c837[_0x5249('0xd')],'sender':_0x43d01b[_0x5249('0x3d')]||_0x43d01b[_0x5249('0x20')],'authorization':_0x43d01b[_0x5249('0x22')]};var _0x5ada2c={'method':_0x5249('0x3e'),'uri':_0x5249('0x3f'),'body':_0x4f1a43,'json':!![]};rp(_0x5ada2c)[_0x5249('0x16')](function(_0x5d806a){var _0x3d4815={'messageId':_0x5d806a[_0x5249('0x40')]};if(!_0x43d01b[_0x5249('0x41')]){_0x3d4815[_0x5249('0x38')]=!![];}return _0x422bbe[_0x5249('0x17')](_0x3d4815);})[_0x5249('0x19')](function(_0x294200){logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate',_0x5249('0x3c'),util['inspect'](_0x294200,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x43d01b[_0x5249('0x30')]&&_0x43d01b['password']){var _0x4f1a43={'messages':[{'source':'xCALLY\x20Motion','to':_0x13c837[_0x5249('0x20')],'body':_0x13c837['body'],'from':_0x43d01b[_0x5249('0x3d')]||_0x43d01b['phone']}]};var _0x1bb10d=util[_0x5249('0x42')](_0x5249('0x43'),_0x43d01b[_0x5249('0x30')],_0x43d01b[_0x5249('0x2c')]);var _0x5ada2c={'method':_0x5249('0x3e'),'uri':_0x5249('0x44'),'body':_0x4f1a43,'headers':{'Authorization':util[_0x5249('0x42')]('Basic\x20%s',new Buffer(_0x1bb10d)['toString'](_0x5249('0x45')))},'json':!![]};rp(_0x5ada2c)[_0x5249('0x16')](function(_0x5d0ef6){if(_0x5d0ef6[_0x5249('0x46')]>=0xc8&&_0x5d0ef6['http_code']<=0xce){if(_0x5d0ef6['data']&&_0x5d0ef6['data'][_0x5249('0x47')]>0x0){var _0x374aca=_[_0x5249('0x48')](_0x5d0ef6['data'][_0x5249('0x23')]);var _0x4a728a={'messageId':_0x374aca[_0x5249('0x49')]};if(!_0x43d01b[_0x5249('0x41')]){_0x4a728a['read']=!![];}return _0x422bbe['update'](_0x4a728a);}else{logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate','clickSend',util[_0x5249('0x29')](_0x5d0ef6,{'showHidden':![],'depth':null}));}}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x4a'),util[_0x5249('0x29')](_0x5d0ef6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5702e3){logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x4a'),util[_0x5249('0x29')](_0x5702e3,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x4a'),_0x5249('0x3b'));}break;case _0x5249('0x4b'):if(_0x43d01b[_0x5249('0x4c')]&&_0x43d01b[_0x5249('0x22')]){var _0x4f1a43={'dst':_0x13c837[_0x5249('0x20')],'text':_0x13c837['body'],'src':_0x43d01b['senderString']||_0x43d01b['phone'],'url':_0x43d01b[_0x5249('0x4d')]+_0x5249('0x4e')+_0x13c837['id']+'/status?token='+_0x43d01b['token']};var _0x1bb10d=util['format']('%s:%s',_0x43d01b[_0x5249('0x4c')],_0x43d01b['authToken']);var _0x5ada2c={'method':_0x5249('0x3e'),'uri':util[_0x5249('0x42')](_0x5249('0x4f'),_0x43d01b[_0x5249('0x4c')]),'body':_0x4f1a43,'headers':{'Authorization':util[_0x5249('0x42')](_0x5249('0x50'),new Buffer(_0x1bb10d)[_0x5249('0x51')](_0x5249('0x45')))},'json':!![]};rp(_0x5ada2c)['then'](function(_0x19954a){var _0x393966={'messageId':_0x19954a['message_uuid'][0x0]};return _0x422bbe[_0x5249('0x17')](_0x393966);})[_0x5249('0x19')](function(_0x33994f){logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x4b'),util[_0x5249('0x29')](_0x33994f,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x4b'),_0x5249('0x52'));}break;case _0x5249('0x53'):if(_0x43d01b[_0x5249('0x30')]&&_0x43d01b[_0x5249('0x2c')]){if(_0x43d01b['baseUrl']){var _0x5a11ab={'method':_0x5249('0x3e'),'uri':_0x43d01b[_0x5249('0x54')]+'/auth/1/session','body':{'username':_0x43d01b[_0x5249('0x30')],'password':_0x43d01b['password']},'json':!![]};return rp(_0x5a11ab)['then'](function(_0x43d525){var _0x3e4752={'method':_0x5249('0x3e'),'uri':_0x43d01b[_0x5249('0x54')]+_0x5249('0x55'),'body':{'messages':[{'from':_0x43d01b[_0x5249('0x20')],'destinations':[{'to':_0x13c837[_0x5249('0x20')]}],'text':_0x13c837[_0x5249('0xd')],'notifyUrl':_0x43d01b[_0x5249('0x4d')]+'/api/sms/messages/'+_0x13c837['id']+_0x5249('0x25')+_0x43d01b[_0x5249('0x26')],'notifyContentType':_0x5249('0x56'),'callbackData':_0x43d01b[_0x5249('0x20')]+';'+_0x13c837[_0x5249('0xd')]}]},'headers':{'Authorization':_0x5249('0x57')+_0x43d525[_0x5249('0x26')]},'json':!![]};return rp(_0x3e4752)['then'](function(_0x441ffd){if(_0x441ffd[_0x5249('0x23')]){var _0x5dba8a={'messageId':_0x441ffd[_0x5249('0x23')][0x0]['messageId']};if(!_0x43d01b[_0x5249('0x41')]){_0x5dba8a[_0x5249('0x38')]=!![];}return _0x422bbe[_0x5249('0x17')](_0x5dba8a);}else{return logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x53'),util[_0x5249('0x29')](_0x441ffd,{'showHidden':![],'depth':null}));}});})[_0x5249('0x19')](function(_0x41fd70){return logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x53'),util[_0x5249('0x29')](_0x41fd70,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x28'),_0x5249('0x53'),_0x5249('0x58'));}}else{logger['error'](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x53'),_0x5249('0x3b'));}break;case _0x5249('0x59'):var _0x148b47=require(_0x5249('0x5a'));if(_0x43d01b[_0x5249('0x5b')]){var _0x1ff5c4={};_0x1ff5c4['login']=_0x43d01b[_0x5249('0x30')];_0x1ff5c4[_0x5249('0x20')]=_0x13c837[_0x5249('0x20')];_0x1ff5c4[_0x5249('0x2e')]=_0x43d01b[_0x5249('0x20')];_0x1ff5c4[_0x5249('0x5c')]=_0x13c837[_0x5249('0xd')];_0x1ff5c4[_0x5249('0x5d')]=+new Date();var _0x41a939='';var _0x30c28f='';var _0x3384c1=Object[_0x5249('0x5e')](_0x1ff5c4);_0x3384c1['sort']();for(var _0x354287=0x0;_0x354287<_0x3384c1['length'];_0x354287++){if(_0x41a939!=''){_0x41a939+='&';}_0x41a939+=_0x3384c1[_0x354287]+'='+encodeURIComponent(_0x1ff5c4[_0x3384c1[_0x354287]]);_0x30c28f+=_0x1ff5c4[_0x3384c1[_0x354287]];}_0x30c28f+=_0x43d01b[_0x5249('0x5b')];_0x30c28f=_0x148b47[_0x5249('0x5f')]('md5')[_0x5249('0x17')](_0x30c28f)['digest'](_0x5249('0x60'));if(_0x41a939!==''){_0x41a939+='&';}_0x41a939+=_0x5249('0x61')+_0x30c28f;var _0x3e89ad={'method':'GET','uri':_0x43d01b[_0x5249('0x54')]+_0x5249('0x62')+_0x41a939,'json':!![]};return rp(_0x3e89ad)['then'](function(_0x5fa61e){var _0x5d02c1=Object[_0x5249('0x5e')](_0x5fa61e);if(_0x5fa61e[_0x5d02c1[0x0]]['error']&&parseInt(_0x5fa61e[_0x5d02c1[0x0]][_0x5249('0x39')])===0x0){var _0x16db2d={'messageId':_0x5fa61e[_0x5d02c1[0x0]][_0x5249('0x63')]};if(!_0x43d01b[_0x5249('0x41')]){_0x16db2d['read']=!![];}return _0x422bbe[_0x5249('0x17')](_0x16db2d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x28'),'csc',util[_0x5249('0x29')](_0x5fa61e[_0x5249('0x39')],{'showHidden':![],'depth':null}));}})[_0x5249('0x19')](function(_0x45664c){return logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate',_0x5249('0x59'),util[_0x5249('0x29')](_0x45664c,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x59'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x43d01b[_0x5249('0x5b')]){var _0x5e9a62={'method':'POST','uri':_0x5249('0x64'),'headers':{'Authorization':_0x43d01b[_0x5249('0x5b')]},'body':{'content':_0x13c837[_0x5249('0xd')],'to':[_0x13c837[_0x5249('0x20')]],'from':_0x43d01b[_0x5249('0x20')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x5e9a62)[_0x5249('0x16')](function(_0x2a54fd){if(!_0x2a54fd[_0x5249('0x39')]){var _0x149382={'messageId':_0x2a54fd['messages'][0x0][_0x5249('0x65')]};if(!_0x43d01b[_0x5249('0x41')]){_0x149382[_0x5249('0x38')]=!![];}return _0x422bbe[_0x5249('0x17')](_0x149382);}else{return logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x66'),util[_0x5249('0x29')](_0x2a54fd['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x119eb8){return logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x66'),util['inspect'](_0x119eb8,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x66'),_0x5249('0x67'));}break;case _0x5249('0x68'):if(_0x43d01b[_0x5249('0x30')]&&_0x43d01b[_0x5249('0x2c')]){var _0x1bb10d=util[_0x5249('0x42')]('%s:%s',_0x43d01b[_0x5249('0x30')],_0x43d01b[_0x5249('0x2c')]);var _0x5ada2c={'method':_0x5249('0x3e'),'uri':_0x5249('0x69')+_0x43d01b[_0x5249('0x6a')]+'/messages','body':{'to':[_0x13c837['phone']],'text':_0x13c837['body'],'from':_0x43d01b[_0x5249('0x20')],'applicationId':_0x43d01b['applicationId']},'headers':{'Authorization':util['format'](_0x5249('0x50'),new Buffer(_0x1bb10d)[_0x5249('0x51')](_0x5249('0x45')))},'json':!![]};rp(_0x5ada2c)['then'](function(_0x5e9e09){if(_0x5e9e09['id']){var _0x1d08c5={'messageId':_0x5e9e09['id']};return _0x422bbe[_0x5249('0x17')](_0x1d08c5);}else{logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate','bandwidth',util[_0x5249('0x29')](_0x5e9e09,{'showHidden':![],'depth':null}));}})[_0x5249('0x19')](function(_0x1cef61){logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x68'),util[_0x5249('0x29')](_0x1cef61,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x39')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x28'),'bandwidth',_0x5249('0x3b'));}break;case _0x5249('0x6b'):if(_0x43d01b[_0x5249('0x5b')]){var _0xc6c68d={};var _0x3e89ad={'method':_0x5249('0x3e'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x5249('0x6c')+_0x43d01b[_0x5249('0x5b')],'Content-Type':_0x5249('0x56')},'body':{'from':_0x43d01b['phone'],'to':_0x13c837[_0x5249('0x20')],'text':_0x13c837[_0x5249('0xd')]},'json':!![]};return rp(_0x3e89ad)[_0x5249('0x16')](function(_0x524daa){if(_0x524daa[_0x5249('0x6d')]==0xca){_0xc6c68d[_0x5249('0x6e')]=_0x524daa;var _0x1ca65c={'method':_0x5249('0x3e'),'uri':_0x5249('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x43d01b['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0xc6c68d[_0x5249('0x6e')][_0x5249('0x70')]},'json':!![]};return rp(_0x1ca65c)[_0x5249('0x16')](function(_0x2ce4b6){_0xc6c68d[_0x5249('0x71')]=_0x2ce4b6;var _0x21f0cd={'messageId':_0xc6c68d[_0x5249('0x6e')]['refid'],'read':!![]};return _0x422bbe[_0x5249('0x17')](_0x21f0cd);});}else{return logger[_0x5249('0x39')](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x6b'),util[_0x5249('0x29')](_0x524daa,{'showHidden':![],'depth':null}));}})[_0x5249('0x19')](function(_0x293472){return logger['error'](_0x5249('0x3a'),_0x5249('0x28'),_0x5249('0x6b'),util[_0x5249('0x29')](_0x293472,{'showHidden':![],'depth':null}));});}else{return logger[_0x5249('0x39')](_0x5249('0x3a'),'afterCreate',_0x5249('0x6b'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x4fff23();});}else{_0x4fff23();}}},'charset':_0x5249('0x72'),'collate':_0x5249('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f192fab..aaf849b 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 _0x673f=['stringify','error','message','info','result','catch','CreateSmsMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x673f,0x6f));var _0xf673=function(_0x5760dd,_0x8f96ca){_0x5760dd=_0x5760dd-0x0;var _0x38157e=_0x673f[_0x5760dd];return _0x38157e;};'use strict';var _=require(_0xf673('0x0'));var util=require(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rs=require(_0xf673('0x4'));var fs=require('fs');var Redis=require(_0xf673('0x5'));var db=require(_0xf673('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf673('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf673('0x8'));var client=jayson[_0xf673('0x9')]['http']({'port':0x232a});config['redis']=_[_0xf673('0xa')](config[_0xf673('0xb')],{'host':_0xf673('0xc'),'port':0x18eb});var socket=require(_0xf673('0xd'))(new Redis(config[_0xf673('0xb')]));require(_0xf673('0xe'))[_0xf673('0xf')](socket);function respondWithRpcPromise(_0x224203,_0x21a82f,_0x1cee96){return new BPromise(function(_0x482ec2,_0x2ceea2){return client[_0xf673('0x10')](_0x224203,_0x1cee96)[_0xf673('0x11')](function(_0x10a4b7){logger['info'](_0xf673('0x12'),_0x21a82f,_0xf673('0x13'));logger['debug'](_0xf673('0x14'),_0x21a82f,_0xf673('0x13'),JSON[_0xf673('0x15')](_0x10a4b7));if(_0x10a4b7[_0xf673('0x16')]){if(_0x10a4b7[_0xf673('0x16')]['code']===0x1f4){logger[_0xf673('0x16')](_0xf673('0x12'),_0x21a82f,_0x10a4b7[_0xf673('0x16')][_0xf673('0x17')]);return _0x2ceea2(_0x10a4b7[_0xf673('0x16')]['message']);}logger[_0xf673('0x16')](_0xf673('0x12'),_0x21a82f,_0x10a4b7['error'][_0xf673('0x17')]);return _0x482ec2(_0x10a4b7['error'][_0xf673('0x17')]);}else{logger[_0xf673('0x18')](_0xf673('0x12'),_0x21a82f,_0xf673('0x13'));_0x482ec2(_0x10a4b7[_0xf673('0x19')][_0xf673('0x17')]);}})[_0xf673('0x1a')](function(_0x233c1e){logger[_0xf673('0x16')](_0xf673('0x12'),_0x21a82f,_0x233c1e);_0x2ceea2(_0x233c1e);});});}exports[_0xf673('0x1b')]=function(_0x4a2a30){var _0x4f1d86=this;return new Promise(function(_0x31e1b4,_0x15c5c2){return db['SmsMessage'][_0xf673('0x1c')](_0x4a2a30[_0xf673('0x1d')],{'raw':_0x4a2a30[_0xf673('0x1e')]?_0x4a2a30[_0xf673('0x1e')][_0xf673('0x1f')]===undefined?!![]:![]:!![]})[_0xf673('0x11')](function(_0x2739b7){logger[_0xf673('0x18')](_0xf673('0x1b'),_0x4a2a30);logger[_0xf673('0x20')]('CreateSmsMessage',_0x4a2a30,JSON['stringify'](_0x2739b7));_0x31e1b4(_0x2739b7);})['catch'](function(_0x24e6b1){logger[_0xf673('0x16')](_0xf673('0x1b'),_0x24e6b1[_0xf673('0x17')],_0x4a2a30);_0x15c5c2(_0x4f1d86[_0xf673('0x16')](0x1f4,_0x24e6b1['message']));});});}; \ No newline at end of file +var _0x708e=['client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x708e,0x110));var _0xe708=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x708e[_0x36da00];return _0x4b72c5;};'use strict';var _=require(_0xe708('0x0'));var util=require(_0xe708('0x1'));var moment=require('moment');var BPromise=require(_0xe708('0x2'));var rs=require(_0xe708('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe708('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe708('0x5'));var jayson=require(_0xe708('0x6'));var client=jayson[_0xe708('0x7')][_0xe708('0x8')]({'port':0x232a});config[_0xe708('0x9')]=_['defaults'](config[_0xe708('0x9')],{'host':_0xe708('0xa'),'port':0x18eb});var socket=require(_0xe708('0xb'))(new Redis(config[_0xe708('0x9')]));require(_0xe708('0xc'))[_0xe708('0xd')](socket);function respondWithRpcPromise(_0x3a4ca3,_0x1faccc,_0x3b70ac){return new BPromise(function(_0x1d3b48,_0x8c163a){return client['request'](_0x3a4ca3,_0x3b70ac)[_0xe708('0xe')](function(_0x1ba93b){logger[_0xe708('0xf')](_0xe708('0x10'),_0x1faccc,_0xe708('0x11'));logger[_0xe708('0x12')](_0xe708('0x13'),_0x1faccc,_0xe708('0x11'),JSON[_0xe708('0x14')](_0x1ba93b));if(_0x1ba93b[_0xe708('0x15')]){if(_0x1ba93b[_0xe708('0x15')][_0xe708('0x16')]===0x1f4){logger[_0xe708('0x15')](_0xe708('0x10'),_0x1faccc,_0x1ba93b[_0xe708('0x15')][_0xe708('0x17')]);return _0x8c163a(_0x1ba93b['error'][_0xe708('0x17')]);}logger[_0xe708('0x15')](_0xe708('0x10'),_0x1faccc,_0x1ba93b['error'][_0xe708('0x17')]);return _0x1d3b48(_0x1ba93b[_0xe708('0x15')][_0xe708('0x17')]);}else{logger['info'](_0xe708('0x10'),_0x1faccc,'request\x20sent');_0x1d3b48(_0x1ba93b[_0xe708('0x18')][_0xe708('0x17')]);}})[_0xe708('0x19')](function(_0x227361){logger[_0xe708('0x15')](_0xe708('0x10'),_0x1faccc,_0x227361);_0x8c163a(_0x227361);});});}exports[_0xe708('0x1a')]=function(_0x1539a9){var _0x368a5e=this;return new Promise(function(_0x1b98d8,_0xcff83d){return db['SmsMessage'][_0xe708('0x1b')](_0x1539a9[_0xe708('0x1c')],{'raw':_0x1539a9['options']?_0x1539a9[_0xe708('0x1d')][_0xe708('0x1e')]===undefined?!![]:![]:!![]})[_0xe708('0xe')](function(_0x6e4b3e){logger[_0xe708('0xf')](_0xe708('0x1a'),_0x1539a9);logger[_0xe708('0x12')](_0xe708('0x1a'),_0x1539a9,JSON[_0xe708('0x14')](_0x6e4b3e));_0x1b98d8(_0x6e4b3e);})['catch'](function(_0x5d4684){logger[_0xe708('0x15')](_0xe708('0x1a'),_0x5d4684[_0xe708('0x17')],_0x1539a9);_0xcff83d(_0x368a5e[_0xe708('0x15')](0x1f4,_0x5d4684[_0xe708('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2e60247..3dd2588 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e77=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x2eb774,_0x383aaa){var _0x595a2e=function(_0x333b83){while(--_0x333b83){_0x2eb774['push'](_0x2eb774['shift']());}};_0x595a2e(++_0x383aaa);}(_0x7e77,0x1a3));var _0x77e7=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x7e77[_0x556bb1];return _0x45455f;};'use strict';var SmsMessageEvents=require(_0x77e7('0x0'));var events=[_0x77e7('0x1'),_0x77e7('0x2'),_0x77e7('0x3')];function createListener(_0x468c93,_0x20fed2){return function(_0x4eb9ef){_0x20fed2[_0x77e7('0x4')](_0x468c93,_0x4eb9ef);};}function removeListener(_0x1900e7,_0x154a60){return function(){SmsMessageEvents[_0x77e7('0x5')](_0x1900e7,_0x154a60);};}exports[_0x77e7('0x6')]=function(_0x17c5e8){for(var _0xa53334=0x0,_0x421197=events[_0x77e7('0x7')];_0xa53334<_0x421197;_0xa53334++){var _0x3531a4=events[_0xa53334];var _0x1eb498=createListener(_0x77e7('0x8')+_0x3531a4,_0x17c5e8);SmsMessageEvents['on'](_0x3531a4,_0x1eb498);}}; \ No newline at end of file +var _0x16b3=['removeListener','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0xfbca49,_0x554ea3){var _0x4d6509=function(_0x4e92c9){while(--_0x4e92c9){_0xfbca49['push'](_0xfbca49['shift']());}};_0x4d6509(++_0x554ea3);}(_0x16b3,0x122));var _0x316b=function(_0x31acb7,_0x5e9b99){_0x31acb7=_0x31acb7-0x0;var _0xe7e77d=_0x16b3[_0x31acb7];return _0xe7e77d;};'use strict';var SmsMessageEvents=require(_0x316b('0x0'));var events=[_0x316b('0x1'),_0x316b('0x2'),'update'];function createListener(_0x579f3e,_0x3e6c43){return function(_0x4b8945){_0x3e6c43[_0x316b('0x3')](_0x579f3e,_0x4b8945);};}function removeListener(_0x40f779,_0x2e4008){return function(){SmsMessageEvents[_0x316b('0x4')](_0x40f779,_0x2e4008);};}exports['register']=function(_0x2e77bc){for(var _0x363329=0x0,_0x3f2372=events[_0x316b('0x5')];_0x363329<_0x3f2372;_0x363329++){var _0x3b84a3=events[_0x363329];var _0x4ea1d9=createListener(_0x316b('0x6')+_0x3b84a3,_0x2e77bc);SmsMessageEvents['on'](_0x3b84a3,_0x4ea1d9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 314f253..cb09fed 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 _0xcf98=['index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','post','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0xf6bd18,_0x1ac393){var _0x19ef87=function(_0x1c18d5){while(--_0x1c18d5){_0xf6bd18['push'](_0xf6bd18['shift']());}};_0x19ef87(++_0x1ac393);}(_0xcf98,0x8d));var _0x8cf9=function(_0x2f843d,_0x481938){_0x2f843d=_0x2f843d-0x0;var _0x2b659f=_0xcf98[_0x2f843d];return _0x2b659f;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cf9('0x5'));var controller=require(_0x8cf9('0x6'));router[_0x8cf9('0x7')]('/',auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x9')]);router[_0x8cf9('0x7')](_0x8cf9('0xa'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0xb')]);router[_0x8cf9('0x7')](_0x8cf9('0xc'),auth['isAuthenticated'](),controller[_0x8cf9('0xd')]);router[_0x8cf9('0x7')]('/:id/members',auth[_0x8cf9('0x8')](),controller['getMembers']);router[_0x8cf9('0x7')](_0x8cf9('0xe'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0xf')]);router[_0x8cf9('0x7')](_0x8cf9('0x10'),auth[_0x8cf9('0x8')](),controller['getAgents']);router[_0x8cf9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8cf9('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8cf9('0x11')](_0x8cf9('0x10'),auth[_0x8cf9('0x8')](),controller['addAgents']);router[_0x8cf9('0x12')](_0x8cf9('0xc'),auth['isAuthenticated'](),controller[_0x8cf9('0x13')]);router[_0x8cf9('0x14')](_0x8cf9('0xc'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x15')]);router[_0x8cf9('0x14')](_0x8cf9('0xe'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x16')]);router[_0x8cf9('0x14')](_0x8cf9('0x10'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x17')]);module[_0x8cf9('0x18')]=router; \ No newline at end of file +var _0x90b1=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x50b54b,_0xba911d){var _0x1859c1=function(_0x4a969b){while(--_0x4a969b){_0x50b54b['push'](_0x50b54b['shift']());}};_0x1859c1(++_0xba911d);}(_0x90b1,0x1bb));var _0x190b=function(_0x16ec06,_0x1513b5){_0x16ec06=_0x16ec06-0x0;var _0xee6d30=_0x90b1[_0x16ec06];return _0xee6d30;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var auth=require(_0x190b('0x4'));var interaction=require(_0x190b('0x5'));var config=require(_0x190b('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x190b('0x7')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0xa')]);router[_0x190b('0x7')](_0x190b('0xb'),auth[_0x190b('0x9')](),controller['show']);router[_0x190b('0x7')](_0x190b('0xc'),auth[_0x190b('0x9')](),controller[_0x190b('0xd')]);router[_0x190b('0x7')](_0x190b('0xe'),auth[_0x190b('0x9')](),controller[_0x190b('0xf')]);router['get'](_0x190b('0x10'),auth[_0x190b('0x9')](),controller['getAgents']);router[_0x190b('0x11')]('/',auth[_0x190b('0x9')](),controller[_0x190b('0x12')]);router[_0x190b('0x11')](_0x190b('0xe'),auth[_0x190b('0x9')](),controller[_0x190b('0x13')]);router[_0x190b('0x11')](_0x190b('0x10'),auth[_0x190b('0x9')](),controller[_0x190b('0x14')]);router[_0x190b('0x15')](_0x190b('0xb'),auth[_0x190b('0x9')](),controller[_0x190b('0x16')]);router[_0x190b('0x17')](_0x190b('0xb'),auth['isAuthenticated'](),controller[_0x190b('0x18')]);router['delete'](_0x190b('0xe'),auth[_0x190b('0x9')](),controller[_0x190b('0x19')]);router[_0x190b('0x17')]('/:id/users',auth[_0x190b('0x9')](),controller[_0x190b('0x1a')]);module[_0x190b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bf5571a..3864084 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 _0xd540=['name','STRING','rrmemory','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd540,0x12b));var _0x0d54=function(_0xaa72b3,_0x4dd0e4){_0xaa72b3=_0xaa72b3-0x0;var _0x206de3=_0xd540[_0xaa72b3];return _0x206de3;};'use strict';var Sequelize=require('sequelize');module[_0x0d54('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0d54('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0d54('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0d54('0x3'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x0cdb=['ENUM','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x191820,_0x106807){var _0x3061b9=function(_0x1bdabd){while(--_0x1bdabd){_0x191820['push'](_0x191820['shift']());}};_0x3061b9(++_0x106807);}(_0x0cdb,0x74));var _0xb0cd=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x0cdb[_0x20cb20];return _0x2fcf4b;};'use strict';var Sequelize=require(_0xb0cd('0x0'));module[_0xb0cd('0x1')]={'name':{'type':Sequelize[_0xb0cd('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb0cd('0x2')]},'timeout':{'type':Sequelize[_0xb0cd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb0cd('0x4')]('rrmemory',_0xb0cd('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 9d835ce..1146249 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 _0x8ef6=['reject','update','then','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','order','SmsQueueId','UserSmsQueue','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','addAgents','spread','isArray','userSmsQueue:remove','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','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/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','json','count','offset','limit','status','set','apply'];(function(_0x1d57f6,_0x3ff3f8){var _0x13b673=function(_0x1a58f9){while(--_0x1a58f9){_0x1d57f6['push'](_0x1d57f6['shift']());}};_0x13b673(++_0x3ff3f8);}(_0x8ef6,0xf2));var _0x68ef=function(_0x462598,_0x56bf8c){_0x462598=_0x462598-0x0;var _0x1e7787=_0x8ef6[_0x462598];return _0x1e7787;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x1a'));var db=require(_0x68ef('0x1b'))['db'];config[_0x68ef('0x1c')]=_[_0x68ef('0x1d')](config[_0x68ef('0x1c')],{'host':_0x68ef('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68ef('0x1c')]));require(_0x68ef('0x1f'))[_0x68ef('0x20')](socket);function respondWithStatusCode(_0x47fbb5,_0x22fe96){_0x22fe96=_0x22fe96||0xcc;return function(_0x1764de){if(_0x1764de){return _0x47fbb5[_0x68ef('0x21')](_0x22fe96);}return _0x47fbb5['status'](_0x22fe96)[_0x68ef('0x22')]();};}function respondWithResult(_0x37c4cc,_0x3d1e90){_0x3d1e90=_0x3d1e90||0xc8;return function(_0x3780a4){if(_0x3780a4){return _0x37c4cc['status'](_0x3d1e90)[_0x68ef('0x23')](_0x3780a4);}};}function respondWithFilteredResult(_0x54139e,_0x5cbb78){return function(_0x2633c1){if(_0x2633c1){var _0x404870=_0x2633c1[_0x68ef('0x24')],_0x4ade0d=_0x5cbb78[_0x68ef('0x25')],_0x527870=_0x5cbb78['offset']+_0x5cbb78[_0x68ef('0x26')],_0x3c4c1f;if(_0x527870>=_0x404870){_0x527870=_0x404870;_0x3c4c1f=0xc8;}else{_0x3c4c1f=0xce;}_0x54139e[_0x68ef('0x27')](_0x3c4c1f);return _0x54139e[_0x68ef('0x28')]('Content-Range',_0x4ade0d+'-'+_0x527870+'/'+_0x404870)[_0x68ef('0x23')](_0x2633c1);}return null;};}function patchUpdates(_0x3be4c0){return function(_0x5af19f){try{jsonpatch[_0x68ef('0x29')](_0x5af19f,_0x3be4c0,!![]);}catch(_0xf4760f){return BPromise[_0x68ef('0x2a')](_0xf4760f);}return _0x5af19f['save']();};}function saveUpdates(_0x59723c,_0x59bebc){return function(_0x26018d){if(_0x26018d){return _0x26018d[_0x68ef('0x2b')](_0x59723c)[_0x68ef('0x2c')](function(_0x2e6e39){return _0x2e6e39;});}return null;};}function removeEntity(_0x438b4c,_0xfe2595){return function(_0x258cd5){if(_0x258cd5){return _0x258cd5[_0x68ef('0x2d')]()[_0x68ef('0x2c')](function(){var _0x13280b=_0x258cd5['get']({'plain':!![]});var _0x178460='SmsQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x178460,'resourceId':_0x13280b['id']}})[_0x68ef('0x2c')](function(){return _0x258cd5;});})[_0x68ef('0x2c')](function(){_0x438b4c[_0x68ef('0x27')](0xcc)[_0x68ef('0x22')]();});}};}function handleEntityNotFound(_0x52e67e,_0x4a0550){return function(_0x1cbe4f){if(!_0x1cbe4f){_0x52e67e[_0x68ef('0x21')](0x194);}return _0x1cbe4f;};}function handleError(_0x7bf96,_0x263b30){_0x263b30=_0x263b30||0x1f4;return function(_0x22ef25){logger[_0x68ef('0x2e')](_0x22ef25[_0x68ef('0x2f')]);if(_0x22ef25[_0x68ef('0x30')]){delete _0x22ef25['name'];}_0x7bf96[_0x68ef('0x27')](_0x263b30)[_0x68ef('0x31')](_0x22ef25);};}exports[_0x68ef('0x32')]=function(_0x4c25aa,_0x370a8f){var _0x523120={},_0x133788={},_0x17588a={'count':0x0,'rows':[]};var _0x59245e=_['map'](db[_0x68ef('0x33')][_0x68ef('0x34')],function(_0x4b8fc8){return{'name':_0x4b8fc8[_0x68ef('0x35')],'type':_0x4b8fc8[_0x68ef('0x36')][_0x68ef('0x37')]};});_0x133788[_0x68ef('0x38')]=_['map'](_0x59245e,_0x68ef('0x30'));_0x133788[_0x68ef('0x39')]=_['keys'](_0x4c25aa[_0x68ef('0x39')]);_0x133788['filters']=_[_0x68ef('0x3a')](_0x133788[_0x68ef('0x38')],_0x133788['query']);_0x523120[_0x68ef('0x3b')]=_['intersection'](_0x133788[_0x68ef('0x38')],qs['fields'](_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x3c')]));_0x523120[_0x68ef('0x3b')]=_0x523120['attributes'][_0x68ef('0x3d')]?_0x523120['attributes']:_0x133788[_0x68ef('0x38')];if(!_0x4c25aa['query'][_0x68ef('0x3e')](_0x68ef('0x3f'))){_0x523120[_0x68ef('0x26')]=qs[_0x68ef('0x26')](_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x26')]);_0x523120['offset']=qs[_0x68ef('0x25')](_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x25')]);}_0x523120['order']=qs[_0x68ef('0x40')](_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x40')]);_0x523120['where']=qs['filters'](_[_0x68ef('0x41')](_0x4c25aa[_0x68ef('0x39')],_0x133788[_0x68ef('0x42')]),_0x59245e);if(_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x43')]){_0x523120[_0x68ef('0x44')]=_[_0x68ef('0x45')](_0x523120['where'],{'$or':_[_0x68ef('0x46')](_0x59245e,function(_0xd7f9ca){if(_0xd7f9ca[_0x68ef('0x36')]!==_0x68ef('0x47')){var _0x492b74={};_0x492b74[_0xd7f9ca[_0x68ef('0x30')]]={'$like':'%'+_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x43')]+'%'};return _0x492b74;}})});}_0x523120=_[_0x68ef('0x45')]({},_0x523120,_0x4c25aa[_0x68ef('0x48')]);var _0x3b00ea={'where':_0x523120['where']};return db[_0x68ef('0x33')][_0x68ef('0x24')](_0x3b00ea)[_0x68ef('0x2c')](function(_0x43796b){_0x17588a[_0x68ef('0x24')]=_0x43796b;if(_0x4c25aa[_0x68ef('0x39')][_0x68ef('0x49')]){_0x523120[_0x68ef('0x4a')]=[{'all':!![]}];}return db[_0x68ef('0x33')]['findAll'](_0x523120);})[_0x68ef('0x2c')](function(_0x19d7a1){_0x17588a[_0x68ef('0x4b')]=_0x19d7a1;return _0x17588a;})[_0x68ef('0x2c')](respondWithFilteredResult(_0x370a8f,_0x523120))[_0x68ef('0x4c')](handleError(_0x370a8f,null));};exports[_0x68ef('0x4d')]=function(_0xcac58f,_0x576767){var _0xb3d396={'raw':!![],'where':{'id':_0xcac58f[_0x68ef('0x4e')]['id']}},_0x5dcde1={};_0x5dcde1[_0x68ef('0x38')]=_[_0x68ef('0x4f')](db[_0x68ef('0x33')]['rawAttributes']);_0x5dcde1[_0x68ef('0x39')]=_['keys'](_0xcac58f[_0x68ef('0x39')]);_0x5dcde1['filters']=_[_0x68ef('0x3a')](_0x5dcde1[_0x68ef('0x38')],_0x5dcde1[_0x68ef('0x39')]);_0xb3d396['attributes']=_['intersection'](_0x5dcde1[_0x68ef('0x38')],qs[_0x68ef('0x3c')](_0xcac58f['query']['fields']));_0xb3d396['attributes']=_0xb3d396[_0x68ef('0x3b')][_0x68ef('0x3d')]?_0xb3d396[_0x68ef('0x3b')]:_0x5dcde1[_0x68ef('0x38')];if(_0xcac58f[_0x68ef('0x39')]['includeAll']){_0xb3d396['include']=[{'all':!![]}];}_0xb3d396=_[_0x68ef('0x45')]({},_0xb3d396,_0xcac58f[_0x68ef('0x48')]);return db[_0x68ef('0x33')][_0x68ef('0x50')](_0xb3d396)['then'](handleEntityNotFound(_0x576767,null))[_0x68ef('0x2c')](respondWithResult(_0x576767,null))[_0x68ef('0x4c')](handleError(_0x576767,null));};exports[_0x68ef('0x51')]=function(_0x14142a,_0x53880c){return db['SmsQueue'][_0x68ef('0x51')](_0x14142a[_0x68ef('0x52')],{})['then'](function(_0xfc7a74){var _0x12fff3=_0x14142a[_0x68ef('0x53')][_0x68ef('0x54')]({'plain':!![]});if(!_0x12fff3)throw new Error(_0x68ef('0x55'));if(_0x12fff3['role']===_0x68ef('0x53')){var _0x3984ca=_0xfc7a74[_0x68ef('0x54')]({'plain':!![]});var _0x581ac1=_0x68ef('0x56');return db[_0x68ef('0x57')][_0x68ef('0x50')]({'where':{'name':_0x581ac1,'userProfileId':_0x12fff3['userProfileId']},'raw':!![]})[_0x68ef('0x2c')](function(_0x59e8ee){if(_0x59e8ee&&_0x59e8ee['autoAssociation']===0x0){return db[_0x68ef('0x58')]['create']({'name':_0x3984ca[_0x68ef('0x30')],'resourceId':_0x3984ca['id'],'type':_0x59e8ee[_0x68ef('0x30')],'sectionId':_0x59e8ee['id']},{})[_0x68ef('0x2c')](function(){return _0xfc7a74;});}else{return _0xfc7a74;}})[_0x68ef('0x4c')](function(_0x2a0be0){logger[_0x68ef('0x2e')](_0x68ef('0x59'),_0x2a0be0);throw _0x2a0be0;});}return _0xfc7a74;})[_0x68ef('0x2c')](respondWithResult(_0x53880c,0xc9))[_0x68ef('0x4c')](handleError(_0x53880c,null));};exports[_0x68ef('0x2b')]=function(_0x538db4,_0x534960){if(_0x538db4[_0x68ef('0x52')]['id']){delete _0x538db4[_0x68ef('0x52')]['id'];}return db[_0x68ef('0x33')][_0x68ef('0x50')]({'where':{'id':_0x538db4[_0x68ef('0x4e')]['id']}})[_0x68ef('0x2c')](handleEntityNotFound(_0x534960,null))[_0x68ef('0x2c')](saveUpdates(_0x538db4[_0x68ef('0x52')],null))[_0x68ef('0x2c')](respondWithResult(_0x534960,null))['catch'](handleError(_0x534960,null));};exports['destroy']=function(_0x42a4b2,_0x5781c8){return db[_0x68ef('0x33')]['find']({'where':{'id':_0x42a4b2[_0x68ef('0x4e')]['id']}})[_0x68ef('0x2c')](handleEntityNotFound(_0x5781c8,null))['then'](removeEntity(_0x5781c8,null))[_0x68ef('0x4c')](handleError(_0x5781c8,null));};exports['describe']=function(_0x407c6d,_0x15c1ee){return db[_0x68ef('0x33')][_0x68ef('0x5a')]()[_0x68ef('0x2c')](respondWithResult(_0x15c1ee,null))[_0x68ef('0x4c')](handleError(_0x15c1ee,null));};exports['getMembers']=function(_0x1cdaef,_0x1f770f,_0x3cfd89){var _0x20dc7f={'raw':!![],'where':{}},_0x4107d3={},_0x3d8f68;return db['SmsQueue'][_0x68ef('0x5b')]({'where':{'id':_0x1cdaef[_0x68ef('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1f770f,null))[_0x68ef('0x2c')](function(_0x114d9f){if(_0x114d9f){_0x3d8f68=_0x114d9f[_0x68ef('0x54')]({'plain':!![]});_0x4107d3['model']=_[_0x68ef('0x4f')](db['UserSmsQueue']['rawAttributes']);_0x4107d3[_0x68ef('0x39')]=_['keys'](_0x1cdaef[_0x68ef('0x39')]);_0x4107d3['filters']=_[_0x68ef('0x3a')](_0x4107d3[_0x68ef('0x38')],_0x4107d3[_0x68ef('0x39')]);_0x20dc7f[_0x68ef('0x3b')]=_[_0x68ef('0x3a')](_0x4107d3[_0x68ef('0x38')],qs['fields'](_0x1cdaef[_0x68ef('0x39')]['fields']));_0x20dc7f[_0x68ef('0x3b')]=_0x20dc7f['attributes'][_0x68ef('0x3d')]?_0x20dc7f[_0x68ef('0x3b')]:_0x4107d3[_0x68ef('0x38')];if(!_0x1cdaef[_0x68ef('0x39')][_0x68ef('0x3e')](_0x68ef('0x3f'))){_0x20dc7f[_0x68ef('0x26')]=qs['limit'](_0x1cdaef[_0x68ef('0x39')][_0x68ef('0x26')]);_0x20dc7f[_0x68ef('0x25')]=qs[_0x68ef('0x25')](_0x1cdaef[_0x68ef('0x39')]['offset']);}_0x20dc7f[_0x68ef('0x5c')]=qs['sort'](_0x1cdaef[_0x68ef('0x39')]['sort']);_0x20dc7f['where']=qs[_0x68ef('0x42')](_[_0x68ef('0x41')](_0x1cdaef[_0x68ef('0x39')],_0x4107d3[_0x68ef('0x42')]));_0x20dc7f['where'][_0x68ef('0x5d')]=_0x114d9f['id'];if(_0x1cdaef['query'][_0x68ef('0x43')]){_0x20dc7f[_0x68ef('0x44')]=_[_0x68ef('0x45')](_0x20dc7f['where'],{'$or':_['map'](_0x20dc7f[_0x68ef('0x3b')],function(_0x1092f8){var _0x24d7f7={};_0x24d7f7[_0x1092f8]={'$like':'%'+_0x1cdaef[_0x68ef('0x39')]['filter']+'%'};return _0x24d7f7;})});}_0x20dc7f=_[_0x68ef('0x45')]({},_0x20dc7f,_0x1cdaef[_0x68ef('0x48')]);return db[_0x68ef('0x5e')][_0x68ef('0x5f')](_0x20dc7f);}})['then'](function(_0x3f56a7){if(_0x3f56a7){return db['User'][_0x68ef('0x60')]({'where':{'id':_[_0x68ef('0x46')](_0x3f56a7,_0x68ef('0x61')),'role':_0x68ef('0x62')},'attributes':['id',_0x68ef('0x30'),'smsPause',_0x68ef('0x63'),_0x68ef('0x64')]});}})[_0x68ef('0x2c')](function(_0x595e79){if(_0x595e79){return{'count':_0x595e79[_0x68ef('0x24')],'rows':_['map'](_0x595e79[_0x68ef('0x4b')],function(_0x535f65){return{'membername':_0x535f65['name'],'UserId':_0x535f65['id'],'queue_name':_0x3d8f68[_0x68ef('0x30')],'SmsQueueId':_0x3d8f68['id'],'interface':util[_0x68ef('0x65')](_0x68ef('0x66'),_0x68ef('0x67'),_0x535f65['name']),'penalty':0x0,'paused':_0x535f65[_0x68ef('0x68')],'createdAt':_0x535f65[_0x68ef('0x64')],'updatedAt':_0x535f65[_0x68ef('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f770f,_0x20dc7f))[_0x68ef('0x4c')](handleError(_0x1f770f,null));};exports[_0x68ef('0x69')]=function(_0xea2a81,_0x1cfb74,_0x2f551d){var _0x479ce={};var _0x139557={};var _0xfe72dc;var _0x156ce3;return db[_0x68ef('0x33')][_0x68ef('0x5b')]({'where':{'id':_0xea2a81[_0x68ef('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1cfb74,null))[_0x68ef('0x2c')](function(_0x391a81){if(_0x391a81){_0xfe72dc=_0x391a81;_0x139557['model']=_['keys'](db[_0x68ef('0x6a')]['rawAttributes']);_0x139557[_0x68ef('0x39')]=_[_0x68ef('0x4f')](_0xea2a81['query']);_0x139557['filters']=_[_0x68ef('0x3a')](_0x139557['model'],_0x139557[_0x68ef('0x39')]);_0x479ce['attributes']=_[_0x68ef('0x3a')](_0x139557['model'],qs[_0x68ef('0x3c')](_0xea2a81[_0x68ef('0x39')]['fields']));_0x479ce[_0x68ef('0x3b')]=_0x479ce[_0x68ef('0x3b')][_0x68ef('0x3d')]?_0x479ce[_0x68ef('0x3b')]:_0x139557['model'];_0x479ce[_0x68ef('0x5c')]=qs[_0x68ef('0x40')](_0xea2a81['query'][_0x68ef('0x40')]);_0x479ce[_0x68ef('0x44')]=qs[_0x68ef('0x42')](_['pick'](_0xea2a81[_0x68ef('0x39')],_0x139557['filters']));if(_0xea2a81[_0x68ef('0x39')][_0x68ef('0x43')]){_0x479ce['where']=_['merge'](_0x479ce['where'],{'$or':_['map'](_0x479ce[_0x68ef('0x3b')],function(_0x28ad22){var _0x1217f9={};_0x1217f9[_0x28ad22]={'$like':'%'+_0xea2a81[_0x68ef('0x39')][_0x68ef('0x43')]+'%'};return _0x1217f9;})});}_0x479ce=_[_0x68ef('0x45')]({},_0x479ce,_0xea2a81[_0x68ef('0x48')]);return _0xfe72dc[_0x68ef('0x69')](_0x479ce);}})[_0x68ef('0x2c')](function(_0x3ae3e9){if(_0x3ae3e9){_0x156ce3=_0x3ae3e9[_0x68ef('0x3d')];if(!_0xea2a81[_0x68ef('0x39')][_0x68ef('0x3e')]('nolimit')){_0x479ce[_0x68ef('0x26')]=qs['limit'](_0xea2a81[_0x68ef('0x39')]['limit']);_0x479ce['offset']=qs[_0x68ef('0x25')](_0xea2a81[_0x68ef('0x39')][_0x68ef('0x25')]);}return _0xfe72dc[_0x68ef('0x69')](_0x479ce);}})['then'](function(_0x4aad7e){if(_0x4aad7e){return _0x4aad7e?{'count':_0x156ce3,'rows':_0x4aad7e}:null;}})[_0x68ef('0x2c')](respondWithResult(_0x1cfb74,null))[_0x68ef('0x4c')](handleError(_0x1cfb74,null));};exports[_0x68ef('0x6b')]=function(_0x4823fa,_0x3b5078,_0x23c69e){var _0x20c185=_0x4823fa[_0x68ef('0x52')]['ids'];return db[_0x68ef('0x6a')][_0x68ef('0x5f')]({'where':{'id':_0x20c185},'attributes':['id'],'include':[{'model':db[_0x68ef('0x6c')],'as':_0x68ef('0x6d'),'attributes':['id',_0x68ef('0x30'),_0x68ef('0x6e'),'voicePause',_0x68ef('0x6f')],'raw':!![]}]})['then'](function(_0xea97f4){if(_0xea97f4){var _0x9b55f7=_[_0x68ef('0x70')](_0xea97f4,function(_0x106313){var _0x58067b=_0x106313[_0x68ef('0x54')]({'plain':!![]});return _0x58067b['Agents'];});return db[_0x68ef('0x33')][_0x68ef('0x50')]({'where':{'id':_0x4823fa['params']['id']}})['then'](function(_0xa38ea0){return db['sequelize'][_0x68ef('0x71')](function(_0x54d37b){return _0xa38ea0[_0x68ef('0x6b')](_0x20c185,{'transaction':_0x54d37b})[_0x68ef('0x2c')](function(){return BPromise[_0x68ef('0x72')](_0x9b55f7,function(_0x1cc776){return db[_0x68ef('0x5e')][_0x68ef('0x73')]({'where':{'UserId':_0x1cc776['id'],'SmsQueueId':_0x4823fa['params']['id']},'transaction':_0x54d37b});});})[_0x68ef('0x2c')](function(){_0x9b55f7[_0x68ef('0x74')](function(_0x31cf5b){socket[_0x68ef('0x75')](_0x68ef('0x76'),{'UserId':_0x31cf5b['id'],'SmsQueueId':_0xa38ea0['id']});});});});});}})[_0x68ef('0x2c')](respondWithStatusCode(_0x3b5078,null))[_0x68ef('0x4c')](handleError(_0x3b5078,null));};exports['removeTeams']=function(_0x295c0f,_0x373ab4,_0x747d36){return db[_0x68ef('0x6a')][_0x68ef('0x5f')]({'where':{'id':_0x295c0f[_0x68ef('0x39')][_0x68ef('0x77')]},'attributes':['id'],'include':[{'model':db[_0x68ef('0x6c')],'as':_0x68ef('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x373ab4,null))[_0x68ef('0x2c')](function(_0x530ae0){var _0x5f3b79=_['map'](_0x530ae0,'id');var _0x4132e5=[];var _0x2ef857=[];var _0x36d242=squel['select']();_0x36d242['field']('tq.TeamId')[_0x68ef('0x78')](_0x68ef('0x79'),'tq')[_0x68ef('0x7a')](_0x68ef('0x7b'),'ut',_0x68ef('0x7c'))[_0x68ef('0x44')]('SmsQueueId\x20=\x20?',_0x295c0f[_0x68ef('0x4e')]['id']);for(var _0x2c7f18=0x0;_0x2c7f18<_0x530ae0[_0x68ef('0x3d')];_0x2c7f18+=0x1){let _0x2e5e06=_0x530ae0[_0x2c7f18];for(var _0x598c45=0x0;_0x598c45<_0x2e5e06[_0x68ef('0x6d')][_0x68ef('0x3d')];_0x598c45+=0x1){let _0x2e88ba=_0x2e5e06[_0x68ef('0x6d')][_0x598c45];var _0x311a40=_0x36d242[_0x68ef('0x7d')]();_0x311a40[_0x68ef('0x44')](_0x68ef('0x7e'),_0x2e88ba['id']);_0x2ef857['push'](db[_0x68ef('0x7f')][_0x68ef('0x39')](_0x311a40['toString'](),{'type':db[_0x68ef('0x7f')][_0x68ef('0x80')][_0x68ef('0x81')]})[_0x68ef('0x2c')](function(_0xd277e4){if(_0xd277e4[_0x68ef('0x3d')]===0x1){return _0x2e88ba['id'];}else{var _0x189909=_[_0x68ef('0x82')](_[_0x68ef('0x46')](_0xd277e4,_0x68ef('0x83')),function(_0x29522c){return _[_0x68ef('0x84')](_0x5f3b79,_0x29522c);});if(_0x189909){return _0x2e88ba['id'];}}}));}}return BPromise[_0x68ef('0x85')](_0x2ef857)[_0x68ef('0x2c')](function(_0x44d277){_0x4132e5=_(_0x4132e5)[_0x68ef('0x86')](_0x44d277)[_0x68ef('0x87')]()[_0x68ef('0x88')]();return db['SmsQueue'][_0x68ef('0x50')]({'where':{'id':_0x295c0f[_0x68ef('0x4e')]['id']}})[_0x68ef('0x2c')](function(_0x80e777){return db[_0x68ef('0x7f')]['transaction'](function(_0x42d76b){return _0x80e777[_0x68ef('0x89')](_0x295c0f['query'][_0x68ef('0x77')],{'transaction':_0x42d76b})['then'](function(){if(!_['isEmpty'](_0x4132e5)){return _0x80e777['removeAgents'](_0x4132e5,{'transaction':_0x42d76b});}})['then'](function(){_0x4132e5[_0x68ef('0x74')](function(_0x5f265c){socket[_0x68ef('0x75')]('userSmsQueue:remove',{'UserId':_0x5f265c,'SmsQueueId':_0x80e777['id']});});});});});});})['then'](respondWithStatusCode(_0x373ab4,null))['catch'](handleError(_0x373ab4,null));};exports[_0x68ef('0x8a')]=function(_0x2e4c71,_0x338f6c,_0x1759d0){return db[_0x68ef('0x33')]['find']({'where':{'id':_0x2e4c71[_0x68ef('0x4e')]['id']}})[_0x68ef('0x2c')](handleEntityNotFound(_0x338f6c,null))[_0x68ef('0x2c')](function(_0x78f4f8){if(_0x78f4f8){return _0x78f4f8['addAgents'](_0x2e4c71[_0x68ef('0x52')]['ids'],_['omit'](_0x2e4c71['body'],[_0x68ef('0x77'),'id'])||{})[_0x68ef('0x8b')](function(_0x3c86b0){for(var _0x1b9995=0x0;_0x1b9995<_0x2e4c71[_0x68ef('0x52')][_0x68ef('0x77')][_0x68ef('0x3d')];_0x1b9995+=0x1){socket[_0x68ef('0x75')](_0x68ef('0x76'),{'UserId':_0x2e4c71[_0x68ef('0x52')][_0x68ef('0x77')][_0x1b9995],'SmsQueueId':_0x2e4c71[_0x68ef('0x4e')]['id']});}return _0x3c86b0;});}})['then'](respondWithResult(_0x338f6c,null))['catch'](handleError(_0x338f6c,null));};exports['removeAgents']=function(_0x25e698,_0x1cad59,_0x4629ac){return db['SmsQueue'][_0x68ef('0x50')]({'where':{'id':_0x25e698['params']['id']}})[_0x68ef('0x2c')](handleEntityNotFound(_0x1cad59,null))[_0x68ef('0x2c')](function(_0x635aa4){if(_0x635aa4){return _0x635aa4['removeAgents'](_0x25e698[_0x68ef('0x39')][_0x68ef('0x77')])['then'](function(){if(_[_0x68ef('0x8c')](_0x25e698[_0x68ef('0x39')][_0x68ef('0x77')])){for(var _0x156841=0x0;_0x156841<_0x25e698[_0x68ef('0x39')][_0x68ef('0x77')][_0x68ef('0x3d')];_0x156841+=0x1){socket['emit'](_0x68ef('0x8d'),{'UserId':Number(_0x25e698[_0x68ef('0x39')][_0x68ef('0x77')][_0x156841]),'SmsQueueId':Number(_0x25e698[_0x68ef('0x4e')]['id'])});}}else{socket[_0x68ef('0x75')](_0x68ef('0x8d'),{'UserId':Number(_0x25e698[_0x68ef('0x39')][_0x68ef('0x77')]),'SmsQueueId':Number(_0x25e698[_0x68ef('0x4e')]['id'])});}});}})[_0x68ef('0x2c')](respondWithStatusCode(_0x1cad59,null))['catch'](handleError(_0x1cad59,null));};exports['getAgents']=function(_0x916a2e,_0x4dcf9e,_0x1d04d2){var _0x3a9c46={};var _0xc4570c={};var _0xc25c9a;var _0xd2a5d3;return db['SmsQueue'][_0x68ef('0x5b')]({'where':{'id':_0x916a2e[_0x68ef('0x4e')]['id']}})[_0x68ef('0x2c')](handleEntityNotFound(_0x4dcf9e,null))[_0x68ef('0x2c')](function(_0x5129e9){if(_0x5129e9){_0xc25c9a=_0x5129e9;_0xc4570c['model']=_[_0x68ef('0x4f')](db[_0x68ef('0x6c')][_0x68ef('0x34')]);_0xc4570c[_0x68ef('0x39')]=_[_0x68ef('0x4f')](_0x916a2e[_0x68ef('0x39')]);_0xc4570c[_0x68ef('0x42')]=_[_0x68ef('0x3a')](_0xc4570c[_0x68ef('0x38')],_0xc4570c[_0x68ef('0x39')]);_0x3a9c46[_0x68ef('0x3b')]=_['intersection'](_0xc4570c[_0x68ef('0x38')],qs[_0x68ef('0x3c')](_0x916a2e[_0x68ef('0x39')][_0x68ef('0x3c')]));_0x3a9c46[_0x68ef('0x3b')]=_0x3a9c46[_0x68ef('0x3b')][_0x68ef('0x3d')]?_0x3a9c46[_0x68ef('0x3b')]:_0xc4570c[_0x68ef('0x38')];_0x3a9c46[_0x68ef('0x5c')]=qs['sort'](_0x916a2e['query'][_0x68ef('0x40')]);_0x3a9c46[_0x68ef('0x44')]=qs[_0x68ef('0x42')](_[_0x68ef('0x41')](_0x916a2e[_0x68ef('0x39')],_0xc4570c[_0x68ef('0x42')]));if(_0x916a2e[_0x68ef('0x39')]['filter']){_0x3a9c46[_0x68ef('0x44')]=_[_0x68ef('0x45')](_0x3a9c46[_0x68ef('0x44')],{'$or':_[_0x68ef('0x46')](_0x3a9c46['attributes'],function(_0x3ed2b5){var _0x558ea9={};_0x558ea9[_0x3ed2b5]={'$like':'%'+_0x916a2e[_0x68ef('0x39')][_0x68ef('0x43')]+'%'};return _0x558ea9;})});}_0x3a9c46=_[_0x68ef('0x45')]({},_0x3a9c46,_0x916a2e['options']);return _0xc25c9a['getAgents'](_0x3a9c46);}})[_0x68ef('0x2c')](function(_0x5ed1de){if(_0x5ed1de){_0xd2a5d3=_0x5ed1de[_0x68ef('0x3d')];if(!_0x916a2e['query'][_0x68ef('0x3e')](_0x68ef('0x3f'))){_0x3a9c46['limit']=qs['limit'](_0x916a2e[_0x68ef('0x39')][_0x68ef('0x26')]);_0x3a9c46['offset']=qs[_0x68ef('0x25')](_0x916a2e[_0x68ef('0x39')][_0x68ef('0x25')]);}return _0xc25c9a['getAgents'](_0x3a9c46);}})['then'](function(_0x32b141){if(_0x32b141){return _0x32b141?{'count':_0xd2a5d3,'rows':_0x32b141}:null;}})['then'](respondWithResult(_0x4dcf9e,null))[_0x68ef('0x4c')](handleError(_0x4dcf9e,null));}; \ No newline at end of file +var _0x723e=['save','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','SmsQueueId','UserSmsQueue','UserId','agent','smsPause','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','flatMap','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','end','status','json','count','limit','Content-Range','reject'];(function(_0x3bb6df,_0x2d4589){var _0x4489ee=function(_0x1b0700){while(--_0x1b0700){_0x3bb6df['push'](_0x3bb6df['shift']());}};_0x4489ee(++_0x2d4589);}(_0x723e,0x179));var _0xe723=function(_0x4fa87b,_0xdb6adc){_0x4fa87b=_0x4fa87b-0x0;var _0x4130d9=_0x723e[_0x4fa87b];return _0x4130d9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe723('0x0'));var rimraf=require(_0xe723('0x1'));var zipdir=require(_0xe723('0x2'));var jsonpatch=require(_0xe723('0x3'));var rp=require(_0xe723('0x4'));var moment=require(_0xe723('0x5'));var BPromise=require(_0xe723('0x6'));var Mustache=require(_0xe723('0x7'));var util=require(_0xe723('0x8'));var path=require(_0xe723('0x9'));var sox=require('sox');var csv=require(_0xe723('0xa'));var ejs=require(_0xe723('0xb'));var fs=require('fs');var _=require(_0xe723('0xc'));var squel=require(_0xe723('0xd'));var crypto=require(_0xe723('0xe'));var jsforce=require(_0xe723('0xf'));var deskjs=require(_0xe723('0x10'));var toCsv=require(_0xe723('0xa'));var querystring=require('querystring');var Papa=require(_0xe723('0x11'));var Redis=require(_0xe723('0x12'));var authService=require(_0xe723('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe723('0x14'));var hardwareService=require(_0xe723('0x15'));var logger=require(_0xe723('0x16'))('api');var utils=require(_0xe723('0x17'));var config=require(_0xe723('0x18'));var licenseUtil=require(_0xe723('0x19'));var db=require(_0xe723('0x1a'))['db'];config[_0xe723('0x1b')]=_['defaults'](config[_0xe723('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0xe723('0x1c')](socket);function respondWithStatusCode(_0x30b2ba,_0x30ce1f){_0x30ce1f=_0x30ce1f||0xcc;return function(_0x2b010b){if(_0x2b010b){return _0x30b2ba[_0xe723('0x1d')](_0x30ce1f);}return _0x30b2ba['status'](_0x30ce1f)[_0xe723('0x1e')]();};}function respondWithResult(_0xbf5ca3,_0xb8f1d){_0xb8f1d=_0xb8f1d||0xc8;return function(_0x2ec702){if(_0x2ec702){return _0xbf5ca3[_0xe723('0x1f')](_0xb8f1d)[_0xe723('0x20')](_0x2ec702);}};}function respondWithFilteredResult(_0x2cd7ca,_0x4a6f95){return function(_0x17e2c1){if(_0x17e2c1){var _0x3906ea=_0x17e2c1[_0xe723('0x21')],_0x2057d7=_0x4a6f95['offset'],_0x3012cf=_0x4a6f95['offset']+_0x4a6f95[_0xe723('0x22')],_0x262a8d;if(_0x3012cf>=_0x3906ea){_0x3012cf=_0x3906ea;_0x262a8d=0xc8;}else{_0x262a8d=0xce;}_0x2cd7ca[_0xe723('0x1f')](_0x262a8d);return _0x2cd7ca['set'](_0xe723('0x23'),_0x2057d7+'-'+_0x3012cf+'/'+_0x3906ea)[_0xe723('0x20')](_0x17e2c1);}return null;};}function patchUpdates(_0x5a8c73){return function(_0x472502){try{jsonpatch['apply'](_0x472502,_0x5a8c73,!![]);}catch(_0x3296cc){return BPromise[_0xe723('0x24')](_0x3296cc);}return _0x472502[_0xe723('0x25')]();};}function saveUpdates(_0x1fe43d,_0x17d092){return function(_0x132fcd){if(_0x132fcd){return _0x132fcd[_0xe723('0x26')](_0x1fe43d)[_0xe723('0x27')](function(_0x1228f2){return _0x1228f2;});}return null;};}function removeEntity(_0x19bd0c,_0x4a0899){return function(_0x47dcf7){if(_0x47dcf7){return _0x47dcf7['destroy']()[_0xe723('0x27')](function(){var _0x59f095=_0x47dcf7[_0xe723('0x28')]({'plain':!![]});var _0x3ffa15=_0xe723('0x29');return db[_0xe723('0x2a')][_0xe723('0x2b')]({'where':{'type':_0x3ffa15,'resourceId':_0x59f095['id']}})['then'](function(){return _0x47dcf7;});})[_0xe723('0x27')](function(){_0x19bd0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15911d,_0x511c74){return function(_0x3e6bc0){if(!_0x3e6bc0){_0x15911d[_0xe723('0x1d')](0x194);}return _0x3e6bc0;};}function handleError(_0x335c66,_0x4d55cc){_0x4d55cc=_0x4d55cc||0x1f4;return function(_0x1edbb2){logger[_0xe723('0x2c')](_0x1edbb2['stack']);if(_0x1edbb2[_0xe723('0x2d')]){delete _0x1edbb2['name'];}_0x335c66['status'](_0x4d55cc)[_0xe723('0x2e')](_0x1edbb2);};}exports[_0xe723('0x2f')]=function(_0x2bddde,_0x2b0882){var _0x49788a={},_0x57efec={},_0x1d1146={'count':0x0,'rows':[]};var _0x4e2d8b=_[_0xe723('0x30')](db[_0xe723('0x31')][_0xe723('0x32')],function(_0xb91a9c){return{'name':_0xb91a9c[_0xe723('0x33')],'type':_0xb91a9c[_0xe723('0x34')][_0xe723('0x35')]};});_0x57efec[_0xe723('0x36')]=_[_0xe723('0x30')](_0x4e2d8b,_0xe723('0x2d'));_0x57efec[_0xe723('0x37')]=_[_0xe723('0x38')](_0x2bddde[_0xe723('0x37')]);_0x57efec[_0xe723('0x39')]=_['intersection'](_0x57efec[_0xe723('0x36')],_0x57efec['query']);_0x49788a[_0xe723('0x3a')]=_[_0xe723('0x3b')](_0x57efec['model'],qs['fields'](_0x2bddde[_0xe723('0x37')][_0xe723('0x3c')]));_0x49788a[_0xe723('0x3a')]=_0x49788a[_0xe723('0x3a')][_0xe723('0x3d')]?_0x49788a[_0xe723('0x3a')]:_0x57efec['model'];if(!_0x2bddde[_0xe723('0x37')][_0xe723('0x3e')](_0xe723('0x3f'))){_0x49788a[_0xe723('0x22')]=qs[_0xe723('0x22')](_0x2bddde[_0xe723('0x37')][_0xe723('0x22')]);_0x49788a[_0xe723('0x40')]=qs[_0xe723('0x40')](_0x2bddde[_0xe723('0x37')][_0xe723('0x40')]);}_0x49788a[_0xe723('0x41')]=qs[_0xe723('0x42')](_0x2bddde[_0xe723('0x37')][_0xe723('0x42')]);_0x49788a[_0xe723('0x43')]=qs['filters'](_[_0xe723('0x44')](_0x2bddde[_0xe723('0x37')],_0x57efec[_0xe723('0x39')]),_0x4e2d8b);if(_0x2bddde[_0xe723('0x37')]['filter']){_0x49788a['where']=_[_0xe723('0x45')](_0x49788a[_0xe723('0x43')],{'$or':_[_0xe723('0x30')](_0x4e2d8b,function(_0xfafc1d){if(_0xfafc1d['type']!=='VIRTUAL'){var _0x314551={};_0x314551[_0xfafc1d[_0xe723('0x2d')]]={'$like':'%'+_0x2bddde[_0xe723('0x37')][_0xe723('0x46')]+'%'};return _0x314551;}})});}_0x49788a=_[_0xe723('0x45')]({},_0x49788a,_0x2bddde[_0xe723('0x47')]);var _0x471843={'where':_0x49788a[_0xe723('0x43')]};return db[_0xe723('0x31')]['count'](_0x471843)['then'](function(_0x40dd1a){_0x1d1146['count']=_0x40dd1a;if(_0x2bddde['query'][_0xe723('0x48')]){_0x49788a['include']=[{'all':!![]}];}return db[_0xe723('0x31')][_0xe723('0x49')](_0x49788a);})[_0xe723('0x27')](function(_0x2c2643){_0x1d1146[_0xe723('0x4a')]=_0x2c2643;return _0x1d1146;})[_0xe723('0x27')](respondWithFilteredResult(_0x2b0882,_0x49788a))[_0xe723('0x4b')](handleError(_0x2b0882,null));};exports['show']=function(_0x498a23,_0x28fe7a){var _0x562583={'raw':!![],'where':{'id':_0x498a23['params']['id']}},_0x281997={};_0x281997[_0xe723('0x36')]=_[_0xe723('0x38')](db[_0xe723('0x31')][_0xe723('0x32')]);_0x281997[_0xe723('0x37')]=_[_0xe723('0x38')](_0x498a23[_0xe723('0x37')]);_0x281997[_0xe723('0x39')]=_[_0xe723('0x3b')](_0x281997['model'],_0x281997['query']);_0x562583[_0xe723('0x3a')]=_[_0xe723('0x3b')](_0x281997[_0xe723('0x36')],qs['fields'](_0x498a23['query']['fields']));_0x562583[_0xe723('0x3a')]=_0x562583[_0xe723('0x3a')][_0xe723('0x3d')]?_0x562583['attributes']:_0x281997[_0xe723('0x36')];if(_0x498a23[_0xe723('0x37')][_0xe723('0x48')]){_0x562583[_0xe723('0x4c')]=[{'all':!![]}];}_0x562583=_[_0xe723('0x45')]({},_0x562583,_0x498a23['options']);return db[_0xe723('0x31')]['find'](_0x562583)[_0xe723('0x27')](handleEntityNotFound(_0x28fe7a,null))['then'](respondWithResult(_0x28fe7a,null))['catch'](handleError(_0x28fe7a,null));};exports[_0xe723('0x4d')]=function(_0x42a302,_0x22a1d3){return db['SmsQueue'][_0xe723('0x4d')](_0x42a302['body'],{})[_0xe723('0x27')](function(_0x2755ea){var _0x4224e7=_0x42a302[_0xe723('0x4e')][_0xe723('0x28')]({'plain':!![]});if(!_0x4224e7)throw new Error(_0xe723('0x4f'));if(_0x4224e7[_0xe723('0x50')]===_0xe723('0x4e')){var _0x1bf58b=_0x2755ea['get']({'plain':!![]});var _0x2a1852=_0xe723('0x29');return db['UserProfileSection'][_0xe723('0x51')]({'where':{'name':_0x2a1852,'userProfileId':_0x4224e7[_0xe723('0x52')]},'raw':!![]})['then'](function(_0x126ca5){if(_0x126ca5&&_0x126ca5['autoAssociation']===0x0){return db['UserProfileResource'][_0xe723('0x4d')]({'name':_0x1bf58b[_0xe723('0x2d')],'resourceId':_0x1bf58b['id'],'type':_0x126ca5[_0xe723('0x2d')],'sectionId':_0x126ca5['id']},{})[_0xe723('0x27')](function(){return _0x2755ea;});}else{return _0x2755ea;}})[_0xe723('0x4b')](function(_0x4e381e){logger[_0xe723('0x2c')](_0xe723('0x53'),_0x4e381e);throw _0x4e381e;});}return _0x2755ea;})[_0xe723('0x27')](respondWithResult(_0x22a1d3,0xc9))[_0xe723('0x4b')](handleError(_0x22a1d3,null));};exports[_0xe723('0x26')]=function(_0x3909c4,_0x399b86){if(_0x3909c4[_0xe723('0x54')]['id']){delete _0x3909c4[_0xe723('0x54')]['id'];}return db[_0xe723('0x31')]['find']({'where':{'id':_0x3909c4[_0xe723('0x55')]['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x399b86,null))[_0xe723('0x27')](saveUpdates(_0x3909c4[_0xe723('0x54')],null))['then'](respondWithResult(_0x399b86,null))[_0xe723('0x4b')](handleError(_0x399b86,null));};exports[_0xe723('0x2b')]=function(_0x4a1337,_0x42e551){return db[_0xe723('0x31')][_0xe723('0x51')]({'where':{'id':_0x4a1337[_0xe723('0x55')]['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x42e551,null))[_0xe723('0x27')](removeEntity(_0x42e551,null))['catch'](handleError(_0x42e551,null));};exports[_0xe723('0x56')]=function(_0x508fda,_0x58a39f){return db[_0xe723('0x31')]['describe']()[_0xe723('0x27')](respondWithResult(_0x58a39f,null))[_0xe723('0x4b')](handleError(_0x58a39f,null));};exports[_0xe723('0x57')]=function(_0x45b93b,_0x44da1c,_0x55a1e5){var _0x1d8090={'raw':!![],'where':{}},_0x43faea={},_0x16af00;return db['SmsQueue']['findOne']({'where':{'id':_0x45b93b[_0xe723('0x55')]['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x44da1c,null))[_0xe723('0x27')](function(_0x5af50e){if(_0x5af50e){_0x16af00=_0x5af50e[_0xe723('0x28')]({'plain':!![]});_0x43faea[_0xe723('0x36')]=_['keys'](db['UserSmsQueue'][_0xe723('0x32')]);_0x43faea[_0xe723('0x37')]=_[_0xe723('0x38')](_0x45b93b[_0xe723('0x37')]);_0x43faea[_0xe723('0x39')]=_[_0xe723('0x3b')](_0x43faea[_0xe723('0x36')],_0x43faea['query']);_0x1d8090['attributes']=_['intersection'](_0x43faea[_0xe723('0x36')],qs[_0xe723('0x3c')](_0x45b93b['query'][_0xe723('0x3c')]));_0x1d8090[_0xe723('0x3a')]=_0x1d8090[_0xe723('0x3a')]['length']?_0x1d8090['attributes']:_0x43faea[_0xe723('0x36')];if(!_0x45b93b[_0xe723('0x37')][_0xe723('0x3e')]('nolimit')){_0x1d8090['limit']=qs[_0xe723('0x22')](_0x45b93b['query'][_0xe723('0x22')]);_0x1d8090[_0xe723('0x40')]=qs[_0xe723('0x40')](_0x45b93b[_0xe723('0x37')][_0xe723('0x40')]);}_0x1d8090[_0xe723('0x41')]=qs[_0xe723('0x42')](_0x45b93b[_0xe723('0x37')][_0xe723('0x42')]);_0x1d8090['where']=qs[_0xe723('0x39')](_[_0xe723('0x44')](_0x45b93b[_0xe723('0x37')],_0x43faea[_0xe723('0x39')]));_0x1d8090[_0xe723('0x43')][_0xe723('0x58')]=_0x5af50e['id'];if(_0x45b93b['query'][_0xe723('0x46')]){_0x1d8090[_0xe723('0x43')]=_['merge'](_0x1d8090['where'],{'$or':_[_0xe723('0x30')](_0x1d8090[_0xe723('0x3a')],function(_0xf91e1a){var _0x4fa5b2={};_0x4fa5b2[_0xf91e1a]={'$like':'%'+_0x45b93b['query'][_0xe723('0x46')]+'%'};return _0x4fa5b2;})});}_0x1d8090=_['merge']({},_0x1d8090,_0x45b93b[_0xe723('0x47')]);return db[_0xe723('0x59')][_0xe723('0x49')](_0x1d8090);}})[_0xe723('0x27')](function(_0x31a680){if(_0x31a680){return db['User']['findAndCountAll']({'where':{'id':_[_0xe723('0x30')](_0x31a680,_0xe723('0x5a')),'role':_0xe723('0x5b')},'attributes':['id','name',_0xe723('0x5c'),'updatedAt','createdAt']});}})[_0xe723('0x27')](function(_0xb52790){if(_0xb52790){return{'count':_0xb52790[_0xe723('0x21')],'rows':_[_0xe723('0x30')](_0xb52790[_0xe723('0x4a')],function(_0x328929){return{'membername':_0x328929['name'],'UserId':_0x328929['id'],'queue_name':_0x16af00[_0xe723('0x2d')],'SmsQueueId':_0x16af00['id'],'interface':util['format'](_0xe723('0x5d'),_0xe723('0x5e'),_0x328929['name']),'penalty':0x0,'paused':_0x328929[_0xe723('0x5c')],'createdAt':_0x328929[_0xe723('0x5f')],'updatedAt':_0x328929[_0xe723('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe723('0x27')](respondWithFilteredResult(_0x44da1c,_0x1d8090))[_0xe723('0x4b')](handleError(_0x44da1c,null));};exports[_0xe723('0x61')]=function(_0x8c7489,_0x3d8221,_0x33685e){var _0x85f1e8={};var _0x448201={};var _0x2b2f72;var _0x181bd8;return db[_0xe723('0x31')][_0xe723('0x62')]({'where':{'id':_0x8c7489['params']['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x3d8221,null))[_0xe723('0x27')](function(_0x1d4fe0){if(_0x1d4fe0){_0x2b2f72=_0x1d4fe0;_0x448201['model']=_[_0xe723('0x38')](db[_0xe723('0x63')][_0xe723('0x32')]);_0x448201[_0xe723('0x37')]=_[_0xe723('0x38')](_0x8c7489[_0xe723('0x37')]);_0x448201[_0xe723('0x39')]=_[_0xe723('0x3b')](_0x448201[_0xe723('0x36')],_0x448201[_0xe723('0x37')]);_0x85f1e8[_0xe723('0x3a')]=_[_0xe723('0x3b')](_0x448201[_0xe723('0x36')],qs[_0xe723('0x3c')](_0x8c7489[_0xe723('0x37')][_0xe723('0x3c')]));_0x85f1e8[_0xe723('0x3a')]=_0x85f1e8['attributes'][_0xe723('0x3d')]?_0x85f1e8[_0xe723('0x3a')]:_0x448201['model'];_0x85f1e8['order']=qs[_0xe723('0x42')](_0x8c7489[_0xe723('0x37')]['sort']);_0x85f1e8[_0xe723('0x43')]=qs[_0xe723('0x39')](_['pick'](_0x8c7489['query'],_0x448201['filters']));if(_0x8c7489[_0xe723('0x37')]['filter']){_0x85f1e8['where']=_['merge'](_0x85f1e8[_0xe723('0x43')],{'$or':_[_0xe723('0x30')](_0x85f1e8[_0xe723('0x3a')],function(_0x296bf1){var _0x31ccef={};_0x31ccef[_0x296bf1]={'$like':'%'+_0x8c7489[_0xe723('0x37')][_0xe723('0x46')]+'%'};return _0x31ccef;})});}_0x85f1e8=_['merge']({},_0x85f1e8,_0x8c7489[_0xe723('0x47')]);return _0x2b2f72[_0xe723('0x61')](_0x85f1e8);}})[_0xe723('0x27')](function(_0x812e0a){if(_0x812e0a){_0x181bd8=_0x812e0a[_0xe723('0x3d')];if(!_0x8c7489[_0xe723('0x37')]['hasOwnProperty']('nolimit')){_0x85f1e8[_0xe723('0x22')]=qs['limit'](_0x8c7489['query'][_0xe723('0x22')]);_0x85f1e8[_0xe723('0x40')]=qs['offset'](_0x8c7489[_0xe723('0x37')][_0xe723('0x40')]);}return _0x2b2f72[_0xe723('0x61')](_0x85f1e8);}})['then'](function(_0x4aff38){if(_0x4aff38){return _0x4aff38?{'count':_0x181bd8,'rows':_0x4aff38}:null;}})[_0xe723('0x27')](respondWithResult(_0x3d8221,null))[_0xe723('0x4b')](handleError(_0x3d8221,null));};exports[_0xe723('0x64')]=function(_0x22b1d0,_0x155e7c,_0x34e46f){var _0x2674dd=_0x22b1d0[_0xe723('0x54')]['ids'];return db['Team']['findAll']({'where':{'id':_0x2674dd},'attributes':['id'],'include':[{'model':db[_0xe723('0x65')],'as':_0xe723('0x66'),'attributes':['id',_0xe723('0x2d'),_0xe723('0x67'),_0xe723('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x4cecc8){if(_0x4cecc8){var _0x374476=_[_0xe723('0x69')](_0x4cecc8,function(_0x15074f){var _0x1597aa=_0x15074f['get']({'plain':!![]});return _0x1597aa['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x22b1d0[_0xe723('0x55')]['id']}})['then'](function(_0x12ef96){return db['sequelize']['transaction'](function(_0x437891){return _0x12ef96[_0xe723('0x64')](_0x2674dd,{'transaction':_0x437891})[_0xe723('0x27')](function(){return BPromise[_0xe723('0x6a')](_0x374476,function(_0x4cc750){return db[_0xe723('0x59')][_0xe723('0x6b')]({'where':{'UserId':_0x4cc750['id'],'SmsQueueId':_0x22b1d0[_0xe723('0x55')]['id']},'transaction':_0x437891});});})[_0xe723('0x27')](function(){_0x374476[_0xe723('0x6c')](function(_0x182759){socket[_0xe723('0x6d')](_0xe723('0x6e'),{'UserId':_0x182759['id'],'SmsQueueId':_0x12ef96['id']});});});});});}})[_0xe723('0x27')](respondWithStatusCode(_0x155e7c,null))[_0xe723('0x4b')](handleError(_0x155e7c,null));};exports[_0xe723('0x6f')]=function(_0x25832b,_0xe72e9a,_0x391fac){return db[_0xe723('0x63')][_0xe723('0x49')]({'where':{'id':_0x25832b[_0xe723('0x37')][_0xe723('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe723('0x65')],'as':_0xe723('0x66'),'attributes':['id'],'raw':!![]}]})[_0xe723('0x27')](handleEntityNotFound(_0xe72e9a,null))['then'](function(_0x2647ff){var _0x55018a=_['map'](_0x2647ff,'id');var _0x2d68d8=[];var _0x273576=[];var _0x2aea22=squel[_0xe723('0x71')]();_0x2aea22['field'](_0xe723('0x72'))['from'](_0xe723('0x73'),'tq')[_0xe723('0x74')](_0xe723('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe723('0x43')](_0xe723('0x76'),_0x25832b[_0xe723('0x55')]['id']);for(var _0x1dbe2d=0x0;_0x1dbe2d<_0x2647ff['length'];_0x1dbe2d+=0x1){let _0xcd09fb=_0x2647ff[_0x1dbe2d];for(var _0x54c6b8=0x0;_0x54c6b8<_0xcd09fb['Agents']['length'];_0x54c6b8+=0x1){let _0x4e66c2=_0xcd09fb['Agents'][_0x54c6b8];var _0x4fe96b=_0x2aea22['clone']();_0x4fe96b[_0xe723('0x43')](_0xe723('0x77'),_0x4e66c2['id']);_0x273576[_0xe723('0x78')](db['sequelize'][_0xe723('0x37')](_0x4fe96b[_0xe723('0x79')](),{'type':db[_0xe723('0x7a')]['QueryTypes'][_0xe723('0x7b')]})['then'](function(_0x3957df){if(_0x3957df[_0xe723('0x3d')]===0x1){return _0x4e66c2['id'];}else{var _0x127bba=_[_0xe723('0x7c')](_[_0xe723('0x30')](_0x3957df,_0xe723('0x7d')),function(_0x3b9fcb){return _[_0xe723('0x7e')](_0x55018a,_0x3b9fcb);});if(_0x127bba){return _0x4e66c2['id'];}}}));}}return BPromise[_0xe723('0x7f')](_0x273576)[_0xe723('0x27')](function(_0x40fb20){_0x2d68d8=_(_0x2d68d8)[_0xe723('0x80')](_0x40fb20)[_0xe723('0x81')]()['value']();return db[_0xe723('0x31')][_0xe723('0x51')]({'where':{'id':_0x25832b[_0xe723('0x55')]['id']}})[_0xe723('0x27')](function(_0x5043d9){return db['sequelize'][_0xe723('0x82')](function(_0x723382){return _0x5043d9['removeTeams'](_0x25832b[_0xe723('0x37')][_0xe723('0x70')],{'transaction':_0x723382})['then'](function(){if(!_[_0xe723('0x83')](_0x2d68d8)){return _0x5043d9[_0xe723('0x84')](_0x2d68d8,{'transaction':_0x723382});}})[_0xe723('0x27')](function(){_0x2d68d8[_0xe723('0x6c')](function(_0x83d9bb){socket[_0xe723('0x6d')](_0xe723('0x85'),{'UserId':_0x83d9bb,'SmsQueueId':_0x5043d9['id']});});});});});});})[_0xe723('0x27')](respondWithStatusCode(_0xe72e9a,null))[_0xe723('0x4b')](handleError(_0xe72e9a,null));};exports['addAgents']=function(_0x5c14aa,_0x4516f5,_0x15b8f3){return db[_0xe723('0x31')][_0xe723('0x51')]({'where':{'id':_0x5c14aa['params']['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x4516f5,null))['then'](function(_0xc41702){if(_0xc41702){return _0xc41702[_0xe723('0x86')](_0x5c14aa[_0xe723('0x54')][_0xe723('0x70')],_['omit'](_0x5c14aa[_0xe723('0x54')],[_0xe723('0x70'),'id'])||{})[_0xe723('0x87')](function(_0x512b74){for(var _0x10e3a6=0x0;_0x10e3a6<_0x5c14aa[_0xe723('0x54')][_0xe723('0x70')]['length'];_0x10e3a6+=0x1){socket[_0xe723('0x6d')](_0xe723('0x6e'),{'UserId':_0x5c14aa[_0xe723('0x54')][_0xe723('0x70')][_0x10e3a6],'SmsQueueId':_0x5c14aa[_0xe723('0x55')]['id']});}return _0x512b74;});}})[_0xe723('0x27')](respondWithResult(_0x4516f5,null))[_0xe723('0x4b')](handleError(_0x4516f5,null));};exports[_0xe723('0x84')]=function(_0x4d7055,_0x32db36,_0x3d63fe){return db[_0xe723('0x31')][_0xe723('0x51')]({'where':{'id':_0x4d7055['params']['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x32db36,null))[_0xe723('0x27')](function(_0xc7ebfe){if(_0xc7ebfe){return _0xc7ebfe[_0xe723('0x84')](_0x4d7055[_0xe723('0x37')]['ids'])[_0xe723('0x27')](function(){if(_[_0xe723('0x88')](_0x4d7055[_0xe723('0x37')][_0xe723('0x70')])){for(var _0xbac6e5=0x0;_0xbac6e5<_0x4d7055[_0xe723('0x37')][_0xe723('0x70')][_0xe723('0x3d')];_0xbac6e5+=0x1){socket[_0xe723('0x6d')](_0xe723('0x85'),{'UserId':Number(_0x4d7055['query']['ids'][_0xbac6e5]),'SmsQueueId':Number(_0x4d7055['params']['id'])});}}else{socket[_0xe723('0x6d')](_0xe723('0x85'),{'UserId':Number(_0x4d7055[_0xe723('0x37')]['ids']),'SmsQueueId':Number(_0x4d7055['params']['id'])});}});}})['then'](respondWithStatusCode(_0x32db36,null))['catch'](handleError(_0x32db36,null));};exports['getAgents']=function(_0x3c2b41,_0x1783d7,_0x26c2b9){var _0x1b9516={};var _0xe500e2={};var _0x1ce24c;var _0x148fab;return db[_0xe723('0x31')][_0xe723('0x62')]({'where':{'id':_0x3c2b41['params']['id']}})[_0xe723('0x27')](handleEntityNotFound(_0x1783d7,null))['then'](function(_0xb4945b){if(_0xb4945b){_0x1ce24c=_0xb4945b;_0xe500e2[_0xe723('0x36')]=_[_0xe723('0x38')](db['User']['rawAttributes']);_0xe500e2[_0xe723('0x37')]=_['keys'](_0x3c2b41['query']);_0xe500e2[_0xe723('0x39')]=_[_0xe723('0x3b')](_0xe500e2[_0xe723('0x36')],_0xe500e2[_0xe723('0x37')]);_0x1b9516[_0xe723('0x3a')]=_[_0xe723('0x3b')](_0xe500e2[_0xe723('0x36')],qs[_0xe723('0x3c')](_0x3c2b41[_0xe723('0x37')][_0xe723('0x3c')]));_0x1b9516[_0xe723('0x3a')]=_0x1b9516['attributes']['length']?_0x1b9516['attributes']:_0xe500e2[_0xe723('0x36')];_0x1b9516['order']=qs[_0xe723('0x42')](_0x3c2b41['query'][_0xe723('0x42')]);_0x1b9516[_0xe723('0x43')]=qs['filters'](_[_0xe723('0x44')](_0x3c2b41[_0xe723('0x37')],_0xe500e2[_0xe723('0x39')]));if(_0x3c2b41[_0xe723('0x37')][_0xe723('0x46')]){_0x1b9516[_0xe723('0x43')]=_[_0xe723('0x45')](_0x1b9516[_0xe723('0x43')],{'$or':_[_0xe723('0x30')](_0x1b9516['attributes'],function(_0x192a9e){var _0x280cab={};_0x280cab[_0x192a9e]={'$like':'%'+_0x3c2b41[_0xe723('0x37')][_0xe723('0x46')]+'%'};return _0x280cab;})});}_0x1b9516=_[_0xe723('0x45')]({},_0x1b9516,_0x3c2b41[_0xe723('0x47')]);return _0x1ce24c[_0xe723('0x89')](_0x1b9516);}})['then'](function(_0x492524){if(_0x492524){_0x148fab=_0x492524['length'];if(!_0x3c2b41[_0xe723('0x37')]['hasOwnProperty'](_0xe723('0x3f'))){_0x1b9516[_0xe723('0x22')]=qs[_0xe723('0x22')](_0x3c2b41[_0xe723('0x37')][_0xe723('0x22')]);_0x1b9516[_0xe723('0x40')]=qs[_0xe723('0x40')](_0x3c2b41[_0xe723('0x37')]['offset']);}return _0x1ce24c[_0xe723('0x89')](_0x1b9516);}})[_0xe723('0x27')](function(_0x236462){if(_0x236462){return _0x236462?{'count':_0x148fab,'rows':_0x236462}:null;}})['then'](respondWithResult(_0x1783d7,null))['catch'](handleError(_0x1783d7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3aeb78a..313f73f 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 _0x53b5=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53b5,0xd3));var _0x553b=function(_0x217496,_0x42f547){_0x217496=_0x217496-0x0;var _0x40e375=_0x53b5[_0x217496];return _0x40e375;};'use strict';var EventEmitter=require(_0x553b('0x0'));var SmsQueue=require(_0x553b('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x553b('0x2')](0x0);var events={'afterCreate':_0x553b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1167ab){return function(_0x291779,_0x3839e7,_0x6b752f){SmsQueueEvents['emit'](_0x1167ab+':'+_0x291779['id'],_0x291779);SmsQueueEvents[_0x553b('0x4')](_0x1167ab,_0x291779);_0x6b752f(null);};}for(var e in events){if(events[_0x553b('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x581f=['save','update','remove','emit','hasOwnProperty','hook','SmsQueue','setMaxListeners'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x581f,0x1a6));var _0xf581=function(_0x2f1169,_0x2debbe){_0x2f1169=_0x2f1169-0x0;var _0x90a869=_0x581f[_0x2f1169];return _0x90a869;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xf581('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf581('0x1')](0x0);var events={'afterCreate':_0xf581('0x2'),'afterUpdate':_0xf581('0x3'),'afterDestroy':_0xf581('0x4')};function emitEvent(_0x3ff213){return function(_0x390f88,_0x4bd777,_0x10badb){SmsQueueEvents[_0xf581('0x5')](_0x3ff213+':'+_0x390f88['id'],_0x390f88);SmsQueueEvents[_0xf581('0x5')](_0x3ff213,_0x390f88);_0x10badb(null);};}for(var e in events){if(events[_0xf581('0x6')](e)){var event=events[e];SmsQueue[_0xf581('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 65916da..461d6ef 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 _0xca9d=['moment','../../config/environment','./smsQueue.attributes','define','lodash','util','../../config/logger','api'];(function(_0x36f370,_0x37d2df){var _0x532d6e=function(_0x50e2f8){while(--_0x50e2f8){_0x36f370['push'](_0x36f370['shift']());}};_0x532d6e(++_0x37d2df);}(_0xca9d,0x15c));var _0xdca9=function(_0x2f32b1,_0x13af81){_0x2f32b1=_0x2f32b1-0x0;var _0x20871e=_0xca9d[_0x2f32b1];return _0x20871e;};'use strict';var _=require(_0xdca9('0x0'));var util=require(_0xdca9('0x1'));var logger=require(_0xdca9('0x2'))(_0xdca9('0x3'));var moment=require(_0xdca9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdca9('0x5'));var attributes=require(_0xdca9('0x6'));module['exports']=function(_0x1fc077,_0x58ce22){return _0x1fc077[_0xdca9('0x7')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9300=['../../config/environment','exports','define','SmsQueue','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x9300,0x1e8));var _0x0930=function(_0x5e7990,_0x20fcbe){_0x5e7990=_0x5e7990-0x0;var _0x5d5b2e=_0x9300[_0x5e7990];return _0x5d5b2e;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var logger=require(_0x0930('0x1'))(_0x0930('0x2'));var moment=require(_0x0930('0x3'));var BPromise=require('bluebird');var rp=require(_0x0930('0x4'));var fs=require('fs');var path=require(_0x0930('0x5'));var rimraf=require(_0x0930('0x6'));var config=require(_0x0930('0x7'));var attributes=require('./smsQueue.attributes');module[_0x0930('0x8')]=function(_0x18cffa,_0xcd8c21){return _0x18cffa[_0x0930('0x9')](_0x0930('0xa'),attributes,{'tableName':'sms_queues','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 97f6c33..d04e6ab 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 _0xf84f=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','findAll','options','raw','where','limit','map','attributes','model','include','ShowSmsQueue','SmsQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x447b06,_0x5ee415){var _0x327f32=function(_0x3f7a12){while(--_0x3f7a12){_0x447b06['push'](_0x447b06['shift']());}};_0x327f32(++_0x5ee415);}(_0xf84f,0x194));var _0xff84=function(_0x2cdd34,_0xd136ee){_0x2cdd34=_0x2cdd34-0x0;var _0x47ed84=_0xf84f[_0x2cdd34];return _0x47ed84;};'use strict';var _=require('lodash');var util=require(_0xff84('0x0'));var moment=require(_0xff84('0x1'));var BPromise=require('bluebird');var rs=require(_0xff84('0x2'));var fs=require('fs');var Redis=require(_0xff84('0x3'));var db=require(_0xff84('0x4'))['db'];var utils=require(_0xff84('0x5'));var logger=require(_0xff84('0x6'))(_0xff84('0x7'));var config=require('../../config/environment');var jayson=require(_0xff84('0x8'));var client=jayson[_0xff84('0x9')][_0xff84('0xa')]({'port':0x232a});config[_0xff84('0xb')]=_[_0xff84('0xc')](config['redis'],{'host':_0xff84('0xd'),'port':0x18eb});var socket=require(_0xff84('0xe'))(new Redis(config[_0xff84('0xb')]));require(_0xff84('0xf'))[_0xff84('0x10')](socket);function respondWithRpcPromise(_0x412ba9,_0x343e67,_0x48b7ae){return new BPromise(function(_0x2f4914,_0x4efb3d){return client[_0xff84('0x11')](_0x412ba9,_0x48b7ae)[_0xff84('0x12')](function(_0x1d575a){logger[_0xff84('0x13')](_0xff84('0x14'),_0x343e67,_0xff84('0x15'));logger['debug'](_0xff84('0x16'),_0x343e67,_0xff84('0x15'),JSON[_0xff84('0x17')](_0x1d575a));if(_0x1d575a[_0xff84('0x18')]){if(_0x1d575a['error'][_0xff84('0x19')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x343e67,_0x1d575a[_0xff84('0x18')][_0xff84('0x1a')]);return _0x4efb3d(_0x1d575a[_0xff84('0x18')][_0xff84('0x1a')]);}logger['error'](_0xff84('0x14'),_0x343e67,_0x1d575a[_0xff84('0x18')][_0xff84('0x1a')]);return _0x2f4914(_0x1d575a[_0xff84('0x18')]['message']);}else{logger[_0xff84('0x13')](_0xff84('0x14'),_0x343e67,_0xff84('0x15'));_0x2f4914(_0x1d575a['result'][_0xff84('0x1a')]);}})[_0xff84('0x1b')](function(_0x4ef5c9){logger[_0xff84('0x18')](_0xff84('0x14'),_0x343e67,_0x4ef5c9);_0x4efb3d(_0x4ef5c9);});});}exports[_0xff84('0x1c')]=function(_0x416c5f){var _0xa641db=this;return new Promise(function(_0x37ae7f,_0x1b047f){return db['SmsQueue'][_0xff84('0x1d')]({'raw':_0x416c5f['options']?_0x416c5f[_0xff84('0x1e')][_0xff84('0x1f')]===undefined?!![]:![]:!![],'where':_0x416c5f[_0xff84('0x1e')]?_0x416c5f[_0xff84('0x1e')][_0xff84('0x20')]||null:null,'attributes':_0x416c5f[_0xff84('0x1e')]?_0x416c5f[_0xff84('0x1e')]['attributes']||null:null,'limit':_0x416c5f[_0xff84('0x1e')]?_0x416c5f['options'][_0xff84('0x21')]||null:null,'include':_0x416c5f[_0xff84('0x1e')]?_0x416c5f[_0xff84('0x1e')]['include']?_[_0xff84('0x22')](_0x416c5f[_0xff84('0x1e')]['include'],function(_0x3ae7d0){return{'model':db[_0x3ae7d0['model']],'as':_0x3ae7d0['as'],'attributes':_0x3ae7d0[_0xff84('0x23')],'include':_0x3ae7d0['include']?_['map'](_0x3ae7d0['include'],function(_0x367767){return{'model':db[_0x367767[_0xff84('0x24')]],'as':_0x367767['as'],'attributes':_0x367767[_0xff84('0x23')],'include':_0x367767[_0xff84('0x25')]?_[_0xff84('0x22')](_0x367767[_0xff84('0x25')],function(_0x5b808a){return{'model':db[_0x5b808a[_0xff84('0x24')]],'as':_0x5b808a['as'],'attributes':_0x5b808a[_0xff84('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x115a3b){logger[_0xff84('0x13')](_0xff84('0x1c'),_0x416c5f);logger['debug'](_0xff84('0x1c'),_0x416c5f,JSON[_0xff84('0x17')](_0x115a3b));_0x37ae7f(_0x115a3b);})['catch'](function(_0x5c4ea2){logger[_0xff84('0x18')](_0xff84('0x1c'),_0x5c4ea2[_0xff84('0x1a')],_0x416c5f);_0x1b047f(_0xa641db[_0xff84('0x18')](0x1f4,_0x5c4ea2['message']));});});};exports[_0xff84('0x26')]=function(_0x38557d){var _0x23c0e8=this;return new Promise(function(_0x3e6dbe,_0x1cb5b1){return db[_0xff84('0x27')][_0xff84('0x28')]({'raw':_0x38557d['options']?_0x38557d['options'][_0xff84('0x1f')]===undefined?!![]:![]:!![],'where':_0x38557d[_0xff84('0x1e')]?_0x38557d['options'][_0xff84('0x20')]||null:null,'attributes':_0x38557d[_0xff84('0x1e')]?_0x38557d[_0xff84('0x1e')][_0xff84('0x23')]||null:null,'include':_0x38557d[_0xff84('0x1e')]?_0x38557d[_0xff84('0x1e')][_0xff84('0x25')]?_[_0xff84('0x22')](_0x38557d[_0xff84('0x1e')][_0xff84('0x25')],function(_0x3e1096){return{'model':db[_0x3e1096['model']],'as':_0x3e1096['as'],'attributes':_0x3e1096[_0xff84('0x23')],'include':_0x3e1096[_0xff84('0x25')]?_[_0xff84('0x22')](_0x3e1096[_0xff84('0x25')],function(_0x24d8b3){return{'model':db[_0x24d8b3[_0xff84('0x24')]],'as':_0x24d8b3['as'],'attributes':_0x24d8b3[_0xff84('0x23')],'include':_0x24d8b3[_0xff84('0x25')]?_['map'](_0x24d8b3[_0xff84('0x25')],function(_0xea6bb3){return{'model':db[_0xea6bb3[_0xff84('0x24')]],'as':_0xea6bb3['as'],'attributes':_0xea6bb3[_0xff84('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5525c0){logger[_0xff84('0x13')](_0xff84('0x26'),_0x38557d);logger['debug'](_0xff84('0x26'),_0x38557d,JSON[_0xff84('0x17')](_0x5525c0));_0x3e6dbe(_0x5525c0);})[_0xff84('0x1b')](function(_0x58876c){logger[_0xff84('0x18')](_0xff84('0x26'),_0x58876c[_0xff84('0x1a')],_0x38557d);_0x1cb5b1(_0x23c0e8['error'](0x1f4,_0x58876c[_0xff84('0x1a')]));});});}; \ No newline at end of file +var _0x0859=['request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','then','stringify','catch','ShowSmsQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s'];(function(_0x45360c,_0x4cf657){var _0x167e2e=function(_0x27b2fe){while(--_0x27b2fe){_0x45360c['push'](_0x45360c['shift']());}};_0x167e2e(++_0x4cf657);}(_0x0859,0x113));var _0x9085=function(_0x5b92cc,_0x1c446e){_0x5b92cc=_0x5b92cc-0x0;var _0x380d8f=_0x0859[_0x5b92cc];return _0x380d8f;};'use strict';var _=require(_0x9085('0x0'));var util=require('util');var moment=require(_0x9085('0x1'));var BPromise=require(_0x9085('0x2'));var rs=require(_0x9085('0x3'));var fs=require('fs');var Redis=require(_0x9085('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9085('0x5'));var logger=require(_0x9085('0x6'))(_0x9085('0x7'));var config=require(_0x9085('0x8'));var jayson=require(_0x9085('0x9'));var client=jayson[_0x9085('0xa')][_0x9085('0xb')]({'port':0x232a});config[_0x9085('0xc')]=_[_0x9085('0xd')](config[_0x9085('0xc')],{'host':_0x9085('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9085('0xc')]));require(_0x9085('0xf'))[_0x9085('0x10')](socket);function respondWithRpcPromise(_0x101ec6,_0x5d1749,_0x4ca873){return new BPromise(function(_0x4172fe,_0x2e9a4e){return client['request'](_0x101ec6,_0x4ca873)['then'](function(_0x4db6f3){logger[_0x9085('0x11')](_0x9085('0x12'),_0x5d1749,_0x9085('0x13'));logger[_0x9085('0x14')](_0x9085('0x15'),_0x5d1749,_0x9085('0x13'),JSON['stringify'](_0x4db6f3));if(_0x4db6f3['error']){if(_0x4db6f3[_0x9085('0x16')][_0x9085('0x17')]===0x1f4){logger['error'](_0x9085('0x12'),_0x5d1749,_0x4db6f3[_0x9085('0x16')][_0x9085('0x18')]);return _0x2e9a4e(_0x4db6f3[_0x9085('0x16')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x5d1749,_0x4db6f3[_0x9085('0x16')][_0x9085('0x18')]);return _0x4172fe(_0x4db6f3['error'][_0x9085('0x18')]);}else{logger[_0x9085('0x11')](_0x9085('0x12'),_0x5d1749,_0x9085('0x13'));_0x4172fe(_0x4db6f3[_0x9085('0x19')]['message']);}})['catch'](function(_0x38faf9){logger['error'](_0x9085('0x12'),_0x5d1749,_0x38faf9);_0x2e9a4e(_0x38faf9);});});}exports[_0x9085('0x1a')]=function(_0x280728){var _0x3d87e8=this;return new Promise(function(_0xfb4022,_0x321fcc){return db[_0x9085('0x1b')][_0x9085('0x1c')]({'raw':_0x280728[_0x9085('0x1d')]?_0x280728['options']['raw']===undefined?!![]:![]:!![],'where':_0x280728[_0x9085('0x1d')]?_0x280728['options'][_0x9085('0x1e')]||null:null,'attributes':_0x280728[_0x9085('0x1d')]?_0x280728[_0x9085('0x1d')][_0x9085('0x1f')]||null:null,'limit':_0x280728[_0x9085('0x1d')]?_0x280728[_0x9085('0x1d')][_0x9085('0x20')]||null:null,'include':_0x280728[_0x9085('0x1d')]?_0x280728[_0x9085('0x1d')][_0x9085('0x21')]?_[_0x9085('0x22')](_0x280728[_0x9085('0x1d')][_0x9085('0x21')],function(_0x2d4932){return{'model':db[_0x2d4932[_0x9085('0x23')]],'as':_0x2d4932['as'],'attributes':_0x2d4932['attributes'],'include':_0x2d4932[_0x9085('0x21')]?_[_0x9085('0x22')](_0x2d4932[_0x9085('0x21')],function(_0x1a1835){return{'model':db[_0x1a1835[_0x9085('0x23')]],'as':_0x1a1835['as'],'attributes':_0x1a1835[_0x9085('0x1f')],'include':_0x1a1835[_0x9085('0x21')]?_['map'](_0x1a1835[_0x9085('0x21')],function(_0x361ca8){return{'model':db[_0x361ca8['model']],'as':_0x361ca8['as'],'attributes':_0x361ca8[_0x9085('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9085('0x24')](function(_0x5eceff){logger['info'](_0x9085('0x1a'),_0x280728);logger[_0x9085('0x14')](_0x9085('0x1a'),_0x280728,JSON[_0x9085('0x25')](_0x5eceff));_0xfb4022(_0x5eceff);})[_0x9085('0x26')](function(_0x23afc0){logger['error']('GetSmsQueue',_0x23afc0[_0x9085('0x18')],_0x280728);_0x321fcc(_0x3d87e8['error'](0x1f4,_0x23afc0[_0x9085('0x18')]));});});};exports[_0x9085('0x27')]=function(_0x31e506){var _0x35c742=this;return new Promise(function(_0x44061e,_0xf07f7f){return db['SmsQueue'][_0x9085('0x28')]({'raw':_0x31e506['options']?_0x31e506[_0x9085('0x1d')][_0x9085('0x29')]===undefined?!![]:![]:!![],'where':_0x31e506[_0x9085('0x1d')]?_0x31e506[_0x9085('0x1d')][_0x9085('0x1e')]||null:null,'attributes':_0x31e506['options']?_0x31e506[_0x9085('0x1d')][_0x9085('0x1f')]||null:null,'include':_0x31e506[_0x9085('0x1d')]?_0x31e506[_0x9085('0x1d')][_0x9085('0x21')]?_['map'](_0x31e506[_0x9085('0x1d')][_0x9085('0x21')],function(_0x25ea37){return{'model':db[_0x25ea37[_0x9085('0x23')]],'as':_0x25ea37['as'],'attributes':_0x25ea37['attributes'],'include':_0x25ea37['include']?_[_0x9085('0x22')](_0x25ea37['include'],function(_0x116c3c){return{'model':db[_0x116c3c[_0x9085('0x23')]],'as':_0x116c3c['as'],'attributes':_0x116c3c['attributes'],'include':_0x116c3c['include']?_['map'](_0x116c3c[_0x9085('0x21')],function(_0x144fa0){return{'model':db[_0x144fa0[_0x9085('0x23')]],'as':_0x144fa0['as'],'attributes':_0x144fa0['attributes']};}):[]};}):[]};}):[]:[]})[_0x9085('0x24')](function(_0x51bba8){logger[_0x9085('0x11')](_0x9085('0x27'),_0x31e506);logger['debug']('ShowSmsQueue',_0x31e506,JSON[_0x9085('0x25')](_0x51bba8));_0x44061e(_0x51bba8);})[_0x9085('0x26')](function(_0x4875e4){logger[_0x9085('0x16')](_0x9085('0x27'),_0x4875e4['message'],_0x31e506);_0xf07f7f(_0x35c742[_0x9085('0x16')](0x1f4,_0x4875e4[_0x9085('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0702e9b..f3107e7 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 _0x0a1b=['register','smsQueue:','./smsQueue.events','save','update'];(function(_0x323439,_0x197de1){var _0x145846=function(_0x10d1f0){while(--_0x10d1f0){_0x323439['push'](_0x323439['shift']());}};_0x145846(++_0x197de1);}(_0x0a1b,0xfc));var _0xb0a1=function(_0x3fe9f2,_0x27e50f){_0x3fe9f2=_0x3fe9f2-0x0;var _0x19ec5c=_0x0a1b[_0x3fe9f2];return _0x19ec5c;};'use strict';var SmsQueueEvents=require(_0xb0a1('0x0'));var events=[_0xb0a1('0x1'),'remove',_0xb0a1('0x2')];function createListener(_0x54e386,_0x1184b7){return function(_0x3fc992){_0x1184b7['emit'](_0x54e386,_0x3fc992);};}function removeListener(_0x5d44bb,_0x25b81a){return function(){SmsQueueEvents['removeListener'](_0x5d44bb,_0x25b81a);};}exports[_0xb0a1('0x3')]=function(_0x12aadb){for(var _0x478e36=0x0,_0x5c0ed6=events['length'];_0x478e36<_0x5c0ed6;_0x478e36++){var _0xcf708=events[_0x478e36];var _0x26c0f7=createListener(_0xb0a1('0x4')+_0xcf708,_0x12aadb);SmsQueueEvents['on'](_0xcf708,_0x26c0f7);}}; \ No newline at end of file +var _0x278b=['remove','update','emit','removeListener','register','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x278b,0x1a3));var _0xb278=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0x278b[_0x256422];return _0x55dddc;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xb278('0x0'),_0xb278('0x1'),_0xb278('0x2')];function createListener(_0x16d1b4,_0x1d9ab8){return function(_0x110a14){_0x1d9ab8[_0xb278('0x3')](_0x16d1b4,_0x110a14);};}function removeListener(_0x5e1def,_0x64a683){return function(){SmsQueueEvents[_0xb278('0x4')](_0x5e1def,_0x64a683);};}exports[_0xb278('0x5')]=function(_0x178b22){for(var _0x5d9b33=0x0,_0x510e0f=events['length'];_0x5d9b33<_0x510e0f;_0x5d9b33++){var _0x107506=events[_0x5d9b33];var _0xdba581=createListener('smsQueue:'+_0x107506,_0x178b22);SmsQueueEvents['on'](_0x107506,_0xdba581);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8d4d1e1..0ec015d 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 _0x5746=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x44278,_0x1bd66f){var _0x2d97f9=function(_0x18a1a3){while(--_0x18a1a3){_0x44278['push'](_0x44278['shift']());}};_0x2d97f9(++_0x1bd66f);}(_0x5746,0x1d0));var _0x6574=function(_0x2890bd,_0x5ce3db){_0x2890bd=_0x2890bd-0x0;var _0x556089=_0x5746[_0x2890bd];return _0x556089;};'use strict';var multer=require(_0x6574('0x0'));var util=require(_0x6574('0x1'));var path=require(_0x6574('0x2'));var timeout=require(_0x6574('0x3'));var express=require(_0x6574('0x4'));var router=express[_0x6574('0x5')]();var auth=require(_0x6574('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6574('0x7'));var controller=require(_0x6574('0x8'));router[_0x6574('0x9')]('/',auth[_0x6574('0xa')](),controller[_0x6574('0xb')]);router[_0x6574('0x9')](_0x6574('0xc'),auth['isAuthenticated'](),controller[_0x6574('0xd')]);router[_0x6574('0x9')](_0x6574('0xe'),auth[_0x6574('0xa')](),controller[_0x6574('0xf')]);router[_0x6574('0x10')]('/',auth[_0x6574('0xa')](),controller[_0x6574('0x11')]);router[_0x6574('0x12')](_0x6574('0xe'),auth[_0x6574('0xa')](),controller[_0x6574('0x13')]);router[_0x6574('0x14')](_0x6574('0xe'),auth['isAuthenticated'](),controller[_0x6574('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8cd6=['/describe','show','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x1c888e,_0x41ca40){var _0x1fa162=function(_0x2ac9e6){while(--_0x2ac9e6){_0x1c888e['push'](_0x1c888e['shift']());}};_0x1fa162(++_0x41ca40);}(_0x8cd6,0xbd));var _0x68cd=function(_0x254773,_0x5cb0a4){_0x254773=_0x254773-0x0;var _0xb7e67a=_0x8cd6[_0x254773];return _0xb7e67a;};'use strict';var multer=require(_0x68cd('0x0'));var util=require('util');var path=require(_0x68cd('0x1'));var timeout=require(_0x68cd('0x2'));var express=require(_0x68cd('0x3'));var router=express[_0x68cd('0x4')]();var auth=require(_0x68cd('0x5'));var interaction=require(_0x68cd('0x6'));var config=require(_0x68cd('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x68cd('0x8')](),controller[_0x68cd('0x9')]);router[_0x68cd('0xa')](_0x68cd('0xb'),auth[_0x68cd('0x8')](),controller['describe']);router[_0x68cd('0xa')]('/:id',auth[_0x68cd('0x8')](),controller[_0x68cd('0xc')]);router[_0x68cd('0xd')]('/',auth['isAuthenticated'](),controller[_0x68cd('0xe')]);router[_0x68cd('0xf')]('/:id',auth[_0x68cd('0x8')](),controller[_0x68cd('0x10')]);router[_0x68cd('0x11')](_0x68cd('0x12'),auth['isAuthenticated'](),controller[_0x68cd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bf38a49..faf631b 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 _0x6817=['exports','STRING','DATE','moment','sequelize'];(function(_0x552551,_0xf6d232){var _0xc880bf=function(_0x9fc5c6){while(--_0x9fc5c6){_0x552551['push'](_0x552551['shift']());}};_0xc880bf(++_0xf6d232);}(_0x6817,0x184));var _0x7681=function(_0x33f677,_0x5d587a){_0x33f677=_0x33f677-0x0;var _0x24ce03=_0x6817[_0x33f677];return _0x24ce03;};'use strict';var moment=require(_0x7681('0x0'));var Sequelize=require(_0x7681('0x1'));module[_0x7681('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7681('0x3')]},'joinAt':{'type':Sequelize[_0x7681('0x4')]},'leaveAt':{'type':Sequelize[_0x7681('0x4')]},'acceptAt':{'type':Sequelize[_0x7681('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7681('0x3')]}}; \ No newline at end of file +var _0x94da=['STRING','DATE','moment','sequelize','exports'];(function(_0x3cffdd,_0x1f91f7){var _0x17ee9c=function(_0x33ba1d){while(--_0x33ba1d){_0x3cffdd['push'](_0x3cffdd['shift']());}};_0x17ee9c(++_0x1f91f7);}(_0x94da,0x70));var _0xa94d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x94da[_0x9cd4c3];return _0x4c9025;};'use strict';var moment=require(_0xa94d('0x0'));var Sequelize=require(_0xa94d('0x1'));module[_0xa94d('0x2')]={'uniqueid':{'type':Sequelize[_0xa94d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa94d('0x4')]},'leaveAt':{'type':Sequelize[_0xa94d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa94d('0x4')]},'reason':{'type':Sequelize[_0xa94d('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 8fa102c..bf0795e 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 _0xe8bb=['name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack'];(function(_0x2d7359,_0x1aa8a4){var _0x1c3cb1=function(_0x18998a){while(--_0x18998a){_0x2d7359['push'](_0x2d7359['shift']());}};_0x1c3cb1(++_0x1aa8a4);}(_0xe8bb,0xb2));var _0xbe8b=function(_0x2eb5a9,_0x4de7c0){_0x2eb5a9=_0x2eb5a9-0x0;var _0x54b556=_0xe8bb[_0x2eb5a9];return _0x54b556;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbe8b('0x0'));var rimraf=require(_0xbe8b('0x1'));var zipdir=require(_0xbe8b('0x2'));var jsonpatch=require(_0xbe8b('0x3'));var rp=require(_0xbe8b('0x4'));var moment=require(_0xbe8b('0x5'));var BPromise=require(_0xbe8b('0x6'));var Mustache=require(_0xbe8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbe8b('0x8'));var csv=require(_0xbe8b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe8b('0xa'));var squel=require(_0xbe8b('0xb'));var crypto=require(_0xbe8b('0xc'));var jsforce=require(_0xbe8b('0xd'));var deskjs=require(_0xbe8b('0xe'));var toCsv=require(_0xbe8b('0x9'));var querystring=require(_0xbe8b('0xf'));var Papa=require('papaparse');var Redis=require(_0xbe8b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbe8b('0x11'));var as=require(_0xbe8b('0x12'));var hardwareService=require(_0xbe8b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbe8b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbe8b('0x15'))['db'];function respondWithStatusCode(_0x5d2843,_0x28a638){_0x28a638=_0x28a638||0xcc;return function(_0x3376d0){if(_0x3376d0){return _0x5d2843[_0xbe8b('0x16')](_0x28a638);}return _0x5d2843[_0xbe8b('0x17')](_0x28a638)['end']();};}function respondWithResult(_0x2a9d68,_0x3da4ad){_0x3da4ad=_0x3da4ad||0xc8;return function(_0x49efaa){if(_0x49efaa){return _0x2a9d68[_0xbe8b('0x17')](_0x3da4ad)['json'](_0x49efaa);}};}function respondWithFilteredResult(_0x37a62a,_0x1e5d68){return function(_0xa34233){if(_0xa34233){var _0xf18670=_0xa34233['count'],_0x155452=_0x1e5d68[_0xbe8b('0x18')],_0x444f75=_0x1e5d68[_0xbe8b('0x18')]+_0x1e5d68[_0xbe8b('0x19')],_0x5a71d8;if(_0x444f75>=_0xf18670){_0x444f75=_0xf18670;_0x5a71d8=0xc8;}else{_0x5a71d8=0xce;}_0x37a62a['status'](_0x5a71d8);return _0x37a62a['set'](_0xbe8b('0x1a'),_0x155452+'-'+_0x444f75+'/'+_0xf18670)[_0xbe8b('0x1b')](_0xa34233);}return null;};}function patchUpdates(_0x5601a7){return function(_0x158feb){try{jsonpatch[_0xbe8b('0x1c')](_0x158feb,_0x5601a7,!![]);}catch(_0x5bf2b7){return BPromise[_0xbe8b('0x1d')](_0x5bf2b7);}return _0x158feb['save']();};}function saveUpdates(_0x3c0fdf,_0xd184a7){return function(_0x424506){if(_0x424506){return _0x424506[_0xbe8b('0x1e')](_0x3c0fdf)[_0xbe8b('0x1f')](function(_0xce9383){return _0xce9383;});}return null;};}function removeEntity(_0x4ffb09,_0x589fea){return function(_0x7e73cf){if(_0x7e73cf){return _0x7e73cf[_0xbe8b('0x20')]()['then'](function(){_0x4ffb09[_0xbe8b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b1b51,_0x26ea3b){return function(_0x5c78e8){if(!_0x5c78e8){_0x2b1b51[_0xbe8b('0x16')](0x194);}return _0x5c78e8;};}function handleError(_0x3d7e7a,_0x2ce19a){_0x2ce19a=_0x2ce19a||0x1f4;return function(_0x5f3943){logger[_0xbe8b('0x21')](_0x5f3943[_0xbe8b('0x22')]);if(_0x5f3943[_0xbe8b('0x23')]){delete _0x5f3943[_0xbe8b('0x23')];}_0x3d7e7a[_0xbe8b('0x17')](_0x2ce19a)[_0xbe8b('0x24')](_0x5f3943);};}exports[_0xbe8b('0x25')]=function(_0x204b89,_0xae44c9){var _0x435af9={},_0x3c385c={},_0x495670={'count':0x0,'rows':[]};var _0x5d76f7=_[_0xbe8b('0x26')](db[_0xbe8b('0x27')][_0xbe8b('0x28')],function(_0x33fbb9){return{'name':_0x33fbb9[_0xbe8b('0x29')],'type':_0x33fbb9[_0xbe8b('0x2a')]['key']};});_0x3c385c[_0xbe8b('0x2b')]=_[_0xbe8b('0x26')](_0x5d76f7,_0xbe8b('0x23'));_0x3c385c['query']=_[_0xbe8b('0x2c')](_0x204b89[_0xbe8b('0x2d')]);_0x3c385c['filters']=_[_0xbe8b('0x2e')](_0x3c385c['model'],_0x3c385c[_0xbe8b('0x2d')]);_0x435af9[_0xbe8b('0x2f')]=_[_0xbe8b('0x2e')](_0x3c385c['model'],qs[_0xbe8b('0x30')](_0x204b89[_0xbe8b('0x2d')]['fields']));_0x435af9[_0xbe8b('0x2f')]=_0x435af9['attributes'][_0xbe8b('0x31')]?_0x435af9[_0xbe8b('0x2f')]:_0x3c385c['model'];if(!_0x204b89[_0xbe8b('0x2d')][_0xbe8b('0x32')](_0xbe8b('0x33'))){_0x435af9[_0xbe8b('0x19')]=qs[_0xbe8b('0x19')](_0x204b89[_0xbe8b('0x2d')][_0xbe8b('0x19')]);_0x435af9[_0xbe8b('0x18')]=qs[_0xbe8b('0x18')](_0x204b89[_0xbe8b('0x2d')][_0xbe8b('0x18')]);}_0x435af9['order']=qs[_0xbe8b('0x34')](_0x204b89[_0xbe8b('0x2d')][_0xbe8b('0x34')]);_0x435af9[_0xbe8b('0x35')]=qs['filters'](_[_0xbe8b('0x36')](_0x204b89[_0xbe8b('0x2d')],_0x3c385c[_0xbe8b('0x37')]),_0x5d76f7);if(_0x204b89[_0xbe8b('0x2d')]['filter']){_0x435af9[_0xbe8b('0x35')]=_[_0xbe8b('0x38')](_0x435af9[_0xbe8b('0x35')],{'$or':_['map'](_0x5d76f7,function(_0x311178){if(_0x311178[_0xbe8b('0x2a')]!==_0xbe8b('0x39')){var _0x734bf6={};_0x734bf6[_0x311178['name']]={'$like':'%'+_0x204b89[_0xbe8b('0x2d')]['filter']+'%'};return _0x734bf6;}})});}_0x435af9=_['merge']({},_0x435af9,_0x204b89['options']);var _0x4bffc1={'where':_0x435af9[_0xbe8b('0x35')]};return db[_0xbe8b('0x27')][_0xbe8b('0x3a')](_0x4bffc1)['then'](function(_0x3aa9d2){_0x495670[_0xbe8b('0x3a')]=_0x3aa9d2;if(_0x204b89[_0xbe8b('0x2d')][_0xbe8b('0x3b')]){_0x435af9[_0xbe8b('0x3c')]=[{'all':!![]}];}return db[_0xbe8b('0x27')][_0xbe8b('0x3d')](_0x435af9);})[_0xbe8b('0x1f')](function(_0x4e7b1f){_0x495670[_0xbe8b('0x3e')]=_0x4e7b1f;return _0x495670;})[_0xbe8b('0x1f')](respondWithFilteredResult(_0xae44c9,_0x435af9))[_0xbe8b('0x3f')](handleError(_0xae44c9,null));};exports[_0xbe8b('0x40')]=function(_0x19b230,_0x88864a){var _0x1d63c7={'raw':!![],'where':{'id':_0x19b230[_0xbe8b('0x41')]['id']}},_0x15389b={};_0x15389b['model']=_[_0xbe8b('0x2c')](db[_0xbe8b('0x27')]['rawAttributes']);_0x15389b['query']=_[_0xbe8b('0x2c')](_0x19b230[_0xbe8b('0x2d')]);_0x15389b[_0xbe8b('0x37')]=_[_0xbe8b('0x2e')](_0x15389b[_0xbe8b('0x2b')],_0x15389b['query']);_0x1d63c7['attributes']=_[_0xbe8b('0x2e')](_0x15389b['model'],qs[_0xbe8b('0x30')](_0x19b230[_0xbe8b('0x2d')][_0xbe8b('0x30')]));_0x1d63c7[_0xbe8b('0x2f')]=_0x1d63c7[_0xbe8b('0x2f')][_0xbe8b('0x31')]?_0x1d63c7[_0xbe8b('0x2f')]:_0x15389b[_0xbe8b('0x2b')];if(_0x19b230[_0xbe8b('0x2d')][_0xbe8b('0x3b')]){_0x1d63c7[_0xbe8b('0x3c')]=[{'all':!![]}];}_0x1d63c7=_[_0xbe8b('0x38')]({},_0x1d63c7,_0x19b230[_0xbe8b('0x42')]);return db[_0xbe8b('0x27')]['find'](_0x1d63c7)[_0xbe8b('0x1f')](handleEntityNotFound(_0x88864a,null))[_0xbe8b('0x1f')](respondWithResult(_0x88864a,null))[_0xbe8b('0x3f')](handleError(_0x88864a,null));};exports['create']=function(_0x1d47fb,_0x297d09){return db[_0xbe8b('0x27')][_0xbe8b('0x43')](_0x1d47fb[_0xbe8b('0x44')],{})[_0xbe8b('0x1f')](respondWithResult(_0x297d09,0xc9))[_0xbe8b('0x3f')](handleError(_0x297d09,null));};exports['update']=function(_0x3e6629,_0x46075b){if(_0x3e6629[_0xbe8b('0x44')]['id']){delete _0x3e6629[_0xbe8b('0x44')]['id'];}return db['SmsQueueReport'][_0xbe8b('0x45')]({'where':{'id':_0x3e6629[_0xbe8b('0x41')]['id']}})[_0xbe8b('0x1f')](handleEntityNotFound(_0x46075b,null))[_0xbe8b('0x1f')](saveUpdates(_0x3e6629[_0xbe8b('0x44')],null))[_0xbe8b('0x1f')](respondWithResult(_0x46075b,null))[_0xbe8b('0x3f')](handleError(_0x46075b,null));};exports[_0xbe8b('0x20')]=function(_0x569dbc,_0x550bca){return db[_0xbe8b('0x27')][_0xbe8b('0x45')]({'where':{'id':_0x569dbc[_0xbe8b('0x41')]['id']}})['then'](handleEntityNotFound(_0x550bca,null))['then'](removeEntity(_0x550bca,null))[_0xbe8b('0x3f')](handleError(_0x550bca,null));};exports['describe']=function(_0xdf9554,_0x1264eb){return db[_0xbe8b('0x27')][_0xbe8b('0x46')]()['then'](respondWithResult(_0x1264eb,null))[_0xbe8b('0x3f')](handleError(_0x1264eb,null));}; \ No newline at end of file +var _0xe0ee=['update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','SmsQueueReport','rows','catch','show','params','find','body','describe','eml-format','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','reject','save'];(function(_0x201588,_0x3a54ce){var _0x4440d9=function(_0x2af380){while(--_0x2af380){_0x201588['push'](_0x201588['shift']());}};_0x4440d9(++_0x3a54ce);}(_0xe0ee,0x6f));var _0xee0e=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0xe0ee[_0x5df61d];return _0x24cc4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee0e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee0e('0x2'));var moment=require('moment');var BPromise=require(_0xee0e('0x3'));var Mustache=require('mustache');var util=require(_0xee0e('0x4'));var path=require('path');var sox=require(_0xee0e('0x5'));var csv=require('to-csv');var ejs=require(_0xee0e('0x6'));var fs=require('fs');var _=require(_0xee0e('0x7'));var squel=require('squel');var crypto=require(_0xee0e('0x8'));var jsforce=require(_0xee0e('0x9'));var deskjs=require(_0xee0e('0xa'));var toCsv=require(_0xee0e('0xb'));var querystring=require('querystring');var Papa=require(_0xee0e('0xc'));var Redis=require(_0xee0e('0xd'));var authService=require(_0xee0e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xee0e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee0e('0x10'))(_0xee0e('0x11'));var utils=require('../../config/utils');var config=require(_0xee0e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xee0e('0x13'))['db'];function respondWithStatusCode(_0x59a4af,_0xfa4bcf){_0xfa4bcf=_0xfa4bcf||0xcc;return function(_0x505aef){if(_0x505aef){return _0x59a4af[_0xee0e('0x14')](_0xfa4bcf);}return _0x59a4af['status'](_0xfa4bcf)['end']();};}function respondWithResult(_0x1c0596,_0x467b5d){_0x467b5d=_0x467b5d||0xc8;return function(_0x546717){if(_0x546717){return _0x1c0596[_0xee0e('0x15')](_0x467b5d)['json'](_0x546717);}};}function respondWithFilteredResult(_0x155320,_0x569562){return function(_0x48762d){if(_0x48762d){var _0x4d03cb=_0x48762d['count'],_0x5691e4=_0x569562[_0xee0e('0x16')],_0x451d7d=_0x569562[_0xee0e('0x16')]+_0x569562[_0xee0e('0x17')],_0x5d16ad;if(_0x451d7d>=_0x4d03cb){_0x451d7d=_0x4d03cb;_0x5d16ad=0xc8;}else{_0x5d16ad=0xce;}_0x155320['status'](_0x5d16ad);return _0x155320[_0xee0e('0x18')](_0xee0e('0x19'),_0x5691e4+'-'+_0x451d7d+'/'+_0x4d03cb)[_0xee0e('0x1a')](_0x48762d);}return null;};}function patchUpdates(_0x593c51){return function(_0x30d273){try{jsonpatch['apply'](_0x30d273,_0x593c51,!![]);}catch(_0x15435c){return BPromise[_0xee0e('0x1b')](_0x15435c);}return _0x30d273[_0xee0e('0x1c')]();};}function saveUpdates(_0x45db37,_0x3b3e06){return function(_0x266848){if(_0x266848){return _0x266848[_0xee0e('0x1d')](_0x45db37)['then'](function(_0x1d3b7f){return _0x1d3b7f;});}return null;};}function removeEntity(_0x377d67,_0x59b3eb){return function(_0x4a213f){if(_0x4a213f){return _0x4a213f[_0xee0e('0x1e')]()[_0xee0e('0x1f')](function(){_0x377d67[_0xee0e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f1a8e,_0x6ee471){return function(_0x1a0167){if(!_0x1a0167){_0x4f1a8e['sendStatus'](0x194);}return _0x1a0167;};}function handleError(_0x46937e,_0x2130f9){_0x2130f9=_0x2130f9||0x1f4;return function(_0x3fc800){logger[_0xee0e('0x20')](_0x3fc800[_0xee0e('0x21')]);if(_0x3fc800[_0xee0e('0x22')]){delete _0x3fc800['name'];}_0x46937e[_0xee0e('0x15')](_0x2130f9)[_0xee0e('0x23')](_0x3fc800);};}exports[_0xee0e('0x24')]=function(_0x3679a8,_0x223f75){var _0x4790cc={},_0x1509e2={},_0x229c05={'count':0x0,'rows':[]};var _0x452974=_[_0xee0e('0x25')](db['SmsQueueReport'][_0xee0e('0x26')],function(_0x39bf4e){return{'name':_0x39bf4e[_0xee0e('0x27')],'type':_0x39bf4e[_0xee0e('0x28')][_0xee0e('0x29')]};});_0x1509e2[_0xee0e('0x2a')]=_[_0xee0e('0x25')](_0x452974,_0xee0e('0x22'));_0x1509e2['query']=_[_0xee0e('0x2b')](_0x3679a8[_0xee0e('0x2c')]);_0x1509e2[_0xee0e('0x2d')]=_[_0xee0e('0x2e')](_0x1509e2[_0xee0e('0x2a')],_0x1509e2[_0xee0e('0x2c')]);_0x4790cc[_0xee0e('0x2f')]=_[_0xee0e('0x2e')](_0x1509e2[_0xee0e('0x2a')],qs[_0xee0e('0x30')](_0x3679a8['query'][_0xee0e('0x30')]));_0x4790cc['attributes']=_0x4790cc[_0xee0e('0x2f')][_0xee0e('0x31')]?_0x4790cc[_0xee0e('0x2f')]:_0x1509e2[_0xee0e('0x2a')];if(!_0x3679a8[_0xee0e('0x2c')][_0xee0e('0x32')]('nolimit')){_0x4790cc[_0xee0e('0x17')]=qs['limit'](_0x3679a8[_0xee0e('0x2c')][_0xee0e('0x17')]);_0x4790cc[_0xee0e('0x16')]=qs[_0xee0e('0x16')](_0x3679a8['query'][_0xee0e('0x16')]);}_0x4790cc[_0xee0e('0x33')]=qs[_0xee0e('0x34')](_0x3679a8[_0xee0e('0x2c')][_0xee0e('0x34')]);_0x4790cc[_0xee0e('0x35')]=qs[_0xee0e('0x2d')](_[_0xee0e('0x36')](_0x3679a8[_0xee0e('0x2c')],_0x1509e2[_0xee0e('0x2d')]),_0x452974);if(_0x3679a8[_0xee0e('0x2c')][_0xee0e('0x37')]){_0x4790cc['where']=_[_0xee0e('0x38')](_0x4790cc['where'],{'$or':_[_0xee0e('0x25')](_0x452974,function(_0x214592){if(_0x214592[_0xee0e('0x28')]!==_0xee0e('0x39')){var _0x1ed804={};_0x1ed804[_0x214592[_0xee0e('0x22')]]={'$like':'%'+_0x3679a8[_0xee0e('0x2c')]['filter']+'%'};return _0x1ed804;}})});}_0x4790cc=_[_0xee0e('0x38')]({},_0x4790cc,_0x3679a8[_0xee0e('0x3a')]);var _0x378ac8={'where':_0x4790cc[_0xee0e('0x35')]};return db['SmsQueueReport'][_0xee0e('0x3b')](_0x378ac8)[_0xee0e('0x1f')](function(_0x4d11ad){_0x229c05[_0xee0e('0x3b')]=_0x4d11ad;if(_0x3679a8[_0xee0e('0x2c')][_0xee0e('0x3c')]){_0x4790cc[_0xee0e('0x3d')]=[{'all':!![]}];}return db[_0xee0e('0x3e')]['findAll'](_0x4790cc);})[_0xee0e('0x1f')](function(_0x3279bc){_0x229c05[_0xee0e('0x3f')]=_0x3279bc;return _0x229c05;})[_0xee0e('0x1f')](respondWithFilteredResult(_0x223f75,_0x4790cc))[_0xee0e('0x40')](handleError(_0x223f75,null));};exports[_0xee0e('0x41')]=function(_0x5b2172,_0x38c93f){var _0x2feb96={'raw':!![],'where':{'id':_0x5b2172[_0xee0e('0x42')]['id']}},_0x5987dc={};_0x5987dc[_0xee0e('0x2a')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x5987dc[_0xee0e('0x2c')]=_[_0xee0e('0x2b')](_0x5b2172['query']);_0x5987dc[_0xee0e('0x2d')]=_[_0xee0e('0x2e')](_0x5987dc[_0xee0e('0x2a')],_0x5987dc[_0xee0e('0x2c')]);_0x2feb96['attributes']=_[_0xee0e('0x2e')](_0x5987dc[_0xee0e('0x2a')],qs[_0xee0e('0x30')](_0x5b2172[_0xee0e('0x2c')][_0xee0e('0x30')]));_0x2feb96[_0xee0e('0x2f')]=_0x2feb96['attributes']['length']?_0x2feb96[_0xee0e('0x2f')]:_0x5987dc[_0xee0e('0x2a')];if(_0x5b2172['query'][_0xee0e('0x3c')]){_0x2feb96[_0xee0e('0x3d')]=[{'all':!![]}];}_0x2feb96=_[_0xee0e('0x38')]({},_0x2feb96,_0x5b2172[_0xee0e('0x3a')]);return db[_0xee0e('0x3e')][_0xee0e('0x43')](_0x2feb96)[_0xee0e('0x1f')](handleEntityNotFound(_0x38c93f,null))[_0xee0e('0x1f')](respondWithResult(_0x38c93f,null))['catch'](handleError(_0x38c93f,null));};exports['create']=function(_0x3a22bb,_0x205bac){return db[_0xee0e('0x3e')]['create'](_0x3a22bb[_0xee0e('0x44')],{})[_0xee0e('0x1f')](respondWithResult(_0x205bac,0xc9))[_0xee0e('0x40')](handleError(_0x205bac,null));};exports['update']=function(_0x58f4b7,_0x5eb686){if(_0x58f4b7[_0xee0e('0x44')]['id']){delete _0x58f4b7[_0xee0e('0x44')]['id'];}return db[_0xee0e('0x3e')][_0xee0e('0x43')]({'where':{'id':_0x58f4b7[_0xee0e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5eb686,null))[_0xee0e('0x1f')](saveUpdates(_0x58f4b7[_0xee0e('0x44')],null))[_0xee0e('0x1f')](respondWithResult(_0x5eb686,null))['catch'](handleError(_0x5eb686,null));};exports['destroy']=function(_0x437f1a,_0x2c3d63){return db[_0xee0e('0x3e')]['find']({'where':{'id':_0x437f1a[_0xee0e('0x42')]['id']}})[_0xee0e('0x1f')](handleEntityNotFound(_0x2c3d63,null))['then'](removeEntity(_0x2c3d63,null))['catch'](handleError(_0x2c3d63,null));};exports[_0xee0e('0x45')]=function(_0x3cbe45,_0x57915b){return db[_0xee0e('0x3e')][_0xee0e('0x45')]()[_0xee0e('0x1f')](respondWithResult(_0x57915b,null))[_0xee0e('0x40')](handleError(_0x57915b,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5fbb17d..3ed5c10 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 _0xafc1=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafc1,0x1dc));var _0x1afc=function(_0x2b415b,_0x880adf){_0x2b415b=_0x2b415b-0x0;var _0x127a46=_0xafc1[_0x2b415b];return _0x127a46;};'use strict';var _=require(_0x1afc('0x0'));var util=require(_0x1afc('0x1'));var logger=require(_0x1afc('0x2'))(_0x1afc('0x3'));var moment=require(_0x1afc('0x4'));var BPromise=require(_0x1afc('0x5'));var rp=require(_0x1afc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1afc('0x7'));var config=require(_0x1afc('0x8'));var attributes=require(_0x1afc('0x9'));module[_0x1afc('0xa')]=function(_0x3ae3eb,_0x59c8c2){return _0x3ae3eb[_0x1afc('0xb')](_0x1afc('0xc'),attributes,{'tableName':_0x1afc('0xd'),'paranoid':![],'indexes':[{'name':_0x1afc('0xe'),'fields':[_0x1afc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2948=['request-promise','path','rimraf','./smsQueueReport.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x28ede4,_0x2bc788){var _0x47e361=function(_0x3ceeeb){while(--_0x3ceeeb){_0x28ede4['push'](_0x28ede4['shift']());}};_0x47e361(++_0x2bc788);}(_0x2948,0xcb));var _0x8294=function(_0x50ba81,_0x37f85d){_0x50ba81=_0x50ba81-0x0;var _0x23173b=_0x2948[_0x50ba81];return _0x23173b;};'use strict';var _=require(_0x8294('0x0'));var util=require(_0x8294('0x1'));var logger=require(_0x8294('0x2'))(_0x8294('0x3'));var moment=require(_0x8294('0x4'));var BPromise=require(_0x8294('0x5'));var rp=require(_0x8294('0x6'));var fs=require('fs');var path=require(_0x8294('0x7'));var rimraf=require(_0x8294('0x8'));var config=require('../../config/environment');var attributes=require(_0x8294('0x9'));module['exports']=function(_0x11c415,_0x26128c){return _0x11c415[_0x8294('0xa')]('SmsQueueReport',attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7a69404..a84bceb 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 _0xf4ad=['request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','options','raw','update','where','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x18ebb1,_0x192dd4){var _0x5a62cf=function(_0xf9b9a3){while(--_0xf9b9a3){_0x18ebb1['push'](_0x18ebb1['shift']());}};_0x5a62cf(++_0x192dd4);}(_0xf4ad,0xdf));var _0xdf4a=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0xf4ad[_0x43b5a7];return _0x5461fe;};'use strict';var _=require(_0xdf4a('0x0'));var util=require(_0xdf4a('0x1'));var moment=require(_0xdf4a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf4a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf4a('0x4'));var logger=require(_0xdf4a('0x5'))(_0xdf4a('0x6'));var config=require('../../config/environment');var jayson=require(_0xdf4a('0x7'));var client=jayson[_0xdf4a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36af45,_0x5d7a2f,_0x164530){return new BPromise(function(_0x17b83b,_0x247308){return client[_0xdf4a('0x9')](_0x36af45,_0x164530)[_0xdf4a('0xa')](function(_0x3af62e){logger[_0xdf4a('0xb')](_0xdf4a('0xc'),_0x5d7a2f,'request\x20sent');logger[_0xdf4a('0xd')](_0xdf4a('0xe'),_0x5d7a2f,_0xdf4a('0xf'),JSON[_0xdf4a('0x10')](_0x3af62e));if(_0x3af62e[_0xdf4a('0x11')]){if(_0x3af62e[_0xdf4a('0x11')][_0xdf4a('0x12')]===0x1f4){logger[_0xdf4a('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x5d7a2f,_0x3af62e['error'][_0xdf4a('0x13')]);return _0x247308(_0x3af62e[_0xdf4a('0x11')]['message']);}logger[_0xdf4a('0x11')](_0xdf4a('0xc'),_0x5d7a2f,_0x3af62e[_0xdf4a('0x11')][_0xdf4a('0x13')]);return _0x17b83b(_0x3af62e[_0xdf4a('0x11')][_0xdf4a('0x13')]);}else{logger[_0xdf4a('0xb')](_0xdf4a('0xc'),_0x5d7a2f,_0xdf4a('0xf'));_0x17b83b(_0x3af62e['result']['message']);}})[_0xdf4a('0x14')](function(_0x5c6daa){logger[_0xdf4a('0x11')](_0xdf4a('0xc'),_0x5d7a2f,_0x5c6daa);_0x247308(_0x5c6daa);});});}exports[_0xdf4a('0x15')]=function(_0x1e7522){var _0x1e4316=this;return new Promise(function(_0x3bb350,_0x551d82){return db[_0xdf4a('0x16')]['create'](_0x1e7522['body'],{'raw':_0x1e7522['options']?_0x1e7522[_0xdf4a('0x17')][_0xdf4a('0x18')]===undefined?!![]:![]:!![]})[_0xdf4a('0xa')](function(_0x49df88){logger['info'](_0xdf4a('0x15'),_0x1e7522);logger[_0xdf4a('0xd')](_0xdf4a('0x15'),_0x1e7522,JSON[_0xdf4a('0x10')](_0x49df88));_0x3bb350(_0x49df88);})[_0xdf4a('0x14')](function(_0x4c5ec6){logger[_0xdf4a('0x11')]('CreateSmsQueueReport',_0x4c5ec6[_0xdf4a('0x13')],_0x1e7522);_0x551d82(_0x1e4316['error'](0x1f4,_0x4c5ec6[_0xdf4a('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0xcf3f80){var _0x7abe53=this;return new Promise(function(_0x1a932a,_0x2d4f2e){return db[_0xdf4a('0x16')][_0xdf4a('0x19')](_0xcf3f80['body'],{'raw':_0xcf3f80[_0xdf4a('0x17')]?_0xcf3f80[_0xdf4a('0x17')][_0xdf4a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf3f80[_0xdf4a('0x17')]?_0xcf3f80[_0xdf4a('0x17')][_0xdf4a('0x1a')]||null:null,'attributes':_0xcf3f80[_0xdf4a('0x17')]?_0xcf3f80[_0xdf4a('0x17')]['attributes']||null:null,'limit':_0xcf3f80['options']?_0xcf3f80[_0xdf4a('0x17')][_0xdf4a('0x1b')]||null:null})['then'](function(_0x44d20d){logger[_0xdf4a('0xb')](_0xdf4a('0x1c'),_0xcf3f80);logger[_0xdf4a('0xd')](_0xdf4a('0x1c'),_0xcf3f80,JSON[_0xdf4a('0x10')](_0x44d20d));_0x1a932a(_0x44d20d);})[_0xdf4a('0x14')](function(_0x2eac2d){logger[_0xdf4a('0x11')]('UpdateSmsQueueReport',_0x2eac2d[_0xdf4a('0x13')],_0xcf3f80);_0x2d4f2e(_0x7abe53[_0xdf4a('0x11')](0x1f4,_0x2eac2d[_0xdf4a('0x13')]));});});}; \ No newline at end of file +var _0x3dd4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateSmsQueueReport','debug','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3dd4,0x143));var _0x43dd=function(_0x54dedb,_0x56597b){_0x54dedb=_0x54dedb-0x0;var _0x2215e2=_0x3dd4[_0x54dedb];return _0x2215e2;};'use strict';var _=require('lodash');var util=require(_0x43dd('0x0'));var moment=require(_0x43dd('0x1'));var BPromise=require(_0x43dd('0x2'));var rs=require(_0x43dd('0x3'));var fs=require('fs');var Redis=require(_0x43dd('0x4'));var db=require(_0x43dd('0x5'))['db'];var utils=require(_0x43dd('0x6'));var logger=require(_0x43dd('0x7'))(_0x43dd('0x8'));var config=require(_0x43dd('0x9'));var jayson=require(_0x43dd('0xa'));var client=jayson[_0x43dd('0xb')][_0x43dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b129f,_0x20bb0b,_0x47a150){return new BPromise(function(_0x2a5da3,_0x3b287d){return client[_0x43dd('0xd')](_0x2b129f,_0x47a150)['then'](function(_0x45ce46){logger['info'](_0x43dd('0xe'),_0x20bb0b,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x20bb0b,_0x43dd('0xf'),JSON[_0x43dd('0x10')](_0x45ce46));if(_0x45ce46[_0x43dd('0x11')]){if(_0x45ce46[_0x43dd('0x11')][_0x43dd('0x12')]===0x1f4){logger['error'](_0x43dd('0xe'),_0x20bb0b,_0x45ce46[_0x43dd('0x11')][_0x43dd('0x13')]);return _0x3b287d(_0x45ce46[_0x43dd('0x11')]['message']);}logger['error'](_0x43dd('0xe'),_0x20bb0b,_0x45ce46['error']['message']);return _0x2a5da3(_0x45ce46[_0x43dd('0x11')][_0x43dd('0x13')]);}else{logger[_0x43dd('0x14')](_0x43dd('0xe'),_0x20bb0b,_0x43dd('0xf'));_0x2a5da3(_0x45ce46[_0x43dd('0x15')][_0x43dd('0x13')]);}})[_0x43dd('0x16')](function(_0xc985f){logger[_0x43dd('0x11')](_0x43dd('0xe'),_0x20bb0b,_0xc985f);_0x3b287d(_0xc985f);});});}exports[_0x43dd('0x17')]=function(_0x68b667){var _0x2750c5=this;return new Promise(function(_0x71c94b,_0x574606){return db[_0x43dd('0x18')][_0x43dd('0x19')](_0x68b667[_0x43dd('0x1a')],{'raw':_0x68b667['options']?_0x68b667[_0x43dd('0x1b')][_0x43dd('0x1c')]===undefined?!![]:![]:!![]})[_0x43dd('0x1d')](function(_0x51894c){logger[_0x43dd('0x14')](_0x43dd('0x17'),_0x68b667);logger['debug'](_0x43dd('0x17'),_0x68b667,JSON[_0x43dd('0x10')](_0x51894c));_0x71c94b(_0x51894c);})[_0x43dd('0x16')](function(_0x1a1238){logger[_0x43dd('0x11')](_0x43dd('0x17'),_0x1a1238['message'],_0x68b667);_0x574606(_0x2750c5[_0x43dd('0x11')](0x1f4,_0x1a1238[_0x43dd('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x179988){var _0x30f054=this;return new Promise(function(_0x3e762a,_0x108976){return db['SmsQueueReport'][_0x43dd('0x1e')](_0x179988[_0x43dd('0x1a')],{'raw':_0x179988[_0x43dd('0x1b')]?_0x179988[_0x43dd('0x1b')][_0x43dd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x179988['options']?_0x179988[_0x43dd('0x1b')][_0x43dd('0x1f')]||null:null,'attributes':_0x179988[_0x43dd('0x1b')]?_0x179988['options'][_0x43dd('0x20')]||null:null,'limit':_0x179988[_0x43dd('0x1b')]?_0x179988[_0x43dd('0x1b')][_0x43dd('0x21')]||null:null})[_0x43dd('0x1d')](function(_0x2c187f){logger[_0x43dd('0x14')](_0x43dd('0x22'),_0x179988);logger[_0x43dd('0x23')](_0x43dd('0x22'),_0x179988,JSON[_0x43dd('0x10')](_0x2c187f));_0x3e762a(_0x2c187f);})['catch'](function(_0x443fd5){logger[_0x43dd('0x11')](_0x43dd('0x22'),_0x443fd5['message'],_0x179988);_0x108976(_0x30f054['error'](0x1f4,_0x443fd5[_0x43dd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index fcae214..216d141 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 _0x3c81=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','./smsTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x3fb1cc,_0x365dd6){_0x3fb1cc=_0x3fb1cc-0x0;var _0x4da549=_0x3c81[_0x3fb1cc];return _0x4da549;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0x7')]);router[_0x13c8('0x5')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller['describe']);router[_0x13c8('0x5')]('/:id',auth[_0x13c8('0x6')](),controller[_0x13c8('0x9')]);router[_0x13c8('0xa')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0xb')]);router[_0x13c8('0xc')](_0x13c8('0xd'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')](_0x13c8('0xd'),auth[_0x13c8('0x6')](),controller[_0x13c8('0x10')]);module[_0x13c8('0x11')]=router; \ No newline at end of file +var _0xf4f4=['Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2a6456,_0x4819ee){var _0x4f553a=function(_0x1f6f58){while(--_0x1f6f58){_0x2a6456['push'](_0x2a6456['shift']());}};_0x4f553a(++_0x4819ee);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5eb35b,_0xec7757){_0x5eb35b=_0x5eb35b-0x0;var _0x11a150=_0xf4f4[_0x5eb35b];return _0x11a150;};'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 auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')]('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x12')]);router['delete']('/:id',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);module[_0x4f4f('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 98c9537..1eab5fb 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 _0xde09=['queue','DATE','NOW','exports','STRING','ENUM','account','agent'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xde09,0x1bb));var _0x9de0=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xde09[_0x1b6186];return _0x186121;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9de0('0x0')]={'uniqueid':{'type':Sequelize[_0x9de0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9de0('0x2')](_0x9de0('0x3'),_0x9de0('0x4'),_0x9de0('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x9de0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x9de0('0x7')]}}; \ No newline at end of file +var _0x203d=['sequelize','exports','STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x202088,_0x176acd){var _0x1d5e1e=function(_0x3957fa){while(--_0x3957fa){_0x202088['push'](_0x202088['shift']());}};_0x1d5e1e(++_0x176acd);}(_0x203d,0x128));var _0xd203=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x203d[_0x3fa296];return _0x10b19f;};'use strict';var moment=require(_0xd203('0x0'));var Sequelize=require(_0xd203('0x1'));module[_0xd203('0x2')]={'uniqueid':{'type':Sequelize[_0xd203('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd203('0x4'),_0xd203('0x5'),_0xd203('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd203('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xd203('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 35f8713..de56983 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 _0x5f10=['util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','SmsTransferReport','findAll','catch','params','keys','rawAttributes','create','body','find','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f10,0xd5));var _0x05f1=function(_0x7f14eb,_0x293155){_0x7f14eb=_0x7f14eb-0x0;var _0x554bff=_0x5f10[_0x7f14eb];return _0x554bff;};'use strict';var pdf=require(_0x05f1('0x0'));var emlformat=require(_0x05f1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x05f1('0x2'));var moment=require(_0x05f1('0x3'));var BPromise=require(_0x05f1('0x4'));var Mustache=require(_0x05f1('0x5'));var util=require(_0x05f1('0x6'));var path=require(_0x05f1('0x7'));var sox=require('sox');var csv=require(_0x05f1('0x8'));var ejs=require(_0x05f1('0x9'));var fs=require('fs');var _=require(_0x05f1('0xa'));var squel=require('squel');var crypto=require(_0x05f1('0xb'));var jsforce=require(_0x05f1('0xc'));var deskjs=require(_0x05f1('0xd'));var toCsv=require(_0x05f1('0x8'));var querystring=require(_0x05f1('0xe'));var Papa=require(_0x05f1('0xf'));var Redis=require('ioredis');var authService=require(_0x05f1('0x10'));var qs=require(_0x05f1('0x11'));var as=require(_0x05f1('0x12'));var hardwareService=require(_0x05f1('0x13'));var logger=require(_0x05f1('0x14'))(_0x05f1('0x15'));var utils=require('../../config/utils');var config=require(_0x05f1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x05f1('0x17'))['db'];function respondWithStatusCode(_0x180257,_0x2e1ade){_0x2e1ade=_0x2e1ade||0xcc;return function(_0x150ba4){if(_0x150ba4){return _0x180257[_0x05f1('0x18')](_0x2e1ade);}return _0x180257[_0x05f1('0x19')](_0x2e1ade)[_0x05f1('0x1a')]();};}function respondWithResult(_0x1fae83,_0x407c6d){_0x407c6d=_0x407c6d||0xc8;return function(_0x5b47c7){if(_0x5b47c7){return _0x1fae83[_0x05f1('0x19')](_0x407c6d)[_0x05f1('0x1b')](_0x5b47c7);}};}function respondWithFilteredResult(_0x12c403,_0x238e75){return function(_0x4a8489){if(_0x4a8489){var _0x3d1cd6=_0x4a8489[_0x05f1('0x1c')],_0x44e861=_0x238e75[_0x05f1('0x1d')],_0x296572=_0x238e75[_0x05f1('0x1d')]+_0x238e75[_0x05f1('0x1e')],_0x16a6b5;if(_0x296572>=_0x3d1cd6){_0x296572=_0x3d1cd6;_0x16a6b5=0xc8;}else{_0x16a6b5=0xce;}_0x12c403[_0x05f1('0x19')](_0x16a6b5);return _0x12c403[_0x05f1('0x1f')](_0x05f1('0x20'),_0x44e861+'-'+_0x296572+'/'+_0x3d1cd6)[_0x05f1('0x1b')](_0x4a8489);}return null;};}function patchUpdates(_0x2cd9e9){return function(_0x367a58){try{jsonpatch['apply'](_0x367a58,_0x2cd9e9,!![]);}catch(_0x1f856f){return BPromise[_0x05f1('0x21')](_0x1f856f);}return _0x367a58[_0x05f1('0x22')]();};}function saveUpdates(_0x2d3e4a,_0x27ac9b){return function(_0x494e2e){if(_0x494e2e){return _0x494e2e[_0x05f1('0x23')](_0x2d3e4a)[_0x05f1('0x24')](function(_0x5c32a1){return _0x5c32a1;});}return null;};}function removeEntity(_0xaf9903,_0x2ea146){return function(_0x15abec){if(_0x15abec){return _0x15abec[_0x05f1('0x25')]()['then'](function(){_0xaf9903['status'](0xcc)[_0x05f1('0x1a')]();});}};}function handleEntityNotFound(_0x46eb59,_0x11e4e5){return function(_0x15ac19){if(!_0x15ac19){_0x46eb59[_0x05f1('0x18')](0x194);}return _0x15ac19;};}function handleError(_0x594f10,_0x2722c9){_0x2722c9=_0x2722c9||0x1f4;return function(_0x61148c){logger['error'](_0x61148c[_0x05f1('0x26')]);if(_0x61148c['name']){delete _0x61148c['name'];}_0x594f10[_0x05f1('0x19')](_0x2722c9)[_0x05f1('0x27')](_0x61148c);};}exports[_0x05f1('0x28')]=function(_0x2bdccf,_0x6a37c5){var _0x32a1c3={},_0x4e000f={},_0x20d91f={'count':0x0,'rows':[]};var _0x379aaa=_[_0x05f1('0x29')](db['SmsTransferReport']['rawAttributes'],function(_0x56e1c9){return{'name':_0x56e1c9[_0x05f1('0x2a')],'type':_0x56e1c9[_0x05f1('0x2b')][_0x05f1('0x2c')]};});_0x4e000f[_0x05f1('0x2d')]=_[_0x05f1('0x29')](_0x379aaa,'name');_0x4e000f['query']=_['keys'](_0x2bdccf[_0x05f1('0x2e')]);_0x4e000f[_0x05f1('0x2f')]=_[_0x05f1('0x30')](_0x4e000f[_0x05f1('0x2d')],_0x4e000f[_0x05f1('0x2e')]);_0x32a1c3[_0x05f1('0x31')]=_['intersection'](_0x4e000f[_0x05f1('0x2d')],qs[_0x05f1('0x32')](_0x2bdccf['query'][_0x05f1('0x32')]));_0x32a1c3[_0x05f1('0x31')]=_0x32a1c3['attributes'][_0x05f1('0x33')]?_0x32a1c3[_0x05f1('0x31')]:_0x4e000f['model'];if(!_0x2bdccf[_0x05f1('0x2e')]['hasOwnProperty']('nolimit')){_0x32a1c3[_0x05f1('0x1e')]=qs[_0x05f1('0x1e')](_0x2bdccf[_0x05f1('0x2e')][_0x05f1('0x1e')]);_0x32a1c3[_0x05f1('0x1d')]=qs[_0x05f1('0x1d')](_0x2bdccf[_0x05f1('0x2e')][_0x05f1('0x1d')]);}_0x32a1c3[_0x05f1('0x34')]=qs[_0x05f1('0x35')](_0x2bdccf[_0x05f1('0x2e')]['sort']);_0x32a1c3[_0x05f1('0x36')]=qs[_0x05f1('0x2f')](_[_0x05f1('0x37')](_0x2bdccf[_0x05f1('0x2e')],_0x4e000f[_0x05f1('0x2f')]),_0x379aaa);if(_0x2bdccf[_0x05f1('0x2e')][_0x05f1('0x38')]){_0x32a1c3['where']=_['merge'](_0x32a1c3['where'],{'$or':_[_0x05f1('0x29')](_0x379aaa,function(_0xd9c2de){if(_0xd9c2de[_0x05f1('0x2b')]!==_0x05f1('0x39')){var _0x1fdb25={};_0x1fdb25[_0xd9c2de[_0x05f1('0x3a')]]={'$like':'%'+_0x2bdccf[_0x05f1('0x2e')]['filter']+'%'};return _0x1fdb25;}})});}_0x32a1c3=_[_0x05f1('0x3b')]({},_0x32a1c3,_0x2bdccf[_0x05f1('0x3c')]);var _0x3f4d0a={'where':_0x32a1c3[_0x05f1('0x36')]};return db['SmsTransferReport'][_0x05f1('0x1c')](_0x3f4d0a)[_0x05f1('0x24')](function(_0x8324fc){_0x20d91f[_0x05f1('0x1c')]=_0x8324fc;if(_0x2bdccf[_0x05f1('0x2e')][_0x05f1('0x3d')]){_0x32a1c3[_0x05f1('0x3e')]=[{'all':!![]}];}return db[_0x05f1('0x3f')][_0x05f1('0x40')](_0x32a1c3);})[_0x05f1('0x24')](function(_0x5a3a5e){_0x20d91f['rows']=_0x5a3a5e;return _0x20d91f;})['then'](respondWithFilteredResult(_0x6a37c5,_0x32a1c3))[_0x05f1('0x41')](handleError(_0x6a37c5,null));};exports['show']=function(_0x352f50,_0x193d6c){var _0x316034={'raw':!![],'where':{'id':_0x352f50[_0x05f1('0x42')]['id']}},_0x1d655f={};_0x1d655f[_0x05f1('0x2d')]=_[_0x05f1('0x43')](db[_0x05f1('0x3f')][_0x05f1('0x44')]);_0x1d655f[_0x05f1('0x2e')]=_[_0x05f1('0x43')](_0x352f50[_0x05f1('0x2e')]);_0x1d655f['filters']=_[_0x05f1('0x30')](_0x1d655f[_0x05f1('0x2d')],_0x1d655f[_0x05f1('0x2e')]);_0x316034[_0x05f1('0x31')]=_['intersection'](_0x1d655f['model'],qs[_0x05f1('0x32')](_0x352f50['query']['fields']));_0x316034[_0x05f1('0x31')]=_0x316034[_0x05f1('0x31')]['length']?_0x316034[_0x05f1('0x31')]:_0x1d655f[_0x05f1('0x2d')];if(_0x352f50[_0x05f1('0x2e')]['includeAll']){_0x316034['include']=[{'all':!![]}];}_0x316034=_[_0x05f1('0x3b')]({},_0x316034,_0x352f50[_0x05f1('0x3c')]);return db[_0x05f1('0x3f')]['find'](_0x316034)['then'](handleEntityNotFound(_0x193d6c,null))['then'](respondWithResult(_0x193d6c,null))[_0x05f1('0x41')](handleError(_0x193d6c,null));};exports[_0x05f1('0x45')]=function(_0x294ff8,_0x4abde7){return db[_0x05f1('0x3f')]['create'](_0x294ff8[_0x05f1('0x46')],{})[_0x05f1('0x24')](respondWithResult(_0x4abde7,0xc9))['catch'](handleError(_0x4abde7,null));};exports[_0x05f1('0x23')]=function(_0x20b801,_0x12ef6f){if(_0x20b801[_0x05f1('0x46')]['id']){delete _0x20b801['body']['id'];}return db[_0x05f1('0x3f')][_0x05f1('0x47')]({'where':{'id':_0x20b801[_0x05f1('0x42')]['id']}})[_0x05f1('0x24')](handleEntityNotFound(_0x12ef6f,null))[_0x05f1('0x24')](saveUpdates(_0x20b801[_0x05f1('0x46')],null))['then'](respondWithResult(_0x12ef6f,null))['catch'](handleError(_0x12ef6f,null));};exports[_0x05f1('0x25')]=function(_0x2692db,_0x5ac4b3){return db[_0x05f1('0x3f')]['find']({'where':{'id':_0x2692db[_0x05f1('0x42')]['id']}})[_0x05f1('0x24')](handleEntityNotFound(_0x5ac4b3,null))['then'](removeEntity(_0x5ac4b3,null))[_0x05f1('0x41')](handleError(_0x5ac4b3,null));};exports['describe']=function(_0x50f14d,_0x514740){return db[_0x05f1('0x3f')][_0x05f1('0x48')]()['then'](respondWithResult(_0x514740,null))[_0x05f1('0x41')](handleError(_0x514740,null));}; \ No newline at end of file +var _0x6b61=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','SmsTransferReport','rows','show','params','includeAll','find','catch','create','body','describe','html-pdf','rimraf','zip-dir'];(function(_0x318f63,_0x991359){var _0x475e98=function(_0x3f5de1){while(--_0x3f5de1){_0x318f63['push'](_0x318f63['shift']());}};_0x475e98(++_0x991359);}(_0x6b61,0x16a));var _0x16b6=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x6b61[_0x1e6e4e];return _0x3d746b;};'use strict';var pdf=require(_0x16b6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16b6('0x1'));var zipdir=require(_0x16b6('0x2'));var jsonpatch=require(_0x16b6('0x3'));var rp=require(_0x16b6('0x4'));var moment=require(_0x16b6('0x5'));var BPromise=require(_0x16b6('0x6'));var Mustache=require(_0x16b6('0x7'));var util=require(_0x16b6('0x8'));var path=require('path');var sox=require(_0x16b6('0x9'));var csv=require(_0x16b6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x16b6('0xb'));var squel=require(_0x16b6('0xc'));var crypto=require('crypto');var jsforce=require(_0x16b6('0xd'));var deskjs=require(_0x16b6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x16b6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x16b6('0x10'));var as=require(_0x16b6('0x11'));var hardwareService=require(_0x16b6('0x12'));var logger=require(_0x16b6('0x13'))(_0x16b6('0x14'));var utils=require(_0x16b6('0x15'));var config=require(_0x16b6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ce093,_0x41c9ad){_0x41c9ad=_0x41c9ad||0xcc;return function(_0x3263f0){if(_0x3263f0){return _0x4ce093[_0x16b6('0x17')](_0x41c9ad);}return _0x4ce093[_0x16b6('0x18')](_0x41c9ad)[_0x16b6('0x19')]();};}function respondWithResult(_0x13158a,_0x37e479){_0x37e479=_0x37e479||0xc8;return function(_0x5434c8){if(_0x5434c8){return _0x13158a[_0x16b6('0x18')](_0x37e479)['json'](_0x5434c8);}};}function respondWithFilteredResult(_0x5ae7c4,_0x4f8a1e){return function(_0x4e8514){if(_0x4e8514){var _0x5f42bc=_0x4e8514['count'],_0x4833a0=_0x4f8a1e['offset'],_0xf6ec42=_0x4f8a1e[_0x16b6('0x1a')]+_0x4f8a1e[_0x16b6('0x1b')],_0x537eba;if(_0xf6ec42>=_0x5f42bc){_0xf6ec42=_0x5f42bc;_0x537eba=0xc8;}else{_0x537eba=0xce;}_0x5ae7c4[_0x16b6('0x18')](_0x537eba);return _0x5ae7c4[_0x16b6('0x1c')](_0x16b6('0x1d'),_0x4833a0+'-'+_0xf6ec42+'/'+_0x5f42bc)[_0x16b6('0x1e')](_0x4e8514);}return null;};}function patchUpdates(_0x30aa64){return function(_0x47508b){try{jsonpatch[_0x16b6('0x1f')](_0x47508b,_0x30aa64,!![]);}catch(_0x478ea1){return BPromise[_0x16b6('0x20')](_0x478ea1);}return _0x47508b['save']();};}function saveUpdates(_0x5307d1,_0x5bef45){return function(_0x52e86c){if(_0x52e86c){return _0x52e86c[_0x16b6('0x21')](_0x5307d1)[_0x16b6('0x22')](function(_0x1b5424){return _0x1b5424;});}return null;};}function removeEntity(_0x360d4a,_0x22d2f7){return function(_0x32f4f7){if(_0x32f4f7){return _0x32f4f7[_0x16b6('0x23')]()[_0x16b6('0x22')](function(){_0x360d4a['status'](0xcc)[_0x16b6('0x19')]();});}};}function handleEntityNotFound(_0xb56485,_0x47fcf0){return function(_0x182bcc){if(!_0x182bcc){_0xb56485[_0x16b6('0x17')](0x194);}return _0x182bcc;};}function handleError(_0x59a461,_0x35c00e){_0x35c00e=_0x35c00e||0x1f4;return function(_0x20995e){logger['error'](_0x20995e[_0x16b6('0x24')]);if(_0x20995e[_0x16b6('0x25')]){delete _0x20995e['name'];}_0x59a461[_0x16b6('0x18')](_0x35c00e)[_0x16b6('0x26')](_0x20995e);};}exports[_0x16b6('0x27')]=function(_0x35b127,_0x599aa0){var _0x44fa79={},_0x499618={},_0x372843={'count':0x0,'rows':[]};var _0x48c4e2=_[_0x16b6('0x28')](db['SmsTransferReport'][_0x16b6('0x29')],function(_0x416244){return{'name':_0x416244[_0x16b6('0x2a')],'type':_0x416244[_0x16b6('0x2b')]['key']};});_0x499618['model']=_[_0x16b6('0x28')](_0x48c4e2,_0x16b6('0x25'));_0x499618[_0x16b6('0x2c')]=_[_0x16b6('0x2d')](_0x35b127[_0x16b6('0x2c')]);_0x499618[_0x16b6('0x2e')]=_[_0x16b6('0x2f')](_0x499618[_0x16b6('0x30')],_0x499618[_0x16b6('0x2c')]);_0x44fa79['attributes']=_[_0x16b6('0x2f')](_0x499618[_0x16b6('0x30')],qs[_0x16b6('0x31')](_0x35b127[_0x16b6('0x2c')][_0x16b6('0x31')]));_0x44fa79[_0x16b6('0x32')]=_0x44fa79['attributes'][_0x16b6('0x33')]?_0x44fa79[_0x16b6('0x32')]:_0x499618['model'];if(!_0x35b127[_0x16b6('0x2c')]['hasOwnProperty'](_0x16b6('0x34'))){_0x44fa79[_0x16b6('0x1b')]=qs[_0x16b6('0x1b')](_0x35b127[_0x16b6('0x2c')][_0x16b6('0x1b')]);_0x44fa79[_0x16b6('0x1a')]=qs[_0x16b6('0x1a')](_0x35b127[_0x16b6('0x2c')][_0x16b6('0x1a')]);}_0x44fa79[_0x16b6('0x35')]=qs[_0x16b6('0x36')](_0x35b127[_0x16b6('0x2c')][_0x16b6('0x36')]);_0x44fa79[_0x16b6('0x37')]=qs[_0x16b6('0x2e')](_[_0x16b6('0x38')](_0x35b127[_0x16b6('0x2c')],_0x499618[_0x16b6('0x2e')]),_0x48c4e2);if(_0x35b127['query']['filter']){_0x44fa79[_0x16b6('0x37')]=_[_0x16b6('0x39')](_0x44fa79[_0x16b6('0x37')],{'$or':_[_0x16b6('0x28')](_0x48c4e2,function(_0x4eef72){if(_0x4eef72[_0x16b6('0x2b')]!==_0x16b6('0x3a')){var _0x5c7ee2={};_0x5c7ee2[_0x4eef72[_0x16b6('0x25')]]={'$like':'%'+_0x35b127[_0x16b6('0x2c')][_0x16b6('0x3b')]+'%'};return _0x5c7ee2;}})});}_0x44fa79=_['merge']({},_0x44fa79,_0x35b127[_0x16b6('0x3c')]);var _0x56e1d7={'where':_0x44fa79[_0x16b6('0x37')]};return db['SmsTransferReport'][_0x16b6('0x3d')](_0x56e1d7)[_0x16b6('0x22')](function(_0xa7d399){_0x372843[_0x16b6('0x3d')]=_0xa7d399;if(_0x35b127['query']['includeAll']){_0x44fa79[_0x16b6('0x3e')]=[{'all':!![]}];}return db[_0x16b6('0x3f')]['findAll'](_0x44fa79);})[_0x16b6('0x22')](function(_0x4e41ca){_0x372843[_0x16b6('0x40')]=_0x4e41ca;return _0x372843;})['then'](respondWithFilteredResult(_0x599aa0,_0x44fa79))['catch'](handleError(_0x599aa0,null));};exports[_0x16b6('0x41')]=function(_0x53bd91,_0x383fd3){var _0x467d2c={'raw':!![],'where':{'id':_0x53bd91[_0x16b6('0x42')]['id']}},_0x2997c9={};_0x2997c9[_0x16b6('0x30')]=_[_0x16b6('0x2d')](db[_0x16b6('0x3f')][_0x16b6('0x29')]);_0x2997c9[_0x16b6('0x2c')]=_[_0x16b6('0x2d')](_0x53bd91[_0x16b6('0x2c')]);_0x2997c9[_0x16b6('0x2e')]=_[_0x16b6('0x2f')](_0x2997c9[_0x16b6('0x30')],_0x2997c9[_0x16b6('0x2c')]);_0x467d2c[_0x16b6('0x32')]=_[_0x16b6('0x2f')](_0x2997c9[_0x16b6('0x30')],qs['fields'](_0x53bd91['query']['fields']));_0x467d2c[_0x16b6('0x32')]=_0x467d2c['attributes']['length']?_0x467d2c[_0x16b6('0x32')]:_0x2997c9[_0x16b6('0x30')];if(_0x53bd91['query'][_0x16b6('0x43')]){_0x467d2c[_0x16b6('0x3e')]=[{'all':!![]}];}_0x467d2c=_['merge']({},_0x467d2c,_0x53bd91[_0x16b6('0x3c')]);return db[_0x16b6('0x3f')][_0x16b6('0x44')](_0x467d2c)['then'](handleEntityNotFound(_0x383fd3,null))[_0x16b6('0x22')](respondWithResult(_0x383fd3,null))[_0x16b6('0x45')](handleError(_0x383fd3,null));};exports[_0x16b6('0x46')]=function(_0x48e232,_0x269f94){return db['SmsTransferReport'][_0x16b6('0x46')](_0x48e232[_0x16b6('0x47')],{})[_0x16b6('0x22')](respondWithResult(_0x269f94,0xc9))[_0x16b6('0x45')](handleError(_0x269f94,null));};exports[_0x16b6('0x21')]=function(_0x517ac1,_0x3fa71b){if(_0x517ac1[_0x16b6('0x47')]['id']){delete _0x517ac1[_0x16b6('0x47')]['id'];}return db['SmsTransferReport'][_0x16b6('0x44')]({'where':{'id':_0x517ac1[_0x16b6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fa71b,null))[_0x16b6('0x22')](saveUpdates(_0x517ac1[_0x16b6('0x47')],null))['then'](respondWithResult(_0x3fa71b,null))['catch'](handleError(_0x3fa71b,null));};exports[_0x16b6('0x23')]=function(_0x2ef0d6,_0x340a9a){return db[_0x16b6('0x3f')][_0x16b6('0x44')]({'where':{'id':_0x2ef0d6[_0x16b6('0x42')]['id']}})[_0x16b6('0x22')](handleEntityNotFound(_0x340a9a,null))['then'](removeEntity(_0x340a9a,null))[_0x16b6('0x45')](handleError(_0x340a9a,null));};exports[_0x16b6('0x48')]=function(_0x5a5006,_0x5841d2){return db[_0x16b6('0x3f')][_0x16b6('0x48')]()[_0x16b6('0x22')](respondWithResult(_0x5841d2,null))['catch'](handleError(_0x5841d2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index bfc2071..4ebe502 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 _0xdbf5=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50d2a0,_0x13168b){var _0x11fe24=function(_0x1d67c4){while(--_0x1d67c4){_0x50d2a0['push'](_0x50d2a0['shift']());}};_0x11fe24(++_0x13168b);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3c37f5,_0x2d6016){_0x3c37f5=_0x3c37f5-0x0;var _0x20f0d7=_0xdbf5[_0x3c37f5];return _0x20f0d7;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5dbf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','util'];(function(_0x3def63,_0x505a12){var _0xd585e3=function(_0x431aef){while(--_0x431aef){_0x3def63['push'](_0x3def63['shift']());}};_0xd585e3(++_0x505a12);}(_0x81c6,0x1d5));var _0x681c=function(_0x4e8a59,_0x32bc84){_0x4e8a59=_0x4e8a59-0x0;var _0x22ba3e=_0x81c6[_0x4e8a59];return _0x22ba3e;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x681c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 016cc24..4e42bd6 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 _0xedb1=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0xd84235,_0xece780){var _0x4d2f34=function(_0x2f4e3d){while(--_0x2f4e3d){_0xd84235['push'](_0xd84235['shift']());}};_0x4d2f34(++_0xece780);}(_0xedb1,0xb8));var _0x1edb=function(_0x295245,_0x413e8b){_0x295245=_0x295245-0x0;var _0xe35b91=_0xedb1[_0x295245];return _0xe35b91;};'use strict';var _=require(_0x1edb('0x0'));var util=require(_0x1edb('0x1'));var moment=require(_0x1edb('0x2'));var BPromise=require(_0x1edb('0x3'));var rs=require(_0x1edb('0x4'));var fs=require('fs');var Redis=require(_0x1edb('0x5'));var db=require(_0x1edb('0x6'))['db'];var utils=require(_0x1edb('0x7'));var logger=require(_0x1edb('0x8'))(_0x1edb('0x9'));var config=require('../../config/environment');var jayson=require(_0x1edb('0xa'));var client=jayson[_0x1edb('0xb')][_0x1edb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x615ef5,_0xf892f4,_0x47e824){return new BPromise(function(_0x35ce77,_0x243bde){return client['request'](_0x615ef5,_0x47e824)['then'](function(_0xfd55a3){logger[_0x1edb('0xd')](_0x1edb('0xe'),_0xf892f4,_0x1edb('0xf'));logger[_0x1edb('0x10')](_0x1edb('0x11'),_0xf892f4,'request\x20sent',JSON[_0x1edb('0x12')](_0xfd55a3));if(_0xfd55a3['error']){if(_0xfd55a3[_0x1edb('0x13')][_0x1edb('0x14')]===0x1f4){logger['error'](_0x1edb('0xe'),_0xf892f4,_0xfd55a3[_0x1edb('0x13')][_0x1edb('0x15')]);return _0x243bde(_0xfd55a3[_0x1edb('0x13')]['message']);}logger['error'](_0x1edb('0xe'),_0xf892f4,_0xfd55a3[_0x1edb('0x13')][_0x1edb('0x15')]);return _0x35ce77(_0xfd55a3[_0x1edb('0x13')]['message']);}else{logger[_0x1edb('0xd')](_0x1edb('0xe'),_0xf892f4,_0x1edb('0xf'));_0x35ce77(_0xfd55a3['result'][_0x1edb('0x15')]);}})['catch'](function(_0x4ea739){logger[_0x1edb('0x13')](_0x1edb('0xe'),_0xf892f4,_0x4ea739);_0x243bde(_0x4ea739);});});} \ No newline at end of file +var _0x6b9e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x6b9e,0x11c));var _0xe6b9=function(_0x3332ea,_0x176f3a){_0x3332ea=_0x3332ea-0x0;var _0x1d0503=_0x6b9e[_0x3332ea];return _0x1d0503;};'use strict';var _=require(_0xe6b9('0x0'));var util=require(_0xe6b9('0x1'));var moment=require(_0xe6b9('0x2'));var BPromise=require(_0xe6b9('0x3'));var rs=require(_0xe6b9('0x4'));var fs=require('fs');var Redis=require(_0xe6b9('0x5'));var db=require(_0xe6b9('0x6'))['db'];var utils=require(_0xe6b9('0x7'));var logger=require('../../config/logger')(_0xe6b9('0x8'));var config=require(_0xe6b9('0x9'));var jayson=require(_0xe6b9('0xa'));var client=jayson[_0xe6b9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab510,_0x1bcc42,_0x12164b){return new BPromise(function(_0x569c21,_0x30bb71){return client[_0xe6b9('0xc')](_0x2ab510,_0x12164b)[_0xe6b9('0xd')](function(_0x511c38){logger['info'](_0xe6b9('0xe'),_0x1bcc42,_0xe6b9('0xf'));logger['debug'](_0xe6b9('0x10'),_0x1bcc42,'request\x20sent',JSON[_0xe6b9('0x11')](_0x511c38));if(_0x511c38[_0xe6b9('0x12')]){if(_0x511c38[_0xe6b9('0x12')]['code']===0x1f4){logger['error'](_0xe6b9('0xe'),_0x1bcc42,_0x511c38[_0xe6b9('0x12')]['message']);return _0x30bb71(_0x511c38[_0xe6b9('0x12')]['message']);}logger[_0xe6b9('0x12')](_0xe6b9('0xe'),_0x1bcc42,_0x511c38['error'][_0xe6b9('0x13')]);return _0x569c21(_0x511c38[_0xe6b9('0x12')][_0xe6b9('0x13')]);}else{logger[_0xe6b9('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x1bcc42,_0xe6b9('0xf'));_0x569c21(_0x511c38[_0xe6b9('0x15')][_0xe6b9('0x13')]);}})['catch'](function(_0x5b4c3b){logger[_0xe6b9('0x12')](_0xe6b9('0xe'),_0x1bcc42,_0x5b4c3b);_0x30bb71(_0x5b4c3b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d26dda7..4aabc63 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 _0x1e43=['express','Router','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2ab0e2,_0x19aae5){var _0x5a4d8f=function(_0x4df487){while(--_0x4df487){_0x2ab0e2['push'](_0x2ab0e2['shift']());}};_0x5a4d8f(++_0x19aae5);}(_0x1e43,0x158));var _0x31e4=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x1e43[_0x20aadb];return _0x520018;};'use strict';var multer=require(_0x31e4('0x0'));var util=require(_0x31e4('0x1'));var path=require(_0x31e4('0x2'));var timeout=require(_0x31e4('0x3'));var express=require(_0x31e4('0x4'));var router=express[_0x31e4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x31e4('0x6')]('/',auth[_0x31e4('0x7')](),controller[_0x31e4('0x8')]);router[_0x31e4('0x6')](_0x31e4('0x9'),auth[_0x31e4('0x7')](),controller[_0x31e4('0xa')]);router[_0x31e4('0x6')](_0x31e4('0xb'),auth[_0x31e4('0x7')](),controller[_0x31e4('0xc')]);var upload=multer({'storage':multer[_0x31e4('0xd')]({'destination':function(_0x55b94b,_0x52ec75,_0x44b44b){_0x44b44b(null,path['join'](config['root'],_0x31e4('0xe')));},'filename':function(_0x151a56,_0x5ac771,_0x61179c){_0x5ac771[_0x31e4('0xf')]=_0x5ac771[_0x31e4('0xf')][_0x31e4('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x61179c(null,util[_0x31e4('0x11')](_0x31e4('0x12'),path[_0x31e4('0x13')](_0x5ac771['originalname'],path[_0x31e4('0x14')](_0x5ac771['originalname'])),Date[_0x31e4('0x15')](),path[_0x31e4('0x14')](_0x5ac771['originalname'])));}})});router[_0x31e4('0x16')]('/',upload[_0x31e4('0x17')]('file'),controller[_0x31e4('0x18')]);router[_0x31e4('0x19')](_0x31e4('0x9'),auth[_0x31e4('0x7')](),controller[_0x31e4('0x1a')]);router[_0x31e4('0x1b')](_0x31e4('0x9'),auth[_0x31e4('0x7')](),controller[_0x31e4('0x1b')]);module[_0x31e4('0x1c')]=router; \ No newline at end of file +var _0xf1a5=['isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','now','extname','post','create','put','update','delete','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0xe0dfd6,_0x40506d){var _0x55e93e=function(_0x1cd535){while(--_0x1cd535){_0xe0dfd6['push'](_0xe0dfd6['shift']());}};_0x55e93e(++_0x40506d);}(_0xf1a5,0x19b));var _0x5f1a=function(_0x52d31e,_0x42cb05){_0x52d31e=_0x52d31e-0x0;var _0x3b4df7=_0xf1a5[_0x52d31e];return _0x3b4df7;};'use strict';var multer=require(_0x5f1a('0x0'));var util=require(_0x5f1a('0x1'));var path=require(_0x5f1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f1a('0x3'));var router=express[_0x5f1a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5f1a('0x5'));var config=require(_0x5f1a('0x6'));var controller=require(_0x5f1a('0x7'));router[_0x5f1a('0x8')]('/',auth[_0x5f1a('0x9')](),controller[_0x5f1a('0xa')]);router[_0x5f1a('0x8')](_0x5f1a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5f1a('0x8')](_0x5f1a('0xc'),auth[_0x5f1a('0x9')](),controller[_0x5f1a('0xd')]);var upload=multer({'storage':multer[_0x5f1a('0xe')]({'destination':function(_0x299bc6,_0x168528,_0x31187f){_0x31187f(null,path[_0x5f1a('0xf')](config[_0x5f1a('0x10')],_0x5f1a('0x11')));},'filename':function(_0x2b97fe,_0x4f9c55,_0x5310e8){_0x4f9c55[_0x5f1a('0x12')]=_0x4f9c55[_0x5f1a('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5310e8(null,util['format'](_0x5f1a('0x13'),path[_0x5f1a('0x14')](_0x4f9c55[_0x5f1a('0x12')],path['extname'](_0x4f9c55[_0x5f1a('0x12')])),Date[_0x5f1a('0x15')](),path[_0x5f1a('0x16')](_0x4f9c55[_0x5f1a('0x12')])));}})});router[_0x5f1a('0x17')]('/',upload['single']('file'),controller[_0x5f1a('0x18')]);router[_0x5f1a('0x19')](_0x5f1a('0xb'),auth[_0x5f1a('0x9')](),controller[_0x5f1a('0x1a')]);router['delete'](_0x5f1a('0xb'),auth[_0x5f1a('0x9')](),controller[_0x5f1a('0x1b')]);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 01c211e..375e43e 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 _0xdb91=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x3d0696,_0x4f1959){var _0x30e985=function(_0x2f6720){while(--_0x2f6720){_0x3d0696['push'](_0x3d0696['shift']());}};_0x30e985(++_0x4f1959);}(_0xdb91,0x1d5));var _0x1db9=function(_0x3cd6ea,_0x3e4892){_0x3cd6ea=_0x3cd6ea-0x0;var _0x570a8b=_0xdb91[_0x3cd6ea];return _0x570a8b;};'use strict';var Sequelize=require(_0x1db9('0x0'));module[_0x1db9('0x1')]={'name':{'type':Sequelize[_0x1db9('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x1db9('0x2')]},'display_name':{'type':Sequelize[_0x1db9('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x1db9('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1db9('0x4')]},'original_channelCount':{'type':Sequelize[_0x1db9('0x5')]},'original_bitRate':{'type':Sequelize[_0x1db9('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x1db9('0x2')]},'converted_duration':{'type':Sequelize[_0x1db9('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x1db9('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1db9('0x5')]}}; \ No newline at end of file +var _0x64d9=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x3ddf82,_0x208b32){var _0xcd211c=function(_0x1a8871){while(--_0x1a8871){_0x3ddf82['push'](_0x3ddf82['shift']());}};_0xcd211c(++_0x208b32);}(_0x64d9,0x7e));var _0x964d=function(_0x289eb6,_0x227970){_0x289eb6=_0x289eb6-0x0;var _0x43ba91=_0x64d9[_0x289eb6];return _0x43ba91;};'use strict';var Sequelize=require('sequelize');module[_0x964d('0x0')]={'name':{'type':Sequelize[_0x964d('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x964d('0x1')]},'display_name':{'type':Sequelize[_0x964d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x964d('0x1')]},'original_format':{'type':Sequelize[_0x964d('0x1')]},'original_duration':{'type':Sequelize[_0x964d('0x2')]},'original_sampleCount':{'type':Sequelize[_0x964d('0x3')]},'original_channelCount':{'type':Sequelize[_0x964d('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x964d('0x4')]},'converted_format':{'type':Sequelize[_0x964d('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x964d('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x964d('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 295753a..7ade14d 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 _0x7475=['path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','Sound','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','options','find','download','params','join','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','transcode','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x53abc9,_0x5230b7){var _0x4501a6=function(_0x99b7bc){while(--_0x99b7bc){_0x53abc9['push'](_0x53abc9['shift']());}};_0x4501a6(++_0x5230b7);}(_0x7475,0x6f));var _0x5747=function(_0x21d624,_0x4e801b){_0x21d624=_0x21d624-0x0;var _0x5cd803=_0x7475[_0x21d624];return _0x5cd803;};'use strict';var pdf=require(_0x5747('0x0'));var emlformat=require(_0x5747('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5747('0x2'));var jsonpatch=require(_0x5747('0x3'));var rp=require(_0x5747('0x4'));var moment=require(_0x5747('0x5'));var BPromise=require(_0x5747('0x6'));var Mustache=require(_0x5747('0x7'));var util=require('util');var path=require(_0x5747('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5747('0x9'));var fs=require('fs');var _=require(_0x5747('0xa'));var squel=require(_0x5747('0xb'));var crypto=require('crypto');var jsforce=require(_0x5747('0xc'));var deskjs=require(_0x5747('0xd'));var toCsv=require(_0x5747('0xe'));var querystring=require(_0x5747('0xf'));var Papa=require(_0x5747('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5747('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5747('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5747('0x13'))['db'];function respondWithStatusCode(_0x54ad6d,_0x3be60e){_0x3be60e=_0x3be60e||0xcc;return function(_0xc0a811){if(_0xc0a811){return _0x54ad6d[_0x5747('0x14')](_0x3be60e);}return _0x54ad6d['status'](_0x3be60e)[_0x5747('0x15')]();};}function respondWithResult(_0x5c72e6,_0x4c281a){_0x4c281a=_0x4c281a||0xc8;return function(_0x3fcb01){if(_0x3fcb01){return _0x5c72e6[_0x5747('0x16')](_0x4c281a)[_0x5747('0x17')](_0x3fcb01);}};}function respondWithFilteredResult(_0x165947,_0x4060b1){return function(_0x2aefa5){if(_0x2aefa5){var _0x57b75b=_0x2aefa5[_0x5747('0x18')],_0xce70c0=_0x4060b1[_0x5747('0x19')],_0x2d1ed0=_0x4060b1[_0x5747('0x19')]+_0x4060b1[_0x5747('0x1a')],_0x4c8ae5;if(_0x2d1ed0>=_0x57b75b){_0x2d1ed0=_0x57b75b;_0x4c8ae5=0xc8;}else{_0x4c8ae5=0xce;}_0x165947['status'](_0x4c8ae5);return _0x165947[_0x5747('0x1b')](_0x5747('0x1c'),_0xce70c0+'-'+_0x2d1ed0+'/'+_0x57b75b)[_0x5747('0x17')](_0x2aefa5);}return null;};}function patchUpdates(_0x263934){return function(_0x38d45a){try{jsonpatch[_0x5747('0x1d')](_0x38d45a,_0x263934,!![]);}catch(_0x4d8e14){return BPromise[_0x5747('0x1e')](_0x4d8e14);}return _0x38d45a[_0x5747('0x1f')]();};}function saveUpdates(_0x324eb7,_0x17b542){return function(_0x53c8ad){if(_0x53c8ad){return _0x53c8ad[_0x5747('0x20')](_0x324eb7)[_0x5747('0x21')](function(_0x462a96){return _0x462a96;});}return null;};}function removeEntity(_0x373318,_0x471b5d){return function(_0x3c3563){if(_0x3c3563){return _0x3c3563[_0x5747('0x22')]()[_0x5747('0x21')](function(){var _0x8ffbb9=_0x3c3563['get']({'plain':!![]});var _0x523094='Sounds';return db['UserProfileResource'][_0x5747('0x22')]({'where':{'type':_0x523094,'resourceId':_0x8ffbb9['id']}})[_0x5747('0x21')](function(){return _0x3c3563;});})['then'](function(){_0x373318['status'](0xcc)[_0x5747('0x15')]();});}};}function handleEntityNotFound(_0x28a283,_0x38448f){return function(_0x17f722){if(!_0x17f722){_0x28a283[_0x5747('0x14')](0x194);}return _0x17f722;};}function handleError(_0x58ef39,_0x1eefe2){_0x1eefe2=_0x1eefe2||0x1f4;return function(_0x39b6fc){logger[_0x5747('0x23')](_0x39b6fc['stack']);if(_0x39b6fc[_0x5747('0x24')]){delete _0x39b6fc['name'];}_0x58ef39[_0x5747('0x16')](_0x1eefe2)['send'](_0x39b6fc);};}exports['index']=function(_0x10a65c,_0x4ac69f){var _0x50eb97={},_0x10708a={},_0x242801={'count':0x0,'rows':[]};var _0x9a3f8c=_[_0x5747('0x25')](db[_0x5747('0x26')][_0x5747('0x27')],function(_0x1647c6){return{'name':_0x1647c6['fieldName'],'type':_0x1647c6[_0x5747('0x28')][_0x5747('0x29')]};});_0x10708a[_0x5747('0x2a')]=_[_0x5747('0x25')](_0x9a3f8c,_0x5747('0x24'));_0x10708a[_0x5747('0x2b')]=_[_0x5747('0x2c')](_0x10a65c['query']);_0x10708a['filters']=_[_0x5747('0x2d')](_0x10708a[_0x5747('0x2a')],_0x10708a['query']);_0x50eb97[_0x5747('0x2e')]=_[_0x5747('0x2d')](_0x10708a[_0x5747('0x2a')],qs[_0x5747('0x2f')](_0x10a65c[_0x5747('0x2b')][_0x5747('0x2f')]));_0x50eb97['attributes']=_0x50eb97[_0x5747('0x2e')][_0x5747('0x30')]?_0x50eb97['attributes']:_0x10708a[_0x5747('0x2a')];if(!_0x10a65c[_0x5747('0x2b')][_0x5747('0x31')](_0x5747('0x32'))){_0x50eb97[_0x5747('0x1a')]=qs[_0x5747('0x1a')](_0x10a65c[_0x5747('0x2b')]['limit']);_0x50eb97['offset']=qs[_0x5747('0x19')](_0x10a65c['query'][_0x5747('0x19')]);}_0x50eb97[_0x5747('0x33')]=qs[_0x5747('0x34')](_0x10a65c['query'][_0x5747('0x34')]);_0x50eb97[_0x5747('0x35')]=qs[_0x5747('0x36')](_['pick'](_0x10a65c[_0x5747('0x2b')],_0x10708a[_0x5747('0x36')]),_0x9a3f8c);if(_0x10a65c[_0x5747('0x2b')][_0x5747('0x37')]){_0x50eb97[_0x5747('0x35')]=_[_0x5747('0x38')](_0x50eb97[_0x5747('0x35')],{'$or':_[_0x5747('0x25')](_0x9a3f8c,function(_0x32475b){if(_0x32475b[_0x5747('0x28')]!==_0x5747('0x39')){var _0x5dfa3b={};_0x5dfa3b[_0x32475b[_0x5747('0x24')]]={'$like':'%'+_0x10a65c['query'][_0x5747('0x37')]+'%'};return _0x5dfa3b;}})});}_0x50eb97=_[_0x5747('0x38')]({},_0x50eb97,_0x10a65c['options']);var _0x3025bb={'where':_0x50eb97['where']};return db[_0x5747('0x26')][_0x5747('0x18')](_0x3025bb)[_0x5747('0x21')](function(_0x6bfcc6){_0x242801[_0x5747('0x18')]=_0x6bfcc6;if(_0x10a65c['query'][_0x5747('0x3a')]){_0x50eb97['include']=[{'all':!![]}];}return db['Sound'][_0x5747('0x3b')](_0x50eb97);})['then'](function(_0x48c66b){_0x242801[_0x5747('0x3c')]=_0x48c66b;return _0x242801;})['then'](respondWithFilteredResult(_0x4ac69f,_0x50eb97))[_0x5747('0x3d')](handleError(_0x4ac69f,null));};exports[_0x5747('0x3e')]=function(_0x1a8a56,_0x1f4dbd){var _0x1eb6a5={'raw':!![],'where':{'id':_0x1a8a56['params']['id']}},_0xb8479c={};_0xb8479c[_0x5747('0x2a')]=_[_0x5747('0x2c')](db['Sound'][_0x5747('0x27')]);_0xb8479c[_0x5747('0x2b')]=_[_0x5747('0x2c')](_0x1a8a56[_0x5747('0x2b')]);_0xb8479c[_0x5747('0x36')]=_['intersection'](_0xb8479c[_0x5747('0x2a')],_0xb8479c[_0x5747('0x2b')]);_0x1eb6a5[_0x5747('0x2e')]=_[_0x5747('0x2d')](_0xb8479c[_0x5747('0x2a')],qs[_0x5747('0x2f')](_0x1a8a56[_0x5747('0x2b')][_0x5747('0x2f')]));_0x1eb6a5['attributes']=_0x1eb6a5[_0x5747('0x2e')]['length']?_0x1eb6a5[_0x5747('0x2e')]:_0xb8479c['model'];if(_0x1a8a56[_0x5747('0x2b')][_0x5747('0x3a')]){_0x1eb6a5['include']=[{'all':!![]}];}_0x1eb6a5=_[_0x5747('0x38')]({},_0x1eb6a5,_0x1a8a56[_0x5747('0x3f')]);return db[_0x5747('0x26')][_0x5747('0x40')](_0x1eb6a5)[_0x5747('0x21')](handleEntityNotFound(_0x1f4dbd,null))[_0x5747('0x21')](respondWithResult(_0x1f4dbd,null))[_0x5747('0x3d')](handleError(_0x1f4dbd,null));};exports[_0x5747('0x41')]=function(_0x54703d,_0x43c864,_0x280655){return db[_0x5747('0x26')][_0x5747('0x40')]({'where':{'id':_0x54703d[_0x5747('0x42')]['id']},'attributes':[_0x5747('0x24'),'save_name','converted_format'],'raw':!![]})[_0x5747('0x21')](handleEntityNotFound(_0x43c864,null))[_0x5747('0x21')](function(_0x5aa9a7){if(_0x5aa9a7){if(!fs['existsSync'](path[_0x5747('0x43')](config['root'],_0x5747('0x44'),_0x5aa9a7[_0x5747('0x45')]+'.'+_0x5aa9a7[_0x5747('0x46')]))){throw new db[(_0x5747('0x47'))][(_0x5747('0x48'))](_0x5747('0x49'));}return _0x43c864[_0x5747('0x41')](path['join'](config[_0x5747('0x4a')],_0x5747('0x44'),util[_0x5747('0x4b')]('%s.%s',_0x5aa9a7[_0x5747('0x45')],_0x5aa9a7['converted_format'])),util[_0x5747('0x4b')](_0x5747('0x4c'),_0x5aa9a7[_0x5747('0x24')],_0x5aa9a7[_0x5747('0x46')]));}return null;})['catch'](handleError(_0x43c864,null));};exports[_0x5747('0x4d')]=function(_0x8f26bd,_0x226d03,_0x48941d){var _0x45aacc={'name':path[_0x5747('0x4e')](_0x8f26bd[_0x5747('0x4f')][_0x5747('0x50')],path[_0x5747('0x51')](_0x8f26bd['file'][_0x5747('0x50')])),'save_name':path['basename'](_0x8f26bd[_0x5747('0x4f')]['filename'],path[_0x5747('0x51')](_0x8f26bd[_0x5747('0x4f')][_0x5747('0x52')])),'original_format':path[_0x5747('0x51')](_0x8f26bd[_0x5747('0x4f')][_0x5747('0x50')])[_0x5747('0x53')](0x1),'converted_format':_0x5747('0x54')};var _0x11b4fc=path[_0x5747('0x43')](config[_0x5747('0x4a')],_0x5747('0x55'),_0x8f26bd[_0x5747('0x4f')]['filename']);var _0x197e40=path[_0x5747('0x43')](config[_0x5747('0x4a')],'server/files/sounds/converted',util['format'](_0x5747('0x4c'),path[_0x5747('0x4e')](_0x8f26bd['file'][_0x5747('0x52')],path[_0x5747('0x51')](_0x8f26bd[_0x5747('0x4f')][_0x5747('0x52')])),_0x45aacc[_0x5747('0x46')]));logger[_0x5747('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x11b4fc);logger[_0x5747('0x56')]('Sound\x20upload\x20destination:\x20%s',_0x197e40);try{fs[_0x5747('0x57')](_0x11b4fc,parseInt(_0x5747('0x58'),0x8));var _0xf7ff5b=sox[_0x5747('0x59')](_0x11b4fc,_0x197e40,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf7ff5b['on'](_0x5747('0x23'),function(_0x2982c7){fs['unlinkSync'](_0x11b4fc);_0x226d03[_0x5747('0x16')](0x1f4)[_0x5747('0x5a')](_0x2982c7);});_0xf7ff5b['on'](_0x5747('0x5b'),function(_0x265b8a){_0x45aacc[_0x5747('0x5c')]=isNaN(_0x265b8a[_0x5747('0x5d')])?null:_0x265b8a[_0x5747('0x5d')]*0x3e8;_0x45aacc[_0x5747('0x5e')]=isNaN(_0x265b8a['sampleCount'])?null:_0x265b8a[_0x5747('0x5f')];_0x45aacc[_0x5747('0x60')]=isNaN(_0x265b8a[_0x5747('0x61')])?null:_0x265b8a[_0x5747('0x61')];_0x45aacc[_0x5747('0x62')]=isNaN(_0x265b8a['bitRate'])?null:_0x265b8a[_0x5747('0x63')];_0x45aacc[_0x5747('0x64')]=isNaN(_0x265b8a['sampleRate'])?null:_0x265b8a[_0x5747('0x65')];});_0xf7ff5b['on'](_0x5747('0x66'),function(_0x44b664){_0x45aacc[_0x5747('0x67')]=isNaN(_0x44b664[_0x5747('0x5d')])?null:_0x44b664[_0x5747('0x5d')]*0x3e8;_0x45aacc['converted_sampleCount']=isNaN(_0x44b664[_0x5747('0x5f')])?null:_0x44b664[_0x5747('0x5f')];_0x45aacc[_0x5747('0x68')]=isNaN(_0x44b664[_0x5747('0x61')])?null:_0x44b664[_0x5747('0x61')];_0x45aacc[_0x5747('0x69')]=isNaN(_0x44b664[_0x5747('0x63')])?null:_0x44b664[_0x5747('0x63')];_0x45aacc[_0x5747('0x6a')]=isNaN(_0x44b664[_0x5747('0x65')])?null:_0x44b664['sampleRate'];});_0xf7ff5b['on'](_0x5747('0x15'),function(){fs['chmodSync'](_0x197e40,parseInt(_0x5747('0x58'),0x8));return db[_0x5747('0x26')]['create'](_0x45aacc)['then'](function(_0x78590b){var _0x142c4f={'role':_0x8f26bd['body'][_0x5747('0x6b')],'userProfileId':_0x8f26bd[_0x5747('0x6c')][_0x5747('0x6d')]};if(!_0x142c4f)throw new Error(_0x5747('0x6e'));if(_0x142c4f[_0x5747('0x6b')]===_0x5747('0x6f')){var _0x4516f5=_0x78590b['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x5747('0x70'),'userProfileId':_0x142c4f[_0x5747('0x6d')]},'raw':!![]})[_0x5747('0x21')](function(_0x23430e){if(_0x23430e&&_0x23430e[_0x5747('0x71')]===0x0){return db['UserProfileResource'][_0x5747('0x4d')]({'name':_0x4516f5[_0x5747('0x24')],'resourceId':_0x4516f5['id'],'type':_0x23430e[_0x5747('0x24')],'sectionId':_0x23430e['id']},{})[_0x5747('0x21')](function(){return _0x78590b;});}else{return _0x78590b;}})[_0x5747('0x3d')](function(_0x43d768){logger['error'](_0x5747('0x72'),_0x43d768);throw _0x43d768;});}return _0x78590b;})[_0x5747('0x21')](respondWithResult(_0x226d03,null))[_0x5747('0x3d')](handleError(_0x226d03,null));});_0xf7ff5b[_0x5747('0x73')]();}catch(_0x38c6b2){_0x226d03[_0x5747('0x16')](0x1f4)[_0x5747('0x5a')](_0x38c6b2);}};exports[_0x5747('0x20')]=function(_0x139eff,_0x3b2e93,_0x7d6678){return db[_0x5747('0x26')][_0x5747('0x40')]({'where':{'id':_0x139eff['params']['id']}})['then'](handleEntityNotFound(_0x3b2e93,null))[_0x5747('0x21')](saveUpdates(_['pick'](_0x139eff[_0x5747('0x6c')],['name',_0x5747('0x74')]),null))['then'](respondWithResult(_0x3b2e93,null))['catch'](handleError(_0x3b2e93,null));};exports['delete']=function(_0x540f5a,_0x42e145,_0x4ab3f5){return db[_0x5747('0x26')][_0x5747('0x40')]({'where':{'id':_0x540f5a['params']['id']}})['then'](function(_0xdfc23b){if(_0xdfc23b){return _0xdfc23b['destroy']();}})[_0x5747('0x21')](function(_0x2583e6){var _0x16f703=path[_0x5747('0x43')](config[_0x5747('0x4a')],_0x5747('0x55'),util[_0x5747('0x4b')](_0x5747('0x4c'),_0x2583e6[_0x5747('0x45')],_0x2583e6[_0x5747('0x75')]));var _0x5215ec=path[_0x5747('0x43')](config[_0x5747('0x4a')],'server/files/sounds/converted',util[_0x5747('0x4b')]('%s.%s',_0x2583e6[_0x5747('0x45')],_0x2583e6[_0x5747('0x46')]));fs[_0x5747('0x76')](_0x16f703);fs[_0x5747('0x76')](_0x5215ec);return _0x2583e6;})[_0x5747('0x21')](function(_0x514c91){if(_0x514c91){return _0x42e145[_0x5747('0x16')](0xcc)[_0x5747('0x15')]();}})['then'](handleEntityNotFound(_0x42e145,null))[_0x5747('0x3d')](handleError(_0x42e145,null));}; \ No newline at end of file +var _0x91a9=['util','sox','to-csv','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','error','stack','name','send','Sound','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','save_name','converted_format','join','root','Sequelize','Sound\x20not\x20found','download','server/files/sounds/converted','format','%s.%s','basename','file','originalname','extname','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','server/files/sounds/original','original_format','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache'];(function(_0x31127d,_0x5e1808){var _0x4c7e55=function(_0x2465b2){while(--_0x2465b2){_0x31127d['push'](_0x31127d['shift']());}};_0x4c7e55(++_0x5e1808);}(_0x91a9,0xec));var _0x991a=function(_0x336d17,_0x57a90d){_0x336d17=_0x336d17-0x0;var _0x3c3eec=_0x91a9[_0x336d17];return _0x3c3eec;};'use strict';var pdf=require(_0x991a('0x0'));var emlformat=require(_0x991a('0x1'));var rimraf=require(_0x991a('0x2'));var zipdir=require(_0x991a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x991a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x991a('0x5'));var util=require(_0x991a('0x6'));var path=require('path');var sox=require(_0x991a('0x7'));var csv=require(_0x991a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x991a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x991a('0x8'));var querystring=require('querystring');var Papa=require(_0x991a('0xa'));var Redis=require(_0x991a('0xb'));var authService=require(_0x991a('0xc'));var qs=require(_0x991a('0xd'));var as=require(_0x991a('0xe'));var hardwareService=require(_0x991a('0xf'));var logger=require(_0x991a('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x991a('0x11'));var licenseUtil=require(_0x991a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d1aad,_0xe06fb6){_0xe06fb6=_0xe06fb6||0xcc;return function(_0x452fc0){if(_0x452fc0){return _0x1d1aad[_0x991a('0x13')](_0xe06fb6);}return _0x1d1aad[_0x991a('0x14')](_0xe06fb6)[_0x991a('0x15')]();};}function respondWithResult(_0x354599,_0x97394f){_0x97394f=_0x97394f||0xc8;return function(_0x4318d4){if(_0x4318d4){return _0x354599[_0x991a('0x14')](_0x97394f)[_0x991a('0x16')](_0x4318d4);}};}function respondWithFilteredResult(_0x3fe947,_0x4b9890){return function(_0x118dee){if(_0x118dee){var _0x3988ab=_0x118dee[_0x991a('0x17')],_0x27f0c8=_0x4b9890[_0x991a('0x18')],_0x26075b=_0x4b9890[_0x991a('0x18')]+_0x4b9890['limit'],_0x3af97f;if(_0x26075b>=_0x3988ab){_0x26075b=_0x3988ab;_0x3af97f=0xc8;}else{_0x3af97f=0xce;}_0x3fe947[_0x991a('0x14')](_0x3af97f);return _0x3fe947[_0x991a('0x19')](_0x991a('0x1a'),_0x27f0c8+'-'+_0x26075b+'/'+_0x3988ab)[_0x991a('0x16')](_0x118dee);}return null;};}function patchUpdates(_0x12549a){return function(_0x434da9){try{jsonpatch[_0x991a('0x1b')](_0x434da9,_0x12549a,!![]);}catch(_0x3b255b){return BPromise[_0x991a('0x1c')](_0x3b255b);}return _0x434da9[_0x991a('0x1d')]();};}function saveUpdates(_0x55d037,_0x222e2a){return function(_0x3124c5){if(_0x3124c5){return _0x3124c5[_0x991a('0x1e')](_0x55d037)[_0x991a('0x1f')](function(_0x4bb04b){return _0x4bb04b;});}return null;};}function removeEntity(_0x4dd149,_0x8179d2){return function(_0x2bbe66){if(_0x2bbe66){return _0x2bbe66[_0x991a('0x20')]()[_0x991a('0x1f')](function(){var _0x30834d=_0x2bbe66[_0x991a('0x21')]({'plain':!![]});var _0x5b250d=_0x991a('0x22');return db['UserProfileResource'][_0x991a('0x20')]({'where':{'type':_0x5b250d,'resourceId':_0x30834d['id']}})['then'](function(){return _0x2bbe66;});})[_0x991a('0x1f')](function(){_0x4dd149[_0x991a('0x14')](0xcc)[_0x991a('0x15')]();});}};}function handleEntityNotFound(_0x2de052,_0x152c03){return function(_0x3858a6){if(!_0x3858a6){_0x2de052['sendStatus'](0x194);}return _0x3858a6;};}function handleError(_0x26d4ec,_0x14f753){_0x14f753=_0x14f753||0x1f4;return function(_0x2145e9){logger[_0x991a('0x23')](_0x2145e9[_0x991a('0x24')]);if(_0x2145e9[_0x991a('0x25')]){delete _0x2145e9['name'];}_0x26d4ec[_0x991a('0x14')](_0x14f753)[_0x991a('0x26')](_0x2145e9);};}exports['index']=function(_0x119993,_0x19121d){var _0xc3b3df={},_0x574115={},_0x88d15b={'count':0x0,'rows':[]};var _0x174dc7=_['map'](db[_0x991a('0x27')]['rawAttributes'],function(_0x47524c){return{'name':_0x47524c[_0x991a('0x28')],'type':_0x47524c[_0x991a('0x29')][_0x991a('0x2a')]};});_0x574115[_0x991a('0x2b')]=_['map'](_0x174dc7,'name');_0x574115[_0x991a('0x2c')]=_[_0x991a('0x2d')](_0x119993[_0x991a('0x2c')]);_0x574115[_0x991a('0x2e')]=_[_0x991a('0x2f')](_0x574115[_0x991a('0x2b')],_0x574115[_0x991a('0x2c')]);_0xc3b3df['attributes']=_['intersection'](_0x574115[_0x991a('0x2b')],qs[_0x991a('0x30')](_0x119993[_0x991a('0x2c')][_0x991a('0x30')]));_0xc3b3df[_0x991a('0x31')]=_0xc3b3df[_0x991a('0x31')][_0x991a('0x32')]?_0xc3b3df[_0x991a('0x31')]:_0x574115[_0x991a('0x2b')];if(!_0x119993[_0x991a('0x2c')][_0x991a('0x33')](_0x991a('0x34'))){_0xc3b3df['limit']=qs[_0x991a('0x35')](_0x119993[_0x991a('0x2c')][_0x991a('0x35')]);_0xc3b3df['offset']=qs[_0x991a('0x18')](_0x119993[_0x991a('0x2c')][_0x991a('0x18')]);}_0xc3b3df[_0x991a('0x36')]=qs['sort'](_0x119993[_0x991a('0x2c')][_0x991a('0x37')]);_0xc3b3df['where']=qs[_0x991a('0x2e')](_[_0x991a('0x38')](_0x119993[_0x991a('0x2c')],_0x574115['filters']),_0x174dc7);if(_0x119993[_0x991a('0x2c')][_0x991a('0x39')]){_0xc3b3df[_0x991a('0x3a')]=_[_0x991a('0x3b')](_0xc3b3df[_0x991a('0x3a')],{'$or':_[_0x991a('0x3c')](_0x174dc7,function(_0x528300){if(_0x528300[_0x991a('0x29')]!==_0x991a('0x3d')){var _0x48ac32={};_0x48ac32[_0x528300[_0x991a('0x25')]]={'$like':'%'+_0x119993[_0x991a('0x2c')][_0x991a('0x39')]+'%'};return _0x48ac32;}})});}_0xc3b3df=_[_0x991a('0x3b')]({},_0xc3b3df,_0x119993[_0x991a('0x3e')]);var _0x5c4537={'where':_0xc3b3df[_0x991a('0x3a')]};return db[_0x991a('0x27')][_0x991a('0x17')](_0x5c4537)[_0x991a('0x1f')](function(_0x2ff4cd){_0x88d15b[_0x991a('0x17')]=_0x2ff4cd;if(_0x119993['query'][_0x991a('0x3f')]){_0xc3b3df['include']=[{'all':!![]}];}return db[_0x991a('0x27')][_0x991a('0x40')](_0xc3b3df);})[_0x991a('0x1f')](function(_0x44cd41){_0x88d15b[_0x991a('0x41')]=_0x44cd41;return _0x88d15b;})[_0x991a('0x1f')](respondWithFilteredResult(_0x19121d,_0xc3b3df))['catch'](handleError(_0x19121d,null));};exports[_0x991a('0x42')]=function(_0xe205cb,_0x59ed53){var _0x272812={'raw':!![],'where':{'id':_0xe205cb[_0x991a('0x43')]['id']}},_0x2fc4d8={};_0x2fc4d8[_0x991a('0x2b')]=_[_0x991a('0x2d')](db[_0x991a('0x27')][_0x991a('0x44')]);_0x2fc4d8[_0x991a('0x2c')]=_['keys'](_0xe205cb['query']);_0x2fc4d8[_0x991a('0x2e')]=_[_0x991a('0x2f')](_0x2fc4d8['model'],_0x2fc4d8['query']);_0x272812['attributes']=_['intersection'](_0x2fc4d8[_0x991a('0x2b')],qs[_0x991a('0x30')](_0xe205cb[_0x991a('0x2c')][_0x991a('0x30')]));_0x272812[_0x991a('0x31')]=_0x272812[_0x991a('0x31')][_0x991a('0x32')]?_0x272812[_0x991a('0x31')]:_0x2fc4d8['model'];if(_0xe205cb[_0x991a('0x2c')][_0x991a('0x3f')]){_0x272812[_0x991a('0x45')]=[{'all':!![]}];}_0x272812=_[_0x991a('0x3b')]({},_0x272812,_0xe205cb['options']);return db[_0x991a('0x27')][_0x991a('0x46')](_0x272812)[_0x991a('0x1f')](handleEntityNotFound(_0x59ed53,null))[_0x991a('0x1f')](respondWithResult(_0x59ed53,null))[_0x991a('0x47')](handleError(_0x59ed53,null));};exports['download']=function(_0x52fe0f,_0x114211,_0x42cf39){return db['Sound']['find']({'where':{'id':_0x52fe0f[_0x991a('0x43')]['id']},'attributes':[_0x991a('0x25'),_0x991a('0x48'),_0x991a('0x49')],'raw':!![]})[_0x991a('0x1f')](handleEntityNotFound(_0x114211,null))['then'](function(_0x172662){if(_0x172662){if(!fs['existsSync'](path[_0x991a('0x4a')](config[_0x991a('0x4b')],'server/files/sounds/converted',_0x172662[_0x991a('0x48')]+'.'+_0x172662[_0x991a('0x49')]))){throw new db[(_0x991a('0x4c'))]['ValidationError'](_0x991a('0x4d'));}return _0x114211[_0x991a('0x4e')](path['join'](config[_0x991a('0x4b')],_0x991a('0x4f'),util[_0x991a('0x50')]('%s.%s',_0x172662[_0x991a('0x48')],_0x172662[_0x991a('0x49')])),util['format'](_0x991a('0x51'),_0x172662[_0x991a('0x25')],_0x172662[_0x991a('0x49')]));}return null;})[_0x991a('0x47')](handleError(_0x114211,null));};exports['create']=function(_0x55198a,_0x4e96d2,_0x597e5b){var _0x31e35a={'name':path[_0x991a('0x52')](_0x55198a[_0x991a('0x53')][_0x991a('0x54')],path[_0x991a('0x55')](_0x55198a['file'][_0x991a('0x54')])),'save_name':path[_0x991a('0x52')](_0x55198a[_0x991a('0x53')][_0x991a('0x56')],path[_0x991a('0x55')](_0x55198a['file']['filename'])),'original_format':path[_0x991a('0x55')](_0x55198a[_0x991a('0x53')][_0x991a('0x54')])[_0x991a('0x57')](0x1),'converted_format':'wav'};var _0x4d41f1=path['join'](config[_0x991a('0x4b')],'server/files/sounds/original',_0x55198a[_0x991a('0x53')][_0x991a('0x56')]);var _0x295280=path[_0x991a('0x4a')](config[_0x991a('0x4b')],_0x991a('0x4f'),util[_0x991a('0x50')]('%s.%s',path[_0x991a('0x52')](_0x55198a[_0x991a('0x53')]['filename'],path[_0x991a('0x55')](_0x55198a[_0x991a('0x53')][_0x991a('0x56')])),_0x31e35a[_0x991a('0x49')]));logger[_0x991a('0x58')](_0x991a('0x59'),_0x4d41f1);logger[_0x991a('0x58')](_0x991a('0x5a'),_0x295280);try{fs[_0x991a('0x5b')](_0x4d41f1,parseInt(_0x991a('0x5c'),0x8));var _0x1af54e=sox[_0x991a('0x5d')](_0x4d41f1,_0x295280,{'sampleRate':0x1f40,'format':_0x991a('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1af54e['on']('error',function(_0x561d0c){fs['unlinkSync'](_0x4d41f1);_0x4e96d2[_0x991a('0x14')](0x1f4)[_0x991a('0x26')](_0x561d0c);});_0x1af54e['on'](_0x991a('0x5f'),function(_0x2e7b45){_0x31e35a[_0x991a('0x60')]=isNaN(_0x2e7b45[_0x991a('0x61')])?null:_0x2e7b45[_0x991a('0x61')]*0x3e8;_0x31e35a[_0x991a('0x62')]=isNaN(_0x2e7b45[_0x991a('0x63')])?null:_0x2e7b45[_0x991a('0x63')];_0x31e35a[_0x991a('0x64')]=isNaN(_0x2e7b45[_0x991a('0x65')])?null:_0x2e7b45['channelCount'];_0x31e35a['original_bitRate']=isNaN(_0x2e7b45[_0x991a('0x66')])?null:_0x2e7b45[_0x991a('0x66')];_0x31e35a['original_sampleRate']=isNaN(_0x2e7b45[_0x991a('0x67')])?null:_0x2e7b45[_0x991a('0x67')];});_0x1af54e['on'](_0x991a('0x68'),function(_0x34fc1d){_0x31e35a[_0x991a('0x69')]=isNaN(_0x34fc1d[_0x991a('0x61')])?null:_0x34fc1d[_0x991a('0x61')]*0x3e8;_0x31e35a[_0x991a('0x6a')]=isNaN(_0x34fc1d[_0x991a('0x63')])?null:_0x34fc1d['sampleCount'];_0x31e35a['converted_channelCount']=isNaN(_0x34fc1d[_0x991a('0x65')])?null:_0x34fc1d[_0x991a('0x65')];_0x31e35a[_0x991a('0x6b')]=isNaN(_0x34fc1d['bitRate'])?null:_0x34fc1d[_0x991a('0x66')];_0x31e35a['converted_sampleRate']=isNaN(_0x34fc1d[_0x991a('0x67')])?null:_0x34fc1d['sampleRate'];});_0x1af54e['on'](_0x991a('0x15'),function(){fs[_0x991a('0x5b')](_0x295280,parseInt(_0x991a('0x5c'),0x8));return db[_0x991a('0x27')]['create'](_0x31e35a)[_0x991a('0x1f')](function(_0x281bfd){var _0x4ecb54={'role':_0x55198a[_0x991a('0x6c')]['role'],'userProfileId':_0x55198a[_0x991a('0x6c')][_0x991a('0x6d')]};if(!_0x4ecb54)throw new Error(_0x991a('0x6e'));if(_0x4ecb54['role']===_0x991a('0x6f')){var _0x36a6ea=_0x281bfd[_0x991a('0x21')]({'plain':!![]});return db[_0x991a('0x70')][_0x991a('0x46')]({'where':{'name':'Sounds','userProfileId':_0x4ecb54[_0x991a('0x6d')]},'raw':!![]})[_0x991a('0x1f')](function(_0x3c01b1){if(_0x3c01b1&&_0x3c01b1['autoAssociation']===0x0){return db[_0x991a('0x71')][_0x991a('0x72')]({'name':_0x36a6ea[_0x991a('0x25')],'resourceId':_0x36a6ea['id'],'type':_0x3c01b1[_0x991a('0x25')],'sectionId':_0x3c01b1['id']},{})[_0x991a('0x1f')](function(){return _0x281bfd;});}else{return _0x281bfd;}})['catch'](function(_0x3e580f){logger[_0x991a('0x23')](_0x991a('0x73'),_0x3e580f);throw _0x3e580f;});}return _0x281bfd;})[_0x991a('0x1f')](respondWithResult(_0x4e96d2,null))[_0x991a('0x47')](handleError(_0x4e96d2,null));});_0x1af54e['start']();}catch(_0x3713c5){_0x4e96d2[_0x991a('0x14')](0x1f4)['send'](_0x3713c5);}};exports[_0x991a('0x1e')]=function(_0x4589d0,_0x1c3223,_0x55270e){return db[_0x991a('0x27')]['find']({'where':{'id':_0x4589d0['params']['id']}})[_0x991a('0x1f')](handleEntityNotFound(_0x1c3223,null))[_0x991a('0x1f')](saveUpdates(_[_0x991a('0x38')](_0x4589d0['body'],['name',_0x991a('0x74')]),null))['then'](respondWithResult(_0x1c3223,null))[_0x991a('0x47')](handleError(_0x1c3223,null));};exports[_0x991a('0x75')]=function(_0x1ba641,_0x5a1bef,_0x571d48){return db[_0x991a('0x27')][_0x991a('0x46')]({'where':{'id':_0x1ba641['params']['id']}})[_0x991a('0x1f')](function(_0x19c8f5){if(_0x19c8f5){return _0x19c8f5[_0x991a('0x20')]();}})[_0x991a('0x1f')](function(_0x51f7d3){var _0x285643=path[_0x991a('0x4a')](config[_0x991a('0x4b')],_0x991a('0x76'),util[_0x991a('0x50')]('%s.%s',_0x51f7d3['save_name'],_0x51f7d3[_0x991a('0x77')]));var _0x52881e=path[_0x991a('0x4a')](config[_0x991a('0x4b')],'server/files/sounds/converted',util[_0x991a('0x50')](_0x991a('0x51'),_0x51f7d3['save_name'],_0x51f7d3['converted_format']));fs[_0x991a('0x78')](_0x285643);fs[_0x991a('0x78')](_0x52881e);return _0x51f7d3;})[_0x991a('0x1f')](function(_0x4853b7){if(_0x4853b7){return _0x5a1bef[_0x991a('0x14')](0xcc)[_0x991a('0x15')]();}})[_0x991a('0x1f')](handleEntityNotFound(_0x5a1bef,null))[_0x991a('0x47')](handleError(_0x5a1bef,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ecb4080..c4aab04 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 _0xa591=['request-promise','path','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x179596,_0x43483a){var _0x441d8a=function(_0x7ae3a9){while(--_0x7ae3a9){_0x179596['push'](_0x179596['shift']());}};_0x441d8a(++_0x43483a);}(_0xa591,0x13f));var _0x1a59=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xa591[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x1a59('0x0'));var util=require(_0x1a59('0x1'));var logger=require(_0x1a59('0x2'))(_0x1a59('0x3'));var moment=require(_0x1a59('0x4'));var BPromise=require(_0x1a59('0x5'));var rp=require(_0x1a59('0x6'));var fs=require('fs');var path=require(_0x1a59('0x7'));var rimraf=require('rimraf');var config=require(_0x1a59('0x8'));var attributes=require(_0x1a59('0x9'));module[_0x1a59('0xa')]=function(_0x4fb1e1,_0x152392){return _0x4fb1e1[_0x1a59('0xb')]('Sound',attributes,{'tableName':_0x1a59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x281e=['tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./sound.attributes','define','Sound'];(function(_0x1ba02d,_0x168483){var _0x1682e1=function(_0x465e10){while(--_0x465e10){_0x1ba02d['push'](_0x1ba02d['shift']());}};_0x1682e1(++_0x168483);}(_0x281e,0xcd));var _0xe281=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x281e[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0xe281('0x0'));var util=require(_0xe281('0x1'));var logger=require(_0xe281('0x2'))(_0xe281('0x3'));var moment=require(_0xe281('0x4'));var BPromise=require('bluebird');var rp=require(_0xe281('0x5'));var fs=require('fs');var path=require(_0xe281('0x6'));var rimraf=require('rimraf');var config=require(_0xe281('0x7'));var attributes=require(_0xe281('0x8'));module['exports']=function(_0x5a4fa5,_0x565308){return _0x5a4fa5[_0xe281('0x9')](_0xe281('0xa'),attributes,{'tableName':_0xe281('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index e094761..e7cdb3e 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 _0xe045=['rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSound','find','options','raw','where','include','model','attributes','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d7ca6,_0x422b3f){var _0x12ad69=function(_0x1a7afa){while(--_0x1a7afa){_0x4d7ca6['push'](_0x4d7ca6['shift']());}};_0x12ad69(++_0x422b3f);}(_0xe045,0xf9));var _0x5e04=function(_0x4342ec,_0x38c8d2){_0x4342ec=_0x4342ec-0x0;var _0x442966=_0xe045[_0x4342ec];return _0x442966;};'use strict';var _=require(_0x5e04('0x0'));var util=require(_0x5e04('0x1'));var moment=require(_0x5e04('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e04('0x3'));var fs=require('fs');var Redis=require(_0x5e04('0x4'));var db=require(_0x5e04('0x5'))['db'];var utils=require(_0x5e04('0x6'));var logger=require('../../config/logger')(_0x5e04('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e04('0x8'));var client=jayson[_0x5e04('0x9')][_0x5e04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46c124,_0x3bed8d,_0x3bdc89){return new BPromise(function(_0x179650,_0x11f3d9){return client[_0x5e04('0xb')](_0x46c124,_0x3bdc89)[_0x5e04('0xc')](function(_0x1c779b){logger[_0x5e04('0xd')](_0x5e04('0xe'),_0x3bed8d,_0x5e04('0xf'));logger[_0x5e04('0x10')](_0x5e04('0x11'),_0x3bed8d,_0x5e04('0xf'),JSON[_0x5e04('0x12')](_0x1c779b));if(_0x1c779b[_0x5e04('0x13')]){if(_0x1c779b['error'][_0x5e04('0x14')]===0x1f4){logger[_0x5e04('0x13')](_0x5e04('0xe'),_0x3bed8d,_0x1c779b[_0x5e04('0x13')][_0x5e04('0x15')]);return _0x11f3d9(_0x1c779b[_0x5e04('0x13')][_0x5e04('0x15')]);}logger[_0x5e04('0x13')](_0x5e04('0xe'),_0x3bed8d,_0x1c779b[_0x5e04('0x13')][_0x5e04('0x15')]);return _0x179650(_0x1c779b[_0x5e04('0x13')][_0x5e04('0x15')]);}else{logger[_0x5e04('0xd')](_0x5e04('0xe'),_0x3bed8d,'request\x20sent');_0x179650(_0x1c779b['result'][_0x5e04('0x15')]);}})[_0x5e04('0x16')](function(_0xa80d03){logger[_0x5e04('0x13')]('Sound,\x20%s,\x20%s',_0x3bed8d,_0xa80d03);_0x11f3d9(_0xa80d03);});});}exports[_0x5e04('0x17')]=function(_0x58e5c8){var _0x4f5a47=this;return new Promise(function(_0x82ffc9,_0x116fb5){return db['Sound'][_0x5e04('0x18')]({'raw':_0x58e5c8[_0x5e04('0x19')]?_0x58e5c8[_0x5e04('0x19')][_0x5e04('0x1a')]===undefined?!![]:![]:!![],'where':_0x58e5c8['options']?_0x58e5c8['options'][_0x5e04('0x1b')]||null:null,'attributes':_0x58e5c8[_0x5e04('0x19')]?_0x58e5c8[_0x5e04('0x19')]['attributes']||null:null,'include':_0x58e5c8['options']?_0x58e5c8[_0x5e04('0x19')][_0x5e04('0x1c')]?_['map'](_0x58e5c8[_0x5e04('0x19')]['include'],function(_0x474519){return{'model':db[_0x474519[_0x5e04('0x1d')]],'as':_0x474519['as'],'attributes':_0x474519[_0x5e04('0x1e')],'include':_0x474519['include']?_[_0x5e04('0x1f')](_0x474519[_0x5e04('0x1c')],function(_0x3560b0){return{'model':db[_0x3560b0[_0x5e04('0x1d')]],'as':_0x3560b0['as'],'attributes':_0x3560b0[_0x5e04('0x1e')],'include':_0x3560b0[_0x5e04('0x1c')]?_[_0x5e04('0x1f')](_0x3560b0[_0x5e04('0x1c')],function(_0xbe9e63){return{'model':db[_0xbe9e63['model']],'as':_0xbe9e63['as'],'attributes':_0xbe9e63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0c9c3){logger[_0x5e04('0xd')]('ShowSound',_0x58e5c8);logger['debug'](_0x5e04('0x17'),_0x58e5c8,JSON[_0x5e04('0x12')](_0xb0c9c3));_0x82ffc9(_0xb0c9c3);})[_0x5e04('0x16')](function(_0x320554){logger['error']('ShowSound',_0x320554['message'],_0x58e5c8);_0x116fb5(_0x4f5a47[_0x5e04('0x13')](0x1f4,_0x320554[_0x5e04('0x15')]));});});}; \ No newline at end of file +var _0xe63c=['model','ShowSound','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','Sound','find','options','raw','where','attributes','include','map'];(function(_0xd48378,_0x4a7af8){var _0xd7f94b=function(_0x248eb5){while(--_0x248eb5){_0xd48378['push'](_0xd48378['shift']());}};_0xd7f94b(++_0x4a7af8);}(_0xe63c,0x176));var _0xce63=function(_0x512aa7,_0x2be0d9){_0x512aa7=_0x512aa7-0x0;var _0x952539=_0xe63c[_0x512aa7];return _0x952539;};'use strict';var _=require(_0xce63('0x0'));var util=require(_0xce63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce63('0x2'));var fs=require('fs');var Redis=require(_0xce63('0x3'));var db=require(_0xce63('0x4'))['db'];var utils=require(_0xce63('0x5'));var logger=require(_0xce63('0x6'))(_0xce63('0x7'));var config=require(_0xce63('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x267e6f,_0x312aa4,_0x23c589){return new BPromise(function(_0x1c84a4,_0x39d92d){return client[_0xce63('0xa')](_0x267e6f,_0x23c589)[_0xce63('0xb')](function(_0x11ee39){logger[_0xce63('0xc')](_0xce63('0xd'),_0x312aa4,'request\x20sent');logger[_0xce63('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x312aa4,_0xce63('0xf'),JSON[_0xce63('0x10')](_0x11ee39));if(_0x11ee39[_0xce63('0x11')]){if(_0x11ee39[_0xce63('0x11')]['code']===0x1f4){logger[_0xce63('0x11')](_0xce63('0xd'),_0x312aa4,_0x11ee39['error']['message']);return _0x39d92d(_0x11ee39['error']['message']);}logger[_0xce63('0x11')](_0xce63('0xd'),_0x312aa4,_0x11ee39[_0xce63('0x11')][_0xce63('0x12')]);return _0x1c84a4(_0x11ee39['error'][_0xce63('0x12')]);}else{logger['info'](_0xce63('0xd'),_0x312aa4,_0xce63('0xf'));_0x1c84a4(_0x11ee39[_0xce63('0x13')][_0xce63('0x12')]);}})[_0xce63('0x14')](function(_0x41c428){logger[_0xce63('0x11')]('Sound,\x20%s,\x20%s',_0x312aa4,_0x41c428);_0x39d92d(_0x41c428);});});}exports['ShowSound']=function(_0xd5502d){var _0x1a4012=this;return new Promise(function(_0x5b4995,_0x56559e){return db[_0xce63('0x15')][_0xce63('0x16')]({'raw':_0xd5502d['options']?_0xd5502d[_0xce63('0x17')][_0xce63('0x18')]===undefined?!![]:![]:!![],'where':_0xd5502d['options']?_0xd5502d[_0xce63('0x17')][_0xce63('0x19')]||null:null,'attributes':_0xd5502d[_0xce63('0x17')]?_0xd5502d[_0xce63('0x17')][_0xce63('0x1a')]||null:null,'include':_0xd5502d[_0xce63('0x17')]?_0xd5502d[_0xce63('0x17')][_0xce63('0x1b')]?_[_0xce63('0x1c')](_0xd5502d[_0xce63('0x17')][_0xce63('0x1b')],function(_0x150031){return{'model':db[_0x150031['model']],'as':_0x150031['as'],'attributes':_0x150031[_0xce63('0x1a')],'include':_0x150031[_0xce63('0x1b')]?_[_0xce63('0x1c')](_0x150031['include'],function(_0x2c5eca){return{'model':db[_0x2c5eca['model']],'as':_0x2c5eca['as'],'attributes':_0x2c5eca[_0xce63('0x1a')],'include':_0x2c5eca[_0xce63('0x1b')]?_['map'](_0x2c5eca[_0xce63('0x1b')],function(_0x36e6d4){return{'model':db[_0x36e6d4[_0xce63('0x1d')]],'as':_0x36e6d4['as'],'attributes':_0x36e6d4[_0xce63('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x519f68){logger[_0xce63('0xc')](_0xce63('0x1e'),_0xd5502d);logger[_0xce63('0xe')](_0xce63('0x1e'),_0xd5502d,JSON['stringify'](_0x519f68));_0x5b4995(_0x519f68);})[_0xce63('0x14')](function(_0x15be2d){logger[_0xce63('0x11')](_0xce63('0x1e'),_0x15be2d[_0xce63('0x12')],_0xd5502d);_0x56559e(_0x1a4012['error'](0x1f4,_0x15be2d[_0xce63('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index f9cb739..83f29c0 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 _0xb15f=['../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb15f,0x14e));var _0xfb15=function(_0x44cd33,_0x1e89fd){_0x44cd33=_0x44cd33-0x0;var _0x389200=_0xb15f[_0x44cd33];return _0x389200;};'use strict';var multer=require(_0xfb15('0x0'));var util=require(_0xfb15('0x1'));var path=require(_0xfb15('0x2'));var timeout=require(_0xfb15('0x3'));var express=require(_0xfb15('0x4'));var router=express[_0xfb15('0x5')]();var auth=require(_0xfb15('0x6'));var interaction=require(_0xfb15('0x7'));var config=require(_0xfb15('0x8'));var controller=require(_0xfb15('0x9'));router[_0xfb15('0xa')]('/',auth[_0xfb15('0xb')](),controller[_0xfb15('0xc')]);router[_0xfb15('0xa')](_0xfb15('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfb15('0xb')](),controller[_0xfb15('0xe')]);router[_0xfb15('0xf')]('/:id',auth[_0xfb15('0xb')](),controller['update']);router['delete'](_0xfb15('0xd'),auth[_0xfb15('0xb')](),controller[_0xfb15('0x10')]);module[_0xfb15('0x11')]=router; \ No newline at end of file +var _0x4239=['express','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x57c4ec,_0xfb1ad0){var _0x157f3c=function(_0x283be4){while(--_0x283be4){_0x57c4ec['push'](_0x57c4ec['shift']());}};_0x157f3c(++_0xfb1ad0);}(_0x4239,0x13e));var _0x9423=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x4239[_0x328534];return _0x2796c0;};'use strict';var multer=require('multer');var util=require(_0x9423('0x0'));var path=require('path');var timeout=require(_0x9423('0x1'));var express=require(_0x9423('0x2'));var router=express['Router']();var auth=require(_0x9423('0x3'));var interaction=require(_0x9423('0x4'));var config=require('../../config/environment');var controller=require(_0x9423('0x5'));router[_0x9423('0x6')]('/',auth[_0x9423('0x7')](),controller['index']);router['get'](_0x9423('0x8'),auth[_0x9423('0x7')](),controller['show']);router[_0x9423('0x9')]('/',auth['isAuthenticated'](),controller[_0x9423('0xa')]);router[_0x9423('0xb')](_0x9423('0x8'),auth[_0x9423('0x7')](),controller[_0x9423('0xc')]);router[_0x9423('0xd')](_0x9423('0x8'),auth[_0x9423('0x7')](),controller[_0x9423('0xe')]);module[_0x9423('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 61bc54c..e332117 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 _0x950a=['TEXT','ENUM','out','sequelize','exports','STRING'];(function(_0x30e9fe,_0x329e07){var _0x4065bc=function(_0x1cab9f){while(--_0x1cab9f){_0x30e9fe['push'](_0x30e9fe['shift']());}};_0x4065bc(++_0x329e07);}(_0x950a,0x111));var _0xa950=function(_0x1dcb8f,_0x86508c){_0x1dcb8f=_0x1dcb8f-0x0;var _0x30e981=_0x950a[_0x1dcb8f];return _0x30e981;};'use strict';var Sequelize=require(_0xa950('0x0'));module[_0xa950('0x1')]={'uniqueid':{'type':Sequelize[_0xa950('0x2')]},'body':{'type':Sequelize[_0xa950('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xa950('0x4')]('in',_0xa950('0x5')),'defaultValue':_0xa950('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xa950('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x33c5=['exports','STRING','medium','ENUM','out'];(function(_0x31a151,_0x4c8524){var _0x497f51=function(_0x506328){while(--_0x506328){_0x31a151['push'](_0x31a151['shift']());}};_0x497f51(++_0x4c8524);}(_0x33c5,0xe6));var _0x533c=function(_0x22fe5c,_0x28645c){_0x22fe5c=_0x22fe5c-0x0;var _0x17a217=_0x33c5[_0x22fe5c];return _0x17a217;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'uniqueid':{'type':Sequelize[_0x533c('0x1')]},'body':{'type':Sequelize['TEXT'](_0x533c('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x533c('0x3')]('in',_0x533c('0x4')),'defaultValue':_0x533c('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x533c('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 9940b71..7cdad2c 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 _0x49e0=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','apply','save','destroy','end','error','stack','name','map','SquareMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','count','findAll','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x3cf6c3,_0xffc8e1){var _0x278f94=function(_0x2cd473){while(--_0x2cd473){_0x3cf6c3['push'](_0x3cf6c3['shift']());}};_0x278f94(++_0xffc8e1);}(_0x49e0,0x1da));var _0x049e=function(_0x104b52,_0x530e51){_0x104b52=_0x104b52-0x0;var _0x30b11b=_0x49e0[_0x104b52];return _0x30b11b;};'use strict';var pdf=require(_0x049e('0x0'));var emlformat=require(_0x049e('0x1'));var rimraf=require(_0x049e('0x2'));var zipdir=require(_0x049e('0x3'));var jsonpatch=require(_0x049e('0x4'));var rp=require(_0x049e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x049e('0x6'));var util=require(_0x049e('0x7'));var path=require(_0x049e('0x8'));var sox=require(_0x049e('0x9'));var csv=require(_0x049e('0xa'));var ejs=require(_0x049e('0xb'));var fs=require('fs');var _=require(_0x049e('0xc'));var squel=require(_0x049e('0xd'));var crypto=require(_0x049e('0xe'));var jsforce=require(_0x049e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x049e('0xa'));var querystring=require(_0x049e('0x10'));var Papa=require(_0x049e('0x11'));var Redis=require('ioredis');var authService=require(_0x049e('0x12'));var qs=require(_0x049e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x049e('0x14'))(_0x049e('0x15'));var utils=require(_0x049e('0x16'));var config=require(_0x049e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x049e('0x18'))['db'];function respondWithStatusCode(_0x486255,_0x44ebb8){_0x44ebb8=_0x44ebb8||0xcc;return function(_0x18e3a4){if(_0x18e3a4){return _0x486255[_0x049e('0x19')](_0x44ebb8);}return _0x486255[_0x049e('0x1a')](_0x44ebb8)['end']();};}function respondWithResult(_0x3ef07f,_0x123c06){_0x123c06=_0x123c06||0xc8;return function(_0x41e60b){if(_0x41e60b){return _0x3ef07f[_0x049e('0x1a')](_0x123c06)[_0x049e('0x1b')](_0x41e60b);}};}function respondWithFilteredResult(_0x360dc8,_0x117d40){return function(_0x2e9841){if(_0x2e9841){var _0x3abe6c=_0x2e9841['count'],_0x1bf503=_0x117d40[_0x049e('0x1c')],_0x19c3e0=_0x117d40['offset']+_0x117d40['limit'],_0x4456de;if(_0x19c3e0>=_0x3abe6c){_0x19c3e0=_0x3abe6c;_0x4456de=0xc8;}else{_0x4456de=0xce;}_0x360dc8[_0x049e('0x1a')](_0x4456de);return _0x360dc8['set']('Content-Range',_0x1bf503+'-'+_0x19c3e0+'/'+_0x3abe6c)[_0x049e('0x1b')](_0x2e9841);}return null;};}function patchUpdates(_0x3c5b93){return function(_0x1845f8){try{jsonpatch[_0x049e('0x1d')](_0x1845f8,_0x3c5b93,!![]);}catch(_0x1c3deb){return BPromise['reject'](_0x1c3deb);}return _0x1845f8[_0x049e('0x1e')]();};}function saveUpdates(_0x37fdbd,_0x22298f){return function(_0x80da41){if(_0x80da41){return _0x80da41['update'](_0x37fdbd)['then'](function(_0x4f28d7){return _0x4f28d7;});}return null;};}function removeEntity(_0x57f035,_0x154a68){return function(_0x48d54b){if(_0x48d54b){return _0x48d54b[_0x049e('0x1f')]()['then'](function(){_0x57f035[_0x049e('0x1a')](0xcc)[_0x049e('0x20')]();});}};}function handleEntityNotFound(_0x1d66a6,_0x1dd0c5){return function(_0x56473d){if(!_0x56473d){_0x1d66a6[_0x049e('0x19')](0x194);}return _0x56473d;};}function handleError(_0xebe8f7,_0x2e931b){_0x2e931b=_0x2e931b||0x1f4;return function(_0x10b445){logger[_0x049e('0x21')](_0x10b445[_0x049e('0x22')]);if(_0x10b445[_0x049e('0x23')]){delete _0x10b445['name'];}_0xebe8f7['status'](_0x2e931b)['send'](_0x10b445);};}exports['index']=function(_0x5dc9db,_0x5d5056){var _0x292e9c={},_0x30e551={},_0x3e33cf={'count':0x0,'rows':[]};var _0x37f0a4=_[_0x049e('0x24')](db[_0x049e('0x25')][_0x049e('0x26')],function(_0x512e96){return{'name':_0x512e96['fieldName'],'type':_0x512e96[_0x049e('0x27')][_0x049e('0x28')]};});_0x30e551[_0x049e('0x29')]=_[_0x049e('0x24')](_0x37f0a4,_0x049e('0x23'));_0x30e551[_0x049e('0x2a')]=_[_0x049e('0x2b')](_0x5dc9db['query']);_0x30e551[_0x049e('0x2c')]=_[_0x049e('0x2d')](_0x30e551[_0x049e('0x29')],_0x30e551[_0x049e('0x2a')]);_0x292e9c['attributes']=_[_0x049e('0x2d')](_0x30e551[_0x049e('0x29')],qs[_0x049e('0x2e')](_0x5dc9db['query']['fields']));_0x292e9c[_0x049e('0x2f')]=_0x292e9c[_0x049e('0x2f')]['length']?_0x292e9c[_0x049e('0x2f')]:_0x30e551['model'];if(!_0x5dc9db['query'][_0x049e('0x30')](_0x049e('0x31'))){_0x292e9c[_0x049e('0x32')]=qs[_0x049e('0x32')](_0x5dc9db['query'][_0x049e('0x32')]);_0x292e9c[_0x049e('0x1c')]=qs['offset'](_0x5dc9db[_0x049e('0x2a')]['offset']);}_0x292e9c[_0x049e('0x33')]=qs['sort'](_0x5dc9db[_0x049e('0x2a')][_0x049e('0x34')]);_0x292e9c[_0x049e('0x35')]=qs['filters'](_[_0x049e('0x36')](_0x5dc9db[_0x049e('0x2a')],_0x30e551[_0x049e('0x2c')]),_0x37f0a4);if(_0x5dc9db['query'][_0x049e('0x37')]){_0x292e9c[_0x049e('0x35')]=_[_0x049e('0x38')](_0x292e9c[_0x049e('0x35')],{'$or':_[_0x049e('0x24')](_0x37f0a4,function(_0x22b5a9){if(_0x22b5a9[_0x049e('0x27')]!==_0x049e('0x39')){var _0x3d4735={};_0x3d4735[_0x22b5a9[_0x049e('0x23')]]={'$like':'%'+_0x5dc9db[_0x049e('0x2a')][_0x049e('0x37')]+'%'};return _0x3d4735;}})});}_0x292e9c=_[_0x049e('0x38')]({},_0x292e9c,_0x5dc9db[_0x049e('0x3a')]);var _0x48e3e5={'where':_0x292e9c[_0x049e('0x35')]};return db[_0x049e('0x25')]['count'](_0x48e3e5)[_0x049e('0x3b')](function(_0x41cb4c){_0x3e33cf[_0x049e('0x3c')]=_0x41cb4c;if(_0x5dc9db['query']['includeAll']){_0x292e9c['include']=[{'all':!![]}];}return db['SquareMessage'][_0x049e('0x3d')](_0x292e9c);})[_0x049e('0x3b')](function(_0x33a255){_0x3e33cf['rows']=_0x33a255;return _0x3e33cf;})['then'](respondWithFilteredResult(_0x5d5056,_0x292e9c))[_0x049e('0x3e')](handleError(_0x5d5056,null));};exports[_0x049e('0x3f')]=function(_0x3cb744,_0x476b14){var _0x19487a={'raw':!![],'where':{'id':_0x3cb744[_0x049e('0x40')]['id']}},_0x38c4dc={};_0x38c4dc['model']=_[_0x049e('0x2b')](db['SquareMessage']['rawAttributes']);_0x38c4dc[_0x049e('0x2a')]=_[_0x049e('0x2b')](_0x3cb744[_0x049e('0x2a')]);_0x38c4dc['filters']=_[_0x049e('0x2d')](_0x38c4dc[_0x049e('0x29')],_0x38c4dc[_0x049e('0x2a')]);_0x19487a['attributes']=_[_0x049e('0x2d')](_0x38c4dc[_0x049e('0x29')],qs[_0x049e('0x2e')](_0x3cb744['query']['fields']));_0x19487a[_0x049e('0x2f')]=_0x19487a[_0x049e('0x2f')]['length']?_0x19487a['attributes']:_0x38c4dc[_0x049e('0x29')];if(_0x3cb744[_0x049e('0x2a')][_0x049e('0x41')]){_0x19487a[_0x049e('0x42')]=[{'all':!![]}];}_0x19487a=_[_0x049e('0x38')]({},_0x19487a,_0x3cb744[_0x049e('0x3a')]);return db[_0x049e('0x25')][_0x049e('0x43')](_0x19487a)[_0x049e('0x3b')](handleEntityNotFound(_0x476b14,null))['then'](respondWithResult(_0x476b14,null))[_0x049e('0x3e')](handleError(_0x476b14,null));};exports[_0x049e('0x44')]=function(_0x33b8a1,_0x54c014){return db[_0x049e('0x25')][_0x049e('0x44')](_0x33b8a1['body'],{})[_0x049e('0x3b')](respondWithResult(_0x54c014,0xc9))[_0x049e('0x3e')](handleError(_0x54c014,null));};exports['update']=function(_0x59dbc5,_0x4a6175){if(_0x59dbc5[_0x049e('0x45')]['id']){delete _0x59dbc5['body']['id'];}return db[_0x049e('0x25')][_0x049e('0x43')]({'where':{'id':_0x59dbc5['params']['id']}})['then'](handleEntityNotFound(_0x4a6175,null))[_0x049e('0x3b')](saveUpdates(_0x59dbc5[_0x049e('0x45')],null))['then'](respondWithResult(_0x4a6175,null))[_0x049e('0x3e')](handleError(_0x4a6175,null));};exports['destroy']=function(_0x3932f7,_0x587edd){return db[_0x049e('0x25')][_0x049e('0x43')]({'where':{'id':_0x3932f7[_0x049e('0x40')]['id']}})[_0x049e('0x3b')](handleEntityNotFound(_0x587edd,null))[_0x049e('0x3b')](removeEntity(_0x587edd,null))['catch'](handleError(_0x587edd,null));}; \ No newline at end of file +var _0xe833=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','SquareMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5b4c01,_0x4fa0c6){var _0x24a60e=function(_0x5e05f8){while(--_0x5e05f8){_0x5b4c01['push'](_0x5b4c01['shift']());}};_0x24a60e(++_0x4fa0c6);}(_0xe833,0x12f));var _0x3e83=function(_0x17a787,_0x1d2362){_0x17a787=_0x17a787-0x0;var _0x3a7de9=_0xe833[_0x17a787];return _0x3a7de9;};'use strict';var pdf=require(_0x3e83('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3e83('0x1'));var zipdir=require(_0x3e83('0x2'));var jsonpatch=require(_0x3e83('0x3'));var rp=require(_0x3e83('0x4'));var moment=require(_0x3e83('0x5'));var BPromise=require(_0x3e83('0x6'));var Mustache=require(_0x3e83('0x7'));var util=require(_0x3e83('0x8'));var path=require(_0x3e83('0x9'));var sox=require(_0x3e83('0xa'));var csv=require(_0x3e83('0xb'));var ejs=require(_0x3e83('0xc'));var fs=require('fs');var _=require(_0x3e83('0xd'));var squel=require(_0x3e83('0xe'));var crypto=require(_0x3e83('0xf'));var jsforce=require(_0x3e83('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3e83('0xb'));var querystring=require('querystring');var Papa=require(_0x3e83('0x11'));var Redis=require(_0x3e83('0x12'));var authService=require(_0x3e83('0x13'));var qs=require(_0x3e83('0x14'));var as=require(_0x3e83('0x15'));var hardwareService=require(_0x3e83('0x16'));var logger=require(_0x3e83('0x17'))(_0x3e83('0x18'));var utils=require('../../config/utils');var config=require(_0x3e83('0x19'));var licenseUtil=require(_0x3e83('0x1a'));var db=require(_0x3e83('0x1b'))['db'];function respondWithStatusCode(_0x3b94e3,_0x287b2b){_0x287b2b=_0x287b2b||0xcc;return function(_0x5c9e36){if(_0x5c9e36){return _0x3b94e3['sendStatus'](_0x287b2b);}return _0x3b94e3[_0x3e83('0x1c')](_0x287b2b)[_0x3e83('0x1d')]();};}function respondWithResult(_0x5212cf,_0x335ea7){_0x335ea7=_0x335ea7||0xc8;return function(_0xa4aa7f){if(_0xa4aa7f){return _0x5212cf['status'](_0x335ea7)[_0x3e83('0x1e')](_0xa4aa7f);}};}function respondWithFilteredResult(_0x3d180d,_0x58b830){return function(_0x2fc95c){if(_0x2fc95c){var _0x1649fd=_0x2fc95c[_0x3e83('0x1f')],_0x57fdb1=_0x58b830[_0x3e83('0x20')],_0xb1dd79=_0x58b830['offset']+_0x58b830[_0x3e83('0x21')],_0x5e02b0;if(_0xb1dd79>=_0x1649fd){_0xb1dd79=_0x1649fd;_0x5e02b0=0xc8;}else{_0x5e02b0=0xce;}_0x3d180d['status'](_0x5e02b0);return _0x3d180d['set'](_0x3e83('0x22'),_0x57fdb1+'-'+_0xb1dd79+'/'+_0x1649fd)[_0x3e83('0x1e')](_0x2fc95c);}return null;};}function patchUpdates(_0x22c517){return function(_0xc6c8ab){try{jsonpatch[_0x3e83('0x23')](_0xc6c8ab,_0x22c517,!![]);}catch(_0x4d092a){return BPromise[_0x3e83('0x24')](_0x4d092a);}return _0xc6c8ab['save']();};}function saveUpdates(_0x45a4cc,_0x3d836b){return function(_0x2f9bdf){if(_0x2f9bdf){return _0x2f9bdf[_0x3e83('0x25')](_0x45a4cc)[_0x3e83('0x26')](function(_0x9c8e4){return _0x9c8e4;});}return null;};}function removeEntity(_0x536d60,_0x421834){return function(_0x4d4d30){if(_0x4d4d30){return _0x4d4d30[_0x3e83('0x27')]()['then'](function(){_0x536d60['status'](0xcc)[_0x3e83('0x1d')]();});}};}function handleEntityNotFound(_0x5a4974,_0x207e84){return function(_0x591ca7){if(!_0x591ca7){_0x5a4974[_0x3e83('0x28')](0x194);}return _0x591ca7;};}function handleError(_0x230b24,_0x4705eb){_0x4705eb=_0x4705eb||0x1f4;return function(_0x2e3510){logger[_0x3e83('0x29')](_0x2e3510[_0x3e83('0x2a')]);if(_0x2e3510[_0x3e83('0x2b')]){delete _0x2e3510['name'];}_0x230b24['status'](_0x4705eb)['send'](_0x2e3510);};}exports['index']=function(_0x23849c,_0x4a74b9){var _0x41b691={},_0xe74430={},_0x1df9c9={'count':0x0,'rows':[]};var _0x33d952=_['map'](db[_0x3e83('0x2c')]['rawAttributes'],function(_0x3aa9c7){return{'name':_0x3aa9c7[_0x3e83('0x2d')],'type':_0x3aa9c7['type']['key']};});_0xe74430[_0x3e83('0x2e')]=_['map'](_0x33d952,'name');_0xe74430[_0x3e83('0x2f')]=_[_0x3e83('0x30')](_0x23849c[_0x3e83('0x2f')]);_0xe74430[_0x3e83('0x31')]=_[_0x3e83('0x32')](_0xe74430['model'],_0xe74430['query']);_0x41b691[_0x3e83('0x33')]=_[_0x3e83('0x32')](_0xe74430[_0x3e83('0x2e')],qs[_0x3e83('0x34')](_0x23849c['query'][_0x3e83('0x34')]));_0x41b691['attributes']=_0x41b691[_0x3e83('0x33')][_0x3e83('0x35')]?_0x41b691[_0x3e83('0x33')]:_0xe74430[_0x3e83('0x2e')];if(!_0x23849c[_0x3e83('0x2f')][_0x3e83('0x36')](_0x3e83('0x37'))){_0x41b691[_0x3e83('0x21')]=qs[_0x3e83('0x21')](_0x23849c[_0x3e83('0x2f')][_0x3e83('0x21')]);_0x41b691['offset']=qs['offset'](_0x23849c[_0x3e83('0x2f')][_0x3e83('0x20')]);}_0x41b691[_0x3e83('0x38')]=qs['sort'](_0x23849c[_0x3e83('0x2f')][_0x3e83('0x39')]);_0x41b691['where']=qs[_0x3e83('0x31')](_[_0x3e83('0x3a')](_0x23849c[_0x3e83('0x2f')],_0xe74430[_0x3e83('0x31')]),_0x33d952);if(_0x23849c[_0x3e83('0x2f')]['filter']){_0x41b691[_0x3e83('0x3b')]=_[_0x3e83('0x3c')](_0x41b691[_0x3e83('0x3b')],{'$or':_[_0x3e83('0x3d')](_0x33d952,function(_0x241a5d){if(_0x241a5d[_0x3e83('0x3e')]!==_0x3e83('0x3f')){var _0x48d8f4={};_0x48d8f4[_0x241a5d[_0x3e83('0x2b')]]={'$like':'%'+_0x23849c['query'][_0x3e83('0x40')]+'%'};return _0x48d8f4;}})});}_0x41b691=_[_0x3e83('0x3c')]({},_0x41b691,_0x23849c[_0x3e83('0x41')]);var _0x3e2033={'where':_0x41b691['where']};return db[_0x3e83('0x2c')]['count'](_0x3e2033)[_0x3e83('0x26')](function(_0x49d054){_0x1df9c9[_0x3e83('0x1f')]=_0x49d054;if(_0x23849c[_0x3e83('0x2f')][_0x3e83('0x42')]){_0x41b691['include']=[{'all':!![]}];}return db[_0x3e83('0x2c')][_0x3e83('0x43')](_0x41b691);})[_0x3e83('0x26')](function(_0x5833e8){_0x1df9c9[_0x3e83('0x44')]=_0x5833e8;return _0x1df9c9;})[_0x3e83('0x26')](respondWithFilteredResult(_0x4a74b9,_0x41b691))[_0x3e83('0x45')](handleError(_0x4a74b9,null));};exports[_0x3e83('0x46')]=function(_0x34ac97,_0x32aa09){var _0x5d72d0={'raw':!![],'where':{'id':_0x34ac97[_0x3e83('0x47')]['id']}},_0x281c36={};_0x281c36[_0x3e83('0x2e')]=_[_0x3e83('0x30')](db[_0x3e83('0x2c')][_0x3e83('0x48')]);_0x281c36['query']=_[_0x3e83('0x30')](_0x34ac97['query']);_0x281c36[_0x3e83('0x31')]=_['intersection'](_0x281c36[_0x3e83('0x2e')],_0x281c36[_0x3e83('0x2f')]);_0x5d72d0[_0x3e83('0x33')]=_[_0x3e83('0x32')](_0x281c36[_0x3e83('0x2e')],qs[_0x3e83('0x34')](_0x34ac97[_0x3e83('0x2f')]['fields']));_0x5d72d0['attributes']=_0x5d72d0['attributes']['length']?_0x5d72d0[_0x3e83('0x33')]:_0x281c36[_0x3e83('0x2e')];if(_0x34ac97[_0x3e83('0x2f')][_0x3e83('0x42')]){_0x5d72d0[_0x3e83('0x49')]=[{'all':!![]}];}_0x5d72d0=_[_0x3e83('0x3c')]({},_0x5d72d0,_0x34ac97['options']);return db[_0x3e83('0x2c')][_0x3e83('0x4a')](_0x5d72d0)['then'](handleEntityNotFound(_0x32aa09,null))[_0x3e83('0x26')](respondWithResult(_0x32aa09,null))[_0x3e83('0x45')](handleError(_0x32aa09,null));};exports[_0x3e83('0x4b')]=function(_0x16c8a5,_0xfa401c){return db[_0x3e83('0x2c')][_0x3e83('0x4b')](_0x16c8a5[_0x3e83('0x4c')],{})[_0x3e83('0x26')](respondWithResult(_0xfa401c,0xc9))['catch'](handleError(_0xfa401c,null));};exports[_0x3e83('0x25')]=function(_0x588c6d,_0xfee857){if(_0x588c6d[_0x3e83('0x4c')]['id']){delete _0x588c6d[_0x3e83('0x4c')]['id'];}return db[_0x3e83('0x2c')]['find']({'where':{'id':_0x588c6d[_0x3e83('0x47')]['id']}})['then'](handleEntityNotFound(_0xfee857,null))['then'](saveUpdates(_0x588c6d[_0x3e83('0x4c')],null))['then'](respondWithResult(_0xfee857,null))[_0x3e83('0x45')](handleError(_0xfee857,null));};exports[_0x3e83('0x27')]=function(_0x4fe13a,_0x2d2c8f){return db[_0x3e83('0x2c')][_0x3e83('0x4a')]({'where':{'id':_0x4fe13a[_0x3e83('0x47')]['id']}})[_0x3e83('0x26')](handleEntityNotFound(_0x2d2c8f,null))[_0x3e83('0x26')](removeEntity(_0x2d2c8f,null))[_0x3e83('0x45')](handleError(_0x2d2c8f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 124c9e9..4c97a4a 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 _0xe7fe=['./squareMessage.attributes','define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42157a,_0x198d83){var _0x41c6c5=function(_0x5331e2){while(--_0x5331e2){_0x42157a['push'](_0x42157a['shift']());}};_0x41c6c5(++_0x198d83);}(_0xe7fe,0x12e));var _0xee7f=function(_0x5742d0,_0x2c36e8){_0x5742d0=_0x5742d0-0x0;var _0x15c0be=_0xe7fe[_0x5742d0];return _0x15c0be;};'use strict';var _=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var logger=require(_0xee7f('0x2'))(_0xee7f('0x3'));var moment=require(_0xee7f('0x4'));var BPromise=require(_0xee7f('0x5'));var rp=require(_0xee7f('0x6'));var fs=require('fs');var path=require(_0xee7f('0x7'));var rimraf=require(_0xee7f('0x8'));var config=require(_0xee7f('0x9'));var attributes=require(_0xee7f('0xa'));module['exports']=function(_0x256654,_0x5ab7c4){return _0x256654[_0xee7f('0xb')](_0xee7f('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc64=['exports','define','SquareMessage','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b3c7e,_0x58aef9){var _0x3015af=function(_0x12e3f7){while(--_0x12e3f7){_0x4b3c7e['push'](_0x4b3c7e['shift']());}};_0x3015af(++_0x58aef9);}(_0xdc64,0x1d1));var _0x4dc6=function(_0x455716,_0x3517fd){_0x455716=_0x455716-0x0;var _0x21d560=_0xdc64[_0x455716];return _0x21d560;};'use strict';var _=require(_0x4dc6('0x0'));var util=require('util');var logger=require(_0x4dc6('0x1'))('api');var moment=require(_0x4dc6('0x2'));var BPromise=require(_0x4dc6('0x3'));var rp=require(_0x4dc6('0x4'));var fs=require('fs');var path=require(_0x4dc6('0x5'));var rimraf=require(_0x4dc6('0x6'));var config=require(_0x4dc6('0x7'));var attributes=require('./squareMessage.attributes');module[_0x4dc6('0x8')]=function(_0x228d51,_0x2608ff){return _0x228d51[_0x4dc6('0x9')](_0x4dc6('0xa'),attributes,{'tableName':'square_messages','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 e0cd1ec..00d076e 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x179e05,_0x26739a){var _0x12e290=function(_0x48aa1c){while(--_0x48aa1c){_0x179e05['push'](_0x179e05['shift']());}};_0x12e290(++_0x26739a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x5a1260,_0x33a145){var _0xa7f587=function(_0x8c512d){while(--_0x8c512d){_0x5a1260['push'](_0x5a1260['shift']());}};_0xa7f587(++_0x33a145);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 20f91fb..4fab45d 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 _0xc951=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/test','post','create','put','update','delete','destroy'];(function(_0x3d20f3,_0x43f44a){var _0x13500f=function(_0x32128b){while(--_0x32128b){_0x3d20f3['push'](_0x3d20f3['shift']());}};_0x13500f(++_0x43f44a);}(_0xc951,0x1a3));var _0x1c95=function(_0x1101c6,_0xbb5ef5){_0x1101c6=_0x1101c6-0x0;var _0x46650a=_0xc951[_0x1101c6];return _0x46650a;};'use strict';var multer=require('multer');var util=require(_0x1c95('0x0'));var path=require(_0x1c95('0x1'));var timeout=require(_0x1c95('0x2'));var express=require(_0x1c95('0x3'));var router=express['Router']();var auth=require(_0x1c95('0x4'));var interaction=require(_0x1c95('0x5'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x1c95('0x6')](),controller[_0x1c95('0x7')]);router['get'](_0x1c95('0x8'),auth[_0x1c95('0x6')](),controller[_0x1c95('0x9')]);router[_0x1c95('0xa')](_0x1c95('0xb'),auth[_0x1c95('0x6')](),timeout('15s'),controller['test']);router[_0x1c95('0xc')]('/',auth[_0x1c95('0x6')](),controller[_0x1c95('0xd')]);router[_0x1c95('0xe')](_0x1c95('0x8'),auth[_0x1c95('0x6')](),controller[_0x1c95('0xf')]);router[_0x1c95('0x10')](_0x1c95('0x8'),auth[_0x1c95('0x6')](),controller[_0x1c95('0x11')]);module[_0x1c95('0x12')]=router; \ No newline at end of file +var _0x4b81=['show','/:id/test','15s','test','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x275793,_0x5eeb6b){var _0xd03864=function(_0x34d2ea){while(--_0x34d2ea){_0x275793['push'](_0x275793['shift']());}};_0xd03864(++_0x5eeb6b);}(_0x4b81,0x9e));var _0x14b8=function(_0x4c8c52,_0x4da81b){_0x4c8c52=_0x4c8c52-0x0;var _0x199946=_0x4b81[_0x4c8c52];return _0x199946;};'use strict';var multer=require(_0x14b8('0x0'));var util=require('util');var path=require(_0x14b8('0x1'));var timeout=require(_0x14b8('0x2'));var express=require(_0x14b8('0x3'));var router=express[_0x14b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x14b8('0x5'));var config=require(_0x14b8('0x6'));var controller=require(_0x14b8('0x7'));router[_0x14b8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14b8('0x8')]('/:id',auth[_0x14b8('0x9')](),controller[_0x14b8('0xa')]);router[_0x14b8('0x8')](_0x14b8('0xb'),auth[_0x14b8('0x9')](),timeout(_0x14b8('0xc')),controller[_0x14b8('0xd')]);router[_0x14b8('0xe')]('/',auth[_0x14b8('0x9')](),controller['create']);router[_0x14b8('0xf')](_0x14b8('0x10'),auth[_0x14b8('0x9')](),controller[_0x14b8('0x11')]);router[_0x14b8('0x12')]('/:id',auth[_0x14b8('0x9')](),controller[_0x14b8('0x13')]);module[_0x14b8('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5e8a1a9..d0a9b5d 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 _0x57e6=['STRING','sequelize','exports'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0x57e6,0x1f0));var _0x657e=function(_0x4a63fc,_0x167a02){_0x4a63fc=_0x4a63fc-0x0;var _0x30d4c3=_0x57e6[_0x4a63fc];return _0x30d4c3;};'use strict';var Sequelize=require(_0x657e('0x0'));module[_0x657e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x657e('0x2')]},'description':{'type':Sequelize[_0x657e('0x2')]}}; \ No newline at end of file +var _0x6964=['sequelize','exports','STRING'];(function(_0x2e0415,_0x402f9d){var _0x559975=function(_0x12625a){while(--_0x12625a){_0x2e0415['push'](_0x2e0415['shift']());}};_0x559975(++_0x402f9d);}(_0x6964,0x177));var _0x4696=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x6964[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require(_0x4696('0x0'));module[_0x4696('0x1')]={'name':{'type':Sequelize[_0x4696('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x4696('0x2')]},'description':{'type':Sequelize[_0x4696('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2523f18..4fc9c00 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 _0xd095=['error','body','params','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','name','send','index','SquareOdbc','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xd095,0x164));var _0x5d09=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd095[_0x5c2e3e];return _0x53f64a;};'use strict';var pdf=require(_0x5d09('0x0'));var emlformat=require(_0x5d09('0x1'));var rimraf=require(_0x5d09('0x2'));var zipdir=require(_0x5d09('0x3'));var jsonpatch=require(_0x5d09('0x4'));var rp=require(_0x5d09('0x5'));var moment=require(_0x5d09('0x6'));var BPromise=require(_0x5d09('0x7'));var Mustache=require(_0x5d09('0x8'));var util=require(_0x5d09('0x9'));var path=require(_0x5d09('0xa'));var sox=require(_0x5d09('0xb'));var csv=require(_0x5d09('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5d09('0xd'));var squel=require(_0x5d09('0xe'));var crypto=require(_0x5d09('0xf'));var jsforce=require(_0x5d09('0x10'));var deskjs=require(_0x5d09('0x11'));var toCsv=require(_0x5d09('0xc'));var querystring=require('querystring');var Papa=require(_0x5d09('0x12'));var Redis=require('ioredis');var authService=require(_0x5d09('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d09('0x14'))(_0x5d09('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5d09('0x16'));var db=require(_0x5d09('0x17'))['db'];function respondWithStatusCode(_0x371707,_0x2f904a){_0x2f904a=_0x2f904a||0xcc;return function(_0x35d6f5){if(_0x35d6f5){return _0x371707[_0x5d09('0x18')](_0x2f904a);}return _0x371707[_0x5d09('0x19')](_0x2f904a)[_0x5d09('0x1a')]();};}function respondWithResult(_0x369a26,_0x32a6e3){_0x32a6e3=_0x32a6e3||0xc8;return function(_0x344512){if(_0x344512){return _0x369a26[_0x5d09('0x19')](_0x32a6e3)['json'](_0x344512);}};}function respondWithFilteredResult(_0x3f13fd,_0x5397e9){return function(_0x2414d6){if(_0x2414d6){var _0x274ba7=_0x2414d6[_0x5d09('0x1b')],_0x23190e=_0x5397e9[_0x5d09('0x1c')],_0x3fd019=_0x5397e9[_0x5d09('0x1c')]+_0x5397e9[_0x5d09('0x1d')],_0x1d075e;if(_0x3fd019>=_0x274ba7){_0x3fd019=_0x274ba7;_0x1d075e=0xc8;}else{_0x1d075e=0xce;}_0x3f13fd['status'](_0x1d075e);return _0x3f13fd[_0x5d09('0x1e')](_0x5d09('0x1f'),_0x23190e+'-'+_0x3fd019+'/'+_0x274ba7)[_0x5d09('0x20')](_0x2414d6);}return null;};}function patchUpdates(_0xc56c76){return function(_0x12d061){try{jsonpatch[_0x5d09('0x21')](_0x12d061,_0xc56c76,!![]);}catch(_0x2ada85){return BPromise[_0x5d09('0x22')](_0x2ada85);}return _0x12d061[_0x5d09('0x23')]();};}function saveUpdates(_0x262961,_0xc4f40c){return function(_0x199d7b){if(_0x199d7b){return _0x199d7b[_0x5d09('0x24')](_0x262961)[_0x5d09('0x25')](function(_0x2d9595){return _0x2d9595;});}return null;};}function removeEntity(_0x3b3b86,_0x49b732){return function(_0x46e745){if(_0x46e745){return _0x46e745[_0x5d09('0x26')]()['then'](function(){var _0x43a5a7=_0x46e745['get']({'plain':!![]});var _0x40b269=_0x5d09('0x27');return db[_0x5d09('0x28')][_0x5d09('0x26')]({'where':{'type':_0x40b269,'resourceId':_0x43a5a7['id']}})['then'](function(){return _0x46e745;});})[_0x5d09('0x25')](function(){_0x3b3b86[_0x5d09('0x19')](0xcc)[_0x5d09('0x1a')]();});}};}function handleEntityNotFound(_0x2c821e,_0x1a027e){return function(_0x5e51ad){if(!_0x5e51ad){_0x2c821e['sendStatus'](0x194);}return _0x5e51ad;};}function handleError(_0x47e890,_0x2f480d){_0x2f480d=_0x2f480d||0x1f4;return function(_0x56d23d){logger['error'](_0x56d23d['stack']);if(_0x56d23d[_0x5d09('0x29')]){delete _0x56d23d[_0x5d09('0x29')];}_0x47e890[_0x5d09('0x19')](_0x2f480d)[_0x5d09('0x2a')](_0x56d23d);};}exports[_0x5d09('0x2b')]=function(_0x4bc0c6,_0x398965){var _0x333831={},_0x412bcf={},_0x57d957={'count':0x0,'rows':[]};var _0x21c6f8=_['map'](db[_0x5d09('0x2c')]['rawAttributes'],function(_0x429b66){return{'name':_0x429b66[_0x5d09('0x2d')],'type':_0x429b66[_0x5d09('0x2e')][_0x5d09('0x2f')]};});_0x412bcf[_0x5d09('0x30')]=_[_0x5d09('0x31')](_0x21c6f8,_0x5d09('0x29'));_0x412bcf[_0x5d09('0x32')]=_['keys'](_0x4bc0c6[_0x5d09('0x32')]);_0x412bcf['filters']=_[_0x5d09('0x33')](_0x412bcf[_0x5d09('0x30')],_0x412bcf[_0x5d09('0x32')]);_0x333831[_0x5d09('0x34')]=_['intersection'](_0x412bcf[_0x5d09('0x30')],qs[_0x5d09('0x35')](_0x4bc0c6[_0x5d09('0x32')][_0x5d09('0x35')]));_0x333831[_0x5d09('0x34')]=_0x333831[_0x5d09('0x34')][_0x5d09('0x36')]?_0x333831[_0x5d09('0x34')]:_0x412bcf[_0x5d09('0x30')];if(!_0x4bc0c6['query'][_0x5d09('0x37')](_0x5d09('0x38'))){_0x333831[_0x5d09('0x1d')]=qs[_0x5d09('0x1d')](_0x4bc0c6[_0x5d09('0x32')][_0x5d09('0x1d')]);_0x333831[_0x5d09('0x1c')]=qs[_0x5d09('0x1c')](_0x4bc0c6[_0x5d09('0x32')]['offset']);}_0x333831[_0x5d09('0x39')]=qs['sort'](_0x4bc0c6[_0x5d09('0x32')]['sort']);_0x333831['where']=qs[_0x5d09('0x3a')](_['pick'](_0x4bc0c6['query'],_0x412bcf['filters']),_0x21c6f8);if(_0x4bc0c6['query']['filter']){_0x333831[_0x5d09('0x3b')]=_[_0x5d09('0x3c')](_0x333831['where'],{'$or':_[_0x5d09('0x31')](_0x21c6f8,function(_0x23cb27){if(_0x23cb27[_0x5d09('0x2e')]!==_0x5d09('0x3d')){var _0x232839={};_0x232839[_0x23cb27[_0x5d09('0x29')]]={'$like':'%'+_0x4bc0c6[_0x5d09('0x32')][_0x5d09('0x3e')]+'%'};return _0x232839;}})});}_0x333831=_['merge']({},_0x333831,_0x4bc0c6[_0x5d09('0x3f')]);var _0x2ab4cf={'where':_0x333831['where']};return db['SquareOdbc']['count'](_0x2ab4cf)[_0x5d09('0x25')](function(_0x2641a9){_0x57d957['count']=_0x2641a9;if(_0x4bc0c6[_0x5d09('0x32')][_0x5d09('0x40')]){_0x333831[_0x5d09('0x41')]=[{'all':!![]}];}return db[_0x5d09('0x2c')][_0x5d09('0x42')](_0x333831);})[_0x5d09('0x25')](function(_0x28c0b4){_0x57d957[_0x5d09('0x43')]=_0x28c0b4;return _0x57d957;})[_0x5d09('0x25')](respondWithFilteredResult(_0x398965,_0x333831))[_0x5d09('0x44')](handleError(_0x398965,null));};exports[_0x5d09('0x45')]=function(_0x58ea7c,_0x44b794){var _0x2861a4={'raw':!![],'where':{'id':_0x58ea7c['params']['id']}},_0x1ee7aa={};_0x1ee7aa[_0x5d09('0x30')]=_[_0x5d09('0x46')](db[_0x5d09('0x2c')][_0x5d09('0x47')]);_0x1ee7aa[_0x5d09('0x32')]=_[_0x5d09('0x46')](_0x58ea7c['query']);_0x1ee7aa[_0x5d09('0x3a')]=_[_0x5d09('0x33')](_0x1ee7aa[_0x5d09('0x30')],_0x1ee7aa[_0x5d09('0x32')]);_0x2861a4[_0x5d09('0x34')]=_['intersection'](_0x1ee7aa[_0x5d09('0x30')],qs['fields'](_0x58ea7c['query'][_0x5d09('0x35')]));_0x2861a4[_0x5d09('0x34')]=_0x2861a4[_0x5d09('0x34')][_0x5d09('0x36')]?_0x2861a4[_0x5d09('0x34')]:_0x1ee7aa[_0x5d09('0x30')];if(_0x58ea7c[_0x5d09('0x32')]['includeAll']){_0x2861a4[_0x5d09('0x41')]=[{'all':!![]}];}_0x2861a4=_['merge']({},_0x2861a4,_0x58ea7c[_0x5d09('0x3f')]);return db['SquareOdbc'][_0x5d09('0x48')](_0x2861a4)[_0x5d09('0x25')](handleEntityNotFound(_0x44b794,null))[_0x5d09('0x25')](respondWithResult(_0x44b794,null))[_0x5d09('0x44')](handleError(_0x44b794,null));};exports['create']=function(_0x43f227,_0x54bc8b){return db[_0x5d09('0x2c')]['create'](_0x43f227['body'],{})['then'](function(_0x4048fa){var _0x4d1c24=_0x43f227['user'][_0x5d09('0x49')]({'plain':!![]});if(!_0x4d1c24)throw new Error(_0x5d09('0x4a'));if(_0x4d1c24['role']===_0x5d09('0x4b')){var _0x402758=_0x4048fa[_0x5d09('0x49')]({'plain':!![]});var _0x345e22=_0x5d09('0x27');return db[_0x5d09('0x4c')][_0x5d09('0x48')]({'where':{'name':_0x345e22,'userProfileId':_0x4d1c24[_0x5d09('0x4d')]},'raw':!![]})['then'](function(_0x59eb76){if(_0x59eb76&&_0x59eb76['autoAssociation']===0x0){return db[_0x5d09('0x28')][_0x5d09('0x4e')]({'name':_0x402758[_0x5d09('0x29')],'resourceId':_0x402758['id'],'type':_0x59eb76[_0x5d09('0x29')],'sectionId':_0x59eb76['id']},{})[_0x5d09('0x25')](function(){return _0x4048fa;});}else{return _0x4048fa;}})['catch'](function(_0x4a7429){logger[_0x5d09('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a7429);throw _0x4a7429;});}return _0x4048fa;})[_0x5d09('0x25')](respondWithResult(_0x54bc8b,0xc9))[_0x5d09('0x44')](handleError(_0x54bc8b,null));};exports['update']=function(_0x5dc913,_0x5b8f16){if(_0x5dc913['body']['id']){delete _0x5dc913[_0x5d09('0x50')]['id'];}return db['SquareOdbc'][_0x5d09('0x48')]({'where':{'id':_0x5dc913[_0x5d09('0x51')]['id']}})[_0x5d09('0x25')](handleEntityNotFound(_0x5b8f16,null))['then'](saveUpdates(_0x5dc913[_0x5d09('0x50')],null))['then'](respondWithResult(_0x5b8f16,null))[_0x5d09('0x44')](handleError(_0x5b8f16,null));};exports[_0x5d09('0x26')]=function(_0x301dda,_0x760d9){return db[_0x5d09('0x2c')][_0x5d09('0x48')]({'where':{'id':_0x301dda[_0x5d09('0x51')]['id']}})[_0x5d09('0x25')](handleEntityNotFound(_0x760d9,null))['then'](removeEntity(_0x760d9,null))[_0x5d09('0x44')](handleError(_0x760d9,null));};exports[_0x5d09('0x52')]=function(_0x475a2f,_0x42c60d,_0xa711bc){var _0x1859ff;return db[_0x5d09('0x2c')]['find']({'where':{'id':_0x475a2f[_0x5d09('0x51')]['id']},'attributes':['id',_0x5d09('0x53')]})[_0x5d09('0x25')](handleEntityNotFound(_0x42c60d,null))[_0x5d09('0x25')](function(_0x4df9b1){if(_0x4df9b1){var _0x41f78d=require(_0x5d09('0x54'))();_0x41f78d[_0x5d09('0x55')](_0x4df9b1[_0x5d09('0x53')]);_0x41f78d[_0x5d09('0x56')]();return _0x4df9b1;}})[_0x5d09('0x25')](respondWithResult(_0x42c60d,null))[_0x5d09('0x44')](handleError(_0x42c60d,null));}; \ No newline at end of file +var _0xbd7e=['index','map','SquareOdbc','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','get','ODBC','destroy','error','stack','name','send'];(function(_0x13cc3b,_0x11dd51){var _0x90fd94=function(_0x4a07f0){while(--_0x4a07f0){_0x13cc3b['push'](_0x13cc3b['shift']());}};_0x90fd94(++_0x11dd51);}(_0xbd7e,0x188));var _0xebd7=function(_0x1e8982,_0x37bfc7){_0x1e8982=_0x1e8982-0x0;var _0x115066=_0xbd7e[_0x1e8982];return _0x115066;};'use strict';var pdf=require(_0xebd7('0x0'));var emlformat=require(_0xebd7('0x1'));var rimraf=require(_0xebd7('0x2'));var zipdir=require(_0xebd7('0x3'));var jsonpatch=require(_0xebd7('0x4'));var rp=require(_0xebd7('0x5'));var moment=require(_0xebd7('0x6'));var BPromise=require(_0xebd7('0x7'));var Mustache=require(_0xebd7('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xebd7('0x9'));var fs=require('fs');var _=require(_0xebd7('0xa'));var squel=require('squel');var crypto=require(_0xebd7('0xb'));var jsforce=require(_0xebd7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebd7('0xd'));var Papa=require(_0xebd7('0xe'));var Redis=require(_0xebd7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xebd7('0x10'));var as=require(_0xebd7('0x11'));var hardwareService=require(_0xebd7('0x12'));var logger=require('../../config/logger')(_0xebd7('0x13'));var utils=require(_0xebd7('0x14'));var config=require(_0xebd7('0x15'));var licenseUtil=require(_0xebd7('0x16'));var db=require(_0xebd7('0x17'))['db'];function respondWithStatusCode(_0x3f6751,_0x4fd83f){_0x4fd83f=_0x4fd83f||0xcc;return function(_0x54cb6d){if(_0x54cb6d){return _0x3f6751['sendStatus'](_0x4fd83f);}return _0x3f6751['status'](_0x4fd83f)[_0xebd7('0x18')]();};}function respondWithResult(_0x2be146,_0x4744dc){_0x4744dc=_0x4744dc||0xc8;return function(_0x511f0e){if(_0x511f0e){return _0x2be146['status'](_0x4744dc)[_0xebd7('0x19')](_0x511f0e);}};}function respondWithFilteredResult(_0xf49bae,_0xad71d0){return function(_0x4a7d04){if(_0x4a7d04){var _0x104b79=_0x4a7d04[_0xebd7('0x1a')],_0x1b6df2=_0xad71d0[_0xebd7('0x1b')],_0x3400af=_0xad71d0['offset']+_0xad71d0[_0xebd7('0x1c')],_0x2e8ca2;if(_0x3400af>=_0x104b79){_0x3400af=_0x104b79;_0x2e8ca2=0xc8;}else{_0x2e8ca2=0xce;}_0xf49bae[_0xebd7('0x1d')](_0x2e8ca2);return _0xf49bae[_0xebd7('0x1e')](_0xebd7('0x1f'),_0x1b6df2+'-'+_0x3400af+'/'+_0x104b79)[_0xebd7('0x19')](_0x4a7d04);}return null;};}function patchUpdates(_0x27b6a5){return function(_0x22c3dd){try{jsonpatch['apply'](_0x22c3dd,_0x27b6a5,!![]);}catch(_0x466e59){return BPromise[_0xebd7('0x20')](_0x466e59);}return _0x22c3dd[_0xebd7('0x21')]();};}function saveUpdates(_0x34389c,_0x15603d){return function(_0x1dbe27){if(_0x1dbe27){return _0x1dbe27[_0xebd7('0x22')](_0x34389c)[_0xebd7('0x23')](function(_0x26ea9e){return _0x26ea9e;});}return null;};}function removeEntity(_0x4e32c2,_0xf449fd){return function(_0x5c94fc){if(_0x5c94fc){return _0x5c94fc['destroy']()[_0xebd7('0x23')](function(){var _0x5b84ca=_0x5c94fc[_0xebd7('0x24')]({'plain':!![]});var _0x56578a=_0xebd7('0x25');return db['UserProfileResource'][_0xebd7('0x26')]({'where':{'type':_0x56578a,'resourceId':_0x5b84ca['id']}})[_0xebd7('0x23')](function(){return _0x5c94fc;});})[_0xebd7('0x23')](function(){_0x4e32c2[_0xebd7('0x1d')](0xcc)[_0xebd7('0x18')]();});}};}function handleEntityNotFound(_0x368c8d,_0x1f3b5c){return function(_0x526e3f){if(!_0x526e3f){_0x368c8d['sendStatus'](0x194);}return _0x526e3f;};}function handleError(_0x34d800,_0x2f788){_0x2f788=_0x2f788||0x1f4;return function(_0xec77d8){logger[_0xebd7('0x27')](_0xec77d8[_0xebd7('0x28')]);if(_0xec77d8[_0xebd7('0x29')]){delete _0xec77d8[_0xebd7('0x29')];}_0x34d800['status'](_0x2f788)[_0xebd7('0x2a')](_0xec77d8);};}exports[_0xebd7('0x2b')]=function(_0x3efc55,_0x536788){var _0xb4cfbd={},_0x511220={},_0x34af9e={'count':0x0,'rows':[]};var _0x3c5c3a=_[_0xebd7('0x2c')](db[_0xebd7('0x2d')]['rawAttributes'],function(_0x3084c0){return{'name':_0x3084c0['fieldName'],'type':_0x3084c0['type'][_0xebd7('0x2e')]};});_0x511220[_0xebd7('0x2f')]=_[_0xebd7('0x2c')](_0x3c5c3a,_0xebd7('0x29'));_0x511220[_0xebd7('0x30')]=_[_0xebd7('0x31')](_0x3efc55['query']);_0x511220['filters']=_[_0xebd7('0x32')](_0x511220[_0xebd7('0x2f')],_0x511220[_0xebd7('0x30')]);_0xb4cfbd[_0xebd7('0x33')]=_[_0xebd7('0x32')](_0x511220[_0xebd7('0x2f')],qs[_0xebd7('0x34')](_0x3efc55[_0xebd7('0x30')][_0xebd7('0x34')]));_0xb4cfbd[_0xebd7('0x33')]=_0xb4cfbd[_0xebd7('0x33')][_0xebd7('0x35')]?_0xb4cfbd[_0xebd7('0x33')]:_0x511220['model'];if(!_0x3efc55[_0xebd7('0x30')][_0xebd7('0x36')](_0xebd7('0x37'))){_0xb4cfbd[_0xebd7('0x1c')]=qs[_0xebd7('0x1c')](_0x3efc55['query'][_0xebd7('0x1c')]);_0xb4cfbd[_0xebd7('0x1b')]=qs['offset'](_0x3efc55[_0xebd7('0x30')][_0xebd7('0x1b')]);}_0xb4cfbd[_0xebd7('0x38')]=qs[_0xebd7('0x39')](_0x3efc55[_0xebd7('0x30')]['sort']);_0xb4cfbd[_0xebd7('0x3a')]=qs[_0xebd7('0x3b')](_['pick'](_0x3efc55[_0xebd7('0x30')],_0x511220[_0xebd7('0x3b')]),_0x3c5c3a);if(_0x3efc55['query'][_0xebd7('0x3c')]){_0xb4cfbd['where']=_[_0xebd7('0x3d')](_0xb4cfbd[_0xebd7('0x3a')],{'$or':_[_0xebd7('0x2c')](_0x3c5c3a,function(_0x470f45){if(_0x470f45[_0xebd7('0x3e')]!==_0xebd7('0x3f')){var _0x193d63={};_0x193d63[_0x470f45[_0xebd7('0x29')]]={'$like':'%'+_0x3efc55[_0xebd7('0x30')]['filter']+'%'};return _0x193d63;}})});}_0xb4cfbd=_[_0xebd7('0x3d')]({},_0xb4cfbd,_0x3efc55[_0xebd7('0x40')]);var _0x1f8350={'where':_0xb4cfbd[_0xebd7('0x3a')]};return db[_0xebd7('0x2d')][_0xebd7('0x1a')](_0x1f8350)['then'](function(_0xb984fb){_0x34af9e['count']=_0xb984fb;if(_0x3efc55[_0xebd7('0x30')][_0xebd7('0x41')]){_0xb4cfbd['include']=[{'all':!![]}];}return db[_0xebd7('0x2d')]['findAll'](_0xb4cfbd);})[_0xebd7('0x23')](function(_0x2607f5){_0x34af9e[_0xebd7('0x42')]=_0x2607f5;return _0x34af9e;})[_0xebd7('0x23')](respondWithFilteredResult(_0x536788,_0xb4cfbd))[_0xebd7('0x43')](handleError(_0x536788,null));};exports[_0xebd7('0x44')]=function(_0x20c284,_0x1327b8){var _0x1a6903={'raw':!![],'where':{'id':_0x20c284[_0xebd7('0x45')]['id']}},_0x5d70ad={};_0x5d70ad[_0xebd7('0x2f')]=_[_0xebd7('0x31')](db[_0xebd7('0x2d')][_0xebd7('0x46')]);_0x5d70ad['query']=_[_0xebd7('0x31')](_0x20c284[_0xebd7('0x30')]);_0x5d70ad[_0xebd7('0x3b')]=_[_0xebd7('0x32')](_0x5d70ad['model'],_0x5d70ad[_0xebd7('0x30')]);_0x1a6903[_0xebd7('0x33')]=_['intersection'](_0x5d70ad[_0xebd7('0x2f')],qs['fields'](_0x20c284[_0xebd7('0x30')][_0xebd7('0x34')]));_0x1a6903[_0xebd7('0x33')]=_0x1a6903[_0xebd7('0x33')][_0xebd7('0x35')]?_0x1a6903[_0xebd7('0x33')]:_0x5d70ad[_0xebd7('0x2f')];if(_0x20c284[_0xebd7('0x30')][_0xebd7('0x41')]){_0x1a6903[_0xebd7('0x47')]=[{'all':!![]}];}_0x1a6903=_[_0xebd7('0x3d')]({},_0x1a6903,_0x20c284[_0xebd7('0x40')]);return db[_0xebd7('0x2d')]['find'](_0x1a6903)[_0xebd7('0x23')](handleEntityNotFound(_0x1327b8,null))[_0xebd7('0x23')](respondWithResult(_0x1327b8,null))['catch'](handleError(_0x1327b8,null));};exports[_0xebd7('0x48')]=function(_0x1c4ac4,_0x58220e){return db[_0xebd7('0x2d')]['create'](_0x1c4ac4[_0xebd7('0x49')],{})[_0xebd7('0x23')](function(_0x248819){var _0x11cf11=_0x1c4ac4[_0xebd7('0x4a')][_0xebd7('0x24')]({'plain':!![]});if(!_0x11cf11)throw new Error(_0xebd7('0x4b'));if(_0x11cf11[_0xebd7('0x4c')]==='user'){var _0x4756ee=_0x248819['get']({'plain':!![]});var _0x1c156c='ODBC';return db[_0xebd7('0x4d')][_0xebd7('0x4e')]({'where':{'name':_0x1c156c,'userProfileId':_0x11cf11[_0xebd7('0x4f')]},'raw':!![]})[_0xebd7('0x23')](function(_0x59549e){if(_0x59549e&&_0x59549e['autoAssociation']===0x0){return db[_0xebd7('0x50')][_0xebd7('0x48')]({'name':_0x4756ee[_0xebd7('0x29')],'resourceId':_0x4756ee['id'],'type':_0x59549e[_0xebd7('0x29')],'sectionId':_0x59549e['id']},{})[_0xebd7('0x23')](function(){return _0x248819;});}else{return _0x248819;}})[_0xebd7('0x43')](function(_0x559255){logger[_0xebd7('0x27')](_0xebd7('0x51'),_0x559255);throw _0x559255;});}return _0x248819;})[_0xebd7('0x23')](respondWithResult(_0x58220e,0xc9))[_0xebd7('0x43')](handleError(_0x58220e,null));};exports[_0xebd7('0x22')]=function(_0x40c981,_0x22f486){if(_0x40c981[_0xebd7('0x49')]['id']){delete _0x40c981['body']['id'];}return db[_0xebd7('0x2d')][_0xebd7('0x4e')]({'where':{'id':_0x40c981[_0xebd7('0x45')]['id']}})[_0xebd7('0x23')](handleEntityNotFound(_0x22f486,null))['then'](saveUpdates(_0x40c981['body'],null))['then'](respondWithResult(_0x22f486,null))[_0xebd7('0x43')](handleError(_0x22f486,null));};exports['destroy']=function(_0x3c66b2,_0x48db25){return db[_0xebd7('0x2d')][_0xebd7('0x4e')]({'where':{'id':_0x3c66b2['params']['id']}})[_0xebd7('0x23')](handleEntityNotFound(_0x48db25,null))[_0xebd7('0x23')](removeEntity(_0x48db25,null))[_0xebd7('0x43')](handleError(_0x48db25,null));};exports[_0xebd7('0x52')]=function(_0x26f87a,_0x233cb3,_0x20517d){var _0x3ab26a;return db[_0xebd7('0x2d')][_0xebd7('0x4e')]({'where':{'id':_0x26f87a[_0xebd7('0x45')]['id']},'attributes':['id',_0xebd7('0x53')]})['then'](handleEntityNotFound(_0x233cb3,null))['then'](function(_0x5dffe8){if(_0x5dffe8){var _0x179b73=require(_0xebd7('0x54'))();_0x179b73[_0xebd7('0x55')](_0x5dffe8[_0xebd7('0x53')]);_0x179b73[_0xebd7('0x56')]();return _0x5dffe8;}})[_0xebd7('0x23')](respondWithResult(_0x233cb3,null))[_0xebd7('0x43')](handleError(_0x233cb3,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 650e569..f9712a7 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 _0x65ba=['define','square_odbc','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x331de6,_0xa95a84){var _0x2d4911=function(_0x512ebe){while(--_0x512ebe){_0x331de6['push'](_0x331de6['shift']());}};_0x2d4911(++_0xa95a84);}(_0x65ba,0x110));var _0xa65b=function(_0x30a446,_0x17a06c){_0x30a446=_0x30a446-0x0;var _0x182f93=_0x65ba[_0x30a446];return _0x182f93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa65b('0x0'))('api');var moment=require('moment');var BPromise=require(_0xa65b('0x1'));var rp=require(_0xa65b('0x2'));var fs=require('fs');var path=require(_0xa65b('0x3'));var rimraf=require(_0xa65b('0x4'));var config=require(_0xa65b('0x5'));var attributes=require('./squareOdbc.attributes');module[_0xa65b('0x6')]=function(_0x12c1f2,_0x1a18d3){return _0x12c1f2[_0xa65b('0x7')]('SquareOdbc',attributes,{'tableName':_0xa65b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f13=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x4e68aa,_0x77632d){var _0xfe0a56=function(_0xd7b460){while(--_0xd7b460){_0x4e68aa['push'](_0x4e68aa['shift']());}};_0xfe0a56(++_0x77632d);}(_0x0f13,0x16a));var _0x30f1=function(_0xdb8234,_0x5eee20){_0xdb8234=_0xdb8234-0x0;var _0x411a61=_0x0f13[_0xdb8234];return _0x411a61;};'use strict';var _=require(_0x30f1('0x0'));var util=require(_0x30f1('0x1'));var logger=require(_0x30f1('0x2'))('api');var moment=require(_0x30f1('0x3'));var BPromise=require(_0x30f1('0x4'));var rp=require(_0x30f1('0x5'));var fs=require('fs');var path=require(_0x30f1('0x6'));var rimraf=require(_0x30f1('0x7'));var config=require(_0x30f1('0x8'));var attributes=require(_0x30f1('0x9'));module['exports']=function(_0x3d96dc,_0x4a99f0){return _0x3d96dc[_0x30f1('0xa')](_0x30f1('0xb'),attributes,{'tableName':_0x30f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index fb1db48..e8a3849 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x3bae51,_0x25e192){var _0xee8c63=function(_0x1e8c1b){while(--_0x1e8c1b){_0x3bae51['push'](_0x3bae51['shift']());}};_0xee8c63(++_0x25e192);}(_0xe14b,0x93));var _0xbe14=function(_0x5bb40b,_0x45cb30){_0x5bb40b=_0x5bb40b-0x0;var _0xaee0dc=_0xe14b[_0x5bb40b];return _0xaee0dc;};'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 +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x25487d,_0x2235a4){var _0x581ee4=function(_0x7025c1){while(--_0x7025c1){_0x25487d['push'](_0x25487d['shift']());}};_0x581ee4(++_0x2235a4);}(_0xe14b,0x93));var _0xbe14=function(_0x1d728b,_0x3b438d){_0x1d728b=_0x1d728b-0x0;var _0x423205=_0xe14b[_0x1d728b];return _0x423205;};'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/squareProject/index.js b/server/api/squareProject/index.js index a41aecc..598d890 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 _0x061f=['delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','put','update'];(function(_0x1011ae,_0x447133){var _0x314fb=function(_0x166933){while(--_0x166933){_0x1011ae['push'](_0x1011ae['shift']());}};_0x314fb(++_0x447133);}(_0x061f,0x174));var _0xf061=function(_0x4a7056,_0x355f8c){_0x4a7056=_0x4a7056-0x0;var _0x47ff79=_0x061f[_0x4a7056];return _0x47ff79;};'use strict';var multer=require(_0xf061('0x0'));var util=require(_0xf061('0x1'));var path=require(_0xf061('0x2'));var timeout=require(_0xf061('0x3'));var express=require('express');var router=express[_0xf061('0x4')]();var auth=require(_0xf061('0x5'));var interaction=require(_0xf061('0x6'));var config=require(_0xf061('0x7'));var controller=require('./squareProject.controller');router[_0xf061('0x8')]('/',auth[_0xf061('0x9')](),controller[_0xf061('0xa')]);router[_0xf061('0x8')](_0xf061('0xb'),auth['isAuthenticated'](),controller[_0xf061('0xc')]);router[_0xf061('0x8')](_0xf061('0xd'),auth[_0xf061('0x9')](),controller[_0xf061('0xe')]);router[_0xf061('0xf')]('/',auth['isAuthenticated'](),controller[_0xf061('0x10')]);router[_0xf061('0xf')](_0xf061('0xd'),auth['isAuthenticated'](),controller['addUsers']);router[_0xf061('0x11')](_0xf061('0xb'),auth[_0xf061('0x9')](),controller[_0xf061('0x12')]);router[_0xf061('0x13')](_0xf061('0xb'),auth['isAuthenticated'](),controller[_0xf061('0x14')]);router[_0xf061('0x13')](_0xf061('0xd'),auth[_0xf061('0x9')](),controller[_0xf061('0x15')]);module[_0xf061('0x16')]=router; \ No newline at end of file +var _0xb971=['Router','../../components/interaction/service','./squareProject.controller','get','index','isAuthenticated','show','/:id/users','getUsers','create','post','addUsers','put','/:id','delete','destroy','removeUsers','exports','multer','path','connect-timeout','express'];(function(_0x51f6ad,_0x3a0a56){var _0x17cfeb=function(_0x1907a0){while(--_0x1907a0){_0x51f6ad['push'](_0x51f6ad['shift']());}};_0x17cfeb(++_0x3a0a56);}(_0xb971,0x1ca));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1b97('0x0'));var util=require('util');var path=require(_0x1b97('0x1'));var timeout=require(_0x1b97('0x2'));var express=require(_0x1b97('0x3'));var router=express[_0x1b97('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b97('0x5'));var config=require('../../config/environment');var controller=require(_0x1b97('0x6'));router[_0x1b97('0x7')]('/',auth['isAuthenticated'](),controller[_0x1b97('0x8')]);router[_0x1b97('0x7')]('/:id',auth[_0x1b97('0x9')](),controller[_0x1b97('0xa')]);router['get'](_0x1b97('0xb'),auth[_0x1b97('0x9')](),controller[_0x1b97('0xc')]);router['post']('/',auth[_0x1b97('0x9')](),controller[_0x1b97('0xd')]);router[_0x1b97('0xe')]('/:id/users',auth[_0x1b97('0x9')](),controller[_0x1b97('0xf')]);router[_0x1b97('0x10')](_0x1b97('0x11'),auth[_0x1b97('0x9')](),controller['update']);router[_0x1b97('0x12')](_0x1b97('0x11'),auth[_0x1b97('0x9')](),controller[_0x1b97('0x13')]);router[_0x1b97('0x12')]('/:id/users',auth[_0x1b97('0x9')](),controller[_0x1b97('0x14')]);module[_0x1b97('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6e824f2..3a27056 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 _0xd739=['production','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd739,0x116));var _0x9d73=function(_0x4c51e1,_0x409691){_0x4c51e1=_0x4c51e1-0x0;var _0x223ab6=_0xd739[_0x4c51e1];return _0x223ab6;};'use strict';var Sequelize=require(_0x9d73('0x0'));module[_0x9d73('0x1')]={'name':{'type':Sequelize[_0x9d73('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x9d73('0x3')]},'preproduction':{'type':Sequelize[_0x9d73('0x4')](_0x9d73('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x9d73('0x6')](_0x9d73('0x7'))[_0x9d73('0x8')](_0x9d73('0x9'));}}},'production':{'type':Sequelize[_0x9d73('0x4')](_0x9d73('0x5')),'get':function(){if(this['getDataValue'](_0x9d73('0xa'))){return this[_0x9d73('0x6')](_0x9d73('0xa'))[_0x9d73('0x8')](_0x9d73('0x9'));}}},'savedAt':{'type':Sequelize[_0x9d73('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x51dc=['DATE','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x311d12,_0x534576){var _0x2f8e9b=function(_0x2f14df){while(--_0x2f14df){_0x311d12['push'](_0x311d12['shift']());}};_0x2f8e9b(++_0x534576);}(_0x51dc,0xbc));var _0xc51d=function(_0x12aee7,_0x21cd2f){_0x12aee7=_0x12aee7-0x0;var _0x5e7569=_0x51dc[_0x12aee7];return _0x5e7569;};'use strict';var Sequelize=require('sequelize');module[_0xc51d('0x0')]={'name':{'type':Sequelize[_0xc51d('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xc51d('0x2')]},'preproduction':{'type':Sequelize[_0xc51d('0x3')](_0xc51d('0x4')),'get':function(){if(this[_0xc51d('0x5')](_0xc51d('0x6'))){return this[_0xc51d('0x5')]('preproduction')[_0xc51d('0x7')](_0xc51d('0x8'));}}},'production':{'type':Sequelize[_0xc51d('0x3')](_0xc51d('0x4')),'get':function(){if(this[_0xc51d('0x5')](_0xc51d('0x9'))){return this[_0xc51d('0x5')](_0xc51d('0x9'))[_0xc51d('0x7')](_0xc51d('0x8'));}}},'savedAt':{'type':Sequelize[_0xc51d('0xa')]},'publishedAt':{'type':Sequelize[_0xc51d('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index be0594d..5a465c6 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 _0x1fde=['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','redis','defaults','localhost','./squareProject.socket','register','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','SquareProjects','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addUsers','ids','omit','removeUsers','isArray','emit','getUsers','User','where','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x150d75,_0x2b72ea){var _0xacd23=function(_0x457290){while(--_0x457290){_0x150d75['push'](_0x150d75['shift']());}};_0xacd23(++_0x2b72ea);}(_0x1fde,0xb9));var _0xe1fd=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0x1fde[_0x80f51a];return _0x327148;};'use strict';var pdf=require(_0xe1fd('0x0'));var emlformat=require(_0xe1fd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe1fd('0x2'));var jsonpatch=require(_0xe1fd('0x3'));var rp=require(_0xe1fd('0x4'));var moment=require('moment');var BPromise=require(_0xe1fd('0x5'));var Mustache=require(_0xe1fd('0x6'));var util=require(_0xe1fd('0x7'));var path=require('path');var sox=require(_0xe1fd('0x8'));var csv=require('to-csv');var ejs=require(_0xe1fd('0x9'));var fs=require('fs');var _=require(_0xe1fd('0xa'));var squel=require(_0xe1fd('0xb'));var crypto=require(_0xe1fd('0xc'));var jsforce=require(_0xe1fd('0xd'));var deskjs=require(_0xe1fd('0xe'));var toCsv=require(_0xe1fd('0xf'));var querystring=require(_0xe1fd('0x10'));var Papa=require('papaparse');var Redis=require(_0xe1fd('0x11'));var authService=require(_0xe1fd('0x12'));var qs=require(_0xe1fd('0x13'));var as=require(_0xe1fd('0x14'));var hardwareService=require(_0xe1fd('0x15'));var logger=require(_0xe1fd('0x16'))(_0xe1fd('0x17'));var utils=require(_0xe1fd('0x18'));var config=require(_0xe1fd('0x19'));var licenseUtil=require(_0xe1fd('0x1a'));var db=require(_0xe1fd('0x1b'))['db'];config[_0xe1fd('0x1c')]=_[_0xe1fd('0x1d')](config[_0xe1fd('0x1c')],{'host':_0xe1fd('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1fd('0x1c')]));require(_0xe1fd('0x1f'))[_0xe1fd('0x20')](socket);function respondWithStatusCode(_0x42e824,_0x580ec3){_0x580ec3=_0x580ec3||0xcc;return function(_0x1ba56a){if(_0x1ba56a){return _0x42e824['sendStatus'](_0x580ec3);}return _0x42e824[_0xe1fd('0x21')](_0x580ec3)[_0xe1fd('0x22')]();};}function respondWithResult(_0x371e78,_0x362fd5){_0x362fd5=_0x362fd5||0xc8;return function(_0x181b02){if(_0x181b02){return _0x371e78['status'](_0x362fd5)[_0xe1fd('0x23')](_0x181b02);}};}function respondWithFilteredResult(_0x4348ef,_0x1fc2e4){return function(_0x1d94ff){if(_0x1d94ff){var _0x48b6b7=_0x1d94ff[_0xe1fd('0x24')],_0x913b6f=_0x1fc2e4[_0xe1fd('0x25')],_0xe9cb64=_0x1fc2e4[_0xe1fd('0x25')]+_0x1fc2e4[_0xe1fd('0x26')],_0x324efb;if(_0xe9cb64>=_0x48b6b7){_0xe9cb64=_0x48b6b7;_0x324efb=0xc8;}else{_0x324efb=0xce;}_0x4348ef[_0xe1fd('0x21')](_0x324efb);return _0x4348ef['set'](_0xe1fd('0x27'),_0x913b6f+'-'+_0xe9cb64+'/'+_0x48b6b7)[_0xe1fd('0x23')](_0x1d94ff);}return null;};}function patchUpdates(_0x404188){return function(_0x13bf62){try{jsonpatch['apply'](_0x13bf62,_0x404188,!![]);}catch(_0x555954){return BPromise[_0xe1fd('0x28')](_0x555954);}return _0x13bf62[_0xe1fd('0x29')]();};}function saveUpdates(_0x198c21,_0x387e09){return function(_0x42b875){if(_0x42b875){return _0x42b875[_0xe1fd('0x2a')](_0x198c21)[_0xe1fd('0x2b')](function(_0x24df90){return _0x24df90;});}return null;};}function removeEntity(_0x19b535,_0x412be2){return function(_0x1a47af){if(_0x1a47af){return _0x1a47af[_0xe1fd('0x2c')]()[_0xe1fd('0x2b')](function(){var _0x216b8b=_0x1a47af[_0xe1fd('0x2d')]({'plain':!![]});var _0x292723=_0xe1fd('0x2e');return db['UserProfileResource'][_0xe1fd('0x2c')]({'where':{'type':_0x292723,'resourceId':_0x216b8b['id']}})[_0xe1fd('0x2b')](function(){return _0x1a47af;});})[_0xe1fd('0x2b')](function(){_0x19b535[_0xe1fd('0x21')](0xcc)[_0xe1fd('0x22')]();});}};}function handleEntityNotFound(_0x53f2a1,_0x288cc4){return function(_0x7a241c){if(!_0x7a241c){_0x53f2a1[_0xe1fd('0x2f')](0x194);}return _0x7a241c;};}function handleError(_0x30babd,_0x1f43f3){_0x1f43f3=_0x1f43f3||0x1f4;return function(_0x52a5ac){logger[_0xe1fd('0x30')](_0x52a5ac[_0xe1fd('0x31')]);if(_0x52a5ac[_0xe1fd('0x32')]){delete _0x52a5ac[_0xe1fd('0x32')];}_0x30babd['status'](_0x1f43f3)[_0xe1fd('0x33')](_0x52a5ac);};}exports[_0xe1fd('0x34')]=function(_0x507c32,_0x3bc573){var _0x3a6e70={},_0x40045c={},_0x5e3123={'count':0x0,'rows':[]};var _0x45628e=_[_0xe1fd('0x35')](db[_0xe1fd('0x36')][_0xe1fd('0x37')],function(_0x1b9210){return{'name':_0x1b9210[_0xe1fd('0x38')],'type':_0x1b9210[_0xe1fd('0x39')][_0xe1fd('0x3a')]};});_0x40045c['model']=_[_0xe1fd('0x35')](_0x45628e,_0xe1fd('0x32'));_0x40045c[_0xe1fd('0x3b')]=_['keys'](_0x507c32['query']);_0x40045c['filters']=_['intersection'](_0x40045c[_0xe1fd('0x3c')],_0x40045c[_0xe1fd('0x3b')]);_0x3a6e70['attributes']=_['intersection'](_0x40045c[_0xe1fd('0x3c')],qs['fields'](_0x507c32[_0xe1fd('0x3b')][_0xe1fd('0x3d')]));_0x3a6e70[_0xe1fd('0x3e')]=_0x3a6e70[_0xe1fd('0x3e')][_0xe1fd('0x3f')]?_0x3a6e70[_0xe1fd('0x3e')]:_0x40045c[_0xe1fd('0x3c')];if(!_0x507c32[_0xe1fd('0x3b')][_0xe1fd('0x40')](_0xe1fd('0x41'))){_0x3a6e70[_0xe1fd('0x26')]=qs[_0xe1fd('0x26')](_0x507c32[_0xe1fd('0x3b')][_0xe1fd('0x26')]);_0x3a6e70[_0xe1fd('0x25')]=qs[_0xe1fd('0x25')](_0x507c32[_0xe1fd('0x3b')][_0xe1fd('0x25')]);}_0x3a6e70[_0xe1fd('0x42')]=qs[_0xe1fd('0x43')](_0x507c32[_0xe1fd('0x3b')][_0xe1fd('0x43')]);_0x3a6e70['where']=qs[_0xe1fd('0x44')](_[_0xe1fd('0x45')](_0x507c32['query'],_0x40045c['filters']),_0x45628e);if(_0x507c32['query'][_0xe1fd('0x46')]){_0x3a6e70['where']=_[_0xe1fd('0x47')](_0x3a6e70['where'],{'$or':_[_0xe1fd('0x35')](_0x45628e,function(_0x4042d1){if(_0x4042d1[_0xe1fd('0x39')]!==_0xe1fd('0x48')){var _0x2f8d55={};_0x2f8d55[_0x4042d1['name']]={'$like':'%'+_0x507c32[_0xe1fd('0x3b')]['filter']+'%'};return _0x2f8d55;}})});}_0x3a6e70=_['merge']({},_0x3a6e70,_0x507c32[_0xe1fd('0x49')]);var _0x9eb866={'where':_0x3a6e70['where']};return db['SquareProject'][_0xe1fd('0x24')](_0x9eb866)[_0xe1fd('0x2b')](function(_0x414d2e){_0x5e3123['count']=_0x414d2e;if(_0x507c32[_0xe1fd('0x3b')][_0xe1fd('0x4a')]){_0x3a6e70[_0xe1fd('0x4b')]=[{'all':!![]}];}return db[_0xe1fd('0x36')]['findAll'](_0x3a6e70);})[_0xe1fd('0x2b')](function(_0x83ae41){_0x5e3123[_0xe1fd('0x4c')]=_0x83ae41;return _0x5e3123;})['then'](respondWithFilteredResult(_0x3bc573,_0x3a6e70))[_0xe1fd('0x4d')](handleError(_0x3bc573,null));};exports[_0xe1fd('0x4e')]=function(_0xbb6bf6,_0x29b07a){var _0x2b8d7e={'raw':![],'where':{'id':_0xbb6bf6[_0xe1fd('0x4f')]['id']}},_0x3d6358={};_0x3d6358[_0xe1fd('0x3c')]=_[_0xe1fd('0x50')](db[_0xe1fd('0x36')][_0xe1fd('0x37')]);_0x3d6358['query']=_[_0xe1fd('0x50')](_0xbb6bf6[_0xe1fd('0x3b')]);_0x3d6358['filters']=_['intersection'](_0x3d6358[_0xe1fd('0x3c')],_0x3d6358[_0xe1fd('0x3b')]);_0x2b8d7e[_0xe1fd('0x3e')]=_[_0xe1fd('0x51')](_0x3d6358[_0xe1fd('0x3c')],qs[_0xe1fd('0x3d')](_0xbb6bf6[_0xe1fd('0x3b')][_0xe1fd('0x3d')]));_0x2b8d7e[_0xe1fd('0x3e')]=_0x2b8d7e[_0xe1fd('0x3e')]['length']?_0x2b8d7e['attributes']:_0x3d6358[_0xe1fd('0x3c')];if(_0xbb6bf6[_0xe1fd('0x3b')][_0xe1fd('0x4a')]){_0x2b8d7e[_0xe1fd('0x4b')]=[{'all':!![]}];}_0x2b8d7e=_[_0xe1fd('0x47')]({},_0x2b8d7e,_0xbb6bf6[_0xe1fd('0x49')]);return db[_0xe1fd('0x36')][_0xe1fd('0x52')](_0x2b8d7e)[_0xe1fd('0x2b')](handleEntityNotFound(_0x29b07a,null))[_0xe1fd('0x2b')](respondWithResult(_0x29b07a,null))[_0xe1fd('0x4d')](handleError(_0x29b07a,null));};exports[_0xe1fd('0x53')]=function(_0x5abf1c,_0x1d38d2){return db[_0xe1fd('0x36')]['create'](_0x5abf1c[_0xe1fd('0x54')],{})[_0xe1fd('0x2b')](function(_0x40bba4){var _0x57fbcf=_0x5abf1c[_0xe1fd('0x55')]['get']({'plain':!![]});if(!_0x57fbcf)throw new Error(_0xe1fd('0x56'));if(_0x57fbcf['role']===_0xe1fd('0x55')){var _0x27b9c8=_0x40bba4['get']({'plain':!![]});var _0x176a7f=_0xe1fd('0x2e');return db[_0xe1fd('0x57')][_0xe1fd('0x52')]({'where':{'name':_0x176a7f,'userProfileId':_0x57fbcf[_0xe1fd('0x58')]},'raw':!![]})[_0xe1fd('0x2b')](function(_0x27944d){if(_0x27944d&&_0x27944d[_0xe1fd('0x59')]===0x0){return db[_0xe1fd('0x5a')][_0xe1fd('0x53')]({'name':_0x27b9c8['name'],'resourceId':_0x27b9c8['id'],'type':_0x27944d[_0xe1fd('0x32')],'sectionId':_0x27944d['id']},{})[_0xe1fd('0x2b')](function(){return _0x40bba4;});}else{return _0x40bba4;}})[_0xe1fd('0x4d')](function(_0x5ee236){logger[_0xe1fd('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ee236);throw _0x5ee236;});}return _0x40bba4;})[_0xe1fd('0x2b')](respondWithResult(_0x1d38d2,0xc9))[_0xe1fd('0x4d')](handleError(_0x1d38d2,null));};exports[_0xe1fd('0x2a')]=function(_0x13f83f,_0x4b8fa9){if(_0x13f83f[_0xe1fd('0x54')]['id']){delete _0x13f83f['body']['id'];}return db[_0xe1fd('0x36')][_0xe1fd('0x52')]({'where':{'id':_0x13f83f['params']['id']}})[_0xe1fd('0x2b')](handleEntityNotFound(_0x4b8fa9,null))[_0xe1fd('0x2b')](saveUpdates(_0x13f83f[_0xe1fd('0x54')],null))['then'](respondWithResult(_0x4b8fa9,null))[_0xe1fd('0x4d')](handleError(_0x4b8fa9,null));};exports[_0xe1fd('0x2c')]=function(_0x200fb7,_0x242a66){return db[_0xe1fd('0x36')][_0xe1fd('0x52')]({'where':{'id':_0x200fb7[_0xe1fd('0x4f')]['id']}})[_0xe1fd('0x2b')](handleEntityNotFound(_0x242a66,null))['then'](removeEntity(_0x242a66,null))[_0xe1fd('0x4d')](handleError(_0x242a66,null));};exports[_0xe1fd('0x5b')]=function(_0x5182c1,_0x51f2a2,_0x176af5){return db['SquareProject']['find']({'where':{'id':_0x5182c1[_0xe1fd('0x4f')]['id']}})[_0xe1fd('0x2b')](handleEntityNotFound(_0x51f2a2,null))[_0xe1fd('0x2b')](function(_0x299232){if(_0x299232){return _0x299232[_0xe1fd('0x5b')](_0x5182c1[_0xe1fd('0x54')][_0xe1fd('0x5c')],_[_0xe1fd('0x5d')](_0x5182c1[_0xe1fd('0x54')],[_0xe1fd('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x51f2a2,null))[_0xe1fd('0x4d')](handleError(_0x51f2a2,null));};exports[_0xe1fd('0x5e')]=function(_0x4344c8,_0x308e37,_0x50c4ca){return db['SquareProject']['find']({'where':{'id':_0x4344c8[_0xe1fd('0x4f')]['id']}})[_0xe1fd('0x2b')](handleEntityNotFound(_0x308e37,null))[_0xe1fd('0x2b')](function(_0x4be1eb){if(_0x4be1eb){return _0x4be1eb[_0xe1fd('0x5e')](_0x4344c8[_0xe1fd('0x3b')][_0xe1fd('0x5c')])[_0xe1fd('0x2b')](function(){if(_[_0xe1fd('0x5f')](_0x4344c8[_0xe1fd('0x3b')][_0xe1fd('0x5c')])){for(var _0x564178=0x0;_0x564178<_0x4344c8['query']['ids'][_0xe1fd('0x3f')];_0x564178+=0x1){socket[_0xe1fd('0x60')]('userSquareProject:remove',{'UserId':Number(_0x4344c8[_0xe1fd('0x3b')]['ids'][_0x564178]),'SquareProjectId':Number(_0x4344c8['params']['id'])});}}else{socket[_0xe1fd('0x60')]('userSquareProject:remove',{'UserId':Number(_0x4344c8[_0xe1fd('0x3b')]['ids']),'SquareProjectId':Number(_0x4344c8[_0xe1fd('0x4f')]['id'])});}});}})[_0xe1fd('0x2b')](respondWithStatusCode(_0x308e37,null))['catch'](handleError(_0x308e37,null));};exports[_0xe1fd('0x61')]=function(_0x10cccd,_0x2a7fbf,_0x49e77b){var _0x1248e1={};var _0x33e51a={};var _0x50f2b4;var _0x2caf4c;return db[_0xe1fd('0x36')]['findOne']({'where':{'id':_0x10cccd['params']['id']}})[_0xe1fd('0x2b')](handleEntityNotFound(_0x2a7fbf,null))['then'](function(_0x377e84){if(_0x377e84){_0x50f2b4=_0x377e84;_0x33e51a[_0xe1fd('0x3c')]=_[_0xe1fd('0x50')](db[_0xe1fd('0x62')][_0xe1fd('0x37')]);_0x33e51a[_0xe1fd('0x3b')]=_[_0xe1fd('0x50')](_0x10cccd[_0xe1fd('0x3b')]);_0x33e51a[_0xe1fd('0x44')]=_[_0xe1fd('0x51')](_0x33e51a['model'],_0x33e51a[_0xe1fd('0x3b')]);_0x1248e1[_0xe1fd('0x3e')]=_['intersection'](_0x33e51a[_0xe1fd('0x3c')],qs[_0xe1fd('0x3d')](_0x10cccd[_0xe1fd('0x3b')][_0xe1fd('0x3d')]));_0x1248e1[_0xe1fd('0x3e')]=_0x1248e1['attributes'][_0xe1fd('0x3f')]?_0x1248e1[_0xe1fd('0x3e')]:_0x33e51a[_0xe1fd('0x3c')];_0x1248e1[_0xe1fd('0x42')]=qs[_0xe1fd('0x43')](_0x10cccd[_0xe1fd('0x3b')][_0xe1fd('0x43')]);_0x1248e1[_0xe1fd('0x63')]=qs[_0xe1fd('0x44')](_['pick'](_0x10cccd[_0xe1fd('0x3b')],_0x33e51a[_0xe1fd('0x44')]));if(_0x10cccd['query'][_0xe1fd('0x46')]){_0x1248e1['where']=_[_0xe1fd('0x47')](_0x1248e1[_0xe1fd('0x63')],{'$or':_[_0xe1fd('0x35')](_0x1248e1[_0xe1fd('0x3e')],function(_0x27da0f){var _0x5b63ba={};_0x5b63ba[_0x27da0f]={'$like':'%'+_0x10cccd['query'][_0xe1fd('0x46')]+'%'};return _0x5b63ba;})});}_0x1248e1=_[_0xe1fd('0x47')]({},_0x1248e1,_0x10cccd[_0xe1fd('0x49')]);return _0x50f2b4['getUsers'](_0x1248e1);}})[_0xe1fd('0x2b')](function(_0x1f7c05){if(_0x1f7c05){_0x2caf4c=_0x1f7c05[_0xe1fd('0x3f')];if(!_0x10cccd[_0xe1fd('0x3b')][_0xe1fd('0x40')](_0xe1fd('0x41'))){_0x1248e1[_0xe1fd('0x26')]=qs[_0xe1fd('0x26')](_0x10cccd['query'][_0xe1fd('0x26')]);_0x1248e1[_0xe1fd('0x25')]=qs[_0xe1fd('0x25')](_0x10cccd[_0xe1fd('0x3b')][_0xe1fd('0x25')]);}return _0x50f2b4[_0xe1fd('0x61')](_0x1248e1);}})['then'](function(_0x1ba3eb){if(_0x1ba3eb){return _0x1ba3eb?{'count':_0x2caf4c,'rows':_0x1ba3eb}:null;}})[_0xe1fd('0x2b')](respondWithResult(_0x2a7fbf,null))[_0xe1fd('0x4d')](handleError(_0x2a7fbf,null));}; \ No newline at end of file +var _0x10f0=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','pick','filter','getUsers','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','status','json'];(function(_0x310820,_0x3cf3f5){var _0x5437e8=function(_0x3b17be){while(--_0x3b17be){_0x310820['push'](_0x310820['shift']());}};_0x5437e8(++_0x3cf3f5);}(_0x10f0,0x157));var _0x010f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x10f0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x010f('0x0'));var emlformat=require(_0x010f('0x1'));var rimraf=require(_0x010f('0x2'));var zipdir=require(_0x010f('0x3'));var jsonpatch=require(_0x010f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x010f('0x5'));var Mustache=require(_0x010f('0x6'));var util=require(_0x010f('0x7'));var path=require(_0x010f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x010f('0x9'));var fs=require('fs');var _=require(_0x010f('0xa'));var squel=require(_0x010f('0xb'));var crypto=require(_0x010f('0xc'));var jsforce=require(_0x010f('0xd'));var deskjs=require(_0x010f('0xe'));var toCsv=require(_0x010f('0xf'));var querystring=require('querystring');var Papa=require(_0x010f('0x10'));var Redis=require(_0x010f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x010f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x010f('0x13'))(_0x010f('0x14'));var utils=require(_0x010f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x010f('0x16'));var db=require('../../mysqldb')['db'];config[_0x010f('0x17')]=_['defaults'](config[_0x010f('0x17')],{'host':_0x010f('0x18'),'port':0x18eb});var socket=require(_0x010f('0x19'))(new Redis(config['redis']));require('./squareProject.socket')[_0x010f('0x1a')](socket);function respondWithStatusCode(_0x508005,_0x3e4583){_0x3e4583=_0x3e4583||0xcc;return function(_0x37e050){if(_0x37e050){return _0x508005['sendStatus'](_0x3e4583);}return _0x508005[_0x010f('0x1b')](_0x3e4583)['end']();};}function respondWithResult(_0x4c38e6,_0x375de9){_0x375de9=_0x375de9||0xc8;return function(_0x2b6620){if(_0x2b6620){return _0x4c38e6[_0x010f('0x1b')](_0x375de9)[_0x010f('0x1c')](_0x2b6620);}};}function respondWithFilteredResult(_0x339061,_0x35ad42){return function(_0x49f280){if(_0x49f280){var _0x22e0fc=_0x49f280[_0x010f('0x1d')],_0xbf8595=_0x35ad42[_0x010f('0x1e')],_0x14ee4f=_0x35ad42['offset']+_0x35ad42[_0x010f('0x1f')],_0x3a00c4;if(_0x14ee4f>=_0x22e0fc){_0x14ee4f=_0x22e0fc;_0x3a00c4=0xc8;}else{_0x3a00c4=0xce;}_0x339061['status'](_0x3a00c4);return _0x339061[_0x010f('0x20')](_0x010f('0x21'),_0xbf8595+'-'+_0x14ee4f+'/'+_0x22e0fc)[_0x010f('0x1c')](_0x49f280);}return null;};}function patchUpdates(_0x100ded){return function(_0x4439df){try{jsonpatch[_0x010f('0x22')](_0x4439df,_0x100ded,!![]);}catch(_0x35bb2e){return BPromise[_0x010f('0x23')](_0x35bb2e);}return _0x4439df[_0x010f('0x24')]();};}function saveUpdates(_0x1132b8,_0x1e0a53){return function(_0x83a31e){if(_0x83a31e){return _0x83a31e[_0x010f('0x25')](_0x1132b8)[_0x010f('0x26')](function(_0x1859dd){return _0x1859dd;});}return null;};}function removeEntity(_0x5d8bcf,_0x3aca26){return function(_0x551d02){if(_0x551d02){return _0x551d02[_0x010f('0x27')]()[_0x010f('0x26')](function(){var _0x3feb5c=_0x551d02[_0x010f('0x28')]({'plain':!![]});var _0x2fbf83=_0x010f('0x29');return db[_0x010f('0x2a')][_0x010f('0x27')]({'where':{'type':_0x2fbf83,'resourceId':_0x3feb5c['id']}})[_0x010f('0x26')](function(){return _0x551d02;});})[_0x010f('0x26')](function(){_0x5d8bcf[_0x010f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524da9,_0xf070c3){return function(_0x23a418){if(!_0x23a418){_0x524da9['sendStatus'](0x194);}return _0x23a418;};}function handleError(_0x5b0346,_0x4834c2){_0x4834c2=_0x4834c2||0x1f4;return function(_0x9ef675){logger[_0x010f('0x2b')](_0x9ef675[_0x010f('0x2c')]);if(_0x9ef675[_0x010f('0x2d')]){delete _0x9ef675['name'];}_0x5b0346[_0x010f('0x1b')](_0x4834c2)['send'](_0x9ef675);};}exports[_0x010f('0x2e')]=function(_0x521f90,_0x4beef8){var _0x84a42c={},_0x44820f={},_0x4e3042={'count':0x0,'rows':[]};var _0x2b9285=_[_0x010f('0x2f')](db[_0x010f('0x30')][_0x010f('0x31')],function(_0x34c6d9){return{'name':_0x34c6d9[_0x010f('0x32')],'type':_0x34c6d9['type'][_0x010f('0x33')]};});_0x44820f[_0x010f('0x34')]=_['map'](_0x2b9285,_0x010f('0x2d'));_0x44820f[_0x010f('0x35')]=_[_0x010f('0x36')](_0x521f90[_0x010f('0x35')]);_0x44820f[_0x010f('0x37')]=_[_0x010f('0x38')](_0x44820f[_0x010f('0x34')],_0x44820f['query']);_0x84a42c['attributes']=_['intersection'](_0x44820f[_0x010f('0x34')],qs[_0x010f('0x39')](_0x521f90['query'][_0x010f('0x39')]));_0x84a42c['attributes']=_0x84a42c[_0x010f('0x3a')][_0x010f('0x3b')]?_0x84a42c[_0x010f('0x3a')]:_0x44820f[_0x010f('0x34')];if(!_0x521f90[_0x010f('0x35')]['hasOwnProperty'](_0x010f('0x3c'))){_0x84a42c[_0x010f('0x1f')]=qs[_0x010f('0x1f')](_0x521f90[_0x010f('0x35')][_0x010f('0x1f')]);_0x84a42c[_0x010f('0x1e')]=qs[_0x010f('0x1e')](_0x521f90[_0x010f('0x35')][_0x010f('0x1e')]);}_0x84a42c[_0x010f('0x3d')]=qs[_0x010f('0x3e')](_0x521f90[_0x010f('0x35')][_0x010f('0x3e')]);_0x84a42c[_0x010f('0x3f')]=qs[_0x010f('0x37')](_['pick'](_0x521f90[_0x010f('0x35')],_0x44820f['filters']),_0x2b9285);if(_0x521f90[_0x010f('0x35')]['filter']){_0x84a42c[_0x010f('0x3f')]=_[_0x010f('0x40')](_0x84a42c[_0x010f('0x3f')],{'$or':_[_0x010f('0x2f')](_0x2b9285,function(_0x420ac7){if(_0x420ac7[_0x010f('0x41')]!=='VIRTUAL'){var _0x407cff={};_0x407cff[_0x420ac7[_0x010f('0x2d')]]={'$like':'%'+_0x521f90[_0x010f('0x35')]['filter']+'%'};return _0x407cff;}})});}_0x84a42c=_[_0x010f('0x40')]({},_0x84a42c,_0x521f90[_0x010f('0x42')]);var _0x5e6791={'where':_0x84a42c[_0x010f('0x3f')]};return db[_0x010f('0x30')][_0x010f('0x1d')](_0x5e6791)[_0x010f('0x26')](function(_0x26b39d){_0x4e3042[_0x010f('0x1d')]=_0x26b39d;if(_0x521f90[_0x010f('0x35')][_0x010f('0x43')]){_0x84a42c[_0x010f('0x44')]=[{'all':!![]}];}return db[_0x010f('0x30')][_0x010f('0x45')](_0x84a42c);})[_0x010f('0x26')](function(_0x4d1c60){_0x4e3042[_0x010f('0x46')]=_0x4d1c60;return _0x4e3042;})[_0x010f('0x26')](respondWithFilteredResult(_0x4beef8,_0x84a42c))[_0x010f('0x47')](handleError(_0x4beef8,null));};exports['show']=function(_0x6e5a5,_0x43ca34){var _0x4df552={'raw':![],'where':{'id':_0x6e5a5[_0x010f('0x48')]['id']}},_0x1f866f={};_0x1f866f[_0x010f('0x34')]=_[_0x010f('0x36')](db['SquareProject'][_0x010f('0x31')]);_0x1f866f['query']=_[_0x010f('0x36')](_0x6e5a5['query']);_0x1f866f[_0x010f('0x37')]=_['intersection'](_0x1f866f['model'],_0x1f866f[_0x010f('0x35')]);_0x4df552[_0x010f('0x3a')]=_[_0x010f('0x38')](_0x1f866f[_0x010f('0x34')],qs[_0x010f('0x39')](_0x6e5a5[_0x010f('0x35')][_0x010f('0x39')]));_0x4df552[_0x010f('0x3a')]=_0x4df552[_0x010f('0x3a')][_0x010f('0x3b')]?_0x4df552[_0x010f('0x3a')]:_0x1f866f[_0x010f('0x34')];if(_0x6e5a5[_0x010f('0x35')][_0x010f('0x43')]){_0x4df552[_0x010f('0x44')]=[{'all':!![]}];}_0x4df552=_['merge']({},_0x4df552,_0x6e5a5[_0x010f('0x42')]);return db[_0x010f('0x30')][_0x010f('0x49')](_0x4df552)[_0x010f('0x26')](handleEntityNotFound(_0x43ca34,null))['then'](respondWithResult(_0x43ca34,null))[_0x010f('0x47')](handleError(_0x43ca34,null));};exports[_0x010f('0x4a')]=function(_0x107156,_0x494e01){return db[_0x010f('0x30')][_0x010f('0x4a')](_0x107156[_0x010f('0x4b')],{})[_0x010f('0x26')](function(_0x2a00e2){var _0x40d10b=_0x107156['user'][_0x010f('0x28')]({'plain':!![]});if(!_0x40d10b)throw new Error(_0x010f('0x4c'));if(_0x40d10b['role']===_0x010f('0x4d')){var _0x4758c0=_0x2a00e2[_0x010f('0x28')]({'plain':!![]});var _0x248676=_0x010f('0x29');return db[_0x010f('0x4e')][_0x010f('0x49')]({'where':{'name':_0x248676,'userProfileId':_0x40d10b[_0x010f('0x4f')]},'raw':!![]})[_0x010f('0x26')](function(_0x4313d9){if(_0x4313d9&&_0x4313d9[_0x010f('0x50')]===0x0){return db['UserProfileResource'][_0x010f('0x4a')]({'name':_0x4758c0[_0x010f('0x2d')],'resourceId':_0x4758c0['id'],'type':_0x4313d9[_0x010f('0x2d')],'sectionId':_0x4313d9['id']},{})[_0x010f('0x26')](function(){return _0x2a00e2;});}else{return _0x2a00e2;}})[_0x010f('0x47')](function(_0x3f7a1d){logger[_0x010f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f7a1d);throw _0x3f7a1d;});}return _0x2a00e2;})[_0x010f('0x26')](respondWithResult(_0x494e01,0xc9))[_0x010f('0x47')](handleError(_0x494e01,null));};exports[_0x010f('0x25')]=function(_0xdd52fb,_0x589480){if(_0xdd52fb[_0x010f('0x4b')]['id']){delete _0xdd52fb[_0x010f('0x4b')]['id'];}return db['SquareProject']['find']({'where':{'id':_0xdd52fb[_0x010f('0x48')]['id']}})[_0x010f('0x26')](handleEntityNotFound(_0x589480,null))[_0x010f('0x26')](saveUpdates(_0xdd52fb[_0x010f('0x4b')],null))[_0x010f('0x26')](respondWithResult(_0x589480,null))[_0x010f('0x47')](handleError(_0x589480,null));};exports[_0x010f('0x27')]=function(_0x3c5856,_0x50d5dc){return db[_0x010f('0x30')][_0x010f('0x49')]({'where':{'id':_0x3c5856[_0x010f('0x48')]['id']}})[_0x010f('0x26')](handleEntityNotFound(_0x50d5dc,null))[_0x010f('0x26')](removeEntity(_0x50d5dc,null))[_0x010f('0x47')](handleError(_0x50d5dc,null));};exports['addUsers']=function(_0x38b8ae,_0x3399c1,_0x4f046f){return db['SquareProject']['find']({'where':{'id':_0x38b8ae['params']['id']}})[_0x010f('0x26')](handleEntityNotFound(_0x3399c1,null))[_0x010f('0x26')](function(_0x358d21){if(_0x358d21){return _0x358d21[_0x010f('0x51')](_0x38b8ae['body'][_0x010f('0x52')],_['omit'](_0x38b8ae[_0x010f('0x4b')],['ids','id'])||{});}})[_0x010f('0x26')](respondWithResult(_0x3399c1,null))[_0x010f('0x47')](handleError(_0x3399c1,null));};exports[_0x010f('0x53')]=function(_0x3ccc30,_0x353b1e,_0x1e7ee8){return db[_0x010f('0x30')]['find']({'where':{'id':_0x3ccc30[_0x010f('0x48')]['id']}})['then'](handleEntityNotFound(_0x353b1e,null))['then'](function(_0x2913a8){if(_0x2913a8){return _0x2913a8['removeUsers'](_0x3ccc30[_0x010f('0x35')][_0x010f('0x52')])[_0x010f('0x26')](function(){if(_[_0x010f('0x54')](_0x3ccc30[_0x010f('0x35')][_0x010f('0x52')])){for(var _0x2846f4=0x0;_0x2846f4<_0x3ccc30[_0x010f('0x35')][_0x010f('0x52')]['length'];_0x2846f4+=0x1){socket[_0x010f('0x55')](_0x010f('0x56'),{'UserId':Number(_0x3ccc30[_0x010f('0x35')]['ids'][_0x2846f4]),'SquareProjectId':Number(_0x3ccc30['params']['id'])});}}else{socket['emit'](_0x010f('0x56'),{'UserId':Number(_0x3ccc30[_0x010f('0x35')]['ids']),'SquareProjectId':Number(_0x3ccc30['params']['id'])});}});}})[_0x010f('0x26')](respondWithStatusCode(_0x353b1e,null))[_0x010f('0x47')](handleError(_0x353b1e,null));};exports['getUsers']=function(_0x139502,_0x3d96e4,_0x906eb1){var _0x4f02c3={};var _0x51b19a={};var _0x3ded33;var _0x313f2e;return db[_0x010f('0x30')][_0x010f('0x57')]({'where':{'id':_0x139502['params']['id']}})[_0x010f('0x26')](handleEntityNotFound(_0x3d96e4,null))[_0x010f('0x26')](function(_0x2def95){if(_0x2def95){_0x3ded33=_0x2def95;_0x51b19a[_0x010f('0x34')]=_['keys'](db[_0x010f('0x58')]['rawAttributes']);_0x51b19a[_0x010f('0x35')]=_['keys'](_0x139502['query']);_0x51b19a[_0x010f('0x37')]=_[_0x010f('0x38')](_0x51b19a[_0x010f('0x34')],_0x51b19a[_0x010f('0x35')]);_0x4f02c3[_0x010f('0x3a')]=_[_0x010f('0x38')](_0x51b19a[_0x010f('0x34')],qs[_0x010f('0x39')](_0x139502[_0x010f('0x35')][_0x010f('0x39')]));_0x4f02c3[_0x010f('0x3a')]=_0x4f02c3['attributes']['length']?_0x4f02c3[_0x010f('0x3a')]:_0x51b19a[_0x010f('0x34')];_0x4f02c3[_0x010f('0x3d')]=qs['sort'](_0x139502[_0x010f('0x35')]['sort']);_0x4f02c3[_0x010f('0x3f')]=qs['filters'](_[_0x010f('0x59')](_0x139502[_0x010f('0x35')],_0x51b19a[_0x010f('0x37')]));if(_0x139502[_0x010f('0x35')]['filter']){_0x4f02c3[_0x010f('0x3f')]=_['merge'](_0x4f02c3['where'],{'$or':_[_0x010f('0x2f')](_0x4f02c3[_0x010f('0x3a')],function(_0x33ed3b){var _0x5e8882={};_0x5e8882[_0x33ed3b]={'$like':'%'+_0x139502['query'][_0x010f('0x5a')]+'%'};return _0x5e8882;})});}_0x4f02c3=_[_0x010f('0x40')]({},_0x4f02c3,_0x139502[_0x010f('0x42')]);return _0x3ded33[_0x010f('0x5b')](_0x4f02c3);}})[_0x010f('0x26')](function(_0x3a1142){if(_0x3a1142){_0x313f2e=_0x3a1142[_0x010f('0x3b')];if(!_0x139502[_0x010f('0x35')][_0x010f('0x5c')](_0x010f('0x3c'))){_0x4f02c3[_0x010f('0x1f')]=qs[_0x010f('0x1f')](_0x139502['query'][_0x010f('0x1f')]);_0x4f02c3[_0x010f('0x1e')]=qs[_0x010f('0x1e')](_0x139502[_0x010f('0x35')][_0x010f('0x1e')]);}return _0x3ded33['getUsers'](_0x4f02c3);}})[_0x010f('0x26')](function(_0x1ab4e2){if(_0x1ab4e2){return _0x1ab4e2?{'count':_0x313f2e,'rows':_0x1ab4e2}:null;}})[_0x010f('0x26')](respondWithResult(_0x3d96e4,null))[_0x010f('0x47')](handleError(_0x3d96e4,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 975cfdc..a72a30e 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 _0x9ea0=['hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9ea0,0xc0));var _0x09ea=function(_0x564c0a,_0x4c86ba){_0x564c0a=_0x564c0a-0x0;var _0x30f5ff=_0x9ea0[_0x564c0a];return _0x30f5ff;};'use strict';var EventEmitter=require(_0x09ea('0x0'));var SquareProject=require(_0x09ea('0x1'))['db'][_0x09ea('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x09ea('0x3')](0x0);var events={'afterCreate':_0x09ea('0x4'),'afterUpdate':_0x09ea('0x5'),'afterDestroy':_0x09ea('0x6')};function emitEvent(_0x826db4){return function(_0x2ad1f3,_0x4fb258,_0x5c75e6){SquareProjectEvents[_0x09ea('0x7')](_0x826db4+':'+_0x2ad1f3['id'],_0x2ad1f3);SquareProjectEvents[_0x09ea('0x7')](_0x826db4,_0x2ad1f3);_0x5c75e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x09ea('0x8')](e,emitEvent(event));}}module[_0x09ea('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x0a4a=['save','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5a10a3,_0x2e7a64){var _0x264f4c=function(_0x4bb7b6){while(--_0x4bb7b6){_0x5a10a3['push'](_0x5a10a3['shift']());}};_0x264f4c(++_0x2e7a64);}(_0x0a4a,0x1ad));var _0xa0a4=function(_0x11e268,_0x7325a){_0x11e268=_0x11e268-0x0;var _0x2765e4=_0x0a4a[_0x11e268];return _0x2765e4;};'use strict';var EventEmitter=require(_0xa0a4('0x0'));var SquareProject=require(_0xa0a4('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa0a4('0x2')](0x0);var events={'afterCreate':_0xa0a4('0x3'),'afterUpdate':'update','afterDestroy':_0xa0a4('0x4')};function emitEvent(_0x1296bd){return function(_0x46d1c5,_0x329101,_0x4a6283){SquareProjectEvents[_0xa0a4('0x5')](_0x1296bd+':'+_0x46d1c5['id'],_0x46d1c5);SquareProjectEvents[_0xa0a4('0x5')](_0x1296bd,_0x46d1c5);_0x4a6283(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa0a4('0x6')](e,emitEvent(event));}}module[_0xa0a4('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b212f8b..c299638 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 _0x2caf=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt'];(function(_0x5b6af4,_0x5b31e1){var _0x5eca47=function(_0x2437c9){while(--_0x2437c9){_0x5b6af4['push'](_0x5b6af4['shift']());}};_0x5eca47(++_0x5b31e1);}(_0x2caf,0x6a));var _0xf2ca=function(_0x40341f,_0x2e78e1){_0x40341f=_0x40341f-0x0;var _0x22a870=_0x2caf[_0x40341f];return _0x22a870;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf2ca('0x0'));var moment=require('moment');var BPromise=require(_0xf2ca('0x1'));var rp=require(_0xf2ca('0x2'));var fs=require('fs');var path=require(_0xf2ca('0x3'));var rimraf=require(_0xf2ca('0x4'));var config=require(_0xf2ca('0x5'));var attributes=require(_0xf2ca('0x6'));module[_0xf2ca('0x7')]=function(_0x51372a,_0x8ce770){return _0x51372a[_0xf2ca('0x8')](_0xf2ca('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ea38c,_0x2fbb08,_0x22ad5d){if(_0x4ea38c[_0xf2ca('0xa')](_0xf2ca('0xb'))){_0x4ea38c[_0xf2ca('0xc')]=moment()['format'](_0xf2ca('0xd'));}if(_0x4ea38c[_0xf2ca('0xa')](_0xf2ca('0xe'))){_0x4ea38c[_0xf2ca('0xf')]=moment()[_0xf2ca('0x10')](_0xf2ca('0xd'));}_0x22ad5d(null,_0x4ea38c);}}});}; \ No newline at end of file +var _0x6d0b=['rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','publishedAt','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x29d25f,_0xf2afd5){var _0x5a48bc=function(_0x229b88){while(--_0x229b88){_0x29d25f['push'](_0x29d25f['shift']());}};_0x5a48bc(++_0xf2afd5);}(_0x6d0b,0x71));var _0xb6d0=function(_0x103fef,_0x356d59){_0x103fef=_0x103fef-0x0;var _0x4ebaef=_0x6d0b[_0x103fef];return _0x4ebaef;};'use strict';var _=require(_0xb6d0('0x0'));var util=require('util');var logger=require(_0xb6d0('0x1'))('api');var moment=require(_0xb6d0('0x2'));var BPromise=require(_0xb6d0('0x3'));var rp=require(_0xb6d0('0x4'));var fs=require('fs');var path=require(_0xb6d0('0x5'));var rimraf=require(_0xb6d0('0x6'));var config=require(_0xb6d0('0x7'));var attributes=require(_0xb6d0('0x8'));module['exports']=function(_0x35142b,_0x3612ac){return _0x35142b[_0xb6d0('0x9')](_0xb6d0('0xa'),attributes,{'tableName':_0xb6d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e41cf,_0x42605b,_0x354e56){if(_0x2e41cf[_0xb6d0('0xc')](_0xb6d0('0xd'))){_0x2e41cf[_0xb6d0('0xe')]=moment()[_0xb6d0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2e41cf[_0xb6d0('0xc')]('production')){_0x2e41cf[_0xb6d0('0x10')]=moment()[_0xb6d0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x354e56(null,_0x2e41cf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d30c2e9..42e813d 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 _0x66b3=['ShowSquareProject','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareProject','find','options','raw','where','map','include','model','attributes','then'];(function(_0x48f4fd,_0x109e22){var _0x4acf8c=function(_0x1fb4ee){while(--_0x1fb4ee){_0x48f4fd['push'](_0x48f4fd['shift']());}};_0x4acf8c(++_0x109e22);}(_0x66b3,0x14f));var _0x366b=function(_0x129812,_0x496836){_0x129812=_0x129812-0x0;var _0x4d001e=_0x66b3[_0x129812];return _0x4d001e;};'use strict';var _=require('lodash');var util=require(_0x366b('0x0'));var moment=require('moment');var BPromise=require(_0x366b('0x1'));var rs=require(_0x366b('0x2'));var fs=require('fs');var Redis=require(_0x366b('0x3'));var db=require(_0x366b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x366b('0x5'))(_0x366b('0x6'));var config=require(_0x366b('0x7'));var jayson=require(_0x366b('0x8'));var client=jayson[_0x366b('0x9')][_0x366b('0xa')]({'port':0x232a});config[_0x366b('0xb')]=_[_0x366b('0xc')](config[_0x366b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x366b('0xb')]));require(_0x366b('0xd'))[_0x366b('0xe')](socket);function respondWithRpcPromise(_0x5a329e,_0x417e63,_0x49eecd){return new BPromise(function(_0x24028b,_0x1b1b1a){return client[_0x366b('0xf')](_0x5a329e,_0x49eecd)['then'](function(_0x4b62a1){logger[_0x366b('0x10')](_0x366b('0x11'),_0x417e63,_0x366b('0x12'));logger[_0x366b('0x13')](_0x366b('0x14'),_0x417e63,_0x366b('0x12'),JSON['stringify'](_0x4b62a1));if(_0x4b62a1[_0x366b('0x15')]){if(_0x4b62a1['error'][_0x366b('0x16')]===0x1f4){logger[_0x366b('0x15')](_0x366b('0x11'),_0x417e63,_0x4b62a1[_0x366b('0x15')][_0x366b('0x17')]);return _0x1b1b1a(_0x4b62a1[_0x366b('0x15')][_0x366b('0x17')]);}logger[_0x366b('0x15')](_0x366b('0x11'),_0x417e63,_0x4b62a1[_0x366b('0x15')][_0x366b('0x17')]);return _0x24028b(_0x4b62a1['error'][_0x366b('0x17')]);}else{logger[_0x366b('0x10')](_0x366b('0x11'),_0x417e63,_0x366b('0x12'));_0x24028b(_0x4b62a1['result'][_0x366b('0x17')]);}})[_0x366b('0x18')](function(_0xa9d66d){logger[_0x366b('0x15')]('SquareProject,\x20%s,\x20%s',_0x417e63,_0xa9d66d);_0x1b1b1a(_0xa9d66d);});});}exports['ShowSquareProject']=function(_0x519e02){var _0x2db727=this;return new Promise(function(_0x38f5b8,_0x75e760){return db[_0x366b('0x19')][_0x366b('0x1a')]({'raw':_0x519e02[_0x366b('0x1b')]?_0x519e02[_0x366b('0x1b')][_0x366b('0x1c')]===undefined?!![]:![]:!![],'where':_0x519e02[_0x366b('0x1b')]?_0x519e02[_0x366b('0x1b')][_0x366b('0x1d')]||null:null,'attributes':_0x519e02['options']?_0x519e02['options']['attributes']||null:null,'include':_0x519e02[_0x366b('0x1b')]?_0x519e02[_0x366b('0x1b')]['include']?_[_0x366b('0x1e')](_0x519e02['options'][_0x366b('0x1f')],function(_0x4525ad){return{'model':db[_0x4525ad[_0x366b('0x20')]],'as':_0x4525ad['as'],'attributes':_0x4525ad[_0x366b('0x21')],'include':_0x4525ad[_0x366b('0x1f')]?_['map'](_0x4525ad['include'],function(_0x35b431){return{'model':db[_0x35b431[_0x366b('0x20')]],'as':_0x35b431['as'],'attributes':_0x35b431[_0x366b('0x21')],'include':_0x35b431['include']?_['map'](_0x35b431['include'],function(_0x4d61bb){return{'model':db[_0x4d61bb[_0x366b('0x20')]],'as':_0x4d61bb['as'],'attributes':_0x4d61bb['attributes']};}):[]};}):[]};}):[]:[]})[_0x366b('0x22')](function(_0x5f0014){logger[_0x366b('0x10')](_0x366b('0x23'),_0x519e02);logger[_0x366b('0x13')](_0x366b('0x23'),_0x519e02,JSON[_0x366b('0x24')](_0x5f0014));_0x38f5b8(_0x5f0014);})['catch'](function(_0x1a5b43){logger[_0x366b('0x15')]('ShowSquareProject',_0x1a5b43[_0x366b('0x17')],_0x519e02);_0x75e760(_0x2db727[_0x366b('0x15')](0x1f4,_0x1a5b43[_0x366b('0x17')]));});});}; \ No newline at end of file +var _0x4f42=['SquareProject,\x20%s,\x20%s','message','result','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x207824,_0x3a8b86){var _0x534553=function(_0x59f93e){while(--_0x59f93e){_0x207824['push'](_0x207824['shift']());}};_0x534553(++_0x3a8b86);}(_0x4f42,0xd6));var _0x24f4=function(_0x32a67d,_0x1bddec){_0x32a67d=_0x32a67d-0x0;var _0x2fd566=_0x4f42[_0x32a67d];return _0x2fd566;};'use strict';var _=require(_0x24f4('0x0'));var util=require(_0x24f4('0x1'));var moment=require(_0x24f4('0x2'));var BPromise=require(_0x24f4('0x3'));var rs=require(_0x24f4('0x4'));var fs=require('fs');var Redis=require(_0x24f4('0x5'));var db=require(_0x24f4('0x6'))['db'];var utils=require(_0x24f4('0x7'));var logger=require(_0x24f4('0x8'))('rpc');var config=require(_0x24f4('0x9'));var jayson=require(_0x24f4('0xa'));var client=jayson[_0x24f4('0xb')][_0x24f4('0xc')]({'port':0x232a});config[_0x24f4('0xd')]=_[_0x24f4('0xe')](config['redis'],{'host':_0x24f4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24f4('0xd')]));require(_0x24f4('0x10'))['register'](socket);function respondWithRpcPromise(_0x76b04f,_0x5c1f10,_0x3755ed){return new BPromise(function(_0x280609,_0x452bfc){return client[_0x24f4('0x11')](_0x76b04f,_0x3755ed)[_0x24f4('0x12')](function(_0x614c9b){logger[_0x24f4('0x13')]('SquareProject,\x20%s,\x20%s',_0x5c1f10,_0x24f4('0x14'));logger[_0x24f4('0x15')](_0x24f4('0x16'),_0x5c1f10,_0x24f4('0x14'),JSON[_0x24f4('0x17')](_0x614c9b));if(_0x614c9b[_0x24f4('0x18')]){if(_0x614c9b[_0x24f4('0x18')][_0x24f4('0x19')]===0x1f4){logger[_0x24f4('0x18')](_0x24f4('0x1a'),_0x5c1f10,_0x614c9b[_0x24f4('0x18')][_0x24f4('0x1b')]);return _0x452bfc(_0x614c9b[_0x24f4('0x18')][_0x24f4('0x1b')]);}logger[_0x24f4('0x18')]('SquareProject,\x20%s,\x20%s',_0x5c1f10,_0x614c9b['error'][_0x24f4('0x1b')]);return _0x280609(_0x614c9b['error']['message']);}else{logger[_0x24f4('0x13')](_0x24f4('0x1a'),_0x5c1f10,'request\x20sent');_0x280609(_0x614c9b[_0x24f4('0x1c')][_0x24f4('0x1b')]);}})['catch'](function(_0x1033da){logger['error'](_0x24f4('0x1a'),_0x5c1f10,_0x1033da);_0x452bfc(_0x1033da);});});}exports[_0x24f4('0x1d')]=function(_0x22dd90){var _0x164191=this;return new Promise(function(_0x3ac15d,_0x144cd2){return db[_0x24f4('0x1e')][_0x24f4('0x1f')]({'raw':_0x22dd90['options']?_0x22dd90[_0x24f4('0x20')][_0x24f4('0x21')]===undefined?!![]:![]:!![],'where':_0x22dd90[_0x24f4('0x20')]?_0x22dd90[_0x24f4('0x20')][_0x24f4('0x22')]||null:null,'attributes':_0x22dd90[_0x24f4('0x20')]?_0x22dd90[_0x24f4('0x20')][_0x24f4('0x23')]||null:null,'include':_0x22dd90[_0x24f4('0x20')]?_0x22dd90['options'][_0x24f4('0x24')]?_[_0x24f4('0x25')](_0x22dd90['options'][_0x24f4('0x24')],function(_0x40d5c6){return{'model':db[_0x40d5c6[_0x24f4('0x26')]],'as':_0x40d5c6['as'],'attributes':_0x40d5c6[_0x24f4('0x23')],'include':_0x40d5c6[_0x24f4('0x24')]?_[_0x24f4('0x25')](_0x40d5c6['include'],function(_0x37abe4){return{'model':db[_0x37abe4[_0x24f4('0x26')]],'as':_0x37abe4['as'],'attributes':_0x37abe4[_0x24f4('0x23')],'include':_0x37abe4[_0x24f4('0x24')]?_[_0x24f4('0x25')](_0x37abe4[_0x24f4('0x24')],function(_0x5e28b2){return{'model':db[_0x5e28b2[_0x24f4('0x26')]],'as':_0x5e28b2['as'],'attributes':_0x5e28b2[_0x24f4('0x23')]};}):[]};}):[]};}):[]:[]})[_0x24f4('0x12')](function(_0x50ed8a){logger[_0x24f4('0x13')]('ShowSquareProject',_0x22dd90);logger[_0x24f4('0x15')](_0x24f4('0x1d'),_0x22dd90,JSON[_0x24f4('0x17')](_0x50ed8a));_0x3ac15d(_0x50ed8a);})[_0x24f4('0x27')](function(_0x1d1809){logger[_0x24f4('0x18')]('ShowSquareProject',_0x1d1809[_0x24f4('0x1b')],_0x22dd90);_0x144cd2(_0x164191['error'](0x1f4,_0x1d1809[_0x24f4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a657648..50b8f34 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 _0x430c=['register','length','squareProject:','./squareProject.events','update','removeListener'];(function(_0x41e708,_0x2817d5){var _0xc004d0=function(_0x52753f){while(--_0x52753f){_0x41e708['push'](_0x41e708['shift']());}};_0xc004d0(++_0x2817d5);}(_0x430c,0x1a1));var _0xc430=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x430c[_0x5a7e78];return _0xa8d4a1;};'use strict';var SquareProjectEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){SquareProjectEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);SquareProjectEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file +var _0x4975=['length','./squareProject.events','remove','update','emit','removeListener','register'];(function(_0x55a34c,_0x583d4d){var _0x3c0197=function(_0x4809e4){while(--_0x4809e4){_0x55a34c['push'](_0x55a34c['shift']());}};_0x3c0197(++_0x583d4d);}(_0x4975,0x86));var _0x5497=function(_0x15ca7c,_0x58e5a4){_0x15ca7c=_0x15ca7c-0x0;var _0x5bae0d=_0x4975[_0x15ca7c];return _0x5bae0d;};'use strict';var SquareProjectEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){SquareProjectEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('squareProject:'+_0x674a2a,_0x539a27);SquareProjectEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 5bc9778..c558224 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 _0x802b=['create','put','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','download','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x802b,0x103));var _0xb802=function(_0x53ffbf,_0x1e36a5){_0x53ffbf=_0x53ffbf-0x0;var _0x5014cc=_0x802b[_0x53ffbf];return _0x5014cc;};'use strict';var multer=require('multer');var util=require(_0xb802('0x0'));var path=require('path');var timeout=require(_0xb802('0x1'));var express=require(_0xb802('0x2'));var router=express[_0xb802('0x3')]();var auth=require(_0xb802('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb802('0x5'));router[_0xb802('0x6')]('/',auth[_0xb802('0x7')](),controller[_0xb802('0x8')]);router[_0xb802('0x6')](_0xb802('0x9'),auth['isAuthenticated'](),controller[_0xb802('0xa')]);router[_0xb802('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0xb802('0xb')]);router[_0xb802('0xc')]('/',auth['isAuthenticated'](),controller[_0xb802('0xd')]);router[_0xb802('0xe')](_0xb802('0x9'),auth[_0xb802('0x7')](),controller['update']);router['delete']('/:id/delete',auth[_0xb802('0x7')](),controller[_0xb802('0xf')]);module[_0xb802('0x10')]=router; \ No newline at end of file +var _0x1b34=['isAuthenticated','index','/:id','show','download','post','create','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x136141,_0x1159ae){var _0x592a3f=function(_0x506bff){while(--_0x506bff){_0x136141['push'](_0x136141['shift']());}};_0x592a3f(++_0x1159ae);}(_0x1b34,0x115));var _0x41b3=function(_0x5c9f8a,_0x686e78){_0x5c9f8a=_0x5c9f8a-0x0;var _0x10fe70=_0x1b34[_0x5c9f8a];return _0x10fe70;};'use strict';var multer=require(_0x41b3('0x0'));var util=require(_0x41b3('0x1'));var path=require(_0x41b3('0x2'));var timeout=require(_0x41b3('0x3'));var express=require(_0x41b3('0x4'));var router=express[_0x41b3('0x5')]();var auth=require(_0x41b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x41b3('0x7'));var controller=require('./squareRecording.controller');router[_0x41b3('0x8')]('/',auth[_0x41b3('0x9')](),controller[_0x41b3('0xa')]);router[_0x41b3('0x8')](_0x41b3('0xb'),auth[_0x41b3('0x9')](),controller[_0x41b3('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x41b3('0xd')]);router[_0x41b3('0xe')]('/',auth[_0x41b3('0x9')](),controller[_0x41b3('0xf')]);router[_0x41b3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x41b3('0x11')]);router[_0x41b3('0x12')](_0x41b3('0x13'),auth[_0x41b3('0x9')](),controller[_0x41b3('0x14')]);module[_0x41b3('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 26921c1..57d6cb7 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 _0x7079=['VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','STRING'];(function(_0x2e62ef,_0x2550eb){var _0x52616a=function(_0x256d4e){while(--_0x256d4e){_0x2e62ef['push'](_0x2e62ef['shift']());}};_0x52616a(++_0x2550eb);}(_0x7079,0x14e));var _0x9707=function(_0x30b585,_0x116588){_0x30b585=_0x30b585-0x0;var _0x2af1b4=_0x7079[_0x30b585];return _0x2af1b4;};'use strict';var Sequelize=require(_0x9707('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9707('0x1')]},'callerid':{'type':Sequelize[_0x9707('0x1')]},'calleridname':{'type':Sequelize[_0x9707('0x1')]},'context':{'type':Sequelize[_0x9707('0x1')]},'extension':{'type':Sequelize[_0x9707('0x1')]},'priority':{'type':Sequelize[_0x9707('0x1')]},'accountcode':{'type':Sequelize[_0x9707('0x1')]},'dnid':{'type':Sequelize[_0x9707('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x9707('0x1')]},'filename':{'type':Sequelize[_0x9707('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9707('0x2')],'get':function(){var _0x4ac88c='';var _0x557ed9=this[_0x9707('0x3')]('savePath');if(_0x557ed9){_0x4ac88c=_0x557ed9[_0x9707('0x4')](_0x557ed9[_0x9707('0x5')]('.'));}return _0x4ac88c;}}}; \ No newline at end of file +var _0x53ea=['exports','STRING','substring','lastIndexOf','sequelize'];(function(_0x4013b1,_0x4af798){var _0x2ef59a=function(_0x8f27b7){while(--_0x8f27b7){_0x4013b1['push'](_0x4013b1['shift']());}};_0x2ef59a(++_0x4af798);}(_0x53ea,0x16c));var _0xa53e=function(_0x619e0c,_0x33c554){_0x619e0c=_0x619e0c-0x0;var _0x4d665f=_0x53ea[_0x619e0c];return _0x4d665f;};'use strict';var Sequelize=require(_0xa53e('0x0'));module[_0xa53e('0x1')]={'uniqueid':{'type':Sequelize[_0xa53e('0x2')]},'callerid':{'type':Sequelize[_0xa53e('0x2')]},'calleridname':{'type':Sequelize[_0xa53e('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa53e('0x2')]},'priority':{'type':Sequelize[_0xa53e('0x2')]},'accountcode':{'type':Sequelize[_0xa53e('0x2')]},'dnid':{'type':Sequelize[_0xa53e('0x2')]},'projectName':{'type':Sequelize[_0xa53e('0x2')]},'saveName':{'type':Sequelize[_0xa53e('0x2')]},'filename':{'type':Sequelize[_0xa53e('0x2')]},'savePath':{'type':Sequelize[_0xa53e('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x2aed49='';var _0x5d8aa4=this['getDataValue']('savePath');if(_0x5d8aa4){_0x2aed49=_0x5d8aa4[_0xa53e('0x3')](_0x5d8aa4[_0xa53e('0x4')]('.'));}return _0x2aed49;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9828524..31b8532 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 _0x7c73=['request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','SquareRecording','rawAttributes','options','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','unlink','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4cf6d2,_0x22e6d3){var _0x4146b4=function(_0x4f1d7c){while(--_0x4f1d7c){_0x4cf6d2['push'](_0x4cf6d2['shift']());}};_0x4146b4(++_0x22e6d3);}(_0x7c73,0xbf));var _0x37c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c73[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x37c7('0x0'));var emlformat=require(_0x37c7('0x1'));var rimraf=require(_0x37c7('0x2'));var zipdir=require(_0x37c7('0x3'));var jsonpatch=require(_0x37c7('0x4'));var rp=require(_0x37c7('0x5'));var moment=require('moment');var BPromise=require(_0x37c7('0x6'));var Mustache=require(_0x37c7('0x7'));var util=require(_0x37c7('0x8'));var path=require(_0x37c7('0x9'));var sox=require(_0x37c7('0xa'));var csv=require('to-csv');var ejs=require(_0x37c7('0xb'));var fs=require('fs');var _=require(_0x37c7('0xc'));var squel=require(_0x37c7('0xd'));var crypto=require(_0x37c7('0xe'));var jsforce=require(_0x37c7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x37c7('0x10'));var Redis=require('ioredis');var authService=require(_0x37c7('0x11'));var qs=require(_0x37c7('0x12'));var as=require(_0x37c7('0x13'));var hardwareService=require(_0x37c7('0x14'));var logger=require(_0x37c7('0x15'))(_0x37c7('0x16'));var utils=require('../../config/utils');var config=require(_0x37c7('0x17'));var licenseUtil=require(_0x37c7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f3f9,_0x2de7c1){_0x2de7c1=_0x2de7c1||0xcc;return function(_0x5a7450){if(_0x5a7450){return _0x43f3f9[_0x37c7('0x19')](_0x2de7c1);}return _0x43f3f9[_0x37c7('0x1a')](_0x2de7c1)[_0x37c7('0x1b')]();};}function respondWithResult(_0x5d2572,_0x41ee4e){_0x41ee4e=_0x41ee4e||0xc8;return function(_0x3d3c3f){if(_0x3d3c3f){return _0x5d2572[_0x37c7('0x1a')](_0x41ee4e)[_0x37c7('0x1c')](_0x3d3c3f);}};}function respondWithFilteredResult(_0x203aee,_0xce27c){return function(_0x3ed5bf){if(_0x3ed5bf){var _0x5408c2=_0x3ed5bf[_0x37c7('0x1d')],_0x4070e7=_0xce27c[_0x37c7('0x1e')],_0xd71cd5=_0xce27c[_0x37c7('0x1e')]+_0xce27c[_0x37c7('0x1f')],_0x45df1f;if(_0xd71cd5>=_0x5408c2){_0xd71cd5=_0x5408c2;_0x45df1f=0xc8;}else{_0x45df1f=0xce;}_0x203aee[_0x37c7('0x1a')](_0x45df1f);return _0x203aee[_0x37c7('0x20')](_0x37c7('0x21'),_0x4070e7+'-'+_0xd71cd5+'/'+_0x5408c2)[_0x37c7('0x1c')](_0x3ed5bf);}return null;};}function patchUpdates(_0x3be6eb){return function(_0x1d98a4){try{jsonpatch[_0x37c7('0x22')](_0x1d98a4,_0x3be6eb,!![]);}catch(_0x232f71){return BPromise[_0x37c7('0x23')](_0x232f71);}return _0x1d98a4[_0x37c7('0x24')]();};}function saveUpdates(_0x27f691,_0x5e271d){return function(_0x3f804e){if(_0x3f804e){return _0x3f804e[_0x37c7('0x25')](_0x27f691)[_0x37c7('0x26')](function(_0x1cb66e){return _0x1cb66e;});}return null;};}function removeEntity(_0x506e86,_0xb83f84){return function(_0x2aa629){if(_0x2aa629){return _0x2aa629[_0x37c7('0x27')]()['then'](function(){_0x506e86[_0x37c7('0x1a')](0xcc)[_0x37c7('0x1b')]();});}};}function handleEntityNotFound(_0x4d50a0,_0x56d410){return function(_0x391c23){if(!_0x391c23){_0x4d50a0[_0x37c7('0x19')](0x194);}return _0x391c23;};}function handleError(_0x550371,_0x3f2e50){_0x3f2e50=_0x3f2e50||0x1f4;return function(_0x5d5991){logger['error'](_0x5d5991['stack']);if(_0x5d5991[_0x37c7('0x28')]){delete _0x5d5991[_0x37c7('0x28')];}_0x550371[_0x37c7('0x1a')](_0x3f2e50)[_0x37c7('0x29')](_0x5d5991);};}exports[_0x37c7('0x2a')]=function(_0x3e9cfc,_0x1b9d30){var _0x20416d={},_0x2ada21={},_0x2c9cf1={'count':0x0,'rows':[]};var _0x508fdd=_[_0x37c7('0x2b')](db['SquareRecording']['rawAttributes'],function(_0x3f6659){return{'name':_0x3f6659['fieldName'],'type':_0x3f6659[_0x37c7('0x2c')]['key']};});_0x2ada21['model']=_['map'](_0x508fdd,_0x37c7('0x28'));_0x2ada21[_0x37c7('0x2d')]=_[_0x37c7('0x2e')](_0x3e9cfc[_0x37c7('0x2d')]);_0x2ada21[_0x37c7('0x2f')]=_[_0x37c7('0x30')](_0x2ada21[_0x37c7('0x31')],_0x2ada21[_0x37c7('0x2d')]);_0x20416d[_0x37c7('0x32')]=_[_0x37c7('0x30')](_0x2ada21[_0x37c7('0x31')],qs[_0x37c7('0x33')](_0x3e9cfc[_0x37c7('0x2d')][_0x37c7('0x33')]));_0x20416d[_0x37c7('0x32')]=_0x20416d[_0x37c7('0x32')][_0x37c7('0x34')]?_0x20416d[_0x37c7('0x32')]:_0x2ada21['model'];if(!_0x3e9cfc[_0x37c7('0x2d')][_0x37c7('0x35')](_0x37c7('0x36'))){_0x20416d['limit']=qs[_0x37c7('0x1f')](_0x3e9cfc[_0x37c7('0x2d')]['limit']);_0x20416d[_0x37c7('0x1e')]=qs[_0x37c7('0x1e')](_0x3e9cfc['query'][_0x37c7('0x1e')]);}_0x20416d[_0x37c7('0x37')]=qs[_0x37c7('0x38')](_0x3e9cfc[_0x37c7('0x2d')][_0x37c7('0x38')]);_0x20416d[_0x37c7('0x39')]=qs[_0x37c7('0x2f')](_[_0x37c7('0x3a')](_0x3e9cfc[_0x37c7('0x2d')],_0x2ada21[_0x37c7('0x2f')]),_0x508fdd);if(_0x3e9cfc['query'][_0x37c7('0x3b')]){_0x20416d[_0x37c7('0x39')]=_[_0x37c7('0x3c')](_0x20416d[_0x37c7('0x39')],{'$or':_[_0x37c7('0x2b')](_0x508fdd,function(_0x3e569b){if(_0x3e569b['type']!==_0x37c7('0x3d')){var _0x51e861={};_0x51e861[_0x3e569b[_0x37c7('0x28')]]={'$like':'%'+_0x3e9cfc['query'][_0x37c7('0x3b')]+'%'};return _0x51e861;}})});}_0x20416d=_[_0x37c7('0x3c')]({},_0x20416d,_0x3e9cfc['options']);var _0x30155c={'where':_0x20416d['where']};return db['SquareRecording']['count'](_0x30155c)[_0x37c7('0x26')](function(_0xc25f21){_0x2c9cf1['count']=_0xc25f21;if(_0x3e9cfc[_0x37c7('0x2d')][_0x37c7('0x3e')]){_0x20416d[_0x37c7('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x37c7('0x40')](_0x20416d);})[_0x37c7('0x26')](function(_0x531cce){_0x2c9cf1[_0x37c7('0x41')]=_0x531cce;return _0x2c9cf1;})[_0x37c7('0x26')](respondWithFilteredResult(_0x1b9d30,_0x20416d))[_0x37c7('0x42')](handleError(_0x1b9d30,null));};exports[_0x37c7('0x43')]=function(_0x2188f3,_0x39684c){var _0x4959b7={'raw':!![],'where':{'id':_0x2188f3[_0x37c7('0x44')]['id']}},_0x27e3d5={};_0x27e3d5[_0x37c7('0x31')]=_['keys'](db[_0x37c7('0x45')][_0x37c7('0x46')]);_0x27e3d5[_0x37c7('0x2d')]=_[_0x37c7('0x2e')](_0x2188f3[_0x37c7('0x2d')]);_0x27e3d5[_0x37c7('0x2f')]=_[_0x37c7('0x30')](_0x27e3d5[_0x37c7('0x31')],_0x27e3d5['query']);_0x4959b7[_0x37c7('0x32')]=_[_0x37c7('0x30')](_0x27e3d5['model'],qs[_0x37c7('0x33')](_0x2188f3['query'][_0x37c7('0x33')]));_0x4959b7['attributes']=_0x4959b7[_0x37c7('0x32')][_0x37c7('0x34')]?_0x4959b7[_0x37c7('0x32')]:_0x27e3d5['model'];if(_0x2188f3['query'][_0x37c7('0x3e')]){_0x4959b7[_0x37c7('0x3f')]=[{'all':!![]}];}_0x4959b7=_[_0x37c7('0x3c')]({},_0x4959b7,_0x2188f3[_0x37c7('0x47')]);return db[_0x37c7('0x45')][_0x37c7('0x48')](_0x4959b7)['then'](handleEntityNotFound(_0x39684c,null))[_0x37c7('0x26')](respondWithResult(_0x39684c,null))['catch'](handleError(_0x39684c,null));};exports[_0x37c7('0x49')]=function(_0x159e1c,_0x2fd2ad){return db['SquareRecording'][_0x37c7('0x49')](_0x159e1c[_0x37c7('0x4a')],{})[_0x37c7('0x26')](respondWithResult(_0x2fd2ad,0xc9))[_0x37c7('0x42')](handleError(_0x2fd2ad,null));};exports[_0x37c7('0x25')]=function(_0x12e942,_0x19d5cd){if(_0x12e942['body']['id']){delete _0x12e942[_0x37c7('0x4a')]['id'];}return db['SquareRecording'][_0x37c7('0x48')]({'where':{'id':_0x12e942[_0x37c7('0x44')]['id']}})[_0x37c7('0x26')](handleEntityNotFound(_0x19d5cd,null))[_0x37c7('0x26')](saveUpdates(_0x12e942['body'],null))[_0x37c7('0x26')](respondWithResult(_0x19d5cd,null))[_0x37c7('0x42')](handleError(_0x19d5cd,null));};exports[_0x37c7('0x4b')]=function(_0x3e7aab,_0x297fb7,_0xb7d506){var _0x5a3f8b=require(_0x37c7('0x4c'));var _0x373f03=![];var _0x1a0555={};if(_0x3e7aab[_0x37c7('0x2d')][_0x37c7('0x2c')]&&_0x3e7aab[_0x37c7('0x2d')][_0x37c7('0x2c')]==='uniqueid'){_0x1a0555[_0x37c7('0x4d')]=_0x3e7aab[_0x37c7('0x44')]['id'];}else{_0x1a0555['id']=_0x3e7aab[_0x37c7('0x44')]['id'];}return db[_0x37c7('0x45')][_0x37c7('0x48')]({'where':_0x1a0555,'attributes':['id','savePath',_0x37c7('0x4e')],'raw':!![]})[_0x37c7('0x26')](handleEntityNotFound(_0x297fb7,null))['then'](function(_0x331daa){if(_0x331daa){var _0xbcab69=_0x331daa[_0x37c7('0x4f')];var _0x50a34e=util[_0x37c7('0x50')](_0x37c7('0x51'),_0xbcab69);if(fs[_0x37c7('0x52')](_0x50a34e)){_0x373f03=!![];return _0x5a3f8b[_0x37c7('0x53')](_0x50a34e,_0xbcab69,config['secrets'][_0x37c7('0x54')])[_0x37c7('0x26')](function(){return _0x331daa;});}return _0x331daa;}})[_0x37c7('0x26')](function(_0x10e718){if(_0x10e718){var _0xad04b6=_0x10e718['savePath'];if(!fs[_0x37c7('0x52')](_0xad04b6)){throw new db[(_0x37c7('0x55'))][(_0x37c7('0x56'))]('SquareRecording\x20not\x20found');}if(_0x10e718[_0x37c7('0x4e')]){return _0x297fb7[_0x37c7('0x4b')](_0xad04b6,_0x10e718[_0x37c7('0x4e')]+path['extname'](_0xad04b6),function(){if(_0x373f03){fs[_0x37c7('0x57')](_0xad04b6);}});}else{return _0x297fb7[_0x37c7('0x4b')](_0xad04b6,function(_0xeb6ed2){if(_0x373f03){fs['unlink'](_0xad04b6);}});}}})[_0x37c7('0x42')](function(_0x314286){if(_0x314286['message']===_0x37c7('0x58')){_0x297fb7[_0x37c7('0x1a')](0x194)[_0x37c7('0x29')](_0x37c7('0x59'));}else{return handleError(_0x297fb7,null);}});};exports[_0x37c7('0x27')]=function(_0x54cc4e,_0x3baedf){return db[_0x37c7('0x45')][_0x37c7('0x48')]({'where':{'id':_0x54cc4e[_0x37c7('0x44')]['id']}})['then'](function(_0x5c8eed){if(!_0x5c8eed)throw new ReferenceError(_0x37c7('0x5a'));return _0x5c8eed;})[_0x37c7('0x26')](function(_0x2c4775){var _0x4b907c=_0x2c4775[_0x37c7('0x4f')];logger[_0x37c7('0x5b')](_0x37c7('0x5c'),_0x4b907c);if(!_[_0x37c7('0x5d')](_0x2c4775[_0x37c7('0x4f')])&&fs['existsSync'](_0x4b907c)){logger['info']('File:\x20\x22'+_0x4b907c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x37c7('0x5e')](_0x4b907c);}_0x4b907c=_0x4b907c+_0x37c7('0x5f');if(!_['isNil'](_0x2c4775[_0x37c7('0x4f')])&&fs[_0x37c7('0x52')](_0x4b907c)){logger[_0x37c7('0x5b')](_0x37c7('0x60')+_0x4b907c+_0x37c7('0x61'));fs['unlinkSync'](_0x4b907c);}return _0x2c4775;})[_0x37c7('0x26')](function(_0x3f147e){if(!_0x3f147e)throw new InternalError();return _0x3f147e[_0x37c7('0x27')]();})[_0x37c7('0x26')](function(){_0x3baedf[_0x37c7('0x1a')](0xcc)[_0x37c7('0x1b')]();})['catch'](handleError(_0x3baedf,null));}; \ No newline at end of file +var _0xdfaa=['apply','reject','save','then','destroy','error','name','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','download','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x16ae43,_0xb74df3){var _0x5978c7=function(_0x3c952d){while(--_0x3c952d){_0x16ae43['push'](_0x16ae43['shift']());}};_0x5978c7(++_0xb74df3);}(_0xdfaa,0xa5));var _0xadfa=function(_0x3f4e1d,_0x2580fa){_0x3f4e1d=_0x3f4e1d-0x0;var _0x32a327=_0xdfaa[_0x3f4e1d];return _0x32a327;};'use strict';var pdf=require(_0xadfa('0x0'));var emlformat=require(_0xadfa('0x1'));var rimraf=require(_0xadfa('0x2'));var zipdir=require(_0xadfa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadfa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xadfa('0x5'));var path=require('path');var sox=require(_0xadfa('0x6'));var csv=require(_0xadfa('0x7'));var ejs=require(_0xadfa('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xadfa('0x9'));var crypto=require(_0xadfa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xadfa('0xb'));var toCsv=require(_0xadfa('0x7'));var querystring=require(_0xadfa('0xc'));var Papa=require(_0xadfa('0xd'));var Redis=require(_0xadfa('0xe'));var authService=require(_0xadfa('0xf'));var qs=require(_0xadfa('0x10'));var as=require(_0xadfa('0x11'));var hardwareService=require(_0xadfa('0x12'));var logger=require(_0xadfa('0x13'))(_0xadfa('0x14'));var utils=require('../../config/utils');var config=require(_0xadfa('0x15'));var licenseUtil=require(_0xadfa('0x16'));var db=require(_0xadfa('0x17'))['db'];function respondWithStatusCode(_0x2f6fe6,_0x4ebb41){_0x4ebb41=_0x4ebb41||0xcc;return function(_0x4daadc){if(_0x4daadc){return _0x2f6fe6[_0xadfa('0x18')](_0x4ebb41);}return _0x2f6fe6[_0xadfa('0x19')](_0x4ebb41)[_0xadfa('0x1a')]();};}function respondWithResult(_0x37c526,_0x5274c1){_0x5274c1=_0x5274c1||0xc8;return function(_0x2ef7fe){if(_0x2ef7fe){return _0x37c526[_0xadfa('0x19')](_0x5274c1)[_0xadfa('0x1b')](_0x2ef7fe);}};}function respondWithFilteredResult(_0x2825a1,_0x31d375){return function(_0x4a932b){if(_0x4a932b){var _0x71cef6=_0x4a932b[_0xadfa('0x1c')],_0x2e4d03=_0x31d375['offset'],_0x330d4f=_0x31d375[_0xadfa('0x1d')]+_0x31d375[_0xadfa('0x1e')],_0x4188c9;if(_0x330d4f>=_0x71cef6){_0x330d4f=_0x71cef6;_0x4188c9=0xc8;}else{_0x4188c9=0xce;}_0x2825a1['status'](_0x4188c9);return _0x2825a1['set']('Content-Range',_0x2e4d03+'-'+_0x330d4f+'/'+_0x71cef6)['json'](_0x4a932b);}return null;};}function patchUpdates(_0x4a32a3){return function(_0x3aeb91){try{jsonpatch[_0xadfa('0x1f')](_0x3aeb91,_0x4a32a3,!![]);}catch(_0x5b3c8d){return BPromise[_0xadfa('0x20')](_0x5b3c8d);}return _0x3aeb91[_0xadfa('0x21')]();};}function saveUpdates(_0x261ac5,_0x2a5a36){return function(_0x4f15f0){if(_0x4f15f0){return _0x4f15f0['update'](_0x261ac5)[_0xadfa('0x22')](function(_0x7e094b){return _0x7e094b;});}return null;};}function removeEntity(_0x35cc73,_0xf4e2e6){return function(_0x402281){if(_0x402281){return _0x402281[_0xadfa('0x23')]()[_0xadfa('0x22')](function(){_0x35cc73[_0xadfa('0x19')](0xcc)[_0xadfa('0x1a')]();});}};}function handleEntityNotFound(_0xd887,_0xe63eb0){return function(_0x485aec){if(!_0x485aec){_0xd887['sendStatus'](0x194);}return _0x485aec;};}function handleError(_0x325035,_0xbb5677){_0xbb5677=_0xbb5677||0x1f4;return function(_0x460dd6){logger[_0xadfa('0x24')](_0x460dd6['stack']);if(_0x460dd6[_0xadfa('0x25')]){delete _0x460dd6[_0xadfa('0x25')];}_0x325035[_0xadfa('0x19')](_0xbb5677)['send'](_0x460dd6);};}exports[_0xadfa('0x26')]=function(_0x1f5643,_0x575ea0){var _0x753aa2={},_0x4e283f={},_0x32cf64={'count':0x0,'rows':[]};var _0xc23b38=_[_0xadfa('0x27')](db[_0xadfa('0x28')][_0xadfa('0x29')],function(_0x365909){return{'name':_0x365909['fieldName'],'type':_0x365909[_0xadfa('0x2a')][_0xadfa('0x2b')]};});_0x4e283f[_0xadfa('0x2c')]=_[_0xadfa('0x27')](_0xc23b38,_0xadfa('0x25'));_0x4e283f[_0xadfa('0x2d')]=_[_0xadfa('0x2e')](_0x1f5643[_0xadfa('0x2d')]);_0x4e283f[_0xadfa('0x2f')]=_[_0xadfa('0x30')](_0x4e283f['model'],_0x4e283f[_0xadfa('0x2d')]);_0x753aa2[_0xadfa('0x31')]=_['intersection'](_0x4e283f[_0xadfa('0x2c')],qs[_0xadfa('0x32')](_0x1f5643[_0xadfa('0x2d')]['fields']));_0x753aa2[_0xadfa('0x31')]=_0x753aa2[_0xadfa('0x31')][_0xadfa('0x33')]?_0x753aa2[_0xadfa('0x31')]:_0x4e283f[_0xadfa('0x2c')];if(!_0x1f5643['query'][_0xadfa('0x34')](_0xadfa('0x35'))){_0x753aa2[_0xadfa('0x1e')]=qs[_0xadfa('0x1e')](_0x1f5643['query'][_0xadfa('0x1e')]);_0x753aa2[_0xadfa('0x1d')]=qs[_0xadfa('0x1d')](_0x1f5643['query'][_0xadfa('0x1d')]);}_0x753aa2[_0xadfa('0x36')]=qs[_0xadfa('0x37')](_0x1f5643[_0xadfa('0x2d')]['sort']);_0x753aa2['where']=qs['filters'](_['pick'](_0x1f5643[_0xadfa('0x2d')],_0x4e283f[_0xadfa('0x2f')]),_0xc23b38);if(_0x1f5643['query'][_0xadfa('0x38')]){_0x753aa2['where']=_[_0xadfa('0x39')](_0x753aa2[_0xadfa('0x3a')],{'$or':_[_0xadfa('0x27')](_0xc23b38,function(_0x5bd8c2){if(_0x5bd8c2[_0xadfa('0x2a')]!==_0xadfa('0x3b')){var _0x34fed2={};_0x34fed2[_0x5bd8c2[_0xadfa('0x25')]]={'$like':'%'+_0x1f5643[_0xadfa('0x2d')][_0xadfa('0x38')]+'%'};return _0x34fed2;}})});}_0x753aa2=_[_0xadfa('0x39')]({},_0x753aa2,_0x1f5643['options']);var _0x371e0b={'where':_0x753aa2[_0xadfa('0x3a')]};return db[_0xadfa('0x28')][_0xadfa('0x1c')](_0x371e0b)[_0xadfa('0x22')](function(_0x137f9c){_0x32cf64[_0xadfa('0x1c')]=_0x137f9c;if(_0x1f5643[_0xadfa('0x2d')][_0xadfa('0x3c')]){_0x753aa2[_0xadfa('0x3d')]=[{'all':!![]}];}return db[_0xadfa('0x28')][_0xadfa('0x3e')](_0x753aa2);})['then'](function(_0x380bc9){_0x32cf64[_0xadfa('0x3f')]=_0x380bc9;return _0x32cf64;})[_0xadfa('0x22')](respondWithFilteredResult(_0x575ea0,_0x753aa2))[_0xadfa('0x40')](handleError(_0x575ea0,null));};exports[_0xadfa('0x41')]=function(_0x4c9a38,_0x1fbb1b){var _0x2171f9={'raw':!![],'where':{'id':_0x4c9a38[_0xadfa('0x42')]['id']}},_0x3a7947={};_0x3a7947['model']=_[_0xadfa('0x2e')](db[_0xadfa('0x28')][_0xadfa('0x29')]);_0x3a7947[_0xadfa('0x2d')]=_[_0xadfa('0x2e')](_0x4c9a38[_0xadfa('0x2d')]);_0x3a7947[_0xadfa('0x2f')]=_['intersection'](_0x3a7947[_0xadfa('0x2c')],_0x3a7947[_0xadfa('0x2d')]);_0x2171f9[_0xadfa('0x31')]=_[_0xadfa('0x30')](_0x3a7947[_0xadfa('0x2c')],qs[_0xadfa('0x32')](_0x4c9a38[_0xadfa('0x2d')][_0xadfa('0x32')]));_0x2171f9['attributes']=_0x2171f9[_0xadfa('0x31')][_0xadfa('0x33')]?_0x2171f9[_0xadfa('0x31')]:_0x3a7947['model'];if(_0x4c9a38[_0xadfa('0x2d')][_0xadfa('0x3c')]){_0x2171f9[_0xadfa('0x3d')]=[{'all':!![]}];}_0x2171f9=_[_0xadfa('0x39')]({},_0x2171f9,_0x4c9a38[_0xadfa('0x43')]);return db[_0xadfa('0x28')][_0xadfa('0x44')](_0x2171f9)[_0xadfa('0x22')](handleEntityNotFound(_0x1fbb1b,null))['then'](respondWithResult(_0x1fbb1b,null))[_0xadfa('0x40')](handleError(_0x1fbb1b,null));};exports[_0xadfa('0x45')]=function(_0x340e08,_0x56cd8d){return db['SquareRecording'][_0xadfa('0x45')](_0x340e08[_0xadfa('0x46')],{})[_0xadfa('0x22')](respondWithResult(_0x56cd8d,0xc9))[_0xadfa('0x40')](handleError(_0x56cd8d,null));};exports[_0xadfa('0x47')]=function(_0x4904a6,_0x3d0471){if(_0x4904a6['body']['id']){delete _0x4904a6['body']['id'];}return db[_0xadfa('0x28')][_0xadfa('0x44')]({'where':{'id':_0x4904a6[_0xadfa('0x42')]['id']}})[_0xadfa('0x22')](handleEntityNotFound(_0x3d0471,null))[_0xadfa('0x22')](saveUpdates(_0x4904a6[_0xadfa('0x46')],null))[_0xadfa('0x22')](respondWithResult(_0x3d0471,null))[_0xadfa('0x40')](handleError(_0x3d0471,null));};exports[_0xadfa('0x48')]=function(_0x5da6b2,_0x273832,_0x3fa51d){var _0xa76366=require('../../components/encryptor');var _0x3e199e=![];var _0x305dfe={};if(_0x5da6b2[_0xadfa('0x2d')][_0xadfa('0x2a')]&&_0x5da6b2['query'][_0xadfa('0x2a')]===_0xadfa('0x49')){_0x305dfe[_0xadfa('0x49')]=_0x5da6b2[_0xadfa('0x42')]['id'];}else{_0x305dfe['id']=_0x5da6b2[_0xadfa('0x42')]['id'];}return db['SquareRecording'][_0xadfa('0x44')]({'where':_0x305dfe,'attributes':['id',_0xadfa('0x4a'),_0xadfa('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x273832,null))[_0xadfa('0x22')](function(_0x32d0df){if(_0x32d0df){var _0x33c43d=_0x32d0df['savePath'];var _0x2215bc=util[_0xadfa('0x4c')](_0xadfa('0x4d'),_0x33c43d);if(fs['existsSync'](_0x2215bc)){_0x3e199e=!![];return _0xa76366[_0xadfa('0x4e')](_0x2215bc,_0x33c43d,config[_0xadfa('0x4f')][_0xadfa('0x50')])['then'](function(){return _0x32d0df;});}return _0x32d0df;}})[_0xadfa('0x22')](function(_0x52b08b){if(_0x52b08b){var _0x46aad4=_0x52b08b[_0xadfa('0x4a')];if(!fs['existsSync'](_0x46aad4)){throw new db[(_0xadfa('0x51'))][(_0xadfa('0x52'))](_0xadfa('0x53'));}if(_0x52b08b[_0xadfa('0x4b')]){return _0x273832[_0xadfa('0x48')](_0x46aad4,_0x52b08b[_0xadfa('0x4b')]+path[_0xadfa('0x54')](_0x46aad4),function(){if(_0x3e199e){fs[_0xadfa('0x55')](_0x46aad4);}});}else{return _0x273832[_0xadfa('0x48')](_0x46aad4,function(_0x2bcf94){if(_0x3e199e){fs['unlink'](_0x46aad4);}});}}})[_0xadfa('0x40')](function(_0x4cc8c7){if(_0x4cc8c7[_0xadfa('0x56')]==='SquareRecording\x20not\x20found'){_0x273832[_0xadfa('0x19')](0x194)[_0xadfa('0x57')](_0xadfa('0x58'));}else{return handleError(_0x273832,null);}});};exports['destroy']=function(_0x1e80fc,_0x156528){return db[_0xadfa('0x28')][_0xadfa('0x44')]({'where':{'id':_0x1e80fc['params']['id']}})[_0xadfa('0x22')](function(_0x3a631f){if(!_0x3a631f)throw new ReferenceError(_0xadfa('0x59'));return _0x3a631f;})['then'](function(_0x399f3a){var _0x327304=_0x399f3a[_0xadfa('0x4a')];logger[_0xadfa('0x5a')](_0xadfa('0x5b'),_0x327304);if(!_['isNil'](_0x399f3a['savePath'])&&fs[_0xadfa('0x5c')](_0x327304)){logger[_0xadfa('0x5a')](_0xadfa('0x5d')+_0x327304+_0xadfa('0x5e'));fs[_0xadfa('0x5f')](_0x327304);}_0x327304=_0x327304+_0xadfa('0x60');if(!_[_0xadfa('0x61')](_0x399f3a[_0xadfa('0x4a')])&&fs[_0xadfa('0x5c')](_0x327304)){logger['info']('File:\x20\x22'+_0x327304+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x327304);}return _0x399f3a;})['then'](function(_0x1c4675){if(!_0x1c4675)throw new InternalError();return _0x1c4675[_0xadfa('0x23')]();})['then'](function(){_0x156528[_0xadfa('0x19')](0xcc)[_0xadfa('0x1a')]();})[_0xadfa('0x40')](handleError(_0x156528,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ffe00a4..97c839c 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 _0x3870=['SquareRecording','square_recordings','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3870,0x146));var _0x0387=function(_0x180451,_0x3533f1){_0x180451=_0x180451-0x0;var _0x4c3a39=_0x3870[_0x180451];return _0x4c3a39;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var logger=require(_0x0387('0x2'))('api');var moment=require(_0x0387('0x3'));var BPromise=require('bluebird');var rp=require(_0x0387('0x4'));var fs=require('fs');var path=require(_0x0387('0x5'));var rimraf=require('rimraf');var config=require(_0x0387('0x6'));var attributes=require(_0x0387('0x7'));module[_0x0387('0x8')]=function(_0x59294e,_0x18976e){return _0x59294e[_0x0387('0x9')](_0x0387('0xa'),attributes,{'tableName':_0x0387('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c91=['util','api','moment','bluebird','path','../../config/environment','define','SquareRecording'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x2c91,0xe0));var _0x12c9=function(_0x211b32,_0x395a0c){_0x211b32=_0x211b32-0x0;var _0x4cd5a1=_0x2c91[_0x211b32];return _0x4cd5a1;};'use strict';var _=require('lodash');var util=require(_0x12c9('0x0'));var logger=require('../../config/logger')(_0x12c9('0x1'));var moment=require(_0x12c9('0x2'));var BPromise=require(_0x12c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12c9('0x4'));var rimraf=require('rimraf');var config=require(_0x12c9('0x5'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x57f5bb,_0x471299){return _0x57f5bb[_0x12c9('0x6')](_0x12c9('0x7'),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 77e1729..a63a9e2 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 _0xd55f=['rpc','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','lodash','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x255112,_0x4ea4f7){var _0x321da8=function(_0x2cf4e7){while(--_0x2cf4e7){_0x255112['push'](_0x255112['shift']());}};_0x321da8(++_0x4ea4f7);}(_0xd55f,0x91));var _0xfd55=function(_0x3123d0,_0x252655){_0x3123d0=_0x3123d0-0x0;var _0x57047c=_0xd55f[_0x3123d0];return _0x57047c;};'use strict';var _=require(_0xfd55('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfd55('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd55('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd55('0x3'));var logger=require(_0xfd55('0x4'))(_0xfd55('0x5'));var config=require('../../config/environment');var jayson=require(_0xfd55('0x6'));var client=jayson[_0xfd55('0x7')][_0xfd55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fd559,_0x478610,_0x5801fb){return new BPromise(function(_0x33070c,_0x574d42){return client['request'](_0x3fd559,_0x5801fb)[_0xfd55('0x9')](function(_0x501e9c){logger[_0xfd55('0xa')](_0xfd55('0xb'),_0x478610,_0xfd55('0xc'));logger[_0xfd55('0xd')](_0xfd55('0xe'),_0x478610,'request\x20sent',JSON[_0xfd55('0xf')](_0x501e9c));if(_0x501e9c['error']){if(_0x501e9c[_0xfd55('0x10')][_0xfd55('0x11')]===0x1f4){logger[_0xfd55('0x10')]('SquareRecording,\x20%s,\x20%s',_0x478610,_0x501e9c['error']['message']);return _0x574d42(_0x501e9c[_0xfd55('0x10')][_0xfd55('0x12')]);}logger[_0xfd55('0x10')](_0xfd55('0xb'),_0x478610,_0x501e9c['error']['message']);return _0x33070c(_0x501e9c[_0xfd55('0x10')]['message']);}else{logger[_0xfd55('0xa')](_0xfd55('0xb'),_0x478610,_0xfd55('0xc'));_0x33070c(_0x501e9c[_0xfd55('0x13')]['message']);}})[_0xfd55('0x14')](function(_0x338c5a){logger[_0xfd55('0x10')](_0xfd55('0xb'),_0x478610,_0x338c5a);_0x574d42(_0x338c5a);});});}exports[_0xfd55('0x15')]=function(_0x49d004){var _0x26df20=this;return new Promise(function(_0x38e81b,_0x46d624){return db[_0xfd55('0x16')]['create'](_0x49d004['body'],{'raw':_0x49d004[_0xfd55('0x17')]?_0x49d004[_0xfd55('0x17')][_0xfd55('0x18')]===undefined?!![]:![]:!![]})[_0xfd55('0x9')](function(_0x23ff20){logger['info']('CreateSquareRecording',_0x49d004);logger[_0xfd55('0xd')](_0xfd55('0x15'),_0x49d004,JSON['stringify'](_0x23ff20));_0x38e81b(_0x23ff20);})[_0xfd55('0x14')](function(_0xca67e8){logger[_0xfd55('0x10')]('CreateSquareRecording',_0xca67e8[_0xfd55('0x12')],_0x49d004);_0x46d624(_0x26df20[_0xfd55('0x10')](0x1f4,_0xca67e8[_0xfd55('0x12')]));});});}; \ No newline at end of file +var _0x6081=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','lodash','util'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x6081,0xee));var _0x1608=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6081[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1608('0x0'));var util=require(_0x1608('0x1'));var moment=require('moment');var BPromise=require(_0x1608('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1608('0x3'));var db=require(_0x1608('0x4'))['db'];var utils=require(_0x1608('0x5'));var logger=require(_0x1608('0x6'))(_0x1608('0x7'));var config=require(_0x1608('0x8'));var jayson=require(_0x1608('0x9'));var client=jayson[_0x1608('0xa')][_0x1608('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7133ca,_0x391b64,_0x38ecb5){return new BPromise(function(_0x561019,_0x112241){return client[_0x1608('0xc')](_0x7133ca,_0x38ecb5)[_0x1608('0xd')](function(_0x4353e4){logger[_0x1608('0xe')]('SquareRecording,\x20%s,\x20%s',_0x391b64,'request\x20sent');logger[_0x1608('0xf')](_0x1608('0x10'),_0x391b64,_0x1608('0x11'),JSON[_0x1608('0x12')](_0x4353e4));if(_0x4353e4[_0x1608('0x13')]){if(_0x4353e4[_0x1608('0x13')][_0x1608('0x14')]===0x1f4){logger[_0x1608('0x13')](_0x1608('0x15'),_0x391b64,_0x4353e4[_0x1608('0x13')]['message']);return _0x112241(_0x4353e4[_0x1608('0x13')][_0x1608('0x16')]);}logger['error'](_0x1608('0x15'),_0x391b64,_0x4353e4[_0x1608('0x13')][_0x1608('0x16')]);return _0x561019(_0x4353e4[_0x1608('0x13')]['message']);}else{logger[_0x1608('0xe')](_0x1608('0x15'),_0x391b64,_0x1608('0x11'));_0x561019(_0x4353e4[_0x1608('0x17')][_0x1608('0x16')]);}})[_0x1608('0x18')](function(_0x319b51){logger[_0x1608('0x13')](_0x1608('0x15'),_0x391b64,_0x319b51);_0x112241(_0x319b51);});});}exports[_0x1608('0x19')]=function(_0x246d83){var _0x411a3a=this;return new Promise(function(_0x42c47d,_0x27b4de){return db[_0x1608('0x1a')][_0x1608('0x1b')](_0x246d83[_0x1608('0x1c')],{'raw':_0x246d83[_0x1608('0x1d')]?_0x246d83[_0x1608('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3fda22){logger[_0x1608('0xe')](_0x1608('0x19'),_0x246d83);logger[_0x1608('0xf')]('CreateSquareRecording',_0x246d83,JSON[_0x1608('0x12')](_0x3fda22));_0x42c47d(_0x3fda22);})[_0x1608('0x18')](function(_0x8f32d6){logger['error'](_0x1608('0x19'),_0x8f32d6[_0x1608('0x16')],_0x246d83);_0x27b4de(_0x411a3a['error'](0x1f4,_0x8f32d6[_0x1608('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index edbbfec..a484ff0 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 _0xbb46=['describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x4cc7a6,_0x3160b7){var _0x1f1b33=function(_0x433498){while(--_0x433498){_0x4cc7a6['push'](_0x4cc7a6['shift']());}};_0x1f1b33(++_0x3160b7);}(_0xbb46,0x184));var _0x6bb4=function(_0x22342c,_0x218835){_0x22342c=_0x22342c-0x0;var _0xd3b434=_0xbb46[_0x22342c];return _0xd3b434;};'use strict';var multer=require(_0x6bb4('0x0'));var util=require(_0x6bb4('0x1'));var path=require(_0x6bb4('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bb4('0x3'));var router=express['Router']();var auth=require(_0x6bb4('0x4'));var interaction=require(_0x6bb4('0x5'));var config=require(_0x6bb4('0x6'));var controller=require('./squareReport.controller');router[_0x6bb4('0x7')]('/',auth[_0x6bb4('0x8')](),controller[_0x6bb4('0x9')]);router['get'](_0x6bb4('0xa'),auth[_0x6bb4('0x8')](),controller[_0x6bb4('0xb')]);router[_0x6bb4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6bb4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6bb4('0xd')](_0x6bb4('0xe'),auth[_0x6bb4('0x8')](),controller[_0x6bb4('0xf')]);router[_0x6bb4('0x10')]('/:id',auth[_0x6bb4('0x8')](),controller[_0x6bb4('0x11')]);module[_0x6bb4('0x12')]=router; \ No newline at end of file +var _0x2526=['update','delete','exports','multer','path','express','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x3caeb5,_0x219363){var _0x5eca7e=function(_0x4cae6b){while(--_0x4cae6b){_0x3caeb5['push'](_0x3caeb5['shift']());}};_0x5eca7e(++_0x219363);}(_0x2526,0x17a));var _0x6252=function(_0x12b913,_0x3095b4){_0x12b913=_0x12b913-0x0;var _0x43883c=_0x2526[_0x12b913];return _0x43883c;};'use strict';var multer=require(_0x6252('0x0'));var util=require('util');var path=require(_0x6252('0x1'));var timeout=require('connect-timeout');var express=require(_0x6252('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6252('0x3'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x6252('0x4')]('/',auth[_0x6252('0x5')](),controller[_0x6252('0x6')]);router[_0x6252('0x4')](_0x6252('0x7'),auth[_0x6252('0x5')](),controller['describe']);router[_0x6252('0x4')](_0x6252('0x8'),auth[_0x6252('0x5')](),controller[_0x6252('0x9')]);router[_0x6252('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6252('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6252('0xc')]);router[_0x6252('0xd')]('/:id',auth[_0x6252('0x5')](),controller['destroy']);module[_0x6252('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 6f2bc7f..15330ca 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 _0x9727=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x303d81,_0x34028c){var _0x77b7c7=function(_0x38d909){while(--_0x38d909){_0x303d81['push'](_0x303d81['shift']());}};_0x77b7c7(++_0x34028c);}(_0x9727,0xa5));var _0x7972=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0x9727[_0x5a1cc9];return _0x471761;};'use strict';var Sequelize=require(_0x7972('0x0'));module[_0x7972('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x7972('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7972('0x2')]},'language':{'type':Sequelize[_0x7972('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7972('0x2')]},'version':{'type':Sequelize[_0x7972('0x2')]},'callerid':{'type':Sequelize[_0x7972('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x7972('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x7972('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7972('0x2')]},'rdnis':{'type':Sequelize[_0x7972('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7972('0x2')]},'priority':{'type':Sequelize[_0x7972('0x2')]},'enhanced':{'type':Sequelize[_0x7972('0x2')]},'accountcode':{'type':Sequelize[_0x7972('0x2')]},'threadid':{'type':Sequelize[_0x7972('0x2')]},'project_name':{'type':Sequelize[_0x7972('0x2')]},'joinAt':{'type':Sequelize[_0x7972('0x3')]},'leaveAt':{'type':Sequelize[_0x7972('0x3')]},'bot':{'type':Sequelize[_0x7972('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a4a=['sequelize','exports','STRING','DATE'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x9a4a,0x9c));var _0xa9a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a4a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa9a4('0x0'));module[_0xa9a4('0x1')]={'network':{'type':Sequelize[_0xa9a4('0x2')]},'network_script':{'type':Sequelize[_0xa9a4('0x2')]},'request':{'type':Sequelize[_0xa9a4('0x2')]},'channel':{'type':Sequelize[_0xa9a4('0x2')]},'language':{'type':Sequelize[_0xa9a4('0x2')]},'type':{'type':Sequelize[_0xa9a4('0x2')]},'uniqueid':{'type':Sequelize[_0xa9a4('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9a4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa9a4('0x2')]},'callingani2':{'type':Sequelize[_0xa9a4('0x2')]},'callington':{'type':Sequelize[_0xa9a4('0x2')]},'callingtns':{'type':Sequelize[_0xa9a4('0x2')]},'dnid':{'type':Sequelize[_0xa9a4('0x2')]},'rdnis':{'type':Sequelize[_0xa9a4('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa9a4('0x2')]},'enhanced':{'type':Sequelize[_0xa9a4('0x2')]},'accountcode':{'type':Sequelize[_0xa9a4('0x2')]},'threadid':{'type':Sequelize[_0xa9a4('0x2')]},'project_name':{'type':Sequelize[_0xa9a4('0x2')]},'joinAt':{'type':Sequelize[_0xa9a4('0x3')]},'leaveAt':{'type':Sequelize[_0xa9a4('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f849b27..fb4d743 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 _0x524e=['query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','SquareReport','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map'];(function(_0xc83c9d,_0x45e407){var _0x548f66=function(_0xc79176){while(--_0xc79176){_0xc83c9d['push'](_0xc83c9d['shift']());}};_0x548f66(++_0x45e407);}(_0x524e,0x15e));var _0xe524=function(_0x405790,_0x41973a){_0x405790=_0x405790-0x0;var _0x237acd=_0x524e[_0x405790];return _0x237acd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1d')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1e')](_0x4b0f51)[_0xe524('0x1f')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x20')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=_0x569660['count'],_0x109795=_0x48165e['offset'],_0x538754=_0x48165e['offset']+_0x48165e[_0xe524('0x21')],_0x29a031;if(_0x538754>=_0x488fce){_0x538754=_0x488fce;_0x29a031=0xc8;}else{_0x29a031=0xce;}_0x1b0af6['status'](_0x29a031);return _0x1b0af6[_0xe524('0x22')](_0xe524('0x23'),_0x109795+'-'+_0x538754+'/'+_0x488fce)[_0xe524('0x20')](_0x569660);}return null;};}function patchUpdates(_0x209d0b){return function(_0x5d7b17){try{jsonpatch[_0xe524('0x24')](_0x5d7b17,_0x209d0b,!![]);}catch(_0x3ccb3f){return BPromise['reject'](_0x3ccb3f);}return _0x5d7b17[_0xe524('0x25')]();};}function saveUpdates(_0x309f85,_0x43a4f9){return function(_0x1dcc0f){if(_0x1dcc0f){return _0x1dcc0f[_0xe524('0x26')](_0x309f85)[_0xe524('0x27')](function(_0xbf059b){return _0xbf059b;});}return null;};}function removeEntity(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x28')]()['then'](function(){_0x375219['status'](0xcc)[_0xe524('0x1f')]();});}};}function handleEntityNotFound(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(!_0x85fc51){_0x23df5e['sendStatus'](0x194);}return _0x85fc51;};}function handleError(_0x158f07,_0x4a03bc){_0x4a03bc=_0x4a03bc||0x1f4;return function(_0x17e245){logger[_0xe524('0x29')](_0x17e245[_0xe524('0x2a')]);if(_0x17e245[_0xe524('0x2b')]){delete _0x17e245[_0xe524('0x2b')];}_0x158f07[_0xe524('0x1e')](_0x4a03bc)[_0xe524('0x2c')](_0x17e245);};}exports['index']=function(_0x58a896,_0x283f18){var _0x45abad={},_0x476572={},_0x109a96={'count':0x0,'rows':[]};var _0x359c8b=_['map'](db['SquareReport'][_0xe524('0x2d')],function(_0x25e7a7){return{'name':_0x25e7a7[_0xe524('0x2e')],'type':_0x25e7a7[_0xe524('0x2f')][_0xe524('0x30')]};});_0x476572['model']=_[_0xe524('0x31')](_0x359c8b,_0xe524('0x2b'));_0x476572['query']=_['keys'](_0x58a896[_0xe524('0x32')]);_0x476572[_0xe524('0x33')]=_['intersection'](_0x476572[_0xe524('0x34')],_0x476572['query']);_0x45abad[_0xe524('0x35')]=_['intersection'](_0x476572[_0xe524('0x34')],qs[_0xe524('0x36')](_0x58a896[_0xe524('0x32')]['fields']));_0x45abad[_0xe524('0x35')]=_0x45abad['attributes'][_0xe524('0x37')]?_0x45abad[_0xe524('0x35')]:_0x476572[_0xe524('0x34')];if(!_0x58a896['query'][_0xe524('0x38')](_0xe524('0x39'))){_0x45abad['limit']=qs[_0xe524('0x21')](_0x58a896[_0xe524('0x32')][_0xe524('0x21')]);_0x45abad[_0xe524('0x3a')]=qs['offset'](_0x58a896[_0xe524('0x32')][_0xe524('0x3a')]);}_0x45abad[_0xe524('0x3b')]=qs[_0xe524('0x3c')](_0x58a896[_0xe524('0x32')][_0xe524('0x3c')]);_0x45abad[_0xe524('0x3d')]=qs[_0xe524('0x33')](_['pick'](_0x58a896[_0xe524('0x32')],_0x476572['filters']),_0x359c8b);if(_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]){_0x45abad['where']=_[_0xe524('0x3f')](_0x45abad['where'],{'$or':_[_0xe524('0x31')](_0x359c8b,function(_0x41af26){if(_0x41af26[_0xe524('0x2f')]!==_0xe524('0x40')){var _0x82a87b={};_0x82a87b[_0x41af26[_0xe524('0x2b')]]={'$like':'%'+_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]+'%'};return _0x82a87b;}})});}_0x45abad=_['merge']({},_0x45abad,_0x58a896[_0xe524('0x41')]);var _0x940c05={'where':_0x45abad[_0xe524('0x3d')]};return db[_0xe524('0x42')][_0xe524('0x43')](_0x940c05)[_0xe524('0x27')](function(_0x1d9648){_0x109a96[_0xe524('0x43')]=_0x1d9648;if(_0x58a896['query'][_0xe524('0x44')]){_0x45abad[_0xe524('0x45')]=[{'all':!![]}];}return db[_0xe524('0x42')]['findAll'](_0x45abad);})[_0xe524('0x27')](function(_0x5213ed){_0x109a96[_0xe524('0x46')]=_0x5213ed;return _0x109a96;})[_0xe524('0x27')](respondWithFilteredResult(_0x283f18,_0x45abad))[_0xe524('0x47')](handleError(_0x283f18,null));};exports[_0xe524('0x48')]=function(_0x27a9e5,_0x4746cd){var _0xbeb2a9={'raw':!![],'where':{'id':_0x27a9e5[_0xe524('0x49')]['id']}},_0x52cd0e={};_0x52cd0e[_0xe524('0x34')]=_[_0xe524('0x4a')](db[_0xe524('0x42')][_0xe524('0x2d')]);_0x52cd0e[_0xe524('0x32')]=_['keys'](_0x27a9e5[_0xe524('0x32')]);_0x52cd0e[_0xe524('0x33')]=_[_0xe524('0x4b')](_0x52cd0e['model'],_0x52cd0e[_0xe524('0x32')]);_0xbeb2a9['attributes']=_['intersection'](_0x52cd0e[_0xe524('0x34')],qs[_0xe524('0x36')](_0x27a9e5['query'][_0xe524('0x36')]));_0xbeb2a9[_0xe524('0x35')]=_0xbeb2a9[_0xe524('0x35')][_0xe524('0x37')]?_0xbeb2a9['attributes']:_0x52cd0e['model'];if(_0x27a9e5[_0xe524('0x32')][_0xe524('0x44')]){_0xbeb2a9['include']=[{'all':!![]}];}_0xbeb2a9=_[_0xe524('0x3f')]({},_0xbeb2a9,_0x27a9e5['options']);return db[_0xe524('0x42')][_0xe524('0x4c')](_0xbeb2a9)[_0xe524('0x27')](handleEntityNotFound(_0x4746cd,null))[_0xe524('0x27')](respondWithResult(_0x4746cd,null))[_0xe524('0x47')](handleError(_0x4746cd,null));};exports[_0xe524('0x4d')]=function(_0x305503,_0x22fb42){return db[_0xe524('0x42')][_0xe524('0x4d')](_0x305503[_0xe524('0x4e')],{})[_0xe524('0x27')](respondWithResult(_0x22fb42,0xc9))[_0xe524('0x47')](handleError(_0x22fb42,null));};exports[_0xe524('0x26')]=function(_0x37d44d,_0x4dff40){if(_0x37d44d[_0xe524('0x4e')]['id']){delete _0x37d44d['body']['id'];}return db['SquareReport'][_0xe524('0x4c')]({'where':{'id':_0x37d44d['params']['id']}})[_0xe524('0x27')](handleEntityNotFound(_0x4dff40,null))[_0xe524('0x27')](saveUpdates(_0x37d44d['body'],null))[_0xe524('0x27')](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['destroy']=function(_0x2fa574,_0x1e5687){return db[_0xe524('0x42')]['find']({'where':{'id':_0x2fa574['params']['id']}})['then'](handleEntityNotFound(_0x1e5687,null))['then'](removeEntity(_0x1e5687,null))['catch'](handleError(_0x1e5687,null));};exports['describe']=function(_0x45f504,_0x2ce5c0){return db['SquareReport'][_0xe524('0x4f')]()[_0xe524('0x27')](respondWithResult(_0x2ce5c0,null))[_0xe524('0x47')](handleError(_0x2ce5c0,null));}; \ No newline at end of file +var _0x4cfd=['catch','merge','options','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','rows'];(function(_0x261d71,_0x38163a){var _0x1f6db9=function(_0x19f36b){while(--_0x19f36b){_0x261d71['push'](_0x261d71['shift']());}};_0x1f6db9(++_0x38163a);}(_0x4cfd,0x170));var _0xd4cf=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x4cfd[_0x15b380];return _0x232c5c;};'use strict';var pdf=require(_0xd4cf('0x0'));var emlformat=require(_0xd4cf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd4cf('0x2'));var jsonpatch=require(_0xd4cf('0x3'));var rp=require(_0xd4cf('0x4'));var moment=require(_0xd4cf('0x5'));var BPromise=require(_0xd4cf('0x6'));var Mustache=require(_0xd4cf('0x7'));var util=require('util');var path=require(_0xd4cf('0x8'));var sox=require(_0xd4cf('0x9'));var csv=require(_0xd4cf('0xa'));var ejs=require(_0xd4cf('0xb'));var fs=require('fs');var _=require(_0xd4cf('0xc'));var squel=require(_0xd4cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xe'));var deskjs=require(_0xd4cf('0xf'));var toCsv=require(_0xd4cf('0xa'));var querystring=require(_0xd4cf('0x10'));var Papa=require(_0xd4cf('0x11'));var Redis=require(_0xd4cf('0x12'));var authService=require(_0xd4cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4cf('0x14'));var hardwareService=require(_0xd4cf('0x15'));var logger=require(_0xd4cf('0x16'))(_0xd4cf('0x17'));var utils=require(_0xd4cf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4cf('0x19'))['db'];function respondWithStatusCode(_0x294c99,_0x544065){_0x544065=_0x544065||0xcc;return function(_0x3ff2db){if(_0x3ff2db){return _0x294c99['sendStatus'](_0x544065);}return _0x294c99[_0xd4cf('0x1a')](_0x544065)['end']();};}function respondWithResult(_0x330630,_0xa597cd){_0xa597cd=_0xa597cd||0xc8;return function(_0x51c61e){if(_0x51c61e){return _0x330630[_0xd4cf('0x1a')](_0xa597cd)[_0xd4cf('0x1b')](_0x51c61e);}};}function respondWithFilteredResult(_0x2f8607,_0x13c0a1){return function(_0x44abd7){if(_0x44abd7){var _0x2ff69e=_0x44abd7[_0xd4cf('0x1c')],_0x560723=_0x13c0a1[_0xd4cf('0x1d')],_0x3aa40d=_0x13c0a1[_0xd4cf('0x1d')]+_0x13c0a1[_0xd4cf('0x1e')],_0x1769e6;if(_0x3aa40d>=_0x2ff69e){_0x3aa40d=_0x2ff69e;_0x1769e6=0xc8;}else{_0x1769e6=0xce;}_0x2f8607[_0xd4cf('0x1a')](_0x1769e6);return _0x2f8607[_0xd4cf('0x1f')](_0xd4cf('0x20'),_0x560723+'-'+_0x3aa40d+'/'+_0x2ff69e)[_0xd4cf('0x1b')](_0x44abd7);}return null;};}function patchUpdates(_0x1ae368){return function(_0x540e2b){try{jsonpatch[_0xd4cf('0x21')](_0x540e2b,_0x1ae368,!![]);}catch(_0x412e19){return BPromise[_0xd4cf('0x22')](_0x412e19);}return _0x540e2b[_0xd4cf('0x23')]();};}function saveUpdates(_0x1caa70,_0x2bef15){return function(_0x2b34e2){if(_0x2b34e2){return _0x2b34e2['update'](_0x1caa70)[_0xd4cf('0x24')](function(_0x49c528){return _0x49c528;});}return null;};}function removeEntity(_0x4ec111,_0x10f6a7){return function(_0x3dbe6d){if(_0x3dbe6d){return _0x3dbe6d[_0xd4cf('0x25')]()[_0xd4cf('0x24')](function(){_0x4ec111[_0xd4cf('0x1a')](0xcc)[_0xd4cf('0x26')]();});}};}function handleEntityNotFound(_0x54aaab,_0x14c159){return function(_0x4f9a7c){if(!_0x4f9a7c){_0x54aaab[_0xd4cf('0x27')](0x194);}return _0x4f9a7c;};}function handleError(_0x335971,_0x269442){_0x269442=_0x269442||0x1f4;return function(_0x4c1896){logger['error'](_0x4c1896['stack']);if(_0x4c1896[_0xd4cf('0x28')]){delete _0x4c1896[_0xd4cf('0x28')];}_0x335971['status'](_0x269442)['send'](_0x4c1896);};}exports['index']=function(_0x23658f,_0x5a3962){var _0x53ac7e={},_0x50e9b9={},_0xd28042={'count':0x0,'rows':[]};var _0x4bb272=_[_0xd4cf('0x29')](db[_0xd4cf('0x2a')][_0xd4cf('0x2b')],function(_0x3b507f){return{'name':_0x3b507f[_0xd4cf('0x2c')],'type':_0x3b507f[_0xd4cf('0x2d')][_0xd4cf('0x2e')]};});_0x50e9b9[_0xd4cf('0x2f')]=_['map'](_0x4bb272,_0xd4cf('0x28'));_0x50e9b9[_0xd4cf('0x30')]=_[_0xd4cf('0x31')](_0x23658f['query']);_0x50e9b9['filters']=_[_0xd4cf('0x32')](_0x50e9b9[_0xd4cf('0x2f')],_0x50e9b9[_0xd4cf('0x30')]);_0x53ac7e[_0xd4cf('0x33')]=_[_0xd4cf('0x32')](_0x50e9b9[_0xd4cf('0x2f')],qs[_0xd4cf('0x34')](_0x23658f[_0xd4cf('0x30')]['fields']));_0x53ac7e[_0xd4cf('0x33')]=_0x53ac7e[_0xd4cf('0x33')][_0xd4cf('0x35')]?_0x53ac7e[_0xd4cf('0x33')]:_0x50e9b9[_0xd4cf('0x2f')];if(!_0x23658f[_0xd4cf('0x30')][_0xd4cf('0x36')](_0xd4cf('0x37'))){_0x53ac7e[_0xd4cf('0x1e')]=qs[_0xd4cf('0x1e')](_0x23658f[_0xd4cf('0x30')][_0xd4cf('0x1e')]);_0x53ac7e[_0xd4cf('0x1d')]=qs['offset'](_0x23658f['query'][_0xd4cf('0x1d')]);}_0x53ac7e[_0xd4cf('0x38')]=qs[_0xd4cf('0x39')](_0x23658f[_0xd4cf('0x30')][_0xd4cf('0x39')]);_0x53ac7e[_0xd4cf('0x3a')]=qs[_0xd4cf('0x3b')](_[_0xd4cf('0x3c')](_0x23658f['query'],_0x50e9b9[_0xd4cf('0x3b')]),_0x4bb272);if(_0x23658f[_0xd4cf('0x30')][_0xd4cf('0x3d')]){_0x53ac7e['where']=_['merge'](_0x53ac7e[_0xd4cf('0x3a')],{'$or':_[_0xd4cf('0x29')](_0x4bb272,function(_0xda1964){if(_0xda1964[_0xd4cf('0x2d')]!=='VIRTUAL'){var _0x470973={};_0x470973[_0xda1964[_0xd4cf('0x28')]]={'$like':'%'+_0x23658f[_0xd4cf('0x30')][_0xd4cf('0x3d')]+'%'};return _0x470973;}})});}_0x53ac7e=_['merge']({},_0x53ac7e,_0x23658f['options']);var _0x4aeaa8={'where':_0x53ac7e[_0xd4cf('0x3a')]};return db[_0xd4cf('0x2a')][_0xd4cf('0x1c')](_0x4aeaa8)[_0xd4cf('0x24')](function(_0x344309){_0xd28042[_0xd4cf('0x1c')]=_0x344309;if(_0x23658f[_0xd4cf('0x30')][_0xd4cf('0x3e')]){_0x53ac7e['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x53ac7e);})[_0xd4cf('0x24')](function(_0x488a7d){_0xd28042[_0xd4cf('0x3f')]=_0x488a7d;return _0xd28042;})[_0xd4cf('0x24')](respondWithFilteredResult(_0x5a3962,_0x53ac7e))[_0xd4cf('0x40')](handleError(_0x5a3962,null));};exports['show']=function(_0x1b864f,_0x1ee4e2){var _0x5c0a07={'raw':!![],'where':{'id':_0x1b864f['params']['id']}},_0x44dda0={};_0x44dda0[_0xd4cf('0x2f')]=_['keys'](db[_0xd4cf('0x2a')][_0xd4cf('0x2b')]);_0x44dda0['query']=_['keys'](_0x1b864f['query']);_0x44dda0[_0xd4cf('0x3b')]=_[_0xd4cf('0x32')](_0x44dda0[_0xd4cf('0x2f')],_0x44dda0[_0xd4cf('0x30')]);_0x5c0a07[_0xd4cf('0x33')]=_[_0xd4cf('0x32')](_0x44dda0['model'],qs[_0xd4cf('0x34')](_0x1b864f[_0xd4cf('0x30')][_0xd4cf('0x34')]));_0x5c0a07[_0xd4cf('0x33')]=_0x5c0a07['attributes'][_0xd4cf('0x35')]?_0x5c0a07['attributes']:_0x44dda0[_0xd4cf('0x2f')];if(_0x1b864f[_0xd4cf('0x30')]['includeAll']){_0x5c0a07['include']=[{'all':!![]}];}_0x5c0a07=_[_0xd4cf('0x41')]({},_0x5c0a07,_0x1b864f[_0xd4cf('0x42')]);return db['SquareReport'][_0xd4cf('0x43')](_0x5c0a07)[_0xd4cf('0x24')](handleEntityNotFound(_0x1ee4e2,null))[_0xd4cf('0x24')](respondWithResult(_0x1ee4e2,null))[_0xd4cf('0x40')](handleError(_0x1ee4e2,null));};exports[_0xd4cf('0x44')]=function(_0x5134b8,_0xa1f953){return db[_0xd4cf('0x2a')][_0xd4cf('0x44')](_0x5134b8[_0xd4cf('0x45')],{})[_0xd4cf('0x24')](respondWithResult(_0xa1f953,0xc9))[_0xd4cf('0x40')](handleError(_0xa1f953,null));};exports['update']=function(_0x41d5af,_0x217754){if(_0x41d5af[_0xd4cf('0x45')]['id']){delete _0x41d5af[_0xd4cf('0x45')]['id'];}return db[_0xd4cf('0x2a')][_0xd4cf('0x43')]({'where':{'id':_0x41d5af[_0xd4cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x217754,null))[_0xd4cf('0x24')](saveUpdates(_0x41d5af[_0xd4cf('0x45')],null))[_0xd4cf('0x24')](respondWithResult(_0x217754,null))[_0xd4cf('0x40')](handleError(_0x217754,null));};exports['destroy']=function(_0x738bf3,_0x6ef0ff){return db[_0xd4cf('0x2a')][_0xd4cf('0x43')]({'where':{'id':_0x738bf3[_0xd4cf('0x46')]['id']}})[_0xd4cf('0x24')](handleEntityNotFound(_0x6ef0ff,null))[_0xd4cf('0x24')](removeEntity(_0x6ef0ff,null))['catch'](handleError(_0x6ef0ff,null));};exports['describe']=function(_0x564241,_0xbafbd2){return db[_0xd4cf('0x2a')][_0xd4cf('0x47')]()[_0xd4cf('0x24')](respondWithResult(_0xbafbd2,null))[_0xd4cf('0x40')](handleError(_0xbafbd2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7a6ff41..67a39ed 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 _0x28e2=['moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api'];(function(_0x73dca4,_0x5697c6){var _0x37a65c=function(_0x48b62c){while(--_0x48b62c){_0x73dca4['push'](_0x73dca4['shift']());}};_0x37a65c(++_0x5697c6);}(_0x28e2,0xdc));var _0x228e=function(_0x589e57,_0x44a100){_0x589e57=_0x589e57-0x0;var _0x54a0bf=_0x28e2[_0x589e57];return _0x54a0bf;};'use strict';var _=require(_0x228e('0x0'));var util=require(_0x228e('0x1'));var logger=require(_0x228e('0x2'))(_0x228e('0x3'));var moment=require(_0x228e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x228e('0x5'));var rimraf=require(_0x228e('0x6'));var config=require(_0x228e('0x7'));var attributes=require(_0x228e('0x8'));module[_0x228e('0x9')]=function(_0x1bb6b9,_0x73e7fa){return _0x1bb6b9[_0x228e('0xa')](_0x228e('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x228e('0xc'),'fields':[_0x228e('0xd'),_0x228e('0xe')]},{'name':_0x228e('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5d1=['./squareReport.attributes','exports','uid_pname','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xdab6d8,_0x51a29c){var _0x4ed618=function(_0x42fd84){while(--_0x42fd84){_0xdab6d8['push'](_0xdab6d8['shift']());}};_0x4ed618(++_0x51a29c);}(_0xf5d1,0x94));var _0x1f5d=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xf5d1[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x1f5d('0x0'));var util=require(_0x1f5d('0x1'));var logger=require(_0x1f5d('0x2'))(_0x1f5d('0x3'));var moment=require('moment');var BPromise=require(_0x1f5d('0x4'));var rp=require(_0x1f5d('0x5'));var fs=require('fs');var path=require(_0x1f5d('0x6'));var rimraf=require(_0x1f5d('0x7'));var config=require('../../config/environment');var attributes=require(_0x1f5d('0x8'));module[_0x1f5d('0x9')]=function(_0x4a21db,_0x3741ee){return _0x4a21db['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x1f5d('0xa'),'fields':['uniqueid','project_name']},{'name':_0x1f5d('0xb'),'fields':[_0x1f5d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 666d17f..1d2789f 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 _0x008c=['client','http','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','catch','create','then','stringify','CreateSquareReport','SquareReport','options','raw','limit','UpdateSquareReport','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x34cfa6,_0x1727ee){var _0x3a46a1=function(_0x546d12){while(--_0x546d12){_0x34cfa6['push'](_0x34cfa6['shift']());}};_0x3a46a1(++_0x1727ee);}(_0x008c,0x188));var _0xc008=function(_0x20fbd5,_0x548e19){_0x20fbd5=_0x20fbd5-0x0;var _0x1bf745=_0x008c[_0x20fbd5];return _0x1bf745;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['CreateSquareReport']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareReport'][_0xc008('0x15')](_0x540e45['body'],{'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![]})[_0xc008('0x16')](function(_0x4b9726){logger['info']('CreateSquareReport',_0x540e45);logger['debug']('CreateSquareReport',_0x540e45,JSON[_0xc008('0x17')](_0x4b9726));_0x46042b(_0x4b9726);})[_0xc008('0x14')](function(_0x251db2){logger[_0xc008('0x10')](_0xc008('0x18'),_0x251db2[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668['error'](0x1f4,_0x251db2[_0xc008('0x13')]));});});};exports['UpdateSquareReport']=function(_0x58a6ea){var _0x218599=this;return new Promise(function(_0x36f358,_0x2e3cfb){return db[_0xc008('0x19')]['update'](_0x58a6ea['body'],{'raw':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a6ea[_0xc008('0x1a')]?_0x58a6ea[_0xc008('0x1a')]['where']||null:null,'attributes':_0x58a6ea['options']?_0x58a6ea['options']['attributes']||null:null,'limit':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1c')]||null:null})[_0xc008('0x16')](function(_0x529961){logger[_0xc008('0xd')](_0xc008('0x1d'),_0x58a6ea);logger[_0xc008('0x1e')](_0xc008('0x1d'),_0x58a6ea,JSON['stringify'](_0x529961));_0x36f358(_0x529961);})[_0xc008('0x14')](function(_0x2e0b4e){logger['error']('UpdateSquareReport',_0x2e0b4e['message'],_0x58a6ea);_0x2e3cfb(_0x218599[_0xc008('0x10')](0x1f4,_0x2e0b4e[_0xc008('0x13')]));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','update','raw','where','limit','UpdateSquareReport','lodash','util','ioredis'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x55ca,0x126));var _0xa55c=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x55ca[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareReport,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')](_0x24783b[_0xa55c('0x1a')],{'raw':_0x24783b[_0xa55c('0x1b')]?_0x24783b['options']['raw']===undefined?!![]:![]:!![]})[_0xa55c('0xb')](function(_0x3776ac){logger[_0xa55c('0x14')]('CreateSquareReport',_0x24783b);logger[_0xa55c('0xe')](_0xa55c('0x17'),_0x24783b,JSON['stringify'](_0x3776ac));_0x3d4c9e(_0x3776ac);})[_0xa55c('0x16')](function(_0x133096){logger[_0xa55c('0x11')](_0xa55c('0x17'),_0x133096[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c['error'](0x1f4,_0x133096[_0xa55c('0x13')]));});});};exports['UpdateSquareReport']=function(_0x5ba836){var _0x59d89a=this;return new Promise(function(_0x19ae88,_0x54b038){return db[_0xa55c('0x18')][_0xa55c('0x1c')](_0x5ba836[_0xa55c('0x1a')],{'raw':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1e')]||null:null,'attributes':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')]['attributes']||null:null,'limit':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1f')]||null:null})[_0xa55c('0xb')](function(_0x5d940d){logger[_0xa55c('0x14')](_0xa55c('0x20'),_0x5ba836);logger[_0xa55c('0xe')](_0xa55c('0x20'),_0x5ba836,JSON[_0xa55c('0x10')](_0x5d940d));_0x19ae88(_0x5d940d);})[_0xa55c('0x16')](function(_0x52d37f){logger[_0xa55c('0x11')]('UpdateSquareReport',_0x52d37f[_0xa55c('0x13')],_0x5ba836);_0x54b038(_0x59d89a[_0xa55c('0x11')](0x1f4,_0x52d37f[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6285e40..0bd47ed 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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0xb6cf7,_0x4a862e){var _0x40ddb7=function(_0x597d75){while(--_0x597d75){_0xb6cf7['push'](_0xb6cf7['shift']());}};_0x40ddb7(++_0x4a862e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31948f,_0x16a032){_0x31948f=_0x31948f-0x0;var _0x14d62e=_0x5f2f[_0x31948f];return _0x14d62e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1ef6aa,_0x45f041){var _0x2573a6=function(_0x30b515){while(--_0x30b515){_0x1ef6aa['push'](_0x1ef6aa['shift']());}};_0x2573a6(++_0x45f041);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e3a01,_0x26a6f7){_0x4e3a01=_0x4e3a01-0x0;var _0xdf0cdc=_0x5f2f[_0x4e3a01];return _0xdf0cdc;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 0bd2356..fb4b8cd 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 _0xb4c0=['STRING','TEXT','sequelize','exports'];(function(_0x3fccbf,_0x14da2f){var _0x1a88a1=function(_0xb09d9f){while(--_0xb09d9f){_0x3fccbf['push'](_0x3fccbf['shift']());}};_0x1a88a1(++_0x14da2f);}(_0xb4c0,0x1ee));var _0x0b4c=function(_0x542b03,_0x28dcc6){_0x542b03=_0x542b03-0x0;var _0x1c6ccc=_0xb4c0[_0x542b03];return _0x1c6ccc;};'use strict';var Sequelize=require(_0x0b4c('0x0'));module[_0x0b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x0b4c('0x2')]},'node':{'type':Sequelize[_0x0b4c('0x2')]},'application':{'type':Sequelize[_0x0b4c('0x2')]},'data':{'type':Sequelize[_0x0b4c('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0b4c('0x2')]}}; \ No newline at end of file +var _0x763f=['exports','STRING','TEXT'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0x763f,0x1ce));var _0xf763=function(_0x55ae99,_0x5ab789){_0x55ae99=_0x55ae99-0x0;var _0x4297e1=_0x763f[_0x55ae99];return _0x4297e1;};'use strict';var Sequelize=require('sequelize');module[_0xf763('0x0')]={'uniqueid':{'type':Sequelize[_0xf763('0x1')]},'node':{'type':Sequelize[_0xf763('0x1')]},'application':{'type':Sequelize[_0xf763('0x1')]},'data':{'type':Sequelize[_0xf763('0x2')]},'project_name':{'type':Sequelize[_0xf763('0x1')]},'callerid':{'type':Sequelize[_0xf763('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 74539b6..b918424 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 _0xefc3=['pick','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','keys','options','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters'];(function(_0x4b7b45,_0xcf2038){var _0x1f8bc1=function(_0x7e1c98){while(--_0x7e1c98){_0x4b7b45['push'](_0x4b7b45['shift']());}};_0x1f8bc1(++_0xcf2038);}(_0xefc3,0xa9));var _0x3efc=function(_0x59c569,_0x33a180){_0x59c569=_0x59c569-0x0;var _0x166517=_0xefc3[_0x59c569];return _0x166517;};'use strict';var pdf=require(_0x3efc('0x0'));var emlformat=require(_0x3efc('0x1'));var rimraf=require(_0x3efc('0x2'));var zipdir=require(_0x3efc('0x3'));var jsonpatch=require(_0x3efc('0x4'));var rp=require(_0x3efc('0x5'));var moment=require('moment');var BPromise=require(_0x3efc('0x6'));var Mustache=require(_0x3efc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3efc('0x8'));var csv=require(_0x3efc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3efc('0xa'));var squel=require(_0x3efc('0xb'));var crypto=require(_0x3efc('0xc'));var jsforce=require(_0x3efc('0xd'));var deskjs=require(_0x3efc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3efc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3efc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3efc('0x11'));var hardwareService=require(_0x3efc('0x12'));var logger=require(_0x3efc('0x13'))(_0x3efc('0x14'));var utils=require('../../config/utils');var config=require(_0x3efc('0x15'));var licenseUtil=require(_0x3efc('0x16'));var db=require(_0x3efc('0x17'))['db'];function respondWithStatusCode(_0x52044f,_0x54a054){_0x54a054=_0x54a054||0xcc;return function(_0x3a63b4){if(_0x3a63b4){return _0x52044f[_0x3efc('0x18')](_0x54a054);}return _0x52044f[_0x3efc('0x19')](_0x54a054)[_0x3efc('0x1a')]();};}function respondWithResult(_0x425d7d,_0x5a9033){_0x5a9033=_0x5a9033||0xc8;return function(_0x44dbc0){if(_0x44dbc0){return _0x425d7d[_0x3efc('0x19')](_0x5a9033)[_0x3efc('0x1b')](_0x44dbc0);}};}function respondWithFilteredResult(_0x2297ad,_0x51bf2d){return function(_0x67ad7e){if(_0x67ad7e){var _0x23a4e3=_0x67ad7e['count'],_0x4545e9=_0x51bf2d[_0x3efc('0x1c')],_0x349110=_0x51bf2d[_0x3efc('0x1c')]+_0x51bf2d['limit'],_0x4fbd63;if(_0x349110>=_0x23a4e3){_0x349110=_0x23a4e3;_0x4fbd63=0xc8;}else{_0x4fbd63=0xce;}_0x2297ad[_0x3efc('0x19')](_0x4fbd63);return _0x2297ad[_0x3efc('0x1d')](_0x3efc('0x1e'),_0x4545e9+'-'+_0x349110+'/'+_0x23a4e3)[_0x3efc('0x1b')](_0x67ad7e);}return null;};}function patchUpdates(_0x2e7ffd){return function(_0x5607c2){try{jsonpatch[_0x3efc('0x1f')](_0x5607c2,_0x2e7ffd,!![]);}catch(_0x1ddae6){return BPromise[_0x3efc('0x20')](_0x1ddae6);}return _0x5607c2[_0x3efc('0x21')]();};}function saveUpdates(_0x5bdc98,_0x145896){return function(_0x3cc50b){if(_0x3cc50b){return _0x3cc50b[_0x3efc('0x22')](_0x5bdc98)[_0x3efc('0x23')](function(_0x1f3eb8){return _0x1f3eb8;});}return null;};}function removeEntity(_0x2c3766,_0x1a4b20){return function(_0x1ff62f){if(_0x1ff62f){return _0x1ff62f[_0x3efc('0x24')]()[_0x3efc('0x23')](function(){_0x2c3766[_0x3efc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32fdda,_0x3a9d6a){return function(_0x2c2ea6){if(!_0x2c2ea6){_0x32fdda[_0x3efc('0x18')](0x194);}return _0x2c2ea6;};}function handleError(_0x459bd0,_0xc4774c){_0xc4774c=_0xc4774c||0x1f4;return function(_0x201910){logger[_0x3efc('0x25')](_0x201910['stack']);if(_0x201910['name']){delete _0x201910[_0x3efc('0x26')];}_0x459bd0[_0x3efc('0x19')](_0xc4774c)[_0x3efc('0x27')](_0x201910);};}exports[_0x3efc('0x28')]=function(_0x14033e,_0x2c80de){var _0x283426={},_0x5a22b9={},_0xdacb87={'count':0x0,'rows':[]};var _0x209ed9=_['map'](db[_0x3efc('0x29')][_0x3efc('0x2a')],function(_0x28561b){return{'name':_0x28561b[_0x3efc('0x2b')],'type':_0x28561b['type'][_0x3efc('0x2c')]};});_0x5a22b9[_0x3efc('0x2d')]=_[_0x3efc('0x2e')](_0x209ed9,_0x3efc('0x26'));_0x5a22b9['query']=_['keys'](_0x14033e[_0x3efc('0x2f')]);_0x5a22b9['filters']=_[_0x3efc('0x30')](_0x5a22b9['model'],_0x5a22b9[_0x3efc('0x2f')]);_0x283426[_0x3efc('0x31')]=_[_0x3efc('0x30')](_0x5a22b9[_0x3efc('0x2d')],qs[_0x3efc('0x32')](_0x14033e['query'][_0x3efc('0x32')]));_0x283426[_0x3efc('0x31')]=_0x283426[_0x3efc('0x31')][_0x3efc('0x33')]?_0x283426[_0x3efc('0x31')]:_0x5a22b9['model'];if(!_0x14033e[_0x3efc('0x2f')][_0x3efc('0x34')](_0x3efc('0x35'))){_0x283426[_0x3efc('0x36')]=qs[_0x3efc('0x36')](_0x14033e[_0x3efc('0x2f')][_0x3efc('0x36')]);_0x283426[_0x3efc('0x1c')]=qs[_0x3efc('0x1c')](_0x14033e[_0x3efc('0x2f')][_0x3efc('0x1c')]);}_0x283426[_0x3efc('0x37')]=qs[_0x3efc('0x38')](_0x14033e[_0x3efc('0x2f')][_0x3efc('0x38')]);_0x283426[_0x3efc('0x39')]=qs[_0x3efc('0x3a')](_[_0x3efc('0x3b')](_0x14033e['query'],_0x5a22b9[_0x3efc('0x3a')]),_0x209ed9);if(_0x14033e['query']['filter']){_0x283426[_0x3efc('0x39')]=_[_0x3efc('0x3c')](_0x283426[_0x3efc('0x39')],{'$or':_[_0x3efc('0x2e')](_0x209ed9,function(_0x5893ed){if(_0x5893ed[_0x3efc('0x3d')]!==_0x3efc('0x3e')){var _0x44ba1b={};_0x44ba1b[_0x5893ed[_0x3efc('0x26')]]={'$like':'%'+_0x14033e[_0x3efc('0x2f')][_0x3efc('0x3f')]+'%'};return _0x44ba1b;}})});}_0x283426=_[_0x3efc('0x3c')]({},_0x283426,_0x14033e['options']);var _0xb34c5={'where':_0x283426[_0x3efc('0x39')]};return db[_0x3efc('0x29')][_0x3efc('0x40')](_0xb34c5)[_0x3efc('0x23')](function(_0x3237c5){_0xdacb87['count']=_0x3237c5;if(_0x14033e[_0x3efc('0x2f')][_0x3efc('0x41')]){_0x283426[_0x3efc('0x42')]=[{'all':!![]}];}return db[_0x3efc('0x29')][_0x3efc('0x43')](_0x283426);})[_0x3efc('0x23')](function(_0x13d768){_0xdacb87[_0x3efc('0x44')]=_0x13d768;return _0xdacb87;})[_0x3efc('0x23')](respondWithFilteredResult(_0x2c80de,_0x283426))[_0x3efc('0x45')](handleError(_0x2c80de,null));};exports[_0x3efc('0x46')]=function(_0x14f5dc,_0x9d2c41){var _0x478b88={'raw':!![],'where':{'id':_0x14f5dc['params']['id']}},_0x334321={};_0x334321[_0x3efc('0x2d')]=_[_0x3efc('0x47')](db['SquareDetailsReport'][_0x3efc('0x2a')]);_0x334321[_0x3efc('0x2f')]=_[_0x3efc('0x47')](_0x14f5dc['query']);_0x334321[_0x3efc('0x3a')]=_[_0x3efc('0x30')](_0x334321[_0x3efc('0x2d')],_0x334321[_0x3efc('0x2f')]);_0x478b88['attributes']=_['intersection'](_0x334321[_0x3efc('0x2d')],qs[_0x3efc('0x32')](_0x14f5dc[_0x3efc('0x2f')][_0x3efc('0x32')]));_0x478b88[_0x3efc('0x31')]=_0x478b88[_0x3efc('0x31')][_0x3efc('0x33')]?_0x478b88[_0x3efc('0x31')]:_0x334321['model'];if(_0x14f5dc[_0x3efc('0x2f')][_0x3efc('0x41')]){_0x478b88[_0x3efc('0x42')]=[{'all':!![]}];}_0x478b88=_[_0x3efc('0x3c')]({},_0x478b88,_0x14f5dc[_0x3efc('0x48')]);return db[_0x3efc('0x29')][_0x3efc('0x49')](_0x478b88)['then'](handleEntityNotFound(_0x9d2c41,null))['then'](respondWithResult(_0x9d2c41,null))[_0x3efc('0x45')](handleError(_0x9d2c41,null));};exports['create']=function(_0x2f3cfe,_0x123b8d){return db[_0x3efc('0x29')]['create'](_0x2f3cfe[_0x3efc('0x4a')],{})[_0x3efc('0x23')](respondWithResult(_0x123b8d,0xc9))[_0x3efc('0x45')](handleError(_0x123b8d,null));};exports[_0x3efc('0x22')]=function(_0x3489cc,_0x11d4b4){if(_0x3489cc[_0x3efc('0x4a')]['id']){delete _0x3489cc[_0x3efc('0x4a')]['id'];}return db['SquareDetailsReport'][_0x3efc('0x49')]({'where':{'id':_0x3489cc[_0x3efc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11d4b4,null))[_0x3efc('0x23')](saveUpdates(_0x3489cc[_0x3efc('0x4a')],null))[_0x3efc('0x23')](respondWithResult(_0x11d4b4,null))[_0x3efc('0x45')](handleError(_0x11d4b4,null));};exports[_0x3efc('0x24')]=function(_0x2ea3ba,_0x238f7f){return db['SquareDetailsReport'][_0x3efc('0x49')]({'where':{'id':_0x2ea3ba['params']['id']}})[_0x3efc('0x23')](handleEntityNotFound(_0x238f7f,null))['then'](removeEntity(_0x238f7f,null))[_0x3efc('0x45')](handleError(_0x238f7f,null));};exports['describe']=function(_0xa2fb88,_0x2aaa70){return db[_0x3efc('0x29')]['describe']()[_0x3efc('0x23')](respondWithResult(_0x2aaa70,null))[_0x3efc('0x45')](handleError(_0x2aaa70,null));}; \ No newline at end of file +var _0x1410=['request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','options','where','count','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x76d29,_0x4fa56f){var _0x4f0bc3=function(_0xb64cd7){while(--_0xb64cd7){_0x76d29['push'](_0x76d29['shift']());}};_0x4f0bc3(++_0x4fa56f);}(_0x1410,0x130));var _0x0141=function(_0xef2081,_0x2eec5d){_0xef2081=_0xef2081-0x0;var _0x5aa323=_0x1410[_0xef2081];return _0x5aa323;};'use strict';var pdf=require(_0x0141('0x0'));var emlformat=require(_0x0141('0x1'));var rimraf=require(_0x0141('0x2'));var zipdir=require(_0x0141('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0141('0x4'));var moment=require('moment');var BPromise=require(_0x0141('0x5'));var Mustache=require('mustache');var util=require(_0x0141('0x6'));var path=require(_0x0141('0x7'));var sox=require(_0x0141('0x8'));var csv=require(_0x0141('0x9'));var ejs=require(_0x0141('0xa'));var fs=require('fs');var _=require(_0x0141('0xb'));var squel=require(_0x0141('0xc'));var crypto=require(_0x0141('0xd'));var jsforce=require(_0x0141('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0141('0x9'));var querystring=require(_0x0141('0xf'));var Papa=require(_0x0141('0x10'));var Redis=require(_0x0141('0x11'));var authService=require(_0x0141('0x12'));var qs=require(_0x0141('0x13'));var as=require(_0x0141('0x14'));var hardwareService=require(_0x0141('0x15'));var logger=require('../../config/logger')(_0x0141('0x16'));var utils=require(_0x0141('0x17'));var config=require(_0x0141('0x18'));var licenseUtil=require(_0x0141('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49cebd,_0xab59e3){_0xab59e3=_0xab59e3||0xcc;return function(_0x25aefb){if(_0x25aefb){return _0x49cebd['sendStatus'](_0xab59e3);}return _0x49cebd[_0x0141('0x1a')](_0xab59e3)[_0x0141('0x1b')]();};}function respondWithResult(_0x16a55a,_0x245007){_0x245007=_0x245007||0xc8;return function(_0x1665e2){if(_0x1665e2){return _0x16a55a['status'](_0x245007)[_0x0141('0x1c')](_0x1665e2);}};}function respondWithFilteredResult(_0x5edd9f,_0x2ee001){return function(_0x3db66a){if(_0x3db66a){var _0x345fbd=_0x3db66a['count'],_0x310e2b=_0x2ee001['offset'],_0x3bf5b4=_0x2ee001[_0x0141('0x1d')]+_0x2ee001[_0x0141('0x1e')],_0x3c91e8;if(_0x3bf5b4>=_0x345fbd){_0x3bf5b4=_0x345fbd;_0x3c91e8=0xc8;}else{_0x3c91e8=0xce;}_0x5edd9f['status'](_0x3c91e8);return _0x5edd9f[_0x0141('0x1f')](_0x0141('0x20'),_0x310e2b+'-'+_0x3bf5b4+'/'+_0x345fbd)[_0x0141('0x1c')](_0x3db66a);}return null;};}function patchUpdates(_0x3a58b6){return function(_0x5427b5){try{jsonpatch[_0x0141('0x21')](_0x5427b5,_0x3a58b6,!![]);}catch(_0x5bf2e8){return BPromise['reject'](_0x5bf2e8);}return _0x5427b5[_0x0141('0x22')]();};}function saveUpdates(_0x3e8603,_0x17585f){return function(_0x30a141){if(_0x30a141){return _0x30a141[_0x0141('0x23')](_0x3e8603)[_0x0141('0x24')](function(_0x5e0ebe){return _0x5e0ebe;});}return null;};}function removeEntity(_0x21d8fc,_0x40c774){return function(_0x363860){if(_0x363860){return _0x363860[_0x0141('0x25')]()[_0x0141('0x24')](function(){_0x21d8fc[_0x0141('0x1a')](0xcc)[_0x0141('0x1b')]();});}};}function handleEntityNotFound(_0x20656b,_0x12a11e){return function(_0x3869b7){if(!_0x3869b7){_0x20656b[_0x0141('0x26')](0x194);}return _0x3869b7;};}function handleError(_0x5bf170,_0x59bdbd){_0x59bdbd=_0x59bdbd||0x1f4;return function(_0x4247d){logger[_0x0141('0x27')](_0x4247d[_0x0141('0x28')]);if(_0x4247d[_0x0141('0x29')]){delete _0x4247d[_0x0141('0x29')];}_0x5bf170['status'](_0x59bdbd)[_0x0141('0x2a')](_0x4247d);};}exports[_0x0141('0x2b')]=function(_0x2bb7c4,_0x4a82a6){var _0x29bec2={},_0x4d1cb3={},_0x15a81e={'count':0x0,'rows':[]};var _0x13d8d1=_[_0x0141('0x2c')](db[_0x0141('0x2d')][_0x0141('0x2e')],function(_0x29f463){return{'name':_0x29f463[_0x0141('0x2f')],'type':_0x29f463[_0x0141('0x30')][_0x0141('0x31')]};});_0x4d1cb3[_0x0141('0x32')]=_[_0x0141('0x2c')](_0x13d8d1,_0x0141('0x29'));_0x4d1cb3[_0x0141('0x33')]=_['keys'](_0x2bb7c4[_0x0141('0x33')]);_0x4d1cb3['filters']=_[_0x0141('0x34')](_0x4d1cb3[_0x0141('0x32')],_0x4d1cb3[_0x0141('0x33')]);_0x29bec2[_0x0141('0x35')]=_[_0x0141('0x34')](_0x4d1cb3[_0x0141('0x32')],qs['fields'](_0x2bb7c4[_0x0141('0x33')]['fields']));_0x29bec2[_0x0141('0x35')]=_0x29bec2[_0x0141('0x35')][_0x0141('0x36')]?_0x29bec2['attributes']:_0x4d1cb3[_0x0141('0x32')];if(!_0x2bb7c4[_0x0141('0x33')]['hasOwnProperty'](_0x0141('0x37'))){_0x29bec2[_0x0141('0x1e')]=qs[_0x0141('0x1e')](_0x2bb7c4[_0x0141('0x33')][_0x0141('0x1e')]);_0x29bec2['offset']=qs[_0x0141('0x1d')](_0x2bb7c4[_0x0141('0x33')][_0x0141('0x1d')]);}_0x29bec2[_0x0141('0x38')]=qs[_0x0141('0x39')](_0x2bb7c4[_0x0141('0x33')]['sort']);_0x29bec2['where']=qs[_0x0141('0x3a')](_[_0x0141('0x3b')](_0x2bb7c4['query'],_0x4d1cb3[_0x0141('0x3a')]),_0x13d8d1);if(_0x2bb7c4[_0x0141('0x33')][_0x0141('0x3c')]){_0x29bec2['where']=_['merge'](_0x29bec2['where'],{'$or':_[_0x0141('0x2c')](_0x13d8d1,function(_0x2b428a){if(_0x2b428a[_0x0141('0x30')]!==_0x0141('0x3d')){var _0x124d58={};_0x124d58[_0x2b428a[_0x0141('0x29')]]={'$like':'%'+_0x2bb7c4[_0x0141('0x33')]['filter']+'%'};return _0x124d58;}})});}_0x29bec2=_[_0x0141('0x3e')]({},_0x29bec2,_0x2bb7c4[_0x0141('0x3f')]);var _0x5b76c1={'where':_0x29bec2[_0x0141('0x40')]};return db[_0x0141('0x2d')][_0x0141('0x41')](_0x5b76c1)[_0x0141('0x24')](function(_0x1a4aa0){_0x15a81e[_0x0141('0x41')]=_0x1a4aa0;if(_0x2bb7c4[_0x0141('0x33')][_0x0141('0x42')]){_0x29bec2['include']=[{'all':!![]}];}return db[_0x0141('0x2d')][_0x0141('0x43')](_0x29bec2);})['then'](function(_0x1d545b){_0x15a81e[_0x0141('0x44')]=_0x1d545b;return _0x15a81e;})[_0x0141('0x24')](respondWithFilteredResult(_0x4a82a6,_0x29bec2))[_0x0141('0x45')](handleError(_0x4a82a6,null));};exports[_0x0141('0x46')]=function(_0x5ace30,_0x1746a1){var _0x56ac88={'raw':!![],'where':{'id':_0x5ace30['params']['id']}},_0x2e6153={};_0x2e6153['model']=_['keys'](db[_0x0141('0x2d')][_0x0141('0x2e')]);_0x2e6153[_0x0141('0x33')]=_['keys'](_0x5ace30[_0x0141('0x33')]);_0x2e6153[_0x0141('0x3a')]=_[_0x0141('0x34')](_0x2e6153[_0x0141('0x32')],_0x2e6153['query']);_0x56ac88[_0x0141('0x35')]=_[_0x0141('0x34')](_0x2e6153[_0x0141('0x32')],qs[_0x0141('0x47')](_0x5ace30[_0x0141('0x33')][_0x0141('0x47')]));_0x56ac88[_0x0141('0x35')]=_0x56ac88[_0x0141('0x35')]['length']?_0x56ac88[_0x0141('0x35')]:_0x2e6153[_0x0141('0x32')];if(_0x5ace30[_0x0141('0x33')]['includeAll']){_0x56ac88[_0x0141('0x48')]=[{'all':!![]}];}_0x56ac88=_[_0x0141('0x3e')]({},_0x56ac88,_0x5ace30[_0x0141('0x3f')]);return db['SquareDetailsReport'][_0x0141('0x49')](_0x56ac88)['then'](handleEntityNotFound(_0x1746a1,null))[_0x0141('0x24')](respondWithResult(_0x1746a1,null))['catch'](handleError(_0x1746a1,null));};exports[_0x0141('0x4a')]=function(_0x558af0,_0xaa2b6d){return db[_0x0141('0x2d')][_0x0141('0x4a')](_0x558af0[_0x0141('0x4b')],{})[_0x0141('0x24')](respondWithResult(_0xaa2b6d,0xc9))['catch'](handleError(_0xaa2b6d,null));};exports[_0x0141('0x23')]=function(_0x282e17,_0x1d40fb){if(_0x282e17['body']['id']){delete _0x282e17[_0x0141('0x4b')]['id'];}return db[_0x0141('0x2d')][_0x0141('0x49')]({'where':{'id':_0x282e17['params']['id']}})[_0x0141('0x24')](handleEntityNotFound(_0x1d40fb,null))['then'](saveUpdates(_0x282e17[_0x0141('0x4b')],null))[_0x0141('0x24')](respondWithResult(_0x1d40fb,null))[_0x0141('0x45')](handleError(_0x1d40fb,null));};exports[_0x0141('0x25')]=function(_0x5c8f64,_0x28d638){return db[_0x0141('0x2d')][_0x0141('0x49')]({'where':{'id':_0x5c8f64[_0x0141('0x4c')]['id']}})[_0x0141('0x24')](handleEntityNotFound(_0x28d638,null))[_0x0141('0x24')](removeEntity(_0x28d638,null))[_0x0141('0x45')](handleError(_0x28d638,null));};exports['describe']=function(_0x285807,_0x427574){return db[_0x0141('0x2d')]['describe']()[_0x0141('0x24')](respondWithResult(_0x427574,null))[_0x0141('0x45')](handleError(_0x427574,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b78aa23..888aa2b 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 _0x8dbb=['../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','util'];(function(_0x4ba258,_0xb2cd21){var _0x53efcd=function(_0x19efef){while(--_0x19efef){_0x4ba258['push'](_0x4ba258['shift']());}};_0x53efcd(++_0xb2cd21);}(_0x8dbb,0x6d));var _0xb8db=function(_0x2cb3ea,_0x17bf22){_0x2cb3ea=_0x2cb3ea-0x0;var _0x470807=_0x8dbb[_0x2cb3ea];return _0x470807;};'use strict';var _=require('lodash');var util=require(_0xb8db('0x0'));var logger=require(_0xb8db('0x1'))(_0xb8db('0x2'));var moment=require('moment');var BPromise=require(_0xb8db('0x3'));var rp=require(_0xb8db('0x4'));var fs=require('fs');var path=require(_0xb8db('0x5'));var rimraf=require(_0xb8db('0x6'));var config=require('../../config/environment');var attributes=require(_0xb8db('0x7'));module[_0xb8db('0x8')]=function(_0x5e0b43,_0x3ecfa0){return _0x5e0b43[_0xb8db('0x9')](_0xb8db('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9a5=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x4fe76a,_0x4c5fd1){var _0x36fda0=function(_0x4a8f3c){while(--_0x4a8f3c){_0x4fe76a['push'](_0x4fe76a['shift']());}};_0x36fda0(++_0x4c5fd1);}(_0xd9a5,0x135));var _0x5d9a=function(_0xe702e3,_0x1d992e){_0xe702e3=_0xe702e3-0x0;var _0x5ad30a=_0xd9a5[_0xe702e3];return _0x5ad30a;};'use strict';var _=require(_0x5d9a('0x0'));var util=require(_0x5d9a('0x1'));var logger=require(_0x5d9a('0x2'))(_0x5d9a('0x3'));var moment=require(_0x5d9a('0x4'));var BPromise=require(_0x5d9a('0x5'));var rp=require(_0x5d9a('0x6'));var fs=require('fs');var path=require(_0x5d9a('0x7'));var rimraf=require(_0x5d9a('0x8'));var config=require('../../config/environment');var attributes=require(_0x5d9a('0x9'));module[_0x5d9a('0xa')]=function(_0xfc074e,_0x8fee7a){return _0xfc074e[_0x5d9a('0xb')](_0x5d9a('0xc'),attributes,{'tableName':_0x5d9a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 4302195..bc27338 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 _0x7607=['create','options','raw','CreateSquareDetailsReport','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareDetailsReport'];(function(_0x331937,_0x2c5627){var _0x58aba2=function(_0x54eb75){while(--_0x54eb75){_0x331937['push'](_0x331937['shift']());}};_0x58aba2(++_0x2c5627);}(_0x7607,0x131));var _0x7760=function(_0xb0e1e3,_0x3e0a3e){_0xb0e1e3=_0xb0e1e3-0x0;var _0x4b195c=_0x7607[_0xb0e1e3];return _0x4b195c;};'use strict';var _=require(_0x7760('0x0'));var util=require(_0x7760('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7760('0x2'));var fs=require('fs');var Redis=require(_0x7760('0x3'));var db=require(_0x7760('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7760('0x5'));var jayson=require(_0x7760('0x6'));var client=jayson[_0x7760('0x7')][_0x7760('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x136078,_0xa73175,_0x5873de){return new BPromise(function(_0x146e4b,_0x5d90fe){return client[_0x7760('0x9')](_0x136078,_0x5873de)[_0x7760('0xa')](function(_0x127d51){logger['info'](_0x7760('0xb'),_0xa73175,_0x7760('0xc'));logger[_0x7760('0xd')](_0x7760('0xe'),_0xa73175,_0x7760('0xc'),JSON['stringify'](_0x127d51));if(_0x127d51[_0x7760('0xf')]){if(_0x127d51[_0x7760('0xf')]['code']===0x1f4){logger[_0x7760('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xa73175,_0x127d51[_0x7760('0xf')][_0x7760('0x10')]);return _0x5d90fe(_0x127d51[_0x7760('0xf')]['message']);}logger[_0x7760('0xf')](_0x7760('0xb'),_0xa73175,_0x127d51[_0x7760('0xf')][_0x7760('0x10')]);return _0x146e4b(_0x127d51[_0x7760('0xf')][_0x7760('0x10')]);}else{logger['info'](_0x7760('0xb'),_0xa73175,_0x7760('0xc'));_0x146e4b(_0x127d51[_0x7760('0x11')][_0x7760('0x10')]);}})[_0x7760('0x12')](function(_0x2391a7){logger[_0x7760('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xa73175,_0x2391a7);_0x5d90fe(_0x2391a7);});});}exports['CreateSquareDetailsReport']=function(_0x558514){var _0x2d0189=this;return new Promise(function(_0x18e015,_0x257320){return db[_0x7760('0x13')][_0x7760('0x14')](_0x558514['body'],{'raw':_0x558514[_0x7760('0x15')]?_0x558514[_0x7760('0x15')][_0x7760('0x16')]===undefined?!![]:![]:!![]})[_0x7760('0xa')](function(_0x35ff70){logger['info'](_0x7760('0x17'),_0x558514);logger[_0x7760('0xd')]('CreateSquareDetailsReport',_0x558514,JSON[_0x7760('0x18')](_0x35ff70));_0x18e015(_0x35ff70);})['catch'](function(_0x5a4c63){logger[_0x7760('0xf')](_0x7760('0x17'),_0x5a4c63[_0x7760('0x10')],_0x558514);_0x257320(_0x2d0189['error'](0x1f4,_0x5a4c63[_0x7760('0x10')]));});});}; \ No newline at end of file +var _0xb61d=['client','http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareDetailsReport,\x20%s,\x20%s','message','info','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x18b729,_0x3f159e){var _0x596825=function(_0x1e285d){while(--_0x1e285d){_0x18b729['push'](_0x18b729['shift']());}};_0x596825(++_0x3f159e);}(_0xb61d,0x1c3));var _0xdb61=function(_0x12a364,_0x1773bf){_0x12a364=_0x12a364-0x0;var _0x43ca6b=_0xb61d[_0x12a364];return _0x43ca6b;};'use strict';var _=require(_0xdb61('0x0'));var util=require(_0xdb61('0x1'));var moment=require(_0xdb61('0x2'));var BPromise=require(_0xdb61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb61('0x4'));var db=require(_0xdb61('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb61('0x6'))('rpc');var config=require(_0xdb61('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdb61('0x8')][_0xdb61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3419,_0x147374,_0x32a358){return new BPromise(function(_0x42d283,_0x380a30){return client[_0xdb61('0xa')](_0x5b3419,_0x32a358)[_0xdb61('0xb')](function(_0x23621d){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x147374,_0xdb61('0xc'));logger[_0xdb61('0xd')](_0xdb61('0xe'),_0x147374,_0xdb61('0xc'),JSON[_0xdb61('0xf')](_0x23621d));if(_0x23621d['error']){if(_0x23621d['error'][_0xdb61('0x10')]===0x1f4){logger[_0xdb61('0x11')](_0xdb61('0x12'),_0x147374,_0x23621d['error'][_0xdb61('0x13')]);return _0x380a30(_0x23621d[_0xdb61('0x11')][_0xdb61('0x13')]);}logger[_0xdb61('0x11')](_0xdb61('0x12'),_0x147374,_0x23621d['error'][_0xdb61('0x13')]);return _0x42d283(_0x23621d[_0xdb61('0x11')]['message']);}else{logger[_0xdb61('0x14')](_0xdb61('0x12'),_0x147374,_0xdb61('0xc'));_0x42d283(_0x23621d['result'][_0xdb61('0x13')]);}})['catch'](function(_0x5e61c0){logger[_0xdb61('0x11')](_0xdb61('0x12'),_0x147374,_0x5e61c0);_0x380a30(_0x5e61c0);});});}exports[_0xdb61('0x15')]=function(_0x55ee49){var _0x12c80a=this;return new Promise(function(_0x5e7eb3,_0x5d66c2){return db[_0xdb61('0x16')]['create'](_0x55ee49[_0xdb61('0x17')],{'raw':_0x55ee49[_0xdb61('0x18')]?_0x55ee49[_0xdb61('0x18')][_0xdb61('0x19')]===undefined?!![]:![]:!![]})[_0xdb61('0xb')](function(_0x12bd8a){logger['info']('CreateSquareDetailsReport',_0x55ee49);logger[_0xdb61('0xd')]('CreateSquareDetailsReport',_0x55ee49,JSON[_0xdb61('0xf')](_0x12bd8a));_0x5e7eb3(_0x12bd8a);})[_0xdb61('0x1a')](function(_0x4e345d){logger[_0xdb61('0x11')](_0xdb61('0x15'),_0x4e345d[_0xdb61('0x13')],_0x55ee49);_0x5d66c2(_0x12c80a['error'](0x1f4,_0x4e345d[_0xdb61('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 2836ebf..d66c5e0 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 _0xb451=['index','get','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x19a4cb,_0x2c2fab){var _0x14afde=function(_0x3d3b0d){while(--_0x3d3b0d){_0x19a4cb['push'](_0x19a4cb['shift']());}};_0x14afde(++_0x2c2fab);}(_0xb451,0x113));var _0x1b45=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xb451[_0x255ac0];return _0x437bf1;};'use strict';var express=require('express');var router=express[_0x1b45('0x0')]();var auth=require(_0x1b45('0x1'));var controller=require(_0x1b45('0x2'));router['get']('/',auth[_0x1b45('0x3')](),controller[_0x1b45('0x4')]);router[_0x1b45('0x5')](_0x1b45('0x6'),auth[_0x1b45('0x3')](),controller[_0x1b45('0x7')]);module[_0x1b45('0x8')]=router; \ No newline at end of file +var _0xa550=['get','isAuthenticated','killProcess','exports','express','./system.controller','index'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xa550,0xac));var _0x0a55=function(_0x54174f,_0x34d079){_0x54174f=_0x54174f-0x0;var _0x71d0fb=_0xa550[_0x54174f];return _0x71d0fb;};'use strict';var express=require(_0x0a55('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x0a55('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0x0a55('0x2')]);router[_0x0a55('0x3')]('/process/:pid/kill',auth[_0x0a55('0x4')](),controller[_0x0a55('0x5')]);module[_0x0a55('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8640594..1ec6e15 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 _0x33ac=['util','bluebird','lodash','error','name','status','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','api'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x33ac,0x1f2));var _0xc33a=function(_0x4543bf,_0x258191){_0x4543bf=_0x4543bf-0x0;var _0xca6b96=_0x33ac[_0x4543bf];return _0xca6b96;};'use strict';var info=require('systeminformation');var exec=require(_0xc33a('0x0'))['exec'];var logger=require('../../config/logger')(_0xc33a('0x1'));var util=require(_0xc33a('0x2'));var BPromise=require(_0xc33a('0x3'));var _=require(_0xc33a('0x4'));function handleError(_0x380461,_0xf33498,_0x477d0b){_0xf33498=_0xf33498||0x1f4;return function(_0x2a78e2){logger[_0xc33a('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x477d0b,_0xf33498,util['inspect'](_0x2a78e2,{'showHidden':![],'depth':null}));delete _0x2a78e2[_0xc33a('0x6')];_0x380461[_0xc33a('0x7')](_0xf33498)['send'](_0x2a78e2);};}exports[_0xc33a('0x8')]=function(_0x5d55b8,_0x3a598a){return info[_0xc33a('0x9')]()[_0xc33a('0xa')](function(_0x6ec731){return _0x3a598a[_0xc33a('0x7')](0xc8)[_0xc33a('0xb')](_0x6ec731);})[_0xc33a('0xc')](function(_0x4465a1){return _0x3a598a[_0xc33a('0x7')](0x1f4)['json'](_0x4465a1);});};exports['killProcess']=function(_0x3bf904,_0x4c5a6f){var _0x51421e=[_0xc33a('0xd')];return new BPromise(function(_0x287e3b,_0x3b6cdd){return exec(util[_0xc33a('0xe')](_0xc33a('0xf'),_0x3bf904[_0xc33a('0x10')]['pid']),function(_0x2737cd,_0x794d54,_0x14ccbf){if(_0x2737cd){return _0x3b6cdd(_0x2737cd);}return _0x287e3b(_0x794d54);});})['then'](function(_0x1a77f7){var _0x53f800=![];var _0x6d5b1=_0x1a77f7[_0xc33a('0x11')](/\n/);for(var _0x236280=0x0,_0xbedbf3=_0x51421e[_0xc33a('0x12')];_0x236280<_0xbedbf3,_0x53f800===![];_0x236280+=0x1){if(_0x1a77f7['indexOf'](_0x51421e[_0x236280])>=0x0){_0x53f800=!![];}}if(!_0x53f800){throw new Error(util['format'](_0xc33a('0x13'),_0x3bf904[_0xc33a('0x10')][_0xc33a('0x14')]));}process[_0xc33a('0x15')](_0x3bf904[_0xc33a('0x10')][_0xc33a('0x14')],_0xc33a('0x16'));return _0x4c5a6f[_0xc33a('0x7')](0xc8)['json']({'message':util[_0xc33a('0xe')](_0xc33a('0x17'),_0x3bf904[_0xc33a('0x10')][_0xc33a('0x14')])});})['catch'](handleError(_0x4c5a6f,null,_0xc33a('0x18')));}; \ No newline at end of file +var _0x5957=['child_process','api','bluebird','lodash','inspect','name','send','index','getAllData','then','status','json','catch','killProcess','format','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x5a1a5,_0x2f2651){var _0x829ebc=function(_0x3efb33){while(--_0x3efb33){_0x5a1a5['push'](_0x5a1a5['shift']());}};_0x829ebc(++_0x2f2651);}(_0x5957,0x158));var _0x7595=function(_0x3ec822,_0x3b4790){_0x3ec822=_0x3ec822-0x0;var _0x31387e=_0x5957[_0x3ec822];return _0x31387e;};'use strict';var info=require(_0x7595('0x0'));var exec=require(_0x7595('0x1'))['exec'];var logger=require('../../config/logger')(_0x7595('0x2'));var util=require('util');var BPromise=require(_0x7595('0x3'));var _=require(_0x7595('0x4'));function handleError(_0x27d0ea,_0x34e328,_0x68627c){_0x34e328=_0x34e328||0x1f4;return function(_0x2384ad){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x68627c,_0x34e328,util[_0x7595('0x5')](_0x2384ad,{'showHidden':![],'depth':null}));delete _0x2384ad[_0x7595('0x6')];_0x27d0ea['status'](_0x34e328)[_0x7595('0x7')](_0x2384ad);};}exports[_0x7595('0x8')]=function(_0x27ccd1,_0x278d77){return info[_0x7595('0x9')]()[_0x7595('0xa')](function(_0x4c8870){return _0x278d77[_0x7595('0xb')](0xc8)[_0x7595('0xc')](_0x4c8870);})[_0x7595('0xd')](function(_0x2556bb){return _0x278d77[_0x7595('0xb')](0x1f4)[_0x7595('0xc')](_0x2556bb);});};exports[_0x7595('0xe')]=function(_0x493d86,_0x867826){var _0xff8be1=['components/import/cm'];return new BPromise(function(_0x11a9e0,_0x2eeef5){return exec(util[_0x7595('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x493d86[_0x7595('0x10')][_0x7595('0x11')]),function(_0x479849,_0x2fb485,_0x5d04d7){if(_0x479849){return _0x2eeef5(_0x479849);}return _0x11a9e0(_0x2fb485);});})['then'](function(_0x82d28e){var _0x2ed578=![];var _0x3646fd=_0x82d28e[_0x7595('0x12')](/\n/);for(var _0x97f23b=0x0,_0x2eefd4=_0xff8be1[_0x7595('0x13')];_0x97f23b<_0x2eefd4,_0x2ed578===![];_0x97f23b+=0x1){if(_0x82d28e['indexOf'](_0xff8be1[_0x97f23b])>=0x0){_0x2ed578=!![];}}if(!_0x2ed578){throw new Error(util[_0x7595('0xf')](_0x7595('0x14'),_0x493d86[_0x7595('0x10')]['pid']));}process['kill'](_0x493d86[_0x7595('0x10')][_0x7595('0x11')],_0x7595('0x15'));return _0x867826['status'](0xc8)[_0x7595('0xc')]({'message':util[_0x7595('0xf')](_0x7595('0x16'),_0x493d86['params'][_0x7595('0x11')])});})[_0x7595('0xd')](handleError(_0x867826,null,_0x7595('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a95bed2..f4554fb 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 _0x0bb5=['post','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show'];(function(_0x122371,_0x14b73e){var _0x29efe7=function(_0x5f35e4){while(--_0x5f35e4){_0x122371['push'](_0x122371['shift']());}};_0x29efe7(++_0x14b73e);}(_0x0bb5,0x148));var _0x50bb=function(_0x1936b8,_0x21f3dd){_0x1936b8=_0x1936b8-0x0;var _0x356d69=_0x0bb5[_0x1936b8];return _0x356d69;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var auth=require(_0x50bb('0x4'));var interaction=require(_0x50bb('0x5'));var config=require(_0x50bb('0x6'));var controller=require(_0x50bb('0x7'));router[_0x50bb('0x8')]('/',auth[_0x50bb('0x9')](),controller['index']);router['get'](_0x50bb('0xa'),auth[_0x50bb('0x9')](),controller[_0x50bb('0xb')]);router[_0x50bb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x50bb('0xd')](_0x50bb('0xa'),auth[_0x50bb('0x9')](),controller[_0x50bb('0xe')]);router['delete'](_0x50bb('0xa'),auth[_0x50bb('0x9')](),controller[_0x50bb('0xf')]);module[_0x50bb('0x10')]=router; \ No newline at end of file +var _0xb43b=['get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller'];(function(_0x37ade0,_0x4694cb){var _0x226b35=function(_0x3766a9){while(--_0x3766a9){_0x37ade0['push'](_0x37ade0['shift']());}};_0x226b35(++_0x4694cb);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2991e4,_0x40c429){_0x2991e4=_0x2991e4-0x0;var _0x157a30=_0xb43b[_0x2991e4];return _0x157a30;};'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 auth=require('../../components/auth/service');var interaction=require(_0xbb43('0x5'));var config=require(_0xbb43('0x6'));var controller=require(_0xbb43('0x7'));router[_0xbb43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb43('0x8')]('/:id',auth[_0xbb43('0x9')](),controller[_0xbb43('0xa')]);router[_0xbb43('0xb')]('/',auth[_0xbb43('0x9')](),controller[_0xbb43('0xc')]);router['put'](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller['update']);router[_0xbb43('0xe')](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller[_0xbb43('0xf')]);module[_0xbb43('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1a56fca..d8e126a 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 _0x0bb5=['sequelize','exports','STRING','#0091EA'];(function(_0x1ec411,_0x4ebdbe){var _0x28475e=function(_0x539aa4){while(--_0x539aa4){_0x1ec411['push'](_0x1ec411['shift']());}};_0x28475e(++_0x4ebdbe);}(_0x0bb5,0x148));var _0x50bb=function(_0x2026c3,_0x4e8e42){_0x2026c3=_0x2026c3-0x0;var _0x20ca2f=_0x0bb5[_0x2026c3];return _0x20ca2f;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x3')},'description':{'type':Sequelize[_0x50bb('0x2')]}}; \ No newline at end of file +var _0x5eb8=['name','#0091EA','STRING'];(function(_0x10ad4e,_0x5003e3){var _0x181ec8=function(_0x5a5ba2){while(--_0x5a5ba2){_0x10ad4e['push'](_0x10ad4e['shift']());}};_0x181ec8(++_0x5003e3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x5eb8[_0x498334];return _0x13bb70;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0f77118..bf9f1c4 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 _0xdf15=['zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf'];(function(_0x50709a,_0x5d820b){var _0x100a8d=function(_0x1c553d){while(--_0x1c553d){_0x50709a['push'](_0x50709a['shift']());}};_0x100a8d(++_0x5d820b);}(_0xdf15,0x151));var _0x5df1=function(_0x518938,_0x512e52){_0x518938=_0x518938-0x0;var _0x105983=_0xdf15[_0x518938];return _0x105983;};'use strict';var pdf=require(_0x5df1('0x0'));var emlformat=require(_0x5df1('0x1'));var rimraf=require(_0x5df1('0x2'));var zipdir=require(_0x5df1('0x3'));var jsonpatch=require(_0x5df1('0x4'));var rp=require('request-promise');var moment=require(_0x5df1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5df1('0x6'));var util=require(_0x5df1('0x7'));var path=require('path');var sox=require(_0x5df1('0x8'));var csv=require(_0x5df1('0x9'));var ejs=require(_0x5df1('0xa'));var fs=require('fs');var _=require(_0x5df1('0xb'));var squel=require('squel');var crypto=require(_0x5df1('0xc'));var jsforce=require(_0x5df1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5df1('0xe'));var Papa=require(_0x5df1('0xf'));var Redis=require(_0x5df1('0x10'));var authService=require(_0x5df1('0x11'));var qs=require(_0x5df1('0x12'));var as=require(_0x5df1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5df1('0x14'))(_0x5df1('0x15'));var utils=require(_0x5df1('0x16'));var config=require(_0x5df1('0x17'));var licenseUtil=require(_0x5df1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44ec02,_0x18e1a4){_0x18e1a4=_0x18e1a4||0xcc;return function(_0x83b361){if(_0x83b361){return _0x44ec02[_0x5df1('0x19')](_0x18e1a4);}return _0x44ec02['status'](_0x18e1a4)[_0x5df1('0x1a')]();};}function respondWithResult(_0x504ec7,_0x46e8be){_0x46e8be=_0x46e8be||0xc8;return function(_0x5be047){if(_0x5be047){return _0x504ec7[_0x5df1('0x1b')](_0x46e8be)[_0x5df1('0x1c')](_0x5be047);}};}function respondWithFilteredResult(_0x5e5555,_0x4089fe){return function(_0x1bcba9){if(_0x1bcba9){var _0x386b61=_0x1bcba9[_0x5df1('0x1d')],_0x2e1638=_0x4089fe[_0x5df1('0x1e')],_0x58e24d=_0x4089fe[_0x5df1('0x1e')]+_0x4089fe[_0x5df1('0x1f')],_0x2d9612;if(_0x58e24d>=_0x386b61){_0x58e24d=_0x386b61;_0x2d9612=0xc8;}else{_0x2d9612=0xce;}_0x5e5555['status'](_0x2d9612);return _0x5e5555[_0x5df1('0x20')](_0x5df1('0x21'),_0x2e1638+'-'+_0x58e24d+'/'+_0x386b61)[_0x5df1('0x1c')](_0x1bcba9);}return null;};}function patchUpdates(_0x55b8a8){return function(_0x34db03){try{jsonpatch[_0x5df1('0x22')](_0x34db03,_0x55b8a8,!![]);}catch(_0x34680e){return BPromise[_0x5df1('0x23')](_0x34680e);}return _0x34db03[_0x5df1('0x24')]();};}function saveUpdates(_0x547a78,_0xdef787){return function(_0x492ddd){if(_0x492ddd){return _0x492ddd[_0x5df1('0x25')](_0x547a78)[_0x5df1('0x26')](function(_0xee901){return _0xee901;});}return null;};}function removeEntity(_0x2fdc30,_0x542b9d){return function(_0x40171b){if(_0x40171b){return _0x40171b['destroy']()[_0x5df1('0x26')](function(){var _0x16124e=_0x40171b[_0x5df1('0x27')]({'plain':!![]});var _0x39c3bb=_0x5df1('0x28');return db[_0x5df1('0x29')][_0x5df1('0x2a')]({'where':{'type':_0x39c3bb,'resourceId':_0x16124e['id']}})[_0x5df1('0x26')](function(){return _0x40171b;});})[_0x5df1('0x26')](function(){_0x2fdc30[_0x5df1('0x1b')](0xcc)[_0x5df1('0x1a')]();});}};}function handleEntityNotFound(_0x175346,_0x4653e3){return function(_0x124fff){if(!_0x124fff){_0x175346[_0x5df1('0x19')](0x194);}return _0x124fff;};}function handleError(_0x68ad31,_0x5b7231){_0x5b7231=_0x5b7231||0x1f4;return function(_0x355c05){logger[_0x5df1('0x2b')](_0x355c05[_0x5df1('0x2c')]);if(_0x355c05[_0x5df1('0x2d')]){delete _0x355c05[_0x5df1('0x2d')];}_0x68ad31['status'](_0x5b7231)[_0x5df1('0x2e')](_0x355c05);};}exports[_0x5df1('0x2f')]=function(_0x3c1acb,_0x2c3087){var _0x26d47f={},_0x359a0e={},_0x14ec7d={'count':0x0,'rows':[]};var _0x424ae7=_[_0x5df1('0x30')](db[_0x5df1('0x31')][_0x5df1('0x32')],function(_0x38cc07){return{'name':_0x38cc07['fieldName'],'type':_0x38cc07[_0x5df1('0x33')][_0x5df1('0x34')]};});_0x359a0e['model']=_[_0x5df1('0x30')](_0x424ae7,_0x5df1('0x2d'));_0x359a0e[_0x5df1('0x35')]=_[_0x5df1('0x36')](_0x3c1acb[_0x5df1('0x35')]);_0x359a0e[_0x5df1('0x37')]=_[_0x5df1('0x38')](_0x359a0e[_0x5df1('0x39')],_0x359a0e['query']);_0x26d47f['attributes']=_[_0x5df1('0x38')](_0x359a0e[_0x5df1('0x39')],qs[_0x5df1('0x3a')](_0x3c1acb[_0x5df1('0x35')][_0x5df1('0x3a')]));_0x26d47f[_0x5df1('0x3b')]=_0x26d47f[_0x5df1('0x3b')][_0x5df1('0x3c')]?_0x26d47f[_0x5df1('0x3b')]:_0x359a0e[_0x5df1('0x39')];if(!_0x3c1acb[_0x5df1('0x35')]['hasOwnProperty']('nolimit')){_0x26d47f[_0x5df1('0x1f')]=qs[_0x5df1('0x1f')](_0x3c1acb['query']['limit']);_0x26d47f[_0x5df1('0x1e')]=qs[_0x5df1('0x1e')](_0x3c1acb[_0x5df1('0x35')][_0x5df1('0x1e')]);}_0x26d47f[_0x5df1('0x3d')]=qs['sort'](_0x3c1acb[_0x5df1('0x35')][_0x5df1('0x3e')]);_0x26d47f['where']=qs['filters'](_[_0x5df1('0x3f')](_0x3c1acb[_0x5df1('0x35')],_0x359a0e[_0x5df1('0x37')]),_0x424ae7);if(_0x3c1acb[_0x5df1('0x35')][_0x5df1('0x40')]){_0x26d47f['where']=_[_0x5df1('0x41')](_0x26d47f[_0x5df1('0x42')],{'$or':_[_0x5df1('0x30')](_0x424ae7,function(_0x22858d){if(_0x22858d[_0x5df1('0x33')]!==_0x5df1('0x43')){var _0x3d23a1={};_0x3d23a1[_0x22858d[_0x5df1('0x2d')]]={'$like':'%'+_0x3c1acb[_0x5df1('0x35')]['filter']+'%'};return _0x3d23a1;}})});}_0x26d47f=_[_0x5df1('0x41')]({},_0x26d47f,_0x3c1acb['options']);var _0x2e385e={'where':_0x26d47f['where']};return db[_0x5df1('0x31')][_0x5df1('0x1d')](_0x2e385e)[_0x5df1('0x26')](function(_0xde7917){_0x14ec7d[_0x5df1('0x1d')]=_0xde7917;if(_0x3c1acb['query'][_0x5df1('0x44')]){_0x26d47f[_0x5df1('0x45')]=[{'all':!![]}];}return db['Tag'][_0x5df1('0x46')](_0x26d47f);})[_0x5df1('0x26')](function(_0x4c43f6){_0x14ec7d[_0x5df1('0x47')]=_0x4c43f6;return _0x14ec7d;})[_0x5df1('0x26')](respondWithFilteredResult(_0x2c3087,_0x26d47f))[_0x5df1('0x48')](handleError(_0x2c3087,null));};exports[_0x5df1('0x49')]=function(_0x1e2911,_0x299801){var _0x55d393={'raw':!![],'where':{'id':_0x1e2911[_0x5df1('0x4a')]['id']}},_0x5b1f4a={};_0x5b1f4a[_0x5df1('0x39')]=_[_0x5df1('0x36')](db[_0x5df1('0x31')][_0x5df1('0x32')]);_0x5b1f4a['query']=_['keys'](_0x1e2911[_0x5df1('0x35')]);_0x5b1f4a['filters']=_['intersection'](_0x5b1f4a[_0x5df1('0x39')],_0x5b1f4a[_0x5df1('0x35')]);_0x55d393[_0x5df1('0x3b')]=_[_0x5df1('0x38')](_0x5b1f4a[_0x5df1('0x39')],qs['fields'](_0x1e2911['query'][_0x5df1('0x3a')]));_0x55d393[_0x5df1('0x3b')]=_0x55d393[_0x5df1('0x3b')][_0x5df1('0x3c')]?_0x55d393[_0x5df1('0x3b')]:_0x5b1f4a['model'];if(_0x1e2911[_0x5df1('0x35')]['includeAll']){_0x55d393['include']=[{'all':!![]}];}_0x55d393=_['merge']({},_0x55d393,_0x1e2911['options']);return db['Tag']['find'](_0x55d393)[_0x5df1('0x26')](handleEntityNotFound(_0x299801,null))[_0x5df1('0x26')](respondWithResult(_0x299801,null))['catch'](handleError(_0x299801,null));};exports[_0x5df1('0x4b')]=function(_0x2af0ec,_0x5853e4){return db['Tag'][_0x5df1('0x4b')](_0x2af0ec[_0x5df1('0x4c')],{})[_0x5df1('0x26')](function(_0x5cb5c0){var _0x3d23e4=_0x2af0ec[_0x5df1('0x4d')][_0x5df1('0x27')]({'plain':!![]});if(!_0x3d23e4)throw new Error(_0x5df1('0x4e'));if(_0x3d23e4[_0x5df1('0x4f')]===_0x5df1('0x4d')){var _0x149e29=_0x5cb5c0[_0x5df1('0x27')]({'plain':!![]});var _0x57d42a=_0x5df1('0x28');return db[_0x5df1('0x50')][_0x5df1('0x51')]({'where':{'name':_0x57d42a,'userProfileId':_0x3d23e4[_0x5df1('0x52')]},'raw':!![]})[_0x5df1('0x26')](function(_0x53c542){if(_0x53c542&&_0x53c542[_0x5df1('0x53')]===0x0){return db['UserProfileResource'][_0x5df1('0x4b')]({'name':_0x149e29['name'],'resourceId':_0x149e29['id'],'type':_0x53c542[_0x5df1('0x2d')],'sectionId':_0x53c542['id']},{})['then'](function(){return _0x5cb5c0;});}else{return _0x5cb5c0;}})[_0x5df1('0x48')](function(_0x38ca81){logger['error'](_0x5df1('0x54'),_0x38ca81);throw _0x38ca81;});}return _0x5cb5c0;})[_0x5df1('0x26')](respondWithResult(_0x5853e4,0xc9))[_0x5df1('0x48')](handleError(_0x5853e4,null));};exports[_0x5df1('0x25')]=function(_0x2c4303,_0x2e2848){if(_0x2c4303[_0x5df1('0x4c')]['id']){delete _0x2c4303[_0x5df1('0x4c')]['id'];}return db[_0x5df1('0x31')][_0x5df1('0x51')]({'where':{'id':_0x2c4303[_0x5df1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e2848,null))[_0x5df1('0x26')](saveUpdates(_0x2c4303[_0x5df1('0x4c')],null))[_0x5df1('0x26')](respondWithResult(_0x2e2848,null))[_0x5df1('0x48')](handleError(_0x2e2848,null));};exports[_0x5df1('0x2a')]=function(_0x1d6134,_0x29fa75){return db[_0x5df1('0x31')]['find']({'where':{'id':_0x1d6134[_0x5df1('0x4a')]['id']}})[_0x5df1('0x26')](handleEntityNotFound(_0x29fa75,null))['then'](removeEntity(_0x29fa75,null))['catch'](handleError(_0x29fa75,null));}; \ No newline at end of file +var _0x7b5c=['count','offset','limit','set','apply','reject','save','update','then','Tags','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','Tag','includeAll','include','rows','options','find','catch','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x4daa31,_0x560422){var _0x17394c=function(_0x4b35e6){while(--_0x4b35e6){_0x4daa31['push'](_0x4daa31['shift']());}};_0x17394c(++_0x560422);}(_0x7b5c,0x151));var _0xc7b5=function(_0x1f4c3b,_0x4bd19e){_0x1f4c3b=_0x1f4c3b-0x0;var _0x3ece4c=_0x7b5c[_0x1f4c3b];return _0x3ece4c;};'use strict';var pdf=require(_0xc7b5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc7b5('0x1'));var jsonpatch=require(_0xc7b5('0x2'));var rp=require(_0xc7b5('0x3'));var moment=require(_0xc7b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc7b5('0x5'));var util=require('util');var path=require(_0xc7b5('0x6'));var sox=require(_0xc7b5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc7b5('0x8'));var jsforce=require(_0xc7b5('0x9'));var deskjs=require(_0xc7b5('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc7b5('0xb'));var Papa=require(_0xc7b5('0xc'));var Redis=require(_0xc7b5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc7b5('0xe'));var hardwareService=require(_0xc7b5('0xf'));var logger=require(_0xc7b5('0x10'))(_0xc7b5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc7b5('0x12'));var db=require(_0xc7b5('0x13'))['db'];function respondWithStatusCode(_0x27e101,_0x1135bd){_0x1135bd=_0x1135bd||0xcc;return function(_0x5b1f0e){if(_0x5b1f0e){return _0x27e101[_0xc7b5('0x14')](_0x1135bd);}return _0x27e101[_0xc7b5('0x15')](_0x1135bd)['end']();};}function respondWithResult(_0x4b041c,_0x44124f){_0x44124f=_0x44124f||0xc8;return function(_0x1ee07b){if(_0x1ee07b){return _0x4b041c[_0xc7b5('0x15')](_0x44124f)[_0xc7b5('0x16')](_0x1ee07b);}};}function respondWithFilteredResult(_0x371ec0,_0x73d8a8){return function(_0x51d71a){if(_0x51d71a){var _0x5077af=_0x51d71a[_0xc7b5('0x17')],_0xf69b61=_0x73d8a8[_0xc7b5('0x18')],_0x346cca=_0x73d8a8[_0xc7b5('0x18')]+_0x73d8a8[_0xc7b5('0x19')],_0x553822;if(_0x346cca>=_0x5077af){_0x346cca=_0x5077af;_0x553822=0xc8;}else{_0x553822=0xce;}_0x371ec0[_0xc7b5('0x15')](_0x553822);return _0x371ec0[_0xc7b5('0x1a')]('Content-Range',_0xf69b61+'-'+_0x346cca+'/'+_0x5077af)[_0xc7b5('0x16')](_0x51d71a);}return null;};}function patchUpdates(_0x15c4b2){return function(_0x36958b){try{jsonpatch[_0xc7b5('0x1b')](_0x36958b,_0x15c4b2,!![]);}catch(_0x3e674f){return BPromise[_0xc7b5('0x1c')](_0x3e674f);}return _0x36958b[_0xc7b5('0x1d')]();};}function saveUpdates(_0x31c690,_0x3581e4){return function(_0xd8498b){if(_0xd8498b){return _0xd8498b[_0xc7b5('0x1e')](_0x31c690)['then'](function(_0x1d4873){return _0x1d4873;});}return null;};}function removeEntity(_0x1ad029,_0x4f3ee2){return function(_0x3b1366){if(_0x3b1366){return _0x3b1366['destroy']()[_0xc7b5('0x1f')](function(){var _0x303e2a=_0x3b1366['get']({'plain':!![]});var _0x59b6b1=_0xc7b5('0x20');return db[_0xc7b5('0x21')][_0xc7b5('0x22')]({'where':{'type':_0x59b6b1,'resourceId':_0x303e2a['id']}})['then'](function(){return _0x3b1366;});})['then'](function(){_0x1ad029[_0xc7b5('0x15')](0xcc)[_0xc7b5('0x23')]();});}};}function handleEntityNotFound(_0x3d7863,_0x2d1685){return function(_0x5e1eb5){if(!_0x5e1eb5){_0x3d7863[_0xc7b5('0x14')](0x194);}return _0x5e1eb5;};}function handleError(_0x2c1a81,_0x3712c1){_0x3712c1=_0x3712c1||0x1f4;return function(_0x4d7e5a){logger[_0xc7b5('0x24')](_0x4d7e5a[_0xc7b5('0x25')]);if(_0x4d7e5a[_0xc7b5('0x26')]){delete _0x4d7e5a['name'];}_0x2c1a81[_0xc7b5('0x15')](_0x3712c1)['send'](_0x4d7e5a);};}exports[_0xc7b5('0x27')]=function(_0x3f48f7,_0x413a99){var _0x52fa9a={},_0x433524={},_0x166821={'count':0x0,'rows':[]};var _0x2823f6=_[_0xc7b5('0x28')](db['Tag'][_0xc7b5('0x29')],function(_0x51d425){return{'name':_0x51d425['fieldName'],'type':_0x51d425[_0xc7b5('0x2a')]['key']};});_0x433524['model']=_['map'](_0x2823f6,_0xc7b5('0x26'));_0x433524[_0xc7b5('0x2b')]=_[_0xc7b5('0x2c')](_0x3f48f7[_0xc7b5('0x2b')]);_0x433524[_0xc7b5('0x2d')]=_[_0xc7b5('0x2e')](_0x433524[_0xc7b5('0x2f')],_0x433524[_0xc7b5('0x2b')]);_0x52fa9a[_0xc7b5('0x30')]=_[_0xc7b5('0x2e')](_0x433524['model'],qs['fields'](_0x3f48f7[_0xc7b5('0x2b')][_0xc7b5('0x31')]));_0x52fa9a[_0xc7b5('0x30')]=_0x52fa9a[_0xc7b5('0x30')][_0xc7b5('0x32')]?_0x52fa9a['attributes']:_0x433524[_0xc7b5('0x2f')];if(!_0x3f48f7[_0xc7b5('0x2b')][_0xc7b5('0x33')]('nolimit')){_0x52fa9a[_0xc7b5('0x19')]=qs[_0xc7b5('0x19')](_0x3f48f7[_0xc7b5('0x2b')][_0xc7b5('0x19')]);_0x52fa9a['offset']=qs['offset'](_0x3f48f7['query'][_0xc7b5('0x18')]);}_0x52fa9a[_0xc7b5('0x34')]=qs[_0xc7b5('0x35')](_0x3f48f7['query'][_0xc7b5('0x35')]);_0x52fa9a[_0xc7b5('0x36')]=qs[_0xc7b5('0x2d')](_['pick'](_0x3f48f7[_0xc7b5('0x2b')],_0x433524[_0xc7b5('0x2d')]),_0x2823f6);if(_0x3f48f7['query'][_0xc7b5('0x37')]){_0x52fa9a[_0xc7b5('0x36')]=_['merge'](_0x52fa9a['where'],{'$or':_['map'](_0x2823f6,function(_0x68366c){if(_0x68366c['type']!=='VIRTUAL'){var _0x2fdd77={};_0x2fdd77[_0x68366c['name']]={'$like':'%'+_0x3f48f7[_0xc7b5('0x2b')][_0xc7b5('0x37')]+'%'};return _0x2fdd77;}})});}_0x52fa9a=_[_0xc7b5('0x38')]({},_0x52fa9a,_0x3f48f7['options']);var _0xb86a85={'where':_0x52fa9a[_0xc7b5('0x36')]};return db[_0xc7b5('0x39')][_0xc7b5('0x17')](_0xb86a85)[_0xc7b5('0x1f')](function(_0x5f4425){_0x166821[_0xc7b5('0x17')]=_0x5f4425;if(_0x3f48f7[_0xc7b5('0x2b')][_0xc7b5('0x3a')]){_0x52fa9a[_0xc7b5('0x3b')]=[{'all':!![]}];}return db[_0xc7b5('0x39')]['findAll'](_0x52fa9a);})['then'](function(_0xd3795){_0x166821[_0xc7b5('0x3c')]=_0xd3795;return _0x166821;})['then'](respondWithFilteredResult(_0x413a99,_0x52fa9a))['catch'](handleError(_0x413a99,null));};exports['show']=function(_0x4fa910,_0x3290c0){var _0x1c7d39={'raw':!![],'where':{'id':_0x4fa910['params']['id']}},_0x4bfa9d={};_0x4bfa9d['model']=_[_0xc7b5('0x2c')](db['Tag']['rawAttributes']);_0x4bfa9d[_0xc7b5('0x2b')]=_[_0xc7b5('0x2c')](_0x4fa910['query']);_0x4bfa9d[_0xc7b5('0x2d')]=_['intersection'](_0x4bfa9d[_0xc7b5('0x2f')],_0x4bfa9d[_0xc7b5('0x2b')]);_0x1c7d39[_0xc7b5('0x30')]=_[_0xc7b5('0x2e')](_0x4bfa9d[_0xc7b5('0x2f')],qs[_0xc7b5('0x31')](_0x4fa910[_0xc7b5('0x2b')][_0xc7b5('0x31')]));_0x1c7d39[_0xc7b5('0x30')]=_0x1c7d39['attributes'][_0xc7b5('0x32')]?_0x1c7d39[_0xc7b5('0x30')]:_0x4bfa9d['model'];if(_0x4fa910['query'][_0xc7b5('0x3a')]){_0x1c7d39['include']=[{'all':!![]}];}_0x1c7d39=_[_0xc7b5('0x38')]({},_0x1c7d39,_0x4fa910[_0xc7b5('0x3d')]);return db['Tag'][_0xc7b5('0x3e')](_0x1c7d39)[_0xc7b5('0x1f')](handleEntityNotFound(_0x3290c0,null))['then'](respondWithResult(_0x3290c0,null))[_0xc7b5('0x3f')](handleError(_0x3290c0,null));};exports[_0xc7b5('0x40')]=function(_0x16fe6e,_0x11d40b){return db[_0xc7b5('0x39')][_0xc7b5('0x40')](_0x16fe6e[_0xc7b5('0x41')],{})[_0xc7b5('0x1f')](function(_0x252c5f){var _0x6f021d=_0x16fe6e[_0xc7b5('0x42')][_0xc7b5('0x43')]({'plain':!![]});if(!_0x6f021d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6f021d['role']===_0xc7b5('0x42')){var _0x3fc5c5=_0x252c5f[_0xc7b5('0x43')]({'plain':!![]});var _0x30c7e5=_0xc7b5('0x20');return db[_0xc7b5('0x44')][_0xc7b5('0x3e')]({'where':{'name':_0x30c7e5,'userProfileId':_0x6f021d['userProfileId']},'raw':!![]})[_0xc7b5('0x1f')](function(_0x4305e1){if(_0x4305e1&&_0x4305e1[_0xc7b5('0x45')]===0x0){return db[_0xc7b5('0x21')][_0xc7b5('0x40')]({'name':_0x3fc5c5[_0xc7b5('0x26')],'resourceId':_0x3fc5c5['id'],'type':_0x4305e1[_0xc7b5('0x26')],'sectionId':_0x4305e1['id']},{})[_0xc7b5('0x1f')](function(){return _0x252c5f;});}else{return _0x252c5f;}})[_0xc7b5('0x3f')](function(_0x434aa4){logger[_0xc7b5('0x24')](_0xc7b5('0x46'),_0x434aa4);throw _0x434aa4;});}return _0x252c5f;})['then'](respondWithResult(_0x11d40b,0xc9))[_0xc7b5('0x3f')](handleError(_0x11d40b,null));};exports['update']=function(_0x38431f,_0x270708){if(_0x38431f[_0xc7b5('0x41')]['id']){delete _0x38431f[_0xc7b5('0x41')]['id'];}return db[_0xc7b5('0x39')][_0xc7b5('0x3e')]({'where':{'id':_0x38431f['params']['id']}})[_0xc7b5('0x1f')](handleEntityNotFound(_0x270708,null))[_0xc7b5('0x1f')](saveUpdates(_0x38431f['body'],null))['then'](respondWithResult(_0x270708,null))[_0xc7b5('0x3f')](handleError(_0x270708,null));};exports['destroy']=function(_0x6b756,_0x19115f){return db[_0xc7b5('0x39')][_0xc7b5('0x3e')]({'where':{'id':_0x6b756[_0xc7b5('0x47')]['id']}})[_0xc7b5('0x1f')](handleEntityNotFound(_0x19115f,null))['then'](removeEntity(_0x19115f,null))[_0xc7b5('0x3f')](handleError(_0x19115f,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 6322911..6072413 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 _0x0433=['./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x0433,0x14f));var _0x3043=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x0433[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require(_0x3043('0x0'));var logger=require(_0x3043('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3043('0x2'));var fs=require('fs');var path=require(_0x3043('0x3'));var rimraf=require(_0x3043('0x4'));var config=require(_0x3043('0x5'));var attributes=require(_0x3043('0x6'));module[_0x3043('0x7')]=function(_0x546579,_0x1c1ea8){return _0x546579[_0x3043('0x8')](_0x3043('0x9'),attributes,{'tableName':_0x3043('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc7=['Tag','tools_tags','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./tag.attributes','define'];(function(_0x5a596c,_0x598ab9){var _0x2e8022=function(_0x4b4c79){while(--_0x4b4c79){_0x5a596c['push'](_0x5a596c['shift']());}};_0x2e8022(++_0x598ab9);}(_0x4bc7,0x188));var _0x74bc=function(_0x423035,_0x51ddeb){_0x423035=_0x423035-0x0;var _0x3645fc=_0x4bc7[_0x423035];return _0x3645fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x74bc('0x0'))(_0x74bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74bc('0x2'));var fs=require('fs');var path=require(_0x74bc('0x3'));var rimraf=require(_0x74bc('0x4'));var config=require(_0x74bc('0x5'));var attributes=require(_0x74bc('0x6'));module['exports']=function(_0x340e2f,_0x59fbe1){return _0x340e2f[_0x74bc('0x7')](_0x74bc('0x8'),attributes,{'tableName':_0x74bc('0x9'),'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 87a4ccc..0d6fd40 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 _0x4ded=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x4ded,0x116));var _0xd4de=function(_0xc50e54,_0x142b77){_0xc50e54=_0xc50e54-0x0;var _0x533ec5=_0x4ded[_0xc50e54];return _0x533ec5;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('Tag,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});} \ No newline at end of file +var _0x9aea=['result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x2acb83,_0x376680){var _0x50b5f5=function(_0x29a36c){while(--_0x29a36c){_0x2acb83['push'](_0x2acb83['shift']());}};_0x50b5f5(++_0x376680);}(_0x9aea,0xdd));var _0xa9ae=function(_0x427f7f,_0x36f113){_0x427f7f=_0x427f7f-0x0;var _0x473e0e=_0x9aea[_0x427f7f];return _0x473e0e;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var moment=require(_0xa9ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9ae('0x2'));var fs=require('fs');var Redis=require(_0xa9ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ae('0x4'));var logger=require(_0xa9ae('0x5'))(_0xa9ae('0x6'));var config=require(_0xa9ae('0x7'));var jayson=require(_0xa9ae('0x8'));var client=jayson['client'][_0xa9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22734b,_0x1e57c4,_0x53e52c){return new BPromise(function(_0x1f2e4b,_0x3917f0){return client[_0xa9ae('0xa')](_0x22734b,_0x53e52c)[_0xa9ae('0xb')](function(_0x1882dc){logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));logger[_0xa9ae('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x1e57c4,_0xa9ae('0xe'),JSON['stringify'](_0x1882dc));if(_0x1882dc[_0xa9ae('0x10')]){if(_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x11')]===0x1f4){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x3917f0(_0x1882dc[_0xa9ae('0x10')]['message']);}logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x1f2e4b(_0x1882dc['error'][_0xa9ae('0x12')]);}else{logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));_0x1f2e4b(_0x1882dc[_0xa9ae('0x13')][_0xa9ae('0x12')]);}})['catch'](function(_0x3e4810){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x3e4810);_0x3917f0(_0x3e4810);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ed6690d..0c240f7 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 _0x4c3b=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','getQueues','/:id/users','create','post','/:id/queues','addQueues','put','update','delete','destroy','removeQueues','removeAgents','exports','multer'];(function(_0x56525b,_0x5f548c){var _0x129b26=function(_0x1a93b2){while(--_0x1a93b2){_0x56525b['push'](_0x56525b['shift']());}};_0x129b26(++_0x5f548c);}(_0x4c3b,0x1ca));var _0xb4c3=function(_0x3a7850,_0x55b0af){_0x3a7850=_0x3a7850-0x0;var _0x351ae3=_0x4c3b[_0x3a7850];return _0x351ae3;};'use strict';var multer=require(_0xb4c3('0x0'));var util=require(_0xb4c3('0x1'));var path=require(_0xb4c3('0x2'));var timeout=require(_0xb4c3('0x3'));var express=require('express');var router=express[_0xb4c3('0x4')]();var auth=require(_0xb4c3('0x5'));var interaction=require(_0xb4c3('0x6'));var config=require(_0xb4c3('0x7'));var controller=require(_0xb4c3('0x8'));router['get']('/',auth[_0xb4c3('0x9')](),controller[_0xb4c3('0xa')]);router[_0xb4c3('0xb')](_0xb4c3('0xc'),auth[_0xb4c3('0x9')](),controller[_0xb4c3('0xd')]);router[_0xb4c3('0xb')]('/:id/queues',auth[_0xb4c3('0x9')](),controller[_0xb4c3('0xe')]);router[_0xb4c3('0xb')](_0xb4c3('0xf'),auth[_0xb4c3('0x9')](),controller['getAgents']);router['post']('/',auth[_0xb4c3('0x9')](),controller[_0xb4c3('0x10')]);router[_0xb4c3('0x11')](_0xb4c3('0x12'),auth[_0xb4c3('0x9')](),controller[_0xb4c3('0x13')]);router[_0xb4c3('0x11')]('/:id/users',auth[_0xb4c3('0x9')](),controller['addAgents']);router[_0xb4c3('0x14')](_0xb4c3('0xc'),auth['isAuthenticated'](),controller[_0xb4c3('0x15')]);router[_0xb4c3('0x16')](_0xb4c3('0xc'),auth[_0xb4c3('0x9')](),controller[_0xb4c3('0x17')]);router[_0xb4c3('0x16')](_0xb4c3('0x12'),auth[_0xb4c3('0x9')](),controller[_0xb4c3('0x18')]);router[_0xb4c3('0x16')]('/:id/users',auth[_0xb4c3('0x9')](),controller[_0xb4c3('0x19')]);module[_0xb4c3('0x1a')]=router; \ No newline at end of file +var _0xd2af=['/:id/users','post','create','addQueues','put','update','delete','removeQueues','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','/:id/queues','isAuthenticated'];(function(_0x250d22,_0x582afd){var _0x3c5efa=function(_0x1ec4ec){while(--_0x1ec4ec){_0x250d22['push'](_0x250d22['shift']());}};_0x3c5efa(++_0x582afd);}(_0xd2af,0xc2));var _0xfd2a=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xd2af[_0x4ed520];return _0x4415a6;};'use strict';var multer=require(_0xfd2a('0x0'));var util=require(_0xfd2a('0x1'));var path=require('path');var timeout=require(_0xfd2a('0x2'));var express=require('express');var router=express[_0xfd2a('0x3')]();var auth=require(_0xfd2a('0x4'));var interaction=require(_0xfd2a('0x5'));var config=require(_0xfd2a('0x6'));var controller=require(_0xfd2a('0x7'));router[_0xfd2a('0x8')]('/',auth['isAuthenticated'](),controller[_0xfd2a('0x9')]);router['get'](_0xfd2a('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xfd2a('0xb'),auth[_0xfd2a('0xc')](),controller['getQueues']);router['get'](_0xfd2a('0xd'),auth[_0xfd2a('0xc')](),controller['getAgents']);router[_0xfd2a('0xe')]('/',auth[_0xfd2a('0xc')](),controller[_0xfd2a('0xf')]);router[_0xfd2a('0xe')]('/:id/queues',auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x10')]);router['post'](_0xfd2a('0xd'),auth[_0xfd2a('0xc')](),controller['addAgents']);router[_0xfd2a('0x11')](_0xfd2a('0xa'),auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x12')]);router['delete'](_0xfd2a('0xa'),auth[_0xfd2a('0xc')](),controller['destroy']);router[_0xfd2a('0x13')]('/:id/queues',auth['isAuthenticated'](),controller[_0xfd2a('0x14')]);router[_0xfd2a('0x13')](_0xfd2a('0xd'),auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x15')]);module[_0xfd2a('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index fb15b6c..05313f1 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 _0x8149=['sequelize','STRING','name'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x8149,0x7b));var _0x9814=function(_0x11aff6,_0x5dc1d1){_0x11aff6=_0x11aff6-0x0;var _0xbd2ef7=_0x8149[_0x11aff6];return _0xbd2ef7;};'use strict';var Sequelize=require(_0x9814('0x0'));module['exports']={'name':{'type':Sequelize[_0x9814('0x1')],'allowNull':![],'unique':_0x9814('0x2')},'description':{'type':Sequelize[_0x9814('0x1')]}}; \ No newline at end of file +var _0x91f7=['name','STRING','sequelize','exports'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x91f7,0x126));var _0x791f=function(_0x16ad0d,_0x54f46c){_0x16ad0d=_0x16ad0d-0x0;var _0x19d04f=_0x91f7[_0x16ad0d];return _0x19d04f;};'use strict';var Sequelize=require(_0x791f('0x0'));module[_0x791f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x791f('0x2')},'description':{'type':Sequelize[_0x791f('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 086c6fd..20f0e3d 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 _0x6fe8=['stack','name','send','index','rawAttributes','fieldName','type','map','keys','query','intersection','fields','attributes','length','model','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','show','Team','options','find','catch','create','body','user','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getQueues','findOne','isValidChannel','channel','Sequelize','ValidationError','Queue','pick','toLowerCase','Queues','addQueues','Unknown\x20channel','add','capitalize','ids','removeQueues','remove','addAgents','Sms','Fax','Openchannel','Whatsapp','each','Voice','User','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','omit','spread','userTeam:save','removeAgents','voice','mail','sms','openchannel','isArray','emit','getAgents','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','count','offset','limit','set','reject','destroy','then','error'];(function(_0x134dc0,_0x4a0aa8){var _0x4fd349=function(_0x4ae6ca){while(--_0x4ae6ca){_0x134dc0['push'](_0x134dc0['shift']());}};_0x4fd349(++_0x4a0aa8);}(_0x6fe8,0xd9));var _0x86fe=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x6fe8[_0x57db49];return _0xd0636f;};'use strict';var pdf=require(_0x86fe('0x0'));var emlformat=require(_0x86fe('0x1'));var rimraf=require(_0x86fe('0x2'));var zipdir=require(_0x86fe('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86fe('0x4'));var moment=require(_0x86fe('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x86fe('0x6'));var path=require(_0x86fe('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x86fe('0x8'));var squel=require(_0x86fe('0x9'));var crypto=require(_0x86fe('0xa'));var jsforce=require(_0x86fe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x86fe('0xc'));var querystring=require(_0x86fe('0xd'));var Papa=require(_0x86fe('0xe'));var Redis=require(_0x86fe('0xf'));var authService=require(_0x86fe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x86fe('0x11'));var hardwareService=require(_0x86fe('0x12'));var logger=require(_0x86fe('0x13'))(_0x86fe('0x14'));var utils=require(_0x86fe('0x15'));var config=require(_0x86fe('0x16'));var licenseUtil=require(_0x86fe('0x17'));var db=require(_0x86fe('0x18'))['db'];config['redis']=_[_0x86fe('0x19')](config[_0x86fe('0x1a')],{'host':_0x86fe('0x1b'),'port':0x18eb});var socket=require(_0x86fe('0x1c'))(new Redis(config[_0x86fe('0x1a')]));require(_0x86fe('0x1d'))[_0x86fe('0x1e')](socket);function respondWithStatusCode(_0x401b30,_0x1a683f){_0x1a683f=_0x1a683f||0xcc;return function(_0x59d971){if(_0x59d971){return _0x401b30[_0x86fe('0x1f')](_0x1a683f);}return _0x401b30['status'](_0x1a683f)[_0x86fe('0x20')]();};}function respondWithResult(_0x1a227a,_0x208b4){_0x208b4=_0x208b4||0xc8;return function(_0x1f714f){if(_0x1f714f){return _0x1a227a[_0x86fe('0x21')](_0x208b4)[_0x86fe('0x22')](_0x1f714f);}};}function respondWithFilteredResult(_0x5687cd,_0xc05f6){return function(_0x2c953e){if(_0x2c953e){var _0x42e323=_0x2c953e[_0x86fe('0x23')],_0x330bbd=_0xc05f6[_0x86fe('0x24')],_0x333e8a=_0xc05f6[_0x86fe('0x24')]+_0xc05f6[_0x86fe('0x25')],_0x15ceb5;if(_0x333e8a>=_0x42e323){_0x333e8a=_0x42e323;_0x15ceb5=0xc8;}else{_0x15ceb5=0xce;}_0x5687cd[_0x86fe('0x21')](_0x15ceb5);return _0x5687cd[_0x86fe('0x26')]('Content-Range',_0x330bbd+'-'+_0x333e8a+'/'+_0x42e323)['json'](_0x2c953e);}return null;};}function patchUpdates(_0xa68273){return function(_0x4b5059){try{jsonpatch['apply'](_0x4b5059,_0xa68273,!![]);}catch(_0x51f67c){return BPromise[_0x86fe('0x27')](_0x51f67c);}return _0x4b5059['save']();};}function saveUpdates(_0x4c593c,_0x3443f1){return function(_0x55ca6e){if(_0x55ca6e){return _0x55ca6e['update'](_0x4c593c)['then'](function(_0x123728){return _0x123728;});}return null;};}function removeEntity(_0xd548c6,_0x41d279){return function(_0x3e61c8){if(_0x3e61c8){return _0x3e61c8[_0x86fe('0x28')]()[_0x86fe('0x29')](function(){var _0xceee47=_0x3e61c8['get']({'plain':!![]});var _0x38212e='Teams';return db['UserProfileResource'][_0x86fe('0x28')]({'where':{'type':_0x38212e,'resourceId':_0xceee47['id']}})['then'](function(){return _0x3e61c8;});})['then'](function(){_0xd548c6[_0x86fe('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f95bb,_0x2ed743){return function(_0x465b16){if(!_0x465b16){_0x2f95bb[_0x86fe('0x1f')](0x194);}return _0x465b16;};}function handleError(_0x5907cb,_0x171ff8){_0x171ff8=_0x171ff8||0x1f4;return function(_0x593d0f){logger[_0x86fe('0x2a')](_0x593d0f[_0x86fe('0x2b')]);if(_0x593d0f[_0x86fe('0x2c')]){delete _0x593d0f[_0x86fe('0x2c')];}_0x5907cb[_0x86fe('0x21')](_0x171ff8)[_0x86fe('0x2d')](_0x593d0f);};}exports[_0x86fe('0x2e')]=function(_0x375f4e,_0x281d2d){var _0x382e70={},_0x1eb08f={},_0x509f26={'count':0x0,'rows':[]};var _0x58b12f=_['map'](db['Team'][_0x86fe('0x2f')],function(_0x270be5){return{'name':_0x270be5[_0x86fe('0x30')],'type':_0x270be5[_0x86fe('0x31')]['key']};});_0x1eb08f['model']=_[_0x86fe('0x32')](_0x58b12f,_0x86fe('0x2c'));_0x1eb08f['query']=_[_0x86fe('0x33')](_0x375f4e[_0x86fe('0x34')]);_0x1eb08f['filters']=_[_0x86fe('0x35')](_0x1eb08f['model'],_0x1eb08f[_0x86fe('0x34')]);_0x382e70['attributes']=_[_0x86fe('0x35')](_0x1eb08f['model'],qs[_0x86fe('0x36')](_0x375f4e[_0x86fe('0x34')][_0x86fe('0x36')]));_0x382e70[_0x86fe('0x37')]=_0x382e70[_0x86fe('0x37')][_0x86fe('0x38')]?_0x382e70[_0x86fe('0x37')]:_0x1eb08f[_0x86fe('0x39')];if(!_0x375f4e[_0x86fe('0x34')]['hasOwnProperty']('nolimit')){_0x382e70[_0x86fe('0x25')]=qs['limit'](_0x375f4e[_0x86fe('0x34')][_0x86fe('0x25')]);_0x382e70[_0x86fe('0x24')]=qs['offset'](_0x375f4e['query'][_0x86fe('0x24')]);}_0x382e70[_0x86fe('0x3a')]=qs[_0x86fe('0x3b')](_0x375f4e[_0x86fe('0x34')][_0x86fe('0x3b')]);_0x382e70[_0x86fe('0x3c')]=qs[_0x86fe('0x3d')](_['pick'](_0x375f4e[_0x86fe('0x34')],_0x1eb08f['filters']),_0x58b12f);if(_0x375f4e[_0x86fe('0x34')][_0x86fe('0x3e')]){_0x382e70[_0x86fe('0x3c')]=_['merge'](_0x382e70[_0x86fe('0x3c')],{'$or':_['map'](_0x58b12f,function(_0x5e45bc){if(_0x5e45bc[_0x86fe('0x31')]!==_0x86fe('0x3f')){var _0xf86ca8={};_0xf86ca8[_0x5e45bc[_0x86fe('0x2c')]]={'$like':'%'+_0x375f4e[_0x86fe('0x34')][_0x86fe('0x3e')]+'%'};return _0xf86ca8;}})});}_0x382e70=_[_0x86fe('0x40')]({},_0x382e70,_0x375f4e['options']);var _0x4dd1df={'where':_0x382e70['where']};return db['Team'][_0x86fe('0x23')](_0x4dd1df)['then'](function(_0x297490){_0x509f26['count']=_0x297490;if(_0x375f4e[_0x86fe('0x34')][_0x86fe('0x41')]){_0x382e70[_0x86fe('0x42')]=[{'all':!![]}];}return db['Team'][_0x86fe('0x43')](_0x382e70);})[_0x86fe('0x29')](function(_0x19642e){_0x509f26['rows']=_0x19642e;return _0x509f26;})[_0x86fe('0x29')](respondWithFilteredResult(_0x281d2d,_0x382e70))['catch'](handleError(_0x281d2d,null));};exports[_0x86fe('0x44')]=function(_0x3244ea,_0x8bc6c3){var _0x469b3d={'raw':![],'where':{'id':_0x3244ea['params']['id']}},_0x1c00ae={};_0x1c00ae[_0x86fe('0x39')]=_[_0x86fe('0x33')](db[_0x86fe('0x45')][_0x86fe('0x2f')]);_0x1c00ae[_0x86fe('0x34')]=_[_0x86fe('0x33')](_0x3244ea[_0x86fe('0x34')]);_0x1c00ae['filters']=_[_0x86fe('0x35')](_0x1c00ae[_0x86fe('0x39')],_0x1c00ae[_0x86fe('0x34')]);_0x469b3d[_0x86fe('0x37')]=_['intersection'](_0x1c00ae['model'],qs[_0x86fe('0x36')](_0x3244ea[_0x86fe('0x34')][_0x86fe('0x36')]));_0x469b3d[_0x86fe('0x37')]=_0x469b3d[_0x86fe('0x37')][_0x86fe('0x38')]?_0x469b3d[_0x86fe('0x37')]:_0x1c00ae[_0x86fe('0x39')];if(_0x3244ea['query'][_0x86fe('0x41')]){_0x469b3d['include']=[{'all':!![]}];}_0x469b3d=_['merge']({},_0x469b3d,_0x3244ea[_0x86fe('0x46')]);return db[_0x86fe('0x45')][_0x86fe('0x47')](_0x469b3d)['then'](handleEntityNotFound(_0x8bc6c3,null))[_0x86fe('0x29')](respondWithResult(_0x8bc6c3,null))[_0x86fe('0x48')](handleError(_0x8bc6c3,null));};exports[_0x86fe('0x49')]=function(_0x34177a,_0x5b036a){return db[_0x86fe('0x45')][_0x86fe('0x49')](_0x34177a[_0x86fe('0x4a')],{})[_0x86fe('0x29')](function(_0x1e306e){var _0x5169a8=_0x34177a[_0x86fe('0x4b')][_0x86fe('0x4c')]({'plain':!![]});if(!_0x5169a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5169a8['role']===_0x86fe('0x4b')){var _0x2e609b=_0x1e306e['get']({'plain':!![]});var _0x14c6cb=_0x86fe('0x4d');return db[_0x86fe('0x4e')][_0x86fe('0x47')]({'where':{'name':_0x14c6cb,'userProfileId':_0x5169a8[_0x86fe('0x4f')]},'raw':!![]})[_0x86fe('0x29')](function(_0x103e4a){if(_0x103e4a&&_0x103e4a[_0x86fe('0x50')]===0x0){return db[_0x86fe('0x51')]['create']({'name':_0x2e609b[_0x86fe('0x2c')],'resourceId':_0x2e609b['id'],'type':_0x103e4a[_0x86fe('0x2c')],'sectionId':_0x103e4a['id']},{})[_0x86fe('0x29')](function(){return _0x1e306e;});}else{return _0x1e306e;}})[_0x86fe('0x48')](function(_0x2c0450){logger['error'](_0x86fe('0x52'),_0x2c0450);throw _0x2c0450;});}return _0x1e306e;})[_0x86fe('0x29')](respondWithResult(_0x5b036a,0xc9))[_0x86fe('0x48')](handleError(_0x5b036a,null));};exports[_0x86fe('0x53')]=function(_0x3fad47,_0x1cd333){if(_0x3fad47[_0x86fe('0x4a')]['id']){delete _0x3fad47[_0x86fe('0x4a')]['id'];}return db[_0x86fe('0x45')][_0x86fe('0x47')]({'where':{'id':_0x3fad47['params']['id']}})[_0x86fe('0x29')](handleEntityNotFound(_0x1cd333,null))[_0x86fe('0x29')](saveUpdates(_0x3fad47['body'],null))[_0x86fe('0x29')](respondWithResult(_0x1cd333,null))['catch'](handleError(_0x1cd333,null));};exports[_0x86fe('0x28')]=function(_0x5cf3e8,_0x3e5029){return db[_0x86fe('0x45')][_0x86fe('0x47')]({'where':{'id':_0x5cf3e8[_0x86fe('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e5029,null))[_0x86fe('0x29')](removeEntity(_0x3e5029,null))[_0x86fe('0x48')](handleError(_0x3e5029,null));};exports[_0x86fe('0x55')]=function(_0x517e6c,_0x3f93ff,_0x36ac34){return db[_0x86fe('0x45')][_0x86fe('0x56')]({'where':{'id':_0x517e6c[_0x86fe('0x54')]['id']}})[_0x86fe('0x29')](handleEntityNotFound(_0x3f93ff,null))[_0x86fe('0x29')](function(_0xc0e9ed){if(!_0x517e6c['query']['channel']||!utils[_0x86fe('0x57')](_0x517e6c[_0x86fe('0x34')][_0x86fe('0x58')])){throw new db[(_0x86fe('0x59'))][(_0x86fe('0x5a'))]('Unknown\x20channel');}var _0x140e8b={};var _0x1dea4e={};_0x1dea4e['model']=_[_0x86fe('0x33')](db[_['capitalize'](_0x517e6c[_0x86fe('0x34')][_0x86fe('0x58')]['toLowerCase']())+_0x86fe('0x5b')]['rawAttributes']);_0x1dea4e[_0x86fe('0x34')]=_[_0x86fe('0x33')](_0x517e6c[_0x86fe('0x34')]);_0x1dea4e[_0x86fe('0x3d')]=_[_0x86fe('0x35')](_0x1dea4e[_0x86fe('0x39')],_0x1dea4e['query']);_0x140e8b[_0x86fe('0x37')]=_['intersection'](_0x1dea4e[_0x86fe('0x39')],qs[_0x86fe('0x36')](_0x517e6c['query'][_0x86fe('0x36')]));_0x140e8b[_0x86fe('0x37')]=_0x140e8b[_0x86fe('0x37')][_0x86fe('0x38')]?_0x140e8b[_0x86fe('0x37')]:_0x1dea4e[_0x86fe('0x39')];_0x140e8b[_0x86fe('0x25')]=qs[_0x86fe('0x25')](_0x517e6c['query']['limit']);_0x140e8b[_0x86fe('0x24')]=qs[_0x86fe('0x24')](_0x517e6c[_0x86fe('0x34')]['offset']);_0x140e8b[_0x86fe('0x3a')]=qs['sort'](_0x517e6c['query'][_0x86fe('0x3b')]);_0x140e8b['where']=qs[_0x86fe('0x3d')](_[_0x86fe('0x5c')](_0x517e6c[_0x86fe('0x34')],_0x1dea4e[_0x86fe('0x3d')]));_0x140e8b=_[_0x86fe('0x40')]({},_0x140e8b,_0x517e6c['options']);return _0xc0e9ed[_0x86fe('0x4c')+_['capitalize'](_0x517e6c[_0x86fe('0x34')][_0x86fe('0x58')][_0x86fe('0x5d')]())+_0x86fe('0x5e')](_0x140e8b);})[_0x86fe('0x29')](respondWithResult(_0x3f93ff,null))['catch'](handleError(_0x3f93ff,null));};exports[_0x86fe('0x5f')]=function(_0x439ecd,_0x42fb00,_0x2f6929){return db[_0x86fe('0x45')]['findOne']({'where':{'id':_0x439ecd['params']['id']}})[_0x86fe('0x29')](function(_0x44cefa){if(_0x44cefa){if(!_0x439ecd[_0x86fe('0x4a')]['channel']||!utils['isValidChannel'](_0x439ecd[_0x86fe('0x4a')][_0x86fe('0x58')])){throw new db['Sequelize'][(_0x86fe('0x5a'))](_0x86fe('0x60'));}return _0x44cefa[_0x86fe('0x61')+_[_0x86fe('0x62')](_0x439ecd[_0x86fe('0x4a')]['channel'][_0x86fe('0x5d')]())+_0x86fe('0x5e')](_0x439ecd[_0x86fe('0x4a')][_0x86fe('0x63')]);}return null;})[_0x86fe('0x29')](handleEntityNotFound(_0x42fb00,null))[_0x86fe('0x29')](respondWithStatusCode(_0x42fb00,null))[_0x86fe('0x48')](handleError(_0x42fb00,null));};exports[_0x86fe('0x64')]=function(_0x4337e7,_0x1c5d36,_0x236b46){return db[_0x86fe('0x45')][_0x86fe('0x56')]({'where':{'id':_0x4337e7[_0x86fe('0x54')]['id']}})[_0x86fe('0x29')](function(_0x2758a9){if(_0x2758a9){if(!_0x4337e7[_0x86fe('0x34')][_0x86fe('0x58')]||!utils[_0x86fe('0x57')](_0x4337e7[_0x86fe('0x34')][_0x86fe('0x58')])){throw new db['Sequelize'][(_0x86fe('0x5a'))](_0x86fe('0x60'));}return _0x2758a9[_0x86fe('0x65')+_[_0x86fe('0x62')](_0x4337e7[_0x86fe('0x34')][_0x86fe('0x58')][_0x86fe('0x5d')]())+_0x86fe('0x5e')](_0x4337e7[_0x86fe('0x34')][_0x86fe('0x63')]);}return null;})[_0x86fe('0x29')](handleEntityNotFound(_0x1c5d36,null))['then'](respondWithStatusCode(_0x1c5d36,null))['catch'](handleError(_0x1c5d36,null));};exports[_0x86fe('0x66')]=function(_0x24d0a5,_0x58be05,_0x2f5283){return db[_0x86fe('0x45')]['find']({'where':{'id':_0x24d0a5[_0x86fe('0x54')]['id']}})['then'](handleEntityNotFound(_0x58be05,null))[_0x86fe('0x29')](function(_0x477b2d){if(_0x477b2d){var _0x18c67b=['Voice','Chat','Mail',_0x86fe('0x67'),_0x86fe('0x68'),_0x86fe('0x69'),_0x86fe('0x6a')];return BPromise[_0x86fe('0x6b')](_0x18c67b,function(_0x3edd08){return _0x477b2d['get'+_0x3edd08+_0x86fe('0x5e')]({'attributes':['id',_0x86fe('0x2c')]})['then'](function(_0xad5449){return BPromise[_0x86fe('0x6b')](_0xad5449,function(_0x292b13){return _0x292b13['addAgents'](_0x24d0a5[_0x86fe('0x4a')][_0x86fe('0x63')])[_0x86fe('0x29')](function(){if(_0x3edd08===_0x86fe('0x6c')){return db[_0x86fe('0x6d')]['findAll']({'where':{'id':_0x24d0a5['body']['ids']},'attributes':['id',_0x86fe('0x2c'),_0x86fe('0x6e'),_0x86fe('0x6f'),_0x86fe('0x70')],'raw':!![]})[_0x86fe('0x29')](function(_0x203d82){return BPromise['each'](_[_0x86fe('0x3e')](_0x203d82,{'online':0x1}),function(_0x1f52aa){return db[_0x86fe('0x71')][_0x86fe('0x72')]({'membername':_0x1f52aa['name'],'UserId':_0x1f52aa['id'],'queue_name':_0x292b13[_0x86fe('0x2c')],'VoiceQueueId':_0x292b13['id'],'interface':_['isNil'](_0x1f52aa[_0x86fe('0x70')])?util[_0x86fe('0x73')](_0x86fe('0x74'),_0x1f52aa['name']):_0x1f52aa[_0x86fe('0x70')],'paused':_0x1f52aa[_0x86fe('0x6f')]||![],'penalty':0x0});});});}});});})[_0x86fe('0x29')](function(){return _0x477b2d;});})['then'](function(){return _0x477b2d;});}})[_0x86fe('0x29')](function(_0x2e846a){if(_0x2e846a){return _0x2e846a[_0x86fe('0x66')](_0x24d0a5[_0x86fe('0x4a')][_0x86fe('0x63')],_[_0x86fe('0x75')](_0x24d0a5[_0x86fe('0x4a')],[_0x86fe('0x63'),'id'])||{})[_0x86fe('0x76')](function(_0x565342){for(var _0x2abef1=0x0;_0x2abef1<_0x24d0a5[_0x86fe('0x4a')][_0x86fe('0x63')][_0x86fe('0x38')];_0x2abef1+=0x1){socket['emit'](_0x86fe('0x77'),{'UserId':_0x24d0a5[_0x86fe('0x4a')][_0x86fe('0x63')][_0x2abef1],'TeamId':_0x24d0a5[_0x86fe('0x54')]['id']});}return _0x565342;});}})[_0x86fe('0x29')](respondWithResult(_0x58be05,null))[_0x86fe('0x48')](handleError(_0x58be05,null));};exports[_0x86fe('0x78')]=function(_0xb351be,_0x15e320,_0x4fc09a){return db[_0x86fe('0x45')][_0x86fe('0x47')]({'where':{'id':_0xb351be['params']['id']}})[_0x86fe('0x29')](handleEntityNotFound(_0x15e320,null))['then'](function(_0xd88a9b){if(_0xd88a9b){return BPromise['each']([_0x86fe('0x79'),'chat',_0x86fe('0x7a'),_0x86fe('0x7b'),'fax',_0x86fe('0x7c'),'whatsapp'],function(_0xad9289){return _0xd88a9b['get'+_[_0x86fe('0x62')](_0xad9289)+_0x86fe('0x5e')]({'attributes':['id',_0x86fe('0x2c')]})['then'](function(_0x1b5b03){return BPromise[_0x86fe('0x6b')](_0x1b5b03,function(_0x201d7d){return _0x201d7d[_0x86fe('0x78')](_0xb351be['query'][_0x86fe('0x63')])[_0x86fe('0x29')](function(){if(_0xad9289==='voice'){return db[_0x86fe('0x71')][_0x86fe('0x28')]({'where':{'VoiceQueueId':_0x201d7d['id'],'UserId':_0xb351be[_0x86fe('0x34')][_0x86fe('0x63')]}});}});});})['then'](function(){return _0xd88a9b;});})[_0x86fe('0x29')](function(){return _0xd88a9b;});}})[_0x86fe('0x29')](function(_0x1a2358){if(_0x1a2358){return _0x1a2358[_0x86fe('0x78')](_0xb351be[_0x86fe('0x34')][_0x86fe('0x63')])[_0x86fe('0x29')](function(){if(_[_0x86fe('0x7d')](_0xb351be['query'][_0x86fe('0x63')])){for(var _0x28f376=0x0;_0x28f376<_0xb351be['query'][_0x86fe('0x63')]['length'];_0x28f376+=0x1){socket[_0x86fe('0x7e')]('userTeam:remove',{'UserId':Number(_0xb351be[_0x86fe('0x34')][_0x86fe('0x63')][_0x28f376]),'TeamId':Number(_0xb351be[_0x86fe('0x54')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0xb351be[_0x86fe('0x34')][_0x86fe('0x63')]),'TeamId':Number(_0xb351be['params']['id'])});}});}})[_0x86fe('0x29')](respondWithStatusCode(_0x15e320,null))[_0x86fe('0x48')](handleError(_0x15e320,null));};exports['getAgents']=function(_0x48cdd4,_0x2138db,_0xfa20c9){var _0x53495d={};var _0x1257ae={};var _0x215729;var _0x35dff8;return db[_0x86fe('0x45')][_0x86fe('0x56')]({'where':{'id':_0x48cdd4['params']['id']}})[_0x86fe('0x29')](handleEntityNotFound(_0x2138db,null))[_0x86fe('0x29')](function(_0x11d039){if(_0x11d039){_0x215729=_0x11d039;_0x1257ae['model']=_[_0x86fe('0x33')](db[_0x86fe('0x6d')][_0x86fe('0x2f')]);_0x1257ae[_0x86fe('0x34')]=_[_0x86fe('0x33')](_0x48cdd4[_0x86fe('0x34')]);_0x1257ae['filters']=_[_0x86fe('0x35')](_0x1257ae[_0x86fe('0x39')],_0x1257ae['query']);_0x53495d[_0x86fe('0x37')]=_[_0x86fe('0x35')](_0x1257ae[_0x86fe('0x39')],qs[_0x86fe('0x36')](_0x48cdd4[_0x86fe('0x34')][_0x86fe('0x36')]));_0x53495d['attributes']=_0x53495d[_0x86fe('0x37')]['length']?_0x53495d[_0x86fe('0x37')]:_0x1257ae[_0x86fe('0x39')];_0x53495d['order']=qs[_0x86fe('0x3b')](_0x48cdd4[_0x86fe('0x34')][_0x86fe('0x3b')]);_0x53495d[_0x86fe('0x3c')]=qs['filters'](_[_0x86fe('0x5c')](_0x48cdd4[_0x86fe('0x34')],_0x1257ae['filters']));if(_0x48cdd4[_0x86fe('0x34')]['filter']){_0x53495d[_0x86fe('0x3c')]=_['merge'](_0x53495d[_0x86fe('0x3c')],{'$or':_[_0x86fe('0x32')](_0x53495d[_0x86fe('0x37')],function(_0x10972d){var _0x2090f3={};_0x2090f3[_0x10972d]={'$like':'%'+_0x48cdd4[_0x86fe('0x34')]['filter']+'%'};return _0x2090f3;})});}_0x53495d=_[_0x86fe('0x40')]({},_0x53495d,_0x48cdd4[_0x86fe('0x46')]);return _0x215729[_0x86fe('0x7f')](_0x53495d);}})[_0x86fe('0x29')](function(_0x279713){if(_0x279713){_0x35dff8=_0x279713[_0x86fe('0x38')];if(!_0x48cdd4['query'][_0x86fe('0x80')](_0x86fe('0x81'))){_0x53495d[_0x86fe('0x25')]=qs[_0x86fe('0x25')](_0x48cdd4[_0x86fe('0x34')][_0x86fe('0x25')]);_0x53495d[_0x86fe('0x24')]=qs['offset'](_0x48cdd4[_0x86fe('0x34')]['offset']);}return _0x215729[_0x86fe('0x7f')](_0x53495d);}})['then'](function(_0x270104){if(_0x270104){return _0x270104?{'count':_0x35dff8,'rows':_0x270104}:null;}})[_0x86fe('0x29')](respondWithResult(_0x2138db,null))[_0x86fe('0x48')](handleError(_0x2138db,null));}; \ No newline at end of file +var _0x1edd=['catch','params','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queue','order','capitalize','addQueues','isValidChannel','add','Queues','ids','removeQueues','remove','Chat','Mail','Fax','Openchannel','each','addAgents','Voice','User','online','voicePause','interface','filter','upsert','isNil','spread','emit','userTeam:save','removeAgents','chat','fax','openchannel','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','Teams','UserProfileResource','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x1edd,0xb7));var _0xd1ed=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x1edd[_0x2a18b7];return _0x45e74e;};'use strict';var pdf=require(_0xd1ed('0x0'));var emlformat=require(_0xd1ed('0x1'));var rimraf=require(_0xd1ed('0x2'));var zipdir=require(_0xd1ed('0x3'));var jsonpatch=require(_0xd1ed('0x4'));var rp=require(_0xd1ed('0x5'));var moment=require(_0xd1ed('0x6'));var BPromise=require(_0xd1ed('0x7'));var Mustache=require(_0xd1ed('0x8'));var util=require(_0xd1ed('0x9'));var path=require(_0xd1ed('0xa'));var sox=require(_0xd1ed('0xb'));var csv=require('to-csv');var ejs=require(_0xd1ed('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1ed('0xd'));var deskjs=require(_0xd1ed('0xe'));var toCsv=require(_0xd1ed('0xf'));var querystring=require(_0xd1ed('0x10'));var Papa=require(_0xd1ed('0x11'));var Redis=require('ioredis');var authService=require(_0xd1ed('0x12'));var qs=require(_0xd1ed('0x13'));var as=require(_0xd1ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd1ed('0x15'));var utils=require(_0xd1ed('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd1ed('0x17'));var db=require(_0xd1ed('0x18'))['db'];config[_0xd1ed('0x19')]=_[_0xd1ed('0x1a')](config[_0xd1ed('0x19')],{'host':_0xd1ed('0x1b'),'port':0x18eb});var socket=require(_0xd1ed('0x1c'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x537f70,_0x941c38){_0x941c38=_0x941c38||0xcc;return function(_0x51b2d2){if(_0x51b2d2){return _0x537f70['sendStatus'](_0x941c38);}return _0x537f70[_0xd1ed('0x1d')](_0x941c38)[_0xd1ed('0x1e')]();};}function respondWithResult(_0x2b8fbe,_0x14244f){_0x14244f=_0x14244f||0xc8;return function(_0x14e150){if(_0x14e150){return _0x2b8fbe['status'](_0x14244f)[_0xd1ed('0x1f')](_0x14e150);}};}function respondWithFilteredResult(_0x551b4d,_0x55fc44){return function(_0x46c9a7){if(_0x46c9a7){var _0x5f5ec6=_0x46c9a7['count'],_0x5a705f=_0x55fc44[_0xd1ed('0x20')],_0x20d0b6=_0x55fc44[_0xd1ed('0x20')]+_0x55fc44[_0xd1ed('0x21')],_0x107509;if(_0x20d0b6>=_0x5f5ec6){_0x20d0b6=_0x5f5ec6;_0x107509=0xc8;}else{_0x107509=0xce;}_0x551b4d[_0xd1ed('0x1d')](_0x107509);return _0x551b4d[_0xd1ed('0x22')](_0xd1ed('0x23'),_0x5a705f+'-'+_0x20d0b6+'/'+_0x5f5ec6)['json'](_0x46c9a7);}return null;};}function patchUpdates(_0x1ebb40){return function(_0x5d6d0e){try{jsonpatch['apply'](_0x5d6d0e,_0x1ebb40,!![]);}catch(_0x2e7cc3){return BPromise[_0xd1ed('0x24')](_0x2e7cc3);}return _0x5d6d0e[_0xd1ed('0x25')]();};}function saveUpdates(_0x28767b,_0x43112a){return function(_0x353a7d){if(_0x353a7d){return _0x353a7d[_0xd1ed('0x26')](_0x28767b)['then'](function(_0x2f9b78){return _0x2f9b78;});}return null;};}function removeEntity(_0x59f086,_0x40b850){return function(_0x3572f2){if(_0x3572f2){return _0x3572f2[_0xd1ed('0x27')]()[_0xd1ed('0x28')](function(){var _0x74a391=_0x3572f2[_0xd1ed('0x29')]({'plain':!![]});var _0x7e12a6=_0xd1ed('0x2a');return db[_0xd1ed('0x2b')]['destroy']({'where':{'type':_0x7e12a6,'resourceId':_0x74a391['id']}})['then'](function(){return _0x3572f2;});})[_0xd1ed('0x28')](function(){_0x59f086[_0xd1ed('0x1d')](0xcc)[_0xd1ed('0x1e')]();});}};}function handleEntityNotFound(_0x4e4a2d,_0xa3efc9){return function(_0x7edeec){if(!_0x7edeec){_0x4e4a2d[_0xd1ed('0x2c')](0x194);}return _0x7edeec;};}function handleError(_0x109985,_0x35d2cc){_0x35d2cc=_0x35d2cc||0x1f4;return function(_0x1899e5){logger[_0xd1ed('0x2d')](_0x1899e5['stack']);if(_0x1899e5[_0xd1ed('0x2e')]){delete _0x1899e5[_0xd1ed('0x2e')];}_0x109985[_0xd1ed('0x1d')](_0x35d2cc)[_0xd1ed('0x2f')](_0x1899e5);};}exports[_0xd1ed('0x30')]=function(_0x25d9fd,_0x34484d){var _0x55556d={},_0x4e6e58={},_0x29af37={'count':0x0,'rows':[]};var _0x56694f=_[_0xd1ed('0x31')](db[_0xd1ed('0x32')][_0xd1ed('0x33')],function(_0x349080){return{'name':_0x349080[_0xd1ed('0x34')],'type':_0x349080[_0xd1ed('0x35')][_0xd1ed('0x36')]};});_0x4e6e58[_0xd1ed('0x37')]=_['map'](_0x56694f,_0xd1ed('0x2e'));_0x4e6e58[_0xd1ed('0x38')]=_[_0xd1ed('0x39')](_0x25d9fd[_0xd1ed('0x38')]);_0x4e6e58[_0xd1ed('0x3a')]=_[_0xd1ed('0x3b')](_0x4e6e58[_0xd1ed('0x37')],_0x4e6e58[_0xd1ed('0x38')]);_0x55556d[_0xd1ed('0x3c')]=_[_0xd1ed('0x3b')](_0x4e6e58[_0xd1ed('0x37')],qs[_0xd1ed('0x3d')](_0x25d9fd[_0xd1ed('0x38')][_0xd1ed('0x3d')]));_0x55556d[_0xd1ed('0x3c')]=_0x55556d['attributes']['length']?_0x55556d[_0xd1ed('0x3c')]:_0x4e6e58[_0xd1ed('0x37')];if(!_0x25d9fd[_0xd1ed('0x38')][_0xd1ed('0x3e')](_0xd1ed('0x3f'))){_0x55556d['limit']=qs[_0xd1ed('0x21')](_0x25d9fd['query'][_0xd1ed('0x21')]);_0x55556d[_0xd1ed('0x20')]=qs['offset'](_0x25d9fd['query'][_0xd1ed('0x20')]);}_0x55556d['order']=qs[_0xd1ed('0x40')](_0x25d9fd[_0xd1ed('0x38')]['sort']);_0x55556d[_0xd1ed('0x41')]=qs[_0xd1ed('0x3a')](_[_0xd1ed('0x42')](_0x25d9fd[_0xd1ed('0x38')],_0x4e6e58[_0xd1ed('0x3a')]),_0x56694f);if(_0x25d9fd[_0xd1ed('0x38')]['filter']){_0x55556d['where']=_[_0xd1ed('0x43')](_0x55556d[_0xd1ed('0x41')],{'$or':_['map'](_0x56694f,function(_0x65bbb9){if(_0x65bbb9[_0xd1ed('0x35')]!==_0xd1ed('0x44')){var _0xf71806={};_0xf71806[_0x65bbb9[_0xd1ed('0x2e')]]={'$like':'%'+_0x25d9fd['query']['filter']+'%'};return _0xf71806;}})});}_0x55556d=_[_0xd1ed('0x43')]({},_0x55556d,_0x25d9fd[_0xd1ed('0x45')]);var _0x469422={'where':_0x55556d['where']};return db[_0xd1ed('0x32')][_0xd1ed('0x46')](_0x469422)[_0xd1ed('0x28')](function(_0x5d9e1a){_0x29af37['count']=_0x5d9e1a;if(_0x25d9fd['query'][_0xd1ed('0x47')]){_0x55556d[_0xd1ed('0x48')]=[{'all':!![]}];}return db['Team'][_0xd1ed('0x49')](_0x55556d);})[_0xd1ed('0x28')](function(_0x342fb8){_0x29af37[_0xd1ed('0x4a')]=_0x342fb8;return _0x29af37;})[_0xd1ed('0x28')](respondWithFilteredResult(_0x34484d,_0x55556d))[_0xd1ed('0x4b')](handleError(_0x34484d,null));};exports['show']=function(_0x48585e,_0x4401ef){var _0x33a5b5={'raw':![],'where':{'id':_0x48585e[_0xd1ed('0x4c')]['id']}},_0x42e808={};_0x42e808[_0xd1ed('0x37')]=_[_0xd1ed('0x39')](db[_0xd1ed('0x32')]['rawAttributes']);_0x42e808[_0xd1ed('0x38')]=_[_0xd1ed('0x39')](_0x48585e[_0xd1ed('0x38')]);_0x42e808[_0xd1ed('0x3a')]=_[_0xd1ed('0x3b')](_0x42e808['model'],_0x42e808[_0xd1ed('0x38')]);_0x33a5b5['attributes']=_[_0xd1ed('0x3b')](_0x42e808[_0xd1ed('0x37')],qs[_0xd1ed('0x3d')](_0x48585e['query'][_0xd1ed('0x3d')]));_0x33a5b5['attributes']=_0x33a5b5[_0xd1ed('0x3c')][_0xd1ed('0x4d')]?_0x33a5b5[_0xd1ed('0x3c')]:_0x42e808[_0xd1ed('0x37')];if(_0x48585e[_0xd1ed('0x38')][_0xd1ed('0x47')]){_0x33a5b5['include']=[{'all':!![]}];}_0x33a5b5=_[_0xd1ed('0x43')]({},_0x33a5b5,_0x48585e['options']);return db[_0xd1ed('0x32')]['find'](_0x33a5b5)[_0xd1ed('0x28')](handleEntityNotFound(_0x4401ef,null))[_0xd1ed('0x28')](respondWithResult(_0x4401ef,null))[_0xd1ed('0x4b')](handleError(_0x4401ef,null));};exports[_0xd1ed('0x4e')]=function(_0x492c63,_0x3c7803){return db[_0xd1ed('0x32')][_0xd1ed('0x4e')](_0x492c63['body'],{})[_0xd1ed('0x28')](function(_0x3719ff){var _0x4ec35a=_0x492c63['user'][_0xd1ed('0x29')]({'plain':!![]});if(!_0x4ec35a)throw new Error(_0xd1ed('0x4f'));if(_0x4ec35a[_0xd1ed('0x50')]===_0xd1ed('0x51')){var _0x3dc365=_0x3719ff[_0xd1ed('0x29')]({'plain':!![]});var _0x437c98=_0xd1ed('0x2a');return db[_0xd1ed('0x52')]['find']({'where':{'name':_0x437c98,'userProfileId':_0x4ec35a[_0xd1ed('0x53')]},'raw':!![]})['then'](function(_0x10b0b8){if(_0x10b0b8&&_0x10b0b8[_0xd1ed('0x54')]===0x0){return db['UserProfileResource'][_0xd1ed('0x4e')]({'name':_0x3dc365[_0xd1ed('0x2e')],'resourceId':_0x3dc365['id'],'type':_0x10b0b8['name'],'sectionId':_0x10b0b8['id']},{})[_0xd1ed('0x28')](function(){return _0x3719ff;});}else{return _0x3719ff;}})['catch'](function(_0x465367){logger[_0xd1ed('0x2d')](_0xd1ed('0x55'),_0x465367);throw _0x465367;});}return _0x3719ff;})[_0xd1ed('0x28')](respondWithResult(_0x3c7803,0xc9))[_0xd1ed('0x4b')](handleError(_0x3c7803,null));};exports['update']=function(_0x212595,_0x3f68b){if(_0x212595[_0xd1ed('0x56')]['id']){delete _0x212595[_0xd1ed('0x56')]['id'];}return db[_0xd1ed('0x32')]['find']({'where':{'id':_0x212595[_0xd1ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f68b,null))[_0xd1ed('0x28')](saveUpdates(_0x212595['body'],null))[_0xd1ed('0x28')](respondWithResult(_0x3f68b,null))[_0xd1ed('0x4b')](handleError(_0x3f68b,null));};exports['destroy']=function(_0x5bb9d4,_0x1fa935){return db[_0xd1ed('0x32')][_0xd1ed('0x57')]({'where':{'id':_0x5bb9d4[_0xd1ed('0x4c')]['id']}})[_0xd1ed('0x28')](handleEntityNotFound(_0x1fa935,null))[_0xd1ed('0x28')](removeEntity(_0x1fa935,null))[_0xd1ed('0x4b')](handleError(_0x1fa935,null));};exports['getQueues']=function(_0x281a5a,_0x51bad5,_0xe531f2){return db[_0xd1ed('0x32')][_0xd1ed('0x58')]({'where':{'id':_0x281a5a[_0xd1ed('0x4c')]['id']}})[_0xd1ed('0x28')](handleEntityNotFound(_0x51bad5,null))[_0xd1ed('0x28')](function(_0x628df8){if(!_0x281a5a[_0xd1ed('0x38')][_0xd1ed('0x59')]||!utils['isValidChannel'](_0x281a5a[_0xd1ed('0x38')][_0xd1ed('0x59')])){throw new db[(_0xd1ed('0x5a'))][(_0xd1ed('0x5b'))](_0xd1ed('0x5c'));}var _0x3b387f={};var _0x44463a={};_0x44463a[_0xd1ed('0x37')]=_[_0xd1ed('0x39')](db[_['capitalize'](_0x281a5a['query'][_0xd1ed('0x59')][_0xd1ed('0x5d')]())+_0xd1ed('0x5e')][_0xd1ed('0x33')]);_0x44463a[_0xd1ed('0x38')]=_['keys'](_0x281a5a[_0xd1ed('0x38')]);_0x44463a[_0xd1ed('0x3a')]=_[_0xd1ed('0x3b')](_0x44463a['model'],_0x44463a[_0xd1ed('0x38')]);_0x3b387f[_0xd1ed('0x3c')]=_['intersection'](_0x44463a[_0xd1ed('0x37')],qs[_0xd1ed('0x3d')](_0x281a5a[_0xd1ed('0x38')][_0xd1ed('0x3d')]));_0x3b387f[_0xd1ed('0x3c')]=_0x3b387f[_0xd1ed('0x3c')][_0xd1ed('0x4d')]?_0x3b387f[_0xd1ed('0x3c')]:_0x44463a[_0xd1ed('0x37')];_0x3b387f['limit']=qs[_0xd1ed('0x21')](_0x281a5a[_0xd1ed('0x38')][_0xd1ed('0x21')]);_0x3b387f[_0xd1ed('0x20')]=qs[_0xd1ed('0x20')](_0x281a5a[_0xd1ed('0x38')][_0xd1ed('0x20')]);_0x3b387f[_0xd1ed('0x5f')]=qs[_0xd1ed('0x40')](_0x281a5a[_0xd1ed('0x38')]['sort']);_0x3b387f['where']=qs['filters'](_[_0xd1ed('0x42')](_0x281a5a[_0xd1ed('0x38')],_0x44463a['filters']));_0x3b387f=_[_0xd1ed('0x43')]({},_0x3b387f,_0x281a5a['options']);return _0x628df8['get'+_[_0xd1ed('0x60')](_0x281a5a['query']['channel'][_0xd1ed('0x5d')]())+'Queues'](_0x3b387f);})[_0xd1ed('0x28')](respondWithResult(_0x51bad5,null))[_0xd1ed('0x4b')](handleError(_0x51bad5,null));};exports[_0xd1ed('0x61')]=function(_0x3d95e9,_0x143cbf,_0x20c872){return db[_0xd1ed('0x32')]['findOne']({'where':{'id':_0x3d95e9['params']['id']}})[_0xd1ed('0x28')](function(_0x24fbe2){if(_0x24fbe2){if(!_0x3d95e9['body'][_0xd1ed('0x59')]||!utils[_0xd1ed('0x62')](_0x3d95e9[_0xd1ed('0x56')][_0xd1ed('0x59')])){throw new db[(_0xd1ed('0x5a'))][(_0xd1ed('0x5b'))]('Unknown\x20channel');}return _0x24fbe2[_0xd1ed('0x63')+_['capitalize'](_0x3d95e9[_0xd1ed('0x56')]['channel'][_0xd1ed('0x5d')]())+_0xd1ed('0x64')](_0x3d95e9[_0xd1ed('0x56')][_0xd1ed('0x65')]);}return null;})[_0xd1ed('0x28')](handleEntityNotFound(_0x143cbf,null))[_0xd1ed('0x28')](respondWithStatusCode(_0x143cbf,null))[_0xd1ed('0x4b')](handleError(_0x143cbf,null));};exports[_0xd1ed('0x66')]=function(_0x1bfdc2,_0x59ed45,_0x42e8bb){return db['Team'][_0xd1ed('0x58')]({'where':{'id':_0x1bfdc2[_0xd1ed('0x4c')]['id']}})[_0xd1ed('0x28')](function(_0x50d693){if(_0x50d693){if(!_0x1bfdc2[_0xd1ed('0x38')][_0xd1ed('0x59')]||!utils[_0xd1ed('0x62')](_0x1bfdc2[_0xd1ed('0x38')][_0xd1ed('0x59')])){throw new db['Sequelize'][(_0xd1ed('0x5b'))]('Unknown\x20channel');}return _0x50d693[_0xd1ed('0x67')+_[_0xd1ed('0x60')](_0x1bfdc2[_0xd1ed('0x38')][_0xd1ed('0x59')][_0xd1ed('0x5d')]())+_0xd1ed('0x64')](_0x1bfdc2[_0xd1ed('0x38')][_0xd1ed('0x65')]);}return null;})[_0xd1ed('0x28')](handleEntityNotFound(_0x59ed45,null))[_0xd1ed('0x28')](respondWithStatusCode(_0x59ed45,null))[_0xd1ed('0x4b')](handleError(_0x59ed45,null));};exports['addAgents']=function(_0x380daf,_0x72efd,_0x578ee3){return db[_0xd1ed('0x32')][_0xd1ed('0x57')]({'where':{'id':_0x380daf['params']['id']}})['then'](handleEntityNotFound(_0x72efd,null))[_0xd1ed('0x28')](function(_0x5a61b8){if(_0x5a61b8){var _0x45faba=['Voice',_0xd1ed('0x68'),_0xd1ed('0x69'),'Sms',_0xd1ed('0x6a'),_0xd1ed('0x6b'),'Whatsapp'];return BPromise['each'](_0x45faba,function(_0x3ab4d6){return _0x5a61b8[_0xd1ed('0x29')+_0x3ab4d6+_0xd1ed('0x64')]({'attributes':['id',_0xd1ed('0x2e')]})['then'](function(_0x31f96c){return BPromise[_0xd1ed('0x6c')](_0x31f96c,function(_0xcc2d69){return _0xcc2d69[_0xd1ed('0x6d')](_0x380daf[_0xd1ed('0x56')]['ids'])['then'](function(){if(_0x3ab4d6===_0xd1ed('0x6e')){return db[_0xd1ed('0x6f')][_0xd1ed('0x49')]({'where':{'id':_0x380daf[_0xd1ed('0x56')][_0xd1ed('0x65')]},'attributes':['id',_0xd1ed('0x2e'),_0xd1ed('0x70'),_0xd1ed('0x71'),_0xd1ed('0x72')],'raw':!![]})[_0xd1ed('0x28')](function(_0x5acd0d){return BPromise[_0xd1ed('0x6c')](_[_0xd1ed('0x73')](_0x5acd0d,{'online':0x1}),function(_0x51f4f2){return db['UserVoiceQueueRt'][_0xd1ed('0x74')]({'membername':_0x51f4f2[_0xd1ed('0x2e')],'UserId':_0x51f4f2['id'],'queue_name':_0xcc2d69['name'],'VoiceQueueId':_0xcc2d69['id'],'interface':_[_0xd1ed('0x75')](_0x51f4f2['interface'])?util['format']('SIP/%s',_0x51f4f2[_0xd1ed('0x2e')]):_0x51f4f2[_0xd1ed('0x72')],'paused':_0x51f4f2[_0xd1ed('0x71')]||![],'penalty':0x0});});});}});});})[_0xd1ed('0x28')](function(){return _0x5a61b8;});})[_0xd1ed('0x28')](function(){return _0x5a61b8;});}})[_0xd1ed('0x28')](function(_0x21bc7b){if(_0x21bc7b){return _0x21bc7b[_0xd1ed('0x6d')](_0x380daf[_0xd1ed('0x56')]['ids'],_['omit'](_0x380daf[_0xd1ed('0x56')],['ids','id'])||{})[_0xd1ed('0x76')](function(_0x44ae93){for(var _0x462963=0x0;_0x462963<_0x380daf['body']['ids'][_0xd1ed('0x4d')];_0x462963+=0x1){socket[_0xd1ed('0x77')](_0xd1ed('0x78'),{'UserId':_0x380daf[_0xd1ed('0x56')][_0xd1ed('0x65')][_0x462963],'TeamId':_0x380daf[_0xd1ed('0x4c')]['id']});}return _0x44ae93;});}})[_0xd1ed('0x28')](respondWithResult(_0x72efd,null))[_0xd1ed('0x4b')](handleError(_0x72efd,null));};exports[_0xd1ed('0x79')]=function(_0x531046,_0x45b28d,_0x3ab4c5){return db[_0xd1ed('0x32')][_0xd1ed('0x57')]({'where':{'id':_0x531046[_0xd1ed('0x4c')]['id']}})[_0xd1ed('0x28')](handleEntityNotFound(_0x45b28d,null))[_0xd1ed('0x28')](function(_0x325cc8){if(_0x325cc8){return BPromise[_0xd1ed('0x6c')](['voice',_0xd1ed('0x7a'),'mail','sms',_0xd1ed('0x7b'),_0xd1ed('0x7c'),'whatsapp'],function(_0x59dd99){return _0x325cc8[_0xd1ed('0x29')+_['capitalize'](_0x59dd99)+'Queues']({'attributes':['id',_0xd1ed('0x2e')]})[_0xd1ed('0x28')](function(_0x2d2117){return BPromise[_0xd1ed('0x6c')](_0x2d2117,function(_0x3baec2){return _0x3baec2[_0xd1ed('0x79')](_0x531046[_0xd1ed('0x38')]['ids'])[_0xd1ed('0x28')](function(){if(_0x59dd99==='voice'){return db[_0xd1ed('0x7d')][_0xd1ed('0x27')]({'where':{'VoiceQueueId':_0x3baec2['id'],'UserId':_0x531046['query'][_0xd1ed('0x65')]}});}});});})[_0xd1ed('0x28')](function(){return _0x325cc8;});})['then'](function(){return _0x325cc8;});}})[_0xd1ed('0x28')](function(_0x47117e){if(_0x47117e){return _0x47117e[_0xd1ed('0x79')](_0x531046[_0xd1ed('0x38')][_0xd1ed('0x65')])[_0xd1ed('0x28')](function(){if(_[_0xd1ed('0x7e')](_0x531046[_0xd1ed('0x38')]['ids'])){for(var _0xb90d6=0x0;_0xb90d6<_0x531046['query'][_0xd1ed('0x65')][_0xd1ed('0x4d')];_0xb90d6+=0x1){socket['emit'](_0xd1ed('0x7f'),{'UserId':Number(_0x531046['query'][_0xd1ed('0x65')][_0xb90d6]),'TeamId':Number(_0x531046[_0xd1ed('0x4c')]['id'])});}}else{socket[_0xd1ed('0x77')](_0xd1ed('0x7f'),{'UserId':Number(_0x531046[_0xd1ed('0x38')][_0xd1ed('0x65')]),'TeamId':Number(_0x531046[_0xd1ed('0x4c')]['id'])});}});}})[_0xd1ed('0x28')](respondWithStatusCode(_0x45b28d,null))[_0xd1ed('0x4b')](handleError(_0x45b28d,null));};exports[_0xd1ed('0x80')]=function(_0x55305b,_0x26cda8,_0x348e45){var _0x2f9972={};var _0xd4c891={};var _0x14340f;var _0x25083c;return db[_0xd1ed('0x32')][_0xd1ed('0x58')]({'where':{'id':_0x55305b[_0xd1ed('0x4c')]['id']}})[_0xd1ed('0x28')](handleEntityNotFound(_0x26cda8,null))[_0xd1ed('0x28')](function(_0x17b9ab){if(_0x17b9ab){_0x14340f=_0x17b9ab;_0xd4c891[_0xd1ed('0x37')]=_[_0xd1ed('0x39')](db['User']['rawAttributes']);_0xd4c891[_0xd1ed('0x38')]=_[_0xd1ed('0x39')](_0x55305b[_0xd1ed('0x38')]);_0xd4c891[_0xd1ed('0x3a')]=_[_0xd1ed('0x3b')](_0xd4c891[_0xd1ed('0x37')],_0xd4c891[_0xd1ed('0x38')]);_0x2f9972[_0xd1ed('0x3c')]=_[_0xd1ed('0x3b')](_0xd4c891['model'],qs[_0xd1ed('0x3d')](_0x55305b[_0xd1ed('0x38')]['fields']));_0x2f9972[_0xd1ed('0x3c')]=_0x2f9972['attributes']['length']?_0x2f9972[_0xd1ed('0x3c')]:_0xd4c891[_0xd1ed('0x37')];_0x2f9972[_0xd1ed('0x5f')]=qs[_0xd1ed('0x40')](_0x55305b[_0xd1ed('0x38')][_0xd1ed('0x40')]);_0x2f9972[_0xd1ed('0x41')]=qs[_0xd1ed('0x3a')](_[_0xd1ed('0x42')](_0x55305b[_0xd1ed('0x38')],_0xd4c891[_0xd1ed('0x3a')]));if(_0x55305b[_0xd1ed('0x38')][_0xd1ed('0x73')]){_0x2f9972['where']=_[_0xd1ed('0x43')](_0x2f9972[_0xd1ed('0x41')],{'$or':_[_0xd1ed('0x31')](_0x2f9972[_0xd1ed('0x3c')],function(_0xeb0900){var _0x5d7650={};_0x5d7650[_0xeb0900]={'$like':'%'+_0x55305b['query'][_0xd1ed('0x73')]+'%'};return _0x5d7650;})});}_0x2f9972=_[_0xd1ed('0x43')]({},_0x2f9972,_0x55305b['options']);return _0x14340f[_0xd1ed('0x80')](_0x2f9972);}})[_0xd1ed('0x28')](function(_0x2f1324){if(_0x2f1324){_0x25083c=_0x2f1324[_0xd1ed('0x4d')];if(!_0x55305b[_0xd1ed('0x38')][_0xd1ed('0x3e')]('nolimit')){_0x2f9972['limit']=qs[_0xd1ed('0x21')](_0x55305b[_0xd1ed('0x38')][_0xd1ed('0x21')]);_0x2f9972[_0xd1ed('0x20')]=qs['offset'](_0x55305b[_0xd1ed('0x38')][_0xd1ed('0x20')]);}return _0x14340f[_0xd1ed('0x80')](_0x2f9972);}})[_0xd1ed('0x28')](function(_0x3eb7e1){if(_0x3eb7e1){return _0x3eb7e1?{'count':_0x25083c,'rows':_0x3eb7e1}:null;}})[_0xd1ed('0x28')](respondWithResult(_0x26cda8,null))['catch'](handleError(_0x26cda8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c6b55fb..a3a206f 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 _0xbea2=['setMaxListeners','update','remove','emit','hasOwnProperty','../../mysqldb','Team'];(function(_0x260cd8,_0x593290){var _0x41738f=function(_0x143ae4){while(--_0x143ae4){_0x260cd8['push'](_0x260cd8['shift']());}};_0x41738f(++_0x593290);}(_0xbea2,0xa6));var _0x2bea=function(_0x1b05b8,_0x5a9aeb){_0x1b05b8=_0x1b05b8-0x0;var _0x587b7e=_0xbea2[_0x1b05b8];return _0x587b7e;};'use strict';var EventEmitter=require('events');var Team=require(_0x2bea('0x0'))['db'][_0x2bea('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x2bea('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2bea('0x3'),'afterDestroy':_0x2bea('0x4')};function emitEvent(_0x22861f){return function(_0x3c1776,_0x1d6314,_0x5b29c0){TeamEvents['emit'](_0x22861f+':'+_0x3c1776['id'],_0x3c1776);TeamEvents[_0x2bea('0x5')](_0x22861f,_0x3c1776);_0x5b29c0(null);};}for(var e in events){if(events[_0x2bea('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xe98a=['emit','hasOwnProperty','hook','events','../../mysqldb','Team','setMaxListeners','save','remove'];(function(_0x2dfac9,_0x4c46a1){var _0x141019=function(_0x48f5c8){while(--_0x48f5c8){_0x2dfac9['push'](_0x2dfac9['shift']());}};_0x141019(++_0x4c46a1);}(_0xe98a,0xe4));var _0xae98=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xe98a[_0x377a6e];return _0x37f751;};'use strict';var EventEmitter=require(_0xae98('0x0'));var Team=require(_0xae98('0x1'))['db'][_0xae98('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xae98('0x3')](0x0);var events={'afterCreate':_0xae98('0x4'),'afterUpdate':'update','afterDestroy':_0xae98('0x5')};function emitEvent(_0x2fc43b){return function(_0x5e96c5,_0x10978b,_0x22696e){TeamEvents[_0xae98('0x6')](_0x2fc43b+':'+_0x5e96c5['id'],_0x5e96c5);TeamEvents[_0xae98('0x6')](_0x2fc43b,_0x5e96c5);_0x22696e(null);};}for(var e in events){if(events[_0xae98('0x7')](e)){var event=events[e];Team[_0xae98('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8f1ced9..1ffcfeb 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 _0x28f7=['../../config/environment','exports','define','Team','teams','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xff0602,_0x86c553){var _0x3f5f40=function(_0x415194){while(--_0x415194){_0xff0602['push'](_0xff0602['shift']());}};_0x3f5f40(++_0x86c553);}(_0x28f7,0x157));var _0x728f=function(_0x33434a,_0x58785d){_0x33434a=_0x33434a-0x0;var _0x53a1bd=_0x28f7[_0x33434a];return _0x53a1bd;};'use strict';var _=require(_0x728f('0x0'));var util=require('util');var logger=require(_0x728f('0x1'))(_0x728f('0x2'));var moment=require(_0x728f('0x3'));var BPromise=require(_0x728f('0x4'));var rp=require(_0x728f('0x5'));var fs=require('fs');var path=require(_0x728f('0x6'));var rimraf=require(_0x728f('0x7'));var config=require(_0x728f('0x8'));var attributes=require('./team.attributes');module[_0x728f('0x9')]=function(_0x4599dd,_0x4dc744){return _0x4599dd[_0x728f('0xa')](_0x728f('0xb'),attributes,{'tableName':_0x728f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0156=['Team','teams','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x50794d,_0x2eeaf4){var _0x432914=function(_0x15ea9b){while(--_0x15ea9b){_0x50794d['push'](_0x50794d['shift']());}};_0x432914(++_0x2eeaf4);}(_0x0156,0xde));var _0x6015=function(_0x9cc73e,_0x3a4a73){_0x9cc73e=_0x9cc73e-0x0;var _0x3aa3c6=_0x0156[_0x9cc73e];return _0x3aa3c6;};'use strict';var _=require(_0x6015('0x0'));var util=require(_0x6015('0x1'));var logger=require('../../config/logger')(_0x6015('0x2'));var moment=require(_0x6015('0x3'));var BPromise=require(_0x6015('0x4'));var rp=require(_0x6015('0x5'));var fs=require('fs');var path=require(_0x6015('0x6'));var rimraf=require('rimraf');var config=require(_0x6015('0x7'));var attributes=require('./team.attributes');module[_0x6015('0x8')]=function(_0x51eed0,_0x2c7601){return _0x51eed0['define'](_0x6015('0x9'),attributes,{'tableName':_0x6015('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 34441ef..41ad065 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 _0x233c=['rpc','jayson/promise','client','http','socket.io-emitter','redis','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f3441,_0x42dd0f){var _0x145fb3=function(_0x2dc771){while(--_0x2dc771){_0x1f3441['push'](_0x1f3441['shift']());}};_0x145fb3(++_0x42dd0f);}(_0x233c,0x162));var _0xc233=function(_0x4b4e82,_0x4b3db7){_0x4b4e82=_0x4b4e82-0x0;var _0x17c3be=_0x233c[_0x4b4e82];return _0x17c3be;};'use strict';var _=require('lodash');var util=require(_0xc233('0x0'));var moment=require(_0xc233('0x1'));var BPromise=require(_0xc233('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc233('0x3'))['db'];var utils=require(_0xc233('0x4'));var logger=require(_0xc233('0x5'))(_0xc233('0x6'));var config=require('../../config/environment');var jayson=require(_0xc233('0x7'));var client=jayson[_0xc233('0x8')][_0xc233('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc233('0xa'))(new Redis(config[_0xc233('0xb')]));require(_0xc233('0xc'))['register'](socket);function respondWithRpcPromise(_0x49016d,_0x4e93b7,_0x1d23d3){return new BPromise(function(_0x57b715,_0x4afa0e){return client['request'](_0x49016d,_0x1d23d3)['then'](function(_0x218ae9){logger[_0xc233('0xd')](_0xc233('0xe'),_0x4e93b7,_0xc233('0xf'));logger['debug'](_0xc233('0x10'),_0x4e93b7,_0xc233('0xf'),JSON['stringify'](_0x218ae9));if(_0x218ae9[_0xc233('0x11')]){if(_0x218ae9[_0xc233('0x11')][_0xc233('0x12')]===0x1f4){logger[_0xc233('0x11')]('Team,\x20%s,\x20%s',_0x4e93b7,_0x218ae9[_0xc233('0x11')][_0xc233('0x13')]);return _0x4afa0e(_0x218ae9[_0xc233('0x11')][_0xc233('0x13')]);}logger[_0xc233('0x11')](_0xc233('0xe'),_0x4e93b7,_0x218ae9[_0xc233('0x11')][_0xc233('0x13')]);return _0x57b715(_0x218ae9[_0xc233('0x11')][_0xc233('0x13')]);}else{logger[_0xc233('0xd')](_0xc233('0xe'),_0x4e93b7,_0xc233('0xf'));_0x57b715(_0x218ae9['result'][_0xc233('0x13')]);}})['catch'](function(_0x3ad8f6){logger[_0xc233('0x11')](_0xc233('0xe'),_0x4e93b7,_0x3ad8f6);_0x4afa0e(_0x3ad8f6);});});} \ No newline at end of file +var _0x4c10=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','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','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4c10,0x1bf));var _0x04c1=function(_0x54a568,_0x512e08){_0x54a568=_0x54a568-0x0;var _0x573b13=_0x4c10[_0x54a568];return _0x573b13;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x04c1('0x0'));var BPromise=require(_0x04c1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c1('0x2'));var db=require(_0x04c1('0x3'))['db'];var utils=require(_0x04c1('0x4'));var logger=require(_0x04c1('0x5'))(_0x04c1('0x6'));var config=require(_0x04c1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x04c1('0x8')][_0x04c1('0x9')]({'port':0x232a});config[_0x04c1('0xa')]=_[_0x04c1('0xb')](config['redis'],{'host':_0x04c1('0xc'),'port':0x18eb});var socket=require(_0x04c1('0xd'))(new Redis(config[_0x04c1('0xa')]));require('./team.socket')[_0x04c1('0xe')](socket);function respondWithRpcPromise(_0x415f19,_0x4bbb9b,_0x388b34){return new BPromise(function(_0x4352a0,_0x2d508d){return client[_0x04c1('0xf')](_0x415f19,_0x388b34)[_0x04c1('0x10')](function(_0x2ac757){logger[_0x04c1('0x11')](_0x04c1('0x12'),_0x4bbb9b,'request\x20sent');logger[_0x04c1('0x13')](_0x04c1('0x14'),_0x4bbb9b,_0x04c1('0x15'),JSON[_0x04c1('0x16')](_0x2ac757));if(_0x2ac757[_0x04c1('0x17')]){if(_0x2ac757[_0x04c1('0x17')][_0x04c1('0x18')]===0x1f4){logger['error'](_0x04c1('0x12'),_0x4bbb9b,_0x2ac757[_0x04c1('0x17')][_0x04c1('0x19')]);return _0x2d508d(_0x2ac757[_0x04c1('0x17')]['message']);}logger[_0x04c1('0x17')](_0x04c1('0x12'),_0x4bbb9b,_0x2ac757['error']['message']);return _0x4352a0(_0x2ac757[_0x04c1('0x17')][_0x04c1('0x19')]);}else{logger[_0x04c1('0x11')]('Team,\x20%s,\x20%s',_0x4bbb9b,_0x04c1('0x15'));_0x4352a0(_0x2ac757[_0x04c1('0x1a')][_0x04c1('0x19')]);}})[_0x04c1('0x1b')](function(_0x32b683){logger[_0x04c1('0x17')](_0x04c1('0x12'),_0x4bbb9b,_0x32b683);_0x2d508d(_0x32b683);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 43e33a5..89b549c 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 _0xd2f5=['length','team:','./team.events','remove','emit','removeListener','register'];(function(_0x143a70,_0x54f316){var _0x30d67e=function(_0x30a114){while(--_0x30a114){_0x143a70['push'](_0x143a70['shift']());}};_0x30d67e(++_0x54f316);}(_0xd2f5,0x144));var _0x5d2f=function(_0x1fb762,_0x191763){_0x1fb762=_0x1fb762-0x0;var _0x39ecc5=_0xd2f5[_0x1fb762];return _0x39ecc5;};'use strict';var TeamEvents=require(_0x5d2f('0x0'));var events=['save',_0x5d2f('0x1'),'update'];function createListener(_0x2a7bb2,_0x4b9d79){return function(_0x784b59){_0x4b9d79[_0x5d2f('0x2')](_0x2a7bb2,_0x784b59);};}function removeListener(_0x102911,_0xc7102b){return function(){TeamEvents[_0x5d2f('0x3')](_0x102911,_0xc7102b);};}exports[_0x5d2f('0x4')]=function(_0x2392df){for(var _0x16e9fa=0x0,_0x4b2540=events[_0x5d2f('0x5')];_0x16e9fa<_0x4b2540;_0x16e9fa++){var _0x908c6=events[_0x16e9fa];var _0x1c8c59=createListener(_0x5d2f('0x6')+_0x908c6,_0x2392df);TeamEvents['on'](_0x908c6,_0x1c8c59);}}; \ No newline at end of file +var _0x8212=['emit','removeListener','length','team:','./team.events','save','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8212,0xb3));var _0x2821=function(_0xf70896,_0x9eed48){_0xf70896=_0xf70896-0x0;var _0x158111=_0x8212[_0xf70896];return _0x158111;};'use strict';var TeamEvents=require(_0x2821('0x0'));var events=[_0x2821('0x1'),'remove',_0x2821('0x2')];function createListener(_0x41ee88,_0x2149c3){return function(_0x328d67){_0x2149c3[_0x2821('0x3')](_0x41ee88,_0x328d67);};}function removeListener(_0x1b2d87,_0xbc7b3c){return function(){TeamEvents[_0x2821('0x4')](_0x1b2d87,_0xbc7b3c);};}exports['register']=function(_0x2f22bd){for(var _0x58d600=0x0,_0x376c57=events[_0x2821('0x5')];_0x58d600<_0x376c57;_0x58d600++){var _0x4ea6d5=events[_0x58d600];var _0x3644aa=createListener(_0x2821('0x6')+_0x4ea6d5,_0x2f22bd);TeamEvents['on'](_0x4ea6d5,_0x3644aa);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8ef1dbb..29e9198 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 _0x612c=['./template.controller','get','isAuthenticated','index','show','post','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15ea12,_0xb48ead){var _0x250916=function(_0x58542b){while(--_0x58542b){_0x15ea12['push'](_0x15ea12['shift']());}};_0x250916(++_0xb48ead);}(_0x612c,0x16e));var _0xc612=function(_0x228bc6,_0x5585a5){_0x228bc6=_0x228bc6-0x0;var _0x1e807a=_0x612c[_0x228bc6];return _0x1e807a;};'use strict';var multer=require('multer');var util=require(_0xc612('0x0'));var path=require(_0xc612('0x1'));var timeout=require(_0xc612('0x2'));var express=require(_0xc612('0x3'));var router=express[_0xc612('0x4')]();var auth=require(_0xc612('0x5'));var interaction=require(_0xc612('0x6'));var config=require(_0xc612('0x7'));var controller=require(_0xc612('0x8'));router[_0xc612('0x9')]('/',auth[_0xc612('0xa')](),controller[_0xc612('0xb')]);router[_0xc612('0x9')]('/:id',auth[_0xc612('0xa')](),controller[_0xc612('0xc')]);router[_0xc612('0xd')]('/',auth[_0xc612('0xa')](),controller['create']);router['put']('/:id',auth[_0xc612('0xa')](),controller[_0xc612('0xe')]);router[_0xc612('0xf')]('/:id',auth[_0xc612('0xa')](),controller['destroy']);module[_0xc612('0x10')]=router; \ No newline at end of file +var _0x9286=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','put','update','delete','multer','util','connect-timeout'];(function(_0x53d644,_0x13c262){var _0x3d7f8f=function(_0x303418){while(--_0x303418){_0x53d644['push'](_0x53d644['shift']());}};_0x3d7f8f(++_0x13c262);}(_0x9286,0x1dd));var _0x6928=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x9286[_0x4207a6];return _0x42b37a;};'use strict';var multer=require(_0x6928('0x0'));var util=require(_0x6928('0x1'));var path=require('path');var timeout=require(_0x6928('0x2'));var express=require(_0x6928('0x3'));var router=express['Router']();var auth=require(_0x6928('0x4'));var interaction=require(_0x6928('0x5'));var config=require(_0x6928('0x6'));var controller=require(_0x6928('0x7'));router[_0x6928('0x8')]('/',auth[_0x6928('0x9')](),controller[_0x6928('0xa')]);router['get'](_0x6928('0xb'),auth[_0x6928('0x9')](),controller[_0x6928('0xc')]);router['post']('/',auth[_0x6928('0x9')](),controller['create']);router[_0x6928('0xd')](_0x6928('0xb'),auth['isAuthenticated'](),controller[_0x6928('0xe')]);router[_0x6928('0xf')](_0x6928('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e7a4324..7b94e5b 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 _0x5000=['STRING','TEXT','sequelize','exports'];(function(_0x28d695,_0x53ba1f){var _0x254895=function(_0x881a43){while(--_0x881a43){_0x28d695['push'](_0x28d695['shift']());}};_0x254895(++_0x53ba1f);}(_0x5000,0x1a2));var _0x0500=function(_0x5c2602,_0x5bbba9){_0x5c2602=_0x5c2602-0x0;var _0x46e701=_0x5000[_0x5c2602];return _0x46e701;};'use strict';var Sequelize=require(_0x0500('0x0'));module[_0x0500('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0500('0x2')]},'html':{'type':Sequelize[_0x0500('0x3')]}}; \ No newline at end of file +var _0x553d=['sequelize','STRING','TEXT'];(function(_0x404610,_0x4df9ef){var _0x4db460=function(_0x53fa36){while(--_0x53fa36){_0x404610['push'](_0x404610['shift']());}};_0x4db460(++_0x4df9ef);}(_0x553d,0x192));var _0xd553=function(_0x15aa11,_0x333b88){_0x15aa11=_0x15aa11-0x0;var _0x5d3317=_0x553d[_0x15aa11];return _0x5d3317;};'use strict';var Sequelize=require(_0xd553('0x0'));module['exports']={'name':{'type':Sequelize[_0xd553('0x1')]},'description':{'type':Sequelize[_0xd553('0x1')]},'html':{'type':Sequelize[_0xd553('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8fb9116..1f87c1c 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 _0x7217=['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','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Template','count','includeAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x5635cf,_0xda4113){var _0x4fc3df=function(_0x57b2fc){while(--_0x57b2fc){_0x5635cf['push'](_0x5635cf['shift']());}};_0x4fc3df(++_0xda4113);}(_0x7217,0x19e));var _0x7721=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7217[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');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('0x9'));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=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){var _0x3e8a4e=_0x512f31[_0x7721('0x29')]({'plain':!![]});var _0x121cc4=_0x7721('0x2a');return db[_0x7721('0x2b')]['destroy']({'where':{'type':_0x121cc4,'resourceId':_0x3e8a4e['id']}})[_0x7721('0x27')](function(){return _0x512f31;});})[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x40d550,_0x16355a){return function(_0x424e05){if(!_0x424e05){_0x40d550[_0x7721('0x2c')](0x194);}return _0x424e05;};}function handleError(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0x1f4;return function(_0x258ddf){logger['error'](_0x258ddf['stack']);if(_0x258ddf[_0x7721('0x2d')]){delete _0x258ddf[_0x7721('0x2d')];}_0x40f367[_0x7721('0x1c')](_0x52316e)[_0x7721('0x2e')](_0x258ddf);};}exports[_0x7721('0x2f')]=function(_0x37b9f0,_0xd7d703){var _0x1da2d8={},_0x5c54f0={},_0x471651={'count':0x0,'rows':[]};var _0x2871c5=_['map'](db['Template'][_0x7721('0x30')],function(_0x220bbf){return{'name':_0x220bbf['fieldName'],'type':_0x220bbf[_0x7721('0x31')][_0x7721('0x32')]};});_0x5c54f0[_0x7721('0x33')]=_['map'](_0x2871c5,_0x7721('0x2d'));_0x5c54f0[_0x7721('0x34')]=_[_0x7721('0x35')](_0x37b9f0[_0x7721('0x34')]);_0x5c54f0[_0x7721('0x36')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],_0x5c54f0[_0x7721('0x34')]);_0x1da2d8[_0x7721('0x37')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],qs[_0x7721('0x38')](_0x37b9f0['query'][_0x7721('0x38')]));_0x1da2d8['attributes']=_0x1da2d8[_0x7721('0x37')][_0x7721('0x39')]?_0x1da2d8[_0x7721('0x37')]:_0x5c54f0[_0x7721('0x33')];if(!_0x37b9f0[_0x7721('0x34')][_0x7721('0x3a')](_0x7721('0x3b'))){_0x1da2d8[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x20')]);_0x1da2d8['offset']=qs[_0x7721('0x1f')](_0x37b9f0['query'][_0x7721('0x1f')]);}_0x1da2d8[_0x7721('0x3c')]=qs[_0x7721('0x3d')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x3d')]);_0x1da2d8[_0x7721('0x3e')]=qs['filters'](_['pick'](_0x37b9f0['query'],_0x5c54f0['filters']),_0x2871c5);if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x3f')]){_0x1da2d8[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x1da2d8['where'],{'$or':_[_0x7721('0x41')](_0x2871c5,function(_0x4cf659){if(_0x4cf659[_0x7721('0x31')]!==_0x7721('0x42')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x2d')]]={'$like':'%'+_0x37b9f0[_0x7721('0x34')]['filter']+'%'};return _0x5a278e;}})});}_0x1da2d8=_['merge']({},_0x1da2d8,_0x37b9f0[_0x7721('0x43')]);var _0xfc4dc4={'where':_0x1da2d8[_0x7721('0x3e')]};return db[_0x7721('0x44')]['count'](_0xfc4dc4)[_0x7721('0x27')](function(_0x120de9){_0x471651[_0x7721('0x45')]=_0x120de9;if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x46')]){_0x1da2d8['include']=[{'all':!![]}];}return db[_0x7721('0x44')]['findAll'](_0x1da2d8);})[_0x7721('0x27')](function(_0x4a5b59){_0x471651[_0x7721('0x47')]=_0x4a5b59;return _0x471651;})[_0x7721('0x27')](respondWithFilteredResult(_0xd7d703,_0x1da2d8))[_0x7721('0x48')](handleError(_0xd7d703,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':!![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x35')](db[_0x7721('0x44')][_0x7721('0x30')]);_0x481fa8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x34')]);_0x1ad315[_0x7721('0x37')]=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x38')](_0x1453d4[_0x7721('0x34')][_0x7721('0x38')]));_0x1ad315[_0x7721('0x37')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x37')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x34')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x40')]({},_0x1ad315,_0x1453d4[_0x7721('0x43')]);return db['Template'][_0x7721('0x4b')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x27')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4c')]=function(_0x196be4,_0xf17c40){return db['Template'][_0x7721('0x4c')](_0x196be4[_0x7721('0x4d')],{})['then'](function(_0x223d93){var _0x1196c2=_0x196be4[_0x7721('0x4e')]['get']({'plain':!![]});if(!_0x1196c2)throw new Error(_0x7721('0x4f'));if(_0x1196c2['role']===_0x7721('0x4e')){var _0x310549=_0x223d93[_0x7721('0x29')]({'plain':!![]});var _0x443503=_0x7721('0x2a');return db[_0x7721('0x50')][_0x7721('0x4b')]({'where':{'name':_0x443503,'userProfileId':_0x1196c2[_0x7721('0x51')]},'raw':!![]})[_0x7721('0x27')](function(_0x3386aa){if(_0x3386aa&&_0x3386aa[_0x7721('0x52')]===0x0){return db[_0x7721('0x2b')][_0x7721('0x4c')]({'name':_0x310549[_0x7721('0x2d')],'resourceId':_0x310549['id'],'type':_0x3386aa[_0x7721('0x2d')],'sectionId':_0x3386aa['id']},{})['then'](function(){return _0x223d93;});}else{return _0x223d93;}})[_0x7721('0x48')](function(_0x2f6f30){logger[_0x7721('0x53')](_0x7721('0x54'),_0x2f6f30);throw _0x2f6f30;});}return _0x223d93;})[_0x7721('0x27')](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x26')]=function(_0x57484c,_0x234bee){if(_0x57484c[_0x7721('0x4d')]['id']){delete _0x57484c[_0x7721('0x4d')]['id'];}return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x57484c[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x234bee,null))[_0x7721('0x27')](saveUpdates(_0x57484c[_0x7721('0x4d')],null))[_0x7721('0x27')](respondWithResult(_0x234bee,null))[_0x7721('0x48')](handleError(_0x234bee,null));};exports['destroy']=function(_0x421c27,_0xadb365){return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x421c27[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xadb365,null))[_0x7721('0x27')](removeEntity(_0xadb365,null))[_0x7721('0x48')](handleError(_0xadb365,null));}; \ No newline at end of file +var _0xe14b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','Templates','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x3f3571,_0x216802){var _0xa45351=function(_0x39dd47){while(--_0x39dd47){_0x3f3571['push'](_0x3f3571['shift']());}};_0xa45351(++_0x216802);}(_0xe14b,0x93));var _0xbe14=function(_0x1026f0,_0x2f6d14){_0x1026f0=_0x1026f0-0x0;var _0x38901d=_0xe14b[_0x1026f0];return _0x38901d;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9b6ca69..46ab8aa 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 _0x0e21=['rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','api','bluebird','request-promise'];(function(_0x1467d6,_0x5b19b2){var _0x3f8262=function(_0x55be71){while(--_0x55be71){_0x1467d6['push'](_0x1467d6['shift']());}};_0x3f8262(++_0x5b19b2);}(_0x0e21,0xa1));var _0x10e2=function(_0x432353,_0x32674a){_0x432353=_0x432353-0x0;var _0x41fb88=_0x0e21[_0x432353];return _0x41fb88;};'use strict';var _=require(_0x10e2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10e2('0x1'));var moment=require('moment');var BPromise=require(_0x10e2('0x2'));var rp=require(_0x10e2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10e2('0x4'));var config=require(_0x10e2('0x5'));var attributes=require(_0x10e2('0x6'));module[_0x10e2('0x7')]=function(_0x304262,_0x4dbd98){return _0x304262[_0x10e2('0x8')](_0x10e2('0x9'),attributes,{'tableName':_0x10e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d27=['path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xdc81a5,_0x458c8f){var _0x113192=function(_0x4bc3cf){while(--_0x4bc3cf){_0xdc81a5['push'](_0xdc81a5['shift']());}};_0x113192(++_0x458c8f);}(_0x7d27,0xa1));var _0x77d2=function(_0x86da5d,_0x18d93e){_0x86da5d=_0x86da5d-0x0;var _0x4f6f71=_0x7d27[_0x86da5d];return _0x4f6f71;};'use strict';var _=require(_0x77d2('0x0'));var util=require(_0x77d2('0x1'));var logger=require(_0x77d2('0x2'))(_0x77d2('0x3'));var moment=require(_0x77d2('0x4'));var BPromise=require(_0x77d2('0x5'));var rp=require(_0x77d2('0x6'));var fs=require('fs');var path=require(_0x77d2('0x7'));var rimraf=require(_0x77d2('0x8'));var config=require(_0x77d2('0x9'));var attributes=require(_0x77d2('0xa'));module[_0x77d2('0xb')]=function(_0x129775,_0x5ce246){return _0x129775[_0x77d2('0xc')]('Template',attributes,{'tableName':_0x77d2('0xd'),'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 b38ed07..fe77b7e 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 _0xc4c1=['message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','result','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x2cac8d,_0x14c4c6){var _0x2c59b1=function(_0x1f5252){while(--_0x1f5252){_0x2cac8d['push'](_0x2cac8d['shift']());}};_0x2c59b1(++_0x14c4c6);}(_0xc4c1,0x1c8));var _0x1c4c=function(_0x2b6fa6,_0x39c76f){_0x2b6fa6=_0x2b6fa6-0x0;var _0x4e9ab8=_0xc4c1[_0x2b6fa6];return _0x4e9ab8;};'use strict';var _=require(_0x1c4c('0x0'));var util=require(_0x1c4c('0x1'));var moment=require(_0x1c4c('0x2'));var BPromise=require(_0x1c4c('0x3'));var rs=require(_0x1c4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c4c('0x5'))['db'];var utils=require(_0x1c4c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c4c('0x7'));var jayson=require(_0x1c4c('0x8'));var client=jayson[_0x1c4c('0x9')][_0x1c4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x521996,_0x18c686,_0x12e613){return new BPromise(function(_0x4d5a9f,_0x2e0455){return client[_0x1c4c('0xb')](_0x521996,_0x12e613)[_0x1c4c('0xc')](function(_0x286fe0){logger[_0x1c4c('0xd')](_0x1c4c('0xe'),_0x18c686,_0x1c4c('0xf'));logger[_0x1c4c('0x10')](_0x1c4c('0x11'),_0x18c686,_0x1c4c('0xf'),JSON[_0x1c4c('0x12')](_0x286fe0));if(_0x286fe0[_0x1c4c('0x13')]){if(_0x286fe0[_0x1c4c('0x13')][_0x1c4c('0x14')]===0x1f4){logger[_0x1c4c('0x13')](_0x1c4c('0xe'),_0x18c686,_0x286fe0[_0x1c4c('0x13')]['message']);return _0x2e0455(_0x286fe0['error']['message']);}logger[_0x1c4c('0x13')](_0x1c4c('0xe'),_0x18c686,_0x286fe0['error']['message']);return _0x4d5a9f(_0x286fe0['error']['message']);}else{logger['info'](_0x1c4c('0xe'),_0x18c686,_0x1c4c('0xf'));_0x4d5a9f(_0x286fe0[_0x1c4c('0x15')]['message']);}})[_0x1c4c('0x16')](function(_0x266f83){logger[_0x1c4c('0x13')](_0x1c4c('0xe'),_0x18c686,_0x266f83);_0x2e0455(_0x266f83);});});}exports[_0x1c4c('0x17')]=function(_0x1a2fb3){var _0x55acbc=this;return new Promise(function(_0x278fe6,_0x2652b6){return db[_0x1c4c('0x18')][_0x1c4c('0x19')]({'raw':_0x1a2fb3[_0x1c4c('0x1a')]?_0x1a2fb3['options'][_0x1c4c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a2fb3[_0x1c4c('0x1a')]?_0x1a2fb3['options'][_0x1c4c('0x1c')]||null:null,'attributes':_0x1a2fb3[_0x1c4c('0x1a')]?_0x1a2fb3[_0x1c4c('0x1a')]['attributes']||null:null,'limit':_0x1a2fb3[_0x1c4c('0x1a')]?_0x1a2fb3['options'][_0x1c4c('0x1d')]||null:null,'include':_0x1a2fb3['options']?_0x1a2fb3[_0x1c4c('0x1a')][_0x1c4c('0x1e')]?_[_0x1c4c('0x1f')](_0x1a2fb3[_0x1c4c('0x1a')][_0x1c4c('0x1e')],function(_0x5520a5){return{'model':db[_0x5520a5[_0x1c4c('0x20')]],'as':_0x5520a5['as'],'attributes':_0x5520a5['attributes'],'include':_0x5520a5[_0x1c4c('0x1e')]?_['map'](_0x5520a5[_0x1c4c('0x1e')],function(_0x4a8ba4){return{'model':db[_0x4a8ba4[_0x1c4c('0x20')]],'as':_0x4a8ba4['as'],'attributes':_0x4a8ba4[_0x1c4c('0x21')],'include':_0x4a8ba4['include']?_['map'](_0x4a8ba4['include'],function(_0x2776ff){return{'model':db[_0x2776ff['model']],'as':_0x2776ff['as'],'attributes':_0x2776ff[_0x1c4c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cccdf){logger[_0x1c4c('0xd')](_0x1c4c('0x17'),_0x1a2fb3);logger[_0x1c4c('0x10')](_0x1c4c('0x17'),_0x1a2fb3,JSON[_0x1c4c('0x12')](_0x4cccdf));_0x278fe6(_0x4cccdf);})[_0x1c4c('0x16')](function(_0x40d995){logger[_0x1c4c('0x13')](_0x1c4c('0x17'),_0x40d995[_0x1c4c('0x22')],_0x1a2fb3);_0x2652b6(_0x55acbc[_0x1c4c('0x13')](0x1f4,_0x40d995[_0x1c4c('0x22')]));});});}; \ No newline at end of file +var _0xa0d9=['limit','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','where','attributes'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xa0d9,0x1be));var _0x9a0d=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xa0d9[_0x40927b];return _0x2635e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a0d('0x0'));var BPromise=require(_0x9a0d('0x1'));var rs=require(_0x9a0d('0x2'));var fs=require('fs');var Redis=require(_0x9a0d('0x3'));var db=require(_0x9a0d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a0d('0x5'))(_0x9a0d('0x6'));var config=require(_0x9a0d('0x7'));var jayson=require(_0x9a0d('0x8'));var client=jayson[_0x9a0d('0x9')][_0x9a0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa3e8a7,_0x5361da,_0x5669b6){return new BPromise(function(_0xd7a94f,_0x7cb6a4){return client[_0x9a0d('0xb')](_0xa3e8a7,_0x5669b6)[_0x9a0d('0xc')](function(_0xb55b20){logger[_0x9a0d('0xd')](_0x9a0d('0xe'),_0x5361da,'request\x20sent');logger[_0x9a0d('0xf')](_0x9a0d('0x10'),_0x5361da,_0x9a0d('0x11'),JSON[_0x9a0d('0x12')](_0xb55b20));if(_0xb55b20[_0x9a0d('0x13')]){if(_0xb55b20['error'][_0x9a0d('0x14')]===0x1f4){logger[_0x9a0d('0x13')](_0x9a0d('0xe'),_0x5361da,_0xb55b20[_0x9a0d('0x13')]['message']);return _0x7cb6a4(_0xb55b20[_0x9a0d('0x13')][_0x9a0d('0x15')]);}logger[_0x9a0d('0x13')](_0x9a0d('0xe'),_0x5361da,_0xb55b20['error']['message']);return _0xd7a94f(_0xb55b20[_0x9a0d('0x13')][_0x9a0d('0x15')]);}else{logger[_0x9a0d('0xd')]('Template,\x20%s,\x20%s',_0x5361da,'request\x20sent');_0xd7a94f(_0xb55b20[_0x9a0d('0x16')][_0x9a0d('0x15')]);}})[_0x9a0d('0x17')](function(_0x2d2dae){logger['error'](_0x9a0d('0xe'),_0x5361da,_0x2d2dae);_0x7cb6a4(_0x2d2dae);});});}exports[_0x9a0d('0x18')]=function(_0x3d4b3d){var _0x4f302c=this;return new Promise(function(_0x57c85a,_0x3e6846){return db[_0x9a0d('0x19')]['findAll']({'raw':_0x3d4b3d[_0x9a0d('0x1a')]?_0x3d4b3d[_0x9a0d('0x1a')][_0x9a0d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d4b3d[_0x9a0d('0x1a')]?_0x3d4b3d['options'][_0x9a0d('0x1c')]||null:null,'attributes':_0x3d4b3d[_0x9a0d('0x1a')]?_0x3d4b3d['options'][_0x9a0d('0x1d')]||null:null,'limit':_0x3d4b3d[_0x9a0d('0x1a')]?_0x3d4b3d[_0x9a0d('0x1a')][_0x9a0d('0x1e')]||null:null,'include':_0x3d4b3d[_0x9a0d('0x1a')]?_0x3d4b3d[_0x9a0d('0x1a')][_0x9a0d('0x1f')]?_[_0x9a0d('0x20')](_0x3d4b3d[_0x9a0d('0x1a')][_0x9a0d('0x1f')],function(_0x4dcf8e){return{'model':db[_0x4dcf8e[_0x9a0d('0x21')]],'as':_0x4dcf8e['as'],'attributes':_0x4dcf8e['attributes'],'include':_0x4dcf8e[_0x9a0d('0x1f')]?_[_0x9a0d('0x20')](_0x4dcf8e[_0x9a0d('0x1f')],function(_0x26c19d){return{'model':db[_0x26c19d[_0x9a0d('0x21')]],'as':_0x26c19d['as'],'attributes':_0x26c19d[_0x9a0d('0x1d')],'include':_0x26c19d['include']?_[_0x9a0d('0x20')](_0x26c19d[_0x9a0d('0x1f')],function(_0x11da9b){return{'model':db[_0x11da9b[_0x9a0d('0x21')]],'as':_0x11da9b['as'],'attributes':_0x11da9b[_0x9a0d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a0d('0xc')](function(_0x302b69){logger[_0x9a0d('0xd')](_0x9a0d('0x18'),_0x3d4b3d);logger[_0x9a0d('0xf')]('GetTemplate',_0x3d4b3d,JSON['stringify'](_0x302b69));_0x57c85a(_0x302b69);})[_0x9a0d('0x17')](function(_0x25fb8e){logger[_0x9a0d('0x13')](_0x9a0d('0x18'),_0x25fb8e[_0x9a0d('0x15')],_0x3d4b3d);_0x3e6846(_0x4f302c[_0x9a0d('0x13')](0x1f4,_0x25fb8e['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 726f0d3..bb7b8e5 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 _0x1432=['get','/:id','show','getAllConditions','/:id/any_conditions','isAuthenticated','/:id/actions','getActions','post','addAnyCondition','addAction','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x1432,0x1b8));var _0x2143=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x1432[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0x2143('0x0'));var util=require(_0x2143('0x1'));var path=require(_0x2143('0x2'));var timeout=require(_0x2143('0x3'));var express=require(_0x2143('0x4'));var router=express[_0x2143('0x5')]();var auth=require(_0x2143('0x6'));var interaction=require(_0x2143('0x7'));var config=require(_0x2143('0x8'));var controller=require(_0x2143('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2143('0xa')](_0x2143('0xb'),auth['isAuthenticated'](),controller[_0x2143('0xc')]);router[_0x2143('0xa')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x2143('0xd')]);router[_0x2143('0xa')](_0x2143('0xe'),auth[_0x2143('0xf')](),controller['getAnyConditions']);router['get'](_0x2143('0x10'),auth[_0x2143('0xf')](),controller[_0x2143('0x11')]);router['post']('/',auth[_0x2143('0xf')](),controller['create']);router[_0x2143('0x12')]('/:id/all_conditions',auth[_0x2143('0xf')](),controller['addAllCondition']);router[_0x2143('0x12')](_0x2143('0xe'),auth[_0x2143('0xf')](),controller[_0x2143('0x13')]);router[_0x2143('0x12')](_0x2143('0x10'),auth[_0x2143('0xf')](),controller[_0x2143('0x14')]);router['put'](_0x2143('0xb'),auth['isAuthenticated'](),controller[_0x2143('0x15')]);router[_0x2143('0x16')](_0x2143('0xb'),auth[_0x2143('0xf')](),controller[_0x2143('0x17')]);module[_0x2143('0x18')]=router; \ No newline at end of file +var _0xee11=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','/:id/all_conditions','addAllCondition','post','addAction','update','delete','destroy'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0xee11,0x180));var _0x1ee1=function(_0x5bf82d,_0x290676){_0x5bf82d=_0x5bf82d-0x0;var _0x35122d=_0xee11[_0x5bf82d];return _0x35122d;};'use strict';var multer=require('multer');var util=require(_0x1ee1('0x0'));var path=require('path');var timeout=require(_0x1ee1('0x1'));var express=require(_0x1ee1('0x2'));var router=express[_0x1ee1('0x3')]();var auth=require(_0x1ee1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1ee1('0x5'));var controller=require(_0x1ee1('0x6'));router[_0x1ee1('0x7')]('/',auth[_0x1ee1('0x8')](),controller[_0x1ee1('0x9')]);router['get'](_0x1ee1('0xa'),auth[_0x1ee1('0x8')](),controller[_0x1ee1('0xb')]);router[_0x1ee1('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router[_0x1ee1('0x7')](_0x1ee1('0xc'),auth['isAuthenticated'](),controller[_0x1ee1('0xd')]);router['get'](_0x1ee1('0xe'),auth[_0x1ee1('0x8')](),controller[_0x1ee1('0xf')]);router['post']('/',auth[_0x1ee1('0x8')](),controller[_0x1ee1('0x10')]);router['post'](_0x1ee1('0x11'),auth['isAuthenticated'](),controller[_0x1ee1('0x12')]);router[_0x1ee1('0x13')]('/:id/any_conditions',auth[_0x1ee1('0x8')](),controller['addAnyCondition']);router[_0x1ee1('0x13')](_0x1ee1('0xe'),auth[_0x1ee1('0x8')](),controller[_0x1ee1('0x14')]);router['put'](_0x1ee1('0xa'),auth[_0x1ee1('0x8')](),controller[_0x1ee1('0x15')]);router[_0x1ee1('0x16')](_0x1ee1('0xa'),auth[_0x1ee1('0x8')](),controller[_0x1ee1('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ee78520..473bfb4 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 _0x3876=['STRING','BOOLEAN','sequelize','exports'];(function(_0x207b87,_0x3266e5){var _0xbc46ff=function(_0x8a4c5f){while(--_0x8a4c5f){_0x207b87['push'](_0x207b87['shift']());}};_0xbc46ff(++_0x3266e5);}(_0x3876,0x1da));var _0x6387=function(_0x55db0e,_0x57acd9){_0x55db0e=_0x55db0e-0x0;var _0x21fa2e=_0x3876[_0x55db0e];return _0x21fa2e;};'use strict';var Sequelize=require(_0x6387('0x0'));module[_0x6387('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6387('0x2')]},'description':{'type':Sequelize[_0x6387('0x2')]},'status':{'type':Sequelize[_0x6387('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbcad=['BOOLEAN','STRING'];(function(_0x4acf20,_0x3f4636){var _0x50eabc=function(_0x20c518){while(--_0x20c518){_0x4acf20['push'](_0x4acf20['shift']());}};_0x50eabc(++_0x3f4636);}(_0xbcad,0x1b1));var _0xdbca=function(_0x4b5873,_0x5eae7c){_0x4b5873=_0x4b5873-0x0;var _0x96976=_0xbcad[_0x4b5873];return _0x96976;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdbca('0x0')]},'status':{'type':Sequelize[_0xdbca('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4efa7ad..d7841a9 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 _0x34e7=['end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','Trigger','count','includeAll','include','findAll','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','options','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x34e7,0x164));var _0x734e=function(_0x41352f,_0x3ee601){_0x41352f=_0x41352f-0x0;var _0x240475=_0x34e7[_0x41352f];return _0x240475;};'use strict';var pdf=require(_0x734e('0x0'));var emlformat=require(_0x734e('0x1'));var rimraf=require(_0x734e('0x2'));var zipdir=require(_0x734e('0x3'));var jsonpatch=require(_0x734e('0x4'));var rp=require(_0x734e('0x5'));var moment=require(_0x734e('0x6'));var BPromise=require(_0x734e('0x7'));var Mustache=require(_0x734e('0x8'));var util=require(_0x734e('0x9'));var path=require(_0x734e('0xa'));var sox=require(_0x734e('0xb'));var csv=require(_0x734e('0xc'));var ejs=require(_0x734e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x734e('0xe'));var crypto=require(_0x734e('0xf'));var jsforce=require(_0x734e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x734e('0xc'));var querystring=require('querystring');var Papa=require(_0x734e('0x11'));var Redis=require(_0x734e('0x12'));var authService=require(_0x734e('0x13'));var qs=require(_0x734e('0x14'));var as=require(_0x734e('0x15'));var hardwareService=require(_0x734e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x734e('0x17'));var config=require(_0x734e('0x18'));var licenseUtil=require(_0x734e('0x19'));var db=require(_0x734e('0x1a'))['db'];function respondWithStatusCode(_0x4bf3e0,_0x1cca88){_0x1cca88=_0x1cca88||0xcc;return function(_0x2cfb3a){if(_0x2cfb3a){return _0x4bf3e0['sendStatus'](_0x1cca88);}return _0x4bf3e0[_0x734e('0x1b')](_0x1cca88)[_0x734e('0x1c')]();};}function respondWithResult(_0x1b7510,_0x44653e){_0x44653e=_0x44653e||0xc8;return function(_0x4f16d8){if(_0x4f16d8){return _0x1b7510['status'](_0x44653e)[_0x734e('0x1d')](_0x4f16d8);}};}function respondWithFilteredResult(_0x2e0d33,_0x2746e2){return function(_0x4f9e90){if(_0x4f9e90){var _0x2c1bdb=_0x4f9e90['count'],_0x4cb595=_0x2746e2[_0x734e('0x1e')],_0x173009=_0x2746e2['offset']+_0x2746e2[_0x734e('0x1f')],_0x3aa65b;if(_0x173009>=_0x2c1bdb){_0x173009=_0x2c1bdb;_0x3aa65b=0xc8;}else{_0x3aa65b=0xce;}_0x2e0d33['status'](_0x3aa65b);return _0x2e0d33[_0x734e('0x20')](_0x734e('0x21'),_0x4cb595+'-'+_0x173009+'/'+_0x2c1bdb)[_0x734e('0x1d')](_0x4f9e90);}return null;};}function patchUpdates(_0x3b11c2){return function(_0x276f50){try{jsonpatch[_0x734e('0x22')](_0x276f50,_0x3b11c2,!![]);}catch(_0x138b29){return BPromise[_0x734e('0x23')](_0x138b29);}return _0x276f50[_0x734e('0x24')]();};}function saveUpdates(_0x5011e6,_0x121f58){return function(_0x47bc5e){if(_0x47bc5e){return _0x47bc5e[_0x734e('0x25')](_0x5011e6)['then'](function(_0x491759){return _0x491759;});}return null;};}function removeEntity(_0x207cae,_0x58cec4){return function(_0x21b1a0){if(_0x21b1a0){return _0x21b1a0['destroy']()[_0x734e('0x26')](function(){var _0x3afcc3=_0x21b1a0[_0x734e('0x27')]({'plain':!![]});var _0x25ae9d=_0x734e('0x28');return db[_0x734e('0x29')][_0x734e('0x2a')]({'where':{'type':_0x25ae9d,'resourceId':_0x3afcc3['id']}})[_0x734e('0x26')](function(){return _0x21b1a0;});})[_0x734e('0x26')](function(){_0x207cae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1276ba,_0x417961){return function(_0x2f1ce4){if(!_0x2f1ce4){_0x1276ba[_0x734e('0x2b')](0x194);}return _0x2f1ce4;};}function handleError(_0x130daf,_0x2a3762){_0x2a3762=_0x2a3762||0x1f4;return function(_0xe7de3){logger[_0x734e('0x2c')](_0xe7de3['stack']);if(_0xe7de3[_0x734e('0x2d')]){delete _0xe7de3['name'];}_0x130daf[_0x734e('0x1b')](_0x2a3762)[_0x734e('0x2e')](_0xe7de3);};}exports[_0x734e('0x2f')]=function(_0x44c379,_0x50e64c){var _0x3c965c={},_0x273438={},_0x441604={'count':0x0,'rows':[]};var _0xa9aaba=_[_0x734e('0x30')](db['Trigger'][_0x734e('0x31')],function(_0x24558b){return{'name':_0x24558b[_0x734e('0x32')],'type':_0x24558b[_0x734e('0x33')]['key']};});_0x273438['model']=_['map'](_0xa9aaba,_0x734e('0x2d'));_0x273438[_0x734e('0x34')]=_[_0x734e('0x35')](_0x44c379[_0x734e('0x34')]);_0x273438[_0x734e('0x36')]=_[_0x734e('0x37')](_0x273438[_0x734e('0x38')],_0x273438[_0x734e('0x34')]);_0x3c965c[_0x734e('0x39')]=_['intersection'](_0x273438['model'],qs[_0x734e('0x3a')](_0x44c379[_0x734e('0x34')][_0x734e('0x3a')]));_0x3c965c['attributes']=_0x3c965c[_0x734e('0x39')][_0x734e('0x3b')]?_0x3c965c['attributes']:_0x273438[_0x734e('0x38')];if(!_0x44c379[_0x734e('0x34')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x3c965c['limit']=qs[_0x734e('0x1f')](_0x44c379[_0x734e('0x34')][_0x734e('0x1f')]);_0x3c965c['offset']=qs['offset'](_0x44c379['query'][_0x734e('0x1e')]);}_0x3c965c[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x44c379[_0x734e('0x34')]['sort']);_0x3c965c['where']=qs[_0x734e('0x36')](_[_0x734e('0x40')](_0x44c379[_0x734e('0x34')],_0x273438[_0x734e('0x36')]),_0xa9aaba);if(_0x44c379[_0x734e('0x34')][_0x734e('0x41')]){_0x3c965c['where']=_[_0x734e('0x42')](_0x3c965c[_0x734e('0x43')],{'$or':_['map'](_0xa9aaba,function(_0x241cd6){if(_0x241cd6[_0x734e('0x33')]!==_0x734e('0x44')){var _0x3f1c8e={};_0x3f1c8e[_0x241cd6[_0x734e('0x2d')]]={'$like':'%'+_0x44c379[_0x734e('0x34')][_0x734e('0x41')]+'%'};return _0x3f1c8e;}})});}_0x3c965c=_['merge']({},_0x3c965c,_0x44c379['options']);var _0x357e4c={'where':_0x3c965c[_0x734e('0x43')]};return db[_0x734e('0x45')]['count'](_0x357e4c)[_0x734e('0x26')](function(_0x565cb1){_0x441604[_0x734e('0x46')]=_0x565cb1;if(_0x44c379[_0x734e('0x34')][_0x734e('0x47')]){_0x3c965c[_0x734e('0x48')]=[{'all':!![]}];}return db[_0x734e('0x45')][_0x734e('0x49')](_0x3c965c);})['then'](function(_0x2783aa){_0x441604['rows']=_0x2783aa;return _0x441604;})[_0x734e('0x26')](respondWithFilteredResult(_0x50e64c,_0x3c965c))['catch'](handleError(_0x50e64c,null));};exports[_0x734e('0x4a')]=function(_0x4d4f0a,_0x48f57f){var _0x1f452e={'raw':![],'where':{'id':_0x4d4f0a['params']['id']}},_0x1362bd={};_0x1362bd[_0x734e('0x38')]=_[_0x734e('0x35')](db['Trigger'][_0x734e('0x31')]);_0x1362bd['query']=_[_0x734e('0x35')](_0x4d4f0a[_0x734e('0x34')]);_0x1362bd[_0x734e('0x36')]=_[_0x734e('0x37')](_0x1362bd[_0x734e('0x38')],_0x1362bd['query']);_0x1f452e[_0x734e('0x39')]=_[_0x734e('0x37')](_0x1362bd[_0x734e('0x38')],qs['fields'](_0x4d4f0a[_0x734e('0x34')]['fields']));_0x1f452e[_0x734e('0x39')]=_0x1f452e['attributes'][_0x734e('0x3b')]?_0x1f452e[_0x734e('0x39')]:_0x1362bd[_0x734e('0x38')];if(_0x4d4f0a[_0x734e('0x34')][_0x734e('0x47')]){_0x1f452e['include']=[{'all':!![]}];}_0x1f452e=_[_0x734e('0x42')]({},_0x1f452e,_0x4d4f0a['options']);return db[_0x734e('0x45')]['find'](_0x1f452e)['then'](handleEntityNotFound(_0x48f57f,null))[_0x734e('0x26')](respondWithResult(_0x48f57f,null))['catch'](handleError(_0x48f57f,null));};exports[_0x734e('0x4b')]=function(_0x4f1c4,_0x33a877){return db[_0x734e('0x45')]['create'](_0x4f1c4[_0x734e('0x4c')],{})['then'](function(_0x3a9a9e){var _0x20e8a7=_0x4f1c4[_0x734e('0x4d')][_0x734e('0x27')]({'plain':!![]});if(!_0x20e8a7)throw new Error(_0x734e('0x4e'));if(_0x20e8a7[_0x734e('0x4f')]===_0x734e('0x4d')){var _0x230626=_0x3a9a9e['get']({'plain':!![]});var _0x4e6967=_0x734e('0x28');return db[_0x734e('0x50')][_0x734e('0x51')]({'where':{'name':_0x4e6967,'userProfileId':_0x20e8a7[_0x734e('0x52')]},'raw':!![]})['then'](function(_0x112486){if(_0x112486&&_0x112486['autoAssociation']===0x0){return db[_0x734e('0x29')][_0x734e('0x4b')]({'name':_0x230626[_0x734e('0x2d')],'resourceId':_0x230626['id'],'type':_0x112486[_0x734e('0x2d')],'sectionId':_0x112486['id']},{})['then'](function(){return _0x3a9a9e;});}else{return _0x3a9a9e;}})[_0x734e('0x53')](function(_0x2b64e2){logger[_0x734e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b64e2);throw _0x2b64e2;});}return _0x3a9a9e;})[_0x734e('0x26')](respondWithResult(_0x33a877,0xc9))[_0x734e('0x53')](handleError(_0x33a877,null));};exports[_0x734e('0x25')]=function(_0x18a6e4,_0x1664c6){if(_0x18a6e4['body']['id']){delete _0x18a6e4[_0x734e('0x4c')]['id'];}return db['Trigger'][_0x734e('0x51')]({'where':{'id':_0x18a6e4[_0x734e('0x54')]['id']}})[_0x734e('0x26')](handleEntityNotFound(_0x1664c6,null))[_0x734e('0x26')](saveUpdates(_0x18a6e4[_0x734e('0x4c')],null))[_0x734e('0x26')](respondWithResult(_0x1664c6,null))[_0x734e('0x53')](handleError(_0x1664c6,null));};exports[_0x734e('0x2a')]=function(_0x18c0fe,_0x4ae6d6){return db[_0x734e('0x45')][_0x734e('0x51')]({'where':{'id':_0x18c0fe[_0x734e('0x54')]['id']}})[_0x734e('0x26')](handleEntityNotFound(_0x4ae6d6,null))[_0x734e('0x26')](removeEntity(_0x4ae6d6,null))['catch'](handleError(_0x4ae6d6,null));};exports[_0x734e('0x55')]=function(_0x1e6187,_0x5c3b39,_0x3945bb){if(_0x1e6187[_0x734e('0x4c')]['id']){delete _0x1e6187['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x1e6187['params']['id']}})[_0x734e('0x26')](handleEntityNotFound(_0x5c3b39,null))[_0x734e('0x26')](function(_0x13353e){if(_0x13353e){_0x1e6187[_0x734e('0x4c')]['TriggerAllId']=_0x13353e['id'];return db[_0x734e('0x56')][_0x734e('0x4b')](_0x1e6187[_0x734e('0x4c')]);}})['then'](respondWithResult(_0x5c3b39,null))[_0x734e('0x53')](handleError(_0x5c3b39,null));};exports[_0x734e('0x57')]=function(_0x5f3044,_0x3c3278,_0x1e9616){if(_0x5f3044[_0x734e('0x4c')]['id']){delete _0x5f3044[_0x734e('0x4c')]['id'];}return db[_0x734e('0x45')][_0x734e('0x51')]({'where':{'id':_0x5f3044[_0x734e('0x54')]['id']}})[_0x734e('0x26')](handleEntityNotFound(_0x3c3278,null))['then'](function(_0x55cfaf){if(_0x55cfaf){_0x5f3044[_0x734e('0x4c')][_0x734e('0x58')]=_0x55cfaf['id'];return db[_0x734e('0x56')]['create'](_0x5f3044[_0x734e('0x4c')]);}})[_0x734e('0x26')](respondWithResult(_0x3c3278,null))[_0x734e('0x53')](handleError(_0x3c3278,null));};exports[_0x734e('0x59')]=function(_0xaf8d59,_0x352495,_0x3f3a4c){var _0x2c2c00={};var _0x1ed738={};var _0x5102c3;var _0x17c6e1;return db[_0x734e('0x45')][_0x734e('0x5a')]({'where':{'id':_0xaf8d59[_0x734e('0x54')]['id']}})['then'](handleEntityNotFound(_0x352495,null))[_0x734e('0x26')](function(_0x26e381){if(_0x26e381){_0x5102c3=_0x26e381;_0x1ed738[_0x734e('0x38')]=_['keys'](db[_0x734e('0x56')][_0x734e('0x31')]);_0x1ed738['query']=_[_0x734e('0x35')](_0xaf8d59[_0x734e('0x34')]);_0x1ed738[_0x734e('0x36')]=_[_0x734e('0x37')](_0x1ed738[_0x734e('0x38')],_0x1ed738[_0x734e('0x34')]);_0x2c2c00[_0x734e('0x39')]=_['intersection'](_0x1ed738[_0x734e('0x38')],qs['fields'](_0xaf8d59[_0x734e('0x34')][_0x734e('0x3a')]));_0x2c2c00['attributes']=_0x2c2c00[_0x734e('0x39')][_0x734e('0x3b')]?_0x2c2c00['attributes']:_0x1ed738[_0x734e('0x38')];_0x2c2c00[_0x734e('0x3e')]=qs['sort'](_0xaf8d59[_0x734e('0x34')]['sort']);_0x2c2c00['where']=qs[_0x734e('0x36')](_[_0x734e('0x40')](_0xaf8d59[_0x734e('0x34')],_0x1ed738[_0x734e('0x36')]));if(_0xaf8d59['query'][_0x734e('0x41')]){_0x2c2c00['where']=_['merge'](_0x2c2c00[_0x734e('0x43')],{'$or':_[_0x734e('0x30')](_0x2c2c00[_0x734e('0x39')],function(_0x5e257b){var _0x45e3f1={};_0x45e3f1[_0x5e257b]={'$like':'%'+_0xaf8d59[_0x734e('0x34')]['filter']+'%'};return _0x45e3f1;})});}_0x2c2c00=_['merge']({},_0x2c2c00,_0xaf8d59['options']);return _0x5102c3['getAllConditions'](_0x2c2c00);}})[_0x734e('0x26')](function(_0x4d2628){if(_0x4d2628){_0x17c6e1=_0x4d2628[_0x734e('0x3b')];if(!_0xaf8d59[_0x734e('0x34')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x2c2c00[_0x734e('0x1f')]=qs['limit'](_0xaf8d59[_0x734e('0x34')][_0x734e('0x1f')]);_0x2c2c00[_0x734e('0x1e')]=qs[_0x734e('0x1e')](_0xaf8d59[_0x734e('0x34')]['offset']);}return _0x5102c3[_0x734e('0x59')](_0x2c2c00);}})[_0x734e('0x26')](function(_0x13a9ab){if(_0x13a9ab){return _0x13a9ab?{'count':_0x17c6e1,'rows':_0x13a9ab}:null;}})[_0x734e('0x26')](respondWithResult(_0x352495,null))[_0x734e('0x53')](handleError(_0x352495,null));};exports[_0x734e('0x5b')]=function(_0x438ab3,_0x800824,_0x5e7960){var _0x2ce236={};var _0x3edc3b={};var _0x144b86;var _0x5b8180;return db[_0x734e('0x45')][_0x734e('0x5a')]({'where':{'id':_0x438ab3[_0x734e('0x54')]['id']}})[_0x734e('0x26')](handleEntityNotFound(_0x800824,null))['then'](function(_0x3fe05a){if(_0x3fe05a){_0x144b86=_0x3fe05a;_0x3edc3b[_0x734e('0x38')]=_[_0x734e('0x35')](db[_0x734e('0x56')][_0x734e('0x31')]);_0x3edc3b[_0x734e('0x34')]=_[_0x734e('0x35')](_0x438ab3[_0x734e('0x34')]);_0x3edc3b[_0x734e('0x36')]=_[_0x734e('0x37')](_0x3edc3b[_0x734e('0x38')],_0x3edc3b['query']);_0x2ce236[_0x734e('0x39')]=_[_0x734e('0x37')](_0x3edc3b[_0x734e('0x38')],qs[_0x734e('0x3a')](_0x438ab3[_0x734e('0x34')]['fields']));_0x2ce236['attributes']=_0x2ce236[_0x734e('0x39')][_0x734e('0x3b')]?_0x2ce236[_0x734e('0x39')]:_0x3edc3b['model'];_0x2ce236[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x438ab3[_0x734e('0x34')]['sort']);_0x2ce236[_0x734e('0x43')]=qs[_0x734e('0x36')](_['pick'](_0x438ab3[_0x734e('0x34')],_0x3edc3b['filters']));if(_0x438ab3[_0x734e('0x34')]['filter']){_0x2ce236[_0x734e('0x43')]=_[_0x734e('0x42')](_0x2ce236[_0x734e('0x43')],{'$or':_[_0x734e('0x30')](_0x2ce236['attributes'],function(_0x5a111f){var _0x3fc3ab={};_0x3fc3ab[_0x5a111f]={'$like':'%'+_0x438ab3['query'][_0x734e('0x41')]+'%'};return _0x3fc3ab;})});}_0x2ce236=_[_0x734e('0x42')]({},_0x2ce236,_0x438ab3[_0x734e('0x5c')]);return _0x144b86[_0x734e('0x5b')](_0x2ce236);}})[_0x734e('0x26')](function(_0x3ef4eb){if(_0x3ef4eb){_0x5b8180=_0x3ef4eb['length'];if(!_0x438ab3['query'][_0x734e('0x3c')](_0x734e('0x3d'))){_0x2ce236['limit']=qs[_0x734e('0x1f')](_0x438ab3['query'][_0x734e('0x1f')]);_0x2ce236[_0x734e('0x1e')]=qs[_0x734e('0x1e')](_0x438ab3[_0x734e('0x34')][_0x734e('0x1e')]);}return _0x144b86[_0x734e('0x5b')](_0x2ce236);}})[_0x734e('0x26')](function(_0x16a950){if(_0x16a950){return _0x16a950?{'count':_0x5b8180,'rows':_0x16a950}:null;}})[_0x734e('0x26')](respondWithResult(_0x800824,null))[_0x734e('0x53')](handleError(_0x800824,null));};exports['addAction']=function(_0x14233b,_0x578fe7,_0x3d7720){if(_0x14233b['body']['id']){delete _0x14233b[_0x734e('0x4c')]['id'];}return db[_0x734e('0x45')][_0x734e('0x51')]({'where':{'id':_0x14233b[_0x734e('0x54')]['id']}})['then'](handleEntityNotFound(_0x578fe7,null))[_0x734e('0x26')](function(_0x4b7360){if(_0x4b7360){_0x14233b[_0x734e('0x4c')][_0x734e('0x5d')]=_0x4b7360['id'];return db[_0x734e('0x5e')][_0x734e('0x4b')](_0x14233b[_0x734e('0x4c')]);}})[_0x734e('0x26')](respondWithResult(_0x578fe7,null))['catch'](handleError(_0x578fe7,null));};exports['getActions']=function(_0x1b0a7c,_0x4afa55,_0x3c559f){var _0x5cf1be={};var _0x4767fd={};var _0x39076d;var _0x54edbd;return db['Trigger'][_0x734e('0x5a')]({'where':{'id':_0x1b0a7c['params']['id']}})[_0x734e('0x26')](handleEntityNotFound(_0x4afa55,null))['then'](function(_0x39ad8a){if(_0x39ad8a){_0x39076d=_0x39ad8a;_0x4767fd[_0x734e('0x38')]=_[_0x734e('0x35')](db[_0x734e('0x5e')]['rawAttributes']);_0x4767fd[_0x734e('0x34')]=_[_0x734e('0x35')](_0x1b0a7c[_0x734e('0x34')]);_0x4767fd[_0x734e('0x36')]=_[_0x734e('0x37')](_0x4767fd[_0x734e('0x38')],_0x4767fd['query']);_0x5cf1be[_0x734e('0x39')]=_[_0x734e('0x37')](_0x4767fd[_0x734e('0x38')],qs['fields'](_0x1b0a7c[_0x734e('0x34')][_0x734e('0x3a')]));_0x5cf1be[_0x734e('0x39')]=_0x5cf1be[_0x734e('0x39')][_0x734e('0x3b')]?_0x5cf1be[_0x734e('0x39')]:_0x4767fd['model'];_0x5cf1be[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x1b0a7c[_0x734e('0x34')][_0x734e('0x3f')]);_0x5cf1be[_0x734e('0x43')]=qs['filters'](_[_0x734e('0x40')](_0x1b0a7c['query'],_0x4767fd[_0x734e('0x36')]));if(_0x1b0a7c[_0x734e('0x34')][_0x734e('0x41')]){_0x5cf1be[_0x734e('0x43')]=_[_0x734e('0x42')](_0x5cf1be[_0x734e('0x43')],{'$or':_[_0x734e('0x30')](_0x5cf1be[_0x734e('0x39')],function(_0x359729){var _0x281158={};_0x281158[_0x359729]={'$like':'%'+_0x1b0a7c[_0x734e('0x34')][_0x734e('0x41')]+'%'};return _0x281158;})});}_0x5cf1be=_[_0x734e('0x42')]({},_0x5cf1be,_0x1b0a7c[_0x734e('0x5c')]);return _0x39076d[_0x734e('0x5f')](_0x5cf1be);}})[_0x734e('0x26')](function(_0x3dd4e4){if(_0x3dd4e4){_0x54edbd=_0x3dd4e4['length'];if(!_0x1b0a7c[_0x734e('0x34')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x5cf1be[_0x734e('0x1f')]=qs['limit'](_0x1b0a7c[_0x734e('0x34')][_0x734e('0x1f')]);_0x5cf1be[_0x734e('0x1e')]=qs['offset'](_0x1b0a7c[_0x734e('0x34')][_0x734e('0x1e')]);}return _0x39076d[_0x734e('0x5f')](_0x5cf1be);}})[_0x734e('0x26')](function(_0x582bdb){if(_0x582bdb){return _0x582bdb?{'count':_0x54edbd,'rows':_0x582bdb}:null;}})[_0x734e('0x26')](respondWithResult(_0x4afa55,null))[_0x734e('0x53')](handleError(_0x4afa55,null));}; \ No newline at end of file +var _0xaced=['Triggers','sendStatus','error','name','send','index','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','Trigger','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Condition','addAnyCondition','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','count','offset','Content-Range','apply','reject','update','then','destroy'];(function(_0x57ed9b,_0x299e4e){var _0x58174a=function(_0x46d77e){while(--_0x46d77e){_0x57ed9b['push'](_0x57ed9b['shift']());}};_0x58174a(++_0x299e4e);}(_0xaced,0x18c));var _0xdace=function(_0x55392c,_0x6d87c6){_0x55392c=_0x55392c-0x0;var _0x1540bc=_0xaced[_0x55392c];return _0x1540bc;};'use strict';var pdf=require(_0xdace('0x0'));var emlformat=require(_0xdace('0x1'));var rimraf=require(_0xdace('0x2'));var zipdir=require(_0xdace('0x3'));var jsonpatch=require(_0xdace('0x4'));var rp=require('request-promise');var moment=require(_0xdace('0x5'));var BPromise=require(_0xdace('0x6'));var Mustache=require(_0xdace('0x7'));var util=require(_0xdace('0x8'));var path=require('path');var sox=require(_0xdace('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdace('0xa'));var squel=require(_0xdace('0xb'));var crypto=require(_0xdace('0xc'));var jsforce=require(_0xdace('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdace('0xe'));var Papa=require(_0xdace('0xf'));var Redis=require(_0xdace('0x10'));var authService=require(_0xdace('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdace('0x12'));var hardwareService=require(_0xdace('0x13'));var logger=require(_0xdace('0x14'))(_0xdace('0x15'));var utils=require('../../config/utils');var config=require(_0xdace('0x16'));var licenseUtil=require(_0xdace('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db53c,_0x4c1fde){_0x4c1fde=_0x4c1fde||0xcc;return function(_0x3c483c){if(_0x3c483c){return _0x4db53c['sendStatus'](_0x4c1fde);}return _0x4db53c[_0xdace('0x18')](_0x4c1fde)[_0xdace('0x19')]();};}function respondWithResult(_0x305174,_0x41a176){_0x41a176=_0x41a176||0xc8;return function(_0x2b09c2){if(_0x2b09c2){return _0x305174[_0xdace('0x18')](_0x41a176)['json'](_0x2b09c2);}};}function respondWithFilteredResult(_0x2fdcf7,_0x58d5d0){return function(_0x258069){if(_0x258069){var _0x2d9a02=_0x258069[_0xdace('0x1a')],_0xebb470=_0x58d5d0[_0xdace('0x1b')],_0x30ea26=_0x58d5d0[_0xdace('0x1b')]+_0x58d5d0['limit'],_0x32c93f;if(_0x30ea26>=_0x2d9a02){_0x30ea26=_0x2d9a02;_0x32c93f=0xc8;}else{_0x32c93f=0xce;}_0x2fdcf7['status'](_0x32c93f);return _0x2fdcf7['set'](_0xdace('0x1c'),_0xebb470+'-'+_0x30ea26+'/'+_0x2d9a02)['json'](_0x258069);}return null;};}function patchUpdates(_0x2e718c){return function(_0x17b6ab){try{jsonpatch[_0xdace('0x1d')](_0x17b6ab,_0x2e718c,!![]);}catch(_0xa7e4d3){return BPromise[_0xdace('0x1e')](_0xa7e4d3);}return _0x17b6ab['save']();};}function saveUpdates(_0x5eea03,_0x402b01){return function(_0x225a3f){if(_0x225a3f){return _0x225a3f[_0xdace('0x1f')](_0x5eea03)[_0xdace('0x20')](function(_0x508298){return _0x508298;});}return null;};}function removeEntity(_0x4dbc4c,_0x6f3053){return function(_0x423941){if(_0x423941){return _0x423941[_0xdace('0x21')]()[_0xdace('0x20')](function(){var _0x14a47e=_0x423941['get']({'plain':!![]});var _0x5ef46d=_0xdace('0x22');return db['UserProfileResource'][_0xdace('0x21')]({'where':{'type':_0x5ef46d,'resourceId':_0x14a47e['id']}})['then'](function(){return _0x423941;});})[_0xdace('0x20')](function(){_0x4dbc4c[_0xdace('0x18')](0xcc)[_0xdace('0x19')]();});}};}function handleEntityNotFound(_0x5737d3,_0x46dee){return function(_0x272cdf){if(!_0x272cdf){_0x5737d3[_0xdace('0x23')](0x194);}return _0x272cdf;};}function handleError(_0x2747e4,_0x27b7bb){_0x27b7bb=_0x27b7bb||0x1f4;return function(_0x439579){logger[_0xdace('0x24')](_0x439579['stack']);if(_0x439579[_0xdace('0x25')]){delete _0x439579[_0xdace('0x25')];}_0x2747e4[_0xdace('0x18')](_0x27b7bb)[_0xdace('0x26')](_0x439579);};}exports[_0xdace('0x27')]=function(_0x36308e,_0x2a12df){var _0x44230e={},_0x57e943={},_0x2d6876={'count':0x0,'rows':[]};var _0x22814a=_['map'](db['Trigger'][_0xdace('0x28')],function(_0x214685){return{'name':_0x214685['fieldName'],'type':_0x214685['type'][_0xdace('0x29')]};});_0x57e943[_0xdace('0x2a')]=_['map'](_0x22814a,_0xdace('0x25'));_0x57e943[_0xdace('0x2b')]=_[_0xdace('0x2c')](_0x36308e[_0xdace('0x2b')]);_0x57e943[_0xdace('0x2d')]=_[_0xdace('0x2e')](_0x57e943[_0xdace('0x2a')],_0x57e943['query']);_0x44230e['attributes']=_[_0xdace('0x2e')](_0x57e943[_0xdace('0x2a')],qs[_0xdace('0x2f')](_0x36308e['query'][_0xdace('0x2f')]));_0x44230e['attributes']=_0x44230e[_0xdace('0x30')][_0xdace('0x31')]?_0x44230e[_0xdace('0x30')]:_0x57e943[_0xdace('0x2a')];if(!_0x36308e[_0xdace('0x2b')]['hasOwnProperty'](_0xdace('0x32'))){_0x44230e[_0xdace('0x33')]=qs[_0xdace('0x33')](_0x36308e['query'][_0xdace('0x33')]);_0x44230e['offset']=qs[_0xdace('0x1b')](_0x36308e[_0xdace('0x2b')]['offset']);}_0x44230e[_0xdace('0x34')]=qs[_0xdace('0x35')](_0x36308e[_0xdace('0x2b')][_0xdace('0x35')]);_0x44230e[_0xdace('0x36')]=qs[_0xdace('0x2d')](_[_0xdace('0x37')](_0x36308e[_0xdace('0x2b')],_0x57e943[_0xdace('0x2d')]),_0x22814a);if(_0x36308e[_0xdace('0x2b')][_0xdace('0x38')]){_0x44230e[_0xdace('0x36')]=_[_0xdace('0x39')](_0x44230e[_0xdace('0x36')],{'$or':_[_0xdace('0x3a')](_0x22814a,function(_0x41630d){if(_0x41630d[_0xdace('0x3b')]!==_0xdace('0x3c')){var _0x4264cc={};_0x4264cc[_0x41630d['name']]={'$like':'%'+_0x36308e[_0xdace('0x2b')][_0xdace('0x38')]+'%'};return _0x4264cc;}})});}_0x44230e=_['merge']({},_0x44230e,_0x36308e[_0xdace('0x3d')]);var _0x580074={'where':_0x44230e[_0xdace('0x36')]};return db['Trigger'][_0xdace('0x1a')](_0x580074)[_0xdace('0x20')](function(_0x132d72){_0x2d6876[_0xdace('0x1a')]=_0x132d72;if(_0x36308e['query'][_0xdace('0x3e')]){_0x44230e['include']=[{'all':!![]}];}return db[_0xdace('0x3f')]['findAll'](_0x44230e);})[_0xdace('0x20')](function(_0x134b65){_0x2d6876['rows']=_0x134b65;return _0x2d6876;})[_0xdace('0x20')](respondWithFilteredResult(_0x2a12df,_0x44230e))['catch'](handleError(_0x2a12df,null));};exports[_0xdace('0x40')]=function(_0x1d9323,_0x1b0662){var _0xc7c653={'raw':![],'where':{'id':_0x1d9323[_0xdace('0x41')]['id']}},_0x4d8d8d={};_0x4d8d8d['model']=_[_0xdace('0x2c')](db[_0xdace('0x3f')][_0xdace('0x28')]);_0x4d8d8d[_0xdace('0x2b')]=_[_0xdace('0x2c')](_0x1d9323[_0xdace('0x2b')]);_0x4d8d8d[_0xdace('0x2d')]=_[_0xdace('0x2e')](_0x4d8d8d[_0xdace('0x2a')],_0x4d8d8d['query']);_0xc7c653[_0xdace('0x30')]=_['intersection'](_0x4d8d8d[_0xdace('0x2a')],qs['fields'](_0x1d9323['query'][_0xdace('0x2f')]));_0xc7c653[_0xdace('0x30')]=_0xc7c653[_0xdace('0x30')][_0xdace('0x31')]?_0xc7c653[_0xdace('0x30')]:_0x4d8d8d[_0xdace('0x2a')];if(_0x1d9323[_0xdace('0x2b')][_0xdace('0x3e')]){_0xc7c653[_0xdace('0x42')]=[{'all':!![]}];}_0xc7c653=_[_0xdace('0x39')]({},_0xc7c653,_0x1d9323[_0xdace('0x3d')]);return db[_0xdace('0x3f')][_0xdace('0x43')](_0xc7c653)['then'](handleEntityNotFound(_0x1b0662,null))[_0xdace('0x20')](respondWithResult(_0x1b0662,null))[_0xdace('0x44')](handleError(_0x1b0662,null));};exports[_0xdace('0x45')]=function(_0x256aec,_0x1d593c){return db[_0xdace('0x3f')][_0xdace('0x45')](_0x256aec[_0xdace('0x46')],{})[_0xdace('0x20')](function(_0x4768d8){var _0x38a4c8=_0x256aec[_0xdace('0x47')]['get']({'plain':!![]});if(!_0x38a4c8)throw new Error(_0xdace('0x48'));if(_0x38a4c8['role']===_0xdace('0x47')){var _0x408ce0=_0x4768d8['get']({'plain':!![]});var _0x5d1c2d=_0xdace('0x22');return db[_0xdace('0x49')][_0xdace('0x43')]({'where':{'name':_0x5d1c2d,'userProfileId':_0x38a4c8[_0xdace('0x4a')]},'raw':!![]})[_0xdace('0x20')](function(_0xad143d){if(_0xad143d&&_0xad143d[_0xdace('0x4b')]===0x0){return db[_0xdace('0x4c')]['create']({'name':_0x408ce0[_0xdace('0x25')],'resourceId':_0x408ce0['id'],'type':_0xad143d[_0xdace('0x25')],'sectionId':_0xad143d['id']},{})[_0xdace('0x20')](function(){return _0x4768d8;});}else{return _0x4768d8;}})[_0xdace('0x44')](function(_0x20f646){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20f646);throw _0x20f646;});}return _0x4768d8;})[_0xdace('0x20')](respondWithResult(_0x1d593c,0xc9))['catch'](handleError(_0x1d593c,null));};exports[_0xdace('0x1f')]=function(_0x4d17c4,_0x6a72e4){if(_0x4d17c4['body']['id']){delete _0x4d17c4[_0xdace('0x46')]['id'];}return db[_0xdace('0x3f')][_0xdace('0x43')]({'where':{'id':_0x4d17c4[_0xdace('0x41')]['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x6a72e4,null))[_0xdace('0x20')](saveUpdates(_0x4d17c4[_0xdace('0x46')],null))[_0xdace('0x20')](respondWithResult(_0x6a72e4,null))[_0xdace('0x44')](handleError(_0x6a72e4,null));};exports[_0xdace('0x21')]=function(_0x16e780,_0x1e27af){return db[_0xdace('0x3f')][_0xdace('0x43')]({'where':{'id':_0x16e780[_0xdace('0x41')]['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x1e27af,null))['then'](removeEntity(_0x1e27af,null))['catch'](handleError(_0x1e27af,null));};exports['addAllCondition']=function(_0x41351a,_0x1bc65d,_0x4aca0e){if(_0x41351a[_0xdace('0x46')]['id']){delete _0x41351a['body']['id'];}return db['Trigger'][_0xdace('0x43')]({'where':{'id':_0x41351a[_0xdace('0x41')]['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x1bc65d,null))['then'](function(_0x1aa047){if(_0x1aa047){_0x41351a[_0xdace('0x46')]['TriggerAllId']=_0x1aa047['id'];return db[_0xdace('0x4d')][_0xdace('0x45')](_0x41351a[_0xdace('0x46')]);}})['then'](respondWithResult(_0x1bc65d,null))['catch'](handleError(_0x1bc65d,null));};exports[_0xdace('0x4e')]=function(_0x317bbb,_0x79600a,_0x1f10f9){if(_0x317bbb[_0xdace('0x46')]['id']){delete _0x317bbb['body']['id'];}return db[_0xdace('0x3f')]['find']({'where':{'id':_0x317bbb['params']['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x79600a,null))['then'](function(_0x141663){if(_0x141663){_0x317bbb[_0xdace('0x46')]['TriggerAnyId']=_0x141663['id'];return db[_0xdace('0x4d')][_0xdace('0x45')](_0x317bbb['body']);}})[_0xdace('0x20')](respondWithResult(_0x79600a,null))[_0xdace('0x44')](handleError(_0x79600a,null));};exports[_0xdace('0x4f')]=function(_0xa0a17b,_0x9fe158,_0x220012){var _0x2af931={};var _0x4ebaac={};var _0x279905;var _0x16aa1f;return db[_0xdace('0x3f')][_0xdace('0x50')]({'where':{'id':_0xa0a17b['params']['id']}})['then'](handleEntityNotFound(_0x9fe158,null))[_0xdace('0x20')](function(_0x1758aa){if(_0x1758aa){_0x279905=_0x1758aa;_0x4ebaac[_0xdace('0x2a')]=_[_0xdace('0x2c')](db[_0xdace('0x4d')][_0xdace('0x28')]);_0x4ebaac[_0xdace('0x2b')]=_[_0xdace('0x2c')](_0xa0a17b[_0xdace('0x2b')]);_0x4ebaac[_0xdace('0x2d')]=_[_0xdace('0x2e')](_0x4ebaac[_0xdace('0x2a')],_0x4ebaac[_0xdace('0x2b')]);_0x2af931[_0xdace('0x30')]=_[_0xdace('0x2e')](_0x4ebaac[_0xdace('0x2a')],qs[_0xdace('0x2f')](_0xa0a17b['query'][_0xdace('0x2f')]));_0x2af931['attributes']=_0x2af931[_0xdace('0x30')][_0xdace('0x31')]?_0x2af931[_0xdace('0x30')]:_0x4ebaac[_0xdace('0x2a')];_0x2af931['order']=qs[_0xdace('0x35')](_0xa0a17b[_0xdace('0x2b')]['sort']);_0x2af931['where']=qs['filters'](_[_0xdace('0x37')](_0xa0a17b[_0xdace('0x2b')],_0x4ebaac[_0xdace('0x2d')]));if(_0xa0a17b[_0xdace('0x2b')][_0xdace('0x38')]){_0x2af931[_0xdace('0x36')]=_[_0xdace('0x39')](_0x2af931['where'],{'$or':_[_0xdace('0x3a')](_0x2af931[_0xdace('0x30')],function(_0x474e20){var _0x245c88={};_0x245c88[_0x474e20]={'$like':'%'+_0xa0a17b[_0xdace('0x2b')][_0xdace('0x38')]+'%'};return _0x245c88;})});}_0x2af931=_[_0xdace('0x39')]({},_0x2af931,_0xa0a17b[_0xdace('0x3d')]);return _0x279905[_0xdace('0x4f')](_0x2af931);}})[_0xdace('0x20')](function(_0x449c7b){if(_0x449c7b){_0x16aa1f=_0x449c7b[_0xdace('0x31')];if(!_0xa0a17b['query'][_0xdace('0x51')](_0xdace('0x32'))){_0x2af931[_0xdace('0x33')]=qs['limit'](_0xa0a17b['query'][_0xdace('0x33')]);_0x2af931[_0xdace('0x1b')]=qs['offset'](_0xa0a17b['query'][_0xdace('0x1b')]);}return _0x279905['getAllConditions'](_0x2af931);}})[_0xdace('0x20')](function(_0x4d5c0f){if(_0x4d5c0f){return _0x4d5c0f?{'count':_0x16aa1f,'rows':_0x4d5c0f}:null;}})['then'](respondWithResult(_0x9fe158,null))[_0xdace('0x44')](handleError(_0x9fe158,null));};exports[_0xdace('0x52')]=function(_0x7267d,_0x5b3f87,_0x4ed746){var _0x35b5aa={};var _0x2d46ac={};var _0x5bb24e;var _0x167cbf;return db[_0xdace('0x3f')][_0xdace('0x50')]({'where':{'id':_0x7267d[_0xdace('0x41')]['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x5b3f87,null))[_0xdace('0x20')](function(_0x3f3809){if(_0x3f3809){_0x5bb24e=_0x3f3809;_0x2d46ac[_0xdace('0x2a')]=_[_0xdace('0x2c')](db['Condition'][_0xdace('0x28')]);_0x2d46ac[_0xdace('0x2b')]=_[_0xdace('0x2c')](_0x7267d['query']);_0x2d46ac[_0xdace('0x2d')]=_['intersection'](_0x2d46ac[_0xdace('0x2a')],_0x2d46ac['query']);_0x35b5aa[_0xdace('0x30')]=_[_0xdace('0x2e')](_0x2d46ac['model'],qs['fields'](_0x7267d[_0xdace('0x2b')][_0xdace('0x2f')]));_0x35b5aa[_0xdace('0x30')]=_0x35b5aa[_0xdace('0x30')][_0xdace('0x31')]?_0x35b5aa[_0xdace('0x30')]:_0x2d46ac[_0xdace('0x2a')];_0x35b5aa[_0xdace('0x34')]=qs[_0xdace('0x35')](_0x7267d[_0xdace('0x2b')]['sort']);_0x35b5aa['where']=qs[_0xdace('0x2d')](_[_0xdace('0x37')](_0x7267d['query'],_0x2d46ac[_0xdace('0x2d')]));if(_0x7267d['query'][_0xdace('0x38')]){_0x35b5aa['where']=_[_0xdace('0x39')](_0x35b5aa[_0xdace('0x36')],{'$or':_[_0xdace('0x3a')](_0x35b5aa[_0xdace('0x30')],function(_0x146769){var _0x54628c={};_0x54628c[_0x146769]={'$like':'%'+_0x7267d[_0xdace('0x2b')]['filter']+'%'};return _0x54628c;})});}_0x35b5aa=_['merge']({},_0x35b5aa,_0x7267d[_0xdace('0x3d')]);return _0x5bb24e[_0xdace('0x52')](_0x35b5aa);}})[_0xdace('0x20')](function(_0x1356cc){if(_0x1356cc){_0x167cbf=_0x1356cc[_0xdace('0x31')];if(!_0x7267d['query']['hasOwnProperty'](_0xdace('0x32'))){_0x35b5aa[_0xdace('0x33')]=qs['limit'](_0x7267d[_0xdace('0x2b')][_0xdace('0x33')]);_0x35b5aa[_0xdace('0x1b')]=qs[_0xdace('0x1b')](_0x7267d[_0xdace('0x2b')][_0xdace('0x1b')]);}return _0x5bb24e[_0xdace('0x52')](_0x35b5aa);}})[_0xdace('0x20')](function(_0xba2c00){if(_0xba2c00){return _0xba2c00?{'count':_0x167cbf,'rows':_0xba2c00}:null;}})[_0xdace('0x20')](respondWithResult(_0x5b3f87,null))['catch'](handleError(_0x5b3f87,null));};exports[_0xdace('0x53')]=function(_0x14e3df,_0x32f929,_0x4d2c6a){if(_0x14e3df[_0xdace('0x46')]['id']){delete _0x14e3df[_0xdace('0x46')]['id'];}return db[_0xdace('0x3f')][_0xdace('0x43')]({'where':{'id':_0x14e3df[_0xdace('0x41')]['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x32f929,null))['then'](function(_0x26c6f2){if(_0x26c6f2){_0x14e3df[_0xdace('0x46')]['TriggerId']=_0x26c6f2['id'];return db[_0xdace('0x54')]['create'](_0x14e3df[_0xdace('0x46')]);}})[_0xdace('0x20')](respondWithResult(_0x32f929,null))[_0xdace('0x44')](handleError(_0x32f929,null));};exports['getActions']=function(_0xd49e93,_0x552f15,_0x32270e){var _0x5d7825={};var _0x4afc48={};var _0x4e7dd4;var _0x352881;return db[_0xdace('0x3f')]['findOne']({'where':{'id':_0xd49e93[_0xdace('0x41')]['id']}})[_0xdace('0x20')](handleEntityNotFound(_0x552f15,null))['then'](function(_0x102a8b){if(_0x102a8b){_0x4e7dd4=_0x102a8b;_0x4afc48[_0xdace('0x2a')]=_[_0xdace('0x2c')](db['Action'][_0xdace('0x28')]);_0x4afc48[_0xdace('0x2b')]=_[_0xdace('0x2c')](_0xd49e93[_0xdace('0x2b')]);_0x4afc48[_0xdace('0x2d')]=_[_0xdace('0x2e')](_0x4afc48[_0xdace('0x2a')],_0x4afc48['query']);_0x5d7825[_0xdace('0x30')]=_[_0xdace('0x2e')](_0x4afc48[_0xdace('0x2a')],qs[_0xdace('0x2f')](_0xd49e93[_0xdace('0x2b')][_0xdace('0x2f')]));_0x5d7825[_0xdace('0x30')]=_0x5d7825[_0xdace('0x30')][_0xdace('0x31')]?_0x5d7825['attributes']:_0x4afc48[_0xdace('0x2a')];_0x5d7825[_0xdace('0x34')]=qs['sort'](_0xd49e93[_0xdace('0x2b')][_0xdace('0x35')]);_0x5d7825[_0xdace('0x36')]=qs[_0xdace('0x2d')](_[_0xdace('0x37')](_0xd49e93[_0xdace('0x2b')],_0x4afc48[_0xdace('0x2d')]));if(_0xd49e93[_0xdace('0x2b')]['filter']){_0x5d7825['where']=_[_0xdace('0x39')](_0x5d7825[_0xdace('0x36')],{'$or':_[_0xdace('0x3a')](_0x5d7825[_0xdace('0x30')],function(_0x1efc85){var _0x3721e5={};_0x3721e5[_0x1efc85]={'$like':'%'+_0xd49e93[_0xdace('0x2b')][_0xdace('0x38')]+'%'};return _0x3721e5;})});}_0x5d7825=_[_0xdace('0x39')]({},_0x5d7825,_0xd49e93['options']);return _0x4e7dd4[_0xdace('0x55')](_0x5d7825);}})[_0xdace('0x20')](function(_0x28dfea){if(_0x28dfea){_0x352881=_0x28dfea['length'];if(!_0xd49e93[_0xdace('0x2b')][_0xdace('0x51')](_0xdace('0x32'))){_0x5d7825[_0xdace('0x33')]=qs[_0xdace('0x33')](_0xd49e93[_0xdace('0x2b')]['limit']);_0x5d7825[_0xdace('0x1b')]=qs[_0xdace('0x1b')](_0xd49e93['query']['offset']);}return _0x4e7dd4[_0xdace('0x55')](_0x5d7825);}})[_0xdace('0x20')](function(_0x10e7f3){if(_0x10e7f3){return _0x10e7f3?{'count':_0x352881,'rows':_0x10e7f3}:null;}})[_0xdace('0x20')](respondWithResult(_0x552f15,null))[_0xdace('0x44')](handleError(_0x552f15,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7366702..932bcd0 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 _0xfdfa=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','Trigger','tools_triggers'];(function(_0x51c9d9,_0xfb97b7){var _0x31c6dd=function(_0x47249a){while(--_0x47249a){_0x51c9d9['push'](_0x51c9d9['shift']());}};_0x31c6dd(++_0xfb97b7);}(_0xfdfa,0x79));var _0xafdf=function(_0x485507,_0x9ab47f){_0x485507=_0x485507-0x0;var _0x1f79e7=_0xfdfa[_0x485507];return _0x1f79e7;};'use strict';var _=require(_0xafdf('0x0'));var util=require(_0xafdf('0x1'));var logger=require(_0xafdf('0x2'))('api');var moment=require(_0xafdf('0x3'));var BPromise=require(_0xafdf('0x4'));var rp=require(_0xafdf('0x5'));var fs=require('fs');var path=require(_0xafdf('0x6'));var rimraf=require(_0xafdf('0x7'));var config=require('../../config/environment');var attributes=require(_0xafdf('0x8'));module['exports']=function(_0x10a113,_0x4a05f6){return _0x10a113['define'](_0xafdf('0x9'),attributes,{'tableName':_0xafdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc813=['exports','Trigger','tools_triggers','lodash','util','api','bluebird','request-promise','path','../../config/environment','./trigger.attributes'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0xc813,0x14d));var _0x3c81=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0xc813[_0x2bddf9];return _0x3f3ae9;};'use strict';var _=require(_0x3c81('0x0'));var util=require(_0x3c81('0x1'));var logger=require('../../config/logger')(_0x3c81('0x2'));var moment=require('moment');var BPromise=require(_0x3c81('0x3'));var rp=require(_0x3c81('0x4'));var fs=require('fs');var path=require(_0x3c81('0x5'));var rimraf=require('rimraf');var config=require(_0x3c81('0x6'));var attributes=require(_0x3c81('0x7'));module[_0x3c81('0x8')]=function(_0x57bc48,_0x197c8d){return _0x57bc48['define'](_0x3c81('0x9'),attributes,{'tableName':_0x3c81('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 aaa048d..d9a21f3 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 _0x4b17=['http','request','then','info','request\x20sent','debug','stringify','error','message','Trigger,\x20%s,\x20%s','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','catch','ShowTrigger','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x35bad0,_0x21927d){var _0x4fe50f=function(_0x1873df){while(--_0x1873df){_0x35bad0['push'](_0x35bad0['shift']());}};_0x4fe50f(++_0x21927d);}(_0x4b17,0x10f));var _0x74b1=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0x4b17[_0x4d05a0];return _0x4c999c;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371c3b,_0x191d2b,_0x16761b){return new BPromise(function(_0x4c293c,_0x287e3e){return client[_0x74b1('0x9')](_0x371c3b,_0x16761b)[_0x74b1('0xa')](function(_0x25382b){logger[_0x74b1('0xb')]('Trigger,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'));logger[_0x74b1('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'),JSON[_0x74b1('0xe')](_0x25382b));if(_0x25382b[_0x74b1('0xf')]){if(_0x25382b[_0x74b1('0xf')]['code']===0x1f4){logger[_0x74b1('0xf')]('Trigger,\x20%s,\x20%s',_0x191d2b,_0x25382b['error'][_0x74b1('0x10')]);return _0x287e3e(_0x25382b[_0x74b1('0xf')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x191d2b,_0x25382b[_0x74b1('0xf')]['message']);return _0x4c293c(_0x25382b['error'][_0x74b1('0x10')]);}else{logger[_0x74b1('0xb')](_0x74b1('0x11'),_0x191d2b,_0x74b1('0xc'));_0x4c293c(_0x25382b[_0x74b1('0x12')][_0x74b1('0x10')]);}})['catch'](function(_0x6237be){logger[_0x74b1('0xf')](_0x74b1('0x11'),_0x191d2b,_0x6237be);_0x287e3e(_0x6237be);});});}exports[_0x74b1('0x13')]=function(_0xde2736){var _0x8c9510=this;return new Promise(function(_0x1ab838,_0x4bb3d2){return db[_0x74b1('0x14')][_0x74b1('0x15')]({'raw':_0xde2736['options']?_0xde2736[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'where':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x18')]||null:null,'attributes':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x19')]||null:null,'limit':_0xde2736['options']?_0xde2736[_0x74b1('0x16')]['limit']||null:null,'include':_0xde2736['options']?_0xde2736['options'][_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0xde2736[_0x74b1('0x16')][_0x74b1('0x1a')],function(_0x563781){return{'model':db[_0x563781['model']],'as':_0x563781['as'],'attributes':_0x563781[_0x74b1('0x19')],'include':_0x563781['include']?_[_0x74b1('0x1b')](_0x563781[_0x74b1('0x1a')],function(_0xb5af0){return{'model':db[_0xb5af0[_0x74b1('0x1c')]],'as':_0xb5af0['as'],'attributes':_0xb5af0[_0x74b1('0x19')],'include':_0xb5af0[_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0xb5af0[_0x74b1('0x1a')],function(_0x4c7f05){return{'model':db[_0x4c7f05[_0x74b1('0x1c')]],'as':_0x4c7f05['as'],'attributes':_0x4c7f05[_0x74b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xa')](function(_0x5c32d2){logger[_0x74b1('0xb')](_0x74b1('0x13'),_0xde2736);logger[_0x74b1('0xd')](_0x74b1('0x13'),_0xde2736,JSON[_0x74b1('0xe')](_0x5c32d2));_0x1ab838(_0x5c32d2);})[_0x74b1('0x1d')](function(_0x436eda){logger[_0x74b1('0xf')]('GetTrigger',_0x436eda[_0x74b1('0x10')],_0xde2736);_0x4bb3d2(_0x8c9510[_0x74b1('0xf')](0x1f4,_0x436eda['message']));});});};exports[_0x74b1('0x1e')]=function(_0x45404f){var _0x1ac433=this;return new Promise(function(_0x5f4d1b,_0x113300){return db[_0x74b1('0x14')]['find']({'raw':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'where':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')][_0x74b1('0x18')]||null:null,'attributes':_0x45404f[_0x74b1('0x16')]?_0x45404f[_0x74b1('0x16')]['attributes']||null:null,'include':_0x45404f[_0x74b1('0x16')]?_0x45404f['options']['include']?_[_0x74b1('0x1b')](_0x45404f['options']['include'],function(_0x3fd43c){return{'model':db[_0x3fd43c[_0x74b1('0x1c')]],'as':_0x3fd43c['as'],'attributes':_0x3fd43c[_0x74b1('0x19')],'include':_0x3fd43c[_0x74b1('0x1a')]?_[_0x74b1('0x1b')](_0x3fd43c[_0x74b1('0x1a')],function(_0x171fa4){return{'model':db[_0x171fa4[_0x74b1('0x1c')]],'as':_0x171fa4['as'],'attributes':_0x171fa4['attributes'],'include':_0x171fa4['include']?_['map'](_0x171fa4[_0x74b1('0x1a')],function(_0x57f7b5){return{'model':db[_0x57f7b5['model']],'as':_0x57f7b5['as'],'attributes':_0x57f7b5[_0x74b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xa')](function(_0x222783){logger['info'](_0x74b1('0x1e'),_0x45404f);logger['debug'](_0x74b1('0x1e'),_0x45404f,JSON[_0x74b1('0xe')](_0x222783));_0x5f4d1b(_0x222783);})['catch'](function(_0x514d0e){logger[_0x74b1('0xf')](_0x74b1('0x1e'),_0x514d0e['message'],_0x45404f);_0x113300(_0x1ac433['error'](0x1f4,_0x514d0e[_0x74b1('0x10')]));});});}; \ No newline at end of file +var _0xf45e=['options','raw','where','attributes','limit','include','model','map','Trigger','find','ShowTrigger','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll'];(function(_0x3d1946,_0xf46c21){var _0x5106a4=function(_0x5bc871){while(--_0x5bc871){_0x3d1946['push'](_0x3d1946['shift']());}};_0x5106a4(++_0xf46c21);}(_0xf45e,0x115));var _0xef45=function(_0x34fbd4,_0x3b303b){_0x34fbd4=_0x34fbd4-0x0;var _0x5723dc=_0xf45e[_0x34fbd4];return _0x5723dc;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Trigger,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['Trigger'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetTrigger',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetTrigger',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowTrigger']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 61c8afa..ec0ce6d 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 _0x33c5=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','util'];(function(_0x34a94c,_0x5ad8a7){var _0x2e040b=function(_0x5038c9){while(--_0x5038c9){_0x34a94c['push'](_0x34a94c['shift']());}};_0x2e040b(++_0x5ad8a7);}(_0x33c5,0xe6));var _0x533c=function(_0x4227f7,_0x5e2633){_0x4227f7=_0x4227f7-0x0;var _0x4d394e=_0x33c5[_0x4227f7];return _0x4d394e;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./trunk.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')](_0x533c('0xd'),auth[_0x533c('0x8')](),controller[_0x533c('0xe')]);router[_0x533c('0xc')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0xa'),auth['isAuthenticated'](),controller[_0x533c('0x11')]);router[_0x533c('0x12')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0x13')]);module[_0x533c('0x14')]=router; \ No newline at end of file +var _0xfd28=['index','/:id','post','/:id/clone','create','update','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x409da0,_0x233ede){var _0x5cb192=function(_0x520bf5){while(--_0x520bf5){_0x409da0['push'](_0x409da0['shift']());}};_0x5cb192(++_0x233ede);}(_0xfd28,0x148));var _0x8fd2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfd28[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var auth=require(_0x8fd2('0x3'));var interaction=require(_0x8fd2('0x4'));var config=require(_0x8fd2('0x5'));var controller=require('./trunk.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8fd2('0xa')](_0x8fd2('0xb'),auth[_0x8fd2('0x7')](),controller['clone']);router[_0x8fd2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['put'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xd')]);router['delete'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xe')]);module[_0x8fd2('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9d2caec..b67d58b 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 _0xce5d=['pai','certificate','active','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0xce5d,0x74));var _0xdce5=function(_0x4ab2b4,_0x15de5f){_0x4ab2b4=_0x4ab2b4-0x0;var _0x1f8db8=_0xce5d[_0x4ab2b4];return _0x1f8db8;};'use strict';var Sequelize=require(_0xdce5('0x0'));module[_0xdce5('0x1')]={'name':{'type':Sequelize[_0xdce5('0x2')],'allowNull':![],'unique':_0xdce5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x5'),_0xdce5('0x6'),_0xdce5('0x7')),'allowNull':![],'defaultValue':_0xdce5('0x5')},'context':{'type':Sequelize[_0xdce5('0x2')],'allowNull':![],'defaultValue':_0xdce5('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0xdce5('0x9'),_0xdce5('0xa'),_0xdce5('0xb'),_0xdce5('0xc'),_0xdce5('0xd'),_0xdce5('0xe'),_0xdce5('0xf'),_0xdce5('0x10'))},'deny':{'type':Sequelize[_0xdce5('0x2')]},'permit':{'type':Sequelize[_0xdce5('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xdce5('0x2')]},'remotesecret':{'type':Sequelize[_0xdce5('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x663fe6){this[_0xdce5('0x11')](_0xdce5('0x12'),_0x663fe6?_0x663fe6[_0xdce5('0x13')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xdce5('0x14')](_0xdce5('0x12'))[_0xdce5('0x15')](','):null;},'comment':_0xdce5('0x16')},'dtmfmode':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x17'),_0xdce5('0x18'),_0xdce5('0x19'),_0xdce5('0x1a'),_0xdce5('0x1b')),'defaultValue':_0xdce5('0x17')},'directmedia':{'type':Sequelize[_0xdce5('0x4')]('yes','no',_0xdce5('0x1c'),_0xdce5('0x1d'),_0xdce5('0x1e')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xdce5('0x2')]},'nat':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x1196f9){this[_0xdce5('0x11')]('nat',_0x1196f9?_0x1196f9['join'](','):null);},'get':function(){return this[_0xdce5('0x14')](_0xdce5('0x20'))?this['getDataValue'](_0xdce5('0x20'))[_0xdce5('0x15')](','):null;},'comment':_0xdce5('0x21')},'callgroup':{'type':Sequelize[_0xdce5('0x2')]},'namedcallgroup':{'type':Sequelize[_0xdce5('0x2')]},'pickupgroup':{'type':Sequelize[_0xdce5('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdce5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':_0xdce5('0x22')},'allow':{'type':Sequelize[_0xdce5('0x2')],'allowNull':![],'defaultValue':_0xdce5('0x23'),'set':function(_0x23fda4){this[_0xdce5('0x11')](_0xdce5('0x24'),_0x23fda4?_0x23fda4[_0xdce5('0x13')](';'):_0xdce5('0x23'));},'get':function(){return this[_0xdce5('0x14')](_0xdce5('0x24'))?this[_0xdce5('0x14')](_0xdce5('0x24'))[_0xdce5('0x15')](';'):null;},'comment':_0xdce5('0x25')},'autoframing':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'insecure':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':_0xdce5('0x26'),'set':function(_0x2fcfe8){this[_0xdce5('0x11')](_0xdce5('0x27'),_0x2fcfe8?_0x2fcfe8['join'](','):null);},'get':function(){return this[_0xdce5('0x14')]('insecure')?this[_0xdce5('0x14')](_0xdce5('0x27'))['split'](','):null;},'comment':_0xdce5('0x28')},'trustrpid':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xdce5('0x1f'),'no','never')},'promiscredir':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'useclientcode':{'type':Sequelize[_0xdce5('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0xdce5('0x29')](0xb)},'setvar':{'type':Sequelize[_0xdce5('0x2')]},'callerid':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':_0xdce5('0x2a')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no'),'defaultValue':_0xdce5('0x1f')},'busylevel':{'type':Sequelize[_0xdce5('0x29')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xdce5('0x1f'),'no')},'allowtransfer':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'subscribecontext':{'type':Sequelize[_0xdce5('0x2')]},'template':{'type':Sequelize[_0xdce5('0x2')]},'videosupport':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no',_0xdce5('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdce5('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xdce5('0x2c'),_0xdce5('0x2d'),_0xdce5('0x2e'))},'session_expires':{'type':Sequelize[_0xdce5('0x29')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x2f'),_0xdce5('0x30')),'defaultValue':_0xdce5('0x30')},'t38pt_usertpsource':{'type':Sequelize[_0xdce5('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xdce5('0x2')]},'fromuser':{'type':Sequelize[_0xdce5('0x2')]},'port':{'type':Sequelize[_0xdce5('0x29')](0x5)},'qualify':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no'),'defaultValue':_0xdce5('0x1f')},'keepalive':{'type':Sequelize[_0xdce5('0x29')](0xb)},'defaultip':{'type':Sequelize[_0xdce5('0x2')]},'defaultuser':{'type':Sequelize[_0xdce5('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdce5('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdce5('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xdce5('0x4')]('yes','no',_0xdce5('0x31')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdce5('0x2')]},'callbackextension':{'type':Sequelize[_0xdce5('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xdce5('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdce5('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0xdce5('0x2')]},'contactdeny':{'type':Sequelize[_0xdce5('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xdce5('0x2')]},'use_q850_reason':{'type':Sequelize[_0xdce5('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'force_avp':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xdce5('0x1f'),'no')},'dtlsenable':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'dtlsverify':{'type':Sequelize[_0xdce5('0x4')]('yes','no','fingerprint',_0xdce5('0x32'))},'dtlsrekey':{'type':Sequelize[_0xdce5('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0xdce5('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xdce5('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xdce5('0x33'),'passive',_0xdce5('0x34')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdce5('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xdce5('0x1f'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdce5('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xdce5('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'subscribemwi':{'type':Sequelize[_0xdce5('0x4')](_0xdce5('0x1f'),'no')},'vmexten':{'type':Sequelize[_0xdce5('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xdce5('0x2')]},'parkinglot':{'type':Sequelize[_0xdce5('0x2')]},'description':{'type':Sequelize[_0xdce5('0x2')]},'host':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':_0xdce5('0x35')},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0xdce5('0x1d'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdce5('0x2')]},'otherFields':{'type':Sequelize[_0xdce5('0x2')]},'active':{'type':Sequelize[_0xdce5('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdce5('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9847=['refuse','originate','uac','uas','pai','actpass','dynamic','update,nonat','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','inband','yes','nonat','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept'];(function(_0x2c8a53,_0x2b40d6){var _0x4d2d87=function(_0x105d29){while(--_0x105d29){_0x2c8a53['push'](_0x2c8a53['shift']());}};_0x4d2d87(++_0x2b40d6);}(_0x9847,0x13c));var _0x7984=function(_0x301bee,_0x91a563){_0x301bee=_0x301bee-0x0;var _0x3fbdbc=_0x9847[_0x301bee];return _0x3fbdbc;};'use strict';var Sequelize=require('sequelize');module[_0x7984('0x0')]={'name':{'type':Sequelize[_0x7984('0x1')],'allowNull':![],'unique':_0x7984('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x4'),_0x7984('0x5'),_0x7984('0x6')),'allowNull':![],'defaultValue':_0x7984('0x4')},'context':{'type':Sequelize[_0x7984('0x1')],'allowNull':![],'defaultValue':_0x7984('0x7')},'callingpres':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x8'),_0x7984('0x9'),_0x7984('0xa'),_0x7984('0xb'),'PROHIB_NOT_SCREENED',_0x7984('0xc'),_0x7984('0xd'),_0x7984('0xe'))},'deny':{'type':Sequelize[_0x7984('0x1')]},'permit':{'type':Sequelize[_0x7984('0x1')]},'secret':{'type':Sequelize[_0x7984('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x7984('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x51d7ea){this[_0x7984('0xf')](_0x7984('0x10'),_0x51d7ea?_0x51d7ea[_0x7984('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x7984('0x10'))?this[_0x7984('0x12')](_0x7984('0x10'))[_0x7984('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x14'),'info','shortinfo',_0x7984('0x15'),'auto'),'defaultValue':_0x7984('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x7984('0x16'),'no',_0x7984('0x17'),'update',_0x7984('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7984('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x7984('0x1')],'defaultValue':_0x7984('0x19'),'set':function(_0x3a317b){this['setDataValue']('nat',_0x3a317b?_0x3a317b[_0x7984('0x11')](','):null);},'get':function(){return this[_0x7984('0x12')](_0x7984('0x1a'))?this[_0x7984('0x12')](_0x7984('0x1a'))[_0x7984('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7984('0x1')]},'namedcallgroup':{'type':Sequelize[_0x7984('0x1')]},'pickupgroup':{'type':Sequelize[_0x7984('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7984('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7984('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7984('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7984('0x1b'),'set':function(_0xfbec66){this[_0x7984('0xf')](_0x7984('0x1c'),_0xfbec66?_0xfbec66[_0x7984('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7984('0x12')]('allow')?this[_0x7984('0x12')]('allow')[_0x7984('0x13')](';'):null;},'comment':_0x7984('0x1d')},'autoframing':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x132db4){this[_0x7984('0xf')](_0x7984('0x1e'),_0x132db4?_0x132db4['join'](','):null);},'get':function(){return this[_0x7984('0x12')](_0x7984('0x1e'))?this[_0x7984('0x12')](_0x7984('0x1e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7984('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no',_0x7984('0x1f'))},'promiscredir':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'accountcode':{'type':Sequelize[_0x7984('0x20')](0xb)},'setvar':{'type':Sequelize[_0x7984('0x1')]},'callerid':{'type':Sequelize[_0x7984('0x1')],'defaultValue':_0x7984('0x21')},'amaflags':{'type':Sequelize[_0x7984('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x7984('0x16'),'no'),'defaultValue':_0x7984('0x16')},'busylevel':{'type':Sequelize[_0x7984('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x7984('0x1')]},'template':{'type':Sequelize[_0x7984('0x1')]},'videosupport':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no',_0x7984('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7984('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7984('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x23'),_0x7984('0x24'),_0x7984('0x25'))},'session_expires':{'type':Sequelize[_0x7984('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x7984('0x20')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x7984('0x26'),_0x7984('0x27')),'defaultValue':_0x7984('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x7984('0x1')]},'regexten':{'type':Sequelize[_0x7984('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7984('0x1')]},'port':{'type':Sequelize[_0x7984('0x20')](0x5)},'qualify':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no'),'defaultValue':_0x7984('0x16')},'keepalive':{'type':Sequelize[_0x7984('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x7984('0x1')]},'defaultuser':{'type':Sequelize[_0x7984('0x1')]},'rtptimeout':{'type':Sequelize[_0x7984('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7984('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7984('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no',_0x7984('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7984('0x1')]},'callbackextension':{'type':Sequelize[_0x7984('0x1')]},'timert1':{'type':Sequelize[_0x7984('0x20')](0xb)},'timerb':{'type':Sequelize[_0x7984('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7984('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x7984('0x1')]},'contactdeny':{'type':Sequelize[_0x7984('0x1')]},'contactacl':{'type':Sequelize[_0x7984('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7984('0x20')](0xb)},'encryption':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'force_avp':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'icesupport':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x7984('0x16'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x7984('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7984('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7984('0x1')]},'dtlscafile':{'type':Sequelize[_0x7984('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x7984('0x3')]('active','passive',_0x7984('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7984('0x1')]},'recordofffeature':{'type':Sequelize[_0x7984('0x1')]},'call_limit':{'type':Sequelize[_0x7984('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7984('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no')},'vmexten':{'type':Sequelize[_0x7984('0x1')]},'mohinterpret':{'type':Sequelize[_0x7984('0x1')]},'mohsuggest':{'type':Sequelize[_0x7984('0x1')]},'parkinglot':{'type':Sequelize[_0x7984('0x1')]},'description':{'type':Sequelize[_0x7984('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7984('0x2a')},'canreinvite':{'type':Sequelize[_0x7984('0x3')](_0x7984('0x16'),'no','nonat','update',_0x7984('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x7984('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'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 61c1e87..257f23c 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 _0xd97a=['sort','filters','pick','where','merge','options','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','writeFileSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','then','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','name','index','map','Trunk','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5dbbca,_0x5d001f){var _0x5cd202=function(_0x10d44f){while(--_0x10d44f){_0x5dbbca['push'](_0x5dbbca['shift']());}};_0x5cd202(++_0x5d001f);}(_0xd97a,0x96));var _0xad97=function(_0x4248e9,_0x19f4bc){_0x4248e9=_0x4248e9-0x0;var _0x4a26af=_0xd97a[_0x4248e9];return _0x4a26af;};'use strict';var pdf=require(_0xad97('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xad97('0x1'));var zipdir=require(_0xad97('0x2'));var jsonpatch=require(_0xad97('0x3'));var rp=require(_0xad97('0x4'));var moment=require(_0xad97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad97('0x6'));var util=require(_0xad97('0x7'));var path=require(_0xad97('0x8'));var sox=require(_0xad97('0x9'));var csv=require(_0xad97('0xa'));var ejs=require(_0xad97('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xad97('0xc'));var crypto=require(_0xad97('0xd'));var jsforce=require(_0xad97('0xe'));var deskjs=require(_0xad97('0xf'));var toCsv=require(_0xad97('0xa'));var querystring=require(_0xad97('0x10'));var Papa=require(_0xad97('0x11'));var Redis=require('ioredis');var authService=require(_0xad97('0x12'));var qs=require(_0xad97('0x13'));var as=require(_0xad97('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad97('0x15'))(_0xad97('0x16'));var utils=require(_0xad97('0x17'));var config=require(_0xad97('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xad97('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xad97('0x1a')][_0xad97('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3813ef,_0x1fb490,_0x4a078f,_0x4a50f7){return new BPromise(function(_0x4d9af7,_0x5205bd){var _0x40babc=_0x4a50f7||client;return _0x40babc['request'](_0x3813ef,_0x4a078f)[_0xad97('0x1c')](function(_0xe8c1f3){logger['info']('Trunk,\x20%s,\x20%s',_0x1fb490,_0xad97('0x1d'));logger['debug'](_0xad97('0x1e'),_0x1fb490,_0xad97('0x1d'),JSON[_0xad97('0x1f')](_0xe8c1f3));if(_0xe8c1f3[_0xad97('0x20')]){if(_0xe8c1f3['error'][_0xad97('0x21')]===0x1f4){logger[_0xad97('0x20')](_0xad97('0x22'),_0x1fb490,_0xe8c1f3[_0xad97('0x20')]['message']);return _0x5205bd(_0xe8c1f3[_0xad97('0x20')][_0xad97('0x23')]);}logger['error'](_0xad97('0x22'),_0x1fb490,_0xe8c1f3[_0xad97('0x20')]['message']);return _0x4d9af7(_0xe8c1f3[_0xad97('0x20')]['message']);}else{logger[_0xad97('0x24')](_0xad97('0x22'),_0x1fb490,_0xad97('0x1d'));_0x4d9af7(_0xe8c1f3[_0xad97('0x25')][_0xad97('0x23')]);}})[_0xad97('0x26')](function(_0x42b47a){logger[_0xad97('0x20')]('Trunk,\x20%s,\x20%s',_0x1fb490,_0x42b47a);_0x5205bd(_0x42b47a);});});}function respondWithStatusCode(_0xe90c54,_0x47032b){_0x47032b=_0x47032b||0xcc;return function(_0x1d307b){if(_0x1d307b){return _0xe90c54[_0xad97('0x27')](_0x47032b);}return _0xe90c54['status'](_0x47032b)[_0xad97('0x28')]();};}function respondWithResult(_0x2d87f4,_0x351953){_0x351953=_0x351953||0xc8;return function(_0x44d6a0){if(_0x44d6a0){return _0x2d87f4['status'](_0x351953)[_0xad97('0x29')](_0x44d6a0);}};}function respondWithFilteredResult(_0x2db15f,_0x53d8bd){return function(_0x46d3a0){if(_0x46d3a0){var _0x29eb72=_0x46d3a0[_0xad97('0x2a')],_0x63d4b8=_0x53d8bd[_0xad97('0x2b')],_0x3c8430=_0x53d8bd[_0xad97('0x2b')]+_0x53d8bd[_0xad97('0x2c')],_0x4b605c;if(_0x3c8430>=_0x29eb72){_0x3c8430=_0x29eb72;_0x4b605c=0xc8;}else{_0x4b605c=0xce;}_0x2db15f[_0xad97('0x2d')](_0x4b605c);return _0x2db15f[_0xad97('0x2e')](_0xad97('0x2f'),_0x63d4b8+'-'+_0x3c8430+'/'+_0x29eb72)['json'](_0x46d3a0);}return null;};}function patchUpdates(_0x8ca167){return function(_0x46960e){try{jsonpatch['apply'](_0x46960e,_0x8ca167,!![]);}catch(_0x4c6ad1){return BPromise[_0xad97('0x30')](_0x4c6ad1);}return _0x46960e[_0xad97('0x31')]();};}function saveUpdates(_0x217038,_0x4d2145){return function(_0x35489c){if(_0x35489c){return _0x35489c[_0xad97('0x32')](_0x217038)['then'](function(_0x25ecd6){return _0x25ecd6;});}return null;};}function removeEntity(_0x534342,_0x5c28b1){return function(_0x8acbcf){if(_0x8acbcf){return _0x8acbcf['destroy']()[_0xad97('0x1c')](function(){var _0x61e384=_0x8acbcf[_0xad97('0x33')]({'plain':!![]});var _0x5dead9=_0xad97('0x34');return db[_0xad97('0x35')][_0xad97('0x36')]({'where':{'type':_0x5dead9,'resourceId':_0x61e384['id']}})['then'](function(){return _0x8acbcf;});})[_0xad97('0x1c')](function(){_0x534342[_0xad97('0x2d')](0xcc)[_0xad97('0x28')]();});}};}function handleEntityNotFound(_0x5ef9ff,_0x440bf8){return function(_0x293e4c){if(!_0x293e4c){_0x5ef9ff[_0xad97('0x27')](0x194);}return _0x293e4c;};}function handleError(_0x3b8e8f,_0x5c773e){_0x5c773e=_0x5c773e||0x1f4;return function(_0x544809){logger[_0xad97('0x20')](_0x544809['stack']);if(_0x544809['name']){delete _0x544809[_0xad97('0x37')];}_0x3b8e8f[_0xad97('0x2d')](_0x5c773e)['send'](_0x544809);};}exports[_0xad97('0x38')]=function(_0x312cef,_0x3dd1dd){var _0x3253d2={},_0x528829={},_0x199c03={'count':0x0,'rows':[]};var _0x59a91e=_[_0xad97('0x39')](db[_0xad97('0x3a')][_0xad97('0x3b')],function(_0x8903d9){return{'name':_0x8903d9['fieldName'],'type':_0x8903d9[_0xad97('0x3c')][_0xad97('0x3d')]};});_0x528829[_0xad97('0x3e')]=_['map'](_0x59a91e,_0xad97('0x37'));_0x528829[_0xad97('0x3f')]=_[_0xad97('0x40')](_0x312cef[_0xad97('0x3f')]);_0x528829['filters']=_[_0xad97('0x41')](_0x528829[_0xad97('0x3e')],_0x528829['query']);_0x3253d2[_0xad97('0x42')]=_['intersection'](_0x528829[_0xad97('0x3e')],qs[_0xad97('0x43')](_0x312cef[_0xad97('0x3f')][_0xad97('0x43')]));_0x3253d2['attributes']=_0x3253d2[_0xad97('0x42')][_0xad97('0x44')]?_0x3253d2[_0xad97('0x42')]:_0x528829[_0xad97('0x3e')];if(!_0x312cef[_0xad97('0x3f')][_0xad97('0x45')](_0xad97('0x46'))){_0x3253d2[_0xad97('0x2c')]=qs['limit'](_0x312cef[_0xad97('0x3f')]['limit']);_0x3253d2[_0xad97('0x2b')]=qs[_0xad97('0x2b')](_0x312cef[_0xad97('0x3f')][_0xad97('0x2b')]);}_0x3253d2[_0xad97('0x47')]=qs[_0xad97('0x48')](_0x312cef['query'][_0xad97('0x48')]);_0x3253d2['where']=qs[_0xad97('0x49')](_[_0xad97('0x4a')](_0x312cef['query'],_0x528829[_0xad97('0x49')]),_0x59a91e);if(_0x312cef['query']['filter']){_0x3253d2[_0xad97('0x4b')]=_[_0xad97('0x4c')](_0x3253d2[_0xad97('0x4b')],{'$or':_[_0xad97('0x39')](_0x59a91e,function(_0xf75762){if(_0xf75762[_0xad97('0x3c')]!=='VIRTUAL'){var _0x50e6ce={};_0x50e6ce[_0xf75762[_0xad97('0x37')]]={'$like':'%'+_0x312cef[_0xad97('0x3f')]['filter']+'%'};return _0x50e6ce;}})});}_0x3253d2=_['merge']({},_0x3253d2,_0x312cef[_0xad97('0x4d')]);var _0x5b917a={'where':_0x3253d2[_0xad97('0x4b')]};return db[_0xad97('0x3a')][_0xad97('0x2a')](_0x5b917a)[_0xad97('0x1c')](function(_0x1d8007){_0x199c03[_0xad97('0x2a')]=_0x1d8007;if(_0x312cef[_0xad97('0x3f')][_0xad97('0x4e')]){_0x3253d2[_0xad97('0x4f')]=[{'all':!![]}];}return db[_0xad97('0x3a')][_0xad97('0x50')](_0x3253d2);})[_0xad97('0x1c')](function(_0x2b1eb2){_0x199c03[_0xad97('0x51')]=_0x2b1eb2;return _0x199c03;})[_0xad97('0x1c')](respondWithFilteredResult(_0x3dd1dd,_0x3253d2))[_0xad97('0x26')](handleError(_0x3dd1dd,null));};exports[_0xad97('0x52')]=function(_0x2cdf19,_0x2b813b){var _0x48d218={'raw':![],'where':{'id':_0x2cdf19[_0xad97('0x53')]['id']}},_0x18c192={};_0x18c192[_0xad97('0x3e')]=_[_0xad97('0x40')](db[_0xad97('0x3a')][_0xad97('0x3b')]);_0x18c192[_0xad97('0x3f')]=_['keys'](_0x2cdf19['query']);_0x18c192[_0xad97('0x49')]=_[_0xad97('0x41')](_0x18c192[_0xad97('0x3e')],_0x18c192[_0xad97('0x3f')]);_0x48d218[_0xad97('0x42')]=_['intersection'](_0x18c192[_0xad97('0x3e')],qs[_0xad97('0x43')](_0x2cdf19[_0xad97('0x3f')]['fields']));_0x48d218[_0xad97('0x42')]=_0x48d218[_0xad97('0x42')][_0xad97('0x44')]?_0x48d218[_0xad97('0x42')]:_0x18c192[_0xad97('0x3e')];if(_0x2cdf19['query'][_0xad97('0x4e')]){_0x48d218[_0xad97('0x4f')]=[{'all':!![]}];}_0x48d218=_[_0xad97('0x4c')]({},_0x48d218,_0x2cdf19['options']);return db['Trunk'][_0xad97('0x54')](_0x48d218)[_0xad97('0x1c')](handleEntityNotFound(_0x2b813b,null))[_0xad97('0x1c')](respondWithResult(_0x2b813b,null))[_0xad97('0x26')](handleError(_0x2b813b,null));};exports[_0xad97('0x55')]=function(_0x23c39c,_0x5b6725){var _0xaa1c2a={'where':{'id':_0x23c39c['params']['id']}},_0x31310d={};_0x31310d[_0xad97('0x3e')]=_[_0xad97('0x40')](db[_0xad97('0x3a')][_0xad97('0x3b')]);_0xaa1c2a[_0xad97('0x42')]=_[_0xad97('0x41')](_0x31310d['model'],qs[_0xad97('0x43')](_0x23c39c[_0xad97('0x3f')][_0xad97('0x43')]));_0xaa1c2a[_0xad97('0x42')]=_0xaa1c2a[_0xad97('0x42')]['length']?_0xaa1c2a[_0xad97('0x42')]:_0x31310d['model'];if(_0x23c39c[_0xad97('0x3f')]['includeAll']){_0xaa1c2a[_0xad97('0x4f')]=[{'all':!![]}];}_0xaa1c2a=_['merge']({},_0xaa1c2a,_0x23c39c[_0xad97('0x4d')]);return db[_0xad97('0x3a')]['find'](_0xaa1c2a)[_0xad97('0x1c')](handleEntityNotFound(_0x5b6725,null))[_0xad97('0x1c')](function(_0x1e7509){if(_0x1e7509){var _0x3d2602=_0x1e7509[_0xad97('0x33')]({'plain':!![]});_0x3d2602=qs[_0xad97('0x56')](_0x3d2602,['id',_0xad97('0x57'),_0xad97('0x58')]);_0x23c39c[_0xad97('0x59')]=_['omit'](_0x23c39c[_0xad97('0x59')],['id',_0xad97('0x57'),_0xad97('0x58')]);return db[_0xad97('0x3a')][_0xad97('0x5a')](_[_0xad97('0x4c')](_0x3d2602,_0x23c39c[_0xad97('0x59')]),{'include':_0x23c39c['query'][_0xad97('0x4e')]?[{'all':!![]}]:undefined})[_0xad97('0x1c')](function(_0x41163d){var _0x56fb14=_0x23c39c[_0xad97('0x5b')][_0xad97('0x33')]({'plain':!![]});if(!_0x56fb14)throw new Error(_0xad97('0x5c'));if(_0x56fb14['role']==='user'){var _0x339178=_0x41163d['get']({'plain':!![]});var _0x5e3e75=_0xad97('0x34');return db[_0xad97('0x5d')][_0xad97('0x54')]({'where':{'name':_0x5e3e75,'userProfileId':_0x56fb14[_0xad97('0x5e')]},'raw':!![]})[_0xad97('0x1c')](function(_0x469f8a){if(_0x469f8a&&_0x469f8a[_0xad97('0x5f')]===0x0){return db[_0xad97('0x35')]['create']({'name':_0x339178['name'],'resourceId':_0x339178['id'],'type':_0x469f8a[_0xad97('0x37')],'sectionId':_0x469f8a['id']},{})[_0xad97('0x1c')](function(){return _0x41163d;});}else{return _0x41163d;}})['catch'](function(_0xbcc909){logger[_0xad97('0x20')](_0xad97('0x60'),_0xbcc909);throw _0xbcc909;});}return _0x41163d;});}})[_0xad97('0x1c')](respondWithResult(_0x5b6725,0xc9))[_0xad97('0x26')](handleError(_0x5b6725,null));};exports[_0xad97('0x5a')]=function(_0x2e1cf9,_0x2227ad,_0x248aa9){var _0x5056bd;return db[_0xad97('0x3a')][_0xad97('0x5a')](_0x2e1cf9[_0xad97('0x59')],{'raw':!![]})[_0xad97('0x1c')](function(_0x5596e1){_0x5056bd=_0x5596e1;return db[_0xad97('0x3a')][_0xad97('0x50')]({'raw':!![]});})[_0xad97('0x1c')](function(_0x24ac60){var _0x2be8bc=fs[_0xad97('0x61')](path[_0xad97('0x62')](config['root'],_0xad97('0x63')),_0xad97('0x64'));var _0x2e3f6f=fs['readFileSync'](path[_0xad97('0x62')](config[_0xad97('0x65')],_0xad97('0x66')),_0xad97('0x64'));var _0x25360d=ejs['render'](_0x2be8bc,{'trunks':_0x24ac60||[]});fs['writeFileSync'](_0xad97('0x67'),_0x25360d);if(_0x5056bd[_0xad97('0x68')]){var _0x187506=ejs[_0xad97('0x69')](_0x2e3f6f,{'trunks':_0x24ac60||[]});fs['writeFileSync'](_0xad97('0x6a'),_0x187506);}})[_0xad97('0x1c')](function(){return respondWithRpcPromise(_0xad97('0x6b'),_0xad97('0x5a'),{'module':_0xad97('0x6c')});})[_0xad97('0x1c')](function(){var _0x317c80=_0x2e1cf9[_0xad97('0x5b')][_0xad97('0x33')]({'plain':!![]});if(!_0x317c80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x317c80[_0xad97('0x6d')]===_0xad97('0x5b')){var _0x565e08=_0x5056bd[_0xad97('0x33')]({'plain':!![]});return db[_0xad97('0x5d')][_0xad97('0x54')]({'where':{'name':'Trunks','userProfileId':_0x317c80[_0xad97('0x5e')]},'raw':!![]})[_0xad97('0x1c')](function(_0x53009b){if(_0x53009b&&_0x53009b[_0xad97('0x5f')]===0x0){return db[_0xad97('0x35')]['create']({'name':_0x565e08[_0xad97('0x37')],'resourceId':_0x565e08['id'],'type':_0x53009b['name'],'sectionId':_0x53009b['id']},{})[_0xad97('0x1c')](function(){return _0x5056bd;});}else{return _0x5056bd;}})[_0xad97('0x26')](function(_0x3c6566){logger[_0xad97('0x20')](_0xad97('0x60'),_0x3c6566);throw _0x3c6566;});}return _0x5056bd;})['then'](respondWithResult(_0x2227ad,0xc9))[_0xad97('0x26')](handleError(_0x2227ad,null));};exports[_0xad97('0x32')]=function(_0x4341f5,_0x2dc80d,_0x23e7b6){var _0x11ded5;return db['Trunk'][_0xad97('0x54')]({'where':{'id':_0x4341f5['params']['id']}})['then'](handleEntityNotFound(_0x2dc80d,null))[_0xad97('0x1c')](saveUpdates(_0x4341f5[_0xad97('0x59')],null))[_0xad97('0x1c')](function(_0x62e7dc){if(_0x62e7dc){_0x11ded5=_0x62e7dc;return db[_0xad97('0x3a')][_0xad97('0x50')]({'raw':!![]});}})['then'](function(_0x9c347c){if(_0x9c347c){var _0x199a12=fs[_0xad97('0x61')](path[_0xad97('0x62')](config[_0xad97('0x65')],_0xad97('0x63')),'utf8');var _0x4d6899=fs[_0xad97('0x61')](path[_0xad97('0x62')](config[_0xad97('0x65')],_0xad97('0x66')),_0xad97('0x64'));var _0x39dd7e=ejs['render'](_0x199a12,{'trunks':_0x9c347c||[]});fs['writeFileSync'](_0xad97('0x67'),_0x39dd7e);var _0x36a0d4=ejs[_0xad97('0x69')](_0x4d6899,{'trunks':_0x9c347c||[]});fs[_0xad97('0x6e')](_0xad97('0x6a'),_0x36a0d4);return respondWithRpcPromise(_0xad97('0x6b'),_0xad97('0x32'),{'module':_0xad97('0x6c')});}return null;})[_0xad97('0x1c')](function(_0xf63777){if(_0xf63777){return _0x11ded5;}})['then'](respondWithResult(_0x2dc80d,null))[_0xad97('0x26')](handleError(_0x2dc80d,null));};exports[_0xad97('0x36')]=function(_0x56ffbd,_0x52cd39,_0x39472e){var _0x13d84b;return db[_0xad97('0x3a')][_0xad97('0x54')]({'where':{'id':_0x56ffbd['params']['id']}})[_0xad97('0x1c')](handleEntityNotFound(_0x52cd39,null))[_0xad97('0x1c')](removeEntity(_0x52cd39,null))['then'](function(){return db[_0xad97('0x3a')][_0xad97('0x50')]({'raw':!![]});})[_0xad97('0x1c')](function(_0x3b6c85){var _0x1a97a3=fs[_0xad97('0x61')](path[_0xad97('0x62')](config[_0xad97('0x65')],'server/files/templates/trunk.ejs'),'utf8');var _0x1c63af=fs[_0xad97('0x61')](path[_0xad97('0x62')](config[_0xad97('0x65')],_0xad97('0x66')),_0xad97('0x64'));var _0x2455a2=ejs[_0xad97('0x69')](_0x1a97a3,{'trunks':_0x3b6c85});var _0x2e6879=ejs[_0xad97('0x69')](_0x1c63af,{'trunks':_0x3b6c85});fs[_0xad97('0x6e')](_0xad97('0x67'),_0x2455a2);fs['writeFileSync'](_0xad97('0x6a'),_0x2e6879);return respondWithRpcPromise(_0xad97('0x6b'),_0xad97('0x36'),{'module':'chan_sip.so'});})[_0xad97('0x26')](handleError(_0x52cd39,null));}; \ No newline at end of file +var _0x49ac=['destroy','then','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trunk','includeAll','include','findAll','rows','catch','params','keys','clone','find','get','omit','createdAt','updatedAt','body','create','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','writeFileSync','render','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','/etc/asterisk/sip_xcally_registers.conf','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x2587ca,_0x231303){var _0x5aada1=function(_0x2d21e1){while(--_0x2d21e1){_0x2587ca['push'](_0x2587ca['shift']());}};_0x5aada1(++_0x231303);}(_0x49ac,0xb2));var _0xc49a=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x49ac[_0x193e28];return _0x20ef59;};'use strict';var pdf=require(_0xc49a('0x0'));var emlformat=require(_0xc49a('0x1'));var rimraf=require(_0xc49a('0x2'));var zipdir=require(_0xc49a('0x3'));var jsonpatch=require(_0xc49a('0x4'));var rp=require(_0xc49a('0x5'));var moment=require(_0xc49a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc49a('0x7'));var util=require(_0xc49a('0x8'));var path=require('path');var sox=require(_0xc49a('0x9'));var csv=require('to-csv');var ejs=require(_0xc49a('0xa'));var fs=require('fs');var _=require(_0xc49a('0xb'));var squel=require('squel');var crypto=require(_0xc49a('0xc'));var jsforce=require(_0xc49a('0xd'));var deskjs=require(_0xc49a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc49a('0xf'));var Papa=require(_0xc49a('0x10'));var Redis=require(_0xc49a('0x11'));var authService=require(_0xc49a('0x12'));var qs=require(_0xc49a('0x13'));var as=require(_0xc49a('0x14'));var hardwareService=require(_0xc49a('0x15'));var logger=require(_0xc49a('0x16'))(_0xc49a('0x17'));var utils=require('../../config/utils');var config=require(_0xc49a('0x18'));var licenseUtil=require(_0xc49a('0x19'));var db=require(_0xc49a('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc49a('0x1b')][_0xc49a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4fe9ed,_0x4c495d,_0xc18ac8,_0x5c614c){return new BPromise(function(_0x231052,_0x5c40df){var _0xb093ab=_0x5c614c||client;return _0xb093ab[_0xc49a('0x1d')](_0x4fe9ed,_0xc18ac8)['then'](function(_0x4ef9e6){logger[_0xc49a('0x1e')]('Trunk,\x20%s,\x20%s',_0x4c495d,_0xc49a('0x1f'));logger[_0xc49a('0x20')](_0xc49a('0x21'),_0x4c495d,_0xc49a('0x1f'),JSON['stringify'](_0x4ef9e6));if(_0x4ef9e6[_0xc49a('0x22')]){if(_0x4ef9e6['error'][_0xc49a('0x23')]===0x1f4){logger[_0xc49a('0x22')](_0xc49a('0x24'),_0x4c495d,_0x4ef9e6['error']['message']);return _0x5c40df(_0x4ef9e6[_0xc49a('0x22')][_0xc49a('0x25')]);}logger['error'](_0xc49a('0x24'),_0x4c495d,_0x4ef9e6[_0xc49a('0x22')][_0xc49a('0x25')]);return _0x231052(_0x4ef9e6['error'][_0xc49a('0x25')]);}else{logger[_0xc49a('0x1e')]('Trunk,\x20%s,\x20%s',_0x4c495d,_0xc49a('0x1f'));_0x231052(_0x4ef9e6['result'][_0xc49a('0x25')]);}})['catch'](function(_0x289e80){logger[_0xc49a('0x22')](_0xc49a('0x24'),_0x4c495d,_0x289e80);_0x5c40df(_0x289e80);});});}function respondWithStatusCode(_0xde1734,_0x35f61d){_0x35f61d=_0x35f61d||0xcc;return function(_0x51486a){if(_0x51486a){return _0xde1734[_0xc49a('0x26')](_0x35f61d);}return _0xde1734[_0xc49a('0x27')](_0x35f61d)[_0xc49a('0x28')]();};}function respondWithResult(_0x1ee96d,_0x7a6389){_0x7a6389=_0x7a6389||0xc8;return function(_0x11983a){if(_0x11983a){return _0x1ee96d[_0xc49a('0x27')](_0x7a6389)[_0xc49a('0x29')](_0x11983a);}};}function respondWithFilteredResult(_0x12ea7f,_0x152dfc){return function(_0x49fbfe){if(_0x49fbfe){var _0x274405=_0x49fbfe[_0xc49a('0x2a')],_0x29967c=_0x152dfc['offset'],_0x1828de=_0x152dfc[_0xc49a('0x2b')]+_0x152dfc[_0xc49a('0x2c')],_0x31e446;if(_0x1828de>=_0x274405){_0x1828de=_0x274405;_0x31e446=0xc8;}else{_0x31e446=0xce;}_0x12ea7f['status'](_0x31e446);return _0x12ea7f[_0xc49a('0x2d')](_0xc49a('0x2e'),_0x29967c+'-'+_0x1828de+'/'+_0x274405)[_0xc49a('0x29')](_0x49fbfe);}return null;};}function patchUpdates(_0x39c909){return function(_0x556f40){try{jsonpatch[_0xc49a('0x2f')](_0x556f40,_0x39c909,!![]);}catch(_0x562657){return BPromise[_0xc49a('0x30')](_0x562657);}return _0x556f40[_0xc49a('0x31')]();};}function saveUpdates(_0x41f8be,_0x396a07){return function(_0xdf07df){if(_0xdf07df){return _0xdf07df['update'](_0x41f8be)['then'](function(_0x10aa0f){return _0x10aa0f;});}return null;};}function removeEntity(_0x27527f,_0x55a092){return function(_0x2086a5){if(_0x2086a5){return _0x2086a5[_0xc49a('0x32')]()[_0xc49a('0x33')](function(){var _0xa538fc=_0x2086a5['get']({'plain':!![]});var _0x5541f9=_0xc49a('0x34');return db[_0xc49a('0x35')][_0xc49a('0x32')]({'where':{'type':_0x5541f9,'resourceId':_0xa538fc['id']}})[_0xc49a('0x33')](function(){return _0x2086a5;});})[_0xc49a('0x33')](function(){_0x27527f[_0xc49a('0x27')](0xcc)[_0xc49a('0x28')]();});}};}function handleEntityNotFound(_0x2ccd00,_0x241b8c){return function(_0x20108b){if(!_0x20108b){_0x2ccd00['sendStatus'](0x194);}return _0x20108b;};}function handleError(_0x2285cf,_0x42ca01){_0x42ca01=_0x42ca01||0x1f4;return function(_0xfc6b90){logger[_0xc49a('0x22')](_0xfc6b90[_0xc49a('0x36')]);if(_0xfc6b90[_0xc49a('0x37')]){delete _0xfc6b90['name'];}_0x2285cf['status'](_0x42ca01)[_0xc49a('0x38')](_0xfc6b90);};}exports[_0xc49a('0x39')]=function(_0x1c7935,_0x475f7c){var _0x55b218={},_0x4a70eb={},_0x527350={'count':0x0,'rows':[]};var _0x35953d=_['map'](db['Trunk'][_0xc49a('0x3a')],function(_0x48f5b4){return{'name':_0x48f5b4[_0xc49a('0x3b')],'type':_0x48f5b4[_0xc49a('0x3c')][_0xc49a('0x3d')]};});_0x4a70eb[_0xc49a('0x3e')]=_[_0xc49a('0x3f')](_0x35953d,_0xc49a('0x37'));_0x4a70eb[_0xc49a('0x40')]=_['keys'](_0x1c7935[_0xc49a('0x40')]);_0x4a70eb[_0xc49a('0x41')]=_['intersection'](_0x4a70eb['model'],_0x4a70eb[_0xc49a('0x40')]);_0x55b218[_0xc49a('0x42')]=_[_0xc49a('0x43')](_0x4a70eb[_0xc49a('0x3e')],qs[_0xc49a('0x44')](_0x1c7935[_0xc49a('0x40')][_0xc49a('0x44')]));_0x55b218['attributes']=_0x55b218['attributes'][_0xc49a('0x45')]?_0x55b218[_0xc49a('0x42')]:_0x4a70eb[_0xc49a('0x3e')];if(!_0x1c7935[_0xc49a('0x40')][_0xc49a('0x46')](_0xc49a('0x47'))){_0x55b218['limit']=qs['limit'](_0x1c7935[_0xc49a('0x40')][_0xc49a('0x2c')]);_0x55b218['offset']=qs[_0xc49a('0x2b')](_0x1c7935['query'][_0xc49a('0x2b')]);}_0x55b218[_0xc49a('0x48')]=qs[_0xc49a('0x49')](_0x1c7935[_0xc49a('0x40')][_0xc49a('0x49')]);_0x55b218[_0xc49a('0x4a')]=qs[_0xc49a('0x41')](_[_0xc49a('0x4b')](_0x1c7935[_0xc49a('0x40')],_0x4a70eb[_0xc49a('0x41')]),_0x35953d);if(_0x1c7935[_0xc49a('0x40')][_0xc49a('0x4c')]){_0x55b218[_0xc49a('0x4a')]=_[_0xc49a('0x4d')](_0x55b218[_0xc49a('0x4a')],{'$or':_[_0xc49a('0x3f')](_0x35953d,function(_0x19fd54){if(_0x19fd54[_0xc49a('0x3c')]!==_0xc49a('0x4e')){var _0x1ee1e5={};_0x1ee1e5[_0x19fd54[_0xc49a('0x37')]]={'$like':'%'+_0x1c7935['query']['filter']+'%'};return _0x1ee1e5;}})});}_0x55b218=_['merge']({},_0x55b218,_0x1c7935[_0xc49a('0x4f')]);var _0x5eee09={'where':_0x55b218[_0xc49a('0x4a')]};return db[_0xc49a('0x50')][_0xc49a('0x2a')](_0x5eee09)[_0xc49a('0x33')](function(_0x238287){_0x527350[_0xc49a('0x2a')]=_0x238287;if(_0x1c7935[_0xc49a('0x40')][_0xc49a('0x51')]){_0x55b218[_0xc49a('0x52')]=[{'all':!![]}];}return db['Trunk'][_0xc49a('0x53')](_0x55b218);})[_0xc49a('0x33')](function(_0x34371c){_0x527350[_0xc49a('0x54')]=_0x34371c;return _0x527350;})['then'](respondWithFilteredResult(_0x475f7c,_0x55b218))[_0xc49a('0x55')](handleError(_0x475f7c,null));};exports['show']=function(_0x24fa9d,_0x5e7d1b){var _0x2fe87f={'raw':![],'where':{'id':_0x24fa9d[_0xc49a('0x56')]['id']}},_0x7221e9={};_0x7221e9[_0xc49a('0x3e')]=_[_0xc49a('0x57')](db['Trunk'][_0xc49a('0x3a')]);_0x7221e9[_0xc49a('0x40')]=_[_0xc49a('0x57')](_0x24fa9d['query']);_0x7221e9['filters']=_[_0xc49a('0x43')](_0x7221e9[_0xc49a('0x3e')],_0x7221e9[_0xc49a('0x40')]);_0x2fe87f['attributes']=_[_0xc49a('0x43')](_0x7221e9['model'],qs[_0xc49a('0x44')](_0x24fa9d['query'][_0xc49a('0x44')]));_0x2fe87f[_0xc49a('0x42')]=_0x2fe87f[_0xc49a('0x42')][_0xc49a('0x45')]?_0x2fe87f[_0xc49a('0x42')]:_0x7221e9[_0xc49a('0x3e')];if(_0x24fa9d['query'][_0xc49a('0x51')]){_0x2fe87f[_0xc49a('0x52')]=[{'all':!![]}];}_0x2fe87f=_[_0xc49a('0x4d')]({},_0x2fe87f,_0x24fa9d[_0xc49a('0x4f')]);return db['Trunk']['find'](_0x2fe87f)[_0xc49a('0x33')](handleEntityNotFound(_0x5e7d1b,null))['then'](respondWithResult(_0x5e7d1b,null))[_0xc49a('0x55')](handleError(_0x5e7d1b,null));};exports[_0xc49a('0x58')]=function(_0x161266,_0x30e8da){var _0x3bcfc1={'where':{'id':_0x161266[_0xc49a('0x56')]['id']}},_0x2b52f7={};_0x2b52f7['model']=_[_0xc49a('0x57')](db[_0xc49a('0x50')][_0xc49a('0x3a')]);_0x3bcfc1[_0xc49a('0x42')]=_[_0xc49a('0x43')](_0x2b52f7['model'],qs[_0xc49a('0x44')](_0x161266['query'][_0xc49a('0x44')]));_0x3bcfc1[_0xc49a('0x42')]=_0x3bcfc1[_0xc49a('0x42')][_0xc49a('0x45')]?_0x3bcfc1[_0xc49a('0x42')]:_0x2b52f7[_0xc49a('0x3e')];if(_0x161266[_0xc49a('0x40')][_0xc49a('0x51')]){_0x3bcfc1[_0xc49a('0x52')]=[{'all':!![]}];}_0x3bcfc1=_[_0xc49a('0x4d')]({},_0x3bcfc1,_0x161266['options']);return db['Trunk'][_0xc49a('0x59')](_0x3bcfc1)[_0xc49a('0x33')](handleEntityNotFound(_0x30e8da,null))[_0xc49a('0x33')](function(_0x3076b8){if(_0x3076b8){var _0x5728a8=_0x3076b8[_0xc49a('0x5a')]({'plain':!![]});_0x5728a8=qs[_0xc49a('0x5b')](_0x5728a8,['id',_0xc49a('0x5c'),_0xc49a('0x5d')]);_0x161266[_0xc49a('0x5e')]=_[_0xc49a('0x5b')](_0x161266[_0xc49a('0x5e')],['id','createdAt',_0xc49a('0x5d')]);return db[_0xc49a('0x50')][_0xc49a('0x5f')](_[_0xc49a('0x4d')](_0x5728a8,_0x161266[_0xc49a('0x5e')]),{'include':_0x161266[_0xc49a('0x40')][_0xc49a('0x51')]?[{'all':!![]}]:undefined})[_0xc49a('0x33')](function(_0x438e6a){var _0x1b621a=_0x161266[_0xc49a('0x60')]['get']({'plain':!![]});if(!_0x1b621a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b621a[_0xc49a('0x61')]===_0xc49a('0x60')){var _0x6f2899=_0x438e6a['get']({'plain':!![]});var _0x43d2f7=_0xc49a('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x43d2f7,'userProfileId':_0x1b621a['userProfileId']},'raw':!![]})[_0xc49a('0x33')](function(_0x5827fd){if(_0x5827fd&&_0x5827fd['autoAssociation']===0x0){return db[_0xc49a('0x35')][_0xc49a('0x5f')]({'name':_0x6f2899['name'],'resourceId':_0x6f2899['id'],'type':_0x5827fd[_0xc49a('0x37')],'sectionId':_0x5827fd['id']},{})['then'](function(){return _0x438e6a;});}else{return _0x438e6a;}})['catch'](function(_0x12bb6b){logger[_0xc49a('0x22')](_0xc49a('0x62'),_0x12bb6b);throw _0x12bb6b;});}return _0x438e6a;});}})[_0xc49a('0x33')](respondWithResult(_0x30e8da,0xc9))[_0xc49a('0x55')](handleError(_0x30e8da,null));};exports['create']=function(_0x1f86ac,_0x5b45b5,_0x5f0ce9){var _0x2bddb9;return db[_0xc49a('0x50')][_0xc49a('0x5f')](_0x1f86ac[_0xc49a('0x5e')],{'raw':!![]})[_0xc49a('0x33')](function(_0xa7b583){_0x2bddb9=_0xa7b583;return db[_0xc49a('0x50')][_0xc49a('0x53')]({'raw':!![]});})[_0xc49a('0x33')](function(_0x36645d){var _0x3aab98=fs[_0xc49a('0x63')](path['join'](config[_0xc49a('0x64')],_0xc49a('0x65')),_0xc49a('0x66'));var _0x2ed02a=fs[_0xc49a('0x63')](path[_0xc49a('0x67')](config[_0xc49a('0x64')],_0xc49a('0x68')),_0xc49a('0x66'));var _0x378f8d=ejs['render'](_0x3aab98,{'trunks':_0x36645d||[]});fs[_0xc49a('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x378f8d);if(_0x2bddb9['registry']){var _0xfeaba7=ejs[_0xc49a('0x6a')](_0x2ed02a,{'trunks':_0x36645d||[]});fs[_0xc49a('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0xfeaba7);}})['then'](function(){return respondWithRpcPromise(_0xc49a('0x6b'),_0xc49a('0x5f'),{'module':_0xc49a('0x6c')});})[_0xc49a('0x33')](function(){var _0x470ba0=_0x1f86ac[_0xc49a('0x60')][_0xc49a('0x5a')]({'plain':!![]});if(!_0x470ba0)throw new Error(_0xc49a('0x6d'));if(_0x470ba0[_0xc49a('0x61')]===_0xc49a('0x60')){var _0x35a343=_0x2bddb9['get']({'plain':!![]});return db['UserProfileSection'][_0xc49a('0x59')]({'where':{'name':_0xc49a('0x34'),'userProfileId':_0x470ba0['userProfileId']},'raw':!![]})['then'](function(_0x43695f){if(_0x43695f&&_0x43695f[_0xc49a('0x6e')]===0x0){return db[_0xc49a('0x35')][_0xc49a('0x5f')]({'name':_0x35a343[_0xc49a('0x37')],'resourceId':_0x35a343['id'],'type':_0x43695f['name'],'sectionId':_0x43695f['id']},{})[_0xc49a('0x33')](function(){return _0x2bddb9;});}else{return _0x2bddb9;}})[_0xc49a('0x55')](function(_0x1ca7f6){logger[_0xc49a('0x22')](_0xc49a('0x62'),_0x1ca7f6);throw _0x1ca7f6;});}return _0x2bddb9;})[_0xc49a('0x33')](respondWithResult(_0x5b45b5,0xc9))[_0xc49a('0x55')](handleError(_0x5b45b5,null));};exports[_0xc49a('0x6f')]=function(_0x2e7faf,_0x9ca488,_0x33db37){var _0x925b21;return db[_0xc49a('0x50')][_0xc49a('0x59')]({'where':{'id':_0x2e7faf[_0xc49a('0x56')]['id']}})[_0xc49a('0x33')](handleEntityNotFound(_0x9ca488,null))[_0xc49a('0x33')](saveUpdates(_0x2e7faf[_0xc49a('0x5e')],null))[_0xc49a('0x33')](function(_0x208d20){if(_0x208d20){_0x925b21=_0x208d20;return db[_0xc49a('0x50')][_0xc49a('0x53')]({'raw':!![]});}})[_0xc49a('0x33')](function(_0x52f479){if(_0x52f479){var _0x3bf4a6=fs[_0xc49a('0x63')](path[_0xc49a('0x67')](config['root'],_0xc49a('0x65')),_0xc49a('0x66'));var _0x500704=fs[_0xc49a('0x63')](path[_0xc49a('0x67')](config[_0xc49a('0x64')],_0xc49a('0x68')),_0xc49a('0x66'));var _0x12506d=ejs[_0xc49a('0x6a')](_0x3bf4a6,{'trunks':_0x52f479||[]});fs[_0xc49a('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x12506d);var _0x2e98c9=ejs[_0xc49a('0x6a')](_0x500704,{'trunks':_0x52f479||[]});fs[_0xc49a('0x69')](_0xc49a('0x70'),_0x2e98c9);return respondWithRpcPromise('Reload',_0xc49a('0x6f'),{'module':_0xc49a('0x6c')});}return null;})['then'](function(_0x3da920){if(_0x3da920){return _0x925b21;}})['then'](respondWithResult(_0x9ca488,null))[_0xc49a('0x55')](handleError(_0x9ca488,null));};exports['destroy']=function(_0x1d73ff,_0x1def78,_0x2f69be){var _0x248b0a;return db['Trunk'][_0xc49a('0x59')]({'where':{'id':_0x1d73ff[_0xc49a('0x56')]['id']}})[_0xc49a('0x33')](handleEntityNotFound(_0x1def78,null))[_0xc49a('0x33')](removeEntity(_0x1def78,null))[_0xc49a('0x33')](function(){return db[_0xc49a('0x50')][_0xc49a('0x53')]({'raw':!![]});})[_0xc49a('0x33')](function(_0x598111){var _0x22e3e2=fs[_0xc49a('0x63')](path[_0xc49a('0x67')](config[_0xc49a('0x64')],'server/files/templates/trunk.ejs'),_0xc49a('0x66'));var _0x347972=fs['readFileSync'](path[_0xc49a('0x67')](config[_0xc49a('0x64')],_0xc49a('0x68')),_0xc49a('0x66'));var _0x35c962=ejs[_0xc49a('0x6a')](_0x22e3e2,{'trunks':_0x598111});var _0x47f2fa=ejs[_0xc49a('0x6a')](_0x347972,{'trunks':_0x598111});fs[_0xc49a('0x69')](_0xc49a('0x71'),_0x35c962);fs[_0xc49a('0x69')](_0xc49a('0x70'),_0x47f2fa);return respondWithRpcPromise(_0xc49a('0x6b'),'destroy',{'module':_0xc49a('0x6c')});})[_0xc49a('0x55')](handleError(_0x1def78,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2bf2b8c..3092ed1 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 _0x5119=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','tools_trunks','lodash'];(function(_0x54e577,_0x158968){var _0xa3e066=function(_0x42609a){while(--_0x42609a){_0x54e577['push'](_0x54e577['shift']());}};_0xa3e066(++_0x158968);}(_0x5119,0x1b7));var _0x9511=function(_0xb72cc8,_0x3b7aa3){_0xb72cc8=_0xb72cc8-0x0;var _0x75cfb3=_0x5119[_0xb72cc8];return _0x75cfb3;};'use strict';var _=require(_0x9511('0x0'));var util=require('util');var logger=require(_0x9511('0x1'))(_0x9511('0x2'));var moment=require('moment');var BPromise=require(_0x9511('0x3'));var rp=require(_0x9511('0x4'));var fs=require('fs');var path=require(_0x9511('0x5'));var rimraf=require(_0x9511('0x6'));var config=require(_0x9511('0x7'));var attributes=require(_0x9511('0x8'));module[_0x9511('0x9')]=function(_0x406037,_0x33b2d0){return _0x406037['define']('Trunk',attributes,{'tableName':_0x9511('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1bd=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Trunk','tools_trunks'];(function(_0x213dd5,_0x1b5e50){var _0x39955a=function(_0x3d9f36){while(--_0x3d9f36){_0x213dd5['push'](_0x213dd5['shift']());}};_0x39955a(++_0x1b5e50);}(_0xb1bd,0x144));var _0xdb1b=function(_0x285aec,_0x481663){_0x285aec=_0x285aec-0x0;var _0x33efa4=_0xb1bd[_0x285aec];return _0x33efa4;};'use strict';var _=require(_0xdb1b('0x0'));var util=require(_0xdb1b('0x1'));var logger=require('../../config/logger')(_0xdb1b('0x2'));var moment=require(_0xdb1b('0x3'));var BPromise=require(_0xdb1b('0x4'));var rp=require(_0xdb1b('0x5'));var fs=require('fs');var path=require(_0xdb1b('0x6'));var rimraf=require(_0xdb1b('0x7'));var config=require(_0xdb1b('0x8'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4cd8e1,_0xca11ca){return _0x4cd8e1[_0xdb1b('0x9')](_0xdb1b('0xa'),attributes,{'tableName':_0xdb1b('0xb'),'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 2ed690c..de60245 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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3168be,_0xde4567){var _0x1ae502=function(_0x2e046){while(--_0x2e046){_0x3168be['push'](_0x3168be['shift']());}};_0x1ae502(++_0xde4567);}(_0x2032,0xd9));var _0x2203=function(_0x396fe9,_0x4e948e){_0x396fe9=_0x396fe9-0x0;var _0x42d994=_0x2032[_0x396fe9];return _0x42d994;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x38578a,_0x39b7a7){var _0x3ca93b=function(_0x49b955){while(--_0x49b955){_0x38578a['push'](_0x38578a['shift']());}};_0x3ca93b(++_0x39b7a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0xb10b[_0x101134];return _0xc47acc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4d23aec..fc870f7 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 _0xb52c=['addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','update','changePassword','delete','removeQueues','removeTeams','/:id','destroy','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','removeApiKey','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','getAvatar','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','/:id/avatar','single','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb52c,0x102));var _0xcb52=function(_0x3e1f71,_0x16603b){_0x3e1f71=_0x3e1f71-0x0;var _0x32b531=_0xb52c[_0x3e1f71];return _0x32b531;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcb52('0x0'));var timeout=require(_0xcb52('0x1'));var express=require(_0xcb52('0x2'));var router=express[_0xcb52('0x3')]();var auth=require(_0xcb52('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcb52('0x5'));var controller=require(_0xcb52('0x6'));router[_0xcb52('0x7')]('/',auth[_0xcb52('0x8')](),controller[_0xcb52('0x9')]);router[_0xcb52('0x7')](_0xcb52('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xcb52('0xb'),auth[_0xcb52('0x8')](),controller['whoami']);router[_0xcb52('0x7')]('/:id',auth[_0xcb52('0x8')](),controller['show']);router['get']('/:id/avatar',controller[_0xcb52('0xc')]);router[_0xcb52('0x7')](_0xcb52('0xd'),auth[_0xcb52('0x8')](),controller['getContacts']);router[_0xcb52('0x7')](_0xcb52('0xe'),auth['isAuthenticated'](),controller['getQueues']);router[_0xcb52('0x7')](_0xcb52('0xf'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x10')]);router[_0xcb52('0x7')](_0xcb52('0x11'),auth[_0xcb52('0x8')](),controller['getGroups']);router[_0xcb52('0x7')](_0xcb52('0x12'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x13')]);router[_0xcb52('0x7')](_0xcb52('0x14'),auth[_0xcb52('0x8')](),controller['getScreenRecordings']);router[_0xcb52('0x7')]('/:id/chat/interactions',auth[_0xcb52('0x8')](),controller[_0xcb52('0x15')]);router[_0xcb52('0x7')](_0xcb52('0x16'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x17')]);router['get'](_0xcb52('0x18'),auth['isAuthenticated'](),controller[_0xcb52('0x19')]);router[_0xcb52('0x7')](_0xcb52('0x1a'),auth['isAuthenticated'](),controller['getSmsInteractions']);router['get'](_0xcb52('0x1b'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x1c')]);router['get'](_0xcb52('0x1d'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x1e')]);router[_0xcb52('0x7')](_0xcb52('0x1f'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x20')]);router['get']('/:id/lists',auth[_0xcb52('0x8')](),controller[_0xcb52('0x21')]);router['get'](_0xcb52('0x22'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x23')]);router[_0xcb52('0x7')](_0xcb52('0x24'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x25')]);router[_0xcb52('0x7')](_0xcb52('0x26'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x27')]);router['get'](_0xcb52('0x28'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x29')]);router['get'](_0xcb52('0x2a'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x2b')]);router[_0xcb52('0x7')](_0xcb52('0x2c'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xcb52('0x7')](_0xcb52('0x2d'),auth[_0xcb52('0x8')](),controller['getChatWebsites']);router['get'](_0xcb52('0x2e'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x2f')]);router[_0xcb52('0x7')]('/:id/square_projects',auth[_0xcb52('0x8')](),controller[_0xcb52('0x30')]);router[_0xcb52('0x7')](_0xcb52('0x31'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x32')]);router[_0xcb52('0x7')](_0xcb52('0x33'),auth[_0xcb52('0x8')](),controller['getApiKey']);router[_0xcb52('0x34')](_0xcb52('0xd'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x35')]);router[_0xcb52('0x34')]('/',auth[_0xcb52('0x8')](),controller['create']);router[_0xcb52('0x34')](_0xcb52('0x36'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x37')]);router[_0xcb52('0x34')](_0xcb52('0xe'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x38')]);var upload=multer({'storage':multer[_0xcb52('0x39')]({'destination':function(_0x3d00de,_0x57033a,_0x1792f0){_0x1792f0(null,path[_0xcb52('0x3a')](config[_0xcb52('0x3b')],'server/files/images/'));},'filename':function(_0x216226,_0x2d3ab4,_0x50a6eb){_0x50a6eb(null,util[_0xcb52('0x3c')](_0xcb52('0x3d'),Date[_0xcb52('0x3e')](),_0x2d3ab4[_0xcb52('0x3f')]));}})});router[_0xcb52('0x34')](_0xcb52('0x40'),upload[_0xcb52('0x41')]('file'),controller[_0xcb52('0x42')]);router[_0xcb52('0x34')](_0xcb52('0x43'),auth['isAuthenticated'](),controller['login']);router['post'](_0xcb52('0x44'),auth['isAuthenticated'](),controller[_0xcb52('0x45')]);router[_0xcb52('0x34')](_0xcb52('0x46'),auth[_0xcb52('0x8')](),controller['pause']);router[_0xcb52('0x34')](_0xcb52('0x47'),auth[_0xcb52('0x8')](),controller['unpause']);router[_0xcb52('0x34')](_0xcb52('0x1f'),auth['isAuthenticated'](),controller[_0xcb52('0x48')]);router[_0xcb52('0x34')](_0xcb52('0x49'),auth['isAuthenticated'](),controller[_0xcb52('0x4a')]);router['post'](_0xcb52('0x4b'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x4c')]);router[_0xcb52('0x34')](_0xcb52('0x4d'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x4e')]);router[_0xcb52('0x34')]('/:id/sms_interactions',auth[_0xcb52('0x8')](),controller['addSmsInteractions']);router[_0xcb52('0x34')](_0xcb52('0x4f'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x50')]);router['post'](_0xcb52('0x51'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x52')]);router[_0xcb52('0x34')](_0xcb52('0x26'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x53')]);router[_0xcb52('0x34')](_0xcb52('0x28'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x54')]);router[_0xcb52('0x34')](_0xcb52('0x2a'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x55')]);router[_0xcb52('0x34')](_0xcb52('0x2c'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xcb52('0x34')](_0xcb52('0x2d'),auth['isAuthenticated'](),controller[_0xcb52('0x56')]);router[_0xcb52('0x34')](_0xcb52('0x2e'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x57')]);router['post'](_0xcb52('0x58'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x59')]);router[_0xcb52('0x34')](_0xcb52('0x33'),auth[_0xcb52('0x8')](),controller['createApiKey']);router[_0xcb52('0x5a')]('/:id',auth[_0xcb52('0x8')](),controller[_0xcb52('0x5b')]);router[_0xcb52('0x5a')]('/:id/password',auth[_0xcb52('0x8')](),controller[_0xcb52('0x5c')]);router[_0xcb52('0x5d')](_0xcb52('0xe'),auth['isAuthenticated'](),controller[_0xcb52('0x5e')]);router[_0xcb52('0x5d')]('/:id/teams',auth[_0xcb52('0x8')](),controller[_0xcb52('0x5f')]);router[_0xcb52('0x5d')](_0xcb52('0x60'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x61')]);router[_0xcb52('0x5d')](_0xcb52('0x49'),auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete'](_0xcb52('0x4b'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x62')]);router['delete'](_0xcb52('0x4d'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x63')]);router[_0xcb52('0x5d')](_0xcb52('0x64'),auth['isAuthenticated'](),controller[_0xcb52('0x65')]);router[_0xcb52('0x5d')]('/:id/openchannel_interactions',auth[_0xcb52('0x8')](),controller[_0xcb52('0x66')]);router[_0xcb52('0x5d')](_0xcb52('0x51'),auth['isAuthenticated'](),controller[_0xcb52('0x67')]);router[_0xcb52('0x5d')](_0xcb52('0x26'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x68')]);router[_0xcb52('0x5d')]('/:id/mail_accounts',auth[_0xcb52('0x8')](),controller['removeMailAccounts']);router[_0xcb52('0x5d')]('/:id/openchannel_accounts',auth[_0xcb52('0x8')](),controller[_0xcb52('0x69')]);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xcb52('0x6a')]);router[_0xcb52('0x5d')](_0xcb52('0x2d'),auth[_0xcb52('0x8')](),controller['removeChatWebsites']);router[_0xcb52('0x5d')](_0xcb52('0x2e'),auth[_0xcb52('0x8')](),controller['removeWhatsappAccounts']);router[_0xcb52('0x5d')](_0xcb52('0x58'),auth[_0xcb52('0x8')](),controller[_0xcb52('0x6b')]);router[_0xcb52('0x5d')](_0xcb52('0x33'),auth['isAuthenticated'](),controller[_0xcb52('0x6c')]);module[_0xcb52('0x6d')]=router; \ No newline at end of file +var _0x4dab=['addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/screen_recordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions'];(function(_0x56d444,_0x2ee7c8){var _0x4cbca1=function(_0x20d00b){while(--_0x20d00b){_0x56d444['push'](_0x56d444['shift']());}};_0x4cbca1(++_0x2ee7c8);}(_0x4dab,0xe3));var _0xb4da=function(_0x1d895d,_0x3e5c93){_0x1d895d=_0x1d895d-0x0;var _0x2dae23=_0x4dab[_0x1d895d];return _0x2dae23;};'use strict';var multer=require(_0xb4da('0x0'));var util=require('util');var path=require(_0xb4da('0x1'));var timeout=require(_0xb4da('0x2'));var express=require('express');var router=express[_0xb4da('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb4da('0x4'));var config=require(_0xb4da('0x5'));var controller=require(_0xb4da('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb4da('0x7')]);router[_0xb4da('0x8')](_0xb4da('0x9'),auth[_0xb4da('0xa')](),controller[_0xb4da('0xb')]);router['get'](_0xb4da('0xc'),auth[_0xb4da('0xa')](),controller[_0xb4da('0xd')]);router[_0xb4da('0x8')](_0xb4da('0xe'),auth[_0xb4da('0xa')](),controller[_0xb4da('0xf')]);router[_0xb4da('0x8')](_0xb4da('0x10'),controller[_0xb4da('0x11')]);router[_0xb4da('0x8')](_0xb4da('0x12'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x13')]);router[_0xb4da('0x8')](_0xb4da('0x14'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x15')]);router[_0xb4da('0x8')](_0xb4da('0x16'),auth[_0xb4da('0xa')](),controller['getVoiceQueuesRt']);router[_0xb4da('0x8')](_0xb4da('0x17'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x18')]);router['get']('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router[_0xb4da('0x8')](_0xb4da('0x19'),auth[_0xb4da('0xa')](),controller['getScreenRecordings']);router[_0xb4da('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xb4da('0x8')](_0xb4da('0x1a'),auth['isAuthenticated'](),controller[_0xb4da('0x1b')]);router[_0xb4da('0x8')](_0xb4da('0x1c'),auth['isAuthenticated'](),controller[_0xb4da('0x1d')]);router[_0xb4da('0x8')](_0xb4da('0x1e'),auth[_0xb4da('0xa')](),controller['getSmsInteractions']);router[_0xb4da('0x8')]('/:id/fax/interactions',auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xb4da('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get'](_0xb4da('0x1f'),auth[_0xb4da('0xa')](),controller['getTeams']);router[_0xb4da('0x8')](_0xb4da('0x20'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x21')]);router[_0xb4da('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0xb4da('0x22')]);router['get'](_0xb4da('0x23'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x24')]);router['get'](_0xb4da('0x25'),auth['isAuthenticated'](),controller[_0xb4da('0x26')]);router[_0xb4da('0x8')](_0xb4da('0x27'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x28')]);router[_0xb4da('0x8')](_0xb4da('0x29'),auth[_0xb4da('0xa')](),controller['getOpenchannelAccounts']);router[_0xb4da('0x8')](_0xb4da('0x2a'),auth[_0xb4da('0xa')](),controller['getSmsAccounts']);router[_0xb4da('0x8')](_0xb4da('0x2b'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x2c')]);router[_0xb4da('0x8')](_0xb4da('0x2d'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x2e')]);router['get']('/:id/square_projects',auth[_0xb4da('0xa')](),controller[_0xb4da('0x2f')]);router['get'](_0xb4da('0x30'),auth[_0xb4da('0xa')](),controller['getScheduledCalls']);router[_0xb4da('0x8')]('/:id/api_key',auth[_0xb4da('0xa')](),controller['getApiKey']);router[_0xb4da('0x31')](_0xb4da('0x12'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0xb4da('0xa')](),controller[_0xb4da('0x32')]);router[_0xb4da('0x31')](_0xb4da('0x33'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x34')]);router[_0xb4da('0x31')](_0xb4da('0x14'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x35')]);var upload=multer({'storage':multer[_0xb4da('0x36')]({'destination':function(_0x146992,_0x2a33fb,_0x3b44ad){_0x3b44ad(null,path[_0xb4da('0x37')](config[_0xb4da('0x38')],_0xb4da('0x39')));},'filename':function(_0x5cde55,_0x3e6960,_0x51982b){_0x51982b(null,util[_0xb4da('0x3a')](_0xb4da('0x3b'),Date[_0xb4da('0x3c')](),_0x3e6960[_0xb4da('0x3d')]));}})});router[_0xb4da('0x31')](_0xb4da('0x10'),upload['single'](_0xb4da('0x3e')),controller[_0xb4da('0x3f')]);router[_0xb4da('0x31')](_0xb4da('0x40'),auth[_0xb4da('0xa')](),controller['login']);router[_0xb4da('0x31')](_0xb4da('0x41'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x42')]);router[_0xb4da('0x31')]('/:id/pause',auth[_0xb4da('0xa')](),controller[_0xb4da('0x43')]);router[_0xb4da('0x31')](_0xb4da('0x44'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x45')]);router['post']('/:id/teams',auth[_0xb4da('0xa')](),controller[_0xb4da('0x46')]);router[_0xb4da('0x31')](_0xb4da('0x47'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x48')]);router[_0xb4da('0x31')](_0xb4da('0x49'),auth[_0xb4da('0xa')](),controller['addMailInteractions']);router[_0xb4da('0x31')](_0xb4da('0x4a'),auth[_0xb4da('0xa')](),controller['addFaxInteractions']);router[_0xb4da('0x31')](_0xb4da('0x4b'),auth[_0xb4da('0xa')](),controller['addSmsInteractions']);router[_0xb4da('0x31')](_0xb4da('0x4c'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x4d')]);router['post'](_0xb4da('0x4e'),auth[_0xb4da('0xa')](),controller['addWhatsappInteractions']);router[_0xb4da('0x31')]('/:id/fax_accounts',auth[_0xb4da('0xa')](),controller[_0xb4da('0x4f')]);router[_0xb4da('0x31')](_0xb4da('0x27'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x50')]);router[_0xb4da('0x31')](_0xb4da('0x29'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x51')]);router[_0xb4da('0x31')](_0xb4da('0x2a'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x52')]);router[_0xb4da('0x31')](_0xb4da('0x2b'),auth['isAuthenticated'](),controller[_0xb4da('0x53')]);router[_0xb4da('0x31')](_0xb4da('0x2d'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0xb4da('0x54'),auth['isAuthenticated'](),controller[_0xb4da('0x55')]);router[_0xb4da('0x31')]('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0xb4da('0x56')]);router['delete']('/:id/queues',auth[_0xb4da('0xa')](),controller[_0xb4da('0x57')]);router[_0xb4da('0x58')]('/:id/teams',auth[_0xb4da('0xa')](),controller[_0xb4da('0x59')]);router[_0xb4da('0x58')](_0xb4da('0xe'),auth['isAuthenticated'](),controller[_0xb4da('0x5a')]);router[_0xb4da('0x58')](_0xb4da('0x47'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x5b')]);router[_0xb4da('0x58')]('/:id/mail_interactions',auth[_0xb4da('0xa')](),controller[_0xb4da('0x5c')]);router[_0xb4da('0x58')](_0xb4da('0x4a'),auth['isAuthenticated'](),controller[_0xb4da('0x5d')]);router[_0xb4da('0x58')](_0xb4da('0x4b'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x5e')]);router[_0xb4da('0x58')]('/:id/openchannel_interactions',auth[_0xb4da('0xa')](),controller[_0xb4da('0x5f')]);router['delete'](_0xb4da('0x4e'),auth[_0xb4da('0xa')](),controller['removeWhatsappInteractions']);router[_0xb4da('0x58')](_0xb4da('0x25'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xb4da('0x58')](_0xb4da('0x27'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xb4da('0x58')]('/:id/openchannel_accounts',auth[_0xb4da('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xb4da('0xa')](),controller[_0xb4da('0x60')]);router[_0xb4da('0x58')](_0xb4da('0x2b'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x61')]);router[_0xb4da('0x58')](_0xb4da('0x2d'),auth['isAuthenticated'](),controller[_0xb4da('0x62')]);router[_0xb4da('0x58')](_0xb4da('0x54'),auth[_0xb4da('0xa')](),controller['removeSquareProjects']);router[_0xb4da('0x58')](_0xb4da('0x63'),auth[_0xb4da('0xa')](),controller[_0xb4da('0x64')]);module[_0xb4da('0x65')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 785613b..33e61db 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 _0xfd6c=['avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','encryption','force_avp','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','sequelize','moment','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','passive','update,nonat','showWebBar','wss'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xfd6c,0x12d));var _0xcfd6=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xfd6c[_0x236d24];return _0x1574cf;};'use strict';var Sequelize=require(_0xcfd6('0x0'));var moment=require(_0xcfd6('0x1'));var util=require('util');var _=require('lodash');module[_0xcfd6('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcfd6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2cf263){this[_0xcfd6('0x4')](_0xcfd6('0x3'),_0x2cf263);this[_0xcfd6('0x4')](_0xcfd6('0x5'),_0x2cf263);},'comment':_0xcfd6('0x6')},'fullname':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':![],'set':function(_0xf13a5){this[_0xcfd6('0x4')](_0xcfd6('0x8'),_0xf13a5);this['setDataValue'](_0xcfd6('0x9'),util['format'](_0xcfd6('0xa'),_0xf13a5,this[_0xcfd6('0xb')](_0xcfd6('0xc'))));}},'alias':{'type':Sequelize[_0xcfd6('0x7')]},'email':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x508089){if(_0x508089){this[_0xcfd6('0x4')](_0xcfd6('0xd'),_0x508089[_0xcfd6('0xe')]());}}},'role':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x10'),_0xcfd6('0x11'),_0xcfd6('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xcfd6('0x7')],'defaultValue':_0xcfd6('0x13')},'internal':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':![],'unique':_0xcfd6('0xc'),'set':function(_0x3e7bf7){this['setDataValue'](_0xcfd6('0xc'),_0x3e7bf7);this[_0xcfd6('0x4')]('accountcode',_0x3e7bf7);this[_0xcfd6('0x4')](_0xcfd6('0x9'),util[_0xcfd6('0x15')]('\x22%s\x22\x20<%s>',this[_0xcfd6('0xb')]('fullname'),_0x3e7bf7));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xcfd6('0x7')]},'mobile':{'type':Sequelize[_0xcfd6('0x7')]},'address':{'type':Sequelize[_0xcfd6('0x7')]},'zipcode':{'type':Sequelize[_0xcfd6('0x7')]},'userpic':{'type':Sequelize[_0xcfd6('0x7')]},'city':{'type':Sequelize[_0xcfd6('0x7')]},'country':{'type':Sequelize[_0xcfd6('0x7')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xcfd6('0x16')]},'voicePause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xcfd6('0x18')},'lastPauseAt':{'type':Sequelize[_0xcfd6('0x16')]},'chatCapacity':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xcfd6('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcfd6('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![],'defaultValue':_0xcfd6('0x19')},'ipaddr':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0xcfd6('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x1a'),'user',_0xcfd6('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![],'defaultValue':_0xcfd6('0x1c')},'callingpres':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x1d'),_0xcfd6('0x1e'),_0xcfd6('0x1f'),_0xcfd6('0x20'),_0xcfd6('0x21'),'PROHIB_PASSED_SCREEN',_0xcfd6('0x22'),_0xcfd6('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![],'defaultValue':_0xcfd6('0x24'),'set':function(_0x38ca31){this[_0xcfd6('0x4')](_0xcfd6('0x25'),_0x38ca31?_0x38ca31[_0xcfd6('0x26')](','):null);},'get':function(){return this[_0xcfd6('0xb')]('transport')?this[_0xcfd6('0xb')](_0xcfd6('0x25'))[_0xcfd6('0x27')](','):null;},'comment':_0xcfd6('0x28')},'dtmfmode':{'type':Sequelize[_0xcfd6('0xf')]('rfc2833',_0xcfd6('0x29'),_0xcfd6('0x2a'),_0xcfd6('0x2b'),_0xcfd6('0x2c')),'allowNull':!![],'defaultValue':_0xcfd6('0x2d')},'directmedia':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no',_0xcfd6('0x2f'),_0xcfd6('0x30'),_0xcfd6('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![],'defaultValue':_0xcfd6('0x32'),'set':function(_0x490d85){this[_0xcfd6('0x4')]('nat',_0x490d85?_0x490d85['join'](','):null);},'get':function(){return this[_0xcfd6('0xb')](_0xcfd6('0x33'))?this['getDataValue'](_0xcfd6('0x33'))[_0xcfd6('0x27')](','):null;},'comment':_0xcfd6('0x34')},'callgroup':{'type':Sequelize[_0xcfd6('0x7')]},'namedcallgroup':{'type':Sequelize[_0xcfd6('0x7')]},'pickupgroup':{'type':Sequelize[_0xcfd6('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xcfd6('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcfd6('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcfd6('0x35')},'allow':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3958e0){this[_0xcfd6('0x4')](_0xcfd6('0x36'),_0x3958e0?_0x3958e0[_0xcfd6('0x26')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xcfd6('0xb')](_0xcfd6('0x36'))?this[_0xcfd6('0xb')](_0xcfd6('0x36'))[_0xcfd6('0x27')](';'):null;},'comment':_0xcfd6('0x37')},'autoframing':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x551a97){this['setDataValue'](_0xcfd6('0x38'),_0x551a97?_0x551a97['join'](','):null);},'get':function(){return this[_0xcfd6('0xb')](_0xcfd6('0x38'))?this[_0xcfd6('0xb')](_0xcfd6('0x38'))[_0xcfd6('0x27')](','):null;},'comment':_0xcfd6('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0xcfd6('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcfd6('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no',_0xcfd6('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xcfd6('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![],'defaultValue':_0xcfd6('0x3b')},'amaflags':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xcfd6('0x2e')},'busylevel':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcfd6('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no',_0xcfd6('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcfd6('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x3d'),_0xcfd6('0x3e'),_0xcfd6('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x40'),_0xcfd6('0x41')),'allowNull':!![],'defaultValue':_0xcfd6('0x41')},'t38pt_usertpsource':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no',_0xcfd6('0x42'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xcfd6('0x43'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xcfd6('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no',_0xcfd6('0x2f'),'update',_0xcfd6('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcfd6('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0xcfd6('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xcfd6('0x7')]},'showWebBar':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0,'set':function(_0x303aa6){this[_0xcfd6('0x4')](_0xcfd6('0x45'),_0x303aa6);var _0x216057=this['get']({'plain':!![]});switch(_0x303aa6){case 0x0:case 0x1:var _0x58ea69=_0x216057['transport']?_['isArray'](_0x216057[_0xcfd6('0x25')])?_0x216057['transport'][_0xcfd6('0x26')]():_0x216057['transport']:'udp';if(_0x58ea69===_0xcfd6('0x46')){_0x58ea69=_0xcfd6('0x24');}this[_0xcfd6('0x4')]('transport',_0x58ea69);this[_0xcfd6('0x4')]('encryption','no');this[_0xcfd6('0x4')](_0xcfd6('0x47'),null);this['setDataValue']('force_avp',null);this[_0xcfd6('0x4')](_0xcfd6('0x48'),null);this[_0xcfd6('0x4')](_0xcfd6('0x49'),null);this[_0xcfd6('0x4')](_0xcfd6('0x4a'),null);this['setDataValue']('dtlssetup',null);this[_0xcfd6('0x4')](_0xcfd6('0x4b'),null);this[_0xcfd6('0x4')](_0xcfd6('0x4c'),null);this[_0xcfd6('0x4')]('rtcp_mux','no');break;case 0x2:this[_0xcfd6('0x4')](_0xcfd6('0x25'),_0xcfd6('0x46'));this[_0xcfd6('0x4')](_0xcfd6('0x4d'),_0xcfd6('0x2e'));this['setDataValue'](_0xcfd6('0x47'),_0xcfd6('0x2e'));this[_0xcfd6('0x4')](_0xcfd6('0x4e'),_0xcfd6('0x2e'));this[_0xcfd6('0x4')](_0xcfd6('0x48'),_0xcfd6('0x2e'));this['setDataValue'](_0xcfd6('0x49'),_0xcfd6('0x2e'));this[_0xcfd6('0x4')]('dtlsverify','no');this[_0xcfd6('0x4')](_0xcfd6('0x4f'),_0xcfd6('0x50'));this[_0xcfd6('0x4')](_0xcfd6('0x4b'),_0x216057[_0xcfd6('0x4b')]||_0xcfd6('0x51'));this['setDataValue'](_0xcfd6('0x4c'),_0x216057[_0xcfd6('0x4c')]||_0xcfd6('0x52'));this['setDataValue'](_0xcfd6('0x53'),_0xcfd6('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xcfd6('0x54')],'set':function(_0x1d2283){this[_0xcfd6('0x4')]('permissions',_0x1d2283?_0x1d2283[_0xcfd6('0x26')](','):[]);},'get':function(){return this[_0xcfd6('0xb')](_0xcfd6('0x55'))?_[_0xcfd6('0x56')](this['getDataValue'](_0xcfd6('0x55'))[_0xcfd6('0x27')](','),function(_0x1cc249){return parseInt(_0x1cc249,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcfd6('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcfd6('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcfd6('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcfd6('0xf')](_0xcfd6('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xcfd6('0xb')](_0xcfd6('0x57'))?this[_0xcfd6('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xcfd6('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcfd6('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![],'set':function(_0x3c4587){if(typeof _0x3c4587==='string'){var _0xe8dbcc=_0x3c4587==='1'?!![]:_0x3c4587==='0'?![]:_0x3c4587===_0xcfd6('0x58')?!![]:_0x3c4587===_0xcfd6('0x59')?![]:![];this[_0xcfd6('0x4')](_0xcfd6('0x5a'),_0xe8dbcc);}else{this[_0xcfd6('0x4')](_0xcfd6('0x5a'),_0x3c4587);}}},'blocked':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![],'set':function(_0x175c17){this['setDataValue']('blocked',_0x175c17);if(_0x175c17===!![]){this[_0xcfd6('0x4')](_0xcfd6('0x5b'),moment());this['setDataValue'](_0xcfd6('0x5c'),0x0);}else{this[_0xcfd6('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcfd6('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0x420e=['info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','split','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uas','fingerprint','certificate','active','passive','update,nonat','get','isArray','wss','encryption','avpf','force_avp','dtlscertfile','rtcp_mux','icesupport','dtlssetup','actpass','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','internal','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x3ebddd,_0x2d5641){var _0x72a382=function(_0x399960){while(--_0x399960){_0x3ebddd['push'](_0x3ebddd['shift']());}};_0x72a382(++_0x2d5641);}(_0x420e,0xe7));var _0xe420=function(_0x2971ae,_0x24ec22){_0x2971ae=_0x2971ae-0x0;var _0x50fc20=_0x420e[_0x2971ae];return _0x50fc20;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe420('0x0'));var util=require(_0xe420('0x1'));var _=require(_0xe420('0x2'));module[_0xe420('0x3')]={'name':{'type':Sequelize[_0xe420('0x4')],'allowNull':![],'unique':_0xe420('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5f2818){this[_0xe420('0x6')](_0xe420('0x5'),_0x5f2818);this['setDataValue'](_0xe420('0x7'),_0x5f2818);},'comment':_0xe420('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4011c1){this[_0xe420('0x6')](_0xe420('0x9'),_0x4011c1);this['setDataValue']('callerid',util[_0xe420('0xa')](_0xe420('0xb'),_0x4011c1,this[_0xe420('0xc')]('internal')));}},'alias':{'type':Sequelize[_0xe420('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x5ec295){if(_0x5ec295){this['setDataValue'](_0xe420('0xd'),_0x5ec295[_0xe420('0xe')]());}}},'role':{'type':Sequelize[_0xe420('0xf')]('admin',_0xe420('0x10'),_0xe420('0x11'),_0xe420('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe420('0x4')],'defaultValue':_0xe420('0x13')},'internal':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':![],'unique':_0xe420('0x15'),'set':function(_0x45b689){this[_0xe420('0x6')](_0xe420('0x15'),_0x45b689);this[_0xe420('0x6')](_0xe420('0x16'),_0x45b689);this[_0xe420('0x6')](_0xe420('0x17'),util[_0xe420('0xa')](_0xe420('0xb'),this[_0xe420('0xc')](_0xe420('0x9')),_0x45b689));}},'salt':{'type':Sequelize[_0xe420('0x4')]},'phone':{'type':Sequelize[_0xe420('0x4')]},'mobile':{'type':Sequelize[_0xe420('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xe420('0x4')]},'userpic':{'type':Sequelize[_0xe420('0x4')]},'city':{'type':Sequelize[_0xe420('0x4')]},'country':{'type':Sequelize[_0xe420('0x4')]},'online':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe420('0x19')]},'voicePause':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe420('0x4')],'defaultValue':_0xe420('0x1a')},'lastPauseAt':{'type':Sequelize[_0xe420('0x19')]},'chatCapacity':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe420('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe420('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe420('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x1b'),_0xe420('0x10'),_0xe420('0x1c')),'allowNull':!![],'defaultValue':_0xe420('0x1b')},'context':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![],'defaultValue':_0xe420('0x1d')},'callingpres':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x1e'),_0xe420('0x1f'),'ALLOWED_FAILED_SCREEN',_0xe420('0x20'),_0xe420('0x21'),_0xe420('0x22'),_0xe420('0x23'),_0xe420('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe420('0x25'),'set':function(_0x466e70){this['setDataValue'](_0xe420('0x26'),_0x466e70?_0x466e70[_0xe420('0x27')](','):null);},'get':function(){return this[_0xe420('0xc')](_0xe420('0x26'))?this[_0xe420('0xc')](_0xe420('0x26'))['split'](','):null;},'comment':_0xe420('0x28')},'dtmfmode':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x29'),_0xe420('0x2a'),_0xe420('0x2b'),_0xe420('0x2c'),'auto'),'allowNull':!![],'defaultValue':_0xe420('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no',_0xe420('0x2e'),_0xe420('0x2f'),_0xe420('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![],'defaultValue':_0xe420('0x31'),'set':function(_0x4d5d63){this['setDataValue'](_0xe420('0x32'),_0x4d5d63?_0x4d5d63['join'](','):null);},'get':function(){return this['getDataValue'](_0xe420('0x32'))?this[_0xe420('0xc')]('nat')[_0xe420('0x33')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe420('0x4')]},'namedcallgroup':{'type':Sequelize[_0xe420('0x4')]},'pickupgroup':{'type':Sequelize[_0xe420('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe420('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xe420('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe420('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1372d8){this['setDataValue'](_0xe420('0x34'),_0x1372d8?_0x1372d8[_0xe420('0x27')](';'):_0xe420('0x35'));},'get':function(){return this[_0xe420('0xc')](_0xe420('0x34'))?this[_0xe420('0xc')](_0xe420('0x34'))['split'](';'):null;},'comment':_0xe420('0x36')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![],'set':function(_0x23aabb){this[_0xe420('0x6')]('insecure',_0x23aabb?_0x23aabb[_0xe420('0x27')](','):null);},'get':function(){return this[_0xe420('0xc')](_0xe420('0x37'))?this[_0xe420('0xc')](_0xe420('0x37'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no',_0xe420('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe420('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![],'defaultValue':_0xe420('0x39')},'amaflags':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe420('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xe420('0x2d')},'busylevel':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe420('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe420('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x3a'),_0xe420('0x3b'),_0xe420('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xe420('0x3d')),'allowNull':!![],'defaultValue':_0xe420('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xe420('0x2d')},'keepalive':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe420('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xe420('0x3e'),_0xe420('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe420('0x40'),_0xe420('0x41'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xe420('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe420('0xf')](_0xe420('0x2d'),'no',_0xe420('0x2e'),'update',_0xe420('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe420('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe420('0x19')]},'passwordResetAt':{'type':Sequelize[_0xe420('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe420('0x4')]},'showWebBar':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0,'set':function(_0x20f580){this[_0xe420('0x6')]('showWebBar',_0x20f580);var _0x2af746=this[_0xe420('0x43')]({'plain':!![]});switch(_0x20f580){case 0x0:case 0x1:var _0xe21435=_0x2af746[_0xe420('0x26')]?_[_0xe420('0x44')](_0x2af746[_0xe420('0x26')])?_0x2af746[_0xe420('0x26')][_0xe420('0x27')]():_0x2af746[_0xe420('0x26')]:'udp';if(_0xe21435===_0xe420('0x45')){_0xe21435=_0xe420('0x25');}this[_0xe420('0x6')](_0xe420('0x26'),_0xe21435);this['setDataValue'](_0xe420('0x46'),'no');this['setDataValue'](_0xe420('0x47'),null);this['setDataValue'](_0xe420('0x48'),null);this[_0xe420('0x6')]('icesupport',null);this[_0xe420('0x6')]('dtlsenable',null);this[_0xe420('0x6')]('dtlsverify',null);this[_0xe420('0x6')]('dtlssetup',null);this[_0xe420('0x6')](_0xe420('0x49'),null);this[_0xe420('0x6')]('dtlsprivatekey',null);this[_0xe420('0x6')](_0xe420('0x4a'),'no');break;case 0x2:this[_0xe420('0x6')](_0xe420('0x26'),_0xe420('0x45'));this[_0xe420('0x6')](_0xe420('0x46'),_0xe420('0x2d'));this[_0xe420('0x6')](_0xe420('0x47'),'yes');this[_0xe420('0x6')](_0xe420('0x48'),_0xe420('0x2d'));this[_0xe420('0x6')](_0xe420('0x4b'),_0xe420('0x2d'));this['setDataValue']('dtlsenable',_0xe420('0x2d'));this[_0xe420('0x6')]('dtlsverify','no');this[_0xe420('0x6')](_0xe420('0x4c'),_0xe420('0x4d'));this[_0xe420('0x6')](_0xe420('0x49'),_0x2af746[_0xe420('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0xe420('0x6')](_0xe420('0x4e'),_0x2af746['dtlsprivatekey']||_0xe420('0x4f'));this[_0xe420('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xe420('0x50')],'set':function(_0x458903){this[_0xe420('0x6')](_0xe420('0x51'),_0x458903?_0x458903[_0xe420('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0xe420('0x51'))?_[_0xe420('0x52')](this['getDataValue']('permissions')['split'](','),function(_0x2cc2bb){return parseInt(_0x2cc2bb,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe420('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe420('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe420('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe420('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe420('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe420('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe420('0x53')],'get':function(){return this['getDataValue'](_0xe420('0x54'))?this[_0xe420('0xc')](_0xe420('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe420('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe420('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![],'set':function(_0x612b6b){if(typeof _0x612b6b==='string'){var _0x8126db=_0x612b6b==='1'?!![]:_0x612b6b==='0'?![]:_0x612b6b===_0xe420('0x55')?!![]:_0x612b6b===_0xe420('0x56')?![]:![];this['setDataValue'](_0xe420('0x57'),_0x8126db);}else{this[_0xe420('0x6')]('screenrecording',_0x612b6b);}}},'blocked':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![],'set':function(_0x23e082){this[_0xe420('0x6')](_0xe420('0x58'),_0x23e082);if(_0x23e082===!![]){this[_0xe420('0x6')]('blockedAt',moment());this[_0xe420('0x6')](_0xe420('0x59'),0x0);}else{this[_0xe420('0x6')](_0xe420('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xe420('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe420('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe420('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3889172..0a2226f 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 _0xeeb8=['getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','loginInPause','format','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','upsert','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','concat','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','QueuePause','manual','mail','chat','fax','sms','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','Voice','Chat','getMailQueues','setDataValue','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','getDataValue','QueueId','removeTeams','getChatQueues','Mail','getWhatsappQueues','Openchannel','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$contains','$any','firstName','lastName','dialActive','getApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','zip-dir','moment','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','get','role','admin','Users','user','Agents','ignore','map','value','includes','UserProfileResource','stack','name','index','User','rawAttributes','fieldName','type','key','differenceBy','password','salt','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','sequelize','lower','filter','options','count','includeAll','include','findAll','rows','catch','params','find','update','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','mailbox','fullname','email','agent','permissions','101','103','113','104','105','107','108','109','100','111','114','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','Telephones','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','push','all','each','telephone','isEmpty','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','emit','Queue:save','voice','VoiceQueue','SIP/%s','UserVoiceQueueRt','removeQueues','remove','Queue:remove','file','getAvatar','join','root','userpic','download','existsSync','server/files/images/','getContacts','CmContact','order','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId'];(function(_0x158b3a,_0x2b4206){var _0x9e7c81=function(_0x368ae8){while(--_0x368ae8){_0x158b3a['push'](_0x158b3a['shift']());}};_0x9e7c81(++_0x2b4206);}(_0xeeb8,0xab));var _0x8eeb=function(_0x10fa07,_0x5d39a0){_0x10fa07=_0x10fa07-0x0;var _0x2faba2=_0xeeb8[_0x10fa07];return _0x2faba2;};'use strict';var pdf=require(_0x8eeb('0x0'));var emlformat=require(_0x8eeb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eeb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8eeb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8eeb('0x4'));var util=require(_0x8eeb('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8eeb('0x6'));var ejs=require(_0x8eeb('0x7'));var fs=require('fs');var _=require(_0x8eeb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8eeb('0x9'));var deskjs=require(_0x8eeb('0xa'));var toCsv=require(_0x8eeb('0x6'));var querystring=require(_0x8eeb('0xb'));var Papa=require(_0x8eeb('0xc'));var Redis=require(_0x8eeb('0xd'));var authService=require(_0x8eeb('0xe'));var qs=require(_0x8eeb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eeb('0x10'));var logger=require(_0x8eeb('0x11'))(_0x8eeb('0x12'));var utils=require('../../config/utils');var config=require(_0x8eeb('0x13'));var licenseUtil=require(_0x8eeb('0x14'));var db=require(_0x8eeb('0x15'))['db'];config[_0x8eeb('0x16')]=_['defaults'](config[_0x8eeb('0x16')],{'host':_0x8eeb('0x17'),'port':0x18eb});var socket=require(_0x8eeb('0x18'))(new Redis(config['redis']));require(_0x8eeb('0x19'))[_0x8eeb('0x1a')](socket);var jayson=require(_0x8eeb('0x1b'));var client=jayson[_0x8eeb('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d63a5,_0x13103a,_0x3f3090,_0x32f689){return new BPromise(function(_0x4ef25c,_0x182b05){var _0x477905=_0x32f689||client;return _0x477905[_0x8eeb('0x1d')](_0x1d63a5,_0x3f3090)[_0x8eeb('0x1e')](function(_0x2be153){logger['info'](_0x8eeb('0x1f'),_0x13103a,_0x8eeb('0x20'));logger[_0x8eeb('0x21')](_0x8eeb('0x22'),_0x13103a,_0x8eeb('0x20'),JSON['stringify'](_0x2be153));if(_0x2be153[_0x8eeb('0x23')]){if(_0x2be153['error'][_0x8eeb('0x24')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x13103a,_0x2be153[_0x8eeb('0x23')][_0x8eeb('0x25')]);return _0x182b05(_0x2be153[_0x8eeb('0x23')][_0x8eeb('0x25')]);}logger[_0x8eeb('0x23')]('User,\x20%s,\x20%s',_0x13103a,_0x2be153[_0x8eeb('0x23')]['message']);return _0x4ef25c(_0x2be153[_0x8eeb('0x23')][_0x8eeb('0x25')]);}else{logger[_0x8eeb('0x26')](_0x8eeb('0x1f'),_0x13103a,'request\x20sent');_0x4ef25c(_0x2be153[_0x8eeb('0x27')][_0x8eeb('0x25')]);}})['catch'](function(_0x10196b){logger[_0x8eeb('0x23')](_0x8eeb('0x1f'),_0x13103a,_0x10196b);_0x182b05(_0x10196b);});});}function respondWithStatusCode(_0x71fbea,_0x14dcd9){_0x14dcd9=_0x14dcd9||0xcc;return function(_0x45d603){if(_0x45d603){return _0x71fbea['sendStatus'](_0x14dcd9);}return _0x71fbea[_0x8eeb('0x28')](_0x14dcd9)[_0x8eeb('0x29')]();};}function respondWithResult(_0x22c3e2,_0x4a2c68){_0x4a2c68=_0x4a2c68||0xc8;return function(_0x393d28){if(_0x393d28){return _0x22c3e2['status'](_0x4a2c68)[_0x8eeb('0x2a')](_0x393d28);}};}function respondWithFilteredResult(_0x12b653,_0x5511dc){return function(_0x5e4a5e){if(_0x5e4a5e){var _0x3057a2=_0x5e4a5e['count'],_0x206c70=_0x5511dc['offset'],_0x2246c4=_0x5511dc[_0x8eeb('0x2b')]+_0x5511dc[_0x8eeb('0x2c')],_0x333ee9;if(_0x2246c4>=_0x3057a2){_0x2246c4=_0x3057a2;_0x333ee9=0xc8;}else{_0x333ee9=0xce;}_0x12b653['status'](_0x333ee9);return _0x12b653[_0x8eeb('0x2d')](_0x8eeb('0x2e'),_0x206c70+'-'+_0x2246c4+'/'+_0x3057a2)[_0x8eeb('0x2a')](_0x5e4a5e);}return null;};}function patchUpdates(_0xb0a1e){return function(_0xe7de69){try{jsonpatch['apply'](_0xe7de69,_0xb0a1e,!![]);}catch(_0x1998f4){return BPromise[_0x8eeb('0x2f')](_0x1998f4);}return _0xe7de69[_0x8eeb('0x30')]();};}function saveUpdates(_0x53069c,_0x5b2997){return function(_0x18425a){if(_0x18425a){return _0x18425a['update'](_0x53069c)[_0x8eeb('0x1e')](function(_0x5ed416){return _0x5ed416;});}return null;};}function removeEntity(_0x35a2fe,_0x56a3f7){return function(_0xbb0943){if(_0xbb0943){return _0xbb0943[_0x8eeb('0x31')]()['then'](function(){var _0xd511e8=_0xbb0943[_0x8eeb('0x32')]({'plain':!![]});if(_0xd511e8[_0x8eeb('0x33')]===_0x8eeb('0x34'))return;var _0x1830ea=[{'name':_0x8eeb('0x35'),'value':_0x8eeb('0x36'),'ignore':!![]},{'name':_0x8eeb('0x37'),'value':'agent','ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x3914d4=_(_0x1830ea)['filter'](_0x8eeb('0x38'))[_0x8eeb('0x39')](_0x8eeb('0x3a'))[_0x8eeb('0x3a')]();if(_[_0x8eeb('0x3b')](_0x3914d4,_0xd511e8[_0x8eeb('0x33')])){return;}var _0x1481fd=_['find'](_0x1830ea,['value',_0xd511e8[_0x8eeb('0x33')]])['name'];return db[_0x8eeb('0x3c')][_0x8eeb('0x31')]({'where':{'type':_0x1481fd,'resourceId':_0xd511e8['id']}})['then'](function(){return _0xbb0943;});})[_0x8eeb('0x1e')](function(){_0x35a2fe[_0x8eeb('0x28')](0xcc)[_0x8eeb('0x29')]();});}};}function handleEntityNotFound(_0x2b0c94,_0x121361){return function(_0x45b1da){if(!_0x45b1da){_0x2b0c94['sendStatus'](0x194);}return _0x45b1da;};}function handleError(_0x1aae74,_0x4fe497){_0x4fe497=_0x4fe497||0x1f4;return function(_0x24be1a){logger[_0x8eeb('0x23')](_0x24be1a[_0x8eeb('0x3d')]);if(_0x24be1a[_0x8eeb('0x3e')]){delete _0x24be1a[_0x8eeb('0x3e')];}_0x1aae74[_0x8eeb('0x28')](_0x4fe497)['send'](_0x24be1a);};}exports[_0x8eeb('0x3f')]=function(_0x1231fd,_0xf27725){var _0x3d3150={},_0x24233b={},_0x2c1c8a={'count':0x0,'rows':[]};var _0x36f8b4=_[_0x8eeb('0x39')](db[_0x8eeb('0x40')][_0x8eeb('0x41')],function(_0x77c4bd){return{'name':_0x77c4bd[_0x8eeb('0x42')],'type':_0x77c4bd[_0x8eeb('0x43')][_0x8eeb('0x44')]};});_0x24233b['model']=_[_0x8eeb('0x45')](_['map'](_0x36f8b4,'name'),[_0x8eeb('0x46'),_0x8eeb('0x47')]);_0x24233b['query']=_[_0x8eeb('0x48')](_0x1231fd[_0x8eeb('0x49')]);_0x24233b['filters']=_[_0x8eeb('0x4a')](_0x24233b[_0x8eeb('0x4b')],_0x24233b[_0x8eeb('0x49')]);_0x3d3150['attributes']=_['intersection'](_0x24233b[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x1231fd['query'][_0x8eeb('0x4c')]));_0x3d3150[_0x8eeb('0x4d')]=_0x3d3150[_0x8eeb('0x4d')]['length']?_0x3d3150[_0x8eeb('0x4d')]:_0x24233b['model'];if(!_0x1231fd[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x3d3150['limit']=qs[_0x8eeb('0x2c')](_0x1231fd['query'][_0x8eeb('0x2c')]);_0x3d3150[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0x1231fd[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}_0x3d3150['order']=qs[_0x8eeb('0x50')](_0x1231fd[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x3d3150['where']=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x1231fd[_0x8eeb('0x49')],_0x24233b[_0x8eeb('0x51')]),_0x36f8b4);if(_0x1231fd[_0x8eeb('0x49')]['filter']){_0x3d3150[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x3d3150[_0x8eeb('0x53')],{'$or':_[_0x8eeb('0x39')](_0x36f8b4,function(_0x33aafb){if(_0x33aafb['type']!==_0x8eeb('0x55')){return db[_0x8eeb('0x56')][_0x8eeb('0x53')](db[_0x8eeb('0x56')]['fn'](_0x8eeb('0x57'),db[_0x8eeb('0x56')]['col'](_0x33aafb[_0x8eeb('0x3e')])),{'$like':db[_0x8eeb('0x56')]['fn'](_0x8eeb('0x57'),'%'+_0x1231fd[_0x8eeb('0x49')][_0x8eeb('0x58')]+'%')});}})});}_0x3d3150=_[_0x8eeb('0x54')]({},_0x3d3150,_0x1231fd[_0x8eeb('0x59')]);var _0x14587a={'where':_0x3d3150[_0x8eeb('0x53')]};return db[_0x8eeb('0x40')][_0x8eeb('0x5a')](_0x14587a)[_0x8eeb('0x1e')](function(_0x23c605){_0x2c1c8a[_0x8eeb('0x5a')]=_0x23c605;if(_0x1231fd[_0x8eeb('0x49')][_0x8eeb('0x5b')]){_0x3d3150[_0x8eeb('0x5c')]=[{'all':!![]}];}return db['User'][_0x8eeb('0x5d')](_0x3d3150);})[_0x8eeb('0x1e')](function(_0x23b4fc){_0x2c1c8a[_0x8eeb('0x5e')]=_0x23b4fc;return _0x2c1c8a;})['then'](respondWithFilteredResult(_0xf27725,_0x3d3150))[_0x8eeb('0x5f')](handleError(_0xf27725,null));};exports['show']=function(_0x59f791,_0x14ee86){var _0x322444={'raw':![],'where':{'id':_0x59f791[_0x8eeb('0x60')]['id']}},_0x11f3ab={};_0x11f3ab[_0x8eeb('0x4b')]=_[_0x8eeb('0x45')](_['keys'](db[_0x8eeb('0x40')]['rawAttributes']),[_0x8eeb('0x46'),_0x8eeb('0x47')]);_0x11f3ab[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x59f791[_0x8eeb('0x49')]);_0x11f3ab[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x11f3ab[_0x8eeb('0x4b')],_0x11f3ab[_0x8eeb('0x49')]);_0x322444[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x11f3ab[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x59f791[_0x8eeb('0x49')]['fields']));_0x322444[_0x8eeb('0x4d')]=_0x322444[_0x8eeb('0x4d')]['length']?_0x322444['attributes']:_0x11f3ab[_0x8eeb('0x4b')];if(_0x59f791[_0x8eeb('0x49')][_0x8eeb('0x5b')]){_0x322444['include']=[{'all':!![]}];}_0x322444=_['merge']({},_0x322444,_0x59f791[_0x8eeb('0x59')]);return db[_0x8eeb('0x40')][_0x8eeb('0x61')](_0x322444)[_0x8eeb('0x1e')](handleEntityNotFound(_0x14ee86,null))['then'](respondWithResult(_0x14ee86,null))['catch'](handleError(_0x14ee86,null));};exports[_0x8eeb('0x62')]=function(_0x18585a,_0x4200f5){if(_0x18585a['body']['id']){delete _0x18585a[_0x8eeb('0x63')]['id'];}delete _0x18585a[_0x8eeb('0x63')][_0x8eeb('0x33')];return db[_0x8eeb('0x40')][_0x8eeb('0x61')]({'where':{'id':_0x18585a[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x4200f5,null))[_0x8eeb('0x1e')](saveUpdates(_0x18585a[_0x8eeb('0x63')],null))['then'](respondWithResult(_0x4200f5,null))[_0x8eeb('0x5f')](handleError(_0x4200f5,null));};exports[_0x8eeb('0x64')]=function(_0x2bc5a3,_0x3ec81b){return db[_0x8eeb('0x40')][_0x8eeb('0x64')]()['then'](respondWithResult(_0x3ec81b,null))[_0x8eeb('0x5f')](handleError(_0x3ec81b,null));};exports[_0x8eeb('0x65')]=function(_0x230859,_0x49999e,_0xa9cc1){return db[_0x8eeb('0x40')][_0x8eeb('0x61')]({'where':{'id':_0x230859['params']['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x49999e,null))[_0x8eeb('0x1e')](function(_0x140b7e){if(_0x140b7e){return _0x140b7e[_0x8eeb('0x65')](_0x230859[_0x8eeb('0x63')]['ids'],_[_0x8eeb('0x66')](_0x230859[_0x8eeb('0x63')],[_0x8eeb('0x67'),'id'])||{});}})[_0x8eeb('0x1e')](respondWithResult(_0x49999e,null))[_0x8eeb('0x5f')](handleError(_0x49999e,null));};function validateUser(_0x498ed8){return new BPromise(function(_0x38957d,_0x4b7411){if(_0x498ed8[_0x8eeb('0x68')])return _0x38957d(_0x498ed8);return db[_0x8eeb('0x69')][_0x8eeb('0x6a')](0x1)[_0x8eeb('0x1e')](function(_0x4dd893){if(_0x4dd893[_0x8eeb('0x6b')])authService[_0x8eeb('0x6c')](_0x498ed8[_0x8eeb('0x46')]);db[_0x8eeb('0x40')][_0x8eeb('0x6d')]('internal')[_0x8eeb('0x1e')](function(_0x458bea){if(_[_0x8eeb('0x6e')](_0x458bea)){_0x498ed8[_0x8eeb('0x68')]=_0x4dd893[_0x8eeb('0x6f')]||0x1;return;}if(_['isNil'](_0x4dd893['min_internal'])||_0x4dd893[_0x8eeb('0x6f')]===_0x458bea){_0x498ed8['internal']=_0x458bea+0x1;return;}if(_0x4dd893[_0x8eeb('0x6f')]>_0x458bea){_0x498ed8[_0x8eeb('0x68')]=_0x4dd893[_0x8eeb('0x6f')];return;}return db[_0x8eeb('0x56')]['query'](_0x8eeb('0x70'),{'type':db[_0x8eeb('0x56')][_0x8eeb('0x71')][_0x8eeb('0x72')]})[_0x8eeb('0x1e')](function(_0x5f9c1a){if(_0x5f9c1a&&_0x5f9c1a['length']){for(var _0x2a3dff=0x0,_0x2153dc=_0x5f9c1a[_0x8eeb('0x73')];_0x2a3dff<_0x2153dc&&_[_0x8eeb('0x6e')](_0x498ed8[_0x8eeb('0x68')]);_0x2a3dff++){if(_0x4dd893[_0x8eeb('0x6f')]<=_0x5f9c1a[_0x2a3dff]['from']){_0x498ed8[_0x8eeb('0x68')]=_0x5f9c1a[_0x2a3dff][_0x8eeb('0x74')];}else if(_0x4dd893[_0x8eeb('0x6f')]>_0x5f9c1a[_0x2a3dff][_0x8eeb('0x74')]&&_0x4dd893[_0x8eeb('0x6f')]<=_0x5f9c1a[_0x2a3dff]['to']){_0x498ed8[_0x8eeb('0x68')]=_0x4dd893[_0x8eeb('0x6f')];}}}if(_['isNil'](_0x498ed8['internal'])){_0x498ed8[_0x8eeb('0x68')]=_0x458bea+0x1;}return _0x38957d(_0x498ed8);});});})[_0x8eeb('0x5f')](function(_0x23f6a8){_0x4b7411(_0x23f6a8);});});}function updateUser(_0x266c73){return new BPromise(function(_0x29c112,_0x1a4bfe){try{if(_0x266c73['voicemail']){_0x266c73[_0x8eeb('0x75')]=_0x266c73['internal'];_0x266c73['VoiceMail']={'mailbox':_0x266c73[_0x8eeb('0x68')],'password':_0x266c73[_0x8eeb('0x46')],'fullname':_0x266c73[_0x8eeb('0x76')],'email':_0x266c73[_0x8eeb('0x77')]};}if(_0x266c73[_0x8eeb('0x33')]===_0x8eeb('0x78')){if(!_0x266c73['permissions'])_0x266c73[_0x8eeb('0x79')]=[_0x8eeb('0x7a'),'102',_0x8eeb('0x7b'),_0x8eeb('0x7c'),'110',_0x8eeb('0x7d'),_0x8eeb('0x7e'),'106',_0x8eeb('0x7f'),_0x8eeb('0x80'),_0x8eeb('0x81'),_0x8eeb('0x82'),_0x8eeb('0x83'),_0x8eeb('0x84')];}_0x29c112(_0x266c73);}catch(_0x44af25){_0x1a4bfe(_0x44af25);}});}exports['create']=function(_0x136dfb,_0x24f9fc){if(_0x136dfb[_0x8eeb('0x36')]['role']==='agent')throw new Error(_0x8eeb('0x85'));if(_0x136dfb['body']['role']===_0x8eeb('0x36')&&_0x136dfb[_0x8eeb('0x36')][_0x8eeb('0x33')]!==_0x8eeb('0x34')){throw new Error(_0x8eeb('0x86'));}if(_0x136dfb['body'][_0x8eeb('0x33')]===_0x8eeb('0x34')&&_0x136dfb[_0x8eeb('0x36')]['role']!==_0x8eeb('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x8eeb('0x87')]([_0x136dfb[_0x8eeb('0x63')]])[_0x8eeb('0x1e')](function(){return validateUser(_0x136dfb[_0x8eeb('0x63')]);})['then'](function(_0xe70a47){return updateUser(_0xe70a47)[_0x8eeb('0x1e')](function(_0x520380){if(_0x520380[_0x8eeb('0x33')]==='admin'){_0x520380[_0x8eeb('0x88')]=_0x136dfb[_0x8eeb('0x36')][_0x8eeb('0x88')];delete _0x520380[_0x8eeb('0x89')];}return _0x520380;});})[_0x8eeb('0x1e')](function(_0x21eb62){return db[_0x8eeb('0x40')]['create'](_0x21eb62,{'include':[{'model':db[_0x8eeb('0x8a')],'as':_0x8eeb('0x8a')}]});})['then'](function(_0x1842ee){if(_0x136dfb['body'][_0x8eeb('0x33')]===_0x8eeb('0x36'))return _0x1842ee;if(_0x136dfb[_0x8eeb('0x36')][_0x8eeb('0x33')]!=='user')return _0x1842ee;return db['UserProfileSection'][_0x8eeb('0x61')]({'where':{'name':_0x1842ee[_0x8eeb('0x33')]===_0x8eeb('0x78')?_0x8eeb('0x37'):_0x8eeb('0x8b'),'userProfileId':_0x136dfb[_0x8eeb('0x36')][_0x8eeb('0x89')]},'raw':!![]})[_0x8eeb('0x1e')](function(_0x3ad4a4){if(!_0x3ad4a4||_0x3ad4a4[_0x8eeb('0x8c')]!=0x0)return _0x1842ee;return db[_0x8eeb('0x3c')][_0x8eeb('0x8d')]({'name':_0x1842ee[_0x8eeb('0x3e')],'resourceId':_0x1842ee['id'],'type':_0x3ad4a4[_0x8eeb('0x3e')],'sectionId':_0x3ad4a4['id']},{})[_0x8eeb('0x1e')](function(){return _0x1842ee;});})[_0x8eeb('0x5f')](function(_0x12353b){logger[_0x8eeb('0x23')](_0x8eeb('0x8e'),_0x12353b);throw _0x12353b;});})[_0x8eeb('0x1e')](respondWithResult(_0x24f9fc,0xc9))['catch'](handleError(_0x24f9fc,null));};exports['bulkCreate']=function(_0x5288fd,_0xf1c08d){var _0x48b152=_0x5288fd[_0x8eeb('0x63')];var _0x25d892=[];if(_0x5288fd[_0x8eeb('0x36')][_0x8eeb('0x33')]===_0x8eeb('0x78'))throw new Error('Unauthorized');if(_[_0x8eeb('0x8f')](_0x48b152,[_0x8eeb('0x33'),_0x8eeb('0x36')])&&_0x5288fd['user'][_0x8eeb('0x33')]!=='admin'){throw new Error(_0x8eeb('0x86'));}if(_[_0x8eeb('0x8f')](_0x48b152,[_0x8eeb('0x33'),_0x8eeb('0x34')])&&_0x5288fd[_0x8eeb('0x36')]['role']!==_0x8eeb('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x8eeb('0x87')](_0x48b152)[_0x8eeb('0x1e')](function(){return validateUser(_0x48b152[0x0]);})[_0x8eeb('0x1e')](function(){for(var _0x3d932f=0x1;_0x3d932f<_0x48b152[_0x8eeb('0x73')];_0x3d932f++){var _0xc64f1a=_0x48b152[_0x3d932f-0x1][_0x8eeb('0x68')];if(!_0x48b152[_0x3d932f]['internal'])_0x48b152[_0x3d932f][_0x8eeb('0x68')]=_0xc64f1a+0x1;_0x25d892[_0x8eeb('0x90')](validateUser(_0x48b152[_0x3d932f]));}return BPromise['all'](_0x25d892);})['then'](function(){_0x25d892=[];for(var _0x434d87=0x0;_0x434d87<_0x48b152[_0x8eeb('0x73')];_0x434d87++){_0x25d892['push'](updateUser(_0x48b152[_0x434d87]));}return BPromise[_0x8eeb('0x91')](_0x25d892);})[_0x8eeb('0x1e')](function(){return BPromise[_0x8eeb('0x92')](_0x48b152,function(_0x1f46b3){return db['User'][_0x8eeb('0x8d')](_0x1f46b3,{'include':[{'model':db[_0x8eeb('0x8a')],'as':_0x8eeb('0x8a')}]})[_0x8eeb('0x1e')](function(_0x2aeb22){_0x1f46b3['id']=_0x2aeb22['id'];return _0x1f46b3;});});})[_0x8eeb('0x1e')](function(_0x132764){if(_0x5288fd[_0x8eeb('0x63')]['role']===_0x8eeb('0x36'))return _0x132764;if(_0x5288fd[_0x8eeb('0x36')][_0x8eeb('0x33')]!==_0x8eeb('0x36'))return _0x132764;var _0x1e5419=_[_0x8eeb('0x8f')](_0x132764,function(_0x23dee6){return _0x23dee6[_0x8eeb('0x33')]===_0x8eeb('0x78')||_0x23dee6[_0x8eeb('0x33')]===_0x8eeb('0x93');});if(!_0x1e5419)return _0x132764;return db['UserProfileSection'][_0x8eeb('0x5d')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x5288fd[_0x8eeb('0x36')][_0x8eeb('0x89')]},'raw':!![]})['then'](function(_0xd80794){if(_[_0x8eeb('0x94')](_0xd80794)||!_['some'](_0xd80794,[_0x8eeb('0x8c'),0x0]))return _0x132764;_0x25d892=[];var _0x57ffb5=_(_0xd80794)['map'](function(_0x1d673e){if(_0x1d673e[_0x8eeb('0x8c')]===0x1)return;return _0x1d673e['name']===_0x8eeb('0x37')?'agent':_0x8eeb('0x93');})['compact']()[_0x8eeb('0x3a')]();for(var _0x1f81a5=0x0;_0x1f81a5<_0x132764[_0x8eeb('0x73')];_0x1f81a5++){if(!_[_0x8eeb('0x3b')](_0x57ffb5,_0x132764[_0x1f81a5][_0x8eeb('0x33')]))return;var _0x3ea8cb=_0x132764[_0x1f81a5][_0x8eeb('0x33')]===_0x8eeb('0x78')?'Agents':_0x8eeb('0x8b');_0x25d892[_0x8eeb('0x90')](db[_0x8eeb('0x3c')][_0x8eeb('0x8d')]({'name':_0x132764[_0x1f81a5][_0x8eeb('0x3e')],'resourceId':_0x132764[_0x1f81a5]['id'],'type':_0x3ea8cb,'sectionId':_[_0x8eeb('0x61')](_0xd80794,[_0x8eeb('0x3e'),_0x3ea8cb])['id']},{}));}return BPromise[_0x8eeb('0x91')](_0x25d892);})[_0x8eeb('0x1e')](respondWithResult(_0xf1c08d,0xc9))[_0x8eeb('0x5f')](handleError(_0xf1c08d,null));});};exports[_0x8eeb('0x95')]=function(_0x5e8543,_0x302fe7,_0x58ac5b){if(_0x5e8543[_0x8eeb('0x63')]['id']){delete _0x5e8543[_0x8eeb('0x63')]['id'];}return db[_0x8eeb('0x40')][_0x8eeb('0x61')]({'where':{'id':_0x5e8543['params']['id']}})[_0x8eeb('0x1e')](function(_0x360174){if(!_0x360174)return null;if(_0x360174['id']===_0x5e8543[_0x8eeb('0x36')]['id']){if(!_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x96')]||!_0x5e8543['body'][_0x8eeb('0x97')]){throw new db[(_0x8eeb('0x98'))][(_0x8eeb('0x99'))](_0x8eeb('0x9a'));}if(!_0x360174['authenticate'](_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x96')])){throw new db[(_0x8eeb('0x98'))]['ValidationError']('Wrong\x20credentials');}if(_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x96')]===_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x97')]){throw new db[(_0x8eeb('0x98'))][(_0x8eeb('0x99'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5e8543[_0x8eeb('0x36')][_0x8eeb('0x33')]===_0x8eeb('0x34')){if(!_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x97')]){throw new db[(_0x8eeb('0x98'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5e8543['user'][_0x8eeb('0x33')]==='user'){if(!_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x97')]){throw new db[(_0x8eeb('0x98'))][(_0x8eeb('0x99'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x360174[_0x8eeb('0x33')]!==_0x8eeb('0x78')){throw new db['Sequelize'][(_0x8eeb('0x99'))]('Unauthorized');}}else{throw new db[(_0x8eeb('0x98'))][(_0x8eeb('0x99'))]('Unauthorized');}return _0x360174;})['then'](handleEntityNotFound(_0x302fe7,null))[_0x8eeb('0x1e')](function(_0x27aef7){return db[_0x8eeb('0x69')][_0x8eeb('0x9b')]({'attributes':['id',_0x8eeb('0x6b'),_0x8eeb('0x9c'),_0x8eeb('0x9d')]})['then'](function(_0x12139a){if(_0x12139a[_0x8eeb('0x6b')])authService[_0x8eeb('0x6c')](_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x97')]);if(!_0x12139a[_0x8eeb('0x9c')]||!_0x27aef7[_0x8eeb('0x9e')])return _0x27aef7;authService[_0x8eeb('0x9f')](_0x5e8543[_0x8eeb('0x63')][_0x8eeb('0x97')],_0x27aef7[_0x8eeb('0x9e')],_0x12139a[_0x8eeb('0x9d')]);return _0x27aef7;})['then'](saveUpdates({'password':_0x5e8543['body'][_0x8eeb('0x97')],'passwordResetAt':_0x5e8543[_0x8eeb('0x36')]['id']==_0x5e8543[_0x8eeb('0x60')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x5e8543['body']['newPassword'],_0x27aef7['previousPasswords'])},null));})['then'](respondWithResult(_0x302fe7,null))[_0x8eeb('0x5f')](handleError(_0x302fe7,null));};exports[_0x8eeb('0xa0')]=function(_0x413084,_0x591965,_0x5f3b13){var _0x33203b=_0x413084[_0x8eeb('0x63')][_0x8eeb('0xa1')];return db[_0x8eeb('0x40')]['find']({'where':{'id':_0x413084['params']['id']},'attributes':['id','name',_0x8eeb('0x33'),_0x8eeb('0xa2'),'loginInPause',_0x8eeb('0xa3'),_0x8eeb('0xa4')]})['then'](handleEntityNotFound(_0x591965,null))[_0x8eeb('0x1e')](function(_0x25704a){if(_0x25704a){if(!utils[_0x8eeb('0xa5')](_0x33203b)){throw new db['Sequelize'][(_0x8eeb('0x99'))](_0x8eeb('0xa6'));}return _0x25704a[_0x8eeb('0xa7')+_[_0x8eeb('0xa8')](_0x33203b[_0x8eeb('0xa9')]())+_0x8eeb('0xaa')](_0x413084[_0x8eeb('0x63')][_0x8eeb('0x67')],{'penalty':_0x413084['body'][_0x8eeb('0xab')]||0x0})['spread'](function(_0x58b1ae){for(var _0x3c22cd=0x0;_0x3c22cd<_0x413084[_0x8eeb('0x63')][_0x8eeb('0x67')][_0x8eeb('0x73')];_0x3c22cd+=0x1){var _0x364602={'UserId':_0x413084[_0x8eeb('0x60')]['id']};_0x364602[_['capitalize'](_0x33203b[_0x8eeb('0xa9')]())+'QueueId']=_0x413084[_0x8eeb('0x63')][_0x8eeb('0x67')][_0x3c22cd];socket[_0x8eeb('0xac')](_0x8eeb('0x36')+_[_0x8eeb('0xa8')](_0x33203b[_0x8eeb('0xa9')]())+_0x8eeb('0xad'),_0x364602);}return _0x58b1ae;})['then'](function(){if(_0x33203b===_0x8eeb('0xae')){return db[_0x8eeb('0xaf')][_0x8eeb('0x5d')]({'where':{'id':_0x413084['body'][_0x8eeb('0x67')]||[]},'raw':!![],'attributes':['id',_0x8eeb('0x3e')]});}})[_0x8eeb('0x1e')](function(_0x5c589e){var _0x2c73af=_0x25704a['get']({'plain':!![]});var _0x2cb7c4=[];if(_0x33203b===_0x8eeb('0xae')&&_0x2c73af[_0x8eeb('0x33')]===_0x8eeb('0x78')&&_0x2c73af[_0x8eeb('0xa2')]){for(var _0x58dc32=0x0;_0x58dc32<_0x5c589e['length'];_0x58dc32+=0x1){_0x2cb7c4[_0x8eeb('0x90')]({'membername':_0x2c73af[_0x8eeb('0x3e')],'UserId':_0x2c73af['id'],'queue_name':_0x5c589e[_0x58dc32][_0x8eeb('0x3e')],'VoiceQueueId':_0x5c589e[_0x58dc32]['id'],'interface':_[_0x8eeb('0x6e')](_0x2c73af[_0x8eeb('0xa4')])?util['format'](_0x8eeb('0xb0'),_0x2c73af[_0x8eeb('0x3e')]):_0x2c73af[_0x8eeb('0xa4')],'paused':_0x2c73af[_0x8eeb('0xa3')]||![],'penalty':_0x413084[_0x8eeb('0x63')][_0x8eeb('0xab')]||0x0});}return BPromise[_0x8eeb('0x92')](_0x2cb7c4,function(_0x176226){return db[_0x8eeb('0xb1')]['upsert'](_0x176226);});}return _0x25704a;});}})['then'](respondWithStatusCode(_0x591965,null))[_0x8eeb('0x5f')](handleError(_0x591965,null));};exports[_0x8eeb('0xb2')]=function(_0x5c940a,_0x5dc8d7,_0x155cb3){var _0x4e1873;return db[_0x8eeb('0x40')][_0x8eeb('0x61')]({'where':{'id':_0x5c940a[_0x8eeb('0x60')]['id']},'attributes':['id',_0x8eeb('0x3e'),'role']})[_0x8eeb('0x1e')](handleEntityNotFound(_0x5dc8d7,null))[_0x8eeb('0x1e')](function(_0x5cbfd4){if(_0x5cbfd4){_0x4e1873=_0x5cbfd4;if(!_0x5c940a['query'][_0x8eeb('0xa1')]||!utils[_0x8eeb('0xa5')](_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0xa1')])){throw new db[(_0x8eeb('0x98'))][(_0x8eeb('0x99'))](_0x8eeb('0xa6'));}return _0x5cbfd4[_0x8eeb('0xb3')+_[_0x8eeb('0xa8')](_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0xa1')]['toLowerCase']())+_0x8eeb('0xaa')](_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0x67')]);}})[_0x8eeb('0x1e')](function(_0x24a1f8){for(var _0x26f543=0x0;_0x26f543<_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0x67')][_0x8eeb('0x73')];_0x26f543+=0x1){var _0x1de74a={'UserId':_0x5c940a[_0x8eeb('0x60')]['id']};_0x1de74a[_[_0x8eeb('0xa8')](_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0xa1')]['toLowerCase']())+'QueueId']=_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0x67')][_0x26f543];socket['emit'](_0x8eeb('0x36')+_['capitalize'](_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0xa1')][_0x8eeb('0xa9')]())+_0x8eeb('0xb4'),_0x1de74a);}return _0x24a1f8;})[_0x8eeb('0x1e')](function(){if(_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0xa1')]===_0x8eeb('0xae')){return db[_0x8eeb('0xb1')][_0x8eeb('0x31')]({'where':{'UserId':_0x5c940a[_0x8eeb('0x60')]['id'],'VoiceQueueId':_0x5c940a[_0x8eeb('0x49')][_0x8eeb('0x67')]},'individualHooks':!![]})[_0x8eeb('0x1e')](function(){return _0x4e1873;});}return _0x4e1873;})[_0x8eeb('0x1e')](respondWithStatusCode(_0x5dc8d7,null))[_0x8eeb('0x5f')](handleError(_0x5dc8d7,null));};exports['addAvatar']=function(_0x360485,_0x290aa2,_0x2d1607){_0x360485[_0x8eeb('0x63')]['userpic']=_0x360485[_0x8eeb('0xb5')]['filename'];return db[_0x8eeb('0x40')]['find']({'where':{'id':_0x360485[_0x8eeb('0x60')]['id']}})['then'](handleEntityNotFound(_0x290aa2,null))[_0x8eeb('0x1e')](saveUpdates(_0x360485[_0x8eeb('0x63')],null))[_0x8eeb('0x1e')](respondWithResult(_0x290aa2,null))[_0x8eeb('0x5f')](handleError(_0x290aa2,null));};exports[_0x8eeb('0xb6')]=function(_0x4b050d,_0xb18d94,_0x4c90a7){var _0x377f4b=path[_0x8eeb('0xb7')](config[_0x8eeb('0xb8')],'server/files/images/logos/default_profile.png');return db[_0x8eeb('0x40')]['find']({'where':{'id':_0x4b050d[_0x8eeb('0x60')]['id']},'attributes':['id',_0x8eeb('0xb9')],'raw':!![]})[_0x8eeb('0x1e')](handleEntityNotFound(_0xb18d94,null))[_0x8eeb('0x1e')](function(_0x16311a){if(_0x16311a){if(_[_0x8eeb('0x6e')](_0x16311a['userpic'])){return _0xb18d94[_0x8eeb('0xba')](_0x377f4b);}else{if(!fs[_0x8eeb('0xbb')](path[_0x8eeb('0xb7')](config[_0x8eeb('0xb8')],_0x8eeb('0xbc'),_0x16311a[_0x8eeb('0xb9')]))){return _0xb18d94[_0x8eeb('0xba')](_0x377f4b);}return _0xb18d94['download'](path[_0x8eeb('0xb7')](config[_0x8eeb('0xb8')],_0x8eeb('0xbc'),_0x16311a[_0x8eeb('0xb9')]));}}})[_0x8eeb('0x5f')](handleError(_0xb18d94,null));};exports[_0x8eeb('0xbd')]=function(_0x439d8f,_0x32601d,_0x5daffd){var _0x118479={};var _0x26ea2c={};var _0x245501;var _0x441378;return db['User'][_0x8eeb('0x9b')]({'where':{'id':_0x439d8f[_0x8eeb('0x60')]['id']}})['then'](handleEntityNotFound(_0x32601d,null))[_0x8eeb('0x1e')](function(_0x1cd1ba){if(_0x1cd1ba){_0x245501=_0x1cd1ba;_0x26ea2c[_0x8eeb('0x4b')]=_['keys'](db[_0x8eeb('0xbe')][_0x8eeb('0x41')]);_0x26ea2c[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x439d8f[_0x8eeb('0x49')]);_0x26ea2c['filters']=_[_0x8eeb('0x4a')](_0x26ea2c[_0x8eeb('0x4b')],_0x26ea2c[_0x8eeb('0x49')]);_0x118479[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x26ea2c[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x439d8f[_0x8eeb('0x49')]['fields']));_0x118479[_0x8eeb('0x4d')]=_0x118479[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x118479['attributes']:_0x26ea2c['model'];_0x118479[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x118479[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x439d8f[_0x8eeb('0x49')],_0x26ea2c['filters']));if(_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x118479[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x118479[_0x8eeb('0x53')],{'$or':_['map'](_0x118479[_0x8eeb('0x4d')],function(_0x1777a8){var _0x14d1ff={};_0x14d1ff[_0x1777a8]={'$like':'%'+_0x439d8f['query'][_0x8eeb('0x58')]+'%'};return _0x14d1ff;})});}_0x118479=_[_0x8eeb('0x54')]({},_0x118479,_0x439d8f[_0x8eeb('0x59')]);return _0x245501[_0x8eeb('0xbd')](_0x118479);}})[_0x8eeb('0x1e')](function(_0x467a7e){if(_0x467a7e){_0x441378=_0x467a7e[_0x8eeb('0x73')];if(_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x5b'))){_0x118479[_0x8eeb('0x5c')]=[{'model':db[_0x8eeb('0xc0')],'as':_0x8eeb('0xc1'),'required':![]},{'model':db[_0x8eeb('0xc2')],'as':_0x8eeb('0xc3'),'attributes':['id',_0x8eeb('0x3e'),_0x8eeb('0xc4')],'where':_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0xc5')]?{'id':_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0xc5')]}:undefined,'required':_0x439d8f['query'][_0x8eeb('0xc5')]?!![]:![]}];}if(!_0x439d8f['query'][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x118479['limit']=qs[_0x8eeb('0x2c')](_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x118479[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0x439d8f[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}return _0x245501[_0x8eeb('0xbd')](_0x118479);}})[_0x8eeb('0x1e')](function(_0x15dc71){if(_0x15dc71){return _0x15dc71?{'count':_0x441378,'rows':_0x15dc71}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x32601d,null))[_0x8eeb('0x5f')](handleError(_0x32601d,null));};exports[_0x8eeb('0xc6')]=function(_0x52d4a5,_0x8fb7e1,_0x2b6bd3){var _0x37ba58;var _0x4021ce;var _0x39e3c1={};var _0x3148b8;return db['User'][_0x8eeb('0x9b')]({'where':{'id':_0x52d4a5[_0x8eeb('0x60')]['id']},'attributes':['id',_0x8eeb('0x3e'),_0x8eeb('0x33')]})[_0x8eeb('0x1e')](handleEntityNotFound(_0x8fb7e1,null))[_0x8eeb('0x1e')](function(_0x453047){if(!utils[_0x8eeb('0xa5')](_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0xa1')])){throw new db[(_0x8eeb('0x98'))][(_0x8eeb('0x99'))](_0x8eeb('0xa6'));}_0x37ba58=_0x453047;var _0x5bb410={};_0x5bb410[_0x8eeb('0x4b')]=_['keys'](db[_[_0x8eeb('0xa8')](_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0xa1')])+'Queue'][_0x8eeb('0x41')]);_0x5bb410[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x52d4a5[_0x8eeb('0x49')]);_0x5bb410['filters']=_[_0x8eeb('0x4a')](_0x5bb410[_0x8eeb('0x4b')],_0x5bb410[_0x8eeb('0x49')]);_0x39e3c1[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x5bb410[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x39e3c1['attributes']=_0x39e3c1['attributes'][_0x8eeb('0x73')]?_0x39e3c1['attributes']:_0x5bb410[_0x8eeb('0x4b')];_0x39e3c1['order']=qs[_0x8eeb('0x50')](_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x39e3c1[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x52d4a5[_0x8eeb('0x49')],_0x5bb410[_0x8eeb('0x51')]));if(_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x39e3c1[_0x8eeb('0x53')]=_['merge'](_0x39e3c1[_0x8eeb('0x53')],{'$or':_[_0x8eeb('0x39')](_0x39e3c1['attributes'],function(_0x238212){var _0x32aca8={};_0x32aca8[_0x238212]={'$like':'%'+_0x52d4a5['query']['filter']+'%'};return _0x32aca8;})});}_0x39e3c1=_[_0x8eeb('0x54')]({},_0x39e3c1,_0x52d4a5['options']);switch(_0x37ba58['role']){case'admin':return db[_['capitalize'](_0x52d4a5['query'][_0x8eeb('0xa1')])+_0x8eeb('0xc7')][_0x8eeb('0x5d')](_0x39e3c1);case _0x8eeb('0x36'):case _0x8eeb('0x78'):return _0x37ba58[_0x8eeb('0x32')+_[_0x8eeb('0xa8')](_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0xa1')])+_0x8eeb('0xaa')](_0x39e3c1);default:throw new db['Sequelize'][(_0x8eeb('0x99'))](_0x8eeb('0xc8'));}})[_0x8eeb('0x1e')](function(_0x5d8a0f){_0x3148b8=_0x5d8a0f[_0x8eeb('0x73')];if(!_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x39e3c1[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x52d4a5[_0x8eeb('0x49')]['limit']);_0x39e3c1[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0x52d4a5[_0x8eeb('0x49')]['offset']);}switch(_0x37ba58[_0x8eeb('0x33')]){case _0x8eeb('0x34'):return db[_['capitalize'](_0x52d4a5['query']['channel'])+'Queue']['findAll'](_0x39e3c1);case _0x8eeb('0x36'):case _0x8eeb('0x78'):return _0x37ba58['get'+_[_0x8eeb('0xa8')](_0x52d4a5[_0x8eeb('0x49')][_0x8eeb('0xa1')])+_0x8eeb('0xaa')](_0x39e3c1);}})[_0x8eeb('0x1e')](function(_0x26c2dd){return{'count':_0x3148b8,'rows':_0x26c2dd};})['then'](respondWithResult(_0x8fb7e1,null))[_0x8eeb('0x5f')](handleError(_0x8fb7e1,null));};exports[_0x8eeb('0xc9')]=function(_0x165301,_0x733f9a,_0x4b2f5f){var _0x29178b={};var _0x38b3ca={};var _0x1497a1;var _0x582cc9;return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0x165301[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x733f9a,null))[_0x8eeb('0x1e')](function(_0x1d2689){if(_0x1d2689){_0x1497a1=_0x1d2689;_0x38b3ca[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0xb1')][_0x8eeb('0x41')]);_0x38b3ca[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x165301[_0x8eeb('0x49')]);_0x38b3ca[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x38b3ca[_0x8eeb('0x4b')],_0x38b3ca[_0x8eeb('0x49')]);_0x29178b[_0x8eeb('0x4d')]=_['intersection'](_0x38b3ca[_0x8eeb('0x4b')],qs['fields'](_0x165301['query'][_0x8eeb('0x4c')]));_0x29178b[_0x8eeb('0x4d')]=_0x29178b[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x29178b[_0x8eeb('0x4d')]:_0x38b3ca[_0x8eeb('0x4b')];_0x29178b['order']=qs[_0x8eeb('0x50')](_0x165301[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x29178b[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x165301[_0x8eeb('0x49')],_0x38b3ca[_0x8eeb('0x51')]));if(_0x165301[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x29178b['where']=_['merge'](_0x29178b['where'],{'$or':_[_0x8eeb('0x39')](_0x29178b[_0x8eeb('0x4d')],function(_0x1dc7e6){var _0x529377={};_0x529377[_0x1dc7e6]={'$like':'%'+_0x165301['query']['filter']+'%'};return _0x529377;})});}_0x29178b=_['merge']({},_0x29178b,_0x165301['options']);return _0x1497a1[_0x8eeb('0xc9')](_0x29178b);}})[_0x8eeb('0x1e')](function(_0x446acd){if(_0x446acd){_0x582cc9=_0x446acd[_0x8eeb('0x73')];if(!_0x165301[_0x8eeb('0x49')]['hasOwnProperty'](_0x8eeb('0x4f'))){_0x29178b[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x165301[_0x8eeb('0x49')]['limit']);_0x29178b[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0x165301[_0x8eeb('0x49')]['offset']);}return _0x1497a1[_0x8eeb('0xc9')](_0x29178b);}})[_0x8eeb('0x1e')](function(_0x1cf5e6){if(_0x1cf5e6){return _0x1cf5e6?{'count':_0x582cc9,'rows':_0x1cf5e6}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x733f9a,null))[_0x8eeb('0x5f')](handleError(_0x733f9a,null));};exports[_0x8eeb('0xca')]=function(_0x5cc0aa,_0x463dc9,_0x4145a0){var _0x104d42={};var _0x148949={};var _0x1a80a6;var _0x13463c;return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0x5cc0aa[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x463dc9,null))[_0x8eeb('0x1e')](function(_0x59c81f){if(_0x59c81f){_0x1a80a6=_0x59c81f;_0x148949[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0xcb')][_0x8eeb('0x41')]);_0x148949[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x5cc0aa[_0x8eeb('0x49')]);_0x148949['filters']=_[_0x8eeb('0x4a')](_0x148949[_0x8eeb('0x4b')],_0x148949[_0x8eeb('0x49')]);_0x104d42[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x148949[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x5cc0aa[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x104d42['attributes']=_0x104d42[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x104d42['attributes']:_0x148949['model'];_0x104d42[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x5cc0aa[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x104d42[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x5cc0aa[_0x8eeb('0x49')],_0x148949[_0x8eeb('0x51')]));if(_0x5cc0aa[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x104d42[_0x8eeb('0x53')]=_['merge'](_0x104d42['where'],{'$or':_[_0x8eeb('0x39')](_0x104d42['attributes'],function(_0x11b1eb){var _0x5a086b={};_0x5a086b[_0x11b1eb]={'$like':'%'+_0x5cc0aa[_0x8eeb('0x49')]['filter']+'%'};return _0x5a086b;})});}_0x104d42=_[_0x8eeb('0x54')]({},_0x104d42,_0x5cc0aa[_0x8eeb('0x59')]);return _0x1a80a6[_0x8eeb('0xca')](_0x104d42);}})[_0x8eeb('0x1e')](function(_0x192362){if(_0x192362){_0x13463c=_0x192362[_0x8eeb('0x73')];if(!_0x5cc0aa[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x104d42['limit']=qs[_0x8eeb('0x2c')](_0x5cc0aa[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x104d42[_0x8eeb('0x2b')]=qs['offset'](_0x5cc0aa[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}return _0x1a80a6[_0x8eeb('0xca')](_0x104d42);}})[_0x8eeb('0x1e')](function(_0x2f0d69){if(_0x2f0d69){return _0x2f0d69?{'count':_0x13463c,'rows':_0x2f0d69}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x463dc9,null))[_0x8eeb('0x5f')](handleError(_0x463dc9,null));};exports['getRecordings']=function(_0x31c109,_0x3fab88,_0x2ab839){var _0x255d57={'raw':!![],'where':{}};var _0x28d338={};var _0x2debe5={'count':0x0,'rows':[]};return db[_0x8eeb('0x40')]['findOne']({'where':{'id':_0x31c109[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x3fab88,null))[_0x8eeb('0x1e')](function(_0x5de2e7){if(_0x5de2e7){_0x28d338[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0xcc')][_0x8eeb('0x41')]);_0x28d338[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x31c109[_0x8eeb('0x49')]);_0x28d338[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x28d338[_0x8eeb('0x4b')],_0x28d338['query']);_0x255d57[_0x8eeb('0x4d')]=_['intersection'](_0x28d338[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x31c109[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x255d57[_0x8eeb('0x4d')]=_0x255d57[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x255d57[_0x8eeb('0x4d')]:_0x28d338[_0x8eeb('0x4b')];if(!_0x31c109[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x255d57[_0x8eeb('0x2c')]=qs['limit'](_0x31c109[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x255d57[_0x8eeb('0x2b')]=qs['offset'](_0x31c109[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}_0x255d57[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x31c109[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x255d57[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x31c109[_0x8eeb('0x49')],_0x28d338[_0x8eeb('0x51')]));_0x255d57['where'][_0x8eeb('0xcd')]=_0x5de2e7['id'];if(_0x31c109['query']['filter']){_0x255d57[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x255d57['where'],{'$or':_[_0x8eeb('0x39')](_0x255d57[_0x8eeb('0x4d')],function(_0x5edef3){var _0x310e7e={};_0x310e7e[_0x5edef3]={'$like':'%'+_0x31c109[_0x8eeb('0x49')][_0x8eeb('0x58')]+'%'};return _0x310e7e;})});}_0x255d57=_[_0x8eeb('0x54')]({},_0x255d57,_0x31c109[_0x8eeb('0x59')]);return db[_0x8eeb('0xcc')][_0x8eeb('0x5a')]({'where':_0x255d57[_0x8eeb('0x53')]})[_0x8eeb('0x1e')](function(_0x10a86f){_0x2debe5[_0x8eeb('0x5a')]=_0x10a86f;if(_0x31c109[_0x8eeb('0x49')]['includeAll']){_0x255d57[_0x8eeb('0x5c')]=[{'all':!![]}];}return db[_0x8eeb('0xcc')][_0x8eeb('0x5d')](_0x255d57);})[_0x8eeb('0x1e')](function(_0x5738b2){_0x2debe5[_0x8eeb('0x5e')]=_0x5738b2;return _0x2debe5;});}})[_0x8eeb('0x1e')](respondWithFilteredResult(_0x3fab88,_0x255d57))['catch'](handleError(_0x3fab88,null));};exports[_0x8eeb('0xce')]=function(_0x5b6f47,_0x37e47c,_0x4263ae){var _0x101e75={'raw':!![],'where':{}};var _0xec1c38={};var _0x210e9b={'count':0x0,'rows':[]};return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0x5b6f47[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x37e47c,null))[_0x8eeb('0x1e')](function(_0x43fcb2){if(_0x43fcb2){_0xec1c38[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0xcf')][_0x8eeb('0x41')]);_0xec1c38[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x5b6f47[_0x8eeb('0x49')]);_0xec1c38['filters']=_[_0x8eeb('0x4a')](_0xec1c38[_0x8eeb('0x4b')],_0xec1c38[_0x8eeb('0x49')]);_0x101e75[_0x8eeb('0x4d')]=_['intersection'](_0xec1c38['model'],qs[_0x8eeb('0x4c')](_0x5b6f47[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x101e75['attributes']=_0x101e75[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x101e75['attributes']:_0xec1c38[_0x8eeb('0x4b')];if(!_0x5b6f47['query'][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x101e75[_0x8eeb('0x2c')]=qs['limit'](_0x5b6f47['query'][_0x8eeb('0x2c')]);_0x101e75[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0x5b6f47[_0x8eeb('0x49')]['offset']);}_0x101e75[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x5b6f47[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x101e75['where']=qs['filters'](_[_0x8eeb('0x52')](_0x5b6f47[_0x8eeb('0x49')],_0xec1c38[_0x8eeb('0x51')]));_0x101e75['where'][_0x8eeb('0xcd')]=_0x43fcb2['id'];if(_0x5b6f47['query'][_0x8eeb('0x58')]){_0x101e75[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x101e75[_0x8eeb('0x53')],{'$or':_[_0x8eeb('0x39')](_0x101e75[_0x8eeb('0x4d')],function(_0x40d27c){var _0x4e9816={};_0x4e9816[_0x40d27c]={'$like':'%'+_0x5b6f47[_0x8eeb('0x49')]['filter']+'%'};return _0x4e9816;})});}_0x101e75=_[_0x8eeb('0x54')]({},_0x101e75,_0x5b6f47['options']);return db[_0x8eeb('0xcf')][_0x8eeb('0x5a')]({'where':_0x101e75[_0x8eeb('0x53')]})['then'](function(_0x499b82){_0x210e9b[_0x8eeb('0x5a')]=_0x499b82;if(_0x5b6f47[_0x8eeb('0x49')][_0x8eeb('0x5b')]){_0x101e75[_0x8eeb('0x5c')]=[{'all':!![]}];}return db[_0x8eeb('0xcf')][_0x8eeb('0x5d')](_0x101e75);})[_0x8eeb('0x1e')](function(_0x44ad19){_0x210e9b[_0x8eeb('0x5e')]=_0x44ad19;return _0x210e9b;});}})[_0x8eeb('0x1e')](respondWithFilteredResult(_0x37e47c,_0x101e75))[_0x8eeb('0x5f')](handleError(_0x37e47c,null));};exports['getChatInteractions']=function(_0x1b1b30,_0x1616a5,_0x2151e7){var _0x529179={};var _0x44d7c1={};var _0x1a809c;var _0x220941;return db[_0x8eeb('0x40')]['findOne']({'where':{'id':_0x1b1b30[_0x8eeb('0x60')]['id']}})['then'](handleEntityNotFound(_0x1616a5,null))[_0x8eeb('0x1e')](function(_0x3a4abb){if(_0x3a4abb){_0x1a809c=_0x3a4abb;_0x44d7c1[_0x8eeb('0x4b')]=_['keys'](db[_0x8eeb('0xd0')][_0x8eeb('0x41')]);_0x44d7c1[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x1b1b30[_0x8eeb('0x49')]);_0x44d7c1[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x44d7c1['model'],_0x44d7c1[_0x8eeb('0x49')]);_0x529179['attributes']=_['intersection'](_0x44d7c1['model'],qs[_0x8eeb('0x4c')](_0x1b1b30['query'][_0x8eeb('0x4c')]));_0x529179[_0x8eeb('0x4d')]=_0x529179['attributes'][_0x8eeb('0x73')]?_0x529179[_0x8eeb('0x4d')]:_0x44d7c1['model'];_0x529179[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x1b1b30[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x529179['where']=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x1b1b30[_0x8eeb('0x49')],_0x44d7c1['filters']));if(_0x1b1b30['query'][_0x8eeb('0x58')]){_0x529179[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x529179[_0x8eeb('0x53')],{'$or':_['map'](_0x529179[_0x8eeb('0x4d')],function(_0x3f4b65){var _0x3809a5={};_0x3809a5[_0x3f4b65]={'$like':'%'+_0x1b1b30[_0x8eeb('0x49')]['filter']+'%'};return _0x3809a5;})});}_0x529179=_['merge']({},_0x529179,_0x1b1b30[_0x8eeb('0x59')]);return _0x1a809c[_0x8eeb('0xd1')](_0x529179);}})[_0x8eeb('0x1e')](function(_0x3525d1){if(_0x3525d1){_0x220941=_0x3525d1['length'];if(!_0x1b1b30['query'][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x529179[_0x8eeb('0x2c')]=qs['limit'](_0x1b1b30['query']['limit']);_0x529179['offset']=qs[_0x8eeb('0x2b')](_0x1b1b30[_0x8eeb('0x49')]['offset']);}return _0x1a809c[_0x8eeb('0xd1')](_0x529179);}})[_0x8eeb('0x1e')](function(_0x41fd36){if(_0x41fd36){return _0x41fd36?{'count':_0x220941,'rows':_0x41fd36}:null;}})['then'](respondWithResult(_0x1616a5,null))[_0x8eeb('0x5f')](handleError(_0x1616a5,null));};exports[_0x8eeb('0xd2')]=function(_0x3a1d1c,_0x3984d3,_0x54d6df){var _0x3f3d60={};var _0xd8f236={};var _0x3242b2;var _0x13dbec;return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0x3a1d1c[_0x8eeb('0x60')]['id']}})['then'](handleEntityNotFound(_0x3984d3,null))['then'](function(_0x20d9c2){if(_0x20d9c2){_0x3242b2=_0x20d9c2;_0xd8f236[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0xd3')][_0x8eeb('0x41')]);_0xd8f236[_0x8eeb('0x49')]=_['keys'](_0x3a1d1c[_0x8eeb('0x49')]);_0xd8f236['filters']=_['intersection'](_0xd8f236['model'],_0xd8f236[_0x8eeb('0x49')]);_0x3f3d60[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0xd8f236['model'],qs['fields'](_0x3a1d1c[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x3f3d60['attributes']=_0x3f3d60[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x3f3d60[_0x8eeb('0x4d')]:_0xd8f236[_0x8eeb('0x4b')];_0x3f3d60[_0x8eeb('0xbf')]=qs['sort'](_0x3a1d1c[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x3f3d60[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_['pick'](_0x3a1d1c[_0x8eeb('0x49')],_0xd8f236[_0x8eeb('0x51')]));if(_0x3a1d1c['query'][_0x8eeb('0x58')]){_0x3f3d60[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x3f3d60['where'],{'$or':_[_0x8eeb('0x39')](_0x3f3d60[_0x8eeb('0x4d')],function(_0x437022){var _0x4b2b5d={};_0x4b2b5d[_0x437022]={'$like':'%'+_0x3a1d1c[_0x8eeb('0x49')][_0x8eeb('0x58')]+'%'};return _0x4b2b5d;})});}_0x3f3d60=_[_0x8eeb('0x54')]({},_0x3f3d60,_0x3a1d1c[_0x8eeb('0x59')]);return _0x3242b2[_0x8eeb('0xd2')](_0x3f3d60);}})[_0x8eeb('0x1e')](function(_0x4a91df){if(_0x4a91df){_0x13dbec=_0x4a91df['length'];if(!_0x3a1d1c[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x3f3d60[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x3a1d1c[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x3f3d60['offset']=qs['offset'](_0x3a1d1c['query'][_0x8eeb('0x2b')]);}return _0x3242b2[_0x8eeb('0xd2')](_0x3f3d60);}})[_0x8eeb('0x1e')](function(_0x33296a){if(_0x33296a){return _0x33296a?{'count':_0x13dbec,'rows':_0x33296a}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x3984d3,null))[_0x8eeb('0x5f')](handleError(_0x3984d3,null));};exports[_0x8eeb('0xd4')]=function(_0x3aba6e,_0x194ee0,_0x1bb414){var _0x16a46d={'raw':!![],'where':{}};var _0x3d4d5e={};var _0xe91bbe={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3aba6e[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x194ee0,null))[_0x8eeb('0x1e')](function(_0x5e0846){if(_0x5e0846){_0x3d4d5e[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db['MailInteraction']['rawAttributes']);_0x3d4d5e[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x3aba6e[_0x8eeb('0x49')]);_0x3d4d5e[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x3d4d5e[_0x8eeb('0x4b')],_0x3d4d5e['query']);_0x16a46d[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x3d4d5e['model'],qs[_0x8eeb('0x4c')](_0x3aba6e['query']['fields']));_0x16a46d[_0x8eeb('0x4d')]=_0x16a46d[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x16a46d[_0x8eeb('0x4d')]:_0x3d4d5e['model'];if(!_0x3aba6e['query'][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x16a46d[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x3aba6e[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x16a46d['offset']=qs['offset'](_0x3aba6e[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}_0x16a46d[_0x8eeb('0xbf')]=qs['sort'](_0x3aba6e[_0x8eeb('0x49')]['sort']);_0x16a46d[_0x8eeb('0x53')]=qs['filters'](_['pick'](_0x3aba6e[_0x8eeb('0x49')],_0x3d4d5e[_0x8eeb('0x51')]));_0x16a46d['where']['UserId']=_0x5e0846['id'];if(_0x3aba6e[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x16a46d[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x16a46d[_0x8eeb('0x53')],{'$or':_['map'](_0x16a46d[_0x8eeb('0x4d')],function(_0x191bc0){var _0x2ea160={};_0x2ea160[_0x191bc0]={'$like':'%'+_0x3aba6e[_0x8eeb('0x49')][_0x8eeb('0x58')]+'%'};return _0x2ea160;})});}_0x16a46d=_['merge']({},_0x16a46d,_0x3aba6e[_0x8eeb('0x59')]);return db[_0x8eeb('0xd5')]['count']({'where':_0x16a46d['where']})[_0x8eeb('0x1e')](function(_0x22713e){_0xe91bbe[_0x8eeb('0x5a')]=_0x22713e;if(_0x3aba6e[_0x8eeb('0x49')]['includeAll']){_0x16a46d[_0x8eeb('0x5c')]=[{'all':!![]}];}return db[_0x8eeb('0xd5')]['findAll'](_0x16a46d);})[_0x8eeb('0x1e')](function(_0xe11b1a){_0xe91bbe[_0x8eeb('0x5e')]=_0xe11b1a;return _0xe91bbe;});}})[_0x8eeb('0x1e')](respondWithFilteredResult(_0x194ee0,_0x16a46d))[_0x8eeb('0x5f')](handleError(_0x194ee0,null));};exports['getSmsInteractions']=function(_0x1748d7,_0x4b1279,_0x4ba625){var _0x3e98f0={};var _0x169411={};var _0x4e3079;var _0x1877e9;return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0x1748d7['params']['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x4b1279,null))[_0x8eeb('0x1e')](function(_0x2d3c3a){if(_0x2d3c3a){_0x4e3079=_0x2d3c3a;_0x169411[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0xd6')][_0x8eeb('0x41')]);_0x169411[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x1748d7[_0x8eeb('0x49')]);_0x169411[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x169411[_0x8eeb('0x4b')],_0x169411['query']);_0x3e98f0[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x169411[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x1748d7[_0x8eeb('0x49')]['fields']));_0x3e98f0[_0x8eeb('0x4d')]=_0x3e98f0[_0x8eeb('0x4d')]['length']?_0x3e98f0[_0x8eeb('0x4d')]:_0x169411[_0x8eeb('0x4b')];_0x3e98f0[_0x8eeb('0xbf')]=qs['sort'](_0x1748d7[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x3e98f0['where']=qs['filters'](_[_0x8eeb('0x52')](_0x1748d7[_0x8eeb('0x49')],_0x169411[_0x8eeb('0x51')]));if(_0x1748d7[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x3e98f0['where']=_[_0x8eeb('0x54')](_0x3e98f0['where'],{'$or':_[_0x8eeb('0x39')](_0x3e98f0['attributes'],function(_0x121da4){var _0x47d1ef={};_0x47d1ef[_0x121da4]={'$like':'%'+_0x1748d7['query'][_0x8eeb('0x58')]+'%'};return _0x47d1ef;})});}_0x3e98f0=_[_0x8eeb('0x54')]({},_0x3e98f0,_0x1748d7[_0x8eeb('0x59')]);return _0x4e3079[_0x8eeb('0xd7')](_0x3e98f0);}})[_0x8eeb('0x1e')](function(_0x1ba0bf){if(_0x1ba0bf){_0x1877e9=_0x1ba0bf[_0x8eeb('0x73')];if(!_0x1748d7['query']['hasOwnProperty']('nolimit')){_0x3e98f0['limit']=qs[_0x8eeb('0x2c')](_0x1748d7[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x3e98f0['offset']=qs[_0x8eeb('0x2b')](_0x1748d7[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}return _0x4e3079[_0x8eeb('0xd7')](_0x3e98f0);}})['then'](function(_0x247ce4){if(_0x247ce4){return _0x247ce4?{'count':_0x1877e9,'rows':_0x247ce4}:null;}})['then'](respondWithResult(_0x4b1279,null))[_0x8eeb('0x5f')](handleError(_0x4b1279,null));};exports[_0x8eeb('0xd8')]=function(_0x311b17,_0x5ba258,_0x5d15d1){var _0x4008ce={};var _0x6bbbee={};var _0xb0bba;var _0x4f2f55;return db[_0x8eeb('0x40')]['findOne']({'where':{'id':_0x311b17['params']['id']}})['then'](handleEntityNotFound(_0x5ba258,null))['then'](function(_0x3c7fb6){if(_0x3c7fb6){_0xb0bba=_0x3c7fb6;_0x6bbbee['model']=_[_0x8eeb('0x48')](db['FaxInteraction'][_0x8eeb('0x41')]);_0x6bbbee[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x311b17['query']);_0x6bbbee['filters']=_[_0x8eeb('0x4a')](_0x6bbbee[_0x8eeb('0x4b')],_0x6bbbee['query']);_0x4008ce[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x6bbbee[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x311b17[_0x8eeb('0x49')]['fields']));_0x4008ce[_0x8eeb('0x4d')]=_0x4008ce[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x4008ce[_0x8eeb('0x4d')]:_0x6bbbee[_0x8eeb('0x4b')];_0x4008ce[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x311b17[_0x8eeb('0x49')]['sort']);_0x4008ce[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x311b17[_0x8eeb('0x49')],_0x6bbbee[_0x8eeb('0x51')]));if(_0x311b17[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x4008ce[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x4008ce['where'],{'$or':_[_0x8eeb('0x39')](_0x4008ce[_0x8eeb('0x4d')],function(_0x3237c6){var _0x1cd1bd={};_0x1cd1bd[_0x3237c6]={'$like':'%'+_0x311b17[_0x8eeb('0x49')]['filter']+'%'};return _0x1cd1bd;})});}_0x4008ce=_[_0x8eeb('0x54')]({},_0x4008ce,_0x311b17[_0x8eeb('0x59')]);return _0xb0bba[_0x8eeb('0xd8')](_0x4008ce);}})[_0x8eeb('0x1e')](function(_0x164e9c){if(_0x164e9c){_0x4f2f55=_0x164e9c[_0x8eeb('0x73')];if(!_0x311b17[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x4008ce[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x311b17['query']['limit']);_0x4008ce[_0x8eeb('0x2b')]=qs['offset'](_0x311b17[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}return _0xb0bba['getFaxInteractions'](_0x4008ce);}})[_0x8eeb('0x1e')](function(_0x530109){if(_0x530109){return _0x530109?{'count':_0x4f2f55,'rows':_0x530109}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x5ba258,null))[_0x8eeb('0x5f')](handleError(_0x5ba258,null));};exports[_0x8eeb('0xd9')]=function(_0x356c8a,_0x2eb5d6,_0x2f9da4){var _0x593b6e={};var _0x16a80c={};var _0x149af6;var _0x1ce384;return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0x356c8a[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x2eb5d6,null))[_0x8eeb('0x1e')](function(_0x8f839a){if(_0x8f839a){_0x149af6=_0x8f839a;_0x16a80c['model']=_[_0x8eeb('0x48')](db[_0x8eeb('0xda')][_0x8eeb('0x41')]);_0x16a80c[_0x8eeb('0x49')]=_['keys'](_0x356c8a['query']);_0x16a80c[_0x8eeb('0x51')]=_['intersection'](_0x16a80c[_0x8eeb('0x4b')],_0x16a80c[_0x8eeb('0x49')]);_0x593b6e[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x16a80c[_0x8eeb('0x4b')],qs['fields'](_0x356c8a['query'][_0x8eeb('0x4c')]));_0x593b6e[_0x8eeb('0x4d')]=_0x593b6e[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x593b6e[_0x8eeb('0x4d')]:_0x16a80c[_0x8eeb('0x4b')];_0x593b6e[_0x8eeb('0xbf')]=qs['sort'](_0x356c8a[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x593b6e[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x356c8a[_0x8eeb('0x49')],_0x16a80c['filters']));if(_0x356c8a['query'][_0x8eeb('0x58')]){_0x593b6e[_0x8eeb('0x53')]=_['merge'](_0x593b6e[_0x8eeb('0x53')],{'$or':_[_0x8eeb('0x39')](_0x593b6e[_0x8eeb('0x4d')],function(_0x1fb3db){var _0xb85f68={};_0xb85f68[_0x1fb3db]={'$like':'%'+_0x356c8a['query'][_0x8eeb('0x58')]+'%'};return _0xb85f68;})});}_0x593b6e=_[_0x8eeb('0x54')]({},_0x593b6e,_0x356c8a[_0x8eeb('0x59')]);return _0x149af6[_0x8eeb('0xd9')](_0x593b6e);}})[_0x8eeb('0x1e')](function(_0x1d8edf){if(_0x1d8edf){_0x1ce384=_0x1d8edf[_0x8eeb('0x73')];if(!_0x356c8a[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x593b6e[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x356c8a[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x593b6e[_0x8eeb('0x2b')]=qs['offset'](_0x356c8a[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}return _0x149af6[_0x8eeb('0xd9')](_0x593b6e);}})[_0x8eeb('0x1e')](function(_0x581234){if(_0x581234){return _0x581234?{'count':_0x1ce384,'rows':_0x581234}:null;}})['then'](respondWithResult(_0x2eb5d6,null))[_0x8eeb('0x5f')](handleError(_0x2eb5d6,null));};exports[_0x8eeb('0xdb')]=function(_0x55c2fa,_0x32eb95,_0x10d008){var _0x464149;var _0x1bc990;var _0x57ea33;var _0x422f87=!_[_0x8eeb('0x6e')](_0x55c2fa[_0x8eeb('0x60')]['id'])?_0x55c2fa['params']['id']:!_['isNil'](_0x55c2fa[_0x8eeb('0x36')]['id'])?_0x55c2fa['user']['id']:null;return db[_0x8eeb('0x40')][_0x8eeb('0x61')]({'where':{'id':_0x422f87,'role':{'$or':[_0x8eeb('0x34'),_0x8eeb('0x36'),'agent']}},'attributes':['id',_0x8eeb('0x3e'),_0x8eeb('0xdc'),'mobile','role',_0x8eeb('0x68'),_0x8eeb('0xdd')]})[_0x8eeb('0x1e')](function(_0x2f0ad3){if(_0x2f0ad3){if(_0x2f0ad3[_0x8eeb('0x33')]==='agent'){_0x464149=_0x2f0ad3;if(_0x55c2fa[_0x8eeb('0x63')][_0x8eeb('0xa4')]){_0x57ea33=util[_0x8eeb('0xde')]('LOCAL/%s@from-sip/n',_0x464149[_0x55c2fa[_0x8eeb('0x63')][_0x8eeb('0xa4')]]);}else if(_0x55c2fa['body']['intrf']){_0x57ea33=util[_0x8eeb('0xde')]('SIP/%s',_0x55c2fa[_0x8eeb('0x63')][_0x8eeb('0xdf')]);}else{_0x57ea33=util[_0x8eeb('0xde')](_0x8eeb('0xb0'),_0x464149['name']);}socket['to'](util['format'](_0x8eeb('0xe0'),_0x464149['name']))[_0x8eeb('0xac')](_0x8eeb('0xe1'),{'ip':_0x55c2fa[_0x8eeb('0xe2')][_0x8eeb('0xe3')]||_0x55c2fa[_0x8eeb('0xe4')][_0x8eeb('0xe5')]||_0x55c2fa['socket'][_0x8eeb('0xe5')]||_0x55c2fa[_0x8eeb('0xe4')][_0x8eeb('0xe6')]['remoteAddress']});return db[_0x8eeb('0xb1')]['destroy']({'where':{'membername':_0x464149['name']},'individualHooks':!![]});}}else{throw new db[(_0x8eeb('0x98'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x8eeb('0x1e')](function(){if(_0x464149){return _0x464149[_0x8eeb('0xe7')]({'raw':!![]});}})[_0x8eeb('0x1e')](function(_0x2f3051){if(_0x464149){var _0x2fb7d4=[];if(_0x2f3051){_0x1bc990=_0x2f3051;if(_0x1bc990[_0x8eeb('0x73')]){for(var _0x522443=0x0;_0x522443<_0x1bc990[_0x8eeb('0x73')];_0x522443++){_0x2fb7d4[_0x8eeb('0x90')]({'membername':_0x464149[_0x8eeb('0x3e')],'UserId':_0x464149['id'],'queue_name':_0x1bc990[_0x522443][_0x8eeb('0x3e')],'VoiceQueueId':_0x1bc990[_0x522443]['id'],'interface':_0x57ea33,'paused':_0x464149[_0x8eeb('0xdd')]||![],'penalty':_0x1bc990[_0x522443]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x8eeb('0x92')](_0x2fb7d4,function(_0x24b864){return db['UserVoiceQueueRt'][_0x8eeb('0xe8')](_0x24b864);});}}}})['then'](function(){if(_0x464149){return db['MemberReport'][_0x8eeb('0x5d')]({'where':{'membername':_0x464149[_0x8eeb('0x3e')],'exitAt':null}});}})[_0x8eeb('0x1e')](function(_0xc3403f){if(_0x464149){var _0x4a9aaa=[];_0xc3403f[_0x8eeb('0xe9')](function(_0x1dc5ba){_0x4a9aaa[_0x8eeb('0x90')](_0x1dc5ba[_0x8eeb('0x62')]({'exitAt':moment()[_0x8eeb('0xde')](_0x8eeb('0xea'))}));});return BPromise[_0x8eeb('0x91')](_0x4a9aaa);}})[_0x8eeb('0x1e')](function(){if(_0x464149){var _0x7f5271=[];var _0x59642f=[];var _0x1e1432=utils[_0x8eeb('0xeb')]();var _0x41818e={'membername':_0x464149[_0x8eeb('0x3e')],'interface':_0x57ea33,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x464149[_0x8eeb('0x33')],'internal':_0x464149[_0x8eeb('0x68')]};_0x1e1432['forEach'](function(_0x479c90){_0x7f5271[_0x8eeb('0x90')](_['merge']({'channel':_0x479c90,'type':_0x8eeb('0xec'),'data1':_0x55c2fa[_0x8eeb('0x63')][_0x8eeb('0xed')],'data2':_0x57ea33},_0x41818e));if(_0x464149[_0x8eeb('0xdd')]){_0x59642f[_0x8eeb('0x90')](_[_0x8eeb('0x54')]({'channel':_0x479c90,'type':_0x8eeb('0xee'),'data1':_0x8eeb('0xef')},_0x41818e));}});return db[_0x8eeb('0xf0')][_0x8eeb('0xf1')](_0x7f5271[_0x8eeb('0xf2')](_0x59642f),{'individualHooks':!![]});}})[_0x8eeb('0x1e')](function(){if(_0x464149){return _0x464149[_0x8eeb('0x62')]({'online':!![],'lastLoginAt':moment()[_0x8eeb('0xde')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x464149[_0x8eeb('0xdd')]||![],'mailPause':_0x464149[_0x8eeb('0xdd')]||![],'chatPause':_0x464149[_0x8eeb('0xdd')]||![],'faxPause':_0x464149['loginInPause']||![],'smsPause':_0x464149['loginInPause']||![],'openchannelPause':_0x464149[_0x8eeb('0xdd')]||![],'whatsappPause':_0x464149[_0x8eeb('0xdd')]||![],'pauseType':_0x464149[_0x8eeb('0xdd')]?_0x8eeb('0xef'):null,'interface':_0x57ea33,'lastPauseAt':moment()[_0x8eeb('0xde')](_0x8eeb('0xea'))});}})[_0x8eeb('0x1e')](function(_0x57acb6){if(_0x55c2fa[_0x8eeb('0xf3')]){return _0x10d008();}else{return BPromise[_0x8eeb('0xf4')](_0x57acb6)[_0x8eeb('0x1e')](respondWithResult(_0x32eb95,null));}})['catch'](handleError(_0x32eb95,null));};exports[_0x8eeb('0xf5')]=function(_0x569a93,_0xae613b,_0x4ff081){var _0x5694b7;return db[_0x8eeb('0x40')]['find']({'where':{'id':_0x569a93[_0x8eeb('0x60')]['id'],'role':_0x8eeb('0x78')},'attributes':['id',_0x8eeb('0x3e'),_0x8eeb('0x33')]})[_0x8eeb('0x1e')](handleEntityNotFound(_0xae613b,null))[_0x8eeb('0x1e')](function(_0x1fee6c){if(_0x1fee6c){_0x5694b7=_0x1fee6c;return db[_0x8eeb('0xb1')][_0x8eeb('0x31')]({'where':{'membername':_0x5694b7[_0x8eeb('0x3e')]},'individualHooks':!![]});}})[_0x8eeb('0x1e')](function(){return db[_0x8eeb('0xf0')][_0x8eeb('0x5d')]({'where':{'membername':_0x5694b7['name'],'exitAt':null}});})[_0x8eeb('0x1e')](function(_0x2b1e7c){var _0x2bcfb2=[];_0x2b1e7c[_0x8eeb('0xe9')](function(_0x25663b){_0x2bcfb2['push'](_0x25663b[_0x8eeb('0x62')]({'exitAt':moment()['format'](_0x8eeb('0xea'))}));});return BPromise['all'](_0x2bcfb2);})[_0x8eeb('0x1e')](function(){return _0x5694b7[_0x8eeb('0x62')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8eeb('0x1e')](respondWithResult(_0xae613b,null))[_0x8eeb('0x5f')](handleError(_0xae613b,null));};exports[_0x8eeb('0xf6')]=function(_0x37c39a,_0x38097a,_0x1137cd){var _0x30a90d;return db[_0x8eeb('0xb1')][_0x8eeb('0x62')]({'paused':0x1},{'where':{'UserId':_0x37c39a[_0x8eeb('0x60')]['id']},'individualHooks':!![]})[_0x8eeb('0x1e')](function(){return db[_0x8eeb('0x40')][_0x8eeb('0x61')]({'where':{'id':_0x37c39a[_0x8eeb('0x60')]['id'],'role':_0x8eeb('0x78')},'attributes':['id',_0x8eeb('0x3e'),_0x8eeb('0x33'),_0x8eeb('0x68'),_0x8eeb('0xa4')]});})[_0x8eeb('0x1e')](handleEntityNotFound(_0x38097a,null))[_0x8eeb('0x1e')](function(_0x3f0f46){if(_0x3f0f46){_0x30a90d=_0x3f0f46;return respondWithRpcPromise('QueuePause',_0x8eeb('0xf6'),{'id':_0x30a90d['id'],'name':_0x30a90d['name'],'pause':!![]});}})['then'](function(){if(_0x30a90d){return db[_0x8eeb('0xf0')][_0x8eeb('0x5d')]({'where':{'membername':_0x30a90d[_0x8eeb('0x3e')],'type':_0x8eeb('0xee'),'exitAt':null}});}})[_0x8eeb('0x1e')](function(_0x45280f){if(_0x45280f['length']){var _0x35ae03=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x22e4ff=0x0,_0x459e7b=_0x45280f['length'];_0x22e4ff<_0x459e7b;_0x22e4ff++){_0x45280f[_0x22e4ff][_0x8eeb('0xf7')]({'exitAt':_0x35ae03});}}})['then'](function(){var _0x3e5e59=[];var _0x5d3704=utils[_0x8eeb('0xeb')]();_0x5d3704[_0x8eeb('0xe9')](function(_0x4ea2a0){_0x3e5e59[_0x8eeb('0x90')]({'channel':_0x4ea2a0,'membername':_0x30a90d['name'],'interface':_[_0x8eeb('0x6e')](_0x30a90d['interface'])?util[_0x8eeb('0xde')](_0x8eeb('0xb0'),_0x30a90d['name']):_0x30a90d[_0x8eeb('0xa4')],'type':_0x8eeb('0xee'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x37c39a[_0x8eeb('0x63')]['type']||_0x8eeb('0xf8'),'role':_0x30a90d[_0x8eeb('0x33')],'internal':_0x30a90d[_0x8eeb('0x68')]});});return db['MemberReport'][_0x8eeb('0xf1')](_0x3e5e59,{'individualHooks':!![]});})[_0x8eeb('0x1e')](function(){return _0x30a90d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x37c39a['body'][_0x8eeb('0x43')]||_0x8eeb('0xf8'),'lastPauseAt':moment()[_0x8eeb('0xde')](_0x8eeb('0xea'))});})[_0x8eeb('0x1e')](respondWithResult(_0x38097a,null))[_0x8eeb('0x5f')](handleError(_0x38097a,null));};exports[_0x8eeb('0xf9')]=function(_0x5697c2,_0x301ecc,_0x4f7e51){var _0x4b52c0;return db['User'][_0x8eeb('0x61')]({'where':{'id':_0x5697c2['params']['id']},'attributes':['id','name',_0x8eeb('0x33'),_0x8eeb('0xa3'),_0x8eeb('0xfa'),_0x8eeb('0xfb'),_0x8eeb('0xfc'),_0x8eeb('0xfd'),_0x8eeb('0xfe'),'whatsapppause',_0x8eeb('0xff'),_0x8eeb('0x100')]})[_0x8eeb('0x1e')](handleEntityNotFound(_0x301ecc,null))[_0x8eeb('0x1e')](function(_0x49eb27){if(_0x49eb27){_0x4b52c0=_0x49eb27;if(_0x5697c2[_0x8eeb('0x63')][_0x8eeb('0xa1')]&&!utils[_0x8eeb('0xa5')](_0x5697c2[_0x8eeb('0x63')]['channel'])){throw new db['Sequelize'][(_0x8eeb('0x99'))]('Unknown\x20channel');}switch(_0x5697c2['body']['channel']){case _0x8eeb('0xae'):return respondWithRpcPromise(_0x8eeb('0x101'),_0x8eeb('0xf9'),{'id':_0x4b52c0['id'],'name':_0x4b52c0[_0x8eeb('0x3e')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x8eeb('0x62')]({'paused':0x0},{'where':{'UserId':_0x4b52c0['id']},'individualHooks':!![]});})[_0x8eeb('0x1e')](function(){return db['MemberReport']['find']({'where':{'channel':_0x5697c2[_0x8eeb('0x63')][_0x8eeb('0xa1')],'membername':_0x4b52c0[_0x8eeb('0x3e')],'type':_0x8eeb('0xee'),'exitAt':null}});})[_0x8eeb('0x1e')](function(_0x13f06a){if(_0x13f06a){return _0x13f06a[_0x8eeb('0x62')]({'exitAt':moment()[_0x8eeb('0xde')](_0x8eeb('0xea')),'data2':_0x8eeb('0x102')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x4b52c0['update']({'voicePause':![]});});case _0x8eeb('0x103'):case _0x8eeb('0x104'):case _0x8eeb('0x105'):case _0x8eeb('0x106'):case _0x8eeb('0x107'):case _0x8eeb('0x108'):return db['MemberReport'][_0x8eeb('0x61')]({'where':{'channel':_0x5697c2['body'][_0x8eeb('0xa1')],'membername':_0x4b52c0[_0x8eeb('0x3e')],'type':_0x8eeb('0xee'),'exitAt':null}})['then'](function(_0x291834){if(_0x291834){return _0x291834[_0x8eeb('0x62')]({'exitAt':moment()[_0x8eeb('0xde')](_0x8eeb('0xea')),'data2':_0x8eeb('0x102')},{'individualHooks':!![]});}return null;})[_0x8eeb('0x1e')](function(){var _0x307928={};_['set'](_0x307928,util[_0x8eeb('0xde')](_0x8eeb('0x109'),_0x5697c2[_0x8eeb('0x63')][_0x8eeb('0xa1')],_0x8eeb('0x10a')),![]);return _0x4b52c0[_0x8eeb('0x62')](_0x307928);});default:return respondWithRpcPromise(_0x8eeb('0x101'),_0x8eeb('0xf9'),{'id':_0x4b52c0['id'],'name':_0x4b52c0[_0x8eeb('0x3e')],'pause':![]})['then'](function(){return db[_0x8eeb('0xb1')][_0x8eeb('0x62')]({'paused':0x0},{'where':{'UserId':_0x4b52c0['id']}});})[_0x8eeb('0x1e')](function(){return db[_0x8eeb('0xf0')][_0x8eeb('0x5d')]({'where':{'membername':_0x4b52c0[_0x8eeb('0x3e')],'type':_0x8eeb('0xee'),'exitAt':null}});})['then'](function(_0x2a1011){var _0x27e9a0=[];_0x2a1011[_0x8eeb('0xe9')](function(_0x12fa97){_0x27e9a0[_0x8eeb('0x90')](_0x12fa97[_0x8eeb('0x62')]({'exitAt':moment()[_0x8eeb('0xde')](_0x8eeb('0xea')),'data2':_0x8eeb('0x102')}));});return BPromise[_0x8eeb('0x91')](_0x27e9a0);})[_0x8eeb('0x1e')](function(){return _0x4b52c0[_0x8eeb('0x62')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8eeb('0x1e')](respondWithResult(_0x301ecc,null))[_0x8eeb('0x5f')](handleError(_0x301ecc,null));};exports[_0x8eeb('0x10b')]=function(_0x5d32f1,_0x24c73f,_0x4ad8c4){var _0x204014={};var _0x1d77be={};var _0x3ca14d;var _0x30a3d8;return db[_0x8eeb('0x40')]['findOne']({'where':{'id':_0x5d32f1[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x24c73f,null))['then'](function(_0x4aef86){if(_0x4aef86){_0x3ca14d=_0x4aef86;_0x1d77be[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0x10c')]['rawAttributes']);_0x1d77be[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x5d32f1[_0x8eeb('0x49')]);_0x1d77be[_0x8eeb('0x51')]=_['intersection'](_0x1d77be[_0x8eeb('0x4b')],_0x1d77be[_0x8eeb('0x49')]);_0x204014['attributes']=_[_0x8eeb('0x4a')](_0x1d77be['model'],qs[_0x8eeb('0x4c')](_0x5d32f1[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x204014['attributes']=_0x204014[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x204014[_0x8eeb('0x4d')]:_0x1d77be['model'];_0x204014[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x5d32f1[_0x8eeb('0x49')]['sort']);_0x204014[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x5d32f1[_0x8eeb('0x49')],_0x1d77be['filters']));if(_0x5d32f1[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x204014[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x204014[_0x8eeb('0x53')],{'$or':_['map'](_0x204014[_0x8eeb('0x4d')],function(_0x47eae5){var _0x3ceec0={};_0x3ceec0[_0x47eae5]={'$like':'%'+_0x5d32f1[_0x8eeb('0x49')][_0x8eeb('0x58')]+'%'};return _0x3ceec0;})});}_0x204014=_[_0x8eeb('0x54')]({},_0x204014,_0x5d32f1['options']);return _0x3ca14d[_0x8eeb('0x10b')](_0x204014);}})['then'](function(_0x230e24){if(_0x230e24){_0x30a3d8=_0x230e24['length'];if(!_0x5d32f1[_0x8eeb('0x49')][_0x8eeb('0x4e')](_0x8eeb('0x4f'))){_0x204014[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0x5d32f1[_0x8eeb('0x49')][_0x8eeb('0x2c')]);_0x204014[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0x5d32f1[_0x8eeb('0x49')]['offset']);}return _0x3ca14d[_0x8eeb('0x10b')](_0x204014);}})[_0x8eeb('0x1e')](function(_0x337acc){if(_0x337acc){return _0x337acc?{'count':_0x30a3d8,'rows':_0x337acc}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x24c73f,null))[_0x8eeb('0x5f')](handleError(_0x24c73f,null));};exports[_0x8eeb('0x10d')]=function(_0x5b8c42,_0x1938f4){return db[_0x8eeb('0x40')]['find']({'where':{'id':_0x5b8c42[_0x8eeb('0x60')]['id']}})[_0x8eeb('0x1e')](handleEntityNotFound(_0x1938f4,null))['then'](function(_0x3b6294){if(_0x3b6294){var _0x9ce84e=_0x3b6294[_0x8eeb('0x32')]({'plain':!![]});return _0x3b6294[_0x8eeb('0x10d')](_0x5b8c42[_0x8eeb('0x63')]['ids'],_[_0x8eeb('0x66')](_0x5b8c42[_0x8eeb('0x63')],[_0x8eeb('0x67'),'id'])||{})[_0x8eeb('0x1e')](function(){for(var _0x49bca9=0x0;_0x49bca9<_0x5b8c42[_0x8eeb('0x63')][_0x8eeb('0x67')]['length'];_0x49bca9++){var _0x2718d2=[];db[_0x8eeb('0x10c')]['findOne']({'where':{'id':_0x5b8c42[_0x8eeb('0x63')]['ids'][_0x49bca9]}})[_0x8eeb('0x1e')](function(_0xb53193){_0x2718d2[_0x8eeb('0x90')](_0xb53193['getVoiceQueues']()[_0x8eeb('0x1e')](function(_0x53f9c7){for(var _0x1366c6=0x0;_0x1366c6<_0x53f9c7[_0x8eeb('0x73')];_0x1366c6++){_0x53f9c7[_0x1366c6]['setDataValue'](_0x8eeb('0xa1'),_0x8eeb('0x10e'));}return _0x53f9c7;}));_0x2718d2['push'](_0xb53193['getChatQueues']()[_0x8eeb('0x1e')](function(_0x14d33d){for(var _0x53f8da=0x0;_0x53f8da<_0x14d33d[_0x8eeb('0x73')];_0x53f8da++){_0x14d33d[_0x53f8da]['setDataValue']('channel',_0x8eeb('0x10f'));}return _0x14d33d;}));_0x2718d2['push'](_0xb53193[_0x8eeb('0x110')]()[_0x8eeb('0x1e')](function(_0x978ac0){for(var _0x1019ba=0x0;_0x1019ba<_0x978ac0[_0x8eeb('0x73')];_0x1019ba++){_0x978ac0[_0x1019ba][_0x8eeb('0x111')](_0x8eeb('0xa1'),'Mail');}return _0x978ac0;}));_0x2718d2[_0x8eeb('0x90')](_0xb53193[_0x8eeb('0x112')]()[_0x8eeb('0x1e')](function(_0x4f219e){for(var _0x47c638=0x0;_0x47c638<_0x4f219e[_0x8eeb('0x73')];_0x47c638++){_0x4f219e[_0x47c638][_0x8eeb('0x111')]('channel',_0x8eeb('0x113'));}return _0x4f219e;}));_0x2718d2['push'](_0xb53193['getWhatsappQueues']()[_0x8eeb('0x1e')](function(_0x372b19){for(var _0x51615d=0x0;_0x51615d<_0x372b19[_0x8eeb('0x73')];_0x51615d++){_0x372b19[_0x51615d][_0x8eeb('0x111')](_0x8eeb('0xa1'),_0x8eeb('0x114'));}return _0x372b19;}));_0x2718d2[_0x8eeb('0x90')](_0xb53193[_0x8eeb('0x115')]()[_0x8eeb('0x1e')](function(_0x4a70d0){for(var _0x488741=0x0;_0x488741<_0x4a70d0['length'];_0x488741++){_0x4a70d0[_0x488741][_0x8eeb('0x111')](_0x8eeb('0xa1'),_0x8eeb('0x116'));}return _0x4a70d0;}));_0x2718d2[_0x8eeb('0x90')](_0xb53193[_0x8eeb('0x117')]()[_0x8eeb('0x1e')](function(_0x37ef99){for(var _0x30bf33=0x0;_0x30bf33<_0x37ef99['length'];_0x30bf33++){_0x37ef99[_0x30bf33][_0x8eeb('0x111')](_0x8eeb('0xa1'),'Openchannel');}return _0x37ef99;}));return BPromise[_0x8eeb('0x91')](_0x2718d2);})['then'](function(_0x24b05c){var _0xcd06d7=_[_0x8eeb('0x118')](_0x24b05c);_0x2718d2=[];return db['sequelize'][_0x8eeb('0x119')](function(_0x2a6ecd){for(var _0xae629c=0x0;_0xae629c<_0xcd06d7[_0x8eeb('0x73')];_0xae629c++){_0x2718d2[_0x8eeb('0x90')](_0xcd06d7[_0xae629c]['addAgent'](_0x9ce84e['id']),{'transaction':_0x2a6ecd});}return BPromise[_0x8eeb('0x91')](_0x2718d2)[_0x8eeb('0x1e')](function(){if(_0x9ce84e[_0x8eeb('0xa2')]){return BPromise[_0x8eeb('0x92')](_['filter'](_0xcd06d7,function(_0x9b405d){return _0x9b405d[_0x8eeb('0x11a')](_0x8eeb('0xa1'))==='Voice';}),function(_0x2240ae){return db[_0x8eeb('0xb1')][_0x8eeb('0xe8')]({'membername':_0x9ce84e[_0x8eeb('0x3e')],'UserId':_0x9ce84e['id'],'queue_name':_0x2240ae[_0x8eeb('0x3e')],'VoiceQueueId':_0x2240ae['id'],'interface':_[_0x8eeb('0x6e')](_0x9ce84e[_0x8eeb('0xa4')])?util[_0x8eeb('0xde')](_0x8eeb('0xb0'),_0x9ce84e[_0x8eeb('0x3e')]):_0x9ce84e[_0x8eeb('0xa4')],'paused':_0x9ce84e[_0x8eeb('0xa3')]||![],'penalty':_0x9ce84e['penalty']},{'transaction':_0x2a6ecd});});}else{return;}})[_0x8eeb('0x1e')](function(){for(var _0x3ee613=0x0;_0x3ee613<_0xcd06d7['length'];_0x3ee613++){var _0x152796=_0xcd06d7[_0x3ee613][_0x8eeb('0x11a')](_0x8eeb('0xa1'));var _0x34dd64=_0x152796+_0x8eeb('0x11b');socket['emit'](_0x8eeb('0x36')+_0x152796+_0x8eeb('0xad'),{'UserId':_0x9ce84e['id'],['queueField']:_0xcd06d7[_0x3ee613]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x1938f4,null))[_0x8eeb('0x5f')](handleError(_0x1938f4,null));};exports[_0x8eeb('0x11c')]=function(_0xa84e24,_0x17f2b4){return db['User']['findOne']({'where':{'id':_0xa84e24[_0x8eeb('0x60')]['id']}})['then'](handleEntityNotFound(_0x17f2b4,null))[_0x8eeb('0x1e')](function(_0x2b95d8){if(_0x2b95d8){var _0x4f9574=_0x2b95d8[_0x8eeb('0x32')]({'plain':!![]});var _0x236c0e=_0xa84e24[_0x8eeb('0x49')][_0x8eeb('0x67')];return _0x2b95d8[_0x8eeb('0x11c')](_0x236c0e)[_0x8eeb('0x1e')](function(){for(var _0x1b6d5f=0x0;_0x1b6d5f<_0x236c0e['length'];_0x1b6d5f++){var _0x21e6e5=[];db['Team'][_0x8eeb('0x9b')]({'where':{'id':_0x236c0e[_0x1b6d5f]}})['then'](function(_0x48a1fc){_0x21e6e5[_0x8eeb('0x90')](_0x48a1fc[_0x8eeb('0xe7')]()[_0x8eeb('0x1e')](function(_0x3c0b90){for(var _0x5b1dad=0x0;_0x5b1dad<_0x3c0b90[_0x8eeb('0x73')];_0x5b1dad++){_0x3c0b90[_0x5b1dad][_0x8eeb('0x111')](_0x8eeb('0xa1'),'Voice');}return _0x3c0b90;}));_0x21e6e5[_0x8eeb('0x90')](_0x48a1fc[_0x8eeb('0x11d')]()[_0x8eeb('0x1e')](function(_0x2a58ab){for(var _0x5edae9=0x0;_0x5edae9<_0x2a58ab[_0x8eeb('0x73')];_0x5edae9++){_0x2a58ab[_0x5edae9]['setDataValue'](_0x8eeb('0xa1'),_0x8eeb('0x10f'));}return _0x2a58ab;}));_0x21e6e5['push'](_0x48a1fc[_0x8eeb('0x110')]()['then'](function(_0x19ce87){for(var _0x2b103f=0x0;_0x2b103f<_0x19ce87[_0x8eeb('0x73')];_0x2b103f++){_0x19ce87[_0x2b103f][_0x8eeb('0x111')](_0x8eeb('0xa1'),_0x8eeb('0x11e'));}return _0x19ce87;}));_0x21e6e5[_0x8eeb('0x90')](_0x48a1fc[_0x8eeb('0x112')]()[_0x8eeb('0x1e')](function(_0x2c0cb2){for(var _0x47142c=0x0;_0x47142c<_0x2c0cb2[_0x8eeb('0x73')];_0x47142c++){_0x2c0cb2[_0x47142c][_0x8eeb('0x111')](_0x8eeb('0xa1'),_0x8eeb('0x113'));}return _0x2c0cb2;}));_0x21e6e5[_0x8eeb('0x90')](_0x48a1fc[_0x8eeb('0x11f')]()[_0x8eeb('0x1e')](function(_0xa11672){for(var _0x5d0d13=0x0;_0x5d0d13<_0xa11672[_0x8eeb('0x73')];_0x5d0d13++){_0xa11672[_0x5d0d13][_0x8eeb('0x111')](_0x8eeb('0xa1'),_0x8eeb('0x114'));}return _0xa11672;}));_0x21e6e5[_0x8eeb('0x90')](_0x48a1fc[_0x8eeb('0x115')]()['then'](function(_0x283a4b){for(var _0x4cbf09=0x0;_0x4cbf09<_0x283a4b[_0x8eeb('0x73')];_0x4cbf09++){_0x283a4b[_0x4cbf09][_0x8eeb('0x111')](_0x8eeb('0xa1'),_0x8eeb('0x116'));}return _0x283a4b;}));_0x21e6e5['push'](_0x48a1fc[_0x8eeb('0x117')]()[_0x8eeb('0x1e')](function(_0x5abb46){for(var _0x818c1f=0x0;_0x818c1f<_0x5abb46['length'];_0x818c1f++){_0x5abb46[_0x818c1f]['setDataValue'](_0x8eeb('0xa1'),_0x8eeb('0x120'));}return _0x5abb46;}));return BPromise[_0x8eeb('0x91')](_0x21e6e5);})[_0x8eeb('0x1e')](function(_0x7cf16e){var _0x115fc8=_[_0x8eeb('0x118')](_0x7cf16e);_0x21e6e5=[];return db['sequelize'][_0x8eeb('0x119')](function(_0x1bc090){for(var _0x57edf8=0x0;_0x57edf8<_0x115fc8[_0x8eeb('0x73')];_0x57edf8++){_0x21e6e5[_0x8eeb('0x90')](_0x115fc8[_0x57edf8]['removeAgent'](_0x4f9574['id']),{'transaction':_0x1bc090});}return BPromise[_0x8eeb('0x91')](_0x21e6e5)['then'](function(){if(_0x4f9574[_0x8eeb('0xa2')]){return BPromise['each'](_[_0x8eeb('0x58')](_0x115fc8,function(_0x3acc46){return _0x3acc46[_0x8eeb('0x11a')](_0x8eeb('0xa1'))===_0x8eeb('0x10e');}),function(_0x48a2c3){return db['UserVoiceQueueRt'][_0x8eeb('0x31')]({'where':{'VoiceQueueId':_0x48a2c3['id'],'UserId':_0x4f9574['id']},'transaction':_0x1bc090});});}else{return;}})['then'](function(){for(var _0x479e8a=0x0;_0x479e8a<_0x115fc8[_0x8eeb('0x73')];_0x479e8a++){var _0xf5f5c3=_0x115fc8[_0x479e8a][_0x8eeb('0x11a')](_0x8eeb('0xa1'));var _0x27121a=_0xf5f5c3+_0x8eeb('0x11b');socket[_0x8eeb('0xac')]('user'+_0xf5f5c3+_0x8eeb('0xb4'),{'UserId':_0x4f9574['id'],['queueField']:_0x115fc8[_0x479e8a]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x17f2b4,null))[_0x8eeb('0x5f')](handleError(_0x17f2b4,null));};exports[_0x8eeb('0x121')]=function(_0xe47ef4,_0x225eec,_0x58554a){var _0x215f93={};var _0xdd9119={};var _0x139553;var _0x329d21;return db[_0x8eeb('0x40')][_0x8eeb('0x9b')]({'where':{'id':_0xe47ef4[_0x8eeb('0x60')]['id']}})['then'](handleEntityNotFound(_0x225eec,null))['then'](function(_0x8e6a3a){if(_0x8e6a3a){_0x139553=_0x8e6a3a;_0xdd9119['model']=_[_0x8eeb('0x48')](db['CmList']['rawAttributes']);_0xdd9119['query']=_[_0x8eeb('0x48')](_0xe47ef4[_0x8eeb('0x49')]);_0xdd9119[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0xdd9119[_0x8eeb('0x4b')],_0xdd9119[_0x8eeb('0x49')]);_0x215f93[_0x8eeb('0x4d')]=_['intersection'](_0xdd9119[_0x8eeb('0x4b')],qs['fields'](_0xe47ef4[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x215f93[_0x8eeb('0x4d')]=_0x215f93[_0x8eeb('0x4d')][_0x8eeb('0x73')]?_0x215f93[_0x8eeb('0x4d')]:_0xdd9119[_0x8eeb('0x4b')];_0x215f93[_0x8eeb('0xbf')]=qs['sort'](_0xe47ef4[_0x8eeb('0x49')][_0x8eeb('0x50')]);_0x215f93['where']=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0xe47ef4['query'],_0xdd9119[_0x8eeb('0x51')]));if(_0xe47ef4[_0x8eeb('0x49')][_0x8eeb('0x58')]){_0x215f93['where']=_['merge'](_0x215f93['where'],{'$or':_[_0x8eeb('0x39')](_0x215f93[_0x8eeb('0x4d')],function(_0x2f2a75){var _0x100f48={};_0x100f48[_0x2f2a75]={'$like':'%'+_0xe47ef4[_0x8eeb('0x49')]['filter']+'%'};return _0x100f48;})});}_0x215f93=_[_0x8eeb('0x54')]({},_0x215f93,_0xe47ef4[_0x8eeb('0x59')]);return _0x139553['getLists'](_0x215f93);}})['then'](function(_0x23d493){if(_0x23d493){_0x329d21=_0x23d493[_0x8eeb('0x73')];if(!_0xe47ef4[_0x8eeb('0x49')][_0x8eeb('0x4e')]('nolimit')){_0x215f93[_0x8eeb('0x2c')]=qs[_0x8eeb('0x2c')](_0xe47ef4[_0x8eeb('0x49')]['limit']);_0x215f93[_0x8eeb('0x2b')]=qs[_0x8eeb('0x2b')](_0xe47ef4[_0x8eeb('0x49')][_0x8eeb('0x2b')]);}return _0x139553[_0x8eeb('0x121')](_0x215f93);}})[_0x8eeb('0x1e')](function(_0x44f72f){if(_0x44f72f){return _0x44f72f?{'count':_0x329d21,'rows':_0x44f72f}:null;}})[_0x8eeb('0x1e')](respondWithResult(_0x225eec,null))[_0x8eeb('0x5f')](handleError(_0x225eec,null));};exports[_0x8eeb('0x122')]=function(_0x19a68f,_0x2e4637,_0x51c3c5){var _0x20b8e6={};var _0x35beaa={};var _0xc2591e;var _0x34a96a;return db[_0x8eeb('0x40')]['findOne']({'where':{'id':_0x19a68f['params']['id']}})['then'](handleEntityNotFound(_0x2e4637,null))[_0x8eeb('0x1e')](function(_0x18bbf6){if(_0x18bbf6){_0xc2591e=_0x18bbf6;_0x35beaa[_0x8eeb('0x4b')]=_[_0x8eeb('0x48')](db[_0x8eeb('0x40')][_0x8eeb('0x41')]);_0x35beaa[_0x8eeb('0x49')]=_[_0x8eeb('0x48')](_0x19a68f['query']);_0x35beaa[_0x8eeb('0x51')]=_[_0x8eeb('0x4a')](_0x35beaa[_0x8eeb('0x4b')],_0x35beaa[_0x8eeb('0x49')]);_0x20b8e6[_0x8eeb('0x4d')]=_[_0x8eeb('0x4a')](_0x35beaa[_0x8eeb('0x4b')],qs[_0x8eeb('0x4c')](_0x19a68f[_0x8eeb('0x49')][_0x8eeb('0x4c')]));_0x20b8e6[_0x8eeb('0x4d')]=_0x20b8e6[_0x8eeb('0x4d')]['length']?_0x20b8e6[_0x8eeb('0x4d')]:_0x35beaa[_0x8eeb('0x4b')];_0x20b8e6[_0x8eeb('0xbf')]=qs[_0x8eeb('0x50')](_0x19a68f[_0x8eeb('0x49')]['sort']);_0x20b8e6[_0x8eeb('0x53')]=qs[_0x8eeb('0x51')](_[_0x8eeb('0x52')](_0x19a68f[_0x8eeb('0x49')],_0x35beaa['filters']));if(_0x19a68f[_0x8eeb('0x49')]['filter']){_0x20b8e6[_0x8eeb('0x53')]=_[_0x8eeb('0x54')](_0x20b8e6[_0x8eeb('0x53')],{'$or':_[_0x8eeb('0x39')](_0x20b8e6[_0x8eeb('0x4d')],function(_0x2e55a0){var _0x256175={};_0x256175[_0x2e55a0]={'$like':'%'+_0x19a68f[_0x8eeb('0x49')][_0x8eeb('0x58')]+'%'};return _0x256175;})});}_0x20b8e6['model']=db[_0x8eeb('0x40')];_0x20b8e6['as']=_0x8eeb('0x37');_0x20b8e6=_[_0x8eeb('0x54')]({},_0x20b8e6,_0x19a68f[_0x8eeb('0x59')]);return _0xc2591e[_0x8eeb('0xe7')]({'include':[_0x20b8e6]});}})['then'](function(_0x394b0e){if(_0x394b0e){var _0x225d51={},_0x5c1c86=[],_0x41c7a2=0x0;for(var _0x456b51=0x0;_0x456b51<_0x394b0e['length'];_0x456b51+=0x1){for(var _0x596369=0x0,_0x1ab451;_0x596369<_0x394b0e[_0x456b51][_0x8eeb('0x37')]['length'];_0x596369+=0x1){_0x1ab451=_0x394b0e[_0x456b51][_0x8eeb('0x37')][_0x596369][_0x8eeb('0x32')]({'plain':!![]});_0x225d51[_0x1ab451['id']]=_0x1ab451;}}_0x225d51=_[_0x8eeb('0x123')](_0x225d51);for(var _0x1d510e=qs[_0x8eeb('0x2b')](_0x19a68f[_0x8eeb('0x49')][_0x8eeb('0x2b')]);_0x1d510e<_0x225d51[_0x8eeb('0x73')]&&_0x5c1c86['length']=_0x49e4a4){_0x5e2236=_0x49e4a4;_0x1878e3=0xc8;}else{_0x1878e3=0xce;}_0x489407[_0x8a7a('0x2b')](_0x1878e3);return _0x489407['set'](_0x8a7a('0x2f'),_0x2842d3+'-'+_0x5e2236+'/'+_0x49e4a4)['json'](_0x1e0828);}return null;};}function patchUpdates(_0x1857e7){return function(_0x11c3c4){try{jsonpatch[_0x8a7a('0x30')](_0x11c3c4,_0x1857e7,!![]);}catch(_0x124bf0){return BPromise[_0x8a7a('0x31')](_0x124bf0);}return _0x11c3c4[_0x8a7a('0x32')]();};}function saveUpdates(_0x5a707d,_0x331ecf){return function(_0x1594e0){if(_0x1594e0){return _0x1594e0[_0x8a7a('0x33')](_0x5a707d)[_0x8a7a('0x20')](function(_0x9a657c){return _0x9a657c;});}return null;};}function removeEntity(_0x1f6fca,_0x3fea91){return function(_0x1624ae){if(_0x1624ae){return _0x1624ae[_0x8a7a('0x34')]()[_0x8a7a('0x20')](function(){var _0x11fcdb=_0x1624ae[_0x8a7a('0x35')]({'plain':!![]});if(_0x11fcdb[_0x8a7a('0x36')]===_0x8a7a('0x37'))return;var _0x48bcee=[{'name':'Users','value':_0x8a7a('0x38'),'ignore':!![]},{'name':_0x8a7a('0x39'),'value':_0x8a7a('0x3a'),'ignore':![]},{'name':_0x8a7a('0x3b'),'value':_0x8a7a('0x3c'),'ignore':![]}];var _0x2d6387=_(_0x48bcee)[_0x8a7a('0x3d')](_0x8a7a('0x3e'))['map'](_0x8a7a('0x3f'))[_0x8a7a('0x3f')]();if(_[_0x8a7a('0x40')](_0x2d6387,_0x11fcdb['role'])){return;}var _0x2e9031=_[_0x8a7a('0x41')](_0x48bcee,[_0x8a7a('0x3f'),_0x11fcdb[_0x8a7a('0x36')]])['name'];return db[_0x8a7a('0x42')][_0x8a7a('0x34')]({'where':{'type':_0x2e9031,'resourceId':_0x11fcdb['id']}})[_0x8a7a('0x20')](function(){return _0x1624ae;});})[_0x8a7a('0x20')](function(){_0x1f6fca[_0x8a7a('0x2b')](0xcc)[_0x8a7a('0x2a')]();});}};}function handleEntityNotFound(_0x5f2e22,_0x3eaf89){return function(_0x51acad){if(!_0x51acad){_0x5f2e22[_0x8a7a('0x43')](0x194);}return _0x51acad;};}function handleError(_0x43d65e,_0x57b252){_0x57b252=_0x57b252||0x1f4;return function(_0x52cca2){logger[_0x8a7a('0x26')](_0x52cca2[_0x8a7a('0x44')]);if(_0x52cca2['name']){delete _0x52cca2['name'];}_0x43d65e[_0x8a7a('0x2b')](_0x57b252)[_0x8a7a('0x45')](_0x52cca2);};}exports[_0x8a7a('0x46')]=function(_0x1fdcd3,_0x4a9564){var _0x2bdd63={},_0x594fcc={},_0x4652e5={'count':0x0,'rows':[]};var _0x277dec=_[_0x8a7a('0x47')](db['User'][_0x8a7a('0x48')],function(_0x5e2fa5){return{'name':_0x5e2fa5[_0x8a7a('0x49')],'type':_0x5e2fa5['type'][_0x8a7a('0x4a')]};});_0x594fcc[_0x8a7a('0x4b')]=_[_0x8a7a('0x4c')](_['map'](_0x277dec,'name'),[_0x8a7a('0x4d'),_0x8a7a('0x4e')]);_0x594fcc[_0x8a7a('0x4f')]=_['keys'](_0x1fdcd3[_0x8a7a('0x4f')]);_0x594fcc['filters']=_[_0x8a7a('0x50')](_0x594fcc[_0x8a7a('0x4b')],_0x594fcc[_0x8a7a('0x4f')]);_0x2bdd63[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0x594fcc['model'],qs[_0x8a7a('0x52')](_0x1fdcd3[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x2bdd63['attributes']=_0x2bdd63['attributes'][_0x8a7a('0x53')]?_0x2bdd63[_0x8a7a('0x51')]:_0x594fcc['model'];if(!_0x1fdcd3[_0x8a7a('0x4f')][_0x8a7a('0x54')]('nolimit')){_0x2bdd63[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x1fdcd3[_0x8a7a('0x4f')][_0x8a7a('0x2e')]);_0x2bdd63['offset']=qs[_0x8a7a('0x2d')](_0x1fdcd3['query'][_0x8a7a('0x2d')]);}_0x2bdd63[_0x8a7a('0x55')]=qs[_0x8a7a('0x56')](_0x1fdcd3[_0x8a7a('0x4f')][_0x8a7a('0x56')]);_0x2bdd63[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_['pick'](_0x1fdcd3[_0x8a7a('0x4f')],_0x594fcc[_0x8a7a('0x58')]),_0x277dec);if(_0x1fdcd3[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x2bdd63[_0x8a7a('0x57')]=_['merge'](_0x2bdd63['where'],{'$or':_[_0x8a7a('0x47')](_0x277dec,function(_0xa747a4){if(_0xa747a4[_0x8a7a('0x59')]!=='VIRTUAL'){return db[_0x8a7a('0x5a')][_0x8a7a('0x57')](db['sequelize']['fn'](_0x8a7a('0x5b'),db[_0x8a7a('0x5a')][_0x8a7a('0x5c')](_0xa747a4[_0x8a7a('0x5d')])),{'$like':db[_0x8a7a('0x5a')]['fn']('lower','%'+_0x1fdcd3[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%')});}})});}_0x2bdd63=_[_0x8a7a('0x5e')]({},_0x2bdd63,_0x1fdcd3['options']);var _0x18abfe={'where':_0x2bdd63[_0x8a7a('0x57')]};return db[_0x8a7a('0x5f')][_0x8a7a('0x60')](_0x18abfe)['then'](function(_0x116072){_0x4652e5['count']=_0x116072;if(_0x1fdcd3[_0x8a7a('0x4f')]['includeAll']){_0x2bdd63[_0x8a7a('0x61')]=[{'all':!![]}];}return db['User']['findAll'](_0x2bdd63);})[_0x8a7a('0x20')](function(_0x535417){_0x4652e5[_0x8a7a('0x62')]=_0x535417;return _0x4652e5;})['then'](respondWithFilteredResult(_0x4a9564,_0x2bdd63))[_0x8a7a('0x63')](handleError(_0x4a9564,null));};exports[_0x8a7a('0x64')]=function(_0x5575b7,_0x332dab){var _0x95b4c8={'raw':![],'where':{'id':_0x5575b7['params']['id']}},_0x868bde={};_0x868bde[_0x8a7a('0x4b')]=_['differenceBy'](_[_0x8a7a('0x65')](db[_0x8a7a('0x5f')][_0x8a7a('0x48')]),[_0x8a7a('0x4d'),_0x8a7a('0x4e')]);_0x868bde[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x5575b7[_0x8a7a('0x4f')]);_0x868bde['filters']=_[_0x8a7a('0x50')](_0x868bde[_0x8a7a('0x4b')],_0x868bde[_0x8a7a('0x4f')]);_0x95b4c8['attributes']=_['intersection'](_0x868bde[_0x8a7a('0x4b')],qs['fields'](_0x5575b7[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x95b4c8[_0x8a7a('0x51')]=_0x95b4c8[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x95b4c8[_0x8a7a('0x51')]:_0x868bde[_0x8a7a('0x4b')];if(_0x5575b7[_0x8a7a('0x4f')][_0x8a7a('0x66')]){_0x95b4c8['include']=[{'all':!![]}];}_0x95b4c8=_[_0x8a7a('0x5e')]({},_0x95b4c8,_0x5575b7[_0x8a7a('0x67')]);return db[_0x8a7a('0x5f')][_0x8a7a('0x41')](_0x95b4c8)[_0x8a7a('0x20')](handleEntityNotFound(_0x332dab,null))[_0x8a7a('0x20')](respondWithResult(_0x332dab,null))[_0x8a7a('0x63')](handleError(_0x332dab,null));};exports[_0x8a7a('0x33')]=function(_0x5eb2e1,_0x3566c3){if(_0x5eb2e1[_0x8a7a('0x68')]['id']){delete _0x5eb2e1[_0x8a7a('0x68')]['id'];}delete _0x5eb2e1['body'][_0x8a7a('0x36')];return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x5eb2e1[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x3566c3,null))[_0x8a7a('0x20')](saveUpdates(_0x5eb2e1[_0x8a7a('0x68')],null))['then'](respondWithResult(_0x3566c3,null))['catch'](handleError(_0x3566c3,null));};exports[_0x8a7a('0x6a')]=function(_0x1cc18e,_0x1174a6){return db[_0x8a7a('0x5f')]['describe']()[_0x8a7a('0x20')](respondWithResult(_0x1174a6,null))[_0x8a7a('0x63')](handleError(_0x1174a6,null));};exports[_0x8a7a('0x6b')]=function(_0x310457,_0x1826f9,_0x3df847){return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x310457['params']['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x1826f9,null))[_0x8a7a('0x20')](function(_0x461ef9){if(_0x461ef9){return _0x461ef9[_0x8a7a('0x6b')](_0x310457[_0x8a7a('0x68')]['ids'],_[_0x8a7a('0x6c')](_0x310457[_0x8a7a('0x68')],[_0x8a7a('0x6d'),'id'])||{});}})[_0x8a7a('0x20')](respondWithResult(_0x1826f9,null))['catch'](handleError(_0x1826f9,null));};function validateUser(_0x38586a){return new BPromise(function(_0x4352c9,_0x1d51eb){if(_0x38586a['internal'])return _0x4352c9(_0x38586a);return db['Setting']['findById'](0x1)[_0x8a7a('0x20')](function(_0x507122){if(_0x507122[_0x8a7a('0x6e')])authService[_0x8a7a('0x6f')](_0x38586a[_0x8a7a('0x4d')]);db[_0x8a7a('0x5f')][_0x8a7a('0x70')](_0x8a7a('0x71'))[_0x8a7a('0x20')](function(_0x287dc3){if(_['isNil'](_0x287dc3)){_0x38586a[_0x8a7a('0x71')]=_0x507122[_0x8a7a('0x72')]||0x1;return;}if(_[_0x8a7a('0x73')](_0x507122[_0x8a7a('0x72')])||_0x507122[_0x8a7a('0x72')]===_0x287dc3){_0x38586a['internal']=_0x287dc3+0x1;return;}if(_0x507122[_0x8a7a('0x72')]>_0x287dc3){_0x38586a[_0x8a7a('0x71')]=_0x507122[_0x8a7a('0x72')];return;}return db[_0x8a7a('0x5a')][_0x8a7a('0x4f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x8a7a('0x5a')][_0x8a7a('0x74')][_0x8a7a('0x75')]})[_0x8a7a('0x20')](function(_0xcc99d2){if(_0xcc99d2&&_0xcc99d2[_0x8a7a('0x53')]){for(var _0x5bcec1=0x0,_0x1da166=_0xcc99d2[_0x8a7a('0x53')];_0x5bcec1<_0x1da166&&_['isNil'](_0x38586a[_0x8a7a('0x71')]);_0x5bcec1++){if(_0x507122[_0x8a7a('0x72')]<=_0xcc99d2[_0x5bcec1][_0x8a7a('0x76')]){_0x38586a['internal']=_0xcc99d2[_0x5bcec1][_0x8a7a('0x76')];}else if(_0x507122['min_internal']>_0xcc99d2[_0x5bcec1][_0x8a7a('0x76')]&&_0x507122[_0x8a7a('0x72')]<=_0xcc99d2[_0x5bcec1]['to']){_0x38586a['internal']=_0x507122[_0x8a7a('0x72')];}}}if(_[_0x8a7a('0x73')](_0x38586a[_0x8a7a('0x71')])){_0x38586a[_0x8a7a('0x71')]=_0x287dc3+0x1;}return _0x4352c9(_0x38586a);});});})[_0x8a7a('0x63')](function(_0x49003f){_0x1d51eb(_0x49003f);});});}function updateUser(_0x132eb0){return new BPromise(function(_0x23523b,_0x3c11f9){try{if(_0x132eb0[_0x8a7a('0x77')]){_0x132eb0[_0x8a7a('0x78')]=_0x132eb0[_0x8a7a('0x71')];_0x132eb0[_0x8a7a('0x79')]={'mailbox':_0x132eb0[_0x8a7a('0x71')],'password':_0x132eb0[_0x8a7a('0x4d')],'fullname':_0x132eb0[_0x8a7a('0x7a')],'email':_0x132eb0[_0x8a7a('0x7b')]};}if(_0x132eb0[_0x8a7a('0x36')]===_0x8a7a('0x3a')){if(!_0x132eb0[_0x8a7a('0x7c')])_0x132eb0[_0x8a7a('0x7c')]=['101',_0x8a7a('0x7d'),_0x8a7a('0x7e'),_0x8a7a('0x7f'),_0x8a7a('0x80'),_0x8a7a('0x81'),'105',_0x8a7a('0x82'),_0x8a7a('0x83'),_0x8a7a('0x84'),_0x8a7a('0x85'),_0x8a7a('0x86'),_0x8a7a('0x87'),'114'];}_0x23523b(_0x132eb0);}catch(_0x5d68c6){_0x3c11f9(_0x5d68c6);}});}exports[_0x8a7a('0x88')]=function(_0x435432,_0x38f17b){if(_0x435432[_0x8a7a('0x38')]['role']==='agent')throw new Error(_0x8a7a('0x89'));if(_0x435432[_0x8a7a('0x68')][_0x8a7a('0x36')]==='user'&&_0x435432[_0x8a7a('0x38')][_0x8a7a('0x36')]!==_0x8a7a('0x37')){throw new Error(_0x8a7a('0x8a'));}if(_0x435432['body'][_0x8a7a('0x36')]==='admin'&&_0x435432['user'][_0x8a7a('0x36')]!==_0x8a7a('0x37')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x8a7a('0x8b')]([_0x435432[_0x8a7a('0x68')]])[_0x8a7a('0x20')](function(){return validateUser(_0x435432[_0x8a7a('0x68')]);})[_0x8a7a('0x20')](function(_0x240172){return updateUser(_0x240172)[_0x8a7a('0x20')](function(_0x3a2732){if(_0x3a2732[_0x8a7a('0x36')]===_0x8a7a('0x37')){_0x3a2732[_0x8a7a('0x8c')]=_0x435432['user'][_0x8a7a('0x8c')];delete _0x3a2732[_0x8a7a('0x8d')];}return _0x3a2732;});})[_0x8a7a('0x20')](function(_0x219b7e){return db[_0x8a7a('0x5f')][_0x8a7a('0x88')](_0x219b7e,{'include':[{'model':db[_0x8a7a('0x79')],'as':_0x8a7a('0x79')}]});})[_0x8a7a('0x20')](function(_0x4289af){if(_0x435432[_0x8a7a('0x68')]['role']==='user')return _0x4289af;if(_0x435432[_0x8a7a('0x38')]['role']!=='user')return _0x4289af;return db[_0x8a7a('0x8e')]['find']({'where':{'name':_0x4289af[_0x8a7a('0x36')]===_0x8a7a('0x3a')?_0x8a7a('0x39'):_0x8a7a('0x3b'),'userProfileId':_0x435432['user']['userProfileId']},'raw':!![]})['then'](function(_0x33c2c6){if(!_0x33c2c6||_0x33c2c6['autoAssociation']!=0x0)return _0x4289af;return db['UserProfileResource'][_0x8a7a('0x88')]({'name':_0x4289af['name'],'resourceId':_0x4289af['id'],'type':_0x33c2c6[_0x8a7a('0x5d')],'sectionId':_0x33c2c6['id']},{})[_0x8a7a('0x20')](function(){return _0x4289af;});})[_0x8a7a('0x63')](function(_0x1e9a36){logger[_0x8a7a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e9a36);throw _0x1e9a36;});})[_0x8a7a('0x20')](respondWithResult(_0x38f17b,0xc9))[_0x8a7a('0x63')](handleError(_0x38f17b,null));};exports['bulkCreate']=function(_0x1cc120,_0x2f8ee2){var _0x3ab32b=_0x1cc120[_0x8a7a('0x68')];var _0x27c300=[];if(_0x1cc120[_0x8a7a('0x38')][_0x8a7a('0x36')]===_0x8a7a('0x3a'))throw new Error(_0x8a7a('0x89'));if(_['some'](_0x3ab32b,[_0x8a7a('0x36'),'user'])&&_0x1cc120[_0x8a7a('0x38')][_0x8a7a('0x36')]!==_0x8a7a('0x37')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x8a7a('0x8f')](_0x3ab32b,['role',_0x8a7a('0x37')])&&_0x1cc120[_0x8a7a('0x38')][_0x8a7a('0x36')]!==_0x8a7a('0x37')){throw new Error(_0x8a7a('0x90'));}return licenseUtil[_0x8a7a('0x8b')](_0x3ab32b)['then'](function(){return validateUser(_0x3ab32b[0x0]);})[_0x8a7a('0x20')](function(){for(var _0x19e606=0x1;_0x19e606<_0x3ab32b[_0x8a7a('0x53')];_0x19e606++){var _0x2a7010=_0x3ab32b[_0x19e606-0x1]['internal'];if(!_0x3ab32b[_0x19e606]['internal'])_0x3ab32b[_0x19e606][_0x8a7a('0x71')]=_0x2a7010+0x1;_0x27c300['push'](validateUser(_0x3ab32b[_0x19e606]));}return BPromise[_0x8a7a('0x91')](_0x27c300);})[_0x8a7a('0x20')](function(){_0x27c300=[];for(var _0x36e42b=0x0;_0x36e42b<_0x3ab32b[_0x8a7a('0x53')];_0x36e42b++){_0x27c300['push'](updateUser(_0x3ab32b[_0x36e42b]));}return BPromise[_0x8a7a('0x91')](_0x27c300);})[_0x8a7a('0x20')](function(){return BPromise[_0x8a7a('0x92')](_0x3ab32b,function(_0x2b9526){return db['User'][_0x8a7a('0x88')](_0x2b9526,{'include':[{'model':db[_0x8a7a('0x79')],'as':_0x8a7a('0x79')}]})[_0x8a7a('0x20')](function(_0x45d7ae){_0x2b9526['id']=_0x45d7ae['id'];return _0x2b9526;});});})[_0x8a7a('0x20')](function(_0x522f65){if(_0x1cc120[_0x8a7a('0x68')][_0x8a7a('0x36')]==='user')return _0x522f65;if(_0x1cc120[_0x8a7a('0x38')][_0x8a7a('0x36')]!==_0x8a7a('0x38'))return _0x522f65;var _0x4711c5=_['some'](_0x522f65,function(_0x622b5a){return _0x622b5a[_0x8a7a('0x36')]===_0x8a7a('0x3a')||_0x622b5a[_0x8a7a('0x36')]===_0x8a7a('0x3c');});if(!_0x4711c5)return _0x522f65;return db['UserProfileSection'][_0x8a7a('0x93')]({'where':{'name':{'$or':[_0x8a7a('0x39'),_0x8a7a('0x3b')]},'userProfileId':_0x1cc120[_0x8a7a('0x38')][_0x8a7a('0x8d')]},'raw':!![]})['then'](function(_0x554704){if(_[_0x8a7a('0x94')](_0x554704)||!_[_0x8a7a('0x8f')](_0x554704,[_0x8a7a('0x95'),0x0]))return _0x522f65;_0x27c300=[];var _0x11c53f=_(_0x554704)['map'](function(_0x4ac171){if(_0x4ac171[_0x8a7a('0x95')]===0x1)return;return _0x4ac171[_0x8a7a('0x5d')]==='Agents'?_0x8a7a('0x3a'):_0x8a7a('0x3c');})[_0x8a7a('0x96')]()[_0x8a7a('0x3f')]();for(var _0x432fa2=0x0;_0x432fa2<_0x522f65[_0x8a7a('0x53')];_0x432fa2++){if(!_[_0x8a7a('0x40')](_0x11c53f,_0x522f65[_0x432fa2][_0x8a7a('0x36')]))return;var _0x1fae22=_0x522f65[_0x432fa2][_0x8a7a('0x36')]==='agent'?_0x8a7a('0x39'):_0x8a7a('0x3b');_0x27c300[_0x8a7a('0x97')](db['UserProfileResource'][_0x8a7a('0x88')]({'name':_0x522f65[_0x432fa2][_0x8a7a('0x5d')],'resourceId':_0x522f65[_0x432fa2]['id'],'type':_0x1fae22,'sectionId':_[_0x8a7a('0x41')](_0x554704,[_0x8a7a('0x5d'),_0x1fae22])['id']},{}));}return BPromise[_0x8a7a('0x91')](_0x27c300);})[_0x8a7a('0x20')](respondWithResult(_0x2f8ee2,0xc9))['catch'](handleError(_0x2f8ee2,null));});};exports[_0x8a7a('0x98')]=function(_0x1f83e6,_0x7c056d,_0x4f49a0){if(_0x1f83e6[_0x8a7a('0x68')]['id']){delete _0x1f83e6[_0x8a7a('0x68')]['id'];}return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x1f83e6[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](function(_0x1d4a70){if(!_0x1d4a70)return null;if(_0x1d4a70['id']===_0x1f83e6[_0x8a7a('0x38')]['id']){if(!_0x1f83e6[_0x8a7a('0x68')][_0x8a7a('0x99')]||!_0x1f83e6['body'][_0x8a7a('0x9a')]){throw new db['Sequelize'][(_0x8a7a('0x9b'))](_0x8a7a('0x9c'));}if(!_0x1d4a70[_0x8a7a('0x9d')](_0x1f83e6[_0x8a7a('0x68')]['oldPassword'])){throw new db[(_0x8a7a('0x9e'))][(_0x8a7a('0x9b'))](_0x8a7a('0x9f'));}if(_0x1f83e6[_0x8a7a('0x68')][_0x8a7a('0x99')]===_0x1f83e6[_0x8a7a('0x68')][_0x8a7a('0x9a')]){throw new db[(_0x8a7a('0x9e'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1f83e6[_0x8a7a('0x38')][_0x8a7a('0x36')]==='admin'){if(!_0x1f83e6[_0x8a7a('0x68')]['newPassword']){throw new db[(_0x8a7a('0x9e'))][(_0x8a7a('0x9b'))](_0x8a7a('0xa0'));}}else if(_0x1f83e6['user']['role']==='user'){if(!_0x1f83e6[_0x8a7a('0x68')][_0x8a7a('0x9a')]){throw new db[(_0x8a7a('0x9e'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1d4a70['role']!==_0x8a7a('0x3a')){throw new db[(_0x8a7a('0x9e'))][(_0x8a7a('0x9b'))]('Unauthorized');}}else{throw new db[(_0x8a7a('0x9e'))]['ValidationError'](_0x8a7a('0x89'));}return _0x1d4a70;})[_0x8a7a('0x20')](handleEntityNotFound(_0x7c056d,null))[_0x8a7a('0x20')](function(_0x60b2e4){return db[_0x8a7a('0xa1')][_0x8a7a('0xa2')]({'attributes':['id','securePassword',_0x8a7a('0xa3'),_0x8a7a('0xa4')]})[_0x8a7a('0x20')](function(_0x475373){if(_0x475373['securePassword'])authService[_0x8a7a('0x6f')](_0x1f83e6['body']['newPassword']);if(!_0x475373['enforcePasswordHistory']||!_0x60b2e4[_0x8a7a('0xa5')])return _0x60b2e4;authService[_0x8a7a('0xa6')](_0x1f83e6[_0x8a7a('0x68')]['newPassword'],_0x60b2e4[_0x8a7a('0xa5')],_0x475373[_0x8a7a('0xa4')]);return _0x60b2e4;})[_0x8a7a('0x20')](saveUpdates({'password':_0x1f83e6[_0x8a7a('0x68')][_0x8a7a('0x9a')],'passwordResetAt':_0x1f83e6['user']['id']==_0x1f83e6[_0x8a7a('0x69')]['id']?moment():null,'previousPasswords':authService[_0x8a7a('0xa7')](_0x1f83e6[_0x8a7a('0x68')][_0x8a7a('0x9a')],_0x60b2e4[_0x8a7a('0xa5')])},null));})[_0x8a7a('0x20')](respondWithResult(_0x7c056d,null))[_0x8a7a('0x63')](handleError(_0x7c056d,null));};exports[_0x8a7a('0xa8')]=function(_0x2fc9ad,_0x3bde23,_0x1c033e){var _0x4933b4=_0x2fc9ad['body'][_0x8a7a('0xa9')];return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x2fc9ad[_0x8a7a('0x69')]['id']},'attributes':['id',_0x8a7a('0x5d'),_0x8a7a('0x36'),'online',_0x8a7a('0xaa'),'voicePause',_0x8a7a('0xab')]})['then'](handleEntityNotFound(_0x3bde23,null))[_0x8a7a('0x20')](function(_0x47b542){if(_0x47b542){if(!utils[_0x8a7a('0xac')](_0x4933b4)){throw new db[(_0x8a7a('0x9e'))][(_0x8a7a('0x9b'))]('Unknown\x20channel');}return _0x47b542[_0x8a7a('0xad')+_[_0x8a7a('0xae')](_0x4933b4[_0x8a7a('0xaf')]())+_0x8a7a('0xb0')](_0x2fc9ad[_0x8a7a('0x68')][_0x8a7a('0x6d')],{'penalty':_0x2fc9ad['body'][_0x8a7a('0xb1')]||0x0})['spread'](function(_0x510921){for(var _0x54105a=0x0;_0x54105a<_0x2fc9ad[_0x8a7a('0x68')][_0x8a7a('0x6d')][_0x8a7a('0x53')];_0x54105a+=0x1){var _0x4dceeb={'UserId':_0x2fc9ad[_0x8a7a('0x69')]['id']};_0x4dceeb[_[_0x8a7a('0xae')](_0x4933b4[_0x8a7a('0xaf')]())+_0x8a7a('0xb2')]=_0x2fc9ad[_0x8a7a('0x68')][_0x8a7a('0x6d')][_0x54105a];socket['emit'](_0x8a7a('0x38')+_[_0x8a7a('0xae')](_0x4933b4[_0x8a7a('0xaf')]())+_0x8a7a('0xb3'),_0x4dceeb);}return _0x510921;})[_0x8a7a('0x20')](function(){if(_0x4933b4===_0x8a7a('0xb4')){return db[_0x8a7a('0xb5')][_0x8a7a('0x93')]({'where':{'id':_0x2fc9ad['body'][_0x8a7a('0x6d')]||[]},'raw':!![],'attributes':['id',_0x8a7a('0x5d')]});}})[_0x8a7a('0x20')](function(_0xb6a19d){var _0x1b3b99=_0x47b542['get']({'plain':!![]});var _0x4d05f0=[];if(_0x4933b4===_0x8a7a('0xb4')&&_0x1b3b99[_0x8a7a('0x36')]===_0x8a7a('0x3a')&&_0x1b3b99['online']){for(var _0x542a1e=0x0;_0x542a1e<_0xb6a19d[_0x8a7a('0x53')];_0x542a1e+=0x1){_0x4d05f0[_0x8a7a('0x97')]({'membername':_0x1b3b99[_0x8a7a('0x5d')],'UserId':_0x1b3b99['id'],'queue_name':_0xb6a19d[_0x542a1e][_0x8a7a('0x5d')],'VoiceQueueId':_0xb6a19d[_0x542a1e]['id'],'interface':_[_0x8a7a('0x73')](_0x1b3b99['interface'])?util[_0x8a7a('0xb6')](_0x8a7a('0xb7'),_0x1b3b99[_0x8a7a('0x5d')]):_0x1b3b99[_0x8a7a('0xab')],'paused':_0x1b3b99[_0x8a7a('0xb8')]||![],'penalty':_0x2fc9ad['body'][_0x8a7a('0xb1')]||0x0});}return BPromise[_0x8a7a('0x92')](_0x4d05f0,function(_0x5d5c18){return db[_0x8a7a('0xb9')][_0x8a7a('0xba')](_0x5d5c18);});}return _0x47b542;});}})[_0x8a7a('0x20')](respondWithStatusCode(_0x3bde23,null))[_0x8a7a('0x63')](handleError(_0x3bde23,null));};exports['removeQueues']=function(_0x7c34e8,_0x2dfdce,_0x13d37d){var _0x442720;return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x7c34e8[_0x8a7a('0x69')]['id']},'attributes':['id',_0x8a7a('0x5d'),_0x8a7a('0x36')]})[_0x8a7a('0x20')](handleEntityNotFound(_0x2dfdce,null))[_0x8a7a('0x20')](function(_0x334f3d){if(_0x334f3d){_0x442720=_0x334f3d;if(!_0x7c34e8[_0x8a7a('0x4f')][_0x8a7a('0xa9')]||!utils['isValidChannel'](_0x7c34e8[_0x8a7a('0x4f')]['channel'])){throw new db[(_0x8a7a('0x9e'))]['ValidationError'](_0x8a7a('0xbb'));}return _0x334f3d[_0x8a7a('0xbc')+_['capitalize'](_0x7c34e8[_0x8a7a('0x4f')][_0x8a7a('0xa9')]['toLowerCase']())+_0x8a7a('0xb0')](_0x7c34e8[_0x8a7a('0x4f')][_0x8a7a('0x6d')]);}})[_0x8a7a('0x20')](function(_0xa03816){for(var _0x6af7fb=0x0;_0x6af7fb<_0x7c34e8['query'][_0x8a7a('0x6d')][_0x8a7a('0x53')];_0x6af7fb+=0x1){var _0x1a29ba={'UserId':_0x7c34e8['params']['id']};_0x1a29ba[_[_0x8a7a('0xae')](_0x7c34e8['query']['channel']['toLowerCase']())+'QueueId']=_0x7c34e8['query'][_0x8a7a('0x6d')][_0x6af7fb];socket['emit'](_0x8a7a('0x38')+_[_0x8a7a('0xae')](_0x7c34e8['query'][_0x8a7a('0xa9')][_0x8a7a('0xaf')]())+_0x8a7a('0xbd'),_0x1a29ba);}return _0xa03816;})[_0x8a7a('0x20')](function(){if(_0x7c34e8[_0x8a7a('0x4f')][_0x8a7a('0xa9')]==='voice'){return db[_0x8a7a('0xb9')][_0x8a7a('0x34')]({'where':{'UserId':_0x7c34e8[_0x8a7a('0x69')]['id'],'VoiceQueueId':_0x7c34e8['query']['ids']},'individualHooks':!![]})[_0x8a7a('0x20')](function(){return _0x442720;});}return _0x442720;})[_0x8a7a('0x20')](respondWithStatusCode(_0x2dfdce,null))['catch'](handleError(_0x2dfdce,null));};exports[_0x8a7a('0xbe')]=function(_0x4f2454,_0x3146a6,_0x51f867){_0x4f2454['body'][_0x8a7a('0xbf')]=_0x4f2454[_0x8a7a('0xc0')][_0x8a7a('0xc1')];return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x4f2454[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x3146a6,null))[_0x8a7a('0x20')](saveUpdates(_0x4f2454['body'],null))['then'](respondWithResult(_0x3146a6,null))[_0x8a7a('0x63')](handleError(_0x3146a6,null));};exports['getAvatar']=function(_0x55df5e,_0x33fe30,_0x2971a1){var _0x125ec0=path['join'](config[_0x8a7a('0xc2')],'server/files/images/logos/default_profile.png');return db['User'][_0x8a7a('0x41')]({'where':{'id':_0x55df5e[_0x8a7a('0x69')]['id']},'attributes':['id',_0x8a7a('0xbf')],'raw':!![]})[_0x8a7a('0x20')](handleEntityNotFound(_0x33fe30,null))[_0x8a7a('0x20')](function(_0x1875d3){if(_0x1875d3){if(_['isNil'](_0x1875d3[_0x8a7a('0xbf')])){return _0x33fe30['download'](_0x125ec0);}else{if(!fs[_0x8a7a('0xc3')](path[_0x8a7a('0xc4')](config[_0x8a7a('0xc2')],_0x8a7a('0xc5'),_0x1875d3[_0x8a7a('0xbf')]))){return _0x33fe30[_0x8a7a('0xc6')](_0x125ec0);}return _0x33fe30[_0x8a7a('0xc6')](path[_0x8a7a('0xc4')](config['root'],_0x8a7a('0xc5'),_0x1875d3[_0x8a7a('0xbf')]));}}})[_0x8a7a('0x63')](handleError(_0x33fe30,null));};exports[_0x8a7a('0xc7')]=function(_0x46a084,_0x10a21c,_0x2240e7){var _0x170cc5={};var _0x1764dc={};var _0x304693;var _0x595d18;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x46a084[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x10a21c,null))[_0x8a7a('0x20')](function(_0x5b1897){if(_0x5b1897){_0x304693=_0x5b1897;_0x1764dc[_0x8a7a('0x4b')]=_['keys'](db['CmContact'][_0x8a7a('0x48')]);_0x1764dc[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x46a084[_0x8a7a('0x4f')]);_0x1764dc[_0x8a7a('0x58')]=_['intersection'](_0x1764dc[_0x8a7a('0x4b')],_0x1764dc[_0x8a7a('0x4f')]);_0x170cc5['attributes']=_['intersection'](_0x1764dc[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x46a084[_0x8a7a('0x4f')]['fields']));_0x170cc5[_0x8a7a('0x51')]=_0x170cc5['attributes']['length']?_0x170cc5[_0x8a7a('0x51')]:_0x1764dc[_0x8a7a('0x4b')];_0x170cc5['order']=qs['sort'](_0x46a084['query'][_0x8a7a('0x56')]);_0x170cc5[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x46a084[_0x8a7a('0x4f')],_0x1764dc[_0x8a7a('0x58')]));if(_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x170cc5[_0x8a7a('0x57')]=_['merge'](_0x170cc5['where'],{'$or':_[_0x8a7a('0x47')](_0x170cc5[_0x8a7a('0x51')],function(_0x464fc3){var _0x48bca5={};_0x48bca5[_0x464fc3]={'$like':'%'+_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x48bca5;})});}_0x170cc5=_['merge']({},_0x170cc5,_0x46a084['options']);return _0x304693[_0x8a7a('0xc7')](_0x170cc5);}})[_0x8a7a('0x20')](function(_0x45c28f){if(_0x45c28f){_0x595d18=_0x45c28f[_0x8a7a('0x53')];if(_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0x54')](_0x8a7a('0x66'))){_0x170cc5['include']=[{'model':db[_0x8a7a('0xc9')],'as':_0x8a7a('0xca'),'required':![]},{'model':db[_0x8a7a('0xcb')],'as':'Tags','attributes':['id',_0x8a7a('0x5d'),_0x8a7a('0xcc')],'where':_0x46a084['query']['tag']?{'id':_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0xcd')]}:undefined,'required':_0x46a084['query'][_0x8a7a('0xcd')]?!![]:![]}];}if(!_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0x54')]('nolimit')){_0x170cc5[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0x2e')]);_0x170cc5['offset']=qs['offset'](_0x46a084[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}return _0x304693['getContacts'](_0x170cc5);}})[_0x8a7a('0x20')](function(_0x2bcc22){if(_0x2bcc22){return _0x2bcc22?{'count':_0x595d18,'rows':_0x2bcc22}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x10a21c,null))['catch'](handleError(_0x10a21c,null));};exports[_0x8a7a('0xce')]=function(_0x454491,_0x4153db,_0x2308c3){var _0x3253e4;var _0x3e407a;var _0x5e5bb3={};var _0x4ba35c;return db['User'][_0x8a7a('0xa2')]({'where':{'id':_0x454491[_0x8a7a('0x69')]['id']},'attributes':['id',_0x8a7a('0x5d'),_0x8a7a('0x36')]})[_0x8a7a('0x20')](handleEntityNotFound(_0x4153db,null))[_0x8a7a('0x20')](function(_0x1bc44b){if(!utils['isValidChannel'](_0x454491[_0x8a7a('0x4f')][_0x8a7a('0xa9')])){throw new db[(_0x8a7a('0x9e'))]['ValidationError'](_0x8a7a('0xbb'));}_0x3253e4=_0x1bc44b;var _0x2d4a17={};_0x2d4a17['model']=_[_0x8a7a('0x65')](db[_['capitalize'](_0x454491[_0x8a7a('0x4f')][_0x8a7a('0xa9')])+_0x8a7a('0xcf')][_0x8a7a('0x48')]);_0x2d4a17[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x454491[_0x8a7a('0x4f')]);_0x2d4a17[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0x2d4a17[_0x8a7a('0x4b')],_0x2d4a17[_0x8a7a('0x4f')]);_0x5e5bb3['attributes']=_['intersection'](_0x2d4a17[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x454491['query'][_0x8a7a('0x52')]));_0x5e5bb3[_0x8a7a('0x51')]=_0x5e5bb3[_0x8a7a('0x51')]['length']?_0x5e5bb3[_0x8a7a('0x51')]:_0x2d4a17[_0x8a7a('0x4b')];_0x5e5bb3[_0x8a7a('0x55')]=qs[_0x8a7a('0x56')](_0x454491[_0x8a7a('0x4f')]['sort']);_0x5e5bb3[_0x8a7a('0x57')]=qs['filters'](_[_0x8a7a('0xc8')](_0x454491[_0x8a7a('0x4f')],_0x2d4a17[_0x8a7a('0x58')]));if(_0x454491['query'][_0x8a7a('0x3d')]){_0x5e5bb3[_0x8a7a('0x57')]=_[_0x8a7a('0x5e')](_0x5e5bb3[_0x8a7a('0x57')],{'$or':_[_0x8a7a('0x47')](_0x5e5bb3[_0x8a7a('0x51')],function(_0x38b67f){var _0x3edd18={};_0x3edd18[_0x38b67f]={'$like':'%'+_0x454491[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x3edd18;})});}_0x5e5bb3=_['merge']({},_0x5e5bb3,_0x454491['options']);switch(_0x3253e4['role']){case _0x8a7a('0x37'):return db[_[_0x8a7a('0xae')](_0x454491[_0x8a7a('0x4f')][_0x8a7a('0xa9')])+_0x8a7a('0xcf')][_0x8a7a('0x93')](_0x5e5bb3);case _0x8a7a('0x38'):case'agent':return _0x3253e4['get'+_[_0x8a7a('0xae')](_0x454491[_0x8a7a('0x4f')][_0x8a7a('0xa9')])+_0x8a7a('0xb0')](_0x5e5bb3);default:throw new db['Sequelize'][(_0x8a7a('0x9b'))](_0x8a7a('0xd0'));}})['then'](function(_0x3210df){_0x4ba35c=_0x3210df[_0x8a7a('0x53')];if(!_0x454491['query'][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x5e5bb3[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x454491['query']['limit']);_0x5e5bb3[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x454491[_0x8a7a('0x4f')]['offset']);}switch(_0x3253e4[_0x8a7a('0x36')]){case _0x8a7a('0x37'):return db[_[_0x8a7a('0xae')](_0x454491['query'][_0x8a7a('0xa9')])+_0x8a7a('0xcf')][_0x8a7a('0x93')](_0x5e5bb3);case _0x8a7a('0x38'):case'agent':return _0x3253e4[_0x8a7a('0x35')+_['capitalize'](_0x454491[_0x8a7a('0x4f')][_0x8a7a('0xa9')])+_0x8a7a('0xb0')](_0x5e5bb3);}})['then'](function(_0x950074){return{'count':_0x4ba35c,'rows':_0x950074};})[_0x8a7a('0x20')](respondWithResult(_0x4153db,null))[_0x8a7a('0x63')](handleError(_0x4153db,null));};exports[_0x8a7a('0xd2')]=function(_0x39302e,_0x56a558,_0x2d3bbd){var _0x501396={};var _0xdf5c4f={};var _0x21611b;var _0x3c072c;return db['User'][_0x8a7a('0xa2')]({'where':{'id':_0x39302e['params']['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x56a558,null))[_0x8a7a('0x20')](function(_0x1b8b35){if(_0x1b8b35){_0x21611b=_0x1b8b35;_0xdf5c4f[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xb9')][_0x8a7a('0x48')]);_0xdf5c4f[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x39302e[_0x8a7a('0x4f')]);_0xdf5c4f['filters']=_[_0x8a7a('0x50')](_0xdf5c4f['model'],_0xdf5c4f[_0x8a7a('0x4f')]);_0x501396[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0xdf5c4f[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x39302e[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x501396[_0x8a7a('0x51')]=_0x501396[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x501396[_0x8a7a('0x51')]:_0xdf5c4f[_0x8a7a('0x4b')];_0x501396[_0x8a7a('0x55')]=qs[_0x8a7a('0x56')](_0x39302e[_0x8a7a('0x4f')][_0x8a7a('0x56')]);_0x501396[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x39302e['query'],_0xdf5c4f[_0x8a7a('0x58')]));if(_0x39302e[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x501396[_0x8a7a('0x57')]=_['merge'](_0x501396[_0x8a7a('0x57')],{'$or':_[_0x8a7a('0x47')](_0x501396[_0x8a7a('0x51')],function(_0x5277e1){var _0x40a109={};_0x40a109[_0x5277e1]={'$like':'%'+_0x39302e['query'][_0x8a7a('0x3d')]+'%'};return _0x40a109;})});}_0x501396=_[_0x8a7a('0x5e')]({},_0x501396,_0x39302e[_0x8a7a('0x67')]);return _0x21611b['getVoiceQueuesRt'](_0x501396);}})[_0x8a7a('0x20')](function(_0xa8db25){if(_0xa8db25){_0x3c072c=_0xa8db25['length'];if(!_0x39302e[_0x8a7a('0x4f')]['hasOwnProperty'](_0x8a7a('0xd1'))){_0x501396[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x39302e[_0x8a7a('0x4f')]['limit']);_0x501396[_0x8a7a('0x2d')]=qs['offset'](_0x39302e['query'][_0x8a7a('0x2d')]);}return _0x21611b[_0x8a7a('0xd2')](_0x501396);}})[_0x8a7a('0x20')](function(_0x152d40){if(_0x152d40){return _0x152d40?{'count':_0x3c072c,'rows':_0x152d40}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x56a558,null))['catch'](handleError(_0x56a558,null));};exports[_0x8a7a('0xd3')]=function(_0x24d955,_0x95c4f3,_0x3ae446){var _0x24e84c={};var _0xe06f2e={};var _0x2ce599;var _0x5b5e70;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x24d955['params']['id']}})['then'](handleEntityNotFound(_0x95c4f3,null))[_0x8a7a('0x20')](function(_0x4ec191){if(_0x4ec191){_0x2ce599=_0x4ec191;_0xe06f2e[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xd4')]['rawAttributes']);_0xe06f2e['query']=_['keys'](_0x24d955['query']);_0xe06f2e[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0xe06f2e[_0x8a7a('0x4b')],_0xe06f2e[_0x8a7a('0x4f')]);_0x24e84c['attributes']=_[_0x8a7a('0x50')](_0xe06f2e[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x24d955['query'][_0x8a7a('0x52')]));_0x24e84c[_0x8a7a('0x51')]=_0x24e84c[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x24e84c['attributes']:_0xe06f2e[_0x8a7a('0x4b')];_0x24e84c[_0x8a7a('0x55')]=qs['sort'](_0x24d955['query'][_0x8a7a('0x56')]);_0x24e84c[_0x8a7a('0x57')]=qs['filters'](_[_0x8a7a('0xc8')](_0x24d955[_0x8a7a('0x4f')],_0xe06f2e[_0x8a7a('0x58')]));if(_0x24d955['query']['filter']){_0x24e84c['where']=_[_0x8a7a('0x5e')](_0x24e84c['where'],{'$or':_[_0x8a7a('0x47')](_0x24e84c[_0x8a7a('0x51')],function(_0x44a380){var _0x42ffc9={};_0x42ffc9[_0x44a380]={'$like':'%'+_0x24d955[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x42ffc9;})});}_0x24e84c=_['merge']({},_0x24e84c,_0x24d955[_0x8a7a('0x67')]);return _0x2ce599['getGroups'](_0x24e84c);}})[_0x8a7a('0x20')](function(_0x4810cf){if(_0x4810cf){_0x5b5e70=_0x4810cf[_0x8a7a('0x53')];if(!_0x24d955[_0x8a7a('0x4f')][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x24e84c['limit']=qs[_0x8a7a('0x2e')](_0x24d955['query'][_0x8a7a('0x2e')]);_0x24e84c[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x24d955[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}return _0x2ce599[_0x8a7a('0xd3')](_0x24e84c);}})[_0x8a7a('0x20')](function(_0x3e5b49){if(_0x3e5b49){return _0x3e5b49?{'count':_0x5b5e70,'rows':_0x3e5b49}:null;}})['then'](respondWithResult(_0x95c4f3,null))[_0x8a7a('0x63')](handleError(_0x95c4f3,null));};exports[_0x8a7a('0xd5')]=function(_0x1b6b55,_0x4110c0,_0x2765b1){var _0x4f11c9={'raw':!![],'where':{}};var _0x4883e0={};var _0x1f4b78={'count':0x0,'rows':[]};return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x1b6b55['params']['id']}})['then'](handleEntityNotFound(_0x4110c0,null))[_0x8a7a('0x20')](function(_0xe8542a){if(_0xe8542a){_0x4883e0[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db['VoiceRecording'][_0x8a7a('0x48')]);_0x4883e0[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x1b6b55[_0x8a7a('0x4f')]);_0x4883e0[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0x4883e0['model'],_0x4883e0[_0x8a7a('0x4f')]);_0x4f11c9[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0x4883e0['model'],qs[_0x8a7a('0x52')](_0x1b6b55[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x4f11c9[_0x8a7a('0x51')]=_0x4f11c9['attributes'][_0x8a7a('0x53')]?_0x4f11c9[_0x8a7a('0x51')]:_0x4883e0['model'];if(!_0x1b6b55[_0x8a7a('0x4f')][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x4f11c9[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x1b6b55[_0x8a7a('0x4f')][_0x8a7a('0x2e')]);_0x4f11c9[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x1b6b55['query'][_0x8a7a('0x2d')]);}_0x4f11c9[_0x8a7a('0x55')]=qs['sort'](_0x1b6b55[_0x8a7a('0x4f')]['sort']);_0x4f11c9[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x1b6b55['query'],_0x4883e0[_0x8a7a('0x58')]));_0x4f11c9[_0x8a7a('0x57')]['UserId']=_0xe8542a['id'];if(_0x1b6b55['query'][_0x8a7a('0x3d')]){_0x4f11c9[_0x8a7a('0x57')]=_['merge'](_0x4f11c9[_0x8a7a('0x57')],{'$or':_[_0x8a7a('0x47')](_0x4f11c9[_0x8a7a('0x51')],function(_0x370a86){var _0x3ab356={};_0x3ab356[_0x370a86]={'$like':'%'+_0x1b6b55[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x3ab356;})});}_0x4f11c9=_[_0x8a7a('0x5e')]({},_0x4f11c9,_0x1b6b55[_0x8a7a('0x67')]);return db['VoiceRecording']['count']({'where':_0x4f11c9[_0x8a7a('0x57')]})[_0x8a7a('0x20')](function(_0x19cadd){_0x1f4b78[_0x8a7a('0x60')]=_0x19cadd;if(_0x1b6b55[_0x8a7a('0x4f')][_0x8a7a('0x66')]){_0x4f11c9[_0x8a7a('0x61')]=[{'all':!![]}];}return db['VoiceRecording'][_0x8a7a('0x93')](_0x4f11c9);})['then'](function(_0x346f17){_0x1f4b78[_0x8a7a('0x62')]=_0x346f17;return _0x1f4b78;});}})[_0x8a7a('0x20')](respondWithFilteredResult(_0x4110c0,_0x4f11c9))['catch'](handleError(_0x4110c0,null));};exports[_0x8a7a('0xd6')]=function(_0x71ec61,_0x327c0a,_0x1a4f12){var _0x2860e5={'raw':!![],'where':{}};var _0x5e2897={};var _0x1eb0f0={'count':0x0,'rows':[]};return db['User'][_0x8a7a('0xa2')]({'where':{'id':_0x71ec61[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x327c0a,null))['then'](function(_0x5ee16c){if(_0x5ee16c){_0x5e2897[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xd7')]['rawAttributes']);_0x5e2897[_0x8a7a('0x4f')]=_['keys'](_0x71ec61[_0x8a7a('0x4f')]);_0x5e2897[_0x8a7a('0x58')]=_['intersection'](_0x5e2897['model'],_0x5e2897[_0x8a7a('0x4f')]);_0x2860e5['attributes']=_[_0x8a7a('0x50')](_0x5e2897[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x71ec61[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x2860e5['attributes']=_0x2860e5[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x2860e5[_0x8a7a('0x51')]:_0x5e2897['model'];if(!_0x71ec61[_0x8a7a('0x4f')][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x2860e5[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x71ec61['query'][_0x8a7a('0x2e')]);_0x2860e5['offset']=qs[_0x8a7a('0x2d')](_0x71ec61[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}_0x2860e5['order']=qs['sort'](_0x71ec61['query'][_0x8a7a('0x56')]);_0x2860e5[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_['pick'](_0x71ec61[_0x8a7a('0x4f')],_0x5e2897['filters']));_0x2860e5[_0x8a7a('0x57')][_0x8a7a('0xd8')]=_0x5ee16c['id'];if(_0x71ec61['query']['filter']){_0x2860e5[_0x8a7a('0x57')]=_[_0x8a7a('0x5e')](_0x2860e5[_0x8a7a('0x57')],{'$or':_['map'](_0x2860e5['attributes'],function(_0x25bb70){var _0x5dfbbc={};_0x5dfbbc[_0x25bb70]={'$like':'%'+_0x71ec61['query']['filter']+'%'};return _0x5dfbbc;})});}_0x2860e5=_[_0x8a7a('0x5e')]({},_0x2860e5,_0x71ec61[_0x8a7a('0x67')]);return db[_0x8a7a('0xd7')][_0x8a7a('0x60')]({'where':_0x2860e5[_0x8a7a('0x57')]})[_0x8a7a('0x20')](function(_0x401ca3){_0x1eb0f0[_0x8a7a('0x60')]=_0x401ca3;if(_0x71ec61[_0x8a7a('0x4f')][_0x8a7a('0x66')]){_0x2860e5[_0x8a7a('0x61')]=[{'all':!![]}];}return db[_0x8a7a('0xd7')][_0x8a7a('0x93')](_0x2860e5);})[_0x8a7a('0x20')](function(_0x386aca){_0x1eb0f0[_0x8a7a('0x62')]=_0x386aca;return _0x1eb0f0;});}})[_0x8a7a('0x20')](respondWithFilteredResult(_0x327c0a,_0x2860e5))[_0x8a7a('0x63')](handleError(_0x327c0a,null));};exports[_0x8a7a('0xd9')]=function(_0x501f63,_0x131a29,_0x126b30){var _0x48538b={};var _0x84e10c={};var _0x8d41b4;var _0x572466;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x501f63[_0x8a7a('0x69')]['id']}})['then'](handleEntityNotFound(_0x131a29,null))[_0x8a7a('0x20')](function(_0x319849){if(_0x319849){_0x8d41b4=_0x319849;_0x84e10c[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xda')][_0x8a7a('0x48')]);_0x84e10c[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x501f63[_0x8a7a('0x4f')]);_0x84e10c[_0x8a7a('0x58')]=_['intersection'](_0x84e10c[_0x8a7a('0x4b')],_0x84e10c['query']);_0x48538b[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0x84e10c[_0x8a7a('0x4b')],qs['fields'](_0x501f63['query'][_0x8a7a('0x52')]));_0x48538b[_0x8a7a('0x51')]=_0x48538b[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x48538b[_0x8a7a('0x51')]:_0x84e10c[_0x8a7a('0x4b')];_0x48538b[_0x8a7a('0x55')]=qs[_0x8a7a('0x56')](_0x501f63['query'][_0x8a7a('0x56')]);_0x48538b[_0x8a7a('0x57')]=qs['filters'](_['pick'](_0x501f63['query'],_0x84e10c['filters']));if(_0x501f63[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x48538b[_0x8a7a('0x57')]=_['merge'](_0x48538b[_0x8a7a('0x57')],{'$or':_[_0x8a7a('0x47')](_0x48538b[_0x8a7a('0x51')],function(_0x2f9677){var _0x5ed149={};_0x5ed149[_0x2f9677]={'$like':'%'+_0x501f63['query'][_0x8a7a('0x3d')]+'%'};return _0x5ed149;})});}_0x48538b=_[_0x8a7a('0x5e')]({},_0x48538b,_0x501f63[_0x8a7a('0x67')]);return _0x8d41b4['getChatInteractions'](_0x48538b);}})['then'](function(_0x1e722f){if(_0x1e722f){_0x572466=_0x1e722f[_0x8a7a('0x53')];if(!_0x501f63[_0x8a7a('0x4f')][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x48538b[_0x8a7a('0x2e')]=qs['limit'](_0x501f63[_0x8a7a('0x4f')]['limit']);_0x48538b[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x501f63['query'][_0x8a7a('0x2d')]);}return _0x8d41b4[_0x8a7a('0xd9')](_0x48538b);}})[_0x8a7a('0x20')](function(_0x20d61f){if(_0x20d61f){return _0x20d61f?{'count':_0x572466,'rows':_0x20d61f}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x131a29,null))[_0x8a7a('0x63')](handleError(_0x131a29,null));};exports['getOpenchannelInteractions']=function(_0x3dfbd3,_0x51479f,_0x2c36a5){var _0x46aabf={};var _0x1924dd={};var _0x205faf;var _0x2a9124;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x3dfbd3[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x51479f,null))['then'](function(_0x58357b){if(_0x58357b){_0x205faf=_0x58357b;_0x1924dd[_0x8a7a('0x4b')]=_['keys'](db[_0x8a7a('0xdb')]['rawAttributes']);_0x1924dd[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x3dfbd3[_0x8a7a('0x4f')]);_0x1924dd[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0x1924dd['model'],_0x1924dd[_0x8a7a('0x4f')]);_0x46aabf[_0x8a7a('0x51')]=_['intersection'](_0x1924dd[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x3dfbd3[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x46aabf[_0x8a7a('0x51')]=_0x46aabf[_0x8a7a('0x51')]['length']?_0x46aabf[_0x8a7a('0x51')]:_0x1924dd[_0x8a7a('0x4b')];_0x46aabf[_0x8a7a('0x55')]=qs['sort'](_0x3dfbd3[_0x8a7a('0x4f')][_0x8a7a('0x56')]);_0x46aabf['where']=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x3dfbd3['query'],_0x1924dd[_0x8a7a('0x58')]));if(_0x3dfbd3[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x46aabf[_0x8a7a('0x57')]=_[_0x8a7a('0x5e')](_0x46aabf['where'],{'$or':_[_0x8a7a('0x47')](_0x46aabf[_0x8a7a('0x51')],function(_0x3ea594){var _0x572279={};_0x572279[_0x3ea594]={'$like':'%'+_0x3dfbd3['query']['filter']+'%'};return _0x572279;})});}_0x46aabf=_[_0x8a7a('0x5e')]({},_0x46aabf,_0x3dfbd3[_0x8a7a('0x67')]);return _0x205faf['getOpenchannelInteractions'](_0x46aabf);}})[_0x8a7a('0x20')](function(_0x51b5f7){if(_0x51b5f7){_0x2a9124=_0x51b5f7[_0x8a7a('0x53')];if(!_0x3dfbd3['query'][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x46aabf[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x3dfbd3[_0x8a7a('0x4f')]['limit']);_0x46aabf[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x3dfbd3[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}return _0x205faf['getOpenchannelInteractions'](_0x46aabf);}})['then'](function(_0x2a9dff){if(_0x2a9dff){return _0x2a9dff?{'count':_0x2a9124,'rows':_0x2a9dff}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x51479f,null))['catch'](handleError(_0x51479f,null));};exports[_0x8a7a('0xdc')]=function(_0x411b70,_0x3e2cca,_0x350b83){var _0x37921a={'raw':!![],'where':{}};var _0x5885f2={};var _0x5ea90d={'count':0x0,'rows':[]};return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x411b70[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x3e2cca,null))[_0x8a7a('0x20')](function(_0xecd2fb){if(_0xecd2fb){_0x5885f2[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db['MailInteraction']['rawAttributes']);_0x5885f2[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x411b70['query']);_0x5885f2[_0x8a7a('0x58')]=_['intersection'](_0x5885f2['model'],_0x5885f2[_0x8a7a('0x4f')]);_0x37921a['attributes']=_['intersection'](_0x5885f2[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x411b70[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x37921a[_0x8a7a('0x51')]=_0x37921a[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x37921a['attributes']:_0x5885f2[_0x8a7a('0x4b')];if(!_0x411b70[_0x8a7a('0x4f')]['hasOwnProperty'](_0x8a7a('0xd1'))){_0x37921a['limit']=qs[_0x8a7a('0x2e')](_0x411b70[_0x8a7a('0x4f')]['limit']);_0x37921a[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x411b70[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}_0x37921a['order']=qs[_0x8a7a('0x56')](_0x411b70[_0x8a7a('0x4f')]['sort']);_0x37921a[_0x8a7a('0x57')]=qs['filters'](_[_0x8a7a('0xc8')](_0x411b70[_0x8a7a('0x4f')],_0x5885f2[_0x8a7a('0x58')]));_0x37921a['where'][_0x8a7a('0xd8')]=_0xecd2fb['id'];if(_0x411b70[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x37921a[_0x8a7a('0x57')]=_['merge'](_0x37921a['where'],{'$or':_[_0x8a7a('0x47')](_0x37921a[_0x8a7a('0x51')],function(_0x30027a){var _0x364bd0={};_0x364bd0[_0x30027a]={'$like':'%'+_0x411b70[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x364bd0;})});}_0x37921a=_['merge']({},_0x37921a,_0x411b70[_0x8a7a('0x67')]);return db[_0x8a7a('0xdd')]['count']({'where':_0x37921a[_0x8a7a('0x57')]})[_0x8a7a('0x20')](function(_0x4948dd){_0x5ea90d[_0x8a7a('0x60')]=_0x4948dd;if(_0x411b70[_0x8a7a('0x4f')][_0x8a7a('0x66')]){_0x37921a[_0x8a7a('0x61')]=[{'all':!![]}];}return db[_0x8a7a('0xdd')][_0x8a7a('0x93')](_0x37921a);})['then'](function(_0xfb4eba){_0x5ea90d[_0x8a7a('0x62')]=_0xfb4eba;return _0x5ea90d;});}})[_0x8a7a('0x20')](respondWithFilteredResult(_0x3e2cca,_0x37921a))[_0x8a7a('0x63')](handleError(_0x3e2cca,null));};exports[_0x8a7a('0xde')]=function(_0x11e1a6,_0xcc8d4f,_0x5384a1){var _0x2f8339={};var _0x34c18c={};var _0x49f7c4;var _0xfd2d4a;return db['User'][_0x8a7a('0xa2')]({'where':{'id':_0x11e1a6[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0xcc8d4f,null))[_0x8a7a('0x20')](function(_0x1e0ca5){if(_0x1e0ca5){_0x49f7c4=_0x1e0ca5;_0x34c18c['model']=_[_0x8a7a('0x65')](db[_0x8a7a('0xdf')]['rawAttributes']);_0x34c18c[_0x8a7a('0x4f')]=_['keys'](_0x11e1a6[_0x8a7a('0x4f')]);_0x34c18c[_0x8a7a('0x58')]=_['intersection'](_0x34c18c[_0x8a7a('0x4b')],_0x34c18c[_0x8a7a('0x4f')]);_0x2f8339[_0x8a7a('0x51')]=_['intersection'](_0x34c18c[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x11e1a6[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x2f8339[_0x8a7a('0x51')]=_0x2f8339[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x2f8339['attributes']:_0x34c18c[_0x8a7a('0x4b')];_0x2f8339[_0x8a7a('0x55')]=qs[_0x8a7a('0x56')](_0x11e1a6['query']['sort']);_0x2f8339[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x11e1a6[_0x8a7a('0x4f')],_0x34c18c['filters']));if(_0x11e1a6[_0x8a7a('0x4f')]['filter']){_0x2f8339[_0x8a7a('0x57')]=_['merge'](_0x2f8339['where'],{'$or':_[_0x8a7a('0x47')](_0x2f8339[_0x8a7a('0x51')],function(_0x257b32){var _0x311320={};_0x311320[_0x257b32]={'$like':'%'+_0x11e1a6['query'][_0x8a7a('0x3d')]+'%'};return _0x311320;})});}_0x2f8339=_[_0x8a7a('0x5e')]({},_0x2f8339,_0x11e1a6[_0x8a7a('0x67')]);return _0x49f7c4[_0x8a7a('0xde')](_0x2f8339);}})[_0x8a7a('0x20')](function(_0x2ce003){if(_0x2ce003){_0xfd2d4a=_0x2ce003[_0x8a7a('0x53')];if(!_0x11e1a6[_0x8a7a('0x4f')][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x2f8339['limit']=qs[_0x8a7a('0x2e')](_0x11e1a6[_0x8a7a('0x4f')][_0x8a7a('0x2e')]);_0x2f8339[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x11e1a6[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}return _0x49f7c4[_0x8a7a('0xde')](_0x2f8339);}})[_0x8a7a('0x20')](function(_0x49d863){if(_0x49d863){return _0x49d863?{'count':_0xfd2d4a,'rows':_0x49d863}:null;}})[_0x8a7a('0x20')](respondWithResult(_0xcc8d4f,null))['catch'](handleError(_0xcc8d4f,null));};exports[_0x8a7a('0xe0')]=function(_0x398aa5,_0x5388bd,_0x5ed1c5){var _0x1ceb1c={};var _0x1de374={};var _0x4a556a;var _0x43dbd1;return db[_0x8a7a('0x5f')]['findOne']({'where':{'id':_0x398aa5[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x5388bd,null))[_0x8a7a('0x20')](function(_0x43cc88){if(_0x43cc88){_0x4a556a=_0x43cc88;_0x1de374[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xe1')][_0x8a7a('0x48')]);_0x1de374[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x398aa5[_0x8a7a('0x4f')]);_0x1de374[_0x8a7a('0x58')]=_['intersection'](_0x1de374[_0x8a7a('0x4b')],_0x1de374['query']);_0x1ceb1c[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0x1de374[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x398aa5[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x1ceb1c[_0x8a7a('0x51')]=_0x1ceb1c['attributes'][_0x8a7a('0x53')]?_0x1ceb1c[_0x8a7a('0x51')]:_0x1de374[_0x8a7a('0x4b')];_0x1ceb1c['order']=qs[_0x8a7a('0x56')](_0x398aa5[_0x8a7a('0x4f')][_0x8a7a('0x56')]);_0x1ceb1c[_0x8a7a('0x57')]=qs['filters'](_['pick'](_0x398aa5[_0x8a7a('0x4f')],_0x1de374[_0x8a7a('0x58')]));if(_0x398aa5[_0x8a7a('0x4f')]['filter']){_0x1ceb1c[_0x8a7a('0x57')]=_['merge'](_0x1ceb1c['where'],{'$or':_[_0x8a7a('0x47')](_0x1ceb1c[_0x8a7a('0x51')],function(_0x21831d){var _0x3d9c07={};_0x3d9c07[_0x21831d]={'$like':'%'+_0x398aa5[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x3d9c07;})});}_0x1ceb1c=_[_0x8a7a('0x5e')]({},_0x1ceb1c,_0x398aa5[_0x8a7a('0x67')]);return _0x4a556a['getFaxInteractions'](_0x1ceb1c);}})['then'](function(_0x1888c8){if(_0x1888c8){_0x43dbd1=_0x1888c8[_0x8a7a('0x53')];if(!_0x398aa5[_0x8a7a('0x4f')]['hasOwnProperty'](_0x8a7a('0xd1'))){_0x1ceb1c[_0x8a7a('0x2e')]=qs['limit'](_0x398aa5['query'][_0x8a7a('0x2e')]);_0x1ceb1c[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x398aa5[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);}return _0x4a556a[_0x8a7a('0xe0')](_0x1ceb1c);}})[_0x8a7a('0x20')](function(_0xaf44ab){if(_0xaf44ab){return _0xaf44ab?{'count':_0x43dbd1,'rows':_0xaf44ab}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x5388bd,null))[_0x8a7a('0x63')](handleError(_0x5388bd,null));};exports[_0x8a7a('0xe2')]=function(_0x863eb1,_0x395b1b,_0x1a8de8){var _0x5cbcd7={};var _0x38fec8={};var _0x435cda;var _0x3677b6;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x863eb1[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x395b1b,null))[_0x8a7a('0x20')](function(_0x45087c){if(_0x45087c){_0x435cda=_0x45087c;_0x38fec8[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xe3')][_0x8a7a('0x48')]);_0x38fec8[_0x8a7a('0x4f')]=_[_0x8a7a('0x65')](_0x863eb1[_0x8a7a('0x4f')]);_0x38fec8[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0x38fec8[_0x8a7a('0x4b')],_0x38fec8[_0x8a7a('0x4f')]);_0x5cbcd7[_0x8a7a('0x51')]=_['intersection'](_0x38fec8[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x863eb1['query'][_0x8a7a('0x52')]));_0x5cbcd7[_0x8a7a('0x51')]=_0x5cbcd7[_0x8a7a('0x51')]['length']?_0x5cbcd7['attributes']:_0x38fec8[_0x8a7a('0x4b')];_0x5cbcd7['order']=qs[_0x8a7a('0x56')](_0x863eb1[_0x8a7a('0x4f')][_0x8a7a('0x56')]);_0x5cbcd7[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_['pick'](_0x863eb1[_0x8a7a('0x4f')],_0x38fec8[_0x8a7a('0x58')]));if(_0x863eb1['query'][_0x8a7a('0x3d')]){_0x5cbcd7[_0x8a7a('0x57')]=_[_0x8a7a('0x5e')](_0x5cbcd7[_0x8a7a('0x57')],{'$or':_[_0x8a7a('0x47')](_0x5cbcd7[_0x8a7a('0x51')],function(_0x327588){var _0x383464={};_0x383464[_0x327588]={'$like':'%'+_0x863eb1[_0x8a7a('0x4f')]['filter']+'%'};return _0x383464;})});}_0x5cbcd7=_['merge']({},_0x5cbcd7,_0x863eb1[_0x8a7a('0x67')]);return _0x435cda[_0x8a7a('0xe2')](_0x5cbcd7);}})['then'](function(_0x511629){if(_0x511629){_0x3677b6=_0x511629[_0x8a7a('0x53')];if(!_0x863eb1['query'][_0x8a7a('0x54')](_0x8a7a('0xd1'))){_0x5cbcd7[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x863eb1['query']['limit']);_0x5cbcd7[_0x8a7a('0x2d')]=qs['offset'](_0x863eb1[_0x8a7a('0x4f')]['offset']);}return _0x435cda[_0x8a7a('0xe2')](_0x5cbcd7);}})[_0x8a7a('0x20')](function(_0x424550){if(_0x424550){return _0x424550?{'count':_0x3677b6,'rows':_0x424550}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x395b1b,null))['catch'](handleError(_0x395b1b,null));};exports['login']=function(_0x404f14,_0x3786ed,_0x4917e5){var _0x2cd11c;var _0x5ce038;var _0x36ee81;var _0xe5909d=!_[_0x8a7a('0x73')](_0x404f14['params']['id'])?_0x404f14[_0x8a7a('0x69')]['id']:!_[_0x8a7a('0x73')](_0x404f14[_0x8a7a('0x38')]['id'])?_0x404f14[_0x8a7a('0x38')]['id']:null;return db['User'][_0x8a7a('0x41')]({'where':{'id':_0xe5909d,'role':{'$or':['admin','user',_0x8a7a('0x3a')]}},'attributes':['id',_0x8a7a('0x5d'),_0x8a7a('0xe4'),'mobile',_0x8a7a('0x36'),_0x8a7a('0x71'),'loginInPause']})['then'](function(_0x194b80){if(_0x194b80){if(_0x194b80[_0x8a7a('0x36')]===_0x8a7a('0x3a')){_0x2cd11c=_0x194b80;if(_0x404f14[_0x8a7a('0x68')][_0x8a7a('0xab')]){_0x36ee81=util['format'](_0x8a7a('0xe5'),_0x2cd11c[_0x404f14['body'][_0x8a7a('0xab')]]);}else if(_0x404f14[_0x8a7a('0x68')][_0x8a7a('0xe6')]){_0x36ee81=util[_0x8a7a('0xb6')](_0x8a7a('0xb7'),_0x404f14[_0x8a7a('0x68')]['intrf']);}else{_0x36ee81=util[_0x8a7a('0xb6')](_0x8a7a('0xb7'),_0x2cd11c[_0x8a7a('0x5d')]);}socket['to'](util[_0x8a7a('0xb6')](_0x8a7a('0xe7'),_0x2cd11c[_0x8a7a('0x5d')]))['emit'](_0x8a7a('0xe8'),{'ip':_0x404f14['headers'][_0x8a7a('0xe9')]||_0x404f14[_0x8a7a('0xea')][_0x8a7a('0xeb')]||_0x404f14['socket'][_0x8a7a('0xeb')]||_0x404f14[_0x8a7a('0xea')][_0x8a7a('0xec')][_0x8a7a('0xeb')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2cd11c[_0x8a7a('0x5d')]},'individualHooks':!![]});}}else{throw new db[(_0x8a7a('0x9e'))][(_0x8a7a('0x9b'))](_0x8a7a('0xed'));}})[_0x8a7a('0x20')](function(){if(_0x2cd11c){return _0x2cd11c['getVoiceQueues']({'raw':!![]});}})[_0x8a7a('0x20')](function(_0x1e4e15){if(_0x2cd11c){var _0x3008ab=[];if(_0x1e4e15){_0x5ce038=_0x1e4e15;if(_0x5ce038[_0x8a7a('0x53')]){for(var _0x2bc21d=0x0;_0x2bc21d<_0x5ce038[_0x8a7a('0x53')];_0x2bc21d++){_0x3008ab[_0x8a7a('0x97')]({'membername':_0x2cd11c[_0x8a7a('0x5d')],'UserId':_0x2cd11c['id'],'queue_name':_0x5ce038[_0x2bc21d][_0x8a7a('0x5d')],'VoiceQueueId':_0x5ce038[_0x2bc21d]['id'],'interface':_0x36ee81,'paused':_0x2cd11c[_0x8a7a('0xaa')]||![],'penalty':_0x5ce038[_0x2bc21d][_0x8a7a('0xee')]||0x0});}return BPromise[_0x8a7a('0x92')](_0x3008ab,function(_0x50c796){return db[_0x8a7a('0xb9')][_0x8a7a('0xba')](_0x50c796);});}}}})[_0x8a7a('0x20')](function(){if(_0x2cd11c){return db[_0x8a7a('0xef')][_0x8a7a('0x93')]({'where':{'membername':_0x2cd11c[_0x8a7a('0x5d')],'exitAt':null}});}})[_0x8a7a('0x20')](function(_0x2e3957){if(_0x2cd11c){var _0x4010ca=[];_0x2e3957['forEach'](function(_0x18ba90){_0x4010ca['push'](_0x18ba90[_0x8a7a('0x33')]({'exitAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0'))}));});return BPromise[_0x8a7a('0x91')](_0x4010ca);}})['then'](function(){if(_0x2cd11c){var _0x2c65cc=[];var _0x2b6435=[];var _0x232efa=utils['getChannels']();var _0x1b2e91={'membername':_0x2cd11c[_0x8a7a('0x5d')],'interface':_0x36ee81,'enterAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0')),'role':_0x2cd11c[_0x8a7a('0x36')],'internal':_0x2cd11c[_0x8a7a('0x71')]};_0x232efa[_0x8a7a('0xf1')](function(_0x161d63){_0x2c65cc[_0x8a7a('0x97')](_['merge']({'channel':_0x161d63,'type':_0x8a7a('0xf2'),'data1':_0x404f14[_0x8a7a('0x68')][_0x8a7a('0xf3')],'data2':_0x36ee81},_0x1b2e91));if(_0x2cd11c[_0x8a7a('0xaa')]){_0x2b6435[_0x8a7a('0x97')](_[_0x8a7a('0x5e')]({'channel':_0x161d63,'type':_0x8a7a('0xf4'),'data1':_0x8a7a('0xf5')},_0x1b2e91));}});return db[_0x8a7a('0xef')][_0x8a7a('0xf6')](_0x2c65cc['concat'](_0x2b6435),{'individualHooks':!![]});}})[_0x8a7a('0x20')](function(){if(_0x2cd11c){return _0x2cd11c[_0x8a7a('0x33')]({'online':!![],'lastLoginAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0')),'voicePause':_0x2cd11c['loginInPause']||![],'mailPause':_0x2cd11c[_0x8a7a('0xaa')]||![],'chatPause':_0x2cd11c[_0x8a7a('0xaa')]||![],'faxPause':_0x2cd11c['loginInPause']||![],'smsPause':_0x2cd11c[_0x8a7a('0xaa')]||![],'openchannelPause':_0x2cd11c['loginInPause']||![],'whatsappPause':_0x2cd11c['loginInPause']||![],'pauseType':_0x2cd11c[_0x8a7a('0xaa')]?_0x8a7a('0xf5'):null,'interface':_0x36ee81,'lastPauseAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0'))});}})[_0x8a7a('0x20')](function(_0x2181f6){if(_0x404f14[_0x8a7a('0xf7')]){return _0x4917e5();}else{return BPromise[_0x8a7a('0xf8')](_0x2181f6)['then'](respondWithResult(_0x3786ed,null));}})[_0x8a7a('0x63')](handleError(_0x3786ed,null));};exports['logout']=function(_0x187377,_0x2f7be1,_0x1329b2){var _0x3884de;return db['User'][_0x8a7a('0x41')]({'where':{'id':_0x187377[_0x8a7a('0x69')]['id'],'role':_0x8a7a('0x3a')},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x2f7be1,null))['then'](function(_0x51d82e){if(_0x51d82e){_0x3884de=_0x51d82e;return db[_0x8a7a('0xb9')]['destroy']({'where':{'membername':_0x3884de['name']},'individualHooks':!![]});}})[_0x8a7a('0x20')](function(){return db['MemberReport'][_0x8a7a('0x93')]({'where':{'membername':_0x3884de[_0x8a7a('0x5d')],'exitAt':null}});})[_0x8a7a('0x20')](function(_0xe632f1){var _0x460a56=[];_0xe632f1[_0x8a7a('0xf1')](function(_0x4add5c){_0x460a56[_0x8a7a('0x97')](_0x4add5c['update']({'exitAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0'))}));});return BPromise[_0x8a7a('0x91')](_0x460a56);})[_0x8a7a('0x20')](function(){return _0x3884de[_0x8a7a('0x33')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2f7be1,null))[_0x8a7a('0x63')](handleError(_0x2f7be1,null));};exports['pause']=function(_0x318b8c,_0x517d60,_0x30558c){var _0x241f6a;return db[_0x8a7a('0xb9')][_0x8a7a('0x33')]({'paused':0x1},{'where':{'UserId':_0x318b8c[_0x8a7a('0x69')]['id']},'individualHooks':!![]})[_0x8a7a('0x20')](function(){return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x318b8c[_0x8a7a('0x69')]['id'],'role':_0x8a7a('0x3a')},'attributes':['id',_0x8a7a('0x5d'),_0x8a7a('0x36'),_0x8a7a('0x71'),_0x8a7a('0xab')]});})[_0x8a7a('0x20')](handleEntityNotFound(_0x517d60,null))[_0x8a7a('0x20')](function(_0x521b6d){if(_0x521b6d){_0x241f6a=_0x521b6d;return respondWithRpcPromise('QueuePause','pause',{'id':_0x241f6a['id'],'name':_0x241f6a['name'],'pause':!![]});}})[_0x8a7a('0x20')](function(){if(_0x241f6a){return db[_0x8a7a('0xef')][_0x8a7a('0x93')]({'where':{'membername':_0x241f6a[_0x8a7a('0x5d')],'type':_0x8a7a('0xf4'),'exitAt':null}});}})[_0x8a7a('0x20')](function(_0x1ad488){if(_0x1ad488['length']){var _0x2acec1=moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0'));for(var _0x5d9f94=0x0,_0x1530fb=_0x1ad488[_0x8a7a('0x53')];_0x5d9f94<_0x1530fb;_0x5d9f94++){_0x1ad488[_0x5d9f94][_0x8a7a('0xf9')]({'exitAt':_0x2acec1});}}})[_0x8a7a('0x20')](function(){var _0x346e42=[];var _0x5e5f3a=utils[_0x8a7a('0xfa')]();_0x5e5f3a[_0x8a7a('0xf1')](function(_0xaaba88){_0x346e42[_0x8a7a('0x97')]({'channel':_0xaaba88,'membername':_0x241f6a[_0x8a7a('0x5d')],'interface':_[_0x8a7a('0x73')](_0x241f6a[_0x8a7a('0xab')])?util[_0x8a7a('0xb6')](_0x8a7a('0xb7'),_0x241f6a[_0x8a7a('0x5d')]):_0x241f6a[_0x8a7a('0xab')],'type':_0x8a7a('0xf4'),'enterAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0')),'data1':_0x318b8c[_0x8a7a('0x68')][_0x8a7a('0x59')]||_0x8a7a('0xfb'),'role':_0x241f6a[_0x8a7a('0x36')],'internal':_0x241f6a[_0x8a7a('0x71')]});});return db[_0x8a7a('0xef')][_0x8a7a('0xf6')](_0x346e42,{'individualHooks':!![]});})['then'](function(){return _0x241f6a[_0x8a7a('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x318b8c[_0x8a7a('0x68')][_0x8a7a('0x59')]||_0x8a7a('0xfb'),'lastPauseAt':moment()[_0x8a7a('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8a7a('0x20')](respondWithResult(_0x517d60,null))[_0x8a7a('0x63')](handleError(_0x517d60,null));};exports[_0x8a7a('0xfc')]=function(_0x3d0347,_0x165289,_0xbf48e){var _0x1bb27f;return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x3d0347['params']['id']},'attributes':['id',_0x8a7a('0x5d'),'role','voicePause',_0x8a7a('0xfd'),'chatPause','faxPause','openchannelPause',_0x8a7a('0xfe'),_0x8a7a('0xff'),_0x8a7a('0x100'),_0x8a7a('0x101')]})[_0x8a7a('0x20')](handleEntityNotFound(_0x165289,null))[_0x8a7a('0x20')](function(_0x50a8da){if(_0x50a8da){_0x1bb27f=_0x50a8da;if(_0x3d0347['body'][_0x8a7a('0xa9')]&&!utils[_0x8a7a('0xac')](_0x3d0347[_0x8a7a('0x68')][_0x8a7a('0xa9')])){throw new db['Sequelize'][(_0x8a7a('0x9b'))](_0x8a7a('0xbb'));}switch(_0x3d0347[_0x8a7a('0x68')][_0x8a7a('0xa9')]){case _0x8a7a('0xb4'):return respondWithRpcPromise('QueuePause',_0x8a7a('0xfc'),{'id':_0x1bb27f['id'],'name':_0x1bb27f[_0x8a7a('0x5d')],'pause':![]})['then'](function(){return db[_0x8a7a('0xb9')]['update']({'paused':0x0},{'where':{'UserId':_0x1bb27f['id']},'individualHooks':!![]});})[_0x8a7a('0x20')](function(){return db['MemberReport'][_0x8a7a('0x41')]({'where':{'channel':_0x3d0347[_0x8a7a('0x68')][_0x8a7a('0xa9')],'membername':_0x1bb27f[_0x8a7a('0x5d')],'type':_0x8a7a('0xf4'),'exitAt':null}});})[_0x8a7a('0x20')](function(_0x225feb){if(_0x225feb){return _0x225feb[_0x8a7a('0x33')]({'exitAt':moment()[_0x8a7a('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8a7a('0x102')},{'individualHooks':!![]});}return null;})[_0x8a7a('0x20')](function(){return _0x1bb27f[_0x8a7a('0x33')]({'voicePause':![]});});case'mail':case _0x8a7a('0x103'):case _0x8a7a('0x104'):case _0x8a7a('0x105'):case _0x8a7a('0x106'):case _0x8a7a('0x107'):return db[_0x8a7a('0xef')][_0x8a7a('0x41')]({'where':{'channel':_0x3d0347[_0x8a7a('0x68')][_0x8a7a('0xa9')],'membername':_0x1bb27f[_0x8a7a('0x5d')],'type':_0x8a7a('0xf4'),'exitAt':null}})['then'](function(_0x1fde94){if(_0x1fde94){return _0x1fde94[_0x8a7a('0x33')]({'exitAt':moment()[_0x8a7a('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8a7a('0x102')},{'individualHooks':!![]});}return null;})[_0x8a7a('0x20')](function(){var _0x38cc7b={};_[_0x8a7a('0x108')](_0x38cc7b,util['format'](_0x8a7a('0x109'),_0x3d0347[_0x8a7a('0x68')]['channel'],_0x8a7a('0x10a')),![]);return _0x1bb27f[_0x8a7a('0x33')](_0x38cc7b);});default:return respondWithRpcPromise('QueuePause',_0x8a7a('0xfc'),{'id':_0x1bb27f['id'],'name':_0x1bb27f[_0x8a7a('0x5d')],'pause':![]})[_0x8a7a('0x20')](function(){return db[_0x8a7a('0xb9')][_0x8a7a('0x33')]({'paused':0x0},{'where':{'UserId':_0x1bb27f['id']}});})[_0x8a7a('0x20')](function(){return db[_0x8a7a('0xef')][_0x8a7a('0x93')]({'where':{'membername':_0x1bb27f['name'],'type':_0x8a7a('0xf4'),'exitAt':null}});})[_0x8a7a('0x20')](function(_0x21e8e7){var _0x35bad7=[];_0x21e8e7['forEach'](function(_0x400148){_0x35bad7[_0x8a7a('0x97')](_0x400148[_0x8a7a('0x33')]({'exitAt':moment()[_0x8a7a('0xb6')](_0x8a7a('0xf0')),'data2':_0x8a7a('0x102')}));});return BPromise[_0x8a7a('0x91')](_0x35bad7);})[_0x8a7a('0x20')](function(){return _0x1bb27f[_0x8a7a('0x33')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x165289,null))[_0x8a7a('0x63')](handleError(_0x165289,null));};exports[_0x8a7a('0x10b')]=function(_0x4116d2,_0x201a2e,_0xd9d68b){var _0x533523={};var _0x540b02={};var _0x37a495;var _0x15c03c;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x4116d2['params']['id']}})['then'](handleEntityNotFound(_0x201a2e,null))['then'](function(_0x491f6c){if(_0x491f6c){_0x37a495=_0x491f6c;_0x540b02[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0x10c')][_0x8a7a('0x48')]);_0x540b02['query']=_[_0x8a7a('0x65')](_0x4116d2['query']);_0x540b02[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0x540b02['model'],_0x540b02[_0x8a7a('0x4f')]);_0x533523[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0x540b02['model'],qs[_0x8a7a('0x52')](_0x4116d2[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x533523[_0x8a7a('0x51')]=_0x533523[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0x533523['attributes']:_0x540b02[_0x8a7a('0x4b')];_0x533523['order']=qs[_0x8a7a('0x56')](_0x4116d2[_0x8a7a('0x4f')][_0x8a7a('0x56')]);_0x533523[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x4116d2[_0x8a7a('0x4f')],_0x540b02[_0x8a7a('0x58')]));if(_0x4116d2[_0x8a7a('0x4f')][_0x8a7a('0x3d')]){_0x533523[_0x8a7a('0x57')]=_[_0x8a7a('0x5e')](_0x533523[_0x8a7a('0x57')],{'$or':_[_0x8a7a('0x47')](_0x533523[_0x8a7a('0x51')],function(_0x2f9159){var _0x5d91f8={};_0x5d91f8[_0x2f9159]={'$like':'%'+_0x4116d2[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0x5d91f8;})});}_0x533523=_['merge']({},_0x533523,_0x4116d2[_0x8a7a('0x67')]);return _0x37a495[_0x8a7a('0x10b')](_0x533523);}})[_0x8a7a('0x20')](function(_0x1eed2b){if(_0x1eed2b){_0x15c03c=_0x1eed2b['length'];if(!_0x4116d2['query']['hasOwnProperty']('nolimit')){_0x533523[_0x8a7a('0x2e')]=qs[_0x8a7a('0x2e')](_0x4116d2['query']['limit']);_0x533523[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x4116d2[_0x8a7a('0x4f')]['offset']);}return _0x37a495[_0x8a7a('0x10b')](_0x533523);}})['then'](function(_0x508722){if(_0x508722){return _0x508722?{'count':_0x15c03c,'rows':_0x508722}:null;}})[_0x8a7a('0x20')](respondWithResult(_0x201a2e,null))[_0x8a7a('0x63')](handleError(_0x201a2e,null));};exports['addTeams']=function(_0x2ed43d,_0x18cb97){return db[_0x8a7a('0x5f')][_0x8a7a('0x41')]({'where':{'id':_0x2ed43d[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x18cb97,null))['then'](function(_0x7bdeb7){if(_0x7bdeb7){var _0x5edf5d=_0x7bdeb7[_0x8a7a('0x35')]({'plain':!![]});return _0x7bdeb7['addTeams'](_0x2ed43d['body'][_0x8a7a('0x6d')],_[_0x8a7a('0x6c')](_0x2ed43d[_0x8a7a('0x68')],[_0x8a7a('0x6d'),'id'])||{})[_0x8a7a('0x20')](function(){for(var _0x57c9b4=0x0;_0x57c9b4<_0x2ed43d[_0x8a7a('0x68')][_0x8a7a('0x6d')][_0x8a7a('0x53')];_0x57c9b4++){var _0x5aae35=[];db[_0x8a7a('0x10c')]['findOne']({'where':{'id':_0x2ed43d[_0x8a7a('0x68')][_0x8a7a('0x6d')][_0x57c9b4]}})['then'](function(_0x41a616){_0x5aae35[_0x8a7a('0x97')](_0x41a616[_0x8a7a('0x10d')]()[_0x8a7a('0x20')](function(_0x51d5bc){for(var _0x2ed0b0=0x0;_0x2ed0b0<_0x51d5bc[_0x8a7a('0x53')];_0x2ed0b0++){_0x51d5bc[_0x2ed0b0]['setDataValue'](_0x8a7a('0xa9'),_0x8a7a('0x10e'));}return _0x51d5bc;}));_0x5aae35[_0x8a7a('0x97')](_0x41a616['getChatQueues']()[_0x8a7a('0x20')](function(_0x36f25a){for(var _0x199f4e=0x0;_0x199f4e<_0x36f25a[_0x8a7a('0x53')];_0x199f4e++){_0x36f25a[_0x199f4e][_0x8a7a('0x10f')](_0x8a7a('0xa9'),'Chat');}return _0x36f25a;}));_0x5aae35[_0x8a7a('0x97')](_0x41a616['getMailQueues']()[_0x8a7a('0x20')](function(_0x5a0168){for(var _0x6ed9cf=0x0;_0x6ed9cf<_0x5a0168[_0x8a7a('0x53')];_0x6ed9cf++){_0x5a0168[_0x6ed9cf]['setDataValue'](_0x8a7a('0xa9'),_0x8a7a('0x110'));}return _0x5a0168;}));_0x5aae35[_0x8a7a('0x97')](_0x41a616[_0x8a7a('0x111')]()['then'](function(_0x19a786){for(var _0xa049d4=0x0;_0xa049d4<_0x19a786['length'];_0xa049d4++){_0x19a786[_0xa049d4][_0x8a7a('0x10f')](_0x8a7a('0xa9'),'Sms');}return _0x19a786;}));_0x5aae35[_0x8a7a('0x97')](_0x41a616[_0x8a7a('0x112')]()[_0x8a7a('0x20')](function(_0x5f1548){for(var _0x5f16bf=0x0;_0x5f16bf<_0x5f1548[_0x8a7a('0x53')];_0x5f16bf++){_0x5f1548[_0x5f16bf][_0x8a7a('0x10f')](_0x8a7a('0xa9'),_0x8a7a('0x113'));}return _0x5f1548;}));_0x5aae35[_0x8a7a('0x97')](_0x41a616[_0x8a7a('0x114')]()['then'](function(_0x5230c0){for(var _0x302106=0x0;_0x302106<_0x5230c0['length'];_0x302106++){_0x5230c0[_0x302106][_0x8a7a('0x10f')](_0x8a7a('0xa9'),'Fax');}return _0x5230c0;}));_0x5aae35['push'](_0x41a616['getOpenchannelQueues']()['then'](function(_0x395b79){for(var _0x17aa9c=0x0;_0x17aa9c<_0x395b79[_0x8a7a('0x53')];_0x17aa9c++){_0x395b79[_0x17aa9c][_0x8a7a('0x10f')](_0x8a7a('0xa9'),_0x8a7a('0x115'));}return _0x395b79;}));return BPromise[_0x8a7a('0x91')](_0x5aae35);})[_0x8a7a('0x20')](function(_0x237d15){var _0x1fc60f=_[_0x8a7a('0x116')](_0x237d15);_0x5aae35=[];return db[_0x8a7a('0x5a')]['transaction'](function(_0x56fe09){for(var _0x27d906=0x0;_0x27d906<_0x1fc60f[_0x8a7a('0x53')];_0x27d906++){_0x5aae35[_0x8a7a('0x97')](_0x1fc60f[_0x27d906][_0x8a7a('0x117')](_0x5edf5d['id']),{'transaction':_0x56fe09});}return BPromise[_0x8a7a('0x91')](_0x5aae35)[_0x8a7a('0x20')](function(){if(_0x5edf5d[_0x8a7a('0x118')]){return BPromise['each'](_[_0x8a7a('0x3d')](_0x1fc60f,function(_0x57d492){return _0x57d492[_0x8a7a('0x119')](_0x8a7a('0xa9'))==='Voice';}),function(_0x46805f){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5edf5d['name'],'UserId':_0x5edf5d['id'],'queue_name':_0x46805f[_0x8a7a('0x5d')],'VoiceQueueId':_0x46805f['id'],'interface':_[_0x8a7a('0x73')](_0x5edf5d[_0x8a7a('0xab')])?util['format'](_0x8a7a('0xb7'),_0x5edf5d[_0x8a7a('0x5d')]):_0x5edf5d['interface'],'paused':_0x5edf5d[_0x8a7a('0xb8')]||![],'penalty':_0x5edf5d[_0x8a7a('0xb1')]},{'transaction':_0x56fe09});});}else{return;}})[_0x8a7a('0x20')](function(){for(var _0x5e2cb3=0x0;_0x5e2cb3<_0x1fc60f[_0x8a7a('0x53')];_0x5e2cb3++){var _0x18dc4d=_0x1fc60f[_0x5e2cb3][_0x8a7a('0x119')](_0x8a7a('0xa9'));var _0x2a501e=_0x18dc4d+_0x8a7a('0xb2');socket[_0x8a7a('0x11a')]('user'+_0x18dc4d+'Queue:save',{'UserId':_0x5edf5d['id'],['queueField']:_0x1fc60f[_0x5e2cb3]['id']});}});});});}});}})[_0x8a7a('0x20')](respondWithStatusCode(_0x18cb97,null))[_0x8a7a('0x63')](handleError(_0x18cb97,null));};exports[_0x8a7a('0x11b')]=function(_0x3593c5,_0xf7df40){return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x3593c5['params']['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0xf7df40,null))[_0x8a7a('0x20')](function(_0x2587c5){if(_0x2587c5){var _0x3ded20=_0x2587c5['get']({'plain':!![]});var _0x3968b4=_0x3593c5[_0x8a7a('0x4f')][_0x8a7a('0x6d')];return _0x2587c5['removeTeams'](_0x3968b4)['then'](function(){for(var _0x3d359d=0x0;_0x3d359d<_0x3968b4[_0x8a7a('0x53')];_0x3d359d++){var _0x356ed5=[];db['Team'][_0x8a7a('0xa2')]({'where':{'id':_0x3968b4[_0x3d359d]}})[_0x8a7a('0x20')](function(_0x5db287){_0x356ed5[_0x8a7a('0x97')](_0x5db287[_0x8a7a('0x10d')]()[_0x8a7a('0x20')](function(_0x50feed){for(var _0x324faa=0x0;_0x324faa<_0x50feed[_0x8a7a('0x53')];_0x324faa++){_0x50feed[_0x324faa]['setDataValue'](_0x8a7a('0xa9'),_0x8a7a('0x10e'));}return _0x50feed;}));_0x356ed5[_0x8a7a('0x97')](_0x5db287[_0x8a7a('0x11c')]()[_0x8a7a('0x20')](function(_0x2f2059){for(var _0x2b7cce=0x0;_0x2b7cce<_0x2f2059[_0x8a7a('0x53')];_0x2b7cce++){_0x2f2059[_0x2b7cce][_0x8a7a('0x10f')]('channel',_0x8a7a('0x11d'));}return _0x2f2059;}));_0x356ed5[_0x8a7a('0x97')](_0x5db287['getMailQueues']()[_0x8a7a('0x20')](function(_0x350fd4){for(var _0x2b7376=0x0;_0x2b7376<_0x350fd4['length'];_0x2b7376++){_0x350fd4[_0x2b7376][_0x8a7a('0x10f')](_0x8a7a('0xa9'),'Mail');}return _0x350fd4;}));_0x356ed5['push'](_0x5db287[_0x8a7a('0x111')]()[_0x8a7a('0x20')](function(_0x296643){for(var _0x5ce0ae=0x0;_0x5ce0ae<_0x296643[_0x8a7a('0x53')];_0x5ce0ae++){_0x296643[_0x5ce0ae]['setDataValue'](_0x8a7a('0xa9'),_0x8a7a('0x11e'));}return _0x296643;}));_0x356ed5['push'](_0x5db287['getWhatsappQueues']()['then'](function(_0x2fd2e4){for(var _0x4db9cf=0x0;_0x4db9cf<_0x2fd2e4[_0x8a7a('0x53')];_0x4db9cf++){_0x2fd2e4[_0x4db9cf]['setDataValue'](_0x8a7a('0xa9'),_0x8a7a('0x113'));}return _0x2fd2e4;}));_0x356ed5[_0x8a7a('0x97')](_0x5db287[_0x8a7a('0x114')]()['then'](function(_0x29fe0f){for(var _0x4b06e6=0x0;_0x4b06e6<_0x29fe0f[_0x8a7a('0x53')];_0x4b06e6++){_0x29fe0f[_0x4b06e6][_0x8a7a('0x10f')](_0x8a7a('0xa9'),'Fax');}return _0x29fe0f;}));_0x356ed5[_0x8a7a('0x97')](_0x5db287[_0x8a7a('0x11f')]()['then'](function(_0x2677dd){for(var _0x3cc4f1=0x0;_0x3cc4f1<_0x2677dd[_0x8a7a('0x53')];_0x3cc4f1++){_0x2677dd[_0x3cc4f1][_0x8a7a('0x10f')](_0x8a7a('0xa9'),'Openchannel');}return _0x2677dd;}));return BPromise[_0x8a7a('0x91')](_0x356ed5);})[_0x8a7a('0x20')](function(_0x5425d5){var _0x3a6b53=_[_0x8a7a('0x116')](_0x5425d5);_0x356ed5=[];return db[_0x8a7a('0x5a')]['transaction'](function(_0x7317b6){for(var _0x2f1b56=0x0;_0x2f1b56<_0x3a6b53['length'];_0x2f1b56++){_0x356ed5[_0x8a7a('0x97')](_0x3a6b53[_0x2f1b56][_0x8a7a('0x120')](_0x3ded20['id']),{'transaction':_0x7317b6});}return BPromise[_0x8a7a('0x91')](_0x356ed5)[_0x8a7a('0x20')](function(){if(_0x3ded20[_0x8a7a('0x118')]){return BPromise[_0x8a7a('0x92')](_['filter'](_0x3a6b53,function(_0xd2b333){return _0xd2b333[_0x8a7a('0x119')](_0x8a7a('0xa9'))===_0x8a7a('0x10e');}),function(_0x5143eb){return db[_0x8a7a('0xb9')][_0x8a7a('0x34')]({'where':{'VoiceQueueId':_0x5143eb['id'],'UserId':_0x3ded20['id']},'transaction':_0x7317b6});});}else{return;}})['then'](function(){for(var _0x2d17ff=0x0;_0x2d17ff<_0x3a6b53[_0x8a7a('0x53')];_0x2d17ff++){var _0x72f5d7=_0x3a6b53[_0x2d17ff]['getDataValue'](_0x8a7a('0xa9'));var _0x2cd792=_0x72f5d7+_0x8a7a('0xb2');socket[_0x8a7a('0x11a')](_0x8a7a('0x38')+_0x72f5d7+_0x8a7a('0xbd'),{'UserId':_0x3ded20['id'],['queueField']:_0x3a6b53[_0x2d17ff]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xf7df40,null))[_0x8a7a('0x63')](handleError(_0xf7df40,null));};exports['getLists']=function(_0x548116,_0x1c3509,_0x475084){var _0xcc10e8={};var _0x11a910={};var _0x3df77e;var _0x48e182;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x548116[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x1c3509,null))[_0x8a7a('0x20')](function(_0x3f7f57){if(_0x3f7f57){_0x3df77e=_0x3f7f57;_0x11a910[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0xc9')][_0x8a7a('0x48')]);_0x11a910['query']=_[_0x8a7a('0x65')](_0x548116[_0x8a7a('0x4f')]);_0x11a910['filters']=_[_0x8a7a('0x50')](_0x11a910[_0x8a7a('0x4b')],_0x11a910['query']);_0xcc10e8[_0x8a7a('0x51')]=_[_0x8a7a('0x50')](_0x11a910[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x548116[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0xcc10e8[_0x8a7a('0x51')]=_0xcc10e8[_0x8a7a('0x51')][_0x8a7a('0x53')]?_0xcc10e8['attributes']:_0x11a910[_0x8a7a('0x4b')];_0xcc10e8['order']=qs['sort'](_0x548116['query'][_0x8a7a('0x56')]);_0xcc10e8[_0x8a7a('0x57')]=qs[_0x8a7a('0x58')](_[_0x8a7a('0xc8')](_0x548116[_0x8a7a('0x4f')],_0x11a910[_0x8a7a('0x58')]));if(_0x548116[_0x8a7a('0x4f')]['filter']){_0xcc10e8['where']=_['merge'](_0xcc10e8[_0x8a7a('0x57')],{'$or':_['map'](_0xcc10e8[_0x8a7a('0x51')],function(_0x28307d){var _0x3360e7={};_0x3360e7[_0x28307d]={'$like':'%'+_0x548116[_0x8a7a('0x4f')]['filter']+'%'};return _0x3360e7;})});}_0xcc10e8=_[_0x8a7a('0x5e')]({},_0xcc10e8,_0x548116[_0x8a7a('0x67')]);return _0x3df77e['getLists'](_0xcc10e8);}})[_0x8a7a('0x20')](function(_0x3cce9a){if(_0x3cce9a){_0x48e182=_0x3cce9a[_0x8a7a('0x53')];if(!_0x548116[_0x8a7a('0x4f')][_0x8a7a('0x54')]('nolimit')){_0xcc10e8['limit']=qs[_0x8a7a('0x2e')](_0x548116[_0x8a7a('0x4f')][_0x8a7a('0x2e')]);_0xcc10e8[_0x8a7a('0x2d')]=qs[_0x8a7a('0x2d')](_0x548116[_0x8a7a('0x4f')]['offset']);}return _0x3df77e['getLists'](_0xcc10e8);}})['then'](function(_0x58ab57){if(_0x58ab57){return _0x58ab57?{'count':_0x48e182,'rows':_0x58ab57}:null;}})['then'](respondWithResult(_0x1c3509,null))['catch'](handleError(_0x1c3509,null));};exports['getAgents']=function(_0x2bf848,_0x5cd5e1,_0x421272){var _0x56cf79={};var _0xf372b4={};var _0xe9c08e;var _0x4bdb0c;return db[_0x8a7a('0x5f')][_0x8a7a('0xa2')]({'where':{'id':_0x2bf848[_0x8a7a('0x69')]['id']}})[_0x8a7a('0x20')](handleEntityNotFound(_0x5cd5e1,null))['then'](function(_0x428d87){if(_0x428d87){_0xe9c08e=_0x428d87;_0xf372b4[_0x8a7a('0x4b')]=_[_0x8a7a('0x65')](db[_0x8a7a('0x5f')]['rawAttributes']);_0xf372b4[_0x8a7a('0x4f')]=_['keys'](_0x2bf848[_0x8a7a('0x4f')]);_0xf372b4[_0x8a7a('0x58')]=_[_0x8a7a('0x50')](_0xf372b4[_0x8a7a('0x4b')],_0xf372b4[_0x8a7a('0x4f')]);_0x56cf79[_0x8a7a('0x51')]=_['intersection'](_0xf372b4[_0x8a7a('0x4b')],qs[_0x8a7a('0x52')](_0x2bf848[_0x8a7a('0x4f')][_0x8a7a('0x52')]));_0x56cf79['attributes']=_0x56cf79['attributes'][_0x8a7a('0x53')]?_0x56cf79['attributes']:_0xf372b4[_0x8a7a('0x4b')];_0x56cf79[_0x8a7a('0x55')]=qs[_0x8a7a('0x56')](_0x2bf848[_0x8a7a('0x4f')]['sort']);_0x56cf79[_0x8a7a('0x57')]=qs['filters'](_[_0x8a7a('0xc8')](_0x2bf848[_0x8a7a('0x4f')],_0xf372b4[_0x8a7a('0x58')]));if(_0x2bf848[_0x8a7a('0x4f')]['filter']){_0x56cf79[_0x8a7a('0x57')]=_[_0x8a7a('0x5e')](_0x56cf79['where'],{'$or':_[_0x8a7a('0x47')](_0x56cf79[_0x8a7a('0x51')],function(_0x96d555){var _0xb08b56={};_0xb08b56[_0x96d555]={'$like':'%'+_0x2bf848[_0x8a7a('0x4f')][_0x8a7a('0x3d')]+'%'};return _0xb08b56;})});}_0x56cf79[_0x8a7a('0x4b')]=db['User'];_0x56cf79['as']=_0x8a7a('0x39');_0x56cf79=_[_0x8a7a('0x5e')]({},_0x56cf79,_0x2bf848[_0x8a7a('0x67')]);return _0xe9c08e[_0x8a7a('0x10d')]({'include':[_0x56cf79]});}})[_0x8a7a('0x20')](function(_0x57870b){if(_0x57870b){var _0x402829={},_0x3948da=[],_0xa9a84e=0x0;for(var _0x5c5925=0x0;_0x5c5925<_0x57870b['length'];_0x5c5925+=0x1){for(var _0x31210e=0x0,_0x3c737a;_0x31210e<_0x57870b[_0x5c5925]['Agents'][_0x8a7a('0x53')];_0x31210e+=0x1){_0x3c737a=_0x57870b[_0x5c5925][_0x8a7a('0x39')][_0x31210e][_0x8a7a('0x35')]({'plain':!![]});_0x402829[_0x3c737a['id']]=_0x3c737a;}}_0x402829=_[_0x8a7a('0x121')](_0x402829);for(var _0x388df2=qs['offset'](_0x2bf848[_0x8a7a('0x4f')][_0x8a7a('0x2d')]);_0x388df2<_0x402829['length']&&_0x3948da['length']=_0x7d7f49['agents']){throw new Error(_0xede1('0x56'));}})[_0xede1('0x12')](function(){if(_0x3b995c){return db[_0xede1('0x2e')][_0xede1('0x57')]({'where':{'membername':_0x3b995c[_0xede1('0x31')]},'individualHooks':!![]});}})[_0xede1('0x12')](function(){if(_0x3b995c){return _0x3b995c[_0xede1('0x58')]({'raw':!![]});}})['then'](function(_0x1823b2){if(_0x3b995c){if(_0x1823b2){var _0x5d5c7a=[];_0x3ee415=_0x1823b2;if(_0x3ee415[_0xede1('0x34')]){for(var _0x108f1a=0x0;_0x108f1a<_0x3ee415[_0xede1('0x34')];_0x108f1a++){_0x5d5c7a[_0xede1('0x4f')](db[_0xede1('0x2e')][_0xede1('0x59')]({'membername':_0x3b995c[_0xede1('0x31')],'UserId':_0x3b995c['id'],'queue_name':_0x3ee415[_0x108f1a][_0xede1('0x31')],'VoiceQueueId':_0x3ee415[_0x108f1a]['id'],'interface':_0x435d87,'paused':_0x3b995c[_0xede1('0x5a')]||![],'penalty':_0x3ee415[_0x108f1a][_0xede1('0x5b')]||0x0}));}return BPromise[_0xede1('0x5c')](_0x5d5c7a);}}}})[_0xede1('0x12')](function(){if(_0x3b995c){return db[_0xede1('0x30')][_0xede1('0x1f')]({'where':{'membername':_0x3b995c[_0xede1('0x31')],'exitAt':null}});}})['then'](function(_0xa0893a){if(_0x3b995c){if(_0xa0893a&&_0xa0893a[_0xede1('0x34')]){var _0x1e6961=[];_0xa0893a[_0xede1('0x37')](function(_0x5dbcd8){_0x1e6961['push'](_0x5dbcd8[_0xede1('0x2f')]({'exitAt':moment()[_0xede1('0x32')](_0xede1('0x33'))}));});return BPromise[_0xede1('0x5c')](_0x1e6961);}}})['then'](function(_0x1aa386){if(_0x3b995c){var _0x2fe981=[];var _0x7aa36f=[];var _0x525f18=utils[_0xede1('0x36')]();var _0x28677b={'membername':_0x3b995c[_0xede1('0x31')],'interface':_0x435d87,'enterAt':moment()[_0xede1('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3b995c[_0xede1('0x2b')],'internal':_0x3b995c[_0xede1('0x2c')]};_0x525f18[_0xede1('0x37')](function(_0x3c1852){_0x2fe981[_0xede1('0x4f')](_[_0xede1('0x5d')]({'channel':_0x3c1852,'type':_0xede1('0x5e'),'data1':_0xede1('0x5f'),'data2':_0x435d87},_0x28677b));if(_0x3b995c[_0xede1('0x5a')]){_0x7aa36f[_0xede1('0x4f')](_[_0xede1('0x5d')]({'channel':_0x3c1852,'type':_0xede1('0x45'),'data1':_0xede1('0x60')},_0x28677b));}});return db['MemberReport'][_0xede1('0x3d')](_0x2fe981[_0xede1('0x61')](_0x7aa36f),{'individualHooks':!![]});}})['then'](function(){if(_0x3b995c){return _0x3b995c[_0xede1('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xede1('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3b995c[_0xede1('0x5a')]||![],'mailPause':_0x3b995c[_0xede1('0x5a')]||![],'chatPause':_0x3b995c[_0xede1('0x5a')]||![],'faxPause':_0x3b995c['loginInPause']||![],'smsPause':_0x3b995c[_0xede1('0x5a')]||![],'openchannelPause':_0x3b995c[_0xede1('0x5a')]||![],'pauseType':_0x3b995c[_0xede1('0x5a')]?_0xede1('0x60'):null,'lastPauseAt':moment()[_0xede1('0x32')](_0xede1('0x33')),'interface':_0x435d87});}})[_0xede1('0x12')](function(_0xd39cd4){_0x272972(_0xd39cd4);})[_0xede1('0x1c')](function(_0x15712b){_0x4c6592(_0x4c1010[_0xede1('0x17')](0x1f4,_0x15712b[_0xede1('0x19')]));});});}; \ No newline at end of file +var _0x0b63=['PauseUser','name','role','interface','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','forEach','push','isNil','format','SIP/%s','PAUSE','type','DEFAULT\x20PAUSE','internal','body','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','UserVoiceQueueRt','mail','sms','whatsapp','system','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','getChannels','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./user.socket','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','User,\x20%s,\x20%s','message','catch','GetUser','User','findAll','options','raw','where','limit','include','model','map','attributes','stringify','ShowUser','find'];(function(_0x63709d,_0x537d26){var _0x1aadbc=function(_0x5dc501){while(--_0x5dc501){_0x63709d['push'](_0x63709d['shift']());}};_0x1aadbc(++_0x537d26);}(_0x0b63,0xe7));var _0x30b6=function(_0x17b451,_0x2bbfa8){_0x17b451=_0x17b451-0x0;var _0x25599d=_0x0b63[_0x17b451];return _0x25599d;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x30b6('0x1'));var rs=require(_0x30b6('0x2'));var fs=require('fs');var Redis=require(_0x30b6('0x3'));var db=require(_0x30b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30b6('0x5'))(_0x30b6('0x6'));var config=require(_0x30b6('0x7'));var jayson=require(_0x30b6('0x8'));var client=jayson[_0x30b6('0x9')][_0x30b6('0xa')]({'port':0x232a});config['redis']=_[_0x30b6('0xb')](config['redis'],{'host':_0x30b6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30b6('0xd')]));require(_0x30b6('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f8faa,_0x1ab626,_0x5b0567){return new BPromise(function(_0x299f08,_0x32295b){return client[_0x30b6('0xf')](_0x3f8faa,_0x5b0567)[_0x30b6('0x10')](function(_0x1acd7f){logger[_0x30b6('0x11')]('User,\x20%s,\x20%s',_0x1ab626,_0x30b6('0x12'));logger[_0x30b6('0x13')](_0x30b6('0x14'),_0x1ab626,_0x30b6('0x12'),JSON['stringify'](_0x1acd7f));if(_0x1acd7f[_0x30b6('0x15')]){if(_0x1acd7f['error']['code']===0x1f4){logger[_0x30b6('0x15')](_0x30b6('0x16'),_0x1ab626,_0x1acd7f[_0x30b6('0x15')]['message']);return _0x32295b(_0x1acd7f['error'][_0x30b6('0x17')]);}logger[_0x30b6('0x15')]('User,\x20%s,\x20%s',_0x1ab626,_0x1acd7f[_0x30b6('0x15')]['message']);return _0x299f08(_0x1acd7f[_0x30b6('0x15')][_0x30b6('0x17')]);}else{logger[_0x30b6('0x11')](_0x30b6('0x16'),_0x1ab626,_0x30b6('0x12'));_0x299f08(_0x1acd7f['result'][_0x30b6('0x17')]);}})[_0x30b6('0x18')](function(_0x3cec44){logger[_0x30b6('0x15')](_0x30b6('0x16'),_0x1ab626,_0x3cec44);_0x32295b(_0x3cec44);});});}exports[_0x30b6('0x19')]=function(_0x2a0f9e){var _0x53417f=this;return new Promise(function(_0x46d6bb,_0x388e18){return db[_0x30b6('0x1a')][_0x30b6('0x1b')]({'raw':_0x2a0f9e['options']?_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a0f9e['options']?_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x1e')]||null:null,'attributes':_0x2a0f9e[_0x30b6('0x1c')]?_0x2a0f9e[_0x30b6('0x1c')]['attributes']||null:null,'limit':_0x2a0f9e[_0x30b6('0x1c')]?_0x2a0f9e['options'][_0x30b6('0x1f')]||null:null,'include':_0x2a0f9e[_0x30b6('0x1c')]?_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x20')]?_['map'](_0x2a0f9e[_0x30b6('0x1c')][_0x30b6('0x20')],function(_0x5a7bdd){return{'model':db[_0x5a7bdd[_0x30b6('0x21')]],'as':_0x5a7bdd['as'],'attributes':_0x5a7bdd['attributes'],'include':_0x5a7bdd[_0x30b6('0x20')]?_[_0x30b6('0x22')](_0x5a7bdd[_0x30b6('0x20')],function(_0x590a28){return{'model':db[_0x590a28[_0x30b6('0x21')]],'as':_0x590a28['as'],'attributes':_0x590a28[_0x30b6('0x23')],'include':_0x590a28[_0x30b6('0x20')]?_[_0x30b6('0x22')](_0x590a28[_0x30b6('0x20')],function(_0x2bf84d){return{'model':db[_0x2bf84d[_0x30b6('0x21')]],'as':_0x2bf84d['as'],'attributes':_0x2bf84d[_0x30b6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x30b6('0x10')](function(_0x50adb4){logger[_0x30b6('0x11')]('GetUser',_0x2a0f9e);logger['debug']('GetUser',_0x2a0f9e,JSON[_0x30b6('0x24')](_0x50adb4));_0x46d6bb(_0x50adb4);})['catch'](function(_0x336eac){logger[_0x30b6('0x15')](_0x30b6('0x19'),_0x336eac[_0x30b6('0x17')],_0x2a0f9e);_0x388e18(_0x53417f[_0x30b6('0x15')](0x1f4,_0x336eac[_0x30b6('0x17')]));});});};exports[_0x30b6('0x25')]=function(_0x68115a){var _0x166a95=this;return new Promise(function(_0x2c117b,_0xe85ade){return db['User'][_0x30b6('0x26')]({'raw':_0x68115a[_0x30b6('0x1c')]?_0x68115a['options']['raw']===undefined?!![]:![]:!![],'where':_0x68115a['options']?_0x68115a['options'][_0x30b6('0x1e')]||null:null,'attributes':_0x68115a[_0x30b6('0x1c')]?_0x68115a[_0x30b6('0x1c')]['attributes']||null:null,'include':_0x68115a[_0x30b6('0x1c')]?_0x68115a['options']['include']?_[_0x30b6('0x22')](_0x68115a[_0x30b6('0x1c')]['include'],function(_0x57d478){return{'model':db[_0x57d478[_0x30b6('0x21')]],'as':_0x57d478['as'],'attributes':_0x57d478['attributes'],'include':_0x57d478['include']?_['map'](_0x57d478[_0x30b6('0x20')],function(_0x54cb75){return{'model':db[_0x54cb75['model']],'as':_0x54cb75['as'],'attributes':_0x54cb75[_0x30b6('0x23')],'include':_0x54cb75[_0x30b6('0x20')]?_[_0x30b6('0x22')](_0x54cb75[_0x30b6('0x20')],function(_0x171019){return{'model':db[_0x171019['model']],'as':_0x171019['as'],'attributes':_0x171019[_0x30b6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x30b6('0x10')](function(_0x206e09){logger[_0x30b6('0x11')](_0x30b6('0x25'),_0x68115a);logger['debug'](_0x30b6('0x25'),_0x68115a,JSON['stringify'](_0x206e09));_0x2c117b(_0x206e09);})[_0x30b6('0x18')](function(_0x54556f){logger[_0x30b6('0x15')](_0x30b6('0x25'),_0x54556f[_0x30b6('0x17')],_0x68115a);_0xe85ade(_0x166a95['error'](0x1f4,_0x54556f[_0x30b6('0x17')]));});});};exports[_0x30b6('0x27')]=function(_0x4281cf){var _0x3fbb52=this;return new Promise(function(_0x44fbb1,_0x408653){var _0x2cf614;return db[_0x30b6('0x1a')][_0x30b6('0x26')]({'where':_0x4281cf[_0x30b6('0x1c')][_0x30b6('0x1e')]||{},'attributes':['id',_0x30b6('0x28'),_0x30b6('0x29'),'internal',_0x30b6('0x2a')]})[_0x30b6('0x10')](function(_0x210cab){if(_0x210cab){_0x2cf614=_0x210cab;return db['UserVoiceQueueRt'][_0x30b6('0x2b')]({'paused':0x1},{'where':{'UserId':_0x2cf614['id']},'individualHooks':!![]});}})['then'](function(){if(_0x2cf614){return db[_0x30b6('0x2c')][_0x30b6('0x1b')]({'where':{'membername':_0x2cf614[_0x30b6('0x28')],'type':'PAUSE','exitAt':null}});}})[_0x30b6('0x10')](function(_0x134741){if(_0x2cf614){if(_0x134741&&_0x134741[_0x30b6('0x2d')]){var _0x4e6478=moment()['format'](_0x30b6('0x2e'));for(var _0xb98b83=0x0,_0x37307f=_0x134741[_0x30b6('0x2d')];_0xb98b83<_0x37307f;_0xb98b83++){_0x134741[_0xb98b83]['updateAttributes']({'exitAt':_0x4e6478});}}}})[_0x30b6('0x10')](function(){if(_0x2cf614){var _0x4a3ab3=[];var _0x536da7=utils['getChannels']();_0x536da7[_0x30b6('0x2f')](function(_0x21cee1){_0x4a3ab3[_0x30b6('0x30')]({'channel':_0x21cee1,'membername':_0x2cf614['name'],'interface':_[_0x30b6('0x31')](_0x2cf614[_0x30b6('0x2a')])?util[_0x30b6('0x32')](_0x30b6('0x33'),_0x2cf614['name']):_0x2cf614[_0x30b6('0x2a')],'type':_0x30b6('0x34'),'enterAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e')),'data1':_0x4281cf['body'][_0x30b6('0x35')]||_0x30b6('0x36'),'role':_0x2cf614[_0x30b6('0x29')],'internal':_0x2cf614[_0x30b6('0x37')],'uniqueid':_0x4281cf[_0x30b6('0x38')]['uniqueid']||null});});return db[_0x30b6('0x2c')]['bulkCreate'](_0x4a3ab3,{'individualHooks':!![]});}})['then'](function(){if(_0x2cf614){return _0x2cf614[_0x30b6('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4281cf[_0x30b6('0x38')]['type']||_0x30b6('0x36'),'lastPauseAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e'))});}})[_0x30b6('0x10')](function(_0x1b1e9d){_0x44fbb1(_0x1b1e9d);})[_0x30b6('0x18')](function(_0x2d0ceb){_0x408653(_0x3fbb52[_0x30b6('0x15')](0x1f4,_0x2d0ceb['message']));});});};exports[_0x30b6('0x39')]=function(_0x500fa1){var _0x2a9db0=this;return new Promise(function(_0xec1649,_0x45698d){var _0x5d4d31;return db['User'][_0x30b6('0x3a')]({'where':_0x500fa1[_0x30b6('0x1c')][_0x30b6('0x1e')]||{},'attributes':['id','name']})[_0x30b6('0x10')](function(_0x4ba361){if(_0x4ba361){_0x5d4d31=_0x4ba361;if(_0x500fa1[_0x30b6('0x38')][_0x30b6('0x3b')]&&!utils[_0x30b6('0x3c')](_0x500fa1[_0x30b6('0x38')][_0x30b6('0x3b')])){throw new Error(_0x30b6('0x3d'));}switch(_0x500fa1[_0x30b6('0x38')][_0x30b6('0x3b')]){case'voice':return db[_0x30b6('0x3e')][_0x30b6('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5d4d31['id']}})[_0x30b6('0x10')](function(){return db[_0x30b6('0x2c')][_0x30b6('0x26')]({'where':{'channel':_0x500fa1[_0x30b6('0x38')]['channel'],'membername':_0x5d4d31['name'],'type':_0x30b6('0x34'),'exitAt':null}});})[_0x30b6('0x10')](function(_0x505246){if(_0x505246){return _0x505246[_0x30b6('0x2b')]({'exitAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x30b6('0x10')](function(){return _0x5d4d31[_0x30b6('0x2b')]({'voicePause':![]});});case _0x30b6('0x3f'):case'chat':case'fax':case _0x30b6('0x40'):case'openchannel':case _0x30b6('0x41'):return db[_0x30b6('0x2c')][_0x30b6('0x26')]({'where':{'channel':_0x500fa1[_0x30b6('0x38')][_0x30b6('0x3b')],'membername':_0x5d4d31[_0x30b6('0x28')],'type':_0x30b6('0x34'),'exitAt':null}})[_0x30b6('0x10')](function(_0x3d1ecc){return _0x3d1ecc[_0x30b6('0x2b')]({'exitAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e')),'data2':_0x30b6('0x42')},{'individualHooks':!![]});})[_0x30b6('0x10')](function(){var _0x33db4b={};_[_0x30b6('0x43')](_0x33db4b,util['format'](_0x30b6('0x44'),_0x500fa1[_0x30b6('0x38')][_0x30b6('0x3b')],_0x30b6('0x45')),![]);return _0x5d4d31[_0x30b6('0x2b')](_0x33db4b);});default:return db[_0x30b6('0x3e')][_0x30b6('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5d4d31['id']}})[_0x30b6('0x10')](function(){return db[_0x30b6('0x2c')][_0x30b6('0x1b')]({'where':{'membername':_0x5d4d31[_0x30b6('0x28')],'type':_0x30b6('0x34'),'exitAt':null}});})[_0x30b6('0x10')](function(_0x4af05a){var _0x52c717=[];_0x4af05a[_0x30b6('0x2f')](function(_0x5bc5eb){_0x52c717['push'](_0x5bc5eb[_0x30b6('0x2b')]({'exitAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e')),'data2':_0x30b6('0x42')}));});return BPromise[_0x30b6('0x46')](_0x52c717);})['then'](function(){return _0x5d4d31[_0x30b6('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x12ad31){_0xec1649(_0x12ad31);})[_0x30b6('0x18')](function(_0x4a7ee0){_0x45698d(_0x2a9db0['error'](0x1f4,_0x4a7ee0[_0x30b6('0x17')]));});});};exports[_0x30b6('0x47')]=function(_0xb433de){var _0x2d009d=this;return new Promise(function(_0x8371c8,_0x5f0526){var _0x390fe9;return db[_0x30b6('0x1a')][_0x30b6('0x3a')]({'where':_0xb433de[_0x30b6('0x1c')][_0x30b6('0x1e')]||{},'attributes':['id',_0x30b6('0x28')]})['then'](function(_0x1d2750){if(_0x1d2750){_0x390fe9=_0x1d2750;return db['UserVoiceQueueRt'][_0x30b6('0x48')]({'where':{'membername':_0x390fe9[_0x30b6('0x28')]},'individualHooks':!![]});}})[_0x30b6('0x10')](function(){if(_0x390fe9){return db['MemberReport']['findAll']({'where':{'membername':_0x390fe9[_0x30b6('0x28')],'exitAt':null}});}})[_0x30b6('0x10')](function(_0x57ce0c){if(_0x390fe9){if(_0x57ce0c&&_0x57ce0c[_0x30b6('0x2d')]){var _0x2ffb5d=[];_0x57ce0c[_0x30b6('0x2f')](function(_0x216621){_0x2ffb5d[_0x30b6('0x30')](_0x216621[_0x30b6('0x2b')]({'exitAt':moment()[_0x30b6('0x32')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x30b6('0x46')](_0x2ffb5d);}}})[_0x30b6('0x10')](function(){if(_0x390fe9){return _0x390fe9['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x30b6('0x10')](function(_0x36e463){_0x8371c8(_0x36e463);})[_0x30b6('0x18')](function(_0x4c6a45){_0x5f0526(_0x2d009d['error'](0x1f4,_0x4c6a45[_0x30b6('0x17')]));});});};exports[_0x30b6('0x49')]=function(_0x16c20b){var _0x1dba18=this;return new Promise(function(_0x434e45,_0x1eca5b){var _0x14db05;var _0x13257f;var _0x55ffb2;var _0xf619e;return db[_0x30b6('0x1a')][_0x30b6('0x3a')]({'where':_0x16c20b[_0x30b6('0x1c')][_0x30b6('0x1e')]||{},'attributes':['id',_0x30b6('0x28'),_0x30b6('0x29'),_0x30b6('0x4a'),_0x30b6('0x4b'),_0x30b6('0x37'),_0x30b6('0x4c'),_0x30b6('0x2a')]})['then'](function(_0x157d6c){if(_0x157d6c){_0x14db05=_0x157d6c;_0xf619e=_0x16c20b['body']['interface']?_0x16c20b[_0x30b6('0x38')][_0x30b6('0x2a')]:util[_0x30b6('0x32')](_0x30b6('0x33'),_0x14db05[_0x30b6('0x28')]);return db[_0x30b6('0x1a')]['count']({'where':{'role':_0x30b6('0x4d'),'online':!![],'id':{'$ne':_0x14db05['id']}}});}})['then'](function(_0x284c9b){if(_0x284c9b){_0x55ffb2=_0x284c9b;return require(_0x30b6('0x4e'))[_0x30b6('0x4f')]();}})[_0x30b6('0x10')](function(_0x3b1703){if(_0x3b1703&&_0x3b1703[_0x30b6('0x50')]&&_0x55ffb2>=_0x3b1703[_0x30b6('0x50')]){throw new Error(_0x30b6('0x51'));}})[_0x30b6('0x10')](function(){if(_0x14db05){return db[_0x30b6('0x3e')][_0x30b6('0x48')]({'where':{'membername':_0x14db05['name']},'individualHooks':!![]});}})['then'](function(){if(_0x14db05){return _0x14db05[_0x30b6('0x52')]({'raw':!![]});}})['then'](function(_0x1d2dd8){if(_0x14db05){if(_0x1d2dd8){var _0x583957=[];_0x13257f=_0x1d2dd8;if(_0x13257f[_0x30b6('0x2d')]){for(var _0xa41501=0x0;_0xa41501<_0x13257f['length'];_0xa41501++){_0x583957[_0x30b6('0x30')](db[_0x30b6('0x3e')][_0x30b6('0x53')]({'membername':_0x14db05[_0x30b6('0x28')],'UserId':_0x14db05['id'],'queue_name':_0x13257f[_0xa41501][_0x30b6('0x28')],'VoiceQueueId':_0x13257f[_0xa41501]['id'],'interface':_0xf619e,'paused':_0x14db05[_0x30b6('0x4c')]||![],'penalty':_0x13257f[_0xa41501]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x30b6('0x46')](_0x583957);}}}})[_0x30b6('0x10')](function(){if(_0x14db05){return db[_0x30b6('0x2c')][_0x30b6('0x1b')]({'where':{'membername':_0x14db05['name'],'exitAt':null}});}})[_0x30b6('0x10')](function(_0x544ead){if(_0x14db05){if(_0x544ead&&_0x544ead['length']){var _0x32e0f0=[];_0x544ead[_0x30b6('0x2f')](function(_0x4daeb2){_0x32e0f0['push'](_0x4daeb2[_0x30b6('0x2b')]({'exitAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e'))}));});return BPromise[_0x30b6('0x46')](_0x32e0f0);}}})[_0x30b6('0x10')](function(_0x449968){if(_0x14db05){var _0x332441=[];var _0x358e06=[];var _0x13a4d4=utils[_0x30b6('0x54')]();var _0x120edb={'membername':_0x14db05[_0x30b6('0x28')],'interface':_0xf619e,'enterAt':moment()['format'](_0x30b6('0x2e')),'role':_0x14db05['role'],'internal':_0x14db05[_0x30b6('0x37')]};_0x13a4d4[_0x30b6('0x2f')](function(_0x584663){_0x332441[_0x30b6('0x30')](_[_0x30b6('0x55')]({'channel':_0x584663,'type':_0x30b6('0x56'),'data1':_0x30b6('0x57'),'data2':_0xf619e},_0x120edb));if(_0x14db05[_0x30b6('0x4c')]){_0x358e06[_0x30b6('0x30')](_[_0x30b6('0x55')]({'channel':_0x584663,'type':_0x30b6('0x34'),'data1':'LOGININPAUSE'},_0x120edb));}});return db[_0x30b6('0x2c')]['bulkCreate'](_0x332441[_0x30b6('0x58')](_0x358e06),{'individualHooks':!![]});}})[_0x30b6('0x10')](function(){if(_0x14db05){return _0x14db05[_0x30b6('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e')),'voicePause':_0x14db05[_0x30b6('0x4c')]||![],'mailPause':_0x14db05[_0x30b6('0x4c')]||![],'chatPause':_0x14db05[_0x30b6('0x4c')]||![],'faxPause':_0x14db05[_0x30b6('0x4c')]||![],'smsPause':_0x14db05[_0x30b6('0x4c')]||![],'openchannelPause':_0x14db05[_0x30b6('0x4c')]||![],'pauseType':_0x14db05['loginInPause']?_0x30b6('0x59'):null,'lastPauseAt':moment()[_0x30b6('0x32')](_0x30b6('0x2e')),'interface':_0xf619e});}})['then'](function(_0x284146){_0x434e45(_0x284146);})['catch'](function(_0x26c3d0){_0x1eca5b(_0x1dba18['error'](0x1f4,_0x26c3d0[_0x30b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9f8e4c5..ba7b35c 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 _0xf840=['emit','length','user:','./user.events','save','remove','update'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xf840,0x10d));var _0x0f84=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0xf840[_0x151418];return _0x40e29a;};'use strict';var UserEvents=require(_0x0f84('0x0'));var events=[_0x0f84('0x1'),_0x0f84('0x2'),_0x0f84('0x3')];function createListener(_0x6b441,_0x55320b){return function(_0x5b6843){_0x55320b[_0x0f84('0x4')](_0x6b441,_0x5b6843);};}function removeListener(_0x4ffb50,_0xb34dbe){return function(){UserEvents['removeListener'](_0x4ffb50,_0xb34dbe);};}exports['register']=function(_0x503de4){for(var _0x40d201=0x0,_0x1ee833=events[_0x0f84('0x5')];_0x40d201<_0x1ee833;_0x40d201++){var _0x365654=events[_0x40d201];var _0x61f0b1=createListener(_0x0f84('0x6')+_0x365654,_0x503de4);UserEvents['on'](_0x365654,_0x61f0b1);}}; \ No newline at end of file +var _0xcc6a=['./user.events','remove','update','emit','register'];(function(_0x53db06,_0x133b7f){var _0x4d350f=function(_0x20a29d){while(--_0x20a29d){_0x53db06['push'](_0x53db06['shift']());}};_0x4d350f(++_0x133b7f);}(_0xcc6a,0x168));var _0xacc6=function(_0x319a8e,_0x24b39c){_0x319a8e=_0x319a8e-0x0;var _0x3074ff=_0xcc6a[_0x319a8e];return _0x3074ff;};'use strict';var UserEvents=require(_0xacc6('0x0'));var events=['save',_0xacc6('0x1'),_0xacc6('0x2')];function createListener(_0x399992,_0x331c5f){return function(_0x5668bb){_0x331c5f[_0xacc6('0x3')](_0x399992,_0x5668bb);};}function removeListener(_0x3ede1c,_0x1b6a27){return function(){UserEvents['removeListener'](_0x3ede1c,_0x1b6a27);};}exports[_0xacc6('0x4')]=function(_0x2c49ff){for(var _0x1e654f=0x0,_0x3534a9=events['length'];_0x1e654f<_0x3534a9;_0x1e654f++){var _0x53cc83=events[_0x1e654f];var _0x41205e=createListener('user:'+_0x53cc83,_0x2c49ff);UserEvents['on'](_0x53cc83,_0x41205e);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9cee3d3..67fa64c 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 _0x0ad0=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x57ac05,_0x555b58){var _0x4c6700=function(_0x122c78){while(--_0x122c78){_0x57ac05['push'](_0x57ac05['shift']());}};_0x4c6700(++_0x555b58);}(_0x0ad0,0x124));var _0x00ad=function(_0x2520ac,_0x52c88b){_0x2520ac=_0x2520ac-0x0;var _0x58281c=_0x0ad0[_0x2520ac];return _0x58281c;};'use strict';var multer=require(_0x00ad('0x0'));var util=require(_0x00ad('0x1'));var path=require(_0x00ad('0x2'));var timeout=require(_0x00ad('0x3'));var express=require(_0x00ad('0x4'));var router=express[_0x00ad('0x5')]();var auth=require(_0x00ad('0x6'));var interaction=require(_0x00ad('0x7'));var config=require(_0x00ad('0x8'));module[_0x00ad('0x9')]=router; \ No newline at end of file +var _0xe768=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe768,0xd1));var _0x8e76=function(_0x30bb4d,_0x489107){_0x30bb4d=_0x30bb4d-0x0;var _0x19022a=_0xe768[_0x30bb4d];return _0x19022a;};'use strict';var multer=require(_0x8e76('0x0'));var util=require(_0x8e76('0x1'));var path=require(_0x8e76('0x2'));var timeout=require(_0x8e76('0x3'));var express=require('express');var router=express[_0x8e76('0x4')]();var auth=require(_0x8e76('0x5'));var interaction=require(_0x8e76('0x6'));var config=require('../../config/environment');module[_0x8e76('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 44fc87b..15eab45 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 _0xb10b=['sequelize','INTEGER'];(function(_0x2285f7,_0x3731be){var _0x28536f=function(_0x136054){while(--_0x136054){_0x2285f7['push'](_0x2285f7['shift']());}};_0x28536f(++_0x3731be);}(_0xb10b,0x12a));var _0xbb10=function(_0x21ecd6,_0x53e0a6){_0x21ecd6=_0x21ecd6-0x0;var _0x5b2b5a=_0xb10b[_0x21ecd6];return _0x5b2b5a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x51f0e8,_0x3fbc6a){var _0xf73e33=function(_0x2ec313){while(--_0x2ec313){_0x51f0e8['push'](_0x51f0e8['shift']());}};_0xf73e33(++_0x3fbc6a);}(_0xe706,0xa3));var _0x6e70=function(_0x25bbd6,_0x18f6d3){_0x25bbd6=_0x25bbd6-0x0;var _0x3a4c78=_0xe706[_0x25bbd6];return _0x3a4c78;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 53d467e..ac2b450 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 _0x4815=['bluebird','request-promise','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1ef717,_0xa18bbe){var _0xb3dd02=function(_0x351930){while(--_0x351930){_0x1ef717['push'](_0x1ef717['shift']());}};_0xb3dd02(++_0xa18bbe);}(_0x4815,0xff));var _0x5481=function(_0x4b978e,_0x194c22){_0x4b978e=_0x4b978e-0x0;var _0x2b7b54=_0x4815[_0x4b978e];return _0x2b7b54;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var logger=require(_0x5481('0x2'))(_0x5481('0x3'));var moment=require(_0x5481('0x4'));var BPromise=require(_0x5481('0x5'));var rp=require(_0x5481('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5481('0x7'));var attributes=require(_0x5481('0x8'));module[_0x5481('0x9')]=function(_0x3de2c3,_0xa91d26){return _0x3de2c3[_0x5481('0xa')](_0x5481('0xb'),attributes,{'tableName':_0x5481('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff22=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xff22,0x135));var _0x2ff2=function(_0x51ba3a,_0x127959){_0x51ba3a=_0x51ba3a-0x0;var _0x1229f6=_0xff22[_0x51ba3a];return _0x1229f6;};'use strict';var _=require(_0x2ff2('0x0'));var util=require(_0x2ff2('0x1'));var logger=require(_0x2ff2('0x2'))(_0x2ff2('0x3'));var moment=require(_0x2ff2('0x4'));var BPromise=require(_0x2ff2('0x5'));var rp=require(_0x2ff2('0x6'));var fs=require('fs');var path=require(_0x2ff2('0x7'));var rimraf=require(_0x2ff2('0x8'));var config=require(_0x2ff2('0x9'));var attributes=require(_0x2ff2('0xa'));module[_0x2ff2('0xb')]=function(_0x1c6b28,_0xb542c0){return _0x1c6b28[_0x2ff2('0xc')](_0x2ff2('0xd'),attributes,{'tableName':_0x2ff2('0xe'),'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 dfb1b7a..57ad4bb 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 _0x9388=['UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x19bb73,_0x41d35c){var _0x24ff0d=function(_0x2c5995){while(--_0x2c5995){_0x19bb73['push'](_0x19bb73['shift']());}};_0x24ff0d(++_0x41d35c);}(_0x9388,0xb3));var _0x8938=function(_0x1a3709,_0x437cfd){_0x1a3709=_0x1a3709-0x0;var _0x2b3146=_0x9388[_0x1a3709];return _0x2b3146;};'use strict';var _=require('lodash');var util=require(_0x8938('0x0'));var moment=require(_0x8938('0x1'));var BPromise=require(_0x8938('0x2'));var rs=require(_0x8938('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8938('0x4'))['db'];var utils=require(_0x8938('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8938('0x6'));var jayson=require(_0x8938('0x7'));var client=jayson[_0x8938('0x8')][_0x8938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e6a31,_0x44cc27,_0x48c996){return new BPromise(function(_0x1b24cf,_0x72b511){return client['request'](_0x1e6a31,_0x48c996)['then'](function(_0x13ab24){logger['info'](_0x8938('0xa'),_0x44cc27,'request\x20sent');logger[_0x8938('0xb')](_0x8938('0xc'),_0x44cc27,_0x8938('0xd'),JSON[_0x8938('0xe')](_0x13ab24));if(_0x13ab24[_0x8938('0xf')]){if(_0x13ab24[_0x8938('0xf')][_0x8938('0x10')]===0x1f4){logger[_0x8938('0xf')](_0x8938('0xa'),_0x44cc27,_0x13ab24[_0x8938('0xf')][_0x8938('0x11')]);return _0x72b511(_0x13ab24['error'][_0x8938('0x11')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x44cc27,_0x13ab24[_0x8938('0xf')][_0x8938('0x11')]);return _0x1b24cf(_0x13ab24[_0x8938('0xf')][_0x8938('0x11')]);}else{logger[_0x8938('0x12')](_0x8938('0xa'),_0x44cc27,'request\x20sent');_0x1b24cf(_0x13ab24[_0x8938('0x13')][_0x8938('0x11')]);}})[_0x8938('0x14')](function(_0x4fc69e){logger[_0x8938('0xf')](_0x8938('0xa'),_0x44cc27,_0x4fc69e);_0x72b511(_0x4fc69e);});});} \ No newline at end of file +var _0xff4b=['http','request','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','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16bb1c,_0x58f468){var _0xace56c=function(_0x216f59){while(--_0x216f59){_0x16bb1c['push'](_0x16bb1c['shift']());}};_0xace56c(++_0x58f468);}(_0xff4b,0x16c));var _0xbff4=function(_0x4d4942,_0x2ed26d){_0x4d4942=_0x4d4942-0x0;var _0x2fa30a=_0xff4b[_0x4d4942];return _0x2fa30a;};'use strict';var _=require(_0xbff4('0x0'));var util=require(_0xbff4('0x1'));var moment=require(_0xbff4('0x2'));var BPromise=require(_0xbff4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbff4('0x4'));var db=require(_0xbff4('0x5'))['db'];var utils=require(_0xbff4('0x6'));var logger=require(_0xbff4('0x7'))(_0xbff4('0x8'));var config=require(_0xbff4('0x9'));var jayson=require(_0xbff4('0xa'));var client=jayson['client'][_0xbff4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e89a4,_0x112b3b,_0x23f27f){return new BPromise(function(_0x23ec38,_0x390f9f){return client[_0xbff4('0xc')](_0x3e89a4,_0x23f27f)[_0xbff4('0xd')](function(_0x16e448){logger[_0xbff4('0xe')](_0xbff4('0xf'),_0x112b3b,_0xbff4('0x10'));logger[_0xbff4('0x11')](_0xbff4('0x12'),_0x112b3b,_0xbff4('0x10'),JSON[_0xbff4('0x13')](_0x16e448));if(_0x16e448[_0xbff4('0x14')]){if(_0x16e448['error'][_0xbff4('0x15')]===0x1f4){logger[_0xbff4('0x14')](_0xbff4('0xf'),_0x112b3b,_0x16e448[_0xbff4('0x14')][_0xbff4('0x16')]);return _0x390f9f(_0x16e448[_0xbff4('0x14')]['message']);}logger['error'](_0xbff4('0xf'),_0x112b3b,_0x16e448['error'][_0xbff4('0x16')]);return _0x23ec38(_0x16e448[_0xbff4('0x14')]['message']);}else{logger['info'](_0xbff4('0xf'),_0x112b3b,_0xbff4('0x10'));_0x23ec38(_0x16e448[_0xbff4('0x17')][_0xbff4('0x16')]);}})[_0xbff4('0x18')](function(_0x36fd96){logger[_0xbff4('0x14')](_0xbff4('0xf'),_0x112b3b,_0x36fd96);_0x390f9f(_0x36fd96);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ff9dab5..2f1ae46 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 _0x94aa=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x472b7c,_0x2982a0){var _0x277935=function(_0x420ccf){while(--_0x420ccf){_0x472b7c['push'](_0x472b7c['shift']());}};_0x277935(++_0x2982a0);}(_0x94aa,0x15c));var _0xa94a=function(_0x862d35,_0x4dfa6b){_0x862d35=_0x862d35-0x0;var _0x3e0bb0=_0x94aa[_0x862d35];return _0x3e0bb0;};'use strict';var multer=require(_0xa94a('0x0'));var util=require(_0xa94a('0x1'));var path=require(_0xa94a('0x2'));var timeout=require(_0xa94a('0x3'));var express=require(_0xa94a('0x4'));var router=express['Router']();var auth=require(_0xa94a('0x5'));var interaction=require(_0xa94a('0x6'));var config=require(_0xa94a('0x7'));module['exports']=router; \ No newline at end of file +var _0xa8bb=['../../components/interaction/service','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x35ebbb,_0xe862ef){var _0x29d9b=function(_0x4fee98){while(--_0x4fee98){_0x35ebbb['push'](_0x35ebbb['shift']());}};_0x29d9b(++_0xe862ef);}(_0xa8bb,0xf1));var _0xba8b=function(_0x370020,_0x4a5fb6){_0x370020=_0x370020-0x0;var _0x483189=_0xa8bb[_0x370020];return _0x483189;};'use strict';var multer=require(_0xba8b('0x0'));var util=require(_0xba8b('0x1'));var path=require(_0xba8b('0x2'));var timeout=require(_0xba8b('0x3'));var express=require(_0xba8b('0x4'));var router=express[_0xba8b('0x5')]();var auth=require(_0xba8b('0x6'));var interaction=require(_0xba8b('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 5961c1b..b013398 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 _0x8e3f=['STRING','sequelize','exports','INTEGER'];(function(_0x36f71e,_0x5949ca){var _0x224bfa=function(_0x1b4cf9){while(--_0x1b4cf9){_0x36f71e['push'](_0x36f71e['shift']());}};_0x224bfa(++_0x5949ca);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'penalty':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf8e3('0x3')]}}; \ No newline at end of file +var _0x4fc2=['sequelize','exports','INTEGER'];(function(_0x3135ac,_0x1b0811){var _0x3691e8=function(_0x1959ec){while(--_0x1959ec){_0x3135ac['push'](_0x3135ac['shift']());}};_0x3691e8(++_0x1b0811);}(_0x4fc2,0x111));var _0x24fc=function(_0x23deec,_0x207fc0){_0x23deec=_0x23deec-0x0;var _0xe9659e=_0x4fc2[_0x23deec];return _0xe9659e;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'penalty':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index bfeb8dc..3a69143 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 _0xd509=['exports','define','user_has_fax_queues','../../config/logger','api','moment','path','rimraf','./userFaxQueue.attributes'];(function(_0x250ed0,_0x13399e){var _0x49a3ab=function(_0x1921da){while(--_0x1921da){_0x250ed0['push'](_0x250ed0['shift']());}};_0x49a3ab(++_0x13399e);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d50('0x0'))(_0x9d50('0x1'));var moment=require(_0x9d50('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d50('0x3'));var rimraf=require(_0x9d50('0x4'));var config=require('../../config/environment');var attributes=require(_0x9d50('0x5'));module[_0x9d50('0x6')]=function(_0x1800ce,_0x54afc4){return _0x1800ce[_0x9d50('0x7')]('UserFaxQueue',attributes,{'tableName':_0x9d50('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa866=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define'];(function(_0x51fb44,_0x541be8){var _0x531423=function(_0x142281){while(--_0x142281){_0x51fb44['push'](_0x51fb44['shift']());}};_0x531423(++_0x541be8);}(_0xa866,0x6a));var _0x6a86=function(_0x428920,_0x2bf461){_0x428920=_0x428920-0x0;var _0x3ed193=_0xa866[_0x428920];return _0x3ed193;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var logger=require(_0x6a86('0x2'))(_0x6a86('0x3'));var moment=require(_0x6a86('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a86('0x5'));var fs=require('fs');var path=require(_0x6a86('0x6'));var rimraf=require(_0x6a86('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a86('0x8'));module[_0x6a86('0x9')]=function(_0xac49a,_0x5e7673){return _0xac49a[_0x6a86('0xa')](_0x6a86('0xb'),attributes,{'tableName':_0x6a86('0xc'),'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 9a94e0d..9caf318 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 _0x8738=['debug','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x8738,0x1aa));var _0x8873=function(_0x189579,_0x791321){_0x189579=_0x189579-0x0;var _0x5d55a8=_0x8738[_0x189579];return _0x5d55a8;};'use strict';var _=require(_0x8873('0x0'));var util=require('util');var moment=require(_0x8873('0x1'));var BPromise=require(_0x8873('0x2'));var rs=require(_0x8873('0x3'));var fs=require('fs');var Redis=require(_0x8873('0x4'));var db=require(_0x8873('0x5'))['db'];var utils=require(_0x8873('0x6'));var logger=require('../../config/logger')(_0x8873('0x7'));var config=require('../../config/environment');var jayson=require(_0x8873('0x8'));var client=jayson[_0x8873('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca0f4,_0x3ebe16,_0x972dc8){return new BPromise(function(_0x492bc9,_0x3d0124){return client[_0x8873('0xa')](_0x1ca0f4,_0x972dc8)[_0x8873('0xb')](function(_0x5ec70a){logger[_0x8873('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x3ebe16,_0x8873('0xd'));logger[_0x8873('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3ebe16,_0x8873('0xd'),JSON[_0x8873('0xf')](_0x5ec70a));if(_0x5ec70a[_0x8873('0x10')]){if(_0x5ec70a[_0x8873('0x10')][_0x8873('0x11')]===0x1f4){logger[_0x8873('0x10')](_0x8873('0x12'),_0x3ebe16,_0x5ec70a[_0x8873('0x10')][_0x8873('0x13')]);return _0x3d0124(_0x5ec70a[_0x8873('0x10')][_0x8873('0x13')]);}logger[_0x8873('0x10')](_0x8873('0x12'),_0x3ebe16,_0x5ec70a['error'][_0x8873('0x13')]);return _0x492bc9(_0x5ec70a['error'][_0x8873('0x13')]);}else{logger[_0x8873('0xc')](_0x8873('0x12'),_0x3ebe16,_0x8873('0xd'));_0x492bc9(_0x5ec70a[_0x8873('0x14')][_0x8873('0x13')]);}})[_0x8873('0x15')](function(_0x237593){logger[_0x8873('0x10')](_0x8873('0x12'),_0x3ebe16,_0x237593);_0x3d0124(_0x237593);});});} \ No newline at end of file +var _0x9b05=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x25077b,_0x249013){var _0x285a52=function(_0x2782eb){while(--_0x2782eb){_0x25077b['push'](_0x25077b['shift']());}};_0x285a52(++_0x249013);}(_0x9b05,0x1cb));var _0x59b0=function(_0x408758,_0x548c1f){_0x408758=_0x408758-0x0;var _0x2e25ae=_0x9b05[_0x408758];return _0x2e25ae;};'use strict';var _=require('lodash');var util=require(_0x59b0('0x0'));var moment=require(_0x59b0('0x1'));var BPromise=require(_0x59b0('0x2'));var rs=require(_0x59b0('0x3'));var fs=require('fs');var Redis=require(_0x59b0('0x4'));var db=require(_0x59b0('0x5'))['db'];var utils=require(_0x59b0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x59b0('0x7'));var jayson=require(_0x59b0('0x8'));var client=jayson[_0x59b0('0x9')][_0x59b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb628,_0x91ad6c,_0xe5f92f){return new BPromise(function(_0x35000a,_0x4ef01f){return client[_0x59b0('0xb')](_0x5eb628,_0xe5f92f)[_0x59b0('0xc')](function(_0x26612c){logger['info'](_0x59b0('0xd'),_0x91ad6c,_0x59b0('0xe'));logger[_0x59b0('0xf')](_0x59b0('0x10'),_0x91ad6c,'request\x20sent',JSON[_0x59b0('0x11')](_0x26612c));if(_0x26612c[_0x59b0('0x12')]){if(_0x26612c[_0x59b0('0x12')][_0x59b0('0x13')]===0x1f4){logger[_0x59b0('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x91ad6c,_0x26612c['error'][_0x59b0('0x14')]);return _0x4ef01f(_0x26612c['error'][_0x59b0('0x14')]);}logger['error'](_0x59b0('0xd'),_0x91ad6c,_0x26612c[_0x59b0('0x12')]['message']);return _0x35000a(_0x26612c[_0x59b0('0x12')][_0x59b0('0x14')]);}else{logger['info'](_0x59b0('0xd'),_0x91ad6c,_0x59b0('0xe'));_0x35000a(_0x26612c[_0x59b0('0x15')][_0x59b0('0x14')]);}})[_0x59b0('0x16')](function(_0x1ef11){logger['error'](_0x59b0('0xd'),_0x91ad6c,_0x1ef11);_0x4ef01f(_0x1ef11);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5f5fce4..e76dbbb 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 _0x6b2c=['multer','util','path','connect-timeout','express','Router','../../config/environment','exports'];(function(_0x218f3c,_0x37b118){var _0x5e1443=function(_0x2a993e){while(--_0x2a993e){_0x218f3c['push'](_0x218f3c['shift']());}};_0x5e1443(++_0x37b118);}(_0x6b2c,0x128));var _0xc6b2=function(_0x4d79c4,_0xc566a6){_0x4d79c4=_0x4d79c4-0x0;var _0x1e7f53=_0x6b2c[_0x4d79c4];return _0x1e7f53;};'use strict';var multer=require(_0xc6b2('0x0'));var util=require(_0xc6b2('0x1'));var path=require(_0xc6b2('0x2'));var timeout=require(_0xc6b2('0x3'));var express=require(_0xc6b2('0x4'));var router=express[_0xc6b2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6b2('0x6'));module[_0xc6b2('0x7')]=router; \ No newline at end of file +var _0xf1a7=['../../config/environment','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xf1a7,0x1d2));var _0x7f1a=function(_0x2f8141,_0x1052ab){_0x2f8141=_0x2f8141-0x0;var _0x9761da=_0xf1a7[_0x2f8141];return _0x9761da;};'use strict';var multer=require(_0x7f1a('0x0'));var util=require(_0x7f1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f1a('0x2'));var router=express[_0x7f1a('0x3')]();var auth=require(_0x7f1a('0x4'));var interaction=require(_0x7f1a('0x5'));var config=require(_0x7f1a('0x6'));module[_0x7f1a('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 a20aa90..4b6e9b5 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 _0xbaf0=['exports','INTEGER'];(function(_0x4f1b87,_0x260834){var _0x74718e=function(_0x24c7c2){while(--_0x24c7c2){_0x4f1b87['push'](_0x4f1b87['shift']());}};_0x74718e(++_0x260834);}(_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')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x450b17,_0x58f404){var _0x38cb2b=function(_0x2b830e){while(--_0x2b830e){_0x450b17['push'](_0x450b17['shift']());}};_0x38cb2b(++_0x58f404);}(_0xe706,0xa3));var _0x6e70=function(_0x4dee14,_0x3d6aba){_0x4dee14=_0x4dee14-0x0;var _0x4daacb=_0xe706[_0x4dee14];return _0x4daacb;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 791bc48..a0d3c48 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x367ca0,_0x108fe2){var _0x7fc358=function(_0x23ca28){while(--_0x23ca28){_0x367ca0['push'](_0x367ca0['shift']());}};_0x7fc358(++_0x108fe2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x3020d5,_0x496039){var _0x4f1828=function(_0x2664a9){while(--_0x2664a9){_0x3020d5['push'](_0x3020d5['shift']());}};_0x4f1828(++_0x496039);}(_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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 03636b4..feb9667 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 _0x109b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','UserMailQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x2caf3a,_0xc6126b){var _0x455fef=function(_0x20d4f5){while(--_0x20d4f5){_0x2caf3a['push'](_0x2caf3a['shift']());}};_0x455fef(++_0xc6126b);}(_0x109b,0x175));var _0xb109=function(_0x3abf39,_0x2a8ca5){_0x3abf39=_0x3abf39-0x0;var _0x447491=_0x109b[_0x3abf39];return _0x447491;};'use strict';var _=require(_0xb109('0x0'));var util=require(_0xb109('0x1'));var moment=require(_0xb109('0x2'));var BPromise=require(_0xb109('0x3'));var rs=require(_0xb109('0x4'));var fs=require('fs');var Redis=require(_0xb109('0x5'));var db=require(_0xb109('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb109('0x7'))(_0xb109('0x8'));var config=require(_0xb109('0x9'));var jayson=require(_0xb109('0xa'));var client=jayson[_0xb109('0xb')][_0xb109('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x479d1f,_0x8e5c9c,_0x2e6278){return new BPromise(function(_0x452f4e,_0x42736e){return client['request'](_0x479d1f,_0x2e6278)['then'](function(_0x544688){logger[_0xb109('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x8e5c9c,'request\x20sent');logger['debug'](_0xb109('0xe'),_0x8e5c9c,'request\x20sent',JSON['stringify'](_0x544688));if(_0x544688['error']){if(_0x544688[_0xb109('0xf')][_0xb109('0x10')]===0x1f4){logger['error'](_0xb109('0x11'),_0x8e5c9c,_0x544688[_0xb109('0xf')][_0xb109('0x12')]);return _0x42736e(_0x544688[_0xb109('0xf')][_0xb109('0x12')]);}logger[_0xb109('0xf')](_0xb109('0x11'),_0x8e5c9c,_0x544688[_0xb109('0xf')][_0xb109('0x12')]);return _0x452f4e(_0x544688[_0xb109('0xf')][_0xb109('0x12')]);}else{logger[_0xb109('0xd')](_0xb109('0x11'),_0x8e5c9c,_0xb109('0x13'));_0x452f4e(_0x544688[_0xb109('0x14')][_0xb109('0x12')]);}})[_0xb109('0x15')](function(_0x2ea5ed){logger[_0xb109('0xf')](_0xb109('0x11'),_0x8e5c9c,_0x2ea5ed);_0x42736e(_0x2ea5ed);});});} \ No newline at end of file +var _0xb7ae=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x2f1f93,_0x55b2b7){_0x2f1f93=_0x2f1f93-0x0;var _0x3b2e8e=_0xb7ae[_0x2f1f93];return _0x3b2e8e;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var moment=require(_0xeb7a('0x2'));var BPromise=require(_0xeb7a('0x3'));var rs=require(_0xeb7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb7a('0x5'))['db'];var utils=require(_0xeb7a('0x6'));var logger=require(_0xeb7a('0x7'))('rpc');var config=require(_0xeb7a('0x8'));var jayson=require(_0xeb7a('0x9'));var client=jayson[_0xeb7a('0xa')][_0xeb7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365bc0,_0x5eeb35,_0x1d872f){return new BPromise(function(_0x19f415,_0x37b060){return client['request'](_0x365bc0,_0x1d872f)[_0xeb7a('0xc')](function(_0x4243b5){logger[_0xeb7a('0xd')](_0xeb7a('0xe'),_0x5eeb35,_0xeb7a('0xf'));logger[_0xeb7a('0x10')](_0xeb7a('0x11'),_0x5eeb35,'request\x20sent',JSON['stringify'](_0x4243b5));if(_0x4243b5[_0xeb7a('0x12')]){if(_0x4243b5[_0xeb7a('0x12')][_0xeb7a('0x13')]===0x1f4){logger[_0xeb7a('0x12')](_0xeb7a('0xe'),_0x5eeb35,_0x4243b5[_0xeb7a('0x12')][_0xeb7a('0x14')]);return _0x37b060(_0x4243b5['error'][_0xeb7a('0x14')]);}logger[_0xeb7a('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x5eeb35,_0x4243b5[_0xeb7a('0x12')][_0xeb7a('0x14')]);return _0x19f415(_0x4243b5['error'][_0xeb7a('0x14')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x5eeb35,_0xeb7a('0xf'));_0x19f415(_0x4243b5['result']['message']);}})[_0xeb7a('0x15')](function(_0x38f5cc){logger[_0xeb7a('0x12')](_0xeb7a('0xe'),_0x5eeb35,_0x38f5cc);_0x37b060(_0x38f5cc);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ab8c467..4d23967 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 _0x3176=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout'];(function(_0x2beba9,_0x304957){var _0xfb6f7e=function(_0x331689){while(--_0x331689){_0x2beba9['push'](_0x2beba9['shift']());}};_0xfb6f7e(++_0x304957);}(_0x3176,0x1d8));var _0x6317=function(_0x56e9ce,_0x451b0c){_0x56e9ce=_0x56e9ce-0x0;var _0xfa6c71=_0x3176[_0x56e9ce];return _0xfa6c71;};'use strict';var multer=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var path=require(_0x6317('0x2'));var timeout=require(_0x6317('0x3'));var express=require(_0x6317('0x4'));var router=express[_0x6317('0x5')]();var auth=require(_0x6317('0x6'));var interaction=require(_0x6317('0x7'));var config=require(_0x6317('0x8'));var controller=require(_0x6317('0x9'));router[_0x6317('0xa')]('/',auth[_0x6317('0xb')](),controller[_0x6317('0xc')]);module[_0x6317('0xd')]=router; \ No newline at end of file +var _0x0490=['isAuthenticated','sendUserNotification','exports','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x5d897d,_0x8f648e){var _0x21a626=function(_0x43d4c9){while(--_0x43d4c9){_0x5d897d['push'](_0x5d897d['shift']());}};_0x21a626(++_0x8f648e);}(_0x0490,0x147));var _0x0049=function(_0x141bb7,_0x70b2ad){_0x141bb7=_0x141bb7-0x0;var _0x377848=_0x0490[_0x141bb7];return _0x377848;};'use strict';var multer=require('multer');var util=require(_0x0049('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0049('0x1'));var interaction=require(_0x0049('0x2'));var config=require(_0x0049('0x3'));var controller=require(_0x0049('0x4'));router[_0x0049('0x5')]('/',auth[_0x0049('0x6')](),controller[_0x0049('0x7')]);module[_0x0049('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6c6136c..22cbe73 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 _0xf0a8=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x1cd918,_0x16b64b){var _0x5bdf1d=function(_0x167f91){while(--_0x167f91){_0x1cd918['push'](_0x1cd918['shift']());}};_0x5bdf1d(++_0x16b64b);}(_0xf0a8,0x8e));var _0x8f0a=function(_0x151092,_0x12dc86){_0x151092=_0x151092-0x0;var _0xe078c6=_0xf0a8[_0x151092];return _0xe078c6;};'use strict';var Sequelize=require(_0x8f0a('0x0'));module['exports']={'body':{'type':Sequelize[_0x8f0a('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x8f0a('0x2')]},'beep':{'type':Sequelize[_0x8f0a('0x3')]}}; \ No newline at end of file +var _0xd4f8=['exports','TEXT','STRING','sequelize'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0xd4f8,0x133));var _0x8d4f=function(_0x42d94f,_0x4a59c9){_0x42d94f=_0x42d94f-0x0;var _0x549aaf=_0xd4f8[_0x42d94f];return _0x549aaf;};'use strict';var Sequelize=require(_0x8d4f('0x0'));module[_0x8d4f('0x1')]={'body':{'type':Sequelize[_0x8d4f('0x2')]},'senderName':{'type':Sequelize[_0x8d4f('0x3')]},'recipientsId':{'type':Sequelize[_0x8d4f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8d4f('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 7b92ec1..0701e19 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 _0xa9e0=['Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','ids','includes','queue','replace','Queue','all','map','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','userNotification','create','forEach','userNotification:send','catch','Template','findOne','html'];(function(_0x4003f0,_0x351666){var _0x229861=function(_0x32ab04){while(--_0x32ab04){_0x4003f0['push'](_0x4003f0['shift']());}};_0x229861(++_0x351666);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4,_0x11c3b6){if(!_0x140511[_0x0a9e('0x28')]['hasOwnProperty'](_0x0a9e('0x29'))&&!_0x140511[_0x0a9e('0x28')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))){throw new db['Sequelize'][(_0x0a9e('0x2c'))](_0x0a9e('0x2d'));}else{if(_0x140511[_0x0a9e('0x28')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))&&!_0x140511[_0x0a9e('0x28')][_0x0a9e('0x2a')](_0x0a9e('0x2e'))){throw new db[(_0x0a9e('0x2f'))]['ValidationError'](_0x0a9e('0x30'));}if(!_0x140511['body'][_0x0a9e('0x2a')](_0x0a9e('0x31'))){throw new db[(_0x0a9e('0x2f'))][(_0x0a9e('0x2c'))](_0x0a9e('0x32'));}else{try{var _0x5180f1=JSON[_0x0a9e('0x33')](_0x140511[_0x0a9e('0x28')][_0x0a9e('0x31')]);}catch(_0x2da5c0){logger[_0x0a9e('0x34')](_0x2da5c0);throw new db[(_0x0a9e('0x2f'))][(_0x0a9e('0x2c'))](_0x0a9e('0x35'));}var _0x5583a4=[_0x0a9e('0x36'),'faxqueue',_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39'),_0x0a9e('0x3a'),'whatsappqueue',_0x0a9e('0x3b'),_0x0a9e('0x3c')];if(_[_0x0a9e('0x3d')](_0x5180f1,function(_0x15de0e){return!_['includes'](_0x5583a4,_0x15de0e['model'][_0x0a9e('0x3e')]());})){throw new db['Sequelize'][(_0x0a9e('0x2c'))](_0x0a9e('0x3f'));}}}var _0x381c37={};_0x381c37[_0x0a9e('0x40')]=_0x140511['body'][_0x0a9e('0x2a')](_0x0a9e('0x40'))?_0x140511[_0x0a9e('0x28')]['senderName']:_0x140511[_0x0a9e('0x3c')][_0x0a9e('0x41')];_0x381c37[_0x0a9e('0x42')]=_['isEmpty'](_0x140511['body'][_0x0a9e('0x42')])?null:_0x140511[_0x0a9e('0x28')]['recipientsDescription'];_0x381c37[_0x0a9e('0x43')]=_0x140511[_0x0a9e('0x28')][_0x0a9e('0x43')]||![];_0x381c37[_0x0a9e('0x44')]=_0x140511['user']['id'];return getContent(_0x140511['body'])[_0x0a9e('0x22')](function(_0x45b3d0){_0x381c37['body']=_0x45b3d0;return getRecipients(_0x5180f1);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x381c37[_0x0a9e('0x45')]=_['sortBy'](_0x1dec2e)[_0x0a9e('0x46')](',');return db[_0x0a9e('0x47')][_0x0a9e('0x48')](function(_0x43dd5b){return db[_0x0a9e('0x49')][_0x0a9e('0x4a')](_0x381c37,{'raw':!![],'transaction':_0x43dd5b})[_0x0a9e('0x22')](function(_0x45a9b8){var _0x23b089={'sender':_0x381c37[_0x0a9e('0x40')],'description':_0x381c37[_0x0a9e('0x42')],'content':_0x381c37[_0x0a9e('0x28')],'beep':_0x381c37[_0x0a9e('0x43')]};_0x1dec2e[_0x0a9e('0x4b')](function(_0x37f6cc){_0x23b089['recipient']=_0x37f6cc;socket['emit'](_0x0a9e('0x4c'),_0x23b089);});return _0x45a9b8;});});})[_0x0a9e('0x22')](respondWithResult(_0x1538a4,0xc9))[_0x0a9e('0x4d')](handleError(_0x1538a4,null));};function getContent(_0x315881){return new BPromise(function(_0x1a69dd,_0xc9a702){if(_0x315881[_0x0a9e('0x29')]){_0x1a69dd(_0x315881[_0x0a9e('0x29')]);return;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'attributes':[_0x0a9e('0x50')],'where':{'id':_0x315881[_0x0a9e('0x2b')]},'raw':!![]})['then'](function(_0x117c99){if(!_0x117c99)throw new db[(_0x0a9e('0x2f'))][(_0x0a9e('0x2c'))](_0x0a9e('0x51'));var _0x2e8caf=Mustache[_0x0a9e('0x52')](_0x117c99[_0x0a9e('0x50')],_0x315881[_0x0a9e('0x2e')]);_0x1a69dd(_0x2e8caf);})['catch'](function(_0x2e9d90){_0xc9a702(_0x2e9d90);});});}function getRecipients(_0x48fd45){return new BPromise(function(_0x473dc8,_0x476688){var _0x8d6dd1=[];var _0x562fb4=[];_0x48fd45[_0x0a9e('0x4b')](function(_0x7f6eb1){var _0x4774f4=_[_0x0a9e('0x53')](_0x7f6eb1[_0x0a9e('0x54')][_0x0a9e('0x3e')]());if(_0x4774f4===_0x0a9e('0x55')){_0x8d6dd1=_['union'](_0x8d6dd1,_0x7f6eb1[_0x0a9e('0x56')]);}else{if(_[_0x0a9e('0x57')](_0x4774f4,_0x0a9e('0x58')))_0x4774f4=_0x4774f4[_0x0a9e('0x59')](_0x0a9e('0x58'),_0x0a9e('0x5a'));_0x7f6eb1[_0x0a9e('0x56')][_0x0a9e('0x4b')](function(_0x34febd){_0x562fb4['push'](getAgents(_0x4774f4,_0x34febd));});}});return BPromise[_0x0a9e('0x5b')](_0x562fb4)[_0x0a9e('0x22')](function(_0x4f7240){_0x8d6dd1=_['union'](_0x8d6dd1,_['flatten'](_0x4f7240));_0x473dc8(_0x8d6dd1);})[_0x0a9e('0x4d')](function(_0x4317e3){_0x476688(_0x4317e3);});});}function getAgents(_0x37edaa,_0x11545a){return new BPromise(function(_0x61bb17,_0x30decb){return db[_0x37edaa][_0x0a9e('0x4f')]({'where':{'id':_0x11545a}})[_0x0a9e('0x22')](function(_0x5d38ae){return _0x5d38ae['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x39d77d){var _0x204173=_[_0x0a9e('0x5c')](_0x39d77d,'id');_0x61bb17(_0x204173);});})['catch'](function(_0x2b69d9){_0x30decb(_0x2b69d9);});});} \ No newline at end of file +var _0xa9e0=['Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','ids','includes','queue','replace','Queue','all','map','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','userNotification','create','forEach','userNotification:send','catch','Template','findOne','html'];(function(_0x4035b1,_0x417644){var _0x13c48b=function(_0x36f8a){while(--_0x36f8a){_0x4035b1['push'](_0x4035b1['shift']());}};_0x13c48b(++_0x417644);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4,_0x11c3b6){if(!_0x140511[_0x0a9e('0x28')]['hasOwnProperty'](_0x0a9e('0x29'))&&!_0x140511[_0x0a9e('0x28')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))){throw new db['Sequelize'][(_0x0a9e('0x2c'))](_0x0a9e('0x2d'));}else{if(_0x140511[_0x0a9e('0x28')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))&&!_0x140511[_0x0a9e('0x28')][_0x0a9e('0x2a')](_0x0a9e('0x2e'))){throw new db[(_0x0a9e('0x2f'))]['ValidationError'](_0x0a9e('0x30'));}if(!_0x140511['body'][_0x0a9e('0x2a')](_0x0a9e('0x31'))){throw new db[(_0x0a9e('0x2f'))][(_0x0a9e('0x2c'))](_0x0a9e('0x32'));}else{try{var _0x5180f1=JSON[_0x0a9e('0x33')](_0x140511[_0x0a9e('0x28')][_0x0a9e('0x31')]);}catch(_0x2da5c0){logger[_0x0a9e('0x34')](_0x2da5c0);throw new db[(_0x0a9e('0x2f'))][(_0x0a9e('0x2c'))](_0x0a9e('0x35'));}var _0x5583a4=[_0x0a9e('0x36'),'faxqueue',_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39'),_0x0a9e('0x3a'),'whatsappqueue',_0x0a9e('0x3b'),_0x0a9e('0x3c')];if(_[_0x0a9e('0x3d')](_0x5180f1,function(_0x15de0e){return!_['includes'](_0x5583a4,_0x15de0e['model'][_0x0a9e('0x3e')]());})){throw new db['Sequelize'][(_0x0a9e('0x2c'))](_0x0a9e('0x3f'));}}}var _0x381c37={};_0x381c37[_0x0a9e('0x40')]=_0x140511['body'][_0x0a9e('0x2a')](_0x0a9e('0x40'))?_0x140511[_0x0a9e('0x28')]['senderName']:_0x140511[_0x0a9e('0x3c')][_0x0a9e('0x41')];_0x381c37[_0x0a9e('0x42')]=_['isEmpty'](_0x140511['body'][_0x0a9e('0x42')])?null:_0x140511[_0x0a9e('0x28')]['recipientsDescription'];_0x381c37[_0x0a9e('0x43')]=_0x140511[_0x0a9e('0x28')][_0x0a9e('0x43')]||![];_0x381c37[_0x0a9e('0x44')]=_0x140511['user']['id'];return getContent(_0x140511['body'])[_0x0a9e('0x22')](function(_0x45b3d0){_0x381c37['body']=_0x45b3d0;return getRecipients(_0x5180f1);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x381c37[_0x0a9e('0x45')]=_['sortBy'](_0x1dec2e)[_0x0a9e('0x46')](',');return db[_0x0a9e('0x47')][_0x0a9e('0x48')](function(_0x43dd5b){return db[_0x0a9e('0x49')][_0x0a9e('0x4a')](_0x381c37,{'raw':!![],'transaction':_0x43dd5b})[_0x0a9e('0x22')](function(_0x45a9b8){var _0x23b089={'sender':_0x381c37[_0x0a9e('0x40')],'description':_0x381c37[_0x0a9e('0x42')],'content':_0x381c37[_0x0a9e('0x28')],'beep':_0x381c37[_0x0a9e('0x43')]};_0x1dec2e[_0x0a9e('0x4b')](function(_0x37f6cc){_0x23b089['recipient']=_0x37f6cc;socket['emit'](_0x0a9e('0x4c'),_0x23b089);});return _0x45a9b8;});});})[_0x0a9e('0x22')](respondWithResult(_0x1538a4,0xc9))[_0x0a9e('0x4d')](handleError(_0x1538a4,null));};function getContent(_0x315881){return new BPromise(function(_0x1a69dd,_0xc9a702){if(_0x315881[_0x0a9e('0x29')]){_0x1a69dd(_0x315881[_0x0a9e('0x29')]);return;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'attributes':[_0x0a9e('0x50')],'where':{'id':_0x315881[_0x0a9e('0x2b')]},'raw':!![]})['then'](function(_0x117c99){if(!_0x117c99)throw new db[(_0x0a9e('0x2f'))][(_0x0a9e('0x2c'))](_0x0a9e('0x51'));var _0x2e8caf=Mustache[_0x0a9e('0x52')](_0x117c99[_0x0a9e('0x50')],_0x315881[_0x0a9e('0x2e')]);_0x1a69dd(_0x2e8caf);})['catch'](function(_0x2e9d90){_0xc9a702(_0x2e9d90);});});}function getRecipients(_0x48fd45){return new BPromise(function(_0x473dc8,_0x476688){var _0x8d6dd1=[];var _0x562fb4=[];_0x48fd45[_0x0a9e('0x4b')](function(_0x7f6eb1){var _0x4774f4=_[_0x0a9e('0x53')](_0x7f6eb1[_0x0a9e('0x54')][_0x0a9e('0x3e')]());if(_0x4774f4===_0x0a9e('0x55')){_0x8d6dd1=_['union'](_0x8d6dd1,_0x7f6eb1[_0x0a9e('0x56')]);}else{if(_[_0x0a9e('0x57')](_0x4774f4,_0x0a9e('0x58')))_0x4774f4=_0x4774f4[_0x0a9e('0x59')](_0x0a9e('0x58'),_0x0a9e('0x5a'));_0x7f6eb1[_0x0a9e('0x56')][_0x0a9e('0x4b')](function(_0x34febd){_0x562fb4['push'](getAgents(_0x4774f4,_0x34febd));});}});return BPromise[_0x0a9e('0x5b')](_0x562fb4)[_0x0a9e('0x22')](function(_0x4f7240){_0x8d6dd1=_['union'](_0x8d6dd1,_['flatten'](_0x4f7240));_0x473dc8(_0x8d6dd1);})[_0x0a9e('0x4d')](function(_0x4317e3){_0x476688(_0x4317e3);});});}function getAgents(_0x37edaa,_0x11545a){return new BPromise(function(_0x61bb17,_0x30decb){return db[_0x37edaa][_0x0a9e('0x4f')]({'where':{'id':_0x11545a}})[_0x0a9e('0x22')](function(_0x5d38ae){return _0x5d38ae['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x39d77d){var _0x204173=_[_0x0a9e('0x5c')](_0x39d77d,'id');_0x61bb17(_0x204173);});})['catch'](function(_0x2b69d9){_0x30decb(_0x2b69d9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8ec3efd..3cb90a7 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 _0x439f=['userNotification','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1636da,_0x23cd79){var _0x1d121f=function(_0x148ee0){while(--_0x148ee0){_0x1636da['push'](_0x1636da['shift']());}};_0x1d121f(++_0x23cd79);}(_0x439f,0x1de));var _0xf439=function(_0x43f552,_0x42808c){_0x43f552=_0x43f552-0x0;var _0x17911b=_0x439f[_0x43f552];return _0x17911b;};'use strict';var EventEmitter=require(_0xf439('0x0'));var userNotification=require(_0xf439('0x1'))['db'][_0xf439('0x2')];var userNotificationEvents=new EventEmitter();userNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf439('0x3'),'afterUpdate':_0xf439('0x4'),'afterDestroy':_0xf439('0x5')};function emitEvent(_0x39a816){return function(_0x551867,_0x2de3ce,_0x31b0e5){userNotificationEvents[_0xf439('0x6')](_0x39a816+':'+_0x551867['id'],_0x551867);userNotificationEvents[_0xf439('0x6')](_0x39a816,_0x551867);_0x31b0e5(null);};}for(var e in events){if(events[_0xf439('0x7')](e)){var event=events[e];userNotification[_0xf439('0x8')](e,emitEvent(event));}}module[_0xf439('0x9')]=userNotificationEvents; \ No newline at end of file +var _0x9c42=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x9c42,0xbd));var _0x29c4=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x9c42[_0x4ee9cd];return _0x328a5b;};'use strict';var EventEmitter=require(_0x29c4('0x0'));var userNotification=require(_0x29c4('0x1'))['db']['userNotification'];var userNotificationEvents=new EventEmitter();userNotificationEvents[_0x29c4('0x2')](0x0);var events={'afterCreate':_0x29c4('0x3'),'afterUpdate':_0x29c4('0x4'),'afterDestroy':_0x29c4('0x5')};function emitEvent(_0x427595){return function(_0x175fac,_0x5b9672,_0x110a03){userNotificationEvents[_0x29c4('0x6')](_0x427595+':'+_0x175fac['id'],_0x175fac);userNotificationEvents[_0x29c4('0x6')](_0x427595,_0x175fac);_0x110a03(null);};}for(var e in events){if(events[_0x29c4('0x7')](e)){var event=events[e];userNotification[_0x29c4('0x8')](e,emitEvent(event));}}module[_0x29c4('0x9')]=userNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9039e9e..b8567d9 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 _0x0350=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x11a3bb,_0x5c5466){var _0x3c3e36=function(_0x59f16f){while(--_0x59f16f){_0x11a3bb['push'](_0x11a3bb['shift']());}};_0x3c3e36(++_0x5c5466);}(_0x0350,0x1be));var _0x0035=function(_0x2141f6,_0x5e799f){_0x2141f6=_0x2141f6-0x0;var _0xb8b9da=_0x0350[_0x2141f6];return _0xb8b9da;};'use strict';var _=require(_0x0035('0x0'));var util=require(_0x0035('0x1'));var logger=require(_0x0035('0x2'))(_0x0035('0x3'));var moment=require(_0x0035('0x4'));var BPromise=require(_0x0035('0x5'));var rp=require(_0x0035('0x6'));var fs=require('fs');var path=require(_0x0035('0x7'));var rimraf=require(_0x0035('0x8'));var config=require(_0x0035('0x9'));var attributes=require(_0x0035('0xa'));module[_0x0035('0xb')]=function(_0x264290,_0x531d69){return _0x264290[_0x0035('0xc')]('userNotification',attributes,{'tableName':_0x0035('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0035('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3836=['./userNotification.attributes','exports','define','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x3836,0x191));var _0x6383=function(_0x480067,_0x3895bf){_0x480067=_0x480067-0x0;var _0x393611=_0x3836[_0x480067];return _0x393611;};'use strict';var _=require(_0x6383('0x0'));var util=require(_0x6383('0x1'));var logger=require(_0x6383('0x2'))(_0x6383('0x3'));var moment=require(_0x6383('0x4'));var BPromise=require(_0x6383('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6383('0x6'));var attributes=require(_0x6383('0x7'));module[_0x6383('0x8')]=function(_0x1e4394,_0xfc761a){return _0x1e4394[_0x6383('0x9')]('userNotification',attributes,{'tableName':_0x6383('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6383('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0b18500..95cc895 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 _0xdb9a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','socket.io-emitter','register','request','then','userNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x436376,_0x152e72){var _0x107484=function(_0x4d3fe7){while(--_0x4d3fe7){_0x436376['push'](_0x436376['shift']());}};_0x107484(++_0x152e72);}(_0xdb9a,0x106));var _0xadb9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdb9a[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xadb9('0x0'));var moment=require(_0xadb9('0x1'));var BPromise=require(_0xadb9('0x2'));var rs=require(_0xadb9('0x3'));var fs=require('fs');var Redis=require(_0xadb9('0x4'));var db=require(_0xadb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xadb9('0x6'))(_0xadb9('0x7'));var config=require('../../config/environment');var jayson=require(_0xadb9('0x8'));var client=jayson['client'][_0xadb9('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xadb9('0xa'))(new Redis(config['redis']));require('./userNotification.socket')[_0xadb9('0xb')](socket);function respondWithRpcPromise(_0x335720,_0x34bb1a,_0x51c5bb){return new BPromise(function(_0x287861,_0x15366e){return client[_0xadb9('0xc')](_0x335720,_0x51c5bb)[_0xadb9('0xd')](function(_0x1b19fe){logger['info'](_0xadb9('0xe'),_0x34bb1a,_0xadb9('0xf'));logger[_0xadb9('0x10')]('userNotification,\x20%s,\x20%s,\x20%s',_0x34bb1a,_0xadb9('0xf'),JSON[_0xadb9('0x11')](_0x1b19fe));if(_0x1b19fe[_0xadb9('0x12')]){if(_0x1b19fe[_0xadb9('0x12')][_0xadb9('0x13')]===0x1f4){logger[_0xadb9('0x12')](_0xadb9('0xe'),_0x34bb1a,_0x1b19fe[_0xadb9('0x12')]['message']);return _0x15366e(_0x1b19fe['error']['message']);}logger[_0xadb9('0x12')](_0xadb9('0xe'),_0x34bb1a,_0x1b19fe[_0xadb9('0x12')][_0xadb9('0x14')]);return _0x287861(_0x1b19fe[_0xadb9('0x12')]['message']);}else{logger[_0xadb9('0x15')](_0xadb9('0xe'),_0x34bb1a,_0xadb9('0xf'));_0x287861(_0x1b19fe[_0xadb9('0x16')][_0xadb9('0x14')]);}})[_0xadb9('0x17')](function(_0x485361){logger['error'](_0xadb9('0xe'),_0x34bb1a,_0x485361);_0x15366e(_0x485361);});});} \ No newline at end of file +var _0x8f32=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','userNotification,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8f32,0x102));var _0x28f3=function(_0x33ce36,_0x147479){_0x33ce36=_0x33ce36-0x0;var _0x5a4cb8=_0x8f32[_0x33ce36];return _0x5a4cb8;};'use strict';var _=require(_0x28f3('0x0'));var util=require('util');var moment=require(_0x28f3('0x1'));var BPromise=require(_0x28f3('0x2'));var rs=require(_0x28f3('0x3'));var fs=require('fs');var Redis=require(_0x28f3('0x4'));var db=require(_0x28f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x28f3('0x6'))('rpc');var config=require(_0x28f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x28f3('0x8')][_0x28f3('0x9')]({'port':0x232a});config['redis']=_[_0x28f3('0xa')](config[_0x28f3('0xb')],{'host':_0x28f3('0xc'),'port':0x18eb});var socket=require(_0x28f3('0xd'))(new Redis(config[_0x28f3('0xb')]));require(_0x28f3('0xe'))[_0x28f3('0xf')](socket);function respondWithRpcPromise(_0x150200,_0x62acbc,_0x3114f6){return new BPromise(function(_0x45beff,_0x5b6df4){return client[_0x28f3('0x10')](_0x150200,_0x3114f6)[_0x28f3('0x11')](function(_0x699c54){logger[_0x28f3('0x12')](_0x28f3('0x13'),_0x62acbc,'request\x20sent');logger[_0x28f3('0x14')]('userNotification,\x20%s,\x20%s,\x20%s',_0x62acbc,_0x28f3('0x15'),JSON[_0x28f3('0x16')](_0x699c54));if(_0x699c54[_0x28f3('0x17')]){if(_0x699c54[_0x28f3('0x17')][_0x28f3('0x18')]===0x1f4){logger[_0x28f3('0x17')](_0x28f3('0x13'),_0x62acbc,_0x699c54['error']['message']);return _0x5b6df4(_0x699c54[_0x28f3('0x17')][_0x28f3('0x19')]);}logger['error'](_0x28f3('0x13'),_0x62acbc,_0x699c54['error'][_0x28f3('0x19')]);return _0x45beff(_0x699c54[_0x28f3('0x17')][_0x28f3('0x19')]);}else{logger[_0x28f3('0x12')](_0x28f3('0x13'),_0x62acbc,_0x28f3('0x15'));_0x45beff(_0x699c54[_0x28f3('0x1a')][_0x28f3('0x19')]);}})[_0x28f3('0x1b')](function(_0x1cc9fa){logger[_0x28f3('0x17')](_0x28f3('0x13'),_0x62acbc,_0x1cc9fa);_0x5b6df4(_0x1cc9fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1dc64c6..7d5d0cb 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 _0x973c=['save','remove','emit','removeListener','register','./userNotification.events'];(function(_0x14f289,_0x30caba){var _0x2cd597=function(_0x4c3457){while(--_0x4c3457){_0x14f289['push'](_0x14f289['shift']());}};_0x2cd597(++_0x30caba);}(_0x973c,0xbf));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var userNotificationEvents=require(_0xc973('0x0'));var events=[_0xc973('0x1'),_0xc973('0x2'),'update'];function createListener(_0x2b97fb,_0x587097){return function(_0x28b02f){_0x587097[_0xc973('0x3')](_0x2b97fb,_0x28b02f);};}function removeListener(_0x20bfd1,_0x177bec){return function(){userNotificationEvents[_0xc973('0x4')](_0x20bfd1,_0x177bec);};}exports[_0xc973('0x5')]=function(_0x56bc97){for(var _0x3ca273=0x0,_0x40d8f4=events['length'];_0x3ca273<_0x40d8f4;_0x3ca273++){var _0x3b1c02=events[_0x3ca273];var _0x17c725=createListener('userNotification:'+_0x3b1c02,_0x56bc97);userNotificationEvents['on'](_0x3b1c02,_0x17c725);}}; \ No newline at end of file +var _0xde8e=['remove','removeListener','register','length','./userNotification.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xde8e,0x1c6));var _0xede8=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0xde8e[_0x2cbd58];return _0x42ef2a;};'use strict';var userNotificationEvents=require(_0xede8('0x0'));var events=['save',_0xede8('0x1'),'update'];function createListener(_0xd2d589,_0x3faa0f){return function(_0x18d8d1){_0x3faa0f['emit'](_0xd2d589,_0x18d8d1);};}function removeListener(_0x329c74,_0x277648){return function(){userNotificationEvents[_0xede8('0x2')](_0x329c74,_0x277648);};}exports[_0xede8('0x3')]=function(_0x36515a){for(var _0x228654=0x0,_0x4e9624=events[_0xede8('0x4')];_0x228654<_0x4e9624;_0x228654++){var _0x6fd0c1=events[_0x228654];var _0x1095c9=createListener('userNotification:'+_0x6fd0c1,_0x36515a);userNotificationEvents['on'](_0x6fd0c1,_0x1095c9);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 72a86e7..763fe22 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 _0xa166=['../../config/environment','multer','express','Router','../../components/auth/service'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xa166,0x1be));var _0x6a16=function(_0x11cd30,_0x58b742){_0x11cd30=_0x11cd30-0x0;var _0x1954c0=_0xa166[_0x11cd30];return _0x1954c0;};'use strict';var multer=require(_0x6a16('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a16('0x1'));var router=express[_0x6a16('0x2')]();var auth=require(_0x6a16('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6a16('0x4'));module['exports']=router; \ No newline at end of file +var _0x08b2=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x08b2,0x148));var _0x208b=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x08b2[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x208b('0x0'));var util=require(_0x208b('0x1'));var path=require(_0x208b('0x2'));var timeout=require(_0x208b('0x3'));var express=require('express');var router=express[_0x208b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x208b('0x5'));var config=require(_0x208b('0x6'));module[_0x208b('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 4e1b8cb..9967508 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x9210db,_0x3a5ad3){var _0x4b5b2a=function(_0x4119b7){while(--_0x4119b7){_0x9210db['push'](_0x9210db['shift']());}};_0x4b5b2a(++_0x3a5ad3);}(_0xe706,0xa3));var _0x6e70=function(_0x1cea7b,_0x37f5f4){_0x1cea7b=_0x1cea7b-0x0;var _0x5618d1=_0xe706[_0x1cea7b];return _0x5618d1;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 674a525..e65c16b 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 _0x37a8=['bluebird','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x18e7a5,_0x5eb8fb){var _0x26f113=function(_0x40d50d){while(--_0x40d50d){_0x18e7a5['push'](_0x18e7a5['shift']());}};_0x26f113(++_0x5eb8fb);}(_0x37a8,0xd4));var _0x837a=function(_0x4fe7bb,_0x1bdd1c){_0x4fe7bb=_0x4fe7bb-0x0;var _0x5659cc=_0x37a8[_0x4fe7bb];return _0x5659cc;};'use strict';var _=require(_0x837a('0x0'));var util=require(_0x837a('0x1'));var logger=require(_0x837a('0x2'))(_0x837a('0x3'));var moment=require('moment');var BPromise=require(_0x837a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x837a('0x5'));var rimraf=require(_0x837a('0x6'));var config=require('../../config/environment');var attributes=require(_0x837a('0x7'));module[_0x837a('0x8')]=function(_0x1c1c2a,_0x34c074){return _0x1c1c2a[_0x837a('0x9')](_0x837a('0xa'),attributes,{'tableName':_0x837a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe0d=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bddb9,_0x569e60){var _0x207daf=function(_0x4cc8c0){while(--_0x4cc8c0){_0x2bddb9['push'](_0x2bddb9['shift']());}};_0x207daf(++_0x569e60);}(_0xbe0d,0x92));var _0xdbe0=function(_0x3afb25,_0x5be96c){_0x3afb25=_0x3afb25-0x0;var _0x108fa4=_0xbe0d[_0x3afb25];return _0x108fa4;};'use strict';var _=require(_0xdbe0('0x0'));var util=require(_0xdbe0('0x1'));var logger=require(_0xdbe0('0x2'))('api');var moment=require(_0xdbe0('0x3'));var BPromise=require(_0xdbe0('0x4'));var rp=require(_0xdbe0('0x5'));var fs=require('fs');var path=require(_0xdbe0('0x6'));var rimraf=require(_0xdbe0('0x7'));var config=require(_0xdbe0('0x8'));var attributes=require(_0xdbe0('0x9'));module[_0xdbe0('0xa')]=function(_0x39c63b,_0x1c5b48){return _0x39c63b[_0xdbe0('0xb')](_0xdbe0('0xc'),attributes,{'tableName':_0xdbe0('0xd'),'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 8f38898..5569e4b 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 _0x4275=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1cb4f6,_0x116629){var _0x53f0ef=function(_0x27e930){while(--_0x27e930){_0x1cb4f6['push'](_0x1cb4f6['shift']());}};_0x53f0ef(++_0x116629);}(_0x4275,0x1d4));var _0x5427=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4275[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5427('0x0'));var util=require(_0x5427('0x1'));var moment=require(_0x5427('0x2'));var BPromise=require(_0x5427('0x3'));var rs=require(_0x5427('0x4'));var fs=require('fs');var Redis=require(_0x5427('0x5'));var db=require(_0x5427('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5427('0x7'))('rpc');var config=require(_0x5427('0x8'));var jayson=require(_0x5427('0x9'));var client=jayson[_0x5427('0xa')][_0x5427('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa93fe1,_0xc5c9e4,_0x6a9409){return new BPromise(function(_0x5639b9,_0x3b2e6f){return client['request'](_0xa93fe1,_0x6a9409)['then'](function(_0x2637bd){logger['info'](_0x5427('0xc'),_0xc5c9e4,_0x5427('0xd'));logger[_0x5427('0xe')](_0x5427('0xf'),_0xc5c9e4,'request\x20sent',JSON[_0x5427('0x10')](_0x2637bd));if(_0x2637bd[_0x5427('0x11')]){if(_0x2637bd[_0x5427('0x11')][_0x5427('0x12')]===0x1f4){logger['error'](_0x5427('0xc'),_0xc5c9e4,_0x2637bd[_0x5427('0x11')]['message']);return _0x3b2e6f(_0x2637bd[_0x5427('0x11')][_0x5427('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0xc5c9e4,_0x2637bd[_0x5427('0x11')][_0x5427('0x13')]);return _0x5639b9(_0x2637bd[_0x5427('0x11')]['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0xc5c9e4,_0x5427('0xd'));_0x5639b9(_0x2637bd['result'][_0x5427('0x13')]);}})[_0x5427('0x14')](function(_0x4d83a6){logger[_0x5427('0x11')](_0x5427('0xc'),_0xc5c9e4,_0x4d83a6);_0x3b2e6f(_0x4d83a6);});});} \ No newline at end of file +var _0xd438=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3f333c,_0x14f59a){var _0x6af3ad=function(_0x497511){while(--_0x497511){_0x3f333c['push'](_0x3f333c['shift']());}};_0x6af3ad(++_0x14f59a);}(_0xd438,0x72));var _0x8d43=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xd438[_0x3b90ab];return _0x206e92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d43('0x0'));var BPromise=require(_0x8d43('0x1'));var rs=require(_0x8d43('0x2'));var fs=require('fs');var Redis=require(_0x8d43('0x3'));var db=require(_0x8d43('0x4'))['db'];var utils=require(_0x8d43('0x5'));var logger=require(_0x8d43('0x6'))('rpc');var config=require(_0x8d43('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d43('0x8')][_0x8d43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3605d1,_0x3f604f,_0x585768){return new BPromise(function(_0x22961a,_0x250e3b){return client[_0x8d43('0xa')](_0x3605d1,_0x585768)[_0x8d43('0xb')](function(_0x98ce1d){logger[_0x8d43('0xc')](_0x8d43('0xd'),_0x3f604f,'request\x20sent');logger[_0x8d43('0xe')](_0x8d43('0xf'),_0x3f604f,_0x8d43('0x10'),JSON['stringify'](_0x98ce1d));if(_0x98ce1d[_0x8d43('0x11')]){if(_0x98ce1d[_0x8d43('0x11')][_0x8d43('0x12')]===0x1f4){logger[_0x8d43('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3f604f,_0x98ce1d[_0x8d43('0x11')][_0x8d43('0x13')]);return _0x250e3b(_0x98ce1d['error'][_0x8d43('0x13')]);}logger['error'](_0x8d43('0xd'),_0x3f604f,_0x98ce1d[_0x8d43('0x11')][_0x8d43('0x13')]);return _0x22961a(_0x98ce1d[_0x8d43('0x11')][_0x8d43('0x13')]);}else{logger[_0x8d43('0xc')](_0x8d43('0xd'),_0x3f604f,_0x8d43('0x10'));_0x22961a(_0x98ce1d[_0x8d43('0x14')][_0x8d43('0x13')]);}})[_0x8d43('0x15')](function(_0x312d90){logger[_0x8d43('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3f604f,_0x312d90);_0x250e3b(_0x312d90);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 61a4963..b725776 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 _0xe07d=['/:id','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','/:id/resources','getResources','post','create','clone','put'];(function(_0x331886,_0x4129c0){var _0x4389a6=function(_0x359153){while(--_0x359153){_0x331886['push'](_0x331886['shift']());}};_0x4389a6(++_0x4129c0);}(_0xe07d,0x172));var _0xde07=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0xe07d[_0x4653f7];return _0x5454da;};'use strict';var multer=require(_0xde07('0x0'));var util=require(_0xde07('0x1'));var path=require(_0xde07('0x2'));var timeout=require('connect-timeout');var express=require(_0xde07('0x3'));var router=express[_0xde07('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xde07('0x5'));var controller=require(_0xde07('0x6'));router[_0xde07('0x7')]('/',auth[_0xde07('0x8')](),controller[_0xde07('0x9')]);router['get'](_0xde07('0xa'),auth[_0xde07('0x8')](),controller[_0xde07('0xb')]);router[_0xde07('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xde07('0xc')]);router[_0xde07('0x7')](_0xde07('0xd'),auth[_0xde07('0x8')](),controller['getSections']);router['get'](_0xde07('0xe'),auth[_0xde07('0x8')](),controller[_0xde07('0xf')]);router[_0xde07('0x10')]('/',auth[_0xde07('0x8')](),controller[_0xde07('0x11')]);router[_0xde07('0x10')]('/:id/clone',auth[_0xde07('0x8')](),controller[_0xde07('0x12')]);router['post'](_0xde07('0xd'),auth['isAuthenticated'](),controller['addSections']);router['post'](_0xde07('0xe'),auth[_0xde07('0x8')](),controller['addResources']);router[_0xde07('0x13')](_0xde07('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xde07('0x15')](_0xde07('0x14'),auth[_0xde07('0x8')](),controller[_0xde07('0x16')]);router[_0xde07('0x15')]('/:id/sections',auth[_0xde07('0x8')](),controller[_0xde07('0x17')]);router[_0xde07('0x15')](_0xde07('0xe'),auth['isAuthenticated'](),controller[_0xde07('0x18')]);module[_0xde07('0x19')]=router; \ No newline at end of file +var _0x6f31=['/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x6f31,0x12a));var _0x16f3=function(_0x411500,_0x2b7cbf){_0x411500=_0x411500-0x0;var _0x417d6e=_0x6f31[_0x411500];return _0x417d6e;};'use strict';var multer=require(_0x16f3('0x0'));var util=require(_0x16f3('0x1'));var path=require(_0x16f3('0x2'));var timeout=require(_0x16f3('0x3'));var express=require(_0x16f3('0x4'));var router=express['Router']();var auth=require(_0x16f3('0x5'));var interaction=require(_0x16f3('0x6'));var config=require(_0x16f3('0x7'));var controller=require(_0x16f3('0x8'));router[_0x16f3('0x9')]('/',auth[_0x16f3('0xa')](),controller[_0x16f3('0xb')]);router[_0x16f3('0x9')](_0x16f3('0xc'),auth[_0x16f3('0xa')](),controller[_0x16f3('0xd')]);router[_0x16f3('0x9')](_0x16f3('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x16f3('0x9')](_0x16f3('0xf'),auth[_0x16f3('0xa')](),controller[_0x16f3('0x10')]);router['get'](_0x16f3('0x11'),auth[_0x16f3('0xa')](),controller[_0x16f3('0x12')]);router[_0x16f3('0x13')]('/',auth[_0x16f3('0xa')](),controller[_0x16f3('0x14')]);router[_0x16f3('0x13')](_0x16f3('0x15'),auth[_0x16f3('0xa')](),controller[_0x16f3('0x16')]);router[_0x16f3('0x13')](_0x16f3('0xf'),auth[_0x16f3('0xa')](),controller[_0x16f3('0x17')]);router[_0x16f3('0x13')]('/:id/resources',auth[_0x16f3('0xa')](),controller[_0x16f3('0x18')]);router[_0x16f3('0x19')](_0x16f3('0xe'),auth['isAuthenticated'](),controller[_0x16f3('0x1a')]);router[_0x16f3('0x1b')]('/:id',auth[_0x16f3('0xa')](),controller['destroy']);router['delete'](_0x16f3('0xf'),auth[_0x16f3('0xa')](),controller[_0x16f3('0x1c')]);router[_0x16f3('0x1b')]('/:id/resources',auth[_0x16f3('0xa')](),controller[_0x16f3('0x1d')]);module[_0x16f3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7224238..9a9b67f 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 _0x6827=['getDataValue','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x6827,0xda));var _0x7682=function(_0x656b46,_0x3dc984){_0x656b46=_0x656b46-0x0;var _0xa59bbf=_0x6827[_0x656b46];return _0xa59bbf;};'use strict';var Sequelize=require(_0x7682('0x0'));module[_0x7682('0x1')]={'name':{'type':Sequelize[_0x7682('0x2')],'allowNull':![],'unique':_0x7682('0x3')},'crudPermissions':{'type':Sequelize[_0x7682('0x2')],'set':function(_0x4c8748){this[_0x7682('0x4')](_0x7682('0x5'),_0x4c8748?_0x4c8748['join'](''):[]);},'get':function(){return this[_0x7682('0x6')](_0x7682('0x5'))?this[_0x7682('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7682('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2229=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','name'];(function(_0x24423c,_0x2d5b54){var _0x4e8361=function(_0x5e80b5){while(--_0x5e80b5){_0x24423c['push'](_0x24423c['shift']());}};_0x4e8361(++_0x2d5b54);}(_0x2229,0xb5));var _0x9222=function(_0x193bec,_0x5bbea3){_0x193bec=_0x193bec-0x0;var _0x3aea83=_0x2229[_0x193bec];return _0x3aea83;};'use strict';var Sequelize=require(_0x9222('0x0'));module['exports']={'name':{'type':Sequelize[_0x9222('0x1')],'allowNull':![],'unique':_0x9222('0x2')},'crudPermissions':{'type':Sequelize[_0x9222('0x1')],'set':function(_0x11191c){this[_0x9222('0x3')](_0x9222('0x4'),_0x11191c?_0x11191c[_0x9222('0x5')](''):[]);},'get':function(){return this[_0x9222('0x6')]('crudPermissions')?this[_0x9222('0x6')](_0x9222('0x4'))[_0x9222('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a9208f0..b7efa04 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 _0x83f1=['include','params','includeAll','find','create','catch','clone','omit','crudPermissions','body','sequelize','transaction','get','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','createdAt','updatedAt','Resources','update','destroy','describe','addSections','userProfileId','removeSections','ids','getSections','enabled','includes','isEmpty','sectionId','subsections','Dashboard','forEach','push','resourceId','addResources','bulkCreate','removeResources','getResources','section','undefined','ValidationError','childModel','Sequelize','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','order','type','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','rows','value','squareprojects','SquareProject','odbc','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueue','inbound','queue','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','pauses','Pause','Schedule','sounds','tags','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','json','offset','limit','set','Content-Range','apply','reject','save','then','end','sendStatus','error','name','index','map','UserProfile','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x83f1,0xa8));var _0x183f=function(_0x92d1fb,_0x4f4375){_0x92d1fb=_0x92d1fb-0x0;var _0x518754=_0x83f1[_0x92d1fb];return _0x518754;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x183f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x183f('0x1'));var jsonpatch=require(_0x183f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x183f('0x3'));var Mustache=require('mustache');var util=require(_0x183f('0x4'));var path=require(_0x183f('0x5'));var sox=require(_0x183f('0x6'));var csv=require(_0x183f('0x7'));var ejs=require(_0x183f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x183f('0x9'));var crypto=require('crypto');var jsforce=require(_0x183f('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x183f('0xb'));var Redis=require(_0x183f('0xc'));var authService=require(_0x183f('0xd'));var qs=require(_0x183f('0xe'));var as=require(_0x183f('0xf'));var hardwareService=require(_0x183f('0x10'));var logger=require('../../config/logger')(_0x183f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x183f('0x12'));var db=require(_0x183f('0x13'))['db'];config[_0x183f('0x14')]=_['defaults'](config[_0x183f('0x14')],{'host':_0x183f('0x15'),'port':0x18eb});var socket=require(_0x183f('0x16'))(new Redis(config[_0x183f('0x14')]));require(_0x183f('0x17'))[_0x183f('0x18')](socket);function respondWithStatusCode(_0x2b5827,_0x74ba97){_0x74ba97=_0x74ba97||0xcc;return function(_0x42eb68){if(_0x42eb68){return _0x2b5827['sendStatus'](_0x74ba97);}return _0x2b5827[_0x183f('0x19')](_0x74ba97)['end']();};}function respondWithResult(_0x4a0d4f,_0x46289f){_0x46289f=_0x46289f||0xc8;return function(_0x314eab){if(_0x314eab){return _0x4a0d4f[_0x183f('0x19')](_0x46289f)[_0x183f('0x1a')](_0x314eab);}};}function respondWithFilteredResult(_0x16953f,_0x8e06fe){return function(_0x5b8d07){if(_0x5b8d07){var _0x4fd1ec=_0x5b8d07['count'],_0x1fa418=_0x8e06fe[_0x183f('0x1b')],_0x2df7d5=_0x8e06fe['offset']+_0x8e06fe[_0x183f('0x1c')],_0x1db4db;if(_0x2df7d5>=_0x4fd1ec){_0x2df7d5=_0x4fd1ec;_0x1db4db=0xc8;}else{_0x1db4db=0xce;}_0x16953f[_0x183f('0x19')](_0x1db4db);return _0x16953f[_0x183f('0x1d')](_0x183f('0x1e'),_0x1fa418+'-'+_0x2df7d5+'/'+_0x4fd1ec)[_0x183f('0x1a')](_0x5b8d07);}return null;};}function patchUpdates(_0xd38615){return function(_0x4d0c26){try{jsonpatch[_0x183f('0x1f')](_0x4d0c26,_0xd38615,!![]);}catch(_0x2a7c3c){return BPromise[_0x183f('0x20')](_0x2a7c3c);}return _0x4d0c26[_0x183f('0x21')]();};}function saveUpdates(_0x39b8d3,_0xf2294a){return function(_0x5eb0dd){if(_0x5eb0dd){return _0x5eb0dd['update'](_0x39b8d3)[_0x183f('0x22')](function(_0x4e75a6){return _0x4e75a6;});}return null;};}function removeEntity(_0x1f1881,_0x1716e1){return function(_0x5ebd3b){if(_0x5ebd3b){return _0x5ebd3b['destroy']()['then'](function(){_0x1f1881['status'](0xcc)[_0x183f('0x23')]();});}};}function handleEntityNotFound(_0x46cf3b,_0x4fecc3){return function(_0x291327){if(!_0x291327){_0x46cf3b[_0x183f('0x24')](0x194);}return _0x291327;};}function handleError(_0x513f18,_0x14a903){_0x14a903=_0x14a903||0x1f4;return function(_0x414542){logger[_0x183f('0x25')](_0x414542['stack']);if(_0x414542[_0x183f('0x26')]){delete _0x414542[_0x183f('0x26')];}_0x513f18[_0x183f('0x19')](_0x14a903)['send'](_0x414542);};}exports[_0x183f('0x27')]=function(_0x3de834,_0x2a8868){var _0x256b2c={},_0x405d61={},_0x1676aa={'count':0x0,'rows':[]};var _0xb812f4=_[_0x183f('0x28')](db[_0x183f('0x29')][_0x183f('0x2a')],function(_0x4657a2){return{'name':_0x4657a2['fieldName'],'type':_0x4657a2['type'][_0x183f('0x2b')]};});_0x405d61[_0x183f('0x2c')]=_[_0x183f('0x28')](_0xb812f4,'name');_0x405d61['query']=_[_0x183f('0x2d')](_0x3de834[_0x183f('0x2e')]);_0x405d61[_0x183f('0x2f')]=_[_0x183f('0x30')](_0x405d61[_0x183f('0x2c')],_0x405d61[_0x183f('0x2e')]);_0x256b2c[_0x183f('0x31')]=_[_0x183f('0x30')](_0x405d61[_0x183f('0x2c')],qs[_0x183f('0x32')](_0x3de834[_0x183f('0x2e')]['fields']));_0x256b2c[_0x183f('0x31')]=_0x256b2c[_0x183f('0x31')][_0x183f('0x33')]?_0x256b2c['attributes']:_0x405d61[_0x183f('0x2c')];if(!_0x3de834['query'][_0x183f('0x34')](_0x183f('0x35'))){_0x256b2c[_0x183f('0x1c')]=qs[_0x183f('0x1c')](_0x3de834[_0x183f('0x2e')]['limit']);_0x256b2c[_0x183f('0x1b')]=qs[_0x183f('0x1b')](_0x3de834[_0x183f('0x2e')]['offset']);}_0x256b2c['order']=qs[_0x183f('0x36')](_0x3de834[_0x183f('0x2e')]['sort']);_0x256b2c[_0x183f('0x37')]=qs[_0x183f('0x2f')](_[_0x183f('0x38')](_0x3de834['query'],_0x405d61[_0x183f('0x2f')]),_0xb812f4);if(_0x3de834['query'][_0x183f('0x39')]){_0x256b2c[_0x183f('0x37')]=_[_0x183f('0x3a')](_0x256b2c[_0x183f('0x37')],{'$or':_[_0x183f('0x28')](_0xb812f4,function(_0x2afed5){if(_0x2afed5['type']!=='VIRTUAL'){var _0x5c086b={};_0x5c086b[_0x2afed5[_0x183f('0x26')]]={'$like':'%'+_0x3de834[_0x183f('0x2e')][_0x183f('0x39')]+'%'};return _0x5c086b;}})});}_0x256b2c=_[_0x183f('0x3a')]({},_0x256b2c,_0x3de834[_0x183f('0x3b')]);var _0x53b4e1={'where':_0x256b2c[_0x183f('0x37')]};return db[_0x183f('0x29')][_0x183f('0x3c')](_0x53b4e1)[_0x183f('0x22')](function(_0x553e6d){_0x1676aa['count']=_0x553e6d;if(_0x3de834[_0x183f('0x2e')]['includeAll']){_0x256b2c[_0x183f('0x3d')]=[{'all':!![]}];}return db[_0x183f('0x29')]['findAll'](_0x256b2c);})[_0x183f('0x22')](function(_0x48a672){_0x1676aa['rows']=_0x48a672;return _0x1676aa;})[_0x183f('0x22')](respondWithFilteredResult(_0x2a8868,_0x256b2c))['catch'](handleError(_0x2a8868,null));};exports['show']=function(_0x7f865d,_0x53c751){var _0x241ac5={'raw':![],'where':{'id':_0x7f865d[_0x183f('0x3e')]['id']}},_0x50412d={};_0x50412d[_0x183f('0x2c')]=_['keys'](db[_0x183f('0x29')][_0x183f('0x2a')]);_0x50412d['query']=_[_0x183f('0x2d')](_0x7f865d[_0x183f('0x2e')]);_0x50412d[_0x183f('0x2f')]=_['intersection'](_0x50412d[_0x183f('0x2c')],_0x50412d[_0x183f('0x2e')]);_0x241ac5[_0x183f('0x31')]=_['intersection'](_0x50412d[_0x183f('0x2c')],qs[_0x183f('0x32')](_0x7f865d['query'][_0x183f('0x32')]));_0x241ac5['attributes']=_0x241ac5[_0x183f('0x31')][_0x183f('0x33')]?_0x241ac5['attributes']:_0x50412d[_0x183f('0x2c')];if(_0x7f865d[_0x183f('0x2e')][_0x183f('0x3f')]){_0x241ac5[_0x183f('0x3d')]=[{'all':!![]}];}_0x241ac5=_['merge']({},_0x241ac5,_0x7f865d[_0x183f('0x3b')]);return db[_0x183f('0x29')][_0x183f('0x40')](_0x241ac5)['then'](handleEntityNotFound(_0x53c751,null))['then'](respondWithResult(_0x53c751,null))['catch'](handleError(_0x53c751,null));};exports['create']=function(_0x4db178,_0xe190f6){return db[_0x183f('0x29')][_0x183f('0x41')](_0x4db178['body'],{})[_0x183f('0x22')](respondWithResult(_0xe190f6,0xc9))[_0x183f('0x42')](handleError(_0xe190f6,null));};exports[_0x183f('0x43')]=function(_0x4f37f3,_0x4595fb){var _0x991540={'where':{'id':_0x4f37f3[_0x183f('0x3e')]['id']}},_0x4742a9={};_0x4742a9['model']=_[_0x183f('0x2d')](db[_0x183f('0x29')][_0x183f('0x2a')]);_0x991540['attributes']=_[_0x183f('0x30')](_0x4742a9['model'],qs['fields'](_0x4f37f3['query'][_0x183f('0x32')]));_0x991540[_0x183f('0x31')]=_0x991540[_0x183f('0x31')][_0x183f('0x33')]?_0x991540['attributes']:_0x4742a9['model'];if(_0x4f37f3[_0x183f('0x2e')][_0x183f('0x3f')]){_0x991540[_0x183f('0x3d')]=[{'all':!![]}];}_0x991540=_[_0x183f('0x3a')]({},_0x991540,_0x4f37f3['options']);return db[_0x183f('0x29')][_0x183f('0x40')](_0x991540)[_0x183f('0x22')](handleEntityNotFound(_0x4595fb,null))[_0x183f('0x22')](function(_0x5bc5ac){if(_0x5bc5ac){var _0x587282=_0x5bc5ac['get']({'plain':!![]});_0x587282=qs[_0x183f('0x44')](_0x587282,['id','createdAt','updatedAt',_0x183f('0x45')]);_0x4f37f3['body']=_['omit'](_0x4f37f3[_0x183f('0x46')],['id','createdAt','updatedAt']);return db[_0x183f('0x47')][_0x183f('0x48')](function(_0x4d3f36){return db[_0x183f('0x29')][_0x183f('0x41')](_[_0x183f('0x3a')](_0x587282,_0x4f37f3['body']),{'include':_0x4f37f3[_0x183f('0x2e')][_0x183f('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x4d3f36})['then'](function(_0x244a39){var _0x123da3=_0x244a39[_0x183f('0x49')]({'plain':!![]});return db[_0x183f('0x4a')][_0x183f('0x4b')]({'where':{'userProfileId':_0x4f37f3[_0x183f('0x3e')]['id']},'raw':!![]})['then'](function(_0x33f82d){if(_0x33f82d){return BPromise[_0x183f('0x4c')](_0x33f82d,function(_0x4c6977){return new BPromise(function(_0x4d8cd1,_0x454ce5){if(_0x4c6977[_0x183f('0x4d')]===null||_0x4c6977[_0x183f('0x4d')]===0x1)_0x4d8cd1(null);return db[_0x183f('0x4e')]['findAll']({'where':{'sectionId':_0x4c6977['id']},'raw':!![]})['then'](function(_0x2b856a){var _0x27ee0c=_[_0x183f('0x28')](_0x2b856a,function(_0x387ecd){return qs[_0x183f('0x44')](_0x387ecd,['id',_0x183f('0x4f'),_0x183f('0x50'),'sectionId']);});_0x4d8cd1(_0x27ee0c);})[_0x183f('0x42')](function(_0x38f591){_0x454ce5(_0x38f591);});})[_0x183f('0x22')](function(_0x4c3519){var _0x441265=qs[_0x183f('0x44')](_0x4c6977,['id',_0x183f('0x4f'),_0x183f('0x50')]);_0x441265['userProfileId']=_0x123da3['id'];if(_0x4c3519)_0x441265[_0x183f('0x51')]=_0x4c3519;return _0x441265;})['then'](function(_0x23c02f){return db[_0x183f('0x4a')][_0x183f('0x41')](_0x23c02f,{'include':[{'model':db[_0x183f('0x4e')],'as':'Resources'}],'raw':!![],'transaction':_0x4d3f36});});})[_0x183f('0x22')](function(){return _0x123da3;});}});});});}})[_0x183f('0x22')](respondWithResult(_0x4595fb,0xc9))[_0x183f('0x42')](handleError(_0x4595fb,null));};exports[_0x183f('0x52')]=function(_0x17e6b4,_0x160ea2){if(_0x17e6b4['body']['id']){delete _0x17e6b4[_0x183f('0x46')]['id'];}return db[_0x183f('0x29')][_0x183f('0x40')]({'where':{'id':_0x17e6b4[_0x183f('0x3e')]['id']}})[_0x183f('0x22')](handleEntityNotFound(_0x160ea2,null))[_0x183f('0x22')](saveUpdates(_0x17e6b4[_0x183f('0x46')],null))[_0x183f('0x22')](respondWithResult(_0x160ea2,null))[_0x183f('0x42')](handleError(_0x160ea2,null));};exports[_0x183f('0x53')]=function(_0x43ad62,_0x455e11){return db[_0x183f('0x29')][_0x183f('0x40')]({'where':{'id':_0x43ad62[_0x183f('0x3e')]['id']}})[_0x183f('0x22')](handleEntityNotFound(_0x455e11,null))['then'](removeEntity(_0x455e11,null))[_0x183f('0x42')](handleError(_0x455e11,null));};exports[_0x183f('0x54')]=function(_0x23d4c4,_0x1ea2c0){return db[_0x183f('0x29')][_0x183f('0x54')]()['then'](respondWithResult(_0x1ea2c0,null))['catch'](handleError(_0x1ea2c0,null));};exports[_0x183f('0x55')]=function(_0x31e44f,_0x2fb451){var _0x2245a7=_0x31e44f['body'];return db[_0x183f('0x29')]['find']({'where':{'id':_0x31e44f[_0x183f('0x3e')]['id']}})[_0x183f('0x22')](handleEntityNotFound(_0x2fb451,null))[_0x183f('0x22')](function(_0x37863c){if(_0x37863c){return db['sequelize'][_0x183f('0x48')](function(_0x5b4ca6){return db[_0x183f('0x4a')][_0x183f('0x53')]({'where':{'userProfileId':_0x31e44f['params']['id'],'sectionId':_[_0x183f('0x28')](_0x2245a7,function(_0x1d4c51){return _0x1d4c51['sectionId'];})},'transaction':_0x5b4ca6})[_0x183f('0x22')](function(){var _0x51bded=_['map'](_0x2245a7,function(_0x54366d){_0x54366d[_0x183f('0x56')]=_0x31e44f[_0x183f('0x3e')]['id'];return _0x54366d;});var _0x5d6267=[];return BPromise[_0x183f('0x4c')](_0x51bded,function(_0x3820ab){return db[_0x183f('0x4a')][_0x183f('0x41')](_0x3820ab,{'include':[{'model':db[_0x183f('0x4e')],'as':'Resources'}],'raw':!![],'transaction':_0x5b4ca6})[_0x183f('0x22')](function(_0x1aae4b){_0x5d6267['push'](_0x1aae4b[_0x183f('0x49')]({'plain':!![]}));});})[_0x183f('0x22')](function(){return _0x5d6267;});});});}})[_0x183f('0x22')](function(_0x49fe93){return _0x49fe93;})[_0x183f('0x22')](respondWithResult(_0x2fb451,null))[_0x183f('0x42')](handleError(_0x2fb451,null));};exports[_0x183f('0x57')]=function(_0x439c40,_0x29440f){var _0x44bb14;return db[_0x183f('0x29')][_0x183f('0x40')]({'where':{'id':_0x439c40[_0x183f('0x3e')]['id']},'attributes':['id',_0x183f('0x26')]})[_0x183f('0x22')](handleEntityNotFound(_0x29440f,null))['then'](function(_0x211830){if(_0x211830){_0x44bb14=_0x211830;return db['UserProfileSection'][_0x183f('0x53')]({'where':{'userProfileId':_0x439c40[_0x183f('0x3e')]['id'],'sectionId':_0x439c40[_0x183f('0x2e')][_0x183f('0x58')]}});}})['then'](function(){return _0x44bb14;})[_0x183f('0x22')](respondWithStatusCode(_0x29440f,null))[_0x183f('0x42')](handleError(_0x29440f,null));};exports[_0x183f('0x59')]=function(_0x2c1bac,_0x32489e){var _0x3e9beb=[];var _0x5c1739=[];return db[_0x183f('0x4a')][_0x183f('0x4b')]({'where':{'userProfileId':_0x2c1bac[_0x183f('0x3e')]['id']},'raw':!![]})[_0x183f('0x22')](function(_0x4ac228){_0x3e9beb=_[_0x183f('0x39')](_0x4ac228,function(_0x29a8b6){return _0x29a8b6[_0x183f('0x5a')]===0x1||_[_0x183f('0x5b')]([0x3eb,0x709],_0x29a8b6['sectionId']);});if(!_[_0x183f('0x5c')](_0x3e9beb)){return _[_0x183f('0x28')](_0x3e9beb,function(_0x553c5d){return _0x553c5d[_0x183f('0x5d')];});}else{return;}})['then'](function(_0x32eedb){if(_0x32eedb)_0x5c1739=_0x32eedb;if(_['includes'](_0x5c1739,0x64)){var _0x15df3f=_[_0x183f('0x40')](_0x3e9beb,{'sectionId':0x64});return hasDefaultDashboard(_0x15df3f)[_0x183f('0x22')](function(_0x3dde8a){return _['map'](_0x3e9beb,function(_0x2205cc){if(_0x2205cc['sectionId']===0x64){_0x2205cc[_0x183f('0x5e')]=_0x3dde8a;}return _0x2205cc;});});}else{return;}})[_0x183f('0x22')](function(_0x1a10c9){if(_0x1a10c9)_0x3e9beb=_0x1a10c9;if(_['includes'](_0x5c1739,0x3eb)){var _0x112a20=_[_0x183f('0x40')](_0x3e9beb,{'sectionId':0x3eb});return getCustomDashboards(_0x112a20)[_0x183f('0x22')](function(_0x4fa7d8){return _[_0x183f('0x28')](_0x3e9beb,function(_0x5deaa4){if(_0x112a20[_0x183f('0x5a')]){if(_0x5deaa4[_0x183f('0x5d')]===0x3eb){_0x5deaa4[_0x183f('0x5e')]=_0x4fa7d8;}}else{if(_0x5deaa4[_0x183f('0x5d')]===0x64){_0x5deaa4['subsections']=_0x4fa7d8;}}return _0x5deaa4;});});}else{return;}})['then'](function(_0x437086){if(_0x437086)_0x3e9beb=_0x437086;if(_[_0x183f('0x5b')](_0x5c1739,0x709)){var _0x3061d4=_[_0x183f('0x40')](_0x3e9beb,{'sectionId':0x709});return getPlugins(_0x3061d4)[_0x183f('0x22')](function(_0x41d364){if(_0x3061d4[_0x183f('0x5a')]){return _[_0x183f('0x28')](_0x3e9beb,function(_0x2183e6){if(_0x2183e6['sectionId']===0x709){_0x2183e6[_0x183f('0x5e')]=_0x41d364;}return _0x2183e6;});}else{var _0x5fad71={'sectionId':0x76c,'enabled':0x1,'subsections':_0x41d364};var _0x3d5801=_['map'](_0x3e9beb);_0x3d5801['push'](_0x5fad71);return _0x3d5801;}});}else{return;}})['then'](function(_0x2a2317){if(_0x2a2317)_0x3e9beb=_0x2a2317;return _[_0x183f('0x39')](_0x3e9beb,[_0x183f('0x5a'),0x1]);})[_0x183f('0x22')](respondWithResult(_0x32489e,null))[_0x183f('0x42')](handleError(_0x32489e,null));};function hasDefaultDashboard(_0x12430e){var _0x138c93=[0x65];return new BPromise(function(_0x5cf284,_0x639ddf){try{if(_0x12430e[_0x183f('0x4d')]){_0x5cf284(_0x138c93);}else{return db[_0x183f('0x4e')]['findOne']({'where':{'sectionId':_0x12430e['id']},'raw':!![]})[_0x183f('0x22')](function(_0x494929){_0x494929?_0x5cf284(_0x138c93):_0x5cf284();});}}catch(_0xd75bac){_0x639ddf(_0xd75bac);}});}function getCustomDashboards(_0x31efd4){var _0x1e3c85=[];return new BPromise(function(_0x139a51,_0x5455ba){try{if(_0x31efd4[_0x183f('0x4d')]){return db[_0x183f('0x5f')][_0x183f('0x4b')]({'raw':!![]})[_0x183f('0x22')](function(_0x484778){_0x484778[_0x183f('0x60')](function(_0x313773){_0x1e3c85[_0x183f('0x61')](_0x313773['id']+0x1869f);});_0x139a51(_0x1e3c85);});}else{return db[_0x183f('0x4e')][_0x183f('0x4b')]({'where':{'sectionId':_0x31efd4['id']},'raw':!![]})[_0x183f('0x22')](function(_0x476bdc){_0x476bdc[_0x183f('0x60')](function(_0x5a86e4){_0x1e3c85['push'](_0x5a86e4[_0x183f('0x62')]+0x1869f);});_0x139a51(_0x1e3c85);});}}catch(_0x34cfce){_0x5455ba(_0x34cfce);}});}function getPlugins(_0x164bee){var _0x4eac15=[];return new BPromise(function(_0x51c8b8,_0x1fbd09){try{if(_0x164bee[_0x183f('0x4d')]){return db['Plugin'][_0x183f('0x4b')]({'raw':!![]})[_0x183f('0x22')](function(_0xcc251d){_0xcc251d[_0x183f('0x60')](function(_0x547213){_0x4eac15[_0x183f('0x61')](_0x547213['id']+0x15b38);});_0x51c8b8(_0x4eac15);});}else{return db[_0x183f('0x4e')]['findAll']({'where':{'sectionId':_0x164bee['id']},'raw':!![]})[_0x183f('0x22')](function(_0x21753c){_0x21753c[_0x183f('0x60')](function(_0x43a373){_0x4eac15['push'](_0x43a373[_0x183f('0x62')]+0x15b38);});_0x51c8b8(_0x4eac15);});}}catch(_0x4b48be){_0x1fbd09(_0x4b48be);}});}exports[_0x183f('0x63')]=function(_0x5c85fc,_0x897dcb){return db[_0x183f('0x29')]['find']({'where':{'id':_0x5c85fc['params']['id']}})[_0x183f('0x22')](handleEntityNotFound(_0x897dcb,null))['then'](function(_0x48b710){if(_0x48b710){return db['sequelize']['transaction'](function(_0x1cdb14){return db[_0x183f('0x4a')][_0x183f('0x4b')]({'where':{'userProfileId':_0x5c85fc['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2b6c14){if(_0x2b6c14){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5c85fc[_0x183f('0x3e')]['id'],'id':_[_0x183f('0x28')](_0x2b6c14,function(_0x2b7e23){return _0x2b7e23['id'];})},'transaction':_0x1cdb14});}})[_0x183f('0x22')](function(_0xe2ace4){var _0x10e69f=_[_0x183f('0x28')](_0x5c85fc[_0x183f('0x46')],function(_0x296345){_0x296345['userProfileId']=_0x5c85fc[_0x183f('0x3e')]['id'];return _0x296345;});return db[_0x183f('0x4a')]['bulkCreate'](_0x10e69f,{'raw':!![],'transaction':_0x1cdb14});})['then'](function(_0x230607){var _0x4aac66=_['filter'](_[_0x183f('0x28')](_0x230607,function(_0x26e468){return _0x26e468[_0x183f('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x4aac66){return db[_0x183f('0x4a')][_0x183f('0x4b')]({'where':{'userProfileId':_0x5c85fc['params']['id'],'sectionId':_[_0x183f('0x28')](_0x4aac66,function(_0x3ae3bf){return _0x3ae3bf[_0x183f('0x5d')];})},'attributes':['id',_0x183f('0x5d')],'raw':!![]})[_0x183f('0x22')](function(_0xe514c0){var _0x4499ba=_[_0x183f('0x28')](_0x5c85fc['body'],function(_0x28696c){_0x28696c[_0x183f('0x56')]=_0x5c85fc['params']['id'];return _0x28696c;});return db[_0x183f('0x4e')][_0x183f('0x64')](_0x4499ba,{'raw':!![],'transaction':_0x1cdb14});});}})[_0x183f('0x42')](handleError(_0x897dcb,null));});}})[_0x183f('0x22')](function(_0x46da85){var _0x2dd92a=_['map'](_0x46da85,function(_0x1d0e16){return _0x1d0e16[_0x183f('0x49')]({'plain':!![]});});})[_0x183f('0x22')](respondWithResult(_0x897dcb,null))[_0x183f('0x42')](handleError(_0x897dcb,null));};exports['removeResources']=function(_0x35340d,_0x4071ad,_0x7e5605){return db['UserProfile']['find']({'where':{'id':_0x35340d[_0x183f('0x3e')]['id']}})[_0x183f('0x22')](handleEntityNotFound(_0x4071ad,null))['then'](function(_0x3655ce){if(_0x3655ce){return _0x3655ce[_0x183f('0x65')](_0x35340d[_0x183f('0x2e')]['ids']);}})[_0x183f('0x22')](respondWithStatusCode(_0x4071ad,null))[_0x183f('0x42')](handleError(_0x4071ad,null));};exports[_0x183f('0x66')]=function(_0x163566,_0x389ef9){var _0x2a6111={'raw':![],'where':{}};var _0x1222f6={};var _0x53a55d={'count':0x0,'rows':[]};var _0x54d5c1=_0x163566[_0x183f('0x2e')][_0x183f('0x67')];if(typeof _0x54d5c1===_0x183f('0x68')){throw new db['Sequelize'][(_0x183f('0x69'))]('Unknown\x20section');}var _0x387061=_0x163566[_0x183f('0x2e')]['mergeResources']||![];var _0xaab032=getQueryModels(_0x54d5c1,_0x387061);if(typeof _0xaab032[_0x183f('0x6a')]===_0x183f('0x68')){throw new db[(_0x183f('0x6b'))][(_0x183f('0x69'))](_0x183f('0x6c')+_0x54d5c1+'\x27');}var _0x595dfd=[];if(!_[_0x183f('0x5c')](_0xaab032[_0x183f('0x6d')])){_0x595dfd=_0xaab032[_0x183f('0x6d')];}else{_0x595dfd=[{'name':_0x54d5c1}];}return db[_0x183f('0x29')][_0x183f('0x6e')]({'where':{'id':_0x163566[_0x183f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x389ef9,null))[_0x183f('0x22')](function(_0xbf08c7){if(_0xbf08c7){var _0x58ad69=[];for(var _0x3a9b01=0x0;_0x3a9b01<_0x595dfd['length'];_0x3a9b01++){_0x58ad69[_0x183f('0x61')](db[_0x183f('0x4a')][_0x183f('0x6e')]({'where':{'userProfileId':_0xbf08c7['id'],'name':_0x595dfd[_0x3a9b01][_0x183f('0x26')]},'raw':!![]}));}return BPromise[_0x183f('0x6f')](_0x58ad69);}})['then'](function(_0x445d46){var _0x2d93cc=_[_0x183f('0x39')](_0x445d46,function(_0x192c4e){return _0x192c4e?_0x192c4e:undefined;});var _0x1f77fc=_[_0x183f('0x39')](_0x595dfd,[_0x183f('0x70'),!![]]);var _0x2fd346=_[_0x183f('0x5c')](_0x2d93cc)&&_[_0x183f('0x5c')](_0x1f77fc)?null:_['union'](_0x1f77fc,_0x2d93cc);if(_0x2fd346){var _0x3b9649=[];for(var _0x36c7f5=0x0;_0x36c7f5<_0x2fd346[_0x183f('0x33')];_0x36c7f5++){var _0x1929f5=_[_0x183f('0x40')](_0x595dfd,function(_0x51c793){return _0x2fd346[_0x36c7f5]?_0x51c793['name']===_0x2fd346[_0x36c7f5][_0x183f('0x26')]:null;});if(_0x1929f5){if(_0x2fd346[_0x36c7f5][_0x183f('0x70')]){_0x3b9649['push'](getAllResources(_0xaab032[_0x183f('0x6a')],_0x2fd346[_0x36c7f5]));}else{if(!_0x2fd346[_0x36c7f5][_0x183f('0x4d')]){_0x3b9649[_0x183f('0x61')](getAllowedResources(_0x1929f5,_0x2fd346[_0x36c7f5],_0xaab032[_0x183f('0x6a')]));}else{if(_0x1929f5[_0x183f('0x2c')]){_0x3b9649[_0x183f('0x61')](getAllFilteredResources(_0x1929f5,_0x2fd346[_0x36c7f5]));}}}}}return BPromise['all'](_0x3b9649);}else{return null;}})[_0x183f('0x22')](function(_0x213924){var _0xb61330=_0x213924;var _0x14f6dc=null;if(_0xb61330){_0x14f6dc=_0xb61330[_0x183f('0x33')]===0x1?_0xb61330[0x0]:null;}if(_0x14f6dc||_0xb61330){var _0x162e80=db[_0xaab032[_0x183f('0x6a')]][_0x183f('0x2a')];_0x1222f6['model']=_[_0x183f('0x2d')](_0x162e80);_0x1222f6[_0x183f('0x2e')]=_[_0x183f('0x2d')](_0x163566[_0x183f('0x2e')]);_0x1222f6[_0x183f('0x2f')]=_['intersection'](_0x1222f6['model'],_0x1222f6[_0x183f('0x2e')]);_0x2a6111[_0x183f('0x31')]=_[_0x183f('0x30')](_0x1222f6[_0x183f('0x2c')],qs[_0x183f('0x32')](_0x163566[_0x183f('0x2e')][_0x183f('0x32')]));_0x2a6111[_0x183f('0x31')]=_0x2a6111[_0x183f('0x31')][_0x183f('0x33')]?_0x2a6111[_0x183f('0x31')]:_0x1222f6[_0x183f('0x2c')];if(!_0x163566[_0x183f('0x2e')][_0x183f('0x34')](_0x183f('0x35'))){_0x2a6111[_0x183f('0x1c')]=qs[_0x183f('0x1c')](_0x163566[_0x183f('0x2e')][_0x183f('0x1c')]);_0x2a6111['offset']=qs['offset'](_0x163566[_0x183f('0x2e')][_0x183f('0x1b')]);}_0x2a6111[_0x183f('0x71')]=qs[_0x183f('0x36')](_0x163566['query']['sort']);_0x2a6111[_0x183f('0x37')]=qs[_0x183f('0x2f')](_[_0x183f('0x38')](_0x163566[_0x183f('0x2e')],_0x1222f6['filters']));if(_0x163566[_0x183f('0x2e')][_0x183f('0x39')]){_0x2a6111['where']=_[_0x183f('0x3a')](_0x2a6111[_0x183f('0x37')],{'$or':_['map'](_0x162e80,function(_0x15b0b9){if(_0x15b0b9[_0x183f('0x72')][_0x183f('0x2b')]!==_0x183f('0x73')){var _0x4ad3c7={};_0x4ad3c7[_0x15b0b9[_0x183f('0x74')]]={'$like':'%'+_0x163566[_0x183f('0x2e')][_0x183f('0x39')]+'%'};return _0x4ad3c7;}})});}var _0x393edd=[];if(_0x14f6dc){var _0x3aea3a=_[_0x183f('0x40')](_0x595dfd,['name',_0x14f6dc[_0x183f('0x26')]]);if(_0x3aea3a[_0x183f('0x74')]){var _0x513647={};if(_0xaab032[_0x183f('0x6a')]===_0x183f('0x75')){_0x513647[_0x3aea3a[_0x183f('0x76')]]=_['map'](_0x14f6dc[_0x183f('0x77')],'id');}else{_0x513647[_0x3aea3a[_0x183f('0x76')]]=_0x14f6dc[_0x183f('0x77')];}_0x393edd[_0x183f('0x61')](_0x513647);}else{_0x2a6111[_0x183f('0x37')]['id']=_0x14f6dc[_0x183f('0x77')];}}else{for(var _0x4c4c39=0x0;_0x4c4c39<_0xb61330[_0x183f('0x33')];_0x4c4c39++){var _0x3aea3a=_[_0x183f('0x40')](_0x595dfd,[_0x183f('0x26'),_0xb61330[_0x4c4c39][_0x183f('0x26')]]);if(_0x3aea3a[_0x183f('0x74')]){var _0x513647={};_0x513647[_0x3aea3a[_0x183f('0x76')]]=_0xb61330[_0x4c4c39][_0x183f('0x77')];_0x393edd[_0x183f('0x61')](_0x513647);}else{if(!_0x2a6111[_0x183f('0x37')]['id'])_0x2a6111[_0x183f('0x37')]['id']=[];_0xb61330[_0x4c4c39][_0x183f('0x77')][_0x183f('0x60')](function(_0x1d6004){_0x2a6111[_0x183f('0x37')]['id'][_0x183f('0x61')](_0x1d6004);});}}}if(!_['isEmpty'](_0x393edd)){_0x2a6111[_0x183f('0x37')]=_[_0x183f('0x3a')](_0x2a6111['where'],{'$and':{'$or':_0x393edd}});}_0x2a6111=_[_0x183f('0x3a')]({},_0x2a6111,_0x163566[_0x183f('0x3b')]);if(_0x14f6dc&&!_0x14f6dc['autoAssociation']&&_0xaab032['childModel']===_0x183f('0x75')){if(_0x163566[_0x183f('0x2e')][_0x183f('0x3f')]){_0x2a6111[_0x183f('0x3d')]=[{'all':!![]}];}return db[_0xaab032[_0x183f('0x6a')]][_0x183f('0x4b')](_0x2a6111)[_0x183f('0x22')](function(_0x101ed9){var _0xd6cb52=[];_0x101ed9[_0x183f('0x60')](function(_0x95ad53){var _0x2344d5;switch(_0x95ad53[_0x183f('0x78')]){case _0x183f('0x79'):_0x2344d5=_[_0x183f('0x40')](_0x14f6dc['associatedResources'],function(_0x409a25){return _0x409a25['id']===_0x95ad53['reportId']&&_0x409a25[_0x183f('0x72')]===_0x183f('0x7a');});break;case _0x183f('0x7b'):_0x2344d5=_[_0x183f('0x40')](_0x14f6dc[_0x183f('0x77')],function(_0x143a36){return _0x143a36['id']===_0x95ad53[_0x183f('0x7c')]&&_0x143a36[_0x183f('0x72')]===_0x183f('0x7d');});break;}if(_0x2344d5)_0xd6cb52[_0x183f('0x61')](_0x95ad53);});_0x53a55d[_0x183f('0x3c')]=_0xd6cb52['length'];_0x53a55d['rows']=_0xd6cb52;return _0x53a55d;});}else{return db[_0xaab032[_0x183f('0x6a')]][_0x183f('0x3c')]({'where':_0x2a6111[_0x183f('0x37')]})[_0x183f('0x22')](function(_0xaf0bf7){_0x53a55d['count']=_0xaf0bf7;if(_0x163566[_0x183f('0x2e')][_0x183f('0x3f')]){if(_0xaab032[_0x183f('0x6a')]===_0x183f('0x7e')){_0x2a6111[_0x183f('0x3d')]=[{'model':db[_0x183f('0x7f')],'as':_0x183f('0x80'),'attributes':['id',_0x183f('0x26'),_0x183f('0x81')],'required':_0x163566[_0x183f('0x2e')][_0x183f('0x82')]?!![]:![]},{'model':db[_0x183f('0x7f')],'as':_0x183f('0x83'),'attributes':['id',_0x183f('0x26'),_0x183f('0x81')],'through':_0x163566[_0x183f('0x2e')]['tag']?{'attributes':[],'where':{'TagId':_0x163566[_0x183f('0x2e')]['tag']||undefined}}:{},'required':_0x163566[_0x183f('0x2e')][_0x183f('0x82')]?!![]:![]}];}else{_0x2a6111[_0x183f('0x3d')]=[{'all':!![]}];}}return db[_0xaab032[_0x183f('0x6a')]]['findAll'](_0x2a6111);})[_0x183f('0x22')](function(_0x391da1){_0x53a55d[_0x183f('0x84')]=_0x391da1;return _0x53a55d;});}}else{return _0x53a55d;}})[_0x183f('0x22')](respondWithFilteredResult(_0x389ef9,_0x2a6111))['catch'](handleError(_0x389ef9,null));};function getAllResources(_0x518c5b,_0x45d59f){return new BPromise(function(_0x4cbc6c,_0x31e4c6){if(_0x45d59f){var _0x10d43b=_0x45d59f[_0x183f('0x39')]?{[_0x45d59f[_0x183f('0x39')][_0x183f('0x74')]]:_0x45d59f[_0x183f('0x39')]['value']}:undefined;return db[_0x518c5b][_0x183f('0x4b')]({'where':_0x10d43b,'raw':!![]})[_0x183f('0x22')](function(_0x2e151e){_0x45d59f[_0x183f('0x77')]=_[_0x183f('0x28')](_0x2e151e,'id');_0x4cbc6c(_0x45d59f);})[_0x183f('0x42')](function(_0x559476){_0x31e4c6(_0x559476);});}else{_0x4cbc6c(null);}});}function getAllFilteredResources(_0x3a71dc,_0x10d1d3){return new BPromise(function(_0xe9dca5,_0x520297){var _0x465825=_0x3a71dc[_0x183f('0x39')]?{[_0x3a71dc['filter'][_0x183f('0x74')]]:_0x3a71dc[_0x183f('0x39')][_0x183f('0x85')]}:undefined;return db[_0x3a71dc[_0x183f('0x2c')]][_0x183f('0x4b')]({'where':_0x465825,'raw':!![]})[_0x183f('0x22')](function(_0x3bfc4d){_0x10d1d3[_0x183f('0x77')]=_[_0x183f('0x28')](_0x3bfc4d,function(_0x2264ec){return _0x2264ec['name'];});_0xe9dca5(_0x10d1d3);})[_0x183f('0x42')](function(_0x479541){_0x520297(_0x479541);});});}function getAllowedResources(_0x5a82aa,_0x2f19a5,_0x55f2c6){return new BPromise(function(_0x429201,_0x369f1f){if(_0x2f19a5){return db[_0x183f('0x4e')][_0x183f('0x4b')]({'where':{'sectionId':_0x2f19a5['id']},'raw':!![]})[_0x183f('0x22')](function(_0x38033c){if(_0x5a82aa['field']&&_0x5a82aa[_0x183f('0x74')]!=='id'){_0x2f19a5['associatedResources']=_[_0x183f('0x28')](_0x38033c,function(_0x11229a){return _0x11229a[_0x5a82aa[_0x183f('0x74')]];});}else{if(_0x55f2c6===_0x183f('0x75')){_0x2f19a5['associatedResources']=_[_0x183f('0x28')](_0x38033c,function(_0x5cbbb9){return{'id':_0x5cbbb9[_0x183f('0x62')],'type':_0x5cbbb9[_0x183f('0x72')]};});}else{_0x2f19a5['associatedResources']=_[_0x183f('0x28')](_0x38033c,function(_0x24be01){return _0x24be01[_0x183f('0x62')];});}}_0x429201(_0x2f19a5);})[_0x183f('0x42')](function(_0x5cd599){_0x369f1f(_0x5cd599);});}else{_0x429201(null);}});}function getQueryModels(_0x106b61,_0x21cfa3){var _0x419227=_0x106b61['toLowerCase']();var _0x2602e0={'childModel':undefined,'parentSections':[]};switch(_0x419227){case _0x183f('0x86'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x87');break;case _0x183f('0x88'):_0x2602e0[_0x183f('0x6a')]='SquareOdbc';break;case'squarerecordings':_0x2602e0['childModel']='SquareRecording';_0x2602e0['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0x183f('0x89')}];break;case _0x183f('0x8a'):_0x2602e0['childModel']=_0x183f('0x8b');break;case _0x183f('0x8c'):_0x2602e0[_0x183f('0x6a')]='CmContact';_0x2602e0[_0x183f('0x6d')]=[{'name':_0x183f('0x8d'),'field':'id','foreignKey':_0x183f('0x8e')}];break;case'lists':_0x2602e0[_0x183f('0x6a')]=_0x183f('0x8f');break;case'companies':_0x2602e0['childModel']=_0x183f('0x90');break;case _0x183f('0x91'):_0x2602e0[_0x183f('0x6a')]='CmCustomField';break;case _0x183f('0x92'):_0x2602e0[_0x183f('0x6a')]='ChatQueue';break;case _0x183f('0x93'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x94');break;case'faxqueues':_0x2602e0[_0x183f('0x6a')]=_0x183f('0x95');break;case _0x183f('0x96'):_0x2602e0[_0x183f('0x6a')]='FaxAccount';break;case _0x183f('0x97'):case'internalroutes':case _0x183f('0x98'):_0x2602e0[_0x183f('0x6a')]='VoiceExtension';break;case _0x183f('0x99'):_0x2602e0[_0x183f('0x6a')]='VoiceContext';break;case _0x183f('0x9a'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x9b');break;case _0x183f('0x9c'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x9d');_0x2602e0[_0x183f('0x6d')]=[{'name':_0x183f('0x9e'),'field':_0x183f('0x26'),'foreignKey':_0x183f('0x9f'),'model':'User','filter':{'field':_0x183f('0xa0'),'value':[_0x183f('0xa1')]}},{'name':_0x183f('0xa2'),'field':_0x183f('0x26'),'foreignKey':_0x183f('0x9f'),'model':_0x183f('0xa3'),'filter':{'field':_0x183f('0xa0'),'value':[_0x183f('0xa4')]}},{'name':'VoiceQueues','field':_0x183f('0x26'),'foreignKey':'queue','model':_0x183f('0xa5'),'filter':{'field':_0x183f('0x72'),'value':[_0x183f('0xa6')]}},{'name':'QueueCampaigns','field':_0x183f('0x26'),'foreignKey':_0x183f('0xa7'),'model':'VoiceQueue','filter':{'field':_0x183f('0x72'),'value':[_0x183f('0xa8')]}}];break;case'musiconholds':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xa9');break;case'chanspies':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xaa');break;case _0x183f('0xab'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xac');break;case _0x183f('0xad'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xae');break;case'mailqueues':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xaf');break;case _0x183f('0xb0'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xb1');break;case _0x183f('0xb2'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xb3');break;case _0x183f('0xb4'):_0x2602e0[_0x183f('0x6a')]='OpenchannelQueue';break;case'openchannelaccounts':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xb5');break;case _0x183f('0xb6'):_0x2602e0[_0x183f('0x6a')]='SmsQueue';break;case _0x183f('0xb7'):_0x2602e0['childModel']=_0x183f('0xb8');break;case _0x183f('0xb9'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xba');break;case'whatsappaccounts':_0x2602e0['childModel']=_0x183f('0xbb');break;case'teams':_0x2602e0['childModel']=_0x183f('0xbc');break;case'voicequeues':case _0x183f('0xbd'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xa5');if(_0x21cfa3){_0x2602e0[_0x183f('0x6d')]=[{'name':'VoiceQueues'},{'name':_0x183f('0xbe')}];}break;case _0x183f('0xbf'):case _0x183f('0xc0'):case _0x183f('0xc1'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xa3');if(_0x21cfa3){_0x2602e0[_0x183f('0x6d')]=[{'name':_0x183f('0xc2'),'filter':{'field':'role','value':[_0x183f('0xc3'),'user']},'ignore':!![]},{'name':_0x183f('0x9e')},{'name':'Telephones'}];}break;case _0x183f('0xc4'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xc5');break;case _0x183f('0xc6'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xc7');break;case'freshdeskaccounts':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xc8');break;case _0x183f('0xc9'):_0x2602e0['childModel']=_0x183f('0xca');break;case'deskaccounts':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xcb');break;case _0x183f('0xcc'):_0x2602e0[_0x183f('0x6a')]='ZohoAccount';break;case _0x183f('0xcd'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xa3');break;case _0x183f('0xce'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xcf');break;case _0x183f('0xd0'):_0x2602e0[_0x183f('0x6a')]='Disposition';break;case _0x183f('0xd1'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x5f');break;case _0x183f('0xd2'):_0x2602e0['childModel']='Interval';break;case _0x183f('0xd3'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xd4');break;case'scheduler':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xd5');break;case _0x183f('0xd6'):_0x2602e0[_0x183f('0x6a')]='Sound';break;case _0x183f('0xd7'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x7f');break;case'templates':_0x2602e0[_0x183f('0x6a')]=_0x183f('0xd8');break;case'triggers':_0x2602e0['childModel']=_0x183f('0xd9');break;case _0x183f('0xda'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xdb');break;case _0x183f('0xdc'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xdd');break;case _0x183f('0xde'):_0x2602e0['childModel']=_0x183f('0xdf');break;case _0x183f('0xe0'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0x75');_0x2602e0[_0x183f('0x6d')]=[{'name':_0x183f('0xe1'),'field':'id','foreignKey':_0x183f('0x7c')}];break;case _0x183f('0xe2'):_0x2602e0[_0x183f('0x6a')]=_0x183f('0xe3');break;case _0x183f('0xe4'):_0x2602e0[_0x183f('0x6a')]='WhatsappAccount';break;default:return _0x2602e0;}return _0x2602e0;} \ No newline at end of file +var _0xa9aa=['count','offset','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','options','include','show','params','keys','includeAll','merge','find','create','clone','omit','crudPermissions','body','createdAt','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','catch','Resources','describe','addSections','userProfileId','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','get','removeResources','getResources','undefined','Sequelize','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','pick','key','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','custom','CustomReports','rows','CmContact','Tag','color','ThroughTags','tag','value','toLowerCase','SquareProject','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Template','triggers','Trigger','trunks','Trunk','Variable','Plugin','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json'];(function(_0x377826,_0x15fb17){var _0x3fc55e=function(_0x392261){while(--_0x392261){_0x377826['push'](_0x377826['shift']());}};_0x3fc55e(++_0x15fb17);}(_0xa9aa,0xcc));var _0xaa9a=function(_0x3b852f,_0x5f15f2){_0x3b852f=_0x3b852f-0x0;var _0x598ac0=_0xa9aa[_0x3b852f];return _0x598ac0;};'use strict';var pdf=require(_0xaa9a('0x0'));var emlformat=require(_0xaa9a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa9a('0x2'));var rp=require(_0xaa9a('0x3'));var moment=require(_0xaa9a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa9a('0x5'));var util=require(_0xaa9a('0x6'));var path=require(_0xaa9a('0x7'));var sox=require(_0xaa9a('0x8'));var csv=require(_0xaa9a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa9a('0xa'));var squel=require(_0xaa9a('0xb'));var crypto=require(_0xaa9a('0xc'));var jsforce=require(_0xaa9a('0xd'));var deskjs=require(_0xaa9a('0xe'));var toCsv=require(_0xaa9a('0x9'));var querystring=require(_0xaa9a('0xf'));var Papa=require(_0xaa9a('0x10'));var Redis=require(_0xaa9a('0x11'));var authService=require(_0xaa9a('0x12'));var qs=require(_0xaa9a('0x13'));var as=require(_0xaa9a('0x14'));var hardwareService=require(_0xaa9a('0x15'));var logger=require(_0xaa9a('0x16'))('api');var utils=require(_0xaa9a('0x17'));var config=require(_0xaa9a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa9a('0x19'))['db'];config[_0xaa9a('0x1a')]=_[_0xaa9a('0x1b')](config[_0xaa9a('0x1a')],{'host':_0xaa9a('0x1c'),'port':0x18eb});var socket=require(_0xaa9a('0x1d'))(new Redis(config['redis']));require(_0xaa9a('0x1e'))[_0xaa9a('0x1f')](socket);function respondWithStatusCode(_0x1df8c2,_0x4f0019){_0x4f0019=_0x4f0019||0xcc;return function(_0x43f09){if(_0x43f09){return _0x1df8c2[_0xaa9a('0x20')](_0x4f0019);}return _0x1df8c2[_0xaa9a('0x21')](_0x4f0019)[_0xaa9a('0x22')]();};}function respondWithResult(_0x5f5c1c,_0x5a2715){_0x5a2715=_0x5a2715||0xc8;return function(_0x389a54){if(_0x389a54){return _0x5f5c1c['status'](_0x5a2715)[_0xaa9a('0x23')](_0x389a54);}};}function respondWithFilteredResult(_0x192b31,_0x32e027){return function(_0x389d7e){if(_0x389d7e){var _0x4f18c5=_0x389d7e[_0xaa9a('0x24')],_0x4a5844=_0x32e027['offset'],_0x1f4908=_0x32e027[_0xaa9a('0x25')]+_0x32e027['limit'],_0x4b988a;if(_0x1f4908>=_0x4f18c5){_0x1f4908=_0x4f18c5;_0x4b988a=0xc8;}else{_0x4b988a=0xce;}_0x192b31['status'](_0x4b988a);return _0x192b31[_0xaa9a('0x26')](_0xaa9a('0x27'),_0x4a5844+'-'+_0x1f4908+'/'+_0x4f18c5)[_0xaa9a('0x23')](_0x389d7e);}return null;};}function patchUpdates(_0x1cd14a){return function(_0x594dbd){try{jsonpatch[_0xaa9a('0x28')](_0x594dbd,_0x1cd14a,!![]);}catch(_0x56ffb7){return BPromise['reject'](_0x56ffb7);}return _0x594dbd['save']();};}function saveUpdates(_0x3ae945,_0x17f6f4){return function(_0x55d4b4){if(_0x55d4b4){return _0x55d4b4[_0xaa9a('0x29')](_0x3ae945)[_0xaa9a('0x2a')](function(_0x5f3256){return _0x5f3256;});}return null;};}function removeEntity(_0x26a4d2,_0x1f693b){return function(_0x186fe1){if(_0x186fe1){return _0x186fe1[_0xaa9a('0x2b')]()[_0xaa9a('0x2a')](function(){_0x26a4d2[_0xaa9a('0x21')](0xcc)[_0xaa9a('0x22')]();});}};}function handleEntityNotFound(_0xc184f7,_0x5748f1){return function(_0x46ab44){if(!_0x46ab44){_0xc184f7[_0xaa9a('0x20')](0x194);}return _0x46ab44;};}function handleError(_0x1d7a1c,_0x2b94ad){_0x2b94ad=_0x2b94ad||0x1f4;return function(_0xc86f61){logger[_0xaa9a('0x2c')](_0xc86f61['stack']);if(_0xc86f61[_0xaa9a('0x2d')]){delete _0xc86f61[_0xaa9a('0x2d')];}_0x1d7a1c['status'](_0x2b94ad)[_0xaa9a('0x2e')](_0xc86f61);};}exports[_0xaa9a('0x2f')]=function(_0x959a0c,_0x3215a6){var _0x6e27fd={},_0x580abd={},_0x6ec953={'count':0x0,'rows':[]};var _0x1032ad=_[_0xaa9a('0x30')](db[_0xaa9a('0x31')][_0xaa9a('0x32')],function(_0x39a2d7){return{'name':_0x39a2d7[_0xaa9a('0x33')],'type':_0x39a2d7[_0xaa9a('0x34')]['key']};});_0x580abd[_0xaa9a('0x35')]=_[_0xaa9a('0x30')](_0x1032ad,'name');_0x580abd['query']=_['keys'](_0x959a0c[_0xaa9a('0x36')]);_0x580abd[_0xaa9a('0x37')]=_[_0xaa9a('0x38')](_0x580abd[_0xaa9a('0x35')],_0x580abd[_0xaa9a('0x36')]);_0x6e27fd['attributes']=_[_0xaa9a('0x38')](_0x580abd[_0xaa9a('0x35')],qs[_0xaa9a('0x39')](_0x959a0c[_0xaa9a('0x36')][_0xaa9a('0x39')]));_0x6e27fd[_0xaa9a('0x3a')]=_0x6e27fd[_0xaa9a('0x3a')][_0xaa9a('0x3b')]?_0x6e27fd[_0xaa9a('0x3a')]:_0x580abd['model'];if(!_0x959a0c[_0xaa9a('0x36')][_0xaa9a('0x3c')](_0xaa9a('0x3d'))){_0x6e27fd['limit']=qs[_0xaa9a('0x3e')](_0x959a0c['query']['limit']);_0x6e27fd['offset']=qs[_0xaa9a('0x25')](_0x959a0c['query'][_0xaa9a('0x25')]);}_0x6e27fd[_0xaa9a('0x3f')]=qs[_0xaa9a('0x40')](_0x959a0c['query']['sort']);_0x6e27fd['where']=qs[_0xaa9a('0x37')](_['pick'](_0x959a0c[_0xaa9a('0x36')],_0x580abd[_0xaa9a('0x37')]),_0x1032ad);if(_0x959a0c['query']['filter']){_0x6e27fd[_0xaa9a('0x41')]=_['merge'](_0x6e27fd[_0xaa9a('0x41')],{'$or':_['map'](_0x1032ad,function(_0x3b528c){if(_0x3b528c['type']!==_0xaa9a('0x42')){var _0x1d0d0c={};_0x1d0d0c[_0x3b528c[_0xaa9a('0x2d')]]={'$like':'%'+_0x959a0c[_0xaa9a('0x36')][_0xaa9a('0x43')]+'%'};return _0x1d0d0c;}})});}_0x6e27fd=_['merge']({},_0x6e27fd,_0x959a0c[_0xaa9a('0x44')]);var _0x48ce24={'where':_0x6e27fd[_0xaa9a('0x41')]};return db[_0xaa9a('0x31')][_0xaa9a('0x24')](_0x48ce24)[_0xaa9a('0x2a')](function(_0x337404){_0x6ec953[_0xaa9a('0x24')]=_0x337404;if(_0x959a0c[_0xaa9a('0x36')]['includeAll']){_0x6e27fd[_0xaa9a('0x45')]=[{'all':!![]}];}return db[_0xaa9a('0x31')]['findAll'](_0x6e27fd);})['then'](function(_0x484ac3){_0x6ec953['rows']=_0x484ac3;return _0x6ec953;})[_0xaa9a('0x2a')](respondWithFilteredResult(_0x3215a6,_0x6e27fd))['catch'](handleError(_0x3215a6,null));};exports[_0xaa9a('0x46')]=function(_0x4a942f,_0x5a6f2e){var _0x3e6625={'raw':![],'where':{'id':_0x4a942f[_0xaa9a('0x47')]['id']}},_0xcc3f0f={};_0xcc3f0f[_0xaa9a('0x35')]=_[_0xaa9a('0x48')](db[_0xaa9a('0x31')][_0xaa9a('0x32')]);_0xcc3f0f[_0xaa9a('0x36')]=_['keys'](_0x4a942f[_0xaa9a('0x36')]);_0xcc3f0f['filters']=_['intersection'](_0xcc3f0f['model'],_0xcc3f0f['query']);_0x3e6625[_0xaa9a('0x3a')]=_[_0xaa9a('0x38')](_0xcc3f0f['model'],qs[_0xaa9a('0x39')](_0x4a942f[_0xaa9a('0x36')][_0xaa9a('0x39')]));_0x3e6625['attributes']=_0x3e6625[_0xaa9a('0x3a')][_0xaa9a('0x3b')]?_0x3e6625['attributes']:_0xcc3f0f[_0xaa9a('0x35')];if(_0x4a942f[_0xaa9a('0x36')][_0xaa9a('0x49')]){_0x3e6625[_0xaa9a('0x45')]=[{'all':!![]}];}_0x3e6625=_[_0xaa9a('0x4a')]({},_0x3e6625,_0x4a942f[_0xaa9a('0x44')]);return db['UserProfile'][_0xaa9a('0x4b')](_0x3e6625)[_0xaa9a('0x2a')](handleEntityNotFound(_0x5a6f2e,null))[_0xaa9a('0x2a')](respondWithResult(_0x5a6f2e,null))['catch'](handleError(_0x5a6f2e,null));};exports[_0xaa9a('0x4c')]=function(_0x174094,_0x216e8f){return db['UserProfile']['create'](_0x174094['body'],{})[_0xaa9a('0x2a')](respondWithResult(_0x216e8f,0xc9))['catch'](handleError(_0x216e8f,null));};exports[_0xaa9a('0x4d')]=function(_0x148623,_0x4be4f3){var _0x29d536={'where':{'id':_0x148623[_0xaa9a('0x47')]['id']}},_0x18adee={};_0x18adee[_0xaa9a('0x35')]=_[_0xaa9a('0x48')](db[_0xaa9a('0x31')][_0xaa9a('0x32')]);_0x29d536[_0xaa9a('0x3a')]=_['intersection'](_0x18adee['model'],qs[_0xaa9a('0x39')](_0x148623[_0xaa9a('0x36')][_0xaa9a('0x39')]));_0x29d536[_0xaa9a('0x3a')]=_0x29d536[_0xaa9a('0x3a')][_0xaa9a('0x3b')]?_0x29d536[_0xaa9a('0x3a')]:_0x18adee[_0xaa9a('0x35')];if(_0x148623[_0xaa9a('0x36')][_0xaa9a('0x49')]){_0x29d536[_0xaa9a('0x45')]=[{'all':!![]}];}_0x29d536=_['merge']({},_0x29d536,_0x148623[_0xaa9a('0x44')]);return db[_0xaa9a('0x31')][_0xaa9a('0x4b')](_0x29d536)[_0xaa9a('0x2a')](handleEntityNotFound(_0x4be4f3,null))[_0xaa9a('0x2a')](function(_0x4a7b13){if(_0x4a7b13){var _0x2dc62a=_0x4a7b13['get']({'plain':!![]});_0x2dc62a=qs[_0xaa9a('0x4e')](_0x2dc62a,['id','createdAt','updatedAt',_0xaa9a('0x4f')]);_0x148623[_0xaa9a('0x50')]=_['omit'](_0x148623['body'],['id',_0xaa9a('0x51'),_0xaa9a('0x52')]);return db[_0xaa9a('0x53')][_0xaa9a('0x54')](function(_0x3ba075){return db[_0xaa9a('0x31')]['create'](_[_0xaa9a('0x4a')](_0x2dc62a,_0x148623['body']),{'include':_0x148623['query'][_0xaa9a('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x3ba075})[_0xaa9a('0x2a')](function(_0x43718f){var _0x37a3b5=_0x43718f['get']({'plain':!![]});return db[_0xaa9a('0x55')][_0xaa9a('0x56')]({'where':{'userProfileId':_0x148623[_0xaa9a('0x47')]['id']},'raw':!![]})['then'](function(_0x3d5cce){if(_0x3d5cce){return BPromise[_0xaa9a('0x57')](_0x3d5cce,function(_0x57da3d){return new BPromise(function(_0x20cc51,_0x446b5b){if(_0x57da3d[_0xaa9a('0x58')]===null||_0x57da3d[_0xaa9a('0x58')]===0x1)_0x20cc51(null);return db[_0xaa9a('0x59')][_0xaa9a('0x56')]({'where':{'sectionId':_0x57da3d['id']},'raw':!![]})[_0xaa9a('0x2a')](function(_0x46b01f){var _0x5a85c9=_[_0xaa9a('0x30')](_0x46b01f,function(_0x504884){return qs[_0xaa9a('0x4e')](_0x504884,['id',_0xaa9a('0x51'),_0xaa9a('0x52'),_0xaa9a('0x5a')]);});_0x20cc51(_0x5a85c9);})[_0xaa9a('0x5b')](function(_0x3f3f4d){_0x446b5b(_0x3f3f4d);});})[_0xaa9a('0x2a')](function(_0x4311d5){var _0x3aa222=qs[_0xaa9a('0x4e')](_0x57da3d,['id','createdAt',_0xaa9a('0x52')]);_0x3aa222['userProfileId']=_0x37a3b5['id'];if(_0x4311d5)_0x3aa222[_0xaa9a('0x5c')]=_0x4311d5;return _0x3aa222;})[_0xaa9a('0x2a')](function(_0xcb1508){return db['UserProfileSection'][_0xaa9a('0x4c')](_0xcb1508,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3ba075});});})[_0xaa9a('0x2a')](function(){return _0x37a3b5;});}});});});}})[_0xaa9a('0x2a')](respondWithResult(_0x4be4f3,0xc9))[_0xaa9a('0x5b')](handleError(_0x4be4f3,null));};exports[_0xaa9a('0x29')]=function(_0x6b42d3,_0x2399eb){if(_0x6b42d3['body']['id']){delete _0x6b42d3[_0xaa9a('0x50')]['id'];}return db[_0xaa9a('0x31')][_0xaa9a('0x4b')]({'where':{'id':_0x6b42d3[_0xaa9a('0x47')]['id']}})[_0xaa9a('0x2a')](handleEntityNotFound(_0x2399eb,null))[_0xaa9a('0x2a')](saveUpdates(_0x6b42d3[_0xaa9a('0x50')],null))['then'](respondWithResult(_0x2399eb,null))[_0xaa9a('0x5b')](handleError(_0x2399eb,null));};exports[_0xaa9a('0x2b')]=function(_0x1790e4,_0x48a5a8){return db[_0xaa9a('0x31')][_0xaa9a('0x4b')]({'where':{'id':_0x1790e4[_0xaa9a('0x47')]['id']}})[_0xaa9a('0x2a')](handleEntityNotFound(_0x48a5a8,null))['then'](removeEntity(_0x48a5a8,null))[_0xaa9a('0x5b')](handleError(_0x48a5a8,null));};exports[_0xaa9a('0x5d')]=function(_0x364870,_0x54a4e1){return db[_0xaa9a('0x31')]['describe']()[_0xaa9a('0x2a')](respondWithResult(_0x54a4e1,null))[_0xaa9a('0x5b')](handleError(_0x54a4e1,null));};exports[_0xaa9a('0x5e')]=function(_0xadef52,_0x464363){var _0x49a32e=_0xadef52['body'];return db[_0xaa9a('0x31')][_0xaa9a('0x4b')]({'where':{'id':_0xadef52[_0xaa9a('0x47')]['id']}})[_0xaa9a('0x2a')](handleEntityNotFound(_0x464363,null))[_0xaa9a('0x2a')](function(_0xbe0785){if(_0xbe0785){return db['sequelize'][_0xaa9a('0x54')](function(_0x197343){return db[_0xaa9a('0x55')]['destroy']({'where':{'userProfileId':_0xadef52['params']['id'],'sectionId':_[_0xaa9a('0x30')](_0x49a32e,function(_0x4721f3){return _0x4721f3[_0xaa9a('0x5a')];})},'transaction':_0x197343})[_0xaa9a('0x2a')](function(){var _0x2a7837=_[_0xaa9a('0x30')](_0x49a32e,function(_0x19c498){_0x19c498[_0xaa9a('0x5f')]=_0xadef52[_0xaa9a('0x47')]['id'];return _0x19c498;});var _0x43964b=[];return BPromise[_0xaa9a('0x57')](_0x2a7837,function(_0x56a459){return db[_0xaa9a('0x55')][_0xaa9a('0x4c')](_0x56a459,{'include':[{'model':db[_0xaa9a('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x197343})[_0xaa9a('0x2a')](function(_0x576def){_0x43964b['push'](_0x576def['get']({'plain':!![]}));});})['then'](function(){return _0x43964b;});});});}})[_0xaa9a('0x2a')](function(_0xb6eaff){return _0xb6eaff;})[_0xaa9a('0x2a')](respondWithResult(_0x464363,null))[_0xaa9a('0x5b')](handleError(_0x464363,null));};exports[_0xaa9a('0x60')]=function(_0x98ae2,_0x42e912){var _0x2870ca;return db[_0xaa9a('0x31')][_0xaa9a('0x4b')]({'where':{'id':_0x98ae2[_0xaa9a('0x47')]['id']},'attributes':['id',_0xaa9a('0x2d')]})[_0xaa9a('0x2a')](handleEntityNotFound(_0x42e912,null))[_0xaa9a('0x2a')](function(_0x1e06cc){if(_0x1e06cc){_0x2870ca=_0x1e06cc;return db[_0xaa9a('0x55')]['destroy']({'where':{'userProfileId':_0x98ae2[_0xaa9a('0x47')]['id'],'sectionId':_0x98ae2['query'][_0xaa9a('0x61')]}});}})[_0xaa9a('0x2a')](function(){return _0x2870ca;})[_0xaa9a('0x2a')](respondWithStatusCode(_0x42e912,null))[_0xaa9a('0x5b')](handleError(_0x42e912,null));};exports[_0xaa9a('0x62')]=function(_0x135385,_0x5683b2){var _0x5e4990=[];var _0x5ce54b=[];return db[_0xaa9a('0x55')][_0xaa9a('0x56')]({'where':{'userProfileId':_0x135385[_0xaa9a('0x47')]['id']},'raw':!![]})[_0xaa9a('0x2a')](function(_0x2254f7){_0x5e4990=_['filter'](_0x2254f7,function(_0x34233f){return _0x34233f[_0xaa9a('0x63')]===0x1||_[_0xaa9a('0x64')]([0x3eb,0x709],_0x34233f[_0xaa9a('0x5a')]);});if(!_[_0xaa9a('0x65')](_0x5e4990)){return _[_0xaa9a('0x30')](_0x5e4990,function(_0x328327){return _0x328327['sectionId'];});}else{return;}})[_0xaa9a('0x2a')](function(_0x1e86ea){if(_0x1e86ea)_0x5ce54b=_0x1e86ea;if(_[_0xaa9a('0x64')](_0x5ce54b,0x64)){var _0x3ef51a=_[_0xaa9a('0x4b')](_0x5e4990,{'sectionId':0x64});return hasDefaultDashboard(_0x3ef51a)[_0xaa9a('0x2a')](function(_0x2843be){return _[_0xaa9a('0x30')](_0x5e4990,function(_0x578fa5){if(_0x578fa5[_0xaa9a('0x5a')]===0x64){_0x578fa5['subsections']=_0x2843be;}return _0x578fa5;});});}else{return;}})[_0xaa9a('0x2a')](function(_0x2b77a3){if(_0x2b77a3)_0x5e4990=_0x2b77a3;if(_[_0xaa9a('0x64')](_0x5ce54b,0x3eb)){var _0x4bc275=_[_0xaa9a('0x4b')](_0x5e4990,{'sectionId':0x3eb});return getCustomDashboards(_0x4bc275)['then'](function(_0x1dc8d2){return _[_0xaa9a('0x30')](_0x5e4990,function(_0x5d3d1a){if(_0x4bc275[_0xaa9a('0x63')]){if(_0x5d3d1a[_0xaa9a('0x5a')]===0x3eb){_0x5d3d1a['subsections']=_0x1dc8d2;}}else{if(_0x5d3d1a['sectionId']===0x64){_0x5d3d1a[_0xaa9a('0x66')]=_0x1dc8d2;}}return _0x5d3d1a;});});}else{return;}})[_0xaa9a('0x2a')](function(_0x4550f6){if(_0x4550f6)_0x5e4990=_0x4550f6;if(_[_0xaa9a('0x64')](_0x5ce54b,0x709)){var _0x23506f=_[_0xaa9a('0x4b')](_0x5e4990,{'sectionId':0x709});return getPlugins(_0x23506f)[_0xaa9a('0x2a')](function(_0x344a4c){if(_0x23506f[_0xaa9a('0x63')]){return _['map'](_0x5e4990,function(_0x3cc4ea){if(_0x3cc4ea[_0xaa9a('0x5a')]===0x709){_0x3cc4ea[_0xaa9a('0x66')]=_0x344a4c;}return _0x3cc4ea;});}else{var _0x39d1a4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x344a4c};var _0x4c06dc=_[_0xaa9a('0x30')](_0x5e4990);_0x4c06dc[_0xaa9a('0x67')](_0x39d1a4);return _0x4c06dc;}});}else{return;}})['then'](function(_0x1d8740){if(_0x1d8740)_0x5e4990=_0x1d8740;return _[_0xaa9a('0x43')](_0x5e4990,['enabled',0x1]);})[_0xaa9a('0x2a')](respondWithResult(_0x5683b2,null))[_0xaa9a('0x5b')](handleError(_0x5683b2,null));};function hasDefaultDashboard(_0x50e6e1){var _0x3c59ed=[0x65];return new BPromise(function(_0x316b08,_0x1f18fa){try{if(_0x50e6e1[_0xaa9a('0x58')]){_0x316b08(_0x3c59ed);}else{return db['UserProfileResource'][_0xaa9a('0x68')]({'where':{'sectionId':_0x50e6e1['id']},'raw':!![]})[_0xaa9a('0x2a')](function(_0x40349a){_0x40349a?_0x316b08(_0x3c59ed):_0x316b08();});}}catch(_0x5703ff){_0x1f18fa(_0x5703ff);}});}function getCustomDashboards(_0x1eb8f3){var _0x4278ba=[];return new BPromise(function(_0x5d20d7,_0x14e08e){try{if(_0x1eb8f3[_0xaa9a('0x58')]){return db[_0xaa9a('0x69')][_0xaa9a('0x56')]({'raw':!![]})[_0xaa9a('0x2a')](function(_0x181793){_0x181793['forEach'](function(_0x2525b3){_0x4278ba[_0xaa9a('0x67')](_0x2525b3['id']+0x1869f);});_0x5d20d7(_0x4278ba);});}else{return db[_0xaa9a('0x59')][_0xaa9a('0x56')]({'where':{'sectionId':_0x1eb8f3['id']},'raw':!![]})[_0xaa9a('0x2a')](function(_0x3dfab2){_0x3dfab2[_0xaa9a('0x6a')](function(_0x3a5d4d){_0x4278ba[_0xaa9a('0x67')](_0x3a5d4d[_0xaa9a('0x6b')]+0x1869f);});_0x5d20d7(_0x4278ba);});}}catch(_0x1f2aa5){_0x14e08e(_0x1f2aa5);}});}function getPlugins(_0x36c978){var _0x567d55=[];return new BPromise(function(_0x2877fa,_0x2ce76d){try{if(_0x36c978[_0xaa9a('0x58')]){return db['Plugin'][_0xaa9a('0x56')]({'raw':!![]})[_0xaa9a('0x2a')](function(_0x36391e){_0x36391e['forEach'](function(_0x1f0f0e){_0x567d55[_0xaa9a('0x67')](_0x1f0f0e['id']+0x15b38);});_0x2877fa(_0x567d55);});}else{return db[_0xaa9a('0x59')]['findAll']({'where':{'sectionId':_0x36c978['id']},'raw':!![]})[_0xaa9a('0x2a')](function(_0x1329a5){_0x1329a5[_0xaa9a('0x6a')](function(_0x4ca10c){_0x567d55['push'](_0x4ca10c[_0xaa9a('0x6b')]+0x15b38);});_0x2877fa(_0x567d55);});}}catch(_0x3321b1){_0x2ce76d(_0x3321b1);}});}exports[_0xaa9a('0x6c')]=function(_0x45311c,_0x279292){return db[_0xaa9a('0x31')]['find']({'where':{'id':_0x45311c['params']['id']}})[_0xaa9a('0x2a')](handleEntityNotFound(_0x279292,null))['then'](function(_0x27466f){if(_0x27466f){return db['sequelize']['transaction'](function(_0x8e3884){return db[_0xaa9a('0x55')]['findAll']({'where':{'userProfileId':_0x45311c[_0xaa9a('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xaa9a('0x2a')](function(_0x5a4531){if(_0x5a4531){return db['UserProfileSection'][_0xaa9a('0x2b')]({'where':{'userProfileId':_0x45311c[_0xaa9a('0x47')]['id'],'id':_[_0xaa9a('0x30')](_0x5a4531,function(_0x406c61){return _0x406c61['id'];})},'transaction':_0x8e3884});}})['then'](function(_0x2afddf){var _0x11283e=_[_0xaa9a('0x30')](_0x45311c['body'],function(_0x11d9b7){_0x11d9b7[_0xaa9a('0x5f')]=_0x45311c[_0xaa9a('0x47')]['id'];return _0x11d9b7;});return db[_0xaa9a('0x55')][_0xaa9a('0x6d')](_0x11283e,{'raw':!![],'transaction':_0x8e3884});})[_0xaa9a('0x2a')](function(_0x2c7849){var _0x27b7d1=_[_0xaa9a('0x43')](_[_0xaa9a('0x30')](_0x2c7849,function(_0x1a02c0){return _0x1a02c0[_0xaa9a('0x6e')]({'plain':!![]});}),{'includeAll':![]});if(_0x27b7d1){return db[_0xaa9a('0x55')][_0xaa9a('0x56')]({'where':{'userProfileId':_0x45311c['params']['id'],'sectionId':_[_0xaa9a('0x30')](_0x27b7d1,function(_0x528f6b){return _0x528f6b[_0xaa9a('0x5a')];})},'attributes':['id',_0xaa9a('0x5a')],'raw':!![]})[_0xaa9a('0x2a')](function(_0x2aea00){var _0x306530=_[_0xaa9a('0x30')](_0x45311c[_0xaa9a('0x50')],function(_0x61259){_0x61259['userProfileId']=_0x45311c[_0xaa9a('0x47')]['id'];return _0x61259;});return db['UserProfileResource'][_0xaa9a('0x6d')](_0x306530,{'raw':!![],'transaction':_0x8e3884});});}})[_0xaa9a('0x5b')](handleError(_0x279292,null));});}})[_0xaa9a('0x2a')](function(_0x5833b5){var _0x1ffbc7=_[_0xaa9a('0x30')](_0x5833b5,function(_0x38dda6){return _0x38dda6[_0xaa9a('0x6e')]({'plain':!![]});});})['then'](respondWithResult(_0x279292,null))[_0xaa9a('0x5b')](handleError(_0x279292,null));};exports['removeResources']=function(_0x2c536e,_0x4e5cca,_0x550755){return db[_0xaa9a('0x31')][_0xaa9a('0x4b')]({'where':{'id':_0x2c536e['params']['id']}})['then'](handleEntityNotFound(_0x4e5cca,null))[_0xaa9a('0x2a')](function(_0x3fb55c){if(_0x3fb55c){return _0x3fb55c[_0xaa9a('0x6f')](_0x2c536e[_0xaa9a('0x36')][_0xaa9a('0x61')]);}})[_0xaa9a('0x2a')](respondWithStatusCode(_0x4e5cca,null))[_0xaa9a('0x5b')](handleError(_0x4e5cca,null));};exports[_0xaa9a('0x70')]=function(_0x54f17b,_0x3b3768){var _0x38e60d={'raw':![],'where':{}};var _0x313587={};var _0x3d1190={'count':0x0,'rows':[]};var _0x36687b=_0x54f17b[_0xaa9a('0x36')]['section'];if(typeof _0x36687b===_0xaa9a('0x71')){throw new db[(_0xaa9a('0x72'))][(_0xaa9a('0x73'))]('Unknown\x20section');}var _0x586f32=_0x54f17b[_0xaa9a('0x36')][_0xaa9a('0x74')]||![];var _0x36ca57=getQueryModels(_0x36687b,_0x586f32);if(typeof _0x36ca57[_0xaa9a('0x75')]===_0xaa9a('0x71')){throw new db['Sequelize'][(_0xaa9a('0x73'))](_0xaa9a('0x76')+_0x36687b+'\x27');}var _0x655369=[];if(!_[_0xaa9a('0x65')](_0x36ca57[_0xaa9a('0x77')])){_0x655369=_0x36ca57[_0xaa9a('0x77')];}else{_0x655369=[{'name':_0x36687b}];}return db[_0xaa9a('0x31')][_0xaa9a('0x68')]({'where':{'id':_0x54f17b[_0xaa9a('0x47')]['id']}})[_0xaa9a('0x2a')](handleEntityNotFound(_0x3b3768,null))[_0xaa9a('0x2a')](function(_0x5125b8){if(_0x5125b8){var _0x1ee80d=[];for(var _0x5ac308=0x0;_0x5ac308<_0x655369['length'];_0x5ac308++){_0x1ee80d[_0xaa9a('0x67')](db[_0xaa9a('0x55')]['findOne']({'where':{'userProfileId':_0x5125b8['id'],'name':_0x655369[_0x5ac308][_0xaa9a('0x2d')]},'raw':!![]}));}return BPromise[_0xaa9a('0x78')](_0x1ee80d);}})[_0xaa9a('0x2a')](function(_0x3e54ee){var _0xb777cc=_[_0xaa9a('0x43')](_0x3e54ee,function(_0x5a490b){return _0x5a490b?_0x5a490b:undefined;});var _0x50be86=_[_0xaa9a('0x43')](_0x655369,[_0xaa9a('0x79'),!![]]);var _0xa89b29=_['isEmpty'](_0xb777cc)&&_[_0xaa9a('0x65')](_0x50be86)?null:_[_0xaa9a('0x7a')](_0x50be86,_0xb777cc);if(_0xa89b29){var _0x34f9a7=[];for(var _0x1a64c4=0x0;_0x1a64c4<_0xa89b29[_0xaa9a('0x3b')];_0x1a64c4++){var _0x482ae9=_['find'](_0x655369,function(_0x1ea075){return _0xa89b29[_0x1a64c4]?_0x1ea075[_0xaa9a('0x2d')]===_0xa89b29[_0x1a64c4][_0xaa9a('0x2d')]:null;});if(_0x482ae9){if(_0xa89b29[_0x1a64c4]['ignore']){_0x34f9a7['push'](getAllResources(_0x36ca57[_0xaa9a('0x75')],_0xa89b29[_0x1a64c4]));}else{if(!_0xa89b29[_0x1a64c4][_0xaa9a('0x58')]){_0x34f9a7[_0xaa9a('0x67')](getAllowedResources(_0x482ae9,_0xa89b29[_0x1a64c4],_0x36ca57['childModel']));}else{if(_0x482ae9['model']){_0x34f9a7[_0xaa9a('0x67')](getAllFilteredResources(_0x482ae9,_0xa89b29[_0x1a64c4]));}}}}}return BPromise['all'](_0x34f9a7);}else{return null;}})['then'](function(_0x329b96){var _0x2d805a=_0x329b96;var _0x2323a0=null;if(_0x2d805a){_0x2323a0=_0x2d805a['length']===0x1?_0x2d805a[0x0]:null;}if(_0x2323a0||_0x2d805a){var _0xf4fed9=db[_0x36ca57[_0xaa9a('0x75')]]['rawAttributes'];_0x313587['model']=_[_0xaa9a('0x48')](_0xf4fed9);_0x313587['query']=_[_0xaa9a('0x48')](_0x54f17b[_0xaa9a('0x36')]);_0x313587[_0xaa9a('0x37')]=_['intersection'](_0x313587[_0xaa9a('0x35')],_0x313587[_0xaa9a('0x36')]);_0x38e60d[_0xaa9a('0x3a')]=_[_0xaa9a('0x38')](_0x313587[_0xaa9a('0x35')],qs['fields'](_0x54f17b[_0xaa9a('0x36')][_0xaa9a('0x39')]));_0x38e60d[_0xaa9a('0x3a')]=_0x38e60d[_0xaa9a('0x3a')]['length']?_0x38e60d[_0xaa9a('0x3a')]:_0x313587['model'];if(!_0x54f17b[_0xaa9a('0x36')]['hasOwnProperty'](_0xaa9a('0x3d'))){_0x38e60d[_0xaa9a('0x3e')]=qs[_0xaa9a('0x3e')](_0x54f17b[_0xaa9a('0x36')]['limit']);_0x38e60d[_0xaa9a('0x25')]=qs[_0xaa9a('0x25')](_0x54f17b[_0xaa9a('0x36')][_0xaa9a('0x25')]);}_0x38e60d[_0xaa9a('0x3f')]=qs[_0xaa9a('0x40')](_0x54f17b[_0xaa9a('0x36')][_0xaa9a('0x40')]);_0x38e60d[_0xaa9a('0x41')]=qs[_0xaa9a('0x37')](_[_0xaa9a('0x7b')](_0x54f17b[_0xaa9a('0x36')],_0x313587[_0xaa9a('0x37')]));if(_0x54f17b[_0xaa9a('0x36')][_0xaa9a('0x43')]){_0x38e60d[_0xaa9a('0x41')]=_[_0xaa9a('0x4a')](_0x38e60d[_0xaa9a('0x41')],{'$or':_['map'](_0xf4fed9,function(_0x3672d1){if(_0x3672d1[_0xaa9a('0x34')][_0xaa9a('0x7c')]!==_0xaa9a('0x42')){var _0x2df921={};_0x2df921[_0x3672d1[_0xaa9a('0x7d')]]={'$like':'%'+_0x54f17b['query'][_0xaa9a('0x43')]+'%'};return _0x2df921;}})});}var _0x55c153=[];if(_0x2323a0){var _0x3f5eff=_['find'](_0x655369,['name',_0x2323a0[_0xaa9a('0x2d')]]);if(_0x3f5eff['field']){var _0x5996fa={};if(_0x36ca57[_0xaa9a('0x75')]===_0xaa9a('0x7e')){_0x5996fa[_0x3f5eff['foreignKey']]=_[_0xaa9a('0x30')](_0x2323a0[_0xaa9a('0x7f')],'id');}else{_0x5996fa[_0x3f5eff[_0xaa9a('0x80')]]=_0x2323a0[_0xaa9a('0x7f')];}_0x55c153[_0xaa9a('0x67')](_0x5996fa);}else{_0x38e60d[_0xaa9a('0x41')]['id']=_0x2323a0['associatedResources'];}}else{for(var _0x265e89=0x0;_0x265e89<_0x2d805a[_0xaa9a('0x3b')];_0x265e89++){var _0x3f5eff=_['find'](_0x655369,[_0xaa9a('0x2d'),_0x2d805a[_0x265e89]['name']]);if(_0x3f5eff[_0xaa9a('0x7d')]){var _0x5996fa={};_0x5996fa[_0x3f5eff['foreignKey']]=_0x2d805a[_0x265e89]['associatedResources'];_0x55c153['push'](_0x5996fa);}else{if(!_0x38e60d[_0xaa9a('0x41')]['id'])_0x38e60d[_0xaa9a('0x41')]['id']=[];_0x2d805a[_0x265e89]['associatedResources'][_0xaa9a('0x6a')](function(_0xb791f7){_0x38e60d[_0xaa9a('0x41')]['id'][_0xaa9a('0x67')](_0xb791f7);});}}}if(!_[_0xaa9a('0x65')](_0x55c153)){_0x38e60d[_0xaa9a('0x41')]=_[_0xaa9a('0x4a')](_0x38e60d[_0xaa9a('0x41')],{'$and':{'$or':_0x55c153}});}_0x38e60d=_[_0xaa9a('0x4a')]({},_0x38e60d,_0x54f17b['options']);if(_0x2323a0&&!_0x2323a0[_0xaa9a('0x58')]&&_0x36ca57[_0xaa9a('0x75')]==='AnalyticExtractedReport'){if(_0x54f17b['query'][_0xaa9a('0x49')]){_0x38e60d[_0xaa9a('0x45')]=[{'all':!![]}];}return db[_0x36ca57[_0xaa9a('0x75')]][_0xaa9a('0x56')](_0x38e60d)[_0xaa9a('0x2a')](function(_0x315e6){var _0x5cebf1=[];_0x315e6['forEach'](function(_0x5e4a48){var _0xe7215b;switch(_0x5e4a48[_0xaa9a('0x81')]){case _0xaa9a('0x82'):_0xe7215b=_['find'](_0x2323a0[_0xaa9a('0x7f')],function(_0x3a0986){return _0x3a0986['id']===_0x5e4a48[_0xaa9a('0x83')]&&_0x3a0986[_0xaa9a('0x34')]==='DefaultReports';});break;case _0xaa9a('0x84'):_0xe7215b=_['find'](_0x2323a0[_0xaa9a('0x7f')],function(_0x36de9c){return _0x36de9c['id']===_0x5e4a48[_0xaa9a('0x83')]&&_0x36de9c['type']===_0xaa9a('0x85');});break;}if(_0xe7215b)_0x5cebf1['push'](_0x5e4a48);});_0x3d1190[_0xaa9a('0x24')]=_0x5cebf1['length'];_0x3d1190[_0xaa9a('0x86')]=_0x5cebf1;return _0x3d1190;});}else{return db[_0x36ca57[_0xaa9a('0x75')]][_0xaa9a('0x24')]({'where':_0x38e60d[_0xaa9a('0x41')]})[_0xaa9a('0x2a')](function(_0x230aac){_0x3d1190['count']=_0x230aac;if(_0x54f17b[_0xaa9a('0x36')]['includeAll']){if(_0x36ca57[_0xaa9a('0x75')]===_0xaa9a('0x87')){_0x38e60d[_0xaa9a('0x45')]=[{'model':db[_0xaa9a('0x88')],'as':'Tags','attributes':['id',_0xaa9a('0x2d'),_0xaa9a('0x89')],'required':_0x54f17b[_0xaa9a('0x36')]['tag']?!![]:![]},{'model':db[_0xaa9a('0x88')],'as':_0xaa9a('0x8a'),'attributes':['id',_0xaa9a('0x2d'),_0xaa9a('0x89')],'through':_0x54f17b[_0xaa9a('0x36')][_0xaa9a('0x8b')]?{'attributes':[],'where':{'TagId':_0x54f17b['query'][_0xaa9a('0x8b')]||undefined}}:{},'required':_0x54f17b[_0xaa9a('0x36')]['tag']?!![]:![]}];}else{_0x38e60d['include']=[{'all':!![]}];}}return db[_0x36ca57['childModel']][_0xaa9a('0x56')](_0x38e60d);})['then'](function(_0x4765da){_0x3d1190[_0xaa9a('0x86')]=_0x4765da;return _0x3d1190;});}}else{return _0x3d1190;}})[_0xaa9a('0x2a')](respondWithFilteredResult(_0x3b3768,_0x38e60d))[_0xaa9a('0x5b')](handleError(_0x3b3768,null));};function getAllResources(_0x2d38fe,_0x1e8cc8){return new BPromise(function(_0x3784b4,_0x31bd0f){if(_0x1e8cc8){var _0x11ff26=_0x1e8cc8['filter']?{[_0x1e8cc8[_0xaa9a('0x43')][_0xaa9a('0x7d')]]:_0x1e8cc8['filter']['value']}:undefined;return db[_0x2d38fe][_0xaa9a('0x56')]({'where':_0x11ff26,'raw':!![]})[_0xaa9a('0x2a')](function(_0x5e2399){_0x1e8cc8[_0xaa9a('0x7f')]=_[_0xaa9a('0x30')](_0x5e2399,'id');_0x3784b4(_0x1e8cc8);})[_0xaa9a('0x5b')](function(_0x486755){_0x31bd0f(_0x486755);});}else{_0x3784b4(null);}});}function getAllFilteredResources(_0x5ec8a6,_0xb591f0){return new BPromise(function(_0x5d3716,_0x369cb2){var _0xfbe6d8=_0x5ec8a6[_0xaa9a('0x43')]?{[_0x5ec8a6[_0xaa9a('0x43')][_0xaa9a('0x7d')]]:_0x5ec8a6[_0xaa9a('0x43')][_0xaa9a('0x8c')]}:undefined;return db[_0x5ec8a6['model']][_0xaa9a('0x56')]({'where':_0xfbe6d8,'raw':!![]})[_0xaa9a('0x2a')](function(_0x256a0c){_0xb591f0['associatedResources']=_[_0xaa9a('0x30')](_0x256a0c,function(_0x48f2cb){return _0x48f2cb[_0xaa9a('0x2d')];});_0x5d3716(_0xb591f0);})[_0xaa9a('0x5b')](function(_0x336319){_0x369cb2(_0x336319);});});}function getAllowedResources(_0x4323a3,_0x207b7f,_0x51d36b){return new BPromise(function(_0x5b7481,_0x432ac4){if(_0x207b7f){return db[_0xaa9a('0x59')][_0xaa9a('0x56')]({'where':{'sectionId':_0x207b7f['id']},'raw':!![]})[_0xaa9a('0x2a')](function(_0xa83deb){if(_0x4323a3[_0xaa9a('0x7d')]&&_0x4323a3['field']!=='id'){_0x207b7f[_0xaa9a('0x7f')]=_[_0xaa9a('0x30')](_0xa83deb,function(_0xb6b8ff){return _0xb6b8ff[_0x4323a3['field']];});}else{if(_0x51d36b===_0xaa9a('0x7e')){_0x207b7f[_0xaa9a('0x7f')]=_[_0xaa9a('0x30')](_0xa83deb,function(_0x3b9748){return{'id':_0x3b9748['resourceId'],'type':_0x3b9748[_0xaa9a('0x34')]};});}else{_0x207b7f['associatedResources']=_['map'](_0xa83deb,function(_0x28606c){return _0x28606c[_0xaa9a('0x6b')];});}}_0x5b7481(_0x207b7f);})[_0xaa9a('0x5b')](function(_0x16588b){_0x432ac4(_0x16588b);});}else{_0x5b7481(null);}});}function getQueryModels(_0x58f34c,_0x31eb1b){var _0x165585=_0x58f34c[_0xaa9a('0x8d')]();var _0x265ca2={'childModel':undefined,'parentSections':[]};switch(_0x165585){case'squareprojects':_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x8e');break;case'odbc':_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x8f');break;case'squarerecordings':_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x90');_0x265ca2[_0xaa9a('0x77')]=[{'name':_0xaa9a('0x91'),'field':_0xaa9a('0x2d'),'foreignKey':_0xaa9a('0x92')}];break;case _0xaa9a('0x93'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x94');break;case _0xaa9a('0x95'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x87');_0x265ca2['parentSections']=[{'name':_0xaa9a('0x96'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x265ca2['childModel']='CmList';break;case _0xaa9a('0x97'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x98');break;case _0xaa9a('0x99'):_0x265ca2[_0xaa9a('0x75')]='CmCustomField';break;case _0xaa9a('0x9a'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x9b');break;case _0xaa9a('0x9c'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x9d');break;case _0xaa9a('0x9e'):_0x265ca2['childModel']=_0xaa9a('0x9f');break;case _0xaa9a('0xa0'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xa1');break;case _0xaa9a('0xa2'):case _0xaa9a('0xa3'):case'outboundroutes':_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xa4');break;case _0xaa9a('0xa5'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xa6');break;case _0xaa9a('0xa7'):_0x265ca2['childModel']=_0xaa9a('0xa8');break;case'voicerecordings':_0x265ca2[_0xaa9a('0x75')]='VoiceRecording';_0x265ca2['parentSections']=[{'name':_0xaa9a('0xa9'),'field':_0xaa9a('0x2d'),'foreignKey':_0xaa9a('0xaa'),'model':_0xaa9a('0xab'),'filter':{'field':_0xaa9a('0xac'),'value':[_0xaa9a('0xad')]}},{'name':_0xaa9a('0xae'),'field':'name','foreignKey':'membername','model':_0xaa9a('0xab'),'filter':{'field':_0xaa9a('0xac'),'value':['telephone']}},{'name':_0xaa9a('0xaf'),'field':_0xaa9a('0x2d'),'foreignKey':_0xaa9a('0xb0'),'model':_0xaa9a('0xb1'),'filter':{'field':'type','value':['inbound']}},{'name':_0xaa9a('0xb2'),'field':_0xaa9a('0x2d'),'foreignKey':_0xaa9a('0xb0'),'model':_0xaa9a('0xb1'),'filter':{'field':_0xaa9a('0x34'),'value':['outbound']}}];break;case _0xaa9a('0xb3'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xb4');break;case'chanspies':_0x265ca2['childModel']=_0xaa9a('0xb5');break;case _0xaa9a('0xb6'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xb7');break;case _0xaa9a('0xb8'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xb9');break;case _0xaa9a('0xba'):_0x265ca2[_0xaa9a('0x75')]='MailQueue';break;case _0xaa9a('0xbb'):_0x265ca2['childModel']=_0xaa9a('0xbc');break;case _0xaa9a('0xbd'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xbe');break;case'openchannelqueues':_0x265ca2['childModel']=_0xaa9a('0xbf');break;case _0xaa9a('0xc0'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xc1');break;case _0xaa9a('0xc2'):_0x265ca2[_0xaa9a('0x75')]='SmsQueue';break;case _0xaa9a('0xc3'):_0x265ca2['childModel']=_0xaa9a('0xc4');break;case _0xaa9a('0xc5'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xc6');break;case _0xaa9a('0xc7'):_0x265ca2[_0xaa9a('0x75')]='WhatsappAccount';break;case _0xaa9a('0xc8'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xc9');break;case _0xaa9a('0xca'):case'queuecampaigns':_0x265ca2[_0xaa9a('0x75')]='VoiceQueue';if(_0x31eb1b){_0x265ca2[_0xaa9a('0x77')]=[{'name':'VoiceQueues'},{'name':_0xaa9a('0xb2')}];}break;case _0xaa9a('0xcb'):case _0xaa9a('0xcc'):case _0xaa9a('0xcd'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xab');if(_0x31eb1b){_0x265ca2[_0xaa9a('0x77')]=[{'name':_0xaa9a('0xce'),'filter':{'field':_0xaa9a('0xac'),'value':[_0xaa9a('0xcf'),_0xaa9a('0xd0')]},'ignore':!![]},{'name':_0xaa9a('0xa9')},{'name':'Telephones'}];}break;case _0xaa9a('0xd1'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xd2');break;case _0xaa9a('0xd3'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xd4');break;case'freshdeskaccounts':_0x265ca2['childModel']=_0xaa9a('0xd5');break;case _0xaa9a('0xd6'):_0x265ca2['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x265ca2['childModel']=_0xaa9a('0xd7');break;case _0xaa9a('0xd8'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xd9');break;case _0xaa9a('0xda'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xab');break;case _0xaa9a('0xdb'):_0x265ca2[_0xaa9a('0x75')]='CannedAnswer';break;case'dispositions':_0x265ca2['childModel']='Disposition';break;case _0xaa9a('0xdc'):_0x265ca2['childModel']=_0xaa9a('0x69');break;case _0xaa9a('0xdd'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xde');break;case _0xaa9a('0xdf'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xe0');break;case _0xaa9a('0xe1'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xe2');break;case'sounds':_0x265ca2['childModel']=_0xaa9a('0xe3');break;case _0xaa9a('0xe4'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x88');break;case'templates':_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xe5');break;case _0xaa9a('0xe6'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xe7');break;case _0xaa9a('0xe8'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xe9');break;case'variables':_0x265ca2['childModel']=_0xaa9a('0xea');break;case'plugins':_0x265ca2['childModel']=_0xaa9a('0xeb');break;case'extractedreports':_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0x7e');_0x265ca2[_0xaa9a('0x77')]=[{'name':_0xaa9a('0xec'),'field':'id','foreignKey':_0xaa9a('0x83')}];break;case _0xaa9a('0xed'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xee');break;case _0xaa9a('0xc7'):_0x265ca2[_0xaa9a('0x75')]=_0xaa9a('0xef');break;default:return _0x265ca2;}return _0x265ca2;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index b589ccb..f8dba97 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 _0x3c30=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3d8a41,_0x2b0fbe){var _0x28675e=function(_0x222859){while(--_0x222859){_0x3d8a41['push'](_0x3d8a41['shift']());}};_0x28675e(++_0x2b0fbe);}(_0x3c30,0x123));var _0x03c3=function(_0x447f4b,_0x200c74){_0x447f4b=_0x447f4b-0x0;var _0x106797=_0x3c30[_0x447f4b];return _0x106797;};'use strict';var EventEmitter=require(_0x03c3('0x0'));var UserProfile=require(_0x03c3('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x03c3('0x2')](0x0);var events={'afterCreate':_0x03c3('0x3'),'afterUpdate':_0x03c3('0x4'),'afterDestroy':_0x03c3('0x5')};function emitEvent(_0x527cb3){return function(_0x5805dc,_0x1310b4,_0x10ab04){UserProfileEvents[_0x03c3('0x6')](_0x527cb3+':'+_0x5805dc['id'],_0x5805dc);UserProfileEvents[_0x03c3('0x6')](_0x527cb3,_0x5805dc);_0x10ab04(null);};}for(var e in events){if(events[_0x03c3('0x7')](e)){var event=events[e];UserProfile[_0x03c3('0x8')](e,emitEvent(event));}}module[_0x03c3('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x4c2c=['events','../../mysqldb','save','update','emit','exports'];(function(_0x3edc14,_0x52697d){var _0x4c6ec4=function(_0x55b66e){while(--_0x55b66e){_0x3edc14['push'](_0x3edc14['shift']());}};_0x4c6ec4(++_0x52697d);}(_0x4c2c,0x12c));var _0xc4c2=function(_0x34c825,_0x44cad4){_0x34c825=_0x34c825-0x0;var _0x2fde13=_0x4c2c[_0x34c825];return _0x2fde13;};'use strict';var EventEmitter=require(_0xc4c2('0x0'));var UserProfile=require(_0xc4c2('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc4c2('0x2'),'afterUpdate':_0xc4c2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x546b88){return function(_0x21d258,_0x4fc5a3,_0x31190f){UserProfileEvents[_0xc4c2('0x4')](_0x546b88+':'+_0x21d258['id'],_0x21d258);UserProfileEvents[_0xc4c2('0x4')](_0x546b88,_0x21d258);_0x31190f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xc4c2('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 89b0e16..8791477 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 _0x2d23=['exports','UserProfile','user_profiles','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x269c6b,_0x57b26b){var _0x6b5ad0=function(_0xa2c43d){while(--_0xa2c43d){_0x269c6b['push'](_0x269c6b['shift']());}};_0x6b5ad0(++_0x57b26b);}(_0x2d23,0xf6));var _0x32d2=function(_0x43d647,_0x149c0b){_0x43d647=_0x43d647-0x0;var _0x42d7fd=_0x2d23[_0x43d647];return _0x42d7fd;};'use strict';var _=require(_0x32d2('0x0'));var util=require(_0x32d2('0x1'));var logger=require(_0x32d2('0x2'))('api');var moment=require(_0x32d2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32d2('0x4'));var rimraf=require(_0x32d2('0x5'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0x32d2('0x6')]=function(_0x12b57f,_0x1e6c1b){return _0x12b57f['define'](_0x32d2('0x7'),attributes,{'tableName':_0x32d2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b0=['user_profiles','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserProfile'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa7b0,0x18d));var _0x0a7b=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0xa7b0[_0x11fbaa];return _0x1831fd;};'use strict';var _=require('lodash');var util=require(_0x0a7b('0x0'));var logger=require(_0x0a7b('0x1'))(_0x0a7b('0x2'));var moment=require(_0x0a7b('0x3'));var BPromise=require(_0x0a7b('0x4'));var rp=require(_0x0a7b('0x5'));var fs=require('fs');var path=require(_0x0a7b('0x6'));var rimraf=require(_0x0a7b('0x7'));var config=require(_0x0a7b('0x8'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x6e8921,_0x3cfde8){return _0x6e8921[_0x0a7b('0x9')](_0x0a7b('0xa'),attributes,{'tableName':_0x0a7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e57b5d1..355c381 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 _0x6f47=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info'];(function(_0x34ad22,_0x466bc9){var _0x1d3cc4=function(_0x56119e){while(--_0x56119e){_0x34ad22['push'](_0x34ad22['shift']());}};_0x1d3cc4(++_0x466bc9);}(_0x6f47,0xc7));var _0x76f4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x6f47[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});config[_0x76f4('0x9')]=_[_0x76f4('0xa')](config['redis'],{'host':_0x76f4('0xb'),'port':0x18eb});var socket=require(_0x76f4('0xc'))(new Redis(config[_0x76f4('0x9')]));require(_0x76f4('0xd'))[_0x76f4('0xe')](socket);function respondWithRpcPromise(_0x4c6b5c,_0x5367d6,_0x3347ef){return new BPromise(function(_0x18e41a,_0x5af83c){return client['request'](_0x4c6b5c,_0x3347ef)[_0x76f4('0xf')](function(_0x458c22){logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));logger[_0x76f4('0x13')](_0x76f4('0x14'),_0x5367d6,_0x76f4('0x12'),JSON[_0x76f4('0x15')](_0x458c22));if(_0x458c22['error']){if(_0x458c22[_0x76f4('0x16')][_0x76f4('0x17')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x5367d6,_0x458c22['error'][_0x76f4('0x18')]);return _0x5af83c(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);return _0x18e41a(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}else{logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));_0x18e41a(_0x458c22[_0x76f4('0x19')][_0x76f4('0x18')]);}})[_0x76f4('0x1a')](function(_0x397360){logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x397360);_0x5af83c(_0x397360);});});} \ No newline at end of file +var _0xda19=['localhost','register','request','then','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5ce929,_0xc8db55){var _0x49c26a=function(_0x5ead9b){while(--_0x5ead9b){_0x5ce929['push'](_0x5ce929['shift']());}};_0x49c26a(++_0xc8db55);}(_0xda19,0xd5));var _0x9da1=function(_0x11079c,_0x4a55dd){_0x11079c=_0x11079c-0x0;var _0x976240=_0xda19[_0x11079c];return _0x976240;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});config[_0x9da1('0xa')]=_[_0x9da1('0xb')](config[_0x9da1('0xa')],{'host':_0x9da1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')[_0x9da1('0xd')](socket);function respondWithRpcPromise(_0x493d0b,_0x33cfe5,_0x1cca84){return new BPromise(function(_0x3ba3d3,_0x1ab988){return client[_0x9da1('0xe')](_0x493d0b,_0x1cca84)[_0x9da1('0xf')](function(_0x9fd032){logger['info']('UserProfile,\x20%s,\x20%s',_0x33cfe5,_0x9da1('0x10'));logger['debug'](_0x9da1('0x11'),_0x33cfe5,_0x9da1('0x10'),JSON[_0x9da1('0x12')](_0x9fd032));if(_0x9fd032[_0x9da1('0x13')]){if(_0x9fd032['error'][_0x9da1('0x14')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x33cfe5,_0x9fd032[_0x9da1('0x13')]['message']);return _0x1ab988(_0x9fd032[_0x9da1('0x13')][_0x9da1('0x15')]);}logger[_0x9da1('0x13')](_0x9da1('0x16'),_0x33cfe5,_0x9fd032[_0x9da1('0x13')]['message']);return _0x3ba3d3(_0x9fd032[_0x9da1('0x13')][_0x9da1('0x15')]);}else{logger[_0x9da1('0x17')](_0x9da1('0x16'),_0x33cfe5,_0x9da1('0x10'));_0x3ba3d3(_0x9fd032[_0x9da1('0x18')]['message']);}})['catch'](function(_0x17205d){logger[_0x9da1('0x13')](_0x9da1('0x16'),_0x33cfe5,_0x17205d);_0x1ab988(_0x17205d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1568714..e7b2a16 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 _0x774b=['register','userProfile:','save','remove','update','emit','removeListener'];(function(_0x4cf25b,_0x4db139){var _0x3c8701=function(_0x55124c){while(--_0x55124c){_0x4cf25b['push'](_0x4cf25b['shift']());}};_0x3c8701(++_0x4db139);}(_0x774b,0x175));var _0xb774=function(_0x372f34,_0x11e195){_0x372f34=_0x372f34-0x0;var _0x515157=_0x774b[_0x372f34];return _0x515157;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xb774('0x0'),_0xb774('0x1'),_0xb774('0x2')];function createListener(_0x1c7f0f,_0x15a08b){return function(_0x1069d4){_0x15a08b[_0xb774('0x3')](_0x1c7f0f,_0x1069d4);};}function removeListener(_0x1944e1,_0x2e25ef){return function(){UserProfileEvents[_0xb774('0x4')](_0x1944e1,_0x2e25ef);};}exports[_0xb774('0x5')]=function(_0x24be9a){for(var _0x1370d6=0x0,_0x393f73=events['length'];_0x1370d6<_0x393f73;_0x1370d6++){var _0xe352ae=events[_0x1370d6];var _0x22cf04=createListener(_0xb774('0x6')+_0xe352ae,_0x24be9a);UserProfileEvents['on'](_0xe352ae,_0x22cf04);}}; \ No newline at end of file +var _0xcf2a=['update','removeListener','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x56c080,_0x65d517){var _0x491b3a=function(_0x58aa87){while(--_0x58aa87){_0x56c080['push'](_0x56c080['shift']());}};_0x491b3a(++_0x65d517);}(_0xcf2a,0x125));var _0xacf2=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xcf2a[_0x5c3ae9];return _0x3f5950;};'use strict';var UserProfileEvents=require(_0xacf2('0x0'));var events=[_0xacf2('0x1'),_0xacf2('0x2'),_0xacf2('0x3')];function createListener(_0x2c8373,_0x57b152){return function(_0x416060){_0x57b152['emit'](_0x2c8373,_0x416060);};}function removeListener(_0x4884c1,_0x55f045){return function(){UserProfileEvents[_0xacf2('0x4')](_0x4884c1,_0x55f045);};}exports[_0xacf2('0x5')]=function(_0x3cbcb6){for(var _0x166d1c=0x0,_0x1b39af=events[_0xacf2('0x6')];_0x166d1c<_0x1b39af;_0x166d1c++){var _0x5ddcb9=events[_0x166d1c];var _0x407bd3=createListener(_0xacf2('0x7')+_0x5ddcb9,_0x3cbcb6);UserProfileEvents['on'](_0x5ddcb9,_0x407bd3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d552355..5887074 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 _0x315e=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x58a95a,_0x29f374){var _0x404b31=function(_0x28bd8b){while(--_0x28bd8b){_0x58a95a['push'](_0x58a95a['shift']());}};_0x404b31(++_0x29f374);}(_0x315e,0x1dd));var _0xe315=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x315e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe315('0x0'));var util=require(_0xe315('0x1'));var path=require(_0xe315('0x2'));var timeout=require('connect-timeout');var express=require(_0xe315('0x3'));var router=express[_0xe315('0x4')]();var auth=require(_0xe315('0x5'));var interaction=require(_0xe315('0x6'));var config=require(_0xe315('0x7'));var controller=require(_0xe315('0x8'));router[_0xe315('0x9')]('/',auth[_0xe315('0xa')](),controller['index']);router[_0xe315('0x9')](_0xe315('0xb'),auth[_0xe315('0xa')](),controller[_0xe315('0xc')]);router[_0xe315('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe315('0xd')]);router[_0xe315('0xe')]('/',auth[_0xe315('0xa')](),controller[_0xe315('0xf')]);router[_0xe315('0x10')]('/:id',auth[_0xe315('0xa')](),controller[_0xe315('0x11')]);router[_0xe315('0x12')](_0xe315('0x13'),auth['isAuthenticated'](),controller[_0xe315('0x14')]);module[_0xe315('0x15')]=router; \ No newline at end of file +var _0xd4a2=['put','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x3612f8,_0x54a8c7){var _0x9a4cb6=function(_0x20e8f2){while(--_0x20e8f2){_0x3612f8['push'](_0x3612f8['shift']());}};_0x9a4cb6(++_0x54a8c7);}(_0xd4a2,0x173));var _0x2d4a=function(_0x324a0d,_0x2111c0){_0x324a0d=_0x324a0d-0x0;var _0x1920f9=_0xd4a2[_0x324a0d];return _0x1920f9;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x2d4a('0x3'));var config=require('../../config/environment');var controller=require(_0x2d4a('0x4'));router[_0x2d4a('0x5')]('/',auth[_0x2d4a('0x6')](),controller[_0x2d4a('0x7')]);router[_0x2d4a('0x5')]('/describe',auth[_0x2d4a('0x6')](),controller[_0x2d4a('0x8')]);router[_0x2d4a('0x5')](_0x2d4a('0x9'),auth[_0x2d4a('0x6')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x6')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x6')](),controller['update']);router['delete'](_0x2d4a('0x9'),auth['isAuthenticated'](),controller[_0x2d4a('0xe')]);module[_0x2d4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 56dd95c..d11621b 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 _0x13e2=['INTEGER'];(function(_0x5e41f0,_0x2bcb2b){var _0xb7ef79=function(_0x99d258){while(--_0x99d258){_0x5e41f0['push'](_0x5e41f0['shift']());}};_0xb7ef79(++_0x2bcb2b);}(_0x13e2,0x134));var _0x213e=function(_0x2d7400,_0x309206){_0x2d7400=_0x2d7400-0x0;var _0x3ba657=_0x13e2[_0x2d7400];return _0x3ba657;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x213e('0x0')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9e87=['STRING','INTEGER','sequelize'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x9e87,0xe9));var _0x79e8=function(_0x2ae2cd,_0xb42c96){_0x2ae2cd=_0x2ae2cd-0x0;var _0xc52725=_0x9e87[_0x2ae2cd];return _0xc52725;};'use strict';var Sequelize=require(_0x79e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x79e8('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x79e8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79e8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 854790f..11b9d33 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 _0x55ca=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','UserProfileResource','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring'];(function(_0x3e6dd4,_0x4de182){var _0x45270c=function(_0x3654b4){while(--_0x3654b4){_0x3e6dd4['push'](_0x3e6dd4['shift']());}};_0x45270c(++_0x4de182);}(_0x55ca,0x126));var _0xa55c=function(_0x5cc556,_0x158710){_0x5cc556=_0x5cc556-0x0;var _0x12103b=_0x55ca[_0x5cc556];return _0x12103b;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=_0x3ccf65[_0xa55c('0x1a')],_0x25934f=_0x4e0b2f[_0xa55c('0x1b')],_0x31e10d=_0x4e0b2f[_0xa55c('0x1b')]+_0x4e0b2f[_0xa55c('0x1c')],_0x1c4cfd;if(_0x31e10d>=_0x3dcf4f){_0x31e10d=_0x3dcf4f;_0x1c4cfd=0xc8;}else{_0x1c4cfd=0xce;}_0x247e77['status'](_0x1c4cfd);return _0x247e77[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x25934f+'-'+_0x31e10d+'/'+_0x3dcf4f)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x358b61){return function(_0x23a1ae){try{jsonpatch[_0xa55c('0x1f')](_0x23a1ae,_0x358b61,!![]);}catch(_0x4c0daf){return BPromise['reject'](_0x4c0daf);}return _0x23a1ae[_0xa55c('0x20')]();};}function saveUpdates(_0x3776ac,_0xade4c4){return function(_0x4cfe10){if(_0x4cfe10){return _0x4cfe10[_0xa55c('0x21')](_0x3776ac)[_0xa55c('0x22')](function(_0x54945a){return _0x54945a;});}return null;};}function removeEntity(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x23')]()[_0xa55c('0x22')](function(){_0x187a87['status'](0xcc)[_0xa55c('0x24')]();});}};}function handleEntityNotFound(_0x504c24,_0x5ba836){return function(_0x59d89a){if(!_0x59d89a){_0x504c24[_0xa55c('0x25')](0x194);}return _0x59d89a;};}function handleError(_0x54b038,_0x3ecbe7){_0x3ecbe7=_0x3ecbe7||0x1f4;return function(_0x190757){logger[_0xa55c('0x26')](_0x190757[_0xa55c('0x27')]);if(_0x190757[_0xa55c('0x28')]){delete _0x190757[_0xa55c('0x28')];}_0x54b038[_0xa55c('0x18')](_0x3ecbe7)[_0xa55c('0x29')](_0x190757);};}exports[_0xa55c('0x2a')]=function(_0x3cd152,_0x1273d7){var _0x57f271={},_0x430d55={},_0x28814f={'count':0x0,'rows':[]};var _0x1c9f6b=_[_0xa55c('0x2b')](db['UserProfileResource'][_0xa55c('0x2c')],function(_0x22f6b6){return{'name':_0x22f6b6[_0xa55c('0x2d')],'type':_0x22f6b6[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x430d55[_0xa55c('0x30')]=_['map'](_0x1c9f6b,_0xa55c('0x28'));_0x430d55['query']=_[_0xa55c('0x31')](_0x3cd152[_0xa55c('0x32')]);_0x430d55[_0xa55c('0x33')]=_[_0xa55c('0x34')](_0x430d55['model'],_0x430d55[_0xa55c('0x32')]);_0x57f271[_0xa55c('0x35')]=_[_0xa55c('0x34')](_0x430d55[_0xa55c('0x30')],qs[_0xa55c('0x36')](_0x3cd152[_0xa55c('0x32')][_0xa55c('0x36')]));_0x57f271[_0xa55c('0x35')]=_0x57f271[_0xa55c('0x35')][_0xa55c('0x37')]?_0x57f271[_0xa55c('0x35')]:_0x430d55['model'];if(!_0x3cd152['query'][_0xa55c('0x38')](_0xa55c('0x39'))){_0x57f271['limit']=qs[_0xa55c('0x1c')](_0x3cd152[_0xa55c('0x32')][_0xa55c('0x1c')]);_0x57f271[_0xa55c('0x1b')]=qs[_0xa55c('0x1b')](_0x3cd152[_0xa55c('0x32')][_0xa55c('0x1b')]);}_0x57f271[_0xa55c('0x3a')]=qs[_0xa55c('0x3b')](_0x3cd152['query']['sort']);_0x57f271['where']=qs[_0xa55c('0x33')](_[_0xa55c('0x3c')](_0x3cd152[_0xa55c('0x32')],_0x430d55['filters']),_0x1c9f6b);if(_0x3cd152[_0xa55c('0x32')]['filter']){_0x57f271[_0xa55c('0x3d')]=_['merge'](_0x57f271[_0xa55c('0x3d')],{'$or':_[_0xa55c('0x2b')](_0x1c9f6b,function(_0x3c0ec1){if(_0x3c0ec1['type']!==_0xa55c('0x3e')){var _0x30f23b={};_0x30f23b[_0x3c0ec1['name']]={'$like':'%'+_0x3cd152[_0xa55c('0x32')][_0xa55c('0x3f')]+'%'};return _0x30f23b;}})});}_0x57f271=_['merge']({},_0x57f271,_0x3cd152['options']);var _0x235f6b={'where':_0x57f271['where']};return db[_0xa55c('0x40')][_0xa55c('0x1a')](_0x235f6b)['then'](function(_0x542d76){_0x28814f['count']=_0x542d76;if(_0x3cd152['query'][_0xa55c('0x41')]){_0x57f271[_0xa55c('0x42')]=[{'all':!![]}];}return db[_0xa55c('0x40')][_0xa55c('0x43')](_0x57f271);})[_0xa55c('0x22')](function(_0x56d17c){_0x28814f[_0xa55c('0x44')]=_0x56d17c;return _0x28814f;})[_0xa55c('0x22')](respondWithFilteredResult(_0x1273d7,_0x57f271))[_0xa55c('0x45')](handleError(_0x1273d7,null));};exports[_0xa55c('0x46')]=function(_0x43bac0,_0x23cef5){var _0x554620={'raw':![],'where':{'id':_0x43bac0['params']['id']}},_0x386e34={};_0x386e34['model']=_[_0xa55c('0x31')](db[_0xa55c('0x40')]['rawAttributes']);_0x386e34[_0xa55c('0x32')]=_['keys'](_0x43bac0['query']);_0x386e34[_0xa55c('0x33')]=_[_0xa55c('0x34')](_0x386e34[_0xa55c('0x30')],_0x386e34['query']);_0x554620[_0xa55c('0x35')]=_[_0xa55c('0x34')](_0x386e34['model'],qs[_0xa55c('0x36')](_0x43bac0['query'][_0xa55c('0x36')]));_0x554620[_0xa55c('0x35')]=_0x554620['attributes'][_0xa55c('0x37')]?_0x554620[_0xa55c('0x35')]:_0x386e34['model'];if(_0x43bac0[_0xa55c('0x32')][_0xa55c('0x41')]){_0x554620[_0xa55c('0x42')]=[{'all':!![]}];}_0x554620=_['merge']({},_0x554620,_0x43bac0[_0xa55c('0x47')]);return db['UserProfileResource'][_0xa55c('0x48')](_0x554620)[_0xa55c('0x22')](handleEntityNotFound(_0x23cef5,null))[_0xa55c('0x22')](respondWithResult(_0x23cef5,null))['catch'](handleError(_0x23cef5,null));};exports[_0xa55c('0x49')]=function(_0x106adb,_0x592429){return db[_0xa55c('0x40')][_0xa55c('0x49')](_0x106adb['body'],{})[_0xa55c('0x22')](respondWithResult(_0x592429,0xc9))[_0xa55c('0x45')](handleError(_0x592429,null));};exports['update']=function(_0x46f839,_0x81cee8){if(_0x46f839[_0xa55c('0x4a')]['id']){delete _0x46f839[_0xa55c('0x4a')]['id'];}return db['UserProfileResource'][_0xa55c('0x48')]({'where':{'id':_0x46f839['params']['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x81cee8,null))[_0xa55c('0x22')](saveUpdates(_0x46f839[_0xa55c('0x4a')],null))['then'](respondWithResult(_0x81cee8,null))[_0xa55c('0x45')](handleError(_0x81cee8,null));};exports[_0xa55c('0x23')]=function(_0x574fe9,_0x5be06){return db[_0xa55c('0x40')][_0xa55c('0x48')]({'where':{'id':_0x574fe9[_0xa55c('0x4b')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x5be06,null))[_0xa55c('0x22')](removeEntity(_0x5be06,null))[_0xa55c('0x45')](handleError(_0x5be06,null));};exports[_0xa55c('0x4c')]=function(_0x3c147b,_0x3376a1){return db['UserProfileResource'][_0xa55c('0x4c')]()[_0xa55c('0x22')](respondWithResult(_0x3376a1,null))[_0xa55c('0x45')](handleError(_0x3376a1,null));}; \ No newline at end of file +var _0x814b=['../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','UserProfileResource','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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/license/util'];(function(_0x132d12,_0x1a5eeb){var _0xf22821=function(_0x1fd116){while(--_0x1fd116){_0x132d12['push'](_0x132d12['shift']());}};_0xf22821(++_0x1a5eeb);}(_0x814b,0x1a2));var _0xb814=function(_0x21c068,_0x369d6a){_0x21c068=_0x21c068-0x0;var _0x5cf199=_0x814b[_0x21c068];return _0x5cf199;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){_0x3b267e['status'](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(!_0x457dac){_0x52b7a3[_0xb814('0x1b')](0x194);}return _0x457dac;};}function handleError(_0x208927,_0x1c8a2e){_0x1c8a2e=_0x1c8a2e||0x1f4;return function(_0xb9e57d){logger[_0xb814('0x26')](_0xb9e57d['stack']);if(_0xb9e57d[_0xb814('0x27')]){delete _0xb9e57d[_0xb814('0x27')];}_0x208927[_0xb814('0x1c')](_0x1c8a2e)[_0xb814('0x28')](_0xb9e57d);};}exports[_0xb814('0x29')]=function(_0x1d5965,_0x3f0150){var _0x1e4e89={},_0x5a6291={},_0x271aa8={'count':0x0,'rows':[]};var _0x328a08=_['map'](db[_0xb814('0x2a')][_0xb814('0x2b')],function(_0x530744){return{'name':_0x530744['fieldName'],'type':_0x530744[_0xb814('0x2c')][_0xb814('0x2d')]};});_0x5a6291['model']=_[_0xb814('0x2e')](_0x328a08,'name');_0x5a6291[_0xb814('0x2f')]=_['keys'](_0x1d5965['query']);_0x5a6291[_0xb814('0x30')]=_['intersection'](_0x5a6291[_0xb814('0x31')],_0x5a6291[_0xb814('0x2f')]);_0x1e4e89[_0xb814('0x32')]=_['intersection'](_0x5a6291['model'],qs[_0xb814('0x33')](_0x1d5965[_0xb814('0x2f')]['fields']));_0x1e4e89[_0xb814('0x32')]=_0x1e4e89[_0xb814('0x32')][_0xb814('0x34')]?_0x1e4e89[_0xb814('0x32')]:_0x5a6291[_0xb814('0x31')];if(!_0x1d5965[_0xb814('0x2f')][_0xb814('0x35')]('nolimit')){_0x1e4e89[_0xb814('0x36')]=qs[_0xb814('0x36')](_0x1d5965[_0xb814('0x2f')][_0xb814('0x36')]);_0x1e4e89[_0xb814('0x20')]=qs['offset'](_0x1d5965[_0xb814('0x2f')]['offset']);}_0x1e4e89[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x1d5965[_0xb814('0x2f')]['sort']);_0x1e4e89[_0xb814('0x39')]=qs[_0xb814('0x30')](_['pick'](_0x1d5965[_0xb814('0x2f')],_0x5a6291[_0xb814('0x30')]),_0x328a08);if(_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]){_0x1e4e89[_0xb814('0x39')]=_[_0xb814('0x3b')](_0x1e4e89['where'],{'$or':_[_0xb814('0x2e')](_0x328a08,function(_0x4e4684){if(_0x4e4684[_0xb814('0x2c')]!=='VIRTUAL'){var _0x4492ef={};_0x4492ef[_0x4e4684['name']]={'$like':'%'+_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]+'%'};return _0x4492ef;}})});}_0x1e4e89=_['merge']({},_0x1e4e89,_0x1d5965['options']);var _0x5dd6bc={'where':_0x1e4e89['where']};return db[_0xb814('0x2a')][_0xb814('0x1f')](_0x5dd6bc)[_0xb814('0x24')](function(_0x42c2ed){_0x271aa8['count']=_0x42c2ed;if(_0x1d5965['query'][_0xb814('0x3c')]){_0x1e4e89['include']=[{'all':!![]}];}return db[_0xb814('0x2a')][_0xb814('0x3d')](_0x1e4e89);})[_0xb814('0x24')](function(_0x3063bf){_0x271aa8[_0xb814('0x3e')]=_0x3063bf;return _0x271aa8;})[_0xb814('0x24')](respondWithFilteredResult(_0x3f0150,_0x1e4e89))[_0xb814('0x3f')](handleError(_0x3f0150,null));};exports[_0xb814('0x40')]=function(_0x31989d,_0x4b6ff8){var _0x544d36={'raw':![],'where':{'id':_0x31989d[_0xb814('0x41')]['id']}},_0x5d26be={};_0x5d26be['model']=_[_0xb814('0x42')](db['UserProfileResource'][_0xb814('0x2b')]);_0x5d26be[_0xb814('0x2f')]=_[_0xb814('0x42')](_0x31989d[_0xb814('0x2f')]);_0x5d26be['filters']=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],_0x5d26be[_0xb814('0x2f')]);_0x544d36[_0xb814('0x32')]=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],qs['fields'](_0x31989d[_0xb814('0x2f')][_0xb814('0x33')]));_0x544d36[_0xb814('0x32')]=_0x544d36[_0xb814('0x32')][_0xb814('0x34')]?_0x544d36[_0xb814('0x32')]:_0x5d26be[_0xb814('0x31')];if(_0x31989d['query']['includeAll']){_0x544d36[_0xb814('0x44')]=[{'all':!![]}];}_0x544d36=_[_0xb814('0x3b')]({},_0x544d36,_0x31989d[_0xb814('0x45')]);return db[_0xb814('0x2a')][_0xb814('0x46')](_0x544d36)[_0xb814('0x24')](handleEntityNotFound(_0x4b6ff8,null))[_0xb814('0x24')](respondWithResult(_0x4b6ff8,null))[_0xb814('0x3f')](handleError(_0x4b6ff8,null));};exports[_0xb814('0x47')]=function(_0x344198,_0xe73300){return db['UserProfileResource'][_0xb814('0x47')](_0x344198[_0xb814('0x48')],{})['then'](respondWithResult(_0xe73300,0xc9))[_0xb814('0x3f')](handleError(_0xe73300,null));};exports['update']=function(_0x2fb0f7,_0x37866f){if(_0x2fb0f7[_0xb814('0x48')]['id']){delete _0x2fb0f7[_0xb814('0x48')]['id'];}return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x2fb0f7[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x37866f,null))[_0xb814('0x24')](saveUpdates(_0x2fb0f7[_0xb814('0x48')],null))['then'](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x25')]=function(_0x30f07b,_0x4156d8){return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x30f07b[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x4156d8,null))['then'](removeEntity(_0x4156d8,null))[_0xb814('0x3f')](handleError(_0x4156d8,null));};exports[_0xb814('0x49')]=function(_0xf27a6e,_0x5a916d){return db[_0xb814('0x2a')]['describe']()[_0xb814('0x24')](respondWithResult(_0x5a916d,null))['catch'](handleError(_0x5a916d,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index cab931c..ab7a4d6 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 _0x4266=['define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x2c7e8f,_0x2af4bb){var _0x4776d1=function(_0x3128d5){while(--_0x3128d5){_0x2c7e8f['push'](_0x2c7e8f['shift']());}};_0x4776d1(++_0x2af4bb);}(_0x4266,0x10f));var _0x6426=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4266[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x6426('0x0'));var util=require(_0x6426('0x1'));var logger=require(_0x6426('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6426('0x3'));var rp=require(_0x6426('0x4'));var fs=require('fs');var path=require(_0x6426('0x5'));var rimraf=require('rimraf');var config=require(_0x6426('0x6'));var attributes=require(_0x6426('0x7'));module[_0x6426('0x8')]=function(_0x3f88fa,_0x227662){return _0x3f88fa[_0x6426('0x9')](_0x6426('0xa'),attributes,{'tableName':_0x6426('0xb'),'paranoid':![],'indexes':[{'name':_0x6426('0xc'),'fields':['resourceId',_0x6426('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50cd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserProfileResource','compositeIndex','resourceId','lodash','util','../../config/logger','api'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x50cd,0xdc));var _0xd50c=function(_0x5d283b,_0x14d1de){_0x5d283b=_0x5d283b-0x0;var _0x3a7d42=_0x50cd[_0x5d283b];return _0x3a7d42;};'use strict';var _=require(_0xd50c('0x0'));var util=require(_0xd50c('0x1'));var logger=require(_0xd50c('0x2'))(_0xd50c('0x3'));var moment=require(_0xd50c('0x4'));var BPromise=require(_0xd50c('0x5'));var rp=require(_0xd50c('0x6'));var fs=require('fs');var path=require(_0xd50c('0x7'));var rimraf=require(_0xd50c('0x8'));var config=require(_0xd50c('0x9'));var attributes=require('./userProfileResource.attributes');module[_0xd50c('0xa')]=function(_0x12215b,_0x51bdfb){return _0x12215b['define'](_0xd50c('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xd50c('0xc'),'fields':[_0xd50c('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4c26934..4b7bc12 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 _0x57a9=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x4f8d6c,_0x3a3979){var _0x31651d=function(_0x3ca240){while(--_0x3ca240){_0x4f8d6c['push'](_0x4f8d6c['shift']());}};_0x31651d(++_0x3a3979);}(_0x57a9,0x176));var _0x957a=function(_0x193a97,_0x534612){_0x193a97=_0x193a97-0x0;var _0x3a3b19=_0x57a9[_0x193a97];return _0x3a3b19;};'use strict';var _=require(_0x957a('0x0'));var util=require(_0x957a('0x1'));var moment=require('moment');var BPromise=require(_0x957a('0x2'));var rs=require(_0x957a('0x3'));var fs=require('fs');var Redis=require(_0x957a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x957a('0x5'));var logger=require(_0x957a('0x6'))(_0x957a('0x7'));var config=require(_0x957a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x957a('0x9')][_0x957a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a46e8,_0x57ec20,_0x54b074){return new BPromise(function(_0x2661f6,_0x2599c6){return client[_0x957a('0xb')](_0x3a46e8,_0x54b074)['then'](function(_0x7fd0a7){logger[_0x957a('0xc')](_0x957a('0xd'),_0x57ec20,_0x957a('0xe'));logger[_0x957a('0xf')](_0x957a('0x10'),_0x57ec20,'request\x20sent',JSON['stringify'](_0x7fd0a7));if(_0x7fd0a7[_0x957a('0x11')]){if(_0x7fd0a7[_0x957a('0x11')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x57ec20,_0x7fd0a7[_0x957a('0x11')][_0x957a('0x12')]);return _0x2599c6(_0x7fd0a7[_0x957a('0x11')][_0x957a('0x12')]);}logger[_0x957a('0x11')](_0x957a('0xd'),_0x57ec20,_0x7fd0a7['error'][_0x957a('0x12')]);return _0x2661f6(_0x7fd0a7[_0x957a('0x11')][_0x957a('0x12')]);}else{logger[_0x957a('0xc')](_0x957a('0xd'),_0x57ec20,_0x957a('0xe'));_0x2661f6(_0x7fd0a7[_0x957a('0x13')][_0x957a('0x12')]);}})[_0x957a('0x14')](function(_0x5d96c6){logger[_0x957a('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x57ec20,_0x5d96c6);_0x2599c6(_0x5d96c6);});});} \ No newline at end of file +var _0x629c=['error','message','info','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','debug','stringify'];(function(_0x585a24,_0x1de8a0){var _0x1d2bed=function(_0x26317c){while(--_0x26317c){_0x585a24['push'](_0x585a24['shift']());}};_0x1d2bed(++_0x1de8a0);}(_0x629c,0x15c));var _0xc629=function(_0x4e2db7,_0x32a61a){_0x4e2db7=_0x4e2db7-0x0;var _0x20f23a=_0x629c[_0x4e2db7];return _0x20f23a;};'use strict';var _=require('lodash');var util=require(_0xc629('0x0'));var moment=require(_0xc629('0x1'));var BPromise=require(_0xc629('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc629('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc629('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc629('0x5'));var jayson=require(_0xc629('0x6'));var client=jayson[_0xc629('0x7')][_0xc629('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x203124,_0x1c3269,_0x3d33cd){return new BPromise(function(_0x5a7ff9,_0x21c9b1){return client['request'](_0x203124,_0x3d33cd)[_0xc629('0x9')](function(_0x1a3349){logger['info'](_0xc629('0xa'),_0x1c3269,'request\x20sent');logger[_0xc629('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1c3269,'request\x20sent',JSON[_0xc629('0xc')](_0x1a3349));if(_0x1a3349[_0xc629('0xd')]){if(_0x1a3349[_0xc629('0xd')]['code']===0x1f4){logger[_0xc629('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x1c3269,_0x1a3349[_0xc629('0xd')][_0xc629('0xe')]);return _0x21c9b1(_0x1a3349[_0xc629('0xd')]['message']);}logger['error'](_0xc629('0xa'),_0x1c3269,_0x1a3349[_0xc629('0xd')][_0xc629('0xe')]);return _0x5a7ff9(_0x1a3349[_0xc629('0xd')][_0xc629('0xe')]);}else{logger[_0xc629('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x1c3269,_0xc629('0x10'));_0x5a7ff9(_0x1a3349[_0xc629('0x11')][_0xc629('0xe')]);}})[_0xc629('0x12')](function(_0x22fb9f){logger[_0xc629('0xd')](_0xc629('0xa'),_0x1c3269,_0x22fb9f);_0x21c9b1(_0x22fb9f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index bde10a9..920547b 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 _0x39d7=['post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x31948b,_0x384064){var _0x4f711b=function(_0x131e20){while(--_0x131e20){_0x31948b['push'](_0x31948b['shift']());}};_0x4f711b(++_0x384064);}(_0x39d7,0xa6));var _0x739d=function(_0x2e4b12,_0x1d2450){_0x2e4b12=_0x2e4b12-0x0;var _0x261964=_0x39d7[_0x2e4b12];return _0x261964;};'use strict';var multer=require('multer');var util=require(_0x739d('0x0'));var path=require(_0x739d('0x1'));var timeout=require(_0x739d('0x2'));var express=require('express');var router=express[_0x739d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x739d('0x4'));var config=require(_0x739d('0x5'));var controller=require(_0x739d('0x6'));router[_0x739d('0x7')]('/',auth[_0x739d('0x8')](),controller[_0x739d('0x9')]);router['get'](_0x739d('0xa'),auth[_0x739d('0x8')](),controller[_0x739d('0xb')]);router[_0x739d('0x7')](_0x739d('0xc'),auth[_0x739d('0x8')](),controller[_0x739d('0xd')]);router[_0x739d('0xe')]('/',auth[_0x739d('0x8')](),controller['create']);router[_0x739d('0xf')](_0x739d('0xc'),auth[_0x739d('0x8')](),controller[_0x739d('0x10')]);router[_0x739d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x739d('0x12')]);module[_0x739d('0x13')]=router; \ No newline at end of file +var _0x4c3c=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x4db22b,_0x30003f){var _0x534552=function(_0x40a463){while(--_0x40a463){_0x4db22b['push'](_0x4db22b['shift']());}};_0x534552(++_0x30003f);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x3f7762,_0x4f539c){_0x3f7762=_0x3f7762-0x0;var _0x4ab977=_0x4c3c[_0x3f7762];return _0x4ab977;};'use strict';var multer=require(_0xc4c3('0x0'));var util=require(_0xc4c3('0x1'));var path=require('path');var timeout=require(_0xc4c3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xc4c3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc4c3('0x4'));router[_0xc4c3('0x5')]('/',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x7')]);router[_0xc4c3('0x5')](_0xc4c3('0x8'),auth[_0xc4c3('0x6')](),controller['describe']);router[_0xc4c3('0x5')](_0xc4c3('0x9'),auth['isAuthenticated'](),controller[_0xc4c3('0xa')]);router[_0xc4c3('0xb')]('/',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0xc')]);router[_0xc4c3('0xd')](_0xc4c3('0x9'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0xe')]);router[_0xc4c3('0xf')](_0xc4c3('0x9'),auth['isAuthenticated'](),controller[_0xc4c3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 73d24ff..c9c6ae7 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 _0xc9b7=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0x313c12,_0x505c0d){var _0x8e626b=function(_0x45b3ca){while(--_0x45b3ca){_0x313c12['push'](_0x313c12['shift']());}};_0x8e626b(++_0x505c0d);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x58bec1,_0x42c53f){_0x58bec1=_0x58bec1-0x0;var _0x16439f=_0xc9b7[_0x58bec1];return _0x16439f;};'use strict';var Sequelize=require(_0x7c9b('0x0'));module[_0x7c9b('0x1')]={'name':{'type':Sequelize[_0x7c9b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x7c9b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x474486){this[_0x7c9b('0x4')](_0x7c9b('0x5'),_0x474486?_0x474486[_0x7c9b('0x6')](''):[]);},'get':function(){return this[_0x7c9b('0x7')](_0x7c9b('0x5'))?this[_0x7c9b('0x7')](_0x7c9b('0x5'))[_0x7c9b('0x8')](''):[];}}}; \ No newline at end of file +var _0x6ede=['BOOLEAN','crudPermissions','join','getDataValue','split','STRING'];(function(_0x2dd1f,_0x128d69){var _0x377c53=function(_0x5316ae){while(--_0x5316ae){_0x2dd1f['push'](_0x2dd1f['shift']());}};_0x377c53(++_0x128d69);}(_0x6ede,0x83));var _0xe6ed=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x6ede[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xe6ed('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xe6ed('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe6ed('0x1')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x310aa8){this['setDataValue'](_0xe6ed('0x2'),_0x310aa8?_0x310aa8[_0xe6ed('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xe6ed('0x2'))?this[_0xe6ed('0x4')](_0xe6ed('0x2'))[_0xe6ed('0x5')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1fd55a9..083a057 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 _0x4547=['name','send','index','map','UserProfileSection','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','include','findAll','rows','then','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','error','stack'];(function(_0x53ad32,_0x1dfb0a){var _0x2da5ba=function(_0xa01942){while(--_0xa01942){_0x53ad32['push'](_0x53ad32['shift']());}};_0x2da5ba(++_0x1dfb0a);}(_0x4547,0x1e6));var _0x7454=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x4547[_0x1c5142];return _0x1268cb;};'use strict';var pdf=require(_0x7454('0x0'));var emlformat=require(_0x7454('0x1'));var rimraf=require(_0x7454('0x2'));var zipdir=require(_0x7454('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7454('0x4'));var moment=require(_0x7454('0x5'));var BPromise=require(_0x7454('0x6'));var Mustache=require(_0x7454('0x7'));var util=require(_0x7454('0x8'));var path=require(_0x7454('0x9'));var sox=require(_0x7454('0xa'));var csv=require(_0x7454('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7454('0xc'));var squel=require(_0x7454('0xd'));var crypto=require(_0x7454('0xe'));var jsforce=require(_0x7454('0xf'));var deskjs=require(_0x7454('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7454('0x11'));var Redis=require(_0x7454('0x12'));var authService=require(_0x7454('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7454('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7454('0x15'))(_0x7454('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7454('0x17'))['db'];function respondWithStatusCode(_0x38fb0a,_0x2ca352){_0x2ca352=_0x2ca352||0xcc;return function(_0x405826){if(_0x405826){return _0x38fb0a[_0x7454('0x18')](_0x2ca352);}return _0x38fb0a[_0x7454('0x19')](_0x2ca352)[_0x7454('0x1a')]();};}function respondWithResult(_0x523345,_0x26d0e3){_0x26d0e3=_0x26d0e3||0xc8;return function(_0x4876c5){if(_0x4876c5){return _0x523345[_0x7454('0x19')](_0x26d0e3)['json'](_0x4876c5);}};}function respondWithFilteredResult(_0x441575,_0x43916a){return function(_0x1b7184){if(_0x1b7184){var _0x5e3e01=_0x1b7184[_0x7454('0x1b')],_0x46af82=_0x43916a[_0x7454('0x1c')],_0x58ac19=_0x43916a['offset']+_0x43916a[_0x7454('0x1d')],_0xd3968c;if(_0x58ac19>=_0x5e3e01){_0x58ac19=_0x5e3e01;_0xd3968c=0xc8;}else{_0xd3968c=0xce;}_0x441575[_0x7454('0x19')](_0xd3968c);return _0x441575['set'](_0x7454('0x1e'),_0x46af82+'-'+_0x58ac19+'/'+_0x5e3e01)[_0x7454('0x1f')](_0x1b7184);}return null;};}function patchUpdates(_0x5cad82){return function(_0x4ca73e){try{jsonpatch[_0x7454('0x20')](_0x4ca73e,_0x5cad82,!![]);}catch(_0x4a203a){return BPromise[_0x7454('0x21')](_0x4a203a);}return _0x4ca73e[_0x7454('0x22')]();};}function saveUpdates(_0xcd492a,_0xe0cb22){return function(_0x2518b0){if(_0x2518b0){return _0x2518b0[_0x7454('0x23')](_0xcd492a)['then'](function(_0x53db06){return _0x53db06;});}return null;};}function removeEntity(_0x2e6bf5,_0xdece3f){return function(_0x35f75e){if(_0x35f75e){return _0x35f75e[_0x7454('0x24')]()['then'](function(){_0x2e6bf5[_0x7454('0x19')](0xcc)[_0x7454('0x1a')]();});}};}function handleEntityNotFound(_0x322677,_0x148b54){return function(_0x1609b5){if(!_0x1609b5){_0x322677[_0x7454('0x18')](0x194);}return _0x1609b5;};}function handleError(_0x41e262,_0x4d39f5){_0x4d39f5=_0x4d39f5||0x1f4;return function(_0x36633e){logger[_0x7454('0x25')](_0x36633e[_0x7454('0x26')]);if(_0x36633e[_0x7454('0x27')]){delete _0x36633e[_0x7454('0x27')];}_0x41e262[_0x7454('0x19')](_0x4d39f5)[_0x7454('0x28')](_0x36633e);};}exports[_0x7454('0x29')]=function(_0x543296,_0x30627a){var _0x194e30={},_0x304c38={},_0x583c8c={'count':0x0,'rows':[]};var _0x4c9594=_[_0x7454('0x2a')](db[_0x7454('0x2b')]['rawAttributes'],function(_0x189de6){return{'name':_0x189de6['fieldName'],'type':_0x189de6[_0x7454('0x2c')][_0x7454('0x2d')]};});_0x304c38['model']=_[_0x7454('0x2a')](_0x4c9594,_0x7454('0x27'));_0x304c38[_0x7454('0x2e')]=_[_0x7454('0x2f')](_0x543296[_0x7454('0x2e')]);_0x304c38['filters']=_['intersection'](_0x304c38[_0x7454('0x30')],_0x304c38[_0x7454('0x2e')]);_0x194e30['attributes']=_[_0x7454('0x31')](_0x304c38[_0x7454('0x30')],qs[_0x7454('0x32')](_0x543296['query'][_0x7454('0x32')]));_0x194e30[_0x7454('0x33')]=_0x194e30[_0x7454('0x33')][_0x7454('0x34')]?_0x194e30[_0x7454('0x33')]:_0x304c38[_0x7454('0x30')];if(!_0x543296['query'][_0x7454('0x35')](_0x7454('0x36'))){_0x194e30[_0x7454('0x1d')]=qs['limit'](_0x543296[_0x7454('0x2e')][_0x7454('0x1d')]);_0x194e30[_0x7454('0x1c')]=qs['offset'](_0x543296[_0x7454('0x2e')][_0x7454('0x1c')]);}_0x194e30[_0x7454('0x37')]=qs['sort'](_0x543296[_0x7454('0x2e')][_0x7454('0x38')]);_0x194e30['where']=qs[_0x7454('0x39')](_[_0x7454('0x3a')](_0x543296[_0x7454('0x2e')],_0x304c38[_0x7454('0x39')]),_0x4c9594);if(_0x543296['query']['filter']){_0x194e30[_0x7454('0x3b')]=_[_0x7454('0x3c')](_0x194e30[_0x7454('0x3b')],{'$or':_[_0x7454('0x2a')](_0x4c9594,function(_0x3935aa){if(_0x3935aa[_0x7454('0x2c')]!==_0x7454('0x3d')){var _0x345b6b={};_0x345b6b[_0x3935aa[_0x7454('0x27')]]={'$like':'%'+_0x543296['query']['filter']+'%'};return _0x345b6b;}})});}_0x194e30=_['merge']({},_0x194e30,_0x543296[_0x7454('0x3e')]);var _0x38b811={'where':_0x194e30['where']};return db[_0x7454('0x2b')][_0x7454('0x1b')](_0x38b811)['then'](function(_0x2975a9){_0x583c8c[_0x7454('0x1b')]=_0x2975a9;if(_0x543296['query']['includeAll']){_0x194e30[_0x7454('0x3f')]=[{'all':!![]}];}return db[_0x7454('0x2b')][_0x7454('0x40')](_0x194e30);})['then'](function(_0x38ad47){_0x583c8c[_0x7454('0x41')]=_0x38ad47;return _0x583c8c;})[_0x7454('0x42')](respondWithFilteredResult(_0x30627a,_0x194e30))[_0x7454('0x43')](handleError(_0x30627a,null));};exports[_0x7454('0x44')]=function(_0x4afdb7,_0x54775f){var _0x395420={'raw':![],'where':{'id':_0x4afdb7[_0x7454('0x45')]['id']}},_0x5a8284={};_0x5a8284['model']=_[_0x7454('0x2f')](db[_0x7454('0x2b')][_0x7454('0x46')]);_0x5a8284[_0x7454('0x2e')]=_['keys'](_0x4afdb7[_0x7454('0x2e')]);_0x5a8284[_0x7454('0x39')]=_[_0x7454('0x31')](_0x5a8284['model'],_0x5a8284[_0x7454('0x2e')]);_0x395420[_0x7454('0x33')]=_[_0x7454('0x31')](_0x5a8284[_0x7454('0x30')],qs[_0x7454('0x32')](_0x4afdb7[_0x7454('0x2e')]['fields']));_0x395420[_0x7454('0x33')]=_0x395420[_0x7454('0x33')][_0x7454('0x34')]?_0x395420[_0x7454('0x33')]:_0x5a8284['model'];if(_0x4afdb7[_0x7454('0x2e')]['includeAll']){_0x395420[_0x7454('0x3f')]=[{'all':!![]}];}_0x395420=_[_0x7454('0x3c')]({},_0x395420,_0x4afdb7[_0x7454('0x3e')]);return db[_0x7454('0x2b')][_0x7454('0x47')](_0x395420)[_0x7454('0x42')](handleEntityNotFound(_0x54775f,null))[_0x7454('0x42')](respondWithResult(_0x54775f,null))['catch'](handleError(_0x54775f,null));};exports[_0x7454('0x48')]=function(_0x448b13,_0x45fac7){return db[_0x7454('0x2b')][_0x7454('0x48')](_0x448b13[_0x7454('0x49')],{})['then'](respondWithResult(_0x45fac7,0xc9))[_0x7454('0x43')](handleError(_0x45fac7,null));};exports[_0x7454('0x23')]=function(_0x4cd9d7,_0x2e19f7){if(_0x4cd9d7[_0x7454('0x49')]['id']){delete _0x4cd9d7[_0x7454('0x49')]['id'];}return db[_0x7454('0x2b')][_0x7454('0x47')]({'where':{'id':_0x4cd9d7['params']['id']}})['then'](handleEntityNotFound(_0x2e19f7,null))[_0x7454('0x42')](saveUpdates(_0x4cd9d7[_0x7454('0x49')],null))[_0x7454('0x42')](respondWithResult(_0x2e19f7,null))[_0x7454('0x43')](handleError(_0x2e19f7,null));};exports[_0x7454('0x24')]=function(_0x87a7a8,_0x642075){return db['UserProfileSection'][_0x7454('0x47')]({'where':{'id':_0x87a7a8['params']['id']}})['then'](handleEntityNotFound(_0x642075,null))[_0x7454('0x42')](removeEntity(_0x642075,null))[_0x7454('0x43')](handleError(_0x642075,null));};exports[_0x7454('0x4a')]=function(_0x36d7dd,_0x13b540){return db[_0x7454('0x2b')][_0x7454('0x4a')]()[_0x7454('0x42')](respondWithResult(_0x13b540,null))[_0x7454('0x43')](handleError(_0x13b540,null));}; \ No newline at end of file +var _0x09be=['where','pick','merge','VIRTUAL','filter','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort'];(function(_0x112649,_0x151126){var _0x49274d=function(_0x1dc737){while(--_0x1dc737){_0x112649['push'](_0x112649['shift']());}};_0x49274d(++_0x151126);}(_0x09be,0x184));var _0xe09b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x09be[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe09b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe09b('0x1'));var jsonpatch=require(_0xe09b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe09b('0x3'));var path=require(_0xe09b('0x4'));var sox=require(_0xe09b('0x5'));var csv=require('to-csv');var ejs=require(_0xe09b('0x6'));var fs=require('fs');var _=require(_0xe09b('0x7'));var squel=require('squel');var crypto=require(_0xe09b('0x8'));var jsforce=require(_0xe09b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe09b('0xa'));var querystring=require(_0xe09b('0xb'));var Papa=require(_0xe09b('0xc'));var Redis=require(_0xe09b('0xd'));var authService=require(_0xe09b('0xe'));var qs=require(_0xe09b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe09b('0x10'));var logger=require(_0xe09b('0x11'))(_0xe09b('0x12'));var utils=require('../../config/utils');var config=require(_0xe09b('0x13'));var licenseUtil=require(_0xe09b('0x14'));var db=require(_0xe09b('0x15'))['db'];function respondWithStatusCode(_0x179d81,_0x1c084a){_0x1c084a=_0x1c084a||0xcc;return function(_0x44b95d){if(_0x44b95d){return _0x179d81[_0xe09b('0x16')](_0x1c084a);}return _0x179d81[_0xe09b('0x17')](_0x1c084a)[_0xe09b('0x18')]();};}function respondWithResult(_0x5724b3,_0x3102e3){_0x3102e3=_0x3102e3||0xc8;return function(_0x5e7ce3){if(_0x5e7ce3){return _0x5724b3[_0xe09b('0x17')](_0x3102e3)['json'](_0x5e7ce3);}};}function respondWithFilteredResult(_0x25deb5,_0x1e05e4){return function(_0x3c7397){if(_0x3c7397){var _0x19a7c4=_0x3c7397[_0xe09b('0x19')],_0x5c6c94=_0x1e05e4[_0xe09b('0x1a')],_0x4b8ba2=_0x1e05e4[_0xe09b('0x1a')]+_0x1e05e4['limit'],_0x5bfee3;if(_0x4b8ba2>=_0x19a7c4){_0x4b8ba2=_0x19a7c4;_0x5bfee3=0xc8;}else{_0x5bfee3=0xce;}_0x25deb5[_0xe09b('0x17')](_0x5bfee3);return _0x25deb5[_0xe09b('0x1b')](_0xe09b('0x1c'),_0x5c6c94+'-'+_0x4b8ba2+'/'+_0x19a7c4)[_0xe09b('0x1d')](_0x3c7397);}return null;};}function patchUpdates(_0x50074b){return function(_0x593b0a){try{jsonpatch[_0xe09b('0x1e')](_0x593b0a,_0x50074b,!![]);}catch(_0x349b13){return BPromise[_0xe09b('0x1f')](_0x349b13);}return _0x593b0a[_0xe09b('0x20')]();};}function saveUpdates(_0xdf85ea,_0x542eb6){return function(_0x183ba9){if(_0x183ba9){return _0x183ba9[_0xe09b('0x21')](_0xdf85ea)[_0xe09b('0x22')](function(_0x59abd4){return _0x59abd4;});}return null;};}function removeEntity(_0x264385,_0x468ae6){return function(_0x199b82){if(_0x199b82){return _0x199b82[_0xe09b('0x23')]()[_0xe09b('0x22')](function(){_0x264385['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x330e09,_0x384ba0){return function(_0x4afa53){if(!_0x4afa53){_0x330e09[_0xe09b('0x16')](0x194);}return _0x4afa53;};}function handleError(_0x4874ba,_0xbf5a5d){_0xbf5a5d=_0xbf5a5d||0x1f4;return function(_0x239ff3){logger[_0xe09b('0x24')](_0x239ff3['stack']);if(_0x239ff3[_0xe09b('0x25')]){delete _0x239ff3[_0xe09b('0x25')];}_0x4874ba[_0xe09b('0x17')](_0xbf5a5d)[_0xe09b('0x26')](_0x239ff3);};}exports[_0xe09b('0x27')]=function(_0x144a7b,_0x5ecab4){var _0x5402aa={},_0x755e39={},_0x470eca={'count':0x0,'rows':[]};var _0x222f96=_[_0xe09b('0x28')](db['UserProfileSection'][_0xe09b('0x29')],function(_0x477bc2){return{'name':_0x477bc2[_0xe09b('0x2a')],'type':_0x477bc2[_0xe09b('0x2b')][_0xe09b('0x2c')]};});_0x755e39['model']=_[_0xe09b('0x28')](_0x222f96,_0xe09b('0x25'));_0x755e39['query']=_[_0xe09b('0x2d')](_0x144a7b[_0xe09b('0x2e')]);_0x755e39[_0xe09b('0x2f')]=_[_0xe09b('0x30')](_0x755e39[_0xe09b('0x31')],_0x755e39['query']);_0x5402aa[_0xe09b('0x32')]=_[_0xe09b('0x30')](_0x755e39[_0xe09b('0x31')],qs[_0xe09b('0x33')](_0x144a7b[_0xe09b('0x2e')][_0xe09b('0x33')]));_0x5402aa[_0xe09b('0x32')]=_0x5402aa[_0xe09b('0x32')]['length']?_0x5402aa[_0xe09b('0x32')]:_0x755e39[_0xe09b('0x31')];if(!_0x144a7b[_0xe09b('0x2e')][_0xe09b('0x34')]('nolimit')){_0x5402aa['limit']=qs[_0xe09b('0x35')](_0x144a7b[_0xe09b('0x2e')][_0xe09b('0x35')]);_0x5402aa[_0xe09b('0x1a')]=qs[_0xe09b('0x1a')](_0x144a7b[_0xe09b('0x2e')][_0xe09b('0x1a')]);}_0x5402aa[_0xe09b('0x36')]=qs[_0xe09b('0x37')](_0x144a7b['query']['sort']);_0x5402aa[_0xe09b('0x38')]=qs[_0xe09b('0x2f')](_[_0xe09b('0x39')](_0x144a7b[_0xe09b('0x2e')],_0x755e39[_0xe09b('0x2f')]),_0x222f96);if(_0x144a7b['query']['filter']){_0x5402aa[_0xe09b('0x38')]=_[_0xe09b('0x3a')](_0x5402aa[_0xe09b('0x38')],{'$or':_[_0xe09b('0x28')](_0x222f96,function(_0x539985){if(_0x539985[_0xe09b('0x2b')]!==_0xe09b('0x3b')){var _0x528d51={};_0x528d51[_0x539985[_0xe09b('0x25')]]={'$like':'%'+_0x144a7b[_0xe09b('0x2e')][_0xe09b('0x3c')]+'%'};return _0x528d51;}})});}_0x5402aa=_[_0xe09b('0x3a')]({},_0x5402aa,_0x144a7b[_0xe09b('0x3d')]);var _0x4932af={'where':_0x5402aa[_0xe09b('0x38')]};return db[_0xe09b('0x3e')][_0xe09b('0x19')](_0x4932af)[_0xe09b('0x22')](function(_0x39ff84){_0x470eca[_0xe09b('0x19')]=_0x39ff84;if(_0x144a7b[_0xe09b('0x2e')][_0xe09b('0x3f')]){_0x5402aa[_0xe09b('0x40')]=[{'all':!![]}];}return db[_0xe09b('0x3e')][_0xe09b('0x41')](_0x5402aa);})[_0xe09b('0x22')](function(_0x1a7a84){_0x470eca[_0xe09b('0x42')]=_0x1a7a84;return _0x470eca;})['then'](respondWithFilteredResult(_0x5ecab4,_0x5402aa))[_0xe09b('0x43')](handleError(_0x5ecab4,null));};exports[_0xe09b('0x44')]=function(_0x1673b3,_0x4c691a){var _0xfa15b8={'raw':![],'where':{'id':_0x1673b3[_0xe09b('0x45')]['id']}},_0x4f2a0c={};_0x4f2a0c[_0xe09b('0x31')]=_[_0xe09b('0x2d')](db[_0xe09b('0x3e')][_0xe09b('0x29')]);_0x4f2a0c[_0xe09b('0x2e')]=_['keys'](_0x1673b3[_0xe09b('0x2e')]);_0x4f2a0c[_0xe09b('0x2f')]=_[_0xe09b('0x30')](_0x4f2a0c[_0xe09b('0x31')],_0x4f2a0c[_0xe09b('0x2e')]);_0xfa15b8['attributes']=_[_0xe09b('0x30')](_0x4f2a0c[_0xe09b('0x31')],qs[_0xe09b('0x33')](_0x1673b3['query'][_0xe09b('0x33')]));_0xfa15b8['attributes']=_0xfa15b8[_0xe09b('0x32')]['length']?_0xfa15b8[_0xe09b('0x32')]:_0x4f2a0c[_0xe09b('0x31')];if(_0x1673b3[_0xe09b('0x2e')][_0xe09b('0x3f')]){_0xfa15b8[_0xe09b('0x40')]=[{'all':!![]}];}_0xfa15b8=_['merge']({},_0xfa15b8,_0x1673b3[_0xe09b('0x3d')]);return db[_0xe09b('0x3e')]['find'](_0xfa15b8)[_0xe09b('0x22')](handleEntityNotFound(_0x4c691a,null))[_0xe09b('0x22')](respondWithResult(_0x4c691a,null))['catch'](handleError(_0x4c691a,null));};exports[_0xe09b('0x46')]=function(_0x1849e5,_0x10ab7f){return db[_0xe09b('0x3e')]['create'](_0x1849e5[_0xe09b('0x47')],{})['then'](respondWithResult(_0x10ab7f,0xc9))[_0xe09b('0x43')](handleError(_0x10ab7f,null));};exports[_0xe09b('0x21')]=function(_0x5a076d,_0x1f0422){if(_0x5a076d['body']['id']){delete _0x5a076d['body']['id'];}return db[_0xe09b('0x3e')][_0xe09b('0x48')]({'where':{'id':_0x5a076d[_0xe09b('0x45')]['id']}})[_0xe09b('0x22')](handleEntityNotFound(_0x1f0422,null))[_0xe09b('0x22')](saveUpdates(_0x5a076d[_0xe09b('0x47')],null))[_0xe09b('0x22')](respondWithResult(_0x1f0422,null))[_0xe09b('0x43')](handleError(_0x1f0422,null));};exports['destroy']=function(_0x1cda6b,_0x902fd8){return db['UserProfileSection'][_0xe09b('0x48')]({'where':{'id':_0x1cda6b[_0xe09b('0x45')]['id']}})['then'](handleEntityNotFound(_0x902fd8,null))[_0xe09b('0x22')](removeEntity(_0x902fd8,null))['catch'](handleError(_0x902fd8,null));};exports['describe']=function(_0x2da0fe,_0x305a5d){return db[_0xe09b('0x3e')][_0xe09b('0x49')]()[_0xe09b('0x22')](respondWithResult(_0x305a5d,null))[_0xe09b('0x43')](handleError(_0x305a5d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index f4f8f33..bc56057 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 _0x83b2=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x37dc59,_0x4fcae4){var _0x1cdb3d=function(_0x60c86e){while(--_0x60c86e){_0x37dc59['push'](_0x37dc59['shift']());}};_0x1cdb3d(++_0x4fcae4);}(_0x83b2,0xb9));var _0x283b=function(_0x14a7d1,_0x59f9ab){_0x14a7d1=_0x14a7d1-0x0;var _0x16a129=_0x83b2[_0x14a7d1];return _0x16a129;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x283b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x283b('0x1'));var fs=require('fs');var path=require(_0x283b('0x2'));var rimraf=require(_0x283b('0x3'));var config=require(_0x283b('0x4'));var attributes=require('./userProfileSection.attributes');module[_0x283b('0x5')]=function(_0x540ae3,_0x1064a0){return _0x540ae3[_0x283b('0x6')](_0x283b('0x7'),attributes,{'tableName':_0x283b('0x8'),'paranoid':![],'indexes':[{'name':_0x283b('0x9'),'fields':[_0x283b('0xa'),_0x283b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc35b=['compositeIndex','util','../../config/logger','moment','rimraf','../../config/environment','define','UserProfileSection','user_profile_has_sections'];(function(_0x5088ad,_0x2aa849){var _0x16ec9e=function(_0x240a1b){while(--_0x240a1b){_0x5088ad['push'](_0x5088ad['shift']());}};_0x16ec9e(++_0x2aa849);}(_0xc35b,0xa3));var _0xbc35=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xc35b[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require(_0xbc35('0x0'));var logger=require(_0xbc35('0x1'))('api');var moment=require(_0xbc35('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc35('0x3'));var config=require(_0xbc35('0x4'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x46eb90,_0x1acf44){return _0x46eb90[_0xbc35('0x5')](_0xbc35('0x6'),attributes,{'tableName':_0xbc35('0x7'),'paranoid':![],'indexes':[{'name':_0xbc35('0x8'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 70b9ebf..6063472 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 _0xfd8e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','randomstring'];(function(_0x49eb1d,_0x293ae1){var _0x2af23c=function(_0x202a72){while(--_0x202a72){_0x49eb1d['push'](_0x49eb1d['shift']());}};_0x2af23c(++_0x293ae1);}(_0xfd8e,0x108));var _0xefd8=function(_0x27b604,_0xb86855){_0x27b604=_0x27b604-0x0;var _0x50acb4=_0xfd8e[_0x27b604];return _0x50acb4;};'use strict';var _=require(_0xefd8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xefd8('0x1'));var fs=require('fs');var Redis=require(_0xefd8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xefd8('0x3'));var logger=require(_0xefd8('0x4'))(_0xefd8('0x5'));var config=require(_0xefd8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xefd8('0x7')][_0xefd8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ccdad,_0x13d4da,_0x47e94f){return new BPromise(function(_0x3e9df2,_0x12f2ca){return client[_0xefd8('0x9')](_0x5ccdad,_0x47e94f)[_0xefd8('0xa')](function(_0x5a02f6){logger[_0xefd8('0xb')](_0xefd8('0xc'),_0x13d4da,_0xefd8('0xd'));logger['debug'](_0xefd8('0xe'),_0x13d4da,_0xefd8('0xd'),JSON[_0xefd8('0xf')](_0x5a02f6));if(_0x5a02f6[_0xefd8('0x10')]){if(_0x5a02f6[_0xefd8('0x10')][_0xefd8('0x11')]===0x1f4){logger[_0xefd8('0x10')](_0xefd8('0xc'),_0x13d4da,_0x5a02f6['error']['message']);return _0x12f2ca(_0x5a02f6[_0xefd8('0x10')][_0xefd8('0x12')]);}logger[_0xefd8('0x10')](_0xefd8('0xc'),_0x13d4da,_0x5a02f6['error'][_0xefd8('0x12')]);return _0x3e9df2(_0x5a02f6[_0xefd8('0x10')][_0xefd8('0x12')]);}else{logger[_0xefd8('0xb')](_0xefd8('0xc'),_0x13d4da,_0xefd8('0xd'));_0x3e9df2(_0x5a02f6['result'][_0xefd8('0x12')]);}})['catch'](function(_0x341170){logger[_0xefd8('0x10')](_0xefd8('0xc'),_0x13d4da,_0x341170);_0x12f2ca(_0x341170);});});} \ No newline at end of file +var _0x9245=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4bde46,_0x4bf77b){var _0x6b4db7=function(_0x17abcb){while(--_0x17abcb){_0x4bde46['push'](_0x4bde46['shift']());}};_0x6b4db7(++_0x4bf77b);}(_0x9245,0x12d));var _0x5924=function(_0x22bbe0,_0x41c04d){_0x22bbe0=_0x22bbe0-0x0;var _0x5da7d3=_0x9245[_0x22bbe0];return _0x5da7d3;};'use strict';var _=require(_0x5924('0x0'));var util=require('util');var moment=require(_0x5924('0x1'));var BPromise=require(_0x5924('0x2'));var rs=require(_0x5924('0x3'));var fs=require('fs');var Redis=require(_0x5924('0x4'));var db=require(_0x5924('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5924('0x6'));var config=require(_0x5924('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5924('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239254,_0x4e8e59,_0x8c1d7){return new BPromise(function(_0x15acc7,_0x57c5e2){return client[_0x5924('0x9')](_0x239254,_0x8c1d7)[_0x5924('0xa')](function(_0x2f68b6){logger[_0x5924('0xb')](_0x5924('0xc'),_0x4e8e59,_0x5924('0xd'));logger['debug'](_0x5924('0xe'),_0x4e8e59,_0x5924('0xd'),JSON[_0x5924('0xf')](_0x2f68b6));if(_0x2f68b6[_0x5924('0x10')]){if(_0x2f68b6['error']['code']===0x1f4){logger['error'](_0x5924('0xc'),_0x4e8e59,_0x2f68b6[_0x5924('0x10')]['message']);return _0x57c5e2(_0x2f68b6[_0x5924('0x10')][_0x5924('0x11')]);}logger[_0x5924('0x10')](_0x5924('0xc'),_0x4e8e59,_0x2f68b6[_0x5924('0x10')]['message']);return _0x15acc7(_0x2f68b6['error'][_0x5924('0x11')]);}else{logger['info'](_0x5924('0xc'),_0x4e8e59,_0x5924('0xd'));_0x15acc7(_0x2f68b6[_0x5924('0x12')][_0x5924('0x11')]);}})[_0x5924('0x13')](function(_0x384cc3){logger[_0x5924('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4e8e59,_0x384cc3);_0x57c5e2(_0x384cc3);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b4a138f..c4996d2 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 _0x6adb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x304e09,_0x256d0f){var _0x26427f=function(_0x3c42a1){while(--_0x3c42a1){_0x304e09['push'](_0x304e09['shift']());}};_0x26427f(++_0x256d0f);}(_0x6adb,0x105));var _0xb6ad=function(_0x39e9b9,_0x1490f9){_0x39e9b9=_0x39e9b9-0x0;var _0x23dd9a=_0x6adb[_0x39e9b9];return _0x23dd9a;};'use strict';var multer=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var path=require(_0xb6ad('0x2'));var timeout=require(_0xb6ad('0x3'));var express=require('express');var router=express[_0xb6ad('0x4')]();var auth=require(_0xb6ad('0x5'));var interaction=require(_0xb6ad('0x6'));var config=require(_0xb6ad('0x7'));module['exports']=router; \ No newline at end of file +var _0x0960=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x0960,0xc2));var _0x0096=function(_0x139815,_0x3d0072){_0x139815=_0x139815-0x0;var _0x3c33ba=_0x0960[_0x139815];return _0x3c33ba;};'use strict';var multer=require(_0x0096('0x0'));var util=require(_0x0096('0x1'));var path=require('path');var timeout=require(_0x0096('0x2'));var express=require(_0x0096('0x3'));var router=express[_0x0096('0x4')]();var auth=require(_0x0096('0x5'));var interaction=require(_0x0096('0x6'));var config=require(_0x0096('0x7'));module[_0x0096('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 83593c0..5901dbe 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 _0xd8b0=['exports','sequelize'];(function(_0x1c7dcf,_0x25723c){var _0x1ede61=function(_0x41f909){while(--_0x41f909){_0x1c7dcf['push'](_0x1c7dcf['shift']());}};_0x1ede61(++_0x25723c);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x5d4876,_0x11e6b0){var _0x6927ac=function(_0x2e9a3a){while(--_0x2e9a3a){_0x5d4876['push'](_0x5d4876['shift']());}};_0x6927ac(++_0x11e6b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 5c380f5..49a1532 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 _0x1b63=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','../../config/logger'];(function(_0x3d7a9f,_0x24e0f1){var _0x13f5f1=function(_0x1fbbda){while(--_0x1fbbda){_0x3d7a9f['push'](_0x3d7a9f['shift']());}};_0x13f5f1(++_0x24e0f1);}(_0x1b63,0x185));var _0x31b6=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x1b63[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0x31b6('0x0'));var util=require(_0x31b6('0x1'));var logger=require(_0x31b6('0x2'))(_0x31b6('0x3'));var moment=require(_0x31b6('0x4'));var BPromise=require(_0x31b6('0x5'));var rp=require(_0x31b6('0x6'));var fs=require('fs');var path=require(_0x31b6('0x7'));var rimraf=require(_0x31b6('0x8'));var config=require(_0x31b6('0x9'));var attributes=require(_0x31b6('0xa'));module[_0x31b6('0xb')]=function(_0x151e8b,_0x247bf7){return _0x151e8b[_0x31b6('0xc')](_0x31b6('0xd'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8382=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','request-promise','rimraf'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x8382,0x1d1));var _0x2838=function(_0x48ceca,_0xab491d){_0x48ceca=_0x48ceca-0x0;var _0x5ea857=_0x8382[_0x48ceca];return _0x5ea857;};'use strict';var _=require('lodash');var util=require(_0x2838('0x0'));var logger=require(_0x2838('0x1'))(_0x2838('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2838('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2838('0x4'));var config=require('../../config/environment');var attributes=require(_0x2838('0x5'));module[_0x2838('0x6')]=function(_0x5bb774,_0x1fa609){return _0x5bb774[_0x2838('0x7')](_0x2838('0x8'),attributes,{'tableName':_0x2838('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 136a924..c83b878 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 _0x3af2=['UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb4b437,_0x3913bd){var _0x1daded=function(_0x143f09){while(--_0x143f09){_0xb4b437['push'](_0xb4b437['shift']());}};_0x1daded(++_0x3913bd);}(_0x3af2,0x1e3));var _0x23af=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3af2[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x23af('0x0'));var util=require(_0x23af('0x1'));var moment=require(_0x23af('0x2'));var BPromise=require(_0x23af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23af('0x4'))['db'];var utils=require(_0x23af('0x5'));var logger=require(_0x23af('0x6'))(_0x23af('0x7'));var config=require(_0x23af('0x8'));var jayson=require(_0x23af('0x9'));var client=jayson[_0x23af('0xa')][_0x23af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a7b06,_0x41a974,_0x50315e){return new BPromise(function(_0x493ade,_0x44c9a4){return client[_0x23af('0xc')](_0x3a7b06,_0x50315e)[_0x23af('0xd')](function(_0x1a60b8){logger[_0x23af('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x41a974,_0x23af('0xf'));logger[_0x23af('0x10')](_0x23af('0x11'),_0x41a974,_0x23af('0xf'),JSON[_0x23af('0x12')](_0x1a60b8));if(_0x1a60b8[_0x23af('0x13')]){if(_0x1a60b8[_0x23af('0x13')][_0x23af('0x14')]===0x1f4){logger[_0x23af('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x41a974,_0x1a60b8[_0x23af('0x13')]['message']);return _0x44c9a4(_0x1a60b8[_0x23af('0x13')]['message']);}logger[_0x23af('0x13')](_0x23af('0x15'),_0x41a974,_0x1a60b8['error'][_0x23af('0x16')]);return _0x493ade(_0x1a60b8['error'][_0x23af('0x16')]);}else{logger[_0x23af('0xe')](_0x23af('0x15'),_0x41a974,_0x23af('0xf'));_0x493ade(_0x1a60b8[_0x23af('0x17')]['message']);}})['catch'](function(_0x84da6b){logger[_0x23af('0x13')](_0x23af('0x15'),_0x41a974,_0x84da6b);_0x44c9a4(_0x84da6b);});});} \ No newline at end of file +var _0x76d0=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x76d0,0x130));var _0x076d=function(_0x4a61ce,_0x31dda7){_0x4a61ce=_0x4a61ce-0x0;var _0x45a5e7=_0x76d0[_0x4a61ce];return _0x45a5e7;};'use strict';var _=require(_0x076d('0x0'));var util=require(_0x076d('0x1'));var moment=require(_0x076d('0x2'));var BPromise=require(_0x076d('0x3'));var rs=require(_0x076d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x076d('0x5'))['db'];var utils=require(_0x076d('0x6'));var logger=require(_0x076d('0x7'))(_0x076d('0x8'));var config=require(_0x076d('0x9'));var jayson=require(_0x076d('0xa'));var client=jayson[_0x076d('0xb')][_0x076d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2defe0,_0x2d34f4,_0x117974){return new BPromise(function(_0x507826,_0x2a77f6){return client[_0x076d('0xd')](_0x2defe0,_0x117974)[_0x076d('0xe')](function(_0x5d0ddd){logger[_0x076d('0xf')](_0x076d('0x10'),_0x2d34f4,'request\x20sent');logger[_0x076d('0x11')](_0x076d('0x12'),_0x2d34f4,_0x076d('0x13'),JSON['stringify'](_0x5d0ddd));if(_0x5d0ddd[_0x076d('0x14')]){if(_0x5d0ddd[_0x076d('0x14')][_0x076d('0x15')]===0x1f4){logger[_0x076d('0x14')](_0x076d('0x10'),_0x2d34f4,_0x5d0ddd[_0x076d('0x14')][_0x076d('0x16')]);return _0x2a77f6(_0x5d0ddd['error']['message']);}logger[_0x076d('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x2d34f4,_0x5d0ddd[_0x076d('0x14')][_0x076d('0x16')]);return _0x507826(_0x5d0ddd['error'][_0x076d('0x16')]);}else{logger[_0x076d('0xf')](_0x076d('0x10'),_0x2d34f4,'request\x20sent');_0x507826(_0x5d0ddd[_0x076d('0x17')][_0x076d('0x16')]);}})[_0x076d('0x18')](function(_0x5dd716){logger[_0x076d('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x2d34f4,_0x5dd716);_0x2a77f6(_0x5dd716);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 800f8a2..98cd089 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 _0x60b0=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x265dc0,_0x10c8be){var _0x372eab=function(_0x2d5356){while(--_0x2d5356){_0x265dc0['push'](_0x265dc0['shift']());}};_0x372eab(++_0x10c8be);}(_0x60b0,0x77));var _0x060b=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x60b0[_0x420d8d];return _0x4865d7;};'use strict';var multer=require(_0x060b('0x0'));var util=require(_0x060b('0x1'));var path=require(_0x060b('0x2'));var timeout=require(_0x060b('0x3'));var express=require(_0x060b('0x4'));var router=express['Router']();var auth=require(_0x060b('0x5'));var interaction=require(_0x060b('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xfaa5=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','util'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xfaa5,0x157));var _0x5faa=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xfaa5[_0x510c60];return _0x49c4aa;};'use strict';var multer=require('multer');var util=require(_0x5faa('0x0'));var path=require(_0x5faa('0x1'));var timeout=require(_0x5faa('0x2'));var express=require(_0x5faa('0x3'));var router=express[_0x5faa('0x4')]();var auth=require(_0x5faa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5faa('0x6'));module[_0x5faa('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 32354cd..7037a94 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x59f7b8,_0xb2ac21){var _0x7b28c5=function(_0x427d2d){while(--_0x427d2d){_0x59f7b8['push'](_0x59f7b8['shift']());}};_0x7b28c5(++_0xb2ac21);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xc26e6d,_0x2886f0){var _0x4f49f0=function(_0xa1f8d2){while(--_0xa1f8d2){_0xc26e6d['push'](_0xc26e6d['shift']());}};_0x4f49f0(++_0x2886f0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 26019b8..8e937e6 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 _0x5fd1=['UserVoiceQueue','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x5d4ddd,_0x4e33cc){var _0xffe0e2=function(_0x19c2fa){while(--_0x19c2fa){_0x5d4ddd['push'](_0x5d4ddd['shift']());}};_0xffe0e2(++_0x4e33cc);}(_0x5fd1,0x155));var _0x15fd=function(_0x39a6a8,_0x220baa){_0x39a6a8=_0x39a6a8-0x0;var _0xfc5750=_0x5fd1[_0x39a6a8];return _0xfc5750;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','util','../../config/logger','api','moment'];(function(_0x1af2e1,_0x50074e){var _0x126714=function(_0x172d88){while(--_0x172d88){_0x1af2e1['push'](_0x1af2e1['shift']());}};_0x126714(++_0x50074e);}(_0x84ab,0x12f));var _0xb84a=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x84ab[_0x48b810];return _0x23c17d;};'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':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index c5b8943..efaca5e 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 _0x314f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5f50b8,_0x4b80a0){var _0x2c5e78=function(_0x108874){while(--_0x108874){_0x5f50b8['push'](_0x5f50b8['shift']());}};_0x2c5e78(++_0x4b80a0);}(_0x314f,0x114));var _0xf314=function(_0x316913,_0x5b4398){_0x316913=_0x316913-0x0;var _0x230f03=_0x314f[_0x316913];return _0x230f03;};'use strict';var _=require(_0xf314('0x0'));var util=require(_0xf314('0x1'));var moment=require(_0xf314('0x2'));var BPromise=require(_0xf314('0x3'));var rs=require(_0xf314('0x4'));var fs=require('fs');var Redis=require(_0xf314('0x5'));var db=require(_0xf314('0x6'))['db'];var utils=require(_0xf314('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf314('0x8'));var jayson=require(_0xf314('0x9'));var client=jayson[_0xf314('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387095,_0x5b0cea,_0x5621e7){return new BPromise(function(_0xbea7c3,_0x29a46a){return client[_0xf314('0xb')](_0x387095,_0x5621e7)[_0xf314('0xc')](function(_0x23269b){logger[_0xf314('0xd')](_0xf314('0xe'),_0x5b0cea,'request\x20sent');logger[_0xf314('0xf')](_0xf314('0x10'),_0x5b0cea,_0xf314('0x11'),JSON[_0xf314('0x12')](_0x23269b));if(_0x23269b[_0xf314('0x13')]){if(_0x23269b[_0xf314('0x13')][_0xf314('0x14')]===0x1f4){logger[_0xf314('0x13')](_0xf314('0xe'),_0x5b0cea,_0x23269b[_0xf314('0x13')]['message']);return _0x29a46a(_0x23269b[_0xf314('0x13')]['message']);}logger[_0xf314('0x13')](_0xf314('0xe'),_0x5b0cea,_0x23269b['error'][_0xf314('0x15')]);return _0xbea7c3(_0x23269b[_0xf314('0x13')]['message']);}else{logger[_0xf314('0xd')](_0xf314('0xe'),_0x5b0cea,'request\x20sent');_0xbea7c3(_0x23269b[_0xf314('0x16')][_0xf314('0x15')]);}})['catch'](function(_0x568c8b){logger[_0xf314('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x5b0cea,_0x568c8b);_0x29a46a(_0x568c8b);});});} \ No newline at end of file +var _0xb2ba=['http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16a84e,_0xbbe691){var _0x2270d8=function(_0x36889b){while(--_0x36889b){_0x16a84e['push'](_0x16a84e['shift']());}};_0x2270d8(++_0xbbe691);}(_0xb2ba,0xbc));var _0xab2b=function(_0x44879f,_0x44a462){_0x44879f=_0x44879f-0x0;var _0x52325a=_0xb2ba[_0x44879f];return _0x52325a;};'use strict';var _=require(_0xab2b('0x0'));var util=require(_0xab2b('0x1'));var moment=require(_0xab2b('0x2'));var BPromise=require(_0xab2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab2b('0x4'));var db=require(_0xab2b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab2b('0x6'))(_0xab2b('0x7'));var config=require(_0xab2b('0x8'));var jayson=require(_0xab2b('0x9'));var client=jayson['client'][_0xab2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48a637,_0x5a0e29,_0x3a7118){return new BPromise(function(_0x2b4c0f,_0x464032){return client[_0xab2b('0xb')](_0x48a637,_0x3a7118)[_0xab2b('0xc')](function(_0x1fbeb0){logger[_0xab2b('0xd')](_0xab2b('0xe'),_0x5a0e29,_0xab2b('0xf'));logger['debug'](_0xab2b('0x10'),_0x5a0e29,_0xab2b('0xf'),JSON['stringify'](_0x1fbeb0));if(_0x1fbeb0[_0xab2b('0x11')]){if(_0x1fbeb0[_0xab2b('0x11')][_0xab2b('0x12')]===0x1f4){logger[_0xab2b('0x11')](_0xab2b('0xe'),_0x5a0e29,_0x1fbeb0['error'][_0xab2b('0x13')]);return _0x464032(_0x1fbeb0['error']['message']);}logger[_0xab2b('0x11')](_0xab2b('0xe'),_0x5a0e29,_0x1fbeb0[_0xab2b('0x11')][_0xab2b('0x13')]);return _0x2b4c0f(_0x1fbeb0['error'][_0xab2b('0x13')]);}else{logger[_0xab2b('0xd')](_0xab2b('0xe'),_0x5a0e29,'request\x20sent');_0x2b4c0f(_0x1fbeb0[_0xab2b('0x14')][_0xab2b('0x13')]);}})[_0xab2b('0x15')](function(_0x486ddb){logger['error'](_0xab2b('0xe'),_0x5a0e29,_0x486ddb);_0x464032(_0x486ddb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a1bf205..936ec8e 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 _0xc382=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x150209,_0x189a28){var _0xc5dfc9=function(_0x624c7b){while(--_0x624c7b){_0x150209['push'](_0x150209['shift']());}};_0xc5dfc9(++_0x189a28);}(_0xc382,0xf0));var _0x2c38=function(_0x441db3,_0x10f359){_0x441db3=_0x441db3-0x0;var _0x16c05d=_0xc382[_0x441db3];return _0x16c05d;};'use strict';var multer=require('multer');var util=require(_0x2c38('0x0'));var path=require(_0x2c38('0x1'));var timeout=require(_0x2c38('0x2'));var express=require(_0x2c38('0x3'));var router=express['Router']();var auth=require(_0x2c38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2c38('0x5'));module['exports']=router; \ No newline at end of file +var _0x9112=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x262323,_0x4a81f1){var _0xa963c3=function(_0x5c715e){while(--_0x5c715e){_0x262323['push'](_0x262323['shift']());}};_0xa963c3(++_0x4a81f1);}(_0x9112,0x1e6));var _0x2911=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x9112[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0x2911('0x0'));var util=require(_0x2911('0x1'));var path=require(_0x2911('0x2'));var timeout=require(_0x2911('0x3'));var express=require(_0x2911('0x4'));var router=express['Router']();var auth=require(_0x2911('0x5'));var interaction=require(_0x2911('0x6'));var config=require(_0x2911('0x7'));module[_0x2911('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a6e5a7f..c036e01 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 _0x79cb=['STRING','INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x189364,_0xb3c7bb){var _0x26f26d=function(_0xf4a0ff){while(--_0xf4a0ff){_0x189364['push'](_0x189364['shift']());}};_0x26f26d(++_0xb3c7bb);}(_0x79cb,0x1c5));var _0xb79c=function(_0x56b772,_0x3b0d80){_0x56b772=_0x56b772-0x0;var _0x20b570=_0x79cb[_0x56b772];return _0x20b570;};'use strict';var Sequelize=require(_0xb79c('0x0'));module[_0xb79c('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb79c('0x2')},'membername':{'type':Sequelize[_0xb79c('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xb79c('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb79c('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xb79c('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xb79c('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xb79c('0x4')](0xb),'defaultValue':0x0,'comment':_0xb79c('0x2')},'paused':{'type':Sequelize[_0xb79c('0x4')](0xb),'defaultValue':0x0,'comment':_0xb79c('0x2')}}; \ No newline at end of file +var _0x39a7=['Required\x20by\x20Asterisk','sequelize','exports','INTEGER','STRING','queue_interface'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x39a7,0xc1));var _0x739a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x39a7[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x739a('0x0'));module[_0x739a('0x1')]={'uniqueid':{'type':Sequelize[_0x739a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x739a('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x739a('0x3')],'allowNull':![],'unique':_0x739a('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x739a('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x739a('0x4'),'comment':_0x739a('0x5')},'penalty':{'type':Sequelize[_0x739a('0x2')](0xb),'defaultValue':0x0,'comment':_0x739a('0x5')},'paused':{'type':Sequelize[_0x739a('0x2')](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 478656f..49fabc9 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 _0xcb29=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xcb29,0x84));var _0x9cb2=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xcb29[_0x369151];return _0x4292d5;};'use strict';var EventEmitter=require(_0x9cb2('0x0'));var UserVoiceQueueRt=require(_0x9cb2('0x1'))['db'][_0x9cb2('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9cb2('0x3')](0x0);var events={'afterCreate':_0x9cb2('0x4'),'afterUpdate':_0x9cb2('0x5'),'afterDestroy':_0x9cb2('0x6')};function emitEvent(_0x469798){return function(_0x75a5a4,_0x383887,_0x4b18ec){UserVoiceQueueRtEvents[_0x9cb2('0x7')](_0x469798+':'+_0x75a5a4['id'],_0x75a5a4);UserVoiceQueueRtEvents[_0x9cb2('0x7')](_0x469798,_0x75a5a4);_0x4b18ec(null);};}for(var e in events){if(events[_0x9cb2('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9cb2('0x9')](e,emitEvent(event));}}module[_0x9cb2('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa50a=['hook','events','../../mysqldb','UserVoiceQueueRt','save','update','remove','emit'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0xa50a,0xd1));var _0xaa50=function(_0x364edc,_0x20b3c1){_0x364edc=_0x364edc-0x0;var _0x53e6a1=_0xa50a[_0x364edc];return _0x53e6a1;};'use strict';var EventEmitter=require(_0xaa50('0x0'));var UserVoiceQueueRt=require(_0xaa50('0x1'))['db'][_0xaa50('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa50('0x3'),'afterUpdate':_0xaa50('0x4'),'afterDestroy':_0xaa50('0x5')};function emitEvent(_0x5dbacd){return function(_0x3cd4a9,_0x4f25eb,_0x40ea5b){UserVoiceQueueRtEvents[_0xaa50('0x6')](_0x5dbacd+':'+_0x3cd4a9['id'],_0x3cd4a9);UserVoiceQueueRtEvents[_0xaa50('0x6')](_0x5dbacd,_0x3cd4a9);_0x40ea5b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xaa50('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7991f68..70dabeb 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 _0x3d6e=['util','api','moment','request-promise','../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x3d6e,0x1af));var _0xe3d6=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x3d6e[_0x342700];return _0x53406f;};'use strict';var _=require(_0xe3d6('0x0'));var util=require(_0xe3d6('0x1'));var logger=require('../../config/logger')(_0xe3d6('0x2'));var moment=require(_0xe3d6('0x3'));var BPromise=require('bluebird');var rp=require(_0xe3d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3d6('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0xdcc9c1,_0x4e876d){return _0xdcc9c1[_0xe3d6('0x6')](_0xe3d6('0x7'),attributes,{'tableName':_0xe3d6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x387a=['user_has_voice_queues_rt','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x2e4b84,_0x19ad5a){var _0x3a0444=function(_0x2a86db){while(--_0x2a86db){_0x2e4b84['push'](_0x2e4b84['shift']());}};_0x3a0444(++_0x19ad5a);}(_0x387a,0xb5));var _0xa387=function(_0x1a7d8d,_0x13742a){_0x1a7d8d=_0x1a7d8d-0x0;var _0x17d702=_0x387a[_0x1a7d8d];return _0x17d702;};'use strict';var _=require(_0xa387('0x0'));var util=require(_0xa387('0x1'));var logger=require(_0xa387('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa387('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa387('0x4'));var rimraf=require(_0xa387('0x5'));var config=require(_0xa387('0x6'));var attributes=require(_0xa387('0x7'));module[_0xa387('0x8')]=function(_0x225d62,_0x3c4a76){return _0x225d62[_0xa387('0x9')](_0xa387('0xa'),attributes,{'tableName':_0xa387('0xb'),'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 781ae06..8200f0c 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 _0x1569=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch','UserVoiceQueueRt','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x5cb98,_0x49403a){var _0x296814=function(_0x351eea){while(--_0x351eea){_0x5cb98['push'](_0x5cb98['shift']());}};_0x296814(++_0x49403a);}(_0x1569,0x13f));var _0x9156=function(_0x203c86,_0x594c7a){_0x203c86=_0x203c86-0x0;var _0x3a609a=_0x1569[_0x203c86];return _0x3a609a;};'use strict';var _=require(_0x9156('0x0'));var util=require(_0x9156('0x1'));var moment=require(_0x9156('0x2'));var BPromise=require(_0x9156('0x3'));var rs=require(_0x9156('0x4'));var fs=require('fs');var Redis=require(_0x9156('0x5'));var db=require(_0x9156('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9156('0x7'))(_0x9156('0x8'));var config=require(_0x9156('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9156('0xa')][_0x9156('0xb')]({'port':0x232a});config['redis']=_[_0x9156('0xc')](config[_0x9156('0xd')],{'host':_0x9156('0xe'),'port':0x18eb});var socket=require(_0x9156('0xf'))(new Redis(config[_0x9156('0xd')]));require('./userVoiceQueueRt.socket')[_0x9156('0x10')](socket);function respondWithRpcPromise(_0x2f7db4,_0x29b855,_0x263371){return new BPromise(function(_0x5707f9,_0x129c00){return client['request'](_0x2f7db4,_0x263371)[_0x9156('0x11')](function(_0x59083b){logger[_0x9156('0x12')](_0x9156('0x13'),_0x29b855,_0x9156('0x14'));logger['debug'](_0x9156('0x15'),_0x29b855,_0x9156('0x14'),JSON['stringify'](_0x59083b));if(_0x59083b[_0x9156('0x16')]){if(_0x59083b[_0x9156('0x16')][_0x9156('0x17')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x29b855,_0x59083b[_0x9156('0x16')][_0x9156('0x18')]);return _0x129c00(_0x59083b['error'][_0x9156('0x18')]);}logger[_0x9156('0x16')](_0x9156('0x13'),_0x29b855,_0x59083b[_0x9156('0x16')][_0x9156('0x18')]);return _0x5707f9(_0x59083b[_0x9156('0x16')][_0x9156('0x18')]);}else{logger['info'](_0x9156('0x13'),_0x29b855,_0x9156('0x14'));_0x5707f9(_0x59083b['result']['message']);}})[_0x9156('0x19')](function(_0x2ead25){logger[_0x9156('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x29b855,_0x2ead25);_0x129c00(_0x2ead25);});});}exports['GetVoiceQueueRtPauses']=function(_0x379918){var _0x4e01ab=this;return new Promise(function(_0x3117e4,_0x4c3992){return db[_0x9156('0x1a')]['findAll']({'raw':_0x379918[_0x9156('0x1b')]?_0x379918[_0x9156('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x379918[_0x9156('0x1b')]?_0x379918[_0x9156('0x1b')][_0x9156('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9156('0x1d'),db[_0x9156('0x1e')]['fn']('IF',db['sequelize'][_0x9156('0x1f')](_0x9156('0x20')))),_0x9156('0x21')]]})[_0x9156('0x11')](function(_0x3d95b3){logger['info'](_0x9156('0x22'),_0x379918);logger[_0x9156('0x23')](_0x9156('0x22'),_0x379918,JSON['stringify'](_0x3d95b3));_0x3117e4(_0x3d95b3);})[_0x9156('0x19')](function(_0x816d85){logger[_0x9156('0x16')](_0x9156('0x22'),_0x816d85[_0x9156('0x18')],_0x379918);_0x4c3992(_0x4e01ab[_0x9156('0x16')](0x1f4,_0x816d85[_0x9156('0x18')]));});});}; \ No newline at end of file +var _0xce59=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','sequelize','COUNT','literal','GetVoiceQueueRtPauses','lodash','util','bluebird'];(function(_0x238a2c,_0x34688e){var _0x591cf7=function(_0x255a54){while(--_0x255a54){_0x238a2c['push'](_0x238a2c['shift']());}};_0x591cf7(++_0x34688e);}(_0xce59,0x107));var _0x9ce5=function(_0x13a2de,_0x35b4e2){_0x13a2de=_0x13a2de-0x0;var _0x35e65d=_0xce59[_0x13a2de];return _0x35e65d;};'use strict';var _=require(_0x9ce5('0x0'));var util=require(_0x9ce5('0x1'));var moment=require('moment');var BPromise=require(_0x9ce5('0x2'));var rs=require(_0x9ce5('0x3'));var fs=require('fs');var Redis=require(_0x9ce5('0x4'));var db=require(_0x9ce5('0x5'))['db'];var utils=require(_0x9ce5('0x6'));var logger=require(_0x9ce5('0x7'))(_0x9ce5('0x8'));var config=require(_0x9ce5('0x9'));var jayson=require(_0x9ce5('0xa'));var client=jayson['client'][_0x9ce5('0xb')]({'port':0x232a});config[_0x9ce5('0xc')]=_[_0x9ce5('0xd')](config['redis'],{'host':_0x9ce5('0xe'),'port':0x18eb});var socket=require(_0x9ce5('0xf'))(new Redis(config[_0x9ce5('0xc')]));require(_0x9ce5('0x10'))[_0x9ce5('0x11')](socket);function respondWithRpcPromise(_0x4c79d2,_0x445ffa,_0xb0a214){return new BPromise(function(_0x348492,_0x2d0fa1){return client[_0x9ce5('0x12')](_0x4c79d2,_0xb0a214)[_0x9ce5('0x13')](function(_0x273517){logger[_0x9ce5('0x14')](_0x9ce5('0x15'),_0x445ffa,_0x9ce5('0x16'));logger[_0x9ce5('0x17')](_0x9ce5('0x18'),_0x445ffa,_0x9ce5('0x16'),JSON[_0x9ce5('0x19')](_0x273517));if(_0x273517[_0x9ce5('0x1a')]){if(_0x273517['error'][_0x9ce5('0x1b')]===0x1f4){logger[_0x9ce5('0x1a')](_0x9ce5('0x15'),_0x445ffa,_0x273517[_0x9ce5('0x1a')][_0x9ce5('0x1c')]);return _0x2d0fa1(_0x273517['error'][_0x9ce5('0x1c')]);}logger[_0x9ce5('0x1a')](_0x9ce5('0x15'),_0x445ffa,_0x273517[_0x9ce5('0x1a')][_0x9ce5('0x1c')]);return _0x348492(_0x273517[_0x9ce5('0x1a')][_0x9ce5('0x1c')]);}else{logger[_0x9ce5('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x445ffa,_0x9ce5('0x16'));_0x348492(_0x273517[_0x9ce5('0x1d')][_0x9ce5('0x1c')]);}})[_0x9ce5('0x1e')](function(_0xe75a9){logger[_0x9ce5('0x1a')](_0x9ce5('0x15'),_0x445ffa,_0xe75a9);_0x2d0fa1(_0xe75a9);});});}exports['GetVoiceQueueRtPauses']=function(_0x546b2e){var _0x4b34a1=this;return new Promise(function(_0x1c7026,_0x15d6b0){return db['UserVoiceQueueRt'][_0x9ce5('0x1f')]({'raw':_0x546b2e[_0x9ce5('0x20')]?_0x546b2e['options'][_0x9ce5('0x21')]===undefined?!![]:![]:!![],'where':_0x546b2e['options']?_0x546b2e[_0x9ce5('0x20')]['where']||null:null,'attributes':[[db[_0x9ce5('0x22')]['fn'](_0x9ce5('0x23'),db[_0x9ce5('0x22')]['fn']('IF',db[_0x9ce5('0x22')][_0x9ce5('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x9ce5('0x13')](function(_0x5d63bc){logger[_0x9ce5('0x14')](_0x9ce5('0x25'),_0x546b2e);logger[_0x9ce5('0x17')]('GetVoiceQueueRtPauses',_0x546b2e,JSON[_0x9ce5('0x19')](_0x5d63bc));_0x1c7026(_0x5d63bc);})[_0x9ce5('0x1e')](function(_0x224aac){logger['error'](_0x9ce5('0x25'),_0x224aac['message'],_0x546b2e);_0x15d6b0(_0x4b34a1['error'](0x1f4,_0x224aac[_0x9ce5('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 584df8e..468edfd 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 _0x2a70=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3eac30,_0x3adb99){var _0x58630b=function(_0x5df74c){while(--_0x5df74c){_0x3eac30['push'](_0x3eac30['shift']());}};_0x58630b(++_0x3adb99);}(_0x2a70,0x121));var _0x02a7=function(_0x5af491,_0x4ad2fd){_0x5af491=_0x5af491-0x0;var _0x6ec62f=_0x2a70[_0x5af491];return _0x6ec62f;};'use strict';var UserVoiceQueueRtEvents=require(_0x02a7('0x0'));var events=[_0x02a7('0x1'),_0x02a7('0x2'),_0x02a7('0x3')];function createListener(_0x529cc9,_0x5e58b8){return function(_0x2db891){_0x5e58b8[_0x02a7('0x4')](_0x529cc9,_0x2db891);};}function removeListener(_0x3a85bd,_0x28319a){return function(){UserVoiceQueueRtEvents[_0x02a7('0x5')](_0x3a85bd,_0x28319a);};}exports[_0x02a7('0x6')]=function(_0x1f70c2){for(var _0x389ddd=0x0,_0xbe07e6=events[_0x02a7('0x7')];_0x389ddd<_0xbe07e6;_0x389ddd++){var _0x3d8454=events[_0x389ddd];var _0x5b6c28=createListener(_0x02a7('0x8')+_0x3d8454,_0x1f70c2);UserVoiceQueueRtEvents['on'](_0x3d8454,_0x5b6c28);}}; \ No newline at end of file +var _0x26be=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x466268,_0x225515){var _0x16d4eb=function(_0x5d4fd1){while(--_0x5d4fd1){_0x466268['push'](_0x466268['shift']());}};_0x16d4eb(++_0x225515);}(_0x26be,0x1f4));var _0xe26b=function(_0x40a2cc,_0x1cfeec){_0x40a2cc=_0x40a2cc-0x0;var _0x5c24c2=_0x26be[_0x40a2cc];return _0x5c24c2;};'use strict';var UserVoiceQueueRtEvents=require(_0xe26b('0x0'));var events=[_0xe26b('0x1'),_0xe26b('0x2'),_0xe26b('0x3')];function createListener(_0x5caf8d,_0x5ea45b){return function(_0x5f3516){_0x5ea45b['emit'](_0x5caf8d,_0x5f3516);};}function removeListener(_0x3d0623,_0x2f26fd){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3d0623,_0x2f26fd);};}exports[_0xe26b('0x4')]=function(_0x45a456){for(var _0x33ac78=0x0,_0x4b934c=events[_0xe26b('0x5')];_0x33ac78<_0x4b934c;_0x33ac78++){var _0x45a829=events[_0x33ac78];var _0x7ee0f6=createListener(_0xe26b('0x6')+_0x45a829,_0x45a456);UserVoiceQueueRtEvents['on'](_0x45a829,_0x7ee0f6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 442917c..86f63c0 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 _0xe980=['../../components/auth/service','../../components/interaction/service','multer','util','path','express'];(function(_0x3d5a8c,_0x33cda9){var _0x36fc3d=function(_0x245a18){while(--_0x245a18){_0x3d5a8c['push'](_0x3d5a8c['shift']());}};_0x36fc3d(++_0x33cda9);}(_0xe980,0x152));var _0x0e98=function(_0x667cad,_0x268896){_0x667cad=_0x667cad-0x0;var _0x1744dd=_0xe980[_0x667cad];return _0x1744dd;};'use strict';var multer=require(_0x0e98('0x0'));var util=require(_0x0e98('0x1'));var path=require(_0x0e98('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e98('0x3'));var router=express['Router']();var auth=require(_0x0e98('0x4'));var interaction=require(_0x0e98('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x782e=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x782e,0xe8));var _0xe782=function(_0x2ab8a5,_0xbda99){_0x2ab8a5=_0x2ab8a5-0x0;var _0x4a7877=_0x782e[_0x2ab8a5];return _0x4a7877;};'use strict';var multer=require(_0xe782('0x0'));var util=require('util');var path=require(_0xe782('0x1'));var timeout=require(_0xe782('0x2'));var express=require(_0xe782('0x3'));var router=express[_0xe782('0x4')]();var auth=require(_0xe782('0x5'));var interaction=require(_0xe782('0x6'));var config=require('../../config/environment');module[_0xe782('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 80258e1..7ab03ad 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x80185b,_0x1611dc){var _0x547f55=function(_0x209d29){while(--_0x209d29){_0x80185b['push'](_0x80185b['shift']());}};_0x547f55(++_0x1611dc);}(_0xe706,0xa3));var _0x6e70=function(_0x2a59af,_0x18d558){_0x2a59af=_0x2a59af-0x0;var _0x3af243=_0xe706[_0x2a59af];return _0x3af243;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2d64fc,_0x42b2a7){var _0x2c8556=function(_0x4b29da){while(--_0x4b29da){_0x2d64fc['push'](_0x2d64fc['shift']());}};_0x2c8556(++_0x42b2a7);}(_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')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e452228..cb3bade 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 _0x3423=['UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x501d0f,_0x4adf25){var _0x50cea4=function(_0x19b0fc){while(--_0x19b0fc){_0x501d0f['push'](_0x501d0f['shift']());}};_0x50cea4(++_0x4adf25);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84a0=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x84a0,0x66));var _0x084a=function(_0x673d68,_0x115d89){_0x673d68=_0x673d68-0x0;var _0x51b40b=_0x84a0[_0x673d68];return _0x51b40b;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var logger=require(_0x084a('0x2'))(_0x084a('0x3'));var moment=require('moment');var BPromise=require(_0x084a('0x4'));var rp=require(_0x084a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x084a('0x6'));var attributes=require(_0x084a('0x7'));module['exports']=function(_0x16f8a7,_0x4325ce){return _0x16f8a7[_0x084a('0x8')](_0x084a('0x9'),attributes,{'tableName':_0x084a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 472b0f1..a2b8765 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc1a9c2,_0x355888){var _0x38ca27=function(_0x462c19){while(--_0x462c19){_0xc1a9c2['push'](_0xc1a9c2['shift']());}};_0x38ca27(++_0x355888);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x51eb92,_0x3df319){var _0xcfe5a9=function(_0x3d99ec){while(--_0x3d99ec){_0x51eb92['push'](_0x51eb92['shift']());}};_0xcfe5a9(++_0x3df319);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6d8f903..27078ee 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 _0x5ccd=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x5ccd,0x1ec));var _0xd5cc=function(_0x3041ce,_0x382f98){_0x3041ce=_0x3041ce-0x0;var _0x68a7f9=_0x5ccd[_0x3041ce];return _0x68a7f9;};'use strict';var multer=require(_0xd5cc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd5cc('0x1'));var express=require(_0xd5cc('0x2'));var router=express[_0xd5cc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd5cc('0x4'));var config=require('../../config/environment');var controller=require(_0xd5cc('0x5'));router[_0xd5cc('0x6')]('/',auth[_0xd5cc('0x7')](),controller[_0xd5cc('0x8')]);router[_0xd5cc('0x6')](_0xd5cc('0x9'),auth['isAuthenticated'](),controller[_0xd5cc('0xa')]);router[_0xd5cc('0xb')]('/',auth[_0xd5cc('0x7')](),controller[_0xd5cc('0xc')]);router[_0xd5cc('0xd')]('/:id',auth[_0xd5cc('0x7')](),controller[_0xd5cc('0xe')]);router[_0xd5cc('0xf')](_0xd5cc('0x9'),auth[_0xd5cc('0x7')](),controller[_0xd5cc('0x10')]);module[_0xd5cc('0x11')]=router; \ No newline at end of file +var _0x796b=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','/:id','show'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x796b,0xaf));var _0xb796=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x796b[_0x1e381c];return _0x9b5ea9;};'use strict';var multer=require(_0xb796('0x0'));var util=require(_0xb796('0x1'));var path=require(_0xb796('0x2'));var timeout=require(_0xb796('0x3'));var express=require(_0xb796('0x4'));var router=express[_0xb796('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb796('0x6'));var config=require(_0xb796('0x7'));var controller=require(_0xb796('0x8'));router['get']('/',auth[_0xb796('0x9')](),controller['index']);router['get'](_0xb796('0xa'),auth['isAuthenticated'](),controller[_0xb796('0xb')]);router['post']('/',auth[_0xb796('0x9')](),controller[_0xb796('0xc')]);router[_0xb796('0xd')](_0xb796('0xa'),auth[_0xb796('0x9')](),controller[_0xb796('0xe')]);router[_0xb796('0xf')](_0xb796('0xa'),auth[_0xb796('0x9')](),controller[_0xb796('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d273ec4..7eccace 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 _0x5e0e=['sequelize','exports','STRING','name'];(function(_0x5a7bb0,_0x23f591){var _0x53283d=function(_0x20ac22){while(--_0x20ac22){_0x5a7bb0['push'](_0x5a7bb0['shift']());}};_0x53283d(++_0x23f591);}(_0x5e0e,0x138));var _0xe5e0=function(_0x3b9d79,_0x42f721){_0x3b9d79=_0x3b9d79-0x0;var _0x16d93e=_0x5e0e[_0x3b9d79];return _0x16d93e;};'use strict';var Sequelize=require(_0xe5e0('0x0'));module[_0xe5e0('0x1')]={'name':{'type':Sequelize[_0xe5e0('0x2')],'unique':_0xe5e0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe5e0('0x2')]}}; \ No newline at end of file +var _0x75b2=['sequelize','exports','STRING','name'];(function(_0x5ce99d,_0xd461b){var _0x15e65b=function(_0x263752){while(--_0x263752){_0x5ce99d['push'](_0x5ce99d['shift']());}};_0x15e65b(++_0xd461b);}(_0x75b2,0x1c0));var _0x275b=function(_0x102154,_0x59b082){_0x102154=_0x102154-0x0;var _0x4d06a3=_0x75b2[_0x102154];return _0x4d06a3;};'use strict';var Sequelize=require(_0x275b('0x0'));module[_0x275b('0x1')]={'name':{'type':Sequelize[_0x275b('0x2')],'unique':_0x275b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a0ad4f1..a928e3d 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 _0x30ea=['type','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','Variables','UserProfileResource','stack','name','send','Variable','rawAttributes','fieldName'];(function(_0x2acbb3,_0x29e1b4){var _0x5c0cc7=function(_0x48c6a5){while(--_0x48c6a5){_0x2acbb3['push'](_0x2acbb3['shift']());}};_0x5c0cc7(++_0x29e1b4);}(_0x30ea,0x1ac));var _0xa30e=function(_0x1a2dc0,_0x4e9565){_0x1a2dc0=_0x1a2dc0-0x0;var _0x14affa=_0x30ea[_0x1a2dc0];return _0x14affa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa30e('0x0'));var rimraf=require(_0xa30e('0x1'));var zipdir=require(_0xa30e('0x2'));var jsonpatch=require(_0xa30e('0x3'));var rp=require(_0xa30e('0x4'));var moment=require(_0xa30e('0x5'));var BPromise=require(_0xa30e('0x6'));var Mustache=require(_0xa30e('0x7'));var util=require(_0xa30e('0x8'));var path=require(_0xa30e('0x9'));var sox=require(_0xa30e('0xa'));var csv=require('to-csv');var ejs=require(_0xa30e('0xb'));var fs=require('fs');var _=require(_0xa30e('0xc'));var squel=require(_0xa30e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa30e('0xe'));var toCsv=require(_0xa30e('0xf'));var querystring=require('querystring');var Papa=require(_0xa30e('0x10'));var Redis=require(_0xa30e('0x11'));var authService=require(_0xa30e('0x12'));var qs=require(_0xa30e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa30e('0x14'))('api');var utils=require(_0xa30e('0x15'));var config=require(_0xa30e('0x16'));var licenseUtil=require(_0xa30e('0x17'));var db=require(_0xa30e('0x18'))['db'];function respondWithStatusCode(_0x55ae43,_0x520109){_0x520109=_0x520109||0xcc;return function(_0x2af495){if(_0x2af495){return _0x55ae43[_0xa30e('0x19')](_0x520109);}return _0x55ae43[_0xa30e('0x1a')](_0x520109)['end']();};}function respondWithResult(_0x654175,_0x531700){_0x531700=_0x531700||0xc8;return function(_0x46e7d2){if(_0x46e7d2){return _0x654175['status'](_0x531700)[_0xa30e('0x1b')](_0x46e7d2);}};}function respondWithFilteredResult(_0x3585b1,_0x17f826){return function(_0x41b5fc){if(_0x41b5fc){var _0x1bee46=_0x41b5fc[_0xa30e('0x1c')],_0x4da81f=_0x17f826[_0xa30e('0x1d')],_0x537c18=_0x17f826[_0xa30e('0x1d')]+_0x17f826[_0xa30e('0x1e')],_0x54aae2;if(_0x537c18>=_0x1bee46){_0x537c18=_0x1bee46;_0x54aae2=0xc8;}else{_0x54aae2=0xce;}_0x3585b1['status'](_0x54aae2);return _0x3585b1[_0xa30e('0x1f')]('Content-Range',_0x4da81f+'-'+_0x537c18+'/'+_0x1bee46)[_0xa30e('0x1b')](_0x41b5fc);}return null;};}function patchUpdates(_0x4b162a){return function(_0x751e30){try{jsonpatch[_0xa30e('0x20')](_0x751e30,_0x4b162a,!![]);}catch(_0x1ffe4f){return BPromise[_0xa30e('0x21')](_0x1ffe4f);}return _0x751e30[_0xa30e('0x22')]();};}function saveUpdates(_0x49f311,_0x4f68b8){return function(_0x149b21){if(_0x149b21){return _0x149b21['update'](_0x49f311)[_0xa30e('0x23')](function(_0x168834){return _0x168834;});}return null;};}function removeEntity(_0x532ba4,_0x562c7a){return function(_0x3abfaf){if(_0x3abfaf){return _0x3abfaf[_0xa30e('0x24')]()[_0xa30e('0x23')](function(){var _0x2964c3=_0x3abfaf[_0xa30e('0x25')]({'plain':!![]});var _0x29fe31=_0xa30e('0x26');return db[_0xa30e('0x27')]['destroy']({'where':{'type':_0x29fe31,'resourceId':_0x2964c3['id']}})[_0xa30e('0x23')](function(){return _0x3abfaf;});})[_0xa30e('0x23')](function(){_0x532ba4[_0xa30e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a121,_0x2ff2c3){return function(_0x36bd2e){if(!_0x36bd2e){_0x12a121[_0xa30e('0x19')](0x194);}return _0x36bd2e;};}function handleError(_0x4c3434,_0x1b6ed7){_0x1b6ed7=_0x1b6ed7||0x1f4;return function(_0x5ee588){logger['error'](_0x5ee588[_0xa30e('0x28')]);if(_0x5ee588[_0xa30e('0x29')]){delete _0x5ee588[_0xa30e('0x29')];}_0x4c3434[_0xa30e('0x1a')](_0x1b6ed7)[_0xa30e('0x2a')](_0x5ee588);};}exports['index']=function(_0x511cf2,_0x3327b5){var _0x420940={},_0x130461={},_0x5abf93={'count':0x0,'rows':[]};var _0x59b0ae=_['map'](db[_0xa30e('0x2b')][_0xa30e('0x2c')],function(_0x560a81){return{'name':_0x560a81[_0xa30e('0x2d')],'type':_0x560a81[_0xa30e('0x2e')]['key']};});_0x130461['model']=_[_0xa30e('0x2f')](_0x59b0ae,_0xa30e('0x29'));_0x130461[_0xa30e('0x30')]=_[_0xa30e('0x31')](_0x511cf2[_0xa30e('0x30')]);_0x130461[_0xa30e('0x32')]=_['intersection'](_0x130461[_0xa30e('0x33')],_0x130461[_0xa30e('0x30')]);_0x420940[_0xa30e('0x34')]=_[_0xa30e('0x35')](_0x130461[_0xa30e('0x33')],qs[_0xa30e('0x36')](_0x511cf2[_0xa30e('0x30')][_0xa30e('0x36')]));_0x420940[_0xa30e('0x34')]=_0x420940['attributes']['length']?_0x420940[_0xa30e('0x34')]:_0x130461[_0xa30e('0x33')];if(!_0x511cf2[_0xa30e('0x30')][_0xa30e('0x37')](_0xa30e('0x38'))){_0x420940['limit']=qs[_0xa30e('0x1e')](_0x511cf2[_0xa30e('0x30')][_0xa30e('0x1e')]);_0x420940[_0xa30e('0x1d')]=qs[_0xa30e('0x1d')](_0x511cf2[_0xa30e('0x30')][_0xa30e('0x1d')]);}_0x420940['order']=qs[_0xa30e('0x39')](_0x511cf2['query'][_0xa30e('0x39')]);_0x420940[_0xa30e('0x3a')]=qs['filters'](_[_0xa30e('0x3b')](_0x511cf2[_0xa30e('0x30')],_0x130461[_0xa30e('0x32')]),_0x59b0ae);if(_0x511cf2[_0xa30e('0x30')][_0xa30e('0x3c')]){_0x420940[_0xa30e('0x3a')]=_[_0xa30e('0x3d')](_0x420940['where'],{'$or':_[_0xa30e('0x2f')](_0x59b0ae,function(_0xe39a9){if(_0xe39a9[_0xa30e('0x2e')]!==_0xa30e('0x3e')){var _0x4bfcd7={};_0x4bfcd7[_0xe39a9['name']]={'$like':'%'+_0x511cf2['query'][_0xa30e('0x3c')]+'%'};return _0x4bfcd7;}})});}_0x420940=_[_0xa30e('0x3d')]({},_0x420940,_0x511cf2[_0xa30e('0x3f')]);var _0x3ba1a9={'where':_0x420940['where']};return db['Variable'][_0xa30e('0x1c')](_0x3ba1a9)[_0xa30e('0x23')](function(_0x2a2f22){_0x5abf93['count']=_0x2a2f22;if(_0x511cf2[_0xa30e('0x30')][_0xa30e('0x40')]){_0x420940[_0xa30e('0x41')]=[{'all':!![]}];}return db[_0xa30e('0x2b')]['findAll'](_0x420940);})[_0xa30e('0x23')](function(_0x227c5e){_0x5abf93[_0xa30e('0x42')]=_0x227c5e;return _0x5abf93;})['then'](respondWithFilteredResult(_0x3327b5,_0x420940))[_0xa30e('0x43')](handleError(_0x3327b5,null));};exports['show']=function(_0x27c91c,_0x29bc5b){var _0x2fea34={'raw':!![],'where':{'id':_0x27c91c[_0xa30e('0x44')]['id']}},_0x1729b9={};_0x1729b9[_0xa30e('0x33')]=_[_0xa30e('0x31')](db[_0xa30e('0x2b')][_0xa30e('0x2c')]);_0x1729b9[_0xa30e('0x30')]=_[_0xa30e('0x31')](_0x27c91c[_0xa30e('0x30')]);_0x1729b9[_0xa30e('0x32')]=_['intersection'](_0x1729b9[_0xa30e('0x33')],_0x1729b9['query']);_0x2fea34[_0xa30e('0x34')]=_[_0xa30e('0x35')](_0x1729b9[_0xa30e('0x33')],qs['fields'](_0x27c91c['query']['fields']));_0x2fea34[_0xa30e('0x34')]=_0x2fea34[_0xa30e('0x34')][_0xa30e('0x45')]?_0x2fea34['attributes']:_0x1729b9[_0xa30e('0x33')];if(_0x27c91c[_0xa30e('0x30')][_0xa30e('0x40')]){_0x2fea34[_0xa30e('0x41')]=[{'all':!![]}];}_0x2fea34=_[_0xa30e('0x3d')]({},_0x2fea34,_0x27c91c['options']);return db[_0xa30e('0x2b')][_0xa30e('0x46')](_0x2fea34)['then'](handleEntityNotFound(_0x29bc5b,null))['then'](respondWithResult(_0x29bc5b,null))[_0xa30e('0x43')](handleError(_0x29bc5b,null));};exports[_0xa30e('0x47')]=function(_0x433f0a,_0x484512){return db[_0xa30e('0x2b')]['create'](_0x433f0a[_0xa30e('0x48')],{})[_0xa30e('0x23')](function(_0x550296){var _0xd87098=_0x433f0a[_0xa30e('0x49')][_0xa30e('0x25')]({'plain':!![]});if(!_0xd87098)throw new Error(_0xa30e('0x4a'));if(_0xd87098[_0xa30e('0x4b')]==='user'){var _0x3f90b9=_0x550296['get']({'plain':!![]});var _0x2fc46c=_0xa30e('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x2fc46c,'userProfileId':_0xd87098[_0xa30e('0x4c')]},'raw':!![]})['then'](function(_0x1e05fa){if(_0x1e05fa&&_0x1e05fa['autoAssociation']===0x0){return db[_0xa30e('0x27')][_0xa30e('0x47')]({'name':_0x3f90b9[_0xa30e('0x29')],'resourceId':_0x3f90b9['id'],'type':_0x1e05fa[_0xa30e('0x29')],'sectionId':_0x1e05fa['id']},{})[_0xa30e('0x23')](function(){return _0x550296;});}else{return _0x550296;}})[_0xa30e('0x43')](function(_0xde73aa){logger[_0xa30e('0x4d')](_0xa30e('0x4e'),_0xde73aa);throw _0xde73aa;});}return _0x550296;})[_0xa30e('0x23')](respondWithResult(_0x484512,0xc9))[_0xa30e('0x43')](handleError(_0x484512,null));};exports['update']=function(_0x3cdeae,_0x4ce53f){if(_0x3cdeae[_0xa30e('0x48')]['id']){delete _0x3cdeae[_0xa30e('0x48')]['id'];}return db['Variable'][_0xa30e('0x46')]({'where':{'id':_0x3cdeae[_0xa30e('0x44')]['id']}})[_0xa30e('0x23')](handleEntityNotFound(_0x4ce53f,null))['then'](saveUpdates(_0x3cdeae[_0xa30e('0x48')],null))[_0xa30e('0x23')](respondWithResult(_0x4ce53f,null))[_0xa30e('0x43')](handleError(_0x4ce53f,null));};exports[_0xa30e('0x24')]=function(_0xf13c8c,_0x233234){return db['Variable'][_0xa30e('0x46')]({'where':{'id':_0xf13c8c['params']['id']}})['then'](handleEntityNotFound(_0x233234,null))[_0xa30e('0x23')](removeEntity(_0x233234,null))[_0xa30e('0x43')](handleError(_0x233234,null));}; \ No newline at end of file +var _0x9ba4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Variables','error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','catch','show','keys','find','create','body','role','user','UserProfileSection','update','params','html-pdf','eml-format','fast-json-patch','mustache','util','sox','ejs','lodash','squel','jsforce','querystring','papaparse'];(function(_0x572b94,_0x3e89b0){var _0x4fce25=function(_0x1b5891){while(--_0x1b5891){_0x572b94['push'](_0x572b94['shift']());}};_0x4fce25(++_0x3e89b0);}(_0x9ba4,0x11c));var _0x49ba=function(_0x2d635d,_0x28c0a2){_0x2d635d=_0x2d635d-0x0;var _0x300599=_0x9ba4[_0x2d635d];return _0x300599;};'use strict';var pdf=require(_0x49ba('0x0'));var emlformat=require(_0x49ba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x49ba('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x49ba('0x3'));var util=require(_0x49ba('0x4'));var path=require('path');var sox=require(_0x49ba('0x5'));var csv=require('to-csv');var ejs=require(_0x49ba('0x6'));var fs=require('fs');var _=require(_0x49ba('0x7'));var squel=require(_0x49ba('0x8'));var crypto=require('crypto');var jsforce=require(_0x49ba('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49ba('0xa'));var Papa=require(_0x49ba('0xb'));var Redis=require(_0x49ba('0xc'));var authService=require(_0x49ba('0xd'));var qs=require(_0x49ba('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49ba('0xf'));var logger=require(_0x49ba('0x10'))('api');var utils=require(_0x49ba('0x11'));var config=require(_0x49ba('0x12'));var licenseUtil=require(_0x49ba('0x13'));var db=require(_0x49ba('0x14'))['db'];function respondWithStatusCode(_0x42135c,_0x596f84){_0x596f84=_0x596f84||0xcc;return function(_0xa81aaf){if(_0xa81aaf){return _0x42135c[_0x49ba('0x15')](_0x596f84);}return _0x42135c[_0x49ba('0x16')](_0x596f84)[_0x49ba('0x17')]();};}function respondWithResult(_0x318be4,_0x25cc78){_0x25cc78=_0x25cc78||0xc8;return function(_0x53ee0e){if(_0x53ee0e){return _0x318be4[_0x49ba('0x16')](_0x25cc78)[_0x49ba('0x18')](_0x53ee0e);}};}function respondWithFilteredResult(_0x2d1b83,_0xf532a0){return function(_0x121ca6){if(_0x121ca6){var _0x54344b=_0x121ca6[_0x49ba('0x19')],_0x1aa267=_0xf532a0[_0x49ba('0x1a')],_0x4505ac=_0xf532a0[_0x49ba('0x1a')]+_0xf532a0[_0x49ba('0x1b')],_0x4f79e6;if(_0x4505ac>=_0x54344b){_0x4505ac=_0x54344b;_0x4f79e6=0xc8;}else{_0x4f79e6=0xce;}_0x2d1b83[_0x49ba('0x16')](_0x4f79e6);return _0x2d1b83[_0x49ba('0x1c')](_0x49ba('0x1d'),_0x1aa267+'-'+_0x4505ac+'/'+_0x54344b)[_0x49ba('0x18')](_0x121ca6);}return null;};}function patchUpdates(_0x22b330){return function(_0x2e835d){try{jsonpatch[_0x49ba('0x1e')](_0x2e835d,_0x22b330,!![]);}catch(_0x521d55){return BPromise[_0x49ba('0x1f')](_0x521d55);}return _0x2e835d[_0x49ba('0x20')]();};}function saveUpdates(_0x4b34d1,_0x50783f){return function(_0x4fe5b0){if(_0x4fe5b0){return _0x4fe5b0['update'](_0x4b34d1)['then'](function(_0x5c37a0){return _0x5c37a0;});}return null;};}function removeEntity(_0x3177fe,_0x4237c8){return function(_0x5ab7d2){if(_0x5ab7d2){return _0x5ab7d2[_0x49ba('0x21')]()[_0x49ba('0x22')](function(){var _0x34e214=_0x5ab7d2[_0x49ba('0x23')]({'plain':!![]});var _0x26f8b6=_0x49ba('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x26f8b6,'resourceId':_0x34e214['id']}})[_0x49ba('0x22')](function(){return _0x5ab7d2;});})[_0x49ba('0x22')](function(){_0x3177fe[_0x49ba('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461991,_0x4a1f20){return function(_0x4bfd7f){if(!_0x4bfd7f){_0x461991[_0x49ba('0x15')](0x194);}return _0x4bfd7f;};}function handleError(_0x7d380b,_0x12ef5b){_0x12ef5b=_0x12ef5b||0x1f4;return function(_0x424cf8){logger[_0x49ba('0x25')](_0x424cf8['stack']);if(_0x424cf8[_0x49ba('0x26')]){delete _0x424cf8[_0x49ba('0x26')];}_0x7d380b[_0x49ba('0x16')](_0x12ef5b)[_0x49ba('0x27')](_0x424cf8);};}exports[_0x49ba('0x28')]=function(_0x1559cf,_0x1e68b7){var _0x145fa3={},_0x4602d8={},_0x217cc0={'count':0x0,'rows':[]};var _0x45dd5=_[_0x49ba('0x29')](db['Variable'][_0x49ba('0x2a')],function(_0x5df8cb){return{'name':_0x5df8cb['fieldName'],'type':_0x5df8cb[_0x49ba('0x2b')][_0x49ba('0x2c')]};});_0x4602d8[_0x49ba('0x2d')]=_['map'](_0x45dd5,'name');_0x4602d8[_0x49ba('0x2e')]=_['keys'](_0x1559cf[_0x49ba('0x2e')]);_0x4602d8[_0x49ba('0x2f')]=_[_0x49ba('0x30')](_0x4602d8['model'],_0x4602d8['query']);_0x145fa3[_0x49ba('0x31')]=_[_0x49ba('0x30')](_0x4602d8['model'],qs['fields'](_0x1559cf['query'][_0x49ba('0x32')]));_0x145fa3[_0x49ba('0x31')]=_0x145fa3[_0x49ba('0x31')][_0x49ba('0x33')]?_0x145fa3[_0x49ba('0x31')]:_0x4602d8['model'];if(!_0x1559cf[_0x49ba('0x2e')][_0x49ba('0x34')]('nolimit')){_0x145fa3[_0x49ba('0x1b')]=qs[_0x49ba('0x1b')](_0x1559cf[_0x49ba('0x2e')]['limit']);_0x145fa3[_0x49ba('0x1a')]=qs[_0x49ba('0x1a')](_0x1559cf[_0x49ba('0x2e')][_0x49ba('0x1a')]);}_0x145fa3['order']=qs['sort'](_0x1559cf[_0x49ba('0x2e')][_0x49ba('0x35')]);_0x145fa3[_0x49ba('0x36')]=qs[_0x49ba('0x2f')](_['pick'](_0x1559cf[_0x49ba('0x2e')],_0x4602d8[_0x49ba('0x2f')]),_0x45dd5);if(_0x1559cf[_0x49ba('0x2e')][_0x49ba('0x37')]){_0x145fa3[_0x49ba('0x36')]=_[_0x49ba('0x38')](_0x145fa3[_0x49ba('0x36')],{'$or':_[_0x49ba('0x29')](_0x45dd5,function(_0x41c52d){if(_0x41c52d[_0x49ba('0x2b')]!==_0x49ba('0x39')){var _0x1fc33f={};_0x1fc33f[_0x41c52d[_0x49ba('0x26')]]={'$like':'%'+_0x1559cf[_0x49ba('0x2e')][_0x49ba('0x37')]+'%'};return _0x1fc33f;}})});}_0x145fa3=_[_0x49ba('0x38')]({},_0x145fa3,_0x1559cf[_0x49ba('0x3a')]);var _0x1753af={'where':_0x145fa3[_0x49ba('0x36')]};return db[_0x49ba('0x3b')][_0x49ba('0x19')](_0x1753af)[_0x49ba('0x22')](function(_0x4376eb){_0x217cc0[_0x49ba('0x19')]=_0x4376eb;if(_0x1559cf['query'][_0x49ba('0x3c')]){_0x145fa3[_0x49ba('0x3d')]=[{'all':!![]}];}return db[_0x49ba('0x3b')][_0x49ba('0x3e')](_0x145fa3);})[_0x49ba('0x22')](function(_0x256abd){_0x217cc0['rows']=_0x256abd;return _0x217cc0;})[_0x49ba('0x22')](respondWithFilteredResult(_0x1e68b7,_0x145fa3))[_0x49ba('0x3f')](handleError(_0x1e68b7,null));};exports[_0x49ba('0x40')]=function(_0xb2fcb7,_0x12ad84){var _0x51a1a2={'raw':!![],'where':{'id':_0xb2fcb7['params']['id']}},_0x1eef28={};_0x1eef28[_0x49ba('0x2d')]=_[_0x49ba('0x41')](db[_0x49ba('0x3b')]['rawAttributes']);_0x1eef28[_0x49ba('0x2e')]=_[_0x49ba('0x41')](_0xb2fcb7[_0x49ba('0x2e')]);_0x1eef28[_0x49ba('0x2f')]=_[_0x49ba('0x30')](_0x1eef28[_0x49ba('0x2d')],_0x1eef28[_0x49ba('0x2e')]);_0x51a1a2['attributes']=_[_0x49ba('0x30')](_0x1eef28[_0x49ba('0x2d')],qs[_0x49ba('0x32')](_0xb2fcb7[_0x49ba('0x2e')][_0x49ba('0x32')]));_0x51a1a2['attributes']=_0x51a1a2[_0x49ba('0x31')]['length']?_0x51a1a2[_0x49ba('0x31')]:_0x1eef28[_0x49ba('0x2d')];if(_0xb2fcb7[_0x49ba('0x2e')][_0x49ba('0x3c')]){_0x51a1a2['include']=[{'all':!![]}];}_0x51a1a2=_[_0x49ba('0x38')]({},_0x51a1a2,_0xb2fcb7[_0x49ba('0x3a')]);return db[_0x49ba('0x3b')][_0x49ba('0x42')](_0x51a1a2)[_0x49ba('0x22')](handleEntityNotFound(_0x12ad84,null))[_0x49ba('0x22')](respondWithResult(_0x12ad84,null))[_0x49ba('0x3f')](handleError(_0x12ad84,null));};exports[_0x49ba('0x43')]=function(_0x16a470,_0x56a173){return db[_0x49ba('0x3b')]['create'](_0x16a470[_0x49ba('0x44')],{})['then'](function(_0x195b68){var _0x1c7fd7=_0x16a470['user']['get']({'plain':!![]});if(!_0x1c7fd7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c7fd7[_0x49ba('0x45')]===_0x49ba('0x46')){var _0x3f253f=_0x195b68[_0x49ba('0x23')]({'plain':!![]});var _0x54efdd='Variables';return db[_0x49ba('0x47')][_0x49ba('0x42')]({'where':{'name':_0x54efdd,'userProfileId':_0x1c7fd7['userProfileId']},'raw':!![]})[_0x49ba('0x22')](function(_0x5e9cf3){if(_0x5e9cf3&&_0x5e9cf3['autoAssociation']===0x0){return db['UserProfileResource'][_0x49ba('0x43')]({'name':_0x3f253f[_0x49ba('0x26')],'resourceId':_0x3f253f['id'],'type':_0x5e9cf3['name'],'sectionId':_0x5e9cf3['id']},{})[_0x49ba('0x22')](function(){return _0x195b68;});}else{return _0x195b68;}})['catch'](function(_0xf18215){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf18215);throw _0xf18215;});}return _0x195b68;})[_0x49ba('0x22')](respondWithResult(_0x56a173,0xc9))['catch'](handleError(_0x56a173,null));};exports[_0x49ba('0x48')]=function(_0x2a0402,_0x5b79b6){if(_0x2a0402['body']['id']){delete _0x2a0402['body']['id'];}return db[_0x49ba('0x3b')][_0x49ba('0x42')]({'where':{'id':_0x2a0402['params']['id']}})[_0x49ba('0x22')](handleEntityNotFound(_0x5b79b6,null))[_0x49ba('0x22')](saveUpdates(_0x2a0402[_0x49ba('0x44')],null))['then'](respondWithResult(_0x5b79b6,null))[_0x49ba('0x3f')](handleError(_0x5b79b6,null));};exports[_0x49ba('0x21')]=function(_0x4a316c,_0x524837){return db[_0x49ba('0x3b')][_0x49ba('0x42')]({'where':{'id':_0x4a316c[_0x49ba('0x49')]['id']}})['then'](handleEntityNotFound(_0x524837,null))['then'](removeEntity(_0x524837,null))[_0x49ba('0x3f')](handleError(_0x524837,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 78be0e1..3c58fd4 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 _0x0f61=['tools_variables','util','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x1fad56,_0x46bf0f){var _0x2eb51a=function(_0x47a592){while(--_0x47a592){_0x1fad56['push'](_0x1fad56['shift']());}};_0x2eb51a(++_0x46bf0f);}(_0x0f61,0xa6));var _0x10f6=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0x0f61[_0x2d460c];return _0xf6fc4c;};'use strict';var _=require('lodash');var util=require(_0x10f6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x10f6('0x1'));var BPromise=require(_0x10f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10f6('0x3'));var rimraf=require(_0x10f6('0x4'));var config=require(_0x10f6('0x5'));var attributes=require(_0x10f6('0x6'));module[_0x10f6('0x7')]=function(_0x3f7624,_0x14defc){return _0x3f7624[_0x10f6('0x8')](_0x10f6('0x9'),attributes,{'tableName':_0x10f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10bd=['tools_variables','util','api','moment','path','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x7697cf,_0x40d922){var _0x1d0a51=function(_0x22f3cb){while(--_0x22f3cb){_0x7697cf['push'](_0x7697cf['shift']());}};_0x1d0a51(++_0x40d922);}(_0x10bd,0x97));var _0xd10b=function(_0x1e2290,_0xd8fe03){_0x1e2290=_0x1e2290-0x0;var _0x1c17f3=_0x10bd[_0x1e2290];return _0x1c17f3;};'use strict';var _=require('lodash');var util=require(_0xd10b('0x0'));var logger=require('../../config/logger')(_0xd10b('0x1'));var moment=require(_0xd10b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd10b('0x3'));var rimraf=require(_0xd10b('0x4'));var config=require(_0xd10b('0x5'));var attributes=require(_0xd10b('0x6'));module['exports']=function(_0xab72c9,_0x14540c){return _0xab72c9[_0xd10b('0x7')](_0xd10b('0x8'),attributes,{'tableName':_0xd10b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 8075877..46eceec 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 _0xc565=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Variable','options','raw','where','attributes','include','model','map','ShowVariable','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5b4e80,_0x3113d2){var _0x2bac9b=function(_0x361e1a){while(--_0x361e1a){_0x5b4e80['push'](_0x5b4e80['shift']());}};_0x2bac9b(++_0x3113d2);}(_0xc565,0x1cb));var _0x5c56=function(_0x57716a,_0x8b931f){_0x57716a=_0x57716a-0x0;var _0x3549df=_0xc565[_0x57716a];return _0x3549df;};'use strict';var _=require(_0x5c56('0x0'));var util=require(_0x5c56('0x1'));var moment=require(_0x5c56('0x2'));var BPromise=require(_0x5c56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c56('0x4'));var db=require(_0x5c56('0x5'))['db'];var utils=require(_0x5c56('0x6'));var logger=require('../../config/logger')(_0x5c56('0x7'));var config=require(_0x5c56('0x8'));var jayson=require(_0x5c56('0x9'));var client=jayson[_0x5c56('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf731b1,_0x2d5ab0,_0x45220d){return new BPromise(function(_0x504890,_0x323123){return client['request'](_0xf731b1,_0x45220d)[_0x5c56('0xb')](function(_0x54f03b){logger[_0x5c56('0xc')](_0x5c56('0xd'),_0x2d5ab0,_0x5c56('0xe'));logger[_0x5c56('0xf')](_0x5c56('0x10'),_0x2d5ab0,'request\x20sent',JSON[_0x5c56('0x11')](_0x54f03b));if(_0x54f03b[_0x5c56('0x12')]){if(_0x54f03b[_0x5c56('0x12')][_0x5c56('0x13')]===0x1f4){logger['error'](_0x5c56('0xd'),_0x2d5ab0,_0x54f03b[_0x5c56('0x12')][_0x5c56('0x14')]);return _0x323123(_0x54f03b[_0x5c56('0x12')][_0x5c56('0x14')]);}logger['error'](_0x5c56('0xd'),_0x2d5ab0,_0x54f03b[_0x5c56('0x12')][_0x5c56('0x14')]);return _0x504890(_0x54f03b['error']['message']);}else{logger[_0x5c56('0xc')](_0x5c56('0xd'),_0x2d5ab0,_0x5c56('0xe'));_0x504890(_0x54f03b[_0x5c56('0x15')][_0x5c56('0x14')]);}})['catch'](function(_0x1518af){logger[_0x5c56('0x12')](_0x5c56('0xd'),_0x2d5ab0,_0x1518af);_0x323123(_0x1518af);});});}exports['ShowVariable']=function(_0x53b4a3){var _0x3dda4e=this;return new Promise(function(_0x33fa92,_0x4d501e){return db[_0x5c56('0x16')]['find']({'raw':_0x53b4a3[_0x5c56('0x17')]?_0x53b4a3[_0x5c56('0x17')][_0x5c56('0x18')]===undefined?!![]:![]:!![],'where':_0x53b4a3['options']?_0x53b4a3['options'][_0x5c56('0x19')]||null:null,'attributes':_0x53b4a3['options']?_0x53b4a3[_0x5c56('0x17')][_0x5c56('0x1a')]||null:null,'include':_0x53b4a3[_0x5c56('0x17')]?_0x53b4a3[_0x5c56('0x17')][_0x5c56('0x1b')]?_['map'](_0x53b4a3[_0x5c56('0x17')][_0x5c56('0x1b')],function(_0x14251e){return{'model':db[_0x14251e[_0x5c56('0x1c')]],'as':_0x14251e['as'],'attributes':_0x14251e[_0x5c56('0x1a')],'include':_0x14251e[_0x5c56('0x1b')]?_['map'](_0x14251e[_0x5c56('0x1b')],function(_0x3e70f1){return{'model':db[_0x3e70f1[_0x5c56('0x1c')]],'as':_0x3e70f1['as'],'attributes':_0x3e70f1['attributes'],'include':_0x3e70f1['include']?_[_0x5c56('0x1d')](_0x3e70f1[_0x5c56('0x1b')],function(_0xc4f325){return{'model':db[_0xc4f325[_0x5c56('0x1c')]],'as':_0xc4f325['as'],'attributes':_0xc4f325[_0x5c56('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5c56('0xb')](function(_0xd37ab6){logger[_0x5c56('0xc')](_0x5c56('0x1e'),_0x53b4a3);logger[_0x5c56('0xf')]('ShowVariable',_0x53b4a3,JSON[_0x5c56('0x11')](_0xd37ab6));_0x33fa92(_0xd37ab6);})['catch'](function(_0x2a67e3){logger[_0x5c56('0x12')](_0x5c56('0x1e'),_0x2a67e3[_0x5c56('0x14')],_0x53b4a3);_0x4d501e(_0x3dda4e[_0x5c56('0x12')](0x1f4,_0x2a67e3[_0x5c56('0x14')]));});});}; \ No newline at end of file +var _0x95b0=['result','ShowVariable','find','options','raw','where','include','map','model','attributes','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x95b0,0xd2));var _0x095b=function(_0x153bf1,_0x5d0520){_0x153bf1=_0x153bf1-0x0;var _0xca13d0=_0x95b0[_0x153bf1];return _0xca13d0;};'use strict';var _=require(_0x095b('0x0'));var util=require(_0x095b('0x1'));var moment=require(_0x095b('0x2'));var BPromise=require(_0x095b('0x3'));var rs=require(_0x095b('0x4'));var fs=require('fs');var Redis=require(_0x095b('0x5'));var db=require(_0x095b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x095b('0x7'))(_0x095b('0x8'));var config=require(_0x095b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x095b('0xa')][_0x095b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c4374,_0x13f4eb,_0x3fe465){return new BPromise(function(_0x2efc9d,_0x29b5ea){return client[_0x095b('0xc')](_0x3c4374,_0x3fe465)['then'](function(_0x23c93a){logger[_0x095b('0xd')](_0x095b('0xe'),_0x13f4eb,_0x095b('0xf'));logger[_0x095b('0x10')](_0x095b('0x11'),_0x13f4eb,'request\x20sent',JSON[_0x095b('0x12')](_0x23c93a));if(_0x23c93a[_0x095b('0x13')]){if(_0x23c93a[_0x095b('0x13')]['code']===0x1f4){logger[_0x095b('0x13')](_0x095b('0xe'),_0x13f4eb,_0x23c93a[_0x095b('0x13')][_0x095b('0x14')]);return _0x29b5ea(_0x23c93a['error'][_0x095b('0x14')]);}logger[_0x095b('0x13')]('Variable,\x20%s,\x20%s',_0x13f4eb,_0x23c93a['error'][_0x095b('0x14')]);return _0x2efc9d(_0x23c93a[_0x095b('0x13')][_0x095b('0x14')]);}else{logger['info'](_0x095b('0xe'),_0x13f4eb,_0x095b('0xf'));_0x2efc9d(_0x23c93a[_0x095b('0x15')][_0x095b('0x14')]);}})['catch'](function(_0x1bab4d){logger[_0x095b('0x13')]('Variable,\x20%s,\x20%s',_0x13f4eb,_0x1bab4d);_0x29b5ea(_0x1bab4d);});});}exports[_0x095b('0x16')]=function(_0x2d5574){var _0x37e03b=this;return new Promise(function(_0x38ee47,_0x1ec49c){return db['Variable'][_0x095b('0x17')]({'raw':_0x2d5574[_0x095b('0x18')]?_0x2d5574[_0x095b('0x18')][_0x095b('0x19')]===undefined?!![]:![]:!![],'where':_0x2d5574['options']?_0x2d5574[_0x095b('0x18')][_0x095b('0x1a')]||null:null,'attributes':_0x2d5574['options']?_0x2d5574[_0x095b('0x18')]['attributes']||null:null,'include':_0x2d5574[_0x095b('0x18')]?_0x2d5574['options'][_0x095b('0x1b')]?_[_0x095b('0x1c')](_0x2d5574[_0x095b('0x18')][_0x095b('0x1b')],function(_0xf6b5ad){return{'model':db[_0xf6b5ad[_0x095b('0x1d')]],'as':_0xf6b5ad['as'],'attributes':_0xf6b5ad[_0x095b('0x1e')],'include':_0xf6b5ad[_0x095b('0x1b')]?_[_0x095b('0x1c')](_0xf6b5ad[_0x095b('0x1b')],function(_0xbca02f){return{'model':db[_0xbca02f[_0x095b('0x1d')]],'as':_0xbca02f['as'],'attributes':_0xbca02f[_0x095b('0x1e')],'include':_0xbca02f[_0x095b('0x1b')]?_[_0x095b('0x1c')](_0xbca02f[_0x095b('0x1b')],function(_0x1a6b00){return{'model':db[_0x1a6b00['model']],'as':_0x1a6b00['as'],'attributes':_0x1a6b00['attributes']};}):[]};}):[]};}):[]:[]})[_0x095b('0x1f')](function(_0x13a313){logger['info'](_0x095b('0x16'),_0x2d5574);logger[_0x095b('0x10')](_0x095b('0x16'),_0x2d5574,JSON[_0x095b('0x12')](_0x13a313));_0x38ee47(_0x13a313);})[_0x095b('0x20')](function(_0x2d98cc){logger[_0x095b('0x13')](_0x095b('0x16'),_0x2d98cc[_0x095b('0x14')],_0x2d5574);_0x1ec49c(_0x37e03b[_0x095b('0x13')](0x1f4,_0x2d98cc[_0x095b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6c0e53e..4f7670a 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 _0xfc84=['get','index','/fetch','canUpdate','reset','/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x53217c,_0x1755e7){var _0x56e1be=function(_0x20528d){while(--_0x20528d){_0x53217c['push'](_0x53217c['shift']());}};_0x56e1be(++_0x1755e7);}(_0xfc84,0xdd));var _0x4fc8=function(_0x3fe78a,_0x597989){_0x3fe78a=_0x3fe78a-0x0;var _0x4ae1f4=_0xfc84[_0x3fe78a];return _0x4ae1f4;};'use strict';var express=require(_0x4fc8('0x0'));var router=express[_0x4fc8('0x1')]();var auth=require(_0x4fc8('0x2'));var controller=require(_0x4fc8('0x3'));router[_0x4fc8('0x4')]('/',controller[_0x4fc8('0x5')]);router[_0x4fc8('0x4')](_0x4fc8('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller['fetch']);router['get']('/reset',auth['isAuthenticated'](),auth[_0x4fc8('0x7')](),controller[_0x4fc8('0x8')]);router[_0x4fc8('0x4')](_0x4fc8('0x9'),auth['isAuthenticated'](),auth[_0x4fc8('0x7')](),controller[_0x4fc8('0xa')]);router[_0x4fc8('0x4')](_0x4fc8('0xb'),auth['isAuthenticated'](),controller[_0x4fc8('0xc')]);router[_0x4fc8('0x4')](_0x4fc8('0xd'),controller['migrations']);module[_0x4fc8('0xe')]=router; \ No newline at end of file +var _0xf980=['/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','exports','Router','../../components/auth/service','./version.controller','index','get'];(function(_0x3cac17,_0x174a50){var _0x38e3be=function(_0x10e160){while(--_0x10e160){_0x3cac17['push'](_0x3cac17['shift']());}};_0x38e3be(++_0x174a50);}(_0xf980,0x1cf));var _0x0f98=function(_0x3e1829,_0xc8ccda){_0x3e1829=_0x3e1829-0x0;var _0x129345=_0xf980[_0x3e1829];return _0x129345;};'use strict';var express=require('express');var router=express[_0x0f98('0x0')]();var auth=require(_0x0f98('0x1'));var controller=require(_0x0f98('0x2'));router['get']('/',controller[_0x0f98('0x3')]);router[_0x0f98('0x4')](_0x0f98('0x5'),auth['isAuthenticated'](),auth[_0x0f98('0x6')](),controller[_0x0f98('0x7')]);router[_0x0f98('0x4')](_0x0f98('0x8'),auth[_0x0f98('0x9')](),auth[_0x0f98('0x6')](),controller[_0x0f98('0xa')]);router[_0x0f98('0x4')](_0x0f98('0xb'),auth[_0x0f98('0x9')](),auth['canUpdate'](),controller['pull']);router[_0x0f98('0x4')]('/restart',auth[_0x0f98('0x9')](),controller['restart']);router[_0x0f98('0x4')]('/migrations',controller['migrations']);module[_0x0f98('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 13f84c2..011aaaf 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 _0xacc6=['master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','server','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin'];(function(_0x4e7932,_0xbce8b9){var _0x32e863=function(_0x3380fe){while(--_0x3380fe){_0x4e7932['push'](_0x4e7932['shift']());}};_0x32e863(++_0xbce8b9);}(_0xacc6,0x150));var _0x6acc=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xacc6[_0x318410];return _0x2898a3;};'use strict';var Umzug=require(_0x6acc('0x0'));var path=require(_0x6acc('0x1'));var fs=require('fs');var _=require(_0x6acc('0x2'));var pkginfo=require(_0x6acc('0x3'))(module,_0x6acc('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x6acc('0x5'))[_0x6acc('0x6')];var db=require(_0x6acc('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x6acc('0x8'));var logger=require('../../config/logger')(_0x6acc('0x9'));var git=require(_0x6acc('0xa'))(config['root']);exports[_0x6acc('0xb')]=function(_0x48b1a8,_0x1f95e8){var _0x538730={'current':module[_0x6acc('0xc')][_0x6acc('0x4')],'phonebar':0x2};if(_0x48b1a8['query']&&_0x48b1a8[_0x6acc('0xd')]['latest']){return git[_0x6acc('0xe')]()[_0x6acc('0xf')](function(_0xb8647d,_0x112778){_0x538730[_0x6acc('0x10')]=(_0xb8647d?module[_0x6acc('0xc')]['version']:_0x112778[_0x6acc('0x10')])||_0x6acc('0x11');return _0x1f95e8[_0x6acc('0x12')](0xc8)[_0x6acc('0x13')](_0x538730);});}else{return _0x1f95e8[_0x6acc('0x12')](0xc8)['json'](_0x538730);}};exports['fetch']=function(_0x15674a,_0x497356){return git[_0x6acc('0xe')]([_0x6acc('0x14'),_0x6acc('0x15')],function(_0x2e3e01){if(_0x2e3e01){logger[_0x6acc('0x16')](_0x2e3e01);return _0x497356[_0x6acc('0x12')](0x1f4)[_0x6acc('0x13')](_0x2e3e01);}logger[_0x6acc('0x17')](_0x6acc('0x18'));return _0x497356[_0x6acc('0x12')](0xc8)[_0x6acc('0x13')]({'output':_0x6acc('0x19')});});};exports[_0x6acc('0x1a')]=function(_0x4c7f9f,_0x3818d8){return git[_0x6acc('0x1a')](['--hard',_0x6acc('0x1b')],function(_0x43b8ca){if(_0x43b8ca){logger[_0x6acc('0x16')](_0x43b8ca);return _0x3818d8[_0x6acc('0x12')](0x1f4)['json'](_0x43b8ca);}logger[_0x6acc('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3818d8['status'](0xc8)[_0x6acc('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x6acc('0x1c')]=function(_0x3edf4a,_0x3c34f9){exec(_0x6acc('0x1d'),function(_0x245536,_0x5ecb25,_0x3e4a71){logger[_0x6acc('0x17')](_0x5ecb25);logger['info'](_0x3e4a71);if(_0x245536){logger[_0x6acc('0x16')](_0x245536);return _0x3c34f9['status'](0x1f4)[_0x6acc('0x13')](_0x245536);}return _0x3c34f9[_0x6acc('0x12')](0xc8)[_0x6acc('0x13')]({'output':_0x5ecb25});});};exports[_0x6acc('0x1e')]=function(_0x5277b6,_0x3fbf10){return pm2[_0x6acc('0x1e')]('motion2')[_0x6acc('0x1f')](function(_0x1cec1e){logger[_0x6acc('0x17')](_0x6acc('0x20'),_0x1cec1e);return _0x3fbf10[_0x6acc('0x12')](0xc8)[_0x6acc('0x13')]({'output':_0x6acc('0x21')});})[_0x6acc('0x22')](function(_0x4d1c18){logger[_0x6acc('0x16')](_0x4d1c18);return _0x3fbf10[_0x6acc('0x12')](0x1f4)[_0x6acc('0x13')](_0x4d1c18);});};exports[_0x6acc('0x23')]=function(_0x1bcfad,_0x8e75a9){var _0x3c8c95=fs[_0x6acc('0x24')](path[_0x6acc('0x25')](config[_0x6acc('0x26')],'server','migrations'));var _0x47ff48=[];for(var _0x5b6fab=0x0;_0x5b6fab<_0x3c8c95[_0x6acc('0x27')];_0x5b6fab++){var _0x23a581=_0x3c8c95[_0x5b6fab][_0x6acc('0x28')](_0x6acc('0x29'),'');if(compareVersions(module[_0x6acc('0xc')][_0x6acc('0x4')],_0x23a581)===-0x1){_0x47ff48['push'](_0x23a581);}}if(_0x47ff48['length']){var _0x907c72=_0x47ff48[_0x6acc('0x2a')](compareVersions);var _0x34c75a=new Umzug({'storage':_0x6acc('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x6acc('0x2c'),'columnName':_0x6acc('0x4')},'migrations':{'params':[db['sequelize'][_0x6acc('0x2d')](),db[_0x6acc('0x2b')][_0x6acc('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x6acc('0x26')],_0x6acc('0x2f'),'migrations'),'pattern':/\.js$/}});_0x34c75a['up']({'migrations':_['map'](_0x907c72,function(_0x51751f){return _0x51751f+_0x6acc('0x29');})})[_0x6acc('0x1f')](function(){return _0x8e75a9['status'](0xc8)[_0x6acc('0x13')]({'output':_0x6acc('0x30')+module[_0x6acc('0xc')][_0x6acc('0x4')]+_0x6acc('0x31')+_['last'](_0x907c72),'migrations':_[_0x6acc('0x25')](_0x907c72)});})['catch'](function(_0x32c961){if(_0x32c961 instanceof db[_0x6acc('0x2b')]['UniqueConstraintError']){return _0x8e75a9[_0x6acc('0x12')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x8e75a9[_0x6acc('0x12')](0x1f4)[_0x6acc('0x13')](_0x32c961);}});}else{return _0x8e75a9[_0x6acc('0x12')](0xc8)['json']({'output':_0x6acc('0x32')});}}; \ No newline at end of file +var _0xacf4=['simple-git','root','index','query','latest','fetch','status','json','origin','master','info','git\x20fetch','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','push','length','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.','map','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xacf4,0xe7));var _0x4acf=function(_0x4e09b4,_0x2d97da){_0x4e09b4=_0x4e09b4-0x0;var _0x458bd6=_0xacf4[_0x4e09b4];return _0x458bd6;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x4acf('0x0'));var pkginfo=require(_0x4acf('0x1'))(module,_0x4acf('0x2'));var compareVersions=require(_0x4acf('0x3'));var exec=require(_0x4acf('0x4'))[_0x4acf('0x5')];var db=require(_0x4acf('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x4acf('0x7'));var logger=require(_0x4acf('0x8'))('update');var git=require(_0x4acf('0x9'))(config[_0x4acf('0xa')]);exports[_0x4acf('0xb')]=function(_0x45a5a4,_0x25d345){var _0x50f5f4={'current':module['exports'][_0x4acf('0x2')],'phonebar':0x2};if(_0x45a5a4['query']&&_0x45a5a4[_0x4acf('0xc')][_0x4acf('0xd')]){return git[_0x4acf('0xe')]()['tags'](function(_0x290ca7,_0x57f6cb){_0x50f5f4['latest']=(_0x290ca7?module['exports'][_0x4acf('0x2')]:_0x57f6cb['latest'])||'2.0.0';return _0x25d345[_0x4acf('0xf')](0xc8)[_0x4acf('0x10')](_0x50f5f4);});}else{return _0x25d345[_0x4acf('0xf')](0xc8)[_0x4acf('0x10')](_0x50f5f4);}};exports[_0x4acf('0xe')]=function(_0x1a9949,_0x7ab3ea){return git[_0x4acf('0xe')]([_0x4acf('0x11'),_0x4acf('0x12')],function(_0x2741d3){if(_0x2741d3){logger['error'](_0x2741d3);return _0x7ab3ea[_0x4acf('0xf')](0x1f4)['json'](_0x2741d3);}logger[_0x4acf('0x13')](_0x4acf('0x14'));return _0x7ab3ea[_0x4acf('0xf')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x4acf('0x15')]=function(_0x40cb8d,_0x240c00){return git['reset']([_0x4acf('0x16'),_0x4acf('0x17')],function(_0x30d289){if(_0x30d289){logger[_0x4acf('0x18')](_0x30d289);return _0x240c00[_0x4acf('0xf')](0x1f4)[_0x4acf('0x10')](_0x30d289);}logger[_0x4acf('0x13')](_0x4acf('0x19'));return _0x240c00[_0x4acf('0xf')](0xc8)[_0x4acf('0x10')]({'output':_0x4acf('0x1a')});});};exports['pull']=function(_0x28d698,_0x6bd89){exec('npm\x20install\x20--production',function(_0x41e5d2,_0x17775f,_0x569d9e){logger[_0x4acf('0x13')](_0x17775f);logger[_0x4acf('0x13')](_0x569d9e);if(_0x41e5d2){logger[_0x4acf('0x18')](_0x41e5d2);return _0x6bd89[_0x4acf('0xf')](0x1f4)['json'](_0x41e5d2);}return _0x6bd89[_0x4acf('0xf')](0xc8)[_0x4acf('0x10')]({'output':_0x17775f});});};exports['restart']=function(_0x32771e,_0x1af4e9){return pm2['restart'](_0x4acf('0x1b'))[_0x4acf('0x1c')](function(_0x38152c){logger[_0x4acf('0x13')]('pm2\x20restart\x20motion\x20%s',_0x38152c);return _0x1af4e9['status'](0xc8)[_0x4acf('0x10')]({'output':_0x4acf('0x1d')});})[_0x4acf('0x1e')](function(_0x42c90c){logger[_0x4acf('0x18')](_0x42c90c);return _0x1af4e9[_0x4acf('0xf')](0x1f4)[_0x4acf('0x10')](_0x42c90c);});};exports[_0x4acf('0x1f')]=function(_0x382c41,_0x2a3830){var _0x57989e=fs[_0x4acf('0x20')](path[_0x4acf('0x21')](config[_0x4acf('0xa')],_0x4acf('0x22'),_0x4acf('0x1f')));var _0x28570f=[];for(var _0x27384c=0x0;_0x27384c<_0x57989e['length'];_0x27384c++){var _0x337b3c=_0x57989e[_0x27384c][_0x4acf('0x23')](_0x4acf('0x24'),'');if(compareVersions(module['exports'][_0x4acf('0x2')],_0x337b3c)===-0x1){_0x28570f[_0x4acf('0x25')](_0x337b3c);}}if(_0x28570f[_0x4acf('0x26')]){var _0x28ce8a=_0x28570f['sort'](compareVersions);var _0x1dae5=new Umzug({'storage':_0x4acf('0x27'),'storageOptions':{'model':db[_0x4acf('0x28')],'modelName':'Migration','columnName':_0x4acf('0x2')},'migrations':{'params':[db[_0x4acf('0x27')][_0x4acf('0x29')](),db[_0x4acf('0x27')][_0x4acf('0x2a')],function(){throw new Error(_0x4acf('0x2b'));}],'path':path['join'](config[_0x4acf('0xa')],_0x4acf('0x22'),'migrations'),'pattern':/\.js$/}});_0x1dae5['up']({'migrations':_[_0x4acf('0x2c')](_0x28ce8a,function(_0x543a37){return _0x543a37+'.js';})})['then'](function(){return _0x2a3830['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x4acf('0x2')]+_0x4acf('0x2d')+_['last'](_0x28ce8a),'migrations':_[_0x4acf('0x21')](_0x28ce8a)});})[_0x4acf('0x1e')](function(_0x39e56b){if(_0x39e56b instanceof db[_0x4acf('0x27')][_0x4acf('0x2e')]){return _0x2a3830[_0x4acf('0xf')](0xc8)[_0x4acf('0x10')]({'output':_0x4acf('0x2f')});}else{return _0x2a3830[_0x4acf('0xf')](0x1f4)[_0x4acf('0x10')](_0x39e56b);}});}else{return _0x2a3830['status'](0xc8)['json']({'output':_0x4acf('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0f3e9b3..9dd7f99 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 _0x9435=['get','/describe','/:id','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index'];(function(_0x12d01e,_0x4313aa){var _0x3bcb8a=function(_0x57ac2){while(--_0x57ac2){_0x12d01e['push'](_0x12d01e['shift']());}};_0x3bcb8a(++_0x4313aa);}(_0x9435,0xa1));var _0x5943=function(_0x3db4d3,_0x3e610b){_0x3db4d3=_0x3db4d3-0x0;var _0x1b7a83=_0x9435[_0x3db4d3];return _0x1b7a83;};'use strict';var multer=require(_0x5943('0x0'));var util=require(_0x5943('0x1'));var path=require('path');var timeout=require(_0x5943('0x2'));var express=require(_0x5943('0x3'));var router=express['Router']();var auth=require(_0x5943('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5943('0x5'));var controller=require(_0x5943('0x6'));router['get']('/',auth[_0x5943('0x7')](),controller[_0x5943('0x8')]);router[_0x5943('0x9')](_0x5943('0xa'),auth[_0x5943('0x7')](),controller['describe']);router[_0x5943('0x9')](_0x5943('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5943('0x7')](),controller[_0x5943('0xc')]);router[_0x5943('0xd')](_0x5943('0xb'),auth[_0x5943('0x7')](),controller['update']);router[_0x5943('0xe')](_0x5943('0xb'),auth[_0x5943('0x7')](),controller[_0x5943('0xf')]);module[_0x5943('0x10')]=router; \ No newline at end of file +var _0xa0ab=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x1c79c9,_0xa28548){var _0x5c40a5=function(_0x58ecd4){while(--_0x58ecd4){_0x1c79c9['push'](_0x1c79c9['shift']());}};_0x5c40a5(++_0xa28548);}(_0xa0ab,0xad));var _0xba0a=function(_0x3c64ad,_0x309f94){_0x3c64ad=_0x3c64ad-0x0;var _0xaecd92=_0xa0ab[_0x3c64ad];return _0xaecd92;};'use strict';var multer=require(_0xba0a('0x0'));var util=require(_0xba0a('0x1'));var path=require(_0xba0a('0x2'));var timeout=require(_0xba0a('0x3'));var express=require(_0xba0a('0x4'));var router=express[_0xba0a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba0a('0x6'));var controller=require(_0xba0a('0x7'));router[_0xba0a('0x8')]('/',auth[_0xba0a('0x9')](),controller[_0xba0a('0xa')]);router[_0xba0a('0x8')]('/describe',auth[_0xba0a('0x9')](),controller['describe']);router['get'](_0xba0a('0xb'),auth['isAuthenticated'](),controller[_0xba0a('0xc')]);router[_0xba0a('0xd')]('/',auth['isAuthenticated'](),controller[_0xba0a('0xe')]);router[_0xba0a('0xf')](_0xba0a('0xb'),auth[_0xba0a('0x9')](),controller['update']);router[_0xba0a('0x10')](_0xba0a('0xb'),auth[_0xba0a('0x9')](),controller[_0xba0a('0x11')]);module[_0xba0a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f83561c..729c9fa 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 _0x038b=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x20654f,_0x9c81d5){var _0x31a7f9=function(_0x5776e3){while(--_0x5776e3){_0x20654f['push'](_0x20654f['shift']());}};_0x31a7f9(++_0x9c81d5);}(_0x038b,0x114));var _0xb038=function(_0x719925,_0x1f8bec){_0x719925=_0x719925-0x0;var _0xd39e17=_0x038b[_0x719925];return _0xd39e17;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'type':{'type':Sequelize[_0xb038('0x1')]},'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb038('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb038('0x1')]},'membername':{'type':Sequelize[_0xb038('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb038('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb038('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb038('0x3')]},'agentcomplete':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb038('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb038('0x1')]},'channelstate':{'type':Sequelize[_0xb038('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'connectedlinename':{'type':Sequelize[_0xb038('0x1')]},'language':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'context':{'type':Sequelize[_0xb038('0x1')]},'exten':{'type':Sequelize[_0xb038('0x1')]},'priority':{'type':Sequelize[_0xb038('0x1')]},'destchannel':{'type':Sequelize[_0xb038('0x1')]},'destchannelstate':{'type':Sequelize[_0xb038('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb038('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb038('0x1')]},'destcalleridname':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb038('0x1')]},'destlanguage':{'type':Sequelize[_0xb038('0x1')]},'destaccountcode':{'type':Sequelize[_0xb038('0x1')]},'destcontext':{'type':Sequelize[_0xb038('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb038('0x1')]},'destuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb038('0x1')]},'transfer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb038('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb038('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb038('0x1')]},'agententerreason':{'type':Sequelize[_0xb038('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7dfd=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x46c4c5,_0x50e67d){var _0x5a6fdc=function(_0x3ca9dd){while(--_0x3ca9dd){_0x46c4c5['push'](_0x46c4c5['shift']());}};_0x5a6fdc(++_0x50e67d);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'type':{'type':Sequelize[_0xd7df('0x2')]},'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'calleridnum':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'queue':{'type':Sequelize[_0xd7df('0x2')]},'interface':{'type':Sequelize[_0xd7df('0x2')]},'membername':{'type':Sequelize[_0xd7df('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd7df('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd7df('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd7df('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd7df('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd7df('0x3')]},'holdtime':{'type':Sequelize[_0xd7df('0x4')]},'agentcomplete':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd7df('0x4')]},'agentacw':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd7df('0x4')]},'reason':{'type':Sequelize[_0xd7df('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd7df('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd7df('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd7df('0x2')]},'language':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'exten':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'destchannel':{'type':Sequelize[_0xd7df('0x2')]},'destchannelstate':{'type':Sequelize[_0xd7df('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd7df('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd7df('0x2')]},'destcalleridname':{'type':Sequelize[_0xd7df('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd7df('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd7df('0x2')]},'destlanguage':{'type':Sequelize[_0xd7df('0x2')]},'destaccountcode':{'type':Sequelize[_0xd7df('0x2')]},'destcontext':{'type':Sequelize[_0xd7df('0x2')]},'destexten':{'type':Sequelize[_0xd7df('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd7df('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd7df('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'agententerreason':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 0a83666..7560792 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 _0x77bf=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceAgentReport','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','merge','where','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x77bf,0x1b0));var _0xf77b=function(_0x58648d,_0x265925){_0x58648d=_0x58648d-0x0;var _0x4dde31=_0x77bf[_0x58648d];return _0x4dde31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf77b('0x0'));var rimraf=require(_0xf77b('0x1'));var zipdir=require(_0xf77b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf77b('0x3'));var Mustache=require(_0xf77b('0x4'));var util=require(_0xf77b('0x5'));var path=require(_0xf77b('0x6'));var sox=require(_0xf77b('0x7'));var csv=require('to-csv');var ejs=require(_0xf77b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf77b('0x9'));var crypto=require('crypto');var jsforce=require(_0xf77b('0xa'));var deskjs=require(_0xf77b('0xb'));var toCsv=require(_0xf77b('0xc'));var querystring=require(_0xf77b('0xd'));var Papa=require(_0xf77b('0xe'));var Redis=require('ioredis');var authService=require(_0xf77b('0xf'));var qs=require(_0xf77b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf77b('0x11'));var logger=require(_0xf77b('0x12'))(_0xf77b('0x13'));var utils=require(_0xf77b('0x14'));var config=require(_0xf77b('0x15'));var licenseUtil=require(_0xf77b('0x16'));var db=require(_0xf77b('0x17'))['db'];function respondWithStatusCode(_0x175657,_0x50df8e){_0x50df8e=_0x50df8e||0xcc;return function(_0x1b7a10){if(_0x1b7a10){return _0x175657[_0xf77b('0x18')](_0x50df8e);}return _0x175657[_0xf77b('0x19')](_0x50df8e)[_0xf77b('0x1a')]();};}function respondWithResult(_0xcbfcb1,_0x4bcf59){_0x4bcf59=_0x4bcf59||0xc8;return function(_0x57feb7){if(_0x57feb7){return _0xcbfcb1['status'](_0x4bcf59)[_0xf77b('0x1b')](_0x57feb7);}};}function respondWithFilteredResult(_0x5d0ecf,_0x526f58){return function(_0x3147b0){if(_0x3147b0){var _0x117428=_0x3147b0['count'],_0x5498be=_0x526f58['offset'],_0x2b036e=_0x526f58['offset']+_0x526f58[_0xf77b('0x1c')],_0x23f3a7;if(_0x2b036e>=_0x117428){_0x2b036e=_0x117428;_0x23f3a7=0xc8;}else{_0x23f3a7=0xce;}_0x5d0ecf[_0xf77b('0x19')](_0x23f3a7);return _0x5d0ecf[_0xf77b('0x1d')](_0xf77b('0x1e'),_0x5498be+'-'+_0x2b036e+'/'+_0x117428)[_0xf77b('0x1b')](_0x3147b0);}return null;};}function patchUpdates(_0x8f4d60){return function(_0xab352f){try{jsonpatch[_0xf77b('0x1f')](_0xab352f,_0x8f4d60,!![]);}catch(_0x584412){return BPromise[_0xf77b('0x20')](_0x584412);}return _0xab352f[_0xf77b('0x21')]();};}function saveUpdates(_0x3b741b,_0x3a0f54){return function(_0x815324){if(_0x815324){return _0x815324[_0xf77b('0x22')](_0x3b741b)['then'](function(_0x56d442){return _0x56d442;});}return null;};}function removeEntity(_0x2568b7,_0x9ca5c1){return function(_0x489189){if(_0x489189){return _0x489189[_0xf77b('0x23')]()[_0xf77b('0x24')](function(){_0x2568b7[_0xf77b('0x19')](0xcc)[_0xf77b('0x1a')]();});}};}function handleEntityNotFound(_0x2067c0,_0x506d16){return function(_0xe63588){if(!_0xe63588){_0x2067c0['sendStatus'](0x194);}return _0xe63588;};}function handleError(_0x3680f3,_0x3fbef8){_0x3fbef8=_0x3fbef8||0x1f4;return function(_0x32c535){logger[_0xf77b('0x25')](_0x32c535[_0xf77b('0x26')]);if(_0x32c535[_0xf77b('0x27')]){delete _0x32c535[_0xf77b('0x27')];}_0x3680f3['status'](_0x3fbef8)[_0xf77b('0x28')](_0x32c535);};}exports[_0xf77b('0x29')]=function(_0xb07938,_0x1b3f30){var _0x28a8cf={},_0x27ff2f={},_0x362142={'count':0x0,'rows':[]};var _0x3f87d5=_[_0xf77b('0x2a')](db[_0xf77b('0x2b')]['rawAttributes'],function(_0x58b297){return{'name':_0x58b297[_0xf77b('0x2c')],'type':_0x58b297['type']['key']};});_0x27ff2f['model']=_['map'](_0x3f87d5,_0xf77b('0x27'));_0x27ff2f[_0xf77b('0x2d')]=_[_0xf77b('0x2e')](_0xb07938[_0xf77b('0x2d')]);_0x27ff2f[_0xf77b('0x2f')]=_[_0xf77b('0x30')](_0x27ff2f[_0xf77b('0x31')],_0x27ff2f['query']);_0x28a8cf[_0xf77b('0x32')]=_[_0xf77b('0x30')](_0x27ff2f[_0xf77b('0x31')],qs[_0xf77b('0x33')](_0xb07938['query']['fields']));_0x28a8cf[_0xf77b('0x32')]=_0x28a8cf['attributes'][_0xf77b('0x34')]?_0x28a8cf[_0xf77b('0x32')]:_0x27ff2f[_0xf77b('0x31')];if(!_0xb07938['query'][_0xf77b('0x35')](_0xf77b('0x36'))){_0x28a8cf[_0xf77b('0x1c')]=qs[_0xf77b('0x1c')](_0xb07938[_0xf77b('0x2d')]['limit']);_0x28a8cf[_0xf77b('0x37')]=qs[_0xf77b('0x37')](_0xb07938['query'][_0xf77b('0x37')]);}_0x28a8cf['order']=qs['sort'](_0xb07938[_0xf77b('0x2d')][_0xf77b('0x38')]);_0x28a8cf['where']=qs[_0xf77b('0x2f')](_[_0xf77b('0x39')](_0xb07938[_0xf77b('0x2d')],_0x27ff2f[_0xf77b('0x2f')]),_0x3f87d5);if(_0xb07938[_0xf77b('0x2d')][_0xf77b('0x3a')]){_0x28a8cf['where']=_[_0xf77b('0x3b')](_0x28a8cf[_0xf77b('0x3c')],{'$or':_['map'](_0x3f87d5,function(_0x83a2b){if(_0x83a2b[_0xf77b('0x3d')]!==_0xf77b('0x3e')){var _0x1a9068={};_0x1a9068[_0x83a2b[_0xf77b('0x27')]]={'$like':'%'+_0xb07938[_0xf77b('0x2d')][_0xf77b('0x3a')]+'%'};return _0x1a9068;}})});}_0x28a8cf=_[_0xf77b('0x3b')]({},_0x28a8cf,_0xb07938[_0xf77b('0x3f')]);var _0x504885={'where':_0x28a8cf[_0xf77b('0x3c')]};return db['VoiceAgentReport'][_0xf77b('0x40')](_0x504885)[_0xf77b('0x24')](function(_0x269e42){_0x362142[_0xf77b('0x40')]=_0x269e42;if(_0xb07938[_0xf77b('0x2d')][_0xf77b('0x41')]){_0x28a8cf[_0xf77b('0x42')]=[{'all':!![]}];}return db[_0xf77b('0x2b')][_0xf77b('0x43')](_0x28a8cf);})[_0xf77b('0x24')](function(_0xe1be4f){_0x362142[_0xf77b('0x44')]=_0xe1be4f;return _0x362142;})['then'](respondWithFilteredResult(_0x1b3f30,_0x28a8cf))[_0xf77b('0x45')](handleError(_0x1b3f30,null));};exports[_0xf77b('0x46')]=function(_0x1ccfe7,_0x366e2f){var _0x15976a={'raw':![],'where':{'id':_0x1ccfe7[_0xf77b('0x47')]['id']}},_0xc2774e={};_0xc2774e['model']=_[_0xf77b('0x2e')](db[_0xf77b('0x2b')][_0xf77b('0x48')]);_0xc2774e['query']=_[_0xf77b('0x2e')](_0x1ccfe7[_0xf77b('0x2d')]);_0xc2774e[_0xf77b('0x2f')]=_[_0xf77b('0x30')](_0xc2774e['model'],_0xc2774e[_0xf77b('0x2d')]);_0x15976a[_0xf77b('0x32')]=_['intersection'](_0xc2774e[_0xf77b('0x31')],qs[_0xf77b('0x33')](_0x1ccfe7[_0xf77b('0x2d')][_0xf77b('0x33')]));_0x15976a[_0xf77b('0x32')]=_0x15976a[_0xf77b('0x32')][_0xf77b('0x34')]?_0x15976a[_0xf77b('0x32')]:_0xc2774e[_0xf77b('0x31')];if(_0x1ccfe7['query'][_0xf77b('0x41')]){_0x15976a['include']=[{'all':!![]}];}_0x15976a=_[_0xf77b('0x3b')]({},_0x15976a,_0x1ccfe7[_0xf77b('0x3f')]);return db['VoiceAgentReport']['find'](_0x15976a)[_0xf77b('0x24')](handleEntityNotFound(_0x366e2f,null))['then'](respondWithResult(_0x366e2f,null))['catch'](handleError(_0x366e2f,null));};exports[_0xf77b('0x49')]=function(_0x5c80b7,_0x3d3a2e){return db[_0xf77b('0x2b')][_0xf77b('0x49')](_0x5c80b7[_0xf77b('0x4a')],{})['then'](respondWithResult(_0x3d3a2e,0xc9))[_0xf77b('0x45')](handleError(_0x3d3a2e,null));};exports[_0xf77b('0x22')]=function(_0x3f252e,_0x1c3ae2){if(_0x3f252e['body']['id']){delete _0x3f252e[_0xf77b('0x4a')]['id'];}return db[_0xf77b('0x2b')][_0xf77b('0x4b')]({'where':{'id':_0x3f252e[_0xf77b('0x47')]['id']}})[_0xf77b('0x24')](handleEntityNotFound(_0x1c3ae2,null))[_0xf77b('0x24')](saveUpdates(_0x3f252e[_0xf77b('0x4a')],null))[_0xf77b('0x24')](respondWithResult(_0x1c3ae2,null))[_0xf77b('0x45')](handleError(_0x1c3ae2,null));};exports['destroy']=function(_0x1b5d79,_0x424f11){return db[_0xf77b('0x2b')][_0xf77b('0x4b')]({'where':{'id':_0x1b5d79[_0xf77b('0x47')]['id']}})[_0xf77b('0x24')](handleEntityNotFound(_0x424f11,null))[_0xf77b('0x24')](removeEntity(_0x424f11,null))[_0xf77b('0x45')](handleError(_0x424f11,null));};exports[_0xf77b('0x4c')]=function(_0x241107,_0x51805f){return db['VoiceAgentReport'][_0xf77b('0x4c')]()[_0xf77b('0x24')](respondWithResult(_0x51805f,null))[_0xf77b('0x45')](handleError(_0x51805f,null));}; \ No newline at end of file +var _0x0072=['fields','include','find','create','update','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','send','index','key','model','map','query','keys','intersection','attributes','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','VoiceAgentReport','includeAll','findAll','rows','catch','show','params','rawAttributes'];(function(_0x22a477,_0x48065c){var _0x4e6a50=function(_0x1ca5b9){while(--_0x1ca5b9){_0x22a477['push'](_0x22a477['shift']());}};_0x4e6a50(++_0x48065c);}(_0x0072,0xf1));var _0x2007=function(_0x4d33ff,_0x22cfff){_0x4d33ff=_0x4d33ff-0x0;var _0x60a1a9=_0x0072[_0x4d33ff];return _0x60a1a9;};'use strict';var pdf=require(_0x2007('0x0'));var emlformat=require(_0x2007('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2007('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2007('0x3'));var moment=require(_0x2007('0x4'));var BPromise=require(_0x2007('0x5'));var Mustache=require(_0x2007('0x6'));var util=require(_0x2007('0x7'));var path=require(_0x2007('0x8'));var sox=require(_0x2007('0x9'));var csv=require(_0x2007('0xa'));var ejs=require(_0x2007('0xb'));var fs=require('fs');var _=require(_0x2007('0xc'));var squel=require(_0x2007('0xd'));var crypto=require(_0x2007('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2007('0xf'));var toCsv=require(_0x2007('0xa'));var querystring=require(_0x2007('0x10'));var Papa=require(_0x2007('0x11'));var Redis=require(_0x2007('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2007('0x13'));var as=require(_0x2007('0x14'));var hardwareService=require(_0x2007('0x15'));var logger=require('../../config/logger')(_0x2007('0x16'));var utils=require(_0x2007('0x17'));var config=require(_0x2007('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2007('0x19'))['db'];function respondWithStatusCode(_0x73982e,_0x3dc7ca){_0x3dc7ca=_0x3dc7ca||0xcc;return function(_0x5c795d){if(_0x5c795d){return _0x73982e['sendStatus'](_0x3dc7ca);}return _0x73982e[_0x2007('0x1a')](_0x3dc7ca)['end']();};}function respondWithResult(_0x32ffb9,_0x17113a){_0x17113a=_0x17113a||0xc8;return function(_0x61c96){if(_0x61c96){return _0x32ffb9[_0x2007('0x1a')](_0x17113a)[_0x2007('0x1b')](_0x61c96);}};}function respondWithFilteredResult(_0x1fe37b,_0x52f891){return function(_0x5cdbfa){if(_0x5cdbfa){var _0x582ff9=_0x5cdbfa[_0x2007('0x1c')],_0x3d7c0e=_0x52f891[_0x2007('0x1d')],_0x3b792a=_0x52f891['offset']+_0x52f891[_0x2007('0x1e')],_0x299ff6;if(_0x3b792a>=_0x582ff9){_0x3b792a=_0x582ff9;_0x299ff6=0xc8;}else{_0x299ff6=0xce;}_0x1fe37b[_0x2007('0x1a')](_0x299ff6);return _0x1fe37b[_0x2007('0x1f')](_0x2007('0x20'),_0x3d7c0e+'-'+_0x3b792a+'/'+_0x582ff9)[_0x2007('0x1b')](_0x5cdbfa);}return null;};}function patchUpdates(_0x2e4693){return function(_0x5a78c7){try{jsonpatch[_0x2007('0x21')](_0x5a78c7,_0x2e4693,!![]);}catch(_0x42f190){return BPromise[_0x2007('0x22')](_0x42f190);}return _0x5a78c7[_0x2007('0x23')]();};}function saveUpdates(_0x16cb38,_0x35226c){return function(_0x2db9ec){if(_0x2db9ec){return _0x2db9ec['update'](_0x16cb38)['then'](function(_0x2b324b){return _0x2b324b;});}return null;};}function removeEntity(_0x463ec7,_0x411d14){return function(_0x486006){if(_0x486006){return _0x486006[_0x2007('0x24')]()[_0x2007('0x25')](function(){_0x463ec7[_0x2007('0x1a')](0xcc)[_0x2007('0x26')]();});}};}function handleEntityNotFound(_0x860ec0,_0x3c5b59){return function(_0x558784){if(!_0x558784){_0x860ec0[_0x2007('0x27')](0x194);}return _0x558784;};}function handleError(_0x54eba9,_0x50bbdb){_0x50bbdb=_0x50bbdb||0x1f4;return function(_0x58c4f9){logger[_0x2007('0x28')](_0x58c4f9[_0x2007('0x29')]);if(_0x58c4f9[_0x2007('0x2a')]){delete _0x58c4f9[_0x2007('0x2a')];}_0x54eba9[_0x2007('0x1a')](_0x50bbdb)[_0x2007('0x2b')](_0x58c4f9);};}exports[_0x2007('0x2c')]=function(_0x244722,_0x27f8fb){var _0x1d8c49={},_0x1d83c5={},_0x2b25cd={'count':0x0,'rows':[]};var _0x1bc7a9=_['map'](db['VoiceAgentReport']['rawAttributes'],function(_0x5476e4){return{'name':_0x5476e4['fieldName'],'type':_0x5476e4['type'][_0x2007('0x2d')]};});_0x1d83c5[_0x2007('0x2e')]=_[_0x2007('0x2f')](_0x1bc7a9,_0x2007('0x2a'));_0x1d83c5[_0x2007('0x30')]=_[_0x2007('0x31')](_0x244722[_0x2007('0x30')]);_0x1d83c5['filters']=_[_0x2007('0x32')](_0x1d83c5[_0x2007('0x2e')],_0x1d83c5[_0x2007('0x30')]);_0x1d8c49['attributes']=_[_0x2007('0x32')](_0x1d83c5[_0x2007('0x2e')],qs['fields'](_0x244722[_0x2007('0x30')]['fields']));_0x1d8c49[_0x2007('0x33')]=_0x1d8c49[_0x2007('0x33')][_0x2007('0x34')]?_0x1d8c49[_0x2007('0x33')]:_0x1d83c5[_0x2007('0x2e')];if(!_0x244722[_0x2007('0x30')]['hasOwnProperty']('nolimit')){_0x1d8c49[_0x2007('0x1e')]=qs[_0x2007('0x1e')](_0x244722[_0x2007('0x30')]['limit']);_0x1d8c49[_0x2007('0x1d')]=qs[_0x2007('0x1d')](_0x244722['query'][_0x2007('0x1d')]);}_0x1d8c49[_0x2007('0x35')]=qs[_0x2007('0x36')](_0x244722['query']['sort']);_0x1d8c49[_0x2007('0x37')]=qs[_0x2007('0x38')](_[_0x2007('0x39')](_0x244722['query'],_0x1d83c5[_0x2007('0x38')]),_0x1bc7a9);if(_0x244722[_0x2007('0x30')][_0x2007('0x3a')]){_0x1d8c49['where']=_[_0x2007('0x3b')](_0x1d8c49[_0x2007('0x37')],{'$or':_[_0x2007('0x2f')](_0x1bc7a9,function(_0x3e5d82){if(_0x3e5d82[_0x2007('0x3c')]!==_0x2007('0x3d')){var _0x1e9b87={};_0x1e9b87[_0x3e5d82[_0x2007('0x2a')]]={'$like':'%'+_0x244722[_0x2007('0x30')]['filter']+'%'};return _0x1e9b87;}})});}_0x1d8c49=_[_0x2007('0x3b')]({},_0x1d8c49,_0x244722[_0x2007('0x3e')]);var _0x50b7e8={'where':_0x1d8c49[_0x2007('0x37')]};return db[_0x2007('0x3f')]['count'](_0x50b7e8)['then'](function(_0x5355ef){_0x2b25cd[_0x2007('0x1c')]=_0x5355ef;if(_0x244722[_0x2007('0x30')][_0x2007('0x40')]){_0x1d8c49['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x2007('0x41')](_0x1d8c49);})['then'](function(_0x3e9755){_0x2b25cd[_0x2007('0x42')]=_0x3e9755;return _0x2b25cd;})[_0x2007('0x25')](respondWithFilteredResult(_0x27f8fb,_0x1d8c49))[_0x2007('0x43')](handleError(_0x27f8fb,null));};exports[_0x2007('0x44')]=function(_0x6cfb89,_0x46c7b7){var _0x3eed98={'raw':![],'where':{'id':_0x6cfb89[_0x2007('0x45')]['id']}},_0x3721dd={};_0x3721dd[_0x2007('0x2e')]=_[_0x2007('0x31')](db[_0x2007('0x3f')][_0x2007('0x46')]);_0x3721dd[_0x2007('0x30')]=_[_0x2007('0x31')](_0x6cfb89['query']);_0x3721dd[_0x2007('0x38')]=_[_0x2007('0x32')](_0x3721dd[_0x2007('0x2e')],_0x3721dd['query']);_0x3eed98[_0x2007('0x33')]=_[_0x2007('0x32')](_0x3721dd[_0x2007('0x2e')],qs[_0x2007('0x47')](_0x6cfb89['query'][_0x2007('0x47')]));_0x3eed98[_0x2007('0x33')]=_0x3eed98[_0x2007('0x33')][_0x2007('0x34')]?_0x3eed98['attributes']:_0x3721dd[_0x2007('0x2e')];if(_0x6cfb89['query'][_0x2007('0x40')]){_0x3eed98[_0x2007('0x48')]=[{'all':!![]}];}_0x3eed98=_['merge']({},_0x3eed98,_0x6cfb89['options']);return db[_0x2007('0x3f')][_0x2007('0x49')](_0x3eed98)['then'](handleEntityNotFound(_0x46c7b7,null))['then'](respondWithResult(_0x46c7b7,null))[_0x2007('0x43')](handleError(_0x46c7b7,null));};exports[_0x2007('0x4a')]=function(_0x224cb4,_0x1e0b9a){return db[_0x2007('0x3f')][_0x2007('0x4a')](_0x224cb4['body'],{})[_0x2007('0x25')](respondWithResult(_0x1e0b9a,0xc9))[_0x2007('0x43')](handleError(_0x1e0b9a,null));};exports[_0x2007('0x4b')]=function(_0x45f3c4,_0x404d1f){if(_0x45f3c4[_0x2007('0x4c')]['id']){delete _0x45f3c4['body']['id'];}return db[_0x2007('0x3f')]['find']({'where':{'id':_0x45f3c4['params']['id']}})[_0x2007('0x25')](handleEntityNotFound(_0x404d1f,null))[_0x2007('0x25')](saveUpdates(_0x45f3c4[_0x2007('0x4c')],null))[_0x2007('0x25')](respondWithResult(_0x404d1f,null))[_0x2007('0x43')](handleError(_0x404d1f,null));};exports[_0x2007('0x24')]=function(_0xb7701a,_0x108481){return db[_0x2007('0x3f')]['find']({'where':{'id':_0xb7701a[_0x2007('0x45')]['id']}})[_0x2007('0x25')](handleEntityNotFound(_0x108481,null))['then'](removeEntity(_0x108481,null))[_0x2007('0x43')](handleError(_0x108481,null));};exports[_0x2007('0x4d')]=function(_0x109ba0,_0x3c5bf9){return db['VoiceAgentReport'][_0x2007('0x4d')]()[_0x2007('0x25')](respondWithResult(_0x3c5bf9,null))['catch'](handleError(_0x3c5bf9,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 991ed11..79998a6 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 _0xb10f=['uniqueid','destuniqueid','api','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent'];(function(_0x3b3ec6,_0x3edb59){var _0x4413bf=function(_0x13f013){while(--_0x13f013){_0x3b3ec6['push'](_0x3b3ec6['shift']());}};_0x4413bf(++_0x3edb59);}(_0xb10f,0xe9));var _0xfb10=function(_0x58f7f,_0x286f5b){_0x58f7f=_0x58f7f-0x0;var _0x37f104=_0xb10f[_0x58f7f];return _0x37f104;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfb10('0x0'));var moment=require('moment');var BPromise=require(_0xfb10('0x1'));var rp=require(_0xfb10('0x2'));var fs=require('fs');var path=require(_0xfb10('0x3'));var rimraf=require(_0xfb10('0x4'));var config=require('../../config/environment');var attributes=require(_0xfb10('0x5'));module[_0xfb10('0x6')]=function(_0x232606,_0xcb61f9){return _0x232606['define'](_0xfb10('0x7'),attributes,{'tableName':_0xfb10('0x8'),'paranoid':![],'indexes':[{'fields':[_0xfb10('0x9'),_0xfb10('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x596d=['bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid','lodash','util','api','moment'];(function(_0x408c7f,_0x51fb36){var _0x3dcef4=function(_0x13ef01){while(--_0x13ef01){_0x408c7f['push'](_0x408c7f['shift']());}};_0x3dcef4(++_0x51fb36);}(_0x596d,0x19c));var _0xd596=function(_0x34de4f,_0x3dd968){_0x34de4f=_0x34de4f-0x0;var _0xb3c5b9=_0x596d[_0x34de4f];return _0xb3c5b9;};'use strict';var _=require(_0xd596('0x0'));var util=require(_0xd596('0x1'));var logger=require('../../config/logger')(_0xd596('0x2'));var moment=require(_0xd596('0x3'));var BPromise=require(_0xd596('0x4'));var rp=require(_0xd596('0x5'));var fs=require('fs');var path=require(_0xd596('0x6'));var rimraf=require(_0xd596('0x7'));var config=require('../../config/environment');var attributes=require(_0xd596('0x8'));module[_0xd596('0x9')]=function(_0x586bb8,_0x24981f){return _0x586bb8[_0xd596('0xa')](_0xd596('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0xd596('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 7338038..c75ef1d 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 _0x698f=['client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','then','UpdateVoiceAgentReport','update','body','where','limit','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24f6f5,_0xb5a6d7){var _0x3a8545=function(_0x65f744){while(--_0x65f744){_0x24f6f5['push'](_0x24f6f5['shift']());}};_0x3a8545(++_0xb5a6d7);}(_0x698f,0xb7));var _0xf698=function(_0x1945f4,_0x472fb1){_0x1945f4=_0x1945f4-0x0;var _0x343e46=_0x698f[_0x1945f4];return _0x343e46;};'use strict';var _=require(_0xf698('0x0'));var util=require(_0xf698('0x1'));var moment=require('moment');var BPromise=require(_0xf698('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf698('0x3'))['db'];var utils=require(_0xf698('0x4'));var logger=require(_0xf698('0x5'))(_0xf698('0x6'));var config=require(_0xf698('0x7'));var jayson=require(_0xf698('0x8'));var client=jayson[_0xf698('0x9')][_0xf698('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8f83d5,_0x323d1d,_0x266d04){return new BPromise(function(_0x3536b3,_0x352316){return client['request'](_0x8f83d5,_0x266d04)['then'](function(_0x44a317){logger[_0xf698('0xb')](_0xf698('0xc'),_0x323d1d,_0xf698('0xd'));logger[_0xf698('0xe')](_0xf698('0xf'),_0x323d1d,_0xf698('0xd'),JSON[_0xf698('0x10')](_0x44a317));if(_0x44a317['error']){if(_0x44a317[_0xf698('0x11')][_0xf698('0x12')]===0x1f4){logger[_0xf698('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x323d1d,_0x44a317[_0xf698('0x11')]['message']);return _0x352316(_0x44a317[_0xf698('0x11')]['message']);}logger[_0xf698('0x11')](_0xf698('0xc'),_0x323d1d,_0x44a317[_0xf698('0x11')][_0xf698('0x13')]);return _0x3536b3(_0x44a317[_0xf698('0x11')][_0xf698('0x13')]);}else{logger[_0xf698('0xb')](_0xf698('0xc'),_0x323d1d,_0xf698('0xd'));_0x3536b3(_0x44a317[_0xf698('0x14')][_0xf698('0x13')]);}})[_0xf698('0x15')](function(_0x4105fc){logger[_0xf698('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x323d1d,_0x4105fc);_0x352316(_0x4105fc);});});}exports[_0xf698('0x16')]=function(_0x920ac2){var _0x88b272=this;return new Promise(function(_0x32b37e,_0x3a80fd){return db[_0xf698('0x17')][_0xf698('0x18')](_0x920ac2['body'],{'raw':_0x920ac2['options']?_0x920ac2[_0xf698('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf698('0x1a')](function(_0x23636a){logger[_0xf698('0xb')](_0xf698('0x16'),_0x920ac2);logger['debug'](_0xf698('0x16'),_0x920ac2,JSON[_0xf698('0x10')](_0x23636a));_0x32b37e(_0x23636a);})[_0xf698('0x15')](function(_0x26b9be){logger[_0xf698('0x11')]('CreateVoiceAgentReport',_0x26b9be[_0xf698('0x13')],_0x920ac2);_0x3a80fd(_0x88b272['error'](0x1f4,_0x26b9be['message']));});});};exports[_0xf698('0x1b')]=function(_0x7643a4){var _0x29b620=this;return new Promise(function(_0x39acd3,_0x33a9b9){return db[_0xf698('0x17')][_0xf698('0x1c')](_0x7643a4[_0xf698('0x1d')],{'raw':_0x7643a4[_0xf698('0x19')]?_0x7643a4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7643a4[_0xf698('0x19')]?_0x7643a4[_0xf698('0x19')][_0xf698('0x1e')]||null:null,'attributes':_0x7643a4[_0xf698('0x19')]?_0x7643a4['options']['attributes']||null:null,'limit':_0x7643a4[_0xf698('0x19')]?_0x7643a4[_0xf698('0x19')][_0xf698('0x1f')]||null:null})['then'](function(_0x38791f){logger['info'](_0xf698('0x1b'),_0x7643a4);logger[_0xf698('0xe')](_0xf698('0x1b'),_0x7643a4,JSON[_0xf698('0x10')](_0x38791f));_0x39acd3(_0x38791f);})[_0xf698('0x15')](function(_0x19a033){logger[_0xf698('0x11')]('UpdateVoiceAgentReport',_0x19a033[_0xf698('0x13')],_0x7643a4);_0x33a9b9(_0x29b620[_0xf698('0x11')](0x1f4,_0x19a033[_0xf698('0x13')]));});});}; \ No newline at end of file +var _0x4ae8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','attributes'];(function(_0x204e16,_0x4bc457){var _0x203d08=function(_0x27d242){while(--_0x27d242){_0x204e16['push'](_0x204e16['shift']());}};_0x203d08(++_0x4bc457);}(_0x4ae8,0xe0));var _0x84ae=function(_0x301b2b,_0x16af0d){_0x301b2b=_0x301b2b-0x0;var _0x8cedf9=_0x4ae8[_0x301b2b];return _0x8cedf9;};'use strict';var _=require(_0x84ae('0x0'));var util=require(_0x84ae('0x1'));var moment=require(_0x84ae('0x2'));var BPromise=require(_0x84ae('0x3'));var rs=require(_0x84ae('0x4'));var fs=require('fs');var Redis=require(_0x84ae('0x5'));var db=require(_0x84ae('0x6'))['db'];var utils=require(_0x84ae('0x7'));var logger=require(_0x84ae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x84ae('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8d43bc,_0x3727e3,_0x1f781f){return new BPromise(function(_0xfefe43,_0x23cb81){return client[_0x84ae('0xa')](_0x8d43bc,_0x1f781f)[_0x84ae('0xb')](function(_0x2d6ac1){logger[_0x84ae('0xc')](_0x84ae('0xd'),_0x3727e3,_0x84ae('0xe'));logger[_0x84ae('0xf')](_0x84ae('0x10'),_0x3727e3,'request\x20sent',JSON[_0x84ae('0x11')](_0x2d6ac1));if(_0x2d6ac1[_0x84ae('0x12')]){if(_0x2d6ac1['error'][_0x84ae('0x13')]===0x1f4){logger[_0x84ae('0x12')](_0x84ae('0xd'),_0x3727e3,_0x2d6ac1[_0x84ae('0x12')][_0x84ae('0x14')]);return _0x23cb81(_0x2d6ac1[_0x84ae('0x12')][_0x84ae('0x14')]);}logger[_0x84ae('0x12')](_0x84ae('0xd'),_0x3727e3,_0x2d6ac1[_0x84ae('0x12')][_0x84ae('0x14')]);return _0xfefe43(_0x2d6ac1[_0x84ae('0x12')][_0x84ae('0x14')]);}else{logger[_0x84ae('0xc')](_0x84ae('0xd'),_0x3727e3,_0x84ae('0xe'));_0xfefe43(_0x2d6ac1[_0x84ae('0x15')]['message']);}})[_0x84ae('0x16')](function(_0x16d07d){logger[_0x84ae('0x12')](_0x84ae('0xd'),_0x3727e3,_0x16d07d);_0x23cb81(_0x16d07d);});});}exports['CreateVoiceAgentReport']=function(_0x174122){var _0x296010=this;return new Promise(function(_0x13623b,_0x6be067){return db[_0x84ae('0x17')][_0x84ae('0x18')](_0x174122[_0x84ae('0x19')],{'raw':_0x174122['options']?_0x174122[_0x84ae('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x84ae('0xb')](function(_0x5db2d8){logger[_0x84ae('0xc')](_0x84ae('0x1b'),_0x174122);logger[_0x84ae('0xf')](_0x84ae('0x1b'),_0x174122,JSON[_0x84ae('0x11')](_0x5db2d8));_0x13623b(_0x5db2d8);})[_0x84ae('0x16')](function(_0x4dfbd4){logger[_0x84ae('0x12')](_0x84ae('0x1b'),_0x4dfbd4[_0x84ae('0x14')],_0x174122);_0x6be067(_0x296010[_0x84ae('0x12')](0x1f4,_0x4dfbd4[_0x84ae('0x14')]));});});};exports[_0x84ae('0x1c')]=function(_0x44f5db){var _0x1dff5e=this;return new Promise(function(_0x17ebea,_0x259f26){return db[_0x84ae('0x17')][_0x84ae('0x1d')](_0x44f5db['body'],{'raw':_0x44f5db['options']?_0x44f5db[_0x84ae('0x1a')][_0x84ae('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44f5db[_0x84ae('0x1a')]?_0x44f5db[_0x84ae('0x1a')]['where']||null:null,'attributes':_0x44f5db['options']?_0x44f5db[_0x84ae('0x1a')][_0x84ae('0x1f')]||null:null,'limit':_0x44f5db[_0x84ae('0x1a')]?_0x44f5db[_0x84ae('0x1a')]['limit']||null:null})[_0x84ae('0xb')](function(_0x34ab6e){logger[_0x84ae('0xc')](_0x84ae('0x1c'),_0x44f5db);logger[_0x84ae('0xf')]('UpdateVoiceAgentReport',_0x44f5db,JSON[_0x84ae('0x11')](_0x34ab6e));_0x17ebea(_0x34ab6e);})['catch'](function(_0x123988){logger[_0x84ae('0x12')](_0x84ae('0x1c'),_0x123988[_0x84ae('0x14')],_0x44f5db);_0x259f26(_0x1dff5e[_0x84ae('0x12')](0x1f4,_0x123988[_0x84ae('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e9b6fe7..9b2e651 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 _0x3345=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete'];(function(_0x246530,_0x480efd){var _0x2639a7=function(_0x5b5956){while(--_0x5b5956){_0x246530['push'](_0x246530['shift']());}};_0x2639a7(++_0x480efd);}(_0x3345,0xe6));var _0x5334=function(_0x52010c,_0x476c68){_0x52010c=_0x52010c-0x0;var _0x30bcb5=_0x3345[_0x52010c];return _0x30bcb5;};'use strict';var multer=require('multer');var util=require(_0x5334('0x0'));var path=require(_0x5334('0x1'));var timeout=require(_0x5334('0x2'));var express=require(_0x5334('0x3'));var router=express['Router']();var auth=require(_0x5334('0x4'));var interaction=require(_0x5334('0x5'));var config=require('../../config/environment');var controller=require(_0x5334('0x6'));router[_0x5334('0x7')]('/',auth[_0x5334('0x8')](),controller[_0x5334('0x9')]);router[_0x5334('0x7')](_0x5334('0xa'),auth[_0x5334('0x8')](),controller['describe']);router[_0x5334('0x7')](_0x5334('0xb'),auth[_0x5334('0x8')](),controller[_0x5334('0xc')]);router[_0x5334('0xd')]('/',auth[_0x5334('0x8')](),controller[_0x5334('0xe')]);router['put'](_0x5334('0xb'),auth[_0x5334('0x8')](),controller[_0x5334('0xf')]);router[_0x5334('0x10')](_0x5334('0xb'),auth['isAuthenticated'](),controller[_0x5334('0x11')]);module[_0x5334('0x12')]=router; \ No newline at end of file +var _0x8cb6=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','create','put','update','/:id','exports','multer','util'];(function(_0x1b60b0,_0x267f7d){var _0x1925ec=function(_0xc260f7){while(--_0xc260f7){_0x1b60b0['push'](_0x1b60b0['shift']());}};_0x1925ec(++_0x267f7d);}(_0x8cb6,0xfa));var _0x68cb=function(_0x50c710,_0x504134){_0x50c710=_0x50c710-0x0;var _0x2d5f79=_0x8cb6[_0x50c710];return _0x2d5f79;};'use strict';var multer=require(_0x68cb('0x0'));var util=require(_0x68cb('0x1'));var path=require(_0x68cb('0x2'));var timeout=require(_0x68cb('0x3'));var express=require(_0x68cb('0x4'));var router=express['Router']();var auth=require(_0x68cb('0x5'));var interaction=require(_0x68cb('0x6'));var config=require(_0x68cb('0x7'));var controller=require('./voiceCallReport.controller');router[_0x68cb('0x8')]('/',auth[_0x68cb('0x9')](),controller[_0x68cb('0xa')]);router[_0x68cb('0x8')](_0x68cb('0xb'),auth[_0x68cb('0x9')](),controller['describe']);router[_0x68cb('0x8')]('/:id',auth[_0x68cb('0x9')](),controller[_0x68cb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x68cb('0xd')]);router[_0x68cb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x68cb('0xf')]);router['delete'](_0x68cb('0x10'),auth[_0x68cb('0x9')](),controller['destroy']);module[_0x68cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a465af7..7b5264c 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 _0x5292=['outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','internal','outbound','inbound-fax'];(function(_0x45fb6b,_0x1475bd){var _0x1fd0ac=function(_0x5b9c2d){while(--_0x5b9c2d){_0x45fb6b['push'](_0x45fb6b['shift']());}};_0x1fd0ac(++_0x1475bd);}(_0x5292,0xf7));var _0x2529=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x5292[_0x371b64];return _0x3cf3b1;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2529('0x2')]('inbound',_0x2529('0x3'),_0x2529('0x4'),_0x2529('0x5'),_0x2529('0x6'),'dialer')},'tag':{'type':Sequelize[_0x2529('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x2529('0x7')]},'callerid':{'type':Sequelize[_0x2529('0x7')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2529('0x7')]},'lastdata':{'type':Sequelize[_0x2529('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x2529('0x9')]},'answertime':{'type':Sequelize[_0x2529('0x9')]},'endtime':{'type':Sequelize[_0x2529('0x9')]},'duration':{'type':Sequelize[_0x2529('0xa')]},'billableseconds':{'type':Sequelize[_0x2529('0xa')]},'mohtime':{'type':Sequelize[_0x2529('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2529('0x7')]},'amaflags':{'type':Sequelize[_0x2529('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x2529('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x2529('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2529('0x7')]},'prefix':{'type':Sequelize[_0x2529('0x7')]},'routeid':{'type':Sequelize[_0x2529('0xa')]},'sipcallid':{'type':Sequelize[_0x2529('0x7')]}}; \ No newline at end of file +var _0x038b=['internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','exports','STRING','ENUM'];(function(_0x38c1fe,_0x3f2e6f){var _0x24d5f5=function(_0x150ca9){while(--_0x150ca9){_0x38c1fe['push'](_0x38c1fe['shift']());}};_0x24d5f5(++_0x3f2e6f);}(_0x038b,0x114));var _0xb038=function(_0x51ad22,_0x20d502){_0x51ad22=_0x51ad22-0x0;var _0x1e677f=_0x038b[_0x51ad22];return _0x1e677f;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'type':{'type':Sequelize[_0xb038('0x2')]('inbound',_0xb038('0x3'),'outbound',_0xb038('0x4'),_0xb038('0x5'),'dialer')},'tag':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xb038('0x1')]},'callerid':{'type':Sequelize[_0xb038('0x1')]},'channel':{'type':Sequelize[_0xb038('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb038('0x6')]},'starttime':{'type':Sequelize[_0xb038('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb038('0x7')]},'duration':{'type':Sequelize[_0xb038('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb038('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb038('0x1')]},'amaflags':{'type':Sequelize[_0xb038('0x1')]},'userfield':{'type':Sequelize[_0xb038('0x1')]},'userDisposition':{'type':Sequelize[_0xb038('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xb038('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xb038('0x1')]},'note':{'type':Sequelize[_0xb038('0x1')]},'prefix':{'type':Sequelize[_0xb038('0x1')]},'routeid':{'type':Sequelize[_0xb038('0x8')]},'sipcallid':{'type':Sequelize[_0xb038('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 52c5ff5..e7283be 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 _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 50a7bd4..267c514 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 _0xfbfd=['bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment'];(function(_0x3cd611,_0x2aef4f){var _0x5a16cd=function(_0x200ce3){while(--_0x200ce3){_0x3cd611['push'](_0x3cd611['shift']());}};_0x5a16cd(++_0x2aef4f);}(_0xfbfd,0x6c));var _0xdfbf=function(_0x4a03a0,_0x1a5b7c){_0x4a03a0=_0x4a03a0-0x0;var _0x35e242=_0xfbfd[_0x4a03a0];return _0x35e242;};'use strict';var _=require(_0xdfbf('0x0'));var util=require(_0xdfbf('0x1'));var logger=require('../../config/logger')(_0xdfbf('0x2'));var moment=require(_0xdfbf('0x3'));var BPromise=require(_0xdfbf('0x4'));var rp=require(_0xdfbf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfbf('0x6'));var config=require(_0xdfbf('0x7'));var attributes=require(_0xdfbf('0x8'));module[_0xdfbf('0x9')]=function(_0x11c6b1,_0x344771){return _0x11c6b1[_0xdfbf('0xa')](_0xdfbf('0xb'),attributes,{'tableName':_0xdfbf('0xc'),'paranoid':![],'indexes':[{'fields':[_0xdfbf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd29=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x30a3ea,_0x1ef557){var _0x170c98=function(_0x59dd23){while(--_0x59dd23){_0x30a3ea['push'](_0x30a3ea['shift']());}};_0x170c98(++_0x1ef557);}(_0xdd29,0x93));var _0x9dd2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd29[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9dd2('0x0'));var util=require(_0x9dd2('0x1'));var logger=require(_0x9dd2('0x2'))(_0x9dd2('0x3'));var moment=require(_0x9dd2('0x4'));var BPromise=require(_0x9dd2('0x5'));var rp=require(_0x9dd2('0x6'));var fs=require('fs');var path=require(_0x9dd2('0x7'));var rimraf=require(_0x9dd2('0x8'));var config=require(_0x9dd2('0x9'));var attributes=require(_0x9dd2('0xa'));module[_0x9dd2('0xb')]=function(_0x2eb35e,_0x475a8e){return _0x2eb35e[_0x9dd2('0xc')](_0x9dd2('0xd'),attributes,{'tableName':_0x9dd2('0xe'),'paranoid':![],'indexes':[{'fields':[_0x9dd2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 54d71c1..7162731 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 _0xe245=['../../config/environment','client','http','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','attributes','include','map','model','then','debug','stringify','CreateVoiceCallReport','create','update','where','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d1bd4,_0x5ad706){var _0x330536=function(_0x47eda7){while(--_0x47eda7){_0x5d1bd4['push'](_0x5d1bd4['shift']());}};_0x330536(++_0x5ad706);}(_0xe245,0xe8));var _0x5e24=function(_0x4a8b37,_0x529545){_0x4a8b37=_0x4a8b37-0x0;var _0x5710e3=_0xe245[_0x4a8b37];return _0x5710e3;};'use strict';var _=require(_0x5e24('0x0'));var util=require('util');var moment=require(_0x5e24('0x1'));var BPromise=require(_0x5e24('0x2'));var rs=require(_0x5e24('0x3'));var fs=require('fs');var Redis=require(_0x5e24('0x4'));var db=require(_0x5e24('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5e24('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5e24('0x7')][_0x5e24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd04dd2,_0x33a964,_0x501bac){return new BPromise(function(_0x185ff8,_0x1d6e20){return client['request'](_0xd04dd2,_0x501bac)['then'](function(_0x1e6453){logger[_0x5e24('0x9')](_0x5e24('0xa'),_0x33a964,'request\x20sent');logger['debug'](_0x5e24('0xb'),_0x33a964,_0x5e24('0xc'),JSON['stringify'](_0x1e6453));if(_0x1e6453['error']){if(_0x1e6453[_0x5e24('0xd')][_0x5e24('0xe')]===0x1f4){logger[_0x5e24('0xd')](_0x5e24('0xa'),_0x33a964,_0x1e6453[_0x5e24('0xd')]['message']);return _0x1d6e20(_0x1e6453[_0x5e24('0xd')]['message']);}logger[_0x5e24('0xd')](_0x5e24('0xa'),_0x33a964,_0x1e6453[_0x5e24('0xd')][_0x5e24('0xf')]);return _0x185ff8(_0x1e6453[_0x5e24('0xd')]['message']);}else{logger[_0x5e24('0x9')]('VoiceCallReport,\x20%s,\x20%s',_0x33a964,'request\x20sent');_0x185ff8(_0x1e6453[_0x5e24('0x10')]['message']);}})[_0x5e24('0x11')](function(_0xa4ca0c){logger[_0x5e24('0xd')](_0x5e24('0xa'),_0x33a964,_0xa4ca0c);_0x1d6e20(_0xa4ca0c);});});}exports[_0x5e24('0x12')]=function(_0x366a98){var _0x415c69=this;return new Promise(function(_0x51ce04,_0x13a87c){return db[_0x5e24('0x13')]['findAll']({'raw':_0x366a98[_0x5e24('0x14')]?_0x366a98[_0x5e24('0x14')][_0x5e24('0x15')]===undefined?!![]:![]:!![],'where':_0x366a98['options']?_0x366a98[_0x5e24('0x14')]['where']||null:null,'attributes':_0x366a98['options']?_0x366a98[_0x5e24('0x14')][_0x5e24('0x16')]||null:null,'limit':_0x366a98['options']?_0x366a98['options']['limit']||null:null,'include':_0x366a98[_0x5e24('0x14')]?_0x366a98[_0x5e24('0x14')][_0x5e24('0x17')]?_[_0x5e24('0x18')](_0x366a98['options'][_0x5e24('0x17')],function(_0x282907){return{'model':db[_0x282907['model']],'as':_0x282907['as'],'attributes':_0x282907['attributes'],'include':_0x282907[_0x5e24('0x17')]?_[_0x5e24('0x18')](_0x282907[_0x5e24('0x17')],function(_0x1cf5a7){return{'model':db[_0x1cf5a7[_0x5e24('0x19')]],'as':_0x1cf5a7['as'],'attributes':_0x1cf5a7[_0x5e24('0x16')],'include':_0x1cf5a7[_0x5e24('0x17')]?_[_0x5e24('0x18')](_0x1cf5a7['include'],function(_0x26ee70){return{'model':db[_0x26ee70[_0x5e24('0x19')]],'as':_0x26ee70['as'],'attributes':_0x26ee70[_0x5e24('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5e24('0x1a')](function(_0x29a24c){logger[_0x5e24('0x9')]('GetVoiceCallReport',_0x366a98);logger[_0x5e24('0x1b')](_0x5e24('0x12'),_0x366a98,JSON[_0x5e24('0x1c')](_0x29a24c));_0x51ce04(_0x29a24c);})[_0x5e24('0x11')](function(_0x4e8426){logger[_0x5e24('0xd')](_0x5e24('0x12'),_0x4e8426[_0x5e24('0xf')],_0x366a98);_0x13a87c(_0x415c69[_0x5e24('0xd')](0x1f4,_0x4e8426[_0x5e24('0xf')]));});});};exports[_0x5e24('0x1d')]=function(_0x4d54b8){var _0x7c4f96=this;return new Promise(function(_0x13738e,_0x567532){return db['VoiceCallReport'][_0x5e24('0x1e')](_0x4d54b8['body'],{'raw':_0x4d54b8['options']?_0x4d54b8[_0x5e24('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x5e24('0x1a')](function(_0x1310df){logger[_0x5e24('0x9')](_0x5e24('0x1d'),_0x4d54b8);logger[_0x5e24('0x1b')](_0x5e24('0x1d'),_0x4d54b8,JSON[_0x5e24('0x1c')](_0x1310df));_0x13738e(_0x1310df);})[_0x5e24('0x11')](function(_0x4a9025){logger[_0x5e24('0xd')](_0x5e24('0x1d'),_0x4a9025['message'],_0x4d54b8);_0x567532(_0x7c4f96[_0x5e24('0xd')](0x1f4,_0x4a9025[_0x5e24('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x332f39){var _0x289085=this;return new Promise(function(_0x30c44a,_0x165117){return db['VoiceCallReport'][_0x5e24('0x1f')](_0x332f39['body'],{'raw':_0x332f39[_0x5e24('0x14')]?_0x332f39[_0x5e24('0x14')][_0x5e24('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x332f39[_0x5e24('0x14')]?_0x332f39[_0x5e24('0x14')][_0x5e24('0x20')]||null:null,'attributes':_0x332f39[_0x5e24('0x14')]?_0x332f39[_0x5e24('0x14')][_0x5e24('0x16')]||null:null,'limit':_0x332f39[_0x5e24('0x14')]?_0x332f39[_0x5e24('0x14')]['limit']||null:null})[_0x5e24('0x1a')](function(_0x55412a){logger[_0x5e24('0x9')](_0x5e24('0x21'),_0x332f39);logger[_0x5e24('0x1b')](_0x5e24('0x21'),_0x332f39,JSON[_0x5e24('0x1c')](_0x55412a));_0x30c44a(_0x55412a);})[_0x5e24('0x11')](function(_0x501fbc){logger[_0x5e24('0xd')](_0x5e24('0x21'),_0x501fbc[_0x5e24('0xf')],_0x332f39);_0x165117(_0x289085['error'](0x1f4,_0x501fbc[_0x5e24('0xf')]));});});}; \ No newline at end of file +var _0x5bea=['request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','raw','options','where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s'];(function(_0x1599bf,_0x3cc1fb){var _0x2470f2=function(_0x555023){while(--_0x555023){_0x1599bf['push'](_0x1599bf['shift']());}};_0x2470f2(++_0x3cc1fb);}(_0x5bea,0x94));var _0xa5be=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5bea[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa5be('0x0'));var util=require(_0xa5be('0x1'));var moment=require(_0xa5be('0x2'));var BPromise=require(_0xa5be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5be('0x5'));var logger=require(_0xa5be('0x6'))(_0xa5be('0x7'));var config=require(_0xa5be('0x8'));var jayson=require(_0xa5be('0x9'));var client=jayson[_0xa5be('0xa')][_0xa5be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2506c4,_0x3da506,_0x35658d){return new BPromise(function(_0x4b99a0,_0x4dc683){return client[_0xa5be('0xc')](_0x2506c4,_0x35658d)[_0xa5be('0xd')](function(_0x88d27f){logger[_0xa5be('0xe')](_0xa5be('0xf'),_0x3da506,_0xa5be('0x10'));logger[_0xa5be('0x11')](_0xa5be('0x12'),_0x3da506,_0xa5be('0x10'),JSON[_0xa5be('0x13')](_0x88d27f));if(_0x88d27f[_0xa5be('0x14')]){if(_0x88d27f[_0xa5be('0x14')][_0xa5be('0x15')]===0x1f4){logger[_0xa5be('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x3da506,_0x88d27f[_0xa5be('0x14')][_0xa5be('0x16')]);return _0x4dc683(_0x88d27f[_0xa5be('0x14')][_0xa5be('0x16')]);}logger[_0xa5be('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x3da506,_0x88d27f[_0xa5be('0x14')]['message']);return _0x4b99a0(_0x88d27f[_0xa5be('0x14')]['message']);}else{logger[_0xa5be('0xe')](_0xa5be('0xf'),_0x3da506,_0xa5be('0x10'));_0x4b99a0(_0x88d27f[_0xa5be('0x17')][_0xa5be('0x16')]);}})[_0xa5be('0x18')](function(_0x4b76ae){logger[_0xa5be('0x14')](_0xa5be('0xf'),_0x3da506,_0x4b76ae);_0x4dc683(_0x4b76ae);});});}exports[_0xa5be('0x19')]=function(_0x2053f3){var _0x2bc316=this;return new Promise(function(_0x2a200d,_0x35db69){return db['VoiceCallReport'][_0xa5be('0x1a')]({'raw':_0x2053f3['options']?_0x2053f3['options'][_0xa5be('0x1b')]===undefined?!![]:![]:!![],'where':_0x2053f3[_0xa5be('0x1c')]?_0x2053f3[_0xa5be('0x1c')][_0xa5be('0x1d')]||null:null,'attributes':_0x2053f3[_0xa5be('0x1c')]?_0x2053f3[_0xa5be('0x1c')][_0xa5be('0x1e')]||null:null,'limit':_0x2053f3[_0xa5be('0x1c')]?_0x2053f3['options'][_0xa5be('0x1f')]||null:null,'include':_0x2053f3[_0xa5be('0x1c')]?_0x2053f3[_0xa5be('0x1c')][_0xa5be('0x20')]?_[_0xa5be('0x21')](_0x2053f3[_0xa5be('0x1c')][_0xa5be('0x20')],function(_0xeed8a){return{'model':db[_0xeed8a[_0xa5be('0x22')]],'as':_0xeed8a['as'],'attributes':_0xeed8a[_0xa5be('0x1e')],'include':_0xeed8a[_0xa5be('0x20')]?_['map'](_0xeed8a['include'],function(_0x20c021){return{'model':db[_0x20c021[_0xa5be('0x22')]],'as':_0x20c021['as'],'attributes':_0x20c021['attributes'],'include':_0x20c021[_0xa5be('0x20')]?_[_0xa5be('0x21')](_0x20c021[_0xa5be('0x20')],function(_0x146a7d){return{'model':db[_0x146a7d[_0xa5be('0x22')]],'as':_0x146a7d['as'],'attributes':_0x146a7d[_0xa5be('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa5be('0xd')](function(_0x52cfe0){logger['info'](_0xa5be('0x19'),_0x2053f3);logger['debug'](_0xa5be('0x19'),_0x2053f3,JSON[_0xa5be('0x13')](_0x52cfe0));_0x2a200d(_0x52cfe0);})['catch'](function(_0x2739c2){logger[_0xa5be('0x14')](_0xa5be('0x19'),_0x2739c2[_0xa5be('0x16')],_0x2053f3);_0x35db69(_0x2bc316[_0xa5be('0x14')](0x1f4,_0x2739c2[_0xa5be('0x16')]));});});};exports[_0xa5be('0x23')]=function(_0xeebdb2){var _0x42487c=this;return new Promise(function(_0x3213de,_0x8f083f){return db[_0xa5be('0x24')][_0xa5be('0x25')](_0xeebdb2[_0xa5be('0x26')],{'raw':_0xeebdb2[_0xa5be('0x1c')]?_0xeebdb2['options'][_0xa5be('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3b4d5d){logger[_0xa5be('0xe')]('CreateVoiceCallReport',_0xeebdb2);logger[_0xa5be('0x11')](_0xa5be('0x23'),_0xeebdb2,JSON[_0xa5be('0x13')](_0x3b4d5d));_0x3213de(_0x3b4d5d);})[_0xa5be('0x18')](function(_0x34e3bd){logger[_0xa5be('0x14')](_0xa5be('0x23'),_0x34e3bd[_0xa5be('0x16')],_0xeebdb2);_0x8f083f(_0x42487c[_0xa5be('0x14')](0x1f4,_0x34e3bd[_0xa5be('0x16')]));});});};exports[_0xa5be('0x27')]=function(_0x1055e8){var _0x696977=this;return new Promise(function(_0x30dfed,_0x4b1df3){return db[_0xa5be('0x24')][_0xa5be('0x28')](_0x1055e8[_0xa5be('0x26')],{'raw':_0x1055e8['options']?_0x1055e8['options'][_0xa5be('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1055e8[_0xa5be('0x1c')]?_0x1055e8[_0xa5be('0x1c')]['where']||null:null,'attributes':_0x1055e8[_0xa5be('0x1c')]?_0x1055e8['options']['attributes']||null:null,'limit':_0x1055e8['options']?_0x1055e8[_0xa5be('0x1c')]['limit']||null:null})[_0xa5be('0xd')](function(_0x20fb29){logger[_0xa5be('0xe')]('UpdateVoiceCallReport',_0x1055e8);logger['debug'](_0xa5be('0x27'),_0x1055e8,JSON[_0xa5be('0x13')](_0x20fb29));_0x30dfed(_0x20fb29);})['catch'](function(_0x6cf0dd){logger['error'](_0xa5be('0x27'),_0x6cf0dd[_0xa5be('0x16')],_0x1055e8);_0x4b1df3(_0x696977[_0xa5be('0x14')](0x1f4,_0x6cf0dd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index cd24334..3169472 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 _0x1a96=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1a96,0x1a3));var _0x61a9=function(_0x433da5,_0x1a4a6e){_0x433da5=_0x433da5-0x0;var _0x18557d=_0x1a96[_0x433da5];return _0x18557d;};'use strict';var multer=require(_0x61a9('0x0'));var util=require(_0x61a9('0x1'));var path=require(_0x61a9('0x2'));var timeout=require(_0x61a9('0x3'));var express=require('express');var router=express[_0x61a9('0x4')]();var auth=require(_0x61a9('0x5'));var interaction=require(_0x61a9('0x6'));var config=require('../../config/environment');var controller=require(_0x61a9('0x7'));router[_0x61a9('0x8')]('/',auth[_0x61a9('0x9')](),controller[_0x61a9('0xa')]);router[_0x61a9('0x8')]('/:id',auth[_0x61a9('0x9')](),controller[_0x61a9('0xb')]);router[_0x61a9('0xc')]('/',auth[_0x61a9('0x9')](),controller[_0x61a9('0xd')]);router['put'](_0x61a9('0xe'),auth[_0x61a9('0x9')](),controller[_0x61a9('0xf')]);router[_0x61a9('0x10')](_0x61a9('0xe'),auth[_0x61a9('0x9')](),controller[_0x61a9('0x11')]);module[_0x61a9('0x12')]=router; \ No newline at end of file +var _0xeb98=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy'];(function(_0x5359f2,_0x3b25ae){var _0x44cd45=function(_0x2a474c){while(--_0x2a474c){_0x5359f2['push'](_0x5359f2['shift']());}};_0x44cd45(++_0x3b25ae);}(_0xeb98,0xe0));var _0x8eb9=function(_0x403b2c,_0x5e5213){_0x403b2c=_0x403b2c-0x0;var _0x56ce49=_0xeb98[_0x403b2c];return _0x56ce49;};'use strict';var multer=require('multer');var util=require(_0x8eb9('0x0'));var path=require(_0x8eb9('0x1'));var timeout=require(_0x8eb9('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8eb9('0x3'));var config=require(_0x8eb9('0x4'));var controller=require(_0x8eb9('0x5'));router[_0x8eb9('0x6')]('/',auth['isAuthenticated'](),controller[_0x8eb9('0x7')]);router[_0x8eb9('0x6')](_0x8eb9('0x8'),auth['isAuthenticated'](),controller[_0x8eb9('0x9')]);router[_0x8eb9('0xa')]('/',auth[_0x8eb9('0xb')](),controller[_0x8eb9('0xc')]);router[_0x8eb9('0xd')](_0x8eb9('0x8'),auth[_0x8eb9('0xb')](),controller[_0x8eb9('0xe')]);router['delete'](_0x8eb9('0x8'),auth[_0x8eb9('0xb')](),controller[_0x8eb9('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7e3261d..ca6d575 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 _0xa8ab=['setDataValue','join','getDataValue','options','BOOLEAN','exports','STRING','name'];(function(_0x4159d8,_0x578d2a){var _0x3d71f6=function(_0x424877){while(--_0x424877){_0x4159d8['push'](_0x4159d8['shift']());}};_0x3d71f6(++_0x578d2a);}(_0xa8ab,0xc5));var _0xba8a=function(_0x2337ef,_0x36b419){_0x2337ef=_0x2337ef-0x0;var _0x17c357=_0xa8ab[_0x2337ef];return _0x17c357;};'use strict';var Sequelize=require('sequelize');module[_0xba8a('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xba8a('0x1')],'unique':_0xba8a('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2cd5b2){this[_0xba8a('0x3')]('options',_0x2cd5b2?_0x2cd5b2[_0xba8a('0x4')](''):[]);},'get':function(){return this[_0xba8a('0x5')](_0xba8a('0x6'))?this['getDataValue'](_0xba8a('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0xba8a('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xba8a('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xba8a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4ab=['split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','getDataValue','options'];(function(_0x11e6f3,_0x28c7b4){var _0x5858bc=function(_0x4c695a){while(--_0x4c695a){_0x11e6f3['push'](_0x11e6f3['shift']());}};_0x5858bc(++_0x28c7b4);}(_0xc4ab,0x92));var _0xbc4a=function(_0x24b6ae,_0x1639d8){_0x24b6ae=_0x24b6ae-0x0;var _0x56ddcd=_0xc4ab[_0x24b6ae];return _0x56ddcd;};'use strict';var Sequelize=require(_0xbc4a('0x0'));module[_0xbc4a('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xbc4a('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xbc4a('0x3')],'set':function(_0x208da5){this[_0xbc4a('0x4')]('options',_0x208da5?_0x208da5['join'](''):[]);},'get':function(){return this[_0xbc4a('0x5')](_0xbc4a('0x6'))?this[_0xbc4a('0x5')](_0xbc4a('0x6'))[_0xbc4a('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xbc4a('0x3')]},'record':{'type':Sequelize[_0xbc4a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbc4a('0x3')]},'description':{'type':Sequelize[_0xbc4a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5e2bea4..d71989c 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 _0x42dc=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoiceChanSpy','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','keys','include','find','create','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params'];(function(_0x56ca15,_0x1a7414){var _0x275429=function(_0x31dec9){while(--_0x31dec9){_0x56ca15['push'](_0x56ca15['shift']());}};_0x275429(++_0x1a7414);}(_0x42dc,0x9c));var _0xc42d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x42dc[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0xc42d('0x0'));var emlformat=require(_0xc42d('0x1'));var rimraf=require(_0xc42d('0x2'));var zipdir=require(_0xc42d('0x3'));var jsonpatch=require(_0xc42d('0x4'));var rp=require('request-promise');var moment=require(_0xc42d('0x5'));var BPromise=require(_0xc42d('0x6'));var Mustache=require(_0xc42d('0x7'));var util=require(_0xc42d('0x8'));var path=require(_0xc42d('0x9'));var sox=require(_0xc42d('0xa'));var csv=require(_0xc42d('0xb'));var ejs=require(_0xc42d('0xc'));var fs=require('fs');var _=require(_0xc42d('0xd'));var squel=require(_0xc42d('0xe'));var crypto=require(_0xc42d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc42d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc42d('0x11'));var Papa=require(_0xc42d('0x12'));var Redis=require('ioredis');var authService=require(_0xc42d('0x13'));var qs=require(_0xc42d('0x14'));var as=require(_0xc42d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc42d('0x16'))(_0xc42d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc42d('0x18'));var db=require(_0xc42d('0x19'))['db'];function respondWithStatusCode(_0x514226,_0x47b151){_0x47b151=_0x47b151||0xcc;return function(_0x2679a0){if(_0x2679a0){return _0x514226[_0xc42d('0x1a')](_0x47b151);}return _0x514226['status'](_0x47b151)['end']();};}function respondWithResult(_0x57e234,_0x9ba485){_0x9ba485=_0x9ba485||0xc8;return function(_0x1b2bd1){if(_0x1b2bd1){return _0x57e234[_0xc42d('0x1b')](_0x9ba485)[_0xc42d('0x1c')](_0x1b2bd1);}};}function respondWithFilteredResult(_0xedfab,_0xb9ed46){return function(_0x1f30bd){if(_0x1f30bd){var _0x369a12=_0x1f30bd[_0xc42d('0x1d')],_0x3cd5e1=_0xb9ed46[_0xc42d('0x1e')],_0x47d2bf=_0xb9ed46[_0xc42d('0x1e')]+_0xb9ed46[_0xc42d('0x1f')],_0x3021b1;if(_0x47d2bf>=_0x369a12){_0x47d2bf=_0x369a12;_0x3021b1=0xc8;}else{_0x3021b1=0xce;}_0xedfab[_0xc42d('0x1b')](_0x3021b1);return _0xedfab[_0xc42d('0x20')]('Content-Range',_0x3cd5e1+'-'+_0x47d2bf+'/'+_0x369a12)[_0xc42d('0x1c')](_0x1f30bd);}return null;};}function patchUpdates(_0x542dcd){return function(_0x11e879){try{jsonpatch[_0xc42d('0x21')](_0x11e879,_0x542dcd,!![]);}catch(_0x544d3c){return BPromise[_0xc42d('0x22')](_0x544d3c);}return _0x11e879[_0xc42d('0x23')]();};}function saveUpdates(_0x30aeff,_0x5df2c9){return function(_0x7d0b79){if(_0x7d0b79){return _0x7d0b79[_0xc42d('0x24')](_0x30aeff)[_0xc42d('0x25')](function(_0x1afd23){return _0x1afd23;});}return null;};}function removeEntity(_0x8ccc0,_0xbbe18c){return function(_0x3deaa1){if(_0x3deaa1){return _0x3deaa1[_0xc42d('0x26')]()[_0xc42d('0x25')](function(){var _0x4aab4b=_0x3deaa1[_0xc42d('0x27')]({'plain':!![]});var _0x460d13='ChanSpies';return db[_0xc42d('0x28')][_0xc42d('0x26')]({'where':{'type':_0x460d13,'resourceId':_0x4aab4b['id']}})[_0xc42d('0x25')](function(){return _0x3deaa1;});})[_0xc42d('0x25')](function(){_0x8ccc0[_0xc42d('0x1b')](0xcc)[_0xc42d('0x29')]();});}};}function handleEntityNotFound(_0x5aa7ee,_0x68b41e){return function(_0xc7a87b){if(!_0xc7a87b){_0x5aa7ee['sendStatus'](0x194);}return _0xc7a87b;};}function handleError(_0x236804,_0xad09c0){_0xad09c0=_0xad09c0||0x1f4;return function(_0x5118b5){logger[_0xc42d('0x2a')](_0x5118b5['stack']);if(_0x5118b5['name']){delete _0x5118b5[_0xc42d('0x2b')];}_0x236804['status'](_0xad09c0)[_0xc42d('0x2c')](_0x5118b5);};}exports[_0xc42d('0x2d')]=function(_0x499c6d,_0x139741){var _0x3ab40b={},_0x1d9514={},_0x5b4a02={'count':0x0,'rows':[]};var _0x5dd786=_[_0xc42d('0x2e')](db[_0xc42d('0x2f')][_0xc42d('0x30')],function(_0x1b3ab2){return{'name':_0x1b3ab2['fieldName'],'type':_0x1b3ab2[_0xc42d('0x31')]['key']};});_0x1d9514[_0xc42d('0x32')]=_[_0xc42d('0x2e')](_0x5dd786,_0xc42d('0x2b'));_0x1d9514[_0xc42d('0x33')]=_['keys'](_0x499c6d[_0xc42d('0x33')]);_0x1d9514[_0xc42d('0x34')]=_[_0xc42d('0x35')](_0x1d9514[_0xc42d('0x32')],_0x1d9514['query']);_0x3ab40b['attributes']=_['intersection'](_0x1d9514['model'],qs['fields'](_0x499c6d['query'][_0xc42d('0x36')]));_0x3ab40b['attributes']=_0x3ab40b[_0xc42d('0x37')][_0xc42d('0x38')]?_0x3ab40b[_0xc42d('0x37')]:_0x1d9514[_0xc42d('0x32')];if(!_0x499c6d[_0xc42d('0x33')][_0xc42d('0x39')](_0xc42d('0x3a'))){_0x3ab40b[_0xc42d('0x1f')]=qs['limit'](_0x499c6d['query'][_0xc42d('0x1f')]);_0x3ab40b['offset']=qs[_0xc42d('0x1e')](_0x499c6d[_0xc42d('0x33')][_0xc42d('0x1e')]);}_0x3ab40b[_0xc42d('0x3b')]=qs[_0xc42d('0x3c')](_0x499c6d[_0xc42d('0x33')][_0xc42d('0x3c')]);_0x3ab40b[_0xc42d('0x3d')]=qs[_0xc42d('0x34')](_[_0xc42d('0x3e')](_0x499c6d[_0xc42d('0x33')],_0x1d9514[_0xc42d('0x34')]),_0x5dd786);if(_0x499c6d[_0xc42d('0x33')][_0xc42d('0x3f')]){_0x3ab40b[_0xc42d('0x3d')]=_['merge'](_0x3ab40b['where'],{'$or':_[_0xc42d('0x2e')](_0x5dd786,function(_0x32a3ab){if(_0x32a3ab[_0xc42d('0x31')]!=='VIRTUAL'){var _0x253356={};_0x253356[_0x32a3ab[_0xc42d('0x2b')]]={'$like':'%'+_0x499c6d[_0xc42d('0x33')][_0xc42d('0x3f')]+'%'};return _0x253356;}})});}_0x3ab40b=_[_0xc42d('0x40')]({},_0x3ab40b,_0x499c6d[_0xc42d('0x41')]);var _0x49ec97={'where':_0x3ab40b[_0xc42d('0x3d')]};return db[_0xc42d('0x2f')][_0xc42d('0x1d')](_0x49ec97)[_0xc42d('0x25')](function(_0x188580){_0x5b4a02[_0xc42d('0x1d')]=_0x188580;if(_0x499c6d[_0xc42d('0x33')][_0xc42d('0x42')]){_0x3ab40b['include']=[{'all':!![]}];}return db[_0xc42d('0x2f')]['findAll'](_0x3ab40b);})[_0xc42d('0x25')](function(_0x29a8c2){_0x5b4a02[_0xc42d('0x43')]=_0x29a8c2;return _0x5b4a02;})[_0xc42d('0x25')](respondWithFilteredResult(_0x139741,_0x3ab40b))[_0xc42d('0x44')](handleError(_0x139741,null));};exports['show']=function(_0x27a5de,_0x3bca9c){var _0x5b11e5={'raw':![],'where':{'id':_0x27a5de['params']['id']}},_0x1a1151={};_0x1a1151[_0xc42d('0x32')]=_[_0xc42d('0x45')](db[_0xc42d('0x2f')][_0xc42d('0x30')]);_0x1a1151[_0xc42d('0x33')]=_[_0xc42d('0x45')](_0x27a5de['query']);_0x1a1151[_0xc42d('0x34')]=_[_0xc42d('0x35')](_0x1a1151[_0xc42d('0x32')],_0x1a1151['query']);_0x5b11e5[_0xc42d('0x37')]=_[_0xc42d('0x35')](_0x1a1151[_0xc42d('0x32')],qs['fields'](_0x27a5de[_0xc42d('0x33')][_0xc42d('0x36')]));_0x5b11e5[_0xc42d('0x37')]=_0x5b11e5['attributes']['length']?_0x5b11e5[_0xc42d('0x37')]:_0x1a1151[_0xc42d('0x32')];if(_0x27a5de[_0xc42d('0x33')][_0xc42d('0x42')]){_0x5b11e5[_0xc42d('0x46')]=[{'all':!![]}];}_0x5b11e5=_['merge']({},_0x5b11e5,_0x27a5de[_0xc42d('0x41')]);return db[_0xc42d('0x2f')][_0xc42d('0x47')](_0x5b11e5)[_0xc42d('0x25')](handleEntityNotFound(_0x3bca9c,null))[_0xc42d('0x25')](respondWithResult(_0x3bca9c,null))[_0xc42d('0x44')](handleError(_0x3bca9c,null));};exports['create']=function(_0x56c43f,_0x49722c){return db['VoiceChanSpy'][_0xc42d('0x48')](_0x56c43f['body'],{})['then'](function(_0x737be0){var _0x17e762=_0x56c43f[_0xc42d('0x49')][_0xc42d('0x27')]({'plain':!![]});if(!_0x17e762)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17e762['role']===_0xc42d('0x49')){var _0x30469d=_0x737be0[_0xc42d('0x27')]({'plain':!![]});var _0x4919ae='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x4919ae,'userProfileId':_0x17e762[_0xc42d('0x4a')]},'raw':!![]})[_0xc42d('0x25')](function(_0x501eb7){if(_0x501eb7&&_0x501eb7['autoAssociation']===0x0){return db[_0xc42d('0x28')]['create']({'name':_0x30469d[_0xc42d('0x2b')],'resourceId':_0x30469d['id'],'type':_0x501eb7['name'],'sectionId':_0x501eb7['id']},{})[_0xc42d('0x25')](function(){return _0x737be0;});}else{return _0x737be0;}})[_0xc42d('0x44')](function(_0x2d384e){logger[_0xc42d('0x2a')](_0xc42d('0x4b'),_0x2d384e);throw _0x2d384e;});}return _0x737be0;})[_0xc42d('0x25')](respondWithResult(_0x49722c,0xc9))[_0xc42d('0x44')](handleError(_0x49722c,null));};exports[_0xc42d('0x24')]=function(_0x514093,_0x4666ff){if(_0x514093[_0xc42d('0x4c')]['id']){delete _0x514093['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x514093['params']['id']}})['then'](handleEntityNotFound(_0x4666ff,null))[_0xc42d('0x25')](saveUpdates(_0x514093[_0xc42d('0x4c')],null))['then'](respondWithResult(_0x4666ff,null))[_0xc42d('0x44')](handleError(_0x4666ff,null));};exports[_0xc42d('0x26')]=function(_0xe17ea,_0x4e1e13){return db['VoiceChanSpy']['find']({'where':{'id':_0xe17ea[_0xc42d('0x4d')]['id']}})[_0xc42d('0x25')](handleEntityNotFound(_0x4e1e13,null))[_0xc42d('0x25')](removeEntity(_0x4e1e13,null))[_0xc42d('0x44')](handleError(_0x4e1e13,null));}; \ No newline at end of file +var _0xb274=['map','VoiceChanSpy','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','pick','filters','filter','where','VIRTUAL','merge','count','includeAll','rows','catch','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','Content-Range','apply','reject','update','destroy','then','ChanSpies','UserProfileResource','sendStatus','error','name','index'];(function(_0x330ffc,_0x31fc9d){var _0x3e2ca8=function(_0x5ae86b){while(--_0x5ae86b){_0x330ffc['push'](_0x330ffc['shift']());}};_0x3e2ca8(++_0x31fc9d);}(_0xb274,0x1c3));var _0x4b27=function(_0x3beb67,_0x103f5c){_0x3beb67=_0x3beb67-0x0;var _0xe4dd9a=_0xb274[_0x3beb67];return _0xe4dd9a;};'use strict';var pdf=require(_0x4b27('0x0'));var emlformat=require(_0x4b27('0x1'));var rimraf=require(_0x4b27('0x2'));var zipdir=require(_0x4b27('0x3'));var jsonpatch=require(_0x4b27('0x4'));var rp=require(_0x4b27('0x5'));var moment=require(_0x4b27('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4b27('0x7'));var util=require('util');var path=require(_0x4b27('0x8'));var sox=require(_0x4b27('0x9'));var csv=require(_0x4b27('0xa'));var ejs=require(_0x4b27('0xb'));var fs=require('fs');var _=require(_0x4b27('0xc'));var squel=require('squel');var crypto=require(_0x4b27('0xd'));var jsforce=require(_0x4b27('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b27('0xf'));var Papa=require(_0x4b27('0x10'));var Redis=require(_0x4b27('0x11'));var authService=require(_0x4b27('0x12'));var qs=require(_0x4b27('0x13'));var as=require(_0x4b27('0x14'));var hardwareService=require(_0x4b27('0x15'));var logger=require(_0x4b27('0x16'))('api');var utils=require(_0x4b27('0x17'));var config=require(_0x4b27('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b27('0x19'))['db'];function respondWithStatusCode(_0x1a24e7,_0x3c36a0){_0x3c36a0=_0x3c36a0||0xcc;return function(_0x2dffae){if(_0x2dffae){return _0x1a24e7['sendStatus'](_0x3c36a0);}return _0x1a24e7[_0x4b27('0x1a')](_0x3c36a0)[_0x4b27('0x1b')]();};}function respondWithResult(_0x3b2a80,_0x5144de){_0x5144de=_0x5144de||0xc8;return function(_0x12c9a9){if(_0x12c9a9){return _0x3b2a80[_0x4b27('0x1a')](_0x5144de)[_0x4b27('0x1c')](_0x12c9a9);}};}function respondWithFilteredResult(_0x351bff,_0x4c5831){return function(_0x14a525){if(_0x14a525){var _0x56d0e6=_0x14a525['count'],_0x3cf35c=_0x4c5831['offset'],_0xee7aaf=_0x4c5831['offset']+_0x4c5831['limit'],_0x1d08d1;if(_0xee7aaf>=_0x56d0e6){_0xee7aaf=_0x56d0e6;_0x1d08d1=0xc8;}else{_0x1d08d1=0xce;}_0x351bff[_0x4b27('0x1a')](_0x1d08d1);return _0x351bff['set'](_0x4b27('0x1d'),_0x3cf35c+'-'+_0xee7aaf+'/'+_0x56d0e6)[_0x4b27('0x1c')](_0x14a525);}return null;};}function patchUpdates(_0x49b5bb){return function(_0x4e5906){try{jsonpatch[_0x4b27('0x1e')](_0x4e5906,_0x49b5bb,!![]);}catch(_0x2c747b){return BPromise[_0x4b27('0x1f')](_0x2c747b);}return _0x4e5906['save']();};}function saveUpdates(_0x532c3e,_0x4f1115){return function(_0x5a2ff3){if(_0x5a2ff3){return _0x5a2ff3[_0x4b27('0x20')](_0x532c3e)['then'](function(_0xdc143a){return _0xdc143a;});}return null;};}function removeEntity(_0x20c210,_0x473ee0){return function(_0x2c5d39){if(_0x2c5d39){return _0x2c5d39[_0x4b27('0x21')]()[_0x4b27('0x22')](function(){var _0x5b6143=_0x2c5d39['get']({'plain':!![]});var _0x506be6=_0x4b27('0x23');return db[_0x4b27('0x24')][_0x4b27('0x21')]({'where':{'type':_0x506be6,'resourceId':_0x5b6143['id']}})[_0x4b27('0x22')](function(){return _0x2c5d39;});})[_0x4b27('0x22')](function(){_0x20c210[_0x4b27('0x1a')](0xcc)[_0x4b27('0x1b')]();});}};}function handleEntityNotFound(_0x106eff,_0x1f6809){return function(_0x2cfa6b){if(!_0x2cfa6b){_0x106eff[_0x4b27('0x25')](0x194);}return _0x2cfa6b;};}function handleError(_0x195340,_0x4396c9){_0x4396c9=_0x4396c9||0x1f4;return function(_0x558cef){logger[_0x4b27('0x26')](_0x558cef['stack']);if(_0x558cef[_0x4b27('0x27')]){delete _0x558cef[_0x4b27('0x27')];}_0x195340[_0x4b27('0x1a')](_0x4396c9)['send'](_0x558cef);};}exports[_0x4b27('0x28')]=function(_0x4b9b37,_0x2faff9){var _0x9dd991={},_0x150d6f={},_0x41621c={'count':0x0,'rows':[]};var _0x72f6f2=_[_0x4b27('0x29')](db[_0x4b27('0x2a')]['rawAttributes'],function(_0x2e3916){return{'name':_0x2e3916[_0x4b27('0x2b')],'type':_0x2e3916[_0x4b27('0x2c')][_0x4b27('0x2d')]};});_0x150d6f[_0x4b27('0x2e')]=_[_0x4b27('0x29')](_0x72f6f2,'name');_0x150d6f[_0x4b27('0x2f')]=_[_0x4b27('0x30')](_0x4b9b37[_0x4b27('0x2f')]);_0x150d6f['filters']=_[_0x4b27('0x31')](_0x150d6f[_0x4b27('0x2e')],_0x150d6f['query']);_0x9dd991[_0x4b27('0x32')]=_[_0x4b27('0x31')](_0x150d6f[_0x4b27('0x2e')],qs[_0x4b27('0x33')](_0x4b9b37[_0x4b27('0x2f')][_0x4b27('0x33')]));_0x9dd991[_0x4b27('0x32')]=_0x9dd991[_0x4b27('0x32')][_0x4b27('0x34')]?_0x9dd991[_0x4b27('0x32')]:_0x150d6f[_0x4b27('0x2e')];if(!_0x4b9b37[_0x4b27('0x2f')][_0x4b27('0x35')](_0x4b27('0x36'))){_0x9dd991[_0x4b27('0x37')]=qs[_0x4b27('0x37')](_0x4b9b37[_0x4b27('0x2f')][_0x4b27('0x37')]);_0x9dd991[_0x4b27('0x38')]=qs['offset'](_0x4b9b37['query'][_0x4b27('0x38')]);}_0x9dd991[_0x4b27('0x39')]=qs['sort'](_0x4b9b37[_0x4b27('0x2f')]['sort']);_0x9dd991['where']=qs['filters'](_[_0x4b27('0x3a')](_0x4b9b37[_0x4b27('0x2f')],_0x150d6f[_0x4b27('0x3b')]),_0x72f6f2);if(_0x4b9b37[_0x4b27('0x2f')][_0x4b27('0x3c')]){_0x9dd991[_0x4b27('0x3d')]=_['merge'](_0x9dd991[_0x4b27('0x3d')],{'$or':_['map'](_0x72f6f2,function(_0x211198){if(_0x211198[_0x4b27('0x2c')]!==_0x4b27('0x3e')){var _0x4c1ea2={};_0x4c1ea2[_0x211198['name']]={'$like':'%'+_0x4b9b37[_0x4b27('0x2f')][_0x4b27('0x3c')]+'%'};return _0x4c1ea2;}})});}_0x9dd991=_[_0x4b27('0x3f')]({},_0x9dd991,_0x4b9b37['options']);var _0x5d35d3={'where':_0x9dd991[_0x4b27('0x3d')]};return db['VoiceChanSpy'][_0x4b27('0x40')](_0x5d35d3)[_0x4b27('0x22')](function(_0x3ffb83){_0x41621c[_0x4b27('0x40')]=_0x3ffb83;if(_0x4b9b37[_0x4b27('0x2f')][_0x4b27('0x41')]){_0x9dd991['include']=[{'all':!![]}];}return db[_0x4b27('0x2a')]['findAll'](_0x9dd991);})[_0x4b27('0x22')](function(_0xde642){_0x41621c[_0x4b27('0x42')]=_0xde642;return _0x41621c;})[_0x4b27('0x22')](respondWithFilteredResult(_0x2faff9,_0x9dd991))[_0x4b27('0x43')](handleError(_0x2faff9,null));};exports['show']=function(_0x18e478,_0x29f1fa){var _0x589f55={'raw':![],'where':{'id':_0x18e478[_0x4b27('0x44')]['id']}},_0x1e5980={};_0x1e5980[_0x4b27('0x2e')]=_['keys'](db['VoiceChanSpy'][_0x4b27('0x45')]);_0x1e5980[_0x4b27('0x2f')]=_[_0x4b27('0x30')](_0x18e478[_0x4b27('0x2f')]);_0x1e5980[_0x4b27('0x3b')]=_[_0x4b27('0x31')](_0x1e5980[_0x4b27('0x2e')],_0x1e5980[_0x4b27('0x2f')]);_0x589f55['attributes']=_[_0x4b27('0x31')](_0x1e5980[_0x4b27('0x2e')],qs[_0x4b27('0x33')](_0x18e478[_0x4b27('0x2f')][_0x4b27('0x33')]));_0x589f55[_0x4b27('0x32')]=_0x589f55['attributes']['length']?_0x589f55[_0x4b27('0x32')]:_0x1e5980[_0x4b27('0x2e')];if(_0x18e478[_0x4b27('0x2f')]['includeAll']){_0x589f55[_0x4b27('0x46')]=[{'all':!![]}];}_0x589f55=_[_0x4b27('0x3f')]({},_0x589f55,_0x18e478[_0x4b27('0x47')]);return db[_0x4b27('0x2a')][_0x4b27('0x48')](_0x589f55)[_0x4b27('0x22')](handleEntityNotFound(_0x29f1fa,null))[_0x4b27('0x22')](respondWithResult(_0x29f1fa,null))['catch'](handleError(_0x29f1fa,null));};exports[_0x4b27('0x49')]=function(_0x9a8029,_0x589429){return db[_0x4b27('0x2a')][_0x4b27('0x49')](_0x9a8029[_0x4b27('0x4a')],{})[_0x4b27('0x22')](function(_0x116b0f){var _0xbb9c9c=_0x9a8029[_0x4b27('0x4b')]['get']({'plain':!![]});if(!_0xbb9c9c)throw new Error(_0x4b27('0x4c'));if(_0xbb9c9c[_0x4b27('0x4d')]===_0x4b27('0x4b')){var _0x5eec1c=_0x116b0f['get']({'plain':!![]});var _0x38e373='ChanSpies';return db[_0x4b27('0x4e')][_0x4b27('0x48')]({'where':{'name':_0x38e373,'userProfileId':_0xbb9c9c[_0x4b27('0x4f')]},'raw':!![]})[_0x4b27('0x22')](function(_0x8ed821){if(_0x8ed821&&_0x8ed821[_0x4b27('0x50')]===0x0){return db[_0x4b27('0x24')]['create']({'name':_0x5eec1c[_0x4b27('0x27')],'resourceId':_0x5eec1c['id'],'type':_0x8ed821[_0x4b27('0x27')],'sectionId':_0x8ed821['id']},{})[_0x4b27('0x22')](function(){return _0x116b0f;});}else{return _0x116b0f;}})[_0x4b27('0x43')](function(_0x482d2f){logger[_0x4b27('0x26')](_0x4b27('0x51'),_0x482d2f);throw _0x482d2f;});}return _0x116b0f;})[_0x4b27('0x22')](respondWithResult(_0x589429,0xc9))[_0x4b27('0x43')](handleError(_0x589429,null));};exports['update']=function(_0x3de69a,_0x322010){if(_0x3de69a['body']['id']){delete _0x3de69a[_0x4b27('0x4a')]['id'];}return db[_0x4b27('0x2a')][_0x4b27('0x48')]({'where':{'id':_0x3de69a[_0x4b27('0x44')]['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x322010,null))[_0x4b27('0x22')](saveUpdates(_0x3de69a[_0x4b27('0x4a')],null))[_0x4b27('0x22')](respondWithResult(_0x322010,null))[_0x4b27('0x43')](handleError(_0x322010,null));};exports[_0x4b27('0x21')]=function(_0x1802ee,_0x258810){return db[_0x4b27('0x2a')]['find']({'where':{'id':_0x1802ee[_0x4b27('0x44')]['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x258810,null))[_0x4b27('0x22')](removeEntity(_0x258810,null))['catch'](handleError(_0x258810,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 70f9e67..9433bcb 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 _0x0ec7=['exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','catch','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then'];(function(_0x204c4d,_0x8da627){var _0x1da111=function(_0x56e869){while(--_0x56e869){_0x204c4d['push'](_0x204c4d['shift']());}};_0x1da111(++_0x8da627);}(_0x0ec7,0x1dc));var _0x70ec=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x0ec7[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x70ec('0x0'));var util=require(_0x70ec('0x1'));var BPromise=require(_0x70ec('0x2'));var attributes=require(_0x70ec('0x3'));var getUserApplications=function(_0x220c32,_0xf3bac0,_0x57d8a1){var _0x484e25=0x1;var _0xbeafcd=[];var _0x2f6146={'context':_0xf3bac0['context']||'from-sip','exten':util[_0x70ec('0x4')](_0x70ec('0x5'),_0x220c32['prefix'],_0x57d8a1),'type':_0x70ec('0x6'),'isApp':![],'ChanSpyId':_0x220c32['id'],'UserId':_0xf3bac0['id']};_0xbeafcd[_0x70ec('0x7')](_[_0x70ec('0x8')]({'app':_0x70ec('0x9'),'appdata':util[_0x70ec('0x4')](_0x70ec('0xa'),_0x70ec('0xb')),'priority':_0x484e25++},_0x2f6146));if(_0x220c32['record']){_0xbeafcd[_0x70ec('0x7')](_[_0x70ec('0x8')]({'app':'MixMonitor','appdata':util[_0x70ec('0x4')](_0x70ec('0xc'),_0x220c32[_0x70ec('0xd')]),'priority':_0x484e25++},_0x2f6146));}if(_0x220c32[_0x70ec('0xe')]){_0xbeafcd[_0x70ec('0x7')](_['merge']({'app':_0x70ec('0xf'),'appdata':_0x220c32[_0x70ec('0x10')],'priority':_0x484e25++},_0x2f6146));}_0xbeafcd[_0x70ec('0x7')](_[_0x70ec('0x8')]({'app':_0x70ec('0x11'),'appdata':util[_0x70ec('0x4')](_0x70ec('0x12'),_0xf3bac0[_0x70ec('0x13')],_0x220c32[_0x70ec('0x14')]?_0x220c32[_0x70ec('0x14')][_0x70ec('0x15')](''):''),'priority':_0x484e25++},_0x2f6146));if(_0x220c32[_0x70ec('0x16')]){_0xbeafcd[_0x70ec('0x7')](_[_0x70ec('0x8')]({'app':_0x70ec('0x17'),'priority':_0x484e25++},_0x2f6146));}return _0xbeafcd;};var getChanSpyApplications=function(_0x2ff786,_0x486993){var _0x4a34c9=[];for(var _0x450f58=0x0,_0x48981c=0x1;_0x450f58<_0x486993[_0x70ec('0x18')];_0x450f58++,_0x48981c=0x1){_0x4a34c9=_0x4a34c9[_0x70ec('0x19')](getUserApplications(_0x2ff786,_0x486993[_0x450f58],_0x486993[_0x450f58][_0x70ec('0x1a')]));if(_0x486993[_0x450f58][_0x70ec('0x1a')]!=_0x486993[_0x450f58][_0x70ec('0x13')]){_0x4a34c9=_0x4a34c9[_0x70ec('0x19')](getUserApplications(_0x2ff786,_0x486993[_0x450f58],_0x486993[_0x450f58][_0x70ec('0x13')]));}}return _0x4a34c9;};var getChanSpyPromise=function(_0x588578,_0xaa3fd5){return new BPromise(function(_0x3a3c18,_0x7556be){return _0x588578[_0x70ec('0x1b')][_0x70ec('0x1c')]({'attributes':['id',_0x70ec('0x13'),_0x70ec('0x1a')],'where':{'role':_0x70ec('0x1d'),'chanspy':!![]},'raw':!![]})[_0x70ec('0x1e')](function(_0x255b9e){if(_0x255b9e){return _0x3a3c18(getChanSpyApplications(_0xaa3fd5,_0x255b9e));}return _0x3a3c18([]);})['catch'](function(_0xd8ae93){_0x7556be(_0xd8ae93);});});};module[_0x70ec('0x1f')]=function(_0x43a842,_0x575376){var _0xd86d9d=_0x43a842['models'];return _0x43a842[_0x70ec('0x20')](_0x70ec('0x21'),attributes,{'tableName':_0x70ec('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x546ee2,_0x1a7f8b,_0x633f5f){return getChanSpyPromise(_0xd86d9d,_0x546ee2)[_0x70ec('0x1e')](function(_0x12e983){if(_0x12e983&&_0x12e983[_0x70ec('0x18')]){return _0xd86d9d[_0x70ec('0x23')]['bulkCreate'](_0x12e983);}})[_0x70ec('0x1e')](function(){_0x633f5f();})[_0x70ec('0x24')](function(_0x201dc5){_0x633f5f(_0x201dc5);});},'afterUpdate':function(_0xdbc8f6,_0x5c23d7,_0x503a6f){return _0xd86d9d[_0x70ec('0x23')]['destroy']({'where':{'ChanSpyId':_0xdbc8f6['id']}})[_0x70ec('0x1e')](function(){return getChanSpyPromise(_0xd86d9d,_0xdbc8f6);})[_0x70ec('0x1e')](function(_0x1b7991){if(_0x1b7991&&_0x1b7991[_0x70ec('0x18')]){return _0xd86d9d[_0x70ec('0x23')][_0x70ec('0x25')](_0x1b7991);}})[_0x70ec('0x1e')](function(){_0x503a6f();})[_0x70ec('0x24')](function(_0x5baddf){_0x503a6f(_0x5baddf);});},'afterDestroy':function(_0x51dd1e,_0xfaec50,_0x21d864){return _0xd86d9d['VoiceExtension'][_0x70ec('0x26')]({'where':{'ChanSpyId':_0x51dd1e['id']}})[_0x70ec('0x1e')](function(){_0x21d864();})[_0x70ec('0x24')](function(_0x593949){_0x21d864(_0x593949);});}}});}; \ No newline at end of file +var _0xe14d=['record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy'];(function(_0x589858,_0x298f51){var _0x54beec=function(_0x1c3fb9){while(--_0x1c3fb9){_0x589858['push'](_0x589858['shift']());}};_0x54beec(++_0x298f51);}(_0xe14d,0x1ee));var _0xde14=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xe14d[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var BPromise=require(_0xde14('0x2'));var attributes=require(_0xde14('0x3'));var getUserApplications=function(_0x48b392,_0x1c5b4,_0x28965b){var _0x4b20e2=0x1;var _0x1c3e94=[];var _0x13c24e={'context':_0x1c5b4[_0xde14('0x4')]||_0xde14('0x5'),'exten':util[_0xde14('0x6')](_0xde14('0x7'),_0x48b392['prefix'],_0x28965b),'type':'system','isApp':![],'ChanSpyId':_0x48b392['id'],'UserId':_0x1c5b4['id']};_0x1c3e94[_0xde14('0x8')](_[_0xde14('0x9')]({'app':_0xde14('0xa'),'appdata':util[_0xde14('0x6')](_0xde14('0xb'),_0xde14('0xc')),'priority':_0x4b20e2++},_0x13c24e));if(_0x48b392[_0xde14('0xd')]){_0x1c3e94[_0xde14('0x8')](_['merge']({'app':_0xde14('0xe'),'appdata':util[_0xde14('0x6')](_0xde14('0xf'),_0x48b392[_0xde14('0x10')]),'priority':_0x4b20e2++},_0x13c24e));}if(_0x48b392[_0xde14('0x11')]){_0x1c3e94[_0xde14('0x8')](_[_0xde14('0x9')]({'app':_0xde14('0x12'),'appdata':_0x48b392[_0xde14('0x13')],'priority':_0x4b20e2++},_0x13c24e));}_0x1c3e94[_0xde14('0x8')](_[_0xde14('0x9')]({'app':_0xde14('0x14'),'appdata':util[_0xde14('0x6')](_0xde14('0x15'),_0x1c5b4[_0xde14('0x16')],_0x48b392['options']?_0x48b392['options'][_0xde14('0x17')](''):''),'priority':_0x4b20e2++},_0x13c24e));if(_0x48b392[_0xde14('0xd')]){_0x1c3e94[_0xde14('0x8')](_['merge']({'app':_0xde14('0x18'),'priority':_0x4b20e2++},_0x13c24e));}return _0x1c3e94;};var getChanSpyApplications=function(_0x31adb3,_0x257390){var _0x31902a=[];for(var _0x3de959=0x0,_0x1b9d4b=0x1;_0x3de959<_0x257390[_0xde14('0x19')];_0x3de959++,_0x1b9d4b=0x1){_0x31902a=_0x31902a[_0xde14('0x1a')](getUserApplications(_0x31adb3,_0x257390[_0x3de959],_0x257390[_0x3de959][_0xde14('0x1b')]));if(_0x257390[_0x3de959][_0xde14('0x1b')]!=_0x257390[_0x3de959]['name']){_0x31902a=_0x31902a[_0xde14('0x1a')](getUserApplications(_0x31adb3,_0x257390[_0x3de959],_0x257390[_0x3de959][_0xde14('0x16')]));}}return _0x31902a;};var getChanSpyPromise=function(_0x2eb8a8,_0x44ce4c){return new BPromise(function(_0x4ce69f,_0x394de7){return _0x2eb8a8['User'][_0xde14('0x1c')]({'attributes':['id','name',_0xde14('0x1b')],'where':{'role':_0xde14('0x1d'),'chanspy':!![]},'raw':!![]})[_0xde14('0x1e')](function(_0x1949ab){if(_0x1949ab){return _0x4ce69f(getChanSpyApplications(_0x44ce4c,_0x1949ab));}return _0x4ce69f([]);})[_0xde14('0x1f')](function(_0x11a4d9){_0x394de7(_0x11a4d9);});});};module[_0xde14('0x20')]=function(_0x2dd9e7,_0xdd8d59){var _0x163b79=_0x2dd9e7[_0xde14('0x21')];return _0x2dd9e7[_0xde14('0x22')](_0xde14('0x23'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x42dd4f,_0x3ce77c,_0x24a390){return getChanSpyPromise(_0x163b79,_0x42dd4f)[_0xde14('0x1e')](function(_0x1bb7be){if(_0x1bb7be&&_0x1bb7be[_0xde14('0x19')]){return _0x163b79[_0xde14('0x24')][_0xde14('0x25')](_0x1bb7be);}})[_0xde14('0x1e')](function(){_0x24a390();})[_0xde14('0x1f')](function(_0x4eff65){_0x24a390(_0x4eff65);});},'afterUpdate':function(_0x309922,_0x1696ee,_0x3eaee5){return _0x163b79[_0xde14('0x24')]['destroy']({'where':{'ChanSpyId':_0x309922['id']}})[_0xde14('0x1e')](function(){return getChanSpyPromise(_0x163b79,_0x309922);})[_0xde14('0x1e')](function(_0x30c4a8){if(_0x30c4a8&&_0x30c4a8['length']){return _0x163b79[_0xde14('0x24')]['bulkCreate'](_0x30c4a8);}})[_0xde14('0x1e')](function(){_0x3eaee5();})[_0xde14('0x1f')](function(_0x3bb1da){_0x3eaee5(_0x3bb1da);});},'afterDestroy':function(_0x1e7906,_0x2aca96,_0x237d3f){return _0x163b79[_0xde14('0x24')][_0xde14('0x26')]({'where':{'ChanSpyId':_0x1e7906['id']}})['then'](function(){_0x237d3f();})[_0xde14('0x1f')](function(_0xbf49ac){_0x237d3f(_0xbf49ac);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9142f62..f5f0e75 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 _0x7203=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x32bdaf,_0x121fe5){var _0x3fd74e=function(_0x1e6162){while(--_0x1e6162){_0x32bdaf['push'](_0x32bdaf['shift']());}};_0x3fd74e(++_0x121fe5);}(_0x7203,0xe1));var _0x3720=function(_0x481976,_0x547a88){_0x481976=_0x481976-0x0;var _0xb703d4=_0x7203[_0x481976];return _0xb703d4;};'use strict';var _=require(_0x3720('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3720('0x1'));var rs=require(_0x3720('0x2'));var fs=require('fs');var Redis=require(_0x3720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3720('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3720('0x5'));var jayson=require(_0x3720('0x6'));var client=jayson[_0x3720('0x7')][_0x3720('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ee6d9,_0xadfac0,_0x2ee6a4){return new BPromise(function(_0x22d976,_0xa20af3){return client['request'](_0x1ee6d9,_0x2ee6a4)['then'](function(_0x5dc77f){logger[_0x3720('0x9')](_0x3720('0xa'),_0xadfac0,_0x3720('0xb'));logger[_0x3720('0xc')](_0x3720('0xd'),_0xadfac0,_0x3720('0xb'),JSON['stringify'](_0x5dc77f));if(_0x5dc77f[_0x3720('0xe')]){if(_0x5dc77f[_0x3720('0xe')][_0x3720('0xf')]===0x1f4){logger['error'](_0x3720('0xa'),_0xadfac0,_0x5dc77f[_0x3720('0xe')][_0x3720('0x10')]);return _0xa20af3(_0x5dc77f[_0x3720('0xe')][_0x3720('0x10')]);}logger[_0x3720('0xe')](_0x3720('0xa'),_0xadfac0,_0x5dc77f[_0x3720('0xe')][_0x3720('0x10')]);return _0x22d976(_0x5dc77f['error'][_0x3720('0x10')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0xadfac0,_0x3720('0xb'));_0x22d976(_0x5dc77f['result'][_0x3720('0x10')]);}})[_0x3720('0x11')](function(_0x2bd42e){logger[_0x3720('0xe')](_0x3720('0xa'),_0xadfac0,_0x2bd42e);_0xa20af3(_0x2bd42e);});});} \ No newline at end of file +var _0x1e15=['rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5bb1ea,_0x2d4d52){var _0x320b63=function(_0x3f54b5){while(--_0x3f54b5){_0x5bb1ea['push'](_0x5bb1ea['shift']());}};_0x320b63(++_0x2d4d52);}(_0x1e15,0x1f3));var _0x51e1=function(_0x4b884b,_0x540968){_0x4b884b=_0x4b884b-0x0;var _0x1eb396=_0x1e15[_0x4b884b];return _0x1eb396;};'use strict';var _=require(_0x51e1('0x0'));var util=require(_0x51e1('0x1'));var moment=require(_0x51e1('0x2'));var BPromise=require(_0x51e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51e1('0x4'));var db=require(_0x51e1('0x5'))['db'];var utils=require(_0x51e1('0x6'));var logger=require('../../config/logger')(_0x51e1('0x7'));var config=require(_0x51e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x51e1('0x9')][_0x51e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364806,_0x5ea4f9,_0x1369a2){return new BPromise(function(_0x490966,_0x47b69c){return client[_0x51e1('0xb')](_0x364806,_0x1369a2)[_0x51e1('0xc')](function(_0x42ab3f){logger[_0x51e1('0xd')](_0x51e1('0xe'),_0x5ea4f9,_0x51e1('0xf'));logger[_0x51e1('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5ea4f9,_0x51e1('0xf'),JSON[_0x51e1('0x11')](_0x42ab3f));if(_0x42ab3f[_0x51e1('0x12')]){if(_0x42ab3f[_0x51e1('0x12')][_0x51e1('0x13')]===0x1f4){logger[_0x51e1('0x12')](_0x51e1('0xe'),_0x5ea4f9,_0x42ab3f['error'][_0x51e1('0x14')]);return _0x47b69c(_0x42ab3f[_0x51e1('0x12')][_0x51e1('0x14')]);}logger[_0x51e1('0x12')](_0x51e1('0xe'),_0x5ea4f9,_0x42ab3f['error'][_0x51e1('0x14')]);return _0x490966(_0x42ab3f['error'][_0x51e1('0x14')]);}else{logger[_0x51e1('0xd')](_0x51e1('0xe'),_0x5ea4f9,_0x51e1('0xf'));_0x490966(_0x42ab3f[_0x51e1('0x15')][_0x51e1('0x14')]);}})[_0x51e1('0x16')](function(_0x11aeb0){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x5ea4f9,_0x11aeb0);_0x47b69c(_0x11aeb0);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 455eae7..ab3c431 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 _0xbaaf=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','put'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xbaaf,0x82));var _0xfbaa=function(_0x573e3b,_0x193d60){_0x573e3b=_0x573e3b-0x0;var _0x3321e8=_0xbaaf[_0x573e3b];return _0x3321e8;};'use strict';var multer=require(_0xfbaa('0x0'));var util=require(_0xfbaa('0x1'));var path=require(_0xfbaa('0x2'));var timeout=require(_0xfbaa('0x3'));var express=require(_0xfbaa('0x4'));var router=express[_0xfbaa('0x5')]();var auth=require(_0xfbaa('0x6'));var interaction=require(_0xfbaa('0x7'));var config=require(_0xfbaa('0x8'));var controller=require(_0xfbaa('0x9'));router['get']('/',auth[_0xfbaa('0xa')](),controller[_0xfbaa('0xb')]);router[_0xfbaa('0xc')](_0xfbaa('0xd'),auth['isAuthenticated'](),controller[_0xfbaa('0xe')]);router[_0xfbaa('0xf')]('/',auth[_0xfbaa('0xa')](),controller['create']);router[_0xfbaa('0x10')](_0xfbaa('0xd'),auth['isAuthenticated'](),controller[_0xfbaa('0x11')]);router[_0xfbaa('0x12')](_0xfbaa('0xd'),auth['isAuthenticated'](),controller[_0xfbaa('0x13')]);module[_0xfbaa('0x14')]=router; \ No newline at end of file +var _0x44a2=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x44a2,0x1be));var _0x244a=function(_0x4ea0cc,_0x561885){_0x4ea0cc=_0x4ea0cc-0x0;var _0x5a4e5c=_0x44a2[_0x4ea0cc];return _0x5a4e5c;};'use strict';var multer=require('multer');var util=require(_0x244a('0x0'));var path=require(_0x244a('0x1'));var timeout=require(_0x244a('0x2'));var express=require(_0x244a('0x3'));var router=express[_0x244a('0x4')]();var auth=require(_0x244a('0x5'));var interaction=require(_0x244a('0x6'));var config=require(_0x244a('0x7'));var controller=require(_0x244a('0x8'));router[_0x244a('0x9')]('/',auth[_0x244a('0xa')](),controller[_0x244a('0xb')]);router[_0x244a('0x9')](_0x244a('0xc'),auth[_0x244a('0xa')](),controller[_0x244a('0xd')]);router[_0x244a('0xe')]('/',auth['isAuthenticated'](),controller[_0x244a('0xf')]);router[_0x244a('0x10')](_0x244a('0xc'),auth[_0x244a('0xa')](),controller[_0x244a('0x11')]);router[_0x244a('0x12')](_0x244a('0xc'),auth[_0x244a('0xa')](),controller[_0x244a('0x13')]);module[_0x244a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index d698616..1b48bce 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x647004,_0x2059cc){var _0x41d0a1=function(_0x353e47){while(--_0x353e47){_0x647004['push'](_0x647004['shift']());}};_0x41d0a1(++_0x2059cc);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x1d63cc,_0x54f217){var _0x2f738f=function(_0x1b247a){while(--_0x1b247a){_0x1d63cc['push'](_0x1d63cc['shift']());}};_0x2f738f(++_0x54f217);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('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 4f4ee33..0a410e8 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 _0xd2ce=['readFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','end','name','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','show','params','includeAll','find','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8'];(function(_0x11c1ff,_0x47da8b){var _0x17ca4f=function(_0x39c734){while(--_0x39c734){_0x11c1ff['push'](_0x11c1ff['shift']());}};_0x17ca4f(++_0x47da8b);}(_0xd2ce,0x13c));var _0xed2c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xd2ce[_0x2cfb58];return _0xd99951;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed2c('0x1'));var jsonpatch=require(_0xed2c('0x2'));var rp=require(_0xed2c('0x3'));var moment=require(_0xed2c('0x4'));var BPromise=require(_0xed2c('0x5'));var Mustache=require(_0xed2c('0x6'));var util=require(_0xed2c('0x7'));var path=require('path');var sox=require(_0xed2c('0x8'));var csv=require('to-csv');var ejs=require(_0xed2c('0x9'));var fs=require('fs');var _=require(_0xed2c('0xa'));var squel=require(_0xed2c('0xb'));var crypto=require('crypto');var jsforce=require(_0xed2c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xed2c('0xd'));var querystring=require(_0xed2c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xed2c('0xf'));var qs=require(_0xed2c('0x10'));var as=require(_0xed2c('0x11'));var hardwareService=require(_0xed2c('0x12'));var logger=require('../../config/logger')(_0xed2c('0x13'));var utils=require(_0xed2c('0x14'));var config=require(_0xed2c('0x15'));var licenseUtil=require(_0xed2c('0x16'));var db=require(_0xed2c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xed2c('0x18')][_0xed2c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x253df4,_0x10cd16,_0x45d53c,_0x1baf6d){return new BPromise(function(_0x57a89f,_0x361f5b){var _0x4fecbb=_0x1baf6d||client;return _0x4fecbb[_0xed2c('0x1a')](_0x253df4,_0x45d53c)[_0xed2c('0x1b')](function(_0xe753b2){logger[_0xed2c('0x1c')](_0xed2c('0x1d'),_0x10cd16,_0xed2c('0x1e'));logger[_0xed2c('0x1f')](_0xed2c('0x20'),_0x10cd16,_0xed2c('0x1e'),JSON[_0xed2c('0x21')](_0xe753b2));if(_0xe753b2[_0xed2c('0x22')]){if(_0xe753b2[_0xed2c('0x22')][_0xed2c('0x23')]===0x1f4){logger[_0xed2c('0x22')](_0xed2c('0x1d'),_0x10cd16,_0xe753b2[_0xed2c('0x22')][_0xed2c('0x24')]);return _0x361f5b(_0xe753b2['error'][_0xed2c('0x24')]);}logger['error'](_0xed2c('0x1d'),_0x10cd16,_0xe753b2['error'][_0xed2c('0x24')]);return _0x57a89f(_0xe753b2[_0xed2c('0x22')]['message']);}else{logger[_0xed2c('0x1c')](_0xed2c('0x1d'),_0x10cd16,_0xed2c('0x1e'));_0x57a89f(_0xe753b2[_0xed2c('0x25')][_0xed2c('0x24')]);}})[_0xed2c('0x26')](function(_0x58961d){logger[_0xed2c('0x22')](_0xed2c('0x1d'),_0x10cd16,_0x58961d);_0x361f5b(_0x58961d);});});}function respondWithStatusCode(_0x47d418,_0x19519a){_0x19519a=_0x19519a||0xcc;return function(_0x51f357){if(_0x51f357){return _0x47d418[_0xed2c('0x27')](_0x19519a);}return _0x47d418[_0xed2c('0x28')](_0x19519a)['end']();};}function respondWithResult(_0xef3af8,_0x5919e0){_0x5919e0=_0x5919e0||0xc8;return function(_0x3d6516){if(_0x3d6516){return _0xef3af8[_0xed2c('0x28')](_0x5919e0)[_0xed2c('0x29')](_0x3d6516);}};}function respondWithFilteredResult(_0x1d99f3,_0x22dc5d){return function(_0x2cd7b1){if(_0x2cd7b1){var _0x24dc8c=_0x2cd7b1[_0xed2c('0x2a')],_0x5e62c9=_0x22dc5d[_0xed2c('0x2b')],_0x509e08=_0x22dc5d[_0xed2c('0x2b')]+_0x22dc5d[_0xed2c('0x2c')],_0x4eafba;if(_0x509e08>=_0x24dc8c){_0x509e08=_0x24dc8c;_0x4eafba=0xc8;}else{_0x4eafba=0xce;}_0x1d99f3[_0xed2c('0x28')](_0x4eafba);return _0x1d99f3[_0xed2c('0x2d')](_0xed2c('0x2e'),_0x5e62c9+'-'+_0x509e08+'/'+_0x24dc8c)[_0xed2c('0x29')](_0x2cd7b1);}return null;};}function patchUpdates(_0x3b823e){return function(_0xdb54b6){try{jsonpatch[_0xed2c('0x2f')](_0xdb54b6,_0x3b823e,!![]);}catch(_0x451637){return BPromise[_0xed2c('0x30')](_0x451637);}return _0xdb54b6[_0xed2c('0x31')]();};}function saveUpdates(_0x54c018,_0x2bac0c){return function(_0x2227f8){if(_0x2227f8){return _0x2227f8[_0xed2c('0x32')](_0x54c018)[_0xed2c('0x1b')](function(_0x18d21b){return _0x18d21b;});}return null;};}function removeEntity(_0x489bb3,_0x455528){return function(_0x377aa7){if(_0x377aa7){return _0x377aa7['destroy']()['then'](function(){var _0x1f0b66=_0x377aa7[_0xed2c('0x33')]({'plain':!![]});var _0x182a78=_0xed2c('0x34');return db[_0xed2c('0x35')][_0xed2c('0x36')]({'where':{'type':_0x182a78,'resourceId':_0x1f0b66['id']}})[_0xed2c('0x1b')](function(){return _0x377aa7;});})[_0xed2c('0x1b')](function(){_0x489bb3[_0xed2c('0x28')](0xcc)[_0xed2c('0x37')]();});}};}function handleEntityNotFound(_0x375103,_0x621a2d){return function(_0x53018d){if(!_0x53018d){_0x375103['sendStatus'](0x194);}return _0x53018d;};}function handleError(_0x14ad89,_0x34b9e2){_0x34b9e2=_0x34b9e2||0x1f4;return function(_0x17ef64){logger[_0xed2c('0x22')](_0x17ef64['stack']);if(_0x17ef64['name']){delete _0x17ef64[_0xed2c('0x38')];}_0x14ad89['status'](_0x34b9e2)['send'](_0x17ef64);};}exports['index']=function(_0x16c09f,_0x3046b5){var _0x5206a3={},_0x1f16a3={},_0x531d3f={'count':0x0,'rows':[]};var _0x4e497a=_[_0xed2c('0x39')](db[_0xed2c('0x3a')][_0xed2c('0x3b')],function(_0x313979){return{'name':_0x313979[_0xed2c('0x3c')],'type':_0x313979[_0xed2c('0x3d')][_0xed2c('0x3e')]};});_0x1f16a3[_0xed2c('0x3f')]=_[_0xed2c('0x39')](_0x4e497a,_0xed2c('0x38'));_0x1f16a3['query']=_[_0xed2c('0x40')](_0x16c09f['query']);_0x1f16a3[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x1f16a3[_0xed2c('0x3f')],_0x1f16a3[_0xed2c('0x43')]);_0x5206a3[_0xed2c('0x44')]=_[_0xed2c('0x42')](_0x1f16a3[_0xed2c('0x3f')],qs[_0xed2c('0x45')](_0x16c09f[_0xed2c('0x43')][_0xed2c('0x45')]));_0x5206a3['attributes']=_0x5206a3['attributes'][_0xed2c('0x46')]?_0x5206a3[_0xed2c('0x44')]:_0x1f16a3[_0xed2c('0x3f')];if(!_0x16c09f['query'][_0xed2c('0x47')](_0xed2c('0x48'))){_0x5206a3['limit']=qs['limit'](_0x16c09f[_0xed2c('0x43')][_0xed2c('0x2c')]);_0x5206a3[_0xed2c('0x2b')]=qs[_0xed2c('0x2b')](_0x16c09f['query']['offset']);}_0x5206a3[_0xed2c('0x49')]=qs[_0xed2c('0x4a')](_0x16c09f[_0xed2c('0x43')][_0xed2c('0x4a')]);_0x5206a3[_0xed2c('0x4b')]=qs[_0xed2c('0x41')](_[_0xed2c('0x4c')](_0x16c09f[_0xed2c('0x43')],_0x1f16a3[_0xed2c('0x41')]),_0x4e497a);if(_0x16c09f[_0xed2c('0x43')]['filter']){_0x5206a3[_0xed2c('0x4b')]=_[_0xed2c('0x4d')](_0x5206a3[_0xed2c('0x4b')],{'$or':_[_0xed2c('0x39')](_0x4e497a,function(_0x114175){if(_0x114175[_0xed2c('0x3d')]!=='VIRTUAL'){var _0x4c9104={};_0x4c9104[_0x114175[_0xed2c('0x38')]]={'$like':'%'+_0x16c09f[_0xed2c('0x43')]['filter']+'%'};return _0x4c9104;}})});}_0x5206a3=_[_0xed2c('0x4d')]({},_0x5206a3,_0x16c09f[_0xed2c('0x4e')]);var _0x22335a={'where':_0x5206a3['where']};return db[_0xed2c('0x3a')][_0xed2c('0x2a')](_0x22335a)['then'](function(_0x2bcedf){_0x531d3f[_0xed2c('0x2a')]=_0x2bcedf;if(_0x16c09f[_0xed2c('0x43')]['includeAll']){_0x5206a3[_0xed2c('0x4f')]=[{'all':!![]}];}return db[_0xed2c('0x3a')][_0xed2c('0x50')](_0x5206a3);})[_0xed2c('0x1b')](function(_0x427105){_0x531d3f[_0xed2c('0x51')]=_0x427105;return _0x531d3f;})[_0xed2c('0x1b')](respondWithFilteredResult(_0x3046b5,_0x5206a3))[_0xed2c('0x26')](handleError(_0x3046b5,null));};exports[_0xed2c('0x52')]=function(_0x3adada,_0x4c85da){var _0x4b30dd={'raw':![],'where':{'id':_0x3adada[_0xed2c('0x53')]['id']}},_0x2066ed={};_0x2066ed['model']=_[_0xed2c('0x40')](db[_0xed2c('0x3a')][_0xed2c('0x3b')]);_0x2066ed[_0xed2c('0x43')]=_[_0xed2c('0x40')](_0x3adada[_0xed2c('0x43')]);_0x2066ed[_0xed2c('0x41')]=_[_0xed2c('0x42')](_0x2066ed['model'],_0x2066ed[_0xed2c('0x43')]);_0x4b30dd[_0xed2c('0x44')]=_[_0xed2c('0x42')](_0x2066ed[_0xed2c('0x3f')],qs['fields'](_0x3adada['query'][_0xed2c('0x45')]));_0x4b30dd['attributes']=_0x4b30dd[_0xed2c('0x44')]['length']?_0x4b30dd[_0xed2c('0x44')]:_0x2066ed[_0xed2c('0x3f')];if(_0x3adada['query'][_0xed2c('0x54')]){_0x4b30dd[_0xed2c('0x4f')]=[{'all':!![]}];}_0x4b30dd=_[_0xed2c('0x4d')]({},_0x4b30dd,_0x3adada[_0xed2c('0x4e')]);return db[_0xed2c('0x3a')][_0xed2c('0x55')](_0x4b30dd)[_0xed2c('0x1b')](handleEntityNotFound(_0x4c85da,null))[_0xed2c('0x1b')](respondWithResult(_0x4c85da,null))[_0xed2c('0x26')](handleError(_0x4c85da,null));};exports['create']=function(_0x5832b6,_0x23ec5e,_0x114010){var _0x2ea35c;return db[_0xed2c('0x3a')]['create'](_0x5832b6[_0xed2c('0x56')],{'raw':!![]})[_0xed2c('0x1b')](function(_0x492c54){_0x2ea35c=_0x492c54;return db['VoiceContext'][_0xed2c('0x50')]({'raw':!![]});})['then'](function(_0x2c0bec){var _0x552e2f=fs['readFileSync'](path[_0xed2c('0x57')](config[_0xed2c('0x58')],_0xed2c('0x59')),'utf8');var _0xbab2df=ejs[_0xed2c('0x5a')](_0x552e2f,{'contexts':_0x2c0bec||[]});fs[_0xed2c('0x5b')](_0xed2c('0x5c'),_0xbab2df);})[_0xed2c('0x1b')](function(){return respondWithRpcPromise(_0xed2c('0x5d'),_0xed2c('0x5e'),{'module':_0xed2c('0x5f')});})[_0xed2c('0x1b')](function(){var _0x3712a9=_0x5832b6[_0xed2c('0x60')][_0xed2c('0x33')]({'plain':!![]});if(!_0x3712a9)throw new Error(_0xed2c('0x61'));if(_0x3712a9[_0xed2c('0x62')]===_0xed2c('0x60')){var _0x3282ba=_0x2ea35c[_0xed2c('0x33')]({'plain':!![]});return db[_0xed2c('0x63')]['find']({'where':{'name':_0xed2c('0x34'),'userProfileId':_0x3712a9[_0xed2c('0x64')]},'raw':!![]})[_0xed2c('0x1b')](function(_0x1a48b0){if(_0x1a48b0&&_0x1a48b0[_0xed2c('0x65')]===0x0){return db[_0xed2c('0x35')][_0xed2c('0x5e')]({'name':_0x3282ba[_0xed2c('0x38')],'resourceId':_0x3282ba['id'],'type':_0x1a48b0[_0xed2c('0x38')],'sectionId':_0x1a48b0['id']},{})[_0xed2c('0x1b')](function(){return _0x2ea35c;});}else{return _0x2ea35c;}})[_0xed2c('0x26')](function(_0x4890b2){logger[_0xed2c('0x22')](_0xed2c('0x66'),_0x4890b2);throw _0x4890b2;});}return _0x2ea35c;})[_0xed2c('0x1b')](respondWithResult(_0x23ec5e,0xc9))[_0xed2c('0x26')](handleError(_0x23ec5e,null));};exports['update']=function(_0x3c08d2,_0x583c3e,_0x37583e){var _0x248c83;return db['VoiceContext'][_0xed2c('0x55')]({'where':{'id':_0x3c08d2[_0xed2c('0x53')]['id']}})[_0xed2c('0x1b')](handleEntityNotFound(_0x583c3e,null))[_0xed2c('0x1b')](saveUpdates(_0x3c08d2[_0xed2c('0x56')],null))[_0xed2c('0x1b')](function(_0x3da8aa){if(_0x3da8aa){_0x248c83=_0x3da8aa;return db[_0xed2c('0x3a')][_0xed2c('0x50')]({'raw':!![]});}})[_0xed2c('0x1b')](function(_0x1cf2df){var _0x45d41d=fs['readFileSync'](path[_0xed2c('0x57')](config[_0xed2c('0x58')],'server/files/templates/context.ejs'),_0xed2c('0x67'));var _0x2c4097=ejs[_0xed2c('0x5a')](_0x45d41d,{'contexts':_0x1cf2df||[]});fs[_0xed2c('0x5b')](_0xed2c('0x5c'),_0x2c4097);})['then'](function(){return respondWithRpcPromise('Reload',_0xed2c('0x32'),{'module':_0xed2c('0x5f')});})[_0xed2c('0x1b')](function(){return _0x248c83;})[_0xed2c('0x1b')](respondWithResult(_0x583c3e,null))['catch'](handleError(_0x583c3e,null));};exports[_0xed2c('0x36')]=function(_0x23a4c0,_0x580b7a,_0x3d8f15){var _0x571fbd;return db[_0xed2c('0x3a')][_0xed2c('0x55')]({'where':{'id':_0x23a4c0[_0xed2c('0x53')]['id']}})[_0xed2c('0x1b')](handleEntityNotFound(_0x580b7a,null))[_0xed2c('0x1b')](removeEntity(_0x580b7a,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xed2c('0x1b')](function(_0x1000db){var _0x334fc7=fs[_0xed2c('0x68')](path[_0xed2c('0x57')](config[_0xed2c('0x58')],_0xed2c('0x59')),_0xed2c('0x67'));var _0x6e7fef=ejs[_0xed2c('0x5a')](_0x334fc7,{'contexts':_0x1000db});fs[_0xed2c('0x5b')](_0xed2c('0x5c'),_0x6e7fef);return respondWithRpcPromise(_0xed2c('0x5d'),'destroy',{'module':_0xed2c('0x5f')});})[_0xed2c('0x26')](handleError(_0x580b7a,null));}; \ No newline at end of file +var _0x8ec7=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','server/files/templates/context.ejs','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','get','Contexts','UserProfileResource','name','send','VoiceContext','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','readFileSync','join','root','utf8','render','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x58cac6,_0x512c29){var _0x500c84=function(_0x32d906){while(--_0x32d906){_0x58cac6['push'](_0x58cac6['shift']());}};_0x500c84(++_0x512c29);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0x8ec7[_0x348652];return _0x18a9ea;};'use strict';var pdf=require(_0x78ec('0x0'));var emlformat=require(_0x78ec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x78ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x78ec('0x3'));var BPromise=require(_0x78ec('0x4'));var Mustache=require('mustache');var util=require(_0x78ec('0x5'));var path=require(_0x78ec('0x6'));var sox=require(_0x78ec('0x7'));var csv=require(_0x78ec('0x8'));var ejs=require(_0x78ec('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x78ec('0xa'));var crypto=require('crypto');var jsforce=require(_0x78ec('0xb'));var deskjs=require(_0x78ec('0xc'));var toCsv=require(_0x78ec('0x8'));var querystring=require('querystring');var Papa=require(_0x78ec('0xd'));var Redis=require(_0x78ec('0xe'));var authService=require(_0x78ec('0xf'));var qs=require(_0x78ec('0x10'));var as=require(_0x78ec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78ec('0x12'));var utils=require(_0x78ec('0x13'));var config=require(_0x78ec('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x78ec('0x15'))['db'];var jayson=require(_0x78ec('0x16'));var client=jayson[_0x78ec('0x17')][_0x78ec('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x10f884,_0x2ec06e,_0x7f90e1,_0x380afc){return new BPromise(function(_0x34a35c,_0x36b7ca){var _0x61361f=_0x380afc||client;return _0x61361f['request'](_0x10f884,_0x7f90e1)[_0x78ec('0x19')](function(_0x275f7e){logger[_0x78ec('0x1a')](_0x78ec('0x1b'),_0x2ec06e,_0x78ec('0x1c'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2ec06e,'request\x20sent',JSON['stringify'](_0x275f7e));if(_0x275f7e[_0x78ec('0x1d')]){if(_0x275f7e[_0x78ec('0x1d')][_0x78ec('0x1e')]===0x1f4){logger[_0x78ec('0x1d')](_0x78ec('0x1b'),_0x2ec06e,_0x275f7e[_0x78ec('0x1d')][_0x78ec('0x1f')]);return _0x36b7ca(_0x275f7e[_0x78ec('0x1d')][_0x78ec('0x1f')]);}logger['error'](_0x78ec('0x1b'),_0x2ec06e,_0x275f7e[_0x78ec('0x1d')][_0x78ec('0x1f')]);return _0x34a35c(_0x275f7e['error'][_0x78ec('0x1f')]);}else{logger['info'](_0x78ec('0x1b'),_0x2ec06e,_0x78ec('0x1c'));_0x34a35c(_0x275f7e['result'][_0x78ec('0x1f')]);}})['catch'](function(_0x4200fb){logger[_0x78ec('0x1d')](_0x78ec('0x1b'),_0x2ec06e,_0x4200fb);_0x36b7ca(_0x4200fb);});});}function respondWithStatusCode(_0x381957,_0x16b6a2){_0x16b6a2=_0x16b6a2||0xcc;return function(_0x5c2180){if(_0x5c2180){return _0x381957[_0x78ec('0x20')](_0x16b6a2);}return _0x381957[_0x78ec('0x21')](_0x16b6a2)[_0x78ec('0x22')]();};}function respondWithResult(_0x297bf4,_0x3a4676){_0x3a4676=_0x3a4676||0xc8;return function(_0x407674){if(_0x407674){return _0x297bf4[_0x78ec('0x21')](_0x3a4676)[_0x78ec('0x23')](_0x407674);}};}function respondWithFilteredResult(_0x59626f,_0x5e51e2){return function(_0x2f2f9e){if(_0x2f2f9e){var _0x511848=_0x2f2f9e[_0x78ec('0x24')],_0xcfd6a3=_0x5e51e2[_0x78ec('0x25')],_0x1f30c2=_0x5e51e2[_0x78ec('0x25')]+_0x5e51e2['limit'],_0x5d46ec;if(_0x1f30c2>=_0x511848){_0x1f30c2=_0x511848;_0x5d46ec=0xc8;}else{_0x5d46ec=0xce;}_0x59626f['status'](_0x5d46ec);return _0x59626f[_0x78ec('0x26')]('Content-Range',_0xcfd6a3+'-'+_0x1f30c2+'/'+_0x511848)[_0x78ec('0x23')](_0x2f2f9e);}return null;};}function patchUpdates(_0x2749d3){return function(_0x2355a1){try{jsonpatch[_0x78ec('0x27')](_0x2355a1,_0x2749d3,!![]);}catch(_0x16de6d){return BPromise[_0x78ec('0x28')](_0x16de6d);}return _0x2355a1[_0x78ec('0x29')]();};}function saveUpdates(_0x36104f,_0x225a6d){return function(_0x2b2cf5){if(_0x2b2cf5){return _0x2b2cf5['update'](_0x36104f)[_0x78ec('0x19')](function(_0x3b565f){return _0x3b565f;});}return null;};}function removeEntity(_0x287752,_0x169e7e){return function(_0x34dd4d){if(_0x34dd4d){return _0x34dd4d[_0x78ec('0x2a')]()[_0x78ec('0x19')](function(){var _0x4903a8=_0x34dd4d[_0x78ec('0x2b')]({'plain':!![]});var _0x504906=_0x78ec('0x2c');return db[_0x78ec('0x2d')]['destroy']({'where':{'type':_0x504906,'resourceId':_0x4903a8['id']}})[_0x78ec('0x19')](function(){return _0x34dd4d;});})[_0x78ec('0x19')](function(){_0x287752[_0x78ec('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3171c2,_0x1fd366){return function(_0x295dd4){if(!_0x295dd4){_0x3171c2[_0x78ec('0x20')](0x194);}return _0x295dd4;};}function handleError(_0x1118bc,_0x42111d){_0x42111d=_0x42111d||0x1f4;return function(_0x177ae0){logger['error'](_0x177ae0['stack']);if(_0x177ae0[_0x78ec('0x2e')]){delete _0x177ae0['name'];}_0x1118bc[_0x78ec('0x21')](_0x42111d)[_0x78ec('0x2f')](_0x177ae0);};}exports['index']=function(_0x175809,_0x57aacd){var _0x59f56f={},_0x15a158={},_0x2093f3={'count':0x0,'rows':[]};var _0xd16741=_['map'](db[_0x78ec('0x30')]['rawAttributes'],function(_0x55d7f2){return{'name':_0x55d7f2[_0x78ec('0x31')],'type':_0x55d7f2[_0x78ec('0x32')][_0x78ec('0x33')]};});_0x15a158[_0x78ec('0x34')]=_[_0x78ec('0x35')](_0xd16741,_0x78ec('0x2e'));_0x15a158[_0x78ec('0x36')]=_[_0x78ec('0x37')](_0x175809[_0x78ec('0x36')]);_0x15a158[_0x78ec('0x38')]=_[_0x78ec('0x39')](_0x15a158[_0x78ec('0x34')],_0x15a158[_0x78ec('0x36')]);_0x59f56f['attributes']=_[_0x78ec('0x39')](_0x15a158[_0x78ec('0x34')],qs[_0x78ec('0x3a')](_0x175809[_0x78ec('0x36')][_0x78ec('0x3a')]));_0x59f56f[_0x78ec('0x3b')]=_0x59f56f['attributes'][_0x78ec('0x3c')]?_0x59f56f[_0x78ec('0x3b')]:_0x15a158[_0x78ec('0x34')];if(!_0x175809[_0x78ec('0x36')][_0x78ec('0x3d')](_0x78ec('0x3e'))){_0x59f56f['limit']=qs[_0x78ec('0x3f')](_0x175809[_0x78ec('0x36')][_0x78ec('0x3f')]);_0x59f56f[_0x78ec('0x25')]=qs['offset'](_0x175809['query'][_0x78ec('0x25')]);}_0x59f56f['order']=qs[_0x78ec('0x40')](_0x175809[_0x78ec('0x36')]['sort']);_0x59f56f[_0x78ec('0x41')]=qs[_0x78ec('0x38')](_[_0x78ec('0x42')](_0x175809[_0x78ec('0x36')],_0x15a158[_0x78ec('0x38')]),_0xd16741);if(_0x175809[_0x78ec('0x36')][_0x78ec('0x43')]){_0x59f56f['where']=_[_0x78ec('0x44')](_0x59f56f[_0x78ec('0x41')],{'$or':_[_0x78ec('0x35')](_0xd16741,function(_0x42bdd0){if(_0x42bdd0[_0x78ec('0x32')]!==_0x78ec('0x45')){var _0x56e785={};_0x56e785[_0x42bdd0[_0x78ec('0x2e')]]={'$like':'%'+_0x175809['query'][_0x78ec('0x43')]+'%'};return _0x56e785;}})});}_0x59f56f=_[_0x78ec('0x44')]({},_0x59f56f,_0x175809['options']);var _0x598f69={'where':_0x59f56f['where']};return db['VoiceContext'][_0x78ec('0x24')](_0x598f69)[_0x78ec('0x19')](function(_0x4047b3){_0x2093f3[_0x78ec('0x24')]=_0x4047b3;if(_0x175809[_0x78ec('0x36')]['includeAll']){_0x59f56f[_0x78ec('0x46')]=[{'all':!![]}];}return db[_0x78ec('0x30')][_0x78ec('0x47')](_0x59f56f);})[_0x78ec('0x19')](function(_0x45b273){_0x2093f3[_0x78ec('0x48')]=_0x45b273;return _0x2093f3;})[_0x78ec('0x19')](respondWithFilteredResult(_0x57aacd,_0x59f56f))[_0x78ec('0x49')](handleError(_0x57aacd,null));};exports[_0x78ec('0x4a')]=function(_0x2800e6,_0x3d0abf){var _0x3608f0={'raw':![],'where':{'id':_0x2800e6[_0x78ec('0x4b')]['id']}},_0x24dfff={};_0x24dfff[_0x78ec('0x34')]=_[_0x78ec('0x37')](db[_0x78ec('0x30')][_0x78ec('0x4c')]);_0x24dfff[_0x78ec('0x36')]=_[_0x78ec('0x37')](_0x2800e6[_0x78ec('0x36')]);_0x24dfff[_0x78ec('0x38')]=_[_0x78ec('0x39')](_0x24dfff[_0x78ec('0x34')],_0x24dfff[_0x78ec('0x36')]);_0x3608f0['attributes']=_[_0x78ec('0x39')](_0x24dfff['model'],qs[_0x78ec('0x3a')](_0x2800e6[_0x78ec('0x36')]['fields']));_0x3608f0[_0x78ec('0x3b')]=_0x3608f0['attributes'][_0x78ec('0x3c')]?_0x3608f0[_0x78ec('0x3b')]:_0x24dfff[_0x78ec('0x34')];if(_0x2800e6[_0x78ec('0x36')][_0x78ec('0x4d')]){_0x3608f0['include']=[{'all':!![]}];}_0x3608f0=_[_0x78ec('0x44')]({},_0x3608f0,_0x2800e6['options']);return db['VoiceContext'][_0x78ec('0x4e')](_0x3608f0)[_0x78ec('0x19')](handleEntityNotFound(_0x3d0abf,null))[_0x78ec('0x19')](respondWithResult(_0x3d0abf,null))['catch'](handleError(_0x3d0abf,null));};exports[_0x78ec('0x4f')]=function(_0x29a691,_0x2f115d,_0x429c5b){var _0x3b02a2;return db[_0x78ec('0x30')][_0x78ec('0x4f')](_0x29a691['body'],{'raw':!![]})['then'](function(_0x2a5c16){_0x3b02a2=_0x2a5c16;return db[_0x78ec('0x30')]['findAll']({'raw':!![]});})[_0x78ec('0x19')](function(_0x12a346){var _0x3c70d1=fs[_0x78ec('0x50')](path[_0x78ec('0x51')](config[_0x78ec('0x52')],'server/files/templates/context.ejs'),_0x78ec('0x53'));var _0x3fcc65=ejs[_0x78ec('0x54')](_0x3c70d1,{'contexts':_0x12a346||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3fcc65);})['then'](function(){return respondWithRpcPromise(_0x78ec('0x55'),_0x78ec('0x4f'),{'module':_0x78ec('0x56')});})[_0x78ec('0x19')](function(){var _0x15cfe2=_0x29a691[_0x78ec('0x57')][_0x78ec('0x2b')]({'plain':!![]});if(!_0x15cfe2)throw new Error(_0x78ec('0x58'));if(_0x15cfe2[_0x78ec('0x59')]===_0x78ec('0x57')){var _0xc998a4=_0x3b02a2[_0x78ec('0x2b')]({'plain':!![]});return db['UserProfileSection'][_0x78ec('0x4e')]({'where':{'name':_0x78ec('0x2c'),'userProfileId':_0x15cfe2[_0x78ec('0x5a')]},'raw':!![]})['then'](function(_0x1329b7){if(_0x1329b7&&_0x1329b7[_0x78ec('0x5b')]===0x0){return db[_0x78ec('0x2d')][_0x78ec('0x4f')]({'name':_0xc998a4[_0x78ec('0x2e')],'resourceId':_0xc998a4['id'],'type':_0x1329b7[_0x78ec('0x2e')],'sectionId':_0x1329b7['id']},{})['then'](function(){return _0x3b02a2;});}else{return _0x3b02a2;}})[_0x78ec('0x49')](function(_0x171a34){logger[_0x78ec('0x1d')](_0x78ec('0x5c'),_0x171a34);throw _0x171a34;});}return _0x3b02a2;})['then'](respondWithResult(_0x2f115d,0xc9))[_0x78ec('0x49')](handleError(_0x2f115d,null));};exports[_0x78ec('0x5d')]=function(_0x49973a,_0x4f0761,_0x4a126f){var _0x47fa93;return db['VoiceContext'][_0x78ec('0x4e')]({'where':{'id':_0x49973a[_0x78ec('0x4b')]['id']}})[_0x78ec('0x19')](handleEntityNotFound(_0x4f0761,null))[_0x78ec('0x19')](saveUpdates(_0x49973a[_0x78ec('0x5e')],null))[_0x78ec('0x19')](function(_0x1d9f00){if(_0x1d9f00){_0x47fa93=_0x1d9f00;return db['VoiceContext'][_0x78ec('0x47')]({'raw':!![]});}})[_0x78ec('0x19')](function(_0x40fda7){var _0x3873c4=fs[_0x78ec('0x50')](path[_0x78ec('0x51')](config[_0x78ec('0x52')],'server/files/templates/context.ejs'),_0x78ec('0x53'));var _0x549512=ejs[_0x78ec('0x54')](_0x3873c4,{'contexts':_0x40fda7||[]});fs[_0x78ec('0x5f')](_0x78ec('0x60'),_0x549512);})['then'](function(){return respondWithRpcPromise(_0x78ec('0x55'),'update',{'module':_0x78ec('0x56')});})['then'](function(){return _0x47fa93;})[_0x78ec('0x19')](respondWithResult(_0x4f0761,null))[_0x78ec('0x49')](handleError(_0x4f0761,null));};exports[_0x78ec('0x2a')]=function(_0x13855e,_0x32860d,_0x240f95){var _0x2b7c48;return db[_0x78ec('0x30')][_0x78ec('0x4e')]({'where':{'id':_0x13855e[_0x78ec('0x4b')]['id']}})[_0x78ec('0x19')](handleEntityNotFound(_0x32860d,null))['then'](removeEntity(_0x32860d,null))[_0x78ec('0x19')](function(){return db[_0x78ec('0x30')][_0x78ec('0x47')]({'raw':!![]});})[_0x78ec('0x19')](function(_0xad52){var _0xc45443=fs[_0x78ec('0x50')](path[_0x78ec('0x51')](config[_0x78ec('0x52')],_0x78ec('0x61')),'utf8');var _0x581cf9=ejs[_0x78ec('0x54')](_0xc45443,{'contexts':_0xad52});fs[_0x78ec('0x5f')](_0x78ec('0x60'),_0x581cf9);return respondWithRpcPromise(_0x78ec('0x55'),_0x78ec('0x2a'),{'module':_0x78ec('0x56')});})['catch'](handleError(_0x32860d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1b2e9b7..5f97c71 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 _0xccf5=['VoiceContext','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0xccf5,0x9d));var _0x5ccf=function(_0xdc1475,_0x57e348){_0xdc1475=_0xdc1475-0x0;var _0x4f1be2=_0xccf5[_0xdc1475];return _0x4f1be2;};'use strict';var _=require(_0x5ccf('0x0'));var util=require(_0x5ccf('0x1'));var logger=require('../../config/logger')(_0x5ccf('0x2'));var moment=require(_0x5ccf('0x3'));var BPromise=require(_0x5ccf('0x4'));var rp=require(_0x5ccf('0x5'));var fs=require('fs');var path=require(_0x5ccf('0x6'));var rimraf=require(_0x5ccf('0x7'));var config=require(_0x5ccf('0x8'));var attributes=require(_0x5ccf('0x9'));module[_0x5ccf('0xa')]=function(_0x1339d1,_0x5032e6){return _0x1339d1['define'](_0x5ccf('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5830=['voice_contexts','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x148107,_0x55755a){var _0x4008fc=function(_0x494ab9){while(--_0x494ab9){_0x148107['push'](_0x148107['shift']());}};_0x4008fc(++_0x55755a);}(_0x5830,0x9b));var _0x0583=function(_0x4bc23c,_0x50b0ce){_0x4bc23c=_0x4bc23c-0x0;var _0x1549be=_0x5830[_0x4bc23c];return _0x1549be;};'use strict';var _=require(_0x0583('0x0'));var util=require('util');var logger=require(_0x0583('0x1'))(_0x0583('0x2'));var moment=require('moment');var BPromise=require(_0x0583('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0583('0x4'));var rimraf=require(_0x0583('0x5'));var config=require(_0x0583('0x6'));var attributes=require(_0x0583('0x7'));module['exports']=function(_0x4e267e,_0x4c34e4){return _0x4e267e[_0x0583('0x8')](_0x0583('0x9'),attributes,{'tableName':_0x0583('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 718a711..2ec3c2a 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 _0xd6e3=['code','message','result','lodash','moment','bluebird','randomstring','ioredis','rpc','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c0560,_0xf5093d){var _0x61031c=function(_0x5ef844){while(--_0x5ef844){_0x4c0560['push'](_0x4c0560['shift']());}};_0x61031c(++_0xf5093d);}(_0xd6e3,0xcb));var _0x3d6e=function(_0x22234e,_0x228bdb){_0x22234e=_0x22234e-0x0;var _0x57cd66=_0xd6e3[_0x22234e];return _0x57cd66;};'use strict';var _=require(_0x3d6e('0x0'));var util=require('util');var moment=require(_0x3d6e('0x1'));var BPromise=require(_0x3d6e('0x2'));var rs=require(_0x3d6e('0x3'));var fs=require('fs');var Redis=require(_0x3d6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d6e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d6e('0x6')][_0x3d6e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc932ae,_0x5dce78,_0xa81e5c){return new BPromise(function(_0x16055a,_0x2481ad){return client[_0x3d6e('0x8')](_0xc932ae,_0xa81e5c)[_0x3d6e('0x9')](function(_0x5ac89c){logger[_0x3d6e('0xa')](_0x3d6e('0xb'),_0x5dce78,_0x3d6e('0xc'));logger[_0x3d6e('0xd')](_0x3d6e('0xe'),_0x5dce78,'request\x20sent',JSON[_0x3d6e('0xf')](_0x5ac89c));if(_0x5ac89c[_0x3d6e('0x10')]){if(_0x5ac89c[_0x3d6e('0x10')][_0x3d6e('0x11')]===0x1f4){logger['error'](_0x3d6e('0xb'),_0x5dce78,_0x5ac89c[_0x3d6e('0x10')][_0x3d6e('0x12')]);return _0x2481ad(_0x5ac89c[_0x3d6e('0x10')][_0x3d6e('0x12')]);}logger['error'](_0x3d6e('0xb'),_0x5dce78,_0x5ac89c[_0x3d6e('0x10')]['message']);return _0x16055a(_0x5ac89c[_0x3d6e('0x10')]['message']);}else{logger['info'](_0x3d6e('0xb'),_0x5dce78,_0x3d6e('0xc'));_0x16055a(_0x5ac89c[_0x3d6e('0x13')][_0x3d6e('0x12')]);}})['catch'](function(_0x22bd92){logger[_0x3d6e('0x10')](_0x3d6e('0xb'),_0x5dce78,_0x22bd92);_0x2481ad(_0x22bd92);});});} \ No newline at end of file +var _0xdb94=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0xd3d919,_0x252ab1){var _0x333d43=function(_0x2baea7){while(--_0x2baea7){_0xd3d919['push'](_0xd3d919['shift']());}};_0x333d43(++_0x252ab1);}(_0xdb94,0xab));var _0x4db9=function(_0x10afec,_0x8e39a9){_0x10afec=_0x10afec-0x0;var _0x515643=_0xdb94[_0x10afec];return _0x515643;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rs=require(_0x4db9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db9('0x5'))['db'];var utils=require(_0x4db9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1f45,_0x196ede,_0x50c27a){return new BPromise(function(_0x14deb9,_0x26248b){return client[_0x4db9('0x9')](_0x5d1f45,_0x50c27a)[_0x4db9('0xa')](function(_0x2cacca){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x196ede,_0x4db9('0xd'),JSON['stringify'](_0x2cacca));if(_0x2cacca[_0x4db9('0x10')]){if(_0x2cacca[_0x4db9('0x10')]['code']===0x1f4){logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca['error']['message']);return _0x26248b(_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);}logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);return _0x14deb9(_0x2cacca[_0x4db9('0x10')]['message']);}else{logger['info'](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));_0x14deb9(_0x2cacca['result'][_0x4db9('0x11')]);}})[_0x4db9('0x12')](function(_0x5d6471){logger['error'](_0x4db9('0xc'),_0x196ede,_0x5d6471);_0x26248b(_0x5d6471);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a1f58c4..650db11 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 _0x01c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x39c9ad,_0x11da55){var _0x4f541c=function(_0x1ff11e){while(--_0x1ff11e){_0x39c9ad['push'](_0x39c9ad['shift']());}};_0x4f541c(++_0x11da55);}(_0x01c8,0x162));var _0x801c=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x01c8[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0x801c('0x0'));var util=require(_0x801c('0x1'));var path=require(_0x801c('0x2'));var timeout=require(_0x801c('0x3'));var express=require(_0x801c('0x4'));var router=express[_0x801c('0x5')]();var auth=require(_0x801c('0x6'));var interaction=require(_0x801c('0x7'));var config=require(_0x801c('0x8'));var controller=require(_0x801c('0x9'));router[_0x801c('0xa')]('/',auth['isAuthenticated'](),controller[_0x801c('0xb')]);router[_0x801c('0xa')]('/describe',auth[_0x801c('0xc')](),controller[_0x801c('0xd')]);router[_0x801c('0xa')]('/:id',auth[_0x801c('0xc')](),controller['show']);router[_0x801c('0xe')]('/',auth['isAuthenticated'](),controller[_0x801c('0xf')]);router[_0x801c('0x10')]('/:id',auth[_0x801c('0xc')](),controller[_0x801c('0x11')]);router[_0x801c('0x12')]('/:id',auth[_0x801c('0xc')](),controller[_0x801c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa570=['isAuthenticated','index','/describe','/:id','post','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x36f688,_0x136a34){var _0x5483e4=function(_0x218af7){while(--_0x218af7){_0x36f688['push'](_0x36f688['shift']());}};_0x5483e4(++_0x136a34);}(_0xa570,0x190));var _0x0a57=function(_0x563a6c,_0x3220c2){_0x563a6c=_0x563a6c-0x0;var _0x58bafd=_0xa570[_0x563a6c];return _0x58bafd;};'use strict';var multer=require(_0x0a57('0x0'));var util=require(_0x0a57('0x1'));var path=require('path');var timeout=require(_0x0a57('0x2'));var express=require(_0x0a57('0x3'));var router=express['Router']();var auth=require(_0x0a57('0x4'));var interaction=require(_0x0a57('0x5'));var config=require(_0x0a57('0x6'));var controller=require('./voiceDialReport.controller');router[_0x0a57('0x7')]('/',auth[_0x0a57('0x8')](),controller[_0x0a57('0x9')]);router[_0x0a57('0x7')](_0x0a57('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0a57('0xb'),auth[_0x0a57('0x8')](),controller['show']);router[_0x0a57('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a57('0xd')](_0x0a57('0xb'),auth[_0x0a57('0x8')](),controller['update']);router[_0x0a57('0xe')](_0x0a57('0xb'),auth[_0x0a57('0x8')](),controller[_0x0a57('0xf')]);module[_0x0a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 57c74a5..0c44b7f 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 _0x826c=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x573a4f,_0x20ab72){var _0x555da9=function(_0x508159){while(--_0x508159){_0x573a4f['push'](_0x573a4f['shift']());}};_0x555da9(++_0x20ab72);}(_0x826c,0x7f));var _0xc826=function(_0xdba16c,_0x5d4e1b){_0xdba16c=_0xdba16c-0x0;var _0x5530f5=_0x826c[_0xdba16c];return _0x5530f5;};'use strict';var Sequelize=require('sequelize');module[_0xc826('0x0')]={'privilege':{'type':Sequelize[_0xc826('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc826('0x1')]},'calleridnum':{'type':Sequelize[_0xc826('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc826('0x1')]},'connectedlinename':{'type':Sequelize[_0xc826('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc826('0x1')]},'exten':{'type':Sequelize[_0xc826('0x1')]},'priority':{'type':Sequelize[_0xc826('0x2')]},'uniqueid':{'type':Sequelize[_0xc826('0x1')]},'linkedid':{'type':Sequelize[_0xc826('0x1')]},'destchannel':{'type':Sequelize[_0xc826('0x1')]},'destchannelstate':{'type':Sequelize[_0xc826('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc826('0x1')]},'destcalleridname':{'type':Sequelize[_0xc826('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc826('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xc826('0x1')]},'destlanguage':{'type':Sequelize[_0xc826('0x1')]},'destaccountcode':{'type':Sequelize[_0xc826('0x1')]},'destcontext':{'type':Sequelize[_0xc826('0x1')]},'destexten':{'type':Sequelize[_0xc826('0x1')]},'destpriority':{'type':Sequelize[_0xc826('0x2')]},'destuniqueid':{'type':Sequelize[_0xc826('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xc826('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc826('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc826('0x1')],'comment':_0xc826('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xc826('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6d25=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x11cf3e,_0x552b93){var _0x2845c4=function(_0x4e25a7){while(--_0x4e25a7){_0x11cf3e['push'](_0x11cf3e['shift']());}};_0x2845c4(++_0x552b93);}(_0x6d25,0x7e));var _0x56d2=function(_0x1d0e2b,_0x497d21){_0x1d0e2b=_0x1d0e2b-0x0;var _0x17f3a7=_0x6d25[_0x1d0e2b];return _0x17f3a7;};'use strict';var Sequelize=require(_0x56d2('0x0'));module[_0x56d2('0x1')]={'privilege':{'type':Sequelize[_0x56d2('0x2')]},'channel':{'type':Sequelize[_0x56d2('0x2')]},'channelstate':{'type':Sequelize[_0x56d2('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x56d2('0x2')]},'calleridname':{'type':Sequelize[_0x56d2('0x2')]},'connectedlinenum':{'type':Sequelize[_0x56d2('0x2')]},'connectedlinename':{'type':Sequelize[_0x56d2('0x2')]},'language':{'type':Sequelize[_0x56d2('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x56d2('0x3')]},'uniqueid':{'type':Sequelize[_0x56d2('0x2')]},'linkedid':{'type':Sequelize[_0x56d2('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x56d2('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x56d2('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x56d2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x56d2('0x2')]},'destlanguage':{'type':Sequelize[_0x56d2('0x2')]},'destaccountcode':{'type':Sequelize[_0x56d2('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x56d2('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x56d2('0x2')]},'destlinkedid':{'type':Sequelize[_0x56d2('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x56d2('0x2')]},'starttime':{'type':Sequelize[_0x56d2('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x56d2('0x2')],'comment':_0x56d2('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x56d2('0x3')]},'holdtime':{'type':Sequelize[_0x56d2('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 0b880da..53396f9 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 _0x96cb=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','keys','create','body','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json'];(function(_0x58a854,_0x34ca3b){var _0x48ed92=function(_0x5ed782){while(--_0x5ed782){_0x58a854['push'](_0x58a854['shift']());}};_0x48ed92(++_0x34ca3b);}(_0x96cb,0x15b));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb96c('0x0'));var emlformat=require(_0xb96c('0x1'));var rimraf=require(_0xb96c('0x2'));var zipdir=require(_0xb96c('0x3'));var jsonpatch=require(_0xb96c('0x4'));var rp=require(_0xb96c('0x5'));var moment=require(_0xb96c('0x6'));var BPromise=require(_0xb96c('0x7'));var Mustache=require(_0xb96c('0x8'));var util=require(_0xb96c('0x9'));var path=require(_0xb96c('0xa'));var sox=require('sox');var csv=require(_0xb96c('0xb'));var ejs=require(_0xb96c('0xc'));var fs=require('fs');var _=require(_0xb96c('0xd'));var squel=require(_0xb96c('0xe'));var crypto=require(_0xb96c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb96c('0x10'));var toCsv=require(_0xb96c('0xb'));var querystring=require('querystring');var Papa=require(_0xb96c('0x11'));var Redis=require(_0xb96c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb96c('0x14'));var logger=require(_0xb96c('0x15'))('api');var utils=require(_0xb96c('0x16'));var config=require(_0xb96c('0x17'));var licenseUtil=require(_0xb96c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12e4dd,_0x3b338a){_0x3b338a=_0x3b338a||0xcc;return function(_0x29c18e){if(_0x29c18e){return _0x12e4dd['sendStatus'](_0x3b338a);}return _0x12e4dd[_0xb96c('0x19')](_0x3b338a)[_0xb96c('0x1a')]();};}function respondWithResult(_0x44a3c2,_0x644541){_0x644541=_0x644541||0xc8;return function(_0x174d9c){if(_0x174d9c){return _0x44a3c2[_0xb96c('0x19')](_0x644541)[_0xb96c('0x1b')](_0x174d9c);}};}function respondWithFilteredResult(_0x4544e6,_0x44cc06){return function(_0x511a29){if(_0x511a29){var _0x4fa80f=_0x511a29['count'],_0x53cc66=_0x44cc06['offset'],_0x47b7d0=_0x44cc06[_0xb96c('0x1c')]+_0x44cc06[_0xb96c('0x1d')],_0x1494aa;if(_0x47b7d0>=_0x4fa80f){_0x47b7d0=_0x4fa80f;_0x1494aa=0xc8;}else{_0x1494aa=0xce;}_0x4544e6[_0xb96c('0x19')](_0x1494aa);return _0x4544e6[_0xb96c('0x1e')](_0xb96c('0x1f'),_0x53cc66+'-'+_0x47b7d0+'/'+_0x4fa80f)[_0xb96c('0x1b')](_0x511a29);}return null;};}function patchUpdates(_0x328df4){return function(_0x1f2f62){try{jsonpatch[_0xb96c('0x20')](_0x1f2f62,_0x328df4,!![]);}catch(_0x4c37ae){return BPromise[_0xb96c('0x21')](_0x4c37ae);}return _0x1f2f62[_0xb96c('0x22')]();};}function saveUpdates(_0x580a24,_0x7457ef){return function(_0x581385){if(_0x581385){return _0x581385[_0xb96c('0x23')](_0x580a24)[_0xb96c('0x24')](function(_0x2a6287){return _0x2a6287;});}return null;};}function removeEntity(_0x1df320,_0x46de9d){return function(_0x31581d){if(_0x31581d){return _0x31581d[_0xb96c('0x25')]()['then'](function(){_0x1df320[_0xb96c('0x19')](0xcc)[_0xb96c('0x1a')]();});}};}function handleEntityNotFound(_0x32bb7f,_0x4ccbb2){return function(_0x70e7f5){if(!_0x70e7f5){_0x32bb7f[_0xb96c('0x26')](0x194);}return _0x70e7f5;};}function handleError(_0x29768b,_0x19876f){_0x19876f=_0x19876f||0x1f4;return function(_0x49df6e){logger[_0xb96c('0x27')](_0x49df6e[_0xb96c('0x28')]);if(_0x49df6e['name']){delete _0x49df6e[_0xb96c('0x29')];}_0x29768b['status'](_0x19876f)[_0xb96c('0x2a')](_0x49df6e);};}exports[_0xb96c('0x2b')]=function(_0x273349,_0x350a36){var _0x54a8a4={},_0x3674ca={},_0x3e4cd7={'count':0x0,'rows':[]};var _0x598095=_['map'](db[_0xb96c('0x2c')][_0xb96c('0x2d')],function(_0x4c9e0f){return{'name':_0x4c9e0f[_0xb96c('0x2e')],'type':_0x4c9e0f[_0xb96c('0x2f')]['key']};});_0x3674ca['model']=_[_0xb96c('0x30')](_0x598095,'name');_0x3674ca['query']=_['keys'](_0x273349[_0xb96c('0x31')]);_0x3674ca[_0xb96c('0x32')]=_[_0xb96c('0x33')](_0x3674ca['model'],_0x3674ca[_0xb96c('0x31')]);_0x54a8a4[_0xb96c('0x34')]=_['intersection'](_0x3674ca['model'],qs[_0xb96c('0x35')](_0x273349['query'][_0xb96c('0x35')]));_0x54a8a4[_0xb96c('0x34')]=_0x54a8a4[_0xb96c('0x34')][_0xb96c('0x36')]?_0x54a8a4[_0xb96c('0x34')]:_0x3674ca[_0xb96c('0x37')];if(!_0x273349[_0xb96c('0x31')][_0xb96c('0x38')]('nolimit')){_0x54a8a4[_0xb96c('0x1d')]=qs[_0xb96c('0x1d')](_0x273349[_0xb96c('0x31')][_0xb96c('0x1d')]);_0x54a8a4[_0xb96c('0x1c')]=qs['offset'](_0x273349['query'][_0xb96c('0x1c')]);}_0x54a8a4['order']=qs[_0xb96c('0x39')](_0x273349[_0xb96c('0x31')]['sort']);_0x54a8a4[_0xb96c('0x3a')]=qs['filters'](_[_0xb96c('0x3b')](_0x273349['query'],_0x3674ca['filters']),_0x598095);if(_0x273349[_0xb96c('0x31')][_0xb96c('0x3c')]){_0x54a8a4['where']=_[_0xb96c('0x3d')](_0x54a8a4[_0xb96c('0x3a')],{'$or':_[_0xb96c('0x30')](_0x598095,function(_0x48ebb2){if(_0x48ebb2['type']!==_0xb96c('0x3e')){var _0x3b77f5={};_0x3b77f5[_0x48ebb2['name']]={'$like':'%'+_0x273349[_0xb96c('0x31')][_0xb96c('0x3c')]+'%'};return _0x3b77f5;}})});}_0x54a8a4=_[_0xb96c('0x3d')]({},_0x54a8a4,_0x273349['options']);var _0x1353b6={'where':_0x54a8a4[_0xb96c('0x3a')]};return db['VoiceDialReport'][_0xb96c('0x3f')](_0x1353b6)[_0xb96c('0x24')](function(_0x66593a){_0x3e4cd7['count']=_0x66593a;if(_0x273349[_0xb96c('0x31')][_0xb96c('0x40')]){_0x54a8a4[_0xb96c('0x41')]=[{'all':!![]}];}return db[_0xb96c('0x2c')][_0xb96c('0x42')](_0x54a8a4);})['then'](function(_0x3d1200){_0x3e4cd7[_0xb96c('0x43')]=_0x3d1200;return _0x3e4cd7;})[_0xb96c('0x24')](respondWithFilteredResult(_0x350a36,_0x54a8a4))[_0xb96c('0x44')](handleError(_0x350a36,null));};exports['show']=function(_0x4e762c,_0x24ab2b){var _0x56927f={'raw':!![],'where':{'id':_0x4e762c['params']['id']}},_0x1f3ba0={};_0x1f3ba0['model']=_['keys'](db[_0xb96c('0x2c')][_0xb96c('0x2d')]);_0x1f3ba0[_0xb96c('0x31')]=_[_0xb96c('0x45')](_0x4e762c['query']);_0x1f3ba0['filters']=_[_0xb96c('0x33')](_0x1f3ba0[_0xb96c('0x37')],_0x1f3ba0[_0xb96c('0x31')]);_0x56927f[_0xb96c('0x34')]=_[_0xb96c('0x33')](_0x1f3ba0[_0xb96c('0x37')],qs[_0xb96c('0x35')](_0x4e762c[_0xb96c('0x31')][_0xb96c('0x35')]));_0x56927f['attributes']=_0x56927f[_0xb96c('0x34')][_0xb96c('0x36')]?_0x56927f[_0xb96c('0x34')]:_0x1f3ba0[_0xb96c('0x37')];if(_0x4e762c[_0xb96c('0x31')][_0xb96c('0x40')]){_0x56927f[_0xb96c('0x41')]=[{'all':!![]}];}_0x56927f=_[_0xb96c('0x3d')]({},_0x56927f,_0x4e762c['options']);return db[_0xb96c('0x2c')]['find'](_0x56927f)[_0xb96c('0x24')](handleEntityNotFound(_0x24ab2b,null))['then'](respondWithResult(_0x24ab2b,null))[_0xb96c('0x44')](handleError(_0x24ab2b,null));};exports[_0xb96c('0x46')]=function(_0x2f6930,_0x304779){return db['VoiceDialReport'][_0xb96c('0x46')](_0x2f6930[_0xb96c('0x47')],{})['then'](respondWithResult(_0x304779,0xc9))['catch'](handleError(_0x304779,null));};exports['update']=function(_0x2348b0,_0x58c498){if(_0x2348b0['body']['id']){delete _0x2348b0['body']['id'];}return db[_0xb96c('0x2c')]['find']({'where':{'id':_0x2348b0[_0xb96c('0x48')]['id']}})[_0xb96c('0x24')](handleEntityNotFound(_0x58c498,null))['then'](saveUpdates(_0x2348b0[_0xb96c('0x47')],null))[_0xb96c('0x24')](respondWithResult(_0x58c498,null))[_0xb96c('0x44')](handleError(_0x58c498,null));};exports['destroy']=function(_0x45855c,_0x2c2bb6){return db['VoiceDialReport'][_0xb96c('0x49')]({'where':{'id':_0x45855c[_0xb96c('0x48')]['id']}})[_0xb96c('0x24')](handleEntityNotFound(_0x2c2bb6,null))[_0xb96c('0x24')](removeEntity(_0x2c2bb6,null))[_0xb96c('0x44')](handleError(_0x2c2bb6,null));};exports['describe']=function(_0x2af6e3,_0x38b06f){return db[_0xb96c('0x2c')][_0xb96c('0x4a')]()[_0xb96c('0x24')](respondWithResult(_0x38b06f,null))[_0xb96c('0x44')](handleError(_0x38b06f,null));}; \ No newline at end of file +var _0x97ce=['../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x97ce,0x143));var _0xe97c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x97ce[_0x2112d4];return _0x434972;};'use strict';var pdf=require(_0xe97c('0x0'));var emlformat=require(_0xe97c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe97c('0x2'));var jsonpatch=require(_0xe97c('0x3'));var rp=require(_0xe97c('0x4'));var moment=require(_0xe97c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe97c('0x6'));var util=require(_0xe97c('0x7'));var path=require(_0xe97c('0x8'));var sox=require('sox');var csv=require(_0xe97c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe97c('0xa'));var squel=require(_0xe97c('0xb'));var crypto=require('crypto');var jsforce=require(_0xe97c('0xc'));var deskjs=require(_0xe97c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe97c('0xe'));var Papa=require(_0xe97c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe97c('0x10'));var as=require(_0xe97c('0x11'));var hardwareService=require(_0xe97c('0x12'));var logger=require('../../config/logger')(_0xe97c('0x13'));var utils=require(_0xe97c('0x14'));var config=require(_0xe97c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe97c('0x16'))['db'];function respondWithStatusCode(_0x3984f4,_0x32c043){_0x32c043=_0x32c043||0xcc;return function(_0x2f4b40){if(_0x2f4b40){return _0x3984f4[_0xe97c('0x17')](_0x32c043);}return _0x3984f4['status'](_0x32c043)[_0xe97c('0x18')]();};}function respondWithResult(_0x2dee9f,_0x3340f8){_0x3340f8=_0x3340f8||0xc8;return function(_0x50b257){if(_0x50b257){return _0x2dee9f[_0xe97c('0x19')](_0x3340f8)[_0xe97c('0x1a')](_0x50b257);}};}function respondWithFilteredResult(_0x35ac50,_0x1e2fb0){return function(_0x1ca6c3){if(_0x1ca6c3){var _0xd8134=_0x1ca6c3[_0xe97c('0x1b')],_0x39e737=_0x1e2fb0['offset'],_0x79ff59=_0x1e2fb0[_0xe97c('0x1c')]+_0x1e2fb0['limit'],_0xb1300a;if(_0x79ff59>=_0xd8134){_0x79ff59=_0xd8134;_0xb1300a=0xc8;}else{_0xb1300a=0xce;}_0x35ac50[_0xe97c('0x19')](_0xb1300a);return _0x35ac50['set'](_0xe97c('0x1d'),_0x39e737+'-'+_0x79ff59+'/'+_0xd8134)['json'](_0x1ca6c3);}return null;};}function patchUpdates(_0x226344){return function(_0x20ca16){try{jsonpatch['apply'](_0x20ca16,_0x226344,!![]);}catch(_0x5d3994){return BPromise['reject'](_0x5d3994);}return _0x20ca16['save']();};}function saveUpdates(_0x2cc0b8,_0x5f34dd){return function(_0x280649){if(_0x280649){return _0x280649[_0xe97c('0x1e')](_0x2cc0b8)[_0xe97c('0x1f')](function(_0x209a90){return _0x209a90;});}return null;};}function removeEntity(_0x5da68b,_0x68b275){return function(_0x558711){if(_0x558711){return _0x558711['destroy']()[_0xe97c('0x1f')](function(){_0x5da68b['status'](0xcc)[_0xe97c('0x18')]();});}};}function handleEntityNotFound(_0x1d39a5,_0xca7f4f){return function(_0x355115){if(!_0x355115){_0x1d39a5[_0xe97c('0x17')](0x194);}return _0x355115;};}function handleError(_0x760b59,_0x408c88){_0x408c88=_0x408c88||0x1f4;return function(_0x333c42){logger[_0xe97c('0x20')](_0x333c42[_0xe97c('0x21')]);if(_0x333c42['name']){delete _0x333c42[_0xe97c('0x22')];}_0x760b59['status'](_0x408c88)[_0xe97c('0x23')](_0x333c42);};}exports[_0xe97c('0x24')]=function(_0x124692,_0x4b82ce){var _0x5d335c={},_0xc03fda={},_0x5b3517={'count':0x0,'rows':[]};var _0x439d5e=_[_0xe97c('0x25')](db[_0xe97c('0x26')][_0xe97c('0x27')],function(_0x322b5c){return{'name':_0x322b5c[_0xe97c('0x28')],'type':_0x322b5c[_0xe97c('0x29')][_0xe97c('0x2a')]};});_0xc03fda['model']=_[_0xe97c('0x25')](_0x439d5e,_0xe97c('0x22'));_0xc03fda[_0xe97c('0x2b')]=_['keys'](_0x124692[_0xe97c('0x2b')]);_0xc03fda[_0xe97c('0x2c')]=_[_0xe97c('0x2d')](_0xc03fda['model'],_0xc03fda['query']);_0x5d335c[_0xe97c('0x2e')]=_[_0xe97c('0x2d')](_0xc03fda[_0xe97c('0x2f')],qs['fields'](_0x124692[_0xe97c('0x2b')][_0xe97c('0x30')]));_0x5d335c[_0xe97c('0x2e')]=_0x5d335c[_0xe97c('0x2e')][_0xe97c('0x31')]?_0x5d335c[_0xe97c('0x2e')]:_0xc03fda['model'];if(!_0x124692[_0xe97c('0x2b')][_0xe97c('0x32')]('nolimit')){_0x5d335c[_0xe97c('0x33')]=qs[_0xe97c('0x33')](_0x124692['query'][_0xe97c('0x33')]);_0x5d335c[_0xe97c('0x1c')]=qs[_0xe97c('0x1c')](_0x124692['query'][_0xe97c('0x1c')]);}_0x5d335c[_0xe97c('0x34')]=qs[_0xe97c('0x35')](_0x124692[_0xe97c('0x2b')][_0xe97c('0x35')]);_0x5d335c[_0xe97c('0x36')]=qs[_0xe97c('0x2c')](_['pick'](_0x124692[_0xe97c('0x2b')],_0xc03fda[_0xe97c('0x2c')]),_0x439d5e);if(_0x124692[_0xe97c('0x2b')][_0xe97c('0x37')]){_0x5d335c[_0xe97c('0x36')]=_[_0xe97c('0x38')](_0x5d335c['where'],{'$or':_[_0xe97c('0x25')](_0x439d5e,function(_0x1cc76f){if(_0x1cc76f[_0xe97c('0x29')]!==_0xe97c('0x39')){var _0x1f6c1d={};_0x1f6c1d[_0x1cc76f[_0xe97c('0x22')]]={'$like':'%'+_0x124692[_0xe97c('0x2b')]['filter']+'%'};return _0x1f6c1d;}})});}_0x5d335c=_['merge']({},_0x5d335c,_0x124692['options']);var _0xd4d7bd={'where':_0x5d335c[_0xe97c('0x36')]};return db[_0xe97c('0x26')][_0xe97c('0x1b')](_0xd4d7bd)[_0xe97c('0x1f')](function(_0xd332c5){_0x5b3517[_0xe97c('0x1b')]=_0xd332c5;if(_0x124692['query']['includeAll']){_0x5d335c[_0xe97c('0x3a')]=[{'all':!![]}];}return db[_0xe97c('0x26')][_0xe97c('0x3b')](_0x5d335c);})[_0xe97c('0x1f')](function(_0x1c0a66){_0x5b3517[_0xe97c('0x3c')]=_0x1c0a66;return _0x5b3517;})[_0xe97c('0x1f')](respondWithFilteredResult(_0x4b82ce,_0x5d335c))[_0xe97c('0x3d')](handleError(_0x4b82ce,null));};exports[_0xe97c('0x3e')]=function(_0x4632d5,_0x45d0f2){var _0x26af23={'raw':!![],'where':{'id':_0x4632d5[_0xe97c('0x3f')]['id']}},_0x5665a1={};_0x5665a1[_0xe97c('0x2f')]=_[_0xe97c('0x40')](db[_0xe97c('0x26')]['rawAttributes']);_0x5665a1[_0xe97c('0x2b')]=_[_0xe97c('0x40')](_0x4632d5[_0xe97c('0x2b')]);_0x5665a1[_0xe97c('0x2c')]=_[_0xe97c('0x2d')](_0x5665a1[_0xe97c('0x2f')],_0x5665a1[_0xe97c('0x2b')]);_0x26af23[_0xe97c('0x2e')]=_[_0xe97c('0x2d')](_0x5665a1[_0xe97c('0x2f')],qs[_0xe97c('0x30')](_0x4632d5[_0xe97c('0x2b')][_0xe97c('0x30')]));_0x26af23['attributes']=_0x26af23['attributes']['length']?_0x26af23[_0xe97c('0x2e')]:_0x5665a1[_0xe97c('0x2f')];if(_0x4632d5[_0xe97c('0x2b')]['includeAll']){_0x26af23[_0xe97c('0x3a')]=[{'all':!![]}];}_0x26af23=_[_0xe97c('0x38')]({},_0x26af23,_0x4632d5['options']);return db[_0xe97c('0x26')][_0xe97c('0x41')](_0x26af23)['then'](handleEntityNotFound(_0x45d0f2,null))['then'](respondWithResult(_0x45d0f2,null))[_0xe97c('0x3d')](handleError(_0x45d0f2,null));};exports['create']=function(_0x2477a4,_0x14b107){return db[_0xe97c('0x26')][_0xe97c('0x42')](_0x2477a4[_0xe97c('0x43')],{})['then'](respondWithResult(_0x14b107,0xc9))[_0xe97c('0x3d')](handleError(_0x14b107,null));};exports[_0xe97c('0x1e')]=function(_0x3b63a1,_0x354be8){if(_0x3b63a1['body']['id']){delete _0x3b63a1['body']['id'];}return db[_0xe97c('0x26')][_0xe97c('0x41')]({'where':{'id':_0x3b63a1[_0xe97c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x354be8,null))[_0xe97c('0x1f')](saveUpdates(_0x3b63a1[_0xe97c('0x43')],null))[_0xe97c('0x1f')](respondWithResult(_0x354be8,null))['catch'](handleError(_0x354be8,null));};exports['destroy']=function(_0x2021ac,_0x4b8906){return db[_0xe97c('0x26')]['find']({'where':{'id':_0x2021ac[_0xe97c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4b8906,null))[_0xe97c('0x1f')](removeEntity(_0x4b8906,null))[_0xe97c('0x3d')](handleError(_0x4b8906,null));};exports[_0xe97c('0x44')]=function(_0x3a1884,_0x53646e){return db[_0xe97c('0x26')][_0xe97c('0x44')]()[_0xe97c('0x1f')](respondWithResult(_0x53646e,null))[_0xe97c('0x3d')](handleError(_0x53646e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 73455f7..2720fec 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 _0x2e1c=['define','report_dial','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x138b2c,_0x142181){var _0xa8b921=function(_0xc1799e){while(--_0xc1799e){_0x138b2c['push'](_0x138b2c['shift']());}};_0xa8b921(++_0x142181);}(_0x2e1c,0x85));var _0xc2e1=function(_0x1fbbd8,_0x443c29){_0x1fbbd8=_0x1fbbd8-0x0;var _0x486d93=_0x2e1c[_0x1fbbd8];return _0x486d93;};'use strict';var _=require(_0xc2e1('0x0'));var util=require('util');var logger=require(_0xc2e1('0x1'))('api');var moment=require(_0xc2e1('0x2'));var BPromise=require(_0xc2e1('0x3'));var rp=require(_0xc2e1('0x4'));var fs=require('fs');var path=require(_0xc2e1('0x5'));var rimraf=require(_0xc2e1('0x6'));var config=require(_0xc2e1('0x7'));var attributes=require(_0xc2e1('0x8'));module[_0xc2e1('0x9')]=function(_0x28da31,_0x3663c2){return _0x28da31[_0xc2e1('0xa')]('VoiceDialReport',attributes,{'tableName':_0xc2e1('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc2e1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0536=['VoiceDialReport','report_dial','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x46cae6,_0x244945){var _0x1e5228=function(_0x3c3033){while(--_0x3c3033){_0x46cae6['push'](_0x46cae6['shift']());}};_0x1e5228(++_0x244945);}(_0x0536,0x15e));var _0x6053=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0536[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6053('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6053('0x1'));var BPromise=require(_0x6053('0x2'));var rp=require(_0x6053('0x3'));var fs=require('fs');var path=require(_0x6053('0x4'));var rimraf=require(_0x6053('0x5'));var config=require(_0x6053('0x6'));var attributes=require(_0x6053('0x7'));module[_0x6053('0x8')]=function(_0x204f61,_0x3ec181){return _0x204f61[_0x6053('0x9')](_0x6053('0xa'),attributes,{'tableName':_0x6053('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 61d1bce..584d2a7 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 _0x09b1=['create','body','options','raw','stringify','UpdateVoiceDialReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceDialReport','VoiceDialReport'];(function(_0x392dc2,_0x47c3f3){var _0x14150f=function(_0x9f305a){while(--_0x9f305a){_0x392dc2['push'](_0x392dc2['shift']());}};_0x14150f(++_0x47c3f3);}(_0x09b1,0x87));var _0x109b=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x09b1[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x109b('0x0'));var util=require(_0x109b('0x1'));var moment=require(_0x109b('0x2'));var BPromise=require('bluebird');var rs=require(_0x109b('0x3'));var fs=require('fs');var Redis=require(_0x109b('0x4'));var db=require(_0x109b('0x5'))['db'];var utils=require(_0x109b('0x6'));var logger=require(_0x109b('0x7'))(_0x109b('0x8'));var config=require(_0x109b('0x9'));var jayson=require(_0x109b('0xa'));var client=jayson[_0x109b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1aae,_0x21b4aa,_0x23c626){return new BPromise(function(_0x8b9078,_0x1fa2ed){return client['request'](_0x5d1aae,_0x23c626)[_0x109b('0xc')](function(_0x1403f4){logger[_0x109b('0xd')](_0x109b('0xe'),_0x21b4aa,'request\x20sent');logger[_0x109b('0xf')](_0x109b('0x10'),_0x21b4aa,'request\x20sent',JSON['stringify'](_0x1403f4));if(_0x1403f4[_0x109b('0x11')]){if(_0x1403f4[_0x109b('0x11')][_0x109b('0x12')]===0x1f4){logger[_0x109b('0x11')](_0x109b('0xe'),_0x21b4aa,_0x1403f4[_0x109b('0x11')][_0x109b('0x13')]);return _0x1fa2ed(_0x1403f4[_0x109b('0x11')][_0x109b('0x13')]);}logger[_0x109b('0x11')](_0x109b('0xe'),_0x21b4aa,_0x1403f4[_0x109b('0x11')]['message']);return _0x8b9078(_0x1403f4[_0x109b('0x11')][_0x109b('0x13')]);}else{logger[_0x109b('0xd')](_0x109b('0xe'),_0x21b4aa,_0x109b('0x14'));_0x8b9078(_0x1403f4[_0x109b('0x15')][_0x109b('0x13')]);}})[_0x109b('0x16')](function(_0x2598ab){logger['error'](_0x109b('0xe'),_0x21b4aa,_0x2598ab);_0x1fa2ed(_0x2598ab);});});}exports[_0x109b('0x17')]=function(_0xe05d47){var _0x5bc796=this;return new Promise(function(_0x80e270,_0x1e53bb){return db[_0x109b('0x18')][_0x109b('0x19')](_0xe05d47[_0x109b('0x1a')],{'raw':_0xe05d47[_0x109b('0x1b')]?_0xe05d47[_0x109b('0x1b')][_0x109b('0x1c')]===undefined?!![]:![]:!![]})[_0x109b('0xc')](function(_0x1651b7){logger['info'](_0x109b('0x17'),_0xe05d47);logger[_0x109b('0xf')](_0x109b('0x17'),_0xe05d47,JSON[_0x109b('0x1d')](_0x1651b7));_0x80e270(_0x1651b7);})[_0x109b('0x16')](function(_0x40de9f){logger['error'](_0x109b('0x17'),_0x40de9f[_0x109b('0x13')],_0xe05d47);_0x1e53bb(_0x5bc796[_0x109b('0x11')](0x1f4,_0x40de9f[_0x109b('0x13')]));});});};exports[_0x109b('0x1e')]=function(_0x1c1f23){var _0x39142d=this;return new Promise(function(_0x101cbf,_0x5d3ae0){return db[_0x109b('0x18')]['update'](_0x1c1f23[_0x109b('0x1a')],{'raw':_0x1c1f23['options']?_0x1c1f23[_0x109b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1f23['options']?_0x1c1f23['options'][_0x109b('0x1f')]||null:null,'attributes':_0x1c1f23[_0x109b('0x1b')]?_0x1c1f23[_0x109b('0x1b')]['attributes']||null:null,'limit':_0x1c1f23[_0x109b('0x1b')]?_0x1c1f23[_0x109b('0x1b')]['limit']||null:null})[_0x109b('0xc')](function(_0xb0d8cc){logger[_0x109b('0xd')](_0x109b('0x1e'),_0x1c1f23);logger[_0x109b('0xf')](_0x109b('0x1e'),_0x1c1f23,JSON[_0x109b('0x1d')](_0xb0d8cc));_0x101cbf(_0xb0d8cc);})[_0x109b('0x16')](function(_0x4a39a6){logger['error'](_0x109b('0x1e'),_0x4a39a6[_0x109b('0x13')],_0x1c1f23);_0x5d3ae0(_0x39142d['error'](0x1f4,_0x4a39a6[_0x109b('0x13')]));});});}; \ No newline at end of file +var _0x4e32=['catch','create','body','options','raw','CreateVoiceDialReport','VoiceDialReport','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x34c492,_0x5afe59){var _0x3aeb9f=function(_0x10b12f){while(--_0x10b12f){_0x34c492['push'](_0x34c492['shift']());}};_0x3aeb9f(++_0x5afe59);}(_0x4e32,0xf9));var _0x24e3=function(_0x9bbe48,_0x5c27cd){_0x9bbe48=_0x9bbe48-0x0;var _0x130fd7=_0x4e32[_0x9bbe48];return _0x130fd7;};'use strict';var _=require(_0x24e3('0x0'));var util=require(_0x24e3('0x1'));var moment=require(_0x24e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x24e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24e3('0x4'))['db'];var utils=require(_0x24e3('0x5'));var logger=require(_0x24e3('0x6'))(_0x24e3('0x7'));var config=require(_0x24e3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24e3('0x9')][_0x24e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ebe28,_0xc3f538,_0xefcec8){return new BPromise(function(_0x2bb02f,_0x56e201){return client[_0x24e3('0xb')](_0x3ebe28,_0xefcec8)[_0x24e3('0xc')](function(_0x2f2d77){logger[_0x24e3('0xd')](_0x24e3('0xe'),_0xc3f538,_0x24e3('0xf'));logger[_0x24e3('0x10')](_0x24e3('0x11'),_0xc3f538,_0x24e3('0xf'),JSON[_0x24e3('0x12')](_0x2f2d77));if(_0x2f2d77['error']){if(_0x2f2d77[_0x24e3('0x13')][_0x24e3('0x14')]===0x1f4){logger[_0x24e3('0x13')](_0x24e3('0xe'),_0xc3f538,_0x2f2d77[_0x24e3('0x13')][_0x24e3('0x15')]);return _0x56e201(_0x2f2d77['error'][_0x24e3('0x15')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0xc3f538,_0x2f2d77[_0x24e3('0x13')]['message']);return _0x2bb02f(_0x2f2d77[_0x24e3('0x13')][_0x24e3('0x15')]);}else{logger[_0x24e3('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0xc3f538,_0x24e3('0xf'));_0x2bb02f(_0x2f2d77[_0x24e3('0x16')][_0x24e3('0x15')]);}})[_0x24e3('0x17')](function(_0x3861f9){logger[_0x24e3('0x13')](_0x24e3('0xe'),_0xc3f538,_0x3861f9);_0x56e201(_0x3861f9);});});}exports['CreateVoiceDialReport']=function(_0x35992a){var _0x599193=this;return new Promise(function(_0x3f9340,_0x1c43d4){return db['VoiceDialReport'][_0x24e3('0x18')](_0x35992a[_0x24e3('0x19')],{'raw':_0x35992a['options']?_0x35992a[_0x24e3('0x1a')][_0x24e3('0x1b')]===undefined?!![]:![]:!![]})[_0x24e3('0xc')](function(_0x152b86){logger[_0x24e3('0xd')](_0x24e3('0x1c'),_0x35992a);logger['debug'](_0x24e3('0x1c'),_0x35992a,JSON[_0x24e3('0x12')](_0x152b86));_0x3f9340(_0x152b86);})[_0x24e3('0x17')](function(_0x268dc6){logger[_0x24e3('0x13')](_0x24e3('0x1c'),_0x268dc6['message'],_0x35992a);_0x1c43d4(_0x599193[_0x24e3('0x13')](0x1f4,_0x268dc6[_0x24e3('0x15')]));});});};exports['UpdateVoiceDialReport']=function(_0x23ce5a){var _0x23af58=this;return new Promise(function(_0x3324a2,_0x344f86){return db[_0x24e3('0x1d')]['update'](_0x23ce5a['body'],{'raw':_0x23ce5a['options']?_0x23ce5a[_0x24e3('0x1a')][_0x24e3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23ce5a[_0x24e3('0x1a')]?_0x23ce5a[_0x24e3('0x1a')][_0x24e3('0x1e')]||null:null,'attributes':_0x23ce5a[_0x24e3('0x1a')]?_0x23ce5a[_0x24e3('0x1a')][_0x24e3('0x1f')]||null:null,'limit':_0x23ce5a['options']?_0x23ce5a[_0x24e3('0x1a')][_0x24e3('0x20')]||null:null})['then'](function(_0x2f5750){logger[_0x24e3('0xd')](_0x24e3('0x21'),_0x23ce5a);logger[_0x24e3('0x10')](_0x24e3('0x21'),_0x23ce5a,JSON[_0x24e3('0x12')](_0x2f5750));_0x3324a2(_0x2f5750);})[_0x24e3('0x17')](function(_0x3663db){logger[_0x24e3('0x13')]('UpdateVoiceDialReport',_0x3663db[_0x24e3('0x15')],_0x23ce5a);_0x344f86(_0x23af58[_0x24e3('0x13')](0x1f4,_0x3663db[_0x24e3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8f1c577..5833cfc 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 _0x062f=['/:id','show','create','post','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x4fac58,_0x213b99){var _0x10e5d1=function(_0x5d276f){while(--_0x5d276f){_0x4fac58['push'](_0x4fac58['shift']());}};_0x10e5d1(++_0x213b99);}(_0x062f,0xc7));var _0xf062=function(_0x15b932,_0x39ba3f){_0x15b932=_0x15b932-0x0;var _0x28fa64=_0x062f[_0x15b932];return _0x28fa64;};'use strict';var multer=require(_0xf062('0x0'));var util=require(_0xf062('0x1'));var path=require(_0xf062('0x2'));var timeout=require('connect-timeout');var express=require(_0xf062('0x3'));var router=express[_0xf062('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf062('0x5'));var config=require(_0xf062('0x6'));var controller=require(_0xf062('0x7'));router[_0xf062('0x8')]('/',auth[_0xf062('0x9')](),controller[_0xf062('0xa')]);router[_0xf062('0x8')](_0xf062('0xb'),auth['isAuthenticated'](),controller[_0xf062('0xc')]);router['post']('/',auth[_0xf062('0x9')](),controller[_0xf062('0xd')]);router[_0xf062('0xe')](_0xf062('0xf'),auth[_0xf062('0x9')](),controller[_0xf062('0x10')]);router[_0xf062('0x11')](_0xf062('0xb'),auth[_0xf062('0x9')](),controller['update']);router[_0xf062('0x12')](_0xf062('0xb'),auth[_0xf062('0x9')](),controller[_0xf062('0x13')]);module[_0xf062('0x14')]=router; \ No newline at end of file +var _0x1107=['post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show'];(function(_0x412668,_0x25beb1){var _0x140488=function(_0x5adce6){while(--_0x5adce6){_0x412668['push'](_0x412668['shift']());}};_0x140488(++_0x25beb1);}(_0x1107,0xd8));var _0x7110=function(_0x4f8cba,_0x51d42b){_0x4f8cba=_0x4f8cba-0x0;var _0xe240a6=_0x1107[_0x4f8cba];return _0xe240a6;};'use strict';var multer=require(_0x7110('0x0'));var util=require(_0x7110('0x1'));var path=require(_0x7110('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7110('0x3')]();var auth=require(_0x7110('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7110('0x5'));var controller=require(_0x7110('0x6'));router[_0x7110('0x7')]('/',auth[_0x7110('0x8')](),controller[_0x7110('0x9')]);router[_0x7110('0x7')](_0x7110('0xa'),auth[_0x7110('0x8')](),controller[_0x7110('0xb')]);router[_0x7110('0xc')]('/',auth[_0x7110('0x8')](),controller[_0x7110('0xd')]);router[_0x7110('0xc')]('/:id/applications',auth[_0x7110('0x8')](),controller['addApplications']);router[_0x7110('0xe')](_0x7110('0xa'),auth['isAuthenticated'](),controller[_0x7110('0xf')]);router[_0x7110('0x10')](_0x7110('0xa'),auth[_0x7110('0x8')](),controller[_0x7110('0x11')]);module[_0x7110('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 50638d7..fdf48b7 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x564928,_0x127b91){var _0x260072=function(_0x1e8430){while(--_0x1e8430){_0x564928['push'](_0x564928['shift']());}};_0x260072(++_0x127b91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1fa576,_0x1af040){var _0x413fe4=function(_0x1ba65d){while(--_0x1ba65d){_0x1fa576['push'](_0x1fa576['shift']());}};_0x413fe4(++_0x1af040);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 5dbe3cc..88eb4c1 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 _0x46b8=['redis','localhost','./voiceExtension.socket','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','value','includes','type','find','name','end','sendStatus','stack','send','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','create','body','startsWith','exten','concat','role','user','InboundRoutes','internal','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x46b8,0xbd));var _0x846b=function(_0x4a80d0,_0x444841){_0x4a80d0=_0x4a80d0-0x0;var _0x5ab3da=_0x46b8[_0x4a80d0];return _0x5ab3da;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x846b('0x0'));var rimraf=require(_0x846b('0x1'));var zipdir=require(_0x846b('0x2'));var jsonpatch=require(_0x846b('0x3'));var rp=require(_0x846b('0x4'));var moment=require(_0x846b('0x5'));var BPromise=require(_0x846b('0x6'));var Mustache=require(_0x846b('0x7'));var util=require(_0x846b('0x8'));var path=require('path');var sox=require(_0x846b('0x9'));var csv=require(_0x846b('0xa'));var ejs=require(_0x846b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x846b('0xc'));var crypto=require(_0x846b('0xd'));var jsforce=require(_0x846b('0xe'));var deskjs=require(_0x846b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x846b('0x10'));var Papa=require(_0x846b('0x11'));var Redis=require(_0x846b('0x12'));var authService=require(_0x846b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x846b('0x14'));var hardwareService=require(_0x846b('0x15'));var logger=require('../../config/logger')(_0x846b('0x16'));var utils=require(_0x846b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x846b('0x18'))['db'];config[_0x846b('0x19')]=_['defaults'](config[_0x846b('0x19')],{'host':_0x846b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x846b('0x1b'))['register'](socket);function respondWithStatusCode(_0x3f2a4c,_0x1e0986){_0x1e0986=_0x1e0986||0xcc;return function(_0x202fb4){if(_0x202fb4){return _0x3f2a4c['sendStatus'](_0x1e0986);}return _0x3f2a4c[_0x846b('0x1c')](_0x1e0986)['end']();};}function respondWithResult(_0x28cb40,_0x4a149c){_0x4a149c=_0x4a149c||0xc8;return function(_0x4beb3){if(_0x4beb3){return _0x28cb40[_0x846b('0x1c')](_0x4a149c)[_0x846b('0x1d')](_0x4beb3);}};}function respondWithFilteredResult(_0x57ac5a,_0x17273e){return function(_0x231998){if(_0x231998){var _0x1a2846=_0x231998['count'],_0x2f2ef3=_0x17273e[_0x846b('0x1e')],_0x341019=_0x17273e[_0x846b('0x1e')]+_0x17273e[_0x846b('0x1f')],_0x487658;if(_0x341019>=_0x1a2846){_0x341019=_0x1a2846;_0x487658=0xc8;}else{_0x487658=0xce;}_0x57ac5a['status'](_0x487658);return _0x57ac5a[_0x846b('0x20')](_0x846b('0x21'),_0x2f2ef3+'-'+_0x341019+'/'+_0x1a2846)[_0x846b('0x1d')](_0x231998);}return null;};}function patchUpdates(_0x5c6e82){return function(_0x26b878){try{jsonpatch[_0x846b('0x22')](_0x26b878,_0x5c6e82,!![]);}catch(_0x106a3b){return BPromise[_0x846b('0x23')](_0x106a3b);}return _0x26b878['save']();};}function saveUpdates(_0x1f5871,_0x29b33a){return function(_0x568eb7){if(_0x568eb7){return _0x568eb7[_0x846b('0x24')](_0x1f5871)['then'](function(_0x2f6643){return _0x2f6643;});}return null;};}function removeEntity(_0x4664a0,_0x1bf53a){return function(_0x365142){if(_0x365142){return _0x365142[_0x846b('0x25')]()[_0x846b('0x26')](function(){var _0x11f7de=_0x365142[_0x846b('0x27')]({'plain':!![]});var _0x4d3bca=[{'name':'InboundRoutes','value':_0x846b('0x28'),'ignore':![]},{'name':_0x846b('0x29'),'value':_0x846b('0x2a'),'ignore':![]},{'name':_0x846b('0x2b'),'value':'internal','ignore':![]}];var _0x254149=_(_0x4d3bca)[_0x846b('0x2c')](_0x846b('0x2d'))['map'](_0x846b('0x2e'))[_0x846b('0x2e')]();if(_[_0x846b('0x2f')](_0x254149,_0x11f7de[_0x846b('0x30')])){return;}var _0x20c2f9=_[_0x846b('0x31')](_0x4d3bca,['value',_0x11f7de[_0x846b('0x30')]])[_0x846b('0x32')];return db['UserProfileResource'][_0x846b('0x25')]({'where':{'type':_0x20c2f9,'resourceId':_0x11f7de['id']}})[_0x846b('0x26')](function(){return _0x365142;});})[_0x846b('0x26')](function(){_0x4664a0['status'](0xcc)[_0x846b('0x33')]();});}};}function handleEntityNotFound(_0x3b551b,_0x145834){return function(_0x12a269){if(!_0x12a269){_0x3b551b[_0x846b('0x34')](0x194);}return _0x12a269;};}function handleError(_0x289e21,_0x1c4232){_0x1c4232=_0x1c4232||0x1f4;return function(_0x3ee941){logger['error'](_0x3ee941[_0x846b('0x35')]);if(_0x3ee941[_0x846b('0x32')]){delete _0x3ee941[_0x846b('0x32')];}_0x289e21[_0x846b('0x1c')](_0x1c4232)[_0x846b('0x36')](_0x3ee941);};}exports[_0x846b('0x37')]=function(_0x2ad388,_0x5db52f){var _0x540369={},_0x235e27={},_0x1ca3e1={'count':0x0,'rows':[]};var _0x4028e3=_[_0x846b('0x38')](db[_0x846b('0x39')][_0x846b('0x3a')],function(_0x32e72c){return{'name':_0x32e72c[_0x846b('0x3b')],'type':_0x32e72c[_0x846b('0x30')][_0x846b('0x3c')]};});_0x235e27[_0x846b('0x3d')]=_[_0x846b('0x38')](_0x4028e3,_0x846b('0x32'));_0x235e27[_0x846b('0x3e')]=_[_0x846b('0x3f')](_0x2ad388[_0x846b('0x3e')]);_0x235e27['filters']=_['intersection'](_0x235e27[_0x846b('0x3d')],_0x235e27[_0x846b('0x3e')]);_0x540369[_0x846b('0x40')]=_[_0x846b('0x41')](_0x235e27[_0x846b('0x3d')],qs[_0x846b('0x42')](_0x2ad388[_0x846b('0x3e')][_0x846b('0x42')]));_0x540369[_0x846b('0x40')]=_0x540369['attributes'][_0x846b('0x43')]?_0x540369[_0x846b('0x40')]:_0x235e27[_0x846b('0x3d')];if(!_0x2ad388[_0x846b('0x3e')][_0x846b('0x44')](_0x846b('0x45'))){_0x540369['limit']=qs[_0x846b('0x1f')](_0x2ad388[_0x846b('0x3e')][_0x846b('0x1f')]);_0x540369[_0x846b('0x1e')]=qs['offset'](_0x2ad388[_0x846b('0x3e')]['offset']);}_0x540369[_0x846b('0x46')]=qs['sort'](_0x2ad388[_0x846b('0x3e')][_0x846b('0x47')]);_0x540369['where']=qs[_0x846b('0x48')](_[_0x846b('0x49')](_0x2ad388[_0x846b('0x3e')],_0x235e27['filters']),_0x4028e3);if(_0x2ad388[_0x846b('0x3e')]['filter']){_0x540369[_0x846b('0x4a')]=_[_0x846b('0x4b')](_0x540369[_0x846b('0x4a')],{'$or':_[_0x846b('0x38')](_0x4028e3,function(_0x12e543){if(_0x12e543[_0x846b('0x30')]!==_0x846b('0x4c')){var _0x592547={};_0x592547[_0x12e543['name']]={'$like':'%'+_0x2ad388[_0x846b('0x3e')]['filter']+'%'};return _0x592547;}})});}_0x540369=_[_0x846b('0x4b')]({},_0x540369,_0x2ad388[_0x846b('0x4d')]);var _0x1c1213={'where':_0x540369[_0x846b('0x4a')]};return db[_0x846b('0x39')][_0x846b('0x4e')](_0x1c1213)['then'](function(_0x1a4f31){_0x1ca3e1['count']=_0x1a4f31;if(_0x2ad388['query'][_0x846b('0x4f')]){_0x540369[_0x846b('0x50')]=[{'all':!![]}];}return db[_0x846b('0x39')]['findAll'](_0x540369);})[_0x846b('0x26')](function(_0x325eb4){_0x1ca3e1[_0x846b('0x51')]=_0x325eb4;return _0x1ca3e1;})[_0x846b('0x26')](respondWithFilteredResult(_0x5db52f,_0x540369))[_0x846b('0x52')](handleError(_0x5db52f,null));};exports[_0x846b('0x53')]=function(_0x3e58a4,_0x255aa7){var _0x38fdb0={'raw':![],'where':{'id':_0x3e58a4[_0x846b('0x54')]['id']}},_0x1367b7={};_0x1367b7['model']=_['keys'](db[_0x846b('0x39')]['rawAttributes']);_0x1367b7[_0x846b('0x3e')]=_['keys'](_0x3e58a4[_0x846b('0x3e')]);_0x1367b7[_0x846b('0x48')]=_[_0x846b('0x41')](_0x1367b7['model'],_0x1367b7[_0x846b('0x3e')]);_0x38fdb0[_0x846b('0x40')]=_[_0x846b('0x41')](_0x1367b7[_0x846b('0x3d')],qs[_0x846b('0x42')](_0x3e58a4[_0x846b('0x3e')][_0x846b('0x42')]));_0x38fdb0['attributes']=_0x38fdb0[_0x846b('0x40')]['length']?_0x38fdb0['attributes']:_0x1367b7[_0x846b('0x3d')];if(_0x3e58a4[_0x846b('0x3e')][_0x846b('0x4f')]){_0x38fdb0[_0x846b('0x50')]=[{'all':!![]}];}_0x38fdb0=_[_0x846b('0x4b')]({},_0x38fdb0,_0x3e58a4[_0x846b('0x4d')]);return db[_0x846b('0x39')][_0x846b('0x31')](_0x38fdb0)[_0x846b('0x26')](handleEntityNotFound(_0x255aa7,null))[_0x846b('0x26')](respondWithResult(_0x255aa7,null))[_0x846b('0x52')](handleError(_0x255aa7,null));};exports[_0x846b('0x25')]=function(_0x5df46c,_0xfba0b8){return db[_0x846b('0x39')][_0x846b('0x31')]({'where':{'id':_0x5df46c[_0x846b('0x54')]['id']}})['then'](handleEntityNotFound(_0xfba0b8,null))['then'](removeEntity(_0xfba0b8,null))[_0x846b('0x52')](handleError(_0xfba0b8,null));};exports[_0x846b('0x55')]=function(_0x34f36e,_0x1ce5fc){if(_0x34f36e[_0x846b('0x56')][_0x846b('0x30')]==='outbound'&&!_[_0x846b('0x57')](_0x34f36e['body'][_0x846b('0x58')],'_')){_0x34f36e[_0x846b('0x56')][_0x846b('0x58')]='_'[_0x846b('0x59')](_0x34f36e[_0x846b('0x56')][_0x846b('0x58')]);}return db[_0x846b('0x39')][_0x846b('0x55')](_0x34f36e[_0x846b('0x56')],{'raw':![]})[_0x846b('0x26')](function(_0x10f5d0){var _0x95b3ea=_0x34f36e['user']['get']({'plain':!![]});if(!_0x95b3ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x95b3ea[_0x846b('0x5a')]===_0x846b('0x5b')){var _0x57e4d2=_0x10f5d0['get']({'plain':!![]});var _0x43338d=[{'name':_0x846b('0x5c'),'value':_0x846b('0x28')},{'name':_0x846b('0x29'),'value':_0x846b('0x2a')},{'name':_0x846b('0x2b'),'value':_0x846b('0x5d')}];var _0x2ab567=_[_0x846b('0x31')](_0x43338d,['value',_0x57e4d2[_0x846b('0x30')]])[_0x846b('0x32')];return db[_0x846b('0x5e')][_0x846b('0x31')]({'where':{'name':_0x2ab567,'userProfileId':_0x95b3ea[_0x846b('0x5f')]},'raw':!![]})[_0x846b('0x26')](function(_0x37d2ab){if(_0x37d2ab&&_0x37d2ab[_0x846b('0x60')]===0x0){return db['UserProfileResource'][_0x846b('0x55')]({'name':_0x57e4d2[_0x846b('0x32')],'resourceId':_0x57e4d2['id'],'type':_0x37d2ab[_0x846b('0x32')],'sectionId':_0x37d2ab['id']},{})[_0x846b('0x26')](function(){return _0x10f5d0;});}else{return _0x10f5d0;}})[_0x846b('0x52')](function(_0x52d926){logger[_0x846b('0x61')](_0x846b('0x62'),_0x52d926);throw _0x52d926;});}return _0x10f5d0;})['then'](respondWithResult(_0x1ce5fc,0xc9))['catch'](handleError(_0x1ce5fc,null));};exports[_0x846b('0x24')]=function(_0x2e31b1,_0x16b314){if(_0x2e31b1[_0x846b('0x56')]['id']){delete _0x2e31b1[_0x846b('0x56')]['id'];}return db[_0x846b('0x39')][_0x846b('0x31')]({'where':{'id':_0x2e31b1[_0x846b('0x54')]['id']}})[_0x846b('0x26')](handleEntityNotFound(_0x16b314,null))[_0x846b('0x26')](function(_0x1a6f8d){if(_0x1a6f8d){return db[_0x846b('0x39')][_0x846b('0x24')](_[_0x846b('0x49')](_0x2e31b1['body'],[_0x846b('0x58'),_0x846b('0x63'),_0x846b('0x64'),_0x846b('0x65'),'cutdigits','mandatoryDisposition']),{'where':{'context':_0x1a6f8d[_0x846b('0x63')],'exten':_0x1a6f8d[_0x846b('0x58')]},'individualHooks':!![]})[_0x846b('0x26')](function(_0x20dc7b){return _0x20dc7b;});}return null;})['then'](respondWithStatusCode(_0x16b314,null))[_0x846b('0x52')](handleError(_0x16b314,null));};exports['addApplications']=function(_0x390052,_0x2b6d03,_0x10ea6d){return db[_0x846b('0x39')]['findOne']({'where':{'id':_0x390052[_0x846b('0x54')]['id']}})[_0x846b('0x26')](handleEntityNotFound(_0x2b6d03,null))[_0x846b('0x26')](function(_0x464f30){if(_0x464f30){return db['sequelize'][_0x846b('0x66')](function(_0x424287){return db[_0x846b('0x39')]['destroy']({'where':{'VoiceExtensionId':_0x390052['params']['id']},'transaction':_0x424287})[_0x846b('0x26')](function(_0x403cb7){var _0x24c928=_[_0x846b('0x38')](_0x390052[_0x846b('0x56')],function(_0x5f5850){_0x5f5850[_0x846b('0x67')]=_0x390052[_0x846b('0x54')]['id'];return _0x5f5850;});return db[_0x846b('0x39')][_0x846b('0x68')](_0x24c928,{'transaction':_0x424287});});})['then'](function(){return db[_0x846b('0x39')][_0x846b('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0x390052[_0x846b('0x54')]['id']},'order':_0x846b('0x6a')});});}})[_0x846b('0x26')](respondWithResult(_0x2b6d03,null))[_0x846b('0x52')](handleError(_0x2b6d03,null));}; \ No newline at end of file +var _0x90bc=['bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','name','UserProfileResource','error','stack','send','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','params','create','startsWith','body','exten','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','transaction'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x90bc,0xd1));var _0xc90b=function(_0x2d5b09,_0x3cdc73){_0x2d5b09=_0x2d5b09-0x0;var _0x3e106b=_0x90bc[_0x2d5b09];return _0x3e106b;};'use strict';var pdf=require(_0xc90b('0x0'));var emlformat=require(_0xc90b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc90b('0x2'));var jsonpatch=require(_0xc90b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc90b('0x4'));var Mustache=require(_0xc90b('0x5'));var util=require('util');var path=require(_0xc90b('0x6'));var sox=require('sox');var csv=require(_0xc90b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc90b('0x8'));var squel=require(_0xc90b('0x9'));var crypto=require(_0xc90b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc90b('0x7'));var querystring=require(_0xc90b('0xb'));var Papa=require(_0xc90b('0xc'));var Redis=require(_0xc90b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc90b('0xe'));var hardwareService=require(_0xc90b('0xf'));var logger=require(_0xc90b('0x10'))(_0xc90b('0x11'));var utils=require('../../config/utils');var config=require(_0xc90b('0x12'));var licenseUtil=require(_0xc90b('0x13'));var db=require(_0xc90b('0x14'))['db'];config[_0xc90b('0x15')]=_[_0xc90b('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc90b('0x17'))(new Redis(config[_0xc90b('0x15')]));require(_0xc90b('0x18'))['register'](socket);function respondWithStatusCode(_0xbc22bc,_0x572267){_0x572267=_0x572267||0xcc;return function(_0x4cd446){if(_0x4cd446){return _0xbc22bc[_0xc90b('0x19')](_0x572267);}return _0xbc22bc[_0xc90b('0x1a')](_0x572267)[_0xc90b('0x1b')]();};}function respondWithResult(_0x5807e1,_0x253bda){_0x253bda=_0x253bda||0xc8;return function(_0x53b662){if(_0x53b662){return _0x5807e1[_0xc90b('0x1a')](_0x253bda)[_0xc90b('0x1c')](_0x53b662);}};}function respondWithFilteredResult(_0x3de476,_0x31661){return function(_0x913d8f){if(_0x913d8f){var _0x5caaa0=_0x913d8f[_0xc90b('0x1d')],_0x129ebf=_0x31661['offset'],_0x1a3452=_0x31661[_0xc90b('0x1e')]+_0x31661[_0xc90b('0x1f')],_0x12aed3;if(_0x1a3452>=_0x5caaa0){_0x1a3452=_0x5caaa0;_0x12aed3=0xc8;}else{_0x12aed3=0xce;}_0x3de476['status'](_0x12aed3);return _0x3de476[_0xc90b('0x20')](_0xc90b('0x21'),_0x129ebf+'-'+_0x1a3452+'/'+_0x5caaa0)['json'](_0x913d8f);}return null;};}function patchUpdates(_0xc2367b){return function(_0x237348){try{jsonpatch['apply'](_0x237348,_0xc2367b,!![]);}catch(_0x28cd7b){return BPromise[_0xc90b('0x22')](_0x28cd7b);}return _0x237348[_0xc90b('0x23')]();};}function saveUpdates(_0x112147,_0x3491e9){return function(_0x1bd532){if(_0x1bd532){return _0x1bd532[_0xc90b('0x24')](_0x112147)[_0xc90b('0x25')](function(_0x1c152d){return _0x1c152d;});}return null;};}function removeEntity(_0x23b147,_0x34fd23){return function(_0x38f25e){if(_0x38f25e){return _0x38f25e[_0xc90b('0x26')]()[_0xc90b('0x25')](function(){var _0x1abeb1=_0x38f25e['get']({'plain':!![]});var _0x233e02=[{'name':_0xc90b('0x27'),'value':_0xc90b('0x28'),'ignore':![]},{'name':_0xc90b('0x29'),'value':_0xc90b('0x2a'),'ignore':![]},{'name':_0xc90b('0x2b'),'value':_0xc90b('0x2c'),'ignore':![]}];var _0x115a71=_(_0x233e02)[_0xc90b('0x2d')](_0xc90b('0x2e'))[_0xc90b('0x2f')](_0xc90b('0x30'))[_0xc90b('0x30')]();if(_['includes'](_0x115a71,_0x1abeb1['type'])){return;}var _0xb4652b=_[_0xc90b('0x31')](_0x233e02,[_0xc90b('0x30'),_0x1abeb1['type']])[_0xc90b('0x32')];return db[_0xc90b('0x33')]['destroy']({'where':{'type':_0xb4652b,'resourceId':_0x1abeb1['id']}})[_0xc90b('0x25')](function(){return _0x38f25e;});})[_0xc90b('0x25')](function(){_0x23b147['status'](0xcc)[_0xc90b('0x1b')]();});}};}function handleEntityNotFound(_0xe5f1a8,_0x5e3198){return function(_0x3bae89){if(!_0x3bae89){_0xe5f1a8[_0xc90b('0x19')](0x194);}return _0x3bae89;};}function handleError(_0x2ee6d4,_0x4fc518){_0x4fc518=_0x4fc518||0x1f4;return function(_0x38e10f){logger[_0xc90b('0x34')](_0x38e10f[_0xc90b('0x35')]);if(_0x38e10f[_0xc90b('0x32')]){delete _0x38e10f[_0xc90b('0x32')];}_0x2ee6d4[_0xc90b('0x1a')](_0x4fc518)[_0xc90b('0x36')](_0x38e10f);};}exports['index']=function(_0x336c6a,_0x1824d9){var _0x45616c={},_0x19d215={},_0x20987a={'count':0x0,'rows':[]};var _0x50ae84=_[_0xc90b('0x2f')](db['VoiceExtension'][_0xc90b('0x37')],function(_0x273c13){return{'name':_0x273c13[_0xc90b('0x38')],'type':_0x273c13[_0xc90b('0x39')]['key']};});_0x19d215[_0xc90b('0x3a')]=_[_0xc90b('0x2f')](_0x50ae84,_0xc90b('0x32'));_0x19d215[_0xc90b('0x3b')]=_[_0xc90b('0x3c')](_0x336c6a['query']);_0x19d215[_0xc90b('0x3d')]=_[_0xc90b('0x3e')](_0x19d215[_0xc90b('0x3a')],_0x19d215[_0xc90b('0x3b')]);_0x45616c[_0xc90b('0x3f')]=_[_0xc90b('0x3e')](_0x19d215[_0xc90b('0x3a')],qs[_0xc90b('0x40')](_0x336c6a[_0xc90b('0x3b')][_0xc90b('0x40')]));_0x45616c[_0xc90b('0x3f')]=_0x45616c[_0xc90b('0x3f')][_0xc90b('0x41')]?_0x45616c[_0xc90b('0x3f')]:_0x19d215[_0xc90b('0x3a')];if(!_0x336c6a[_0xc90b('0x3b')][_0xc90b('0x42')](_0xc90b('0x43'))){_0x45616c[_0xc90b('0x1f')]=qs[_0xc90b('0x1f')](_0x336c6a[_0xc90b('0x3b')][_0xc90b('0x1f')]);_0x45616c[_0xc90b('0x1e')]=qs[_0xc90b('0x1e')](_0x336c6a[_0xc90b('0x3b')]['offset']);}_0x45616c[_0xc90b('0x44')]=qs[_0xc90b('0x45')](_0x336c6a[_0xc90b('0x3b')]['sort']);_0x45616c[_0xc90b('0x46')]=qs[_0xc90b('0x3d')](_[_0xc90b('0x47')](_0x336c6a[_0xc90b('0x3b')],_0x19d215['filters']),_0x50ae84);if(_0x336c6a[_0xc90b('0x3b')][_0xc90b('0x2d')]){_0x45616c['where']=_[_0xc90b('0x48')](_0x45616c[_0xc90b('0x46')],{'$or':_[_0xc90b('0x2f')](_0x50ae84,function(_0x405663){if(_0x405663[_0xc90b('0x39')]!==_0xc90b('0x49')){var _0x57b05a={};_0x57b05a[_0x405663[_0xc90b('0x32')]]={'$like':'%'+_0x336c6a[_0xc90b('0x3b')][_0xc90b('0x2d')]+'%'};return _0x57b05a;}})});}_0x45616c=_[_0xc90b('0x48')]({},_0x45616c,_0x336c6a[_0xc90b('0x4a')]);var _0x1d1ed4={'where':_0x45616c[_0xc90b('0x46')]};return db[_0xc90b('0x4b')][_0xc90b('0x1d')](_0x1d1ed4)[_0xc90b('0x25')](function(_0x366e9c){_0x20987a['count']=_0x366e9c;if(_0x336c6a[_0xc90b('0x3b')][_0xc90b('0x4c')]){_0x45616c[_0xc90b('0x4d')]=[{'all':!![]}];}return db['VoiceExtension'][_0xc90b('0x4e')](_0x45616c);})[_0xc90b('0x25')](function(_0x27371e){_0x20987a[_0xc90b('0x4f')]=_0x27371e;return _0x20987a;})[_0xc90b('0x25')](respondWithFilteredResult(_0x1824d9,_0x45616c))[_0xc90b('0x50')](handleError(_0x1824d9,null));};exports['show']=function(_0x484012,_0x18aea0){var _0x5b3c42={'raw':![],'where':{'id':_0x484012['params']['id']}},_0x4c9a85={};_0x4c9a85[_0xc90b('0x3a')]=_[_0xc90b('0x3c')](db[_0xc90b('0x4b')]['rawAttributes']);_0x4c9a85[_0xc90b('0x3b')]=_[_0xc90b('0x3c')](_0x484012[_0xc90b('0x3b')]);_0x4c9a85[_0xc90b('0x3d')]=_['intersection'](_0x4c9a85[_0xc90b('0x3a')],_0x4c9a85[_0xc90b('0x3b')]);_0x5b3c42[_0xc90b('0x3f')]=_[_0xc90b('0x3e')](_0x4c9a85[_0xc90b('0x3a')],qs['fields'](_0x484012[_0xc90b('0x3b')]['fields']));_0x5b3c42[_0xc90b('0x3f')]=_0x5b3c42[_0xc90b('0x3f')][_0xc90b('0x41')]?_0x5b3c42[_0xc90b('0x3f')]:_0x4c9a85['model'];if(_0x484012[_0xc90b('0x3b')][_0xc90b('0x4c')]){_0x5b3c42['include']=[{'all':!![]}];}_0x5b3c42=_['merge']({},_0x5b3c42,_0x484012['options']);return db[_0xc90b('0x4b')]['find'](_0x5b3c42)['then'](handleEntityNotFound(_0x18aea0,null))[_0xc90b('0x25')](respondWithResult(_0x18aea0,null))[_0xc90b('0x50')](handleError(_0x18aea0,null));};exports[_0xc90b('0x26')]=function(_0x5b2fe7,_0x23adea){return db[_0xc90b('0x4b')][_0xc90b('0x31')]({'where':{'id':_0x5b2fe7[_0xc90b('0x51')]['id']}})[_0xc90b('0x25')](handleEntityNotFound(_0x23adea,null))[_0xc90b('0x25')](removeEntity(_0x23adea,null))['catch'](handleError(_0x23adea,null));};exports[_0xc90b('0x52')]=function(_0x833599,_0xb39eb3){if(_0x833599['body'][_0xc90b('0x39')]===_0xc90b('0x2a')&&!_[_0xc90b('0x53')](_0x833599[_0xc90b('0x54')]['exten'],'_')){_0x833599[_0xc90b('0x54')][_0xc90b('0x55')]='_'['concat'](_0x833599[_0xc90b('0x54')][_0xc90b('0x55')]);}return db[_0xc90b('0x4b')][_0xc90b('0x52')](_0x833599[_0xc90b('0x54')],{'raw':![]})[_0xc90b('0x25')](function(_0x46f10b){var _0x1aee2c=_0x833599[_0xc90b('0x56')]['get']({'plain':!![]});if(!_0x1aee2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aee2c[_0xc90b('0x57')]===_0xc90b('0x56')){var _0x2bcbdb=_0x46f10b[_0xc90b('0x58')]({'plain':!![]});var _0x581c58=[{'name':_0xc90b('0x27'),'value':'inbound'},{'name':_0xc90b('0x29'),'value':_0xc90b('0x2a')},{'name':'InternalRoutes','value':_0xc90b('0x2c')}];var _0x5e5f64=_[_0xc90b('0x31')](_0x581c58,[_0xc90b('0x30'),_0x2bcbdb[_0xc90b('0x39')]])['name'];return db[_0xc90b('0x59')][_0xc90b('0x31')]({'where':{'name':_0x5e5f64,'userProfileId':_0x1aee2c[_0xc90b('0x5a')]},'raw':!![]})[_0xc90b('0x25')](function(_0x24f2c8){if(_0x24f2c8&&_0x24f2c8[_0xc90b('0x5b')]===0x0){return db[_0xc90b('0x33')][_0xc90b('0x52')]({'name':_0x2bcbdb[_0xc90b('0x32')],'resourceId':_0x2bcbdb['id'],'type':_0x24f2c8[_0xc90b('0x32')],'sectionId':_0x24f2c8['id']},{})['then'](function(){return _0x46f10b;});}else{return _0x46f10b;}})[_0xc90b('0x50')](function(_0x313943){logger[_0xc90b('0x34')](_0xc90b('0x5c'),_0x313943);throw _0x313943;});}return _0x46f10b;})[_0xc90b('0x25')](respondWithResult(_0xb39eb3,0xc9))[_0xc90b('0x50')](handleError(_0xb39eb3,null));};exports[_0xc90b('0x24')]=function(_0x23f728,_0x2bee24){if(_0x23f728[_0xc90b('0x54')]['id']){delete _0x23f728['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x23f728[_0xc90b('0x51')]['id']}})[_0xc90b('0x25')](handleEntityNotFound(_0x2bee24,null))['then'](function(_0x457b48){if(_0x457b48){return db[_0xc90b('0x4b')][_0xc90b('0x24')](_['pick'](_0x23f728['body'],['exten',_0xc90b('0x5d'),_0xc90b('0x5e'),_0xc90b('0x5f'),'cutdigits',_0xc90b('0x60')]),{'where':{'context':_0x457b48[_0xc90b('0x5d')],'exten':_0x457b48['exten']},'individualHooks':!![]})['then'](function(_0x7323cb){return _0x7323cb;});}return null;})['then'](respondWithStatusCode(_0x2bee24,null))[_0xc90b('0x50')](handleError(_0x2bee24,null));};exports[_0xc90b('0x61')]=function(_0x2c8384,_0x10bb1e,_0x229832){return db[_0xc90b('0x4b')][_0xc90b('0x62')]({'where':{'id':_0x2c8384['params']['id']}})['then'](handleEntityNotFound(_0x10bb1e,null))['then'](function(_0x2c6048){if(_0x2c6048){return db['sequelize'][_0xc90b('0x63')](function(_0xfa02b7){return db[_0xc90b('0x4b')][_0xc90b('0x26')]({'where':{'VoiceExtensionId':_0x2c8384[_0xc90b('0x51')]['id']},'transaction':_0xfa02b7})['then'](function(_0x9a368e){var _0x2e0d58=_[_0xc90b('0x2f')](_0x2c8384[_0xc90b('0x54')],function(_0x3a7ea3){_0x3a7ea3['VoiceExtensionId']=_0x2c8384[_0xc90b('0x51')]['id'];return _0x3a7ea3;});return db[_0xc90b('0x4b')][_0xc90b('0x64')](_0x2e0d58,{'transaction':_0xfa02b7});});})[_0xc90b('0x25')](function(){return db[_0xc90b('0x4b')][_0xc90b('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c8384[_0xc90b('0x51')]['id']},'order':_0xc90b('0x66')});});}})[_0xc90b('0x25')](respondWithResult(_0x10bb1e,null))[_0xc90b('0x50')](handleError(_0x10bb1e,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cf8200d..0621b2f 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 _0x95e4=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x95e4,0xb1));var _0x495e=function(_0x307f7b,_0x284469){_0x307f7b=_0x307f7b-0x0;var _0xcdc4fa=_0x95e4[_0x307f7b];return _0xcdc4fa;};'use strict';var EventEmitter=require(_0x495e('0x0'));var VoiceExtension=require(_0x495e('0x1'))['db'][_0x495e('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x495e('0x3')](0x0);var events={'afterCreate':_0x495e('0x4'),'afterUpdate':_0x495e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10c22a){return function(_0x2c5b9e,_0x5b513c,_0x9150b9){VoiceExtensionEvents[_0x495e('0x6')](_0x10c22a+':'+_0x2c5b9e['id'],_0x2c5b9e);VoiceExtensionEvents[_0x495e('0x6')](_0x10c22a,_0x2c5b9e);_0x9150b9(null);};}for(var e in events){if(events[_0x495e('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x495e('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x4fc6=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fc6,0x184));var _0x64fc=function(_0x3bdc1e,_0xca6195){_0x3bdc1e=_0x3bdc1e-0x0;var _0x272c5c=_0x4fc6[_0x3bdc1e];return _0x272c5c;};'use strict';var EventEmitter=require(_0x64fc('0x0'));var VoiceExtension=require(_0x64fc('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x64fc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x64fc('0x3'),'afterDestroy':_0x64fc('0x4')};function emitEvent(_0x463701){return function(_0x3e4ee3,_0x1ab627,_0x15b2fe){VoiceExtensionEvents[_0x64fc('0x5')](_0x463701+':'+_0x3e4ee3['id'],_0x3e4ee3);VoiceExtensionEvents[_0x64fc('0x5')](_0x463701,_0x3e4ee3);_0x15b2fe(null);};}for(var e in events){if(events[_0x64fc('0x6')](e)){var event=events[e];VoiceExtension[_0x64fc('0x7')](e,emitEvent(event));}}module[_0x64fc('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 dbc415c..69b4032 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 _0x911a=['exports','define','VoiceExtension','voice_extensions','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x911a,0xf4));var _0xa911=function(_0x45e92f,_0x1043bc){_0x45e92f=_0x45e92f-0x0;var _0x179a3e=_0x911a[_0x45e92f];return _0x179a3e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa911('0x0'));var BPromise=require(_0xa911('0x1'));var rp=require(_0xa911('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa911('0x3'));var config=require(_0xa911('0x4'));var attributes=require(_0xa911('0x5'));module[_0xa911('0x6')]=function(_0x4d6aba,_0x7ee515){return _0x4d6aba[_0xa911('0x7')](_0xa911('0x8'),attributes,{'tableName':_0xa911('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d45=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','lodash','util','../../config/logger'];(function(_0x2908d0,_0x17728a){var _0x2b6f05=function(_0x48bd00){while(--_0x48bd00){_0x2908d0['push'](_0x2908d0['shift']());}};_0x2b6f05(++_0x17728a);}(_0x7d45,0x147));var _0x57d4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7d45[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x57d4('0x0'));var util=require(_0x57d4('0x1'));var logger=require(_0x57d4('0x2'))('api');var moment=require(_0x57d4('0x3'));var BPromise=require(_0x57d4('0x4'));var rp=require(_0x57d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57d4('0x6'));var config=require(_0x57d4('0x7'));var attributes=require(_0x57d4('0x8'));module['exports']=function(_0x5888e9,_0xdd3702){return _0x5888e9[_0x57d4('0x9')](_0x57d4('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 413f03f..b9b9679 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 _0xb309=['GetVoiceExtension','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceExtension.socket','register','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x23dcf1,_0x4a56b4){var _0x53d91a=function(_0x533abf){while(--_0x533abf){_0x23dcf1['push'](_0x23dcf1['shift']());}};_0x53d91a(++_0x4a56b4);}(_0xb309,0x96));var _0x9b30=function(_0x2696ec,_0x11a87f){_0x2696ec=_0x2696ec-0x0;var _0x1af23a=_0xb309[_0x2696ec];return _0x1af23a;};'use strict';var _=require(_0x9b30('0x0'));var util=require('util');var moment=require(_0x9b30('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b30('0x3'))['db'];var utils=require(_0x9b30('0x4'));var logger=require(_0x9b30('0x5'))(_0x9b30('0x6'));var config=require(_0x9b30('0x7'));var jayson=require(_0x9b30('0x8'));var client=jayson['client'][_0x9b30('0x9')]({'port':0x232a});config[_0x9b30('0xa')]=_[_0x9b30('0xb')](config[_0x9b30('0xa')],{'host':_0x9b30('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b30('0xa')]));require(_0x9b30('0xd'))[_0x9b30('0xe')](socket);function respondWithRpcPromise(_0x30033f,_0x6f0fd8,_0x4aaf20){return new BPromise(function(_0x131bef,_0x1bff33){return client['request'](_0x30033f,_0x4aaf20)['then'](function(_0x175ac2){logger[_0x9b30('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x6f0fd8,'request\x20sent');logger[_0x9b30('0x10')](_0x9b30('0x11'),_0x6f0fd8,_0x9b30('0x12'),JSON['stringify'](_0x175ac2));if(_0x175ac2[_0x9b30('0x13')]){if(_0x175ac2[_0x9b30('0x13')][_0x9b30('0x14')]===0x1f4){logger[_0x9b30('0x13')](_0x9b30('0x15'),_0x6f0fd8,_0x175ac2['error'][_0x9b30('0x16')]);return _0x1bff33(_0x175ac2[_0x9b30('0x13')][_0x9b30('0x16')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x6f0fd8,_0x175ac2['error'][_0x9b30('0x16')]);return _0x131bef(_0x175ac2[_0x9b30('0x13')][_0x9b30('0x16')]);}else{logger[_0x9b30('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x6f0fd8,'request\x20sent');_0x131bef(_0x175ac2[_0x9b30('0x17')]['message']);}})[_0x9b30('0x18')](function(_0x2a7836){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x6f0fd8,_0x2a7836);_0x1bff33(_0x2a7836);});});}exports['GetVoiceExtension']=function(_0x2edd30){var _0xa54cd2=this;return new Promise(function(_0x361b3e,_0x3c82c5){return db[_0x9b30('0x19')]['findAll']({'raw':_0x2edd30[_0x9b30('0x1a')]?_0x2edd30[_0x9b30('0x1a')][_0x9b30('0x1b')]===undefined?!![]:![]:!![],'where':_0x2edd30[_0x9b30('0x1a')]?_0x2edd30[_0x9b30('0x1a')][_0x9b30('0x1c')]||null:null,'attributes':_0x2edd30[_0x9b30('0x1a')]?_0x2edd30[_0x9b30('0x1a')][_0x9b30('0x1d')]||null:null,'limit':_0x2edd30[_0x9b30('0x1a')]?_0x2edd30['options'][_0x9b30('0x1e')]||null:null,'include':_0x2edd30[_0x9b30('0x1a')]?_0x2edd30['options'][_0x9b30('0x1f')]?_[_0x9b30('0x20')](_0x2edd30[_0x9b30('0x1a')]['include'],function(_0x109e01){return{'model':db[_0x109e01[_0x9b30('0x21')]],'as':_0x109e01['as'],'attributes':_0x109e01[_0x9b30('0x1d')],'include':_0x109e01[_0x9b30('0x1f')]?_[_0x9b30('0x20')](_0x109e01[_0x9b30('0x1f')],function(_0x5e3cb0){return{'model':db[_0x5e3cb0[_0x9b30('0x21')]],'as':_0x5e3cb0['as'],'attributes':_0x5e3cb0['attributes'],'include':_0x5e3cb0[_0x9b30('0x1f')]?_[_0x9b30('0x20')](_0x5e3cb0[_0x9b30('0x1f')],function(_0x4eab9c){return{'model':db[_0x4eab9c[_0x9b30('0x21')]],'as':_0x4eab9c['as'],'attributes':_0x4eab9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b30('0x22')](function(_0x3b9e30){logger[_0x9b30('0xf')](_0x9b30('0x23'),_0x2edd30);logger[_0x9b30('0x10')](_0x9b30('0x23'),_0x2edd30,JSON[_0x9b30('0x24')](_0x3b9e30));_0x361b3e(_0x3b9e30);})[_0x9b30('0x18')](function(_0x68b4a7){logger['error']('GetVoiceExtension',_0x68b4a7[_0x9b30('0x16')],_0x2edd30);_0x3c82c5(_0xa54cd2[_0x9b30('0x13')](0x1f4,_0x68b4a7[_0x9b30('0x16')]));});});}; \ No newline at end of file +var _0xc3c4=['map','model','GetVoiceExtension','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','options','raw','where','limit','include'];(function(_0x5c9f12,_0x571ec8){var _0x37ba21=function(_0x1592a7){while(--_0x1592a7){_0x5c9f12['push'](_0x5c9f12['shift']());}};_0x37ba21(++_0x571ec8);}(_0xc3c4,0xdb));var _0x4c3c=function(_0x752d9f,_0x58a684){_0x752d9f=_0x752d9f-0x0;var _0x56c1cf=_0xc3c4[_0x752d9f];return _0x56c1cf;};'use strict';var _=require(_0x4c3c('0x0'));var util=require(_0x4c3c('0x1'));var moment=require(_0x4c3c('0x2'));var BPromise=require(_0x4c3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c3c('0x4'));var db=require(_0x4c3c('0x5'))['db'];var utils=require(_0x4c3c('0x6'));var logger=require('../../config/logger')(_0x4c3c('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c3c('0x8'));var client=jayson[_0x4c3c('0x9')]['http']({'port':0x232a});config[_0x4c3c('0xa')]=_['defaults'](config[_0x4c3c('0xa')],{'host':_0x4c3c('0xb'),'port':0x18eb});var socket=require(_0x4c3c('0xc'))(new Redis(config[_0x4c3c('0xa')]));require(_0x4c3c('0xd'))[_0x4c3c('0xe')](socket);function respondWithRpcPromise(_0x5518e6,_0x561e49,_0x44c893){return new BPromise(function(_0x48c01d,_0x151e5b){return client[_0x4c3c('0xf')](_0x5518e6,_0x44c893)[_0x4c3c('0x10')](function(_0x2da4c2){logger[_0x4c3c('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x561e49,'request\x20sent');logger[_0x4c3c('0x12')](_0x4c3c('0x13'),_0x561e49,_0x4c3c('0x14'),JSON['stringify'](_0x2da4c2));if(_0x2da4c2[_0x4c3c('0x15')]){if(_0x2da4c2[_0x4c3c('0x15')][_0x4c3c('0x16')]===0x1f4){logger[_0x4c3c('0x15')](_0x4c3c('0x17'),_0x561e49,_0x2da4c2['error'][_0x4c3c('0x18')]);return _0x151e5b(_0x2da4c2[_0x4c3c('0x15')]['message']);}logger[_0x4c3c('0x15')](_0x4c3c('0x17'),_0x561e49,_0x2da4c2[_0x4c3c('0x15')]['message']);return _0x48c01d(_0x2da4c2[_0x4c3c('0x15')][_0x4c3c('0x18')]);}else{logger['info'](_0x4c3c('0x17'),_0x561e49,_0x4c3c('0x14'));_0x48c01d(_0x2da4c2[_0x4c3c('0x19')][_0x4c3c('0x18')]);}})[_0x4c3c('0x1a')](function(_0x72f6cb){logger['error'](_0x4c3c('0x17'),_0x561e49,_0x72f6cb);_0x151e5b(_0x72f6cb);});});}exports['GetVoiceExtension']=function(_0x357d52){var _0x4cd37e=this;return new Promise(function(_0x26c44a,_0x2f5751){return db[_0x4c3c('0x1b')]['findAll']({'raw':_0x357d52['options']?_0x357d52[_0x4c3c('0x1c')][_0x4c3c('0x1d')]===undefined?!![]:![]:!![],'where':_0x357d52[_0x4c3c('0x1c')]?_0x357d52['options'][_0x4c3c('0x1e')]||null:null,'attributes':_0x357d52[_0x4c3c('0x1c')]?_0x357d52[_0x4c3c('0x1c')]['attributes']||null:null,'limit':_0x357d52[_0x4c3c('0x1c')]?_0x357d52[_0x4c3c('0x1c')][_0x4c3c('0x1f')]||null:null,'include':_0x357d52[_0x4c3c('0x1c')]?_0x357d52[_0x4c3c('0x1c')][_0x4c3c('0x20')]?_[_0x4c3c('0x21')](_0x357d52['options']['include'],function(_0x3648d7){return{'model':db[_0x3648d7[_0x4c3c('0x22')]],'as':_0x3648d7['as'],'attributes':_0x3648d7['attributes'],'include':_0x3648d7[_0x4c3c('0x20')]?_[_0x4c3c('0x21')](_0x3648d7['include'],function(_0x28fad4){return{'model':db[_0x28fad4[_0x4c3c('0x22')]],'as':_0x28fad4['as'],'attributes':_0x28fad4['attributes'],'include':_0x28fad4[_0x4c3c('0x20')]?_[_0x4c3c('0x21')](_0x28fad4[_0x4c3c('0x20')],function(_0x11e461){return{'model':db[_0x11e461[_0x4c3c('0x22')]],'as':_0x11e461['as'],'attributes':_0x11e461['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a6f7f){logger[_0x4c3c('0x11')](_0x4c3c('0x23'),_0x357d52);logger[_0x4c3c('0x12')]('GetVoiceExtension',_0x357d52,JSON['stringify'](_0x2a6f7f));_0x26c44a(_0x2a6f7f);})[_0x4c3c('0x1a')](function(_0x245963){logger['error']('GetVoiceExtension',_0x245963[_0x4c3c('0x18')],_0x357d52);_0x2f5751(_0x4cd37e[_0x4c3c('0x15')](0x1f4,_0x245963[_0x4c3c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 93c3b8d..22e8305 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 _0xdf89=['remove','update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x2cc6bf,_0x4849a3){var _0x320f3c=function(_0x4fbe91){while(--_0x4fbe91){_0x2cc6bf['push'](_0x2cc6bf['shift']());}};_0x320f3c(++_0x4849a3);}(_0xdf89,0x179));var _0x9df8=function(_0xe6f21c,_0x15d794){_0xe6f21c=_0xe6f21c-0x0;var _0x5d94fc=_0xdf89[_0xe6f21c];return _0x5d94fc;};'use strict';var VoiceExtensionEvents=require(_0x9df8('0x0'));var events=['save',_0x9df8('0x1'),_0x9df8('0x2')];function createListener(_0x11afe2,_0x2d6964){return function(_0x53f977){_0x2d6964[_0x9df8('0x3')](_0x11afe2,_0x53f977);};}function removeListener(_0x3db24a,_0x36e1c4){return function(){VoiceExtensionEvents[_0x9df8('0x4')](_0x3db24a,_0x36e1c4);};}exports[_0x9df8('0x5')]=function(_0x252415){for(var _0x825569=0x0,_0x280274=events[_0x9df8('0x6')];_0x825569<_0x280274;_0x825569++){var _0xae5cee=events[_0x825569];var _0x4b5838=createListener('voiceExtension:'+_0xae5cee,_0x252415);VoiceExtensionEvents['on'](_0xae5cee,_0x4b5838);}}; \ No newline at end of file +var _0xe436=['voiceExtension:','save','remove','emit','removeListener','register','length'];(function(_0x2b05dc,_0x4e1d99){var _0x748466=function(_0x1f2b7a){while(--_0x1f2b7a){_0x2b05dc['push'](_0x2b05dc['shift']());}};_0x748466(++_0x4e1d99);}(_0xe436,0x143));var _0x6e43=function(_0x431b03,_0x116a95){_0x431b03=_0x431b03-0x0;var _0x8eaa94=_0xe436[_0x431b03];return _0x8eaa94;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x6e43('0x0'),_0x6e43('0x1'),'update'];function createListener(_0xf6a497,_0x4cfd79){return function(_0x2db5ed){_0x4cfd79[_0x6e43('0x2')](_0xf6a497,_0x2db5ed);};}function removeListener(_0x28fb2a,_0x12592f){return function(){VoiceExtensionEvents[_0x6e43('0x3')](_0x28fb2a,_0x12592f);};}exports[_0x6e43('0x4')]=function(_0x126068){for(var _0x27df05=0x0,_0x110d32=events[_0x6e43('0x5')];_0x27df05<_0x110d32;_0x27df05++){var _0x463622=events[_0x27df05];var _0x1c3eef=createListener(_0x6e43('0x6')+_0x463622,_0x126068);VoiceExtensionEvents['on'](_0x463622,_0x1c3eef);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a1d3e65..c16781d 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 _0x9072=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','put','update','destroy','multer','util'];(function(_0x2d0e5b,_0x537973){var _0x1906fd=function(_0xe8c8cf){while(--_0xe8c8cf){_0x2d0e5b['push'](_0x2d0e5b['shift']());}};_0x1906fd(++_0x537973);}(_0x9072,0x6a));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2907('0x0'));var util=require(_0x2907('0x1'));var path=require(_0x2907('0x2'));var timeout=require(_0x2907('0x3'));var express=require(_0x2907('0x4'));var router=express[_0x2907('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2907('0x6'));var config=require(_0x2907('0x7'));var controller=require(_0x2907('0x8'));router[_0x2907('0x9')]('/',auth[_0x2907('0xa')](),controller[_0x2907('0xb')]);router[_0x2907('0x9')](_0x2907('0xc'),auth[_0x2907('0xa')](),controller[_0x2907('0xd')]);router[_0x2907('0x9')](_0x2907('0xe'),auth[_0x2907('0xa')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2907('0xf')](_0x2907('0xc'),auth['isAuthenticated'](),controller[_0x2907('0x10')]);router['delete']('/:id',auth[_0x2907('0xa')](),controller[_0x2907('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2702=['../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x2702,0x19d));var _0x2270=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2702[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x2270('0x0'));var util=require(_0x2270('0x1'));var path=require('path');var timeout=require(_0x2270('0x2'));var express=require(_0x2270('0x3'));var router=express[_0x2270('0x4')]();var auth=require(_0x2270('0x5'));var interaction=require(_0x2270('0x6'));var config=require('../../config/environment');var controller=require(_0x2270('0x7'));router[_0x2270('0x8')]('/',auth['isAuthenticated'](),controller[_0x2270('0x9')]);router[_0x2270('0x8')](_0x2270('0xa'),auth[_0x2270('0xb')](),controller[_0x2270('0xc')]);router[_0x2270('0x8')](_0x2270('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2270('0xe')]('/',auth[_0x2270('0xb')](),controller['create']);router[_0x2270('0xf')](_0x2270('0xa'),auth['isAuthenticated'](),controller[_0x2270('0x10')]);router[_0x2270('0x11')](_0x2270('0xa'),auth['isAuthenticated'](),controller[_0x2270('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 14a2369..7c9e032 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 _0x878f=['contest_mailbox','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail'];(function(_0xf0c36,_0x414038){var _0x23aaf5=function(_0x1e727e){while(--_0x1e727e){_0xf0c36['push'](_0xf0c36['shift']());}};_0x23aaf5(++_0x414038);}(_0x878f,0x173));var _0xf878=function(_0x3ff132,_0x1846a1){_0x3ff132=_0x3ff132-0x0;var _0x4bb98e=_0x878f[_0x3ff132];return _0x4bb98e;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'customer_id':{'type':Sequelize[_0xf878('0x1')]},'context':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x2'),'unique':_0xf878('0x3')},'mailbox':{'type':Sequelize[_0xf878('0x1')],'defaultValue':'','allowNull':![],'unique':_0xf878('0x3')},'password':{'type':Sequelize[_0xf878('0x1')]},'fullname':{'type':Sequelize[_0xf878('0x1')]},'email':{'type':Sequelize[_0xf878('0x1')],'validate':{'isEmail':!![]},'set':function(_0x27ae4d){this['setDataValue']('email',typeof _0x27ae4d===_0xf878('0x4')&&_0x27ae4d[_0xf878('0x5')]()?_0x27ae4d['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xf878('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf878('0x1')]},'callback':{'type':Sequelize[_0xf878('0x1')]},'review':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf878('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'stamp':{'type':_0xf878('0xa')},'emailsubject':{'type':Sequelize[_0xf878('0x1')]},'emailbody':{'type':Sequelize[_0xf878('0x1')]},'maxsecs':{'type':Sequelize[_0xf878('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf878('0xc')],'get':function(){return this[_0xf878('0xd')](_0xf878('0xe'))+_0xf878('0xf')+this[_0xf878('0xd')](_0xf878('0x10'));}}}; \ No newline at end of file +var _0xb62e=['central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'customer_id':{'type':Sequelize[_0xeb62('0x2')]},'context':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':'from-voicemail','unique':_0xeb62('0x3')},'mailbox':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':'','allowNull':![],'unique':_0xeb62('0x3')},'password':{'type':Sequelize[_0xeb62('0x2')]},'fullname':{'type':Sequelize[_0xeb62('0x2')]},'email':{'type':Sequelize[_0xeb62('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5bc3c7){this[_0xeb62('0x4')](_0xeb62('0x5'),typeof _0x5bc3c7===_0xeb62('0x6')&&_0x5bc3c7['trim']()?_0x5bc3c7[_0xeb62('0x7')]():null);}},'pager':{'type':Sequelize[_0xeb62('0x2')]},'tz':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':_0xeb62('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xeb62('0x2')]},'callback':{'type':Sequelize[_0xeb62('0x2')]},'review':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xeb62('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xeb62('0x9'),'no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xeb62('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'stamp':{'type':_0xeb62('0xc')},'emailsubject':{'type':Sequelize[_0xeb62('0x2')]},'emailbody':{'type':Sequelize[_0xeb62('0x2')]},'maxsecs':{'type':Sequelize[_0xeb62('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xeb62('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xeb62('0xe')],'get':function(){return this[_0xeb62('0xf')](_0xeb62('0x10'))+'\x20-\x20'+this[_0xeb62('0xf')](_0xeb62('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 993ba74..de581d9 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 _0xfd7b=['get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','findAll','catch','show','rawAttributes','include','create','body','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','VoiceMailMessage','hasOwnProperty','pick','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','save','update','then','destroy'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfd7b[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0xbfd7('0x0'));var emlformat=require(_0xbfd7('0x1'));var rimraf=require(_0xbfd7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbfd7('0x3'));var rp=require(_0xbfd7('0x4'));var moment=require(_0xbfd7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfd7('0x6'));var util=require(_0xbfd7('0x7'));var path=require(_0xbfd7('0x8'));var sox=require('sox');var csv=require(_0xbfd7('0x9'));var ejs=require(_0xbfd7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbfd7('0xb'));var crypto=require(_0xbfd7('0xc'));var jsforce=require(_0xbfd7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbfd7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbfd7('0xe'));var authService=require(_0xbfd7('0xf'));var qs=require(_0xbfd7('0x10'));var as=require(_0xbfd7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfd7('0x12'))(_0xbfd7('0x13'));var utils=require(_0xbfd7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbfd7('0x15'));var db=require(_0xbfd7('0x16'))['db'];function respondWithStatusCode(_0x5bf99b,_0x32b1f8){_0x32b1f8=_0x32b1f8||0xcc;return function(_0x1da812){if(_0x1da812){return _0x5bf99b['sendStatus'](_0x32b1f8);}return _0x5bf99b[_0xbfd7('0x17')](_0x32b1f8)[_0xbfd7('0x18')]();};}function respondWithResult(_0x36edc4,_0x256703){_0x256703=_0x256703||0xc8;return function(_0x2ba278){if(_0x2ba278){return _0x36edc4[_0xbfd7('0x17')](_0x256703)[_0xbfd7('0x19')](_0x2ba278);}};}function respondWithFilteredResult(_0x4672f1,_0x13246d){return function(_0x355982){if(_0x355982){var _0xdc8970=_0x355982[_0xbfd7('0x1a')],_0x465419=_0x13246d[_0xbfd7('0x1b')],_0x42b276=_0x13246d[_0xbfd7('0x1b')]+_0x13246d['limit'],_0x19b889;if(_0x42b276>=_0xdc8970){_0x42b276=_0xdc8970;_0x19b889=0xc8;}else{_0x19b889=0xce;}_0x4672f1[_0xbfd7('0x17')](_0x19b889);return _0x4672f1[_0xbfd7('0x1c')](_0xbfd7('0x1d'),_0x465419+'-'+_0x42b276+'/'+_0xdc8970)[_0xbfd7('0x19')](_0x355982);}return null;};}function patchUpdates(_0x344d85){return function(_0x1096bc){try{jsonpatch['apply'](_0x1096bc,_0x344d85,!![]);}catch(_0x4bb45c){return BPromise['reject'](_0x4bb45c);}return _0x1096bc[_0xbfd7('0x1e')]();};}function saveUpdates(_0x4a003b,_0x4bd787){return function(_0x448658){if(_0x448658){return _0x448658[_0xbfd7('0x1f')](_0x4a003b)[_0xbfd7('0x20')](function(_0x3d0b8b){return _0x3d0b8b;});}return null;};}function removeEntity(_0x22e9e6,_0x492a5b){return function(_0x1705b6){if(_0x1705b6){return _0x1705b6[_0xbfd7('0x21')]()[_0xbfd7('0x20')](function(){var _0x37fc6f=_0x1705b6[_0xbfd7('0x22')]({'plain':!![]});var _0x44faec=_0xbfd7('0x23');return db[_0xbfd7('0x24')]['destroy']({'where':{'type':_0x44faec,'resourceId':_0x37fc6f['id']}})[_0xbfd7('0x20')](function(){return _0x1705b6;});})[_0xbfd7('0x20')](function(){_0x22e9e6[_0xbfd7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x284cff,_0xd862e3){return function(_0x341dda){if(!_0x341dda){_0x284cff['sendStatus'](0x194);}return _0x341dda;};}function handleError(_0x44ee2a,_0xd8ce2){_0xd8ce2=_0xd8ce2||0x1f4;return function(_0x3c41d5){logger[_0xbfd7('0x25')](_0x3c41d5[_0xbfd7('0x26')]);if(_0x3c41d5[_0xbfd7('0x27')]){delete _0x3c41d5[_0xbfd7('0x27')];}_0x44ee2a[_0xbfd7('0x17')](_0xd8ce2)[_0xbfd7('0x28')](_0x3c41d5);};}exports[_0xbfd7('0x29')]=function(_0x263ee3,_0x2ff20f){var _0x308259={},_0x5bb305={},_0x383b7e={'count':0x0,'rows':[]};var _0x10663d=_[_0xbfd7('0x2a')](db[_0xbfd7('0x2b')]['rawAttributes'],function(_0x4ba994){return{'name':_0x4ba994['fieldName'],'type':_0x4ba994[_0xbfd7('0x2c')][_0xbfd7('0x2d')]};});_0x5bb305[_0xbfd7('0x2e')]=_['map'](_0x10663d,_0xbfd7('0x27'));_0x5bb305[_0xbfd7('0x2f')]=_[_0xbfd7('0x30')](_0x263ee3[_0xbfd7('0x2f')]);_0x5bb305[_0xbfd7('0x31')]=_['intersection'](_0x5bb305[_0xbfd7('0x2e')],_0x5bb305[_0xbfd7('0x2f')]);_0x308259[_0xbfd7('0x32')]=_[_0xbfd7('0x33')](_0x5bb305['model'],qs[_0xbfd7('0x34')](_0x263ee3[_0xbfd7('0x2f')][_0xbfd7('0x34')]));_0x308259['attributes']=_0x308259[_0xbfd7('0x32')][_0xbfd7('0x35')]?_0x308259[_0xbfd7('0x32')]:_0x5bb305['model'];if(!_0x263ee3[_0xbfd7('0x2f')]['hasOwnProperty'](_0xbfd7('0x36'))){_0x308259['limit']=qs[_0xbfd7('0x37')](_0x263ee3[_0xbfd7('0x2f')][_0xbfd7('0x37')]);_0x308259[_0xbfd7('0x1b')]=qs[_0xbfd7('0x1b')](_0x263ee3[_0xbfd7('0x2f')]['offset']);}_0x308259[_0xbfd7('0x38')]=qs[_0xbfd7('0x39')](_0x263ee3[_0xbfd7('0x2f')][_0xbfd7('0x39')]);_0x308259['where']=qs[_0xbfd7('0x31')](_['pick'](_0x263ee3[_0xbfd7('0x2f')],_0x5bb305[_0xbfd7('0x31')]),_0x10663d);if(_0x263ee3['query'][_0xbfd7('0x3a')]){_0x308259[_0xbfd7('0x3b')]=_[_0xbfd7('0x3c')](_0x308259[_0xbfd7('0x3b')],{'$or':_[_0xbfd7('0x2a')](_0x10663d,function(_0x256bc6){if(_0x256bc6[_0xbfd7('0x2c')]!==_0xbfd7('0x3d')){var _0x586a4c={};_0x586a4c[_0x256bc6[_0xbfd7('0x27')]]={'$like':'%'+_0x263ee3[_0xbfd7('0x2f')][_0xbfd7('0x3a')]+'%'};return _0x586a4c;}})});}_0x308259=_['merge']({},_0x308259,_0x263ee3[_0xbfd7('0x3e')]);var _0x532c35={'where':_0x308259[_0xbfd7('0x3b')]};return db[_0xbfd7('0x2b')][_0xbfd7('0x1a')](_0x532c35)['then'](function(_0x32917a){_0x383b7e[_0xbfd7('0x1a')]=_0x32917a;if(_0x263ee3[_0xbfd7('0x2f')]['includeAll']){_0x308259['include']=[{'all':!![]}];}return db['VoiceMail'][_0xbfd7('0x3f')](_0x308259);})[_0xbfd7('0x20')](function(_0xa9cb5b){_0x383b7e['rows']=_0xa9cb5b;return _0x383b7e;})[_0xbfd7('0x20')](respondWithFilteredResult(_0x2ff20f,_0x308259))[_0xbfd7('0x40')](handleError(_0x2ff20f,null));};exports[_0xbfd7('0x41')]=function(_0x5dbdc2,_0x1af30e){var _0xbc59d7={'raw':!![],'where':{'id':_0x5dbdc2['params']['id']}},_0x2f1bfb={};_0x2f1bfb[_0xbfd7('0x2e')]=_[_0xbfd7('0x30')](db[_0xbfd7('0x2b')][_0xbfd7('0x42')]);_0x2f1bfb[_0xbfd7('0x2f')]=_[_0xbfd7('0x30')](_0x5dbdc2[_0xbfd7('0x2f')]);_0x2f1bfb[_0xbfd7('0x31')]=_[_0xbfd7('0x33')](_0x2f1bfb[_0xbfd7('0x2e')],_0x2f1bfb[_0xbfd7('0x2f')]);_0xbc59d7[_0xbfd7('0x32')]=_[_0xbfd7('0x33')](_0x2f1bfb[_0xbfd7('0x2e')],qs[_0xbfd7('0x34')](_0x5dbdc2[_0xbfd7('0x2f')][_0xbfd7('0x34')]));_0xbc59d7[_0xbfd7('0x32')]=_0xbc59d7[_0xbfd7('0x32')]['length']?_0xbc59d7[_0xbfd7('0x32')]:_0x2f1bfb[_0xbfd7('0x2e')];if(_0x5dbdc2[_0xbfd7('0x2f')]['includeAll']){_0xbc59d7[_0xbfd7('0x43')]=[{'all':!![]}];}_0xbc59d7=_[_0xbfd7('0x3c')]({},_0xbc59d7,_0x5dbdc2[_0xbfd7('0x3e')]);return db[_0xbfd7('0x2b')]['find'](_0xbc59d7)[_0xbfd7('0x20')](handleEntityNotFound(_0x1af30e,null))[_0xbfd7('0x20')](respondWithResult(_0x1af30e,null))['catch'](handleError(_0x1af30e,null));};exports[_0xbfd7('0x44')]=function(_0x3a2c48,_0x4944b7){return db['VoiceMail'][_0xbfd7('0x44')](_0x3a2c48[_0xbfd7('0x45')],{})['then'](function(_0x31d1df){var _0x20de4c=_0x3a2c48['user'][_0xbfd7('0x22')]({'plain':!![]});if(!_0x20de4c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20de4c['role']===_0xbfd7('0x46')){var _0xcda8e7=_0x31d1df[_0xbfd7('0x22')]({'plain':!![]});var _0x29a6ce=_0xbfd7('0x23');return db['UserProfileSection'][_0xbfd7('0x47')]({'where':{'name':_0x29a6ce,'userProfileId':_0x20de4c[_0xbfd7('0x48')]},'raw':!![]})[_0xbfd7('0x20')](function(_0x105a73){if(_0x105a73&&_0x105a73[_0xbfd7('0x49')]===0x0){return db[_0xbfd7('0x24')][_0xbfd7('0x44')]({'name':_0xcda8e7['name'],'resourceId':_0xcda8e7['id'],'type':_0x105a73[_0xbfd7('0x27')],'sectionId':_0x105a73['id']},{})[_0xbfd7('0x20')](function(){return _0x31d1df;});}else{return _0x31d1df;}})['catch'](function(_0xdd547c){logger[_0xbfd7('0x25')](_0xbfd7('0x4a'),_0xdd547c);throw _0xdd547c;});}return _0x31d1df;})[_0xbfd7('0x20')](respondWithResult(_0x4944b7,0xc9))[_0xbfd7('0x40')](handleError(_0x4944b7,null));};exports[_0xbfd7('0x1f')]=function(_0x162d45,_0x403d74){if(_0x162d45[_0xbfd7('0x45')]['id']){delete _0x162d45[_0xbfd7('0x45')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x162d45[_0xbfd7('0x4b')]['id']}})[_0xbfd7('0x20')](handleEntityNotFound(_0x403d74,null))[_0xbfd7('0x20')](saveUpdates(_0x162d45[_0xbfd7('0x45')],null))[_0xbfd7('0x20')](respondWithResult(_0x403d74,null))['catch'](handleError(_0x403d74,null));};exports[_0xbfd7('0x21')]=function(_0x1b7d38,_0x577424){return db[_0xbfd7('0x2b')][_0xbfd7('0x47')]({'where':{'id':_0x1b7d38[_0xbfd7('0x4b')]['id']}})[_0xbfd7('0x20')](handleEntityNotFound(_0x577424,null))[_0xbfd7('0x20')](removeEntity(_0x577424,null))[_0xbfd7('0x40')](handleError(_0x577424,null));};exports['getMessages']=function(_0x5c3819,_0x351fca,_0x2764b6){return db[_0xbfd7('0x2b')][_0xbfd7('0x4c')]({'where':{'id':_0x5c3819[_0xbfd7('0x4b')]['id']}})[_0xbfd7('0x20')](handleEntityNotFound(_0x351fca,null))[_0xbfd7('0x20')](function(_0x228361){var _0x3e5274;var _0x1d9cb3={},_0x4be1c1={};_0x4be1c1['model']=_[_0xbfd7('0x30')](db[_0xbfd7('0x4d')][_0xbfd7('0x42')]);_0x4be1c1[_0xbfd7('0x2f')]=_[_0xbfd7('0x30')](_0x5c3819[_0xbfd7('0x2f')]);_0x4be1c1[_0xbfd7('0x31')]=_['intersection'](_0x4be1c1['model'],_0x4be1c1['query']);_0x1d9cb3[_0xbfd7('0x32')]=_[_0xbfd7('0x33')](_0x4be1c1[_0xbfd7('0x2e')],qs[_0xbfd7('0x34')](_0x5c3819[_0xbfd7('0x2f')][_0xbfd7('0x34')]));_0x1d9cb3[_0xbfd7('0x32')]=_0x1d9cb3['attributes'][_0xbfd7('0x35')]?_0x1d9cb3['attributes']:_0x4be1c1['model'];if(!_0x5c3819[_0xbfd7('0x2f')][_0xbfd7('0x4e')]('nolimit')){_0x1d9cb3[_0xbfd7('0x37')]=qs[_0xbfd7('0x37')](_0x5c3819[_0xbfd7('0x2f')][_0xbfd7('0x37')]);_0x1d9cb3[_0xbfd7('0x1b')]=qs[_0xbfd7('0x1b')](_0x5c3819[_0xbfd7('0x2f')][_0xbfd7('0x1b')]);}_0x1d9cb3[_0xbfd7('0x38')]=qs[_0xbfd7('0x39')](_0x5c3819[_0xbfd7('0x2f')][_0xbfd7('0x39')]);_0x1d9cb3[_0xbfd7('0x3b')]=qs[_0xbfd7('0x31')](_[_0xbfd7('0x4f')](_0x5c3819['query'],_0x4be1c1[_0xbfd7('0x31')]));if(_0x5c3819['query'][_0xbfd7('0x3a')]){_0x1d9cb3[_0xbfd7('0x3b')]=_[_0xbfd7('0x3c')](_0x1d9cb3[_0xbfd7('0x3b')],{'$or':_[_0xbfd7('0x2a')](_0x1d9cb3[_0xbfd7('0x32')],function(_0x51fb65){var _0x305d07={};_0x305d07[_0x51fb65]={'$like':'%'+_0x5c3819[_0xbfd7('0x2f')]['filter']+'%'};return _0x305d07;})});}_0x1d9cb3[_0xbfd7('0x3b')]=_[_0xbfd7('0x3c')](_0x1d9cb3[_0xbfd7('0x3b')],{'mailboxuser':_0x228361['mailbox']});_0x1d9cb3=_[_0xbfd7('0x3c')]({},_0x1d9cb3,_0x5c3819[_0xbfd7('0x3e')]);return db[_0xbfd7('0x4d')][_0xbfd7('0x50')](_0x1d9cb3)['then'](respondWithFilteredResult(_0x351fca,_0x1d9cb3));})[_0xbfd7('0x40')](handleError(_0x351fca,null));}; \ No newline at end of file +var _0x5a13=['../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','fields','length','model','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x554709,_0x214a8d){var _0xaea55b=function(_0x10f7ed){while(--_0x10f7ed){_0x554709['push'](_0x554709['shift']());}};_0xaea55b(++_0x214a8d);}(_0x5a13,0x92));var _0x35a1=function(_0x49f1f5,_0x5400cd){_0x49f1f5=_0x49f1f5-0x0;var _0x5817e3=_0x5a13[_0x49f1f5];return _0x5817e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x35a1('0x0'));var rimraf=require(_0x35a1('0x1'));var zipdir=require(_0x35a1('0x2'));var jsonpatch=require(_0x35a1('0x3'));var rp=require(_0x35a1('0x4'));var moment=require(_0x35a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x35a1('0x6'));var util=require('util');var path=require(_0x35a1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35a1('0x8'));var squel=require(_0x35a1('0x9'));var crypto=require(_0x35a1('0xa'));var jsforce=require(_0x35a1('0xb'));var deskjs=require(_0x35a1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x35a1('0xd'));var Papa=require(_0x35a1('0xe'));var Redis=require(_0x35a1('0xf'));var authService=require(_0x35a1('0x10'));var qs=require(_0x35a1('0x11'));var as=require(_0x35a1('0x12'));var hardwareService=require(_0x35a1('0x13'));var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require(_0x35a1('0x16'));var licenseUtil=require(_0x35a1('0x17'));var db=require(_0x35a1('0x18'))['db'];function respondWithStatusCode(_0x398b62,_0x2c5ba0){_0x2c5ba0=_0x2c5ba0||0xcc;return function(_0x48212d){if(_0x48212d){return _0x398b62[_0x35a1('0x19')](_0x2c5ba0);}return _0x398b62['status'](_0x2c5ba0)[_0x35a1('0x1a')]();};}function respondWithResult(_0x360a5e,_0x51c277){_0x51c277=_0x51c277||0xc8;return function(_0x1ddfb9){if(_0x1ddfb9){return _0x360a5e[_0x35a1('0x1b')](_0x51c277)[_0x35a1('0x1c')](_0x1ddfb9);}};}function respondWithFilteredResult(_0x440481,_0x4faa68){return function(_0xac42ac){if(_0xac42ac){var _0x156a6a=_0xac42ac[_0x35a1('0x1d')],_0x423d80=_0x4faa68[_0x35a1('0x1e')],_0x41eed1=_0x4faa68['offset']+_0x4faa68[_0x35a1('0x1f')],_0x5d5166;if(_0x41eed1>=_0x156a6a){_0x41eed1=_0x156a6a;_0x5d5166=0xc8;}else{_0x5d5166=0xce;}_0x440481[_0x35a1('0x1b')](_0x5d5166);return _0x440481['set'](_0x35a1('0x20'),_0x423d80+'-'+_0x41eed1+'/'+_0x156a6a)[_0x35a1('0x1c')](_0xac42ac);}return null;};}function patchUpdates(_0x7912d4){return function(_0x3931bb){try{jsonpatch[_0x35a1('0x21')](_0x3931bb,_0x7912d4,!![]);}catch(_0x5a324d){return BPromise[_0x35a1('0x22')](_0x5a324d);}return _0x3931bb[_0x35a1('0x23')]();};}function saveUpdates(_0x4b978e,_0x50f6d1){return function(_0x54e83d){if(_0x54e83d){return _0x54e83d['update'](_0x4b978e)[_0x35a1('0x24')](function(_0x5ab929){return _0x5ab929;});}return null;};}function removeEntity(_0x3e24a3,_0x240565){return function(_0x151e40){if(_0x151e40){return _0x151e40['destroy']()[_0x35a1('0x24')](function(){var _0x5eef97=_0x151e40[_0x35a1('0x25')]({'plain':!![]});var _0x31272b=_0x35a1('0x26');return db[_0x35a1('0x27')][_0x35a1('0x28')]({'where':{'type':_0x31272b,'resourceId':_0x5eef97['id']}})[_0x35a1('0x24')](function(){return _0x151e40;});})['then'](function(){_0x3e24a3[_0x35a1('0x1b')](0xcc)[_0x35a1('0x1a')]();});}};}function handleEntityNotFound(_0x4e9a35,_0x209e81){return function(_0x138727){if(!_0x138727){_0x4e9a35['sendStatus'](0x194);}return _0x138727;};}function handleError(_0x1fe9bd,_0x184f5a){_0x184f5a=_0x184f5a||0x1f4;return function(_0x346d2e){logger[_0x35a1('0x29')](_0x346d2e[_0x35a1('0x2a')]);if(_0x346d2e[_0x35a1('0x2b')]){delete _0x346d2e[_0x35a1('0x2b')];}_0x1fe9bd[_0x35a1('0x1b')](_0x184f5a)[_0x35a1('0x2c')](_0x346d2e);};}exports['index']=function(_0x44d0dc,_0x44f0f4){var _0x4d22b2={},_0x5c9e67={},_0x2c9630={'count':0x0,'rows':[]};var _0x45186e=_[_0x35a1('0x2d')](db[_0x35a1('0x2e')][_0x35a1('0x2f')],function(_0x19be3d){return{'name':_0x19be3d[_0x35a1('0x30')],'type':_0x19be3d[_0x35a1('0x31')]['key']};});_0x5c9e67['model']=_[_0x35a1('0x2d')](_0x45186e,_0x35a1('0x2b'));_0x5c9e67[_0x35a1('0x32')]=_[_0x35a1('0x33')](_0x44d0dc['query']);_0x5c9e67[_0x35a1('0x34')]=_['intersection'](_0x5c9e67['model'],_0x5c9e67[_0x35a1('0x32')]);_0x4d22b2[_0x35a1('0x35')]=_[_0x35a1('0x36')](_0x5c9e67['model'],qs[_0x35a1('0x37')](_0x44d0dc[_0x35a1('0x32')][_0x35a1('0x37')]));_0x4d22b2[_0x35a1('0x35')]=_0x4d22b2[_0x35a1('0x35')][_0x35a1('0x38')]?_0x4d22b2[_0x35a1('0x35')]:_0x5c9e67[_0x35a1('0x39')];if(!_0x44d0dc[_0x35a1('0x32')]['hasOwnProperty'](_0x35a1('0x3a'))){_0x4d22b2[_0x35a1('0x1f')]=qs[_0x35a1('0x1f')](_0x44d0dc[_0x35a1('0x32')][_0x35a1('0x1f')]);_0x4d22b2[_0x35a1('0x1e')]=qs[_0x35a1('0x1e')](_0x44d0dc[_0x35a1('0x32')][_0x35a1('0x1e')]);}_0x4d22b2['order']=qs[_0x35a1('0x3b')](_0x44d0dc['query'][_0x35a1('0x3b')]);_0x4d22b2[_0x35a1('0x3c')]=qs[_0x35a1('0x34')](_[_0x35a1('0x3d')](_0x44d0dc['query'],_0x5c9e67[_0x35a1('0x34')]),_0x45186e);if(_0x44d0dc['query'][_0x35a1('0x3e')]){_0x4d22b2[_0x35a1('0x3c')]=_['merge'](_0x4d22b2[_0x35a1('0x3c')],{'$or':_['map'](_0x45186e,function(_0xd14f9f){if(_0xd14f9f[_0x35a1('0x31')]!=='VIRTUAL'){var _0x47e61f={};_0x47e61f[_0xd14f9f['name']]={'$like':'%'+_0x44d0dc[_0x35a1('0x32')][_0x35a1('0x3e')]+'%'};return _0x47e61f;}})});}_0x4d22b2=_[_0x35a1('0x3f')]({},_0x4d22b2,_0x44d0dc[_0x35a1('0x40')]);var _0x57efd2={'where':_0x4d22b2[_0x35a1('0x3c')]};return db['VoiceMail'][_0x35a1('0x1d')](_0x57efd2)[_0x35a1('0x24')](function(_0x2e230c){_0x2c9630[_0x35a1('0x1d')]=_0x2e230c;if(_0x44d0dc[_0x35a1('0x32')][_0x35a1('0x41')]){_0x4d22b2['include']=[{'all':!![]}];}return db[_0x35a1('0x2e')][_0x35a1('0x42')](_0x4d22b2);})['then'](function(_0x41cffb){_0x2c9630[_0x35a1('0x43')]=_0x41cffb;return _0x2c9630;})[_0x35a1('0x24')](respondWithFilteredResult(_0x44f0f4,_0x4d22b2))['catch'](handleError(_0x44f0f4,null));};exports['show']=function(_0xb0ca7d,_0x56f134){var _0x48086c={'raw':!![],'where':{'id':_0xb0ca7d[_0x35a1('0x44')]['id']}},_0x2d4dd9={};_0x2d4dd9[_0x35a1('0x39')]=_[_0x35a1('0x33')](db[_0x35a1('0x2e')]['rawAttributes']);_0x2d4dd9[_0x35a1('0x32')]=_[_0x35a1('0x33')](_0xb0ca7d[_0x35a1('0x32')]);_0x2d4dd9[_0x35a1('0x34')]=_[_0x35a1('0x36')](_0x2d4dd9[_0x35a1('0x39')],_0x2d4dd9[_0x35a1('0x32')]);_0x48086c[_0x35a1('0x35')]=_[_0x35a1('0x36')](_0x2d4dd9['model'],qs[_0x35a1('0x37')](_0xb0ca7d[_0x35a1('0x32')][_0x35a1('0x37')]));_0x48086c['attributes']=_0x48086c[_0x35a1('0x35')]['length']?_0x48086c[_0x35a1('0x35')]:_0x2d4dd9['model'];if(_0xb0ca7d[_0x35a1('0x32')][_0x35a1('0x41')]){_0x48086c[_0x35a1('0x45')]=[{'all':!![]}];}_0x48086c=_[_0x35a1('0x3f')]({},_0x48086c,_0xb0ca7d[_0x35a1('0x40')]);return db[_0x35a1('0x2e')][_0x35a1('0x46')](_0x48086c)[_0x35a1('0x24')](handleEntityNotFound(_0x56f134,null))[_0x35a1('0x24')](respondWithResult(_0x56f134,null))[_0x35a1('0x47')](handleError(_0x56f134,null));};exports[_0x35a1('0x48')]=function(_0x310609,_0x5487eb){return db[_0x35a1('0x2e')][_0x35a1('0x48')](_0x310609[_0x35a1('0x49')],{})[_0x35a1('0x24')](function(_0x41801b){var _0x218179=_0x310609['user'][_0x35a1('0x25')]({'plain':!![]});if(!_0x218179)throw new Error(_0x35a1('0x4a'));if(_0x218179[_0x35a1('0x4b')]===_0x35a1('0x4c')){var _0x2e120f=_0x41801b[_0x35a1('0x25')]({'plain':!![]});var _0x23b191=_0x35a1('0x26');return db[_0x35a1('0x4d')][_0x35a1('0x46')]({'where':{'name':_0x23b191,'userProfileId':_0x218179['userProfileId']},'raw':!![]})[_0x35a1('0x24')](function(_0x324cc4){if(_0x324cc4&&_0x324cc4[_0x35a1('0x4e')]===0x0){return db[_0x35a1('0x27')][_0x35a1('0x48')]({'name':_0x2e120f[_0x35a1('0x2b')],'resourceId':_0x2e120f['id'],'type':_0x324cc4[_0x35a1('0x2b')],'sectionId':_0x324cc4['id']},{})['then'](function(){return _0x41801b;});}else{return _0x41801b;}})['catch'](function(_0x486036){logger[_0x35a1('0x29')](_0x35a1('0x4f'),_0x486036);throw _0x486036;});}return _0x41801b;})[_0x35a1('0x24')](respondWithResult(_0x5487eb,0xc9))[_0x35a1('0x47')](handleError(_0x5487eb,null));};exports[_0x35a1('0x50')]=function(_0x25dead,_0x45206c){if(_0x25dead[_0x35a1('0x49')]['id']){delete _0x25dead['body']['id'];}return db[_0x35a1('0x2e')][_0x35a1('0x46')]({'where':{'id':_0x25dead['params']['id']}})[_0x35a1('0x24')](handleEntityNotFound(_0x45206c,null))[_0x35a1('0x24')](saveUpdates(_0x25dead['body'],null))[_0x35a1('0x24')](respondWithResult(_0x45206c,null))[_0x35a1('0x47')](handleError(_0x45206c,null));};exports[_0x35a1('0x28')]=function(_0x1844bd,_0x344143){return db[_0x35a1('0x2e')][_0x35a1('0x46')]({'where':{'id':_0x1844bd[_0x35a1('0x44')]['id']}})[_0x35a1('0x24')](handleEntityNotFound(_0x344143,null))[_0x35a1('0x24')](removeEntity(_0x344143,null))[_0x35a1('0x47')](handleError(_0x344143,null));};exports[_0x35a1('0x51')]=function(_0x2b35a0,_0x5800a9,_0x20ad80){return db[_0x35a1('0x2e')][_0x35a1('0x52')]({'where':{'id':_0x2b35a0[_0x35a1('0x44')]['id']}})[_0x35a1('0x24')](handleEntityNotFound(_0x5800a9,null))[_0x35a1('0x24')](function(_0x449cd9){var _0x1b0094;var _0x35d6b5={},_0x11e820={};_0x11e820['model']=_[_0x35a1('0x33')](db[_0x35a1('0x53')][_0x35a1('0x2f')]);_0x11e820[_0x35a1('0x32')]=_[_0x35a1('0x33')](_0x2b35a0['query']);_0x11e820[_0x35a1('0x34')]=_[_0x35a1('0x36')](_0x11e820[_0x35a1('0x39')],_0x11e820[_0x35a1('0x32')]);_0x35d6b5['attributes']=_[_0x35a1('0x36')](_0x11e820[_0x35a1('0x39')],qs[_0x35a1('0x37')](_0x2b35a0[_0x35a1('0x32')][_0x35a1('0x37')]));_0x35d6b5['attributes']=_0x35d6b5[_0x35a1('0x35')]['length']?_0x35d6b5[_0x35a1('0x35')]:_0x11e820['model'];if(!_0x2b35a0[_0x35a1('0x32')][_0x35a1('0x54')](_0x35a1('0x3a'))){_0x35d6b5[_0x35a1('0x1f')]=qs[_0x35a1('0x1f')](_0x2b35a0['query'][_0x35a1('0x1f')]);_0x35d6b5['offset']=qs[_0x35a1('0x1e')](_0x2b35a0[_0x35a1('0x32')]['offset']);}_0x35d6b5['order']=qs['sort'](_0x2b35a0[_0x35a1('0x32')][_0x35a1('0x3b')]);_0x35d6b5[_0x35a1('0x3c')]=qs['filters'](_[_0x35a1('0x3d')](_0x2b35a0[_0x35a1('0x32')],_0x11e820[_0x35a1('0x34')]));if(_0x2b35a0['query'][_0x35a1('0x3e')]){_0x35d6b5['where']=_[_0x35a1('0x3f')](_0x35d6b5['where'],{'$or':_[_0x35a1('0x2d')](_0x35d6b5['attributes'],function(_0x1a3310){var _0x3c69bb={};_0x3c69bb[_0x1a3310]={'$like':'%'+_0x2b35a0[_0x35a1('0x32')][_0x35a1('0x3e')]+'%'};return _0x3c69bb;})});}_0x35d6b5[_0x35a1('0x3c')]=_['merge'](_0x35d6b5[_0x35a1('0x3c')],{'mailboxuser':_0x449cd9['mailbox']});_0x35d6b5=_[_0x35a1('0x3f')]({},_0x35d6b5,_0x2b35a0['options']);return db['VoiceMailMessage']['findAndCountAll'](_0x35d6b5)[_0x35a1('0x24')](respondWithFilteredResult(_0x5800a9,_0x35d6b5));})['catch'](handleError(_0x5800a9,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9be58a8..277ec65 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 _0xe615=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','mailbox_context','mailbox','lodash','util'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0xe615,0xb9));var _0x5e61=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xe615[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x5e61('0x0'));var util=require(_0x5e61('0x1'));var logger=require('../../config/logger')(_0x5e61('0x2'));var moment=require(_0x5e61('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e61('0x4'));var fs=require('fs');var path=require(_0x5e61('0x5'));var rimraf=require(_0x5e61('0x6'));var config=require(_0x5e61('0x7'));var attributes=require(_0x5e61('0x8'));module['exports']=function(_0x232e56,_0x299113){return _0x232e56['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x5e61('0x9'),'fields':[_0x5e61('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x973f=['./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x48051b,_0x339115){var _0x2a4f6e=function(_0x5b7756){while(--_0x5b7756){_0x48051b['push'](_0x48051b['shift']());}};_0x2a4f6e(++_0x339115);}(_0x973f,0x18d));var _0xf973=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x973f[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xf973('0x0'));var util=require(_0xf973('0x1'));var logger=require(_0xf973('0x2'))(_0xf973('0x3'));var moment=require(_0xf973('0x4'));var BPromise=require(_0xf973('0x5'));var rp=require(_0xf973('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf973('0x7'));var config=require('../../config/environment');var attributes=require(_0xf973('0x8'));module[_0xf973('0x9')]=function(_0xad223b,_0x73448e){return _0xad223b['define'](_0xf973('0xa'),attributes,{'tableName':_0xf973('0xb'),'paranoid':![],'indexes':[{'name':_0xf973('0xc'),'fields':[_0xf973('0xd'),_0xf973('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1383797..a62be0d 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 _0x3b58=['jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x384831,_0x268fae){var _0x6107f3=function(_0x4b53e7){while(--_0x4b53e7){_0x384831['push'](_0x384831['shift']());}};_0x6107f3(++_0x268fae);}(_0x3b58,0x11d));var _0x83b5=function(_0x4ca800,_0x21e1be){_0x4ca800=_0x4ca800-0x0;var _0x3d45b7=_0x3b58[_0x4ca800];return _0x3d45b7;};'use strict';var _=require(_0x83b5('0x0'));var util=require(_0x83b5('0x1'));var moment=require(_0x83b5('0x2'));var BPromise=require(_0x83b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83b5('0x4'));var db=require(_0x83b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x83b5('0x6'))(_0x83b5('0x7'));var config=require(_0x83b5('0x8'));var jayson=require(_0x83b5('0x9'));var client=jayson['client'][_0x83b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ea123,_0x4eb540,_0x12ccc7){return new BPromise(function(_0x29d8e6,_0x466010){return client[_0x83b5('0xb')](_0x2ea123,_0x12ccc7)['then'](function(_0x22e5c9){logger[_0x83b5('0xc')](_0x83b5('0xd'),_0x4eb540,_0x83b5('0xe'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4eb540,_0x83b5('0xe'),JSON[_0x83b5('0xf')](_0x22e5c9));if(_0x22e5c9['error']){if(_0x22e5c9[_0x83b5('0x10')][_0x83b5('0x11')]===0x1f4){logger[_0x83b5('0x10')](_0x83b5('0xd'),_0x4eb540,_0x22e5c9['error'][_0x83b5('0x12')]);return _0x466010(_0x22e5c9[_0x83b5('0x10')]['message']);}logger[_0x83b5('0x10')](_0x83b5('0xd'),_0x4eb540,_0x22e5c9[_0x83b5('0x10')][_0x83b5('0x12')]);return _0x29d8e6(_0x22e5c9[_0x83b5('0x10')][_0x83b5('0x12')]);}else{logger[_0x83b5('0xc')](_0x83b5('0xd'),_0x4eb540,_0x83b5('0xe'));_0x29d8e6(_0x22e5c9[_0x83b5('0x13')][_0x83b5('0x12')]);}})[_0x83b5('0x14')](function(_0x5561fd){logger['error'](_0x83b5('0xd'),_0x4eb540,_0x5561fd);_0x466010(_0x5561fd);});});} \ No newline at end of file +var _0xfaab=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x5cfd09,_0x5bd220){var _0x33b678=function(_0x41c3ac){while(--_0x41c3ac){_0x5cfd09['push'](_0x5cfd09['shift']());}};_0x33b678(++_0x5bd220);}(_0xfaab,0xcb));var _0xbfaa=function(_0x40be5f,_0x4c4944){_0x40be5f=_0x40be5f-0x0;var _0x13dd68=_0xfaab[_0x40be5f];return _0x13dd68;};'use strict';var _=require(_0xbfaa('0x0'));var util=require(_0xbfaa('0x1'));var moment=require(_0xbfaa('0x2'));var BPromise=require(_0xbfaa('0x3'));var rs=require(_0xbfaa('0x4'));var fs=require('fs');var Redis=require(_0xbfaa('0x5'));var db=require(_0xbfaa('0x6'))['db'];var utils=require(_0xbfaa('0x7'));var logger=require(_0xbfaa('0x8'))('rpc');var config=require(_0xbfaa('0x9'));var jayson=require(_0xbfaa('0xa'));var client=jayson[_0xbfaa('0xb')][_0xbfaa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10f470,_0x400a49,_0x41d61a){return new BPromise(function(_0x4ebd68,_0x3c586a){return client[_0xbfaa('0xd')](_0x10f470,_0x41d61a)[_0xbfaa('0xe')](function(_0x71884d){logger['info'](_0xbfaa('0xf'),_0x400a49,_0xbfaa('0x10'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x400a49,'request\x20sent',JSON[_0xbfaa('0x11')](_0x71884d));if(_0x71884d[_0xbfaa('0x12')]){if(_0x71884d[_0xbfaa('0x12')][_0xbfaa('0x13')]===0x1f4){logger[_0xbfaa('0x12')]('VoiceMail,\x20%s,\x20%s',_0x400a49,_0x71884d[_0xbfaa('0x12')][_0xbfaa('0x14')]);return _0x3c586a(_0x71884d['error']['message']);}logger['error'](_0xbfaa('0xf'),_0x400a49,_0x71884d['error'][_0xbfaa('0x14')]);return _0x4ebd68(_0x71884d[_0xbfaa('0x12')][_0xbfaa('0x14')]);}else{logger[_0xbfaa('0x15')](_0xbfaa('0xf'),_0x400a49,_0xbfaa('0x10'));_0x4ebd68(_0x71884d[_0xbfaa('0x16')]['message']);}})['catch'](function(_0x4d4ead){logger[_0xbfaa('0x12')]('VoiceMail,\x20%s,\x20%s',_0x400a49,_0x4d4ead);_0x3c586a(_0x4d4ead);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f705db8..2e470e1 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 _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x114720,_0x100b90){var _0x482582=function(_0x2998e3){while(--_0x2998e3){_0x114720['push'](_0x114720['shift']());}};_0x482582(++_0x100b90);}(_0x4819,0xcd));var _0x9481=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0x4819[_0x485f35];return _0x2ad118;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file +var _0x687b=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x687b,0x14a));var _0xb687=function(_0xf46ea,_0xd97598){_0xf46ea=_0xf46ea-0x0;var _0x363349=_0x687b[_0xf46ea];return _0x363349;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0x8')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0xe')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xf')]);router[_0xb687('0x10')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')]('/:id',auth[_0xb687('0x9')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a94639b..12ff8d4 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 _0x4739=['sequelize','VIRTUAL','INTEGER','STRING','TIMESTAMP'];(function(_0x36fdc9,_0x3a2e74){var _0x594c20=function(_0x413cae){while(--_0x413cae){_0x36fdc9['push'](_0x36fdc9['shift']());}};_0x594c20(++_0x3a2e74);}(_0x4739,0xa5));var _0x9473=function(_0x599204,_0x280d9d){_0x599204=_0x599204-0x0;var _0xab27ab=_0x4739[_0x599204];return _0xab27ab;};'use strict';var Sequelize=require(_0x9473('0x0'));module['exports']={'name':{'type':Sequelize[_0x9473('0x1')],'get':function(_0x37badd){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x9473('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9473('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x9473('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9473('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9473('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9473('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9473('0x3')],'defaultValue':''},'stamp':{'type':_0x9473('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x9e3a=['exports','getDataValue','STRING','BLOB','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9e3a,0x121));var _0xa9e3=function(_0x2f1c6c,_0x1c98e5){_0x2f1c6c=_0x2f1c6c-0x0;var _0xd2a871=_0x9e3a[_0x2f1c6c];return _0xd2a871;};'use strict';var Sequelize=require(_0xa9e3('0x0'));module[_0xa9e3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x562857){return this[_0xa9e3('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xa9e3('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa9e3('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e32b857..b2cd1f2 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 _0xdfb5=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','rows','catch','show','params','keys','options','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs'];(function(_0x110d59,_0x50c4fb){var _0x2fce64=function(_0xc1dcd8){while(--_0xc1dcd8){_0x110d59['push'](_0x110d59['shift']());}};_0x2fce64(++_0x50c4fb);}(_0xdfb5,0x1f3));var _0x5dfb=function(_0x5b9c02,_0x28a7bd){_0x5b9c02=_0x5b9c02-0x0;var _0x2736fd=_0xdfb5[_0x5b9c02];return _0x2736fd;};'use strict';var pdf=require(_0x5dfb('0x0'));var emlformat=require(_0x5dfb('0x1'));var rimraf=require(_0x5dfb('0x2'));var zipdir=require(_0x5dfb('0x3'));var jsonpatch=require(_0x5dfb('0x4'));var rp=require('request-promise');var moment=require(_0x5dfb('0x5'));var BPromise=require(_0x5dfb('0x6'));var Mustache=require(_0x5dfb('0x7'));var util=require(_0x5dfb('0x8'));var path=require('path');var sox=require(_0x5dfb('0x9'));var csv=require('to-csv');var ejs=require(_0x5dfb('0xa'));var fs=require('fs');var _=require(_0x5dfb('0xb'));var squel=require(_0x5dfb('0xc'));var crypto=require(_0x5dfb('0xd'));var jsforce=require(_0x5dfb('0xe'));var deskjs=require(_0x5dfb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5dfb('0x10'));var Papa=require(_0x5dfb('0x11'));var Redis=require(_0x5dfb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5dfb('0x13'));var as=require(_0x5dfb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dfb('0x15'));var utils=require(_0x5dfb('0x16'));var config=require(_0x5dfb('0x17'));var licenseUtil=require(_0x5dfb('0x18'));var db=require(_0x5dfb('0x19'))['db'];function respondWithStatusCode(_0x16589b,_0x7d200f){_0x7d200f=_0x7d200f||0xcc;return function(_0x85917e){if(_0x85917e){return _0x16589b['sendStatus'](_0x7d200f);}return _0x16589b[_0x5dfb('0x1a')](_0x7d200f)['end']();};}function respondWithResult(_0x1877b6,_0x5cc7d9){_0x5cc7d9=_0x5cc7d9||0xc8;return function(_0x1f49d3){if(_0x1f49d3){return _0x1877b6[_0x5dfb('0x1a')](_0x5cc7d9)[_0x5dfb('0x1b')](_0x1f49d3);}};}function respondWithFilteredResult(_0x145a7e,_0xe43353){return function(_0xbc07e6){if(_0xbc07e6){var _0x280adc=_0xbc07e6['count'],_0x23e59e=_0xe43353[_0x5dfb('0x1c')],_0x4e2d63=_0xe43353[_0x5dfb('0x1c')]+_0xe43353['limit'],_0xbc9777;if(_0x4e2d63>=_0x280adc){_0x4e2d63=_0x280adc;_0xbc9777=0xc8;}else{_0xbc9777=0xce;}_0x145a7e[_0x5dfb('0x1a')](_0xbc9777);return _0x145a7e[_0x5dfb('0x1d')](_0x5dfb('0x1e'),_0x23e59e+'-'+_0x4e2d63+'/'+_0x280adc)[_0x5dfb('0x1b')](_0xbc07e6);}return null;};}function patchUpdates(_0x1933b7){return function(_0x33d05e){try{jsonpatch[_0x5dfb('0x1f')](_0x33d05e,_0x1933b7,!![]);}catch(_0x1d3dce){return BPromise[_0x5dfb('0x20')](_0x1d3dce);}return _0x33d05e[_0x5dfb('0x21')]();};}function saveUpdates(_0xbc02ee,_0x16fda8){return function(_0x4161ea){if(_0x4161ea){return _0x4161ea[_0x5dfb('0x22')](_0xbc02ee)[_0x5dfb('0x23')](function(_0x1514a5){return _0x1514a5;});}return null;};}function removeEntity(_0x45955d,_0x1eb12b){return function(_0x4c15f2){if(_0x4c15f2){return _0x4c15f2[_0x5dfb('0x24')]()['then'](function(){_0x45955d['status'](0xcc)[_0x5dfb('0x25')]();});}};}function handleEntityNotFound(_0x559080,_0x277610){return function(_0x48ad74){if(!_0x48ad74){_0x559080[_0x5dfb('0x26')](0x194);}return _0x48ad74;};}function handleError(_0x412a69,_0x4cd97e){_0x4cd97e=_0x4cd97e||0x1f4;return function(_0x3b9eb9){logger[_0x5dfb('0x27')](_0x3b9eb9['stack']);if(_0x3b9eb9[_0x5dfb('0x28')]){delete _0x3b9eb9[_0x5dfb('0x28')];}_0x412a69[_0x5dfb('0x1a')](_0x4cd97e)[_0x5dfb('0x29')](_0x3b9eb9);};}exports['index']=function(_0x563947,_0x8ebfc8){var _0x39bc32={},_0x20c686={},_0x1e4730={'count':0x0,'rows':[]};var _0x3ec810=_[_0x5dfb('0x2a')](db[_0x5dfb('0x2b')][_0x5dfb('0x2c')],function(_0x36112e){return{'name':_0x36112e['fieldName'],'type':_0x36112e['type'][_0x5dfb('0x2d')]};});_0x20c686[_0x5dfb('0x2e')]=_[_0x5dfb('0x2f')](_[_0x5dfb('0x2a')](_0x3ec810,'name'),[_0x5dfb('0x28')]);_0x20c686['query']=_['keys'](_0x563947[_0x5dfb('0x30')]);_0x20c686[_0x5dfb('0x31')]=_[_0x5dfb('0x32')](_0x20c686[_0x5dfb('0x2e')],_0x20c686['query']);_0x39bc32[_0x5dfb('0x33')]=_[_0x5dfb('0x32')](_0x20c686[_0x5dfb('0x2e')],qs[_0x5dfb('0x34')](_0x563947[_0x5dfb('0x30')][_0x5dfb('0x34')]));_0x39bc32[_0x5dfb('0x33')]=_0x39bc32[_0x5dfb('0x33')][_0x5dfb('0x35')]?_0x39bc32[_0x5dfb('0x33')]:_0x20c686['model'];if(!_0x563947[_0x5dfb('0x30')][_0x5dfb('0x36')]('nolimit')){_0x39bc32[_0x5dfb('0x37')]=qs[_0x5dfb('0x37')](_0x563947['query'][_0x5dfb('0x37')]);_0x39bc32[_0x5dfb('0x1c')]=qs[_0x5dfb('0x1c')](_0x563947[_0x5dfb('0x30')][_0x5dfb('0x1c')]);}_0x39bc32[_0x5dfb('0x38')]=qs[_0x5dfb('0x39')](_0x563947['query'][_0x5dfb('0x39')]);_0x39bc32[_0x5dfb('0x3a')]=qs['filters'](_[_0x5dfb('0x3b')](_0x563947['query'],_0x20c686[_0x5dfb('0x31')]),_0x3ec810);if(_0x563947['query'][_0x5dfb('0x3c')]){_0x39bc32[_0x5dfb('0x3a')]=_[_0x5dfb('0x3d')](_0x39bc32['where'],{'$or':_['map'](_0x3ec810,function(_0x187fb5){if(_0x187fb5[_0x5dfb('0x3e')]!==_0x5dfb('0x3f')){var _0x30ddb4={};_0x30ddb4[_0x187fb5[_0x5dfb('0x28')]]={'$like':'%'+_0x563947[_0x5dfb('0x30')][_0x5dfb('0x3c')]+'%'};return _0x30ddb4;}})});}_0x39bc32=_[_0x5dfb('0x3d')]({},_0x39bc32,_0x563947['options']);var _0x28ed04={'where':_0x39bc32[_0x5dfb('0x3a')]};return db[_0x5dfb('0x2b')][_0x5dfb('0x40')](_0x28ed04)[_0x5dfb('0x23')](function(_0x4adc3a){_0x1e4730[_0x5dfb('0x40')]=_0x4adc3a;if(_0x563947[_0x5dfb('0x30')]['includeAll']){_0x39bc32[_0x5dfb('0x41')]=[{'all':!![]}];}return db[_0x5dfb('0x2b')]['findAll'](_0x39bc32);})[_0x5dfb('0x23')](function(_0x1d5941){_0x1e4730[_0x5dfb('0x42')]=_0x1d5941;return _0x1e4730;})[_0x5dfb('0x23')](respondWithFilteredResult(_0x8ebfc8,_0x39bc32))[_0x5dfb('0x43')](handleError(_0x8ebfc8,null));};exports[_0x5dfb('0x44')]=function(_0x3c451e,_0xfc0a70){var _0x182074={'raw':!![],'where':{'id':_0x3c451e[_0x5dfb('0x45')]['id']}},_0x5177d4={};_0x5177d4[_0x5dfb('0x2e')]=_[_0x5dfb('0x46')](db[_0x5dfb('0x2b')][_0x5dfb('0x2c')]);_0x5177d4[_0x5dfb('0x30')]=_[_0x5dfb('0x46')](_0x3c451e['query']);_0x5177d4[_0x5dfb('0x31')]=_[_0x5dfb('0x32')](_0x5177d4[_0x5dfb('0x2e')],_0x5177d4[_0x5dfb('0x30')]);_0x182074[_0x5dfb('0x33')]=_[_0x5dfb('0x32')](_0x5177d4[_0x5dfb('0x2e')],qs['fields'](_0x3c451e[_0x5dfb('0x30')][_0x5dfb('0x34')]));_0x182074[_0x5dfb('0x33')]=_0x182074[_0x5dfb('0x33')][_0x5dfb('0x35')]?_0x182074['attributes']:_0x5177d4['model'];if(_0x3c451e[_0x5dfb('0x30')]['includeAll']){_0x182074[_0x5dfb('0x41')]=[{'all':!![]}];}_0x182074=_[_0x5dfb('0x3d')]({},_0x182074,_0x3c451e[_0x5dfb('0x47')]);return db[_0x5dfb('0x2b')][_0x5dfb('0x48')](_0x182074)[_0x5dfb('0x23')](handleEntityNotFound(_0xfc0a70,null))['then'](respondWithResult(_0xfc0a70,null))['catch'](handleError(_0xfc0a70,null));};exports[_0x5dfb('0x49')]=function(_0x16deb3,_0xd7ecbe){return db[_0x5dfb('0x2b')][_0x5dfb('0x49')](_0x16deb3[_0x5dfb('0x4a')],{})[_0x5dfb('0x23')](respondWithResult(_0xd7ecbe,0xc9))[_0x5dfb('0x43')](handleError(_0xd7ecbe,null));};exports[_0x5dfb('0x22')]=function(_0x4b4a05,_0x3fc5e9){if(_0x4b4a05[_0x5dfb('0x4a')]['id']){delete _0x4b4a05['body']['id'];}return db[_0x5dfb('0x2b')][_0x5dfb('0x48')]({'where':{'id':_0x4b4a05[_0x5dfb('0x45')]['id']}})[_0x5dfb('0x23')](handleEntityNotFound(_0x3fc5e9,null))[_0x5dfb('0x23')](saveUpdates(_0x4b4a05[_0x5dfb('0x4a')],null))['then'](respondWithResult(_0x3fc5e9,null))[_0x5dfb('0x43')](handleError(_0x3fc5e9,null));};exports[_0x5dfb('0x24')]=function(_0x21ae69,_0x24c5a1){return db['VoiceMailMessage'][_0x5dfb('0x48')]({'where':{'id':_0x21ae69[_0x5dfb('0x45')]['id']}})[_0x5dfb('0x23')](handleEntityNotFound(_0x24c5a1,null))[_0x5dfb('0x23')](removeEntity(_0x24c5a1,null))[_0x5dfb('0x43')](handleError(_0x24c5a1,null));};exports[_0x5dfb('0x4b')]=function(_0x5c770f,_0x236504,_0xf42d99){return db[_0x5dfb('0x2b')][_0x5dfb('0x48')]({'where':{'id':_0x5c770f[_0x5dfb('0x45')]['id']},'attributes':['id','recording','msg_id']})[_0x5dfb('0x23')](handleEntityNotFound(_0x236504,null))[_0x5dfb('0x23')](function(_0x1fe99c){if(_0x1fe99c){if(!_0x1fe99c[_0x5dfb('0x4c')]){throw new db[(_0x5dfb('0x4d'))][(_0x5dfb('0x4e'))](_0x5dfb('0x4f'));}var _0x2b1ab0={'Content-Type':_0x5dfb('0x50'),'Content-Disposition':'attachment'};if(_0x1fe99c[_0x5dfb('0x51')]){_0x2b1ab0[_0x5dfb('0x52')]=_0x5dfb('0x53')+_0x1fe99c[_0x5dfb('0x51')]+_0x5dfb('0x54');}_0x236504[_0x5dfb('0x1d')](_0x2b1ab0);return _0x236504['send'](new Buffer(_0x1fe99c[_0x5dfb('0x4c')]));}})['catch'](handleError(_0x236504,null));}; \ No newline at end of file +var _0xc908=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','type'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xc908,0x77));var _0x8c90=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0xc908[_0x2842b4];return _0x2b9521;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8c90('0x0'));var zipdir=require(_0x8c90('0x1'));var jsonpatch=require(_0x8c90('0x2'));var rp=require('request-promise');var moment=require(_0x8c90('0x3'));var BPromise=require(_0x8c90('0x4'));var Mustache=require('mustache');var util=require(_0x8c90('0x5'));var path=require(_0x8c90('0x6'));var sox=require(_0x8c90('0x7'));var csv=require(_0x8c90('0x8'));var ejs=require(_0x8c90('0x9'));var fs=require('fs');var _=require(_0x8c90('0xa'));var squel=require(_0x8c90('0xb'));var crypto=require(_0x8c90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c90('0xd'));var toCsv=require(_0x8c90('0x8'));var querystring=require(_0x8c90('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c90('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8c90('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c90('0x11'));var logger=require(_0x8c90('0x12'))(_0x8c90('0x13'));var utils=require(_0x8c90('0x14'));var config=require(_0x8c90('0x15'));var licenseUtil=require(_0x8c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21771d,_0x30715f){_0x30715f=_0x30715f||0xcc;return function(_0x1b13e9){if(_0x1b13e9){return _0x21771d[_0x8c90('0x17')](_0x30715f);}return _0x21771d[_0x8c90('0x18')](_0x30715f)[_0x8c90('0x19')]();};}function respondWithResult(_0x38cf3b,_0x2f3136){_0x2f3136=_0x2f3136||0xc8;return function(_0x223acc){if(_0x223acc){return _0x38cf3b[_0x8c90('0x18')](_0x2f3136)[_0x8c90('0x1a')](_0x223acc);}};}function respondWithFilteredResult(_0xdbe486,_0x5b8a94){return function(_0x1056ad){if(_0x1056ad){var _0x2967e5=_0x1056ad[_0x8c90('0x1b')],_0x1d4aee=_0x5b8a94['offset'],_0x527f32=_0x5b8a94[_0x8c90('0x1c')]+_0x5b8a94[_0x8c90('0x1d')],_0x3cd969;if(_0x527f32>=_0x2967e5){_0x527f32=_0x2967e5;_0x3cd969=0xc8;}else{_0x3cd969=0xce;}_0xdbe486[_0x8c90('0x18')](_0x3cd969);return _0xdbe486[_0x8c90('0x1e')](_0x8c90('0x1f'),_0x1d4aee+'-'+_0x527f32+'/'+_0x2967e5)[_0x8c90('0x1a')](_0x1056ad);}return null;};}function patchUpdates(_0x329530){return function(_0x5cd972){try{jsonpatch[_0x8c90('0x20')](_0x5cd972,_0x329530,!![]);}catch(_0x46a41a){return BPromise[_0x8c90('0x21')](_0x46a41a);}return _0x5cd972[_0x8c90('0x22')]();};}function saveUpdates(_0x5a90f5,_0x4b7af2){return function(_0x71b1bd){if(_0x71b1bd){return _0x71b1bd[_0x8c90('0x23')](_0x5a90f5)[_0x8c90('0x24')](function(_0xb96983){return _0xb96983;});}return null;};}function removeEntity(_0x1f5730,_0x4164e7){return function(_0x5263f2){if(_0x5263f2){return _0x5263f2['destroy']()['then'](function(){_0x1f5730[_0x8c90('0x18')](0xcc)[_0x8c90('0x19')]();});}};}function handleEntityNotFound(_0x11bdcb,_0x4ea976){return function(_0x58b8db){if(!_0x58b8db){_0x11bdcb[_0x8c90('0x17')](0x194);}return _0x58b8db;};}function handleError(_0x5e1c05,_0x38a72c){_0x38a72c=_0x38a72c||0x1f4;return function(_0x5c136d){logger[_0x8c90('0x25')](_0x5c136d[_0x8c90('0x26')]);if(_0x5c136d['name']){delete _0x5c136d[_0x8c90('0x27')];}_0x5e1c05[_0x8c90('0x18')](_0x38a72c)[_0x8c90('0x28')](_0x5c136d);};}exports[_0x8c90('0x29')]=function(_0xbf7ef3,_0xac61d1){var _0x3159d5={},_0x10ca2b={},_0x17160e={'count':0x0,'rows':[]};var _0x20ef3b=_['map'](db[_0x8c90('0x2a')][_0x8c90('0x2b')],function(_0x4814f2){return{'name':_0x4814f2['fieldName'],'type':_0x4814f2[_0x8c90('0x2c')][_0x8c90('0x2d')]};});_0x10ca2b[_0x8c90('0x2e')]=_['differenceBy'](_[_0x8c90('0x2f')](_0x20ef3b,_0x8c90('0x27')),[_0x8c90('0x27')]);_0x10ca2b[_0x8c90('0x30')]=_[_0x8c90('0x31')](_0xbf7ef3[_0x8c90('0x30')]);_0x10ca2b[_0x8c90('0x32')]=_[_0x8c90('0x33')](_0x10ca2b[_0x8c90('0x2e')],_0x10ca2b[_0x8c90('0x30')]);_0x3159d5[_0x8c90('0x34')]=_[_0x8c90('0x33')](_0x10ca2b[_0x8c90('0x2e')],qs[_0x8c90('0x35')](_0xbf7ef3[_0x8c90('0x30')]['fields']));_0x3159d5['attributes']=_0x3159d5[_0x8c90('0x34')][_0x8c90('0x36')]?_0x3159d5[_0x8c90('0x34')]:_0x10ca2b[_0x8c90('0x2e')];if(!_0xbf7ef3[_0x8c90('0x30')][_0x8c90('0x37')](_0x8c90('0x38'))){_0x3159d5['limit']=qs[_0x8c90('0x1d')](_0xbf7ef3['query'][_0x8c90('0x1d')]);_0x3159d5[_0x8c90('0x1c')]=qs[_0x8c90('0x1c')](_0xbf7ef3[_0x8c90('0x30')][_0x8c90('0x1c')]);}_0x3159d5[_0x8c90('0x39')]=qs[_0x8c90('0x3a')](_0xbf7ef3[_0x8c90('0x30')][_0x8c90('0x3a')]);_0x3159d5[_0x8c90('0x3b')]=qs[_0x8c90('0x32')](_['pick'](_0xbf7ef3['query'],_0x10ca2b[_0x8c90('0x32')]),_0x20ef3b);if(_0xbf7ef3[_0x8c90('0x30')]['filter']){_0x3159d5[_0x8c90('0x3b')]=_[_0x8c90('0x3c')](_0x3159d5[_0x8c90('0x3b')],{'$or':_[_0x8c90('0x2f')](_0x20ef3b,function(_0x1265ee){if(_0x1265ee[_0x8c90('0x2c')]!==_0x8c90('0x3d')){var _0x1a2ac0={};_0x1a2ac0[_0x1265ee[_0x8c90('0x27')]]={'$like':'%'+_0xbf7ef3[_0x8c90('0x30')][_0x8c90('0x3e')]+'%'};return _0x1a2ac0;}})});}_0x3159d5=_[_0x8c90('0x3c')]({},_0x3159d5,_0xbf7ef3[_0x8c90('0x3f')]);var _0xa36f8d={'where':_0x3159d5[_0x8c90('0x3b')]};return db[_0x8c90('0x2a')][_0x8c90('0x1b')](_0xa36f8d)[_0x8c90('0x24')](function(_0x2baa5a){_0x17160e[_0x8c90('0x1b')]=_0x2baa5a;if(_0xbf7ef3['query'][_0x8c90('0x40')]){_0x3159d5[_0x8c90('0x41')]=[{'all':!![]}];}return db[_0x8c90('0x2a')]['findAll'](_0x3159d5);})[_0x8c90('0x24')](function(_0x22e766){_0x17160e[_0x8c90('0x42')]=_0x22e766;return _0x17160e;})[_0x8c90('0x24')](respondWithFilteredResult(_0xac61d1,_0x3159d5))[_0x8c90('0x43')](handleError(_0xac61d1,null));};exports[_0x8c90('0x44')]=function(_0x598b43,_0x20716f){var _0x494ed9={'raw':!![],'where':{'id':_0x598b43[_0x8c90('0x45')]['id']}},_0xcb7266={};_0xcb7266[_0x8c90('0x2e')]=_[_0x8c90('0x31')](db['VoiceMailMessage'][_0x8c90('0x2b')]);_0xcb7266[_0x8c90('0x30')]=_[_0x8c90('0x31')](_0x598b43['query']);_0xcb7266[_0x8c90('0x32')]=_[_0x8c90('0x33')](_0xcb7266[_0x8c90('0x2e')],_0xcb7266[_0x8c90('0x30')]);_0x494ed9[_0x8c90('0x34')]=_['intersection'](_0xcb7266[_0x8c90('0x2e')],qs[_0x8c90('0x35')](_0x598b43[_0x8c90('0x30')][_0x8c90('0x35')]));_0x494ed9[_0x8c90('0x34')]=_0x494ed9[_0x8c90('0x34')][_0x8c90('0x36')]?_0x494ed9[_0x8c90('0x34')]:_0xcb7266[_0x8c90('0x2e')];if(_0x598b43['query']['includeAll']){_0x494ed9[_0x8c90('0x41')]=[{'all':!![]}];}_0x494ed9=_[_0x8c90('0x3c')]({},_0x494ed9,_0x598b43[_0x8c90('0x3f')]);return db[_0x8c90('0x2a')][_0x8c90('0x46')](_0x494ed9)[_0x8c90('0x24')](handleEntityNotFound(_0x20716f,null))[_0x8c90('0x24')](respondWithResult(_0x20716f,null))[_0x8c90('0x43')](handleError(_0x20716f,null));};exports['create']=function(_0x5c5057,_0x5753b2){return db[_0x8c90('0x2a')][_0x8c90('0x47')](_0x5c5057[_0x8c90('0x48')],{})[_0x8c90('0x24')](respondWithResult(_0x5753b2,0xc9))['catch'](handleError(_0x5753b2,null));};exports[_0x8c90('0x23')]=function(_0x132b05,_0x41c15e){if(_0x132b05[_0x8c90('0x48')]['id']){delete _0x132b05['body']['id'];}return db[_0x8c90('0x2a')][_0x8c90('0x46')]({'where':{'id':_0x132b05['params']['id']}})['then'](handleEntityNotFound(_0x41c15e,null))['then'](saveUpdates(_0x132b05['body'],null))[_0x8c90('0x24')](respondWithResult(_0x41c15e,null))['catch'](handleError(_0x41c15e,null));};exports[_0x8c90('0x49')]=function(_0x3811a6,_0x5135de){return db[_0x8c90('0x2a')][_0x8c90('0x46')]({'where':{'id':_0x3811a6[_0x8c90('0x45')]['id']}})[_0x8c90('0x24')](handleEntityNotFound(_0x5135de,null))[_0x8c90('0x24')](removeEntity(_0x5135de,null))[_0x8c90('0x43')](handleError(_0x5135de,null));};exports[_0x8c90('0x4a')]=function(_0x352f73,_0x15cee8,_0x320ba1){return db['VoiceMailMessage']['find']({'where':{'id':_0x352f73[_0x8c90('0x45')]['id']},'attributes':['id',_0x8c90('0x4b'),_0x8c90('0x4c')]})[_0x8c90('0x24')](handleEntityNotFound(_0x15cee8,null))[_0x8c90('0x24')](function(_0x5620b1){if(_0x5620b1){if(!_0x5620b1[_0x8c90('0x4b')]){throw new db[(_0x8c90('0x4d'))]['ValidationError'](_0x8c90('0x4e'));}var _0x19c2b2={'Content-Type':'audio/wav','Content-Disposition':_0x8c90('0x4f')};if(_0x5620b1[_0x8c90('0x4c')]){_0x19c2b2['Content-Disposition']=_0x8c90('0x50')+_0x5620b1[_0x8c90('0x4c')]+_0x8c90('0x51');}_0x15cee8[_0x8c90('0x1e')](_0x19c2b2);return _0x15cee8['send'](new Buffer(_0x5620b1[_0x8c90('0x4b')]));}})[_0x8c90('0x43')](handleError(_0x15cee8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8eaf184..e68ae38 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 _0x6961=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x6961,0xa0));var _0x1696=function(_0x3faf51,_0x4535f3){_0x3faf51=_0x3faf51-0x0;var _0x4685b7=_0x6961[_0x3faf51];return _0x4685b7;};'use strict';var _=require(_0x1696('0x0'));var util=require(_0x1696('0x1'));var logger=require('../../config/logger')(_0x1696('0x2'));var moment=require(_0x1696('0x3'));var BPromise=require(_0x1696('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1696('0x5'));var rimraf=require(_0x1696('0x6'));var config=require(_0x1696('0x7'));var attributes=require(_0x1696('0x8'));module[_0x1696('0x9')]=function(_0x56e809,_0x3af16f){return _0x56e809[_0x1696('0xa')](_0x1696('0xb'),attributes,{'tableName':_0x1696('0xc'),'paranoid':![],'indexes':[{'name':_0x1696('0xd'),'fields':[_0x1696('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdff1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xdff1,0x196));var _0x1dff=function(_0x65e2df,_0x8bda19){_0x65e2df=_0x65e2df-0x0;var _0x57f948=_0xdff1[_0x65e2df];return _0x57f948;};'use strict';var _=require(_0x1dff('0x0'));var util=require(_0x1dff('0x1'));var logger=require(_0x1dff('0x2'))(_0x1dff('0x3'));var moment=require(_0x1dff('0x4'));var BPromise=require(_0x1dff('0x5'));var rp=require(_0x1dff('0x6'));var fs=require('fs');var path=require(_0x1dff('0x7'));var rimraf=require(_0x1dff('0x8'));var config=require(_0x1dff('0x9'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x24fd03,_0x4f4660){return _0x24fd03[_0x1dff('0xa')](_0x1dff('0xb'),attributes,{'tableName':_0x1dff('0xc'),'paranoid':![],'indexes':[{'name':_0x1dff('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7200579..2896e71 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2d0ef5,_0x5621a4){var _0x550979=function(_0x23d4c7){while(--_0x23d4c7){_0x2d0ef5['push'](_0x2d0ef5['shift']());}};_0x550979(++_0x5621a4);}(_0xadb5,0xad));var _0x5adb=function(_0x24492f,_0x4eca6a){_0x24492f=_0x24492f-0x0;var _0x43e522=_0xadb5[_0x24492f];return _0x43e522;};'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']('VoiceMailMessage,\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 _0x7a54=['info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x2f01b6,_0xb923d1){_0x2f01b6=_0x2f01b6-0x0;var _0x3aea08=_0x7a54[_0x2f01b6];return _0x3aea08;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 042a0e5..2216bd4 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 _0xd332=['put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd332,0x84));var _0x2d33=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xd332[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x2d33('0x0'));var util=require(_0x2d33('0x1'));var path=require(_0x2d33('0x2'));var timeout=require(_0x2d33('0x3'));var express=require(_0x2d33('0x4'));var router=express[_0x2d33('0x5')]();var auth=require(_0x2d33('0x6'));var interaction=require(_0x2d33('0x7'));var config=require('../../config/environment');var controller=require(_0x2d33('0x8'));router[_0x2d33('0x9')]('/',auth[_0x2d33('0xa')](),controller[_0x2d33('0xb')]);router[_0x2d33('0x9')](_0x2d33('0xc'),auth['isAuthenticated'](),controller[_0x2d33('0xd')]);router[_0x2d33('0x9')](_0x2d33('0xe'),auth['isAuthenticated'](),controller[_0x2d33('0xf')]);router[_0x2d33('0x10')]('/',auth[_0x2d33('0xa')](),controller[_0x2d33('0x11')]);router['post'](_0x2d33('0xe'),auth[_0x2d33('0xa')](),controller['addSound']);router[_0x2d33('0x12')](_0x2d33('0xc'),auth[_0x2d33('0xa')](),controller[_0x2d33('0x13')]);router[_0x2d33('0x14')](_0x2d33('0xc'),auth[_0x2d33('0xa')](),controller[_0x2d33('0x15')]);router['delete'](_0x2d33('0x16'),auth[_0x2d33('0xa')](),controller[_0x2d33('0x17')]);module[_0x2d33('0x18')]=router; \ No newline at end of file +var _0xbf8e=['put','update','destroy','delete','/:id/sounds/:id2','exports','util','path','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','/:id/sounds','post','create','addSound'];(function(_0xfbda8e,_0x116e9b){var _0x38b756=function(_0x48c06d){while(--_0x48c06d){_0xfbda8e['push'](_0xfbda8e['shift']());}};_0x38b756(++_0x116e9b);}(_0xbf8e,0x9e));var _0xebf8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbf8e[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xebf8('0x0'));var path=require(_0xebf8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xebf8('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xebf8('0x3'));var controller=require(_0xebf8('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xebf8('0x5')]);router[_0xebf8('0x6')](_0xebf8('0x7'),auth[_0xebf8('0x8')](),controller['show']);router[_0xebf8('0x6')](_0xebf8('0x9'),auth['isAuthenticated'](),controller['getSounds']);router[_0xebf8('0xa')]('/',auth[_0xebf8('0x8')](),controller[_0xebf8('0xb')]);router[_0xebf8('0xa')](_0xebf8('0x9'),auth[_0xebf8('0x8')](),controller[_0xebf8('0xc')]);router[_0xebf8('0xd')](_0xebf8('0x7'),auth[_0xebf8('0x8')](),controller[_0xebf8('0xe')]);router['delete'](_0xebf8('0x7'),auth[_0xebf8('0x8')](),controller[_0xebf8('0xf')]);router[_0xebf8('0x10')](_0xebf8('0x11'),auth[_0xebf8('0x8')](),controller['removeSound']);module[_0xebf8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index dfdb39f..632db0e 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 _0x4ff5=['alpha','BOOLEAN','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x34ed52,_0xdfc291){var _0x35c8db=function(_0x1298e1){while(--_0x1298e1){_0x34ed52['push'](_0x34ed52['shift']());}};_0x35c8db(++_0xdfc291);}(_0x4ff5,0xce));var _0x54ff=function(_0x56124c,_0x259164){_0x56124c=_0x56124c-0x0;var _0x506807=_0x4ff5[_0x56124c];return _0x506807;};'use strict';var Sequelize=require('sequelize');module[_0x54ff('0x0')]={'name':{'type':Sequelize[_0x54ff('0x1')],'allowNull':![],'unique':_0x54ff('0x2')},'mode':{'type':Sequelize[_0x54ff('0x3')](_0x54ff('0x4'),_0x54ff('0x5'),_0x54ff('0x6'),_0x54ff('0x7'),_0x54ff('0x8'),_0x54ff('0x9')),'allowNull':!![],'defaultValue':_0x54ff('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x54ff('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x54ff('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x54ff('0x1')],'allowNull':!![],'defaultValue':_0x54ff('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x54ff('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8c31=['quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','files','mp3nb'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x8c31,0xdf));var _0x18c3=function(_0x507abf,_0x102de1){_0x507abf=_0x507abf-0x0;var _0x93bddf=_0x8c31[_0x507abf];return _0x93bddf;};'use strict';var Sequelize=require(_0x18c3('0x0'));module[_0x18c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x18c3('0x2')},'mode':{'type':Sequelize['ENUM']('custom',_0x18c3('0x3'),_0x18c3('0x4'),_0x18c3('0x5'),_0x18c3('0x6'),_0x18c3('0x7')),'allowNull':!![],'defaultValue':_0x18c3('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x18c3('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x18c3('0x8')],'allowNull':!![],'defaultValue':_0x18c3('0x9')},'format':{'type':Sequelize[_0x18c3('0x8')],'allowNull':!![]},'stamp':{'type':_0x18c3('0xa')},'defaultEntry':{'type':Sequelize[_0x18c3('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 2421a43..879cbee 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 _0x028b=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','end','json','count','offset','status','set','Content-Range','apply','reject','save','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','params','options','find','update','body','create','sequelize','mode','root','files','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','destroy','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','extname','%s.%s','symlinkSync','removeSound','findOne','id2','getSounds','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x13d8ad,_0x41fa42){var _0x4f07a4=function(_0x4d0a86){while(--_0x4d0a86){_0x13d8ad['push'](_0x13d8ad['shift']());}};_0x4f07a4(++_0x41fa42);}(_0x028b,0x134));var _0xb028=function(_0x150b06,_0x35d8d7){_0x150b06=_0x150b06-0x0;var _0x1a10bd=_0x028b[_0x150b06];return _0x1a10bd;};'use strict';var pdf=require(_0xb028('0x0'));var emlformat=require(_0xb028('0x1'));var rimraf=require(_0xb028('0x2'));var zipdir=require(_0xb028('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb028('0x4'));var Mustache=require('mustache');var util=require(_0xb028('0x5'));var path=require(_0xb028('0x6'));var sox=require(_0xb028('0x7'));var csv=require(_0xb028('0x8'));var ejs=require(_0xb028('0x9'));var fs=require('fs');var _=require(_0xb028('0xa'));var squel=require(_0xb028('0xb'));var crypto=require(_0xb028('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb028('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb028('0xe'));var Redis=require(_0xb028('0xf'));var authService=require(_0xb028('0x10'));var qs=require(_0xb028('0x11'));var as=require(_0xb028('0x12'));var hardwareService=require(_0xb028('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb028('0x14'));var db=require(_0xb028('0x15'))['db'];function respondWithStatusCode(_0x3832b4,_0x382e6b){_0x382e6b=_0x382e6b||0xcc;return function(_0x1767d8){if(_0x1767d8){return _0x3832b4['sendStatus'](_0x382e6b);}return _0x3832b4['status'](_0x382e6b)[_0xb028('0x16')]();};}function respondWithResult(_0x3e3cca,_0x58f556){_0x58f556=_0x58f556||0xc8;return function(_0x3297b6){if(_0x3297b6){return _0x3e3cca['status'](_0x58f556)[_0xb028('0x17')](_0x3297b6);}};}function respondWithFilteredResult(_0x2b7f10,_0x1f7bd3){return function(_0x3cfe8e){if(_0x3cfe8e){var _0x523a68=_0x3cfe8e[_0xb028('0x18')],_0x41e9df=_0x1f7bd3['offset'],_0x490d48=_0x1f7bd3[_0xb028('0x19')]+_0x1f7bd3['limit'],_0x35f107;if(_0x490d48>=_0x523a68){_0x490d48=_0x523a68;_0x35f107=0xc8;}else{_0x35f107=0xce;}_0x2b7f10[_0xb028('0x1a')](_0x35f107);return _0x2b7f10[_0xb028('0x1b')](_0xb028('0x1c'),_0x41e9df+'-'+_0x490d48+'/'+_0x523a68)[_0xb028('0x17')](_0x3cfe8e);}return null;};}function patchUpdates(_0x453a69){return function(_0x28345f){try{jsonpatch[_0xb028('0x1d')](_0x28345f,_0x453a69,!![]);}catch(_0x5870f2){return BPromise[_0xb028('0x1e')](_0x5870f2);}return _0x28345f[_0xb028('0x1f')]();};}function saveUpdates(_0x2b2f06,_0x517af4){return function(_0x71f19){if(_0x71f19){return _0x71f19['update'](_0x2b2f06)[_0xb028('0x20')](function(_0x24ac82){return _0x24ac82;});}return null;};}function removeEntity(_0x512393,_0x13b1c6){return function(_0x21fc6f){if(_0x21fc6f){return _0x21fc6f['destroy']()[_0xb028('0x20')](function(){var _0x40081e=_0x21fc6f[_0xb028('0x21')]({'plain':!![]});var _0xf693b=_0xb028('0x22');return db[_0xb028('0x23')]['destroy']({'where':{'type':_0xf693b,'resourceId':_0x40081e['id']}})[_0xb028('0x20')](function(){return _0x21fc6f;});})[_0xb028('0x20')](function(){_0x512393[_0xb028('0x1a')](0xcc)[_0xb028('0x16')]();});}};}function handleEntityNotFound(_0x2d123b,_0x2d5a1a){return function(_0x1302e4){if(!_0x1302e4){_0x2d123b['sendStatus'](0x194);}return _0x1302e4;};}function handleError(_0x3b23f2,_0x2aad75){_0x2aad75=_0x2aad75||0x1f4;return function(_0x487285){logger[_0xb028('0x24')](_0x487285[_0xb028('0x25')]);if(_0x487285[_0xb028('0x26')]){delete _0x487285['name'];}_0x3b23f2[_0xb028('0x1a')](_0x2aad75)[_0xb028('0x27')](_0x487285);};}exports[_0xb028('0x28')]=function(_0x4cb232,_0x4eb81e){var _0x10d552={},_0xbe4f5c={},_0x235156={'count':0x0,'rows':[]};var _0x18793a=_[_0xb028('0x29')](db[_0xb028('0x2a')][_0xb028('0x2b')],function(_0x45085f){return{'name':_0x45085f[_0xb028('0x2c')],'type':_0x45085f['type'][_0xb028('0x2d')]};});_0xbe4f5c['model']=_[_0xb028('0x29')](_0x18793a,_0xb028('0x26'));_0xbe4f5c[_0xb028('0x2e')]=_[_0xb028('0x2f')](_0x4cb232['query']);_0xbe4f5c[_0xb028('0x30')]=_[_0xb028('0x31')](_0xbe4f5c[_0xb028('0x32')],_0xbe4f5c[_0xb028('0x2e')]);_0x10d552['attributes']=_[_0xb028('0x31')](_0xbe4f5c[_0xb028('0x32')],qs[_0xb028('0x33')](_0x4cb232['query'][_0xb028('0x33')]));_0x10d552[_0xb028('0x34')]=_0x10d552['attributes'][_0xb028('0x35')]?_0x10d552[_0xb028('0x34')]:_0xbe4f5c[_0xb028('0x32')];if(!_0x4cb232[_0xb028('0x2e')][_0xb028('0x36')]('nolimit')){_0x10d552[_0xb028('0x37')]=qs['limit'](_0x4cb232[_0xb028('0x2e')][_0xb028('0x37')]);_0x10d552[_0xb028('0x19')]=qs[_0xb028('0x19')](_0x4cb232[_0xb028('0x2e')][_0xb028('0x19')]);}_0x10d552[_0xb028('0x38')]=qs['sort'](_0x4cb232['query'][_0xb028('0x39')]);_0x10d552[_0xb028('0x3a')]=qs['filters'](_[_0xb028('0x3b')](_0x4cb232['query'],_0xbe4f5c[_0xb028('0x30')]),_0x18793a);if(_0x4cb232[_0xb028('0x2e')][_0xb028('0x3c')]){_0x10d552[_0xb028('0x3a')]=_[_0xb028('0x3d')](_0x10d552['where'],{'$or':_[_0xb028('0x29')](_0x18793a,function(_0x5cba01){if(_0x5cba01['type']!=='VIRTUAL'){var _0x247b30={};_0x247b30[_0x5cba01['name']]={'$like':'%'+_0x4cb232[_0xb028('0x2e')][_0xb028('0x3c')]+'%'};return _0x247b30;}})});}_0x10d552=_['merge']({},_0x10d552,_0x4cb232['options']);var _0x9465ee={'where':_0x10d552[_0xb028('0x3a')]};return db[_0xb028('0x2a')][_0xb028('0x18')](_0x9465ee)[_0xb028('0x20')](function(_0x582d1a){_0x235156[_0xb028('0x18')]=_0x582d1a;if(_0x4cb232[_0xb028('0x2e')][_0xb028('0x3e')]){_0x10d552[_0xb028('0x3f')]=[{'all':!![]}];}return db[_0xb028('0x2a')]['findAll'](_0x10d552);})[_0xb028('0x20')](function(_0x648cbf){_0x235156[_0xb028('0x40')]=_0x648cbf;return _0x235156;})[_0xb028('0x20')](respondWithFilteredResult(_0x4eb81e,_0x10d552))[_0xb028('0x41')](handleError(_0x4eb81e,null));};exports['show']=function(_0x1c572c,_0x5e8e02){var _0x5b72de={'raw':![],'where':{'id':_0x1c572c[_0xb028('0x42')]['id']}},_0x540cd2={};_0x540cd2[_0xb028('0x32')]=_['keys'](db[_0xb028('0x2a')][_0xb028('0x2b')]);_0x540cd2[_0xb028('0x2e')]=_[_0xb028('0x2f')](_0x1c572c[_0xb028('0x2e')]);_0x540cd2[_0xb028('0x30')]=_['intersection'](_0x540cd2[_0xb028('0x32')],_0x540cd2['query']);_0x5b72de[_0xb028('0x34')]=_[_0xb028('0x31')](_0x540cd2[_0xb028('0x32')],qs[_0xb028('0x33')](_0x1c572c[_0xb028('0x2e')][_0xb028('0x33')]));_0x5b72de[_0xb028('0x34')]=_0x5b72de['attributes'][_0xb028('0x35')]?_0x5b72de[_0xb028('0x34')]:_0x540cd2[_0xb028('0x32')];if(_0x1c572c['query'][_0xb028('0x3e')]){_0x5b72de[_0xb028('0x3f')]=[{'all':!![]}];}_0x5b72de=_[_0xb028('0x3d')]({},_0x5b72de,_0x1c572c[_0xb028('0x43')]);return db['VoiceMusicOnHold'][_0xb028('0x44')](_0x5b72de)['then'](handleEntityNotFound(_0x5e8e02,null))[_0xb028('0x20')](respondWithResult(_0x5e8e02,null))[_0xb028('0x41')](handleError(_0x5e8e02,null));};exports[_0xb028('0x45')]=function(_0x18e833,_0x416475){if(_0x18e833[_0xb028('0x46')]['id']){delete _0x18e833[_0xb028('0x46')]['id'];}return db[_0xb028('0x2a')][_0xb028('0x44')]({'where':{'id':_0x18e833[_0xb028('0x42')]['id']}})[_0xb028('0x20')](handleEntityNotFound(_0x416475,null))[_0xb028('0x20')](saveUpdates(_0x18e833[_0xb028('0x46')],null))[_0xb028('0x20')](respondWithResult(_0x416475,null))[_0xb028('0x41')](handleError(_0x416475,null));};exports[_0xb028('0x47')]=function(_0xd5dd0c,_0x39f0fd,_0x3b60db){return db[_0xb028('0x48')]['transaction'](function(_0x1c0fc1){if(_0xd5dd0c[_0xb028('0x46')][_0xb028('0x49')]==='files'){_0xd5dd0c['body']['directory']=path['join'](config[_0xb028('0x4a')],'server/files/moh',_0xd5dd0c[_0xb028('0x46')]['name']);}return db[_0xb028('0x2a')]['create'](_0xd5dd0c[_0xb028('0x46')],{'transaction':_0x1c0fc1})[_0xb028('0x20')](function(_0x52bb2c){if(_0xd5dd0c[_0xb028('0x46')][_0xb028('0x49')]===_0xb028('0x4b')){fs[_0xb028('0x4c')](_0x52bb2c[_0xb028('0x4d')],parseInt(_0xb028('0x4e'),0x8));}var _0xd50f64=_0xd5dd0c[_0xb028('0x4f')][_0xb028('0x21')]({'plain':!![]});if(!_0xd50f64)throw new Error(_0xb028('0x50'));if(_0xd50f64[_0xb028('0x51')]===_0xb028('0x4f')){var _0x122b6a=_0x52bb2c[_0xb028('0x21')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0xd50f64['userProfileId']},'raw':!![]})[_0xb028('0x20')](function(_0x2949ed){if(_0x2949ed&&_0x2949ed[_0xb028('0x52')]===0x0){return db[_0xb028('0x23')][_0xb028('0x47')]({'name':_0x122b6a[_0xb028('0x26')],'resourceId':_0x122b6a['id'],'type':_0x2949ed[_0xb028('0x26')],'sectionId':_0x2949ed['id']},{})[_0xb028('0x20')](function(){return _0x52bb2c;});}else{return _0x52bb2c;}})['catch'](function(_0x584645){logger['error'](_0xb028('0x53'),_0x584645);});}return _0x52bb2c;});})[_0xb028('0x20')](respondWithResult(_0x39f0fd,0xc9))[_0xb028('0x41')](handleError(_0x39f0fd,null));};exports['destroy']=function(_0xcb5a30,_0x3a3485,_0x1956b5){var _0x5104bc;return db[_0xb028('0x2a')][_0xb028('0x44')]({'where':{'id':_0xcb5a30[_0xb028('0x42')]['id']}})['then'](function(_0x3954a4){if(_0x3954a4){return db[_0xb028('0x48')][_0xb028('0x54')](function(_0xddef2d){return _0x3954a4[_0xb028('0x55')]({'transaction':_0xddef2d,'raw':!![]})[_0xb028('0x20')](function(_0x517644){if(_0x517644[_0xb028('0x4d')]){fs[_0xb028('0x56')](_0x517644['directory'])['forEach'](function(_0x1cffbc){fs[_0xb028('0x57')](path[_0xb028('0x58')](_0x517644[_0xb028('0x4d')],_0x1cffbc));});fs[_0xb028('0x59')](_0x517644['directory']);}return _0x517644;});})[_0xb028('0x41')](function(_0x160fc3){throw new db[(_0xb028('0x5a'))][(_0xb028('0x5b'))](_0x160fc3[_0xb028('0x5c')]);});}})[_0xb028('0x20')](handleEntityNotFound(_0x3a3485,null))[_0xb028('0x20')](removeEntity(_0x3a3485,null))[_0xb028('0x41')](handleError(_0x3a3485,null));};exports[_0xb028('0x5d')]=function(_0x150bda,_0x4b9202,_0x4218b9){return db[_0xb028('0x48')][_0xb028('0x54')](function(_0x366bc0){var _0x3340d9;return db[_0xb028('0x2a')][_0xb028('0x44')]({'where':{'id':_0x150bda[_0xb028('0x42')]['id']}})[_0xb028('0x20')](function(_0x54d16f){if(_0x54d16f){_0x3340d9=_0x54d16f;return _0x54d16f[_0xb028('0x5d')](_0x150bda[_0xb028('0x46')]['id'],{'transaction':_0x366bc0});}})[_0xb028('0x20')](function(_0xc13e8f){if(_0xc13e8f){return db[_0xb028('0x5e')]['findOne']({'where':{'id':_0x150bda[_0xb028('0x46')]['id']},'attributes':['id',_0xb028('0x26'),_0xb028('0x5f'),_0xb028('0x60'),_0xb028('0x61')],'raw':!![]});}})[_0xb028('0x20')](function(_0x1ae88e){if(_0x1ae88e){var _0x521deb=path[_0xb028('0x58')](config['root'],_0xb028('0x62'),util[_0xb028('0x63')]('%s.%s',path['basename'](_0x1ae88e[_0xb028('0x5f')],path[_0xb028('0x64')](_0x1ae88e[_0xb028('0x5f')])),_0x1ae88e['converted_format']));var _0x15b544=path[_0xb028('0x58')](config['root'],'server/files/moh',_0x3340d9['name'],util[_0xb028('0x63')](_0xb028('0x65'),_0x1ae88e[_0xb028('0x26')],_0x1ae88e[_0xb028('0x60')]));fs[_0xb028('0x66')](_0x521deb,_0x15b544);return _0x1ae88e;}})[_0xb028('0x41')](function(_0x329a7a){throw new db['Sequelize']['ValidationError'](_0x329a7a['message']);});})['then'](handleEntityNotFound(_0x4b9202,null))[_0xb028('0x20')](respondWithResult(_0x4b9202,0xc9))['catch'](handleError(_0x4b9202,null));};exports[_0xb028('0x67')]=function(_0x1ea18b,_0x47f776,_0x12b11d){return db[_0xb028('0x48')][_0xb028('0x54')](function(_0x504157){var _0x22f535;return db['VoiceMusicOnHold'][_0xb028('0x68')]({'where':{'id':_0x1ea18b[_0xb028('0x42')]['id']}})[_0xb028('0x20')](handleEntityNotFound(_0x47f776,null))[_0xb028('0x20')](function(_0x58b44e){if(_0x58b44e){_0x22f535=_0x58b44e;return _0x58b44e['removeSound'](_0x1ea18b[_0xb028('0x42')][_0xb028('0x69')]);}})[_0xb028('0x20')](function(_0x7122b3){if(_0x7122b3){return db[_0xb028('0x5e')][_0xb028('0x68')]({'where':{'id':_0x1ea18b[_0xb028('0x42')][_0xb028('0x69')]},'attributes':['id',_0xb028('0x26'),'save_name',_0xb028('0x60'),'createdAt'],'raw':!![]});}})[_0xb028('0x20')](function(_0x5e5c81){if(_0x5e5c81){fs[_0xb028('0x57')](path['join'](_0x22f535[_0xb028('0x4d')],util[_0xb028('0x63')]('%s.%s',_0x5e5c81['name'],_0x5e5c81[_0xb028('0x60')])));return _0x5e5c81;}})[_0xb028('0x41')](function(_0x594355){throw new db[(_0xb028('0x5a'))][(_0xb028('0x5b'))](_0x594355[_0xb028('0x5c')]);});})['then'](handleEntityNotFound(_0x47f776,null))['then'](respondWithStatusCode(_0x47f776,0xcc))[_0xb028('0x41')](handleError(_0x47f776,null));};exports['getSounds']=function(_0x52a94f,_0x3f1dc1,_0x9e6285){var _0x53afb9={};var _0x4d0d22={};var _0x2dc004;var _0x3bc298;return db[_0xb028('0x2a')]['findOne']({'where':{'id':_0x52a94f[_0xb028('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f1dc1,null))[_0xb028('0x20')](function(_0x4fd173){if(_0x4fd173){_0x2dc004=_0x4fd173;_0x4d0d22['model']=_['keys'](db[_0xb028('0x5e')][_0xb028('0x2b')]);_0x4d0d22[_0xb028('0x2e')]=_['keys'](_0x52a94f['query']);_0x4d0d22[_0xb028('0x30')]=_[_0xb028('0x31')](_0x4d0d22['model'],_0x4d0d22[_0xb028('0x2e')]);_0x53afb9['attributes']=_[_0xb028('0x31')](_0x4d0d22[_0xb028('0x32')],qs['fields'](_0x52a94f[_0xb028('0x2e')]['fields']));_0x53afb9[_0xb028('0x34')]=_0x53afb9[_0xb028('0x34')][_0xb028('0x35')]?_0x53afb9[_0xb028('0x34')]:_0x4d0d22[_0xb028('0x32')];_0x53afb9[_0xb028('0x38')]=qs[_0xb028('0x39')](_0x52a94f[_0xb028('0x2e')]['sort']);_0x53afb9['where']=qs[_0xb028('0x30')](_['pick'](_0x52a94f['query'],_0x4d0d22[_0xb028('0x30')]));if(_0x52a94f['query'][_0xb028('0x3c')]){_0x53afb9['where']=_[_0xb028('0x3d')](_0x53afb9[_0xb028('0x3a')],{'$or':_[_0xb028('0x29')](_0x53afb9['attributes'],function(_0x5773b1){var _0xd72eab={};_0xd72eab[_0x5773b1]={'$like':'%'+_0x52a94f[_0xb028('0x2e')][_0xb028('0x3c')]+'%'};return _0xd72eab;})});}_0x53afb9=_[_0xb028('0x3d')]({},_0x53afb9,_0x52a94f['options']);return _0x2dc004[_0xb028('0x6a')](_0x53afb9);}})['then'](function(_0x5377d1){if(_0x5377d1){_0x3bc298=_0x5377d1[_0xb028('0x35')];if(!_0x52a94f[_0xb028('0x2e')][_0xb028('0x36')]('nolimit')){_0x53afb9[_0xb028('0x37')]=qs[_0xb028('0x37')](_0x52a94f[_0xb028('0x2e')][_0xb028('0x37')]);_0x53afb9[_0xb028('0x19')]=qs[_0xb028('0x19')](_0x52a94f[_0xb028('0x2e')][_0xb028('0x19')]);}return _0x2dc004['getSounds'](_0x53afb9);}})[_0xb028('0x20')](function(_0x9d0653){if(_0x9d0653){return _0x9d0653?{'count':_0x3bc298,'rows':_0x9d0653}:null;}})['then'](respondWithResult(_0x3f1dc1,null))['catch'](handleError(_0x3f1dc1,null));}; \ No newline at end of file +var _0x3ec1=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','count','includeAll','findAll','show','include','options','catch','body','params','create','sequelize','transaction','mode','directory','root','files','mkdirSync','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','extname','server/files/moh','symlinkSync','message','removeSound','id2','getSounds','Sound','order','pick','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0x3ec1,0x1bf));var _0x13ec=function(_0xdff6ec,_0x177300){_0xdff6ec=_0xdff6ec-0x0;var _0x3081fe=_0x3ec1[_0xdff6ec];return _0x3081fe;};'use strict';var pdf=require(_0x13ec('0x0'));var emlformat=require(_0x13ec('0x1'));var rimraf=require(_0x13ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13ec('0x3'));var rp=require(_0x13ec('0x4'));var moment=require(_0x13ec('0x5'));var BPromise=require(_0x13ec('0x6'));var Mustache=require(_0x13ec('0x7'));var util=require(_0x13ec('0x8'));var path=require(_0x13ec('0x9'));var sox=require(_0x13ec('0xa'));var csv=require(_0x13ec('0xb'));var ejs=require(_0x13ec('0xc'));var fs=require('fs');var _=require(_0x13ec('0xd'));var squel=require(_0x13ec('0xe'));var crypto=require('crypto');var jsforce=require(_0x13ec('0xf'));var deskjs=require(_0x13ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x13ec('0x11'));var Papa=require(_0x13ec('0x12'));var Redis=require(_0x13ec('0x13'));var authService=require(_0x13ec('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x13ec('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13ec('0x16'))(_0x13ec('0x17'));var utils=require(_0x13ec('0x18'));var config=require(_0x13ec('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x13ec('0x1a'))['db'];function respondWithStatusCode(_0x1082da,_0x563c70){_0x563c70=_0x563c70||0xcc;return function(_0x4f1845){if(_0x4f1845){return _0x1082da['sendStatus'](_0x563c70);}return _0x1082da[_0x13ec('0x1b')](_0x563c70)[_0x13ec('0x1c')]();};}function respondWithResult(_0x347d4b,_0x1a4fa5){_0x1a4fa5=_0x1a4fa5||0xc8;return function(_0x3008a5){if(_0x3008a5){return _0x347d4b[_0x13ec('0x1b')](_0x1a4fa5)[_0x13ec('0x1d')](_0x3008a5);}};}function respondWithFilteredResult(_0x166717,_0x112136){return function(_0x16aff7){if(_0x16aff7){var _0x2b9579=_0x16aff7['count'],_0x2e9087=_0x112136[_0x13ec('0x1e')],_0x3044e7=_0x112136['offset']+_0x112136[_0x13ec('0x1f')],_0x29e75b;if(_0x3044e7>=_0x2b9579){_0x3044e7=_0x2b9579;_0x29e75b=0xc8;}else{_0x29e75b=0xce;}_0x166717[_0x13ec('0x1b')](_0x29e75b);return _0x166717[_0x13ec('0x20')](_0x13ec('0x21'),_0x2e9087+'-'+_0x3044e7+'/'+_0x2b9579)[_0x13ec('0x1d')](_0x16aff7);}return null;};}function patchUpdates(_0x15fea6){return function(_0x30f182){try{jsonpatch[_0x13ec('0x22')](_0x30f182,_0x15fea6,!![]);}catch(_0x469294){return BPromise[_0x13ec('0x23')](_0x469294);}return _0x30f182[_0x13ec('0x24')]();};}function saveUpdates(_0x36a7c1,_0x579e9b){return function(_0x2a0621){if(_0x2a0621){return _0x2a0621[_0x13ec('0x25')](_0x36a7c1)['then'](function(_0x28cc7a){return _0x28cc7a;});}return null;};}function removeEntity(_0x3cdf40,_0x28af41){return function(_0xa31a5c){if(_0xa31a5c){return _0xa31a5c[_0x13ec('0x26')]()[_0x13ec('0x27')](function(){var _0x5d3c5d=_0xa31a5c[_0x13ec('0x28')]({'plain':!![]});var _0x2054e6=_0x13ec('0x29');return db[_0x13ec('0x2a')]['destroy']({'where':{'type':_0x2054e6,'resourceId':_0x5d3c5d['id']}})[_0x13ec('0x27')](function(){return _0xa31a5c;});})[_0x13ec('0x27')](function(){_0x3cdf40['status'](0xcc)[_0x13ec('0x1c')]();});}};}function handleEntityNotFound(_0x3aeae2,_0xbdc5b7){return function(_0x2bc0c8){if(!_0x2bc0c8){_0x3aeae2[_0x13ec('0x2b')](0x194);}return _0x2bc0c8;};}function handleError(_0x469143,_0x494484){_0x494484=_0x494484||0x1f4;return function(_0x2d8de1){logger[_0x13ec('0x2c')](_0x2d8de1[_0x13ec('0x2d')]);if(_0x2d8de1[_0x13ec('0x2e')]){delete _0x2d8de1[_0x13ec('0x2e')];}_0x469143['status'](_0x494484)['send'](_0x2d8de1);};}exports[_0x13ec('0x2f')]=function(_0x5e5461,_0xf8275c){var _0x442293={},_0x4b2d5d={},_0x3da6b2={'count':0x0,'rows':[]};var _0x445e30=_[_0x13ec('0x30')](db[_0x13ec('0x31')][_0x13ec('0x32')],function(_0x1c0723){return{'name':_0x1c0723[_0x13ec('0x33')],'type':_0x1c0723['type'][_0x13ec('0x34')]};});_0x4b2d5d['model']=_[_0x13ec('0x30')](_0x445e30,_0x13ec('0x2e'));_0x4b2d5d[_0x13ec('0x35')]=_[_0x13ec('0x36')](_0x5e5461[_0x13ec('0x35')]);_0x4b2d5d[_0x13ec('0x37')]=_[_0x13ec('0x38')](_0x4b2d5d['model'],_0x4b2d5d[_0x13ec('0x35')]);_0x442293[_0x13ec('0x39')]=_[_0x13ec('0x38')](_0x4b2d5d[_0x13ec('0x3a')],qs[_0x13ec('0x3b')](_0x5e5461[_0x13ec('0x35')][_0x13ec('0x3b')]));_0x442293[_0x13ec('0x39')]=_0x442293[_0x13ec('0x39')][_0x13ec('0x3c')]?_0x442293[_0x13ec('0x39')]:_0x4b2d5d[_0x13ec('0x3a')];if(!_0x5e5461[_0x13ec('0x35')][_0x13ec('0x3d')](_0x13ec('0x3e'))){_0x442293[_0x13ec('0x1f')]=qs['limit'](_0x5e5461['query'][_0x13ec('0x1f')]);_0x442293['offset']=qs['offset'](_0x5e5461[_0x13ec('0x35')][_0x13ec('0x1e')]);}_0x442293['order']=qs[_0x13ec('0x3f')](_0x5e5461[_0x13ec('0x35')][_0x13ec('0x3f')]);_0x442293[_0x13ec('0x40')]=qs['filters'](_['pick'](_0x5e5461[_0x13ec('0x35')],_0x4b2d5d[_0x13ec('0x37')]),_0x445e30);if(_0x5e5461['query'][_0x13ec('0x41')]){_0x442293[_0x13ec('0x40')]=_[_0x13ec('0x42')](_0x442293[_0x13ec('0x40')],{'$or':_[_0x13ec('0x30')](_0x445e30,function(_0x58b71d){if(_0x58b71d[_0x13ec('0x43')]!=='VIRTUAL'){var _0x3efff3={};_0x3efff3[_0x58b71d[_0x13ec('0x2e')]]={'$like':'%'+_0x5e5461['query'][_0x13ec('0x41')]+'%'};return _0x3efff3;}})});}_0x442293=_[_0x13ec('0x42')]({},_0x442293,_0x5e5461['options']);var _0x53117a={'where':_0x442293['where']};return db[_0x13ec('0x31')]['count'](_0x53117a)[_0x13ec('0x27')](function(_0x471ce8){_0x3da6b2[_0x13ec('0x44')]=_0x471ce8;if(_0x5e5461['query'][_0x13ec('0x45')]){_0x442293['include']=[{'all':!![]}];}return db[_0x13ec('0x31')][_0x13ec('0x46')](_0x442293);})[_0x13ec('0x27')](function(_0x31a64e){_0x3da6b2['rows']=_0x31a64e;return _0x3da6b2;})['then'](respondWithFilteredResult(_0xf8275c,_0x442293))['catch'](handleError(_0xf8275c,null));};exports[_0x13ec('0x47')]=function(_0x394431,_0xbc34b8){var _0x1c18de={'raw':![],'where':{'id':_0x394431['params']['id']}},_0x2099be={};_0x2099be[_0x13ec('0x3a')]=_['keys'](db[_0x13ec('0x31')]['rawAttributes']);_0x2099be[_0x13ec('0x35')]=_[_0x13ec('0x36')](_0x394431[_0x13ec('0x35')]);_0x2099be[_0x13ec('0x37')]=_[_0x13ec('0x38')](_0x2099be[_0x13ec('0x3a')],_0x2099be[_0x13ec('0x35')]);_0x1c18de[_0x13ec('0x39')]=_[_0x13ec('0x38')](_0x2099be[_0x13ec('0x3a')],qs[_0x13ec('0x3b')](_0x394431[_0x13ec('0x35')][_0x13ec('0x3b')]));_0x1c18de['attributes']=_0x1c18de['attributes'][_0x13ec('0x3c')]?_0x1c18de[_0x13ec('0x39')]:_0x2099be[_0x13ec('0x3a')];if(_0x394431[_0x13ec('0x35')][_0x13ec('0x45')]){_0x1c18de[_0x13ec('0x48')]=[{'all':!![]}];}_0x1c18de=_[_0x13ec('0x42')]({},_0x1c18de,_0x394431[_0x13ec('0x49')]);return db[_0x13ec('0x31')]['find'](_0x1c18de)['then'](handleEntityNotFound(_0xbc34b8,null))[_0x13ec('0x27')](respondWithResult(_0xbc34b8,null))[_0x13ec('0x4a')](handleError(_0xbc34b8,null));};exports[_0x13ec('0x25')]=function(_0xe1816e,_0x226f49){if(_0xe1816e[_0x13ec('0x4b')]['id']){delete _0xe1816e[_0x13ec('0x4b')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0xe1816e[_0x13ec('0x4c')]['id']}})[_0x13ec('0x27')](handleEntityNotFound(_0x226f49,null))[_0x13ec('0x27')](saveUpdates(_0xe1816e['body'],null))[_0x13ec('0x27')](respondWithResult(_0x226f49,null))[_0x13ec('0x4a')](handleError(_0x226f49,null));};exports[_0x13ec('0x4d')]=function(_0x177449,_0x36da52,_0x3c901c){return db[_0x13ec('0x4e')][_0x13ec('0x4f')](function(_0x82997a){if(_0x177449[_0x13ec('0x4b')][_0x13ec('0x50')]==='files'){_0x177449[_0x13ec('0x4b')][_0x13ec('0x51')]=path['join'](config[_0x13ec('0x52')],'server/files/moh',_0x177449[_0x13ec('0x4b')][_0x13ec('0x2e')]);}return db[_0x13ec('0x31')][_0x13ec('0x4d')](_0x177449['body'],{'transaction':_0x82997a})[_0x13ec('0x27')](function(_0x3c94ad){if(_0x177449['body'][_0x13ec('0x50')]===_0x13ec('0x53')){fs[_0x13ec('0x54')](_0x3c94ad[_0x13ec('0x51')],parseInt('0777',0x8));}var _0x166143=_0x177449[_0x13ec('0x55')][_0x13ec('0x28')]({'plain':!![]});if(!_0x166143)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x166143['role']===_0x13ec('0x55')){var _0x208bff=_0x3c94ad[_0x13ec('0x28')]({'plain':!![]});return db[_0x13ec('0x56')][_0x13ec('0x57')]({'where':{'name':_0x13ec('0x29'),'userProfileId':_0x166143['userProfileId']},'raw':!![]})[_0x13ec('0x27')](function(_0x5a68ae){if(_0x5a68ae&&_0x5a68ae[_0x13ec('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x208bff[_0x13ec('0x2e')],'resourceId':_0x208bff['id'],'type':_0x5a68ae[_0x13ec('0x2e')],'sectionId':_0x5a68ae['id']},{})[_0x13ec('0x27')](function(){return _0x3c94ad;});}else{return _0x3c94ad;}})[_0x13ec('0x4a')](function(_0x4c167d){logger['error'](_0x13ec('0x59'),_0x4c167d);});}return _0x3c94ad;});})[_0x13ec('0x27')](respondWithResult(_0x36da52,0xc9))[_0x13ec('0x4a')](handleError(_0x36da52,null));};exports[_0x13ec('0x26')]=function(_0x291d75,_0x38c8f1,_0x1c7754){var _0x43f3ef;return db[_0x13ec('0x31')][_0x13ec('0x57')]({'where':{'id':_0x291d75[_0x13ec('0x4c')]['id']}})['then'](function(_0x491b39){if(_0x491b39){return db[_0x13ec('0x4e')][_0x13ec('0x4f')](function(_0x33ba67){return _0x491b39[_0x13ec('0x26')]({'transaction':_0x33ba67,'raw':!![]})[_0x13ec('0x27')](function(_0x437d36){if(_0x437d36[_0x13ec('0x51')]){fs['readdirSync'](_0x437d36['directory'])[_0x13ec('0x5a')](function(_0x200037){fs[_0x13ec('0x5b')](path[_0x13ec('0x5c')](_0x437d36[_0x13ec('0x51')],_0x200037));});fs[_0x13ec('0x5d')](_0x437d36[_0x13ec('0x51')]);}return _0x437d36;});})[_0x13ec('0x4a')](function(_0x440168){throw new db[(_0x13ec('0x5e'))][(_0x13ec('0x5f'))](_0x440168['message']);});}})['then'](handleEntityNotFound(_0x38c8f1,null))[_0x13ec('0x27')](removeEntity(_0x38c8f1,null))[_0x13ec('0x4a')](handleError(_0x38c8f1,null));};exports[_0x13ec('0x60')]=function(_0x410471,_0x1fce24,_0x1957bb){return db[_0x13ec('0x4e')][_0x13ec('0x4f')](function(_0x2bc16d){var _0x52ef0c;return db[_0x13ec('0x31')]['find']({'where':{'id':_0x410471[_0x13ec('0x4c')]['id']}})[_0x13ec('0x27')](function(_0x5a4677){if(_0x5a4677){_0x52ef0c=_0x5a4677;return _0x5a4677['addSound'](_0x410471[_0x13ec('0x4b')]['id'],{'transaction':_0x2bc16d});}})[_0x13ec('0x27')](function(_0x32284b){if(_0x32284b){return db['Sound'][_0x13ec('0x61')]({'where':{'id':_0x410471[_0x13ec('0x4b')]['id']},'attributes':['id','name',_0x13ec('0x62'),_0x13ec('0x63'),_0x13ec('0x64')],'raw':!![]});}})[_0x13ec('0x27')](function(_0x445247){if(_0x445247){var _0x1729b2=path[_0x13ec('0x5c')](config[_0x13ec('0x52')],'server/files/sounds/converted',util[_0x13ec('0x65')](_0x13ec('0x66'),path[_0x13ec('0x67')](_0x445247['save_name'],path[_0x13ec('0x68')](_0x445247[_0x13ec('0x62')])),_0x445247['converted_format']));var _0x49ddb3=path[_0x13ec('0x5c')](config['root'],_0x13ec('0x69'),_0x52ef0c[_0x13ec('0x2e')],util[_0x13ec('0x65')](_0x13ec('0x66'),_0x445247[_0x13ec('0x2e')],_0x445247[_0x13ec('0x63')]));fs[_0x13ec('0x6a')](_0x1729b2,_0x49ddb3);return _0x445247;}})['catch'](function(_0x4c1352){throw new db[(_0x13ec('0x5e'))][(_0x13ec('0x5f'))](_0x4c1352[_0x13ec('0x6b')]);});})['then'](handleEntityNotFound(_0x1fce24,null))[_0x13ec('0x27')](respondWithResult(_0x1fce24,0xc9))[_0x13ec('0x4a')](handleError(_0x1fce24,null));};exports['removeSound']=function(_0x4cfd91,_0x4a575c,_0x20701b){return db[_0x13ec('0x4e')]['transaction'](function(_0x138f4a){var _0x1a276a;return db[_0x13ec('0x31')][_0x13ec('0x61')]({'where':{'id':_0x4cfd91['params']['id']}})[_0x13ec('0x27')](handleEntityNotFound(_0x4a575c,null))[_0x13ec('0x27')](function(_0x2fa14a){if(_0x2fa14a){_0x1a276a=_0x2fa14a;return _0x2fa14a[_0x13ec('0x6c')](_0x4cfd91[_0x13ec('0x4c')][_0x13ec('0x6d')]);}})[_0x13ec('0x27')](function(_0x533139){if(_0x533139){return db['Sound'][_0x13ec('0x61')]({'where':{'id':_0x4cfd91[_0x13ec('0x4c')][_0x13ec('0x6d')]},'attributes':['id',_0x13ec('0x2e'),_0x13ec('0x62'),_0x13ec('0x63'),_0x13ec('0x64')],'raw':!![]});}})[_0x13ec('0x27')](function(_0x26311b){if(_0x26311b){fs['unlinkSync'](path[_0x13ec('0x5c')](_0x1a276a['directory'],util[_0x13ec('0x65')](_0x13ec('0x66'),_0x26311b[_0x13ec('0x2e')],_0x26311b[_0x13ec('0x63')])));return _0x26311b;}})[_0x13ec('0x4a')](function(_0x575334){throw new db[(_0x13ec('0x5e'))][(_0x13ec('0x5f'))](_0x575334['message']);});})[_0x13ec('0x27')](handleEntityNotFound(_0x4a575c,null))['then'](respondWithStatusCode(_0x4a575c,0xcc))[_0x13ec('0x4a')](handleError(_0x4a575c,null));};exports[_0x13ec('0x6e')]=function(_0x125f19,_0x9f13a1,_0x6a25d2){var _0xa16e25={};var _0x3e86be={};var _0x5eebf5;var _0x1c7021;return db['VoiceMusicOnHold'][_0x13ec('0x61')]({'where':{'id':_0x125f19[_0x13ec('0x4c')]['id']}})[_0x13ec('0x27')](handleEntityNotFound(_0x9f13a1,null))[_0x13ec('0x27')](function(_0x553d97){if(_0x553d97){_0x5eebf5=_0x553d97;_0x3e86be[_0x13ec('0x3a')]=_[_0x13ec('0x36')](db[_0x13ec('0x6f')][_0x13ec('0x32')]);_0x3e86be[_0x13ec('0x35')]=_[_0x13ec('0x36')](_0x125f19[_0x13ec('0x35')]);_0x3e86be[_0x13ec('0x37')]=_[_0x13ec('0x38')](_0x3e86be[_0x13ec('0x3a')],_0x3e86be[_0x13ec('0x35')]);_0xa16e25[_0x13ec('0x39')]=_[_0x13ec('0x38')](_0x3e86be[_0x13ec('0x3a')],qs[_0x13ec('0x3b')](_0x125f19[_0x13ec('0x35')][_0x13ec('0x3b')]));_0xa16e25[_0x13ec('0x39')]=_0xa16e25[_0x13ec('0x39')][_0x13ec('0x3c')]?_0xa16e25[_0x13ec('0x39')]:_0x3e86be['model'];_0xa16e25[_0x13ec('0x70')]=qs[_0x13ec('0x3f')](_0x125f19[_0x13ec('0x35')][_0x13ec('0x3f')]);_0xa16e25[_0x13ec('0x40')]=qs[_0x13ec('0x37')](_[_0x13ec('0x71')](_0x125f19['query'],_0x3e86be[_0x13ec('0x37')]));if(_0x125f19[_0x13ec('0x35')][_0x13ec('0x41')]){_0xa16e25['where']=_['merge'](_0xa16e25[_0x13ec('0x40')],{'$or':_[_0x13ec('0x30')](_0xa16e25[_0x13ec('0x39')],function(_0x2e345a){var _0x3ee542={};_0x3ee542[_0x2e345a]={'$like':'%'+_0x125f19['query']['filter']+'%'};return _0x3ee542;})});}_0xa16e25=_[_0x13ec('0x42')]({},_0xa16e25,_0x125f19['options']);return _0x5eebf5['getSounds'](_0xa16e25);}})['then'](function(_0x491f2e){if(_0x491f2e){_0x1c7021=_0x491f2e[_0x13ec('0x3c')];if(!_0x125f19[_0x13ec('0x35')][_0x13ec('0x3d')](_0x13ec('0x3e'))){_0xa16e25[_0x13ec('0x1f')]=qs[_0x13ec('0x1f')](_0x125f19[_0x13ec('0x35')]['limit']);_0xa16e25[_0x13ec('0x1e')]=qs[_0x13ec('0x1e')](_0x125f19[_0x13ec('0x35')]['offset']);}return _0x5eebf5[_0x13ec('0x6e')](_0xa16e25);}})['then'](function(_0x5a048c){if(_0x5a048c){return _0x5a048c?{'count':_0x1c7021,'rows':_0x5a048c}:null;}})[_0x13ec('0x27')](respondWithResult(_0x9f13a1,null))[_0x13ec('0x4a')](handleError(_0x9f13a1,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ab4355d..d622ed1 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 _0x9a41=['api','moment','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash'];(function(_0x44da26,_0x11cea6){var _0x131c9b=function(_0x25ab52){while(--_0x25ab52){_0x44da26['push'](_0x44da26['shift']());}};_0x131c9b(++_0x11cea6);}(_0x9a41,0xb3));var _0x19a4=function(_0x5b7227,_0x465a47){_0x5b7227=_0x5b7227-0x0;var _0x5407ac=_0x9a41[_0x5b7227];return _0x5407ac;};'use strict';var _=require(_0x19a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19a4('0x1'));var moment=require(_0x19a4('0x2'));var BPromise=require('bluebird');var rp=require(_0x19a4('0x3'));var fs=require('fs');var path=require(_0x19a4('0x4'));var rimraf=require('rimraf');var config=require(_0x19a4('0x5'));var attributes=require(_0x19a4('0x6'));module[_0x19a4('0x7')]=function(_0x8fc347,_0x4d90f9){return _0x8fc347[_0x19a4('0x8')](_0x19a4('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde12=['../../config/logger','api','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash','util'];(function(_0x57c62c,_0x17c1b2){var _0x53f1fb=function(_0x21ccb5){while(--_0x21ccb5){_0x57c62c['push'](_0x57c62c['shift']());}};_0x53f1fb(++_0x17c1b2);}(_0xde12,0xf8));var _0x2de1=function(_0x1a515e,_0x32fd63){_0x1a515e=_0x1a515e-0x0;var _0x3af63a=_0xde12[_0x1a515e];return _0x3af63a;};'use strict';var _=require(_0x2de1('0x0'));var util=require(_0x2de1('0x1'));var logger=require(_0x2de1('0x2'))(_0x2de1('0x3'));var moment=require('moment');var BPromise=require(_0x2de1('0x4'));var rp=require(_0x2de1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2de1('0x6'));var config=require('../../config/environment');var attributes=require(_0x2de1('0x7'));module['exports']=function(_0x382fcf,_0x55331d){return _0x382fcf[_0x2de1('0x8')](_0x2de1('0x9'),attributes,{'tableName':'voice_musiconhold','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 26b0f6d..e4867e7 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 _0x5bb9=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x5bb9,0x7d));var _0x95bb=function(_0x491423,_0x1b011c){_0x491423=_0x491423-0x0;var _0x4e78f7=_0x5bb9[_0x491423];return _0x4e78f7;};'use strict';var _=require('lodash');var util=require(_0x95bb('0x0'));var moment=require(_0x95bb('0x1'));var BPromise=require(_0x95bb('0x2'));var rs=require(_0x95bb('0x3'));var fs=require('fs');var Redis=require(_0x95bb('0x4'));var db=require(_0x95bb('0x5'))['db'];var utils=require(_0x95bb('0x6'));var logger=require(_0x95bb('0x7'))(_0x95bb('0x8'));var config=require(_0x95bb('0x9'));var jayson=require(_0x95bb('0xa'));var client=jayson['client'][_0x95bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25fc08,_0x477489,_0xaa3e33){return new BPromise(function(_0x1202a2,_0x59a5bb){return client[_0x95bb('0xc')](_0x25fc08,_0xaa3e33)[_0x95bb('0xd')](function(_0x10f321){logger[_0x95bb('0xe')](_0x95bb('0xf'),_0x477489,_0x95bb('0x10'));logger[_0x95bb('0x11')](_0x95bb('0x12'),_0x477489,_0x95bb('0x10'),JSON[_0x95bb('0x13')](_0x10f321));if(_0x10f321[_0x95bb('0x14')]){if(_0x10f321[_0x95bb('0x14')][_0x95bb('0x15')]===0x1f4){logger[_0x95bb('0x14')](_0x95bb('0xf'),_0x477489,_0x10f321[_0x95bb('0x14')][_0x95bb('0x16')]);return _0x59a5bb(_0x10f321['error'][_0x95bb('0x16')]);}logger[_0x95bb('0x14')](_0x95bb('0xf'),_0x477489,_0x10f321[_0x95bb('0x14')][_0x95bb('0x16')]);return _0x1202a2(_0x10f321[_0x95bb('0x14')][_0x95bb('0x16')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x477489,_0x95bb('0x10'));_0x1202a2(_0x10f321[_0x95bb('0x17')][_0x95bb('0x16')]);}})['catch'](function(_0x451c1b){logger[_0x95bb('0x14')](_0x95bb('0xf'),_0x477489,_0x451c1b);_0x59a5bb(_0x451c1b);});});} \ No newline at end of file +var _0xa6dc=['VoiceMusicOnHold,\x20%s,\x20%s','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1cb4fa,_0xdcc088){var _0x73b45b=function(_0x47738a){while(--_0x47738a){_0x1cb4fa['push'](_0x1cb4fa['shift']());}};_0x73b45b(++_0xdcc088);}(_0xa6dc,0x8c));var _0xca6d=function(_0x835934,_0x3e03f7){_0x835934=_0x835934-0x0;var _0x28253d=_0xa6dc[_0x835934];return _0x28253d;};'use strict';var _=require('lodash');var util=require(_0xca6d('0x0'));var moment=require(_0xca6d('0x1'));var BPromise=require(_0xca6d('0x2'));var rs=require(_0xca6d('0x3'));var fs=require('fs');var Redis=require(_0xca6d('0x4'));var db=require(_0xca6d('0x5'))['db'];var utils=require(_0xca6d('0x6'));var logger=require('../../config/logger')(_0xca6d('0x7'));var config=require(_0xca6d('0x8'));var jayson=require(_0xca6d('0x9'));var client=jayson[_0xca6d('0xa')][_0xca6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aa613,_0x5df286,_0x485797){return new BPromise(function(_0x10189e,_0x3917ac){return client[_0xca6d('0xc')](_0x1aa613,_0x485797)['then'](function(_0x27bf93){logger[_0xca6d('0xd')](_0xca6d('0xe'),_0x5df286,'request\x20sent');logger['debug'](_0xca6d('0xf'),_0x5df286,'request\x20sent',JSON[_0xca6d('0x10')](_0x27bf93));if(_0x27bf93[_0xca6d('0x11')]){if(_0x27bf93[_0xca6d('0x11')][_0xca6d('0x12')]===0x1f4){logger['error'](_0xca6d('0xe'),_0x5df286,_0x27bf93[_0xca6d('0x11')]['message']);return _0x3917ac(_0x27bf93[_0xca6d('0x11')]['message']);}logger['error'](_0xca6d('0xe'),_0x5df286,_0x27bf93[_0xca6d('0x11')][_0xca6d('0x13')]);return _0x10189e(_0x27bf93[_0xca6d('0x11')][_0xca6d('0x13')]);}else{logger[_0xca6d('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5df286,_0xca6d('0x14'));_0x10189e(_0x27bf93[_0xca6d('0x15')][_0xca6d('0x13')]);}})['catch'](function(_0x2e2c54){logger[_0xca6d('0x11')](_0xca6d('0xe'),_0x5df286,_0x2e2c54);_0x3917ac(_0x2e2c54);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 034030d..c188ce0 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 _0x5fc4=['destroy','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/users','getAgents','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5fc4,0x1dd));var _0x45fc=function(_0x38c61b,_0x3c2945){_0x38c61b=_0x38c61b-0x0;var _0x28b8e6=_0x5fc4[_0x38c61b];return _0x28b8e6;};'use strict';var multer=require('multer');var util=require(_0x45fc('0x0'));var path=require('path');var timeout=require(_0x45fc('0x1'));var express=require(_0x45fc('0x2'));var router=express[_0x45fc('0x3')]();var auth=require(_0x45fc('0x4'));var interaction=require(_0x45fc('0x5'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x45fc('0x6')]('/',auth[_0x45fc('0x7')](),controller[_0x45fc('0x8')]);router[_0x45fc('0x6')]('/describe',auth[_0x45fc('0x7')](),controller['describe']);router[_0x45fc('0x6')](_0x45fc('0x9'),auth['isAuthenticated'](),controller[_0x45fc('0xa')]);router[_0x45fc('0x6')](_0x45fc('0xb'),auth[_0x45fc('0x7')](),controller[_0x45fc('0xc')]);router[_0x45fc('0xd')]('/',auth[_0x45fc('0x7')](),controller[_0x45fc('0xe')]);router['post'](_0x45fc('0xb'),auth['isAuthenticated'](),controller['addAgents']);router[_0x45fc('0xf')](_0x45fc('0x9'),auth[_0x45fc('0x7')](),controller[_0x45fc('0x10')]);router['delete'](_0x45fc('0x9'),auth[_0x45fc('0x7')](),controller[_0x45fc('0x11')]);router[_0x45fc('0x12')](_0x45fc('0xb'),auth[_0x45fc('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x11f9=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','describe','get','/:id','show','/:id/users','getAgents','post','create','put','update','delete','removeAgents','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11f9,0xe6));var _0x911f=function(_0x35bded,_0xde51e3){_0x35bded=_0x35bded-0x0;var _0x1becbc=_0x11f9[_0x35bded];return _0x1becbc;};'use strict';var multer=require(_0x911f('0x0'));var util=require(_0x911f('0x1'));var path=require(_0x911f('0x2'));var timeout=require(_0x911f('0x3'));var express=require('express');var router=express[_0x911f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x911f('0x5'));var config=require(_0x911f('0x6'));var controller=require(_0x911f('0x7'));router['get']('/',auth[_0x911f('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x911f('0x9')]);router[_0x911f('0xa')](_0x911f('0xb'),auth['isAuthenticated'](),controller[_0x911f('0xc')]);router[_0x911f('0xa')](_0x911f('0xd'),auth[_0x911f('0x8')](),controller[_0x911f('0xe')]);router[_0x911f('0xf')]('/',auth[_0x911f('0x8')](),controller[_0x911f('0x10')]);router[_0x911f('0xf')](_0x911f('0xd'),auth[_0x911f('0x8')](),controller['addAgents']);router[_0x911f('0x11')](_0x911f('0xb'),auth[_0x911f('0x8')](),controller[_0x911f('0x12')]);router[_0x911f('0x13')](_0x911f('0xb'),auth[_0x911f('0x8')](),controller['destroy']);router['delete'](_0x911f('0xd'),auth[_0x911f('0x8')](),controller[_0x911f('0x14')]);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 0273ac0..235b46d 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 _0x9ff2=['INTEGER','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x4b490c,_0x3f1444){var _0x4a27c6=function(_0x4ea217){while(--_0x4ea217){_0x4b490c['push'](_0x4b490c['shift']());}};_0x4a27c6(++_0x3f1444);}(_0x9ff2,0x14a));var _0x29ff=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9ff2[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x29ff('0x0'));module[_0x29ff('0x1')]={'name':{'type':Sequelize[_0x29ff('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x29ff('0x3')],'get':function(_0x13fabb){return _0x29ff('0x4')+this[_0x29ff('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x29ff('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x29ff('0x6')]}}; \ No newline at end of file +var _0xfb07=['VIRTUAL','system-','getDataValue','STRING','sequelize','exports'];(function(_0x43a0b0,_0x4a9c41){var _0x96c795=function(_0x488134){while(--_0x488134){_0x43a0b0['push'](_0x43a0b0['shift']());}};_0x96c795(++_0x4a9c41);}(_0xfb07,0xa0));var _0x7fb0=function(_0xa450,_0x3040ac){_0xa450=_0xa450-0x0;var _0x3ca9ae=_0xfb07[_0xa450];return _0x3ca9ae;};'use strict';var Sequelize=require(_0x7fb0('0x0'));module[_0x7fb0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x7fb0('0x2')],'get':function(_0x18cc7b){return _0x7fb0('0x3')+this[_0x7fb0('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x7fb0('0x5')]},'callerIdAll':{'type':Sequelize[_0x7fb0('0x5')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 75f2f4a..4525a74 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 _0xf96b=['ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','pick','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','context','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','CDR(prefix)=','callerIdAll','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xf96b,0x109));var _0xbf96=function(_0x288373,_0x58052a){_0x288373=_0x288373-0x0;var _0x102d76=_0xf96b[_0x288373];return _0x102d76;};'use strict';var pdf=require(_0xbf96('0x0'));var emlformat=require(_0xbf96('0x1'));var rimraf=require(_0xbf96('0x2'));var zipdir=require(_0xbf96('0x3'));var jsonpatch=require(_0xbf96('0x4'));var rp=require(_0xbf96('0x5'));var moment=require(_0xbf96('0x6'));var BPromise=require(_0xbf96('0x7'));var Mustache=require(_0xbf96('0x8'));var util=require(_0xbf96('0x9'));var path=require(_0xbf96('0xa'));var sox=require(_0xbf96('0xb'));var csv=require(_0xbf96('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf96('0xd'));var squel=require(_0xbf96('0xe'));var crypto=require(_0xbf96('0xf'));var jsforce=require(_0xbf96('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbf96('0xc'));var querystring=require(_0xbf96('0x11'));var Papa=require(_0xbf96('0x12'));var Redis=require(_0xbf96('0x13'));var authService=require(_0xbf96('0x14'));var qs=require(_0xbf96('0x15'));var as=require(_0xbf96('0x16'));var hardwareService=require(_0xbf96('0x17'));var logger=require('../../config/logger')(_0xbf96('0x18'));var utils=require(_0xbf96('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbf96('0x1a'));var db=require(_0xbf96('0x1b'))['db'];config[_0xbf96('0x1c')]=_['defaults'](config[_0xbf96('0x1c')],{'host':_0xbf96('0x1d'),'port':0x18eb});var socket=require(_0xbf96('0x1e'))(new Redis(config[_0xbf96('0x1c')]));require(_0xbf96('0x1f'))[_0xbf96('0x20')](socket);function respondWithStatusCode(_0x59c141,_0x186a1c){_0x186a1c=_0x186a1c||0xcc;return function(_0x218dfc){if(_0x218dfc){return _0x59c141[_0xbf96('0x21')](_0x186a1c);}return _0x59c141[_0xbf96('0x22')](_0x186a1c)[_0xbf96('0x23')]();};}function respondWithResult(_0xbb399b,_0x18d09c){_0x18d09c=_0x18d09c||0xc8;return function(_0x5c5a5e){if(_0x5c5a5e){return _0xbb399b[_0xbf96('0x22')](_0x18d09c)['json'](_0x5c5a5e);}};}function respondWithFilteredResult(_0x41254f,_0x1c2cdf){return function(_0x568425){if(_0x568425){var _0x1e9707=_0x568425[_0xbf96('0x24')],_0x64b2f9=_0x1c2cdf[_0xbf96('0x25')],_0x597e5d=_0x1c2cdf[_0xbf96('0x25')]+_0x1c2cdf[_0xbf96('0x26')],_0x3bc6cb;if(_0x597e5d>=_0x1e9707){_0x597e5d=_0x1e9707;_0x3bc6cb=0xc8;}else{_0x3bc6cb=0xce;}_0x41254f[_0xbf96('0x22')](_0x3bc6cb);return _0x41254f[_0xbf96('0x27')]('Content-Range',_0x64b2f9+'-'+_0x597e5d+'/'+_0x1e9707)[_0xbf96('0x28')](_0x568425);}return null;};}function patchUpdates(_0x4f769b){return function(_0xa44474){try{jsonpatch[_0xbf96('0x29')](_0xa44474,_0x4f769b,!![]);}catch(_0x11bd93){return BPromise['reject'](_0x11bd93);}return _0xa44474[_0xbf96('0x2a')]();};}function saveUpdates(_0x55025c,_0xe12df8){return function(_0x29626d){if(_0x29626d){return _0x29626d[_0xbf96('0x2b')](_0x55025c)['then'](function(_0x1c92f9){return _0x1c92f9;});}return null;};}function removeEntity(_0xf132af,_0x5f1385){return function(_0x496cef){if(_0x496cef){return _0x496cef[_0xbf96('0x2c')]()[_0xbf96('0x2d')](function(){var _0x363379=_0x496cef['get']({'plain':!![]});var _0x527558='VoicePrefixes';return db['UserProfileResource'][_0xbf96('0x2c')]({'where':{'type':_0x527558,'resourceId':_0x363379['id']}})[_0xbf96('0x2d')](function(){return _0x496cef;});})[_0xbf96('0x2d')](function(){_0xf132af[_0xbf96('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2f86,_0x3373c0){return function(_0x278319){if(!_0x278319){_0x3c2f86[_0xbf96('0x21')](0x194);}return _0x278319;};}function handleError(_0x5e99b3,_0x59edc6){_0x59edc6=_0x59edc6||0x1f4;return function(_0x16a659){logger[_0xbf96('0x2e')](_0x16a659[_0xbf96('0x2f')]);if(_0x16a659[_0xbf96('0x30')]){delete _0x16a659[_0xbf96('0x30')];}_0x5e99b3[_0xbf96('0x22')](_0x59edc6)[_0xbf96('0x31')](_0x16a659);};}exports[_0xbf96('0x32')]=function(_0x4da3e6,_0x2725cf){var _0x24eef8={},_0x29fcde={},_0x5b0b80={'count':0x0,'rows':[]};var _0x4a8135=_[_0xbf96('0x33')](db['VoicePrefix'][_0xbf96('0x34')],function(_0x44bed8){return{'name':_0x44bed8[_0xbf96('0x35')],'type':_0x44bed8[_0xbf96('0x36')][_0xbf96('0x37')]};});_0x29fcde[_0xbf96('0x38')]=_[_0xbf96('0x33')](_0x4a8135,_0xbf96('0x30'));_0x29fcde[_0xbf96('0x39')]=_['keys'](_0x4da3e6[_0xbf96('0x39')]);_0x29fcde['filters']=_[_0xbf96('0x3a')](_0x29fcde[_0xbf96('0x38')],_0x29fcde[_0xbf96('0x39')]);_0x24eef8['attributes']=_[_0xbf96('0x3a')](_0x29fcde[_0xbf96('0x38')],qs[_0xbf96('0x3b')](_0x4da3e6[_0xbf96('0x39')][_0xbf96('0x3b')]));_0x24eef8[_0xbf96('0x3c')]=_0x24eef8[_0xbf96('0x3c')][_0xbf96('0x3d')]?_0x24eef8['attributes']:_0x29fcde[_0xbf96('0x38')];if(!_0x4da3e6['query'][_0xbf96('0x3e')](_0xbf96('0x3f'))){_0x24eef8[_0xbf96('0x26')]=qs[_0xbf96('0x26')](_0x4da3e6[_0xbf96('0x39')]['limit']);_0x24eef8[_0xbf96('0x25')]=qs['offset'](_0x4da3e6[_0xbf96('0x39')][_0xbf96('0x25')]);}_0x24eef8[_0xbf96('0x40')]=qs[_0xbf96('0x41')](_0x4da3e6[_0xbf96('0x39')][_0xbf96('0x41')]);_0x24eef8['where']=qs[_0xbf96('0x42')](_['pick'](_0x4da3e6[_0xbf96('0x39')],_0x29fcde[_0xbf96('0x42')]),_0x4a8135);if(_0x4da3e6[_0xbf96('0x39')]['filter']){_0x24eef8[_0xbf96('0x43')]=_[_0xbf96('0x44')](_0x24eef8[_0xbf96('0x43')],{'$or':_['map'](_0x4a8135,function(_0x1b84ad){if(_0x1b84ad[_0xbf96('0x36')]!==_0xbf96('0x45')){var _0x3fb731={};_0x3fb731[_0x1b84ad[_0xbf96('0x30')]]={'$like':'%'+_0x4da3e6[_0xbf96('0x39')][_0xbf96('0x46')]+'%'};return _0x3fb731;}})});}_0x24eef8=_['merge']({},_0x24eef8,_0x4da3e6[_0xbf96('0x47')]);var _0x3748ef={'where':_0x24eef8['where']};return db[_0xbf96('0x48')][_0xbf96('0x24')](_0x3748ef)[_0xbf96('0x2d')](function(_0x1472df){_0x5b0b80['count']=_0x1472df;if(_0x4da3e6[_0xbf96('0x39')][_0xbf96('0x49')]){_0x24eef8[_0xbf96('0x4a')]=[{'all':!![]}];}return db[_0xbf96('0x48')][_0xbf96('0x4b')](_0x24eef8);})[_0xbf96('0x2d')](function(_0x59af62){_0x5b0b80['rows']=_0x59af62;return _0x5b0b80;})[_0xbf96('0x2d')](respondWithFilteredResult(_0x2725cf,_0x24eef8))[_0xbf96('0x4c')](handleError(_0x2725cf,null));};exports[_0xbf96('0x4d')]=function(_0x52cfad,_0x24e023){var _0x1a453c={'raw':![],'where':{'id':_0x52cfad[_0xbf96('0x4e')]['id']}},_0x2f5316={};_0x2f5316[_0xbf96('0x38')]=_[_0xbf96('0x4f')](db[_0xbf96('0x48')][_0xbf96('0x34')]);_0x2f5316[_0xbf96('0x39')]=_['keys'](_0x52cfad[_0xbf96('0x39')]);_0x2f5316['filters']=_['intersection'](_0x2f5316[_0xbf96('0x38')],_0x2f5316['query']);_0x1a453c[_0xbf96('0x3c')]=_['intersection'](_0x2f5316[_0xbf96('0x38')],qs[_0xbf96('0x3b')](_0x52cfad[_0xbf96('0x39')]['fields']));_0x1a453c[_0xbf96('0x3c')]=_0x1a453c[_0xbf96('0x3c')]['length']?_0x1a453c[_0xbf96('0x3c')]:_0x2f5316['model'];if(_0x52cfad[_0xbf96('0x39')][_0xbf96('0x49')]){_0x1a453c[_0xbf96('0x4a')]=[{'all':!![]}];}_0x1a453c=_[_0xbf96('0x44')]({},_0x1a453c,_0x52cfad[_0xbf96('0x47')]);return db[_0xbf96('0x48')]['find'](_0x1a453c)[_0xbf96('0x2d')](handleEntityNotFound(_0x24e023,null))[_0xbf96('0x2d')](respondWithResult(_0x24e023,null))[_0xbf96('0x4c')](handleError(_0x24e023,null));};exports['destroy']=function(_0x49d930,_0x1908a1){return db[_0xbf96('0x48')][_0xbf96('0x50')]({'where':{'id':_0x49d930[_0xbf96('0x4e')]['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x1908a1,null))['then'](removeEntity(_0x1908a1,null))[_0xbf96('0x4c')](handleError(_0x1908a1,null));};exports[_0xbf96('0x51')]=function(_0x21d42f,_0x32bb47){return db['VoicePrefix']['describe']()[_0xbf96('0x2d')](respondWithResult(_0x32bb47,null))[_0xbf96('0x4c')](handleError(_0x32bb47,null));};exports[_0xbf96('0x52')]=function(_0x5c79af,_0x186b6f){var _0x478fcd;return db['sequelize'][_0xbf96('0x53')](function(_0x32cca5){return db[_0xbf96('0x48')][_0xbf96('0x52')](_0x5c79af[_0xbf96('0x54')],{'transaction':_0x32cca5})['then'](function(_0x445887){_0x478fcd=_0x445887[_0xbf96('0x55')]({'plain':!![]});return db[_0xbf96('0x56')][_0xbf96('0x50')]({'where':{'id':_0x478fcd[_0xbf96('0x57')]},'raw':!![]})[_0xbf96('0x2d')](function(_0x22afd8){return createVoicePrefixExtensions(_0x478fcd,_0x22afd8,_0x32cca5);});});})[_0xbf96('0x2d')](function(){var _0x1e5329=_0x5c79af[_0xbf96('0x58')]['get']({'plain':!![]});if(!_0x1e5329)throw new Error(_0xbf96('0x59'));if(_0x1e5329['role']===_0xbf96('0x58')){var _0x210f77=_0x478fcd;return db[_0xbf96('0x5a')][_0xbf96('0x50')]({'where':{'name':_0xbf96('0x5b'),'userProfileId':_0x1e5329[_0xbf96('0x5c')]},'raw':!![]})[_0xbf96('0x2d')](function(_0x563793){if(_0x563793&&_0x563793['autoAssociation']===0x0){return db['UserProfileResource'][_0xbf96('0x52')]({'name':_0x210f77[_0xbf96('0x30')],'resourceId':_0x210f77['id'],'type':_0x563793[_0xbf96('0x30')],'sectionId':_0x563793['id']},{})[_0xbf96('0x2d')](function(){return _0x478fcd;});}else{return _0x478fcd;}})[_0xbf96('0x4c')](function(_0x36135d){logger[_0xbf96('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36135d);throw _0x36135d;});}return _0x478fcd;})[_0xbf96('0x2d')](respondWithResult(_0x186b6f,null))[_0xbf96('0x4c')](handleError(_0x186b6f,null));};function Extension(_0x56c5cd,_0x4e8f93,_0x4cd661,_0x2dfc05){this[_0xbf96('0x5d')]='from-sip';this['exten']=_0x56c5cd;this[_0xbf96('0x5e')]=_0x4cd661;this['type']=_0xbf96('0x5f');this[_0xbf96('0x60')]='Voice\x20Prefix\x20Extension';this[_0xbf96('0x61')]=_0x4e8f93;this[_0xbf96('0x62')]=_0x2dfc05;}function createVoicePrefixExtensions(_0x17ff4e,_0xa60efb,_0x11b4bf){return new BPromise(function(_0x33c53e,_0x6b7284){var _0x33e39d=new Extension(formatPrefixName(_0x17ff4e[_0xbf96('0x63')]),0x1,_0xbf96('0x64'),_0xbf96('0x65'));_0x33e39d[_0xbf96('0x66')]=_0x17ff4e['id'];return db[_0xbf96('0x56')]['create'](_0x33e39d,{'transaction':_0x11b4bf})['then'](function(_0x5587a2){var _0x5515fc=_0x5587a2['get']({'plain':!![]});var _0x463e55=_[_0xbf96('0x33')](addVoicePrefixExtensions(_0x17ff4e,_0xa60efb),function(_0x261a6b){_0x261a6b[_0xbf96('0x57')]=_0x5515fc['id'];_0x261a6b['VoicePrefixId']=_0x17ff4e['id'];return _0x261a6b;});return db[_0xbf96('0x56')][_0xbf96('0x67')](_0x463e55,{'transaction':_0x11b4bf})[_0xbf96('0x2d')](function(_0x2e49bd){if(!_0x2e49bd){return _0x6b7284('Extensions\x20creation\x20failed');}else{return _0x33c53e(_0x2e49bd);}})['catch'](function(_0x1c5023){return _0x6b7284(_0x1c5023);});});;});};function addVoicePrefixExtensions(_0xc24f9d,_0x2e6576){var _0xfe64f4=[];var _0x32862e=formatPrefixName(_0xc24f9d[_0xbf96('0x63')]);_0xfe64f4['push'](new Extension(_0x32862e,0x2,'Set',_0xbf96('0x68')+_0xc24f9d[_0xbf96('0x30')]));if(_0xc24f9d[_0xbf96('0x69')]){_0xfe64f4[_0xbf96('0x6a')](new Extension(_0x32862e,0x3,_0xbf96('0x6b'),_0xbf96('0x6c')+_0xc24f9d[_0xbf96('0x69')]));}else{_0xfe64f4[_0xbf96('0x6a')](new Extension(_0x32862e,0x3,_0xbf96('0x64'),_0xbf96('0x6d')));}_0xfe64f4[_0xbf96('0x6a')](new Extension(_0x32862e,0x4,_0xbf96('0x6e'),_0x2e6576[_0xbf96('0x5d')]+','+_0xbf96('0x6f')+(0x8+_0xc24f9d[_0xbf96('0x30')][_0xbf96('0x3d')])+'}'+','+0x1));return _0xfe64f4;}function formatPrefixName(_0xcbd59f){var _0x51051e='_';for(var _0x102915=0x0;_0x102915<_0xcbd59f[_0xbf96('0x3d')];_0x102915++){if(_0xcbd59f[_0xbf96('0x70')](_0x102915)=='-'){_0x51051e+=_0xcbd59f[_0xbf96('0x70')](_0x102915);}else{_0x51051e+='['+_0xcbd59f['charAt'](_0x102915)+']';}}_0x51051e+='.';return _0x51051e;}exports[_0xbf96('0x2b')]=function(_0x417f73,_0xbfe7da,_0x5cb973){var _0x515312=_0x417f73['body'];_0x515312['prefix']=_0xbf96('0x71')+_0x515312['name']+'-';return db['sequelize'][_0xbf96('0x53')](function(_0x47d467){return db[_0xbf96('0x48')]['update'](_0x515312,{'where':{'id':_0x515312['id']},'transaction':_0x47d467})[_0xbf96('0x2d')](function(){return db['VoiceExtension'][_0xbf96('0x2c')]({'where':{'VoicePrefixId':_0x515312['id']},'transaction':_0x47d467})[_0xbf96('0x2d')](function(){return db['VoiceExtension'][_0xbf96('0x50')]({'where':{'id':_0x515312[_0xbf96('0x57')]},'raw':!![]})[_0xbf96('0x2d')](function(_0x5130ba){return createVoicePrefixExtensions(_0x515312,_0x5130ba,_0x47d467);});});});})[_0xbf96('0x2d')](function(){return db[_0xbf96('0x48')][_0xbf96('0x72')](_0x515312['id']);})[_0xbf96('0x2d')](respondWithResult(_0xbfe7da,null))['catch'](handleError(_0xbfe7da,null));};exports[_0xbf96('0x73')]=function(_0xb4cf73,_0x33bdff,_0x1a5cd0){return db['VoicePrefix'][_0xbf96('0x50')]({'where':{'id':_0xb4cf73[_0xbf96('0x4e')]['id']}})['then'](handleEntityNotFound(_0x33bdff,null))['then'](function(_0x5c38ac){if(_0x5c38ac){return _0x5c38ac[_0xbf96('0x73')](_0xb4cf73['body'][_0xbf96('0x74')],_[_0xbf96('0x75')](_0xb4cf73['body'],['ids','id'])||{})[_0xbf96('0x76')](function(_0x4d675b){for(var _0x206ba1=0x0;_0x206ba1<_0xb4cf73[_0xbf96('0x54')][_0xbf96('0x74')][_0xbf96('0x3d')];_0x206ba1+=0x1){socket[_0xbf96('0x77')](_0xbf96('0x78'),{'UserId':_0xb4cf73['body'][_0xbf96('0x74')][_0x206ba1],'VoicePrefixId':_0xb4cf73[_0xbf96('0x4e')]['id']});}return _0x4d675b;});}})[_0xbf96('0x2d')](respondWithResult(_0x33bdff,null))[_0xbf96('0x4c')](handleError(_0x33bdff,null));};exports[_0xbf96('0x79')]=function(_0x3bf8fa,_0x325877,_0xdd42c8){return db[_0xbf96('0x48')]['find']({'where':{'id':_0x3bf8fa['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x325877,null))['then'](function(_0x33a078){if(_0x33a078){return _0x33a078[_0xbf96('0x79')](_0x3bf8fa['query'][_0xbf96('0x74')])[_0xbf96('0x2d')](function(){if(_[_0xbf96('0x7a')](_0x3bf8fa['query'][_0xbf96('0x74')])){for(var _0x5edf87=0x0;_0x5edf87<_0x3bf8fa[_0xbf96('0x39')][_0xbf96('0x74')][_0xbf96('0x3d')];_0x5edf87+=0x1){socket[_0xbf96('0x77')](_0xbf96('0x7b'),{'UserId':Number(_0x3bf8fa[_0xbf96('0x39')][_0xbf96('0x74')][_0x5edf87]),'VoicePrefixId':Number(_0x3bf8fa[_0xbf96('0x4e')]['id'])});}}else{socket[_0xbf96('0x77')](_0xbf96('0x7b'),{'UserId':Number(_0x3bf8fa[_0xbf96('0x39')][_0xbf96('0x74')]),'VoicePrefixId':Number(_0x3bf8fa[_0xbf96('0x4e')]['id'])});}});}})[_0xbf96('0x2d')](respondWithStatusCode(_0x325877,null))['catch'](handleError(_0x325877,null));};exports['getAgents']=function(_0x3309c9,_0x1bb33a,_0x2b82b1){var _0x33844f={};var _0x2218f0={};var _0x1dd524;var _0x24e009;return db[_0xbf96('0x48')]['findOne']({'where':{'id':_0x3309c9['params']['id']}})[_0xbf96('0x2d')](handleEntityNotFound(_0x1bb33a,null))[_0xbf96('0x2d')](function(_0xb697b0){if(_0xb697b0){_0x1dd524=_0xb697b0;_0x2218f0[_0xbf96('0x38')]=_[_0xbf96('0x4f')](db[_0xbf96('0x7c')][_0xbf96('0x34')]);_0x2218f0[_0xbf96('0x39')]=_['keys'](_0x3309c9[_0xbf96('0x39')]);_0x2218f0[_0xbf96('0x42')]=_['intersection'](_0x2218f0[_0xbf96('0x38')],_0x2218f0[_0xbf96('0x39')]);_0x33844f[_0xbf96('0x3c')]=_[_0xbf96('0x3a')](_0x2218f0[_0xbf96('0x38')],qs[_0xbf96('0x3b')](_0x3309c9[_0xbf96('0x39')][_0xbf96('0x3b')]));_0x33844f[_0xbf96('0x3c')]=_0x33844f['attributes'][_0xbf96('0x3d')]?_0x33844f[_0xbf96('0x3c')]:_0x2218f0[_0xbf96('0x38')];_0x33844f[_0xbf96('0x40')]=qs[_0xbf96('0x41')](_0x3309c9[_0xbf96('0x39')][_0xbf96('0x41')]);_0x33844f[_0xbf96('0x43')]=qs[_0xbf96('0x42')](_[_0xbf96('0x7d')](_0x3309c9[_0xbf96('0x39')],_0x2218f0[_0xbf96('0x42')]));if(_0x3309c9[_0xbf96('0x39')][_0xbf96('0x46')]){_0x33844f['where']=_['merge'](_0x33844f['where'],{'$or':_[_0xbf96('0x33')](_0x33844f[_0xbf96('0x3c')],function(_0x28ba44){var _0xdff73d={};_0xdff73d[_0x28ba44]={'$like':'%'+_0x3309c9['query'][_0xbf96('0x46')]+'%'};return _0xdff73d;})});}_0x33844f=_[_0xbf96('0x44')]({},_0x33844f,_0x3309c9[_0xbf96('0x47')]);return _0x1dd524['getAgents'](_0x33844f);}})[_0xbf96('0x2d')](function(_0x2ff153){if(_0x2ff153){_0x24e009=_0x2ff153[_0xbf96('0x3d')];if(!_0x3309c9['query'][_0xbf96('0x3e')]('nolimit')){_0x33844f[_0xbf96('0x26')]=qs['limit'](_0x3309c9[_0xbf96('0x39')]['limit']);_0x33844f[_0xbf96('0x25')]=qs[_0xbf96('0x25')](_0x3309c9[_0xbf96('0x39')][_0xbf96('0x25')]);}return _0x1dd524[_0xbf96('0x7e')](_0x33844f);}})[_0xbf96('0x2d')](function(_0x2c5154){if(_0x2c5154){return _0x2c5154?{'count':_0x24e009,'rows':_0x2c5154}:null;}})[_0xbf96('0x2d')](respondWithResult(_0x1bb33a,null))['catch'](handleError(_0x1bb33a,null));}; \ No newline at end of file +var _0x1561=['count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','stack','name','send','map','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','describe','transaction','create','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','order','sort','pick','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','end','status','json'];(function(_0x33f413,_0x30b304){var _0x415a13=function(_0x37cfdd){while(--_0x37cfdd){_0x33f413['push'](_0x33f413['shift']());}};_0x415a13(++_0x30b304);}(_0x1561,0x1bd));var _0x1156=function(_0x5c8b66,_0x5c7465){_0x5c8b66=_0x5c8b66-0x0;var _0x3ccd36=_0x1561[_0x5c8b66];return _0x3ccd36;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1156('0x0'));var zipdir=require(_0x1156('0x1'));var jsonpatch=require(_0x1156('0x2'));var rp=require(_0x1156('0x3'));var moment=require(_0x1156('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1156('0x5'));var util=require(_0x1156('0x6'));var path=require(_0x1156('0x7'));var sox=require(_0x1156('0x8'));var csv=require('to-csv');var ejs=require(_0x1156('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1156('0xa'));var crypto=require(_0x1156('0xb'));var jsforce=require(_0x1156('0xc'));var deskjs=require(_0x1156('0xd'));var toCsv=require(_0x1156('0xe'));var querystring=require('querystring');var Papa=require(_0x1156('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1156('0x10'));var as=require(_0x1156('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1156('0x12'))('api');var utils=require(_0x1156('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1156('0x14'));var db=require(_0x1156('0x15'))['db'];config['redis']=_['defaults'](config[_0x1156('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1156('0x17'))(new Redis(config[_0x1156('0x16')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x3a7c28,_0xf521c2){_0xf521c2=_0xf521c2||0xcc;return function(_0x9673ef){if(_0x9673ef){return _0x3a7c28['sendStatus'](_0xf521c2);}return _0x3a7c28['status'](_0xf521c2)[_0x1156('0x18')]();};}function respondWithResult(_0x236d32,_0x3c244d){_0x3c244d=_0x3c244d||0xc8;return function(_0x399417){if(_0x399417){return _0x236d32[_0x1156('0x19')](_0x3c244d)[_0x1156('0x1a')](_0x399417);}};}function respondWithFilteredResult(_0x2c1ff5,_0x6dd20){return function(_0x2d820d){if(_0x2d820d){var _0x211e6b=_0x2d820d[_0x1156('0x1b')],_0x2582cb=_0x6dd20[_0x1156('0x1c')],_0x4ab172=_0x6dd20['offset']+_0x6dd20[_0x1156('0x1d')],_0x18bc91;if(_0x4ab172>=_0x211e6b){_0x4ab172=_0x211e6b;_0x18bc91=0xc8;}else{_0x18bc91=0xce;}_0x2c1ff5[_0x1156('0x19')](_0x18bc91);return _0x2c1ff5[_0x1156('0x1e')](_0x1156('0x1f'),_0x2582cb+'-'+_0x4ab172+'/'+_0x211e6b)[_0x1156('0x1a')](_0x2d820d);}return null;};}function patchUpdates(_0x3805fa){return function(_0x3633ef){try{jsonpatch[_0x1156('0x20')](_0x3633ef,_0x3805fa,!![]);}catch(_0x535dda){return BPromise[_0x1156('0x21')](_0x535dda);}return _0x3633ef['save']();};}function saveUpdates(_0x40f190,_0x271515){return function(_0x2e1c0a){if(_0x2e1c0a){return _0x2e1c0a['update'](_0x40f190)[_0x1156('0x22')](function(_0x3af43f){return _0x3af43f;});}return null;};}function removeEntity(_0x28caf5,_0x2946b5){return function(_0xdcc9dd){if(_0xdcc9dd){return _0xdcc9dd[_0x1156('0x23')]()['then'](function(){var _0xa5ffd7=_0xdcc9dd[_0x1156('0x24')]({'plain':!![]});var _0x204acc=_0x1156('0x25');return db[_0x1156('0x26')][_0x1156('0x23')]({'where':{'type':_0x204acc,'resourceId':_0xa5ffd7['id']}})[_0x1156('0x22')](function(){return _0xdcc9dd;});})[_0x1156('0x22')](function(){_0x28caf5[_0x1156('0x19')](0xcc)[_0x1156('0x18')]();});}};}function handleEntityNotFound(_0x225502,_0x19c9d3){return function(_0x1af5b2){if(!_0x1af5b2){_0x225502[_0x1156('0x27')](0x194);}return _0x1af5b2;};}function handleError(_0x4f5c32,_0x415bb1){_0x415bb1=_0x415bb1||0x1f4;return function(_0xca0e08){logger['error'](_0xca0e08[_0x1156('0x28')]);if(_0xca0e08[_0x1156('0x29')]){delete _0xca0e08['name'];}_0x4f5c32[_0x1156('0x19')](_0x415bb1)[_0x1156('0x2a')](_0xca0e08);};}exports['index']=function(_0x12a68e,_0x265406){var _0x577957={},_0x2c5759={},_0x266960={'count':0x0,'rows':[]};var _0x4e9cf9=_[_0x1156('0x2b')](db[_0x1156('0x2c')]['rawAttributes'],function(_0x321179){return{'name':_0x321179[_0x1156('0x2d')],'type':_0x321179[_0x1156('0x2e')][_0x1156('0x2f')]};});_0x2c5759['model']=_['map'](_0x4e9cf9,_0x1156('0x29'));_0x2c5759[_0x1156('0x30')]=_[_0x1156('0x31')](_0x12a68e[_0x1156('0x30')]);_0x2c5759[_0x1156('0x32')]=_[_0x1156('0x33')](_0x2c5759[_0x1156('0x34')],_0x2c5759[_0x1156('0x30')]);_0x577957[_0x1156('0x35')]=_['intersection'](_0x2c5759['model'],qs[_0x1156('0x36')](_0x12a68e['query'][_0x1156('0x36')]));_0x577957[_0x1156('0x35')]=_0x577957['attributes'][_0x1156('0x37')]?_0x577957[_0x1156('0x35')]:_0x2c5759[_0x1156('0x34')];if(!_0x12a68e[_0x1156('0x30')]['hasOwnProperty'](_0x1156('0x38'))){_0x577957[_0x1156('0x1d')]=qs['limit'](_0x12a68e[_0x1156('0x30')][_0x1156('0x1d')]);_0x577957[_0x1156('0x1c')]=qs[_0x1156('0x1c')](_0x12a68e['query'][_0x1156('0x1c')]);}_0x577957['order']=qs['sort'](_0x12a68e[_0x1156('0x30')]['sort']);_0x577957[_0x1156('0x39')]=qs['filters'](_['pick'](_0x12a68e[_0x1156('0x30')],_0x2c5759[_0x1156('0x32')]),_0x4e9cf9);if(_0x12a68e[_0x1156('0x30')][_0x1156('0x3a')]){_0x577957[_0x1156('0x39')]=_[_0x1156('0x3b')](_0x577957[_0x1156('0x39')],{'$or':_['map'](_0x4e9cf9,function(_0x231ad6){if(_0x231ad6['type']!==_0x1156('0x3c')){var _0x4be51d={};_0x4be51d[_0x231ad6['name']]={'$like':'%'+_0x12a68e[_0x1156('0x30')][_0x1156('0x3a')]+'%'};return _0x4be51d;}})});}_0x577957=_[_0x1156('0x3b')]({},_0x577957,_0x12a68e[_0x1156('0x3d')]);var _0x1a1e84={'where':_0x577957[_0x1156('0x39')]};return db['VoicePrefix'][_0x1156('0x1b')](_0x1a1e84)[_0x1156('0x22')](function(_0x9b8f8d){_0x266960[_0x1156('0x1b')]=_0x9b8f8d;if(_0x12a68e[_0x1156('0x30')][_0x1156('0x3e')]){_0x577957[_0x1156('0x3f')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x577957);})['then'](function(_0x4e1d11){_0x266960[_0x1156('0x40')]=_0x4e1d11;return _0x266960;})[_0x1156('0x22')](respondWithFilteredResult(_0x265406,_0x577957))['catch'](handleError(_0x265406,null));};exports['show']=function(_0x4b7133,_0x55ba00){var _0x5b4a4c={'raw':![],'where':{'id':_0x4b7133[_0x1156('0x41')]['id']}},_0xbc16ba={};_0xbc16ba[_0x1156('0x34')]=_['keys'](db[_0x1156('0x2c')]['rawAttributes']);_0xbc16ba['query']=_[_0x1156('0x31')](_0x4b7133[_0x1156('0x30')]);_0xbc16ba[_0x1156('0x32')]=_[_0x1156('0x33')](_0xbc16ba[_0x1156('0x34')],_0xbc16ba[_0x1156('0x30')]);_0x5b4a4c[_0x1156('0x35')]=_[_0x1156('0x33')](_0xbc16ba['model'],qs[_0x1156('0x36')](_0x4b7133[_0x1156('0x30')]['fields']));_0x5b4a4c[_0x1156('0x35')]=_0x5b4a4c[_0x1156('0x35')]['length']?_0x5b4a4c[_0x1156('0x35')]:_0xbc16ba['model'];if(_0x4b7133[_0x1156('0x30')]['includeAll']){_0x5b4a4c['include']=[{'all':!![]}];}_0x5b4a4c=_[_0x1156('0x3b')]({},_0x5b4a4c,_0x4b7133[_0x1156('0x3d')]);return db[_0x1156('0x2c')][_0x1156('0x42')](_0x5b4a4c)[_0x1156('0x22')](handleEntityNotFound(_0x55ba00,null))[_0x1156('0x22')](respondWithResult(_0x55ba00,null))['catch'](handleError(_0x55ba00,null));};exports[_0x1156('0x23')]=function(_0x55a5cc,_0x420fc7){return db[_0x1156('0x2c')][_0x1156('0x42')]({'where':{'id':_0x55a5cc[_0x1156('0x41')]['id']}})[_0x1156('0x22')](handleEntityNotFound(_0x420fc7,null))[_0x1156('0x22')](removeEntity(_0x420fc7,null))[_0x1156('0x43')](handleError(_0x420fc7,null));};exports[_0x1156('0x44')]=function(_0x1ec9ca,_0x5c3d9a){return db[_0x1156('0x2c')][_0x1156('0x44')]()[_0x1156('0x22')](respondWithResult(_0x5c3d9a,null))[_0x1156('0x43')](handleError(_0x5c3d9a,null));};exports['create']=function(_0x1317d2,_0x123a9d){var _0x212d9e;return db['sequelize'][_0x1156('0x45')](function(_0x2c622b){return db[_0x1156('0x2c')][_0x1156('0x46')](_0x1317d2[_0x1156('0x47')],{'transaction':_0x2c622b})[_0x1156('0x22')](function(_0x4c65b2){_0x212d9e=_0x4c65b2[_0x1156('0x24')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x212d9e[_0x1156('0x48')]},'raw':!![]})[_0x1156('0x22')](function(_0x17ed91){return createVoicePrefixExtensions(_0x212d9e,_0x17ed91,_0x2c622b);});});})[_0x1156('0x22')](function(){var _0x2d8b18=_0x1317d2['user']['get']({'plain':!![]});if(!_0x2d8b18)throw new Error(_0x1156('0x49'));if(_0x2d8b18[_0x1156('0x4a')]==='user'){var _0x29b159=_0x212d9e;return db[_0x1156('0x4b')][_0x1156('0x42')]({'where':{'name':_0x1156('0x25'),'userProfileId':_0x2d8b18[_0x1156('0x4c')]},'raw':!![]})[_0x1156('0x22')](function(_0x55d53b){if(_0x55d53b&&_0x55d53b[_0x1156('0x4d')]===0x0){return db[_0x1156('0x26')][_0x1156('0x46')]({'name':_0x29b159[_0x1156('0x29')],'resourceId':_0x29b159['id'],'type':_0x55d53b['name'],'sectionId':_0x55d53b['id']},{})[_0x1156('0x22')](function(){return _0x212d9e;});}else{return _0x212d9e;}})['catch'](function(_0x54e60e){logger['error'](_0x1156('0x4e'),_0x54e60e);throw _0x54e60e;});}return _0x212d9e;})[_0x1156('0x22')](respondWithResult(_0x123a9d,null))[_0x1156('0x43')](handleError(_0x123a9d,null));};function Extension(_0x142b9d,_0x259398,_0x3349de,_0x327c2a){this['context']='from-sip';this['exten']=_0x142b9d;this[_0x1156('0x4f')]=_0x3349de;this[_0x1156('0x2e')]=_0x1156('0x50');this[_0x1156('0x51')]=_0x1156('0x52');this[_0x1156('0x53')]=_0x259398;this[_0x1156('0x54')]=_0x327c2a;}function createVoicePrefixExtensions(_0x5ae820,_0x13075f,_0x4da0b3){return new BPromise(function(_0x5497cf,_0x1e65cd){var _0x5a6ad8=new Extension(formatPrefixName(_0x5ae820[_0x1156('0x55')]),0x1,_0x1156('0x56'),_0x1156('0x57'));_0x5a6ad8[_0x1156('0x58')]=_0x5ae820['id'];return db['VoiceExtension'][_0x1156('0x46')](_0x5a6ad8,{'transaction':_0x4da0b3})['then'](function(_0x4d049b){var _0x56d2ca=_0x4d049b['get']({'plain':!![]});var _0x8c05f6=_['map'](addVoicePrefixExtensions(_0x5ae820,_0x13075f),function(_0x2669ca){_0x2669ca[_0x1156('0x48')]=_0x56d2ca['id'];_0x2669ca[_0x1156('0x58')]=_0x5ae820['id'];return _0x2669ca;});return db[_0x1156('0x59')][_0x1156('0x5a')](_0x8c05f6,{'transaction':_0x4da0b3})['then'](function(_0x4dd7f8){if(!_0x4dd7f8){return _0x1e65cd('Extensions\x20creation\x20failed');}else{return _0x5497cf(_0x4dd7f8);}})['catch'](function(_0x160107){return _0x1e65cd(_0x160107);});});;});};function addVoicePrefixExtensions(_0x5e9352,_0xd27c2e){var _0x29d23a=[];var _0x1989a1=formatPrefixName(_0x5e9352[_0x1156('0x55')]);_0x29d23a[_0x1156('0x5b')](new Extension(_0x1989a1,0x2,_0x1156('0x5c'),_0x1156('0x5d')+_0x5e9352[_0x1156('0x29')]));if(_0x5e9352[_0x1156('0x5e')]){_0x29d23a['push'](new Extension(_0x1989a1,0x3,_0x1156('0x5c'),_0x1156('0x5f')+_0x5e9352[_0x1156('0x5e')]));}else{_0x29d23a[_0x1156('0x5b')](new Extension(_0x1989a1,0x3,_0x1156('0x56'),_0x1156('0x60')));}_0x29d23a[_0x1156('0x5b')](new Extension(_0x1989a1,0x4,_0x1156('0x61'),_0xd27c2e['context']+','+'${EXTEN:'+(0x8+_0x5e9352[_0x1156('0x29')][_0x1156('0x37')])+'}'+','+0x1));return _0x29d23a;}function formatPrefixName(_0x392b56){var _0x2d34ce='_';for(var _0x32c7fd=0x0;_0x32c7fd<_0x392b56[_0x1156('0x37')];_0x32c7fd++){if(_0x392b56[_0x1156('0x62')](_0x32c7fd)=='-'){_0x2d34ce+=_0x392b56[_0x1156('0x62')](_0x32c7fd);}else{_0x2d34ce+='['+_0x392b56[_0x1156('0x62')](_0x32c7fd)+']';}}_0x2d34ce+='.';return _0x2d34ce;}exports['update']=function(_0x780841,_0x398e1b,_0x3bacb7){var _0x4a5773=_0x780841[_0x1156('0x47')];_0x4a5773[_0x1156('0x55')]=_0x1156('0x63')+_0x4a5773[_0x1156('0x29')]+'-';return db[_0x1156('0x64')][_0x1156('0x45')](function(_0x3baa27){return db[_0x1156('0x2c')]['update'](_0x4a5773,{'where':{'id':_0x4a5773['id']},'transaction':_0x3baa27})['then'](function(){return db['VoiceExtension'][_0x1156('0x23')]({'where':{'VoicePrefixId':_0x4a5773['id']},'transaction':_0x3baa27})[_0x1156('0x22')](function(){return db[_0x1156('0x59')]['find']({'where':{'id':_0x4a5773['VoiceExtensionId']},'raw':!![]})[_0x1156('0x22')](function(_0x3e8010){return createVoicePrefixExtensions(_0x4a5773,_0x3e8010,_0x3baa27);});});});})['then'](function(){return db[_0x1156('0x2c')][_0x1156('0x65')](_0x4a5773['id']);})[_0x1156('0x22')](respondWithResult(_0x398e1b,null))['catch'](handleError(_0x398e1b,null));};exports[_0x1156('0x66')]=function(_0x587bb4,_0x294a06,_0x2783b6){return db[_0x1156('0x2c')][_0x1156('0x42')]({'where':{'id':_0x587bb4[_0x1156('0x41')]['id']}})[_0x1156('0x22')](handleEntityNotFound(_0x294a06,null))[_0x1156('0x22')](function(_0x38fdc6){if(_0x38fdc6){return _0x38fdc6[_0x1156('0x66')](_0x587bb4[_0x1156('0x47')][_0x1156('0x67')],_['omit'](_0x587bb4[_0x1156('0x47')],['ids','id'])||{})[_0x1156('0x68')](function(_0x6bb664){for(var _0x29ef14=0x0;_0x29ef14<_0x587bb4[_0x1156('0x47')][_0x1156('0x67')][_0x1156('0x37')];_0x29ef14+=0x1){socket[_0x1156('0x69')](_0x1156('0x6a'),{'UserId':_0x587bb4[_0x1156('0x47')][_0x1156('0x67')][_0x29ef14],'VoicePrefixId':_0x587bb4[_0x1156('0x41')]['id']});}return _0x6bb664;});}})[_0x1156('0x22')](respondWithResult(_0x294a06,null))[_0x1156('0x43')](handleError(_0x294a06,null));};exports['removeAgents']=function(_0x3e21f0,_0x554f65,_0x323a8a){return db['VoicePrefix'][_0x1156('0x42')]({'where':{'id':_0x3e21f0[_0x1156('0x41')]['id']}})['then'](handleEntityNotFound(_0x554f65,null))['then'](function(_0x3ef3eb){if(_0x3ef3eb){return _0x3ef3eb[_0x1156('0x6b')](_0x3e21f0[_0x1156('0x30')][_0x1156('0x67')])[_0x1156('0x22')](function(){if(_[_0x1156('0x6c')](_0x3e21f0[_0x1156('0x30')]['ids'])){for(var _0x86d780=0x0;_0x86d780<_0x3e21f0[_0x1156('0x30')][_0x1156('0x67')]['length'];_0x86d780+=0x1){socket[_0x1156('0x69')](_0x1156('0x6d'),{'UserId':Number(_0x3e21f0[_0x1156('0x30')][_0x1156('0x67')][_0x86d780]),'VoicePrefixId':Number(_0x3e21f0[_0x1156('0x41')]['id'])});}}else{socket[_0x1156('0x69')]('userVoicePrefix:remove',{'UserId':Number(_0x3e21f0['query']['ids']),'VoicePrefixId':Number(_0x3e21f0['params']['id'])});}});}})[_0x1156('0x22')](respondWithStatusCode(_0x554f65,null))[_0x1156('0x43')](handleError(_0x554f65,null));};exports[_0x1156('0x6e')]=function(_0x140556,_0xc32528,_0x2475e9){var _0x50f7ad={};var _0x593a8f={};var _0x4b817a;var _0x2f4924;return db[_0x1156('0x2c')][_0x1156('0x6f')]({'where':{'id':_0x140556[_0x1156('0x41')]['id']}})[_0x1156('0x22')](handleEntityNotFound(_0xc32528,null))[_0x1156('0x22')](function(_0x54d624){if(_0x54d624){_0x4b817a=_0x54d624;_0x593a8f['model']=_[_0x1156('0x31')](db[_0x1156('0x70')][_0x1156('0x71')]);_0x593a8f[_0x1156('0x30')]=_[_0x1156('0x31')](_0x140556[_0x1156('0x30')]);_0x593a8f[_0x1156('0x32')]=_['intersection'](_0x593a8f[_0x1156('0x34')],_0x593a8f['query']);_0x50f7ad['attributes']=_[_0x1156('0x33')](_0x593a8f[_0x1156('0x34')],qs[_0x1156('0x36')](_0x140556['query'][_0x1156('0x36')]));_0x50f7ad['attributes']=_0x50f7ad[_0x1156('0x35')][_0x1156('0x37')]?_0x50f7ad[_0x1156('0x35')]:_0x593a8f[_0x1156('0x34')];_0x50f7ad[_0x1156('0x72')]=qs['sort'](_0x140556[_0x1156('0x30')][_0x1156('0x73')]);_0x50f7ad[_0x1156('0x39')]=qs['filters'](_[_0x1156('0x74')](_0x140556[_0x1156('0x30')],_0x593a8f[_0x1156('0x32')]));if(_0x140556[_0x1156('0x30')][_0x1156('0x3a')]){_0x50f7ad[_0x1156('0x39')]=_[_0x1156('0x3b')](_0x50f7ad[_0x1156('0x39')],{'$or':_[_0x1156('0x2b')](_0x50f7ad[_0x1156('0x35')],function(_0x128c5a){var _0xe63671={};_0xe63671[_0x128c5a]={'$like':'%'+_0x140556[_0x1156('0x30')][_0x1156('0x3a')]+'%'};return _0xe63671;})});}_0x50f7ad=_[_0x1156('0x3b')]({},_0x50f7ad,_0x140556[_0x1156('0x3d')]);return _0x4b817a['getAgents'](_0x50f7ad);}})['then'](function(_0x1ba82f){if(_0x1ba82f){_0x2f4924=_0x1ba82f[_0x1156('0x37')];if(!_0x140556[_0x1156('0x30')][_0x1156('0x75')]('nolimit')){_0x50f7ad['limit']=qs[_0x1156('0x1d')](_0x140556[_0x1156('0x30')][_0x1156('0x1d')]);_0x50f7ad['offset']=qs[_0x1156('0x1c')](_0x140556[_0x1156('0x30')]['offset']);}return _0x4b817a[_0x1156('0x6e')](_0x50f7ad);}})[_0x1156('0x22')](function(_0x4ded65){if(_0x4ded65){return _0x4ded65?{'count':_0x2f4924,'rows':_0x4ded65}:null;}})['then'](respondWithResult(_0xc32528,null))[_0x1156('0x43')](handleError(_0xc32528,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8f45f4d..569b961 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x4c393f,_0x1b627d){var _0x1a7773=function(_0x311cec){while(--_0x311cec){_0x4c393f['push'](_0x4c393f['shift']());}};_0x1a7773(++_0x1b627d);}(_0x008c,0x188));var _0xc008=function(_0x231e5a,_0x1718f8){_0x231e5a=_0x231e5a-0x0;var _0x216a7d=_0x008c[_0x231e5a];return _0x216a7d;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x37c932,_0x3794aa){var _0x5e8365=function(_0x514fb0){while(--_0x514fb0){_0x37c932['push'](_0x37c932['shift']());}};_0x5e8365(++_0x3794aa);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index be4b348..6c4e0b5 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 _0xead9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api'];(function(_0x299970,_0x25c56e){var _0x1feecb=function(_0x1be5a6){while(--_0x1be5a6){_0x299970['push'](_0x299970['shift']());}};_0x1feecb(++_0x25c56e);}(_0xead9,0x136));var _0x9ead=function(_0x6d4da8,_0x3cbc95){_0x6d4da8=_0x6d4da8-0x0;var _0x10af59=_0xead9[_0x6d4da8];return _0x10af59;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ead('0x0'))(_0x9ead('0x1'));var moment=require(_0x9ead('0x2'));var BPromise=require(_0x9ead('0x3'));var rp=require(_0x9ead('0x4'));var fs=require('fs');var path=require(_0x9ead('0x5'));var rimraf=require(_0x9ead('0x6'));var config=require(_0x9ead('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x9ead('0x8')]=function(_0x39347f,_0x1e7784){return _0x39347f[_0x9ead('0x9')](_0x9ead('0xa'),attributes,{'tableName':_0x9ead('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc666=['voice_prefixes','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','VoicePrefix'];(function(_0xe17d25,_0x4dd1f6){var _0x2ffeea=function(_0x2bbf19){while(--_0x2bbf19){_0xe17d25['push'](_0xe17d25['shift']());}};_0x2ffeea(++_0x4dd1f6);}(_0xc666,0xbf));var _0x6c66=function(_0x328ee1,_0x1b9365){_0x328ee1=_0x328ee1-0x0;var _0x511ef5=_0xc666[_0x328ee1];return _0x511ef5;};'use strict';var _=require(_0x6c66('0x0'));var util=require(_0x6c66('0x1'));var logger=require(_0x6c66('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c66('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c66('0x4'));var rimraf=require(_0x6c66('0x5'));var config=require(_0x6c66('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x963f69,_0x1e6eee){return _0x963f69[_0x6c66('0x7')](_0x6c66('0x8'),attributes,{'tableName':_0x6c66('0x9'),'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 c17d189..471255a 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 _0x0893=['redis','defaults','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58ee37,_0x56017b){var _0x40c31c=function(_0x4f1bf2){while(--_0x4f1bf2){_0x58ee37['push'](_0x58ee37['shift']());}};_0x40c31c(++_0x56017b);}(_0x0893,0x138));var _0x3089=function(_0x36d801,_0x54b8ec){_0x36d801=_0x36d801-0x0;var _0x4dce01=_0x0893[_0x36d801];return _0x4dce01;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3089('0x0'));var BPromise=require(_0x3089('0x1'));var rs=require(_0x3089('0x2'));var fs=require('fs');var Redis=require(_0x3089('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3089('0x4'));var logger=require('../../config/logger')(_0x3089('0x5'));var config=require(_0x3089('0x6'));var jayson=require(_0x3089('0x7'));var client=jayson[_0x3089('0x8')][_0x3089('0x9')]({'port':0x232a});config[_0x3089('0xa')]=_[_0x3089('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3089('0xc'))(new Redis(config[_0x3089('0xa')]));require(_0x3089('0xd'))[_0x3089('0xe')](socket);function respondWithRpcPromise(_0x2123b2,_0x2a8f61,_0x11b752){return new BPromise(function(_0x2f5371,_0x5b3889){return client['request'](_0x2123b2,_0x11b752)['then'](function(_0xded4b2){logger[_0x3089('0xf')](_0x3089('0x10'),_0x2a8f61,_0x3089('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2a8f61,_0x3089('0x11'),JSON['stringify'](_0xded4b2));if(_0xded4b2[_0x3089('0x12')]){if(_0xded4b2[_0x3089('0x12')][_0x3089('0x13')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2a8f61,_0xded4b2[_0x3089('0x12')][_0x3089('0x14')]);return _0x5b3889(_0xded4b2[_0x3089('0x12')][_0x3089('0x14')]);}logger[_0x3089('0x12')](_0x3089('0x10'),_0x2a8f61,_0xded4b2['error'][_0x3089('0x14')]);return _0x2f5371(_0xded4b2['error']['message']);}else{logger[_0x3089('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x2a8f61,_0x3089('0x11'));_0x2f5371(_0xded4b2[_0x3089('0x15')]['message']);}})[_0x3089('0x16')](function(_0x4f8090){logger[_0x3089('0x12')](_0x3089('0x10'),_0x2a8f61,_0x4f8090);_0x5b3889(_0x4f8090);});});} \ No newline at end of file +var _0xad36=['error','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c70d3,_0x3deec1){var _0x376a33=function(_0xb1f3fc){while(--_0xb1f3fc){_0x1c70d3['push'](_0x1c70d3['shift']());}};_0x376a33(++_0x3deec1);}(_0xad36,0x131));var _0x6ad3=function(_0xca26e6,_0x589bdc){_0xca26e6=_0xca26e6-0x0;var _0x1a9bf9=_0xad36[_0xca26e6];return _0x1a9bf9;};'use strict';var _=require(_0x6ad3('0x0'));var util=require('util');var moment=require(_0x6ad3('0x1'));var BPromise=require(_0x6ad3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ad3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ad3('0x4'));var logger=require(_0x6ad3('0x5'))(_0x6ad3('0x6'));var config=require(_0x6ad3('0x7'));var jayson=require(_0x6ad3('0x8'));var client=jayson['client'][_0x6ad3('0x9')]({'port':0x232a});config[_0x6ad3('0xa')]=_[_0x6ad3('0xb')](config[_0x6ad3('0xa')],{'host':_0x6ad3('0xc'),'port':0x18eb});var socket=require(_0x6ad3('0xd'))(new Redis(config[_0x6ad3('0xa')]));require('./voicePrefix.socket')[_0x6ad3('0xe')](socket);function respondWithRpcPromise(_0x2de7ce,_0x489b62,_0x12a229){return new BPromise(function(_0x407f49,_0x576da3){return client['request'](_0x2de7ce,_0x12a229)[_0x6ad3('0xf')](function(_0x26044b){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x489b62,'request\x20sent');logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x489b62,_0x6ad3('0x12'),JSON[_0x6ad3('0x13')](_0x26044b));if(_0x26044b[_0x6ad3('0x14')]){if(_0x26044b[_0x6ad3('0x14')]['code']===0x1f4){logger[_0x6ad3('0x14')](_0x6ad3('0x15'),_0x489b62,_0x26044b[_0x6ad3('0x14')]['message']);return _0x576da3(_0x26044b[_0x6ad3('0x14')][_0x6ad3('0x16')]);}logger[_0x6ad3('0x14')](_0x6ad3('0x15'),_0x489b62,_0x26044b['error'][_0x6ad3('0x16')]);return _0x407f49(_0x26044b[_0x6ad3('0x14')]['message']);}else{logger['info'](_0x6ad3('0x15'),_0x489b62,'request\x20sent');_0x407f49(_0x26044b[_0x6ad3('0x17')]['message']);}})[_0x6ad3('0x18')](function(_0x84ff64){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x489b62,_0x84ff64);_0x576da3(_0x84ff64);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 821ba4b..d822ea6 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 _0x41b7=['save','remove','update','emit','removeListener','register','voicePrefix:','./voicePrefix.events'];(function(_0x1d8c86,_0x35919a){var _0x47c8a5=function(_0x39346d){while(--_0x39346d){_0x1d8c86['push'](_0x1d8c86['shift']());}};_0x47c8a5(++_0x35919a);}(_0x41b7,0x17f));var _0x741b=function(_0x13a3cb,_0x3373fc){_0x13a3cb=_0x13a3cb-0x0;var _0x293f42=_0x41b7[_0x13a3cb];return _0x293f42;};'use strict';var VoicePrefixEvents=require(_0x741b('0x0'));var events=[_0x741b('0x1'),_0x741b('0x2'),_0x741b('0x3')];function createListener(_0x22364d,_0x3a8ecf){return function(_0x4d658e){_0x3a8ecf[_0x741b('0x4')](_0x22364d,_0x4d658e);};}function removeListener(_0x3cf68b,_0x3bdbc8){return function(){VoicePrefixEvents[_0x741b('0x5')](_0x3cf68b,_0x3bdbc8);};}exports[_0x741b('0x6')]=function(_0x449858){for(var _0x222cf9=0x0,_0x3021fb=events['length'];_0x222cf9<_0x3021fb;_0x222cf9++){var _0x1ba6b7=events[_0x222cf9];var _0x5ef6e1=createListener(_0x741b('0x7')+_0x1ba6b7,_0x449858);VoicePrefixEvents['on'](_0x1ba6b7,_0x5ef6e1);}}; \ No newline at end of file +var _0xe600=['voicePrefix:','./voicePrefix.events','save','update','emit','removeListener','register','length'];(function(_0x2c1d85,_0x30a616){var _0x38cf1b=function(_0x322a4d){while(--_0x322a4d){_0x2c1d85['push'](_0x2c1d85['shift']());}};_0x38cf1b(++_0x30a616);}(_0xe600,0x89));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var VoicePrefixEvents=require(_0x0e60('0x0'));var events=[_0x0e60('0x1'),'remove',_0x0e60('0x2')];function createListener(_0x1ccd1b,_0x1f9063){return function(_0x3919e0){_0x1f9063[_0x0e60('0x3')](_0x1ccd1b,_0x3919e0);};}function removeListener(_0x30d3e4,_0x3ff19f){return function(){VoicePrefixEvents[_0x0e60('0x4')](_0x30d3e4,_0x3ff19f);};}exports[_0x0e60('0x5')]=function(_0x52c985){for(var _0x3fd75a=0x0,_0x59296e=events[_0x0e60('0x6')];_0x3fd75a<_0x59296e;_0x3fd75a++){var _0x4f1d1e=events[_0x3fd75a];var _0x4b506e=createListener(_0x0e60('0x7')+_0x4f1d1e,_0x52c985);VoicePrefixEvents['on'](_0x4f1d1e,_0x4b506e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index aebedd4..9e57744 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 _0xe34f=['post','create','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','update','delete','destroy','removeTeams','removeLists','exports','util','path','express','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x19d254,_0x1cc409){var _0x394531=function(_0x545984){while(--_0x545984){_0x19d254['push'](_0x19d254['shift']());}};_0x394531(++_0x1cc409);}(_0xe34f,0x16d));var _0xfe34=function(_0x1de756,_0x330f57){_0x1de756=_0x1de756-0x0;var _0x51abd3=_0xe34f[_0x1de756];return _0x51abd3;};'use strict';var multer=require('multer');var util=require(_0xfe34('0x0'));var path=require(_0xfe34('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe34('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe34('0x3'));var controller=require('./voiceQueue.controller');router[_0xfe34('0x4')]('/',auth['isAuthenticated'](),controller[_0xfe34('0x5')]);router['get'](_0xfe34('0x6'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x8')]);router[_0xfe34('0x4')](_0xfe34('0x9'),auth[_0xfe34('0x7')](),controller[_0xfe34('0xa')]);router[_0xfe34('0x4')](_0xfe34('0xb'),auth[_0xfe34('0x7')](),controller[_0xfe34('0xc')]);router[_0xfe34('0x4')]('/:id/hopper_finals',auth[_0xfe34('0x7')](),controller['getHopperFinals']);router[_0xfe34('0x4')](_0xfe34('0xd'),auth['isAuthenticated'](),controller[_0xfe34('0xe')]);router[_0xfe34('0x4')](_0xfe34('0xf'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x10')]);router[_0xfe34('0x4')](_0xfe34('0x11'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x12')]);router[_0xfe34('0x4')](_0xfe34('0x13'),auth['isAuthenticated'](),controller[_0xfe34('0x14')]);router[_0xfe34('0x4')](_0xfe34('0x15'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x16')]);router[_0xfe34('0x4')](_0xfe34('0x17'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x18')]);router[_0xfe34('0x19')]('/',auth[_0xfe34('0x7')](),controller[_0xfe34('0x1a')]);router[_0xfe34('0x19')](_0xfe34('0x1b'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x1c')]);router[_0xfe34('0x19')](_0xfe34('0xf'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x1d')]);router[_0xfe34('0x19')](_0xfe34('0x11'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x1e')]);router[_0xfe34('0x19')](_0xfe34('0x15'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x1f')]);router[_0xfe34('0x19')](_0xfe34('0x17'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x20')]);router['put'](_0xfe34('0x6'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x21')]);router[_0xfe34('0x22')](_0xfe34('0x6'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x23')]);router[_0xfe34('0x22')](_0xfe34('0xf'),auth[_0xfe34('0x7')](),controller[_0xfe34('0x24')]);router[_0xfe34('0x22')](_0xfe34('0x11'),auth[_0xfe34('0x7')](),controller['removeAgents']);router[_0xfe34('0x22')](_0xfe34('0x15'),auth['isAuthenticated'](),controller[_0xfe34('0x25')]);router['delete'](_0xfe34('0x17'),auth[_0xfe34('0x7')](),controller['removeBlackLists']);module[_0xfe34('0x26')]=router; \ No newline at end of file +var _0xd098=['show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','/:id/teams','addTeams','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeLists','removeBlackLists','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id'];(function(_0x1556eb,_0x121563){var _0x3ba08c=function(_0x3562a5){while(--_0x3562a5){_0x1556eb['push'](_0x1556eb['shift']());}};_0x3ba08c(++_0x121563);}(_0xd098,0xf7));var _0x8d09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd098[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8d09('0x0'));var util=require('util');var path=require(_0x8d09('0x1'));var timeout=require(_0x8d09('0x2'));var express=require(_0x8d09('0x3'));var router=express['Router']();var auth=require(_0x8d09('0x4'));var interaction=require(_0x8d09('0x5'));var config=require(_0x8d09('0x6'));var controller=require(_0x8d09('0x7'));router[_0x8d09('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d09('0x9')]);router[_0x8d09('0x8')](_0x8d09('0xa'),auth['isAuthenticated'](),controller[_0x8d09('0xb')]);router[_0x8d09('0x8')](_0x8d09('0xc'),auth[_0x8d09('0xd')](),controller[_0x8d09('0xe')]);router[_0x8d09('0x8')](_0x8d09('0xf'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x10')]);router[_0x8d09('0x8')](_0x8d09('0x11'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x12')]);router['get'](_0x8d09('0x13'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x14')]);router[_0x8d09('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8d09('0x15')]);router['get'](_0x8d09('0x16'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x17')]);router[_0x8d09('0x8')](_0x8d09('0x18'),auth[_0x8d09('0xd')](),controller['getMembers']);router[_0x8d09('0x8')](_0x8d09('0x19'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x1a')]);router['get'](_0x8d09('0x1b'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x8d09('0x1c')]('/',auth[_0x8d09('0xd')](),controller[_0x8d09('0x1d')]);router[_0x8d09('0x1c')](_0x8d09('0x1e'),auth[_0x8d09('0xd')](),controller['clone']);router[_0x8d09('0x1c')](_0x8d09('0x1f'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x20')]);router[_0x8d09('0x1c')](_0x8d09('0x16'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x21')]);router[_0x8d09('0x1c')](_0x8d09('0x19'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x22')]);router[_0x8d09('0x1c')](_0x8d09('0x1b'),auth['isAuthenticated'](),controller[_0x8d09('0x23')]);router[_0x8d09('0x24')](_0x8d09('0xa'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x25')]);router[_0x8d09('0x26')](_0x8d09('0xa'),auth['isAuthenticated'](),controller[_0x8d09('0x27')]);router['delete']('/:id/teams',auth[_0x8d09('0xd')](),controller[_0x8d09('0x28')]);router['delete'](_0x8d09('0x16'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x8d09('0x26')]('/:id/lists',auth[_0x8d09('0xd')](),controller[_0x8d09('0x29')]);router['delete'](_0x8d09('0x1b'),auth[_0x8d09('0xd')](),controller[_0x8d09('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 40014f9..67dc480 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x116ce6,_0x47adf3){var _0x1cda4b=function(_0x115f41){while(--_0x115f41){_0x116ce6['push'](_0x116ce6['shift']());}};_0x1cda4b(++_0x47adf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x353847,_0x5c84de){var _0x40d8a6=function(_0x221958){while(--_0x221958){_0x353847['push'](_0x353847['shift']());}};_0x40d8a6(++_0x5c84de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9615387..eed240b 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 _0xcb91=['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','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','UserProfileResource','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select'];(function(_0x4e1ef7,_0x349fa5){var _0x20f191=function(_0x2db9e3){while(--_0x2db9e3){_0x4e1ef7['push'](_0x4e1ef7['shift']());}};_0x20f191(++_0x349fa5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0xcb91[_0x20cc29];return _0x28d513;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var licenseUtil=require(_0x1cb9('0x15'));var db=require(_0x1cb9('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1cb9('0x17'),'port':0x18eb});var socket=require(_0x1cb9('0x18'))(new Redis(config[_0x1cb9('0x19')]));require(_0x1cb9('0x1a'))['register'](socket);function respondWithStatusCode(_0x397727,_0x6ef389){_0x6ef389=_0x6ef389||0xcc;return function(_0x1b3cd7){if(_0x1b3cd7){return _0x397727[_0x1cb9('0x1b')](_0x6ef389);}return _0x397727[_0x1cb9('0x1c')](_0x6ef389)['end']();};}function respondWithResult(_0x5572cb,_0xd446a3){_0xd446a3=_0xd446a3||0xc8;return function(_0x3cc765){if(_0x3cc765){return _0x5572cb[_0x1cb9('0x1c')](_0xd446a3)[_0x1cb9('0x1d')](_0x3cc765);}};}function respondWithFilteredResult(_0x3e21e0,_0xf22920){return function(_0x23d3a9){if(_0x23d3a9){var _0x4e1340=_0x23d3a9[_0x1cb9('0x1e')],_0x479d43=_0xf22920[_0x1cb9('0x1f')],_0x1b2fa6=_0xf22920[_0x1cb9('0x1f')]+_0xf22920[_0x1cb9('0x20')],_0x41ac41;if(_0x1b2fa6>=_0x4e1340){_0x1b2fa6=_0x4e1340;_0x41ac41=0xc8;}else{_0x41ac41=0xce;}_0x3e21e0[_0x1cb9('0x1c')](_0x41ac41);return _0x3e21e0['set']('Content-Range',_0x479d43+'-'+_0x1b2fa6+'/'+_0x4e1340)[_0x1cb9('0x1d')](_0x23d3a9);}return null;};}function patchUpdates(_0x5dbfae){return function(_0x4750b1){try{jsonpatch[_0x1cb9('0x21')](_0x4750b1,_0x5dbfae,!![]);}catch(_0x523b26){return BPromise['reject'](_0x523b26);}return _0x4750b1[_0x1cb9('0x22')]();};}function saveUpdates(_0x325637,_0x103a63){return function(_0x4601b8){if(_0x4601b8){return _0x4601b8[_0x1cb9('0x23')](_0x325637)[_0x1cb9('0x24')](function(_0x59ebea){return _0x59ebea;});}return null;};}function removeEntity(_0x55b232,_0x6c6f61){return function(_0x557199){if(_0x557199){return _0x557199[_0x1cb9('0x25')]()[_0x1cb9('0x24')](function(){var _0x69b4c8=_0x557199[_0x1cb9('0x26')]({'plain':!![]});var _0x43a100=[{'name':'VoiceQueues','value':_0x1cb9('0x27'),'ignore':![]},{'name':_0x1cb9('0x28'),'value':'outbound','ignore':![]}];var _0xd6891c=_(_0x43a100)[_0x1cb9('0x29')](_0x1cb9('0x2a'))[_0x1cb9('0x2b')](_0x1cb9('0x2c'))[_0x1cb9('0x2c')]();if(_[_0x1cb9('0x2d')](_0xd6891c,_0x69b4c8[_0x1cb9('0x2e')])){return;}var _0x41e5c2=_[_0x1cb9('0x2f')](_0x43a100,['value',_0x69b4c8[_0x1cb9('0x2e')]])['name'];return db[_0x1cb9('0x30')]['destroy']({'where':{'type':_0x41e5c2,'resourceId':_0x69b4c8['id']}})[_0x1cb9('0x24')](function(){return _0x557199;});})[_0x1cb9('0x24')](function(){_0x55b232[_0x1cb9('0x1c')](0xcc)[_0x1cb9('0x31')]();});}};}function handleEntityNotFound(_0x561d89,_0x1c701f){return function(_0x4eba82){if(!_0x4eba82){_0x561d89[_0x1cb9('0x1b')](0x194);}return _0x4eba82;};}function handleError(_0x336a98,_0x4220d7){_0x4220d7=_0x4220d7||0x1f4;return function(_0x5d8793){logger[_0x1cb9('0x32')](_0x5d8793['stack']);if(_0x5d8793[_0x1cb9('0x33')]){delete _0x5d8793['name'];}_0x336a98[_0x1cb9('0x1c')](_0x4220d7)[_0x1cb9('0x34')](_0x5d8793);};}exports[_0x1cb9('0x35')]=function(_0xae910,_0x56c3e0){var _0x2114a4={},_0xf71b9a={},_0x3467d5={'count':0x0,'rows':[]};var _0x91a1db=_[_0x1cb9('0x2b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')],function(_0x1ed5ad){return{'name':_0x1ed5ad[_0x1cb9('0x38')],'type':_0x1ed5ad[_0x1cb9('0x2e')][_0x1cb9('0x39')]};});_0xf71b9a[_0x1cb9('0x3a')]=_[_0x1cb9('0x2b')](_0x91a1db,'name');_0xf71b9a['query']=_[_0x1cb9('0x3b')](_0xae910[_0x1cb9('0x3c')]);_0xf71b9a[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0xf71b9a[_0x1cb9('0x3a')],_0xf71b9a[_0x1cb9('0x3c')]);_0x2114a4[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0xf71b9a['model'],qs[_0x1cb9('0x40')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x2114a4['attributes']=_0x2114a4[_0x1cb9('0x3f')]['length']?_0x2114a4[_0x1cb9('0x3f')]:_0xf71b9a['model'];if(!_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x2114a4[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x2114a4['offset']=qs['offset'](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x2114a4[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x2114a4[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0xae910['query'],_0xf71b9a['filters']),_0x91a1db);if(_0xae910['query'][_0x1cb9('0x29')]){_0x2114a4[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x2114a4[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x91a1db,function(_0x4f551f){if(_0x4f551f[_0x1cb9('0x2e')]!=='VIRTUAL'){var _0x91121={};_0x91121[_0x4f551f[_0x1cb9('0x33')]]={'$like':'%'+_0xae910[_0x1cb9('0x3c')]['filter']+'%'};return _0x91121;}})});}_0x2114a4=_[_0x1cb9('0x47')]({},_0x2114a4,_0xae910['options']);var _0xda1a44={'where':_0x2114a4[_0x1cb9('0x45')]};return db['VoiceQueue']['count'](_0xda1a44)[_0x1cb9('0x24')](function(_0x339829){_0x3467d5[_0x1cb9('0x1e')]=_0x339829;if(_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x2114a4['include']=[{'all':!![]}];}return db[_0x1cb9('0x36')]['findAll'](_0x2114a4);})['then'](function(_0x495335){_0x3467d5[_0x1cb9('0x49')]=_0x495335;return _0x3467d5;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x56c3e0,_0x2114a4))[_0x1cb9('0x4a')](handleError(_0x56c3e0,null));};exports[_0x1cb9('0x4b')]=function(_0x116c05,_0x2a8b7f){var _0x40ca68={'raw':![],'where':{'id':_0x116c05[_0x1cb9('0x4c')]['id']}},_0x409b89={};_0x409b89[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db['VoiceQueue'][_0x1cb9('0x37')]);_0x409b89[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x116c05['query']);_0x409b89[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x409b89[_0x1cb9('0x3a')],_0x409b89[_0x1cb9('0x3c')]);_0x40ca68[_0x1cb9('0x3f')]=_['intersection'](_0x409b89[_0x1cb9('0x3a')],qs['fields'](_0x116c05[_0x1cb9('0x3c')]['fields']));_0x40ca68[_0x1cb9('0x3f')]=_0x40ca68[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x40ca68[_0x1cb9('0x3f')]:_0x409b89['model'];if(_0x116c05[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x40ca68[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x40ca68=_[_0x1cb9('0x47')]({},_0x40ca68,_0x116c05[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x40ca68)[_0x1cb9('0x24')](handleEntityNotFound(_0x2a8b7f,null))[_0x1cb9('0x24')](respondWithResult(_0x2a8b7f,null))[_0x1cb9('0x4a')](handleError(_0x2a8b7f,null));};exports['create']=function(_0x5092a6,_0x28c65d){return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_0x5092a6[_0x1cb9('0x51')],{})[_0x1cb9('0x24')](function(_0x2d076b){var _0x367dd7=_0x5092a6[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x367dd7)throw new Error(_0x1cb9('0x53'));if(_0x367dd7['role']===_0x1cb9('0x52')){var _0x5e773d=_0x2d076b[_0x1cb9('0x26')]({'plain':!![]});var _0x5201e8=[{'name':_0x1cb9('0x54'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x1cb9('0x55')}];var _0x3b0c2e=_[_0x1cb9('0x2f')](_0x5201e8,['value',_0x5e773d[_0x1cb9('0x2e')]])[_0x1cb9('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x3b0c2e,'userProfileId':_0x367dd7[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x3e70fc){if(_0x3e70fc&&_0x3e70fc[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x5e773d[_0x1cb9('0x33')],'resourceId':_0x5e773d['id'],'type':_0x3e70fc['name'],'sectionId':_0x3e70fc['id']},{})[_0x1cb9('0x24')](function(){return _0x2d076b;});}else{return _0x2d076b;}})[_0x1cb9('0x4a')](function(_0x108551){logger['error'](_0x1cb9('0x58'),_0x108551);throw _0x108551;});}return _0x2d076b;})[_0x1cb9('0x24')](respondWithResult(_0x28c65d,0xc9))[_0x1cb9('0x4a')](handleError(_0x28c65d,null));};exports[_0x1cb9('0x59')]=function(_0x12d283,_0x3c4681){var _0x5ae762={'where':{'id':_0x12d283[_0x1cb9('0x4c')]['id']}},_0x37ceb5={};_0x37ceb5[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')]);_0x5ae762[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x37ceb5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x12d283[_0x1cb9('0x3c')]['fields']));_0x5ae762[_0x1cb9('0x3f')]=_0x5ae762[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x5ae762[_0x1cb9('0x3f')]:_0x37ceb5['model'];if(_0x12d283['query'][_0x1cb9('0x48')]){_0x5ae762[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x5ae762=_[_0x1cb9('0x47')]({},_0x5ae762,_0x12d283[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x5ae762)[_0x1cb9('0x24')](handleEntityNotFound(_0x3c4681,null))[_0x1cb9('0x24')](function(_0x478bba){if(_0x478bba){var _0x49f74c=_0x478bba[_0x1cb9('0x26')]({'plain':!![]});_0x49f74c=qs['omit'](_0x49f74c,['id','createdAt','updatedAt']);_0x12d283['body']=_['omit'](_0x12d283[_0x1cb9('0x51')],['id',_0x1cb9('0x5a'),_0x1cb9('0x5b')]);return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_[_0x1cb9('0x47')](_0x49f74c,_0x12d283['body']),{'include':_0x12d283[_0x1cb9('0x3c')][_0x1cb9('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x58c7ed){var _0x150441=_0x12d283[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x150441)throw new Error(_0x1cb9('0x53'));if(_0x150441[_0x1cb9('0x5c')]==='user'){var _0x538ff0=_0x58c7ed['get']({'plain':!![]});var _0x270282=[{'name':_0x1cb9('0x54'),'value':_0x1cb9('0x27')},{'name':_0x1cb9('0x28'),'value':_0x1cb9('0x55')}];var _0x59bad0=_[_0x1cb9('0x2f')](_0x270282,[_0x1cb9('0x2c'),_0x538ff0['type']])['name'];return db[_0x1cb9('0x5d')]['find']({'where':{'name':_0x59bad0,'userProfileId':_0x150441[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x2c54ea){if(_0x2c54ea&&_0x2c54ea[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x538ff0['name'],'resourceId':_0x538ff0['id'],'type':_0x2c54ea[_0x1cb9('0x33')],'sectionId':_0x2c54ea['id']},{})[_0x1cb9('0x24')](function(){return _0x58c7ed;});}else{return _0x58c7ed;}})[_0x1cb9('0x4a')](function(_0x17c361){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c361);throw _0x17c361;});}return _0x58c7ed;});}})[_0x1cb9('0x24')](respondWithResult(_0x3c4681,0xc9))[_0x1cb9('0x4a')](handleError(_0x3c4681,null));};exports[_0x1cb9('0x23')]=function(_0x1ee140,_0x210b0b){if(_0x1ee140[_0x1cb9('0x51')]['id']){delete _0x1ee140['body']['id'];}return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x1ee140[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x210b0b,null))['then'](saveUpdates(_0x1ee140[_0x1cb9('0x51')],null))[_0x1cb9('0x24')](respondWithResult(_0x210b0b,null))[_0x1cb9('0x4a')](handleError(_0x210b0b,null));};exports['destroy']=function(_0x1b4878,_0x95be29){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x1b4878[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x95be29,null))['then'](removeEntity(_0x95be29,null))[_0x1cb9('0x4a')](handleError(_0x95be29,null));};exports[_0x1cb9('0x5e')]=function(_0x38d6a7,_0x4398dc,_0x3d3c1a){var _0x1da41c={'raw':![],'where':{}};var _0x128a41={};var _0x37bcd9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x38d6a7[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4398dc,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){_0x128a41[_0x1cb9('0x3a')]=_['keys'](db['CmHopper'][_0x1cb9('0x37')]);_0x128a41[_0x1cb9('0x3c')]=_['keys'](_0x38d6a7[_0x1cb9('0x3c')]);_0x128a41['filters']=_[_0x1cb9('0x3e')](_0x128a41[_0x1cb9('0x3a')],_0x128a41[_0x1cb9('0x3c')]);_0x1da41c[_0x1cb9('0x3f')]=_['intersection'](_0x128a41[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1da41c[_0x1cb9('0x3f')]=_0x1da41c[_0x1cb9('0x3f')]['length']?_0x1da41c[_0x1cb9('0x3f')]:_0x128a41[_0x1cb9('0x3a')];if(!_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x1da41c[_0x1cb9('0x20')]=qs['limit'](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1da41c['offset']=qs[_0x1cb9('0x1f')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x1da41c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x1da41c['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x38d6a7[_0x1cb9('0x3c')],_0x128a41[_0x1cb9('0x3d')]));_0x1da41c['where'][_0x1cb9('0x60')]=_0x5415fa['id'];if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1da41c[_0x1cb9('0x45')]=_['merge'](_0x1da41c[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x1da41c[_0x1cb9('0x3f')],function(_0x5d0e8c){var _0x10f13e={};_0x10f13e[_0x5d0e8c]={'$like':'%'+_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x10f13e;})});}_0x1da41c=_[_0x1cb9('0x47')]({},_0x1da41c,_0x38d6a7[_0x1cb9('0x4f')]);return db[_0x1cb9('0x61')][_0x1cb9('0x1e')]({'where':_0x1da41c['where']})[_0x1cb9('0x24')](function(_0x4b15a4){_0x37bcd9[_0x1cb9('0x1e')]=_0x4b15a4;if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x1da41c[_0x1cb9('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x1cb9('0x62')](_0x1da41c);})[_0x1cb9('0x24')](function(_0x5e68a1){_0x37bcd9[_0x1cb9('0x49')]=_0x5e68a1;return _0x37bcd9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x4398dc,_0x1da41c))[_0x1cb9('0x4a')](handleError(_0x4398dc,null));};exports[_0x1cb9('0x63')]=function(_0x453fa3,_0x52a3f1,_0x5e0e56){var _0x544d2d={'raw':!![],'where':{}};var _0x5ad853={};var _0x19daa1={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x453fa3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x52a3f1,null))[_0x1cb9('0x24')](function(_0x1e6402){if(_0x1e6402){_0x5ad853[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x64')][_0x1cb9('0x37')]);_0x5ad853[_0x1cb9('0x3c')]=_['keys'](_0x453fa3[_0x1cb9('0x3c')]);_0x5ad853[_0x1cb9('0x3d')]=_['intersection'](_0x5ad853[_0x1cb9('0x3a')],_0x5ad853[_0x1cb9('0x3c')]);_0x544d2d[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x5ad853['model'],qs[_0x1cb9('0x40')](_0x453fa3[_0x1cb9('0x3c')]['fields']));_0x544d2d['attributes']=_0x544d2d[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x544d2d['attributes']:_0x5ad853['model'];if(!_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x41')]('nolimit')){_0x544d2d['limit']=qs[_0x1cb9('0x20')](_0x453fa3['query']['limit']);_0x544d2d['offset']=qs[_0x1cb9('0x1f')](_0x453fa3['query'][_0x1cb9('0x1f')]);}_0x544d2d[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x453fa3['query'][_0x1cb9('0x44')]);_0x544d2d[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_['pick'](_0x453fa3[_0x1cb9('0x3c')],_0x5ad853[_0x1cb9('0x3d')]));_0x544d2d[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1e6402['id'];if(_0x453fa3[_0x1cb9('0x3c')]['filter']){_0x544d2d[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x544d2d[_0x1cb9('0x45')],{'$or':_['map'](_0x544d2d[_0x1cb9('0x3f')],function(_0x81962d){var _0x534378={};_0x534378[_0x81962d]={'$like':'%'+_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x534378;})});}_0x544d2d=_['merge']({},_0x544d2d,_0x453fa3[_0x1cb9('0x4f')]);return db[_0x1cb9('0x64')][_0x1cb9('0x1e')]({'where':_0x544d2d[_0x1cb9('0x45')]})[_0x1cb9('0x24')](function(_0x1768b8){_0x19daa1[_0x1cb9('0x1e')]=_0x1768b8;if(_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x544d2d[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x64')][_0x1cb9('0x62')](_0x544d2d);})[_0x1cb9('0x24')](function(_0x1b2b1c){_0x19daa1[_0x1cb9('0x49')]=_0x1b2b1c;return _0x19daa1;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x52a3f1,_0x544d2d))[_0x1cb9('0x4a')](handleError(_0x52a3f1,null));};exports[_0x1cb9('0x65')]=function(_0x48e879,_0x508a75,_0x13ba32){var _0x94d2c2={'raw':!![],'where':{}};var _0x20af42={};var _0x35f64f={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x48e879[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x508a75,null))['then'](function(_0x1d14a4){if(_0x1d14a4){_0x20af42[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x66')][_0x1cb9('0x37')]);_0x20af42['query']=_[_0x1cb9('0x3b')](_0x48e879[_0x1cb9('0x3c')]);_0x20af42[_0x1cb9('0x3d')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],_0x20af42[_0x1cb9('0x3c')]);_0x94d2c2[_0x1cb9('0x3f')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x48e879[_0x1cb9('0x3c')]['fields']));_0x94d2c2['attributes']=_0x94d2c2['attributes'][_0x1cb9('0x4d')]?_0x94d2c2[_0x1cb9('0x3f')]:_0x20af42[_0x1cb9('0x3a')];if(!_0x48e879['query'][_0x1cb9('0x41')]('nolimit')){_0x94d2c2['limit']=qs[_0x1cb9('0x20')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x94d2c2[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x94d2c2[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x48e879[_0x1cb9('0x3c')]['sort']);_0x94d2c2['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x48e879['query'],_0x20af42['filters']));_0x94d2c2['where']['VoiceQueueId']=_0x1d14a4['id'];if(_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x94d2c2['where']=_[_0x1cb9('0x47')](_0x94d2c2[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x94d2c2[_0x1cb9('0x3f')],function(_0x169b0f){var _0x5218ea={};_0x5218ea[_0x169b0f]={'$like':'%'+_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x5218ea;})});}_0x94d2c2=_[_0x1cb9('0x47')]({},_0x94d2c2,_0x48e879[_0x1cb9('0x4f')]);return db['CmHopperFinal'][_0x1cb9('0x1e')]({'where':_0x94d2c2[_0x1cb9('0x45')]})['then'](function(_0x5ee95a){_0x35f64f['count']=_0x5ee95a;if(_0x48e879[_0x1cb9('0x3c')]['includeAll']){_0x94d2c2[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x66')][_0x1cb9('0x62')](_0x94d2c2);})[_0x1cb9('0x24')](function(_0x31d1e5){_0x35f64f[_0x1cb9('0x49')]=_0x31d1e5;return _0x35f64f;});}})['then'](respondWithFilteredResult(_0x508a75,_0x94d2c2))[_0x1cb9('0x4a')](handleError(_0x508a75,null));};exports[_0x1cb9('0x67')]=function(_0x3726ba,_0x242cad,_0x699d37){var _0xf8e83f={'raw':!![],'where':{}};var _0x237e3b={};var _0x21e3fb={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x3726ba[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x242cad,null))[_0x1cb9('0x24')](function(_0x1022d8){if(_0x1022d8){_0x237e3b[_0x1cb9('0x3a')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x237e3b[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x3726ba['query']);_0x237e3b[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],_0x237e3b['query']);_0xf8e83f[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x3726ba[_0x1cb9('0x3c')]['fields']));_0xf8e83f[_0x1cb9('0x3f')]=_0xf8e83f['attributes']['length']?_0xf8e83f[_0x1cb9('0x3f')]:_0x237e3b[_0x1cb9('0x3a')];if(!_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0xf8e83f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x3726ba[_0x1cb9('0x3c')]['limit']);_0xf8e83f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0xf8e83f[_0x1cb9('0x43')]=qs['sort'](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0xf8e83f[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x3726ba['query'],_0x237e3b[_0x1cb9('0x3d')]));_0xf8e83f[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1022d8['id'];if(_0x3726ba['query'][_0x1cb9('0x29')]){_0xf8e83f[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0xf8e83f[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0xf8e83f[_0x1cb9('0x3f')],function(_0x4e3ad0){var _0x45dc8c={};_0x45dc8c[_0x4e3ad0]={'$like':'%'+_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x45dc8c;})});}_0xf8e83f=_['merge']({},_0xf8e83f,_0x3726ba[_0x1cb9('0x4f')]);return db[_0x1cb9('0x68')]['count']({'where':_0xf8e83f['where']})[_0x1cb9('0x24')](function(_0x3fc823){_0x21e3fb[_0x1cb9('0x1e')]=_0x3fc823;if(_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0xf8e83f['include']=[{'all':!![]}];}return db[_0x1cb9('0x68')][_0x1cb9('0x62')](_0xf8e83f);})[_0x1cb9('0x24')](function(_0x3180dd){_0x21e3fb[_0x1cb9('0x49')]=_0x3180dd;return _0x21e3fb;});}})['then'](respondWithFilteredResult(_0x242cad,_0xf8e83f))['catch'](handleError(_0x242cad,null));};exports[_0x1cb9('0x69')]=function(_0x35383b,_0x9f2cb1,_0x4f7cc8){var _0x53c35a={};var _0x40d403={};var _0x3c4b2b;var _0x33d06a;return db['VoiceQueue']['findOne']({'where':{'id':_0x35383b['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x9f2cb1,null))[_0x1cb9('0x24')](function(_0x27995f){if(_0x27995f){_0x3c4b2b=_0x27995f;_0x40d403['model']=_[_0x1cb9('0x3b')](db['Team'][_0x1cb9('0x37')]);_0x40d403[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x35383b[_0x1cb9('0x3c')]);_0x40d403[_0x1cb9('0x3d')]=_['intersection'](_0x40d403[_0x1cb9('0x3a')],_0x40d403['query']);_0x53c35a[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x40d403[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x35383b[_0x1cb9('0x3c')]['fields']));_0x53c35a[_0x1cb9('0x3f')]=_0x53c35a[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x53c35a[_0x1cb9('0x3f')]:_0x40d403[_0x1cb9('0x3a')];_0x53c35a[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x35383b['query']['sort']);_0x53c35a[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x35383b[_0x1cb9('0x3c')],_0x40d403[_0x1cb9('0x3d')]));if(_0x35383b['query'][_0x1cb9('0x29')]){_0x53c35a[_0x1cb9('0x45')]=_['merge'](_0x53c35a['where'],{'$or':_[_0x1cb9('0x2b')](_0x53c35a['attributes'],function(_0x2f5a5f){var _0x4af9bb={};_0x4af9bb[_0x2f5a5f]={'$like':'%'+_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x4af9bb;})});}_0x53c35a=_[_0x1cb9('0x47')]({},_0x53c35a,_0x35383b[_0x1cb9('0x4f')]);return _0x3c4b2b[_0x1cb9('0x69')](_0x53c35a);}})[_0x1cb9('0x24')](function(_0x2c7326){if(_0x2c7326){_0x33d06a=_0x2c7326[_0x1cb9('0x4d')];if(!_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x53c35a[_0x1cb9('0x20')]=qs['limit'](_0x35383b['query']['limit']);_0x53c35a['offset']=qs[_0x1cb9('0x1f')](_0x35383b[_0x1cb9('0x3c')]['offset']);}return _0x3c4b2b['getTeams'](_0x53c35a);}})['then'](function(_0x3cf4ff){if(_0x3cf4ff){return _0x3cf4ff?{'count':_0x33d06a,'rows':_0x3cf4ff}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x9f2cb1,null))[_0x1cb9('0x4a')](handleError(_0x9f2cb1,null));};exports[_0x1cb9('0x6a')]=function(_0x4d66d3,_0x178cba,_0x2492a0){var _0x436364=_0x4d66d3['body'][_0x1cb9('0x6b')];var _0x2d9fcb=_['map'](_0x436364,'id');return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x2d9fcb},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id',_0x1cb9('0x33'),_0x1cb9('0x6f'),_0x1cb9('0x70'),_0x1cb9('0x71')],'raw':!![]}]})[_0x1cb9('0x24')](function(_0x4ea5ae){if(_0x4ea5ae){var _0x183bdb=_[_0x1cb9('0x72')](_0x4ea5ae,function(_0x21c0ab){var _0x384183=_0x21c0ab[_0x1cb9('0x26')]({'plain':!![]});_0x384183[_0x1cb9('0x6e')][_0x1cb9('0x73')](function(_0xd171b9){_0xd171b9[_0x1cb9('0x74')]=_[_0x1cb9('0x2f')](_0x436364,{'id':_0x384183['id']})['penalty'];});return _0x384183[_0x1cb9('0x6e')];});return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x4d66d3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(_0x523fdb){return db[_0x1cb9('0x75')]['transaction'](function(_0x51770e){return _0x523fdb[_0x1cb9('0x6a')](_0x2d9fcb,{'transaction':_0x51770e})[_0x1cb9('0x24')](function(){return BPromise[_0x1cb9('0x76')](_0x183bdb,function(_0x182e0d){return db[_0x1cb9('0x77')][_0x1cb9('0x78')]({'where':{'UserId':_0x182e0d['id'],'VoiceQueueId':_0x4d66d3[_0x1cb9('0x4c')]['id']},'defaults':{'penalty':_0x182e0d[_0x1cb9('0x74')]},'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){return BPromise['each'](_['filter'](_0x183bdb,{'online':!![]}),function(_0x98f5cf){return db[_0x1cb9('0x79')][_0x1cb9('0x7a')]({'membername':_0x98f5cf[_0x1cb9('0x33')],'UserId':_0x98f5cf['id'],'queue_name':_0x523fdb[_0x1cb9('0x33')],'VoiceQueueId':_0x523fdb['id'],'interface':_[_0x1cb9('0x7b')](_0x98f5cf[_0x1cb9('0x71')])?util[_0x1cb9('0x7c')](_0x1cb9('0x7d'),_0x98f5cf[_0x1cb9('0x33')]):_0x98f5cf['interface'],'paused':_0x98f5cf[_0x1cb9('0x70')]||![],'penalty':_0x98f5cf[_0x1cb9('0x74')]},{'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){_0x183bdb[_0x1cb9('0x73')](function(_0xd38514){socket[_0x1cb9('0x7e')]('userVoiceQueue:save',{'UserId':_0xd38514['id'],'VoiceQueueId':_0x523fdb['id']});});});});});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x178cba,null))[_0x1cb9('0x4a')](handleError(_0x178cba,null));};exports[_0x1cb9('0x7f')]=function(_0x40f1e3,_0x3d72d7,_0x1bf6a4){return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')]},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x3d72d7,null))[_0x1cb9('0x24')](function(_0x399537){var _0x1ad996=_[_0x1cb9('0x2b')](_0x399537,'id');var _0x42622e=[];var _0x27390a=[];var _0x36761a=squel[_0x1cb9('0x81')]();_0x36761a[_0x1cb9('0x82')](_0x1cb9('0x83'))[_0x1cb9('0x84')](_0x1cb9('0x85'),'tq')[_0x1cb9('0x86')](_0x1cb9('0x87'),'ut',_0x1cb9('0x88'))[_0x1cb9('0x45')](_0x1cb9('0x89'),_0x40f1e3['params']['id']);for(var _0x11a83c=0x0;_0x11a83c<_0x399537[_0x1cb9('0x4d')];_0x11a83c+=0x1){let _0x16ec06=_0x399537[_0x11a83c];for(var _0x9ab004=0x0;_0x9ab004<_0x16ec06[_0x1cb9('0x6e')][_0x1cb9('0x4d')];_0x9ab004+=0x1){let _0x4cd6fc=_0x16ec06[_0x1cb9('0x6e')][_0x9ab004];var _0x56e26b=_0x36761a[_0x1cb9('0x59')]();_0x56e26b[_0x1cb9('0x45')](_0x1cb9('0x8a'),_0x4cd6fc['id']);_0x27390a['push'](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x56e26b[_0x1cb9('0x8b')](),{'type':db[_0x1cb9('0x75')]['QueryTypes'][_0x1cb9('0x8c')]})[_0x1cb9('0x24')](function(_0x3557bd){if(_0x3557bd[_0x1cb9('0x4d')]===0x1){return _0x4cd6fc['id'];}else{var _0x4f0c63=_[_0x1cb9('0x8d')](_[_0x1cb9('0x2b')](_0x3557bd,'TeamId'),function(_0x21d844){return _[_0x1cb9('0x2d')](_0x1ad996,_0x21d844);});if(_0x4f0c63){return _0x4cd6fc['id'];}}}));}}return BPromise[_0x1cb9('0x8e')](_0x27390a)[_0x1cb9('0x24')](function(_0x196350){_0x42622e=_(_0x42622e)[_0x1cb9('0x8f')](_0x196350)[_0x1cb9('0x90')]()[_0x1cb9('0x2c')]();return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x40f1e3[_0x1cb9('0x4c')]['id']}})['then'](function(_0x2d2180){return db['sequelize'][_0x1cb9('0x91')](function(_0x328e5a){return _0x2d2180[_0x1cb9('0x7f')](_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')],{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){if(!_[_0x1cb9('0x92')](_0x42622e)){return _0x2d2180[_0x1cb9('0x93')](_0x42622e,{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x40f1e3[_0x1cb9('0x4c')]['id'],'UserId':_0x42622e},'transaction':_0x328e5a});});}})[_0x1cb9('0x24')](function(){_0x42622e['forEach'](function(_0x44b50d){socket[_0x1cb9('0x7e')](_0x1cb9('0x94'),{'UserId':_0x44b50d,'VoiceQueueId':_0x2d2180['id']});});});});});});})['then'](respondWithStatusCode(_0x3d72d7,null))['catch'](handleError(_0x3d72d7,null));};exports['addAgents']=function(_0x46e35d,_0x2dd501,_0x5018c5){var _0x47d696,_0x31627f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x46e35d[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dd501,null))[_0x1cb9('0x24')](function(_0x149b0c){if(_0x149b0c){_0x31627f=_0x149b0c;return _0x149b0c[_0x1cb9('0x95')](_0x46e35d[_0x1cb9('0x51')]['ids'],_[_0x1cb9('0x96')](_0x46e35d[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{})[_0x1cb9('0x97')](function(_0x463d1c){for(var _0x3908a8=0x0;_0x3908a8<_0x46e35d['body'][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0x3908a8+=0x1){socket[_0x1cb9('0x7e')](_0x1cb9('0x98'),{'UserId':_0x46e35d[_0x1cb9('0x51')][_0x1cb9('0x80')][_0x3908a8],'VoiceQueueId':_0x46e35d[_0x1cb9('0x4c')]['id']});}return _0x463d1c;});}})[_0x1cb9('0x24')](function(_0xa43246){_0x47d696=_0xa43246||[];if(_0x31627f){return db[_0x1cb9('0x6d')][_0x1cb9('0x62')]({'where':{'id':_0x46e35d['body'][_0x1cb9('0x80')]},'attributes':['id',_0x1cb9('0x33'),'online',_0x1cb9('0x70'),'interface'],'raw':!![]});}})[_0x1cb9('0x24')](function(_0x28f70a){if(!_[_0x1cb9('0x92')](_0x28f70a)){var _0x46fb97=[];for(var _0x193c14=0x0;_0x193c14<_0x28f70a[_0x1cb9('0x4d')];_0x193c14++){if(_0x28f70a[_0x193c14][_0x1cb9('0x6f')]){_0x46fb97[_0x1cb9('0x99')](db[_0x1cb9('0x79')]['upsert']({'membername':_0x28f70a[_0x193c14]['name'],'UserId':_0x28f70a[_0x193c14]['id'],'queue_name':_0x31627f['name'],'VoiceQueueId':_0x31627f['id'],'interface':_[_0x1cb9('0x7b')](_0x28f70a[_0x193c14][_0x1cb9('0x71')])?util[_0x1cb9('0x7c')]('SIP/%s',_0x28f70a[_0x193c14][_0x1cb9('0x33')]):_0x28f70a[_0x193c14][_0x1cb9('0x71')],'paused':_0x28f70a[_0x193c14][_0x1cb9('0x70')]||![],'penalty':_0x46e35d[_0x1cb9('0x51')]['penalty']||0x0}));}}return BPromise['all'](_0x46fb97);}})[_0x1cb9('0x24')](function(){return _0x47d696;})[_0x1cb9('0x24')](respondWithResult(_0x2dd501,null))['catch'](handleError(_0x2dd501,null));};exports[_0x1cb9('0x93')]=function(_0x3b7e24,_0x5c58a7,_0x18132b){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x3b7e24['params']['id']}})['then'](handleEntityNotFound(_0x5c58a7,null))[_0x1cb9('0x24')](function(_0x73fc01){if(_0x73fc01){return _0x73fc01['removeAgents'](_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x9a')](_0x3b7e24['query'][_0x1cb9('0x80')])){for(var _0xb76fc2=0x0;_0xb76fc2<_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0xb76fc2+=0x1){socket['emit'](_0x1cb9('0x94'),{'UserId':Number(_0x3b7e24['query'][_0x1cb9('0x80')][_0xb76fc2]),'VoiceQueueId':Number(_0x3b7e24['params']['id'])});}}else{socket[_0x1cb9('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')]),'VoiceQueueId':Number(_0x3b7e24[_0x1cb9('0x4c')]['id'])});}});}})[_0x1cb9('0x24')](function(_0x3f54a8){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x3b7e24[_0x1cb9('0x4c')]['id'],'UserId':_0x3b7e24['query'][_0x1cb9('0x80')]}})[_0x1cb9('0x24')](function(){return _0x3f54a8;});})[_0x1cb9('0x24')](respondWithStatusCode(_0x5c58a7,null))[_0x1cb9('0x4a')](handleError(_0x5c58a7,null));};exports[_0x1cb9('0x9b')]=function(_0x42f11b,_0x55fa4a,_0x4e85b0){var _0x335df3={};var _0x155ee5={};var _0x40ad48;var _0x17a6a2;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x42f11b['params']['id']}})['then'](handleEntityNotFound(_0x55fa4a,null))[_0x1cb9('0x24')](function(_0x416300){if(_0x416300){_0x40ad48=_0x416300;_0x155ee5[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x6d')][_0x1cb9('0x37')]);_0x155ee5[_0x1cb9('0x3c')]=_['keys'](_0x42f11b[_0x1cb9('0x3c')]);_0x155ee5[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],_0x155ee5[_0x1cb9('0x3c')]);_0x335df3[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x335df3[_0x1cb9('0x3f')]=_0x335df3['attributes'][_0x1cb9('0x4d')]?_0x335df3['attributes']:_0x155ee5['model'];_0x335df3['order']=qs['sort'](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x335df3['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x42f11b[_0x1cb9('0x3c')],_0x155ee5[_0x1cb9('0x3d')]));if(_0x42f11b[_0x1cb9('0x3c')]['filter']){_0x335df3[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x335df3[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x335df3[_0x1cb9('0x3f')],function(_0x27064d){var _0x2ddb5f={};_0x2ddb5f[_0x27064d]={'$like':'%'+_0x42f11b[_0x1cb9('0x3c')]['filter']+'%'};return _0x2ddb5f;})});}_0x335df3=_[_0x1cb9('0x47')]({},_0x335df3,_0x42f11b['options']);return _0x40ad48[_0x1cb9('0x9b')](_0x335df3);}})['then'](function(_0xb75f4d){if(_0xb75f4d){_0x17a6a2=_0xb75f4d[_0x1cb9('0x4d')];if(!_0x42f11b[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x335df3[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x335df3['offset']=qs[_0x1cb9('0x1f')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x40ad48['getAgents'](_0x335df3);}})[_0x1cb9('0x24')](function(_0x1978d3){if(_0x1978d3){return _0x1978d3?{'count':_0x17a6a2,'rows':_0x1978d3}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x55fa4a,null))[_0x1cb9('0x4a')](handleError(_0x55fa4a,null));};exports['getMembers']=function(_0x25486c,_0x4ee661,_0x4e7706){var _0x327071={};var _0x48afe4={};var _0x209ba0;var _0x57685a;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x25486c['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x4ee661,null))[_0x1cb9('0x24')](function(_0x14cfb9){if(_0x14cfb9){_0x209ba0=_0x14cfb9;_0x48afe4[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x79')]['rawAttributes']);_0x48afe4[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x25486c[_0x1cb9('0x3c')]);_0x48afe4[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],_0x48afe4['query']);_0x327071['attributes']=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x25486c[_0x1cb9('0x3c')]['fields']));_0x327071[_0x1cb9('0x3f')]=_0x327071[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x327071['attributes']:_0x48afe4[_0x1cb9('0x3a')];_0x327071[_0x1cb9('0x43')]=qs['sort'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x327071['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x25486c[_0x1cb9('0x3c')],_0x48afe4[_0x1cb9('0x3d')]));if(_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x327071[_0x1cb9('0x45')]=_['merge'](_0x327071[_0x1cb9('0x45')],{'$or':_['map'](_0x327071[_0x1cb9('0x3f')],function(_0x1bb6e2){var _0x11869b={};_0x11869b[_0x1bb6e2]={'$like':'%'+_0x25486c[_0x1cb9('0x3c')]['filter']+'%'};return _0x11869b;})});}_0x327071=_[_0x1cb9('0x47')]({},_0x327071,_0x25486c[_0x1cb9('0x4f')]);return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})['then'](function(_0x3acaf7){if(_0x3acaf7){_0x57685a=_0x3acaf7['length'];if(!_0x25486c['query'][_0x1cb9('0x41')]('nolimit')){_0x327071[_0x1cb9('0x20')]=qs['limit'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x327071[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})[_0x1cb9('0x24')](function(_0x1a4b8c){return _0x1a4b8c?{'count':_0x57685a,'rows':_0x1a4b8c}:null;})[_0x1cb9('0x24')](respondWithResult(_0x4ee661,null))[_0x1cb9('0x4a')](handleError(_0x4ee661,null));};exports[_0x1cb9('0x9d')]=function(_0x1b40ed,_0x50c592,_0x362ccf){var _0x183798={};var _0x572f51={};var _0x530922;var _0xc2f0cc;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x1b40ed['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x50c592,null))[_0x1cb9('0x24')](function(_0x55d14f){if(_0x55d14f){_0x530922=_0x55d14f;_0x572f51[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x572f51[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x1b40ed['query']);_0x572f51[_0x1cb9('0x3d')]=_['intersection'](_0x572f51[_0x1cb9('0x3a')],_0x572f51['query']);_0x183798[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x572f51[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x183798['attributes']=_0x183798[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x183798[_0x1cb9('0x3f')]:_0x572f51['model'];_0x183798['order']=qs[_0x1cb9('0x44')](_0x1b40ed['query'][_0x1cb9('0x44')]);_0x183798[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x1b40ed[_0x1cb9('0x3c')],_0x572f51[_0x1cb9('0x3d')]));if(_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x183798[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x183798[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x183798[_0x1cb9('0x3f')],function(_0x31f74e){var _0x209a74={};_0x209a74[_0x31f74e]={'$like':'%'+_0x1b40ed['query'][_0x1cb9('0x29')]+'%'};return _0x209a74;})});}_0x183798=_[_0x1cb9('0x47')]({},_0x183798,_0x1b40ed[_0x1cb9('0x4f')]);return _0x530922[_0x1cb9('0x9d')](_0x183798);}})[_0x1cb9('0x24')](function(_0x5d0cd8){if(_0x5d0cd8){_0xc2f0cc=_0x5d0cd8[_0x1cb9('0x4d')];if(!_0x1b40ed[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x183798[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x183798[_0x1cb9('0x1f')]=qs['offset'](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x530922['getLists'](_0x183798);}})[_0x1cb9('0x24')](function(_0x16aaad){if(_0x16aaad){return _0x16aaad?{'count':_0xc2f0cc,'rows':_0x16aaad}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x50c592,null))['catch'](handleError(_0x50c592,null));};exports['addLists']=function(_0x465b41,_0x1ee133,_0x1c4e81){var _0x43b7b1,_0x26368f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x465b41['params']['id']}})['then'](handleEntityNotFound(_0x1ee133,null))['then'](function(_0x272cbc){if(_0x272cbc){_0x26368f=_0x272cbc;return _0x272cbc['addLists'](_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x80')],_[_0x1cb9('0x96')](_0x465b41[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x46ae55){var _0x590374;_0x43b7b1=_0x46ae55||[];var _0x4ecf13=[];if(_0x46ae55){for(var _0x2a4878=0x0;_0x2a4878<_0x46ae55[_0x1cb9('0x4d')];_0x2a4878+=0x1){var _0x267b06=_0x46ae55[_0x2a4878]['get']({'plain':!![]});_0x26368f[_0x1cb9('0x9f')]=_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]?_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]:_0x26368f[_0x1cb9('0x9f')];switch(_0x26368f[_0x1cb9('0x9f')]){case _0x1cb9('0xa0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))[_0x1cb9('0xa4')]([_0x1cb9('0xa5'),_0x1cb9('0xa6'),_0x1cb9('0xa7'),'ListId',_0x1cb9('0x60'),'createdAt','updatedAt'],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0xa6'))['field']('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')['field'](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),_0x1cb9('0x60'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))['where']('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x81')]()['field'](_0x1cb9('0xac'))['from'](_0x1cb9('0xad'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']()))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xaf'))['from'](_0x1cb9('0xa3'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')]())))[_0x1cb9('0x8b')]();break;case _0x1cb9('0xb0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))['fromQuery'](['phone','scheduledAt',_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field']('NOW()',_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id',_0x1cb9('0xa7'))[_0x1cb9('0x82')](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3'))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x1cb9('0x84')]('cm_hopper')['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']())))[_0x1cb9('0x8b')]();break;default:_0x590374=squel[_0x1cb9('0xa1')]()['into'](_0x1cb9('0xa3'))[_0x1cb9('0xa4')](['phone',_0x1cb9('0xa6'),_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel['select']()['field'](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field'](_0x1cb9('0xa8'),_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),'updatedAt')[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))[_0x1cb9('0x45')]('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3')))[_0x1cb9('0x8b')]();}_0x4ecf13[_0x1cb9('0x99')](db[_0x1cb9('0x75')]['query'](_0x590374));}return BPromise[_0x1cb9('0x8e')](_0x4ecf13);}})['then'](function(){return _0x43b7b1;})[_0x1cb9('0x24')](respondWithResult(_0x1ee133,null))[_0x1cb9('0x4a')](handleError(_0x1ee133,null));};exports['removeLists']=function(_0x49444a,_0x1f3976,_0x3fb70a){return db['VoiceQueue'][_0x1cb9('0x2f')]({'where':{'id':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x1f3976,null))[_0x1cb9('0x24')](function(_0x3ea026){if(_0x3ea026){return _0x3ea026[_0x1cb9('0xb4')](_0x49444a[_0x1cb9('0x3c')][_0x1cb9('0x80')]);}})[_0x1cb9('0x24')](function(_0x2db8b9){if(_0x2db8b9){return db[_0x1cb9('0x61')][_0x1cb9('0x25')]({'where':{'ListId':_0x49444a[_0x1cb9('0x3c')]['ids'],'VoiceQueueId':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(){return _0x2db8b9;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x1f3976,null))[_0x1cb9('0x4a')](handleError(_0x1f3976,null));};exports[_0x1cb9('0xb5')]=function(_0x355c3a,_0x5c9814,_0xd4ba25){var _0x1a6c4c={};var _0x4f4e04={};var _0x209197;var _0x35e3f4;return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x355c3a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5c9814,null))[_0x1cb9('0x24')](function(_0x2a799f){if(_0x2a799f){_0x209197=_0x2a799f;_0x4f4e04[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x4f4e04[_0x1cb9('0x3c')]=_['keys'](_0x355c3a[_0x1cb9('0x3c')]);_0x4f4e04['filters']=_['intersection'](_0x4f4e04[_0x1cb9('0x3a')],_0x4f4e04[_0x1cb9('0x3c')]);_0x1a6c4c[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x4f4e04['model'],qs[_0x1cb9('0x40')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1a6c4c[_0x1cb9('0x3f')]=_0x1a6c4c[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x1a6c4c[_0x1cb9('0x3f')]:_0x4f4e04['model'];_0x1a6c4c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x355c3a[_0x1cb9('0x3c')]['sort']);_0x1a6c4c[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x355c3a[_0x1cb9('0x3c')],_0x4f4e04[_0x1cb9('0x3d')]));if(_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1a6c4c['where']=_['merge'](_0x1a6c4c['where'],{'$or':_['map'](_0x1a6c4c[_0x1cb9('0x3f')],function(_0x48fa02){var _0x35302e={};_0x35302e[_0x48fa02]={'$like':'%'+_0x355c3a['query'][_0x1cb9('0x29')]+'%'};return _0x35302e;})});}_0x1a6c4c=_[_0x1cb9('0x47')]({},_0x1a6c4c,_0x355c3a[_0x1cb9('0x4f')]);return _0x209197[_0x1cb9('0xb5')](_0x1a6c4c);}})[_0x1cb9('0x24')](function(_0x138763){if(_0x138763){_0x35e3f4=_0x138763[_0x1cb9('0x4d')];if(!_0x355c3a[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x1a6c4c[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1a6c4c['offset']=qs['offset'](_0x355c3a[_0x1cb9('0x3c')]['offset']);}return _0x209197['getBlackLists'](_0x1a6c4c);}})['then'](function(_0x331c18){if(_0x331c18){return _0x331c18?{'count':_0x35e3f4,'rows':_0x331c18}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x5c9814,null))[_0x1cb9('0x4a')](handleError(_0x5c9814,null));};exports[_0x1cb9('0xb6')]=function(_0x836ef4,_0x5a407f,_0x19ac33){var _0x12e221,_0x5cd228;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x836ef4[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5a407f,null))[_0x1cb9('0x24')](function(_0x74cb14){if(_0x74cb14){_0x5cd228=_0x74cb14;return _0x74cb14[_0x1cb9('0xb6')](_0x836ef4['body'][_0x1cb9('0x80')],_['omit'](_0x836ef4['body'],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x2c9609){var _0x169e38;_0x12e221=_0x2c9609||[];var _0x2b4f5c=[];if(_0x2c9609){for(var _0x50bed6=0x0;_0x50bed6<_0x2c9609[_0x1cb9('0x4d')];_0x50bed6+=0x1){var _0x290bb3=_0x2c9609[_0x50bed6][_0x1cb9('0x26')]({'plain':!![]});_0x169e38=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xb7'))['fromQuery']([_0x1cb9('0xa5'),_0x1cb9('0xa7'),'ListId','VoiceQueueId',_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),'phone')[_0x1cb9('0x82')]('id','ContactId')[_0x1cb9('0x82')](_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x836ef4['params']['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))['from'](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x8b')]();_0x2b4f5c[_0x1cb9('0x99')](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x169e38));}return BPromise['all'](_0x2b4f5c);}})[_0x1cb9('0x24')](function(){return _0x12e221;})[_0x1cb9('0x24')](respondWithResult(_0x5a407f,null))['catch'](handleError(_0x5a407f,null));};exports[_0x1cb9('0xb8')]=function(_0x18a18f,_0x202c3a,_0x5b39f7){return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x18a18f[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x202c3a,null))['then'](function(_0x10f6f6){if(_0x10f6f6){return _0x10f6f6[_0x1cb9('0xb8')](_0x18a18f[_0x1cb9('0x3c')]['ids']);}})[_0x1cb9('0x24')](function(_0x3d4a83){if(_0x3d4a83){return db['CmHopperBlack'][_0x1cb9('0x25')]({'where':{'ListId':_0x18a18f[_0x1cb9('0x3c')][_0x1cb9('0x80')],'VoiceQueueId':_0x18a18f[_0x1cb9('0x4c')]['id']}})['then'](function(){return _0x3d4a83;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x202c3a,null))['catch'](handleError(_0x202c3a,null));}; \ No newline at end of file +var _0x0713=['updatedAt','role','getHoppers','findOne','CmHopper','nolimit','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','Team','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','ids','removeAgents','emit','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','error','name','send','VoiceQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','options','findAll','rows','catch','rawAttributes','includeAll','include','create','body','user','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt'];(function(_0x59bdcc,_0x12f159){var _0x560bbb=function(_0xfb0c8e){while(--_0xfb0c8e){_0x59bdcc['push'](_0x59bdcc['shift']());}};_0x560bbb(++_0x12f159);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];config['redis']=_['defaults'](config[_0x3071('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3071('0x1c'))(new Redis(config[_0x3071('0x1b')]));require('./voiceQueue.socket')[_0x3071('0x1d')](socket);function respondWithStatusCode(_0x4e1219,_0x2fc15d){_0x2fc15d=_0x2fc15d||0xcc;return function(_0x45c93b){if(_0x45c93b){return _0x4e1219[_0x3071('0x1e')](_0x2fc15d);}return _0x4e1219[_0x3071('0x1f')](_0x2fc15d)[_0x3071('0x20')]();};}function respondWithResult(_0x2a6a4b,_0x157a47){_0x157a47=_0x157a47||0xc8;return function(_0x11bdc9){if(_0x11bdc9){return _0x2a6a4b[_0x3071('0x1f')](_0x157a47)[_0x3071('0x21')](_0x11bdc9);}};}function respondWithFilteredResult(_0x5f3c22,_0x224996){return function(_0x17dbda){if(_0x17dbda){var _0x1068d9=_0x17dbda[_0x3071('0x22')],_0x108a83=_0x224996[_0x3071('0x23')],_0x3acf0e=_0x224996['offset']+_0x224996[_0x3071('0x24')],_0x17aee2;if(_0x3acf0e>=_0x1068d9){_0x3acf0e=_0x1068d9;_0x17aee2=0xc8;}else{_0x17aee2=0xce;}_0x5f3c22[_0x3071('0x1f')](_0x17aee2);return _0x5f3c22[_0x3071('0x25')]('Content-Range',_0x108a83+'-'+_0x3acf0e+'/'+_0x1068d9)[_0x3071('0x21')](_0x17dbda);}return null;};}function patchUpdates(_0x5cd80d){return function(_0x833074){try{jsonpatch[_0x3071('0x26')](_0x833074,_0x5cd80d,!![]);}catch(_0x3762d8){return BPromise[_0x3071('0x27')](_0x3762d8);}return _0x833074[_0x3071('0x28')]();};}function saveUpdates(_0x34c50e,_0x3c5cef){return function(_0x211b4f){if(_0x211b4f){return _0x211b4f['update'](_0x34c50e)['then'](function(_0x2ce48a){return _0x2ce48a;});}return null;};}function removeEntity(_0xb05b1d,_0x412652){return function(_0x13df9f){if(_0x13df9f){return _0x13df9f[_0x3071('0x29')]()[_0x3071('0x2a')](function(){var _0x7a4cb4=_0x13df9f[_0x3071('0x2b')]({'plain':!![]});var _0x1de5fb=[{'name':'VoiceQueues','value':_0x3071('0x2c'),'ignore':![]},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e'),'ignore':![]}];var _0x4d5c4b=_(_0x1de5fb)[_0x3071('0x2f')](_0x3071('0x30'))[_0x3071('0x31')](_0x3071('0x32'))[_0x3071('0x32')]();if(_[_0x3071('0x33')](_0x4d5c4b,_0x7a4cb4[_0x3071('0x34')])){return;}var _0x3921a1=_[_0x3071('0x35')](_0x1de5fb,[_0x3071('0x32'),_0x7a4cb4[_0x3071('0x34')]])['name'];return db['UserProfileResource'][_0x3071('0x29')]({'where':{'type':_0x3921a1,'resourceId':_0x7a4cb4['id']}})[_0x3071('0x2a')](function(){return _0x13df9f;});})[_0x3071('0x2a')](function(){_0xb05b1d[_0x3071('0x1f')](0xcc)[_0x3071('0x20')]();});}};}function handleEntityNotFound(_0x29538c,_0x32b6b1){return function(_0x1ccc41){if(!_0x1ccc41){_0x29538c['sendStatus'](0x194);}return _0x1ccc41;};}function handleError(_0x55d230,_0x4ab983){_0x4ab983=_0x4ab983||0x1f4;return function(_0x1b0aaf){logger[_0x3071('0x36')](_0x1b0aaf['stack']);if(_0x1b0aaf[_0x3071('0x37')]){delete _0x1b0aaf[_0x3071('0x37')];}_0x55d230[_0x3071('0x1f')](_0x4ab983)[_0x3071('0x38')](_0x1b0aaf);};}exports['index']=function(_0x218a82,_0x1525df){var _0x602719={},_0x240443={},_0x148096={'count':0x0,'rows':[]};var _0x2068ce=_[_0x3071('0x31')](db[_0x3071('0x39')]['rawAttributes'],function(_0x3988eb){return{'name':_0x3988eb['fieldName'],'type':_0x3988eb['type'][_0x3071('0x3a')]};});_0x240443[_0x3071('0x3b')]=_['map'](_0x2068ce,_0x3071('0x37'));_0x240443[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x218a82[_0x3071('0x3c')]);_0x240443[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x240443['model'],_0x240443[_0x3071('0x3c')]);_0x602719[_0x3071('0x40')]=_['intersection'](_0x240443[_0x3071('0x3b')],qs['fields'](_0x218a82[_0x3071('0x3c')][_0x3071('0x41')]));_0x602719['attributes']=_0x602719['attributes'][_0x3071('0x42')]?_0x602719[_0x3071('0x40')]:_0x240443[_0x3071('0x3b')];if(!_0x218a82['query'][_0x3071('0x43')]('nolimit')){_0x602719[_0x3071('0x24')]=qs['limit'](_0x218a82[_0x3071('0x3c')][_0x3071('0x24')]);_0x602719[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x218a82[_0x3071('0x3c')]['offset']);}_0x602719['order']=qs[_0x3071('0x44')](_0x218a82[_0x3071('0x3c')][_0x3071('0x44')]);_0x602719[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x218a82[_0x3071('0x3c')],_0x240443[_0x3071('0x3e')]),_0x2068ce);if(_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]){_0x602719[_0x3071('0x45')]=_['merge'](_0x602719[_0x3071('0x45')],{'$or':_['map'](_0x2068ce,function(_0x4c8b1f){if(_0x4c8b1f['type']!=='VIRTUAL'){var _0x2992e6={};_0x2992e6[_0x4c8b1f[_0x3071('0x37')]]={'$like':'%'+_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x2992e6;}})});}_0x602719=_[_0x3071('0x47')]({},_0x602719,_0x218a82[_0x3071('0x48')]);var _0xa711b5={'where':_0x602719[_0x3071('0x45')]};return db['VoiceQueue'][_0x3071('0x22')](_0xa711b5)[_0x3071('0x2a')](function(_0x44a879){_0x148096[_0x3071('0x22')]=_0x44a879;if(_0x218a82[_0x3071('0x3c')]['includeAll']){_0x602719['include']=[{'all':!![]}];}return db[_0x3071('0x39')][_0x3071('0x49')](_0x602719);})[_0x3071('0x2a')](function(_0x5c5865){_0x148096[_0x3071('0x4a')]=_0x5c5865;return _0x148096;})['then'](respondWithFilteredResult(_0x1525df,_0x602719))[_0x3071('0x4b')](handleError(_0x1525df,null));};exports['show']=function(_0x18a773,_0x509178){var _0x5a3db7={'raw':![],'where':{'id':_0x18a773['params']['id']}},_0x874522={};_0x874522[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x874522[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x18a773['query']);_0x874522[_0x3071('0x3e')]=_['intersection'](_0x874522[_0x3071('0x3b')],_0x874522['query']);_0x5a3db7[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x874522['model'],qs[_0x3071('0x41')](_0x18a773[_0x3071('0x3c')][_0x3071('0x41')]));_0x5a3db7[_0x3071('0x40')]=_0x5a3db7[_0x3071('0x40')][_0x3071('0x42')]?_0x5a3db7[_0x3071('0x40')]:_0x874522['model'];if(_0x18a773[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5a3db7[_0x3071('0x4e')]=[{'all':!![]}];}_0x5a3db7=_[_0x3071('0x47')]({},_0x5a3db7,_0x18a773['options']);return db[_0x3071('0x39')][_0x3071('0x35')](_0x5a3db7)[_0x3071('0x2a')](handleEntityNotFound(_0x509178,null))[_0x3071('0x2a')](respondWithResult(_0x509178,null))[_0x3071('0x4b')](handleError(_0x509178,null));};exports[_0x3071('0x4f')]=function(_0x3ab6d4,_0x390944){return db[_0x3071('0x39')][_0x3071('0x4f')](_0x3ab6d4[_0x3071('0x50')],{})[_0x3071('0x2a')](function(_0x24977b){var _0x114f1f=_0x3ab6d4[_0x3071('0x51')][_0x3071('0x2b')]({'plain':!![]});if(!_0x114f1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x114f1f['role']===_0x3071('0x51')){var _0x580c04=_0x24977b[_0x3071('0x2b')]({'plain':!![]});var _0x198168=[{'name':_0x3071('0x52'),'value':'inbound'},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e')}];var _0x5bc69e=_['find'](_0x198168,[_0x3071('0x32'),_0x580c04[_0x3071('0x34')]])[_0x3071('0x37')];return db[_0x3071('0x53')]['find']({'where':{'name':_0x5bc69e,'userProfileId':_0x114f1f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x3f2edc){if(_0x3f2edc&&_0x3f2edc[_0x3071('0x55')]===0x0){return db[_0x3071('0x56')]['create']({'name':_0x580c04[_0x3071('0x37')],'resourceId':_0x580c04['id'],'type':_0x3f2edc[_0x3071('0x37')],'sectionId':_0x3f2edc['id']},{})[_0x3071('0x2a')](function(){return _0x24977b;});}else{return _0x24977b;}})[_0x3071('0x4b')](function(_0x12d6be){logger[_0x3071('0x36')](_0x3071('0x57'),_0x12d6be);throw _0x12d6be;});}return _0x24977b;})['then'](respondWithResult(_0x390944,0xc9))['catch'](handleError(_0x390944,null));};exports[_0x3071('0x58')]=function(_0x4de4f3,_0xe96994){var _0x26ba8a={'where':{'id':_0x4de4f3[_0x3071('0x59')]['id']}},_0x499b6a={};_0x499b6a[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x26ba8a[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x499b6a[_0x3071('0x3b')],qs['fields'](_0x4de4f3[_0x3071('0x3c')][_0x3071('0x41')]));_0x26ba8a[_0x3071('0x40')]=_0x26ba8a['attributes'][_0x3071('0x42')]?_0x26ba8a[_0x3071('0x40')]:_0x499b6a[_0x3071('0x3b')];if(_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]){_0x26ba8a[_0x3071('0x4e')]=[{'all':!![]}];}_0x26ba8a=_[_0x3071('0x47')]({},_0x26ba8a,_0x4de4f3[_0x3071('0x48')]);return db[_0x3071('0x39')]['find'](_0x26ba8a)[_0x3071('0x2a')](handleEntityNotFound(_0xe96994,null))[_0x3071('0x2a')](function(_0x3bcf28){if(_0x3bcf28){var _0x26ecb2=_0x3bcf28[_0x3071('0x2b')]({'plain':!![]});_0x26ecb2=qs[_0x3071('0x5a')](_0x26ecb2,['id',_0x3071('0x5b'),_0x3071('0x5c')]);_0x4de4f3[_0x3071('0x50')]=_[_0x3071('0x5a')](_0x4de4f3[_0x3071('0x50')],['id','createdAt',_0x3071('0x5c')]);return db[_0x3071('0x39')][_0x3071('0x4f')](_[_0x3071('0x47')](_0x26ecb2,_0x4de4f3[_0x3071('0x50')]),{'include':_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]?[{'all':!![]}]:undefined})[_0x3071('0x2a')](function(_0x52fddc){var _0x352d6f=_0x4de4f3[_0x3071('0x51')]['get']({'plain':!![]});if(!_0x352d6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352d6f[_0x3071('0x5d')]===_0x3071('0x51')){var _0x3469c1=_0x52fddc[_0x3071('0x2b')]({'plain':!![]});var _0x5278ea=[{'name':'VoiceQueues','value':_0x3071('0x2c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5113fc=_['find'](_0x5278ea,[_0x3071('0x32'),_0x3469c1[_0x3071('0x34')]])[_0x3071('0x37')];return db['UserProfileSection'][_0x3071('0x35')]({'where':{'name':_0x5113fc,'userProfileId':_0x352d6f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x19a03d){if(_0x19a03d&&_0x19a03d['autoAssociation']===0x0){return db[_0x3071('0x56')][_0x3071('0x4f')]({'name':_0x3469c1['name'],'resourceId':_0x3469c1['id'],'type':_0x19a03d[_0x3071('0x37')],'sectionId':_0x19a03d['id']},{})[_0x3071('0x2a')](function(){return _0x52fddc;});}else{return _0x52fddc;}})[_0x3071('0x4b')](function(_0x40c258){logger[_0x3071('0x36')](_0x3071('0x57'),_0x40c258);throw _0x40c258;});}return _0x52fddc;});}})[_0x3071('0x2a')](respondWithResult(_0xe96994,0xc9))['catch'](handleError(_0xe96994,null));};exports['update']=function(_0x21c1e3,_0x168025){if(_0x21c1e3[_0x3071('0x50')]['id']){delete _0x21c1e3['body']['id'];}return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x21c1e3[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x168025,null))[_0x3071('0x2a')](saveUpdates(_0x21c1e3[_0x3071('0x50')],null))[_0x3071('0x2a')](respondWithResult(_0x168025,null))[_0x3071('0x4b')](handleError(_0x168025,null));};exports[_0x3071('0x29')]=function(_0x5eed64,_0x4ce89b){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x5eed64[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ce89b,null))[_0x3071('0x2a')](removeEntity(_0x4ce89b,null))[_0x3071('0x4b')](handleError(_0x4ce89b,null));};exports[_0x3071('0x5e')]=function(_0x155542,_0x2ae053,_0x4fa372){var _0x20dff9={'raw':![],'where':{}};var _0x138a94={};var _0x1da477={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x155542[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2ae053,null))['then'](function(_0x521ee6){if(_0x521ee6){_0x138a94[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x60')][_0x3071('0x4c')]);_0x138a94[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x155542[_0x3071('0x3c')]);_0x138a94[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x138a94['model'],_0x138a94[_0x3071('0x3c')]);_0x20dff9[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x138a94[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x155542[_0x3071('0x3c')][_0x3071('0x41')]));_0x20dff9[_0x3071('0x40')]=_0x20dff9['attributes'][_0x3071('0x42')]?_0x20dff9['attributes']:_0x138a94[_0x3071('0x3b')];if(!_0x155542[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x20dff9[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x155542[_0x3071('0x3c')][_0x3071('0x24')]);_0x20dff9[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x155542['query'][_0x3071('0x23')]);}_0x20dff9[_0x3071('0x62')]=qs['sort'](_0x155542[_0x3071('0x3c')][_0x3071('0x44')]);_0x20dff9[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0x155542['query'],_0x138a94['filters']));_0x20dff9[_0x3071('0x45')]['VoiceQueueId']=_0x521ee6['id'];if(_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]){_0x20dff9[_0x3071('0x45')]=_[_0x3071('0x47')](_0x20dff9[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x20dff9['attributes'],function(_0x290d1c){var _0xa732ea={};_0xa732ea[_0x290d1c]={'$like':'%'+_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0xa732ea;})});}_0x20dff9=_['merge']({},_0x20dff9,_0x155542[_0x3071('0x48')]);return db[_0x3071('0x60')]['count']({'where':_0x20dff9[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x391887){_0x1da477[_0x3071('0x22')]=_0x391887;if(_0x155542[_0x3071('0x3c')]['includeAll']){_0x20dff9[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x3071('0x49')](_0x20dff9);})[_0x3071('0x2a')](function(_0x39060f){_0x1da477[_0x3071('0x4a')]=_0x39060f;return _0x1da477;});}})[_0x3071('0x2a')](respondWithFilteredResult(_0x2ae053,_0x20dff9))[_0x3071('0x4b')](handleError(_0x2ae053,null));};exports[_0x3071('0x63')]=function(_0x32b2e2,_0x4ed248,_0x2868c2){var _0x3efa3c={'raw':!![],'where':{}};var _0x459653={};var _0x4dfb45={'count':0x0,'rows':[]};return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x32b2e2[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ed248,null))[_0x3071('0x2a')](function(_0x5e0cbd){if(_0x5e0cbd){_0x459653[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x64')][_0x3071('0x4c')]);_0x459653[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x32b2e2[_0x3071('0x3c')]);_0x459653[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x459653['model'],_0x459653[_0x3071('0x3c')]);_0x3efa3c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x459653['model'],qs['fields'](_0x32b2e2['query']['fields']));_0x3efa3c['attributes']=_0x3efa3c[_0x3071('0x40')][_0x3071('0x42')]?_0x3efa3c['attributes']:_0x459653[_0x3071('0x3b')];if(!_0x32b2e2[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x3efa3c['limit']=qs[_0x3071('0x24')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x24')]);_0x3efa3c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x23')]);}_0x3efa3c['order']=qs['sort'](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x44')]);_0x3efa3c[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x32b2e2[_0x3071('0x3c')],_0x459653[_0x3071('0x3e')]));_0x3efa3c[_0x3071('0x45')][_0x3071('0x65')]=_0x5e0cbd['id'];if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x2f')]){_0x3efa3c[_0x3071('0x45')]=_[_0x3071('0x47')](_0x3efa3c['where'],{'$or':_[_0x3071('0x31')](_0x3efa3c[_0x3071('0x40')],function(_0x118268){var _0x9dba3={};_0x9dba3[_0x118268]={'$like':'%'+_0x32b2e2[_0x3071('0x3c')]['filter']+'%'};return _0x9dba3;})});}_0x3efa3c=_[_0x3071('0x47')]({},_0x3efa3c,_0x32b2e2['options']);return db['CmHopperHistory'][_0x3071('0x22')]({'where':_0x3efa3c[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x48fdd2){_0x4dfb45[_0x3071('0x22')]=_0x48fdd2;if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x4d')]){_0x3efa3c[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x64')]['findAll'](_0x3efa3c);})['then'](function(_0x39dc23){_0x4dfb45[_0x3071('0x4a')]=_0x39dc23;return _0x4dfb45;});}})['then'](respondWithFilteredResult(_0x4ed248,_0x3efa3c))[_0x3071('0x4b')](handleError(_0x4ed248,null));};exports[_0x3071('0x66')]=function(_0x22e484,_0x2d559a,_0xa7fb55){var _0x4df9dd={'raw':!![],'where':{}};var _0x4194dd={};var _0x5b1ff8={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x22e484['params']['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2d559a,null))['then'](function(_0x1322eb){if(_0x1322eb){_0x4194dd[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x67')]['rawAttributes']);_0x4194dd[_0x3071('0x3c')]=_['keys'](_0x22e484[_0x3071('0x3c')]);_0x4194dd['filters']=_[_0x3071('0x3f')](_0x4194dd[_0x3071('0x3b')],_0x4194dd['query']);_0x4df9dd[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x4194dd['model'],qs[_0x3071('0x41')](_0x22e484[_0x3071('0x3c')][_0x3071('0x41')]));_0x4df9dd[_0x3071('0x40')]=_0x4df9dd[_0x3071('0x40')][_0x3071('0x42')]?_0x4df9dd[_0x3071('0x40')]:_0x4194dd[_0x3071('0x3b')];if(!_0x22e484[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x4df9dd[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x22e484[_0x3071('0x3c')][_0x3071('0x24')]);_0x4df9dd['offset']=qs[_0x3071('0x23')](_0x22e484[_0x3071('0x3c')][_0x3071('0x23')]);}_0x4df9dd[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x22e484['query']['sort']);_0x4df9dd[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x22e484[_0x3071('0x3c')],_0x4194dd[_0x3071('0x3e')]));_0x4df9dd['where'][_0x3071('0x65')]=_0x1322eb['id'];if(_0x22e484[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4df9dd[_0x3071('0x45')]=_[_0x3071('0x47')](_0x4df9dd[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x4df9dd[_0x3071('0x40')],function(_0xbee265){var _0x199bb0={};_0x199bb0[_0xbee265]={'$like':'%'+_0x22e484['query'][_0x3071('0x2f')]+'%'};return _0x199bb0;})});}_0x4df9dd=_['merge']({},_0x4df9dd,_0x22e484[_0x3071('0x48')]);return db[_0x3071('0x67')][_0x3071('0x22')]({'where':_0x4df9dd[_0x3071('0x45')]})['then'](function(_0x4f83d2){_0x5b1ff8['count']=_0x4f83d2;if(_0x22e484[_0x3071('0x3c')][_0x3071('0x4d')]){_0x4df9dd[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x67')]['findAll'](_0x4df9dd);})[_0x3071('0x2a')](function(_0x7c3473){_0x5b1ff8[_0x3071('0x4a')]=_0x7c3473;return _0x5b1ff8;});}})['then'](respondWithFilteredResult(_0x2d559a,_0x4df9dd))['catch'](handleError(_0x2d559a,null));};exports['getHopperBlacks']=function(_0x4afc58,_0x18d792,_0x46efeb){var _0x5795ea={'raw':!![],'where':{}};var _0x2750c5={};var _0x2a2b9d={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x4afc58[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x18d792,null))[_0x3071('0x2a')](function(_0x3d83cd){if(_0x3d83cd){_0x2750c5[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmHopperBlack'][_0x3071('0x4c')]);_0x2750c5['query']=_[_0x3071('0x3d')](_0x4afc58[_0x3071('0x3c')]);_0x2750c5[_0x3071('0x3e')]=_['intersection'](_0x2750c5[_0x3071('0x3b')],_0x2750c5[_0x3071('0x3c')]);_0x5795ea[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x2750c5['model'],qs[_0x3071('0x41')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x41')]));_0x5795ea[_0x3071('0x40')]=_0x5795ea[_0x3071('0x40')]['length']?_0x5795ea['attributes']:_0x2750c5[_0x3071('0x3b')];if(!_0x4afc58[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x5795ea['limit']=qs['limit'](_0x4afc58[_0x3071('0x3c')][_0x3071('0x24')]);_0x5795ea['offset']=qs[_0x3071('0x23')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x23')]);}_0x5795ea['order']=qs['sort'](_0x4afc58['query'][_0x3071('0x44')]);_0x5795ea[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x4afc58['query'],_0x2750c5[_0x3071('0x3e')]));_0x5795ea[_0x3071('0x45')][_0x3071('0x65')]=_0x3d83cd['id'];if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x2f')]){_0x5795ea['where']=_[_0x3071('0x47')](_0x5795ea['where'],{'$or':_[_0x3071('0x31')](_0x5795ea[_0x3071('0x40')],function(_0x294316){var _0xc1632={};_0xc1632[_0x294316]={'$like':'%'+_0x4afc58[_0x3071('0x3c')]['filter']+'%'};return _0xc1632;})});}_0x5795ea=_[_0x3071('0x47')]({},_0x5795ea,_0x4afc58[_0x3071('0x48')]);return db[_0x3071('0x68')][_0x3071('0x22')]({'where':_0x5795ea[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x58d53b){_0x2a2b9d[_0x3071('0x22')]=_0x58d53b;if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5795ea[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3071('0x49')](_0x5795ea);})[_0x3071('0x2a')](function(_0x330cfb){_0x2a2b9d[_0x3071('0x4a')]=_0x330cfb;return _0x2a2b9d;});}})['then'](respondWithFilteredResult(_0x18d792,_0x5795ea))[_0x3071('0x4b')](handleError(_0x18d792,null));};exports['getTeams']=function(_0x17a9f5,_0x2fcecd,_0x148924){var _0xfe896c={};var _0x3aa03f={};var _0x44c0e5;var _0x31c8bd;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x17a9f5['params']['id']}})['then'](handleEntityNotFound(_0x2fcecd,null))[_0x3071('0x2a')](function(_0x2b0a2d){if(_0x2b0a2d){_0x44c0e5=_0x2b0a2d;_0x3aa03f['model']=_[_0x3071('0x3d')](db['Team'][_0x3071('0x4c')]);_0x3aa03f[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x17a9f5[_0x3071('0x3c')]);_0x3aa03f[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],_0x3aa03f[_0x3071('0x3c')]);_0xfe896c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],qs['fields'](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x41')]));_0xfe896c[_0x3071('0x40')]=_0xfe896c['attributes'][_0x3071('0x42')]?_0xfe896c['attributes']:_0x3aa03f[_0x3071('0x3b')];_0xfe896c[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x17a9f5[_0x3071('0x3c')]['sort']);_0xfe896c['where']=qs['filters'](_[_0x3071('0x46')](_0x17a9f5['query'],_0x3aa03f['filters']));if(_0x17a9f5[_0x3071('0x3c')]['filter']){_0xfe896c[_0x3071('0x45')]=_[_0x3071('0x47')](_0xfe896c[_0x3071('0x45')],{'$or':_['map'](_0xfe896c[_0x3071('0x40')],function(_0x5a10af){var _0x587e6b={};_0x587e6b[_0x5a10af]={'$like':'%'+_0x17a9f5[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x587e6b;})});}_0xfe896c=_[_0x3071('0x47')]({},_0xfe896c,_0x17a9f5[_0x3071('0x48')]);return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x3d396d){if(_0x3d396d){_0x31c8bd=_0x3d396d['length'];if(!_0x17a9f5[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0xfe896c[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x24')]);_0xfe896c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x17a9f5['query'][_0x3071('0x23')]);}return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x28e880){if(_0x28e880){return _0x28e880?{'count':_0x31c8bd,'rows':_0x28e880}:null;}})[_0x3071('0x2a')](respondWithResult(_0x2fcecd,null))[_0x3071('0x4b')](handleError(_0x2fcecd,null));};exports[_0x3071('0x6a')]=function(_0x4ec86a,_0x2b6fca,_0x5b2cbc){var _0x32575c=_0x4ec86a[_0x3071('0x50')][_0x3071('0x6b')];var _0x5411b4=_['map'](_0x32575c,'id');return db['Team'][_0x3071('0x49')]({'where':{'id':_0x5411b4},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id','name',_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]}]})[_0x3071('0x2a')](function(_0x3e788f){if(_0x3e788f){var _0x25b492=_[_0x3071('0x71')](_0x3e788f,function(_0x1befe3){var _0x381eb=_0x1befe3['get']({'plain':!![]});_0x381eb[_0x3071('0x6d')][_0x3071('0x72')](function(_0x345f90){_0x345f90['penalty']=_[_0x3071('0x35')](_0x32575c,{'id':_0x381eb['id']})[_0x3071('0x73')];});return _0x381eb[_0x3071('0x6d')];});return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4ec86a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x10a0c3){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x242313){return _0x10a0c3[_0x3071('0x6a')](_0x5411b4,{'transaction':_0x242313})['then'](function(){return BPromise[_0x3071('0x76')](_0x25b492,function(_0x3e9573){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3e9573['id'],'VoiceQueueId':_0x4ec86a['params']['id']},'defaults':{'penalty':_0x3e9573['penalty']},'transaction':_0x242313});});})[_0x3071('0x2a')](function(){return BPromise[_0x3071('0x76')](_['filter'](_0x25b492,{'online':!![]}),function(_0x1b0bb7){return db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1b0bb7[_0x3071('0x37')],'UserId':_0x1b0bb7['id'],'queue_name':_0x10a0c3[_0x3071('0x37')],'VoiceQueueId':_0x10a0c3['id'],'interface':_[_0x3071('0x79')](_0x1b0bb7[_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1b0bb7[_0x3071('0x37')]):_0x1b0bb7[_0x3071('0x70')],'paused':_0x1b0bb7[_0x3071('0x6f')]||![],'penalty':_0x1b0bb7[_0x3071('0x73')]},{'transaction':_0x242313});});})['then'](function(){_0x25b492[_0x3071('0x72')](function(_0x9eb8e2){socket['emit'](_0x3071('0x7c'),{'UserId':_0x9eb8e2['id'],'VoiceQueueId':_0x10a0c3['id']});});});});});}})[_0x3071('0x2a')](respondWithStatusCode(_0x2b6fca,null))[_0x3071('0x4b')](handleError(_0x2b6fca,null));};exports[_0x3071('0x7d')]=function(_0x4e6536,_0x2bfae8,_0x363418){return db[_0x3071('0x7e')][_0x3071('0x49')]({'where':{'id':_0x4e6536['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x3071('0x2a')](handleEntityNotFound(_0x2bfae8,null))[_0x3071('0x2a')](function(_0x406ffe){var _0x2e4180=_[_0x3071('0x31')](_0x406ffe,'id');var _0x2fc3d5=[];var _0x4d2992=[];var _0x15f9b1=squel['select']();_0x15f9b1['field'](_0x3071('0x7f'))[_0x3071('0x80')]('team_has_voice_queues','tq')['join'](_0x3071('0x81'),'ut',_0x3071('0x82'))[_0x3071('0x45')](_0x3071('0x83'),_0x4e6536['params']['id']);for(var _0x6ad3d9=0x0;_0x6ad3d9<_0x406ffe[_0x3071('0x42')];_0x6ad3d9+=0x1){let _0x2bb0eb=_0x406ffe[_0x6ad3d9];for(var _0x15a2b6=0x0;_0x15a2b6<_0x2bb0eb[_0x3071('0x6d')]['length'];_0x15a2b6+=0x1){let _0x2bf807=_0x2bb0eb[_0x3071('0x6d')][_0x15a2b6];var _0x52b7a8=_0x15f9b1['clone']();_0x52b7a8['where'](_0x3071('0x84'),_0x2bf807['id']);_0x4d2992[_0x3071('0x85')](db[_0x3071('0x74')]['query'](_0x52b7a8[_0x3071('0x86')](),{'type':db[_0x3071('0x74')]['QueryTypes'][_0x3071('0x87')]})[_0x3071('0x2a')](function(_0x33efb9){if(_0x33efb9[_0x3071('0x42')]===0x1){return _0x2bf807['id'];}else{var _0x2a995c=_['every'](_['map'](_0x33efb9,_0x3071('0x88')),function(_0x20230c){return _[_0x3071('0x33')](_0x2e4180,_0x20230c);});if(_0x2a995c){return _0x2bf807['id'];}}}));}}return BPromise[_0x3071('0x89')](_0x4d2992)['then'](function(_0x5ed84d){_0x2fc3d5=_(_0x2fc3d5)[_0x3071('0x8a')](_0x5ed84d)[_0x3071('0x8b')]()['value']();return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4e6536[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x4e1cfa){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x6f189a){return _0x4e1cfa[_0x3071('0x7d')](_0x4e6536['query'][_0x3071('0x8c')],{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){if(!_['isEmpty'](_0x2fc3d5)){return _0x4e1cfa[_0x3071('0x8d')](_0x2fc3d5,{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x4e6536[_0x3071('0x59')]['id'],'UserId':_0x2fc3d5},'transaction':_0x6f189a});});}})['then'](function(){_0x2fc3d5[_0x3071('0x72')](function(_0x5ece4a){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':_0x5ece4a,'VoiceQueueId':_0x4e1cfa['id']});});});});});});})[_0x3071('0x2a')](respondWithStatusCode(_0x2bfae8,null))[_0x3071('0x4b')](handleError(_0x2bfae8,null));};exports[_0x3071('0x8f')]=function(_0x29746e,_0x4826a0,_0x2ba6c3){var _0xacb4a3,_0x21d250;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x29746e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4826a0,null))['then'](function(_0x25eca6){if(_0x25eca6){_0x21d250=_0x25eca6;return _0x25eca6[_0x3071('0x8f')](_0x29746e[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x29746e['body'],[_0x3071('0x8c'),'id'])||{})[_0x3071('0x90')](function(_0x1179ff){for(var _0xceab08=0x0;_0xceab08<_0x29746e['body'][_0x3071('0x8c')][_0x3071('0x42')];_0xceab08+=0x1){socket[_0x3071('0x8e')](_0x3071('0x7c'),{'UserId':_0x29746e[_0x3071('0x50')][_0x3071('0x8c')][_0xceab08],'VoiceQueueId':_0x29746e[_0x3071('0x59')]['id']});}return _0x1179ff;});}})[_0x3071('0x2a')](function(_0x4c7b0d){_0xacb4a3=_0x4c7b0d||[];if(_0x21d250){return db['User'][_0x3071('0x49')]({'where':{'id':_0x29746e[_0x3071('0x50')]['ids']},'attributes':['id',_0x3071('0x37'),_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]});}})[_0x3071('0x2a')](function(_0x1a769a){if(!_[_0x3071('0x91')](_0x1a769a)){var _0x55f5c4=[];for(var _0x1c85bc=0x0;_0x1c85bc<_0x1a769a[_0x3071('0x42')];_0x1c85bc++){if(_0x1a769a[_0x1c85bc]['online']){_0x55f5c4[_0x3071('0x85')](db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1a769a[_0x1c85bc]['name'],'UserId':_0x1a769a[_0x1c85bc]['id'],'queue_name':_0x21d250[_0x3071('0x37')],'VoiceQueueId':_0x21d250['id'],'interface':_[_0x3071('0x79')](_0x1a769a[_0x1c85bc][_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1a769a[_0x1c85bc][_0x3071('0x37')]):_0x1a769a[_0x1c85bc][_0x3071('0x70')],'paused':_0x1a769a[_0x1c85bc][_0x3071('0x6f')]||![],'penalty':_0x29746e['body'][_0x3071('0x73')]||0x0}));}}return BPromise[_0x3071('0x89')](_0x55f5c4);}})['then'](function(){return _0xacb4a3;})['then'](respondWithResult(_0x4826a0,null))[_0x3071('0x4b')](handleError(_0x4826a0,null));};exports['removeAgents']=function(_0x11d7b9,_0x589333,_0x5be17d){return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x11d7b9[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x589333,null))[_0x3071('0x2a')](function(_0x6dc24d){if(_0x6dc24d){return _0x6dc24d['removeAgents'](_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')])['then'](function(){if(_[_0x3071('0x92')](_0x11d7b9[_0x3071('0x3c')]['ids'])){for(var _0x17b3fd=0x0;_0x17b3fd<_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x3071('0x42')];_0x17b3fd+=0x1){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x17b3fd]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}}else{socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9['query'][_0x3071('0x8c')]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}});}})[_0x3071('0x2a')](function(_0x3a1bd3){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x11d7b9[_0x3071('0x59')]['id'],'UserId':_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')]}})[_0x3071('0x2a')](function(){return _0x3a1bd3;});})[_0x3071('0x2a')](respondWithStatusCode(_0x589333,null))[_0x3071('0x4b')](handleError(_0x589333,null));};exports['getAgents']=function(_0xce1615,_0x5a6594,_0x1dc10a){var _0x2acf72={};var _0x41a30d={};var _0x305958;var _0x393279;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0xce1615['params']['id']}})['then'](handleEntityNotFound(_0x5a6594,null))[_0x3071('0x2a')](function(_0x4f5f82){if(_0x4f5f82){_0x305958=_0x4f5f82;_0x41a30d['model']=_[_0x3071('0x3d')](db['User']['rawAttributes']);_0x41a30d[_0x3071('0x3c')]=_['keys'](_0xce1615[_0x3071('0x3c')]);_0x41a30d['filters']=_[_0x3071('0x3f')](_0x41a30d[_0x3071('0x3b')],_0x41a30d[_0x3071('0x3c')]);_0x2acf72[_0x3071('0x40')]=_['intersection'](_0x41a30d['model'],qs['fields'](_0xce1615[_0x3071('0x3c')][_0x3071('0x41')]));_0x2acf72[_0x3071('0x40')]=_0x2acf72['attributes'][_0x3071('0x42')]?_0x2acf72[_0x3071('0x40')]:_0x41a30d[_0x3071('0x3b')];_0x2acf72[_0x3071('0x62')]=qs['sort'](_0xce1615[_0x3071('0x3c')][_0x3071('0x44')]);_0x2acf72[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0xce1615[_0x3071('0x3c')],_0x41a30d[_0x3071('0x3e')]));if(_0xce1615['query'][_0x3071('0x2f')]){_0x2acf72[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2acf72[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2acf72[_0x3071('0x40')],function(_0x397892){var _0x4666fc={};_0x4666fc[_0x397892]={'$like':'%'+_0xce1615['query']['filter']+'%'};return _0x4666fc;})});}_0x2acf72=_[_0x3071('0x47')]({},_0x2acf72,_0xce1615[_0x3071('0x48')]);return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x23e6b6){if(_0x23e6b6){_0x393279=_0x23e6b6['length'];if(!_0xce1615[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x2acf72[_0x3071('0x24')]=qs['limit'](_0xce1615['query'][_0x3071('0x24')]);_0x2acf72[_0x3071('0x23')]=qs[_0x3071('0x23')](_0xce1615[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x49b48e){if(_0x49b48e){return _0x49b48e?{'count':_0x393279,'rows':_0x49b48e}:null;}})[_0x3071('0x2a')](respondWithResult(_0x5a6594,null))[_0x3071('0x4b')](handleError(_0x5a6594,null));};exports['getMembers']=function(_0x16588c,_0x191207,_0x1ae9f5){var _0x1c78d8={};var _0x14e6bf={};var _0x46cb83;var _0x4d092a;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x16588c[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x191207,null))[_0x3071('0x2a')](function(_0x2edcad){if(_0x2edcad){_0x46cb83=_0x2edcad;_0x14e6bf['model']=_[_0x3071('0x3d')](db['UserVoiceQueueRt'][_0x3071('0x4c')]);_0x14e6bf[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x16588c[_0x3071('0x3c')]);_0x14e6bf[_0x3071('0x3e')]=_['intersection'](_0x14e6bf[_0x3071('0x3b')],_0x14e6bf[_0x3071('0x3c')]);_0x1c78d8['attributes']=_['intersection'](_0x14e6bf[_0x3071('0x3b')],qs['fields'](_0x16588c[_0x3071('0x3c')]['fields']));_0x1c78d8[_0x3071('0x40')]=_0x1c78d8['attributes'][_0x3071('0x42')]?_0x1c78d8[_0x3071('0x40')]:_0x14e6bf[_0x3071('0x3b')];_0x1c78d8[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x16588c[_0x3071('0x3c')]['sort']);_0x1c78d8[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x16588c[_0x3071('0x3c')],_0x14e6bf['filters']));if(_0x16588c['query'][_0x3071('0x2f')]){_0x1c78d8[_0x3071('0x45')]=_[_0x3071('0x47')](_0x1c78d8[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x1c78d8['attributes'],function(_0xa7c24b){var _0x3612fa={};_0x3612fa[_0xa7c24b]={'$like':'%'+_0x16588c[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x3612fa;})});}_0x1c78d8=_[_0x3071('0x47')]({},_0x1c78d8,_0x16588c[_0x3071('0x48')]);return _0x46cb83[_0x3071('0x94')](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x5b0ec5){if(_0x5b0ec5){_0x4d092a=_0x5b0ec5['length'];if(!_0x16588c[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x1c78d8[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x16588c['query']['limit']);_0x1c78d8[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x16588c[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x46cb83['getMembers'](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x290db0){return _0x290db0?{'count':_0x4d092a,'rows':_0x290db0}:null;})[_0x3071('0x2a')](respondWithResult(_0x191207,null))[_0x3071('0x4b')](handleError(_0x191207,null));};exports[_0x3071('0x95')]=function(_0x5deca4,_0x33583a,_0x390b60){var _0x4c63ee={};var _0x476765={};var _0x1bb3d7;var _0x59bb52;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x5deca4[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x33583a,null))[_0x3071('0x2a')](function(_0x241c34){if(_0x241c34){_0x1bb3d7=_0x241c34;_0x476765[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmList'][_0x3071('0x4c')]);_0x476765[_0x3071('0x3c')]=_['keys'](_0x5deca4[_0x3071('0x3c')]);_0x476765['filters']=_[_0x3071('0x3f')](_0x476765['model'],_0x476765[_0x3071('0x3c')]);_0x4c63ee[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x476765[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x41')]));_0x4c63ee[_0x3071('0x40')]=_0x4c63ee[_0x3071('0x40')][_0x3071('0x42')]?_0x4c63ee[_0x3071('0x40')]:_0x476765['model'];_0x4c63ee[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x44')]);_0x4c63ee['where']=qs['filters'](_[_0x3071('0x46')](_0x5deca4['query'],_0x476765['filters']));if(_0x5deca4[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4c63ee['where']=_[_0x3071('0x47')](_0x4c63ee['where'],{'$or':_[_0x3071('0x31')](_0x4c63ee[_0x3071('0x40')],function(_0x3762a4){var _0x4285a2={};_0x4285a2[_0x3762a4]={'$like':'%'+_0x5deca4[_0x3071('0x3c')]['filter']+'%'};return _0x4285a2;})});}_0x4c63ee=_[_0x3071('0x47')]({},_0x4c63ee,_0x5deca4[_0x3071('0x48')]);return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x10b3f1){if(_0x10b3f1){_0x59bb52=_0x10b3f1[_0x3071('0x42')];if(!_0x5deca4[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x4c63ee[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x5deca4[_0x3071('0x3c')]['limit']);_0x4c63ee[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x5deca4['query'][_0x3071('0x23')]);}return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x430c53){if(_0x430c53){return _0x430c53?{'count':_0x59bb52,'rows':_0x430c53}:null;}})[_0x3071('0x2a')](respondWithResult(_0x33583a,null))[_0x3071('0x4b')](handleError(_0x33583a,null));};exports[_0x3071('0x96')]=function(_0x50cb8c,_0x13d977,_0x2973b7){var _0x4d0f2a,_0x19b73d;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x50cb8c[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x13d977,null))[_0x3071('0x2a')](function(_0x4957b4){if(_0x4957b4){_0x19b73d=_0x4957b4;return _0x4957b4[_0x3071('0x96')](_0x50cb8c[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x50cb8c[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x5db057){var _0x4eb2f0;_0x4d0f2a=_0x5db057||[];var _0x51e4b1=[];if(_0x5db057){for(var _0x4b9aad=0x0;_0x4b9aad<_0x5db057[_0x3071('0x42')];_0x4b9aad+=0x1){var _0x35bf60=_0x5db057[_0x4b9aad][_0x3071('0x2b')]({'plain':!![]});_0x19b73d[_0x3071('0x97')]=_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]?_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]:_0x19b73d[_0x3071('0x97')];switch(_0x19b73d[_0x3071('0x97')]){case _0x3071('0x98'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper')['fromQuery']([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),'updatedAt'],squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),'scheduledAt')[_0x3071('0xa0')]('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))['field'](_0x50cb8c['params']['id'][_0x3071('0x86')](),_0x3071('0x65'))['field'](_0x3071('0xa1'),_0x3071('0x5b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x3071('0xa7'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id']['toString']()))['where'](_0x3071('0xa6'),squel['select']()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')](_0x3071('0xa9'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))[_0x3071('0x86')]();break;case _0x3071('0xaa'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')](['phone',_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),_0x3071('0x5c')],squel['select']()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),'VoiceQueueId')[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5b'))['field'](_0x3071('0xa1'),'updatedAt')[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())[_0x3071('0x45')](_0x3071('0xac'))[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))['toString']();break;default:_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),'VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()['field'](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()',_0x3071('0x5b'))['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))['where'](_0x3071('0xa4'))['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')]['toString']())[_0x3071('0x45')](_0x3071('0xac')))[_0x3071('0x86')]();}_0x51e4b1['push'](db[_0x3071('0x74')][_0x3071('0x3c')](_0x4eb2f0));}return BPromise[_0x3071('0x89')](_0x51e4b1);}})[_0x3071('0x2a')](function(){return _0x4d0f2a;})[_0x3071('0x2a')](respondWithResult(_0x13d977,null))[_0x3071('0x4b')](handleError(_0x13d977,null));};exports[_0x3071('0xad')]=function(_0x41f46a,_0x453fa6,_0x80af16){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x41f46a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x453fa6,null))[_0x3071('0x2a')](function(_0x18fbc3){if(_0x18fbc3){return _0x18fbc3[_0x3071('0xad')](_0x41f46a[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x2673a5){if(_0x2673a5){return db['CmHopper'][_0x3071('0x29')]({'where':{'ListId':_0x41f46a[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x41f46a['params']['id']}})[_0x3071('0x2a')](function(){return _0x2673a5;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x453fa6,null))[_0x3071('0x4b')](handleError(_0x453fa6,null));};exports[_0x3071('0xae')]=function(_0x3d957e,_0x401cc5,_0xb08066){var _0x2f5966={};var _0x58557e={};var _0xc3f6f9;var _0x21f445;return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x3d957e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x401cc5,null))['then'](function(_0x46f138){if(_0x46f138){_0xc3f6f9=_0x46f138;_0x58557e[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0xaf')][_0x3071('0x4c')]);_0x58557e[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x3d957e[_0x3071('0x3c')]);_0x58557e[_0x3071('0x3e')]=_['intersection'](_0x58557e['model'],_0x58557e[_0x3071('0x3c')]);_0x2f5966['attributes']=_['intersection'](_0x58557e[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x3d957e[_0x3071('0x3c')][_0x3071('0x41')]));_0x2f5966['attributes']=_0x2f5966['attributes']['length']?_0x2f5966[_0x3071('0x40')]:_0x58557e[_0x3071('0x3b')];_0x2f5966[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x3d957e['query'][_0x3071('0x44')]);_0x2f5966[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x3d957e['query'],_0x58557e['filters']));if(_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]){_0x2f5966[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2f5966[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2f5966['attributes'],function(_0x39bf1d){var _0x1e703b={};_0x1e703b[_0x39bf1d]={'$like':'%'+_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x1e703b;})});}_0x2f5966=_[_0x3071('0x47')]({},_0x2f5966,_0x3d957e[_0x3071('0x48')]);return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x56642a){if(_0x56642a){_0x21f445=_0x56642a[_0x3071('0x42')];if(!_0x3d957e['query'][_0x3071('0x43')](_0x3071('0x61'))){_0x2f5966[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x3d957e['query'][_0x3071('0x24')]);_0x2f5966[_0x3071('0x23')]=qs['offset'](_0x3d957e[_0x3071('0x3c')][_0x3071('0x23')]);}return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x46f8cf){if(_0x46f8cf){return _0x46f8cf?{'count':_0x21f445,'rows':_0x46f8cf}:null;}})[_0x3071('0x2a')](respondWithResult(_0x401cc5,null))[_0x3071('0x4b')](handleError(_0x401cc5,null));};exports[_0x3071('0xb0')]=function(_0x2b92f5,_0x369200,_0x4287b4){var _0x43860c,_0x185fef;return db[_0x3071('0x39')]['find']({'where':{'id':_0x2b92f5[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x369200,null))['then'](function(_0x3543bb){if(_0x3543bb){_0x185fef=_0x3543bb;return _0x3543bb[_0x3071('0xb0')](_0x2b92f5['body'][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x2b92f5[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x27a834){var _0x624078;_0x43860c=_0x27a834||[];var _0x911c8c=[];if(_0x27a834){for(var _0x32776b=0x0;_0x32776b<_0x27a834[_0x3071('0x42')];_0x32776b+=0x1){var _0x5a98c7=_0x27a834[_0x32776b]['get']({'plain':!![]});_0x624078=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper_black')[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9d'),'ListId','VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')['field'](_0x2b92f5[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()','createdAt')['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')]('ListId\x20=\x20?',_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3071('0x86')]();_0x911c8c[_0x3071('0x85')](db[_0x3071('0x74')][_0x3071('0x3c')](_0x624078));}return BPromise[_0x3071('0x89')](_0x911c8c);}})['then'](function(){return _0x43860c;})[_0x3071('0x2a')](respondWithResult(_0x369200,null))[_0x3071('0x4b')](handleError(_0x369200,null));};exports['removeBlackLists']=function(_0x2c9ebe,_0x16f73b,_0xb628a){return db[_0x3071('0x39')]['find']({'where':{'id':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x16f73b,null))[_0x3071('0x2a')](function(_0x57dc29){if(_0x57dc29){return _0x57dc29[_0x3071('0xb1')](_0x2c9ebe[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x41fb16){if(_0x41fb16){return db[_0x3071('0x68')]['destroy']({'where':{'ListId':_0x2c9ebe[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(){return _0x41fb16;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x16f73b,null))[_0x3071('0x4b')](handleError(_0x16f73b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b51ff70..6b8e216 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 _0xa069=['exports','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0xeafbff,_0x1ba785){var _0x1d01f7=function(_0x31cb42){while(--_0x31cb42){_0xeafbff['push'](_0xeafbff['shift']());}};_0x1d01f7(++_0x1ba785);}(_0xa069,0x86));var _0x9a06=function(_0x1ef521,_0x3c5c4a){_0x1ef521=_0x1ef521-0x0;var _0x3c166d=_0xa069[_0x1ef521];return _0x3c166d;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x9a06('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9a06('0x1')](0x0);var events={'afterCreate':_0x9a06('0x2'),'afterUpdate':_0x9a06('0x3'),'afterDestroy':'remove'};function emitEvent(_0x157316){return function(_0x19741a,_0x27c6fd,_0x2b055c){VoiceQueueEvents['emit'](_0x157316+':'+_0x19741a['id'],_0x19741a);VoiceQueueEvents[_0x9a06('0x4')](_0x157316,_0x19741a);_0x2b055c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9a06('0x5')](e,emitEvent(event));}}module[_0x9a06('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xdb05=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb05,0x1bb));var _0x5db0=function(_0xc4832f,_0x41b9ae){_0xc4832f=_0xc4832f-0x0;var _0x343172=_0xdb05[_0xc4832f];return _0x343172;};'use strict';var EventEmitter=require(_0x5db0('0x0'));var VoiceQueue=require(_0x5db0('0x1'))['db'][_0x5db0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5db0('0x3')](0x0);var events={'afterCreate':_0x5db0('0x4'),'afterUpdate':_0x5db0('0x5'),'afterDestroy':_0x5db0('0x6')};function emitEvent(_0xad7d0f){return function(_0x12bc64,_0x148a70,_0x59fb61){VoiceQueueEvents[_0x5db0('0x7')](_0xad7d0f+':'+_0x12bc64['id'],_0x12bc64);VoiceQueueEvents[_0x5db0('0x7')](_0xad7d0f,_0x12bc64);_0x59fb61(null);};}for(var e in events){if(events[_0x5db0('0x8')](e)){var event=events[e];VoiceQueue[_0x5db0('0x9')](e,emitEvent(event));}}module[_0x5db0('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 1085f74..1f80db1 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 _0x92a4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue'];(function(_0x92afbd,_0x141ea4){var _0x323568=function(_0x3f8977){while(--_0x3f8977){_0x92afbd['push'](_0x92afbd['shift']());}};_0x323568(++_0x141ea4);}(_0x92a4,0x152));var _0x492a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x92a4[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x492a('0x0'));var util=require(_0x492a('0x1'));var logger=require(_0x492a('0x2'))(_0x492a('0x3'));var moment=require(_0x492a('0x4'));var BPromise=require(_0x492a('0x5'));var rp=require(_0x492a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x492a('0x7'));var config=require(_0x492a('0x8'));var attributes=require(_0x492a('0x9'));module[_0x492a('0xa')]=function(_0x142738,_0x33f536){return _0x142738[_0x492a('0xb')](_0x492a('0xc'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3be=['request-promise','path','rimraf','./voiceQueue.attributes','voice_queues','lodash','util','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe3be,0xb9));var _0xee3b=function(_0x597cbd,_0x14151f){_0x597cbd=_0x597cbd-0x0;var _0x481430=_0xe3be[_0x597cbd];return _0x481430;};'use strict';var _=require(_0xee3b('0x0'));var util=require(_0xee3b('0x1'));var logger=require('../../config/logger')(_0xee3b('0x2'));var moment=require(_0xee3b('0x3'));var BPromise=require(_0xee3b('0x4'));var rp=require(_0xee3b('0x5'));var fs=require('fs');var path=require(_0xee3b('0x6'));var rimraf=require(_0xee3b('0x7'));var config=require('../../config/environment');var attributes=require(_0xee3b('0x8'));module['exports']=function(_0x7c4fcb,_0x814b06){return _0x7c4fcb['define']('VoiceQueue',attributes,{'tableName':_0xee3b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b7af35b..6841b1a 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 _0xdd70=['GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','find','map','ShowVoiceQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueue,\x20%s,\x20%s'];(function(_0x320c90,_0x515e0a){var _0x4b8824=function(_0x11fd98){while(--_0x11fd98){_0x320c90['push'](_0x320c90['shift']());}};_0x4b8824(++_0x515e0a);}(_0xdd70,0x1ed));var _0x0dd7=function(_0x2a995b,_0x4481c6){_0x2a995b=_0x2a995b-0x0;var _0x363fe6=_0xdd70[_0x2a995b];return _0x363fe6;};'use strict';var _=require(_0x0dd7('0x0'));var util=require('util');var moment=require(_0x0dd7('0x1'));var BPromise=require(_0x0dd7('0x2'));var rs=require(_0x0dd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dd7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0dd7('0x5'));var jayson=require(_0x0dd7('0x6'));var client=jayson[_0x0dd7('0x7')][_0x0dd7('0x8')]({'port':0x232a});config[_0x0dd7('0x9')]=_[_0x0dd7('0xa')](config[_0x0dd7('0x9')],{'host':_0x0dd7('0xb'),'port':0x18eb});var socket=require(_0x0dd7('0xc'))(new Redis(config['redis']));require(_0x0dd7('0xd'))[_0x0dd7('0xe')](socket);function respondWithRpcPromise(_0x1566cb,_0x2d1009,_0x220f70){return new BPromise(function(_0x337cbb,_0x48a496){return client[_0x0dd7('0xf')](_0x1566cb,_0x220f70)[_0x0dd7('0x10')](function(_0x4ebbb5){logger[_0x0dd7('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x2d1009,_0x0dd7('0x12'));logger[_0x0dd7('0x13')](_0x0dd7('0x14'),_0x2d1009,'request\x20sent',JSON[_0x0dd7('0x15')](_0x4ebbb5));if(_0x4ebbb5[_0x0dd7('0x16')]){if(_0x4ebbb5[_0x0dd7('0x16')]['code']===0x1f4){logger[_0x0dd7('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2d1009,_0x4ebbb5[_0x0dd7('0x16')][_0x0dd7('0x17')]);return _0x48a496(_0x4ebbb5[_0x0dd7('0x16')][_0x0dd7('0x17')]);}logger[_0x0dd7('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2d1009,_0x4ebbb5[_0x0dd7('0x16')][_0x0dd7('0x17')]);return _0x337cbb(_0x4ebbb5['error'][_0x0dd7('0x17')]);}else{logger[_0x0dd7('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x2d1009,_0x0dd7('0x12'));_0x337cbb(_0x4ebbb5[_0x0dd7('0x18')]['message']);}})[_0x0dd7('0x19')](function(_0x15d57e){logger[_0x0dd7('0x16')](_0x0dd7('0x1a'),_0x2d1009,_0x15d57e);_0x48a496(_0x15d57e);});});}exports[_0x0dd7('0x1b')]=function(_0x2f6a76){var _0x17db4a=this;return new Promise(function(_0x2f61c7,_0xcc79cd){return db[_0x0dd7('0x1c')][_0x0dd7('0x1d')]({'raw':_0x2f6a76['options']?_0x2f6a76[_0x0dd7('0x1e')][_0x0dd7('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f6a76[_0x0dd7('0x1e')]?_0x2f6a76[_0x0dd7('0x1e')][_0x0dd7('0x20')]||null:null,'attributes':_0x2f6a76[_0x0dd7('0x1e')]?_0x2f6a76['options'][_0x0dd7('0x21')]||null:null,'limit':_0x2f6a76[_0x0dd7('0x1e')]?_0x2f6a76['options'][_0x0dd7('0x22')]||null:null,'include':_0x2f6a76['options']?_0x2f6a76['options'][_0x0dd7('0x23')]?_['map'](_0x2f6a76[_0x0dd7('0x1e')]['include'],function(_0x58bcdb){return{'model':db[_0x58bcdb[_0x0dd7('0x24')]],'as':_0x58bcdb['as'],'attributes':_0x58bcdb[_0x0dd7('0x21')],'include':_0x58bcdb['include']?_['map'](_0x58bcdb['include'],function(_0x272727){return{'model':db[_0x272727['model']],'as':_0x272727['as'],'attributes':_0x272727[_0x0dd7('0x21')],'include':_0x272727['include']?_['map'](_0x272727['include'],function(_0x6f0db){return{'model':db[_0x6f0db[_0x0dd7('0x24')]],'as':_0x6f0db['as'],'attributes':_0x6f0db[_0x0dd7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0dd7('0x10')](function(_0x130907){logger['info'](_0x0dd7('0x1b'),_0x2f6a76);logger[_0x0dd7('0x13')](_0x0dd7('0x1b'),_0x2f6a76,JSON[_0x0dd7('0x15')](_0x130907));_0x2f61c7(_0x130907);})[_0x0dd7('0x19')](function(_0x3ab200){logger['error'](_0x0dd7('0x1b'),_0x3ab200['message'],_0x2f6a76);_0xcc79cd(_0x17db4a['error'](0x1f4,_0x3ab200[_0x0dd7('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x31732c){var _0x498adc=this;return new Promise(function(_0x535db3,_0xbf6843){return db['VoiceQueue'][_0x0dd7('0x25')]({'raw':_0x31732c['options']?_0x31732c['options'][_0x0dd7('0x1f')]===undefined?!![]:![]:!![],'where':_0x31732c[_0x0dd7('0x1e')]?_0x31732c[_0x0dd7('0x1e')][_0x0dd7('0x20')]||null:null,'attributes':_0x31732c[_0x0dd7('0x1e')]?_0x31732c[_0x0dd7('0x1e')][_0x0dd7('0x21')]||null:null,'include':_0x31732c[_0x0dd7('0x1e')]?_0x31732c[_0x0dd7('0x1e')][_0x0dd7('0x23')]?_[_0x0dd7('0x26')](_0x31732c['options'][_0x0dd7('0x23')],function(_0x778417){return{'model':db[_0x778417[_0x0dd7('0x24')]],'as':_0x778417['as'],'attributes':_0x778417[_0x0dd7('0x21')],'include':_0x778417[_0x0dd7('0x23')]?_[_0x0dd7('0x26')](_0x778417['include'],function(_0x5a3597){return{'model':db[_0x5a3597[_0x0dd7('0x24')]],'as':_0x5a3597['as'],'attributes':_0x5a3597[_0x0dd7('0x21')],'include':_0x5a3597[_0x0dd7('0x23')]?_[_0x0dd7('0x26')](_0x5a3597[_0x0dd7('0x23')],function(_0x100fd0){return{'model':db[_0x100fd0[_0x0dd7('0x24')]],'as':_0x100fd0['as'],'attributes':_0x100fd0['attributes']};}):[]};}):[]};}):[]:[]})[_0x0dd7('0x10')](function(_0x3cf998){logger[_0x0dd7('0x11')](_0x0dd7('0x27'),_0x31732c);logger[_0x0dd7('0x13')](_0x0dd7('0x27'),_0x31732c,JSON['stringify'](_0x3cf998));_0x535db3(_0x3cf998);})[_0x0dd7('0x19')](function(_0x568870){logger['error']('ShowVoiceQueue',_0x568870['message'],_0x31732c);_0xbf6843(_0x498adc[_0x0dd7('0x16')](0x1f4,_0x568870[_0x0dd7('0x17')]));});});}; \ No newline at end of file +var _0x69d6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','stringify','ShowVoiceQueue','find','util','bluebird','ioredis'];(function(_0x3dafdc,_0xcf3dad){var _0x10f953=function(_0x3fb398){while(--_0x3fb398){_0x3dafdc['push'](_0x3dafdc['shift']());}};_0x10f953(++_0xcf3dad);}(_0x69d6,0xe7));var _0x669d=function(_0x4db198,_0x3ea6c2){_0x4db198=_0x4db198-0x0;var _0xedceb9=_0x69d6[_0x4db198];return _0xedceb9;};'use strict';var _=require('lodash');var util=require(_0x669d('0x0'));var moment=require('moment');var BPromise=require(_0x669d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x669d('0x2'));var db=require(_0x669d('0x3'))['db'];var utils=require(_0x669d('0x4'));var logger=require(_0x669d('0x5'))(_0x669d('0x6'));var config=require(_0x669d('0x7'));var jayson=require(_0x669d('0x8'));var client=jayson[_0x669d('0x9')]['http']({'port':0x232a});config['redis']=_[_0x669d('0xa')](config[_0x669d('0xb')],{'host':_0x669d('0xc'),'port':0x18eb});var socket=require(_0x669d('0xd'))(new Redis(config[_0x669d('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5b0a7f,_0x58f020,_0x28790d){return new BPromise(function(_0x56f627,_0x267c6e){return client[_0x669d('0xe')](_0x5b0a7f,_0x28790d)[_0x669d('0xf')](function(_0x1289b1){logger[_0x669d('0x10')](_0x669d('0x11'),_0x58f020,_0x669d('0x12'));logger['debug'](_0x669d('0x13'),_0x58f020,'request\x20sent',JSON['stringify'](_0x1289b1));if(_0x1289b1[_0x669d('0x14')]){if(_0x1289b1[_0x669d('0x14')][_0x669d('0x15')]===0x1f4){logger[_0x669d('0x14')](_0x669d('0x11'),_0x58f020,_0x1289b1[_0x669d('0x14')][_0x669d('0x16')]);return _0x267c6e(_0x1289b1['error'][_0x669d('0x16')]);}logger[_0x669d('0x14')](_0x669d('0x11'),_0x58f020,_0x1289b1[_0x669d('0x14')][_0x669d('0x16')]);return _0x56f627(_0x1289b1[_0x669d('0x14')][_0x669d('0x16')]);}else{logger[_0x669d('0x10')](_0x669d('0x11'),_0x58f020,_0x669d('0x12'));_0x56f627(_0x1289b1['result'][_0x669d('0x16')]);}})[_0x669d('0x17')](function(_0x19a408){logger['error'](_0x669d('0x11'),_0x58f020,_0x19a408);_0x267c6e(_0x19a408);});});}exports[_0x669d('0x18')]=function(_0x3615d7){var _0x309de9=this;return new Promise(function(_0x4b8681,_0x360dd3){return db[_0x669d('0x19')][_0x669d('0x1a')]({'raw':_0x3615d7['options']?_0x3615d7[_0x669d('0x1b')][_0x669d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3615d7[_0x669d('0x1b')]?_0x3615d7[_0x669d('0x1b')][_0x669d('0x1d')]||null:null,'attributes':_0x3615d7[_0x669d('0x1b')]?_0x3615d7[_0x669d('0x1b')][_0x669d('0x1e')]||null:null,'limit':_0x3615d7[_0x669d('0x1b')]?_0x3615d7[_0x669d('0x1b')][_0x669d('0x1f')]||null:null,'include':_0x3615d7[_0x669d('0x1b')]?_0x3615d7['options']['include']?_['map'](_0x3615d7[_0x669d('0x1b')][_0x669d('0x20')],function(_0x23d308){return{'model':db[_0x23d308[_0x669d('0x21')]],'as':_0x23d308['as'],'attributes':_0x23d308[_0x669d('0x1e')],'include':_0x23d308[_0x669d('0x20')]?_[_0x669d('0x22')](_0x23d308[_0x669d('0x20')],function(_0x3750b7){return{'model':db[_0x3750b7[_0x669d('0x21')]],'as':_0x3750b7['as'],'attributes':_0x3750b7[_0x669d('0x1e')],'include':_0x3750b7[_0x669d('0x20')]?_['map'](_0x3750b7[_0x669d('0x20')],function(_0x12c822){return{'model':db[_0x12c822[_0x669d('0x21')]],'as':_0x12c822['as'],'attributes':_0x12c822['attributes']};}):[]};}):[]};}):[]:[]})[_0x669d('0xf')](function(_0x3a7439){logger['info'](_0x669d('0x18'),_0x3615d7);logger[_0x669d('0x23')](_0x669d('0x18'),_0x3615d7,JSON[_0x669d('0x24')](_0x3a7439));_0x4b8681(_0x3a7439);})[_0x669d('0x17')](function(_0x9af367){logger[_0x669d('0x14')](_0x669d('0x18'),_0x9af367[_0x669d('0x16')],_0x3615d7);_0x360dd3(_0x309de9[_0x669d('0x14')](0x1f4,_0x9af367[_0x669d('0x16')]));});});};exports[_0x669d('0x25')]=function(_0x3ed66f){var _0x1b049f=this;return new Promise(function(_0x28e4a1,_0x362229){return db[_0x669d('0x19')][_0x669d('0x26')]({'raw':_0x3ed66f['options']?_0x3ed66f[_0x669d('0x1b')][_0x669d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ed66f[_0x669d('0x1b')]?_0x3ed66f['options'][_0x669d('0x1d')]||null:null,'attributes':_0x3ed66f[_0x669d('0x1b')]?_0x3ed66f[_0x669d('0x1b')][_0x669d('0x1e')]||null:null,'include':_0x3ed66f[_0x669d('0x1b')]?_0x3ed66f[_0x669d('0x1b')][_0x669d('0x20')]?_['map'](_0x3ed66f[_0x669d('0x1b')]['include'],function(_0x55b7c8){return{'model':db[_0x55b7c8[_0x669d('0x21')]],'as':_0x55b7c8['as'],'attributes':_0x55b7c8[_0x669d('0x1e')],'include':_0x55b7c8[_0x669d('0x20')]?_[_0x669d('0x22')](_0x55b7c8[_0x669d('0x20')],function(_0x114e86){return{'model':db[_0x114e86[_0x669d('0x21')]],'as':_0x114e86['as'],'attributes':_0x114e86[_0x669d('0x1e')],'include':_0x114e86[_0x669d('0x20')]?_[_0x669d('0x22')](_0x114e86[_0x669d('0x20')],function(_0x49de23){return{'model':db[_0x49de23[_0x669d('0x21')]],'as':_0x49de23['as'],'attributes':_0x49de23[_0x669d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x669d('0xf')](function(_0xa7c2e5){logger['info'](_0x669d('0x25'),_0x3ed66f);logger[_0x669d('0x23')](_0x669d('0x25'),_0x3ed66f,JSON[_0x669d('0x24')](_0xa7c2e5));_0x28e4a1(_0xa7c2e5);})[_0x669d('0x17')](function(_0x75bfce){logger[_0x669d('0x14')]('ShowVoiceQueue',_0x75bfce[_0x669d('0x16')],_0x3ed66f);_0x362229(_0x1b049f[_0x669d('0x14')](0x1f4,_0x75bfce[_0x669d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f64443a..e9c4437 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 _0x2964=['save','remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x1d765f,_0x19ce3a){var _0x1a50ca=function(_0x599f66){while(--_0x599f66){_0x1d765f['push'](_0x1d765f['shift']());}};_0x1a50ca(++_0x19ce3a);}(_0x2964,0x8f));var _0x4296=function(_0x4c42a3,_0xd68f54){_0x4c42a3=_0x4c42a3-0x0;var _0x1be62b=_0x2964[_0x4c42a3];return _0x1be62b;};'use strict';var VoiceQueueEvents=require(_0x4296('0x0'));var events=[_0x4296('0x1'),_0x4296('0x2'),_0x4296('0x3')];function createListener(_0xcca10c,_0x20de2c){return function(_0x2fc873){_0x20de2c[_0x4296('0x4')](_0xcca10c,_0x2fc873);};}function removeListener(_0x5b475b,_0x1796ef){return function(){VoiceQueueEvents[_0x4296('0x5')](_0x5b475b,_0x1796ef);};}exports[_0x4296('0x6')]=function(_0x40296e){for(var _0x59e857=0x0,_0x1bdd00=events[_0x4296('0x7')];_0x59e857<_0x1bdd00;_0x59e857++){var _0x332dc4=events[_0x59e857];var _0x367c94=createListener(_0x4296('0x8')+_0x332dc4,_0x40296e);VoiceQueueEvents['on'](_0x332dc4,_0x367c94);}}; \ No newline at end of file +var _0x9699=['length','voiceQueue:','./voiceQueue.events','save','emit','removeListener','register'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x9699,0xd4));var _0x9969=function(_0x32c148,_0x37316f){_0x32c148=_0x32c148-0x0;var _0xed3bf8=_0x9699[_0x32c148];return _0xed3bf8;};'use strict';var VoiceQueueEvents=require(_0x9969('0x0'));var events=[_0x9969('0x1'),'remove','update'];function createListener(_0x11697f,_0x2e9660){return function(_0x54d7f2){_0x2e9660[_0x9969('0x2')](_0x11697f,_0x54d7f2);};}function removeListener(_0x4e633d,_0x5efafc){return function(){VoiceQueueEvents[_0x9969('0x3')](_0x4e633d,_0x5efafc);};}exports[_0x9969('0x4')]=function(_0x3e2b68){for(var _0x41c8b3=0x0,_0x1efa92=events[_0x9969('0x5')];_0x41c8b3<_0x1efa92;_0x41c8b3++){var _0x70260f=events[_0x41c8b3];var _0x5a052d=createListener(_0x9969('0x6')+_0x70260f,_0x3e2b68);VoiceQueueEvents['on'](_0x70260f,_0x5a052d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a548b3b..fc7c26d 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 _0x4ccb=['getVoiceQueuesReport','/:id','post','put','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','describe'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4ccb,0x196));var _0xb4cc=function(_0x192e18,_0x3a1023){_0x192e18=_0x192e18-0x0;var _0x56243a=_0x4ccb[_0x192e18];return _0x56243a;};'use strict';var multer=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var path=require(_0xb4cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4cc('0x3'));var router=express[_0xb4cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb4cc('0x5'));var config=require(_0xb4cc('0x6'));var controller=require(_0xb4cc('0x7'));router['get']('/',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x9')]);router[_0xb4cc('0xa')]('/describe',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0xb')]);router[_0xb4cc('0xa')]('/index',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0xc')]);router[_0xb4cc('0xa')](_0xb4cc('0xd'),auth[_0xb4cc('0x8')](),controller['show']);router[_0xb4cc('0xe')]('/',auth[_0xb4cc('0x8')](),controller['create']);router[_0xb4cc('0xf')]('/:id',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x10')]);router[_0xb4cc('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb4cc('0x12')]);module['exports']=router; \ No newline at end of file +var _0x50a5=['getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','exports','multer','util','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x50a5,0xd1));var _0x550a=function(_0x297ccd,_0xce03f9){_0x297ccd=_0x297ccd-0x0;var _0x28fdfb=_0x50a5[_0x297ccd];return _0x28fdfb;};'use strict';var multer=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x550a('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x550a('0x3'));var controller=require(_0x550a('0x4'));router[_0x550a('0x5')]('/',auth[_0x550a('0x6')](),controller[_0x550a('0x7')]);router[_0x550a('0x5')](_0x550a('0x8'),auth[_0x550a('0x6')](),controller[_0x550a('0x9')]);router[_0x550a('0x5')](_0x550a('0xa'),auth[_0x550a('0x6')](),controller[_0x550a('0xb')]);router['get'](_0x550a('0xc'),auth[_0x550a('0x6')](),controller[_0x550a('0xd')]);router[_0x550a('0xe')]('/',auth[_0x550a('0x6')](),controller[_0x550a('0xf')]);router['put'](_0x550a('0xc'),auth[_0x550a('0x6')](),controller[_0x550a('0x10')]);router[_0x550a('0x11')](_0x550a('0xc'),auth[_0x550a('0x6')](),controller[_0x550a('0x12')]);module[_0x550a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 16b4302..f00c8ae 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 _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x47595e,_0x3e1c1e){var _0x4c86a9=function(_0x5357ce){while(--_0x5357ce){_0x47595e['push'](_0x47595e['shift']());}};_0x4c86a9(++_0x3e1c1e);}(_0x70e0,0x17b));var _0x070e=function(_0x2abb92,_0x41cd5e){_0x2abb92=_0x2abb92-0x0;var _0x5017cb=_0x70e0[_0x2abb92];return _0x5017cb;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d8b('0x2')]},'calleridname':{'type':Sequelize[_0x0d8b('0x2')]},'queue':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x577834){var _0x5e15e6=moment(_0x577834);var _0x3f8b6f=moment(this[_0x0d8b('0x4')](_0x0d8b('0x5')))['format'](_0x0d8b('0x6'));var _0x284169=_0x5e15e6['diff'](_0x3f8b6f,_0x0d8b('0x7'));this[_0x0d8b('0x8')](_0x0d8b('0x9'),_0x577834);this[_0x0d8b('0x8')](_0x0d8b('0xa'),_0x284169||null);}},'position':{'type':Sequelize[_0x0d8b('0xb')]},'count':{'type':Sequelize[_0x0d8b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xd')},'originalposition':{'type':Sequelize[_0x0d8b('0xb')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d8b('0x2')]},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'context':{'type':Sequelize[_0x0d8b('0x2')]},'exten':{'type':Sequelize[_0x0d8b('0x2')]},'priority':{'type':Sequelize[_0x0d8b('0x2')]},'holdtime':{'type':Sequelize[_0x0d8b('0xb')]},'mohtime':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0d8b('0x2')]},'transfer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xe')},'transferexten':{'type':Sequelize[_0x0d8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 14161d5..f1d9f35 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 _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x4a1322,_0x5537b7){var _0x540071=function(_0x21a1d8){while(--_0x21a1d8){_0x4a1322['push'](_0x4a1322['shift']());}};_0x540071(++_0x5537b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x3fdb8b,_0xd30463){var _0x14114c=function(_0x3ad14e){while(--_0x3ad14e){_0x3fdb8b['push'](_0x3fdb8b['shift']());}};_0x14114c(++_0xd30463);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d219025..f8b7dd6 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 _0x5bb4=['VoiceQueueReport','setMaxListeners','save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x476f35,_0x4d4d0e){var _0x453e9b=function(_0xa7c039){while(--_0xa7c039){_0x476f35['push'](_0x476f35['shift']());}};_0x453e9b(++_0x4d4d0e);}(_0x5bb4,0x13e));var _0x45bb=function(_0x287d68,_0x2ebb74){_0x287d68=_0x287d68-0x0;var _0x4cf0d9=_0x5bb4[_0x287d68];return _0x4cf0d9;};'use strict';var EventEmitter=require(_0x45bb('0x0'));var VoiceQueueReport=require(_0x45bb('0x1'))['db'][_0x45bb('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x45bb('0x3')](0x0);var events={'afterCreate':_0x45bb('0x4'),'afterUpdate':_0x45bb('0x5'),'afterDestroy':_0x45bb('0x6')};function emitEvent(_0x55c22b){return function(_0x42f3ec,_0x45ff87,_0x2e3f53){VoiceQueueReportEvents['emit'](_0x55c22b+':'+_0x42f3ec['id'],_0x42f3ec);VoiceQueueReportEvents['emit'](_0x55c22b,_0x42f3ec);_0x2e3f53(null);};}for(var e in events){if(events[_0x45bb('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x9537=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x9537,0x1d0));var _0x7953=function(_0x55ef7d,_0x24490b){_0x55ef7d=_0x55ef7d-0x0;var _0x1def2d=_0x9537[_0x55ef7d];return _0x1def2d;};'use strict';var EventEmitter=require(_0x7953('0x0'));var VoiceQueueReport=require(_0x7953('0x1'))['db'][_0x7953('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7953('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7953('0x4'),'afterDestroy':_0x7953('0x5')};function emitEvent(_0x7f1b4d){return function(_0x55da09,_0x6f95fc,_0x52fc87){VoiceQueueReportEvents[_0x7953('0x6')](_0x7f1b4d+':'+_0x55da09['id'],_0x55da09);VoiceQueueReportEvents[_0x7953('0x6')](_0x7f1b4d,_0x55da09);_0x52fc87(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7953('0x7')](e,emitEvent(event));}}module[_0x7953('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 7fe71c5..a8fd59e 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 _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x26f169,_0x2d01b2){var _0x43aad9=function(_0x4395ea){while(--_0x4395ea){_0x26f169['push'](_0x26f169['shift']());}};_0x43aad9(++_0x2d01b2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5be6d3,_0x3becee){_0x5be6d3=_0x5be6d3-0x0;var _0x3a677b=_0x5f2f[_0x5be6d3];return _0x3a677b;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x3cae30,_0x5d8b99){var _0x263f77=function(_0x308222){while(--_0x308222){_0x3cae30['push'](_0x3cae30['shift']());}};_0x263f77(++_0x5d8b99);}(_0xb10b,0x12a));var _0xbb10=function(_0x421c11,_0xcf7560){_0x421c11=_0x421c11-0x0;var _0x317709=_0xb10b[_0x421c11];return _0x317709;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0885706..a21d188 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 _0x7de1=['error','code','message','VoiceQueueReport,\x20%s,\x20%s','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','then','info','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x335e05,_0x207ea2){var _0x1ba224=function(_0x2a02f3){while(--_0x2a02f3){_0x335e05['push'](_0x335e05['shift']());}};_0x1ba224(++_0x207ea2);}(_0x7de1,0x1cd));var _0x17de=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x7de1[_0x347471];return _0x422b6a;};'use strict';var _=require(_0x17de('0x0'));var util=require(_0x17de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17de('0x2'));var fs=require('fs');var Redis=require(_0x17de('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x17de('0x4'))(_0x17de('0x5'));var config=require('../../config/environment');var jayson=require(_0x17de('0x6'));var client=jayson[_0x17de('0x7')][_0x17de('0x8')]({'port':0x232a});config[_0x17de('0x9')]=_[_0x17de('0xa')](config[_0x17de('0x9')],{'host':_0x17de('0xb'),'port':0x18eb});var socket=require(_0x17de('0xc'))(new Redis(config[_0x17de('0x9')]));require('./voiceQueueReport.socket')[_0x17de('0xd')](socket);function respondWithRpcPromise(_0x13dbfa,_0x1cf978,_0x2e4f28){return new BPromise(function(_0x205691,_0x35e994){return client[_0x17de('0xe')](_0x13dbfa,_0x2e4f28)['then'](function(_0x5aa6a1){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1cf978,_0x17de('0xf'));logger[_0x17de('0x10')](_0x17de('0x11'),_0x1cf978,_0x17de('0xf'),JSON[_0x17de('0x12')](_0x5aa6a1));if(_0x5aa6a1[_0x17de('0x13')]){if(_0x5aa6a1[_0x17de('0x13')][_0x17de('0x14')]===0x1f4){logger[_0x17de('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cf978,_0x5aa6a1['error'][_0x17de('0x15')]);return _0x35e994(_0x5aa6a1['error'][_0x17de('0x15')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1cf978,_0x5aa6a1[_0x17de('0x13')][_0x17de('0x15')]);return _0x205691(_0x5aa6a1[_0x17de('0x13')]['message']);}else{logger['info'](_0x17de('0x16'),_0x1cf978,_0x17de('0xf'));_0x205691(_0x5aa6a1['result'][_0x17de('0x15')]);}})[_0x17de('0x17')](function(_0x203080){logger[_0x17de('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cf978,_0x203080);_0x35e994(_0x203080);});});}exports[_0x17de('0x18')]=function(_0x3cf737){var _0x5efaa1=this;return new Promise(function(_0x33de9d,_0x155a77){return db[_0x17de('0x19')][_0x17de('0x1a')]({'raw':_0x3cf737[_0x17de('0x1b')]?_0x3cf737[_0x17de('0x1b')][_0x17de('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cf737['options']?_0x3cf737[_0x17de('0x1b')][_0x17de('0x1d')]||null:null,'attributes':_0x3cf737[_0x17de('0x1b')]?_0x3cf737['options'][_0x17de('0x1e')]||null:null,'limit':_0x3cf737[_0x17de('0x1b')]?_0x3cf737[_0x17de('0x1b')][_0x17de('0x1f')]||null:null,'include':_0x3cf737[_0x17de('0x1b')]?_0x3cf737['options']['include']?_['map'](_0x3cf737[_0x17de('0x1b')][_0x17de('0x20')],function(_0xc64c63){return{'model':db[_0xc64c63[_0x17de('0x21')]],'as':_0xc64c63['as'],'attributes':_0xc64c63[_0x17de('0x1e')],'include':_0xc64c63[_0x17de('0x20')]?_['map'](_0xc64c63[_0x17de('0x20')],function(_0x580c6b){return{'model':db[_0x580c6b[_0x17de('0x21')]],'as':_0x580c6b['as'],'attributes':_0x580c6b[_0x17de('0x1e')],'include':_0x580c6b[_0x17de('0x20')]?_['map'](_0x580c6b[_0x17de('0x20')],function(_0x2326c7){return{'model':db[_0x2326c7[_0x17de('0x21')]],'as':_0x2326c7['as'],'attributes':_0x2326c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x17de('0x22')](function(_0x23c846){logger[_0x17de('0x23')](_0x17de('0x18'),_0x3cf737);logger[_0x17de('0x10')]('GetVoiceQueueReport',_0x3cf737,JSON[_0x17de('0x12')](_0x23c846));_0x33de9d(_0x23c846);})['catch'](function(_0x3f1ab2){logger['error'](_0x17de('0x18'),_0x3f1ab2['message'],_0x3cf737);_0x155a77(_0x5efaa1[_0x17de('0x13')](0x1f4,_0x3f1ab2[_0x17de('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x14238c){var _0x2ebada=this;return new Promise(function(_0x454df6,_0x5ef732){return db[_0x17de('0x19')]['create'](_0x14238c[_0x17de('0x24')],{'raw':_0x14238c[_0x17de('0x1b')]?_0x14238c[_0x17de('0x1b')][_0x17de('0x1c')]===undefined?!![]:![]:!![]})[_0x17de('0x22')](function(_0x540925){logger[_0x17de('0x23')](_0x17de('0x25'),_0x14238c);logger[_0x17de('0x10')](_0x17de('0x25'),_0x14238c,JSON['stringify'](_0x540925));_0x454df6(_0x540925);})[_0x17de('0x17')](function(_0x52d87a){logger[_0x17de('0x13')]('CreateVoiceQueueReport',_0x52d87a['message'],_0x14238c);_0x5ef732(_0x2ebada['error'](0x1f4,_0x52d87a[_0x17de('0x15')]));});});};exports[_0x17de('0x26')]=function(_0x5265fa){var _0x287d8f=this;return new Promise(function(_0x17e2a9,_0x209ffa){return db[_0x17de('0x19')][_0x17de('0x27')](_0x5265fa[_0x17de('0x24')],{'raw':_0x5265fa[_0x17de('0x1b')]?_0x5265fa[_0x17de('0x1b')][_0x17de('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5265fa['options']?_0x5265fa['options']['where']||null:null,'attributes':_0x5265fa[_0x17de('0x1b')]?_0x5265fa[_0x17de('0x1b')]['attributes']||null:null,'limit':_0x5265fa[_0x17de('0x1b')]?_0x5265fa[_0x17de('0x1b')]['limit']||null:null})[_0x17de('0x22')](function(_0x1c970c){logger[_0x17de('0x23')]('UpdateVoiceQueueReport',_0x5265fa);logger[_0x17de('0x10')]('UpdateVoiceQueueReport',_0x5265fa,JSON['stringify'](_0x1c970c));_0x17e2a9(_0x1c970c);})[_0x17de('0x17')](function(_0x5687c5){logger[_0x17de('0x13')](_0x17de('0x26'),_0x5687c5['message'],_0x5265fa);_0x209ffa(_0x287d8f[_0x17de('0x13')](0x1f4,_0x5687c5[_0x17de('0x15')]));});});}; \ No newline at end of file +var _0x21e2=['UpdateVoiceQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body'];(function(_0x3aeb6b,_0x32ada4){var _0x30087b=function(_0x19ee6a){while(--_0x19ee6a){_0x3aeb6b['push'](_0x3aeb6b['shift']());}};_0x30087b(++_0x32ada4);}(_0x21e2,0x1b9));var _0x221e=function(_0x4c7c31,_0x2c2905){_0x4c7c31=_0x4c7c31-0x0;var _0x11a7ed=_0x21e2[_0x4c7c31];return _0x11a7ed;};'use strict';var _=require(_0x221e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x221e('0x1'));var rs=require(_0x221e('0x2'));var fs=require('fs');var Redis=require(_0x221e('0x3'));var db=require(_0x221e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x221e('0x5'))('rpc');var config=require(_0x221e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x221e('0x7')][_0x221e('0x8')]({'port':0x232a});config['redis']=_[_0x221e('0x9')](config[_0x221e('0xa')],{'host':_0x221e('0xb'),'port':0x18eb});var socket=require(_0x221e('0xc'))(new Redis(config[_0x221e('0xa')]));require(_0x221e('0xd'))['register'](socket);function respondWithRpcPromise(_0x28a44d,_0x4e7ade,_0x9edfe9){return new BPromise(function(_0x16c030,_0x4f1136){return client['request'](_0x28a44d,_0x9edfe9)[_0x221e('0xe')](function(_0x4b4185){logger[_0x221e('0xf')](_0x221e('0x10'),_0x4e7ade,_0x221e('0x11'));logger[_0x221e('0x12')](_0x221e('0x13'),_0x4e7ade,_0x221e('0x11'),JSON[_0x221e('0x14')](_0x4b4185));if(_0x4b4185[_0x221e('0x15')]){if(_0x4b4185[_0x221e('0x15')]['code']===0x1f4){logger[_0x221e('0x15')](_0x221e('0x10'),_0x4e7ade,_0x4b4185[_0x221e('0x15')]['message']);return _0x4f1136(_0x4b4185[_0x221e('0x15')][_0x221e('0x16')]);}logger[_0x221e('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4e7ade,_0x4b4185['error'][_0x221e('0x16')]);return _0x16c030(_0x4b4185[_0x221e('0x15')]['message']);}else{logger[_0x221e('0xf')](_0x221e('0x10'),_0x4e7ade,_0x221e('0x11'));_0x16c030(_0x4b4185[_0x221e('0x17')][_0x221e('0x16')]);}})[_0x221e('0x18')](function(_0x521484){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4e7ade,_0x521484);_0x4f1136(_0x521484);});});}exports['GetVoiceQueueReport']=function(_0x4138d0){var _0x5cf814=this;return new Promise(function(_0x1c4bcb,_0x5f1e56){return db[_0x221e('0x19')][_0x221e('0x1a')]({'raw':_0x4138d0[_0x221e('0x1b')]?_0x4138d0[_0x221e('0x1b')][_0x221e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4138d0[_0x221e('0x1b')]?_0x4138d0[_0x221e('0x1b')][_0x221e('0x1d')]||null:null,'attributes':_0x4138d0[_0x221e('0x1b')]?_0x4138d0[_0x221e('0x1b')][_0x221e('0x1e')]||null:null,'limit':_0x4138d0[_0x221e('0x1b')]?_0x4138d0['options'][_0x221e('0x1f')]||null:null,'include':_0x4138d0[_0x221e('0x1b')]?_0x4138d0[_0x221e('0x1b')][_0x221e('0x20')]?_[_0x221e('0x21')](_0x4138d0[_0x221e('0x1b')][_0x221e('0x20')],function(_0x53b3ba){return{'model':db[_0x53b3ba['model']],'as':_0x53b3ba['as'],'attributes':_0x53b3ba['attributes'],'include':_0x53b3ba[_0x221e('0x20')]?_[_0x221e('0x21')](_0x53b3ba[_0x221e('0x20')],function(_0x33293e){return{'model':db[_0x33293e[_0x221e('0x22')]],'as':_0x33293e['as'],'attributes':_0x33293e[_0x221e('0x1e')],'include':_0x33293e['include']?_[_0x221e('0x21')](_0x33293e['include'],function(_0x1699ac){return{'model':db[_0x1699ac[_0x221e('0x22')]],'as':_0x1699ac['as'],'attributes':_0x1699ac[_0x221e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x221e('0xe')](function(_0x2ca4cc){logger[_0x221e('0xf')](_0x221e('0x23'),_0x4138d0);logger['debug'](_0x221e('0x23'),_0x4138d0,JSON['stringify'](_0x2ca4cc));_0x1c4bcb(_0x2ca4cc);})['catch'](function(_0x1b4a5b){logger['error'](_0x221e('0x23'),_0x1b4a5b[_0x221e('0x16')],_0x4138d0);_0x5f1e56(_0x5cf814[_0x221e('0x15')](0x1f4,_0x1b4a5b[_0x221e('0x16')]));});});};exports[_0x221e('0x24')]=function(_0x4d8af9){var _0x1e211a=this;return new Promise(function(_0x258bfb,_0x38bb4b){return db[_0x221e('0x19')][_0x221e('0x25')](_0x4d8af9[_0x221e('0x26')],{'raw':_0x4d8af9[_0x221e('0x1b')]?_0x4d8af9[_0x221e('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x299094){logger[_0x221e('0xf')](_0x221e('0x24'),_0x4d8af9);logger['debug'](_0x221e('0x24'),_0x4d8af9,JSON[_0x221e('0x14')](_0x299094));_0x258bfb(_0x299094);})['catch'](function(_0x3c16d4){logger['error']('CreateVoiceQueueReport',_0x3c16d4[_0x221e('0x16')],_0x4d8af9);_0x38bb4b(_0x1e211a[_0x221e('0x15')](0x1f4,_0x3c16d4['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x12795a){var _0xf35f56=this;return new Promise(function(_0x43ef5d,_0x1efd11){return db['VoiceQueueReport']['update'](_0x12795a[_0x221e('0x26')],{'raw':_0x12795a['options']?_0x12795a[_0x221e('0x1b')][_0x221e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12795a[_0x221e('0x1b')]?_0x12795a[_0x221e('0x1b')]['where']||null:null,'attributes':_0x12795a[_0x221e('0x1b')]?_0x12795a[_0x221e('0x1b')][_0x221e('0x1e')]||null:null,'limit':_0x12795a[_0x221e('0x1b')]?_0x12795a['options'][_0x221e('0x1f')]||null:null})[_0x221e('0xe')](function(_0x4a7817){logger[_0x221e('0xf')](_0x221e('0x27'),_0x12795a);logger[_0x221e('0x12')](_0x221e('0x27'),_0x12795a,JSON[_0x221e('0x14')](_0x4a7817));_0x43ef5d(_0x4a7817);})['catch'](function(_0x188844){logger[_0x221e('0x15')](_0x221e('0x27'),_0x188844[_0x221e('0x16')],_0x12795a);_0x1efd11(_0xf35f56[_0x221e('0x15')](0x1f4,_0x188844[_0x221e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 39aa7c1..f2b773c 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 _0x4eed=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x4a2b62,_0x5a972a){var _0x2ca5ac=function(_0x83d23c){while(--_0x83d23c){_0x4a2b62['push'](_0x4a2b62['shift']());}};_0x2ca5ac(++_0x5a972a);}(_0x4eed,0x1f1));var _0xd4ee=function(_0x2aa1c3,_0x2568f0){_0x2aa1c3=_0x2aa1c3-0x0;var _0x4f75e9=_0x4eed[_0x2aa1c3];return _0x4f75e9;};'use strict';var VoiceQueueReportEvents=require(_0xd4ee('0x0'));var events=[_0xd4ee('0x1'),_0xd4ee('0x2'),_0xd4ee('0x3')];function createListener(_0x193aa0,_0x137301){return function(_0x2cdefe){_0x137301[_0xd4ee('0x4')](_0x193aa0,_0x2cdefe);};}function removeListener(_0x39b6e4,_0x7aa221){return function(){VoiceQueueReportEvents[_0xd4ee('0x5')](_0x39b6e4,_0x7aa221);};}exports[_0xd4ee('0x6')]=function(_0x2762a4){for(var _0x1b6214=0x0,_0x389277=events['length'];_0x1b6214<_0x389277;_0x1b6214++){var _0x359619=events[_0x1b6214];var _0x140537=createListener(_0xd4ee('0x7')+_0x359619,_0x2762a4);VoiceQueueReportEvents['on'](_0x359619,_0x140537);}}; \ No newline at end of file +var _0x6c5a=['./voiceQueueReport.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c5a,0xf3));var _0xa6c5=function(_0x3536c5,_0x4e33b2){_0x3536c5=_0x3536c5-0x0;var _0x4a0f82=_0x6c5a[_0x3536c5];return _0x4a0f82;};'use strict';var VoiceQueueReportEvents=require(_0xa6c5('0x0'));var events=[_0xa6c5('0x1'),'remove',_0xa6c5('0x2')];function createListener(_0x59f30e,_0x207c87){return function(_0x267b4d){_0x207c87['emit'](_0x59f30e,_0x267b4d);};}function removeListener(_0x51aa29,_0x2b9c14){return function(){VoiceQueueReportEvents['removeListener'](_0x51aa29,_0x2b9c14);};}exports['register']=function(_0x34f0a3){for(var _0x26ae52=0x0,_0x2bfbfc=events['length'];_0x26ae52<_0x2bfbfc;_0x26ae52++){var _0x4783a5=events[_0x26ae52];var _0x525ec3=createListener('voiceQueueReport:'+_0x4783a5,_0x34f0a3);VoiceQueueReportEvents['on'](_0x4783a5,_0x525ec3);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 240e6b6..b00a00d 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 _0x1b3d=['express','Router','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1b3d,0x1f4));var _0xd1b3=function(_0x5a2814,_0x1c404f){_0x5a2814=_0x5a2814-0x0;var _0x1b07a0=_0x1b3d[_0x5a2814];return _0x1b07a0;};'use strict';var multer=require(_0xd1b3('0x0'));var util=require(_0xd1b3('0x1'));var path=require(_0xd1b3('0x2'));var timeout=require(_0xd1b3('0x3'));var express=require(_0xd1b3('0x4'));var router=express[_0xd1b3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd1b3('0x6'));var config=require('../../config/environment');var controller=require(_0xd1b3('0x7'));router[_0xd1b3('0x8')]('/',auth[_0xd1b3('0x9')](),controller['index']);router['get'](_0xd1b3('0xa'),auth[_0xd1b3('0x9')](),controller[_0xd1b3('0xb')]);router[_0xd1b3('0xc')]('/',auth[_0xd1b3('0x9')](),controller[_0xd1b3('0xd')]);router[_0xd1b3('0xe')](_0xd1b3('0xa'),auth[_0xd1b3('0x9')](),controller[_0xd1b3('0xf')]);router[_0xd1b3('0x10')](_0xd1b3('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd1b3('0x11')]=router; \ No newline at end of file +var _0xe896=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer'];(function(_0x243300,_0x316d20){var _0x3a7583=function(_0x472d10){while(--_0x472d10){_0x243300['push'](_0x243300['shift']());}};_0x3a7583(++_0x316d20);}(_0xe896,0xbd));var _0x6e89=function(_0x2d2641,_0x713a38){_0x2d2641=_0x2d2641-0x0;var _0x2fb825=_0xe896[_0x2d2641];return _0x2fb825;};'use strict';var multer=require(_0x6e89('0x0'));var util=require(_0x6e89('0x1'));var path=require(_0x6e89('0x2'));var timeout=require(_0x6e89('0x3'));var express=require(_0x6e89('0x4'));var router=express[_0x6e89('0x5')]();var auth=require(_0x6e89('0x6'));var interaction=require(_0x6e89('0x7'));var config=require('../../config/environment');var controller=require(_0x6e89('0x8'));router[_0x6e89('0x9')]('/',auth[_0x6e89('0xa')](),controller[_0x6e89('0xb')]);router[_0x6e89('0x9')]('/:id',auth[_0x6e89('0xa')](),controller[_0x6e89('0xc')]);router[_0x6e89('0xd')]('/',auth[_0x6e89('0xa')](),controller[_0x6e89('0xe')]);router['put'](_0x6e89('0xf'),auth[_0x6e89('0xa')](),controller[_0x6e89('0x10')]);router[_0x6e89('0x11')](_0x6e89('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e89('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6eb8a6b..79a6747 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 _0x82c2=['sequelize','moment','exports','STRING','DATE','format'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0x82c2,0x17a));var _0x282c=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0x82c2[_0xb0b922];return _0x5dc41e;};'use strict';var Sequelize=require(_0x282c('0x0'));var moment=require(_0x282c('0x1'));module[_0x282c('0x2')]={'time':{'type':Sequelize[_0x282c('0x3')]},'callid':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x282c('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x282c('0x4')],'allowNull':![],'defaultValue':moment()[_0x282c('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xd8e3=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x206a3c,_0x2c2f57){var _0x3e0f8d=function(_0x2edcb9){while(--_0x2edcb9){_0x206a3c['push'](_0x206a3c['shift']());}};_0x3e0f8d(++_0x2c2f57);}(_0xd8e3,0x7b));var _0x3d8e=function(_0x18db84,_0x1f700a){_0x18db84=_0x18db84-0x0;var _0x2dc659=_0xd8e3[_0x18db84];return _0x2dc659;};'use strict';var Sequelize=require(_0x3d8e('0x0'));var moment=require(_0x3d8e('0x1'));module['exports']={'time':{'type':Sequelize[_0x3d8e('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3d8e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3d8e('0x3')],'allowNull':![],'defaultValue':moment()[_0x3d8e('0x4')](_0x3d8e('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a00be5b..ad586b1 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 _0x0cc9=['filters','filter','merge','options','VoiceQueuesLog','includeAll','include','findAll','catch','show','params','fields','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x2c45e8,_0x552869){var _0x1f7b63=function(_0x1affd6){while(--_0x1affd6){_0x2c45e8['push'](_0x2c45e8['shift']());}};_0x1f7b63(++_0x552869);}(_0x0cc9,0xa2));var _0x90cc=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0x0cc9[_0x27125a];return _0x391f7a;};'use strict';var pdf=require(_0x90cc('0x0'));var emlformat=require(_0x90cc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x90cc('0x2'));var jsonpatch=require(_0x90cc('0x3'));var rp=require(_0x90cc('0x4'));var moment=require('moment');var BPromise=require(_0x90cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90cc('0x6'));var sox=require(_0x90cc('0x7'));var csv=require(_0x90cc('0x8'));var ejs=require(_0x90cc('0x9'));var fs=require('fs');var _=require(_0x90cc('0xa'));var squel=require(_0x90cc('0xb'));var crypto=require(_0x90cc('0xc'));var jsforce=require(_0x90cc('0xd'));var deskjs=require(_0x90cc('0xe'));var toCsv=require(_0x90cc('0x8'));var querystring=require('querystring');var Papa=require(_0x90cc('0xf'));var Redis=require('ioredis');var authService=require(_0x90cc('0x10'));var qs=require(_0x90cc('0x11'));var as=require(_0x90cc('0x12'));var hardwareService=require(_0x90cc('0x13'));var logger=require(_0x90cc('0x14'))(_0x90cc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x90cc('0x16'))['db'];function respondWithStatusCode(_0x10d26b,_0x39049b){_0x39049b=_0x39049b||0xcc;return function(_0xc46e0){if(_0xc46e0){return _0x10d26b[_0x90cc('0x17')](_0x39049b);}return _0x10d26b[_0x90cc('0x18')](_0x39049b)['end']();};}function respondWithResult(_0xbcb86a,_0x44c516){_0x44c516=_0x44c516||0xc8;return function(_0xece3c9){if(_0xece3c9){return _0xbcb86a[_0x90cc('0x18')](_0x44c516)[_0x90cc('0x19')](_0xece3c9);}};}function respondWithFilteredResult(_0x3fe5a2,_0x171eef){return function(_0x17766e){if(_0x17766e){var _0x2fb7c2=_0x17766e[_0x90cc('0x1a')],_0x3bb61c=_0x171eef[_0x90cc('0x1b')],_0x353ce9=_0x171eef[_0x90cc('0x1b')]+_0x171eef['limit'],_0x25ad66;if(_0x353ce9>=_0x2fb7c2){_0x353ce9=_0x2fb7c2;_0x25ad66=0xc8;}else{_0x25ad66=0xce;}_0x3fe5a2[_0x90cc('0x18')](_0x25ad66);return _0x3fe5a2[_0x90cc('0x1c')](_0x90cc('0x1d'),_0x3bb61c+'-'+_0x353ce9+'/'+_0x2fb7c2)[_0x90cc('0x19')](_0x17766e);}return null;};}function patchUpdates(_0x59a000){return function(_0xe604d1){try{jsonpatch[_0x90cc('0x1e')](_0xe604d1,_0x59a000,!![]);}catch(_0x579d2a){return BPromise['reject'](_0x579d2a);}return _0xe604d1[_0x90cc('0x1f')]();};}function saveUpdates(_0x221261,_0x518ee9){return function(_0x2792fc){if(_0x2792fc){return _0x2792fc['update'](_0x221261)['then'](function(_0xd03e1f){return _0xd03e1f;});}return null;};}function removeEntity(_0x2505e2,_0x32b921){return function(_0x4f55e4){if(_0x4f55e4){return _0x4f55e4[_0x90cc('0x20')]()[_0x90cc('0x21')](function(){_0x2505e2[_0x90cc('0x18')](0xcc)[_0x90cc('0x22')]();});}};}function handleEntityNotFound(_0x2939bd,_0x3a235a){return function(_0x387582){if(!_0x387582){_0x2939bd[_0x90cc('0x17')](0x194);}return _0x387582;};}function handleError(_0x2748f1,_0x1d8d1d){_0x1d8d1d=_0x1d8d1d||0x1f4;return function(_0x1bf94f){logger[_0x90cc('0x23')](_0x1bf94f[_0x90cc('0x24')]);if(_0x1bf94f['name']){delete _0x1bf94f[_0x90cc('0x25')];}_0x2748f1['status'](_0x1d8d1d)[_0x90cc('0x26')](_0x1bf94f);};}exports[_0x90cc('0x27')]=function(_0x204441,_0xfd2f97){var _0x1b5b75={},_0xfef256={},_0x1f4a01={'count':0x0,'rows':[]};var _0x762f81=_[_0x90cc('0x28')](db['VoiceQueuesLog'][_0x90cc('0x29')],function(_0x4a5ebe){return{'name':_0x4a5ebe['fieldName'],'type':_0x4a5ebe[_0x90cc('0x2a')][_0x90cc('0x2b')]};});_0xfef256[_0x90cc('0x2c')]=_['map'](_0x762f81,_0x90cc('0x25'));_0xfef256[_0x90cc('0x2d')]=_[_0x90cc('0x2e')](_0x204441[_0x90cc('0x2d')]);_0xfef256['filters']=_[_0x90cc('0x2f')](_0xfef256[_0x90cc('0x2c')],_0xfef256['query']);_0x1b5b75[_0x90cc('0x30')]=_['intersection'](_0xfef256[_0x90cc('0x2c')],qs['fields'](_0x204441[_0x90cc('0x2d')]['fields']));_0x1b5b75[_0x90cc('0x30')]=_0x1b5b75[_0x90cc('0x30')][_0x90cc('0x31')]?_0x1b5b75[_0x90cc('0x30')]:_0xfef256['model'];if(!_0x204441[_0x90cc('0x2d')][_0x90cc('0x32')](_0x90cc('0x33'))){_0x1b5b75[_0x90cc('0x34')]=qs['limit'](_0x204441['query'][_0x90cc('0x34')]);_0x1b5b75[_0x90cc('0x1b')]=qs[_0x90cc('0x1b')](_0x204441[_0x90cc('0x2d')][_0x90cc('0x1b')]);}_0x1b5b75[_0x90cc('0x35')]=qs[_0x90cc('0x36')](_0x204441[_0x90cc('0x2d')][_0x90cc('0x36')]);_0x1b5b75[_0x90cc('0x37')]=qs['filters'](_[_0x90cc('0x38')](_0x204441[_0x90cc('0x2d')],_0xfef256[_0x90cc('0x39')]),_0x762f81);if(_0x204441[_0x90cc('0x2d')][_0x90cc('0x3a')]){_0x1b5b75[_0x90cc('0x37')]=_[_0x90cc('0x3b')](_0x1b5b75[_0x90cc('0x37')],{'$or':_['map'](_0x762f81,function(_0x4a3041){if(_0x4a3041['type']!=='VIRTUAL'){var _0x6bc17a={};_0x6bc17a[_0x4a3041[_0x90cc('0x25')]]={'$like':'%'+_0x204441[_0x90cc('0x2d')]['filter']+'%'};return _0x6bc17a;}})});}_0x1b5b75=_[_0x90cc('0x3b')]({},_0x1b5b75,_0x204441[_0x90cc('0x3c')]);var _0x400a67={'where':_0x1b5b75['where']};return db[_0x90cc('0x3d')]['count'](_0x400a67)['then'](function(_0x20be7f){_0x1f4a01['count']=_0x20be7f;if(_0x204441[_0x90cc('0x2d')][_0x90cc('0x3e')]){_0x1b5b75[_0x90cc('0x3f')]=[{'all':!![]}];}return db[_0x90cc('0x3d')][_0x90cc('0x40')](_0x1b5b75);})[_0x90cc('0x21')](function(_0x440d68){_0x1f4a01['rows']=_0x440d68;return _0x1f4a01;})[_0x90cc('0x21')](respondWithFilteredResult(_0xfd2f97,_0x1b5b75))[_0x90cc('0x41')](handleError(_0xfd2f97,null));};exports[_0x90cc('0x42')]=function(_0x3b4471,_0x26bd91){var _0x3d297d={'raw':!![],'where':{'id':_0x3b4471[_0x90cc('0x43')]['id']}},_0x257e33={};_0x257e33[_0x90cc('0x2c')]=_[_0x90cc('0x2e')](db['VoiceQueuesLog']['rawAttributes']);_0x257e33[_0x90cc('0x2d')]=_['keys'](_0x3b4471[_0x90cc('0x2d')]);_0x257e33['filters']=_['intersection'](_0x257e33[_0x90cc('0x2c')],_0x257e33[_0x90cc('0x2d')]);_0x3d297d[_0x90cc('0x30')]=_[_0x90cc('0x2f')](_0x257e33[_0x90cc('0x2c')],qs[_0x90cc('0x44')](_0x3b4471[_0x90cc('0x2d')][_0x90cc('0x44')]));_0x3d297d[_0x90cc('0x30')]=_0x3d297d[_0x90cc('0x30')]['length']?_0x3d297d[_0x90cc('0x30')]:_0x257e33[_0x90cc('0x2c')];if(_0x3b4471[_0x90cc('0x2d')][_0x90cc('0x3e')]){_0x3d297d[_0x90cc('0x3f')]=[{'all':!![]}];}_0x3d297d=_[_0x90cc('0x3b')]({},_0x3d297d,_0x3b4471[_0x90cc('0x3c')]);return db['VoiceQueuesLog'][_0x90cc('0x45')](_0x3d297d)[_0x90cc('0x21')](handleEntityNotFound(_0x26bd91,null))[_0x90cc('0x21')](respondWithResult(_0x26bd91,null))[_0x90cc('0x41')](handleError(_0x26bd91,null));};exports[_0x90cc('0x46')]=function(_0x56c5e6,_0x4cfc52){return db[_0x90cc('0x3d')]['create'](_0x56c5e6['body'],{})[_0x90cc('0x21')](respondWithResult(_0x4cfc52,0xc9))[_0x90cc('0x41')](handleError(_0x4cfc52,null));};exports[_0x90cc('0x47')]=function(_0x227500,_0x5db513){if(_0x227500[_0x90cc('0x48')]['id']){delete _0x227500[_0x90cc('0x48')]['id'];}return db[_0x90cc('0x3d')]['find']({'where':{'id':_0x227500[_0x90cc('0x43')]['id']}})[_0x90cc('0x21')](handleEntityNotFound(_0x5db513,null))[_0x90cc('0x21')](saveUpdates(_0x227500[_0x90cc('0x48')],null))[_0x90cc('0x21')](respondWithResult(_0x5db513,null))['catch'](handleError(_0x5db513,null));};exports[_0x90cc('0x20')]=function(_0xf0ad67,_0x367cf3){return db[_0x90cc('0x3d')][_0x90cc('0x45')]({'where':{'id':_0xf0ad67[_0x90cc('0x43')]['id']}})[_0x90cc('0x21')](handleEntityNotFound(_0x367cf3,null))[_0x90cc('0x21')](removeEntity(_0x367cf3,null))[_0x90cc('0x41')](handleError(_0x367cf3,null));}; \ No newline at end of file +var _0x8fc9=['sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','merge','options','find','create','body','html-pdf','eml-format','rimraf','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x377c86,_0x1cb418){var _0x1562f4=function(_0x5c5864){while(--_0x5c5864){_0x377c86['push'](_0x377c86['shift']());}};_0x1562f4(++_0x1cb418);}(_0x8fc9,0x152));var _0x98fc=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x8fc9[_0x2892da];return _0x28cff2;};'use strict';var pdf=require(_0x98fc('0x0'));var emlformat=require(_0x98fc('0x1'));var rimraf=require(_0x98fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x98fc('0x3'));var util=require(_0x98fc('0x4'));var path=require(_0x98fc('0x5'));var sox=require('sox');var csv=require(_0x98fc('0x6'));var ejs=require(_0x98fc('0x7'));var fs=require('fs');var _=require(_0x98fc('0x8'));var squel=require(_0x98fc('0x9'));var crypto=require(_0x98fc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x98fc('0xb'));var toCsv=require(_0x98fc('0x6'));var querystring=require('querystring');var Papa=require(_0x98fc('0xc'));var Redis=require(_0x98fc('0xd'));var authService=require(_0x98fc('0xe'));var qs=require(_0x98fc('0xf'));var as=require(_0x98fc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98fc('0x11'))('api');var utils=require(_0x98fc('0x12'));var config=require(_0x98fc('0x13'));var licenseUtil=require(_0x98fc('0x14'));var db=require(_0x98fc('0x15'))['db'];function respondWithStatusCode(_0x4db530,_0x3d02fc){_0x3d02fc=_0x3d02fc||0xcc;return function(_0x4f56be){if(_0x4f56be){return _0x4db530[_0x98fc('0x16')](_0x3d02fc);}return _0x4db530[_0x98fc('0x17')](_0x3d02fc)['end']();};}function respondWithResult(_0x1b3eed,_0x304d2c){_0x304d2c=_0x304d2c||0xc8;return function(_0x33b893){if(_0x33b893){return _0x1b3eed[_0x98fc('0x17')](_0x304d2c)['json'](_0x33b893);}};}function respondWithFilteredResult(_0x1e057d,_0x11fd6e){return function(_0x47f1a0){if(_0x47f1a0){var _0x5d0568=_0x47f1a0[_0x98fc('0x18')],_0x45144d=_0x11fd6e[_0x98fc('0x19')],_0x55739c=_0x11fd6e[_0x98fc('0x19')]+_0x11fd6e[_0x98fc('0x1a')],_0x1ce532;if(_0x55739c>=_0x5d0568){_0x55739c=_0x5d0568;_0x1ce532=0xc8;}else{_0x1ce532=0xce;}_0x1e057d[_0x98fc('0x17')](_0x1ce532);return _0x1e057d[_0x98fc('0x1b')](_0x98fc('0x1c'),_0x45144d+'-'+_0x55739c+'/'+_0x5d0568)[_0x98fc('0x1d')](_0x47f1a0);}return null;};}function patchUpdates(_0x4881f7){return function(_0x3026a6){try{jsonpatch[_0x98fc('0x1e')](_0x3026a6,_0x4881f7,!![]);}catch(_0x5a5410){return BPromise['reject'](_0x5a5410);}return _0x3026a6[_0x98fc('0x1f')]();};}function saveUpdates(_0x29cd9a,_0x3a1882){return function(_0x23d773){if(_0x23d773){return _0x23d773[_0x98fc('0x20')](_0x29cd9a)[_0x98fc('0x21')](function(_0x46169d){return _0x46169d;});}return null;};}function removeEntity(_0x4c258f,_0x58d426){return function(_0x2decff){if(_0x2decff){return _0x2decff[_0x98fc('0x22')]()[_0x98fc('0x21')](function(){_0x4c258f[_0x98fc('0x17')](0xcc)[_0x98fc('0x23')]();});}};}function handleEntityNotFound(_0x5dbe38,_0x1040b7){return function(_0x145996){if(!_0x145996){_0x5dbe38[_0x98fc('0x16')](0x194);}return _0x145996;};}function handleError(_0x35a95c,_0x4ea810){_0x4ea810=_0x4ea810||0x1f4;return function(_0x41fe33){logger[_0x98fc('0x24')](_0x41fe33[_0x98fc('0x25')]);if(_0x41fe33[_0x98fc('0x26')]){delete _0x41fe33[_0x98fc('0x26')];}_0x35a95c[_0x98fc('0x17')](_0x4ea810)['send'](_0x41fe33);};}exports[_0x98fc('0x27')]=function(_0xef0c9a,_0xdb4bc6){var _0x40d997={},_0x46dd47={},_0x4e869f={'count':0x0,'rows':[]};var _0x386803=_[_0x98fc('0x28')](db[_0x98fc('0x29')]['rawAttributes'],function(_0x32623c){return{'name':_0x32623c[_0x98fc('0x2a')],'type':_0x32623c[_0x98fc('0x2b')][_0x98fc('0x2c')]};});_0x46dd47[_0x98fc('0x2d')]=_[_0x98fc('0x28')](_0x386803,_0x98fc('0x26'));_0x46dd47[_0x98fc('0x2e')]=_[_0x98fc('0x2f')](_0xef0c9a[_0x98fc('0x2e')]);_0x46dd47[_0x98fc('0x30')]=_['intersection'](_0x46dd47['model'],_0x46dd47['query']);_0x40d997[_0x98fc('0x31')]=_[_0x98fc('0x32')](_0x46dd47[_0x98fc('0x2d')],qs['fields'](_0xef0c9a[_0x98fc('0x2e')][_0x98fc('0x33')]));_0x40d997[_0x98fc('0x31')]=_0x40d997['attributes'][_0x98fc('0x34')]?_0x40d997[_0x98fc('0x31')]:_0x46dd47[_0x98fc('0x2d')];if(!_0xef0c9a[_0x98fc('0x2e')]['hasOwnProperty'](_0x98fc('0x35'))){_0x40d997[_0x98fc('0x1a')]=qs[_0x98fc('0x1a')](_0xef0c9a[_0x98fc('0x2e')]['limit']);_0x40d997[_0x98fc('0x19')]=qs['offset'](_0xef0c9a[_0x98fc('0x2e')][_0x98fc('0x19')]);}_0x40d997[_0x98fc('0x36')]=qs[_0x98fc('0x37')](_0xef0c9a[_0x98fc('0x2e')]['sort']);_0x40d997[_0x98fc('0x38')]=qs[_0x98fc('0x30')](_[_0x98fc('0x39')](_0xef0c9a[_0x98fc('0x2e')],_0x46dd47[_0x98fc('0x30')]),_0x386803);if(_0xef0c9a[_0x98fc('0x2e')][_0x98fc('0x3a')]){_0x40d997[_0x98fc('0x38')]=_['merge'](_0x40d997[_0x98fc('0x38')],{'$or':_['map'](_0x386803,function(_0xbfc88c){if(_0xbfc88c[_0x98fc('0x2b')]!==_0x98fc('0x3b')){var _0x4c3bcb={};_0x4c3bcb[_0xbfc88c['name']]={'$like':'%'+_0xef0c9a[_0x98fc('0x2e')][_0x98fc('0x3a')]+'%'};return _0x4c3bcb;}})});}_0x40d997=_['merge']({},_0x40d997,_0xef0c9a['options']);var _0x45e532={'where':_0x40d997[_0x98fc('0x38')]};return db['VoiceQueuesLog'][_0x98fc('0x18')](_0x45e532)[_0x98fc('0x21')](function(_0x5c15b0){_0x4e869f[_0x98fc('0x18')]=_0x5c15b0;if(_0xef0c9a[_0x98fc('0x2e')][_0x98fc('0x3c')]){_0x40d997[_0x98fc('0x3d')]=[{'all':!![]}];}return db[_0x98fc('0x29')][_0x98fc('0x3e')](_0x40d997);})[_0x98fc('0x21')](function(_0x11621c){_0x4e869f['rows']=_0x11621c;return _0x4e869f;})['then'](respondWithFilteredResult(_0xdb4bc6,_0x40d997))[_0x98fc('0x3f')](handleError(_0xdb4bc6,null));};exports[_0x98fc('0x40')]=function(_0x29504b,_0x3ced2f){var _0x3f2f54={'raw':!![],'where':{'id':_0x29504b[_0x98fc('0x41')]['id']}},_0x5234e7={};_0x5234e7['model']=_[_0x98fc('0x2f')](db[_0x98fc('0x29')][_0x98fc('0x42')]);_0x5234e7[_0x98fc('0x2e')]=_[_0x98fc('0x2f')](_0x29504b['query']);_0x5234e7['filters']=_[_0x98fc('0x32')](_0x5234e7['model'],_0x5234e7['query']);_0x3f2f54[_0x98fc('0x31')]=_['intersection'](_0x5234e7['model'],qs[_0x98fc('0x33')](_0x29504b[_0x98fc('0x2e')][_0x98fc('0x33')]));_0x3f2f54[_0x98fc('0x31')]=_0x3f2f54['attributes'][_0x98fc('0x34')]?_0x3f2f54[_0x98fc('0x31')]:_0x5234e7[_0x98fc('0x2d')];if(_0x29504b[_0x98fc('0x2e')][_0x98fc('0x3c')]){_0x3f2f54[_0x98fc('0x3d')]=[{'all':!![]}];}_0x3f2f54=_[_0x98fc('0x43')]({},_0x3f2f54,_0x29504b[_0x98fc('0x44')]);return db[_0x98fc('0x29')][_0x98fc('0x45')](_0x3f2f54)['then'](handleEntityNotFound(_0x3ced2f,null))[_0x98fc('0x21')](respondWithResult(_0x3ced2f,null))[_0x98fc('0x3f')](handleError(_0x3ced2f,null));};exports[_0x98fc('0x46')]=function(_0x396d25,_0x31350e){return db[_0x98fc('0x29')]['create'](_0x396d25[_0x98fc('0x47')],{})[_0x98fc('0x21')](respondWithResult(_0x31350e,0xc9))[_0x98fc('0x3f')](handleError(_0x31350e,null));};exports[_0x98fc('0x20')]=function(_0x55075a,_0x46f634){if(_0x55075a['body']['id']){delete _0x55075a[_0x98fc('0x47')]['id'];}return db[_0x98fc('0x29')][_0x98fc('0x45')]({'where':{'id':_0x55075a[_0x98fc('0x41')]['id']}})['then'](handleEntityNotFound(_0x46f634,null))[_0x98fc('0x21')](saveUpdates(_0x55075a[_0x98fc('0x47')],null))[_0x98fc('0x21')](respondWithResult(_0x46f634,null))[_0x98fc('0x3f')](handleError(_0x46f634,null));};exports[_0x98fc('0x22')]=function(_0x10d44c,_0x2c006b){return db[_0x98fc('0x29')][_0x98fc('0x45')]({'where':{'id':_0x10d44c['params']['id']}})[_0x98fc('0x21')](handleEntityNotFound(_0x2c006b,null))[_0x98fc('0x21')](removeEntity(_0x2c006b,null))[_0x98fc('0x3f')](handleError(_0x2c006b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 998d3c6..454145f 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 _0xf16b=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b1ca9,_0x10435a){var _0x32c019=function(_0x3989d8){while(--_0x3989d8){_0x2b1ca9['push'](_0x2b1ca9['shift']());}};_0x32c019(++_0x10435a);}(_0xf16b,0xe9));var _0xbf16=function(_0x2e4381,_0x5cee0d){_0x2e4381=_0x2e4381-0x0;var _0x2aef25=_0xf16b[_0x2e4381];return _0x2aef25;};'use strict';var _=require(_0xbf16('0x0'));var util=require('util');var logger=require(_0xbf16('0x1'))(_0xbf16('0x2'));var moment=require(_0xbf16('0x3'));var BPromise=require(_0xbf16('0x4'));var rp=require(_0xbf16('0x5'));var fs=require('fs');var path=require(_0xbf16('0x6'));var rimraf=require(_0xbf16('0x7'));var config=require(_0xbf16('0x8'));var attributes=require(_0xbf16('0x9'));module[_0xbf16('0xa')]=function(_0x206108,_0x5d1e87){return _0x206108[_0xbf16('0xb')]('VoiceQueuesLog',attributes,{'tableName':_0xbf16('0xc'),'paranoid':![],'indexes':[{'name':_0xbf16('0xd'),'fields':[_0xbf16('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x0611=['request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0611,0x73));var _0x1061=function(_0x143238,_0x27c705){_0x143238=_0x143238-0x0;var _0x157b0b=_0x0611[_0x143238];return _0x157b0b;};'use strict';var _=require(_0x1061('0x0'));var util=require('util');var logger=require(_0x1061('0x1'))(_0x1061('0x2'));var moment=require(_0x1061('0x3'));var BPromise=require(_0x1061('0x4'));var rp=require(_0x1061('0x5'));var fs=require('fs');var path=require(_0x1061('0x6'));var rimraf=require(_0x1061('0x7'));var config=require(_0x1061('0x8'));var attributes=require(_0x1061('0x9'));module['exports']=function(_0x2d7cf1,_0x1bf3c7){return _0x2d7cf1[_0x1061('0xa')](_0x1061('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x1061('0xc'),'fields':[_0x1061('0xd'),_0x1061('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b18287d..6fc0def 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 _0x4e81=['VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x40e3a9,_0x3bf968){var _0x2ccb91=function(_0x2ba2eb){while(--_0x2ba2eb){_0x40e3a9['push'](_0x40e3a9['shift']());}};_0x2ccb91(++_0x3bf968);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x4e81[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});} \ No newline at end of file +var _0x3070=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x1e52cb,_0x1f9dc4){var _0x259b73=function(_0x1c3c6c){while(--_0x1c3c6c){_0x1e52cb['push'](_0x1e52cb['shift']());}};_0x259b73(++_0x1f9dc4);}(_0x3070,0x75));var _0x0307=function(_0x211cd4,_0x35a5ce){_0x211cd4=_0x211cd4-0x0;var _0x424ad5=_0x3070[_0x211cd4];return _0x424ad5;};'use strict';var _=require('lodash');var util=require(_0x0307('0x0'));var moment=require('moment');var BPromise=require(_0x0307('0x1'));var rs=require(_0x0307('0x2'));var fs=require('fs');var Redis=require(_0x0307('0x3'));var db=require(_0x0307('0x4'))['db'];var utils=require(_0x0307('0x5'));var logger=require(_0x0307('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0307('0x7'));var client=jayson[_0x0307('0x8')][_0x0307('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc1dc51,_0x4fbe3e,_0x3ecfb6){return new BPromise(function(_0x41e638,_0x53e6b7){return client[_0x0307('0xa')](_0xc1dc51,_0x3ecfb6)[_0x0307('0xb')](function(_0x187fb3){logger[_0x0307('0xc')](_0x0307('0xd'),_0x4fbe3e,_0x0307('0xe'));logger[_0x0307('0xf')](_0x0307('0x10'),_0x4fbe3e,_0x0307('0xe'),JSON['stringify'](_0x187fb3));if(_0x187fb3[_0x0307('0x11')]){if(_0x187fb3['error'][_0x0307('0x12')]===0x1f4){logger[_0x0307('0x11')](_0x0307('0xd'),_0x4fbe3e,_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);return _0x53e6b7(_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);}logger[_0x0307('0x11')](_0x0307('0xd'),_0x4fbe3e,_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);return _0x41e638(_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);}else{logger[_0x0307('0xc')](_0x0307('0xd'),_0x4fbe3e,'request\x20sent');_0x41e638(_0x187fb3[_0x0307('0x14')][_0x0307('0x13')]);}})[_0x0307('0x15')](function(_0x5f11a5){logger['error'](_0x0307('0xd'),_0x4fbe3e,_0x5f11a5);_0x53e6b7(_0x5f11a5);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 52142df..35cc463 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 _0x49d5=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceRecording.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','downloads'];(function(_0x49a6ed,_0x5507b2){var _0x365e7d=function(_0x55fca7){while(--_0x55fca7){_0x49a6ed['push'](_0x49a6ed['shift']());}};_0x365e7d(++_0x5507b2);}(_0x49d5,0x169));var _0x549d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x49d5[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x549d('0x0'));var util=require(_0x549d('0x1'));var path=require(_0x549d('0x2'));var timeout=require(_0x549d('0x3'));var express=require(_0x549d('0x4'));var router=express[_0x549d('0x5')]();var auth=require(_0x549d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x549d('0x7'));router[_0x549d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x549d('0x8')](_0x549d('0x9'),auth['isAuthenticated'](),controller[_0x549d('0xa')]);router[_0x549d('0x8')](_0x549d('0xb'),auth[_0x549d('0xc')](),controller[_0x549d('0xd')]);router['get'](_0x549d('0xe'),auth[_0x549d('0xc')](),controller[_0x549d('0xf')]);router[_0x549d('0x8')]('/:id/downloads',controller[_0x549d('0x10')]);router[_0x549d('0x8')](_0x549d('0x11'),auth['isAuthenticated'](),controller[_0x549d('0x12')]);router[_0x549d('0x13')]('/',auth[_0x549d('0xc')](),controller[_0x549d('0x14')]);router[_0x549d('0x13')]('/:id/transcribe',auth[_0x549d('0xc')](),controller[_0x549d('0x15')]);router[_0x549d('0x16')](_0x549d('0xb'),auth[_0x549d('0xc')](),controller[_0x549d('0x17')]);router[_0x549d('0x18')](_0x549d('0xb'),auth[_0x549d('0xc')](),controller[_0x549d('0x19')]);module[_0x549d('0x1a')]=router; \ No newline at end of file +var _0x2aff=['downloadTranscribe','post','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe'];(function(_0x334516,_0x324982){var _0x403802=function(_0x24fce0){while(--_0x24fce0){_0x334516['push'](_0x334516['shift']());}};_0x403802(++_0x324982);}(_0x2aff,0xbd));var _0xf2af=function(_0x50a7ec,_0x1b7a84){_0x50a7ec=_0x50a7ec-0x0;var _0x57976c=_0x2aff[_0x50a7ec];return _0x57976c;};'use strict';var multer=require('multer');var util=require(_0xf2af('0x0'));var path=require(_0xf2af('0x1'));var timeout=require(_0xf2af('0x2'));var express=require(_0xf2af('0x3'));var router=express[_0xf2af('0x4')]();var auth=require(_0xf2af('0x5'));var interaction=require(_0xf2af('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf2af('0x7')]);router[_0xf2af('0x8')](_0xf2af('0x9'),auth[_0xf2af('0xa')](),controller[_0xf2af('0xb')]);router[_0xf2af('0x8')](_0xf2af('0xc'),auth['isAuthenticated'](),controller[_0xf2af('0xd')]);router[_0xf2af('0x8')](_0xf2af('0xe'),auth[_0xf2af('0xa')](),controller[_0xf2af('0xf')]);router[_0xf2af('0x8')](_0xf2af('0x10'),controller['downloads']);router[_0xf2af('0x8')](_0xf2af('0x11'),auth[_0xf2af('0xa')](),controller[_0xf2af('0x12')]);router['post']('/',auth[_0xf2af('0xa')](),controller['create']);router[_0xf2af('0x13')](_0xf2af('0x11'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0xf2af('0x14')](_0xf2af('0xc'),auth[_0xf2af('0xa')](),controller['update']);router[_0xf2af('0x15')](_0xf2af('0xc'),auth['isAuthenticated'](),controller[_0xf2af('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5ce3604..e1cc1ef 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 _0x275e=['path','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','channel','split','INTEGER','TEXT','NEW','FLOAT','DATE','toString','updatedAt','MM-DD-YYYY\x20HH:mm'];(function(_0x5e037d,_0x2cdbe9){var _0x4ebab3=function(_0x25d312){while(--_0x25d312){_0x5e037d['push'](_0x5e037d['shift']());}};_0x4ebab3(++_0x2cdbe9);}(_0x275e,0x17a));var _0xe275=function(_0x2b47c1,_0x993abd){_0x2b47c1=_0x2b47c1-0x0;var _0x21be84=_0x275e[_0x2b47c1];return _0x21be84;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xe275('0x0'));module[_0xe275('0x1')]={'format':{'type':Sequelize[_0xe275('0x2')],'get':function(){return this['getDataValue'](_0xe275('0x3'))?path[_0xe275('0x4')](this[_0xe275('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xe275('0x6')]},'channel':{'type':Sequelize[_0xe275('0x6')],'set':function(_0x2e3795){if(_0x2e3795){this[_0xe275('0x7')](_0xe275('0x8'),_0x2e3795);this['setDataValue']('membername',_0x2e3795[_0xe275('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe275('0x6')]},'calleridnum':{'type':Sequelize[_0xe275('0x6')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe275('0x6')]},'connectedlinename':{'type':Sequelize[_0xe275('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe275('0x6')]},'value':{'type':Sequelize[_0xe275('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xe275('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe275('0x6')]},'userDisposition':{'type':Sequelize[_0xe275('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xe275('0x6')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xe275('0xb')]},'transcribeName':{'type':Sequelize[_0xe275('0x6')]},'transcribeStatus':{'type':Sequelize[_0xe275('0x6')],'defaultValue':_0xe275('0xc')},'fileUri':{'type':Sequelize[_0xe275('0xb')]},'fileText':{'type':Sequelize[_0xe275('0xb')]},'failureReason':{'type':Sequelize[_0xe275('0xb')]},'sentiment':{'type':Sequelize[_0xe275('0x6')]},'sPositive':{'type':Sequelize[_0xe275('0xd')]},'sNegative':{'type':Sequelize[_0xe275('0xd')]},'sNeutral':{'type':Sequelize[_0xe275('0xd')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xe275('0xe')],'get':function(){return moment(this[_0xe275('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xe275('0xf')]();}},'updatedAt':{'type':Sequelize[_0xe275('0xe')],'get':function(){return moment(this[_0xe275('0x5')](_0xe275('0x10')))['format'](_0xe275('0x11'))['toString']();}}}; \ No newline at end of file +var _0x7cc8=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','membername','split','INTEGER','NEW','TEXT','FLOAT','BOOLEAN'];(function(_0x33794a,_0x4a1770){var _0x3f3612=function(_0x4521e6){while(--_0x4521e6){_0x33794a['push'](_0x33794a['shift']());}};_0x3f3612(++_0x4a1770);}(_0x7cc8,0x101));var _0x87cc=function(_0x19876f,_0x42774e){_0x19876f=_0x19876f-0x0;var _0x32a19a=_0x7cc8[_0x19876f];return _0x32a19a;};'use strict';var Sequelize=require(_0x87cc('0x0'));var moment=require(_0x87cc('0x1'));var path=require('path');module[_0x87cc('0x2')]={'format':{'type':Sequelize[_0x87cc('0x3')],'get':function(){return this[_0x87cc('0x4')](_0x87cc('0x5'))?path['extname'](this[_0x87cc('0x4')](_0x87cc('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x87cc('0x6')],'set':function(_0x1f9583){if(_0x1f9583){this[_0x87cc('0x7')](_0x87cc('0x8'),_0x1f9583);this[_0x87cc('0x7')](_0x87cc('0x9'),_0x1f9583[_0x87cc('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x87cc('0x6')]},'calleridnum':{'type':Sequelize[_0x87cc('0x6')]},'calleridname':{'type':Sequelize[_0x87cc('0x6')]},'connectedlinenum':{'type':Sequelize[_0x87cc('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x87cc('0x6')]},'context':{'type':Sequelize[_0x87cc('0x6')]},'exten':{'type':Sequelize[_0x87cc('0x6')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x87cc('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x87cc('0x6')]},'userDisposition':{'type':Sequelize[_0x87cc('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x87cc('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x87cc('0x6')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x87cc('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x87cc('0xc')},'fileUri':{'type':Sequelize[_0x87cc('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x87cc('0xd')]},'sentiment':{'type':Sequelize[_0x87cc('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x87cc('0xe')]},'sNeutral':{'type':Sequelize[_0x87cc('0xe')]},'sMixed':{'type':Sequelize[_0x87cc('0xe')]},'tempSentiment':{'type':Sequelize[_0x87cc('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x87cc('0x10')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x87cc('0x11')](_0x87cc('0x12'))[_0x87cc('0x13')]();}},'updatedAt':{'type':Sequelize[_0x87cc('0x10')],'get':function(){return moment(this[_0x87cc('0x4')](_0x87cc('0x14')))[_0x87cc('0x11')](_0x87cc('0x12'))[_0x87cc('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index ba62081..1ed06e8 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 _0xf55c=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','IN_PROGRESS','tempSentiment','runSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','end','count','offset','status','Content-Range','json','save','update','then','sendStatus','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','query','keys','attributes','model','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','describe','download','type','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','send','Not\x20found','../../components/encryptor','sequelize','MD5','push','$and','extname','destroy','Entity\x20not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion'];(function(_0x4ff191,_0xd1f046){var _0x4ff56b=function(_0xf334e5){while(--_0xf334e5){_0x4ff191['push'](_0x4ff191['shift']());}};_0x4ff56b(++_0xd1f046);}(_0xf55c,0x1cb));var _0xcf55=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xf55c[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0xcf55('0x0'));var emlformat=require(_0xcf55('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcf55('0x2'));var jsonpatch=require(_0xcf55('0x3'));var rp=require(_0xcf55('0x4'));var moment=require(_0xcf55('0x5'));var BPromise=require(_0xcf55('0x6'));var Mustache=require(_0xcf55('0x7'));var util=require(_0xcf55('0x8'));var path=require(_0xcf55('0x9'));var sox=require('sox');var csv=require(_0xcf55('0xa'));var ejs=require(_0xcf55('0xb'));var fs=require('fs');var _=require(_0xcf55('0xc'));var squel=require(_0xcf55('0xd'));var crypto=require(_0xcf55('0xe'));var jsforce=require(_0xcf55('0xf'));var deskjs=require(_0xcf55('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcf55('0x11'));var Papa=require(_0xcf55('0x12'));var AWS=require(_0xcf55('0x13'));var uuidv4=require(_0xcf55('0x14'));var Redis=require(_0xcf55('0x15'));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(_0xcf55('0x16'))(_0xcf55('0x17'));var utils=require(_0xcf55('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcf55('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15642c,_0x918aee){_0x918aee=_0x918aee||0xcc;return function(_0x19f2d1){if(_0x19f2d1){return _0x15642c['sendStatus'](_0x918aee);}return _0x15642c['status'](_0x918aee)[_0xcf55('0x1a')]();};}function respondWithResult(_0x222823,_0x507414){_0x507414=_0x507414||0xc8;return function(_0x45ddf7){if(_0x45ddf7){return _0x222823['status'](_0x507414)['json'](_0x45ddf7);}};}function respondWithFilteredResult(_0x2d04de,_0x44426d){return function(_0x5abf9d){if(_0x5abf9d){var _0x10f1a6=_0x5abf9d[_0xcf55('0x1b')],_0x916692=_0x44426d['offset'],_0x3dbd6c=_0x44426d[_0xcf55('0x1c')]+_0x44426d['limit'],_0x2ae025;if(_0x3dbd6c>=_0x10f1a6){_0x3dbd6c=_0x10f1a6;_0x2ae025=0xc8;}else{_0x2ae025=0xce;}_0x2d04de[_0xcf55('0x1d')](_0x2ae025);return _0x2d04de['set'](_0xcf55('0x1e'),_0x916692+'-'+_0x3dbd6c+'/'+_0x10f1a6)[_0xcf55('0x1f')](_0x5abf9d);}return null;};}function patchUpdates(_0x4e997e){return function(_0x5a31c0){try{jsonpatch['apply'](_0x5a31c0,_0x4e997e,!![]);}catch(_0x2812ff){return BPromise['reject'](_0x2812ff);}return _0x5a31c0[_0xcf55('0x20')]();};}function saveUpdates(_0x4de1ff,_0x16ec6b){return function(_0x5c5ab9){if(_0x5c5ab9){return _0x5c5ab9[_0xcf55('0x21')](_0x4de1ff)[_0xcf55('0x22')](function(_0x18477a){return _0x18477a;});}return null;};}function removeEntity(_0x1235f4,_0x546750){return function(_0x1fc6a0){if(_0x1fc6a0){return _0x1fc6a0['destroy']()[_0xcf55('0x22')](function(){_0x1235f4[_0xcf55('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497c13,_0x5ebed0){return function(_0x57c0cd){if(!_0x57c0cd){_0x497c13[_0xcf55('0x23')](0x194);}return _0x57c0cd;};}function handleError(_0x37b2e5,_0x5f58cb){_0x5f58cb=_0x5f58cb||0x1f4;return function(_0x3d2e7c){logger[_0xcf55('0x24')](_0x3d2e7c[_0xcf55('0x25')]);if(_0x3d2e7c[_0xcf55('0x26')]){delete _0x3d2e7c[_0xcf55('0x26')];}_0x37b2e5[_0xcf55('0x1d')](_0x5f58cb)['send'](_0x3d2e7c);};}exports[_0xcf55('0x27')]=function(_0x2d5c5b,_0x15c26b){var _0x3cab78={},_0x2c7e52={},_0x281d47={'count':0x0,'rows':[]};var _0x5dbd8c=_[_0xcf55('0x28')](db[_0xcf55('0x29')][_0xcf55('0x2a')],function(_0x551fc0){return{'name':_0x551fc0[_0xcf55('0x2b')],'type':_0x551fc0['type'][_0xcf55('0x2c')]};});_0x2c7e52['model']=_[_0xcf55('0x2d')](_[_0xcf55('0x28')](_0x5dbd8c,_0xcf55('0x26')),[_0xcf55('0x2e')]);_0x2c7e52[_0xcf55('0x2f')]=_[_0xcf55('0x30')](_0x2d5c5b[_0xcf55('0x2f')]);_0x2c7e52['filters']=_['intersection'](_0x2c7e52['model'],_0x2c7e52['query']);_0x3cab78[_0xcf55('0x31')]=_['intersection'](_0x2c7e52[_0xcf55('0x32')],qs[_0xcf55('0x33')](_0x2d5c5b[_0xcf55('0x2f')][_0xcf55('0x33')]));_0x3cab78[_0xcf55('0x31')]=_0x3cab78['attributes'][_0xcf55('0x34')]?_0x3cab78[_0xcf55('0x31')]:_0x2c7e52[_0xcf55('0x32')];if(!_0x2d5c5b['query']['hasOwnProperty'](_0xcf55('0x35'))){_0x3cab78[_0xcf55('0x36')]=qs['limit'](_0x2d5c5b[_0xcf55('0x2f')][_0xcf55('0x36')]);_0x3cab78['offset']=qs['offset'](_0x2d5c5b[_0xcf55('0x2f')]['offset']);}_0x3cab78[_0xcf55('0x37')]=qs[_0xcf55('0x38')](_0x2d5c5b[_0xcf55('0x2f')][_0xcf55('0x38')]);_0x3cab78[_0xcf55('0x39')]=qs[_0xcf55('0x3a')](_[_0xcf55('0x3b')](_0x2d5c5b['query'],_0x2c7e52[_0xcf55('0x3a')]),_0x5dbd8c);if(_0x2d5c5b['query'][_0xcf55('0x3c')]){_0x3cab78[_0xcf55('0x39')]=_[_0xcf55('0x3d')](_0x3cab78[_0xcf55('0x39')],{'$or':_['map'](_0x5dbd8c,function(_0x2d47a6){if(_0x2d47a6['type']!==_0xcf55('0x3e')){var _0x5dc09e={};_0x5dc09e[_0x2d47a6[_0xcf55('0x26')]]={'$like':'%'+_0x2d5c5b[_0xcf55('0x2f')]['filter']+'%'};return _0x5dc09e;}})});}_0x3cab78=_[_0xcf55('0x3d')]({},_0x3cab78,_0x2d5c5b[_0xcf55('0x3f')]);var _0xc9e4be={'where':_0x3cab78[_0xcf55('0x39')]};return db[_0xcf55('0x29')][_0xcf55('0x1b')](_0xc9e4be)[_0xcf55('0x22')](function(_0x4aecad){_0x281d47[_0xcf55('0x1b')]=_0x4aecad;if(_0x2d5c5b[_0xcf55('0x2f')][_0xcf55('0x40')]){_0x3cab78['include']=[{'all':!![]}];}return db[_0xcf55('0x29')][_0xcf55('0x41')](_0x3cab78);})[_0xcf55('0x22')](function(_0x3a6895){_0x281d47[_0xcf55('0x42')]=_0x3a6895;return _0x281d47;})[_0xcf55('0x22')](respondWithFilteredResult(_0x15c26b,_0x3cab78))[_0xcf55('0x43')](handleError(_0x15c26b,null));};exports[_0xcf55('0x44')]=function(_0x54c7e8,_0x320caf){var _0x517cf5={'raw':![],'where':{'id':_0x54c7e8[_0xcf55('0x45')]['id']}},_0x5b9444={};_0x5b9444[_0xcf55('0x32')]=_[_0xcf55('0x30')](db['VoiceRecording']['rawAttributes']);_0x5b9444[_0xcf55('0x2f')]=_[_0xcf55('0x30')](_0x54c7e8[_0xcf55('0x2f')]);_0x5b9444[_0xcf55('0x3a')]=_[_0xcf55('0x46')](_0x5b9444[_0xcf55('0x32')],_0x5b9444[_0xcf55('0x2f')]);_0x517cf5[_0xcf55('0x31')]=_[_0xcf55('0x46')](_0x5b9444['model'],qs[_0xcf55('0x33')](_0x54c7e8[_0xcf55('0x2f')][_0xcf55('0x33')]));_0x517cf5[_0xcf55('0x31')]=_0x517cf5[_0xcf55('0x31')][_0xcf55('0x34')]?_0x517cf5[_0xcf55('0x31')]:_0x5b9444[_0xcf55('0x32')];if(_0x54c7e8[_0xcf55('0x2f')][_0xcf55('0x40')]){_0x517cf5['include']=[{'all':!![]}];}_0x517cf5=_[_0xcf55('0x3d')]({},_0x517cf5,_0x54c7e8['options']);return db['VoiceRecording'][_0xcf55('0x47')](_0x517cf5)[_0xcf55('0x22')](handleEntityNotFound(_0x320caf,null))[_0xcf55('0x22')](respondWithResult(_0x320caf,null))[_0xcf55('0x43')](handleError(_0x320caf,null));};exports[_0xcf55('0x48')]=function(_0x59a606,_0x542bf7){return db[_0xcf55('0x29')][_0xcf55('0x48')](_0x59a606[_0xcf55('0x49')],{})['then'](respondWithResult(_0x542bf7,0xc9))[_0xcf55('0x43')](handleError(_0x542bf7,null));};exports[_0xcf55('0x21')]=function(_0x25ca18,_0xf8c8b4){if(_0x25ca18[_0xcf55('0x49')]['id']){delete _0x25ca18[_0xcf55('0x49')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x25ca18['params']['id']}})[_0xcf55('0x22')](handleEntityNotFound(_0xf8c8b4,null))['then'](saveUpdates(_0x25ca18[_0xcf55('0x49')],null))[_0xcf55('0x22')](respondWithResult(_0xf8c8b4,null))['catch'](handleError(_0xf8c8b4,null));};exports['describe']=function(_0x202b45,_0x36d864){return db[_0xcf55('0x29')][_0xcf55('0x4a')]()[_0xcf55('0x22')](respondWithResult(_0x36d864,null))[_0xcf55('0x43')](handleError(_0x36d864,null));};exports[_0xcf55('0x4b')]=function(_0x39ea2a,_0x3d086b,_0x47f77f){var _0x2c11ba=require('../../components/encryptor');var _0x13d765=![];var _0x1b772d={};if(_0x39ea2a['query'][_0xcf55('0x4c')]&&_0x39ea2a['query']['type']==='uniqueid'){_0x1b772d[_0xcf55('0x4d')]=_0x39ea2a['params']['id'];}else{_0x1b772d['id']=_0x39ea2a[_0xcf55('0x45')]['id'];}return db['VoiceRecording'][_0xcf55('0x47')]({'where':_0x1b772d,'attributes':['id',_0xcf55('0x4e')],'raw':!![]})[_0xcf55('0x22')](handleEntityNotFound(_0x3d086b,null))['then'](function(_0x5d3302){if(_0x5d3302){var _0x4ece6e=_0x5d3302['value'];var _0x9a3876=util[_0xcf55('0x2e')]('%s.cypher',_0x4ece6e);if(fs[_0xcf55('0x4f')](_0x9a3876)){_0x13d765=!![];return _0x2c11ba[_0xcf55('0x50')](_0x9a3876,_0x4ece6e,config[_0xcf55('0x51')][_0xcf55('0x52')])[_0xcf55('0x22')](function(){return _0x5d3302;});}return _0x5d3302;}})['then'](function(_0x16472b){if(_0x16472b){var _0x138546=_0x16472b['value'];if(!fs['existsSync'](_0x138546)){throw new db[(_0xcf55('0x53'))][(_0xcf55('0x54'))](_0xcf55('0x55'));}if(_0x16472b[_0xcf55('0x56')]){return _0x3d086b['download'](_0x138546,_0x16472b[_0xcf55('0x56')]+path['extname'](_0x138546),function(){if(_0x13d765){fs[_0xcf55('0x57')](_0x138546);}});}else{return _0x3d086b['download'](_0x138546,function(_0x1b185d){if(_0x13d765){fs[_0xcf55('0x57')](_0x138546);}});}}})[_0xcf55('0x43')](function(_0x293580){if(_0x293580['message']===_0xcf55('0x55')){_0x3d086b['status'](0x194)[_0xcf55('0x58')](_0xcf55('0x59'));}else{return handleError(_0x3d086b,null);}});};exports['downloads']=function(_0x584d57,_0x5d27de,_0x51774d){var _0x31c7c9=require(_0xcf55('0x5a'));var _0x4a09a4=![];var _0x328d31={'$and':[db[_0xcf55('0x5b')]['where'](db[_0xcf55('0x5b')]['fn'](_0xcf55('0x5c'),db['sequelize']['col'](_0xcf55('0x4d'))),_0x584d57[_0xcf55('0x2f')]['token'])]};if(_0x584d57[_0xcf55('0x2f')][_0xcf55('0x4c')]&&_0x584d57[_0xcf55('0x2f')]['type']==='uniqueid'){_0x328d31['$and'][_0xcf55('0x5d')]({'uniqueid':_0x584d57[_0xcf55('0x45')]['id']});}else{_0x328d31[_0xcf55('0x5e')][_0xcf55('0x5d')]({'id':_0x584d57['params']['id']});}return db[_0xcf55('0x29')][_0xcf55('0x47')]({'where':_0x328d31,'attributes':['id',_0xcf55('0x4e')],'raw':!![]})[_0xcf55('0x22')](handleEntityNotFound(_0x5d27de,null))[_0xcf55('0x22')](function(_0x458634){if(_0x458634){var _0x5a9e15=util['format']('%s.cypher',_0x458634[_0xcf55('0x4e')]);if(fs[_0xcf55('0x4f')](_0x5a9e15)){_0x4a09a4=!![];return _0x31c7c9[_0xcf55('0x50')](_0x5a9e15,_0x458634['value'],config[_0xcf55('0x51')][_0xcf55('0x52')])[_0xcf55('0x22')](function(){return _0x458634;});}return _0x458634;}})[_0xcf55('0x22')](function(_0x4d0a8f){if(_0x4d0a8f){if(!fs[_0xcf55('0x4f')](_0x4d0a8f[_0xcf55('0x4e')])){throw new db[(_0xcf55('0x53'))][(_0xcf55('0x54'))](_0xcf55('0x55'));}if(_0x4d0a8f['filename']){return _0x5d27de[_0xcf55('0x4b')](_0x4d0a8f[_0xcf55('0x4e')],_0x4d0a8f[_0xcf55('0x56')]+path[_0xcf55('0x5f')](_0x4d0a8f[_0xcf55('0x4e')]),function(){if(_0x4a09a4){fs[_0xcf55('0x57')](_0x4d0a8f['value']);}});}else{return _0x5d27de[_0xcf55('0x4b')](_0x4d0a8f['value'],function(_0x388690){if(_0x4a09a4){fs[_0xcf55('0x57')](_0x4d0a8f[_0xcf55('0x4e')]);}});}}})[_0xcf55('0x43')](handleError(_0x5d27de,null));};exports[_0xcf55('0x60')]=function(_0x3e2988,_0x5be438){return db['VoiceRecording'][_0xcf55('0x47')]({'where':{'id':_0x3e2988[_0xcf55('0x45')]['id']}})['then'](function(_0x5853dc){if(!_0x5853dc)throw new ReferenceError(_0xcf55('0x61'));return _0x5853dc;})[_0xcf55('0x22')](function(_0x42aaeb){var _0x10b789=_0x42aaeb['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x10b789);if(!_[_0xcf55('0x62')](_0x42aaeb[_0xcf55('0x4e')])&&fs[_0xcf55('0x4f')](_0x10b789)){logger[_0xcf55('0x63')](_0xcf55('0x64')+_0x10b789+_0xcf55('0x65'));fs[_0xcf55('0x66')](_0x10b789);}_0x10b789=_0x10b789+_0xcf55('0x67');if(!_[_0xcf55('0x62')](_0x42aaeb[_0xcf55('0x4e')])&&fs['existsSync'](_0x10b789)){logger['info'](_0xcf55('0x64')+_0x10b789+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcf55('0x66')](_0x10b789);}return _0x42aaeb;})[_0xcf55('0x22')](function(_0x2041d1){if(!_0x2041d1)throw new InternalError();return _0x2041d1[_0xcf55('0x60')]();})['then'](function(){_0x5be438[_0xcf55('0x1d')](0xcc)['end']();})[_0xcf55('0x43')](handleError(_0x5be438,null));};function getBucketslist(_0xd077a3,_0x4e6d3f,_0x118dd2){return new Promise(function(_0x466a14,_0x3f23fd){var _0x2f8a8f=new AWS['S3']({'accessKeyId':_0x4e6d3f,'secretAccessKey':_0xd077a3,'region':_0x118dd2});_0x2f8a8f[_0xcf55('0x68')]({},function(_0x160b12,_0x3f2d4c){if(_0x160b12){return _0x3f23fd(_0x160b12);}else{return _0x466a14(_0x3f2d4c);}});});}function createBucket(_0x33422f,_0x21d61e,_0x3acf4f,_0xd22985){return new Promise(function(_0x4f1b0f,_0x2cf5c9){var _0x20d706=new AWS['S3']({'accessKeyId':_0x21d61e,'secretAccessKey':_0x33422f,'region':_0x3acf4f});_0x20d706[_0xcf55('0x69')]({'Bucket':_0xd22985},function(_0x547b3b,_0x5b0960){if(_0x547b3b){return _0x2cf5c9(_0x547b3b);}else{return _0x4f1b0f(_0x5b0960);}});});}function uploadFile(_0x1182e9,_0xfd210a,_0x1086c4,_0x1d8161,_0x5474a9,_0x545067){return new Promise(function(_0x200adc,_0x35483d){var _0x717f9d=new AWS['S3']({'accessKeyId':_0xfd210a,'secretAccessKey':_0x1182e9,'region':_0x1086c4});_0x717f9d[_0xcf55('0x6a')]({'Bucket':_0x1d8161,'Key':_0x5474a9,'Body':_0x545067},function(_0x56c7b8,_0xde8c1){if(_0x56c7b8){return _0x35483d(_0x56c7b8);}else{return _0x200adc(_0xde8c1);}});});}function startTranscribe(_0x39f815,_0x5385b9,_0x21edd0,_0x38bd1f,_0x6a1959,_0x556a2d){return new Promise(function(_0x4d04ff,_0x476393){var _0x5a1d5c=new AWS[(_0xcf55('0x6b'))]({'accessKeyId':_0x5385b9,'secretAccessKey':_0x39f815,'region':_0x21edd0});_0x5a1d5c[_0xcf55('0x6c')]({'TranscriptionJobName':_0x38bd1f,'LanguageCode':_0x6a1959,'Media':{'MediaFileUri':_0x556a2d}},function(_0x5c8840,_0x3000bd){if(_0x5c8840){return _0x476393(_0x5c8840);}else{return _0x4d04ff(_0x3000bd);}});});}function transcribe(_0x11430e,_0x19ad9d,_0x3d42bb,_0x250466,_0x1b3010,_0x1487bc,_0x4d34e1){return new Promise(function(_0x291139,_0x1051ce){var _0x47fb1d={};logger['info'](util['format'](_0xcf55('0x6d'),_0x11430e,_0x1b3010));return uploadFile(_0x19ad9d,_0x3d42bb,_0x250466,_0x1b3010,path['basename'](_0x1487bc),fs[_0xcf55('0x6e')](_0x1487bc))[_0xcf55('0x22')](function(_0x1e42a8){logger[_0xcf55('0x63')](util[_0xcf55('0x2e')](_0xcf55('0x6f'),_0x11430e,_0x1b3010,_0x1e42a8['Location']));_0x47fb1d[_0xcf55('0x70')]=_0x1e42a8['Bucket'];_0x47fb1d[_0xcf55('0x71')]=_0x1e42a8[_0xcf55('0x72')];logger[_0xcf55('0x63')](util[_0xcf55('0x2e')](_0xcf55('0x73'),_0x11430e));return startTranscribe(_0x19ad9d,_0x3d42bb,_0x250466,uuidv4(),_0x4d34e1,_0x1e42a8['Location']);})[_0xcf55('0x22')](function(_0x1ed123){logger['info'](util[_0xcf55('0x2e')](_0xcf55('0x74'),_0x11430e,_0x1ed123[_0xcf55('0x75')][_0xcf55('0x76')]));_0x47fb1d[_0xcf55('0x77')]=_0x1ed123[_0xcf55('0x75')][_0xcf55('0x76')];_0x47fb1d[_0xcf55('0x78')]=_0x1ed123['TranscriptionJob'][_0xcf55('0x79')];return _0x291139(_0x47fb1d);})[_0xcf55('0x43')](function(_0x3f816b){return _0x1051ce(_0x3f816b);});});}exports['runTranscribe']=function(_0x1553b1,_0x2ce9a1,_0x4456c3){var _0xa4770c;var _0x27f3c6;var _0x5bb8e5;var _0x2b80c8=require(_0xcf55('0x5a'));return db[_0xcf55('0x29')]['findOne']({'where':{'id':_0x1553b1[_0xcf55('0x45')]['id']}})[_0xcf55('0x22')](function(_0xaef7dd){if(_0xaef7dd){var _0x1e0207=util[_0xcf55('0x2e')]('%s.cypher',_0xaef7dd[_0xcf55('0x4e')]);if(fs['existsSync'](_0x1e0207)){cypher=!![];return _0x2b80c8[_0xcf55('0x50')](_0x1e0207,_0xaef7dd[_0xcf55('0x4e')],config[_0xcf55('0x51')]['recording'])[_0xcf55('0x22')](function(){return _0xaef7dd;});}return _0xaef7dd;}})[_0xcf55('0x22')](function(_0x27734a){if(!_0x27734a){throw new db[(_0xcf55('0x53'))][(_0xcf55('0x54'))](_0xcf55('0x7a'));}_0x27f3c6=_0x27734a;return db[_0xcf55('0x7b')][_0xcf55('0x7c')]({'where':{'id':0x1}});})[_0xcf55('0x22')](handleEntityNotFound(_0x2ce9a1,null))[_0xcf55('0x22')](function(_0x2d3cfb){if(_0x2d3cfb){_0xa4770c=_0x2d3cfb;if(!_0xa4770c[_0xcf55('0x7d')]||!_0xa4770c[_0xcf55('0x7e')]||!_0xa4770c['transcribeRegion']||!_0xa4770c[_0xcf55('0x7f')]||!_0xa4770c[_0xcf55('0x70')]){throw new db[(_0xcf55('0x53'))][(_0xcf55('0x54'))](_0xcf55('0x80'));}if(_0x1553b1[_0xcf55('0x49')]['runSentiment']&&(!_0xa4770c[_0xcf55('0x81')]||!_0xa4770c[_0xcf55('0x82')]||!_0xa4770c[_0xcf55('0x83')]||!_0xa4770c[_0xcf55('0x7f')]||!_0xa4770c[_0xcf55('0x70')])){throw new db[(_0xcf55('0x53'))][(_0xcf55('0x54'))](_0xcf55('0x84'));}return db['CloudProvider'][_0xcf55('0x7c')]({'where':{'id':_0xa4770c[_0xcf55('0x7e')]}});}})[_0xcf55('0x22')](function(_0x48f1c7){if(!_0x48f1c7){throw new db[(_0xcf55('0x53'))]['ValidationError'](_0xcf55('0x85'));}if(!_0x48f1c7[_0xcf55('0x86')]||!_0x48f1c7[_0xcf55('0x87')]){throw new db[(_0xcf55('0x53'))]['ValidationError'](_0xcf55('0x88'));}_0x5bb8e5=_0x48f1c7;return getBucketslist(_0x5bb8e5[_0xcf55('0x86')],_0x5bb8e5['data2'],_0xa4770c['transcribeRegion']);})[_0xcf55('0x22')](function(_0x526ad0){if(_0x526ad0&&_0x526ad0[_0xcf55('0x89')]){var _0x57c786=_[_0xcf55('0x47')](_0x526ad0[_0xcf55('0x89')],function(_0x49832f){return _0x49832f[_0xcf55('0x8a')]===_0xa4770c['bucket'];});if(!_0x57c786){logger[_0xcf55('0x63')](util['format'](_0xcf55('0x8b'),_0x1553b1[_0xcf55('0x45')]['id'],_0xa4770c[_0xcf55('0x70')]));return createBucket(_0x5bb8e5[_0xcf55('0x86')],_0x5bb8e5[_0xcf55('0x87')],_0xa4770c[_0xcf55('0x8c')],_0xa4770c['bucket']);}logger[_0xcf55('0x63')](util[_0xcf55('0x2e')](_0xcf55('0x8d'),_0x1553b1[_0xcf55('0x45')]['id'],_0xa4770c[_0xcf55('0x70')]));return;}})[_0xcf55('0x22')](function(_0x1a5594){if(_0x27f3c6['transcribeStatus']==='NEW'){return transcribe(_0x1553b1[_0xcf55('0x45')]['id'],_0x5bb8e5['data1'],_0x5bb8e5['data2'],_0xa4770c[_0xcf55('0x8c')],_0xa4770c[_0xcf55('0x70')],_0x27f3c6[_0xcf55('0x4e')],_0xa4770c[_0xcf55('0x7f')]);}else{logger[_0xcf55('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1553b1['params']['id']));return{'transcribeStatus':_0xcf55('0x8e')};}})[_0xcf55('0x22')](function(_0x221a56){if(_0x221a56){_0x221a56[_0xcf55('0x8f')]=_0x1553b1['body'][_0xcf55('0x90')];return _0x27f3c6['updateAttributes'](_0x221a56);}})[_0xcf55('0x22')](respondWithResult(_0x2ce9a1,null))[_0xcf55('0x43')](handleError(_0x2ce9a1,null));};function writeFile(_0x1043a0,_0x13466c){return new Promise(function(_0x94c091,_0x14e49c){fs[_0xcf55('0x91')](_0x13466c,_0x1043a0,function(_0x483597,_0x418b46){if(_0x483597){return _0x14e49c(_0x483597);}else{return _0x94c091(_0x418b46);}});});}exports['downloadTranscribe']=function(_0x568dbe,_0x1bc37a,_0xf2b0dd){return db[_0xcf55('0x29')][_0xcf55('0x7c')]({'where':{'id':_0x568dbe[_0xcf55('0x45')]['id']}})['then'](handleEntityNotFound(_0x1bc37a))[_0xcf55('0x22')](function(_0x493d7a){if(_0x493d7a&&_0x493d7a[_0xcf55('0x92')]){var _0x21607d=_0x493d7a[_0xcf55('0x92')];var _0x402b66=config[_0xcf55('0x93')]+_0xcf55('0x94')+_0x493d7a['id']+_0xcf55('0x95');if(fs[_0xcf55('0x4f')](_0x402b66)){return _0x402b66;}return writeFile(_0x21607d,_0x402b66)[_0xcf55('0x22')](function(){return _0x402b66;});}else{throw new db[(_0xcf55('0x53'))][(_0xcf55('0x54'))]('Transcript\x20not\x20available');}})[_0xcf55('0x22')](function(_0x311b2b){return _0x1bc37a[_0xcf55('0x4b')](_0x311b2b);})[_0xcf55('0x43')](handleError(_0x1bc37a));}; \ No newline at end of file +var _0x42f3=['bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','format','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','VoiceRecording','findAll','rows','catch','show','keys','length','find','create','body','update','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','NEW','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x35986f,_0x4266cc){var _0x1efd7e=function(_0x5496a7){while(--_0x5496a7){_0x35986f['push'](_0x35986f['shift']());}};_0x1efd7e(++_0x4266cc);}(_0x42f3,0x11f));var _0x342f=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x42f3[_0x4b174a];return _0x3cd7bf;};'use strict';var pdf=require(_0x342f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x342f('0x1'));var zipdir=require(_0x342f('0x2'));var jsonpatch=require(_0x342f('0x3'));var rp=require('request-promise');var moment=require(_0x342f('0x4'));var BPromise=require(_0x342f('0x5'));var Mustache=require(_0x342f('0x6'));var util=require('util');var path=require(_0x342f('0x7'));var sox=require(_0x342f('0x8'));var csv=require(_0x342f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x342f('0xa'));var crypto=require(_0x342f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x342f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x342f('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x342f('0xe'));var Redis=require(_0x342f('0xf'));var authService=require(_0x342f('0x10'));var qs=require(_0x342f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x342f('0x12'));var logger=require('../../config/logger')(_0x342f('0x13'));var utils=require(_0x342f('0x14'));var config=require(_0x342f('0x15'));var licenseUtil=require(_0x342f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb66546,_0x37f613){_0x37f613=_0x37f613||0xcc;return function(_0x726dda){if(_0x726dda){return _0xb66546[_0x342f('0x17')](_0x37f613);}return _0xb66546[_0x342f('0x18')](_0x37f613)[_0x342f('0x19')]();};}function respondWithResult(_0x10afa9,_0x1350f9){_0x1350f9=_0x1350f9||0xc8;return function(_0x5b09a8){if(_0x5b09a8){return _0x10afa9['status'](_0x1350f9)['json'](_0x5b09a8);}};}function respondWithFilteredResult(_0x699166,_0x43bc21){return function(_0x1dd327){if(_0x1dd327){var _0x163eb6=_0x1dd327[_0x342f('0x1a')],_0x5b9104=_0x43bc21[_0x342f('0x1b')],_0x1bb08f=_0x43bc21[_0x342f('0x1b')]+_0x43bc21[_0x342f('0x1c')],_0x13391c;if(_0x1bb08f>=_0x163eb6){_0x1bb08f=_0x163eb6;_0x13391c=0xc8;}else{_0x13391c=0xce;}_0x699166['status'](_0x13391c);return _0x699166[_0x342f('0x1d')](_0x342f('0x1e'),_0x5b9104+'-'+_0x1bb08f+'/'+_0x163eb6)[_0x342f('0x1f')](_0x1dd327);}return null;};}function patchUpdates(_0x7793be){return function(_0x336e7f){try{jsonpatch['apply'](_0x336e7f,_0x7793be,!![]);}catch(_0x47cba6){return BPromise[_0x342f('0x20')](_0x47cba6);}return _0x336e7f[_0x342f('0x21')]();};}function saveUpdates(_0x196196,_0x3ea1c9){return function(_0xb73a22){if(_0xb73a22){return _0xb73a22['update'](_0x196196)[_0x342f('0x22')](function(_0x2f3762){return _0x2f3762;});}return null;};}function removeEntity(_0x129d26,_0x393d12){return function(_0xe3a5e2){if(_0xe3a5e2){return _0xe3a5e2[_0x342f('0x23')]()[_0x342f('0x22')](function(){_0x129d26[_0x342f('0x18')](0xcc)[_0x342f('0x19')]();});}};}function handleEntityNotFound(_0x449049,_0x18f6f0){return function(_0x578d34){if(!_0x578d34){_0x449049[_0x342f('0x17')](0x194);}return _0x578d34;};}function handleError(_0x4b5da5,_0x3d1c3){_0x3d1c3=_0x3d1c3||0x1f4;return function(_0x25c2bd){logger[_0x342f('0x24')](_0x25c2bd[_0x342f('0x25')]);if(_0x25c2bd[_0x342f('0x26')]){delete _0x25c2bd[_0x342f('0x26')];}_0x4b5da5[_0x342f('0x18')](_0x3d1c3)[_0x342f('0x27')](_0x25c2bd);};}exports[_0x342f('0x28')]=function(_0x3112c9,_0x42fdb0){var _0x356f80={},_0x1e7e07={},_0xf5df12={'count':0x0,'rows':[]};var _0x3f0806=_[_0x342f('0x29')](db['VoiceRecording'][_0x342f('0x2a')],function(_0x49b16b){return{'name':_0x49b16b[_0x342f('0x2b')],'type':_0x49b16b[_0x342f('0x2c')]['key']};});_0x1e7e07[_0x342f('0x2d')]=_[_0x342f('0x2e')](_[_0x342f('0x29')](_0x3f0806,'name'),[_0x342f('0x2f')]);_0x1e7e07['query']=_['keys'](_0x3112c9[_0x342f('0x30')]);_0x1e7e07[_0x342f('0x31')]=_[_0x342f('0x32')](_0x1e7e07[_0x342f('0x2d')],_0x1e7e07['query']);_0x356f80['attributes']=_[_0x342f('0x32')](_0x1e7e07['model'],qs['fields'](_0x3112c9['query'][_0x342f('0x33')]));_0x356f80[_0x342f('0x34')]=_0x356f80[_0x342f('0x34')]['length']?_0x356f80['attributes']:_0x1e7e07[_0x342f('0x2d')];if(!_0x3112c9[_0x342f('0x30')][_0x342f('0x35')]('nolimit')){_0x356f80[_0x342f('0x1c')]=qs[_0x342f('0x1c')](_0x3112c9[_0x342f('0x30')][_0x342f('0x1c')]);_0x356f80['offset']=qs[_0x342f('0x1b')](_0x3112c9['query'][_0x342f('0x1b')]);}_0x356f80['order']=qs[_0x342f('0x36')](_0x3112c9['query'][_0x342f('0x36')]);_0x356f80[_0x342f('0x37')]=qs[_0x342f('0x31')](_[_0x342f('0x38')](_0x3112c9[_0x342f('0x30')],_0x1e7e07[_0x342f('0x31')]),_0x3f0806);if(_0x3112c9[_0x342f('0x30')][_0x342f('0x39')]){_0x356f80[_0x342f('0x37')]=_[_0x342f('0x3a')](_0x356f80[_0x342f('0x37')],{'$or':_[_0x342f('0x29')](_0x3f0806,function(_0x381025){if(_0x381025[_0x342f('0x2c')]!=='VIRTUAL'){var _0x354419={};_0x354419[_0x381025[_0x342f('0x26')]]={'$like':'%'+_0x3112c9[_0x342f('0x30')][_0x342f('0x39')]+'%'};return _0x354419;}})});}_0x356f80=_['merge']({},_0x356f80,_0x3112c9[_0x342f('0x3b')]);var _0x39b112={'where':_0x356f80[_0x342f('0x37')]};return db['VoiceRecording'][_0x342f('0x1a')](_0x39b112)[_0x342f('0x22')](function(_0x9ad351){_0xf5df12[_0x342f('0x1a')]=_0x9ad351;if(_0x3112c9[_0x342f('0x30')][_0x342f('0x3c')]){_0x356f80[_0x342f('0x3d')]=[{'all':!![]}];}return db[_0x342f('0x3e')][_0x342f('0x3f')](_0x356f80);})['then'](function(_0xa401a8){_0xf5df12[_0x342f('0x40')]=_0xa401a8;return _0xf5df12;})[_0x342f('0x22')](respondWithFilteredResult(_0x42fdb0,_0x356f80))[_0x342f('0x41')](handleError(_0x42fdb0,null));};exports[_0x342f('0x42')]=function(_0x2c098b,_0x1396c2){var _0x4738db={'raw':![],'where':{'id':_0x2c098b['params']['id']}},_0x1d71fc={};_0x1d71fc[_0x342f('0x2d')]=_[_0x342f('0x43')](db[_0x342f('0x3e')][_0x342f('0x2a')]);_0x1d71fc[_0x342f('0x30')]=_[_0x342f('0x43')](_0x2c098b[_0x342f('0x30')]);_0x1d71fc['filters']=_[_0x342f('0x32')](_0x1d71fc[_0x342f('0x2d')],_0x1d71fc['query']);_0x4738db[_0x342f('0x34')]=_['intersection'](_0x1d71fc[_0x342f('0x2d')],qs['fields'](_0x2c098b['query'][_0x342f('0x33')]));_0x4738db[_0x342f('0x34')]=_0x4738db[_0x342f('0x34')][_0x342f('0x44')]?_0x4738db[_0x342f('0x34')]:_0x1d71fc[_0x342f('0x2d')];if(_0x2c098b[_0x342f('0x30')]['includeAll']){_0x4738db['include']=[{'all':!![]}];}_0x4738db=_[_0x342f('0x3a')]({},_0x4738db,_0x2c098b[_0x342f('0x3b')]);return db['VoiceRecording'][_0x342f('0x45')](_0x4738db)[_0x342f('0x22')](handleEntityNotFound(_0x1396c2,null))[_0x342f('0x22')](respondWithResult(_0x1396c2,null))[_0x342f('0x41')](handleError(_0x1396c2,null));};exports[_0x342f('0x46')]=function(_0x244be8,_0x342177){return db[_0x342f('0x3e')]['create'](_0x244be8[_0x342f('0x47')],{})[_0x342f('0x22')](respondWithResult(_0x342177,0xc9))[_0x342f('0x41')](handleError(_0x342177,null));};exports[_0x342f('0x48')]=function(_0x3b3cd3,_0x16bd2a){if(_0x3b3cd3[_0x342f('0x47')]['id']){delete _0x3b3cd3[_0x342f('0x47')]['id'];}return db['VoiceRecording'][_0x342f('0x45')]({'where':{'id':_0x3b3cd3[_0x342f('0x49')]['id']}})[_0x342f('0x22')](handleEntityNotFound(_0x16bd2a,null))[_0x342f('0x22')](saveUpdates(_0x3b3cd3[_0x342f('0x47')],null))[_0x342f('0x22')](respondWithResult(_0x16bd2a,null))[_0x342f('0x41')](handleError(_0x16bd2a,null));};exports[_0x342f('0x4a')]=function(_0x2b8296,_0xf07659){return db[_0x342f('0x3e')][_0x342f('0x4a')]()[_0x342f('0x22')](respondWithResult(_0xf07659,null))[_0x342f('0x41')](handleError(_0xf07659,null));};exports[_0x342f('0x4b')]=function(_0x578d2b,_0x2073c2,_0x103449){var _0x3a5121=require(_0x342f('0x4c'));var _0x1854aa=![];var _0x2cc614={};if(_0x578d2b['query']['type']&&_0x578d2b[_0x342f('0x30')][_0x342f('0x2c')]===_0x342f('0x4d')){_0x2cc614['uniqueid']=_0x578d2b[_0x342f('0x49')]['id'];}else{_0x2cc614['id']=_0x578d2b[_0x342f('0x49')]['id'];}return db[_0x342f('0x3e')][_0x342f('0x45')]({'where':_0x2cc614,'attributes':['id',_0x342f('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2073c2,null))['then'](function(_0x35782c){if(_0x35782c){var _0x56a182=_0x35782c[_0x342f('0x4e')];var _0x1f3989=util[_0x342f('0x2f')](_0x342f('0x4f'),_0x56a182);if(fs['existsSync'](_0x1f3989)){_0x1854aa=!![];return _0x3a5121[_0x342f('0x50')](_0x1f3989,_0x56a182,config[_0x342f('0x51')][_0x342f('0x52')])[_0x342f('0x22')](function(){return _0x35782c;});}return _0x35782c;}})['then'](function(_0x5c7aaa){if(_0x5c7aaa){var _0x1e7859=_0x5c7aaa[_0x342f('0x4e')];if(!fs[_0x342f('0x53')](_0x1e7859)){throw new db[(_0x342f('0x54'))][(_0x342f('0x55'))](_0x342f('0x56'));}if(_0x5c7aaa[_0x342f('0x57')]){return _0x2073c2['download'](_0x1e7859,_0x5c7aaa['filename']+path[_0x342f('0x58')](_0x1e7859),function(){if(_0x1854aa){fs[_0x342f('0x59')](_0x1e7859);}});}else{return _0x2073c2[_0x342f('0x4b')](_0x1e7859,function(_0x2b8714){if(_0x1854aa){fs['unlink'](_0x1e7859);}});}}})[_0x342f('0x41')](function(_0xb80c95){if(_0xb80c95[_0x342f('0x5a')]===_0x342f('0x56')){_0x2073c2[_0x342f('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x2073c2,null);}});};exports['downloads']=function(_0x51728e,_0x117ac9,_0x24e070){var _0x9480fe=require(_0x342f('0x4c'));var _0x5c99a8=![];var _0xcbcea1={'$and':[db[_0x342f('0x5b')][_0x342f('0x37')](db[_0x342f('0x5b')]['fn'](_0x342f('0x5c'),db[_0x342f('0x5b')]['col']('uniqueid')),_0x51728e[_0x342f('0x30')]['token'])]};if(_0x51728e[_0x342f('0x30')][_0x342f('0x2c')]&&_0x51728e[_0x342f('0x30')][_0x342f('0x2c')]===_0x342f('0x4d')){_0xcbcea1[_0x342f('0x5d')][_0x342f('0x5e')]({'uniqueid':_0x51728e[_0x342f('0x49')]['id']});}else{_0xcbcea1[_0x342f('0x5d')]['push']({'id':_0x51728e[_0x342f('0x49')]['id']});}return db[_0x342f('0x3e')][_0x342f('0x45')]({'where':_0xcbcea1,'attributes':['id',_0x342f('0x4e')],'raw':!![]})[_0x342f('0x22')](handleEntityNotFound(_0x117ac9,null))[_0x342f('0x22')](function(_0x367acd){if(_0x367acd){var _0x1ec61f=util[_0x342f('0x2f')](_0x342f('0x4f'),_0x367acd['value']);if(fs[_0x342f('0x53')](_0x1ec61f)){_0x5c99a8=!![];return _0x9480fe[_0x342f('0x50')](_0x1ec61f,_0x367acd[_0x342f('0x4e')],config[_0x342f('0x51')][_0x342f('0x52')])[_0x342f('0x22')](function(){return _0x367acd;});}return _0x367acd;}})[_0x342f('0x22')](function(_0x2f3537){if(_0x2f3537){if(!fs[_0x342f('0x53')](_0x2f3537[_0x342f('0x4e')])){throw new db[(_0x342f('0x54'))][(_0x342f('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x2f3537['filename']){return _0x117ac9[_0x342f('0x4b')](_0x2f3537[_0x342f('0x4e')],_0x2f3537[_0x342f('0x57')]+path[_0x342f('0x58')](_0x2f3537[_0x342f('0x4e')]),function(){if(_0x5c99a8){fs[_0x342f('0x59')](_0x2f3537[_0x342f('0x4e')]);}});}else{return _0x117ac9[_0x342f('0x4b')](_0x2f3537[_0x342f('0x4e')],function(_0x4edacb){if(_0x5c99a8){fs[_0x342f('0x59')](_0x2f3537[_0x342f('0x4e')]);}});}}})[_0x342f('0x41')](handleError(_0x117ac9,null));};exports[_0x342f('0x23')]=function(_0x3c5369,_0x21452b){return db[_0x342f('0x3e')][_0x342f('0x45')]({'where':{'id':_0x3c5369[_0x342f('0x49')]['id']}})[_0x342f('0x22')](function(_0x2cc152){if(!_0x2cc152)throw new ReferenceError(_0x342f('0x5f'));return _0x2cc152;})[_0x342f('0x22')](function(_0x6d0e09){var _0x31c433=_0x6d0e09[_0x342f('0x4e')];logger[_0x342f('0x60')](_0x342f('0x61'),_0x31c433);if(!_[_0x342f('0x62')](_0x6d0e09[_0x342f('0x4e')])&&fs[_0x342f('0x53')](_0x31c433)){logger[_0x342f('0x60')](_0x342f('0x63')+_0x31c433+_0x342f('0x64'));fs['unlinkSync'](_0x31c433);}_0x31c433=_0x31c433+_0x342f('0x65');if(!_[_0x342f('0x62')](_0x6d0e09['value'])&&fs[_0x342f('0x53')](_0x31c433)){logger[_0x342f('0x60')](_0x342f('0x63')+_0x31c433+_0x342f('0x64'));fs[_0x342f('0x66')](_0x31c433);}return _0x6d0e09;})[_0x342f('0x22')](function(_0x23969f){if(!_0x23969f)throw new InternalError();return _0x23969f[_0x342f('0x23')]();})[_0x342f('0x22')](function(){_0x21452b[_0x342f('0x18')](0xcc)['end']();})[_0x342f('0x41')](handleError(_0x21452b,null));};function getBucketslist(_0x5783c7,_0x43a803,_0xc986f3){return new Promise(function(_0x2dbb13,_0x379c77){var _0x28b39f=new AWS['S3']({'accessKeyId':_0x43a803,'secretAccessKey':_0x5783c7,'region':_0xc986f3});_0x28b39f[_0x342f('0x67')]({},function(_0x18f02c,_0x5e2c91){if(_0x18f02c){return _0x379c77(_0x18f02c);}else{return _0x2dbb13(_0x5e2c91);}});});}function createBucket(_0x9d3204,_0x29d3d5,_0x1bd699,_0x40305e){return new Promise(function(_0x525f6b,_0x105c07){var _0x51472b=new AWS['S3']({'accessKeyId':_0x29d3d5,'secretAccessKey':_0x9d3204,'region':_0x1bd699});_0x51472b['createBucket']({'Bucket':_0x40305e},function(_0x10cc54,_0x4a6bea){if(_0x10cc54){return _0x105c07(_0x10cc54);}else{return _0x525f6b(_0x4a6bea);}});});}function uploadFile(_0x45b17c,_0x42c004,_0x401dce,_0x5b0e6b,_0x2839db,_0x2b00a5){return new Promise(function(_0x2856cc,_0xfe2aae){var _0x505e87=new AWS['S3']({'accessKeyId':_0x42c004,'secretAccessKey':_0x45b17c,'region':_0x401dce});_0x505e87[_0x342f('0x68')]({'Bucket':_0x5b0e6b,'Key':_0x2839db,'Body':_0x2b00a5},function(_0x13bab3,_0xb76ffa){if(_0x13bab3){return _0xfe2aae(_0x13bab3);}else{return _0x2856cc(_0xb76ffa);}});});}function startTranscribe(_0x579dfa,_0x52cf85,_0x454250,_0x58d5a2,_0x259a57,_0x208c38){return new Promise(function(_0x2daed5,_0x2feb3d){var _0x453619=new AWS[(_0x342f('0x69'))]({'accessKeyId':_0x52cf85,'secretAccessKey':_0x579dfa,'region':_0x454250});_0x453619[_0x342f('0x6a')]({'TranscriptionJobName':_0x58d5a2,'LanguageCode':_0x259a57,'Media':{'MediaFileUri':_0x208c38}},function(_0x2306ae,_0x38fac0){if(_0x2306ae){return _0x2feb3d(_0x2306ae);}else{return _0x2daed5(_0x38fac0);}});});}function transcribe(_0x308be4,_0x5f055d,_0x11e210,_0xf2ff68,_0xaf2c40,_0x56103b,_0x17d189){return new Promise(function(_0x3ba092,_0x4e045a){var _0x38e0cd={};logger[_0x342f('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x308be4,_0xaf2c40));return uploadFile(_0x5f055d,_0x11e210,_0xf2ff68,_0xaf2c40,path['basename'](_0x56103b),fs[_0x342f('0x6b')](_0x56103b))['then'](function(_0x178624){logger[_0x342f('0x60')](util['format'](_0x342f('0x6c'),_0x308be4,_0xaf2c40,_0x178624[_0x342f('0x6d')]));_0x38e0cd[_0x342f('0x6e')]=_0x178624[_0x342f('0x6f')];_0x38e0cd[_0x342f('0x70')]=_0x178624[_0x342f('0x6d')];logger[_0x342f('0x60')](util[_0x342f('0x2f')](_0x342f('0x71'),_0x308be4));return startTranscribe(_0x5f055d,_0x11e210,_0xf2ff68,uuidv4(),_0x17d189,_0x178624[_0x342f('0x6d')]);})[_0x342f('0x22')](function(_0x5c4fc3){logger[_0x342f('0x60')](util['format'](_0x342f('0x72'),_0x308be4,_0x5c4fc3[_0x342f('0x73')][_0x342f('0x74')]));_0x38e0cd[_0x342f('0x75')]=_0x5c4fc3[_0x342f('0x73')][_0x342f('0x74')];_0x38e0cd[_0x342f('0x76')]=_0x5c4fc3[_0x342f('0x73')][_0x342f('0x77')];return _0x3ba092(_0x38e0cd);})[_0x342f('0x41')](function(_0x3b8f04){return _0x4e045a(_0x3b8f04);});});}exports[_0x342f('0x78')]=function(_0x1d1256,_0xb98f83,_0x24b885){var _0x17f733;var _0x31d3bb;var _0x1c0c26;var _0x3382ce=require(_0x342f('0x4c'));return db[_0x342f('0x3e')][_0x342f('0x79')]({'where':{'id':_0x1d1256[_0x342f('0x49')]['id']}})['then'](function(_0xda7649){if(_0xda7649){var _0x155c04=util[_0x342f('0x2f')](_0x342f('0x4f'),_0xda7649[_0x342f('0x4e')]);if(fs[_0x342f('0x53')](_0x155c04)){cypher=!![];return _0x3382ce[_0x342f('0x50')](_0x155c04,_0xda7649[_0x342f('0x4e')],config[_0x342f('0x51')][_0x342f('0x52')])[_0x342f('0x22')](function(){return _0xda7649;});}return _0xda7649;}})['then'](function(_0x409f05){if(!_0x409f05){throw new db[(_0x342f('0x54'))][(_0x342f('0x55'))](_0x342f('0x7a'));}_0x31d3bb=_0x409f05;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xb98f83,null))[_0x342f('0x22')](function(_0x2a2ff1){if(_0x2a2ff1){_0x17f733=_0x2a2ff1;if(!_0x17f733[_0x342f('0x7b')]||!_0x17f733[_0x342f('0x7c')]||!_0x17f733[_0x342f('0x7d')]||!_0x17f733[_0x342f('0x7e')]||!_0x17f733[_0x342f('0x6e')]){throw new db[(_0x342f('0x54'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x1d1256['body'][_0x342f('0x7f')]&&(!_0x17f733[_0x342f('0x80')]||!_0x17f733[_0x342f('0x81')]||!_0x17f733[_0x342f('0x82')]||!_0x17f733[_0x342f('0x7e')]||!_0x17f733[_0x342f('0x6e')])){throw new db[(_0x342f('0x54'))][(_0x342f('0x55'))](_0x342f('0x83'));}return db[_0x342f('0x84')][_0x342f('0x79')]({'where':{'id':_0x17f733['transcribeAccountId']}});}})[_0x342f('0x22')](function(_0xcf3b7d){if(!_0xcf3b7d){throw new db['Sequelize'][(_0x342f('0x55'))](_0x342f('0x85'));}if(!_0xcf3b7d[_0x342f('0x86')]||!_0xcf3b7d[_0x342f('0x87')]){throw new db[(_0x342f('0x54'))][(_0x342f('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x1c0c26=_0xcf3b7d;return getBucketslist(_0x1c0c26[_0x342f('0x86')],_0x1c0c26['data2'],_0x17f733[_0x342f('0x7d')]);})[_0x342f('0x22')](function(_0x174adb){if(_0x174adb&&_0x174adb['Buckets']){var _0x65e7bd=_[_0x342f('0x45')](_0x174adb[_0x342f('0x88')],function(_0x523478){return _0x523478[_0x342f('0x89')]===_0x17f733['bucket'];});if(!_0x65e7bd){logger['info'](util[_0x342f('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1d1256[_0x342f('0x49')]['id'],_0x17f733[_0x342f('0x6e')]));return createBucket(_0x1c0c26[_0x342f('0x86')],_0x1c0c26[_0x342f('0x87')],_0x17f733[_0x342f('0x7d')],_0x17f733['bucket']);}logger[_0x342f('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1d1256[_0x342f('0x49')]['id'],_0x17f733[_0x342f('0x6e')]));return;}})['then'](function(_0x519031){if(_0x31d3bb[_0x342f('0x76')]===_0x342f('0x8a')){return transcribe(_0x1d1256[_0x342f('0x49')]['id'],_0x1c0c26[_0x342f('0x86')],_0x1c0c26[_0x342f('0x87')],_0x17f733[_0x342f('0x7d')],_0x17f733[_0x342f('0x6e')],_0x31d3bb[_0x342f('0x4e')],_0x17f733[_0x342f('0x7e')]);}else{logger[_0x342f('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1d1256['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x4c02db){if(_0x4c02db){_0x4c02db['tempSentiment']=_0x1d1256[_0x342f('0x47')][_0x342f('0x7f')];return _0x31d3bb[_0x342f('0x8b')](_0x4c02db);}})[_0x342f('0x22')](respondWithResult(_0xb98f83,null))[_0x342f('0x41')](handleError(_0xb98f83,null));};function writeFile(_0x11ba5d,_0x47821){return new Promise(function(_0x42c5da,_0x17a6f2){fs[_0x342f('0x8c')](_0x47821,_0x11ba5d,function(_0x1124d0,_0x2fabdc){if(_0x1124d0){return _0x17a6f2(_0x1124d0);}else{return _0x42c5da(_0x2fabdc);}});});}exports[_0x342f('0x8d')]=function(_0x1d8fc5,_0x56c5ce,_0x13b598){return db[_0x342f('0x3e')][_0x342f('0x79')]({'where':{'id':_0x1d8fc5[_0x342f('0x49')]['id']}})[_0x342f('0x22')](handleEntityNotFound(_0x56c5ce))[_0x342f('0x22')](function(_0x40a679){if(_0x40a679&&_0x40a679[_0x342f('0x8e')]){var _0x2962db=_0x40a679[_0x342f('0x8e')];var _0x2b0ff0=config['root']+_0x342f('0x8f')+_0x40a679['id']+_0x342f('0x90');if(fs['existsSync'](_0x2b0ff0)){return _0x2b0ff0;}return writeFile(_0x2962db,_0x2b0ff0)['then'](function(){return _0x2b0ff0;});}else{throw new db[(_0x342f('0x54'))]['ValidationError'](_0x342f('0x91'));}})['then'](function(_0x2cb875){return _0x56c5ce[_0x342f('0x4b')](_0x2cb875);})['catch'](handleError(_0x56c5ce));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 623acc1..26c1781 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 _0x48c9=['./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x48c9,0x1e5));var _0x948c=function(_0x40c849,_0xbc22a1){_0x40c849=_0x40c849-0x0;var _0x7d3bef=_0x48c9[_0x40c849];return _0x7d3bef;};'use strict';var _=require(_0x948c('0x0'));var util=require(_0x948c('0x1'));var logger=require(_0x948c('0x2'))(_0x948c('0x3'));var moment=require(_0x948c('0x4'));var BPromise=require(_0x948c('0x5'));var rp=require(_0x948c('0x6'));var fs=require('fs');var path=require(_0x948c('0x7'));var rimraf=require(_0x948c('0x8'));var config=require(_0x948c('0x9'));var attributes=require(_0x948c('0xa'));module['exports']=function(_0x5aca17,_0xe4c535){return _0x5aca17[_0x948c('0xb')](_0x948c('0xc'),attributes,{'tableName':_0x948c('0xd'),'paranoid':![],'indexes':[{'name':_0x948c('0xe'),'fields':[_0x948c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75bd=['moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x75bd,0x14f));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd75b('0x0'));var util=require(_0xd75b('0x1'));var logger=require(_0xd75b('0x2'))('api');var moment=require(_0xd75b('0x3'));var BPromise=require('bluebird');var rp=require(_0xd75b('0x4'));var fs=require('fs');var path=require(_0xd75b('0x5'));var rimraf=require(_0xd75b('0x6'));var config=require(_0xd75b('0x7'));var attributes=require('./voiceRecording.attributes');module[_0xd75b('0x8')]=function(_0x55572f,_0x46ef31){return _0x55572f[_0xd75b('0x9')](_0xd75b('0xa'),attributes,{'tableName':_0xd75b('0xb'),'paranoid':![],'indexes':[{'name':_0xd75b('0xc'),'fields':[_0xd75b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index a3392e5..ea37c18 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x10e956,_0xd5fcf0){var _0x3312a0=function(_0x11d25){while(--_0x11d25){_0x10e956['push'](_0x10e956['shift']());}};_0x3312a0(++_0xd5fcf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x22a15e,_0x25fbc4){var _0x3e459f=function(_0x28a114){while(--_0x28a114){_0x22a15e['push'](_0x22a15e['shift']());}};_0x3e459f(++_0x25fbc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 558ccf6..393d245 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 _0xc5c9=['/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','put'];(function(_0x599da4,_0x2ec53d){var _0x380805=function(_0x15d390){while(--_0x15d390){_0x599da4['push'](_0x599da4['shift']());}};_0x380805(++_0x2ec53d);}(_0xc5c9,0x93));var _0x9c5c=function(_0x4dac76,_0x1b148b){_0x4dac76=_0x4dac76-0x0;var _0x56c29e=_0xc5c9[_0x4dac76];return _0x56c29e;};'use strict';var multer=require(_0x9c5c('0x0'));var util=require('util');var path=require(_0x9c5c('0x1'));var timeout=require(_0x9c5c('0x2'));var express=require(_0x9c5c('0x3'));var router=express[_0x9c5c('0x4')]();var auth=require(_0x9c5c('0x5'));var interaction=require(_0x9c5c('0x6'));var config=require(_0x9c5c('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x9c5c('0x8')]('/',auth[_0x9c5c('0x9')](),controller[_0x9c5c('0xa')]);router['get']('/describe',auth[_0x9c5c('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9c5c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9c5c('0xc')](_0x9c5c('0xd'),auth['isAuthenticated'](),controller[_0x9c5c('0xe')]);router[_0x9c5c('0xf')](_0x9c5c('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdd33=['create','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdd33,0x180));var _0x3dd3=function(_0x25a2dc,_0x523994){_0x25a2dc=_0x25a2dc-0x0;var _0x24338c=_0xdd33[_0x25a2dc];return _0x24338c;};'use strict';var multer=require(_0x3dd3('0x0'));var util=require(_0x3dd3('0x1'));var path=require(_0x3dd3('0x2'));var timeout=require(_0x3dd3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3dd3('0x4'));var interaction=require(_0x3dd3('0x5'));var config=require(_0x3dd3('0x6'));var controller=require(_0x3dd3('0x7'));router[_0x3dd3('0x8')]('/',auth['isAuthenticated'](),controller[_0x3dd3('0x9')]);router[_0x3dd3('0x8')](_0x3dd3('0xa'),auth['isAuthenticated'](),controller[_0x3dd3('0xb')]);router[_0x3dd3('0x8')](_0x3dd3('0xc'),auth[_0x3dd3('0xd')](),controller['show']);router[_0x3dd3('0xe')]('/',auth[_0x3dd3('0xd')](),controller[_0x3dd3('0xf')]);router['put'](_0x3dd3('0xc'),auth['isAuthenticated'](),controller[_0x3dd3('0x10')]);router[_0x3dd3('0x11')](_0x3dd3('0xc'),auth[_0x3dd3('0xd')](),controller['destroy']);module[_0x3dd3('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index aec59d2..6e94cc2 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 _0xc90d=['STRING','Yes','sequelize','moment','ENUM','blind','attended'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc90d,0x1c9));var _0xdc90=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0xc90d[_0x7148b6];return _0x111019;};'use strict';var Sequelize=require(_0xdc90('0x0'));var moment=require(_0xdc90('0x1'));module['exports']={'type':{'type':Sequelize[_0xdc90('0x2')](_0xdc90('0x3'),_0xdc90('0x4'))},'result':{'type':Sequelize[_0xdc90('0x5')]},'transfererchannel':{'type':Sequelize[_0xdc90('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdc90('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdc90('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdc90('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xdc90('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xdc90('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xdc90('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xdc90('0x5')]},'transfereechannel':{'type':Sequelize[_0xdc90('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xdc90('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xdc90('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xdc90('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xdc90('0x5')]},'isexternal':{'type':Sequelize[_0xdc90('0x2')](_0xdc90('0x6'),'No')},'context':{'type':Sequelize[_0xdc90('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x356f=['moment','ENUM','attended','STRING','Yes','sequelize'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x356f,0x167));var _0xf356=function(_0x15cc71,_0x4607ca){_0x15cc71=_0x15cc71-0x0;var _0xd5d8df=_0x356f[_0x15cc71];return _0xd5d8df;};'use strict';var Sequelize=require(_0xf356('0x0'));var moment=require(_0xf356('0x1'));module['exports']={'type':{'type':Sequelize[_0xf356('0x2')]('blind',_0xf356('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf356('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf356('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf356('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf356('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xf356('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf356('0x4')]},'transferercontext':{'type':Sequelize[_0xf356('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf356('0x4')]},'transfereechannel':{'type':Sequelize[_0xf356('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xf356('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xf356('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf356('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xf356('0x4')]},'isexternal':{'type':Sequelize[_0xf356('0x2')](_0xf356('0x5'),'No')},'context':{'type':Sequelize[_0xf356('0x4')]},'extension':{'type':Sequelize[_0xf356('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ba6eadd..694622f 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 _0x6ad2=['reject','save','then','error','stack','name','send','map','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply'];(function(_0x1e7a07,_0x355dd1){var _0x4b60be=function(_0x2eb2bf){while(--_0x2eb2bf){_0x1e7a07['push'](_0x1e7a07['shift']());}};_0x4b60be(++_0x355dd1);}(_0x6ad2,0x159));var _0x26ad=function(_0x260d17,_0x41db16){_0x260d17=_0x260d17-0x0;var _0x11dc8d=_0x6ad2[_0x260d17];return _0x11dc8d;};'use strict';var pdf=require(_0x26ad('0x0'));var emlformat=require(_0x26ad('0x1'));var rimraf=require(_0x26ad('0x2'));var zipdir=require(_0x26ad('0x3'));var jsonpatch=require(_0x26ad('0x4'));var rp=require(_0x26ad('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x26ad('0x6'));var util=require('util');var path=require(_0x26ad('0x7'));var sox=require(_0x26ad('0x8'));var csv=require(_0x26ad('0x9'));var ejs=require(_0x26ad('0xa'));var fs=require('fs');var _=require(_0x26ad('0xb'));var squel=require(_0x26ad('0xc'));var crypto=require(_0x26ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x26ad('0xe'));var toCsv=require(_0x26ad('0x9'));var querystring=require(_0x26ad('0xf'));var Papa=require(_0x26ad('0x10'));var Redis=require('ioredis');var authService=require(_0x26ad('0x11'));var qs=require(_0x26ad('0x12'));var as=require(_0x26ad('0x13'));var hardwareService=require(_0x26ad('0x14'));var logger=require(_0x26ad('0x15'))(_0x26ad('0x16'));var utils=require(_0x26ad('0x17'));var config=require(_0x26ad('0x18'));var licenseUtil=require(_0x26ad('0x19'));var db=require(_0x26ad('0x1a'))['db'];function respondWithStatusCode(_0x4107a9,_0x42e2af){_0x42e2af=_0x42e2af||0xcc;return function(_0x552ad3){if(_0x552ad3){return _0x4107a9['sendStatus'](_0x42e2af);}return _0x4107a9[_0x26ad('0x1b')](_0x42e2af)[_0x26ad('0x1c')]();};}function respondWithResult(_0x13a5b3,_0x3abc1a){_0x3abc1a=_0x3abc1a||0xc8;return function(_0x5982bc){if(_0x5982bc){return _0x13a5b3[_0x26ad('0x1b')](_0x3abc1a)[_0x26ad('0x1d')](_0x5982bc);}};}function respondWithFilteredResult(_0x3792b5,_0x2335f1){return function(_0x382717){if(_0x382717){var _0x5c6769=_0x382717[_0x26ad('0x1e')],_0xc8caf3=_0x2335f1[_0x26ad('0x1f')],_0x761f8f=_0x2335f1[_0x26ad('0x1f')]+_0x2335f1[_0x26ad('0x20')],_0x1aeec0;if(_0x761f8f>=_0x5c6769){_0x761f8f=_0x5c6769;_0x1aeec0=0xc8;}else{_0x1aeec0=0xce;}_0x3792b5[_0x26ad('0x1b')](_0x1aeec0);return _0x3792b5['set'](_0x26ad('0x21'),_0xc8caf3+'-'+_0x761f8f+'/'+_0x5c6769)[_0x26ad('0x1d')](_0x382717);}return null;};}function patchUpdates(_0x5c57ff){return function(_0x5b9b96){try{jsonpatch[_0x26ad('0x22')](_0x5b9b96,_0x5c57ff,!![]);}catch(_0x5dcf86){return BPromise[_0x26ad('0x23')](_0x5dcf86);}return _0x5b9b96[_0x26ad('0x24')]();};}function saveUpdates(_0x4ed3d3,_0x43ee81){return function(_0x1cece2){if(_0x1cece2){return _0x1cece2['update'](_0x4ed3d3)[_0x26ad('0x25')](function(_0x45c4a5){return _0x45c4a5;});}return null;};}function removeEntity(_0x1af58f,_0x1edf25){return function(_0x3a06e6){if(_0x3a06e6){return _0x3a06e6['destroy']()[_0x26ad('0x25')](function(){_0x1af58f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe3b938,_0x5cedce){return function(_0x2312f9){if(!_0x2312f9){_0xe3b938['sendStatus'](0x194);}return _0x2312f9;};}function handleError(_0x21ce78,_0x4a9cbc){_0x4a9cbc=_0x4a9cbc||0x1f4;return function(_0x4574f7){logger[_0x26ad('0x26')](_0x4574f7[_0x26ad('0x27')]);if(_0x4574f7['name']){delete _0x4574f7[_0x26ad('0x28')];}_0x21ce78[_0x26ad('0x1b')](_0x4a9cbc)[_0x26ad('0x29')](_0x4574f7);};}exports['index']=function(_0x13b79b,_0x494c78){var _0x3110a7={},_0x183dd1={},_0x26d67d={'count':0x0,'rows':[]};var _0x342ba8=_[_0x26ad('0x2a')](db['VoiceTransferReport']['rawAttributes'],function(_0x9b4d8c){return{'name':_0x9b4d8c['fieldName'],'type':_0x9b4d8c[_0x26ad('0x2b')]['key']};});_0x183dd1['model']=_['map'](_0x342ba8,_0x26ad('0x28'));_0x183dd1[_0x26ad('0x2c')]=_['keys'](_0x13b79b[_0x26ad('0x2c')]);_0x183dd1[_0x26ad('0x2d')]=_[_0x26ad('0x2e')](_0x183dd1['model'],_0x183dd1[_0x26ad('0x2c')]);_0x3110a7[_0x26ad('0x2f')]=_[_0x26ad('0x2e')](_0x183dd1[_0x26ad('0x30')],qs[_0x26ad('0x31')](_0x13b79b['query'][_0x26ad('0x31')]));_0x3110a7['attributes']=_0x3110a7['attributes'][_0x26ad('0x32')]?_0x3110a7[_0x26ad('0x2f')]:_0x183dd1[_0x26ad('0x30')];if(!_0x13b79b['query'][_0x26ad('0x33')](_0x26ad('0x34'))){_0x3110a7[_0x26ad('0x20')]=qs[_0x26ad('0x20')](_0x13b79b[_0x26ad('0x2c')][_0x26ad('0x20')]);_0x3110a7[_0x26ad('0x1f')]=qs[_0x26ad('0x1f')](_0x13b79b[_0x26ad('0x2c')][_0x26ad('0x1f')]);}_0x3110a7[_0x26ad('0x35')]=qs[_0x26ad('0x36')](_0x13b79b[_0x26ad('0x2c')][_0x26ad('0x36')]);_0x3110a7['where']=qs[_0x26ad('0x2d')](_['pick'](_0x13b79b[_0x26ad('0x2c')],_0x183dd1[_0x26ad('0x2d')]),_0x342ba8);if(_0x13b79b[_0x26ad('0x2c')][_0x26ad('0x37')]){_0x3110a7[_0x26ad('0x38')]=_[_0x26ad('0x39')](_0x3110a7[_0x26ad('0x38')],{'$or':_[_0x26ad('0x2a')](_0x342ba8,function(_0x25102e){if(_0x25102e[_0x26ad('0x2b')]!==_0x26ad('0x3a')){var _0x2400b6={};_0x2400b6[_0x25102e['name']]={'$like':'%'+_0x13b79b[_0x26ad('0x2c')][_0x26ad('0x37')]+'%'};return _0x2400b6;}})});}_0x3110a7=_[_0x26ad('0x39')]({},_0x3110a7,_0x13b79b[_0x26ad('0x3b')]);var _0x582505={'where':_0x3110a7[_0x26ad('0x38')]};return db[_0x26ad('0x3c')]['count'](_0x582505)[_0x26ad('0x25')](function(_0x4970f0){_0x26d67d[_0x26ad('0x1e')]=_0x4970f0;if(_0x13b79b[_0x26ad('0x2c')][_0x26ad('0x3d')]){_0x3110a7[_0x26ad('0x3e')]=[{'all':!![]}];}return db[_0x26ad('0x3c')][_0x26ad('0x3f')](_0x3110a7);})[_0x26ad('0x25')](function(_0x376990){_0x26d67d[_0x26ad('0x40')]=_0x376990;return _0x26d67d;})[_0x26ad('0x25')](respondWithFilteredResult(_0x494c78,_0x3110a7))[_0x26ad('0x41')](handleError(_0x494c78,null));};exports[_0x26ad('0x42')]=function(_0x50abb7,_0x10f0cd){var _0x17a1ba={'raw':!![],'where':{'id':_0x50abb7['params']['id']}},_0xeefc4b={};_0xeefc4b[_0x26ad('0x30')]=_[_0x26ad('0x43')](db[_0x26ad('0x3c')][_0x26ad('0x44')]);_0xeefc4b[_0x26ad('0x2c')]=_[_0x26ad('0x43')](_0x50abb7[_0x26ad('0x2c')]);_0xeefc4b[_0x26ad('0x2d')]=_[_0x26ad('0x2e')](_0xeefc4b['model'],_0xeefc4b[_0x26ad('0x2c')]);_0x17a1ba[_0x26ad('0x2f')]=_[_0x26ad('0x2e')](_0xeefc4b[_0x26ad('0x30')],qs[_0x26ad('0x31')](_0x50abb7[_0x26ad('0x2c')][_0x26ad('0x31')]));_0x17a1ba[_0x26ad('0x2f')]=_0x17a1ba[_0x26ad('0x2f')][_0x26ad('0x32')]?_0x17a1ba['attributes']:_0xeefc4b['model'];if(_0x50abb7[_0x26ad('0x2c')]['includeAll']){_0x17a1ba[_0x26ad('0x3e')]=[{'all':!![]}];}_0x17a1ba=_['merge']({},_0x17a1ba,_0x50abb7['options']);return db['VoiceTransferReport'][_0x26ad('0x45')](_0x17a1ba)['then'](handleEntityNotFound(_0x10f0cd,null))[_0x26ad('0x25')](respondWithResult(_0x10f0cd,null))[_0x26ad('0x41')](handleError(_0x10f0cd,null));};exports[_0x26ad('0x46')]=function(_0x5d9967,_0x2139be){return db[_0x26ad('0x3c')][_0x26ad('0x46')](_0x5d9967[_0x26ad('0x47')],{})[_0x26ad('0x25')](respondWithResult(_0x2139be,0xc9))[_0x26ad('0x41')](handleError(_0x2139be,null));};exports[_0x26ad('0x48')]=function(_0x380619,_0x2fc748){if(_0x380619[_0x26ad('0x47')]['id']){delete _0x380619['body']['id'];}return db[_0x26ad('0x3c')][_0x26ad('0x45')]({'where':{'id':_0x380619[_0x26ad('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fc748,null))[_0x26ad('0x25')](saveUpdates(_0x380619[_0x26ad('0x47')],null))['then'](respondWithResult(_0x2fc748,null))['catch'](handleError(_0x2fc748,null));};exports[_0x26ad('0x4a')]=function(_0x4664f9,_0xd3113d){return db[_0x26ad('0x3c')][_0x26ad('0x45')]({'where':{'id':_0x4664f9[_0x26ad('0x49')]['id']}})['then'](handleEntityNotFound(_0xd3113d,null))[_0x26ad('0x25')](removeEntity(_0xd3113d,null))[_0x26ad('0x41')](handleError(_0xd3113d,null));};exports[_0x26ad('0x4b')]=function(_0x4b4617,_0x229bab){return db[_0x26ad('0x3c')][_0x26ad('0x4b')]()[_0x26ad('0x25')](respondWithResult(_0x229bab,null))[_0x26ad('0x41')](handleError(_0x229bab,null));}; \ No newline at end of file +var _0x7a55=['catch','show','params','length','merge','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows'];(function(_0x5925ed,_0x3c08b5){var _0x530bd8=function(_0x58387e){while(--_0x58387e){_0x5925ed['push'](_0x5925ed['shift']());}};_0x530bd8(++_0x3c08b5);}(_0x7a55,0xea));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x57a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x57a5('0x1'));var zipdir=require(_0x57a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57a5('0x3'));var moment=require('moment');var BPromise=require(_0x57a5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57a5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57a5('0x6'));var fs=require('fs');var _=require(_0x57a5('0x7'));var squel=require('squel');var crypto=require(_0x57a5('0x8'));var jsforce=require(_0x57a5('0x9'));var deskjs=require(_0x57a5('0xa'));var toCsv=require(_0x57a5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x57a5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x57a5('0xd'));var as=require(_0x57a5('0xe'));var hardwareService=require(_0x57a5('0xf'));var logger=require('../../config/logger')(_0x57a5('0x10'));var utils=require(_0x57a5('0x11'));var config=require(_0x57a5('0x12'));var licenseUtil=require(_0x57a5('0x13'));var db=require(_0x57a5('0x14'))['db'];function respondWithStatusCode(_0x40bf62,_0x354d4c){_0x354d4c=_0x354d4c||0xcc;return function(_0x4c9986){if(_0x4c9986){return _0x40bf62[_0x57a5('0x15')](_0x354d4c);}return _0x40bf62[_0x57a5('0x16')](_0x354d4c)[_0x57a5('0x17')]();};}function respondWithResult(_0x296adc,_0x4b5e2b){_0x4b5e2b=_0x4b5e2b||0xc8;return function(_0x2cf260){if(_0x2cf260){return _0x296adc[_0x57a5('0x16')](_0x4b5e2b)[_0x57a5('0x18')](_0x2cf260);}};}function respondWithFilteredResult(_0x520b5d,_0x48679d){return function(_0x112d76){if(_0x112d76){var _0x465e52=_0x112d76[_0x57a5('0x19')],_0x11758f=_0x48679d[_0x57a5('0x1a')],_0x4aa29f=_0x48679d[_0x57a5('0x1a')]+_0x48679d[_0x57a5('0x1b')],_0x5de9e9;if(_0x4aa29f>=_0x465e52){_0x4aa29f=_0x465e52;_0x5de9e9=0xc8;}else{_0x5de9e9=0xce;}_0x520b5d[_0x57a5('0x16')](_0x5de9e9);return _0x520b5d[_0x57a5('0x1c')]('Content-Range',_0x11758f+'-'+_0x4aa29f+'/'+_0x465e52)[_0x57a5('0x18')](_0x112d76);}return null;};}function patchUpdates(_0xb404cc){return function(_0x46c1a6){try{jsonpatch[_0x57a5('0x1d')](_0x46c1a6,_0xb404cc,!![]);}catch(_0x402966){return BPromise[_0x57a5('0x1e')](_0x402966);}return _0x46c1a6[_0x57a5('0x1f')]();};}function saveUpdates(_0x3b7bc9,_0x53dd12){return function(_0x23cff1){if(_0x23cff1){return _0x23cff1[_0x57a5('0x20')](_0x3b7bc9)[_0x57a5('0x21')](function(_0x165df7){return _0x165df7;});}return null;};}function removeEntity(_0x3f06a9,_0x5b994d){return function(_0x49121d){if(_0x49121d){return _0x49121d[_0x57a5('0x22')]()[_0x57a5('0x21')](function(){_0x3f06a9[_0x57a5('0x16')](0xcc)[_0x57a5('0x17')]();});}};}function handleEntityNotFound(_0x2eb3e8,_0x518f02){return function(_0x39b539){if(!_0x39b539){_0x2eb3e8[_0x57a5('0x15')](0x194);}return _0x39b539;};}function handleError(_0x10fb93,_0x5a1a09){_0x5a1a09=_0x5a1a09||0x1f4;return function(_0x3bbc0b){logger[_0x57a5('0x23')](_0x3bbc0b[_0x57a5('0x24')]);if(_0x3bbc0b[_0x57a5('0x25')]){delete _0x3bbc0b[_0x57a5('0x25')];}_0x10fb93[_0x57a5('0x16')](_0x5a1a09)[_0x57a5('0x26')](_0x3bbc0b);};}exports[_0x57a5('0x27')]=function(_0x490b1b,_0x2652f2){var _0x201b86={},_0x221337={},_0x1c4f16={'count':0x0,'rows':[]};var _0xacce6=_[_0x57a5('0x28')](db['VoiceTransferReport'][_0x57a5('0x29')],function(_0x520ae8){return{'name':_0x520ae8[_0x57a5('0x2a')],'type':_0x520ae8[_0x57a5('0x2b')][_0x57a5('0x2c')]};});_0x221337['model']=_[_0x57a5('0x28')](_0xacce6,_0x57a5('0x25'));_0x221337[_0x57a5('0x2d')]=_[_0x57a5('0x2e')](_0x490b1b[_0x57a5('0x2d')]);_0x221337[_0x57a5('0x2f')]=_[_0x57a5('0x30')](_0x221337[_0x57a5('0x31')],_0x221337[_0x57a5('0x2d')]);_0x201b86[_0x57a5('0x32')]=_[_0x57a5('0x30')](_0x221337[_0x57a5('0x31')],qs['fields'](_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x33')]));_0x201b86[_0x57a5('0x32')]=_0x201b86[_0x57a5('0x32')]['length']?_0x201b86['attributes']:_0x221337[_0x57a5('0x31')];if(!_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x34')](_0x57a5('0x35'))){_0x201b86['limit']=qs['limit'](_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x1b')]);_0x201b86['offset']=qs['offset'](_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x1a')]);}_0x201b86[_0x57a5('0x36')]=qs[_0x57a5('0x37')](_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x37')]);_0x201b86['where']=qs['filters'](_[_0x57a5('0x38')](_0x490b1b[_0x57a5('0x2d')],_0x221337[_0x57a5('0x2f')]),_0xacce6);if(_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x39')]){_0x201b86[_0x57a5('0x3a')]=_['merge'](_0x201b86[_0x57a5('0x3a')],{'$or':_[_0x57a5('0x28')](_0xacce6,function(_0x46485e){if(_0x46485e[_0x57a5('0x2b')]!==_0x57a5('0x3b')){var _0x27ddbf={};_0x27ddbf[_0x46485e[_0x57a5('0x25')]]={'$like':'%'+_0x490b1b['query'][_0x57a5('0x39')]+'%'};return _0x27ddbf;}})});}_0x201b86=_['merge']({},_0x201b86,_0x490b1b[_0x57a5('0x3c')]);var _0x1efc07={'where':_0x201b86['where']};return db[_0x57a5('0x3d')][_0x57a5('0x19')](_0x1efc07)[_0x57a5('0x21')](function(_0x287cd4){_0x1c4f16[_0x57a5('0x19')]=_0x287cd4;if(_0x490b1b[_0x57a5('0x2d')][_0x57a5('0x3e')]){_0x201b86[_0x57a5('0x3f')]=[{'all':!![]}];}return db[_0x57a5('0x3d')][_0x57a5('0x40')](_0x201b86);})['then'](function(_0x3e6653){_0x1c4f16[_0x57a5('0x41')]=_0x3e6653;return _0x1c4f16;})[_0x57a5('0x21')](respondWithFilteredResult(_0x2652f2,_0x201b86))[_0x57a5('0x42')](handleError(_0x2652f2,null));};exports[_0x57a5('0x43')]=function(_0x1a0260,_0x325b95){var _0x45489e={'raw':!![],'where':{'id':_0x1a0260[_0x57a5('0x44')]['id']}},_0xc66575={};_0xc66575[_0x57a5('0x31')]=_[_0x57a5('0x2e')](db[_0x57a5('0x3d')][_0x57a5('0x29')]);_0xc66575['query']=_['keys'](_0x1a0260['query']);_0xc66575[_0x57a5('0x2f')]=_[_0x57a5('0x30')](_0xc66575[_0x57a5('0x31')],_0xc66575[_0x57a5('0x2d')]);_0x45489e[_0x57a5('0x32')]=_[_0x57a5('0x30')](_0xc66575['model'],qs['fields'](_0x1a0260[_0x57a5('0x2d')][_0x57a5('0x33')]));_0x45489e[_0x57a5('0x32')]=_0x45489e['attributes'][_0x57a5('0x45')]?_0x45489e[_0x57a5('0x32')]:_0xc66575['model'];if(_0x1a0260['query'][_0x57a5('0x3e')]){_0x45489e[_0x57a5('0x3f')]=[{'all':!![]}];}_0x45489e=_[_0x57a5('0x46')]({},_0x45489e,_0x1a0260[_0x57a5('0x3c')]);return db['VoiceTransferReport'][_0x57a5('0x47')](_0x45489e)['then'](handleEntityNotFound(_0x325b95,null))[_0x57a5('0x21')](respondWithResult(_0x325b95,null))[_0x57a5('0x42')](handleError(_0x325b95,null));};exports[_0x57a5('0x48')]=function(_0x40465b,_0xd30fb7){return db[_0x57a5('0x3d')]['create'](_0x40465b[_0x57a5('0x49')],{})[_0x57a5('0x21')](respondWithResult(_0xd30fb7,0xc9))[_0x57a5('0x42')](handleError(_0xd30fb7,null));};exports[_0x57a5('0x20')]=function(_0x38c894,_0xf492c9){if(_0x38c894[_0x57a5('0x49')]['id']){delete _0x38c894[_0x57a5('0x49')]['id'];}return db[_0x57a5('0x3d')][_0x57a5('0x47')]({'where':{'id':_0x38c894[_0x57a5('0x44')]['id']}})['then'](handleEntityNotFound(_0xf492c9,null))[_0x57a5('0x21')](saveUpdates(_0x38c894[_0x57a5('0x49')],null))['then'](respondWithResult(_0xf492c9,null))[_0x57a5('0x42')](handleError(_0xf492c9,null));};exports[_0x57a5('0x22')]=function(_0x403c5e,_0x5462e9){return db['VoiceTransferReport'][_0x57a5('0x47')]({'where':{'id':_0x403c5e['params']['id']}})['then'](handleEntityNotFound(_0x5462e9,null))['then'](removeEntity(_0x5462e9,null))[_0x57a5('0x42')](handleError(_0x5462e9,null));};exports[_0x57a5('0x4a')]=function(_0x32d8d2,_0x5d4326){return db['VoiceTransferReport'][_0x57a5('0x4a')]()[_0x57a5('0x21')](respondWithResult(_0x5d4326,null))[_0x57a5('0x42')](handleError(_0x5d4326,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9a79b54..21735b2 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 _0xd7c1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x50890a,_0x3f4250){var _0x4579b6=function(_0x2538da){while(--_0x2538da){_0x50890a['push'](_0x50890a['shift']());}};_0x4579b6(++_0x3f4250);}(_0xd7c1,0xa5));var _0x1d7c=function(_0x409122,_0x1045f0){_0x409122=_0x409122-0x0;var _0x272667=_0xd7c1[_0x409122];return _0x272667;};'use strict';var _=require(_0x1d7c('0x0'));var util=require(_0x1d7c('0x1'));var logger=require(_0x1d7c('0x2'))(_0x1d7c('0x3'));var moment=require(_0x1d7c('0x4'));var BPromise=require(_0x1d7c('0x5'));var rp=require(_0x1d7c('0x6'));var fs=require('fs');var path=require(_0x1d7c('0x7'));var rimraf=require(_0x1d7c('0x8'));var config=require(_0x1d7c('0x9'));var attributes=require(_0x1d7c('0xa'));module[_0x1d7c('0xb')]=function(_0x4eedd8,_0xfcdfbd){return _0x4eedd8[_0x1d7c('0xc')](_0x1d7c('0xd'),attributes,{'tableName':_0x1d7c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fd=['bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x425b76,_0x3b07a9){var _0x10a2bb=function(_0x3725f3){while(--_0x3725f3){_0x425b76['push'](_0x425b76['shift']());}};_0x10a2bb(++_0x3b07a9);}(_0xc4fd,0x167));var _0xdc4f=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0xc4fd[_0x491cbe];return _0x59449d;};'use strict';var _=require(_0xdc4f('0x0'));var util=require(_0xdc4f('0x1'));var logger=require(_0xdc4f('0x2'))(_0xdc4f('0x3'));var moment=require(_0xdc4f('0x4'));var BPromise=require(_0xdc4f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc4f('0x6'));var rimraf=require(_0xdc4f('0x7'));var config=require(_0xdc4f('0x8'));var attributes=require(_0xdc4f('0x9'));module[_0xdc4f('0xa')]=function(_0x54c2d1,_0x2ccec7){return _0x54c2d1[_0xdc4f('0xb')](_0xdc4f('0xc'),attributes,{'tableName':_0xdc4f('0xd'),'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 22f1bfb..14edd99 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 _0x8d37=['result','CreateVoiceTransferReport','body','options','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x40f7ff,_0x37d4c3){var _0x333640=function(_0x29eefd){while(--_0x29eefd){_0x40f7ff['push'](_0x40f7ff['shift']());}};_0x333640(++_0x37d4c3);}(_0x8d37,0xbc));var _0x78d3=function(_0x5aa826,_0x2e1085){_0x5aa826=_0x5aa826-0x0;var _0x5a8d33=_0x8d37[_0x5aa826];return _0x5a8d33;};'use strict';var _=require(_0x78d3('0x0'));var util=require('util');var moment=require(_0x78d3('0x1'));var BPromise=require(_0x78d3('0x2'));var rs=require(_0x78d3('0x3'));var fs=require('fs');var Redis=require(_0x78d3('0x4'));var db=require(_0x78d3('0x5'))['db'];var utils=require(_0x78d3('0x6'));var logger=require(_0x78d3('0x7'))('rpc');var config=require(_0x78d3('0x8'));var jayson=require(_0x78d3('0x9'));var client=jayson['client'][_0x78d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22de5a,_0x48311a,_0x2a4b3c){return new BPromise(function(_0x41c2a4,_0x1d3167){return client[_0x78d3('0xb')](_0x22de5a,_0x2a4b3c)[_0x78d3('0xc')](function(_0x464636){logger['info'](_0x78d3('0xd'),_0x48311a,_0x78d3('0xe'));logger[_0x78d3('0xf')](_0x78d3('0x10'),_0x48311a,_0x78d3('0xe'),JSON['stringify'](_0x464636));if(_0x464636[_0x78d3('0x11')]){if(_0x464636[_0x78d3('0x11')][_0x78d3('0x12')]===0x1f4){logger[_0x78d3('0x11')](_0x78d3('0xd'),_0x48311a,_0x464636[_0x78d3('0x11')][_0x78d3('0x13')]);return _0x1d3167(_0x464636['error'][_0x78d3('0x13')]);}logger[_0x78d3('0x11')](_0x78d3('0xd'),_0x48311a,_0x464636['error'][_0x78d3('0x13')]);return _0x41c2a4(_0x464636['error'][_0x78d3('0x13')]);}else{logger['info'](_0x78d3('0xd'),_0x48311a,'request\x20sent');_0x41c2a4(_0x464636[_0x78d3('0x14')][_0x78d3('0x13')]);}})['catch'](function(_0x55608f){logger[_0x78d3('0x11')](_0x78d3('0xd'),_0x48311a,_0x55608f);_0x1d3167(_0x55608f);});});}exports[_0x78d3('0x15')]=function(_0x481766){var _0x55e489=this;return new Promise(function(_0x4110c6,_0x4a9a76){return db['VoiceTransferReport']['create'](_0x481766[_0x78d3('0x16')],{'raw':_0x481766[_0x78d3('0x17')]?_0x481766[_0x78d3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x78d3('0xc')](function(_0x131b3d){logger['info'](_0x78d3('0x15'),_0x481766);logger[_0x78d3('0xf')](_0x78d3('0x15'),_0x481766,JSON[_0x78d3('0x18')](_0x131b3d));_0x4110c6(_0x131b3d);})[_0x78d3('0x19')](function(_0x821ed8){logger[_0x78d3('0x11')](_0x78d3('0x15'),_0x821ed8[_0x78d3('0x13')],_0x481766);_0x4a9a76(_0x55e489[_0x78d3('0x11')](0x1f4,_0x821ed8['message']));});});}; \ No newline at end of file +var _0xf197=['CreateVoiceTransferReport','create','body','options','stringify','lodash','util','moment','ioredis','rpc','client','http','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x5948b5,_0x4db0eb){var _0x4ce64b=function(_0x51fd01){while(--_0x51fd01){_0x5948b5['push'](_0x5948b5['shift']());}};_0x4ce64b(++_0x4db0eb);}(_0xf197,0x130));var _0x7f19=function(_0x4c4e79,_0x3ebd96){_0x4c4e79=_0x4c4e79-0x0;var _0x13962b=_0xf197[_0x4c4e79];return _0x13962b;};'use strict';var _=require(_0x7f19('0x0'));var util=require(_0x7f19('0x1'));var moment=require(_0x7f19('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f19('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f19('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7f19('0x5')][_0x7f19('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39b5b1,_0x1851e3,_0x39c494){return new BPromise(function(_0x2ebbfb,_0x3c349c){return client['request'](_0x39b5b1,_0x39c494)[_0x7f19('0x7')](function(_0x116b95){logger[_0x7f19('0x8')]('VoiceTransferReport,\x20%s,\x20%s',_0x1851e3,_0x7f19('0x9'));logger[_0x7f19('0xa')](_0x7f19('0xb'),_0x1851e3,_0x7f19('0x9'),JSON['stringify'](_0x116b95));if(_0x116b95[_0x7f19('0xc')]){if(_0x116b95['error'][_0x7f19('0xd')]===0x1f4){logger[_0x7f19('0xc')](_0x7f19('0xe'),_0x1851e3,_0x116b95['error']['message']);return _0x3c349c(_0x116b95[_0x7f19('0xc')][_0x7f19('0xf')]);}logger[_0x7f19('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x1851e3,_0x116b95[_0x7f19('0xc')][_0x7f19('0xf')]);return _0x2ebbfb(_0x116b95['error'][_0x7f19('0xf')]);}else{logger[_0x7f19('0x8')](_0x7f19('0xe'),_0x1851e3,'request\x20sent');_0x2ebbfb(_0x116b95[_0x7f19('0x10')]['message']);}})[_0x7f19('0x11')](function(_0x2cc098){logger[_0x7f19('0xc')](_0x7f19('0xe'),_0x1851e3,_0x2cc098);_0x3c349c(_0x2cc098);});});}exports[_0x7f19('0x12')]=function(_0x5c56a1){var _0x27634b=this;return new Promise(function(_0x3b38d7,_0x122a9f){return db['VoiceTransferReport'][_0x7f19('0x13')](_0x5c56a1[_0x7f19('0x14')],{'raw':_0x5c56a1[_0x7f19('0x15')]?_0x5c56a1[_0x7f19('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x7f19('0x7')](function(_0xb8a760){logger[_0x7f19('0x8')](_0x7f19('0x12'),_0x5c56a1);logger['debug'](_0x7f19('0x12'),_0x5c56a1,JSON[_0x7f19('0x16')](_0xb8a760));_0x3b38d7(_0xb8a760);})[_0x7f19('0x11')](function(_0x5168be){logger[_0x7f19('0xc')]('CreateVoiceTransferReport',_0x5168be[_0x7f19('0xf')],_0x5c56a1);_0x122a9f(_0x27634b[_0x7f19('0xc')](0x1f4,_0x5168be[_0x7f19('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index cf1d488..1958713 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 _0xbd50=['../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','hangup','/answer','/hold','hold','/calls','calls','/transfer','transfer','exports','express','Router'];(function(_0x231e5a,_0x1718f8){var _0x216a7d=function(_0x212271){while(--_0x212271){_0x231e5a['push'](_0x231e5a['shift']());}};_0x216a7d(++_0x1718f8);}(_0xbd50,0x196));var _0x0bd5=function(_0x4b77ee,_0x1eac1e){_0x4b77ee=_0x4b77ee-0x0;var _0x41780a=_0xbd50[_0x4b77ee];return _0x41780a;};'use strict';var express=require(_0x0bd5('0x0'));var router=express[_0x0bd5('0x1')]();var auth=require(_0x0bd5('0x2'));var controller=require('./webbar.controller');router[_0x0bd5('0x3')](_0x0bd5('0x4'),auth[_0x0bd5('0x5')](),auth[_0x0bd5('0x6')](),controller[_0x0bd5('0x7')]);router['post']('/hangup',auth['isAuthenticated'](),auth[_0x0bd5('0x6')](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x3')](_0x0bd5('0x9'),auth[_0x0bd5('0x5')](),auth['canUpdate'](),controller['answer']);router[_0x0bd5('0x3')](_0x0bd5('0xa'),auth[_0x0bd5('0x5')](),auth['canUpdate'](),controller[_0x0bd5('0xb')]);router[_0x0bd5('0x3')]('/unhold',auth[_0x0bd5('0x5')](),auth[_0x0bd5('0x6')](),controller['unhold']);router[_0x0bd5('0x3')](_0x0bd5('0xc'),auth[_0x0bd5('0x5')](),auth['canUpdate'](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0x3')](_0x0bd5('0xe'),auth[_0x0bd5('0x5')](),auth[_0x0bd5('0x6')](),controller[_0x0bd5('0xf')]);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0xa7b4=['unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','post','/originate','/hangup','canUpdate','hangup','/answer','isAuthenticated','answer','/hold','hold'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x45fe42,_0x1aa6a0){_0x45fe42=_0x45fe42-0x0;var _0x1cdae0=_0xa7b4[_0x45fe42];return _0x1cdae0;};'use strict';var express=require('express');var router=express[_0x4a7b('0x0')]();var auth=require(_0x4a7b('0x1'));var controller=require('./webbar.controller');router[_0x4a7b('0x2')](_0x4a7b('0x3'),auth['isAuthenticated'](),auth['canUpdate'](),controller['originate']);router[_0x4a7b('0x2')](_0x4a7b('0x4'),auth['isAuthenticated'](),auth[_0x4a7b('0x5')](),controller[_0x4a7b('0x6')]);router[_0x4a7b('0x2')](_0x4a7b('0x7'),auth[_0x4a7b('0x8')](),auth[_0x4a7b('0x5')](),controller[_0x4a7b('0x9')]);router[_0x4a7b('0x2')](_0x4a7b('0xa'),auth[_0x4a7b('0x8')](),auth[_0x4a7b('0x5')](),controller[_0x4a7b('0xb')]);router[_0x4a7b('0x2')]('/unhold',auth[_0x4a7b('0x8')](),auth['canUpdate'](),controller[_0x4a7b('0xc')]);router[_0x4a7b('0x2')](_0x4a7b('0xd'),auth[_0x4a7b('0x8')](),auth['canUpdate'](),controller['calls']);router[_0x4a7b('0x2')](_0x4a7b('0xe'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4a7b('0xf')]);module[_0x4a7b('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0a9ec4f..304ba7d 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 _0xcebf=['userId','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','ioredis','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows','length','sessionId\x20','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!'];(function(_0x10a0f6,_0x57f290){var _0x94c73a=function(_0x3952c3){while(--_0x3952c3){_0x10a0f6['push'](_0x10a0f6['shift']());}};_0x94c73a(++_0x57f290);}(_0xcebf,0x1a0));var _0xfceb=function(_0x4d9858,_0x1aa734){_0x4d9858=_0x4d9858-0x0;var _0x1600d4=_0xcebf[_0x4d9858];return _0x1600d4;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xfceb('0x0'));var db=require(_0xfceb('0x1'))['db'];var config=require(_0xfceb('0x2'));var util=require(_0xfceb('0x3'));var BPromise=require(_0xfceb('0x4'));var jayson=require(_0xfceb('0x5'));var amiClient=jayson[_0xfceb('0x6')][_0xfceb('0x7')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xfceb('0x8'));config[_0xfceb('0x9')]=_['defaults'](config[_0xfceb('0x9')],{'host':_0xfceb('0xa'),'port':0x18eb});var io=require(_0xfceb('0xb'))(new Redis(config[_0xfceb('0x9')]));var Schema=require(_0xfceb('0xc'));var originateValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xfceb('0xe'),'required':[!![],_0xfceb('0xf')]},'callerId':{'type':_0xfceb('0xe')},'callbackUrl':{'type':_0xfceb('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],_0xfceb('0x10')]},'sessionId':{'type':_0xfceb('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],_0xfceb('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],_0xfceb('0x10')]},'sessionId':{'type':'string','required':[!![],_0xfceb('0x11')]},'transferNumber':{'type':_0xfceb('0xe'),'required':[!![],_0xfceb('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],_0xfceb('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],_0xfceb('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfceb('0xd'),'required':[!![],_0xfceb('0x10')]}});function emit(_0x271875,_0x6cfd42,_0x120a91){logger[_0xfceb('0x13')](_0x271875,_0x6cfd42,JSON[_0xfceb('0x14')](_0x120a91));io['to'](_0x271875)['emit'](_0x6cfd42,_0x120a91);}function handleError(_0x33b4e7){return function(_0x69fdb){console[_0xfceb('0x15')](_0xfceb('0x16'),_0x69fdb,_0x69fdb instanceof RangeError);logger['error'](_0x69fdb['stack']);if(_0x69fdb instanceof RangeError){if(_0x69fdb[_0xfceb('0x17')]){delete _0x69fdb[_0xfceb('0x17')];}_0x33b4e7[_0xfceb('0x18')](0x194)[_0xfceb('0x19')](_0x69fdb);}else{if(_0x69fdb[_0xfceb('0x17')]){delete _0x69fdb[_0xfceb('0x17')];}_0x33b4e7['status'](0x1f4)['send'](_0x69fdb);}};}function checkError(){return function(_0x42ec14){if(!_0x42ec14){throw new RangeError(_0xfceb('0x1a'));}return _0x42ec14;};}function respondWithRpcPromise(_0x30d1fe,_0x583a30){return new BPromise(function(_0x4cb7d3,_0x39612a){var _0x135f52=amiClient;return _0x135f52[_0xfceb('0x1b')](_0x30d1fe,_0x583a30)[_0xfceb('0x1c')](function(_0x4f3f08){if(_0x4f3f08[_0xfceb('0x1d')]){if(_0x4f3f08[_0xfceb('0x1d')][_0xfceb('0x1e')]===0x1f4){return _0x39612a(_0x4f3f08[_0xfceb('0x1d')]['message']);}return _0x4cb7d3(_0x4f3f08[_0xfceb('0x1d')][_0xfceb('0x1f')]);}else{_0x4cb7d3(_0x4f3f08[_0xfceb('0x20')]);}})[_0xfceb('0x21')](function(_0x5ac0de){_0x39612a(_0x5ac0de);});});}function getAgent(_0x2f8c84){return db[_0xfceb('0x22')][_0xfceb('0x23')]({'where':{'id':_0x2f8c84,'role':_0xfceb('0x24')}})[_0xfceb('0x1c')](checkError());}function getAgentCheckSession(_0x197c08,_0x1064b5){return new BPromise(function(_0x540edf,_0x3a3c7b){var _0x5e9982=respondWithRpcPromise(_0xfceb('0x25'));var _0x30fc93=getAgent(_0x197c08);Promise['all']([_0x5e9982,_0x30fc93])[_0xfceb('0x1c')](function(_0x3fd367){var _0x4e0f18=_0x3fd367[0x0];var _0x573acb=_0x3fd367[0x1];var _0x3f8145=_[_0xfceb('0x26')](_0x4e0f18[_0xfceb('0x27')],function(_0x4cba65){return _0x4cba65['UserId']==_0x573acb['id']&&_0x4cba65['sessionId']==_0x1064b5;});if(_0x3f8145[_0xfceb('0x28')]==0x1){_0x540edf(_0x573acb);}else{_0x3a3c7b(new RangeError(_0xfceb('0x29')+_0x1064b5+'\x20not\x20found!'));}});});}exports['originate']=function(_0xba02ea,_0x3ffd26){logger[_0xfceb('0x13')](_0xfceb('0x2a'),_0xba02ea[_0xfceb('0x2b')]);var _0x2ba659=originateValidation[_0xfceb('0xc')](_0xba02ea[_0xfceb('0x2b')]);if(_0x2ba659[_0xfceb('0x28')]>0x0){return _0x3ffd26[_0xfceb('0x18')](0x190)[_0xfceb('0x2c')](_0x2ba659);}var _0x35aa12=_0xba02ea[_0xfceb('0x2b')]['userId'];var _0x1798a8=_0xba02ea[_0xfceb('0x2b')][_0xfceb('0x2d')];var _0x5b9993=_0xba02ea[_0xfceb('0x2b')][_0xfceb('0x2e')];var _0x593acc=_0xba02ea['body'][_0xfceb('0x2f')];return getAgent(_0x35aa12)['then'](function(_0x53ceb0){logger[_0xfceb('0x13')](_0xfceb('0x30'),_0x53ceb0['name']);emit(util['format'](_0xfceb('0x31'),_0x53ceb0['name']),_0xfceb('0x32'),{'callNumber':_0x1798a8,'callerId':_0x5b9993,'callbackUrl':_0x593acc});return _0x3ffd26[_0xfceb('0x18')](0xc8)[_0xfceb('0x2c')]({'error':![],'message':_0xfceb('0x33')});})['catch'](handleError(_0x3ffd26));};exports['hangup']=function(_0x1a8034,_0x63bbba){logger[_0xfceb('0x13')]('hangup\x20fired:',_0x1a8034['body']);var _0x4f679c=hangupValidation[_0xfceb('0xc')](_0x1a8034[_0xfceb('0x2b')]);if(_0x4f679c['length']>0x0){return _0x63bbba[_0xfceb('0x18')](0x190)[_0xfceb('0x2c')](_0x4f679c);}var _0x4c3c32=_0x1a8034[_0xfceb('0x2b')][_0xfceb('0x34')];var _0x3a9850=_0x1a8034['body'][_0xfceb('0x35')];return getAgent(_0x4c3c32)[_0xfceb('0x1c')](function(_0x272f5a){logger[_0xfceb('0x13')](_0xfceb('0x30'),_0x272f5a[_0xfceb('0x17')]);emit(util['format'](_0xfceb('0x31'),_0x272f5a[_0xfceb('0x17')]),_0xfceb('0x36'),{'sessionId':_0x3a9850});return _0x63bbba[_0xfceb('0x18')](0xc8)[_0xfceb('0x2c')]({'error':![],'message':_0xfceb('0x37')});})[_0xfceb('0x21')](handleError(_0x63bbba));};exports[_0xfceb('0x38')]=function(_0x5e65fc,_0x16a147){logger[_0xfceb('0x13')](_0xfceb('0x39'),_0x5e65fc[_0xfceb('0x2b')]);var _0x24d4ff=answerValidation[_0xfceb('0xc')](_0x5e65fc[_0xfceb('0x2b')]);if(_0x24d4ff[_0xfceb('0x28')]>0x0){return _0x16a147['status'](0x190)[_0xfceb('0x2c')](_0x24d4ff);}var _0x46fab0=_0x5e65fc[_0xfceb('0x2b')][_0xfceb('0x34')];var _0x58658e=_0x5e65fc['body'][_0xfceb('0x35')];return getAgent(_0x46fab0)[_0xfceb('0x1c')](function(_0x2e749e){logger[_0xfceb('0x13')]('entityFound:',_0x2e749e[_0xfceb('0x17')]);emit(util[_0xfceb('0x3a')](_0xfceb('0x31'),_0x2e749e[_0xfceb('0x17')]),_0xfceb('0x3b'),{'sessionId':_0x58658e});return _0x16a147['status'](0xc8)[_0xfceb('0x2c')]({'error':![],'message':_0xfceb('0x3c')});})[_0xfceb('0x21')](handleError(_0x16a147));};exports['hold']=function(_0x45f8f8,_0x2527c2){logger[_0xfceb('0x13')](_0xfceb('0x3d'),_0x45f8f8[_0xfceb('0x2b')]);var _0x1ede84=holdValidation[_0xfceb('0xc')](_0x45f8f8['body']);if(_0x1ede84[_0xfceb('0x28')]>0x0){return _0x2527c2['status'](0x190)[_0xfceb('0x2c')](_0x1ede84);}var _0x21015a=_0x45f8f8['body'][_0xfceb('0x34')];var _0x1b6c21=_0x45f8f8['body']['sessionId'];return getAgent(_0x21015a)[_0xfceb('0x1c')](function(_0x397848){logger[_0xfceb('0x13')](_0xfceb('0x30'),_0x397848[_0xfceb('0x17')]);emit(util[_0xfceb('0x3a')](_0xfceb('0x31'),_0x397848[_0xfceb('0x17')]),_0xfceb('0x3e'),{'sessionId':_0x1b6c21});return _0x2527c2[_0xfceb('0x18')](0xc8)['json']({'error':![],'message':_0xfceb('0x3f')});})[_0xfceb('0x21')](handleError(_0x2527c2));};exports[_0xfceb('0x40')]=function(_0x565688,_0x58014e){logger[_0xfceb('0x13')](_0xfceb('0x41'),_0x565688[_0xfceb('0x2b')]);var _0x1af1a8=unholdValidation[_0xfceb('0xc')](_0x565688[_0xfceb('0x2b')]);if(_0x1af1a8[_0xfceb('0x28')]>0x0){return _0x58014e['status'](0x190)[_0xfceb('0x2c')](_0x1af1a8);}var _0x7bbf2c=_0x565688[_0xfceb('0x2b')][_0xfceb('0x34')];var _0x34d5d0=_0x565688[_0xfceb('0x2b')][_0xfceb('0x35')];return getAgent(_0x7bbf2c)[_0xfceb('0x1c')](function(_0x23dbb8){logger[_0xfceb('0x13')](_0xfceb('0x30'),_0x23dbb8[_0xfceb('0x17')]);emit(util['format'](_0xfceb('0x31'),_0x23dbb8[_0xfceb('0x17')]),_0xfceb('0x42'),{'sessionId':_0x34d5d0});return _0x58014e[_0xfceb('0x18')](0xc8)[_0xfceb('0x2c')]({'error':![],'message':_0xfceb('0x43')});})[_0xfceb('0x21')](handleError(_0x58014e));};exports[_0xfceb('0x44')]=function(_0x4797e8,_0x2e7a82){logger['info'](_0xfceb('0x45'),_0x2e7a82[_0xfceb('0x2b')]);var _0x120a96=callsValidation[_0xfceb('0xc')](_0x4797e8[_0xfceb('0x2b')]);if(_0x120a96[_0xfceb('0x28')]>0x0){return _0x2e7a82[_0xfceb('0x18')](0x190)[_0xfceb('0x2c')](_0x120a96);}var _0x314ed1=_0x4797e8['body'][_0xfceb('0x34')];var _0x3ae094=respondWithRpcPromise(_0xfceb('0x25'));var _0x43110c=getAgent(_0x314ed1);return Promise[_0xfceb('0x46')]([_0x3ae094,_0x43110c])[_0xfceb('0x1c')](function(_0xbd0d42){var _0x440648=_0xbd0d42[0x0];var _0x342a08=_0xbd0d42[0x1];var _0x487401=_[_0xfceb('0x26')](_0x440648[_0xfceb('0x27')],function(_0x1ac4b5){return _0x1ac4b5['UserId']==_0x342a08['id'];});return _0x2e7a82[_0xfceb('0x18')](0xc8)[_0xfceb('0x2c')]({'count':_0x487401[_0xfceb('0x28')],'rows':_0x487401});})[_0xfceb('0x21')](handleError(_0x2e7a82));};exports[_0xfceb('0x47')]=function(_0x5e76e3,_0xe0e997){logger['info'](_0xfceb('0x48'),_0x5e76e3[_0xfceb('0x2b')]);var _0x44b5d4=conferenceValidation[_0xfceb('0xc')](_0x5e76e3[_0xfceb('0x2b')]);if(_0x44b5d4['length']>0x0){return _0xe0e997[_0xfceb('0x18')](0x190)['json'](_0x44b5d4);}var _0x5bdbdd=_0x5e76e3['body'][_0xfceb('0x34')];return getAgent(_0x5bdbdd)[_0xfceb('0x1c')](function(_0x3f7f35){logger[_0xfceb('0x13')](_0xfceb('0x30'),_0x3f7f35[_0xfceb('0x17')]);emit(util[_0xfceb('0x3a')](_0xfceb('0x31'),_0x3f7f35['name']),'webbar:conference');return _0xe0e997['status'](0xc8)[_0xfceb('0x2c')]({'error':![],'message':_0xfceb('0x49')});})[_0xfceb('0x21')](handleError(_0xe0e997));};exports[_0xfceb('0x4a')]=function(_0x16f837,_0x459e88){logger[_0xfceb('0x13')](_0xfceb('0x4b'),_0x16f837['body']);var _0x1eac58=transferValidation['validate'](_0x16f837[_0xfceb('0x2b')]);if(_0x1eac58[_0xfceb('0x28')]>0x0){return _0x459e88['status'](0x190)[_0xfceb('0x2c')](_0x1eac58);}var _0x4231a8=_0x16f837[_0xfceb('0x2b')][_0xfceb('0x34')];var _0x29307f=_0x16f837[_0xfceb('0x2b')][_0xfceb('0x35')];var _0x41bf02=_0x16f837[_0xfceb('0x2b')][_0xfceb('0x4c')];return getAgent(_0x4231a8)['then'](function(_0x4a3cc0){logger[_0xfceb('0x13')]('entityFound:',_0x4a3cc0['name']);emit(util[_0xfceb('0x3a')](_0xfceb('0x31'),_0x4a3cc0[_0xfceb('0x17')]),_0xfceb('0x4d'),{'sessionId':_0x29307f,'transferNumber':_0x41bf02});return _0x459e88[_0xfceb('0x18')](0xc8)[_0xfceb('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0xfceb('0x21')](handleError(_0x459e88));}; \ No newline at end of file +var _0x4133=['calls\x20fired:','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','then','error','code','message','result','catch','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','format','webbar:originate','json','originate\x20executed!','hangup','entityFound:','webbar:hangup','answer','answer\x20fired:','user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20executed!'];(function(_0x367ae3,_0xe5cac0){var _0x18e134=function(_0x529fdc){while(--_0x529fdc){_0x367ae3['push'](_0x367ae3['shift']());}};_0x18e134(++_0xe5cac0);}(_0x4133,0x17a));var _0x3413=function(_0x1ac0dd,_0x5a1e5f){_0x1ac0dd=_0x1ac0dd-0x0;var _0x31fc81=_0x4133[_0x1ac0dd];return _0x31fc81;};'use strict';var path=require(_0x3413('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x3413('0x1'));var util=require(_0x3413('0x2'));var BPromise=require(_0x3413('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3413('0x4')][_0x3413('0x5')]({'port':0x232a});var logger=require(_0x3413('0x6'))(_0x3413('0x7'));var Redis=require(_0x3413('0x8'));config[_0x3413('0x9')]=_[_0x3413('0xa')](config[_0x3413('0x9')],{'host':_0x3413('0xb'),'port':0x18eb});var io=require(_0x3413('0xc'))(new Redis(config[_0x3413('0x9')]));var Schema=require(_0x3413('0xd'));var originateValidation=new Schema({'userId':{'type':_0x3413('0xe'),'required':[!![],_0x3413('0xf')]},'callNumber':{'type':_0x3413('0x10'),'required':[!![],_0x3413('0x11')]},'callerId':{'type':_0x3413('0x10')},'callbackUrl':{'type':_0x3413('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3413('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3413('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3413('0xe'),'required':[!![],_0x3413('0xf')]},'sessionId':{'type':_0x3413('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3413('0xf')]},'sessionId':{'type':_0x3413('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3413('0xe'),'required':[!![],_0x3413('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3413('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3413('0xf')]}});function emit(_0x58d4c8,_0x5250aa,_0x271269){logger[_0x3413('0x12')](_0x58d4c8,_0x5250aa,JSON[_0x3413('0x13')](_0x271269));io['to'](_0x58d4c8)[_0x3413('0x14')](_0x5250aa,_0x271269);}function handleError(_0xbb973c){return function(_0x2643c1){console[_0x3413('0x15')](_0x3413('0x16'),_0x2643c1,_0x2643c1 instanceof RangeError);logger['error'](_0x2643c1[_0x3413('0x17')]);if(_0x2643c1 instanceof RangeError){if(_0x2643c1[_0x3413('0x18')]){delete _0x2643c1[_0x3413('0x18')];}_0xbb973c[_0x3413('0x19')](0x194)['send'](_0x2643c1);}else{if(_0x2643c1['name']){delete _0x2643c1[_0x3413('0x18')];}_0xbb973c[_0x3413('0x19')](0x1f4)['send'](_0x2643c1);}};}function checkError(){return function(_0x24f53d){if(!_0x24f53d){throw new RangeError('NotFound');}return _0x24f53d;};}function respondWithRpcPromise(_0x4d1e68,_0x36183e){return new BPromise(function(_0x401caf,_0x5ae9ce){var _0x4a1f08=amiClient;return _0x4a1f08['request'](_0x4d1e68,_0x36183e)[_0x3413('0x1a')](function(_0x5488a5){if(_0x5488a5[_0x3413('0x1b')]){if(_0x5488a5[_0x3413('0x1b')][_0x3413('0x1c')]===0x1f4){return _0x5ae9ce(_0x5488a5[_0x3413('0x1b')]['message']);}return _0x401caf(_0x5488a5[_0x3413('0x1b')][_0x3413('0x1d')]);}else{_0x401caf(_0x5488a5[_0x3413('0x1e')]);}})[_0x3413('0x1f')](function(_0x112cf8){_0x5ae9ce(_0x112cf8);});});}function getAgent(_0x439812){return db[_0x3413('0x20')]['findOne']({'where':{'id':_0x439812,'role':_0x3413('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x2a6a27,_0x1f902a){return new BPromise(function(_0x4cb8c7,_0xc9e022){var _0x452aae=respondWithRpcPromise(_0x3413('0x22'));var _0x1cab54=getAgent(_0x2a6a27);Promise[_0x3413('0x23')]([_0x452aae,_0x1cab54])[_0x3413('0x1a')](function(_0x2485b4){var _0x4b7a02=_0x2485b4[0x0];var _0x4039aa=_0x2485b4[0x1];var _0x43d978=_[_0x3413('0x24')](_0x4b7a02[_0x3413('0x25')],function(_0x403b83){return _0x403b83[_0x3413('0x26')]==_0x4039aa['id']&&_0x403b83[_0x3413('0x27')]==_0x1f902a;});if(_0x43d978[_0x3413('0x28')]==0x1){_0x4cb8c7(_0x4039aa);}else{_0xc9e022(new RangeError(_0x3413('0x29')+_0x1f902a+_0x3413('0x2a')));}});});}exports[_0x3413('0x2b')]=function(_0x519504,_0xeab71d){logger[_0x3413('0x12')](_0x3413('0x2c'),_0x519504[_0x3413('0x2d')]);var _0x405b10=originateValidation[_0x3413('0xd')](_0x519504[_0x3413('0x2d')]);if(_0x405b10['length']>0x0){return _0xeab71d[_0x3413('0x19')](0x190)['json'](_0x405b10);}var _0x4a099c=_0x519504['body'][_0x3413('0x2e')];var _0x5a8dbb=_0x519504[_0x3413('0x2d')][_0x3413('0x2f')];var _0x489801=_0x519504[_0x3413('0x2d')]['callerId'];var _0x1c3ee9=_0x519504['body'][_0x3413('0x30')];return getAgent(_0x4a099c)[_0x3413('0x1a')](function(_0x3dc8f6){logger['info']('entityFound:',_0x3dc8f6[_0x3413('0x18')]);emit(util[_0x3413('0x31')]('user:%s',_0x3dc8f6[_0x3413('0x18')]),_0x3413('0x32'),{'callNumber':_0x5a8dbb,'callerId':_0x489801,'callbackUrl':_0x1c3ee9});return _0xeab71d[_0x3413('0x19')](0xc8)[_0x3413('0x33')]({'error':![],'message':_0x3413('0x34')});})[_0x3413('0x1f')](handleError(_0xeab71d));};exports[_0x3413('0x35')]=function(_0x3a07e3,_0xf6560a){logger[_0x3413('0x12')]('hangup\x20fired:',_0x3a07e3['body']);var _0x18f42a=hangupValidation[_0x3413('0xd')](_0x3a07e3['body']);if(_0x18f42a['length']>0x0){return _0xf6560a[_0x3413('0x19')](0x190)['json'](_0x18f42a);}var _0x5d7078=_0x3a07e3[_0x3413('0x2d')][_0x3413('0x2e')];var _0x324a60=_0x3a07e3['body'][_0x3413('0x27')];return getAgent(_0x5d7078)[_0x3413('0x1a')](function(_0x56ed71){logger[_0x3413('0x12')](_0x3413('0x36'),_0x56ed71['name']);emit(util[_0x3413('0x31')]('user:%s',_0x56ed71[_0x3413('0x18')]),_0x3413('0x37'),{'sessionId':_0x324a60});return _0xf6560a[_0x3413('0x19')](0xc8)[_0x3413('0x33')]({'error':![],'message':'hangup\x20executed!'});})[_0x3413('0x1f')](handleError(_0xf6560a));};exports[_0x3413('0x38')]=function(_0x42fde5,_0x2ae7d9){logger[_0x3413('0x12')](_0x3413('0x39'),_0x42fde5[_0x3413('0x2d')]);var _0x2a82ab=answerValidation[_0x3413('0xd')](_0x42fde5[_0x3413('0x2d')]);if(_0x2a82ab[_0x3413('0x28')]>0x0){return _0x2ae7d9[_0x3413('0x19')](0x190)[_0x3413('0x33')](_0x2a82ab);}var _0x3913c0=_0x42fde5[_0x3413('0x2d')][_0x3413('0x2e')];var _0xa5bea8=_0x42fde5[_0x3413('0x2d')][_0x3413('0x27')];return getAgent(_0x3913c0)['then'](function(_0x344892){logger[_0x3413('0x12')](_0x3413('0x36'),_0x344892['name']);emit(util[_0x3413('0x31')](_0x3413('0x3a'),_0x344892['name']),_0x3413('0x3b'),{'sessionId':_0xa5bea8});return _0x2ae7d9['status'](0xc8)[_0x3413('0x33')]({'error':![],'message':_0x3413('0x3c')});})['catch'](handleError(_0x2ae7d9));};exports[_0x3413('0x3d')]=function(_0x61b733,_0x5941c9){logger[_0x3413('0x12')](_0x3413('0x3e'),_0x61b733['body']);var _0xaf65fe=holdValidation['validate'](_0x61b733['body']);if(_0xaf65fe[_0x3413('0x28')]>0x0){return _0x5941c9[_0x3413('0x19')](0x190)[_0x3413('0x33')](_0xaf65fe);}var _0x118542=_0x61b733[_0x3413('0x2d')]['userId'];var _0x37b864=_0x61b733[_0x3413('0x2d')][_0x3413('0x27')];return getAgent(_0x118542)[_0x3413('0x1a')](function(_0x541c90){logger[_0x3413('0x12')](_0x3413('0x36'),_0x541c90[_0x3413('0x18')]);emit(util[_0x3413('0x31')]('user:%s',_0x541c90[_0x3413('0x18')]),_0x3413('0x3f'),{'sessionId':_0x37b864});return _0x5941c9[_0x3413('0x19')](0xc8)[_0x3413('0x33')]({'error':![],'message':_0x3413('0x40')});})[_0x3413('0x1f')](handleError(_0x5941c9));};exports['unhold']=function(_0x5a7291,_0x4d9dd8){logger[_0x3413('0x12')]('unhold\x20fired:',_0x5a7291[_0x3413('0x2d')]);var _0x44292a=unholdValidation['validate'](_0x5a7291[_0x3413('0x2d')]);if(_0x44292a['length']>0x0){return _0x4d9dd8['status'](0x190)[_0x3413('0x33')](_0x44292a);}var _0x387c92=_0x5a7291[_0x3413('0x2d')][_0x3413('0x2e')];var _0x1bf34a=_0x5a7291[_0x3413('0x2d')][_0x3413('0x27')];return getAgent(_0x387c92)['then'](function(_0x48f146){logger[_0x3413('0x12')](_0x3413('0x36'),_0x48f146[_0x3413('0x18')]);emit(util[_0x3413('0x31')](_0x3413('0x3a'),_0x48f146[_0x3413('0x18')]),'webbar:unhold',{'sessionId':_0x1bf34a});return _0x4d9dd8[_0x3413('0x19')](0xc8)[_0x3413('0x33')]({'error':![],'message':_0x3413('0x41')});})[_0x3413('0x1f')](handleError(_0x4d9dd8));};exports['calls']=function(_0x48225e,_0x1756ee){logger[_0x3413('0x12')](_0x3413('0x42'),_0x1756ee[_0x3413('0x2d')]);var _0x197298=callsValidation[_0x3413('0xd')](_0x48225e[_0x3413('0x2d')]);if(_0x197298[_0x3413('0x28')]>0x0){return _0x1756ee[_0x3413('0x19')](0x190)[_0x3413('0x33')](_0x197298);}var _0x3ff59a=_0x48225e[_0x3413('0x2d')][_0x3413('0x2e')];var _0x335527=respondWithRpcPromise(_0x3413('0x22'));var _0x193d3a=getAgent(_0x3ff59a);return Promise[_0x3413('0x23')]([_0x335527,_0x193d3a])[_0x3413('0x1a')](function(_0x231e2a){var _0x2ff290=_0x231e2a[0x0];var _0x1202d0=_0x231e2a[0x1];var _0x1ab01d=_[_0x3413('0x24')](_0x2ff290[_0x3413('0x25')],function(_0x223a2e){return _0x223a2e[_0x3413('0x26')]==_0x1202d0['id'];});return _0x1756ee['status'](0xc8)[_0x3413('0x33')]({'count':_0x1ab01d['length'],'rows':_0x1ab01d});})[_0x3413('0x1f')](handleError(_0x1756ee));};exports['conference']=function(_0x2f2367,_0x3050de){logger[_0x3413('0x12')](_0x3413('0x43'),_0x2f2367[_0x3413('0x2d')]);var _0x3050da=conferenceValidation[_0x3413('0xd')](_0x2f2367[_0x3413('0x2d')]);if(_0x3050da[_0x3413('0x28')]>0x0){return _0x3050de[_0x3413('0x19')](0x190)[_0x3413('0x33')](_0x3050da);}var _0x164a90=_0x2f2367['body'][_0x3413('0x2e')];return getAgent(_0x164a90)['then'](function(_0x579528){logger[_0x3413('0x12')](_0x3413('0x36'),_0x579528[_0x3413('0x18')]);emit(util[_0x3413('0x31')]('user:%s',_0x579528[_0x3413('0x18')]),_0x3413('0x44'));return _0x3050de[_0x3413('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3050de));};exports[_0x3413('0x45')]=function(_0x5d819b,_0x50d8eb){logger['info'](_0x3413('0x46'),_0x5d819b[_0x3413('0x2d')]);var _0x2b108a=transferValidation[_0x3413('0xd')](_0x5d819b[_0x3413('0x2d')]);if(_0x2b108a['length']>0x0){return _0x50d8eb['status'](0x190)[_0x3413('0x33')](_0x2b108a);}var _0xf04e99=_0x5d819b['body'][_0x3413('0x2e')];var _0x334f76=_0x5d819b[_0x3413('0x2d')][_0x3413('0x27')];var _0x4d179c=_0x5d819b[_0x3413('0x2d')][_0x3413('0x47')];return getAgent(_0xf04e99)[_0x3413('0x1a')](function(_0x337573){logger['info'](_0x3413('0x36'),_0x337573[_0x3413('0x18')]);emit(util[_0x3413('0x31')](_0x3413('0x3a'),_0x337573['name']),_0x3413('0x48'),{'sessionId':_0x334f76,'transferNumber':_0x4d179c});return _0x50d8eb['status'](0xc8)['json']({'error':![],'message':_0x3413('0x49')});})[_0x3413('0x1f')](handleError(_0x50d8eb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c3d3758..c5d81f8 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 _0xfff0=['/:id','show','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','describe'];(function(_0x2fcf21,_0x1e19ff){var _0x34ea40=function(_0x55ca7f){while(--_0x55ca7f){_0x2fcf21['push'](_0x2fcf21['shift']());}};_0x34ea40(++_0x1e19ff);}(_0xfff0,0x139));var _0x0fff=function(_0x567794,_0x59573e){_0x567794=_0x567794-0x0;var _0xc6855=_0xfff0[_0x567794];return _0xc6855;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require('../../config/environment');var controller=require(_0x0fff('0x6'));router[_0x0fff('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fff('0x8')]);router[_0x0fff('0x7')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xa')]);router['get'](_0x0fff('0xb'),auth['isAuthenticated'](),controller[_0x0fff('0xc')]);router[_0x0fff('0x7')]('/:id/dispositions',auth[_0x0fff('0xd')](),controller[_0x0fff('0xe')]);router[_0x0fff('0x7')](_0x0fff('0xf'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x10')]);router[_0x0fff('0x7')](_0x0fff('0x11'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x12')]);router[_0x0fff('0x7')]('/:id/applications',auth[_0x0fff('0xd')](),controller['getApplications']);router[_0x0fff('0x13')]('/',auth[_0x0fff('0xd')](),controller[_0x0fff('0x14')]);router[_0x0fff('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0fff('0x15')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0fff('0x16')]);router[_0x0fff('0x13')]('/:id/users',auth[_0x0fff('0xd')](),controller[_0x0fff('0x17')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x0fff('0x18')]);router[_0x0fff('0x13')](_0x0fff('0x19'),controller[_0x0fff('0x1a')]);router[_0x0fff('0x13')](_0x0fff('0x1b'),auth['isAuthenticated'](),controller[_0x0fff('0x1c')]);router[_0x0fff('0x1d')](_0x0fff('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0fff('0x1e')](_0x0fff('0xb'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x1f')]);router['delete'](_0x0fff('0x20'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x21')]);router[_0x0fff('0x1e')](_0x0fff('0xf'),auth[_0x0fff('0xd')](),controller['removeAnswers']);router[_0x0fff('0x1e')](_0x0fff('0x11'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x22')]);module[_0x0fff('0x23')]=router; \ No newline at end of file +var _0x6343=['create','addAnswer','addApplications','/:id/notify','notify','send','update','delete','destroy','removeDispositions','removeAgents','exports','path','connect-timeout','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','/describe','/:id','show','get','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post'];(function(_0x42b881,_0x3037a2){var _0x1d6a6a=function(_0x196da8){while(--_0x196da8){_0x42b881['push'](_0x42b881['shift']());}};_0x1d6a6a(++_0x3037a2);}(_0x6343,0x168));var _0x3634=function(_0x8e84ca,_0x2e2230){_0x8e84ca=_0x8e84ca-0x0;var _0x12f83e=_0x6343[_0x8e84ca];return _0x12f83e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3634('0x2'));var controller=require(_0x3634('0x3'));router['get']('/',auth[_0x3634('0x4')](),controller[_0x3634('0x5')]);router['get'](_0x3634('0x6'),auth[_0x3634('0x4')](),controller['describe']);router['get'](_0x3634('0x7'),auth[_0x3634('0x4')](),controller[_0x3634('0x8')]);router[_0x3634('0x9')](_0x3634('0xa'),auth[_0x3634('0x4')](),controller['getDispositions']);router['get'](_0x3634('0xb'),auth[_0x3634('0x4')](),controller['getAnswers']);router[_0x3634('0x9')](_0x3634('0xc'),auth[_0x3634('0x4')](),controller[_0x3634('0xd')]);router[_0x3634('0x9')](_0x3634('0xe'),auth[_0x3634('0x4')](),controller[_0x3634('0xf')]);router[_0x3634('0x10')]('/',auth[_0x3634('0x4')](),controller[_0x3634('0x11')]);router[_0x3634('0x10')](_0x3634('0xa'),auth[_0x3634('0x4')](),controller['addDisposition']);router[_0x3634('0x10')]('/:id/canned_answers',auth[_0x3634('0x4')](),controller[_0x3634('0x12')]);router[_0x3634('0x10')](_0x3634('0xc'),auth[_0x3634('0x4')](),controller['addAgents']);router[_0x3634('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3634('0x13')]);router['post'](_0x3634('0x14'),controller[_0x3634('0x15')]);router[_0x3634('0x10')]('/:id/send',auth[_0x3634('0x4')](),controller[_0x3634('0x16')]);router['put'](_0x3634('0x7'),auth['isAuthenticated'](),controller[_0x3634('0x17')]);router[_0x3634('0x18')]('/:id',auth[_0x3634('0x4')](),controller[_0x3634('0x19')]);router[_0x3634('0x18')]('/:id/dispositions',auth[_0x3634('0x4')](),controller[_0x3634('0x1a')]);router['delete'](_0x3634('0xb'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3634('0x18')](_0x3634('0xc'),auth['isAuthenticated'](),controller[_0x3634('0x1b')]);module[_0x3634('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index db9db7d..35694d2 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 _0x48ba=['twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','ENUM'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x48ba,0xbe));var _0xa48b=function(_0x36d0a8,_0x345cfb){_0x36d0a8=_0x36d0a8-0x0;var _0xf78ed1=_0x48ba[_0x36d0a8];return _0xf78ed1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa48b('0x0'));module[_0xa48b('0x1')]={'name':{'type':Sequelize[_0xa48b('0x2')],'unique':_0xa48b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa48b('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xa48b('0x2')]},'type':{'type':Sequelize[_0xa48b('0x4')](_0xa48b('0x5'))},'accountSid':{'type':Sequelize[_0xa48b('0x2')]},'authToken':{'type':Sequelize[_0xa48b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa48b('0x6')],'defaultValue':function(){return _0xa48b('0x7');}},'notificationSound':{'type':Sequelize[_0xa48b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa48b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa48b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa48b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa48b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa48b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa48b('0x9')],'comment':_0xa48b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa48b('0x8')],'defaultValue':![],'comment':_0xa48b('0xb'),'set':function(_0xb06996){if(!_0xb06996){this[_0xa48b('0xc')](_0xa48b('0xd'),null);}this[_0xa48b('0xc')](_0xa48b('0xe'),_0xb06996);}},'description':{'type':Sequelize[_0xa48b('0x2')]}}; \ No newline at end of file +var _0xb141=['STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb141,0xd7));var _0x1b14=function(_0x85db44,_0x36e0b9){_0x85db44=_0x85db44-0x0;var _0x1742e=_0xb141[_0x85db44];return _0x1742e;};'use strict';var Sequelize=require(_0x1b14('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x1b14('0x1')],'unique':_0x1b14('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1b14('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1b14('0x3')]();}},'phone':{'type':Sequelize[_0x1b14('0x1')]},'type':{'type':Sequelize[_0x1b14('0x4')](_0x1b14('0x5'))},'accountSid':{'type':Sequelize[_0x1b14('0x1')]},'authToken':{'type':Sequelize[_0x1b14('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1b14('0x6')],'defaultValue':function(){return _0x1b14('0x7');}},'notificationSound':{'type':Sequelize[_0x1b14('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1b14('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1b14('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1b14('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b14('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b14('0x9')],'comment':_0x1b14('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc27fbe){if(!_0xc27fbe){this[_0x1b14('0xb')]('mandatoryDispositionPauseId',null);}this[_0x1b14('0xb')]('mandatoryDisposition',_0xc27fbe);}},'description':{'type':Sequelize[_0x1b14('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ef57dcc..05c682e 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 _0xee43=['ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','WhatsappAccount','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x402b19,_0x224241){var _0x13da47=function(_0x34cb5b){while(--_0x34cb5b){_0x402b19['push'](_0x402b19['shift']());}};_0x13da47(++_0x224241);}(_0xee43,0xf7));var _0x3ee4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xee43[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x3ee4('0x0'));var emlformat=require(_0x3ee4('0x1'));var rimraf=require(_0x3ee4('0x2'));var zipdir=require(_0x3ee4('0x3'));var jsonpatch=require(_0x3ee4('0x4'));var rp=require(_0x3ee4('0x5'));var moment=require(_0x3ee4('0x6'));var BPromise=require(_0x3ee4('0x7'));var Mustache=require(_0x3ee4('0x8'));var util=require(_0x3ee4('0x9'));var path=require('path');var sox=require(_0x3ee4('0xa'));var csv=require(_0x3ee4('0xb'));var ejs=require(_0x3ee4('0xc'));var fs=require('fs');var _=require(_0x3ee4('0xd'));var squel=require(_0x3ee4('0xe'));var crypto=require(_0x3ee4('0xf'));var jsforce=require(_0x3ee4('0x10'));var deskjs=require(_0x3ee4('0x11'));var toCsv=require(_0x3ee4('0xb'));var querystring=require(_0x3ee4('0x12'));var Papa=require(_0x3ee4('0x13'));var Redis=require(_0x3ee4('0x14'));var authService=require(_0x3ee4('0x15'));var qs=require(_0x3ee4('0x16'));var as=require(_0x3ee4('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ee4('0x18'));var utils=require(_0x3ee4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3ee4('0x1a'));var db=require(_0x3ee4('0x1b'))['db'];config[_0x3ee4('0x1c')]=_[_0x3ee4('0x1d')](config[_0x3ee4('0x1c')],{'host':_0x3ee4('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3ee4('0x1f'))['register'](socket);var jayson=require(_0x3ee4('0x20'));var client=jayson[_0x3ee4('0x21')][_0x3ee4('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x19dc37,_0x509bac,_0x3aa662,_0x42e683){return new BPromise(function(_0x442ca7,_0x245fd4){var _0x3c947c=_0x42e683||client;return _0x3c947c[_0x3ee4('0x23')](_0x19dc37,_0x3aa662)['then'](function(_0x4b3b9c){logger[_0x3ee4('0x24')](_0x3ee4('0x25'),_0x509bac,_0x3ee4('0x26'));logger[_0x3ee4('0x27')](_0x3ee4('0x28'),_0x509bac,_0x3ee4('0x26'),JSON[_0x3ee4('0x29')](_0x4b3b9c));if(_0x4b3b9c[_0x3ee4('0x2a')]){if(_0x4b3b9c[_0x3ee4('0x2a')][_0x3ee4('0x2b')]===0x1f4){logger[_0x3ee4('0x2a')](_0x3ee4('0x25'),_0x509bac,_0x4b3b9c['error'][_0x3ee4('0x2c')]);return _0x245fd4(_0x4b3b9c[_0x3ee4('0x2a')]['message']);}logger[_0x3ee4('0x2a')](_0x3ee4('0x25'),_0x509bac,_0x4b3b9c[_0x3ee4('0x2a')][_0x3ee4('0x2c')]);return _0x442ca7(_0x4b3b9c[_0x3ee4('0x2a')][_0x3ee4('0x2c')]);}else{logger['info'](_0x3ee4('0x25'),_0x509bac,'request\x20sent');_0x442ca7(_0x4b3b9c['result'][_0x3ee4('0x2c')]);}})[_0x3ee4('0x2d')](function(_0x19c2c8){logger[_0x3ee4('0x2a')](_0x3ee4('0x25'),_0x509bac,_0x19c2c8);_0x245fd4(_0x19c2c8);});});}function respondWithStatusCode(_0x1237d4,_0xede475){_0xede475=_0xede475||0xcc;return function(_0x4dc263){if(_0x4dc263){return _0x1237d4[_0x3ee4('0x2e')](_0xede475);}return _0x1237d4[_0x3ee4('0x2f')](_0xede475)[_0x3ee4('0x30')]();};}function respondWithResult(_0x4fbd06,_0x158e45){_0x158e45=_0x158e45||0xc8;return function(_0x3e4962){if(_0x3e4962){return _0x4fbd06['status'](_0x158e45)[_0x3ee4('0x31')](_0x3e4962);}};}function respondWithFilteredResult(_0x148878,_0x2a3293){return function(_0x4d1df9){if(_0x4d1df9){var _0x2b05ab=_0x4d1df9[_0x3ee4('0x32')],_0x1f553c=_0x2a3293[_0x3ee4('0x33')],_0x201d89=_0x2a3293[_0x3ee4('0x33')]+_0x2a3293[_0x3ee4('0x34')],_0x1be9c3;if(_0x201d89>=_0x2b05ab){_0x201d89=_0x2b05ab;_0x1be9c3=0xc8;}else{_0x1be9c3=0xce;}_0x148878[_0x3ee4('0x2f')](_0x1be9c3);return _0x148878[_0x3ee4('0x35')](_0x3ee4('0x36'),_0x1f553c+'-'+_0x201d89+'/'+_0x2b05ab)[_0x3ee4('0x31')](_0x4d1df9);}return null;};}function patchUpdates(_0xc7b09a){return function(_0x3852d5){try{jsonpatch[_0x3ee4('0x37')](_0x3852d5,_0xc7b09a,!![]);}catch(_0x5a6111){return BPromise[_0x3ee4('0x38')](_0x5a6111);}return _0x3852d5[_0x3ee4('0x39')]();};}function saveUpdates(_0x226e9c,_0x4248ff){return function(_0x3ac284){if(_0x3ac284){return _0x3ac284[_0x3ee4('0x3a')](_0x226e9c)[_0x3ee4('0x3b')](function(_0x324d56){return _0x324d56;});}return null;};}function removeEntity(_0x38d714,_0x4b8c27){return function(_0x40ded6){if(_0x40ded6){return _0x40ded6[_0x3ee4('0x3c')]()[_0x3ee4('0x3b')](function(){var _0x43e087=_0x40ded6['get']({'plain':!![]});var _0x1d3ce9=_0x3ee4('0x3d');return db[_0x3ee4('0x3e')]['destroy']({'where':{'type':_0x1d3ce9,'resourceId':_0x43e087['id']}})[_0x3ee4('0x3b')](function(){return _0x40ded6;});})['then'](function(){_0x38d714[_0x3ee4('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x157002,_0x13a9b0){return function(_0xdf5224){if(!_0xdf5224){_0x157002['sendStatus'](0x194);}return _0xdf5224;};}function handleError(_0x1a23e5,_0x1ce5ee){_0x1ce5ee=_0x1ce5ee||0x1f4;return function(_0x432919){logger[_0x3ee4('0x2a')](_0x432919['stack']);if(_0x432919[_0x3ee4('0x3f')]){delete _0x432919['name'];}_0x1a23e5[_0x3ee4('0x2f')](_0x1ce5ee)[_0x3ee4('0x40')](_0x432919);};}exports[_0x3ee4('0x41')]=function(_0x4d171b,_0x476543){var _0x13fc6={'include':[{'model':db[_0x3ee4('0x42')],'as':_0x3ee4('0x43')}]},_0x14a8e3={},_0x590ccb={'count':0x0,'rows':[]};var _0xb4d5ef=_[_0x3ee4('0x44')](db['WhatsappAccount']['rawAttributes'],function(_0x3736dd){return{'name':_0x3736dd[_0x3ee4('0x45')],'type':_0x3736dd[_0x3ee4('0x46')][_0x3ee4('0x47')]};});_0x14a8e3[_0x3ee4('0x48')]=_[_0x3ee4('0x44')](_0xb4d5ef,_0x3ee4('0x3f'));_0x14a8e3[_0x3ee4('0x49')]=_[_0x3ee4('0x4a')](_0x4d171b['query']);_0x14a8e3[_0x3ee4('0x4b')]=_[_0x3ee4('0x4c')](_0x14a8e3[_0x3ee4('0x48')],_0x14a8e3[_0x3ee4('0x49')]);_0x13fc6[_0x3ee4('0x4d')]=_['intersection'](_0x14a8e3[_0x3ee4('0x48')],qs[_0x3ee4('0x4e')](_0x4d171b['query'][_0x3ee4('0x4e')]));_0x13fc6[_0x3ee4('0x4d')]=_0x13fc6[_0x3ee4('0x4d')][_0x3ee4('0x4f')]?_0x13fc6['attributes']:_0x14a8e3[_0x3ee4('0x48')];if(!_0x4d171b[_0x3ee4('0x49')][_0x3ee4('0x50')]('nolimit')){_0x13fc6['limit']=qs[_0x3ee4('0x34')](_0x4d171b['query']['limit']);_0x13fc6[_0x3ee4('0x33')]=qs[_0x3ee4('0x33')](_0x4d171b[_0x3ee4('0x49')][_0x3ee4('0x33')]);}_0x13fc6[_0x3ee4('0x51')]=qs[_0x3ee4('0x52')](_0x4d171b[_0x3ee4('0x49')][_0x3ee4('0x52')]);_0x13fc6[_0x3ee4('0x53')]=qs['filters'](_[_0x3ee4('0x54')](_0x4d171b['query'],_0x14a8e3[_0x3ee4('0x4b')]),_0xb4d5ef);if(_0x4d171b[_0x3ee4('0x49')]['filter']){_0x13fc6[_0x3ee4('0x53')]=_[_0x3ee4('0x55')](_0x13fc6['where'],{'$or':_[_0x3ee4('0x44')](_0xb4d5ef,function(_0x5a1552){if(_0x5a1552[_0x3ee4('0x46')]!=='VIRTUAL'){var _0x3bebc5={};_0x3bebc5[_0x5a1552[_0x3ee4('0x3f')]]={'$like':'%'+_0x4d171b[_0x3ee4('0x49')]['filter']+'%'};return _0x3bebc5;}})});}_0x13fc6=_['merge']({},_0x13fc6,_0x4d171b[_0x3ee4('0x56')]);var _0x1371fd={'where':_0x13fc6[_0x3ee4('0x53')]};return db[_0x3ee4('0x57')][_0x3ee4('0x32')](_0x1371fd)[_0x3ee4('0x3b')](function(_0x3eb0e3){_0x590ccb[_0x3ee4('0x32')]=_0x3eb0e3;if(_0x4d171b[_0x3ee4('0x49')][_0x3ee4('0x58')]){_0x13fc6[_0x3ee4('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x3ee4('0x5a')](_0x13fc6);})['then'](function(_0x19d342){_0x590ccb[_0x3ee4('0x5b')]=_0x19d342;return _0x590ccb;})[_0x3ee4('0x3b')](respondWithFilteredResult(_0x476543,_0x13fc6))[_0x3ee4('0x2d')](handleError(_0x476543,null));};exports[_0x3ee4('0x5c')]=function(_0x5e53c3,_0x31ed6a){var _0x5b644c={'raw':![],'where':{'id':_0x5e53c3[_0x3ee4('0x5d')]['id']},'include':[{'model':db[_0x3ee4('0x42')],'as':_0x3ee4('0x43')}]},_0x4d0f86={};_0x4d0f86[_0x3ee4('0x48')]=_[_0x3ee4('0x4a')](db[_0x3ee4('0x57')][_0x3ee4('0x5e')]);_0x4d0f86[_0x3ee4('0x49')]=_[_0x3ee4('0x4a')](_0x5e53c3['query']);_0x4d0f86['filters']=_[_0x3ee4('0x4c')](_0x4d0f86[_0x3ee4('0x48')],_0x4d0f86[_0x3ee4('0x49')]);_0x5b644c[_0x3ee4('0x4d')]=_[_0x3ee4('0x4c')](_0x4d0f86['model'],qs[_0x3ee4('0x4e')](_0x5e53c3['query'][_0x3ee4('0x4e')]));_0x5b644c[_0x3ee4('0x4d')]=_0x5b644c[_0x3ee4('0x4d')]['length']?_0x5b644c['attributes']:_0x4d0f86['model'];if(_0x5e53c3['query']['includeAll']){_0x5b644c['include']=[{'all':!![]}];}_0x5b644c=_[_0x3ee4('0x55')]({},_0x5b644c,_0x5e53c3[_0x3ee4('0x56')]);return db[_0x3ee4('0x57')][_0x3ee4('0x5f')](_0x5b644c)[_0x3ee4('0x3b')](handleEntityNotFound(_0x31ed6a,null))[_0x3ee4('0x3b')](respondWithResult(_0x31ed6a,null))[_0x3ee4('0x2d')](handleError(_0x31ed6a,null));};exports[_0x3ee4('0x60')]=function(_0x21e85d,_0x4cedfa){return db[_0x3ee4('0x57')][_0x3ee4('0x60')](_0x21e85d['body'],{})[_0x3ee4('0x3b')](function(_0x42be29){var _0x4a2533=_0x21e85d['user'][_0x3ee4('0x61')]({'plain':!![]});if(!_0x4a2533)throw new Error(_0x3ee4('0x62'));if(_0x4a2533[_0x3ee4('0x63')]==='user'){var _0x3a174c=_0x42be29['get']({'plain':!![]});var _0x100fb6=_0x3ee4('0x3d');return db[_0x3ee4('0x64')]['find']({'where':{'name':_0x100fb6,'userProfileId':_0x4a2533[_0x3ee4('0x65')]},'raw':!![]})['then'](function(_0x4c7309){if(_0x4c7309&&_0x4c7309['autoAssociation']===0x0){return db[_0x3ee4('0x3e')][_0x3ee4('0x60')]({'name':_0x3a174c[_0x3ee4('0x3f')],'resourceId':_0x3a174c['id'],'type':_0x4c7309['name'],'sectionId':_0x4c7309['id']},{})[_0x3ee4('0x3b')](function(){return _0x42be29;});}else{return _0x42be29;}})[_0x3ee4('0x2d')](function(_0x311321){logger['error'](_0x3ee4('0x66'),_0x311321);throw _0x311321;});}return _0x42be29;})['then'](respondWithResult(_0x4cedfa,0xc9))[_0x3ee4('0x2d')](handleError(_0x4cedfa,null));};exports[_0x3ee4('0x3a')]=function(_0x10f98f,_0x4a7b30){if(_0x10f98f[_0x3ee4('0x67')]['id']){delete _0x10f98f[_0x3ee4('0x67')]['id'];}return db[_0x3ee4('0x57')]['find']({'where':{'id':_0x10f98f[_0x3ee4('0x5d')]['id']},'include':[{'model':db[_0x3ee4('0x42')],'as':_0x3ee4('0x43')}]})['then'](handleEntityNotFound(_0x4a7b30,null))[_0x3ee4('0x3b')](saveUpdates(_0x10f98f['body'],null))['then'](respondWithResult(_0x4a7b30,null))[_0x3ee4('0x2d')](handleError(_0x4a7b30,null));};exports['destroy']=function(_0x2ee7e4,_0x65e52f){return db[_0x3ee4('0x57')][_0x3ee4('0x5f')]({'where':{'id':_0x2ee7e4[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x65e52f,null))[_0x3ee4('0x3b')](removeEntity(_0x65e52f,null))['catch'](handleError(_0x65e52f,null));};exports[_0x3ee4('0x68')]=function(_0x3cbc80,_0x45af34){return db[_0x3ee4('0x57')]['describe']()['then'](respondWithResult(_0x45af34,null))[_0x3ee4('0x2d')](handleError(_0x45af34,null));};exports['addDisposition']=function(_0x166ced,_0x27ce4e,_0x444328){if(_0x166ced[_0x3ee4('0x67')]['id']){delete _0x166ced['body']['id'];}return db[_0x3ee4('0x57')][_0x3ee4('0x5f')]({'where':{'id':_0x166ced[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x27ce4e,null))[_0x3ee4('0x3b')](function(_0x1765bf){if(_0x1765bf){_0x166ced[_0x3ee4('0x67')][_0x3ee4('0x69')]=_0x1765bf['id'];return db[_0x3ee4('0x6a')][_0x3ee4('0x60')](_0x166ced[_0x3ee4('0x67')]);}})[_0x3ee4('0x3b')](respondWithResult(_0x27ce4e,null))['catch'](handleError(_0x27ce4e,null));};exports[_0x3ee4('0x6b')]=function(_0x1a19c0,_0x412860,_0x576c2c){var _0x2557e6={'raw':![],'where':{}};var _0x4af8e8={};var _0x47538a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ee4('0x6c')]({'where':{'id':_0x1a19c0[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x412860,null))[_0x3ee4('0x3b')](function(_0x5de28f){if(_0x5de28f){_0x4af8e8[_0x3ee4('0x48')]=_[_0x3ee4('0x4a')](db['Disposition'][_0x3ee4('0x5e')]);_0x4af8e8[_0x3ee4('0x49')]=_[_0x3ee4('0x4a')](_0x1a19c0[_0x3ee4('0x49')]);_0x4af8e8[_0x3ee4('0x4b')]=_[_0x3ee4('0x4c')](_0x4af8e8[_0x3ee4('0x48')],_0x4af8e8['query']);_0x2557e6[_0x3ee4('0x4d')]=_[_0x3ee4('0x4c')](_0x4af8e8[_0x3ee4('0x48')],qs[_0x3ee4('0x4e')](_0x1a19c0[_0x3ee4('0x49')]['fields']));_0x2557e6[_0x3ee4('0x4d')]=_0x2557e6[_0x3ee4('0x4d')]['length']?_0x2557e6[_0x3ee4('0x4d')]:_0x4af8e8[_0x3ee4('0x48')];if(!_0x1a19c0[_0x3ee4('0x49')]['hasOwnProperty'](_0x3ee4('0x6d'))){_0x2557e6[_0x3ee4('0x34')]=qs[_0x3ee4('0x34')](_0x1a19c0[_0x3ee4('0x49')]['limit']);_0x2557e6[_0x3ee4('0x33')]=qs[_0x3ee4('0x33')](_0x1a19c0[_0x3ee4('0x49')]['offset']);}_0x2557e6['order']=qs[_0x3ee4('0x52')](_0x1a19c0[_0x3ee4('0x49')][_0x3ee4('0x52')]);_0x2557e6['where']=qs[_0x3ee4('0x4b')](_[_0x3ee4('0x54')](_0x1a19c0[_0x3ee4('0x49')],_0x4af8e8[_0x3ee4('0x4b')]));_0x2557e6['where'][_0x3ee4('0x69')]=_0x5de28f['id'];if(_0x1a19c0[_0x3ee4('0x49')][_0x3ee4('0x6e')]){_0x2557e6[_0x3ee4('0x53')]=_[_0x3ee4('0x55')](_0x2557e6[_0x3ee4('0x53')],{'$or':_[_0x3ee4('0x44')](_0x2557e6['attributes'],function(_0x580f25){var _0x1e4bdf={};_0x1e4bdf[_0x580f25]={'$like':'%'+_0x1a19c0[_0x3ee4('0x49')][_0x3ee4('0x6e')]+'%'};return _0x1e4bdf;})});}_0x2557e6=_[_0x3ee4('0x55')]({},_0x2557e6,_0x1a19c0['options']);return db[_0x3ee4('0x6a')]['count']({'where':_0x2557e6[_0x3ee4('0x53')]})[_0x3ee4('0x3b')](function(_0x4f27e6){_0x47538a[_0x3ee4('0x32')]=_0x4f27e6;if(_0x1a19c0[_0x3ee4('0x49')][_0x3ee4('0x58')]){_0x2557e6['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2557e6);})['then'](function(_0x35b188){_0x47538a['rows']=_0x35b188;return _0x47538a;});}})[_0x3ee4('0x3b')](respondWithFilteredResult(_0x412860,_0x2557e6))[_0x3ee4('0x2d')](handleError(_0x412860,null));};exports['removeDispositions']=function(_0x17cb35,_0x5aaf70,_0x12f39b){return db[_0x3ee4('0x57')][_0x3ee4('0x5f')]({'where':{'id':_0x17cb35['params']['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x5aaf70,null))[_0x3ee4('0x3b')](function(_0x551766){if(_0x551766){return _0x551766[_0x3ee4('0x6f')](_0x17cb35[_0x3ee4('0x49')][_0x3ee4('0x70')]);}})[_0x3ee4('0x3b')](respondWithStatusCode(_0x5aaf70,null))[_0x3ee4('0x2d')](handleError(_0x5aaf70,null));};exports[_0x3ee4('0x71')]=function(_0x265bd9,_0x2822aa,_0x41ce5b){if(_0x265bd9[_0x3ee4('0x67')]['id']){delete _0x265bd9[_0x3ee4('0x67')]['id'];}return db[_0x3ee4('0x57')][_0x3ee4('0x5f')]({'where':{'id':_0x265bd9[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x2822aa,null))[_0x3ee4('0x3b')](function(_0x3d204f){if(_0x3d204f){_0x265bd9[_0x3ee4('0x67')][_0x3ee4('0x69')]=_0x3d204f['id'];return db['CannedAnswer'][_0x3ee4('0x60')](_0x265bd9['body']);}})[_0x3ee4('0x3b')](respondWithResult(_0x2822aa,null))[_0x3ee4('0x2d')](handleError(_0x2822aa,null));};exports['getAnswers']=function(_0x359c25,_0x976e18,_0x28788e){var _0x113eb0={'raw':![],'where':{}};var _0x42eda7={};var _0x513dc2={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x359c25[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x976e18,null))[_0x3ee4('0x3b')](function(_0xfd9507){if(_0xfd9507){_0x42eda7[_0x3ee4('0x48')]=_['keys'](db[_0x3ee4('0x72')][_0x3ee4('0x5e')]);_0x42eda7[_0x3ee4('0x49')]=_['keys'](_0x359c25[_0x3ee4('0x49')]);_0x42eda7[_0x3ee4('0x4b')]=_[_0x3ee4('0x4c')](_0x42eda7[_0x3ee4('0x48')],_0x42eda7[_0x3ee4('0x49')]);_0x113eb0[_0x3ee4('0x4d')]=_[_0x3ee4('0x4c')](_0x42eda7[_0x3ee4('0x48')],qs[_0x3ee4('0x4e')](_0x359c25[_0x3ee4('0x49')][_0x3ee4('0x4e')]));_0x113eb0[_0x3ee4('0x4d')]=_0x113eb0[_0x3ee4('0x4d')][_0x3ee4('0x4f')]?_0x113eb0[_0x3ee4('0x4d')]:_0x42eda7[_0x3ee4('0x48')];if(!_0x359c25[_0x3ee4('0x49')][_0x3ee4('0x50')](_0x3ee4('0x6d'))){_0x113eb0['limit']=qs[_0x3ee4('0x34')](_0x359c25['query'][_0x3ee4('0x34')]);_0x113eb0[_0x3ee4('0x33')]=qs[_0x3ee4('0x33')](_0x359c25[_0x3ee4('0x49')]['offset']);}_0x113eb0['order']=qs[_0x3ee4('0x52')](_0x359c25[_0x3ee4('0x49')][_0x3ee4('0x52')]);_0x113eb0['where']=qs['filters'](_[_0x3ee4('0x54')](_0x359c25[_0x3ee4('0x49')],_0x42eda7[_0x3ee4('0x4b')]));_0x113eb0[_0x3ee4('0x53')][_0x3ee4('0x69')]=_0xfd9507['id'];if(_0x359c25[_0x3ee4('0x49')][_0x3ee4('0x6e')]){_0x113eb0[_0x3ee4('0x53')]=_[_0x3ee4('0x55')](_0x113eb0[_0x3ee4('0x53')],{'$or':_[_0x3ee4('0x44')](_0x113eb0[_0x3ee4('0x4d')],function(_0x6d34b7){var _0x3abfea={};_0x3abfea[_0x6d34b7]={'$like':'%'+_0x359c25[_0x3ee4('0x49')][_0x3ee4('0x6e')]+'%'};return _0x3abfea;})});}_0x113eb0=_[_0x3ee4('0x55')]({},_0x113eb0,_0x359c25[_0x3ee4('0x56')]);return db['CannedAnswer'][_0x3ee4('0x32')]({'where':_0x113eb0[_0x3ee4('0x53')]})[_0x3ee4('0x3b')](function(_0x4b7d6d){_0x513dc2[_0x3ee4('0x32')]=_0x4b7d6d;if(_0x359c25['query'][_0x3ee4('0x58')]){_0x113eb0[_0x3ee4('0x59')]=[{'all':!![]}];}return db[_0x3ee4('0x72')]['findAll'](_0x113eb0);})[_0x3ee4('0x3b')](function(_0x1786f5){_0x513dc2['rows']=_0x1786f5;return _0x513dc2;});}})[_0x3ee4('0x3b')](respondWithFilteredResult(_0x976e18,_0x113eb0))[_0x3ee4('0x2d')](handleError(_0x976e18,null));};exports[_0x3ee4('0x73')]=function(_0x4bd53b,_0x4070de,_0xd49b0d){return db[_0x3ee4('0x57')]['find']({'where':{'id':_0x4bd53b[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x4070de,null))[_0x3ee4('0x3b')](function(_0x227d30){if(_0x227d30){return _0x227d30[_0x3ee4('0x73')](_0x4bd53b['query']['ids']);}})[_0x3ee4('0x3b')](respondWithStatusCode(_0x4070de,null))[_0x3ee4('0x2d')](handleError(_0x4070de,null));};exports[_0x3ee4('0x74')]=function(_0x32193a,_0x32f4e7,_0x6c7f59){return db[_0x3ee4('0x57')][_0x3ee4('0x5f')]({'where':{'id':_0x32193a[_0x3ee4('0x5d')]['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x32f4e7,null))[_0x3ee4('0x3b')](function(_0x239731){if(_0x239731){return _0x239731[_0x3ee4('0x74')](_0x32193a[_0x3ee4('0x67')][_0x3ee4('0x70')],_[_0x3ee4('0x75')](_0x32193a[_0x3ee4('0x67')],['ids','id'])||{})['spread'](function(_0x5b355b){for(var _0x572fc8=0x0;_0x572fc8<_0x32193a[_0x3ee4('0x67')][_0x3ee4('0x70')][_0x3ee4('0x4f')];_0x572fc8+=0x1){socket['emit'](_0x3ee4('0x76'),{'UserId':_0x32193a[_0x3ee4('0x67')][_0x3ee4('0x70')][_0x572fc8],'WhatsappAccountId':_0x32193a[_0x3ee4('0x5d')]['id']});}return _0x5b355b;});}})[_0x3ee4('0x3b')](respondWithResult(_0x32f4e7,null))[_0x3ee4('0x2d')](handleError(_0x32f4e7,null));};exports[_0x3ee4('0x77')]=function(_0x202d29,_0x2fc19e,_0x214082){return db[_0x3ee4('0x57')][_0x3ee4('0x5f')]({'where':{'id':_0x202d29[_0x3ee4('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2fc19e,null))[_0x3ee4('0x3b')](function(_0x33c275){if(_0x33c275){return _0x33c275['removeAgents'](_0x202d29[_0x3ee4('0x49')][_0x3ee4('0x70')])[_0x3ee4('0x3b')](function(){if(_[_0x3ee4('0x78')](_0x202d29[_0x3ee4('0x49')][_0x3ee4('0x70')])){for(var _0x541b71=0x0;_0x541b71<_0x202d29[_0x3ee4('0x49')][_0x3ee4('0x70')][_0x3ee4('0x4f')];_0x541b71+=0x1){socket[_0x3ee4('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x202d29[_0x3ee4('0x49')]['ids'][_0x541b71]),'WhatsappAccountId':Number(_0x202d29[_0x3ee4('0x5d')]['id'])});}}else{socket[_0x3ee4('0x79')](_0x3ee4('0x7a'),{'UserId':Number(_0x202d29['query'][_0x3ee4('0x70')]),'WhatsappAccountId':Number(_0x202d29[_0x3ee4('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fc19e,null))[_0x3ee4('0x2d')](handleError(_0x2fc19e,null));};exports['getAgents']=function(_0x279832,_0xc73ea,_0x2963a2){var _0x2f645e={};var _0x4a07a7={};var _0x532fe1;var _0x36e638;return db[_0x3ee4('0x57')]['findOne']({'where':{'id':_0x279832['params']['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0xc73ea,null))[_0x3ee4('0x3b')](function(_0x3cc8d0){if(_0x3cc8d0){_0x532fe1=_0x3cc8d0;_0x4a07a7[_0x3ee4('0x48')]=_[_0x3ee4('0x4a')](db['User'][_0x3ee4('0x5e')]);_0x4a07a7['query']=_['keys'](_0x279832['query']);_0x4a07a7[_0x3ee4('0x4b')]=_[_0x3ee4('0x4c')](_0x4a07a7[_0x3ee4('0x48')],_0x4a07a7[_0x3ee4('0x49')]);_0x2f645e[_0x3ee4('0x4d')]=_[_0x3ee4('0x4c')](_0x4a07a7[_0x3ee4('0x48')],qs[_0x3ee4('0x4e')](_0x279832[_0x3ee4('0x49')]['fields']));_0x2f645e['attributes']=_0x2f645e['attributes'][_0x3ee4('0x4f')]?_0x2f645e['attributes']:_0x4a07a7[_0x3ee4('0x48')];_0x2f645e[_0x3ee4('0x51')]=qs[_0x3ee4('0x52')](_0x279832[_0x3ee4('0x49')][_0x3ee4('0x52')]);_0x2f645e[_0x3ee4('0x53')]=qs[_0x3ee4('0x4b')](_['pick'](_0x279832['query'],_0x4a07a7[_0x3ee4('0x4b')]));if(_0x279832[_0x3ee4('0x49')][_0x3ee4('0x6e')]){_0x2f645e[_0x3ee4('0x53')]=_['merge'](_0x2f645e[_0x3ee4('0x53')],{'$or':_[_0x3ee4('0x44')](_0x2f645e['attributes'],function(_0x3504e1){var _0x47b74f={};_0x47b74f[_0x3504e1]={'$like':'%'+_0x279832[_0x3ee4('0x49')][_0x3ee4('0x6e')]+'%'};return _0x47b74f;})});}_0x2f645e=_['merge']({},_0x2f645e,_0x279832['options']);return _0x532fe1[_0x3ee4('0x7b')](_0x2f645e);}})[_0x3ee4('0x3b')](function(_0x4b4013){if(_0x4b4013){_0x36e638=_0x4b4013['length'];if(!_0x279832['query']['hasOwnProperty'](_0x3ee4('0x6d'))){_0x2f645e[_0x3ee4('0x34')]=qs[_0x3ee4('0x34')](_0x279832[_0x3ee4('0x49')]['limit']);_0x2f645e['offset']=qs['offset'](_0x279832[_0x3ee4('0x49')][_0x3ee4('0x33')]);}return _0x532fe1[_0x3ee4('0x7b')](_0x2f645e);}})[_0x3ee4('0x3b')](function(_0x25f3b5){if(_0x25f3b5){return _0x25f3b5?{'count':_0x36e638,'rows':_0x25f3b5}:null;}})[_0x3ee4('0x3b')](respondWithResult(_0xc73ea,null))[_0x3ee4('0x2d')](handleError(_0xc73ea,null));};exports[_0x3ee4('0x7c')]=function(_0x399dc9,_0x1c996a,_0x3af606){return db[_0x3ee4('0x57')][_0x3ee4('0x6c')]({'where':{'id':_0x399dc9['params']['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x1c996a,null))['then'](function(_0x16737c){if(_0x16737c){return db[_0x3ee4('0x7d')][_0x3ee4('0x7e')](function(_0x240452){return db[_0x3ee4('0x7f')][_0x3ee4('0x3c')]({'where':{'WhatsappAccountId':_0x399dc9[_0x3ee4('0x5d')]['id']},'transaction':_0x240452})['then'](function(_0x1982bf){var _0xf256a9=_['map'](_0x399dc9['body'],function(_0x4614ef){_0x4614ef[_0x3ee4('0x69')]=_0x399dc9[_0x3ee4('0x5d')]['id'];return _0x4614ef;});return db[_0x3ee4('0x7f')][_0x3ee4('0x80')](_0xf256a9,{'transaction':_0x240452});});})[_0x3ee4('0x3b')](function(){return db[_0x3ee4('0x7f')][_0x3ee4('0x81')]({'where':{'WhatsappAccountId':_0x399dc9[_0x3ee4('0x5d')]['id']},'order':'priority'});});}})[_0x3ee4('0x3b')](respondWithResult(_0x1c996a,null))[_0x3ee4('0x2d')](handleError(_0x1c996a,null));};exports[_0x3ee4('0x82')]=function(_0x2be894,_0x44278d,_0x3ab2c0){var _0x805196={};var _0x2cf6f6={};var _0xcd31d5;var _0x1d7b33;return db['WhatsappAccount']['findOne']({'where':{'id':_0x2be894['params']['id']}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x44278d,null))[_0x3ee4('0x3b')](function(_0x536510){if(_0x536510){_0xcd31d5=_0x536510;_0x2cf6f6[_0x3ee4('0x48')]=_[_0x3ee4('0x4a')](db[_0x3ee4('0x7f')]['rawAttributes']);_0x2cf6f6[_0x3ee4('0x49')]=_[_0x3ee4('0x4a')](_0x2be894[_0x3ee4('0x49')]);_0x2cf6f6[_0x3ee4('0x4b')]=_[_0x3ee4('0x4c')](_0x2cf6f6[_0x3ee4('0x48')],_0x2cf6f6[_0x3ee4('0x49')]);_0x805196[_0x3ee4('0x4d')]=_[_0x3ee4('0x4c')](_0x2cf6f6[_0x3ee4('0x48')],qs[_0x3ee4('0x4e')](_0x2be894['query'][_0x3ee4('0x4e')]));_0x805196[_0x3ee4('0x4d')]=_0x805196[_0x3ee4('0x4d')][_0x3ee4('0x4f')]?_0x805196[_0x3ee4('0x4d')]:_0x2cf6f6[_0x3ee4('0x48')];_0x805196[_0x3ee4('0x51')]=qs[_0x3ee4('0x52')](_0x2be894[_0x3ee4('0x49')]['sort']);_0x805196['where']=qs[_0x3ee4('0x4b')](_[_0x3ee4('0x54')](_0x2be894[_0x3ee4('0x49')],_0x2cf6f6[_0x3ee4('0x4b')]));if(_0x2be894['query']['filter']){_0x805196[_0x3ee4('0x53')]=_['merge'](_0x805196[_0x3ee4('0x53')],{'$or':_[_0x3ee4('0x44')](_0x805196[_0x3ee4('0x4d')],function(_0x34724a){var _0x4c6026={};_0x4c6026[_0x34724a]={'$like':'%'+_0x2be894[_0x3ee4('0x49')][_0x3ee4('0x6e')]+'%'};return _0x4c6026;})});}_0x805196=_[_0x3ee4('0x55')]({},_0x805196,_0x2be894['options']);return _0xcd31d5[_0x3ee4('0x82')](_0x805196);}})[_0x3ee4('0x3b')](function(_0x1bd4bb){if(_0x1bd4bb){_0x1d7b33=_0x1bd4bb[_0x3ee4('0x4f')];if(!_0x2be894['query'][_0x3ee4('0x50')](_0x3ee4('0x6d'))){_0x805196[_0x3ee4('0x34')]=qs['limit'](_0x2be894['query']['limit']);_0x805196[_0x3ee4('0x33')]=qs[_0x3ee4('0x33')](_0x2be894[_0x3ee4('0x49')][_0x3ee4('0x33')]);}return _0xcd31d5[_0x3ee4('0x82')](_0x805196);}})['then'](function(_0x2cdc7e){if(_0x2cdc7e){return _0x2cdc7e?{'count':_0x1d7b33,'rows':_0x2cdc7e}:null;}})['then'](respondWithResult(_0x44278d,null))[_0x3ee4('0x2d')](handleError(_0x44278d,null));};exports[_0x3ee4('0x83')]=function(_0x510b9c,_0x1ca4e8,_0x59684d){var _0x2c8e6d={'channel':_0x3ee4('0x84')};var _0x5083c5=[];var _0x2fec05=[];var _0x40edbc={};return db['WhatsappAccount'][_0x3ee4('0x5f')]({'where':{'id':_0x510b9c['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3ee4('0x85')}]})['then'](handleEntityNotFound(_0x1ca4e8,null))[_0x3ee4('0x3b')](function(_0x3ab47b){_0x2c8e6d[_0x3ee4('0x86')]=_0x3ab47b;_0x2c8e6d['applications']=_[_0x3ee4('0x87')](_0x3ab47b['Applications'],[_0x3ee4('0x88')],[_0x3ee4('0x89')]);if(_0x2c8e6d['account']['Applications']){delete _0x2c8e6d[_0x3ee4('0x86')]['Applications'];}return db[_0x3ee4('0x8a')]['describe']();})['then'](function(_0x3ae0d1){if(!_0x3ae0d1){throw new db['Sequelize'][(_0x3ee4('0x8b'))](_0x3ee4('0x8c'));}_0x5083c5=_[_0x3ee4('0x8d')](_[_0x3ee4('0x4a')](_0x3ae0d1),['createdAt','updatedAt']);_0x2fec05=_['difference'](_['keys'](_0x3ae0d1),[_0x3ee4('0x8e'),_0x3ee4('0x8f'),_0x3ee4('0x90'),_0x3ee4('0x91')]);_0x2c8e6d[_0x3ee4('0x67')]={'mapKey':_0x3ee4('0x92')};if(_0x2c8e6d[_0x3ee4('0x86')][_0x3ee4('0x46')]&&_0x2c8e6d[_0x3ee4('0x86')]['type']===_0x3ee4('0x93')){_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x94')]=_0x510b9c[_0x3ee4('0x67')][_0x3ee4('0x95')][_0x3ee4('0x96')](_0x3ee4('0x97'),'');_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x67')]=_0x510b9c[_0x3ee4('0x67')][_0x3ee4('0x98')];_0x2c8e6d['body'][_0x3ee4('0x99')]=_0x510b9c[_0x3ee4('0x67')][_0x3ee4('0x9a')];}if(_0x2c8e6d[_0x3ee4('0x67')]['id']){delete _0x2c8e6d[_0x3ee4('0x67')]['id'];}if(_[_0x3ee4('0x9b')](_0x2c8e6d[_0x3ee4('0x67')]['from'])){throw new db[(_0x3ee4('0x9c'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x3ee4('0x9b')](_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x67')])||_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x67')]===''){throw new db[(_0x3ee4('0x9c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2c8e6d['body'][_0x3ee4('0x9d')])){throw new db[(_0x3ee4('0x9c'))]['ValidationError'](_0x3ee4('0x9e')+_0x2fec05);}if(!_[_0x3ee4('0x9f')](_0x2fec05,_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x9d')])){throw new db[(_0x3ee4('0x9c'))][(_0x3ee4('0x8b'))](_0x3ee4('0xa0')+_0x2fec05);}_0x40edbc[_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x9d')]]=_0x2c8e6d[_0x3ee4('0x67')]['from'];return db[_0x3ee4('0xa1')][_0x3ee4('0x5f')]({'where':{'id':_0x2c8e6d[_0x3ee4('0x86')]['ListId']},'include':[{'model':db[_0x3ee4('0x8a')],'as':_0x3ee4('0xa2'),'where':_0x40edbc,'limit':0x1,'order':[[_0x3ee4('0x8f'),_0x3ee4('0xa3')]]}]});})[_0x3ee4('0x3b')](handleEntityNotFound(_0x1ca4e8,null))[_0x3ee4('0x3b')](function(_0x301579){if(_0x301579){_0x2c8e6d['list']=_[_0x3ee4('0x75')](_0x301579,[_0x3ee4('0xa2')]);if(_0x301579['Contacts'][_0x3ee4('0x4f')]){return _0x301579['Contacts'][0x0];}var _0x1df4d2=_[_0x3ee4('0x1d')](_0x2c8e6d[_0x3ee4('0x67')],{'firstName':_0x2c8e6d[_0x3ee4('0x67')]['from'],'ListId':_0x301579['id']});_0x1df4d2[_0x2c8e6d['body'][_0x3ee4('0x9d')]]=_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x94')];return db['CmContact'][_0x3ee4('0x60')](_0x1df4d2,{'fields':_0x5083c5,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ca4e8,null))['then'](function(_0x16ca05){if(_0x16ca05){_0x2c8e6d[_0x3ee4('0xa4')]=_0x16ca05;var _0x2d5aee={'ContactId':_0x16ca05['id'],'phone':_0x2c8e6d['body']['from'],'WhatsappAccountId':_0x510b9c[_0x3ee4('0x5d')]['id']};var _0x3de5e0={'ContactId':_0x16ca05['id'],'WhatsappAccountId':_0x510b9c[_0x3ee4('0x5d')]['id'],'closed':![]};return db[_0x3ee4('0xa5')][_0x3ee4('0x5f')]({'where':_0x3de5e0})[_0x3ee4('0x3b')](function(_0x2b0260){if(_0x2b0260){return[_0x2b0260,![]];}return db['WhatsappInteraction'][_0x3ee4('0x60')](_0x2d5aee)[_0x3ee4('0x3b')](function(_0x28993f){return[_0x28993f,!![]];});});}})[_0x3ee4('0xa6')](function(_0x3fcbe1,_0x27d43b){_0x2c8e6d[_0x3ee4('0xa7')]=_0x3fcbe1[_0x3ee4('0x61')]({'plain':!![]});_0x2c8e6d[_0x3ee4('0xa7')][_0x3ee4('0xa8')]=![];if(_0x27d43b){if(_0x2c8e6d['account'][_0x3ee4('0xa9')]){_0x2c8e6d[_0x3ee4('0xaa')][_0x3ee4('0xab')]({'id':0x0,'priority':_0x2c8e6d['applications'][_0x3ee4('0x4f')]+0x1,'app':_0x3ee4('0xac'),'appdata':_0x3ee4('0xad'),'interval':'*,*,*,*'});}_0x2c8e6d[_0x3ee4('0xa7')][_0x3ee4('0xa8')]=!![];}return db[_0x3ee4('0xae')][_0x3ee4('0x60')]({'phone':_0x2c8e6d[_0x3ee4('0x67')]['from'],'messageId':_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x99')],'body':_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0x67')],'WhatsappAccountId':_0x510b9c[_0x3ee4('0x5d')]['id'],'WhatsappInteractionId':_0x3fcbe1['id'],'direction':'in','ContactId':_0x3fcbe1[_0x3ee4('0xaf')],'AttachmentId':_0x2c8e6d[_0x3ee4('0x67')][_0x3ee4('0xb0')]});})[_0x3ee4('0x3b')](function(_0x3531f5){_0x2c8e6d[_0x3ee4('0x2c')]=_0x3531f5;if(_0x2c8e6d[_0x3ee4('0xa7')]['UserId']){return db[_0x3ee4('0xb1')][_0x3ee4('0x5f')]({'attributes':['id',_0x3ee4('0x3f')],'where':{'id':_0x2c8e6d[_0x3ee4('0xa7')][_0x3ee4('0xb2')]}})['then'](function(_0x433d5d){if(_0x433d5d){_0x2c8e6d['applications'][_0x3ee4('0xb3')]({'id':0x0,'priority':0x0,'app':_0x3ee4('0xb4'),'appdata':_0x433d5d[_0x3ee4('0x3f')]+','+(_0x2c8e6d[_0x3ee4('0x86')][_0x3ee4('0xb5')]||0xa),'interval':_0x3ee4('0xb6')});}return respondWithRpcPromise('Start',_0x3ee4('0xb7'),_0x2c8e6d);});}return respondWithRpcPromise('Start',_0x3ee4('0xb7'),_0x2c8e6d);})[_0x3ee4('0x3b')](function(_0x5456a2){if(_0x5456a2){var _0x63f782=0xc8;var _0xbfa7aa=_0x3ee4('0xb8');logger[_0x3ee4('0x24')](_0x3ee4('0x28'),_0xbfa7aa,_0x63f782,'entity\x20found');logger['debug'](_0x3ee4('0xb9'),_0xbfa7aa,_0x63f782,_0x3ee4('0xba'),JSON[_0x3ee4('0x29')](_0x5456a2));if(_0x2c8e6d[_0x3ee4('0x86')][_0x3ee4('0x46')]===_0x3ee4('0x93')){return _0x1ca4e8[_0x3ee4('0x2f')](_0x63f782)[_0x3ee4('0x35')]('Content-Type',_0x3ee4('0xbb'))[_0x3ee4('0x40')](_0x3ee4('0xbc'));}else{return _0x1ca4e8[_0x3ee4('0x2f')](_0x63f782)['json'](_0x5456a2);}}})[_0x3ee4('0x2d')](handleError(_0x1ca4e8,null));};exports['send']=function(_0x1a74f9,_0x2cf314,_0x282499){var _0x61b3b5,_0x487c3f,_0x2d257b;if(_[_0x3ee4('0x9b')](_0x1a74f9['body'][_0x3ee4('0x67')])||_0x1a74f9[_0x3ee4('0x67')][_0x3ee4('0x67')]===''){throw new db[(_0x3ee4('0x9c'))][(_0x3ee4('0x8b'))](_0x3ee4('0xbd'));}if(_['isNil'](_0x1a74f9[_0x3ee4('0x67')]['to'])){throw new db[(_0x3ee4('0x9c'))][(_0x3ee4('0x8b'))](_0x3ee4('0xbe'));}_0x61b3b5=_0x1a74f9['body']['to'];return db['WhatsappAccount'][_0x3ee4('0x5f')]({'where':{'id':_0x1a74f9[_0x3ee4('0x5d')]['id']},'include':[{'model':db[_0x3ee4('0xa1')],'as':_0x3ee4('0xbf'),'include':[{'model':db[_0x3ee4('0x8a')],'as':_0x3ee4('0xa2'),'where':{'mobile':_0x61b3b5},'limit':0x1,'order':[['updatedAt',_0x3ee4('0xa3')]]}]}]})[_0x3ee4('0x3b')](handleEntityNotFound(_0x2cf314,null))['then'](function(_0x752950){if(_0x752950&&_0x752950[_0x3ee4('0xbf')]){_0x487c3f=_0x752950[_0x3ee4('0x61')]({'plain':!![]});if(_0x487c3f['List']&&_0x487c3f['List'][_0x3ee4('0xa2')][_0x3ee4('0x4f')]){return _0x487c3f['List']['Contacts'][0x0];}return db[_0x3ee4('0x8a')]['create'](_[_0x3ee4('0x1d')](_0x1a74f9[_0x3ee4('0x67')],{'firstName':_0x61b3b5,'mobile':_0x61b3b5,'phone':_0x61b3b5,'ListId':_0x487c3f[_0x3ee4('0x91')]}));}})[_0x3ee4('0x3b')](handleEntityNotFound(_0x2cf314,null))[_0x3ee4('0x3b')](function(_0x77b86d){if(_0x77b86d){_0x2d257b=_0x77b86d;return db[_0x3ee4('0xa5')]['find']({'where':{'ContactId':_0x2d257b['id'],'closed':![],'WhatsappAccountId':_0x487c3f['id']}})[_0x3ee4('0x3b')](function(_0x33d2dd){if(_0x33d2dd){return[_0x33d2dd,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x1a74f9[_0x3ee4('0xc0')]['id'],'ContactId':_0x2d257b['id'],'WhatsappAccountId':_0x487c3f['id'],'phone':_0x61b3b5,'firstMsgDirection':_0x3ee4('0xc1'),'Messages':[_[_0x3ee4('0x55')](_0x1a74f9['body'],{'read':![],'body':_0x1a74f9[_0x3ee4('0x67')][_0x3ee4('0x67')],'phone':_0x61b3b5,'WhatsappAccountId':_0x487c3f['id'],'UserId':_0x1a74f9['user']['id'],'ContactId':_0x2d257b['id']})]},{'include':[{'model':db[_0x3ee4('0xae')],'as':_0x3ee4('0xc2')}]})[_0x3ee4('0x3b')](function(_0x419fd0){return[_0x419fd0,!![]];});});}})[_0x3ee4('0xa6')](function(_0x54c3cd,_0xba269b){if(_0xba269b){return _0x54c3cd;}return db[_0x3ee4('0xae')][_0x3ee4('0x60')](_['merge'](_0x1a74f9[_0x3ee4('0x67')],{'read':![],'body':_0x1a74f9[_0x3ee4('0x67')][_0x3ee4('0x67')],'phone':_0x61b3b5,'WhatsappAccountId':_0x487c3f['id'],'WhatsappInteractionId':_0x54c3cd['id'],'UserId':_0x1a74f9[_0x3ee4('0xc0')]['id'],'ContactId':_0x2d257b['id']}))[_0x3ee4('0x3b')](function(_0x2fbc6e){_0x54c3cd['dataValues']['Messages']=[];_0x54c3cd['dataValues'][_0x3ee4('0xc2')][_0x3ee4('0xab')](_0x2fbc6e[_0x3ee4('0xc3')]);return _0x54c3cd;});})[_0x3ee4('0x3b')](respondWithResult(_0x2cf314,null))[_0x3ee4('0x2d')](handleError(_0x2cf314,null));}; \ No newline at end of file +var _0xb25e=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','includeAll','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','account','from','From','messageId','MessageSid','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','Contacts','defaults','contact','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','create','body','user','get','role','UserProfileSection'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0xb25e,0x114));var _0xeb25=function(_0x195ef,_0x42f51e){_0x195ef=_0x195ef-0x0;var _0x51e106=_0xb25e[_0x195ef];return _0x51e106;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb25('0x0'));var rimraf=require(_0xeb25('0x1'));var zipdir=require(_0xeb25('0x2'));var jsonpatch=require(_0xeb25('0x3'));var rp=require(_0xeb25('0x4'));var moment=require(_0xeb25('0x5'));var BPromise=require(_0xeb25('0x6'));var Mustache=require('mustache');var util=require(_0xeb25('0x7'));var path=require('path');var sox=require(_0xeb25('0x8'));var csv=require(_0xeb25('0x9'));var ejs=require(_0xeb25('0xa'));var fs=require('fs');var _=require(_0xeb25('0xb'));var squel=require('squel');var crypto=require(_0xeb25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb25('0xd'));var toCsv=require(_0xeb25('0x9'));var querystring=require('querystring');var Papa=require(_0xeb25('0xe'));var Redis=require(_0xeb25('0xf'));var authService=require(_0xeb25('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb25('0x11'));var logger=require(_0xeb25('0x12'))(_0xeb25('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb25('0x14'));var db=require(_0xeb25('0x15'))['db'];config[_0xeb25('0x16')]=_['defaults'](config['redis'],{'host':_0xeb25('0x17'),'port':0x18eb});var socket=require(_0xeb25('0x18'))(new Redis(config[_0xeb25('0x16')]));require('./whatsappAccount.socket')[_0xeb25('0x19')](socket);var jayson=require(_0xeb25('0x1a'));var client=jayson[_0xeb25('0x1b')][_0xeb25('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1ae2f9,_0x1996b3,_0x2414dd,_0x29f55d){return new BPromise(function(_0x5c8f94,_0xa86fe4){var _0x417ddf=_0x29f55d||client;return _0x417ddf['request'](_0x1ae2f9,_0x2414dd)[_0xeb25('0x1d')](function(_0x4368a1){logger[_0xeb25('0x1e')](_0xeb25('0x1f'),_0x1996b3,_0xeb25('0x20'));logger['debug'](_0xeb25('0x21'),_0x1996b3,_0xeb25('0x20'),JSON[_0xeb25('0x22')](_0x4368a1));if(_0x4368a1[_0xeb25('0x23')]){if(_0x4368a1[_0xeb25('0x23')]['code']===0x1f4){logger[_0xeb25('0x23')](_0xeb25('0x1f'),_0x1996b3,_0x4368a1[_0xeb25('0x23')][_0xeb25('0x24')]);return _0xa86fe4(_0x4368a1[_0xeb25('0x23')][_0xeb25('0x24')]);}logger[_0xeb25('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x1996b3,_0x4368a1['error'][_0xeb25('0x24')]);return _0x5c8f94(_0x4368a1[_0xeb25('0x23')][_0xeb25('0x24')]);}else{logger[_0xeb25('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x1996b3,_0xeb25('0x20'));_0x5c8f94(_0x4368a1['result'][_0xeb25('0x24')]);}})[_0xeb25('0x25')](function(_0x330d6c){logger['error'](_0xeb25('0x1f'),_0x1996b3,_0x330d6c);_0xa86fe4(_0x330d6c);});});}function respondWithStatusCode(_0x38d915,_0x5d879d){_0x5d879d=_0x5d879d||0xcc;return function(_0x3d8294){if(_0x3d8294){return _0x38d915[_0xeb25('0x26')](_0x5d879d);}return _0x38d915[_0xeb25('0x27')](_0x5d879d)[_0xeb25('0x28')]();};}function respondWithResult(_0x2ffc27,_0x3fd5ae){_0x3fd5ae=_0x3fd5ae||0xc8;return function(_0x180f7e){if(_0x180f7e){return _0x2ffc27[_0xeb25('0x27')](_0x3fd5ae)[_0xeb25('0x29')](_0x180f7e);}};}function respondWithFilteredResult(_0x43cf46,_0x5532fc){return function(_0x4c879a){if(_0x4c879a){var _0x89eed2=_0x4c879a[_0xeb25('0x2a')],_0x57ea13=_0x5532fc['offset'],_0x5e5458=_0x5532fc[_0xeb25('0x2b')]+_0x5532fc['limit'],_0x43082a;if(_0x5e5458>=_0x89eed2){_0x5e5458=_0x89eed2;_0x43082a=0xc8;}else{_0x43082a=0xce;}_0x43cf46[_0xeb25('0x27')](_0x43082a);return _0x43cf46[_0xeb25('0x2c')]('Content-Range',_0x57ea13+'-'+_0x5e5458+'/'+_0x89eed2)[_0xeb25('0x29')](_0x4c879a);}return null;};}function patchUpdates(_0x57ed44){return function(_0x120ebf){try{jsonpatch[_0xeb25('0x2d')](_0x120ebf,_0x57ed44,!![]);}catch(_0x5fbb7b){return BPromise[_0xeb25('0x2e')](_0x5fbb7b);}return _0x120ebf[_0xeb25('0x2f')]();};}function saveUpdates(_0x1d01c3,_0x134c5a){return function(_0x5e53c7){if(_0x5e53c7){return _0x5e53c7[_0xeb25('0x30')](_0x1d01c3)['then'](function(_0x5a30ac){return _0x5a30ac;});}return null;};}function removeEntity(_0x5cd23f,_0xbd2140){return function(_0x7a7182){if(_0x7a7182){return _0x7a7182[_0xeb25('0x31')]()['then'](function(){var _0x5debef=_0x7a7182['get']({'plain':!![]});var _0x15deed='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x15deed,'resourceId':_0x5debef['id']}})['then'](function(){return _0x7a7182;});})[_0xeb25('0x1d')](function(){_0x5cd23f[_0xeb25('0x27')](0xcc)[_0xeb25('0x28')]();});}};}function handleEntityNotFound(_0x313229,_0x3b67d8){return function(_0x3401d9){if(!_0x3401d9){_0x313229['sendStatus'](0x194);}return _0x3401d9;};}function handleError(_0x24f77c,_0x4e70a0){_0x4e70a0=_0x4e70a0||0x1f4;return function(_0x5b7189){logger[_0xeb25('0x23')](_0x5b7189['stack']);if(_0x5b7189['name']){delete _0x5b7189[_0xeb25('0x32')];}_0x24f77c['status'](_0x4e70a0)[_0xeb25('0x33')](_0x5b7189);};}exports[_0xeb25('0x34')]=function(_0x2d21e0,_0x3e522e){var _0x5e677c={'include':[{'model':db[_0xeb25('0x35')],'as':_0xeb25('0x36')}]},_0x345e53={},_0x501188={'count':0x0,'rows':[]};var _0x36a342=_[_0xeb25('0x37')](db[_0xeb25('0x38')][_0xeb25('0x39')],function(_0x2bae09){return{'name':_0x2bae09[_0xeb25('0x3a')],'type':_0x2bae09[_0xeb25('0x3b')][_0xeb25('0x3c')]};});_0x345e53[_0xeb25('0x3d')]=_['map'](_0x36a342,_0xeb25('0x32'));_0x345e53[_0xeb25('0x3e')]=_[_0xeb25('0x3f')](_0x2d21e0[_0xeb25('0x3e')]);_0x345e53[_0xeb25('0x40')]=_[_0xeb25('0x41')](_0x345e53[_0xeb25('0x3d')],_0x345e53[_0xeb25('0x3e')]);_0x5e677c[_0xeb25('0x42')]=_[_0xeb25('0x41')](_0x345e53[_0xeb25('0x3d')],qs['fields'](_0x2d21e0['query'][_0xeb25('0x43')]));_0x5e677c[_0xeb25('0x42')]=_0x5e677c[_0xeb25('0x42')][_0xeb25('0x44')]?_0x5e677c[_0xeb25('0x42')]:_0x345e53[_0xeb25('0x3d')];if(!_0x2d21e0[_0xeb25('0x3e')][_0xeb25('0x45')](_0xeb25('0x46'))){_0x5e677c['limit']=qs[_0xeb25('0x47')](_0x2d21e0[_0xeb25('0x3e')][_0xeb25('0x47')]);_0x5e677c[_0xeb25('0x2b')]=qs[_0xeb25('0x2b')](_0x2d21e0['query'][_0xeb25('0x2b')]);}_0x5e677c[_0xeb25('0x48')]=qs[_0xeb25('0x49')](_0x2d21e0['query'][_0xeb25('0x49')]);_0x5e677c[_0xeb25('0x4a')]=qs[_0xeb25('0x40')](_[_0xeb25('0x4b')](_0x2d21e0[_0xeb25('0x3e')],_0x345e53[_0xeb25('0x40')]),_0x36a342);if(_0x2d21e0[_0xeb25('0x3e')][_0xeb25('0x4c')]){_0x5e677c[_0xeb25('0x4a')]=_[_0xeb25('0x4d')](_0x5e677c['where'],{'$or':_[_0xeb25('0x37')](_0x36a342,function(_0x18bc6e){if(_0x18bc6e[_0xeb25('0x3b')]!==_0xeb25('0x4e')){var _0x221799={};_0x221799[_0x18bc6e[_0xeb25('0x32')]]={'$like':'%'+_0x2d21e0[_0xeb25('0x3e')][_0xeb25('0x4c')]+'%'};return _0x221799;}})});}_0x5e677c=_[_0xeb25('0x4d')]({},_0x5e677c,_0x2d21e0[_0xeb25('0x4f')]);var _0xd27105={'where':_0x5e677c[_0xeb25('0x4a')]};return db[_0xeb25('0x38')][_0xeb25('0x2a')](_0xd27105)[_0xeb25('0x1d')](function(_0x20c571){_0x501188[_0xeb25('0x2a')]=_0x20c571;if(_0x2d21e0[_0xeb25('0x3e')]['includeAll']){_0x5e677c[_0xeb25('0x50')]=[{'all':!![]}];}return db[_0xeb25('0x38')][_0xeb25('0x51')](_0x5e677c);})[_0xeb25('0x1d')](function(_0x24d99d){_0x501188[_0xeb25('0x52')]=_0x24d99d;return _0x501188;})[_0xeb25('0x1d')](respondWithFilteredResult(_0x3e522e,_0x5e677c))[_0xeb25('0x25')](handleError(_0x3e522e,null));};exports[_0xeb25('0x53')]=function(_0x1891a2,_0x457c86){var _0x743f29={'raw':![],'where':{'id':_0x1891a2[_0xeb25('0x54')]['id']},'include':[{'model':db[_0xeb25('0x35')],'as':'mandatoryDispositionPause'}]},_0x491f41={};_0x491f41['model']=_['keys'](db[_0xeb25('0x38')]['rawAttributes']);_0x491f41['query']=_[_0xeb25('0x3f')](_0x1891a2[_0xeb25('0x3e')]);_0x491f41[_0xeb25('0x40')]=_[_0xeb25('0x41')](_0x491f41['model'],_0x491f41[_0xeb25('0x3e')]);_0x743f29[_0xeb25('0x42')]=_[_0xeb25('0x41')](_0x491f41[_0xeb25('0x3d')],qs[_0xeb25('0x43')](_0x1891a2[_0xeb25('0x3e')]['fields']));_0x743f29['attributes']=_0x743f29['attributes'][_0xeb25('0x44')]?_0x743f29[_0xeb25('0x42')]:_0x491f41[_0xeb25('0x3d')];if(_0x1891a2['query']['includeAll']){_0x743f29['include']=[{'all':!![]}];}_0x743f29=_[_0xeb25('0x4d')]({},_0x743f29,_0x1891a2[_0xeb25('0x4f')]);return db[_0xeb25('0x38')][_0xeb25('0x55')](_0x743f29)[_0xeb25('0x1d')](handleEntityNotFound(_0x457c86,null))['then'](respondWithResult(_0x457c86,null))['catch'](handleError(_0x457c86,null));};exports['create']=function(_0x5b7a59,_0x5bc00c){return db[_0xeb25('0x38')][_0xeb25('0x56')](_0x5b7a59[_0xeb25('0x57')],{})[_0xeb25('0x1d')](function(_0x4f12b0){var _0x18f636=_0x5b7a59[_0xeb25('0x58')][_0xeb25('0x59')]({'plain':!![]});if(!_0x18f636)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f636[_0xeb25('0x5a')]===_0xeb25('0x58')){var _0x314c00=_0x4f12b0[_0xeb25('0x59')]({'plain':!![]});var _0x473820='WhatsappAccounts';return db[_0xeb25('0x5b')][_0xeb25('0x55')]({'where':{'name':_0x473820,'userProfileId':_0x18f636[_0xeb25('0x5c')]},'raw':!![]})[_0xeb25('0x1d')](function(_0x808789){if(_0x808789&&_0x808789[_0xeb25('0x5d')]===0x0){return db[_0xeb25('0x5e')][_0xeb25('0x56')]({'name':_0x314c00[_0xeb25('0x32')],'resourceId':_0x314c00['id'],'type':_0x808789[_0xeb25('0x32')],'sectionId':_0x808789['id']},{})[_0xeb25('0x1d')](function(){return _0x4f12b0;});}else{return _0x4f12b0;}})[_0xeb25('0x25')](function(_0x1d48e0){logger[_0xeb25('0x23')](_0xeb25('0x5f'),_0x1d48e0);throw _0x1d48e0;});}return _0x4f12b0;})[_0xeb25('0x1d')](respondWithResult(_0x5bc00c,0xc9))[_0xeb25('0x25')](handleError(_0x5bc00c,null));};exports[_0xeb25('0x30')]=function(_0x1a093a,_0x4e34b2){if(_0x1a093a[_0xeb25('0x57')]['id']){delete _0x1a093a['body']['id'];}return db[_0xeb25('0x38')][_0xeb25('0x55')]({'where':{'id':_0x1a093a[_0xeb25('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xeb25('0x1d')](handleEntityNotFound(_0x4e34b2,null))[_0xeb25('0x1d')](saveUpdates(_0x1a093a['body'],null))['then'](respondWithResult(_0x4e34b2,null))[_0xeb25('0x25')](handleError(_0x4e34b2,null));};exports[_0xeb25('0x31')]=function(_0x2cea1a,_0x201a0c){return db[_0xeb25('0x38')]['find']({'where':{'id':_0x2cea1a['params']['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x201a0c,null))[_0xeb25('0x1d')](removeEntity(_0x201a0c,null))[_0xeb25('0x25')](handleError(_0x201a0c,null));};exports[_0xeb25('0x60')]=function(_0x4407d6,_0x5dedf9){return db['WhatsappAccount'][_0xeb25('0x60')]()['then'](respondWithResult(_0x5dedf9,null))[_0xeb25('0x25')](handleError(_0x5dedf9,null));};exports[_0xeb25('0x61')]=function(_0x32e44d,_0x3d9adb,_0x35835e){if(_0x32e44d[_0xeb25('0x57')]['id']){delete _0x32e44d[_0xeb25('0x57')]['id'];}return db[_0xeb25('0x38')][_0xeb25('0x55')]({'where':{'id':_0x32e44d[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x3d9adb,null))[_0xeb25('0x1d')](function(_0x2a0ced){if(_0x2a0ced){_0x32e44d[_0xeb25('0x57')][_0xeb25('0x62')]=_0x2a0ced['id'];return db[_0xeb25('0x63')][_0xeb25('0x56')](_0x32e44d[_0xeb25('0x57')]);}})[_0xeb25('0x1d')](respondWithResult(_0x3d9adb,null))[_0xeb25('0x25')](handleError(_0x3d9adb,null));};exports[_0xeb25('0x64')]=function(_0xbaef6c,_0x4be050,_0x20a4c1){var _0x41c8d9={'raw':![],'where':{}};var _0x34c1f1={};var _0x488980={'count':0x0,'rows':[]};return db[_0xeb25('0x38')]['findOne']({'where':{'id':_0xbaef6c[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x4be050,null))['then'](function(_0x32ee1d){if(_0x32ee1d){_0x34c1f1[_0xeb25('0x3d')]=_[_0xeb25('0x3f')](db['Disposition'][_0xeb25('0x39')]);_0x34c1f1[_0xeb25('0x3e')]=_[_0xeb25('0x3f')](_0xbaef6c[_0xeb25('0x3e')]);_0x34c1f1[_0xeb25('0x40')]=_[_0xeb25('0x41')](_0x34c1f1[_0xeb25('0x3d')],_0x34c1f1[_0xeb25('0x3e')]);_0x41c8d9[_0xeb25('0x42')]=_[_0xeb25('0x41')](_0x34c1f1[_0xeb25('0x3d')],qs[_0xeb25('0x43')](_0xbaef6c[_0xeb25('0x3e')][_0xeb25('0x43')]));_0x41c8d9['attributes']=_0x41c8d9[_0xeb25('0x42')][_0xeb25('0x44')]?_0x41c8d9['attributes']:_0x34c1f1['model'];if(!_0xbaef6c[_0xeb25('0x3e')][_0xeb25('0x45')](_0xeb25('0x46'))){_0x41c8d9[_0xeb25('0x47')]=qs['limit'](_0xbaef6c[_0xeb25('0x3e')]['limit']);_0x41c8d9[_0xeb25('0x2b')]=qs[_0xeb25('0x2b')](_0xbaef6c['query'][_0xeb25('0x2b')]);}_0x41c8d9[_0xeb25('0x48')]=qs[_0xeb25('0x49')](_0xbaef6c[_0xeb25('0x3e')][_0xeb25('0x49')]);_0x41c8d9[_0xeb25('0x4a')]=qs[_0xeb25('0x40')](_[_0xeb25('0x4b')](_0xbaef6c[_0xeb25('0x3e')],_0x34c1f1['filters']));_0x41c8d9[_0xeb25('0x4a')][_0xeb25('0x62')]=_0x32ee1d['id'];if(_0xbaef6c[_0xeb25('0x3e')][_0xeb25('0x4c')]){_0x41c8d9[_0xeb25('0x4a')]=_[_0xeb25('0x4d')](_0x41c8d9[_0xeb25('0x4a')],{'$or':_[_0xeb25('0x37')](_0x41c8d9[_0xeb25('0x42')],function(_0x1101d3){var _0x3330d7={};_0x3330d7[_0x1101d3]={'$like':'%'+_0xbaef6c['query'][_0xeb25('0x4c')]+'%'};return _0x3330d7;})});}_0x41c8d9=_['merge']({},_0x41c8d9,_0xbaef6c[_0xeb25('0x4f')]);return db[_0xeb25('0x63')][_0xeb25('0x2a')]({'where':_0x41c8d9[_0xeb25('0x4a')]})[_0xeb25('0x1d')](function(_0x2a08d6){_0x488980[_0xeb25('0x2a')]=_0x2a08d6;if(_0xbaef6c[_0xeb25('0x3e')]['includeAll']){_0x41c8d9[_0xeb25('0x50')]=[{'all':!![]}];}return db['Disposition'][_0xeb25('0x51')](_0x41c8d9);})['then'](function(_0x159df7){_0x488980[_0xeb25('0x52')]=_0x159df7;return _0x488980;});}})[_0xeb25('0x1d')](respondWithFilteredResult(_0x4be050,_0x41c8d9))['catch'](handleError(_0x4be050,null));};exports['removeDispositions']=function(_0x3900d6,_0x276ee2,_0x4b9198){return db['WhatsappAccount'][_0xeb25('0x55')]({'where':{'id':_0x3900d6[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x276ee2,null))[_0xeb25('0x1d')](function(_0x87b097){if(_0x87b097){return _0x87b097[_0xeb25('0x65')](_0x3900d6[_0xeb25('0x3e')]['ids']);}})[_0xeb25('0x1d')](respondWithStatusCode(_0x276ee2,null))[_0xeb25('0x25')](handleError(_0x276ee2,null));};exports[_0xeb25('0x66')]=function(_0x1a3ebb,_0x4f26c4,_0x58a4b7){if(_0x1a3ebb[_0xeb25('0x57')]['id']){delete _0x1a3ebb[_0xeb25('0x57')]['id'];}return db['WhatsappAccount'][_0xeb25('0x55')]({'where':{'id':_0x1a3ebb[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x4f26c4,null))[_0xeb25('0x1d')](function(_0xbda7fb){if(_0xbda7fb){_0x1a3ebb['body']['WhatsappAccountId']=_0xbda7fb['id'];return db['CannedAnswer'][_0xeb25('0x56')](_0x1a3ebb[_0xeb25('0x57')]);}})[_0xeb25('0x1d')](respondWithResult(_0x4f26c4,null))['catch'](handleError(_0x4f26c4,null));};exports[_0xeb25('0x67')]=function(_0x58c65a,_0x318a58,_0x2302ca){var _0x2b509d={'raw':![],'where':{}};var _0x45db5c={};var _0x3b6e65={'count':0x0,'rows':[]};return db[_0xeb25('0x38')][_0xeb25('0x68')]({'where':{'id':_0x58c65a[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x318a58,null))[_0xeb25('0x1d')](function(_0x15e121){if(_0x15e121){_0x45db5c['model']=_[_0xeb25('0x3f')](db[_0xeb25('0x69')][_0xeb25('0x39')]);_0x45db5c[_0xeb25('0x3e')]=_[_0xeb25('0x3f')](_0x58c65a[_0xeb25('0x3e')]);_0x45db5c['filters']=_[_0xeb25('0x41')](_0x45db5c[_0xeb25('0x3d')],_0x45db5c[_0xeb25('0x3e')]);_0x2b509d[_0xeb25('0x42')]=_[_0xeb25('0x41')](_0x45db5c[_0xeb25('0x3d')],qs['fields'](_0x58c65a['query']['fields']));_0x2b509d[_0xeb25('0x42')]=_0x2b509d[_0xeb25('0x42')][_0xeb25('0x44')]?_0x2b509d['attributes']:_0x45db5c[_0xeb25('0x3d')];if(!_0x58c65a['query'][_0xeb25('0x45')](_0xeb25('0x46'))){_0x2b509d[_0xeb25('0x47')]=qs[_0xeb25('0x47')](_0x58c65a['query']['limit']);_0x2b509d[_0xeb25('0x2b')]=qs[_0xeb25('0x2b')](_0x58c65a['query'][_0xeb25('0x2b')]);}_0x2b509d[_0xeb25('0x48')]=qs[_0xeb25('0x49')](_0x58c65a[_0xeb25('0x3e')]['sort']);_0x2b509d[_0xeb25('0x4a')]=qs[_0xeb25('0x40')](_[_0xeb25('0x4b')](_0x58c65a['query'],_0x45db5c[_0xeb25('0x40')]));_0x2b509d[_0xeb25('0x4a')][_0xeb25('0x62')]=_0x15e121['id'];if(_0x58c65a[_0xeb25('0x3e')][_0xeb25('0x4c')]){_0x2b509d[_0xeb25('0x4a')]=_[_0xeb25('0x4d')](_0x2b509d['where'],{'$or':_[_0xeb25('0x37')](_0x2b509d[_0xeb25('0x42')],function(_0x4e797f){var _0x31c32c={};_0x31c32c[_0x4e797f]={'$like':'%'+_0x58c65a[_0xeb25('0x3e')][_0xeb25('0x4c')]+'%'};return _0x31c32c;})});}_0x2b509d=_[_0xeb25('0x4d')]({},_0x2b509d,_0x58c65a[_0xeb25('0x4f')]);return db['CannedAnswer']['count']({'where':_0x2b509d['where']})[_0xeb25('0x1d')](function(_0x5b6588){_0x3b6e65[_0xeb25('0x2a')]=_0x5b6588;if(_0x58c65a['query'][_0xeb25('0x6a')]){_0x2b509d[_0xeb25('0x50')]=[{'all':!![]}];}return db[_0xeb25('0x69')]['findAll'](_0x2b509d);})[_0xeb25('0x1d')](function(_0x3d93b3){_0x3b6e65[_0xeb25('0x52')]=_0x3d93b3;return _0x3b6e65;});}})[_0xeb25('0x1d')](respondWithFilteredResult(_0x318a58,_0x2b509d))[_0xeb25('0x25')](handleError(_0x318a58,null));};exports['removeAnswers']=function(_0x5a20ed,_0x5a2655,_0x256964){return db[_0xeb25('0x38')][_0xeb25('0x55')]({'where':{'id':_0x5a20ed[_0xeb25('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a2655,null))[_0xeb25('0x1d')](function(_0x23cac4){if(_0x23cac4){return _0x23cac4['removeAnswers'](_0x5a20ed[_0xeb25('0x3e')][_0xeb25('0x6b')]);}})[_0xeb25('0x1d')](respondWithStatusCode(_0x5a2655,null))[_0xeb25('0x25')](handleError(_0x5a2655,null));};exports[_0xeb25('0x6c')]=function(_0x3ac53f,_0x49ff9a,_0x182579){return db[_0xeb25('0x38')][_0xeb25('0x55')]({'where':{'id':_0x3ac53f[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x49ff9a,null))[_0xeb25('0x1d')](function(_0x589521){if(_0x589521){return _0x589521[_0xeb25('0x6c')](_0x3ac53f['body'][_0xeb25('0x6b')],_[_0xeb25('0x6d')](_0x3ac53f[_0xeb25('0x57')],[_0xeb25('0x6b'),'id'])||{})[_0xeb25('0x6e')](function(_0x40963d){for(var _0x25b8fb=0x0;_0x25b8fb<_0x3ac53f[_0xeb25('0x57')][_0xeb25('0x6b')]['length'];_0x25b8fb+=0x1){socket['emit'](_0xeb25('0x6f'),{'UserId':_0x3ac53f['body'][_0xeb25('0x6b')][_0x25b8fb],'WhatsappAccountId':_0x3ac53f[_0xeb25('0x54')]['id']});}return _0x40963d;});}})[_0xeb25('0x1d')](respondWithResult(_0x49ff9a,null))[_0xeb25('0x25')](handleError(_0x49ff9a,null));};exports[_0xeb25('0x70')]=function(_0x43593f,_0x5009da,_0x2fa066){return db[_0xeb25('0x38')][_0xeb25('0x55')]({'where':{'id':_0x43593f['params']['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x5009da,null))[_0xeb25('0x1d')](function(_0x2e6eb1){if(_0x2e6eb1){return _0x2e6eb1[_0xeb25('0x70')](_0x43593f[_0xeb25('0x3e')][_0xeb25('0x6b')])[_0xeb25('0x1d')](function(){if(_[_0xeb25('0x71')](_0x43593f[_0xeb25('0x3e')][_0xeb25('0x6b')])){for(var _0x15cc55=0x0;_0x15cc55<_0x43593f[_0xeb25('0x3e')]['ids'][_0xeb25('0x44')];_0x15cc55+=0x1){socket['emit'](_0xeb25('0x72'),{'UserId':Number(_0x43593f[_0xeb25('0x3e')][_0xeb25('0x6b')][_0x15cc55]),'WhatsappAccountId':Number(_0x43593f[_0xeb25('0x54')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x43593f[_0xeb25('0x3e')][_0xeb25('0x6b')]),'WhatsappAccountId':Number(_0x43593f[_0xeb25('0x54')]['id'])});}});}})[_0xeb25('0x1d')](respondWithStatusCode(_0x5009da,null))[_0xeb25('0x25')](handleError(_0x5009da,null));};exports[_0xeb25('0x73')]=function(_0x531645,_0x2b0112,_0x18649b){var _0x45529d={};var _0x5a60c2={};var _0x2b5a5e;var _0x3f065f;return db[_0xeb25('0x38')][_0xeb25('0x68')]({'where':{'id':_0x531645['params']['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x2b0112,null))[_0xeb25('0x1d')](function(_0x3d6fdb){if(_0x3d6fdb){_0x2b5a5e=_0x3d6fdb;_0x5a60c2[_0xeb25('0x3d')]=_[_0xeb25('0x3f')](db['User'][_0xeb25('0x39')]);_0x5a60c2['query']=_[_0xeb25('0x3f')](_0x531645['query']);_0x5a60c2[_0xeb25('0x40')]=_['intersection'](_0x5a60c2[_0xeb25('0x3d')],_0x5a60c2[_0xeb25('0x3e')]);_0x45529d[_0xeb25('0x42')]=_['intersection'](_0x5a60c2['model'],qs[_0xeb25('0x43')](_0x531645['query'][_0xeb25('0x43')]));_0x45529d[_0xeb25('0x42')]=_0x45529d['attributes']['length']?_0x45529d['attributes']:_0x5a60c2[_0xeb25('0x3d')];_0x45529d[_0xeb25('0x48')]=qs['sort'](_0x531645[_0xeb25('0x3e')][_0xeb25('0x49')]);_0x45529d[_0xeb25('0x4a')]=qs[_0xeb25('0x40')](_[_0xeb25('0x4b')](_0x531645[_0xeb25('0x3e')],_0x5a60c2[_0xeb25('0x40')]));if(_0x531645[_0xeb25('0x3e')][_0xeb25('0x4c')]){_0x45529d[_0xeb25('0x4a')]=_[_0xeb25('0x4d')](_0x45529d[_0xeb25('0x4a')],{'$or':_[_0xeb25('0x37')](_0x45529d['attributes'],function(_0x246ee4){var _0xd769d6={};_0xd769d6[_0x246ee4]={'$like':'%'+_0x531645[_0xeb25('0x3e')]['filter']+'%'};return _0xd769d6;})});}_0x45529d=_[_0xeb25('0x4d')]({},_0x45529d,_0x531645[_0xeb25('0x4f')]);return _0x2b5a5e[_0xeb25('0x73')](_0x45529d);}})['then'](function(_0x26705f){if(_0x26705f){_0x3f065f=_0x26705f[_0xeb25('0x44')];if(!_0x531645[_0xeb25('0x3e')][_0xeb25('0x45')](_0xeb25('0x46'))){_0x45529d['limit']=qs[_0xeb25('0x47')](_0x531645[_0xeb25('0x3e')]['limit']);_0x45529d['offset']=qs[_0xeb25('0x2b')](_0x531645[_0xeb25('0x3e')][_0xeb25('0x2b')]);}return _0x2b5a5e[_0xeb25('0x73')](_0x45529d);}})[_0xeb25('0x1d')](function(_0x2685c0){if(_0x2685c0){return _0x2685c0?{'count':_0x3f065f,'rows':_0x2685c0}:null;}})[_0xeb25('0x1d')](respondWithResult(_0x2b0112,null))[_0xeb25('0x25')](handleError(_0x2b0112,null));};exports[_0xeb25('0x74')]=function(_0x380bab,_0x411def,_0x37a373){return db[_0xeb25('0x38')][_0xeb25('0x68')]({'where':{'id':_0x380bab['params']['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0x411def,null))[_0xeb25('0x1d')](function(_0x4f4f77){if(_0x4f4f77){return db[_0xeb25('0x75')]['transaction'](function(_0x2f6bc8){return db['WhatsappApplication'][_0xeb25('0x31')]({'where':{'WhatsappAccountId':_0x380bab[_0xeb25('0x54')]['id']},'transaction':_0x2f6bc8})['then'](function(_0x4cf328){var _0x3feccd=_['map'](_0x380bab[_0xeb25('0x57')],function(_0x27525e){_0x27525e['WhatsappAccountId']=_0x380bab[_0xeb25('0x54')]['id'];return _0x27525e;});return db[_0xeb25('0x76')][_0xeb25('0x77')](_0x3feccd,{'transaction':_0x2f6bc8});});})[_0xeb25('0x1d')](function(){return db['WhatsappApplication'][_0xeb25('0x78')]({'where':{'WhatsappAccountId':_0x380bab[_0xeb25('0x54')]['id']},'order':_0xeb25('0x79')});});}})[_0xeb25('0x1d')](respondWithResult(_0x411def,null))['catch'](handleError(_0x411def,null));};exports['getApplications']=function(_0x4baf3a,_0xcc29d9,_0x47a573){var _0x572d1e={};var _0xbc3ea1={};var _0x548cf8;var _0x20a9b3;return db['WhatsappAccount']['findOne']({'where':{'id':_0x4baf3a[_0xeb25('0x54')]['id']}})[_0xeb25('0x1d')](handleEntityNotFound(_0xcc29d9,null))[_0xeb25('0x1d')](function(_0x6d2c45){if(_0x6d2c45){_0x548cf8=_0x6d2c45;_0xbc3ea1[_0xeb25('0x3d')]=_[_0xeb25('0x3f')](db[_0xeb25('0x76')]['rawAttributes']);_0xbc3ea1[_0xeb25('0x3e')]=_['keys'](_0x4baf3a[_0xeb25('0x3e')]);_0xbc3ea1['filters']=_['intersection'](_0xbc3ea1[_0xeb25('0x3d')],_0xbc3ea1[_0xeb25('0x3e')]);_0x572d1e[_0xeb25('0x42')]=_['intersection'](_0xbc3ea1['model'],qs['fields'](_0x4baf3a['query'][_0xeb25('0x43')]));_0x572d1e[_0xeb25('0x42')]=_0x572d1e[_0xeb25('0x42')]['length']?_0x572d1e[_0xeb25('0x42')]:_0xbc3ea1[_0xeb25('0x3d')];_0x572d1e['order']=qs[_0xeb25('0x49')](_0x4baf3a[_0xeb25('0x3e')][_0xeb25('0x49')]);_0x572d1e[_0xeb25('0x4a')]=qs['filters'](_['pick'](_0x4baf3a['query'],_0xbc3ea1[_0xeb25('0x40')]));if(_0x4baf3a[_0xeb25('0x3e')][_0xeb25('0x4c')]){_0x572d1e[_0xeb25('0x4a')]=_['merge'](_0x572d1e[_0xeb25('0x4a')],{'$or':_['map'](_0x572d1e['attributes'],function(_0x5c8c94){var _0x12da4c={};_0x12da4c[_0x5c8c94]={'$like':'%'+_0x4baf3a[_0xeb25('0x3e')][_0xeb25('0x4c')]+'%'};return _0x12da4c;})});}_0x572d1e=_[_0xeb25('0x4d')]({},_0x572d1e,_0x4baf3a[_0xeb25('0x4f')]);return _0x548cf8[_0xeb25('0x7a')](_0x572d1e);}})['then'](function(_0x4ebb91){if(_0x4ebb91){_0x20a9b3=_0x4ebb91['length'];if(!_0x4baf3a[_0xeb25('0x3e')][_0xeb25('0x45')](_0xeb25('0x46'))){_0x572d1e[_0xeb25('0x47')]=qs[_0xeb25('0x47')](_0x4baf3a[_0xeb25('0x3e')]['limit']);_0x572d1e[_0xeb25('0x2b')]=qs['offset'](_0x4baf3a[_0xeb25('0x3e')]['offset']);}return _0x548cf8[_0xeb25('0x7a')](_0x572d1e);}})[_0xeb25('0x1d')](function(_0x519a0b){if(_0x519a0b){return _0x519a0b?{'count':_0x20a9b3,'rows':_0x519a0b}:null;}})[_0xeb25('0x1d')](respondWithResult(_0xcc29d9,null))['catch'](handleError(_0xcc29d9,null));};exports[_0xeb25('0x7b')]=function(_0x376950,_0x1bc1b5,_0x25f69f){var _0x1f0523={'channel':_0xeb25('0x7c')};var _0x212078=[];var _0x3795a9=[];var _0x548cd6={};return db[_0xeb25('0x38')][_0xeb25('0x55')]({'where':{'id':_0x376950[_0xeb25('0x54')]['id']},'include':[{'model':db[_0xeb25('0x76')],'as':_0xeb25('0x7d')}]})[_0xeb25('0x1d')](handleEntityNotFound(_0x1bc1b5,null))[_0xeb25('0x1d')](function(_0x421a0b){_0x1f0523['account']=_0x421a0b;_0x1f0523['applications']=_[_0xeb25('0x7e')](_0x421a0b[_0xeb25('0x7d')],[_0xeb25('0x79')],[_0xeb25('0x7f')]);if(_0x1f0523['account']['Applications']){delete _0x1f0523['account'][_0xeb25('0x7d')];}return db[_0xeb25('0x80')][_0xeb25('0x60')]();})[_0xeb25('0x1d')](function(_0x18c14b){if(!_0x18c14b){throw new db[(_0xeb25('0x81'))]['ValidationError'](_0xeb25('0x82'));}_0x212078=_[_0xeb25('0x83')](_[_0xeb25('0x3f')](_0x18c14b),[_0xeb25('0x84'),_0xeb25('0x85')]);_0x3795a9=_['difference'](_[_0xeb25('0x3f')](_0x18c14b),['createdAt',_0xeb25('0x85'),_0xeb25('0x86'),'ListId']);_0x1f0523['body']={'mapKey':_0xeb25('0x87')};if(_0x1f0523[_0xeb25('0x88')][_0xeb25('0x3b')]&&_0x1f0523['account']['type']==='twilio'){_0x1f0523[_0xeb25('0x57')][_0xeb25('0x89')]=_0x376950[_0xeb25('0x57')][_0xeb25('0x8a')]['replace']('whatsapp:','');_0x1f0523[_0xeb25('0x57')]['body']=_0x376950[_0xeb25('0x57')]['Body'];_0x1f0523[_0xeb25('0x57')][_0xeb25('0x8b')]=_0x376950[_0xeb25('0x57')][_0xeb25('0x8c')];}if(_0x1f0523[_0xeb25('0x57')]['id']){delete _0x1f0523[_0xeb25('0x57')]['id'];}if(_[_0xeb25('0x8d')](_0x1f0523[_0xeb25('0x57')][_0xeb25('0x89')])){throw new db[(_0xeb25('0x81'))][(_0xeb25('0x8e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1f0523[_0xeb25('0x57')]['body'])||_0x1f0523['body'][_0xeb25('0x57')]===''){throw new db['Sequelize'][(_0xeb25('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1f0523['body'][_0xeb25('0x8f')])){throw new db[(_0xeb25('0x81'))][(_0xeb25('0x8e'))](_0xeb25('0x90')+_0x3795a9);}if(!_[_0xeb25('0x91')](_0x3795a9,_0x1f0523['body'][_0xeb25('0x8f')])){throw new db[(_0xeb25('0x81'))][(_0xeb25('0x8e'))](_0xeb25('0x92')+_0x3795a9);}_0x548cd6[_0x1f0523[_0xeb25('0x57')][_0xeb25('0x8f')]]=_0x1f0523[_0xeb25('0x57')][_0xeb25('0x89')];return db[_0xeb25('0x93')][_0xeb25('0x55')]({'where':{'id':_0x1f0523['account'][_0xeb25('0x94')]},'include':[{'model':db[_0xeb25('0x80')],'as':'Contacts','where':_0x548cd6,'limit':0x1,'order':[[_0xeb25('0x85'),_0xeb25('0x95')]]}]});})[_0xeb25('0x1d')](handleEntityNotFound(_0x1bc1b5,null))[_0xeb25('0x1d')](function(_0x4b24f1){if(_0x4b24f1){_0x1f0523[_0xeb25('0x96')]=_['omit'](_0x4b24f1,[_0xeb25('0x97')]);if(_0x4b24f1[_0xeb25('0x97')][_0xeb25('0x44')]){return _0x4b24f1[_0xeb25('0x97')][0x0];}var _0x5078b5=_[_0xeb25('0x98')](_0x1f0523[_0xeb25('0x57')],{'firstName':_0x1f0523[_0xeb25('0x57')][_0xeb25('0x89')],'ListId':_0x4b24f1['id']});_0x5078b5[_0x1f0523[_0xeb25('0x57')][_0xeb25('0x8f')]]=_0x1f0523[_0xeb25('0x57')][_0xeb25('0x89')];return db['CmContact'][_0xeb25('0x56')](_0x5078b5,{'fields':_0x212078,'raw':!![]});}})[_0xeb25('0x1d')](handleEntityNotFound(_0x1bc1b5,null))[_0xeb25('0x1d')](function(_0x46f928){if(_0x46f928){_0x1f0523[_0xeb25('0x99')]=_0x46f928;var _0x4e337c={'ContactId':_0x46f928['id'],'phone':_0x1f0523[_0xeb25('0x57')][_0xeb25('0x89')],'WhatsappAccountId':_0x376950[_0xeb25('0x54')]['id']};var _0x490803={'ContactId':_0x46f928['id'],'WhatsappAccountId':_0x376950[_0xeb25('0x54')]['id'],'closed':![]};return db[_0xeb25('0x9a')]['find']({'where':_0x490803})[_0xeb25('0x1d')](function(_0x178e8d){if(_0x178e8d){return[_0x178e8d,![]];}return db['WhatsappInteraction']['create'](_0x4e337c)[_0xeb25('0x1d')](function(_0x449d13){return[_0x449d13,!![]];});});}})[_0xeb25('0x6e')](function(_0x38fc75,_0xc5f0b8){_0x1f0523[_0xeb25('0x9b')]=_0x38fc75['get']({'plain':!![]});_0x1f0523[_0xeb25('0x9b')]['created']=![];if(_0xc5f0b8){if(_0x1f0523[_0xeb25('0x88')][_0xeb25('0x9c')]){_0x1f0523[_0xeb25('0x9d')][_0xeb25('0x9e')]({'id':0x0,'priority':_0x1f0523['applications'][_0xeb25('0x44')]+0x1,'app':_0xeb25('0x9f'),'appdata':_0xeb25('0xa0'),'interval':_0xeb25('0xa1')});}_0x1f0523[_0xeb25('0x9b')]['created']=!![];}return db[_0xeb25('0xa2')][_0xeb25('0x56')]({'phone':_0x1f0523[_0xeb25('0x57')]['from'],'messageId':_0x1f0523[_0xeb25('0x57')][_0xeb25('0x8b')],'body':_0x1f0523[_0xeb25('0x57')][_0xeb25('0x57')],'WhatsappAccountId':_0x376950['params']['id'],'WhatsappInteractionId':_0x38fc75['id'],'direction':'in','ContactId':_0x38fc75[_0xeb25('0xa3')],'AttachmentId':_0x1f0523[_0xeb25('0x57')][_0xeb25('0xa4')]});})[_0xeb25('0x1d')](function(_0x56fd47){_0x1f0523[_0xeb25('0x24')]=_0x56fd47;if(_0x1f0523['interaction'][_0xeb25('0xa5')]){return db[_0xeb25('0xa6')]['find']({'attributes':['id',_0xeb25('0x32')],'where':{'id':_0x1f0523[_0xeb25('0x9b')][_0xeb25('0xa5')]}})['then'](function(_0x53c836){if(_0x53c836){_0x1f0523['applications'][_0xeb25('0xa7')]({'id':0x0,'priority':0x0,'app':_0xeb25('0xa8'),'appdata':_0x53c836[_0xeb25('0x32')]+','+(_0x1f0523['account'][_0xeb25('0xa9')]||0xa),'interval':_0xeb25('0xa1')});}return respondWithRpcPromise('Start','startRouting',_0x1f0523);});}return respondWithRpcPromise(_0xeb25('0xaa'),_0xeb25('0xab'),_0x1f0523);})['then'](function(_0x3b35b0){if(_0x3b35b0){var _0x5ee01e=0xc8;var _0x54341b='receiveMessage';logger[_0xeb25('0x1e')](_0xeb25('0x21'),_0x54341b,_0x5ee01e,'entity\x20found');logger[_0xeb25('0xac')](_0xeb25('0xad'),_0x54341b,_0x5ee01e,'entity\x20found',JSON[_0xeb25('0x22')](_0x3b35b0));if(_0x1f0523[_0xeb25('0x88')][_0xeb25('0x3b')]===_0xeb25('0xae')){return _0x1bc1b5[_0xeb25('0x27')](_0x5ee01e)[_0xeb25('0x2c')](_0xeb25('0xaf'),_0xeb25('0xb0'))[_0xeb25('0x33')](_0xeb25('0xb1'));}else{return _0x1bc1b5[_0xeb25('0x27')](_0x5ee01e)[_0xeb25('0x29')](_0x3b35b0);}}})[_0xeb25('0x25')](handleError(_0x1bc1b5,null));};exports[_0xeb25('0x33')]=function(_0x4f6f08,_0x44b14a,_0x416d58){var _0x4a51bf,_0x5a7179,_0x4a18e9;if(_[_0xeb25('0x8d')](_0x4f6f08[_0xeb25('0x57')][_0xeb25('0x57')])||_0x4f6f08[_0xeb25('0x57')][_0xeb25('0x57')]===''){throw new db[(_0xeb25('0x81'))]['ValidationError'](_0xeb25('0xb2'));}if(_[_0xeb25('0x8d')](_0x4f6f08['body']['to'])){throw new db[(_0xeb25('0x81'))][(_0xeb25('0x8e'))](_0xeb25('0xb3'));}_0x4a51bf=_0x4f6f08[_0xeb25('0x57')]['to'];return db[_0xeb25('0x38')]['find']({'where':{'id':_0x4f6f08[_0xeb25('0x54')]['id']},'include':[{'model':db[_0xeb25('0x93')],'as':_0xeb25('0xb4'),'include':[{'model':db[_0xeb25('0x80')],'as':_0xeb25('0x97'),'where':{'mobile':_0x4a51bf},'limit':0x1,'order':[['updatedAt',_0xeb25('0x95')]]}]}]})['then'](handleEntityNotFound(_0x44b14a,null))[_0xeb25('0x1d')](function(_0x5e2128){if(_0x5e2128&&_0x5e2128[_0xeb25('0xb4')]){_0x5a7179=_0x5e2128[_0xeb25('0x59')]({'plain':!![]});if(_0x5a7179[_0xeb25('0xb4')]&&_0x5a7179[_0xeb25('0xb4')][_0xeb25('0x97')][_0xeb25('0x44')]){return _0x5a7179[_0xeb25('0xb4')][_0xeb25('0x97')][0x0];}return db[_0xeb25('0x80')]['create'](_[_0xeb25('0x98')](_0x4f6f08['body'],{'firstName':_0x4a51bf,'mobile':_0x4a51bf,'phone':_0x4a51bf,'ListId':_0x5a7179[_0xeb25('0x94')]}));}})[_0xeb25('0x1d')](handleEntityNotFound(_0x44b14a,null))[_0xeb25('0x1d')](function(_0x332b5a){if(_0x332b5a){_0x4a18e9=_0x332b5a;return db[_0xeb25('0x9a')][_0xeb25('0x55')]({'where':{'ContactId':_0x4a18e9['id'],'closed':![],'WhatsappAccountId':_0x5a7179['id']}})[_0xeb25('0x1d')](function(_0x4bdeff){if(_0x4bdeff){return[_0x4bdeff,![]];}return db[_0xeb25('0x9a')][_0xeb25('0x56')]({'UserId':_0x4f6f08[_0xeb25('0x58')]['id'],'ContactId':_0x4a18e9['id'],'WhatsappAccountId':_0x5a7179['id'],'phone':_0x4a51bf,'firstMsgDirection':_0xeb25('0xb5'),'Messages':[_[_0xeb25('0x4d')](_0x4f6f08[_0xeb25('0x57')],{'read':![],'body':_0x4f6f08[_0xeb25('0x57')]['body'],'phone':_0x4a51bf,'WhatsappAccountId':_0x5a7179['id'],'UserId':_0x4f6f08[_0xeb25('0x58')]['id'],'ContactId':_0x4a18e9['id']})]},{'include':[{'model':db[_0xeb25('0xa2')],'as':_0xeb25('0xb6')}]})['then'](function(_0x44eb0f){return[_0x44eb0f,!![]];});});}})[_0xeb25('0x6e')](function(_0x4531f1,_0x423869){if(_0x423869){return _0x4531f1;}return db['WhatsappMessage'][_0xeb25('0x56')](_[_0xeb25('0x4d')](_0x4f6f08['body'],{'read':![],'body':_0x4f6f08[_0xeb25('0x57')][_0xeb25('0x57')],'phone':_0x4a51bf,'WhatsappAccountId':_0x5a7179['id'],'WhatsappInteractionId':_0x4531f1['id'],'UserId':_0x4f6f08['user']['id'],'ContactId':_0x4a18e9['id']}))['then'](function(_0x33f34f){_0x4531f1[_0xeb25('0xb7')]['Messages']=[];_0x4531f1[_0xeb25('0xb7')][_0xeb25('0xb6')]['push'](_0x33f34f[_0xeb25('0xb7')]);return _0x4531f1;});})[_0xeb25('0x1d')](respondWithResult(_0x44b14a,null))[_0xeb25('0x25')](handleError(_0x44b14a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 064674a..bdb85ed 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 _0xc6a2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x55fe98,_0x48df72){var _0x5b6e36=function(_0xa20f90){while(--_0xa20f90){_0x55fe98['push'](_0x55fe98['shift']());}};_0x5b6e36(++_0x48df72);}(_0xc6a2,0x69));var _0x2c6a=function(_0x18665e,_0x502bd3){_0x18665e=_0x18665e-0x0;var _0x550ac9=_0xc6a2[_0x18665e];return _0x550ac9;};'use strict';var EventEmitter=require(_0x2c6a('0x0'));var WhatsappAccount=require(_0x2c6a('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2c6a('0x2')](0x0);var events={'afterCreate':_0x2c6a('0x3'),'afterUpdate':_0x2c6a('0x4'),'afterDestroy':_0x2c6a('0x5')};function emitEvent(_0x121b96){return function(_0xc93e9a,_0x3b1269,_0x1d2cfd){WhatsappAccountEvents[_0x2c6a('0x6')](_0x121b96+':'+_0xc93e9a['id'],_0xc93e9a);WhatsappAccountEvents[_0x2c6a('0x6')](_0x121b96,_0xc93e9a);_0x1d2cfd(null);};}for(var e in events){if(events[_0x2c6a('0x7')](e)){var event=events[e];WhatsappAccount[_0x2c6a('0x8')](e,emitEvent(event));}}module[_0x2c6a('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x01d9=['WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5e75ef,_0x4ce765){var _0x3c28b2=function(_0x29a66c){while(--_0x29a66c){_0x5e75ef['push'](_0x5e75ef['shift']());}};_0x3c28b2(++_0x4ce765);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x901d('0x0'));var WhatsappAccount=require(_0x901d('0x1'))['db'][_0x901d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x901d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x901d('0x4'),'afterDestroy':_0x901d('0x5')};function emitEvent(_0x247cfc){return function(_0x8f7b4,_0x214f38,_0x456f31){WhatsappAccountEvents[_0x901d('0x6')](_0x247cfc+':'+_0x8f7b4['id'],_0x8f7b4);WhatsappAccountEvents['emit'](_0x247cfc,_0x8f7b4);_0x456f31(null);};}for(var e in events){if(events[_0x901d('0x7')](e)){var event=events[e];WhatsappAccount[_0x901d('0x8')](e,emitEvent(event));}}module[_0x901d('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0ecab06..b5b4bb9 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 _0x4d86=['define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4d86,0x6a));var _0x64d8=function(_0x5d1a86,_0x56a303){_0x5d1a86=_0x5d1a86-0x0;var _0x55a1df=_0x4d86[_0x5d1a86];return _0x55a1df;};'use strict';var _=require(_0x64d8('0x0'));var util=require(_0x64d8('0x1'));var logger=require(_0x64d8('0x2'))(_0x64d8('0x3'));var moment=require(_0x64d8('0x4'));var BPromise=require(_0x64d8('0x5'));var rp=require(_0x64d8('0x6'));var fs=require('fs');var path=require(_0x64d8('0x7'));var rimraf=require(_0x64d8('0x8'));var config=require('../../config/environment');var attributes=require(_0x64d8('0x9'));module[_0x64d8('0xa')]=function(_0x41b71b,_0x392d71){return _0x41b71b[_0x64d8('0xb')]('WhatsappAccount',attributes,{'tableName':_0x64d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0105=['rimraf','../../config/environment','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xa013a4,_0x2ff249){var _0x27f4a2=function(_0x1a5a6f){while(--_0x1a5a6f){_0xa013a4['push'](_0xa013a4['shift']());}};_0x27f4a2(++_0x2ff249);}(_0x0105,0x16c));var _0x5010=function(_0x51f08b,_0xbd7ed7){_0x51f08b=_0x51f08b-0x0;var _0x546259=_0x0105[_0x51f08b];return _0x546259;};'use strict';var _=require(_0x5010('0x0'));var util=require('util');var logger=require(_0x5010('0x1'))('api');var moment=require(_0x5010('0x2'));var BPromise=require(_0x5010('0x3'));var rp=require(_0x5010('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5010('0x5'));var config=require(_0x5010('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x5010('0x7')]=function(_0x4e8376,_0x2e1143){return _0x4e8376[_0x5010('0x8')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 970fe22..347fc6f 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 _0x749c=['then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x108f30,_0x1c2bc6){var _0x12be71=function(_0x48d8fd){while(--_0x48d8fd){_0x108f30['push'](_0x108f30['shift']());}};_0x12be71(++_0x1c2bc6);}(_0x749c,0x17a));var _0xc749=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x749c[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var moment=require(_0xc749('0x2'));var BPromise=require(_0xc749('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc749('0x4'));var db=require(_0xc749('0x5'))['db'];var utils=require(_0xc749('0x6'));var logger=require(_0xc749('0x7'))(_0xc749('0x8'));var config=require(_0xc749('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc749('0xa')]['http']({'port':0x232a});config[_0xc749('0xb')]=_[_0xc749('0xc')](config['redis'],{'host':_0xc749('0xd'),'port':0x18eb});var socket=require(_0xc749('0xe'))(new Redis(config[_0xc749('0xb')]));require(_0xc749('0xf'))[_0xc749('0x10')](socket);function respondWithRpcPromise(_0x51f21a,_0x24191f,_0x10c30e){return new BPromise(function(_0x58fbe2,_0xec2c50){return client[_0xc749('0x11')](_0x51f21a,_0x10c30e)[_0xc749('0x12')](function(_0x50a850){logger[_0xc749('0x13')](_0xc749('0x14'),_0x24191f,_0xc749('0x15'));logger[_0xc749('0x16')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x24191f,'request\x20sent',JSON['stringify'](_0x50a850));if(_0x50a850[_0xc749('0x17')]){if(_0x50a850[_0xc749('0x17')]['code']===0x1f4){logger[_0xc749('0x17')](_0xc749('0x14'),_0x24191f,_0x50a850[_0xc749('0x17')]['message']);return _0xec2c50(_0x50a850[_0xc749('0x17')][_0xc749('0x18')]);}logger[_0xc749('0x17')](_0xc749('0x14'),_0x24191f,_0x50a850[_0xc749('0x17')]['message']);return _0x58fbe2(_0x50a850[_0xc749('0x17')]['message']);}else{logger[_0xc749('0x13')](_0xc749('0x14'),_0x24191f,_0xc749('0x15'));_0x58fbe2(_0x50a850[_0xc749('0x19')]['message']);}})['catch'](function(_0x25a086){logger[_0xc749('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x24191f,_0x25a086);_0xec2c50(_0x25a086);});});}exports[_0xc749('0x1a')]=function(_0x3b2741){var _0x5616fd=this;return new Promise(function(_0x3406d2,_0x2b40e1){return db['WhatsappAccount'][_0xc749('0x1b')]({'raw':_0x3b2741['options']?_0x3b2741[_0xc749('0x1c')][_0xc749('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b2741[_0xc749('0x1c')]?_0x3b2741[_0xc749('0x1c')][_0xc749('0x1e')]||null:null,'attributes':_0x3b2741[_0xc749('0x1c')]?_0x3b2741[_0xc749('0x1c')][_0xc749('0x1f')]||null:null,'include':_0x3b2741[_0xc749('0x1c')]?_0x3b2741['options'][_0xc749('0x20')]?_[_0xc749('0x21')](_0x3b2741['options'][_0xc749('0x20')],function(_0x536bbb){return{'model':db[_0x536bbb[_0xc749('0x22')]],'as':_0x536bbb['as'],'attributes':_0x536bbb[_0xc749('0x1f')],'include':_0x536bbb[_0xc749('0x20')]?_[_0xc749('0x21')](_0x536bbb[_0xc749('0x20')],function(_0x1cefff){return{'model':db[_0x1cefff[_0xc749('0x22')]],'as':_0x1cefff['as'],'attributes':_0x1cefff[_0xc749('0x1f')],'include':_0x1cefff[_0xc749('0x20')]?_[_0xc749('0x21')](_0x1cefff[_0xc749('0x20')],function(_0x918a5f){return{'model':db[_0x918a5f[_0xc749('0x22')]],'as':_0x918a5f['as'],'attributes':_0x918a5f[_0xc749('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37280a){logger[_0xc749('0x13')](_0xc749('0x1a'),_0x3b2741);logger['debug'](_0xc749('0x1a'),_0x3b2741,JSON['stringify'](_0x37280a));_0x3406d2(_0x37280a);})[_0xc749('0x23')](function(_0x5928de){logger[_0xc749('0x17')](_0xc749('0x1a'),_0x5928de[_0xc749('0x18')],_0x3b2741);_0x2b40e1(_0x5616fd[_0xc749('0x17')](0x1f4,_0x5928de[_0xc749('0x18')]));});});}; \ No newline at end of file +var _0xf09f=['stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','ShowWhatsappAccount','find','raw','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','request','then','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0xf09f,0x1cc));var _0xff09=function(_0x50839e,_0x1e4b4c){_0x50839e=_0x50839e-0x0;var _0x33e314=_0xf09f[_0x50839e];return _0x33e314;};'use strict';var _=require('lodash');var util=require(_0xff09('0x0'));var moment=require(_0xff09('0x1'));var BPromise=require(_0xff09('0x2'));var rs=require(_0xff09('0x3'));var fs=require('fs');var Redis=require(_0xff09('0x4'));var db=require(_0xff09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff09('0x6'))(_0xff09('0x7'));var config=require(_0xff09('0x8'));var jayson=require(_0xff09('0x9'));var client=jayson[_0xff09('0xa')][_0xff09('0xb')]({'port':0x232a});config[_0xff09('0xc')]=_[_0xff09('0xd')](config[_0xff09('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xff09('0xe'))(new Redis(config[_0xff09('0xc')]));require(_0xff09('0xf'))['register'](socket);function respondWithRpcPromise(_0x24ad2c,_0x433408,_0x50c0e9){return new BPromise(function(_0x313bb1,_0x58f903){return client[_0xff09('0x10')](_0x24ad2c,_0x50c0e9)[_0xff09('0x11')](function(_0x53ce0e){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x433408,'request\x20sent');logger[_0xff09('0x12')](_0xff09('0x13'),_0x433408,_0xff09('0x14'),JSON[_0xff09('0x15')](_0x53ce0e));if(_0x53ce0e[_0xff09('0x16')]){if(_0x53ce0e['error'][_0xff09('0x17')]===0x1f4){logger[_0xff09('0x16')](_0xff09('0x18'),_0x433408,_0x53ce0e[_0xff09('0x16')]['message']);return _0x58f903(_0x53ce0e[_0xff09('0x16')]['message']);}logger[_0xff09('0x16')](_0xff09('0x18'),_0x433408,_0x53ce0e['error'][_0xff09('0x19')]);return _0x313bb1(_0x53ce0e['error'][_0xff09('0x19')]);}else{logger[_0xff09('0x1a')](_0xff09('0x18'),_0x433408,_0xff09('0x14'));_0x313bb1(_0x53ce0e[_0xff09('0x1b')][_0xff09('0x19')]);}})['catch'](function(_0x270c19){logger[_0xff09('0x16')](_0xff09('0x18'),_0x433408,_0x270c19);_0x58f903(_0x270c19);});});}exports[_0xff09('0x1c')]=function(_0x20966d){var _0xe51b5b=this;return new Promise(function(_0x506e2a,_0x1bcb04){return db['WhatsappAccount'][_0xff09('0x1d')]({'raw':_0x20966d['options']?_0x20966d['options'][_0xff09('0x1e')]===undefined?!![]:![]:!![],'where':_0x20966d[_0xff09('0x1f')]?_0x20966d[_0xff09('0x1f')][_0xff09('0x20')]||null:null,'attributes':_0x20966d[_0xff09('0x1f')]?_0x20966d['options'][_0xff09('0x21')]||null:null,'include':_0x20966d[_0xff09('0x1f')]?_0x20966d['options'][_0xff09('0x22')]?_[_0xff09('0x23')](_0x20966d['options'][_0xff09('0x22')],function(_0x8a5f10){return{'model':db[_0x8a5f10['model']],'as':_0x8a5f10['as'],'attributes':_0x8a5f10['attributes'],'include':_0x8a5f10[_0xff09('0x22')]?_[_0xff09('0x23')](_0x8a5f10['include'],function(_0x1552c9){return{'model':db[_0x1552c9[_0xff09('0x24')]],'as':_0x1552c9['as'],'attributes':_0x1552c9[_0xff09('0x21')],'include':_0x1552c9[_0xff09('0x22')]?_[_0xff09('0x23')](_0x1552c9[_0xff09('0x22')],function(_0xb99eaf){return{'model':db[_0xb99eaf[_0xff09('0x24')]],'as':_0xb99eaf['as'],'attributes':_0xb99eaf['attributes']};}):[]};}):[]};}):[]:[]})[_0xff09('0x11')](function(_0x3fb5ab){logger[_0xff09('0x1a')]('ShowWhatsappAccount',_0x20966d);logger[_0xff09('0x12')]('ShowWhatsappAccount',_0x20966d,JSON['stringify'](_0x3fb5ab));_0x506e2a(_0x3fb5ab);})['catch'](function(_0x709d3c){logger['error']('ShowWhatsappAccount',_0x709d3c[_0xff09('0x19')],_0x20966d);_0x1bcb04(_0xe51b5b[_0xff09('0x16')](0x1f4,_0x709d3c[_0xff09('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index cda0006..0ad368e 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 _0xf884=['./whatsappAccount.events','save','update','removeListener','register','length','whatsappAccount:'];(function(_0x5d4818,_0x3ccae2){var _0x578a9c=function(_0x530284){while(--_0x530284){_0x5d4818['push'](_0x5d4818['shift']());}};_0x578a9c(++_0x3ccae2);}(_0xf884,0x19d));var _0x4f88=function(_0x5818fc,_0x3483d4){_0x5818fc=_0x5818fc-0x0;var _0x1fc95f=_0xf884[_0x5818fc];return _0x1fc95f;};'use strict';var WhatsappAccountEvents=require(_0x4f88('0x0'));var events=[_0x4f88('0x1'),'remove',_0x4f88('0x2')];function createListener(_0x3556a3,_0x561066){return function(_0x384174){_0x561066['emit'](_0x3556a3,_0x384174);};}function removeListener(_0x43dd4f,_0x2e19cb){return function(){WhatsappAccountEvents[_0x4f88('0x3')](_0x43dd4f,_0x2e19cb);};}exports[_0x4f88('0x4')]=function(_0x552105){for(var _0x1dc683=0x0,_0x1d373c=events[_0x4f88('0x5')];_0x1dc683<_0x1d373c;_0x1dc683++){var _0x4db0d4=events[_0x1dc683];var _0x3cb201=createListener(_0x4f88('0x6')+_0x4db0d4,_0x552105);WhatsappAccountEvents['on'](_0x4db0d4,_0x3cb201);}}; \ No newline at end of file +var _0x2819=['./whatsappAccount.events','save','removeListener','register','whatsappAccount:'];(function(_0x29b1d5,_0x132707){var _0x288575=function(_0x20536a){while(--_0x20536a){_0x29b1d5['push'](_0x29b1d5['shift']());}};_0x288575(++_0x132707);}(_0x2819,0x186));var _0x9281=function(_0x38bdca,_0x1445e5){_0x38bdca=_0x38bdca-0x0;var _0x51ca98=_0x2819[_0x38bdca];return _0x51ca98;};'use strict';var WhatsappAccountEvents=require(_0x9281('0x0'));var events=[_0x9281('0x1'),'remove','update'];function createListener(_0xb0081e,_0x58fd10){return function(_0x35a807){_0x58fd10['emit'](_0xb0081e,_0x35a807);};}function removeListener(_0x4c7c59,_0x3db84f){return function(){WhatsappAccountEvents[_0x9281('0x2')](_0x4c7c59,_0x3db84f);};}exports[_0x9281('0x3')]=function(_0x430dea){for(var _0x37a237=0x0,_0x161864=events['length'];_0x37a237<_0x161864;_0x37a237++){var _0x2882ac=events[_0x37a237];var _0x1373e8=createListener(_0x9281('0x4')+_0x2882ac,_0x430dea);WhatsappAccountEvents['on'](_0x2882ac,_0x1373e8);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 03c184a..4a707c7 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 _0x51be=['./whatsappApplication.controller','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x51be,0x1e7));var _0xe51b=function(_0x16cf9e,_0x3d3cfd){_0x16cf9e=_0x16cf9e-0x0;var _0x56aefd=_0x51be[_0x16cf9e];return _0x56aefd;};'use strict';var multer=require(_0xe51b('0x0'));var util=require('util');var path=require(_0xe51b('0x1'));var timeout=require(_0xe51b('0x2'));var express=require(_0xe51b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe51b('0x4'));var config=require(_0xe51b('0x5'));var controller=require(_0xe51b('0x6'));router[_0xe51b('0x7')]('/',auth[_0xe51b('0x8')](),controller[_0xe51b('0x9')]);router[_0xe51b('0x7')]('/:id',auth[_0xe51b('0x8')](),controller[_0xe51b('0xa')]);router[_0xe51b('0xb')]('/',auth[_0xe51b('0x8')](),controller['create']);router['put'](_0xe51b('0xc'),auth[_0xe51b('0x8')](),controller[_0xe51b('0xd')]);router[_0xe51b('0xe')]('/:id',auth[_0xe51b('0x8')](),controller[_0xe51b('0xf')]);module[_0xe51b('0x10')]=router; \ No newline at end of file +var _0xa92f=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x1381df,_0xa4f9e9){var _0x3dd915=function(_0x104735){while(--_0x104735){_0x1381df['push'](_0x1381df['shift']());}};_0x3dd915(++_0xa4f9e9);}(_0xa92f,0x8f));var _0xfa92=function(_0x189fbc,_0xf3c0ac){_0x189fbc=_0x189fbc-0x0;var _0x4474fe=_0xa92f[_0x189fbc];return _0x4474fe;};'use strict';var multer=require(_0xfa92('0x0'));var util=require('util');var path=require(_0xfa92('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa92('0x2'));var router=express[_0xfa92('0x3')]();var auth=require(_0xfa92('0x4'));var interaction=require(_0xfa92('0x5'));var config=require(_0xfa92('0x6'));var controller=require(_0xfa92('0x7'));router['get']('/',auth[_0xfa92('0x8')](),controller['index']);router[_0xfa92('0x9')](_0xfa92('0xa'),auth['isAuthenticated'](),controller[_0xfa92('0xb')]);router[_0xfa92('0xc')]('/',auth[_0xfa92('0x8')](),controller[_0xfa92('0xd')]);router[_0xfa92('0xe')]('/:id',auth[_0xfa92('0x8')](),controller['update']);router[_0xfa92('0xf')](_0xfa92('0xa'),auth[_0xfa92('0x8')](),controller[_0xfa92('0x10')]);module[_0xfa92('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d746c90..4c3d552 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 _0xb3ee=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x4f43c4,_0x15b282){var _0x5e0585=function(_0xf1dabc){while(--_0xf1dabc){_0x4f43c4['push'](_0x4f43c4['shift']());}};_0x5e0585(++_0x15b282);}(_0xb3ee,0x17a));var _0xeb3e=function(_0x46efb5,_0x2c9f29){_0x46efb5=_0x46efb5-0x0;var _0x49ac20=_0xb3ee[_0x46efb5];return _0x49ac20;};'use strict';var Sequelize=require(_0xeb3e('0x0'));module[_0xeb3e('0x1')]={'priority':{'type':Sequelize[_0xeb3e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeb3e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xeb3e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeb3e('0x5')}}; \ No newline at end of file +var _0x7cc7=['TEXT','*,*,*,*','STRING','noop'];(function(_0x7fa6dd,_0x1820b9){var _0x17e225=function(_0x309fee){while(--_0x309fee){_0x7fa6dd['push'](_0x7fa6dd['shift']());}};_0x17e225(++_0x1820b9);}(_0x7cc7,0xf2));var _0x77cc=function(_0x1ddc26,_0x261215){_0x1ddc26=_0x1ddc26-0x0;var _0x250c93=_0x7cc7[_0x1ddc26];return _0x250c93;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x77cc('0x0')],'allowNull':![],'defaultValue':_0x77cc('0x1')},'appdata':{'type':Sequelize[_0x77cc('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x77cc('0x0')],'defaultValue':_0x77cc('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0053142..c67b513 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 _0x3e99=['crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappApplication','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel'];(function(_0x403276,_0x34bec9){var _0xf19e78=function(_0x3dee06){while(--_0x3dee06){_0x403276['push'](_0x403276['shift']());}};_0xf19e78(++_0x34bec9);}(_0x3e99,0x89));var _0x93e9=function(_0x568cd2,_0x319ed8){_0x568cd2=_0x568cd2-0x0;var _0x426629=_0x3e99[_0x568cd2];return _0x426629;};'use strict';var pdf=require(_0x93e9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x93e9('0x1'));var zipdir=require(_0x93e9('0x2'));var jsonpatch=require(_0x93e9('0x3'));var rp=require(_0x93e9('0x4'));var moment=require('moment');var BPromise=require(_0x93e9('0x5'));var Mustache=require(_0x93e9('0x6'));var util=require(_0x93e9('0x7'));var path=require(_0x93e9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x93e9('0x9'));var squel=require(_0x93e9('0xa'));var crypto=require(_0x93e9('0xb'));var jsforce=require(_0x93e9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93e9('0xd'));var querystring=require(_0x93e9('0xe'));var Papa=require('papaparse');var Redis=require(_0x93e9('0xf'));var authService=require(_0x93e9('0x10'));var qs=require(_0x93e9('0x11'));var as=require(_0x93e9('0x12'));var hardwareService=require(_0x93e9('0x13'));var logger=require(_0x93e9('0x14'))(_0x93e9('0x15'));var utils=require('../../config/utils');var config=require(_0x93e9('0x16'));var licenseUtil=require(_0x93e9('0x17'));var db=require(_0x93e9('0x18'))['db'];function respondWithStatusCode(_0x46c7bc,_0x405bfb){_0x405bfb=_0x405bfb||0xcc;return function(_0x23227d){if(_0x23227d){return _0x46c7bc['sendStatus'](_0x405bfb);}return _0x46c7bc[_0x93e9('0x19')](_0x405bfb)['end']();};}function respondWithResult(_0x30ff21,_0x18ae92){_0x18ae92=_0x18ae92||0xc8;return function(_0x404dca){if(_0x404dca){return _0x30ff21[_0x93e9('0x19')](_0x18ae92)[_0x93e9('0x1a')](_0x404dca);}};}function respondWithFilteredResult(_0x19a11e,_0x5a4438){return function(_0x2c92b0){if(_0x2c92b0){var _0x38ccb8=_0x2c92b0[_0x93e9('0x1b')],_0x43bd56=_0x5a4438[_0x93e9('0x1c')],_0x263748=_0x5a4438[_0x93e9('0x1c')]+_0x5a4438[_0x93e9('0x1d')],_0x12d03b;if(_0x263748>=_0x38ccb8){_0x263748=_0x38ccb8;_0x12d03b=0xc8;}else{_0x12d03b=0xce;}_0x19a11e[_0x93e9('0x19')](_0x12d03b);return _0x19a11e[_0x93e9('0x1e')](_0x93e9('0x1f'),_0x43bd56+'-'+_0x263748+'/'+_0x38ccb8)[_0x93e9('0x1a')](_0x2c92b0);}return null;};}function patchUpdates(_0x5b373e){return function(_0x1575c1){try{jsonpatch[_0x93e9('0x20')](_0x1575c1,_0x5b373e,!![]);}catch(_0x137868){return BPromise[_0x93e9('0x21')](_0x137868);}return _0x1575c1[_0x93e9('0x22')]();};}function saveUpdates(_0x2e7335,_0xdb13c6){return function(_0x184c63){if(_0x184c63){return _0x184c63['update'](_0x2e7335)[_0x93e9('0x23')](function(_0x587b70){return _0x587b70;});}return null;};}function removeEntity(_0x12bda5,_0x320fb8){return function(_0x33f40c){if(_0x33f40c){return _0x33f40c[_0x93e9('0x24')]()[_0x93e9('0x23')](function(){_0x12bda5[_0x93e9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228fe3,_0x2b0895){return function(_0x33c43b){if(!_0x33c43b){_0x228fe3['sendStatus'](0x194);}return _0x33c43b;};}function handleError(_0x2f7ace,_0x23dbaf){_0x23dbaf=_0x23dbaf||0x1f4;return function(_0x5a31db){logger[_0x93e9('0x25')](_0x5a31db[_0x93e9('0x26')]);if(_0x5a31db[_0x93e9('0x27')]){delete _0x5a31db['name'];}_0x2f7ace[_0x93e9('0x19')](_0x23dbaf)['send'](_0x5a31db);};}exports[_0x93e9('0x28')]=function(_0xc2388b,_0x389885){var _0xd1d09b={},_0x5d258e={},_0x383f2c={'count':0x0,'rows':[]};var _0x1883a5=_[_0x93e9('0x29')](db[_0x93e9('0x2a')]['rawAttributes'],function(_0x34020e){return{'name':_0x34020e[_0x93e9('0x2b')],'type':_0x34020e[_0x93e9('0x2c')]['key']};});_0x5d258e[_0x93e9('0x2d')]=_[_0x93e9('0x29')](_0x1883a5,_0x93e9('0x27'));_0x5d258e[_0x93e9('0x2e')]=_[_0x93e9('0x2f')](_0xc2388b[_0x93e9('0x2e')]);_0x5d258e['filters']=_[_0x93e9('0x30')](_0x5d258e['model'],_0x5d258e[_0x93e9('0x2e')]);_0xd1d09b[_0x93e9('0x31')]=_['intersection'](_0x5d258e['model'],qs[_0x93e9('0x32')](_0xc2388b[_0x93e9('0x2e')][_0x93e9('0x32')]));_0xd1d09b[_0x93e9('0x31')]=_0xd1d09b[_0x93e9('0x31')][_0x93e9('0x33')]?_0xd1d09b[_0x93e9('0x31')]:_0x5d258e[_0x93e9('0x2d')];if(!_0xc2388b['query']['hasOwnProperty'](_0x93e9('0x34'))){_0xd1d09b[_0x93e9('0x1d')]=qs[_0x93e9('0x1d')](_0xc2388b['query'][_0x93e9('0x1d')]);_0xd1d09b['offset']=qs[_0x93e9('0x1c')](_0xc2388b['query'][_0x93e9('0x1c')]);}_0xd1d09b[_0x93e9('0x35')]=qs[_0x93e9('0x36')](_0xc2388b[_0x93e9('0x2e')][_0x93e9('0x36')]);_0xd1d09b['where']=qs[_0x93e9('0x37')](_[_0x93e9('0x38')](_0xc2388b[_0x93e9('0x2e')],_0x5d258e['filters']),_0x1883a5);if(_0xc2388b[_0x93e9('0x2e')][_0x93e9('0x39')]){_0xd1d09b['where']=_[_0x93e9('0x3a')](_0xd1d09b['where'],{'$or':_['map'](_0x1883a5,function(_0x4d4dc3){if(_0x4d4dc3[_0x93e9('0x2c')]!==_0x93e9('0x3b')){var _0x69204f={};_0x69204f[_0x4d4dc3['name']]={'$like':'%'+_0xc2388b[_0x93e9('0x2e')]['filter']+'%'};return _0x69204f;}})});}_0xd1d09b=_['merge']({},_0xd1d09b,_0xc2388b[_0x93e9('0x3c')]);var _0x4cc95e={'where':_0xd1d09b[_0x93e9('0x3d')]};return db['WhatsappApplication'][_0x93e9('0x1b')](_0x4cc95e)[_0x93e9('0x23')](function(_0x2af461){_0x383f2c[_0x93e9('0x1b')]=_0x2af461;if(_0xc2388b[_0x93e9('0x2e')][_0x93e9('0x3e')]){_0xd1d09b['include']=[{'all':!![]}];}return db[_0x93e9('0x2a')][_0x93e9('0x3f')](_0xd1d09b);})['then'](function(_0x40ad53){_0x383f2c[_0x93e9('0x40')]=_0x40ad53;return _0x383f2c;})['then'](respondWithFilteredResult(_0x389885,_0xd1d09b))[_0x93e9('0x41')](handleError(_0x389885,null));};exports[_0x93e9('0x42')]=function(_0x566676,_0xac0f57){var _0x2914b6={'raw':!![],'where':{'id':_0x566676[_0x93e9('0x43')]['id']}},_0x57d8cc={};_0x57d8cc[_0x93e9('0x2d')]=_[_0x93e9('0x2f')](db['WhatsappApplication'][_0x93e9('0x44')]);_0x57d8cc[_0x93e9('0x2e')]=_[_0x93e9('0x2f')](_0x566676[_0x93e9('0x2e')]);_0x57d8cc[_0x93e9('0x37')]=_[_0x93e9('0x30')](_0x57d8cc[_0x93e9('0x2d')],_0x57d8cc[_0x93e9('0x2e')]);_0x2914b6[_0x93e9('0x31')]=_['intersection'](_0x57d8cc[_0x93e9('0x2d')],qs['fields'](_0x566676[_0x93e9('0x2e')][_0x93e9('0x32')]));_0x2914b6[_0x93e9('0x31')]=_0x2914b6[_0x93e9('0x31')]['length']?_0x2914b6[_0x93e9('0x31')]:_0x57d8cc[_0x93e9('0x2d')];if(_0x566676[_0x93e9('0x2e')][_0x93e9('0x3e')]){_0x2914b6[_0x93e9('0x45')]=[{'all':!![]}];}_0x2914b6=_[_0x93e9('0x3a')]({},_0x2914b6,_0x566676[_0x93e9('0x3c')]);return db[_0x93e9('0x2a')][_0x93e9('0x46')](_0x2914b6)[_0x93e9('0x23')](handleEntityNotFound(_0xac0f57,null))[_0x93e9('0x23')](respondWithResult(_0xac0f57,null))[_0x93e9('0x41')](handleError(_0xac0f57,null));};exports['create']=function(_0x4ab018,_0x32a229){return db[_0x93e9('0x2a')][_0x93e9('0x47')](_0x4ab018[_0x93e9('0x48')],{})[_0x93e9('0x23')](respondWithResult(_0x32a229,0xc9))[_0x93e9('0x41')](handleError(_0x32a229,null));};exports[_0x93e9('0x49')]=function(_0x3e7e7c,_0x4acdf5){if(_0x3e7e7c[_0x93e9('0x48')]['id']){delete _0x3e7e7c[_0x93e9('0x48')]['id'];}return db['WhatsappApplication'][_0x93e9('0x46')]({'where':{'id':_0x3e7e7c[_0x93e9('0x43')]['id']}})[_0x93e9('0x23')](handleEntityNotFound(_0x4acdf5,null))[_0x93e9('0x23')](saveUpdates(_0x3e7e7c[_0x93e9('0x48')],null))[_0x93e9('0x23')](respondWithResult(_0x4acdf5,null))[_0x93e9('0x41')](handleError(_0x4acdf5,null));};exports['destroy']=function(_0x4d7387,_0x22d029){return db[_0x93e9('0x2a')][_0x93e9('0x46')]({'where':{'id':_0x4d7387[_0x93e9('0x43')]['id']}})[_0x93e9('0x23')](handleEntityNotFound(_0x22d029,null))[_0x93e9('0x23')](removeEntity(_0x22d029,null))[_0x93e9('0x41')](handleError(_0x22d029,null));}; \ No newline at end of file +var _0xbad2=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','apply','save','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring'];(function(_0x56ff3f,_0x10ef8b){var _0x3d13da=function(_0x5504fd){while(--_0x5504fd){_0x56ff3f['push'](_0x56ff3f['shift']());}};_0x3d13da(++_0x10ef8b);}(_0xbad2,0xbc));var _0x2bad=function(_0x199f68,_0x15447c){_0x199f68=_0x199f68-0x0;var _0x138256=_0xbad2[_0x199f68];return _0x138256;};'use strict';var pdf=require(_0x2bad('0x0'));var emlformat=require(_0x2bad('0x1'));var rimraf=require(_0x2bad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bad('0x3'));var rp=require(_0x2bad('0x4'));var moment=require(_0x2bad('0x5'));var BPromise=require(_0x2bad('0x6'));var Mustache=require('mustache');var util=require(_0x2bad('0x7'));var path=require(_0x2bad('0x8'));var sox=require(_0x2bad('0x9'));var csv=require(_0x2bad('0xa'));var ejs=require(_0x2bad('0xb'));var fs=require('fs');var _=require(_0x2bad('0xc'));var squel=require('squel');var crypto=require(_0x2bad('0xd'));var jsforce=require(_0x2bad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2bad('0xa'));var querystring=require(_0x2bad('0xf'));var Papa=require(_0x2bad('0x10'));var Redis=require(_0x2bad('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2bad('0x12'));var as=require(_0x2bad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2bad('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2bad('0x15'));var db=require(_0x2bad('0x16'))['db'];function respondWithStatusCode(_0x3a9af4,_0x3f0599){_0x3f0599=_0x3f0599||0xcc;return function(_0xb95679){if(_0xb95679){return _0x3a9af4['sendStatus'](_0x3f0599);}return _0x3a9af4[_0x2bad('0x17')](_0x3f0599)[_0x2bad('0x18')]();};}function respondWithResult(_0x20a83c,_0x3b7e9a){_0x3b7e9a=_0x3b7e9a||0xc8;return function(_0x1876ad){if(_0x1876ad){return _0x20a83c[_0x2bad('0x17')](_0x3b7e9a)[_0x2bad('0x19')](_0x1876ad);}};}function respondWithFilteredResult(_0x521d55,_0x4fa921){return function(_0x4e9114){if(_0x4e9114){var _0xebc6d8=_0x4e9114[_0x2bad('0x1a')],_0x750287=_0x4fa921[_0x2bad('0x1b')],_0xef2a4f=_0x4fa921[_0x2bad('0x1b')]+_0x4fa921['limit'],_0x2852a7;if(_0xef2a4f>=_0xebc6d8){_0xef2a4f=_0xebc6d8;_0x2852a7=0xc8;}else{_0x2852a7=0xce;}_0x521d55[_0x2bad('0x17')](_0x2852a7);return _0x521d55[_0x2bad('0x1c')]('Content-Range',_0x750287+'-'+_0xef2a4f+'/'+_0xebc6d8)[_0x2bad('0x19')](_0x4e9114);}return null;};}function patchUpdates(_0x76d146){return function(_0x218a93){try{jsonpatch[_0x2bad('0x1d')](_0x218a93,_0x76d146,!![]);}catch(_0x17b540){return BPromise['reject'](_0x17b540);}return _0x218a93[_0x2bad('0x1e')]();};}function saveUpdates(_0x2fd98f,_0x4b0ce9){return function(_0x183925){if(_0x183925){return _0x183925['update'](_0x2fd98f)[_0x2bad('0x1f')](function(_0x4df63f){return _0x4df63f;});}return null;};}function removeEntity(_0x9bfc7b,_0x452702){return function(_0x45f26a){if(_0x45f26a){return _0x45f26a[_0x2bad('0x20')]()[_0x2bad('0x1f')](function(){_0x9bfc7b[_0x2bad('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7855,_0x5ae308){return function(_0x59c0e2){if(!_0x59c0e2){_0x2f7855['sendStatus'](0x194);}return _0x59c0e2;};}function handleError(_0x319f79,_0x3ec675){_0x3ec675=_0x3ec675||0x1f4;return function(_0x168955){logger['error'](_0x168955[_0x2bad('0x21')]);if(_0x168955[_0x2bad('0x22')]){delete _0x168955[_0x2bad('0x22')];}_0x319f79[_0x2bad('0x17')](_0x3ec675)[_0x2bad('0x23')](_0x168955);};}exports[_0x2bad('0x24')]=function(_0x170f41,_0x45cfca){var _0x1548f4={},_0x332fdc={},_0x13e4fd={'count':0x0,'rows':[]};var _0x1b9536=_[_0x2bad('0x25')](db[_0x2bad('0x26')][_0x2bad('0x27')],function(_0x2c31e7){return{'name':_0x2c31e7[_0x2bad('0x28')],'type':_0x2c31e7[_0x2bad('0x29')][_0x2bad('0x2a')]};});_0x332fdc[_0x2bad('0x2b')]=_[_0x2bad('0x25')](_0x1b9536,_0x2bad('0x22'));_0x332fdc[_0x2bad('0x2c')]=_[_0x2bad('0x2d')](_0x170f41['query']);_0x332fdc[_0x2bad('0x2e')]=_[_0x2bad('0x2f')](_0x332fdc[_0x2bad('0x2b')],_0x332fdc[_0x2bad('0x2c')]);_0x1548f4[_0x2bad('0x30')]=_['intersection'](_0x332fdc[_0x2bad('0x2b')],qs[_0x2bad('0x31')](_0x170f41[_0x2bad('0x2c')][_0x2bad('0x31')]));_0x1548f4['attributes']=_0x1548f4[_0x2bad('0x30')][_0x2bad('0x32')]?_0x1548f4['attributes']:_0x332fdc[_0x2bad('0x2b')];if(!_0x170f41[_0x2bad('0x2c')]['hasOwnProperty'](_0x2bad('0x33'))){_0x1548f4[_0x2bad('0x34')]=qs[_0x2bad('0x34')](_0x170f41[_0x2bad('0x2c')][_0x2bad('0x34')]);_0x1548f4[_0x2bad('0x1b')]=qs[_0x2bad('0x1b')](_0x170f41[_0x2bad('0x2c')][_0x2bad('0x1b')]);}_0x1548f4[_0x2bad('0x35')]=qs[_0x2bad('0x36')](_0x170f41[_0x2bad('0x2c')][_0x2bad('0x36')]);_0x1548f4[_0x2bad('0x37')]=qs[_0x2bad('0x2e')](_['pick'](_0x170f41[_0x2bad('0x2c')],_0x332fdc['filters']),_0x1b9536);if(_0x170f41[_0x2bad('0x2c')][_0x2bad('0x38')]){_0x1548f4[_0x2bad('0x37')]=_[_0x2bad('0x39')](_0x1548f4[_0x2bad('0x37')],{'$or':_['map'](_0x1b9536,function(_0x7f5a9){if(_0x7f5a9[_0x2bad('0x29')]!==_0x2bad('0x3a')){var _0x142198={};_0x142198[_0x7f5a9[_0x2bad('0x22')]]={'$like':'%'+_0x170f41[_0x2bad('0x2c')][_0x2bad('0x38')]+'%'};return _0x142198;}})});}_0x1548f4=_[_0x2bad('0x39')]({},_0x1548f4,_0x170f41[_0x2bad('0x3b')]);var _0x889e64={'where':_0x1548f4[_0x2bad('0x37')]};return db[_0x2bad('0x26')][_0x2bad('0x1a')](_0x889e64)[_0x2bad('0x1f')](function(_0x5610c6){_0x13e4fd['count']=_0x5610c6;if(_0x170f41[_0x2bad('0x2c')][_0x2bad('0x3c')]){_0x1548f4['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x2bad('0x3d')](_0x1548f4);})[_0x2bad('0x1f')](function(_0x17bd71){_0x13e4fd['rows']=_0x17bd71;return _0x13e4fd;})['then'](respondWithFilteredResult(_0x45cfca,_0x1548f4))[_0x2bad('0x3e')](handleError(_0x45cfca,null));};exports['show']=function(_0x219137,_0x1a66bc){var _0x50cbbc={'raw':!![],'where':{'id':_0x219137[_0x2bad('0x3f')]['id']}},_0x27f800={};_0x27f800['model']=_[_0x2bad('0x2d')](db[_0x2bad('0x26')]['rawAttributes']);_0x27f800[_0x2bad('0x2c')]=_[_0x2bad('0x2d')](_0x219137[_0x2bad('0x2c')]);_0x27f800[_0x2bad('0x2e')]=_[_0x2bad('0x2f')](_0x27f800[_0x2bad('0x2b')],_0x27f800[_0x2bad('0x2c')]);_0x50cbbc[_0x2bad('0x30')]=_['intersection'](_0x27f800[_0x2bad('0x2b')],qs['fields'](_0x219137[_0x2bad('0x2c')][_0x2bad('0x31')]));_0x50cbbc[_0x2bad('0x30')]=_0x50cbbc['attributes'][_0x2bad('0x32')]?_0x50cbbc[_0x2bad('0x30')]:_0x27f800[_0x2bad('0x2b')];if(_0x219137['query'][_0x2bad('0x3c')]){_0x50cbbc[_0x2bad('0x40')]=[{'all':!![]}];}_0x50cbbc=_['merge']({},_0x50cbbc,_0x219137[_0x2bad('0x3b')]);return db[_0x2bad('0x26')][_0x2bad('0x41')](_0x50cbbc)[_0x2bad('0x1f')](handleEntityNotFound(_0x1a66bc,null))[_0x2bad('0x1f')](respondWithResult(_0x1a66bc,null))[_0x2bad('0x3e')](handleError(_0x1a66bc,null));};exports[_0x2bad('0x42')]=function(_0x5c290b,_0x7deba0){return db[_0x2bad('0x26')][_0x2bad('0x42')](_0x5c290b[_0x2bad('0x43')],{})[_0x2bad('0x1f')](respondWithResult(_0x7deba0,0xc9))[_0x2bad('0x3e')](handleError(_0x7deba0,null));};exports['update']=function(_0x46738f,_0x98e79d){if(_0x46738f[_0x2bad('0x43')]['id']){delete _0x46738f[_0x2bad('0x43')]['id'];}return db[_0x2bad('0x26')]['find']({'where':{'id':_0x46738f[_0x2bad('0x3f')]['id']}})[_0x2bad('0x1f')](handleEntityNotFound(_0x98e79d,null))[_0x2bad('0x1f')](saveUpdates(_0x46738f[_0x2bad('0x43')],null))['then'](respondWithResult(_0x98e79d,null))[_0x2bad('0x3e')](handleError(_0x98e79d,null));};exports[_0x2bad('0x20')]=function(_0x13f1fd,_0x5a7a05){return db[_0x2bad('0x26')][_0x2bad('0x41')]({'where':{'id':_0x13f1fd[_0x2bad('0x3f')]['id']}})[_0x2bad('0x1f')](handleEntityNotFound(_0x5a7a05,null))[_0x2bad('0x1f')](removeEntity(_0x5a7a05,null))[_0x2bad('0x3e')](handleError(_0x5a7a05,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e79cd85..5377fd5 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 _0x62ed=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x527ad8,_0x31bf8f){var _0x11cef9=function(_0x1445fd){while(--_0x1445fd){_0x527ad8['push'](_0x527ad8['shift']());}};_0x11cef9(++_0x31bf8f);}(_0x62ed,0x181));var _0xd62e=function(_0xc7ed4d,_0x34c49a){_0xc7ed4d=_0xc7ed4d-0x0;var _0x3d466f=_0x62ed[_0xc7ed4d];return _0x3d466f;};'use strict';var _=require(_0xd62e('0x0'));var util=require(_0xd62e('0x1'));var logger=require(_0xd62e('0x2'))(_0xd62e('0x3'));var moment=require(_0xd62e('0x4'));var BPromise=require(_0xd62e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd62e('0x6'));var rimraf=require(_0xd62e('0x7'));var config=require(_0xd62e('0x8'));var attributes=require(_0xd62e('0x9'));module[_0xd62e('0xa')]=function(_0xf60d6e,_0x30a5cb){return _0xf60d6e[_0xd62e('0xb')](_0xd62e('0xc'),attributes,{'tableName':_0xd62e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd60f=['path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd60f,0x190));var _0xfd60=function(_0x318934,_0x52fe7a){_0x318934=_0x318934-0x0;var _0x431292=_0xd60f[_0x318934];return _0x431292;};'use strict';var _=require(_0xfd60('0x0'));var util=require(_0xfd60('0x1'));var logger=require(_0xfd60('0x2'))(_0xfd60('0x3'));var moment=require(_0xfd60('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd60('0x5'));var fs=require('fs');var path=require(_0xfd60('0x6'));var rimraf=require(_0xfd60('0x7'));var config=require('../../config/environment');var attributes=require(_0xfd60('0x8'));module['exports']=function(_0x4f85e8,_0x4b2fb4){return _0x4f85e8[_0xfd60('0x9')](_0xfd60('0xa'),attributes,{'tableName':_0xfd60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd60('0xc'),'collate':_0xfd60('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9ad9c01..64f0396 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 _0xfc65=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5073b6,_0x311c61){var _0x1e6209=function(_0x5e5247){while(--_0x5e5247){_0x5073b6['push'](_0x5073b6['shift']());}};_0x1e6209(++_0x311c61);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x3addcb,_0x2deca4){_0x3addcb=_0x3addcb-0x0;var _0x52a97e=_0xfc65[_0x3addcb];return _0x52a97e;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fc6('0x1'));var rs=require(_0x5fc6('0x2'));var fs=require('fs');var Redis=require(_0x5fc6('0x3'));var db=require(_0x5fc6('0x4'))['db'];var utils=require(_0x5fc6('0x5'));var logger=require(_0x5fc6('0x6'))(_0x5fc6('0x7'));var config=require(_0x5fc6('0x8'));var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409c5f,_0x1a9600,_0x572941){return new BPromise(function(_0x3921c5,_0x1f1409){return client[_0x5fc6('0xc')](_0x409c5f,_0x572941)[_0x5fc6('0xd')](function(_0x16c285){logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1a9600,_0x5fc6('0x10'));logger[_0x5fc6('0x11')](_0x5fc6('0x12'),_0x1a9600,'request\x20sent',JSON[_0x5fc6('0x13')](_0x16c285));if(_0x16c285['error']){if(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x15')]===0x1f4){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285['error'][_0x5fc6('0x16')]);return _0x1f1409(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);return _0x3921c5(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}else{logger[_0x5fc6('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1a9600,'request\x20sent');_0x3921c5(_0x16c285[_0x5fc6('0x17')][_0x5fc6('0x16')]);}})['catch'](function(_0x26d2ba){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x26d2ba);_0x1f1409(_0x26d2ba);});});} \ No newline at end of file +var _0x277c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird'];(function(_0x10e9a8,_0x430f51){var _0x1fcb44=function(_0x41b04a){while(--_0x41b04a){_0x10e9a8['push'](_0x10e9a8['shift']());}};_0x1fcb44(++_0x430f51);}(_0x277c,0x153));var _0xc277=function(_0x39954b,_0x308c26){_0x39954b=_0x39954b-0x0;var _0x578224=_0x277c[_0x39954b];return _0x578224;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var moment=require(_0xc277('0x1'));var BPromise=require(_0xc277('0x2'));var rs=require(_0xc277('0x3'));var fs=require('fs');var Redis=require(_0xc277('0x4'));var db=require(_0xc277('0x5'))['db'];var utils=require(_0xc277('0x6'));var logger=require(_0xc277('0x7'))(_0xc277('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc277('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77e168,_0x54d634,_0x378158){return new BPromise(function(_0x17a2fe,_0x55be1f){return client[_0xc277('0xa')](_0x77e168,_0x378158)[_0xc277('0xb')](function(_0xfdf694){logger[_0xc277('0xc')](_0xc277('0xd'),_0x54d634,_0xc277('0xe'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x54d634,_0xc277('0xe'),JSON[_0xc277('0xf')](_0xfdf694));if(_0xfdf694[_0xc277('0x10')]){if(_0xfdf694[_0xc277('0x10')]['code']===0x1f4){logger[_0xc277('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x54d634,_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);return _0x55be1f(_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);}logger['error'](_0xc277('0xd'),_0x54d634,_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);return _0x17a2fe(_0xfdf694['error']['message']);}else{logger[_0xc277('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x54d634,_0xc277('0xe'));_0x17a2fe(_0xfdf694['result'][_0xc277('0x11')]);}})[_0xc277('0x12')](function(_0x15f560){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x54d634,_0x15f560);_0x55be1f(_0x15f560);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2c27252..d39ead1 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 _0xb706=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','delete','removeTags','exports','path','connect-timeout'];(function(_0x716428,_0x534d3){var _0x605f60=function(_0x13262f){while(--_0x13262f){_0x716428['push'](_0x716428['shift']());}};_0x605f60(++_0x534d3);}(_0xb706,0x15e));var _0x6b70=function(_0x5ee9d1,_0x39aa0d){_0x5ee9d1=_0x5ee9d1-0x0;var _0x26002a=_0xb706[_0x5ee9d1];return _0x26002a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b70('0x0'));var timeout=require(_0x6b70('0x1'));var express=require(_0x6b70('0x2'));var router=express[_0x6b70('0x3')]();var auth=require(_0x6b70('0x4'));var interaction=require(_0x6b70('0x5'));var config=require(_0x6b70('0x6'));var controller=require(_0x6b70('0x7'));router[_0x6b70('0x8')]('/',auth[_0x6b70('0x9')](),controller[_0x6b70('0xa')]);router[_0x6b70('0x8')](_0x6b70('0xb'),auth['isAuthenticated'](),controller[_0x6b70('0xc')]);router[_0x6b70('0x8')](_0x6b70('0xd'),auth[_0x6b70('0x9')](),controller[_0x6b70('0xe')]);router[_0x6b70('0x8')](_0x6b70('0xf'),auth[_0x6b70('0x9')](),controller[_0x6b70('0x10')]);router['get']('/:id/download',auth[_0x6b70('0x9')](),controller['download']);router[_0x6b70('0x11')]('/',auth[_0x6b70('0x9')](),controller[_0x6b70('0x12')]);router[_0x6b70('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6b70('0x13')]);router[_0x6b70('0x11')](_0x6b70('0x14'),auth[_0x6b70('0x9')](),interaction[_0x6b70('0x15')](_0x6b70('0x16'),_0x6b70('0x17')),controller[_0x6b70('0x18')]);router[_0x6b70('0x19')](_0x6b70('0xd'),auth[_0x6b70('0x9')](),interaction[_0x6b70('0x15')](_0x6b70('0x16'),_0x6b70('0x1a')),controller[_0x6b70('0x1b')]);router['delete'](_0x6b70('0xd'),auth[_0x6b70('0x9')](),interaction[_0x6b70('0x15')](_0x6b70('0x16'),_0x6b70('0x1c')),controller['destroy']);router[_0x6b70('0x1d')]('/:id/tags',auth[_0x6b70('0x9')](),controller[_0x6b70('0x1e')]);module[_0x6b70('0x1f')]=router; \ No newline at end of file +var _0x5b41=['index','show','/:id/messages','/:id/download','post','create','addMessage','tracked','whatsapp','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated'];(function(_0x5239ff,_0x56cefa){var _0x1b4670=function(_0x2a83b7){while(--_0x2a83b7){_0x5239ff['push'](_0x5239ff['shift']());}};_0x1b4670(++_0x56cefa);}(_0x5b41,0x129));var _0x15b4=function(_0x626578,_0x2554d1){_0x626578=_0x626578-0x0;var _0x55b94c=_0x5b41[_0x626578];return _0x55b94c;};'use strict';var multer=require(_0x15b4('0x0'));var util=require(_0x15b4('0x1'));var path=require(_0x15b4('0x2'));var timeout=require(_0x15b4('0x3'));var express=require(_0x15b4('0x4'));var router=express[_0x15b4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x15b4('0x6'));var config=require(_0x15b4('0x7'));var controller=require(_0x15b4('0x8'));router[_0x15b4('0x9')]('/',auth[_0x15b4('0xa')](),controller[_0x15b4('0xb')]);router[_0x15b4('0x9')]('/describe',auth[_0x15b4('0xa')](),controller['describe']);router[_0x15b4('0x9')]('/:id',auth[_0x15b4('0xa')](),controller[_0x15b4('0xc')]);router[_0x15b4('0x9')](_0x15b4('0xd'),auth[_0x15b4('0xa')](),controller['getMessages']);router[_0x15b4('0x9')](_0x15b4('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x15b4('0xf')]('/',auth[_0x15b4('0xa')](),controller[_0x15b4('0x10')]);router['post'](_0x15b4('0xd'),auth['isAuthenticated'](),controller[_0x15b4('0x11')]);router['post']('/:id/tags',auth[_0x15b4('0xa')](),interaction[_0x15b4('0x12')](_0x15b4('0x13'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x15b4('0x14')](_0x15b4('0x15'),auth['isAuthenticated'](),interaction[_0x15b4('0x12')](_0x15b4('0x13'),_0x15b4('0x16')),controller['update']);router[_0x15b4('0x17')](_0x15b4('0x15'),auth[_0x15b4('0xa')](),interaction[_0x15b4('0x12')](_0x15b4('0x13'),_0x15b4('0x18')),controller[_0x15b4('0x19')]);router['delete']('/:id/tags',auth[_0x15b4('0xa')](),controller[_0x15b4('0x1a')]);module[_0x15b4('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 7e55825..fc71a88 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 _0xda11=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x4c9851,_0x3cb61f){var _0x111d52=function(_0x1323a6){while(--_0x1323a6){_0x4c9851['push'](_0x4c9851['shift']());}};_0x111d52(++_0x3cb61f);}(_0xda11,0x18b));var _0x1da1=function(_0x4c7620,_0x16a30a){_0x4c7620=_0x4c7620-0x0;var _0x1097a0=_0xda11[_0x4c7620];return _0x1097a0;};'use strict';var Sequelize=require(_0x1da1('0x0'));var moment=require(_0x1da1('0x1'));module[_0x1da1('0x2')]={'closed':{'type':Sequelize[_0x1da1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1da1('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1da1('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1da1('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1da1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1da1('0x6')]('in',_0x1da1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1da1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1da1('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa3b9=['ENUM','DATE','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x23aa6b,_0x53fd8d){var _0x29a5a8=function(_0x3909b4){while(--_0x3909b4){_0x23aa6b['push'](_0x23aa6b['shift']());}};_0x29a5a8(++_0x53fd8d);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x4f8d61,_0x5f41d8){_0x4f8d61=_0x4f8d61-0x0;var _0x56f3e3=_0xa3b9[_0x4f8d61];return _0x56f3e3;};'use strict';var Sequelize=require(_0x9a3b('0x0'));var moment=require(_0x9a3b('0x1'));module[_0x9a3b('0x2')]={'closed':{'type':Sequelize[_0x9a3b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9a3b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9a3b('0x4')]},'note':{'type':Sequelize[_0x9a3b('0x4')]},'phone':{'type':Sequelize[_0x9a3b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9a3b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9a3b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x9a3b('0x5')]('in',_0x9a3b('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ee20fe6..fab922c 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 _0x1a85=['createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','count','toString','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','keys','includeAll','include','options','body','params','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','sendStatus','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','Users','fullname','Tags','TagIds','split','push','catch','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','UserId','some','compact','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?'];(function(_0x2c4214,_0x2dbaf3){var _0x1b1fef=function(_0x5d26fc){while(--_0x5d26fc){_0x2c4214['push'](_0x2c4214['shift']());}};_0x1b1fef(++_0x2dbaf3);}(_0x1a85,0x178));var _0x51a8=function(_0x458b0,_0x15f01d){_0x458b0=_0x458b0-0x0;var _0x294e1f=_0x1a85[_0x458b0];return _0x294e1f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51a8('0x0'));var zipdir=require(_0x51a8('0x1'));var jsonpatch=require(_0x51a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51a8('0x3'));var Mustache=require(_0x51a8('0x4'));var util=require(_0x51a8('0x5'));var path=require('path');var sox=require(_0x51a8('0x6'));var csv=require('to-csv');var ejs=require(_0x51a8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=_0x45a433['count'],_0x23539e=_0x1c2f25[_0x51a8('0x20')],_0x3bc1a2=_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x21')],_0x544886;if(_0x3bc1a2>=_0xd52230){_0x3bc1a2=_0xd52230;_0x544886=0xc8;}else{_0x544886=0xce;}_0x516abc[_0x51a8('0x1d')](_0x544886);return _0x516abc[_0x51a8('0x22')](_0x51a8('0x23'),_0x23539e+'-'+_0x3bc1a2+'/'+_0xd52230)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x3bf5b6){return function(_0x5ac1c0){try{jsonpatch[_0x51a8('0x24')](_0x5ac1c0,_0x3bf5b6,!![]);}catch(_0x53438c){return BPromise[_0x51a8('0x25')](_0x53438c);}return _0x5ac1c0[_0x51a8('0x26')]();};}function saveUpdates(_0x8bda40,_0x3759d6){return function(_0x51f737){if(_0x51f737){return _0x51f737[_0x51a8('0x27')](_0x8bda40)['then'](function(_0x47f063){return _0x47f063;});}return null;};}function removeEntity(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x28')]()[_0x51a8('0x29')](function(){_0x23d26a[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x2f2f05,_0x291ed6){return function(_0x1326a2){if(!_0x1326a2){_0x2f2f05['sendStatus'](0x194);}return _0x1326a2;};}function handleError(_0x273ce2,_0x1b7577){_0x1b7577=_0x1b7577||0x1f4;return function(_0xca5746){logger[_0x51a8('0x2a')](_0xca5746[_0x51a8('0x2b')]);if(_0xca5746[_0x51a8('0x2c')]){delete _0xca5746[_0x51a8('0x2c')];}_0x273ce2[_0x51a8('0x1d')](_0x1b7577)[_0x51a8('0x2d')](_0xca5746);};}function getInteractionUsers(_0x4b5cda,_0x20c6b5){return new BPromise(function(_0x347a02,_0x4a1548){try{if(_0x20c6b5[_0x4b5cda['id']]){_0x4b5cda[_0x51a8('0x2e')]=_['map'](_0x20c6b5[_0x4b5cda['id']],function(_0x276424){return{'id':_0x276424['id'],'fullname':_0x276424[_0x51a8('0x2f')]};});}}catch(_0x143f46){_0x4a1548(_0x143f46);}_0x347a02(_0x4b5cda);});}function getInteractionTags(_0x41df56,_0x2136b4){return new BPromise(function(_0x4ea271,_0x10c19b){try{if(_0x41df56['TagIds']){_0x41df56[_0x51a8('0x30')]=[];_0x41df56[_0x51a8('0x31')][_0x51a8('0x32')](',')['forEach'](function(_0x2080a1){_0x41df56['Tags'][_0x51a8('0x33')](_0x2136b4[_0x2080a1]);});}delete _0x41df56[_0x51a8('0x31')];}catch(_0x1ba6a7){_0x10c19b(_0x1ba6a7);}_0x4ea271(_0x41df56);});}function updateWhatsappInteraction(_0x224099,_0x193e0f,_0x50195b){return new BPromise(function(_0x1167b8,_0x53b3b6){return getInteractionUsers(_0x224099,_0x50195b)[_0x51a8('0x29')](function(_0x2d977b){return getInteractionTags(_0x2d977b,_0x193e0f);})[_0x51a8('0x29')](function(_0x578fc6){_0x1167b8(_0x578fc6);})[_0x51a8('0x34')](function(_0xdc6cc7){_0x53b3b6(_0xdc6cc7);});});}exports[_0x51a8('0x35')]=function(_0x2429f8,_0x41c020){var _0x49ab37={},_0x4c2b3d={},_0x4d3114={'count':0x0,'rows':[]};var _0x21b871=_[_0x51a8('0x36')](db['WhatsappInteraction'][_0x51a8('0x37')],function(_0x4ec0ac){return{'name':_0x4ec0ac[_0x51a8('0x38')],'type':_0x4ec0ac[_0x51a8('0x39')][_0x51a8('0x3a')]};});_0x4c2b3d[_0x51a8('0x3b')]=_[_0x51a8('0x36')](_0x21b871,_0x51a8('0x2c'));_0x4c2b3d['query']=_['keys'](_0x2429f8[_0x51a8('0x3c')]);_0x4c2b3d['filters']=_['intersection'](_0x4c2b3d['model'],_0x4c2b3d[_0x51a8('0x3c')]);_0x49ab37[_0x51a8('0x3d')]=_[_0x51a8('0x3e')](_0x4c2b3d['model'],qs[_0x51a8('0x3f')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x3f')]));_0x49ab37[_0x51a8('0x3d')]=_0x49ab37['attributes'][_0x51a8('0x40')]?_0x49ab37[_0x51a8('0x3d')]:_0x4c2b3d[_0x51a8('0x3b')];if(!_0x2429f8['query'][_0x51a8('0x41')]('nolimit')){_0x49ab37[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x21')]);_0x49ab37['offset']=qs[_0x51a8('0x20')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x20')]);}_0x49ab37[_0x51a8('0x42')]=qs[_0x51a8('0x43')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x43')]);_0x49ab37[_0x51a8('0x44')]=qs[_0x51a8('0x45')](_['pick'](_0x2429f8[_0x51a8('0x3c')],_0x4c2b3d[_0x51a8('0x45')]),_0x21b871);var _0x4c7c67=[];var _0x53409d=squel[_0x51a8('0x46')]()[_0x51a8('0x47')]('id')[_0x51a8('0x47')](_0x51a8('0x2c'))[_0x51a8('0x47')](_0x51a8('0x48'))[_0x51a8('0x49')](_0x51a8('0x4a'));var _0x26ad89=squel[_0x51a8('0x46')]()['field'](_0x51a8('0x4b'))[_0x51a8('0x47')](_0x51a8('0x4c'))[_0x51a8('0x47')](_0x51a8('0x4d'))[_0x51a8('0x49')]('user_has_whatsapp_interactions','ui')[_0x51a8('0x4e')]('users','u',_0x51a8('0x4f'));var _0x3a33f3=squel[_0x51a8('0x46')]()[_0x51a8('0x49')](_0x51a8('0x50'),'i')['left_join']('cm_contacts','c',_0x51a8('0x51'))[_0x51a8('0x4e')](_0x51a8('0x52'),'o',_0x51a8('0x53'))[_0x51a8('0x4e')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x51a8('0x4e')](_0x51a8('0x54'),'me',_0x51a8('0x55'))[_0x51a8('0x4e')](_0x51a8('0x56'),'it',_0x51a8('0x57'))[_0x51a8('0x4e')](_0x51a8('0x4a'),'t',_0x51a8('0x58'));var _0x4d29ab=squel['expr']();var _0x5db030=[];var _0x3e2d6c=squel[_0x51a8('0x59')]();var _0x103897;if(_0x2429f8['query'][_0x51a8('0x5a')]){_0x103897=as[_0x51a8('0x5b')](_0x2429f8['query'][_0x51a8('0x5a')]);var _0x4fb93c=_0x103897['sqlOperator'];for(var _0xbf828b=0x0;_0xbf828b<_0x103897[_0x51a8('0x5c')][_0x51a8('0x40')];_0xbf828b++){var _0x56d7f1=_0x103897['conditions'][_0xbf828b];var _0x3a8f1e='i';var _0x5b0398=_[_0x51a8('0x5d')](_0x21b871,[_0x51a8('0x2c'),_0x56d7f1[_0x51a8('0x47')]]);if(!_0x5b0398){switch(_0x56d7f1[_0x51a8('0x47')]){case _0x51a8('0x5e'):if(_0x56d7f1[_0x51a8('0x5f')]==0x1){_0x3a33f3[_0x51a8('0x60')]('`'+_0x56d7f1[_0x51a8('0x47')]+_0x51a8('0x61'));}else{_0x3a33f3['having']('`'+_0x56d7f1[_0x51a8('0x47')]+_0x51a8('0x62'));}break;case _0x51a8('0x63'):if(_0x56d7f1[_0x51a8('0x64')]==='$substring'){if(_0x56d7f1[_0x51a8('0x5f')]['split']('\x20')[_0x51a8('0x40')]>0x1){_0x4d29ab[_0x4fb93c](_0x51a8('0x65'),qs['getFullTextValue'](_0x56d7f1['value']),null);}else{var _0x2628d4='%'+_0x56d7f1[_0x51a8('0x5f')]+'%';_0x4d29ab[_0x4fb93c](_0x51a8('0x66'),_0x2628d4,_0x2628d4,_0x2628d4);}}else{_0x5b0398=_[_0x51a8('0x5d')](_0x21b871,[_0x51a8('0x2c'),'ContactId']);_0x56d7f1[_0x51a8('0x47')]=_0x51a8('0x67');_0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);}break;case _0x51a8('0x6b'):var _0x62966a=_0x56d7f1[_0x51a8('0x5f')]['split'](',')['map'](function(_0x4ba203){return Number(_0x4ba203);});_0x62966a['forEach'](function(_0x2048c6){_0x3e2d6c['or'](_0x51a8('0x6c'),'%,'+_0x2048c6+',%');});_0x5db030=_['union'](_0x5db030,_0x62966a);break;case _0x51a8('0x6d'):if(_0x56d7f1['operator']===_0x51a8('0x6e')){_0x4d29ab[_0x4fb93c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x56d7f1[_0x51a8('0x5f')]+'%',null);}else{_0x5b0398=_[_0x51a8('0x5d')](_0x21b871,['name','UserId']);_0x56d7f1['field']=_0x51a8('0x6f');_0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);}break;case'body':_0x390c25=as[_0x51a8('0x68')]('me',null,_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);break;}}else{var _0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25['text'],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25['value']['end']);}}}else{var _0x50a6ad=_(_0x2429f8['query'])['keys']()[_0x51a8('0x36')](function(_0x529b2f){return _[_0x51a8('0x70')](_0x21b871,[_0x51a8('0x2c'),_0x529b2f])?_0x529b2f:undefined;})[_0x51a8('0x71')]()[_0x51a8('0x5f')]();if(!_[_0x51a8('0x72')](_0x50a6ad)){_0x50a6ad[_0x51a8('0x73')](function(_0x28c539){if(_0x28c539===_0x51a8('0x74')){_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x75'),[]['concat'](_0x2429f8[_0x51a8('0x3c')][_0x28c539]));}else if(_0x28c539===_0x51a8('0x76')){var _0x31ee59=JSON['parse'](_0x2429f8['query'][_0x28c539])['$gte'];var _0x10c22e=JSON[_0x51a8('0x77')](_0x2429f8[_0x51a8('0x3c')][_0x28c539])[_0x51a8('0x78')];_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x79'),_0x31ee59,_0x10c22e);}else{if(_0x2429f8[_0x51a8('0x3c')][_0x28c539]===_0x51a8('0x7a')){_0x3a33f3[_0x51a8('0x44')]('i.'+_0x28c539+_0x51a8('0x7b'));}else{_0x3a33f3[_0x51a8('0x44')]('i.'+_0x28c539+_0x51a8('0x7c'),_0x2429f8[_0x51a8('0x3c')][_0x28c539]);}}});}if(_0x2429f8['query'][_0x51a8('0x7d')]){if(_0x2429f8[_0x51a8('0x3c')]['read']==0x1){_0x3a33f3[_0x51a8('0x60')]('`unreadMessages`\x20=\x200');}else{_0x3a33f3['having']('`unreadMessages`\x20>\x200');}}if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')]){_0x5db030=_[_0x51a8('0x7f')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')])?_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')]:new Array(_0x2429f8['query']['tag']);_0x5db030['forEach'](function(_0x44e496){_0x3e2d6c['or'](_0x51a8('0x6c'),'%,'+_0x44e496+',%');});}if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x80')]){var _0x32a40b=_0x2429f8[_0x51a8('0x3c')]['filter'][_0x51a8('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x51a8('0x82')](_0x32a40b)){_0x4d29ab['or'](_0x51a8('0x83'),_0x32a40b+'%')['or'](_0x51a8('0x84'),_0x32a40b+'%');}else{_0x4d29ab['or'](_0x51a8('0x85'),qs[_0x51a8('0x86')](_0x32a40b))['or'](_0x51a8('0x87'),_0x32a40b+'%');}}}_0x3a33f3[_0x51a8('0x44')](_0x4d29ab);_0x3a33f3[_0x51a8('0x88')](_0x51a8('0x89'));var _0x39fcef={'type':db[_0x51a8('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x21912f=_0x3a33f3[_0x51a8('0x8b')]();_0x21912f[_0x51a8('0x47')](_0x51a8('0x89'));_0x21912f['field'](_0x51a8('0x8c'),'unreadMessages');if(_0x49ab37[_0x51a8('0x42')]){_0x49ab37[_0x51a8('0x42')][_0x51a8('0x73')](function(_0x24fcc3){var _0x190632=_0x24fcc3[0x0]===_0x51a8('0x8d')?_0x24fcc3[0x0]:'i.'+_0x24fcc3[0x0];_0x3a33f3[_0x51a8('0x42')](_0x190632,_0x24fcc3[0x1]===_0x51a8('0x8e')?![]:!![]);});}if(!_[_0x51a8('0x72')](_0x5db030)){_0x3a33f3['having'](_0x3e2d6c);_0x21912f[_0x51a8('0x44')](_0x51a8('0x8f'),_0x5db030);}BPromise[_0x51a8('0x90')]()[_0x51a8('0x29')](function(){if(!_0x103897){if(_0x2429f8['query']['WhatsappAccountId'])return;_0x21912f[_0x51a8('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x3a33f3['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2429f8[_0x51a8('0x91')]['role']!=='agent')return;return _0x2429f8[_0x51a8('0x91')][_0x51a8('0x92')]({'attributes':['id'],'raw':!![]})[_0x51a8('0x29')](function(_0x5be0ce){if(_[_0x51a8('0x72')](_0x5be0ce)){_0x21912f[_0x51a8('0x44')](_0x51a8('0x93'));_0x3a33f3['where'](_0x51a8('0x93'));}else{_0x21912f[_0x51a8('0x44')](_0x51a8('0x75'),_[_0x51a8('0x36')](_0x5be0ce,'id'));_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x75'),_[_0x51a8('0x36')](_0x5be0ce,'id'));}});})[_0x51a8('0x29')](function(){if(_0x2429f8[_0x51a8('0x91')]['role']===_0x51a8('0x94')&&!_0x103897&&!_0x2429f8[_0x51a8('0x3c')]['WhatsappAccountId'])return[];return db[_0x51a8('0x95')][_0x51a8('0x3c')](_0x21912f['toString'](),_0x39fcef);})[_0x51a8('0x29')](function(_0x132ce5){_0x4d3114[_0x51a8('0x96')]=_0x132ce5[_0x51a8('0x40')];if(_0x4d3114[_0x51a8('0x96')]===0x0)return[];return db['sequelize'][_0x51a8('0x3c')](_0x53409d[_0x51a8('0x97')](),_0x39fcef)[_0x51a8('0x29')](function(_0x1d587e){_0x4c7c67=_['keyBy'](_0x1d587e,'id');_0x39fcef=_[_0x51a8('0x98')](_0x39fcef,{'model':db[_0x51a8('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x3f')]){_0x49ab37[_0x51a8('0x3d')][_0x51a8('0x73')](function(_0xf718e){_0x3a33f3[_0x51a8('0x47')]('i.'+_0xf718e);});}else{_0x3a33f3['field'](_0x51a8('0x8c'),_0x51a8('0x5e'));_0x3a33f3['field'](_0x51a8('0x9a'),_0x51a8('0x9b'));_0x3a33f3['field'](_0x51a8('0x9c'),'Account.mandatoryDisposition');_0x3a33f3['field'](_0x51a8('0x9d'),_0x51a8('0x8d'));_0x3a33f3[_0x51a8('0x47')]('i.*');_0x3a33f3['field'](_0x51a8('0x9e'),'Contact.firstName');_0x3a33f3[_0x51a8('0x47')](_0x51a8('0x9f'),_0x51a8('0xa0'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa1'),_0x51a8('0xa2'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa3'),_0x51a8('0xa4'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa5'),_0x51a8('0xa6'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa7'),_0x51a8('0xa8'));_0x3a33f3['field']('o.fullname',_0x51a8('0xa9'));_0x3a33f3['field']('o.internal','Owner.internal');_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xaa'),_0x51a8('0x31'));}if(_0x49ab37[_0x51a8('0x21')])_0x3a33f3['limit'](_0x49ab37[_0x51a8('0x21')]);if(_0x49ab37[_0x51a8('0x20')])_0x3a33f3['offset'](_0x49ab37[_0x51a8('0x20')]);return db[_0x51a8('0x95')]['query'](_0x3a33f3['toString'](),_0x39fcef);})[_0x51a8('0x29')](function(_0x835bff){_0x26ad89[_0x51a8('0x44')](_0x51a8('0xab'),_[_0x51a8('0x36')](_0x835bff,'id'));return db[_0x51a8('0x95')]['query'](_0x26ad89[_0x51a8('0x97')](),_0x39fcef)[_0x51a8('0x29')](function(_0x181f8b){var _0x566d62=_[_0x51a8('0xac')](_0x181f8b,_0x51a8('0xad'));var _0x1db1e0=[];_0x835bff['forEach'](function(_0x149fa4){_0x1db1e0[_0x51a8('0x33')](updateWhatsappInteraction(_0x149fa4,_0x4c7c67,_0x566d62));});return BPromise['all'](_0x1db1e0);});});})[_0x51a8('0x29')](function(_0x529916){_0x4d3114[_0x51a8('0xae')]=_0x529916;return _0x4d3114;})[_0x51a8('0x29')](respondWithFilteredResult(_0x41c020,_0x49ab37))[_0x51a8('0x34')](handleError(_0x41c020,null));};exports[_0x51a8('0xaf')]=function(_0x41621c,_0x700df1){var _0x398d27={'raw':![],'where':{'id':_0x41621c['params']['id']}},_0x42d0ad={};_0x42d0ad[_0x51a8('0x3b')]=_[_0x51a8('0xb0')](db[_0x51a8('0x99')][_0x51a8('0x37')]);_0x42d0ad[_0x51a8('0x3c')]=_['keys'](_0x41621c['query']);_0x42d0ad[_0x51a8('0x45')]=_[_0x51a8('0x3e')](_0x42d0ad[_0x51a8('0x3b')],_0x42d0ad[_0x51a8('0x3c')]);_0x398d27[_0x51a8('0x3d')]=_['intersection'](_0x42d0ad[_0x51a8('0x3b')],qs['fields'](_0x41621c[_0x51a8('0x3c')][_0x51a8('0x3f')]));_0x398d27['attributes']=_0x398d27[_0x51a8('0x3d')]['length']?_0x398d27[_0x51a8('0x3d')]:_0x42d0ad[_0x51a8('0x3b')];if(_0x41621c[_0x51a8('0x3c')][_0x51a8('0xb1')]){_0x398d27[_0x51a8('0xb2')]=[{'all':!![]}];}_0x398d27=_['merge']({},_0x398d27,_0x41621c[_0x51a8('0xb3')]);return db[_0x51a8('0x99')]['find'](_0x398d27)[_0x51a8('0x29')](handleEntityNotFound(_0x700df1,null))[_0x51a8('0x29')](respondWithResult(_0x700df1,null))['catch'](handleError(_0x700df1,null));};exports['create']=function(_0x24b2a9,_0x158c45){return db[_0x51a8('0x99')]['create'](_0x24b2a9[_0x51a8('0xb4')],{})[_0x51a8('0x29')](respondWithResult(_0x158c45,0xc9))[_0x51a8('0x34')](handleError(_0x158c45,null));};exports[_0x51a8('0x27')]=function(_0x336269,_0x21f861){if(_0x336269[_0x51a8('0xb4')]['id']){delete _0x336269['body']['id'];}return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x336269[_0x51a8('0xb5')]['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x21f861,null))['then'](saveUpdates(_0x336269['body'],null))[_0x51a8('0x29')](respondWithResult(_0x21f861,null))[_0x51a8('0x34')](handleError(_0x21f861,null));};exports['destroy']=function(_0x4ea00f,_0x5b44ba){return db[_0x51a8('0x99')]['find']({'where':{'id':_0x4ea00f['params']['id']}})['then'](handleEntityNotFound(_0x5b44ba,null))[_0x51a8('0x29')](removeEntity(_0x5b44ba,null))['catch'](handleError(_0x5b44ba,null));};exports[_0x51a8('0xb6')]=function(_0x2d820c,_0x52403f){return db['WhatsappInteraction'][_0x51a8('0xb6')]()['then'](respondWithResult(_0x52403f,null))[_0x51a8('0x34')](handleError(_0x52403f,null));};exports[_0x51a8('0xb7')]=function(_0x4bf480,_0x39938f,_0x88625a){return db['WhatsappMessage'][_0x51a8('0x5d')]({'where':{'id':_0x4bf480[_0x51a8('0xb5')]['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x39938f,null))['then'](function(_0x2af315){if(_0x2af315){return _0x2af315[_0x51a8('0xb7')](_0x4bf480[_0x51a8('0xb4')]['ids'],_['omit'](_0x4bf480[_0x51a8('0xb4')],[_0x51a8('0xb8'),'id'])||{});}})[_0x51a8('0x29')](respondWithResult(_0x39938f,null))[_0x51a8('0x34')](handleError(_0x39938f,null));};exports[_0x51a8('0xb9')]=function(_0x475014,_0x35cd5d,_0x64e49d){var _0x1482ff={'raw':![],'where':{}};var _0x570ba0={};var _0x2a8aa1={'count':0x0,'rows':[]};return db[_0x51a8('0x99')][_0x51a8('0xba')]({'where':{'id':_0x475014['params']['id']}})['then'](handleEntityNotFound(_0x35cd5d,null))[_0x51a8('0x29')](function(_0x318478){if(_0x318478){_0x570ba0[_0x51a8('0x3b')]=_[_0x51a8('0xb0')](db[_0x51a8('0xbb')]['rawAttributes']);_0x570ba0['query']=_[_0x51a8('0xb0')](_0x475014[_0x51a8('0x3c')]);_0x570ba0['filters']=_[_0x51a8('0x3e')](_0x570ba0[_0x51a8('0x3b')],_0x570ba0[_0x51a8('0x3c')]);_0x1482ff[_0x51a8('0x3d')]=_[_0x51a8('0x3e')](_0x570ba0['model'],qs['fields'](_0x475014[_0x51a8('0x3c')]['fields']));_0x1482ff[_0x51a8('0x3d')]=_0x1482ff['attributes'][_0x51a8('0x40')]?_0x1482ff[_0x51a8('0x3d')]:_0x570ba0['model'];if(!_0x475014[_0x51a8('0x3c')][_0x51a8('0x41')](_0x51a8('0xbc'))){_0x1482ff[_0x51a8('0x21')]=qs['limit'](_0x475014['query'][_0x51a8('0x21')]);_0x1482ff[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x475014[_0x51a8('0x3c')]['offset']);}_0x1482ff[_0x51a8('0x42')]=qs['sort'](_0x475014[_0x51a8('0x3c')]['sort']);_0x1482ff[_0x51a8('0x44')]=qs[_0x51a8('0x45')](_[_0x51a8('0xbd')](_0x475014[_0x51a8('0x3c')],_0x570ba0['filters']));_0x1482ff[_0x51a8('0x44')]['WhatsappInteractionId']=_0x318478['id'];if(_0x475014[_0x51a8('0x3c')][_0x51a8('0x80')]){_0x1482ff[_0x51a8('0x44')]=_['merge'](_0x1482ff[_0x51a8('0x44')],{'$or':_[_0x51a8('0x36')](_0x1482ff[_0x51a8('0x3d')],function(_0x4e636b){var _0x5e541d={};_0x5e541d[_0x4e636b]={'$like':'%'+_0x475014[_0x51a8('0x3c')][_0x51a8('0x80')]+'%'};return _0x5e541d;})});}if(_0x475014[_0x51a8('0x3c')][_0x51a8('0xbe')]){var _0x4c3d87=_0x475014['query'][_0x51a8('0xbe')]['split'](',');var _0x1b9cd4={};_0x1b9cd4[_0x4c3d87[0x0]]={'$gte':moment(_0x4c3d87[0x1])[_0x51a8('0xbf')](_0x51a8('0xc0'))};_0x1482ff[_0x51a8('0x44')]=_[_0x51a8('0x98')](_0x1482ff[_0x51a8('0x44')],_0x1b9cd4);}_0x1482ff=_[_0x51a8('0x98')]({},_0x1482ff,_0x475014['options']);return db['WhatsappMessage']['count']({'where':_0x1482ff[_0x51a8('0x44')]})[_0x51a8('0x29')](function(_0x2600c3){_0x2a8aa1[_0x51a8('0x96')]=_0x2600c3;if(_0x475014[_0x51a8('0x3c')]['includeAll']){_0x1482ff[_0x51a8('0xb2')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x51a8('0xc1')](_0x1482ff);})[_0x51a8('0x29')](function(_0x1dcdd9){_0x2a8aa1[_0x51a8('0xae')]=_0x1dcdd9;return _0x2a8aa1;});}})['then'](respondWithFilteredResult(_0x35cd5d,_0x1482ff))['catch'](handleError(_0x35cd5d,null));};exports[_0x51a8('0xc2')]=function(_0x542cc4,_0x289366,_0x4252e7){return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x542cc4['params']['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x289366,null))[_0x51a8('0x29')](function(_0x441ee7){if(_0x441ee7){return _0x441ee7[_0x51a8('0xc3')](_0x542cc4[_0x51a8('0xb4')][_0x51a8('0xb8')],_[_0x51a8('0xc4')](_0x542cc4[_0x51a8('0xb4')],[_0x51a8('0xb8'),'id'])||{})[_0x51a8('0xc5')](function(){return db[_0x51a8('0x6b')]['findAll']({'attributes':['id',_0x51a8('0x2c'),_0x51a8('0x48')],'where':{'id':_0x542cc4[_0x51a8('0xb4')][_0x51a8('0xb8')]}});})[_0x51a8('0x29')](function(_0x4c2cfa){socket[_0x51a8('0xc6')](_0x51a8('0xc7'),{'id':Number(_0x542cc4[_0x51a8('0xb5')]['id']),'tags':_0x4c2cfa||[]});return{'id':Number(_0x542cc4['params']['id']),'tags':_0x4c2cfa||[]};});}})[_0x51a8('0x29')](respondWithResult(_0x289366,null))[_0x51a8('0x34')](handleError(_0x289366,null));};exports[_0x51a8('0xc8')]=function(_0x4a2353,_0x399db9,_0x2209e4){return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x4a2353['params']['id']}})['then'](handleEntityNotFound(_0x399db9,null))['then'](function(_0x1e957d){if(_0x1e957d){return _0x1e957d['removeTags'](_0x4a2353['query'][_0x51a8('0xb8')]);}})[_0x51a8('0x29')](respondWithStatusCode(_0x399db9,null))[_0x51a8('0x34')](handleError(_0x399db9,null));};exports[_0x51a8('0xc9')]=function(_0x1ec08a,_0x462183){var _0x5b316b=moment()[_0x51a8('0xca')]()[_0x51a8('0x97')]();var _0x577fce=path['join'](config[_0x51a8('0xcb')],_0x51a8('0xcc'),'files',_0x51a8('0xcd'));var _0x19dd35=path[_0x51a8('0xce')](config[_0x51a8('0xcb')],_0x51a8('0xcc'),_0x51a8('0xcf'),_0x51a8('0xd0'));var _0x16dce5=path[_0x51a8('0xce')](_0x577fce,_0x5b316b);var _0x1568bf=util[_0x51a8('0xbf')](_0x51a8('0xd1'),_0x1ec08a[_0x51a8('0xb5')]['id'],_0x5b316b);var _0xfedb52=path[_0x51a8('0xce')](_0x577fce,_0x1568bf);var _0x5804c7=[];_0x5804c7[_0x51a8('0x33')]({'model':db[_0x51a8('0x6d')],'as':'User','attributes':['id',_0x51a8('0x2f')],'raw':!![]});_0x5804c7[_0x51a8('0x33')]({'model':db['CmContact'],'as':_0x51a8('0x63'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1ec08a[_0x51a8('0x3c')]['attachments']){_0x5804c7[_0x51a8('0x33')]({'model':db[_0x51a8('0xd2')],'as':_0x51a8('0xd2'),'raw':!![]});}var _0x3b9e0c=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body','createdAt',_0x51a8('0xd3'),_0x51a8('0xd4'),_0x51a8('0x7d')],'include':_0x5804c7}];_0x3b9e0c[_0x51a8('0x33')]({'model':db[_0x51a8('0xd5')],'as':_0x51a8('0xd6'),'attributes':['id',_0x51a8('0x2c')]});_0x3b9e0c['push']({'model':db['User'],'as':_0x51a8('0xd7'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x51a8('0x5d')]({'where':{'id':_0x1ec08a[_0x51a8('0xb5')]['id']},'include':_0x3b9e0c})[_0x51a8('0x29')](handleEntityNotFound(_0x462183,null))[_0x51a8('0x29')](function(_0x3c609c){if(_0x3c609c){var _0x3c76e4=_0x3c609c[_0x51a8('0xd8')]({'plain':!![]});fs[_0x51a8('0xd9')](_0x16dce5);var _0x83dfed={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x51a8('0xda')}},'footer':{'height':_0x51a8('0xdb'),'contents':{'default':util[_0x51a8('0xbf')](_0x51a8('0xdc'),util[_0x51a8('0xbf')](_0x51a8('0xdd'),_0x51a8('0xde'),_0x3c76e4['id']),moment()[_0x51a8('0xbf')](_0x51a8('0xdf'))[_0x51a8('0x97')]())}}};var _0x4a55c0={'channel':'Whatsapp','account':_0x3c76e4['Account'][_0x51a8('0x2c')],'agent':_0x3c76e4[_0x51a8('0xd7')]?_0x3c76e4[_0x51a8('0xd7')]['fullname']:_0x51a8('0xe0'),'createdAt':moment(_0x3c76e4[_0x51a8('0x76')])[_0x51a8('0xbf')](_0x51a8('0xc0'))['toString'](),'closedAt':_0x3c76e4[_0x51a8('0xe1')]?moment(_0x3c76e4[_0x51a8('0xe2')])['format'](_0x51a8('0xc0'))['toString']():'','disposition':_0x3c76e4[_0x51a8('0xe3')],'messages':_(_0x3c76e4[_0x51a8('0xe4')])[_0x51a8('0x80')]({'secret':![]})[_0x51a8('0x36')](function(_0x5592e6){if(_0x5592e6[_0x51a8('0xd2')]){var _0x4ad6a8=path['join'](_0x19dd35,_0x5592e6[_0x51a8('0xd2')][_0x51a8('0xe5')]);if(fs[_0x51a8('0xe6')](_0x4ad6a8)){fs[_0x51a8('0xe7')](_0x4ad6a8)[_0x51a8('0xe8')](fs[_0x51a8('0xe9')](path[_0x51a8('0xce')](_0x16dce5,_0x5592e6['Attachment'][_0x51a8('0xe5')])));}}return{'date':moment(_0x5592e6[_0x51a8('0x76')])[_0x51a8('0xbf')](_0x51a8('0xc0'))['toString'](),'sender':_0x5592e6[_0x51a8('0xd3')]===_0x51a8('0xea')?_0x5592e6[_0x51a8('0x6d')]?_0x5592e6[_0x51a8('0x6d')]['fullname']:_0x51a8('0xeb'):_0x5592e6[_0x51a8('0x63')][_0x51a8('0xec')]+(_0x5592e6[_0x51a8('0x63')]['lastName']?'\x20'+_0x5592e6[_0x51a8('0x63')][_0x51a8('0xed')]:''),'body':_0x5592e6[_0x51a8('0xd2')]?_0x5592e6[_0x51a8('0xd2')][_0x51a8('0xe5')]:_0x5592e6[_0x51a8('0xb4')],'direction':_0x5592e6[_0x51a8('0xd3')]===_0x51a8('0xea')?'A':'C','secret':_0x5592e6[_0x51a8('0xd4')],'read':_0x5592e6[_0x51a8('0x7d')],'attachment':_0x5592e6['Attachment']};})['value']()};return ejs[_0x51a8('0xee')](path['join'](config[_0x51a8('0xcb')],_0x51a8('0xcc'),_0x51a8('0xef'),_0x51a8('0xf0')),{'interaction':_0x4a55c0})[_0x51a8('0x29')](function(_0xc445ba){return new BPromise(function(_0xa6c131,_0x4a3278){pdf['create'](_0xc445ba,_0x83dfed)[_0x51a8('0xf1')](path[_0x51a8('0xce')](_0x16dce5,_0x51a8('0xf2')+_0x3c76e4['id']+'-'+_0x5b316b+_0x51a8('0xf3')),function(_0x3bd73b,_0x12b472){if(_0x3bd73b)return _0x4a3278(_0x3bd73b);_0xa6c131(_0x12b472);});});})[_0x51a8('0x29')](function(){return new BPromise(function(_0x326f86,_0x410051){zipdir(_0x16dce5,{'saveTo':_0xfedb52},function(_0x2e3e68,_0xf07549){if(_0x2e3e68)return _0x410051(_0x2e3e68);return _0x326f86(_0xf07549);});})['then'](function(){return new BPromise(function(_0x49b426,_0x310086){rimraf(_0x16dce5,function(_0x1ca255){if(_0x1ca255)_0x310086(_0x1ca255);return _0x49b426();});});})[_0x51a8('0x29')](function(){return _0x462183[_0x51a8('0xc9')](_0xfedb52,_0x1568bf,function(_0xa18052){if(_0xa18052){console[_0x51a8('0xf4')]('err',_0xa18052);}else{fs[_0x51a8('0xf5')](_0xfedb52);}});});});}else{return _0x462183[_0x51a8('0xf6')](0xc8);}})['catch'](handleError(_0x462183,null));}; \ No newline at end of file +var _0x1a85=['createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','count','toString','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','keys','includeAll','include','options','body','params','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','sendStatus','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','Users','fullname','Tags','TagIds','split','push','catch','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','UserId','some','compact','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?'];(function(_0x2bfb74,_0x5b9646){var _0x5c6e09=function(_0x2e6f0f){while(--_0x2e6f0f){_0x2bfb74['push'](_0x2bfb74['shift']());}};_0x5c6e09(++_0x5b9646);}(_0x1a85,0x178));var _0x51a8=function(_0x148785,_0x195ee5){_0x148785=_0x148785-0x0;var _0x17a172=_0x1a85[_0x148785];return _0x17a172;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51a8('0x0'));var zipdir=require(_0x51a8('0x1'));var jsonpatch=require(_0x51a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51a8('0x3'));var Mustache=require(_0x51a8('0x4'));var util=require(_0x51a8('0x5'));var path=require('path');var sox=require(_0x51a8('0x6'));var csv=require('to-csv');var ejs=require(_0x51a8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=_0x45a433['count'],_0x23539e=_0x1c2f25[_0x51a8('0x20')],_0x3bc1a2=_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x21')],_0x544886;if(_0x3bc1a2>=_0xd52230){_0x3bc1a2=_0xd52230;_0x544886=0xc8;}else{_0x544886=0xce;}_0x516abc[_0x51a8('0x1d')](_0x544886);return _0x516abc[_0x51a8('0x22')](_0x51a8('0x23'),_0x23539e+'-'+_0x3bc1a2+'/'+_0xd52230)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x3bf5b6){return function(_0x5ac1c0){try{jsonpatch[_0x51a8('0x24')](_0x5ac1c0,_0x3bf5b6,!![]);}catch(_0x53438c){return BPromise[_0x51a8('0x25')](_0x53438c);}return _0x5ac1c0[_0x51a8('0x26')]();};}function saveUpdates(_0x8bda40,_0x3759d6){return function(_0x51f737){if(_0x51f737){return _0x51f737[_0x51a8('0x27')](_0x8bda40)['then'](function(_0x47f063){return _0x47f063;});}return null;};}function removeEntity(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x28')]()[_0x51a8('0x29')](function(){_0x23d26a[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x2f2f05,_0x291ed6){return function(_0x1326a2){if(!_0x1326a2){_0x2f2f05['sendStatus'](0x194);}return _0x1326a2;};}function handleError(_0x273ce2,_0x1b7577){_0x1b7577=_0x1b7577||0x1f4;return function(_0xca5746){logger[_0x51a8('0x2a')](_0xca5746[_0x51a8('0x2b')]);if(_0xca5746[_0x51a8('0x2c')]){delete _0xca5746[_0x51a8('0x2c')];}_0x273ce2[_0x51a8('0x1d')](_0x1b7577)[_0x51a8('0x2d')](_0xca5746);};}function getInteractionUsers(_0x4b5cda,_0x20c6b5){return new BPromise(function(_0x347a02,_0x4a1548){try{if(_0x20c6b5[_0x4b5cda['id']]){_0x4b5cda[_0x51a8('0x2e')]=_['map'](_0x20c6b5[_0x4b5cda['id']],function(_0x276424){return{'id':_0x276424['id'],'fullname':_0x276424[_0x51a8('0x2f')]};});}}catch(_0x143f46){_0x4a1548(_0x143f46);}_0x347a02(_0x4b5cda);});}function getInteractionTags(_0x41df56,_0x2136b4){return new BPromise(function(_0x4ea271,_0x10c19b){try{if(_0x41df56['TagIds']){_0x41df56[_0x51a8('0x30')]=[];_0x41df56[_0x51a8('0x31')][_0x51a8('0x32')](',')['forEach'](function(_0x2080a1){_0x41df56['Tags'][_0x51a8('0x33')](_0x2136b4[_0x2080a1]);});}delete _0x41df56[_0x51a8('0x31')];}catch(_0x1ba6a7){_0x10c19b(_0x1ba6a7);}_0x4ea271(_0x41df56);});}function updateWhatsappInteraction(_0x224099,_0x193e0f,_0x50195b){return new BPromise(function(_0x1167b8,_0x53b3b6){return getInteractionUsers(_0x224099,_0x50195b)[_0x51a8('0x29')](function(_0x2d977b){return getInteractionTags(_0x2d977b,_0x193e0f);})[_0x51a8('0x29')](function(_0x578fc6){_0x1167b8(_0x578fc6);})[_0x51a8('0x34')](function(_0xdc6cc7){_0x53b3b6(_0xdc6cc7);});});}exports[_0x51a8('0x35')]=function(_0x2429f8,_0x41c020){var _0x49ab37={},_0x4c2b3d={},_0x4d3114={'count':0x0,'rows':[]};var _0x21b871=_[_0x51a8('0x36')](db['WhatsappInteraction'][_0x51a8('0x37')],function(_0x4ec0ac){return{'name':_0x4ec0ac[_0x51a8('0x38')],'type':_0x4ec0ac[_0x51a8('0x39')][_0x51a8('0x3a')]};});_0x4c2b3d[_0x51a8('0x3b')]=_[_0x51a8('0x36')](_0x21b871,_0x51a8('0x2c'));_0x4c2b3d['query']=_['keys'](_0x2429f8[_0x51a8('0x3c')]);_0x4c2b3d['filters']=_['intersection'](_0x4c2b3d['model'],_0x4c2b3d[_0x51a8('0x3c')]);_0x49ab37[_0x51a8('0x3d')]=_[_0x51a8('0x3e')](_0x4c2b3d['model'],qs[_0x51a8('0x3f')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x3f')]));_0x49ab37[_0x51a8('0x3d')]=_0x49ab37['attributes'][_0x51a8('0x40')]?_0x49ab37[_0x51a8('0x3d')]:_0x4c2b3d[_0x51a8('0x3b')];if(!_0x2429f8['query'][_0x51a8('0x41')]('nolimit')){_0x49ab37[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x21')]);_0x49ab37['offset']=qs[_0x51a8('0x20')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x20')]);}_0x49ab37[_0x51a8('0x42')]=qs[_0x51a8('0x43')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x43')]);_0x49ab37[_0x51a8('0x44')]=qs[_0x51a8('0x45')](_['pick'](_0x2429f8[_0x51a8('0x3c')],_0x4c2b3d[_0x51a8('0x45')]),_0x21b871);var _0x4c7c67=[];var _0x53409d=squel[_0x51a8('0x46')]()[_0x51a8('0x47')]('id')[_0x51a8('0x47')](_0x51a8('0x2c'))[_0x51a8('0x47')](_0x51a8('0x48'))[_0x51a8('0x49')](_0x51a8('0x4a'));var _0x26ad89=squel[_0x51a8('0x46')]()['field'](_0x51a8('0x4b'))[_0x51a8('0x47')](_0x51a8('0x4c'))[_0x51a8('0x47')](_0x51a8('0x4d'))[_0x51a8('0x49')]('user_has_whatsapp_interactions','ui')[_0x51a8('0x4e')]('users','u',_0x51a8('0x4f'));var _0x3a33f3=squel[_0x51a8('0x46')]()[_0x51a8('0x49')](_0x51a8('0x50'),'i')['left_join']('cm_contacts','c',_0x51a8('0x51'))[_0x51a8('0x4e')](_0x51a8('0x52'),'o',_0x51a8('0x53'))[_0x51a8('0x4e')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x51a8('0x4e')](_0x51a8('0x54'),'me',_0x51a8('0x55'))[_0x51a8('0x4e')](_0x51a8('0x56'),'it',_0x51a8('0x57'))[_0x51a8('0x4e')](_0x51a8('0x4a'),'t',_0x51a8('0x58'));var _0x4d29ab=squel['expr']();var _0x5db030=[];var _0x3e2d6c=squel[_0x51a8('0x59')]();var _0x103897;if(_0x2429f8['query'][_0x51a8('0x5a')]){_0x103897=as[_0x51a8('0x5b')](_0x2429f8['query'][_0x51a8('0x5a')]);var _0x4fb93c=_0x103897['sqlOperator'];for(var _0xbf828b=0x0;_0xbf828b<_0x103897[_0x51a8('0x5c')][_0x51a8('0x40')];_0xbf828b++){var _0x56d7f1=_0x103897['conditions'][_0xbf828b];var _0x3a8f1e='i';var _0x5b0398=_[_0x51a8('0x5d')](_0x21b871,[_0x51a8('0x2c'),_0x56d7f1[_0x51a8('0x47')]]);if(!_0x5b0398){switch(_0x56d7f1[_0x51a8('0x47')]){case _0x51a8('0x5e'):if(_0x56d7f1[_0x51a8('0x5f')]==0x1){_0x3a33f3[_0x51a8('0x60')]('`'+_0x56d7f1[_0x51a8('0x47')]+_0x51a8('0x61'));}else{_0x3a33f3['having']('`'+_0x56d7f1[_0x51a8('0x47')]+_0x51a8('0x62'));}break;case _0x51a8('0x63'):if(_0x56d7f1[_0x51a8('0x64')]==='$substring'){if(_0x56d7f1[_0x51a8('0x5f')]['split']('\x20')[_0x51a8('0x40')]>0x1){_0x4d29ab[_0x4fb93c](_0x51a8('0x65'),qs['getFullTextValue'](_0x56d7f1['value']),null);}else{var _0x2628d4='%'+_0x56d7f1[_0x51a8('0x5f')]+'%';_0x4d29ab[_0x4fb93c](_0x51a8('0x66'),_0x2628d4,_0x2628d4,_0x2628d4);}}else{_0x5b0398=_[_0x51a8('0x5d')](_0x21b871,[_0x51a8('0x2c'),'ContactId']);_0x56d7f1[_0x51a8('0x47')]=_0x51a8('0x67');_0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);}break;case _0x51a8('0x6b'):var _0x62966a=_0x56d7f1[_0x51a8('0x5f')]['split'](',')['map'](function(_0x4ba203){return Number(_0x4ba203);});_0x62966a['forEach'](function(_0x2048c6){_0x3e2d6c['or'](_0x51a8('0x6c'),'%,'+_0x2048c6+',%');});_0x5db030=_['union'](_0x5db030,_0x62966a);break;case _0x51a8('0x6d'):if(_0x56d7f1['operator']===_0x51a8('0x6e')){_0x4d29ab[_0x4fb93c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x56d7f1[_0x51a8('0x5f')]+'%',null);}else{_0x5b0398=_[_0x51a8('0x5d')](_0x21b871,['name','UserId']);_0x56d7f1['field']=_0x51a8('0x6f');_0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);}break;case'body':_0x390c25=as[_0x51a8('0x68')]('me',null,_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);break;}}else{var _0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25['text'],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25['value']['end']);}}}else{var _0x50a6ad=_(_0x2429f8['query'])['keys']()[_0x51a8('0x36')](function(_0x529b2f){return _[_0x51a8('0x70')](_0x21b871,[_0x51a8('0x2c'),_0x529b2f])?_0x529b2f:undefined;})[_0x51a8('0x71')]()[_0x51a8('0x5f')]();if(!_[_0x51a8('0x72')](_0x50a6ad)){_0x50a6ad[_0x51a8('0x73')](function(_0x28c539){if(_0x28c539===_0x51a8('0x74')){_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x75'),[]['concat'](_0x2429f8[_0x51a8('0x3c')][_0x28c539]));}else if(_0x28c539===_0x51a8('0x76')){var _0x31ee59=JSON['parse'](_0x2429f8['query'][_0x28c539])['$gte'];var _0x10c22e=JSON[_0x51a8('0x77')](_0x2429f8[_0x51a8('0x3c')][_0x28c539])[_0x51a8('0x78')];_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x79'),_0x31ee59,_0x10c22e);}else{if(_0x2429f8[_0x51a8('0x3c')][_0x28c539]===_0x51a8('0x7a')){_0x3a33f3[_0x51a8('0x44')]('i.'+_0x28c539+_0x51a8('0x7b'));}else{_0x3a33f3[_0x51a8('0x44')]('i.'+_0x28c539+_0x51a8('0x7c'),_0x2429f8[_0x51a8('0x3c')][_0x28c539]);}}});}if(_0x2429f8['query'][_0x51a8('0x7d')]){if(_0x2429f8[_0x51a8('0x3c')]['read']==0x1){_0x3a33f3[_0x51a8('0x60')]('`unreadMessages`\x20=\x200');}else{_0x3a33f3['having']('`unreadMessages`\x20>\x200');}}if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')]){_0x5db030=_[_0x51a8('0x7f')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')])?_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')]:new Array(_0x2429f8['query']['tag']);_0x5db030['forEach'](function(_0x44e496){_0x3e2d6c['or'](_0x51a8('0x6c'),'%,'+_0x44e496+',%');});}if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x80')]){var _0x32a40b=_0x2429f8[_0x51a8('0x3c')]['filter'][_0x51a8('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x51a8('0x82')](_0x32a40b)){_0x4d29ab['or'](_0x51a8('0x83'),_0x32a40b+'%')['or'](_0x51a8('0x84'),_0x32a40b+'%');}else{_0x4d29ab['or'](_0x51a8('0x85'),qs[_0x51a8('0x86')](_0x32a40b))['or'](_0x51a8('0x87'),_0x32a40b+'%');}}}_0x3a33f3[_0x51a8('0x44')](_0x4d29ab);_0x3a33f3[_0x51a8('0x88')](_0x51a8('0x89'));var _0x39fcef={'type':db[_0x51a8('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x21912f=_0x3a33f3[_0x51a8('0x8b')]();_0x21912f[_0x51a8('0x47')](_0x51a8('0x89'));_0x21912f['field'](_0x51a8('0x8c'),'unreadMessages');if(_0x49ab37[_0x51a8('0x42')]){_0x49ab37[_0x51a8('0x42')][_0x51a8('0x73')](function(_0x24fcc3){var _0x190632=_0x24fcc3[0x0]===_0x51a8('0x8d')?_0x24fcc3[0x0]:'i.'+_0x24fcc3[0x0];_0x3a33f3[_0x51a8('0x42')](_0x190632,_0x24fcc3[0x1]===_0x51a8('0x8e')?![]:!![]);});}if(!_[_0x51a8('0x72')](_0x5db030)){_0x3a33f3['having'](_0x3e2d6c);_0x21912f[_0x51a8('0x44')](_0x51a8('0x8f'),_0x5db030);}BPromise[_0x51a8('0x90')]()[_0x51a8('0x29')](function(){if(!_0x103897){if(_0x2429f8['query']['WhatsappAccountId'])return;_0x21912f[_0x51a8('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x3a33f3['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2429f8[_0x51a8('0x91')]['role']!=='agent')return;return _0x2429f8[_0x51a8('0x91')][_0x51a8('0x92')]({'attributes':['id'],'raw':!![]})[_0x51a8('0x29')](function(_0x5be0ce){if(_[_0x51a8('0x72')](_0x5be0ce)){_0x21912f[_0x51a8('0x44')](_0x51a8('0x93'));_0x3a33f3['where'](_0x51a8('0x93'));}else{_0x21912f[_0x51a8('0x44')](_0x51a8('0x75'),_[_0x51a8('0x36')](_0x5be0ce,'id'));_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x75'),_[_0x51a8('0x36')](_0x5be0ce,'id'));}});})[_0x51a8('0x29')](function(){if(_0x2429f8[_0x51a8('0x91')]['role']===_0x51a8('0x94')&&!_0x103897&&!_0x2429f8[_0x51a8('0x3c')]['WhatsappAccountId'])return[];return db[_0x51a8('0x95')][_0x51a8('0x3c')](_0x21912f['toString'](),_0x39fcef);})[_0x51a8('0x29')](function(_0x132ce5){_0x4d3114[_0x51a8('0x96')]=_0x132ce5[_0x51a8('0x40')];if(_0x4d3114[_0x51a8('0x96')]===0x0)return[];return db['sequelize'][_0x51a8('0x3c')](_0x53409d[_0x51a8('0x97')](),_0x39fcef)[_0x51a8('0x29')](function(_0x1d587e){_0x4c7c67=_['keyBy'](_0x1d587e,'id');_0x39fcef=_[_0x51a8('0x98')](_0x39fcef,{'model':db[_0x51a8('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x3f')]){_0x49ab37[_0x51a8('0x3d')][_0x51a8('0x73')](function(_0xf718e){_0x3a33f3[_0x51a8('0x47')]('i.'+_0xf718e);});}else{_0x3a33f3['field'](_0x51a8('0x8c'),_0x51a8('0x5e'));_0x3a33f3['field'](_0x51a8('0x9a'),_0x51a8('0x9b'));_0x3a33f3['field'](_0x51a8('0x9c'),'Account.mandatoryDisposition');_0x3a33f3['field'](_0x51a8('0x9d'),_0x51a8('0x8d'));_0x3a33f3[_0x51a8('0x47')]('i.*');_0x3a33f3['field'](_0x51a8('0x9e'),'Contact.firstName');_0x3a33f3[_0x51a8('0x47')](_0x51a8('0x9f'),_0x51a8('0xa0'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa1'),_0x51a8('0xa2'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa3'),_0x51a8('0xa4'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa5'),_0x51a8('0xa6'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa7'),_0x51a8('0xa8'));_0x3a33f3['field']('o.fullname',_0x51a8('0xa9'));_0x3a33f3['field']('o.internal','Owner.internal');_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xaa'),_0x51a8('0x31'));}if(_0x49ab37[_0x51a8('0x21')])_0x3a33f3['limit'](_0x49ab37[_0x51a8('0x21')]);if(_0x49ab37[_0x51a8('0x20')])_0x3a33f3['offset'](_0x49ab37[_0x51a8('0x20')]);return db[_0x51a8('0x95')]['query'](_0x3a33f3['toString'](),_0x39fcef);})[_0x51a8('0x29')](function(_0x835bff){_0x26ad89[_0x51a8('0x44')](_0x51a8('0xab'),_[_0x51a8('0x36')](_0x835bff,'id'));return db[_0x51a8('0x95')]['query'](_0x26ad89[_0x51a8('0x97')](),_0x39fcef)[_0x51a8('0x29')](function(_0x181f8b){var _0x566d62=_[_0x51a8('0xac')](_0x181f8b,_0x51a8('0xad'));var _0x1db1e0=[];_0x835bff['forEach'](function(_0x149fa4){_0x1db1e0[_0x51a8('0x33')](updateWhatsappInteraction(_0x149fa4,_0x4c7c67,_0x566d62));});return BPromise['all'](_0x1db1e0);});});})[_0x51a8('0x29')](function(_0x529916){_0x4d3114[_0x51a8('0xae')]=_0x529916;return _0x4d3114;})[_0x51a8('0x29')](respondWithFilteredResult(_0x41c020,_0x49ab37))[_0x51a8('0x34')](handleError(_0x41c020,null));};exports[_0x51a8('0xaf')]=function(_0x41621c,_0x700df1){var _0x398d27={'raw':![],'where':{'id':_0x41621c['params']['id']}},_0x42d0ad={};_0x42d0ad[_0x51a8('0x3b')]=_[_0x51a8('0xb0')](db[_0x51a8('0x99')][_0x51a8('0x37')]);_0x42d0ad[_0x51a8('0x3c')]=_['keys'](_0x41621c['query']);_0x42d0ad[_0x51a8('0x45')]=_[_0x51a8('0x3e')](_0x42d0ad[_0x51a8('0x3b')],_0x42d0ad[_0x51a8('0x3c')]);_0x398d27[_0x51a8('0x3d')]=_['intersection'](_0x42d0ad[_0x51a8('0x3b')],qs['fields'](_0x41621c[_0x51a8('0x3c')][_0x51a8('0x3f')]));_0x398d27['attributes']=_0x398d27[_0x51a8('0x3d')]['length']?_0x398d27[_0x51a8('0x3d')]:_0x42d0ad[_0x51a8('0x3b')];if(_0x41621c[_0x51a8('0x3c')][_0x51a8('0xb1')]){_0x398d27[_0x51a8('0xb2')]=[{'all':!![]}];}_0x398d27=_['merge']({},_0x398d27,_0x41621c[_0x51a8('0xb3')]);return db[_0x51a8('0x99')]['find'](_0x398d27)[_0x51a8('0x29')](handleEntityNotFound(_0x700df1,null))[_0x51a8('0x29')](respondWithResult(_0x700df1,null))['catch'](handleError(_0x700df1,null));};exports['create']=function(_0x24b2a9,_0x158c45){return db[_0x51a8('0x99')]['create'](_0x24b2a9[_0x51a8('0xb4')],{})[_0x51a8('0x29')](respondWithResult(_0x158c45,0xc9))[_0x51a8('0x34')](handleError(_0x158c45,null));};exports[_0x51a8('0x27')]=function(_0x336269,_0x21f861){if(_0x336269[_0x51a8('0xb4')]['id']){delete _0x336269['body']['id'];}return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x336269[_0x51a8('0xb5')]['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x21f861,null))['then'](saveUpdates(_0x336269['body'],null))[_0x51a8('0x29')](respondWithResult(_0x21f861,null))[_0x51a8('0x34')](handleError(_0x21f861,null));};exports['destroy']=function(_0x4ea00f,_0x5b44ba){return db[_0x51a8('0x99')]['find']({'where':{'id':_0x4ea00f['params']['id']}})['then'](handleEntityNotFound(_0x5b44ba,null))[_0x51a8('0x29')](removeEntity(_0x5b44ba,null))['catch'](handleError(_0x5b44ba,null));};exports[_0x51a8('0xb6')]=function(_0x2d820c,_0x52403f){return db['WhatsappInteraction'][_0x51a8('0xb6')]()['then'](respondWithResult(_0x52403f,null))[_0x51a8('0x34')](handleError(_0x52403f,null));};exports[_0x51a8('0xb7')]=function(_0x4bf480,_0x39938f,_0x88625a){return db['WhatsappMessage'][_0x51a8('0x5d')]({'where':{'id':_0x4bf480[_0x51a8('0xb5')]['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x39938f,null))['then'](function(_0x2af315){if(_0x2af315){return _0x2af315[_0x51a8('0xb7')](_0x4bf480[_0x51a8('0xb4')]['ids'],_['omit'](_0x4bf480[_0x51a8('0xb4')],[_0x51a8('0xb8'),'id'])||{});}})[_0x51a8('0x29')](respondWithResult(_0x39938f,null))[_0x51a8('0x34')](handleError(_0x39938f,null));};exports[_0x51a8('0xb9')]=function(_0x475014,_0x35cd5d,_0x64e49d){var _0x1482ff={'raw':![],'where':{}};var _0x570ba0={};var _0x2a8aa1={'count':0x0,'rows':[]};return db[_0x51a8('0x99')][_0x51a8('0xba')]({'where':{'id':_0x475014['params']['id']}})['then'](handleEntityNotFound(_0x35cd5d,null))[_0x51a8('0x29')](function(_0x318478){if(_0x318478){_0x570ba0[_0x51a8('0x3b')]=_[_0x51a8('0xb0')](db[_0x51a8('0xbb')]['rawAttributes']);_0x570ba0['query']=_[_0x51a8('0xb0')](_0x475014[_0x51a8('0x3c')]);_0x570ba0['filters']=_[_0x51a8('0x3e')](_0x570ba0[_0x51a8('0x3b')],_0x570ba0[_0x51a8('0x3c')]);_0x1482ff[_0x51a8('0x3d')]=_[_0x51a8('0x3e')](_0x570ba0['model'],qs['fields'](_0x475014[_0x51a8('0x3c')]['fields']));_0x1482ff[_0x51a8('0x3d')]=_0x1482ff['attributes'][_0x51a8('0x40')]?_0x1482ff[_0x51a8('0x3d')]:_0x570ba0['model'];if(!_0x475014[_0x51a8('0x3c')][_0x51a8('0x41')](_0x51a8('0xbc'))){_0x1482ff[_0x51a8('0x21')]=qs['limit'](_0x475014['query'][_0x51a8('0x21')]);_0x1482ff[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x475014[_0x51a8('0x3c')]['offset']);}_0x1482ff[_0x51a8('0x42')]=qs['sort'](_0x475014[_0x51a8('0x3c')]['sort']);_0x1482ff[_0x51a8('0x44')]=qs[_0x51a8('0x45')](_[_0x51a8('0xbd')](_0x475014[_0x51a8('0x3c')],_0x570ba0['filters']));_0x1482ff[_0x51a8('0x44')]['WhatsappInteractionId']=_0x318478['id'];if(_0x475014[_0x51a8('0x3c')][_0x51a8('0x80')]){_0x1482ff[_0x51a8('0x44')]=_['merge'](_0x1482ff[_0x51a8('0x44')],{'$or':_[_0x51a8('0x36')](_0x1482ff[_0x51a8('0x3d')],function(_0x4e636b){var _0x5e541d={};_0x5e541d[_0x4e636b]={'$like':'%'+_0x475014[_0x51a8('0x3c')][_0x51a8('0x80')]+'%'};return _0x5e541d;})});}if(_0x475014[_0x51a8('0x3c')][_0x51a8('0xbe')]){var _0x4c3d87=_0x475014['query'][_0x51a8('0xbe')]['split'](',');var _0x1b9cd4={};_0x1b9cd4[_0x4c3d87[0x0]]={'$gte':moment(_0x4c3d87[0x1])[_0x51a8('0xbf')](_0x51a8('0xc0'))};_0x1482ff[_0x51a8('0x44')]=_[_0x51a8('0x98')](_0x1482ff[_0x51a8('0x44')],_0x1b9cd4);}_0x1482ff=_[_0x51a8('0x98')]({},_0x1482ff,_0x475014['options']);return db['WhatsappMessage']['count']({'where':_0x1482ff[_0x51a8('0x44')]})[_0x51a8('0x29')](function(_0x2600c3){_0x2a8aa1[_0x51a8('0x96')]=_0x2600c3;if(_0x475014[_0x51a8('0x3c')]['includeAll']){_0x1482ff[_0x51a8('0xb2')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x51a8('0xc1')](_0x1482ff);})[_0x51a8('0x29')](function(_0x1dcdd9){_0x2a8aa1[_0x51a8('0xae')]=_0x1dcdd9;return _0x2a8aa1;});}})['then'](respondWithFilteredResult(_0x35cd5d,_0x1482ff))['catch'](handleError(_0x35cd5d,null));};exports[_0x51a8('0xc2')]=function(_0x542cc4,_0x289366,_0x4252e7){return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x542cc4['params']['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x289366,null))[_0x51a8('0x29')](function(_0x441ee7){if(_0x441ee7){return _0x441ee7[_0x51a8('0xc3')](_0x542cc4[_0x51a8('0xb4')][_0x51a8('0xb8')],_[_0x51a8('0xc4')](_0x542cc4[_0x51a8('0xb4')],[_0x51a8('0xb8'),'id'])||{})[_0x51a8('0xc5')](function(){return db[_0x51a8('0x6b')]['findAll']({'attributes':['id',_0x51a8('0x2c'),_0x51a8('0x48')],'where':{'id':_0x542cc4[_0x51a8('0xb4')][_0x51a8('0xb8')]}});})[_0x51a8('0x29')](function(_0x4c2cfa){socket[_0x51a8('0xc6')](_0x51a8('0xc7'),{'id':Number(_0x542cc4[_0x51a8('0xb5')]['id']),'tags':_0x4c2cfa||[]});return{'id':Number(_0x542cc4['params']['id']),'tags':_0x4c2cfa||[]};});}})[_0x51a8('0x29')](respondWithResult(_0x289366,null))[_0x51a8('0x34')](handleError(_0x289366,null));};exports[_0x51a8('0xc8')]=function(_0x4a2353,_0x399db9,_0x2209e4){return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x4a2353['params']['id']}})['then'](handleEntityNotFound(_0x399db9,null))['then'](function(_0x1e957d){if(_0x1e957d){return _0x1e957d['removeTags'](_0x4a2353['query'][_0x51a8('0xb8')]);}})[_0x51a8('0x29')](respondWithStatusCode(_0x399db9,null))[_0x51a8('0x34')](handleError(_0x399db9,null));};exports[_0x51a8('0xc9')]=function(_0x1ec08a,_0x462183){var _0x5b316b=moment()[_0x51a8('0xca')]()[_0x51a8('0x97')]();var _0x577fce=path['join'](config[_0x51a8('0xcb')],_0x51a8('0xcc'),'files',_0x51a8('0xcd'));var _0x19dd35=path[_0x51a8('0xce')](config[_0x51a8('0xcb')],_0x51a8('0xcc'),_0x51a8('0xcf'),_0x51a8('0xd0'));var _0x16dce5=path[_0x51a8('0xce')](_0x577fce,_0x5b316b);var _0x1568bf=util[_0x51a8('0xbf')](_0x51a8('0xd1'),_0x1ec08a[_0x51a8('0xb5')]['id'],_0x5b316b);var _0xfedb52=path[_0x51a8('0xce')](_0x577fce,_0x1568bf);var _0x5804c7=[];_0x5804c7[_0x51a8('0x33')]({'model':db[_0x51a8('0x6d')],'as':'User','attributes':['id',_0x51a8('0x2f')],'raw':!![]});_0x5804c7[_0x51a8('0x33')]({'model':db['CmContact'],'as':_0x51a8('0x63'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1ec08a[_0x51a8('0x3c')]['attachments']){_0x5804c7[_0x51a8('0x33')]({'model':db[_0x51a8('0xd2')],'as':_0x51a8('0xd2'),'raw':!![]});}var _0x3b9e0c=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body','createdAt',_0x51a8('0xd3'),_0x51a8('0xd4'),_0x51a8('0x7d')],'include':_0x5804c7}];_0x3b9e0c[_0x51a8('0x33')]({'model':db[_0x51a8('0xd5')],'as':_0x51a8('0xd6'),'attributes':['id',_0x51a8('0x2c')]});_0x3b9e0c['push']({'model':db['User'],'as':_0x51a8('0xd7'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x51a8('0x5d')]({'where':{'id':_0x1ec08a[_0x51a8('0xb5')]['id']},'include':_0x3b9e0c})[_0x51a8('0x29')](handleEntityNotFound(_0x462183,null))[_0x51a8('0x29')](function(_0x3c609c){if(_0x3c609c){var _0x3c76e4=_0x3c609c[_0x51a8('0xd8')]({'plain':!![]});fs[_0x51a8('0xd9')](_0x16dce5);var _0x83dfed={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x51a8('0xda')}},'footer':{'height':_0x51a8('0xdb'),'contents':{'default':util[_0x51a8('0xbf')](_0x51a8('0xdc'),util[_0x51a8('0xbf')](_0x51a8('0xdd'),_0x51a8('0xde'),_0x3c76e4['id']),moment()[_0x51a8('0xbf')](_0x51a8('0xdf'))[_0x51a8('0x97')]())}}};var _0x4a55c0={'channel':'Whatsapp','account':_0x3c76e4['Account'][_0x51a8('0x2c')],'agent':_0x3c76e4[_0x51a8('0xd7')]?_0x3c76e4[_0x51a8('0xd7')]['fullname']:_0x51a8('0xe0'),'createdAt':moment(_0x3c76e4[_0x51a8('0x76')])[_0x51a8('0xbf')](_0x51a8('0xc0'))['toString'](),'closedAt':_0x3c76e4[_0x51a8('0xe1')]?moment(_0x3c76e4[_0x51a8('0xe2')])['format'](_0x51a8('0xc0'))['toString']():'','disposition':_0x3c76e4[_0x51a8('0xe3')],'messages':_(_0x3c76e4[_0x51a8('0xe4')])[_0x51a8('0x80')]({'secret':![]})[_0x51a8('0x36')](function(_0x5592e6){if(_0x5592e6[_0x51a8('0xd2')]){var _0x4ad6a8=path['join'](_0x19dd35,_0x5592e6[_0x51a8('0xd2')][_0x51a8('0xe5')]);if(fs[_0x51a8('0xe6')](_0x4ad6a8)){fs[_0x51a8('0xe7')](_0x4ad6a8)[_0x51a8('0xe8')](fs[_0x51a8('0xe9')](path[_0x51a8('0xce')](_0x16dce5,_0x5592e6['Attachment'][_0x51a8('0xe5')])));}}return{'date':moment(_0x5592e6[_0x51a8('0x76')])[_0x51a8('0xbf')](_0x51a8('0xc0'))['toString'](),'sender':_0x5592e6[_0x51a8('0xd3')]===_0x51a8('0xea')?_0x5592e6[_0x51a8('0x6d')]?_0x5592e6[_0x51a8('0x6d')]['fullname']:_0x51a8('0xeb'):_0x5592e6[_0x51a8('0x63')][_0x51a8('0xec')]+(_0x5592e6[_0x51a8('0x63')]['lastName']?'\x20'+_0x5592e6[_0x51a8('0x63')][_0x51a8('0xed')]:''),'body':_0x5592e6[_0x51a8('0xd2')]?_0x5592e6[_0x51a8('0xd2')][_0x51a8('0xe5')]:_0x5592e6[_0x51a8('0xb4')],'direction':_0x5592e6[_0x51a8('0xd3')]===_0x51a8('0xea')?'A':'C','secret':_0x5592e6[_0x51a8('0xd4')],'read':_0x5592e6[_0x51a8('0x7d')],'attachment':_0x5592e6['Attachment']};})['value']()};return ejs[_0x51a8('0xee')](path['join'](config[_0x51a8('0xcb')],_0x51a8('0xcc'),_0x51a8('0xef'),_0x51a8('0xf0')),{'interaction':_0x4a55c0})[_0x51a8('0x29')](function(_0xc445ba){return new BPromise(function(_0xa6c131,_0x4a3278){pdf['create'](_0xc445ba,_0x83dfed)[_0x51a8('0xf1')](path[_0x51a8('0xce')](_0x16dce5,_0x51a8('0xf2')+_0x3c76e4['id']+'-'+_0x5b316b+_0x51a8('0xf3')),function(_0x3bd73b,_0x12b472){if(_0x3bd73b)return _0x4a3278(_0x3bd73b);_0xa6c131(_0x12b472);});});})[_0x51a8('0x29')](function(){return new BPromise(function(_0x326f86,_0x410051){zipdir(_0x16dce5,{'saveTo':_0xfedb52},function(_0x2e3e68,_0xf07549){if(_0x2e3e68)return _0x410051(_0x2e3e68);return _0x326f86(_0xf07549);});})['then'](function(){return new BPromise(function(_0x49b426,_0x310086){rimraf(_0x16dce5,function(_0x1ca255){if(_0x1ca255)_0x310086(_0x1ca255);return _0x49b426();});});})[_0x51a8('0x29')](function(){return _0x462183[_0x51a8('0xc9')](_0xfedb52,_0x1568bf,function(_0xa18052){if(_0xa18052){console[_0x51a8('0xf4')]('err',_0xa18052);}else{fs[_0x51a8('0xf5')](_0xfedb52);}});});});}else{return _0x462183[_0x51a8('0xf6')](0xc8);}})['catch'](handleError(_0x462183,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index caa76f5..b734e1e 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 _0x6576=['save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6576,0xb8));var _0x6657=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x6576[_0x151418];return _0x40e29a;};'use strict';var EventEmitter=require(_0x6657('0x0'));var WhatsappInteraction=require(_0x6657('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x6657('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6657('0x2')](0x0);var events={'afterCreate':_0x6657('0x3'),'afterUpdate':'update','afterDestroy':_0x6657('0x4')};function emitEvent(_0x49bf69){return function(_0x2fd20c,_0x7fec80,_0x37b591){_0x2fd20c[_0x6657('0x5')]({'attributes':['id'],'raw':!![]})[_0x6657('0x6')](function(_0x1e2438){_0x2fd20c[_0x6657('0x7')](_0x6657('0x8'),_0x1e2438[_0x6657('0x9')](function(_0x3e382c){return{'id':_0x3e382c['id']};}));return WhatsappMessage[_0x6657('0xa')]({'where':{'WhatsappInteractionId':_0x2fd20c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x535175){_0x2fd20c[_0x6657('0x7')](_0x6657('0xb'),_0x535175['length']);WhatsappInteractionEvents[_0x6657('0xc')](_0x49bf69+':'+_0x2fd20c['id'],_0x2fd20c);WhatsappInteractionEvents[_0x6657('0xc')](_0x49bf69,_0x2fd20c);_0x37b591(null);})[_0x6657('0xd')](_0x37b591(null));};}for(var e in events){if(events[_0x6657('0xe')](e)){var event=events[e];WhatsappInteraction[_0x6657('0xf')](e,emitEvent(event));}}module[_0x6657('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x9fab=['setDataValue','Users','map','findAll','length','catch','hook','../../mysqldb','setMaxListeners','remove','getUsers','then'];(function(_0x181e2d,_0x4ccf91){var _0x231d54=function(_0x27c41a){while(--_0x27c41a){_0x181e2d['push'](_0x181e2d['shift']());}};_0x231d54(++_0x4ccf91);}(_0x9fab,0x1c3));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xb9fa('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb9fa('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb9fa('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb9fa('0x2')};function emitEvent(_0x2f97f0){return function(_0x1cce36,_0x545e61,_0x159542){_0x1cce36[_0xb9fa('0x3')]({'attributes':['id'],'raw':!![]})[_0xb9fa('0x4')](function(_0x457dc4){_0x1cce36[_0xb9fa('0x5')](_0xb9fa('0x6'),_0x457dc4[_0xb9fa('0x7')](function(_0x59dc09){return{'id':_0x59dc09['id']};}));return WhatsappMessage[_0xb9fa('0x8')]({'where':{'WhatsappInteractionId':_0x1cce36['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb9fa('0x4')](function(_0x5d7af7){_0x1cce36[_0xb9fa('0x5')]('unreadMessages',_0x5d7af7[_0xb9fa('0x9')]);WhatsappInteractionEvents['emit'](_0x2f97f0+':'+_0x1cce36['id'],_0x1cce36);WhatsappInteractionEvents['emit'](_0x2f97f0,_0x1cce36);_0x159542(null);})[_0xb9fa('0xa')](_0x159542(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xb9fa('0xb')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 94c02f9..07484f4 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 _0x3d17=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x88fa18,_0x8e16ac){var _0xd1bcd3=function(_0x27501f){while(--_0x27501f){_0x88fa18['push'](_0x88fa18['shift']());}};_0xd1bcd3(++_0x8e16ac);}(_0x3d17,0x1d2));var _0x73d1=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x3d17[_0x243217];return _0x478029;};'use strict';var _=require(_0x73d1('0x0'));var util=require(_0x73d1('0x1'));var logger=require(_0x73d1('0x2'))(_0x73d1('0x3'));var moment=require(_0x73d1('0x4'));var BPromise=require('bluebird');var rp=require(_0x73d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x73d1('0x6'));var attributes=require(_0x73d1('0x7'));module[_0x73d1('0x8')]=function(_0x378515,_0x5bbbf4){return _0x378515[_0x73d1('0x9')](_0x73d1('0xa'),attributes,{'tableName':_0x73d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5262a0,_0x3b0341,_0x1fb4de){if(_0x5262a0[_0x73d1('0xc')](_0x73d1('0xd'))){_0x5262a0[_0x73d1('0xe')]=moment()['format'](_0x73d1('0xf'));}_0x1fb4de(null,_0x5262a0);}}});}; \ No newline at end of file +var _0x8b07=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8b07,0x117));var _0x78b0=function(_0x53e8cc,_0x28b9d0){_0x53e8cc=_0x53e8cc-0x0;var _0x168227=_0x8b07[_0x53e8cc];return _0x168227;};'use strict';var _=require(_0x78b0('0x0'));var util=require(_0x78b0('0x1'));var logger=require('../../config/logger')(_0x78b0('0x2'));var moment=require(_0x78b0('0x3'));var BPromise=require(_0x78b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x78b0('0x5'));var config=require(_0x78b0('0x6'));var attributes=require(_0x78b0('0x7'));module[_0x78b0('0x8')]=function(_0x28126c,_0x45a0e2){return _0x28126c[_0x78b0('0x9')](_0x78b0('0xa'),attributes,{'tableName':_0x78b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x401885,_0x5cd5d1,_0x567258){if(_0x401885[_0x78b0('0xc')](_0x78b0('0xd'))){_0x401885[_0x78b0('0xe')]=moment()[_0x78b0('0xf')](_0x78b0('0x10'));}_0x567258(null,_0x401885);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index bd1ad06..66d2dfb 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 _0x8132=['WhatsappInteraction','body','options','raw','attributes','limit','then','AddTagsToWhatsappInteraction','where','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','UpdateWhatsappInteraction'];(function(_0x906c78,_0x38f979){var _0x324ad2=function(_0x429f87){while(--_0x429f87){_0x906c78['push'](_0x906c78['shift']());}};_0x324ad2(++_0x38f979);}(_0x8132,0x148));var _0x2813=function(_0x230073,_0x2bce95){_0x230073=_0x230073-0x0;var _0x3b5ef2=_0x8132[_0x230073];return _0x3b5ef2;};'use strict';var _=require('lodash');var util=require(_0x2813('0x0'));var moment=require(_0x2813('0x1'));var BPromise=require(_0x2813('0x2'));var rs=require(_0x2813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2813('0x4'))['db'];var utils=require(_0x2813('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2813('0x6'));var jayson=require(_0x2813('0x7'));var client=jayson[_0x2813('0x8')]['http']({'port':0x232a});config[_0x2813('0x9')]=_[_0x2813('0xa')](config[_0x2813('0x9')],{'host':_0x2813('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2813('0x9')]));require('./whatsappInteraction.socket')[_0x2813('0xc')](socket);function respondWithRpcPromise(_0x29f66a,_0x28968e,_0x2b4dfa){return new BPromise(function(_0x3f2ea1,_0x5489a2){return client['request'](_0x29f66a,_0x2b4dfa)['then'](function(_0x5cd4a6){logger[_0x2813('0xd')](_0x2813('0xe'),_0x28968e,_0x2813('0xf'));logger[_0x2813('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x28968e,'request\x20sent',JSON[_0x2813('0x11')](_0x5cd4a6));if(_0x5cd4a6['error']){if(_0x5cd4a6['error'][_0x2813('0x12')]===0x1f4){logger[_0x2813('0x13')](_0x2813('0xe'),_0x28968e,_0x5cd4a6['error'][_0x2813('0x14')]);return _0x5489a2(_0x5cd4a6['error'][_0x2813('0x14')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x28968e,_0x5cd4a6[_0x2813('0x13')][_0x2813('0x14')]);return _0x3f2ea1(_0x5cd4a6[_0x2813('0x13')][_0x2813('0x14')]);}else{logger[_0x2813('0xd')](_0x2813('0xe'),_0x28968e,_0x2813('0xf'));_0x3f2ea1(_0x5cd4a6['result'][_0x2813('0x14')]);}})['catch'](function(_0x549768){logger[_0x2813('0x13')](_0x2813('0xe'),_0x28968e,_0x549768);_0x5489a2(_0x549768);});});}exports[_0x2813('0x15')]=function(_0x1cd346){var _0x514e3f=this;return new Promise(function(_0x5943db,_0x503034){return db[_0x2813('0x16')]['update'](_0x1cd346[_0x2813('0x17')],{'raw':_0x1cd346[_0x2813('0x18')]?_0x1cd346[_0x2813('0x18')][_0x2813('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cd346['options']?_0x1cd346[_0x2813('0x18')]['where']||null:null,'attributes':_0x1cd346[_0x2813('0x18')]?_0x1cd346['options'][_0x2813('0x1a')]||null:null,'limit':_0x1cd346[_0x2813('0x18')]?_0x1cd346[_0x2813('0x18')][_0x2813('0x1b')]||null:null})[_0x2813('0x1c')](function(_0x28fb66){logger['info']('UpdateWhatsappInteraction',_0x1cd346);logger[_0x2813('0x10')](_0x2813('0x15'),_0x1cd346,JSON[_0x2813('0x11')](_0x28fb66));_0x5943db(_0x28fb66);})['catch'](function(_0x165e90){logger['error']('UpdateWhatsappInteraction',_0x165e90['message'],_0x1cd346);_0x503034(_0x514e3f[_0x2813('0x13')](0x1f4,_0x165e90[_0x2813('0x14')]));});});};exports[_0x2813('0x1d')]=function(_0x3ca8b1){return new Promise(function(_0x479130,_0x326b63){return db[_0x2813('0x16')]['find']({'where':_0x3ca8b1['options']?_0x3ca8b1[_0x2813('0x18')][_0x2813('0x1e')]||null:null})[_0x2813('0x1c')](function(_0x389700){if(_0x389700){return _0x389700['addTags'](_0x3ca8b1[_0x2813('0x17')][_0x2813('0x1f')],_[_0x2813('0x20')](_0x3ca8b1[_0x2813('0x17')],[_0x2813('0x1f'),'id'])||{});}})[_0x2813('0x21')](function(_0x53baa8){logger['info'](_0x2813('0x22'),_0x3ca8b1);logger[_0x2813('0x10')](_0x2813('0x22'),_0x3ca8b1,JSON[_0x2813('0x11')](_0x53baa8));_0x479130(_0x53baa8);})['catch'](function(_0x384adf){logger[_0x2813('0x13')](_0x2813('0x22'),_0x384adf[_0x2813('0x14')],_0x3ca8b1);_0x326b63(_this[_0x2813('0x13')](0x1f4,_0x384adf[_0x2813('0x14')]));});});}; \ No newline at end of file +var _0xaef6=['find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaef6,0x1e9));var _0x6aef=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xaef6[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6aef('0x0'));var util=require(_0x6aef('0x1'));var moment=require(_0x6aef('0x2'));var BPromise=require(_0x6aef('0x3'));var rs=require(_0x6aef('0x4'));var fs=require('fs');var Redis=require(_0x6aef('0x5'));var db=require(_0x6aef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6aef('0x7'))(_0x6aef('0x8'));var config=require(_0x6aef('0x9'));var jayson=require(_0x6aef('0xa'));var client=jayson[_0x6aef('0xb')][_0x6aef('0xc')]({'port':0x232a});config[_0x6aef('0xd')]=_[_0x6aef('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6aef('0xf'))(new Redis(config[_0x6aef('0xd')]));require(_0x6aef('0x10'))['register'](socket);function respondWithRpcPromise(_0xc57fec,_0x1dd24f,_0x805bd7){return new BPromise(function(_0x809ad3,_0x40c053){return client[_0x6aef('0x11')](_0xc57fec,_0x805bd7)[_0x6aef('0x12')](function(_0x454527){logger[_0x6aef('0x13')](_0x6aef('0x14'),_0x1dd24f,_0x6aef('0x15'));logger[_0x6aef('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1dd24f,_0x6aef('0x15'),JSON['stringify'](_0x454527));if(_0x454527[_0x6aef('0x17')]){if(_0x454527['error'][_0x6aef('0x18')]===0x1f4){logger[_0x6aef('0x17')](_0x6aef('0x14'),_0x1dd24f,_0x454527['error'][_0x6aef('0x19')]);return _0x40c053(_0x454527[_0x6aef('0x17')][_0x6aef('0x19')]);}logger[_0x6aef('0x17')](_0x6aef('0x14'),_0x1dd24f,_0x454527[_0x6aef('0x17')][_0x6aef('0x19')]);return _0x809ad3(_0x454527['error']['message']);}else{logger[_0x6aef('0x13')](_0x6aef('0x14'),_0x1dd24f,_0x6aef('0x15'));_0x809ad3(_0x454527[_0x6aef('0x1a')][_0x6aef('0x19')]);}})[_0x6aef('0x1b')](function(_0x311cf1){logger[_0x6aef('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x1dd24f,_0x311cf1);_0x40c053(_0x311cf1);});});}exports[_0x6aef('0x1c')]=function(_0x314811){var _0x1eae7c=this;return new Promise(function(_0x1851cf,_0x2917a8){return db[_0x6aef('0x1d')][_0x6aef('0x1e')](_0x314811[_0x6aef('0x1f')],{'raw':_0x314811[_0x6aef('0x20')]?_0x314811[_0x6aef('0x20')][_0x6aef('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314811[_0x6aef('0x20')]?_0x314811['options'][_0x6aef('0x22')]||null:null,'attributes':_0x314811[_0x6aef('0x20')]?_0x314811[_0x6aef('0x20')][_0x6aef('0x23')]||null:null,'limit':_0x314811['options']?_0x314811[_0x6aef('0x20')][_0x6aef('0x24')]||null:null})[_0x6aef('0x12')](function(_0xa014c3){logger[_0x6aef('0x13')](_0x6aef('0x1c'),_0x314811);logger[_0x6aef('0x16')](_0x6aef('0x1c'),_0x314811,JSON[_0x6aef('0x25')](_0xa014c3));_0x1851cf(_0xa014c3);})[_0x6aef('0x1b')](function(_0x22596d){logger[_0x6aef('0x17')](_0x6aef('0x1c'),_0x22596d[_0x6aef('0x19')],_0x314811);_0x2917a8(_0x1eae7c['error'](0x1f4,_0x22596d[_0x6aef('0x19')]));});});};exports[_0x6aef('0x26')]=function(_0x516bb7){return new Promise(function(_0x507cfb,_0x29a863){return db[_0x6aef('0x1d')][_0x6aef('0x27')]({'where':_0x516bb7[_0x6aef('0x20')]?_0x516bb7[_0x6aef('0x20')]['where']||null:null})[_0x6aef('0x12')](function(_0x10ff28){if(_0x10ff28){return _0x10ff28['addTags'](_0x516bb7[_0x6aef('0x1f')][_0x6aef('0x28')],_[_0x6aef('0x29')](_0x516bb7[_0x6aef('0x1f')],[_0x6aef('0x28'),'id'])||{});}})[_0x6aef('0x2a')](function(_0x13c5f5){logger[_0x6aef('0x13')](_0x6aef('0x2b'),_0x516bb7);logger[_0x6aef('0x16')](_0x6aef('0x2b'),_0x516bb7,JSON[_0x6aef('0x25')](_0x13c5f5));_0x507cfb(_0x13c5f5);})['catch'](function(_0x56ca22){logger[_0x6aef('0x17')]('AddTags',_0x56ca22['message'],_0x516bb7);_0x29a863(_this[_0x6aef('0x17')](0x1f4,_0x56ca22[_0x6aef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5d7ca7f..ea0dbf3 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 _0xde13=['emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x4ffa11,_0x120051){var _0x1f669d=function(_0x44b3ab){while(--_0x44b3ab){_0x4ffa11['push'](_0x4ffa11['shift']());}};_0x1f669d(++_0x120051);}(_0xde13,0x12a));var _0x3de1=function(_0x128960,_0x432976){_0x128960=_0x128960-0x0;var _0x1ddb2b=_0xde13[_0x128960];return _0x1ddb2b;};'use strict';var WhatsappInteractionEvents=require(_0x3de1('0x0'));var events=[_0x3de1('0x1'),_0x3de1('0x2'),'update'];function createListener(_0x2dd4aa,_0x4a1276){return function(_0x752aee){_0x4a1276[_0x3de1('0x3')](_0x2dd4aa,_0x752aee);};}function removeListener(_0x29a1fa,_0x22b514){return function(){WhatsappInteractionEvents['removeListener'](_0x29a1fa,_0x22b514);};}exports[_0x3de1('0x4')]=function(_0x5627ab){for(var _0x344532=0x0,_0x227497=events[_0x3de1('0x5')];_0x344532<_0x227497;_0x344532++){var _0x3edfb9=events[_0x344532];var _0x212c18=createListener(_0x3de1('0x6')+_0x3edfb9,_0x5627ab);WhatsappInteractionEvents['on'](_0x3edfb9,_0x212c18);}}; \ No newline at end of file +var _0x76c2=['length','whatsappInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x59df9f,_0x4a6dbf){var _0x3aa3fc=function(_0x951ef7){while(--_0x951ef7){_0x59df9f['push'](_0x59df9f['shift']());}};_0x3aa3fc(++_0x4a6dbf);}(_0x76c2,0x182));var _0x276c=function(_0x3b8ed6,_0x3b5bb6){_0x3b8ed6=_0x3b8ed6-0x0;var _0x2e6223=_0x76c2[_0x3b8ed6];return _0x2e6223;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x276c('0x0'),_0x276c('0x1'),_0x276c('0x2')];function createListener(_0x669bf8,_0x391d97){return function(_0x17e5f7){_0x391d97[_0x276c('0x3')](_0x669bf8,_0x17e5f7);};}function removeListener(_0x2e8c63,_0x55fd20){return function(){WhatsappInteractionEvents[_0x276c('0x4')](_0x2e8c63,_0x55fd20);};}exports[_0x276c('0x5')]=function(_0x3fa6bd){for(var _0x2f6cf5=0x0,_0x575e2f=events[_0x276c('0x6')];_0x2f6cf5<_0x575e2f;_0x2f6cf5++){var _0x59ea39=events[_0x2f6cf5];var _0x271643=createListener(_0x276c('0x7')+_0x59ea39,_0x3fa6bd);WhatsappInteractionEvents['on'](_0x59ea39,_0x271643);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f837c11..4b6af64 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 _0xbb56=['/:id','show','whatsapp','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xbb56,0x1b3));var _0x6bb5=function(_0x506853,_0x37bd48){_0x506853=_0x506853-0x0;var _0x262c3c=_0xbb56[_0x506853];return _0x262c3c;};'use strict';var multer=require(_0x6bb5('0x0'));var util=require(_0x6bb5('0x1'));var path=require(_0x6bb5('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bb5('0x3'));var router=express[_0x6bb5('0x4')]();var auth=require(_0x6bb5('0x5'));var interaction=require(_0x6bb5('0x6'));var config=require(_0x6bb5('0x7'));var controller=require(_0x6bb5('0x8'));router[_0x6bb5('0x9')]('/',auth[_0x6bb5('0xa')](),controller[_0x6bb5('0xb')]);router['get'](_0x6bb5('0xc'),auth[_0x6bb5('0xa')](),controller['describe']);router['get'](_0x6bb5('0xd'),auth[_0x6bb5('0xa')](),controller[_0x6bb5('0xe')]);router['post']('/',auth[_0x6bb5('0xa')](),interaction['tracked'](_0x6bb5('0xf'),'whatsappmessage:create'),controller[_0x6bb5('0x10')]);router[_0x6bb5('0x11')](_0x6bb5('0x12'),controller[_0x6bb5('0x13')]);router[_0x6bb5('0x14')](_0x6bb5('0xd'),auth[_0x6bb5('0xa')](),controller[_0x6bb5('0x15')]);router['put'](_0x6bb5('0x16'),auth['isAuthenticated'](),controller[_0x6bb5('0x17')]);router['put'](_0x6bb5('0x18'),auth[_0x6bb5('0xa')](),controller[_0x6bb5('0x19')]);router[_0x6bb5('0x1a')](_0x6bb5('0xd'),auth['isAuthenticated'](),controller[_0x6bb5('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa9cd=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','update','/:id/accept','accept','put','/:id/reject','delete','destroy','exports'];(function(_0x38cdea,_0x864de6){var _0x559f21=function(_0x26e32f){while(--_0x26e32f){_0x38cdea['push'](_0x38cdea['shift']());}};_0x559f21(++_0x864de6);}(_0xa9cd,0xbd));var _0xda9c=function(_0x245a16,_0x511e05){_0x245a16=_0x245a16-0x0;var _0x1f8027=_0xa9cd[_0x245a16];return _0x1f8027;};'use strict';var multer=require(_0xda9c('0x0'));var util=require(_0xda9c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xda9c('0x2'));var interaction=require(_0xda9c('0x3'));var config=require(_0xda9c('0x4'));var controller=require(_0xda9c('0x5'));router['get']('/',auth[_0xda9c('0x6')](),controller[_0xda9c('0x7')]);router[_0xda9c('0x8')](_0xda9c('0x9'),auth[_0xda9c('0x6')](),controller[_0xda9c('0xa')]);router['get'](_0xda9c('0xb'),auth['isAuthenticated'](),controller[_0xda9c('0xc')]);router[_0xda9c('0xd')]('/',auth[_0xda9c('0x6')](),interaction[_0xda9c('0xe')](_0xda9c('0xf'),'whatsappmessage:create'),controller[_0xda9c('0x10')]);router['post'](_0xda9c('0x11'),controller[_0xda9c('0x12')]);router['put'](_0xda9c('0xb'),auth[_0xda9c('0x6')](),controller[_0xda9c('0x13')]);router['put'](_0xda9c('0x14'),auth['isAuthenticated'](),controller[_0xda9c('0x15')]);router[_0xda9c('0x16')](_0xda9c('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0xda9c('0x18')](_0xda9c('0xb'),auth[_0xda9c('0x6')](),controller[_0xda9c('0x19')]);module[_0xda9c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b8a74ab..d3ed088 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 _0xce59=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x134cf2,_0x537e34){var _0x53959a=function(_0x35aed6){while(--_0x35aed6){_0x134cf2['push'](_0x134cf2['shift']());}};_0x53959a(++_0x537e34);}(_0xce59,0x182));var _0x9ce5=function(_0x575add,_0x61bc89){_0x575add=_0x575add-0x0;var _0x31bc87=_0xce59[_0x575add];return _0x31bc87;};'use strict';var Sequelize=require(_0x9ce5('0x0'));module[_0x9ce5('0x1')]={'body':{'type':Sequelize[_0x9ce5('0x2')](_0x9ce5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9ce5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9ce5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9ce5('0x6')]},'readAt':{'type':Sequelize[_0x9ce5('0x7')]},'secret':{'type':Sequelize[_0x9ce5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9ce5('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x987f=['BOOLEAN','ENUM','out','STRING','DATE','exports','medium'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x987f,0x108));var _0xf987=function(_0x105736,_0x141625){_0x105736=_0x105736-0x0;var _0x55178c=_0x987f[_0x105736];return _0x55178c;};'use strict';var Sequelize=require('sequelize');module[_0xf987('0x0')]={'body':{'type':Sequelize['TEXT'](_0xf987('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xf987('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf987('0x3')]('in',_0xf987('0x4')),'defaultValue':_0xf987('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf987('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf987('0x5')]},'readAt':{'type':Sequelize[_0xf987('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf987('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 788b08d..0113d19 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 _0xd052=['../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappMessage.socket','http','client','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','reject','destroy','stack','name','index','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','count','includeAll','include','findAll','params','rawAttributes','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api'];(function(_0x22abc4,_0x3da584){var _0x105e3d=function(_0x442f9e){while(--_0x442f9e){_0x22abc4['push'](_0x22abc4['shift']());}};_0x105e3d(++_0x3da584);}(_0xd052,0x69));var _0x2d05=function(_0x3b4738,_0x4f36bf){_0x3b4738=_0x3b4738-0x0;var _0x3ef663=_0xd052[_0x3b4738];return _0x3ef663;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2d05('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d05('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d05('0x2'));var Mustache=require('mustache');var util=require(_0x2d05('0x3'));var path=require(_0x2d05('0x4'));var sox=require('sox');var csv=require(_0x2d05('0x5'));var ejs=require(_0x2d05('0x6'));var fs=require('fs');var _=require(_0x2d05('0x7'));var squel=require(_0x2d05('0x8'));var crypto=require(_0x2d05('0x9'));var jsforce=require(_0x2d05('0xa'));var deskjs=require(_0x2d05('0xb'));var toCsv=require(_0x2d05('0x5'));var querystring=require(_0x2d05('0xc'));var Papa=require(_0x2d05('0xd'));var Redis=require(_0x2d05('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d05('0xf'));var logger=require(_0x2d05('0x10'))(_0x2d05('0x11'));var utils=require(_0x2d05('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2d05('0x13'));var db=require('../../mysqldb')['db'];config[_0x2d05('0x14')]=_[_0x2d05('0x15')](config[_0x2d05('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d05('0x16'))(new Redis(config[_0x2d05('0x14')]));require(_0x2d05('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2d05('0x18')]({'port':0x232c});var client9002=jayson[_0x2d05('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a68bd,_0x5bf467,_0x5aa559,_0x432102){return new BPromise(function(_0x3eead7,_0x4b02be){var _0x15b13c=_0x432102||client;return _0x15b13c[_0x2d05('0x1a')](_0x2a68bd,_0x5aa559)[_0x2d05('0x1b')](function(_0x336175){logger[_0x2d05('0x1c')]('WhatsappMessage,\x20%s,\x20%s',_0x5bf467,_0x2d05('0x1d'));logger[_0x2d05('0x1e')](_0x2d05('0x1f'),_0x5bf467,'request\x20sent',JSON[_0x2d05('0x20')](_0x336175));if(_0x336175[_0x2d05('0x21')]){if(_0x336175[_0x2d05('0x21')][_0x2d05('0x22')]===0x1f4){logger[_0x2d05('0x21')](_0x2d05('0x23'),_0x5bf467,_0x336175[_0x2d05('0x21')][_0x2d05('0x24')]);return _0x4b02be(_0x336175[_0x2d05('0x21')][_0x2d05('0x24')]);}logger['error'](_0x2d05('0x23'),_0x5bf467,_0x336175[_0x2d05('0x21')][_0x2d05('0x24')]);return _0x3eead7(_0x336175[_0x2d05('0x21')][_0x2d05('0x24')]);}else{logger[_0x2d05('0x1c')](_0x2d05('0x23'),_0x5bf467,_0x2d05('0x1d'));_0x3eead7(_0x336175[_0x2d05('0x25')]['message']);}})[_0x2d05('0x26')](function(_0x13ef22){logger[_0x2d05('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x5bf467,_0x13ef22);_0x4b02be(_0x13ef22);});});}function respondWithStatusCode(_0x5bfcac,_0x48d545){_0x48d545=_0x48d545||0xcc;return function(_0x7ca052){if(_0x7ca052){return _0x5bfcac[_0x2d05('0x27')](_0x48d545);}return _0x5bfcac[_0x2d05('0x28')](_0x48d545)[_0x2d05('0x29')]();};}function respondWithResult(_0x3ce25f,_0x51a90e){_0x51a90e=_0x51a90e||0xc8;return function(_0x1e876c){if(_0x1e876c){return _0x3ce25f['status'](_0x51a90e)[_0x2d05('0x2a')](_0x1e876c);}};}function respondWithFilteredResult(_0x12e82b,_0x2a30be){return function(_0xc9bd97){if(_0xc9bd97){var _0x12869d=_0xc9bd97['count'],_0x350a53=_0x2a30be[_0x2d05('0x2b')],_0x173e72=_0x2a30be[_0x2d05('0x2b')]+_0x2a30be[_0x2d05('0x2c')],_0x19f8bd;if(_0x173e72>=_0x12869d){_0x173e72=_0x12869d;_0x19f8bd=0xc8;}else{_0x19f8bd=0xce;}_0x12e82b[_0x2d05('0x28')](_0x19f8bd);return _0x12e82b['set']('Content-Range',_0x350a53+'-'+_0x173e72+'/'+_0x12869d)['json'](_0xc9bd97);}return null;};}function patchUpdates(_0x5505ab){return function(_0x292648){try{jsonpatch['apply'](_0x292648,_0x5505ab,!![]);}catch(_0x1c7b70){return BPromise[_0x2d05('0x2d')](_0x1c7b70);}return _0x292648['save']();};}function saveUpdates(_0x4eeb9e,_0x1d0c74){return function(_0x34a522){if(_0x34a522){return _0x34a522['update'](_0x4eeb9e)[_0x2d05('0x1b')](function(_0x982df6){return _0x982df6;});}return null;};}function removeEntity(_0xd58221,_0x38fd50){return function(_0x19f641){if(_0x19f641){return _0x19f641[_0x2d05('0x2e')]()[_0x2d05('0x1b')](function(){_0xd58221[_0x2d05('0x28')](0xcc)[_0x2d05('0x29')]();});}};}function handleEntityNotFound(_0x45a5d2,_0x25bf1e){return function(_0x27a025){if(!_0x27a025){_0x45a5d2[_0x2d05('0x27')](0x194);}return _0x27a025;};}function handleError(_0x26c051,_0xb304d3){_0xb304d3=_0xb304d3||0x1f4;return function(_0x591741){logger['error'](_0x591741[_0x2d05('0x2f')]);if(_0x591741[_0x2d05('0x30')]){delete _0x591741[_0x2d05('0x30')];}_0x26c051['status'](_0xb304d3)['send'](_0x591741);};}exports[_0x2d05('0x31')]=function(_0x395ee9,_0x2d4336){var _0x49c577={},_0x1a10bd={},_0x2b7420={'count':0x0,'rows':[]};var _0x41b615=_['map'](db['WhatsappMessage']['rawAttributes'],function(_0x555300){return{'name':_0x555300[_0x2d05('0x32')],'type':_0x555300[_0x2d05('0x33')][_0x2d05('0x34')]};});_0x1a10bd['model']=_[_0x2d05('0x35')](_0x41b615,'name');_0x1a10bd[_0x2d05('0x36')]=_[_0x2d05('0x37')](_0x395ee9[_0x2d05('0x36')]);_0x1a10bd[_0x2d05('0x38')]=_[_0x2d05('0x39')](_0x1a10bd[_0x2d05('0x3a')],_0x1a10bd[_0x2d05('0x36')]);_0x49c577[_0x2d05('0x3b')]=_[_0x2d05('0x39')](_0x1a10bd[_0x2d05('0x3a')],qs[_0x2d05('0x3c')](_0x395ee9[_0x2d05('0x36')]['fields']));_0x49c577[_0x2d05('0x3b')]=_0x49c577[_0x2d05('0x3b')][_0x2d05('0x3d')]?_0x49c577[_0x2d05('0x3b')]:_0x1a10bd[_0x2d05('0x3a')];if(!_0x395ee9[_0x2d05('0x36')][_0x2d05('0x3e')]('nolimit')){_0x49c577['limit']=qs[_0x2d05('0x2c')](_0x395ee9[_0x2d05('0x36')][_0x2d05('0x2c')]);_0x49c577[_0x2d05('0x2b')]=qs[_0x2d05('0x2b')](_0x395ee9[_0x2d05('0x36')][_0x2d05('0x2b')]);}_0x49c577[_0x2d05('0x3f')]=qs[_0x2d05('0x40')](_0x395ee9[_0x2d05('0x36')][_0x2d05('0x40')]);_0x49c577[_0x2d05('0x41')]=qs[_0x2d05('0x38')](_[_0x2d05('0x42')](_0x395ee9['query'],_0x1a10bd[_0x2d05('0x38')]),_0x41b615);if(_0x395ee9[_0x2d05('0x36')][_0x2d05('0x43')]){_0x49c577[_0x2d05('0x41')]=_[_0x2d05('0x44')](_0x49c577['where'],{'$or':_[_0x2d05('0x35')](_0x41b615,function(_0x44628e){if(_0x44628e[_0x2d05('0x33')]!==_0x2d05('0x45')){var _0x15f6b1={};_0x15f6b1[_0x44628e['name']]={'$like':'%'+_0x395ee9[_0x2d05('0x36')]['filter']+'%'};return _0x15f6b1;}})});}_0x49c577=_[_0x2d05('0x44')]({},_0x49c577,_0x395ee9[_0x2d05('0x46')]);var _0x5f20dc={'where':_0x49c577[_0x2d05('0x41')]};return db[_0x2d05('0x47')]['count'](_0x5f20dc)[_0x2d05('0x1b')](function(_0x2d393d){_0x2b7420[_0x2d05('0x48')]=_0x2d393d;if(_0x395ee9['query'][_0x2d05('0x49')]){_0x49c577[_0x2d05('0x4a')]=[{'all':!![]}];}return db[_0x2d05('0x47')][_0x2d05('0x4b')](_0x49c577);})[_0x2d05('0x1b')](function(_0x404fbf){_0x2b7420['rows']=_0x404fbf;return _0x2b7420;})['then'](respondWithFilteredResult(_0x2d4336,_0x49c577))[_0x2d05('0x26')](handleError(_0x2d4336,null));};exports['show']=function(_0x555bf3,_0x4d6238){var _0x44981a={'raw':!![],'where':{'id':_0x555bf3[_0x2d05('0x4c')]['id']}},_0x393c02={};_0x393c02[_0x2d05('0x3a')]=_['keys'](db[_0x2d05('0x47')][_0x2d05('0x4d')]);_0x393c02[_0x2d05('0x36')]=_[_0x2d05('0x37')](_0x555bf3[_0x2d05('0x36')]);_0x393c02[_0x2d05('0x38')]=_['intersection'](_0x393c02[_0x2d05('0x3a')],_0x393c02['query']);_0x44981a['attributes']=_['intersection'](_0x393c02['model'],qs[_0x2d05('0x3c')](_0x555bf3['query']['fields']));_0x44981a[_0x2d05('0x3b')]=_0x44981a[_0x2d05('0x3b')][_0x2d05('0x3d')]?_0x44981a[_0x2d05('0x3b')]:_0x393c02[_0x2d05('0x3a')];if(_0x555bf3[_0x2d05('0x36')][_0x2d05('0x49')]){_0x44981a['include']=[{'all':!![]}];}_0x44981a=_[_0x2d05('0x44')]({},_0x44981a,_0x555bf3[_0x2d05('0x46')]);return db[_0x2d05('0x47')][_0x2d05('0x4e')](_0x44981a)['then'](handleEntityNotFound(_0x4d6238,null))[_0x2d05('0x1b')](respondWithResult(_0x4d6238,null))[_0x2d05('0x26')](handleError(_0x4d6238,null));};exports[_0x2d05('0x4f')]=function(_0x5880a7,_0x374255){return db[_0x2d05('0x47')][_0x2d05('0x4f')](_0x5880a7['body'],{})[_0x2d05('0x1b')](respondWithResult(_0x374255,0xc9))[_0x2d05('0x26')](handleError(_0x374255,null));};exports[_0x2d05('0x50')]=function(_0x368fcc,_0x599fbb){if(_0x368fcc[_0x2d05('0x51')]['id']){delete _0x368fcc[_0x2d05('0x51')]['id'];}return db[_0x2d05('0x47')][_0x2d05('0x4e')]({'where':{'id':_0x368fcc[_0x2d05('0x4c')]['id']}})[_0x2d05('0x1b')](handleEntityNotFound(_0x599fbb,null))[_0x2d05('0x1b')](saveUpdates(_0x368fcc[_0x2d05('0x51')],null))[_0x2d05('0x1b')](respondWithResult(_0x599fbb,null))[_0x2d05('0x26')](handleError(_0x599fbb,null));};exports[_0x2d05('0x2e')]=function(_0x310e0b,_0x149395){return db['WhatsappMessage'][_0x2d05('0x4e')]({'where':{'id':_0x310e0b['params']['id']}})[_0x2d05('0x1b')](handleEntityNotFound(_0x149395,null))[_0x2d05('0x1b')](removeEntity(_0x149395,null))[_0x2d05('0x26')](handleError(_0x149395,null));};exports[_0x2d05('0x52')]=function(_0x24c37a,_0x9fde21){return db[_0x2d05('0x47')][_0x2d05('0x52')]()[_0x2d05('0x1b')](respondWithResult(_0x9fde21,null))[_0x2d05('0x26')](handleError(_0x9fde21,null));};var interaction_log=require('../../config/logger')(_0x2d05('0x53'));exports[_0x2d05('0x54')]=function(_0x384960,_0xc92a13,_0x21f045){var _0xfbaf66={'agent':{},'channel':_0x2d05('0x55')};if(_0x384960['body']['id']){delete _0x384960[_0x2d05('0x51')]['id'];}_0x384960[_0x2d05('0x51')][_0x2d05('0x56')]=!![];_0x384960[_0x2d05('0x51')][_0x2d05('0x57')]=moment()[_0x2d05('0x58')](_0x2d05('0x59'));_0x384960[_0x2d05('0x51')][_0x2d05('0x5a')]=_0x384960['body']['UserId']||_0x384960[_0x2d05('0x5b')]['id'];_0xfbaf66[_0x2d05('0x5c')]['id']=_0x384960[_0x2d05('0x51')][_0x2d05('0x5a')];return db['WhatsappMessage']['find']({'where':{'id':_0x384960['params']['id'],'UserId':null},'include':[{'model':db[_0x2d05('0x5d')],'as':_0x2d05('0x5e')}]})[_0x2d05('0x1b')](handleEntityNotFound(_0xc92a13,null))['then'](saveUpdates(_0x384960[_0x2d05('0x51')],null))[_0x2d05('0x1b')](function(_0x5c68eb){if(_0x5c68eb){_0xfbaf66['message']=_0x5c68eb[_0x2d05('0x5f')]({'plain':!![]});return db[_0x2d05('0x60')][_0x2d05('0x4e')]({'where':{'id':_0x5c68eb['WhatsappInteractionId']}});}return null;})[_0x2d05('0x1b')](handleEntityNotFound(_0xc92a13,null))[_0x2d05('0x1b')](function(_0x3bcbb7){if(_0x3bcbb7){return _0x3bcbb7[_0x2d05('0x50')]({'UserId':_0x384960[_0x2d05('0x51')]['UserId'],'read1stAt':_[_0x2d05('0x61')](_0x3bcbb7[_0x2d05('0x62')])?moment()[_0x2d05('0x58')](_0x2d05('0x59')):undefined});}return null;})[_0x2d05('0x1b')](function(_0x8da244){if(_0x8da244){_0xfbaf66[_0x2d05('0x63')]=_0x8da244[_0x2d05('0x5f')]({'plain':!![]});interaction_log[_0x2d05('0x1c')](_0x2d05('0x64'),_0x384960[_0x2d05('0x5b')]['id'],_0x384960[_0x2d05('0x5b')][_0x2d05('0x30')],_0x384960[_0x2d05('0x5b')][_0x2d05('0x65')],_0xfbaf66[_0x2d05('0x63')]['id'],_0x384960['body']?JSON[_0x2d05('0x20')](_0x384960['body']):'null');return respondWithRpcPromise(_0x2d05('0x66'),_0x2d05('0x67'),_0xfbaf66);}return null;})['then'](function(_0x4e3f46){if(_0x4e3f46){if(_0x384960[_0x2d05('0x51')][_0x2d05('0x68')]){_0xfbaf66[_0x2d05('0x24')][_0x2d05('0x69')]=util[_0x2d05('0x58')](_0x2d05('0x6a'),_0x384960['user'][_0x2d05('0x30')]);_0xfbaf66[_0x2d05('0x24')]['channel']=_0xfbaf66['channel'];_0xfbaf66[_0x2d05('0x24')][_0x2d05('0x6b')]=_0x2d05('0x54');return respondWithRpcPromise(_0x2d05('0x6c'),_0x2d05('0x6c'),{'event':_0x2d05('0x6d'),'message':_0xfbaf66[_0x2d05('0x24')]},client9002)['then'](function(){return _0xfbaf66;});}return _0xfbaf66;}return null;})['then'](respondWithResult(_0xc92a13,null))[_0x2d05('0x26')](handleError(_0xc92a13,null));};var interaction_log=require(_0x2d05('0x10'))(_0x2d05('0x53'));exports[_0x2d05('0x2d')]=function(_0x3a60bf,_0x4d8d2d,_0xc3d542){var _0x4187c4={'agent':{},'channel':_0x2d05('0x55')};if(_0x3a60bf[_0x2d05('0x51')]['id']){delete _0x3a60bf[_0x2d05('0x51')]['id'];}_0x3a60bf[_0x2d05('0x51')]['UserId']=_0x3a60bf['body'][_0x2d05('0x5a')]||_0x3a60bf[_0x2d05('0x5b')]['id'];_0x4187c4[_0x2d05('0x5c')]['id']=_0x3a60bf[_0x2d05('0x51')]['UserId'];return db[_0x2d05('0x47')][_0x2d05('0x4e')]({'where':{'id':_0x3a60bf['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d8d2d,null))['then'](function(_0x5a9b0e){if(_0x5a9b0e){_0x4187c4['message']=_0x5a9b0e[_0x2d05('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0x2d05('0x4e')]({'where':{'id':_0x5a9b0e[_0x2d05('0x6e')]}});}return null;})[_0x2d05('0x1b')](handleEntityNotFound(_0x4d8d2d,null))[_0x2d05('0x1b')](function(_0x21981d){if(_0x21981d){_0x4187c4[_0x2d05('0x63')]=_0x21981d['get']({'plain':!![]});interaction_log[_0x2d05('0x1c')](_0x2d05('0x6f'),_0x3a60bf[_0x2d05('0x5b')]['id'],_0x3a60bf[_0x2d05('0x5b')]['name'],_0x3a60bf[_0x2d05('0x5b')]['role'],_0x4187c4['interaction']['id'],_0x3a60bf[_0x2d05('0x51')]?JSON[_0x2d05('0x20')](_0x3a60bf['body']):'null');return respondWithRpcPromise(_0x2d05('0x70'),_0x2d05('0x71'),_0x4187c4);}return null;})[_0x2d05('0x1b')](function(_0x53a9f5){if(_0x53a9f5){_0x53a9f5['message'][_0x2d05('0x69')]=util['format'](_0x2d05('0x6a'),_0x3a60bf[_0x2d05('0x5b')][_0x2d05('0x30')]);_0x53a9f5[_0x2d05('0x24')][_0x2d05('0x72')]=_0x4187c4['channel'];_0x53a9f5[_0x2d05('0x24')][_0x2d05('0x6b')]=_0x2d05('0x2d');respondWithRpcPromise(_0x2d05('0x6c'),'EventManager',{'event':_0x2d05('0x73'),'message':_0x53a9f5['message']},client9002);return _0x4187c4;}return null;})[_0x2d05('0x1b')](respondWithResult(_0x4d8d2d,null))['catch'](handleError(_0x4d8d2d,null));};exports['status']=function(_0x523008,_0xbe8093,_0x3cbcbd){if(_0x523008[_0x2d05('0x51')]['id']){delete _0x523008[_0x2d05('0x51')]['id'];}var _0x432902;return db['WhatsappMessage'][_0x2d05('0x4e')]({'where':{'id':_0x523008[_0x2d05('0x4c')]['id']}})[_0x2d05('0x1b')](handleEntityNotFound(_0xbe8093,null))[_0x2d05('0x1b')](function(_0x458408){if(_0x458408){_0x432902=_0x458408;return db['WhatsappAccount'][_0x2d05('0x4e')]({'where':{'id':_0x458408['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0xbe8093,null))[_0x2d05('0x1b')](function(_0x11c40e){if(_0x11c40e){logger['debug'](_0x2d05('0x74'),'status',_0x2d05('0x75'),_0x11c40e[_0x2d05('0x33')],util[_0x2d05('0x76')](_0x523008[_0x2d05('0x51')],{'showHidden':![],'depth':null}));switch(_0x11c40e[_0x2d05('0x33')]){case _0x2d05('0x77'):if(_0x523008[_0x2d05('0x51')]['MessageSid']&&_0x523008[_0x2d05('0x51')]['MessageSid']===_0x432902[_0x2d05('0x78')]&&_0x523008[_0x2d05('0x51')][_0x2d05('0x79')]&&_0x523008[_0x2d05('0x51')][_0x2d05('0x79')]===_0x2d05('0x56')){return _0x432902[_0x2d05('0x50')]({'read':!![]});}else{logger['error'](_0x2d05('0x7a'),'status',_0x2d05('0x77'),util[_0x2d05('0x76')](_0x523008[_0x2d05('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x432902;}})[_0x2d05('0x1b')](respondWithResult(_0xbe8093,null))[_0x2d05('0x26')](handleError(_0xbe8093,null));}; \ No newline at end of file +var _0x500c=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','WhatsappMessage','fieldName','type','key','model','map','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','keys','rawAttributes','intersection','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','Contact','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteraction','WhatsappInteractionId','RejectMessage','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','html-pdf'];(function(_0x37e560,_0x30b109){var _0x5baf5c=function(_0x3ce94b){while(--_0x3ce94b){_0x37e560['push'](_0x37e560['shift']());}};_0x5baf5c(++_0x30b109);}(_0x500c,0x188));var _0xc500=function(_0x25a7c5,_0x3d5c81){_0x25a7c5=_0x25a7c5-0x0;var _0x386f07=_0x500c[_0x25a7c5];return _0x386f07;};'use strict';var pdf=require(_0xc500('0x0'));var emlformat=require(_0xc500('0x1'));var rimraf=require(_0xc500('0x2'));var zipdir=require(_0xc500('0x3'));var jsonpatch=require(_0xc500('0x4'));var rp=require(_0xc500('0x5'));var moment=require(_0xc500('0x6'));var BPromise=require(_0xc500('0x7'));var Mustache=require(_0xc500('0x8'));var util=require(_0xc500('0x9'));var path=require(_0xc500('0xa'));var sox=require(_0xc500('0xb'));var csv=require(_0xc500('0xc'));var ejs=require(_0xc500('0xd'));var fs=require('fs');var _=require(_0xc500('0xe'));var squel=require('squel');var crypto=require(_0xc500('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc500('0x10'));var toCsv=require(_0xc500('0xc'));var querystring=require(_0xc500('0x11'));var Papa=require(_0xc500('0x12'));var Redis=require(_0xc500('0x13'));var authService=require(_0xc500('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc500('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc500('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc500('0x17'));var licenseUtil=require(_0xc500('0x18'));var db=require('../../mysqldb')['db'];config[_0xc500('0x19')]=_[_0xc500('0x1a')](config[_0xc500('0x19')],{'host':_0xc500('0x1b'),'port':0x18eb});var socket=require(_0xc500('0x1c'))(new Redis(config[_0xc500('0x19')]));require(_0xc500('0x1d'))[_0xc500('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc500('0x1f')][_0xc500('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xc500('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x291767,_0x387d54,_0x286ae3,_0x2e53a1){return new BPromise(function(_0x369271,_0x3e020a){var _0x4c1aed=_0x2e53a1||client;return _0x4c1aed[_0xc500('0x21')](_0x291767,_0x286ae3)[_0xc500('0x22')](function(_0x3ca6a8){logger[_0xc500('0x23')](_0xc500('0x24'),_0x387d54,_0xc500('0x25'));logger[_0xc500('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x387d54,'request\x20sent',JSON['stringify'](_0x3ca6a8));if(_0x3ca6a8[_0xc500('0x27')]){if(_0x3ca6a8['error'][_0xc500('0x28')]===0x1f4){logger[_0xc500('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x387d54,_0x3ca6a8[_0xc500('0x27')]['message']);return _0x3e020a(_0x3ca6a8['error'][_0xc500('0x29')]);}logger['error'](_0xc500('0x24'),_0x387d54,_0x3ca6a8['error']['message']);return _0x369271(_0x3ca6a8[_0xc500('0x27')][_0xc500('0x29')]);}else{logger[_0xc500('0x23')](_0xc500('0x24'),_0x387d54,_0xc500('0x25'));_0x369271(_0x3ca6a8[_0xc500('0x2a')][_0xc500('0x29')]);}})[_0xc500('0x2b')](function(_0x24a3db){logger[_0xc500('0x27')](_0xc500('0x24'),_0x387d54,_0x24a3db);_0x3e020a(_0x24a3db);});});}function respondWithStatusCode(_0x344962,_0x2ac2e5){_0x2ac2e5=_0x2ac2e5||0xcc;return function(_0x4c62d0){if(_0x4c62d0){return _0x344962[_0xc500('0x2c')](_0x2ac2e5);}return _0x344962['status'](_0x2ac2e5)[_0xc500('0x2d')]();};}function respondWithResult(_0xf77f5,_0x859b8e){_0x859b8e=_0x859b8e||0xc8;return function(_0x27fd0f){if(_0x27fd0f){return _0xf77f5[_0xc500('0x2e')](_0x859b8e)[_0xc500('0x2f')](_0x27fd0f);}};}function respondWithFilteredResult(_0x5a8314,_0x3f20fc){return function(_0x3560ca){if(_0x3560ca){var _0x235e96=_0x3560ca[_0xc500('0x30')],_0x2f1911=_0x3f20fc[_0xc500('0x31')],_0x5b270f=_0x3f20fc[_0xc500('0x31')]+_0x3f20fc[_0xc500('0x32')],_0x10ec93;if(_0x5b270f>=_0x235e96){_0x5b270f=_0x235e96;_0x10ec93=0xc8;}else{_0x10ec93=0xce;}_0x5a8314[_0xc500('0x2e')](_0x10ec93);return _0x5a8314[_0xc500('0x33')](_0xc500('0x34'),_0x2f1911+'-'+_0x5b270f+'/'+_0x235e96)[_0xc500('0x2f')](_0x3560ca);}return null;};}function patchUpdates(_0x3e9e4d){return function(_0x36f35c){try{jsonpatch[_0xc500('0x35')](_0x36f35c,_0x3e9e4d,!![]);}catch(_0x3b8bcf){return BPromise[_0xc500('0x36')](_0x3b8bcf);}return _0x36f35c[_0xc500('0x37')]();};}function saveUpdates(_0x1c7a3e,_0x1b6372){return function(_0x3b1991){if(_0x3b1991){return _0x3b1991[_0xc500('0x38')](_0x1c7a3e)['then'](function(_0x455453){return _0x455453;});}return null;};}function removeEntity(_0x3949e1,_0x441d31){return function(_0x404083){if(_0x404083){return _0x404083['destroy']()[_0xc500('0x22')](function(){_0x3949e1['status'](0xcc)[_0xc500('0x2d')]();});}};}function handleEntityNotFound(_0x2435d7,_0x98e96c){return function(_0x13b4b0){if(!_0x13b4b0){_0x2435d7['sendStatus'](0x194);}return _0x13b4b0;};}function handleError(_0x127d84,_0x50b006){_0x50b006=_0x50b006||0x1f4;return function(_0x3b603b){logger[_0xc500('0x27')](_0x3b603b['stack']);if(_0x3b603b[_0xc500('0x39')]){delete _0x3b603b[_0xc500('0x39')];}_0x127d84['status'](_0x50b006)[_0xc500('0x3a')](_0x3b603b);};}exports[_0xc500('0x3b')]=function(_0x5e677c,_0x47d8e7){var _0x2558dc={},_0x53aab7={},_0x2b516e={'count':0x0,'rows':[]};var _0x13cda6=_['map'](db[_0xc500('0x3c')]['rawAttributes'],function(_0x3c776d){return{'name':_0x3c776d[_0xc500('0x3d')],'type':_0x3c776d[_0xc500('0x3e')][_0xc500('0x3f')]};});_0x53aab7[_0xc500('0x40')]=_[_0xc500('0x41')](_0x13cda6,_0xc500('0x39'));_0x53aab7[_0xc500('0x42')]=_['keys'](_0x5e677c[_0xc500('0x42')]);_0x53aab7['filters']=_['intersection'](_0x53aab7[_0xc500('0x40')],_0x53aab7[_0xc500('0x42')]);_0x2558dc['attributes']=_['intersection'](_0x53aab7[_0xc500('0x40')],qs[_0xc500('0x43')](_0x5e677c[_0xc500('0x42')][_0xc500('0x43')]));_0x2558dc[_0xc500('0x44')]=_0x2558dc[_0xc500('0x44')][_0xc500('0x45')]?_0x2558dc[_0xc500('0x44')]:_0x53aab7[_0xc500('0x40')];if(!_0x5e677c[_0xc500('0x42')][_0xc500('0x46')](_0xc500('0x47'))){_0x2558dc[_0xc500('0x32')]=qs[_0xc500('0x32')](_0x5e677c[_0xc500('0x42')]['limit']);_0x2558dc['offset']=qs[_0xc500('0x31')](_0x5e677c[_0xc500('0x42')][_0xc500('0x31')]);}_0x2558dc[_0xc500('0x48')]=qs[_0xc500('0x49')](_0x5e677c[_0xc500('0x42')][_0xc500('0x49')]);_0x2558dc[_0xc500('0x4a')]=qs[_0xc500('0x4b')](_[_0xc500('0x4c')](_0x5e677c['query'],_0x53aab7[_0xc500('0x4b')]),_0x13cda6);if(_0x5e677c[_0xc500('0x42')][_0xc500('0x4d')]){_0x2558dc['where']=_['merge'](_0x2558dc[_0xc500('0x4a')],{'$or':_[_0xc500('0x41')](_0x13cda6,function(_0x4ed9b6){if(_0x4ed9b6[_0xc500('0x3e')]!==_0xc500('0x4e')){var _0x2a2faa={};_0x2a2faa[_0x4ed9b6['name']]={'$like':'%'+_0x5e677c['query'][_0xc500('0x4d')]+'%'};return _0x2a2faa;}})});}_0x2558dc=_[_0xc500('0x4f')]({},_0x2558dc,_0x5e677c[_0xc500('0x50')]);var _0x27cd6e={'where':_0x2558dc[_0xc500('0x4a')]};return db['WhatsappMessage'][_0xc500('0x30')](_0x27cd6e)['then'](function(_0x15e3c8){_0x2b516e['count']=_0x15e3c8;if(_0x5e677c[_0xc500('0x42')][_0xc500('0x51')]){_0x2558dc[_0xc500('0x52')]=[{'all':!![]}];}return db[_0xc500('0x3c')][_0xc500('0x53')](_0x2558dc);})[_0xc500('0x22')](function(_0x31f690){_0x2b516e[_0xc500('0x54')]=_0x31f690;return _0x2b516e;})[_0xc500('0x22')](respondWithFilteredResult(_0x47d8e7,_0x2558dc))[_0xc500('0x2b')](handleError(_0x47d8e7,null));};exports['show']=function(_0x9ffc1a,_0x855462){var _0x51a34c={'raw':!![],'where':{'id':_0x9ffc1a['params']['id']}},_0x15c427={};_0x15c427['model']=_[_0xc500('0x55')](db[_0xc500('0x3c')][_0xc500('0x56')]);_0x15c427['query']=_[_0xc500('0x55')](_0x9ffc1a[_0xc500('0x42')]);_0x15c427[_0xc500('0x4b')]=_['intersection'](_0x15c427['model'],_0x15c427[_0xc500('0x42')]);_0x51a34c[_0xc500('0x44')]=_[_0xc500('0x57')](_0x15c427[_0xc500('0x40')],qs['fields'](_0x9ffc1a[_0xc500('0x42')][_0xc500('0x43')]));_0x51a34c[_0xc500('0x44')]=_0x51a34c[_0xc500('0x44')]['length']?_0x51a34c[_0xc500('0x44')]:_0x15c427[_0xc500('0x40')];if(_0x9ffc1a[_0xc500('0x42')][_0xc500('0x51')]){_0x51a34c['include']=[{'all':!![]}];}_0x51a34c=_[_0xc500('0x4f')]({},_0x51a34c,_0x9ffc1a[_0xc500('0x50')]);return db[_0xc500('0x3c')]['find'](_0x51a34c)[_0xc500('0x22')](handleEntityNotFound(_0x855462,null))[_0xc500('0x22')](respondWithResult(_0x855462,null))[_0xc500('0x2b')](handleError(_0x855462,null));};exports[_0xc500('0x58')]=function(_0x2d5bf9,_0x2b5033){return db['WhatsappMessage'][_0xc500('0x58')](_0x2d5bf9[_0xc500('0x59')],{})[_0xc500('0x22')](respondWithResult(_0x2b5033,0xc9))[_0xc500('0x2b')](handleError(_0x2b5033,null));};exports['update']=function(_0x510ae7,_0x460d0c){if(_0x510ae7['body']['id']){delete _0x510ae7[_0xc500('0x59')]['id'];}return db[_0xc500('0x3c')][_0xc500('0x5a')]({'where':{'id':_0x510ae7[_0xc500('0x5b')]['id']}})[_0xc500('0x22')](handleEntityNotFound(_0x460d0c,null))[_0xc500('0x22')](saveUpdates(_0x510ae7[_0xc500('0x59')],null))['then'](respondWithResult(_0x460d0c,null))[_0xc500('0x2b')](handleError(_0x460d0c,null));};exports['destroy']=function(_0x26e638,_0x3d2934){return db['WhatsappMessage'][_0xc500('0x5a')]({'where':{'id':_0x26e638[_0xc500('0x5b')]['id']}})[_0xc500('0x22')](handleEntityNotFound(_0x3d2934,null))[_0xc500('0x22')](removeEntity(_0x3d2934,null))['catch'](handleError(_0x3d2934,null));};exports[_0xc500('0x5c')]=function(_0x2e6c92,_0x2ca3ca){return db[_0xc500('0x3c')][_0xc500('0x5c')]()['then'](respondWithResult(_0x2ca3ca,null))[_0xc500('0x2b')](handleError(_0x2ca3ca,null));};var interaction_log=require(_0xc500('0x16'))(_0xc500('0x5d'));exports[_0xc500('0x5e')]=function(_0x52f6b3,_0x24247e,_0x3acde9){var _0x398064={'agent':{},'channel':_0xc500('0x5f')};if(_0x52f6b3[_0xc500('0x59')]['id']){delete _0x52f6b3[_0xc500('0x59')]['id'];}_0x52f6b3[_0xc500('0x59')][_0xc500('0x60')]=!![];_0x52f6b3['body'][_0xc500('0x61')]=moment()['format'](_0xc500('0x62'));_0x52f6b3[_0xc500('0x59')]['UserId']=_0x52f6b3['body']['UserId']||_0x52f6b3[_0xc500('0x63')]['id'];_0x398064[_0xc500('0x64')]['id']=_0x52f6b3[_0xc500('0x59')][_0xc500('0x65')];return db[_0xc500('0x3c')][_0xc500('0x5a')]({'where':{'id':_0x52f6b3['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc500('0x66')}]})[_0xc500('0x22')](handleEntityNotFound(_0x24247e,null))[_0xc500('0x22')](saveUpdates(_0x52f6b3[_0xc500('0x59')],null))['then'](function(_0x5eab12){if(_0x5eab12){_0x398064[_0xc500('0x29')]=_0x5eab12[_0xc500('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x5eab12['WhatsappInteractionId']}});}return null;})[_0xc500('0x22')](handleEntityNotFound(_0x24247e,null))['then'](function(_0x384da9){if(_0x384da9){return _0x384da9['update']({'UserId':_0x52f6b3[_0xc500('0x59')][_0xc500('0x65')],'read1stAt':_[_0xc500('0x68')](_0x384da9[_0xc500('0x69')])?moment()['format'](_0xc500('0x62')):undefined});}return null;})[_0xc500('0x22')](function(_0x41fdd1){if(_0x41fdd1){_0x398064[_0xc500('0x6a')]=_0x41fdd1['get']({'plain':!![]});interaction_log[_0xc500('0x23')](_0xc500('0x6b'),_0x52f6b3[_0xc500('0x63')]['id'],_0x52f6b3[_0xc500('0x63')]['name'],_0x52f6b3[_0xc500('0x63')][_0xc500('0x6c')],_0x398064[_0xc500('0x6a')]['id'],_0x52f6b3[_0xc500('0x59')]?JSON[_0xc500('0x6d')](_0x52f6b3[_0xc500('0x59')]):_0xc500('0x6e'));return respondWithRpcPromise(_0xc500('0x6f'),_0xc500('0x70'),_0x398064);}return null;})['then'](function(_0x40f068){if(_0x40f068){if(_0x52f6b3[_0xc500('0x59')]['manual']){_0x398064[_0xc500('0x29')][_0xc500('0x71')]=util[_0xc500('0x72')](_0xc500('0x73'),_0x52f6b3[_0xc500('0x63')][_0xc500('0x39')]);_0x398064[_0xc500('0x29')][_0xc500('0x74')]=_0x398064[_0xc500('0x74')];_0x398064['message'][_0xc500('0x75')]=_0xc500('0x5e');return respondWithRpcPromise(_0xc500('0x76'),_0xc500('0x76'),{'event':_0xc500('0x77'),'message':_0x398064[_0xc500('0x29')]},client9002)[_0xc500('0x22')](function(){return _0x398064;});}return _0x398064;}return null;})[_0xc500('0x22')](respondWithResult(_0x24247e,null))[_0xc500('0x2b')](handleError(_0x24247e,null));};var interaction_log=require(_0xc500('0x16'))(_0xc500('0x5d'));exports[_0xc500('0x36')]=function(_0x2e5423,_0x28847e,_0x4bc7c6){var _0x2a69b3={'agent':{},'channel':_0xc500('0x5f')};if(_0x2e5423['body']['id']){delete _0x2e5423[_0xc500('0x59')]['id'];}_0x2e5423[_0xc500('0x59')][_0xc500('0x65')]=_0x2e5423['body'][_0xc500('0x65')]||_0x2e5423[_0xc500('0x63')]['id'];_0x2a69b3[_0xc500('0x64')]['id']=_0x2e5423[_0xc500('0x59')]['UserId'];return db[_0xc500('0x3c')][_0xc500('0x5a')]({'where':{'id':_0x2e5423[_0xc500('0x5b')]['id'],'UserId':null}})[_0xc500('0x22')](handleEntityNotFound(_0x28847e,null))['then'](function(_0x2d5276){if(_0x2d5276){_0x2a69b3[_0xc500('0x29')]=_0x2d5276[_0xc500('0x67')]({'plain':!![]});return db[_0xc500('0x78')]['find']({'where':{'id':_0x2d5276[_0xc500('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x28847e,null))[_0xc500('0x22')](function(_0x127861){if(_0x127861){_0x2a69b3[_0xc500('0x6a')]=_0x127861[_0xc500('0x67')]({'plain':!![]});interaction_log[_0xc500('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e5423[_0xc500('0x63')]['id'],_0x2e5423[_0xc500('0x63')][_0xc500('0x39')],_0x2e5423[_0xc500('0x63')][_0xc500('0x6c')],_0x2a69b3[_0xc500('0x6a')]['id'],_0x2e5423['body']?JSON[_0xc500('0x6d')](_0x2e5423[_0xc500('0x59')]):_0xc500('0x6e'));return respondWithRpcPromise(_0xc500('0x7a'),'rejectMessage',_0x2a69b3);}return null;})[_0xc500('0x22')](function(_0x2fdb88){if(_0x2fdb88){_0x2fdb88[_0xc500('0x29')][_0xc500('0x71')]=util[_0xc500('0x72')](_0xc500('0x73'),_0x2e5423[_0xc500('0x63')][_0xc500('0x39')]);_0x2fdb88[_0xc500('0x29')][_0xc500('0x74')]=_0x2a69b3[_0xc500('0x74')];_0x2fdb88[_0xc500('0x29')]['event']=_0xc500('0x36');respondWithRpcPromise(_0xc500('0x76'),'EventManager',{'event':_0xc500('0x7b'),'message':_0x2fdb88['message']},client9002);return _0x2a69b3;}return null;})[_0xc500('0x22')](respondWithResult(_0x28847e,null))['catch'](handleError(_0x28847e,null));};exports['status']=function(_0x4dfb58,_0x2f7609,_0x4d3b2b){if(_0x4dfb58[_0xc500('0x59')]['id']){delete _0x4dfb58[_0xc500('0x59')]['id'];}var _0x6a7a28;return db[_0xc500('0x3c')][_0xc500('0x5a')]({'where':{'id':_0x4dfb58[_0xc500('0x5b')]['id']}})[_0xc500('0x22')](handleEntityNotFound(_0x2f7609,null))[_0xc500('0x22')](function(_0x23373b){if(_0x23373b){_0x6a7a28=_0x23373b;return db['WhatsappAccount'][_0xc500('0x5a')]({'where':{'id':_0x23373b['WhatsappAccountId']}});}})[_0xc500('0x22')](handleEntityNotFound(_0x2f7609,null))[_0xc500('0x22')](function(_0x5ad05d){if(_0x5ad05d){logger[_0xc500('0x26')](_0xc500('0x7c'),_0xc500('0x2e'),_0xc500('0x7d'),_0x5ad05d['type'],util[_0xc500('0x7e')](_0x4dfb58[_0xc500('0x59')],{'showHidden':![],'depth':null}));switch(_0x5ad05d['type']){case _0xc500('0x7f'):if(_0x4dfb58['body'][_0xc500('0x80')]&&_0x4dfb58['body'][_0xc500('0x80')]===_0x6a7a28[_0xc500('0x81')]&&_0x4dfb58['body'][_0xc500('0x82')]&&_0x4dfb58['body'][_0xc500('0x82')]===_0xc500('0x60')){return _0x6a7a28[_0xc500('0x38')]({'read':!![]});}else{logger[_0xc500('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xc500('0x2e'),'twilio',util[_0xc500('0x7e')](_0x4dfb58[_0xc500('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x6a7a28;}})[_0xc500('0x22')](respondWithResult(_0x2f7609,null))[_0xc500('0x2b')](handleError(_0x2f7609,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 23f5ee7..11c6d5b 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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3193b5,_0x2d5069){var _0x49d36d=function(_0x289490){while(--_0x289490){_0x3193b5['push'](_0x3193b5['shift']());}};_0x49d36d(++_0x2d5069);}(_0x7a54,0x106));var _0x47a5=function(_0x3009d6,_0x1128e6){_0x3009d6=_0x3009d6-0x0;var _0x10ee5=_0x7a54[_0x3009d6];return _0x10ee5;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3ab48a,_0x9bd1c7){var _0x2cfb46=function(_0x56e7e1){while(--_0x56e7e1){_0x3ab48a['push'](_0x3ab48a['shift']());}};_0x2cfb46(++_0x9bd1c7);}(_0x7a54,0x106));var _0x47a5=function(_0x361c31,_0xa7dd62){_0x361c31=_0x361c31-0x0;var _0x5adadc=_0x7a54[_0x361c31];return _0x5adadc;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c589fef..0e94c9e 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 _0x0b33=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','secret','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','direction','toLowerCase','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','then','sid'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x0b33,0xfa));var _0x30b3=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0x0b33[_0x2ff762];return _0x158b02;};'use strict';var _=require('lodash');var util=require(_0x30b3('0x0'));var logger=require(_0x30b3('0x1'))('api');var moment=require(_0x30b3('0x2'));var BPromise=require('bluebird');var rp=require(_0x30b3('0x3'));var fs=require('fs');var path=require(_0x30b3('0x4'));var rimraf=require(_0x30b3('0x5'));var config=require('../../config/environment');var attributes=require(_0x30b3('0x6'));module[_0x30b3('0x7')]=function(_0x4fabe2,_0x829e15){return _0x4fabe2[_0x30b3('0x8')](_0x30b3('0x9'),attributes,{'tableName':_0x30b3('0xa'),'paranoid':![],'indexes':[{'name':_0x30b3('0xb'),'fields':['messageId']},{'name':_0x30b3('0xc'),'fields':[_0x30b3('0xd')],'type':_0x30b3('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e9718,_0x4beee6,_0x5c7d09){var _0x2f40bd=_0x4fabe2[_0x30b3('0xf')];var _0x3dd207=_0x5e9718[_0x30b3('0x10')]({'plain':!![]});if(_0x3dd207['direction']['toLowerCase']()==='in'||_0x3dd207['direction']['toLowerCase']()==='out'&&!_0x3dd207[_0x30b3('0x11')]&&!_['isNil'](_0x3dd207['UserId'])){_0x2f40bd[_0x30b3('0x12')][_0x30b3('0x13')]({'where':{'id':_0x3dd207[_0x30b3('0x14')]}})['then'](function(_0x576361){if(_0x576361){_0x576361[_0x30b3('0x15')]({'lastMsgAt':_0x3dd207[_0x30b3('0x16')],'lastMsgDirection':_0x3dd207[_0x30b3('0x17')][_0x30b3('0x18')]()});}})[_0x30b3('0x19')](function(_0x4b33f0){console[_0x30b3('0x1a')](_0x4b33f0);});}if(_0x3dd207[_0x30b3('0x17')]===_0x30b3('0x1b')&&!_0x3dd207['secret']){var _0xa56c5b;_0x2f40bd[_0x30b3('0x1c')][_0x30b3('0x1d')]({'where':{'id':_0x3dd207[_0x30b3('0x1e')]},'raw':!![]})['then'](function(_0x22494c){_0xa56c5b=_0x22494c;if(_0xa56c5b&&_0xa56c5b[_0x30b3('0x1f')]){switch(_0xa56c5b[_0x30b3('0x1f')]){case _0x30b3('0x20'):var _0x3e980e=require('twilio');if(_0xa56c5b[_0x30b3('0x21')]&&_0xa56c5b[_0x30b3('0x22')]&&_0xa56c5b[_0x30b3('0x23')]){var _0x1fe87f=new _0x3e980e(_0xa56c5b['accountSid'],_0xa56c5b[_0x30b3('0x22')]);_0x1fe87f[_0x30b3('0x24')][_0x30b3('0x25')]({'body':_0x3dd207['body'],'to':_0x30b3('0x26')+_0x3dd207[_0x30b3('0x23')],'from':'whatsapp:'+_0xa56c5b['phone'],'statusCallback':_0xa56c5b[_0x30b3('0x27')]+_0x30b3('0x28')+_0x3dd207['id']+_0x30b3('0x29')+_0xa56c5b['token']})[_0x30b3('0x2a')](function(_0x3c8586){if(_0x3c8586['sid']){return _0x5e9718[_0x30b3('0x15')]({'messageId':_0x3c8586[_0x30b3('0x2b')]});}})[_0x30b3('0x19')](function(_0x32046a){logger['error'](_0x30b3('0x2c'),_0x30b3('0x2d'),_0x30b3('0x20'),util['inspect'](_0x32046a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x30b3('0x2c'),'afterCreate',_0x30b3('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x30b3('0x2e')](function(){_0x5c7d09();});}else{_0x5c7d09();}}},'charset':_0x30b3('0x2f'),'collate':_0x30b3('0x30')});}; \ No newline at end of file +var _0x86e8=['sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','then','update','createdAt','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/status?token=','token'];(function(_0x35b947,_0x21ecb2){var _0x42fa78=function(_0x10da73){while(--_0x10da73){_0x35b947['push'](_0x35b947['shift']());}};_0x42fa78(++_0x21ecb2);}(_0x86e8,0xbf));var _0x886e=function(_0x33c48f,_0x1b620b){_0x33c48f=_0x33c48f-0x0;var _0x138b01=_0x86e8[_0x33c48f];return _0x138b01;};'use strict';var _=require(_0x886e('0x0'));var util=require(_0x886e('0x1'));var logger=require(_0x886e('0x2'))('api');var moment=require(_0x886e('0x3'));var BPromise=require('bluebird');var rp=require(_0x886e('0x4'));var fs=require('fs');var path=require(_0x886e('0x5'));var rimraf=require(_0x886e('0x6'));var config=require(_0x886e('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x886e('0x8')]=function(_0xd39a71,_0x426ef8){return _0xd39a71[_0x886e('0x9')](_0x886e('0xa'),attributes,{'tableName':_0x886e('0xb'),'paranoid':![],'indexes':[{'name':_0x886e('0xc'),'fields':[_0x886e('0xc')]},{'name':_0x886e('0xd'),'fields':[_0x886e('0xe')],'type':_0x886e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e212d,_0x270207,_0x5a716d){var _0x38163d=_0xd39a71[_0x886e('0x10')];var _0x40b0f7=_0x2e212d[_0x886e('0x11')]({'plain':!![]});if(_0x40b0f7[_0x886e('0x12')][_0x886e('0x13')]()==='in'||_0x40b0f7[_0x886e('0x12')][_0x886e('0x13')]()===_0x886e('0x14')&&!_0x40b0f7['secret']&&!_[_0x886e('0x15')](_0x40b0f7['UserId'])){_0x38163d[_0x886e('0x16')][_0x886e('0x17')]({'where':{'id':_0x40b0f7['WhatsappInteractionId']}})[_0x886e('0x18')](function(_0x3b8a3b){if(_0x3b8a3b){_0x3b8a3b[_0x886e('0x19')]({'lastMsgAt':_0x40b0f7[_0x886e('0x1a')],'lastMsgDirection':_0x40b0f7[_0x886e('0x12')][_0x886e('0x13')]()});}})['catch'](function(_0x577c9c){console['error'](_0x577c9c);});}if(_0x40b0f7['direction']==='out'&&!_0x40b0f7['secret']){var _0x564271;_0x38163d[_0x886e('0x1b')][_0x886e('0x1c')]({'where':{'id':_0x40b0f7[_0x886e('0x1d')]},'raw':!![]})[_0x886e('0x18')](function(_0x5392e2){_0x564271=_0x5392e2;if(_0x564271&&_0x564271[_0x886e('0x1e')]){switch(_0x564271[_0x886e('0x1e')]){case _0x886e('0x1f'):var _0x28acd9=require('twilio');if(_0x564271[_0x886e('0x20')]&&_0x564271[_0x886e('0x21')]&&_0x564271[_0x886e('0x22')]){var _0x268a0b=new _0x28acd9(_0x564271[_0x886e('0x20')],_0x564271['authToken']);_0x268a0b['messages']['create']({'body':_0x40b0f7['body'],'to':_0x886e('0x23')+_0x40b0f7[_0x886e('0x22')],'from':'whatsapp:'+_0x564271['phone'],'statusCallback':_0x564271[_0x886e('0x24')]+'/api/whatsapp/messages/'+_0x40b0f7['id']+_0x886e('0x25')+_0x564271[_0x886e('0x26')]})[_0x886e('0x18')](function(_0x5b2cb0){if(_0x5b2cb0[_0x886e('0x27')]){return _0x2e212d[_0x886e('0x19')]({'messageId':_0x5b2cb0[_0x886e('0x27')]});}})[_0x886e('0x28')](function(_0x1f3627){logger[_0x886e('0x29')](_0x886e('0x2a'),'afterCreate',_0x886e('0x1f'),util[_0x886e('0x2b')](_0x1f3627,{'showHidden':![],'depth':null}));});}else{logger[_0x886e('0x29')](_0x886e('0x2a'),'afterCreate',_0x886e('0x1f'),_0x886e('0x2c'));}break;}}})[_0x886e('0x2d')](function(){_0x5a716d();});}else{_0x5a716d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b4060d5..730c621 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 _0xd0b8=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','CreateWhatsappMessage','create','body','options','raw'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd0b8,0x177));var _0x8d0b=function(_0x31bfaa,_0x27fdae){_0x31bfaa=_0x31bfaa-0x0;var _0x318511=_0xd0b8[_0x31bfaa];return _0x318511;};'use strict';var _=require('lodash');var util=require(_0x8d0b('0x0'));var moment=require(_0x8d0b('0x1'));var BPromise=require(_0x8d0b('0x2'));var rs=require(_0x8d0b('0x3'));var fs=require('fs');var Redis=require(_0x8d0b('0x4'));var db=require(_0x8d0b('0x5'))['db'];var utils=require(_0x8d0b('0x6'));var logger=require(_0x8d0b('0x7'))('rpc');var config=require(_0x8d0b('0x8'));var jayson=require(_0x8d0b('0x9'));var client=jayson[_0x8d0b('0xa')][_0x8d0b('0xb')]({'port':0x232a});config['redis']=_[_0x8d0b('0xc')](config[_0x8d0b('0xd')],{'host':_0x8d0b('0xe'),'port':0x18eb});var socket=require(_0x8d0b('0xf'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x8d0b('0x10')](socket);function respondWithRpcPromise(_0x1e2c42,_0x48ee38,_0x5a1109){return new BPromise(function(_0x34aef9,_0x1bd3a8){return client[_0x8d0b('0x11')](_0x1e2c42,_0x5a1109)[_0x8d0b('0x12')](function(_0x3fadc9){logger[_0x8d0b('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x48ee38,_0x8d0b('0x14'));logger[_0x8d0b('0x15')](_0x8d0b('0x16'),_0x48ee38,_0x8d0b('0x14'),JSON[_0x8d0b('0x17')](_0x3fadc9));if(_0x3fadc9['error']){if(_0x3fadc9[_0x8d0b('0x18')][_0x8d0b('0x19')]===0x1f4){logger[_0x8d0b('0x18')](_0x8d0b('0x1a'),_0x48ee38,_0x3fadc9[_0x8d0b('0x18')][_0x8d0b('0x1b')]);return _0x1bd3a8(_0x3fadc9[_0x8d0b('0x18')][_0x8d0b('0x1b')]);}logger['error'](_0x8d0b('0x1a'),_0x48ee38,_0x3fadc9[_0x8d0b('0x18')]['message']);return _0x34aef9(_0x3fadc9[_0x8d0b('0x18')][_0x8d0b('0x1b')]);}else{logger['info'](_0x8d0b('0x1a'),_0x48ee38,'request\x20sent');_0x34aef9(_0x3fadc9['result'][_0x8d0b('0x1b')]);}})['catch'](function(_0x24d9cc){logger[_0x8d0b('0x18')](_0x8d0b('0x1a'),_0x48ee38,_0x24d9cc);_0x1bd3a8(_0x24d9cc);});});}exports[_0x8d0b('0x1c')]=function(_0x319511){var _0x482834=this;return new Promise(function(_0x386820,_0x3ba473){return db['WhatsappMessage'][_0x8d0b('0x1d')](_0x319511[_0x8d0b('0x1e')],{'raw':_0x319511[_0x8d0b('0x1f')]?_0x319511[_0x8d0b('0x1f')][_0x8d0b('0x20')]===undefined?!![]:![]:!![]})[_0x8d0b('0x12')](function(_0x580468){logger[_0x8d0b('0x13')]('CreateWhatsappMessage',_0x319511);logger[_0x8d0b('0x15')]('CreateWhatsappMessage',_0x319511,JSON[_0x8d0b('0x17')](_0x580468));_0x386820(_0x580468);})[_0x8d0b('0x21')](function(_0x2a4e85){logger[_0x8d0b('0x18')](_0x8d0b('0x1c'),_0x2a4e85[_0x8d0b('0x1b')],_0x319511);_0x3ba473(_0x482834[_0x8d0b('0x18')](0x1f4,_0x2a4e85[_0x8d0b('0x1b')]));});});}; \ No newline at end of file +var _0xe594=['request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','body','options','raw','then','moment','bluebird','randomstring','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x275685,_0x34c7d9){var _0x49d68d=function(_0x49607d){while(--_0x49607d){_0x275685['push'](_0x275685['shift']());}};_0x49d68d(++_0x34c7d9);}(_0xe594,0x91));var _0x4e59=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xe594[_0x37a7c6];return _0x539905;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e59('0x0'));var BPromise=require(_0x4e59('0x1'));var rs=require(_0x4e59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e59('0x3'));var logger=require('../../config/logger')(_0x4e59('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4e59('0x5')]({'port':0x232a});config[_0x4e59('0x6')]=_[_0x4e59('0x7')](config[_0x4e59('0x6')],{'host':_0x4e59('0x8'),'port':0x18eb});var socket=require(_0x4e59('0x9'))(new Redis(config[_0x4e59('0x6')]));require(_0x4e59('0xa'))['register'](socket);function respondWithRpcPromise(_0x35ecd0,_0x335379,_0x3a7cef){return new BPromise(function(_0x3853a4,_0x32ffee){return client[_0x4e59('0xb')](_0x35ecd0,_0x3a7cef)['then'](function(_0x53f6d2){logger['info'](_0x4e59('0xc'),_0x335379,_0x4e59('0xd'));logger[_0x4e59('0xe')](_0x4e59('0xf'),_0x335379,_0x4e59('0xd'),JSON[_0x4e59('0x10')](_0x53f6d2));if(_0x53f6d2[_0x4e59('0x11')]){if(_0x53f6d2[_0x4e59('0x11')][_0x4e59('0x12')]===0x1f4){logger[_0x4e59('0x11')](_0x4e59('0xc'),_0x335379,_0x53f6d2[_0x4e59('0x11')]['message']);return _0x32ffee(_0x53f6d2[_0x4e59('0x11')]['message']);}logger['error'](_0x4e59('0xc'),_0x335379,_0x53f6d2[_0x4e59('0x11')]['message']);return _0x3853a4(_0x53f6d2[_0x4e59('0x11')][_0x4e59('0x13')]);}else{logger['info'](_0x4e59('0xc'),_0x335379,_0x4e59('0xd'));_0x3853a4(_0x53f6d2['result'][_0x4e59('0x13')]);}})[_0x4e59('0x14')](function(_0x1533c0){logger[_0x4e59('0x11')](_0x4e59('0xc'),_0x335379,_0x1533c0);_0x32ffee(_0x1533c0);});});}exports[_0x4e59('0x15')]=function(_0x3e5596){var _0x1d6652=this;return new Promise(function(_0x183089,_0x24145b){return db['WhatsappMessage']['create'](_0x3e5596[_0x4e59('0x16')],{'raw':_0x3e5596[_0x4e59('0x17')]?_0x3e5596[_0x4e59('0x17')][_0x4e59('0x18')]===undefined?!![]:![]:!![]})[_0x4e59('0x19')](function(_0x5cf661){logger['info']('CreateWhatsappMessage',_0x3e5596);logger[_0x4e59('0xe')](_0x4e59('0x15'),_0x3e5596,JSON[_0x4e59('0x10')](_0x5cf661));_0x183089(_0x5cf661);})[_0x4e59('0x14')](function(_0x566e75){logger[_0x4e59('0x11')]('CreateWhatsappMessage',_0x566e75[_0x4e59('0x13')],_0x3e5596);_0x24145b(_0x1d6652[_0x4e59('0x11')](0x1f4,_0x566e75[_0x4e59('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index a3eb429..7d13bf8 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 _0x4431=['save','emit','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x50d88b,_0x2be047){var _0x583426=function(_0x1f577c){while(--_0x1f577c){_0x50d88b['push'](_0x50d88b['shift']());}};_0x583426(++_0x2be047);}(_0x4431,0x1bc));var _0x1443=function(_0x467ab4,_0x26bd9c){_0x467ab4=_0x467ab4-0x0;var _0x24acc6=_0x4431[_0x467ab4];return _0x24acc6;};'use strict';var WhatsappMessageEvents=require(_0x1443('0x0'));var events=[_0x1443('0x1'),'remove','update'];function createListener(_0x274282,_0x4b8551){return function(_0xfbc54b){_0x4b8551[_0x1443('0x2')](_0x274282,_0xfbc54b);};}function removeListener(_0x2e152c,_0x354e76){return function(){WhatsappMessageEvents['removeListener'](_0x2e152c,_0x354e76);};}exports[_0x1443('0x3')]=function(_0x518c44){for(var _0x1bfea1=0x0,_0x55b27f=events['length'];_0x1bfea1<_0x55b27f;_0x1bfea1++){var _0x4dcbcc=events[_0x1bfea1];var _0x305d56=createListener(_0x1443('0x4')+_0x4dcbcc,_0x518c44);WhatsappMessageEvents['on'](_0x4dcbcc,_0x305d56);}}; \ No newline at end of file +var _0x2bd8=['removeListener','register','length','./whatsappMessage.events','remove','update','emit'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x2bd8,0x130));var _0x82bd=function(_0x1d04fe,_0x205f41){_0x1d04fe=_0x1d04fe-0x0;var _0x1057b8=_0x2bd8[_0x1d04fe];return _0x1057b8;};'use strict';var WhatsappMessageEvents=require(_0x82bd('0x0'));var events=['save',_0x82bd('0x1'),_0x82bd('0x2')];function createListener(_0x208a3d,_0x41dbdf){return function(_0x4681ad){_0x41dbdf[_0x82bd('0x3')](_0x208a3d,_0x4681ad);};}function removeListener(_0x183f76,_0x572a80){return function(){WhatsappMessageEvents[_0x82bd('0x4')](_0x183f76,_0x572a80);};}exports[_0x82bd('0x5')]=function(_0x3bf810){for(var _0x5ceb60=0x0,_0x19dbb1=events[_0x82bd('0x6')];_0x5ceb60<_0x19dbb1;_0x5ceb60++){var _0x226f60=events[_0x5ceb60];var _0x1f7463=createListener('whatsappMessage:'+_0x226f60,_0x3bf810);WhatsappMessageEvents['on'](_0x226f60,_0x1f7463);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 8b87841..c4ee8a1 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 _0x193e=['destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x8ec58d,_0x36922c){var _0x26cc46=function(_0x32b293){while(--_0x32b293){_0x8ec58d['push'](_0x8ec58d['shift']());}};_0x26cc46(++_0x36922c);}(_0x193e,0x12d));var _0xe193=function(_0x69bae4,_0x32abef){_0x69bae4=_0x69bae4-0x0;var _0x2caa89=_0x193e[_0x69bae4];return _0x2caa89;};'use strict';var multer=require(_0xe193('0x0'));var util=require(_0xe193('0x1'));var path=require(_0xe193('0x2'));var timeout=require(_0xe193('0x3'));var express=require(_0xe193('0x4'));var router=express[_0xe193('0x5')]();var auth=require(_0xe193('0x6'));var interaction=require(_0xe193('0x7'));var config=require(_0xe193('0x8'));var controller=require(_0xe193('0x9'));router[_0xe193('0xa')]('/',auth[_0xe193('0xb')](),controller[_0xe193('0xc')]);router[_0xe193('0xa')](_0xe193('0xd'),auth[_0xe193('0xb')](),controller[_0xe193('0xe')]);router[_0xe193('0xa')](_0xe193('0xf'),auth[_0xe193('0xb')](),controller[_0xe193('0x10')]);router[_0xe193('0xa')](_0xe193('0x11'),auth['isAuthenticated'](),controller[_0xe193('0x12')]);router[_0xe193('0xa')](_0xe193('0x13'),auth[_0xe193('0xb')](),controller[_0xe193('0x14')]);router[_0xe193('0xa')](_0xe193('0x15'),auth[_0xe193('0xb')](),controller[_0xe193('0x16')]);router[_0xe193('0x17')]('/',auth[_0xe193('0xb')](),controller[_0xe193('0x18')]);router[_0xe193('0x17')](_0xe193('0x13'),auth[_0xe193('0xb')](),controller[_0xe193('0x19')]);router[_0xe193('0x17')]('/:id/users',auth[_0xe193('0xb')](),controller[_0xe193('0x1a')]);router[_0xe193('0x1b')](_0xe193('0xf'),auth['isAuthenticated'](),controller[_0xe193('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe193('0x1d')]);router[_0xe193('0x1e')](_0xe193('0x13'),auth[_0xe193('0xb')](),controller[_0xe193('0x1f')]);router[_0xe193('0x1e')](_0xe193('0x15'),auth['isAuthenticated'](),controller[_0xe193('0x20')]);module['exports']=router; \ No newline at end of file +var _0xc4df=['/:id/teams','addTeams','addAgents','put','update','destroy','removeTeams','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/users','getAgents','create','post'];(function(_0x3190c2,_0x2b9d6b){var _0x306550=function(_0x559f8a){while(--_0x559f8a){_0x3190c2['push'](_0x3190c2['shift']());}};_0x306550(++_0x2b9d6b);}(_0xc4df,0xd4));var _0xfc4d=function(_0x1a8f84,_0x31a56e){_0x1a8f84=_0x1a8f84-0x0;var _0x26fa74=_0xc4df[_0x1a8f84];return _0x26fa74;};'use strict';var multer=require(_0xfc4d('0x0'));var util=require('util');var path=require(_0xfc4d('0x1'));var timeout=require(_0xfc4d('0x2'));var express=require(_0xfc4d('0x3'));var router=express[_0xfc4d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfc4d('0x5'));var config=require(_0xfc4d('0x6'));var controller=require(_0xfc4d('0x7'));router[_0xfc4d('0x8')]('/',auth[_0xfc4d('0x9')](),controller[_0xfc4d('0xa')]);router['get'](_0xfc4d('0xb'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0xc')]);router['get'](_0xfc4d('0xd'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0xe')]);router[_0xfc4d('0x8')](_0xfc4d('0xf'),auth[_0xfc4d('0x9')](),controller['getMembers']);router[_0xfc4d('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xfc4d('0x8')](_0xfc4d('0x10'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x11')]);router['post']('/',auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x12')]);router[_0xfc4d('0x13')](_0xfc4d('0x14'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x15')]);router['post'](_0xfc4d('0x10'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x16')]);router[_0xfc4d('0x17')](_0xfc4d('0xd'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x18')]);router['delete'](_0xfc4d('0xd'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x19')]);router['delete'](_0xfc4d('0x14'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0x1a')]);router[_0xfc4d('0x1b')](_0xfc4d('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfc4d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ec4396d..071f71f 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 _0xded8=['beepall','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xded8,0x1f2));var _0x8ded=function(_0x31d8d3,_0x5e6fdc){_0x31d8d3=_0x31d8d3-0x0;var _0x35e292=_0xded8[_0x31d8d3];return _0x35e292;};'use strict';var Sequelize=require(_0x8ded('0x0'));module[_0x8ded('0x1')]={'name':{'type':Sequelize[_0x8ded('0x2')],'unique':_0x8ded('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8ded('0x4')](_0x8ded('0x5'),_0x8ded('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe9b6=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xe9b6,0x7b));var _0x6e9b=function(_0x36899c,_0x59e018){_0x36899c=_0x36899c-0x0;var _0x2e66d3=_0xe9b6[_0x36899c];return _0x2e66d3;};'use strict';var Sequelize=require(_0x6e9b('0x0'));module[_0x6e9b('0x1')]={'name':{'type':Sequelize[_0x6e9b('0x2')],'unique':_0x6e9b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6e9b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6e9b('0x5'),_0x6e9b('0x6'),_0x6e9b('0x7'))},'description':{'type':Sequelize[_0x6e9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7ff69ac..63606b5 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 _0xe047=['SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','body','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','get','sendStatus','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','merge','options','find','create','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s'];(function(_0x528372,_0x1bc4c8){var _0x2e2c58=function(_0x188584){while(--_0x188584){_0x528372['push'](_0x528372['shift']());}};_0x2e2c58(++_0x1bc4c8);}(_0xe047,0xb0));var _0x7e04=function(_0x276015,_0x57eb3d){_0x276015=_0x276015-0x0;var _0x385345=_0xe047[_0x276015];return _0x385345;};'use strict';var pdf=require(_0x7e04('0x0'));var emlformat=require(_0x7e04('0x1'));var rimraf=require(_0x7e04('0x2'));var zipdir=require(_0x7e04('0x3'));var jsonpatch=require(_0x7e04('0x4'));var rp=require(_0x7e04('0x5'));var moment=require(_0x7e04('0x6'));var BPromise=require(_0x7e04('0x7'));var Mustache=require(_0x7e04('0x8'));var util=require(_0x7e04('0x9'));var path=require(_0x7e04('0xa'));var sox=require(_0x7e04('0xb'));var csv=require(_0x7e04('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e04('0xd'));var squel=require(_0x7e04('0xe'));var crypto=require(_0x7e04('0xf'));var jsforce=require(_0x7e04('0x10'));var deskjs=require(_0x7e04('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7e04('0x12'));var Papa=require(_0x7e04('0x13'));var Redis=require('ioredis');var authService=require(_0x7e04('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7e04('0x15'));var hardwareService=require(_0x7e04('0x16'));var logger=require(_0x7e04('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7e04('0x18'));var licenseUtil=require(_0x7e04('0x19'));var db=require(_0x7e04('0x1a'))['db'];config[_0x7e04('0x1b')]=_[_0x7e04('0x1c')](config[_0x7e04('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e04('0x1b')]));require('./whatsappQueue.socket')[_0x7e04('0x1d')](socket);function respondWithStatusCode(_0x5e33ba,_0x5ccaab){_0x5ccaab=_0x5ccaab||0xcc;return function(_0x8ecfdc){if(_0x8ecfdc){return _0x5e33ba['sendStatus'](_0x5ccaab);}return _0x5e33ba[_0x7e04('0x1e')](_0x5ccaab)[_0x7e04('0x1f')]();};}function respondWithResult(_0x266697,_0x1def64){_0x1def64=_0x1def64||0xc8;return function(_0x67221b){if(_0x67221b){return _0x266697[_0x7e04('0x1e')](_0x1def64)[_0x7e04('0x20')](_0x67221b);}};}function respondWithFilteredResult(_0x45af5a,_0x299b9e){return function(_0x3c4f14){if(_0x3c4f14){var _0x3ea71b=_0x3c4f14[_0x7e04('0x21')],_0x32c0d7=_0x299b9e[_0x7e04('0x22')],_0x1a2727=_0x299b9e[_0x7e04('0x22')]+_0x299b9e['limit'],_0x5ba287;if(_0x1a2727>=_0x3ea71b){_0x1a2727=_0x3ea71b;_0x5ba287=0xc8;}else{_0x5ba287=0xce;}_0x45af5a[_0x7e04('0x1e')](_0x5ba287);return _0x45af5a[_0x7e04('0x23')]('Content-Range',_0x32c0d7+'-'+_0x1a2727+'/'+_0x3ea71b)[_0x7e04('0x20')](_0x3c4f14);}return null;};}function patchUpdates(_0xcf0d44){return function(_0x6c363){try{jsonpatch[_0x7e04('0x24')](_0x6c363,_0xcf0d44,!![]);}catch(_0x5e150e){return BPromise[_0x7e04('0x25')](_0x5e150e);}return _0x6c363[_0x7e04('0x26')]();};}function saveUpdates(_0x288037,_0x82b7ac){return function(_0x1b01a0){if(_0x1b01a0){return _0x1b01a0[_0x7e04('0x27')](_0x288037)['then'](function(_0x594e9e){return _0x594e9e;});}return null;};}function removeEntity(_0x5da6b7,_0x21f770){return function(_0x51f439){if(_0x51f439){return _0x51f439[_0x7e04('0x28')]()[_0x7e04('0x29')](function(){var _0x1b6080=_0x51f439[_0x7e04('0x2a')]({'plain':!![]});var _0x354296='WhatsappQueues';return db['UserProfileResource'][_0x7e04('0x28')]({'where':{'type':_0x354296,'resourceId':_0x1b6080['id']}})['then'](function(){return _0x51f439;});})[_0x7e04('0x29')](function(){_0x5da6b7[_0x7e04('0x1e')](0xcc)[_0x7e04('0x1f')]();});}};}function handleEntityNotFound(_0x81d1b9,_0x1a58fd){return function(_0x158b2b){if(!_0x158b2b){_0x81d1b9[_0x7e04('0x2b')](0x194);}return _0x158b2b;};}function handleError(_0x43d88d,_0x4813a8){_0x4813a8=_0x4813a8||0x1f4;return function(_0x126cd0){logger[_0x7e04('0x2c')](_0x126cd0[_0x7e04('0x2d')]);if(_0x126cd0[_0x7e04('0x2e')]){delete _0x126cd0[_0x7e04('0x2e')];}_0x43d88d['status'](_0x4813a8)['send'](_0x126cd0);};}exports[_0x7e04('0x2f')]=function(_0x1d7974,_0x15e645){var _0x5f5ffd={},_0x15e84c={},_0x1116ee={'count':0x0,'rows':[]};var _0x44cb0c=_[_0x7e04('0x30')](db[_0x7e04('0x31')][_0x7e04('0x32')],function(_0xc0650c){return{'name':_0xc0650c[_0x7e04('0x33')],'type':_0xc0650c[_0x7e04('0x34')][_0x7e04('0x35')]};});_0x15e84c[_0x7e04('0x36')]=_[_0x7e04('0x30')](_0x44cb0c,_0x7e04('0x2e'));_0x15e84c[_0x7e04('0x37')]=_[_0x7e04('0x38')](_0x1d7974[_0x7e04('0x37')]);_0x15e84c[_0x7e04('0x39')]=_[_0x7e04('0x3a')](_0x15e84c[_0x7e04('0x36')],_0x15e84c[_0x7e04('0x37')]);_0x5f5ffd['attributes']=_[_0x7e04('0x3a')](_0x15e84c[_0x7e04('0x36')],qs[_0x7e04('0x3b')](_0x1d7974[_0x7e04('0x37')][_0x7e04('0x3b')]));_0x5f5ffd[_0x7e04('0x3c')]=_0x5f5ffd[_0x7e04('0x3c')][_0x7e04('0x3d')]?_0x5f5ffd['attributes']:_0x15e84c[_0x7e04('0x36')];if(!_0x1d7974['query'][_0x7e04('0x3e')](_0x7e04('0x3f'))){_0x5f5ffd[_0x7e04('0x40')]=qs['limit'](_0x1d7974[_0x7e04('0x37')][_0x7e04('0x40')]);_0x5f5ffd[_0x7e04('0x22')]=qs[_0x7e04('0x22')](_0x1d7974[_0x7e04('0x37')][_0x7e04('0x22')]);}_0x5f5ffd[_0x7e04('0x41')]=qs[_0x7e04('0x42')](_0x1d7974[_0x7e04('0x37')][_0x7e04('0x42')]);_0x5f5ffd[_0x7e04('0x43')]=qs[_0x7e04('0x39')](_[_0x7e04('0x44')](_0x1d7974[_0x7e04('0x37')],_0x15e84c['filters']),_0x44cb0c);if(_0x1d7974[_0x7e04('0x37')][_0x7e04('0x45')]){_0x5f5ffd[_0x7e04('0x43')]=_['merge'](_0x5f5ffd[_0x7e04('0x43')],{'$or':_[_0x7e04('0x30')](_0x44cb0c,function(_0x3500a9){if(_0x3500a9[_0x7e04('0x34')]!=='VIRTUAL'){var _0x459b9d={};_0x459b9d[_0x3500a9[_0x7e04('0x2e')]]={'$like':'%'+_0x1d7974['query']['filter']+'%'};return _0x459b9d;}})});}_0x5f5ffd=_['merge']({},_0x5f5ffd,_0x1d7974['options']);var _0x575e24={'where':_0x5f5ffd[_0x7e04('0x43')]};return db[_0x7e04('0x31')][_0x7e04('0x21')](_0x575e24)['then'](function(_0xf87c01){_0x1116ee[_0x7e04('0x21')]=_0xf87c01;if(_0x1d7974[_0x7e04('0x37')][_0x7e04('0x46')]){_0x5f5ffd[_0x7e04('0x47')]=[{'all':!![]}];}return db[_0x7e04('0x31')][_0x7e04('0x48')](_0x5f5ffd);})[_0x7e04('0x29')](function(_0x5a8d30){_0x1116ee[_0x7e04('0x49')]=_0x5a8d30;return _0x1116ee;})['then'](respondWithFilteredResult(_0x15e645,_0x5f5ffd))[_0x7e04('0x4a')](handleError(_0x15e645,null));};exports['show']=function(_0x4e8eb2,_0x143f3b){var _0x52aace={'raw':!![],'where':{'id':_0x4e8eb2['params']['id']}},_0x297e84={};_0x297e84[_0x7e04('0x36')]=_['keys'](db[_0x7e04('0x31')][_0x7e04('0x32')]);_0x297e84[_0x7e04('0x37')]=_[_0x7e04('0x38')](_0x4e8eb2['query']);_0x297e84[_0x7e04('0x39')]=_[_0x7e04('0x3a')](_0x297e84[_0x7e04('0x36')],_0x297e84[_0x7e04('0x37')]);_0x52aace[_0x7e04('0x3c')]=_[_0x7e04('0x3a')](_0x297e84[_0x7e04('0x36')],qs[_0x7e04('0x3b')](_0x4e8eb2[_0x7e04('0x37')][_0x7e04('0x3b')]));_0x52aace[_0x7e04('0x3c')]=_0x52aace[_0x7e04('0x3c')]['length']?_0x52aace['attributes']:_0x297e84[_0x7e04('0x36')];if(_0x4e8eb2[_0x7e04('0x37')]['includeAll']){_0x52aace['include']=[{'all':!![]}];}_0x52aace=_[_0x7e04('0x4b')]({},_0x52aace,_0x4e8eb2[_0x7e04('0x4c')]);return db[_0x7e04('0x31')][_0x7e04('0x4d')](_0x52aace)[_0x7e04('0x29')](handleEntityNotFound(_0x143f3b,null))[_0x7e04('0x29')](respondWithResult(_0x143f3b,null))['catch'](handleError(_0x143f3b,null));};exports[_0x7e04('0x4e')]=function(_0x4051d2,_0x5a620b){return db[_0x7e04('0x31')][_0x7e04('0x4e')](_0x4051d2['body'],{})['then'](function(_0x1a9c24){var _0x2ec71c=_0x4051d2[_0x7e04('0x4f')][_0x7e04('0x2a')]({'plain':!![]});if(!_0x2ec71c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ec71c[_0x7e04('0x50')]===_0x7e04('0x4f')){var _0x4a325a=_0x1a9c24[_0x7e04('0x2a')]({'plain':!![]});var _0x4e44cc=_0x7e04('0x51');return db[_0x7e04('0x52')][_0x7e04('0x4d')]({'where':{'name':_0x4e44cc,'userProfileId':_0x2ec71c[_0x7e04('0x53')]},'raw':!![]})[_0x7e04('0x29')](function(_0x4dafd7){if(_0x4dafd7&&_0x4dafd7[_0x7e04('0x54')]===0x0){return db[_0x7e04('0x55')][_0x7e04('0x4e')]({'name':_0x4a325a[_0x7e04('0x2e')],'resourceId':_0x4a325a['id'],'type':_0x4dafd7[_0x7e04('0x2e')],'sectionId':_0x4dafd7['id']},{})['then'](function(){return _0x1a9c24;});}else{return _0x1a9c24;}})[_0x7e04('0x4a')](function(_0xcf69f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf69f4);throw _0xcf69f4;});}return _0x1a9c24;})[_0x7e04('0x29')](respondWithResult(_0x5a620b,0xc9))[_0x7e04('0x4a')](handleError(_0x5a620b,null));};exports[_0x7e04('0x27')]=function(_0x5bb9b6,_0x2b3602){if(_0x5bb9b6['body']['id']){delete _0x5bb9b6['body']['id'];}return db[_0x7e04('0x31')][_0x7e04('0x4d')]({'where':{'id':_0x5bb9b6['params']['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x2b3602,null))['then'](saveUpdates(_0x5bb9b6['body'],null))[_0x7e04('0x29')](respondWithResult(_0x2b3602,null))[_0x7e04('0x4a')](handleError(_0x2b3602,null));};exports['destroy']=function(_0x5dcf84,_0x3eb778){return db[_0x7e04('0x31')][_0x7e04('0x4d')]({'where':{'id':_0x5dcf84[_0x7e04('0x56')]['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x3eb778,null))['then'](removeEntity(_0x3eb778,null))[_0x7e04('0x4a')](handleError(_0x3eb778,null));};exports[_0x7e04('0x57')]=function(_0x429f2c,_0x5a7bef){return db[_0x7e04('0x31')]['describe']()['then'](respondWithResult(_0x5a7bef,null))[_0x7e04('0x4a')](handleError(_0x5a7bef,null));};exports[_0x7e04('0x58')]=function(_0x104276,_0x635ed9,_0x3dab53){var _0x25afc0={'raw':!![],'where':{}},_0x1f5eb6={},_0x48f053;return db[_0x7e04('0x31')][_0x7e04('0x59')]({'where':{'id':_0x104276[_0x7e04('0x56')]['id']}})['then'](handleEntityNotFound(_0x635ed9,null))['then'](function(_0x3b5827){if(_0x3b5827){_0x48f053=_0x3b5827[_0x7e04('0x2a')]({'plain':!![]});_0x1f5eb6[_0x7e04('0x36')]=_[_0x7e04('0x38')](db[_0x7e04('0x5a')][_0x7e04('0x32')]);_0x1f5eb6[_0x7e04('0x37')]=_['keys'](_0x104276[_0x7e04('0x37')]);_0x1f5eb6[_0x7e04('0x39')]=_[_0x7e04('0x3a')](_0x1f5eb6[_0x7e04('0x36')],_0x1f5eb6[_0x7e04('0x37')]);_0x25afc0[_0x7e04('0x3c')]=_[_0x7e04('0x3a')](_0x1f5eb6[_0x7e04('0x36')],qs[_0x7e04('0x3b')](_0x104276[_0x7e04('0x37')][_0x7e04('0x3b')]));_0x25afc0[_0x7e04('0x3c')]=_0x25afc0[_0x7e04('0x3c')][_0x7e04('0x3d')]?_0x25afc0[_0x7e04('0x3c')]:_0x1f5eb6[_0x7e04('0x36')];if(!_0x104276['query']['hasOwnProperty'](_0x7e04('0x3f'))){_0x25afc0[_0x7e04('0x40')]=qs['limit'](_0x104276[_0x7e04('0x37')][_0x7e04('0x40')]);_0x25afc0[_0x7e04('0x22')]=qs[_0x7e04('0x22')](_0x104276[_0x7e04('0x37')][_0x7e04('0x22')]);}_0x25afc0[_0x7e04('0x41')]=qs[_0x7e04('0x42')](_0x104276[_0x7e04('0x37')]['sort']);_0x25afc0[_0x7e04('0x43')]=qs['filters'](_[_0x7e04('0x44')](_0x104276[_0x7e04('0x37')],_0x1f5eb6['filters']));_0x25afc0['where'][_0x7e04('0x5b')]=_0x3b5827['id'];if(_0x104276['query']['filter']){_0x25afc0[_0x7e04('0x43')]=_['merge'](_0x25afc0[_0x7e04('0x43')],{'$or':_['map'](_0x25afc0[_0x7e04('0x3c')],function(_0x1187d8){var _0x58d631={};_0x58d631[_0x1187d8]={'$like':'%'+_0x104276[_0x7e04('0x37')]['filter']+'%'};return _0x58d631;})});}_0x25afc0=_['merge']({},_0x25afc0,_0x104276['options']);return db[_0x7e04('0x5a')]['findAll'](_0x25afc0);}})[_0x7e04('0x29')](function(_0x3ceb7e){if(_0x3ceb7e){return db[_0x7e04('0x5c')][_0x7e04('0x5d')]({'where':{'id':_['map'](_0x3ceb7e,_0x7e04('0x5e')),'role':'agent'},'attributes':['id',_0x7e04('0x2e'),_0x7e04('0x5f'),_0x7e04('0x60'),_0x7e04('0x61')]});}})[_0x7e04('0x29')](function(_0x4b2b53){if(_0x4b2b53){return{'count':_0x4b2b53[_0x7e04('0x21')],'rows':_[_0x7e04('0x30')](_0x4b2b53[_0x7e04('0x49')],function(_0x74e0af){return{'membername':_0x74e0af[_0x7e04('0x2e')],'UserId':_0x74e0af['id'],'queue_name':_0x48f053[_0x7e04('0x2e')],'WhatsappQueueId':_0x48f053['id'],'interface':util[_0x7e04('0x62')](_0x7e04('0x63'),_0x7e04('0x64'),_0x74e0af['name']),'penalty':0x0,'paused':_0x74e0af[_0x7e04('0x5f')],'createdAt':_0x74e0af[_0x7e04('0x61')],'updatedAt':_0x74e0af['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e04('0x29')](respondWithFilteredResult(_0x635ed9,_0x25afc0))['catch'](handleError(_0x635ed9,null));};exports['getTeams']=function(_0xd87b69,_0x36d455,_0x2c029d){var _0x3352eb={};var _0x8a5422={};var _0x20cab5;var _0x7e6356;return db[_0x7e04('0x31')][_0x7e04('0x59')]({'where':{'id':_0xd87b69[_0x7e04('0x56')]['id']}})['then'](handleEntityNotFound(_0x36d455,null))[_0x7e04('0x29')](function(_0x4ceba0){if(_0x4ceba0){_0x20cab5=_0x4ceba0;_0x8a5422['model']=_['keys'](db['Team'][_0x7e04('0x32')]);_0x8a5422['query']=_[_0x7e04('0x38')](_0xd87b69[_0x7e04('0x37')]);_0x8a5422[_0x7e04('0x39')]=_[_0x7e04('0x3a')](_0x8a5422[_0x7e04('0x36')],_0x8a5422['query']);_0x3352eb[_0x7e04('0x3c')]=_['intersection'](_0x8a5422[_0x7e04('0x36')],qs[_0x7e04('0x3b')](_0xd87b69[_0x7e04('0x37')][_0x7e04('0x3b')]));_0x3352eb[_0x7e04('0x3c')]=_0x3352eb[_0x7e04('0x3c')][_0x7e04('0x3d')]?_0x3352eb[_0x7e04('0x3c')]:_0x8a5422['model'];_0x3352eb[_0x7e04('0x41')]=qs[_0x7e04('0x42')](_0xd87b69[_0x7e04('0x37')][_0x7e04('0x42')]);_0x3352eb[_0x7e04('0x43')]=qs['filters'](_['pick'](_0xd87b69[_0x7e04('0x37')],_0x8a5422['filters']));if(_0xd87b69[_0x7e04('0x37')]['filter']){_0x3352eb[_0x7e04('0x43')]=_['merge'](_0x3352eb[_0x7e04('0x43')],{'$or':_[_0x7e04('0x30')](_0x3352eb[_0x7e04('0x3c')],function(_0x492077){var _0x23ccee={};_0x23ccee[_0x492077]={'$like':'%'+_0xd87b69[_0x7e04('0x37')]['filter']+'%'};return _0x23ccee;})});}_0x3352eb=_['merge']({},_0x3352eb,_0xd87b69[_0x7e04('0x4c')]);return _0x20cab5['getTeams'](_0x3352eb);}})[_0x7e04('0x29')](function(_0x11d426){if(_0x11d426){_0x7e6356=_0x11d426[_0x7e04('0x3d')];if(!_0xd87b69[_0x7e04('0x37')][_0x7e04('0x3e')](_0x7e04('0x3f'))){_0x3352eb[_0x7e04('0x40')]=qs[_0x7e04('0x40')](_0xd87b69[_0x7e04('0x37')][_0x7e04('0x40')]);_0x3352eb[_0x7e04('0x22')]=qs[_0x7e04('0x22')](_0xd87b69[_0x7e04('0x37')]['offset']);}return _0x20cab5[_0x7e04('0x65')](_0x3352eb);}})[_0x7e04('0x29')](function(_0x33dfe9){if(_0x33dfe9){return _0x33dfe9?{'count':_0x7e6356,'rows':_0x33dfe9}:null;}})[_0x7e04('0x29')](respondWithResult(_0x36d455,null))['catch'](handleError(_0x36d455,null));};exports[_0x7e04('0x66')]=function(_0x25ca54,_0x7173f0,_0xd11747){var _0x32d503=_0x25ca54['body'][_0x7e04('0x67')];return db[_0x7e04('0x68')][_0x7e04('0x48')]({'where':{'id':_0x32d503},'attributes':['id'],'include':[{'model':db[_0x7e04('0x5c')],'as':_0x7e04('0x69'),'attributes':['id',_0x7e04('0x2e'),'online',_0x7e04('0x6a'),_0x7e04('0x6b')],'raw':!![]}]})[_0x7e04('0x29')](function(_0x266d22){if(_0x266d22){var _0x232f86=_[_0x7e04('0x6c')](_0x266d22,function(_0x300009){var _0x3da868=_0x300009[_0x7e04('0x2a')]({'plain':!![]});return _0x3da868[_0x7e04('0x69')];});return db['WhatsappQueue']['find']({'where':{'id':_0x25ca54[_0x7e04('0x56')]['id']}})[_0x7e04('0x29')](function(_0xbb7b6c){return db['sequelize'][_0x7e04('0x6d')](function(_0x323c2c){return _0xbb7b6c['addTeams'](_0x32d503,{'transaction':_0x323c2c})[_0x7e04('0x29')](function(){return BPromise[_0x7e04('0x6e')](_0x232f86,function(_0x4b44a5){return db[_0x7e04('0x5a')][_0x7e04('0x6f')]({'where':{'UserId':_0x4b44a5['id'],'WhatsappQueueId':_0x25ca54[_0x7e04('0x56')]['id']},'transaction':_0x323c2c});});})[_0x7e04('0x29')](function(){_0x232f86[_0x7e04('0x70')](function(_0x27247b){socket[_0x7e04('0x71')](_0x7e04('0x72'),{'UserId':_0x27247b['id'],'WhatsappQueueId':_0xbb7b6c['id']});});});});});}})['then'](respondWithStatusCode(_0x7173f0,null))[_0x7e04('0x4a')](handleError(_0x7173f0,null));};exports['removeTeams']=function(_0x3fd743,_0x10a516,_0x16cf93){return db['Team']['findAll']({'where':{'id':_0x3fd743[_0x7e04('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7e04('0x5c')],'as':_0x7e04('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7e04('0x29')](handleEntityNotFound(_0x10a516,null))['then'](function(_0x3ae47e){var _0x43a7c4=_[_0x7e04('0x30')](_0x3ae47e,'id');var _0x265306=[];var _0x379533=[];var _0xbf938f=squel['select']();_0xbf938f['field']('tq.TeamId')[_0x7e04('0x73')](_0x7e04('0x74'),'tq')[_0x7e04('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7e04('0x43')](_0x7e04('0x76'),_0x3fd743['params']['id']);for(var _0x3ab1b9=0x0;_0x3ab1b9<_0x3ae47e[_0x7e04('0x3d')];_0x3ab1b9+=0x1){let _0xf59335=_0x3ae47e[_0x3ab1b9];for(var _0x154c54=0x0;_0x154c54<_0xf59335[_0x7e04('0x69')]['length'];_0x154c54+=0x1){let _0x2b3b7a=_0xf59335['Agents'][_0x154c54];var _0xf85647=_0xbf938f['clone']();_0xf85647['where'](_0x7e04('0x77'),_0x2b3b7a['id']);_0x379533[_0x7e04('0x78')](db[_0x7e04('0x79')][_0x7e04('0x37')](_0xf85647['toString'](),{'type':db[_0x7e04('0x79')][_0x7e04('0x7a')]['SELECT']})[_0x7e04('0x29')](function(_0x237ea7){if(_0x237ea7[_0x7e04('0x3d')]===0x1){return _0x2b3b7a['id'];}else{var _0xe999f9=_[_0x7e04('0x7b')](_[_0x7e04('0x30')](_0x237ea7,_0x7e04('0x7c')),function(_0x1cc1b0){return _[_0x7e04('0x7d')](_0x43a7c4,_0x1cc1b0);});if(_0xe999f9){return _0x2b3b7a['id'];}}}));}}return BPromise[_0x7e04('0x7e')](_0x379533)[_0x7e04('0x29')](function(_0x3e5dff){_0x265306=_(_0x265306)[_0x7e04('0x7f')](_0x3e5dff)[_0x7e04('0x80')]()[_0x7e04('0x81')]();return db['WhatsappQueue']['find']({'where':{'id':_0x3fd743['params']['id']}})[_0x7e04('0x29')](function(_0x107ba0){return db[_0x7e04('0x79')][_0x7e04('0x6d')](function(_0xf177c3){return _0x107ba0[_0x7e04('0x82')](_0x3fd743[_0x7e04('0x37')]['ids'],{'transaction':_0xf177c3})[_0x7e04('0x29')](function(){if(!_['isEmpty'](_0x265306)){return _0x107ba0[_0x7e04('0x83')](_0x265306,{'transaction':_0xf177c3});}})[_0x7e04('0x29')](function(){_0x265306[_0x7e04('0x70')](function(_0x2577fa){socket[_0x7e04('0x71')](_0x7e04('0x84'),{'UserId':_0x2577fa,'WhatsappQueueId':_0x107ba0['id']});});});});});});})[_0x7e04('0x29')](respondWithStatusCode(_0x10a516,null))['catch'](handleError(_0x10a516,null));};exports[_0x7e04('0x85')]=function(_0x2e562e,_0xb0180b,_0x3c834c){return db[_0x7e04('0x31')][_0x7e04('0x4d')]({'where':{'id':_0x2e562e[_0x7e04('0x56')]['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0xb0180b,null))[_0x7e04('0x29')](function(_0x41f4e5){if(_0x41f4e5){return _0x41f4e5['addAgents'](_0x2e562e[_0x7e04('0x86')][_0x7e04('0x67')],_['omit'](_0x2e562e['body'],[_0x7e04('0x67'),'id'])||{})[_0x7e04('0x87')](function(_0x48be10){for(var _0x27b351=0x0;_0x27b351<_0x2e562e[_0x7e04('0x86')][_0x7e04('0x67')][_0x7e04('0x3d')];_0x27b351+=0x1){socket['emit'](_0x7e04('0x72'),{'UserId':_0x2e562e[_0x7e04('0x86')][_0x7e04('0x67')][_0x27b351],'WhatsappQueueId':_0x2e562e[_0x7e04('0x56')]['id']});}return _0x48be10;});}})[_0x7e04('0x29')](respondWithResult(_0xb0180b,null))[_0x7e04('0x4a')](handleError(_0xb0180b,null));};exports[_0x7e04('0x83')]=function(_0x37efdf,_0x2de785,_0x4c2f1e){return db[_0x7e04('0x31')]['find']({'where':{'id':_0x37efdf[_0x7e04('0x56')]['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x2de785,null))['then'](function(_0x2dba6b){if(_0x2dba6b){return _0x2dba6b[_0x7e04('0x83')](_0x37efdf[_0x7e04('0x37')][_0x7e04('0x67')])['then'](function(){if(_[_0x7e04('0x88')](_0x37efdf[_0x7e04('0x37')][_0x7e04('0x67')])){for(var _0x130bbb=0x0;_0x130bbb<_0x37efdf[_0x7e04('0x37')][_0x7e04('0x67')][_0x7e04('0x3d')];_0x130bbb+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x37efdf[_0x7e04('0x37')][_0x7e04('0x67')][_0x130bbb]),'WhatsappQueueId':Number(_0x37efdf[_0x7e04('0x56')]['id'])});}}else{socket['emit'](_0x7e04('0x84'),{'UserId':Number(_0x37efdf[_0x7e04('0x37')][_0x7e04('0x67')]),'WhatsappQueueId':Number(_0x37efdf[_0x7e04('0x56')]['id'])});}});}})[_0x7e04('0x29')](respondWithStatusCode(_0x2de785,null))[_0x7e04('0x4a')](handleError(_0x2de785,null));};exports['getAgents']=function(_0x54d54c,_0x42546f,_0x31a778){var _0x24724f={};var _0x4fbf23={};var _0x23ddfb;var _0x5b9320;return db[_0x7e04('0x31')][_0x7e04('0x59')]({'where':{'id':_0x54d54c[_0x7e04('0x56')]['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x42546f,null))['then'](function(_0x3a2c1b){if(_0x3a2c1b){_0x23ddfb=_0x3a2c1b;_0x4fbf23[_0x7e04('0x36')]=_[_0x7e04('0x38')](db[_0x7e04('0x5c')][_0x7e04('0x32')]);_0x4fbf23[_0x7e04('0x37')]=_[_0x7e04('0x38')](_0x54d54c[_0x7e04('0x37')]);_0x4fbf23['filters']=_['intersection'](_0x4fbf23[_0x7e04('0x36')],_0x4fbf23[_0x7e04('0x37')]);_0x24724f[_0x7e04('0x3c')]=_[_0x7e04('0x3a')](_0x4fbf23[_0x7e04('0x36')],qs[_0x7e04('0x3b')](_0x54d54c[_0x7e04('0x37')][_0x7e04('0x3b')]));_0x24724f['attributes']=_0x24724f['attributes'][_0x7e04('0x3d')]?_0x24724f[_0x7e04('0x3c')]:_0x4fbf23[_0x7e04('0x36')];_0x24724f[_0x7e04('0x41')]=qs[_0x7e04('0x42')](_0x54d54c[_0x7e04('0x37')]['sort']);_0x24724f[_0x7e04('0x43')]=qs[_0x7e04('0x39')](_[_0x7e04('0x44')](_0x54d54c['query'],_0x4fbf23[_0x7e04('0x39')]));if(_0x54d54c[_0x7e04('0x37')][_0x7e04('0x45')]){_0x24724f['where']=_[_0x7e04('0x4b')](_0x24724f['where'],{'$or':_[_0x7e04('0x30')](_0x24724f[_0x7e04('0x3c')],function(_0x46281d){var _0x295793={};_0x295793[_0x46281d]={'$like':'%'+_0x54d54c['query'][_0x7e04('0x45')]+'%'};return _0x295793;})});}_0x24724f=_[_0x7e04('0x4b')]({},_0x24724f,_0x54d54c['options']);return _0x23ddfb[_0x7e04('0x89')](_0x24724f);}})[_0x7e04('0x29')](function(_0x5bb751){if(_0x5bb751){_0x5b9320=_0x5bb751['length'];if(!_0x54d54c[_0x7e04('0x37')]['hasOwnProperty'](_0x7e04('0x3f'))){_0x24724f[_0x7e04('0x40')]=qs[_0x7e04('0x40')](_0x54d54c[_0x7e04('0x37')]['limit']);_0x24724f[_0x7e04('0x22')]=qs[_0x7e04('0x22')](_0x54d54c[_0x7e04('0x37')][_0x7e04('0x22')]);}return _0x23ddfb['getAgents'](_0x24724f);}})[_0x7e04('0x29')](function(_0x5c9c0c){if(_0x5c9c0c){return _0x5c9c0c?{'count':_0x5b9320,'rows':_0x5c9c0c}:null;}})[_0x7e04('0x29')](respondWithResult(_0x42546f,null))[_0x7e04('0x4a')](handleError(_0x42546f,null));}; \ No newline at end of file +var _0x3a8a=['describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','where','WhatsappQueueId','User','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','each','emit','userWhatsappQueue:save','removeTeams','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','end','json','count','offset','set','apply','save','update','then','destroy','get','WhatsappQueues','sendStatus','error','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','limit','order','sort','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params'];(function(_0x1360bb,_0x3f5003){var _0x26812a=function(_0x46ca5a){while(--_0x46ca5a){_0x1360bb['push'](_0x1360bb['shift']());}};_0x26812a(++_0x3f5003);}(_0x3a8a,0x1bf));var _0xa3a8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3a8a[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0xa3a8('0x0'));var emlformat=require(_0xa3a8('0x1'));var rimraf=require(_0xa3a8('0x2'));var zipdir=require(_0xa3a8('0x3'));var jsonpatch=require(_0xa3a8('0x4'));var rp=require(_0xa3a8('0x5'));var moment=require(_0xa3a8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa3a8('0x7'));var util=require(_0xa3a8('0x8'));var path=require(_0xa3a8('0x9'));var sox=require('sox');var csv=require(_0xa3a8('0xa'));var ejs=require(_0xa3a8('0xb'));var fs=require('fs');var _=require(_0xa3a8('0xc'));var squel=require(_0xa3a8('0xd'));var crypto=require(_0xa3a8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa3a8('0xa'));var querystring=require('querystring');var Papa=require(_0xa3a8('0xf'));var Redis=require(_0xa3a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa3a8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa3a8('0x12'));var utils=require(_0xa3a8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3a8('0x14'))['db'];config['redis']=_[_0xa3a8('0x15')](config[_0xa3a8('0x16')],{'host':_0xa3a8('0x17'),'port':0x18eb});var socket=require(_0xa3a8('0x18'))(new Redis(config[_0xa3a8('0x16')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x204f16,_0x465e52){_0x465e52=_0x465e52||0xcc;return function(_0x4b869d){if(_0x4b869d){return _0x204f16['sendStatus'](_0x465e52);}return _0x204f16[_0xa3a8('0x19')](_0x465e52)[_0xa3a8('0x1a')]();};}function respondWithResult(_0x665bf0,_0x511872){_0x511872=_0x511872||0xc8;return function(_0x1a16cc){if(_0x1a16cc){return _0x665bf0['status'](_0x511872)[_0xa3a8('0x1b')](_0x1a16cc);}};}function respondWithFilteredResult(_0x5d7e7b,_0x4ef746){return function(_0x2aebb4){if(_0x2aebb4){var _0x48ea21=_0x2aebb4[_0xa3a8('0x1c')],_0x4c4925=_0x4ef746[_0xa3a8('0x1d')],_0x161680=_0x4ef746[_0xa3a8('0x1d')]+_0x4ef746['limit'],_0x1cc47e;if(_0x161680>=_0x48ea21){_0x161680=_0x48ea21;_0x1cc47e=0xc8;}else{_0x1cc47e=0xce;}_0x5d7e7b[_0xa3a8('0x19')](_0x1cc47e);return _0x5d7e7b[_0xa3a8('0x1e')]('Content-Range',_0x4c4925+'-'+_0x161680+'/'+_0x48ea21)[_0xa3a8('0x1b')](_0x2aebb4);}return null;};}function patchUpdates(_0x44b4ec){return function(_0x5ce470){try{jsonpatch[_0xa3a8('0x1f')](_0x5ce470,_0x44b4ec,!![]);}catch(_0x4f25e2){return BPromise['reject'](_0x4f25e2);}return _0x5ce470[_0xa3a8('0x20')]();};}function saveUpdates(_0x3cbbd1,_0x26e8a2){return function(_0x492743){if(_0x492743){return _0x492743[_0xa3a8('0x21')](_0x3cbbd1)[_0xa3a8('0x22')](function(_0x3fc13f){return _0x3fc13f;});}return null;};}function removeEntity(_0x5ef229,_0x1a4dc0){return function(_0x5e4701){if(_0x5e4701){return _0x5e4701[_0xa3a8('0x23')]()[_0xa3a8('0x22')](function(){var _0x5585fc=_0x5e4701[_0xa3a8('0x24')]({'plain':!![]});var _0x34cf29=_0xa3a8('0x25');return db['UserProfileResource'][_0xa3a8('0x23')]({'where':{'type':_0x34cf29,'resourceId':_0x5585fc['id']}})[_0xa3a8('0x22')](function(){return _0x5e4701;});})['then'](function(){_0x5ef229[_0xa3a8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eba1a,_0x3e2a7c){return function(_0x5af624){if(!_0x5af624){_0x2eba1a[_0xa3a8('0x26')](0x194);}return _0x5af624;};}function handleError(_0x45beb9,_0x585522){_0x585522=_0x585522||0x1f4;return function(_0x47de4e){logger[_0xa3a8('0x27')](_0x47de4e['stack']);if(_0x47de4e['name']){delete _0x47de4e[_0xa3a8('0x28')];}_0x45beb9['status'](_0x585522)[_0xa3a8('0x29')](_0x47de4e);};}exports['index']=function(_0x52cdf4,_0x1117d9){var _0xef6620={},_0x2fd533={},_0x173922={'count':0x0,'rows':[]};var _0x1176d7=_[_0xa3a8('0x2a')](db[_0xa3a8('0x2b')][_0xa3a8('0x2c')],function(_0x78b0b0){return{'name':_0x78b0b0[_0xa3a8('0x2d')],'type':_0x78b0b0[_0xa3a8('0x2e')][_0xa3a8('0x2f')]};});_0x2fd533[_0xa3a8('0x30')]=_['map'](_0x1176d7,_0xa3a8('0x28'));_0x2fd533['query']=_['keys'](_0x52cdf4[_0xa3a8('0x31')]);_0x2fd533['filters']=_[_0xa3a8('0x32')](_0x2fd533[_0xa3a8('0x30')],_0x2fd533['query']);_0xef6620['attributes']=_[_0xa3a8('0x32')](_0x2fd533[_0xa3a8('0x30')],qs[_0xa3a8('0x33')](_0x52cdf4['query'][_0xa3a8('0x33')]));_0xef6620[_0xa3a8('0x34')]=_0xef6620['attributes'][_0xa3a8('0x35')]?_0xef6620[_0xa3a8('0x34')]:_0x2fd533[_0xa3a8('0x30')];if(!_0x52cdf4['query']['hasOwnProperty'](_0xa3a8('0x36'))){_0xef6620[_0xa3a8('0x37')]=qs[_0xa3a8('0x37')](_0x52cdf4['query']['limit']);_0xef6620[_0xa3a8('0x1d')]=qs['offset'](_0x52cdf4[_0xa3a8('0x31')][_0xa3a8('0x1d')]);}_0xef6620[_0xa3a8('0x38')]=qs[_0xa3a8('0x39')](_0x52cdf4[_0xa3a8('0x31')][_0xa3a8('0x39')]);_0xef6620['where']=qs[_0xa3a8('0x3a')](_[_0xa3a8('0x3b')](_0x52cdf4[_0xa3a8('0x31')],_0x2fd533[_0xa3a8('0x3a')]),_0x1176d7);if(_0x52cdf4[_0xa3a8('0x31')][_0xa3a8('0x3c')]){_0xef6620['where']=_[_0xa3a8('0x3d')](_0xef6620['where'],{'$or':_[_0xa3a8('0x2a')](_0x1176d7,function(_0x5b395f){if(_0x5b395f[_0xa3a8('0x2e')]!=='VIRTUAL'){var _0x1c0c20={};_0x1c0c20[_0x5b395f['name']]={'$like':'%'+_0x52cdf4[_0xa3a8('0x31')]['filter']+'%'};return _0x1c0c20;}})});}_0xef6620=_['merge']({},_0xef6620,_0x52cdf4[_0xa3a8('0x3e')]);var _0x4154d9={'where':_0xef6620['where']};return db[_0xa3a8('0x2b')][_0xa3a8('0x1c')](_0x4154d9)[_0xa3a8('0x22')](function(_0x506050){_0x173922[_0xa3a8('0x1c')]=_0x506050;if(_0x52cdf4[_0xa3a8('0x31')][_0xa3a8('0x3f')]){_0xef6620[_0xa3a8('0x40')]=[{'all':!![]}];}return db[_0xa3a8('0x2b')][_0xa3a8('0x41')](_0xef6620);})[_0xa3a8('0x22')](function(_0x282315){_0x173922[_0xa3a8('0x42')]=_0x282315;return _0x173922;})[_0xa3a8('0x22')](respondWithFilteredResult(_0x1117d9,_0xef6620))[_0xa3a8('0x43')](handleError(_0x1117d9,null));};exports[_0xa3a8('0x44')]=function(_0xb15041,_0x13f061){var _0x35ce0b={'raw':!![],'where':{'id':_0xb15041['params']['id']}},_0x39e2f6={};_0x39e2f6['model']=_[_0xa3a8('0x45')](db[_0xa3a8('0x2b')][_0xa3a8('0x2c')]);_0x39e2f6[_0xa3a8('0x31')]=_['keys'](_0xb15041[_0xa3a8('0x31')]);_0x39e2f6[_0xa3a8('0x3a')]=_[_0xa3a8('0x32')](_0x39e2f6[_0xa3a8('0x30')],_0x39e2f6[_0xa3a8('0x31')]);_0x35ce0b[_0xa3a8('0x34')]=_['intersection'](_0x39e2f6[_0xa3a8('0x30')],qs['fields'](_0xb15041[_0xa3a8('0x31')]['fields']));_0x35ce0b[_0xa3a8('0x34')]=_0x35ce0b[_0xa3a8('0x34')]['length']?_0x35ce0b[_0xa3a8('0x34')]:_0x39e2f6['model'];if(_0xb15041[_0xa3a8('0x31')]['includeAll']){_0x35ce0b['include']=[{'all':!![]}];}_0x35ce0b=_['merge']({},_0x35ce0b,_0xb15041[_0xa3a8('0x3e')]);return db['WhatsappQueue'][_0xa3a8('0x46')](_0x35ce0b)['then'](handleEntityNotFound(_0x13f061,null))[_0xa3a8('0x22')](respondWithResult(_0x13f061,null))[_0xa3a8('0x43')](handleError(_0x13f061,null));};exports[_0xa3a8('0x47')]=function(_0x35567d,_0x760862){return db[_0xa3a8('0x2b')][_0xa3a8('0x47')](_0x35567d['body'],{})[_0xa3a8('0x22')](function(_0xb751a9){var _0x551fe4=_0x35567d['user'][_0xa3a8('0x24')]({'plain':!![]});if(!_0x551fe4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x551fe4[_0xa3a8('0x48')]===_0xa3a8('0x49')){var _0x40d328=_0xb751a9[_0xa3a8('0x24')]({'plain':!![]});var _0xd5f4b7=_0xa3a8('0x25');return db[_0xa3a8('0x4a')][_0xa3a8('0x46')]({'where':{'name':_0xd5f4b7,'userProfileId':_0x551fe4[_0xa3a8('0x4b')]},'raw':!![]})[_0xa3a8('0x22')](function(_0x48339d){if(_0x48339d&&_0x48339d[_0xa3a8('0x4c')]===0x0){return db[_0xa3a8('0x4d')][_0xa3a8('0x47')]({'name':_0x40d328[_0xa3a8('0x28')],'resourceId':_0x40d328['id'],'type':_0x48339d[_0xa3a8('0x28')],'sectionId':_0x48339d['id']},{})[_0xa3a8('0x22')](function(){return _0xb751a9;});}else{return _0xb751a9;}})['catch'](function(_0x224cdf){logger[_0xa3a8('0x27')](_0xa3a8('0x4e'),_0x224cdf);throw _0x224cdf;});}return _0xb751a9;})[_0xa3a8('0x22')](respondWithResult(_0x760862,0xc9))['catch'](handleError(_0x760862,null));};exports[_0xa3a8('0x21')]=function(_0x17f432,_0x3d5a24){if(_0x17f432[_0xa3a8('0x4f')]['id']){delete _0x17f432[_0xa3a8('0x4f')]['id'];}return db[_0xa3a8('0x2b')]['find']({'where':{'id':_0x17f432[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](handleEntityNotFound(_0x3d5a24,null))[_0xa3a8('0x22')](saveUpdates(_0x17f432[_0xa3a8('0x4f')],null))['then'](respondWithResult(_0x3d5a24,null))[_0xa3a8('0x43')](handleError(_0x3d5a24,null));};exports['destroy']=function(_0x2a25e0,_0x283870){return db[_0xa3a8('0x2b')][_0xa3a8('0x46')]({'where':{'id':_0x2a25e0[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](handleEntityNotFound(_0x283870,null))[_0xa3a8('0x22')](removeEntity(_0x283870,null))[_0xa3a8('0x43')](handleError(_0x283870,null));};exports[_0xa3a8('0x51')]=function(_0x5bde0d,_0x43a7c0){return db[_0xa3a8('0x2b')][_0xa3a8('0x51')]()[_0xa3a8('0x22')](respondWithResult(_0x43a7c0,null))[_0xa3a8('0x43')](handleError(_0x43a7c0,null));};exports[_0xa3a8('0x52')]=function(_0x23c5ba,_0x2ada41,_0x16010b){var _0x374b0a={'raw':!![],'where':{}},_0x3a0e80={},_0x5c3841;return db[_0xa3a8('0x2b')][_0xa3a8('0x53')]({'where':{'id':_0x23c5ba[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](handleEntityNotFound(_0x2ada41,null))[_0xa3a8('0x22')](function(_0x5611d2){if(_0x5611d2){_0x5c3841=_0x5611d2['get']({'plain':!![]});_0x3a0e80[_0xa3a8('0x30')]=_['keys'](db[_0xa3a8('0x54')][_0xa3a8('0x2c')]);_0x3a0e80[_0xa3a8('0x31')]=_[_0xa3a8('0x45')](_0x23c5ba[_0xa3a8('0x31')]);_0x3a0e80['filters']=_[_0xa3a8('0x32')](_0x3a0e80[_0xa3a8('0x30')],_0x3a0e80[_0xa3a8('0x31')]);_0x374b0a[_0xa3a8('0x34')]=_['intersection'](_0x3a0e80[_0xa3a8('0x30')],qs[_0xa3a8('0x33')](_0x23c5ba[_0xa3a8('0x31')]['fields']));_0x374b0a[_0xa3a8('0x34')]=_0x374b0a[_0xa3a8('0x34')][_0xa3a8('0x35')]?_0x374b0a[_0xa3a8('0x34')]:_0x3a0e80[_0xa3a8('0x30')];if(!_0x23c5ba[_0xa3a8('0x31')][_0xa3a8('0x55')](_0xa3a8('0x36'))){_0x374b0a['limit']=qs[_0xa3a8('0x37')](_0x23c5ba[_0xa3a8('0x31')]['limit']);_0x374b0a[_0xa3a8('0x1d')]=qs[_0xa3a8('0x1d')](_0x23c5ba[_0xa3a8('0x31')][_0xa3a8('0x1d')]);}_0x374b0a[_0xa3a8('0x38')]=qs[_0xa3a8('0x39')](_0x23c5ba['query'][_0xa3a8('0x39')]);_0x374b0a[_0xa3a8('0x56')]=qs['filters'](_[_0xa3a8('0x3b')](_0x23c5ba[_0xa3a8('0x31')],_0x3a0e80['filters']));_0x374b0a['where'][_0xa3a8('0x57')]=_0x5611d2['id'];if(_0x23c5ba[_0xa3a8('0x31')][_0xa3a8('0x3c')]){_0x374b0a[_0xa3a8('0x56')]=_[_0xa3a8('0x3d')](_0x374b0a[_0xa3a8('0x56')],{'$or':_[_0xa3a8('0x2a')](_0x374b0a['attributes'],function(_0x22c428){var _0x170fb8={};_0x170fb8[_0x22c428]={'$like':'%'+_0x23c5ba[_0xa3a8('0x31')][_0xa3a8('0x3c')]+'%'};return _0x170fb8;})});}_0x374b0a=_[_0xa3a8('0x3d')]({},_0x374b0a,_0x23c5ba[_0xa3a8('0x3e')]);return db[_0xa3a8('0x54')]['findAll'](_0x374b0a);}})['then'](function(_0x1e847f){if(_0x1e847f){return db[_0xa3a8('0x58')]['findAndCountAll']({'where':{'id':_[_0xa3a8('0x2a')](_0x1e847f,'UserId'),'role':_0xa3a8('0x59')},'attributes':['id',_0xa3a8('0x28'),_0xa3a8('0x5a'),_0xa3a8('0x5b'),_0xa3a8('0x5c')]});}})[_0xa3a8('0x22')](function(_0x49b5ce){if(_0x49b5ce){return{'count':_0x49b5ce[_0xa3a8('0x1c')],'rows':_[_0xa3a8('0x2a')](_0x49b5ce[_0xa3a8('0x42')],function(_0x1dffa6){return{'membername':_0x1dffa6[_0xa3a8('0x28')],'UserId':_0x1dffa6['id'],'queue_name':_0x5c3841['name'],'WhatsappQueueId':_0x5c3841['id'],'interface':util[_0xa3a8('0x5d')](_0xa3a8('0x5e'),'SIP',_0x1dffa6[_0xa3a8('0x28')]),'penalty':0x0,'paused':_0x1dffa6[_0xa3a8('0x5a')],'createdAt':_0x1dffa6[_0xa3a8('0x5c')],'updatedAt':_0x1dffa6[_0xa3a8('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ada41,_0x374b0a))[_0xa3a8('0x43')](handleError(_0x2ada41,null));};exports[_0xa3a8('0x5f')]=function(_0x16cf67,_0x236f23,_0x54f1d8){var _0x50d7e5={};var _0x4d30dd={};var _0xf7d86e;var _0x5f3056;return db[_0xa3a8('0x2b')][_0xa3a8('0x53')]({'where':{'id':_0x16cf67[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](handleEntityNotFound(_0x236f23,null))[_0xa3a8('0x22')](function(_0x7ef24c){if(_0x7ef24c){_0xf7d86e=_0x7ef24c;_0x4d30dd[_0xa3a8('0x30')]=_[_0xa3a8('0x45')](db['Team'][_0xa3a8('0x2c')]);_0x4d30dd['query']=_['keys'](_0x16cf67[_0xa3a8('0x31')]);_0x4d30dd['filters']=_[_0xa3a8('0x32')](_0x4d30dd[_0xa3a8('0x30')],_0x4d30dd[_0xa3a8('0x31')]);_0x50d7e5['attributes']=_['intersection'](_0x4d30dd[_0xa3a8('0x30')],qs['fields'](_0x16cf67[_0xa3a8('0x31')][_0xa3a8('0x33')]));_0x50d7e5[_0xa3a8('0x34')]=_0x50d7e5[_0xa3a8('0x34')][_0xa3a8('0x35')]?_0x50d7e5['attributes']:_0x4d30dd['model'];_0x50d7e5[_0xa3a8('0x38')]=qs['sort'](_0x16cf67[_0xa3a8('0x31')][_0xa3a8('0x39')]);_0x50d7e5[_0xa3a8('0x56')]=qs[_0xa3a8('0x3a')](_['pick'](_0x16cf67[_0xa3a8('0x31')],_0x4d30dd[_0xa3a8('0x3a')]));if(_0x16cf67[_0xa3a8('0x31')]['filter']){_0x50d7e5[_0xa3a8('0x56')]=_[_0xa3a8('0x3d')](_0x50d7e5[_0xa3a8('0x56')],{'$or':_[_0xa3a8('0x2a')](_0x50d7e5[_0xa3a8('0x34')],function(_0x25c9c9){var _0x51c550={};_0x51c550[_0x25c9c9]={'$like':'%'+_0x16cf67[_0xa3a8('0x31')][_0xa3a8('0x3c')]+'%'};return _0x51c550;})});}_0x50d7e5=_[_0xa3a8('0x3d')]({},_0x50d7e5,_0x16cf67[_0xa3a8('0x3e')]);return _0xf7d86e[_0xa3a8('0x5f')](_0x50d7e5);}})[_0xa3a8('0x22')](function(_0x2b08d4){if(_0x2b08d4){_0x5f3056=_0x2b08d4['length'];if(!_0x16cf67[_0xa3a8('0x31')][_0xa3a8('0x55')](_0xa3a8('0x36'))){_0x50d7e5[_0xa3a8('0x37')]=qs[_0xa3a8('0x37')](_0x16cf67['query']['limit']);_0x50d7e5['offset']=qs['offset'](_0x16cf67[_0xa3a8('0x31')][_0xa3a8('0x1d')]);}return _0xf7d86e['getTeams'](_0x50d7e5);}})[_0xa3a8('0x22')](function(_0x25b518){if(_0x25b518){return _0x25b518?{'count':_0x5f3056,'rows':_0x25b518}:null;}})[_0xa3a8('0x22')](respondWithResult(_0x236f23,null))[_0xa3a8('0x43')](handleError(_0x236f23,null));};exports[_0xa3a8('0x60')]=function(_0xc2d7cf,_0x416822,_0x4ee9e5){var _0x37bcab=_0xc2d7cf[_0xa3a8('0x4f')][_0xa3a8('0x61')];return db[_0xa3a8('0x62')][_0xa3a8('0x41')]({'where':{'id':_0x37bcab},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa3a8('0x28'),_0xa3a8('0x63'),_0xa3a8('0x64'),_0xa3a8('0x65')],'raw':!![]}]})[_0xa3a8('0x22')](function(_0x5ceb77){if(_0x5ceb77){var _0x22abf3=_['flatMap'](_0x5ceb77,function(_0x169a77){var _0x3a1f5b=_0x169a77['get']({'plain':!![]});return _0x3a1f5b[_0xa3a8('0x66')];});return db[_0xa3a8('0x2b')][_0xa3a8('0x46')]({'where':{'id':_0xc2d7cf[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](function(_0x5547a4){return db[_0xa3a8('0x67')]['transaction'](function(_0x580dcd){return _0x5547a4['addTeams'](_0x37bcab,{'transaction':_0x580dcd})[_0xa3a8('0x22')](function(){return BPromise[_0xa3a8('0x68')](_0x22abf3,function(_0x248a78){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x248a78['id'],'WhatsappQueueId':_0xc2d7cf[_0xa3a8('0x50')]['id']},'transaction':_0x580dcd});});})[_0xa3a8('0x22')](function(){_0x22abf3['forEach'](function(_0x2df588){socket[_0xa3a8('0x69')](_0xa3a8('0x6a'),{'UserId':_0x2df588['id'],'WhatsappQueueId':_0x5547a4['id']});});});});});}})[_0xa3a8('0x22')](respondWithStatusCode(_0x416822,null))[_0xa3a8('0x43')](handleError(_0x416822,null));};exports[_0xa3a8('0x6b')]=function(_0xd58550,_0x578095,_0x9b6807){return db[_0xa3a8('0x62')][_0xa3a8('0x41')]({'where':{'id':_0xd58550[_0xa3a8('0x31')][_0xa3a8('0x61')]},'attributes':['id'],'include':[{'model':db[_0xa3a8('0x58')],'as':_0xa3a8('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x578095,null))[_0xa3a8('0x22')](function(_0x28200e){var _0x488e1e=_[_0xa3a8('0x2a')](_0x28200e,'id');var _0x3b7995=[];var _0x3efe05=[];var _0xdee453=squel['select']();_0xdee453[_0xa3a8('0x6c')]('tq.TeamId')[_0xa3a8('0x6d')]('team_has_whatsapp_queues','tq')['join'](_0xa3a8('0x6e'),'ut',_0xa3a8('0x6f'))[_0xa3a8('0x56')]('WhatsappQueueId\x20=\x20?',_0xd58550[_0xa3a8('0x50')]['id']);for(var _0x57203d=0x0;_0x57203d<_0x28200e[_0xa3a8('0x35')];_0x57203d+=0x1){let _0x18835e=_0x28200e[_0x57203d];for(var _0x38b8ca=0x0;_0x38b8ca<_0x18835e[_0xa3a8('0x66')][_0xa3a8('0x35')];_0x38b8ca+=0x1){let _0x17880c=_0x18835e[_0xa3a8('0x66')][_0x38b8ca];var _0x3c23d4=_0xdee453[_0xa3a8('0x70')]();_0x3c23d4[_0xa3a8('0x56')]('ut.UserId\x20=\x20?',_0x17880c['id']);_0x3efe05[_0xa3a8('0x71')](db[_0xa3a8('0x67')]['query'](_0x3c23d4[_0xa3a8('0x72')](),{'type':db[_0xa3a8('0x67')][_0xa3a8('0x73')][_0xa3a8('0x74')]})[_0xa3a8('0x22')](function(_0x2095c2){if(_0x2095c2[_0xa3a8('0x35')]===0x1){return _0x17880c['id'];}else{var _0x5034a9=_[_0xa3a8('0x75')](_[_0xa3a8('0x2a')](_0x2095c2,_0xa3a8('0x76')),function(_0x20eef1){return _[_0xa3a8('0x77')](_0x488e1e,_0x20eef1);});if(_0x5034a9){return _0x17880c['id'];}}}));}}return BPromise[_0xa3a8('0x78')](_0x3efe05)[_0xa3a8('0x22')](function(_0x42b8e0){_0x3b7995=_(_0x3b7995)[_0xa3a8('0x79')](_0x42b8e0)[_0xa3a8('0x7a')]()[_0xa3a8('0x7b')]();return db[_0xa3a8('0x2b')][_0xa3a8('0x46')]({'where':{'id':_0xd58550[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](function(_0x55644f){return db['sequelize'][_0xa3a8('0x7c')](function(_0x44025d){return _0x55644f[_0xa3a8('0x6b')](_0xd58550[_0xa3a8('0x31')][_0xa3a8('0x61')],{'transaction':_0x44025d})[_0xa3a8('0x22')](function(){if(!_[_0xa3a8('0x7d')](_0x3b7995)){return _0x55644f[_0xa3a8('0x7e')](_0x3b7995,{'transaction':_0x44025d});}})[_0xa3a8('0x22')](function(){_0x3b7995[_0xa3a8('0x7f')](function(_0x380e52){socket['emit'](_0xa3a8('0x80'),{'UserId':_0x380e52,'WhatsappQueueId':_0x55644f['id']});});});});});});})['then'](respondWithStatusCode(_0x578095,null))['catch'](handleError(_0x578095,null));};exports['addAgents']=function(_0x2757fe,_0x1bfe89,_0x438f7b){return db[_0xa3a8('0x2b')][_0xa3a8('0x46')]({'where':{'id':_0x2757fe[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](handleEntityNotFound(_0x1bfe89,null))[_0xa3a8('0x22')](function(_0x41d094){if(_0x41d094){return _0x41d094['addAgents'](_0x2757fe[_0xa3a8('0x4f')][_0xa3a8('0x61')],_[_0xa3a8('0x81')](_0x2757fe['body'],['ids','id'])||{})['spread'](function(_0x32fde4){for(var _0x398b4a=0x0;_0x398b4a<_0x2757fe[_0xa3a8('0x4f')][_0xa3a8('0x61')]['length'];_0x398b4a+=0x1){socket['emit'](_0xa3a8('0x6a'),{'UserId':_0x2757fe[_0xa3a8('0x4f')][_0xa3a8('0x61')][_0x398b4a],'WhatsappQueueId':_0x2757fe['params']['id']});}return _0x32fde4;});}})[_0xa3a8('0x22')](respondWithResult(_0x1bfe89,null))['catch'](handleError(_0x1bfe89,null));};exports[_0xa3a8('0x7e')]=function(_0x592760,_0xaefcef,_0x49937b){return db[_0xa3a8('0x2b')][_0xa3a8('0x46')]({'where':{'id':_0x592760[_0xa3a8('0x50')]['id']}})['then'](handleEntityNotFound(_0xaefcef,null))[_0xa3a8('0x22')](function(_0x57a933){if(_0x57a933){return _0x57a933[_0xa3a8('0x7e')](_0x592760[_0xa3a8('0x31')][_0xa3a8('0x61')])[_0xa3a8('0x22')](function(){if(_[_0xa3a8('0x82')](_0x592760[_0xa3a8('0x31')][_0xa3a8('0x61')])){for(var _0x320b02=0x0;_0x320b02<_0x592760[_0xa3a8('0x31')]['ids'][_0xa3a8('0x35')];_0x320b02+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x592760['query'][_0xa3a8('0x61')][_0x320b02]),'WhatsappQueueId':Number(_0x592760[_0xa3a8('0x50')]['id'])});}}else{socket[_0xa3a8('0x69')](_0xa3a8('0x80'),{'UserId':Number(_0x592760[_0xa3a8('0x31')][_0xa3a8('0x61')]),'WhatsappQueueId':Number(_0x592760['params']['id'])});}});}})[_0xa3a8('0x22')](respondWithStatusCode(_0xaefcef,null))['catch'](handleError(_0xaefcef,null));};exports['getAgents']=function(_0x430274,_0x21df9d,_0x44e096){var _0x4d7742={};var _0x4c69a0={};var _0x4818fa;var _0x44c471;return db[_0xa3a8('0x2b')][_0xa3a8('0x53')]({'where':{'id':_0x430274[_0xa3a8('0x50')]['id']}})[_0xa3a8('0x22')](handleEntityNotFound(_0x21df9d,null))['then'](function(_0x5ca6bb){if(_0x5ca6bb){_0x4818fa=_0x5ca6bb;_0x4c69a0[_0xa3a8('0x30')]=_[_0xa3a8('0x45')](db[_0xa3a8('0x58')][_0xa3a8('0x2c')]);_0x4c69a0['query']=_['keys'](_0x430274[_0xa3a8('0x31')]);_0x4c69a0[_0xa3a8('0x3a')]=_['intersection'](_0x4c69a0[_0xa3a8('0x30')],_0x4c69a0[_0xa3a8('0x31')]);_0x4d7742[_0xa3a8('0x34')]=_[_0xa3a8('0x32')](_0x4c69a0[_0xa3a8('0x30')],qs[_0xa3a8('0x33')](_0x430274['query']['fields']));_0x4d7742[_0xa3a8('0x34')]=_0x4d7742[_0xa3a8('0x34')][_0xa3a8('0x35')]?_0x4d7742[_0xa3a8('0x34')]:_0x4c69a0[_0xa3a8('0x30')];_0x4d7742[_0xa3a8('0x38')]=qs[_0xa3a8('0x39')](_0x430274['query'][_0xa3a8('0x39')]);_0x4d7742['where']=qs['filters'](_[_0xa3a8('0x3b')](_0x430274[_0xa3a8('0x31')],_0x4c69a0[_0xa3a8('0x3a')]));if(_0x430274[_0xa3a8('0x31')][_0xa3a8('0x3c')]){_0x4d7742[_0xa3a8('0x56')]=_[_0xa3a8('0x3d')](_0x4d7742[_0xa3a8('0x56')],{'$or':_[_0xa3a8('0x2a')](_0x4d7742[_0xa3a8('0x34')],function(_0x1aad12){var _0xc795ef={};_0xc795ef[_0x1aad12]={'$like':'%'+_0x430274[_0xa3a8('0x31')]['filter']+'%'};return _0xc795ef;})});}_0x4d7742=_[_0xa3a8('0x3d')]({},_0x4d7742,_0x430274[_0xa3a8('0x3e')]);return _0x4818fa['getAgents'](_0x4d7742);}})[_0xa3a8('0x22')](function(_0x5d54a8){if(_0x5d54a8){_0x44c471=_0x5d54a8[_0xa3a8('0x35')];if(!_0x430274[_0xa3a8('0x31')][_0xa3a8('0x55')](_0xa3a8('0x36'))){_0x4d7742[_0xa3a8('0x37')]=qs[_0xa3a8('0x37')](_0x430274['query'][_0xa3a8('0x37')]);_0x4d7742['offset']=qs['offset'](_0x430274[_0xa3a8('0x31')]['offset']);}return _0x4818fa[_0xa3a8('0x83')](_0x4d7742);}})['then'](function(_0x6b8c69){if(_0x6b8c69){return _0x6b8c69?{'count':_0x44c471,'rows':_0x6b8c69}:null;}})[_0xa3a8('0x22')](respondWithResult(_0x21df9d,null))['catch'](handleError(_0x21df9d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 22d78c0..dc3a5c3 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 _0x7a0a=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3f8911,_0x3e7a22){var _0x1ce397=function(_0x230c5e){while(--_0x230c5e){_0x3f8911['push'](_0x3f8911['shift']());}};_0x1ce397(++_0x3e7a22);}(_0x7a0a,0xfd));var _0xa7a0=function(_0x2189d1,_0x4e67a0){_0x2189d1=_0x2189d1-0x0;var _0xc909eb=_0x7a0a[_0x2189d1];return _0xc909eb;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xa7a0('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa7a0('0x1')](0x0);var events={'afterCreate':_0xa7a0('0x2'),'afterUpdate':_0xa7a0('0x3'),'afterDestroy':_0xa7a0('0x4')};function emitEvent(_0x7378ef){return function(_0x41b9a3,_0x23226f,_0x4a52d8){WhatsappQueueEvents[_0xa7a0('0x5')](_0x7378ef+':'+_0x41b9a3['id'],_0x41b9a3);WhatsappQueueEvents[_0xa7a0('0x5')](_0x7378ef,_0x41b9a3);_0x4a52d8(null);};}for(var e in events){if(events[_0xa7a0('0x6')](e)){var event=events[e];WhatsappQueue[_0xa7a0('0x7')](e,emitEvent(event));}}module[_0xa7a0('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xbe86=['update','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xbe86,0x18d));var _0x6be8=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0xbe86[_0xb3b452];return _0x238983;};'use strict';var EventEmitter=require(_0x6be8('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6be8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6be8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6be8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x48a9c1){return function(_0x4112b8,_0x27ac3c,_0x33f8b5){WhatsappQueueEvents[_0x6be8('0x4')](_0x48a9c1+':'+_0x4112b8['id'],_0x4112b8);WhatsappQueueEvents[_0x6be8('0x4')](_0x48a9c1,_0x4112b8);_0x33f8b5(null);};}for(var e in events){if(events[_0x6be8('0x5')](e)){var event=events[e];WhatsappQueue[_0x6be8('0x6')](e,emitEvent(event));}}module[_0x6be8('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 5788a40..43fdfab 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 _0x9163=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','WhatsappQueue','lodash'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x9163,0x1a6));var _0x3916=function(_0x2d0a70,_0x28fe51){_0x2d0a70=_0x2d0a70-0x0;var _0x127de3=_0x9163[_0x2d0a70];return _0x127de3;};'use strict';var _=require(_0x3916('0x0'));var util=require(_0x3916('0x1'));var logger=require(_0x3916('0x2'))(_0x3916('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3916('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3916('0x5'));var config=require(_0x3916('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x3916('0x7')]=function(_0x582343,_0xc9159b){return _0x582343['define'](_0x3916('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae51=['moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x2be1ef,_0x1a4093){var _0x2741e2=function(_0x4ca85f){while(--_0x4ca85f){_0x2be1ef['push'](_0x2be1ef['shift']());}};_0x2741e2(++_0x1a4093);}(_0xae51,0x110));var _0x1ae5=function(_0x41ca6d,_0x1172ed){_0x41ca6d=_0x41ca6d-0x0;var _0x34fd50=_0xae51[_0x41ca6d];return _0x34fd50;};'use strict';var _=require(_0x1ae5('0x0'));var util=require(_0x1ae5('0x1'));var logger=require(_0x1ae5('0x2'))(_0x1ae5('0x3'));var moment=require(_0x1ae5('0x4'));var BPromise=require(_0x1ae5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ae5('0x6'));var rimraf=require(_0x1ae5('0x7'));var config=require(_0x1ae5('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x1ae5('0x9')]=function(_0xbbb77c,_0x205cb9){return _0xbbb77c['define'](_0x1ae5('0xa'),attributes,{'tableName':_0x1ae5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 34068dd..19c2b5c 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 _0x214e=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','WhatsappQueue','findAll','options','raw','where','limit','include','attributes','map','model','GetWhatsappQueue','stringify','catch','ShowWhatsappQueue','find','debug','lodash','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x290fc9,_0x3069fe){var _0x31c8bd=function(_0x4bec21){while(--_0x4bec21){_0x290fc9['push'](_0x290fc9['shift']());}};_0x31c8bd(++_0x3069fe);}(_0x214e,0x12a));var _0xe214=function(_0x2737a6,_0x8a30e2){_0x2737a6=_0x2737a6-0x0;var _0x182bbf=_0x214e[_0x2737a6];return _0x182bbf;};'use strict';var _=require(_0xe214('0x0'));var util=require('util');var moment=require(_0xe214('0x1'));var BPromise=require(_0xe214('0x2'));var rs=require(_0xe214('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe214('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe214('0x5'));var config=require(_0xe214('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe214('0x7')][_0xe214('0x8')]({'port':0x232a});config[_0xe214('0x9')]=_[_0xe214('0xa')](config[_0xe214('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe214('0xb'))(new Redis(config[_0xe214('0x9')]));require(_0xe214('0xc'))['register'](socket);function respondWithRpcPromise(_0x305e76,_0x142374,_0x26d856){return new BPromise(function(_0x41c566,_0x47f7d8){return client[_0xe214('0xd')](_0x305e76,_0x26d856)[_0xe214('0xe')](function(_0x408574){logger['info'](_0xe214('0xf'),_0x142374,_0xe214('0x10'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x142374,_0xe214('0x10'),JSON['stringify'](_0x408574));if(_0x408574['error']){if(_0x408574['error'][_0xe214('0x11')]===0x1f4){logger[_0xe214('0x12')](_0xe214('0xf'),_0x142374,_0x408574['error']['message']);return _0x47f7d8(_0x408574[_0xe214('0x12')][_0xe214('0x13')]);}logger[_0xe214('0x12')](_0xe214('0xf'),_0x142374,_0x408574[_0xe214('0x12')]['message']);return _0x41c566(_0x408574['error'][_0xe214('0x13')]);}else{logger[_0xe214('0x14')](_0xe214('0xf'),_0x142374,_0xe214('0x10'));_0x41c566(_0x408574[_0xe214('0x15')][_0xe214('0x13')]);}})['catch'](function(_0x2ad602){logger[_0xe214('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x142374,_0x2ad602);_0x47f7d8(_0x2ad602);});});}exports['GetWhatsappQueue']=function(_0xf86b2f){var _0x17b144=this;return new Promise(function(_0x3433ca,_0xfdb7e2){return db[_0xe214('0x16')][_0xe214('0x17')]({'raw':_0xf86b2f[_0xe214('0x18')]?_0xf86b2f['options'][_0xe214('0x19')]===undefined?!![]:![]:!![],'where':_0xf86b2f[_0xe214('0x18')]?_0xf86b2f['options'][_0xe214('0x1a')]||null:null,'attributes':_0xf86b2f[_0xe214('0x18')]?_0xf86b2f[_0xe214('0x18')]['attributes']||null:null,'limit':_0xf86b2f[_0xe214('0x18')]?_0xf86b2f['options'][_0xe214('0x1b')]||null:null,'include':_0xf86b2f[_0xe214('0x18')]?_0xf86b2f[_0xe214('0x18')]['include']?_['map'](_0xf86b2f[_0xe214('0x18')][_0xe214('0x1c')],function(_0x590575){return{'model':db[_0x590575['model']],'as':_0x590575['as'],'attributes':_0x590575[_0xe214('0x1d')],'include':_0x590575[_0xe214('0x1c')]?_[_0xe214('0x1e')](_0x590575[_0xe214('0x1c')],function(_0x21070a){return{'model':db[_0x21070a[_0xe214('0x1f')]],'as':_0x21070a['as'],'attributes':_0x21070a[_0xe214('0x1d')],'include':_0x21070a[_0xe214('0x1c')]?_['map'](_0x21070a[_0xe214('0x1c')],function(_0x51e97e){return{'model':db[_0x51e97e[_0xe214('0x1f')]],'as':_0x51e97e['as'],'attributes':_0x51e97e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe214('0xe')](function(_0x78068c){logger[_0xe214('0x14')](_0xe214('0x20'),_0xf86b2f);logger['debug'](_0xe214('0x20'),_0xf86b2f,JSON[_0xe214('0x21')](_0x78068c));_0x3433ca(_0x78068c);})[_0xe214('0x22')](function(_0x3a030f){logger[_0xe214('0x12')]('GetWhatsappQueue',_0x3a030f[_0xe214('0x13')],_0xf86b2f);_0xfdb7e2(_0x17b144[_0xe214('0x12')](0x1f4,_0x3a030f[_0xe214('0x13')]));});});};exports[_0xe214('0x23')]=function(_0x24de37){var _0x273494=this;return new Promise(function(_0xd139e1,_0x54ac56){return db['WhatsappQueue'][_0xe214('0x24')]({'raw':_0x24de37[_0xe214('0x18')]?_0x24de37[_0xe214('0x18')][_0xe214('0x19')]===undefined?!![]:![]:!![],'where':_0x24de37['options']?_0x24de37[_0xe214('0x18')]['where']||null:null,'attributes':_0x24de37['options']?_0x24de37['options'][_0xe214('0x1d')]||null:null,'include':_0x24de37['options']?_0x24de37[_0xe214('0x18')][_0xe214('0x1c')]?_[_0xe214('0x1e')](_0x24de37[_0xe214('0x18')][_0xe214('0x1c')],function(_0x3fdf0d){return{'model':db[_0x3fdf0d[_0xe214('0x1f')]],'as':_0x3fdf0d['as'],'attributes':_0x3fdf0d[_0xe214('0x1d')],'include':_0x3fdf0d['include']?_['map'](_0x3fdf0d[_0xe214('0x1c')],function(_0x54c556){return{'model':db[_0x54c556[_0xe214('0x1f')]],'as':_0x54c556['as'],'attributes':_0x54c556[_0xe214('0x1d')],'include':_0x54c556[_0xe214('0x1c')]?_[_0xe214('0x1e')](_0x54c556[_0xe214('0x1c')],function(_0x1bc8df){return{'model':db[_0x1bc8df[_0xe214('0x1f')]],'as':_0x1bc8df['as'],'attributes':_0x1bc8df[_0xe214('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe214('0xe')](function(_0x8a631d){logger[_0xe214('0x14')](_0xe214('0x23'),_0x24de37);logger[_0xe214('0x25')](_0xe214('0x23'),_0x24de37,JSON[_0xe214('0x21')](_0x8a631d));_0xd139e1(_0x8a631d);})['catch'](function(_0x539f9d){logger[_0xe214('0x12')](_0xe214('0x23'),_0x539f9d[_0xe214('0x13')],_0x24de37);_0x54ac56(_0x273494['error'](0x1f4,_0x539f9d[_0xe214('0x13')]));});});}; \ No newline at end of file +var _0x9150=['redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','map','include','model','catch','find','ShowWhatsappQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x9150,0x1b9));var _0x0915=function(_0x169384,_0x598d20){_0x169384=_0x169384-0x0;var _0x2ce571=_0x9150[_0x169384];return _0x2ce571;};'use strict';var _=require('lodash');var util=require(_0x0915('0x0'));var moment=require('moment');var BPromise=require(_0x0915('0x1'));var rs=require(_0x0915('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0915('0x3'))['db'];var utils=require(_0x0915('0x4'));var logger=require(_0x0915('0x5'))(_0x0915('0x6'));var config=require(_0x0915('0x7'));var jayson=require(_0x0915('0x8'));var client=jayson['client'][_0x0915('0x9')]({'port':0x232a});config[_0x0915('0xa')]=_[_0x0915('0xb')](config[_0x0915('0xa')],{'host':_0x0915('0xc'),'port':0x18eb});var socket=require(_0x0915('0xd'))(new Redis(config['redis']));require(_0x0915('0xe'))[_0x0915('0xf')](socket);function respondWithRpcPromise(_0x5c1320,_0x2063fe,_0x5f10aa){return new BPromise(function(_0x126ee9,_0x28d21f){return client[_0x0915('0x10')](_0x5c1320,_0x5f10aa)[_0x0915('0x11')](function(_0x5094e1){logger[_0x0915('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2063fe,_0x0915('0x13'));logger[_0x0915('0x14')](_0x0915('0x15'),_0x2063fe,_0x0915('0x13'),JSON[_0x0915('0x16')](_0x5094e1));if(_0x5094e1[_0x0915('0x17')]){if(_0x5094e1[_0x0915('0x17')][_0x0915('0x18')]===0x1f4){logger[_0x0915('0x17')](_0x0915('0x19'),_0x2063fe,_0x5094e1['error']['message']);return _0x28d21f(_0x5094e1[_0x0915('0x17')][_0x0915('0x1a')]);}logger[_0x0915('0x17')](_0x0915('0x19'),_0x2063fe,_0x5094e1[_0x0915('0x17')][_0x0915('0x1a')]);return _0x126ee9(_0x5094e1['error'][_0x0915('0x1a')]);}else{logger[_0x0915('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2063fe,'request\x20sent');_0x126ee9(_0x5094e1[_0x0915('0x1b')][_0x0915('0x1a')]);}})['catch'](function(_0x7e8f77){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2063fe,_0x7e8f77);_0x28d21f(_0x7e8f77);});});}exports[_0x0915('0x1c')]=function(_0x293773){var _0xf2bc0f=this;return new Promise(function(_0x35ad0b,_0x3f45e4){return db[_0x0915('0x1d')][_0x0915('0x1e')]({'raw':_0x293773[_0x0915('0x1f')]?_0x293773['options'][_0x0915('0x20')]===undefined?!![]:![]:!![],'where':_0x293773[_0x0915('0x1f')]?_0x293773[_0x0915('0x1f')][_0x0915('0x21')]||null:null,'attributes':_0x293773[_0x0915('0x1f')]?_0x293773[_0x0915('0x1f')][_0x0915('0x22')]||null:null,'limit':_0x293773['options']?_0x293773[_0x0915('0x1f')]['limit']||null:null,'include':_0x293773[_0x0915('0x1f')]?_0x293773[_0x0915('0x1f')]['include']?_[_0x0915('0x23')](_0x293773[_0x0915('0x1f')][_0x0915('0x24')],function(_0x2208b3){return{'model':db[_0x2208b3['model']],'as':_0x2208b3['as'],'attributes':_0x2208b3['attributes'],'include':_0x2208b3[_0x0915('0x24')]?_['map'](_0x2208b3[_0x0915('0x24')],function(_0xdd9a7a){return{'model':db[_0xdd9a7a[_0x0915('0x25')]],'as':_0xdd9a7a['as'],'attributes':_0xdd9a7a[_0x0915('0x22')],'include':_0xdd9a7a[_0x0915('0x24')]?_[_0x0915('0x23')](_0xdd9a7a[_0x0915('0x24')],function(_0x3560bc){return{'model':db[_0x3560bc[_0x0915('0x25')]],'as':_0x3560bc['as'],'attributes':_0x3560bc[_0x0915('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0915('0x11')](function(_0x1aff7a){logger[_0x0915('0x12')](_0x0915('0x1c'),_0x293773);logger[_0x0915('0x14')](_0x0915('0x1c'),_0x293773,JSON['stringify'](_0x1aff7a));_0x35ad0b(_0x1aff7a);})[_0x0915('0x26')](function(_0x3c8b43){logger[_0x0915('0x17')](_0x0915('0x1c'),_0x3c8b43[_0x0915('0x1a')],_0x293773);_0x3f45e4(_0xf2bc0f[_0x0915('0x17')](0x1f4,_0x3c8b43[_0x0915('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x483c66){var _0xe47ffe=this;return new Promise(function(_0x5cf4e2,_0x324e67){return db['WhatsappQueue'][_0x0915('0x27')]({'raw':_0x483c66[_0x0915('0x1f')]?_0x483c66['options']['raw']===undefined?!![]:![]:!![],'where':_0x483c66[_0x0915('0x1f')]?_0x483c66[_0x0915('0x1f')][_0x0915('0x21')]||null:null,'attributes':_0x483c66['options']?_0x483c66[_0x0915('0x1f')]['attributes']||null:null,'include':_0x483c66[_0x0915('0x1f')]?_0x483c66[_0x0915('0x1f')][_0x0915('0x24')]?_[_0x0915('0x23')](_0x483c66[_0x0915('0x1f')][_0x0915('0x24')],function(_0x5bd1e9){return{'model':db[_0x5bd1e9[_0x0915('0x25')]],'as':_0x5bd1e9['as'],'attributes':_0x5bd1e9[_0x0915('0x22')],'include':_0x5bd1e9[_0x0915('0x24')]?_[_0x0915('0x23')](_0x5bd1e9[_0x0915('0x24')],function(_0x109036){return{'model':db[_0x109036[_0x0915('0x25')]],'as':_0x109036['as'],'attributes':_0x109036[_0x0915('0x22')],'include':_0x109036[_0x0915('0x24')]?_[_0x0915('0x23')](_0x109036[_0x0915('0x24')],function(_0x2e47f3){return{'model':db[_0x2e47f3[_0x0915('0x25')]],'as':_0x2e47f3['as'],'attributes':_0x2e47f3[_0x0915('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0915('0x11')](function(_0x3848c4){logger[_0x0915('0x12')]('ShowWhatsappQueue',_0x483c66);logger[_0x0915('0x14')](_0x0915('0x28'),_0x483c66,JSON['stringify'](_0x3848c4));_0x5cf4e2(_0x3848c4);})[_0x0915('0x26')](function(_0x5678b3){logger[_0x0915('0x17')](_0x0915('0x28'),_0x5678b3[_0x0915('0x1a')],_0x483c66);_0x324e67(_0xe47ffe['error'](0x1f4,_0x5678b3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 083d66f..b952581 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 _0xafa8=['emit','register','length','save','remove','update'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xafa8,0x135));var _0x8afa=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0xafa8[_0x37ded3];return _0x51e49e;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x8afa('0x0'),_0x8afa('0x1'),_0x8afa('0x2')];function createListener(_0x221aec,_0x198d41){return function(_0x3a7ce3){_0x198d41[_0x8afa('0x3')](_0x221aec,_0x3a7ce3);};}function removeListener(_0x56871a,_0x37301b){return function(){WhatsappQueueEvents['removeListener'](_0x56871a,_0x37301b);};}exports[_0x8afa('0x4')]=function(_0x4dc54d){for(var _0x58aa65=0x0,_0x33102b=events[_0x8afa('0x5')];_0x58aa65<_0x33102b;_0x58aa65++){var _0x637811=events[_0x58aa65];var _0x353bd0=createListener('whatsappQueue:'+_0x637811,_0x4dc54d);WhatsappQueueEvents['on'](_0x637811,_0x353bd0);}}; \ No newline at end of file +var _0x933b=['whatsappQueue:','./whatsappQueue.events','save','emit','register'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x933b,0x16e));var _0xb933=function(_0x5d2803,_0x110ad3){_0x5d2803=_0x5d2803-0x0;var _0x526746=_0x933b[_0x5d2803];return _0x526746;};'use strict';var WhatsappQueueEvents=require(_0xb933('0x0'));var events=[_0xb933('0x1'),'remove','update'];function createListener(_0x6f27a3,_0x476426){return function(_0x5414de){_0x476426[_0xb933('0x2')](_0x6f27a3,_0x5414de);};}function removeListener(_0xf0a9c7,_0x4a3e02){return function(){WhatsappQueueEvents['removeListener'](_0xf0a9c7,_0x4a3e02);};}exports[_0xb933('0x3')]=function(_0x322df5){for(var _0x105a1f=0x0,_0x234230=events['length'];_0x105a1f<_0x234230;_0x105a1f++){var _0x30afea=events[_0x105a1f];var _0x31a82c=createListener(_0xb933('0x4')+_0x30afea,_0x322df5);WhatsappQueueEvents['on'](_0x30afea,_0x31a82c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 44c6399..ba21f80 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 _0x4312=['../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','/:id','post','create','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x22f4af,_0x481c37){var _0x11a28c=function(_0x2e2db1){while(--_0x2e2db1){_0x22f4af['push'](_0x22f4af['shift']());}};_0x11a28c(++_0x481c37);}(_0x4312,0xaf));var _0x2431=function(_0x5a70a2,_0xf1e7f9){_0x5a70a2=_0x5a70a2-0x0;var _0x1c88fd=_0x4312[_0x5a70a2];return _0x1c88fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2431('0x0'));var timeout=require(_0x2431('0x1'));var express=require('express');var router=express[_0x2431('0x2')]();var auth=require(_0x2431('0x3'));var interaction=require(_0x2431('0x4'));var config=require(_0x2431('0x5'));var controller=require(_0x2431('0x6'));router[_0x2431('0x7')]('/',auth['isAuthenticated'](),controller[_0x2431('0x8')]);router['get'](_0x2431('0x9'),auth[_0x2431('0xa')](),controller['describe']);router[_0x2431('0x7')](_0x2431('0xb'),auth[_0x2431('0xa')](),controller['show']);router[_0x2431('0xc')]('/',auth[_0x2431('0xa')](),controller[_0x2431('0xd')]);router['put'](_0x2431('0xb'),auth['isAuthenticated'](),controller[_0x2431('0xe')]);router[_0x2431('0xf')](_0x2431('0xb'),auth['isAuthenticated'](),controller[_0x2431('0x10')]);module[_0x2431('0x11')]=router; \ No newline at end of file +var _0x7610=['path','Router','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','multer'];(function(_0x2ace24,_0x27a8fb){var _0x382e19=function(_0x27573d){while(--_0x27573d){_0x2ace24['push'](_0x2ace24['shift']());}};_0x382e19(++_0x27a8fb);}(_0x7610,0x167));var _0x0761=function(_0x281a28,_0x34542c){_0x281a28=_0x281a28-0x0;var _0x54f40c=_0x7610[_0x281a28];return _0x54f40c;};'use strict';var multer=require(_0x0761('0x0'));var util=require('util');var path=require(_0x0761('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0761('0x2')]();var auth=require(_0x0761('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0761('0x4'));router[_0x0761('0x5')]('/',auth[_0x0761('0x6')](),controller['index']);router[_0x0761('0x5')](_0x0761('0x7'),auth['isAuthenticated'](),controller[_0x0761('0x8')]);router[_0x0761('0x5')](_0x0761('0x9'),auth[_0x0761('0x6')](),controller[_0x0761('0xa')]);router['post']('/',auth[_0x0761('0x6')](),controller[_0x0761('0xb')]);router[_0x0761('0xc')](_0x0761('0x9'),auth[_0x0761('0x6')](),controller['update']);router[_0x0761('0xd')]('/:id',auth[_0x0761('0x6')](),controller[_0x0761('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 7da8bc3..fda73a0 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 _0x3e74=['DATE','sequelize','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3e74,0x175));var _0x43e7=function(_0xfc1d1b,_0x217ee5){_0xfc1d1b=_0xfc1d1b-0x0;var _0x327159=_0x3e74[_0xfc1d1b];return _0x327159;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x4ea53c,_0x1e9fd6){var _0x2b333c=function(_0x25d2e0){while(--_0x25d2e0){_0x4ea53c['push'](_0x4ea53c['shift']());}};_0x2b333c(++_0x1e9fd6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3d89a5,_0x339454){_0x3d89a5=_0x3d89a5-0x0;var _0x39687f=_0x8ef6[_0x3d89a5];return _0x39687f;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 643f47e..99277d4 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 _0xa07d=['set','reject','save','update','then','error','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','util','sox','to-csv','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xa07d,0x1c0));var _0xda07=function(_0x465a97,_0x39c4bb){_0x465a97=_0x465a97-0x0;var _0x5eac31=_0xa07d[_0x465a97];return _0x5eac31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xda07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda07('0x1'));var jsonpatch=require(_0xda07('0x2'));var rp=require('request-promise');var moment=require(_0xda07('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda07('0x4'));var path=require('path');var sox=require(_0xda07('0x5'));var csv=require(_0xda07('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xda07('0x7'));var jsforce=require(_0xda07('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xda07('0x6'));var querystring=require('querystring');var Papa=require(_0xda07('0x9'));var Redis=require(_0xda07('0xa'));var authService=require(_0xda07('0xb'));var qs=require(_0xda07('0xc'));var as=require(_0xda07('0xd'));var hardwareService=require(_0xda07('0xe'));var logger=require(_0xda07('0xf'))(_0xda07('0x10'));var utils=require(_0xda07('0x11'));var config=require(_0xda07('0x12'));var licenseUtil=require(_0xda07('0x13'));var db=require(_0xda07('0x14'))['db'];function respondWithStatusCode(_0x857d9d,_0x2ff145){_0x2ff145=_0x2ff145||0xcc;return function(_0x5e404f){if(_0x5e404f){return _0x857d9d[_0xda07('0x15')](_0x2ff145);}return _0x857d9d[_0xda07('0x16')](_0x2ff145)[_0xda07('0x17')]();};}function respondWithResult(_0x8f5fdd,_0x1243a8){_0x1243a8=_0x1243a8||0xc8;return function(_0x2a4c6c){if(_0x2a4c6c){return _0x8f5fdd[_0xda07('0x16')](_0x1243a8)[_0xda07('0x18')](_0x2a4c6c);}};}function respondWithFilteredResult(_0x2e869f,_0x1bd7d1){return function(_0x331128){if(_0x331128){var _0x5cb314=_0x331128[_0xda07('0x19')],_0x533ea5=_0x1bd7d1[_0xda07('0x1a')],_0x332b34=_0x1bd7d1[_0xda07('0x1a')]+_0x1bd7d1[_0xda07('0x1b')],_0x5ed8bc;if(_0x332b34>=_0x5cb314){_0x332b34=_0x5cb314;_0x5ed8bc=0xc8;}else{_0x5ed8bc=0xce;}_0x2e869f[_0xda07('0x16')](_0x5ed8bc);return _0x2e869f[_0xda07('0x1c')]('Content-Range',_0x533ea5+'-'+_0x332b34+'/'+_0x5cb314)[_0xda07('0x18')](_0x331128);}return null;};}function patchUpdates(_0x472490){return function(_0x3fe218){try{jsonpatch['apply'](_0x3fe218,_0x472490,!![]);}catch(_0x160763){return BPromise[_0xda07('0x1d')](_0x160763);}return _0x3fe218[_0xda07('0x1e')]();};}function saveUpdates(_0x45d7b0,_0x2f4ebb){return function(_0x1103fd){if(_0x1103fd){return _0x1103fd[_0xda07('0x1f')](_0x45d7b0)[_0xda07('0x20')](function(_0x14c11f){return _0x14c11f;});}return null;};}function removeEntity(_0x4fdd55,_0x3f7919){return function(_0x54b54b){if(_0x54b54b){return _0x54b54b['destroy']()[_0xda07('0x20')](function(){_0x4fdd55[_0xda07('0x16')](0xcc)[_0xda07('0x17')]();});}};}function handleEntityNotFound(_0x34d1e6,_0x36fd21){return function(_0x18bb7b){if(!_0x18bb7b){_0x34d1e6[_0xda07('0x15')](0x194);}return _0x18bb7b;};}function handleError(_0x396cbf,_0x21810a){_0x21810a=_0x21810a||0x1f4;return function(_0x46cce3){logger[_0xda07('0x21')](_0x46cce3['stack']);if(_0x46cce3[_0xda07('0x22')]){delete _0x46cce3[_0xda07('0x22')];}_0x396cbf[_0xda07('0x16')](_0x21810a)['send'](_0x46cce3);};}exports[_0xda07('0x23')]=function(_0x414cbb,_0x364341){var _0xed8fbb={},_0x7d3ad2={},_0x4b4d15={'count':0x0,'rows':[]};var _0x5a862d=_[_0xda07('0x24')](db[_0xda07('0x25')][_0xda07('0x26')],function(_0x23dbcb){return{'name':_0x23dbcb[_0xda07('0x27')],'type':_0x23dbcb[_0xda07('0x28')]['key']};});_0x7d3ad2[_0xda07('0x29')]=_[_0xda07('0x24')](_0x5a862d,_0xda07('0x22'));_0x7d3ad2[_0xda07('0x2a')]=_[_0xda07('0x2b')](_0x414cbb[_0xda07('0x2a')]);_0x7d3ad2['filters']=_[_0xda07('0x2c')](_0x7d3ad2['model'],_0x7d3ad2[_0xda07('0x2a')]);_0xed8fbb[_0xda07('0x2d')]=_['intersection'](_0x7d3ad2['model'],qs[_0xda07('0x2e')](_0x414cbb[_0xda07('0x2a')][_0xda07('0x2e')]));_0xed8fbb[_0xda07('0x2d')]=_0xed8fbb[_0xda07('0x2d')][_0xda07('0x2f')]?_0xed8fbb[_0xda07('0x2d')]:_0x7d3ad2[_0xda07('0x29')];if(!_0x414cbb[_0xda07('0x2a')][_0xda07('0x30')](_0xda07('0x31'))){_0xed8fbb[_0xda07('0x1b')]=qs[_0xda07('0x1b')](_0x414cbb[_0xda07('0x2a')][_0xda07('0x1b')]);_0xed8fbb['offset']=qs[_0xda07('0x1a')](_0x414cbb[_0xda07('0x2a')][_0xda07('0x1a')]);}_0xed8fbb[_0xda07('0x32')]=qs[_0xda07('0x33')](_0x414cbb[_0xda07('0x2a')][_0xda07('0x33')]);_0xed8fbb[_0xda07('0x34')]=qs[_0xda07('0x35')](_[_0xda07('0x36')](_0x414cbb[_0xda07('0x2a')],_0x7d3ad2[_0xda07('0x35')]),_0x5a862d);if(_0x414cbb[_0xda07('0x2a')][_0xda07('0x37')]){_0xed8fbb[_0xda07('0x34')]=_[_0xda07('0x38')](_0xed8fbb['where'],{'$or':_[_0xda07('0x24')](_0x5a862d,function(_0x1347d2){if(_0x1347d2[_0xda07('0x28')]!=='VIRTUAL'){var _0x46bc4f={};_0x46bc4f[_0x1347d2[_0xda07('0x22')]]={'$like':'%'+_0x414cbb['query']['filter']+'%'};return _0x46bc4f;}})});}_0xed8fbb=_['merge']({},_0xed8fbb,_0x414cbb[_0xda07('0x39')]);var _0x1308c9={'where':_0xed8fbb[_0xda07('0x34')]};return db[_0xda07('0x25')]['count'](_0x1308c9)[_0xda07('0x20')](function(_0x14188b){_0x4b4d15[_0xda07('0x19')]=_0x14188b;if(_0x414cbb['query']['includeAll']){_0xed8fbb['include']=[{'all':!![]}];}return db[_0xda07('0x25')][_0xda07('0x3a')](_0xed8fbb);})[_0xda07('0x20')](function(_0x324488){_0x4b4d15[_0xda07('0x3b')]=_0x324488;return _0x4b4d15;})['then'](respondWithFilteredResult(_0x364341,_0xed8fbb))[_0xda07('0x3c')](handleError(_0x364341,null));};exports[_0xda07('0x3d')]=function(_0xd05b79,_0x28c38a){var _0x200fa2={'raw':!![],'where':{'id':_0xd05b79[_0xda07('0x3e')]['id']}},_0x37348d={};_0x37348d[_0xda07('0x29')]=_[_0xda07('0x2b')](db[_0xda07('0x25')]['rawAttributes']);_0x37348d[_0xda07('0x2a')]=_[_0xda07('0x2b')](_0xd05b79[_0xda07('0x2a')]);_0x37348d[_0xda07('0x35')]=_[_0xda07('0x2c')](_0x37348d[_0xda07('0x29')],_0x37348d[_0xda07('0x2a')]);_0x200fa2[_0xda07('0x2d')]=_[_0xda07('0x2c')](_0x37348d['model'],qs[_0xda07('0x2e')](_0xd05b79[_0xda07('0x2a')][_0xda07('0x2e')]));_0x200fa2['attributes']=_0x200fa2[_0xda07('0x2d')][_0xda07('0x2f')]?_0x200fa2['attributes']:_0x37348d[_0xda07('0x29')];if(_0xd05b79[_0xda07('0x2a')]['includeAll']){_0x200fa2[_0xda07('0x3f')]=[{'all':!![]}];}_0x200fa2=_[_0xda07('0x38')]({},_0x200fa2,_0xd05b79[_0xda07('0x39')]);return db[_0xda07('0x25')][_0xda07('0x40')](_0x200fa2)[_0xda07('0x20')](handleEntityNotFound(_0x28c38a,null))[_0xda07('0x20')](respondWithResult(_0x28c38a,null))['catch'](handleError(_0x28c38a,null));};exports[_0xda07('0x41')]=function(_0x756e72,_0x2ec871){return db[_0xda07('0x25')][_0xda07('0x41')](_0x756e72[_0xda07('0x42')],{})[_0xda07('0x20')](respondWithResult(_0x2ec871,0xc9))['catch'](handleError(_0x2ec871,null));};exports[_0xda07('0x1f')]=function(_0x235832,_0x15d547){if(_0x235832[_0xda07('0x42')]['id']){delete _0x235832['body']['id'];}return db[_0xda07('0x25')][_0xda07('0x40')]({'where':{'id':_0x235832[_0xda07('0x3e')]['id']}})['then'](handleEntityNotFound(_0x15d547,null))[_0xda07('0x20')](saveUpdates(_0x235832['body'],null))['then'](respondWithResult(_0x15d547,null))[_0xda07('0x3c')](handleError(_0x15d547,null));};exports['destroy']=function(_0x5857c7,_0x299b70){return db[_0xda07('0x25')][_0xda07('0x40')]({'where':{'id':_0x5857c7['params']['id']}})[_0xda07('0x20')](handleEntityNotFound(_0x299b70,null))[_0xda07('0x20')](removeEntity(_0x299b70,null))[_0xda07('0x3c')](handleError(_0x299b70,null));};exports[_0xda07('0x43')]=function(_0x380f6b,_0x1b84f5){return db['WhatsappQueueReport'][_0xda07('0x43')]()[_0xda07('0x20')](respondWithResult(_0x1b84f5,null))['catch'](handleError(_0x1b84f5,null));}; \ No newline at end of file +var _0xf1e7=['WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','destroy','stack','name','send','map'];(function(_0x5b834c,_0x40b138){var _0x227a93=function(_0x65e483){while(--_0x65e483){_0x5b834c['push'](_0x5b834c['shift']());}};_0x227a93(++_0x40b138);}(_0xf1e7,0x103));var _0x7f1e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xf1e7[_0x263a74];return _0x2aa86c;};'use strict';var pdf=require(_0x7f1e('0x0'));var emlformat=require(_0x7f1e('0x1'));var rimraf=require(_0x7f1e('0x2'));var zipdir=require(_0x7f1e('0x3'));var jsonpatch=require(_0x7f1e('0x4'));var rp=require(_0x7f1e('0x5'));var moment=require(_0x7f1e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7f1e('0x7'));var util=require(_0x7f1e('0x8'));var path=require(_0x7f1e('0x9'));var sox=require(_0x7f1e('0xa'));var csv=require(_0x7f1e('0xb'));var ejs=require(_0x7f1e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f1e('0xd'));var crypto=require(_0x7f1e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7f1e('0xf'));var toCsv=require(_0x7f1e('0xb'));var querystring=require('querystring');var Papa=require(_0x7f1e('0x10'));var Redis=require(_0x7f1e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7f1e('0x12'));var as=require(_0x7f1e('0x13'));var hardwareService=require(_0x7f1e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7f1e('0x15'));var config=require(_0x7f1e('0x16'));var licenseUtil=require(_0x7f1e('0x17'));var db=require(_0x7f1e('0x18'))['db'];function respondWithStatusCode(_0x5f3605,_0x2a4d66){_0x2a4d66=_0x2a4d66||0xcc;return function(_0x2fa4bd){if(_0x2fa4bd){return _0x5f3605[_0x7f1e('0x19')](_0x2a4d66);}return _0x5f3605[_0x7f1e('0x1a')](_0x2a4d66)[_0x7f1e('0x1b')]();};}function respondWithResult(_0x22f86c,_0x2f3048){_0x2f3048=_0x2f3048||0xc8;return function(_0x51a11c){if(_0x51a11c){return _0x22f86c[_0x7f1e('0x1a')](_0x2f3048)['json'](_0x51a11c);}};}function respondWithFilteredResult(_0x5e9753,_0x15b3f7){return function(_0xa92ab7){if(_0xa92ab7){var _0x339d70=_0xa92ab7[_0x7f1e('0x1c')],_0x1c4364=_0x15b3f7[_0x7f1e('0x1d')],_0x3eeebc=_0x15b3f7[_0x7f1e('0x1d')]+_0x15b3f7[_0x7f1e('0x1e')],_0xc9ab0d;if(_0x3eeebc>=_0x339d70){_0x3eeebc=_0x339d70;_0xc9ab0d=0xc8;}else{_0xc9ab0d=0xce;}_0x5e9753[_0x7f1e('0x1a')](_0xc9ab0d);return _0x5e9753['set'](_0x7f1e('0x1f'),_0x1c4364+'-'+_0x3eeebc+'/'+_0x339d70)[_0x7f1e('0x20')](_0xa92ab7);}return null;};}function patchUpdates(_0x488865){return function(_0x5491d2){try{jsonpatch['apply'](_0x5491d2,_0x488865,!![]);}catch(_0x5d17bf){return BPromise[_0x7f1e('0x21')](_0x5d17bf);}return _0x5491d2[_0x7f1e('0x22')]();};}function saveUpdates(_0x535250,_0x479a6b){return function(_0x4a0d0a){if(_0x4a0d0a){return _0x4a0d0a['update'](_0x535250)[_0x7f1e('0x23')](function(_0x5daaa5){return _0x5daaa5;});}return null;};}function removeEntity(_0x1395bc,_0x10a59){return function(_0x2ad309){if(_0x2ad309){return _0x2ad309[_0x7f1e('0x24')]()['then'](function(){_0x1395bc[_0x7f1e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ddfc,_0x55b7ae){return function(_0xed2ed0){if(!_0xed2ed0){_0x64ddfc['sendStatus'](0x194);}return _0xed2ed0;};}function handleError(_0x4e50d6,_0x1dc8fc){_0x1dc8fc=_0x1dc8fc||0x1f4;return function(_0x12293c){logger['error'](_0x12293c[_0x7f1e('0x25')]);if(_0x12293c[_0x7f1e('0x26')]){delete _0x12293c[_0x7f1e('0x26')];}_0x4e50d6['status'](_0x1dc8fc)[_0x7f1e('0x27')](_0x12293c);};}exports['index']=function(_0x62d1ed,_0x4ea365){var _0x4e845d={},_0x3a48c5={},_0x3b14fa={'count':0x0,'rows':[]};var _0x4b3d89=_[_0x7f1e('0x28')](db[_0x7f1e('0x29')]['rawAttributes'],function(_0x13696b){return{'name':_0x13696b[_0x7f1e('0x2a')],'type':_0x13696b[_0x7f1e('0x2b')][_0x7f1e('0x2c')]};});_0x3a48c5[_0x7f1e('0x2d')]=_[_0x7f1e('0x28')](_0x4b3d89,_0x7f1e('0x26'));_0x3a48c5[_0x7f1e('0x2e')]=_[_0x7f1e('0x2f')](_0x62d1ed[_0x7f1e('0x2e')]);_0x3a48c5[_0x7f1e('0x30')]=_['intersection'](_0x3a48c5[_0x7f1e('0x2d')],_0x3a48c5[_0x7f1e('0x2e')]);_0x4e845d['attributes']=_[_0x7f1e('0x31')](_0x3a48c5[_0x7f1e('0x2d')],qs[_0x7f1e('0x32')](_0x62d1ed[_0x7f1e('0x2e')]['fields']));_0x4e845d[_0x7f1e('0x33')]=_0x4e845d[_0x7f1e('0x33')][_0x7f1e('0x34')]?_0x4e845d['attributes']:_0x3a48c5[_0x7f1e('0x2d')];if(!_0x62d1ed[_0x7f1e('0x2e')][_0x7f1e('0x35')](_0x7f1e('0x36'))){_0x4e845d['limit']=qs[_0x7f1e('0x1e')](_0x62d1ed[_0x7f1e('0x2e')][_0x7f1e('0x1e')]);_0x4e845d['offset']=qs[_0x7f1e('0x1d')](_0x62d1ed[_0x7f1e('0x2e')][_0x7f1e('0x1d')]);}_0x4e845d[_0x7f1e('0x37')]=qs[_0x7f1e('0x38')](_0x62d1ed['query'][_0x7f1e('0x38')]);_0x4e845d[_0x7f1e('0x39')]=qs['filters'](_[_0x7f1e('0x3a')](_0x62d1ed[_0x7f1e('0x2e')],_0x3a48c5[_0x7f1e('0x30')]),_0x4b3d89);if(_0x62d1ed[_0x7f1e('0x2e')][_0x7f1e('0x3b')]){_0x4e845d[_0x7f1e('0x39')]=_['merge'](_0x4e845d['where'],{'$or':_[_0x7f1e('0x28')](_0x4b3d89,function(_0x1fa254){if(_0x1fa254[_0x7f1e('0x2b')]!==_0x7f1e('0x3c')){var _0x1a8385={};_0x1a8385[_0x1fa254['name']]={'$like':'%'+_0x62d1ed['query'][_0x7f1e('0x3b')]+'%'};return _0x1a8385;}})});}_0x4e845d=_['merge']({},_0x4e845d,_0x62d1ed[_0x7f1e('0x3d')]);var _0x5e0bc5={'where':_0x4e845d[_0x7f1e('0x39')]};return db[_0x7f1e('0x29')][_0x7f1e('0x1c')](_0x5e0bc5)[_0x7f1e('0x23')](function(_0x375cfc){_0x3b14fa[_0x7f1e('0x1c')]=_0x375cfc;if(_0x62d1ed[_0x7f1e('0x2e')][_0x7f1e('0x3e')]){_0x4e845d[_0x7f1e('0x3f')]=[{'all':!![]}];}return db[_0x7f1e('0x29')][_0x7f1e('0x40')](_0x4e845d);})[_0x7f1e('0x23')](function(_0x3b913d){_0x3b14fa['rows']=_0x3b913d;return _0x3b14fa;})[_0x7f1e('0x23')](respondWithFilteredResult(_0x4ea365,_0x4e845d))[_0x7f1e('0x41')](handleError(_0x4ea365,null));};exports[_0x7f1e('0x42')]=function(_0xbb82e,_0x383a89){var _0x21f21a={'raw':!![],'where':{'id':_0xbb82e[_0x7f1e('0x43')]['id']}},_0x29eda2={};_0x29eda2[_0x7f1e('0x2d')]=_[_0x7f1e('0x2f')](db[_0x7f1e('0x29')][_0x7f1e('0x44')]);_0x29eda2[_0x7f1e('0x2e')]=_[_0x7f1e('0x2f')](_0xbb82e[_0x7f1e('0x2e')]);_0x29eda2['filters']=_[_0x7f1e('0x31')](_0x29eda2[_0x7f1e('0x2d')],_0x29eda2[_0x7f1e('0x2e')]);_0x21f21a['attributes']=_[_0x7f1e('0x31')](_0x29eda2['model'],qs['fields'](_0xbb82e[_0x7f1e('0x2e')]['fields']));_0x21f21a[_0x7f1e('0x33')]=_0x21f21a[_0x7f1e('0x33')]['length']?_0x21f21a[_0x7f1e('0x33')]:_0x29eda2[_0x7f1e('0x2d')];if(_0xbb82e[_0x7f1e('0x2e')][_0x7f1e('0x3e')]){_0x21f21a[_0x7f1e('0x3f')]=[{'all':!![]}];}_0x21f21a=_[_0x7f1e('0x45')]({},_0x21f21a,_0xbb82e[_0x7f1e('0x3d')]);return db[_0x7f1e('0x29')]['find'](_0x21f21a)[_0x7f1e('0x23')](handleEntityNotFound(_0x383a89,null))[_0x7f1e('0x23')](respondWithResult(_0x383a89,null))[_0x7f1e('0x41')](handleError(_0x383a89,null));};exports[_0x7f1e('0x46')]=function(_0x4deebd,_0x796562){return db[_0x7f1e('0x29')][_0x7f1e('0x46')](_0x4deebd[_0x7f1e('0x47')],{})[_0x7f1e('0x23')](respondWithResult(_0x796562,0xc9))[_0x7f1e('0x41')](handleError(_0x796562,null));};exports[_0x7f1e('0x48')]=function(_0x4ef69d,_0x50eec){if(_0x4ef69d['body']['id']){delete _0x4ef69d[_0x7f1e('0x47')]['id'];}return db[_0x7f1e('0x29')][_0x7f1e('0x49')]({'where':{'id':_0x4ef69d[_0x7f1e('0x43')]['id']}})[_0x7f1e('0x23')](handleEntityNotFound(_0x50eec,null))['then'](saveUpdates(_0x4ef69d[_0x7f1e('0x47')],null))[_0x7f1e('0x23')](respondWithResult(_0x50eec,null))[_0x7f1e('0x41')](handleError(_0x50eec,null));};exports[_0x7f1e('0x24')]=function(_0x3c9303,_0x27888c){return db[_0x7f1e('0x29')][_0x7f1e('0x49')]({'where':{'id':_0x3c9303['params']['id']}})[_0x7f1e('0x23')](handleEntityNotFound(_0x27888c,null))['then'](removeEntity(_0x27888c,null))[_0x7f1e('0x41')](handleError(_0x27888c,null));};exports[_0x7f1e('0x4a')]=function(_0x373497,_0xf52116){return db[_0x7f1e('0x29')][_0x7f1e('0x4a')]()[_0x7f1e('0x23')](respondWithResult(_0xf52116,null))[_0x7f1e('0x41')](handleError(_0xf52116,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 44d3c35..9a70e6a 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 _0x6e63=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','moment'];(function(_0x47d7ec,_0x17f197){var _0x98674a=function(_0x4f7db3){while(--_0x4f7db3){_0x47d7ec['push'](_0x47d7ec['shift']());}};_0x98674a(++_0x17f197);}(_0x6e63,0xca));var _0x36e6=function(_0x2e9873,_0xd8e62a){_0x2e9873=_0x2e9873-0x0;var _0x17ae47=_0x6e63[_0x2e9873];return _0x17ae47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36e6('0x0'))('api');var moment=require(_0x36e6('0x1'));var BPromise=require(_0x36e6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36e6('0x3'));var rimraf=require(_0x36e6('0x4'));var config=require(_0x36e6('0x5'));var attributes=require(_0x36e6('0x6'));module[_0x36e6('0x7')]=function(_0x2da5a6,_0x3aeaaf){return _0x2da5a6[_0x36e6('0x8')](_0x36e6('0x9'),attributes,{'tableName':_0x36e6('0xa'),'paranoid':![],'indexes':[{'name':_0x36e6('0xb'),'fields':[_0x36e6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0dce=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x507ba3,_0x4ee4fb){var _0x512192=function(_0x1d628c){while(--_0x1d628c){_0x507ba3['push'](_0x507ba3['shift']());}};_0x512192(++_0x4ee4fb);}(_0x0dce,0x12a));var _0xe0dc=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0dce[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xe0dc('0x0'));var util=require(_0xe0dc('0x1'));var logger=require(_0xe0dc('0x2'))(_0xe0dc('0x3'));var moment=require(_0xe0dc('0x4'));var BPromise=require(_0xe0dc('0x5'));var rp=require(_0xe0dc('0x6'));var fs=require('fs');var path=require(_0xe0dc('0x7'));var rimraf=require(_0xe0dc('0x8'));var config=require(_0xe0dc('0x9'));var attributes=require(_0xe0dc('0xa'));module[_0xe0dc('0xb')]=function(_0x16c859,_0x4c6d1c){return _0x16c859[_0xe0dc('0xc')](_0xe0dc('0xd'),attributes,{'tableName':_0xe0dc('0xe'),'paranoid':![],'indexes':[{'name':_0xe0dc('0xf'),'fields':[_0xe0dc('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index df3380e..1cfb0f2 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 _0xe99e=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','UpdateWhatsappQueueReport','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0xe99e,0x1ea));var _0xee99=function(_0x24e5c9,_0x127db1){_0x24e5c9=_0x24e5c9-0x0;var _0x1d0a5f=_0xe99e[_0x24e5c9];return _0x1d0a5f;};'use strict';var _=require(_0xee99('0x0'));var util=require(_0xee99('0x1'));var moment=require(_0xee99('0x2'));var BPromise=require(_0xee99('0x3'));var rs=require(_0xee99('0x4'));var fs=require('fs');var Redis=require(_0xee99('0x5'));var db=require(_0xee99('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee99('0x7'))(_0xee99('0x8'));var config=require(_0xee99('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32be85,_0x2c9f9d,_0x487748){return new BPromise(function(_0x5cc332,_0x2c740c){return client['request'](_0x32be85,_0x487748)[_0xee99('0xb')](function(_0x3014fe){logger[_0xee99('0xc')](_0xee99('0xd'),_0x2c9f9d,_0xee99('0xe'));logger[_0xee99('0xf')](_0xee99('0x10'),_0x2c9f9d,_0xee99('0xe'),JSON[_0xee99('0x11')](_0x3014fe));if(_0x3014fe[_0xee99('0x12')]){if(_0x3014fe['error']['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x2c9f9d,_0x3014fe[_0xee99('0x12')][_0xee99('0x13')]);return _0x2c740c(_0x3014fe[_0xee99('0x12')][_0xee99('0x13')]);}logger['error'](_0xee99('0xd'),_0x2c9f9d,_0x3014fe[_0xee99('0x12')][_0xee99('0x13')]);return _0x5cc332(_0x3014fe[_0xee99('0x12')][_0xee99('0x13')]);}else{logger[_0xee99('0xc')](_0xee99('0xd'),_0x2c9f9d,_0xee99('0xe'));_0x5cc332(_0x3014fe[_0xee99('0x14')]['message']);}})[_0xee99('0x15')](function(_0x3f8853){logger[_0xee99('0x12')](_0xee99('0xd'),_0x2c9f9d,_0x3f8853);_0x2c740c(_0x3f8853);});});}exports[_0xee99('0x16')]=function(_0x2f5804){var _0x55dfe3=this;return new Promise(function(_0x460cde,_0x2d90b7){return db[_0xee99('0x17')][_0xee99('0x18')](_0x2f5804[_0xee99('0x19')],{'raw':_0x2f5804['options']?_0x2f5804['options'][_0xee99('0x1a')]===undefined?!![]:![]:!![]})[_0xee99('0xb')](function(_0x349a43){logger[_0xee99('0xc')](_0xee99('0x16'),_0x2f5804);logger[_0xee99('0xf')]('CreateWhatsappQueueReport',_0x2f5804,JSON[_0xee99('0x11')](_0x349a43));_0x460cde(_0x349a43);})[_0xee99('0x15')](function(_0x46eba0){logger[_0xee99('0x12')](_0xee99('0x16'),_0x46eba0[_0xee99('0x13')],_0x2f5804);_0x2d90b7(_0x55dfe3['error'](0x1f4,_0x46eba0['message']));});});};exports[_0xee99('0x1b')]=function(_0x249dd4){var _0x289d25=this;return new Promise(function(_0x2b0c1a,_0x2147b0){return db[_0xee99('0x17')]['update'](_0x249dd4[_0xee99('0x19')],{'raw':_0x249dd4[_0xee99('0x1c')]?_0x249dd4[_0xee99('0x1c')][_0xee99('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x249dd4[_0xee99('0x1c')]?_0x249dd4[_0xee99('0x1c')][_0xee99('0x1d')]||null:null,'attributes':_0x249dd4['options']?_0x249dd4['options'][_0xee99('0x1e')]||null:null,'limit':_0x249dd4[_0xee99('0x1c')]?_0x249dd4[_0xee99('0x1c')][_0xee99('0x1f')]||null:null})[_0xee99('0xb')](function(_0x391cce){logger[_0xee99('0xc')]('UpdateWhatsappQueueReport',_0x249dd4);logger['debug'](_0xee99('0x1b'),_0x249dd4,JSON[_0xee99('0x11')](_0x391cce));_0x2b0c1a(_0x391cce);})[_0xee99('0x15')](function(_0x22e912){logger[_0xee99('0x12')](_0xee99('0x1b'),_0x22e912[_0xee99('0x13')],_0x249dd4);_0x2147b0(_0x289d25[_0xee99('0x12')](0x1f4,_0x22e912[_0xee99('0x13')]));});});}; \ No newline at end of file +var _0x2260=['../../config/logger','../../config/environment','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','then','catch','UpdateWhatsappQueueReport','body','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x40a3bd,_0x183f83){var _0x2e4dc7=function(_0x44b645){while(--_0x44b645){_0x40a3bd['push'](_0x40a3bd['shift']());}};_0x2e4dc7(++_0x183f83);}(_0x2260,0x12f));var _0x0226=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2260[_0x4d07cc];return _0x42de3b;};'use strict';var _=require('lodash');var util=require(_0x0226('0x0'));var moment=require(_0x0226('0x1'));var BPromise=require(_0x0226('0x2'));var rs=require(_0x0226('0x3'));var fs=require('fs');var Redis=require(_0x0226('0x4'));var db=require(_0x0226('0x5'))['db'];var utils=require(_0x0226('0x6'));var logger=require(_0x0226('0x7'))('rpc');var config=require(_0x0226('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0226('0x9')][_0x0226('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3566d4,_0x3325b7,_0x2cbfab){return new BPromise(function(_0x4db4b3,_0x1e189a){return client[_0x0226('0xb')](_0x3566d4,_0x2cbfab)['then'](function(_0x4fe561){logger[_0x0226('0xc')](_0x0226('0xd'),_0x3325b7,_0x0226('0xe'));logger[_0x0226('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3325b7,'request\x20sent',JSON[_0x0226('0x10')](_0x4fe561));if(_0x4fe561[_0x0226('0x11')]){if(_0x4fe561[_0x0226('0x11')][_0x0226('0x12')]===0x1f4){logger[_0x0226('0x11')](_0x0226('0xd'),_0x3325b7,_0x4fe561[_0x0226('0x11')][_0x0226('0x13')]);return _0x1e189a(_0x4fe561[_0x0226('0x11')]['message']);}logger['error'](_0x0226('0xd'),_0x3325b7,_0x4fe561[_0x0226('0x11')][_0x0226('0x13')]);return _0x4db4b3(_0x4fe561[_0x0226('0x11')][_0x0226('0x13')]);}else{logger[_0x0226('0xc')](_0x0226('0xd'),_0x3325b7,_0x0226('0xe'));_0x4db4b3(_0x4fe561[_0x0226('0x14')][_0x0226('0x13')]);}})['catch'](function(_0xd9ec32){logger[_0x0226('0x11')](_0x0226('0xd'),_0x3325b7,_0xd9ec32);_0x1e189a(_0xd9ec32);});});}exports[_0x0226('0x15')]=function(_0x1ddc7f){var _0x35e0de=this;return new Promise(function(_0x1eaabd,_0x302fba){return db[_0x0226('0x16')][_0x0226('0x17')](_0x1ddc7f['body'],{'raw':_0x1ddc7f[_0x0226('0x18')]?_0x1ddc7f[_0x0226('0x18')][_0x0226('0x19')]===undefined?!![]:![]:!![]})[_0x0226('0x1a')](function(_0x3d9564){logger[_0x0226('0xc')](_0x0226('0x15'),_0x1ddc7f);logger[_0x0226('0xf')](_0x0226('0x15'),_0x1ddc7f,JSON[_0x0226('0x10')](_0x3d9564));_0x1eaabd(_0x3d9564);})[_0x0226('0x1b')](function(_0x40645a){logger[_0x0226('0x11')]('CreateWhatsappQueueReport',_0x40645a[_0x0226('0x13')],_0x1ddc7f);_0x302fba(_0x35e0de['error'](0x1f4,_0x40645a[_0x0226('0x13')]));});});};exports[_0x0226('0x1c')]=function(_0x1a4558){var _0x5e0f7b=this;return new Promise(function(_0x218e2d,_0x5b75ed){return db[_0x0226('0x16')]['update'](_0x1a4558[_0x0226('0x1d')],{'raw':_0x1a4558[_0x0226('0x18')]?_0x1a4558[_0x0226('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a4558[_0x0226('0x18')]?_0x1a4558['options']['where']||null:null,'attributes':_0x1a4558['options']?_0x1a4558[_0x0226('0x18')]['attributes']||null:null,'limit':_0x1a4558[_0x0226('0x18')]?_0x1a4558[_0x0226('0x18')][_0x0226('0x1e')]||null:null})[_0x0226('0x1a')](function(_0x4d5eae){logger['info']('UpdateWhatsappQueueReport',_0x1a4558);logger[_0x0226('0xf')](_0x0226('0x1c'),_0x1a4558,JSON[_0x0226('0x10')](_0x4d5eae));_0x218e2d(_0x4d5eae);})[_0x0226('0x1b')](function(_0x51b933){logger[_0x0226('0x11')](_0x0226('0x1c'),_0x51b933[_0x0226('0x13')],_0x1a4558);_0x5b75ed(_0x5e0f7b[_0x0226('0x11')](0x1f4,_0x51b933[_0x0226('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1953536..fd96c95 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 _0x2752=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x24807a,_0x12ffaa){var _0x4d4a96=function(_0x28bd89){while(--_0x28bd89){_0x24807a['push'](_0x24807a['shift']());}};_0x4d4a96(++_0x12ffaa);}(_0x2752,0x12b));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2275('0x0'));var util=require('util');var path=require(_0x2275('0x1'));var timeout=require('connect-timeout');var express=require(_0x2275('0x2'));var router=express[_0x2275('0x3')]();var auth=require(_0x2275('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2275('0x5'));var controller=require(_0x2275('0x6'));router[_0x2275('0x7')]('/',auth[_0x2275('0x8')](),controller[_0x2275('0x9')]);router[_0x2275('0x7')]('/describe',auth[_0x2275('0x8')](),controller['describe']);router['get'](_0x2275('0xa'),auth['isAuthenticated'](),controller[_0x2275('0xb')]);router[_0x2275('0xc')]('/',auth[_0x2275('0x8')](),controller[_0x2275('0xd')]);router[_0x2275('0xe')]('/:id',auth[_0x2275('0x8')](),controller[_0x2275('0xf')]);router[_0x2275('0x10')](_0x2275('0xa'),auth[_0x2275('0x8')](),controller[_0x2275('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc9b1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','create','delete','/:id','destroy','exports','path','connect-timeout','express'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0xc9b1,0xb8));var _0x1c9b=function(_0x32f4fb,_0x203ab8){_0x32f4fb=_0x32f4fb-0x0;var _0x57ed4=_0xc9b1[_0x32f4fb];return _0x57ed4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c9b('0x0'));var timeout=require(_0x1c9b('0x1'));var express=require(_0x1c9b('0x2'));var router=express[_0x1c9b('0x3')]();var auth=require(_0x1c9b('0x4'));var interaction=require(_0x1c9b('0x5'));var config=require(_0x1c9b('0x6'));var controller=require(_0x1c9b('0x7'));router[_0x1c9b('0x8')]('/',auth[_0x1c9b('0x9')](),controller[_0x1c9b('0xa')]);router[_0x1c9b('0x8')]('/describe',auth[_0x1c9b('0x9')](),controller[_0x1c9b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1c9b('0x9')](),controller[_0x1c9b('0xc')]);router['put']('/:id',auth[_0x1c9b('0x9')](),controller['update']);router[_0x1c9b('0xd')](_0x1c9b('0xe'),auth[_0x1c9b('0x9')](),controller[_0x1c9b('0xf')]);module[_0x1c9b('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 f01352e..ae84f61 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 _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x901ce4,_0x225e6e){var _0x33c41d=function(_0xa94edb){while(--_0xa94edb){_0x901ce4['push'](_0x901ce4['shift']());}};_0x33c41d(++_0x225e6e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34725a,_0x443114){_0x34725a=_0x34725a-0x0;var _0x1739ef=_0x5f2f[_0x34725a];return _0x1739ef;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file +var _0x757a=['queue','DATE','exports','STRING'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x757a,0xde));var _0xa757=function(_0xf36124,_0x931d32){_0xf36124=_0xf36124-0x0;var _0x2c2c9c=_0x757a[_0xf36124];return _0x2c2c9c;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index fedf32b..b76f023 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 _0xd634=['end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x210f10,_0x9ebeb6){var _0xa147bd=function(_0x56bf6e){while(--_0x56bf6e){_0x210f10['push'](_0x210f10['shift']());}};_0xa147bd(++_0x9ebeb6);}(_0xd634,0x151));var _0x4d63=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0xd634[_0x478414];return _0x5eb6b9;};'use strict';var pdf=require(_0x4d63('0x0'));var emlformat=require(_0x4d63('0x1'));var rimraf=require(_0x4d63('0x2'));var zipdir=require(_0x4d63('0x3'));var jsonpatch=require(_0x4d63('0x4'));var rp=require(_0x4d63('0x5'));var moment=require(_0x4d63('0x6'));var BPromise=require(_0x4d63('0x7'));var Mustache=require(_0x4d63('0x8'));var util=require(_0x4d63('0x9'));var path=require('path');var sox=require(_0x4d63('0xa'));var csv=require(_0x4d63('0xb'));var ejs=require(_0x4d63('0xc'));var fs=require('fs');var _=require(_0x4d63('0xd'));var squel=require(_0x4d63('0xe'));var crypto=require(_0x4d63('0xf'));var jsforce=require(_0x4d63('0x10'));var deskjs=require(_0x4d63('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d63('0x12'));var Redis=require('ioredis');var authService=require(_0x4d63('0x13'));var qs=require(_0x4d63('0x14'));var as=require(_0x4d63('0x15'));var hardwareService=require(_0x4d63('0x16'));var logger=require('../../config/logger')(_0x4d63('0x17'));var utils=require('../../config/utils');var config=require(_0x4d63('0x18'));var licenseUtil=require(_0x4d63('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4722e9,_0x391247){_0x391247=_0x391247||0xcc;return function(_0x3f7722){if(_0x3f7722){return _0x4722e9[_0x4d63('0x1a')](_0x391247);}return _0x4722e9[_0x4d63('0x1b')](_0x391247)[_0x4d63('0x1c')]();};}function respondWithResult(_0x20485c,_0x2924db){_0x2924db=_0x2924db||0xc8;return function(_0x215990){if(_0x215990){return _0x20485c[_0x4d63('0x1b')](_0x2924db)[_0x4d63('0x1d')](_0x215990);}};}function respondWithFilteredResult(_0x2454cc,_0xe435ec){return function(_0x59497d){if(_0x59497d){var _0x38804a=_0x59497d[_0x4d63('0x1e')],_0x3ab719=_0xe435ec[_0x4d63('0x1f')],_0x6c70=_0xe435ec[_0x4d63('0x1f')]+_0xe435ec[_0x4d63('0x20')],_0x3ed512;if(_0x6c70>=_0x38804a){_0x6c70=_0x38804a;_0x3ed512=0xc8;}else{_0x3ed512=0xce;}_0x2454cc[_0x4d63('0x1b')](_0x3ed512);return _0x2454cc[_0x4d63('0x21')](_0x4d63('0x22'),_0x3ab719+'-'+_0x6c70+'/'+_0x38804a)['json'](_0x59497d);}return null;};}function patchUpdates(_0x3b2695){return function(_0x4a8aa8){try{jsonpatch['apply'](_0x4a8aa8,_0x3b2695,!![]);}catch(_0x5a430c){return BPromise['reject'](_0x5a430c);}return _0x4a8aa8[_0x4d63('0x23')]();};}function saveUpdates(_0x230af4,_0x1f8ac1){return function(_0x422de0){if(_0x422de0){return _0x422de0['update'](_0x230af4)[_0x4d63('0x24')](function(_0x35d7b0){return _0x35d7b0;});}return null;};}function removeEntity(_0x2d8f02,_0x2b9ad6){return function(_0x129d14){if(_0x129d14){return _0x129d14[_0x4d63('0x25')]()[_0x4d63('0x24')](function(){_0x2d8f02['status'](0xcc)[_0x4d63('0x1c')]();});}};}function handleEntityNotFound(_0x26d29c,_0x5c6777){return function(_0x1fd6e3){if(!_0x1fd6e3){_0x26d29c[_0x4d63('0x1a')](0x194);}return _0x1fd6e3;};}function handleError(_0x671dcf,_0x4a0766){_0x4a0766=_0x4a0766||0x1f4;return function(_0x484c30){logger[_0x4d63('0x26')](_0x484c30[_0x4d63('0x27')]);if(_0x484c30['name']){delete _0x484c30[_0x4d63('0x28')];}_0x671dcf[_0x4d63('0x1b')](_0x4a0766)['send'](_0x484c30);};}exports[_0x4d63('0x29')]=function(_0x228717,_0x8065f2){var _0x40e76b={},_0x43daaf={},_0x39e47e={'count':0x0,'rows':[]};var _0x422b46=_[_0x4d63('0x2a')](db[_0x4d63('0x2b')][_0x4d63('0x2c')],function(_0x5d3051){return{'name':_0x5d3051[_0x4d63('0x2d')],'type':_0x5d3051[_0x4d63('0x2e')][_0x4d63('0x2f')]};});_0x43daaf[_0x4d63('0x30')]=_[_0x4d63('0x2a')](_0x422b46,_0x4d63('0x28'));_0x43daaf['query']=_[_0x4d63('0x31')](_0x228717['query']);_0x43daaf[_0x4d63('0x32')]=_[_0x4d63('0x33')](_0x43daaf[_0x4d63('0x30')],_0x43daaf['query']);_0x40e76b[_0x4d63('0x34')]=_['intersection'](_0x43daaf[_0x4d63('0x30')],qs[_0x4d63('0x35')](_0x228717[_0x4d63('0x36')][_0x4d63('0x35')]));_0x40e76b['attributes']=_0x40e76b[_0x4d63('0x34')][_0x4d63('0x37')]?_0x40e76b[_0x4d63('0x34')]:_0x43daaf['model'];if(!_0x228717[_0x4d63('0x36')]['hasOwnProperty']('nolimit')){_0x40e76b[_0x4d63('0x20')]=qs[_0x4d63('0x20')](_0x228717['query'][_0x4d63('0x20')]);_0x40e76b[_0x4d63('0x1f')]=qs[_0x4d63('0x1f')](_0x228717[_0x4d63('0x36')][_0x4d63('0x1f')]);}_0x40e76b['order']=qs[_0x4d63('0x38')](_0x228717[_0x4d63('0x36')][_0x4d63('0x38')]);_0x40e76b['where']=qs[_0x4d63('0x32')](_[_0x4d63('0x39')](_0x228717['query'],_0x43daaf[_0x4d63('0x32')]),_0x422b46);if(_0x228717[_0x4d63('0x36')][_0x4d63('0x3a')]){_0x40e76b['where']=_[_0x4d63('0x3b')](_0x40e76b[_0x4d63('0x3c')],{'$or':_[_0x4d63('0x2a')](_0x422b46,function(_0x251a8b){if(_0x251a8b['type']!==_0x4d63('0x3d')){var _0x2fc0fe={};_0x2fc0fe[_0x251a8b['name']]={'$like':'%'+_0x228717['query'][_0x4d63('0x3a')]+'%'};return _0x2fc0fe;}})});}_0x40e76b=_['merge']({},_0x40e76b,_0x228717[_0x4d63('0x3e')]);var _0x5815f1={'where':_0x40e76b['where']};return db[_0x4d63('0x2b')][_0x4d63('0x1e')](_0x5815f1)[_0x4d63('0x24')](function(_0xb761ee){_0x39e47e[_0x4d63('0x1e')]=_0xb761ee;if(_0x228717[_0x4d63('0x36')][_0x4d63('0x3f')]){_0x40e76b['include']=[{'all':!![]}];}return db[_0x4d63('0x2b')][_0x4d63('0x40')](_0x40e76b);})[_0x4d63('0x24')](function(_0x4cc52a){_0x39e47e['rows']=_0x4cc52a;return _0x39e47e;})['then'](respondWithFilteredResult(_0x8065f2,_0x40e76b))[_0x4d63('0x41')](handleError(_0x8065f2,null));};exports[_0x4d63('0x42')]=function(_0x19dd59,_0x473c69){var _0x4c3851={'raw':!![],'where':{'id':_0x19dd59[_0x4d63('0x43')]['id']}},_0x2a691f={};_0x2a691f[_0x4d63('0x30')]=_[_0x4d63('0x31')](db['WhatsappTransferReport'][_0x4d63('0x2c')]);_0x2a691f[_0x4d63('0x36')]=_[_0x4d63('0x31')](_0x19dd59[_0x4d63('0x36')]);_0x2a691f['filters']=_[_0x4d63('0x33')](_0x2a691f[_0x4d63('0x30')],_0x2a691f[_0x4d63('0x36')]);_0x4c3851[_0x4d63('0x34')]=_['intersection'](_0x2a691f[_0x4d63('0x30')],qs[_0x4d63('0x35')](_0x19dd59[_0x4d63('0x36')][_0x4d63('0x35')]));_0x4c3851[_0x4d63('0x34')]=_0x4c3851[_0x4d63('0x34')][_0x4d63('0x37')]?_0x4c3851[_0x4d63('0x34')]:_0x2a691f[_0x4d63('0x30')];if(_0x19dd59[_0x4d63('0x36')][_0x4d63('0x3f')]){_0x4c3851[_0x4d63('0x44')]=[{'all':!![]}];}_0x4c3851=_[_0x4d63('0x3b')]({},_0x4c3851,_0x19dd59[_0x4d63('0x3e')]);return db['WhatsappTransferReport'][_0x4d63('0x45')](_0x4c3851)[_0x4d63('0x24')](handleEntityNotFound(_0x473c69,null))[_0x4d63('0x24')](respondWithResult(_0x473c69,null))[_0x4d63('0x41')](handleError(_0x473c69,null));};exports[_0x4d63('0x46')]=function(_0x30ace9,_0x35f860){return db[_0x4d63('0x2b')][_0x4d63('0x46')](_0x30ace9[_0x4d63('0x47')],{})[_0x4d63('0x24')](respondWithResult(_0x35f860,0xc9))[_0x4d63('0x41')](handleError(_0x35f860,null));};exports['update']=function(_0x3ac0a6,_0x38277e){if(_0x3ac0a6[_0x4d63('0x47')]['id']){delete _0x3ac0a6[_0x4d63('0x47')]['id'];}return db[_0x4d63('0x2b')][_0x4d63('0x45')]({'where':{'id':_0x3ac0a6[_0x4d63('0x43')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x38277e,null))[_0x4d63('0x24')](saveUpdates(_0x3ac0a6[_0x4d63('0x47')],null))[_0x4d63('0x24')](respondWithResult(_0x38277e,null))[_0x4d63('0x41')](handleError(_0x38277e,null));};exports[_0x4d63('0x25')]=function(_0x4cf740,_0x59ce12){return db[_0x4d63('0x2b')][_0x4d63('0x45')]({'where':{'id':_0x4cf740[_0x4d63('0x43')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x59ce12,null))[_0x4d63('0x24')](removeEntity(_0x59ce12,null))[_0x4d63('0x41')](handleError(_0x59ce12,null));};exports[_0x4d63('0x48')]=function(_0x5d4380,_0x3c04fc){return db[_0x4d63('0x2b')]['describe']()[_0x4d63('0x24')](respondWithResult(_0x3c04fc,null))[_0x4d63('0x41')](handleError(_0x3c04fc,null));}; \ No newline at end of file +var _0x191a=['rows','catch','params','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','WhatsappTransferReport','findAll'];(function(_0x10b345,_0x456808){var _0x40adb9=function(_0x4e5d46){while(--_0x4e5d46){_0x10b345['push'](_0x10b345['shift']());}};_0x40adb9(++_0x456808);}(_0x191a,0xef));var _0xa191=function(_0xc7f12f,_0xaed5){_0xc7f12f=_0xc7f12f-0x0;var _0x5f48fa=_0x191a[_0xc7f12f];return _0x5f48fa;};'use strict';var pdf=require(_0xa191('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa191('0x1'));var zipdir=require(_0xa191('0x2'));var jsonpatch=require(_0xa191('0x3'));var rp=require(_0xa191('0x4'));var moment=require(_0xa191('0x5'));var BPromise=require(_0xa191('0x6'));var Mustache=require(_0xa191('0x7'));var util=require(_0xa191('0x8'));var path=require(_0xa191('0x9'));var sox=require(_0xa191('0xa'));var csv=require(_0xa191('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa191('0xc'));var squel=require(_0xa191('0xd'));var crypto=require('crypto');var jsforce=require(_0xa191('0xe'));var deskjs=require(_0xa191('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa191('0x10'));var Papa=require(_0xa191('0x11'));var Redis=require(_0xa191('0x12'));var authService=require(_0xa191('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa191('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa191('0x15'));var utils=require(_0xa191('0x16'));var config=require(_0xa191('0x17'));var licenseUtil=require(_0xa191('0x18'));var db=require(_0xa191('0x19'))['db'];function respondWithStatusCode(_0x100bd4,_0x1436b5){_0x1436b5=_0x1436b5||0xcc;return function(_0x5a52b1){if(_0x5a52b1){return _0x100bd4[_0xa191('0x1a')](_0x1436b5);}return _0x100bd4['status'](_0x1436b5)['end']();};}function respondWithResult(_0x51adb3,_0x105f5a){_0x105f5a=_0x105f5a||0xc8;return function(_0x3bd524){if(_0x3bd524){return _0x51adb3[_0xa191('0x1b')](_0x105f5a)[_0xa191('0x1c')](_0x3bd524);}};}function respondWithFilteredResult(_0x49f239,_0x5e1114){return function(_0x3ba1f9){if(_0x3ba1f9){var _0x4cee99=_0x3ba1f9[_0xa191('0x1d')],_0xb2a26e=_0x5e1114[_0xa191('0x1e')],_0x36f7b8=_0x5e1114[_0xa191('0x1e')]+_0x5e1114[_0xa191('0x1f')],_0x1c179b;if(_0x36f7b8>=_0x4cee99){_0x36f7b8=_0x4cee99;_0x1c179b=0xc8;}else{_0x1c179b=0xce;}_0x49f239[_0xa191('0x1b')](_0x1c179b);return _0x49f239['set'](_0xa191('0x20'),_0xb2a26e+'-'+_0x36f7b8+'/'+_0x4cee99)[_0xa191('0x1c')](_0x3ba1f9);}return null;};}function patchUpdates(_0x1a7b98){return function(_0x5096ff){try{jsonpatch[_0xa191('0x21')](_0x5096ff,_0x1a7b98,!![]);}catch(_0x374e4c){return BPromise[_0xa191('0x22')](_0x374e4c);}return _0x5096ff[_0xa191('0x23')]();};}function saveUpdates(_0xe39816,_0x51e09c){return function(_0x2451f1){if(_0x2451f1){return _0x2451f1[_0xa191('0x24')](_0xe39816)[_0xa191('0x25')](function(_0xe86b8c){return _0xe86b8c;});}return null;};}function removeEntity(_0x2ecf1e,_0x5f24a7){return function(_0x5cfc32){if(_0x5cfc32){return _0x5cfc32[_0xa191('0x26')]()[_0xa191('0x25')](function(){_0x2ecf1e['status'](0xcc)[_0xa191('0x27')]();});}};}function handleEntityNotFound(_0x3ba431,_0x2405ce){return function(_0x346788){if(!_0x346788){_0x3ba431[_0xa191('0x1a')](0x194);}return _0x346788;};}function handleError(_0x53e8be,_0x48383c){_0x48383c=_0x48383c||0x1f4;return function(_0x13a9cb){logger[_0xa191('0x28')](_0x13a9cb[_0xa191('0x29')]);if(_0x13a9cb[_0xa191('0x2a')]){delete _0x13a9cb['name'];}_0x53e8be['status'](_0x48383c)['send'](_0x13a9cb);};}exports[_0xa191('0x2b')]=function(_0x482cb3,_0x1404e6){var _0x3c4dc9={},_0x4a4ef0={},_0x193a7c={'count':0x0,'rows':[]};var _0x599b68=_[_0xa191('0x2c')](db['WhatsappTransferReport'][_0xa191('0x2d')],function(_0x584b5b){return{'name':_0x584b5b[_0xa191('0x2e')],'type':_0x584b5b[_0xa191('0x2f')][_0xa191('0x30')]};});_0x4a4ef0[_0xa191('0x31')]=_[_0xa191('0x2c')](_0x599b68,'name');_0x4a4ef0[_0xa191('0x32')]=_[_0xa191('0x33')](_0x482cb3[_0xa191('0x32')]);_0x4a4ef0[_0xa191('0x34')]=_[_0xa191('0x35')](_0x4a4ef0[_0xa191('0x31')],_0x4a4ef0['query']);_0x3c4dc9[_0xa191('0x36')]=_[_0xa191('0x35')](_0x4a4ef0[_0xa191('0x31')],qs[_0xa191('0x37')](_0x482cb3[_0xa191('0x32')]['fields']));_0x3c4dc9[_0xa191('0x36')]=_0x3c4dc9[_0xa191('0x36')][_0xa191('0x38')]?_0x3c4dc9[_0xa191('0x36')]:_0x4a4ef0[_0xa191('0x31')];if(!_0x482cb3['query'][_0xa191('0x39')](_0xa191('0x3a'))){_0x3c4dc9[_0xa191('0x1f')]=qs[_0xa191('0x1f')](_0x482cb3['query'][_0xa191('0x1f')]);_0x3c4dc9[_0xa191('0x1e')]=qs[_0xa191('0x1e')](_0x482cb3[_0xa191('0x32')][_0xa191('0x1e')]);}_0x3c4dc9['order']=qs['sort'](_0x482cb3[_0xa191('0x32')][_0xa191('0x3b')]);_0x3c4dc9[_0xa191('0x3c')]=qs['filters'](_[_0xa191('0x3d')](_0x482cb3['query'],_0x4a4ef0['filters']),_0x599b68);if(_0x482cb3['query'][_0xa191('0x3e')]){_0x3c4dc9[_0xa191('0x3c')]=_[_0xa191('0x3f')](_0x3c4dc9[_0xa191('0x3c')],{'$or':_[_0xa191('0x2c')](_0x599b68,function(_0xb737b9){if(_0xb737b9['type']!==_0xa191('0x40')){var _0x4b9223={};_0x4b9223[_0xb737b9[_0xa191('0x2a')]]={'$like':'%'+_0x482cb3[_0xa191('0x32')][_0xa191('0x3e')]+'%'};return _0x4b9223;}})});}_0x3c4dc9=_[_0xa191('0x3f')]({},_0x3c4dc9,_0x482cb3['options']);var _0x3f7d71={'where':_0x3c4dc9[_0xa191('0x3c')]};return db['WhatsappTransferReport']['count'](_0x3f7d71)[_0xa191('0x25')](function(_0x548e00){_0x193a7c[_0xa191('0x1d')]=_0x548e00;if(_0x482cb3[_0xa191('0x32')][_0xa191('0x41')]){_0x3c4dc9[_0xa191('0x42')]=[{'all':!![]}];}return db[_0xa191('0x43')][_0xa191('0x44')](_0x3c4dc9);})[_0xa191('0x25')](function(_0x4cfd42){_0x193a7c[_0xa191('0x45')]=_0x4cfd42;return _0x193a7c;})[_0xa191('0x25')](respondWithFilteredResult(_0x1404e6,_0x3c4dc9))[_0xa191('0x46')](handleError(_0x1404e6,null));};exports['show']=function(_0x470c98,_0x51094d){var _0x4263fd={'raw':!![],'where':{'id':_0x470c98[_0xa191('0x47')]['id']}},_0x49ee70={};_0x49ee70[_0xa191('0x31')]=_[_0xa191('0x33')](db['WhatsappTransferReport']['rawAttributes']);_0x49ee70[_0xa191('0x32')]=_['keys'](_0x470c98[_0xa191('0x32')]);_0x49ee70[_0xa191('0x34')]=_[_0xa191('0x35')](_0x49ee70[_0xa191('0x31')],_0x49ee70['query']);_0x4263fd[_0xa191('0x36')]=_['intersection'](_0x49ee70[_0xa191('0x31')],qs[_0xa191('0x37')](_0x470c98[_0xa191('0x32')][_0xa191('0x37')]));_0x4263fd[_0xa191('0x36')]=_0x4263fd[_0xa191('0x36')][_0xa191('0x38')]?_0x4263fd[_0xa191('0x36')]:_0x49ee70[_0xa191('0x31')];if(_0x470c98[_0xa191('0x32')][_0xa191('0x41')]){_0x4263fd[_0xa191('0x42')]=[{'all':!![]}];}_0x4263fd=_[_0xa191('0x3f')]({},_0x4263fd,_0x470c98[_0xa191('0x48')]);return db[_0xa191('0x43')][_0xa191('0x49')](_0x4263fd)[_0xa191('0x25')](handleEntityNotFound(_0x51094d,null))[_0xa191('0x25')](respondWithResult(_0x51094d,null))[_0xa191('0x46')](handleError(_0x51094d,null));};exports[_0xa191('0x4a')]=function(_0x2f67a4,_0x3845bc){return db[_0xa191('0x43')][_0xa191('0x4a')](_0x2f67a4[_0xa191('0x4b')],{})[_0xa191('0x25')](respondWithResult(_0x3845bc,0xc9))['catch'](handleError(_0x3845bc,null));};exports['update']=function(_0x44c600,_0x445b0f){if(_0x44c600['body']['id']){delete _0x44c600[_0xa191('0x4b')]['id'];}return db[_0xa191('0x43')]['find']({'where':{'id':_0x44c600[_0xa191('0x47')]['id']}})[_0xa191('0x25')](handleEntityNotFound(_0x445b0f,null))['then'](saveUpdates(_0x44c600[_0xa191('0x4b')],null))[_0xa191('0x25')](respondWithResult(_0x445b0f,null))[_0xa191('0x46')](handleError(_0x445b0f,null));};exports[_0xa191('0x26')]=function(_0x4199a6,_0x26ec9a){return db[_0xa191('0x43')][_0xa191('0x49')]({'where':{'id':_0x4199a6[_0xa191('0x47')]['id']}})[_0xa191('0x25')](handleEntityNotFound(_0x26ec9a,null))[_0xa191('0x25')](removeEntity(_0x26ec9a,null))['catch'](handleError(_0x26ec9a,null));};exports[_0xa191('0x4c')]=function(_0x50a741,_0x739d32){return db[_0xa191('0x43')][_0xa191('0x4c')]()[_0xa191('0x25')](respondWithResult(_0x739d32,null))[_0xa191('0x46')](handleError(_0x739d32,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f869187..d33ef08 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 _0xcde3=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0xfec69d,_0x76db15){var _0x13958a=function(_0x5ee50d){while(--_0x5ee50d){_0xfec69d['push'](_0xfec69d['shift']());}};_0x13958a(++_0x76db15);}(_0xcde3,0x186));var _0x3cde=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0xcde3[_0x318256];return _0xb1e352;};'use strict';var _=require(_0x3cde('0x0'));var util=require(_0x3cde('0x1'));var logger=require(_0x3cde('0x2'))(_0x3cde('0x3'));var moment=require(_0x3cde('0x4'));var BPromise=require(_0x3cde('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cde('0x6'));var rimraf=require(_0x3cde('0x7'));var config=require(_0x3cde('0x8'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x78c317,_0x5815fd){return _0x78c317[_0x3cde('0x9')](_0x3cde('0xa'),attributes,{'tableName':_0x3cde('0xb'),'paranoid':![],'indexes':[{'name':_0x3cde('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf84c=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf84c,0xe2));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf84('0x0'));var util=require(_0xcf84('0x1'));var logger=require(_0xcf84('0x2'))(_0xcf84('0x3'));var moment=require(_0xcf84('0x4'));var BPromise=require(_0xcf84('0x5'));var rp=require(_0xcf84('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf84('0x7'));var config=require(_0xcf84('0x8'));var attributes=require(_0xcf84('0x9'));module[_0xcf84('0xa')]=function(_0x2e25b4,_0x1c5313){return _0x2e25b4[_0xcf84('0xb')](_0xcf84('0xc'),attributes,{'tableName':_0xcf84('0xd'),'paranoid':![],'indexes':[{'name':_0xcf84('0xe'),'fields':[_0xcf84('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 79ff538..a29bd0d 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2beda5,_0x5c90c9){var _0x21908b=function(_0x193355){while(--_0x193355){_0x2beda5['push'](_0x2beda5['shift']());}};_0x21908b(++_0x5c90c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2815e5,_0x5e7340){var _0x576eca=function(_0x30abab){while(--_0x30abab){_0x2815e5['push'](_0x2815e5['shift']());}};_0x576eca(++_0x5e7340);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 80ede86..fa45838 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cdc=['None','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','online','join','name'];(function(_0x47d214,_0x3366c7){var _0x6f643c=function(_0x18d2f5){while(--_0x18d2f5){_0x47d214['push'](_0x47d214['shift']());}};_0x6f643c(++_0x3366c7);}(_0x7cdc,0x190));var _0xc7cd=function(_0x9e25c0,_0x2bc32e){_0x9e25c0=_0x9e25c0-0x0;var _0x13fb2a=_0x7cdc[_0x9e25c0];return _0x13fb2a;};'use strict';var _=require('lodash');var mysqldb=require(_0xc7cd('0x0'));var rpc=require(_0xc7cd('0x1'));var config=require('./config/environment');var logger=require(_0xc7cd('0x2'))(_0xc7cd('0x3'));var pm2=require(_0xc7cd('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xc7cd('0x5'));var chat=require(_0xc7cd('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xc7cd('0x7'));function main(){return mysqldb['db'][_0xc7cd('0x8')][_0xc7cd('0x9')]()[_0xc7cd('0xa')](function(){return rpc[_0xc7cd('0xb')]();})[_0xc7cd('0xa')](function(_0x42a4b8){logger['info'](_0x42a4b8);return chat[_0xc7cd('0xc')]();})['then'](function(){return whatsapp[_0xc7cd('0xc')]();})[_0xc7cd('0xa')](function(){return schedule[_0xc7cd('0xc')]();})[_0xc7cd('0xa')](function(){return transcribe['start']();})[_0xc7cd('0xa')](function(_0x4346ee){logger[_0xc7cd('0xd')](_0x4346ee);return pm2[_0xc7cd('0xc')](pm2Config);})['then'](function(_0x1e750c){logger['info'](_0xc7cd('0xe'),_[_0xc7cd('0xf')](_[_0xc7cd('0x10')](_0x1e750c,{'status':_0xc7cd('0x11')}),'name')[_0xc7cd('0x12')]());logger[_0xc7cd('0xd')]('Offline\x20apps:',_[_0xc7cd('0xf')](_['filter'](_0x1e750c,function(_0x25db6c){return _0x25db6c['status']!==_0xc7cd('0x11');}),_0xc7cd('0x13'))[_0xc7cd('0x12')]()||_0xc7cd('0x14'));config['seedDB']&&require(_0xc7cd('0x15'))[_0xc7cd('0x16')]();require(_0xc7cd('0x17'))[_0xc7cd('0x16')]();})[_0xc7cd('0x18')](function(_0x2eca03){logger[_0xc7cd('0x19')](_0xc7cd('0x1a'),_0x2eca03);process[_0xc7cd('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x500c=['None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:'];(function(_0x23c813,_0x4fb118){var _0x25b020=function(_0xf81b73){while(--_0xf81b73){_0x23c813['push'](_0x23c813['shift']());}};_0x25b020(++_0x4fb118);}(_0x500c,0x188));var _0xc500=function(_0x4bc88c,_0x29970a){_0x4bc88c=_0x4bc88c-0x0;var _0x392d8d=_0x500c[_0x4bc88c];return _0x392d8d;};'use strict';var _=require(_0xc500('0x0'));var mysqldb=require(_0xc500('0x1'));var rpc=require(_0xc500('0x2'));var config=require(_0xc500('0x3'));var logger=require(_0xc500('0x4'))(_0xc500('0x5'));var pm2=require(_0xc500('0x6'));var pm2Config=require(_0xc500('0x7'));var schedule=require(_0xc500('0x8'));var chat=require(_0xc500('0x9'));var whatsapp=require(_0xc500('0xa'));var transcribe=require(_0xc500('0xb'));function main(){return mysqldb['db'][_0xc500('0xc')][_0xc500('0xd')]()[_0xc500('0xe')](function(){return rpc['listen']();})[_0xc500('0xe')](function(_0x480a10){logger[_0xc500('0xf')](_0x480a10);return chat[_0xc500('0x10')]();})[_0xc500('0xe')](function(){return whatsapp[_0xc500('0x10')]();})[_0xc500('0xe')](function(){return schedule[_0xc500('0x10')]();})['then'](function(){return transcribe[_0xc500('0x10')]();})['then'](function(_0x30fc23){logger['info'](_0x30fc23);return pm2['start'](pm2Config);})[_0xc500('0xe')](function(_0x1edbae){logger['info'](_0xc500('0x11'),_[_0xc500('0x12')](_[_0xc500('0x13')](_0x1edbae,{'status':_0xc500('0x14')}),_0xc500('0x15'))[_0xc500('0x16')]());logger[_0xc500('0xf')](_0xc500('0x17'),_['map'](_[_0xc500('0x13')](_0x1edbae,function(_0x313906){return _0x313906['status']!==_0xc500('0x14');}),_0xc500('0x15'))[_0xc500('0x16')]()||_0xc500('0x18'));config[_0xc500('0x19')]&&require(_0xc500('0x1a'))[_0xc500('0x1b')]();require('./config/license')[_0xc500('0x1b')]();})[_0xc500('0x1c')](function(_0x3ca6a8){logger[_0xc500('0x1d')](_0xc500('0x1e'),_0x3ca6a8);process[_0xc500('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ba2e69c..1bb1cbc 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 _0x8085=['isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','status','json','unmanaged','Forbidden.','isAuthenticated','headers','authorization','Basic','User','find','then','pass','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','apiKeyNonce','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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','decryptString','split','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role','internal','email','userpic','permissions','voicePause','mailPause','faxPause','smsPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled'];(function(_0x59d232,_0x1d5632){var _0x216518=function(_0x1e0171){while(--_0x1e0171){_0x59d232['push'](_0x59d232['shift']());}};_0x216518(++_0x1d5632);}(_0x8085,0xcb));var _0x5808=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x8085[_0x31ced5];return _0x10d9e5;};'use strict';var db=require(_0x5808('0x0'))['db'];var config=require(_0x5808('0x1'));var hardwareConf=require(_0x5808('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x5808('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x5808('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x5808('0x5'));var crypto=require(_0x5808('0x6'));var BPromise=require(_0x5808('0x7'));var util=require(_0x5808('0x8'));var moment=require(_0x5808('0x9'));var validateJwt=expressJwt({'secret':config[_0x5808('0xa')][_0x5808('0xb')]});var userAttributes=['id',_0x5808('0xc'),'fullname','name',_0x5808('0xd'),_0x5808('0xe'),_0x5808('0xf'),_0x5808('0x10'),'md5secret',_0x5808('0x11'),'chatPause',_0x5808('0x12'),_0x5808('0x13'),_0x5808('0x14'),'openchannelPause','pauseType',_0x5808('0x15'),'lastLoginAt',_0x5808('0x16'),_0x5808('0x17'),_0x5808('0x18'),_0x5808('0x19'),_0x5808('0x1a'),_0x5808('0x1b'),_0x5808('0x1c'),_0x5808('0x1d'),'phoneBarEnableRecording',_0x5808('0x1e'),_0x5808('0x1f'),'phoneBarExpires','phoneBarPrefixRequired',_0x5808('0x20'),_0x5808('0x21'),'hotdesk',_0x5808('0x22'),_0x5808('0x23'),_0x5808('0x24')];exports[_0x5808('0x25')]=function(){return this['isAuthenticated'](!![])[_0x5808('0x26')](function(_0x33cad0,_0x2c35eb,_0x100451){if(_0x33cad0[_0x5808('0x27')]){_0x100451();}else{return db[_0x5808('0x28')][_0x5808('0x29')]({'where':{'id':_0x33cad0[_0x5808('0x2a')]['id']},'attributes':['id',_0x5808('0x2b'),_0x5808('0x2c')],'raw':!![]})['then'](function(_0x129ba1){if(_0x129ba1&&_0x129ba1[_0x5808('0x2b')]){return _0x2c35eb[_0x5808('0x2d')](_0x129ba1[_0x5808('0x2c')]==='unmanaged'?0x195:0x193)[_0x5808('0x2e')]({'message':_0x129ba1[_0x5808('0x2c')]===_0x5808('0x2f')?'Unmanaged.':_0x5808('0x30')});}else{_0x100451();}})['catch'](function(_0x1ebdfe){_0x100451(_0x1ebdfe);});}});};exports[_0x5808('0x31')]=function isAuthenticated(_0x140a23){return compose()[_0x5808('0x26')](function(_0x202e8c,_0x361029,_0x1d8379){var _0x43f7f7;if(_0x202e8c[_0x5808('0x32')][_0x5808('0x33')]){if(_['startsWith'](_0x202e8c['headers'][_0x5808('0x33')],_0x5808('0x34'))){var _0x1ba836=basicAuth(_0x202e8c);db[_0x5808('0x35')][_0x5808('0x36')]({'where':{'name':_0x1ba836['name']}})[_0x5808('0x37')](function(_0x15202f){if(!_0x15202f||!_0x15202f['authenticate'](_0x1ba836[_0x5808('0x38')])){return _0x361029[_0x5808('0x2d')](0x191)[_0x5808('0x2e')]({'message':_0x5808('0x39')});}_0x202e8c[_0x5808('0x27')]={'id':_0x15202f['id']};_0x1d8379();})[_0x5808('0x3a')](function(_0x3fb860){_0x1d8379(_0x3fb860);});}else if(_[_0x5808('0x3b')](_0x202e8c[_0x5808('0x32')][_0x5808('0x33')],'Bearer')){validateJwt(_0x202e8c,_0x361029,_0x1d8379);}else{if(_0x140a23){_0x1d8379();}else{return _0x361029[_0x5808('0x2d')](0x193)[_0x5808('0x2e')]({'message':_0x5808('0x3c')});}}}else if(_0x202e8c[_0x5808('0x3d')][_0x5808('0x3e')]){try{var _0x3b5dc1={'audience':hardwareConf[_0x5808('0x3f')](),'issuer':hardwareConf[_0x5808('0x3f')]()};verifyJwt(_0x202e8c[_0x5808('0x3d')]['apikey'],_0x3b5dc1)[_0x5808('0x37')](function(_0x5d9e1a){return db['User'][_0x5808('0x36')]({'where':{'id':_0x5d9e1a[_0x5808('0x40')]}})['then'](function(_0xf63a94){_0x43f7f7=_0xf63a94;return db[_0x5808('0x41')][_0x5808('0x29')]({'where':{'id':0x1},'attributes':[_0x5808('0x42'),_0x5808('0x43')],'raw':!![]});})[_0x5808('0x37')](function(_0x170dd7){if(!_0x43f7f7||!_['isEqual'](_0x43f7f7['apiKeyNonce'],_0x5d9e1a['nonce'])){return _0x361029[_0x5808('0x2d')](0x191)[_0x5808('0x2e')]({'message':_0x5808('0x44')});}if(_0x43f7f7[_0x5808('0x45')]){return _0x361029[_0x5808('0x2d')](0x191)[_0x5808('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x43f7f7[_0x5808('0x46')]){if(_0x170dd7[_0x5808('0x43')]>0x0){if(moment(_0x43f7f7[_0x5808('0x47')])[_0x5808('0x48')](_0x170dd7['blockDuration'],_0x5808('0x49'))>moment()){return _0x361029[_0x5808('0x2d')](0x191)[_0x5808('0x2e')]({'message':_0x5808('0x4a')});}}else{return _0x361029['status'](0x191)[_0x5808('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x202e8c[_0x5808('0x27')]={'id':_0x43f7f7['id']};_0x1d8379();});})['catch'](function(){return _0x361029['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x37ab96){_0x1d8379(_0x37ab96);}}else if(_0x140a23){_0x1d8379();}else{return _0x361029['status'](0x193)[_0x5808('0x2e')]({'message':_0x5808('0x3c')});}})[_0x5808('0x26')](function(_0x1e2169,_0x3ff46a,_0x4ce943){if(_0x1e2169[_0x5808('0x27')]){db[_0x5808('0x35')][_0x5808('0x36')]({'where':{'id':_0x1e2169[_0x5808('0x27')]['id']},'attributes':userAttributes})[_0x5808('0x37')](function(_0x5e7a00){if(!_0x5e7a00){return _0x3ff46a[_0x5808('0x2d')](0x194)[_0x5808('0x2e')]({'message':_0x5808('0x4b')});}_0x1e2169['user']=_0x5e7a00;_0x4ce943();})['catch'](function(_0x5ad6a0){_0x4ce943(_0x5ad6a0);});}else if(_0x140a23){_0x4ce943();}else{return _0x3ff46a['status'](0x194)[_0x5808('0x2e')]({'message':_0x5808('0x4c')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x2d8472,_0xc26f,_0x56ca3f){return licenseUtil[_0x5808('0x4d')]()['then'](function(_0x5f263d){if(_0x5f263d['update']){_0x56ca3f();}else{return _0xc26f[_0x5808('0x2d')](0x193)[_0x5808('0x2e')]({'message':_0x5808('0x4e')});}})[_0x5808('0x3a')](function(_0x5a4311){_0x56ca3f(_0x5a4311);});});};exports['isMiddleware']=function(_0x43bd2c,_0x52ddaa,_0x415e10){_0x43bd2c[_0x5808('0x4f')]=!![];return _0x415e10();};exports[_0x5808('0x50')]=function signToken(_0x2e9ec2){return signJwt(_0x2e9ec2);};exports[_0x5808('0x51')]=function(_0x5c0372,_0x17c46b){if(!_0x5c0372[_0x5808('0x27')]){return _0x17c46b[_0x5808('0x2d')](0x194)[_0x5808('0x2e')]({'message':_0x5808('0x52')});}var _0x4a9ef3={'payload':{'id':_0x5c0372[_0x5808('0x27')]['id'],'role':_0x5c0372[_0x5808('0x27')][_0x5808('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a9ef3)['then'](function(_0x52cb99){_0x17c46b[_0x5808('0x53')](_0x5808('0x54'),_0x52cb99);_0x17c46b[_0x5808('0x55')](_0x5808('0x56'));})[_0x5808('0x3a')](function(_0x3777f7){return _0x17c46b[_0x5808('0x2d')](0x1f4)[_0x5808('0x57')](_0x3777f7);});};exports['retrieveApiKey']=function(_0x6e69d7){if(_['isNil'](_0x6e69d7[_0x5808('0x58')])||_[_0x5808('0x59')](_0x6e69d7[_0x5808('0x5a')])){return null;}else{return createJwt(_0x6e69d7);}};exports[_0x5808('0x5b')]=function(_0x3687c5){_0x3687c5[_0x5808('0x58')]=generateNonce();_0x3687c5[_0x5808('0x5a')]=generateIssuedAt();return createJwt(_0x3687c5);};exports[_0x5808('0x5c')]=function(_0x237cab,_0x35b9dd){var _0x48a9c1=_0x237cab[_0x5808('0x3d')][_0x5808('0x3e')];if(_0x48a9c1){var _0x1d040c={'nonce':_0x35b9dd[_0x5808('0x58')],'iat':_0x35b9dd[_0x5808('0x5a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5808('0x3f')]()};return verifyJwt(_0x48a9c1,_0x1d040c)[_0x5808('0x37')](function(){return generateApiKey(_0x35b9dd);});}else{throw{'message':_0x5808('0x5d')};}};exports[_0x5808('0x5e')]=function(_0x28e6fb){var _0x5d732e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5d732e[_0x5808('0x5f')](_0x28e6fb))throw new db['Sequelize'][(_0x5808('0x60'))](_0x5808('0x61'));return;};exports['validatePasswordHistory']=function(_0x2bde8d,_0x548365,_0x1a548e){var _0xa7091c=encryptor['decryptString'](_0x548365)['split'](',');for(var _0x1e0aae=0x0;_0x1e0aae<_0x1a548e;_0x1e0aae++){if(!_0xa7091c[_0x1e0aae])break;if(_0x2bde8d[_0x5808('0x62')]()===_0xa7091c[_0x1e0aae][_0x5808('0x62')]()){var _0x2d5659=util[_0x5808('0x63')](_0x5808('0x64'),_0x1a548e);if(_0x1a548e===0x1){_0x2d5659=_0x5808('0x65');}throw new db[(_0x5808('0x66'))][(_0x5808('0x60'))](_0x2d5659);}}return;};exports['updatePasswordsHistory']=function(_0xb4c6ec,_0x1b6ddb){var _0x24aace=_0x1b6ddb?encryptor[_0x5808('0x67')](_0x1b6ddb)[_0x5808('0x68')](','):[];if(_0x24aace['length']===0x5){_0x24aace[_0x5808('0x69')](-0x1,0x1);}_0x24aace[_0x5808('0x6a')](_0xb4c6ec);return encryptor[_0x5808('0x6b')](_0x24aace[_0x5808('0x6c')](','));};function signJwt(_0x5906d4){var _0x5daf99=BPromise[_0x5808('0x6d')](jwt[_0x5808('0x6e')],{'context':jwt});var _0x4fb597=_0x5906d4[_0x5808('0x6f')]||config[_0x5808('0xa')][_0x5808('0xb')];return new BPromise(function(_0x298858,_0x2723e5){_0x5daf99(_0x5906d4[_0x5808('0x70')],_0x4fb597,_0x5906d4[_0x5808('0x71')])['then'](function(_0x4310c5){_0x298858(_0x4310c5);})['catch'](function(_0xafa80b){_0x2723e5(_0xafa80b);});});}function verifyJwt(_0x345def,_0x591f9f,_0x59ebcf){var _0x454b28=BPromise['promisify'](jwt[_0x5808('0x72')],{'context':jwt});var _0x45c025=_0x59ebcf||config[_0x5808('0xa')][_0x5808('0xb')];return new BPromise(function(_0x1de0a1,_0x1fe60b){_0x454b28(_0x345def,_0x45c025,_0x591f9f)[_0x5808('0x37')](function(_0x5428a8){_0x1de0a1(_0x5428a8);})['catch'](function(_0x16732c){_0x1fe60b(_0x16732c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x5808('0x73')](_0x5808('0x74'));}function generateIssuedAt(){return Math[_0x5808('0x75')](Date[_0x5808('0x76')]()/0x3e8)[_0x5808('0x73')]();}function createJwt(_0x5b5634){var _0x27ad5e={'payload':{'iat':_0x5b5634[_0x5808('0x5a')],'nonce':_0x5b5634['apiKeyNonce']},'options':{'algorithm':_0x5808('0x77'),'subject':_0x5b5634['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x5808('0x3f')]()}};return signJwt(_0x27ad5e)['then'](function(_0x4c8107){return{'iat':_0x5b5634[_0x5808('0x5a')],'nonce':_0x5b5634['apiKeyNonce'],'token':_0x4c8107};});} \ No newline at end of file +var _0x9d60=['redirect','/dashboards/general','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','splice','unshift','encryptString','join','secret','secrets','payload','options','promisify','verify','randomBytes','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','email','userpic','permissions','voicePause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','closed','disposition','then','unmanaged','json','Forbidden.','catch','authorization','headers','Basic','User','find','pass','status','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token'];(function(_0x2959b8,_0x28fc08){var _0x2ad22d=function(_0x875631){while(--_0x875631){_0x2959b8['push'](_0x2959b8['shift']());}};_0x2ad22d(++_0x28fc08);}(_0x9d60,0x1ee));var _0x09d6=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x9d60[_0x2a4fe2];return _0x225c4a;};'use strict';var db=require(_0x09d6('0x0'))['db'];var config=require(_0x09d6('0x1'));var hardwareConf=require(_0x09d6('0x2'));var licenseUtil=require(_0x09d6('0x3'));var encryptor=require(_0x09d6('0x4'));var _=require(_0x09d6('0x5'));var jwt=require(_0x09d6('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x09d6('0x7'));var basicAuth=require(_0x09d6('0x8'));var crypto=require(_0x09d6('0x9'));var BPromise=require(_0x09d6('0xa'));var util=require(_0x09d6('0xb'));var moment=require(_0x09d6('0xc'));var validateJwt=expressJwt({'secret':config['secrets'][_0x09d6('0xd')]});var userAttributes=['id',_0x09d6('0xe'),_0x09d6('0xf'),_0x09d6('0x10'),'internal',_0x09d6('0x11'),_0x09d6('0x12'),_0x09d6('0x13'),'md5secret',_0x09d6('0x14'),'chatPause',_0x09d6('0x15'),'faxPause',_0x09d6('0x16'),_0x09d6('0x17'),_0x09d6('0x18'),_0x09d6('0x19'),_0x09d6('0x1a'),_0x09d6('0x1b'),_0x09d6('0x1c'),_0x09d6('0x1d'),'passwordResetAt',_0x09d6('0x1e'),'phoneBarAutoAnswer',_0x09d6('0x1f'),'phoneBarDnd',_0x09d6('0x20'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired',_0x09d6('0x21'),_0x09d6('0x22'),'hotdesk','interface',_0x09d6('0x23'),_0x09d6('0x24')];exports[_0x09d6('0x25')]=function(){return this[_0x09d6('0x26')](!![])[_0x09d6('0x27')](function(_0x1504a9,_0x51b1cc,_0x2b812e){if(_0x1504a9[_0x09d6('0x28')]){_0x2b812e();}else{return db['ChatInteraction'][_0x09d6('0x29')]({'where':{'id':_0x1504a9['params']['id']},'attributes':['id',_0x09d6('0x2a'),_0x09d6('0x2b')],'raw':!![]})[_0x09d6('0x2c')](function(_0x5e7a29){if(_0x5e7a29&&_0x5e7a29['closed']){return _0x51b1cc['status'](_0x5e7a29[_0x09d6('0x2b')]===_0x09d6('0x2d')?0x195:0x193)[_0x09d6('0x2e')]({'message':_0x5e7a29[_0x09d6('0x2b')]===_0x09d6('0x2d')?'Unmanaged.':_0x09d6('0x2f')});}else{_0x2b812e();}})[_0x09d6('0x30')](function(_0x4b4752){_0x2b812e(_0x4b4752);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2f36aa){return compose()[_0x09d6('0x27')](function(_0x1a79b2,_0x547fd9,_0x2845d9){var _0x145a99;if(_0x1a79b2['headers'][_0x09d6('0x31')]){if(_['startsWith'](_0x1a79b2[_0x09d6('0x32')][_0x09d6('0x31')],_0x09d6('0x33'))){var _0x1223f0=basicAuth(_0x1a79b2);db[_0x09d6('0x34')][_0x09d6('0x35')]({'where':{'name':_0x1223f0[_0x09d6('0x10')]}})[_0x09d6('0x2c')](function(_0x9551eb){if(!_0x9551eb||!_0x9551eb['authenticate'](_0x1223f0[_0x09d6('0x36')])){return _0x547fd9[_0x09d6('0x37')](0x191)[_0x09d6('0x2e')]({'message':'Wrong\x20credentials.'});}_0x1a79b2[_0x09d6('0x28')]={'id':_0x9551eb['id']};_0x2845d9();})[_0x09d6('0x30')](function(_0x43999e){_0x2845d9(_0x43999e);});}else if(_[_0x09d6('0x38')](_0x1a79b2['headers'][_0x09d6('0x31')],_0x09d6('0x39'))){validateJwt(_0x1a79b2,_0x547fd9,_0x2845d9);}else{if(_0x2f36aa){_0x2845d9();}else{return _0x547fd9[_0x09d6('0x37')](0x193)[_0x09d6('0x2e')]({'message':_0x09d6('0x3a')});}}}else if(_0x1a79b2['query'][_0x09d6('0x3b')]){try{var _0xec48b6={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1a79b2[_0x09d6('0x3c')][_0x09d6('0x3b')],_0xec48b6)[_0x09d6('0x2c')](function(_0x1756a2){return db[_0x09d6('0x34')][_0x09d6('0x35')]({'where':{'id':_0x1756a2[_0x09d6('0x3d')]}})['then'](function(_0x5d859a){_0x145a99=_0x5d859a;return db[_0x09d6('0x3e')]['findOne']({'where':{'id':0x1},'attributes':[_0x09d6('0x3f'),_0x09d6('0x40')],'raw':!![]});})[_0x09d6('0x2c')](function(_0x3bb1a7){if(!_0x145a99||!_[_0x09d6('0x41')](_0x145a99['apiKeyNonce'],_0x1756a2[_0x09d6('0x42')])){return _0x547fd9[_0x09d6('0x37')](0x191)[_0x09d6('0x2e')]({'message':_0x09d6('0x43')});}if(_0x145a99['disabled']){return _0x547fd9[_0x09d6('0x37')](0x191)[_0x09d6('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x145a99['blocked']){if(_0x3bb1a7[_0x09d6('0x40')]>0x0){if(moment(_0x145a99[_0x09d6('0x44')])[_0x09d6('0x45')](_0x3bb1a7[_0x09d6('0x40')],_0x09d6('0x46'))>moment()){return _0x547fd9[_0x09d6('0x37')](0x191)[_0x09d6('0x2e')]({'message':_0x09d6('0x47')});}}else{return _0x547fd9[_0x09d6('0x37')](0x191)[_0x09d6('0x2e')]({'message':_0x09d6('0x47')});}}_0x1a79b2[_0x09d6('0x28')]={'id':_0x145a99['id']};_0x2845d9();});})[_0x09d6('0x30')](function(){return _0x547fd9[_0x09d6('0x37')](0x191)[_0x09d6('0x2e')]({'message':_0x09d6('0x47')});});}catch(_0x37db35){_0x2845d9(_0x37db35);}}else if(_0x2f36aa){_0x2845d9();}else{return _0x547fd9[_0x09d6('0x37')](0x193)[_0x09d6('0x2e')]({'message':_0x09d6('0x3a')});}})[_0x09d6('0x27')](function(_0x1805ce,_0x1b2878,_0x51282f){if(_0x1805ce[_0x09d6('0x28')]){db[_0x09d6('0x34')][_0x09d6('0x35')]({'where':{'id':_0x1805ce[_0x09d6('0x28')]['id']},'attributes':userAttributes})['then'](function(_0x508121){if(!_0x508121){return _0x1b2878[_0x09d6('0x37')](0x194)[_0x09d6('0x2e')]({'message':_0x09d6('0x48')});}_0x1805ce[_0x09d6('0x28')]=_0x508121;_0x51282f();})[_0x09d6('0x30')](function(_0xff0357){_0x51282f(_0xff0357);});}else if(_0x2f36aa){_0x51282f();}else{return _0x1b2878[_0x09d6('0x37')](0x194)['json']({'message':_0x09d6('0x49')});}});};exports[_0x09d6('0x4a')]=function canUpdate(){return compose()[_0x09d6('0x27')](function(_0x197a4d,_0x42db6f,_0x48d356){return licenseUtil[_0x09d6('0x4b')]()[_0x09d6('0x2c')](function(_0x105a81){if(_0x105a81[_0x09d6('0x4c')]){_0x48d356();}else{return _0x42db6f[_0x09d6('0x37')](0x193)[_0x09d6('0x2e')]({'message':_0x09d6('0x4d')});}})[_0x09d6('0x30')](function(_0x8d8dfe){_0x48d356(_0x8d8dfe);});});};exports['isMiddleware']=function(_0xb8e031,_0x40bd99,_0x5a6177){_0xb8e031['isMiddleware']=!![];return _0x5a6177();};exports['signToken']=function signToken(_0x39b3a9){return signJwt(_0x39b3a9);};exports[_0x09d6('0x4e')]=function(_0x3d2b15,_0x97a2c3){if(!_0x3d2b15[_0x09d6('0x28')]){return _0x97a2c3[_0x09d6('0x37')](0x194)['json']({'message':_0x09d6('0x4f')});}var _0xc6d86f={'payload':{'id':_0x3d2b15[_0x09d6('0x28')]['id'],'role':_0x3d2b15['user'][_0x09d6('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0xc6d86f)['then'](function(_0x38d2af){_0x97a2c3['cookie'](_0x09d6('0x50'),_0x38d2af);_0x97a2c3[_0x09d6('0x51')](_0x09d6('0x52'));})[_0x09d6('0x30')](function(_0x186996){return _0x97a2c3[_0x09d6('0x37')](0x1f4)['send'](_0x186996);});};exports[_0x09d6('0x53')]=function(_0x3ff7c5){if(_['isNil'](_0x3ff7c5[_0x09d6('0x54')])||_[_0x09d6('0x55')](_0x3ff7c5[_0x09d6('0x56')])){return null;}else{return createJwt(_0x3ff7c5);}};exports['generateApiKey']=function(_0x5c0ae6){_0x5c0ae6[_0x09d6('0x54')]=generateNonce();_0x5c0ae6['apiKeyIat']=generateIssuedAt();return createJwt(_0x5c0ae6);};exports[_0x09d6('0x57')]=function(_0x5d6b08,_0x29e5f3){var _0x24dcd2=_0x5d6b08['query'][_0x09d6('0x3b')];if(_0x24dcd2){var _0xe0802c={'nonce':_0x29e5f3[_0x09d6('0x54')],'iat':_0x29e5f3['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x24dcd2,_0xe0802c)[_0x09d6('0x2c')](function(){return generateApiKey(_0x29e5f3);});}else{throw{'message':_0x09d6('0x58')};}};exports[_0x09d6('0x59')]=function(_0x357ffe){var _0xdf075c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xdf075c[_0x09d6('0x5a')](_0x357ffe))throw new db['Sequelize'][(_0x09d6('0x5b'))](_0x09d6('0x5c'));return;};exports[_0x09d6('0x5d')]=function(_0x6a7d8,_0x26d82f,_0x380dc8){var _0x34d19b=encryptor[_0x09d6('0x5e')](_0x26d82f)[_0x09d6('0x5f')](',');for(var _0x1d9da7=0x0;_0x1d9da7<_0x380dc8;_0x1d9da7++){if(!_0x34d19b[_0x1d9da7])break;if(_0x6a7d8[_0x09d6('0x60')]()===_0x34d19b[_0x1d9da7][_0x09d6('0x60')]()){var _0x328e51=util[_0x09d6('0x61')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x380dc8);if(_0x380dc8===0x1){_0x328e51=_0x09d6('0x62');}throw new db[(_0x09d6('0x63'))][(_0x09d6('0x5b'))](_0x328e51);}}return;};exports[_0x09d6('0x64')]=function(_0x4bcdf4,_0x4be3f2){var _0x43eedd=_0x4be3f2?encryptor[_0x09d6('0x5e')](_0x4be3f2)[_0x09d6('0x5f')](','):[];if(_0x43eedd['length']===0x5){_0x43eedd[_0x09d6('0x65')](-0x1,0x1);}_0x43eedd[_0x09d6('0x66')](_0x4bcdf4);return encryptor[_0x09d6('0x67')](_0x43eedd[_0x09d6('0x68')](','));};function signJwt(_0x3fa1de){var _0x553223=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x4bda02=_0x3fa1de[_0x09d6('0x69')]||config[_0x09d6('0x6a')][_0x09d6('0xd')];return new BPromise(function(_0x112887,_0x29f9be){_0x553223(_0x3fa1de[_0x09d6('0x6b')],_0x4bda02,_0x3fa1de[_0x09d6('0x6c')])[_0x09d6('0x2c')](function(_0x5171b3){_0x112887(_0x5171b3);})['catch'](function(_0x3c753f){_0x29f9be(_0x3c753f);});});}function verifyJwt(_0x3e0eac,_0x272c4f,_0x1dbd34){var _0x5e2e7e=BPromise[_0x09d6('0x6d')](jwt[_0x09d6('0x6e')],{'context':jwt});var _0x408533=_0x1dbd34||config['secrets'][_0x09d6('0xd')];return new BPromise(function(_0x17a054,_0xb5b2d8){_0x5e2e7e(_0x3e0eac,_0x408533,_0x272c4f)['then'](function(_0x252557){_0x17a054(_0x252557);})[_0x09d6('0x30')](function(_0x4b8bba){_0xb5b2d8(_0x4b8bba);});});}function generateNonce(){return crypto[_0x09d6('0x6f')](0x10)[_0x09d6('0x70')](_0x09d6('0x71'));}function generateIssuedAt(){return Math[_0x09d6('0x72')](Date['now']()/0x3e8)[_0x09d6('0x70')]();}function createJwt(_0x59237b){var _0x361d93={'payload':{'iat':_0x59237b[_0x09d6('0x56')],'nonce':_0x59237b[_0x09d6('0x54')]},'options':{'algorithm':'HS512','subject':_0x59237b['id'][_0x09d6('0x70')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x361d93)[_0x09d6('0x2c')](function(_0x2c5f0c){return{'iat':_0x59237b[_0x09d6('0x56')],'nonce':_0x59237b[_0x09d6('0x54')],'token':_0x2c5f0c};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8355ccd..abd879c 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 _0xf2ca=['final','end','close','unlink','decryptFile','algorithm','data','secret','utf8','base64','decryptString','createDecipher','crypto','bluebird','../../config/environment','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','write'];(function(_0x283253,_0x446fad){var _0x264de7=function(_0x18338d){while(--_0x18338d){_0x283253['push'](_0x283253['shift']());}};_0x264de7(++_0x446fad);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3a93b7,_0x658183){_0x3a93b7=_0x3a93b7-0x0;var _0x2ed891=_0xf2ca[_0x3a93b7];return _0x2ed891;};'use strict';var crypto=require(_0xaf2c('0x0'));var fs=require('fs');var BPromise=require(_0xaf2c('0x1'));var config=require(_0xaf2c('0x2'));const stringOptions={'secret':config['secrets'][_0xaf2c('0x3')],'algorithm':_0xaf2c('0x4')};const fileOptions={'algorithm':_0xaf2c('0x5')};function combineOptions(_0x219511){var _0x3a724c={};for(var _0x10c910 in fileOptions){if(fileOptions['hasOwnProperty'](_0x10c910)){_0x3a724c[_0x10c910]=fileOptions[_0x10c910];}}if(_0x219511){for(var _0x1fd101 in _0x219511){if(_0x219511[_0xaf2c('0x6')](_0x1fd101)){_0x3a724c[_0x1fd101]=_0x219511[_0x1fd101];}}}return _0x3a724c;}exports[_0xaf2c('0x7')]=function(_0x1f9531,_0x58351f,_0x37fedd,_0x3c0421){return new BPromise(function(_0x4a7397,_0x2a011d){_0x3c0421=combineOptions(_0x3c0421);var _0x4ba0a2=new Buffer(_0x37fedd);var _0x439ca3=fs['createReadStream'](_0x1f9531);var _0x2f5099=fs[_0xaf2c('0x8')](_0x58351f);var _0x2e04e5=crypto[_0xaf2c('0x9')](_0x3c0421['algorithm'],_0x4ba0a2);_0x439ca3['on']('data',function(_0x2c0d88){var _0x41a5a0=new Buffer(_0x2e04e5[_0xaf2c('0xa')](_0x2c0d88),_0xaf2c('0xb'));_0x2f5099[_0xaf2c('0xc')](_0x41a5a0);});_0x439ca3['on']('end',function(){try{var _0x590126=new Buffer(_0x2e04e5[_0xaf2c('0xd')](_0xaf2c('0xb')),_0xaf2c('0xb'));_0x2f5099[_0xaf2c('0xc')](_0x590126);_0x2f5099[_0xaf2c('0xe')]();_0x2f5099['on'](_0xaf2c('0xf'),function(){return _0x4a7397(_0x58351f);});}catch(_0x214f47){fs[_0xaf2c('0x10')](_0x58351f);return _0x2a011d(_0x214f47);}});});};exports[_0xaf2c('0x11')]=function(_0x1d0633,_0x6ac8e,_0x2b4d13,_0x26bf7b){return new BPromise(function(_0x3432e4,_0x705d09){_0x26bf7b=combineOptions(_0x26bf7b);var _0x54c34a=new Buffer(_0x2b4d13);var _0x3ca650=fs['createReadStream'](_0x1d0633);var _0x278a28=fs[_0xaf2c('0x8')](_0x6ac8e);var _0x1d544a=crypto['createDecipher'](_0x26bf7b[_0xaf2c('0x12')],_0x54c34a);_0x3ca650['on'](_0xaf2c('0x13'),function(_0x1fec4c){var _0x20000b=new Buffer(_0x1d544a[_0xaf2c('0xa')](_0x1fec4c),_0xaf2c('0xb'));_0x278a28['write'](_0x20000b);});_0x3ca650['on'](_0xaf2c('0xe'),function(){try{var _0x164bcb=new Buffer(_0x1d544a[_0xaf2c('0xd')](_0xaf2c('0xb')),_0xaf2c('0xb'));_0x278a28['write'](_0x164bcb);_0x278a28[_0xaf2c('0xe')]();_0x278a28['on'](_0xaf2c('0xf'),function(){return _0x3432e4(_0x6ac8e);});}catch(_0x18153c){fs['unlink'](_0x6ac8e);return _0x705d09(_0x18153c);}});});};exports['encryptString']=function(_0x29cbdf,_0x303546,_0x1cafad){var _0x99f78d=_0x1cafad||stringOptions['algorithm'];var _0x2b8f1a=_0x303546||stringOptions[_0xaf2c('0x14')];var _0x3a0145=crypto[_0xaf2c('0x9')](_0x99f78d,_0x2b8f1a);var _0xe929b5=_0x3a0145[_0xaf2c('0xa')](_0x29cbdf,_0xaf2c('0x15'),'base64');_0xe929b5+=_0x3a0145[_0xaf2c('0xd')](_0xaf2c('0x16'));return _0xe929b5;};exports[_0xaf2c('0x17')]=function(_0x410536,_0x4b7cf2,_0x3fb190){var _0x589d47=_0x3fb190||stringOptions[_0xaf2c('0x12')];var _0x42f980=_0x4b7cf2||stringOptions[_0xaf2c('0x14')];var _0x5d685a=crypto[_0xaf2c('0x18')](_0x589d47,_0x42f980);var _0x2ea490=_0x5d685a[_0xaf2c('0xa')](_0x410536,'base64',_0xaf2c('0x15'));_0x2ea490+=_0x5d685a[_0xaf2c('0xd')](_0xaf2c('0x15'));return _0x2ea490;}; \ No newline at end of file +var _0xd046=['aes-256-ctr','hasOwnProperty','encryptFile','algorithm','data','binary','write','end','final','close','unlink','decryptFile','createReadStream','createWriteStream','createDecipher','update','encryptString','secret','createCipher','utf8','base64','decryptString','bluebird','../../config/environment','secrets'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd046,0x129));var _0x6d04=function(_0x4afeb5,_0x261b51){_0x4afeb5=_0x4afeb5-0x0;var _0x3aecda=_0xd046[_0x4afeb5];return _0x3aecda;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x6d04('0x0'));var config=require(_0x6d04('0x1'));const stringOptions={'secret':config[_0x6d04('0x2')]['session'],'algorithm':_0x6d04('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x4d3747){var _0x33720a={};for(var _0x4d2121 in fileOptions){if(fileOptions[_0x6d04('0x4')](_0x4d2121)){_0x33720a[_0x4d2121]=fileOptions[_0x4d2121];}}if(_0x4d3747){for(var _0x4a1d47 in _0x4d3747){if(_0x4d3747['hasOwnProperty'](_0x4a1d47)){_0x33720a[_0x4a1d47]=_0x4d3747[_0x4a1d47];}}}return _0x33720a;}exports[_0x6d04('0x5')]=function(_0x1968c4,_0x4f83bc,_0x569c7b,_0x2e2c01){return new BPromise(function(_0x42aa22,_0x52fc0c){_0x2e2c01=combineOptions(_0x2e2c01);var _0x533dcf=new Buffer(_0x569c7b);var _0x27a3d6=fs['createReadStream'](_0x1968c4);var _0x38bce9=fs['createWriteStream'](_0x4f83bc);var _0x5a2dbb=crypto['createCipher'](_0x2e2c01[_0x6d04('0x6')],_0x533dcf);_0x27a3d6['on'](_0x6d04('0x7'),function(_0x3397ea){var _0x1acfcc=new Buffer(_0x5a2dbb['update'](_0x3397ea),_0x6d04('0x8'));_0x38bce9[_0x6d04('0x9')](_0x1acfcc);});_0x27a3d6['on'](_0x6d04('0xa'),function(){try{var _0x16526b=new Buffer(_0x5a2dbb[_0x6d04('0xb')](_0x6d04('0x8')),_0x6d04('0x8'));_0x38bce9[_0x6d04('0x9')](_0x16526b);_0x38bce9[_0x6d04('0xa')]();_0x38bce9['on'](_0x6d04('0xc'),function(){return _0x42aa22(_0x4f83bc);});}catch(_0x252eee){fs[_0x6d04('0xd')](_0x4f83bc);return _0x52fc0c(_0x252eee);}});});};exports[_0x6d04('0xe')]=function(_0x92a88b,_0x2da704,_0x14f13c,_0x18170c){return new BPromise(function(_0x2c69e0,_0xed5538){_0x18170c=combineOptions(_0x18170c);var _0x1f8252=new Buffer(_0x14f13c);var _0x14190b=fs[_0x6d04('0xf')](_0x92a88b);var _0x2bc798=fs[_0x6d04('0x10')](_0x2da704);var _0x4e93b5=crypto[_0x6d04('0x11')](_0x18170c[_0x6d04('0x6')],_0x1f8252);_0x14190b['on'](_0x6d04('0x7'),function(_0x7edbfc){var _0x1d3dac=new Buffer(_0x4e93b5[_0x6d04('0x12')](_0x7edbfc),_0x6d04('0x8'));_0x2bc798[_0x6d04('0x9')](_0x1d3dac);});_0x14190b['on'](_0x6d04('0xa'),function(){try{var _0x27d8eb=new Buffer(_0x4e93b5[_0x6d04('0xb')](_0x6d04('0x8')),_0x6d04('0x8'));_0x2bc798['write'](_0x27d8eb);_0x2bc798[_0x6d04('0xa')]();_0x2bc798['on'](_0x6d04('0xc'),function(){return _0x2c69e0(_0x2da704);});}catch(_0x54cf0e){fs['unlink'](_0x2da704);return _0xed5538(_0x54cf0e);}});});};exports[_0x6d04('0x13')]=function(_0x326276,_0x4386bd,_0xe8f198){var _0x36113c=_0xe8f198||stringOptions[_0x6d04('0x6')];var _0x325c71=_0x4386bd||stringOptions[_0x6d04('0x14')];var _0x16a5b8=crypto[_0x6d04('0x15')](_0x36113c,_0x325c71);var _0x2c4d5b=_0x16a5b8[_0x6d04('0x12')](_0x326276,_0x6d04('0x16'),_0x6d04('0x17'));_0x2c4d5b+=_0x16a5b8['final'](_0x6d04('0x17'));return _0x2c4d5b;};exports[_0x6d04('0x18')]=function(_0x6104a2,_0x292647,_0x4256a3){var _0x3a62d4=_0x4256a3||stringOptions['algorithm'];var _0x2a3b20=_0x292647||stringOptions[_0x6d04('0x14')];var _0x1c99d6=crypto[_0x6d04('0x11')](_0x3a62d4,_0x2a3b20);var _0x2ed2bb=_0x1c99d6['update'](_0x6104a2,'base64','utf8');_0x2ed2bb+=_0x1c99d6['final'](_0x6d04('0x16'));return _0x2ed2bb;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 444fecb..c909515 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 _0xcb91=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','each','push','%s%d.%s','csv','%s.%s','writeFileSync','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split'];(function(_0x1041cf,_0x56e98c){var _0x3dd764=function(_0x5c2705){while(--_0x5c2705){_0x1041cf['push'](_0x1041cf['shift']());}};_0x3dd764(++_0x56e98c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xcb91[_0x58afd5];return _0x3e503b;};'use strict';var util=require('util');var path=require('path');var _=require(_0x1cb9('0x0'));var csv=require(_0x1cb9('0x1'));var fs=require('fs');var BPromise=require(_0x1cb9('0x2'));var zipdir=require(_0x1cb9('0x3'));var rimraf=require('rimraf');var db=require(_0x1cb9('0x4'))['db'];var dbH=require(_0x1cb9('0x4'))['dbH'];var logger=require(_0x1cb9('0x5'))(_0x1cb9('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1cb9('0x7')][0x3];var PATH=process[_0x1cb9('0x7')][0x4];function analyticExtractedReport(_0x4ffe20,_0x38737d){var _0x12567c={'status':_0x4ffe20};var _0x59d1be={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x38737d){_0x12567c[_0x1cb9('0x8')]=_0x38737d;}return db['AnalyticExtractedReport']['update'](_0x12567c,_0x59d1be);}function main(){var _0x45a12f=0x1388;var _0x2fa15c;logger[_0x1cb9('0x9')](util[_0x1cb9('0xa')](_0x1cb9('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x1cb9('0xc')][_0x1cb9('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1cb9('0xe'),_0x1cb9('0xf')]})[_0x1cb9('0x10')](function(_0x5445e1){if(_0x5445e1){_0x2fa15c=_0x5445e1;_0x45a12f=_0x2fa15c['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x1cb9('0x11')][_0x1cb9('0x12')](util[_0x1cb9('0xa')](_0x1cb9('0x13'),QUERY),{'type':dbH['sequelize'][_0x1cb9('0x14')][_0x1cb9('0x15')]});})[_0x1cb9('0x10')](function(_0x8dfa55){if(!_0x8dfa55[0x0][_0x1cb9('0x16')]){return analyticExtractedReport('Empty');}var _0x5572cb=[];var _0xd446a3=0x0;var _0x3cc765=!![];if(_0x8dfa55&&_0x8dfa55[_0x1cb9('0x17')]){var _0x3f1376=_0x8dfa55[0x0][_0x1cb9('0x16')]%(_0xd446a3+_0x45a12f);if(_0x2fa15c[_0x1cb9('0xe')]){for(;_0x3cc765;_0xd446a3+=_0x45a12f,_0x3f1376=_0x8dfa55[0x0][_0x1cb9('0x16')]%(_0xd446a3+_0x45a12f)){if(_0x3f1376==0x0||_0x3f1376==_0x8dfa55[0x0]['num']){_0x3cc765=![];}_0x5572cb['push'](dbH[_0x1cb9('0x11')][_0x1cb9('0x12')](util[_0x1cb9('0xa')](_0x1cb9('0x18'),QUERY,_0x45a12f,_0xd446a3),{'type':dbH[_0x1cb9('0x11')][_0x1cb9('0x14')][_0x1cb9('0x15')]}));}}else{_0x5572cb['push'](dbH['sequelize'][_0x1cb9('0x12')](QUERY,{'type':dbH['sequelize'][_0x1cb9('0x14')][_0x1cb9('0x15')]}));}}var _0x523b26=path['dirname'](PATH);var _0x2e3854=path[_0x1cb9('0x19')](PATH,_0x1cb9('0x1a'));var _0x4601b8=_0x2fa15c[_0x1cb9('0xe')]&&_0x5572cb[_0x1cb9('0x17')]>0x1;var _0x59ebea=[];if(!fs['existsSync'](path[_0x1cb9('0x1b')](_0x523b26,_0x2e3854))&&_0x4601b8){fs['mkdirSync'](path[_0x1cb9('0x1b')](_0x523b26,_0x2e3854));}return BPromise[_0x1cb9('0x1c')](_0x5572cb,function(_0x69b4c8){_0x59ebea[_0x1cb9('0x1d')](_0x69b4c8);})[_0x1cb9('0x10')](function(){for(var _0x53f9fa=0x0;_0x53f9fa<_0x59ebea[_0x1cb9('0x17')];_0x53f9fa+=0x1){var _0x9df250;var _0x4c8d76=_0x59ebea[_0x53f9fa];if(_0x4601b8){_0x9df250=path[_0x1cb9('0x1b')](_0x523b26,_0x2e3854,util[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x2e3854,_0x53f9fa,_0x1cb9('0x1f')));}else{_0x9df250=path[_0x1cb9('0x1b')](_0x523b26,util[_0x1cb9('0xa')](_0x1cb9('0x20'),_0x2e3854,_0x1cb9('0x1f')));}fs[_0x1cb9('0x21')](_0x9df250,csv(_0x4c8d76));}})[_0x1cb9('0x10')](function(){if(_0x4601b8){zipdir(path['join'](_0x523b26,_0x2e3854),{'saveTo':path[_0x1cb9('0x1b')](_0x523b26,util['format'](_0x1cb9('0x20'),_0x2e3854,'zip'))},function(_0x278327,_0x41011c){});rimraf(path[_0x1cb9('0x1b')](_0x523b26,_0x2e3854),function(){});}})[_0x1cb9('0x10')](function(){logger['info'](util[_0x1cb9('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1cb9('0x22')));return analyticExtractedReport(_0x1cb9('0x23'),_0x4601b8?util[_0x1cb9('0xa')]('%s.%s',_0x2e3854,_0x4601b8?_0x1cb9('0x24'):'csv'):null);});})[_0x1cb9('0x25')](function(_0x58f4f5){logger[_0x1cb9('0x9')](util[_0x1cb9('0xa')](_0x1cb9('0x26'),EXTRACTED_REPORT_ID,_0x1cb9('0x22')),util['inspect'](_0x58f4f5,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x1cb9('0x27'));});}main(); \ No newline at end of file +var _0x0a9a=['num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','split','then','splitSizeCsv','sequelize','query','format','QueryTypes','SELECT'];(function(_0x364390,_0x46b408){var _0x3cf60d=function(_0x551d05){while(--_0x551d05){_0x364390['push'](_0x364390['shift']());}};_0x3cf60d(++_0x46b408);}(_0x0a9a,0x183));var _0xa0a9=function(_0x511e8c,_0x9a5341){_0x511e8c=_0x511e8c-0x0;var _0x1ed601=_0x0a9a[_0x511e8c];return _0x1ed601;};'use strict';var util=require('util');var path=require(_0xa0a9('0x0'));var _=require('lodash');var csv=require(_0xa0a9('0x1'));var fs=require('fs');var BPromise=require(_0xa0a9('0x2'));var zipdir=require(_0xa0a9('0x3'));var rimraf=require(_0xa0a9('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa0a9('0x5'))[_0xa0a9('0x6')];var logger=require('../../config/logger')(_0xa0a9('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xa0a9('0x8')][0x2]);var QUERY=process[_0xa0a9('0x8')][0x3];var PATH=process[_0xa0a9('0x8')][0x4];function analyticExtractedReport(_0x499a29,_0x2b2eb4){var _0x520f42={'status':_0x499a29};var _0x10aa8a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b2eb4){_0x520f42[_0xa0a9('0x9')]=_0x2b2eb4;}return db[_0xa0a9('0xa')][_0xa0a9('0xb')](_0x520f42,_0x10aa8a);}function main(){var _0x4b9b93=0x1388;var _0x2ba0ac;logger[_0xa0a9('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa0a9('0xd')));return db[_0xa0a9('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa0a9('0xf'),'splitSizeCsv']})[_0xa0a9('0x10')](function(_0x4b7913){if(_0x4b7913){_0x2ba0ac=_0x4b7913;_0x4b9b93=_0x2ba0ac[_0xa0a9('0x11')]||0x1388;}})[_0xa0a9('0x10')](function(){return dbH[_0xa0a9('0x12')][_0xa0a9('0x13')](util[_0xa0a9('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa0a9('0x12')][_0xa0a9('0x15')][_0xa0a9('0x16')]});})[_0xa0a9('0x10')](function(_0x2f8b3c){if(!_0x2f8b3c[0x0][_0xa0a9('0x17')]){return analyticExtractedReport('Empty');}var _0x176faa=[];var _0x48c315=0x0;var _0x4a57dd=!![];if(_0x2f8b3c&&_0x2f8b3c[_0xa0a9('0x18')]){var _0x9f5abd=_0x2f8b3c[0x0][_0xa0a9('0x17')]%(_0x48c315+_0x4b9b93);if(_0x2ba0ac[_0xa0a9('0xf')]){for(;_0x4a57dd;_0x48c315+=_0x4b9b93,_0x9f5abd=_0x2f8b3c[0x0]['num']%(_0x48c315+_0x4b9b93)){if(_0x9f5abd==0x0||_0x9f5abd==_0x2f8b3c[0x0][_0xa0a9('0x17')]){_0x4a57dd=![];}_0x176faa[_0xa0a9('0x19')](dbH[_0xa0a9('0x12')][_0xa0a9('0x13')](util[_0xa0a9('0x14')](_0xa0a9('0x1a'),QUERY,_0x4b9b93,_0x48c315),{'type':dbH['sequelize'][_0xa0a9('0x15')][_0xa0a9('0x16')]}));}}else{_0x176faa['push'](dbH['sequelize'][_0xa0a9('0x13')](QUERY,{'type':dbH[_0xa0a9('0x12')][_0xa0a9('0x15')]['SELECT']}));}}var _0x307d7e=path['dirname'](PATH);var _0x1fb36b=path['basename'](PATH,_0xa0a9('0x1b'));var _0x504786=_0x2ba0ac[_0xa0a9('0xf')]&&_0x176faa[_0xa0a9('0x18')]>0x1;var _0x4938da=[];if(!fs[_0xa0a9('0x1c')](path['join'](_0x307d7e,_0x1fb36b))&&_0x504786){fs[_0xa0a9('0x1d')](path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b));}return BPromise[_0xa0a9('0x1f')](_0x176faa,function(_0x252a14){_0x4938da['push'](_0x252a14);})[_0xa0a9('0x10')](function(){for(var _0xe49d3b=0x0;_0xe49d3b<_0x4938da[_0xa0a9('0x18')];_0xe49d3b+=0x1){var _0x3f4bea;var _0x526dd1=_0x4938da[_0xe49d3b];if(_0x504786){_0x3f4bea=path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b,util[_0xa0a9('0x14')](_0xa0a9('0x20'),_0x1fb36b,_0xe49d3b,'csv'));}else{_0x3f4bea=path['join'](_0x307d7e,util[_0xa0a9('0x14')](_0xa0a9('0x21'),_0x1fb36b,_0xa0a9('0x22')));}fs[_0xa0a9('0x23')](_0x3f4bea,csv(_0x526dd1));}})[_0xa0a9('0x10')](function(){if(_0x504786){zipdir(path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b),{'saveTo':path[_0xa0a9('0x1e')](_0x307d7e,util[_0xa0a9('0x14')](_0xa0a9('0x21'),_0x1fb36b,_0xa0a9('0x24')))},function(_0x41e994,_0x554191){});rimraf(path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b),function(){});}})[_0xa0a9('0x10')](function(){logger['info'](util[_0xa0a9('0x14')](_0xa0a9('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x504786?util[_0xa0a9('0x14')]('%s.%s',_0x1fb36b,_0x504786?'zip':_0xa0a9('0x22')):null);});})[_0xa0a9('0x26')](function(_0x347cbf){logger[_0xa0a9('0xc')](util[_0xa0a9('0x14')](_0xa0a9('0x27'),EXTRACTED_REPORT_ID,_0xa0a9('0xd')),util['inspect'](_0x347cbf,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa0a9('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 66eb077..ff6fc81 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 _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x370ffb,_0xcf3741){var _0x5c95fd=function(_0x47666b){while(--_0x47666b){_0x370ffb['push'](_0x370ffb['shift']());}};_0x5c95fd(++_0xcf3741);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4cef0d,_0x5053c2){_0x4cef0d=_0x4cef0d-0x0;var _0x2dbd60=_0x5f2f[_0x4cef0d];return _0x2dbd60;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x1d6bed,_0x4e4ec1){var _0x19338b=function(_0xbc7229){while(--_0xbc7229){_0x1d6bed['push'](_0x1d6bed['shift']());}};_0x19338b(++_0x4e4ec1);}(_0xb10b,0x12a));var _0xbb10=function(_0x31b2d3,_0x2a787){_0x31b2d3=_0x31b2d3-0x0;var _0x583cfc=_0xb10b[_0x31b2d3];return _0x583cfc;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7cf177f..84f1c27 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 _0xe9ea=['argv','savename','AnalyticExtractedReport','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','num','Empty','length','QueryTypes','SELECT','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','json2xls','bluebird','zip-dir','../../config/logger'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xe9ea,0x128));var _0xae9e=function(_0x333f64,_0xa3938d){_0x333f64=_0x333f64-0x0;var _0x51fee5=_0xe9ea[_0x333f64];return _0x51fee5;};'use strict';var util=require(_0xae9e('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xae9e('0x1'));var BPromise=require(_0xae9e('0x2'));var zipdir=require(_0xae9e('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xae9e('0x4'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xae9e('0x5')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xae9e('0x5')][0x4];function analyticExtractedReport(_0x4f03ea,_0x29b39e){var _0x58be23={'status':_0x4f03ea};var _0x51e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29b39e){_0x58be23[_0xae9e('0x6')]=_0x29b39e;}return db[_0xae9e('0x7')]['update'](_0x58be23,_0x51e9);}function main(){var _0x1e3f72=0x1388;var _0x5622d8;logger[_0xae9e('0x8')](util[_0xae9e('0x9')](_0xae9e('0xa'),EXTRACTED_REPORT_ID,_0xae9e('0xb')));return db[_0xae9e('0xc')][_0xae9e('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xae9e('0xe'),_0xae9e('0xf')]})[_0xae9e('0x10')](function(_0x3b47bb){if(_0x3b47bb){_0x5622d8=_0x3b47bb;_0x1e3f72=_0x5622d8[_0xae9e('0xf')]||0x1388;}})['then'](function(){return dbH[_0xae9e('0x11')][_0xae9e('0x12')](util[_0xae9e('0x9')](_0xae9e('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xae9e('0x10')](function(_0x2a9b0a){if(!_0x2a9b0a[0x0][_0xae9e('0x14')]){return analyticExtractedReport(_0xae9e('0x15'));}var _0x372bb7=[];var _0x5f522a=0x0;var _0x391f09=!![];if(_0x5622d8[_0xae9e('0xe')]){if(_0x2a9b0a&&_0x2a9b0a[_0xae9e('0x16')]){var _0x31a988=_0x2a9b0a[0x0][_0xae9e('0x14')]%(_0x5f522a+_0x1e3f72);for(;_0x391f09;_0x5f522a+=_0x1e3f72,_0x31a988=_0x2a9b0a[0x0][_0xae9e('0x14')]%(_0x5f522a+_0x1e3f72)){if(_0x31a988==0x0||_0x31a988==_0x2a9b0a[0x0][_0xae9e('0x14')]){_0x391f09=![];}_0x372bb7['push'](dbH[_0xae9e('0x11')][_0xae9e('0x12')](util[_0xae9e('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1e3f72,_0x5f522a),{'type':dbH[_0xae9e('0x11')][_0xae9e('0x17')][_0xae9e('0x18')]}));}}}else{_0x372bb7[_0xae9e('0x19')](dbH[_0xae9e('0x11')][_0xae9e('0x12')](QUERY,{'type':dbH[_0xae9e('0x11')][_0xae9e('0x17')][_0xae9e('0x18')]}));}var _0x36c46e=path[_0xae9e('0x1a')](PATH);var _0x4b1674=path[_0xae9e('0x1b')](PATH,_0xae9e('0x1c'));var _0x47ebc2=_0x5622d8[_0xae9e('0xe')]&&_0x372bb7['length']>0x1;var _0x460f9b=[];if(!fs[_0xae9e('0x1d')](path['join'](_0x36c46e,_0x4b1674))&&_0x47ebc2){fs[_0xae9e('0x1e')](path[_0xae9e('0x1f')](_0x36c46e,_0x4b1674));}return BPromise[_0xae9e('0x20')](_0x372bb7,function(_0x3653bf){_0x460f9b[_0xae9e('0x19')](_0x3653bf);})['then'](function(){for(var _0x5abfe8=0x0;_0x5abfe8<_0x460f9b[_0xae9e('0x16')];_0x5abfe8+=0x1){var _0x4c8e1f;var _0x486359=_0x460f9b[_0x5abfe8];if(_0x47ebc2){_0x4c8e1f=path[_0xae9e('0x1f')](_0x36c46e,_0x4b1674,util[_0xae9e('0x9')](_0xae9e('0x21'),_0x4b1674,_0x5abfe8,_0xae9e('0x22')));}else{_0x4c8e1f=path[_0xae9e('0x1f')](_0x36c46e,util[_0xae9e('0x9')](_0xae9e('0x23'),_0x4b1674,_0xae9e('0x22')));}fs[_0xae9e('0x24')](_0x4c8e1f,json2xls(_0x486359),_0xae9e('0x25'));}})[_0xae9e('0x10')](function(){if(_0x47ebc2){zipdir(path[_0xae9e('0x1f')](_0x36c46e,_0x4b1674),{'saveTo':path[_0xae9e('0x1f')](_0x36c46e,util[_0xae9e('0x9')]('%s.%s',_0x4b1674,_0xae9e('0x26')))},function(_0x882758,_0x2c258b){});rimraf(path[_0xae9e('0x1f')](_0x36c46e,_0x4b1674),function(){});}})['then'](function(){logger[_0xae9e('0x8')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xae9e('0xb')));return analyticExtractedReport(_0xae9e('0x27'),_0x47ebc2?util['format'](_0xae9e('0x23'),_0x4b1674,_0x47ebc2?_0xae9e('0x26'):_0xae9e('0x22')):null);});})['catch'](function(_0x6b42d8){logger['info'](util[_0xae9e('0x9')](_0xae9e('0x28'),EXTRACTED_REPORT_ID,_0xae9e('0xb')),util[_0xae9e('0x29')](_0x6b42d8,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xae9e('0x2a'));});}main(); \ No newline at end of file +var _0xe2a0=['zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','split','length','push','QueryTypes','basename','.xlsx','existsSync','join','mkdirSync','each','then','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe2a0,0x1d1));var _0x0e2a=function(_0x1ad831,_0x734b6a){_0x1ad831=_0x1ad831-0x0;var _0x36537d=_0xe2a0[_0x1ad831];return _0x36537d;};'use strict';var util=require(_0x0e2a('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x0e2a('0x1'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x0e2a('0x2'));var db=require(_0x0e2a('0x3'))['db'];var dbH=require(_0x0e2a('0x3'))[_0x0e2a('0x4')];var logger=require(_0x0e2a('0x5'))(_0x0e2a('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0e2a('0x7')][0x2]);var QUERY=process[_0x0e2a('0x7')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x269f1f,_0x32506a){var _0x4645c4={'status':_0x269f1f};var _0x14d53c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x32506a){_0x4645c4[_0x0e2a('0x8')]=_0x32506a;}return db[_0x0e2a('0x9')][_0x0e2a('0xa')](_0x4645c4,_0x14d53c);}function main(){var _0x456598=0x1388;var _0x3170a9;logger['info'](util[_0x0e2a('0xb')](_0x0e2a('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x5dff22){if(_0x5dff22){_0x3170a9=_0x5dff22;_0x456598=_0x3170a9[_0x0e2a('0xd')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x0e2a('0xe')](util[_0x0e2a('0xb')](_0x0e2a('0xf'),QUERY),{'type':dbH[_0x0e2a('0x10')]['QueryTypes'][_0x0e2a('0x11')]});})['then'](function(_0xc3a2d7){if(!_0xc3a2d7[0x0][_0x0e2a('0x12')]){return analyticExtractedReport('Empty');}var _0x1b1a13=[];var _0x306d87=0x0;var _0xa085e0=!![];if(_0x3170a9[_0x0e2a('0x13')]){if(_0xc3a2d7&&_0xc3a2d7[_0x0e2a('0x14')]){var _0x31c8ec=_0xc3a2d7[0x0][_0x0e2a('0x12')]%(_0x306d87+_0x456598);for(;_0xa085e0;_0x306d87+=_0x456598,_0x31c8ec=_0xc3a2d7[0x0][_0x0e2a('0x12')]%(_0x306d87+_0x456598)){if(_0x31c8ec==0x0||_0x31c8ec==_0xc3a2d7[0x0]['num']){_0xa085e0=![];}_0x1b1a13[_0x0e2a('0x15')](dbH[_0x0e2a('0x10')][_0x0e2a('0xe')](util[_0x0e2a('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x456598,_0x306d87),{'type':dbH[_0x0e2a('0x10')]['QueryTypes'][_0x0e2a('0x11')]}));}}}else{_0x1b1a13['push'](dbH[_0x0e2a('0x10')][_0x0e2a('0xe')](QUERY,{'type':dbH[_0x0e2a('0x10')][_0x0e2a('0x16')][_0x0e2a('0x11')]}));}var _0x509ed1=path['dirname'](PATH);var _0x3c88fe=path[_0x0e2a('0x17')](PATH,_0x0e2a('0x18'));var _0x1f4450=_0x3170a9[_0x0e2a('0x13')]&&_0x1b1a13[_0x0e2a('0x14')]>0x1;var _0x48aced=[];if(!fs[_0x0e2a('0x19')](path[_0x0e2a('0x1a')](_0x509ed1,_0x3c88fe))&&_0x1f4450){fs[_0x0e2a('0x1b')](path[_0x0e2a('0x1a')](_0x509ed1,_0x3c88fe));}return BPromise[_0x0e2a('0x1c')](_0x1b1a13,function(_0x5ea15e){_0x48aced[_0x0e2a('0x15')](_0x5ea15e);})[_0x0e2a('0x1d')](function(){for(var _0x52340b=0x0;_0x52340b<_0x48aced[_0x0e2a('0x14')];_0x52340b+=0x1){var _0x1f834d;var _0xf44e13=_0x48aced[_0x52340b];if(_0x1f4450){_0x1f834d=path[_0x0e2a('0x1a')](_0x509ed1,_0x3c88fe,util[_0x0e2a('0xb')](_0x0e2a('0x1e'),_0x3c88fe,_0x52340b,_0x0e2a('0x1f')));}else{_0x1f834d=path[_0x0e2a('0x1a')](_0x509ed1,util[_0x0e2a('0xb')]('%s.%s',_0x3c88fe,_0x0e2a('0x1f')));}fs[_0x0e2a('0x20')](_0x1f834d,json2xls(_0xf44e13),_0x0e2a('0x21'));}})[_0x0e2a('0x1d')](function(){if(_0x1f4450){zipdir(path[_0x0e2a('0x1a')](_0x509ed1,_0x3c88fe),{'saveTo':path[_0x0e2a('0x1a')](_0x509ed1,util[_0x0e2a('0xb')](_0x0e2a('0x22'),_0x3c88fe,'zip'))},function(_0x116cb4,_0x4804a5){});rimraf(path[_0x0e2a('0x1a')](_0x509ed1,_0x3c88fe),function(){});}})[_0x0e2a('0x1d')](function(){logger[_0x0e2a('0x23')](util[_0x0e2a('0xb')](_0x0e2a('0x24'),EXTRACTED_REPORT_ID,_0x0e2a('0x25')));return analyticExtractedReport(_0x0e2a('0x26'),_0x1f4450?util[_0x0e2a('0xb')](_0x0e2a('0x22'),_0x3c88fe,_0x1f4450?_0x0e2a('0x27'):_0x0e2a('0x1f')):null);});})['catch'](function(_0x4ca2da){logger[_0x0e2a('0x23')](util['format'](_0x0e2a('0x28'),EXTRACTED_REPORT_ID,_0x0e2a('0x25')),util['inspect'](_0x4ca2da,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0e2a('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 68854f7..d10ab32 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 _0x26ef=['find','push','type','Set','format','CDR(type)=%s','outbound','cutdigits','${EXTEN}','context','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','map','intervals','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','toLowerCase','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','destroy','bulkCreate','catch','rewrite','util','Interval','findAll','then','models','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension'];(function(_0x3c8ad0,_0x97ae34){var _0x27d92c=function(_0x1a29a8){while(--_0x1a29a8){_0x3c8ad0['push'](_0x3c8ad0['shift']());}};_0x27d92c(++_0x97ae34);}(_0x26ef,0x13e));var _0xf26e=function(_0x122936,_0x501dae){_0x122936=_0x122936-0x0;var _0x397ae4=_0x26ef[_0x122936];return _0x397ae4;};'use strict';var _=require('lodash');var util=require(_0xf26e('0x0'));function rewrite(_0x404c4c,_0x1d7212){var _0x109735=this;return _0x404c4c['models'][_0xf26e('0x1')][_0xf26e('0x2')]({'raw':!![]})[_0xf26e('0x3')](function(_0x5a237b){_0x109735['intervals']=_0x5a237b;return _0x404c4c[_0xf26e('0x4')][_0xf26e('0x5')][_0xf26e('0x2')]({'where':{'IntervalId':_0x1d7212[_0xf26e('0x6')]},'raw':!![]});})[_0xf26e('0x3')](function(_0x476901){return _0x404c4c[_0xf26e('0x4')][_0xf26e('0x5')][_0xf26e('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x476901,_0xf26e('0x7')))}},'order':[{'raw':_0xf26e('0x8')}],'raw':!![]});})[_0xf26e('0x3')](function(_0x4aa972){var _0x40a60e=_[_0xf26e('0x9')](_0x4aa972,{'priority':'1'});var _0x275d64=_['filter'](_0x4aa972,{'isApp':0x1});var _0x1761f6=_[_0xf26e('0xa')](_0x275d64,'exten');var _0x36731c=[_0xf26e('0xb'),_0xf26e('0xc')];var _0xfc00c2=[];var _0x48fffa=[];for(var _0x323c23 in _0x1761f6){if(_0x1761f6[_0xf26e('0xd')](_0x323c23)){_0x109735[_0xf26e('0xe')]=0x2;_0x109735[_0xf26e('0xf')]=[];_0x109735[_0xf26e('0x10')]=_[_0xf26e('0x11')](_0x40a60e,{'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')]});_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':util[_0xf26e('0x15')](_0xf26e('0x16'),_0x1761f6[_0x323c23][0x0]['type']),'context':_0x1761f6[_0x323c23][0x0]['context'],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0]['VoiceExtensionId']});if(_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')]===_0xf26e('0x17')){if(_0x109735[_0xf26e('0x10')]){_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':'Set','appdata':'CDR(destination)='+(_0x109735[_0xf26e('0x10')][_0xf26e('0x18')]?'${EXTEN:'+_0x109735['extension']['cutdigits']+'}':_0xf26e('0x19')),'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});}_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':'Set','appdata':_0xf26e('0x1c')+_0x1761f6[_0x323c23][0x0]['VoiceExtensionId'],'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0]['exten'],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0]['VoiceExtensionId']});var _0x419f8a=_0x109735['priority']++;_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x1d'),'appdata':_0xf26e('0x1e')+(_0x419f8a+0x2)+_0xf26e('0x1f')+(_0x419f8a+0x1)+')','context':_0x1761f6[_0x323c23][0x0]['context'],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x419f8a,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});if(_0x109735[_0xf26e('0x10')]){_0x109735['extensions'][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':_0x109735[_0xf26e('0x10')][_0xf26e('0x18')]?_0xf26e('0x20')+_0x109735['extension'][_0xf26e('0x18')]+'}':_0xf26e('0x21'),'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0]['exten'],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});}_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':'Set','appdata':_0xf26e('0x22')+_0x1761f6[_0x323c23][0x0]['VoiceExtensionId'],'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});if(_0x109735['extension']&&_0x109735[_0xf26e('0x10')][_0xf26e('0xd')](_0xf26e('0x23'))&&_0x109735[_0xf26e('0x10')]['recordingFormat']!==_0xf26e('0x24')){_0x109735['extensions'][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':_0xf26e('0x25'),'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0]['VoiceExtensionId']});_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':_0xf26e('0x26')+_0x109735[_0xf26e('0x10')][_0xf26e('0x23')]||_0xf26e('0x27'),'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0]['exten'],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});}}_0x109735['extensions'][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0]['VoiceExtensionId']});_0x109735['extensions'][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':_0xf26e('0x28'),'context':_0x1761f6[_0x323c23][0x0]['context'],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735['priority']++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0]['VoiceExtensionId']});_0x109735['extensions'][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0][_0xf26e('0x13')],'app':'Set','appdata':_0xf26e('0x29'),'context':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1a')],'exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'priority':_0x109735[_0xf26e('0xe')]++,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});for(var _0x55cb0a=0x0,_0x701586=0x0;_0x55cb0a<_0x1761f6[_0x323c23][_0xf26e('0x2a')];_0x55cb0a+=0x1,_0x701586=0x0){var _0x45778f=_0x1761f6[_0x323c23][_0x55cb0a];if(_0x45778f[_0xf26e('0x13')]){_0x45778f[_0xf26e('0x13')]=_0x45778f['type']['toLowerCase']();}var _0x13e423=[];var _0x141ab6=[];delete _0x45778f['id'];delete _0x45778f[_0xf26e('0x2b')];delete _0x45778f['updatedAt'];var _0x560b6e=_0x45778f['interval']!==_0xf26e('0x2c')?[_0x45778f['interval']]:_0x45778f[_0xf26e('0x6')]?_[_0xf26e('0x2d')](_[_0xf26e('0x9')](_0x109735[_0xf26e('0x2e')],{'IntervalId':_0x45778f[_0xf26e('0x6')]}),_0xf26e('0x2f')):[];if(_0x45778f['hasOwnProperty']('tag')){if(_0x45778f[_0xf26e('0x30')]&&_0x45778f[_0xf26e('0x30')]!=='--'){_0x13e423['push']({'type':_0x45778f[_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':_0xf26e('0x31')+_0x45778f[_0xf26e('0x30')],'context':_0x45778f[_0xf26e('0x1a')],'exten':_0x45778f[_0xf26e('0x7')],'priority':_0x560b6e[_0xf26e('0x2a')]+_0x109735['priority']+_0x701586++,'VoiceExtensionId':_0x45778f[_0xf26e('0x1b')]});}}if(_0x45778f[_0xf26e('0x13')]===_0xf26e('0x17')&&_0x45778f[_0xf26e('0xd')](_0xf26e('0x32'))){if(_0x45778f[_0xf26e('0x32')]){_0x13e423[_0xf26e('0x12')]({'type':_0x45778f[_0xf26e('0x13')],'app':_0xf26e('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x45778f[_0xf26e('0x32')]+')','context':_0x45778f[_0xf26e('0x1a')],'exten':_0x45778f[_0xf26e('0x7')],'priority':_0x560b6e[_0xf26e('0x2a')]+_0x109735[_0xf26e('0xe')]+_0x701586++,'VoiceExtensionId':_0x45778f[_0xf26e('0x1b')]});}else{_0x13e423[_0xf26e('0x12')]({'type':_0x45778f[_0xf26e('0x13')],'app':_0xf26e('0x1d'),'appdata':_0xf26e('0x33'),'context':_0x45778f[_0xf26e('0x1a')],'exten':_0x45778f[_0xf26e('0x7')],'priority':_0x560b6e[_0xf26e('0x2a')]+_0x109735[_0xf26e('0xe')]+_0x701586++,'VoiceExtensionId':_0x45778f[_0xf26e('0x1b')]});}}if(_0x45778f['hasOwnProperty']('answer')){if(_0x36731c['indexOf'](_0x45778f[_0xf26e('0x34')][_0xf26e('0x35')]())>=0x0&&_0x45778f[_0xf26e('0x36')]!==_0xf26e('0x37')){if(_0x45778f[_0xf26e('0x38')]){_0x13e423['push']({'type':_0x45778f[_0xf26e('0x13')],'app':'ExecIf','appdata':_0xf26e('0x39'),'context':_0x45778f['context'],'exten':_0x45778f[_0xf26e('0x7')],'priority':_0x560b6e['length']+_0x109735[_0xf26e('0xe')]+_0x701586++,'VoiceExtensionId':_0x45778f[_0xf26e('0x1b')]});_0x13e423['push']({'type':_0x45778f[_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x45778f[_0xf26e('0x1a')],'exten':_0x45778f[_0xf26e('0x7')],'priority':_0x560b6e[_0xf26e('0x2a')]+_0x109735[_0xf26e('0xe')]+_0x701586++,'VoiceExtensionId':_0x45778f[_0xf26e('0x1b')]});}else{_0x13e423[_0xf26e('0x12')]({'type':_0x45778f['type'],'app':_0xf26e('0x1d'),'appdata':_0xf26e('0x3a'),'context':_0x45778f['context'],'exten':_0x45778f['exten'],'priority':_0x560b6e[_0xf26e('0x2a')]+_0x109735['priority']+_0x701586++,'VoiceExtensionId':_0x45778f[_0xf26e('0x1b')]});_0x13e423[_0xf26e('0x12')]({'type':_0x45778f[_0xf26e('0x13')],'app':_0xf26e('0x14'),'appdata':_0xf26e('0x3b'),'context':_0x45778f[_0xf26e('0x1a')],'exten':_0x45778f['exten'],'priority':_0x560b6e[_0xf26e('0x2a')]+_0x109735[_0xf26e('0xe')]+_0x701586++,'VoiceExtensionId':_0x45778f['VoiceExtensionId']});}}}for(var _0x5753f1=0x0;_0x5753f1<_0x560b6e[_0xf26e('0x2a')];_0x5753f1+=0x1){var _0x29e4c2=_0x109735['priority']+_0x560b6e['length'];var _0xa2e925=_0x5753f1===_0x560b6e['length']-0x1?_0x109735['priority']+_0x13e423[_0xf26e('0x2a')]+_0x141ab6[_0xf26e('0x2a')]+0x2:_0x109735[_0xf26e('0xe')]+_0x5753f1+0x1;_0x13e423[_0xf26e('0x3c')](_0x5753f1,0x0,{'type':_0x45778f[_0xf26e('0x13')],'app':'GotoIfTime','appdata':_0x560b6e[_0x5753f1]+'?'+_0x45778f[_0xf26e('0x1a')]+_0xf26e('0x3d')+_0x29e4c2+':'+_0x45778f[_0xf26e('0x1a')]+_0xf26e('0x3d')+_0xa2e925,'exten':_0x45778f['exten'],'context':_0x45778f[_0xf26e('0x1a')],'priority':_0x109735[_0xf26e('0xe')]+_0x5753f1,'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});}_0x45778f[_0xf26e('0xe')]=_0x13e423[_0xf26e('0x2a')]?_[_0xf26e('0x3e')](_0x13e423)[_0xf26e('0xe')]+0x1:_0x109735[_0xf26e('0xe')];_0x109735['priority']=(_0x141ab6[_0xf26e('0x2a')]?_[_0xf26e('0x3e')](_0x141ab6)[_0xf26e('0xe')]:_0x45778f[_0xf26e('0xe')])+0x1;_0x109735['extensions']=_['concat'](_0x109735[_0xf26e('0xf')],_0x13e423,[_0x45778f],_0x141ab6);}_0x109735[_0xf26e('0xf')][_0xf26e('0x12')]({'type':_0x1761f6[_0x323c23][0x0]['type'],'app':'Hangup','exten':_0x1761f6[_0x323c23][0x0][_0xf26e('0x7')],'context':_0x1761f6[_0x323c23][0x0]['context'],'priority':_0x109735[_0xf26e('0xe')],'VoiceExtensionId':_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]});_0xfc00c2[_0xf26e('0x12')](_0x1761f6[_0x323c23][0x0][_0xf26e('0x1b')]);_0x48fffa=_['concat'](_0x48fffa,_0x109735[_0xf26e('0xf')]);}}return _0x404c4c['transaction'](function(_0x4560a8){return _0x404c4c[_0xf26e('0x4')][_0xf26e('0x5')][_0xf26e('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0xfc00c2}},'transaction':_0x4560a8})[_0xf26e('0x3')](function(_0x3a2724){return _0x404c4c['models'][_0xf26e('0x5')][_0xf26e('0x40')](_['sortBy'](_0x48fffa,_0xf26e('0xe')),{'transaction':_0x4560a8});});});})[_0xf26e('0x41')](function(_0x498bed){console['error'](_0x498bed);});}exports[_0xf26e('0x42')]=rewrite; \ No newline at end of file +var _0x652b=['lodash','models','Interval','then','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','format','CDR(type)=%s','type','context','outbound','Set','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','VoiceExtensionId','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','appType','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x652b,0xd8));var _0xb652=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x652b[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xb652('0x0'));var util=require('util');function rewrite(_0x37c472,_0x10dfa5){var _0x4775d3=this;return _0x37c472[_0xb652('0x1')][_0xb652('0x2')]['findAll']({'raw':!![]})[_0xb652('0x3')](function(_0x5468f7){_0x4775d3['intervals']=_0x5468f7;return _0x37c472['models'][_0xb652('0x4')][_0xb652('0x5')]({'where':{'IntervalId':_0x10dfa5['IntervalId']},'raw':!![]});})[_0xb652('0x3')](function(_0x162e97){return _0x37c472[_0xb652('0x1')][_0xb652('0x4')][_0xb652('0x5')]({'where':{'exten':{'$in':_[_0xb652('0x6')](_[_0xb652('0x7')](_0x162e97,_0xb652('0x8')))}},'order':[{'raw':_0xb652('0x9')}],'raw':!![]});})[_0xb652('0x3')](function(_0x39f602){var _0xb4ece2=_[_0xb652('0xa')](_0x39f602,{'priority':'1'});var _0x37aa80=_[_0xb652('0xa')](_0x39f602,{'isApp':0x1});var _0x156001=_[_0xb652('0xb')](_0x37aa80,'exten');var _0x13b57a=[_0xb652('0xc'),_0xb652('0xd')];var _0x5b5e2d=[];var _0x332a3a=[];for(var _0x35feca in _0x156001){if(_0x156001[_0xb652('0xe')](_0x35feca)){_0x4775d3[_0xb652('0xf')]=0x2;_0x4775d3[_0xb652('0x10')]=[];_0x4775d3[_0xb652('0x11')]=_[_0xb652('0x12')](_0xb4ece2,{'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')]});_0x4775d3[_0xb652('0x10')][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0]['type'],'app':'Set','appdata':util[_0xb652('0x14')](_0xb652('0x15'),_0x156001[_0x35feca][0x0][_0xb652('0x16')]),'context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0]['VoiceExtensionId']});if(_0x156001[_0x35feca][0x0][_0xb652('0x16')]===_0xb652('0x18')){if(_0x4775d3[_0xb652('0x11')]){_0x4775d3[_0xb652('0x10')][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':_0xb652('0x1a')+(_0x4775d3[_0xb652('0x11')]['cutdigits']?'${EXTEN:'+_0x4775d3[_0xb652('0x11')][_0xb652('0x1b')]+'}':_0xb652('0x1c')),'context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0]['VoiceExtensionId']});}_0x4775d3[_0xb652('0x10')][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':_0xb652('0x1d')+_0x156001[_0x35feca][0x0][_0xb652('0x1e')],'context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});var _0x719f13=_0x4775d3[_0xb652('0xf')]++;_0x4775d3[_0xb652('0x10')]['push']({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':'ExecIf','appdata':_0xb652('0x1f')+(_0x719f13+0x2)+_0xb652('0x20')+(_0x719f13+0x1)+')','context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x719f13,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});if(_0x4775d3[_0xb652('0x11')]){_0x4775d3['extensions']['push']({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':_0x4775d3[_0xb652('0x11')]['cutdigits']?_0xb652('0x21')+_0x4775d3['extension']['cutdigits']+'}':_0xb652('0x22'),'context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0]['VoiceExtensionId']});}_0x4775d3[_0xb652('0x10')][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0]['type'],'app':_0xb652('0x19'),'appdata':_0xb652('0x23')+_0x156001[_0x35feca][0x0]['VoiceExtensionId'],'context':_0x156001[_0x35feca][0x0]['context'],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});if(_0x4775d3[_0xb652('0x11')]&&_0x4775d3[_0xb652('0x11')][_0xb652('0xe')](_0xb652('0x24'))&&_0x4775d3['extension'][_0xb652('0x24')]!==_0xb652('0x25')){_0x4775d3['extensions'][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':_0xb652('0x26'),'context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});_0x4775d3['extensions'][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':_0xb652('0x27')+_0x4775d3[_0xb652('0x11')]['recordingFormat']||'wav','context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});}}_0x4775d3['extensions'][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0]['type'],'app':'Set','appdata':_0xb652('0x28'),'context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});_0x4775d3[_0xb652('0x10')][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0]['type'],'app':_0xb652('0x19'),'appdata':_0xb652('0x29'),'context':_0x156001[_0x35feca][0x0]['context'],'exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'priority':_0x4775d3[_0xb652('0xf')]++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});_0x4775d3['extensions'][_0xb652('0x13')]({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':'MONITOR_OPTIONS=ab','context':_0x156001[_0x35feca][0x0][_0xb652('0x17')],'exten':_0x156001[_0x35feca][0x0]['exten'],'priority':_0x4775d3['priority']++,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});for(var _0x4a22a6=0x0,_0x116778=0x0;_0x4a22a6<_0x156001[_0x35feca][_0xb652('0x2a')];_0x4a22a6+=0x1,_0x116778=0x0){var _0xa18f94=_0x156001[_0x35feca][_0x4a22a6];if(_0xa18f94['type']){_0xa18f94['type']=_0xa18f94[_0xb652('0x16')]['toLowerCase']();}var _0x2557af=[];var _0x50942a=[];delete _0xa18f94['id'];delete _0xa18f94[_0xb652('0x2b')];delete _0xa18f94[_0xb652('0x2c')];var _0x430c53=_0xa18f94[_0xb652('0x2d')]!==_0xb652('0x2e')?[_0xa18f94[_0xb652('0x2d')]]:_0xa18f94[_0xb652('0x2f')]?_[_0xb652('0x7')](_[_0xb652('0xa')](_0x4775d3[_0xb652('0x30')],{'IntervalId':_0xa18f94[_0xb652('0x2f')]}),_0xb652('0x2d')):[];if(_0xa18f94['hasOwnProperty'](_0xb652('0x31'))){if(_0xa18f94[_0xb652('0x31')]&&_0xa18f94[_0xb652('0x31')]!=='--'){_0x2557af[_0xb652('0x13')]({'type':_0xa18f94[_0xb652('0x16')],'app':_0xb652('0x19'),'appdata':_0xb652('0x32')+_0xa18f94[_0xb652('0x31')],'context':_0xa18f94[_0xb652('0x17')],'exten':_0xa18f94[_0xb652('0x8')],'priority':_0x430c53[_0xb652('0x2a')]+_0x4775d3[_0xb652('0xf')]+_0x116778++,'VoiceExtensionId':_0xa18f94[_0xb652('0x1e')]});}}if(_0xa18f94[_0xb652('0x16')]===_0xb652('0x18')&&_0xa18f94[_0xb652('0xe')]('callerID')){if(_0xa18f94[_0xb652('0x33')]){_0x2557af['push']({'type':_0xa18f94[_0xb652('0x16')],'app':'ExecIf','appdata':_0xb652('0x34')+_0xa18f94['callerID']+')','context':_0xa18f94[_0xb652('0x17')],'exten':_0xa18f94[_0xb652('0x8')],'priority':_0x430c53[_0xb652('0x2a')]+_0x4775d3['priority']+_0x116778++,'VoiceExtensionId':_0xa18f94['VoiceExtensionId']});}else{_0x2557af['push']({'type':_0xa18f94[_0xb652('0x16')],'app':'ExecIf','appdata':_0xb652('0x35'),'context':_0xa18f94[_0xb652('0x17')],'exten':_0xa18f94[_0xb652('0x8')],'priority':_0x430c53[_0xb652('0x2a')]+_0x4775d3[_0xb652('0xf')]+_0x116778++,'VoiceExtensionId':_0xa18f94[_0xb652('0x1e')]});}}if(_0xa18f94[_0xb652('0xe')](_0xb652('0x36'))){if(_0x13b57a[_0xb652('0x37')](_0xa18f94['app'][_0xb652('0x38')]())>=0x0&&_0xa18f94[_0xb652('0x39')]!=='custom'){if(_0xa18f94[_0xb652('0x36')]){_0x2557af[_0xb652('0x13')]({'type':_0xa18f94[_0xb652('0x16')],'app':_0xb652('0x3a'),'appdata':_0xb652('0x3b'),'context':_0xa18f94['context'],'exten':_0xa18f94['exten'],'priority':_0x430c53[_0xb652('0x2a')]+_0x4775d3[_0xb652('0xf')]+_0x116778++,'VoiceExtensionId':_0xa18f94[_0xb652('0x1e')]});_0x2557af[_0xb652('0x13')]({'type':_0xa18f94['type'],'app':'Set','appdata':_0xb652('0x3c'),'context':_0xa18f94[_0xb652('0x17')],'exten':_0xa18f94[_0xb652('0x8')],'priority':_0x430c53[_0xb652('0x2a')]+_0x4775d3[_0xb652('0xf')]+_0x116778++,'VoiceExtensionId':_0xa18f94[_0xb652('0x1e')]});}else{_0x2557af[_0xb652('0x13')]({'type':_0xa18f94[_0xb652('0x16')],'app':_0xb652('0x3a'),'appdata':_0xb652('0x3d'),'context':_0xa18f94[_0xb652('0x17')],'exten':_0xa18f94[_0xb652('0x8')],'priority':_0x430c53[_0xb652('0x2a')]+_0x4775d3['priority']+_0x116778++,'VoiceExtensionId':_0xa18f94[_0xb652('0x1e')]});_0x2557af[_0xb652('0x13')]({'type':_0xa18f94['type'],'app':'Set','appdata':_0xb652('0x3e'),'context':_0xa18f94[_0xb652('0x17')],'exten':_0xa18f94['exten'],'priority':_0x430c53['length']+_0x4775d3[_0xb652('0xf')]+_0x116778++,'VoiceExtensionId':_0xa18f94[_0xb652('0x1e')]});}}}for(var _0x442cdf=0x0;_0x442cdf<_0x430c53[_0xb652('0x2a')];_0x442cdf+=0x1){var _0x3c57b7=_0x4775d3[_0xb652('0xf')]+_0x430c53[_0xb652('0x2a')];var _0x13bd13=_0x442cdf===_0x430c53[_0xb652('0x2a')]-0x1?_0x4775d3[_0xb652('0xf')]+_0x2557af['length']+_0x50942a[_0xb652('0x2a')]+0x2:_0x4775d3[_0xb652('0xf')]+_0x442cdf+0x1;_0x2557af[_0xb652('0x3f')](_0x442cdf,0x0,{'type':_0xa18f94[_0xb652('0x16')],'app':'GotoIfTime','appdata':_0x430c53[_0x442cdf]+'?'+_0xa18f94[_0xb652('0x17')]+_0xb652('0x40')+_0x3c57b7+':'+_0xa18f94[_0xb652('0x17')]+_0xb652('0x40')+_0x13bd13,'exten':_0xa18f94['exten'],'context':_0xa18f94[_0xb652('0x17')],'priority':_0x4775d3[_0xb652('0xf')]+_0x442cdf,'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});}_0xa18f94[_0xb652('0xf')]=_0x2557af[_0xb652('0x2a')]?_[_0xb652('0x41')](_0x2557af)[_0xb652('0xf')]+0x1:_0x4775d3[_0xb652('0xf')];_0x4775d3[_0xb652('0xf')]=(_0x50942a[_0xb652('0x2a')]?_[_0xb652('0x41')](_0x50942a)[_0xb652('0xf')]:_0xa18f94[_0xb652('0xf')])+0x1;_0x4775d3[_0xb652('0x10')]=_[_0xb652('0x42')](_0x4775d3[_0xb652('0x10')],_0x2557af,[_0xa18f94],_0x50942a);}_0x4775d3[_0xb652('0x10')]['push']({'type':_0x156001[_0x35feca][0x0][_0xb652('0x16')],'app':'Hangup','exten':_0x156001[_0x35feca][0x0][_0xb652('0x8')],'context':_0x156001[_0x35feca][0x0]['context'],'priority':_0x4775d3[_0xb652('0xf')],'VoiceExtensionId':_0x156001[_0x35feca][0x0][_0xb652('0x1e')]});_0x5b5e2d[_0xb652('0x13')](_0x156001[_0x35feca][0x0]['VoiceExtensionId']);_0x332a3a=_[_0xb652('0x42')](_0x332a3a,_0x4775d3['extensions']);}}return _0x37c472[_0xb652('0x43')](function(_0x3ab53b){return _0x37c472[_0xb652('0x1')]['VoiceExtension'][_0xb652('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x5b5e2d}},'transaction':_0x3ab53b})[_0xb652('0x3')](function(_0x3c23e0){return _0x37c472[_0xb652('0x1')][_0xb652('0x4')][_0xb652('0x45')](_[_0xb652('0x46')](_0x332a3a,_0xb652('0xf')),{'transaction':_0x3ab53b});});});})[_0xb652('0x47')](function(_0x1ecf3e){console['error'](_0x1ecf3e);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b1f7515..2d918aa 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x898f00,_0x37d1d4){var _0xe59e86=function(_0x3f1ecf){while(--_0x3f1ecf){_0x898f00['push'](_0x898f00['shift']());}};_0xe59e86(++_0x37d1d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xcb91[_0x2283dc];return _0x16db90;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x1cade3,_0x1b0cff){var _0x4cf547=function(_0x13299){while(--_0x13299){_0x1cade3['push'](_0x1cade3['shift']());}};_0x4cf547(++_0x1b0cff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 711f3f2..fd57d43 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 _0x9049=['body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','util','bluebird','squel','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','toString','cm_contacts.updatedAt','cm_contacts','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','into',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','exit','push','code','message','spread','catch','error','main','stringify','send','binding','socket_timestamp','.csv','header','parse','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','isValid','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','step','duplicates','CREATE\x20TABLE\x20','format',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','campaigns','CampaignId','each','then','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory'];(function(_0x7eb86f,_0x1ca3eb){var _0x38ecd0=function(_0x34ac3a){while(--_0x34ac3a){_0x7eb86f['push'](_0x7eb86f['shift']());}};_0x38ecd0(++_0x1ca3eb);}(_0x9049,0x85));var _0x9904=function(_0x1adde0,_0x378167){_0x1adde0=_0x1adde0-0x0;var _0x18da10=_0x9049[_0x1adde0];return _0x18da10;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x9904('0x0'));var BPromise=require(_0x9904('0x1'));var moment=require('moment');var squel=require(_0x9904('0x2'));var Redis=require(_0x9904('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x9904('0x4'))(_0x9904('0x5'));config[_0x9904('0x6')]=_[_0x9904('0x7')](config[_0x9904('0x6')],{'host':_0x9904('0x8'),'port':0x18eb});var socket=require(_0x9904('0x9'))(new Redis(config[_0x9904('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x9904('0xa'));function isEmail(_0x2ca472){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))*$/[_0x9904('0xb')](_0x2ca472);}function selectNotIn(_0x604df7,_0xbc209d,_0x24fb78,_0x3e7e99,_0x2ffcf7){return squel[_0x9904('0xc')]()[_0x9904('0xd')]('phone')['from'](_0x3e7e99)['join'](_0xbc209d,null,_0xbc209d+_0x9904('0xe')+_0x3e7e99+'.'+_0x24fb78)[_0x9904('0xf')](_0x3e7e99+'.'+_0x24fb78+_0x9904('0x10')+_0x604df7+'.'+_0x24fb78)['where'](_0xbc209d+_0x9904('0x11')+_0x2ffcf7[_0x9904('0x12')]()+')');}function insertCmHopper(_0x4151aa,_0x1c5079,_0x12bcd6,_0xf7ca9b,_0x15ee16){var _0x395ff6=[_0x9904('0x13'),'cm_contacts.scheduledat',_0x9904('0x14'),_0x9904('0x15'),_0x1c5079+'.'+_0xf7ca9b,_0x9904('0x16'),'cm_contacts.updatedAt','cm_contacts.priority',_0x9904('0x17'),'\x22'+_0x15ee16+'\x22'];return squel[_0x9904('0x18')]()['into']('cm_hopper')[_0x9904('0x19')]([_0x9904('0x1a'),_0x9904('0x1b'),_0x9904('0x1c'),_0x9904('0x1d'),_0xf7ca9b,_0x9904('0x1e'),_0x9904('0x1f'),_0x9904('0x20'),_0x9904('0x21'),_0x9904('0x22')],squel[_0x9904('0xc')]()[_0x9904('0x23')](_0x395ff6)[_0x9904('0x24')](_0x1c5079)[_0x9904('0x12')]('cm_contacts',null,_0x9904('0x25')+_0x1c5079+_0x9904('0x26'))[_0x9904('0x12')](_0x12bcd6,null,_0x12bcd6+_0x9904('0xe')+_0x1c5079+'.'+_0xf7ca9b)[_0x9904('0xf')](_0x1c5079+_0x9904('0x27'),_0x4151aa)['where'](_0x9904('0x28'),NOW)[_0x9904('0xf')](_0x9904('0x29'),selectNotIn(_0x1c5079,_0x12bcd6,_0xf7ca9b,'cm_hopper',[_0x9904('0x2a'),_0x9904('0x2b')]))['where'](_0x9904('0x29'),selectNotIn(_0x1c5079,_0x12bcd6,_0xf7ca9b,_0x9904('0x2c'),[_0x9904('0x2a')])))[_0x9904('0x2d')]();}function insertCmHopperBlack(_0x1488fd,_0x333767,_0x3b3791,_0x4d18bf){var _0x18336e=[_0x9904('0x13'),_0x9904('0x14'),_0x9904('0x15'),_0x333767+'.'+_0x4d18bf,_0x9904('0x16'),_0x9904('0x2e')];return squel[_0x9904('0x18')]()['into']('cm_hopper_black')[_0x9904('0x19')](['phone',_0x9904('0x1c'),_0x9904('0x1d'),_0x4d18bf,_0x9904('0x1e'),_0x9904('0x1f')],squel[_0x9904('0xc')]()[_0x9904('0x23')](_0x18336e)[_0x9904('0x24')](_0x333767)['join'](_0x9904('0x2f'),null,_0x9904('0x25')+_0x333767+'.CmListId')[_0x9904('0x12')](_0x3b3791,null,_0x3b3791+_0x9904('0xe')+_0x333767+'.'+_0x4d18bf)[_0x9904('0xf')](_0x333767+'.CmListId\x20=\x20?',_0x1488fd)['where'](_0x9904('0x28'),NOW)['where'](_0x9904('0x29'),squel[_0x9904('0xc')]()[_0x9904('0xd')](_0x9904('0x1a'))[_0x9904('0x24')](_0x9904('0x30'))['where'](_0x9904('0x31'),_0x1488fd)[_0x9904('0xf')](_0x4d18bf+_0x9904('0x32'),_0x333767+'.'+_0x4d18bf)))[_0x9904('0x2d')]();}function insertCmContact(_0x2af7d2,_0x43bead,_0x4ffa52,_0x2efc76){var _0x104a3b=_[_0x9904('0x33')](_[_0x9904('0x34')](_0x2efc76),[_0x9904('0x1d'),_0x9904('0x35'),_0x9904('0x1e'),_0x9904('0x1f')]);return squel['insert']()[_0x9904('0x36')](_0x9904('0x2f'))[_0x9904('0x19')](_0x104a3b,squel[_0x9904('0xc')]()[_0x9904('0x23')](_0x104a3b)[_0x9904('0x24')](_0x43bead)[_0x9904('0xf')]('('+_0x4ffa52[_0x9904('0x12')](',')+_0x9904('0x37'),squel[_0x9904('0xc')]()[_0x9904('0x23')](_0x4ffa52)[_0x9904('0x24')]('cm_contacts')[_0x9904('0xf')](_0x9904('0x31'),_0x2af7d2)[_0x9904('0xf')](_0x9904('0x38')))[_0x9904('0xf')](_0x9904('0x39'),squel['select']()['field']('MIN(id)',_0x9904('0x3a'))[_0x9904('0x24')](_0x43bead)[_0x9904('0x3b')](_0x4ffa52[_0x9904('0x12')](','))))['toString']();}function handleStop(){logger[_0x9904('0x3c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x42b41a){logger['error'](_0x42b41a['message']);process[_0x9904('0x3d')](0x1);}function handleError(_0x389ec1,_0x9f6eb8){stats['errors'][_0x9904('0x3e')]({'name':_0x9f6eb8[_0x9904('0x3f')],'message':_0x9f6eb8[_0x9904('0x40')],'row':_0x389ec1});}function handleQuery(_0x437481){logger[_0x9904('0x3c')](_0x437481);return db['sequelize']['query'](_0x437481)[_0x9904('0x41')](function(_0x122c7c){results[_0x9904('0x3e')](_0x122c7c);})[_0x9904('0x42')](function(_0x51dea1){logger[_0x9904('0x43')](_0x51dea1[_0x9904('0x40')]);});}function main(_0x50e311,_0x5a1939,_0x5a1af7,_0x4dafea){logger[_0x9904('0x3c')](_0x9904('0x44'),_0x50e311,JSON[_0x9904('0x45')](_0x5a1939));process[_0x9904('0x46')]('start');var _0x5ce00e=_0x5a1939[_0x9904('0x47')];var _0x18613a=_0x5a1939[_0x9904('0x48')];var _0x292a19=path[_0x9904('0x12')](config['root'],'server/files/tmp',_0x18613a+_0x9904('0x49'));var _0x51d008=_[_0x9904('0x34')](_0x5ce00e)[_0x9904('0x12')]();logger[_0x9904('0x3c')](_0x9904('0x4a'),_0x51d008);fs['writeFileSync'](_0x292a19,_0x51d008+'\x0a');Papa[_0x9904('0x4b')](fs[_0x9904('0x4c')](_0x50e311),{'header':!![],'skipEmptyLines':!![],'step':function(_0x377239,_0x183c22){try{for(var _0x4707c0=0x0,_0x4ca694=[];_0x4707c0<_0x377239[_0x9904('0x4d')][_0x9904('0x4e')];_0x4707c0++){stats[_0x9904('0x4f')]+=0x1;if(_0x377239[_0x9904('0x50')][_0x4707c0]){handleError(_0x377239['data'][_0x4707c0],_0x377239[_0x9904('0x50')][_0x4707c0]);}else{var _0x558864=[];for(var _0x26cd6d in _0x5ce00e){if(_0x5ce00e[_0x9904('0x51')](_0x26cd6d)){if(_0x377239[_0x9904('0x4d')][_0x4707c0][_0x5ce00e[_0x26cd6d]]){var _0x2ba0cd=_[_0x9904('0x52')](_0x377239['data'][_0x4707c0][_0x5ce00e[_0x26cd6d]][_0x9904('0x53')](/"/g,'\x27'));switch(_0x26cd6d){case'scheduledat':var _0x57ffb7=moment(_0x2ba0cd,_0x9904('0xa'),!![]);if(_0x57ffb7[_0x9904('0x54')]()){_0x4ca694[_0x9904('0x3e')]('\x22'+_0x2ba0cd+'\x22');}else{_0x558864[_0x9904('0x3e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x9904('0x20'):var _0x1240e6=parseInt(_0x2ba0cd);_0x2ba0cd=_['isNaN'](_0x1240e6)||_0x1240e6<0x0||_0x1240e6>0x4?_0x4dafea?0x3:0x2:_0x1240e6;_0x4ca694['push']('\x22'+_0x2ba0cd+'\x22');break;case'UserId':var _0x122eb4=parseInt(_0x2ba0cd);if(_[_0x9904('0x55')](_0x122eb4)&&_[_0x9904('0x56')](_0x5a1af7,_0x122eb4)){_0x4ca694[_0x9904('0x3e')]('\x22'+_0x122eb4+'\x22');}else{_0x558864[_0x9904('0x3e')](_0x9904('0x57'));}break;case _0x9904('0x58'):if(isEmail(_0x2ba0cd)){_0x4ca694[_0x9904('0x3e')]('\x22'+_0x2ba0cd+'\x22');}else{_0x558864[_0x9904('0x3e')](_0x9904('0x59'));}break;case _0x9904('0x5a'):var _0x484b7b=moment(_0x2ba0cd,_0x9904('0x5b'),!![]);if(_0x484b7b['isValid']()){_0x4ca694[_0x9904('0x3e')]('\x22'+_0x2ba0cd+'\x22');}else{_0x558864[_0x9904('0x3e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4ca694['push']('\x22'+_0x2ba0cd+'\x22');}}else{switch(_0x26cd6d){case _0x9904('0x5c'):case'phone':_0x558864[_0x9904('0x3e')](_0x26cd6d+_0x9904('0x5d'));break;default:_0x4ca694['push']('\x22\x22');}}}}if(_0x558864['length']){handleError(_0x377239[_0x9904('0x4d')][_0x4707c0],{'code':_0x9904('0x5e'),'message':_0x558864[_0x9904('0x12')]()});}else{fs[_0x9904('0x5f')](_0x292a19,_0x4ca694[_0x9904('0x12')]()+'\x0a');}_0x4ca694=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x9904('0x60')+_0x18613a,stats);stats[_0x9904('0x50')]=[];}}if(stopped){logger[_0x9904('0x3c')]('Abort\x20parser');_0x183c22['abort']();}}catch(_0x287d03){handleError(_0x377239[_0x9904('0x4d')][_0x4707c0],{'code':'SystemError','message':_0x287d03[_0x9904('0x40')]});logger[_0x9904('0x43')](_0x9904('0x61'),_0x287d03[_0x9904('0x40')]);}},'complete':function(){try{var _0x3193e9=[];var _0x22bcc6=_0x9904('0x2f');if(_0x5a1939[_0x9904('0x62')]&&_0x5a1939[_0x9904('0x62')]['length']){_0x22bcc6='cm_contacts_'+_0x18613a;_0x3193e9[_0x9904('0x3e')](_0x9904('0x63')+_0x22bcc6+'\x20LIKE\x20cm_contacts;');}var _0x5e55e8=util[_0x9904('0x64')]('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',_0x292a19,_0x22bcc6,_0x51d008,_0x5a1939[_0x9904('0x1d')],_0x5a1939['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x5ce00e[_0x9904('0x1b')])){_0x5e55e8+=_0x9904('0x65');}_0x3193e9[_0x9904('0x3e')](_0x5e55e8);if(_0x5a1939[_0x9904('0x62')]&&_0x5a1939['duplicates'][_0x9904('0x4e')]){_0x3193e9[_0x9904('0x3e')](insertCmContact(_0x5a1939['ListId'],_0x22bcc6,_0x5a1939['duplicates'],_0x5ce00e));_0x3193e9[_0x9904('0x3e')](_0x9904('0x66')+_0x22bcc6+';');}_0x3193e9[_0x9904('0x3e')](insertCmHopper(_0x5a1939['ListId'],_0x9904('0x67'),_0x9904('0x68'),_0x9904('0x69'),_0x4dafea));_0x3193e9[_0x9904('0x3e')](insertCmHopperBlack(_0x5a1939[_0x9904('0x1d')],_0x9904('0x6a'),'voice_queues',_0x9904('0x69')));_0x3193e9['push'](insertCmHopper(_0x5a1939[_0x9904('0x1d')],_0x9904('0x6b'),'campaigns','CampaignId',_0x4dafea));_0x3193e9[_0x9904('0x3e')](insertCmHopperBlack(_0x5a1939[_0x9904('0x1d')],_0x9904('0x6c'),_0x9904('0x6d'),_0x9904('0x6e')));BPromise[_0x9904('0x6f')](_0x3193e9,handleQuery)[_0x9904('0x70')](function(_0x19c9b5){stats[_0x9904('0x71')]=!![];stats[_0x9904('0x72')]=_0x5a1939[_0x9904('0x62')]&&_0x5a1939[_0x9904('0x62')]['length']?results[0x2][_0x9904('0x72')]:results[0x0][_0x9904('0x72')];socket[_0x9904('0x73')](_0x9904('0x60')+_0x18613a,stats);fs[_0x9904('0x74')](_0x50e311);fs[_0x9904('0x74')](_0x292a19);process[_0x9904('0x3d')](0x0);})['catch'](function(_0x40b1f4){logger['error'](_0x40b1f4['message']);process[_0x9904('0x3d')](0x1);});}catch(_0x5a1836){logger[_0x9904('0x43')](_0x9904('0x75'),_0x5a1836[_0x9904('0x40')]);process[_0x9904('0x3d')](0x1);}},'error':function(_0x26d388,_0x2b6f81,_0x32b0b1,_0x32a844){throw new Error(_0x32a844);}});}function validate(){if(process[_0x9904('0x76')]&&process[_0x9904('0x76')][_0x9904('0x4e')]<0x4){throw new Error(_0x9904('0x77'));}var _0x32f4d9=path[_0x9904('0x12')](config[_0x9904('0x78')],'server/files/tmp',process[_0x9904('0x76')][0x2]);if(!fs[_0x9904('0x79')](_0x32f4d9)){throw new Error(_0x9904('0x7a'));}var _0x4b51cf={};try{_0x4b51cf=JSON[_0x9904('0x4b')](process[_0x9904('0x76')][0x3]);if(!_0x4b51cf['binding']){throw new Error(_0x9904('0x7b'));}if(!_0x4b51cf[_0x9904('0x47')]['phone']){throw new Error(_0x9904('0x7c'));}if(!_0x4b51cf[_0x9904('0x47')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x334878=0x0;if(_0x4b51cf['binding'][_0x9904('0x21')]){_0x334878=0x1;}if(!_0x4b51cf[_0x9904('0x1d')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1e70d5){throw new Error(_0x9904('0x7d'));}var _0x154e89=[];try{_0x154e89=_[_0x9904('0x7e')](JSON[_0x9904('0x4b')](process[_0x9904('0x76')][0x4]),'id');}catch(_0x1ab970){logger['info'](_0x9904('0x7f'));}main(_0x32f4d9,_0x4b51cf,_0x154e89,_0x334878);}validate();process['on']('SIGINT',handleStop);process['on'](_0x9904('0x80'),handleUncaughtException); \ No newline at end of file +var _0xecd2=['toString','cm_contacts.phone','insert','cm_hopper_black','ContactId','concat','keys','updatedAt','fromQuery','select',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','group','info','error','message','exit','sequelize','query','spread','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','data','length','errors','replace','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','affectedRows','unlink','catch','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22'];(function(_0x464607,_0x4e13eb){var _0x3ef4c6=function(_0x464491){while(--_0x464491){_0x464607['push'](_0x464607['shift']());}};_0x3ef4c6(++_0x4e13eb);}(_0xecd2,0xd1));var _0x2ecd=function(_0x4f12ba,_0x291b60){_0x4f12ba=_0x4f12ba-0x0;var _0x3fb21d=_0xecd2[_0x4f12ba];return _0x3fb21d;};'use strict';var fs=require('fs');var path=require(_0x2ecd('0x0'));var _=require('lodash');var Papa=require(_0x2ecd('0x1'));var util=require('util');var BPromise=require(_0x2ecd('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x2ecd('0x3'));var logger=require(_0x2ecd('0x4'))('import');config['redis']=_[_0x2ecd('0x5')](config[_0x2ecd('0x6')],{'host':_0x2ecd('0x7'),'port':0x18eb});var socket=require(_0x2ecd('0x8'))(new Redis(config[_0x2ecd('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2ecd('0x9')](_0x2ecd('0xa'));function isEmail(_0x937942){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))*$/[_0x2ecd('0xb')](_0x937942);}function selectNotIn(_0x43d603,_0x3958f5,_0x2391ae,_0x3464c9,_0x563e7d){return squel['select']()[_0x2ecd('0xc')](_0x2ecd('0xd'))[_0x2ecd('0xe')](_0x3464c9)[_0x2ecd('0xf')](_0x3958f5,null,_0x3958f5+_0x2ecd('0x10')+_0x3464c9+'.'+_0x2391ae)[_0x2ecd('0x11')](_0x3464c9+'.'+_0x2391ae+_0x2ecd('0x12')+_0x43d603+'.'+_0x2391ae)[_0x2ecd('0x11')](_0x3958f5+'.dialCheckDuplicateType\x20IN\x20('+_0x563e7d['join']()+')');}function insertCmHopper(_0x3d197a,_0x40b7fb,_0x36ee67,_0x4602b5,_0x372831){var _0x1dc668=['cm_contacts.phone',_0x2ecd('0x13'),_0x2ecd('0x14'),_0x2ecd('0x15'),_0x40b7fb+'.'+_0x4602b5,_0x2ecd('0x16'),_0x2ecd('0x17'),_0x2ecd('0x18'),_0x2ecd('0x19'),'\x22'+_0x372831+'\x22'];return squel['insert']()[_0x2ecd('0x1a')](_0x2ecd('0x1b'))['fromQuery']([_0x2ecd('0xd'),_0x2ecd('0x1c'),'ContactId',_0x2ecd('0x1d'),_0x4602b5,_0x2ecd('0x1e'),'updatedAt',_0x2ecd('0x1f'),_0x2ecd('0x20'),_0x2ecd('0x21')],squel['select']()[_0x2ecd('0x22')](_0x1dc668)[_0x2ecd('0xe')](_0x40b7fb)[_0x2ecd('0xf')](_0x2ecd('0x23'),null,_0x2ecd('0x24')+_0x40b7fb+_0x2ecd('0x25'))['join'](_0x36ee67,null,_0x36ee67+_0x2ecd('0x10')+_0x40b7fb+'.'+_0x4602b5)['where'](_0x40b7fb+_0x2ecd('0x26'),_0x3d197a)[_0x2ecd('0x11')](_0x2ecd('0x27'),NOW)[_0x2ecd('0x11')](_0x2ecd('0x28'),selectNotIn(_0x40b7fb,_0x36ee67,_0x4602b5,'cm_hopper',[_0x2ecd('0x29'),_0x2ecd('0x2a')]))[_0x2ecd('0x11')](_0x2ecd('0x28'),selectNotIn(_0x40b7fb,_0x36ee67,_0x4602b5,_0x2ecd('0x1b'),[_0x2ecd('0x29')])))[_0x2ecd('0x2b')]();}function insertCmHopperBlack(_0x4cb4be,_0x104cda,_0x3cfc8e,_0x4b1f3e){var _0x2e9a3c=[_0x2ecd('0x2c'),_0x2ecd('0x14'),'cm_contacts.ListId',_0x104cda+'.'+_0x4b1f3e,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x2ecd('0x2d')]()['into'](_0x2ecd('0x2e'))['fromQuery'](['phone',_0x2ecd('0x2f'),_0x2ecd('0x1d'),_0x4b1f3e,_0x2ecd('0x1e'),'updatedAt'],squel['select']()[_0x2ecd('0x22')](_0x2e9a3c)[_0x2ecd('0xe')](_0x104cda)[_0x2ecd('0xf')](_0x2ecd('0x23'),null,_0x2ecd('0x24')+_0x104cda+_0x2ecd('0x25'))[_0x2ecd('0xf')](_0x3cfc8e,null,_0x3cfc8e+_0x2ecd('0x10')+_0x104cda+'.'+_0x4b1f3e)[_0x2ecd('0x11')](_0x104cda+_0x2ecd('0x26'),_0x4cb4be)[_0x2ecd('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2ecd('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2ecd('0xc')](_0x2ecd('0xd'))['from'](_0x2ecd('0x2e'))[_0x2ecd('0x11')]('ListId\x20=\x20?',_0x4cb4be)['where'](_0x4b1f3e+'\x20=\x20?',_0x104cda+'.'+_0x4b1f3e)))[_0x2ecd('0x2b')]();}function insertCmContact(_0x4c1bb8,_0x3ce5bb,_0x4ccd46,_0x4e76b0){var _0x5c31c9=_[_0x2ecd('0x30')](_[_0x2ecd('0x31')](_0x4e76b0),[_0x2ecd('0x1d'),'CompanyId','createdAt',_0x2ecd('0x32')]);return squel[_0x2ecd('0x2d')]()['into'](_0x2ecd('0x23'))[_0x2ecd('0x33')](_0x5c31c9,squel[_0x2ecd('0x34')]()[_0x2ecd('0x22')](_0x5c31c9)[_0x2ecd('0xe')](_0x3ce5bb)[_0x2ecd('0x11')]('('+_0x4ccd46[_0x2ecd('0xf')](',')+_0x2ecd('0x35'),squel[_0x2ecd('0x34')]()[_0x2ecd('0x22')](_0x4ccd46)['from']('cm_contacts')['where'](_0x2ecd('0x36'),_0x4c1bb8)['where']('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x2ecd('0x34')]()[_0x2ecd('0xc')](_0x2ecd('0x37'),'min_id')[_0x2ecd('0xe')](_0x3ce5bb)[_0x2ecd('0x38')](_0x4ccd46['join'](','))))[_0x2ecd('0x2b')]();}function handleStop(){logger[_0x2ecd('0x39')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4a7bf0){logger[_0x2ecd('0x3a')](_0x4a7bf0[_0x2ecd('0x3b')]);process[_0x2ecd('0x3c')](0x1);}function handleError(_0x42527e,_0x5fd1a9){stats['errors']['push']({'name':_0x5fd1a9['code'],'message':_0x5fd1a9[_0x2ecd('0x3b')],'row':_0x42527e});}function handleQuery(_0x46ebdc){logger[_0x2ecd('0x39')](_0x46ebdc);return db[_0x2ecd('0x3d')][_0x2ecd('0x3e')](_0x46ebdc)[_0x2ecd('0x3f')](function(_0x44312d){results['push'](_0x44312d);})['catch'](function(_0x42ad71){logger[_0x2ecd('0x3a')](_0x42ad71[_0x2ecd('0x3b')]);});}function main(_0x2540b5,_0x36297c,_0xc66801,_0x278efd){logger[_0x2ecd('0x39')](_0x2ecd('0x40'),_0x2540b5,JSON[_0x2ecd('0x41')](_0x36297c));process['send'](_0x2ecd('0x42'));var _0x477060=_0x36297c[_0x2ecd('0x43')];var _0x35c09d=_0x36297c[_0x2ecd('0x44')];var _0x4249db=path[_0x2ecd('0xf')](config[_0x2ecd('0x45')],_0x2ecd('0x46'),_0x35c09d+_0x2ecd('0x47'));var _0x2dde98=_[_0x2ecd('0x31')](_0x477060)[_0x2ecd('0xf')]();logger['info'](_0x2ecd('0x48'),_0x2dde98);fs[_0x2ecd('0x49')](_0x4249db,_0x2dde98+'\x0a');Papa[_0x2ecd('0x4a')](fs['createReadStream'](_0x2540b5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x384bc4,_0x46db35){try{for(var _0x404e74=0x0,_0x3d0664=[];_0x404e74<_0x384bc4[_0x2ecd('0x4b')][_0x2ecd('0x4c')];_0x404e74++){stats['rows']+=0x1;if(_0x384bc4[_0x2ecd('0x4d')][_0x404e74]){handleError(_0x384bc4[_0x2ecd('0x4b')][_0x404e74],_0x384bc4[_0x2ecd('0x4d')][_0x404e74]);}else{var _0x84162d=[];for(var _0xf2071 in _0x477060){if(_0x477060['hasOwnProperty'](_0xf2071)){if(_0x384bc4['data'][_0x404e74][_0x477060[_0xf2071]]){var _0x395cc2=_['trim'](_0x384bc4[_0x2ecd('0x4b')][_0x404e74][_0x477060[_0xf2071]][_0x2ecd('0x4e')](/"/g,'\x27'));switch(_0xf2071){case _0x2ecd('0x1c'):var _0x266809=moment(_0x395cc2,_0x2ecd('0xa'),!![]);if(_0x266809[_0x2ecd('0x4f')]()){_0x3d0664[_0x2ecd('0x50')]('\x22'+_0x395cc2+'\x22');}else{_0x84162d[_0x2ecd('0x50')](_0x2ecd('0x51'));}break;case _0x2ecd('0x1f'):var _0x25239e=parseInt(_0x395cc2);_0x395cc2=_[_0x2ecd('0x52')](_0x25239e)||_0x25239e<0x0||_0x25239e>0x4?_0x278efd?0x3:0x2:_0x25239e;_0x3d0664[_0x2ecd('0x50')]('\x22'+_0x395cc2+'\x22');break;case _0x2ecd('0x20'):var _0x20be52=parseInt(_0x395cc2);if(_[_0x2ecd('0x53')](_0x20be52)&&_['includes'](_0xc66801,_0x20be52)){_0x3d0664[_0x2ecd('0x50')]('\x22'+_0x20be52+'\x22');}else{_0x84162d[_0x2ecd('0x50')](_0x2ecd('0x54'));}break;case _0x2ecd('0x55'):if(isEmail(_0x395cc2)){_0x3d0664[_0x2ecd('0x50')]('\x22'+_0x395cc2+'\x22');}else{_0x84162d[_0x2ecd('0x50')](_0x2ecd('0x56'));}break;case _0x2ecd('0x57'):var _0x5f23cd=moment(_0x395cc2,_0x2ecd('0x58'),!![]);if(_0x5f23cd['isValid']()){_0x3d0664[_0x2ecd('0x50')]('\x22'+_0x395cc2+'\x22');}else{_0x84162d[_0x2ecd('0x50')](_0x2ecd('0x59'));}break;default:_0x3d0664['push']('\x22'+_0x395cc2+'\x22');}}else{switch(_0xf2071){case _0x2ecd('0x5a'):case'phone':_0x84162d[_0x2ecd('0x50')](_0xf2071+_0x2ecd('0x5b'));break;default:_0x3d0664['push']('\x22\x22');}}}}if(_0x84162d['length']){handleError(_0x384bc4['data'][_0x404e74],{'code':_0x2ecd('0x5c'),'message':_0x84162d[_0x2ecd('0xf')]()});}else{fs['appendFileSync'](_0x4249db,_0x3d0664[_0x2ecd('0xf')]()+'\x0a');}_0x3d0664=[];}if(!(stats['rows']%0xc8)){socket[_0x2ecd('0x5d')](_0x2ecd('0x5e')+_0x35c09d,stats);stats[_0x2ecd('0x4d')]=[];}}if(stopped){logger[_0x2ecd('0x39')]('Abort\x20parser');_0x46db35[_0x2ecd('0x5f')]();}}catch(_0x47cacb){handleError(_0x384bc4[_0x2ecd('0x4b')][_0x404e74],{'code':_0x2ecd('0x60'),'message':_0x47cacb[_0x2ecd('0x3b')]});logger[_0x2ecd('0x3a')](_0x2ecd('0x61'),_0x47cacb[_0x2ecd('0x3b')]);}},'complete':function(){try{var _0x362b59=[];var _0x1e8dd1=_0x2ecd('0x23');if(_0x36297c[_0x2ecd('0x62')]&&_0x36297c[_0x2ecd('0x62')][_0x2ecd('0x4c')]){_0x1e8dd1=_0x2ecd('0x63')+_0x35c09d;_0x362b59[_0x2ecd('0x50')](_0x2ecd('0x64')+_0x1e8dd1+'\x20LIKE\x20cm_contacts;');}var _0x2f99d6=util[_0x2ecd('0x9')](_0x2ecd('0x65'),_0x4249db,_0x1e8dd1,_0x2dde98,_0x36297c[_0x2ecd('0x1d')],_0x36297c[_0x2ecd('0x66')]||null,NOW,NOW);if(_[_0x2ecd('0x67')](_0x477060['scheduledat'])){_0x2f99d6+=',\x20scheduledAt\x20=\x20NOW()';}_0x362b59[_0x2ecd('0x50')](_0x2f99d6);if(_0x36297c['duplicates']&&_0x36297c['duplicates']['length']){_0x362b59[_0x2ecd('0x50')](insertCmContact(_0x36297c[_0x2ecd('0x1d')],_0x1e8dd1,_0x36297c[_0x2ecd('0x62')],_0x477060));_0x362b59[_0x2ecd('0x50')](_0x2ecd('0x68')+_0x1e8dd1+';');}_0x362b59[_0x2ecd('0x50')](insertCmHopper(_0x36297c[_0x2ecd('0x1d')],_0x2ecd('0x69'),'voice_queues',_0x2ecd('0x6a'),_0x278efd));_0x362b59[_0x2ecd('0x50')](insertCmHopperBlack(_0x36297c[_0x2ecd('0x1d')],'voice_queues_has_cm_blacklists',_0x2ecd('0x6b'),'VoiceQueueId'));_0x362b59[_0x2ecd('0x50')](insertCmHopper(_0x36297c[_0x2ecd('0x1d')],_0x2ecd('0x6c'),_0x2ecd('0x6d'),_0x2ecd('0x6e'),_0x278efd));_0x362b59[_0x2ecd('0x50')](insertCmHopperBlack(_0x36297c['ListId'],_0x2ecd('0x6f'),_0x2ecd('0x6d'),_0x2ecd('0x6e')));BPromise['each'](_0x362b59,handleQuery)[_0x2ecd('0x70')](function(_0x22807e){stats['finish']=!![];stats[_0x2ecd('0x71')]=_0x36297c['duplicates']&&_0x36297c[_0x2ecd('0x62')]['length']?results[0x2][_0x2ecd('0x71')]:results[0x0][_0x2ecd('0x71')];socket[_0x2ecd('0x5d')]('contact:import:'+_0x35c09d,stats);fs[_0x2ecd('0x72')](_0x2540b5);fs['unlink'](_0x4249db);process[_0x2ecd('0x3c')](0x0);})[_0x2ecd('0x73')](function(_0x25f0a5){logger[_0x2ecd('0x3a')](_0x25f0a5[_0x2ecd('0x3b')]);process[_0x2ecd('0x3c')](0x1);});}catch(_0x15003c){logger['error'](_0x2ecd('0x74'),_0x15003c[_0x2ecd('0x3b')]);process[_0x2ecd('0x3c')](0x1);}},'error':function(_0x1691d5,_0x38cd17,_0x234c22,_0x1601ee){throw new Error(_0x1601ee);}});}function validate(){if(process['argv']&&process[_0x2ecd('0x75')][_0x2ecd('0x4c')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x79a0ed=path['join'](config['root'],'server/files/tmp',process[_0x2ecd('0x75')][0x2]);if(!fs[_0x2ecd('0x76')](_0x79a0ed)){throw new Error(_0x2ecd('0x77'));}var _0xd565b1={};try{_0xd565b1=JSON[_0x2ecd('0x4a')](process[_0x2ecd('0x75')][0x3]);if(!_0xd565b1[_0x2ecd('0x43')]){throw new Error(_0x2ecd('0x78'));}if(!_0xd565b1[_0x2ecd('0x43')]['phone']){throw new Error(_0x2ecd('0x79'));}if(!_0xd565b1[_0x2ecd('0x43')][_0x2ecd('0x5a')]){throw new Error(_0x2ecd('0x7a'));}var _0x3bee24=0x0;if(_0xd565b1[_0x2ecd('0x43')]['UserId']){_0x3bee24=0x1;}if(!_0xd565b1[_0x2ecd('0x1d')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x25184a){throw new Error(_0x2ecd('0x7b'));}var _0xf0dd3=[];try{_0xf0dd3=_['map'](JSON[_0x2ecd('0x4a')](process['argv'][0x4]),'id');}catch(_0x5abcaa){logger[_0x2ecd('0x39')](_0x2ecd('0x7c'));}main(_0x79a0ed,_0xd565b1,_0xf0dd3,_0x3bee24);}validate();process['on']('SIGINT',handleStop);process['on'](_0x2ecd('0x7d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 501358b..714c16a 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['destexten','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Called\x20Number','membername','starttime','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To'];(function(_0xaff3d5,_0x36f203){var _0x4d4e28=function(_0x5b9d26){while(--_0x5b9d26){_0xaff3d5['push'](_0xaff3d5['shift']());}};_0x4d4e28(++_0x36f203);}(_0xb688,0xcf));var _0x8b68=function(_0x78a81a,_0x450088){_0x78a81a=_0x78a81a-0x0;var _0x5a05d7=_0xb688[_0x78a81a];return _0x5a05d7;};'use strict';exports['getSubjects']=function(_0x39c8c5,_0x196cec){var _0x266285=[{'type':_0x8b68('0x0'),'content':_0x8b68('0x1'),'variableName':null}];switch(_0x39c8c5[_0x8b68('0x2')]()){case'voice':switch(_0x196cec[_0x8b68('0x2')]()){case _0x8b68('0x3'):_0x266285[_0x8b68('0x4')]({'type':_0x8b68('0x5'),'content':'','variableName':'queue'});_0x266285[_0x8b68('0x4')]({'type':'variable','content':'','variableName':_0x8b68('0x6')});break;case _0x8b68('0x7'):_0x266285[_0x8b68('0x4')]({'type':_0x8b68('0x0'),'content':_0x8b68('0x8'),'variableName':null});_0x266285[_0x8b68('0x4')]({'type':_0x8b68('0x5'),'content':'','variableName':_0x8b68('0x9')});break;}}return _0x266285;};exports[_0x8b68('0xa')]=function(_0x2f2e3c,_0x418775){var _0x317d01=[];switch(_0x2f2e3c[_0x8b68('0x2')]()){case'voice':switch(_0x418775[_0x8b68('0x2')]()){case _0x8b68('0x3'):_0x317d01=[{'type':_0x8b68('0x0'),'content':_0x8b68('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0xd'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x6')},{'type':_0x8b68('0xc'),'content':'','key':'Caller\x20Name','keyType':_0x8b68('0x5'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x8b68('0xe'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0xf')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x8b68('0x5'),'variableName':'queue'},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x10'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x11')},{'type':'keyValue','content':'','key':_0x8b68('0x12'),'keyType':_0x8b68('0x5'),'variableName':'agentcalledAt'},{'type':_0x8b68('0x0'),'content':_0x8b68('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x14'),'keyType':_0x8b68('0x5'),'variableName':'destcalleridname'},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x15'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x9')},{'type':_0x8b68('0x0'),'content':_0x8b68('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x8b68('0x5'),'variableName':'agentcalledAt'},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x17'),'keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x18')},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x19'),'keyType':'variable','variableName':_0x8b68('0x1a')},{'type':_0x8b68('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x8b68('0x5'),'variableName':_0x8b68('0x1b')},{'type':_0x8b68('0xc'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':'talktime'}];break;case _0x8b68('0x7'):_0x317d01=[{'type':_0x8b68('0x0'),'content':_0x8b68('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x8b68('0x1c'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x8b68('0xc'),'content':'','key':'Member\x20Name','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x1d')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x11')},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x12'),'keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x1e')},{'type':_0x8b68('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x8b68('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x1f')},{'type':'keyValue','content':'','key':_0x8b68('0x20'),'keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x21')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x22')},{'type':_0x8b68('0xc'),'content':'','key':_0x8b68('0x23'),'keyType':_0x8b68('0x5'),'keyContent':'','variableName':_0x8b68('0x24')}];break;}}return _0x317d01;}; \ No newline at end of file +var _0xf7b4=['destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','Date','***\x20Agent\x20Info\x20***','Agent\x20Name'];(function(_0x1443e3,_0x1b8bbf){var _0x442136=function(_0x54ecbb){while(--_0x54ecbb){_0x1443e3['push'](_0x1443e3['shift']());}};_0x442136(++_0x1b8bbf);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4b6658,_0x15a721){_0x4b6658=_0x4b6658-0x0;var _0x3e311a=_0xf7b4[_0x4b6658];return _0x3e311a;};'use strict';exports[_0x4f7b('0x0')]=function(_0x5579ed,_0x581bb0){var _0x5ccf30=[{'type':_0x4f7b('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x5579ed['toLowerCase']()){case _0x4f7b('0x2'):switch(_0x581bb0[_0x4f7b('0x3')]()){case _0x4f7b('0x4'):_0x5ccf30[_0x4f7b('0x5')]({'type':_0x4f7b('0x6'),'content':'','variableName':_0x4f7b('0x7')});_0x5ccf30[_0x4f7b('0x5')]({'type':_0x4f7b('0x6'),'content':'','variableName':_0x4f7b('0x8')});break;case _0x4f7b('0x9'):_0x5ccf30[_0x4f7b('0x5')]({'type':_0x4f7b('0x1'),'content':_0x4f7b('0xa'),'variableName':null});_0x5ccf30['push']({'type':_0x4f7b('0x6'),'content':'','variableName':_0x4f7b('0xb')});break;}}return _0x5ccf30;};exports['getDescriptions']=function(_0xdd1aab,_0x3a3d6c){var _0x408e01=[];switch(_0xdd1aab[_0x4f7b('0x3')]()){case _0x4f7b('0x2'):switch(_0x3a3d6c['toLowerCase']()){case _0x4f7b('0x4'):_0x408e01=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0xd'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x8')},{'type':'keyValue','content':'','key':_0x4f7b('0xe'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0xf')},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x10'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x11')},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x12'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x7')},{'type':_0x4f7b('0xc'),'content':'','key':'UniqueId','keyType':_0x4f7b('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x4f7b('0x13'),'keyType':_0x4f7b('0x6'),'variableName':'agentcalledAt'},{'type':_0x4f7b('0x1'),'content':_0x4f7b('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x15'),'keyType':'variable','variableName':_0x4f7b('0x16')},{'type':'keyValue','content':'','key':_0x4f7b('0x17'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0xb')},{'type':_0x4f7b('0x1'),'content':_0x4f7b('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x19'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x1a')},{'type':'keyValue','content':'','key':_0x4f7b('0x1b'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x1c')},{'type':'keyValue','content':'','key':_0x4f7b('0x1d'),'keyType':_0x4f7b('0x6'),'variableName':'agentcompleteAt'},{'type':_0x4f7b('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x1e')},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x1f'),'keyType':_0x4f7b('0x6'),'variableName':_0x4f7b('0x20')}];break;case _0x4f7b('0x9'):_0x408e01=[{'type':_0x4f7b('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x21'),'keyType':_0x4f7b('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x22'),'keyType':_0x4f7b('0x6'),'keyContent':'','variableName':_0x4f7b('0x23')},{'type':_0x4f7b('0xc'),'content':'','key':'UniqueId','keyType':_0x4f7b('0x6'),'keyContent':'','variableName':_0x4f7b('0x24')},{'type':_0x4f7b('0xc'),'content':'','key':'Date','keyType':_0x4f7b('0x6'),'keyContent':'','variableName':'starttime'},{'type':'string','content':_0x4f7b('0x18')},{'type':'keyValue','content':'','key':_0x4f7b('0x25'),'keyType':_0x4f7b('0x6'),'keyContent':'','variableName':_0x4f7b('0x26')},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x27'),'keyType':_0x4f7b('0x6'),'keyContent':'','variableName':_0x4f7b('0x28')},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x29'),'keyType':_0x4f7b('0x6'),'keyContent':'','variableName':_0x4f7b('0x2a')},{'type':_0x4f7b('0xc'),'content':'','key':_0x4f7b('0x2b'),'keyType':_0x4f7b('0x6'),'keyContent':'','variableName':_0x4f7b('0x2c')}];break;}}return _0x408e01;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 67086d4..d09e89f 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9efe=['tracked','clone','body','html','phone','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','then','update','info','error'];(function(_0x59c703,_0xd196b8){var _0x45ca3f=function(_0x4924a4){while(--_0x4924a4){_0x59c703['push'](_0x59c703['shift']());}};_0x45ca3f(++_0xd196b8);}(_0x9efe,0xca));var _0xe9ef=function(_0x6c5690,_0xf8cf2a){_0x6c5690=_0x6c5690-0x0;var _0x416f9f=_0x9efe[_0x6c5690];return _0x416f9f;};'use strict';var _=require('lodash');var db=require(_0xe9ef('0x0'))['db'];var loggers={'openchannel':require(_0xe9ef('0x1'))(_0xe9ef('0x2')),'mail':require(_0xe9ef('0x1'))(_0xe9ef('0x3')),'fax':require('../../config/logger')(_0xe9ef('0x4')),'sms':require(_0xe9ef('0x1'))(_0xe9ef('0x5')),'chat':require(_0xe9ef('0x1'))(_0xe9ef('0x6')),'whatsapp':require(_0xe9ef('0x1'))(_0xe9ef('0x7'))};function getInteractionId(_0x58d664,_0x47df46,_0x590cea){if(_0x58d664&&_0x58d664[_[_0xe9ef('0x8')](_0x590cea)+_0xe9ef('0x9')]){return _0x58d664[_[_0xe9ef('0x8')](_0x590cea)+'InteractionId'];}else if(_0x58d664&&_0x58d664['id']){return _0x58d664['id'];}else if(_0x47df46&&_0x47df46['id']){return _0x47df46['id'];}else{return'unknown';}}function log(_0x55d349,_0x4f4122,_0x341d45,_0xab041e,_0xda2b2,_0x527fe8){loggers[_0xda2b2[_0xe9ef('0xa')]()][_0x55d349](_0xe9ef('0xb'),_0x527fe8[_0xe9ef('0xc')](),_0x4f4122?_0x4f4122['id']:null,_0x4f4122?_0x4f4122[_0xe9ef('0xd')]:null,_0x4f4122?_0x4f4122[_0xe9ef('0xe')]:null,getInteractionId(_0x341d45,_0xab041e,_0xda2b2),_0x341d45?JSON[_0xe9ef('0xf')](_0x341d45):'null');}function updateUser(_0x45ae9a,_0x3248f4,_0x1157d1,_0x429783,_0xbe7e){db[_['upperFirst'](_0x429783)+_0xe9ef('0x10')][_0xe9ef('0x11')]({'where':{'id':getInteractionId(_0x3248f4,_0x1157d1,_0x429783)}})[_0xe9ef('0x12')](function(_0x1f2698){if(_0x1f2698){return _0x1f2698[_0xe9ef('0x13')]({'UserId':_0x45ae9a?_0x45ae9a['id']:null});}})['then'](function(_0x537d17){if(_0x537d17){log(_0xe9ef('0x14'),_0x45ae9a,_0x3248f4,_0x1157d1,_0x429783,_0xbe7e);}})['catch'](function(){log(_0xe9ef('0x15'),_0x45ae9a,_0x3248f4,_0x1157d1,_0x429783,_0xbe7e);});}exports[_0xe9ef('0x16')]=function(_0x3c94c3,_0x50a8d7){return function(_0x104f82,_0x1f1fad,_0x2caa88){var _0x39ef6c=_0x104f82['user'];var _0x3c47ff={};var _0x5d99c2=_0x104f82['query'];if(_0x3c47ff){_0x3c47ff=_[_0xe9ef('0x17')](_0x104f82[_0xe9ef('0x18')]);_0x3c47ff=_['omit'](_0x3c47ff,[_0xe9ef('0x18'),_0xe9ef('0x19'),_0xe9ef('0x1a'),'fax',_0xe9ef('0x1b')]);}updateUser(_0x39ef6c,_0x3c47ff,_0x5d99c2,_0x3c94c3,_0x50a8d7);_0x2caa88(null);};}; \ No newline at end of file +var _0x8910=['findOne','then','update','info','catch','error','tracked','user','query','omit','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x8910,0x1ef));var _0x0891=function(_0x139e6a,_0x443ab7){_0x139e6a=_0x139e6a-0x0;var _0x19c2ba=_0x8910[_0x139e6a];return _0x19c2ba;};'use strict';var _=require(_0x0891('0x0'));var db=require(_0x0891('0x1'))['db'];var loggers={'openchannel':require(_0x0891('0x2'))(_0x0891('0x3')),'mail':require('../../config/logger')(_0x0891('0x4')),'fax':require(_0x0891('0x2'))(_0x0891('0x5')),'sms':require(_0x0891('0x2'))(_0x0891('0x6')),'chat':require(_0x0891('0x2'))('chat-interactions'),'whatsapp':require(_0x0891('0x2'))('whatsapp-interactions')};function getInteractionId(_0x556beb,_0x46891f,_0x5dc734){if(_0x556beb&&_0x556beb[_[_0x0891('0x7')](_0x5dc734)+_0x0891('0x8')]){return _0x556beb[_[_0x0891('0x7')](_0x5dc734)+_0x0891('0x8')];}else if(_0x556beb&&_0x556beb['id']){return _0x556beb['id'];}else if(_0x46891f&&_0x46891f['id']){return _0x46891f['id'];}else{return _0x0891('0x9');}}function log(_0x14535b,_0x1f1f9d,_0x442477,_0xea4569,_0x436c2e,_0x3ef57a){loggers[_0x436c2e[_0x0891('0xa')]()][_0x14535b](_0x0891('0xb'),_0x3ef57a[_0x0891('0xc')](),_0x1f1f9d?_0x1f1f9d['id']:null,_0x1f1f9d?_0x1f1f9d['name']:null,_0x1f1f9d?_0x1f1f9d[_0x0891('0xd')]:null,getInteractionId(_0x442477,_0xea4569,_0x436c2e),_0x442477?JSON[_0x0891('0xe')](_0x442477):_0x0891('0xf'));}function updateUser(_0x4b338d,_0x555f35,_0x42c97d,_0x79f150,_0x121475){db[_[_0x0891('0x7')](_0x79f150)+_0x0891('0x10')][_0x0891('0x11')]({'where':{'id':getInteractionId(_0x555f35,_0x42c97d,_0x79f150)}})[_0x0891('0x12')](function(_0x45ee09){if(_0x45ee09){return _0x45ee09[_0x0891('0x13')]({'UserId':_0x4b338d?_0x4b338d['id']:null});}})[_0x0891('0x12')](function(_0x5a1a9a){if(_0x5a1a9a){log(_0x0891('0x14'),_0x4b338d,_0x555f35,_0x42c97d,_0x79f150,_0x121475);}})[_0x0891('0x15')](function(){log(_0x0891('0x16'),_0x4b338d,_0x555f35,_0x42c97d,_0x79f150,_0x121475);});}exports[_0x0891('0x17')]=function(_0x20a504,_0x1b3a57){return function(_0x2f52d4,_0x2448df,_0x2e710a){var _0x194df6=_0x2f52d4[_0x0891('0x18')];var _0x24f84e={};var _0x4a6912=_0x2f52d4[_0x0891('0x19')];if(_0x24f84e){_0x24f84e=_['clone'](_0x2f52d4['body']);_0x24f84e=_[_0x0891('0x1a')](_0x24f84e,[_0x0891('0x1b'),_0x0891('0x1c'),_0x0891('0x1d'),_0x0891('0x1e'),_0x0891('0x1f')]);}updateUser(_0x194df6,_0x24f84e,_0x4a6912,_0x20a504,_0x1b3a57);_0x2e710a(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 485b8ec..0518bb1 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 _0xd46b=['user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse','hasOwnProperty','use','License','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin'];(function(_0x369447,_0x1275e9){var _0x55345b=function(_0x4a3db0){while(--_0x4a3db0){_0x369447['push'](_0x369447['shift']());}};_0x55345b(++_0x1275e9);}(_0xd46b,0xb8));var _0xbd46=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0xd46b[_0x4b0830];return _0x1f53a7;};'use strict';var crypto=require(_0xbd46('0x0'));var util=require(_0xbd46('0x1'));var compose=require('composable-middleware');var db=require(_0xbd46('0x2'))['db'];var config=require(_0xbd46('0x3'));function getValueFromLicense(_0x28c498,_0x444b03){if(_0x28c498&&_0x444b03){if(_0x444b03[_0xbd46('0x4')]&&_0x444b03[_0xbd46('0x5')]){var _0x168275=_0x444b03[_0xbd46('0x4')];var _0x12df25=_0x444b03['license'];var _0x282b4=_0x168275[_0xbd46('0x6')]('-')[0x4];var _0x3d9255=_0x168275[_0xbd46('0x6')]('-')[0x0];var _0x5791ef=crypto[_0xbd46('0x7')](_0xbd46('0x8'),util[_0xbd46('0x9')](_0xbd46('0xa'),_0x282b4,_0x168275,_0x3d9255));var _0x26aa11=_0x5791ef['update'](_0x12df25,_0xbd46('0xb'),'utf8');_0x26aa11+=_0x5791ef['final'](_0xbd46('0xc'));var _0x2ee511=JSON[_0xbd46('0xd')](_0x26aa11);return _0x2ee511[_0xbd46('0xe')](_0x28c498)?_0x2ee511[_0x28c498]:null;}}return null;}function isLimit(_0x2ebc0f,_0x3ee018,_0x289493,_0x3fb735){var _0x291475=_0x3ee018;return compose()[_0xbd46('0xf')](function(_0x4b753b,_0x36c535,_0xba635e){return db[_0xbd46('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x59e251){var _0x42603a=getValueFromLicense(_0x2ebc0f,_0x59e251);return _0x42603a?_0x42603a:_0x291475;})[_0xbd46('0x11')](function(_0x48f89e){_0x291475=_0x48f89e;return _0x289493['count'](_0x3fb735);})[_0xbd46('0x11')](function(_0x5a38f3){if(_0x5a38f3>=_0x291475){return _0x36c535['status'](0x193)[_0xbd46('0x12')]({'message':util[_0xbd46('0x9')](_0xbd46('0x13'),_0x2ebc0f)});}_0xba635e();})[_0xbd46('0x14')](function(_0x4518f6){_0xba635e(_0x4518f6);});});}function isUserLimit(){return isLimit(_0xbd46('0x15'),0x1,db[_0xbd46('0x16')],{'where':{'$or':[{'role':_0xbd46('0x17')},{'role':_0xbd46('0x18')}]}});}exports[_0xbd46('0x19')]=isUserLimit; \ No newline at end of file +var _0xb200=['then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','update','base64','utf8','final','parse','use','License','findOne'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xb200,0x1d0));var _0x0b20=function(_0x41aaa5,_0x5d880b){_0x41aaa5=_0x41aaa5-0x0;var _0x35c60f=_0xb200[_0x41aaa5];return _0x35c60f;};'use strict';var crypto=require('crypto');var util=require(_0x0b20('0x0'));var compose=require(_0x0b20('0x1'));var db=require(_0x0b20('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4a4a23,_0x5575b9){if(_0x4a4a23&&_0x5575b9){if(_0x5575b9[_0x0b20('0x3')]&&_0x5575b9['license']){var _0x1560d3=_0x5575b9['data1'];var _0xf5c652=_0x5575b9[_0x0b20('0x4')];var _0x5e9bd6=_0x1560d3[_0x0b20('0x5')]('-')[0x4];var _0x31cca8=_0x1560d3['split']('-')[0x0];var _0x2a40a9=crypto[_0x0b20('0x6')]('aes-256-ctr',util[_0x0b20('0x7')]('%s:%s:%s',_0x5e9bd6,_0x1560d3,_0x31cca8));var _0x5a8363=_0x2a40a9[_0x0b20('0x8')](_0xf5c652,_0x0b20('0x9'),_0x0b20('0xa'));_0x5a8363+=_0x2a40a9[_0x0b20('0xb')](_0x0b20('0xa'));var _0x68e4a3=JSON[_0x0b20('0xc')](_0x5a8363);return _0x68e4a3['hasOwnProperty'](_0x4a4a23)?_0x68e4a3[_0x4a4a23]:null;}}return null;}function isLimit(_0x531327,_0x205047,_0x1ad7b3,_0x39a4c2){var _0x3b485a=_0x205047;return compose()[_0x0b20('0xd')](function(_0x56606f,_0x16e8ce,_0x21af08){return db[_0x0b20('0xe')][_0x0b20('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x0b20('0x10')](function(_0xc5d58){var _0x39490d=getValueFromLicense(_0x531327,_0xc5d58);return _0x39490d?_0x39490d:_0x3b485a;})[_0x0b20('0x10')](function(_0x3a81d2){_0x3b485a=_0x3a81d2;return _0x1ad7b3['count'](_0x39a4c2);})[_0x0b20('0x10')](function(_0x28157c){if(_0x28157c>=_0x3b485a){return _0x16e8ce['status'](0x193)[_0x0b20('0x11')]({'message':util[_0x0b20('0x7')](_0x0b20('0x12'),_0x531327)});}_0x21af08();})['catch'](function(_0x3aeba0){_0x21af08(_0x3aeba0);});});}function isUserLimit(){return isLimit(_0x0b20('0x13'),0x1,db[_0x0b20('0x14')],{'where':{'$or':[{'role':_0x0b20('0x15')},{'role':_0x0b20('0x16')}]}});}exports[_0x0b20('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4ed0f9a..f116369 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 _0x2893=['add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','DATE','minutes','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','forEach','match','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x2893,0x84));var _0x3289=function(_0xc96ce9,_0x39dab2){_0xc96ce9=_0xc96ce9-0x0;var _0x4f8966=_0x2893[_0xc96ce9];return _0x4f8966;};'use strict';var _=require(_0x3289('0x0'));var moment=require(_0x3289('0x1'));exports[_0x3289('0x2')]=function(_0x3ced5b){var _0x2a06e3={'conditions':[]};_0x2a06e3[_0x3289('0x3')]=_['startsWith'](_0x3ced5b,_0x3289('0x4'))?'or':_0x3289('0x5');var _0x1c0004=_0x3ced5b[_0x3289('0x6')](_0x3289('0x7'),'')[_0x3289('0x6')]('[$or]','')[_0x3289('0x8')]('||');for(var _0x32983e=0x0;_0x32983e<_0x1c0004[_0x3289('0x9')];_0x32983e++){var _0x1d7f15=_0x1c0004[_0x32983e][_0x3289('0x8')](':=');var _0x25128c=_0x1d7f15[0x0];var _0x16a9d1=_0x1d7f15['slice'](0x1);_0x16a9d1[_0x3289('0xa')](function(_0x5e84b8){var _0x25aab4=_0x5e84b8[_0x3289('0x8')]('[')['shift']();var _0x338ce5=_0x5e84b8[_0x3289('0xb')](/\[(.*?)\]/g);_0x338ce5['forEach'](function(_0x314711){var _0x18683f=_0x314711[_0x3289('0x8')]('[')['filter'](function(_0x44070f){return _0x44070f[_0x3289('0xc')](']')>-0x1;})[_0x3289('0xd')](function(_0x302c75){return _0x302c75[_0x3289('0x8')](']')[0x0];})[0x0];_0x2a06e3[_0x3289('0xe')][_0x3289('0xf')]({'field':_0x25128c,'operator':_0x25aab4,'value':_0x18683f});});});}return _0x2a06e3;};exports[_0x3289('0x10')]=function(_0x74664f,_0x35847c,_0x5af3f3){var _0x12bcfc={};if(_0x35847c==='DATE'){if(_0x5af3f3[_0x3289('0x11')]===_0x3289('0x12')){_0x5af3f3[_0x3289('0x11')]=_0x3289('0x13');_0x5af3f3[_0x3289('0x14')]+=','+_0x5af3f3[_0x3289('0x14')];}else if(_[_0x3289('0x15')]([_0x3289('0x16'),_0x3289('0x17')],_0x5af3f3[_0x3289('0x11')])){_0x5af3f3[_0x3289('0x14')]=moment(_0x5af3f3[_0x3289('0x14')])[_0x3289('0x18')](0x1,_0x3289('0x19'))[_0x3289('0x1a')](_0x3289('0x1b'));}}if(_0x5af3f3[_0x3289('0x1c')]){_0x35847c=_0x5af3f3[_0x3289('0x1c')];_0x12bcfc[_0x3289('0x1d')]='CAST('+_0x74664f+'.'+_0x5af3f3[_0x3289('0x1e')]+_0x3289('0x1f')+_0x5af3f3[_0x3289('0x1c')]+')\x20'+parseOperator(_0x5af3f3['operator']);}else{_0x12bcfc[_0x3289('0x1d')]=_0x74664f+'.'+_0x5af3f3[_0x3289('0x1e')]+'\x20'+parseOperator(_0x5af3f3[_0x3289('0x11')]);}if(_[_0x3289('0x15')]([_0x3289('0x20'),_0x3289('0x21')],_0x5af3f3['operator']))_0x12bcfc[_0x3289('0x1d')]='('+_0x12bcfc[_0x3289('0x1d')]+'\x20OR\x20'+_0x74664f+'.'+_0x5af3f3[_0x3289('0x1e')]+_0x3289('0x22');_0x12bcfc[_0x3289('0x14')]=parseValue(_0x35847c,_0x5af3f3[_0x3289('0x11')],_0x5af3f3[_0x3289('0x14')]);return _0x12bcfc;};function parseOperator(_0x475f05){var _0x11ad2e;switch(_0x475f05){case _0x3289('0x23'):_0x11ad2e='IN\x20?';break;case'$notIn':_0x11ad2e=_0x3289('0x24');break;case _0x3289('0x12'):_0x11ad2e=_0x3289('0x25');break;case _0x3289('0x20'):_0x11ad2e=_0x3289('0x26');break;case _0x3289('0x27'):case _0x3289('0x28'):case'$endsWith':_0x11ad2e='LIKE\x20?';break;case _0x3289('0x29'):_0x11ad2e=_0x3289('0x2a');break;case'$gt':_0x11ad2e=_0x3289('0x2b');break;case _0x3289('0x17'):_0x11ad2e=_0x3289('0x2c');break;case'$gte':_0x11ad2e=_0x3289('0x2d');break;case'$between':_0x11ad2e=_0x3289('0x2e');break;}return _0x11ad2e;}function parseValue(_0x16b43d,_0x48c85,_0x31b2d1){var _0x52d66d={'start':undefined,'end':undefined};switch(_0x48c85){case'$in':case _0x3289('0x21'):_0x52d66d['start']=_0x31b2d1[_0x3289('0x8')](',');break;case _0x3289('0x27'):_0x52d66d['start']='%'+_0x31b2d1+'%';break;case _0x3289('0x28'):_0x52d66d[_0x3289('0x2f')]=_0x31b2d1+'%';break;case'$endsWith':_0x52d66d[_0x3289('0x2f')]='%'+_0x31b2d1;break;case _0x3289('0x13'):var _0x1a4d47=_0x31b2d1[_0x3289('0x8')](',');var _0x31b2d1=_0x1a4d47[_0x3289('0x30')]();var _0x230dcd=_0x1a4d47[_0x3289('0x31')]();if(_0x16b43d===_0x3289('0x32')){_0x31b2d1=moment(_0x31b2d1)['utcOffset'](0x0,!![])[_0x3289('0x1a')]();_0x230dcd=moment(_0x230dcd)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0x3289('0x18')](0x3b,_0x3289('0x33'))[_0x3289('0x18')](0x3b,'seconds')[_0x3289('0x1a')]();}_0x52d66d={'start':_0x31b2d1,'end':_0x230dcd};break;default:_0x52d66d[_0x3289('0x2f')]=_0x31b2d1;break;}return _0x52d66d;} \ No newline at end of file +var _0x5e91=['forEach','split','shift','match','filter','map','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','days','format','CAST(','field','\x20AS\x20','text','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','pop','utcOffset','add','hours','minutes','lodash','parseSearch','startsWith','[$or]','and','[$and]','replace','length','slice'];(function(_0x473069,_0x4c390c){var _0x312b0b=function(_0x12ef49){while(--_0x12ef49){_0x473069['push'](_0x473069['shift']());}};_0x312b0b(++_0x4c390c);}(_0x5e91,0x10a));var _0x15e9=function(_0x4a5cce,_0x34265f){_0x4a5cce=_0x4a5cce-0x0;var _0x347252=_0x5e91[_0x4a5cce];return _0x347252;};'use strict';var _=require(_0x15e9('0x0'));var moment=require('moment');exports[_0x15e9('0x1')]=function(_0x223d82){var _0x3b9ab7={'conditions':[]};_0x3b9ab7['sqlOperator']=_[_0x15e9('0x2')](_0x223d82,_0x15e9('0x3'))?'or':_0x15e9('0x4');var _0x5a05b3=_0x223d82['replace'](_0x15e9('0x5'),'')[_0x15e9('0x6')](_0x15e9('0x3'),'')['split']('||');for(var _0x52665=0x0;_0x52665<_0x5a05b3[_0x15e9('0x7')];_0x52665++){var _0x3b9013=_0x5a05b3[_0x52665]['split'](':=');var _0x167fbe=_0x3b9013[0x0];var _0x3290d4=_0x3b9013[_0x15e9('0x8')](0x1);_0x3290d4[_0x15e9('0x9')](function(_0x38c5ba){var _0x2b3787=_0x38c5ba[_0x15e9('0xa')]('[')[_0x15e9('0xb')]();var _0x555986=_0x38c5ba[_0x15e9('0xc')](/\[(.*?)\]/g);_0x555986[_0x15e9('0x9')](function(_0x30fca1){var _0x2f266f=_0x30fca1['split']('[')[_0x15e9('0xd')](function(_0x2b5f59){return _0x2b5f59['indexOf'](']')>-0x1;})[_0x15e9('0xe')](function(_0x2a808a){return _0x2a808a[_0x15e9('0xa')](']')[0x0];})[0x0];_0x3b9ab7['conditions'][_0x15e9('0xf')]({'field':_0x167fbe,'operator':_0x2b3787,'value':_0x2f266f});});});}return _0x3b9ab7;};exports[_0x15e9('0x10')]=function(_0x144196,_0x3fe9ff,_0x47416a){var _0x3c50e8={};if(_0x3fe9ff===_0x15e9('0x11')){if(_0x47416a[_0x15e9('0x12')]===_0x15e9('0x13')){_0x47416a[_0x15e9('0x12')]=_0x15e9('0x14');_0x47416a['value']+=','+_0x47416a[_0x15e9('0x15')];}else if(_['includes']([_0x15e9('0x16'),_0x15e9('0x17')],_0x47416a[_0x15e9('0x12')])){_0x47416a[_0x15e9('0x15')]=moment(_0x47416a['value'])['add'](0x1,_0x15e9('0x18'))[_0x15e9('0x19')]('YYYY-MM-DD');}}if(_0x47416a['castTo']){_0x3fe9ff=_0x47416a['castTo'];_0x3c50e8['text']=_0x15e9('0x1a')+_0x144196+'.'+_0x47416a[_0x15e9('0x1b')]+_0x15e9('0x1c')+_0x47416a['castTo']+')\x20'+parseOperator(_0x47416a[_0x15e9('0x12')]);}else{_0x3c50e8[_0x15e9('0x1d')]=_0x144196+'.'+_0x47416a['field']+'\x20'+parseOperator(_0x47416a[_0x15e9('0x12')]);}if(_[_0x15e9('0x1e')]([_0x15e9('0x1f'),_0x15e9('0x20')],_0x47416a[_0x15e9('0x12')]))_0x3c50e8['text']='('+_0x3c50e8[_0x15e9('0x1d')]+_0x15e9('0x21')+_0x144196+'.'+_0x47416a['field']+_0x15e9('0x22');_0x3c50e8[_0x15e9('0x15')]=parseValue(_0x3fe9ff,_0x47416a[_0x15e9('0x12')],_0x47416a[_0x15e9('0x15')]);return _0x3c50e8;};function parseOperator(_0x33e35d){var _0x2bd8c6;switch(_0x33e35d){case _0x15e9('0x23'):_0x2bd8c6='IN\x20?';break;case _0x15e9('0x20'):_0x2bd8c6=_0x15e9('0x24');break;case _0x15e9('0x13'):_0x2bd8c6=_0x15e9('0x25');break;case _0x15e9('0x1f'):_0x2bd8c6=_0x15e9('0x26');break;case _0x15e9('0x27'):case _0x15e9('0x28'):case _0x15e9('0x29'):_0x2bd8c6=_0x15e9('0x2a');break;case _0x15e9('0x2b'):_0x2bd8c6=_0x15e9('0x2c');break;case'$gt':_0x2bd8c6=_0x15e9('0x2d');break;case _0x15e9('0x17'):_0x2bd8c6=_0x15e9('0x2e');break;case _0x15e9('0x2f'):_0x2bd8c6=_0x15e9('0x30');break;case _0x15e9('0x14'):_0x2bd8c6=_0x15e9('0x31');break;}return _0x2bd8c6;}function parseValue(_0x46da56,_0x4c2292,_0x382aa4){var _0x499a3b={'start':undefined,'end':undefined};switch(_0x4c2292){case _0x15e9('0x23'):case'$notIn':_0x499a3b['start']=_0x382aa4[_0x15e9('0xa')](',');break;case _0x15e9('0x27'):_0x499a3b['start']='%'+_0x382aa4+'%';break;case _0x15e9('0x28'):_0x499a3b['start']=_0x382aa4+'%';break;case'$endsWith':_0x499a3b['start']='%'+_0x382aa4;break;case _0x15e9('0x14'):var _0x1c1ece=_0x382aa4['split'](',');var _0x382aa4=_0x1c1ece[_0x15e9('0xb')]();var _0x205b34=_0x1c1ece[_0x15e9('0x32')]();if(_0x46da56===_0x15e9('0x11')){_0x382aa4=moment(_0x382aa4)[_0x15e9('0x33')](0x0,!![])[_0x15e9('0x19')]();_0x205b34=moment(_0x205b34)[_0x15e9('0x33')](0x0,!![])[_0x15e9('0x34')](0x17,_0x15e9('0x35'))[_0x15e9('0x34')](0x3b,_0x15e9('0x36'))[_0x15e9('0x34')](0x3b,'seconds')[_0x15e9('0x19')]();}_0x499a3b={'start':_0x382aa4,'end':_0x205b34};break;default:_0x499a3b['start']=_0x382aa4;break;}return _0x499a3b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index f6aca64..b95ad16 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 _0x43ba=['push','join','lodash','sequelize','moment','split','filters','isEmpty','forOwn','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','isArray','limit','offset','priority','col','unsigned','cast','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace'];(function(_0x24dce9,_0x392609){var _0x3c7dcd=function(_0xcbeeff){while(--_0xcbeeff){_0x24dce9['push'](_0x24dce9['shift']());}};_0x3c7dcd(++_0x392609);}(_0x43ba,0xb6));var _0xa43b=function(_0x558619,_0xe8aa7c){_0x558619=_0x558619-0x0;var _0x3b11fe=_0x43ba[_0x558619];return _0x3b11fe;};'use strict';var _=require(_0xa43b('0x0'));var sequelize=require(_0xa43b('0x1'));var moment=require(_0xa43b('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0xcb9d7){var _0x565b38=null;if(_0xcb9d7){_0x565b38=_0xcb9d7[_0xa43b('0x3')](',');}return _0x565b38;};exports[_0xa43b('0x4')]=function(_0x4ea607,_0x38bd89){var _0x1138db={};if(!_[_0xa43b('0x5')](_0x4ea607)){_[_0xa43b('0x6')](_0x4ea607,function(_0x83e042,_0x1eba36){try{if(_0x38bd89){var _0x14409c=_['find'](_0x38bd89,{'name':_0x1eba36})||{};if(_0x14409c[_0xa43b('0x7')]==='DATE'&&_[_0xa43b('0x8')](_0x83e042)){var _0x16e61e=JSON[_0xa43b('0x9')](_0x83e042);var _0xafcd59={'$gte':moment(moment(_0x16e61e[_0xa43b('0xa')])[_0xa43b('0xb')](_0xa43b('0xc')))[_0xa43b('0xd')]()[_0xa43b('0xb')](),'$lte':moment(moment(_0x16e61e['$lte'])['format'](_0xa43b('0xc')))[_0xa43b('0xd')]()['subtract'](0x1,'s')[_0xa43b('0xb')]()};_0x1138db[_0x1eba36]=_0xafcd59;}else{_0x1138db[_0x1eba36]=_[_0xa43b('0xe')](_0x83e042)?_0x83e042:JSON['parse'](_0x83e042);}}else{_0x1138db[_0x1eba36]=_[_0xa43b('0xe')](_0x83e042)?_0x83e042:JSON[_0xa43b('0x9')](_0x83e042);}}catch(_0x1b1cdb){_0x1138db[_0x1eba36]=_0x83e042[_0xa43b('0x3')](',');}});}return _0x1138db;};exports[_0xa43b('0xf')]=function(_0x3949a6){_0x3949a6=parseInt(_0x3949a6,0xa);if(!_0x3949a6||_0x3949a6<0x0){_0x3949a6=LIMIT_VALUE;}return _0x3949a6;};exports[_0xa43b('0x10')]=function(_0x478e15){_0x478e15=parseInt(_0x478e15,0xa);if(!_0x478e15||_0x478e15<0x0){_0x478e15=0x0;}return _0x478e15;};exports['sort']=function(_0x2ed9f1){var _0x52b274,_0x459881=null;if(_0x2ed9f1){_0x52b274=_0x2ed9f1[_0xa43b('0x3')](',');_0x459881=_['map'](_0x52b274,function(_0x4e9def){if(_0x4e9def['indexOf']('-')===0x0){return[_0x4e9def===_0xa43b('0x11')?sequelize['cast'](sequelize[_0xa43b('0x12')](_0xa43b('0x11')),_0xa43b('0x13')):_0x4e9def['substr'](0x1),'DESC'];}else{return[_0x4e9def===_0xa43b('0x11')?sequelize[_0xa43b('0x14')](sequelize[_0xa43b('0x12')](_0xa43b('0x11')),_0xa43b('0x13')):_0x4e9def,_0xa43b('0x15')];}});}return _0x459881;};exports['omit']=function(_0x6e10e9,_0x2fd051){if(_[_0xa43b('0x5')](_0x6e10e9)){return _0x6e10e9;}if(_[_0xa43b('0xe')](_0x6e10e9)){for(var _0x1ef1f9=0x0;_0x1ef1f9<_0x6e10e9['length'];_0x1ef1f9+=0x1){_0x6e10e9[_0x1ef1f9]=this[_0xa43b('0x16')](_0x6e10e9[_0x1ef1f9],_0x2fd051);}return _0x6e10e9;}if(!_[_0xa43b('0x17')](_0x6e10e9)){return _0x6e10e9;}if(_[_0xa43b('0x18')](_0x2fd051)){_0x2fd051=[_0x2fd051];}if(!_[_0xa43b('0xe')](_0x2fd051)){return _0x6e10e9;}for(var _0x41f911=0x0;_0x41f911<_0x2fd051[_0xa43b('0x19')];_0x41f911+=0x1){_[_0xa43b('0x1a')](_0x6e10e9,_0x2fd051[_0x41f911]);}for(var _0x175c9d in _0x6e10e9){if(_0x6e10e9[_0xa43b('0x1b')](_0x175c9d)){_0x6e10e9[_0x175c9d]=this[_0xa43b('0x16')](_0x6e10e9[_0x175c9d],_0x2fd051);}}return _0x6e10e9;};exports[_0xa43b('0x1c')]=function(_0x4dfc6a){return _0x4dfc6a[_0xa43b('0x1d')](RegExp(_0xa43b('0x1e')))?!![]:![];};exports[_0xa43b('0x1f')]=function(_0xd62e80){return _0xd62e80['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3a6244){var _0x253f82=[];_0x3a6244[_0xa43b('0x3')](/[ ,]+/)[_0xa43b('0x20')](function(_0x5e21ba){_0x5e21ba=_0x5e21ba[_0xa43b('0x21')](/([^:]")"+/g,'$1');_0x5e21ba='+'+_0x5e21ba+'*';if(_0x5e21ba['includes']('@'))_0x5e21ba='\x22'+_0x5e21ba+'\x22';_0x253f82[_0xa43b('0x22')](_0x5e21ba);});return _0x253f82[_0xa43b('0x23')]('\x20');}; \ No newline at end of file +var _0xe7a2=['map','priority','cast','col','unsigned','substr','ASC','omit','isObject','isString','length','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','lodash','sequelize','fields','isEmpty','forOwn','find','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','isArray','split','limit','offset','sort'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe7a2,0x17d));var _0x2e7a=function(_0x3cbc00,_0x563224){_0x3cbc00=_0x3cbc00-0x0;var _0x45dfd1=_0xe7a2[_0x3cbc00];return _0x45dfd1;};'use strict';var _=require(_0x2e7a('0x0'));var sequelize=require(_0x2e7a('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x2e7a('0x2')]=function(_0x193d44){var _0x3eaa83=null;if(_0x193d44){_0x3eaa83=_0x193d44['split'](',');}return _0x3eaa83;};exports['filters']=function(_0x31f62c,_0x703529){var _0x3353c2={};if(!_[_0x2e7a('0x3')](_0x31f62c)){_[_0x2e7a('0x4')](_0x31f62c,function(_0x3ed2a8,_0x3785a8){try{if(_0x703529){var _0x2c7856=_[_0x2e7a('0x5')](_0x703529,{'name':_0x3785a8})||{};if(_0x2c7856['type']===_0x2e7a('0x6')&&_[_0x2e7a('0x7')](_0x3ed2a8)){var _0x4680e5=JSON[_0x2e7a('0x8')](_0x3ed2a8);var _0x2653ed={'$gte':moment(moment(_0x4680e5[_0x2e7a('0x9')])[_0x2e7a('0xa')](_0x2e7a('0xb')))[_0x2e7a('0xc')]()[_0x2e7a('0xa')](),'$lte':moment(moment(_0x4680e5[_0x2e7a('0xd')])[_0x2e7a('0xa')](_0x2e7a('0xb')))[_0x2e7a('0xc')]()['subtract'](0x1,'s')['format']()};_0x3353c2[_0x3785a8]=_0x2653ed;}else{_0x3353c2[_0x3785a8]=_[_0x2e7a('0xe')](_0x3ed2a8)?_0x3ed2a8:JSON[_0x2e7a('0x8')](_0x3ed2a8);}}else{_0x3353c2[_0x3785a8]=_['isArray'](_0x3ed2a8)?_0x3ed2a8:JSON[_0x2e7a('0x8')](_0x3ed2a8);}}catch(_0x134b23){_0x3353c2[_0x3785a8]=_0x3ed2a8[_0x2e7a('0xf')](',');}});}return _0x3353c2;};exports[_0x2e7a('0x10')]=function(_0x588713){_0x588713=parseInt(_0x588713,0xa);if(!_0x588713||_0x588713<0x0){_0x588713=LIMIT_VALUE;}return _0x588713;};exports[_0x2e7a('0x11')]=function(_0x3422a7){_0x3422a7=parseInt(_0x3422a7,0xa);if(!_0x3422a7||_0x3422a7<0x0){_0x3422a7=0x0;}return _0x3422a7;};exports[_0x2e7a('0x12')]=function(_0x525099){var _0xe61b86,_0x347a33=null;if(_0x525099){_0xe61b86=_0x525099['split'](',');_0x347a33=_[_0x2e7a('0x13')](_0xe61b86,function(_0x243c59){if(_0x243c59['indexOf']('-')===0x0){return[_0x243c59===_0x2e7a('0x14')?sequelize[_0x2e7a('0x15')](sequelize[_0x2e7a('0x16')](_0x2e7a('0x14')),_0x2e7a('0x17')):_0x243c59[_0x2e7a('0x18')](0x1),'DESC'];}else{return[_0x243c59==='priority'?sequelize[_0x2e7a('0x15')](sequelize[_0x2e7a('0x16')](_0x2e7a('0x14')),_0x2e7a('0x17')):_0x243c59,_0x2e7a('0x19')];}});}return _0x347a33;};exports[_0x2e7a('0x1a')]=function(_0xa857f,_0x58dcc0){if(_[_0x2e7a('0x3')](_0xa857f)){return _0xa857f;}if(_['isArray'](_0xa857f)){for(var _0x18750d=0x0;_0x18750d<_0xa857f['length'];_0x18750d+=0x1){_0xa857f[_0x18750d]=this['omit'](_0xa857f[_0x18750d],_0x58dcc0);}return _0xa857f;}if(!_[_0x2e7a('0x1b')](_0xa857f)){return _0xa857f;}if(_[_0x2e7a('0x1c')](_0x58dcc0)){_0x58dcc0=[_0x58dcc0];}if(!_[_0x2e7a('0xe')](_0x58dcc0)){return _0xa857f;}for(var _0x5a6fbb=0x0;_0x5a6fbb<_0x58dcc0[_0x2e7a('0x1d')];_0x5a6fbb+=0x1){_[_0x2e7a('0x1e')](_0xa857f,_0x58dcc0[_0x5a6fbb]);}for(var _0x58b142 in _0xa857f){if(_0xa857f['hasOwnProperty'](_0x58b142)){_0xa857f[_0x58b142]=this['omit'](_0xa857f[_0x58b142],_0x58dcc0);}}return _0xa857f;};exports[_0x2e7a('0x1f')]=function(_0x19913b){return _0x19913b[_0x2e7a('0x20')](RegExp(_0x2e7a('0x21')))?!![]:![];};exports[_0x2e7a('0x22')]=function(_0x3134ed){return _0x3134ed[_0x2e7a('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x2e7a('0x23')]=function(_0x8c8bb2){var _0x4bd318=[];_0x8c8bb2[_0x2e7a('0xf')](/[ ,]+/)[_0x2e7a('0x24')](function(_0x3d7504){_0x3d7504=_0x3d7504['replace'](/([^:]")"+/g,'$1');_0x3d7504='+'+_0x3d7504+'*';if(_0x3d7504[_0x2e7a('0x25')]('@'))_0x3d7504='\x22'+_0x3d7504+'\x22';_0x4bd318[_0x2e7a('0x26')](_0x3d7504);});return _0x4bd318[_0x2e7a('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 07b2435..3fcde3b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9ae=['moment','./environment','../mysqldb','get','env','production','set','appPath','root','development','test','join','client','use','json\x20replacer','toISOString','split','static','views','/server/views','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport'];(function(_0x334ed4,_0x5dab35){var _0x4bca61=function(_0x353710){while(--_0x353710){_0x334ed4['push'](_0x334ed4['shift']());}};_0x4bca61(++_0x5dab35);}(_0xa9ae,0x88));var _0xea9a=function(_0x599063,_0x4d8fc5){_0x599063=_0x599063-0x0;var _0x5b401a=_0xa9ae[_0x599063];return _0x5b401a;};'use strict';var express=require(_0xea9a('0x0'));var favicon=require(_0xea9a('0x1'));var bodyParser=require(_0xea9a('0x2'));var methodOverride=require(_0xea9a('0x3'));var cookieParser=require(_0xea9a('0x4'));var errorHandler=require(_0xea9a('0x5'));var path=require(_0xea9a('0x6'));var passport=require(_0xea9a('0x7'));var cors=require('cors');var moment=require(_0xea9a('0x8'));var config=require(_0xea9a('0x9'));var db=require(_0xea9a('0xa'))['db'];exports['default']=function(_0x1a0758){var _0x42e0bb=_0x1a0758[_0xea9a('0xb')](_0xea9a('0xc'));if(_0x42e0bb===_0xea9a('0xd')){_0x1a0758[_0xea9a('0xe')](_0xea9a('0xf'),path['join'](config[_0xea9a('0x10')],'public'));}if(_0x42e0bb===_0xea9a('0x11')||_0x42e0bb===_0xea9a('0x12')){_0x1a0758[_0xea9a('0xe')](_0xea9a('0xf'),path[_0xea9a('0x13')](config[_0xea9a('0x10')],_0xea9a('0x14')));_0x1a0758[_0xea9a('0x15')](errorHandler());}_0x1a0758['set'](_0xea9a('0x16'),function(_0x42b54e,_0x13c5d3){if(this[_0x42b54e]instanceof Date){_0x13c5d3=this[_0x42b54e][_0xea9a('0x17')]()[_0xea9a('0x18')]('.')[0x0]+'Z';}return _0x13c5d3;});_0x1a0758['use'](express[_0xea9a('0x19')](_0x1a0758[_0xea9a('0xb')]('appPath')));_0x1a0758[_0xea9a('0xe')](_0xea9a('0x1a'),config['root']+_0xea9a('0x1b'));_0x1a0758['engine']('html',require(_0xea9a('0x1c'))[_0xea9a('0x1d')]);_0x1a0758[_0xea9a('0xe')](_0xea9a('0x1e'),_0xea9a('0x1f'));_0x1a0758[_0xea9a('0x15')](bodyParser[_0xea9a('0x20')]({'limit':_0xea9a('0x21'),'extended':!![]}));_0x1a0758[_0xea9a('0x15')](bodyParser[_0xea9a('0x22')]({'limit':_0xea9a('0x21')}));_0x1a0758[_0xea9a('0x15')](cors());_0x1a0758[_0xea9a('0x15')](methodOverride());_0x1a0758['use'](cookieParser());_0x1a0758[_0xea9a('0x15')](passport[_0xea9a('0x23')]());}; \ No newline at end of file +var _0x18a7=['passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','test','client','use','json\x20replacer','split','static','views','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','initialize','express','body-parser','method-override','errorhandler'];(function(_0x503325,_0x24a407){var _0x452fff=function(_0x42bf26){while(--_0x42bf26){_0x503325['push'](_0x503325['shift']());}};_0x452fff(++_0x24a407);}(_0x18a7,0x104));var _0x718a=function(_0x238b98,_0x2c10e7){_0x238b98=_0x238b98-0x0;var _0x2bab15=_0x18a7[_0x238b98];return _0x2bab15;};'use strict';var express=require(_0x718a('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x718a('0x1'));var methodOverride=require(_0x718a('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x718a('0x3'));var path=require('path');var passport=require(_0x718a('0x4'));var cors=require(_0x718a('0x5'));var moment=require(_0x718a('0x6'));var config=require(_0x718a('0x7'));var db=require(_0x718a('0x8'))['db'];exports[_0x718a('0x9')]=function(_0x121f11){var _0x2d16a3=_0x121f11[_0x718a('0xa')](_0x718a('0xb'));if(_0x2d16a3===_0x718a('0xc')){_0x121f11[_0x718a('0xd')](_0x718a('0xe'),path[_0x718a('0xf')](config[_0x718a('0x10')],_0x718a('0x11')));}if(_0x2d16a3==='development'||_0x2d16a3===_0x718a('0x12')){_0x121f11['set'](_0x718a('0xe'),path[_0x718a('0xf')](config[_0x718a('0x10')],_0x718a('0x13')));_0x121f11[_0x718a('0x14')](errorHandler());}_0x121f11[_0x718a('0xd')](_0x718a('0x15'),function(_0x113dd4,_0x27a4e9){if(this[_0x113dd4]instanceof Date){_0x27a4e9=this[_0x113dd4]['toISOString']()[_0x718a('0x16')]('.')[0x0]+'Z';}return _0x27a4e9;});_0x121f11[_0x718a('0x14')](express[_0x718a('0x17')](_0x121f11[_0x718a('0xa')](_0x718a('0xe'))));_0x121f11[_0x718a('0xd')](_0x718a('0x18'),config[_0x718a('0x10')]+'/server/views');_0x121f11['engine'](_0x718a('0x19'),require(_0x718a('0x1a'))[_0x718a('0x1b')]);_0x121f11[_0x718a('0xd')](_0x718a('0x1c'),_0x718a('0x19'));_0x121f11[_0x718a('0x14')](bodyParser[_0x718a('0x1d')]({'limit':'50mb','extended':!![]}));_0x121f11[_0x718a('0x14')](bodyParser[_0x718a('0x1e')]({'limit':_0x718a('0x1f')}));_0x121f11['use'](cors());_0x121f11[_0x718a('0x14')](methodOverride());_0x121f11[_0x718a('0x14')](cookieParser());_0x121f11[_0x718a('0x14')](passport[_0x718a('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e1060f2..5c03682 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 _0xdcc4=['orderBy','keys','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','map','join','createHash','md5','update','digest','hex','getUuid','platform','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces'];(function(_0x1081c9,_0x4b25ea){var _0x1837ce=function(_0x489e92){while(--_0x489e92){_0x1081c9['push'](_0x1081c9['shift']());}};_0x1837ce(++_0x4b25ea);}(_0xdcc4,0xea));var _0x4dcc=function(_0x23c2b0,_0x3c1277){_0x23c2b0=_0x23c2b0-0x0;var _0x55a076=_0xdcc4[_0x23c2b0];return _0x55a076;};'use strict';var _=require(_0x4dcc('0x0'));var os=require('os');var crypto=require(_0x4dcc('0x1'));var machine=require(_0x4dcc('0x2'));var exec=require(_0x4dcc('0x3'))[_0x4dcc('0x4')];function getInterfaces(){var _0x4b6388=[];var _0x128a7b=os[_0x4dcc('0x5')]();var _0x416d97=_[_0x4dcc('0x6')](_[_0x4dcc('0x7')](_0x128a7b));for(var _0x2c3176=0x0;_0x2c3176<_0x416d97['length'];_0x2c3176++){var _0x1f8ef7=_0x128a7b[_0x416d97[_0x2c3176]]['filter'](function(_0x3392ef){return _0x3392ef[_0x4dcc('0x8')]===_0x4dcc('0x9')&&_0x3392ef[_0x4dcc('0xa')]===![];});_0x4b6388=_0x4b6388['concat'](_0x1f8ef7);}return _0x4b6388;}function getFirstInterface(){var _0x202efb=_[_0x4dcc('0xb')](getInterfaces());return{'macAddress':_0x202efb&&_0x202efb[_0x4dcc('0xc')]?_0x202efb[_0x4dcc('0xc')]:_0x4dcc('0xd'),'ipAddress':_0x202efb&&_0x202efb[_0x4dcc('0xe')]?_0x202efb[_0x4dcc('0xe')]:_0x4dcc('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x88bfd8=_[_0x4dcc('0x6')](os['cpus']()[_0x4dcc('0x10')](function(_0x20013a){return _0x20013a['model'];}))[_0x4dcc('0x11')](':');return crypto[_0x4dcc('0x12')](_0x4dcc('0x13'))[_0x4dcc('0x14')](_0x88bfd8)[_0x4dcc('0x15')](_0x4dcc('0x16'));}exports[_0x4dcc('0x17')]=function(){switch(os[_0x4dcc('0x18')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4dcc('0x19')})[_0x4dcc('0x1a')]('\x0d\x0a','');default:var _0xde3a5f=getFirstInterface();var _0x2f41d1=getCPUhash();var _0x445496=_0x2f41d1+'|'+os['hostname']()+'|'+_0xde3a5f[_0x4dcc('0x1b')]+'|'+_0xde3a5f[_0x4dcc('0x1c')];var _0x5bf52e=crypto['createHash']('md5')[_0x4dcc('0x14')](_0x445496)[_0x4dcc('0x15')]('hex');return _0x5bf52e[_0x4dcc('0x1d')](0x0,0x8)+'-'+_0x5bf52e[_0x4dcc('0x1d')](0x8,0xc)+'-'+_0x5bf52e[_0x4dcc('0x1d')](0xc,0x10)+'-'+_0x5bf52e['substring'](0x10,0x14)+'-'+_0x5bf52e[_0x4dcc('0x1d')](0x14);}}; \ No newline at end of file +var _0x34aa=['replace','macAddress','ipAddress','createHash','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','join','md5','update','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x54e518,_0x3c6439){var _0x648607=function(_0x5baa0b){while(--_0x5baa0b){_0x54e518['push'](_0x54e518['shift']());}};_0x648607(++_0x3c6439);}(_0x34aa,0x171));var _0xa34a=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x34aa[_0x44d9ab];return _0x31485e;};'use strict';var _=require(_0xa34a('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xa34a('0x1'));var exec=require(_0xa34a('0x2'))[_0xa34a('0x3')];function getInterfaces(){var _0x1fc924=[];var _0x496e55=os[_0xa34a('0x4')]();var _0x30f3a2=_[_0xa34a('0x5')](_[_0xa34a('0x6')](_0x496e55));for(var _0x49f29e=0x0;_0x49f29e<_0x30f3a2[_0xa34a('0x7')];_0x49f29e++){var _0x27349c=_0x496e55[_0x30f3a2[_0x49f29e]][_0xa34a('0x8')](function(_0x1a03fd){return _0x1a03fd[_0xa34a('0x9')]===_0xa34a('0xa')&&_0x1a03fd['internal']===![];});_0x1fc924=_0x1fc924[_0xa34a('0xb')](_0x27349c);}return _0x1fc924;}function getFirstInterface(){var _0x2fc902=_[_0xa34a('0xc')](getInterfaces());return{'macAddress':_0x2fc902&&_0x2fc902[_0xa34a('0xd')]?_0x2fc902[_0xa34a('0xd')]:'00:00:00:00:00:00','ipAddress':_0x2fc902&&_0x2fc902[_0xa34a('0xe')]?_0x2fc902[_0xa34a('0xe')]:_0xa34a('0xf')};}exports[_0xa34a('0x10')]=getFirstInterface;function getCPUhash(){var _0x31e98f=_[_0xa34a('0x5')](os[_0xa34a('0x11')]()['map'](function(_0x3145e9){return _0x3145e9[_0xa34a('0x12')];}))[_0xa34a('0x13')](':');return crypto['createHash'](_0xa34a('0x14'))[_0xa34a('0x15')](_0x31e98f)['digest'](_0xa34a('0x16'));}exports[_0xa34a('0x17')]=function(){switch(os['platform']()){case _0xa34a('0x18'):return exec(_0xa34a('0x19'),{'encoding':_0xa34a('0x1a')})[_0xa34a('0x1b')]('\x0d\x0a','');default:var _0x41b9bb=getFirstInterface();var _0x5da451=getCPUhash();var _0x40ae0c=_0x5da451+'|'+os['hostname']()+'|'+_0x41b9bb[_0xa34a('0x1c')]+'|'+_0x41b9bb[_0xa34a('0x1d')];var _0x3a05ca=crypto[_0xa34a('0x1e')]('md5')[_0xa34a('0x15')](_0x40ae0c)[_0xa34a('0x1f')](_0xa34a('0x16'));return _0x3a05ca[_0xa34a('0x20')](0x0,0x8)+'-'+_0x3a05ca[_0xa34a('0x20')](0x8,0xc)+'-'+_0x3a05ca['substring'](0xc,0x10)+'-'+_0x3a05ca[_0xa34a('0x20')](0x10,0x14)+'-'+_0x3a05ca[_0xa34a('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 62e5b4a..112b6f8 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 _0xf4a0=['%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','||FIELD||VALUE||\x0a','findOne','admin','email','|name|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','fullname','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','bluebird','version','../../components/encryptor','./hardware','../logger','license','process','https://www.xcallymotion.com','format'];(function(_0x1292e1,_0x360b33){var _0xbb1e0e=function(_0x17a415){while(--_0x17a415){_0x1292e1['push'](_0x1292e1['shift']());}};_0xbb1e0e(++_0x360b33);}(_0xf4a0,0x14b));var _0x0f4a=function(_0x42cedd,_0x18fb2f){_0x42cedd=_0x42cedd-0x0;var _0x2d25ea=_0xf4a0[_0x42cedd];return _0x2d25ea;};'use strict';var util=require(_0x0f4a('0x0'));var moment=require(_0x0f4a('0x1'));var rp=require('request-promise');var BPromise=require(_0x0f4a('0x2'));var pkginfo=require('pkginfo')(module,_0x0f4a('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x0f4a('0x4'));var hardware=require(_0x0f4a('0x5'));var logger=require(_0x0f4a('0x6'))(_0x0f4a('0x7'));var jira=require('../../api/jira/jira.controller');const {config}=require(_0x0f4a('0x8'));var HOST=_0x0f4a('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2fe531){return new BPromise(function(_0x502f22,_0x6d4afc){var _0x728628=util[_0x0f4a('0xa')](_0x0f4a('0xb'),HOST,_0x2fe531,module[_0x0f4a('0xc')][_0x0f4a('0x3')]);if(oldToken){_0x728628=util[_0x0f4a('0xa')](_0x0f4a('0xd'),HOST,_0x2fe531,module[_0x0f4a('0xc')][_0x0f4a('0x3')],oldToken);}var _0x365ae6={'uri':_0x728628,'method':_0x0f4a('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x365ae6)[_0x0f4a('0xf')](function(_0x5289ae){_0x502f22(_0x5289ae);})['catch'](function(_0x551c97){_0x6d4afc(_0x551c97);});});}function sendJiraAlert(_0x50b519,_0xa980f3,_0x5253ff){var _0x27fbe6=_0x0f4a('0x10');return db['User'][_0x0f4a('0x11')]({'where':{'role':_0x0f4a('0x12')},'attributes':['fullname',_0x0f4a('0x13')],'raw':!![]})[_0x0f4a('0xf')](function(_0x10f07a){ADMIN=_0x10f07a;_0x27fbe6+='|reason|'+_0x5253ff+'|\x0a';_0x27fbe6+='|uuid|'+_0x50b519+'|\x0a';_0x27fbe6+='|machineUuid|'+_0xa980f3+'|\x0a';_0x27fbe6+=_0x0f4a('0x14')+ADMIN['fullname']+'|\x0a';_0x27fbe6+='|email|'+ADMIN['email']+'|\x0a';return _0x27fbe6;})[_0x0f4a('0xf')](function(_0x449c76){var _0xe8149e=hardware[_0x0f4a('0x15')]()[_0x0f4a('0x16')];return jira[_0x0f4a('0x17')]({'key':_0x0f4a('0x18'),'summary':_0x0f4a('0x19'),'description':_0x449c76,'issuetype':_0x0f4a('0x1a'),'oldToken':_0x50b519,'newToken':_0xa980f3,'email':ADMIN['email'],'name':ADMIN[_0x0f4a('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0xe8149e});});}function manageLicense(_0x5d7682,_0x1c229f){var _0x63cbc5=_0x1c229f[_0x0f4a('0x1c')]({'plain':!![]});httpRequest(_0x5d7682)[_0x0f4a('0xf')](function(_0x32b1fd){if(oldToken){oldToken=undefined;}if(_0x32b1fd[_0x0f4a('0x1d')]){if(!_0x63cbc5[_0x0f4a('0x7')]&&_0x63cbc5[_0x0f4a('0x7')]!=_0x32b1fd[_0x0f4a('0x7')]||_0x63cbc5[_0x0f4a('0x7')]&&_0x63cbc5[_0x0f4a('0x1e')]){logger[_0x0f4a('0x1f')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x63cbc5[_0x0f4a('0x7')]&&!_0x63cbc5['data2']&&_0x63cbc5[_0x0f4a('0x7')]!=_0x32b1fd[_0x0f4a('0x7')]){logger[_0x0f4a('0x1f')](_0x0f4a('0x20'));}if(_0x63cbc5[_0x0f4a('0x7')]&&!_0x63cbc5[_0x0f4a('0x1e')]&&_0x63cbc5[_0x0f4a('0x7')]==_0x32b1fd[_0x0f4a('0x7')]){return _0x1c229f;}return _0x1c229f[_0x0f4a('0x21')]({'data1':_0x5d7682,'data2':null,'license':_0x32b1fd[_0x0f4a('0x7')]});}else{if(_0x32b1fd[_0x0f4a('0x7')]||_0x63cbc5[_0x0f4a('0x7')]){if(!_0x63cbc5[_0x0f4a('0x1e')]){if(_0x63cbc5['data1']==_0x5d7682){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x0f4a('0x22'));}else{GRAY_PERIOD_REASON=_0x0f4a('0x23');oldToken=_0x63cbc5[_0x0f4a('0x24')];logger[_0x0f4a('0x1f')](_0x0f4a('0x25'),_0x63cbc5['data1'],_0x5d7682);}sendJiraAlert(_0x63cbc5[_0x0f4a('0x24')],_0x32b1fd[_0x0f4a('0x26')],GRAY_PERIOD_REASON);logger['info'](_0x0f4a('0x27'),GRAY_PERIOD_REASON[_0x0f4a('0x28')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x1c229f[_0x0f4a('0x21')]({'data2':encryptor[_0x0f4a('0x29')](moment()[_0x0f4a('0xa')](_0x0f4a('0x2a')))});}else{if(moment()[_0x0f4a('0x2b')](encryptor[_0x0f4a('0x2c')](_0x63cbc5[_0x0f4a('0x1e')]),_0x0f4a('0x2d'))>DAYS){logger[_0x0f4a('0x1f')](_0x0f4a('0x2e'),moment()[_0x0f4a('0xa')](_0x0f4a('0x2a')));return _0x1c229f[_0x0f4a('0x21')]({'data1':_0x5d7682,'data2':null,'license':null});}}}else{if(_0x63cbc5['data1']!=_0x5d7682){logger[_0x0f4a('0x1f')](_0x0f4a('0x25'),_0x63cbc5[_0x0f4a('0x24')],_0x5d7682);return _0x1c229f['update']({'data1':_0x5d7682,'data2':null,'license':null});}}}return _0x1c229f;})['then'](function(_0x5e0f5c){_0x1c229f=_0x5e0f5c;})[_0x0f4a('0x2f')](function(_0x382a26){logger['error'](_0x382a26['message']);})[_0x0f4a('0x30')](function(){setTimeout(function(){manageLicense(hardware[_0x0f4a('0x31')](),_0x1c229f);},TIME);});}function defaultLicense(){var _0x282f1b=hardware[_0x0f4a('0x31')]();if(_0x282f1b){return db[_0x0f4a('0x32')][_0x0f4a('0x33')]({'where':{'id':0x1},'defaults':{'data1':_0x282f1b}})[_0x0f4a('0x34')](function(_0x2a5d58,_0x5eb654){logger[_0x0f4a('0x1f')](_0x0f4a('0x35'),_0x282f1b);manageLicense(_0x282f1b,_0x2a5d58);})[_0x0f4a('0x2f')](function(_0x3bb1c4){logger[_0x0f4a('0x36')](_0x3bb1c4[_0x0f4a('0x37')]);});}}exports[_0x0f4a('0x38')]=defaultLicense; \ No newline at end of file +var _0xcf97=['pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','process','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','User','|uuid|','|machineUuid|','|name|','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','email','fullname','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcf97,0xdc));var _0x7cf9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xcf97[_0x1ebce2];return _0x4a330c;};'use strict';var util=require(_0x7cf9('0x0'));var moment=require(_0x7cf9('0x1'));var rp=require(_0x7cf9('0x2'));var BPromise=require(_0x7cf9('0x3'));var pkginfo=require(_0x7cf9('0x4'))(module,_0x7cf9('0x5'));var db=require(_0x7cf9('0x6'))['db'];var encryptor=require(_0x7cf9('0x7'));var hardware=require(_0x7cf9('0x8'));var logger=require(_0x7cf9('0x9'))(_0x7cf9('0xa'));var jira=require(_0x7cf9('0xb'));const {config}=require(_0x7cf9('0xc'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xfc42fb){return new BPromise(function(_0x4c1d37,_0x4c00e3){var _0x5f1465=util[_0x7cf9('0xd')](_0x7cf9('0xe'),HOST,_0xfc42fb,module[_0x7cf9('0xf')][_0x7cf9('0x5')]);if(oldToken){_0x5f1465=util[_0x7cf9('0xd')](_0x7cf9('0x10'),HOST,_0xfc42fb,module[_0x7cf9('0xf')][_0x7cf9('0x5')],oldToken);}var _0x52d332={'uri':_0x5f1465,'method':_0x7cf9('0x11'),'timeout':0xea60,'json':!![]};return rp(_0x52d332)[_0x7cf9('0x12')](function(_0x56174e){_0x4c1d37(_0x56174e);})['catch'](function(_0x4c5eb8){_0x4c00e3(_0x4c5eb8);});});}function sendJiraAlert(_0x1b352a,_0x4e1547,_0x5ec4b3){var _0x49de3='||FIELD||VALUE||\x0a';return db[_0x7cf9('0x13')]['findOne']({'where':{'role':'admin'},'attributes':['fullname','email'],'raw':!![]})['then'](function(_0x92ed37){ADMIN=_0x92ed37;_0x49de3+='|reason|'+_0x5ec4b3+'|\x0a';_0x49de3+=_0x7cf9('0x14')+_0x1b352a+'|\x0a';_0x49de3+=_0x7cf9('0x15')+_0x4e1547+'|\x0a';_0x49de3+=_0x7cf9('0x16')+ADMIN['fullname']+'|\x0a';_0x49de3+='|email|'+ADMIN['email']+'|\x0a';return _0x49de3;})[_0x7cf9('0x12')](function(_0x750ce9){var _0x283f5f=hardware[_0x7cf9('0x17')]()[_0x7cf9('0x18')];return jira['openIssue']({'key':_0x7cf9('0x19'),'summary':_0x7cf9('0x1a'),'description':_0x750ce9,'issuetype':_0x7cf9('0x1b'),'oldToken':_0x1b352a,'newToken':_0x4e1547,'email':ADMIN[_0x7cf9('0x1c')],'name':ADMIN[_0x7cf9('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x283f5f});});}function manageLicense(_0x3e5965,_0x2b6502){var _0x33be78=_0x2b6502[_0x7cf9('0x1e')]({'plain':!![]});httpRequest(_0x3e5965)[_0x7cf9('0x12')](function(_0x2306d5){if(oldToken){oldToken=undefined;}if(_0x2306d5[_0x7cf9('0x1f')]){if(!_0x33be78['license']&&_0x33be78[_0x7cf9('0xa')]!=_0x2306d5[_0x7cf9('0xa')]||_0x33be78[_0x7cf9('0xa')]&&_0x33be78[_0x7cf9('0x20')]){logger[_0x7cf9('0x21')](_0x7cf9('0x22'));}if(_0x33be78[_0x7cf9('0xa')]&&!_0x33be78[_0x7cf9('0x20')]&&_0x33be78[_0x7cf9('0xa')]!=_0x2306d5['license']){logger['info'](_0x7cf9('0x23'));}if(_0x33be78['license']&&!_0x33be78[_0x7cf9('0x20')]&&_0x33be78[_0x7cf9('0xa')]==_0x2306d5[_0x7cf9('0xa')]){return _0x2b6502;}return _0x2b6502[_0x7cf9('0x24')]({'data1':_0x3e5965,'data2':null,'license':_0x2306d5['license']});}else{if(_0x2306d5[_0x7cf9('0xa')]||_0x33be78['license']){if(!_0x33be78['data2']){if(_0x33be78[_0x7cf9('0x25')]==_0x3e5965){GRAY_PERIOD_REASON=_0x7cf9('0x26');logger[_0x7cf9('0x21')](_0x7cf9('0x27'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x33be78[_0x7cf9('0x25')];logger[_0x7cf9('0x21')](_0x7cf9('0x28'),_0x33be78[_0x7cf9('0x25')],_0x3e5965);}sendJiraAlert(_0x33be78[_0x7cf9('0x25')],_0x2306d5[_0x7cf9('0x29')],GRAY_PERIOD_REASON);logger[_0x7cf9('0x21')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x7cf9('0x2a')](),moment()['format'](_0x7cf9('0x2b')));return _0x2b6502[_0x7cf9('0x24')]({'data2':encryptor[_0x7cf9('0x2c')](moment()[_0x7cf9('0xd')](_0x7cf9('0x2b')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x33be78[_0x7cf9('0x20')]),_0x7cf9('0x2d'))>DAYS){logger[_0x7cf9('0x21')](_0x7cf9('0x2e'),moment()[_0x7cf9('0xd')]('YYYY-MM-DD\x20HH:mm'));return _0x2b6502[_0x7cf9('0x24')]({'data1':_0x3e5965,'data2':null,'license':null});}}}else{if(_0x33be78[_0x7cf9('0x25')]!=_0x3e5965){logger[_0x7cf9('0x21')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x33be78[_0x7cf9('0x25')],_0x3e5965);return _0x2b6502[_0x7cf9('0x24')]({'data1':_0x3e5965,'data2':null,'license':null});}}}return _0x2b6502;})['then'](function(_0x549879){_0x2b6502=_0x549879;})[_0x7cf9('0x2f')](function(_0x255514){logger[_0x7cf9('0x30')](_0x255514[_0x7cf9('0x31')]);})[_0x7cf9('0x32')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2b6502);},TIME);});}function defaultLicense(){var _0x3bfdae=hardware[_0x7cf9('0x33')]();if(_0x3bfdae){return db[_0x7cf9('0x34')][_0x7cf9('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x3bfdae}})[_0x7cf9('0x36')](function(_0x224d7d,_0x5aa531){logger[_0x7cf9('0x21')](_0x7cf9('0x37'),_0x3bfdae);manageLicense(_0x3bfdae,_0x224d7d);})[_0x7cf9('0x2f')](function(_0xdf8937){logger['error'](_0xdf8937['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4ef29f5..bc04ecb 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 _0x5696=['2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','role','sequelize','count','user','telephones','forEach','admin','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','telephone','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb'];(function(_0x4b13f0,_0x1273df){var _0x2a1955=function(_0x5634ea){while(--_0x5634ea){_0x4b13f0['push'](_0x4b13f0['shift']());}};_0x2a1955(++_0x1273df);}(_0x5696,0x13b));var _0x6569=function(_0x5a3e56,_0x57163b){_0x5a3e56=_0x5a3e56-0x0;var _0x52cad6=_0x5696[_0x5a3e56];return _0x52cad6;};'use strict';var util=require(_0x6569('0x0'));var _=require(_0x6569('0x1'));var moment=require(_0x6569('0x2'));var BPromise=require(_0x6569('0x3'));var hardware=require(_0x6569('0x4'));var encryptor=require(_0x6569('0x5'));var db=require(_0x6569('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6569('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6569('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6569('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6569('0x9'),'machineUuid':hardware[_0x6569('0xa')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xf6e996){return new BPromise(function(_0x23ad50,_0x2e05f1){return db['License'][_0x6569('0xb')](_[_0x6569('0xc')](_0xf6e996,{'raw':!![],'where':{'id':0x1}}))[_0x6569('0xd')](function(_0x822c70){return checkLicense(_0x822c70,null);})[_0x6569('0xd')](function(_0x42b22f){_0x23ad50(_0x42b22f);return;})['catch'](function(_0x557e21){_0x2e05f1(_0x557e21);});});}function checkLicense(_0x4fb14a,_0x4f2e4f){if(!_0x4fb14a){demoLicense['uuid']=_0x4fb14a[_0x6569('0xe')];return demoLicense;}try{var _0x528a92=_0x4f2e4f||_0x4fb14a[_0x6569('0xf')];if(_[_0x6569('0x10')](_0x528a92)){throw new Error(_0x6569('0x11'));}var _0x193170=_0x4fb14a['data1'];var _0x2a3264=_0x4fb14a[_0x6569('0x12')];var _0x1b23a9=_0x193170[_0x6569('0x13')]('-')[0x4];var _0x1bb2d2=_0x193170[_0x6569('0x13')]('-')[0x0];var _0x55bd64=encryptor[_0x6569('0x14')](_0x528a92,util[_0x6569('0x15')](_0x6569('0x16'),_0x1b23a9,_0x193170,_0x1bb2d2));var _0x98344e=JSON['parse'](_0x55bd64);_0x98344e['demo']=![];_0x98344e[_0x6569('0x17')]=_0x193170;_0x98344e[_0x6569('0x18')]=hardware['getUuid']();if(_0x2a3264){var _0x100c3d=encryptor[_0x6569('0x14')](_0x2a3264);_0x98344e[_0x6569('0x19')]=_0x100c3d;_0x98344e[_0x6569('0x1a')]=moment(_0x100c3d)[_0x6569('0x1b')](0x7,_0x6569('0x1c'))['format']();_0x98344e[_0x6569('0x1d')]=_0x98344e[_0x6569('0x17')]!=_0x98344e['machineUuid']?_0x6569('0x1e'):_0x6569('0x1f');}return _0x98344e;}catch(_0x1f2b2c){breakingLicense['uuid']=_0x4fb14a[_0x6569('0xe')];breakingLicense[_0x6569('0x20')]=_0x1f2b2c[_0x6569('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1b2ce2,_0x418778){getLicense()['then'](function(_0x1edfa7){return db['User']['findAll']({'attributes':[_0x6569('0x21'),[db['sequelize']['fn']('COUNT',db[_0x6569('0x22')]['col'](_0x6569('0x21'))),_0x6569('0x23')]],'group':_0x6569('0x21'),'where':{'role':{'$or':['admin',_0x6569('0x24'),'telephone']}},'raw':!![]})[_0x6569('0xd')](function(_0x3436e7){var _0x7840c4={'user':_0x1edfa7['users']||0x0,'telephone':_0x1edfa7[_0x6569('0x25')]||0x0};_0x3436e7[_0x6569('0x26')](function(_0x2e88a9){var _0x49cb82=_0x2e88a9['role']===_0x6569('0x27')?_0x6569('0x24'):_0x2e88a9['role'];_0x7840c4[_0x49cb82]-=_0x2e88a9[_0x6569('0x23')];if(_0x7840c4[_0x49cb82]<0x0)_0x7840c4[_0x49cb82]=0x0;});_0x1b2ce2(_0x7840c4);return;});})[_0x6569('0x28')](function(_0xd302c0){_0x418778(_0xd302c0);});});}function checkUserLimits(_0x5cfd5a){return new BPromise(function(_0x1faa68,_0x2cdb55){getLimits()[_0x6569('0xd')](function(_0x5998e9){var _0xebc90f=_[_0x6569('0x29')](_[_0x6569('0x2a')](_0x5cfd5a,_0x6569('0x21')),[_0x6569('0x27'),'user','telephone']);var _0x3e2ed1=(_0xebc90f[_0x6569('0x27')]||0x0)+(_0xebc90f['user']||0x0);var _0x174748=_0xebc90f['telephone']||0x0;if(_0x3e2ed1>_0x5998e9[_0x6569('0x24')])return _0x2cdb55(_0x6569('0x2b'));if(_0x174748>_0x5998e9[_0x6569('0x2c')])return _0x2cdb55('License\x20limit\x20reached\x20for\x20telephones');return _0x1faa68();})[_0x6569('0x28')](function(_0x5f6078){_0x2cdb55(_0x5f6078);});});}module[_0x6569('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x9c69=['License\x20key\x20value\x20not\x20found','data2','parse','demo','decryptString','deadline','days','format','grayReason','machineUuid','changed','message','User','findAll','role','sequelize','COUNT','col','count','user','telephone','users','forEach','admin','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x9c69,0x78));var _0x99c6=function(_0x538eab,_0x196107){_0x538eab=_0x538eab-0x0;var _0x3ec7b9=_0x9c69[_0x538eab];return _0x3ec7b9;};'use strict';var util=require(_0x99c6('0x0'));var _=require(_0x99c6('0x1'));var moment=require('moment');var BPromise=require(_0x99c6('0x2'));var hardware=require(_0x99c6('0x3'));var encryptor=require(_0x99c6('0x4'));var db=require(_0x99c6('0x5'))['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':_0x99c6('0x6'),'machineUuid':hardware[_0x99c6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x99c6('0x8'),'machineUuid':hardware[_0x99c6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x14c65e){return new BPromise(function(_0x92820e,_0x2c953a){return db[_0x99c6('0x9')][_0x99c6('0xa')](_[_0x99c6('0xb')](_0x14c65e,{'raw':!![],'where':{'id':0x1}}))[_0x99c6('0xc')](function(_0x37b9e1){return checkLicense(_0x37b9e1,null);})[_0x99c6('0xc')](function(_0x5dc97e){_0x92820e(_0x5dc97e);return;})[_0x99c6('0xd')](function(_0x51adc0){_0x2c953a(_0x51adc0);});});}function checkLicense(_0x234084,_0x48384b){if(!_0x234084){demoLicense[_0x99c6('0xe')]=_0x234084[_0x99c6('0xf')];return demoLicense;}try{var _0x432266=_0x48384b||_0x234084[_0x99c6('0x10')];if(_[_0x99c6('0x11')](_0x432266)){throw new Error(_0x99c6('0x12'));}var _0x454fed=_0x234084[_0x99c6('0xf')];var _0x8c96fe=_0x234084[_0x99c6('0x13')];var _0x46341c=_0x454fed['split']('-')[0x4];var _0x36a6e8=_0x454fed['split']('-')[0x0];var _0x14afc6=encryptor['decryptString'](_0x432266,util['format']('%s:%s:%s',_0x46341c,_0x454fed,_0x36a6e8));var _0x5dcf5b=JSON[_0x99c6('0x14')](_0x14afc6);_0x5dcf5b[_0x99c6('0x15')]=![];_0x5dcf5b['uuid']=_0x454fed;_0x5dcf5b['machineUuid']=hardware[_0x99c6('0x7')]();if(_0x8c96fe){var _0x4bff80=encryptor[_0x99c6('0x16')](_0x8c96fe);_0x5dcf5b['gray']=_0x4bff80;_0x5dcf5b[_0x99c6('0x17')]=moment(_0x4bff80)['add'](0x7,_0x99c6('0x18'))[_0x99c6('0x19')]();_0x5dcf5b[_0x99c6('0x1a')]=_0x5dcf5b[_0x99c6('0xe')]!=_0x5dcf5b[_0x99c6('0x1b')]?_0x99c6('0x1c'):'disabled';}return _0x5dcf5b;}catch(_0x44bd45){breakingLicense[_0x99c6('0xe')]=_0x234084[_0x99c6('0xf')];breakingLicense[_0x99c6('0x1d')]=_0x44bd45[_0x99c6('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4e21a6,_0x51e4ff){getLicense()[_0x99c6('0xc')](function(_0x258f78){return db[_0x99c6('0x1e')][_0x99c6('0x1f')]({'attributes':[_0x99c6('0x20'),[db[_0x99c6('0x21')]['fn'](_0x99c6('0x22'),db['sequelize'][_0x99c6('0x23')]('role')),_0x99c6('0x24')]],'group':'role','where':{'role':{'$or':['admin',_0x99c6('0x25'),_0x99c6('0x26')]}},'raw':!![]})[_0x99c6('0xc')](function(_0x33f04b){var _0x4d6745={'user':_0x258f78[_0x99c6('0x27')]||0x0,'telephone':_0x258f78['telephones']||0x0};_0x33f04b[_0x99c6('0x28')](function(_0x396254){var _0x462257=_0x396254['role']===_0x99c6('0x29')?_0x99c6('0x25'):_0x396254['role'];_0x4d6745[_0x462257]-=_0x396254[_0x99c6('0x24')];if(_0x4d6745[_0x462257]<0x0)_0x4d6745[_0x462257]=0x0;});_0x4e21a6(_0x4d6745);return;});})['catch'](function(_0x284291){_0x51e4ff(_0x284291);});});}function checkUserLimits(_0x1997eb){return new BPromise(function(_0x251de0,_0x2eb65a){getLimits()['then'](function(_0x4b6de2){var _0x2f562f=_[_0x99c6('0x2a')](_['countBy'](_0x1997eb,'role'),[_0x99c6('0x29'),_0x99c6('0x25'),_0x99c6('0x26')]);var _0x4dd568=(_0x2f562f[_0x99c6('0x29')]||0x0)+(_0x2f562f[_0x99c6('0x25')]||0x0);var _0x217caf=_0x2f562f[_0x99c6('0x26')]||0x0;if(_0x4dd568>_0x4b6de2['user'])return _0x2eb65a(_0x99c6('0x2b'));if(_0x217caf>_0x4b6de2['telephone'])return _0x2eb65a(_0x99c6('0x2c'));return _0x251de0();})['catch'](function(_0xbf6617){_0x2eb65a(_0xbf6617);});});}module[_0x99c6('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 0cf7399..9b99421 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 _0xa71d=['exports','http://localhost:9000','secret'];(function(_0x327b51,_0x2b9f19){var _0x1471e2=function(_0x53e5e5){while(--_0x53e5e5){_0x327b51['push'](_0x327b51['shift']());}};_0x1471e2(++_0x2b9f19);}(_0xa71d,0xbd));var _0xda71=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xa71d[_0x39e84d];return _0x1991bc;};'use strict';module[_0xda71('0x0')]={'DOMAIN':_0xda71('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xda71('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x3f64=['exports','myappanuglar-secret','app-id'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3f64,0xf0));var _0x43f6=function(_0xc4d003,_0x3115e0){_0xc4d003=_0xc4d003-0x0;var _0x325803=_0x3f64[_0xc4d003];return _0x325803;};'use strict';module[_0x43f6('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x43f6('0x1'),'GOOGLE_ID':_0x43f6('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 411949f..8898c37 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x493f=['level','Logger','transports','File','%s-%s','error','info','Console','moment','util','path','INFO','join','/var','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x493f,0x194));var _0xf493=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x493f[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0xf493('0x0'));var winston=require('winston');var util=require(_0xf493('0x1'));var path=require(_0xf493('0x2'));var debugLevel=_0xf493('0x3');function filename(_0x5d3d90,_0x1798ed){return path[_0xf493('0x4')](_0xf493('0x5'),'log','xcally',util[_0xf493('0x6')](_0xf493('0x7'),_0x5d3d90,_0x1798ed));}function formatter(_0x314171,_0x6c86bf){_0x6c86bf['message']=_0x6c86bf[_0xf493('0x8')][_0xf493('0x9')](/@@{/g,_0xf493('0xa'))[_0xf493('0x9')](/}@@/g,_0xf493('0xb'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xf493('0x6')](_0xf493('0xc'),moment()[_0xf493('0x6')](_0xf493('0xd')),_0x6c86bf[_0xf493('0xe')]['toUpperCase'](),_0x314171,_0x6c86bf[_0xf493('0x8')]);}module['exports']=function(_0x35e657){return new winston[(_0xf493('0xf'))]({'transports':[new winston[(_0xf493('0x10'))][(_0xf493('0x11'))]({'name':util['format'](_0xf493('0x12'),_0x35e657,_0xf493('0x13')),'filename':filename(_0x35e657,_0xf493('0x13')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x9c6ab1){return formatter(_0x35e657,_0x9c6ab1);}}),new winston['transports']['File']({'name':util[_0xf493('0x6')](_0xf493('0x12'),_0x35e657,_0xf493('0x14')),'filename':filename(_0x35e657,_0xf493('0x14')),'level':_0xf493('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e8a4c){return formatter(_0x35e657,_0x1e8a4c);}}),new winston[(_0xf493('0x10'))][(_0xf493('0x15'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x15b181){return formatter(_0x35e657,_0x15b181);}})]});}; \ No newline at end of file +var _0xa94b=['}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','Logger','transports','File','%s-%s','info','Console','env','moment','winston','util','path','join','xcally','format','%s-%s.log','replace','{{{'];(function(_0x27b423,_0x312583){var _0x5c11b8=function(_0x22a3b9){while(--_0x22a3b9){_0x27b423['push'](_0x27b423['shift']());}};_0x5c11b8(++_0x312583);}(_0xa94b,0xbc));var _0xba94=function(_0x19b220,_0x2a2612){_0x19b220=_0x19b220-0x0;var _0x2f9893=_0xa94b[_0x19b220];return _0x2f9893;};'use strict';var moment=require(_0xba94('0x0'));var winston=require(_0xba94('0x1'));var util=require(_0xba94('0x2'));var path=require(_0xba94('0x3'));var debugLevel='INFO';function filename(_0x1f33e2,_0x28049e){return path[_0xba94('0x4')]('/var','log',_0xba94('0x5'),util[_0xba94('0x6')](_0xba94('0x7'),_0x1f33e2,_0x28049e));}function formatter(_0x5945e8,_0x3bdf91){_0x3bdf91['message']=_0x3bdf91['message'][_0xba94('0x8')](/@@{/g,_0xba94('0x9'))[_0xba94('0x8')](/}@@/g,_0xba94('0xa'))[_0xba94('0x8')](/@{/g,'{{')[_0xba94('0x8')](/}@/g,'}}');return util[_0xba94('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xba94('0x6')](_0xba94('0xb')),_0x3bdf91[_0xba94('0xc')][_0xba94('0xd')](),_0x5945e8,_0x3bdf91[_0xba94('0xe')]);}module['exports']=function(_0x6d69b0){return new winston[(_0xba94('0xf'))]({'transports':[new winston[(_0xba94('0x10'))][(_0xba94('0x11'))]({'name':util[_0xba94('0x6')](_0xba94('0x12'),_0x6d69b0,'error'),'filename':filename(_0x6d69b0,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ea7c0){return formatter(_0x6d69b0,_0x2ea7c0);}}),new winston[(_0xba94('0x10'))][(_0xba94('0x11'))]({'name':util[_0xba94('0x6')](_0xba94('0x12'),_0x6d69b0,_0xba94('0x13')),'filename':filename(_0x6d69b0,_0xba94('0x13')),'level':_0xba94('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x34d6c5){return formatter(_0x6d69b0,_0x34d6c5);}}),new winston['transports'][(_0xba94('0x14'))]({'level':process[_0xba94('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x264ee3){return formatter(_0x6d69b0,_0x264ee3);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0175ec8..1a5eaf7 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 _0x024a=['../../services/agi/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express','join','agi'];(function(_0x2559f3,_0x58b392){var _0x4ca9f5=function(_0x5c4de2){while(--_0x5c4de2){_0x2559f3['push'](_0x2559f3['shift']());}};_0x4ca9f5(++_0x58b392);}(_0x024a,0x17f));var _0xa024=function(_0x14cb95,_0x3306c6){_0x14cb95=_0x14cb95-0x0;var _0x5748e2=_0x024a[_0x14cb95];return _0x5748e2;};'use strict';var path=require(_0xa024('0x0'));var os=require('os');var config={'apps':[{'name':_0xa024('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xa024('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0xa024('0x3'),'script':path[_0xa024('0x2')](__dirname,_0xa024('0x4'))},{'name':'email','script':path[_0xa024('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xa024('0x5'),'script':path[_0xa024('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0xa024('0x6'),'script':path[_0xa024('0x2')](__dirname,_0xa024('0x7'))}]};module[_0xa024('0x8')]=config; \ No newline at end of file +var _0x751d=['../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x751d,0xb3));var _0xd751=function(_0x5864ef,_0x496812){_0x5864ef=_0x5864ef-0x0;var _0x21c244=_0x751d[_0x5864ef];return _0x21c244;};'use strict';var path=require(_0xd751('0x0'));var os=require('os');var config={'apps':[{'name':_0xd751('0x1'),'script':path[_0xd751('0x2')](__dirname,_0xd751('0x3'))},{'name':_0xd751('0x4'),'script':path[_0xd751('0x2')](__dirname,_0xd751('0x5'))},{'name':_0xd751('0x6'),'script':path[_0xd751('0x2')](__dirname,_0xd751('0x7'))},{'name':'email','script':path['join'](__dirname,_0xd751('0x8'))},{'name':'routing','script':path[_0xd751('0x2')](__dirname,_0xd751('0x9'))},{'name':'xdr','script':path['join'](__dirname,_0xd751('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index cb518a4..7622efc 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 _0x64f5=['then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','connected'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x64f5,0x17e));var _0x564f=function(_0x43b190,_0x212217){_0x43b190=_0x43b190-0x0;var _0x4fd791=_0x64f5[_0x43b190];return _0x4fd791;};'use strict';var pm2=require(_0x564f('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x5020a9,_0x39903b){return pm2['connect'](function(_0x2e7142){if(_0x2e7142){return _0x39903b(_0x2e7142);}return _0x5020a9(_0x564f('0x1'));});});};exports['start']=function(_0x2607d6){return connect()[_0x564f('0x2')](function(){return new BPromise(function(_0x1fabb8,_0x72b009){return pm2[_0x564f('0x3')](_0x2607d6,function(_0x4d3dae,_0x26f14e){if(_0x4d3dae){return _0x72b009(_0x4d3dae);}pm2[_0x564f('0x4')]();return _0x1fabb8(_0x26f14e);});});});};exports[_0x564f('0x5')]=function(_0x26fd74){return connect()[_0x564f('0x2')](function(){return new BPromise(function(_0x369f1a,_0x2e2b5c){return pm2[_0x564f('0x5')](_0x26fd74,function(_0xc3b20f,_0x3aa86a){if(_0xc3b20f){return _0x2e2b5c(_0xc3b20f);}pm2[_0x564f('0x4')]();return _0x369f1a(_0x3aa86a);});});});};exports[_0x564f('0x6')]=function(_0x6b234d){return connect()['then'](function(){return new BPromise(function(_0x58028b,_0xcaf1e0){return pm2['restart'](_0x6b234d,function(_0x18c2e,_0xb6065d){if(_0x18c2e){return _0xcaf1e0(_0x18c2e);}pm2[_0x564f('0x4')]();return _0x58028b(_0xb6065d);});});});};exports['list']=function(){return connect()[_0x564f('0x2')](function(){return new BPromise(function(_0xa24e3c,_0xa57ee4){return pm2[_0x564f('0x7')](function(_0x454f0b,_0x518570){if(_0x454f0b){return _0xa57ee4(_0x454f0b);}pm2['disconnect']();return _0xa24e3c(_0x518570);});});});};exports[_0x564f('0x8')]=function(_0x29cf05){return connect()[_0x564f('0x2')](function(){return new BPromise(function(_0x38fdd7,_0xec5adf){return pm2[_0x564f('0x8')](_0x29cf05,function(_0x2e7980,_0x15d9d7){if(_0x2e7980){return _0xec5adf(_0x2e7980);}pm2[_0x564f('0x4')]();return _0x38fdd7(_0x15d9d7);});});});};exports[_0x564f('0x9')]=function(_0x38764d){return connect()['then'](function(){return new BPromise(function(_0x1a5759,_0x445017){return pm2[_0x564f('0x9')](_0x38764d,function(_0xed14eb,_0x418820){if(_0xed14eb){return _0x445017(_0xed14eb);}pm2[_0x564f('0x4')]();return _0x1a5759(_0x418820);});});});};exports[_0x564f('0xa')]=function(){return connect()[_0x564f('0x2')](function(){return new BPromise(function(_0x1bb5c8,_0x1be914){return pm2[_0x564f('0xa')](function(_0x5a09e8){if(_0x5a09e8){return _0x1be914(_0x5a09e8);}return _0x1bb5c8(_0x564f('0xb'));});});});}; \ No newline at end of file +var _0x31c2=['restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','then','start','stop','disconnect'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x31c2,0x1e1));var _0x231c=function(_0x3181a2,_0x5672b4){_0x3181a2=_0x3181a2-0x0;var _0x319051=_0x31c2[_0x3181a2];return _0x319051;};'use strict';var pm2=require(_0x231c('0x0'));var BPromise=require(_0x231c('0x1'));var config=require(_0x231c('0x2'));function connect(){return new BPromise(function(_0x143120,_0x1c57c9){return pm2[_0x231c('0x3')](function(_0xa1faa4){if(_0xa1faa4){return _0x1c57c9(_0xa1faa4);}return _0x143120(_0x231c('0x4'));});});};exports['start']=function(_0x59f232){return connect()[_0x231c('0x5')](function(){return new BPromise(function(_0x1b9d64,_0x1f3f7d){return pm2[_0x231c('0x6')](_0x59f232,function(_0x48bfb2,_0x111bf9){if(_0x48bfb2){return _0x1f3f7d(_0x48bfb2);}pm2['disconnect']();return _0x1b9d64(_0x111bf9);});});});};exports[_0x231c('0x7')]=function(_0x38b3b9){return connect()[_0x231c('0x5')](function(){return new BPromise(function(_0x55fa3a,_0x2524bf){return pm2[_0x231c('0x7')](_0x38b3b9,function(_0x1e390f,_0x23841c){if(_0x1e390f){return _0x2524bf(_0x1e390f);}pm2[_0x231c('0x8')]();return _0x55fa3a(_0x23841c);});});});};exports[_0x231c('0x9')]=function(_0x10b80f){return connect()['then'](function(){return new BPromise(function(_0x2e3796,_0x9ebb03){return pm2['restart'](_0x10b80f,function(_0xc07b99,_0x43c270){if(_0xc07b99){return _0x9ebb03(_0xc07b99);}pm2[_0x231c('0x8')]();return _0x2e3796(_0x43c270);});});});};exports[_0x231c('0xa')]=function(){return connect()[_0x231c('0x5')](function(){return new BPromise(function(_0x1404bc,_0x2c4f75){return pm2[_0x231c('0xa')](function(_0xc09de5,_0x311218){if(_0xc09de5){return _0x2c4f75(_0xc09de5);}pm2[_0x231c('0x8')]();return _0x1404bc(_0x311218);});});});};exports[_0x231c('0xb')]=function(_0xe37de8){return connect()[_0x231c('0x5')](function(){return new BPromise(function(_0x12a6ad,_0x210f2e){return pm2[_0x231c('0xb')](_0xe37de8,function(_0x192bac,_0x1852e5){if(_0x192bac){return _0x210f2e(_0x192bac);}pm2[_0x231c('0x8')]();return _0x12a6ad(_0x1852e5);});});});};exports['delete']=function(_0x599cd6){return connect()[_0x231c('0x5')](function(){return new BPromise(function(_0x17f9ce,_0xadea80){return pm2[_0x231c('0xc')](_0x599cd6,function(_0x2bca68,_0x3c3ea6){if(_0x2bca68){return _0xadea80(_0x2bca68);}pm2[_0x231c('0x8')]();return _0x17f9ce(_0x3c3ea6);});});});};exports[_0x231c('0xd')]=function(){return connect()[_0x231c('0x5')](function(){return new BPromise(function(_0x5f045f,_0x4a0c45){return pm2['dump'](function(_0x872034){if(_0x872034){return _0x4a0c45(_0x872034);}return _0x5f045f('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 0fd8df5..dbfb367 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 _0xe0a5=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../logger','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','map','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe0a5,0x18d));var _0x5e0a=function(_0x39a387,_0x496459){_0x39a387=_0x39a387-0x0;var _0x4d9420=_0xe0a5[_0x39a387];return _0x4d9420;};'use strict';var _=require(_0x5e0a('0x0'));var moment=require(_0x5e0a('0x1'));var Redis=require(_0x5e0a('0x2'));var util=require(_0x5e0a('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x5e0a('0x4'))('schedule');config[_0x5e0a('0x5')]=_[_0x5e0a('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e0a('0x7'))(new Redis(config[_0x5e0a('0x5')]));function closeInteractions(){var _0x65b019=0x0;var _0x3d82da=[];return db[_0x5e0a('0x8')][_0x5e0a('0x9')]({'raw':!![],'attributes':['id',_0x5e0a('0xa')],'where':{'id':0x1}})['then'](function(_0x31d44b){_0x65b019=_0x31d44b[_0x5e0a('0xa')];if(_0x65b019){return db[_0x5e0a('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x5e0a('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5e0a('0xd')](_0x31d44b[_0x5e0a('0xa')],_0x5e0a('0xe'))}}});}else{return[];}})[_0x5e0a('0xf')](function(_0x23a523){if(_0x23a523&&_0x23a523['length']){_0x3d82da=_[_0x5e0a('0x10')](_0x23a523||[],'id');logger['info'](_0x5e0a('0x11'),_0x3d82da[_0x5e0a('0x12')]());return db[_0x5e0a('0xb')][_0x5e0a('0x13')]({'closeReason':_0x5e0a('0x14'),'disposition':_0x5e0a('0x15'),'closed':!![],'closedAt':moment()[_0x5e0a('0x16')](_0x5e0a('0x17'))},{'where':{'id':_0x3d82da}});}})[_0x5e0a('0xf')](function(){if(_0x3d82da&&_0x3d82da[_0x5e0a('0x18')]){logger[_0x5e0a('0x19')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3d82da[_0x5e0a('0x12')]());for(var _0x503d8c=0x0;_0x503d8c<_0x3d82da[_0x5e0a('0x18')];_0x503d8c++){io['emit'](_0x5e0a('0x1a'),{'id':_0x3d82da[_0x503d8c],'closed':!![]});}}})[_0x5e0a('0x1b')](function(_0x1aa149){logger[_0x5e0a('0x1c')](_0x5e0a('0x1d'),_0x1aa149?util[_0x5e0a('0x1e')](_0x1aa149,{'showHidden':![],'depth':null}):'');});}exports[_0x5e0a('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9176=['minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','lodash','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout'];(function(_0x4f0212,_0x108bce){var _0x44dde4=function(_0x2c0e36){while(--_0x2c0e36){_0x4f0212['push'](_0x4f0212['shift']());}};_0x44dde4(++_0x108bce);}(_0x9176,0x86));var _0x6917=function(_0x125703,_0x46989c){_0x125703=_0x125703-0x0;var _0x1a954b=_0x9176[_0x125703];return _0x1a954b;};'use strict';var _=require(_0x6917('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x6917('0x1'));var config=require(_0x6917('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x6917('0x3'))(_0x6917('0x4'));config[_0x6917('0x5')]=_[_0x6917('0x6')](config[_0x6917('0x5')],{'host':_0x6917('0x7'),'port':0x18eb});var io=require(_0x6917('0x8'))(new Redis(config[_0x6917('0x5')]));function closeInteractions(){var _0x288bd6=0x0;var _0x1e55d4=[];return db[_0x6917('0x9')]['find']({'raw':!![],'attributes':['id',_0x6917('0xa')],'where':{'id':0x1}})['then'](function(_0x418cad){_0x288bd6=_0x418cad[_0x6917('0xa')];if(_0x288bd6){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x418cad['chatTimeout'],_0x6917('0xb'))}}});}else{return[];}})[_0x6917('0xc')](function(_0x48b8ea){if(_0x48b8ea&&_0x48b8ea[_0x6917('0xd')]){_0x1e55d4=_[_0x6917('0xe')](_0x48b8ea||[],'id');logger[_0x6917('0xf')](_0x6917('0x10'),_0x1e55d4[_0x6917('0x11')]());return db[_0x6917('0x12')][_0x6917('0x13')]({'closeReason':_0x6917('0x14'),'disposition':_0x6917('0x15'),'closed':!![],'closedAt':moment()[_0x6917('0x16')](_0x6917('0x17'))},{'where':{'id':_0x1e55d4}});}})[_0x6917('0xc')](function(){if(_0x1e55d4&&_0x1e55d4['length']){logger[_0x6917('0xf')](_0x6917('0x18'),_0x1e55d4[_0x6917('0x11')]());for(var _0x48be29=0x0;_0x48be29<_0x1e55d4[_0x6917('0xd')];_0x48be29++){io[_0x6917('0x19')](_0x6917('0x1a'),{'id':_0x1e55d4[_0x48be29],'closed':!![]});}}})[_0x6917('0x1b')](function(_0x1bbeae){logger[_0x6917('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1bbeae?util['inspect'](_0x1bbeae,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 313e09e..767633b 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 _0x79d8=['stop','stop\x20cron','startAt','update','run','util','path','lodash','moment','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','MailAccount','service','Smtp','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','status','Sent','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','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error\x20mail','email\x20sent','catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','then','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','intersection','difference','toString','exists','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','cron','active','isBetween','endAt'];(function(_0x433c75,_0x42f8f7){var _0x12be3d=function(_0x43752a){while(--_0x43752a){_0x433c75['push'](_0x433c75['shift']());}};_0x12be3d(++_0x42f8f7);}(_0x79d8,0x104));var _0x879d=function(_0x327c6b,_0x934a93){_0x327c6b=_0x327c6b-0x0;var _0xbd81d8=_0x79d8[_0x327c6b];return _0xbd81d8;};'use strict';var fs=require('fs');var util=require(_0x879d('0x0'));var path=require(_0x879d('0x1'));var _=require(_0x879d('0x2'));var moment=require(_0x879d('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x879d('0x4'));var BPromise=require('bluebird');var logger=require(_0x879d('0x5'))('schedule');var db=require(_0x879d('0x6'))['db'];var analyticCustomReportController=require(_0x879d('0x7'));var analyticDefaultReportController=require(_0x879d('0x8'));var client=jayson[_0x879d('0x9')][_0x879d('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4ec182,_0x47afbc){return function(){logger[_0x879d('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4ec182['email']);var _0x5c6814=!![];var _0x3e3db1={'tls':{'rejectUnauthorized':![]}};if(_0x4ec182[_0x879d('0xc')]['Smtp']['service']){_0x3e3db1[_0x879d('0xd')]=_0x4ec182[_0x879d('0xc')][_0x879d('0xe')][_0x879d('0xd')];}else{_0x3e3db1[_0x879d('0xf')]=_0x4ec182[_0x879d('0xc')]['Smtp'][_0x879d('0xf')];_0x3e3db1['port']=_0x4ec182[_0x879d('0xc')]['Smtp'][_0x879d('0x10')];_0x3e3db1[_0x879d('0x11')]=_0x4ec182[_0x879d('0xc')][_0x879d('0xe')][_0x879d('0x11')];}if(_0x4ec182[_0x879d('0xc')][_0x879d('0xe')][_0x879d('0x12')]){_0x3e3db1[_0x879d('0x13')]={'user':_0x4ec182[_0x879d('0xc')][_0x879d('0xe')]['user'],'pass':_0x4ec182[_0x879d('0xc')][_0x879d('0xe')]['pass']};}var _0x4d3c00={'account':_0x3e3db1,'message':{'from':util[_0x879d('0x14')](_0x879d('0x15'),_0x4ec182['MailAccount'][_0x879d('0x16')],_0x4ec182[_0x879d('0xc')][_0x879d('0x17')]||_0x4ec182[_0x879d('0xc')][_0x879d('0xe')][_0x879d('0x18')]),'to':_0x4ec182[_0x879d('0x17')],'cc':_0x4ec182['cc'],'bcc':_0x4ec182[_0x879d('0x19')],'subject':util[_0x879d('0x14')](_0x879d('0x1a'),_0x47afbc[_0x879d('0x16')],_0x4ec182[_0x879d('0x1b')],_0x4ec182[_0x879d('0x1c')])}};var _0x51bd92=path[_0x879d('0x1d')](__dirname,_0x879d('0x1e'));var _0x419bd0=_0x47afbc['savename'];var _0x2183d8=util[_0x879d('0x14')](_0x879d('0x1f'),path[_0x879d('0x20')](_0x47afbc[_0x879d('0x21')],path[_0x879d('0x22')](_0x47afbc[_0x879d('0x21')])),_0x879d('0x23'));var _0x2c08f9=path[_0x879d('0x1d')](_0x51bd92,_0x419bd0);var _0x2b91ff=path[_0x879d('0x1d')](_0x51bd92,_0x2183d8);if(fs['existsSync'](_0x2c08f9)){_0x47afbc[_0x879d('0x24')]=_0x879d('0x25');_0x4d3c00['message'][_0x879d('0x26')]=[{'filename':_0x419bd0,'path':_0x2c08f9}];_0x4d3c00['message'][_0x879d('0x27')]=util['format'](_0x879d('0x28'),JSON[_0x879d('0x29')](_0x47afbc,null,0x2));}else if(fs[_0x879d('0x2a')](_0x2b91ff)){_0x47afbc[_0x879d('0x24')]=_0x879d('0x25');_0x4d3c00[_0x879d('0x2b')][_0x879d('0x26')]=[{'filename':_0x2183d8,'path':_0x2b91ff}];}else{_0x4d3c00[_0x879d('0x2b')]['text']=_0x879d('0x2c');if(!_0x4ec182[_0x879d('0x2d')]){_0x5c6814=![];logger[_0x879d('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5c6814){return client[_0x879d('0x2e')](_0x879d('0x2f'),_0x4d3c00)['then'](function(_0x562da8){if(_0x562da8['error']){return logger['error'](_0x879d('0x30'),JSON[_0x879d('0x29')](_0x562da8));}return logger[_0x879d('0xb')](_0x879d('0x31'));})[_0x879d('0x32')](function(_0x20de6b){return logger[_0x879d('0x33')](_0x879d('0x30'),JSON[_0x879d('0x29')](_0x20de6b));});}};}function handleError(){return function(_0x27101a){return logger['error'](JSON[_0x879d('0x29')](_0x27101a));};}function handleResult(_0x7f5a59){return function(_0x24b35e){logger['info']('data',JSON[_0x879d('0x29')](_0x24b35e));if(_0x7f5a59[_0x879d('0xc')]&&_0x7f5a59['MailAccount']['Smtp']&&!_['isNil'](_0x7f5a59['email'])){setTimeout(handleSendEmail(_0x7f5a59,_0x24b35e),0x3c*0x3e8);}};}function handleJob(_0x1a4948){return function(){try{if(_[_0x879d('0x34')](_0x1a4948[_0x879d('0x1b')])){return logger['info'](_0x879d('0x35'));}if(_[_0x879d('0x34')](_0x1a4948['subtractUnit'])){return logger[_0x879d('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x252b9c={'startDate':moment()[_0x879d('0x36')](_0x1a4948[_0x879d('0x1b')],_0x1a4948[_0x879d('0x1c')])[_0x879d('0x14')](_0x879d('0x37')),'endDate':moment()[_0x879d('0x14')](_0x879d('0x37')),'type':_0x879d('0x38'),'output':_0x1a4948['output'],'name':_0x1a4948['name']};if(!_[_0x879d('0x34')](_0x1a4948[_0x879d('0x39')])){logger[_0x879d('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x1a4948[_0x879d('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x1a4948[_0x879d('0x39')]},_0x252b9c)['then'](handleResult(_0x1a4948))[_0x879d('0x32')](handleError());}if(!_[_0x879d('0x34')](_0x1a4948[_0x879d('0x3a')])){logger[_0x879d('0xb')]('exec\x20custom\x20report\x20id:%s',_0x1a4948[_0x879d('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x1a4948[_0x879d('0x3a')]},_0x252b9c)[_0x879d('0x3b')](handleResult(_0x1a4948))[_0x879d('0x32')](handleError());}}catch(_0x4dfa05){logger[_0x879d('0x33')](JSON[_0x879d('0x29')](_0x4dfa05));}return logger['info'](_0x879d('0x3c'));};}function getJobs(_0x203abc){var _0x16a404={};if(_0x203abc){_0x16a404['id']=_0x203abc;}return db[_0x879d('0x3d')]['findAll']({'where':_0x16a404,'include':[{'model':db[_0x879d('0xc')],'attributes':['id',_0x879d('0x16'),_0x879d('0x17')],'include':[{'model':db[_0x879d('0x3e')],'as':_0x879d('0xe')}]}]})[_0x879d('0x3b')](function(_0x20a94a){var _0x3eb3bb=_[_0x879d('0x3f')](manager[_0x879d('0x40')]);var _0x4387f6=_['map'](_0x20a94a,function(_0x5b831c){return _0x5b831c['id']['toString']();});var _0x4d7bc0=_['keyBy'](_0x20a94a,function(_0x5c4e51){return _0x5c4e51['id']['toString']();});var _0x2fe461=_0x203abc?_0x4387f6:_['difference'](_0x4387f6,_0x3eb3bb);var _0x3756e0=_[_0x879d('0x41')](_0x4387f6,_0x3eb3bb);var _0x4cf1ae=_[_0x879d('0x42')](_0x3eb3bb,_0x4387f6);var _0x471d01;var _0x5850fa;for(_0x471d01=0x0;_0x471d01<_0x4cf1ae['length']&&!_0x203abc;_0x471d01+=0x1){_0x5850fa=_0x4cf1ae[_0x471d01][_0x879d('0x43')]();if(manager[_0x879d('0x44')](_0x5850fa)){manager['stop'](_0x5850fa);manager[_0x879d('0x45')](_0x5850fa);logger['info'](_0x879d('0x46'),_0x5850fa);}}logger[_0x879d('0xb')](_0x879d('0x47'),JSON[_0x879d('0x29')](_0x2fe461));for(_0x471d01=0x0;_0x471d01<_0x2fe461[_0x879d('0x48')];_0x471d01+=0x1){_0x5850fa=_0x2fe461[_0x471d01][_0x879d('0x43')]();logger[_0x879d('0xb')](_0x879d('0x49'),_0x5850fa);if(_0x203abc){logger[_0x879d('0xb')](_0x879d('0x4a'),_0x203abc);logger[_0x879d('0xb')](JSON[_0x879d('0x29')](_0x4d7bc0[_0x5850fa]));BPromise[_0x879d('0x4b')]()[_0x879d('0x3b')](handleJob(_0x4d7bc0[_0x5850fa]));logger[_0x879d('0xb')]('run\x20job',_0x4d7bc0[_0x5850fa][_0x879d('0x16')],_0x4d7bc0[_0x5850fa][_0x879d('0x4c')]);}else if(_0x4d7bc0[_0x5850fa][_0x879d('0x4c')]&&_0x4d7bc0[_0x5850fa][_0x879d('0x4d')]&&moment()[_0x879d('0x4e')](_0x4d7bc0[_0x5850fa]['startAt'],_0x4d7bc0[_0x5850fa][_0x879d('0x4f')])){manager['add'](_0x5850fa,_0x4d7bc0[_0x5850fa][_0x879d('0x4c')],handleJob(_0x4d7bc0[_0x5850fa]));manager['start'](_0x5850fa);logger[_0x879d('0xb')]('add\x20cron',_0x4d7bc0[_0x5850fa][_0x879d('0x16')],_0x4d7bc0[_0x5850fa]['cron']);}else if(manager[_0x879d('0x44')](_0x5850fa)){manager[_0x879d('0x50')](_0x5850fa);manager[_0x879d('0x45')](_0x5850fa);logger['info'](_0x879d('0x51'),_0x4d7bc0[_0x5850fa][_0x879d('0x16')],_0x4d7bc0[_0x5850fa][_0x879d('0x4c')]);}}for(_0x471d01=0x0,_0x5850fa;_0x471d01<_0x3756e0[_0x879d('0x48')]&&!_0x203abc;_0x471d01+=0x1){_0x5850fa=_0x3756e0[_0x471d01]['toString']();if(manager[_0x879d('0x44')](_0x5850fa)){if(_0x4d7bc0[_0x5850fa]['cron']&&_0x4d7bc0[_0x5850fa][_0x879d('0x4d')]&&moment()['isBetween'](_0x4d7bc0[_0x5850fa][_0x879d('0x52')],_0x4d7bc0[_0x5850fa][_0x879d('0x4f')])){manager[_0x879d('0x53')](_0x5850fa,_0x4d7bc0[_0x5850fa]['cron'],handleJob(_0x4d7bc0[_0x5850fa]));logger[_0x879d('0xb')]('update\x20cron',_0x4d7bc0[_0x5850fa][_0x879d('0x16')],_0x4d7bc0[_0x5850fa]['cron']);}else{manager[_0x879d('0x50')](_0x5850fa);manager['deleteJob'](_0x5850fa);logger[_0x879d('0xb')]('stop\x20cron',_0x4d7bc0[_0x5850fa][_0x879d('0x16')],_0x4d7bc0[_0x5850fa][_0x879d('0x4c')]);}}}})[_0x879d('0x32')](function(_0x83f839){logger[_0x879d('0x33')](JSON[_0x879d('0x29')](_0x83f839));});}exports[_0x879d('0x54')]=function(_0x1bb804){return getJobs(_0x1bb804);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf818=['\x22%s\x22\x20<%s>','name','user','bcc','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','then','error','catch','error\x20mail','data','isNil','subtractNumber','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','keys','jobs','map','keyBy','toString','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','endAt','update\x20cron','run','path','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','auth','pass','format'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xf818,0x194));var _0x8f81=function(_0xee09a2,_0x579dab){_0xee09a2=_0xee09a2-0x0;var _0x509cdf=_0xf818[_0xee09a2];return _0x509cdf;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x8f81('0x0'));var _=require('lodash');var moment=require(_0x8f81('0x1'));var CronJobManager=require(_0x8f81('0x2'));var jayson=require(_0x8f81('0x3'));var BPromise=require(_0x8f81('0x4'));var logger=require('../logger')('schedule');var db=require(_0x8f81('0x5'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x8f81('0x6'));var client=jayson[_0x8f81('0x7')][_0x8f81('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x54baec,_0x1c5421){return function(){logger[_0x8f81('0x9')](_0x8f81('0xa'),_0x54baec[_0x8f81('0xb')]);var _0x5c1230=!![];var _0x2dab0a={'tls':{'rejectUnauthorized':![]}};if(_0x54baec['MailAccount'][_0x8f81('0xc')][_0x8f81('0xd')]){_0x2dab0a[_0x8f81('0xd')]=_0x54baec[_0x8f81('0xe')][_0x8f81('0xc')][_0x8f81('0xd')];}else{_0x2dab0a[_0x8f81('0xf')]=_0x54baec[_0x8f81('0xe')]['Smtp'][_0x8f81('0xf')];_0x2dab0a[_0x8f81('0x10')]=_0x54baec['MailAccount'][_0x8f81('0xc')][_0x8f81('0x10')];_0x2dab0a[_0x8f81('0x11')]=_0x54baec[_0x8f81('0xe')][_0x8f81('0xc')][_0x8f81('0x11')];}if(_0x54baec[_0x8f81('0xe')][_0x8f81('0xc')]['authentication']){_0x2dab0a[_0x8f81('0x12')]={'user':_0x54baec[_0x8f81('0xe')][_0x8f81('0xc')]['user'],'pass':_0x54baec[_0x8f81('0xe')][_0x8f81('0xc')][_0x8f81('0x13')]};}var _0x3f0510={'account':_0x2dab0a,'message':{'from':util[_0x8f81('0x14')](_0x8f81('0x15'),_0x54baec[_0x8f81('0xe')][_0x8f81('0x16')],_0x54baec[_0x8f81('0xe')][_0x8f81('0xb')]||_0x54baec['MailAccount'][_0x8f81('0xc')][_0x8f81('0x17')]),'to':_0x54baec[_0x8f81('0xb')],'cc':_0x54baec['cc'],'bcc':_0x54baec[_0x8f81('0x18')],'subject':util[_0x8f81('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x1c5421['name'],_0x54baec['subtractNumber'],_0x54baec['subtractUnit'])}};var _0x14a2e6=path[_0x8f81('0x19')](__dirname,_0x8f81('0x1a'));var _0x40cc2c=_0x1c5421[_0x8f81('0x1b')];var _0x1a0918=util['format'](_0x8f81('0x1c'),path[_0x8f81('0x1d')](_0x1c5421[_0x8f81('0x1b')],path[_0x8f81('0x1e')](_0x1c5421[_0x8f81('0x1b')])),_0x8f81('0x1f'));var _0x5bd371=path[_0x8f81('0x19')](_0x14a2e6,_0x40cc2c);var _0x5b0852=path[_0x8f81('0x19')](_0x14a2e6,_0x1a0918);if(fs['existsSync'](_0x5bd371)){_0x1c5421[_0x8f81('0x20')]='Sent';_0x3f0510[_0x8f81('0x21')][_0x8f81('0x22')]=[{'filename':_0x40cc2c,'path':_0x5bd371}];_0x3f0510['message']['text']=util[_0x8f81('0x14')](_0x8f81('0x23'),JSON[_0x8f81('0x24')](_0x1c5421,null,0x2));}else if(fs['existsSync'](_0x5b0852)){_0x1c5421['status']=_0x8f81('0x25');_0x3f0510[_0x8f81('0x21')][_0x8f81('0x22')]=[{'filename':_0x1a0918,'path':_0x5b0852}];}else{_0x3f0510[_0x8f81('0x21')]['text']=_0x8f81('0x26');if(!_0x54baec['sendIfEmpty']){_0x5c1230=![];logger[_0x8f81('0x9')](_0x8f81('0x27'));}}if(_0x5c1230){return client['request']('SendMail',_0x3f0510)[_0x8f81('0x28')](function(_0x53378f){if(_0x53378f['error']){return logger[_0x8f81('0x29')]('error\x20mail',JSON[_0x8f81('0x24')](_0x53378f));}return logger['info']('email\x20sent');})[_0x8f81('0x2a')](function(_0x4a9cb5){return logger[_0x8f81('0x29')](_0x8f81('0x2b'),JSON[_0x8f81('0x24')](_0x4a9cb5));});}};}function handleError(){return function(_0x4c92dc){return logger[_0x8f81('0x29')](JSON[_0x8f81('0x24')](_0x4c92dc));};}function handleResult(_0x27c9ab){return function(_0x445d07){logger[_0x8f81('0x9')](_0x8f81('0x2c'),JSON[_0x8f81('0x24')](_0x445d07));if(_0x27c9ab['MailAccount']&&_0x27c9ab[_0x8f81('0xe')][_0x8f81('0xc')]&&!_[_0x8f81('0x2d')](_0x27c9ab[_0x8f81('0xb')])){setTimeout(handleSendEmail(_0x27c9ab,_0x445d07),0x3c*0x3e8);}};}function handleJob(_0x1ea5a1){return function(){try{if(_[_0x8f81('0x2d')](_0x1ea5a1[_0x8f81('0x2e')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x8f81('0x2d')](_0x1ea5a1[_0x8f81('0x2f')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x21c19b={'startDate':moment()[_0x8f81('0x30')](_0x1ea5a1[_0x8f81('0x2e')],_0x1ea5a1[_0x8f81('0x2f')])['format'](_0x8f81('0x31')),'endDate':moment()[_0x8f81('0x14')](_0x8f81('0x31')),'type':_0x8f81('0x32'),'output':_0x1ea5a1[_0x8f81('0x33')],'name':_0x1ea5a1[_0x8f81('0x16')]};if(!_[_0x8f81('0x2d')](_0x1ea5a1[_0x8f81('0x34')])){logger[_0x8f81('0x9')](_0x8f81('0x35'),_0x1ea5a1[_0x8f81('0x34')]);return analyticDefaultReportController[_0x8f81('0x36')]({'id':_0x1ea5a1['DefaultReportId']},_0x21c19b)['then'](handleResult(_0x1ea5a1))['catch'](handleError());}if(!_[_0x8f81('0x2d')](_0x1ea5a1[_0x8f81('0x37')])){logger['info'](_0x8f81('0x38'),_0x1ea5a1[_0x8f81('0x37')]);return analyticCustomReportController[_0x8f81('0x36')]({'id':_0x1ea5a1[_0x8f81('0x37')]},_0x21c19b)[_0x8f81('0x28')](handleResult(_0x1ea5a1))[_0x8f81('0x2a')](handleError());}}catch(_0x538f80){logger[_0x8f81('0x29')](JSON[_0x8f81('0x24')](_0x538f80));}return logger[_0x8f81('0x9')](_0x8f81('0x39'));};}function getJobs(_0xc7a733){var _0x54a6b7={};if(_0xc7a733){_0x54a6b7['id']=_0xc7a733;}return db['Schedule']['findAll']({'where':_0x54a6b7,'include':[{'model':db[_0x8f81('0xe')],'attributes':['id','name',_0x8f81('0xb')],'include':[{'model':db['MailServerOut'],'as':_0x8f81('0xc')}]}]})[_0x8f81('0x28')](function(_0xa232bf){var _0x264128=_[_0x8f81('0x3a')](manager[_0x8f81('0x3b')]);var _0x2cc4c7=_[_0x8f81('0x3c')](_0xa232bf,function(_0x27754a){return _0x27754a['id']['toString']();});var _0x47257f=_[_0x8f81('0x3d')](_0xa232bf,function(_0x410113){return _0x410113['id'][_0x8f81('0x3e')]();});var _0x4d945e=_0xc7a733?_0x2cc4c7:_['difference'](_0x2cc4c7,_0x264128);var _0x11ea55=_[_0x8f81('0x3f')](_0x2cc4c7,_0x264128);var _0x2f174c=_['difference'](_0x264128,_0x2cc4c7);var _0x365971;var _0x17f8a0;for(_0x365971=0x0;_0x365971<_0x2f174c['length']&&!_0xc7a733;_0x365971+=0x1){_0x17f8a0=_0x2f174c[_0x365971][_0x8f81('0x3e')]();if(manager[_0x8f81('0x40')](_0x17f8a0)){manager[_0x8f81('0x41')](_0x17f8a0);manager[_0x8f81('0x42')](_0x17f8a0);logger[_0x8f81('0x9')](_0x8f81('0x43'),_0x17f8a0);}}logger[_0x8f81('0x9')](_0x8f81('0x44'),JSON[_0x8f81('0x24')](_0x4d945e));for(_0x365971=0x0;_0x365971<_0x4d945e[_0x8f81('0x45')];_0x365971+=0x1){_0x17f8a0=_0x4d945e[_0x365971]['toString']();logger['info'](_0x8f81('0x46'),_0x17f8a0);if(_0xc7a733){logger[_0x8f81('0x9')](_0x8f81('0x47'),_0xc7a733);logger[_0x8f81('0x9')](JSON[_0x8f81('0x24')](_0x47257f[_0x17f8a0]));BPromise[_0x8f81('0x48')]()[_0x8f81('0x28')](handleJob(_0x47257f[_0x17f8a0]));logger[_0x8f81('0x9')](_0x8f81('0x49'),_0x47257f[_0x17f8a0]['name'],_0x47257f[_0x17f8a0][_0x8f81('0x4a')]);}else if(_0x47257f[_0x17f8a0]['cron']&&_0x47257f[_0x17f8a0][_0x8f81('0x4b')]&&moment()[_0x8f81('0x4c')](_0x47257f[_0x17f8a0][_0x8f81('0x4d')],_0x47257f[_0x17f8a0]['endAt'])){manager[_0x8f81('0x4e')](_0x17f8a0,_0x47257f[_0x17f8a0][_0x8f81('0x4a')],handleJob(_0x47257f[_0x17f8a0]));manager[_0x8f81('0x4f')](_0x17f8a0);logger[_0x8f81('0x9')](_0x8f81('0x50'),_0x47257f[_0x17f8a0][_0x8f81('0x16')],_0x47257f[_0x17f8a0][_0x8f81('0x4a')]);}else if(manager[_0x8f81('0x40')](_0x17f8a0)){manager['stop'](_0x17f8a0);manager[_0x8f81('0x42')](_0x17f8a0);logger[_0x8f81('0x9')](_0x8f81('0x51'),_0x47257f[_0x17f8a0][_0x8f81('0x16')],_0x47257f[_0x17f8a0][_0x8f81('0x4a')]);}}for(_0x365971=0x0,_0x17f8a0;_0x365971<_0x11ea55[_0x8f81('0x45')]&&!_0xc7a733;_0x365971+=0x1){_0x17f8a0=_0x11ea55[_0x365971]['toString']();if(manager['exists'](_0x17f8a0)){if(_0x47257f[_0x17f8a0][_0x8f81('0x4a')]&&_0x47257f[_0x17f8a0][_0x8f81('0x4b')]&&moment()[_0x8f81('0x4c')](_0x47257f[_0x17f8a0]['startAt'],_0x47257f[_0x17f8a0][_0x8f81('0x52')])){manager['update'](_0x17f8a0,_0x47257f[_0x17f8a0][_0x8f81('0x4a')],handleJob(_0x47257f[_0x17f8a0]));logger['info'](_0x8f81('0x53'),_0x47257f[_0x17f8a0][_0x8f81('0x16')],_0x47257f[_0x17f8a0][_0x8f81('0x4a')]);}else{manager[_0x8f81('0x41')](_0x17f8a0);manager[_0x8f81('0x42')](_0x17f8a0);logger[_0x8f81('0x9')](_0x8f81('0x51'),_0x47257f[_0x17f8a0]['name'],_0x47257f[_0x17f8a0][_0x8f81('0x4a')]);}}}})[_0x8f81('0x2a')](function(_0x291d49){logger[_0x8f81('0x29')](JSON[_0x8f81('0x24')](_0x291d49));});}exports[_0x8f81('0x54')]=function(_0x57cc68){return getJobs(_0x57cc68);};exports[_0x8f81('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 0673037..55b56bd 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 _0x4219=['sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Cloud\x20Provider\x20not\x20configured','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','start','aws-sdk','request-promise','util','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested'];(function(_0x1782a6,_0x388e8f){var _0x39fd37=function(_0xe85e07){while(--_0xe85e07){_0x1782a6['push'](_0x1782a6['shift']());}};_0x39fd37(++_0x388e8f);}(_0x4219,0xaf));var _0x9421=function(_0x540deb,_0x1e537d){_0x540deb=_0x540deb-0x0;var _0x445c96=_0x4219[_0x540deb];return _0x445c96;};var _=require('lodash');var AWS=require(_0x9421('0x0'));var rp=require(_0x9421('0x1'));var util=require(_0x9421('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x9421('0x3'));function getTranscriptionJob(_0x31c355,_0x5df79d,_0x32dd87,_0x204620){return new Promise(function(_0x57c5e1,_0x19df02){var _0x59ef38=new AWS[(_0x9421('0x4'))]({'accessKeyId':_0x5df79d,'secretAccessKey':_0x31c355,'region':_0x32dd87});_0x59ef38[_0x9421('0x5')]({'TranscriptionJobName':_0x204620},function(_0x18c1ab,_0x4e2305){if(_0x18c1ab){return _0x19df02(_0x18c1ab);}else{return _0x57c5e1(_0x4e2305);}});});}function sentiment(_0x29d036,_0xb59895,_0x395c95,_0x4e7a68,_0x20afb4){return new Promise(function(_0x3aea83,_0x5c31a4){var _0x183f3e=new AWS[(_0x9421('0x6'))]({'accessKeyId':_0xb59895,'secretAccessKey':_0x29d036,'region':_0x395c95});_0x183f3e[_0x9421('0x7')]({'Text':_0x4e7a68,'LanguageCode':_0x20afb4[_0x9421('0x8')](0x0,0x2)},function(_0x4ab291,_0x20ed6d){if(_0x4ab291){return _0x5c31a4(_0x4ab291);}else{return _0x3aea83(_0x20ed6d);}});});}function checkTranscribeJob(_0x396cbd,_0x2c6e56,_0x417c5c){var _0x531ea3;return new BPromise(function(_0x163b31,_0x580f16){logger[_0x9421('0x9')](util['format'](_0x9421('0xa'),_0x396cbd['id'],_0x396cbd[_0x9421('0xb')]));return getTranscriptionJob(_0x417c5c['data1'],_0x417c5c[_0x9421('0xc')],_0x2c6e56[_0x9421('0xd')],_0x396cbd[_0x9421('0xb')])[_0x9421('0xe')](function(_0x212bf1){logger[_0x9421('0x9')](util['format'](_0x9421('0xf'),_0x396cbd['id'],_0x396cbd[_0x9421('0xb')],_0x212bf1[_0x9421('0x10')][_0x9421('0x11')]));if(!_0x396cbd[_0x9421('0x12')]){switch(_0x212bf1['TranscriptionJob'][_0x9421('0x11')]){case _0x9421('0x13'):var _0x34c559={'transcribeStatus':_0x212bf1[_0x9421('0x10')][_0x9421('0x11')],'fileUri':_0x212bf1[_0x9421('0x10')][_0x9421('0x14')]['TranscriptFileUri']};logger[_0x9421('0x9')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x396cbd['id']));return rp({'uri':_0x212bf1[_0x9421('0x10')][_0x9421('0x14')][_0x9421('0x15')],'json':!![]})['then'](function(_0x3cefac){logger[_0x9421('0x9')](util[_0x9421('0x16')](_0x9421('0x17'),_0x396cbd['id']));if(_0x3cefac&&_0x3cefac[_0x9421('0x18')]&&_0x3cefac[_0x9421('0x18')][_0x9421('0x19')]&&_0x3cefac[_0x9421('0x18')]['transcripts'][_0x9421('0x1a')]){_0x34c559[_0x9421('0x12')]='';for(var _0x460edb=0x0;_0x460edb<_0x3cefac[_0x9421('0x18')]['transcripts'][_0x9421('0x1a')];_0x460edb++){_0x34c559['fileText']+=_0x3cefac[_0x9421('0x18')][_0x9421('0x19')][_0x460edb]['transcript']+'';}}return _0x396cbd[_0x9421('0x1b')](_0x34c559);})[_0x9421('0xe')](function(){logger[_0x9421('0x9')](util[_0x9421('0x16')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x396cbd['id']));if(!_0x396cbd[_0x9421('0x1c')]){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))](_0x9421('0x1f'));}if(!_0x2c6e56[_0x9421('0x20')]||!_0x2c6e56[_0x9421('0x21')]||!_0x2c6e56[_0x9421('0x22')]||!_0x2c6e56['language']||!_0x2c6e56[_0x9421('0x23')]){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))](_0x9421('0x24'));}if(!_0x34c559[_0x9421('0x12')]){throw new Error(_0x9421('0x25'));}if(_0x2c6e56[_0x9421('0x21')]===_0x417c5c['id']){return _0x417c5c;}else{return db['CloudProvider'][_0x9421('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x9421('0xe')](function(_0x198fa2){if(!_0x198fa2){throw new db[(_0x9421('0x1d'))]['ValidationError'](_0x9421('0x27'));}if(!_0x198fa2[_0x9421('0x28')]||!_0x198fa2['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x531ea3=_0x198fa2;logger['info'](util[_0x9421('0x16')](_0x9421('0x29'),_0x396cbd['id']));return sentiment(_0x531ea3[_0x9421('0x28')],_0x531ea3['data2'],_0x2c6e56[_0x9421('0x22')],_0x34c559[_0x9421('0x12')],_0x2c6e56[_0x9421('0x2a')]);})[_0x9421('0xe')](function(_0x13e891){logger[_0x9421('0x9')](util[_0x9421('0x16')](_0x9421('0x2b'),_0x396cbd['id']));return _0x396cbd[_0x9421('0x1b')]({'sentiment':_0x13e891[_0x9421('0x2c')],'sPositive':_0x13e891[_0x9421('0x2d')][_0x9421('0x2e')],'sNegative':_0x13e891['SentimentScore']['Negative'],'sMixed':_0x13e891['SentimentScore'][_0x9421('0x2f')],'sNeutral':_0x13e891['SentimentScore'][_0x9421('0x30')]});})[_0x9421('0xe')](function(){logger[_0x9421('0x9')](util[_0x9421('0x16')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x396cbd['id']));_0x163b31();});case _0x9421('0x31'):return _0x396cbd['update']({'transcribeStatus':_0x9421('0x31'),'failureReason':_0x212bf1[_0x9421('0x10')]['FailureReason']})[_0x9421('0xe')](function(){logger['info'](util[_0x9421('0x16')](_0x9421('0x32'),_0x396cbd['id']));_0x163b31();});default:logger[_0x9421('0x9')](util['format'](_0x9421('0x33'),_0x396cbd['id']));break;}}else{return BPromise[_0x9421('0x34')]()[_0x9421('0xe')](function(){if(!_0x396cbd[_0x9421('0x1c')]){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))](_0x9421('0x1f'));}if(!_0x2c6e56[_0x9421('0x20')]||!_0x2c6e56['sentimentAccountId']||!_0x2c6e56[_0x9421('0x22')]||!_0x2c6e56['language']||!_0x2c6e56[_0x9421('0x23')]){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x396cbd[_0x9421('0x12')]){throw new Error(_0x9421('0x25'));}if(_0x2c6e56['sentimentAccountId']===_0x417c5c['id']){return _0x417c5c;}else{return db[_0x9421('0x35')][_0x9421('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x9421('0xe')](function(_0x555ac3){if(!_0x555ac3){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))](_0x9421('0x27'));}if(!_0x555ac3[_0x9421('0x28')]||!_0x555ac3[_0x9421('0xc')]){throw new db[(_0x9421('0x1d'))]['ValidationError'](_0x9421('0x36'));}_0x531ea3=_0x555ac3;logger[_0x9421('0x9')](util[_0x9421('0x16')](_0x9421('0x29'),_0x396cbd['id']));return sentiment(_0x531ea3[_0x9421('0x28')],_0x531ea3[_0x9421('0xc')],_0x2c6e56[_0x9421('0x22')],_0x396cbd[_0x9421('0x12')],_0x2c6e56['language']);})[_0x9421('0xe')](function(_0x5b1224){logger[_0x9421('0x9')](util[_0x9421('0x16')](_0x9421('0x2b'),_0x396cbd['id']));return _0x396cbd[_0x9421('0x1b')]({'sentiment':_0x5b1224['Sentiment'],'sPositive':_0x5b1224[_0x9421('0x2d')]['Positive'],'sNegative':_0x5b1224[_0x9421('0x2d')]['Negative'],'sMixed':_0x5b1224[_0x9421('0x2d')][_0x9421('0x2f')],'sNeutral':_0x5b1224[_0x9421('0x2d')][_0x9421('0x30')],'transcribeStatus':_0x9421('0x13')});})[_0x9421('0xe')](function(){logger[_0x9421('0x9')](util[_0x9421('0x16')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x396cbd['id']));_0x163b31();});}})['catch'](function(_0x245696){if(_0x245696){if(!_0x245696[_0x9421('0x37')]||_0x245696[_0x9421('0x37')]!==_0x9421('0x38')){logger[_0x9421('0x39')](util['format'](_0x9421('0x3a'),_0x396cbd['id']),util[_0x9421('0x3b')](_0x245696,{'showHidden':![],'depth':null}));}}_0x163b31();});});}function checkTranscribe(){var _0x193062;var _0xb5dc9d;var _0x5f05c9;return db['VoiceRecording'][_0x9421('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0xceea9b){if(!_0xceea9b||!_0xceea9b[_0x9421('0x1a')]){throw new db['Sequelize'][(_0x9421('0x1e'))](_0x9421('0x3d'));}_0x193062=_0xceea9b;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x9421('0xe')](function(_0x3a4972){if(!_0x3a4972){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))](_0x9421('0x3e'));}_0xb5dc9d=_0x3a4972;if(!_0xb5dc9d[_0x9421('0x3')]||!_0xb5dc9d[_0x9421('0x3f')]||!_0xb5dc9d[_0x9421('0xd')]||!_0xb5dc9d[_0x9421('0x2a')]||!_0xb5dc9d[_0x9421('0x23')]){throw new db['Sequelize'][(_0x9421('0x1e'))](_0x9421('0x40'));}return db['CloudProvider'][_0x9421('0x26')]({'where':{'id':_0xb5dc9d[_0x9421('0x3f')]}});})['then'](function(_0x3bec81){if(!_0x3bec81){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3bec81[_0x9421('0x28')]||!_0x3bec81[_0x9421('0xc')]){throw new db[(_0x9421('0x1d'))][(_0x9421('0x1e'))](_0x9421('0x36'));}_0x5f05c9=_0x3bec81;var _0x5afe8b=[];_0x193062[_0x9421('0x41')](function(_0x57c5bb){_0x5afe8b['push'](checkTranscribeJob(_0x57c5bb,_0xb5dc9d,_0x5f05c9));});return BPromise[_0x9421('0x42')](_0x5afe8b);})[_0x9421('0x43')](function(_0x2512b7){if(_0x2512b7){if(!_0x2512b7['name']||_0x2512b7[_0x9421('0x37')]!==_0x9421('0x38')){logger[_0x9421('0x39')](util[_0x9421('0x3b')](_0x2512b7,{'showHidden':![],'depth':null}));}}});}exports[_0x9421('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8d90=['TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Cloud\x20Provider\x20not\x20available','data1','Mixed','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe'];(function(_0x56a267,_0x17d06c){var _0x40ac38=function(_0x190dfa){while(--_0x190dfa){_0x56a267['push'](_0x56a267['shift']());}};_0x40ac38(++_0x17d06c);}(_0x8d90,0x11a));var _0x08d9=function(_0x94e688,_0x30bd99){_0x94e688=_0x94e688-0x0;var _0x4a8237=_0x8d90[_0x94e688];return _0x4a8237;};var _=require(_0x08d9('0x0'));var AWS=require(_0x08d9('0x1'));var rp=require('request-promise');var util=require(_0x08d9('0x2'));var BPromise=require(_0x08d9('0x3'));var db=require(_0x08d9('0x4'))['db'];var logger=require('../../config/logger')(_0x08d9('0x5'));function getTranscriptionJob(_0x4fd65f,_0x20afcd,_0x539ae6,_0x4c0416){return new Promise(function(_0x284075,_0x23fa08){var _0x38cdbd=new AWS[(_0x08d9('0x6'))]({'accessKeyId':_0x20afcd,'secretAccessKey':_0x4fd65f,'region':_0x539ae6});_0x38cdbd[_0x08d9('0x7')]({'TranscriptionJobName':_0x4c0416},function(_0x74d550,_0x56bda3){if(_0x74d550){return _0x23fa08(_0x74d550);}else{return _0x284075(_0x56bda3);}});});}function sentiment(_0x43f6f8,_0x28a15b,_0x3c229e,_0x1426e2,_0x5cb779){return new Promise(function(_0x5e4f0f,_0xc32ca6){var _0x45a586=new AWS['Comprehend']({'accessKeyId':_0x28a15b,'secretAccessKey':_0x43f6f8,'region':_0x3c229e});_0x45a586[_0x08d9('0x8')]({'Text':_0x1426e2,'LanguageCode':_0x5cb779[_0x08d9('0x9')](0x0,0x2)},function(_0x47d7de,_0x160065){if(_0x47d7de){return _0xc32ca6(_0x47d7de);}else{return _0x5e4f0f(_0x160065);}});});}function checkTranscribeJob(_0xc43352,_0x739b08,_0x27e70c){var _0x3ac911;return new BPromise(function(_0x5bce46,_0x1bf5e2){logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0xc'),_0xc43352['id'],_0xc43352[_0x08d9('0xd')]));return getTranscriptionJob(_0x27e70c['data1'],_0x27e70c[_0x08d9('0xe')],_0x739b08[_0x08d9('0xf')],_0xc43352['transcribeName'])[_0x08d9('0x10')](function(_0x1cd024){logger['info'](util[_0x08d9('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xc43352['id'],_0xc43352[_0x08d9('0xd')],_0x1cd024[_0x08d9('0x11')][_0x08d9('0x12')]));if(!_0xc43352[_0x08d9('0x13')]){switch(_0x1cd024['TranscriptionJob'][_0x08d9('0x12')]){case'COMPLETED':var _0x1d0f7b={'transcribeStatus':_0x1cd024['TranscriptionJob'][_0x08d9('0x12')],'fileUri':_0x1cd024['TranscriptionJob']['Transcript']['TranscriptFileUri']};logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x14'),_0xc43352['id']));return rp({'uri':_0x1cd024[_0x08d9('0x11')][_0x08d9('0x15')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x5835bd){logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x16'),_0xc43352['id']));if(_0x5835bd&&_0x5835bd[_0x08d9('0x17')]&&_0x5835bd['results'][_0x08d9('0x18')]&&_0x5835bd['results'][_0x08d9('0x18')][_0x08d9('0x19')]){_0x1d0f7b[_0x08d9('0x13')]='';for(var _0x521819=0x0;_0x521819<_0x5835bd[_0x08d9('0x17')][_0x08d9('0x18')]['length'];_0x521819++){_0x1d0f7b['fileText']+=_0x5835bd[_0x08d9('0x17')][_0x08d9('0x18')][_0x521819][_0x08d9('0x1a')]+'';}}return _0xc43352['update'](_0x1d0f7b);})[_0x08d9('0x10')](function(){logger['info'](util[_0x08d9('0xb')](_0x08d9('0x1b'),_0xc43352['id']));if(!_0xc43352[_0x08d9('0x1c')]){throw new db['Sequelize'][(_0x08d9('0x1d'))](_0x08d9('0x1e'));}if(!_0x739b08[_0x08d9('0x1f')]||!_0x739b08['sentimentAccountId']||!_0x739b08[_0x08d9('0x20')]||!_0x739b08[_0x08d9('0x21')]||!_0x739b08[_0x08d9('0x22')]){throw new db[(_0x08d9('0x23'))][(_0x08d9('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1d0f7b[_0x08d9('0x13')]){throw new Error(_0x08d9('0x24'));}if(_0x739b08['sentimentAccountId']===_0x27e70c['id']){return _0x27e70c;}else{return db[_0x08d9('0x25')][_0x08d9('0x26')]({'where':{'id':_settings[_0x08d9('0x27')]}});}})['then'](function(_0x4b7462){if(!_0x4b7462){throw new db[(_0x08d9('0x23'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4b7462['data1']||!_0x4b7462[_0x08d9('0xe')]){throw new db[(_0x08d9('0x23'))]['ValidationError'](_0x08d9('0x28'));}_0x3ac911=_0x4b7462;logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x29'),_0xc43352['id']));return sentiment(_0x3ac911['data1'],_0x3ac911[_0x08d9('0xe')],_0x739b08['sentimentRegion'],_0x1d0f7b[_0x08d9('0x13')],_0x739b08['language']);})[_0x08d9('0x10')](function(_0x5f071d){logger[_0x08d9('0xa')](util['format'](_0x08d9('0x2a'),_0xc43352['id']));return _0xc43352[_0x08d9('0x2b')]({'sentiment':_0x5f071d[_0x08d9('0x2c')],'sPositive':_0x5f071d[_0x08d9('0x2d')][_0x08d9('0x2e')],'sNegative':_0x5f071d['SentimentScore']['Negative'],'sMixed':_0x5f071d['SentimentScore']['Mixed'],'sNeutral':_0x5f071d[_0x08d9('0x2d')][_0x08d9('0x2f')]});})[_0x08d9('0x10')](function(){logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x1b'),_0xc43352['id']));_0x5bce46();});case _0x08d9('0x30'):return _0xc43352[_0x08d9('0x2b')]({'transcribeStatus':_0x08d9('0x30'),'failureReason':_0x1cd024[_0x08d9('0x11')][_0x08d9('0x31')]})[_0x08d9('0x10')](function(){logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x1b'),_0xc43352['id']));_0x5bce46();});default:logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x32'),_0xc43352['id']));break;}}else{return BPromise['resolve']()[_0x08d9('0x10')](function(){if(!_0xc43352[_0x08d9('0x1c')]){throw new db['Sequelize'][(_0x08d9('0x1d'))](_0x08d9('0x1e'));}if(!_0x739b08['sentiment']||!_0x739b08['sentimentAccountId']||!_0x739b08[_0x08d9('0x20')]||!_0x739b08['language']||!_0x739b08['bucket']){throw new db[(_0x08d9('0x23'))][(_0x08d9('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xc43352[_0x08d9('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x739b08[_0x08d9('0x27')]===_0x27e70c['id']){return _0x27e70c;}else{return db[_0x08d9('0x25')][_0x08d9('0x26')]({'where':{'id':_settings[_0x08d9('0x27')]}});}})['then'](function(_0x16afc4){if(!_0x16afc4){throw new db[(_0x08d9('0x23'))][(_0x08d9('0x1d'))](_0x08d9('0x33'));}if(!_0x16afc4[_0x08d9('0x34')]||!_0x16afc4[_0x08d9('0xe')]){throw new db[(_0x08d9('0x23'))][(_0x08d9('0x1d'))](_0x08d9('0x28'));}_0x3ac911=_0x16afc4;logger[_0x08d9('0xa')](util[_0x08d9('0xb')](_0x08d9('0x29'),_0xc43352['id']));return sentiment(_0x3ac911[_0x08d9('0x34')],_0x3ac911[_0x08d9('0xe')],_0x739b08[_0x08d9('0x20')],_0xc43352[_0x08d9('0x13')],_0x739b08[_0x08d9('0x21')]);})[_0x08d9('0x10')](function(_0x37d1bf){logger['info'](util['format'](_0x08d9('0x2a'),_0xc43352['id']));return _0xc43352[_0x08d9('0x2b')]({'sentiment':_0x37d1bf[_0x08d9('0x2c')],'sPositive':_0x37d1bf[_0x08d9('0x2d')][_0x08d9('0x2e')],'sNegative':_0x37d1bf[_0x08d9('0x2d')]['Negative'],'sMixed':_0x37d1bf['SentimentScore'][_0x08d9('0x35')],'sNeutral':_0x37d1bf[_0x08d9('0x2d')][_0x08d9('0x2f')],'transcribeStatus':'COMPLETED'});})[_0x08d9('0x10')](function(){logger[_0x08d9('0xa')](util['format'](_0x08d9('0x1b'),_0xc43352['id']));_0x5bce46();});}})['catch'](function(_0x493ec8){if(_0x493ec8){if(!_0x493ec8[_0x08d9('0x36')]||_0x493ec8[_0x08d9('0x36')]!==_0x08d9('0x37')){logger[_0x08d9('0x38')](util[_0x08d9('0xb')](_0x08d9('0x39'),_0xc43352['id']),util[_0x08d9('0x3a')](_0x493ec8,{'showHidden':![],'depth':null}));}}_0x5bce46();});});}function checkTranscribe(){var _0x4143c3;var _0x200302;var _0x447c74;return db[_0x08d9('0x3b')][_0x08d9('0x3c')]({'where':{'transcribeStatus':_0x08d9('0x3d')}})[_0x08d9('0x10')](function(_0x218fe9){if(!_0x218fe9||!_0x218fe9[_0x08d9('0x19')]){throw new db['Sequelize'][(_0x08d9('0x1d'))](_0x08d9('0x3e'));}_0x4143c3=_0x218fe9;return db[_0x08d9('0x3f')][_0x08d9('0x26')]({'where':{'id':0x1}});})[_0x08d9('0x10')](function(_0xa29080){if(!_0xa29080){throw new db[(_0x08d9('0x23'))][(_0x08d9('0x1d'))](_0x08d9('0x40'));}_0x200302=_0xa29080;if(!_0x200302[_0x08d9('0x5')]||!_0x200302[_0x08d9('0x41')]||!_0x200302['transcribeRegion']||!_0x200302[_0x08d9('0x21')]||!_0x200302[_0x08d9('0x22')]){throw new db['Sequelize'][(_0x08d9('0x1d'))](_0x08d9('0x42'));}return db[_0x08d9('0x25')]['findOne']({'where':{'id':_0x200302[_0x08d9('0x41')]}});})[_0x08d9('0x10')](function(_0x293b4b){if(!_0x293b4b){throw new db[(_0x08d9('0x23'))]['ValidationError'](_0x08d9('0x33'));}if(!_0x293b4b[_0x08d9('0x34')]||!_0x293b4b['data2']){throw new db[(_0x08d9('0x23'))][(_0x08d9('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x447c74=_0x293b4b;var _0x553bea=[];_0x4143c3[_0x08d9('0x43')](function(_0x38be2c){_0x553bea[_0x08d9('0x44')](checkTranscribeJob(_0x38be2c,_0x200302,_0x447c74));});return BPromise[_0x08d9('0x45')](_0x553bea);})[_0x08d9('0x46')](function(_0xa93112){if(_0xa93112){if(!_0xa93112[_0x08d9('0x36')]||_0xa93112[_0x08d9('0x36')]!=='SequelizeValidationError'){logger[_0x08d9('0x38')](util['inspect'](_0xa93112,{'showHidden':![],'depth':null}));}}});}exports[_0x08d9('0x47')]=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 551e854..f3f592e 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 _0x0517=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map'];(function(_0x18dbf4,_0x28c747){var _0x881810=function(_0x429331){while(--_0x429331){_0x18dbf4['push'](_0x18dbf4['shift']());}};_0x881810(++_0x28c747);}(_0x0517,0x1ad));var _0x7051=function(_0xc78da,_0x226968){_0xc78da=_0xc78da-0x0;var _0x5dca87=_0x0517[_0xc78da];return _0x5dca87;};'use strict';var _=require(_0x7051('0x0'));var moment=require(_0x7051('0x1'));var Redis=require(_0x7051('0x2'));var util=require(_0x7051('0x3'));var config=require(_0x7051('0x4'));var db=require(_0x7051('0x5'))['db'];var logger=require(_0x7051('0x6'))(_0x7051('0x7'));config[_0x7051('0x8')]=_[_0x7051('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7051('0xa'))(new Redis(config[_0x7051('0x8')]));function closeInteractions(){var _0x25957b=[];return db[_0x7051('0xb')][_0x7051('0xc')]({'raw':!![],'attributes':['id',_0x7051('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7051('0xe')](0x18,_0x7051('0xf'))}}})[_0x7051('0x10')](function(_0x2156f6){if(_0x2156f6&&_0x2156f6[_0x7051('0x11')]){_0x25957b=_[_0x7051('0x12')](_0x2156f6||[],'id');logger[_0x7051('0x13')](_0x7051('0x14'),_0x25957b[_0x7051('0x15')]());return db[_0x7051('0xb')]['update']({'closeReason':'system','disposition':_0x7051('0x16'),'closed':!![],'closedAt':moment()[_0x7051('0x17')](_0x7051('0x18'))},{'where':{'id':_0x25957b}});}})[_0x7051('0x10')](function(){if(_0x25957b&&_0x25957b[_0x7051('0x11')]){logger[_0x7051('0x13')](_0x7051('0x19'),_0x25957b[_0x7051('0x15')]());for(var _0x336b34=0x0;_0x336b34<_0x25957b[_0x7051('0x11')];_0x336b34++){io[_0x7051('0x1a')](_0x7051('0x1b'),{'id':_0x25957b[_0x336b34],'closed':!![]});}}})[_0x7051('0x1c')](function(_0x290275){logger[_0x7051('0x1d')](_0x7051('0x1e'),_0x290275?util[_0x7051('0x1f')](_0x290275,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x284a=['util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis'];(function(_0x296ad6,_0x3ea2a8){var _0x9a9438=function(_0x2f190c){while(--_0x2f190c){_0x296ad6['push'](_0x296ad6['shift']());}};_0x9a9438(++_0x3ea2a8);}(_0x284a,0x13d));var _0xa284=function(_0x41c8ff,_0x17121f){_0x41c8ff=_0x41c8ff-0x0;var _0x1543fb=_0x284a[_0x41c8ff];return _0x1543fb;};'use strict';var _=require(_0xa284('0x0'));var moment=require(_0xa284('0x1'));var Redis=require(_0xa284('0x2'));var util=require(_0xa284('0x3'));var config=require('../../config/environment');var db=require(_0xa284('0x4'))['db'];var logger=require(_0xa284('0x5'))('schedule');config[_0xa284('0x6')]=_[_0xa284('0x7')](config[_0xa284('0x6')],{'host':_0xa284('0x8'),'port':0x18eb});var io=require(_0xa284('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1cc852=[];return db['WhatsappInteraction'][_0xa284('0xa')]({'raw':!![],'attributes':['id',_0xa284('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa284('0xc')](0x18,_0xa284('0xd'))}}})[_0xa284('0xe')](function(_0x213756){if(_0x213756&&_0x213756[_0xa284('0xf')]){_0x1cc852=_[_0xa284('0x10')](_0x213756||[],'id');logger[_0xa284('0x11')](_0xa284('0x12'),_0x1cc852[_0xa284('0x13')]());return db[_0xa284('0x14')]['update']({'closeReason':_0xa284('0x15'),'disposition':_0xa284('0x16'),'closed':!![],'closedAt':moment()[_0xa284('0x17')](_0xa284('0x18'))},{'where':{'id':_0x1cc852}});}})[_0xa284('0xe')](function(){if(_0x1cc852&&_0x1cc852[_0xa284('0xf')]){logger['info'](_0xa284('0x19'),_0x1cc852[_0xa284('0x13')]());for(var _0x3b9ce1=0x0;_0x3b9ce1<_0x1cc852[_0xa284('0xf')];_0x3b9ce1++){io[_0xa284('0x1a')](_0xa284('0x1b'),{'id':_0x1cc852[_0x3b9ce1],'closed':!![]});}}})[_0xa284('0x1c')](function(_0x3964fb){logger[_0xa284('0x1d')](_0xa284('0x1e'),_0x3964fb?util[_0xa284('0x1f')](_0x3964fb,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4ae5033..df0d792 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03c8=['@xcally.com','now','Innocenzo','destroy','CmContact','bulkCreate','then','log','contacts1','CmHopper','hopper1','finished\x20populating','contacts2','hopper2','catch','../mysqldb','push','Biondo','innocenzo.biondo'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x03c8,0xcd));var _0x803c=function(_0x3d79c9,_0x28c56a){_0x3d79c9=_0x3d79c9-0x0;var _0x454fdf=_0x03c8[_0x3d79c9];return _0x454fdf;};'use strict';var util=require('util');var db=require(_0x803c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x803c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x803c('0x2')+i,'phone':0xf879fb460+i,'email':_0x803c('0x3')+i+_0x803c('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x803c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x803c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x803c('0x5')](),'updatedAt':Date[_0x803c('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x803c('0x6')+i,'lastName':_0x803c('0x2')+i,'phone':0xf879fb460+i,'email':_0x803c('0x3')+i+_0x803c('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x803c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x803c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x803c('0x5')]()});}db['CmContact'][_0x803c('0x7')]({'where':{}})['then'](function(){return db[_0x803c('0x8')][_0x803c('0x9')](contacts);})[_0x803c('0xa')](function(){console[_0x803c('0xb')]('finished\x20populating',_0x803c('0xc'));return db[_0x803c('0xd')][_0x803c('0x7')]({'where':{}});})[_0x803c('0xa')](function(){return db[_0x803c('0xd')][_0x803c('0x9')](hopper);})[_0x803c('0xa')](function(){console['log']('finished\x20populating',_0x803c('0xe'));return db[_0x803c('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x803c('0xb')](_0x803c('0xf'),_0x803c('0x10'));return db['CmHopper'][_0x803c('0x9')](hopper2);})[_0x803c('0xa')](function(){console[_0x803c('0xb')](_0x803c('0xf'),_0x803c('0x11'));})[_0x803c('0x12')](function(_0x3e8376){console[_0x803c('0xb')](_0x3e8376);}); \ No newline at end of file +var _0xb77b=['contacts2','CmHopper','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','hopper1','bulkCreate'];(function(_0x2bf59c,_0x252567){var _0xd76bf8=function(_0x16fea5){while(--_0x16fea5){_0x2bf59c['push'](_0x2bf59c['shift']());}};_0xd76bf8(++_0x252567);}(_0xb77b,0x17e));var _0xbb77=function(_0x3292c3,_0x2f1e3b){_0x3292c3=_0x3292c3-0x0;var _0x572074=_0xb77b[_0x3292c3];return _0x572074;};'use strict';var util=require('util');var db=require(_0xbb77('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbb77('0x1')]({'id':i,'firstName':_0xbb77('0x2')+i,'lastName':_0xbb77('0x3')+i,'phone':0xf879fb460+i,'email':_0xbb77('0x4')+i+_0xbb77('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbb77('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xbb77('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbb77('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbb77('0x1')]({'id':i,'firstName':_0xbb77('0x2')+i,'lastName':_0xbb77('0x3')+i,'phone':0xf879fb460+i,'email':_0xbb77('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbb77('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xbb77('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbb77('0x6')](),'updatedAt':Date['now']()});}db[_0xbb77('0x7')][_0xbb77('0x8')]({'where':{}})[_0xbb77('0x9')](function(){return db[_0xbb77('0x7')]['bulkCreate'](contacts);})[_0xbb77('0x9')](function(){console[_0xbb77('0xa')](_0xbb77('0xb'),'contacts1');return db['CmHopper'][_0xbb77('0x8')]({'where':{}});})[_0xbb77('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console['log'](_0xbb77('0xb'),_0xbb77('0xc'));return db[_0xbb77('0x7')][_0xbb77('0xd')](contacts2);})[_0xbb77('0x9')](function(){console[_0xbb77('0xa')](_0xbb77('0xb'),_0xbb77('0xe'));return db[_0xbb77('0xf')]['bulkCreate'](hopper2);})[_0xbb77('0x9')](function(){console[_0xbb77('0xa')](_0xbb77('0xb'),_0xbb77('0x10'));})[_0xbb77('0x11')](function(_0x2aaac4){console[_0xbb77('0xa')](_0x2aaac4);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ead5aef..b88ee88 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7363=['agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s'];(function(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0x7363,0xc2));var _0x3736=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x7363[_0xab2afb];return _0x25262b;};'use strict';var util=require('util');var db=require(_0x3736('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3736('0x1')]({'name':util[_0x3736('0x2')](_0x3736('0x3'),_0x3736('0x4'),i),'fullname':util['format']('%s%s',_0x3736('0x4'),i),'email':util[_0x3736('0x2')](_0x3736('0x5'),_0x3736('0x4'),i),'role':'agent','password':_0x3736('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x3736('0x7'),'ws',_0x3736('0x8')],'disallow':[_0x3736('0x9')],'allow':[_0x3736('0xa')],'defaultuser':util[_0x3736('0x2')](_0x3736('0x3'),_0x3736('0x4'),i),'encryption':_0x3736('0xb'),'avpf':_0x3736('0xb'),'force_avp':_0x3736('0xb'),'icesupport':_0x3736('0xb'),'dtlsenable':_0x3736('0xb'),'dtlsverify':'no','dtlscertfile':_0x3736('0xc'),'dtlsprivatekey':_0x3736('0xd'),'dtlssetup':_0x3736('0xe'),'callerid':util['format'](_0x3736('0xf'),util[_0x3736('0x2')](_0x3736('0x3'),'agent',i),0xfa0+i)});}db[_0x3736('0x10')][_0x3736('0x11')](users)[_0x3736('0x12')](function(){console[_0x3736('0x13')](_0x3736('0x14'));})[_0x3736('0x15')](function(_0x2eeecb){console['log'](_0x2eeecb);}); \ No newline at end of file +var _0xddff=['yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x279787,_0x5ef473){var _0x495cdc=function(_0x3fa714){while(--_0x3fa714){_0x279787['push'](_0x279787['shift']());}};_0x495cdc(++_0x5ef473);}(_0xddff,0xb1));var _0xfddf=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0xddff[_0x343090];return _0x3ff3e8;};'use strict';var util=require('util');var db=require(_0xfddf('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xfddf('0x1')]({'name':util['format'](_0xfddf('0x2'),_0xfddf('0x3'),i),'fullname':util[_0xfddf('0x4')](_0xfddf('0x2'),_0xfddf('0x3'),i),'email':util[_0xfddf('0x4')](_0xfddf('0x5'),_0xfddf('0x3'),i),'role':_0xfddf('0x3'),'password':_0xfddf('0x6'),'internal':0xfa0+i,'type':_0xfddf('0x7'),'transport':[_0xfddf('0x8'),'ws',_0xfddf('0x9')],'disallow':[_0xfddf('0xa')],'allow':[_0xfddf('0xb')],'defaultuser':util[_0xfddf('0x4')](_0xfddf('0x2'),'agent',i),'encryption':_0xfddf('0xc'),'avpf':_0xfddf('0xc'),'force_avp':_0xfddf('0xc'),'icesupport':_0xfddf('0xc'),'dtlsenable':_0xfddf('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xfddf('0xd'),'callerid':util[_0xfddf('0x4')](_0xfddf('0xe'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xfddf('0xf')][_0xfddf('0x10')](users)[_0xfddf('0x11')](function(){console[_0xfddf('0x12')](_0xfddf('0x13'));})[_0xfddf('0x14')](function(_0x4a1f9){console[_0xfddf('0x12')](_0x4a1f9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 321ec7d..8b190b5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeaa2=['map','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','CONNECTED','lodash','bluebird','name','Agents','User','role','telephone','agent','type','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','Telephones','findAll','IvrCampaigns','resourceId','where','Campaign','ivr','%s:queue:%s','format','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueue','MailQueue','OpenchannelQueues','WhatsappQueues','Trunks','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','mail','whatsapp','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions'];(function(_0x392127,_0x4546bd){var _0x24e3e5=function(_0x416300){while(--_0x416300){_0x392127['push'](_0x392127['shift']());}};_0x24e3e5(++_0x4546bd);}(_0xeaa2,0xd5));var _0x2eaa=function(_0x3a2deb,_0x2f8c2d){_0x3a2deb=_0x3a2deb-0x0;var _0x203ab0=_0xeaa2[_0x3a2deb];return _0x203ab0;};'use strict';var _=require(_0x2eaa('0x0'));var util=require('util');var BPromise=require(_0x2eaa('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x2eaa('0x2')],'include':[{'as':_0x2eaa('0x3'),'model':db[_0x2eaa('0x4')],'attributes':['id','name',_0x2eaa('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2eaa('0x2')],'where':{'role':_0x2eaa('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2eaa('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2eaa('0x2'),_0x2eaa('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x438667,_0x2d5669,_0x42695c){return db[_0x2eaa('0x9')]['findOne']({'where':{'name':_0x438667,'userProfileId':_0x2d5669},'raw':!![]})[_0x2eaa('0xa')](function(_0x596cf9){if(_0x596cf9){if(_0x596cf9['autoAssociation']){switch(_0x438667){case _0x2eaa('0xb'):case _0x2eaa('0xc'):case _0x2eaa('0xd'):case _0x2eaa('0xe'):case _0x2eaa('0xf'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x42695c]['findAll'](queryQueues);case _0x2eaa('0x10'):return db[_0x42695c][_0x2eaa('0x11')](queryTelephones);case'Trunks':return db[_0x42695c][_0x2eaa('0x11')](queryTrunks);case _0x2eaa('0x12'):return db[_0x42695c]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x596cf9['id']},'raw':!![]})[_0x2eaa('0xa')](function(_0x292181){if(_0x292181){var _0x46ddd8={'where':{'id':_['map'](_0x292181,_0x2eaa('0x13'))},'raw':!![]};switch(_0x42695c){case _0x2eaa('0x4'):_0x46ddd8[_0x2eaa('0x14')][_0x2eaa('0x5')]=_0x2eaa('0x6');break;case _0x2eaa('0x15'):_0x46ddd8[_0x2eaa('0x14')][_0x2eaa('0x8')]=_0x2eaa('0x16');break;}return db[_0x42695c][_0x2eaa('0x11')](_0x46ddd8);}else{return[];}});}}else{return[];}})[_0x2eaa('0xa')](function(_0x10664d){return _0x10664d;});}function joinOrLeaveQueues(_0xa60413,_0x25c687,_0x2552f1,_0x54036d){_0xa60413[_0x25c687](util['format'](_0x2eaa('0x17'),_0x2552f1,_0x54036d[_0x2eaa('0x2')]));if(_0x54036d[_0x2eaa('0x3')]){for(var _0x5dde97=0x0;_0x5dde97<_0x54036d[_0x2eaa('0x3')]['length'];_0x5dde97+=0x1){_0xa60413[_0x25c687](util[_0x2eaa('0x18')](_0x2eaa('0x19'),_0x54036d['Agents'][_0x5dde97][_0x2eaa('0x2')]));}}}function joinOrLeave(_0x3ec74d,_0x239f0e,_0xc90fce){var _0x4bf3dc;if(_0x3ec74d[_0x2eaa('0x1a')][_0x2eaa('0x1b')]['id']){db[_0x2eaa('0x4')]['find']({'attributes':['id',_0x2eaa('0x2'),_0x2eaa('0x5'),_0x2eaa('0x1c')],'where':{'id':_0x3ec74d[_0x2eaa('0x1a')][_0x2eaa('0x1b')]['id']},'include':[{'model':db[_0x2eaa('0x1d')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2eaa('0x1e')],'as':_0x2eaa('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x2eaa('0x20')],'as':_0x2eaa('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x2eaa('0x22')],'as':_0x2eaa('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2eaa('0x24')],'as':_0x2eaa('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2eaa('0x26')],'as':_0x2eaa('0x27'),'attributes':['id'],'raw':!![]}]})[_0x2eaa('0xa')](function(_0x1df61b){if(_0x1df61b){_0x4bf3dc=_0x1df61b;_0x3ec74d[_0x239f0e](util[_0x2eaa('0x18')](_0x2eaa('0x19'),_0x1df61b[_0x2eaa('0x2')]));var _0x203605=[];switch(_0x1df61b['role']){case _0x2eaa('0x28'):_0x3ec74d[_0x239f0e](_0x2eaa('0x29'));_0x3ec74d[_0x239f0e](_0x2eaa('0x2a'));if(queryQueues[_0x2eaa('0x2b')]('include')){delete queryQueues[_0x2eaa('0x2c')];}_0x203605[_0x2eaa('0x2d')](db[_0x2eaa('0x2e')][_0x2eaa('0x11')](queryQueues));_0x203605[_0x2eaa('0x2d')](db['ChatQueue']['findAll'](queryQueues));_0x203605[_0x2eaa('0x2d')](db[_0x2eaa('0x2f')]['findAll'](queryQueues));_0x203605[_0x2eaa('0x2d')](db['SmsQueue'][_0x2eaa('0x11')](queryQueues));_0x203605[_0x2eaa('0x2d')](db['MailQueue']['findAll'](queryQueues));_0x203605[_0x2eaa('0x2d')](db[_0x2eaa('0x30')][_0x2eaa('0x11')](queryQueues));_0x203605['push'](db[_0x2eaa('0x31')][_0x2eaa('0x11')](queryQueues));_0x203605[_0x2eaa('0x2d')](db['User'][_0x2eaa('0x11')](queryTelephones));_0x203605[_0x2eaa('0x2d')](db[_0x2eaa('0x32')][_0x2eaa('0x11')](queryTrunks));_0x203605['push'](db['Campaign'][_0x2eaa('0x11')](queryCampaigns));_0x203605['push'](db[_0x2eaa('0x4')][_0x2eaa('0x11')](queryAgents));break;case _0x2eaa('0x33'):_0x3ec74d[_0x239f0e](_0x2eaa('0x29'));_0x3ec74d[_0x239f0e]('voice:outbound');_0x203605[_0x2eaa('0x2d')](getAssociatedResources('VoiceQueues',_0x1df61b[_0x2eaa('0x1c')],_0x2eaa('0x2e')));_0x203605[_0x2eaa('0x2d')](getAssociatedResources('ChatQueues',_0x1df61b[_0x2eaa('0x1c')],'ChatQueue'));_0x203605[_0x2eaa('0x2d')](getAssociatedResources(_0x2eaa('0xd'),_0x1df61b[_0x2eaa('0x1c')],'FaxQueue'));_0x203605[_0x2eaa('0x2d')](getAssociatedResources('SmsQueues',_0x1df61b[_0x2eaa('0x1c')],_0x2eaa('0x34')));_0x203605[_0x2eaa('0x2d')](getAssociatedResources(_0x2eaa('0xf'),_0x1df61b['userProfileId'],_0x2eaa('0x35')));_0x203605[_0x2eaa('0x2d')](getAssociatedResources(_0x2eaa('0x36'),_0x1df61b['userProfileId'],'OpenchannelQueue'));_0x203605[_0x2eaa('0x2d')](getAssociatedResources(_0x2eaa('0x37'),_0x1df61b[_0x2eaa('0x1c')],_0x2eaa('0x31')));_0x203605[_0x2eaa('0x2d')](getAssociatedResources(_0x2eaa('0x10'),_0x1df61b[_0x2eaa('0x1c')],'User'));_0x203605[_0x2eaa('0x2d')](getAssociatedResources(_0x2eaa('0x38'),_0x1df61b[_0x2eaa('0x1c')],_0x2eaa('0x32')));_0x203605['push'](getAssociatedResources('IvrCampaigns',_0x1df61b[_0x2eaa('0x1c')],_0x2eaa('0x15')));_0x203605[_0x2eaa('0x2d')](db['User'][_0x2eaa('0x11')](queryAgents));break;case _0x2eaa('0x7'):_0x3ec74d[_0x239f0e]('voice:inbound');_0x3ec74d[_0x239f0e](_0x2eaa('0x2a'));_0x203605['push'](_0x1df61b['getVoiceQueues']({'attributes':['id','name']}));_0x203605['push'](_0x1df61b[_0x2eaa('0x39')]({'attributes':['id','name']}));_0x203605[_0x2eaa('0x2d')](_0x1df61b[_0x2eaa('0x3a')]({'attributes':['id',_0x2eaa('0x2')]}));_0x203605[_0x2eaa('0x2d')](_0x1df61b['getSmsQueues']({'attributes':['id',_0x2eaa('0x2')]}));_0x203605[_0x2eaa('0x2d')](_0x1df61b[_0x2eaa('0x3b')]({'attributes':['id',_0x2eaa('0x2')]}));_0x203605[_0x2eaa('0x2d')](_0x1df61b[_0x2eaa('0x3c')]({'attributes':['id',_0x2eaa('0x2')]}));_0x203605[_0x2eaa('0x2d')](_0x1df61b[_0x2eaa('0x3d')]({'attributes':['id',_0x2eaa('0x2')]}));break;}return BPromise[_0x2eaa('0x3e')](_0x203605);}})[_0x2eaa('0xa')](function(_0x71c6dd){if(_0x71c6dd&&_0x71c6dd[_0x2eaa('0x3f')]){for(var _0x29ecbd=0x0;_0x29ecbd<_0x71c6dd[_0x2eaa('0x3f')];_0x29ecbd+=0x1){for(var _0x5d8ceb=0x0;_0x5d8ceb<_0x71c6dd[_0x29ecbd]['length'];_0x5d8ceb+=0x1){switch(_0x29ecbd){case 0x0:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,_0x2eaa('0x40'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x1:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,_0x2eaa('0x41'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x2:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,_0x2eaa('0x42'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x3:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,'sms',_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x4:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,_0x2eaa('0x43'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x5:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,'openchannel',_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x6:joinOrLeaveQueues(_0x3ec74d,_0x239f0e,_0x2eaa('0x44'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]);break;case 0x7:_0x3ec74d[_0x239f0e](util['format']('telephone:%s',_0x71c6dd[_0x29ecbd][_0x5d8ceb][_0x2eaa('0x2')]));break;case 0x8:_0x3ec74d[_0x239f0e](util[_0x2eaa('0x18')](_0x2eaa('0x45'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]['name']));break;case 0x9:_0x3ec74d[_0x239f0e](util['format']('campaign:%s:%s',_0x71c6dd[_0x29ecbd][_0x5d8ceb]['type'],_0x71c6dd[_0x29ecbd][_0x5d8ceb][_0x2eaa('0x2')]));break;case 0xa:_0x3ec74d[_0x239f0e](util[_0x2eaa('0x18')](_0x2eaa('0x19'),_0x71c6dd[_0x29ecbd][_0x5d8ceb]['name']));break;}}}}})['then'](function(){if(_0x239f0e===_0x2eaa('0x46')){var _0x406f8a=_['map'](_0x4bf3dc[_0x2eaa('0x47')],'id');return _0x4bf3dc[_0x2eaa('0x48')](_0x406f8a)[_0x2eaa('0xa')](function(){for(var _0x46fa73=0x0;_0x46fa73<_0x406f8a[_0x2eaa('0x3f')];_0x46fa73+=0x1){_0xc90fce[_0x2eaa('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x406f8a[_0x46fa73]),'UserId':Number(_0x4bf3dc['id'])});}});}})[_0x2eaa('0xa')](function(){if(_0x239f0e===_0x2eaa('0x46')){var _0x2cbbc1=_['map'](_0x4bf3dc[_0x2eaa('0x1f')],'id');return _0x4bf3dc[_0x2eaa('0x4a')](_0x2cbbc1)[_0x2eaa('0xa')](function(){for(var _0xb84a5a=0x0;_0xb84a5a<_0x2cbbc1[_0x2eaa('0x3f')];_0xb84a5a+=0x1){_0xc90fce[_0x2eaa('0x49')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2cbbc1[_0xb84a5a]),'UserId':Number(_0x4bf3dc['id'])});}});}})[_0x2eaa('0xa')](function(){if(_0x239f0e==='leave'){var _0x25a39d=_[_0x2eaa('0x4b')](_0x4bf3dc[_0x2eaa('0x21')],'id');return _0x4bf3dc[_0x2eaa('0x4c')](_0x25a39d)['then'](function(){for(var _0x4a1d44=0x0;_0x4a1d44<_0x25a39d['length'];_0x4a1d44+=0x1){_0xc90fce['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x25a39d[_0x4a1d44]),'UserId':Number(_0x4bf3dc['id'])});}});}})[_0x2eaa('0xa')](function(){if(_0x239f0e==='leave'){var _0x4a1c42=_[_0x2eaa('0x4b')](_0x4bf3dc[_0x2eaa('0x23')],'id');return _0x4bf3dc[_0x2eaa('0x4d')](_0x4a1c42)[_0x2eaa('0xa')](function(){for(var _0x5dd7c6=0x0;_0x5dd7c6<_0x4a1c42[_0x2eaa('0x3f')];_0x5dd7c6+=0x1){_0xc90fce[_0x2eaa('0x49')](_0x2eaa('0x4e'),{'SmsInteractionId':Number(_0x4a1c42[_0x5dd7c6]),'UserId':Number(_0x4bf3dc['id'])});}});}})[_0x2eaa('0xa')](function(){if(_0x239f0e==='leave'){var _0x1cbf0e=_['map'](_0x4bf3dc[_0x2eaa('0x25')],'id');return _0x4bf3dc[_0x2eaa('0x4f')](_0x1cbf0e)[_0x2eaa('0xa')](function(){for(var _0x14058f=0x0;_0x14058f<_0x1cbf0e[_0x2eaa('0x3f')];_0x14058f+=0x1){_0xc90fce['emit'](_0x2eaa('0x50'),{'OpenchannelInteractionId':Number(_0x1cbf0e[_0x14058f]),'UserId':Number(_0x4bf3dc['id'])});}});}})[_0x2eaa('0xa')](function(){if(_0x239f0e===_0x2eaa('0x46')){var _0x107838=_['map'](_0x4bf3dc[_0x2eaa('0x27')],'id');return _0x4bf3dc[_0x2eaa('0x51')](_0x107838)[_0x2eaa('0xa')](function(){for(var _0x204c90=0x0;_0x204c90<_0x107838['length'];_0x204c90+=0x1){_0xc90fce[_0x2eaa('0x49')](_0x2eaa('0x52'),{'WhatsappInteractionId':Number(_0x107838[_0x204c90]),'UserId':Number(_0x4bf3dc['id'])});}});}})[_0x2eaa('0x53')](function(_0x32323b){_0x3ec74d['log'](_0x32323b);});}}function onDisconnect(_0x2d8b20,_0x2c7062){joinOrLeave(_0x2d8b20,_0x2eaa('0x46'),_0x2c7062);}function onConnect(_0x35ffa7){joinOrLeave(_0x35ffa7,_0x2eaa('0x54'));}exports[_0x2eaa('0x55')]=function(_0x3e1783){_0x3e1783['on'](_0x2eaa('0x56'),function(_0x41a7c1){_0x41a7c1['setMaxListeners'](0x0);_0x41a7c1[_0x2eaa('0x57')]=_0x41a7c1[_0x2eaa('0x58')][_0x2eaa('0x56')][_0x2eaa('0x59')]+':'+_0x41a7c1[_0x2eaa('0x58')][_0x2eaa('0x56')][_0x2eaa('0x5a')];_0x41a7c1[_0x2eaa('0x5b')]=new Date();_0x41a7c1['log']=function(_0x58a649){console[_0x2eaa('0x5c')](_0x2eaa('0x5d')+_0x41a7c1['nsp']['name']+'['+_0x41a7c1[_0x2eaa('0x57')]+']',_0x58a649);};_0x41a7c1['on'](_0x2eaa('0x5e'),function(){onDisconnect(_0x41a7c1,_0x3e1783);_0x41a7c1[_0x2eaa('0x5c')]('DISCONNECTED');});onConnect(_0x41a7c1);_0x41a7c1[_0x2eaa('0x5c')](_0x2eaa('0x5f'));});}; \ No newline at end of file +var _0x8ee9=['agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','resourceId','then','map','Campaign','where','format','length','user:%s','Agents','handshake','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','SmsQueues','Trunks','IvrCampaigns','getVoiceQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','default','setMaxListeners','connection','request','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','role'];(function(_0x34539b,_0x59c4ed){var _0x2fcc20=function(_0x4b33da){while(--_0x4b33da){_0x34539b['push'](_0x34539b['shift']());}};_0x2fcc20(++_0x59c4ed);}(_0x8ee9,0xb3));var _0x98ee=function(_0x1650b4,_0x1477f8){_0x1650b4=_0x1650b4-0x0;var _0x5c320f=_0x8ee9[_0x1650b4];return _0x5c320f;};'use strict';var _=require(_0x98ee('0x0'));var util=require(_0x98ee('0x1'));var BPromise=require(_0x98ee('0x2'));var db=require(_0x98ee('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x98ee('0x4')],'include':[{'as':'Agents','model':db[_0x98ee('0x5')],'attributes':['id',_0x98ee('0x4'),_0x98ee('0x6')],'raw':!![],'where':{'role':_0x98ee('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x98ee('0x4')],'where':{'role':_0x98ee('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x98ee('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x98ee('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x98ee('0x4'),_0x98ee('0x9')],'where':{'type':_0x98ee('0xa')}};function getAssociatedResources(_0x5ec975,_0x3d34bd,_0x4628a0){return db['UserProfileSection'][_0x98ee('0xb')]({'where':{'name':_0x5ec975,'userProfileId':_0x3d34bd},'raw':!![]})['then'](function(_0x196937){if(_0x196937){if(_0x196937[_0x98ee('0xc')]){switch(_0x5ec975){case _0x98ee('0xd'):case _0x98ee('0xe'):case _0x98ee('0xf'):case'SmsQueues':case _0x98ee('0x10'):case _0x98ee('0x11'):case _0x98ee('0x12'):return db[_0x4628a0]['findAll'](queryQueues);case _0x98ee('0x13'):return db[_0x4628a0][_0x98ee('0x14')](queryTelephones);case'Trunks':return db[_0x4628a0][_0x98ee('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x4628a0][_0x98ee('0x14')](queryCampaigns);}}else{return db[_0x98ee('0x15')][_0x98ee('0x14')]({'attributes':[_0x98ee('0x16')],'where':{'sectionId':_0x196937['id']},'raw':!![]})[_0x98ee('0x17')](function(_0x23ceb6){if(_0x23ceb6){var _0x58a1d4={'where':{'id':_[_0x98ee('0x18')](_0x23ceb6,'resourceId')},'raw':!![]};switch(_0x4628a0){case _0x98ee('0x5'):_0x58a1d4['where'][_0x98ee('0x6')]='telephone';break;case _0x98ee('0x19'):_0x58a1d4[_0x98ee('0x1a')][_0x98ee('0x9')]='ivr';break;}return db[_0x4628a0]['findAll'](_0x58a1d4);}else{return[];}});}}else{return[];}})[_0x98ee('0x17')](function(_0x421488){return _0x421488;});}function joinOrLeaveQueues(_0x109a0d,_0x34cf18,_0x17f02b,_0x4ad758){_0x109a0d[_0x34cf18](util[_0x98ee('0x1b')]('%s:queue:%s',_0x17f02b,_0x4ad758[_0x98ee('0x4')]));if(_0x4ad758['Agents']){for(var _0xa3e86a=0x0;_0xa3e86a<_0x4ad758['Agents'][_0x98ee('0x1c')];_0xa3e86a+=0x1){_0x109a0d[_0x34cf18](util[_0x98ee('0x1b')](_0x98ee('0x1d'),_0x4ad758[_0x98ee('0x1e')][_0xa3e86a]['name']));}}}function joinOrLeave(_0x4f0209,_0xfb078d,_0x32f396){var _0x347e11;if(_0x4f0209[_0x98ee('0x1f')][_0x98ee('0x20')]['id']){db['User'][_0x98ee('0x21')]({'attributes':['id',_0x98ee('0x4'),_0x98ee('0x6'),_0x98ee('0x22')],'where':{'id':_0x4f0209[_0x98ee('0x1f')][_0x98ee('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x98ee('0x23')],'as':_0x98ee('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x98ee('0x25')],'as':_0x98ee('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x98ee('0x27')],'as':_0x98ee('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x98ee('0x29')],'as':_0x98ee('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x98ee('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xe9be9f){if(_0xe9be9f){_0x347e11=_0xe9be9f;_0x4f0209[_0xfb078d](util[_0x98ee('0x1b')]('user:%s',_0xe9be9f[_0x98ee('0x4')]));var _0x5cb287=[];switch(_0xe9be9f[_0x98ee('0x6')]){case'admin':_0x4f0209[_0xfb078d](_0x98ee('0x2c'));_0x4f0209[_0xfb078d](_0x98ee('0x2d'));if(queryQueues[_0x98ee('0x2e')](_0x98ee('0x2f'))){delete queryQueues['include'];}_0x5cb287[_0x98ee('0x30')](db[_0x98ee('0x31')]['findAll'](queryQueues));_0x5cb287[_0x98ee('0x30')](db[_0x98ee('0x32')][_0x98ee('0x14')](queryQueues));_0x5cb287[_0x98ee('0x30')](db[_0x98ee('0x33')][_0x98ee('0x14')](queryQueues));_0x5cb287['push'](db['SmsQueue'][_0x98ee('0x14')](queryQueues));_0x5cb287['push'](db[_0x98ee('0x34')][_0x98ee('0x14')](queryQueues));_0x5cb287['push'](db[_0x98ee('0x35')][_0x98ee('0x14')](queryQueues));_0x5cb287[_0x98ee('0x30')](db[_0x98ee('0x36')][_0x98ee('0x14')](queryQueues));_0x5cb287['push'](db['User'][_0x98ee('0x14')](queryTelephones));_0x5cb287[_0x98ee('0x30')](db['Trunk'][_0x98ee('0x14')](queryTrunks));_0x5cb287[_0x98ee('0x30')](db[_0x98ee('0x19')][_0x98ee('0x14')](queryCampaigns));_0x5cb287[_0x98ee('0x30')](db['User'][_0x98ee('0x14')](queryAgents));break;case'user':_0x4f0209[_0xfb078d](_0x98ee('0x2c'));_0x4f0209[_0xfb078d](_0x98ee('0x2d'));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0xd'),_0xe9be9f[_0x98ee('0x22')],'VoiceQueue'));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0xe'),_0xe9be9f[_0x98ee('0x22')],_0x98ee('0x32')));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0xf'),_0xe9be9f[_0x98ee('0x22')],'FaxQueue'));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0x37'),_0xe9be9f[_0x98ee('0x22')],'SmsQueue'));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0x10'),_0xe9be9f[_0x98ee('0x22')],_0x98ee('0x34')));_0x5cb287['push'](getAssociatedResources(_0x98ee('0x11'),_0xe9be9f[_0x98ee('0x22')],'OpenchannelQueue'));_0x5cb287[_0x98ee('0x30')](getAssociatedResources('WhatsappQueues',_0xe9be9f[_0x98ee('0x22')],_0x98ee('0x36')));_0x5cb287['push'](getAssociatedResources(_0x98ee('0x13'),_0xe9be9f[_0x98ee('0x22')],_0x98ee('0x5')));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0x38'),_0xe9be9f[_0x98ee('0x22')],'Trunk'));_0x5cb287[_0x98ee('0x30')](getAssociatedResources(_0x98ee('0x39'),_0xe9be9f[_0x98ee('0x22')],_0x98ee('0x19')));_0x5cb287['push'](db[_0x98ee('0x5')]['findAll'](queryAgents));break;case _0x98ee('0x7'):_0x4f0209[_0xfb078d](_0x98ee('0x2c'));_0x4f0209[_0xfb078d](_0x98ee('0x2d'));_0x5cb287['push'](_0xe9be9f[_0x98ee('0x3a')]({'attributes':['id',_0x98ee('0x4')]}));_0x5cb287[_0x98ee('0x30')](_0xe9be9f['getChatQueues']({'attributes':['id',_0x98ee('0x4')]}));_0x5cb287[_0x98ee('0x30')](_0xe9be9f['getFaxQueues']({'attributes':['id',_0x98ee('0x4')]}));_0x5cb287['push'](_0xe9be9f[_0x98ee('0x3b')]({'attributes':['id',_0x98ee('0x4')]}));_0x5cb287[_0x98ee('0x30')](_0xe9be9f['getMailQueues']({'attributes':['id','name']}));_0x5cb287[_0x98ee('0x30')](_0xe9be9f[_0x98ee('0x3c')]({'attributes':['id',_0x98ee('0x4')]}));_0x5cb287[_0x98ee('0x30')](_0xe9be9f[_0x98ee('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0x98ee('0x3e')](_0x5cb287);}})[_0x98ee('0x17')](function(_0x5026b3){if(_0x5026b3&&_0x5026b3[_0x98ee('0x1c')]){for(var _0x584e71=0x0;_0x584e71<_0x5026b3[_0x98ee('0x1c')];_0x584e71+=0x1){for(var _0x190b66=0x0;_0x190b66<_0x5026b3[_0x584e71][_0x98ee('0x1c')];_0x190b66+=0x1){switch(_0x584e71){case 0x0:joinOrLeaveQueues(_0x4f0209,_0xfb078d,_0x98ee('0x3f'),_0x5026b3[_0x584e71][_0x190b66]);break;case 0x1:joinOrLeaveQueues(_0x4f0209,_0xfb078d,_0x98ee('0x40'),_0x5026b3[_0x584e71][_0x190b66]);break;case 0x2:joinOrLeaveQueues(_0x4f0209,_0xfb078d,_0x98ee('0x41'),_0x5026b3[_0x584e71][_0x190b66]);break;case 0x3:joinOrLeaveQueues(_0x4f0209,_0xfb078d,_0x98ee('0x42'),_0x5026b3[_0x584e71][_0x190b66]);break;case 0x4:joinOrLeaveQueues(_0x4f0209,_0xfb078d,_0x98ee('0x43'),_0x5026b3[_0x584e71][_0x190b66]);break;case 0x5:joinOrLeaveQueues(_0x4f0209,_0xfb078d,_0x98ee('0x44'),_0x5026b3[_0x584e71][_0x190b66]);break;case 0x6:joinOrLeaveQueues(_0x4f0209,_0xfb078d,'whatsapp',_0x5026b3[_0x584e71][_0x190b66]);break;case 0x7:_0x4f0209[_0xfb078d](util[_0x98ee('0x1b')]('telephone:%s',_0x5026b3[_0x584e71][_0x190b66][_0x98ee('0x4')]));break;case 0x8:_0x4f0209[_0xfb078d](util[_0x98ee('0x1b')]('trunk:%s',_0x5026b3[_0x584e71][_0x190b66][_0x98ee('0x4')]));break;case 0x9:_0x4f0209[_0xfb078d](util['format']('campaign:%s:%s',_0x5026b3[_0x584e71][_0x190b66][_0x98ee('0x9')],_0x5026b3[_0x584e71][_0x190b66]['name']));break;case 0xa:_0x4f0209[_0xfb078d](util[_0x98ee('0x1b')](_0x98ee('0x1d'),_0x5026b3[_0x584e71][_0x190b66][_0x98ee('0x4')]));break;}}}}})[_0x98ee('0x17')](function(){if(_0xfb078d===_0x98ee('0x45')){var _0x58d45c=_[_0x98ee('0x18')](_0x347e11[_0x98ee('0x46')],'id');return _0x347e11[_0x98ee('0x47')](_0x58d45c)[_0x98ee('0x17')](function(){for(var _0x410a7f=0x0;_0x410a7f<_0x58d45c[_0x98ee('0x1c')];_0x410a7f+=0x1){_0x32f396[_0x98ee('0x48')](_0x98ee('0x49'),{'ChatInteractionId':Number(_0x58d45c[_0x410a7f]),'UserId':Number(_0x347e11['id'])});}});}})[_0x98ee('0x17')](function(){if(_0xfb078d===_0x98ee('0x45')){var _0x1f242f=_[_0x98ee('0x18')](_0x347e11[_0x98ee('0x24')],'id');return _0x347e11[_0x98ee('0x4a')](_0x1f242f)[_0x98ee('0x17')](function(){for(var _0x32e646=0x0;_0x32e646<_0x1f242f[_0x98ee('0x1c')];_0x32e646+=0x1){_0x32f396[_0x98ee('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x1f242f[_0x32e646]),'UserId':Number(_0x347e11['id'])});}});}})[_0x98ee('0x17')](function(){if(_0xfb078d==='leave'){var _0x47c202=_[_0x98ee('0x18')](_0x347e11[_0x98ee('0x26')],'id');return _0x347e11[_0x98ee('0x4b')](_0x47c202)[_0x98ee('0x17')](function(){for(var _0x48b9e7=0x0;_0x48b9e7<_0x47c202[_0x98ee('0x1c')];_0x48b9e7+=0x1){_0x32f396['emit'](_0x98ee('0x4c'),{'FaxInteractionId':Number(_0x47c202[_0x48b9e7]),'UserId':Number(_0x347e11['id'])});}});}})[_0x98ee('0x17')](function(){if(_0xfb078d===_0x98ee('0x45')){var _0x57d3f0=_[_0x98ee('0x18')](_0x347e11['SmsInteractions'],'id');return _0x347e11['removeSmsInteractions'](_0x57d3f0)[_0x98ee('0x17')](function(){for(var _0x1abecc=0x0;_0x1abecc<_0x57d3f0[_0x98ee('0x1c')];_0x1abecc+=0x1){_0x32f396['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x57d3f0[_0x1abecc]),'UserId':Number(_0x347e11['id'])});}});}})[_0x98ee('0x17')](function(){if(_0xfb078d==='leave'){var _0x18237d=_[_0x98ee('0x18')](_0x347e11[_0x98ee('0x2a')],'id');return _0x347e11[_0x98ee('0x4d')](_0x18237d)[_0x98ee('0x17')](function(){for(var _0x35d62e=0x0;_0x35d62e<_0x18237d[_0x98ee('0x1c')];_0x35d62e+=0x1){_0x32f396[_0x98ee('0x48')](_0x98ee('0x4e'),{'OpenchannelInteractionId':Number(_0x18237d[_0x35d62e]),'UserId':Number(_0x347e11['id'])});}});}})['then'](function(){if(_0xfb078d===_0x98ee('0x45')){var _0x583781=_[_0x98ee('0x18')](_0x347e11[_0x98ee('0x2b')],'id');return _0x347e11[_0x98ee('0x4f')](_0x583781)[_0x98ee('0x17')](function(){for(var _0x527c8e=0x0;_0x527c8e<_0x583781[_0x98ee('0x1c')];_0x527c8e+=0x1){_0x32f396['emit'](_0x98ee('0x50'),{'WhatsappInteractionId':Number(_0x583781[_0x527c8e]),'UserId':Number(_0x347e11['id'])});}});}})['catch'](function(_0x18c461){_0x4f0209[_0x98ee('0x51')](_0x18c461);});}}function onDisconnect(_0x5a359d,_0x425fc6){joinOrLeave(_0x5a359d,_0x98ee('0x45'),_0x425fc6);}function onConnect(_0x7aac8d){joinOrLeave(_0x7aac8d,'join');}exports[_0x98ee('0x52')]=function(_0x2bfff7){_0x2bfff7['on']('connection',function(_0x28ee9e){_0x28ee9e[_0x98ee('0x53')](0x0);_0x28ee9e['address']=_0x28ee9e['request'][_0x98ee('0x54')]['remoteAddress']+':'+_0x28ee9e[_0x98ee('0x55')][_0x98ee('0x54')]['remotePort'];_0x28ee9e[_0x98ee('0x56')]=new Date();_0x28ee9e[_0x98ee('0x51')]=function(_0x31eabb){console[_0x98ee('0x51')](_0x98ee('0x57')+_0x28ee9e[_0x98ee('0x58')][_0x98ee('0x4')]+'['+_0x28ee9e[_0x98ee('0x59')]+']',_0x31eabb);};_0x28ee9e['on'](_0x98ee('0x5a'),function(){onDisconnect(_0x28ee9e,_0x2bfff7);_0x28ee9e[_0x98ee('0x51')](_0x98ee('0x5b'));});onConnect(_0x28ee9e);_0x28ee9e[_0x98ee('0x51')](_0x98ee('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 0e81301..c99e830 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 _0x43a1=['FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','Trigger,\x20%s','EventManager','error','catch','get','channel','event','UserId','User','find','name','then','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','closed','default','length','model','hook','callback','toLowerCase','condition','../../mysqldb','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','SmsInteraction','newinteraction','Sms','Whatsapp','WhatsappInteraction','WhatsappMessage','newmessage','Fax','FaxInteraction'];(function(_0x44419a,_0x5fb47c){var _0x5bd8d0=function(_0x399376){while(--_0x399376){_0x44419a['push'](_0x44419a['shift']());}};_0x5bd8d0(++_0x5fb47c);}(_0x43a1,0x1ed));var _0x143a=function(_0x1751b3,_0x16f9d8){_0x1751b3=_0x1751b3-0x0;var _0x5dd310=_0x43a1[_0x1751b3];return _0x5dd310;};'use strict';var util=require('util');var db=require(_0x143a('0x0'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')('triggers');var client=jayson[_0x143a('0x1')]['http']({'port':0x232a});var triggers=[{'channel':_0x143a('0x2'),'model':_0x143a('0x3'),'event':_0x143a('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x143a('0x2'),'model':_0x143a('0x3'),'event':_0x143a('0x5'),'condition':_0x143a('0x6'),'callback':afterUpdate},{'channel':_0x143a('0x2'),'model':_0x143a('0x7'),'event':_0x143a('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x143a('0x8'),'event':'afterCreate','condition':_0x143a('0x9'),'callback':afterCreate},{'channel':_0x143a('0xa'),'model':_0x143a('0x8'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x143a('0xa'),'model':'SmsMessage','event':_0x143a('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x143a('0xb'),'model':'WhatsappInteraction','event':_0x143a('0x4'),'condition':_0x143a('0x9'),'callback':afterCreate},{'channel':_0x143a('0xb'),'model':_0x143a('0xc'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x143a('0xb'),'model':_0x143a('0xd'),'event':'afterCreate','condition':_0x143a('0xe'),'callback':afterCreateMessage},{'channel':_0x143a('0xf'),'model':_0x143a('0x10'),'event':'afterCreate','condition':_0x143a('0x9'),'callback':afterCreate},{'channel':'Fax','model':_0x143a('0x10'),'event':'afterUpdate','condition':_0x143a('0x6'),'callback':afterUpdate},{'channel':_0x143a('0xf'),'model':_0x143a('0x11'),'event':'afterCreate','condition':_0x143a('0xe'),'callback':afterCreateMessage},{'channel':_0x143a('0x12'),'model':_0x143a('0x13'),'event':_0x143a('0x4'),'condition':_0x143a('0x9'),'callback':afterCreate},{'channel':_0x143a('0x12'),'model':_0x143a('0x13'),'event':_0x143a('0x5'),'condition':_0x143a('0x6'),'callback':afterUpdate},{'channel':'Mail','model':_0x143a('0x14'),'event':_0x143a('0x4'),'condition':_0x143a('0xe'),'callback':afterCreateMessage},{'channel':_0x143a('0x15'),'model':_0x143a('0x16'),'event':_0x143a('0x4'),'condition':_0x143a('0x9'),'callback':afterCreate},{'channel':_0x143a('0x15'),'model':_0x143a('0x16'),'event':'afterUpdate','condition':_0x143a('0x6'),'callback':afterUpdate},{'channel':_0x143a('0x15'),'model':_0x143a('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x24f8b2){return client[_0x143a('0x18')]('EventManager',_0x24f8b2)['then'](function(_0x228313){logger['info'](_0x143a('0x19'),_0x143a('0x1a'),_0x228313);if(_0x228313[_0x143a('0x1b')]){if(_0x228313[_0x143a('0x1b')]['code']===0x1f4){logger[_0x143a('0x1b')](_0x143a('0x19'),'EventManager',_0x228313[_0x143a('0x1b')]);}}})[_0x143a('0x1c')](function(_0x225674){logger[_0x143a('0x1b')](_0x143a('0x19'),'EventManager',_0x225674);});}function afterCreateMessage(_0x483dbb,_0x26ab23){return function(_0x4fc8ed,_0x12952f){_0x4fc8ed=_0x4fc8ed[_0x143a('0x1d')]({'plain':!![]});_0x4fc8ed[_0x143a('0x1e')]=_0x483dbb;_0x4fc8ed[_0x143a('0x1f')]=_0x4fc8ed['direction'];if(_0x4fc8ed[_0x143a('0x20')]){return db[_0x143a('0x21')][_0x143a('0x22')]({'where':{'id':_0x4fc8ed[_0x143a('0x20')]},'attributes':['id',_0x143a('0x23')],'raw':!![]})[_0x143a('0x24')](function(_0x3563e0){_0x4fc8ed[_0x143a('0x25')]=util[_0x143a('0x26')](_0x143a('0x27'),_0x3563e0[_0x143a('0x23')]);_0x4fc8ed[_0x143a('0x1e')]=_0x483dbb;return request({'event':_0x143a('0x28'),'message':_0x4fc8ed});})[_0x143a('0x1c')](function(_0x25c36b){console['error'](_0x25c36b);});}else{return request({'event':_0x143a('0x29'),'message':_0x4fc8ed});}};}function afterCreate(_0x4e91e3,_0x6f5ca){return function(_0xafeea3,_0x185378){_0xafeea3=_0xafeea3[_0x143a('0x1d')]({'plain':!![]});_0xafeea3[_0x143a('0x1e')]=_0x4e91e3;_0xafeea3[_0x143a('0x1f')]=_0x143a('0x2a');return request({'event':_0x6f5ca,'message':_0xafeea3});};}function afterUpdate(_0x8222c5,_0x10e7cb){return function(_0x5d623d,_0x139fd4){if(_0x5d623d['changed'](_0x143a('0x2b'))&&_0x5d623d['closed']){_0x5d623d=_0x5d623d[_0x143a('0x1d')]({'plain':!![]});_0x5d623d['channel']=_0x8222c5;_0x5d623d[_0x143a('0x1f')]='closed';if(_0x5d623d[_0x143a('0x20')]){return db[_0x143a('0x21')][_0x143a('0x22')]({'where':{'id':_0x5d623d[_0x143a('0x20')]},'attributes':['id',_0x143a('0x23')],'raw':!![]})['then'](function(_0x406828){_0x5d623d['interface']=util[_0x143a('0x26')]('SIP/%s',_0x406828[_0x143a('0x23')]);return request({'event':_0x10e7cb,'message':_0x5d623d});})[_0x143a('0x1c')](function(_0x5a91d1){console[_0x143a('0x1b')](_0x5a91d1);});}else{return request({'event':_0x10e7cb,'message':_0x5d623d});}}};}exports[_0x143a('0x2c')]=function(){for(var _0x35d04e=0x0;_0x35d04e=_0x350a74[_0xa973('0x15')]){throw Error(_0xa973('0x16'));}_0x5eb709(_0x1be9ea);})[_0xa973('0x17')](function(_0x1f011b){_0xdf3675(_0x1f011b);});});}; \ No newline at end of file +var _0x55a5=['catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','isValidChannel','toLowerCase','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x452de3,_0x531134){var _0x2ee585=function(_0x6883e9){while(--_0x6883e9){_0x452de3['push'](_0x452de3['shift']());}};_0x2ee585(++_0x531134);}(_0x55a5,0xf1));var _0x555a=function(_0x3cbe3a,_0x78bfce){_0x3cbe3a=_0x3cbe3a-0x0;var _0x24ffc1=_0x55a5[_0x3cbe3a];return _0x24ffc1;};'use strict';var _=require(_0x555a('0x0'));var BPromise=require(_0x555a('0x1'));var db=require(_0x555a('0x2'))['db'];var util=require(_0x555a('0x3'));var channels=[_0x555a('0x4'),_0x555a('0x5'),_0x555a('0x6'),_0x555a('0x7'),_0x555a('0x8'),'whatsapp',_0x555a('0x9')];exports['getChannels']=function(){return channels;};exports[_0x555a('0xa')]=function(_0x28b4c7){_0x28b4c7=_0x28b4c7[_0x555a('0xb')]();return _['includes'](channels,_0x28b4c7);};exports[_0x555a('0xc')]=function(_0x25acda,_0x505c3d,_0x4a4683,_0x593b64){var _0x228da6={'loginAttempts':_0x505c3d,'blocked':_0x4a4683};if(!_[_0x555a('0xd')](_0x593b64)){_0x228da6['blockedAt']=_0x593b64;}return _0x25acda[_0x555a('0xe')](_0x228da6);};exports[_0x555a('0xf')]=function(_0x12e9d4){return new BPromise(function(_0x267bc3,_0x5ec7d1){var _0x1c6442=0x0;if(_0x12e9d4[_0x555a('0x10')]!==_0x555a('0x11')){_0x267bc3(_0x12e9d4);}db[_0x555a('0x12')][_0x555a('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x12e9d4['id']}}})[_0x555a('0x14')](function(_0x497bf9){_0x1c6442=_0x497bf9;return util[_0x555a('0xf')]();})[_0x555a('0x14')](function(_0x442d7a){if(_0x442d7a&&_0x442d7a[_0x555a('0x15')]&&_0x1c6442>=_0x442d7a['agents']){throw Error(_0x555a('0x16'));}_0x267bc3(_0x12e9d4);})[_0x555a('0x17')](function(_0x8a13c){_0x5ec7d1(_0x8a13c);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9e4132b..f200269 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6422=['404','status','render','json','send','exports'];(function(_0x278661,_0x34d62c){var _0x238040=function(_0x3a12a9){while(--_0x3a12a9){_0x278661['push'](_0x278661['shift']());}};_0x238040(++_0x34d62c);}(_0x6422,0x95));var _0x2642=function(_0x5121b4,_0x2a6497){_0x5121b4=_0x5121b4-0x0;var _0x38b748=_0x6422[_0x5121b4];return _0x38b748;};'use strict';module[_0x2642('0x0')][0x194]=function pageNotFound(_0x555a29,_0x2e13f1){var _0x3058dd=_0x2642('0x1');var _0x14ce7c=0x194;var _0x12527b={'status':_0x14ce7c};_0x2e13f1[_0x2642('0x2')](_0x12527b[_0x2642('0x2')]);_0x2e13f1[_0x2642('0x3')](_0x3058dd,{},function(_0x2c0ee7,_0x4f8064){if(_0x2c0ee7){return _0x2e13f1[_0x2642('0x2')](_0x12527b[_0x2642('0x2')])[_0x2642('0x4')](_0x12527b);}_0x2e13f1[_0x2642('0x5')](_0x4f8064);});}; \ No newline at end of file +var _0x390d=['render','send','404','status'];(function(_0xa6053c,_0x102009){var _0x48efe9=function(_0x145321){while(--_0x145321){_0xa6053c['push'](_0xa6053c['shift']());}};_0x48efe9(++_0x102009);}(_0x390d,0xd6));var _0xd390=function(_0x5ba80d,_0x616b5f){_0x5ba80d=_0x5ba80d-0x0;var _0x14f843=_0x390d[_0x5ba80d];return _0x14f843;};'use strict';module['exports'][0x194]=function pageNotFound(_0xd36b21,_0x450c29){var _0x8b064a=_0xd390('0x0');var _0x38995a=0x194;var _0x464389={'status':_0x38995a};_0x450c29[_0xd390('0x1')](_0x464389[_0xd390('0x1')]);_0x450c29[_0xd390('0x2')](_0x8b064a,{},function(_0x27b0ac,_0x2f1777){if(_0x27b0ac){return _0x450c29[_0xd390('0x1')](_0x464389[_0xd390('0x1')])['json'](_0x464389);}_0x450c29[_0xd390('0x3')](_0x2f1777);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d309f7e..7849c6e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fb4=['OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','CmHopper','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','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','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/notification/notification.model','userNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','Recordings','VoiceQueuesRt','Extensions','HopperFinals','hasMany','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','SenderId','userNotifications','belongsTo','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccount','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceMusicOnHold','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','HopperHistories','HopperBlacks','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','VoiceCallReport','AgentReports','ContactId','MailServerIn','MailAccountId','MailServerOut','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','user_has_mail_accounts','team_has_mail_queues','Teams','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','MailInteractionId','restrict','TagId','Contact','Items','Applications','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Users','Attachment','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','user_has_chat_websites','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','Contacts','CompanyId','Hoppers','JscriptySessions','ChatInteractions','cm_contact_has_tags','CampaignId','OwnerId','OneAll','AutomationAllId','Any','AutomationAnyId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','Variable','VariableId','SugarcrmAccount','Description','int_desk_configuration_has_tags','Subject','ZendeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Account','Dynamics365Field','FreshsalesConfiguration','FromId','SessionId','ProjectId','MailQueues','SmsQueues','WhatsappQueue','TrunkId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','utf8','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../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','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model'];(function(_0x3fb61a,_0x21e3ca){var _0x4c8c58=function(_0x3f1a31){while(--_0x3f1a31){_0x3fb61a['push'](_0x3fb61a['shift']());}};_0x4c8c58(++_0x21e3ca);}(_0x4fb4,0x190));var _0x44fb=function(_0x4e21dd,_0x4ef8f5){_0x4e21dd=_0x4e21dd-0x0;var _0x43151e=_0x4fb4[_0x4e21dd];return _0x43151e;};'use strict';var path=require('path');var config=require(_0x44fb('0x0'));var Sequelize=require(_0x44fb('0x1'));var _=require(_0x44fb('0x2'));var jstz=require(_0x44fb('0x3'));var timezone=jstz[_0x44fb('0x4')]();config[_0x44fb('0x1')]=_['defaultsDeep'](config[_0x44fb('0x1')],{'database':_0x44fb('0x5'),'username':_0x44fb('0x6'),'password':_0x44fb('0x7'),'options':{'host':_0x44fb('0x8'),'port':0xcea,'dialect':_0x44fb('0x9'),'dialectOptions':{'charset':_0x44fb('0xa')},'logging':![],'timezone':timezone[_0x44fb('0xb')](),'define':{'charset':'utf8','collate':_0x44fb('0xc')}}});config[_0x44fb('0xd')]=_['defaultsDeep'](config[_0x44fb('0xd')],{'database':_0x44fb('0x5'),'username':_0x44fb('0x6'),'password':_0x44fb('0x7'),'options':{'host':_0x44fb('0x8'),'port':0xcea,'dialect':_0x44fb('0x9'),'dialectOptions':{'charset':_0x44fb('0xa')},'logging':![],'timezone':timezone[_0x44fb('0xb')](),'define':{'charset':_0x44fb('0xe'),'collate':_0x44fb('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x44fb('0xf')],config[_0x44fb('0x1')][_0x44fb('0x10')],config[_0x44fb('0x1')][_0x44fb('0x11')],config['sequelize'][_0x44fb('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x44fb('0xd')][_0x44fb('0xf')],config[_0x44fb('0xd')][_0x44fb('0x10')],config['sequelizeHistory'][_0x44fb('0x11')],config[_0x44fb('0xd')][_0x44fb('0x12')])};db[_0x44fb('0x13')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x15'));db['VoiceChanSpy']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x16'));db[_0x44fb('0x17')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x18'));db[_0x44fb('0x19')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x1a'));db[_0x44fb('0x1b')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x1c'));db[_0x44fb('0x1d')]=db['sequelize']['import'](_0x44fb('0x1e'));db[_0x44fb('0x1f')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x20'));db[_0x44fb('0x21')]=db[_0x44fb('0x1')]['import']('../api/voiceMail/voiceMail.model');db[_0x44fb('0x22')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x23'));db['VoiceCallReport']=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x24'));db[_0x44fb('0x25')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x26'));db[_0x44fb('0x27')]=db[_0x44fb('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x44fb('0x1')]['import'](_0x44fb('0x28'));db[_0x44fb('0x29')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x2a'));db[_0x44fb('0x2b')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x44fb('0x1')]['import'](_0x44fb('0x2c'));db[_0x44fb('0x2d')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x2e'));db[_0x44fb('0x2f')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x30'));db[_0x44fb('0x31')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x32'));db[_0x44fb('0x33')]=db[_0x44fb('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x34'));db[_0x44fb('0x35')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x36'));db['UserWhatsappQueue']=db[_0x44fb('0x1')]['import'](_0x44fb('0x37'));db['MailServerIn']=db[_0x44fb('0x1')]['import'](_0x44fb('0x38'));db['MailServerOut']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x39'));db[_0x44fb('0x3a')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x3b'));db[_0x44fb('0x3c')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x3d'));db['MailSubstatus']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x3e'));db[_0x44fb('0x3f')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x40'));db[_0x44fb('0x41')]=db['sequelize']['import'](_0x44fb('0x42'));db[_0x44fb('0x43')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x44'));db[_0x44fb('0x45')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x46'));db[_0x44fb('0x47')]=db['sequelize'][_0x44fb('0x14')]('../api/dashboard/dashboard.model');db[_0x44fb('0x48')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x49'));db['FaxAccount']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x4a'));db[_0x44fb('0x4b')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x4c'));db[_0x44fb('0x4d')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/faxMessage/faxMessage.model');db[_0x44fb('0x4e')]=db['sequelize']['import']('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x4f'));db[_0x44fb('0x50')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x51'));db[_0x44fb('0x52')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x53'));db[_0x44fb('0x54')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x55'));db['SmsMessage']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x56'));db[_0x44fb('0x57')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x58'));db[_0x44fb('0x59')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x5a'));db[_0x44fb('0x5b')]=db['sequelize'][_0x44fb('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x44fb('0x5c')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x5d'));db[_0x44fb('0x5e')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x5f'));db[_0x44fb('0x60')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x61'));db[_0x44fb('0x62')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x63'));db[_0x44fb('0x64')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x44fb('0x65')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x66'));db['ChatInteraction']=db['sequelize']['import'](_0x44fb('0x67'));db[_0x44fb('0x68')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x69'));db[_0x44fb('0x6a')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x6b'));db[_0x44fb('0x6c')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x6d'));db[_0x44fb('0x6e')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x6f'));db[_0x44fb('0x70')]=db[_0x44fb('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x44fb('0x71')]=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db[_0x44fb('0x72')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/cmContact/cmContact.model');db[_0x44fb('0x73')]=db['sequelize'][_0x44fb('0x14')]('../api/cmHopper/cmHopper.model');db[_0x44fb('0x74')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x44fb('0x75')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x44fb('0x76')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x77'));db[_0x44fb('0x78')]=db['sequelize']['import'](_0x44fb('0x79'));db[_0x44fb('0x7a')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x7b'));db[_0x44fb('0x7c')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x7d'));db[_0x44fb('0x7e')]=db[_0x44fb('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x44fb('0x7f')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/disposition/disposition.model');db[_0x44fb('0x80')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x81'));db[_0x44fb('0x82')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/interval/interval.model');db[_0x44fb('0x83')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x84'));db['Cdr']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x85'));db[_0x44fb('0x86')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x87'));db[_0x44fb('0x88')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x89'));db[_0x44fb('0x8a')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x8b'));db[_0x44fb('0x8c')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x8d'));db['Template']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x8e'));db[_0x44fb('0x8f')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x90'));db['Variable']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x91'));db[_0x44fb('0x92')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x93'));db[_0x44fb('0x94')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x95'));db[_0x44fb('0x96')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x97'));db[_0x44fb('0x98')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x99'));db['AnalyticExtractedReport']=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x44fb('0x9a')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0x9b'));db[_0x44fb('0x9c')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x9d'));db[_0x44fb('0x9e')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x9f'));db[_0x44fb('0xa0')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xa1'));db['SalesforceField']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xa2'));db['SugarcrmAccount']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xa3'));db[_0x44fb('0xa4')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xa5'));db[_0x44fb('0xa6')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xa7'));db[_0x44fb('0xa8')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x44fb('0xa9')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xaa'));db[_0x44fb('0xab')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xac'));db[_0x44fb('0xad')]=db['sequelize'][_0x44fb('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x44fb('0xae')]=db[_0x44fb('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x44fb('0xaf')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xb0'));db['ZendeskAccount']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0xb1'));db[_0x44fb('0xb2')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0xb3'));db[_0x44fb('0xb4')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xb5'));db[_0x44fb('0xb6')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xb7'));db[_0x44fb('0xb8')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xb9'));db['VtigerAccount']=db[_0x44fb('0x1')]['import'](_0x44fb('0xba'));db[_0x44fb('0xbb')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xbc'));db[_0x44fb('0xbd')]=db[_0x44fb('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x44fb('0xbe')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xbf'));db[_0x44fb('0xc0')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xc1'));db[_0x44fb('0xc2')]=db[_0x44fb('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x44fb('0x1')]['import'](_0x44fb('0xc3'));db[_0x44fb('0xc4')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xc5'));db['Dynamics365Field']=db['sequelize']['import'](_0x44fb('0xc6'));db[_0x44fb('0xc7')]=db['sequelize'][_0x44fb('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x44fb('0xc8')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xc9'));db['Integration']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x93'));db[_0x44fb('0xca')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xcb'));db[_0x44fb('0xcc')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xcd'));db[_0x44fb('0xce')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xcf'));db[_0x44fb('0xd0')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xd1'));db[_0x44fb('0xd2')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0xd3'));db[_0x44fb('0xd4')]=db['sequelize'][_0x44fb('0x14')](_0x44fb('0xd5'));db[_0x44fb('0xd6')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xd7'));db[_0x44fb('0xd8')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/squareReport/squareReport.model');db[_0x44fb('0xd9')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xda'));db[_0x44fb('0xdb')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xdc'));db[_0x44fb('0xdd')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xde'));db[_0x44fb('0xdf')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x44fb('0xe0')]=db['sequelize']['import']('../api/squareProject/squareProject.model');db['SquareRecording']=db['sequelize'][_0x44fb('0x14')](_0x44fb('0xe1'));db[_0x44fb('0xe2')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xe3'));db[_0x44fb('0xe4')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xe5'));db[_0x44fb('0xe6')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xe7'));db[_0x44fb('0xe8')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xe9'));db['Migration']=db[_0x44fb('0x1')]['import'](_0x44fb('0xea'));db['Attachment']=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x44fb('0xeb')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xec'));db[_0x44fb('0xed')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x44fb('0xee')]=db[_0x44fb('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x44fb('0xef')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xf0'));db['OpenchannelTransferReport']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xf1'));db[_0x44fb('0xf2')]=db[_0x44fb('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x44fb('0xf3')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xf4'));db[_0x44fb('0xf5')]=db[_0x44fb('0x1')]['import'](_0x44fb('0xf6'));db[_0x44fb('0xf7')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xf8'));db[_0x44fb('0xf9')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xfa'));db[_0x44fb('0xfb')]=db[_0x44fb('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db['Notification']=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xfc'));db[_0x44fb('0xfd')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0xfe'));db[_0x44fb('0xff')]=db[_0x44fb('0x1')][_0x44fb('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x44fb('0x100')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x101'));db[_0x44fb('0x102')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x103'));db[_0x44fb('0x104')]=db[_0x44fb('0x1')]['import'](_0x44fb('0x105'));db[_0x44fb('0x106')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x107'));db[_0x44fb('0x108')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x109'));db['WhatsappQueue']=db['sequelize'][_0x44fb('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x44fb('0x10a')]=db[_0x44fb('0x1')][_0x44fb('0x14')](_0x44fb('0x10b'));db['User'][_0x44fb('0x10c')](db[_0x44fb('0x21')],{'as':_0x44fb('0x21'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')]['hasMany'](db[_0x44fb('0x1d')],{'as':_0x44fb('0x10f'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x44fb('0x110'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')]['hasMany'](db[_0x44fb('0x19')],{'as':_0x44fb('0x111'),'onDelete':_0x44fb('0x10d'),'hooks':!![]});db[_0x44fb('0x13')]['hasMany'](db[_0x44fb('0x75')],{'as':_0x44fb('0x112'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')][_0x44fb('0x113')](db['CmHopperHistory'],{'as':_0x44fb('0x114'),'foreignKey':_0x44fb('0x10e')});db['User'][_0x44fb('0x113')](db['ReportAgentPreview'],{'as':_0x44fb('0x115'),'foreignKey':'UserId'});db[_0x44fb('0x13')][_0x44fb('0x113')](db[_0x44fb('0x5c')],{'as':_0x44fb('0x116'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')][_0x44fb('0x113')](db[_0x44fb('0x117')],{'as':'ChatInteractions','foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')][_0x44fb('0x113')](db[_0x44fb('0x54')],{'as':'SmsInteractions','foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')][_0x44fb('0x113')](db['FaxInteraction'],{'as':_0x44fb('0x118'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')]['hasMany'](db[_0x44fb('0x3f')],{'as':_0x44fb('0x119'),'foreignKey':_0x44fb('0x10e')});db['User'][_0x44fb('0x113')](db[_0x44fb('0x102')],{'as':_0x44fb('0x11a'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x13')][_0x44fb('0x113')](db[_0x44fb('0x11b')],{'as':_0x44fb('0x11c'),'foreignKey':_0x44fb('0x11d')});db[_0x44fb('0x13')]['hasMany'](db[_0x44fb('0xfd')],{'as':_0x44fb('0x11e'),'foreignKey':_0x44fb('0x11d')});db['User'][_0x44fb('0x11f')](db[_0x44fb('0xf7')],{'as':_0x44fb('0xf7'),'foreignKey':'userProfileId'});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x6e')],{'as':_0x44fb('0x121'),'through':_0x44fb('0x122')});db['User'][_0x44fb('0x120')](db[_0x44fb('0x72')],{'as':'Contacts','through':_0x44fb('0x123')});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x124'),'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['Team'],{'through':_0x44fb('0x125')});db[_0x44fb('0x13')][_0x44fb('0x120')](db['MailInteraction'],{'as':_0x44fb('0x119'),'through':_0x44fb('0x126')});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x117')],{'as':'ChatInteractions','through':_0x44fb('0x127')});db[_0x44fb('0x13')]['belongsToMany'](db[_0x44fb('0x4d')],{'as':'FaxInteractions','through':_0x44fb('0x128')});db['User'][_0x44fb('0x120')](db[_0x44fb('0x54')],{'as':_0x44fb('0x129'),'through':_0x44fb('0x12a')});db[_0x44fb('0x13')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x44fb('0x12b')});db[_0x44fb('0x13')]['belongsToMany'](db[_0x44fb('0x102')],{'as':_0x44fb('0x11a'),'through':_0x44fb('0x12c')});db['User'][_0x44fb('0x120')](db[_0x44fb('0x1b')],{'as':_0x44fb('0x12d'),'through':_0x44fb('0x2d'),'required':![]});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x3c')],{'as':'MailQueues','through':_0x44fb('0x31'),'required':![]});db[_0x44fb('0x13')]['belongsToMany'](db['ChatQueue'],{'as':_0x44fb('0x12e'),'through':_0x44fb('0x2f'),'required':![],'hooks':!![]});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x4e')],{'as':_0x44fb('0x12f'),'through':'UserFaxQueue','required':![]});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x57')],{'as':'SmsQueues','through':_0x44fb('0x130'),'required':![]});db['User']['belongsToMany'](db['OpenchannelQueue'],{'as':_0x44fb('0x131'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x44fb('0x120')](db['WhatsappQueue'],{'as':_0x44fb('0x132'),'through':_0x44fb('0x133'),'required':![]});db['User'][_0x44fb('0x120')](db[_0x44fb('0xf3')],{'through':_0x44fb('0x134')});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0xf5')],{'as':_0x44fb('0x135'),'through':_0x44fb('0x136'),'required':![]});db['User'][_0x44fb('0x120')](db[_0x44fb('0x62')],{'as':_0x44fb('0x137'),'through':'user_has_chat_websites'});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x138')],{'as':_0x44fb('0x139'),'through':'user_has_fax_accounts'});db[_0x44fb('0x13')]['belongsToMany'](db[_0x44fb('0x3a')],{'as':_0x44fb('0x13a'),'through':'user_has_mail_accounts'});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0x59')],{'as':_0x44fb('0x13b'),'through':_0x44fb('0x13c')});db[_0x44fb('0x13')]['belongsToMany'](db[_0x44fb('0x50')],{'as':_0x44fb('0x13d'),'through':_0x44fb('0x13e')});db['User'][_0x44fb('0x120')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x44fb('0x13f')});db[_0x44fb('0x13')][_0x44fb('0x120')](db[_0x44fb('0xe0')],{'as':_0x44fb('0x140'),'through':_0x44fb('0x141')});db[_0x44fb('0x142')][_0x44fb('0x113')](db[_0x44fb('0x19')],{'as':_0x44fb('0x143'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x144')});db[_0x44fb('0x17')]['hasMany'](db[_0x44fb('0x19')],{'onDelete':_0x44fb('0x10d')});db[_0x44fb('0x19')]['hasMany'](db[_0x44fb('0x19')],{'as':'Applications','onDelete':_0x44fb('0x10d')});db[_0x44fb('0x145')]['belongsToMany'](db['Sound'],{'as':'Sounds','through':_0x44fb('0x146')});db[_0x44fb('0x1b')][_0x44fb('0x113')](db[_0x44fb('0x147')],{'as':_0x44fb('0x148'),'foreignKey':'VoiceQueueId'});db[_0x44fb('0x1b')]['hasMany'](db[_0x44fb('0x73')],{'as':'Hoppers','foreignKey':_0x44fb('0x149')});db[_0x44fb('0x1b')][_0x44fb('0x113')](db[_0x44fb('0x75')],{'as':_0x44fb('0x112'),'foreignKey':_0x44fb('0x149')});db[_0x44fb('0x1b')][_0x44fb('0x113')](db[_0x44fb('0x76')],{'as':_0x44fb('0x14a'),'foreignKey':_0x44fb('0x149')});db['VoiceQueue'][_0x44fb('0x113')](db[_0x44fb('0x115')],{'as':_0x44fb('0x115'),'foreignKey':'VoiceQueueId'});db[_0x44fb('0x1b')]['hasMany'](db[_0x44fb('0x74')],{'as':_0x44fb('0x14b'),'foreignKey':_0x44fb('0x149')});db['VoiceQueue'][_0x44fb('0x113')](db[_0x44fb('0xd4')],{'as':'JscriptySessions','foreignKey':_0x44fb('0x149')});db['VoiceQueue'][_0x44fb('0x11f')](db['Trunk'],{'as':_0x44fb('0x29'),'foreignKey':'TrunkId'});db[_0x44fb('0x1b')]['belongsTo'](db[_0x44fb('0x29')],{'as':_0x44fb('0x14c'),'foreignKey':_0x44fb('0x14d')});db[_0x44fb('0x1b')]['belongsTo'](db[_0x44fb('0x82')],{'as':_0x44fb('0x82'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x1b')]['belongsTo'](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':_0x44fb('0x150')});db['VoiceQueue'][_0x44fb('0x120')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x124'),'through':'voice_queues_has_cm_lists'});db[_0x44fb('0x1b')]['belongsToMany'](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x2d')});db[_0x44fb('0x1b')][_0x44fb('0x120')](db['Team'],{'as':'Teams','through':_0x44fb('0x152')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x44fb('0x153'),'through':_0x44fb('0x154')});db[_0x44fb('0x1d')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':_0x44fb('0x13'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x1f')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':_0x44fb('0x13'),'foreignKey':'UserId'});db[_0x44fb('0x21')]['hasMany'](db[_0x44fb('0x22')],{'as':_0x44fb('0x155'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x156'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x44fb('0x11f')](db['VoiceMail'],{'foreignKey':_0x44fb('0x156'),'targetKey':_0x44fb('0x157')});db['VoiceCallReport'][_0x44fb('0x113')](db[_0x44fb('0x27')],{'as':'QueueCalls','foreignKey':_0x44fb('0x158'),'constraints':![]});db[_0x44fb('0x159')][_0x44fb('0x113')](db[_0x44fb('0x25')],{'as':_0x44fb('0x15a'),'foreignKey':_0x44fb('0x158'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x44fb('0x13')],{'as':_0x44fb('0x13'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x159')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':'Contact','foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x15c')][_0x44fb('0x11f')](db[_0x44fb('0x3a')],{'as':_0x44fb('0x3a'),'foreignKey':_0x44fb('0x15d')});db[_0x44fb('0x15e')]['belongsTo'](db[_0x44fb('0x3a')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailAccount'][_0x44fb('0x10c')](db[_0x44fb('0x15c')],{'as':_0x44fb('0x15f'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0x3a')][_0x44fb('0x10c')](db[_0x44fb('0x15e')],{'as':_0x44fb('0x160'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0x3a')]['hasMany'](db['Disposition'],{'as':_0x44fb('0x161'),'foreignKey':_0x44fb('0x15d')});db[_0x44fb('0x3a')][_0x44fb('0x113')](db['CannedAnswer'],{'as':_0x44fb('0x162'),'foreignKey':'MailAccountId'});db[_0x44fb('0x3a')]['hasMany'](db[_0x44fb('0x41')],{'as':'Messages','foreignKey':_0x44fb('0x15d')});db['MailAccount']['hasMany'](db[_0x44fb('0x3f')],{'as':_0x44fb('0x163')});db['MailAccount'][_0x44fb('0x113')](db[_0x44fb('0x43')],{'as':'Applications'});db[_0x44fb('0x3a')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0x3a')][_0x44fb('0x11f')](db[_0x44fb('0x166')],{'as':_0x44fb('0x166'),'foreignKey':_0x44fb('0x167')});db['MailAccount'][_0x44fb('0x11f')](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':_0x44fb('0x150')});db[_0x44fb('0x3a')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x168')});db[_0x44fb('0x3c')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x31')});db['MailQueue'][_0x44fb('0x120')](db[_0x44fb('0xe4')],{'through':_0x44fb('0x169'),'as':_0x44fb('0x16a')});db[_0x44fb('0x3f')]['hasMany'](db[_0x44fb('0x41')],{'as':_0x44fb('0x155'),'onDelete':_0x44fb('0x10d'),'foreignKey':'MailInteractionId'});db[_0x44fb('0x3f')]['belongsTo'](db[_0x44fb('0x3a')],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x15d')});db[_0x44fb('0x3f')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0x44fb('0x13')],{'as':_0x44fb('0x16c'),'foreignKey':'UserId'});db['MailInteraction'][_0x44fb('0x120')](db['Tag'],{'through':_0x44fb('0x16d'),'as':_0x44fb('0x16e')});db[_0x44fb('0x3f')][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':_0x44fb('0x16d'),'as':_0x44fb('0x16f')});db[_0x44fb('0x3f')][_0x44fb('0x120')](db['User'],{'as':'Users','through':_0x44fb('0x126'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':_0x44fb('0x10d')});db[_0x44fb('0x41')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':_0x44fb('0x13')});db['MailMessage'][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'onDelete':_0x44fb('0x10d'),'as':'Contact'});db[_0x44fb('0x41')][_0x44fb('0x11f')](db['MailInteraction'],{'as':_0x44fb('0x170'),'foreignKey':_0x44fb('0x171')});db[_0x44fb('0x41')][_0x44fb('0x11f')](db['MailAccount'],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x15d')});db[_0x44fb('0x43')]['belongsTo'](db[_0x44fb('0x13')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x44fb('0x3c')],{'onDelete':_0x44fb('0x172')});db['MailApplication'][_0x44fb('0x11f')](db[_0x44fb('0x3a')],{'onDelete':_0x44fb('0x172')});db[_0x44fb('0x43')][_0x44fb('0x11f')](db[_0x44fb('0x82')],{'onDelete':_0x44fb('0x172'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x43')][_0x44fb('0x11f')](db['Tag'],{'onDelete':_0x44fb('0x172'),'foreignKey':_0x44fb('0x173')});db[_0x44fb('0x45')][_0x44fb('0x11f')](db[_0x44fb('0x3a')],{});db[_0x44fb('0x45')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':'List','foreignKey':_0x44fb('0x165')});db[_0x44fb('0x45')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x45')]['belongsTo'](db[_0x44fb('0x3f')],{});db[_0x44fb('0x45')][_0x44fb('0x11f')](db[_0x44fb('0x41')],{});db['MailQueueReport']['belongsTo'](db[_0x44fb('0x13')],{});db[_0x44fb('0x45')][_0x44fb('0x11f')](db[_0x44fb('0x3c')],{});db[_0x44fb('0x47')][_0x44fb('0x113')](db[_0x44fb('0x48')],{'as':_0x44fb('0x175'),'onDelete':_0x44fb('0x10d')});db['FaxAccount']['hasMany'](db[_0x44fb('0x7f')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x44fb('0x138')][_0x44fb('0x113')](db[_0x44fb('0x7e')],{'as':_0x44fb('0x162'),'foreignKey':'FaxAccountId'});db[_0x44fb('0x138')][_0x44fb('0x113')](db[_0x44fb('0x4d')],{'as':'Interactions'});db['FaxAccount'][_0x44fb('0x113')](db[_0x44fb('0x4b')],{'as':_0x44fb('0x176')});db[_0x44fb('0x138')][_0x44fb('0x113')](db[_0x44fb('0x19')],{'as':_0x44fb('0x177'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0x138')]['hasMany'](db[_0x44fb('0x178')],{'as':_0x44fb('0x155')});db[_0x44fb('0x138')]['belongsTo'](db[_0x44fb('0x29')],{'as':'Trunk'});db[_0x44fb('0x138')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0x138')][_0x44fb('0x11f')](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':_0x44fb('0x150')});db['FaxAccount'][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x179')});db['FaxApplication'][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'onDelete':_0x44fb('0x172')});db[_0x44fb('0x4b')][_0x44fb('0x11f')](db[_0x44fb('0x4e')],{'onDelete':'restrict'});db[_0x44fb('0x4b')][_0x44fb('0x11f')](db[_0x44fb('0x138')],{'onDelete':'restrict'});db[_0x44fb('0x4b')]['belongsTo'](db[_0x44fb('0x8c')],{'onDelete':_0x44fb('0x172'),'foreignKey':'TagId'});db[_0x44fb('0x4d')][_0x44fb('0x113')](db[_0x44fb('0x178')],{'as':_0x44fb('0x155'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x17a')});db['FaxInteraction']['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x44fb('0x17b')});db[_0x44fb('0x4d')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x44fb('0x11f')](db['User'],{'as':_0x44fb('0x16c'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x4d')]['belongsToMany'](db[_0x44fb('0x8c')],{'through':_0x44fb('0x17c'),'as':_0x44fb('0x16e')});db[_0x44fb('0x4d')][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':'fax_interaction_has_tags','as':_0x44fb('0x16f')});db[_0x44fb('0x4d')][_0x44fb('0x120')](db['User'],{'as':_0x44fb('0x17d'),'through':'user_has_fax_interactions','foreignKey':_0x44fb('0x17a')});db[_0x44fb('0x178')]['belongsTo'](db[_0x44fb('0x13')],{'onDelete':'cascade','as':_0x44fb('0x13')});db[_0x44fb('0x178')]['belongsTo'](db[_0x44fb('0x4d')],{'as':_0x44fb('0x170'),'foreignKey':_0x44fb('0x17a')});db['FaxMessage'][_0x44fb('0x11f')](db['CmContact'],{'onDelete':_0x44fb('0x10d'),'as':_0x44fb('0x174')});db['FaxMessage'][_0x44fb('0x11f')](db[_0x44fb('0x17e')],{'as':_0x44fb('0x17e'),'foreignKey':_0x44fb('0x17f')});db[_0x44fb('0x178')]['belongsTo'](db[_0x44fb('0x138')],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x17b')});db[_0x44fb('0x4e')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':'UserFaxQueue'});db['FaxQueue'][_0x44fb('0x120')](db[_0x44fb('0xe4')],{'through':_0x44fb('0x180'),'as':_0x44fb('0x16a')});db[_0x44fb('0x181')][_0x44fb('0x11f')](db[_0x44fb('0x138')],{});db[_0x44fb('0x181')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0x181')]['belongsTo'](db['CmContact'],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x181')]['belongsTo'](db[_0x44fb('0x4d')],{});db[_0x44fb('0x181')][_0x44fb('0x11f')](db[_0x44fb('0x178')],{});db[_0x44fb('0x181')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{});db[_0x44fb('0x181')][_0x44fb('0x11f')](db[_0x44fb('0x4e')],{});db[_0x44fb('0x50')][_0x44fb('0x113')](db['Disposition'],{'as':_0x44fb('0x161'),'foreignKey':'SmsAccountId'});db[_0x44fb('0x50')]['hasMany'](db[_0x44fb('0x7e')],{'as':_0x44fb('0x162'),'foreignKey':'SmsAccountId'});db[_0x44fb('0x50')][_0x44fb('0x113')](db['SmsMessage'],{'as':_0x44fb('0x155'),'foreignKey':_0x44fb('0x182')});db[_0x44fb('0x50')][_0x44fb('0x113')](db['SmsInteraction'],{'as':_0x44fb('0x163')});db[_0x44fb('0x50')][_0x44fb('0x113')](db[_0x44fb('0x52')],{'as':'Applications'});db[_0x44fb('0x50')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':'List','foreignKey':_0x44fb('0x165')});db[_0x44fb('0x50')][_0x44fb('0x11f')](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':_0x44fb('0x150')});db['SmsAccount'][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':'user_has_sms_accounts'});db[_0x44fb('0x52')]['belongsTo'](db['User'],{'onDelete':_0x44fb('0x172')});db[_0x44fb('0x52')][_0x44fb('0x11f')](db[_0x44fb('0x57')],{'onDelete':'restrict'});db[_0x44fb('0x52')][_0x44fb('0x11f')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x44fb('0x52')][_0x44fb('0x11f')](db[_0x44fb('0x82')],{'onDelete':_0x44fb('0x172'),'foreignKey':'IntervalId'});db[_0x44fb('0x52')][_0x44fb('0x11f')](db[_0x44fb('0x8c')],{'onDelete':_0x44fb('0x172'),'foreignKey':'TagId'});db[_0x44fb('0x54')][_0x44fb('0x113')](db[_0x44fb('0x183')],{'as':_0x44fb('0x155'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x184')});db[_0x44fb('0x54')][_0x44fb('0x11f')](db['SmsAccount'],{'as':'Account','foreignKey':_0x44fb('0x182')});db[_0x44fb('0x54')]['belongsTo'](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x54')][_0x44fb('0x11f')](db['User'],{'as':_0x44fb('0x16c'),'foreignKey':'UserId'});db[_0x44fb('0x54')][_0x44fb('0x120')](db['Tag'],{'through':_0x44fb('0x185'),'as':_0x44fb('0x16e')});db[_0x44fb('0x54')]['belongsToMany'](db[_0x44fb('0x8c')],{'through':_0x44fb('0x185'),'as':'ThroughTags'});db[_0x44fb('0x54')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x17d'),'through':_0x44fb('0x12a'),'foreignKey':'SmsInteractionId'});db[_0x44fb('0x183')]['belongsTo'](db[_0x44fb('0x13')],{'as':_0x44fb('0x13')});db[_0x44fb('0x183')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'onDelete':_0x44fb('0x10d'),'as':'Contact'});db[_0x44fb('0x183')][_0x44fb('0x11f')](db[_0x44fb('0x54')],{'onDelete':_0x44fb('0x10d'),'as':_0x44fb('0x170'),'foreignKey':_0x44fb('0x184')});db[_0x44fb('0x183')][_0x44fb('0x11f')](db['SmsAccount'],{'as':_0x44fb('0x16b'),'foreignKey':'SmsAccountId'});db[_0x44fb('0x57')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x44fb('0x186')});db[_0x44fb('0x57')][_0x44fb('0x120')](db[_0x44fb('0xe4')],{'through':_0x44fb('0x187'),'as':_0x44fb('0x16a')});db[_0x44fb('0x59')][_0x44fb('0x113')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x44fb('0x188')});db['OpenchannelAccount'][_0x44fb('0x113')](db[_0x44fb('0x7e')],{'as':_0x44fb('0x162'),'foreignKey':_0x44fb('0x188')});db['OpenchannelAccount'][_0x44fb('0x113')](db[_0x44fb('0x5c')],{'as':_0x44fb('0x163'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x44fb('0x113')](db[_0x44fb('0x5e')],{'as':_0x44fb('0x155'),'foreignKey':_0x44fb('0x188')});db[_0x44fb('0x59')][_0x44fb('0x113')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x44fb('0x188')});db['OpenchannelAccount'][_0x44fb('0x11f')](db['CmList'],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0x59')][_0x44fb('0x11f')](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':'user_has_openchannel_accounts'});db[_0x44fb('0x5b')]['belongsTo'](db[_0x44fb('0x13')],{'onDelete':'restrict'});db[_0x44fb('0x5b')]['belongsTo'](db[_0x44fb('0x60')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x44fb('0x5b')][_0x44fb('0x11f')](db['OpenchannelAccount'],{'onDelete':_0x44fb('0x172'),'foreignKey':_0x44fb('0x188')});db[_0x44fb('0x5b')][_0x44fb('0x11f')](db['Interval'],{'onDelete':_0x44fb('0x172'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x5b')][_0x44fb('0x11f')](db[_0x44fb('0x8c')],{'onDelete':'restrict','foreignKey':_0x44fb('0x173')});db[_0x44fb('0x5c')]['hasMany'](db[_0x44fb('0x5e')],{'as':_0x44fb('0x155'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x44fb('0x5c')][_0x44fb('0x11f')](db[_0x44fb('0x59')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x44fb('0x5c')]['belongsTo'](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x5c')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':_0x44fb('0x16c'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':_0x44fb('0x189'),'as':_0x44fb('0x16e')});db[_0x44fb('0x5c')][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':_0x44fb('0x189'),'as':_0x44fb('0x16f')});db[_0x44fb('0x5c')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x17d'),'through':_0x44fb('0x12b'),'foreignKey':'OpenchannelInteractionId'});db[_0x44fb('0x5e')]['belongsTo'](db[_0x44fb('0x13')],{'onDelete':_0x44fb('0x10d'),'as':_0x44fb('0x13')});db[_0x44fb('0x5e')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'onDelete':'cascade','as':_0x44fb('0x174')});db[_0x44fb('0x5e')][_0x44fb('0x11f')](db['OpenchannelInteraction'],{'onDelete':_0x44fb('0x10d'),'as':'Interaction','foreignKey':_0x44fb('0x18a')});db[_0x44fb('0x5e')]['belongsTo'](db['Attachment'],{'as':_0x44fb('0x17e'),'foreignKey':_0x44fb('0x17f')});db[_0x44fb('0x5e')]['belongsTo'](db[_0x44fb('0x59')],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x188')});db[_0x44fb('0x60')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x35'),'foreignKey':_0x44fb('0x18b')});db[_0x44fb('0x60')][_0x44fb('0x120')](db[_0x44fb('0xe4')],{'through':_0x44fb('0x18c'),'as':'Teams'});db['ChatWebsite'][_0x44fb('0x113')](db[_0x44fb('0x7f')],{'as':_0x44fb('0x161'),'foreignKey':_0x44fb('0x18d')});db['ChatWebsite'][_0x44fb('0x113')](db['CannedAnswer'],{'as':_0x44fb('0x162'),'foreignKey':'ChatWebsiteId'});db[_0x44fb('0x62')][_0x44fb('0x113')](db[_0x44fb('0x70')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x44fb('0x113')](db[_0x44fb('0x117')],{'as':_0x44fb('0x163')});db[_0x44fb('0x62')][_0x44fb('0x113')](db[_0x44fb('0x65')],{'as':_0x44fb('0x176')});db['ChatWebsite'][_0x44fb('0x113')](db['ChatMessage'],{'as':'Messages'});db[_0x44fb('0x62')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':'ListId'});db[_0x44fb('0x62')][_0x44fb('0x11f')](db[_0x44fb('0x82')],{'as':_0x44fb('0x82'),'foreignKey':'IntervalId'});db[_0x44fb('0x62')][_0x44fb('0x11f')](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':_0x44fb('0x150')});db[_0x44fb('0x62')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x18e')});db[_0x44fb('0x64')][_0x44fb('0x11f')](db[_0x44fb('0x59')],{});db['OpenchannelQueueReport'][_0x44fb('0x11f')](db['CmList'],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0x64')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x64')][_0x44fb('0x11f')](db[_0x44fb('0x5c')],{});db[_0x44fb('0x64')][_0x44fb('0x11f')](db[_0x44fb('0x5e')],{});db[_0x44fb('0x64')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{});db[_0x44fb('0x64')]['belongsTo'](db[_0x44fb('0x60')],{});db[_0x44fb('0x65')]['belongsTo'](db[_0x44fb('0x13')],{'as':_0x44fb('0x18f'),'foreignKey':_0x44fb('0x10e'),'onDelete':'restrict'});db[_0x44fb('0x65')][_0x44fb('0x11f')](db[_0x44fb('0x6c')],{'as':_0x44fb('0x190'),'foreignKey':_0x44fb('0x191'),'onDelete':_0x44fb('0x172')});db[_0x44fb('0x65')][_0x44fb('0x11f')](db[_0x44fb('0x62')],{'as':'Website','foreignKey':_0x44fb('0x18d'),'onDelete':_0x44fb('0x172')});db['ChatApplication'][_0x44fb('0x11f')](db[_0x44fb('0x8c')],{'onDelete':_0x44fb('0x172'),'foreignKey':_0x44fb('0x173')});db[_0x44fb('0x117')]['hasMany'](db['ChatMessage'],{'as':_0x44fb('0x155'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x44fb('0x117')][_0x44fb('0x11f')](db['ChatWebsite'],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x18d')});db[_0x44fb('0x117')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db['ChatInteraction'][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':'Owner','foreignKey':_0x44fb('0x10e')});db['ChatInteraction'][_0x44fb('0x120')](db['Tag'],{'through':_0x44fb('0x192'),'as':_0x44fb('0x16e')});db[_0x44fb('0x117')][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':_0x44fb('0x192'),'as':'ThroughTags'});db['ChatInteraction'][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':'Users','through':_0x44fb('0x127'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'onDelete':_0x44fb('0x10d'),'as':'User'});db['ChatMessage']['belongsTo'](db[_0x44fb('0x72')],{'onDelete':'cascade','as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x68')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x44fb('0x10d'),'as':_0x44fb('0x170'),'foreignKey':_0x44fb('0x193')});db['ChatMessage'][_0x44fb('0x11f')](db['Attachment'],{'as':_0x44fb('0x17e'),'foreignKey':_0x44fb('0x17f')});db[_0x44fb('0x68')][_0x44fb('0x11f')](db['ChatWebsite'],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x18d')});db[_0x44fb('0x6a')]['belongsTo'](db[_0x44fb('0x72')],{'onDelete':_0x44fb('0x10d'),'as':'Contact','foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x6a')][_0x44fb('0x11f')](db[_0x44fb('0x62')],{'as':_0x44fb('0x16b'),'foreignKey':'ChatWebsiteId'});db[_0x44fb('0x6c')][_0x44fb('0x120')](db['User'],{'as':_0x44fb('0x151'),'through':_0x44fb('0x2f'),'hooks':!![]});db[_0x44fb('0x6c')][_0x44fb('0x120')](db[_0x44fb('0xe4')],{'through':_0x44fb('0x194'),'as':_0x44fb('0x16a')});db['ChatGroup'][_0x44fb('0x113')](db['ChatInternalMessage'],{'as':_0x44fb('0x155'),'foreignKey':'ChatGroupId','onDelete':_0x44fb('0x10d')});db[_0x44fb('0x6e')]['belongsToMany'](db[_0x44fb('0x13')],{'as':_0x44fb('0x148'),'through':_0x44fb('0x122')});db[_0x44fb('0x70')][_0x44fb('0x11f')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db[_0x44fb('0x72')],{'as':_0x44fb('0x195'),'foreignKey':_0x44fb('0x196')});db['CmContact'][_0x44fb('0x113')](db[_0x44fb('0x73')],{'as':_0x44fb('0x197'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x72')]['hasMany'](db['CmHopperFinal'],{'as':_0x44fb('0x112'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x72')][_0x44fb('0x113')](db['CmHopperHistory'],{'as':_0x44fb('0x14a'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x72')][_0x44fb('0x113')](db[_0x44fb('0x115')],{'as':'ReportAgentPreview','foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x72')]['hasMany'](db[_0x44fb('0xd4')],{'as':_0x44fb('0x198'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x72')][_0x44fb('0x113')](db[_0x44fb('0x5c')],{'as':_0x44fb('0x116'),'foreignKey':_0x44fb('0x15b'),'onDelete':_0x44fb('0x172')});db['CmContact']['hasMany'](db[_0x44fb('0x117')],{'as':_0x44fb('0x199'),'foreignKey':_0x44fb('0x15b'),'onDelete':'restrict'});db[_0x44fb('0x72')][_0x44fb('0x113')](db[_0x44fb('0x54')],{'as':_0x44fb('0x129'),'foreignKey':_0x44fb('0x15b'),'onDelete':_0x44fb('0x172')});db[_0x44fb('0x72')][_0x44fb('0x113')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x44fb('0x15b'),'onDelete':'restrict'});db[_0x44fb('0x72')][_0x44fb('0x113')](db[_0x44fb('0x3f')],{'as':_0x44fb('0x119'),'foreignKey':_0x44fb('0x15b'),'onDelete':_0x44fb('0x172')});db[_0x44fb('0x72')][_0x44fb('0x11f')](db['CmCompany'],{'as':'Company','foreignKey':_0x44fb('0x196')});db[_0x44fb('0x72')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0x72')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x17d'),'through':'cm_user_has_contacts'});db[_0x44fb('0x72')]['belongsToMany'](db[_0x44fb('0x8c')],{'as':_0x44fb('0x16e'),'through':_0x44fb('0x19a')});db['CmContact'][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':_0x44fb('0x19a'),'as':_0x44fb('0x16f')});db['CmHopper']['belongsTo'](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':'ContactId','onDelete':_0x44fb('0x10d')});db[_0x44fb('0x73')][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':'List','foreignKey':_0x44fb('0x165'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0x73')]['belongsTo'](db['User'],{'as':_0x44fb('0x18f'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x73')]['belongsTo'](db['VoiceQueue'],{'as':_0x44fb('0x190'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x44fb('0x73')]['belongsTo'](db[_0x44fb('0xe8')],{'as':'Campaign','foreignKey':_0x44fb('0x19b'),'onDelete':_0x44fb('0x10d')});db['CmHopper']['belongsTo'](db[_0x44fb('0x13')],{'as':'Owner','foreignKey':_0x44fb('0x19c')});db[_0x44fb('0x74')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b'),'onDelete':_0x44fb('0x10d')});db['CmHopperBlack']['belongsTo'](db[_0x44fb('0xf3')],{'as':'List','foreignKey':_0x44fb('0x165'),'onDelete':_0x44fb('0x10d')});db['CmHopperBlack'][_0x44fb('0x11f')](db[_0x44fb('0x1b')],{'as':'Queue','foreignKey':_0x44fb('0x149'),'onDelete':'cascade'});db[_0x44fb('0x74')]['belongsTo'](db[_0x44fb('0xe8')],{'as':_0x44fb('0xe8'),'foreignKey':'CampaignId','onDelete':_0x44fb('0x10d')});db[_0x44fb('0x7c')][_0x44fb('0x113')](db[_0x44fb('0x80')],{'as':{'plural':'All','singular':_0x44fb('0x19d')},'foreignKey':_0x44fb('0x19e'),'onDelete':_0x44fb('0x10d'),'hooks':!![]});db['Automation'][_0x44fb('0x113')](db['Condition'],{'as':{'plural':_0x44fb('0x19f'),'singular':'OneAny'},'foreignKey':_0x44fb('0x1a0'),'onDelete':'cascade','hooks':!![]});db[_0x44fb('0x7c')][_0x44fb('0x113')](db['Action'],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x44fb('0x10d'),'hooks':!![]});db[_0x44fb('0x7f')][_0x44fb('0x113')](db[_0x44fb('0x7f')],{'as':_0x44fb('0x161'),'foreignKey':'ParentId','onDelete':_0x44fb('0x10d')});db[_0x44fb('0x82')][_0x44fb('0x113')](db[_0x44fb('0x82')],{'as':'Intervals','foreignKey':_0x44fb('0x14e'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x44fb('0x82')]['hasMany'](db[_0x44fb('0x19')],{'as':_0x44fb('0x111'),'foreignKey':_0x44fb('0x14e'),'onDelete':_0x44fb('0x172')});db[_0x44fb('0x82')]['hasMany'](db[_0x44fb('0x43')],{'as':_0x44fb('0x1a1'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x82')][_0x44fb('0x113')](db[_0x44fb('0x65')],{'as':_0x44fb('0x1a2'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x82')][_0x44fb('0x113')](db[_0x44fb('0x4b')],{'as':_0x44fb('0x1a3'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x82')][_0x44fb('0x113')](db['SmsApplication'],{'as':_0x44fb('0x1a4'),'foreignKey':_0x44fb('0x14e')});db['Schedule'][_0x44fb('0x11f')](db[_0x44fb('0x3a')],{});db['Schedule'][_0x44fb('0x11f')](db[_0x44fb('0x98')],{'foreignKey':_0x44fb('0x1a5')});db['Schedule'][_0x44fb('0x11f')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x44fb('0x8a')][_0x44fb('0x120')](db[_0x44fb('0x145')],{'as':_0x44fb('0x1a6'),'through':'moh_has_sounds','onDelete':_0x44fb('0x172')});db[_0x44fb('0x8c')][_0x44fb('0x120')](db['CmContact'],{'through':_0x44fb('0x19a')});db[_0x44fb('0x8c')][_0x44fb('0x120')](db[_0x44fb('0x117')],{'through':_0x44fb('0x192')});db[_0x44fb('0x8c')]['belongsToMany'](db[_0x44fb('0x3f')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x44fb('0x120')](db[_0x44fb('0x54')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x44fb('0x120')](db[_0x44fb('0x4d')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x44fb('0x5c')],{'through':_0x44fb('0x189')});db['Tag'][_0x44fb('0x120')](db[_0x44fb('0x102')],{'through':_0x44fb('0x1a7')});db['Trigger']['hasMany'](db[_0x44fb('0x80')],{'as':{'plural':_0x44fb('0x1a8'),'singular':_0x44fb('0x1a9')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x44fb('0x8f')][_0x44fb('0x113')](db[_0x44fb('0x80')],{'as':{'plural':_0x44fb('0x1aa'),'singular':_0x44fb('0x1ab')},'foreignKey':_0x44fb('0x1ac'),'onDelete':_0x44fb('0x10d'),'hooks':!![]});db[_0x44fb('0x8f')]['hasMany'](db[_0x44fb('0x7a')],{'as':_0x44fb('0x1ad'),'foreignKey':_0x44fb('0x1ae'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x44fb('0x1af')],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b1'),'hooks':!![]});db[_0x44fb('0x98')][_0x44fb('0x113')](db[_0x44fb('0x1af')],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':'DefaultReportId'});db[_0x44fb('0x9a')][_0x44fb('0x113')](db['AnalyticFieldReport'],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b2')});db['AnalyticFieldReport'][_0x44fb('0x11f')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x44fb('0x9e')][_0x44fb('0x113')](db[_0x44fb('0xa0')],{'as':_0x44fb('0x1b3'),'onDelete':'cascade','foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xa0')]['hasMany'](db[_0x44fb('0x1b5')],{'as':_0x44fb('0x1b6'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xa0')][_0x44fb('0x113')](db[_0x44fb('0x1b5')],{'as':_0x44fb('0x1b8'),'onDelete':'cascade','foreignKey':_0x44fb('0x1b9')});db['SalesforceConfiguration'][_0x44fb('0x113')](db[_0x44fb('0x1b5')],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xa0')][_0x44fb('0x11f')](db[_0x44fb('0x9e')],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0x1b5')]['hasMany'](db[_0x44fb('0x1b5')],{'as':'Subject','foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0x1b5')][_0x44fb('0x113')](db[_0x44fb('0x1b5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x44fb('0x1b5')]['hasMany'](db[_0x44fb('0x1b5')],{'as':_0x44fb('0x1bb'),'foreignKey':'FieldId'});db['SalesforceField'][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':_0x44fb('0x1bd')});db[_0x44fb('0x1be')][_0x44fb('0x113')](db[_0x44fb('0xa4')],{'as':'Configurations','onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xa4')][_0x44fb('0x113')](db[_0x44fb('0xa6')],{'as':_0x44fb('0x1b6'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xa4')][_0x44fb('0x113')](db['SugarcrmField'],{'as':_0x44fb('0x1b8'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b9')});db['SugarcrmConfiguration'][_0x44fb('0x113')](db[_0x44fb('0xa6')],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xa4')]['belongsTo'](db[_0x44fb('0x1be')],{'as':'Account','foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xa6')][_0x44fb('0x113')](db[_0x44fb('0xa6')],{'as':'Subject','foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xa6')][_0x44fb('0x113')](db[_0x44fb('0xa6')],{'as':_0x44fb('0x1bf'),'foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xa6')][_0x44fb('0x113')](db[_0x44fb('0xa6')],{'as':_0x44fb('0x1bb'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xa6')][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':'VariableId'});db[_0x44fb('0xa8')][_0x44fb('0x113')](db[_0x44fb('0xa9')],{'as':_0x44fb('0x1b3'),'onDelete':_0x44fb('0x10d'),'foreignKey':'AccountId'});db[_0x44fb('0xa9')][_0x44fb('0x113')](db['DeskField'],{'as':_0x44fb('0x1b6'),'onDelete':'cascade','foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xa9')][_0x44fb('0x113')](db['DeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xa9')][_0x44fb('0x113')](db['DeskField'],{'as':_0x44fb('0x1b0'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x44fb('0xa9')][_0x44fb('0x11f')](db['DeskAccount'],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x1b4')});db['DeskConfiguration'][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':_0x44fb('0x1c0')});db[_0x44fb('0xab')][_0x44fb('0x113')](db['DeskField'],{'as':_0x44fb('0x1c1'),'foreignKey':'SubjectId'});db['DeskField']['hasMany'](db[_0x44fb('0xab')],{'as':_0x44fb('0x1bf'),'foreignKey':'DescriptionId'});db['DeskField'][_0x44fb('0x113')](db[_0x44fb('0xab')],{'as':_0x44fb('0x1bb'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xab')][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':_0x44fb('0x1bd')});db[_0x44fb('0xad')]['hasMany'](db[_0x44fb('0xae')],{'as':_0x44fb('0x1b3'),'onDelete':_0x44fb('0x10d'),'foreignKey':'AccountId'});db[_0x44fb('0xae')]['hasMany'](db[_0x44fb('0xaf')],{'as':_0x44fb('0x1b6'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xae')][_0x44fb('0x113')](db[_0x44fb('0xaf')],{'as':'Descriptions','onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xae')][_0x44fb('0x113')](db['ZohoField'],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xae')][_0x44fb('0x11f')](db['ZohoAccount'],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xaf')][_0x44fb('0x113')](db[_0x44fb('0xaf')],{'as':_0x44fb('0x1c1'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xaf')][_0x44fb('0x113')](db[_0x44fb('0xaf')],{'as':'Description','foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xaf')][_0x44fb('0x113')](db[_0x44fb('0xaf')],{'as':_0x44fb('0x1bb'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xaf')][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':_0x44fb('0x1bd')});db['ZendeskAccount'][_0x44fb('0x113')](db[_0x44fb('0xb2')],{'as':_0x44fb('0x1b3'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xb2')][_0x44fb('0x113')](db['ZendeskField'],{'as':_0x44fb('0x1b6'),'foreignKey':'SubjectId'});db[_0x44fb('0xb2')]['hasMany'](db[_0x44fb('0x1c2')],{'as':_0x44fb('0x1b8'),'foreignKey':'DescriptionId'});db[_0x44fb('0xb2')][_0x44fb('0x113')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xb2')][_0x44fb('0x11f')](db['ZendeskAccount'],{'as':_0x44fb('0x16b'),'foreignKey':'AccountId'});db[_0x44fb('0xb2')][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x44fb('0x113')](db[_0x44fb('0x1c2')],{'as':_0x44fb('0x1c1'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0x1c2')][_0x44fb('0x113')](db[_0x44fb('0x1c2')],{'as':_0x44fb('0x1bf'),'foreignKey':_0x44fb('0x1b9')});db['ZendeskField'][_0x44fb('0x113')](db[_0x44fb('0x1c2')],{'as':'Field','foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0x1c2')]['belongsTo'](db[_0x44fb('0x1bc')],{'as':'Variable','foreignKey':_0x44fb('0x1bd')});db[_0x44fb('0xb4')][_0x44fb('0x113')](db[_0x44fb('0xb6')],{'as':_0x44fb('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x44fb('0x113')](db['FreshdeskField'],{'as':_0x44fb('0x1b6'),'onDelete':'cascade','foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xb6')][_0x44fb('0x113')](db[_0x44fb('0xb8')],{'as':_0x44fb('0x1b8'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b9')});db['FreshdeskConfiguration'][_0x44fb('0x113')](db[_0x44fb('0xb8')],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':'FieldId'});db[_0x44fb('0xb6')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xb6')]['belongsToMany'](db[_0x44fb('0x8c')],{'through':_0x44fb('0x1c3')});db[_0x44fb('0xb8')]['hasMany'](db[_0x44fb('0xb8')],{'as':_0x44fb('0x1c1'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xb8')][_0x44fb('0x113')](db[_0x44fb('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x44fb('0xb8')][_0x44fb('0x113')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xb8')][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':'VariableId'});db[_0x44fb('0x1c4')][_0x44fb('0x113')](db[_0x44fb('0xbb')],{'as':_0x44fb('0x1b3'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xbb')]['hasMany'](db[_0x44fb('0xbd')],{'as':_0x44fb('0x1b6'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xbb')][_0x44fb('0x113')](db[_0x44fb('0xbd')],{'as':_0x44fb('0x1b8'),'foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xbb')][_0x44fb('0x113')](db['VtigerField'],{'as':_0x44fb('0x1b0'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xbb')][_0x44fb('0x11f')](db['VtigerAccount'],{'as':_0x44fb('0x16b'),'foreignKey':'AccountId'});db[_0x44fb('0xbd')][_0x44fb('0x113')](db[_0x44fb('0xbd')],{'as':_0x44fb('0x1c1'),'foreignKey':'SubjectId'});db[_0x44fb('0xbd')]['hasMany'](db[_0x44fb('0xbd')],{'as':_0x44fb('0x1bf'),'foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xbd')][_0x44fb('0x113')](db[_0x44fb('0xbd')],{'as':_0x44fb('0x1bb'),'foreignKey':_0x44fb('0x1ba')});db['VtigerField'][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':'VariableId'});db[_0x44fb('0xbe')][_0x44fb('0x113')](db[_0x44fb('0xc0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x44fb('0x1b4')});db['ServicenowConfiguration'][_0x44fb('0x113')](db[_0x44fb('0xc2')],{'as':_0x44fb('0x1b6'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xc0')][_0x44fb('0x113')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xc0')][_0x44fb('0x113')](db[_0x44fb('0xc2')],{'as':_0x44fb('0x1b0'),'foreignKey':'FieldId'});db[_0x44fb('0xc0')]['belongsTo'](db[_0x44fb('0xbe')],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xc2')][_0x44fb('0x113')](db[_0x44fb('0xc2')],{'as':_0x44fb('0x1c1'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0xc2')][_0x44fb('0x113')](db[_0x44fb('0xc2')],{'as':'Description','foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xc2')][_0x44fb('0x113')](db[_0x44fb('0xc2')],{'as':'Field','foreignKey':_0x44fb('0x1ba')});db['ServicenowField'][_0x44fb('0x11f')](db['Variable'],{'as':_0x44fb('0x1bc'),'foreignKey':_0x44fb('0x1bd')});db[_0x44fb('0x1c5')][_0x44fb('0x113')](db[_0x44fb('0xc4')],{'as':'Configurations','onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1b7')});db['Dynamics365Configuration']['hasMany'](db[_0x44fb('0x1c6')],{'as':_0x44fb('0x1b8'),'onDelete':'cascade','foreignKey':_0x44fb('0x1b9')});db['Dynamics365Configuration']['hasMany'](db[_0x44fb('0x1c6')],{'as':_0x44fb('0x1b0'),'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1ba')});db['Dynamics365Configuration'][_0x44fb('0x11f')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x44fb('0x1b4')});db[_0x44fb('0x1c6')][_0x44fb('0x113')](db[_0x44fb('0x1c6')],{'as':_0x44fb('0x1c1'),'foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0x1c6')][_0x44fb('0x113')](db[_0x44fb('0x1c6')],{'as':_0x44fb('0x1bf'),'foreignKey':_0x44fb('0x1b9')});db['Dynamics365Field'][_0x44fb('0x113')](db[_0x44fb('0x1c6')],{'as':'Field','foreignKey':'FieldId'});db[_0x44fb('0x1c6')][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':_0x44fb('0x1bd')});db[_0x44fb('0xc7')][_0x44fb('0x113')](db['FreshsalesConfiguration'],{'as':_0x44fb('0x1b3'),'onDelete':_0x44fb('0x10d'),'foreignKey':'AccountId'});db[_0x44fb('0x1c7')][_0x44fb('0x113')](db[_0x44fb('0xc8')],{'as':'Subjects','foreignKey':_0x44fb('0x1b7')});db[_0x44fb('0x1c7')][_0x44fb('0x113')](db[_0x44fb('0xc8')],{'as':'Descriptions','foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0x1c7')][_0x44fb('0x113')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0x1c7')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x44fb('0x16b'),'foreignKey':'AccountId'});db[_0x44fb('0xc8')][_0x44fb('0x113')](db['FreshsalesField'],{'as':_0x44fb('0x1c1'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x44fb('0x113')](db[_0x44fb('0xc8')],{'as':_0x44fb('0x1bf'),'foreignKey':_0x44fb('0x1b9')});db[_0x44fb('0xc8')]['hasMany'](db[_0x44fb('0xc8')],{'as':_0x44fb('0x1bb'),'foreignKey':_0x44fb('0x1ba')});db[_0x44fb('0xc8')][_0x44fb('0x11f')](db[_0x44fb('0x1bc')],{'as':_0x44fb('0x1bc'),'foreignKey':_0x44fb('0x1bd')});db['ChatQueueReport'][_0x44fb('0x11f')](db[_0x44fb('0x62')],{});db['ChatQueueReport'][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0xcc')]['belongsTo'](db[_0x44fb('0x72')],{'as':_0x44fb('0x174'),'foreignKey':_0x44fb('0x15b')});db[_0x44fb('0xcc')]['belongsTo'](db[_0x44fb('0x117')],{});db[_0x44fb('0xcc')][_0x44fb('0x11f')](db['ChatMessage'],{});db[_0x44fb('0xcc')][_0x44fb('0x11f')](db['User'],{});db[_0x44fb('0xcc')][_0x44fb('0x11f')](db[_0x44fb('0x6c')],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x44fb('0x10d'),'foreignKey':_0x44fb('0x1c8')});db['ChatInternalMessage'][_0x44fb('0x11f')](db['User'],{'onDelete':_0x44fb('0x10d'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x44fb('0x113')](db[_0x44fb('0xd2')],{'foreignKey':_0x44fb('0x1c9'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0xd4')][_0x44fb('0x113')](db[_0x44fb('0xd0')],{'foreignKey':_0x44fb('0x1c9'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0xd6')][_0x44fb('0x11f')](db[_0x44fb('0x50')],{});db['SmsQueueReport'][_0x44fb('0x11f')](db[_0x44fb('0xf3')],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db['SmsQueueReport'][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'as':'Contact','foreignKey':_0x44fb('0x15b')});db[_0x44fb('0xd6')]['belongsTo'](db['SmsInteraction'],{});db[_0x44fb('0xd6')][_0x44fb('0x11f')](db[_0x44fb('0x183')],{});db[_0x44fb('0xd6')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{});db['SmsQueueReport'][_0x44fb('0x11f')](db[_0x44fb('0x57')],{});db['JscriptyProject'][_0x44fb('0x113')](db[_0x44fb('0xd4')],{'foreignKey':_0x44fb('0x1ca')});db['JscriptyProject'][_0x44fb('0x113')](db['JscriptyQuestionReport'],{'foreignKey':_0x44fb('0x1ca')});db[_0x44fb('0xdb')][_0x44fb('0x113')](db[_0x44fb('0xd0')],{'foreignKey':'ProjectId'});db[_0x44fb('0xe0')][_0x44fb('0x120')](db['User'],{'as':_0x44fb('0x17d'),'through':_0x44fb('0x141')});db[_0x44fb('0xe4')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':'user_has_teams'});db[_0x44fb('0xe4')][_0x44fb('0x120')](db[_0x44fb('0x1b')],{'through':'team_has_voice_queues','as':_0x44fb('0x12d')});db[_0x44fb('0xe4')]['belongsToMany'](db[_0x44fb('0x3c')],{'through':'team_has_mail_queues','as':_0x44fb('0x1cb')});db[_0x44fb('0xe4')][_0x44fb('0x120')](db['ChatQueue'],{'through':_0x44fb('0x194'),'as':_0x44fb('0x12e')});db['Team'][_0x44fb('0x120')](db[_0x44fb('0x4e')],{'through':_0x44fb('0x180'),'as':_0x44fb('0x12f')});db[_0x44fb('0xe4')][_0x44fb('0x120')](db[_0x44fb('0x57')],{'through':_0x44fb('0x187'),'as':_0x44fb('0x1cc')});db['Team']['belongsToMany'](db[_0x44fb('0x60')],{'through':_0x44fb('0x18c'),'as':_0x44fb('0x131')});db['Team']['belongsToMany'](db[_0x44fb('0x1cd')],{'through':'team_has_whatsapp_queues','as':_0x44fb('0x132')});db['Campaign'][_0x44fb('0x113')](db[_0x44fb('0x73')],{'as':_0x44fb('0x197'),'foreignKey':_0x44fb('0x19b')});db['Campaign'][_0x44fb('0x113')](db[_0x44fb('0x75')],{'as':_0x44fb('0x112'),'foreignKey':_0x44fb('0x19b')});db[_0x44fb('0xe8')][_0x44fb('0x113')](db[_0x44fb('0x76')],{'as':_0x44fb('0x14a'),'foreignKey':_0x44fb('0x19b')});db[_0x44fb('0xe8')][_0x44fb('0x113')](db[_0x44fb('0x74')],{'as':_0x44fb('0x14b'),'foreignKey':'CampaignId'});db[_0x44fb('0xe8')]['belongsTo'](db[_0x44fb('0x29')],{'as':'Trunk','foreignKey':_0x44fb('0x1ce')});db[_0x44fb('0xe8')][_0x44fb('0x11f')](db[_0x44fb('0x29')],{'as':_0x44fb('0x14c'),'foreignKey':_0x44fb('0x14d')});db[_0x44fb('0xe8')][_0x44fb('0x11f')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db['Campaign'][_0x44fb('0x11f')](db['SquareProject'],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x44fb('0xe8')][_0x44fb('0x120')](db[_0x44fb('0xf3')],{'as':'Lists','through':_0x44fb('0x1cf')});db[_0x44fb('0xe8')][_0x44fb('0x120')](db['CmList'],{'as':'BlackLists','through':_0x44fb('0x1d0')});db[_0x44fb('0xed')][_0x44fb('0x11f')](db['MailMessage'],{});db[_0x44fb('0xed')][_0x44fb('0x11f')](db[_0x44fb('0x3f')],{});db['MailTransferReport'][_0x44fb('0x11f')](db[_0x44fb('0x3a')],{'foreignKey':_0x44fb('0x1d1'),'as':_0x44fb('0x1d2')});db[_0x44fb('0xed')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'foreignKey':'FromUserId','as':_0x44fb('0x1d3')});db[_0x44fb('0xed')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'foreignKey':_0x44fb('0x1d4'),'as':_0x44fb('0x1d5')});db[_0x44fb('0xed')][_0x44fb('0x11f')](db[_0x44fb('0x3c')],{'foreignKey':_0x44fb('0x1d6'),'as':_0x44fb('0x1d7')});db[_0x44fb('0xed')][_0x44fb('0x11f')](db[_0x44fb('0x3a')],{'foreignKey':'ToMailAccountId','as':_0x44fb('0x1d8')});db[_0x44fb('0xee')]['belongsTo'](db[_0x44fb('0x68')],{});db[_0x44fb('0xee')][_0x44fb('0x11f')](db[_0x44fb('0x117')],{});db[_0x44fb('0xee')][_0x44fb('0x11f')](db[_0x44fb('0x62')],{'foreignKey':_0x44fb('0x1d9'),'as':_0x44fb('0x1d2')});db['ChatTransferReport'][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'foreignKey':_0x44fb('0x1da'),'as':'FromAgent'});db[_0x44fb('0xee')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'foreignKey':_0x44fb('0x1d4'),'as':_0x44fb('0x1d5')});db[_0x44fb('0xee')][_0x44fb('0x11f')](db[_0x44fb('0x6c')],{'foreignKey':_0x44fb('0x1db'),'as':'ToQueue'});db[_0x44fb('0xee')]['belongsTo'](db[_0x44fb('0x62')],{'foreignKey':_0x44fb('0x1dc'),'as':_0x44fb('0x1d8')});db[_0x44fb('0xef')][_0x44fb('0x11f')](db['FaxMessage'],{});db[_0x44fb('0xef')]['belongsTo'](db[_0x44fb('0x4d')],{});db['FaxTransferReport'][_0x44fb('0x11f')](db[_0x44fb('0x138')],{'foreignKey':_0x44fb('0x1dd'),'as':_0x44fb('0x1d2')});db['FaxTransferReport'][_0x44fb('0x11f')](db['User'],{'foreignKey':_0x44fb('0x1da'),'as':'FromAgent'});db['FaxTransferReport'][_0x44fb('0x11f')](db['User'],{'foreignKey':_0x44fb('0x1d4'),'as':_0x44fb('0x1d5')});db[_0x44fb('0xef')][_0x44fb('0x11f')](db[_0x44fb('0x4e')],{'foreignKey':_0x44fb('0x1de'),'as':_0x44fb('0x1d7')});db['FaxTransferReport']['belongsTo'](db[_0x44fb('0x138')],{'foreignKey':_0x44fb('0x1df'),'as':_0x44fb('0x1d8')});db[_0x44fb('0x1e0')][_0x44fb('0x11f')](db['OpenchannelMessage'],{});db[_0x44fb('0x1e0')]['belongsTo'](db[_0x44fb('0x5c')],{});db[_0x44fb('0x1e0')][_0x44fb('0x11f')](db[_0x44fb('0x59')],{'foreignKey':_0x44fb('0x1e1'),'as':_0x44fb('0x1d2')});db[_0x44fb('0x1e0')]['belongsTo'](db[_0x44fb('0x13')],{'foreignKey':'FromUserId','as':_0x44fb('0x1d3')});db[_0x44fb('0x1e0')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'foreignKey':_0x44fb('0x1d4'),'as':_0x44fb('0x1d5')});db[_0x44fb('0x1e0')][_0x44fb('0x11f')](db[_0x44fb('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':_0x44fb('0x1d7')});db[_0x44fb('0x1e0')][_0x44fb('0x11f')](db[_0x44fb('0x59')],{'foreignKey':_0x44fb('0x1e2'),'as':_0x44fb('0x1d8')});db[_0x44fb('0xf2')][_0x44fb('0x11f')](db[_0x44fb('0x183')],{});db[_0x44fb('0xf2')][_0x44fb('0x11f')](db[_0x44fb('0x54')],{});db[_0x44fb('0xf2')][_0x44fb('0x11f')](db[_0x44fb('0x50')],{'foreignKey':_0x44fb('0x1e3'),'as':_0x44fb('0x1d2')});db[_0x44fb('0xf2')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'foreignKey':_0x44fb('0x1da'),'as':_0x44fb('0x1d3')});db[_0x44fb('0xf2')][_0x44fb('0x11f')](db['User'],{'foreignKey':_0x44fb('0x1d4'),'as':_0x44fb('0x1d5')});db[_0x44fb('0xf2')][_0x44fb('0x11f')](db[_0x44fb('0x57')],{'foreignKey':'ToSmsQueueId','as':_0x44fb('0x1d7')});db['SmsTransferReport'][_0x44fb('0x11f')](db[_0x44fb('0x50')],{'foreignKey':'ToSmsAccountId','as':_0x44fb('0x1d8')});db[_0x44fb('0xf3')]['hasMany'](db[_0x44fb('0x7f')],{'as':_0x44fb('0x161'),'foreignKey':_0x44fb('0x165')});db['CmList'][_0x44fb('0x113')](db[_0x44fb('0x78')],{'as':_0x44fb('0x1e4'),'foreignKey':_0x44fb('0x165')});db['CmList'][_0x44fb('0x113')](db[_0x44fb('0x72')],{'as':_0x44fb('0x195'),'onDelete':'cascade','foreignKey':_0x44fb('0x165')});db[_0x44fb('0xf3')]['hasMany'](db['CmHopperFinal'],{'as':_0x44fb('0x112'),'foreignKey':_0x44fb('0x165')});db['CmList'][_0x44fb('0x113')](db['CmHopperHistory'],{'as':_0x44fb('0x114'),'foreignKey':_0x44fb('0x165')});db['CmList'][_0x44fb('0x113')](db[_0x44fb('0x115')],{'as':_0x44fb('0x115'),'foreignKey':_0x44fb('0x165')});db[_0x44fb('0xf3')][_0x44fb('0x120')](db[_0x44fb('0x1b')],{'as':_0x44fb('0x1e5'),'through':_0x44fb('0x1e6')});db[_0x44fb('0xf3')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x134')});db[_0x44fb('0xf5')][_0x44fb('0x113')](db[_0x44fb('0x19')],{'as':_0x44fb('0x111'),'onDelete':_0x44fb('0x10d')});db[_0x44fb('0xf5')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x136')});db[_0x44fb('0xf7')][_0x44fb('0x113')](db['User'],{'as':_0x44fb('0x17d'),'foreignKey':_0x44fb('0x1e7')});db[_0x44fb('0xf7')][_0x44fb('0x113')](db[_0x44fb('0xf9')],{'as':_0x44fb('0x1e8'),'foreignKey':_0x44fb('0x1e7'),'onDelete':'cascade'});db[_0x44fb('0xf9')][_0x44fb('0x113')](db[_0x44fb('0xfb')],{'as':_0x44fb('0x1e9'),'foreignKey':_0x44fb('0x1ea'),'onDelete':'cascade'});db[_0x44fb('0xff')][_0x44fb('0x113')](db['Disposition'],{'as':_0x44fb('0x161'),'foreignKey':'WhatsappAccountId'});db[_0x44fb('0xff')][_0x44fb('0x113')](db[_0x44fb('0x7e')],{'as':_0x44fb('0x162'),'foreignKey':'WhatsappAccountId'});db[_0x44fb('0xff')][_0x44fb('0x113')](db['WhatsappMessage'],{'as':_0x44fb('0x155'),'foreignKey':_0x44fb('0x1eb')});db['WhatsappAccount']['hasMany'](db[_0x44fb('0x102')],{'as':'Interactions'});db[_0x44fb('0xff')][_0x44fb('0x113')](db[_0x44fb('0x100')],{'as':_0x44fb('0x176')});db[_0x44fb('0xff')][_0x44fb('0x11f')](db['CmList'],{'as':'List','foreignKey':_0x44fb('0x165')});db[_0x44fb('0xff')]['belongsTo'](db[_0x44fb('0x83')],{'as':_0x44fb('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x44fb('0xff')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x44fb('0x100')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'onDelete':_0x44fb('0x172')});db[_0x44fb('0x100')][_0x44fb('0x11f')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x44fb('0x100')]['belongsTo'](db[_0x44fb('0xff')],{'onDelete':_0x44fb('0x172')});db['WhatsappApplication']['belongsTo'](db[_0x44fb('0x82')],{'onDelete':_0x44fb('0x172'),'foreignKey':_0x44fb('0x14e')});db[_0x44fb('0x100')]['belongsTo'](db[_0x44fb('0x8c')],{'onDelete':'restrict','foreignKey':_0x44fb('0x173')});db[_0x44fb('0x102')][_0x44fb('0x113')](db[_0x44fb('0x104')],{'as':_0x44fb('0x155'),'onDelete':'cascade','foreignKey':_0x44fb('0x1ec')});db[_0x44fb('0x102')][_0x44fb('0x11f')](db[_0x44fb('0xff')],{'as':_0x44fb('0x16b'),'foreignKey':_0x44fb('0x1eb')});db[_0x44fb('0x102')][_0x44fb('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction'][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':_0x44fb('0x16c'),'foreignKey':_0x44fb('0x10e')});db[_0x44fb('0x102')][_0x44fb('0x120')](db[_0x44fb('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x44fb('0x16e')});db[_0x44fb('0x102')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x44fb('0x16f')});db['WhatsappInteraction'][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x17d'),'through':_0x44fb('0x12c'),'foreignKey':'WhatsappInteractionId'});db[_0x44fb('0x104')][_0x44fb('0x11f')](db[_0x44fb('0x13')],{'as':_0x44fb('0x13')});db[_0x44fb('0x104')][_0x44fb('0x11f')](db[_0x44fb('0x72')],{'onDelete':_0x44fb('0x10d'),'as':'Contact'});db['WhatsappMessage'][_0x44fb('0x11f')](db[_0x44fb('0x102')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x44fb('0x1ec')});db[_0x44fb('0x104')]['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x44fb('0x1eb')});db[_0x44fb('0x106')]['belongsTo'](db[_0x44fb('0xff')],{});db[_0x44fb('0x106')][_0x44fb('0x11f')](db['CmList'],{'as':_0x44fb('0x164'),'foreignKey':_0x44fb('0x165')});db['WhatsappQueueReport']['belongsTo'](db[_0x44fb('0x72')],{'as':'Contact','foreignKey':_0x44fb('0x15b')});db[_0x44fb('0x106')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x44fb('0x106')][_0x44fb('0x11f')](db[_0x44fb('0x1cd')],{});db[_0x44fb('0x106')]['belongsTo'](db[_0x44fb('0x104')],{});db[_0x44fb('0x106')][_0x44fb('0x11f')](db['User'],{});db[_0x44fb('0x108')]['belongsTo'](db['WhatsappMessage'],{});db[_0x44fb('0x108')][_0x44fb('0x11f')](db[_0x44fb('0x102')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x44fb('0xff')],{'foreignKey':'FromWhatsappAccountId','as':_0x44fb('0x1d2')});db[_0x44fb('0x108')][_0x44fb('0x11f')](db[_0x44fb('0xff')],{'foreignKey':'ToWhatsappAccountId','as':_0x44fb('0x1d8')});db[_0x44fb('0x108')][_0x44fb('0x11f')](db[_0x44fb('0x1cd')],{'foreignKey':_0x44fb('0x1ed'),'as':'ToQueue'});db[_0x44fb('0x108')]['belongsTo'](db['User'],{'foreignKey':_0x44fb('0x1da'),'as':_0x44fb('0x1d3')});db[_0x44fb('0x108')][_0x44fb('0x11f')](db['User'],{'foreignKey':'ToUserId','as':_0x44fb('0x1d5')});db[_0x44fb('0x1cd')][_0x44fb('0x120')](db[_0x44fb('0x13')],{'as':_0x44fb('0x151'),'through':_0x44fb('0x133'),'foreignKey':_0x44fb('0x1ee')});db[_0x44fb('0x1cd')][_0x44fb('0x120')](db[_0x44fb('0xe4')],{'through':'team_has_whatsapp_queues','as':_0x44fb('0x16a')});module[_0x44fb('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd8a5=['../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteractions','MailInteractions','SenderId','userNotification','userNotifications','belongsTo','userProfileId','ChatGroup','chat_group_has_users','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteraction','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','MailQueues','UserMailQueue','ChatQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailServerOut','Imap','Dispositions','Answers','MailAccountId','Messages','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','restrict','TagId','MailQueueReport','Items','FaxAccountId','CannedAnswer','FaxApplication','Exntensions','FaxQueue','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Website','ChatWebsiteId','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','CompanyId','CmHopperHistory','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','Actions','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','Schedule','AnalyticDefaultReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','Description','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','Dynamics365Configuration','FreshsalesField','FreshsalesConfiguration','FromId','JscriptyAnswerReport','SessionId','ProjectId','FaxQueues','team_has_sms_queues','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField'];(function(_0x5a1d98,_0x574513){var _0x2e164f=function(_0x116fc0){while(--_0x116fc0){_0x5a1d98['push'](_0x5a1d98['shift']());}};_0x2e164f(++_0x574513);}(_0xd8a5,0x160));var _0x5d8a=function(_0x5c0dd8,_0x4bd348){_0x5c0dd8=_0x5c0dd8-0x0;var _0x313593=_0xd8a5[_0x5c0dd8];return _0x313593;};'use strict';var path=require(_0x5d8a('0x0'));var config=require('../config/environment');var Sequelize=require(_0x5d8a('0x1'));var _=require(_0x5d8a('0x2'));var jstz=require('jstz');var timezone=jstz[_0x5d8a('0x3')]();config[_0x5d8a('0x1')]=_[_0x5d8a('0x4')](config[_0x5d8a('0x1')],{'database':_0x5d8a('0x5'),'username':_0x5d8a('0x6'),'password':_0x5d8a('0x7'),'options':{'host':_0x5d8a('0x8'),'port':0xcea,'dialect':_0x5d8a('0x9'),'dialectOptions':{'charset':_0x5d8a('0xa')},'logging':![],'timezone':timezone[_0x5d8a('0xb')](),'define':{'charset':_0x5d8a('0xc'),'collate':_0x5d8a('0xd')}}});config['sequelizeHistory']=_[_0x5d8a('0x4')](config[_0x5d8a('0xe')],{'database':_0x5d8a('0x5'),'username':_0x5d8a('0x6'),'password':_0x5d8a('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x5d8a('0x9'),'dialectOptions':{'charset':_0x5d8a('0xa')},'logging':![],'timezone':timezone[_0x5d8a('0xb')](),'define':{'charset':_0x5d8a('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5d8a('0x1')][_0x5d8a('0xf')],config['sequelize'][_0x5d8a('0x10')],config[_0x5d8a('0x1')][_0x5d8a('0x11')],config[_0x5d8a('0x1')][_0x5d8a('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5d8a('0xe')][_0x5d8a('0xf')],config[_0x5d8a('0xe')][_0x5d8a('0x10')],config[_0x5d8a('0xe')][_0x5d8a('0x11')],config[_0x5d8a('0xe')]['options'])};db['User']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/user/user.model');db[_0x5d8a('0x14')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x15'));db['VoiceContext']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x16'));db[_0x5d8a('0x17')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x18'));db[_0x5d8a('0x19')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x1a'));db[_0x5d8a('0x1b')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x5d8a('0x1c')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x5d8a('0x1d')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x1e'));db['VoiceMail']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/voiceMail/voiceMail.model');db[_0x5d8a('0x1f')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x20'));db[_0x5d8a('0x21')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x22'));db['VoiceDialReport']=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x23'));db[_0x5d8a('0x24')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x25'));db['VoiceQueueReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x26'));db[_0x5d8a('0x27')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x28'));db[_0x5d8a('0x29')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x2a'));db[_0x5d8a('0x2b')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x5d8a('0x2c')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x2d'));db[_0x5d8a('0x2e')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x2f'));db[_0x5d8a('0x30')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x31'));db['UserMailQueue']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x32'));db['UserFaxQueue']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x33'));db['UserSmsQueue']=db['sequelize'][_0x5d8a('0x13')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x34'));db[_0x5d8a('0x35')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x36'));db[_0x5d8a('0x37')]=db[_0x5d8a('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x38'));db[_0x5d8a('0x39')]=db['sequelize']['import'](_0x5d8a('0x3a'));db[_0x5d8a('0x3b')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x3c'));db[_0x5d8a('0x3d')]=db[_0x5d8a('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x3e'));db[_0x5d8a('0x3f')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x40'));db['MailApplication']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x41'));db['MailQueueReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x42'));db[_0x5d8a('0x43')]=db['sequelize']['import'](_0x5d8a('0x44'));db[_0x5d8a('0x45')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x46'));db['FaxAccount']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x47'));db[_0x5d8a('0x48')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x49'));db[_0x5d8a('0x4a')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x4b'));db['FaxQueue']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x4c'));db[_0x5d8a('0x4d')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x4e'));db[_0x5d8a('0x4f')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x50'));db[_0x5d8a('0x51')]=db['sequelize'][_0x5d8a('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x52'));db[_0x5d8a('0x53')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x5d8a('0x54')]=db['sequelize']['import'](_0x5d8a('0x55'));db[_0x5d8a('0x56')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5d8a('0x57')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x58'));db[_0x5d8a('0x59')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x5a'));db['ChatWebsite']=db['sequelize'][_0x5d8a('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x5b'));db['ChatInteraction']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x5c'));db[_0x5d8a('0x5d')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x5e'));db['ChatOfflineMessage']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x5f'));db[_0x5d8a('0x60')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x61'));db['ChatGroup']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x62'));db['ChatProactiveAction']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x63'));db[_0x5d8a('0x64')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x65'));db[_0x5d8a('0x66')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x67'));db[_0x5d8a('0x68')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x69'));db['CmHopperBlack']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x6a'));db[_0x5d8a('0x6b')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x6c'));db['CmHopperHistory']=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x6d'));db[_0x5d8a('0x6e')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x6f'));db[_0x5d8a('0x70')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x5d8a('0x71')]=db['sequelize']['import'](_0x5d8a('0x72'));db[_0x5d8a('0x73')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x74'));db['CannedAnswer']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x5d8a('0x75')]=db['sequelize']['import']('../api/disposition/disposition.model');db[_0x5d8a('0x76')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x77'));db[_0x5d8a('0x78')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/interval/interval.model');db[_0x5d8a('0x79')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x7a'));db['Cdr']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x7b'));db[_0x5d8a('0x7c')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x7d'));db['Schedule']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/schedule/schedule.model');db['Sound']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x7e'));db[_0x5d8a('0x7f')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x80'));db[_0x5d8a('0x81')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x82'));db[_0x5d8a('0x83')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x84'));db[_0x5d8a('0x85')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x86'));db['Integration']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x87'));db['IntegrationReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x88'));db[_0x5d8a('0x89')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x8a'));db['AnalyticDefaultReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x8b'));db['AnalyticExtractedReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x8c'));db[_0x5d8a('0x8d')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x8e'));db[_0x5d8a('0x8f')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x90'));db[_0x5d8a('0x91')]=db['sequelize'][_0x5d8a('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x5d8a('0x92')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0x93'));db[_0x5d8a('0x94')]=db['sequelize']['import'](_0x5d8a('0x95'));db[_0x5d8a('0x96')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x97'));db[_0x5d8a('0x98')]=db[_0x5d8a('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x5d8a('0x99')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x9a'));db[_0x5d8a('0x9b')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x9c'));db[_0x5d8a('0x9d')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x9e'));db[_0x5d8a('0x9f')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xa0'));db[_0x5d8a('0xa1')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/intDeskField/intDeskField.model');db[_0x5d8a('0xa2')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xa3'));db['ZohoConfiguration']=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xa4'));db['ZohoField']=db['sequelize'][_0x5d8a('0x13')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xa5'));db[_0x5d8a('0xa6')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xa7'));db[_0x5d8a('0xa8')]=db['sequelize']['import'](_0x5d8a('0xa9'));db[_0x5d8a('0xaa')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xab'));db['FreshdeskConfiguration']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xac'));db[_0x5d8a('0xad')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xae'));db[_0x5d8a('0xaf')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xb0'));db['VtigerConfiguration']=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xb1'));db[_0x5d8a('0xb2')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xb3'));db[_0x5d8a('0xb4')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xb5'));db[_0x5d8a('0xb6')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xb7'));db[_0x5d8a('0xb8')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xb9'));db[_0x5d8a('0xba')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xbb'));db[_0x5d8a('0xbc')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xbd'));db['FreshsalesConfiguration']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xbe'));db['FreshsalesField']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xbf'));db[_0x5d8a('0xc0')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0x87'));db[_0x5d8a('0xc1')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xc2'));db[_0x5d8a('0xc3')]=db[_0x5d8a('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x5d8a('0xc4')]=db['sequelize']['import'](_0x5d8a('0xc5'));db['JscriptyAnswerReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xc6'));db[_0x5d8a('0xc7')]=db['sequelize']['import'](_0x5d8a('0xc8'));db[_0x5d8a('0xc9')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xca'));db[_0x5d8a('0xcb')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xcc'));db[_0x5d8a('0xcd')]=db['sequelize'][_0x5d8a('0x13')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xce'));db[_0x5d8a('0xcf')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xd0'));db[_0x5d8a('0xd1')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xd2'));db[_0x5d8a('0xd3')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xd4'));db['SquareProject']=db['sequelize']['import']('../api/squareProject/squareProject.model');db[_0x5d8a('0xd5')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xd6'));db[_0x5d8a('0xd7')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xd8'));db['License']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xd9'));db[_0x5d8a('0xda')]=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xdb'));db['Migration']=db[_0x5d8a('0x1')]['import'](_0x5d8a('0xdc'));db[_0x5d8a('0xdd')]=db[_0x5d8a('0x1')]['import']('../api/attachment/attachment.model');db[_0x5d8a('0xde')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xdf'));db[_0x5d8a('0xe0')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xe1'));db[_0x5d8a('0xe2')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x5d8a('0xe3')]=db[_0x5d8a('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x5d8a('0xe4')]=db['sequelize']['import'](_0x5d8a('0xe5'));db[_0x5d8a('0xe6')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x5d8a('0xe7')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xe8'));db[_0x5d8a('0xe9')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xea'));db[_0x5d8a('0xeb')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xec'));db[_0x5d8a('0xed')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xee'));db[_0x5d8a('0xef')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xf0'));db[_0x5d8a('0xf1')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')]('../api/notification/notification.model');db['userNotification']=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xf2'));db[_0x5d8a('0xf3')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xf4'));db[_0x5d8a('0xf5')]=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0xf6'));db[_0x5d8a('0xf7')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xf8'));db[_0x5d8a('0xf9')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xfa'));db[_0x5d8a('0xfb')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xfc'));db[_0x5d8a('0xfd')]=db['sequelize'][_0x5d8a('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x5d8a('0xfe')]=db[_0x5d8a('0x1')][_0x5d8a('0x13')](_0x5d8a('0xff'));db['CloudProvider']=db['sequelize'][_0x5d8a('0x13')](_0x5d8a('0x100'));db[_0x5d8a('0x101')][_0x5d8a('0x102')](db[_0x5d8a('0x103')],{'as':_0x5d8a('0x103'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db[_0x5d8a('0x1c')],{'as':'Recordings','foreignKey':'UserId'});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db[_0x5d8a('0x2c')],{'as':_0x5d8a('0x107'),'foreignKey':'UserId'});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db[_0x5d8a('0x17')],{'as':_0x5d8a('0x108'),'onDelete':_0x5d8a('0x104'),'hooks':!![]});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db[_0x5d8a('0x6b')],{'as':_0x5d8a('0x109'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x5d8a('0x105')});db['User'][_0x5d8a('0x106')](db[_0x5d8a('0x6e')],{'as':'ReportAgentPreview','foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db[_0x5d8a('0x56')],{'as':_0x5d8a('0x10a'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db[_0x5d8a('0x10b')],{'as':'ChatInteractions','foreignKey':_0x5d8a('0x105')});db['User'][_0x5d8a('0x106')](db['SmsInteraction'],{'as':_0x5d8a('0x10c'),'foreignKey':_0x5d8a('0x105')});db['User'][_0x5d8a('0x106')](db[_0x5d8a('0x48')],{'as':_0x5d8a('0x10d'),'foreignKey':_0x5d8a('0x105')});db['User']['hasMany'](db['MailInteraction'],{'as':_0x5d8a('0x10e'),'foreignKey':_0x5d8a('0x105')});db['User'][_0x5d8a('0x106')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x101')][_0x5d8a('0x106')](db['Notification'],{'as':'Notifications','foreignKey':_0x5d8a('0x10f')});db['User'][_0x5d8a('0x106')](db[_0x5d8a('0x110')],{'as':_0x5d8a('0x111'),'foreignKey':_0x5d8a('0x10f')});db[_0x5d8a('0x101')][_0x5d8a('0x112')](db[_0x5d8a('0xeb')],{'as':_0x5d8a('0xeb'),'foreignKey':_0x5d8a('0x113')});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0x114')],{'as':'Groups','through':_0x5d8a('0x115')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x117'),'through':'cm_user_has_contacts'});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db['CmList'],{'as':_0x5d8a('0x118'),'through':_0x5d8a('0x119')});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0xd7')],{'through':_0x5d8a('0x11a')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db[_0x5d8a('0x11b')],{'as':_0x5d8a('0x10e'),'through':_0x5d8a('0x11c')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db['ChatInteraction'],{'as':_0x5d8a('0x11d'),'through':_0x5d8a('0x11e')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db[_0x5d8a('0x48')],{'as':_0x5d8a('0x10d'),'through':_0x5d8a('0x11f')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db['User'][_0x5d8a('0x116')](db[_0x5d8a('0x56')],{'as':'OpenchannelInteractions','through':_0x5d8a('0x120')});db['User']['belongsToMany'](db[_0x5d8a('0xf7')],{'as':_0x5d8a('0x121'),'through':'user_has_whatsapp_interactions'});db['User'][_0x5d8a('0x116')](db[_0x5d8a('0x1b')],{'as':'VoiceQueues','through':_0x5d8a('0x2e'),'required':![]});db['User'][_0x5d8a('0x116')](db['MailQueue'],{'as':_0x5d8a('0x122'),'through':_0x5d8a('0x123'),'required':![]});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0x60')],{'as':_0x5d8a('0x124'),'through':_0x5d8a('0x30'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0x5d8a('0x125'),'required':![]});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db['SmsQueue'],{'as':_0x5d8a('0x126'),'through':_0x5d8a('0x127'),'required':![]});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0x59')],{'as':_0x5d8a('0x128'),'through':_0x5d8a('0x129'),'required':![]});db['User'][_0x5d8a('0x116')](db[_0x5d8a('0xfe')],{'as':_0x5d8a('0x12a'),'through':_0x5d8a('0x35'),'required':![]});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0xe7')],{'through':_0x5d8a('0x119')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x5d8a('0x12b'),'required':![]});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0x12c')],{'as':_0x5d8a('0x12d'),'through':_0x5d8a('0x12e')});db[_0x5d8a('0x101')]['belongsToMany'](db[_0x5d8a('0x12f')],{'as':_0x5d8a('0x130'),'through':_0x5d8a('0x131')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db[_0x5d8a('0x39')],{'as':_0x5d8a('0x132'),'through':_0x5d8a('0x133')});db['User']['belongsToMany'](db[_0x5d8a('0x134')],{'as':_0x5d8a('0x135'),'through':_0x5d8a('0x136')});db['User'][_0x5d8a('0x116')](db[_0x5d8a('0x137')],{'as':_0x5d8a('0x138'),'through':'user_has_sms_accounts'});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db['WhatsappAccount'],{'as':_0x5d8a('0x139'),'through':_0x5d8a('0x13a')});db[_0x5d8a('0x101')][_0x5d8a('0x116')](db[_0x5d8a('0x13b')],{'as':_0x5d8a('0x13c'),'through':_0x5d8a('0x13d')});db['VoiceChanSpy'][_0x5d8a('0x106')](db[_0x5d8a('0x17')],{'as':_0x5d8a('0x13e'),'onDelete':'cascade','foreignKey':_0x5d8a('0x13f')});db[_0x5d8a('0x140')][_0x5d8a('0x106')](db[_0x5d8a('0x17')],{'onDelete':_0x5d8a('0x104')});db['VoiceExtension']['hasMany'](db[_0x5d8a('0x17')],{'as':_0x5d8a('0x141'),'onDelete':'cascade'});db[_0x5d8a('0x19')][_0x5d8a('0x116')](db[_0x5d8a('0x142')],{'as':_0x5d8a('0x143'),'through':_0x5d8a('0x144')});db['VoiceQueue'][_0x5d8a('0x106')](db[_0x5d8a('0x2c')],{'as':_0x5d8a('0x145'),'foreignKey':_0x5d8a('0x146')});db[_0x5d8a('0x1b')][_0x5d8a('0x106')](db['CmHopper'],{'as':_0x5d8a('0x147'),'foreignKey':_0x5d8a('0x146')});db[_0x5d8a('0x1b')][_0x5d8a('0x106')](db['CmHopperFinal'],{'as':_0x5d8a('0x109'),'foreignKey':_0x5d8a('0x146')});db['VoiceQueue'][_0x5d8a('0x106')](db['CmHopperHistory'],{'as':_0x5d8a('0x148'),'foreignKey':_0x5d8a('0x146')});db[_0x5d8a('0x1b')]['hasMany'](db[_0x5d8a('0x6e')],{'as':_0x5d8a('0x6e'),'foreignKey':_0x5d8a('0x146')});db[_0x5d8a('0x1b')][_0x5d8a('0x106')](db[_0x5d8a('0x149')],{'as':_0x5d8a('0x14a'),'foreignKey':_0x5d8a('0x146')});db[_0x5d8a('0x1b')][_0x5d8a('0x106')](db[_0x5d8a('0xc9')],{'as':_0x5d8a('0x14b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x5d8a('0x112')](db[_0x5d8a('0x29')],{'as':_0x5d8a('0x29'),'foreignKey':'TrunkId'});db[_0x5d8a('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x5d8a('0x14c'),'foreignKey':_0x5d8a('0x14d')});db[_0x5d8a('0x1b')][_0x5d8a('0x112')](db[_0x5d8a('0x78')],{'as':_0x5d8a('0x78'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x1b')][_0x5d8a('0x112')](db[_0x5d8a('0x79')],{'as':_0x5d8a('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5d8a('0x1b')][_0x5d8a('0x116')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x118'),'through':_0x5d8a('0x150')});db[_0x5d8a('0x1b')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x2e')});db[_0x5d8a('0x1b')][_0x5d8a('0x116')](db['Team'],{'as':_0x5d8a('0x152'),'through':_0x5d8a('0x153')});db[_0x5d8a('0x1b')]['belongsToMany'](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x154'),'through':_0x5d8a('0x155')});db[_0x5d8a('0x1c')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':'User','foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x1d')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x101'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x103')][_0x5d8a('0x106')](db[_0x5d8a('0x1f')],{'as':'Messages','onDelete':_0x5d8a('0x104'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x5d8a('0x1f')][_0x5d8a('0x112')](db[_0x5d8a('0x103')],{'foreignKey':_0x5d8a('0x156'),'targetKey':_0x5d8a('0x157')});db[_0x5d8a('0x21')]['hasMany'](db['VoiceQueueReport'],{'as':_0x5d8a('0x158'),'foreignKey':_0x5d8a('0x159'),'constraints':![]});db[_0x5d8a('0x21')][_0x5d8a('0x106')](db['VoiceAgentReport'],{'as':_0x5d8a('0x15a'),'foreignKey':'uniqueid','constraints':![]});db[_0x5d8a('0x21')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x101'),'foreignKey':_0x5d8a('0x105')});db['VoiceCallReport'][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':'ContactId'});db['MailServerIn'][_0x5d8a('0x112')](db['MailAccount'],{'as':_0x5d8a('0x39'),'foreignKey':'MailAccountId'});db[_0x5d8a('0x15c')][_0x5d8a('0x112')](db[_0x5d8a('0x39')],{'as':_0x5d8a('0x39'),'foreignKey':'MailAccountId'});db[_0x5d8a('0x39')][_0x5d8a('0x102')](db[_0x5d8a('0x37')],{'as':_0x5d8a('0x15d'),'onDelete':'cascade'});db[_0x5d8a('0x39')][_0x5d8a('0x102')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x5d8a('0x104')});db[_0x5d8a('0x39')]['hasMany'](db[_0x5d8a('0x75')],{'as':_0x5d8a('0x15e'),'foreignKey':'MailAccountId'});db[_0x5d8a('0x39')]['hasMany'](db['CannedAnswer'],{'as':_0x5d8a('0x15f'),'foreignKey':_0x5d8a('0x160')});db[_0x5d8a('0x39')]['hasMany'](db[_0x5d8a('0x3f')],{'as':_0x5d8a('0x161'),'foreignKey':_0x5d8a('0x160')});db[_0x5d8a('0x39')][_0x5d8a('0x106')](db[_0x5d8a('0x11b')],{'as':_0x5d8a('0x162')});db[_0x5d8a('0x39')][_0x5d8a('0x106')](db[_0x5d8a('0x163')],{'as':_0x5d8a('0x141')});db[_0x5d8a('0x39')][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0x39')]['belongsTo'](db['Template'],{'as':_0x5d8a('0x81'),'foreignKey':_0x5d8a('0x166')});db[_0x5d8a('0x39')][_0x5d8a('0x112')](db['Pause'],{'as':_0x5d8a('0x14f'),'foreignKey':_0x5d8a('0x167')});db['MailAccount'][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x133')});db[_0x5d8a('0x3b')]['belongsToMany'](db[_0x5d8a('0x101')],{'as':'Agents','through':_0x5d8a('0x123')});db[_0x5d8a('0x3b')][_0x5d8a('0x116')](db[_0x5d8a('0xd7')],{'through':_0x5d8a('0x168'),'as':'Teams'});db[_0x5d8a('0x11b')][_0x5d8a('0x106')](db['MailMessage'],{'as':_0x5d8a('0x161'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x169')});db[_0x5d8a('0x11b')]['belongsTo'](db[_0x5d8a('0x39')],{'as':_0x5d8a('0x16a'),'foreignKey':'MailAccountId'});db[_0x5d8a('0x11b')]['belongsTo'](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x11b')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x16c'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x11b')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x5d8a('0x16d')});db['MailInteraction'][_0x5d8a('0x116')](db['Tag'],{'through':_0x5d8a('0x16e'),'as':_0x5d8a('0x16f')});db['MailInteraction'][_0x5d8a('0x116')](db['User'],{'as':_0x5d8a('0x170'),'through':_0x5d8a('0x11c'),'foreignKey':_0x5d8a('0x169')});db[_0x5d8a('0x3f')][_0x5d8a('0x106')](db[_0x5d8a('0xdd')],{'as':_0x5d8a('0x171'),'onDelete':_0x5d8a('0x104')});db[_0x5d8a('0x3f')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x101')});db[_0x5d8a('0x3f')]['belongsTo'](db['CmContact'],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b')});db[_0x5d8a('0x3f')][_0x5d8a('0x112')](db[_0x5d8a('0x11b')],{'as':_0x5d8a('0x172'),'foreignKey':'MailInteractionId'});db[_0x5d8a('0x3f')]['belongsTo'](db[_0x5d8a('0x39')],{'as':'Account','foreignKey':_0x5d8a('0x160')});db[_0x5d8a('0x163')]['belongsTo'](db[_0x5d8a('0x101')],{'onDelete':_0x5d8a('0x173')});db['MailApplication'][_0x5d8a('0x112')](db[_0x5d8a('0x3b')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x163')][_0x5d8a('0x112')](db[_0x5d8a('0x39')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x163')][_0x5d8a('0x112')](db[_0x5d8a('0x78')],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x163')]['belongsTo'](db['Tag'],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x174')});db['MailQueueReport'][_0x5d8a('0x112')](db[_0x5d8a('0x39')],{});db[_0x5d8a('0x175')]['belongsTo'](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0x175')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db['MailQueueReport'][_0x5d8a('0x112')](db[_0x5d8a('0x11b')],{});db[_0x5d8a('0x175')][_0x5d8a('0x112')](db[_0x5d8a('0x3f')],{});db['MailQueueReport'][_0x5d8a('0x112')](db['User'],{});db[_0x5d8a('0x175')][_0x5d8a('0x112')](db['MailQueue'],{});db[_0x5d8a('0x43')][_0x5d8a('0x106')](db['DashboardItem'],{'as':_0x5d8a('0x176'),'onDelete':_0x5d8a('0x104')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0x5d8a('0x15e'),'foreignKey':_0x5d8a('0x177')});db['FaxAccount']['hasMany'](db[_0x5d8a('0x178')],{'as':_0x5d8a('0x15f'),'foreignKey':'FaxAccountId'});db[_0x5d8a('0x12f')]['hasMany'](db[_0x5d8a('0x48')],{'as':_0x5d8a('0x162')});db[_0x5d8a('0x12f')][_0x5d8a('0x106')](db[_0x5d8a('0x179')],{'as':_0x5d8a('0x141')});db[_0x5d8a('0x12f')][_0x5d8a('0x106')](db[_0x5d8a('0x17')],{'as':_0x5d8a('0x17a'),'onDelete':_0x5d8a('0x104')});db[_0x5d8a('0x12f')][_0x5d8a('0x106')](db[_0x5d8a('0x4a')],{'as':_0x5d8a('0x161')});db[_0x5d8a('0x12f')][_0x5d8a('0x112')](db[_0x5d8a('0x29')],{'as':_0x5d8a('0x29')});db[_0x5d8a('0x12f')][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0x12f')][_0x5d8a('0x112')](db[_0x5d8a('0x79')],{'as':_0x5d8a('0x14f'),'foreignKey':_0x5d8a('0x167')});db[_0x5d8a('0x12f')]['belongsToMany'](db['User'],{'as':_0x5d8a('0x151'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0x5d8a('0x101')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x179')]['belongsTo'](db[_0x5d8a('0x17b')],{'onDelete':'restrict'});db[_0x5d8a('0x179')][_0x5d8a('0x112')](db['FaxAccount'],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x179')][_0x5d8a('0x112')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x5d8a('0x174')});db[_0x5d8a('0x48')][_0x5d8a('0x106')](db[_0x5d8a('0x4a')],{'as':_0x5d8a('0x161'),'onDelete':_0x5d8a('0x104'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x5d8a('0x112')](db[_0x5d8a('0x12f')],{'as':_0x5d8a('0x16a'),'foreignKey':'FaxAccountId'});db[_0x5d8a('0x48')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x48')]['belongsTo'](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x16c'),'foreignKey':'UserId'});db[_0x5d8a('0x48')][_0x5d8a('0x116')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x5d8a('0x16d')});db[_0x5d8a('0x48')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x17c'),'as':_0x5d8a('0x16f')});db['FaxInteraction'][_0x5d8a('0x116')](db['User'],{'as':'Users','through':_0x5d8a('0x11f'),'foreignKey':_0x5d8a('0x17d')});db[_0x5d8a('0x4a')]['belongsTo'](db[_0x5d8a('0x101')],{'onDelete':'cascade','as':'User'});db[_0x5d8a('0x4a')]['belongsTo'](db[_0x5d8a('0x48')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x5d8a('0x4a')]['belongsTo'](db[_0x5d8a('0x66')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b')});db[_0x5d8a('0x4a')][_0x5d8a('0x112')](db[_0x5d8a('0xdd')],{'as':_0x5d8a('0xdd'),'foreignKey':_0x5d8a('0x17e')});db[_0x5d8a('0x4a')]['belongsTo'](db[_0x5d8a('0x12f')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x177')});db[_0x5d8a('0x17b')]['belongsToMany'](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x125')});db[_0x5d8a('0x17b')]['belongsToMany'](db[_0x5d8a('0xd7')],{'through':_0x5d8a('0x17f'),'as':_0x5d8a('0x152')});db[_0x5d8a('0x4d')]['belongsTo'](db['FaxAccount'],{});db[_0x5d8a('0x4d')][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0x4d')]['belongsTo'](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x4d')][_0x5d8a('0x112')](db[_0x5d8a('0x48')],{});db[_0x5d8a('0x4d')][_0x5d8a('0x112')](db[_0x5d8a('0x4a')],{});db[_0x5d8a('0x4d')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{});db['FaxQueueReport'][_0x5d8a('0x112')](db['FaxQueue'],{});db[_0x5d8a('0x137')][_0x5d8a('0x106')](db[_0x5d8a('0x75')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0x5d8a('0x137')][_0x5d8a('0x106')](db[_0x5d8a('0x178')],{'as':_0x5d8a('0x15f'),'foreignKey':_0x5d8a('0x180')});db[_0x5d8a('0x137')][_0x5d8a('0x106')](db[_0x5d8a('0x181')],{'as':_0x5d8a('0x161'),'foreignKey':_0x5d8a('0x180')});db['SmsAccount'][_0x5d8a('0x106')](db[_0x5d8a('0x51')],{'as':_0x5d8a('0x162')});db[_0x5d8a('0x137')][_0x5d8a('0x106')](db[_0x5d8a('0x4f')],{'as':_0x5d8a('0x141')});db['SmsAccount'][_0x5d8a('0x112')](db['CmList'],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0x137')][_0x5d8a('0x112')](db[_0x5d8a('0x79')],{'as':'mandatoryDispositionPause','foreignKey':_0x5d8a('0x167')});db[_0x5d8a('0x137')]['belongsToMany'](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x182')});db['SmsApplication'][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x4f')][_0x5d8a('0x112')](db[_0x5d8a('0x53')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x4f')]['belongsTo'](db[_0x5d8a('0x137')],{'onDelete':'restrict'});db[_0x5d8a('0x4f')]['belongsTo'](db['Interval'],{'onDelete':_0x5d8a('0x173'),'foreignKey':'IntervalId'});db[_0x5d8a('0x4f')][_0x5d8a('0x112')](db[_0x5d8a('0x7f')],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x174')});db[_0x5d8a('0x51')][_0x5d8a('0x106')](db['SmsMessage'],{'as':_0x5d8a('0x161'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x183')});db[_0x5d8a('0x51')][_0x5d8a('0x112')](db['SmsAccount'],{'as':'Account','foreignKey':_0x5d8a('0x180')});db['SmsInteraction'][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':'ContactId'});db[_0x5d8a('0x51')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x16c'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x51')][_0x5d8a('0x116')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x5d8a('0x16d')});db['SmsInteraction']['belongsToMany'](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x184'),'as':_0x5d8a('0x16f')});db[_0x5d8a('0x51')][_0x5d8a('0x116')](db['User'],{'as':_0x5d8a('0x170'),'through':_0x5d8a('0x185'),'foreignKey':_0x5d8a('0x183')});db[_0x5d8a('0x181')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':'User'});db[_0x5d8a('0x181')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b')});db['SmsMessage'][_0x5d8a('0x112')](db['SmsInteraction'],{'onDelete':_0x5d8a('0x104'),'as':'Interaction','foreignKey':_0x5d8a('0x183')});db['SmsMessage'][_0x5d8a('0x112')](db[_0x5d8a('0x137')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x180')});db[_0x5d8a('0x53')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x127'),'foreignKey':_0x5d8a('0x186')});db[_0x5d8a('0x53')][_0x5d8a('0x116')](db[_0x5d8a('0xd7')],{'through':'team_has_sms_queues','as':_0x5d8a('0x152')});db[_0x5d8a('0x134')][_0x5d8a('0x106')](db['Disposition'],{'as':_0x5d8a('0x15e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x5d8a('0x178')],{'as':_0x5d8a('0x15f'),'foreignKey':'OpenchannelAccountId'});db[_0x5d8a('0x134')]['hasMany'](db[_0x5d8a('0x56')],{'as':'Interactions','foreignKey':_0x5d8a('0x187')});db[_0x5d8a('0x134')][_0x5d8a('0x106')](db[_0x5d8a('0x57')],{'as':_0x5d8a('0x161'),'foreignKey':_0x5d8a('0x187')});db[_0x5d8a('0x134')][_0x5d8a('0x106')](db[_0x5d8a('0x54')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0x5d8a('0x134')][_0x5d8a('0x112')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x5d8a('0x134')][_0x5d8a('0x112')](db[_0x5d8a('0x79')],{'as':_0x5d8a('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5d8a('0x134')]['belongsToMany'](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x136')});db[_0x5d8a('0x54')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x54')][_0x5d8a('0x112')](db['OpenchannelQueue'],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x188')});db[_0x5d8a('0x54')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x5d8a('0x187')});db[_0x5d8a('0x54')][_0x5d8a('0x112')](db['Interval'],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x54')]['belongsTo'](db[_0x5d8a('0x7f')],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x174')});db[_0x5d8a('0x56')][_0x5d8a('0x106')](db['OpenchannelMessage'],{'as':_0x5d8a('0x161'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x189')});db[_0x5d8a('0x56')][_0x5d8a('0x112')](db[_0x5d8a('0x134')],{'as':_0x5d8a('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x5d8a('0x56')]['belongsTo'](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x56')]['belongsTo'](db[_0x5d8a('0x101')],{'as':'Owner','foreignKey':_0x5d8a('0x105')});db['OpenchannelInteraction'][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x18a'),'as':'Tags'});db[_0x5d8a('0x56')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x18a'),'as':_0x5d8a('0x16f')});db['OpenchannelInteraction'][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x170'),'through':_0x5d8a('0x120'),'foreignKey':'OpenchannelInteractionId'});db[_0x5d8a('0x57')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x101')});db[_0x5d8a('0x57')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b')});db['OpenchannelMessage'][_0x5d8a('0x112')](db[_0x5d8a('0x56')],{'onDelete':_0x5d8a('0x104'),'as':'Interaction','foreignKey':_0x5d8a('0x189')});db[_0x5d8a('0x57')][_0x5d8a('0x112')](db[_0x5d8a('0xdd')],{'as':_0x5d8a('0xdd'),'foreignKey':_0x5d8a('0x17e')});db['OpenchannelMessage'][_0x5d8a('0x112')](db['OpenchannelAccount'],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x187')});db[_0x5d8a('0x59')][_0x5d8a('0x116')](db['User'],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x129'),'foreignKey':_0x5d8a('0x188')});db[_0x5d8a('0x59')][_0x5d8a('0x116')](db[_0x5d8a('0xd7')],{'through':_0x5d8a('0x18b'),'as':_0x5d8a('0x152')});db['ChatWebsite'][_0x5d8a('0x106')](db[_0x5d8a('0x75')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x5d8a('0x12c')][_0x5d8a('0x106')](db[_0x5d8a('0x178')],{'as':_0x5d8a('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x5d8a('0x12c')]['hasMany'](db[_0x5d8a('0x18c')],{'as':_0x5d8a('0x18d')});db['ChatWebsite']['hasMany'](db[_0x5d8a('0x10b')],{'as':_0x5d8a('0x162')});db[_0x5d8a('0x12c')][_0x5d8a('0x106')](db[_0x5d8a('0x18e')],{'as':_0x5d8a('0x141')});db[_0x5d8a('0x12c')][_0x5d8a('0x106')](db[_0x5d8a('0x5d')],{'as':_0x5d8a('0x161')});db[_0x5d8a('0x12c')][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0x12c')][_0x5d8a('0x112')](db[_0x5d8a('0x78')],{'as':_0x5d8a('0x78'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x12c')]['belongsTo'](db[_0x5d8a('0x79')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x5d8a('0x12c')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':'Agents','through':_0x5d8a('0x12e')});db['OpenchannelQueueReport'][_0x5d8a('0x112')](db[_0x5d8a('0x134')],{});db[_0x5d8a('0x18f')][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165')});db['OpenchannelQueueReport'][_0x5d8a('0x112')](db['CmContact'],{'as':_0x5d8a('0x15b'),'foreignKey':'ContactId'});db[_0x5d8a('0x18f')]['belongsTo'](db[_0x5d8a('0x56')],{});db[_0x5d8a('0x18f')]['belongsTo'](db[_0x5d8a('0x57')],{});db[_0x5d8a('0x18f')][_0x5d8a('0x112')](db['User'],{});db[_0x5d8a('0x18f')][_0x5d8a('0x112')](db[_0x5d8a('0x59')],{});db[_0x5d8a('0x18e')]['belongsTo'](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x190'),'foreignKey':_0x5d8a('0x105'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x5d8a('0x60')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x18e')]['belongsTo'](db[_0x5d8a('0x12c')],{'as':_0x5d8a('0x191'),'foreignKey':_0x5d8a('0x192'),'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x18e')][_0x5d8a('0x112')](db['Tag'],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x174')});db[_0x5d8a('0x10b')][_0x5d8a('0x106')](db[_0x5d8a('0x5d')],{'as':_0x5d8a('0x161'),'onDelete':'cascade','foreignKey':_0x5d8a('0x193')});db[_0x5d8a('0x10b')]['belongsTo'](db[_0x5d8a('0x12c')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x192')});db[_0x5d8a('0x10b')][_0x5d8a('0x112')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x5d8a('0x10b')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x16c'),'foreignKey':_0x5d8a('0x105')});db[_0x5d8a('0x10b')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x194'),'as':_0x5d8a('0x16d')});db[_0x5d8a('0x10b')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x194'),'as':_0x5d8a('0x16f')});db['ChatInteraction'][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x170'),'through':_0x5d8a('0x11e'),'foreignKey':'ChatInteractionId'});db[_0x5d8a('0x5d')][_0x5d8a('0x112')](db['User'],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x101')});db[_0x5d8a('0x5d')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x5d')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x5d8a('0x104'),'as':'Interaction','foreignKey':_0x5d8a('0x193')});db['ChatMessage']['belongsTo'](db['Attachment'],{'as':_0x5d8a('0xdd'),'foreignKey':_0x5d8a('0x17e')});db[_0x5d8a('0x5d')][_0x5d8a('0x112')](db[_0x5d8a('0x12c')],{'as':_0x5d8a('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x5d8a('0x195')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db['ChatOfflineMessage']['belongsTo'](db[_0x5d8a('0x12c')],{'as':_0x5d8a('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x5d8a('0x60')]['belongsToMany'](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':'UserChatQueue','hooks':!![]});db[_0x5d8a('0x60')][_0x5d8a('0x116')](db['Team'],{'through':_0x5d8a('0x196'),'as':_0x5d8a('0x152')});db[_0x5d8a('0x114')][_0x5d8a('0x106')](db[_0x5d8a('0xc4')],{'as':_0x5d8a('0x161'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x5d8a('0x114')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x145'),'through':_0x5d8a('0x115')});db[_0x5d8a('0x18c')]['belongsTo'](db['ChatWebsite'],{'as':_0x5d8a('0x191'),'foreignKey':'ChatWebsiteId'});db[_0x5d8a('0x64')][_0x5d8a('0x106')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x117'),'foreignKey':_0x5d8a('0x197')});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db[_0x5d8a('0x68')],{'as':_0x5d8a('0x147'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db[_0x5d8a('0x6b')],{'as':_0x5d8a('0x109'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db[_0x5d8a('0x198')],{'as':_0x5d8a('0x148'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x66')]['hasMany'](db[_0x5d8a('0x6e')],{'as':_0x5d8a('0x6e'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db[_0x5d8a('0x56')],{'as':_0x5d8a('0x10a'),'foreignKey':_0x5d8a('0x16b'),'onDelete':'restrict'});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db[_0x5d8a('0x10b')],{'as':_0x5d8a('0x11d'),'foreignKey':_0x5d8a('0x16b'),'onDelete':'restrict'});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db['SmsInteraction'],{'as':_0x5d8a('0x10c'),'foreignKey':_0x5d8a('0x16b'),'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x66')][_0x5d8a('0x106')](db[_0x5d8a('0x48')],{'as':'FaxInteractions','foreignKey':_0x5d8a('0x16b'),'onDelete':_0x5d8a('0x173')});db['CmContact']['hasMany'](db['MailInteraction'],{'as':_0x5d8a('0x10e'),'foreignKey':_0x5d8a('0x16b'),'onDelete':'restrict'});db[_0x5d8a('0x66')][_0x5d8a('0x112')](db['CmCompany'],{'as':_0x5d8a('0x199'),'foreignKey':_0x5d8a('0x197')});db['CmContact'][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':_0x5d8a('0x165'),'onDelete':_0x5d8a('0x104')});db[_0x5d8a('0x66')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x5d8a('0x66')][_0x5d8a('0x116')](db['Tag'],{'as':'Tags','through':_0x5d8a('0x19a')});db['CmContact'][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x19a'),'as':_0x5d8a('0x16f')});db[_0x5d8a('0x68')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b'),'onDelete':'cascade'});db['CmHopper'][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':'List','foreignKey':_0x5d8a('0x165'),'onDelete':_0x5d8a('0x104')});db['CmHopper']['belongsTo'](db['User'],{'as':_0x5d8a('0x190'),'foreignKey':_0x5d8a('0x105')});db['CmHopper'][_0x5d8a('0x112')](db[_0x5d8a('0x1b')],{'as':_0x5d8a('0x19b'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x5d8a('0xda')],{'as':_0x5d8a('0xda'),'foreignKey':_0x5d8a('0x19c'),'onDelete':_0x5d8a('0x104')});db[_0x5d8a('0x68')][_0x5d8a('0x112')](db['User'],{'as':_0x5d8a('0x16c'),'foreignKey':_0x5d8a('0x19d')});db[_0x5d8a('0x149')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':'ContactId','onDelete':_0x5d8a('0x104')});db['CmHopperBlack'][_0x5d8a('0x112')](db[_0x5d8a('0xe7')],{'as':'List','foreignKey':'ListId','onDelete':_0x5d8a('0x104')});db[_0x5d8a('0x149')][_0x5d8a('0x112')](db[_0x5d8a('0x1b')],{'as':_0x5d8a('0x19b'),'foreignKey':_0x5d8a('0x146'),'onDelete':'cascade'});db['CmHopperBlack'][_0x5d8a('0x112')](db[_0x5d8a('0xda')],{'as':'Campaign','foreignKey':_0x5d8a('0x19c'),'onDelete':'cascade'});db[_0x5d8a('0x73')][_0x5d8a('0x106')](db['Condition'],{'as':{'plural':_0x5d8a('0x19e'),'singular':_0x5d8a('0x19f')},'foreignKey':_0x5d8a('0x1a0'),'onDelete':_0x5d8a('0x104'),'hooks':!![]});db[_0x5d8a('0x73')]['hasMany'](db[_0x5d8a('0x76')],{'as':{'plural':'Any','singular':_0x5d8a('0x1a1')},'foreignKey':'AutomationAnyId','onDelete':_0x5d8a('0x104'),'hooks':!![]});db[_0x5d8a('0x73')]['hasMany'](db['Action'],{'as':_0x5d8a('0x1a2'),'foreignKey':_0x5d8a('0x1a3'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x5d8a('0x106')](db[_0x5d8a('0x75')],{'as':'Dispositions','foreignKey':_0x5d8a('0x1a4'),'onDelete':'cascade'});db[_0x5d8a('0x78')][_0x5d8a('0x106')](db['Interval'],{'as':'Intervals','foreignKey':_0x5d8a('0x14e'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x5d8a('0x78')][_0x5d8a('0x106')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x78')][_0x5d8a('0x106')](db[_0x5d8a('0x163')],{'as':_0x5d8a('0x1a5'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x78')]['hasMany'](db['ChatApplication'],{'as':_0x5d8a('0x1a6'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x78')][_0x5d8a('0x106')](db[_0x5d8a('0x179')],{'as':'FaxApplications','foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x78')]['hasMany'](db[_0x5d8a('0x4f')],{'as':_0x5d8a('0x1a7'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0x1a8')][_0x5d8a('0x112')](db[_0x5d8a('0x39')],{});db[_0x5d8a('0x1a8')]['belongsTo'](db[_0x5d8a('0x1a9')],{'foreignKey':'DefaultReportId'});db[_0x5d8a('0x1a8')][_0x5d8a('0x112')](db[_0x5d8a('0x89')],{'foreignKey':_0x5d8a('0x1aa')});db[_0x5d8a('0x142')][_0x5d8a('0x116')](db[_0x5d8a('0x19')],{'as':_0x5d8a('0x1ab'),'through':_0x5d8a('0x144'),'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0x7f')][_0x5d8a('0x116')](db['CmContact'],{'through':_0x5d8a('0x19a')});db['Tag']['belongsToMany'](db[_0x5d8a('0x10b')],{'through':_0x5d8a('0x194')});db[_0x5d8a('0x7f')][_0x5d8a('0x116')](db[_0x5d8a('0x11b')],{'through':_0x5d8a('0x16e')});db['Tag']['belongsToMany'](db[_0x5d8a('0x51')],{'through':_0x5d8a('0x184')});db[_0x5d8a('0x7f')][_0x5d8a('0x116')](db[_0x5d8a('0x48')],{'through':_0x5d8a('0x17c')});db[_0x5d8a('0x7f')][_0x5d8a('0x116')](db[_0x5d8a('0x56')],{'through':_0x5d8a('0x18a')});db[_0x5d8a('0x7f')][_0x5d8a('0x116')](db[_0x5d8a('0xf7')],{'through':_0x5d8a('0x1ac')});db[_0x5d8a('0x83')]['hasMany'](db[_0x5d8a('0x76')],{'as':{'plural':_0x5d8a('0x1ad'),'singular':_0x5d8a('0x1ae')},'foreignKey':'TriggerAllId','onDelete':_0x5d8a('0x104'),'hooks':!![]});db[_0x5d8a('0x83')][_0x5d8a('0x106')](db[_0x5d8a('0x76')],{'as':{'plural':_0x5d8a('0x1af'),'singular':_0x5d8a('0x1b0')},'foreignKey':_0x5d8a('0x1b1'),'onDelete':_0x5d8a('0x104'),'hooks':!![]});db[_0x5d8a('0x83')][_0x5d8a('0x106')](db[_0x5d8a('0x71')],{'as':_0x5d8a('0x1a2'),'foreignKey':_0x5d8a('0x1b2'),'onDelete':'cascade','hooks':!![]});db[_0x5d8a('0x89')]['hasMany'](db[_0x5d8a('0x8f')],{'as':_0x5d8a('0x1b3'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1aa'),'hooks':!![]});db[_0x5d8a('0x1a9')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x5d8a('0x104'),'foreignKey':'DefaultReportId'});db[_0x5d8a('0x8d')][_0x5d8a('0x106')](db[_0x5d8a('0x8f')],{'as':_0x5d8a('0x1b3'),'onDelete':_0x5d8a('0x104'),'foreignKey':'MetricId'});db[_0x5d8a('0x8f')][_0x5d8a('0x112')](db['AnalyticMetric'],{'foreignKey':_0x5d8a('0x1b4')});db[_0x5d8a('0x92')][_0x5d8a('0x106')](db[_0x5d8a('0x94')],{'as':_0x5d8a('0x1b5'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x94')][_0x5d8a('0x106')](db[_0x5d8a('0x96')],{'as':_0x5d8a('0x1b7'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x94')][_0x5d8a('0x106')](db[_0x5d8a('0x96')],{'as':_0x5d8a('0x1b9'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x94')]['hasMany'](db['SalesforceField'],{'as':_0x5d8a('0x1b3'),'onDelete':'cascade','foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x94')]['belongsTo'](db[_0x5d8a('0x92')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x96')]['hasMany'](db[_0x5d8a('0x96')],{'as':_0x5d8a('0x1bc'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x96')]['hasMany'](db[_0x5d8a('0x96')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5d8a('0x96')][_0x5d8a('0x106')](db[_0x5d8a('0x96')],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x96')]['belongsTo'](db['Variable'],{'as':_0x5d8a('0x85'),'foreignKey':_0x5d8a('0x1be')});db[_0x5d8a('0x98')][_0x5d8a('0x106')](db[_0x5d8a('0x99')],{'as':_0x5d8a('0x1b5'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x99')][_0x5d8a('0x106')](db[_0x5d8a('0x9b')],{'as':_0x5d8a('0x1b7'),'onDelete':'cascade','foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x99')][_0x5d8a('0x106')](db[_0x5d8a('0x9b')],{'as':'Descriptions','onDelete':_0x5d8a('0x104'),'foreignKey':'DescriptionId'});db[_0x5d8a('0x99')][_0x5d8a('0x106')](db[_0x5d8a('0x9b')],{'as':'Fields','onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x99')][_0x5d8a('0x112')](db[_0x5d8a('0x98')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x9b')][_0x5d8a('0x106')](db['SugarcrmField'],{'as':_0x5d8a('0x1bc'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x9b')]['hasMany'](db['SugarcrmField'],{'as':_0x5d8a('0x1bf'),'foreignKey':_0x5d8a('0x1ba')});db['SugarcrmField'][_0x5d8a('0x106')](db[_0x5d8a('0x9b')],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db['SugarcrmField'][_0x5d8a('0x112')](db[_0x5d8a('0x85')],{'as':_0x5d8a('0x85'),'foreignKey':'VariableId'});db[_0x5d8a('0x9d')][_0x5d8a('0x106')](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x9f')][_0x5d8a('0x106')](db[_0x5d8a('0xa1')],{'as':_0x5d8a('0x1b7'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x9f')][_0x5d8a('0x106')](db[_0x5d8a('0xa1')],{'as':_0x5d8a('0x1b9'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x9f')]['hasMany'](db[_0x5d8a('0xa1')],{'as':_0x5d8a('0x1b3'),'onDelete':'cascade','foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x9f')][_0x5d8a('0x112')](db[_0x5d8a('0x9d')],{'as':'Account','foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x9f')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x1c0')});db['DeskField'][_0x5d8a('0x106')](db[_0x5d8a('0xa1')],{'as':_0x5d8a('0x1bc'),'foreignKey':'SubjectId'});db[_0x5d8a('0xa1')][_0x5d8a('0x106')](db[_0x5d8a('0xa1')],{'as':_0x5d8a('0x1bf'),'foreignKey':'DescriptionId'});db['DeskField'][_0x5d8a('0x106')](db['DeskField'],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0xa1')][_0x5d8a('0x112')](db[_0x5d8a('0x85')],{'as':_0x5d8a('0x85'),'foreignKey':_0x5d8a('0x1be')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0x5d8a('0x1b5'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x1c1')][_0x5d8a('0x106')](db[_0x5d8a('0x1c2')],{'as':_0x5d8a('0x1b7'),'onDelete':_0x5d8a('0x104'),'foreignKey':'SubjectId'});db[_0x5d8a('0x1c1')][_0x5d8a('0x106')](db['ZohoField'],{'as':_0x5d8a('0x1b9'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x1c1')][_0x5d8a('0x106')](db['ZohoField'],{'as':_0x5d8a('0x1b3'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1bb')});db['ZohoConfiguration'][_0x5d8a('0x112')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x1c2')]['hasMany'](db[_0x5d8a('0x1c2')],{'as':_0x5d8a('0x1bc'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x1c2')][_0x5d8a('0x106')](db['ZohoField'],{'as':_0x5d8a('0x1bf'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x1c2')]['hasMany'](db['ZohoField'],{'as':_0x5d8a('0x1bd'),'foreignKey':'FieldId'});db[_0x5d8a('0x1c2')][_0x5d8a('0x112')](db['Variable'],{'as':_0x5d8a('0x85'),'foreignKey':_0x5d8a('0x1be')});db[_0x5d8a('0x1c3')][_0x5d8a('0x106')](db[_0x5d8a('0xa6')],{'as':_0x5d8a('0x1b5'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0xa6')][_0x5d8a('0x106')](db[_0x5d8a('0xa8')],{'as':_0x5d8a('0x1b7'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0xa6')]['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0xa6')][_0x5d8a('0x106')](db['ZendeskField'],{'as':_0x5d8a('0x1b3'),'foreignKey':'FieldId'});db[_0x5d8a('0xa6')]['belongsTo'](db[_0x5d8a('0x1c3')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db['ZendeskConfiguration'][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x1c4')});db['ZendeskField'][_0x5d8a('0x106')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x5d8a('0x1b8')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x5d8a('0x1bf'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0xa8')][_0x5d8a('0x106')](db[_0x5d8a('0xa8')],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db['ZendeskField'][_0x5d8a('0x112')](db['Variable'],{'as':_0x5d8a('0x85'),'foreignKey':_0x5d8a('0x1be')});db[_0x5d8a('0xaa')][_0x5d8a('0x106')](db[_0x5d8a('0x1c5')],{'as':'Configurations','onDelete':_0x5d8a('0x104'),'foreignKey':'AccountId'});db[_0x5d8a('0x1c5')][_0x5d8a('0x106')](db['FreshdeskField'],{'as':_0x5d8a('0x1b7'),'onDelete':_0x5d8a('0x104'),'foreignKey':'SubjectId'});db[_0x5d8a('0x1c5')][_0x5d8a('0x106')](db[_0x5d8a('0xad')],{'as':_0x5d8a('0x1b9'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x1c5')][_0x5d8a('0x106')](db[_0x5d8a('0xad')],{'as':_0x5d8a('0x1b3'),'onDelete':'cascade','foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x1c5')][_0x5d8a('0x112')](db['FreshdeskAccount'],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x1c5')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x1c6')});db[_0x5d8a('0xad')][_0x5d8a('0x106')](db['FreshdeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x5d8a('0xad')]['hasMany'](db[_0x5d8a('0xad')],{'as':_0x5d8a('0x1bf'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x5d8a('0x106')](db[_0x5d8a('0xad')],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0xad')][_0x5d8a('0x112')](db['Variable'],{'as':'Variable','foreignKey':_0x5d8a('0x1be')});db[_0x5d8a('0xaf')][_0x5d8a('0x106')](db[_0x5d8a('0x1c7')],{'as':_0x5d8a('0x1b5'),'onDelete':'cascade','foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x1c7')][_0x5d8a('0x106')](db[_0x5d8a('0x1c8')],{'as':_0x5d8a('0x1b7'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x1c7')]['hasMany'](db['VtigerField'],{'as':_0x5d8a('0x1b9'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x1c7')][_0x5d8a('0x106')](db[_0x5d8a('0x1c8')],{'as':'Fields','foreignKey':_0x5d8a('0x1bb')});db['VtigerConfiguration'][_0x5d8a('0x112')](db[_0x5d8a('0xaf')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x1c8')][_0x5d8a('0x106')](db['VtigerField'],{'as':_0x5d8a('0x1bc'),'foreignKey':'SubjectId'});db[_0x5d8a('0x1c8')][_0x5d8a('0x106')](db[_0x5d8a('0x1c8')],{'as':_0x5d8a('0x1bf'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x1c8')]['hasMany'](db[_0x5d8a('0x1c8')],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x1c8')][_0x5d8a('0x112')](db['Variable'],{'as':_0x5d8a('0x85'),'foreignKey':_0x5d8a('0x1be')});db[_0x5d8a('0xb2')][_0x5d8a('0x106')](db[_0x5d8a('0xb4')],{'as':_0x5d8a('0x1b5'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0xb4')][_0x5d8a('0x106')](db[_0x5d8a('0xb6')],{'as':_0x5d8a('0x1b7'),'foreignKey':_0x5d8a('0x1b8')});db['ServicenowConfiguration'][_0x5d8a('0x106')](db[_0x5d8a('0xb6')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x5d8a('0x106')](db[_0x5d8a('0xb6')],{'as':_0x5d8a('0x1b3'),'foreignKey':_0x5d8a('0x1bb')});db['ServicenowConfiguration']['belongsTo'](db['ServicenowAccount'],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0xb6')]['hasMany'](db[_0x5d8a('0xb6')],{'as':_0x5d8a('0x1bc'),'foreignKey':'SubjectId'});db[_0x5d8a('0xb6')][_0x5d8a('0x106')](db[_0x5d8a('0xb6')],{'as':_0x5d8a('0x1bf'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0xb6')][_0x5d8a('0x106')](db[_0x5d8a('0xb6')],{'as':'Field','foreignKey':'FieldId'});db[_0x5d8a('0xb6')][_0x5d8a('0x112')](db['Variable'],{'as':_0x5d8a('0x85'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0x5d8a('0x106')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x5d8a('0x104'),'foreignKey':'AccountId'});db[_0x5d8a('0x1c9')][_0x5d8a('0x106')](db[_0x5d8a('0xba')],{'as':_0x5d8a('0x1b7'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b8')});db['Dynamics365Configuration'][_0x5d8a('0x106')](db[_0x5d8a('0xba')],{'as':_0x5d8a('0x1b9'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1ba')});db[_0x5d8a('0x1c9')][_0x5d8a('0x106')](db[_0x5d8a('0xba')],{'as':_0x5d8a('0x1b3'),'onDelete':_0x5d8a('0x104'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x5d8a('0x112')](db['Dynamics365Account'],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db['Dynamics365Field']['hasMany'](db[_0x5d8a('0xba')],{'as':_0x5d8a('0x1bc'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0xba')]['hasMany'](db['Dynamics365Field'],{'as':'Description','foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x5d8a('0x106')](db[_0x5d8a('0xba')],{'as':_0x5d8a('0x1bd'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x5d8a('0x112')](db[_0x5d8a('0x85')],{'as':_0x5d8a('0x85'),'foreignKey':'VariableId'});db[_0x5d8a('0xbc')][_0x5d8a('0x106')](db['FreshsalesConfiguration'],{'as':_0x5d8a('0x1b5'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1b6')});db['FreshsalesConfiguration'][_0x5d8a('0x106')](db[_0x5d8a('0x1ca')],{'as':_0x5d8a('0x1b7'),'foreignKey':_0x5d8a('0x1b8')});db['FreshsalesConfiguration'][_0x5d8a('0x106')](db[_0x5d8a('0x1ca')],{'as':'Descriptions','foreignKey':_0x5d8a('0x1ba')});db['FreshsalesConfiguration'][_0x5d8a('0x106')](db[_0x5d8a('0x1ca')],{'as':_0x5d8a('0x1b3'),'foreignKey':'FieldId'});db[_0x5d8a('0x1cb')][_0x5d8a('0x112')](db[_0x5d8a('0xbc')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1b6')});db[_0x5d8a('0x1ca')][_0x5d8a('0x106')](db[_0x5d8a('0x1ca')],{'as':_0x5d8a('0x1bc'),'foreignKey':_0x5d8a('0x1b8')});db[_0x5d8a('0x1ca')][_0x5d8a('0x106')](db['FreshsalesField'],{'as':_0x5d8a('0x1bf'),'foreignKey':'DescriptionId'});db[_0x5d8a('0x1ca')][_0x5d8a('0x106')](db[_0x5d8a('0x1ca')],{'as':_0x5d8a('0x1bd'),'foreignKey':_0x5d8a('0x1bb')});db[_0x5d8a('0x1ca')][_0x5d8a('0x112')](db[_0x5d8a('0x85')],{'as':_0x5d8a('0x85'),'foreignKey':_0x5d8a('0x1be')});db[_0x5d8a('0xc3')][_0x5d8a('0x112')](db[_0x5d8a('0x12c')],{});db[_0x5d8a('0xc3')][_0x5d8a('0x112')](db['CmList'],{'as':_0x5d8a('0x164'),'foreignKey':'ListId'});db[_0x5d8a('0xc3')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':'Contact','foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0xc3')]['belongsTo'](db[_0x5d8a('0x10b')],{});db[_0x5d8a('0xc3')][_0x5d8a('0x112')](db[_0x5d8a('0x5d')],{});db[_0x5d8a('0xc3')]['belongsTo'](db[_0x5d8a('0x101')],{});db['ChatQueueReport'][_0x5d8a('0x112')](db[_0x5d8a('0x60')],{});db[_0x5d8a('0xc4')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1cc')});db['ChatInternalMessage'][_0x5d8a('0x112')](db['User'],{'onDelete':_0x5d8a('0x104'),'foreignKey':'ToId'});db[_0x5d8a('0xc9')][_0x5d8a('0x106')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x5d8a('0x104')});db['JscriptySessionReport'][_0x5d8a('0x106')](db[_0x5d8a('0x1cd')],{'foreignKey':_0x5d8a('0x1ce'),'onDelete':_0x5d8a('0x104')});db['SmsQueueReport'][_0x5d8a('0x112')](db[_0x5d8a('0x137')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x5d8a('0xcb')]['belongsTo'](db[_0x5d8a('0x66')],{'as':'Contact','foreignKey':_0x5d8a('0x16b')});db['SmsQueueReport'][_0x5d8a('0x112')](db[_0x5d8a('0x51')],{});db[_0x5d8a('0xcb')][_0x5d8a('0x112')](db[_0x5d8a('0x181')],{});db[_0x5d8a('0xcb')][_0x5d8a('0x112')](db['User'],{});db[_0x5d8a('0xcb')][_0x5d8a('0x112')](db['SmsQueue'],{});db['JscriptyProject'][_0x5d8a('0x106')](db[_0x5d8a('0xc9')],{'foreignKey':'ProjectId'});db[_0x5d8a('0xcf')][_0x5d8a('0x106')](db[_0x5d8a('0xc7')],{'foreignKey':_0x5d8a('0x1cf')});db[_0x5d8a('0xcf')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x5d8a('0x1cf')});db[_0x5d8a('0x13b')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x170'),'through':_0x5d8a('0x13d')});db['Team'][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':'Agents','through':'user_has_teams'});db['Team'][_0x5d8a('0x116')](db['VoiceQueue'],{'through':'team_has_voice_queues','as':'VoiceQueues'});db[_0x5d8a('0xd7')][_0x5d8a('0x116')](db[_0x5d8a('0x3b')],{'through':_0x5d8a('0x168'),'as':_0x5d8a('0x122')});db['Team'][_0x5d8a('0x116')](db[_0x5d8a('0x60')],{'through':_0x5d8a('0x196'),'as':_0x5d8a('0x124')});db[_0x5d8a('0xd7')]['belongsToMany'](db['FaxQueue'],{'through':_0x5d8a('0x17f'),'as':_0x5d8a('0x1d0')});db['Team']['belongsToMany'](db[_0x5d8a('0x53')],{'through':_0x5d8a('0x1d1'),'as':_0x5d8a('0x126')});db['Team']['belongsToMany'](db[_0x5d8a('0x59')],{'through':_0x5d8a('0x18b'),'as':_0x5d8a('0x128')});db[_0x5d8a('0xd7')][_0x5d8a('0x116')](db[_0x5d8a('0xfe')],{'through':_0x5d8a('0x1d2'),'as':'WhatsappQueues'});db[_0x5d8a('0xda')]['hasMany'](db[_0x5d8a('0x68')],{'as':_0x5d8a('0x147'),'foreignKey':_0x5d8a('0x19c')});db['Campaign'][_0x5d8a('0x106')](db[_0x5d8a('0x6b')],{'as':_0x5d8a('0x109'),'foreignKey':_0x5d8a('0x19c')});db[_0x5d8a('0xda')][_0x5d8a('0x106')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x5d8a('0x19c')});db[_0x5d8a('0xda')]['hasMany'](db[_0x5d8a('0x149')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x5d8a('0xda')][_0x5d8a('0x112')](db[_0x5d8a('0x29')],{'as':_0x5d8a('0x29'),'foreignKey':_0x5d8a('0x1d3')});db[_0x5d8a('0xda')][_0x5d8a('0x112')](db[_0x5d8a('0x29')],{'as':_0x5d8a('0x14c'),'foreignKey':_0x5d8a('0x14d')});db[_0x5d8a('0xda')]['belongsTo'](db[_0x5d8a('0x78')],{'as':_0x5d8a('0x78'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0xda')][_0x5d8a('0x112')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x5d8a('0x1d4')});db['Campaign'][_0x5d8a('0x116')](db['CmList'],{'as':_0x5d8a('0x118'),'through':_0x5d8a('0x1d5')});db[_0x5d8a('0xda')]['belongsToMany'](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x154'),'through':_0x5d8a('0x1d6')});db[_0x5d8a('0xe0')][_0x5d8a('0x112')](db[_0x5d8a('0x3f')],{});db[_0x5d8a('0xe0')][_0x5d8a('0x112')](db[_0x5d8a('0x11b')],{});db[_0x5d8a('0xe0')][_0x5d8a('0x112')](db[_0x5d8a('0x39')],{'foreignKey':_0x5d8a('0x1d7'),'as':_0x5d8a('0x1d8')});db['MailTransferReport']['belongsTo'](db[_0x5d8a('0x101')],{'foreignKey':'FromUserId','as':_0x5d8a('0x1d9')});db[_0x5d8a('0xe0')][_0x5d8a('0x112')](db['User'],{'foreignKey':_0x5d8a('0x1da'),'as':_0x5d8a('0x1db')});db[_0x5d8a('0xe0')][_0x5d8a('0x112')](db[_0x5d8a('0x3b')],{'foreignKey':_0x5d8a('0x1dc'),'as':_0x5d8a('0x1dd')});db[_0x5d8a('0xe0')][_0x5d8a('0x112')](db[_0x5d8a('0x39')],{'foreignKey':'ToMailAccountId','as':_0x5d8a('0x1de')});db[_0x5d8a('0xe2')][_0x5d8a('0x112')](db[_0x5d8a('0x5d')],{});db[_0x5d8a('0xe2')]['belongsTo'](db[_0x5d8a('0x10b')],{});db[_0x5d8a('0xe2')]['belongsTo'](db[_0x5d8a('0x12c')],{'foreignKey':_0x5d8a('0x1df'),'as':'FromAccount'});db[_0x5d8a('0xe2')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1e0'),'as':'FromAgent'});db[_0x5d8a('0xe2')][_0x5d8a('0x112')](db['User'],{'foreignKey':'ToUserId','as':_0x5d8a('0x1db')});db[_0x5d8a('0xe2')][_0x5d8a('0x112')](db[_0x5d8a('0x60')],{'foreignKey':_0x5d8a('0x1e1'),'as':_0x5d8a('0x1dd')});db[_0x5d8a('0xe2')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x5d8a('0x1de')});db[_0x5d8a('0xe3')]['belongsTo'](db[_0x5d8a('0x4a')],{});db[_0x5d8a('0xe3')][_0x5d8a('0x112')](db[_0x5d8a('0x48')],{});db[_0x5d8a('0xe3')][_0x5d8a('0x112')](db[_0x5d8a('0x12f')],{'foreignKey':_0x5d8a('0x1e2'),'as':_0x5d8a('0x1d8')});db[_0x5d8a('0xe3')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1e0'),'as':_0x5d8a('0x1d9')});db['FaxTransferReport'][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1da'),'as':'ToAgent'});db[_0x5d8a('0xe3')][_0x5d8a('0x112')](db[_0x5d8a('0x17b')],{'foreignKey':'ToFaxQueueId','as':_0x5d8a('0x1dd')});db[_0x5d8a('0xe3')][_0x5d8a('0x112')](db[_0x5d8a('0x12f')],{'foreignKey':_0x5d8a('0x1e3'),'as':_0x5d8a('0x1de')});db[_0x5d8a('0xe4')][_0x5d8a('0x112')](db[_0x5d8a('0x57')],{});db[_0x5d8a('0xe4')][_0x5d8a('0x112')](db[_0x5d8a('0x56')],{});db[_0x5d8a('0xe4')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x5d8a('0x1e4'),'as':'FromAccount'});db[_0x5d8a('0xe4')][_0x5d8a('0x112')](db['User'],{'foreignKey':_0x5d8a('0x1e0'),'as':_0x5d8a('0x1d9')});db[_0x5d8a('0xe4')]['belongsTo'](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1da'),'as':_0x5d8a('0x1db')});db[_0x5d8a('0xe4')][_0x5d8a('0x112')](db[_0x5d8a('0x59')],{'foreignKey':_0x5d8a('0x1e5'),'as':_0x5d8a('0x1dd')});db[_0x5d8a('0xe4')]['belongsTo'](db[_0x5d8a('0x134')],{'foreignKey':_0x5d8a('0x1e6'),'as':_0x5d8a('0x1de')});db['SmsTransferReport'][_0x5d8a('0x112')](db[_0x5d8a('0x181')],{});db[_0x5d8a('0xe6')][_0x5d8a('0x112')](db[_0x5d8a('0x51')],{});db[_0x5d8a('0xe6')]['belongsTo'](db[_0x5d8a('0x137')],{'foreignKey':_0x5d8a('0x1e7'),'as':_0x5d8a('0x1d8')});db[_0x5d8a('0xe6')]['belongsTo'](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1e0'),'as':_0x5d8a('0x1d9')});db[_0x5d8a('0xe6')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1da'),'as':'ToAgent'});db[_0x5d8a('0xe6')]['belongsTo'](db[_0x5d8a('0x53')],{'foreignKey':_0x5d8a('0x1e8'),'as':_0x5d8a('0x1dd')});db[_0x5d8a('0xe6')]['belongsTo'](db[_0x5d8a('0x137')],{'foreignKey':_0x5d8a('0x1e9'),'as':'ToAccount'});db[_0x5d8a('0xe7')][_0x5d8a('0x106')](db['Disposition'],{'as':_0x5d8a('0x15e'),'foreignKey':'ListId'});db['CmList'][_0x5d8a('0x106')](db[_0x5d8a('0x70')],{'as':_0x5d8a('0x1ea'),'foreignKey':_0x5d8a('0x165')});db['CmList'][_0x5d8a('0x106')](db['CmContact'],{'as':_0x5d8a('0x117'),'onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0xe7')]['hasMany'](db[_0x5d8a('0x6b')],{'as':_0x5d8a('0x109'),'foreignKey':'ListId'});db[_0x5d8a('0xe7')][_0x5d8a('0x106')](db[_0x5d8a('0x198')],{'as':_0x5d8a('0x1eb'),'foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0xe7')][_0x5d8a('0x106')](db[_0x5d8a('0x6e')],{'as':'ReportAgentPreview','foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0xe7')][_0x5d8a('0x116')](db[_0x5d8a('0x1b')],{'as':'Queues','through':_0x5d8a('0x150')});db['CmList'][_0x5d8a('0x116')](db['User'],{'as':_0x5d8a('0x151'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x5d8a('0x106')](db[_0x5d8a('0x17')],{'as':_0x5d8a('0x108'),'onDelete':_0x5d8a('0x104')});db['VoicePrefix'][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':'Agents','through':_0x5d8a('0x12b')});db[_0x5d8a('0xeb')]['hasMany'](db['User'],{'as':_0x5d8a('0x170'),'foreignKey':_0x5d8a('0x113')});db[_0x5d8a('0xeb')][_0x5d8a('0x106')](db[_0x5d8a('0xed')],{'as':_0x5d8a('0x1ec'),'foreignKey':'userProfileId','onDelete':_0x5d8a('0x104')});db[_0x5d8a('0xed')][_0x5d8a('0x106')](db[_0x5d8a('0xef')],{'as':_0x5d8a('0x1ed'),'foreignKey':_0x5d8a('0x1ee'),'onDelete':_0x5d8a('0x104')});db[_0x5d8a('0xf3')][_0x5d8a('0x106')](db[_0x5d8a('0x75')],{'as':_0x5d8a('0x15e'),'foreignKey':'WhatsappAccountId'});db[_0x5d8a('0xf3')]['hasMany'](db['CannedAnswer'],{'as':_0x5d8a('0x15f'),'foreignKey':_0x5d8a('0x1ef')});db[_0x5d8a('0xf3')]['hasMany'](db[_0x5d8a('0xf9')],{'as':_0x5d8a('0x161'),'foreignKey':_0x5d8a('0x1ef')});db[_0x5d8a('0xf3')][_0x5d8a('0x106')](db['WhatsappInteraction'],{'as':_0x5d8a('0x162')});db[_0x5d8a('0xf3')][_0x5d8a('0x106')](db[_0x5d8a('0xf5')],{'as':'Applications'});db[_0x5d8a('0xf3')][_0x5d8a('0x112')](db['CmList'],{'as':'List','foreignKey':_0x5d8a('0x165')});db[_0x5d8a('0xf3')]['belongsTo'](db[_0x5d8a('0x79')],{'as':_0x5d8a('0x14f'),'foreignKey':_0x5d8a('0x167')});db[_0x5d8a('0xf3')][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x13a')});db[_0x5d8a('0xf5')]['belongsTo'](db[_0x5d8a('0x101')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x5d8a('0x112')](db[_0x5d8a('0xfe')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0xf5')]['belongsTo'](db[_0x5d8a('0xf3')],{'onDelete':_0x5d8a('0x173')});db[_0x5d8a('0xf5')][_0x5d8a('0x112')](db[_0x5d8a('0x78')],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x14e')});db[_0x5d8a('0xf5')][_0x5d8a('0x112')](db['Tag'],{'onDelete':_0x5d8a('0x173'),'foreignKey':_0x5d8a('0x174')});db[_0x5d8a('0xf7')][_0x5d8a('0x106')](db[_0x5d8a('0xf9')],{'as':'Messages','onDelete':_0x5d8a('0x104'),'foreignKey':_0x5d8a('0x1f0')});db[_0x5d8a('0xf7')][_0x5d8a('0x112')](db[_0x5d8a('0xf3')],{'as':_0x5d8a('0x16a'),'foreignKey':_0x5d8a('0x1ef')});db[_0x5d8a('0xf7')]['belongsTo'](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':_0x5d8a('0x16b')});db[_0x5d8a('0xf7')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'as':_0x5d8a('0x16c'),'foreignKey':'UserId'});db[_0x5d8a('0xf7')][_0x5d8a('0x116')](db[_0x5d8a('0x7f')],{'through':_0x5d8a('0x1ac'),'as':_0x5d8a('0x16d')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0x5d8a('0x1ac'),'as':_0x5d8a('0x16f')});db['WhatsappInteraction'][_0x5d8a('0x116')](db[_0x5d8a('0x101')],{'as':'Users','through':_0x5d8a('0x1f1'),'foreignKey':_0x5d8a('0x1f0')});db[_0x5d8a('0xf9')][_0x5d8a('0x112')](db['User'],{'as':_0x5d8a('0x101')});db[_0x5d8a('0xf9')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'onDelete':_0x5d8a('0x104'),'as':_0x5d8a('0x15b')});db['WhatsappMessage']['belongsTo'](db[_0x5d8a('0xf7')],{'onDelete':_0x5d8a('0x104'),'as':'Interaction','foreignKey':_0x5d8a('0x1f0')});db[_0x5d8a('0xf9')][_0x5d8a('0x112')](db[_0x5d8a('0xf3')],{'as':'Account','foreignKey':_0x5d8a('0x1ef')});db[_0x5d8a('0xfb')][_0x5d8a('0x112')](db[_0x5d8a('0xf3')],{});db[_0x5d8a('0xfb')]['belongsTo'](db[_0x5d8a('0xe7')],{'as':_0x5d8a('0x164'),'foreignKey':'ListId'});db[_0x5d8a('0xfb')][_0x5d8a('0x112')](db[_0x5d8a('0x66')],{'as':_0x5d8a('0x15b'),'foreignKey':'ContactId'});db[_0x5d8a('0xfb')][_0x5d8a('0x112')](db[_0x5d8a('0xf7')],{});db[_0x5d8a('0xfb')][_0x5d8a('0x112')](db[_0x5d8a('0xfe')],{});db[_0x5d8a('0xfb')][_0x5d8a('0x112')](db['WhatsappMessage'],{});db[_0x5d8a('0xfb')]['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0x5d8a('0x112')](db[_0x5d8a('0xf9')],{});db[_0x5d8a('0xfd')][_0x5d8a('0x112')](db[_0x5d8a('0xf7')],{});db[_0x5d8a('0xfd')][_0x5d8a('0x112')](db['WhatsappAccount'],{'foreignKey':_0x5d8a('0x1f2'),'as':'FromAccount'});db[_0x5d8a('0xfd')]['belongsTo'](db[_0x5d8a('0xf3')],{'foreignKey':_0x5d8a('0x1f3'),'as':_0x5d8a('0x1de')});db[_0x5d8a('0xfd')]['belongsTo'](db[_0x5d8a('0xfe')],{'foreignKey':_0x5d8a('0x1f4'),'as':_0x5d8a('0x1dd')});db[_0x5d8a('0xfd')][_0x5d8a('0x112')](db[_0x5d8a('0x101')],{'foreignKey':_0x5d8a('0x1e0'),'as':_0x5d8a('0x1d9')});db[_0x5d8a('0xfd')]['belongsTo'](db[_0x5d8a('0x101')],{'foreignKey':'ToUserId','as':_0x5d8a('0x1db')});db['WhatsappQueue'][_0x5d8a('0x116')](db['User'],{'as':_0x5d8a('0x151'),'through':_0x5d8a('0x35'),'foreignKey':_0x5d8a('0x1f5')});db['WhatsappQueue'][_0x5d8a('0x116')](db[_0x5d8a('0xd7')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0x5d8a('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 53e4202..1ace08e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x928c=['route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','street','mobile','fax','clientId','clientSecret','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','calleridname','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','express','express-winston','./errors','./config/environment','./config/logger','api','default','use','%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','url','responseTime','user','role','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)','method','remoteAddress','statusCode','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./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/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','1.0.16'];(function(_0x313c0e,_0x530cf0){var _0x4175a5=function(_0x5f1430){while(--_0x5f1430){_0x313c0e['push'](_0x313c0e['shift']());}};_0x4175a5(++_0x530cf0);}(_0x928c,0x17f));var _0xc928=function(_0x2991ee,_0x21311a){_0x2991ee=_0x2991ee-0x0;var _0x352dcd=_0x928c[_0x2991ee];return _0x352dcd;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0xc928('0x0'));var ewinston=require(_0xc928('0x1'));var util=require('util');var errors=require(_0xc928('0x2'));var config=require(_0xc928('0x3'));var logger=require(_0xc928('0x4'))(_0xc928('0x5'));var authLogger=require(_0xc928('0x4'))('auth');exports[_0xc928('0x6')]=function(_0x4704bc){_0x4704bc[_0xc928('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4fd2a0,_0x5e433b){var _0x445248=_0xc928('0x8');if(!_[_0xc928('0x9')](_0x4fd2a0[_0xc928('0xa')])){_0x445248+=_0xc928('0xb');var _0x628a51=_0x4fd2a0[_0xc928('0xa')];maskSensitiveData(_0x628a51);}return util[_0xc928('0xc')](_0x445248,_0x4fd2a0['method'],_0x4fd2a0[_0xc928('0xd')][_0xc928('0xe')]?_0x4fd2a0['headers']['x-forwarded-for']:_0x4fd2a0[_0xc928('0xf')]['remoteAddress']||_0x4fd2a0['ip'],_0x4fd2a0[_0xc928('0x10')],_0x5e433b['statusCode'],_0x5e433b[_0xc928('0x11')],_0x4fd2a0[_0xc928('0x12')]?_0x4fd2a0['user']['id']:null,_0x4fd2a0[_0xc928('0x12')]?_0x4fd2a0[_0xc928('0x12')]['name']:null,_0x4fd2a0[_0xc928('0x12')]?_0x4fd2a0[_0xc928('0x12')][_0xc928('0x13')]:null,_0x628a51?util[_0xc928('0x14')](_0x628a51,![],null):'');}}));_0x4704bc[_0xc928('0x7')](ewinston[_0xc928('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x546cfe,_0x16dd14){var _0x331e02=_0xc928('0x16');if(_0x546cfe[_0xc928('0xa')]&&_0x546cfe[_0xc928('0xa')][_0xc928('0x17')]&&_0x546cfe[_0xc928('0xa')][_0xc928('0x18')]){_0x331e02=_0xc928('0x19');}return util[_0xc928('0xc')](_0x331e02,_0x546cfe[_0xc928('0x1a')],_0x546cfe[_0xc928('0xd')]['x-forwarded-for']?_0x546cfe[_0xc928('0xd')][_0xc928('0xe')]:_0x546cfe[_0xc928('0xf')][_0xc928('0x1b')]||_0x546cfe['ip'],_0x546cfe['url'],_0x16dd14[_0xc928('0x1c')],_0x16dd14[_0xc928('0x11')],_0x546cfe[_0xc928('0x12')]?_0x546cfe['user']['id']:null,_0x546cfe['user']?_0x546cfe[_0xc928('0x12')][_0xc928('0x1d')]:null,_0x546cfe[_0xc928('0x12')]?_0x546cfe[_0xc928('0x12')]['role']:null,_0x546cfe['body']&&_0x546cfe[_0xc928('0xa')][_0xc928('0x17')]?_0x546cfe[_0xc928('0xa')][_0xc928('0x17')]:_0xc928('0x1e'),_0x546cfe['body']&&_0x546cfe[_0xc928('0xa')][_0xc928('0x18')]?_0x546cfe[_0xc928('0xa')]['agent_id']:'',_0x546cfe['body']&&_0x546cfe[_0xc928('0xa')][_0xc928('0x1f')]?_0x546cfe['body'][_0xc928('0x1f')]:'');},'ignoreRoute':function(_0x1c80f8){var _0xcb813=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xcb813[_0xc928('0x20')](_0x1c80f8['url']);}}));_0x4704bc[_0xc928('0x7')](_0xc928('0x21'),require(_0xc928('0x22')));_0x4704bc[_0xc928('0x7')](_0xc928('0x23'),require(_0xc928('0x24')));_0x4704bc[_0xc928('0x7')](_0xc928('0x25'),require(_0xc928('0x26')));_0x4704bc[_0xc928('0x7')](_0xc928('0x27'),require(_0xc928('0x28')));_0x4704bc[_0xc928('0x7')](_0xc928('0x29'),require(_0xc928('0x2a')));_0x4704bc[_0xc928('0x7')](_0xc928('0x2b'),require(_0xc928('0x2c')));_0x4704bc['use'](_0xc928('0x2d'),require(_0xc928('0x2e')));_0x4704bc[_0xc928('0x7')]('/api/screen/recordings',require('./api/screenRecording'));_0x4704bc[_0xc928('0x7')](_0xc928('0x2f'),require(_0xc928('0x30')));_0x4704bc[_0xc928('0x7')](_0xc928('0x31'),require(_0xc928('0x32')));_0x4704bc[_0xc928('0x7')](_0xc928('0x33'),require(_0xc928('0x34')));_0x4704bc[_0xc928('0x7')](_0xc928('0x35'),require(_0xc928('0x36')));_0x4704bc[_0xc928('0x7')]('/api/voice/agents/reports',require(_0xc928('0x37')));_0x4704bc[_0xc928('0x7')]('/api/voice/queues/reports',require(_0xc928('0x38')));_0x4704bc[_0xc928('0x7')](_0xc928('0x39'),require(_0xc928('0x3a')));_0x4704bc[_0xc928('0x7')](_0xc928('0x3b'),require(_0xc928('0x3c')));_0x4704bc[_0xc928('0x7')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x4704bc[_0xc928('0x7')]('/api/mail/out_servers',require(_0xc928('0x3d')));_0x4704bc[_0xc928('0x7')](_0xc928('0x3e'),require(_0xc928('0x3f')));_0x4704bc[_0xc928('0x7')](_0xc928('0x40'),require('./api/mailQueue'));_0x4704bc[_0xc928('0x7')](_0xc928('0x41'),require(_0xc928('0x42')));_0x4704bc['use'](_0xc928('0x43'),require(_0xc928('0x44')));_0x4704bc[_0xc928('0x7')](_0xc928('0x45'),require(_0xc928('0x46')));_0x4704bc[_0xc928('0x7')]('/api/mail/applications',require(_0xc928('0x47')));_0x4704bc['use'](_0xc928('0x48'),require(_0xc928('0x49')));_0x4704bc[_0xc928('0x7')](_0xc928('0x4a'),require(_0xc928('0x4b')));_0x4704bc['use'](_0xc928('0x4c'),require(_0xc928('0x4d')));_0x4704bc['use']('/api/fax/accounts',require('./api/faxAccount'));_0x4704bc['use'](_0xc928('0x4e'),require(_0xc928('0x4f')));_0x4704bc[_0xc928('0x7')](_0xc928('0x50'),require(_0xc928('0x51')));_0x4704bc[_0xc928('0x7')](_0xc928('0x52'),require('./api/faxMessage'));_0x4704bc[_0xc928('0x7')](_0xc928('0x53'),require('./api/faxQueue'));_0x4704bc['use'](_0xc928('0x54'),require(_0xc928('0x55')));_0x4704bc[_0xc928('0x7')](_0xc928('0x56'),require(_0xc928('0x57')));_0x4704bc[_0xc928('0x7')]('/api/sms/applications',require(_0xc928('0x58')));_0x4704bc['use'](_0xc928('0x59'),require(_0xc928('0x5a')));_0x4704bc[_0xc928('0x7')](_0xc928('0x5b'),require(_0xc928('0x5c')));_0x4704bc['use']('/api/sms/queues',require(_0xc928('0x5d')));_0x4704bc[_0xc928('0x7')]('/api/openchannel/accounts',require(_0xc928('0x5e')));_0x4704bc[_0xc928('0x7')](_0xc928('0x5f'),require('./api/openchannelApplication'));_0x4704bc[_0xc928('0x7')](_0xc928('0x60'),require(_0xc928('0x61')));_0x4704bc[_0xc928('0x7')]('/api/openchannel/messages',require(_0xc928('0x62')));_0x4704bc[_0xc928('0x7')]('/api/openchannel/queues',require(_0xc928('0x63')));_0x4704bc[_0xc928('0x7')](_0xc928('0x64'),require(_0xc928('0x65')));_0x4704bc[_0xc928('0x7')](_0xc928('0x66'),require('./api/openchannelQueueReport'));_0x4704bc[_0xc928('0x7')](_0xc928('0x67'),require('./api/chatApplication'));_0x4704bc['use'](_0xc928('0x68'),require(_0xc928('0x69')));_0x4704bc[_0xc928('0x7')](_0xc928('0x6a'),require(_0xc928('0x6b')));_0x4704bc[_0xc928('0x7')](_0xc928('0x6c'),require('./api/chatOfflineMessage'));_0x4704bc['use'](_0xc928('0x6d'),require(_0xc928('0x6e')));_0x4704bc[_0xc928('0x7')]('/api/chat/groups',require(_0xc928('0x6f')));_0x4704bc[_0xc928('0x7')]('/api/chat/proactive_actions',require(_0xc928('0x70')));_0x4704bc[_0xc928('0x7')](_0xc928('0x71'),require(_0xc928('0x72')));_0x4704bc[_0xc928('0x7')](_0xc928('0x73'),require(_0xc928('0x74')));_0x4704bc[_0xc928('0x7')](_0xc928('0x75'),require(_0xc928('0x76')));_0x4704bc[_0xc928('0x7')](_0xc928('0x77'),require(_0xc928('0x78')));_0x4704bc[_0xc928('0x7')](_0xc928('0x79'),require(_0xc928('0x7a')));_0x4704bc[_0xc928('0x7')](_0xc928('0x7b'),require(_0xc928('0x7c')));_0x4704bc['use'](_0xc928('0x7d'),require(_0xc928('0x7e')));_0x4704bc[_0xc928('0x7')](_0xc928('0x7f'),require(_0xc928('0x80')));_0x4704bc[_0xc928('0x7')](_0xc928('0x81'),require(_0xc928('0x82')));_0x4704bc[_0xc928('0x7')](_0xc928('0x83'),require(_0xc928('0x84')));_0x4704bc[_0xc928('0x7')](_0xc928('0x85'),require(_0xc928('0x86')));_0x4704bc[_0xc928('0x7')](_0xc928('0x87'),require(_0xc928('0x88')));_0x4704bc[_0xc928('0x7')](_0xc928('0x89'),require(_0xc928('0x8a')));_0x4704bc[_0xc928('0x7')](_0xc928('0x8b'),require(_0xc928('0x8c')));_0x4704bc['use']('/api/cdr',require(_0xc928('0x8d')));_0x4704bc['use'](_0xc928('0x8e'),require(_0xc928('0x8f')));_0x4704bc[_0xc928('0x7')]('/api/schedules',require(_0xc928('0x90')));_0x4704bc['use']('/api/sounds',require('./api/sound'));_0x4704bc[_0xc928('0x7')]('/api/tags',require('./api/tag'));_0x4704bc[_0xc928('0x7')]('/api/templates',require(_0xc928('0x91')));_0x4704bc[_0xc928('0x7')](_0xc928('0x92'),require(_0xc928('0x93')));_0x4704bc[_0xc928('0x7')]('/api/variables',require('./api/variable'));_0x4704bc[_0xc928('0x7')](_0xc928('0x94'),require(_0xc928('0x95')));_0x4704bc[_0xc928('0x7')](_0xc928('0x96'),require(_0xc928('0x97')));_0x4704bc['use'](_0xc928('0x98'),require(_0xc928('0x99')));_0x4704bc[_0xc928('0x7')](_0xc928('0x9a'),require(_0xc928('0x9b')));_0x4704bc[_0xc928('0x7')](_0xc928('0x9c'),require(_0xc928('0x9d')));_0x4704bc[_0xc928('0x7')](_0xc928('0x9e'),require(_0xc928('0x9f')));_0x4704bc[_0xc928('0x7')]('/api/analytics/field_reports',require(_0xc928('0xa0')));_0x4704bc[_0xc928('0x7')](_0xc928('0xa1'),require(_0xc928('0xa2')));_0x4704bc[_0xc928('0x7')](_0xc928('0xa3'),require(_0xc928('0xa4')));_0x4704bc[_0xc928('0x7')]('/api/integrations/salesforce/configurations',require(_0xc928('0xa5')));_0x4704bc['use']('/api/integrations/salesforce/fields',require(_0xc928('0xa6')));_0x4704bc[_0xc928('0x7')]('/api/integrations/sugarcrm/accounts',require(_0xc928('0xa7')));_0x4704bc[_0xc928('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xc928('0xa8')));_0x4704bc['use'](_0xc928('0xa9'),require(_0xc928('0xaa')));_0x4704bc[_0xc928('0x7')](_0xc928('0xab'),require('./api/intDeskAccount'));_0x4704bc[_0xc928('0x7')](_0xc928('0xac'),require(_0xc928('0xad')));_0x4704bc[_0xc928('0x7')](_0xc928('0xae'),require('./api/intDeskField'));_0x4704bc[_0xc928('0x7')]('/api/integrations/zoho/accounts',require(_0xc928('0xaf')));_0x4704bc[_0xc928('0x7')](_0xc928('0xb0'),require(_0xc928('0xb1')));_0x4704bc['use'](_0xc928('0xb2'),require(_0xc928('0xb3')));_0x4704bc[_0xc928('0x7')](_0xc928('0xb4'),require(_0xc928('0xb5')));_0x4704bc[_0xc928('0x7')](_0xc928('0xb6'),require(_0xc928('0xb7')));_0x4704bc[_0xc928('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x4704bc[_0xc928('0x7')](_0xc928('0xb8'),require(_0xc928('0xb9')));_0x4704bc['use'](_0xc928('0xba'),require(_0xc928('0xbb')));_0x4704bc[_0xc928('0x7')](_0xc928('0xbc'),require(_0xc928('0xbd')));_0x4704bc['use']('/api/integrations/vtiger/accounts',require(_0xc928('0xbe')));_0x4704bc[_0xc928('0x7')](_0xc928('0xbf'),require('./api/intVtigerConfiguration'));_0x4704bc[_0xc928('0x7')](_0xc928('0xc0'),require('./api/intVtigerField'));_0x4704bc[_0xc928('0x7')](_0xc928('0xc1'),require(_0xc928('0xc2')));_0x4704bc['use'](_0xc928('0xc3'),require('./api/intServicenowConfiguration'));_0x4704bc[_0xc928('0x7')](_0xc928('0xc4'),require(_0xc928('0xc5')));_0x4704bc['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x4704bc[_0xc928('0x7')](_0xc928('0xc6'),require(_0xc928('0xc7')));_0x4704bc[_0xc928('0x7')](_0xc928('0xc8'),require(_0xc928('0xc9')));_0x4704bc[_0xc928('0x7')](_0xc928('0xca'),require(_0xc928('0xcb')));_0x4704bc['use'](_0xc928('0xcc'),require('./api/intFreshsalesConfiguration'));_0x4704bc['use']('/api/integrations/freshsales/fields',require(_0xc928('0xcd')));_0x4704bc[_0xc928('0x7')](_0xc928('0xce'),require(_0xc928('0xcf')));_0x4704bc[_0xc928('0x7')]('/api/chat/reports/queue',require(_0xc928('0xd0')));_0x4704bc[_0xc928('0x7')](_0xc928('0xd1'),require('./api/chatInternalMessage'));_0x4704bc[_0xc928('0x7')](_0xc928('0xd2'),require(_0xc928('0xd3')));_0x4704bc[_0xc928('0x7')]('/api/jscripty/questions/reports',require(_0xc928('0xd4')));_0x4704bc['use']('/api/jscripty/sessions/reports',require(_0xc928('0xd5')));_0x4704bc['use'](_0xc928('0xd6'),require(_0xc928('0xd7')));_0x4704bc[_0xc928('0x7')](_0xc928('0xd8'),require(_0xc928('0xd9')));_0x4704bc['use']('/api/square/details/reports',require(_0xc928('0xda')));_0x4704bc[_0xc928('0x7')](_0xc928('0xdb'),require(_0xc928('0xdc')));_0x4704bc[_0xc928('0x7')](_0xc928('0xdd'),require('./api/setting'));_0x4704bc[_0xc928('0x7')](_0xc928('0xde'),require(_0xc928('0xdf')));_0x4704bc[_0xc928('0x7')](_0xc928('0xe0'),require('./api/squareProject'));_0x4704bc['use'](_0xc928('0xe1'),require(_0xc928('0xe2')));_0x4704bc[_0xc928('0x7')](_0xc928('0xe3'),require(_0xc928('0xe4')));_0x4704bc[_0xc928('0x7')](_0xc928('0xe5'),require(_0xc928('0xe6')));_0x4704bc['use']('/api/license',require(_0xc928('0xe7')));_0x4704bc[_0xc928('0x7')](_0xc928('0xe8'),require('./api/campaign'));_0x4704bc['use'](_0xc928('0xe9'),require(_0xc928('0xea')));_0x4704bc[_0xc928('0x7')](_0xc928('0xeb'),require('./api/attachment'));_0x4704bc[_0xc928('0x7')](_0xc928('0xec'),require(_0xc928('0xed')));_0x4704bc[_0xc928('0x7')](_0xc928('0xee'),require(_0xc928('0xef')));_0x4704bc[_0xc928('0x7')](_0xc928('0xf0'),require('./api/chatTransferReport'));_0x4704bc[_0xc928('0x7')](_0xc928('0xf1'),require('./api/faxTransferReport'));_0x4704bc[_0xc928('0x7')](_0xc928('0xf2'),require(_0xc928('0xf3')));_0x4704bc[_0xc928('0x7')](_0xc928('0xf4'),require(_0xc928('0xf5')));_0x4704bc[_0xc928('0x7')](_0xc928('0xf6'),require(_0xc928('0xf7')));_0x4704bc['use'](_0xc928('0xf8'),require(_0xc928('0xf9')));_0x4704bc[_0xc928('0x7')](_0xc928('0xfa'),require(_0xc928('0xfb')));_0x4704bc[_0xc928('0x7')]('/api/userProfile/sections',require(_0xc928('0xfc')));_0x4704bc['use'](_0xc928('0xfd'),require(_0xc928('0xfe')));_0x4704bc[_0xc928('0x7')]('/api/notifications',require('./api/notification'));_0x4704bc['use'](_0xc928('0xff'),require(_0xc928('0x100')));_0x4704bc[_0xc928('0x7')]('/api/whatsapp/accounts',require(_0xc928('0x101')));_0x4704bc[_0xc928('0x7')](_0xc928('0x102'),require(_0xc928('0x103')));_0x4704bc['use'](_0xc928('0x104'),require(_0xc928('0x105')));_0x4704bc[_0xc928('0x7')]('/api/whatsapp/messages',require(_0xc928('0x106')));_0x4704bc['use'](_0xc928('0x107'),require(_0xc928('0x108')));_0x4704bc['use'](_0xc928('0x109'),require(_0xc928('0x10a')));_0x4704bc[_0xc928('0x7')](_0xc928('0x10b'),require(_0xc928('0x10c')));_0x4704bc['use'](_0xc928('0x10d'),require('./api/cloudProvider'));_0x4704bc[_0xc928('0x7')](_0xc928('0x10e'),require(_0xc928('0x10f')));_0x4704bc[_0xc928('0x7')](_0xc928('0x110'),require(_0xc928('0x111')));_0x4704bc[_0xc928('0x7')](_0xc928('0x112'),require(_0xc928('0x113')));_0x4704bc[_0xc928('0x7')]('/api/rpc',require(_0xc928('0x114')));_0x4704bc[_0xc928('0x7')](_0xc928('0x115'),require(_0xc928('0x116')));_0x4704bc[_0xc928('0x7')]('/api/system',require('./api/system'));_0x4704bc[_0xc928('0x7')](_0xc928('0x117'),require(_0xc928('0x118')));_0x4704bc[_0xc928('0x7')](_0xc928('0x119'),require(_0xc928('0x11a')));_0x4704bc['use'](_0xc928('0x11b'),express[_0xc928('0x11c')](path[_0xc928('0x11d')](config[_0xc928('0x11e')],_0xc928('0x11b'))));_0x4704bc['use'](_0xc928('0x11f'),express['static'](path[_0xc928('0x11d')](config[_0xc928('0x11e')],'/www')));_0x4704bc['use'](_0xc928('0x120'),express[_0xc928('0x11c')](path[_0xc928('0x11d')](config['root'],_0xc928('0x120'))));_0x4704bc['use']('/snippet',express[_0xc928('0x11c')](path[_0xc928('0x11d')](config[_0xc928('0x11e')],_0xc928('0x121'),_0xc928('0x122'))));_0x4704bc[_0xc928('0x7')]('/plugins',express[_0xc928('0x11c')](path[_0xc928('0x11d')](config['root'],'/server/files/plugins')));_0x4704bc[_0xc928('0x123')](_0xc928('0x124'))[_0xc928('0x125')](errors[0x194]);_0x4704bc[_0xc928('0x123')]('/*')[_0xc928('0x125')](function(_0x7bb453,_0x1a92c2){_0x1a92c2[_0xc928('0x126')](path[_0xc928('0x127')](_0x4704bc[_0xc928('0x125')](_0xc928('0x128'))+_0xc928('0x129')));});};var sensitiveFields=[_0xc928('0x12a'),_0xc928('0x12b'),_0xc928('0x12c'),'apiKey',_0xc928('0x12d'),_0xc928('0x12e'),_0xc928('0x12f'),'phone',_0xc928('0x130'),_0xc928('0x131'),'email',_0xc928('0x132'),_0xc928('0x133'),_0xc928('0x134'),_0xc928('0x135'),'accessKey',_0xc928('0x136'),_0xc928('0x137'),_0xc928('0x138'),_0xc928('0x139'),_0xc928('0x13a'),'authToken',_0xc928('0x13b'),_0xc928('0x13c'),'membername',_0xc928('0x13d'),'calleridnum','exten',_0xc928('0x13e'),_0xc928('0x13f'),_0xc928('0x140'),'accesskeyid',_0xc928('0x141'),_0xc928('0x142'),_0xc928('0x12'),_0xc928('0x143'),_0xc928('0x144'),_0xc928('0x145'),_0xc928('0x146'),_0xc928('0x147'),'registry',_0xc928('0x148')];function maskSensitiveData(_0xda62bf){var _0x5f6535=/(?!^)[\s\S](?!$)/g;if(!_[_0xc928('0x149')](_0xda62bf))return;for(var _0x22b761 in _0xda62bf){if(_[_0xc928('0x14a')](_0xda62bf[_0x22b761])){for(var _0x48b65b=0x0;_0x48b65b<_0xda62bf[_0x22b761][_0xc928('0x14b')];_0x48b65b++){maskSensitiveData(_0xda62bf[_0x22b761][_0x48b65b]);}}else if(_[_0xc928('0x149')](_0xda62bf[_0x22b761])){maskSensitiveData(_0xda62bf[_0x22b761]);}else if(_[_0xc928('0x14c')](_0xda62bf[_0x22b761])){_0xda62bf[_0x22b761]=_0xda62bf[_0x22b761][_0xc928('0x14d')](/{{{/g,_0xc928('0x14e'))['replace'](/}}}/g,_0xc928('0x14f'))[_0xc928('0x14d')](/{{/g,'@{')[_0xc928('0x14d')](/}}/g,'}@');if(_[_0xc928('0x150')](sensitiveFields,_0x22b761)){_0xda62bf[_0x22b761]=_0xda62bf[_0x22b761]['replace'](_0x5f6535,'*');}}}} \ No newline at end of file +var _0xc3b0=['accessTokenSecret','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','secretaccesskey','pass','dsn','secret','registry','oldPassword','isPlainObject','length','@@{','replace','includes','lodash','path','express','express-winston','./config/environment','./config/logger','auth','default','use','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','statusCode','role','device','other','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./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/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/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/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/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/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/authLocal','./api/jira','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','/demo','static','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','clientId','clientSecret','securityToken','code','tenantId','token','channelSecret','accessToken'];(function(_0x1fc82b,_0x5150a6){var _0x4c6679=function(_0x1d97dd){while(--_0x1d97dd){_0x1fc82b['push'](_0x1fc82b['shift']());}};_0x4c6679(++_0x5150a6);}(_0xc3b0,0x166));var _0x0c3b=function(_0x1a713b,_0x1bf005){_0x1a713b=_0x1a713b-0x0;var _0x37ae74=_0xc3b0[_0x1a713b];return _0x37ae74;};'use strict';var _=require(_0x0c3b('0x0'));var path=require(_0x0c3b('0x1'));var express=require(_0x0c3b('0x2'));var ewinston=require(_0x0c3b('0x3'));var util=require('util');var errors=require('./errors');var config=require(_0x0c3b('0x4'));var logger=require(_0x0c3b('0x5'))('api');var authLogger=require(_0x0c3b('0x5'))(_0x0c3b('0x6'));exports[_0x0c3b('0x7')]=function(_0x5ba7f1){_0x5ba7f1[_0x0c3b('0x8')](ewinston[_0x0c3b('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x8e628a,_0x4e7c4f){var _0x5c4e3a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x0c3b('0xa')](_0x8e628a[_0x0c3b('0xb')])){_0x5c4e3a+=_0x0c3b('0xc');var _0x2062dd=_0x8e628a[_0x0c3b('0xb')];maskSensitiveData(_0x2062dd);}return util[_0x0c3b('0xd')](_0x5c4e3a,_0x8e628a[_0x0c3b('0xe')],_0x8e628a[_0x0c3b('0xf')][_0x0c3b('0x10')]?_0x8e628a[_0x0c3b('0xf')][_0x0c3b('0x10')]:_0x8e628a[_0x0c3b('0x11')]['remoteAddress']||_0x8e628a['ip'],_0x8e628a[_0x0c3b('0x12')],_0x4e7c4f['statusCode'],_0x4e7c4f[_0x0c3b('0x13')],_0x8e628a['user']?_0x8e628a[_0x0c3b('0x14')]['id']:null,_0x8e628a[_0x0c3b('0x14')]?_0x8e628a[_0x0c3b('0x14')][_0x0c3b('0x15')]:null,_0x8e628a[_0x0c3b('0x14')]?_0x8e628a[_0x0c3b('0x14')]['role']:null,_0x2062dd?util[_0x0c3b('0x16')](_0x2062dd,![],null):'');}}));_0x5ba7f1['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x292e67,_0x35f261){var _0x107daf=_0x0c3b('0x17');if(_0x292e67[_0x0c3b('0xb')]&&_0x292e67['body']['device']&&_0x292e67[_0x0c3b('0xb')][_0x0c3b('0x18')]){_0x107daf=_0x0c3b('0x19');}return util['format'](_0x107daf,_0x292e67[_0x0c3b('0xe')],_0x292e67[_0x0c3b('0xf')][_0x0c3b('0x10')]?_0x292e67[_0x0c3b('0xf')][_0x0c3b('0x10')]:_0x292e67[_0x0c3b('0x11')][_0x0c3b('0x1a')]||_0x292e67['ip'],_0x292e67['url'],_0x35f261[_0x0c3b('0x1b')],_0x35f261['responseTime'],_0x292e67[_0x0c3b('0x14')]?_0x292e67[_0x0c3b('0x14')]['id']:null,_0x292e67[_0x0c3b('0x14')]?_0x292e67[_0x0c3b('0x14')][_0x0c3b('0x15')]:null,_0x292e67[_0x0c3b('0x14')]?_0x292e67[_0x0c3b('0x14')][_0x0c3b('0x1c')]:null,_0x292e67[_0x0c3b('0xb')]&&_0x292e67['body'][_0x0c3b('0x1d')]?_0x292e67[_0x0c3b('0xb')][_0x0c3b('0x1d')]:_0x0c3b('0x1e'),_0x292e67[_0x0c3b('0xb')]&&_0x292e67['body'][_0x0c3b('0x18')]?_0x292e67['body'][_0x0c3b('0x18')]:'',_0x292e67[_0x0c3b('0xb')]&&_0x292e67[_0x0c3b('0xb')]['agent_name']?_0x292e67[_0x0c3b('0xb')][_0x0c3b('0x1f')]:'');},'ignoreRoute':function(_0x131f94){var _0x10b0fd=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x10b0fd[_0x0c3b('0x20')](_0x131f94[_0x0c3b('0x12')]);}}));_0x5ba7f1['use']('/api/users',require('./api/user'));_0x5ba7f1['use'](_0x0c3b('0x21'),require(_0x0c3b('0x22')));_0x5ba7f1['use'](_0x0c3b('0x23'),require(_0x0c3b('0x24')));_0x5ba7f1[_0x0c3b('0x8')]('/api/voice/extensions',require(_0x0c3b('0x25')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x26'),require(_0x0c3b('0x27')));_0x5ba7f1['use'](_0x0c3b('0x28'),require(_0x0c3b('0x29')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x2a'),require(_0x0c3b('0x2b')));_0x5ba7f1['use'](_0x0c3b('0x2c'),require(_0x0c3b('0x2d')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x2e'),require(_0x0c3b('0x2f')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x30'),require('./api/voiceMailMessage'));_0x5ba7f1[_0x0c3b('0x8')]('/api/voice/calls/reports',require(_0x0c3b('0x31')));_0x5ba7f1[_0x0c3b('0x8')]('/api/voice/dials/reports',require(_0x0c3b('0x32')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x33'),require(_0x0c3b('0x34')));_0x5ba7f1['use'](_0x0c3b('0x35'),require(_0x0c3b('0x36')));_0x5ba7f1['use'](_0x0c3b('0x37'),require(_0x0c3b('0x38')));_0x5ba7f1[_0x0c3b('0x8')]('/api/trunks',require(_0x0c3b('0x39')));_0x5ba7f1['use'](_0x0c3b('0x3a'),require('./api/voiceTransferReport'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x3b'),require(_0x0c3b('0x3c')));_0x5ba7f1['use']('/api/mail/accounts',require('./api/mailAccount'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x3d'),require(_0x0c3b('0x3e')));_0x5ba7f1[_0x0c3b('0x8')]('/api/mail/substatuses',require(_0x0c3b('0x3f')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x40'),require(_0x0c3b('0x41')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x42'),require(_0x0c3b('0x43')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x44'),require(_0x0c3b('0x45')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x46'),require(_0x0c3b('0x47')));_0x5ba7f1[_0x0c3b('0x8')]('/api/dashboards',require(_0x0c3b('0x48')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x49'),require(_0x0c3b('0x4a')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x4b'),require(_0x0c3b('0x4c')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x4d'),require(_0x0c3b('0x4e')));_0x5ba7f1[_0x0c3b('0x8')]('/api/fax/interactions',require(_0x0c3b('0x4f')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x50'),require(_0x0c3b('0x51')));_0x5ba7f1['use'](_0x0c3b('0x52'),require(_0x0c3b('0x53')));_0x5ba7f1[_0x0c3b('0x8')]('/api/fax/reports/queue',require(_0x0c3b('0x54')));_0x5ba7f1[_0x0c3b('0x8')]('/api/sms/accounts',require(_0x0c3b('0x55')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x56'),require('./api/smsApplication'));_0x5ba7f1['use'](_0x0c3b('0x57'),require(_0x0c3b('0x58')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x59'),require(_0x0c3b('0x5a')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x5b'),require(_0x0c3b('0x5c')));_0x5ba7f1['use'](_0x0c3b('0x5d'),require(_0x0c3b('0x5e')));_0x5ba7f1['use'](_0x0c3b('0x5f'),require(_0x0c3b('0x60')));_0x5ba7f1['use'](_0x0c3b('0x61'),require(_0x0c3b('0x62')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x63'),require(_0x0c3b('0x64')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x65'),require(_0x0c3b('0x66')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x67'),require(_0x0c3b('0x68')));_0x5ba7f1[_0x0c3b('0x8')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x69'),require(_0x0c3b('0x6a')));_0x5ba7f1[_0x0c3b('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x6b'),require(_0x0c3b('0x6c')));_0x5ba7f1[_0x0c3b('0x8')]('/api/chat/offline_messages',require(_0x0c3b('0x6d')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x6e'),require('./api/chatQueue'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x6f'),require(_0x0c3b('0x70')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x71'),require(_0x0c3b('0x72')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x73'),require(_0x0c3b('0x74')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x75'),require(_0x0c3b('0x76')));_0x5ba7f1['use'](_0x0c3b('0x77'),require('./api/cmHopper'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x78'),require(_0x0c3b('0x79')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x7a'),require(_0x0c3b('0x7b')));_0x5ba7f1['use'](_0x0c3b('0x7c'),require(_0x0c3b('0x7d')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x7e'),require(_0x0c3b('0x7f')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x80'),require('./api/action'));_0x5ba7f1[_0x0c3b('0x8')]('/api/automations',require('./api/automation'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x81'),require(_0x0c3b('0x82')));_0x5ba7f1['use'](_0x0c3b('0x83'),require(_0x0c3b('0x84')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x85'),require('./api/condition'));_0x5ba7f1[_0x0c3b('0x8')]('/api/intervals',require(_0x0c3b('0x86')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x87'),require(_0x0c3b('0x88')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x89'),require(_0x0c3b('0x8a')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x8b'),require(_0x0c3b('0x8c')));_0x5ba7f1['use'](_0x0c3b('0x8d'),require(_0x0c3b('0x8e')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x8f'),require(_0x0c3b('0x90')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x91'),require(_0x0c3b('0x92')));_0x5ba7f1['use'](_0x0c3b('0x93'),require(_0x0c3b('0x94')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x95'),require(_0x0c3b('0x96')));_0x5ba7f1['use'](_0x0c3b('0x97'),require(_0x0c3b('0x98')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x99'),require(_0x0c3b('0x9a')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x9b'),require(_0x0c3b('0x9c')));_0x5ba7f1['use'](_0x0c3b('0x9d'),require(_0x0c3b('0x9e')));_0x5ba7f1[_0x0c3b('0x8')]('/api/analytics/default_reports',require(_0x0c3b('0x9f')));_0x5ba7f1['use'](_0x0c3b('0xa0'),require(_0x0c3b('0xa1')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xa2'),require(_0x0c3b('0xa3')));_0x5ba7f1['use'](_0x0c3b('0xa4'),require('./api/analyticFieldReport'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xa5'),require(_0x0c3b('0xa6')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xa7'),require('./api/intSalesforceAccount'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xa8'),require('./api/intSalesforceConfiguration'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xa9'),require(_0x0c3b('0xaa')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xab'),require('./api/intSugarcrmAccount'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xac'),require(_0x0c3b('0xad')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xae'),require(_0x0c3b('0xaf')));_0x5ba7f1[_0x0c3b('0x8')]('/api/integrations/desk/accounts',require(_0x0c3b('0xb0')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xb1'),require(_0x0c3b('0xb2')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xb3'),require(_0x0c3b('0xb4')));_0x5ba7f1[_0x0c3b('0x8')]('/api/integrations/zoho/accounts',require(_0x0c3b('0xb5')));_0x5ba7f1[_0x0c3b('0x8')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xb6'),require('./api/intZohoField'));_0x5ba7f1['use'](_0x0c3b('0xb7'),require(_0x0c3b('0xb8')));_0x5ba7f1['use'](_0x0c3b('0xb9'),require(_0x0c3b('0xba')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xbb'),require(_0x0c3b('0xbc')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xbd'),require(_0x0c3b('0xbe')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xbf'),require(_0x0c3b('0xc0')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xc1'),require(_0x0c3b('0xc2')));_0x5ba7f1['use'](_0x0c3b('0xc3'),require(_0x0c3b('0xc4')));_0x5ba7f1['use'](_0x0c3b('0xc5'),require(_0x0c3b('0xc6')));_0x5ba7f1[_0x0c3b('0x8')]('/api/integrations/vtiger/fields',require(_0x0c3b('0xc7')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xc8'),require(_0x0c3b('0xc9')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xca'),require(_0x0c3b('0xcb')));_0x5ba7f1[_0x0c3b('0x8')]('/api/integrations/servicenow/fields',require(_0x0c3b('0xcc')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xcd'),require(_0x0c3b('0xce')));_0x5ba7f1['use'](_0x0c3b('0xcf'),require(_0x0c3b('0xd0')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xd1'),require(_0x0c3b('0xd2')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xd3'),require(_0x0c3b('0xd4')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xd5'),require('./api/intFreshsalesConfiguration'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xd6'),require(_0x0c3b('0xd7')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xd8'),require(_0x0c3b('0xd9')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xda'),require(_0x0c3b('0xdb')));_0x5ba7f1['use'](_0x0c3b('0xdc'),require(_0x0c3b('0xdd')));_0x5ba7f1['use']('/api/jscripty/answers/reports',require(_0x0c3b('0xde')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xdf'),require(_0x0c3b('0xe0')));_0x5ba7f1[_0x0c3b('0x8')]('/api/jscripty/sessions/reports',require(_0x0c3b('0xe1')));_0x5ba7f1[_0x0c3b('0x8')]('/api/sms/reports/queue',require(_0x0c3b('0xe2')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xe3'),require('./api/squareReport'));_0x5ba7f1[_0x0c3b('0x8')]('/api/square/details/reports',require(_0x0c3b('0xe4')));_0x5ba7f1['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x5ba7f1[_0x0c3b('0x8')]('/api/settings',require(_0x0c3b('0xe5')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xe6'),require(_0x0c3b('0xe7')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xe8'),require(_0x0c3b('0xe9')));_0x5ba7f1['use'](_0x0c3b('0xea'),require(_0x0c3b('0xeb')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xec'),require(_0x0c3b('0xed')));_0x5ba7f1['use'](_0x0c3b('0xee'),require(_0x0c3b('0xef')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xf0'),require(_0x0c3b('0xf1')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xf2'),require(_0x0c3b('0xf3')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xf4'),require(_0x0c3b('0xf5')));_0x5ba7f1[_0x0c3b('0x8')]('/api/attachments',require(_0x0c3b('0xf6')));_0x5ba7f1[_0x0c3b('0x8')]('/api/plugins',require(_0x0c3b('0xf7')));_0x5ba7f1['use'](_0x0c3b('0xf8'),require(_0x0c3b('0xf9')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xfa'),require('./api/chatTransferReport'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xfb'),require(_0x0c3b('0xfc')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xfd'),require(_0x0c3b('0xfe')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0xff'),require(_0x0c3b('0x100')));_0x5ba7f1[_0x0c3b('0x8')]('/api/cm/lists',require(_0x0c3b('0x101')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x102'),require(_0x0c3b('0x103')));_0x5ba7f1['use'](_0x0c3b('0x104'),require(_0x0c3b('0x105')));_0x5ba7f1['use'](_0x0c3b('0x106'),require(_0x0c3b('0x107')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x108'),require(_0x0c3b('0x109')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x10a'),require(_0x0c3b('0x10b')));_0x5ba7f1[_0x0c3b('0x8')]('/api/userNotifications',require('./api/userNotification'));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x10c'),require(_0x0c3b('0x10d')));_0x5ba7f1[_0x0c3b('0x8')]('/api/whatsapp/applications',require(_0x0c3b('0x10e')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x10f'),require(_0x0c3b('0x110')));_0x5ba7f1[_0x0c3b('0x8')]('/api/whatsapp/messages',require(_0x0c3b('0x111')));_0x5ba7f1['use'](_0x0c3b('0x112'),require(_0x0c3b('0x113')));_0x5ba7f1[_0x0c3b('0x8')]('/api/whatsapp/reports/transfer',require(_0x0c3b('0x114')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x115'),require(_0x0c3b('0x116')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x117'),require(_0x0c3b('0x118')));_0x5ba7f1[_0x0c3b('0x8')]('/api/auth/local',require(_0x0c3b('0x119')));_0x5ba7f1[_0x0c3b('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x5ba7f1[_0x0c3b('0x8')]('/api/jira',require(_0x0c3b('0x11a')));_0x5ba7f1[_0x0c3b('0x8')]('/api/rpc',require(_0x0c3b('0x11b')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x11c'),require(_0x0c3b('0x11d')));_0x5ba7f1[_0x0c3b('0x8')]('/api/system',require(_0x0c3b('0x11e')));_0x5ba7f1[_0x0c3b('0x8')]('/api/pm2',require(_0x0c3b('0x11f')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x120'),require(_0x0c3b('0x121')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x122'),express['static'](path[_0x0c3b('0x123')](config[_0x0c3b('0x124')],'/apidoc')));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x125'),express['static'](path['join'](config[_0x0c3b('0x124')],_0x0c3b('0x125'))));_0x5ba7f1['use'](_0x0c3b('0x126'),express[_0x0c3b('0x127')](path[_0x0c3b('0x123')](config['root'],_0x0c3b('0x126'))));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x128'),express[_0x0c3b('0x127')](path[_0x0c3b('0x123')](config[_0x0c3b('0x124')],_0x0c3b('0x129'),_0x0c3b('0x12a'))));_0x5ba7f1[_0x0c3b('0x8')](_0x0c3b('0x12b'),express[_0x0c3b('0x127')](path['join'](config[_0x0c3b('0x124')],_0x0c3b('0x12c'))));_0x5ba7f1[_0x0c3b('0x12d')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x5ba7f1[_0x0c3b('0x12d')]('/*')[_0x0c3b('0x12e')](function(_0x5aafd0,_0xa162c9){_0xa162c9['sendFile'](path[_0x0c3b('0x12f')](_0x5ba7f1[_0x0c3b('0x12e')](_0x0c3b('0x130'))+_0x0c3b('0x131')));});};var sensitiveFields=[_0x0c3b('0x132'),_0x0c3b('0x133'),_0x0c3b('0x134'),_0x0c3b('0x135'),_0x0c3b('0x136'),_0x0c3b('0x137'),_0x0c3b('0x138'),_0x0c3b('0x139'),'mobile','fax','email',_0x0c3b('0x13a'),_0x0c3b('0x13b'),_0x0c3b('0x13c'),_0x0c3b('0x13d'),'accessKey',_0x0c3b('0x13e'),_0x0c3b('0x13f'),_0x0c3b('0x140'),_0x0c3b('0x141'),_0x0c3b('0x142'),'authToken','consumerKey',_0x0c3b('0x143'),'membername',_0x0c3b('0x144'),_0x0c3b('0x145'),_0x0c3b('0x146'),_0x0c3b('0x147'),_0x0c3b('0x148'),'privateKey','accesskeyid',_0x0c3b('0x149'),'key','user',_0x0c3b('0x14a'),'accountSid','localstationid',_0x0c3b('0x14b'),_0x0c3b('0x14c'),_0x0c3b('0x14d'),_0x0c3b('0x14e')];function maskSensitiveData(_0x2acd89){var _0x51bb09=/(?!^)[\s\S](?!$)/g;if(!_[_0x0c3b('0x14f')](_0x2acd89))return;for(var _0x3c3244 in _0x2acd89){if(_['isArray'](_0x2acd89[_0x3c3244])){for(var _0x45557d=0x0;_0x45557d<_0x2acd89[_0x3c3244][_0x0c3b('0x150')];_0x45557d++){maskSensitiveData(_0x2acd89[_0x3c3244][_0x45557d]);}}else if(_['isPlainObject'](_0x2acd89[_0x3c3244])){maskSensitiveData(_0x2acd89[_0x3c3244]);}else if(_['isString'](_0x2acd89[_0x3c3244])){_0x2acd89[_0x3c3244]=_0x2acd89[_0x3c3244]['replace'](/{{{/g,_0x0c3b('0x151'))['replace'](/}}}/g,'}@@')[_0x0c3b('0x152')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x0c3b('0x153')](sensitiveFields,_0x3c3244)){_0x2acd89[_0x3c3244]=_0x2acd89[_0x3c3244][_0x0c3b('0x152')](_0x51bb09,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8651144..93702d7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3052=['../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.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','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc'];(function(_0xdd639f,_0x283a95){var _0x263d11=function(_0x284e21){while(--_0x284e21){_0xdd639f['push'](_0xdd639f['shift']());}};_0x263d11(++_0x283a95);}(_0x3052,0x14e));var _0x2305=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3052[_0x3947c9];return _0x2e7871;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2305('0x0'));var _=require(_0x2305('0x1'));var config=require(_0x2305('0x2'));exports[_0x2305('0x3')]=function(){return new BPromise(function(_0x1bf02f,_0x37fe8b){var _0xf78911={};_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x4')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x6')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x7')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x8')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x9')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0xa')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0xb')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0xc')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/memberReport/memberReport.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0xd')));_0xf78911=_['merge'](_0xf78911,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0xe')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0xf')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/mailAccount/mailAccount.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x10')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x11')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x12')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x13')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x14')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x15')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/faxApplication/faxApplication.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x16')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x17')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x18')));_0xf78911=_['merge'](_0xf78911,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x19')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x1a')));_0xf78911=_['merge'](_0xf78911,require('../api/smsMessage/smsMessage.rpc'));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x1b')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x1c')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x1d')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x1e')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x1f')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x20')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/chatQueue/chatQueue.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x21')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x22')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x23')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x24')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x25')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x26')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x27')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x28')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/trigger/trigger.rpc'));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x29')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x2a')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x2b')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x2c')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/intZohoAccount/intZohoAccount.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x2d')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x2e')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x2f')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x30')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x31')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x32')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x33')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x34')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x35')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x36')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require('../api/squareProject/squareProject.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x37')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x38')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x39')));_0xf78911=_['merge'](_0xf78911,require('../api/attachment/attachment.rpc'));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x3a')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x3b')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x3c')));_0xf78911=_['merge'](_0xf78911,require(_0x2305('0x3d')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x3e')));_0xf78911=_[_0x2305('0x5')](_0xf78911,require(_0x2305('0x3f')));var _0x57bc83=jayson[_0x2305('0x40')](_0xf78911)[_0x2305('0x41')]();var _0x34778c=config[_0x2305('0x42')][_0x2305('0x43')]||config[_0x2305('0x43')]+0x1;var _0x53b475=config[_0x2305('0x42')]['ip']||_0x2305('0x44');_0x57bc83['on'](_0x2305('0x45'),function(_0x4c2688){return _0x37fe8b(_0x4c2688);});_0x57bc83[_0x2305('0x3')](_0x34778c,_0x53b475,function(){console['log'](_0x2305('0x46'),_0x53b475,_0x34778c);require(_0x2305('0x47'))[_0x2305('0x48')]();return _0x1bf02f(_0x2305('0x49')+_0x53b475+':'+_0x34778c);});});}; \ No newline at end of file +var _0xa78e=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc'];(function(_0x1ff18e,_0x3c2cef){var _0x169835=function(_0x17bd4e){while(--_0x17bd4e){_0x1ff18e['push'](_0x1ff18e['shift']());}};_0x169835(++_0x3c2cef);}(_0xa78e,0x1b9));var _0xea78=function(_0x2c4c57,_0x1ff70c){_0x2c4c57=_0x2c4c57-0x0;var _0x2b24f6=_0xa78e[_0x2c4c57];return _0x2b24f6;};'use strict';var jayson=require(_0xea78('0x0'));var BPromise=require(_0xea78('0x1'));var _=require('lodash');var config=require(_0xea78('0x2'));exports[_0xea78('0x3')]=function(){return new BPromise(function(_0x2fa6c7,_0x25247f){var _0x29fab0={};_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/user/user.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x5')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/voiceQueue/voiceQueue.rpc'));_0x29fab0=_['merge'](_0x29fab0,require('../api/voiceRecording/voiceRecording.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x6')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x7')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x8')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x9')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0xa')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0xb')));_0x29fab0=_['merge'](_0x29fab0,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0xc')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0xd')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0xe')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/mailInteraction/mailInteraction.rpc'));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0xf')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x10')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x11')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x12')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x13')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x14')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x15')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x16')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x17')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/smsAccount/smsAccount.rpc'));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x18')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x19')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x1a')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x1b')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x29fab0=_['merge'](_0x29fab0,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x1c')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x1d')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x1e')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x1f')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x20')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x21')));_0x29fab0=_['merge'](_0x29fab0,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x22')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/interval/interval.rpc'));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x23')));_0x29fab0=_['merge'](_0x29fab0,require('../api/sound/sound.rpc'));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x24')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x25')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x26')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x27')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x28')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x29')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x2a')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x2b')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x2c')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x2d')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x2e')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x2f')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x30')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x31')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x32')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x33')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x34')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x35')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x36')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x37')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x38')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x39')));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x3a')));_0x29fab0=_['merge'](_0x29fab0,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x29fab0=_['merge'](_0x29fab0,require(_0xea78('0x3b')));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x29fab0=_[_0xea78('0x4')](_0x29fab0,require(_0xea78('0x3c')));var _0xe86ba7=jayson[_0xea78('0x3d')](_0x29fab0)[_0xea78('0x3e')]();var _0x4aa669=config[_0xea78('0x3f')][_0xea78('0x40')]||config['port']+0x1;var _0x479898=config[_0xea78('0x3f')]['ip']||_0xea78('0x41');_0xe86ba7['on'](_0xea78('0x42'),function(_0x264cbe){return _0x25247f(_0x264cbe);});_0xe86ba7[_0xea78('0x3')](_0x4aa669,_0x479898,function(){console['log'](_0xea78('0x43'),_0x479898,_0x4aa669);require(_0xea78('0x44'))[_0xea78('0x45')]();return _0x2fa6c7(_0xea78('0x46')+_0x479898+':'+_0x4aa669);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5c65d70..07ff51d 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedd9,0xfc));var _0x9edd=function(_0x10fa03,_0x195147){_0x10fa03=_0x10fa03-0x0;var _0x39dca4=_0xedd9[_0x10fa03];return _0x39dca4;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4380fa3..aa1e873 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 _0xcd18=['util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports'];(function(_0xc0be57,_0x2d1e96){var _0x2d786d=function(_0x5c91fc){while(--_0x5c91fc){_0xc0be57['push'](_0xc0be57['shift']());}};_0x2d786d(++_0x2d1e96);}(_0xcd18,0xb4));var _0x8cd1=function(_0x314ba5,_0x359dac){_0x314ba5=_0x314ba5-0x0;var _0x81ae10=_0xcd18[_0x314ba5];return _0x81ae10;};'use strict';var util=require(_0x8cd1('0x0'));var error={'E_AGI_UNDEFINED':_0x8cd1('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x8cd1('0x2'),'E_AGI_SERVER_CLOSE':_0x8cd1('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x8cd1('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x8cd1('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x8cd1('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8cd1('0x7'),'E_AGI_IVR_ENTRY':_0x8cd1('0x8')};function AGIError(_0x2d35e4){var _0x2d35e4=_0x2d35e4||null,_0x16eecb=_0x16eecb||[],_0x3cd29b=0x1,_0x10b229='';if(!error[_0x2d35e4]){_0x2d35e4='E_AGI_UNDEFINED';}_0x16eecb[_0x8cd1('0x9')](error[_0x2d35e4]);while(arguments[_0x3cd29b]){_0x16eecb[_0x8cd1('0x9')](arguments[_0x3cd29b]);_0x3cd29b++;}_0x10b229=util[_0x8cd1('0xa')][_0x8cd1('0xb')](util,_0x16eecb);this[_0x8cd1('0xc')]=_0x10b229;this[_0x8cd1('0xd')]=_0x2d35e4;}module[_0x8cd1('0xe')]=AGIError; \ No newline at end of file +var _0xc9b7=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x2f5049,_0x56f6bc){var _0x2e39b8=function(_0x28bffd){while(--_0x28bffd){_0x2f5049['push'](_0x2f5049['shift']());}};_0x2e39b8(++_0x56f6bc);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x517c2e,_0x3d4bf3){_0x517c2e=_0x517c2e-0x0;var _0x5d4029=_0xc9b7[_0x517c2e];return _0x5d4029;};'use strict';var util=require(_0x7c9b('0x0'));var error={'E_AGI_UNDEFINED':_0x7c9b('0x1'),'E_AGI_ARGUMENT_PORT':_0x7c9b('0x2'),'E_AGI_SERVER_ERROR':_0x7c9b('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x7c9b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7c9b('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x7c9b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7c9b('0x7'),'E_AGI_COMMAND_EMPTY':_0x7c9b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7c9b('0x9'),'E_AGI_IVR_ENTRY':_0x7c9b('0xa')};function AGIError(_0x4714e0){var _0x4714e0=_0x4714e0||null,_0xdfe4d7=_0xdfe4d7||[],_0x456555=0x1,_0x440561='';if(!error[_0x4714e0]){_0x4714e0=_0x7c9b('0xb');}_0xdfe4d7[_0x7c9b('0xc')](error[_0x4714e0]);while(arguments[_0x456555]){_0xdfe4d7[_0x7c9b('0xc')](arguments[_0x456555]);_0x456555++;}_0x440561=util[_0x7c9b('0xd')][_0x7c9b('0xe')](util,_0xdfe4d7);this[_0x7c9b('0xf')]=_0x440561;this[_0x7c9b('0x10')]=_0x4714e0;}module[_0x7c9b('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f1c9870..a43f9d5 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 _0xa5fa=['info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','agi','menu','getdigits','vertices','edges','prototype','addVertex','addEdge','numberOfEdges','getVertex','traverseBFS'];(function(_0x160509,_0x186265){var _0x16b4b4=function(_0x14207e){while(--_0x14207e){_0x160509['push'](_0x160509['shift']());}};_0x16b4b4(++_0x186265);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0xa5fa[_0x2b6235];return _0x4cee7f;};'use strict';var _=require('lodash');var logger=require(_0xaa5f('0x0'))(_0xaa5f('0x1'));var verticesWithRetry=[_0xaa5f('0x2'),_0xaa5f('0x3'),'getsecretdigits'];var Graph=function(){this[_0xaa5f('0x4')]={};this[_0xaa5f('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xaa5f('0x6')][_0xaa5f('0x7')]=function(_0x37f7bc){this[_0xaa5f('0x4')][_0x37f7bc['id']]=_0x37f7bc;this[_0xaa5f('0x5')][_0x37f7bc['id']]=[];};Graph[_0xaa5f('0x6')][_0xaa5f('0x8')]=function(_0xc326df,_0x74f64f,_0x3f550e){this[_0xaa5f('0x5')][_0xc326df]['push']({'target':_0x74f64f,'condition':_0x3f550e});this[_0xaa5f('0x9')]+=0x1;};Graph[_0xaa5f('0x6')]['size']=function(){return _['size'](this[_0xaa5f('0x4')]);};Graph['prototype']['relations']=function(){return this[_0xaa5f('0x9')];};Graph['prototype'][_0xaa5f('0xa')]=function(_0x471e14){return this[_0xaa5f('0x4')][_0x471e14];};Graph[_0xaa5f('0x6')][_0xaa5f('0xb')]=function(_0x48d1d3,_0xbd4e10){if(!this['vertices'][_0x48d1d3]){return logger[_0xaa5f('0xc')](_0xaa5f('0xd'));}var _0x31eabc=_0xbd4e10(this[_0xaa5f('0x4')][_0x48d1d3]);if(!_0x31eabc){return logger[_0xaa5f('0xc')]('stop\x20traverse');}if(this['edges'][_0x48d1d3][_0xaa5f('0xe')]===0x0){return logger[_0xaa5f('0xc')](_0xaa5f('0xf'));}for(var _0x4265ab=0x0,_0x27fdca=[],_0x1fa36a=![];_0x4265ab\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','catch','then','indexOf','agi_','substring','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','close','hangup','sync','production','debug','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','context','priority','response','code','result','toString','agicommand\x20not\x20found','finally','vertex','isUndefined','extension','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc'];(function(_0x14b762,_0x5b56c3){var _0x1a1f4c=function(_0x5a6672){while(--_0x5a6672){_0x14b762['push'](_0x14b762['shift']());}};_0x1a1f4c(++_0x5b56c3);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0xd7df('0x0'));var _=require(_0xd7df('0x1'));var syncho=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var config=require(_0xd7df('0x5'));var logger=require(_0xd7df('0x6'))(_0xd7df('0x7'));var utilLicense=require(_0xd7df('0x8'));var rpc=require(_0xd7df('0x9'));var mailRpc=require(_0xd7df('0xa'));var Graph=require(_0xd7df('0xb'));var Vertices=require(_0xd7df('0xc'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd7df('0x7')]=_[_0xd7df('0xd')](config[_0xd7df('0x7')],{'ip':_0xd7df('0xe'),'port':0x11dd});function connectionHandler(_0x5c220a){process[_0xd7df('0xf')](function(){syncho(function(){try{setChannelVariables(_0x5c220a);agiHandler(_0x5c220a);}catch(_0xb3557a){logger[_0xd7df('0x10')](_0xb3557a[_0xd7df('0x11')]);}});});}function listeningHandler(){console['log'](_0xd7df('0x12'),config['agi'][_0xd7df('0x13')]);logger['info'](util[_0xd7df('0x14')](_0xd7df('0x15'),config[_0xd7df('0x7')]['ip'],config[_0xd7df('0x7')][_0xd7df('0x13')]));}function errorHandler(_0x174c88){if(_0x174c88&&_0x174c88[_0xd7df('0x16')]&&_0x174c88[_0xd7df('0x17')]){logger[_0xd7df('0x10')](util[_0xd7df('0x14')](_0xd7df('0x18'),_0x174c88[_0xd7df('0x16')],_0x174c88[_0xd7df('0x17')]));}else{logger[_0xd7df('0x10')](util[_0xd7df('0x14')](_0xd7df('0x19'),_0x174c88[_0xd7df('0x11')]));}}function closeHandler(){logger['info'](util[_0xd7df('0x14')](_0xd7df('0x1a'),this['arg_1'],this[_0xd7df('0x1b')],this[_0xd7df('0x1c')],this['dnid'],this[_0xd7df('0x1d')]));try{createSquareReport(this);}catch(_0x30ee65){logger[_0xd7df('0x10')](_0x30ee65['stack']);}}function timeoutHandler(){logger[_0xd7df('0x1e')](util[_0xd7df('0x14')](_0xd7df('0x1f'),this['arg_1'],this[_0xd7df('0x1b')],this[_0xd7df('0x1c')],this[_0xd7df('0x20')],this['uniqueid']));}function hangupHandler(){logger[_0xd7df('0x1e')](util['format'](_0xd7df('0x21'),this['arg_1'],this[_0xd7df('0x1b')],this[_0xd7df('0x1c')],this[_0xd7df('0x20')],this['uniqueid']));this[_0xd7df('0x22')]=!![];}function getRoot(_0x502ae8){return parser[_0xd7df('0x23')](_0x502ae8,{'object':!![]})[_0xd7df('0x24')][_0xd7df('0x25')];}function addVertex(_0x29f354,_0x1c774b,_0xa80cbf){_0x1c774b[_0xd7df('0x26')]=_0xa80cbf;if(_0x1c774b['hasOwnProperty']('retry')){_0x1c774b[_0xd7df('0x27')]=parseInt(_0x1c774b[_0xd7df('0x28')],0xa);}_0x29f354[_0xd7df('0x29')](_[_0xd7df('0x2a')](_0x1c774b,_0xd7df('0x2b')));}function initGraph(_0x11a4a8,_0x373359){var _0x2b6fde=new Graph();for(var _0x163904 in _0x11a4a8){if(_0x11a4a8['hasOwnProperty'](_0x163904)){if(_[_0xd7df('0x2c')](_0x11a4a8[_0x163904])){for(var _0x132fd1=0x0;_0x132fd1<_0x11a4a8[_0x163904][_0xd7df('0x2d')];_0x132fd1+=0x1){addVertex(_0x2b6fde,_0x11a4a8[_0x163904][_0x132fd1],_0x163904);}}else{addVertex(_0x2b6fde,_0x11a4a8[_0x163904],_0x163904);}}}for(var _0x29f0e8=0x0;_0x29f0e8<_0x373359[_0xd7df('0x2d')];_0x29f0e8+=0x1){if(_0x373359[_0x29f0e8][_0xd7df('0x2e')]&&_0x373359[_0x29f0e8][_0xd7df('0x2f')]){_0x2b6fde[_0xd7df('0x30')](_0x373359[_0x29f0e8]['source'],_0x373359[_0x29f0e8]['target'],_0x373359[_0x29f0e8]['value']);}}return _0x2b6fde;}function getSquareProject(_0x58584d,_0x4fd521){rpc[_0xd7df('0x31')](_0x58584d)['then'](function(_0xd366b){_0x4fd521(null,_0xd366b);})[_0xd7df('0x32')](function(_0x503a90){_0x4fd521(null,_0x503a90);});}function createSquareReport(_0x3ef553,_0x2887db){rpc['createSquareReport'](_0x3ef553)[_0xd7df('0x33')](function(_0x4c01d9){if(_0x2887db){_0x2887db(null,_0x4c01d9);}})[_0xd7df('0x32')](function(_0x3cf290){if(_0x2887db){_0x2887db(null,_0x3cf290);}});}function setChannelVariables(_0x40f965){for(var _0x3304c4 in _0x40f965){if(_0x40f965['hasOwnProperty'](_0x3304c4)){if(_0x3304c4[_0xd7df('0x34')](_0xd7df('0x35'))===0x0){_0x40f965[_0x3304c4[_0xd7df('0x36')](0x4)]=_0x40f965[_0x3304c4];delete _0x40f965[_0x3304c4];}}}}function getLogFromObject(_0x1d81b2){return util[_0xd7df('0x37')](_0x1d81b2,{'showHidden':![],'depth':null});}function agiHandler(_0x4cecf2){var _0x141206,_0x2eb429,_0x19f43d,_0x2e689a,_0x2e828e;logger['debug']('variables',JSON[_0xd7df('0x38')](_0x4cecf2,null,0x2));logger['info'](util[_0xd7df('0x14')](_0xd7df('0x39'),_0x4cecf2[_0xd7df('0x3a')],_0x4cecf2[_0xd7df('0x1b')],_0x4cecf2['callerid'],_0x4cecf2['dnid'],_0x4cecf2['uniqueid']));_0x4cecf2['on'](_0xd7df('0x10'),errorHandler);_0x4cecf2['on'](_0xd7df('0x3b'),closeHandler);_0x4cecf2['on']('timeout',timeoutHandler);_0x4cecf2[_0xd7df('0x22')]=![];_0x4cecf2['on'](_0xd7df('0x3c'),hangupHandler);var _0x4bda0e=getSquareProject[_0xd7df('0x3d')](null,_0x4cecf2['arg_1']);if(_0x4bda0e){if(_0x4bda0e[_0xd7df('0x3e')]){_0x141206=getRoot(_0x4bda0e[_0xd7df('0x3e')]);if(_0x141206&&_0x141206['start']){logger[_0xd7df('0x3f')]('root',JSON[_0xd7df('0x38')](_0x141206,null,0x2));_0x4cecf2[_0xd7df('0x40')]=moment()[_0xd7df('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x2eb429=initGraph(_[_0xd7df('0x2a')](_0x141206,_0xd7df('0x2b')),_0x141206[_0xd7df('0x2b')]);_0x19f43d=new Vertices(_0x4cecf2,rpc,mailRpc);logger[_0xd7df('0x1e')](util['format'](_0xd7df('0x41'),_0x4cecf2[_0xd7df('0x3a')],_0x4cecf2[_0xd7df('0x1b')],_0x4cecf2['callerid'],_0x4cecf2[_0xd7df('0x20')],_0x4cecf2[_0xd7df('0x1d')]));_0x2eb429[_0xd7df('0x42')](_0x141206['start']['id'],function(_0x80019d){try{_0x80019d=_0x19f43d[_0xd7df('0x43')](_0x80019d);logger['debug']('vertex',JSON[_0xd7df('0x38')](_0x80019d,null,0x2));if(_0x80019d[_0xd7df('0x26')]===_0xd7df('0x44')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4cecf2[_0xd7df('0x45')]=_0x80019d['context']||_0x4cecf2[_0xd7df('0x45')];_0x4cecf2['extension']=_0x80019d['extension'];_0x4cecf2[_0xd7df('0x46')]=_0x80019d['priority']?_0x80019d[_0xd7df('0x46')]-0x1:0x1;return null;}else if(_0x80019d&&_0x19f43d[_0x80019d[_0xd7df('0x26')]]){_0x2e828e=_0x19f43d[_0x80019d[_0xd7df('0x26')]](_0x80019d);logger[_0xd7df('0x1e')](_0xd7df('0x47'),JSON[_0xd7df('0x38')](_0x2e828e,null,0x2));if(_0x2e828e&&_0x2e828e[_0xd7df('0x48')]===AGI_CODE_SUCCESS&&_0x2e828e[_0xd7df('0x49')]!==AGI_RESULT_ERROR&&!_0x4cecf2[_0xd7df('0x22')]){logger['debug'](_0xd7df('0x47'),getLogFromObject(_0x2e828e));return _['isUndefined'](_0x2e828e[_0xd7df('0x49')])?null:_0x2e828e[_0xd7df('0x49')][_0xd7df('0x4a')]();}else{logger[_0xd7df('0x10')](_0xd7df('0x47'),getLogFromObject(_0x2e828e));return null;}}else{logger[_0xd7df('0x10')](_0xd7df('0x4b'));return null;}}catch(_0x38056b){logger[_0xd7df('0x10')](_0x38056b['stack']);return null;}});if(_0x141206[_0xd7df('0x4c')]){logger[_0xd7df('0x1e')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cecf2[_0xd7df('0x3a')],_0x4cecf2[_0xd7df('0x1b')],_0x4cecf2[_0xd7df('0x1c')],_0x4cecf2['dnid'],_0x4cecf2['uniqueid']));_0x2eb429[_0xd7df('0x42')](_0x141206['finally']['id'],function(_0x3e9797){try{_0x3e9797=_0x19f43d[_0xd7df('0x43')](_0x3e9797);logger[_0xd7df('0x3f')](_0xd7df('0x4d'),JSON[_0xd7df('0x38')](_0x3e9797,null,0x2));if(_0x3e9797&&_0x19f43d[_0x3e9797[_0xd7df('0x26')]]){_0x2e828e=_0x19f43d[_0x3e9797[_0xd7df('0x26')]](_0x3e9797);if(_0x2e828e){logger[_0xd7df('0x3f')](_0xd7df('0x47'),getLogFromObject(_0x2e828e));return _[_0xd7df('0x4e')](_0x2e828e[_0xd7df('0x49')])?null:_0x2e828e[_0xd7df('0x49')]['toString']();}else{logger[_0xd7df('0x10')](_0xd7df('0x47'),getLogFromObject(_0x2e828e));return null;}}else{logger[_0xd7df('0x10')](_0xd7df('0x4b'));return null;}}catch(_0x215251){logger['error'](_0x215251[_0xd7df('0x11')]);return null;}});}logger[_0xd7df('0x1e')](util[_0xd7df('0x14')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cecf2[_0xd7df('0x3a')],_0x4cecf2['calleridname'],_0x4cecf2[_0xd7df('0x1c')],_0x4cecf2[_0xd7df('0x20')],_0x4cecf2[_0xd7df('0x1d')]));logger[_0xd7df('0x1e')](util[_0xd7df('0x14')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4cecf2['context'],_0x4cecf2['extension'],parseInt(_0x4cecf2[_0xd7df('0x46')],0xa)+0x1));_0x4cecf2['continueAt'](_0x4cecf2[_0xd7df('0x45')],_0x4cecf2[_0xd7df('0x4f')],parseInt(_0x4cecf2[_0xd7df('0x46')],0xa)+0x1);_0x4cecf2[_0xd7df('0x3b')]();}}else{logger[_0xd7df('0x10')](util[_0xd7df('0x14')](_0xd7df('0x50'),_0x4cecf2[_0xd7df('0x3a')]));_0x4cecf2[_0xd7df('0x51')](_0x4cecf2[_0xd7df('0x45')],_0x4cecf2[_0xd7df('0x4f')],parseInt(_0x4cecf2[_0xd7df('0x46')],0xa)+0x1);_0x4cecf2[_0xd7df('0x3b')]();}}else{logger[_0xd7df('0x10')](util[_0xd7df('0x14')](_0xd7df('0x52'),_0x4cecf2['arg_1']));_0x4cecf2[_0xd7df('0x51')](_0x4cecf2[_0xd7df('0x45')],_0x4cecf2['extension'],parseInt(_0x4cecf2['priority'],0xa)+0x1);_0x4cecf2[_0xd7df('0x3b')]();}}function main(){var _0x514e1b;return utilLicense[_0xd7df('0x53')]()['then'](function(_0x1f34c2){if(_0x1f34c2){if(_0x1f34c2[_0xd7df('0x54')]){if(_0x1f34c2[_0xd7df('0x55')]&&_0x1f34c2['callysquare']>0x0){logger['info'](util['format'](_0xd7df('0x56'),_0x1f34c2[_0xd7df('0x55')]));_0x514e1b=_0x1f34c2[_0xd7df('0x55')];}else{logger[_0xd7df('0x1e')](_0xd7df('0x57'));}}else{logger[_0xd7df('0x1e')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x514e1b=-0x1;}}})[_0xd7df('0x32')](function(_0x3570c4){logger[_0xd7df('0x10')](_0xd7df('0x58'),_0x3570c4[_0xd7df('0x11')]);})[_0xd7df('0x4c')](function(){var _0x19889a=require(_0xd7df('0x59'))(config[_0xd7df('0x7')][_0xd7df('0x13')],config[_0xd7df('0x7')]['ip'],_0x514e1b);_0x19889a['on'](_0xd7df('0x10'),errorHandler);_0x19889a['on'](_0xd7df('0x5a'),listeningHandler);_0x19889a['on'](_0xd7df('0x5b'),connectionHandler);_0x19889a['on'](_0xd7df('0x3b'),closeHandler);});}main(); \ No newline at end of file +var _0x7217=['hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','sync','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','xml2json','syncho','util','moment','../../config/environment','../../config/logger','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand'];(function(_0x20879c,_0x592349){var _0x1e2182=function(_0x18c47e){while(--_0x18c47e){_0x20879c['push'](_0x20879c['shift']());}};_0x1e2182(++_0x592349);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var parser=require(_0x7721('0x0'));var _=require('lodash');var syncho=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var config=require(_0x7721('0x4'));var logger=require(_0x7721('0x5'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0x7721('0x6'));var mailRpc=require(_0x7721('0x7'));var Graph=require(_0x7721('0x8'));var Vertices=require(_0x7721('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7721('0xa')]=_[_0x7721('0xb')](config[_0x7721('0xa')],{'ip':_0x7721('0xc'),'port':0x11dd});function connectionHandler(_0x225610){process[_0x7721('0xd')](function(){syncho(function(){try{setChannelVariables(_0x225610);agiHandler(_0x225610);}catch(_0x3e6368){logger[_0x7721('0xe')](_0x3e6368[_0x7721('0xf')]);}});});}function listeningHandler(){console[_0x7721('0x10')](_0x7721('0x11'),config['agi'][_0x7721('0x12')]);logger[_0x7721('0x13')](util[_0x7721('0x14')](_0x7721('0x15'),config[_0x7721('0xa')]['ip'],config[_0x7721('0xa')][_0x7721('0x12')]));}function errorHandler(_0x27b36b){if(_0x27b36b&&_0x27b36b['name']&&_0x27b36b[_0x7721('0x16')]){logger[_0x7721('0xe')](util['format'](_0x7721('0x17'),_0x27b36b[_0x7721('0x18')],_0x27b36b[_0x7721('0x16')]));}else{logger[_0x7721('0xe')](util['format'](_0x7721('0x19'),_0x27b36b[_0x7721('0xf')]));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7721('0x1a')],this[_0x7721('0x1b')],this[_0x7721('0x1c')],this[_0x7721('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x20f669){logger['error'](_0x20f669[_0x7721('0xf')]);}}function timeoutHandler(){logger['info'](util[_0x7721('0x14')](_0x7721('0x1e'),this[_0x7721('0x1a')],this[_0x7721('0x1b')],this[_0x7721('0x1c')],this[_0x7721('0x1d')],this[_0x7721('0x1f')]));}function hangupHandler(){logger[_0x7721('0x13')](util[_0x7721('0x14')](_0x7721('0x20'),this['arg_1'],this[_0x7721('0x1b')],this[_0x7721('0x1c')],this[_0x7721('0x1d')],this[_0x7721('0x1f')]));this['evtHangup']=!![];}function getRoot(_0x28f5a6){return parser['toJson'](_0x28f5a6,{'object':!![]})[_0x7721('0x21')][_0x7721('0x22')];}function addVertex(_0x3e8a4e,_0x1caad8,_0x121cc4){_0x1caad8[_0x7721('0x23')]=_0x121cc4;if(_0x1caad8[_0x7721('0x24')]('retry')){_0x1caad8[_0x7721('0x25')]=parseInt(_0x1caad8[_0x7721('0x26')],0xa);}_0x3e8a4e[_0x7721('0x27')](_[_0x7721('0x28')](_0x1caad8,_0x7721('0x29')));}function initGraph(_0x16355a,_0x424e05){var _0xf753f1=new Graph();for(var _0x40f367 in _0x16355a){if(_0x16355a['hasOwnProperty'](_0x40f367)){if(_[_0x7721('0x2a')](_0x16355a[_0x40f367])){for(var _0x5b0551=0x0;_0x5b0551<_0x16355a[_0x40f367]['length'];_0x5b0551+=0x1){addVertex(_0xf753f1,_0x16355a[_0x40f367][_0x5b0551],_0x40f367);}}else{addVertex(_0xf753f1,_0x16355a[_0x40f367],_0x40f367);}}}for(var _0x315202=0x0;_0x315202<_0x424e05[_0x7721('0x2b')];_0x315202+=0x1){if(_0x424e05[_0x315202][_0x7721('0x2c')]&&_0x424e05[_0x315202][_0x7721('0x2d')]){_0xf753f1[_0x7721('0x2e')](_0x424e05[_0x315202][_0x7721('0x2c')],_0x424e05[_0x315202][_0x7721('0x2d')],_0x424e05[_0x315202][_0x7721('0x2f')]);}}return _0xf753f1;}function getSquareProject(_0x5c54f0,_0x471651){rpc[_0x7721('0x30')](_0x5c54f0)['then'](function(_0x4a25c9){_0x471651(null,_0x4a25c9);})[_0x7721('0x31')](function(_0x220bbf){_0x471651(null,_0x220bbf);});}function createSquareReport(_0x48f329,_0x46f772){rpc[_0x7721('0x32')](_0x48f329)[_0x7721('0x33')](function(_0x58d54b){if(_0x46f772){_0x46f772(null,_0x58d54b);}})[_0x7721('0x31')](function(_0x1ff31b){if(_0x46f772){_0x46f772(null,_0x1ff31b);}});}function setChannelVariables(_0x1492d4){for(var _0x3f15e2 in _0x1492d4){if(_0x1492d4[_0x7721('0x24')](_0x3f15e2)){if(_0x3f15e2['indexOf'](_0x7721('0x34'))===0x0){_0x1492d4[_0x3f15e2[_0x7721('0x35')](0x4)]=_0x1492d4[_0x3f15e2];delete _0x1492d4[_0x3f15e2];}}}}function getLogFromObject(_0xb2386d){return util['inspect'](_0xb2386d,{'showHidden':![],'depth':null});}function agiHandler(_0x35de7a){var _0x213a2e,_0x498654,_0x217592,_0x5ce026,_0x2d6ba0;logger[_0x7721('0x36')](_0x7721('0x37'),JSON[_0x7721('0x38')](_0x35de7a,null,0x2));logger[_0x7721('0x13')](util[_0x7721('0x14')](_0x7721('0x39'),_0x35de7a[_0x7721('0x1a')],_0x35de7a[_0x7721('0x1b')],_0x35de7a[_0x7721('0x1c')],_0x35de7a[_0x7721('0x1d')],_0x35de7a['uniqueid']));_0x35de7a['on'](_0x7721('0xe'),errorHandler);_0x35de7a['on']('close',closeHandler);_0x35de7a['on'](_0x7721('0x3a'),timeoutHandler);_0x35de7a[_0x7721('0x3b')]=![];_0x35de7a['on'](_0x7721('0x3c'),hangupHandler);var _0x1d03de=getSquareProject[_0x7721('0x3d')](null,_0x35de7a[_0x7721('0x1a')]);if(_0x1d03de){if(_0x1d03de['production']){_0x213a2e=getRoot(_0x1d03de['production']);if(_0x213a2e&&_0x213a2e['start']){logger['debug'](_0x7721('0x22'),JSON[_0x7721('0x38')](_0x213a2e,null,0x2));_0x35de7a[_0x7721('0x3e')]=moment()[_0x7721('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x498654=initGraph(_[_0x7721('0x28')](_0x213a2e,'mxCell'),_0x213a2e[_0x7721('0x29')]);_0x217592=new Vertices(_0x35de7a,rpc,mailRpc);logger[_0x7721('0x13')](util['format'](_0x7721('0x3f'),_0x35de7a[_0x7721('0x1a')],_0x35de7a['calleridname'],_0x35de7a['callerid'],_0x35de7a[_0x7721('0x1d')],_0x35de7a[_0x7721('0x1f')]));_0x498654[_0x7721('0x40')](_0x213a2e[_0x7721('0x41')]['id'],function(_0x577af9){try{_0x577af9=_0x217592[_0x7721('0x42')](_0x577af9);logger[_0x7721('0x36')](_0x7721('0x43'),JSON[_0x7721('0x38')](_0x577af9,null,0x2));if(_0x577af9[_0x7721('0x23')]==='gotoc'){logger[_0x7721('0x13')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x35de7a[_0x7721('0x44')]=_0x577af9['context']||_0x35de7a[_0x7721('0x44')];_0x35de7a[_0x7721('0x45')]=_0x577af9[_0x7721('0x45')];_0x35de7a['priority']=_0x577af9[_0x7721('0x46')]?_0x577af9[_0x7721('0x46')]-0x1:0x1;return null;}else if(_0x577af9&&_0x217592[_0x577af9[_0x7721('0x23')]]){_0x2d6ba0=_0x217592[_0x577af9['agicommand']](_0x577af9);logger[_0x7721('0x13')](_0x7721('0x47'),JSON[_0x7721('0x38')](_0x2d6ba0,null,0x2));if(_0x2d6ba0&&_0x2d6ba0[_0x7721('0x48')]===AGI_CODE_SUCCESS&&_0x2d6ba0[_0x7721('0x49')]!==AGI_RESULT_ERROR&&!_0x35de7a[_0x7721('0x3b')]){logger[_0x7721('0x36')]('response',getLogFromObject(_0x2d6ba0));return _['isUndefined'](_0x2d6ba0[_0x7721('0x49')])?null:_0x2d6ba0[_0x7721('0x49')][_0x7721('0x4a')]();}else{logger[_0x7721('0xe')](_0x7721('0x47'),getLogFromObject(_0x2d6ba0));return null;}}else{logger[_0x7721('0xe')](_0x7721('0x4b'));return null;}}catch(_0x2966fe){logger[_0x7721('0xe')](_0x2966fe[_0x7721('0xf')]);return null;}});if(_0x213a2e['finally']){logger['info'](util[_0x7721('0x14')](_0x7721('0x4c'),_0x35de7a[_0x7721('0x1a')],_0x35de7a[_0x7721('0x1b')],_0x35de7a['callerid'],_0x35de7a[_0x7721('0x1d')],_0x35de7a[_0x7721('0x1f')]));_0x498654['traverseBFS'](_0x213a2e[_0x7721('0x4d')]['id'],function(_0x583320){try{_0x583320=_0x217592[_0x7721('0x42')](_0x583320);logger['debug'](_0x7721('0x43'),JSON[_0x7721('0x38')](_0x583320,null,0x2));if(_0x583320&&_0x217592[_0x583320[_0x7721('0x23')]]){_0x2d6ba0=_0x217592[_0x583320['agicommand']](_0x583320);if(_0x2d6ba0){logger[_0x7721('0x36')](_0x7721('0x47'),getLogFromObject(_0x2d6ba0));return _['isUndefined'](_0x2d6ba0[_0x7721('0x49')])?null:_0x2d6ba0[_0x7721('0x49')][_0x7721('0x4a')]();}else{logger['error'](_0x7721('0x47'),getLogFromObject(_0x2d6ba0));return null;}}else{logger['error'](_0x7721('0x4b'));return null;}}catch(_0x310549){logger[_0x7721('0xe')](_0x310549[_0x7721('0xf')]);return null;}});}logger[_0x7721('0x13')](util[_0x7721('0x14')](_0x7721('0x4e'),_0x35de7a[_0x7721('0x1a')],_0x35de7a[_0x7721('0x1b')],_0x35de7a[_0x7721('0x1c')],_0x35de7a[_0x7721('0x1d')],_0x35de7a[_0x7721('0x1f')]));logger[_0x7721('0x13')](util[_0x7721('0x14')](_0x7721('0x4f'),_0x35de7a['context'],_0x35de7a[_0x7721('0x45')],parseInt(_0x35de7a[_0x7721('0x46')],0xa)+0x1));_0x35de7a[_0x7721('0x50')](_0x35de7a[_0x7721('0x44')],_0x35de7a[_0x7721('0x45')],parseInt(_0x35de7a[_0x7721('0x46')],0xa)+0x1);_0x35de7a[_0x7721('0x51')]();}}else{logger['error'](util[_0x7721('0x14')](_0x7721('0x52'),_0x35de7a[_0x7721('0x1a')]));_0x35de7a[_0x7721('0x50')](_0x35de7a[_0x7721('0x44')],_0x35de7a[_0x7721('0x45')],parseInt(_0x35de7a[_0x7721('0x46')],0xa)+0x1);_0x35de7a[_0x7721('0x51')]();}}else{logger[_0x7721('0xe')](util[_0x7721('0x14')](_0x7721('0x53'),_0x35de7a['arg_1']));_0x35de7a[_0x7721('0x50')](_0x35de7a[_0x7721('0x44')],_0x35de7a[_0x7721('0x45')],parseInt(_0x35de7a[_0x7721('0x46')],0xa)+0x1);_0x35de7a[_0x7721('0x51')]();}}function main(){var _0x3e7918;return utilLicense[_0x7721('0x54')]()[_0x7721('0x33')](function(_0x360882){if(_0x360882){if(_0x360882[_0x7721('0x55')]){if(_0x360882[_0x7721('0x56')]&&_0x360882[_0x7721('0x56')]>0x0){logger[_0x7721('0x13')](util[_0x7721('0x14')](_0x7721('0x57'),_0x360882['callysquare']));_0x3e7918=_0x360882['callysquare'];}else{logger['info'](_0x7721('0x58'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3e7918=-0x1;}}})['catch'](function(_0x5d7036){logger[_0x7721('0xe')](_0x7721('0x59'),_0x5d7036[_0x7721('0xf')]);})['finally'](function(){var _0x5181d7=require('./server')(config['agi']['port'],config[_0x7721('0xa')]['ip'],_0x3e7918);_0x5181d7['on']('error',errorHandler);_0x5181d7['on']('listening',listeningHandler);_0x5181d7['on']('connection',connectionHandler);_0x5181d7['on'](_0x7721('0x51'),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 97fc8f4..59b334f 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x52050a,_0x23fac7){var _0x28e3ac=function(_0x4ed618){while(--_0x4ed618){_0x52050a['push'](_0x52050a['shift']());}};_0x28e3ac(++_0x23fac7);}(_0x814b,0x1a2));var _0xb814=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0x814b[_0x562faa];return _0xc70f59;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1f8c1d,_0x5b2236){var _0x142601=function(_0x495474){while(--_0x495474){_0x1f8c1d['push'](_0x1f8c1d['shift']());}};_0x142601(++_0x5b2236);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 59cf7d0..62a3aaa 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 _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xb10b,0x12a));var _0xbb10=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xb10b[_0x593564];return _0x211a89;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x4d3a9b,_0x20b47d){var _0x1b5471=function(_0x51bf57){while(--_0x51bf57){_0x4d3a9b['push'](_0x4d3a9b['shift']());}};_0x1b5471(++_0x20b47d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ed5e4,_0x15d7fc){_0x5ed5e4=_0x5ed5e4-0x0;var _0xcc956a=_0xb10b[_0x5ed5e4];return _0xcc956a;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 68b502f..a2b68a3 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 _0x9651=['ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','agentLogin','LoginUser','agentUnpause','agentLogout','LogoutUser','moment','util','jayson/promise','http','request','error','result','catch','getSquareProject','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById'];(function(_0x4359eb,_0x19330a){var _0x2da37e=function(_0x3a9e2d){while(--_0x3a9e2d){_0x4359eb['push'](_0x4359eb['shift']());}};_0x2da37e(++_0x19330a);}(_0x9651,0x166));var _0x1965=function(_0x1689b2,_0x3d5cbe){_0x1689b2=_0x1689b2-0x0;var _0x3c76e0=_0x9651[_0x1689b2];return _0x3c76e0;};'use strict';var BPromise=require('bluebird');var moment=require(_0x1965('0x0'));var _=require('lodash');var util=require(_0x1965('0x1'));var jayson=require(_0x1965('0x2'));var client=jayson['client'][_0x1965('0x3')]({'port':0x2329});function request(_0x3a6a6e,_0x2a0a54){return new BPromise(function(_0x3d09d3,_0x1b5701){return client[_0x1965('0x4')](_0x3a6a6e,_0x2a0a54)['then'](function(_0x1bcc80){if(_0x1bcc80[_0x1965('0x5')]){return _0x1b5701(_0x1bcc80['error']['message']);}else{return _0x3d09d3(_0x1bcc80[_0x1965('0x6')]);}})[_0x1965('0x7')](function(_0x1a27ed){return _0x1b5701(_0x1a27ed);});});}exports[_0x1965('0x8')]=function(_0x18e833){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x18e833},'attributes':['production']}});};exports['getMailAccountById']=function(_0x90b8c1){return request(_0x1965('0x9'),{'options':{'raw':![],'where':{'id':_0x90b8c1},'include':[{'model':_0x1965('0xa'),'as':_0x1965('0xb')}],'attributes':['id',_0x1965('0xc'),_0x1965('0xd')]}});};exports[_0x1965('0xe')]=function(_0x5dbe88){return request(_0x1965('0xf'),{'options':{'where':{'id':_0x5dbe88},'attributes':[_0x1965('0xc')]}});};exports['getVoiceQueueById']=function(_0x2b665f){return request(_0x1965('0x10'),{'options':{'where':{'id':_0x2b665f},'attributes':[_0x1965('0xc')]}});};exports[_0x1965('0x11')]=function(_0x516f8c){return request(_0x1965('0x12'),{'options':{'where':{'id':_0x516f8c},'attributes':[_0x1965('0xc')]}});};exports[_0x1965('0x13')]=function(_0x3c190a){return request(_0x1965('0x14'),{'options':{'where':{'id':_0x3c190a},'attributes':[_0x1965('0x15')]}});};exports[_0x1965('0x16')]=function(_0x25bea6){return request(_0x1965('0x17'),{'options':{'where':{'id':_0x25bea6},'attributes':[_0x1965('0xc')]}});};exports[_0x1965('0x18')]=function(_0x424357){return request(_0x1965('0x19'),{'options':{'where':{'id':_0x424357},'attributes':[_0x1965('0xc')]}});};exports[_0x1965('0x1a')]=function(_0x208241){return request(_0x1965('0x1b'),{'options':{'where':{'id':_0x208241},'attributes':[_0x1965('0x1c')]}});};exports[_0x1965('0x1d')]=function(_0xc9bfad){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xc9bfad},'include':[{'model':_0x1965('0x1e'),'as':_0x1965('0x1f')}]}});};exports[_0x1965('0x20')]=function(_0x31e0c0){return request(_0x1965('0x21'),{'options':{'where':{'id':_0x31e0c0},'attributes':['id',_0x1965('0xc')]}});};exports[_0x1965('0x22')]=function(_0x3c238f){return request('CreateSmsMessage',{'body':_0x3c238f});};exports[_0x1965('0x23')]=function(_0x33afb9){return request(_0x1965('0x24'),{'body':_0x33afb9});};exports['createSquareReport']=function(_0x59acc5){return request('CreateSquareReport',{'body':_['merge'](_0x59acc5,{'project_name':_0x59acc5[_0x1965('0x25')],'prev_project_name':_0x59acc5['arg_2']||'','is_subproject':_0x59acc5[_0x1965('0x26')]?!![]:![],'leaveAt':moment()[_0x1965('0x27')](_0x1965('0x28'))})});};exports[_0x1965('0x29')]=function(_0x3a3ff4){return request(_0x1965('0x2a'),{'body':_0x3a3ff4});};exports[_0x1965('0x2b')]=function(_0x50900f){return request('CreateSquareMessage',{'body':_0x50900f});};exports[_0x1965('0x2c')]=function(_0x12ddda){return request(_0x1965('0x2d'),{'options':{'raw':![],'where':{'phone':_0x12ddda[_0x1965('0x2e')],'ListId':_0x12ddda[_0x1965('0x2f')]}}})[_0x1965('0x30')](function(_0x4eaf92){if(_0x4eaf92){return _0x4eaf92;}return request(_0x1965('0x31'),{'body':_0x12ddda});});};exports['getPauseById']=function(_0x36000c){return request('ShowPause',{'options':{'where':{'id':_0x36000c},'attributes':['name']}});};exports[_0x1965('0x32')]=function(_0x5a052d,_0x63c1d6){return request(_0x1965('0x33'),{'body':{'interface':_0x63c1d6},'options':{'where':_0x5a052d}});};exports['agentPause']=function(_0x455510,_0x1f63f8,_0x271cbf){return request('PauseUser',{'body':{'type':_0x1f63f8,'uniqueid':_0x271cbf},'options':{'where':_0x455510}});};exports[_0x1965('0x34')]=function(_0x4c5bba){return request('UnpauseUser',{'body':{},'options':{'where':_0x4c5bba}});};exports[_0x1965('0x35')]=function(_0x2e4383){return request(_0x1965('0x36'),{'body':{},'options':{'where':_0x2e4383}});}; \ No newline at end of file +var _0x96db=['ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','message','catch','production','getMailAccountById'];(function(_0x400979,_0x525e5f){var _0x690b7d=function(_0x4c74f2){while(--_0x4c74f2){_0x400979['push'](_0x400979['shift']());}};_0x690b7d(++_0x525e5f);}(_0x96db,0x10b));var _0xb96d=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x96db[_0x100e36];return _0x1df0c9;};'use strict';var BPromise=require(_0xb96d('0x0'));var moment=require(_0xb96d('0x1'));var _=require(_0xb96d('0x2'));var util=require(_0xb96d('0x3'));var jayson=require(_0xb96d('0x4'));var client=jayson['client'][_0xb96d('0x5')]({'port':0x2329});function request(_0x30d038,_0x409dc4){return new BPromise(function(_0x21f541,_0x27b186){return client[_0xb96d('0x6')](_0x30d038,_0x409dc4)[_0xb96d('0x7')](function(_0x4142ff){if(_0x4142ff[_0xb96d('0x8')]){return _0x27b186(_0x4142ff[_0xb96d('0x8')][_0xb96d('0x9')]);}else{return _0x21f541(_0x4142ff['result']);}})[_0xb96d('0xa')](function(_0x54e1a5){return _0x27b186(_0x54e1a5);});});}exports['getSquareProject']=function(_0x2784f8){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2784f8},'attributes':[_0xb96d('0xb')]}});};exports[_0xb96d('0xc')]=function(_0x46c69f){return request(_0xb96d('0xd'),{'options':{'raw':![],'where':{'id':_0x46c69f},'include':[{'model':_0xb96d('0xe'),'as':_0xb96d('0xf')}],'attributes':['id',_0xb96d('0x10'),'email']}});};exports[_0xb96d('0x11')]=function(_0x47edb7){return request(_0xb96d('0x12'),{'options':{'where':{'id':_0x47edb7},'attributes':[_0xb96d('0x10')]}});};exports[_0xb96d('0x13')]=function(_0x4966be){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4966be},'attributes':[_0xb96d('0x10')]}});};exports[_0xb96d('0x14')]=function(_0x1b18f1){return request(_0xb96d('0x15'),{'options':{'where':{'id':_0x1b18f1},'attributes':[_0xb96d('0x10')]}});};exports[_0xb96d('0x16')]=function(_0x8f60ac){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x8f60ac},'attributes':[_0xb96d('0x17')]}});};exports[_0xb96d('0x18')]=function(_0x35ac38){return request(_0xb96d('0x19'),{'options':{'where':{'id':_0x35ac38},'attributes':[_0xb96d('0x10')]}});};exports[_0xb96d('0x1a')]=function(_0x1cb987){return request('ShowTrunk',{'options':{'where':{'id':_0x1cb987},'attributes':['name']}});};exports[_0xb96d('0x1b')]=function(_0x3086db){return request('ShowSound',{'options':{'where':{'id':_0x3086db},'attributes':[_0xb96d('0x1c')]}});};exports[_0xb96d('0x1d')]=function(_0x4f5420){return request(_0xb96d('0x1e'),{'options':{'raw':![],'where':{'id':_0x4f5420},'include':[{'model':_0xb96d('0x1f'),'as':'Intervals'}]}});};exports[_0xb96d('0x20')]=function(_0x1c368b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1c368b},'attributes':['id','name']}});};exports[_0xb96d('0x21')]=function(_0x5cd858){return request(_0xb96d('0x22'),{'body':_0x5cd858});};exports[_0xb96d('0x23')]=function(_0x3c59cf){return request(_0xb96d('0x24'),{'body':_0x3c59cf});};exports[_0xb96d('0x25')]=function(_0x1a8db7){return request(_0xb96d('0x26'),{'body':_[_0xb96d('0x27')](_0x1a8db7,{'project_name':_0x1a8db7[_0xb96d('0x28')],'prev_project_name':_0x1a8db7[_0xb96d('0x29')]||'','is_subproject':_0x1a8db7[_0xb96d('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xb96d('0x2a'))})});};exports['createSquareRecording']=function(_0x52d3b6){return request(_0xb96d('0x2b'),{'body':_0x52d3b6});};exports[_0xb96d('0x2c')]=function(_0x473cba){return request('CreateSquareMessage',{'body':_0x473cba});};exports[_0xb96d('0x2d')]=function(_0x5eabe3){return request(_0xb96d('0x2e'),{'options':{'raw':![],'where':{'phone':_0x5eabe3[_0xb96d('0x2f')],'ListId':_0x5eabe3['ListId']}}})[_0xb96d('0x7')](function(_0x2e049c){if(_0x2e049c){return _0x2e049c;}return request(_0xb96d('0x30'),{'body':_0x5eabe3});});};exports[_0xb96d('0x31')]=function(_0x299ce0){return request(_0xb96d('0x32'),{'options':{'where':{'id':_0x299ce0},'attributes':[_0xb96d('0x10')]}});};exports[_0xb96d('0x33')]=function(_0x26a079,_0x30f9e6){return request('LoginUser',{'body':{'interface':_0x30f9e6},'options':{'where':_0x26a079}});};exports[_0xb96d('0x34')]=function(_0x5b7b5d,_0x753ee3,_0x4e475f){return request(_0xb96d('0x35'),{'body':{'type':_0x753ee3,'uniqueid':_0x4e475f},'options':{'where':_0x5b7b5d}});};exports[_0xb96d('0x36')]=function(_0x610c4){return request('UnpauseUser',{'body':{},'options':{'where':_0x610c4}});};exports[_0xb96d('0x37')]=function(_0x21aeaa){return request('LogoutUser',{'body':{},'options':{'where':_0x21aeaa}});}; \ 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 28cfe96..311cace 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xa37e=['exports'];(function(_0x348580,_0xa49f0c){var _0x5b747f=function(_0x5dd446){while(--_0x5dd446){_0x348580['push'](_0x348580['shift']());}};_0x5b747f(++_0xa49f0c);}(_0xa37e,0x97));var _0xea37=function(_0x4cfb54,_0x488a76){_0x4cfb54=_0x4cfb54-0x0;var _0x3984be=_0xa37e[_0x4cfb54];return _0x3984be;};var polly=require('./polly');var lex=require('./lex');module[_0xea37('0x0')]={'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 73b3faa..af7ee96 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 _0xb49a=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb49a,0xfb));var _0xab49=function(_0xfcbf57,_0x4b05fd){_0xfcbf57=_0xfcbf57-0x0;var _0x1078fa=_0xb49a[_0xfcbf57];return _0x1078fa;};'use strict';var lex=require(_0xab49('0x0'));module[_0xab49('0x1')]=function(_0x217cf4,_0x1d512a,_0x8db649,_0x55d01b,_0x4387a5,_0x1d1789){return lex(_0x217cf4,_0x1d512a,_0x8db649,_0x55d01b,_0x4387a5,_0x1d1789);}; \ No newline at end of file +var _0x0e85=['./lib/api','exports'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x0e85,0x7c));var _0x50e8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0e85[_0x4b7895];return _0x264180;};'use strict';var lex=require(_0x50e8('0x0'));module[_0x50e8('0x1')]=function(_0x5a568b,_0x11a13a,_0x682d10,_0x55e515,_0x55cba3,_0x4ce6cd){return lex(_0x5a568b,_0x11a13a,_0x682d10,_0x55e515,_0x55cba3,_0x4ce6cd);}; \ 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 3bb1187..d60ac2d 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 _0xbe0c=['aws-sdk','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST'];(function(_0x69ac1a,_0xd11e5f){var _0x5d1cb0=function(_0x41173f){while(--_0x41173f){_0x69ac1a['push'](_0x69ac1a['shift']());}};_0x5d1cb0(++_0xd11e5f);}(_0xbe0c,0x1b2));var _0xcbe0=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0xbe0c[_0xf2662b];return _0x257dc7;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xcbe0('0x0'));function lexResult(_0x2e1252,_0x409a50){return new BPromise(function(_0x28d164,_0x4a72a9){_0x2e1252['postText'](_0x409a50,function(_0x49d60a,_0x3aab92){if(_0x49d60a){_0x4a72a9(_0x49d60a);}if(_0x3aab92[_0xcbe0('0x1')]){for(const _0x50d904 in _0x3aab92[_0xcbe0('0x1')]){if(_0x3aab92[_0xcbe0('0x1')][_0xcbe0('0x2')](_0x50d904)){var _0x7f27ea=_0x3aab92[_0xcbe0('0x1')][_0x50d904];_0x3aab92[_0xcbe0('0x3')+_0x50d904]=_0x7f27ea;}}}_0x28d164(_0x3aab92);});});}module[_0xcbe0('0x4')]=function(_0x277fdb,_0x8cc259,_0x262a3c,_0x20850d,_0x3201a1,_0x243d40){var _0x557b6f=new AWS[(_0xcbe0('0x5'))]({'accessKeyId':_0x8cc259,'secretAccessKey':_0x262a3c,'region':_0x20850d});var _0x2ea4ce={'botAlias':_0xcbe0('0x6'),'botName':_0x243d40,'inputText':_0x3201a1,'userId':_0x277fdb};return lexResult(_0x557b6f,_0x2ea4ce);}; \ No newline at end of file +var _0x6689=['exports','$LATEST','bluebird','aws-sdk','postText','slots','slot_'];(function(_0x570dab,_0x2a0b4e){var _0x2a2f95=function(_0x60f47){while(--_0x60f47){_0x570dab['push'](_0x570dab['shift']());}};_0x2a2f95(++_0x2a0b4e);}(_0x6689,0xb1));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x9668('0x0'));var AWS=require(_0x9668('0x1'));function lexResult(_0x2b34a5,_0x367268){return new BPromise(function(_0x1e45fa,_0x19faa7){_0x2b34a5[_0x9668('0x2')](_0x367268,function(_0x834565,_0x12565f){if(_0x834565){_0x19faa7(_0x834565);}if(_0x12565f[_0x9668('0x3')]){for(const _0x5847fd in _0x12565f[_0x9668('0x3')]){if(_0x12565f[_0x9668('0x3')]['hasOwnProperty'](_0x5847fd)){var _0x802759=_0x12565f[_0x9668('0x3')][_0x5847fd];_0x12565f[_0x9668('0x4')+_0x5847fd]=_0x802759;}}}_0x1e45fa(_0x12565f);});});}module[_0x9668('0x5')]=function(_0x19327d,_0x414989,_0x5e9ba0,_0x3c35ea,_0x4043ce,_0x5839c0){var _0x140c86=new AWS['LexRuntime']({'accessKeyId':_0x414989,'secretAccessKey':_0x5e9ba0,'region':_0x3c35ea});var _0x2538d3={'botAlias':_0x9668('0x6'),'botName':_0x5839c0,'inputText':_0x4043ce,'userId':_0x19327d};return lexResult(_0x140c86,_0x2538d3);}; \ 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 84b4313..8d6a969 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 _0xbd3e=['./lib/api','exports'];(function(_0x2ed6ae,_0x4f257d){var _0x2461a0=function(_0x29a292){while(--_0x29a292){_0x2ed6ae['push'](_0x2ed6ae['shift']());}};_0x2461a0(++_0x4f257d);}(_0xbd3e,0x1a6));var _0xebd3=function(_0xaff2de,_0x43b044){_0xaff2de=_0xaff2de-0x0;var _0x3d3472=_0xbd3e[_0xaff2de];return _0x3d3472;};'use strict';var polly=require(_0xebd3('0x0'));module[_0xebd3('0x1')]=function(_0x28719d,_0x226b6b,_0x529a73,_0x1d0329,_0x2a6e0c,_0x499c75,_0x55e9c1){return polly(_0x28719d,_0x226b6b,_0x529a73,_0x1d0329,_0x2a6e0c,_0x499c75,_0x55e9c1);}; \ No newline at end of file +var _0x027f=['./lib/api','exports'];(function(_0x37dc1d,_0xbf91ef){var _0x4ac931=function(_0x1a45dd){while(--_0x1a45dd){_0x37dc1d['push'](_0x37dc1d['shift']());}};_0x4ac931(++_0xbf91ef);}(_0x027f,0x14a));var _0xf027=function(_0x4884ba,_0x476151){_0x4884ba=_0x4884ba-0x0;var _0x53bef4=_0x027f[_0x4884ba];return _0x53bef4;};'use strict';var polly=require(_0xf027('0x0'));module[_0xf027('0x1')]=function(_0x3f387e,_0xe906f5,_0x19d24d,_0x29ce89,_0x22d123,_0x336c55,_0x15c9dc){return polly(_0x3f387e,_0xe906f5,_0x19d24d,_0x29ce89,_0x22d123,_0x336c55,_0x15c9dc);}; \ 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 8d35d7a..869a315 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 _0xc86b=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird'];(function(_0x1ad46a,_0x2ca566){var _0x383f84=function(_0x221ca6){while(--_0x221ca6){_0x1ad46a['push'](_0x1ad46a['shift']());}};_0x383f84(++_0x2ca566);}(_0xc86b,0x8d));var _0xbc86=function(_0x3869f6,_0x2ea2d5){_0x3869f6=_0x3869f6-0x0;var _0x536687=_0xc86b[_0x3869f6];return _0x536687;};'use strict';var fs=require('fs');var path=require(_0xbc86('0x0'));var BPromise=require(_0xbc86('0x1'));var rs=require(_0xbc86('0x2'));var AWS=require(_0xbc86('0x3'));function pollyResult(_0x348c88,_0x37232f,_0x27b93f){return new BPromise(function(_0x110782,_0x3d2016){_0x348c88[_0xbc86('0x4')](_0x37232f,function(_0x4989aa,_0x7714c3){if(_0x4989aa){_0x3d2016(_0x4989aa);}else if(_0x7714c3){if(_0x7714c3[_0xbc86('0x5')]instanceof Buffer){fs[_0xbc86('0x6')](_0x27b93f,_0x7714c3[_0xbc86('0x5')],function(_0x4a8e4e){if(_0x4a8e4e){_0x3d2016(_0x4a8e4e);}else{_0x110782();}});}else{_0x3d2016(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3d2016(new Error(_0xbc86('0x7')));}});});}module[_0xbc86('0x8')]=function(_0x4c857b,_0x226877,_0x43df43,_0x3df6a6,_0xca736b,_0x19d5be,_0x14bb86){var _0x333ce9=new AWS[(_0xbc86('0x9'))]({'accessKeyId':_0x4c857b,'secretAccessKey':_0x226877,'region':_0x43df43});var _0x9beeb5={'Text':_0xca736b,'TextType':_0x19d5be||_0xbc86('0xa'),'OutputFormat':'mp3','VoiceId':_0x3df6a6};return pollyResult(_0x333ce9,_0x9beeb5,_0x14bb86);}; \ No newline at end of file +var _0x6c69=['path','bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','mp3'];(function(_0x49ff8f,_0x24cd5d){var _0x55a2a2=function(_0x595bfc){while(--_0x595bfc){_0x49ff8f['push'](_0x49ff8f['shift']());}};_0x55a2a2(++_0x24cd5d);}(_0x6c69,0x1ef));var _0x96c6=function(_0x3488e1,_0x5bcc18){_0x3488e1=_0x3488e1-0x0;var _0x4845ac=_0x6c69[_0x3488e1];return _0x4845ac;};'use strict';var fs=require('fs');var path=require(_0x96c6('0x0'));var BPromise=require(_0x96c6('0x1'));var rs=require('randomstring');var AWS=require(_0x96c6('0x2'));function pollyResult(_0x128cc3,_0x45e996,_0x38b8b5){return new BPromise(function(_0x89e1a0,_0x18d608){_0x128cc3[_0x96c6('0x3')](_0x45e996,function(_0x2da1a9,_0x2acdbe){if(_0x2da1a9){_0x18d608(_0x2da1a9);}else if(_0x2acdbe){if(_0x2acdbe['AudioStream']instanceof Buffer){fs[_0x96c6('0x4')](_0x38b8b5,_0x2acdbe[_0x96c6('0x5')],function(_0x58f77c){if(_0x58f77c){_0x18d608(_0x58f77c);}else{_0x89e1a0();}});}else{_0x18d608(new Error(_0x96c6('0x6')));}}else{_0x18d608(new Error(_0x96c6('0x7')));}});});}module['exports']=function(_0x482c1f,_0x4903ae,_0x477e32,_0x1786ea,_0x3e0b95,_0x3cad04,_0x162672){var _0x19e6b5=new AWS['Polly']({'accessKeyId':_0x482c1f,'secretAccessKey':_0x4903ae,'region':_0x477e32});var _0x5b7ece={'Text':_0x3e0b95,'TextType':_0x3cad04||'text','OutputFormat':_0x96c6('0x8'),'VoiceId':_0x1786ea};return pollyResult(_0x19e6b5,_0x5b7ece,_0x162672);}; \ 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 7eeb623..cf2c6b2 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 _0xd03d=['exports'];(function(_0x3633fe,_0x1d7a15){var _0x4f1abd=function(_0x4c4b60){while(--_0x4c4b60){_0x3633fe['push'](_0x3633fe['shift']());}};_0x4f1abd(++_0x1d7a15);}(_0xd03d,0x185));var _0xdd03=function(_0x2206dd,_0x49d175){_0x2206dd=_0x2206dd-0x0;var _0x19c409=_0xd03d[_0x2206dd];return _0x19c409;};'use strict';var asr=require('./lib/api');module[_0xdd03('0x0')]=function(_0x2f2b8b,_0x418cc8,_0x2e6786,_0x5ab02e){return asr(_0x2f2b8b,_0x418cc8,_0x2e6786);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x2197fe,_0x3a9e73,_0x569cc0,_0x58d48f){return asr(_0x2197fe,_0x3a9e73,_0x569cc0);}; \ 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 6aae839..f8856e7 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 _0x000c=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64'];(function(_0x1b366a,_0x52e5ac){var _0xc683a5=function(_0x173f48){while(--_0x173f48){_0x1b366a['push'](_0x1b366a['shift']());}};_0xc683a5(++_0x52e5ac);}(_0x000c,0xac));var _0xc000=function(_0x355ea8,_0x4284e1){_0x355ea8=_0x355ea8-0x0;var _0x58f9ef=_0x000c[_0x355ea8];return _0x58f9ef;};'use strict';var url=require(_0xc000('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xc000('0x1')]=function(_0x55cbc7,_0x429355,_0x4d1b35){return new BPromise(function(_0xf324f8,_0x10dff9){var _0x5de9b0;if(typeof _0x55cbc7!==_0xc000('0x2')||_0x55cbc7['length']===0x0){return _0x10dff9(_0xc000('0x3'));}if(typeof _0x429355!==_0xc000('0x2')||_0x429355[_0xc000('0x4')]===0x0){return _0x10dff9(_0xc000('0x5'));}if(typeof _0x4d1b35!==_0xc000('0x6')&&(typeof _0x4d1b35!=='string'||_0x4d1b35[_0xc000('0x4')]===0x0)){return _0x10dff9(_0xc000('0x7'));}try{_0x5de9b0=fs['readFileSync'](_0x55cbc7)[_0xc000('0x8')](_0xc000('0x9'));}catch(_0x42d31b){return _0x10dff9(_0x42d31b);}return _0xf324f8({'method':_0xc000('0xa'),'uri':host+_0xc000('0xb')+_0x429355,'body':{'config':{'encoding':_0xc000('0xc'),'sampleRateHertz':_0xc000('0xd'),'languageCode':_0x4d1b35},'audio':{'content':_0x5de9b0}},'json':!![]});});}; \ No newline at end of file +var _0x9eb6=['bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9eb6,0x1ef));var _0x69eb=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x9eb6[_0x1d2bbb];return _0x38082b;};'use strict';var url=require('url');var BPromise=require(_0x69eb('0x0'));var fs=require('fs');var host=_0x69eb('0x1');module[_0x69eb('0x2')]=function(_0x9b57bc,_0x25129f,_0xa9a136){return new BPromise(function(_0x29f5bc,_0x4aa98f){var _0x129d59;if(typeof _0x9b57bc!==_0x69eb('0x3')||_0x9b57bc['length']===0x0){return _0x4aa98f(_0x69eb('0x4'));}if(typeof _0x25129f!=='string'||_0x25129f[_0x69eb('0x5')]===0x0){return _0x4aa98f(_0x69eb('0x6'));}if(typeof _0xa9a136!==_0x69eb('0x7')&&(typeof _0xa9a136!==_0x69eb('0x3')||_0xa9a136[_0x69eb('0x5')]===0x0)){return _0x4aa98f(_0x69eb('0x8'));}try{_0x129d59=fs[_0x69eb('0x9')](_0x9b57bc)['toString'](_0x69eb('0xa'));}catch(_0x441b73){return _0x4aa98f(_0x441b73);}return _0x29f5bc({'method':_0x69eb('0xb'),'uri':host+_0x69eb('0xc')+_0x25129f,'body':{'config':{'encoding':_0x69eb('0xd'),'sampleRateHertz':_0x69eb('0xe'),'languageCode':_0xa9a136},'audio':{'content':_0x129d59}},'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 b3907e0..538885e 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 _0xe651=['exports','./asr'];(function(_0x15ccc9,_0x13b74c){var _0x48467f=function(_0x33995b){while(--_0x33995b){_0x15ccc9['push'](_0x15ccc9['shift']());}};_0x48467f(++_0x13b74c);}(_0xe651,0x1a5));var _0x1e65=function(_0x19cee7,_0x562ecb){_0x19cee7=_0x19cee7-0x0;var _0x45657b=_0xe651[_0x19cee7];return _0x45657b;};var asr=require(_0x1e65('0x0'));module[_0x1e65('0x1')]={'asr':asr}; \ No newline at end of file +var _0x98e5=['./asr'];(function(_0x10f5c8,_0xc98ea3){var _0x20de63=function(_0x58f0e5){while(--_0x58f0e5){_0x10f5c8['push'](_0x10f5c8['shift']());}};_0x20de63(++_0xc98ea3);}(_0x98e5,0xa1));var _0x598e=function(_0xdd9f41,_0x23cdfa){_0xdd9f41=_0xdd9f41-0x0;var _0xa6425c=_0x98e5[_0xdd9f41];return _0xa6425c;};var asr=require(_0x598e('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 93bb0ac..61cc963 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 _0x6d9a=['length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','result','resolvedQuery','actionIncomplete','fulfillment','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','google-tts-api','util','./aws','./google','./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','protocol','get','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','from','base64','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','generic'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x6d9a,0x1d2));var _0xa6d9=function(_0x1de57b,_0x2efea1){_0x1de57b=_0x1de57b-0x0;var _0x8f6db7=_0x6d9a[_0x1de57b];return _0x8f6db7;};'use strict';var apiai=require(_0xa6d9('0x0'));var BPromise=require(_0xa6d9('0x1'));var dialogflow=require(_0xa6d9('0x2'));var fs=require('fs');var http=require(_0xa6d9('0x3'));var https=require(_0xa6d9('0x4'));var md5=require(_0xa6d9('0x5'));var path=require(_0xa6d9('0x6'));var querystring=require('querystring');var rp=require(_0xa6d9('0x7'));var rs=require(_0xa6d9('0x8'));var sox=require('sox');var tts=require(_0xa6d9('0x9'));var urlParse=require('url')['parse'];var util=require(_0xa6d9('0xa'));var aws=require(_0xa6d9('0xb'));var google=require(_0xa6d9('0xc'));var sestek=require('./sestek');var tilde=require(_0xa6d9('0xd'));var logger=require(_0xa6d9('0xe'))(_0xa6d9('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xe184dc,_0x3f1fde){return new BPromise(function(_0x244629,_0x4385da){var _0x19949b=urlParse(_0xe184dc);var _0x43da62=_0x19949b['protocol']===_0xa6d9('0x10')?https:http;var _0xa27fbc={'host':_0x19949b[_0xa6d9('0x11')],'path':_0x19949b[_0xa6d9('0x6')],'headers':{'user-agent':_0xa6d9('0x12')}};_0x43da62['get'](_0xa27fbc,function(_0x65a8fc){if(_0x65a8fc[_0xa6d9('0x13')]!==0xc8){logger[_0xa6d9('0x14')](_0xa6d9('0x15')+_0xe184dc+_0xa6d9('0x16')+_0x65a8fc[_0xa6d9('0x13')]+'\x20('+_0x65a8fc[_0xa6d9('0x17')]+')');_0x4385da(new Error('request\x20to\x20'+_0xe184dc+_0xa6d9('0x16')+_0x65a8fc[_0xa6d9('0x13')]+'\x20('+_0x65a8fc[_0xa6d9('0x17')]+')'));return;}var _0x2f3678=fs[_0xa6d9('0x18')](_0x3f1fde);_0x2f3678['on'](_0xa6d9('0x19'),function(){logger[_0xa6d9('0x1a')]('finish\x20download\x20file');_0x2f3678[_0xa6d9('0x1b')](_0x244629);});_0x2f3678['on']('error',function(_0x3579cf){fs[_0xa6d9('0x1c')](_0x3f1fde);logger[_0xa6d9('0x14')](_0xa6d9('0x1d'),_0x3579cf);_0x4385da(_0x3579cf);});_0x65a8fc[_0xa6d9('0x1e')](_0x2f3678);})['on']('error',function(_0x2161ba){logger[_0xa6d9('0x14')](_0x2161ba);_0x4385da(_0x2161ba);})[_0xa6d9('0x1f')]();});}function uploadFile(_0x3594ca){return new BPromise(function(_0x8b2bc0,_0x4e1da9){var _0x2d5879=urlParse(_0x3594ca);var _0x5a7616=_0x2d5879[_0xa6d9('0x20')]===_0xa6d9('0x10')?https:http;var _0x5c6a6f={'host':_0x2d5879['host'],'path':_0x2d5879[_0xa6d9('0x6')],'headers':{'user-agent':_0xa6d9('0x12')}};_0x5a7616[_0xa6d9('0x21')](_0x5c6a6f,function(_0x3fdcdb){if(_0x3fdcdb[_0xa6d9('0x13')]!==0xc8){_0x4e1da9(new Error(_0xa6d9('0x15')+_0x3594ca+_0xa6d9('0x16')+_0x3fdcdb[_0xa6d9('0x13')]+'\x20('+_0x3fdcdb['statusMessage']+')'));return;}var _0x15c247='';_0x3fdcdb['on'](_0xa6d9('0x22'),function(_0x354820){_0x15c247+=_0x354820;});_0x3fdcdb['on']('end',function(){_0x8b2bc0(_0x15c247);});})['on']('error',function(_0x15070c){_0x4e1da9(_0x15070c);})['end']();});}function convertFile(_0x15eaae,_0x8d166){return new BPromise(function(_0x5cf417,_0x43d677){var _0x55764c=sox['transcode'](_0x15eaae,_0x8d166,{'sampleRate':0x1f40,'format':_0xa6d9('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55764c['on'](_0xa6d9('0x14'),function(_0x3059ad){logger[_0xa6d9('0x14')](_0xa6d9('0x24'),_0x3059ad);_0x43d677(_0x3059ad);});_0x55764c['on'](_0xa6d9('0x1f'),function(){logger['info'](_0xa6d9('0x25'));_0x5cf417();});_0x55764c[_0xa6d9('0x26')]();});}function base64Decode(_0x408c54,_0x5cc1c2){var _0x3b3a5b=path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x2a'));fs[_0xa6d9('0x2b')](_0x3b3a5b,_0x408c54,'base64');return convertFile(_0x3b3a5b,_0x5cc1c2)[_0xa6d9('0x2c')](function(){try{fs[_0xa6d9('0x1c')](_0x3b3a5b);fs[_0xa6d9('0x2d')](_0x5cc1c2,_0xa6d9('0x2e'));}catch(_0xac2e15){logger[_0xa6d9('0x14')](_0xac2e15);}return _0x5cc1c2['split']('.')[0x0];});}function base64Encode(_0x255c43){var _0x180dd5=fs[_0xa6d9('0x2f')](_0x255c43);return new Buffer(_0x180dd5)[_0xa6d9('0x30')]('base64');}exports[_0xa6d9('0x31')]=function(_0x5f3ad7,_0x301c15,_0x36389a,_0x281765,_0x1d92ff,_0xeda9cc){var _0x28674f,_0x7b10cb;var _0x2576d9=_0xa6d9('0x32');var _0x486494=_0xa6d9('0x33')+_0x5f3ad7;var _0x28b1af={};if(_0x301c15===_0xa6d9('0x34')){_0x28b1af[_0xa6d9('0x35')]={'ssml':_0x36389a};}else{_0x28b1af['input']={'text':_0x36389a};};_0x28b1af[_0xa6d9('0x36')]={'languageCode':_0x281765,'ssmlGender':_0x1d92ff};_0x28b1af[_0xa6d9('0x37')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x185628={'url':_0x2576d9+_0xa6d9('0x38')+_0x486494,'method':_0xa6d9('0x39'),'json':!![],'body':_0x28b1af};return rp(_0x185628)[_0xa6d9('0x2c')](function(_0x4f371b){return new BPromise(function(_0x8c3331,_0x531480){_0x28674f=path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs['generate'](0x4)+'.mp3');var _0x123ca7=Buffer[_0xa6d9('0x3a')](_0x4f371b['audioContent'],_0xa6d9('0x3b'));return fs[_0xa6d9('0x3c')](_0x28674f,_0x123ca7,function(_0xc7bfac){_0x531480(_0xc7bfac);},function(_0x28c55a){fs[_0xa6d9('0x2d')](_0x28674f,_0xa6d9('0x2e'));_0x8c3331(_0x28c55a);});});})[_0xa6d9('0x2c')](function(_0x21f111){_0x7b10cb=path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x2a'));return convertFile(_0x28674f,_0x7b10cb);})['then'](function(){try{fs[_0xa6d9('0x1c')](_0x28674f);fs[_0xa6d9('0x2d')](_0x7b10cb,_0xa6d9('0x2e'));}catch(_0x6a0c22){logger['error'](_0x6a0c22);}logger['info'](_0xa6d9('0x3d'),_0x7b10cb[_0xa6d9('0x3e')]('.')[0x0]);return _0x7b10cb[_0xa6d9('0x3e')]('.')[0x0];});};exports[_0xa6d9('0x3f')]=function(_0x100d13,_0x4485ee){var _0x5ebd5f=_0xa6d9('0x40');var _0x1cc894,_0x157f1e;var _0x5614ca;var _0x1b7c62={'encoding':_0xa6d9('0x41'),'method':_0xa6d9('0x39'),'timeout':0x2710,'url':_0x5ebd5f,'headers':{'Content-Type':_0xa6d9('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0xa6d9('0x43')]([[[_0xa6d9('0x44'),JSON[_0xa6d9('0x43')]([_0x100d13,_0x4485ee||'en',![],'null']),null,_0xa6d9('0x45')]]]))};return rp(_0x1b7c62)[_0xa6d9('0x2c')](function(_0x53231d){try{_0x5614ca=eval(_0x53231d['slice'](0x5))[0x0][0x2];}catch(_0x526c0e){throw new Error('parse\x20response\x20failed:\x0a'+_0x53231d[_0xa6d9('0x22')]);}if(!_0x5614ca){if(_0x100d13[_0xa6d9('0x46')]>0xc8){throw new Error(_0xa6d9('0x47'));}else{throw new Error(_0xa6d9('0x48')+_0x4485ee+_0xa6d9('0x49'));}}try{_0x5614ca=eval(_0x5614ca)[0x0];}catch(_0x4888c6){throw new Error(_0xa6d9('0x4a')+res['data']);}const _0x4bed9b=_0x5614ca;_0x1cc894=path[_0xa6d9('0x27')](__dirname,'tmp',rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x4b'));fs[_0xa6d9('0x2b')](_0x1cc894,_0x5614ca,{'encoding':_0xa6d9('0x3b')});_0x157f1e=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xa6d9('0x2a'));return convertFile(_0x1cc894,_0x157f1e);})[_0xa6d9('0x2c')](function(){try{fs[_0xa6d9('0x1c')](_0x1cc894);fs[_0xa6d9('0x2d')](_0x157f1e,'777');}catch(_0x4f5ccb){logger['error'](_0x4f5ccb);}logger[_0xa6d9('0x1a')](_0xa6d9('0x4c'),_0x157f1e[_0xa6d9('0x3e')]('.')[0x0]);return _0x157f1e[_0xa6d9('0x3e')]('.')[0x0];});};exports[_0xa6d9('0x4d')]=function(_0x394a83,_0x499e20,_0x4a5a48){return google[_0xa6d9('0x4e')](_0x394a83,_0x499e20,_0x4a5a48)['then'](function(_0x23535e){logger['info'](_0x23535e[_0xa6d9('0x4f')]);return rp(_0x23535e);})[_0xa6d9('0x2c')](function(_0x3f7cae){var _0x3d3e09='';var _0x1078a1=0x0;try{fs[_0xa6d9('0x1c')](_0x394a83);}catch(_0x290088){logger[_0xa6d9('0x14')](_0x290088);}if(_0x3f7cae&&_0x3f7cae[_0xa6d9('0x50')]){_0x3d3e09=_0x3f7cae['results'][_0xa6d9('0x51')](function(_0x5e499c){return _0x5e499c&&_0x5e499c['alternatives'][0x0]&&_0x5e499c[_0xa6d9('0x52')][0x0][_0xa6d9('0x53')]?_0x5e499c[_0xa6d9('0x52')][0x0][_0xa6d9('0x53')]:'';})[_0xa6d9('0x54')]('\x0a');_0x1078a1=_0x3f7cae[_0xa6d9('0x50')][_0xa6d9('0x51')](function(_0x3095db){return _0x3095db&&_0x3095db[_0xa6d9('0x52')][0x0]&&_0x3095db[_0xa6d9('0x52')][0x0][_0xa6d9('0x55')]?_0x3095db['alternatives'][0x0][_0xa6d9('0x55')]:0x0;})[_0xa6d9('0x54')]('\x0a');}logger[_0xa6d9('0x1a')]('googleASR\x20transcription',_0x3d3e09);logger[_0xa6d9('0x1a')](_0xa6d9('0x56'),_0x1078a1);return{'transcript':_0x3d3e09,'confidence':_0x1078a1};})[_0xa6d9('0x57')](function(_0xdea4c6){logger[_0xa6d9('0x14')](_0xa6d9('0x58'),_0xdea4c6['statusCode'],_0xdea4c6[_0xa6d9('0x59')],_0xdea4c6['message']);});};exports[_0xa6d9('0x5a')]=function(_0x10f2d3,_0x58f875,_0x2f6c01,_0xd12631){var _0x1bb1e7=apiai(_0x58f875,{'language':_0xd12631||'en'});return _0x1bb1e7['textRequest'](_0x2f6c01,{'sessionId':md5(_0x10f2d3)})[_0xa6d9('0x2c')](function(_0x46eabd){logger[_0xa6d9('0x1a')](JSON['stringify'](_0x46eabd));return{'source':_0x46eabd[_0xa6d9('0x5b')]['source'],'resolvedQuery':_0x46eabd['result'][_0xa6d9('0x5c')],'action':_0x46eabd[_0xa6d9('0x5b')]['action'],'actionIncomplete':_0x46eabd[_0xa6d9('0x5b')][_0xa6d9('0x5d')],'speech':_0x46eabd['result'][_0xa6d9('0x5e')]['speech'],'score':_0x46eabd[_0xa6d9('0x5b')]['score'],'statusCode':_0x46eabd[_0xa6d9('0x5f')]['code'],'endConversation':_0x46eabd[_0xa6d9('0x5b')][_0xa6d9('0x60')][_0xa6d9('0x61')]||![],'isFallbackIntent':_0x46eabd['result'][_0xa6d9('0x60')]['isFallbackIntent']};});};exports[_0xa6d9('0x62')]=function(_0x5098a7,_0x144055,_0x264df4,_0x714050,_0x5713df,_0x5a09df){var _0x1e650c=_0x714050[_0xa6d9('0x63')](/\\n/g,'\x0a');var _0x1722ec={'credentials':{'private_key':_0x1e650c,'client_email':_0x264df4}};var _0x444640=new dialogflow[(_0xa6d9('0x64'))](_0x1722ec);var _0x1232d8=_0x444640[_0xa6d9('0x65')](_0x144055,md5(_0x5098a7));var _0x4ffcf6={'session':_0x1232d8,'queryInput':{'text':{'text':_0x5713df,'languageCode':_0x5a09df}}};return _0x444640[_0xa6d9('0x66')](_0x4ffcf6)[_0xa6d9('0x2c')](function(_0xa7f40a){if(_0xa7f40a&&_0xa7f40a['length']){logger[_0xa6d9('0x1a')](_0xa6d9('0x67'),JSON[_0xa6d9('0x43')](_0xa7f40a));var _0x29895b=_0xa7f40a[0x0];if(_0x29895b){var _0x52ed08={'action':_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x69')],'allRequiredParamsPresent':_0x29895b['queryResult'][_0xa6d9('0x6a')],'endConversation':_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x6b')]&&_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x6b')][_0xa6d9('0x6c')]?_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x6b')]['fields'][_0xa6d9('0x6d')]['boolValue']:![],'fulfillmentText':_0x29895b['queryResult'][_0xa6d9('0x6e')],'intentName':_0x29895b[_0xa6d9('0x68')]['intent'][_0xa6d9('0x59')],'intentDisplayName':_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x6f')][_0xa6d9('0x70')],'isFallbackIntent':_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x6f')][_0xa6d9('0x71')],'languageCode':_0x29895b['queryResult']['languageCode'],'queryText':_0x29895b[_0xa6d9('0x68')]['queryText'],'responseId':_0x29895b[_0xa6d9('0x72')],'score':_0x29895b[_0xa6d9('0x68')][_0xa6d9('0x73')],'speech':_0x29895b[_0xa6d9('0x68')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0xa7f40a)};return _0x52ed08;}}});};exports['tildeASR']=function(_0x4051c5,_0x299964,_0xc97e0e,_0x39f448){return tilde[_0xa6d9('0x4e')](_0x4051c5,_0x299964,_0xc97e0e,_0x39f448)[_0xa6d9('0x2c')](function(_0x55a7df){try{fs[_0xa6d9('0x1c')](_0x4051c5);}catch(_0x26136b){logger[_0xa6d9('0x14')](_0x26136b);}logger[_0xa6d9('0x1a')](_0xa6d9('0x74'),_0x55a7df[_0xa6d9('0x53')]);logger['info'](_0xa6d9('0x75'),_0x55a7df[_0xa6d9('0x55')]);return _0x55a7df;});};exports['awsPolly']=function(_0x1abf08,_0x5d204e,_0x5b26aa,_0x1eae17,_0x32e581,_0x59e056){var _0x112113=path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x4b'));var _0x5c449c;return aws['polly'](_0x1abf08,_0x5d204e,_0x5b26aa,_0x1eae17,_0x32e581,_0x59e056,_0x112113)[_0xa6d9('0x2c')](function(){_0x5c449c=path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x2a'));return convertFile(_0x112113,_0x5c449c);})[_0xa6d9('0x2c')](function(){try{fs[_0xa6d9('0x1c')](_0x112113);fs[_0xa6d9('0x2d')](_0x5c449c,'777');}catch(_0x2d4c60){logger[_0xa6d9('0x14')](_0x2d4c60);}return _0x5c449c[_0xa6d9('0x3e')]('.')[0x0];});};exports[_0xa6d9('0x76')]=function(_0x2f7441,_0x501121,_0x361790,_0x2aa073,_0x24710c,_0x146939){return aws['lex'](_0x2f7441,_0x501121,_0x361790,_0x2aa073,_0x24710c,_0x146939)['then'](function(_0x43dc22){logger[_0xa6d9('0x1a')](JSON[_0xa6d9('0x43')](_0x43dc22));return _0x43dc22;});};exports[_0xa6d9('0x77')]=function(_0x651318,_0x9857dd,_0xa99526,_0x46b726){var _0x28b099=util['format'](_0xa6d9('0x78'),ISPEECH_API,_0x651318,encodeURIComponent(_0x9857dd),_0xa99526,_0x46b726);var _0x35ca57=path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x4b'));var _0x2547ba;return downloadFile(_0x28b099,_0x35ca57)[_0xa6d9('0x2c')](function(){_0x2547ba=path['resolve'](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+_0xa6d9('0x2a'));return convertFile(_0x35ca57,_0x2547ba);})['then'](function(){try{fs[_0xa6d9('0x1c')](_0x35ca57);fs[_0xa6d9('0x2d')](_0x2547ba,'777');}catch(_0x3905a4){logger['error'](_0x3905a4);}return _0x2547ba['split']('.')[0x0];});};exports[_0xa6d9('0x79')]=function(_0x2b8730,_0x2916da,_0x3e2da9,_0x129891){var _0x495891=util[_0xa6d9('0x7a')](_0xa6d9('0x7b'),ISPEECH_API,_0x2916da,_0x3e2da9,base64Encode(_0x2b8730),_0x129891?util['format'](_0xa6d9('0x7c'),encodeURIComponent(_0x129891)):_0xa6d9('0x7d'));return uploadFile(_0x495891)['then'](function(_0x381722){return querystring[_0xa6d9('0x7e')](_0x381722);});};exports['sestekNDA']=function(_0x505d73,_0x1c9ed4){return sestek[_0xa6d9('0x7f')](_0x505d73,_0x1c9ed4)[_0xa6d9('0x2c')](function(_0x477b9c){logger[_0xa6d9('0x1a')](JSON[_0xa6d9('0x43')](_0x477b9c));var _0x230031={'speech':_0x477b9c[_0xa6d9('0x80')],'action':_0x477b9c[_0xa6d9('0x81')]?_0x477b9c['channelData'][_0xa6d9('0x82')]:undefined,'actiondata':_0x477b9c['channelData']?_0x477b9c[_0xa6d9('0x81')]['CustomActionData']:undefined};if(_0x477b9c[_0xa6d9('0x81')]&&_0x477b9c['channelData'][_0xa6d9('0x83')]){return base64Decode(_0x477b9c[_0xa6d9('0x81')][_0xa6d9('0x83')][_0xa6d9('0x84')],path[_0xa6d9('0x27')](__dirname,_0xa6d9('0x28'),rs[_0xa6d9('0x29')](0x4)+'.wav'))['then'](function(_0x45a2b4){_0x230031['audiofile']=_0x45a2b4;return _0x230031;});}return _0x230031;});};exports[_0xa6d9('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x66e0=['protocol','https:','host','path','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','end','WHAT_EVER','data','transcode','wav','error\x20convert','resolve','tmp','generate','.wav','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','writeFile','unlink','split','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','md5','sox','google-tts-api','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x66e0,0x103));var _0x066e=function(_0x5998ce,_0x1488da){_0x5998ce=_0x5998ce-0x0;var _0x33cf7c=_0x66e0[_0x5998ce];return _0x33cf7c;};'use strict';var apiai=require(_0x066e('0x0'));var BPromise=require(_0x066e('0x1'));var dialogflow=require(_0x066e('0x2'));var fs=require('fs');var http=require(_0x066e('0x3'));var https=require('https');var md5=require(_0x066e('0x4'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x066e('0x5'));var tts=require(_0x066e('0x6'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x066e('0x7'));var google=require(_0x066e('0x8'));var sestek=require(_0x066e('0x9'));var tilde=require(_0x066e('0xa'));var logger=require(_0x066e('0xb'))('agi');var ISPEECH_API=_0x066e('0xc');function downloadFile(_0x2b1685,_0x4d0a90){return new BPromise(function(_0x2e6acf,_0x132dcd){var _0x593fce=urlParse(_0x2b1685);var _0x4c4daa=_0x593fce[_0x066e('0xd')]===_0x066e('0xe')?https:http;var _0x524c9b={'host':_0x593fce[_0x066e('0xf')],'path':_0x593fce[_0x066e('0x10')],'headers':{'user-agent':'WHAT_EVER'}};_0x4c4daa[_0x066e('0x11')](_0x524c9b,function(_0x5f3192){if(_0x5f3192[_0x066e('0x12')]!==0xc8){logger['error'](_0x066e('0x13')+_0x2b1685+_0x066e('0x14')+_0x5f3192[_0x066e('0x12')]+'\x20('+_0x5f3192[_0x066e('0x15')]+')');_0x132dcd(new Error(_0x066e('0x13')+_0x2b1685+_0x066e('0x14')+_0x5f3192[_0x066e('0x12')]+'\x20('+_0x5f3192[_0x066e('0x15')]+')'));return;}var _0x2ae879=fs[_0x066e('0x16')](_0x4d0a90);_0x2ae879['on'](_0x066e('0x17'),function(){logger[_0x066e('0x18')](_0x066e('0x19'));_0x2ae879['close'](_0x2e6acf);});_0x2ae879['on'](_0x066e('0x1a'),function(_0x45a7f4){fs['unlink'](_0x4d0a90);logger['error'](_0x066e('0x1b'),_0x45a7f4);_0x132dcd(_0x45a7f4);});_0x5f3192['pipe'](_0x2ae879);})['on'](_0x066e('0x1a'),function(_0x113080){logger[_0x066e('0x1a')](_0x113080);_0x132dcd(_0x113080);})[_0x066e('0x1c')]();});}function uploadFile(_0x58371d){return new BPromise(function(_0x29d169,_0x59d3f1){var _0x24c2ea=urlParse(_0x58371d);var _0x5b7eb3=_0x24c2ea[_0x066e('0xd')]===_0x066e('0xe')?https:http;var _0x93d1d9={'host':_0x24c2ea[_0x066e('0xf')],'path':_0x24c2ea[_0x066e('0x10')],'headers':{'user-agent':_0x066e('0x1d')}};_0x5b7eb3[_0x066e('0x11')](_0x93d1d9,function(_0x447b8f){if(_0x447b8f[_0x066e('0x12')]!==0xc8){_0x59d3f1(new Error(_0x066e('0x13')+_0x58371d+_0x066e('0x14')+_0x447b8f[_0x066e('0x12')]+'\x20('+_0x447b8f[_0x066e('0x15')]+')'));return;}var _0x1c04dd='';_0x447b8f['on'](_0x066e('0x1e'),function(_0x2e6f7f){_0x1c04dd+=_0x2e6f7f;});_0x447b8f['on'](_0x066e('0x1c'),function(){_0x29d169(_0x1c04dd);});})['on'](_0x066e('0x1a'),function(_0x5926b4){_0x59d3f1(_0x5926b4);})[_0x066e('0x1c')]();});}function convertFile(_0x1c73da,_0x3f77e1){return new BPromise(function(_0x59120c,_0x4ceaa5){var _0x2b797e=sox[_0x066e('0x1f')](_0x1c73da,_0x3f77e1,{'sampleRate':0x1f40,'format':_0x066e('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b797e['on'](_0x066e('0x1a'),function(_0x3bb5ed){logger[_0x066e('0x1a')](_0x066e('0x21'),_0x3bb5ed);_0x4ceaa5(_0x3bb5ed);});_0x2b797e['on']('end',function(){logger[_0x066e('0x18')]('finish\x20to\x20convert');_0x59120c();});_0x2b797e['start']();});}function base64Decode(_0x37895c,_0x55e34d){var _0x7f4660=path[_0x066e('0x22')](__dirname,_0x066e('0x23'),rs[_0x066e('0x24')](0x4)+_0x066e('0x25'));fs['writeFileSync'](_0x7f4660,_0x37895c,_0x066e('0x26'));return convertFile(_0x7f4660,_0x55e34d)[_0x066e('0x27')](function(){try{fs['unlink'](_0x7f4660);fs[_0x066e('0x28')](_0x55e34d,_0x066e('0x29'));}catch(_0x44c81f){logger[_0x066e('0x1a')](_0x44c81f);}return _0x55e34d['split']('.')[0x0];});}function base64Encode(_0x5cf467){var _0x21b950=fs[_0x066e('0x2a')](_0x5cf467);return new Buffer(_0x21b950)[_0x066e('0x2b')](_0x066e('0x26'));}exports[_0x066e('0x2c')]=function(_0x441686,_0x2b42f1,_0x4c52b9,_0x2c07a1,_0x109fc6,_0x2b4140){var _0xe4da9e,_0x49ad8b;var _0x5b91bb=_0x066e('0x2d');var _0x296194=_0x066e('0x2e')+_0x441686;var _0x5cc445={};if(_0x2b42f1===_0x066e('0x2f')){_0x5cc445[_0x066e('0x30')]={'ssml':_0x4c52b9};}else{_0x5cc445[_0x066e('0x30')]={'text':_0x4c52b9};};_0x5cc445[_0x066e('0x31')]={'languageCode':_0x2c07a1,'ssmlGender':_0x109fc6};_0x5cc445[_0x066e('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x21e621={'url':_0x5b91bb+_0x066e('0x33')+_0x296194,'method':_0x066e('0x34'),'json':!![],'body':_0x5cc445};return rp(_0x21e621)[_0x066e('0x27')](function(_0xe5de6f){return new BPromise(function(_0x3b6e7c,_0x786297){_0xe4da9e=path[_0x066e('0x22')](__dirname,'tmp',rs[_0x066e('0x24')](0x4)+'.mp3');var _0x23b992=Buffer['from'](_0xe5de6f['audioContent'],_0x066e('0x26'));return fs[_0x066e('0x35')](_0xe4da9e,_0x23b992,function(_0x10dc84){_0x786297(_0x10dc84);},function(_0x11bcae){fs['chmodSync'](_0xe4da9e,'777');_0x3b6e7c(_0x11bcae);});});})[_0x066e('0x27')](function(_0x5281d9){_0x49ad8b=path[_0x066e('0x22')](__dirname,_0x066e('0x23'),rs[_0x066e('0x24')](0x4)+'.wav');return convertFile(_0xe4da9e,_0x49ad8b);})[_0x066e('0x27')](function(){try{fs[_0x066e('0x36')](_0xe4da9e);fs[_0x066e('0x28')](_0x49ad8b,_0x066e('0x29'));}catch(_0x158b0f){logger['error'](_0x158b0f);}logger[_0x066e('0x18')]('googleCloudTTS\x20path',_0x49ad8b['split']('.')[0x0]);return _0x49ad8b[_0x066e('0x37')]('.')[0x0];});};exports[_0x066e('0x38')]=function(_0x1e0b83,_0x4f8537){var _0x1cceb0='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x555edb,_0x523ce4;var _0x4b2df6;var _0x5e67ee={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x1cceb0,'headers':{'Content-Type':_0x066e('0x39')},'body':_0x066e('0x3a')+encodeURIComponent(JSON[_0x066e('0x3b')]([[[_0x066e('0x3c'),JSON[_0x066e('0x3b')]([_0x1e0b83,_0x4f8537||'en',![],_0x066e('0x3d')]),null,_0x066e('0x3e')]]]))};return rp(_0x5e67ee)['then'](function(_0x41a0af){try{_0x4b2df6=eval(_0x41a0af[_0x066e('0x3f')](0x5))[0x0][0x2];}catch(_0x3a1ff9){throw new Error('parse\x20response\x20failed:\x0a'+_0x41a0af[_0x066e('0x1e')]);}if(!_0x4b2df6){if(_0x1e0b83[_0x066e('0x40')]>0xc8){throw new Error(_0x066e('0x41'));}else{throw new Error(_0x066e('0x42')+_0x4f8537+_0x066e('0x43'));}}try{_0x4b2df6=eval(_0x4b2df6)[0x0];}catch(_0x356c7f){throw new Error(_0x066e('0x44')+res[_0x066e('0x1e')]);}const _0x1664b8=_0x4b2df6;_0x555edb=path[_0x066e('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0x066e('0x45'));fs['writeFileSync'](_0x555edb,_0x4b2df6,{'encoding':_0x066e('0x26')});_0x523ce4=path[_0x066e('0x22')](__dirname,'tmp',rs[_0x066e('0x24')](0x4)+_0x066e('0x25'));return convertFile(_0x555edb,_0x523ce4);})[_0x066e('0x27')](function(){try{fs[_0x066e('0x36')](_0x555edb);fs['chmodSync'](_0x523ce4,'777');}catch(_0x2dea70){logger[_0x066e('0x1a')](_0x2dea70);}logger['info'](_0x066e('0x46'),_0x523ce4[_0x066e('0x37')]('.')[0x0]);return _0x523ce4['split']('.')[0x0];});};exports[_0x066e('0x47')]=function(_0x428864,_0x597505,_0x184af8){return google[_0x066e('0x48')](_0x428864,_0x597505,_0x184af8)[_0x066e('0x27')](function(_0x54a294){logger['info'](_0x54a294[_0x066e('0x49')]);return rp(_0x54a294);})[_0x066e('0x27')](function(_0x242137){var _0x20cc88='';var _0x1dacc6=0x0;try{fs['unlink'](_0x428864);}catch(_0x4d8a52){logger[_0x066e('0x1a')](_0x4d8a52);}if(_0x242137&&_0x242137['results']){_0x20cc88=_0x242137[_0x066e('0x4a')]['map'](function(_0x3ba2be){return _0x3ba2be&&_0x3ba2be[_0x066e('0x4b')][0x0]&&_0x3ba2be[_0x066e('0x4b')][0x0][_0x066e('0x4c')]?_0x3ba2be[_0x066e('0x4b')][0x0][_0x066e('0x4c')]:'';})[_0x066e('0x4d')]('\x0a');_0x1dacc6=_0x242137['results'][_0x066e('0x4e')](function(_0x310082){return _0x310082&&_0x310082[_0x066e('0x4b')][0x0]&&_0x310082['alternatives'][0x0][_0x066e('0x4f')]?_0x310082[_0x066e('0x4b')][0x0][_0x066e('0x4f')]:0x0;})[_0x066e('0x4d')]('\x0a');}logger['info'](_0x066e('0x50'),_0x20cc88);logger['info'](_0x066e('0x51'),_0x1dacc6);return{'transcript':_0x20cc88,'confidence':_0x1dacc6};})[_0x066e('0x52')](function(_0x3ec89c){logger[_0x066e('0x1a')](_0x066e('0x53'),_0x3ec89c['statusCode'],_0x3ec89c['name'],_0x3ec89c[_0x066e('0x54')]);});};exports[_0x066e('0x55')]=function(_0x2e1f5a,_0x53fa0d,_0x5751ea,_0x4c4abf){var _0x2fea41=apiai(_0x53fa0d,{'language':_0x4c4abf||'en'});return _0x2fea41[_0x066e('0x56')](_0x5751ea,{'sessionId':md5(_0x2e1f5a)})['then'](function(_0x46625c){logger['info'](JSON[_0x066e('0x3b')](_0x46625c));return{'source':_0x46625c[_0x066e('0x57')][_0x066e('0x58')],'resolvedQuery':_0x46625c[_0x066e('0x57')][_0x066e('0x59')],'action':_0x46625c[_0x066e('0x57')]['action'],'actionIncomplete':_0x46625c['result']['actionIncomplete'],'speech':_0x46625c[_0x066e('0x57')]['fulfillment']['speech'],'score':_0x46625c[_0x066e('0x57')]['score'],'statusCode':_0x46625c[_0x066e('0x5a')][_0x066e('0x5b')],'endConversation':_0x46625c[_0x066e('0x57')][_0x066e('0x5c')][_0x066e('0x5d')]||![],'isFallbackIntent':_0x46625c[_0x066e('0x57')][_0x066e('0x5c')][_0x066e('0x5e')]};});};exports[_0x066e('0x5f')]=function(_0x25c4c0,_0x28a0aa,_0x230aab,_0x2251ab,_0x595e01,_0x24b73b){var _0x34cd5d=_0x2251ab[_0x066e('0x60')](/\\n/g,'\x0a');var _0x2e74d0={'credentials':{'private_key':_0x34cd5d,'client_email':_0x230aab}};var _0xfc7659=new dialogflow[(_0x066e('0x61'))](_0x2e74d0);var _0x45f6ab=_0xfc7659[_0x066e('0x62')](_0x28a0aa,md5(_0x25c4c0));var _0x329c85={'session':_0x45f6ab,'queryInput':{'text':{'text':_0x595e01,'languageCode':_0x24b73b}}};return _0xfc7659[_0x066e('0x63')](_0x329c85)[_0x066e('0x27')](function(_0x4635d5){if(_0x4635d5&&_0x4635d5[_0x066e('0x40')]){logger[_0x066e('0x18')](_0x066e('0x64'),JSON['stringify'](_0x4635d5));var _0x4a2747=_0x4635d5[0x0];if(_0x4a2747){var _0x44e03f={'action':_0x4a2747['queryResult'][_0x066e('0x65')],'allRequiredParamsPresent':_0x4a2747[_0x066e('0x66')][_0x066e('0x67')],'endConversation':_0x4a2747[_0x066e('0x66')][_0x066e('0x68')]&&_0x4a2747['queryResult'][_0x066e('0x68')][_0x066e('0x69')]?_0x4a2747[_0x066e('0x66')][_0x066e('0x68')][_0x066e('0x69')][_0x066e('0x6a')][_0x066e('0x6b')]:![],'fulfillmentText':_0x4a2747['queryResult']['fulfillmentText'],'intentName':_0x4a2747[_0x066e('0x66')][_0x066e('0x6c')]['name'],'intentDisplayName':_0x4a2747[_0x066e('0x66')][_0x066e('0x6c')]['displayName'],'isFallbackIntent':_0x4a2747[_0x066e('0x66')][_0x066e('0x6c')]['isFallback'],'languageCode':_0x4a2747[_0x066e('0x66')][_0x066e('0x6d')],'queryText':_0x4a2747['queryResult'][_0x066e('0x6e')],'responseId':_0x4a2747[_0x066e('0x6f')],'score':_0x4a2747[_0x066e('0x66')][_0x066e('0x70')],'speech':_0x4a2747[_0x066e('0x66')][_0x066e('0x71')],'providerResponse':JSON[_0x066e('0x3b')](_0x4635d5)};return _0x44e03f;}}});};exports[_0x066e('0x72')]=function(_0x4a8d32,_0x3c1f99,_0x5e3292,_0x14c309){return tilde[_0x066e('0x48')](_0x4a8d32,_0x3c1f99,_0x5e3292,_0x14c309)[_0x066e('0x27')](function(_0x90c6e0){try{fs['unlink'](_0x4a8d32);}catch(_0x4ba10a){logger[_0x066e('0x1a')](_0x4ba10a);}logger[_0x066e('0x18')](_0x066e('0x73'),_0x90c6e0['transcript']);logger[_0x066e('0x18')](_0x066e('0x74'),_0x90c6e0[_0x066e('0x4f')]);return _0x90c6e0;});};exports['awsPolly']=function(_0x29be4b,_0x518244,_0x807202,_0x35cfed,_0x875937,_0x2afa50){var _0x3dea86=path[_0x066e('0x22')](__dirname,'tmp',rs[_0x066e('0x24')](0x4)+_0x066e('0x45'));var _0x16bd36;return aws[_0x066e('0x75')](_0x29be4b,_0x518244,_0x807202,_0x35cfed,_0x875937,_0x2afa50,_0x3dea86)['then'](function(){_0x16bd36=path[_0x066e('0x22')](__dirname,'tmp',rs[_0x066e('0x24')](0x4)+'.wav');return convertFile(_0x3dea86,_0x16bd36);})[_0x066e('0x27')](function(){try{fs[_0x066e('0x36')](_0x3dea86);fs[_0x066e('0x28')](_0x16bd36,'777');}catch(_0x581973){logger[_0x066e('0x1a')](_0x581973);}return _0x16bd36[_0x066e('0x37')]('.')[0x0];});};exports[_0x066e('0x76')]=function(_0x47d2b3,_0x2194f4,_0x206892,_0x3c539e,_0x34395b,_0x422e07){return aws[_0x066e('0x77')](_0x47d2b3,_0x2194f4,_0x206892,_0x3c539e,_0x34395b,_0x422e07)[_0x066e('0x27')](function(_0x5ca2f4){logger[_0x066e('0x18')](JSON[_0x066e('0x3b')](_0x5ca2f4));return _0x5ca2f4;});};exports[_0x066e('0x78')]=function(_0x43a04f,_0x83a5ca,_0x359166,_0x36cdff){var _0x11d7a2=util['format'](_0x066e('0x79'),ISPEECH_API,_0x43a04f,encodeURIComponent(_0x83a5ca),_0x359166,_0x36cdff);var _0xe30d9b=path[_0x066e('0x22')](__dirname,'tmp',rs[_0x066e('0x24')](0x4)+_0x066e('0x45'));var _0x542d14;return downloadFile(_0x11d7a2,_0xe30d9b)[_0x066e('0x27')](function(){_0x542d14=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x066e('0x25'));return convertFile(_0xe30d9b,_0x542d14);})[_0x066e('0x27')](function(){try{fs['unlink'](_0xe30d9b);fs[_0x066e('0x28')](_0x542d14,_0x066e('0x29'));}catch(_0x43bb4f){logger['error'](_0x43bb4f);}return _0x542d14['split']('.')[0x0];});};exports[_0x066e('0x7a')]=function(_0x1394ed,_0x5b8ffe,_0x5f4a34,_0x2d8a90){var _0x6f6b61=util[_0x066e('0x7b')](_0x066e('0x7c'),ISPEECH_API,_0x5b8ffe,_0x5f4a34,base64Encode(_0x1394ed),_0x2d8a90?util[_0x066e('0x7b')](_0x066e('0x7d'),encodeURIComponent(_0x2d8a90)):'freeform=3');return uploadFile(_0x6f6b61)[_0x066e('0x27')](function(_0x5845e8){return querystring[_0x066e('0x7e')](_0x5845e8);});};exports[_0x066e('0x7f')]=function(_0xf6e8b5,_0x1fcce6){return sestek[_0x066e('0x80')](_0xf6e8b5,_0x1fcce6)[_0x066e('0x27')](function(_0x4007b5){logger['info'](JSON[_0x066e('0x3b')](_0x4007b5));var _0x3263d6={'speech':_0x4007b5[_0x066e('0x81')],'action':_0x4007b5[_0x066e('0x82')]?_0x4007b5[_0x066e('0x82')][_0x066e('0x83')]:undefined,'actiondata':_0x4007b5[_0x066e('0x82')]?_0x4007b5[_0x066e('0x82')][_0x066e('0x84')]:undefined};if(_0x4007b5[_0x066e('0x82')]&&_0x4007b5[_0x066e('0x82')][_0x066e('0x85')]){return base64Decode(_0x4007b5[_0x066e('0x82')][_0x066e('0x85')][_0x066e('0x86')],path[_0x066e('0x22')](__dirname,_0x066e('0x23'),rs[_0x066e('0x24')](0x4)+_0x066e('0x25')))[_0x066e('0x27')](function(_0x3a5ecd){_0x3263d6[_0x066e('0x87')]=_0x3a5ecd;return _0x3263d6;});}return _0x3263d6;});};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 02ab1f5..a0bb5ec 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 _0xde99=['exports','./nda'];(function(_0x2f5bf7,_0x428282){var _0x42128a=function(_0x15bdba){while(--_0x15bdba){_0x2f5bf7['push'](_0x2f5bf7['shift']());}};_0x42128a(++_0x428282);}(_0xde99,0xa7));var _0x9de9=function(_0x1a9d7b,_0x1fc191){_0x1a9d7b=_0x1a9d7b-0x0;var _0x23c002=_0xde99[_0x1a9d7b];return _0x23c002;};var nda=require(_0x9de9('0x0'));module[_0x9de9('0x1')]={'nda':nda}; \ No newline at end of file +var _0xb302=['exports','./nda'];(function(_0x260862,_0x219290){var _0x115f6=function(_0x29e772){while(--_0x29e772){_0x260862['push'](_0x260862['shift']());}};_0x115f6(++_0x219290);}(_0xb302,0xb5));var _0x2b30=function(_0x1e7739,_0x2299ba){_0x1e7739=_0x1e7739-0x0;var _0x228a07=_0xb302[_0x1e7739];return _0x228a07;};var nda=require(_0x2b30('0x0'));module[_0x2b30('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 c913436..f4e36d5 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 _0xf2d3=['extension','text','Bearer\x20','access_token','project','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','body','CustomActionData','stringify','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','dnid'];(function(_0x13c7d9,_0x559240){var _0x17c1e9=function(_0x3fb9c4){while(--_0x3fb9c4){_0x13c7d9['push'](_0x13c7d9['shift']());}};_0x17c1e9(++_0x559240);}(_0xf2d3,0x1a3));var _0x3f2d=function(_0xa052dc,_0x36b503){_0xa052dc=_0xa052dc-0x0;var _0x3b2f51=_0xf2d3[_0xa052dc];return _0x3b2f51;};'use strict';var rp=require('request-promise');var url=require(_0x3f2d('0x0'));var logger=require(_0x3f2d('0x1'))(_0x3f2d('0x2'));module[_0x3f2d('0x3')]=function(_0x37044b,_0x5860e6){var _0x397ee3={'method':_0x3f2d('0x4'),'uri':url['resolve'](_0x5860e6[_0x3f2d('0x5')],_0x3f2d('0x6')),'form':{'grant_type':'password','username':_0x5860e6[_0x3f2d('0x7')],'password':_0x5860e6[_0x3f2d('0x8')]},'json':!![]};return rp(_0x397ee3)['then'](function(_0x2d58f4){var _0x137d8a={'method':_0x3f2d('0x4'),'uri':url['resolve'](_0x5860e6[_0x3f2d('0x9')],_0x3f2d('0xa')),'body':{'type':_0x5860e6[_0x3f2d('0xb')]||_0x3f2d('0xc'),'channelId':_0x3f2d('0xd'),'conversation':{'id':_0x37044b['uniqueid']},'from':{'id':_0x37044b[_0x3f2d('0xe')],'name':_0x37044b['calleridname']},'recipient':{'id':_0x37044b[_0x3f2d('0xf')],'name':_0x37044b[_0x3f2d('0x10')]},'text':_0x5860e6[_0x3f2d('0x11')],'channelData':{}},'headers':{'Authorization':_0x3f2d('0x12')+_0x2d58f4[_0x3f2d('0x13')]},'json':!![]};if(_0x5860e6[_0x3f2d('0x14')]){_0x137d8a['body'][_0x3f2d('0x15')]['ProjectName']=_0x5860e6['project'];}if(_0x5860e6[_0x3f2d('0x16')]=='1'){_0x137d8a['body'][_0x3f2d('0x15')][_0x3f2d('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3f2d('0x18')};}if(_0x5860e6['custom_action']){_0x137d8a['body'][_0x3f2d('0x15')][_0x3f2d('0x19')]=_0x5860e6['custom_action'];if(_0x5860e6['custom_action_data']){_0x137d8a[_0x3f2d('0x1a')]['channelData'][_0x3f2d('0x1b')]=_0x5860e6['custom_action_data'];}}logger['info'](JSON[_0x3f2d('0x1c')](_0x137d8a));return rp(_0x137d8a);});}; \ No newline at end of file +var _0x9a9b=['project','channelData','ProjectName','ndagenerate_audio','body','audio/wav','custom_action','CustomAction','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token'];(function(_0x24c7ef,_0x67765f){var _0x59b897=function(_0x22f0a6){while(--_0x22f0a6){_0x24c7ef['push'](_0x24c7ef['shift']());}};_0x59b897(++_0x67765f);}(_0x9a9b,0xf1));var _0xb9a9=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x9a9b[_0x19159a];return _0xa677f4;};'use strict';var rp=require(_0xb9a9('0x0'));var url=require(_0xb9a9('0x1'));var logger=require(_0xb9a9('0x2'))('agi');module[_0xb9a9('0x3')]=function(_0x721e25,_0x155a60){var _0x209740={'method':_0xb9a9('0x4'),'uri':url[_0xb9a9('0x5')](_0x155a60[_0xb9a9('0x6')],'/token'),'form':{'grant_type':_0xb9a9('0x7'),'username':_0x155a60['username'],'password':_0x155a60['password']},'json':!![]};return rp(_0x209740)[_0xb9a9('0x8')](function(_0x2bb8cc){var _0x164b41={'method':_0xb9a9('0x4'),'uri':url[_0xb9a9('0x5')](_0x155a60[_0xb9a9('0x9')],_0xb9a9('0xa')),'body':{'type':_0x155a60['ndaactivity_type']||_0xb9a9('0xb'),'channelId':_0xb9a9('0xc'),'conversation':{'id':_0x721e25[_0xb9a9('0xd')]},'from':{'id':_0x721e25[_0xb9a9('0xe')],'name':_0x721e25[_0xb9a9('0xf')]},'recipient':{'id':_0x721e25[_0xb9a9('0x10')],'name':_0x721e25[_0xb9a9('0x11')]},'text':_0x155a60['text'],'channelData':{}},'headers':{'Authorization':_0xb9a9('0x12')+_0x2bb8cc[_0xb9a9('0x13')]},'json':!![]};if(_0x155a60[_0xb9a9('0x14')]){_0x164b41['body'][_0xb9a9('0x15')][_0xb9a9('0x16')]=_0x155a60[_0xb9a9('0x14')];}if(_0x155a60[_0xb9a9('0x17')]=='1'){_0x164b41[_0xb9a9('0x18')][_0xb9a9('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb9a9('0x19')};}if(_0x155a60[_0xb9a9('0x1a')]){_0x164b41[_0xb9a9('0x18')][_0xb9a9('0x15')][_0xb9a9('0x1b')]=_0x155a60['custom_action'];if(_0x155a60['custom_action_data']){_0x164b41[_0xb9a9('0x18')][_0xb9a9('0x15')]['CustomActionData']=_0x155a60['custom_action_data'];}}logger['info'](JSON[_0xb9a9('0x1c')](_0x164b41));return rp(_0x164b41);});}; \ 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 3aa1918..30e86bb 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 _0xbebc=['exports','./lib/api'];(function(_0x4a4bc9,_0xd8cbdb){var _0x3589ca=function(_0x11e401){while(--_0x11e401){_0x4a4bc9['push'](_0x4a4bc9['shift']());}};_0x3589ca(++_0xd8cbdb);}(_0xbebc,0x17f));var _0xcbeb=function(_0x36de74,_0x42a465){_0x36de74=_0x36de74-0x0;var _0x1cb3bd=_0xbebc[_0x36de74];return _0x1cb3bd;};'use strict';var asr=require(_0xcbeb('0x0'));module[_0xcbeb('0x1')]=function(_0x4bc75b,_0x5307d4,_0x3b3830,_0x3f385e){return asr(_0x4bc75b,_0x5307d4,_0x3b3830,_0x3f385e);}; \ No newline at end of file +var _0x3e6d=['exports'];(function(_0x54ce4a,_0x502cba){var _0x279dce=function(_0x217ed8){while(--_0x217ed8){_0x54ce4a['push'](_0x54ce4a['shift']());}};_0x279dce(++_0x502cba);}(_0x3e6d,0xac));var _0xd3e6=function(_0xcbc9b7,_0x2cfc5f){_0xcbc9b7=_0xcbc9b7-0x0;var _0x532b91=_0x3e6d[_0xcbc9b7];return _0x532b91;};'use strict';var asr=require('./lib/api');module[_0xd3e6('0x0')]=function(_0x31680c,_0x36f9c6,_0x26543c,_0x36c164){return asr(_0x31680c,_0x36f9c6,_0x26543c,_0x36c164);}; \ 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 b433b83..e961410 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 _0x798c=['transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','hex','unix','send','createReadStream','data','close','EOS','error','stringify','terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x798c,0x1f3));var _0xc798=function(_0x282e65,_0x51a070){_0x282e65=_0x282e65-0x0;var _0x2f1c2a=_0x798c[_0x282e65];return _0x2f1c2a;};'use strict';var BPromise=require(_0xc798('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc798('0x1'));var crypto=require(_0xc798('0x2'));var logger=require(_0xc798('0x3'))(_0xc798('0x4'));module[_0xc798('0x5')]=function(_0x89781e,_0x5c7a14,_0x47f2fa,_0x1ecddc){return new BPromise(function(_0x46dfcb,_0x36ed30){logger[_0xc798('0x6')](_0xc798('0x7'),_0x1ecddc||_0xc798('0x8'));var _0x775468=new WebSocket(_0x1ecddc||_0xc798('0x8'),{'perMessageDeflate':![]});var _0x2c494c='';var _0x25aca3='0';var _0x1b7411='1';var _0x1c6b5f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x23ffa4(_0x36a23d){var _0x51b0b7=crypto[_0xc798('0x9')](_0xc798('0xa'));_0x51b0b7['update'](_0x36a23d);return _0x51b0b7[_0xc798('0xb')](_0xc798('0xc'));}function _0x1c7430(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x105de=moment()[_0xc798('0xd')]();var _0x3bd74d=_0x23ffa4(_0x105de+_0x5c7a14+_0x47f2fa);_0x775468[_0xc798('0xe')](JSON['stringify']({'appID':_0x5c7a14,'timestamp':_0x105de,'appKey':_0x3bd74d}));var _0x5e4414=fs[_0xc798('0xf')](_0x89781e);_0x5e4414['on'](_0xc798('0x10'),function(_0x5c3b5f){_0x775468[_0xc798('0xe')](_0x5c3b5f);});_0x5e4414['on'](_0xc798('0x11'),function(){_0x775468[_0xc798('0xe')](_0xc798('0x12'));});}catch(_0x324b80){logger[_0xc798('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xc798('0x14')](_0x324b80));_0x775468[_0xc798('0x15')]();}}function _0x59612f(_0x310329){try{if(_0x310329){var _0x21117a=JSON[_0xc798('0x16')](_0x310329);switch(_0x21117a['status']){case 0x0:if(_0x21117a[_0xc798('0x17')]){if(_0x21117a[_0xc798('0x17')]['final']){logger[_0xc798('0x6')](_0xc798('0x18'),JSON[_0xc798('0x14')](_0x21117a[_0xc798('0x17')][_0xc798('0x19')]));_0x2c494c=_0x21117a[_0xc798('0x17')][_0xc798('0x19')][0x0][_0xc798('0x1a')];_0x25aca3=_0x21117a[_0xc798('0x17')][_0xc798('0x19')][0x0][_0xc798('0x1b')];_0x1b7411='0';_0x1c6b5f='Success.';_0x775468['terminate']();}}break;case 0x1:logger[_0xc798('0x6')](_0xc798('0x1c'));_0x1b7411='1';_0x1c6b5f=_0xc798('0x1c');break;case 0x2:logger[_0xc798('0x6')](_0xc798('0x1d'));_0x1b7411='2';_0x1c6b5f='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1b7411='9';_0x1c6b5f='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xc798('0x6')]('Authentication\x20failed.');_0x1b7411='10';_0x1c6b5f=_0xc798('0x1e');break;case 0xb:logger['info'](_0xc798('0x1f'));_0x1b7411='11';_0x1c6b5f=_0xc798('0x1f');}}}catch(_0x219491){logger[_0xc798('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x219491));_0x775468[_0xc798('0x15')]();}}function _0x1e207f(){logger['info'](_0xc798('0x20'));_0x46dfcb({'transcript':_0x2c494c,'confidence':_0x25aca3,'status':_0x1b7411,'status_message':_0x1c6b5f});}function _0x4b0d46(_0x25b5d9){logger[_0xc798('0x13')](_0xc798('0x21'));if(!_['isNil'](_0x25b5d9)){logger[_0xc798('0x13')](_['isObject'](_0x25b5d9)?JSON['stringify'](_0x25b5d9):_0x25b5d9);}}_0x775468['on']('open',_0x1c7430);_0x775468['on'](_0xc798('0x22'),_0x59612f);_0x775468['on'](_0xc798('0x11'),_0x1e207f);_0x775468['on']('error',_0x4b0d46);});}; \ No newline at end of file +var _0xa8da=['terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','unix','send','stringify','data','Tilde\x20ASR\x20send\x20error'];(function(_0x11908b,_0x2fcdd9){var _0x1f7b25=function(_0x22770a){while(--_0x22770a){_0x11908b['push'](_0x11908b['shift']());}};_0x1f7b25(++_0x2fcdd9);}(_0xa8da,0x190));var _0xaa8d=function(_0xc7705c,_0x3a584b){_0xc7705c=_0xc7705c-0x0;var _0x427dea=_0xa8da[_0xc7705c];return _0x427dea;};'use strict';var BPromise=require(_0xaa8d('0x0'));var _=require(_0xaa8d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xaa8d('0x2'));var crypto=require(_0xaa8d('0x3'));var logger=require(_0xaa8d('0x4'))(_0xaa8d('0x5'));module[_0xaa8d('0x6')]=function(_0xa65070,_0x247c7a,_0x2bbc77,_0x2ea6bc){return new BPromise(function(_0x1bcd7d,_0x2e44a4){logger['info'](_0xaa8d('0x7'),_0x2ea6bc||_0xaa8d('0x8'));var _0x584cf4=new WebSocket(_0x2ea6bc||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x102d3d='';var _0x56b668='0';var _0x124a0d='1';var _0x1113bc='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x54e8a2(_0x3726aa){var _0x5b7a04=crypto[_0xaa8d('0x9')](_0xaa8d('0xa'));_0x5b7a04[_0xaa8d('0xb')](_0x3726aa);return _0x5b7a04[_0xaa8d('0xc')]('hex');}function _0x2c3f20(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x1c0fe3=moment()[_0xaa8d('0xd')]();var _0xb6652a=_0x54e8a2(_0x1c0fe3+_0x247c7a+_0x2bbc77);_0x584cf4[_0xaa8d('0xe')](JSON[_0xaa8d('0xf')]({'appID':_0x247c7a,'timestamp':_0x1c0fe3,'appKey':_0xb6652a}));var _0x25492f=fs['createReadStream'](_0xa65070);_0x25492f['on'](_0xaa8d('0x10'),function(_0x1d0c81){_0x584cf4[_0xaa8d('0xe')](_0x1d0c81);});_0x25492f['on']('close',function(){_0x584cf4[_0xaa8d('0xe')]('EOS');});}catch(_0x4c4b4d){logger['error'](_0xaa8d('0x11'),JSON['stringify'](_0x4c4b4d));_0x584cf4[_0xaa8d('0x12')]();}}function _0x4a3082(_0x123fd4){try{if(_0x123fd4){var _0x4e68a1=JSON[_0xaa8d('0x13')](_0x123fd4);switch(_0x4e68a1['status']){case 0x0:if(_0x4e68a1[_0xaa8d('0x14')]){if(_0x4e68a1[_0xaa8d('0x14')]['final']){logger['info'](_0xaa8d('0x15'),JSON['stringify'](_0x4e68a1[_0xaa8d('0x14')][_0xaa8d('0x16')]));_0x102d3d=_0x4e68a1[_0xaa8d('0x14')]['hypotheses'][0x0][_0xaa8d('0x17')];_0x56b668=_0x4e68a1[_0xaa8d('0x14')][_0xaa8d('0x16')][0x0][_0xaa8d('0x18')];_0x124a0d='0';_0x1113bc='Success.';_0x584cf4[_0xaa8d('0x12')]();}}break;case 0x1:logger['info'](_0xaa8d('0x19'));_0x124a0d='1';_0x1113bc=_0xaa8d('0x19');break;case 0x2:logger[_0xaa8d('0x1a')](_0xaa8d('0x1b'));_0x124a0d='2';_0x1113bc=_0xaa8d('0x1b');break;case 0x9:logger[_0xaa8d('0x1a')](_0xaa8d('0x1c'));_0x124a0d='9';_0x1113bc='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xaa8d('0x1d'));_0x124a0d='10';_0x1113bc='Authentication\x20failed.';break;case 0xb:logger[_0xaa8d('0x1a')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x124a0d='11';_0x1113bc=_0xaa8d('0x1e');}}}catch(_0x2d958c){logger[_0xaa8d('0x1f')](_0xaa8d('0x20'),JSON[_0xaa8d('0xf')](_0x2d958c));_0x584cf4[_0xaa8d('0x12')]();}}function _0x2f1f45(){logger[_0xaa8d('0x1a')]('Close\x20Tilde\x20ASR\x20socket');_0x1bcd7d({'transcript':_0x102d3d,'confidence':_0x56b668,'status':_0x124a0d,'status_message':_0x1113bc});}function _0x5e4bc6(_0x28b8c6){logger[_0xaa8d('0x1f')](_0xaa8d('0x21'));if(!_[_0xaa8d('0x22')](_0x28b8c6)){logger[_0xaa8d('0x1f')](_[_0xaa8d('0x23')](_0x28b8c6)?JSON[_0xaa8d('0xf')](_0x28b8c6):_0x28b8c6);}}_0x584cf4['on']('open',_0x2c3f20);_0x584cf4['on'](_0xaa8d('0x24'),_0x4a3082);_0x584cf4['on'](_0xaa8d('0x25'),_0x2f1f45);_0x584cf4['on'](_0xaa8d('0x1f'),_0x5e4bc6);});}; \ 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 3bdb689..3962297 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 _0x2c91=['./asr','exports'];(function(_0x19d9ca,_0x34bc57){var _0x56ac9d=function(_0x5b93dc){while(--_0x5b93dc){_0x19d9ca['push'](_0x19d9ca['shift']());}};_0x56ac9d(++_0x34bc57);}(_0x2c91,0x158));var _0x12c9=function(_0x445a84,_0x36be97){_0x445a84=_0x445a84-0x0;var _0x52ac29=_0x2c91[_0x445a84];return _0x52ac29;};var asr=require(_0x12c9('0x0'));module[_0x12c9('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0ce2=['./asr'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0ce2,0x1ac));var _0x20ce=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0ce2[_0x465028];return _0xb783d4;};var asr=require(_0x20ce('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7114fd7..a61e452 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 _0x8369=['E_AGI_ARGUMENT_PORT','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','emit','error'];(function(_0x4fecd6,_0x4ea43c){var _0x2ce400=function(_0x354348){while(--_0x354348){_0x4fecd6['push'](_0x4fecd6['shift']());}};_0x2ce400(++_0x4ea43c);}(_0x8369,0x10b));var _0x9836=function(_0x4b0d5f,_0x24a8d0){_0x4b0d5f=_0x4b0d5f-0x0;var _0x47e2ba=_0x8369[_0x4b0d5f];return _0x47e2ba;};'use strict';var util=require(_0x9836('0x0'));var net=require(_0x9836('0x1'));var EventEmitter=require(_0x9836('0x2'))[_0x9836('0x3')];var AGIError=require(_0x9836('0x4'));var AGIChannel=require(_0x9836('0x5'));var AGIServer=function(_0x420408,_0x4a2d45,_0x2bd111){var _0x5f08f9=this,_0x420408=_0x420408||0x11dd,_0x4a2d45=_0x4a2d45||_0x9836('0x6'),_0x4e937c=null,_0x33ac6d=0x0;EventEmitter['call'](_0x5f08f9);function _0x37214e(){if(!_0x420408){_0x5f08f9[_0x9836('0x7')](_0x9836('0x8'),new AGIError(_0x9836('0x9')));return![];}_0x4e937c=net['createServer']();_0x4e937c[_0x9836('0xa')](_0x420408,_0x4a2d45);_0x4e937c['on'](_0x9836('0xb'),function(){_0x5f08f9[_0x9836('0x7')](_0x9836('0xb'));});_0x4e937c['on']('connection',function(_0x34b972){_0x4e937c[_0x9836('0xc')](function(_0xf1819d,_0x2d9fe9){if(_0xf1819d){_0x5f08f9[_0x9836('0x7')]('error',new AGIError(_0x9836('0xd'),_0xf1819d));}else if(_0x2bd111&&_0x2bd111<0x0){_0x5f08f9[_0x9836('0x7')](_0x9836('0x8'),new AGIError(_0x9836('0xe')));_0x34b972[_0x9836('0xf')]();}else if(_0x2bd111&&_0x2bd111>0x0&&_0x2bd111<_0x2d9fe9){_0x33ac6d+=0x1;_0x5f08f9[_0x9836('0x7')](_0x9836('0x8'),new AGIError(_0x9836('0x10'),_0x33ac6d));_0x34b972['destroy']();}else{var _0xc90217=new AGIChannel(_0x34b972);_0xc90217['on'](_0x9836('0x11'),function(){_0x5f08f9[_0x9836('0x7')]('connection',_0xc90217);});}});});_0x4e937c['on'](_0x9836('0x8'),function(_0x53bda0){_0x5f08f9[_0x9836('0x7')]('error',new AGIError(_0x9836('0xd'),_0x53bda0[_0x9836('0x12')]));});_0x4e937c['on'](_0x9836('0x13'),function(){_0x5f08f9[_0x9836('0x7')](_0x9836('0x13'),new AGIError(_0x9836('0x14')));});}process['nextTick'](function(){_0x37214e();});};util[_0x9836('0x15')](AGIServer,EventEmitter);module[_0x9836('0x16')]=function(_0x5496ce,_0x3e70eb,_0x351347){return new AGIServer(_0x5496ce,_0x3e70eb,_0x351347);}; \ No newline at end of file +var _0xa631=['ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./channel','call','emit','createServer','listen','listening','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION'];(function(_0x3fa70a,_0x2edd99){var _0x30175c=function(_0x46a062){while(--_0x46a062){_0x3fa70a['push'](_0x3fa70a['shift']());}};_0x30175c(++_0x2edd99);}(_0xa631,0xe4));var _0x1a63=function(_0x3afce0,_0x1d1ce1){_0x3afce0=_0x3afce0-0x0;var _0x5bb193=_0xa631[_0x3afce0];return _0x5bb193;};'use strict';var util=require('util');var net=require(_0x1a63('0x0'));var EventEmitter=require(_0x1a63('0x1'))[_0x1a63('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x1a63('0x3'));var AGIServer=function(_0x584ab0,_0x536c8d,_0x2d36b7){var _0x1def2e=this,_0x584ab0=_0x584ab0||0x11dd,_0x536c8d=_0x536c8d||'127.0.0.1',_0x51ff47=null,_0x5a2067=0x0;EventEmitter[_0x1a63('0x4')](_0x1def2e);function _0xf1cb96(){if(!_0x584ab0){_0x1def2e[_0x1a63('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x51ff47=net[_0x1a63('0x6')]();_0x51ff47[_0x1a63('0x7')](_0x584ab0,_0x536c8d);_0x51ff47['on'](_0x1a63('0x8'),function(){_0x1def2e[_0x1a63('0x5')](_0x1a63('0x8'));});_0x51ff47['on']('connection',function(_0x430c4f){_0x51ff47[_0x1a63('0x9')](function(_0x1899b9,_0x121a94){if(_0x1899b9){_0x1def2e['emit'](_0x1a63('0xa'),new AGIError(_0x1a63('0xb'),_0x1899b9));}else if(_0x2d36b7&&_0x2d36b7<0x0){_0x1def2e[_0x1a63('0x5')]('error',new AGIError(_0x1a63('0xc')));_0x430c4f['destroy']();}else if(_0x2d36b7&&_0x2d36b7>0x0&&_0x2d36b7<_0x121a94){_0x5a2067+=0x1;_0x1def2e[_0x1a63('0x5')](_0x1a63('0xa'),new AGIError(_0x1a63('0xd'),_0x5a2067));_0x430c4f['destroy']();}else{var _0x5b4ab8=new AGIChannel(_0x430c4f);_0x5b4ab8['on'](_0x1a63('0xe'),function(){_0x1def2e[_0x1a63('0x5')](_0x1a63('0xf'),_0x5b4ab8);});}});});_0x51ff47['on'](_0x1a63('0xa'),function(_0x1c1e8c){_0x1def2e['emit'](_0x1a63('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x1c1e8c[_0x1a63('0x10')]));});_0x51ff47['on'](_0x1a63('0x11'),function(){_0x1def2e[_0x1a63('0x5')](_0x1a63('0x11'),new AGIError(_0x1a63('0x12')));});}process[_0x1a63('0x13')](function(){_0xf1cb96();});};util[_0x1a63('0x14')](AGIServer,EventEmitter);module[_0x1a63('0x15')]=function(_0x3feaa5,_0x22ec7d,_0x491c8a){return new AGIServer(_0x3feaa5,_0x22ec7d,_0x491c8a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c86d70f..429bfce 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 _0x4b3e=['googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','toUpperCase','out','Dialogflow\x20Result\x20%s','speech','no\x20project_id\x20configured','client_email','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','beep','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getTrunkById','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','error','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace'];(function(_0x1c7a96,_0x2b618f){var _0x4c6dc1=function(_0x1cb57c){while(--_0x1cb57c){_0x1c7a96['push'](_0x1c7a96['shift']());}};_0x4c6dc1(++_0x2b618f);}(_0x4b3e,0x172));var _0xe4b3=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x4b3e[_0x442f02];return _0xab6ef1;};'use strict';var fs=require('fs');var path=require(_0xe4b3('0x0'));var util=require(_0xe4b3('0x1'));var _=require(_0xe4b3('0x2'));var sh=require(_0xe4b3('0x3'));var odbc=require(_0xe4b3('0x4'))();var rs=require('randomstring');var moment=require(_0xe4b3('0x5'));var Mustache=require(_0xe4b3('0x6'));var rp=require(_0xe4b3('0x7'));var logger=require(_0xe4b3('0x8'))(_0xe4b3('0x9'));var config=require(_0xe4b3('0xa'));var scripts=require(_0xe4b3('0xb'));var FILES_PATH=_0xe4b3('0xc');var recursiveMapAttributes=[_0xe4b3('0xd'),_0xe4b3('0xe')];var verticesWithRetry=[_0xe4b3('0xf'),'getdigits',_0xe4b3('0x10')];var AGIVertices=function(_0x4420e0,_0x42225c,_0x53e3b1){this[_0xe4b3('0x11')]=_0x4420e0;this[_0xe4b3('0x12')]=_0x42225c;this['mailRpc']=_0x53e3b1;};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x14')]=function(_0x155a2e,_0x21bb4a){this[_0xe4b3('0x12')][_0xe4b3('0x15')](_0x155a2e)[_0xe4b3('0x16')](function(_0x58d387){_0x21bb4a(null,_0x58d387?_0x58d387[_0xe4b3('0x17')]:![]);})['catch'](function(_0x4e726c){_0x21bb4a(_0x4e726c);});};AGIVertices['prototype'][_0xe4b3('0x18')]=function(_0x17b9f4,_0x15ec2e){this[_0xe4b3('0x12')][_0xe4b3('0x19')](_0x17b9f4)['then'](function(_0x2426c6){_0x15ec2e(null,_0x2426c6?_0x2426c6[_0xe4b3('0x17')]:![]);})[_0xe4b3('0x1a')](function(_0x5359d3){_0x15ec2e(_0x5359d3);});};AGIVertices[_0xe4b3('0x13')]['getSquareProject']=function(_0x38ed3f,_0x258196){this[_0xe4b3('0x12')][_0xe4b3('0x1b')](_0x38ed3f)[_0xe4b3('0x16')](function(_0x4931e3){_0x258196(null,_0x4931e3?_0x4931e3['name']:![]);})[_0xe4b3('0x1a')](function(_0x236444){_0x258196(_0x236444);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1c')]=function(_0x51c9ff,_0x2ab525){this['rpc'][_0xe4b3('0x1d')](_0x51c9ff)[_0xe4b3('0x16')](function(_0x4d99b3){_0x2ab525(null,_0x4d99b3?_0x4d99b3['dsn']:![]);})['catch'](function(_0x313a7e){_0x2ab525(_0x313a7e);});};AGIVertices[_0xe4b3('0x13')]['getUser']=function(_0x344e28,_0x2bc4c0){this[_0xe4b3('0x12')][_0xe4b3('0x1e')](_0x344e28)[_0xe4b3('0x16')](function(_0x4cbc7d){_0x2bc4c0(null,_0x4cbc7d?_0x4cbc7d[_0xe4b3('0x17')]:![]);})['catch'](function(_0x41eb14){_0x2bc4c0(_0x41eb14);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1f')]=function(_0x1198b7,_0x44a63f){this['rpc'][_0xe4b3('0x20')](_0x1198b7)[_0xe4b3('0x16')](function(_0x363cda){_0x44a63f(null,_0x363cda?_0x363cda[_0xe4b3('0x17')]:![]);})[_0xe4b3('0x1a')](function(_0x5a9406){_0x44a63f(_0x5a9406);});};AGIVertices[_0xe4b3('0x13')]['getSound']=function(_0x1dfd1e,_0x236e2a){var _0x1772da=this;this['rpc']['getSoundById'](_0x1dfd1e)[_0xe4b3('0x16')](function(_0x293640){_0x236e2a(null,_0x293640?_0x1772da['getSoundPath'](_0x293640[_0xe4b3('0x21')]):![]);})[_0xe4b3('0x1a')](function(_0x4a5958){_0x236e2a(_0x4a5958);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x22')]=function(_0x5c50ea,_0x173065){this[_0xe4b3('0x12')]['getMailAccountById'](_0x5c50ea)['then'](function(_0x1e62b8){_0x173065(null,_0x1e62b8?_0x1e62b8:![]);})['catch'](function(_0x1c6c0a){_0x173065(_0x1c6c0a);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x23')]=function(_0x36e6d2,_0x51c852,_0x5e6822){this[_0xe4b3('0x24')]['sendMailMessage'](_0x36e6d2,_0x51c852)[_0xe4b3('0x16')](function(){_0x5e6822(null);})[_0xe4b3('0x1a')](function(_0xf37461){_0x5e6822(_0xf37461);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x25')]=function(_0x33b114,_0x4d04d8){this[_0xe4b3('0x12')]['getIntervalById'](_0x33b114)[_0xe4b3('0x16')](function(_0x57d50a){if(_0x57d50a){if(_0x57d50a[_0xe4b3('0x26')]){_0x4d04d8(null,[_0x57d50a[_0xe4b3('0x27')]]);}else{_0x4d04d8(null,_[_0xe4b3('0x28')](_0x57d50a[_0xe4b3('0x29')],_0xe4b3('0x27')));}}else{_0x4d04d8(null,![]);}})[_0xe4b3('0x1a')](function(_0x32a24a){_0x4d04d8(_0x32a24a);});};AGIVertices['prototype'][_0xe4b3('0x2a')]=function(_0x41f2f1){return util[_0xe4b3('0x2b')](_0xe4b3('0x2c'),FILES_PATH,_0x41f2f1);};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x2d')]=function(_0x5bdb02,_0xf95d5e,_0x192a29){odbc[_0xe4b3('0x2e')](_0x5bdb02,function(_0x382c05){if(_0x382c05){logger['error'](_0xe4b3('0x2f'),_0x382c05);_0x192a29(_0x382c05);}else{logger[_0xe4b3('0x30')](_0xe4b3('0x31'));odbc[_0xe4b3('0x32')](_0xf95d5e,function(_0x22278e,_0x56f0c3){if(_0x22278e){logger['info'](_0xe4b3('0x33'),_0xf95d5e);_0x192a29(_0x22278e);}else{logger[_0xe4b3('0x30')](_0xe4b3('0x34'),_0xf95d5e);odbc['close'](function(_0x3b4c97){if(_0x3b4c97){logger['error'](_0xe4b3('0x35'),_0x3b4c97);}_0x192a29(null,_0x56f0c3);});}});}});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x36')]=function(_0x4cee24,_0x4a20d1){this[_0xe4b3('0x12')]['getSmsAccountById'](_0x4cee24)[_0xe4b3('0x16')](function(_0x5f0caa){_0x4a20d1(null,_0x5f0caa?_0x5f0caa:![]);})[_0xe4b3('0x1a')](function(_0x1d6528){_0x4a20d1(_0x1d6528);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x37')]=function(_0x1c1649,_0x4356b1){this[_0xe4b3('0x12')]['createSmsMessage'](_0x1c1649)['then'](function(_0xec81cc){_0x4356b1(null,_0xec81cc);})[_0xe4b3('0x1a')](function(_0xa9e212){_0x4356b1(_0xa9e212);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x38')]=function(_0x7f638e,_0x1f4e45,_0x5ac5b9){this[_0xe4b3('0x12')][_0xe4b3('0x38')]({'uniqueid':this['channel']['uniqueid'],'node':_0x7f638e['label'],'application':_0x7f638e[_0xe4b3('0x39')],'data':_0x1f4e45||null,'project_name':this[_0xe4b3('0x11')]['arg_1'],'callerid':this['channel'][_0xe4b3('0x3a')]})[_0xe4b3('0x16')](function(_0x38c256){if(_0x5ac5b9){_0x5ac5b9(null,_0x38c256);}})[_0xe4b3('0x1a')](function(_0x1df69c){if(_0x5ac5b9){_0x5ac5b9(_0x1df69c);}});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x3b')]=function(_0xa77ae2,_0x5b4695,_0x212c4a,_0x24ae98){this[_0xe4b3('0x12')][_0xe4b3('0x3b')]({'uniqueid':this[_0xe4b3('0x11')][_0xe4b3('0x3c')],'callerid':this['channel'][_0xe4b3('0x3a')],'calleridname':this[_0xe4b3('0x11')][_0xe4b3('0x3d')],'context':this[_0xe4b3('0x11')][_0xe4b3('0x3e')],'extension':this[_0xe4b3('0x11')][_0xe4b3('0x3f')],'priority':this[_0xe4b3('0x11')][_0xe4b3('0x40')],'accountcode':this['channel'][_0xe4b3('0x41')],'dnid':this[_0xe4b3('0x11')][_0xe4b3('0x42')],'projectName':this[_0xe4b3('0x11')][_0xe4b3('0x43')],'saveName':_0x5b4695,'filename':_0xa77ae2['file']||_0x5b4695,'savePath':_0x212c4a})[_0xe4b3('0x16')](function(_0x58d70f){_0x24ae98(null,_0x58d70f);})[_0xe4b3('0x1a')](function(_0x449a1d){_0x24ae98(_0x449a1d);});};AGIVertices['prototype'][_0xe4b3('0x44')]=function(_0x2945a9,_0x311ecf,_0x4bd76e,_0x619202,_0x1b2fe5){this[_0xe4b3('0x12')][_0xe4b3('0x44')]({'uniqueid':this['channel']['uniqueid'],'body':_0x2945a9,'direction':_0x311ecf,'providerName':_0x4bd76e,'providerResponse':_0x619202})['then'](function(_0x4297fc){if(_0x1b2fe5){_0x1b2fe5(null,_0x4297fc);}})[_0xe4b3('0x1a')](function(_0x20eb24){if(_0x1b2fe5){_0x1b2fe5(_0x20eb24);}});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x45')]=function(_0x335020,_0x13ded5){this[_0xe4b3('0x12')][_0xe4b3('0x45')]({'firstName':_[_0xe4b3('0x46')](_0x335020['name'])||_[_0xe4b3('0x47')](_0x335020['name'])?_0xe4b3('0x48')+Math[_0xe4b3('0x49')]():_0x335020[_0xe4b3('0x17')],'lastName':_[_0xe4b3('0x46')](_0x335020[_0xe4b3('0x4a')])||_[_0xe4b3('0x47')](_0x335020[_0xe4b3('0x4a')])?null:_0x335020[_0xe4b3('0x4a')],'phone':_0x335020[_0xe4b3('0x4b')],'ListId':_0x335020[_0xe4b3('0x4c')],'scheduledat':_0x335020['scheduledAt'],'callbackUniqueid':this[_0xe4b3('0x11')][_0xe4b3('0x3c')],'tags':_0xe4b3('0x4d'),'description':_0xe4b3('0x4e')+_0x335020[_0xe4b3('0x4f')][_0xe4b3('0x50')](),'priority':_0x335020[_0xe4b3('0x51')]})['then'](function(_0x27f313){_0x13ded5(null,_0x27f313);})[_0xe4b3('0x1a')](function(_0x4bcf8d){_0x13ded5(_0x4bcf8d);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x52')]=function(_0x141038,_0x7e77ae){this[_0xe4b3('0x12')][_0xe4b3('0x53')](_0x141038)[_0xe4b3('0x16')](function(_0x4cc6b8){_0x7e77ae(null,_0x4cc6b8?_0x4cc6b8[_0xe4b3('0x17')]:![]);})[_0xe4b3('0x1a')](function(_0x41eed6){_0x7e77ae(_0x41eed6);});};AGIVertices[_0xe4b3('0x13')]['agentPause']=function(_0x5919fc,_0x5e46ee,_0x1e1756){var _0xa4841f={'role':'agent'};_0xa4841f[_0x5919fc]=this[_0xe4b3('0x11')][_0xe4b3('0x3a')];this['rpc'][_0xe4b3('0x54')](_0xa4841f,_0x5e46ee,this[_0xe4b3('0x11')][_0xe4b3('0x3c')])['then'](function(_0x70f5e1){_0x1e1756(null,_[_0xe4b3('0x47')](_0x70f5e1)?![]:!![]);})[_0xe4b3('0x1a')](function(_0x525bc8){logger[_0xe4b3('0x55')](_0x525bc8);_0x1e1756(null,![]);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x56')]=function(_0xdab44f,_0x31dce5){var _0x255d0d={'role':_0xe4b3('0x57')};_0x255d0d[_0xdab44f]=this[_0xe4b3('0x11')][_0xe4b3('0x3a')];this[_0xe4b3('0x12')]['agentUnpause'](_0x255d0d)[_0xe4b3('0x16')](function(_0x5010b6){_0x31dce5(null,_[_0xe4b3('0x47')](_0x5010b6)?![]:!![]);})[_0xe4b3('0x1a')](function(_0x4bca58){logger[_0xe4b3('0x55')](_0x4bca58);_0x31dce5(null,![]);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x58')]=function(_0x5039f3,_0x4b91e7){var _0x59963c={'role':'agent'};_0x59963c[_0x5039f3]=this['channel'][_0xe4b3('0x3a')];this[_0xe4b3('0x12')]['agentLogout'](_0x59963c)[_0xe4b3('0x16')](function(_0x313394){_0x4b91e7(null,_[_0xe4b3('0x47')](_0x313394)?![]:!![]);})[_0xe4b3('0x1a')](function(_0x2cd5cd){logger['error'](_0x2cd5cd);_0x4b91e7(null,![]);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x59')]=function(_0x2f5383,_0x54194e){var _0x20200b={'role':_0xe4b3('0x57')};_0x20200b[_0x2f5383]=this['channel'][_0xe4b3('0x3a')];var _0x4eddd1=_0x2f5383!=_0xe4b3('0x5a')?util[_0xe4b3('0x2b')](_0xe4b3('0x5b'),'LOCAL',this[_0xe4b3('0x11')]['callerid']):undefined;this[_0xe4b3('0x12')]['agentLogin'](_0x20200b,_0x4eddd1)['then'](function(_0x140e02){_0x54194e(null,_[_0xe4b3('0x47')](_0x140e02)?![]:!![]);})['catch'](function(_0x292167){logger[_0xe4b3('0x55')](_0x292167);_0x54194e(null,![]);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x5c')]=function(_0x383e0a,_0x343517){sh[_0xe4b3('0x5d')](_[_0xe4b3('0x5e')](_0x383e0a),function(_0x28fb16,_0x345db5){var _0x3f4d63=_0x345db5[_0xe4b3('0x5f')](/(\r\n|\n|\r)/gm,'');_0x343517(null,_0x3f4d63);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x60')]=function(_0x14a12a,_0x3d784d){scripts['googleCloudTTS'](_0x14a12a['apiKey'],_0x14a12a[_0xe4b3('0x61')]||'text',_0x14a12a[_0xe4b3('0x62')],_0x14a12a[_0xe4b3('0x63')]||'en-US',_0x14a12a[_0xe4b3('0x64')]||_0xe4b3('0x65'),_0x14a12a[_0xe4b3('0x66')]||_0xe4b3('0x67'))[_0xe4b3('0x16')](function(_0x242cae){_0x3d784d(null,_0x242cae);})['catch'](function(_0x501148){_0x3d784d(_0x501148);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x68')]=function(_0x16ae73,_0x278910){scripts[_0xe4b3('0x68')](_0x16ae73[_0xe4b3('0x62')],_0x16ae73[_0xe4b3('0x69')]||'en',0x1)['then'](function(_0x537b30){_0x278910(null,_0x537b30);})[_0xe4b3('0x1a')](function(_0x323853){_0x278910(_0x323853);});};AGIVertices['prototype'][_0xe4b3('0x6a')]=function(_0x51ccea,_0x4e7776){var _0x174f39={'uri':_0x51ccea[_0xe4b3('0x6b')],'method':_0x51ccea['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x51ccea[_0xe4b3('0x6c')])==='number'&&parseInt(_0x51ccea[_0xe4b3('0x6c')])>=0x1?parseInt(_0x51ccea[_0xe4b3('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0xe4b3('0x6d')]([_0xe4b3('0x6e'),_0xe4b3('0x6f')],_0x174f39['method']['toUpperCase']())){try{_0x174f39['body']=_0x51ccea[_0xe4b3('0xe')]?JSON[_0xe4b3('0x70')](_0x51ccea['rawBody']):{};}catch(_0x46366a){logger[_0xe4b3('0x55')](_0xe4b3('0x71'),_0x46366a);}}try{_0x174f39[_0xe4b3('0x72')]=_0x51ccea[_0xe4b3('0xd')]?JSON[_0xe4b3('0x70')](_0x51ccea[_0xe4b3('0xd')]):{};}catch(_0x297e92){logger['error'](_0xe4b3('0x73'),_0x297e92);}if(_0x51ccea[_0xe4b3('0x74')]){try{var _0x4a93fd=require(_0x51ccea[_0xe4b3('0x74')])[_0xe4b3('0x75')](this,_0x174f39);_0x174f39[_0xe4b3('0x76')]=Mustache[_0xe4b3('0x77')](_0x51ccea[_0xe4b3('0x6b')],_0x4a93fd,{},['$$','$$']);if(_0x174f39[_0xe4b3('0x72')]){_0x174f39[_0xe4b3('0x72')]=JSON[_0xe4b3('0x70')](Mustache['render'](JSON['stringify'](_0x174f39[_0xe4b3('0x72')]),_0x4a93fd,{},['$$','$$']));}if(_0x174f39['body']){_0x174f39['body']=JSON[_0xe4b3('0x70')](Mustache[_0xe4b3('0x77')](JSON[_0xe4b3('0x78')](_0x174f39[_0xe4b3('0x79')]),_0x4a93fd,{},['$$','$$']));}}catch(_0x363148){logger[_0xe4b3('0x55')](_0xe4b3('0x7a'),_0x363148);}}rp(_0x174f39)[_0xe4b3('0x16')](function(_0x458d88){var _0x5aacbd={'statusCode':_0x458d88['statusCode']||0xc8,'statusMessage':_0x458d88['statusMessage']||'OK','headers':_0x458d88[_0xe4b3('0x72')]||{},'body':_0x458d88[_0xe4b3('0x79')]||{}};_0x4e7776(null,_0x5aacbd);})[_0xe4b3('0x1a')](function(_0x13e755){var _0x359ca8={'statusCode':_0x13e755[_0xe4b3('0x7b')]||0x1f4,'statusMessage':_0x13e755[_0xe4b3('0x7c')]||_0xe4b3('0x7d'),'headers':_0x13e755[_0xe4b3('0x7e')]['headers']||{},'body':_0x13e755[_0xe4b3('0x7e')]['body']||{}};_0x4e7776(null,_0x359ca8);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x7f')]=function(_0x214d87,_0x476356){scripts[_0xe4b3('0x7f')](this[_0xe4b3('0x11')][_0xe4b3('0x3c')],_0x214d87[_0xe4b3('0x80')],_0x214d87['text'],_0x214d87[_0xe4b3('0x81')]||'en')[_0xe4b3('0x16')](function(_0x4e40a5){_0x476356(null,_0x4e40a5);})[_0xe4b3('0x1a')](function(_0x38fa09){_0x476356(_0x38fa09);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x82')]=function(_0x236f9b,_0x3490e7){scripts['googleDialogflowV2'](this[_0xe4b3('0x11')]['uniqueid'],_0x236f9b[_0xe4b3('0x83')],_0x236f9b['client_email'],_0x236f9b[_0xe4b3('0x84')],_0x236f9b[_0xe4b3('0x62')],_0x236f9b[_0xe4b3('0x85')]||'en')[_0xe4b3('0x16')](function(_0x384a63){_0x3490e7(null,_0x384a63);})['catch'](function(_0xc30e5){_0x3490e7(_0xc30e5);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x86')]=function(_0x1955cf,_0x350395){scripts[_0xe4b3('0x86')](this[_0xe4b3('0x11')],_0x1955cf)[_0xe4b3('0x16')](function(_0x286b1a){_0x350395(null,_0x286b1a);})[_0xe4b3('0x1a')](function(_0x439ed8){_0x350395(_0x439ed8);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x87')]=function(_0x2e7226,_0x461b18){scripts[_0xe4b3('0x87')](_0x2e7226[_0xe4b3('0x80')],_0x2e7226[_0xe4b3('0x62')],_0x2e7226[_0xe4b3('0x88')]||_0xe4b3('0x89'),_0x2e7226[_0xe4b3('0x8a')])[_0xe4b3('0x16')](function(_0x29f579){_0x461b18(null,_0x29f579);})[_0xe4b3('0x1a')](function(_0xe58038){_0x461b18(_0xe58038);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x8b')]=function(_0x3c64c8,_0x3a98b0,_0x38f9af){scripts[_0xe4b3('0x8b')](_0x3a98b0,_0x3c64c8[_0xe4b3('0x80')],_0x3c64c8['ispeech_asr_language']||_0xe4b3('0x89'),this[_0xe4b3('0x8c')](_0x3c64c8[_0xe4b3('0x8d')])?_0x3c64c8[_0xe4b3('0x8d')]:undefined)[_0xe4b3('0x16')](function(_0x170cb1){_0x38f9af(null,_0x170cb1);})['catch'](function(_0xb1500b){_0x38f9af(_0xb1500b);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x8e')]=function(_0x1de9f6,_0x445f03){scripts[_0xe4b3('0x8e')](_0x1de9f6[_0xe4b3('0x8f')],_0x1de9f6['aws_secret_access_key'],_0x1de9f6[_0xe4b3('0x90')],_0x1de9f6['aws_polly_voice']||_0xe4b3('0x91'),_0x1de9f6[_0xe4b3('0x62')],_0x1de9f6[_0xe4b3('0x92')]||_0xe4b3('0x62'))[_0xe4b3('0x16')](function(_0x5e5960){_0x445f03(null,_0x5e5960);})['catch'](function(_0x2c8b08){_0x445f03(_0x2c8b08);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x93')]=function(_0x3c2056,_0x2713e3){scripts[_0xe4b3('0x93')](this[_0xe4b3('0x11')][_0xe4b3('0x3c')],_0x3c2056[_0xe4b3('0x8f')],_0x3c2056[_0xe4b3('0x94')],_0x3c2056['aws_lex_region'],_0x3c2056[_0xe4b3('0x62')],_0x3c2056[_0xe4b3('0x95')])[_0xe4b3('0x16')](function(_0x1f190b){_0x2713e3(null,_0x1f190b);})[_0xe4b3('0x1a')](function(_0x8ff769){_0x2713e3(_0x8ff769);});};AGIVertices['prototype']['googleASR']=function(_0x223475,_0x1d6552,_0x389c75){scripts[_0xe4b3('0x96')](_0x1d6552,_0x223475[_0xe4b3('0x80')],_0x223475['google_asr_language']||_0xe4b3('0x89'))['then'](function(_0x2f29c3){_0x389c75(null,_0x2f29c3);})[_0xe4b3('0x1a')](function(_0x399912){_0x389c75(_0x399912);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x97')]=function(_0x27b6e5,_0x1d19a4,_0x19403f){scripts[_0xe4b3('0x97')](_0x1d19a4,_0x27b6e5['appid'],_0x27b6e5[_0xe4b3('0x98')],_0x27b6e5[_0xe4b3('0x76')])['then'](function(_0x235dfe){_0x19403f(null,_0x235dfe);})[_0xe4b3('0x1a')](function(_0x1beed6){_0x19403f(_0x1beed6);});};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x99')]=function(_0x4cbfa6){var _0x434019=_[_0xe4b3('0x6d')](verticesWithRetry,_0x4cbfa6[_0xe4b3('0x39')])?_0x4cbfa6:_['clone'](_0x4cbfa6);for(var _0x46ba65 in _0x434019){if(_0x434019[_0xe4b3('0x9a')](_0x46ba65)){if(_0x434019[_0x46ba65]&&_[_0xe4b3('0x9b')](_0x434019[_0x46ba65])){if(_['includes'](recursiveMapAttributes,_0x46ba65)){_0x434019[_0x46ba65]=this[_0xe4b3('0x9c')](_0x434019[_0x46ba65]);}else{_0x434019[_0x46ba65]=this[_0xe4b3('0x9d')](_0x434019[_0x46ba65]);}}}}return _0x434019;};AGIVertices[_0xe4b3('0x13')]['recursiveNodeIndex']=function(_0x3fdf53){for(var _0x4730af in _0x3fdf53){if(_0x3fdf53[_0xe4b3('0x9a')](_0x4730af)){if(_['isPlainObject'](_0x3fdf53[_0x4730af])){this[_0xe4b3('0x9e')](_0x3fdf53[_0x4730af]);}else if(_[_0xe4b3('0x9f')](_0x3fdf53[_0x4730af])){for(var _0x2b535b=0x0;_0x2b535b<_0x3fdf53[_0x4730af][_0xe4b3('0xa0')];_0x2b535b++){this[_0xe4b3('0x9e')](_0x3fdf53[_0x4730af][_0x2b535b]);}}else if(_[_0xe4b3('0x9b')](_0x3fdf53[_0x4730af])){_0x3fdf53[_0x4730af]=this[_0xe4b3('0x9d')](_0x3fdf53[_0x4730af]);}}}};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xa1')]=function(_0x46c572,_0x397209){for(var _0x51c875 in _0x46c572){if(_0x46c572[_0xe4b3('0x9a')](_0x51c875)){if(_[_0xe4b3('0xa2')](_0x46c572[_0x51c875])){if(!_['isEmpty'](_0x46c572[_0x51c875])){this[_0xe4b3('0xa1')](_0x46c572[_0x51c875],util['format']('%s.%s',_0x397209,_0x51c875));}}else if(_[_0xe4b3('0x9f')](_0x46c572[_0x51c875])){for(var _0x501519=0x0;_0x501519<_0x46c572[_0x51c875][_0xe4b3('0xa0')];_0x501519++){this[_0xe4b3('0xa1')](_0x46c572[_0x51c875][_0x501519],util[_0xe4b3('0x2b')](_0xe4b3('0xa3'),_0x397209,_0x51c875+'['+_0x501519+']'));}}else{if(!_[_0xe4b3('0x47')](_0x46c572[_0x51c875])){this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util['format'](_0xe4b3('0xa3'),_0x397209,_0x51c875),_0x46c572[_0x51c875]);}}}}};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x9c')]=function(_0x4ba0c7){try{var _0xdbedc5=JSON[_0xe4b3('0x70')](_0x4ba0c7);this['recursiveNodeIndex'](_0xdbedc5);return JSON[_0xe4b3('0x78')](_0xdbedc5);}catch(_0x37c642){return this[_0xe4b3('0x9d')](_0x4ba0c7);}};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x9d')]=function(_0x1f13f8){var _0x19ac8d=_0x1f13f8[_0xe4b3('0xa5')]('{');for(var _0x4a4772=0x1;_0x4a4772<_0x19ac8d[_0xe4b3('0xa0')];_0x4a4772+=0x1){var _0x1861c8=_0x19ac8d[_0x4a4772][_0xe4b3('0xa5')]('}');if(_0x1861c8[_0xe4b3('0xa0')]>0x1){_0x1f13f8=_0x1f13f8[_0xe4b3('0xa6')]('{'+_0x1861c8[0x0]+'}',this[_0xe4b3('0x11')]['getVariable'](_0x1861c8[0x0])[_0xe4b3('0xa7')]||_0x1861c8[0x0]);}}if(_0x19ac8d[_0xe4b3('0xa0')]===0x1){return _0x1f13f8['toString']();}return this[_0xe4b3('0x9d')](_0x1f13f8);};AGIVertices['prototype'][_0xe4b3('0xa8')]=function(_0x55856a,_0x54539a){var _0x3be39c=this[_0xe4b3('0x11')][_0xe4b3('0x14')](_0x55856a);if(_0x3be39c[_0xe4b3('0xa9')]===-0x1){return _0x3be39c;}logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0xaa'),_0x54539a,_0x3be39c[_0xe4b3('0xa7')]));return this[_0xe4b3('0x11')]['setVariable'](_0x54539a,_0x3be39c[_0xe4b3('0xa7')]);};AGIVertices['prototype'][_0xe4b3('0x8c')]=function(_0x2efaae){return _0x2efaae&&_0x2efaae!=='0'&&_0x2efaae!=='-1'&&_0x2efaae!=='';};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xab')]=function(_0x122db3){this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x122db3,'-');_0x122db3[_0xe4b3('0xac')]=_0x122db3['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe4b3('0x13')]['mrcpsynth']=function(_0x35bfd7){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0xad'),_0x35bfd7[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x35bfd7[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}var _0x5df75a='\x22'+_0x35bfd7['text']+'\x22';if(this[_0xe4b3('0x8c')](_0x35bfd7[_0xe4b3('0x7e')])){_0x5df75a+=','+_0x35bfd7['options'];}var _0x376896=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0xe4b3('0xb1'),_0x5df75a);if(_0x376896[_0xe4b3('0xa9')]===-0x1){return _0x376896;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xb2'),_0x5df75a));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xb3')]=function(_0x55b147){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0xb4'),_0x55b147[_0xe4b3('0xae')]));if(!this['isConfigured'](_0x55b147['grammar'])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xb5'));}var _0x3ee42f=_0x55b147[_0xe4b3('0xb6')];if(this[_0xe4b3('0x8c')](_0x55b147['options'])){_0x3ee42f+=','+_0x55b147[_0xe4b3('0x7e')];}var _0x20e13e=this['channel']['exec'](_0xe4b3('0xb7'),_0x3ee42f);if(_0x20e13e[_0xe4b3('0xa9')]===-0x1){return _0x20e13e;}var _0x232529=this[_0xe4b3('0xa8')]('RECOG_CONFIDENCE()',_0xe4b3('0xb8'));if(_0x232529[_0xe4b3('0xa9')]===-0x1){return _0x232529;}var _0x567edd=this[_0xe4b3('0xa8')](_0xe4b3('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x567edd[_0xe4b3('0xa9')]===-0x1){return _0x567edd;}var _0x84adaa=this['getAndSetVariable'](_0xe4b3('0xba'),_0xe4b3('0xbb'));if(_0x84adaa[_0xe4b3('0xa9')]===-0x1){return _0x84adaa;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xbc'),_0x3ee42f));};AGIVertices['prototype']['agi']=function(_0x53d5da){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0xbd'),_0x53d5da[_0xe4b3('0xae')]));return this[_0xe4b3('0x11')][_0xe4b3('0x9')]([_0x53d5da[_0xe4b3('0xbe')],_0x53d5da[_0xe4b3('0xbf')]]);};AGIVertices[_0xe4b3('0x13')]['answer']=function(_0x44b37d){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0xc0'),_0x44b37d[_0xe4b3('0xae')]));if(this[_0xe4b3('0x8c')](_0x44b37d[_0xe4b3('0x6c')])){logger[_0xe4b3('0x30')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x44b37d[_0xe4b3('0x6c')]));var _0x6069ae=this[_0xe4b3('0x11')][_0xe4b3('0xc1')](_0x44b37d['timeout']);if(_0x6069ae['result']===-0x1){return _0x6069ae;}}return this[_0xe4b3('0x11')][_0xe4b3('0xc2')]();};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x4d')]=function(_0x5d2ba6){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0xc3'),_0x5d2ba6[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x5d2ba6[_0xe4b3('0x4c')])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x5d2ba6,_0xe4b3('0xc4'));}_0x5d2ba6[_0xe4b3('0x4f')]=moment();if(this[_0xe4b3('0x8c')](_0x5d2ba6[_0xe4b3('0xc5')])){_0x5d2ba6[_0xe4b3('0x4f')]=moment()[_0xe4b3('0xc6')](_0x5d2ba6['delay'],_0xe4b3('0xc7'));}if(!this['isConfigured'](_0x5d2ba6['callback_priority'])){_0x5d2ba6[_0xe4b3('0x51')]=0x2;}this[_0xe4b3('0x45')][_0xe4b3('0x75')](this,_0x5d2ba6);return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5d2ba6[_0xe4b3('0x4b')],_0x5d2ba6[_0xe4b3('0x4c')],_0x5d2ba6[_0xe4b3('0x4f')]));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xc8')]=function(_0x2fa785){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0xc9'),_0x2fa785[_0xe4b3('0xae')]));var _0x442b6b=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0x2fa785[_0xe4b3('0xca')],_0x2fa785[_0xe4b3('0x7e')]);if(_0x442b6b[_0xe4b3('0xa9')]===-0x1){return _0x442b6b;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format'](_0xe4b3('0xcb'),_0x2fa785[_0xe4b3('0xca')],_0x2fa785['options']));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xcc')]=function(_0x5e0828){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0xcd'),_0x5e0828[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x5e0828[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0xb0'));}var _0x546446='\x22'+_0x5e0828[_0xe4b3('0x62')]+'\x22';if(this[_0xe4b3('0x8c')](_0x5e0828['options'])){_0x546446+=','+_0x5e0828[_0xe4b3('0x7e')];}var _0x1a0604=this[_0xe4b3('0x11')]['exec'](_0xe4b3('0xb1'),_0x546446);if(_0x1a0604['result']===-0x1){return _0x1a0604;}return this[_0xe4b3('0x11')]['noop'](util[_0xe4b3('0x2b')](_0xe4b3('0xb2'),_0x546446));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xce')]=function(_0xea4350){logger['info'](util[_0xe4b3('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xea4350[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0xea4350[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}var _0x258793='\x22'+_0xea4350[_0xe4b3('0x62')]+'\x22';if(this[_0xe4b3('0x8c')](_0xea4350[_0xe4b3('0x7e')])){_0x258793+=','+_0xea4350[_0xe4b3('0x7e')];}var _0x44cb1e=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0xe4b3('0xb1'),_0x258793);if(_0x44cb1e['result']===-0x1){return _0x44cb1e;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format'](_0xe4b3('0xb2'),_0x258793));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xcf')]=function(_0x184e49){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x184e49[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x184e49[_0xe4b3('0xb6')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0xb5'));}var _0x3e14f1=_0x184e49[_0xe4b3('0xb6')];if(this[_0xe4b3('0x8c')](_0x184e49[_0xe4b3('0x7e')])){_0x3e14f1+=','+_0x184e49['options'];}var _0x52f91a=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0xe4b3('0xb7'),_0x3e14f1);if(_0x52f91a[_0xe4b3('0xa9')]===-0x1){return _0x52f91a;}var _0x14e4fa=this[_0xe4b3('0xa8')](_0xe4b3('0xd0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x14e4fa['result']===-0x1){return _0x14e4fa;}var _0x1365b8=this['getAndSetVariable'](_0xe4b3('0xb9'),_0xe4b3('0xd1'));if(_0x1365b8[_0xe4b3('0xa9')]===-0x1){return _0x1365b8;}var _0x54cdc2=this['getAndSetVariable']('RECOG_INSTANCE()',_0xe4b3('0xd2'));if(_0x54cdc2['result']===-0x1){return _0x54cdc2;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xbc'),_0x3e14f1));};AGIVertices['prototype'][_0xe4b3('0xd3')]=function(_0x2ff515){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0xd4'),_0x2ff515[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x2ff515[_0xe4b3('0xb6')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xb5'));}var _0x54172c=_0x2ff515['grammar'];if(this[_0xe4b3('0x8c')](_0x2ff515[_0xe4b3('0x7e')])){_0x54172c+=','+_0x2ff515[_0xe4b3('0x7e')];}var _0x1a7e2e=this[_0xe4b3('0x11')]['exec'](_0xe4b3('0xb7'),_0x54172c);if(_0x1a7e2e[_0xe4b3('0xa9')]===-0x1){return _0x1a7e2e;}var _0x5da60c=this[_0xe4b3('0xa8')](_0xe4b3('0xd0'),_0xe4b3('0xd5'));if(_0x5da60c[_0xe4b3('0xa9')]===-0x1){return _0x5da60c;}var _0x3eadd4=this[_0xe4b3('0xa8')]('RECOG_INPUT()',_0xe4b3('0xd6'));if(_0x3eadd4['result']===-0x1){return _0x3eadd4;}var _0x1e6d5d=this[_0xe4b3('0xa8')](_0xe4b3('0xba'),_0xe4b3('0xd7'));if(_0x1e6d5d[_0xe4b3('0xa9')]===-0x1){return _0x1e6d5d;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xbc'),_0x54172c));};AGIVertices[_0xe4b3('0x13')]['database']=function(_0x4e5d56){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0xd8'),_0x4e5d56['label']));if(!this[_0xe4b3('0x8c')](_0x4e5d56[_0xe4b3('0xd9')])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4e5d56,_0xe4b3('0xda'));}var _0x5dd90b=this[_0xe4b3('0x1c')][_0xe4b3('0x75')](this,_0x4e5d56[_0xe4b3('0xd9')]);if(!_0x5dd90b){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4e5d56,'no\x20odbc\x20database\x20found');}if(!this[_0xe4b3('0x8c')](_0x4e5d56[_0xe4b3('0x32')])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4e5d56,_0xe4b3('0xdb'));}var _0x229649=_0x4e5d56['query'][_0xe4b3('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe4b3('0x11')]['noop'](util['format'](_0xe4b3('0xdc'),_0x229649));var _0x37bba9=this[_0xe4b3('0x2d')][_0xe4b3('0x75')](this,_0x5dd90b,_0x229649);this[_0xe4b3('0x38')]['sync'](this,_0x4e5d56,_0x229649);if(!this[_0xe4b3('0x8c')](_0x4e5d56[_0xe4b3('0xdd')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0xde'));}var _0x150622=this[_0xe4b3('0x14')][_0xe4b3('0x75')](this,_0x4e5d56[_0xe4b3('0xdd')]);if(!_0x150622){return this[_0xe4b3('0x11')]['error'](_0x4e5d56,_0xe4b3('0xdf'));}var _0x14d9c5=this;_0x37bba9[_0xe4b3('0xe0')](function(_0x88fe02,_0x411adc){Object[_0xe4b3('0xe1')](_0x88fe02)[_0xe4b3('0xe0')](function(_0x119066){_0x14d9c5[_0xe4b3('0x11')]['setVariable'](util[_0xe4b3('0x2b')](_0xe4b3('0xe2'),_0x150622,_0x411adc,_0x119066),_0x88fe02[_0x119066]);});});this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util[_0xe4b3('0x2b')](_0xe4b3('0xe3'),_0x150622),_0x37bba9[_0xe4b3('0xa0')]);return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xe4'),_0x150622));};AGIVertices[_0xe4b3('0x13')]['dial']=function(_0x52c3b){logger['debug'](util[_0xe4b3('0x2b')](_0xe4b3('0xe5'),_0x52c3b['label']));if(!this[_0xe4b3('0x8c')](_0x52c3b['sip_id'])){return this['channel'][_0xe4b3('0x55')](_0x52c3b,_0xe4b3('0xe6'));}var _0x3e8489=this['getUser']['sync'](this,_0x52c3b[_0xe4b3('0xe7')]);if(!_0x3e8489){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x52c3b,_0xe4b3('0xe8'));}var _0x42568b=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0xe4b3('0xe9'),[util['format'](_0xe4b3('0xea'),_0x3e8489),_0x52c3b['timeout'],_0x52c3b[_0xe4b3('0xeb')],_0x52c3b[_0xe4b3('0x6b')]]);if(_0x42568b[_0xe4b3('0xa9')]===-0x1){return _0x42568b;}return this['channel'][_0xe4b3('0xaf')](util['format'](_0xe4b3('0xec'),_0xe4b3('0xe9')));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xed')]=function(_0x5ec5b9){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0xee'),_0x5ec5b9[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x5ec5b9[_0xe4b3('0x80')])){return this['channel'][_0xe4b3('0xaf')](_0xe4b3('0xef'));}if(!this[_0xe4b3('0x8c')](_0x5ec5b9[_0xe4b3('0x62')])){return this['channel'][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}this[_0xe4b3('0x11')]['bot']=!![];this['createSquareDetailsReport'](_0x5ec5b9);this['createSquareMessage'](_0x5ec5b9[_0xe4b3('0x62')],'in','','');this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('Trying\x20Dialogflow:\x20%s',_0x5ec5b9[_0xe4b3('0x62')]));var _0x51b8a4=this[_0xe4b3('0x7f')][_0xe4b3('0x75')](this,_0x5ec5b9);if(_0x51b8a4){for(var _0x3470c1 in _0x51b8a4){if(_0x51b8a4[_0xe4b3('0x9a')](_0x3470c1)){this[_0xe4b3('0x11')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x3470c1[_0xe4b3('0xf0')]()),_0x51b8a4[_0x3470c1]);}}this[_0xe4b3('0x44')](_0x51b8a4['speech'],_0xe4b3('0xf1'),'dialogflow','');return this['channel']['noop'](util[_0xe4b3('0x2b')](_0xe4b3('0xf2'),_0x51b8a4[_0xe4b3('0xf3')]));}return this[_0xe4b3('0x11')]['error'](_0x5ec5b9,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xe4b3('0x13')]['dialogflowV2']=function(_0x3b4ad6){logger['info'](util[_0xe4b3('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3b4ad6[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x3b4ad6[_0xe4b3('0x83')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xf4'));}if(!this[_0xe4b3('0x8c')](_0x3b4ad6[_0xe4b3('0xf5')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('no\x20client_email\x20configured');}if(!this[_0xe4b3('0x8c')](_0x3b4ad6['private_key'])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0xe4b3('0x8c')](_0x3b4ad6[_0xe4b3('0x85')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xf6'));}if(!this[_0xe4b3('0x8c')](_0x3b4ad6[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}this[_0xe4b3('0x11')][_0xe4b3('0xf7')]=!![];this['createSquareDetailsReport'](_0x3b4ad6);this['createSquareMessage'](_0x3b4ad6[_0xe4b3('0x62')],'in','','');this[_0xe4b3('0x11')]['noop'](util[_0xe4b3('0x2b')](_0xe4b3('0xf8'),_0x3b4ad6[_0xe4b3('0x62')]));var _0x4d590f=this['googleDialogflowV2'][_0xe4b3('0x75')](this,_0x3b4ad6);if(_0x4d590f){for(var _0x41838d in _0x4d590f){if(_0x4d590f[_0xe4b3('0x9a')](_0x41838d)){if(_0x41838d!=='providerResponse'){this['channel']['setVariable'](util[_0xe4b3('0x2b')](_0xe4b3('0xf9'),_0x41838d[_0xe4b3('0xf0')]()),_0x4d590f[_0x41838d]);}}}this[_0xe4b3('0x44')](_0x4d590f[_0xe4b3('0xf3')],_0xe4b3('0xf1'),_0xe4b3('0xfa'),_0x4d590f['providerResponse']);return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xfb'),_0x4d590f[_0xe4b3('0xf3')]));}return this[_0xe4b3('0x11')]['error'](_0x3b4ad6,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xfc')]=function(_0x35585e){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0xfd'),_0x35585e['label']));if(!this[_0xe4b3('0x8c')](_0x35585e[_0xe4b3('0xfe')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xff'));}if(!this[_0xe4b3('0x8c')](_0x35585e[_0xe4b3('0x100')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('no\x20username\x20configured');}if(!this[_0xe4b3('0x8c')](_0x35585e[_0xe4b3('0x101')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x102'));}if(!this['isConfigured'](_0x35585e[_0xe4b3('0x103')])){return this['channel'][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}this['channel'][_0xe4b3('0xf7')]=!![];this['createSquareDetailsReport'](_0x35585e);this['createSquareMessage'](_0x35585e['text'],'in','','');this['channel']['noop'](util[_0xe4b3('0x2b')](_0xe4b3('0x104'),_0x35585e['text']));var _0x294ced=this['sestekNDA'][_0xe4b3('0x75')](this,_0x35585e);if(_0x294ced){for(var _0x53fa95 in _0x294ced){if(_0x294ced[_0xe4b3('0x9a')](_0x53fa95)){this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util['format']('SESTEK_NDA_%s',_0x53fa95[_0xe4b3('0xf0')]()),_0x294ced[_0x53fa95]);}}this[_0xe4b3('0x44')](_0x294ced[_0xe4b3('0xf3')],_0xe4b3('0xf1'),_0xe4b3('0xfc'),'');if(_0x294ced['audiofile']){this['channel'][_0xe4b3('0xaf')](util['format'](_0xe4b3('0x105'),_0x294ced['audiofile']));var _0x4085a6=this['channel']['streamFile'](_0x294ced[_0xe4b3('0x106')]);try{fs[_0xe4b3('0x107')](_0x294ced[_0xe4b3('0x106')]+'.wav');}catch(_0x29ad59){logger['error'](_0x29ad59);}return _0x4085a6;}else{return this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x108'),_0x294ced['speech']));}}return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x35585e,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xe4b3('0x13')]['end']=function(_0x48fca7){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x109'),_0x48fca7[_0xe4b3('0xae')]));return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0x10a'));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x10b')]=function(_0x236fa8){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x10c'),_0x236fa8['label']));var _0x414ad2='';if(_0x236fa8[_0xe4b3('0x10d')]){if(!this[_0xe4b3('0x8c')](_0x236fa8['trunk_id'])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x236fa8,_0xe4b3('0x10e'));}else{var _0x3122f8=parseInt(_0x236fa8['trunk_id'],0xa);if(isNaN(_0x3122f8)){_0x414ad2=_0x236fa8[_0xe4b3('0x10d')];}else{_0x414ad2=this[_0xe4b3('0x1f')][_0xe4b3('0x75')](this,_0x236fa8[_0xe4b3('0x10d')]);if(!_0x414ad2){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x236fa8,_0xe4b3('0x10f'));}}}}else if(_0x236fa8[_0xe4b3('0x110')]){_0x414ad2=_0x236fa8[_0xe4b3('0x110')];}else{return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x236fa8,_0xe4b3('0x10e'));}var _0x2732d2=this['channel'][_0xe4b3('0x5d')](_0xe4b3('0xe9'),[util[_0xe4b3('0x2b')](_0xe4b3('0x111'),_0x414ad2,_0x236fa8[_0xe4b3('0x4b')]),_0x236fa8['timeout'],_0x236fa8['opts'],_0x236fa8[_0xe4b3('0x6b')]]);if(_0x2732d2['result']===-0x1){return _0x2732d2;}return this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xec'),_0xe4b3('0xe9')));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x112')]=function(_0x401aea){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x401aea['label']));return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('finally');};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x113')]=function(_0x4fd6e4){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x114'),_0x4fd6e4['label']));if(_0x4fd6e4[_0xe4b3('0xac')]===0x0){return this[_0xe4b3('0xab')](_0x4fd6e4);}_0x4fd6e4['retry']-=0x1;if(!this[_0xe4b3('0x8c')](_0x4fd6e4['file_id'])){return this[_0xe4b3('0x11')]['error'](_0x4fd6e4,_0xe4b3('0x115'));}var _0x216449=this[_0xe4b3('0x116')][_0xe4b3('0x75')](this,_0x4fd6e4[_0xe4b3('0x117')]);if(!_0x216449){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4fd6e4,_0xe4b3('0x118'));}if(!this[_0xe4b3('0x8c')](_0x4fd6e4['variable_id'])){return this['channel'][_0xe4b3('0x55')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x23197c=this[_0xe4b3('0x11')][_0xe4b3('0x119')](_0x216449,_0x4fd6e4[_0xe4b3('0x11a')],_0x4fd6e4[_0xe4b3('0x11b')]);var _0x4b9107=_0x23197c[_0xe4b3('0xa9')]?_0x23197c['result'][_0xe4b3('0x50')]():'';logger[_0xe4b3('0x30')](_0xe4b3('0x11c'),JSON['stringify'](_0x23197c));if(_0x23197c[_0xe4b3('0xa9')]===-0x1){this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x4fd6e4,_0x4b9107);return _0x23197c;}else if(_0x23197c[_0xe4b3('0xa7')]===_0xe4b3('0x6c')){_0x23197c[_0xe4b3('0xa9')]=_0x4b9107['length']>=parseInt(_0x4fd6e4[_0xe4b3('0x11d')])?'x':'i';}else{_0x23197c[_0xe4b3('0xa9')]=_0x4b9107[_0xe4b3('0xa0')]>=parseInt(_0x4fd6e4[_0xe4b3('0x11d')])&&_0x4b9107[_0xe4b3('0xa0')]<=parseInt(_0x4fd6e4[_0xe4b3('0x11b')])?'x':'i';}var _0x176f11=this[_0xe4b3('0x14')]['sync'](this,_0x4fd6e4[_0xe4b3('0xdd')]);if(!_0x176f11){return this[_0xe4b3('0x11')]['error'](_0x4fd6e4,_0xe4b3('0xdf'));}this[_0xe4b3('0x11')]['setVariable'](_0x176f11,_0x4b9107);if(this[_0xe4b3('0x8c')](_0x4fd6e4[_0xe4b3('0x11e')])){var _0x13c9eb=parseInt(_0x4fd6e4[_0xe4b3('0x11e')],0xa);var _0x5b0330=rs[_0xe4b3('0x11f')]({'charset':'*','length':_0x13c9eb});var _0x2a9989=_0x4b9107[_0xe4b3('0xa0')];if(_0x2a9989>0x0){if(_0x2a9989>_0x13c9eb){this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x4fd6e4,_0x4fd6e4['hiddendigitspos']===_0xe4b3('0x120')?_0x5b0330+_0x4b9107[_0xe4b3('0x121')](_0x13c9eb):_0x4b9107[_0xe4b3('0x121')](0x0,_0x2a9989-_0x13c9eb)+_0x5b0330);}else{this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x4fd6e4,rs['generate']({'charset':'*','length':_0x2a9989}));}}else{this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x4fd6e4,'');}}else{this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x4fd6e4,_0x4b9107);}return _0x23197c;};AGIVertices['prototype'][_0xe4b3('0x10')]=function(_0x618993){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0x122'),_0x618993[_0xe4b3('0xae')]));return this['getdigits'](_0x618993);};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x123')]=function(_0x438ce1){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x438ce1[_0xe4b3('0xae')]));this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x438ce1,_0x438ce1[_0xe4b3('0x124')]);return this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('GOAL\x20%s',_0x438ce1[_0xe4b3('0x124')]));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x125')]=function(_0x5647cd){logger[_0xe4b3('0x30')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5647cd[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x5647cd['aws_access_key_id'])||!this['isConfigured'](_0x5647cd[_0xe4b3('0x94')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe4b3('0x8c')](_0x5647cd[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x126'),_0x5647cd[_0xe4b3('0x62')]));var _0x13019b=this[_0xe4b3('0x8e')][_0xe4b3('0x75')](this,_0x5647cd);if(_0x13019b){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x13019b));var _0x23cb7d=this[_0xe4b3('0x11')][_0xe4b3('0x127')](_0x13019b);try{fs['unlink'](_0x13019b+_0xe4b3('0x128'));}catch(_0xcafeb4){logger[_0xe4b3('0x55')](_0xcafeb4);}return _0x23cb7d;}return this['channel'][_0xe4b3('0x55')](_0x5647cd,_0xe4b3('0x129'));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x12a')]=function(_0x7a6f3e){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x7a6f3e[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x7a6f3e['aws_access_key_id'])||!this[_0xe4b3('0x8c')](_0x7a6f3e['aws_secret_access_key'])){return this['channel']['noop'](_0xe4b3('0x12b'));}if(!this[_0xe4b3('0x8c')](_0x7a6f3e['aws_bot_name'])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x12c'));}if(!this['isConfigured'](_0x7a6f3e[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0xb0'));}this[_0xe4b3('0x11')][_0xe4b3('0xf7')]=!![];this['createSquareDetailsReport'](_0x7a6f3e);this['createSquareMessage'](_0x7a6f3e[_0xe4b3('0x62')],'in','','');this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x12d'),_0x7a6f3e[_0xe4b3('0x62')]));var _0x37c243=this[_0xe4b3('0x93')][_0xe4b3('0x75')](this,_0x7a6f3e);if(_0x37c243){for(var _0x1f5112 in _0x37c243){if(_0x37c243[_0xe4b3('0x9a')](_0x1f5112)&&_['isString'](_0x37c243[_0x1f5112])){this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util['format'](_0xe4b3('0x12e'),_0x1f5112[_0xe4b3('0xf0')]()),_0x37c243[_0x1f5112]);}}if(_[_0xe4b3('0x47')](_0x37c243[_0xe4b3('0x7c')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x12f'));}else{this[_0xe4b3('0x44')](_0x37c243[_0xe4b3('0x7c')],_0xe4b3('0xf1'),'amazonlex','');return this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x130'),_0x37c243[_0xe4b3('0x7c')]));}}return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x7a6f3e,_0xe4b3('0x131'));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x132')]=function(_0x3ab631){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x133'),_0x3ab631['label'],_0x3ab631['timeout']));if(!this[_0xe4b3('0x8c')](_0x3ab631[_0xe4b3('0x80')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xef'));}var _0x5af55f=_0xe4b3('0x134');var _0x1e0a0e=util['format'](_0xe4b3('0x135'),FILES_PATH,rs[_0xe4b3('0x11f')](0x4));var _0x1918a0=util[_0xe4b3('0x2b')](_0xe4b3('0xa3'),_0x1e0a0e,_0x5af55f);var _0x108568=!![];if(_0x3ab631['beep']==='NOBEEP'){_0x108568=![];}var _0x42c1c8=this[_0xe4b3('0x11')]['recordFile'](_0x1e0a0e,_0x5af55f,_0x3ab631[_0xe4b3('0x136')],_0x3ab631['timeout'],undefined,_0x108568);if(_0x42c1c8[_0xe4b3('0xa9')]!==-0x1){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x137'),_0x1918a0));var _0x349b28=this[_0xe4b3('0x96')]['sync'](this,_0x3ab631,_0x1918a0);if(_0x349b28){for(var _0x34752e in _0x349b28){if(_0x349b28[_0xe4b3('0x9a')](_0x34752e)){this['channel'][_0xe4b3('0xa4')](util[_0xe4b3('0x2b')](_0xe4b3('0x138'),_0x34752e[_0xe4b3('0xf0')]()),_0x349b28[_0x34752e]);}}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x139'),JSON['stringify'](_0x349b28)));}}return _0x42c1c8;};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x13a')]=function(_0x3e24bf){logger['info'](util[_0xe4b3('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3e24bf['label']));if(!this[_0xe4b3('0x8c')](_0x3e24bf['appid'])){return this['channel'][_0xe4b3('0xaf')](_0xe4b3('0x13b'));}if(!this['isConfigured'](_0x3e24bf['appsecret'])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('no\x20appsecret\x20configured');}var _0x554d9f=_0xe4b3('0x134');var _0x5af8c5=util['format'](_0xe4b3('0x135'),FILES_PATH,rs['generate'](0x4));var _0x369cf4=util[_0xe4b3('0x2b')]('%s.%s',_0x5af8c5,_0x554d9f);var _0xfb08a=!![];if(_0x3e24bf[_0xe4b3('0x13c')]===_0xe4b3('0x13d')){_0xfb08a=![];}var _0x21958b=this['channel']['recordFile'](_0x5af8c5,_0x554d9f,_0x3e24bf['intKey'],_0x3e24bf['timeout'],undefined,_0xfb08a);if(_0x21958b[_0xe4b3('0xa9')]!==-0x1){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x13e'),_0x369cf4));var _0x5bfbb4=this[_0xe4b3('0x97')][_0xe4b3('0x75')](this,_0x3e24bf,_0x369cf4);if(_0x5bfbb4){for(var _0x3e9172 in _0x5bfbb4){if(_0x5bfbb4[_0xe4b3('0x9a')](_0x3e9172)){this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util[_0xe4b3('0x2b')](_0xe4b3('0x13f'),_0x3e9172['toUpperCase']()),_0x5bfbb4[_0x3e9172]);}}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('TildeASR\x20Result\x20%s',JSON[_0xe4b3('0x78')](_0x5bfbb4)));}}return _0x21958b;};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x140')]=function(_0x247d18){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x141'),_0x247d18['label']));return this[_0xe4b3('0x11')][_0xe4b3('0x142')](_0x247d18[_0xe4b3('0x3e')],_0x247d18[_0xe4b3('0x3f')],_0x247d18[_0xe4b3('0x40')]);};AGIVertices['prototype'][_0xe4b3('0x143')]=function(_0x2df5ad){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x144'),_0x2df5ad['label']));if(!this[_0xe4b3('0x8c')](_0x2df5ad[_0xe4b3('0x145')])){return this['channel']['error'](_0x2df5ad,_0xe4b3('0x146'));}try{var _0x1f2eef=eval(_0x2df5ad[_0xe4b3('0x145')])?'true':'false';this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x147'),_0x2df5ad['condition'],_0x1f2eef));return{'code':0xc8,'result':_0x1f2eef};}catch(_0x1973cf){return{'code':0xc8,'result':_0xe4b3('0x148')};}};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x149')]=function(_0x234136){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x14a'),_0x234136[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x234136[_0xe4b3('0x14b')])){return this[_0xe4b3('0x11')]['error'](_0x234136,_0xe4b3('0x14c'));}var _0x54ec18=this[_0xe4b3('0x25')][_0xe4b3('0x75')](this,_0x234136[_0xe4b3('0x14b')]);if(!_0x54ec18){return this['channel'][_0xe4b3('0x55')](_0x234136,_0xe4b3('0x14d'));}for(var _0x4b53ee=0x0;_0x4b53ee<_0x54ec18['length'];_0x4b53ee+=0x1){var _0x6c76bc=this[_0xe4b3('0x11')][_0xe4b3('0x14')](util['format']('IFTIME(%s?true:false)',_0x54ec18[_0x4b53ee]));if(_0x6c76bc[_0xe4b3('0xa9')]===-0x1){return _0x6c76bc;}logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x14e'),_0x54ec18[_0x4b53ee],_0x6c76bc['extra']));if(_0x6c76bc[_0xe4b3('0xa7')]===_0xe4b3('0x14f')){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x14e'),_0x54ec18[_0x4b53ee],_0xe4b3('0x14f')));this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x14e'),_0x54ec18[_0x4b53ee],_0xe4b3('0x14f')));return{'code':0xc8,'result':_0xe4b3('0x14f')};}else{logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('IFTIME\x20%s\x20%s',_0x54ec18[_0x4b53ee],_0xe4b3('0x148')));this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x14e'),_0x54ec18[_0x4b53ee],_0xe4b3('0x148')));}}return{'code':0xc8,'result':_0xe4b3('0x148')};};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x150')]=function(_0x50ac1d){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x151'),_0x50ac1d['label']));return this[_0xe4b3('0x11')][_0xe4b3('0x150')]();};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x152')]=function(_0x4e9c0d){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x153'),_0x4e9c0d['label']));if(!this[_0xe4b3('0x8c')](_0x4e9c0d[_0xe4b3('0x80')])){return this['channel'][_0xe4b3('0xaf')](_0xe4b3('0xef'));}var _0x2bb947='wav';var _0x416883=util[_0xe4b3('0x2b')](_0xe4b3('0x135'),FILES_PATH,rs[_0xe4b3('0x11f')](0x4));var _0x477331=util[_0xe4b3('0x2b')]('%s.%s',_0x416883,_0x2bb947);var _0x29ed38=!![];if(_0x4e9c0d[_0xe4b3('0x13c')]==='NOBEEP'){_0x29ed38=![];}var _0x424627=this[_0xe4b3('0x11')][_0xe4b3('0x154')](_0x416883,_0x2bb947,_0x4e9c0d['intKey'],_0x4e9c0d[_0xe4b3('0x6c')],undefined,_0x29ed38);if(_0x424627[_0xe4b3('0xa9')]!==-0x1){this[_0xe4b3('0x11')]['noop'](util[_0xe4b3('0x2b')]('ispeech\x20%s\x20file\x20created',_0x477331));var _0x46430a=this[_0xe4b3('0x8b')][_0xe4b3('0x75')](this,_0x4e9c0d,_0x477331);if(_0x46430a){for(var _0x56fd9c in _0x46430a){if(_0x46430a[_0xe4b3('0x9a')](_0x56fd9c)){this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util['format']('ISPEECH_ASR_%s',_0x56fd9c['toUpperCase']()),_0x46430a[_0x56fd9c]);}}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format'](_0xe4b3('0x155'),JSON[_0xe4b3('0x78')](_0x46430a)));}}return _0x424627;};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x156')]=function(_0x4ea017){logger[_0xe4b3('0x30')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4ea017[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x4ea017[_0xe4b3('0x80')])){return this['channel'][_0xe4b3('0xaf')]('no\x20key\x20configured');}if(!this[_0xe4b3('0x8c')](_0x4ea017[_0xe4b3('0x62')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0xb0'));}this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format'](_0xe4b3('0x157'),_0x4ea017[_0xe4b3('0x62')]));var _0x53fc10=this[_0xe4b3('0x87')][_0xe4b3('0x75')](this,_0x4ea017);if(_0x53fc10){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('ispeech\x20%s\x20file\x20created',_0x53fc10));var _0x5c78d8=this[_0xe4b3('0x11')][_0xe4b3('0x127')](_0x53fc10,_0x4ea017['intKey']);try{fs[_0xe4b3('0x107')](_0x53fc10+_0xe4b3('0x128'));}catch(_0x5eefd3){logger[_0xe4b3('0x55')](_0x5eefd3);}return _0x5c78d8;}return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4ea017,_0xe4b3('0x158'));};AGIVertices['prototype'][_0xe4b3('0x159')]=function(_0x25b4c5){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15a'),_0x25b4c5[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x25b4c5[_0xe4b3('0x15b')])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x25b4c5,'no\x20find\x20by\x20configured');}logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15c'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x25b4c5[_0xe4b3('0x15b')]));var _0x59f7d9=this['agentLogin'][_0xe4b3('0x75')](this,_0x25b4c5['findBy']);if(_0x59f7d9){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x15d'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x25b4c5[_0xe4b3('0x15b')]));this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x15d'),this[_0xe4b3('0x11')]['callerid'],_0x25b4c5[_0xe4b3('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15e'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x25b4c5['findBy']));this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x15e'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x25b4c5[_0xe4b3('0x15b')]));return{'code':0xc8,'result':_0xe4b3('0x15f')};}};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x160')]=function(_0x105194){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x105194[_0xe4b3('0xae')]));if(!this['isConfigured'](_0x105194[_0xe4b3('0x15b')])){return this['channel'][_0xe4b3('0x55')](_0x105194,_0xe4b3('0x161'));}logger[_0xe4b3('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe4b3('0x11')]['callerid'],_0x105194[_0xe4b3('0x15b')]));var _0x863507=this[_0xe4b3('0x58')]['sync'](this,_0x105194[_0xe4b3('0x15b')]);if(_0x863507){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x105194['findBy']));this[_0xe4b3('0x11')]['noop'](util[_0xe4b3('0x2b')](_0xe4b3('0x15d'),this['channel'][_0xe4b3('0x3a')],_0x105194[_0xe4b3('0x15b')]));return{'code':0xc8,'result':_0xe4b3('0x162')};}else{logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15e'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x105194[_0xe4b3('0x15b')]));this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x15e'),this[_0xe4b3('0x11')]['callerid'],_0x105194[_0xe4b3('0x15b')]));return{'code':0xc8,'result':_0xe4b3('0x15f')};}};AGIVertices['prototype'][_0xe4b3('0x163')]=function(_0x24912a){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0x164'),_0x24912a[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x24912a['operation'])){return this['channel'][_0xe4b3('0x55')](_0x24912a,_0xe4b3('0x165'));}this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('math\x20%s',_0x24912a['operation']));var _0x34ea9b=eval(_0x24912a[_0xe4b3('0x166')]);if(!this[_0xe4b3('0x8c')](_0x24912a[_0xe4b3('0xdd')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xde'));}var _0x5973ff=this[_0xe4b3('0x14')][_0xe4b3('0x75')](this,_0x24912a[_0xe4b3('0xdd')]);if(!_0x5973ff){return this['channel']['error'](_0x24912a,_0xe4b3('0xdf'));}if(_[_0xe4b3('0x9f')](_0x34ea9b)){var _0x30df74=this;_0x34ea9b[_0xe4b3('0xe0')](function(_0x196ace,_0x38696f){_0x30df74[_0xe4b3('0x11')][_0xe4b3('0xa4')](util[_0xe4b3('0x2b')]('%s[%s]',_0x5973ff,_0x38696f),_0x196ace);});return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format'](_0xe4b3('0x167'),_0x5973ff));}else{return this['channel']['setVariable'](_0x5973ff,_0x34ea9b);}};AGIVertices['prototype'][_0xe4b3('0xf')]=function(_0x4c9889){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x168'),_0x4c9889[_0xe4b3('0xae')]));if(_0x4c9889['retry']===0x0){return this[_0xe4b3('0xab')](_0x4c9889);}_0x4c9889[_0xe4b3('0xac')]-=0x1;if(!this['isConfigured'](_0x4c9889[_0xe4b3('0x117')])){return this[_0xe4b3('0x11')]['error'](_0x4c9889,_0xe4b3('0x115'));}var _0x16a729=this[_0xe4b3('0x116')]['sync'](this,_0x4c9889[_0xe4b3('0x117')]);if(!_0x16a729){return this['channel'][_0xe4b3('0x55')](_0x4c9889,_0xe4b3('0x118'));}var _0x1bde31=this[_0xe4b3('0x11')][_0xe4b3('0x119')](_0x16a729,_0x4c9889['response'],_0x4c9889['digit']);var _0x4fd48f=_0x1bde31['result'];if(_0x1bde31[_0xe4b3('0xa9')]===-0x1){this[_0xe4b3('0x38')]['sync'](this,_0x4c9889,'-1');return _0x1bde31;}else if(_0x1bde31['extra']==='timeout'){_0x1bde31[_0xe4b3('0xa9')]=_0x1bde31[_0xe4b3('0xa9')][_0xe4b3('0xa0')]>0x0?_0x1bde31[_0xe4b3('0xa9')]:'t';}else if(_['isEmpty'](_0x1bde31['result'])){_0x1bde31[_0xe4b3('0xa9')]='#';_0x4fd48f='#';}if(!this['isConfigured'](_0x4c9889[_0xe4b3('0xdd')])){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0xde'));}else{var _0x3c12c7=this['getVariable']['sync'](this,_0x4c9889['variable_id']);if(!_0x3c12c7){return this['channel']['error'](_0x4c9889,_0xe4b3('0xdf'));}this[_0xe4b3('0x11')][_0xe4b3('0xa4')](_0x3c12c7,_0x4fd48f);}this['createSquareDetailsReport'][_0xe4b3('0x75')](this,_0x4c9889,_0x4fd48f);return _0x1bde31;};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0xaf')]=function(_0x5aafd5){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x169'),_0x5aafd5['label']));return this[_0xe4b3('0x11')]['noop'](_0x5aafd5[_0xe4b3('0x16a')]||_0x5aafd5[_0xe4b3('0xae')]);};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x16b')]=function(_0x4d3b80){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x16c'),_0x4d3b80[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x4d3b80[_0xe4b3('0x15b')])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4d3b80,_0xe4b3('0x161'));}logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15c'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x4d3b80[_0xe4b3('0x15b')]));var _0x4e269a=this[_0xe4b3('0x52')][_0xe4b3('0x75')](this,_0x4d3b80[_0xe4b3('0x16d')]);var _0x2d7e4f=this[_0xe4b3('0x54')]['sync'](this,_0x4d3b80[_0xe4b3('0x15b')],_0x4e269a);if(_0x2d7e4f){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x4d3b80[_0xe4b3('0x15b')]));this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x15d'),this['channel'][_0xe4b3('0x3a')],_0x4d3b80[_0xe4b3('0x15b')]));return{'code':0xc8,'result':_0xe4b3('0x162')};}else{logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15e'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x4d3b80[_0xe4b3('0x15b')]));this[_0xe4b3('0x11')]['noop'](util['format'](_0xe4b3('0x15d'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x4d3b80[_0xe4b3('0x15b')]));return{'code':0xc8,'result':_0xe4b3('0x15f')};}};AGIVertices['prototype'][_0xe4b3('0x16e')]=function(_0x424506){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x16f'),_0x424506[_0xe4b3('0xae')]));if(!this['isConfigured'](_0x424506[_0xe4b3('0x117')])){return this['channel'][_0xe4b3('0x55')](_0x424506,_0xe4b3('0x115'));}var _0x55fca8=this['getSound']['sync'](this,_0x424506[_0xe4b3('0x117')]);if(!_0x55fca8){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x424506,'no\x20file\x20audio\x20found');}var _0x949d1e=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0xe4b3('0x170'),[_0x55fca8,_0x424506[_0xe4b3('0xeb')]]);if(_0x949d1e['result']===-0x1){return _0x949d1e;}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('Executed\x20command\x20%s\x20%s',_0xe4b3('0x170'),_0x55fca8));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x171')]=function(_0x383830){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x172'),_0x383830[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x383830[_0xe4b3('0x173')])){return this[_0xe4b3('0x11')]['error'](_0x383830,_0xe4b3('0x174'));}var _0x3f38ac='';var _0x445275=parseInt(_0x383830[_0xe4b3('0x173')],0xa);if(isNaN(_0x445275)){_0x3f38ac=_0x383830['queue_id'];}else{_0x3f38ac=this['getVoiceQueue'][_0xe4b3('0x75')](this,_0x383830[_0xe4b3('0x173')]);if(!_0x3f38ac){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x383830,'no\x20queue\x20found');}}var _0x14209f='';if(this[_0xe4b3('0x8c')](_0x383830[_0xe4b3('0x117')])){var _0x5a4b28=this[_0xe4b3('0x116')][_0xe4b3('0x75')](this,_0x383830['file_id']);if(_0x5a4b28){_0x14209f=_0x5a4b28;}}this['createSquareDetailsReport'][_0xe4b3('0x75')](this,_0x383830,_0x3f38ac);if(_0x383830[_0xe4b3('0xeb')][_0xe4b3('0x175')]('x')<0x0){_0x383830[_0xe4b3('0xeb')]+='x';}if(_0x383830['opts'][_0xe4b3('0x175')]('X')<0x0){_0x383830['opts']+='X';}this['channel'][_0xe4b3('0xa4')](_0xe4b3('0x176'),_0x3f38ac?_0x3f38ac['toLowerCase']():'');var _0x3ffa95=this[_0xe4b3('0x11')]['exec'](_0xe4b3('0x177'),[_0x3f38ac,_0x383830['opts'],_0x383830[_0xe4b3('0x6b')],_0x14209f,_0x383830['timeout'],_0x383830[_0xe4b3('0x9')],_0x383830[_0xe4b3('0x178')],_0x383830[_0xe4b3('0x179')],'',_0x383830[_0xe4b3('0x17a')]]);if(_0x3ffa95[_0xe4b3('0xa9')]===-0x1){return _0x3ffa95;}return this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xcb'),_0xe4b3('0x177'),_0x3f38ac));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x17b')]=function(_0x300113){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x17c'),_0x300113['label']));var _0x1e382e=_0x300113[_0xe4b3('0x17d')]||'wav';var _0x24413c=util[_0xe4b3('0x2b')](_0xe4b3('0x17e'),this[_0xe4b3('0x11')][_0xe4b3('0x3c')],rs[_0xe4b3('0x11f')](0x5));var _0x4d67aa=util['format'](_0xe4b3('0x17f'),FILES_PATH,_0x24413c,_0x1e382e);var _0xe1d5d6=util['format'](_0xe4b3('0x135'),FILES_PATH,_0x24413c);this[_0xe4b3('0x3b')][_0xe4b3('0x75')](this,_0x300113,_0x24413c,_0x4d67aa);this['channel'][_0xe4b3('0xa4')](_0xe4b3('0x180'),_0x24413c);logger[_0xe4b3('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xe1d5d6,_0x1e382e,_0x300113[_0xe4b3('0x181')],_0x300113[_0xe4b3('0x6c')]);return this[_0xe4b3('0x11')][_0xe4b3('0x154')](_0xe1d5d6,_0x1e382e,_0x300113['escape_digits'],_0x300113[_0xe4b3('0x6c')],undefined,!![]);};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x182')]=function(_0x30c1da){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x183'),_0x30c1da[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x30c1da['url'])){return this[_0xe4b3('0x11')]['noop']('no\x20url\x20configured');}var _0x540fab=this[_0xe4b3('0x6a')][_0xe4b3('0x75')](this,_0x30c1da);logger[_0xe4b3('0x30')](util['format']('Response:',util[_0xe4b3('0x184')](_0x540fab,{'showHidden':![],'depth':null})));if(!this[_0xe4b3('0x8c')](_0x30c1da[_0xe4b3('0xdd')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0x185'));}var _0x2a590e=this[_0xe4b3('0x14')][_0xe4b3('0x75')](this,_0x30c1da[_0xe4b3('0xdd')]);if(!_0x2a590e){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x30c1da,_0xe4b3('0xdf'));}this[_0xe4b3('0x11')][_0xe4b3('0xa4')](util[_0xe4b3('0x2b')](_0xe4b3('0x186'),_0x2a590e),_0x540fab[_0xe4b3('0x7b')]?_0x540fab[_0xe4b3('0x7b')]:'200');this['channel'][_0xe4b3('0xa4')](util[_0xe4b3('0x2b')](_0xe4b3('0x187'),_0x2a590e),_0x540fab[_0xe4b3('0x188')]?_0x540fab[_0xe4b3('0x188')]:'OK');if(_0x540fab[_0xe4b3('0x79')]){try{this['saveRestApiResult'](_0x540fab[_0xe4b3('0x79')],_0x2a590e);}catch(_0x13110a){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2a590e));}}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0xe4'),_0x2a590e));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x189')]=function(_0x2ccb8b){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0x18a'),_0x2ccb8b['label']));return this[_0xe4b3('0x11')][_0xe4b3('0x18b')](_0x2ccb8b['digits']['replace'](/\s+/g,''),_0x2ccb8b['escape_digits']);};AGIVertices['prototype'][_0xe4b3('0x18c')]=function(_0x4eef42){logger[_0xe4b3('0x30')](util['format'](_0xe4b3('0x18d'),_0x4eef42['label']));return this[_0xe4b3('0x11')][_0xe4b3('0x18e')](_0x4eef42[_0xe4b3('0x18f')]['replace'](/\s+/g,''),_0x4eef42[_0xe4b3('0x181')]);};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x190')]=function(_0xfdbaf7){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x191'),_0xfdbaf7[_0xe4b3('0xae')]));return this['channel'][_0xe4b3('0x192')](_0xfdbaf7[_0xe4b3('0x62')],_0xfdbaf7[_0xe4b3('0x181')]);};AGIVertices['prototype']['sendMail']=function(_0x81e6fb){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x193'),_0x81e6fb[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x81e6fb[_0xe4b3('0x194')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x195'));}var _0x4bedd7=this['getMailAccount'][_0xe4b3('0x75')](this,_0x81e6fb[_0xe4b3('0x194')]);if(!_0x4bedd7||!_0x4bedd7[_0xe4b3('0x196')]){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x81e6fb,_0xe4b3('0x197'));}var _0x355db0={'from':util[_0xe4b3('0x2b')](_0xe4b3('0x198'),_0x4bedd7[_0xe4b3('0x17')],_0x4bedd7[_0xe4b3('0x199')]||_0x4bedd7['Smtp']['user']),'to':_0x81e6fb['to']||'','cc':_0x81e6fb['cc']||'','bcc':_0x81e6fb[_0xe4b3('0x19a')]||'','subject':_0x81e6fb['subject'],'html':_0x81e6fb['text'],'text':_0x81e6fb[_0xe4b3('0x62')]};var _0x592d80={'tls':{'rejectUnauthorized':![]}};if(_0x4bedd7[_0xe4b3('0x196')][_0xe4b3('0x19b')]){_0x592d80[_0xe4b3('0x19b')]=_0x4bedd7[_0xe4b3('0x196')][_0xe4b3('0x19b')];}else{_0x592d80[_0xe4b3('0x19c')]=_0x4bedd7[_0xe4b3('0x196')][_0xe4b3('0x19c')];_0x592d80[_0xe4b3('0x19d')]=_0x4bedd7[_0xe4b3('0x196')][_0xe4b3('0x19d')];_0x592d80[_0xe4b3('0x19e')]=_0x4bedd7[_0xe4b3('0x196')][_0xe4b3('0x19e')];}if(_0x4bedd7[_0xe4b3('0x196')][_0xe4b3('0x19f')]){_0x592d80['auth']={'user':_0x4bedd7[_0xe4b3('0x196')]['user'],'pass':_0x4bedd7['Smtp'][_0xe4b3('0x1a0')]};}if(this['isConfigured'](_0x81e6fb[_0xe4b3('0x1a1')])){}logger[_0xe4b3('0x1a2')](_0xe4b3('0x1a3'),JSON['stringify'](_0x355db0));this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x81e6fb,_0x81e6fb[_0xe4b3('0x194')]);this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x1a4'),_0x4bedd7[_0xe4b3('0x17')]));this['sendMailMessage'][_0xe4b3('0x75')](this,_0x592d80,_0x355db0);return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xe4b3('0x1a5')]=function(_0x48d284){logger['info'](util[_0xe4b3('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x48d284['label']));return this[_0xe4b3('0x11')][_0xe4b3('0xaf')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xe4b3('0x13')]['sendSMS']=function(_0x1b2486){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1a6'),_0x1b2486[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x1b2486[_0xe4b3('0x1a7')])){return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x1a8'));}var _0x362b7a=this[_0xe4b3('0x36')][_0xe4b3('0x75')](this,_0x1b2486[_0xe4b3('0x1a7')]);if(!_0x362b7a){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x1b2486,_0xe4b3('0x1a9'));}var _0x420ae0={'body':_0x1b2486[_0xe4b3('0x1aa')],'phone':_0x1b2486['to']||'','SmsAccountId':_0x362b7a['id']};logger[_0xe4b3('0x1a2')](_0xe4b3('0x1ab'),JSON[_0xe4b3('0x78')](_0x420ae0));this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x1b2486,_0x1b2486[_0xe4b3('0x1a7')]);this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x1ac'),_0x362b7a['name']));this['createSmsMessage'][_0xe4b3('0x75')](this,_0x420ae0);return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x1ad'));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1ae')]=function(_0x4bc351){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1af'),_0x4bc351[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x4bc351['variable_id'])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x4bc351,_0xe4b3('0x1b0'));}var _0x1e0848=this['getVariable'][_0xe4b3('0x75')](this,_0x4bc351[_0xe4b3('0xdd')]);if(!_0x1e0848){return this['channel'][_0xe4b3('0x55')](_0x4bc351,_0xe4b3('0xdf'));}return this[_0xe4b3('0x11')][_0xe4b3('0xa4')](_0x1e0848,_0x4bc351['variable_value']);};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1b1')]=function(_0x13518f){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1b2'),_0x13518f['label']));this['channel'][_0xe4b3('0xaf')](_0xe4b3('0x1b3'));if(_0x13518f[_0xe4b3('0xc2')]===_0xe4b3('0x1b4')){this['channel'][_0xe4b3('0xaf')](_0xe4b3('0x1b5'));return this[_0xe4b3('0x11')]['answer']();}return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](_0xe4b3('0x1b6'));};AGIVertices['prototype'][_0xe4b3('0x1b7')]=function(_0x39b4c7){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x39b4c7[_0xe4b3('0xae')]));if(!this['isConfigured'](_0x39b4c7[_0xe4b3('0x1b8')])){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x39b4c7,_0xe4b3('0x1b9'));}var _0x498f82=this[_0xe4b3('0x1ba')][_0xe4b3('0x75')](this,_0x39b4c7['project_id']);if(!this['isConfigured'](_0x498f82)){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x39b4c7,util[_0xe4b3('0x2b')](_0xe4b3('0x1bb'),_0x39b4c7[_0xe4b3('0x1b8')]));}if(_0x498f82===this[_0xe4b3('0x11')][_0xe4b3('0x43')]){return this['channel'][_0xe4b3('0x55')](_0x39b4c7,_0xe4b3('0x1bc'));}this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x39b4c7,_0x498f82);var _0x95e5bd=this[_0xe4b3('0x11')]['exec'](_0xe4b3('0x1bd'),util['format'](_0xe4b3('0x1be'),config['agi'][_0xe4b3('0x19c')]||'127.0.0.1',_0x498f82,this[_0xe4b3('0x11')][_0xe4b3('0x43')]));if(_0x95e5bd[_0xe4b3('0xa9')]===-0x1){return _0x95e5bd;}return this[_0xe4b3('0x11')]['noop'](util[_0xe4b3('0x2b')]('Executed\x20command\x20%s\x20%s','AGI',_0x498f82));};AGIVertices['prototype'][_0xe4b3('0x1bf')]=function(_0x282a15){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1c0'),_0x282a15[_0xe4b3('0xae')]));var _0x2d1b24=this[_0xe4b3('0x5c')]['sync'](this,_0x282a15[_0xe4b3('0xbe')]);this[_0xe4b3('0x38')][_0xe4b3('0x75')](this,_0x282a15,_0x282a15['command']);if(this['isConfigured'](_0x282a15['variable_id'])){var _0x1de0be=this['getVariable']['sync'](this,_0x282a15[_0xe4b3('0xdd')]);if(_0x1de0be){this['channel'][_0xe4b3('0xa4')](_0x1de0be,_0x2d1b24);return this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x282a15[_0xe4b3('0xbe')],_0x1de0be));}}return this['channel'][_0xe4b3('0xaf')](util['format'](_0xe4b3('0x1c1'),_0x282a15[_0xe4b3('0xbe')]));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1c2')]=function(_0x141000){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1c3'),_0x141000[_0xe4b3('0xae')]));_0x141000[_0xe4b3('0x62')]=_0x141000['text'][_0xe4b3('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x141000[_0xe4b3('0x1c4')])){return this[_0xe4b3('0x11')]['noop'](_0xe4b3('0x1c5'));}if(!this[_0xe4b3('0x8c')](_0x141000[_0xe4b3('0x62')])){return this['channel'][_0xe4b3('0xaf')]('no\x20text\x20configured');}this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format'](_0xe4b3('0x1c6'),_0x141000[_0xe4b3('0x62')]));var _0x1e902f=this[_0xe4b3('0x60')][_0xe4b3('0x75')](this,_0x141000);if(_0x1e902f){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1e902f));var _0x539af8=this[_0xe4b3('0x11')][_0xe4b3('0x127')](_0x1e902f);try{fs['unlink'](_0x1e902f+_0xe4b3('0x128'));}catch(_0x238acd){logger['error'](_0x238acd);}return _0x539af8;}return this['channel'][_0xe4b3('0x55')](_0x141000,_0xe4b3('0x1c7'));};AGIVertices['prototype'][_0xe4b3('0x1c8')]=function(_0x51e423){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1c9'),_0x51e423[_0xe4b3('0xae')]));_0x51e423[_0xe4b3('0x62')]=_0x51e423['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe4b3('0x8c')](_0x51e423[_0xe4b3('0x62')])){return this['channel'][_0xe4b3('0xaf')](_0xe4b3('0xb0'));}this['channel'][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('Trying\x20Google\x20TTS\x20%s',_0x51e423[_0xe4b3('0x62')]));var _0x4ad4c6=this[_0xe4b3('0x68')][_0xe4b3('0x75')](this,_0x51e423);if(_0x4ad4c6){this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x4ad4c6));var _0x43474e=this[_0xe4b3('0x11')]['streamFile'](_0x4ad4c6);try{fs[_0xe4b3('0x107')](_0x4ad4c6+'.wav');}catch(_0x66e60e){logger[_0xe4b3('0x55')](_0x66e60e);}return _0x43474e;}return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x51e423,_0xe4b3('0x1ca'));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1cb')]=function(_0x3cc163){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3cc163['label']));if(!this['isConfigured'](_0x3cc163[_0xe4b3('0x15b')])){return this['channel'][_0xe4b3('0x55')](_0x3cc163,'no\x20find\x20by\x20configured');}logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x15c'),this[_0xe4b3('0x11')]['callerid'],_0x3cc163['findBy']));var _0x4e8cce=this[_0xe4b3('0x56')][_0xe4b3('0x75')](this,_0x3cc163[_0xe4b3('0x15b')]);if(_0x4e8cce){logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0x15d'),this[_0xe4b3('0x11')]['callerid'],_0x3cc163[_0xe4b3('0x15b')]));this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util[_0xe4b3('0x2b')](_0xe4b3('0x15d'),this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x3cc163['findBy']));return{'code':0xc8,'result':_0xe4b3('0x162')};}else{logger['info'](util[_0xe4b3('0x2b')](_0xe4b3('0x15e'),this['channel'][_0xe4b3('0x3a')],_0x3cc163[_0xe4b3('0x15b')]));this[_0xe4b3('0x11')][_0xe4b3('0xaf')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe4b3('0x11')][_0xe4b3('0x3a')],_0x3cc163[_0xe4b3('0x15b')]));return{'code':0xc8,'result':_0xe4b3('0x15f')};}};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1cc')]=function(_0xfcc884){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1cd'),_0xfcc884['label']));var _0x35dc85=this[_0xe4b3('0x11')][_0xe4b3('0x5d')](_0xe4b3('0x1ce'),[_0xfcc884[_0xe4b3('0x1cf')],_0xfcc884[_0xe4b3('0x7e')]]);if(_0x35dc85[_0xe4b3('0xa9')]===-0x1){return _0x35dc85;}return this[_0xe4b3('0x11')]['noop'](util[_0xe4b3('0x2b')](_0xe4b3('0xcb'),'VOICEMAIL',_0xfcc884[_0xe4b3('0x1cf')]));};AGIVertices[_0xe4b3('0x13')][_0xe4b3('0x1d0')]=function(_0x2abe5f){logger[_0xe4b3('0x30')](util[_0xe4b3('0x2b')](_0xe4b3('0x1d1'),_0x2abe5f[_0xe4b3('0xae')]));if(!this[_0xe4b3('0x8c')](_0x2abe5f[_0xe4b3('0xdd')])){return this['channel']['error'](_0x2abe5f,_0xe4b3('0x1b0'));}var _0x24c2e1=this[_0xe4b3('0x14')][_0xe4b3('0x75')](this,_0x2abe5f[_0xe4b3('0xdd')]);if(!_0x24c2e1){return this[_0xe4b3('0x11')][_0xe4b3('0x55')](_0x2abe5f,_0xe4b3('0xdf'));}var _0x44c63b=this[_0xe4b3('0x11')][_0xe4b3('0x14')](_0x24c2e1);return{'code':0xc8,'result':_0x44c63b[_0xe4b3('0xa7')]?_0x44c63b[_0xe4b3('0xa7')]:'-'};};String[_0xe4b3('0x13')]['replaceAll']=function(_0x45f1ba,_0x2de141){return this[_0xe4b3('0xa5')](_0x45f1ba)['join'](_0x2de141);};module['exports']=AGIVertices; \ No newline at end of file +var _0x19a7=['Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','channel','createSquareRecording','uniqueid','callerid','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','random','lastName','isNil','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','stringify','render','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','wait','answer','list_id','add','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','dialogflowV2','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','isString','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','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','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','Skipped\x20Answer','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','command','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','exports','path','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query'];(function(_0x1e2b52,_0x5c2829){var _0x13809a=function(_0x3812bd){while(--_0x3812bd){_0x1e2b52['push'](_0x1e2b52['shift']());}};_0x13809a(++_0x5c2829);}(_0x19a7,0x193));var _0x719a=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x19a7[_0x1da04e];return _0xdd8c41;};'use strict';var fs=require('fs');var path=require(_0x719a('0x0'));var util=require(_0x719a('0x1'));var _=require(_0x719a('0x2'));var sh=require(_0x719a('0x3'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x719a('0x4'));var Mustache=require(_0x719a('0x5'));var rp=require(_0x719a('0x6'));var logger=require(_0x719a('0x7'))('agi');var config=require(_0x719a('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x719a('0x9');var recursiveMapAttributes=[_0x719a('0xa'),_0x719a('0xb')];var verticesWithRetry=['menu',_0x719a('0xc'),_0x719a('0xd')];var AGIVertices=function(_0x878906,_0x4e6303,_0x16a13d){this['channel']=_0x878906;this['rpc']=_0x4e6303;this[_0x719a('0xe')]=_0x16a13d;};AGIVertices[_0x719a('0xf')][_0x719a('0x10')]=function(_0x4db016,_0x2a1305){this[_0x719a('0x11')][_0x719a('0x12')](_0x4db016)[_0x719a('0x13')](function(_0x42f966){_0x2a1305(null,_0x42f966?_0x42f966['name']:![]);})[_0x719a('0x14')](function(_0x42c1cf){_0x2a1305(_0x42c1cf);});};AGIVertices['prototype'][_0x719a('0x15')]=function(_0x281874,_0x1a9351){this[_0x719a('0x11')][_0x719a('0x16')](_0x281874)['then'](function(_0x2a8ef0){_0x1a9351(null,_0x2a8ef0?_0x2a8ef0[_0x719a('0x17')]:![]);})[_0x719a('0x14')](function(_0x1f4d84){_0x1a9351(_0x1f4d84);});};AGIVertices[_0x719a('0xf')][_0x719a('0x18')]=function(_0x255443,_0x51bad8){this[_0x719a('0x11')][_0x719a('0x19')](_0x255443)[_0x719a('0x13')](function(_0x33b595){_0x51bad8(null,_0x33b595?_0x33b595[_0x719a('0x17')]:![]);})[_0x719a('0x14')](function(_0x1f3380){_0x51bad8(_0x1f3380);});};AGIVertices[_0x719a('0xf')][_0x719a('0x1a')]=function(_0x1576ec,_0x359129){this['rpc'][_0x719a('0x1b')](_0x1576ec)[_0x719a('0x13')](function(_0x308a08){_0x359129(null,_0x308a08?_0x308a08[_0x719a('0x1c')]:![]);})['catch'](function(_0x48b3d3){_0x359129(_0x48b3d3);});};AGIVertices[_0x719a('0xf')][_0x719a('0x1d')]=function(_0x350121,_0x457c1b){this[_0x719a('0x11')]['getUserById'](_0x350121)[_0x719a('0x13')](function(_0x2c7283){_0x457c1b(null,_0x2c7283?_0x2c7283[_0x719a('0x17')]:![]);})[_0x719a('0x14')](function(_0x5a78d3){_0x457c1b(_0x5a78d3);});};AGIVertices[_0x719a('0xf')][_0x719a('0x1e')]=function(_0x459110,_0xbeee3){this[_0x719a('0x11')]['getTrunkById'](_0x459110)[_0x719a('0x13')](function(_0xb8f94a){_0xbeee3(null,_0xb8f94a?_0xb8f94a[_0x719a('0x17')]:![]);})['catch'](function(_0x1d5997){_0xbeee3(_0x1d5997);});};AGIVertices[_0x719a('0xf')]['getSound']=function(_0x2e9a1d,_0x1f84c1){var _0x11d1b0=this;this['rpc']['getSoundById'](_0x2e9a1d)[_0x719a('0x13')](function(_0x5b26e0){_0x1f84c1(null,_0x5b26e0?_0x11d1b0[_0x719a('0x1f')](_0x5b26e0[_0x719a('0x20')]):![]);})[_0x719a('0x14')](function(_0x118492){_0x1f84c1(_0x118492);});};AGIVertices[_0x719a('0xf')]['getMailAccount']=function(_0x1f043c,_0x5d902f){this[_0x719a('0x11')][_0x719a('0x21')](_0x1f043c)[_0x719a('0x13')](function(_0xb96d0d){_0x5d902f(null,_0xb96d0d?_0xb96d0d:![]);})['catch'](function(_0x1018b1){_0x5d902f(_0x1018b1);});};AGIVertices['prototype'][_0x719a('0x22')]=function(_0x4e9ce1,_0x51b049,_0x4d5dd4){this[_0x719a('0xe')]['sendMailMessage'](_0x4e9ce1,_0x51b049)[_0x719a('0x13')](function(){_0x4d5dd4(null);})['catch'](function(_0x404c47){_0x4d5dd4(_0x404c47);});};AGIVertices[_0x719a('0xf')][_0x719a('0x23')]=function(_0xc953b7,_0x3a7199){this['rpc'][_0x719a('0x24')](_0xc953b7)[_0x719a('0x13')](function(_0xc61994){if(_0xc61994){if(_0xc61994[_0x719a('0x25')]){_0x3a7199(null,[_0xc61994['interval']]);}else{_0x3a7199(null,_['map'](_0xc61994[_0x719a('0x26')],'interval'));}}else{_0x3a7199(null,![]);}})[_0x719a('0x14')](function(_0x34d6a3){_0x3a7199(_0x34d6a3);});};AGIVertices[_0x719a('0xf')][_0x719a('0x1f')]=function(_0x5dbcbb){return util[_0x719a('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x5dbcbb);};AGIVertices[_0x719a('0xf')][_0x719a('0x28')]=function(_0x2bb6fb,_0x37d4d0,_0x390572){odbc[_0x719a('0x29')](_0x2bb6fb,function(_0x307ad5){if(_0x307ad5){logger[_0x719a('0x2a')](_0x719a('0x2b'),_0x307ad5);_0x390572(_0x307ad5);}else{logger[_0x719a('0x2c')](_0x719a('0x2d'));odbc[_0x719a('0x2e')](_0x37d4d0,function(_0x5e7201,_0x2f63c1){if(_0x5e7201){logger[_0x719a('0x2c')](_0x719a('0x2f'),_0x37d4d0);_0x390572(_0x5e7201);}else{logger['info'](_0x719a('0x30'),_0x37d4d0);odbc[_0x719a('0x31')](function(_0x4b05af){if(_0x4b05af){logger[_0x719a('0x2a')](_0x719a('0x32'),_0x4b05af);}_0x390572(null,_0x2f63c1);});}});}});};AGIVertices[_0x719a('0xf')]['getSmsAccount']=function(_0x1bed36,_0x3e4575){this[_0x719a('0x11')][_0x719a('0x33')](_0x1bed36)['then'](function(_0x9e7bf5){_0x3e4575(null,_0x9e7bf5?_0x9e7bf5:![]);})[_0x719a('0x14')](function(_0x4370b9){_0x3e4575(_0x4370b9);});};AGIVertices[_0x719a('0xf')][_0x719a('0x34')]=function(_0xf2c131,_0x583d3e){this[_0x719a('0x11')][_0x719a('0x34')](_0xf2c131)['then'](function(_0x142999){_0x583d3e(null,_0x142999);})['catch'](function(_0x3d2449){_0x583d3e(_0x3d2449);});};AGIVertices[_0x719a('0xf')][_0x719a('0x35')]=function(_0x1877b9,_0x124ad6,_0x296d0c){this[_0x719a('0x11')][_0x719a('0x35')]({'uniqueid':this['channel']['uniqueid'],'node':_0x1877b9[_0x719a('0x36')],'application':_0x1877b9[_0x719a('0x37')],'data':_0x124ad6||null,'project_name':this[_0x719a('0x38')]['arg_1'],'callerid':this[_0x719a('0x38')]['callerid']})[_0x719a('0x13')](function(_0x48d4cf){if(_0x296d0c){_0x296d0c(null,_0x48d4cf);}})[_0x719a('0x14')](function(_0x175297){if(_0x296d0c){_0x296d0c(_0x175297);}});};AGIVertices[_0x719a('0xf')]['createSquareRecording']=function(_0x2a94a7,_0x4e0942,_0x1e96c4,_0x23bc49){this[_0x719a('0x11')][_0x719a('0x39')]({'uniqueid':this[_0x719a('0x38')][_0x719a('0x3a')],'callerid':this['channel'][_0x719a('0x3b')],'calleridname':this[_0x719a('0x38')][_0x719a('0x3c')],'context':this['channel'][_0x719a('0x3d')],'extension':this['channel']['extension'],'priority':this[_0x719a('0x38')][_0x719a('0x3e')],'accountcode':this[_0x719a('0x38')][_0x719a('0x3f')],'dnid':this[_0x719a('0x38')]['dnid'],'projectName':this[_0x719a('0x38')][_0x719a('0x40')],'saveName':_0x4e0942,'filename':_0x2a94a7[_0x719a('0x41')]||_0x4e0942,'savePath':_0x1e96c4})[_0x719a('0x13')](function(_0x9ee2e7){_0x23bc49(null,_0x9ee2e7);})[_0x719a('0x14')](function(_0x5019a3){_0x23bc49(_0x5019a3);});};AGIVertices[_0x719a('0xf')][_0x719a('0x42')]=function(_0x5c02e0,_0x28305d,_0x219918,_0x42db54,_0x23041f){this[_0x719a('0x11')][_0x719a('0x42')]({'uniqueid':this[_0x719a('0x38')]['uniqueid'],'body':_0x5c02e0,'direction':_0x28305d,'providerName':_0x219918,'providerResponse':_0x42db54})[_0x719a('0x13')](function(_0x500070){if(_0x23041f){_0x23041f(null,_0x500070);}})['catch'](function(_0x397db6){if(_0x23041f){_0x23041f(_0x397db6);}});};AGIVertices[_0x719a('0xf')][_0x719a('0x43')]=function(_0x3e5c26,_0x424331){this[_0x719a('0x11')]['createCmContact']({'firstName':_[_0x719a('0x44')](_0x3e5c26[_0x719a('0x17')])||_['isNil'](_0x3e5c26[_0x719a('0x17')])?'callback_'+Math[_0x719a('0x45')]():_0x3e5c26['name'],'lastName':_[_0x719a('0x44')](_0x3e5c26[_0x719a('0x46')])||_[_0x719a('0x47')](_0x3e5c26[_0x719a('0x46')])?null:_0x3e5c26[_0x719a('0x46')],'phone':_0x3e5c26[_0x719a('0x48')],'ListId':_0x3e5c26['list_id'],'scheduledat':_0x3e5c26[_0x719a('0x49')],'callbackUniqueid':this[_0x719a('0x38')]['uniqueid'],'tags':_0x719a('0x4a'),'description':_0x719a('0x4b')+_0x3e5c26['scheduledAt'][_0x719a('0x4c')](),'priority':_0x3e5c26[_0x719a('0x4d')]})[_0x719a('0x13')](function(_0x32a1df){_0x424331(null,_0x32a1df);})[_0x719a('0x14')](function(_0x33689d){_0x424331(_0x33689d);});};AGIVertices[_0x719a('0xf')]['getPause']=function(_0x548383,_0x30ab09){this['rpc'][_0x719a('0x4e')](_0x548383)[_0x719a('0x13')](function(_0x11616d){_0x30ab09(null,_0x11616d?_0x11616d['name']:![]);})[_0x719a('0x14')](function(_0x57bd45){_0x30ab09(_0x57bd45);});};AGIVertices[_0x719a('0xf')][_0x719a('0x4f')]=function(_0x53592f,_0x258cc6,_0x1e3c12){var _0x5ce84d={'role':'agent'};_0x5ce84d[_0x53592f]=this[_0x719a('0x38')]['callerid'];this['rpc'][_0x719a('0x4f')](_0x5ce84d,_0x258cc6,this[_0x719a('0x38')][_0x719a('0x3a')])[_0x719a('0x13')](function(_0x15e9b8){_0x1e3c12(null,_[_0x719a('0x47')](_0x15e9b8)?![]:!![]);})['catch'](function(_0x49d1bc){logger[_0x719a('0x2a')](_0x49d1bc);_0x1e3c12(null,![]);});};AGIVertices[_0x719a('0xf')][_0x719a('0x50')]=function(_0xc73ee0,_0x5bde08){var _0x44f275={'role':_0x719a('0x51')};_0x44f275[_0xc73ee0]=this[_0x719a('0x38')]['callerid'];this['rpc'][_0x719a('0x50')](_0x44f275)['then'](function(_0x3b6eb5){_0x5bde08(null,_[_0x719a('0x47')](_0x3b6eb5)?![]:!![]);})[_0x719a('0x14')](function(_0x1e6207){logger[_0x719a('0x2a')](_0x1e6207);_0x5bde08(null,![]);});};AGIVertices['prototype'][_0x719a('0x52')]=function(_0x49cc50,_0x5821b8){var _0x5d1c9f={'role':'agent'};_0x5d1c9f[_0x49cc50]=this[_0x719a('0x38')][_0x719a('0x3b')];this[_0x719a('0x11')][_0x719a('0x52')](_0x5d1c9f)[_0x719a('0x13')](function(_0x31799f){_0x5821b8(null,_[_0x719a('0x47')](_0x31799f)?![]:!![]);})[_0x719a('0x14')](function(_0x459519){logger[_0x719a('0x2a')](_0x459519);_0x5821b8(null,![]);});};AGIVertices[_0x719a('0xf')][_0x719a('0x53')]=function(_0x5d20c1,_0x593fc8){var _0x615616={'role':'agent'};_0x615616[_0x5d20c1]=this[_0x719a('0x38')][_0x719a('0x3b')];var _0x443586=_0x5d20c1!=_0x719a('0x54')?util[_0x719a('0x27')](_0x719a('0x55'),'LOCAL',this[_0x719a('0x38')][_0x719a('0x3b')]):undefined;this['rpc'][_0x719a('0x53')](_0x615616,_0x443586)[_0x719a('0x13')](function(_0x501ce7){_0x593fc8(null,_[_0x719a('0x47')](_0x501ce7)?![]:!![]);})[_0x719a('0x14')](function(_0x596e25){logger[_0x719a('0x2a')](_0x596e25);_0x593fc8(null,![]);});};AGIVertices[_0x719a('0xf')][_0x719a('0x56')]=function(_0xdc8c5d,_0x36a360){sh[_0x719a('0x57')](_['trim'](_0xdc8c5d),function(_0x4d2362,_0x4f383a){var _0x28f511=_0x4f383a[_0x719a('0x58')](/(\r\n|\n|\r)/gm,'');_0x36a360(null,_0x28f511);});};AGIVertices[_0x719a('0xf')][_0x719a('0x59')]=function(_0x3f60c9,_0x296aae){scripts['googleCloudTTS'](_0x3f60c9[_0x719a('0x5a')],_0x3f60c9['google_cloud_tts_text_type']||'text',_0x3f60c9[_0x719a('0x5b')],_0x3f60c9[_0x719a('0x5c')]||_0x719a('0x5d'),_0x3f60c9[_0x719a('0x5e')]||_0x719a('0x5f'),_0x3f60c9[_0x719a('0x60')]||_0x719a('0x61'))['then'](function(_0x1b5438){_0x296aae(null,_0x1b5438);})[_0x719a('0x14')](function(_0x345d00){_0x296aae(_0x345d00);});};AGIVertices[_0x719a('0xf')][_0x719a('0x62')]=function(_0x594c08,_0x505add){scripts[_0x719a('0x62')](_0x594c08['text'],_0x594c08['google_tts_language']||'en',0x1)[_0x719a('0x13')](function(_0x2c98b4){_0x505add(null,_0x2c98b4);})[_0x719a('0x14')](function(_0x473465){_0x505add(_0x473465);});};AGIVertices['prototype'][_0x719a('0x63')]=function(_0x58a404,_0x4d904b){var _0x53f346={'uri':_0x58a404[_0x719a('0x64')],'method':_0x58a404[_0x719a('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x58a404[_0x719a('0x66')])===_0x719a('0x67')&&parseInt(_0x58a404[_0x719a('0x66')])>=0x1?parseInt(_0x58a404[_0x719a('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x719a('0x68'),_0x719a('0x69')],_0x53f346[_0x719a('0x65')][_0x719a('0x6a')]())){try{_0x53f346[_0x719a('0x6b')]=_0x58a404[_0x719a('0xb')]?JSON[_0x719a('0x6c')](_0x58a404[_0x719a('0xb')]):{};}catch(_0x2ff310){logger[_0x719a('0x2a')](_0x719a('0x6d'),_0x2ff310);}}try{_0x53f346[_0x719a('0x6e')]=_0x58a404[_0x719a('0xa')]?JSON['parse'](_0x58a404[_0x719a('0xa')]):{};}catch(_0x39bcbd){logger[_0x719a('0x2a')](_0x719a('0x6f'),_0x39bcbd);}if(_0x58a404[_0x719a('0x70')]){try{var _0x2a03d9=require(_0x58a404['computedVariables'])[_0x719a('0x71')](this,_0x53f346);_0x53f346[_0x719a('0x72')]=Mustache['render'](_0x58a404[_0x719a('0x64')],_0x2a03d9,{},['$$','$$']);if(_0x53f346['headers']){_0x53f346[_0x719a('0x6e')]=JSON[_0x719a('0x6c')](Mustache['render'](JSON[_0x719a('0x73')](_0x53f346['headers']),_0x2a03d9,{},['$$','$$']));}if(_0x53f346['body']){_0x53f346[_0x719a('0x6b')]=JSON['parse'](Mustache[_0x719a('0x74')](JSON[_0x719a('0x73')](_0x53f346['body']),_0x2a03d9,{},['$$','$$']));}}catch(_0x5922b8){logger[_0x719a('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5922b8);}}rp(_0x53f346)['then'](function(_0x4fadb9){var _0x2b9b1a={'statusCode':_0x4fadb9[_0x719a('0x75')]||0xc8,'statusMessage':_0x4fadb9['statusMessage']||'OK','headers':_0x4fadb9['headers']||{},'body':_0x4fadb9[_0x719a('0x6b')]||{}};_0x4d904b(null,_0x2b9b1a);})['catch'](function(_0x4002b9){var _0x5a8562={'statusCode':_0x4002b9[_0x719a('0x75')]||0x1f4,'statusMessage':_0x4002b9[_0x719a('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4002b9['options'][_0x719a('0x6e')]||{},'body':_0x4002b9[_0x719a('0x77')]['body']||{}};_0x4d904b(null,_0x5a8562);});};AGIVertices['prototype']['googleDialogflow']=function(_0x145159,_0x1d6041){scripts[_0x719a('0x78')](this[_0x719a('0x38')][_0x719a('0x3a')],_0x145159[_0x719a('0x79')],_0x145159['text'],_0x145159[_0x719a('0x7a')]||'en')[_0x719a('0x13')](function(_0x1ba147){_0x1d6041(null,_0x1ba147);})[_0x719a('0x14')](function(_0x1f75ce){_0x1d6041(_0x1f75ce);});};AGIVertices[_0x719a('0xf')][_0x719a('0x7b')]=function(_0x1d41f5,_0x3dc31b){scripts['googleDialogflowV2'](this[_0x719a('0x38')][_0x719a('0x3a')],_0x1d41f5[_0x719a('0x7c')],_0x1d41f5[_0x719a('0x7d')],_0x1d41f5[_0x719a('0x7e')],_0x1d41f5['text'],_0x1d41f5[_0x719a('0x7f')]||'en')[_0x719a('0x13')](function(_0x587c75){_0x3dc31b(null,_0x587c75);})[_0x719a('0x14')](function(_0x530438){_0x3dc31b(_0x530438);});};AGIVertices['prototype']['sestekNDA']=function(_0x1413cc,_0x5c0caa){scripts[_0x719a('0x80')](this[_0x719a('0x38')],_0x1413cc)[_0x719a('0x13')](function(_0x5c60a0){_0x5c0caa(null,_0x5c60a0);})[_0x719a('0x14')](function(_0x2c7218){_0x5c0caa(_0x2c7218);});};AGIVertices[_0x719a('0xf')][_0x719a('0x81')]=function(_0x1219df,_0xc790cc){scripts[_0x719a('0x81')](_0x1219df[_0x719a('0x79')],_0x1219df[_0x719a('0x5b')],_0x1219df[_0x719a('0x82')]||_0x719a('0x5d'),_0x1219df[_0x719a('0x83')])[_0x719a('0x13')](function(_0x493a21){_0xc790cc(null,_0x493a21);})[_0x719a('0x14')](function(_0x2700bf){_0xc790cc(_0x2700bf);});};AGIVertices[_0x719a('0xf')][_0x719a('0x84')]=function(_0x5e02cc,_0x46c054,_0x301921){scripts['ispeechASR'](_0x46c054,_0x5e02cc['key'],_0x5e02cc[_0x719a('0x85')]||_0x719a('0x5d'),this[_0x719a('0x86')](_0x5e02cc[_0x719a('0x87')])?_0x5e02cc[_0x719a('0x87')]:undefined)[_0x719a('0x13')](function(_0x59844e){_0x301921(null,_0x59844e);})[_0x719a('0x14')](function(_0x435a27){_0x301921(_0x435a27);});};AGIVertices[_0x719a('0xf')][_0x719a('0x88')]=function(_0x3a6252,_0x5d04b){scripts[_0x719a('0x88')](_0x3a6252[_0x719a('0x89')],_0x3a6252['aws_secret_access_key'],_0x3a6252[_0x719a('0x8a')],_0x3a6252[_0x719a('0x8b')]||_0x719a('0x8c'),_0x3a6252['text'],_0x3a6252[_0x719a('0x8d')]||'text')[_0x719a('0x13')](function(_0x393b23){_0x5d04b(null,_0x393b23);})[_0x719a('0x14')](function(_0x408407){_0x5d04b(_0x408407);});};AGIVertices[_0x719a('0xf')][_0x719a('0x8e')]=function(_0xfd9713,_0x416e9e){scripts[_0x719a('0x8e')](this['channel']['uniqueid'],_0xfd9713[_0x719a('0x89')],_0xfd9713[_0x719a('0x8f')],_0xfd9713['aws_lex_region'],_0xfd9713[_0x719a('0x5b')],_0xfd9713[_0x719a('0x90')])['then'](function(_0x22abb7){_0x416e9e(null,_0x22abb7);})['catch'](function(_0x2e2a3e){_0x416e9e(_0x2e2a3e);});};AGIVertices[_0x719a('0xf')]['googleASR']=function(_0x19fa59,_0x5ca11e,_0x574373){scripts[_0x719a('0x91')](_0x5ca11e,_0x19fa59[_0x719a('0x79')],_0x19fa59[_0x719a('0x92')]||_0x719a('0x5d'))[_0x719a('0x13')](function(_0x34e21a){_0x574373(null,_0x34e21a);})[_0x719a('0x14')](function(_0x3148db){_0x574373(_0x3148db);});};AGIVertices[_0x719a('0xf')][_0x719a('0x93')]=function(_0xbf088a,_0x5e38dd,_0x275d51){scripts['tildeASR'](_0x5e38dd,_0xbf088a[_0x719a('0x94')],_0xbf088a[_0x719a('0x95')],_0xbf088a['uri'])[_0x719a('0x13')](function(_0x5e9922){_0x275d51(null,_0x5e9922);})[_0x719a('0x14')](function(_0x4f1137){_0x275d51(_0x4f1137);});};AGIVertices[_0x719a('0xf')]['clear']=function(_0x4da1d3){var _0x46fef1=_['includes'](verticesWithRetry,_0x4da1d3[_0x719a('0x37')])?_0x4da1d3:_[_0x719a('0x96')](_0x4da1d3);for(var _0xdd27b7 in _0x46fef1){if(_0x46fef1[_0x719a('0x97')](_0xdd27b7)){if(_0x46fef1[_0xdd27b7]&&_['isString'](_0x46fef1[_0xdd27b7])){if(_[_0x719a('0x98')](recursiveMapAttributes,_0xdd27b7)){_0x46fef1[_0xdd27b7]=this[_0x719a('0x99')](_0x46fef1[_0xdd27b7]);}else{_0x46fef1[_0xdd27b7]=this[_0x719a('0x9a')](_0x46fef1[_0xdd27b7]);}}}}return _0x46fef1;};AGIVertices[_0x719a('0xf')][_0x719a('0x9b')]=function(_0x162537){for(var _0x29ad99 in _0x162537){if(_0x162537['hasOwnProperty'](_0x29ad99)){if(_['isPlainObject'](_0x162537[_0x29ad99])){this[_0x719a('0x9b')](_0x162537[_0x29ad99]);}else if(_[_0x719a('0x9c')](_0x162537[_0x29ad99])){for(var _0x314c17=0x0;_0x314c17<_0x162537[_0x29ad99]['length'];_0x314c17++){this['recursiveNodeIndex'](_0x162537[_0x29ad99][_0x314c17]);}}else if(_['isString'](_0x162537[_0x29ad99])){_0x162537[_0x29ad99]=this['replaceAllVariables'](_0x162537[_0x29ad99]);}}}};AGIVertices[_0x719a('0xf')][_0x719a('0x9d')]=function(_0x5d5097,_0x31c06d){for(var _0x3261ae in _0x5d5097){if(_0x5d5097[_0x719a('0x97')](_0x3261ae)){if(_['isPlainObject'](_0x5d5097[_0x3261ae])){if(!_['isEmpty'](_0x5d5097[_0x3261ae])){this[_0x719a('0x9d')](_0x5d5097[_0x3261ae],util[_0x719a('0x27')]('%s.%s',_0x31c06d,_0x3261ae));}}else if(_[_0x719a('0x9c')](_0x5d5097[_0x3261ae])){for(var _0x10138d=0x0;_0x10138d<_0x5d5097[_0x3261ae][_0x719a('0x9e')];_0x10138d++){this[_0x719a('0x9d')](_0x5d5097[_0x3261ae][_0x10138d],util['format'](_0x719a('0x9f'),_0x31c06d,_0x3261ae+'['+_0x10138d+']'));}}else{if(!_[_0x719a('0x47')](_0x5d5097[_0x3261ae])){this[_0x719a('0x38')][_0x719a('0xa0')](util['format'](_0x719a('0x9f'),_0x31c06d,_0x3261ae),_0x5d5097[_0x3261ae]);}}}}};AGIVertices[_0x719a('0xf')][_0x719a('0x99')]=function(_0xf664d6){try{var _0xafb0ed=JSON['parse'](_0xf664d6);this[_0x719a('0x9b')](_0xafb0ed);return JSON[_0x719a('0x73')](_0xafb0ed);}catch(_0x4e9b3b){return this[_0x719a('0x9a')](_0xf664d6);}};AGIVertices[_0x719a('0xf')][_0x719a('0x9a')]=function(_0x1bc0ad){var _0x51192b=_0x1bc0ad[_0x719a('0xa1')]('{');for(var _0x3c17ec=0x1;_0x3c17ec<_0x51192b[_0x719a('0x9e')];_0x3c17ec+=0x1){var _0x2fd3d8=_0x51192b[_0x3c17ec]['split']('}');if(_0x2fd3d8[_0x719a('0x9e')]>0x1){_0x1bc0ad=_0x1bc0ad[_0x719a('0xa2')]('{'+_0x2fd3d8[0x0]+'}',this[_0x719a('0x38')][_0x719a('0x10')](_0x2fd3d8[0x0])[_0x719a('0xa3')]||_0x2fd3d8[0x0]);}}if(_0x51192b[_0x719a('0x9e')]===0x1){return _0x1bc0ad[_0x719a('0x4c')]();}return this[_0x719a('0x9a')](_0x1bc0ad);};AGIVertices[_0x719a('0xf')][_0x719a('0xa4')]=function(_0x433304,_0x35407a){var _0x169850=this['channel'][_0x719a('0x10')](_0x433304);if(_0x169850['result']===-0x1){return _0x169850;}logger['info'](util[_0x719a('0x27')](_0x719a('0xa5'),_0x35407a,_0x169850[_0x719a('0xa3')]));return this['channel']['setVariable'](_0x35407a,_0x169850[_0x719a('0xa3')]);};AGIVertices[_0x719a('0xf')][_0x719a('0x86')]=function(_0x456382){return _0x456382&&_0x456382!=='0'&&_0x456382!=='-1'&&_0x456382!=='';};AGIVertices[_0x719a('0xf')]['maxRetry']=function(_0x28686c){this[_0x719a('0x35')][_0x719a('0x71')](this,_0x28686c,'-');_0x28686c[_0x719a('0xa6')]=_0x28686c[_0x719a('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x719a('0xa8')]=function(_0x3429dc){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xa9'),_0x3429dc[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x3429dc[_0x719a('0x5b')])){return this['channel'][_0x719a('0xaa')](_0x719a('0xab'));}var _0xe39f74='\x22'+_0x3429dc[_0x719a('0x5b')]+'\x22';if(this[_0x719a('0x86')](_0x3429dc[_0x719a('0x77')])){_0xe39f74+=','+_0x3429dc[_0x719a('0x77')];}var _0x2db7d4=this[_0x719a('0x38')]['exec'](_0x719a('0xac'),_0xe39f74);if(_0x2db7d4[_0x719a('0xad')]===-0x1){return _0x2db7d4;}return this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xae'),_0xe39f74));};AGIVertices[_0x719a('0xf')][_0x719a('0xaf')]=function(_0x4e054b){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4e054b[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x4e054b[_0x719a('0xb0')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xb1'));}var _0x4eb473=_0x4e054b[_0x719a('0xb0')];if(this[_0x719a('0x86')](_0x4e054b[_0x719a('0x77')])){_0x4eb473+=','+_0x4e054b[_0x719a('0x77')];}var _0x443c35=this['channel'][_0x719a('0x57')]('MRCPRecog',_0x4eb473);if(_0x443c35['result']===-0x1){return _0x443c35;}var _0x2d1022=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x719a('0xb2'));if(_0x2d1022[_0x719a('0xad')]===-0x1){return _0x2d1022;}var _0xdfcde7=this[_0x719a('0xa4')](_0x719a('0xb3'),_0x719a('0xb4'));if(_0xdfcde7['result']===-0x1){return _0xdfcde7;}var _0x2e9219=this[_0x719a('0xa4')](_0x719a('0xb5'),_0x719a('0xb6'));if(_0x2e9219['result']===-0x1){return _0x2e9219;}return this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xb7'),_0x4eb473));};AGIVertices[_0x719a('0xf')]['agi']=function(_0x2c6c5b){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xb8'),_0x2c6c5b[_0x719a('0x36')]));return this[_0x719a('0x38')][_0x719a('0xb9')]([_0x2c6c5b['command'],_0x2c6c5b['args']]);};AGIVertices[_0x719a('0xf')]['answer']=function(_0x6e19d9){logger[_0x719a('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x6e19d9[_0x719a('0x36')]));if(this[_0x719a('0x86')](_0x6e19d9['timeout'])){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x6e19d9[_0x719a('0x66')]));var _0x1c3e09=this[_0x719a('0x38')][_0x719a('0xba')](_0x6e19d9[_0x719a('0x66')]);if(_0x1c3e09[_0x719a('0xad')]===-0x1){return _0x1c3e09;}}return this[_0x719a('0x38')][_0x719a('0xbb')]();};AGIVertices['prototype']['callback']=function(_0x520520){logger['info'](util[_0x719a('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x520520[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x520520[_0x719a('0xbc')])){return this['channel']['error'](_0x520520,'no\x20list\x20selected');}_0x520520[_0x719a('0x49')]=moment();if(this['isConfigured'](_0x520520['delay'])){_0x520520['scheduledAt']=moment()[_0x719a('0xbd')](_0x520520[_0x719a('0xbe')],_0x719a('0xbf'));}if(!this[_0x719a('0x86')](_0x520520[_0x719a('0x4d')])){_0x520520['callback_priority']=0x2;}this[_0x719a('0x43')][_0x719a('0x71')](this,_0x520520);return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x520520['phone'],_0x520520[_0x719a('0xbc')],_0x520520[_0x719a('0x49')]));};AGIVertices[_0x719a('0xf')][_0x719a('0xc0')]=function(_0x269ee9){logger['info'](util['format'](_0x719a('0xc1'),_0x269ee9[_0x719a('0x36')]));var _0x2cf88e=this[_0x719a('0x38')]['exec'](_0x269ee9[_0x719a('0xc2')],_0x269ee9[_0x719a('0x77')]);if(_0x2cf88e['result']===-0x1){return _0x2cf88e;}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xc3'),_0x269ee9[_0x719a('0xc2')],_0x269ee9[_0x719a('0x77')]));};AGIVertices[_0x719a('0xf')][_0x719a('0xc4')]=function(_0x41125f){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x41125f[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x41125f[_0x719a('0x5b')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xab'));}var _0x3fdc5b='\x22'+_0x41125f[_0x719a('0x5b')]+'\x22';if(this[_0x719a('0x86')](_0x41125f[_0x719a('0x77')])){_0x3fdc5b+=','+_0x41125f[_0x719a('0x77')];}var _0x30adad=this[_0x719a('0x38')]['exec']('MRCPSynth',_0x3fdc5b);if(_0x30adad[_0x719a('0xad')]===-0x1){return _0x30adad;}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3fdc5b));};AGIVertices[_0x719a('0xf')][_0x719a('0xc5')]=function(_0x171c36){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xc6'),_0x171c36['label']));if(!this[_0x719a('0x86')](_0x171c36[_0x719a('0x5b')])){return this[_0x719a('0x38')]['noop'](_0x719a('0xab'));}var _0x268811='\x22'+_0x171c36['text']+'\x22';if(this[_0x719a('0x86')](_0x171c36[_0x719a('0x77')])){_0x268811+=','+_0x171c36[_0x719a('0x77')];}var _0x60dafd=this[_0x719a('0x38')][_0x719a('0x57')](_0x719a('0xac'),_0x268811);if(_0x60dafd[_0x719a('0xad')]===-0x1){return _0x60dafd;}return this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xae'),_0x268811));};AGIVertices['prototype'][_0x719a('0xc7')]=function(_0x227236){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xc8'),_0x227236['label']));if(!this['isConfigured'](_0x227236[_0x719a('0xb0')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xb1'));}var _0x23abc3=_0x227236['grammar'];if(this[_0x719a('0x86')](_0x227236[_0x719a('0x77')])){_0x23abc3+=','+_0x227236[_0x719a('0x77')];}var _0x5747d1=this['channel'][_0x719a('0x57')]('MRCPRecog',_0x23abc3);if(_0x5747d1[_0x719a('0xad')]===-0x1){return _0x5747d1;}var _0x45c584=this[_0x719a('0xa4')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x45c584[_0x719a('0xad')]===-0x1){return _0x45c584;}var _0x42ed65=this[_0x719a('0xa4')](_0x719a('0xb3'),_0x719a('0xc9'));if(_0x42ed65[_0x719a('0xad')]===-0x1){return _0x42ed65;}var _0xa33005=this['getAndSetVariable'](_0x719a('0xb5'),_0x719a('0xca'));if(_0xa33005[_0x719a('0xad')]===-0x1){return _0xa33005;}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xb7'),_0x23abc3));};AGIVertices['prototype'][_0x719a('0xcb')]=function(_0x4317e9){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xcc'),_0x4317e9[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x4317e9[_0x719a('0xb0')])){return this['channel'][_0x719a('0xaa')]('no\x20grammar\x20configured');}var _0x4f7d48=_0x4317e9[_0x719a('0xb0')];if(this[_0x719a('0x86')](_0x4317e9['options'])){_0x4f7d48+=','+_0x4317e9[_0x719a('0x77')];}var _0x535be0=this[_0x719a('0x38')][_0x719a('0x57')](_0x719a('0xcd'),_0x4f7d48);if(_0x535be0[_0x719a('0xad')]===-0x1){return _0x535be0;}var _0x7aa046=this[_0x719a('0xa4')](_0x719a('0xce'),_0x719a('0xcf'));if(_0x7aa046['result']===-0x1){return _0x7aa046;}var _0x479aac=this[_0x719a('0xa4')](_0x719a('0xb3'),_0x719a('0xd0'));if(_0x479aac[_0x719a('0xad')]===-0x1){return _0x479aac;}var _0x1a950a=this[_0x719a('0xa4')](_0x719a('0xb5'),_0x719a('0xd1'));if(_0x1a950a[_0x719a('0xad')]===-0x1){return _0x1a950a;}return this[_0x719a('0x38')][_0x719a('0xaa')](util['format'](_0x719a('0xb7'),_0x4f7d48));};AGIVertices[_0x719a('0xf')]['database']=function(_0x2f707d){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xd2'),_0x2f707d[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x2f707d['odbc_id'])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x2f707d,'no\x20database\x20selected');}var _0x5c22d0=this['getSquareOdbc'][_0x719a('0x71')](this,_0x2f707d[_0x719a('0xd3')]);if(!_0x5c22d0){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x2f707d,_0x719a('0xd4'));}if(!this[_0x719a('0x86')](_0x2f707d[_0x719a('0x2e')])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x2f707d,_0x719a('0xd5'));}var _0x141c88=_0x2f707d[_0x719a('0x2e')][_0x719a('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x719a('0x27')](_0x719a('0xd6'),_0x141c88));var _0x318faa=this['getQueryOdbc'][_0x719a('0x71')](this,_0x5c22d0,_0x141c88);this[_0x719a('0x35')][_0x719a('0x71')](this,_0x2f707d,_0x141c88);if(!this[_0x719a('0x86')](_0x2f707d['variable_id'])){return this[_0x719a('0x38')]['noop'](_0x719a('0xd7'));}var _0x420a6d=this['getVariable']['sync'](this,_0x2f707d['variable_id']);if(!_0x420a6d){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x2f707d,_0x719a('0xd8'));}var _0x47d676=this;_0x318faa[_0x719a('0xd9')](function(_0x174b75,_0x4f283e){Object[_0x719a('0xda')](_0x174b75)[_0x719a('0xd9')](function(_0x2f081d){_0x47d676[_0x719a('0x38')][_0x719a('0xa0')](util[_0x719a('0x27')](_0x719a('0xdb'),_0x420a6d,_0x4f283e,_0x2f081d),_0x174b75[_0x2f081d]);});});this['channel'][_0x719a('0xa0')](util['format'](_0x719a('0xdc'),_0x420a6d),_0x318faa[_0x719a('0x9e')]);return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('variable\x20%s\x20set',_0x420a6d));};AGIVertices[_0x719a('0xf')]['dial']=function(_0x376656){logger[_0x719a('0xdd')](util[_0x719a('0x27')](_0x719a('0xde'),_0x376656[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x376656[_0x719a('0xdf')])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x376656,'no\x20user\x20selected');}var _0x29a54d=this[_0x719a('0x1d')]['sync'](this,_0x376656[_0x719a('0xdf')]);if(!_0x29a54d){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x376656,_0x719a('0xe0'));}var _0x523c5d=this[_0x719a('0x38')][_0x719a('0x57')](_0x719a('0xe1'),[util[_0x719a('0x27')](_0x719a('0xe2'),_0x29a54d),_0x376656['timeout'],_0x376656[_0x719a('0xe3')],_0x376656[_0x719a('0x64')]]);if(_0x523c5d[_0x719a('0xad')]===-0x1){return _0x523c5d;}return this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')]('Executed\x20command\x20%s',_0x719a('0xe1')));};AGIVertices[_0x719a('0xf')]['dialogflow']=function(_0x2065b2){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0xe4'),_0x2065b2['label']));if(!this[_0x719a('0x86')](_0x2065b2[_0x719a('0x79')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xe5'));}if(!this[_0x719a('0x86')](_0x2065b2[_0x719a('0x5b')])){return this[_0x719a('0x38')]['noop']('no\x20text\x20configured');}this[_0x719a('0x38')]['bot']=!![];this['createSquareDetailsReport'](_0x2065b2);this[_0x719a('0x42')](_0x2065b2['text'],'in','','');this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xe6'),_0x2065b2[_0x719a('0x5b')]));var _0x5cb7e7=this['googleDialogflow'][_0x719a('0x71')](this,_0x2065b2);if(_0x5cb7e7){for(var _0x2847b6 in _0x5cb7e7){if(_0x5cb7e7[_0x719a('0x97')](_0x2847b6)){this[_0x719a('0x38')][_0x719a('0xa0')](util[_0x719a('0x27')](_0x719a('0xe7'),_0x2847b6[_0x719a('0x6a')]()),_0x5cb7e7[_0x2847b6]);}}this[_0x719a('0x42')](_0x5cb7e7[_0x719a('0xe8')],_0x719a('0xe9'),_0x719a('0xea'),'');return this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')]('Dialogflow\x20Result\x20%s',_0x5cb7e7[_0x719a('0xe8')]));}return this[_0x719a('0x38')][_0x719a('0x2a')](_0x2065b2,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x719a('0xf')][_0x719a('0xeb')]=function(_0x156d45){logger['info'](util[_0x719a('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x156d45[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x156d45[_0x719a('0x7c')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xec'));}if(!this[_0x719a('0x86')](_0x156d45['client_email'])){return this['channel'][_0x719a('0xaa')]('no\x20client_email\x20configured');}if(!this[_0x719a('0x86')](_0x156d45['private_key'])){return this['channel']['noop'](_0x719a('0xed'));}if(!this['isConfigured'](_0x156d45[_0x719a('0x7f')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xee'));}if(!this[_0x719a('0x86')](_0x156d45['text'])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xab'));}this['channel'][_0x719a('0xef')]=!![];this[_0x719a('0x35')](_0x156d45);this['createSquareMessage'](_0x156d45[_0x719a('0x5b')],'in','','');this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xf0'),_0x156d45[_0x719a('0x5b')]));var _0x5bf5c0=this[_0x719a('0x7b')]['sync'](this,_0x156d45);if(_0x5bf5c0){for(var _0x1076e1 in _0x5bf5c0){if(_0x5bf5c0[_0x719a('0x97')](_0x1076e1)){if(_0x1076e1!==_0x719a('0xf1')){this[_0x719a('0x38')][_0x719a('0xa0')](util[_0x719a('0x27')]('DIALOGFLOW_%s',_0x1076e1['toUpperCase']()),_0x5bf5c0[_0x1076e1]);}}}this['createSquareMessage'](_0x5bf5c0[_0x719a('0xe8')],_0x719a('0xe9'),_0x719a('0xeb'),_0x5bf5c0[_0x719a('0xf1')]);return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xf2'),_0x5bf5c0[_0x719a('0xe8')]));}return this['channel'][_0x719a('0x2a')](_0x156d45,_0x719a('0xf3'));};AGIVertices[_0x719a('0xf')][_0x719a('0xf4')]=function(_0x4cb4e3){logger['info'](util['format'](_0x719a('0xf5'),_0x4cb4e3[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x4cb4e3[_0x719a('0xf6')])){return this['channel']['noop'](_0x719a('0xf7'));}if(!this['isConfigured'](_0x4cb4e3[_0x719a('0xf8')])){return this[_0x719a('0x38')][_0x719a('0xaa')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x4cb4e3[_0x719a('0xf9')])){return this['channel']['noop'](_0x719a('0xfa'));}if(!this[_0x719a('0x86')](_0x4cb4e3['ndassistant_url'])){return this['channel'][_0x719a('0xaa')](_0x719a('0xab'));}this[_0x719a('0x38')][_0x719a('0xef')]=!![];this[_0x719a('0x35')](_0x4cb4e3);this[_0x719a('0x42')](_0x4cb4e3['text'],'in','','');this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('Trying\x20SestekNDA:\x20%s',_0x4cb4e3['text']));var _0x3b8ab7=this[_0x719a('0x80')][_0x719a('0x71')](this,_0x4cb4e3);if(_0x3b8ab7){for(var _0x1c9f5f in _0x3b8ab7){if(_0x3b8ab7[_0x719a('0x97')](_0x1c9f5f)){this[_0x719a('0x38')][_0x719a('0xa0')](util[_0x719a('0x27')](_0x719a('0xfb'),_0x1c9f5f[_0x719a('0x6a')]()),_0x3b8ab7[_0x1c9f5f]);}}this[_0x719a('0x42')](_0x3b8ab7[_0x719a('0xe8')],_0x719a('0xe9'),'sesteknda','');if(_0x3b8ab7[_0x719a('0xfc')]){this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xfd'),_0x3b8ab7[_0x719a('0xfc')]));var _0x157eee=this[_0x719a('0x38')]['streamFile'](_0x3b8ab7[_0x719a('0xfc')]);try{fs[_0x719a('0xfe')](_0x3b8ab7[_0x719a('0xfc')]+_0x719a('0xff'));}catch(_0x464c4f){logger[_0x719a('0x2a')](_0x464c4f);}return _0x157eee;}else{return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x100'),_0x3b8ab7[_0x719a('0xe8')]));}}return this[_0x719a('0x38')][_0x719a('0x2a')](_0x4cb4e3,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x719a('0xf')][_0x719a('0x101')]=function(_0x1504ae){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x102'),_0x1504ae[_0x719a('0x36')]));return this['channel'][_0x719a('0xaa')]('end');};AGIVertices[_0x719a('0xf')][_0x719a('0x103')]=function(_0x5772d4){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5772d4[_0x719a('0x36')]));var _0x3a434b='';if(_0x5772d4['trunk_id']){if(!this[_0x719a('0x86')](_0x5772d4['trunk_id'])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x5772d4,_0x719a('0x104'));}else{var _0x566e7d=parseInt(_0x5772d4[_0x719a('0x105')],0xa);if(isNaN(_0x566e7d)){_0x3a434b=_0x5772d4['trunk_id'];}else{_0x3a434b=this[_0x719a('0x1e')]['sync'](this,_0x5772d4[_0x719a('0x105')]);if(!_0x3a434b){return this['channel'][_0x719a('0x2a')](_0x5772d4,'no\x20trunk\x20found');}}}}else if(_0x5772d4[_0x719a('0x106')]){_0x3a434b=_0x5772d4['trunk_name'];}else{return this[_0x719a('0x38')][_0x719a('0x2a')](_0x5772d4,_0x719a('0x104'));}var _0x4618df=this[_0x719a('0x38')][_0x719a('0x57')](_0x719a('0xe1'),[util['format'](_0x719a('0x107'),_0x3a434b,_0x5772d4[_0x719a('0x48')]),_0x5772d4[_0x719a('0x66')],_0x5772d4[_0x719a('0xe3')],_0x5772d4['url']]);if(_0x4618df[_0x719a('0xad')]===-0x1){return _0x4618df;}return this['channel']['noop'](util[_0x719a('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x719a('0xf')][_0x719a('0x108')]=function(_0x48cf19){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x48cf19[_0x719a('0x36')]));return this[_0x719a('0x38')]['noop']('finally');};AGIVertices[_0x719a('0xf')]['getdigits']=function(_0x5e082b){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x109'),_0x5e082b['label']));if(_0x5e082b[_0x719a('0xa6')]===0x0){return this[_0x719a('0xa7')](_0x5e082b);}_0x5e082b[_0x719a('0xa6')]-=0x1;if(!this[_0x719a('0x86')](_0x5e082b[_0x719a('0x10a')])){return this[_0x719a('0x38')]['error'](_0x5e082b,_0x719a('0x10b'));}var _0xe1abbd=this[_0x719a('0x10c')][_0x719a('0x71')](this,_0x5e082b[_0x719a('0x10a')]);if(!_0xe1abbd){return this['channel'][_0x719a('0x2a')](_0x5e082b,'no\x20file\x20audio\x20found');}if(!this[_0x719a('0x86')](_0x5e082b[_0x719a('0x10d')])){return this[_0x719a('0x38')]['error'](_0x719a('0xd7'));}var _0x1c20cd=this[_0x719a('0x38')][_0x719a('0x10e')](_0xe1abbd,_0x5e082b[_0x719a('0x10f')],_0x5e082b[_0x719a('0x110')]);var _0x5aecb6=_0x1c20cd[_0x719a('0xad')]?_0x1c20cd[_0x719a('0xad')]['toString']():'';logger[_0x719a('0x2c')](_0x719a('0x111'),JSON[_0x719a('0x73')](_0x1c20cd));if(_0x1c20cd[_0x719a('0xad')]===-0x1){this[_0x719a('0x35')][_0x719a('0x71')](this,_0x5e082b,_0x5aecb6);return _0x1c20cd;}else if(_0x1c20cd[_0x719a('0xa3')]==='timeout'){_0x1c20cd[_0x719a('0xad')]=_0x5aecb6[_0x719a('0x9e')]>=parseInt(_0x5e082b[_0x719a('0x112')])?'x':'i';}else{_0x1c20cd[_0x719a('0xad')]=_0x5aecb6[_0x719a('0x9e')]>=parseInt(_0x5e082b[_0x719a('0x112')])&&_0x5aecb6[_0x719a('0x9e')]<=parseInt(_0x5e082b[_0x719a('0x110')])?'x':'i';}var _0x7ae6aa=this[_0x719a('0x10')][_0x719a('0x71')](this,_0x5e082b[_0x719a('0x10d')]);if(!_0x7ae6aa){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x5e082b,'no\x20variable\x20found');}this['channel'][_0x719a('0xa0')](_0x7ae6aa,_0x5aecb6);if(this[_0x719a('0x86')](_0x5e082b[_0x719a('0x113')])){var _0xef9db5=parseInt(_0x5e082b[_0x719a('0x113')],0xa);var _0x3b70c1=rs['generate']({'charset':'*','length':_0xef9db5});var _0x58d7ab=_0x5aecb6['length'];if(_0x58d7ab>0x0){if(_0x58d7ab>_0xef9db5){this[_0x719a('0x35')][_0x719a('0x71')](this,_0x5e082b,_0x5e082b[_0x719a('0x114')]==='first'?_0x3b70c1+_0x5aecb6['substr'](_0xef9db5):_0x5aecb6[_0x719a('0x115')](0x0,_0x58d7ab-_0xef9db5)+_0x3b70c1);}else{this[_0x719a('0x35')][_0x719a('0x71')](this,_0x5e082b,rs[_0x719a('0x116')]({'charset':'*','length':_0x58d7ab}));}}else{this['createSquareDetailsReport'][_0x719a('0x71')](this,_0x5e082b,'');}}else{this[_0x719a('0x35')][_0x719a('0x71')](this,_0x5e082b,_0x5aecb6);}return _0x1c20cd;};AGIVertices[_0x719a('0xf')][_0x719a('0xd')]=function(_0x5ca5cd){logger['info'](util[_0x719a('0x27')](_0x719a('0x117'),_0x5ca5cd[_0x719a('0x36')]));return this[_0x719a('0xc')](_0x5ca5cd);};AGIVertices[_0x719a('0xf')][_0x719a('0x118')]=function(_0x131627){logger['info'](util['format'](_0x719a('0x119'),_0x131627['label']));this[_0x719a('0x35')][_0x719a('0x71')](this,_0x131627,_0x131627[_0x719a('0x11a')]);return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x11b'),_0x131627[_0x719a('0x11a')]));};AGIVertices[_0x719a('0xf')]['awspolly']=function(_0x5ccd78){logger[_0x719a('0x2c')](util['format'](_0x719a('0x11c'),_0x5ccd78[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x5ccd78[_0x719a('0x89')])||!this[_0x719a('0x86')](_0x5ccd78[_0x719a('0x8f')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0x11d'));}if(!this[_0x719a('0x86')](_0x5ccd78[_0x719a('0x5b')])){return this['channel'][_0x719a('0xaa')](_0x719a('0xab'));}this[_0x719a('0x38')][_0x719a('0xaa')](util['format'](_0x719a('0x11e'),_0x5ccd78[_0x719a('0x5b')]));var _0x548505=this[_0x719a('0x88')][_0x719a('0x71')](this,_0x5ccd78);if(_0x548505){this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x11f'),_0x548505));var _0x1dae97=this[_0x719a('0x38')]['streamFile'](_0x548505);try{fs[_0x719a('0xfe')](_0x548505+_0x719a('0xff'));}catch(_0x470d26){logger[_0x719a('0x2a')](_0x470d26);}return _0x1dae97;}return this[_0x719a('0x38')][_0x719a('0x2a')](_0x5ccd78,_0x719a('0x120'));};AGIVertices[_0x719a('0xf')][_0x719a('0x121')]=function(_0x50c9f8){logger['info'](util[_0x719a('0x27')](_0x719a('0x122'),_0x50c9f8['label']));if(!this[_0x719a('0x86')](_0x50c9f8[_0x719a('0x89')])||!this[_0x719a('0x86')](_0x50c9f8[_0x719a('0x8f')])){return this['channel'][_0x719a('0xaa')](_0x719a('0x11d'));}if(!this[_0x719a('0x86')](_0x50c9f8[_0x719a('0x90')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0x123'));}if(!this[_0x719a('0x86')](_0x50c9f8['text'])){return this[_0x719a('0x38')][_0x719a('0xaa')]('no\x20text\x20configured');}this['channel'][_0x719a('0xef')]=!![];this[_0x719a('0x35')](_0x50c9f8);this[_0x719a('0x42')](_0x50c9f8['text'],'in','','');this[_0x719a('0x38')][_0x719a('0xaa')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x50c9f8[_0x719a('0x5b')]));var _0x5590ab=this[_0x719a('0x8e')]['sync'](this,_0x50c9f8);if(_0x5590ab){for(var _0x16d7d4 in _0x5590ab){if(_0x5590ab['hasOwnProperty'](_0x16d7d4)&&_[_0x719a('0x124')](_0x5590ab[_0x16d7d4])){this[_0x719a('0x38')]['setVariable'](util[_0x719a('0x27')]('AWS_LEX_%s',_0x16d7d4[_0x719a('0x6a')]()),_0x5590ab[_0x16d7d4]);}}if(_[_0x719a('0x47')](_0x5590ab['message'])){return this[_0x719a('0x38')][_0x719a('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x5590ab[_0x719a('0x76')],_0x719a('0xe9'),_0x719a('0x125'),'');return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x126'),_0x5590ab[_0x719a('0x76')]));}}return this[_0x719a('0x38')][_0x719a('0x2a')](_0x50c9f8,_0x719a('0x127'));};AGIVertices['prototype'][_0x719a('0x128')]=function(_0x4137ff){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x129'),_0x4137ff[_0x719a('0x36')],_0x4137ff[_0x719a('0x66')]));if(!this['isConfigured'](_0x4137ff[_0x719a('0x79')])){return this['channel']['noop'](_0x719a('0xe5'));}var _0x5192b2=_0x719a('0x12a');var _0x521791=util['format'](_0x719a('0x12b'),FILES_PATH,rs[_0x719a('0x116')](0x4));var _0x5c7331=util[_0x719a('0x27')](_0x719a('0x9f'),_0x521791,_0x5192b2);var _0x461743=!![];if(_0x4137ff[_0x719a('0x12c')]==='NOBEEP'){_0x461743=![];}var _0x3518c5=this[_0x719a('0x38')][_0x719a('0x12d')](_0x521791,_0x5192b2,_0x4137ff[_0x719a('0x12e')],_0x4137ff['timeout'],undefined,_0x461743);if(_0x3518c5['result']!==-0x1){this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x12f'),_0x5c7331));var _0x212312=this['googleASR'][_0x719a('0x71')](this,_0x4137ff,_0x5c7331);if(_0x212312){for(var _0x37b658 in _0x212312){if(_0x212312[_0x719a('0x97')](_0x37b658)){this[_0x719a('0x38')]['setVariable'](util[_0x719a('0x27')]('GOOGLE_ASR_%s',_0x37b658['toUpperCase']()),_0x212312[_0x37b658]);}}return this[_0x719a('0x38')][_0x719a('0xaa')](util['format'](_0x719a('0x130'),JSON[_0x719a('0x73')](_0x212312)));}}return _0x3518c5;};AGIVertices[_0x719a('0xf')][_0x719a('0x131')]=function(_0x30bfe4){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x30bfe4['label']));if(!this[_0x719a('0x86')](_0x30bfe4[_0x719a('0x94')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0x132'));}if(!this[_0x719a('0x86')](_0x30bfe4[_0x719a('0x95')])){return this['channel'][_0x719a('0xaa')](_0x719a('0x133'));}var _0x2a3962='wav';var _0x57c780=util[_0x719a('0x27')](_0x719a('0x12b'),FILES_PATH,rs[_0x719a('0x116')](0x4));var _0x317d5b=util[_0x719a('0x27')](_0x719a('0x9f'),_0x57c780,_0x2a3962);var _0x57073d=!![];if(_0x30bfe4[_0x719a('0x12c')]===_0x719a('0x134')){_0x57073d=![];}var _0x11de1d=this[_0x719a('0x38')][_0x719a('0x12d')](_0x57c780,_0x2a3962,_0x30bfe4[_0x719a('0x12e')],_0x30bfe4[_0x719a('0x66')],undefined,_0x57073d);if(_0x11de1d[_0x719a('0xad')]!==-0x1){this[_0x719a('0x38')]['noop'](util['format'](_0x719a('0x135'),_0x317d5b));var _0x3087e4=this[_0x719a('0x93')][_0x719a('0x71')](this,_0x30bfe4,_0x317d5b);if(_0x3087e4){for(var _0x456010 in _0x3087e4){if(_0x3087e4[_0x719a('0x97')](_0x456010)){this[_0x719a('0x38')][_0x719a('0xa0')](util['format'](_0x719a('0x136'),_0x456010['toUpperCase']()),_0x3087e4[_0x456010]);}}return this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0x137'),JSON[_0x719a('0x73')](_0x3087e4)));}}return _0x11de1d;};AGIVertices[_0x719a('0xf')][_0x719a('0x138')]=function(_0x13226b){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x139'),_0x13226b[_0x719a('0x36')]));return this[_0x719a('0x38')][_0x719a('0x13a')](_0x13226b[_0x719a('0x3d')],_0x13226b[_0x719a('0x13b')],_0x13226b[_0x719a('0x3e')]);};AGIVertices[_0x719a('0xf')][_0x719a('0x13c')]=function(_0x46bb9c){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x13d'),_0x46bb9c[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x46bb9c[_0x719a('0x13e')])){return this['channel'][_0x719a('0x2a')](_0x46bb9c,_0x719a('0x13f'));}try{var _0x4eb570=eval(_0x46bb9c[_0x719a('0x13e')])?_0x719a('0x140'):_0x719a('0x141');this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x142'),_0x46bb9c['condition'],_0x4eb570));return{'code':0xc8,'result':_0x4eb570};}catch(_0x541872){return{'code':0xc8,'result':_0x719a('0x141')};}};AGIVertices['prototype'][_0x719a('0x143')]=function(_0x4755ad){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x144'),_0x4755ad[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x4755ad['interval_id'])){return this[_0x719a('0x38')]['error'](_0x4755ad,_0x719a('0x145'));}var _0x2a0da4=this[_0x719a('0x23')][_0x719a('0x71')](this,_0x4755ad['interval_id']);if(!_0x2a0da4){return this[_0x719a('0x38')]['error'](_0x4755ad,_0x719a('0x146'));}for(var _0x2bd0eb=0x0;_0x2bd0eb<_0x2a0da4[_0x719a('0x9e')];_0x2bd0eb+=0x1){var _0x1b747f=this['channel'][_0x719a('0x10')](util[_0x719a('0x27')](_0x719a('0x147'),_0x2a0da4[_0x2bd0eb]));if(_0x1b747f[_0x719a('0xad')]===-0x1){return _0x1b747f;}logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x148'),_0x2a0da4[_0x2bd0eb],_0x1b747f['extra']));if(_0x1b747f['extra']===_0x719a('0x140')){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x148'),_0x2a0da4[_0x2bd0eb],_0x719a('0x140')));this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x148'),_0x2a0da4[_0x2bd0eb],'true'));return{'code':0xc8,'result':_0x719a('0x140')};}else{logger['info'](util[_0x719a('0x27')]('IFTIME\x20%s\x20%s',_0x2a0da4[_0x2bd0eb],'false'));this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0x148'),_0x2a0da4[_0x2bd0eb],_0x719a('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x719a('0xf')]['hangup']=function(_0x3701ca){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x149'),_0x3701ca[_0x719a('0x36')]));return this[_0x719a('0x38')][_0x719a('0x14a')]();};AGIVertices['prototype']['ispeechasr']=function(_0x5ed5ce){logger['info'](util[_0x719a('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5ed5ce[_0x719a('0x36')]));if(!this['isConfigured'](_0x5ed5ce[_0x719a('0x79')])){return this[_0x719a('0x38')]['noop'](_0x719a('0xe5'));}var _0x2fe212=_0x719a('0x12a');var _0x4be2a2=util[_0x719a('0x27')](_0x719a('0x12b'),FILES_PATH,rs[_0x719a('0x116')](0x4));var _0x687523=util[_0x719a('0x27')]('%s.%s',_0x4be2a2,_0x2fe212);var _0x3b0e21=!![];if(_0x5ed5ce[_0x719a('0x12c')]===_0x719a('0x134')){_0x3b0e21=![];}var _0x496d8e=this['channel']['recordFile'](_0x4be2a2,_0x2fe212,_0x5ed5ce['intKey'],_0x5ed5ce[_0x719a('0x66')],undefined,_0x3b0e21);if(_0x496d8e[_0x719a('0xad')]!==-0x1){this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x14b'),_0x687523));var _0x3273df=this[_0x719a('0x84')][_0x719a('0x71')](this,_0x5ed5ce,_0x687523);if(_0x3273df){for(var _0x568677 in _0x3273df){if(_0x3273df[_0x719a('0x97')](_0x568677)){this[_0x719a('0x38')][_0x719a('0xa0')](util[_0x719a('0x27')](_0x719a('0x14c'),_0x568677[_0x719a('0x6a')]()),_0x3273df[_0x568677]);}}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x14d'),JSON[_0x719a('0x73')](_0x3273df)));}}return _0x496d8e;};AGIVertices[_0x719a('0xf')][_0x719a('0x14e')]=function(_0xcbcfc6){logger[_0x719a('0x2c')](util['format'](_0x719a('0x14f'),_0xcbcfc6[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0xcbcfc6[_0x719a('0x79')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xe5'));}if(!this[_0x719a('0x86')](_0xcbcfc6[_0x719a('0x5b')])){return this[_0x719a('0x38')]['noop'](_0x719a('0xab'));}this[_0x719a('0x38')]['noop'](util['format'](_0x719a('0x150'),_0xcbcfc6[_0x719a('0x5b')]));var _0x53f75a=this[_0x719a('0x81')][_0x719a('0x71')](this,_0xcbcfc6);if(_0x53f75a){this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('ispeech\x20%s\x20file\x20created',_0x53f75a));var _0x4dfa12=this[_0x719a('0x38')][_0x719a('0x151')](_0x53f75a,_0xcbcfc6['intKey']);try{fs[_0x719a('0xfe')](_0x53f75a+'.wav');}catch(_0x216b78){logger[_0x719a('0x2a')](_0x216b78);}return _0x4dfa12;}return this[_0x719a('0x38')][_0x719a('0x2a')](_0xcbcfc6,_0x719a('0x152'));};AGIVertices[_0x719a('0xf')][_0x719a('0x153')]=function(_0x304ae6){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x304ae6[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x304ae6[_0x719a('0x154')])){return this['channel']['error'](_0x304ae6,_0x719a('0x155'));}logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x156'),this['channel']['callerid'],_0x304ae6[_0x719a('0x154')]));var _0x3b6efe=this[_0x719a('0x53')][_0x719a('0x71')](this,_0x304ae6['findBy']);if(_0x3b6efe){logger[_0x719a('0x2c')](util['format'](_0x719a('0x157'),this[_0x719a('0x38')][_0x719a('0x3b')],_0x304ae6['findBy']));this[_0x719a('0x38')][_0x719a('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x719a('0x38')]['callerid'],_0x304ae6[_0x719a('0x154')]));return{'code':0xc8,'result':_0x719a('0x158')};}else{logger['info'](util[_0x719a('0x27')](_0x719a('0x159'),this[_0x719a('0x38')][_0x719a('0x3b')],_0x304ae6[_0x719a('0x154')]));this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x159'),this['channel'][_0x719a('0x3b')],_0x304ae6[_0x719a('0x154')]));return{'code':0xc8,'result':_0x719a('0x15a')};}};AGIVertices[_0x719a('0xf')][_0x719a('0x15b')]=function(_0x430f50){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x430f50['label']));if(!this[_0x719a('0x86')](_0x430f50[_0x719a('0x154')])){return this[_0x719a('0x38')]['error'](_0x430f50,_0x719a('0x155'));}logger[_0x719a('0x2c')](util[_0x719a('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x430f50[_0x719a('0x154')]));var _0x5e1462=this[_0x719a('0x52')]['sync'](this,_0x430f50['findBy']);if(_0x5e1462){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x157'),this[_0x719a('0x38')][_0x719a('0x3b')],_0x430f50[_0x719a('0x154')]));this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0x157'),this[_0x719a('0x38')][_0x719a('0x3b')],_0x430f50['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x159'),this['channel'][_0x719a('0x3b')],_0x430f50[_0x719a('0x154')]));this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x159'),this['channel'][_0x719a('0x3b')],_0x430f50[_0x719a('0x154')]));return{'code':0xc8,'result':_0x719a('0x15a')};}};AGIVertices[_0x719a('0xf')][_0x719a('0x15c')]=function(_0x238587){logger['info'](util[_0x719a('0x27')](_0x719a('0x15d'),_0x238587['label']));if(!this[_0x719a('0x86')](_0x238587[_0x719a('0x15e')])){return this['channel'][_0x719a('0x2a')](_0x238587,_0x719a('0x15f'));}this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('math\x20%s',_0x238587['operation']));var _0x5d3adf=eval(_0x238587[_0x719a('0x15e')]);if(!this[_0x719a('0x86')](_0x238587[_0x719a('0x10d')])){return this['channel'][_0x719a('0xaa')](_0x719a('0xd7'));}var _0x356942=this[_0x719a('0x10')][_0x719a('0x71')](this,_0x238587[_0x719a('0x10d')]);if(!_0x356942){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x238587,_0x719a('0xd8'));}if(_[_0x719a('0x9c')](_0x5d3adf)){var _0x48d7c9=this;_0x5d3adf[_0x719a('0xd9')](function(_0x13bb79,_0x55ef9b){_0x48d7c9[_0x719a('0x38')][_0x719a('0xa0')](util['format'](_0x719a('0x160'),_0x356942,_0x55ef9b),_0x13bb79);});return this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')]('variable\x20%s[key]\x20set',_0x356942));}else{return this[_0x719a('0x38')][_0x719a('0xa0')](_0x356942,_0x5d3adf);}};AGIVertices[_0x719a('0xf')][_0x719a('0x161')]=function(_0x153594){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x162'),_0x153594[_0x719a('0x36')]));if(_0x153594[_0x719a('0xa6')]===0x0){return this[_0x719a('0xa7')](_0x153594);}_0x153594['retry']-=0x1;if(!this['isConfigured'](_0x153594['file_id'])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x153594,_0x719a('0x10b'));}var _0x327bdb=this[_0x719a('0x10c')][_0x719a('0x71')](this,_0x153594[_0x719a('0x10a')]);if(!_0x327bdb){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x153594,'no\x20file\x20audio\x20found');}var _0x484459=this[_0x719a('0x38')][_0x719a('0x10e')](_0x327bdb,_0x153594[_0x719a('0x10f')],_0x153594['digit']);var _0xb3cec2=_0x484459[_0x719a('0xad')];if(_0x484459[_0x719a('0xad')]===-0x1){this['createSquareDetailsReport'][_0x719a('0x71')](this,_0x153594,'-1');return _0x484459;}else if(_0x484459[_0x719a('0xa3')]===_0x719a('0x66')){_0x484459[_0x719a('0xad')]=_0x484459[_0x719a('0xad')][_0x719a('0x9e')]>0x0?_0x484459['result']:'t';}else if(_[_0x719a('0x44')](_0x484459['result'])){_0x484459[_0x719a('0xad')]='#';_0xb3cec2='#';}if(!this[_0x719a('0x86')](_0x153594['variable_id'])){this[_0x719a('0x38')]['noop'](_0x719a('0xd7'));}else{var _0x229622=this[_0x719a('0x10')][_0x719a('0x71')](this,_0x153594[_0x719a('0x10d')]);if(!_0x229622){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x153594,_0x719a('0xd8'));}this[_0x719a('0x38')]['setVariable'](_0x229622,_0xb3cec2);}this['createSquareDetailsReport']['sync'](this,_0x153594,_0xb3cec2);return _0x484459;};AGIVertices['prototype']['noop']=function(_0x320d6e){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x320d6e[_0x719a('0x36')]));return this[_0x719a('0x38')]['noop'](_0x320d6e[_0x719a('0x163')]||_0x320d6e[_0x719a('0x36')]);};AGIVertices['prototype']['pause']=function(_0x24b94f){logger['info'](util['format'](_0x719a('0x164'),_0x24b94f[_0x719a('0x36')]));if(!this['isConfigured'](_0x24b94f[_0x719a('0x154')])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x24b94f,_0x719a('0x155'));}logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x156'),this['channel'][_0x719a('0x3b')],_0x24b94f[_0x719a('0x154')]));var _0x4660c5=this['getPause'][_0x719a('0x71')](this,_0x24b94f[_0x719a('0x165')]);var _0x3d7565=this['agentPause'][_0x719a('0x71')](this,_0x24b94f[_0x719a('0x154')],_0x4660c5);if(_0x3d7565){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x157'),this['channel'][_0x719a('0x3b')],_0x24b94f[_0x719a('0x154')]));this[_0x719a('0x38')][_0x719a('0xaa')](util['format'](_0x719a('0x157'),this['channel'][_0x719a('0x3b')],_0x24b94f['findBy']));return{'code':0xc8,'result':_0x719a('0x158')};}else{logger[_0x719a('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x719a('0x38')]['callerid'],_0x24b94f[_0x719a('0x154')]));this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x719a('0x38')][_0x719a('0x3b')],_0x24b94f[_0x719a('0x154')]));return{'code':0xc8,'result':_0x719a('0x15a')};}};AGIVertices[_0x719a('0xf')][_0x719a('0x166')]=function(_0x18bd7b){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x167'),_0x18bd7b[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x18bd7b[_0x719a('0x10a')])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x18bd7b,_0x719a('0x10b'));}var _0x3f9987=this[_0x719a('0x10c')][_0x719a('0x71')](this,_0x18bd7b[_0x719a('0x10a')]);if(!_0x3f9987){return this[_0x719a('0x38')]['error'](_0x18bd7b,_0x719a('0x168'));}var _0x121b4b=this['channel']['exec']('PLAYBACK',[_0x3f9987,_0x18bd7b[_0x719a('0xe3')]]);if(_0x121b4b[_0x719a('0xad')]===-0x1){return _0x121b4b;}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('Executed\x20command\x20%s\x20%s',_0x719a('0x169'),_0x3f9987));};AGIVertices[_0x719a('0xf')][_0x719a('0x16a')]=function(_0x541977){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x541977[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x541977['queue_id'])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x541977,_0x719a('0x16b'));}var _0x3e85d0='';var _0x4fc670=parseInt(_0x541977[_0x719a('0x16c')],0xa);if(isNaN(_0x4fc670)){_0x3e85d0=_0x541977['queue_id'];}else{_0x3e85d0=this[_0x719a('0x15')][_0x719a('0x71')](this,_0x541977[_0x719a('0x16c')]);if(!_0x3e85d0){return this['channel'][_0x719a('0x2a')](_0x541977,_0x719a('0x16d'));}}var _0x30ee68='';if(this[_0x719a('0x86')](_0x541977[_0x719a('0x10a')])){var _0x2d4f87=this[_0x719a('0x10c')][_0x719a('0x71')](this,_0x541977[_0x719a('0x10a')]);if(_0x2d4f87){_0x30ee68=_0x2d4f87;}}this[_0x719a('0x35')]['sync'](this,_0x541977,_0x3e85d0);if(_0x541977[_0x719a('0xe3')][_0x719a('0x16e')]('x')<0x0){_0x541977['opts']+='x';}if(_0x541977[_0x719a('0xe3')][_0x719a('0x16e')]('X')<0x0){_0x541977['opts']+='X';}this[_0x719a('0x38')]['setVariable'](_0x719a('0x16f'),_0x3e85d0?_0x3e85d0[_0x719a('0x170')]():'');var _0x5c1dc6=this[_0x719a('0x38')][_0x719a('0x57')](_0x719a('0x171'),[_0x3e85d0,_0x541977[_0x719a('0xe3')],_0x541977[_0x719a('0x64')],_0x30ee68,_0x541977['timeout'],_0x541977[_0x719a('0xb9')],_0x541977['macro'],_0x541977['gosub'],'',_0x541977[_0x719a('0x172')]]);if(_0x5c1dc6[_0x719a('0xad')]===-0x1){return _0x5c1dc6;}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xc3'),'QUEUE',_0x3e85d0));};AGIVertices[_0x719a('0xf')]['record']=function(_0x1ef66a){logger['info'](util['format'](_0x719a('0x173'),_0x1ef66a[_0x719a('0x36')]));var _0x2454e1=_0x1ef66a[_0x719a('0x174')]||'wav';var _0xe6bc92=util[_0x719a('0x27')](_0x719a('0x175'),this['channel'][_0x719a('0x3a')],rs[_0x719a('0x116')](0x5));var _0x3292d5=util['format'](_0x719a('0x176'),FILES_PATH,_0xe6bc92,_0x2454e1);var _0x30331d=util[_0x719a('0x27')](_0x719a('0x12b'),FILES_PATH,_0xe6bc92);this['createSquareRecording'][_0x719a('0x71')](this,_0x1ef66a,_0xe6bc92,_0x3292d5);this[_0x719a('0x38')][_0x719a('0xa0')](_0x719a('0x177'),_0xe6bc92);logger[_0x719a('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x30331d,_0x2454e1,_0x1ef66a[_0x719a('0x178')],_0x1ef66a[_0x719a('0x66')]);return this[_0x719a('0x38')][_0x719a('0x12d')](_0x30331d,_0x2454e1,_0x1ef66a[_0x719a('0x178')],_0x1ef66a[_0x719a('0x66')],undefined,!![]);};AGIVertices[_0x719a('0xf')][_0x719a('0x179')]=function(_0x1cbec6){logger[_0x719a('0x2c')](util['format'](_0x719a('0x17a'),_0x1cbec6[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x1cbec6['url'])){return this['channel'][_0x719a('0xaa')](_0x719a('0x17b'));}var _0x24e70e=this[_0x719a('0x63')][_0x719a('0x71')](this,_0x1cbec6);logger['info'](util['format'](_0x719a('0x17c'),util['inspect'](_0x24e70e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1cbec6['variable_id'])){return this[_0x719a('0x38')]['noop'](_0x719a('0x17d'));}var _0x5f4aef=this['getVariable']['sync'](this,_0x1cbec6[_0x719a('0x10d')]);if(!_0x5f4aef){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x1cbec6,_0x719a('0xd8'));}this[_0x719a('0x38')][_0x719a('0xa0')](util[_0x719a('0x27')]('%s_STATUS_CODE',_0x5f4aef),_0x24e70e[_0x719a('0x75')]?_0x24e70e[_0x719a('0x75')]:_0x719a('0x17e'));this[_0x719a('0x38')]['setVariable'](util[_0x719a('0x27')]('%s_STATUS_MESSAGE',_0x5f4aef),_0x24e70e['statusMessage']?_0x24e70e[_0x719a('0x17f')]:'OK');if(_0x24e70e[_0x719a('0x6b')]){try{this['saveRestApiResult'](_0x24e70e['body'],_0x5f4aef);}catch(_0x24f08a){logger[_0x719a('0x2a')](util[_0x719a('0x27')](_0x719a('0x180'),_0x5f4aef));}}return this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')]('variable\x20%s\x20set',_0x5f4aef));};AGIVertices['prototype']['saydigits']=function(_0x51a375){logger['info'](util[_0x719a('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x51a375['label']));return this[_0x719a('0x38')]['sayDigits'](_0x51a375[_0x719a('0x181')][_0x719a('0x58')](/\s+/g,''),_0x51a375[_0x719a('0x178')]);};AGIVertices[_0x719a('0xf')][_0x719a('0x182')]=function(_0x4b8df6){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x183'),_0x4b8df6[_0x719a('0x36')]));return this[_0x719a('0x38')][_0x719a('0x184')](_0x4b8df6[_0x719a('0x67')][_0x719a('0x58')](/\s+/g,''),_0x4b8df6['escape_digits']);};AGIVertices[_0x719a('0xf')][_0x719a('0x185')]=function(_0x42496b){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x186'),_0x42496b[_0x719a('0x36')]));return this[_0x719a('0x38')][_0x719a('0x187')](_0x42496b[_0x719a('0x5b')],_0x42496b[_0x719a('0x178')]);};AGIVertices[_0x719a('0xf')][_0x719a('0x188')]=function(_0xb6ee4c){logger['info'](util[_0x719a('0x27')](_0x719a('0x189'),_0xb6ee4c[_0x719a('0x36')]));if(!this['isConfigured'](_0xb6ee4c[_0x719a('0x18a')])){return this['channel'][_0x719a('0xaa')](_0x719a('0x18b'));}var _0x6da162=this['getMailAccount']['sync'](this,_0xb6ee4c[_0x719a('0x18a')]);if(!_0x6da162||!_0x6da162[_0x719a('0x18c')]){return this[_0x719a('0x38')]['error'](_0xb6ee4c,_0x719a('0x18d'));}var _0x8efe0f={'from':util['format'](_0x719a('0x18e'),_0x6da162[_0x719a('0x17')],_0x6da162[_0x719a('0x18f')]||_0x6da162['Smtp']['user']),'to':_0xb6ee4c['to']||'','cc':_0xb6ee4c['cc']||'','bcc':_0xb6ee4c[_0x719a('0x190')]||'','subject':_0xb6ee4c[_0x719a('0x191')],'html':_0xb6ee4c[_0x719a('0x5b')],'text':_0xb6ee4c[_0x719a('0x5b')]};var _0x12f417={'tls':{'rejectUnauthorized':![]}};if(_0x6da162['Smtp']['service']){_0x12f417[_0x719a('0x192')]=_0x6da162[_0x719a('0x18c')][_0x719a('0x192')];}else{_0x12f417[_0x719a('0x193')]=_0x6da162[_0x719a('0x18c')][_0x719a('0x193')];_0x12f417[_0x719a('0x194')]=_0x6da162['Smtp']['port'];_0x12f417['secure']=_0x6da162[_0x719a('0x18c')][_0x719a('0x195')];}if(_0x6da162[_0x719a('0x18c')][_0x719a('0x196')]){_0x12f417[_0x719a('0x197')]={'user':_0x6da162['Smtp'][_0x719a('0x198')],'pass':_0x6da162['Smtp'][_0x719a('0x199')]};}if(this['isConfigured'](_0xb6ee4c[_0x719a('0x19a')])){}logger[_0x719a('0xdd')](_0x719a('0x19b'),JSON[_0x719a('0x73')](_0x8efe0f));this[_0x719a('0x35')]['sync'](this,_0xb6ee4c,_0xb6ee4c[_0x719a('0x18a')]);this['channel'][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x19c'),_0x6da162[_0x719a('0x17')]));this['sendMailMessage']['sync'](this,_0x12f417,_0x8efe0f);return this['channel'][_0x719a('0xaa')](_0x719a('0x19d'));};AGIVertices['prototype']['sendFax']=function(_0x55b81a){logger['info'](util[_0x719a('0x27')](_0x719a('0x19e'),_0x55b81a[_0x719a('0x36')]));return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0x19f'));};AGIVertices[_0x719a('0xf')][_0x719a('0x1a0')]=function(_0x264bbd){logger['info'](util[_0x719a('0x27')](_0x719a('0x1a1'),_0x264bbd['label']));if(!this['isConfigured'](_0x264bbd[_0x719a('0x1a2')])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0x1a3'));}var _0xfe594d=this[_0x719a('0x1a4')]['sync'](this,_0x264bbd[_0x719a('0x1a2')]);if(!_0xfe594d){return this['channel'][_0x719a('0x2a')](_0x264bbd,'no\x20sms\x20account\x20found');}var _0x3a1040={'body':_0x264bbd[_0x719a('0x1a5')],'phone':_0x264bbd['to']||'','SmsAccountId':_0xfe594d['id']};logger[_0x719a('0xdd')](_0x719a('0x1a6'),JSON[_0x719a('0x73')](_0x3a1040));this['createSquareDetailsReport'][_0x719a('0x71')](this,_0x264bbd,_0x264bbd['sms_account_id']);this[_0x719a('0x38')][_0x719a('0xaa')](util['format'](_0x719a('0x1a7'),_0xfe594d[_0x719a('0x17')]));this[_0x719a('0x34')]['sync'](this,_0x3a1040);return this[_0x719a('0x38')][_0x719a('0xaa')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x719a('0xf')]['set']=function(_0x4c0970){logger['info'](util[_0x719a('0x27')](_0x719a('0x1a8'),_0x4c0970[_0x719a('0x36')]));if(!this['isConfigured'](_0x4c0970[_0x719a('0x10d')])){return this['channel'][_0x719a('0x2a')](_0x4c0970,_0x719a('0x1a9'));}var _0xaea6db=this[_0x719a('0x10')]['sync'](this,_0x4c0970[_0x719a('0x10d')]);if(!_0xaea6db){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x4c0970,_0x719a('0xd8'));}return this[_0x719a('0x38')]['setVariable'](_0xaea6db,_0x4c0970['variable_value']);};AGIVertices[_0x719a('0xf')][_0x719a('0x1aa')]=function(_0x578600){logger[_0x719a('0x2c')](util['format'](_0x719a('0x1ab'),_0x578600[_0x719a('0x36')]));this[_0x719a('0x38')][_0x719a('0xaa')]('START\x20CALLY\x20SQUARE');if(_0x578600[_0x719a('0xbb')]==='yes'){this['channel'][_0x719a('0xaa')]('Answer');return this[_0x719a('0x38')][_0x719a('0xbb')]();}return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0x1ac'));};AGIVertices['prototype']['subproject']=function(_0x33bcbf){logger['info'](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x33bcbf[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x33bcbf['project_id'])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x33bcbf,_0x719a('0x1ad'));}var _0x5714bb=this[_0x719a('0x18')][_0x719a('0x71')](this,_0x33bcbf[_0x719a('0x1ae')]);if(!this[_0x719a('0x86')](_0x5714bb)){return this[_0x719a('0x38')]['error'](_0x33bcbf,util[_0x719a('0x27')](_0x719a('0x1af'),_0x33bcbf[_0x719a('0x1ae')]));}if(_0x5714bb===this[_0x719a('0x38')][_0x719a('0x40')]){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x33bcbf,_0x719a('0x1b0'));}this[_0x719a('0x35')][_0x719a('0x71')](this,_0x33bcbf,_0x5714bb);var _0xfd8136=this['channel'][_0x719a('0x57')]('AGI',util[_0x719a('0x27')](_0x719a('0x1b1'),config[_0x719a('0xb9')][_0x719a('0x193')]||'127.0.0.1',_0x5714bb,this[_0x719a('0x38')][_0x719a('0x40')]));if(_0xfd8136[_0x719a('0xad')]===-0x1){return _0xfd8136;}return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0xc3'),_0x719a('0x1b2'),_0x5714bb));};AGIVertices['prototype']['system']=function(_0xe0fc99){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xe0fc99['label']));var _0x4436c5=this[_0x719a('0x56')][_0x719a('0x71')](this,_0xe0fc99[_0x719a('0x1b3')]);this['createSquareDetailsReport'][_0x719a('0x71')](this,_0xe0fc99,_0xe0fc99[_0x719a('0x1b3')]);if(this[_0x719a('0x86')](_0xe0fc99[_0x719a('0x10d')])){var _0x5480bb=this['getVariable'][_0x719a('0x71')](this,_0xe0fc99[_0x719a('0x10d')]);if(_0x5480bb){this[_0x719a('0x38')][_0x719a('0xa0')](_0x5480bb,_0x4436c5);return this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xe0fc99['command'],_0x5480bb));}}return this['channel'][_0x719a('0xaa')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xe0fc99['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x56e9fa){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x1b4'),_0x56e9fa[_0x719a('0x36')]));_0x56e9fa[_0x719a('0x5b')]=_0x56e9fa[_0x719a('0x5b')][_0x719a('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x56e9fa[_0x719a('0x5a')])){return this['channel']['noop'](_0x719a('0x1b5'));}if(!this[_0x719a('0x86')](_0x56e9fa['text'])){return this[_0x719a('0x38')][_0x719a('0xaa')](_0x719a('0xab'));}this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x1b6'),_0x56e9fa['text']));var _0x4770d4=this[_0x719a('0x59')][_0x719a('0x71')](this,_0x56e9fa);if(_0x4770d4){this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x1b7'),_0x4770d4));var _0x3ef481=this[_0x719a('0x38')][_0x719a('0x151')](_0x4770d4);try{fs[_0x719a('0xfe')](_0x4770d4+_0x719a('0xff'));}catch(_0x29df5f){logger[_0x719a('0x2a')](_0x29df5f);}return _0x3ef481;}return this[_0x719a('0x38')][_0x719a('0x2a')](_0x56e9fa,_0x719a('0x1b8'));};AGIVertices[_0x719a('0xf')]['tts']=function(_0x12a2ea){logger['info'](util[_0x719a('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x12a2ea[_0x719a('0x36')]));_0x12a2ea[_0x719a('0x5b')]=_0x12a2ea['text'][_0x719a('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x719a('0x86')](_0x12a2ea[_0x719a('0x5b')])){return this[_0x719a('0x38')]['noop'](_0x719a('0xab'));}this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0x1b9'),_0x12a2ea[_0x719a('0x5b')]));var _0x39348d=this[_0x719a('0x62')][_0x719a('0x71')](this,_0x12a2ea);if(_0x39348d){this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0x1ba'),_0x39348d));var _0x3139d5=this[_0x719a('0x38')]['streamFile'](_0x39348d);try{fs[_0x719a('0xfe')](_0x39348d+_0x719a('0xff'));}catch(_0x1abf40){logger[_0x719a('0x2a')](_0x1abf40);}return _0x3139d5;}return this['channel'][_0x719a('0x2a')](_0x12a2ea,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x719a('0xf')][_0x719a('0x1bb')]=function(_0x34f114){logger[_0x719a('0x2c')](util['format'](_0x719a('0x1bc'),_0x34f114[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x34f114[_0x719a('0x154')])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x34f114,_0x719a('0x155'));}logger[_0x719a('0x2c')](util['format'](_0x719a('0x156'),this[_0x719a('0x38')][_0x719a('0x3b')],_0x34f114['findBy']));var _0x565861=this['agentUnpause']['sync'](this,_0x34f114[_0x719a('0x154')]);if(_0x565861){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x719a('0x38')][_0x719a('0x3b')],_0x34f114[_0x719a('0x154')]));this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0x157'),this['channel']['callerid'],_0x34f114[_0x719a('0x154')]));return{'code':0xc8,'result':_0x719a('0x158')};}else{logger[_0x719a('0x2c')](util[_0x719a('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x719a('0x38')]['callerid'],_0x34f114[_0x719a('0x154')]));this[_0x719a('0x38')][_0x719a('0xaa')](util[_0x719a('0x27')](_0x719a('0x159'),this[_0x719a('0x38')]['callerid'],_0x34f114[_0x719a('0x154')]));return{'code':0xc8,'result':_0x719a('0x15a')};}};AGIVertices[_0x719a('0xf')][_0x719a('0x1bd')]=function(_0x131010){logger[_0x719a('0x2c')](util[_0x719a('0x27')](_0x719a('0x1be'),_0x131010['label']));var _0x31af51=this[_0x719a('0x38')]['exec'](_0x719a('0x1bf'),[_0x131010[_0x719a('0x1c0')],_0x131010[_0x719a('0x77')]]);if(_0x31af51[_0x719a('0xad')]===-0x1){return _0x31af51;}return this[_0x719a('0x38')]['noop'](util[_0x719a('0x27')](_0x719a('0xc3'),_0x719a('0x1bf'),_0x131010[_0x719a('0x1c0')]));};AGIVertices[_0x719a('0xf')]['vswitch']=function(_0x3f6457){logger[_0x719a('0x2c')](util[_0x719a('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3f6457[_0x719a('0x36')]));if(!this[_0x719a('0x86')](_0x3f6457[_0x719a('0x10d')])){return this[_0x719a('0x38')][_0x719a('0x2a')](_0x3f6457,'no\x20variable\x20selected');}var _0x26ae07=this[_0x719a('0x10')][_0x719a('0x71')](this,_0x3f6457[_0x719a('0x10d')]);if(!_0x26ae07){return this['channel'][_0x719a('0x2a')](_0x3f6457,_0x719a('0xd8'));}var _0x3d3ad8=this[_0x719a('0x38')][_0x719a('0x10')](_0x26ae07);return{'code':0xc8,'result':_0x3d3ad8[_0x719a('0xa3')]?_0x3d3ad8['extra']:'-'};};String[_0x719a('0xf')][_0x719a('0xa2')]=function(_0x20a2c4,_0x2242e1){return this[_0x719a('0xa1')](_0x20a2c4)['join'](_0x2242e1);};module[_0x719a('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6b12c8b..440c218 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 _0xedd9=['Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','stopAcw','[TIMER][STOP][AGENT:%s]','stringify','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]'];(function(_0x49a468,_0x74f71a){var _0x3cc35b=function(_0xc89ce7){while(--_0xc89ce7){_0x49a468['push'](_0x49a468['shift']());}};_0x3cc35b(++_0x74f71a);}(_0xedd9,0xfc));var _0x9edd=function(_0x8203b7,_0x117ba8){_0x8203b7=_0x8203b7-0x0;var _0x35ecfd=_0xedd9[_0x8203b7];return _0x35ecfd;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var ami=require(_0x9edd('0x2'));var logger=require(_0x9edd('0x3'))(_0x9edd('0x4'));var RpcUser=require(_0x9edd('0x5'));var RpcVoiceAgentReport=require(_0x9edd('0x6'));function Acw(_0x36b53f){this['voiceQueues']=_0x36b53f[_0x9edd('0x7')];this[_0x9edd('0x8')]=_0x36b53f[_0x9edd('0x8')];this[_0x9edd('0x9')]=_0x36b53f['timers'];this[_0x9edd('0xa')]={};ami['on']('agentconnect',this[_0x9edd('0xb')][_0x9edd('0xc')](this));ami['on'](_0x9edd('0xd'),this[_0x9edd('0xe')]['bind'](this));ami['on'](_0x9edd('0xf'),this['syncHangup'][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x10'),this['syncAgentRingNoAnswer'][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x11'),this['syncAttendedTransfer'][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x12'),this[_0x9edd('0x13')][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x14'),this[_0x9edd('0x15')][_0x9edd('0xc')](this));}function getDiff(_0xef5498){var _0x47eb64=moment()[_0x9edd('0x16')](0x0);var _0x44fc7c=moment(_0xef5498)[_0x9edd('0x16')](0x0);return _0x47eb64[_0x9edd('0x17')](_0x44fc7c,_0x9edd('0x18'));}Acw[_0x9edd('0x19')][_0x9edd('0x1a')]=function(_0x75a4ab){try{var _0x4ea60f=this;var _0x5f5bf4=this[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x1b')];var _0x5acf65=this[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x1c')];var _0x40ba32=this['voiceQueues'][_0x5acf65];var _0x43dc70=![];var _0x5d879c=_0x9edd('0x1d');if(_0x40ba32[_0x9edd('0x1e')]){if(_0x40ba32['mandatoryDispositionPause']['name']){_0x43dc70=!![];_0x5d879c=_0x40ba32[_0x9edd('0x1f')]['name'];}}ami[_0x9edd('0x20')]({'action':'QueuePause','interface':_0x5f5bf4,'paused':!![],'reason':_0x5d879c})['then'](function(_0x356751){if(_0x4ea60f[_0x9edd('0x8')][_0x5f5bf4]){return RpcUser['getAgent'](_0x4ea60f['agents'][_0x5f5bf4]['id'])[_0x9edd('0x21')](function(_0x186186){if(_0x186186&&!_0x186186[_0x9edd('0x22')]){logger['info'](_0x9edd('0x23'),_0x75a4ab,_0x5f5bf4,_0x5acf65);var _0x1dca43=_0x4ea60f[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x24')]&&_0x4ea60f[_0x9edd('0xa')][_0x75a4ab]['destlinkedid']?_0x4ea60f[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x25')]:_0x75a4ab;return RpcUser[_0x9edd('0x26')](_0x4ea60f[_0x9edd('0x8')][_0x5f5bf4],_0x5d879c,_0x1dca43)[_0x9edd('0x21')](function(_0x4d507f){if(!_0x43dc70){_0x4ea60f['timers'][_0x5f5bf4]={};logger[_0x9edd('0x27')](_0x9edd('0x28'),_0x75a4ab,_0x4ea60f[_0x9edd('0x7')][_0x5acf65][_0x9edd('0x29')],_0x5f5bf4,_0x5acf65);_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4]['timer']=setTimeout(_0x4ea60f['stopAcw'][_0x9edd('0xc')](_0x4ea60f,_0x5f5bf4),_0x4ea60f[_0x9edd('0x7')][_0x5acf65][_0x9edd('0x29')]*0x3e8);_0x4ea60f['timers'][_0x5f5bf4][_0x9edd('0x2a')]=moment()[_0x9edd('0x2b')](_0x9edd('0x2c'));_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4]['uniqueid']=_0x75a4ab;_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x1c')]=_0x5acf65;_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2d')]=function(){var _0xbbf08f=getDiff(_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2a')]);clearTimeout(_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2e')]);_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2e')]=![];RpcVoiceAgentReport[_0x9edd('0x2f')]({'acwtime':_0xbbf08f},_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x30')],_0x5f5bf4)[_0x9edd('0x21')](function(_0x5af178){logger[_0x9edd('0x27')](_0x9edd('0x31'),_0x75a4ab,_0xbbf08f,_0x5af178);})[_0x9edd('0x32')](function(_0x5d1707){logger[_0x9edd('0x33')](_0x9edd('0x34'),_0x75a4ab,_0x5d1707);});delete _0x4ea60f[_0x9edd('0x9')][_0x5f5bf4];};}});}else{logger[_0x9edd('0x27')](_0x9edd('0x35'),_0x75a4ab,_0x5f5bf4,_0x5acf65);}});}})[_0x9edd('0x32')](function(_0x473068){logger[_0x9edd('0x33')](_0x9edd('0x28'),_0x75a4ab,_0x4ea60f[_0x9edd('0x7')][_0x5acf65][_0x9edd('0x29')],_0x5f5bf4,_0x5acf65);})[_0x9edd('0x36')](function(){delete _0x4ea60f[_0x9edd('0xa')][_0x75a4ab];});}catch(_0x14f780){logger['error'](_0x9edd('0x37'),_0x14f780['message']);}};Acw[_0x9edd('0x19')][_0x9edd('0x38')]=function(_0x10d6fd){try{var _0x434d26=this;if(_0x434d26[_0x9edd('0x9')][_0x10d6fd]){_0x434d26['timers'][_0x10d6fd][_0x9edd('0x2e')]=![];var _0x44dbfc=_0x434d26[_0x9edd('0x9')][_0x10d6fd][_0x9edd('0x30')];var _0x1be77f=_0x434d26[_0x9edd('0x9')][_0x10d6fd][_0x9edd('0x1c')];var _0x1cbbac=_0x434d26[_0x9edd('0x7')][_0x1be77f][_0x9edd('0x29')];logger['info'](_0x9edd('0x39'),_0x10d6fd);RpcUser['saveUnpause'](this[_0x9edd('0x8')][_0x10d6fd]);RpcVoiceAgentReport['update']({'acwtime':_0x1cbbac,'agentacw':!![]},_0x44dbfc,_0x10d6fd)[_0x9edd('0x21')](function(_0x2858b5){logger[_0x9edd('0x27')]('[%s][UPDATE][ACWTIME:%s]',_0x44dbfc,_0x1cbbac,_0x2858b5);})[_0x9edd('0x32')](function(_0xcbd0ef){logger[_0x9edd('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x44dbfc,_0xcbd0ef);});}else{logger[_0x9edd('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x10d6fd);if(_0x434d26[_0x9edd('0x9')]){logger[_0x9edd('0x27')]('[ACW][TIMERS]',JSON[_0x9edd('0x3a')](_0x434d26[_0x9edd('0x9')]));}}}catch(_0x389f51){logger[_0x9edd('0x33')]('[ACW][STOP]\x20%s',_0x389f51[_0x9edd('0x3b')]);}};Acw['prototype'][_0x9edd('0xb')]=function(_0xc1e657){try{if(this['voiceQueues'][_0xc1e657[_0x9edd('0x1c')]]&&(this['voiceQueues'][_0xc1e657['queue']][_0x9edd('0x4')]||this[_0x9edd('0x7')][_0xc1e657[_0x9edd('0x1c')]][_0x9edd('0x1e')])){if(this[_0x9edd('0x8')][_0xc1e657[_0x9edd('0x1b')]]){this[_0x9edd('0xa')][_0xc1e657[_0x9edd('0x30')]]={'queue':_0xc1e657[_0x9edd('0x1c')],'interface':_0xc1e657[_0x9edd('0x1b')],'destlinkedid':_0xc1e657[_0x9edd('0x25')]};}}}catch(_0x3be90c){logger[_0x9edd('0x33')](_0x9edd('0x3c'),_0x3be90c[_0x9edd('0x3b')]);}};Acw['prototype'][_0x9edd('0x15')]=function(_0x2570e3){try{if(this[_0x9edd('0x7')][_0x2570e3[_0x9edd('0x1c')]]&&(this[_0x9edd('0x7')][_0x2570e3[_0x9edd('0x1c')]][_0x9edd('0x4')]||this['voiceQueues'][_0x2570e3['queue']]['mandatoryDisposition'])){if(this[_0x9edd('0x8')][_0x2570e3['interface']]){this[_0x9edd('0xa')][_0x2570e3[_0x9edd('0x30')]]={'queue':_0x2570e3[_0x9edd('0x1c')],'interface':_0x2570e3[_0x9edd('0x1b')]};}}}catch(_0x367791){logger['error'](_0x9edd('0x3d'),_0x367791[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncHangupRequest']=function(_0x3626bc){try{if(this[_0x9edd('0xa')][_0x3626bc[_0x9edd('0x30')]]&&_[_0x9edd('0x3e')](this[_0x9edd('0xa')][_0x3626bc[_0x9edd('0x30')]]['attended'])){logger[_0x9edd('0x27')](_0x9edd('0x3f'),_0x3626bc['uniqueid']);this[_0x9edd('0x1a')](_0x3626bc[_0x9edd('0x30')]);}else if(this['channels'][_0x3626bc[_0x9edd('0x40')]]&&_[_0x9edd('0x3e')](this[_0x9edd('0xa')][_0x3626bc['linkedid']][_0x9edd('0x24')])){logger[_0x9edd('0x27')](_0x9edd('0x41'),_0x3626bc[_0x9edd('0x40')]);this['startAcw'](_0x3626bc[_0x9edd('0x40')]);}}catch(_0x527727){logger[_0x9edd('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x527727[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncHangup']=function(_0x8e59bd){try{if(this['channels'][_0x8e59bd[_0x9edd('0x30')]]&&this[_0x9edd('0xa')][_0x8e59bd[_0x9edd('0x30')]][_0x9edd('0x24')]){logger[_0x9edd('0x27')](_0x9edd('0x42'),_0x8e59bd[_0x9edd('0x30')]);this[_0x9edd('0x1a')](_0x8e59bd[_0x9edd('0x30')]);}else if(this[_0x9edd('0xa')][_0x8e59bd[_0x9edd('0x40')]]&&this['channels'][_0x8e59bd[_0x9edd('0x40')]][_0x9edd('0x24')]){logger[_0x9edd('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x8e59bd[_0x9edd('0x40')]);this['startAcw'](_0x8e59bd['linkedid']);}}catch(_0x54ecfa){logger[_0x9edd('0x33')](_0x9edd('0x43'),_0x54ecfa[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncAttendedTransfer']=function(_0x56b38b){try{if(!_['isNil'](this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x44')]])){this[_0x9edd('0x1a')](_0x56b38b[_0x9edd('0x44')]);if(this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x45')]]){this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x45')]]['attended']=!![];this[_0x9edd('0xa')][_0x56b38b['transfertargetuniqueid']]=this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x45')]];delete this['channels'][_0x56b38b[_0x9edd('0x45')]];}}else if(!_[_0x9edd('0x46')](this[_0x9edd('0xa')][_0x56b38b['transfertargetuniqueid']])){this[_0x9edd('0x1a')](_0x56b38b[_0x9edd('0x47')]);if(this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x48')]]){this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x48')]]['attended']=!![];this['channels'][_0x56b38b[_0x9edd('0x44')]]=this['channels'][_0x56b38b[_0x9edd('0x48')]];delete this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x48')]];}}}catch(_0x17d2f2){logger['error'](_0x9edd('0x49'),_0x17d2f2['message']);}};Acw[_0x9edd('0x19')][_0x9edd('0x13')]=function(_0xc6bde6){try{if(this['channels'][_0xc6bde6[_0x9edd('0x4a')]]){logger['info'](_0x9edd('0x4b'),JSON[_0x9edd('0x3a')](_0xc6bde6['transfereruniqueid']));this[_0x9edd('0x1a')](_0xc6bde6['transfereruniqueid']);}else if(this[_0x9edd('0xa')][_0xc6bde6[_0x9edd('0x4c')]]){logger[_0x9edd('0x27')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x9edd('0x3a')](_0xc6bde6[_0x9edd('0x4c')]));this[_0x9edd('0x1a')](_0xc6bde6[_0x9edd('0x4c')]);}}catch(_0x467512){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x467512[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncAgentRingNoAnswer']=function(_0x5496e9){try{if(this['voiceQueues'][_0x5496e9[_0x9edd('0x1c')]]&&this['voiceQueues'][_0x5496e9['queue']][_0x9edd('0x4d')]===_0x9edd('0x4e')){if(this['agents'][_0x5496e9[_0x9edd('0x1b')]]){logger[_0x9edd('0x27')](_0x9edd('0x4f'),_0x5496e9['uniqueid'],_0x5496e9[_0x9edd('0x1b')],_0x5496e9['queue']);return RpcUser[_0x9edd('0x26')](this[_0x9edd('0x8')][_0x5496e9['interface']],_0x9edd('0x50'),_0x5496e9[_0x9edd('0x30')]);}}}catch(_0x5c1746){logger[_0x9edd('0x33')](_0x9edd('0x51'),_0x5c1746[_0x9edd('0x3b')]);}};module[_0x9edd('0x52')]=Acw; \ No newline at end of file +var _0xa8a8=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','interface','ACW','mandatoryDisposition','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%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]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer'];(function(_0x19e55c,_0xc6fde6){var _0x1f1579=function(_0x3a360a){while(--_0x3a360a){_0x19e55c['push'](_0x19e55c['shift']());}};_0x1f1579(++_0xc6fde6);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4f9dea,_0x1afd06){_0x4f9dea=_0x4f9dea-0x0;var _0x23fef8=_0xa8a8[_0x4f9dea];return _0x23fef8;};'use strict';var util=require(_0x8a8a('0x0'));var _=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var ami=require(_0x8a8a('0x3'));var logger=require('../../../config/logger')(_0x8a8a('0x4'));var RpcUser=require(_0x8a8a('0x5'));var RpcVoiceAgentReport=require(_0x8a8a('0x6'));function Acw(_0x3ed1de){this[_0x8a8a('0x7')]=_0x3ed1de[_0x8a8a('0x7')];this[_0x8a8a('0x8')]=_0x3ed1de[_0x8a8a('0x8')];this[_0x8a8a('0x9')]=_0x3ed1de[_0x8a8a('0x9')];this[_0x8a8a('0xa')]={};ami['on'](_0x8a8a('0xb'),this[_0x8a8a('0xc')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x8a8a('0xf'),this['syncHangup'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x10'),this['syncAgentRingNoAnswer'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x11'),this[_0x8a8a('0x12')]['bind'](this));ami['on'](_0x8a8a('0x13'),this[_0x8a8a('0x14')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x15'),this['syncAgentConnectPreview'][_0x8a8a('0xd')](this));}function getDiff(_0x4e5d74){var _0x25e1d5=moment()[_0x8a8a('0x16')](0x0);var _0x787eec=moment(_0x4e5d74)[_0x8a8a('0x16')](0x0);return _0x25e1d5[_0x8a8a('0x17')](_0x787eec,_0x8a8a('0x18'));}Acw[_0x8a8a('0x19')]['startAcw']=function(_0x1ed3be){try{var _0x568b83=this;var _0x1f36b6=this[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x1a')];var _0x4291e9=this[_0x8a8a('0xa')][_0x1ed3be]['queue'];var _0x9d55f9=this[_0x8a8a('0x7')][_0x4291e9];var _0x262ca9=![];var _0x2bce13=_0x8a8a('0x1b');if(_0x9d55f9[_0x8a8a('0x1c')]){if(_0x9d55f9['mandatoryDispositionPause']['name']){_0x262ca9=!![];_0x2bce13=_0x9d55f9['mandatoryDispositionPause']['name'];}}ami['Action']({'action':_0x8a8a('0x1d'),'interface':_0x1f36b6,'paused':!![],'reason':_0x2bce13})[_0x8a8a('0x1e')](function(_0xe0f449){if(_0x568b83[_0x8a8a('0x8')][_0x1f36b6]){return RpcUser[_0x8a8a('0x1f')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6]['id'])[_0x8a8a('0x1e')](function(_0xe0321c){if(_0xe0321c&&!_0xe0321c[_0x8a8a('0x20')]){logger[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x1ed3be,_0x1f36b6,_0x4291e9);var _0x3aa2bb=_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x23')]&&_0x568b83[_0x8a8a('0xa')][_0x1ed3be]['destlinkedid']?_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x24')]:_0x1ed3be;return RpcUser[_0x8a8a('0x25')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6],_0x2bce13,_0x3aa2bb)[_0x8a8a('0x1e')](function(_0x251315){if(!_0x262ca9){_0x568b83[_0x8a8a('0x9')][_0x1f36b6]={};logger['info'](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);_0x568b83['timers'][_0x1f36b6]['timer']=setTimeout(_0x568b83[_0x8a8a('0x28')][_0x8a8a('0xd')](_0x568b83,_0x1f36b6),_0x568b83['voiceQueues'][_0x4291e9]['acwTimeout']*0x3e8);_0x568b83['timers'][_0x1f36b6][_0x8a8a('0x29')]=moment()['format'](_0x8a8a('0x2a'));_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid']=_0x1ed3be;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2b')]=_0x4291e9;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2c')]=function(){var _0x41802e=getDiff(_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x29')]);clearTimeout(_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['timer']);_0x568b83['timers'][_0x1f36b6]['timer']=![];RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x41802e},_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid'],_0x1f36b6)[_0x8a8a('0x1e')](function(_0x304e83){logger['info'](_0x8a8a('0x2e'),_0x1ed3be,_0x41802e,_0x304e83);})[_0x8a8a('0x2f')](function(_0x63b9be){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1ed3be,_0x63b9be);});delete _0x568b83[_0x8a8a('0x9')][_0x1f36b6];};}});}else{logger['info'](_0x8a8a('0x30'),_0x1ed3be,_0x1f36b6,_0x4291e9);}});}})[_0x8a8a('0x2f')](function(_0x3ecbca){logger[_0x8a8a('0x31')](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);})[_0x8a8a('0x32')](function(){delete _0x568b83[_0x8a8a('0xa')][_0x1ed3be];});}catch(_0xf7d4d7){logger[_0x8a8a('0x31')](_0x8a8a('0x33'),_0xf7d4d7[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x28')]=function(_0xac4c53){try{var _0x8e3017=this;if(_0x8e3017[_0x8a8a('0x9')][_0xac4c53]){_0x8e3017['timers'][_0xac4c53]['timer']=![];var _0x53da01=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x35')];var _0x376de3=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x2b')];var _0x508e67=_0x8e3017['voiceQueues'][_0x376de3][_0x8a8a('0x27')];logger['info'](_0x8a8a('0x36'),_0xac4c53);RpcUser['saveUnpause'](this['agents'][_0xac4c53]);RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x508e67,'agentacw':!![]},_0x53da01,_0xac4c53)[_0x8a8a('0x1e')](function(_0x285e2c){logger[_0x8a8a('0x21')](_0x8a8a('0x2e'),_0x53da01,_0x508e67,_0x285e2c);})[_0x8a8a('0x2f')](function(_0x20584a){logger['error'](_0x8a8a('0x37'),_0x53da01,_0x20584a);});}else{logger[_0x8a8a('0x31')](_0x8a8a('0x38'),_0xac4c53);if(_0x8e3017['timers']){logger[_0x8a8a('0x21')](_0x8a8a('0x39'),JSON[_0x8a8a('0x3a')](_0x8e3017['timers']));}}}catch(_0x3fda48){logger[_0x8a8a('0x31')](_0x8a8a('0x3b'),_0x3fda48[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0xc')]=function(_0x4ffdd9){try{if(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]][_0x8a8a('0x4')]||this['voiceQueues'][_0x4ffdd9['queue']][_0x8a8a('0x1c')])){if(this[_0x8a8a('0x8')][_0x4ffdd9[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x4ffdd9['uniqueid']]={'queue':_0x4ffdd9[_0x8a8a('0x2b')],'interface':_0x4ffdd9['interface'],'destlinkedid':_0x4ffdd9[_0x8a8a('0x24')]};}}}catch(_0x1629dc){logger['error'](_0x8a8a('0x3c'),_0x1629dc[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAgentConnectPreview']=function(_0x177f89){try{if(this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x177f89['queue']][_0x8a8a('0x4')]||this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]['mandatoryDisposition'])){if(this[_0x8a8a('0x8')][_0x177f89[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x177f89[_0x8a8a('0x35')]]={'queue':_0x177f89[_0x8a8a('0x2b')],'interface':_0x177f89[_0x8a8a('0x1a')]};}}}catch(_0x13c233){logger[_0x8a8a('0x31')](_0x8a8a('0x3d'),_0x13c233[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncHangupRequest']=function(_0x1ad19b){try{if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]&&_[_0x8a8a('0x3e')](this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]['attended'])){logger[_0x8a8a('0x21')](_0x8a8a('0x3f'),_0x1ad19b[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x1ad19b['uniqueid']);}else if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x41')]]&&_[_0x8a8a('0x3e')](this['channels'][_0x1ad19b['linkedid']][_0x8a8a('0x23')])){logger[_0x8a8a('0x21')](_0x8a8a('0x42'),_0x1ad19b[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x1ad19b[_0x8a8a('0x41')]);}}catch(_0x1d1b5c){logger[_0x8a8a('0x31')](_0x8a8a('0x43'),_0x1d1b5c['message']);}};Acw['prototype'][_0x8a8a('0x44')]=function(_0x10f689){try{if(this['channels'][_0x10f689['uniqueid']]&&this[_0x8a8a('0xa')][_0x10f689['uniqueid']][_0x8a8a('0x23')]){logger['info'](_0x8a8a('0x45'),_0x10f689[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x35')]);}else if(this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]]&&this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]][_0x8a8a('0x23')]){logger[_0x8a8a('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x10f689[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x41')]);}}catch(_0x1e3bf5){logger[_0x8a8a('0x31')]('[ACW][syncHangup]\x20%s',_0x1e3bf5[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAttendedTransfer']=function(_0x5c5cb6){try{if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]])){this[_0x8a8a('0x40')](_0x5c5cb6[_0x8a8a('0x47')]);if(this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']]){this['channels'][_0x5c5cb6['secondtransfereruniqueid']][_0x8a8a('0x23')]=!![];this['channels'][_0x5c5cb6[_0x8a8a('0x48')]]=this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x49')]];}}else if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6['transfertargetuniqueid']])){this[_0x8a8a('0x40')](_0x5c5cb6['transfertargetuniqueid']);if(this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]]){this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]][_0x8a8a('0x23')]=!![];this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]]=this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]];}}}catch(_0x5b029e){logger['error'](_0x8a8a('0x4b'),_0x5b029e['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x395564){try{if(this[_0x8a8a('0xa')][_0x395564['transfereruniqueid']]){logger[_0x8a8a('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x395564[_0x8a8a('0x4c')]));this[_0x8a8a('0x40')](_0x395564['transfereruniqueid']);}else if(this[_0x8a8a('0xa')][_0x395564[_0x8a8a('0x4d')]]){logger[_0x8a8a('0x21')](_0x8a8a('0x4e'),JSON[_0x8a8a('0x3a')](_0x395564[_0x8a8a('0x4d')]));this['startAcw'](_0x395564[_0x8a8a('0x4d')]);}}catch(_0x402b5f){logger['error'](_0x8a8a('0x4f'),_0x402b5f[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x50')]=function(_0x3c2f8d){try{if(this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]]&&this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]][_0x8a8a('0x51')]==='all'){if(this[_0x8a8a('0x8')][_0x3c2f8d[_0x8a8a('0x1a')]]){logger['info'](_0x8a8a('0x52'),_0x3c2f8d[_0x8a8a('0x35')],_0x3c2f8d[_0x8a8a('0x1a')],_0x3c2f8d[_0x8a8a('0x2b')]);return RpcUser[_0x8a8a('0x25')](this['agents'][_0x3c2f8d[_0x8a8a('0x1a')]],_0x8a8a('0x53'),_0x3c2f8d[_0x8a8a('0x35')]);}}}catch(_0x2984eb){logger[_0x8a8a('0x31')](_0x8a8a('0x54'),_0x2984eb[_0x8a8a('0x34')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cb7b9ce..47c36c7 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 _0xe2b3=['../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','catch','exports','asterisk-manager','bluebird','moment','util','lodash'];(function(_0x22ca63,_0xd263ec){var _0xadc6dc=function(_0x4cd069){while(--_0x4cd069){_0x22ca63['push'](_0x22ca63['shift']());}};_0xadc6dc(++_0xd263ec);}(_0xe2b3,0xa3));var _0x3e2b=function(_0x3e8314,_0x1284f1){_0x3e8314=_0x3e8314-0x0;var _0x42df7b=_0xe2b3[_0x3e8314];return _0x42df7b;};'use strict';var Manager=require(_0x3e2b('0x0'));var BPromise=require(_0x3e2b('0x1'));var moment=require(_0x3e2b('0x2'));var util=require(_0x3e2b('0x3'));var _=require(_0x3e2b('0x4'));var logger=require(_0x3e2b('0x5'))(_0x3e2b('0x6'));var config=require('../../config/environment');var ami=new Manager(config[_0x3e2b('0x7')][_0x3e2b('0x8')],config[_0x3e2b('0x7')]['ip'],config['asterisk'][_0x3e2b('0x9')],config['asterisk'][_0x3e2b('0xa')],!![]);ami[_0x3e2b('0xb')]();ami[_0x3e2b('0xc')]=BPromise[_0x3e2b('0xd')](ami[_0x3e2b('0xe')]);function error(_0xbf9f85){logger[_0x3e2b('0xf')](util[_0x3e2b('0x10')](_0x3e2b('0x11'),config[_0x3e2b('0x7')][_0x3e2b('0x9')],config['asterisk']['ip'],config[_0x3e2b('0x7')][_0x3e2b('0x8')],util[_0x3e2b('0x12')](_0xbf9f85,![],null)));}function close(){logger[_0x3e2b('0xf')](util[_0x3e2b('0x10')](_0x3e2b('0x13'),config[_0x3e2b('0x7')][_0x3e2b('0x9')],config['asterisk']['ip'],config[_0x3e2b('0x7')][_0x3e2b('0x8')]));}ami[_0x3e2b('0x14')]=function(){return function(){return ami[_0x3e2b('0xc')]({'action':_0x3e2b('0x15')});};};ami[_0x3e2b('0x16')]=function(){return function(){return ami['Action']({'action':_0x3e2b('0x17')});};};ami[_0x3e2b('0x18')]=function(){return function(){return ami['Action']({'action':_0x3e2b('0x19')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x3e2b('0xc')]({'action':'queuesummary'});};};ami[_0x3e2b('0x1a')]=function(){return function(){return ami[_0x3e2b('0xc')]({'action':_0x3e2b('0x1b')});};};function connect(_0x53f9b3){logger['info'](util['format'](_0x3e2b('0x1c'),config[_0x3e2b('0x7')][_0x3e2b('0x9')],config[_0x3e2b('0x7')]['ip'],config[_0x3e2b('0x7')]['port']));ami[_0x3e2b('0x1d')](_0x3e2b('0xf'),error);ami[_0x3e2b('0x1d')](_0x3e2b('0x1e'),close);}ami['on'](_0x3e2b('0x1f'),connect);ami['on'](_0x3e2b('0x20'),function(_0x28ac53){logger[_0x3e2b('0x21')](util[_0x3e2b('0x10')](_0x3e2b('0x22'),config[_0x3e2b('0x7')][_0x3e2b('0x9')],config[_0x3e2b('0x7')]['ip'],config['asterisk'][_0x3e2b('0x8')],util[_0x3e2b('0x12')](_0x28ac53,![],null)));});ami['on'](_0x3e2b('0x23'),function(_0x50b428){logger[_0x3e2b('0x21')](util['format'](_0x3e2b('0x24'),config[_0x3e2b('0x7')][_0x3e2b('0x9')],config[_0x3e2b('0x7')]['ip'],config['asterisk']['port']));return BPromise[_0x3e2b('0x25')]()[_0x3e2b('0x26')](ami[_0x3e2b('0x14')]())[_0x3e2b('0x26')](ami['actionDeviceStateList']())[_0x3e2b('0x26')](ami['actionSipPeerStatus']())[_0x3e2b('0x26')](ami[_0x3e2b('0x27')]())['then'](ami[_0x3e2b('0x1a')]())[_0x3e2b('0x28')](function(_0x569a6b){console['log'](_0x569a6b);});});ami['once']('error',error);ami[_0x3e2b('0x1d')](_0x3e2b('0x1e'),close);module[_0x3e2b('0x29')]=ami; \ No newline at end of file +var _0x4d19=['keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','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','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipPeerStatus','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','asterisk','password'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d19,0x1f3));var _0x94d1=function(_0x1bed8f,_0x412dc0){_0x1bed8f=_0x1bed8f-0x0;var _0x399631=_0x4d19[_0x1bed8f];return _0x399631;};'use strict';var Manager=require(_0x94d1('0x0'));var BPromise=require(_0x94d1('0x1'));var moment=require(_0x94d1('0x2'));var util=require(_0x94d1('0x3'));var _=require(_0x94d1('0x4'));var logger=require('../../config/logger')(_0x94d1('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config[_0x94d1('0x6')]['ip'],config[_0x94d1('0x6')]['username'],config[_0x94d1('0x6')][_0x94d1('0x7')],!![]);ami[_0x94d1('0x8')]();ami[_0x94d1('0x9')]=BPromise[_0x94d1('0xa')](ami['action']);function error(_0xac0b34){logger[_0x94d1('0xb')](util[_0x94d1('0xc')](_0x94d1('0xd'),config['asterisk'][_0x94d1('0xe')],config[_0x94d1('0x6')]['ip'],config[_0x94d1('0x6')][_0x94d1('0xf')],util[_0x94d1('0x10')](_0xac0b34,![],null)));}function close(){logger['error'](util['format'](_0x94d1('0x11'),config[_0x94d1('0x6')][_0x94d1('0xe')],config[_0x94d1('0x6')]['ip'],config[_0x94d1('0x6')]['port']));}ami[_0x94d1('0x12')]=function(){return function(){return ami[_0x94d1('0x9')]({'action':_0x94d1('0x13')});};};ami[_0x94d1('0x14')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x94d1('0x9')]({'action':_0x94d1('0x15')});};};ami[_0x94d1('0x16')]=function(){return function(){return ami['Action']({'action':_0x94d1('0x17')});};};ami[_0x94d1('0x18')]=function(){return function(){return ami['Action']({'action':_0x94d1('0x19')});};};function connect(_0xef9813){logger[_0x94d1('0x1a')](util[_0x94d1('0xc')](_0x94d1('0x1b'),config[_0x94d1('0x6')][_0x94d1('0xe')],config[_0x94d1('0x6')]['ip'],config[_0x94d1('0x6')][_0x94d1('0xf')]));ami['once'](_0x94d1('0xb'),error);ami[_0x94d1('0x1c')](_0x94d1('0x1d'),close);}ami['on'](_0x94d1('0x1e'),connect);ami['on'](_0x94d1('0x1f'),function(_0x549ee8){logger[_0x94d1('0x1a')](util[_0x94d1('0xc')](_0x94d1('0x20'),config[_0x94d1('0x6')][_0x94d1('0xe')],config['asterisk']['ip'],config[_0x94d1('0x6')][_0x94d1('0xf')],util[_0x94d1('0x10')](_0x549ee8,![],null)));});ami['on'](_0x94d1('0x21'),function(_0x481450){logger[_0x94d1('0x1a')](util[_0x94d1('0xc')](_0x94d1('0x22'),config[_0x94d1('0x6')][_0x94d1('0xe')],config['asterisk']['ip'],config[_0x94d1('0x6')][_0x94d1('0xf')]));return BPromise['resolve']()[_0x94d1('0x23')](ami[_0x94d1('0x12')]())[_0x94d1('0x23')](ami[_0x94d1('0x14')]())[_0x94d1('0x23')](ami[_0x94d1('0x24')]())[_0x94d1('0x23')](ami[_0x94d1('0x16')]())[_0x94d1('0x23')](ami['actionCoreShowChannels']())['catch'](function(_0x442f7f){console[_0x94d1('0x25')](_0x442f7f);});});ami[_0x94d1('0x1c')](_0x94d1('0xb'),error);ami[_0x94d1('0x1c')](_0x94d1('0x1d'),close);module[_0x94d1('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2ed9dba..e344b56 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 _0x0620=['message','result','exports','jayson/promise','bluebird','../../config/logger','Request','request','debug','rpc','memberReport','error'];(function(_0x208630,_0x474910){var _0x5b7f61=function(_0x3f34e1){while(--_0x3f34e1){_0x208630['push'](_0x208630['shift']());}};_0x5b7f61(++_0x474910);}(_0x0620,0x16b));var _0x0062=function(_0x50d086,_0x4e96e0){_0x50d086=_0x50d086-0x0;var _0x2e9e27=_0x0620[_0x50d086];return _0x2e9e27;};'use strict';var jayson=require(_0x0062('0x0'));var BPromise=require(_0x0062('0x1'));var logger=require(_0x0062('0x2'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0x0062('0x3')]=function(_0x1eda7a,_0x519b45){return new BPromise(function(_0x4a08ed,_0x5d2740){return client[_0x0062('0x4')](_0x1eda7a,_0x519b45)['then'](function(_0x1822fb){logger[_0x0062('0x5')](_0x0062('0x6'),_0x0062('0x7'),_0x1eda7a,_0x519b45,_0x1822fb);if(_0x1822fb[_0x0062('0x8')]){logger['error'](_0x0062('0x6'),_0x0062('0x7'),_0x1eda7a,_0x1822fb[_0x0062('0x8')][_0x0062('0x9')],_0x519b45);return _0x5d2740(_0x1822fb[_0x0062('0x8')][_0x0062('0x9')]);}else{return _0x4a08ed(_0x1822fb[_0x0062('0xa')]);}})['catch'](function(_0x4bccc8){logger['error'](_0x0062('0x6'),_0x0062('0x7'),_0x1eda7a,_0x4bccc8,_0x519b45);return _0x5d2740(_0x4bccc8);});});};module[_0x0062('0xb')]=client; \ No newline at end of file +var _0x042b=['jayson/promise','bluebird','../../config/logger','ami','client','http','Request','request','then','debug','rpc','memberReport','error','message','result','catch'];(function(_0xe23713,_0x419a1b){var _0x1ac7ce=function(_0x2f51c2){while(--_0x2f51c2){_0xe23713['push'](_0xe23713['shift']());}};_0x1ac7ce(++_0x419a1b);}(_0x042b,0x80));var _0xb042=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x042b[_0x3b380d];return _0x54502b;};'use strict';var jayson=require(_0xb042('0x0'));var BPromise=require(_0xb042('0x1'));var logger=require(_0xb042('0x2'))(_0xb042('0x3'));var client=jayson[_0xb042('0x4')][_0xb042('0x5')]({'port':0x2329});client[_0xb042('0x6')]=function(_0x3da085,_0x3aca82){return new BPromise(function(_0x22896c,_0x49de52){return client[_0xb042('0x7')](_0x3da085,_0x3aca82)[_0xb042('0x8')](function(_0x15bd3d){logger[_0xb042('0x9')](_0xb042('0xa'),_0xb042('0xb'),_0x3da085,_0x3aca82,_0x15bd3d);if(_0x15bd3d['error']){logger[_0xb042('0xc')](_0xb042('0xa'),_0xb042('0xb'),_0x3da085,_0x15bd3d[_0xb042('0xc')][_0xb042('0xd')],_0x3aca82);return _0x49de52(_0x15bd3d[_0xb042('0xc')]['message']);}else{return _0x22896c(_0x15bd3d[_0xb042('0xe')]);}})[_0xb042('0xf')](function(_0x461103){logger[_0xb042('0xc')](_0xb042('0xa'),_0xb042('0xb'),_0x3da085,_0x461103,_0x3aca82);return _0x49de52(_0x461103);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index e05e6ff..30208ea 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d40=['callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue','queue','exports','util','lodash','string','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x457cbd,_0xc0060){var _0x24ae5b=function(_0x9bec66){while(--_0x9bec66){_0x457cbd['push'](_0x457cbd['shift']());}};_0x24ae5b(++_0xc0060);}(_0x5d40,0x1a2));var _0x05d4=function(_0x378f94,_0x3e06c7){_0x378f94=_0x378f94-0x0;var _0x24c437=_0x5d40[_0x378f94];return _0x24c437;};'use strict';var util=require(_0x05d4('0x0'));var _=require(_0x05d4('0x1'));var moment=require('moment');function checkNameSurname(_0x12afd8,_0x5cb585,_0x2f4e46){var _0x41bae7='';if(!_['isNil'](_0x5cb585)&&_0x05d4('0x2')===typeof _0x5cb585){_0x41bae7+=_0x5cb585;}if(!_['isNil'](_0x2f4e46)&&'string'===typeof _0x2f4e46){_0x41bae7+='\x20'+_0x2f4e46;}if(_0x41bae7!==''){return _0x41bae7;}return _0x12afd8;}function Action(_0x3d00e7,_0x494cff,_0x284a89){this['voiceQueue']=_0x3d00e7;this['uniqueid']=_0x284a89||undefined;this[_0x05d4('0x3')]=checkNameSurname(_0x494cff[_0x05d4('0x4')][_0x05d4('0x5')],_0x494cff[_0x05d4('0x4')]['firstName'],_0x494cff[_0x05d4('0x4')][_0x05d4('0x6')]);this[_0x05d4('0x7')]=_0x494cff[_0x05d4('0x4')]['phone'];this['queue']=_0x3d00e7['name'];this[_0x05d4('0x8')]=_0x494cff['active']||![];this[_0x05d4('0x9')]=_0x3d00e7[_0x05d4('0x9')];this[_0x05d4('0xa')]=_0x3d00e7[_0x05d4('0xa')]||0x3;this[_0x05d4('0xb')]=_0x494cff['scheduledat'];this[_0x05d4('0xc')]=_0x494cff[_0x05d4('0xc')];this['countcongestionretry']=_0x494cff[_0x05d4('0xd')];this[_0x05d4('0xe')]=_0x494cff[_0x05d4('0xe')];this[_0x05d4('0xf')]=_0x494cff[_0x05d4('0xf')];this[_0x05d4('0x10')]=_0x494cff['countdropretry'];this[_0x05d4('0x11')]=_0x494cff[_0x05d4('0x11')];this['countmachineretry']=_0x494cff[_0x05d4('0x12')];this[_0x05d4('0x13')]=_0x494cff[_0x05d4('0x13')];this['ContactId']=_0x494cff[_0x05d4('0x14')];this[_0x05d4('0x15')]=_0x494cff[_0x05d4('0x15')];this[_0x05d4('0x16')]=_0x494cff[_0x05d4('0x16')];this[_0x05d4('0x17')]=_0x494cff[_0x05d4('0x17')];this[_0x05d4('0x18')]=_0x494cff[_0x05d4('0x18')];this[_0x05d4('0x19')]=_0x494cff['id'];this[_0x05d4('0x1a')]=_0x494cff[_0x05d4('0x4')][_0x05d4('0x1b')]||'';this[_0x05d4('0x1c')]=moment()[_0x05d4('0x1d')](_0x05d4('0x1e'));this[_0x05d4('0x1f')]=_0x494cff[_0x05d4('0x1f')];this[_0x05d4('0x20')]=_0x494cff[_0x05d4('0x20')];this[_0x05d4('0x21')]=_0x494cff[_0x05d4('0x21')];this[_0x05d4('0x22')]=_0x494cff[_0x05d4('0x22')];this[_0x05d4('0x23')]='';this[_0x05d4('0x24')]='';}Action[_0x05d4('0x25')]['getCaller']=function(){return util[_0x05d4('0x1d')](_0x05d4('0x26'),this['name'],this['voiceQueue'][_0x05d4('0x27')]>0x0?this[_0x05d4('0x7')][_0x05d4('0x28')](this[_0x05d4('0x29')][_0x05d4('0x27')]):this[_0x05d4('0x7')]);};Action[_0x05d4('0x25')][_0x05d4('0x2a')]=function(){return this[_0x05d4('0x2b')];};module[_0x05d4('0x2c')]=Action; \ No newline at end of file +var _0x6f7a=['util','lodash','moment','isNil','string','voiceQueue','uniqueid','phone','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','exports'];(function(_0x39a621,_0xc278b4){var _0x470c4a=function(_0x317c91){while(--_0x317c91){_0x39a621['push'](_0x39a621['shift']());}};_0x470c4a(++_0xc278b4);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4f4999,_0x2b9f2e){_0x4f4999=_0x4f4999-0x0;var _0x405481=_0x6f7a[_0x4f4999];return _0x405481;};'use strict';var util=require(_0xa6f7('0x0'));var _=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));function checkNameSurname(_0x982062,_0x4dd99d,_0x93614a){var _0x407de3='';if(!_[_0xa6f7('0x3')](_0x4dd99d)&&_0xa6f7('0x4')===typeof _0x4dd99d){_0x407de3+=_0x4dd99d;}if(!_[_0xa6f7('0x3')](_0x93614a)&&_0xa6f7('0x4')===typeof _0x93614a){_0x407de3+='\x20'+_0x93614a;}if(_0x407de3!==''){return _0x407de3;}return _0x982062;}function Action(_0x35f8f0,_0x20cccd,_0x1fdd5f){this[_0xa6f7('0x5')]=_0x35f8f0;this[_0xa6f7('0x6')]=_0x1fdd5f||undefined;this['name']=checkNameSurname(_0x20cccd['Contact'][_0xa6f7('0x7')],_0x20cccd[_0xa6f7('0x8')][_0xa6f7('0x9')],_0x20cccd[_0xa6f7('0x8')][_0xa6f7('0xa')]);this['number']=_0x20cccd['Contact'][_0xa6f7('0x7')];this[_0xa6f7('0xb')]=_0x35f8f0['name'];this[_0xa6f7('0xc')]=_0x20cccd['active']||![];this[_0xa6f7('0xd')]=_0x35f8f0[_0xa6f7('0xd')];this[_0xa6f7('0xe')]=_0x35f8f0[_0xa6f7('0xe')]||0x3;this['scheduledat']=_0x20cccd[_0xa6f7('0xf')];this['countbusyretry']=_0x20cccd[_0xa6f7('0x10')];this[_0xa6f7('0x11')]=_0x20cccd[_0xa6f7('0x11')];this['countnoanswerretry']=_0x20cccd[_0xa6f7('0x12')];this['countnosuchnumberretry']=_0x20cccd[_0xa6f7('0x13')];this['countdropretry']=_0x20cccd[_0xa6f7('0x14')];this[_0xa6f7('0x15')]=_0x20cccd[_0xa6f7('0x15')];this['countmachineretry']=_0x20cccd[_0xa6f7('0x16')];this[_0xa6f7('0x17')]=_0x20cccd[_0xa6f7('0x17')];this[_0xa6f7('0x18')]=_0x20cccd['ContactId'];this['ListId']=_0x20cccd[_0xa6f7('0x19')];this['UserId']=_0x20cccd[_0xa6f7('0x1a')];this[_0xa6f7('0x1b')]=_0x20cccd['VoiceQueueId'];this[_0xa6f7('0x1c')]=_0x20cccd[_0xa6f7('0x1c')];this[_0xa6f7('0x1d')]=_0x20cccd['id'];this[_0xa6f7('0x1e')]=_0x20cccd[_0xa6f7('0x8')][_0xa6f7('0x9')]||'';this['starttime']=moment()[_0xa6f7('0x1f')](_0xa6f7('0x20'));this['callback']=_0x20cccd['callback'];this['callbackuniqueid']=_0x20cccd[_0xa6f7('0x21')];this[_0xa6f7('0x22')]=_0x20cccd['callbackat'];this['recallme']=_0x20cccd['recallme'];this[_0xa6f7('0x23')]='';this[_0xa6f7('0x24')]='';}Action[_0xa6f7('0x25')]['getCaller']=function(){return util['format'](_0xa6f7('0x26'),this['name'],this['voiceQueue'][_0xa6f7('0x27')]>0x0?this['number'][_0xa6f7('0x28')](this[_0xa6f7('0x5')][_0xa6f7('0x27')]):this[_0xa6f7('0x29')]);};Action[_0xa6f7('0x25')]['getQueue']=function(){return this['queue'];};module[_0xa6f7('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index cae01e4..12a03ac 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe859=['diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','ringtime','holdtime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe859,0xa5));var _0x9e85=function(_0x36b1c1,_0x3569bb){_0x36b1c1=_0x36b1c1-0x0;var _0x4cb976=_0xe859[_0x36b1c1];return _0x4cb976;};'use strict';var util=require(_0x9e85('0x0'));var _=require(_0x9e85('0x1'));var moment=require('moment');function getSeconds(_0x39438b,_0x409100){var _0x2f0051=moment(_0x39438b)[_0x9e85('0x2')](0x0);var _0x2bbf52=moment(_0x409100)[_0x9e85('0x2')](0x0);return _0x2f0051[_0x9e85('0x3')](_0x2bbf52,_0x9e85('0x4'));}function AgentComplete(_0x1fef05,_0x15184e){this[_0x9e85('0x5')]=0x4;this['statedesc']=_0x9e85('0x6');this[_0x9e85('0x7')]=_0x1fef05[_0x9e85('0x7')];this['type']=_0x1fef05[_0x9e85('0x8')];this[_0x9e85('0x9')]=_0x1fef05[_0x9e85('0x8')]===_0x9e85('0xa')?_0x9e85('0xb'):_0x1fef05[_0x9e85('0x8')];this[_0x9e85('0xc')]=_0x1fef05[_0x9e85('0xc')];this['countcongestionretry']=_0x1fef05['countcongestionretry'];this[_0x9e85('0xd')]=_0x1fef05[_0x9e85('0xd')];this['countglobal']=_0x1fef05[_0x9e85('0xc')]+_0x1fef05[_0x9e85('0xe')]+_0x1fef05['countnoanswerretry']+_0x1fef05['countnosuchnumberretry']+_0x1fef05[_0x9e85('0xf')]+_0x1fef05[_0x9e85('0x10')]+_0x1fef05[_0x9e85('0x11')]+_0x1fef05[_0x9e85('0x12')];this[_0x9e85('0x13')]=_0x1fef05[_0x9e85('0x13')];this[_0x9e85('0xf')]=_0x1fef05[_0x9e85('0xf')];this[_0x9e85('0x10')]=_0x1fef05['countabandonedretry'];this[_0x9e85('0x11')]=_0x1fef05[_0x9e85('0x11')];this['countagentrejectretry']=_0x1fef05[_0x9e85('0x12')];this[_0x9e85('0x14')]=_0x15184e['uniqueid'];this['calleridname']=_0x1fef05[_0x9e85('0x15')];this['calleridnum']=_0x1fef05[_0x9e85('0x16')];this[_0x9e85('0x17')]=_0x1fef05['starttime'];this[_0x9e85('0x18')]=_0x1fef05[_0x9e85('0x18')];this[_0x9e85('0x19')]=_0x1fef05['answertime'];this[_0x9e85('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x9e85('0x1b')]=getSeconds(_0x1fef05[_0x9e85('0x18')],_0x1fef05['starttime']);this[_0x9e85('0x1c')]=getSeconds(_0x1fef05['answertime'],_0x1fef05['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x1fef05[_0x9e85('0x19')]);this['queue']=_0x15184e[_0x9e85('0xb')];this['membername']=_0x15184e[_0x9e85('0x1d')];this['reason']=_0x15184e['reason'];this[_0x9e85('0x1e')]=_0x1fef05['callback'];this[_0x9e85('0x1f')]=_0x1fef05[_0x9e85('0x1f')];this[_0x9e85('0x20')]=_0x1fef05[_0x9e85('0x20')];this[_0x9e85('0x21')]=_0x1fef05[_0x9e85('0x21')];this[_0x9e85('0x22')]=_0x1fef05[_0x9e85('0x22')];this[_0x9e85('0x23')]=_0x1fef05['ListId'];this[_0x9e85('0x24')]=_0x1fef05['UserId'];this['VoiceQueueId']=_0x1fef05[_0x9e85('0x25')];this[_0x9e85('0x26')]=_0x1fef05['CampaignId'];this[_0x9e85('0x27')]=_0x1fef05[_0x9e85('0x27')]||'';this[_0x9e85('0x28')]=_0x1fef05[_0x9e85('0x28')]||'';}module[_0x9e85('0x29')]=AgentComplete; \ No newline at end of file +var _0x7637=['milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment'];(function(_0x4098dc,_0x19da22){var _0x2bbd12=function(_0x222274){while(--_0x222274){_0x4098dc['push'](_0x4098dc['shift']());}};_0x2bbd12(++_0x19da22);}(_0x7637,0xe4));var _0x7763=function(_0x3b584b,_0x39dc34){_0x3b584b=_0x3b584b-0x0;var _0x38559d=_0x7637[_0x3b584b];return _0x38559d;};'use strict';var util=require('util');var _=require(_0x7763('0x0'));var moment=require(_0x7763('0x1'));function getSeconds(_0x6924a3,_0x23216d){var _0xcb9662=moment(_0x6924a3)[_0x7763('0x2')](0x0);var _0x20ff90=moment(_0x23216d)['milliseconds'](0x0);return _0xcb9662[_0x7763('0x3')](_0x20ff90,_0x7763('0x4'));}function AgentComplete(_0x5cdbd2,_0xac5c20){this[_0x7763('0x5')]=0x4;this[_0x7763('0x6')]=_0x7763('0x7');this[_0x7763('0x8')]=_0x5cdbd2[_0x7763('0x8')];this['type']=_0x5cdbd2[_0x7763('0x9')];this[_0x7763('0xa')]=_0x5cdbd2[_0x7763('0x9')]==='outbound'?_0x7763('0xb'):_0x5cdbd2[_0x7763('0x9')];this[_0x7763('0xc')]=_0x5cdbd2[_0x7763('0xc')];this[_0x7763('0xd')]=_0x5cdbd2[_0x7763('0xd')];this[_0x7763('0xe')]=_0x5cdbd2['countnoanswerretry'];this['countglobal']=_0x5cdbd2[_0x7763('0xc')]+_0x5cdbd2[_0x7763('0xd')]+_0x5cdbd2[_0x7763('0xe')]+_0x5cdbd2[_0x7763('0xf')]+_0x5cdbd2[_0x7763('0x10')]+_0x5cdbd2[_0x7763('0x11')]+_0x5cdbd2[_0x7763('0x12')]+_0x5cdbd2[_0x7763('0x13')];this[_0x7763('0xf')]=_0x5cdbd2[_0x7763('0xf')];this[_0x7763('0x10')]=_0x5cdbd2['countdropretry'];this[_0x7763('0x11')]=_0x5cdbd2[_0x7763('0x11')];this['countmachineretry']=_0x5cdbd2['countmachineretry'];this['countagentrejectretry']=_0x5cdbd2['countagentrejectretry'];this[_0x7763('0x14')]=_0xac5c20[_0x7763('0x14')];this[_0x7763('0x15')]=_0x5cdbd2[_0x7763('0x16')];this[_0x7763('0x17')]=_0x5cdbd2[_0x7763('0x18')];this[_0x7763('0x19')]=_0x5cdbd2[_0x7763('0x19')];this[_0x7763('0x1a')]=_0x5cdbd2[_0x7763('0x1a')];this[_0x7763('0x1b')]=_0x5cdbd2['answertime'];this[_0x7763('0x1c')]=moment()[_0x7763('0x1d')](_0x7763('0x1e'));this['ringtime']=getSeconds(_0x5cdbd2[_0x7763('0x1a')],_0x5cdbd2[_0x7763('0x19')]);this['holdtime']=getSeconds(_0x5cdbd2[_0x7763('0x1b')],_0x5cdbd2[_0x7763('0x1a')]);this[_0x7763('0x1f')]=getSeconds(this[_0x7763('0x1c')],_0x5cdbd2[_0x7763('0x1b')]);this[_0x7763('0xb')]=_0xac5c20[_0x7763('0xb')];this['membername']=_0xac5c20[_0x7763('0x20')];this[_0x7763('0x21')]=_0xac5c20[_0x7763('0x21')];this[_0x7763('0x22')]=_0x5cdbd2[_0x7763('0x22')];this['callbackuniqueid']=_0x5cdbd2[_0x7763('0x23')];this[_0x7763('0x24')]=_0x5cdbd2[_0x7763('0x24')];this[_0x7763('0x25')]=_0x5cdbd2[_0x7763('0x25')];this['ContactId']=_0x5cdbd2[_0x7763('0x26')];this[_0x7763('0x27')]=_0x5cdbd2[_0x7763('0x27')];this[_0x7763('0x28')]=_0x5cdbd2[_0x7763('0x28')];this['VoiceQueueId']=_0x5cdbd2[_0x7763('0x29')];this[_0x7763('0x2a')]=_0x5cdbd2[_0x7763('0x2a')];this[_0x7763('0x2b')]=_0x5cdbd2[_0x7763('0x2b')]||'';this[_0x7763('0x2c')]=_0x5cdbd2[_0x7763('0x2c')]||'';}module[_0x7763('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 1e2110b..7a654dc 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe524=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum'];(function(_0x1cf7eb,_0x58d473){var _0xc5e664=function(_0x352080){while(--_0x352080){_0x1cf7eb['push'](_0x1cf7eb['shift']());}};_0xc5e664(++_0x58d473);}(_0xe524,0x114));var _0x4e52=function(_0x20da23,_0x329568){_0x20da23=_0x20da23-0x0;var _0x1cc36a=_0xe524[_0x20da23];return _0x1cc36a;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x1731e0,_0x26b8fa){var _0x13962c=moment(_0x1731e0)[_0x4e52('0x0')](0x0);var _0x285455=moment(_0x26b8fa)[_0x4e52('0x0')](0x0);return _0x13962c[_0x4e52('0x1')](_0x285455,_0x4e52('0x2'));}function Final(_0x17c4c0){this[_0x4e52('0x3')]=_0x17c4c0['uniqueid'];this[_0x4e52('0x4')]=_0x17c4c0['scheduledat'];this[_0x4e52('0x5')]=_0x17c4c0[_0x4e52('0x5')];this[_0x4e52('0x6')]=_0x17c4c0[_0x4e52('0x5')]===_0x4e52('0x7')?_0x4e52('0x8'):_0x17c4c0[_0x4e52('0x5')];this[_0x4e52('0x9')]=_0x17c4c0[_0x4e52('0x9')];this[_0x4e52('0xa')]=_0x17c4c0['countcongestionretry'];this[_0x4e52('0xb')]=_0x17c4c0[_0x4e52('0xb')];this[_0x4e52('0xc')]=_0x17c4c0[_0x4e52('0x9')]+_0x17c4c0['countcongestionretry']+_0x17c4c0[_0x4e52('0xb')]+_0x17c4c0[_0x4e52('0xd')]+_0x17c4c0[_0x4e52('0xe')]+_0x17c4c0[_0x4e52('0xf')]+_0x17c4c0['countmachineretry']+_0x17c4c0[_0x4e52('0x10')];this[_0x4e52('0xd')]=_0x17c4c0[_0x4e52('0xd')];this[_0x4e52('0xe')]=_0x17c4c0[_0x4e52('0xe')];this[_0x4e52('0xf')]=_0x17c4c0[_0x4e52('0xf')];this[_0x4e52('0x11')]=_0x17c4c0[_0x4e52('0x11')];this[_0x4e52('0x10')]=_0x17c4c0[_0x4e52('0x10')];this[_0x4e52('0x8')]=_0x17c4c0[_0x4e52('0x8')];this[_0x4e52('0x12')]=_0x17c4c0[_0x4e52('0x12')];this[_0x4e52('0x13')]=_0x17c4c0['calleridnum'];this[_0x4e52('0x14')]=_0x17c4c0[_0x4e52('0x14')];this[_0x4e52('0x15')]=_0x17c4c0[_0x4e52('0x15')];this[_0x4e52('0x16')]=_0x17c4c0[_0x4e52('0x15')];this[_0x4e52('0x17')]=_0x17c4c0[_0x4e52('0x17')]||0x0;this['holdtime']=_0x17c4c0[_0x4e52('0x18')]||0x0;this[_0x4e52('0x19')]=_0x17c4c0['talktime']||0x0;this[_0x4e52('0x1a')]=_0x17c4c0[_0x4e52('0x1a')];this[_0x4e52('0x1b')]=_0x17c4c0[_0x4e52('0x1b')];this[_0x4e52('0x1c')]=_0x17c4c0[_0x4e52('0x1c')];this[_0x4e52('0x1d')]=_0x17c4c0[_0x4e52('0x1d')];this[_0x4e52('0x1e')]=_0x17c4c0[_0x4e52('0x1e')];this[_0x4e52('0x1f')]=_0x17c4c0[_0x4e52('0x1f')];this['UserId']=_0x17c4c0[_0x4e52('0x20')];this['VoiceQueueId']=_0x17c4c0[_0x4e52('0x21')];this['CampaignId']=_0x17c4c0[_0x4e52('0x22')];this[_0x4e52('0x23')]=_0x17c4c0['originatecalleridnum']||'';this[_0x4e52('0x24')]=_0x17c4c0[_0x4e52('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0xcf32=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x2f130c,_0x3b677d){var _0x4f8a65=function(_0x14ed69){while(--_0x14ed69){_0x2f130c['push'](_0x2f130c['shift']());}};_0x4f8a65(++_0x3b677d);}(_0xcf32,0x1af));var _0x2cf3=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xcf32[_0x95942];return _0x6d7f81;};'use strict';var util=require(_0x2cf3('0x0'));var _=require('lodash');var moment=require(_0x2cf3('0x1'));function getSeconds(_0x5ef524,_0x4cd6bc){var _0xe16cc1=moment(_0x5ef524)[_0x2cf3('0x2')](0x0);var _0x30274f=moment(_0x4cd6bc)[_0x2cf3('0x2')](0x0);return _0xe16cc1[_0x2cf3('0x3')](_0x30274f,'seconds');}function Final(_0x3851a6){this[_0x2cf3('0x4')]=_0x3851a6[_0x2cf3('0x4')];this['scheduledat']=_0x3851a6['scheduledat'];this[_0x2cf3('0x5')]=_0x3851a6[_0x2cf3('0x5')];this[_0x2cf3('0x6')]=_0x3851a6[_0x2cf3('0x5')]===_0x2cf3('0x7')?'queue':_0x3851a6[_0x2cf3('0x5')];this['countbusyretry']=_0x3851a6[_0x2cf3('0x8')];this[_0x2cf3('0x9')]=_0x3851a6[_0x2cf3('0x9')];this[_0x2cf3('0xa')]=_0x3851a6['countnoanswerretry'];this[_0x2cf3('0xb')]=_0x3851a6[_0x2cf3('0x8')]+_0x3851a6['countcongestionretry']+_0x3851a6['countnoanswerretry']+_0x3851a6[_0x2cf3('0xc')]+_0x3851a6[_0x2cf3('0xd')]+_0x3851a6[_0x2cf3('0xe')]+_0x3851a6['countmachineretry']+_0x3851a6[_0x2cf3('0xf')];this[_0x2cf3('0xc')]=_0x3851a6[_0x2cf3('0xc')];this[_0x2cf3('0xd')]=_0x3851a6[_0x2cf3('0xd')];this[_0x2cf3('0xe')]=_0x3851a6['countabandonedretry'];this[_0x2cf3('0x10')]=_0x3851a6[_0x2cf3('0x10')];this[_0x2cf3('0xf')]=_0x3851a6[_0x2cf3('0xf')];this[_0x2cf3('0x11')]=_0x3851a6[_0x2cf3('0x11')];this[_0x2cf3('0x12')]=_0x3851a6[_0x2cf3('0x12')];this[_0x2cf3('0x13')]=_0x3851a6[_0x2cf3('0x13')];this['starttime']=_0x3851a6[_0x2cf3('0x14')];this[_0x2cf3('0x15')]=_0x3851a6[_0x2cf3('0x15')];this[_0x2cf3('0x16')]=_0x3851a6[_0x2cf3('0x15')];this['ringtime']=_0x3851a6[_0x2cf3('0x17')]||0x0;this[_0x2cf3('0x18')]=_0x3851a6['holdtime']||0x0;this[_0x2cf3('0x19')]=_0x3851a6[_0x2cf3('0x19')]||0x0;this[_0x2cf3('0x1a')]=_0x3851a6[_0x2cf3('0x1a')];this[_0x2cf3('0x1b')]=_0x3851a6[_0x2cf3('0x1b')];this[_0x2cf3('0x1c')]=_0x3851a6[_0x2cf3('0x1c')];this[_0x2cf3('0x1d')]=_0x3851a6[_0x2cf3('0x1d')];this[_0x2cf3('0x1e')]=_0x3851a6[_0x2cf3('0x1e')];this[_0x2cf3('0x1f')]=_0x3851a6[_0x2cf3('0x1f')];this[_0x2cf3('0x20')]=_0x3851a6[_0x2cf3('0x20')];this[_0x2cf3('0x21')]=_0x3851a6[_0x2cf3('0x21')];this[_0x2cf3('0x22')]=_0x3851a6[_0x2cf3('0x22')];this[_0x2cf3('0x23')]=_0x3851a6[_0x2cf3('0x23')]||'';this[_0x2cf3('0x24')]=_0x3851a6[_0x2cf3('0x24')]||'';}module[_0x2cf3('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index da72342..1d141bb 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3c8=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','Answer'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0xe3c8,0x1c5));var _0x8e3c=function(_0x49a643,_0x213f00){_0x49a643=_0x49a643-0x0;var _0x21ceeb=_0xe3c8[_0x49a643];return _0x21ceeb;};'use strict';var util=require(_0x8e3c('0x0'));var _=require(_0x8e3c('0x1'));var moment=require(_0x8e3c('0x2'));function getSeconds(_0x4fb818,_0x13ea19){var _0x214e67=moment(_0x4fb818)[_0x8e3c('0x3')](0x0);var _0x1012c2=moment(_0x13ea19)[_0x8e3c('0x3')](0x0);return _0x214e67[_0x8e3c('0x4')](_0x1012c2,_0x8e3c('0x5'));}function Hangup(_0x24df15,_0x4e7273){this['state']=0x4;this['statedesc']=_0x8e3c('0x6');this[_0x8e3c('0x7')]=_0x24df15[_0x8e3c('0x7')];this[_0x8e3c('0x8')]=_0x24df15[_0x8e3c('0x8')];this[_0x8e3c('0x9')]=_0x24df15[_0x8e3c('0x8')]===_0x8e3c('0xa')?_0x8e3c('0xb'):_0x24df15[_0x8e3c('0x8')];this[_0x8e3c('0xc')]=_0x24df15['countbusyretry'];this[_0x8e3c('0xd')]=_0x24df15[_0x8e3c('0xd')];this[_0x8e3c('0xe')]=_0x24df15[_0x8e3c('0xe')];this[_0x8e3c('0xf')]=_0x24df15[_0x8e3c('0xc')]+_0x24df15[_0x8e3c('0xd')]+_0x24df15['countnoanswerretry']+_0x24df15[_0x8e3c('0x10')]+_0x24df15[_0x8e3c('0x11')]+_0x24df15[_0x8e3c('0x12')]+_0x24df15[_0x8e3c('0x13')]+_0x24df15[_0x8e3c('0x14')];this[_0x8e3c('0x10')]=_0x24df15['countnosuchnumberretry'];this[_0x8e3c('0x11')]=_0x24df15[_0x8e3c('0x11')];this['countabandonedretry']=_0x24df15[_0x8e3c('0x12')];this['countmachineretry']=_0x24df15[_0x8e3c('0x13')];this[_0x8e3c('0x14')]=_0x24df15[_0x8e3c('0x14')];this[_0x8e3c('0x15')]=_0x4e7273[_0x8e3c('0x15')];this[_0x8e3c('0x16')]=_0x24df15[_0x8e3c('0x17')];this[_0x8e3c('0x18')]=_0x24df15[_0x8e3c('0x19')];this[_0x8e3c('0x1a')]=_0x24df15[_0x8e3c('0x1a')];this[_0x8e3c('0x1b')]=_0x24df15[_0x8e3c('0x1b')];this[_0x8e3c('0x1c')]=moment()['format'](_0x8e3c('0x1d'));this[_0x8e3c('0x1e')]=getSeconds(_0x24df15[_0x8e3c('0x1b')],_0x24df15['starttime']);this[_0x8e3c('0x1f')]=0x0;this[_0x8e3c('0x20')]=getSeconds(this[_0x8e3c('0x1c')],_0x24df15[_0x8e3c('0x1b')]);this[_0x8e3c('0xb')]=_0x24df15['queue'];this[_0x8e3c('0x21')]=_0x8e3c('0x22');this[_0x8e3c('0x23')]=_0x4e7273['cause-txt'];this[_0x8e3c('0x24')]=_0x24df15[_0x8e3c('0x24')];this[_0x8e3c('0x25')]=_0x24df15[_0x8e3c('0x25')];this[_0x8e3c('0x26')]=_0x24df15[_0x8e3c('0x26')];this['recallme']=_0x24df15[_0x8e3c('0x27')];this[_0x8e3c('0x28')]=_0x24df15[_0x8e3c('0x28')];this['ListId']=_0x24df15[_0x8e3c('0x29')];this[_0x8e3c('0x2a')]=_0x24df15['UserId'];this[_0x8e3c('0x2b')]=_0x24df15[_0x8e3c('0x2b')];this[_0x8e3c('0x2c')]=_0x24df15[_0x8e3c('0x2c')];}module[_0x8e3c('0x2d')]=Hangup; \ No newline at end of file +var _0x4c2d=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','endtime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat'];(function(_0x4ddba1,_0x203eb5){var _0x3ae961=function(_0x3d052e){while(--_0x3d052e){_0x4ddba1['push'](_0x4ddba1['shift']());}};_0x3ae961(++_0x203eb5);}(_0x4c2d,0xec));var _0xd4c2=function(_0x38dcec,_0x4d3d1f){_0x38dcec=_0x38dcec-0x0;var _0x57b05c=_0x4c2d[_0x38dcec];return _0x57b05c;};'use strict';var util=require(_0xd4c2('0x0'));var _=require(_0xd4c2('0x1'));var moment=require(_0xd4c2('0x2'));function getSeconds(_0x13717a,_0x37721d){var _0xba9c15=moment(_0x13717a)[_0xd4c2('0x3')](0x0);var _0x1345be=moment(_0x37721d)[_0xd4c2('0x3')](0x0);return _0xba9c15[_0xd4c2('0x4')](_0x1345be,_0xd4c2('0x5'));}function Hangup(_0x54516f,_0x59c099){this[_0xd4c2('0x6')]=0x4;this[_0xd4c2('0x7')]='Answer';this[_0xd4c2('0x8')]=_0x54516f['scheduledat'];this[_0xd4c2('0x9')]=_0x54516f[_0xd4c2('0x9')];this[_0xd4c2('0xa')]=_0x54516f[_0xd4c2('0x9')]===_0xd4c2('0xb')?'queue':_0x54516f[_0xd4c2('0x9')];this[_0xd4c2('0xc')]=_0x54516f[_0xd4c2('0xc')];this['countcongestionretry']=_0x54516f[_0xd4c2('0xd')];this[_0xd4c2('0xe')]=_0x54516f['countnoanswerretry'];this[_0xd4c2('0xf')]=_0x54516f[_0xd4c2('0xc')]+_0x54516f['countcongestionretry']+_0x54516f[_0xd4c2('0xe')]+_0x54516f[_0xd4c2('0x10')]+_0x54516f[_0xd4c2('0x11')]+_0x54516f[_0xd4c2('0x12')]+_0x54516f['countmachineretry']+_0x54516f['countagentrejectretry'];this[_0xd4c2('0x10')]=_0x54516f['countnosuchnumberretry'];this[_0xd4c2('0x11')]=_0x54516f[_0xd4c2('0x11')];this['countabandonedretry']=_0x54516f['countabandonedretry'];this[_0xd4c2('0x13')]=_0x54516f[_0xd4c2('0x13')];this[_0xd4c2('0x14')]=_0x54516f['countagentrejectretry'];this[_0xd4c2('0x15')]=_0x59c099[_0xd4c2('0x15')];this[_0xd4c2('0x16')]=_0x54516f[_0xd4c2('0x17')];this[_0xd4c2('0x18')]=_0x54516f[_0xd4c2('0x19')];this[_0xd4c2('0x1a')]=_0x54516f[_0xd4c2('0x1a')];this['responsetime']=_0x54516f['responsetime'];this['endtime']=moment()[_0xd4c2('0x1b')](_0xd4c2('0x1c'));this[_0xd4c2('0x1d')]=getSeconds(_0x54516f[_0xd4c2('0x1e')],_0x54516f[_0xd4c2('0x1a')]);this[_0xd4c2('0x1f')]=0x0;this['talktime']=getSeconds(this[_0xd4c2('0x20')],_0x54516f[_0xd4c2('0x1e')]);this['queue']=_0x54516f[_0xd4c2('0x21')];this[_0xd4c2('0x22')]=_0xd4c2('0x23');this[_0xd4c2('0x24')]=_0x59c099['cause-txt'];this[_0xd4c2('0x25')]=_0x54516f[_0xd4c2('0x25')];this[_0xd4c2('0x26')]=_0x54516f[_0xd4c2('0x26')];this[_0xd4c2('0x27')]=_0x54516f[_0xd4c2('0x27')];this[_0xd4c2('0x28')]=_0x54516f['recallme'];this[_0xd4c2('0x29')]=_0x54516f[_0xd4c2('0x29')];this[_0xd4c2('0x2a')]=_0x54516f[_0xd4c2('0x2a')];this[_0xd4c2('0x2b')]=_0x54516f[_0xd4c2('0x2b')];this[_0xd4c2('0x2c')]=_0x54516f[_0xd4c2('0x2c')];this[_0xd4c2('0x2d')]=_0x54516f['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 99fb877..63919b5 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc8c=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x40b4e4,_0x20bb04){var _0x565d6b=function(_0x44edf5){while(--_0x44edf5){_0x40b4e4['push'](_0x40b4e4['shift']());}};_0x565d6b(++_0x20bb04);}(_0xdc8c,0xd9));var _0xcdc8=function(_0x515208,_0x5a12fd){_0x515208=_0x515208-0x0;var _0x4c3f8c=_0xdc8c[_0x515208];return _0x4c3f8c;};'use strict';var util=require(_0xcdc8('0x0'));var _=require(_0xcdc8('0x1'));var moment=require('moment');function getSeconds(_0x5c1a2a,_0x2480d5){var _0x55ebc3=moment(_0x5c1a2a)[_0xcdc8('0x2')](0x0);var _0x52eb76=moment(_0x2480d5)[_0xcdc8('0x2')](0x0);return _0x55ebc3[_0xcdc8('0x3')](_0x52eb76,_0xcdc8('0x4'));}function History(_0x5a3b55){this[_0xcdc8('0x5')]=_0x5a3b55[_0xcdc8('0x5')];this[_0xcdc8('0x6')]=_0x5a3b55[_0xcdc8('0x6')]||undefined;this[_0xcdc8('0x7')]=_0x5a3b55[_0xcdc8('0x7')];this[_0xcdc8('0x8')]=_0x5a3b55[_0xcdc8('0x7')]===_0xcdc8('0x9')?_0xcdc8('0xa'):_0x5a3b55[_0xcdc8('0x7')];this['countbusyretry']=_0x5a3b55[_0xcdc8('0xb')];this[_0xcdc8('0xc')]=_0x5a3b55['countcongestionretry'];this[_0xcdc8('0xd')]=_0x5a3b55[_0xcdc8('0xd')];this[_0xcdc8('0xe')]=_0x5a3b55[_0xcdc8('0xb')]+_0x5a3b55[_0xcdc8('0xc')]+_0x5a3b55[_0xcdc8('0xd')]+_0x5a3b55[_0xcdc8('0xf')]+_0x5a3b55[_0xcdc8('0x10')]+_0x5a3b55[_0xcdc8('0x11')]+_0x5a3b55[_0xcdc8('0x12')]+_0x5a3b55[_0xcdc8('0x13')];this[_0xcdc8('0xf')]=_0x5a3b55[_0xcdc8('0xf')];this[_0xcdc8('0x10')]=_0x5a3b55['countdropretry'];this[_0xcdc8('0x11')]=_0x5a3b55[_0xcdc8('0x11')];this[_0xcdc8('0x12')]=_0x5a3b55[_0xcdc8('0x12')];this[_0xcdc8('0x13')]=_0x5a3b55[_0xcdc8('0x13')];this[_0xcdc8('0xa')]=_0x5a3b55[_0xcdc8('0xa')];this[_0xcdc8('0x14')]=_0x5a3b55[_0xcdc8('0x15')];this['calleridnum']=_0x5a3b55[_0xcdc8('0x16')];this[_0xcdc8('0x17')]=_0x5a3b55[_0xcdc8('0x17')];this[_0xcdc8('0x18')]=_0x5a3b55[_0xcdc8('0x18')];this[_0xcdc8('0x19')]=_0x5a3b55[_0xcdc8('0x18')];this[_0xcdc8('0x1a')]=getSeconds(_0x5a3b55[_0xcdc8('0x18')],_0x5a3b55[_0xcdc8('0x17')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xcdc8('0x1b')]=_0x5a3b55[_0xcdc8('0x1b')];this[_0xcdc8('0x1c')]=_0x5a3b55['callbackuniqueid'];this[_0xcdc8('0x1d')]=_0x5a3b55['callbackat'];this['recallme']=_0x5a3b55[_0xcdc8('0x1e')];this['ContactId']=_0x5a3b55[_0xcdc8('0x1f')];this['ListId']=_0x5a3b55[_0xcdc8('0x20')];this['UserId']=_0x5a3b55['UserId'];this[_0xcdc8('0x21')]=_0x5a3b55[_0xcdc8('0x21')];this[_0xcdc8('0x22')]=_0x5a3b55[_0xcdc8('0x22')];this[_0xcdc8('0x23')]=_0x5a3b55['originatecalleridnum']||'';this[_0xcdc8('0x24')]=_0x5a3b55[_0xcdc8('0x24')]||'';}module[_0xcdc8('0x25')]=History; \ No newline at end of file +var _0x48a9=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','name','calleridnum','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','exports','lodash','moment'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x48a9,0x8a));var _0x948a=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x48a9[_0x2bf466];return _0x856885;};'use strict';var util=require('util');var _=require(_0x948a('0x0'));var moment=require(_0x948a('0x1'));function getSeconds(_0x4558fd,_0x2a4f7e){var _0x4e8954=moment(_0x4558fd)['milliseconds'](0x0);var _0x44a83d=moment(_0x2a4f7e)[_0x948a('0x2')](0x0);return _0x4e8954[_0x948a('0x3')](_0x44a83d,_0x948a('0x4'));}function History(_0x925b92){this[_0x948a('0x5')]=_0x925b92['uniqueid'];this[_0x948a('0x6')]=_0x925b92[_0x948a('0x6')]||undefined;this['type']=_0x925b92[_0x948a('0x7')];this[_0x948a('0x8')]=_0x925b92[_0x948a('0x7')]===_0x948a('0x9')?'queue':_0x925b92['type'];this[_0x948a('0xa')]=_0x925b92[_0x948a('0xa')];this[_0x948a('0xb')]=_0x925b92['countcongestionretry'];this['countnoanswerretry']=_0x925b92[_0x948a('0xc')];this[_0x948a('0xd')]=_0x925b92[_0x948a('0xa')]+_0x925b92[_0x948a('0xb')]+_0x925b92[_0x948a('0xc')]+_0x925b92['countnosuchnumberretry']+_0x925b92[_0x948a('0xe')]+_0x925b92[_0x948a('0xf')]+_0x925b92[_0x948a('0x10')]+_0x925b92[_0x948a('0x11')];this[_0x948a('0x12')]=_0x925b92['countnosuchnumberretry'];this[_0x948a('0xe')]=_0x925b92[_0x948a('0xe')];this[_0x948a('0xf')]=_0x925b92[_0x948a('0xf')];this[_0x948a('0x10')]=_0x925b92[_0x948a('0x10')];this[_0x948a('0x11')]=_0x925b92['countagentrejectretry'];this[_0x948a('0x13')]=_0x925b92[_0x948a('0x13')];this[_0x948a('0x14')]=_0x925b92[_0x948a('0x15')];this[_0x948a('0x16')]=_0x925b92['number'];this['starttime']=_0x925b92['starttime'];this[_0x948a('0x17')]=_0x925b92[_0x948a('0x17')];this['endtime']=_0x925b92[_0x948a('0x17')];this['ringtime']=getSeconds(_0x925b92[_0x948a('0x17')],_0x925b92['starttime']);this['holdtime']=0x0;this[_0x948a('0x18')]=0x0;this[_0x948a('0x19')]=_0x925b92['callback'];this['callbackuniqueid']=_0x925b92[_0x948a('0x1a')];this[_0x948a('0x1b')]=_0x925b92['callbackat'];this[_0x948a('0x1c')]=_0x925b92['recallme'];this[_0x948a('0x1d')]=_0x925b92['ContactId'];this[_0x948a('0x1e')]=_0x925b92[_0x948a('0x1e')];this['UserId']=_0x925b92[_0x948a('0x1f')];this[_0x948a('0x20')]=_0x925b92[_0x948a('0x20')];this['CampaignId']=_0x925b92['CampaignId'];this['originatecalleridnum']=_0x925b92['originatecalleridnum']||'';this[_0x948a('0x21')]=_0x925b92[_0x948a('0x21')]||'';}module[_0x948a('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c212d51..f028684 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 _0x1145=['dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','startProgressive','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','inBlackList','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','checkContactBlack','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','lodash','bluebird','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','outbound','answered','available','sumBillable','sumDuration','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','merge','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','active','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','membername','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','AMD','countnoanswerretry','dialMachineMaxRetry','minutes','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','TIMEOUT','dialDropMaxRetry','ListId','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','status','stateinterface','strategy','rrmemory','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','Queue','launchHandleIvr','handleIvr','loggedIn'];(function(_0x245d4a,_0x4db7d4){var _0x58bd1e=function(_0x5b9866){while(--_0x5b9866){_0x245d4a['push'](_0x245d4a['shift']());}};_0x58bd1e(++_0x4db7d4);}(_0x1145,0xc7));var _0x5114=function(_0x1b0896,_0x3efacf){_0x1b0896=_0x1b0896-0x0;var _0x295e3f=_0x1145[_0x1b0896];return _0x295e3f;};'use strict';var util=require(_0x5114('0x0'));var _=require(_0x5114('0x1'));var BPromise=require(_0x5114('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x5114('0x3'));var config=require(_0x5114('0x4'));var logger=require(_0x5114('0x5'))(_0x5114('0x6'));var loggerBooked=require(_0x5114('0x5'))(_0x5114('0x7'));var loggerPredictive=require(_0x5114('0x5'))(_0x5114('0x8'));var loggerPredictiveCalls=require(_0x5114('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x5114('0x9'));var ami=require('../ami');config[_0x5114('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5114('0xa')]));var cmHopper=require(_0x5114('0xb'));var cmHopperHistory=require(_0x5114('0xc'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x5114('0xd'));var Action=require(_0x5114('0xe'));var History=require(_0x5114('0xf'));var Final=require(_0x5114('0x10'));var AgentComplete=require(_0x5114('0x11'));var QueueCallerAbandon=require(_0x5114('0x12'));var Hangup=require(_0x5114('0x13'));var ipAgi=process[_0x5114('0x14')]['XCALLY_IP_AGI']||_0x5114('0x15');var strategy={'rrmemory':'rrmemory','roundrobin':_0x5114('0x16')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xf09644){this[_0x5114('0x17')]=this[_0x5114('0x17')]?this['tail'][_0x5114('0x18')](_0xf09644):_0xf09644();};function Dialer(_0x173485,_0x57b216){this[_0x5114('0x19')]=new Sequence();this[_0x5114('0x1a')]=_0x57b216;this[_0x5114('0x1b')]=_0x173485[_0x5114('0x1b')];this[_0x5114('0x1c')]=_0x173485[_0x5114('0x1c')];this[_0x5114('0x1d')]=_0x173485[_0x5114('0x1d')];this[_0x5114('0x1e')]=_0x173485['trunks'];this[_0x5114('0x1f')]=config['maxNumberOriginate']||0x2;this[_0x5114('0x20')]={};this[_0x5114('0x21')]={};this[_0x5114('0x22')]={};this[_0x5114('0x23')]={};this[_0x5114('0x24')]={};this[_0x5114('0x25')]={};this['startProgressive']={};this[_0x5114('0x26')]={};this[_0x5114('0x27')]={};this[_0x5114('0x28')]={};ami['on'](_0x5114('0x29'),this[_0x5114('0x2a')][_0x5114('0x2b')](this));ami['on'](_0x5114('0x2c'),this[_0x5114('0x2d')][_0x5114('0x2b')](this));ami['on'](_0x5114('0x2e'),this[_0x5114('0x2f')]['bind'](this));ami['on'](_0x5114('0x30'),this[_0x5114('0x31')]['bind'](this));ami['on']('custom:queuesummary',this[_0x5114('0x9')]['bind'](this));ami['on'](_0x5114('0x32'),this[_0x5114('0x33')][_0x5114('0x2b')](this));ami['on'](_0x5114('0x34'),this[_0x5114('0x35')][_0x5114('0x2b')](this));ami['on']('varset',this[_0x5114('0x36')][_0x5114('0x2b')](this));ami['on'](_0x5114('0x37'),this[_0x5114('0x38')][_0x5114('0x2b')](this));ami['on'](_0x5114('0x39'),this[_0x5114('0x3a')][_0x5114('0x2b')](this));this[_0x5114('0x3b')]();this['loopClearZombieChannels']();}function isNotNull(_0x5651aa){return _0x5651aa!==null&&!_[_0x5114('0x3c')](_0x5651aa);}function checkIsLoggedIn(_0x179593,_0x29ffb4){return function(){if(_0x29ffb4<=0x0){_0x179593[_0x5114('0x3d')]=_0x5114('0x3e');throw _0x179593[_0x5114('0x3f')]+_0x5114('0x40');}};}function isActive(_0x67e27a){return _0x67e27a;}function checkIsActive(_0x411684,_0x4f0c3f){return function(){if(!isActive(_0x4f0c3f)){_0x411684[_0x5114('0x3d')]=_0x5114('0x41');throw _0x411684[_0x5114('0x3f')]+_0x5114('0x42');}};}function checkInterval(_0x5f1795){return function(){if(!isNotNull(_0x5f1795[_0x5114('0x43')])){_0x5f1795[_0x5114('0x3d')]='INTERVAL_IS_NULL';throw _0x5f1795[_0x5114('0x3f')]+_0x5114('0x44');}if(!isNotNull(_0x5f1795[_0x5114('0x43')][_0x5114('0x45')])){_0x5f1795[_0x5114('0x3d')]=_0x5114('0x46');throw _0x5f1795['name']+_0x5114('0x44');}if(!isNotNull(_[_0x5114('0x47')](_0x5f1795[_0x5114('0x43')][_0x5114('0x45')]))){_0x5f1795[_0x5114('0x3d')]=_0x5114('0x46');throw _0x5f1795[_0x5114('0x3f')]+_0x5114('0x44');}};}function msgResponse(_0x5c5eb2,_0x4fbc98,_0x23d0ea){return{'action':_0x5c5eb2,'response':_0x4fbc98,'message':_0x23d0ea,'stack':_0x23d0ea};}function myreject(_0x1b18da){return function(_0x2d7ac0){return _0x1b18da(msgResponse(_0x5114('0x48'),_0x5114('0x49'),JSON[_0x5114('0x4a')](_0x2d7ac0)));};}function getSeconds(_0x1aa9eb,_0x440a5b){var _0x3b5234=moment(_0x1aa9eb)[_0x5114('0x4b')](0x0);var _0x3f255e=moment(_0x440a5b)[_0x5114('0x4b')](0x0);return _0x3b5234[_0x5114('0x4c')](_0x3f255e,'seconds');}function emit(_0x4d753a,_0x4835b4,_0x482ed1){io['to'](_0x4d753a)['emit'](_0x4835b4,_0x482ed1);}function emitVoiceQueueSummary(_0x390cf5){if(_0x390cf5['type']===_0x5114('0x4d')){var _0x5b81f3={'id':_0x390cf5['id'],'name':_0x390cf5[_0x5114('0x3f')],'strategy':_0x390cf5['strategy'],'answered':_0x390cf5[_0x5114('0x4e')],'available':_0x390cf5[_0x5114('0x4f')],'loggedIn':_0x390cf5['loggedIn'],'pTalking':_0x390cf5['pTalking'],'sumBillable':_0x390cf5[_0x5114('0x50')],'sumDuration':_0x390cf5[_0x5114('0x51')],'sumHoldTime':_0x390cf5['sumHoldTime']||0x0,'talking':_0x390cf5['talking'],'total':_0x390cf5[_0x5114('0x52')],'type':_0x390cf5[_0x5114('0x53')],'unmanaged':_0x390cf5[_0x5114('0x54')],'abandoned':_0x390cf5[_0x5114('0x55')],'waiting':_0x390cf5[_0x5114('0x56')],'loggedInDb':_0x390cf5[_0x5114('0x57')],'dialActive':_0x390cf5[_0x5114('0x58')],'dialMethod':_0x390cf5[_0x5114('0x59')],'dialOriginateCallerIdName':_0x390cf5[_0x5114('0x5a')],'dialOriginateCallerIdNumber':_0x390cf5['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x390cf5['dialOriginateTimeout'],'dialPrefix':_0x390cf5['dialPrefix'],'outboundAnswerAgiCallsDay':_0x390cf5[_0x5114('0x5b')],'outboundAnswerCallsDay':_0x390cf5[_0x5114('0x5c')],'outboundBlacklistCallsDay':_0x390cf5[_0x5114('0x5d')],'outboundBusyCallsDay':_0x390cf5[_0x5114('0x5e')],'outboundCongestionCallsDay':_0x390cf5[_0x5114('0x5f')],'outboundDropCallsDayACS':_0x390cf5[_0x5114('0x60')],'outboundDropCallsDayCallersExit':_0x390cf5[_0x5114('0x61')],'outboundDropCallsDayTimeout':_0x390cf5[_0x5114('0x62')],'outboundNoAnswerCallsDay':_0x390cf5[_0x5114('0x63')],'outboundNoSuchCallsDay':_0x390cf5[_0x5114('0x64')],'outboundOriginateFailureCallsDay':_0x390cf5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x390cf5[_0x5114('0x65')],'outboundRejectCallsDay':_0x390cf5[_0x5114('0x66')],'outboundUnknownCallsDay':_0x390cf5[_0x5114('0x67')],'predictiveIntervalAnsweredCalls':_0x390cf5[_0x5114('0x68')],'predictiveIntervalAvgHoldtime':_0x390cf5[_0x5114('0x69')],'predictiveIntervalAvgTalktime':_0x390cf5['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x390cf5[_0x5114('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x390cf5[_0x5114('0x6b')],'predictiveIntervalErlangCalls':_0x390cf5[_0x5114('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x390cf5['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x390cf5[_0x5114('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x390cf5[_0x5114('0x6e')],'predictiveIntervalPauses':_0x390cf5[_0x5114('0x6f')],'predictiveIntervalAvailable':_0x390cf5['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x390cf5['predictiveIntervalTotalCalls'],'message':_0x390cf5[_0x5114('0x3d')],'originated':_0x390cf5[_0x5114('0x70')],'erlangCalls':_0x390cf5[_0x5114('0x71')],'erlangCallToSecond':_0x390cf5[_0x5114('0x72')],'erlangAbandonmentRate':_0x390cf5[_0x5114('0x73')],'erlangBusyFactor':_0x390cf5['erlangBusyFactor'],'startPredictive':_0x390cf5[_0x5114('0x25')],'startProgressive':_0x390cf5['startProgressive']};if(_0x390cf5[_0x5114('0x74')]){_0x5b81f3['Trunk']={'id':_0x390cf5[_0x5114('0x74')]['id'],'name':_0x390cf5['Trunk'][_0x5114('0x3f')],'active':_0x390cf5[_0x5114('0x74')]['active'],'callerid':_0x390cf5[_0x5114('0x74')][_0x5114('0x75')]};}if(_0x390cf5['Interval']){_0x5b81f3[_0x5114('0x43')]={'id':_0x390cf5['Interval']['id'],'name':_0x390cf5[_0x5114('0x43')][_0x5114('0x3f')]};}var _0x13822e=md5(JSON['stringify'](_0x5b81f3));if(_0x390cf5[_0x5114('0x76')]!==_0x13822e){_0x390cf5[_0x5114('0x76')]=_0x13822e;emit(util[_0x5114('0x77')](_0x5114('0x78'),_0x5b81f3[_0x5114('0x3f')]),_0x5114('0x79'),_0x5b81f3);}}}function emitCampaignSummary(_0x5c9fad){if(_0x5c9fad['type']===_0x5114('0x7a')){emit(util['format'](_0x5114('0x7b'),_0x5c9fad[_0x5114('0x3f')]),_0x5114('0x7c'),_0x5c9fad);}}function checkGetDataPredictive(_0x1870d9){if(isNotNull(_0x1870d9)&&!_[_0x5114('0x47')](_0x1870d9)){loggerPredictive[_0x5114('0x7d')](_0x5114('0x7e'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1870d9['predictiveIntervalTotalCalls']);loggerPredictive[_0x5114('0x7d')](_0x5114('0x7f'),_0x1870d9['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1870d9['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x5114('0x7d')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1870d9[_0x5114('0x6a')]);loggerPredictive['info'](_0x5114('0x80'),_0x1870d9['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x5114('0x7d')](_0x5114('0x81'),_0x1870d9[_0x5114('0x82')]);loggerPredictive['info'](_0x5114('0x83'));if(_0x1870d9[_0x5114('0x84')]>0x0){if(!_[_0x5114('0x3c')](_0x1870d9[_0x5114('0x82')])&&_0x1870d9[_0x5114('0x82')]>0x0){return!![];}loggerPredictive[_0x5114('0x7d')](_0x5114('0x85'));if(!_[_0x5114('0x3c')](_0x1870d9['predictiveIntervalAvgHoldtime'])&&_0x1870d9[_0x5114('0x69')]>0x0){return!![];}loggerPredictive['info'](_0x5114('0x86'));}else{loggerPredictive[_0x5114('0x7d')](_0x5114('0x87'));}}else{loggerPredictive['info'](_0x5114('0x88'));}return![];}function mergeDataErlangB(_0x46a41e){return function(_0x5ccaa4){loggerPredictive['info'](_0x5114('0x89'));loggerPredictive[_0x5114('0x7d')](_0x5114('0x8a'),_0x5ccaa4[_0x5114('0x71')]);loggerPredictive[_0x5114('0x7d')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ccaa4[_0x5114('0x72')]);loggerPredictive['info'](_0x5114('0x8b'),_0x5ccaa4[_0x5114('0x73')]);loggerPredictive[_0x5114('0x7d')](_0x5114('0x8c'),_0x5ccaa4[_0x5114('0x8d')]);loggerPredictive['info'](_0x5114('0x8b'),_0x5ccaa4[_0x5114('0x73')]);loggerPredictive[_0x5114('0x7d')](_0x5114('0x83'));_['merge'](_0x46a41e,_0x5ccaa4);};}function getDiff(_0x528b33){var _0x561d09=moment()['milliseconds'](0x0);var _0x174d14=moment(_0x528b33)[_0x5114('0x4b')](0x0);return _0x561d09['diff'](_0x174d14,'seconds');}function ifInterval(_0x6548bf,_0x208dfd){if(_[_0x5114('0x3c')](_0x208dfd)){return![];}return getDiff(_0x208dfd)<_0x6548bf*0x3c;}function freeVariablesPredictive(_0x4a80dd){if(isNotNull(_0x4a80dd)){if(!_[_0x5114('0x3c')](_0x4a80dd['startProgressive'])){_0x4a80dd['startProgressive']=undefined;loggerPredictive['info'](_0x4a80dd['name'],_0x5114('0x8e'));}if(!_[_0x5114('0x3c')](_0x4a80dd[_0x5114('0x25')])){_0x4a80dd[_0x5114('0x25')]=undefined;loggerPredictive[_0x5114('0x7d')](_0x4a80dd[_0x5114('0x3f')],_0x5114('0x8f'));}if(!_[_0x5114('0x3c')](_0x4a80dd[_0x5114('0x90')])){clearInterval(_0x4a80dd[_0x5114('0x90')]);_0x4a80dd[_0x5114('0x90')]=undefined;loggerPredictive[_0x5114('0x7d')](_0x4a80dd[_0x5114('0x3f')],_0x5114('0x91'));}}}function erlangb(_0x20be95,_0x579a5c){if(_0x579a5c===0x0){return 0x0;}var _0x64dcd2=0x1;for(var _0x32b2b8=0x1;_0x32b2b8<=_0x579a5c;_0x32b2b8+=0x1){_0x64dcd2=0x1+_0x64dcd2*_0x32b2b8/_0x20be95;}return 0x1/_0x64dcd2;}function isVoiceQueueOutbound(_0x5901cc){return _0x5901cc===_0x5114('0x4d');}function isNotPreview(_0x16d2b7){return _0x16d2b7!==_0x5114('0x1a');}function isCampaignIvr(_0x20f5f3){return _0x20f5f3==='ivr';}function getCallerId(_0x91ba3,_0x546320,_0xf19daf){if(!_['isUndefined'](_0xf19daf)&&typeof _0xf19daf==='string'&&!_[_0x5114('0x47')](_0xf19daf)){if(!_[_0x5114('0x3c')](_0x546320)&&typeof _0x546320===_0x5114('0x92')&&!_[_0x5114('0x47')](_0x546320)){return util[_0x5114('0x77')](_0x5114('0x93'),_0x546320,_0xf19daf);}return util[_0x5114('0x77')](_0x5114('0x93'),_0xf19daf,_0xf19daf);}if(!_[_0x5114('0x3c')](_0x91ba3)&&typeof _0x91ba3===_0x5114('0x92')&&!_['isEmpty'](_0x91ba3)){return _0x91ba3;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x5a7edc,_0xbf417c){return function(_0x2f809e){freeVariablesPredictive(_0xbf417c);emitVoiceQueueSummary(_0xbf417c);emitCampaignSummary(_0xbf417c);loggerSyncQueueSummary[_0x5114('0x94')](_0x5a7edc,util[_0x5114('0x95')](_0x2f809e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3092ab,_0x41c8f1){return function(_0x3e6c8b){loggerPredictive[_0x5114('0x94')](_0x41c8f1[_0x5114('0x3f')],_0x3092ab);loggerPredictive[_0x5114('0x94')](_0x3e6c8b['stack']);freeVariablesPredictive(_0x41c8f1);};}function loggerCatch(_0x5567cd){return function(_0x8b430c){logger[_0x5114('0x94')](_0x5567cd,util['inspect'](_0x8b430c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x426188){return _0x426188&&!_['isUndefined'](_0x426188)&&_0x426188['length']>0x0;}function decremetOriginate(_0x2c67a7){if(!_[_0x5114('0x3c')](_0x2c67a7)&&_0x2c67a7!==null){if(typeof _0x2c67a7[_0x5114('0x70')]!=='undefined'){if(_0x2c67a7[_0x5114('0x70')]>0x0){_0x2c67a7['originated']-=0x1;}else{logger[_0x5114('0x94')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x5114('0x96'));}}function checkContactLowerLimitOriginate(_0xa11d10,_0x404db9,_0x5d8d6c){if(_0x404db9>_0x5d8d6c){for(var _0x56af4e=0x0;_0x56af4e<_0x404db9-_0x5d8d6c;_0x56af4e+=0x1){decremetOriginate(_0xa11d10);}}}function loggerGetContactDialer(_0x6be527,_0x2dac11,_0x4ef1b1){return function(_0xea4868){checkContactLowerLimitOriginate(_0x2dac11,_0x4ef1b1,0x0);logger['error'](_0x6be527,util[_0x5114('0x95')](_0xea4868,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x49721b){return function(_0x145aee){if(isNotNull(_0x145aee)&&isNotNull(_0x145aee[0x0])){if(_0x145aee[0x0][_0x5114('0x97')]>0x0){_0x49721b['message']=_0x5114('0x98');logger['info'](_0x5114('0x99')+_0x49721b['name'],_0x145aee[0x0][_0x5114('0x97')],'contacts');}else{_0x49721b['message']=_0x5114('0x9a');logger[_0x5114('0x7d')](_0x5114('0x9b')+_0x49721b[_0x5114('0x3f')]);}}};}function notSendMessagesQueue(_0x3c7abf){if(_0x3c7abf[_0x5114('0x9c')]){freeVariablesPredictive(_0x3c7abf);if(_0x3c7abf['originated']===0x0&&_0x3c7abf[_0x5114('0x9d')]===0x0&&_0x3c7abf[_0x5114('0x56')]===0x0&&(_0x3c7abf[_0x5114('0x9e')]||0x0)===0x0){_0x3c7abf[_0x5114('0x9c')]=![];_0x3c7abf[_0x5114('0x4f')]=0x0;_0x3c7abf[_0x5114('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5114('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3c7abf['name'],'is\x20not\x20active');}else{_0x3c7abf[_0x5114('0x3d')]=_0x5114('0x9f');loggerSyncQueueSummary[_0x5114('0x94')](_0x5114('0xa0'),_0x3c7abf[_0x5114('0x3f')],_0x5114('0xa1'));}emitVoiceQueueSummary(_0x3c7abf);}}function notSendMessagesCampaign(_0x560577){if(_0x560577['sendMessageOneNotActive']){if(_0x560577['originated']===0x0){_0x560577[_0x5114('0x9c')]=![];_0x560577[_0x5114('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5114('0x94')](_0x5114('0xa2'),_0x560577['name'],'is\x20not\x20active');}else{_0x560577[_0x5114('0x3d')]=_0x5114('0x9f');loggerSyncQueueSummary['error'](_0x5114('0xa2'),_0x560577[_0x5114('0x3f')],_0x5114('0xa1'));}emitCampaignSummary(_0x560577);}}function createObjHistory(_0x4c6314,_0x100968,_0x78a3be,_0x2c1435,_0x15447e){_0x4c6314[_0x5114('0x3d')]=_0x78a3be;var _0x15b05d=new Action(_0x4c6314,_0x100968);var _0x42f2a0=new History(_0x15b05d);_0x42f2a0[_0x5114('0xa3')]=_0x2c1435;_0x42f2a0['statedesc']=_0x15447e;_0x42f2a0[_0x5114('0xa4')]=_0x15b05d[_0x5114('0xa5')];return _0x42f2a0;}Dialer[_0x5114('0xa6')][_0x5114('0xa7')]=function(){var _0x347674=this;setInterval(function(){_0x347674[_0x5114('0xa8')](_0x347674[_0x5114('0x23')],_0x5114('0xa9'));_0x347674['clearZombieChannels'](_0x347674[_0x5114('0x21')],_0x5114('0xaa'));},0x32c8);};Dialer[_0x5114('0xa6')][_0x5114('0xa8')]=function(_0x4759d3,_0x17becd){var _0x132505=this;for(var _0x1b75f9 in _0x4759d3){if(typeof _0x4759d3[_0x1b75f9]!==_0x5114('0xab')){this[_0x5114('0x19')]['enqueue'](function(){if(!_[_0x5114('0xac')](_0x4759d3[_0x1b75f9])){return ami[_0x5114('0xad')]({'action':'status','channel':_0x4759d3[_0x1b75f9][_0x5114('0xae')]})[_0x5114('0xaf')](function(_0x1d19a0){if(_0x1d19a0['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x4759d3[_0x1b75f9]&&_0x4759d3[_0x1b75f9][_0x5114('0x53')]!==_0x5114('0x7a')){_0x132505[_0x5114('0xb0')](_0x132505[_0x5114('0x1b')][_0x4759d3[_0x1b75f9][_0x5114('0xb1')]]);logger[_0x5114('0x94')](_0x5114('0xb2'),_0x17becd,_0x1b75f9,_0x4759d3[_0x1b75f9][_0x5114('0xb1')]);delete _0x4759d3[_0x1b75f9];}if(_0x4759d3[_0x1b75f9]&&_0x4759d3[_0x1b75f9][_0x5114('0x53')]===_0x5114('0x7a')){_0x132505[_0x5114('0xb0')](_0x132505[_0x5114('0x1c')][_0x4759d3[_0x1b75f9][_0x5114('0xb1')]]);logger[_0x5114('0x94')]('[Dialer][checkChannel][ivr]',_0x17becd,_0x1b75f9,_0x4759d3[_0x1b75f9][_0x5114('0xb1')]);delete _0x4759d3[_0x1b75f9];}},0x2328);}});}});}}};Dialer[_0x5114('0xa6')][_0x5114('0xb3')]=function(_0x3090ea){return BPromise[_0x5114('0xb4')]()[_0x5114('0xb5')](cmHopper[_0x5114('0xb3')](_0x3090ea))[_0x5114('0xaf')](loggerCatch(_0x5114('0xb6')));};Dialer[_0x5114('0xa6')][_0x5114('0xb7')]=function(_0x2a3069){return BPromise[_0x5114('0xb4')]()['then'](cmHopperBlack[_0x5114('0xb7')](_0x2a3069))[_0x5114('0xaf')](loggerCatch(_0x5114('0xb8')));};Dialer[_0x5114('0xa6')][_0x5114('0xb9')]=function(_0x5b9cc1){return BPromise['resolve']()[_0x5114('0xb5')](cmHopperBlack[_0x5114('0xb9')](_0x5b9cc1))['catch'](loggerCatch(_0x5114('0xba')));};Dialer[_0x5114('0xa6')][_0x5114('0xbb')]=function(_0x71f42a){return BPromise[_0x5114('0xb4')]()['then'](cmHopperHistory['avgHandleTime'](_0x71f42a))[_0x5114('0xaf')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x5114('0xa6')][_0x5114('0xbc')]=function(_0x4f1aa2){return BPromise[_0x5114('0xb4')]()['then'](cmHopper[_0x5114('0xbc')](_0x4f1aa2))[_0x5114('0xaf')](loggerCatch(_0x5114('0xbd')));};Dialer[_0x5114('0xa6')][_0x5114('0xbe')]=function(_0x309dd6,_0x29cfc9,_0x2435d1){return BPromise[_0x5114('0xb4')]()[_0x5114('0xb5')](cmHopper[_0x5114('0xbe')](_0x309dd6,_0x29cfc9,_0x2435d1))[_0x5114('0xaf')](loggerCatch(_0x5114('0xbf')));};Dialer[_0x5114('0xa6')][_0x5114('0xc0')]=function(_0x170b39,_0x26494f,_0x3ca3d7,_0x5b50bb){return BPromise['resolve']()['then'](cmHopper[_0x5114('0xc0')](_0x170b39,_0x26494f,_0x3ca3d7,_0x5b50bb))['catch'](loggerCatch(_0x5114('0xc1')));};Dialer[_0x5114('0xa6')][_0x5114('0xc2')]=function(_0x46d282,_0x5bd12f,_0x84e020){return BPromise[_0x5114('0xb4')]()[_0x5114('0xb5')](cmHopper[_0x5114('0xc2')](_0x46d282,_0x5bd12f,_0x84e020))[_0x5114('0xaf')](loggerCatch(_0x5114('0xc1')));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x2b1bcb){return BPromise[_0x5114('0xb4')]()[_0x5114('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2b1bcb))['catch'](loggerCatch(_0x5114('0xc3')));};Dialer[_0x5114('0xa6')][_0x5114('0xc4')]=function(_0x3f748e){return BPromise['resolve']()[_0x5114('0xb5')](cmHopper[_0x5114('0xc4')](_0x3f748e))[_0x5114('0xaf')](loggerCatch(_0x5114('0xc5')));};Dialer[_0x5114('0xa6')]['createHistory']=function(_0x113b8f){return BPromise['resolve']()['then'](cmHopperHistory[_0x5114('0xc6')](_0x113b8f))[_0x5114('0xaf')](loggerCatch(_0x5114('0xc7')));};Dialer[_0x5114('0xa6')]['updateOriginated']=function(_0xeb5951){if(!_['isUndefined'](_0xeb5951)&&_0xeb5951!==null){if(typeof _0xeb5951[_0x5114('0x70')]!=='undefined'){if(_0xeb5951[_0x5114('0x70')]>0x0){_0xeb5951[_0x5114('0x70')]-=0x1;}else{logger[_0x5114('0x94')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5114('0x94')](_0x5114('0xc8'));}};Dialer['prototype'][_0x5114('0xc9')]=function(_0x2ba3f2,_0x1b494d){var _0x41de7a=this;return function(_0x16ca05){_0x41de7a['updateOriginated'](_0x1b494d);logger[_0x5114('0x94')](_0x2ba3f2,util[_0x5114('0x95')](_0x16ca05,{'showHidden':![],'depth':null}));};};Dialer[_0x5114('0xa6')]['emptyContact']=function(_0x22fb23,_0x534bd8,_0x4f69b8){var _0x396185={'state':0x19,'statedesc':_0x5114('0xca')};this[_0x5114('0xb0')](_0x534bd8);this[_0x5114('0xcb')](_[_0x5114('0xcc')](_0x396185,_[_0x5114('0xcd')](_0x4f69b8,[_0x5114('0xce'),'ListId',_0x5114('0xcf'),_0x5114('0xd0'),_0x5114('0xd1')])),_0x5114('0xd2'),_0x5114('0xd3'));logger[_0x5114('0x94')](_0x22fb23);};Dialer[_0x5114('0xa6')]['isSuccess']=function(_0x17dbba){return _0x17dbba===_0x5114('0xd4');};Dialer[_0x5114('0xa6')][_0x5114('0xd5')]=function(_0x3a7024){return!_[_0x5114('0x3c')](_0x3a7024)&&_0x3a7024&&!_[_0x5114('0x3c')](_0x3a7024[_0x5114('0x3f')])&&!_[_0x5114('0x3c')](_0x3a7024[_0x5114('0xd6')])&&_0x3a7024[_0x5114('0xd6')]&&(this['trunks'][util[_0x5114('0x77')]('SIP/%s',_0x3a7024['name'])]['status']===_0x5114('0xd7')||this['trunks'][util[_0x5114('0x77')](_0x5114('0xd8'),_0x3a7024[_0x5114('0x3f')])]['status']===_0x5114('0xd9'));};Dialer[_0x5114('0xa6')]['saveInDb']=function(_0x1400a7,_0xd45f9,_0x25204a){this[_0x5114('0xc6')](_0x1400a7)['catch'](loggerCatch(_0xd45f9));this[_0x5114('0xc4')](_0x1400a7)['catch'](loggerCatch(_0x25204a));};Dialer[_0x5114('0xa6')][_0x5114('0x36')]=function(_0x58864d){var _0x4917c9=this[_0x5114('0x23')][_0x58864d[_0x5114('0xda')]];var _0x56c9e8;if(!_[_0x5114('0xac')](_0x58864d)&&!_['isNil'](_0x58864d[_0x5114('0xdb')])&&!_[_0x5114('0xac')](_0x58864d[_0x5114('0xdb')][_0x5114('0xdc')])&&_0x58864d[_0x5114('0xdd')]===_0x5114('0xde')&&_0x4917c9){if(_0x4917c9[_0x5114('0x53')]!=='ivr'&&this[_0x5114('0x1b')][_0x4917c9['queue']][_0x5114('0xdf')]&&_0x58864d[_0x5114('0xe0')]===_0x5114('0xe1')){delete this[_0x5114('0x23')][_0x58864d[_0x5114('0xda')]];this['updateOriginated'](this[_0x5114('0x1b')][_0x4917c9[_0x5114('0xb1')]]);this[_0x5114('0x1b')][_0x4917c9[_0x5114('0xb1')]][_0x5114('0x5c')]+=0x1;this[_0x5114('0x1b')][_0x4917c9[_0x5114('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x56c9e8=new Hangup(_0x4917c9,_0x58864d);_0x56c9e8['state']=0x12;_0x56c9e8[_0x5114('0xe2')]='HangupInAMD';_0x56c9e8[_0x5114('0xe3')]='AMD';this['saveInDb'](_0x56c9e8,_0x5114('0xe4'),'[syncHangupInAMD]');}if(_0x4917c9['type']!==_0x5114('0x7a')&&this['voiceQueues'][_0x4917c9[_0x5114('0xb1')]][_0x5114('0xdf')]&&_0x58864d['value']===_0x5114('0xe5')){var _0xf06f8a=this;return new BPromise(function(_0x9ce0bb,_0x37091e){delete _0xf06f8a[_0x5114('0x23')][_0x58864d[_0x5114('0xda')]];_0xf06f8a[_0x5114('0xb0')](_0xf06f8a[_0x5114('0x1b')][_0x4917c9['queue']]);_0xf06f8a['voiceQueues'][_0x4917c9[_0x5114('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0xf06f8a[_0x5114('0x1b')][_0x4917c9[_0x5114('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x158eb0=_0xf06f8a[_0x5114('0x1b')][_0x4917c9[_0x5114('0xb1')]];var _0x3a449f=new Hangup(_0x4917c9,_0x58864d);_0x3a449f['state']=0x13;_0x3a449f[_0x5114('0xe2')]=_0x5114('0xe6');_0x3a449f[_0x5114('0xe3')]='AMD';_0x3a449f[_0x5114('0xe7')]+=0x1;_0x3a449f[_0x5114('0xe8')]+=0x1;_0x3a449f[_0x5114('0xe9')]=!![];_0xf06f8a[_0x5114('0xc6')](_0x3a449f)[_0x5114('0xaf')](loggerCatch(_0x5114('0xea')));if(_0x3a449f[_0x5114('0xeb')]+_0x3a449f[_0x5114('0xec')]+_0x3a449f['countnoanswerretry']+_0x3a449f[_0x5114('0xed')]+_0x3a449f[_0x5114('0xee')]+_0x3a449f[_0x5114('0xef')]+_0x3a449f['countmachineretry']+_0x3a449f['countagentrejectretry']>=_0x158eb0[_0x5114('0xf0')]){_0xf06f8a[_0x5114('0xf1')](_0x3a449f,_0x9ce0bb,_0x37091e,_0x5114('0xf2'));}else{if(_0x3a449f['countmachineretry']>=_0x158eb0['dialMachineMaxRetry']){_0xf06f8a[_0x5114('0xf3')](_0x3a449f,_0x9ce0bb,_0x37091e,_0x5114('0xf4'));}else{_0xf06f8a[_0x5114('0xbc')]({'active':![],'countmachineretry':_0x3a449f[_0x5114('0xe7')],'scheduledat':moment()[_0x5114('0xf5')](_0x158eb0[_0x5114('0xf6')],'minutes')[_0x5114('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3a449f[_0x5114('0xce')],'ListId':_0x3a449f['ListId'],'VoiceQueueId':_0x3a449f[_0x5114('0xd0')]||undefined,'CampaignId':_0x3a449f[_0x5114('0xd1')]||undefined})['catch'](loggerCatch(_0x5114('0xf7')));_0x9ce0bb({'reschedule':0x1});}}});}if(_0x4917c9[_0x5114('0x53')]===_0x5114('0x7a')&&this[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]][_0x5114('0xdf')]&&_0x58864d[_0x5114('0xe0')]===_0x5114('0xe1')){delete this['uniqueId'][_0x58864d[_0x5114('0xda')]];this['updateOriginated'](this[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]]);_0x56c9e8=new Hangup(_0x4917c9,_0x58864d);_0x56c9e8['state']=0x12;_0x56c9e8[_0x5114('0xe2')]=_0x5114('0xf8');_0x56c9e8[_0x5114('0xe3')]='AMD';this[_0x5114('0xcb')](_0x56c9e8,'[syncHangupInAMDIvr][createHistory]',_0x5114('0xf9'));}if(_0x4917c9[_0x5114('0x53')]===_0x5114('0x7a')&&this[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]]['dialAMDActive']&&_0x58864d[_0x5114('0xe0')]===_0x5114('0xe5')){var _0xf06f8a=this;return new BPromise(function(_0x420ff3,_0x4ac5df){delete _0xf06f8a[_0x5114('0x23')][_0x58864d[_0x5114('0xda')]];_0xf06f8a[_0x5114('0xb0')](_0xf06f8a[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]]);_0xf06f8a[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]][_0x5114('0x5c')]+=0x1;_0xf06f8a[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]][_0x5114('0x5b')]+=0x1;var _0x5efc63=_0xf06f8a[_0x5114('0x1c')][_0x4917c9[_0x5114('0xb1')]];var _0x186a44=new Hangup(_0x4917c9,_0x58864d);_0x186a44['state']=0x13;_0x186a44['statedesc']='Machine';_0x186a44[_0x5114('0xe3')]=_0x5114('0xfa');_0x186a44['countmachineretry']+=0x1;_0x186a44[_0x5114('0xe8')]+=0x1;_0x186a44['amd']=!![];_0xf06f8a[_0x5114('0xc6')](_0x186a44)[_0x5114('0xaf')](loggerCatch(_0x5114('0xea')));if(_0x186a44[_0x5114('0xeb')]+_0x186a44[_0x5114('0xec')]+_0x186a44[_0x5114('0xfb')]+_0x186a44[_0x5114('0xed')]+_0x186a44[_0x5114('0xee')]+_0x186a44[_0x5114('0xef')]+_0x186a44[_0x5114('0xe7')]+_0x186a44['countagentrejectretry']>=_0x5efc63[_0x5114('0xf0')]){_0xf06f8a[_0x5114('0xf1')](_0x186a44,_0x420ff3,_0x4ac5df,'reason19\x20machine....');}else{if(_0x186a44[_0x5114('0xe7')]>=_0x5efc63[_0x5114('0xfc')]){_0xf06f8a[_0x5114('0xf3')](_0x186a44,_0x420ff3,_0x4ac5df,_0x5114('0xf4'));}else{_0xf06f8a['rescheduleContact']({'active':![],'countmachineretry':_0x186a44[_0x5114('0xe7')],'scheduledat':moment()['add'](_0x5efc63[_0x5114('0xf6')],_0x5114('0xfd'))[_0x5114('0x77')](_0x5114('0xfe')),'ContactId':_0x186a44['ContactId'],'ListId':_0x186a44['ListId'],'VoiceQueueId':_0x186a44[_0x5114('0xd0')]||undefined,'CampaignId':_0x186a44['CampaignId']||undefined})['catch'](loggerCatch(_0x5114('0xf7')));_0x420ff3({'reschedule':0x1});}}});}}};Dialer[_0x5114('0xa6')][_0x5114('0x33')]=function(_0xe8efa7){var _0x4e20d7=this[_0x5114('0x23')][_0xe8efa7[_0x5114('0xda')]];var _0x1f9e62=this;var _0x47a1d0;if(_0x4e20d7&&_0x4e20d7[_0x5114('0x53')]===_0x5114('0x7a')){delete this[_0x5114('0x23')][_0xe8efa7[_0x5114('0xda')]];this[_0x5114('0xb0')](this[_0x5114('0x1c')][_0x4e20d7[_0x5114('0xb1')]]);this[_0x5114('0x1c')][_0x4e20d7[_0x5114('0xb1')]][_0x5114('0xff')]+=0x1;_0x47a1d0=new Hangup(_0x4e20d7,_0xe8efa7);this['createHistory'](_0x47a1d0)[_0x5114('0xaf')](loggerCatch(_0x5114('0x100')));this[_0x5114('0xc4')](_0x47a1d0)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4e20d7&&_0x4e20d7[_0x5114('0x53')]!=='ivr'&&isNotNull(this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]][_0x5114('0x101')])){delete this[_0x5114('0x23')][_0xe8efa7[_0x5114('0xda')]];this[_0x5114('0xb0')](this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]]);this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]][_0x5114('0x5c')]+=0x1;this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]][_0x5114('0x5b')]+=0x1;_0x47a1d0=new Hangup(_0x4e20d7,_0xe8efa7);_0x47a1d0[_0x5114('0xa3')]=0x10;_0x47a1d0['statedesc']=_0x5114('0x102');_0x47a1d0[_0x5114('0xe3')]=_0x5114('0x103');this['createHistory'](_0x47a1d0)['catch'](loggerCatch(_0x5114('0x100')));this['moveContactManagedDialer'](_0x47a1d0)[_0x5114('0xaf')](loggerCatch(_0x5114('0x104')));}if(_0x4e20d7&&_0x4e20d7[_0x5114('0x53')]!==_0x5114('0x7a')&&!isNotNull(this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]]['dialQueueProject'])){delete this[_0x5114('0x23')][_0xe8efa7[_0x5114('0xda')]];this['updateOriginated'](this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]]);this[_0x5114('0x1b')][_0x4e20d7[_0x5114('0xb1')]]['outboundUnknownCallsDay']+=0x1;_0x47a1d0=new Hangup(_0x4e20d7,_0xe8efa7);_0x47a1d0[_0x5114('0xa3')]=0xc;_0x47a1d0[_0x5114('0xe2')]=_0xe8efa7['cause-txt'];_0x47a1d0[_0x5114('0xe3')]=_0x5114('0x105');this[_0x5114('0xc6')](_0x47a1d0)[_0x5114('0xaf')](loggerCatch(_0x5114('0x100')));this[_0x5114('0xc4')](_0x47a1d0)[_0x5114('0xaf')](loggerCatch(_0x5114('0x104')));}};Dialer['prototype']['syncAgentComplete']=function(_0x1868a6){var _0x3db273=this[_0x5114('0x23')][_0x1868a6[_0x5114('0xda')]];var _0x286a53=this;if(this[_0x5114('0x1b')][_0x1868a6[_0x5114('0xb1')]]){if(_0x3db273&&_0x3db273[_0x5114('0x53')]!==_0x5114('0x7a')){delete this['uniqueId'][_0x1868a6['uniqueid']];this['voiceQueues'][_0x1868a6['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3aad0f=new AgentComplete(_0x3db273,_0x1868a6);if(_0x1868a6[_0x5114('0x106')]===_0x5114('0x107')){_0x3aad0f[_0x5114('0x108')]=this[_0x5114('0x1b')][_0x1868a6['queue']][_0x5114('0x109')]&&this[_0x5114('0x1b')][_0x1868a6[_0x5114('0xb1')]][_0x5114('0x10a')]?moment()[_0x5114('0x77')](_0x5114('0xfe')):undefined;}this[_0x5114('0xc6')](_0x3aad0f)[_0x5114('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x5114('0xc4')](_0x3aad0f)[_0x5114('0xaf')](loggerCatch(_0x5114('0x10b')));}}};Dialer[_0x5114('0xa6')]['syncAgentConnect']=function(_0x296400){if(this[_0x5114('0x1b')][_0x296400[_0x5114('0xb1')]]){if(this['uniqueId'][_0x296400[_0x5114('0xda')]]&&this[_0x5114('0x23')][_0x296400['uniqueid']][_0x5114('0x53')]!==_0x5114('0x7a')){this['updateOriginated'](this[_0x5114('0x1b')][_0x296400[_0x5114('0xb1')]]);this['uniqueId'][_0x296400[_0x5114('0xda')]][_0x5114('0x10c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5114('0xa6')][_0x5114('0x10d')]=function(_0x5f50f6){this['createHistory'](_0x5f50f6)[_0x5114('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x5114('0xc4')](_0x5f50f6)['catch'](loggerCatch(_0x5114('0x10e')));};Dialer[_0x5114('0xa6')][_0x5114('0x2d')]=function(_0x4ddf0f){var _0x1b9205=this[_0x5114('0x23')][_0x4ddf0f[_0x5114('0xda')]];var _0xc5395e=this;if(this[_0x5114('0x1b')][_0x4ddf0f['queue']]){if(_0x1b9205&&_0x1b9205[_0x5114('0x53')]!==_0x5114('0x7a')){delete this[_0x5114('0x23')][_0x4ddf0f[_0x5114('0xda')]];this[_0x5114('0xb0')](this[_0x5114('0x1b')][_0x4ddf0f['queue']]);_0x1b9205[_0x5114('0x10f')]=moment()[_0x5114('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x36b83f=new QueueCallerAbandon(_0x1b9205,_0x4ddf0f);if(getSeconds(_0x1b9205[_0x5114('0x10f')],_0x1b9205[_0x5114('0x110')])>=_0x1b9205['dialQueueTimeout']){this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]][_0x5114('0x6b')]+=0x1;this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]][_0x5114('0x62')]+=0x1;this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x36b83f[_0x5114('0xa3')]=0xa;_0x36b83f['statedesc']=_0x5114('0x111');_0x36b83f['dropreason']=_0x5114('0x112');_0x36b83f[_0x5114('0x108')]=this['voiceQueues'][_0x4ddf0f['queue']][_0x5114('0x109')]?moment()[_0x5114('0x77')](_0x5114('0xfe')):undefined;_0x36b83f[_0x5114('0xee')]+=0x1;_0x36b83f[_0x5114('0xe8')]+=0x1;if(_0x36b83f[_0x5114('0xee')]>=this[_0x5114('0x1b')][_0x4ddf0f['queue']][_0x5114('0x113')]){this[_0x5114('0x10d')](_0x36b83f);}else{this[_0x5114('0xbc')]({'active':![],'countdropretry':_0x36b83f[_0x5114('0xee')],'scheduledat':moment()['add'](this[_0x5114('0x1b')][_0x4ddf0f['queue']]['dialDropRetryFrequency'],_0x5114('0xfd'))['format'](_0x5114('0xfe')),'ContactId':_0x1b9205[_0x5114('0xce')],'ListId':_0x1b9205[_0x5114('0x114')],'VoiceQueueId':_0x1b9205[_0x5114('0xd0')]||undefined,'CampaignId':_0x1b9205[_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x115')));var _0x4053d3=new History(_0x36b83f);_0x4053d3[_0x5114('0xa3')]=0xa;_0x4053d3[_0x5114('0xe2')]=_0x5114('0x111');_0x4053d3['starttime']=moment()[_0x5114('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x4053d3['endtime']=_0x4053d3[_0x5114('0xa5')];_0x4053d3[_0x5114('0x116')]=_0x36b83f['calleridname'];_0x4053d3[_0x5114('0x117')]=_0x36b83f['calleridnum'];this[_0x5114('0xc6')](_0x4053d3)[_0x5114('0xaf')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]][_0x5114('0x61')]+=0x1;_0x36b83f['state']=0xb;_0x36b83f['statedesc']=_0x5114('0x118');_0x36b83f[_0x5114('0x119')]=_0x5114('0x11a');_0x36b83f[_0x5114('0xef')]+=0x1;_0x36b83f[_0x5114('0xe8')]+=0x1;if(_0x36b83f['countabandonedretry']>=this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]]['dialAbandonedMaxRetry']){this[_0x5114('0x10d')](_0x36b83f);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x36b83f[_0x5114('0xef')],'scheduledat':moment()[_0x5114('0xf5')](this[_0x5114('0x1b')][_0x4ddf0f[_0x5114('0xb1')]][_0x5114('0x11b')],_0x5114('0xfd'))['format'](_0x5114('0xfe')),'ContactId':_0x1b9205[_0x5114('0xce')],'ListId':_0x1b9205[_0x5114('0x114')],'VoiceQueueId':_0x1b9205['VoiceQueueId']||undefined,'CampaignId':_0x1b9205['CampaignId']||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x11c')));var _0x4053d3=new History(_0x36b83f);_0x4053d3[_0x5114('0xa3')]=0xb;_0x4053d3[_0x5114('0xe2')]=_0x5114('0x118');_0x4053d3[_0x5114('0xa5')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4053d3['endtime']=_0x4053d3[_0x5114('0xa5')];_0x4053d3[_0x5114('0x116')]=_0x36b83f[_0x5114('0x116')];_0x4053d3['calleridnum']=_0x36b83f[_0x5114('0x117')];this[_0x5114('0xc6')](_0x4053d3)['catch'](loggerCatch(_0x5114('0x11d')));}}}}};Dialer[_0x5114('0xa6')]['syncNewExten']=function(_0x104af9){if(this[_0x5114('0x21')][_0x104af9['uniqueid']]){this['actions'][_0x104af9[_0x5114('0xda')]][_0x5114('0xae')]=_0x104af9['channel'];}if(this['uniqueId'][_0x104af9[_0x5114('0xda')]]){this['uniqueId'][_0x104af9['uniqueid']][_0x5114('0xae')]=_0x104af9['channel'];}};Dialer[_0x5114('0xa6')][_0x5114('0x38')]=function(_0xcaac2e){if(strategy[this[_0x5114('0x1b')][this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]][_0x5114('0xb1')]]['strategy']]===_0x5114('0x16')){if(this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]]&&_[_0x5114('0xac')](this[_0x5114('0x21')][_0xcaac2e['actionid']][_0x5114('0x11f')])&&_0xcaac2e[_0x5114('0x120')]==='1'&&_0xcaac2e['paused']==='0'){if(this[_0x5114('0x1d')][_0xcaac2e[_0x5114('0x121')]]){if(!this[_0x5114('0x1d')][_0xcaac2e[_0x5114('0x121')]][_0x5114('0x11f')]){this[_0x5114('0x1d')][_0xcaac2e[_0x5114('0x121')]][_0x5114('0x11f')]=!![];this[_0x5114('0x21')][_0xcaac2e['actionid']][_0x5114('0x11f')]=!![];this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]]['stateinterface']=_0xcaac2e[_0x5114('0x121')];}}}}else if((strategy[this[_0x5114('0x1b')][this[_0x5114('0x21')][_0xcaac2e['actionid']]['queue']][_0x5114('0x122')]]||'rrmemory')===_0x5114('0x123')){if(this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]]){if(this[_0x5114('0x1d')][_0xcaac2e[_0x5114('0x121')]]){this['actions'][_0xcaac2e[_0x5114('0x11e')]]['stateinterface']=_0xcaac2e[_0x5114('0x121')];if(_['isNil'](this[_0x5114('0x27')][this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]][_0x5114('0xb1')]])){this['queueBooked'][this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]]['queue']]=[];}this[_0x5114('0x27')][this[_0x5114('0x21')][_0xcaac2e[_0x5114('0x11e')]][_0x5114('0xb1')]][_0x5114('0x124')](_['merge'](_['pick'](this[_0x5114('0x21')][_0xcaac2e['actionid']],[_0x5114('0x125'),'stateinterface']),{'status':_0xcaac2e[_0x5114('0x120')],'paused':_0xcaac2e[_0x5114('0x126')]}));}}}};function unlockQueueStatus(_0x3dbe39,_0x51032a){setTimeout(function(){if(_['isUndefined'](_0x3dbe39[_0x5114('0x127')])){loggerBooked[_0x5114('0x94')](_0x5114('0x128'),_0x51032a);}_0x3dbe39[_0x5114('0x127')]=!![];loggerBooked[_0x5114('0x7d')](_0x5114('0x129'),_0x51032a,JSON[_0x5114('0x4a')](_[_0x5114('0xcd')](_0x3dbe39,[_0x5114('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x5114('0xa6')][_0x5114('0x3a')]=function(_0x23d08a){var _0x2fab57=this;var _0x3d7984=_0x2fab57[_0x5114('0x1b')][_0x2fab57[_0x5114('0x21')][_0x23d08a['actionid']][_0x5114('0xb1')]];if(strategy[this['voiceQueues'][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]][_0x5114('0x122')]]===_0x5114('0x16')){if(this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]]&&this[_0x5114('0x21')][_0x23d08a['actionid']]['stateinterface']){this[_0x5114('0x1a')]['run'](this['actions'][_0x23d08a['actionid']][_0x5114('0x125')],this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0x121')])['catch'](function(_0x5a08f0){logger[_0x5114('0x94')](_0x5114('0x12a'),util['inspect'](_0x5a08f0,{'showHidden':![],'depth':null}));})[_0x5114('0x18')](function(){_0x2fab57[_0x5114('0xb0')](_0x2fab57[_0x5114('0x1b')][_0x2fab57['actions'][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]]);_0x2fab57['agents'][_0x2fab57[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0x121')]][_0x5114('0x11f')]=![];delete _0x2fab57[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]];unlockQueueStatus(_0x3d7984);});}else{this[_0x5114('0xb0')](this[_0x5114('0x1b')][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]]);this[_0x5114('0xbc')]({'active':![],'ContactId':this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xce')],'ListId':this[_0x5114('0x21')][_0x23d08a['actionid']][_0x5114('0x114')],'VoiceQueueId':this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xd0')]||undefined,'CampaignId':this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]]['CampaignId']||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x12b')));delete this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]];unlockQueueStatus(_0x3d7984);}}else if((strategy[this[_0x5114('0x1b')][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]][_0x5114('0x122')]]||_0x5114('0x123'))===_0x5114('0x123')){var _0x1de635;if(this['actions'][_0x23d08a[_0x5114('0x11e')]]&&!_[_0x5114('0x47')](this[_0x5114('0x27')][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]])){if(this[_0x5114('0x28')][_0x2fab57[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]]){this[_0x5114('0x28')][_0x2fab57['actions'][_0x23d08a['actionid']]['queue']]=this[_0x5114('0x28')][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]]['queue']]?this['queueBookedRR'][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]]:this[_0x5114('0x27')][this[_0x5114('0x21')][_0x23d08a['actionid']][_0x5114('0xb1')]]?this[_0x5114('0x27')][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]][_0x5114('0x12c')]||0x0:0x0;}this[_0x5114('0x27')][this[_0x5114('0x21')][_0x23d08a['actionid']][_0x5114('0xb1')]]['_rr']=this[_0x5114('0x28')][this[_0x5114('0x21')][_0x23d08a[_0x5114('0x11e')]][_0x5114('0xb1')]];for(var _0x144aa=0x0;_0x144aa=0x0;})[_0x5114('0xaf')](myreject(_0x512a63)));}}else{_0x372779[_0x5114('0x124')](ami[_0x5114('0xad')]({'action':'command','command':util[_0x5114('0x77')](_0x5114('0x142'),_0x5b047f,!_['isUndefined'](config['timezones'][_0x5efff1])?_0x5efff1:'')})[_0x5114('0xb5')](function(_0xf6bbbb){return _0xf6bbbb[_0x5114('0x144')][_0x5114('0x145')]('true')>=0x0;})[_0x5114('0xaf')](myreject(_0x512a63)));}BPromise[_0x5114('0x147')](_0x372779)['then'](function(_0x1bb15e){var _0x4fa41f=_[_0x5114('0x148')](_0x1bb15e);if(_0x4fa41f){return _0x4f490a(_0x4fa41f);}else{_0x392446[_0x5114('0x3d')]=_0x360d68?_0x5114('0x149'):_0x5114('0x14a');return _0x512a63(msgResponse(_0x5114('0x14b'),_0x5114('0x13e'),'Global:\x20'+_0x360d68+'\x20'+_0x39a14a+_0x5114('0x14c')+util[_0x5114('0x95')](_0x5b047f,{'showHidden':![],'depth':null})+_0x5114('0x14d')+_0x5efff1));}})[_0x5114('0xaf')](function(_0x346ae6){return _0x512a63(msgResponse(_0x5114('0x13b'),'Failure',JSON[_0x5114('0x4a')](_0x346ae6)));});});};Dialer[_0x5114('0xa6')]['checkDialMethod']=function(_0xa9663b){var _0x2fc133=this;return function(){switch(_0xa9663b[_0x5114('0x59')]){case _0x5114('0x14e'):freeVariablesPredictive(_0xa9663b);_0x2fc133['handlePower'](_0xa9663b,0x1);break;case _0x5114('0x14f'):freeVariablesPredictive(_0xa9663b);_0x2fc133[_0x5114('0x150')](_0xa9663b,_0xa9663b[_0x5114('0x151')]);break;case _0x5114('0x8'):_0x2fc133[_0x5114('0x8')](_0xa9663b);break;case _0x5114('0x7'):freeVariablesPredictive(_0xa9663b);_0x2fc133[_0x5114('0x150')](_0xa9663b,0x1);break;default:freeVariablesPredictive(_0xa9663b);logger[_0x5114('0x94')](_0x5114('0x152'),_0xa9663b['name'],'method\x20not\x20recognized');}};};Dialer[_0x5114('0xa6')][_0x5114('0x153')]=function(_0x3898de){var _0x7edb99=this;return function(){_0x7edb99[_0x5114('0x154')](_0x3898de);};};Dialer[_0x5114('0xa6')]['syncQueueSummary']=function(_0xfff012){var _0x540815=this;if(isNotPreview(_0xfff012[_0x5114('0x59')])){if(isVoiceQueueOutbound(_0xfff012[_0x5114('0x53')])&&isActive(_0xfff012['dialActive'])){_0xfff012[_0x5114('0x9c')]=!![];BPromise[_0x5114('0xb4')]()[_0x5114('0xb5')](checkIsLoggedIn(_0xfff012,_0xfff012[_0x5114('0x155')]))['then'](checkIsActive(_0xfff012,_0xfff012['dialActive']))[_0x5114('0xb5')](checkInterval(_0xfff012))[_0x5114('0xb5')](_0x540815['checkIsTrunkReachable'](_0xfff012))[_0x5114('0xb5')](_0x540815[_0x5114('0x13a')](_0xfff012[_0x5114('0x156')],_0xfff012['dialTimezone'],_0xfff012[_0x5114('0x3f')],_0xfff012))['then'](_0x540815[_0x5114('0x13c')](_0xfff012[_0x5114('0x43')],_0xfff012[_0x5114('0x157')],_0xfff012[_0x5114('0x3f')],_0xfff012))[_0x5114('0xb5')](_0x540815['checkDialMethod'](_0xfff012))[_0x5114('0xaf')](loggerCatchQueueSummary(_0x5114('0x158'),_0xfff012));}else{notSendMessagesQueue(_0xfff012);}}else{freeVariablesPredictive(_0xfff012);}};Dialer[_0x5114('0xa6')]['syncCampaigns']=function(){var _0x51befa=this;var _0x3c5d58;for(var _0x1e042b in this[_0x5114('0x1c')]){if(typeof this[_0x5114('0x1c')][_0x1e042b]!==_0x5114('0xab')){_0x3c5d58=this[_0x5114('0x1c')][_0x1e042b];if(isCampaignIvr(_0x3c5d58[_0x5114('0x53')])&&isActive(_0x3c5d58[_0x5114('0xd6')])){_0x3c5d58[_0x5114('0x9c')]=!![];BPromise[_0x5114('0xb4')]()[_0x5114('0xb5')](checkIsActive(_0x3c5d58,_0x3c5d58[_0x5114('0xd6')]))['then'](checkInterval(_0x3c5d58))[_0x5114('0xb5')](_0x51befa['checkIsTrunkReachable'](_0x3c5d58))[_0x5114('0xb5')](_0x51befa['checkIfTime'](_0x3c5d58[_0x5114('0x156')],_0x3c5d58['dialTimezone'],_0x3c5d58[_0x5114('0x3f')],_0x3c5d58))[_0x5114('0xb5')](_0x51befa[_0x5114('0x13c')](_0x3c5d58[_0x5114('0x43')],_0x3c5d58[_0x5114('0x157')],_0x3c5d58[_0x5114('0x3f')],_0x3c5d58))[_0x5114('0xb5')](_0x51befa[_0x5114('0x153')](_0x3c5d58))[_0x5114('0xaf')](loggerCatchQueueSummary(_0x5114('0x159'),_0x3c5d58));}else{notSendMessagesCampaign(_0x3c5d58);}}}};function getCallerIdRandom(_0x138683,_0x3111df){var _0x53bdcc;var _0x5d033e;var _0xaf8cd6;if(_0x3111df<=0x0){_0x3111df=0x1;}_0x53bdcc=new RegExp(_0x5114('0x15a')+_0x3111df+'}$');_0x5d033e=Math[_0x5114('0x15b')](0xa,_0x3111df-0x1);_0xaf8cd6=Math['pow'](0xa,_0x3111df)-0x1;return util[_0x5114('0x77')]('%s',_['replace'](_0x138683,_0x53bdcc,_[_0x5114('0x15c')](_0x5d033e,_0xaf8cd6)));}function extractCalleridName(_0xaeae3f){var _0x109ee8=_0xaeae3f[_0x5114('0x15d')](/"(.*?)"/);return _0x109ee8?_0x109ee8[0x1]:_0xaeae3f;}function extractCalleridNumber(_0x17d9b3){var _0x453fb9=_0x17d9b3[_0x5114('0x15d')](/<(.*?)>/);return _0x453fb9?_0x453fb9[0x1]:_0x17d9b3;}Dialer[_0x5114('0xa6')][_0x5114('0x15e')]=function(_0x283b0b,_0x2e1287){var _0xcd254b=this;var _0x13fd37=uuid['v4']();this[_0x5114('0x21')][_0x13fd37]=new Action(_0x283b0b,_0x2e1287,_0x13fd37);return new BPromise(function(_0x43c08e,_0x2d999d){if(_[_0x5114('0x3c')](_0x283b0b)&&typeof _0x283b0b!==_0x5114('0x15f')){return _0x2d999d(msgResponse(_0x5114('0x160'),_0x5114('0x13e'),_0x5114('0x161')));}if(_[_0x5114('0x3c')](_0x2e1287[_0x5114('0x162')][_0x5114('0x163')])||_0x2e1287[_0x5114('0x162')][_0x5114('0x163')]===null){return _0x2d999d(msgResponse(_0x5114('0x160'),_0x5114('0x13e'),_0x5114('0x164')));}var _0x3abcaa={'XMD-CALLERID':_0xcd254b['actions'][_0x13fd37][_0x5114('0x165')](),'XMD-AGI':_0x283b0b['dialQueueProject']?util['format'](_0x5114('0x166'),ipAgi,_0x283b0b['dialQueueProject']):_0x5114('0x167'),'XMD-AGIAFTER':_0x283b0b[_0x5114('0x109')]?util[_0x5114('0x77')](_0x5114('0x166'),ipAgi,_0x283b0b[_0x5114('0x109')]):'NONE','XMD-QUEUE':_0x283b0b[_0x5114('0x53')]===_0x5114('0x4d')?util[_0x5114('0x77')](_0x5114('0x168'),_0x283b0b[_0x5114('0x3f')],_0x283b0b[_0x5114('0x169')]||'',_0x283b0b[_0x5114('0x10a')]?'c':'',_0x283b0b[_0x5114('0x16a')]||0x3):_0x5114('0x167'),'XMD-CONTACTID':_0x2e1287['ContactId'],'XMD-CDRTYPE':_0x5114('0x6'),'CALLERID(all)':_0xcd254b[_0x5114('0x21')][_0x13fd37][_0x5114('0x165')](),'XMD-AMD':_0x283b0b[_0x5114('0xdf')]?_0x5114('0x16b'):_0x5114('0x167'),'XMD-DESTINATION':_0x5114('0xde')};if(_0x283b0b[_0x5114('0xdf')]){_0x3abcaa[_0x5114('0x16c')]=_0x283b0b['dialAMDInitialSilence']||0x9c4;_0x3abcaa[_0x5114('0x16d')]=_0x283b0b[_0x5114('0x16e')]||0x5dc;_0x3abcaa['XMD-AMDAFTERGREETINGSILENCE']=_0x283b0b[_0x5114('0x16f')]||0x320;_0x3abcaa[_0x5114('0x170')]=_0x283b0b[_0x5114('0x171')]||0x1388;_0x3abcaa[_0x5114('0x172')]=_0x283b0b[_0x5114('0x173')]||0x64;_0x3abcaa[_0x5114('0x174')]=_0x283b0b[_0x5114('0x175')]||0x32;_0x3abcaa[_0x5114('0x176')]=_0x283b0b[_0x5114('0x177')]||0x3;_0x3abcaa[_0x5114('0x178')]=_0x283b0b['dialAMDSilenceThreshold']||0x100;_0x3abcaa[_0x5114('0x179')]=_0x283b0b[_0x5114('0x17a')]||0x1388;}if(_0x283b0b[_0x5114('0x53')]===_0x5114('0x4d')){_0x3abcaa[_0x5114('0x17b')]=_0x2e1287[_0x5114('0xd0')];}else{_0x3abcaa[_0x5114('0x17c')]=_0x2e1287['CampaignId'];}for(var _0x498540 in _0x2e1287[_0x5114('0x162')]){if(typeof _0x2e1287[_0x5114('0x162')][_0x498540]!==_0x5114('0xab')){if(isNotNull(_0x2e1287[_0x5114('0x162')][_0x498540])&&_0x498540!=='id'&&_0x498540!==_0x5114('0x17d')&&_0x498540!==_0x5114('0x17e')&&_0x498540!==_0x5114('0x17f')){_0x3abcaa[util[_0x5114('0x77')](_0x5114('0x180'),_0x5114('0x181'),_[_0x5114('0x182')](_0x498540))]=_0x2e1287[_0x5114('0x162')][_0x498540];}}}var _0x565795=_0xcd254b[_0x5114('0xd5')](_0x283b0b['Trunk'])?getCallerId(_0x283b0b['Trunk'][_0x5114('0x75')],_0x283b0b[_0x5114('0x5a')],_0x283b0b[_0x5114('0x183')]>0x0?getCallerIdRandom(_0x283b0b[_0x5114('0x184')],_0x283b0b[_0x5114('0x183')]):_0x283b0b[_0x5114('0x184')]):getCallerId(_[_0x5114('0xac')](_0x283b0b[_0x5114('0x185')])?_0x283b0b[_0x5114('0x74')]['callerid']:_0x283b0b[_0x5114('0x185')][_0x5114('0x75')],_0x283b0b[_0x5114('0x5a')],_0x283b0b[_0x5114('0x183')]>0x0?getCallerIdRandom(_0x283b0b[_0x5114('0x184')],_0x283b0b['dialRandomLastDigitCallerIdNumber']):_0x283b0b[_0x5114('0x184')]);if(_0x565795){_0x3abcaa[_0x5114('0x186')]=_0xcd254b[_0x5114('0x21')][_0x13fd37][_0x5114('0x187')]=extractCalleridName(_0x565795);_0x3abcaa[_0x5114('0x188')]=_0xcd254b[_0x5114('0x21')][_0x13fd37]['originatecalleridnum']=extractCalleridNumber(_0x565795);}return ami[_0x5114('0xad')]({'actionid':_0x13fd37,'action':_0x5114('0x160'),'channel':_0xcd254b['isTrunkReachable'](_0x283b0b[_0x5114('0x74')])?util[_0x5114('0x77')](_0x5114('0x189'),_0x283b0b[_0x5114('0x74')]['name'],isNotNull(_0x283b0b['dialPrefix'])?_0x283b0b[_0x5114('0x18a')][_0x5114('0x18b')]()||'':'',_0x283b0b['dialCutDigit']>0x0?_0x2e1287[_0x5114('0x162')][_0x5114('0x163')][_0x5114('0x18c')](_0x283b0b[_0x5114('0x18d')]):_0x2e1287[_0x5114('0x162')][_0x5114('0x163')]):util[_0x5114('0x77')](_0x5114('0x189'),_['isNil'](_0x283b0b['TrunkBackup'])?_0x283b0b[_0x5114('0x74')][_0x5114('0x3f')]:_0x283b0b['TrunkBackup'][_0x5114('0x3f')],isNotNull(_0x283b0b[_0x5114('0x18a')])?_0x283b0b['dialPrefix'][_0x5114('0x18b')]()||'':'',_0x283b0b['dialCutDigit']>0x0?_0x2e1287[_0x5114('0x162')]['phone']['substring'](_0x283b0b['dialCutDigit']):_0x2e1287[_0x5114('0x162')][_0x5114('0x163')]),'callerid':_0x565795,'Exten':_0x5114('0xde'),'Context':'from-sip','Priority':'1','variable':_0x3abcaa,'timeout':(_0x283b0b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x13fd37})['then'](function(_0xdfd041){return _0x43c08e(_0xdfd041);})[_0x5114('0xaf')](function(_0xbf7059){_0x283b0b[_0x5114('0x18e')]+=0x1;var _0x28111f=new History(_0xcd254b['actions'][_0x13fd37]);logger[_0x5114('0x94')](util[_0x5114('0x77')]('[originateError]:\x20%s',JSON[_0x5114('0x4a')](_0xbf7059)));_0x28111f[_0x5114('0xa3')]=0xe;_0x28111f[_0x5114('0xe2')]=_0x5114('0x18f');_0x28111f[_0x5114('0xa5')]=moment()[_0x5114('0x77')](_0x5114('0xfe'));_0x28111f[_0x5114('0xa4')]=_0x28111f[_0x5114('0xa5')];_0xcd254b[_0x5114('0xc6')](_0x28111f)[_0x5114('0xaf')](loggerCatch(_0x5114('0x190')));_0xcd254b[_0x5114('0xc4')](_0x28111f)['catch'](loggerCatch(_0x5114('0x190')))[_0x5114('0x18')](function(){delete _0xcd254b[_0x5114('0x21')][_0x13fd37];return _0x2d999d(msgResponse(_0x5114('0x160'),_0x5114('0x49'),_0x5114('0x191')));});});});};Dialer['prototype'][_0x5114('0x2f')]=function(_0x51bed5){var _0xa95fd8=this[_0x5114('0x21')][_0x51bed5[_0x5114('0x11e')]];if(_0xa95fd8){delete this['actions'][_0x51bed5['actionid']];_0xa95fd8[_0x5114('0x110')]=moment()[_0x5114('0x77')](_0x5114('0xfe'));var _0x51fa32=_0xa95fd8[_0x5114('0x53')]===_0x5114('0x7a')?this[_0x5114('0x1c')][_0xa95fd8['queue']]:this[_0x5114('0x1b')][_0xa95fd8[_0x5114('0x192')]()];if(!this[_0x5114('0x193')](_0x51bed5[_0x5114('0x194')])){this['updateOriginated'](_0x51fa32);return this['callProgressDetecting'](_0xa95fd8,_0x51fa32,_0x51bed5)[_0x5114('0xaf')](loggerCatch(_0x5114('0x195')));}this[_0x5114('0x23')][_0x51bed5[_0x5114('0xda')]]=_0xa95fd8;}};Dialer[_0x5114('0xa6')][_0x5114('0x196')]=function(_0x1be213,_0x527e0f,_0x1c61b7){var _0x16c93a=new History(_0x527e0f);if(_0x16c93a[_0x5114('0xeb')]+_0x16c93a[_0x5114('0xec')]+_0x16c93a[_0x5114('0xfb')]+_0x16c93a[_0x5114('0xed')]+_0x16c93a[_0x5114('0xee')]+_0x16c93a[_0x5114('0xef')]+_0x16c93a[_0x5114('0xe7')]+_0x16c93a['countagentrejectretry']>=_0x1c61b7[_0x5114('0xf0')]-0x1){return!![];}switch(_0x1be213){case 0x3:if(_0x16c93a['countnoanswerretry']>=_0x1c61b7[_0x5114('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x16c93a[_0x5114('0xfb')]+=0x1,'scheduledat':moment()['add'](_0x1c61b7['dialNoAnswerRetryFrequency'],_0x5114('0xfd'))[_0x5114('0x77')](_0x5114('0xfe')),'ContactId':_0x16c93a[_0x5114('0xce')],'ListId':_0x16c93a['ListId'],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x198')));break;case 0x5:if(_0x16c93a[_0x5114('0xeb')]>=_0x1c61b7[_0x5114('0x199')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x16c93a[_0x5114('0xeb')]+=0x1,'scheduledat':moment()[_0x5114('0xf5')](_0x1c61b7[_0x5114('0x19a')],_0x5114('0xfd'))[_0x5114('0x77')](_0x5114('0xfe')),'ContactId':_0x16c93a[_0x5114('0xce')],'ListId':_0x16c93a[_0x5114('0x114')],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a['CampaignId']||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x19b')));break;case 0x8:if(_0x16c93a[_0x5114('0xec')]>=_0x1c61b7[_0x5114('0x19c')]-0x1){return!![];}this[_0x5114('0xbc')]({'active':![],'countcongestionretry':_0x16c93a[_0x5114('0xec')]+=0x1,'scheduledat':moment()['add'](_0x1c61b7[_0x5114('0x19d')],_0x5114('0xfd'))[_0x5114('0x77')](_0x5114('0xfe')),'ContactId':_0x16c93a['ContactId'],'ListId':_0x16c93a[_0x5114('0x114')],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x19e')));break;case 0x0:if(_0x16c93a[_0x5114('0xed')]>=_0x1c61b7[_0x5114('0x19f')]-0x1){return!![];}else{this[_0x5114('0xbc')]({'active':![],'countnosuchnumberretry':_0x16c93a[_0x5114('0xed')]+=0x1,'scheduledat':moment()[_0x5114('0xf5')](_0x1c61b7[_0x5114('0x1a0')],'minutes')['format'](_0x5114('0xfe')),'ContactId':_0x16c93a[_0x5114('0xce')],'ListId':_0x16c93a[_0x5114('0x114')],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})['catch'](loggerCatch(_0x5114('0x1a1')));}break;case 0xa:if(_0x16c93a['countdropretry']>=_0x1c61b7[_0x5114('0x113')]-0x1){return!![];}this[_0x5114('0xbc')]({'active':![],'countdropretry':_0x16c93a[_0x5114('0xee')]+=0x1,'scheduledat':moment()[_0x5114('0xf5')](_0x1c61b7[_0x5114('0x1a2')],_0x5114('0xfd'))[_0x5114('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16c93a[_0x5114('0xce')],'ListId':_0x16c93a['ListId'],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x115')));break;case 0xb:if(_0x16c93a[_0x5114('0xef')]>=_0x1c61b7[_0x5114('0x1a3')]-0x1){return!![];}this[_0x5114('0xbc')]({'active':![],'countabandonedretry':_0x16c93a[_0x5114('0xef')]+=0x1,'scheduledat':moment()['add'](_0x1c61b7[_0x5114('0x11b')],_0x5114('0xfd'))[_0x5114('0x77')](_0x5114('0xfe')),'ContactId':_0x16c93a[_0x5114('0xce')],'ListId':_0x16c93a['ListId'],'VoiceQueueId':_0x16c93a['VoiceQueueId']||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x11c')));break;case 0x13:if(_0x16c93a[_0x5114('0xe7')]>=_0x1c61b7[_0x5114('0xfc')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x16c93a[_0x5114('0xe7')]+=0x1,'scheduledat':moment()[_0x5114('0xf5')](_0x1c61b7[_0x5114('0xf6')],_0x5114('0xfd'))[_0x5114('0x77')](_0x5114('0xfe')),'ContactId':_0x16c93a[_0x5114('0xce')],'ListId':_0x16c93a[_0x5114('0x114')],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})['catch'](loggerCatch(_0x5114('0xf7')));break;case 0x14:if(_0x16c93a['countagentrejectretry']>=_0x1c61b7[_0x5114('0x1a4')]-0x1){return!![];}this[_0x5114('0xbc')]({'active':![],'countagentrejectretry':_0x16c93a[_0x5114('0x1a5')]+=0x1,'scheduledat':moment()['add'](_0x1c61b7[_0x5114('0x1a6')],'minutes')['format'](_0x5114('0xfe')),'ContactId':_0x16c93a['ContactId'],'ListId':_0x16c93a[_0x5114('0x114')],'VoiceQueueId':_0x16c93a[_0x5114('0xd0')]||undefined,'CampaignId':_0x16c93a[_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch(_0x5114('0x1a7')));break;default:return!![];}};Dialer['prototype'][_0x5114('0x1a8')]=function(_0x5e9222,_0x5f0038,_0x180253){var _0x5869ea=this;var _0x2e804c=new History(_0x5e9222);return new BPromise(function(_0x434f74,_0x2d4862){if(_[_0x5114('0x3c')](_0x5f0038)&&typeof _0x5f0038!==_0x5114('0x15f')){return _0x2d4862(msgResponse(_0x5114('0x1a9'),'Failure','entity\x20is\x20undefine'));}if(_[_0x5114('0x3c')](_0x180253)&&typeof _0x180253!==_0x5114('0x15f')){return _0x2d4862(msgResponse('[callProgressDetecting]',_0x5114('0x13e'),'evt\x20is\x20undefine'));}switch(_0x180253[_0x5114('0x106')]){case'0':_0x5f0038[_0x5114('0x64')]+=0x1;_0x2e804c[_0x5114('0xa3')]=0x0;_0x2e804c[_0x5114('0xe2')]=_0x5114('0x1aa');_0x2e804c['countnosuchnumberretry']+=0x1;_0x2e804c[_0x5114('0xe8')]+=0x1;ami[_0x5114('0x1ab')](_0x5114('0x1ac'),ut[_0x5114('0x1ad')](_0x5e9222,'nosuchnumber'));_0x5869ea[_0x5114('0xc6')](_0x2e804c)[_0x5114('0xaf')](loggerCatch(_0x5114('0xea')));if(_0x5869ea[_0x5114('0x196')](0x0,_0x5e9222,_0x5f0038)){if(_0x2e804c[_0x5114('0xed')]>=_0x5f0038[_0x5114('0x19f')]){_0x5869ea[_0x5114('0xf3')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1ae'));}else{_0x5869ea['stateGlobal'](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1ae'));}}break;case'3':_0x5f0038[_0x5114('0x63')]+=0x1;_0x2e804c[_0x5114('0xa3')]=0x3;_0x2e804c[_0x5114('0xe2')]=_0x5114('0x1af');_0x2e804c[_0x5114('0xfb')]+=0x1;_0x2e804c[_0x5114('0xe8')]+=0x1;ami[_0x5114('0x1ab')](_0x5114('0x1b0'),ut[_0x5114('0x1ad')](_0x5e9222,'noanswer'));_0x5869ea[_0x5114('0xc6')](_0x2e804c)[_0x5114('0xaf')](loggerCatch(_0x5114('0x1b1')));if(_0x5869ea['checkRetriveMax'](0x3,_0x5e9222,_0x5f0038)){if(_0x2e804c[_0x5114('0xfb')]>=_0x5f0038[_0x5114('0x197')]){_0x5869ea['createStateFinal'](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1b2'));}else{_0x5869ea[_0x5114('0xf1')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1b2'));}}break;case'5':_0x5f0038[_0x5114('0x5e')]+=0x1;_0x2e804c[_0x5114('0xa3')]=0x5;_0x2e804c[_0x5114('0xe2')]=_0x5114('0x1b3');_0x2e804c['countbusyretry']+=0x1;_0x2e804c[_0x5114('0xe8')]+=0x1;ami[_0x5114('0x1ab')](_0x5114('0x1b4'),ut[_0x5114('0x1ad')](_0x5e9222,_0x5114('0x1b5')));_0x5869ea['createHistory'](_0x2e804c)[_0x5114('0xaf')](loggerCatch(_0x5114('0x1b6')));if(_0x5869ea[_0x5114('0x196')](0x5,_0x5e9222,_0x5f0038)){if(_0x2e804c[_0x5114('0xeb')]>=_0x5f0038[_0x5114('0x199')]){_0x5869ea[_0x5114('0xf3')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1b7'));}else{_0x5869ea[_0x5114('0xf1')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1b7'));}}break;case'8':_0x5f0038[_0x5114('0x5f')]+=0x1;_0x2e804c[_0x5114('0xa3')]=0x8;_0x2e804c[_0x5114('0xe2')]=_0x5114('0x1b8');_0x2e804c['countcongestionretry']+=0x1;_0x2e804c[_0x5114('0xe8')]+=0x1;ami[_0x5114('0x1ab')]('custom:agentcongestion',ut[_0x5114('0x1ad')](_0x5e9222,_0x5114('0x1b9')));_0x5869ea['createHistory'](_0x2e804c)[_0x5114('0xaf')](loggerCatch(_0x5114('0x1ba')));if(_0x5869ea[_0x5114('0x196')](0x8,_0x5e9222,_0x5f0038)){if(_0x2e804c['countcongestionretry']>=_0x5f0038[_0x5114('0x19c')]){_0x5869ea[_0x5114('0xf3')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1bb'));}else{_0x5869ea[_0x5114('0xf1')](_0x2e804c,_0x434f74,_0x2d4862,'reason\x208\x20congestion');}}break;case'11':_0x5f0038[_0x5114('0x1bc')]+=0x1;_0x2e804c[_0x5114('0xa3')]=0xb;_0x2e804c[_0x5114('0xe2')]=_0x5114('0x118');_0x2e804c[_0x5114('0xef')]+=0x1;_0x2e804c['countglobal']+=0x1;_0x5869ea[_0x5114('0xc6')](_0x2e804c)[_0x5114('0xaf')](loggerCatch(_0x5114('0x11d')));if(_0x5869ea['checkRetriveMax'](0xb,_0x5e9222,_0x5f0038)){if(_0x2e804c[_0x5114('0xef')]>=_0x5f0038['dialAbandonedMaxRetry']){_0x5869ea['createStateFinal'](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1bd'));}else{_0x5869ea[_0x5114('0xf1')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1bd'));}}break;case'20':_0x5f0038['outboundRejectCallsDay']+=0x1;_0x2e804c['state']=0x14;_0x2e804c[_0x5114('0xe2')]=_0x5114('0x1be');_0x2e804c[_0x5114('0x1a5')]+=0x1;_0x2e804c['countglobal']+=0x1;ami[_0x5114('0x1ab')](_0x5114('0x1bf'),ut[_0x5114('0x1ad')](_0x5e9222,_0x5114('0x1c0')));_0x5869ea['createHistory'](_0x2e804c)[_0x5114('0xaf')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5869ea[_0x5114('0x196')](0x14,_0x5e9222,_0x5f0038)){if(_0x2e804c[_0x5114('0x1a5')]>=_0x5f0038[_0x5114('0x1a4')]){_0x5869ea[_0x5114('0xf3')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1c1'));}else{_0x5869ea[_0x5114('0xf1')](_0x2e804c,_0x434f74,_0x2d4862,_0x5114('0x1c1'));}}break;default:_0x5f0038[_0x5114('0x67')]+=0x1;_0x2e804c[_0x5114('0xa3')]=0xc;_0x2e804c[_0x5114('0xe2')]=_0x180253[_0x5114('0x106')];_0x5869ea[_0x5114('0xc6')](_0x2e804c)[_0x5114('0xaf')](loggerCatch(_0x5114('0x1c2')));if(_0x5869ea['checkRetriveMax'](_0x180253[_0x5114('0x106')],_0x5e9222,_0x5f0038)){if(_0x2e804c[_0x5114('0xeb')]+_0x2e804c[_0x5114('0xec')]+_0x2e804c[_0x5114('0xfb')]+_0x2e804c[_0x5114('0xed')]+_0x2e804c[_0x5114('0xee')]+_0x2e804c[_0x5114('0xef')]+_0x2e804c[_0x5114('0xe7')]+_0x2e804c[_0x5114('0x1a5')]>=_0x5f0038[_0x5114('0xf0')]){_0x5869ea[_0x5114('0xf1')](_0x2e804c,_0x434f74,_0x2d4862,_0x180253[_0x5114('0x106')]);}else{_0x5869ea[_0x5114('0xf3')](_0x2e804c,_0x434f74,_0x2d4862,_0x180253[_0x5114('0x106')]);}}}});};Dialer[_0x5114('0xa6')]['stateGlobal']=function(_0x107a89,_0x4e5d1c,_0x53e33f,_0x329155){var _0x5db0c7=new Final(_0x107a89);_0x5db0c7['state']=0xf;_0x5db0c7['statedesc']='Global';this[_0x5114('0xf3')](_0x5db0c7,_0x4e5d1c,_0x53e33f,_0x329155);};Dialer[_0x5114('0xa6')]['createStateFinal']=function(_0x33af0d,_0x78561f,_0x31c524,_0x3c647a){this[_0x5114('0xc4')](_0x33af0d)[_0x5114('0xb5')](function(){return _0x78561f(msgResponse('[callProgressDetecting]',_0x5114('0xd4'),_0x3c647a));})[_0x5114('0xaf')](function(){return _0x31c524(msgResponse(_0x5114('0x1c3'),'Failure',_0x5114('0x1c4')));});};Dialer[_0x5114('0xa6')][_0x5114('0x8')]=function(_0x59699c){var _0x5d4252=_0x59699c['dialPredictiveOptimizationPercentage']/0x64;var _0xe3305c=_0x59699c[_0x5114('0x62')]/(_0x59699c[_0x5114('0x62')]+_0x59699c[_0x5114('0x5c')]);var _0x237c05=Math['round'](_0x59699c[_0x5114('0x1c5')]*(_0x59699c[_0x5114('0x1c6')]/0x64));var _0x43b663=Math[_0x5114('0x1c7')](_0x59699c[_0x5114('0x1c5')]*(_0x59699c[_0x5114('0x1c8')]/0x64));var _0x43a7fa=_0x59699c['available']+_0x59699c[_0x5114('0x9d')];var _0x5943bb=Math[_0x5114('0x1c9')](_0x59699c['erlangCalls']*_0x59699c['erlangAbandonmentRate']*_0x59699c[_0x5114('0x6d')]*_0x59699c[_0x5114('0x6e')]);if(_['isUndefined'](_0x59699c['startProgressive'])){if(!_['isUndefined'](_0x59699c[_0x5114('0x25')])){_0x59699c[_0x5114('0x25')]=undefined;loggerPredictive[_0x5114('0x94')](_0x5114('0x1ca'),_0x5114('0x1cb'));}if(!_['isUndefined'](_0x59699c[_0x5114('0x90')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x5114('0x1cc'));clearInterval(_0x59699c[_0x5114('0x90')]);_0x59699c[_0x5114('0x90')]=undefined;}_0x59699c[_0x5114('0x1cd')]=moment()['format'](_0x5114('0xfe'));loggerPredictive['info'](_0x59699c[_0x5114('0x3f')],_0x5114('0x1ce'),_0x59699c['startProgressive']);this[_0x5114('0x150')](_0x59699c,0x1);}else if(ifInterval(_0x59699c[_0x5114('0x1cf')],_0x59699c[_0x5114('0x1cd')])){this[_0x5114('0x150')](_0x59699c,0x1);loggerPredictiveCalls['info'](_0x5114('0x1d0'),_0x59699c[_0x5114('0x1cd')],_0x59699c[_0x5114('0x3f')]);_0x59699c[_0x5114('0x71')]=0x0;_0x59699c[_0x5114('0x1d1')]=0x0;}else if(_0x5d4252<_0xe3305c&&_0x59699c[_0x5114('0x1d2')]===_0x5114('0x1d3')){freeVariablesPredictive(_0x59699c);loggerPredictive[_0x5114('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0xe3305c,_0x5114('0x1cd'),_0x59699c[_0x5114('0x3f')]);}else if(_0x5943bb<_0x59699c['predictiveIntervalErlangCallsDroppedCalls']&&_0x59699c[_0x5114('0x1d2')]===_0x5114('0x1d3')){freeVariablesPredictive(_0x59699c);loggerPredictive[_0x5114('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x5943bb,_0x5114('0x1d4'),_0x59699c['predictiveIntervalErlangCallsDroppedCalls'],_0x5114('0x1cd'),_0x59699c[_0x5114('0x3f')]);}else if(!ifInterval(_0x59699c[_0x5114('0x1cf')],_0x59699c['startProgressive'])&&_['isUndefined'](_0x59699c[_0x5114('0x25')])&&!_[_0x5114('0x3c')](_0x59699c[_0x5114('0x1cd')])){_0x59699c['startPredictive']=moment()[_0x5114('0x77')](_0x5114('0xfe'));loggerPredictive[_0x5114('0x7d')](_0x59699c[_0x5114('0x3f')],_0x5114('0x1d5'),_0x59699c[_0x5114('0x25')]);this['averageHandleTime'](_0x59699c[_0x5114('0x1cf')])[_0x5114('0xb5')](this[_0x5114('0x1d6')](_0x59699c))[_0x5114('0xb5')](mergeDataErlangB(_0x59699c))[_0x5114('0xb5')](this[_0x5114('0x1d7')](_0x59699c))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x59699c));}else if(!ifInterval(_0x59699c[_0x5114('0x1cf')],_0x59699c[_0x5114('0x25')])){_0x59699c['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x59699c[_0x5114('0x25')]=moment()[_0x5114('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5114('0x7d')](_0x59699c[_0x5114('0x3f')],_0x5114('0x1d8'),_0x59699c[_0x5114('0x25')]);clearInterval(_0x59699c['handlePredictive']);_0x59699c[_0x5114('0x90')]=undefined;this[_0x5114('0xbb')](_0x59699c[_0x5114('0x1cf')])['then'](this[_0x5114('0x1d6')](_0x59699c))['then'](mergeDataErlangB(_0x59699c))[_0x5114('0xb5')](this[_0x5114('0x1d7')](_0x59699c))[_0x5114('0xaf')](loggerCatchPredictive(_0x5114('0x1d9'),_0x59699c));}else if(_0x59699c[_0x5114('0x1c5')]&&_0x43a7fa<_0x59699c['predictiveIntervalAvailable']-_0x43b663){freeVariablesPredictive(_0x59699c);loggerPredictive['info'](_0x59699c['name'],_0x5114('0x1da'),_0x43a7fa,_0x5114('0x1db'),_0x59699c[_0x5114('0x1c5')],'-',_0x43b663,'=',_0x59699c[_0x5114('0x1c5')]-_0x43b663,')');}else if(_0x59699c[_0x5114('0x1c5')]&&_0x43a7fa>_0x59699c[_0x5114('0x1c5')]+_0x237c05){freeVariablesPredictive(_0x59699c);loggerPredictive[_0x5114('0x7d')](_0x59699c['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x43a7fa,_0x5114('0x1dc'),_0x59699c[_0x5114('0x1c5')],'+',_0x237c05,'=',_0x59699c[_0x5114('0x1c5')]+_0x237c05,')');}};Dialer[_0x5114('0xa6')][_0x5114('0x1d6')]=function(_0x34564c){var _0x17b65d=this;return function(_0xb22752){return new BPromise(function(_0x5ec867,_0xee9988){_[_0x5114('0xcc')](_0x34564c,_0xb22752[0x0]);if(checkGetDataPredictive(_0xb22752[0x0])){var _0x50c2a4=_0x34564c[_0x5114('0x1c5')]=_0x34564c[_0x5114('0x9d')]+_0x34564c['available'];var _0x27f5ca=_0x34564c[_0x5114('0x1cf')]*0x3c;var _0x3c69af=_0xb22752[0x0][_0x5114('0x82')]+_0xb22752[0x0][_0x5114('0x69')];var _0x5dd8cc=(_0xb22752[0x0][_0x5114('0x68')]+_0xb22752[0x0][_0x5114('0x6b')]+_0xb22752[0x0][_0x5114('0x6a')])/_0xb22752[0x0][_0x5114('0x84')];_0x34564c[_0x5114('0x6d')]=_0x5dd8cc>0x0?_0x5dd8cc:0x1;switch(_0x34564c[_0x5114('0x1d2')]){case _0x5114('0x1d3'):var _0x4dac6e=_0x34564c[_0x5114('0x1dd')]/0x64;return _0x17b65d[_0x5114('0x1de')](_0x50c2a4,_0x27f5ca,_0x3c69af,_0x5dd8cc,_0x4dac6e)[_0x5114('0xb5')](function(_0x5b4efa){return _0x5ec867(_0x5b4efa);});case'agentBusyFactor':var _0x46c3e3=_0x34564c[_0x5114('0x1dd')]/0x64;return _0x17b65d[_0x5114('0x1df')](_0x50c2a4,_0x27f5ca,_0x3c69af,_0x5dd8cc,_0x46c3e3)[_0x5114('0xb5')](function(_0x3b403a){return _0x5ec867(_0x3b403a);});default:return _0xee9988(msgResponse('[getDataPredictive]',_0x5114('0x13e'),_0x5114('0x1e0')));}}else{return _0xee9988(msgResponse('[getDataPredictive]',_0x5114('0x13e'),'check\x20failure'));}});};};Dialer[_0x5114('0xa6')][_0x5114('0x1e1')]=function(_0x1a6118){var _0x20097a=this;return function(_0x4282a4){return new BPromise(function(_0x419725,_0x427ff2){_[_0x5114('0xcc')](_0x1a6118,_0x4282a4[0x0]);if(checkGetDataPredictive(_0x4282a4[0x0])){loggerPredictive['info'](JSON[_0x5114('0x4a')](_0x4282a4[0x0]));if(_0x1a6118[_0x5114('0x1d2')]===_0x5114('0x1d3')){return _0x20097a['getVoiceQueueRtPauses'](_0x1a6118['id'])['then'](function(_0xb717e2){var _0x5402ff=_0x1a6118[_0x5114('0x155')]-_0xb717e2[0x0][_0x5114('0x1e2')];var _0xced6d5=_0x1a6118[_0x5114('0x1cf')]*0x3c;var _0x9f306a=_0x4282a4[0x0][_0x5114('0x82')]+_0x4282a4[0x0][_0x5114('0x69')];var _0x23fff3=(_0x4282a4[0x0][_0x5114('0x68')]+_0x4282a4[0x0][_0x5114('0x6b')]+_0x4282a4[0x0][_0x5114('0x6a')])/_0x4282a4[0x0][_0x5114('0x84')];var _0x4220ee=_0x1a6118[_0x5114('0x1dd')]/0x64;_0x1a6118[_0x5114('0x6f')]=_0xb717e2[0x0][_0x5114('0x1e2')]||0x0;_0x1a6118[_0x5114('0x6d')]=_0x23fff3>0x0?_0x23fff3:0x1;return _0x20097a[_0x5114('0x1de')](_0x5402ff,_0xced6d5,_0x9f306a,_0x23fff3,_0x4220ee);})[_0x5114('0xb5')](function(_0x5dee14){return _0x419725(_0x5dee14);})[_0x5114('0xaf')](function(_0x94e3e4){return _0x427ff2(msgResponse('[CatchErlangB]',_0x5114('0x13e'),JSON[_0x5114('0x4a')](_0x94e3e4)));});}if(_0x1a6118[_0x5114('0x1d2')]==='agentBusyFactor'){return _0x20097a['getVoiceQueueRtPauses'](_0x1a6118['id'])[_0x5114('0xb5')](function(_0x52b83f){var _0x32d16e=_0x1a6118['loggedIn']-_0x52b83f[0x0][_0x5114('0x1e2')];var _0x4e8927=_0x1a6118[_0x5114('0x1cf')]*0x3c;var _0x2f058a=_0x4282a4[0x0][_0x5114('0x82')]+_0x4282a4[0x0]['predictiveIntervalAvgHoldtime'];var _0x50507d=(_0x4282a4[0x0]['predictiveIntervalAnsweredCalls']+_0x4282a4[0x0][_0x5114('0x6b')]+_0x4282a4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4282a4[0x0][_0x5114('0x84')];var _0x1de0b4=_0x1a6118[_0x5114('0x1dd')]/0x64;_0x1a6118[_0x5114('0x6f')]=_0x52b83f[0x0][_0x5114('0x1e2')]||0x0;_0x1a6118[_0x5114('0x6d')]=_0x50507d>0x0?_0x50507d:0x1;return _0x20097a[_0x5114('0x1df')](_0x32d16e,_0x4e8927,_0x2f058a,_0x50507d,_0x1de0b4);})[_0x5114('0xb5')](function(_0xb14abf){return _0x419725(_0xb14abf);})[_0x5114('0xaf')](function(_0x211f96){return _0x427ff2(msgResponse(_0x5114('0x1e3'),'Failure',JSON[_0x5114('0x4a')](_0x211f96)));});}}else{return _0x427ff2(msgResponse(_0x5114('0x1e4'),_0x5114('0x13e'),_0x5114('0x1e5')));}});};};Dialer[_0x5114('0xa6')]['startMethodPredictive']=function(_0x3ee94){var _0x5ddbed=this;return function(){var _0x3b3c80=0x0;var _0x2fcd72=Math[_0x5114('0x1c9')](_0x3ee94[_0x5114('0x72')]*0x3e8);if(_0x2fcd72>0x0){_0x2fcd72=_0x2fcd72<0x64?0x64:_0x2fcd72;loggerPredictive[_0x5114('0x7d')](_0x3ee94['name'],_0x5114('0x1e6'),_0x2fcd72,_0x5114('0x4b'));_0x3ee94['handlePredictive']=setInterval(function(){_0x5ddbed['handlePredictive'](_0x3ee94);loggerPredictiveCalls[_0x5114('0x7d')](_0x5114('0x1e7'),_0x3b3c80+=0x1);},_0x2fcd72);}else{loggerPredictive['info'](_0x3ee94[_0x5114('0x3f')],_0x5114('0x1e8'));}};};Dialer['prototype']['checkContactBlack']=function(_0x3bc8e9,_0x57e89c){var _0x496968=this;return function(_0x1dbc09){if(_[_0x5114('0x47')](_0x1dbc09)){if(_[_0x5114('0xac')](_0x57e89c[_0x5114('0xcf')])||!_0x57e89c[_0x5114('0x1e9')]){if(_0x3bc8e9[_0x5114('0x59')]===_0x5114('0x7')){_0x3bc8e9[_0x5114('0x127')]=_[_0x5114('0x3c')](_0x3bc8e9['queueStatusComplete'])?!![]:_0x3bc8e9['queueStatusComplete'];var _0x2f1ffd=uuid['v4']();_0x496968[_0x5114('0x21')][_0x2f1ffd]=new Action(_0x3bc8e9,_0x57e89c,_0x2f1ffd);loggerBooked[_0x5114('0x7d')]('[booked][checkContactBlack]',_0x2f1ffd,_0x5114('0x1ea'),JSON['stringify'](_0x3bc8e9['queueStatusComplete']),_0x5114('0x1eb'),_0x3bc8e9[_0x5114('0x3f')]);if(_0x3bc8e9[_0x5114('0x127')]){_0x3bc8e9[_0x5114('0x127')]=![];_0x496968[_0x5114('0x27')][_0x496968[_0x5114('0x21')][_0x2f1ffd]['queue']]=[];ami[_0x5114('0xad')]({'actionid':_0x2f1ffd,'action':_0x5114('0x1ec'),'queue':_0x3bc8e9[_0x5114('0x3f')]})[_0x5114('0xaf')](function(){_0x496968[_0x5114('0xb0')](_0x3bc8e9);_0x496968[_0x5114('0xbc')]({'active':![],'ContactId':_0x496968[_0x5114('0x21')][_0x2f1ffd][_0x5114('0xce')],'ListId':_0x496968[_0x5114('0x21')][_0x2f1ffd]['ListId'],'VoiceQueueId':_0x496968[_0x5114('0x21')][_0x2f1ffd][_0x5114('0xd0')]||undefined,'CampaignId':_0x496968['actions'][_0x2f1ffd][_0x5114('0xd1')]||undefined})[_0x5114('0xaf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x496968['actions'][_0x2f1ffd];});}else{loggerBooked['info'](_0x5114('0x1ed'),JSON[_0x5114('0x4a')](_0x3bc8e9[_0x5114('0x127')]),_0x5114('0x1eb'),_0x3bc8e9[_0x5114('0x3f')]);_0x496968[_0x5114('0xb0')](_0x3bc8e9);_0x496968[_0x5114('0xbc')]({'active':![],'ContactId':_0x496968['actions'][_0x2f1ffd][_0x5114('0xce')],'ListId':_0x496968[_0x5114('0x21')][_0x2f1ffd][_0x5114('0x114')],'VoiceQueueId':_0x496968[_0x5114('0x21')][_0x2f1ffd][_0x5114('0xd0')]||undefined,'CampaignId':_0x496968[_0x5114('0x21')][_0x2f1ffd][_0x5114('0xd1')]||undefined})['catch'](loggerCatch(_0x5114('0x1ee')));delete _0x496968[_0x5114('0x21')][_0x2f1ffd];}}else{return _0x496968['actionOriginate'](_0x3bc8e9,_0x57e89c);}}else{if(getDiff(_0x57e89c[_0x5114('0x1ef')])<_0x3bc8e9['dialRecallMeTimeout']*0x3c){if(_0x57e89c[_0x5114('0x1f0')]&&!_0x57e89c['Agent'][_0x5114('0x1f1')]){_0x496968[_0x5114('0x1a')]['run'](_0x57e89c['id'])[_0x5114('0x18')](function(){_0x496968['updateOriginated'](_0x3bc8e9);});}else{_0x496968[_0x5114('0xbe')]({'active':![]},_0x57e89c['id'],0x1)[_0x5114('0x18')](function(){_0x496968[_0x5114('0xb0')](_0x3bc8e9);});}}else{_0x3bc8e9['outboundReCallsDay']+=0x1;_0x496968['updateOriginated'](_0x3bc8e9);if(_0x3bc8e9[_0x5114('0x1f2')]){_0x496968[_0x5114('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x57e89c[_0x5114('0xce')],'ListId':_0x57e89c[_0x5114('0x114')],'VoiceQueueId':_0x57e89c['VoiceQueueId']||undefined,'CampaignId':_0x57e89c['CampaignId']||undefined})['catch'](loggerCatch(_0x5114('0x1f3')));_0x496968[_0x5114('0xc6')](createObjHistory(_0x3bc8e9,_0x57e89c,'RECALLINQUEUE',0x17,_0x5114('0x1f4')))['catch'](loggerCatch(_0x5114('0x1f5')));}else{_0x496968[_0x5114('0xcb')](createObjHistory(_0x3bc8e9,_0x57e89c,_0x5114('0x1f6'),0x16,_0x5114('0x1f7')),_0x5114('0x1f8'),'[Originate][HistoryRecallClose]');}}}}else{_0x3bc8e9[_0x5114('0x5d')]+=0x1;_0x496968[_0x5114('0xcb')](createObjHistory(_0x3bc8e9,_0x57e89c,_0x5114('0x1f9'),0xd,_0x5114('0x1fa')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x5114('0x1fb');}};};Dialer[_0x5114('0xa6')][_0x5114('0x154')]=function(_0x3bbe2c){var _0x2d3154=this;var _0x3e0ef2=_0x3bbe2c['limitCalls']-_0x3bbe2c[_0x5114('0x70')]-_0x3bbe2c['temp'];emitCampaignSummary(_0x3bbe2c);if(_0x3e0ef2>0x0){if(_0x3e0ef2>this['maxNumberOriginate']){_0x3e0ef2=this['maxNumberOriginate'];}_0x3bbe2c[_0x5114('0x1fc')]+=_0x3e0ef2;this[_0x5114('0xc2')](_0x3bbe2c['id'],_0x3e0ef2,_0x3bbe2c['dialOrderByScheduledAt'])[_0x5114('0xb5')](function(_0x3f3b28){_0x3bbe2c[_0x5114('0x1fc')]-=_0x3e0ef2;_0x3bbe2c[_0x5114('0x1fc')]=_0x3bbe2c[_0x5114('0x1fc')]>0x0?_0x3bbe2c[_0x5114('0x1fc')]:0x0;if(!checkContactEmpty(_0x3f3b28)){_0x3bbe2c[_0x5114('0x3d')]=_0x5114('0x9a');logger['info'](_0x5114('0x1fd')+_0x3bbe2c[_0x5114('0x3f')]);}else{_0x3bbe2c[_0x5114('0x70')]+=_0x3f3b28[_0x5114('0x12d')];_0x3bbe2c[_0x5114('0x3d')]=_0x5114('0x1fe');for(var _0xb52e2b=0x0;_0xb52e2b<_0x3f3b28[_0x5114('0x12d')];_0xb52e2b+=0x1){_0x3bbe2c[_0x5114('0x1ff')]+=0x1;if(_['isNil'](_0x3f3b28[_0xb52e2b])||_['isNil'](_0x3f3b28[_0xb52e2b][_0x5114('0x162')])||_[_0x5114('0xac')](_0x3f3b28[_0xb52e2b][_0x5114('0x162')][_0x5114('0x163')])){_0x2d3154[_0x5114('0x200')](_0x5114('0x201'),_0x3bbe2c,_0x3f3b28[_0xb52e2b]);}else{_0x2d3154[_0x5114('0xb9')](_[_0x5114('0xcd')](_0x3f3b28[_0xb52e2b],['CampaignId',_0x5114('0x202')]))[_0x5114('0xb5')](_0x2d3154['checkContactBlack'](_0x3bbe2c,_0x3f3b28[_0xb52e2b]))[_0x5114('0xaf')](_0x2d3154[_0x5114('0xc9')]('[actionOriginateIvr]\x20',_0x3bbe2c));}}}})[_0x5114('0xaf')](loggerGetContactDialer(_0x5114('0x203'),_0x3bbe2c,_0x3e0ef2));}};Dialer['prototype'][_0x5114('0x150')]=function(_0xe07843,_0x4c6d23){var _0x5eddb1=this;var _0x34aaa4=[];var _0x31adf3=_0x4c6d23>=0x1?_0x4c6d23:0x1;if(_0xe07843['dialMethod']==='booked'){_0x31adf3=0x1;}var _0x2191a4=Math[_0x5114('0x1c9')](_0xe07843['available']*_0x31adf3)-_0xe07843[_0x5114('0x70')]-_0xe07843[_0x5114('0x1fc')];emitVoiceQueueSummary(_0xe07843);if(_0xe07843['dialLimitQueue']>0x0){var _0x3acd1f=_0xe07843[_0x5114('0x204')]-_0xe07843[_0x5114('0x70')]-_0xe07843[_0x5114('0x9d')]-_0xe07843[_0x5114('0x1fc')]-_0xe07843[_0x5114('0x9e')];if(_0x2191a4>_0x3acd1f){_0x2191a4=_0x3acd1f;}}if(_0x2191a4>0x0){if(_0xe07843['dialMethod']===_0x5114('0x7')){_0x2191a4=0x1;}if(_0x2191a4>this[_0x5114('0x1f')]){_0x2191a4=this[_0x5114('0x1f')];}_0xe07843[_0x5114('0x1fc')]+=_0x2191a4;for(var _0x3436e8 in this['agents']){if(typeof this[_0x5114('0x1d')][_0x3436e8]!=='undefined'){if(this['agents'][_0x3436e8][_0x5114('0xa3')]==='not_inuse'&&this[_0x5114('0x1d')][_0x3436e8][_0x5114('0x120')]==='reachable'){_0x34aaa4[_0x5114('0x124')](this[_0x5114('0x1d')][_0x3436e8]['id']);}}}this[_0x5114('0xc0')](_0xe07843['id'],_0x34aaa4,_0x2191a4,_0xe07843[_0x5114('0x205')])['then'](function(_0x5edda0){_0xe07843[_0x5114('0x1fc')]-=_0x2191a4;_0xe07843[_0x5114('0x1fc')]=_0xe07843[_0x5114('0x1fc')]>0x0?_0xe07843[_0x5114('0x1fc')]:0x0;if(!checkContactEmpty(_0x5edda0)){_0x5eddb1[_0x5114('0xb3')](_0xe07843)[_0x5114('0xb5')](sendMessageReschedule(_0xe07843))[_0x5114('0xaf')](loggerCatch(_0x5114('0xb6')));}else{_0xe07843['originated']+=_0x5edda0[_0x5114('0x12d')];_0xe07843[_0x5114('0x3d')]=_0xe07843['dialMethod']===_0x5114('0x7')?_0x5114('0x16b'):_0x5114('0x1fe');for(var _0x8e3298=0x0;_0x8e3298<_0x5edda0[_0x5114('0x12d')];_0x8e3298+=0x1){if(_[_0x5114('0xac')](_0x5edda0[_0x8e3298])||_[_0x5114('0xac')](_0x5edda0[_0x8e3298]['Contact'])||_[_0x5114('0xac')](_0x5edda0[_0x8e3298][_0x5114('0x162')][_0x5114('0x163')])){_0x5eddb1[_0x5114('0x200')](_0x5114('0x201'),_0xe07843,_0x5edda0[_0x8e3298]);}else{_0x5eddb1[_0x5114('0xb7')](_['pick'](_0x5edda0[_0x8e3298],[_0x5114('0xd0'),_0x5114('0x202')]))[_0x5114('0xb5')](_0x5eddb1[_0x5114('0x206')](_0xe07843,_0x5edda0[_0x8e3298]))['catch'](_0x5eddb1[_0x5114('0xc9')](_0x5114('0x201'),_0xe07843));}}}})[_0x5114('0xaf')](loggerGetContactDialer(_0x5114('0x207'),_0xe07843,_0x2191a4));}};Dialer[_0x5114('0xa6')]['handlePredictive']=function(_0x1e3a56){if(_0x1e3a56['dialLimitQueue']>0x0){var _0x132d75=_0x1e3a56[_0x5114('0x204')]-_0x1e3a56['originated']-_0x1e3a56[_0x5114('0x9d')];if(_0x132d75>0x0){this['tryOriginatePredictive'](_0x1e3a56);}else{loggerPredictiveCalls[_0x5114('0x7d')](_0x5114('0x208'));}}else{this[_0x5114('0x209')](_0x1e3a56);}};Dialer[_0x5114('0xa6')]['tryOriginatePredictive']=function(_0x3d519f){var _0x40c143=this;var _0x24900c=[];_0x3d519f[_0x5114('0x70')]+=0x1;for(var _0x1f6bcc in this[_0x5114('0x1d')]){if(typeof this[_0x5114('0x1d')][_0x1f6bcc]!==_0x5114('0xab')){if(this[_0x5114('0x1d')][_0x1f6bcc][_0x5114('0xa3')]===_0x5114('0x20a')&&this['agents'][_0x1f6bcc][_0x5114('0x120')]===_0x5114('0xd7')){_0x24900c[_0x5114('0x124')](this[_0x5114('0x1d')][_0x1f6bcc]['id']);}}}this[_0x5114('0xc0')](_0x3d519f['id'],_0x24900c,0x1,_0x3d519f[_0x5114('0x205')])['then'](function(_0x17d22b){if(!checkContactEmpty(_0x17d22b)){checkContactLowerLimitOriginate(_0x3d519f,0x1,0x0);_0x40c143[_0x5114('0xb3')](_0x3d519f)[_0x5114('0xb5')](sendMessageReschedule(_0x3d519f))[_0x5114('0xaf')](loggerCatch(_0x5114('0xb6')));}else{_0x3d519f[_0x5114('0x3d')]=_0x5114('0x1fe');if(_['isNil'](_0x17d22b[0x0])||_[_0x5114('0xac')](_0x17d22b[0x0]['Contact'])||_[_0x5114('0xac')](_0x17d22b[0x0][_0x5114('0x162')][_0x5114('0x163')])){_0x40c143[_0x5114('0x200')](_0x5114('0x201'),_0x3d519f,_0x17d22b[0x0]);}else{_0x40c143['checkIsBlackList'](_['pick'](_0x17d22b[0x0],['VoiceQueueId','Contact.phone']))[_0x5114('0xb5')](_0x40c143[_0x5114('0x206')](_0x3d519f,_0x17d22b[0x0]))['catch'](_0x40c143['loggerHandler'](_0x5114('0x20b'),_0x3d519f));}}})[_0x5114('0xaf')](loggerGetContactDialer(_0x5114('0x20c'),_0x3d519f,0x1));emitVoiceQueueSummary(_0x3d519f);};Dialer[_0x5114('0xa6')][_0x5114('0x1de')]=function(_0x1b70ac,_0x4738b3,_0x9145a7,_0x589ad6,_0x1b89ef,_0x733b1a){loggerPredictive['info'](_0x5114('0x20d'));loggerPredictive['info'](_0x5114('0x20e'),_0x1b70ac);loggerPredictive[_0x5114('0x7d')](_0x5114('0x20f'),_0x4738b3);loggerPredictive[_0x5114('0x7d')](_0x5114('0x210'),_0x9145a7);loggerPredictive[_0x5114('0x7d')]('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',_0x589ad6);loggerPredictive['info'](_0x5114('0x211'),_0x1b89ef);loggerPredictive[_0x5114('0x7d')](_0x5114('0x83'));return new BPromise(function(_0x390041,_0x2147c8){if(_0x1b70ac<=0x0||isNaN(_0x1b70ac)){return _0x2147c8(msgResponse(_0x5114('0x212'),_0x5114('0x49'),_0x5114('0x213')+_0x1b70ac));}if(_0x9145a7<=0x0||isNaN(_0x9145a7)){return _0x2147c8(msgResponse(_0x5114('0x212'),'Error',_0x5114('0x214')+_0x9145a7));}if(_0x589ad6<=0x0||isNaN(_0x589ad6)){return _0x2147c8(msgResponse('[abandonmentRate]',_0x5114('0x49'),_0x5114('0x215')+_0x589ad6));}if(_0x4738b3<=0x0||isNaN(_0x4738b3)){return _0x2147c8(msgResponse(_0x5114('0x212'),_0x5114('0x49'),'interval\x20=\x20'+_0x4738b3));}if(_0x1b89ef<=0x0||isNaN(_0x1b89ef)){return _0x2147c8(msgResponse(_0x5114('0x212'),_0x5114('0x49'),_0x5114('0x216')+_0x1b89ef));}_0x733b1a=_0x733b1a||0x0;var _0x1befba=0x1/_0x9145a7;var _0x40ca66=0x0;var _0x4600eb=0x0;var _0x289542=0x0;var _0x4c801c=0x0;for(var _0x15ecca=0x0;_0x289542<_0x1b89ef;_0x15ecca+=0x1){_0x4600eb=_0x15ecca/_0x4738b3;_0x40ca66=(_0x589ad6*_0x4600eb+_0x733b1a)/_0x1befba;_0x289542=erlangb(_0x40ca66,_0x1b70ac);_0x4c801c=_0x40ca66/_0x1b70ac*(0x1-erlangb(_0x40ca66,_0x1b70ac));}return _0x390041({'erlangCalls':_0x15ecca,'erlangCallToSecond':_0x4738b3/_0x15ecca,'erlangAbandonmentRate':_0x289542,'erlangBusyFactor':_0x4c801c});});};Dialer[_0x5114('0xa6')][_0x5114('0x1df')]=function(_0xc4c191,_0x344a8c,_0x42751d,_0x1b1b05,_0x3616a3,_0x59dd81){loggerPredictive[_0x5114('0x7d')](_0x5114('0x217'));loggerPredictive['info'](_0x5114('0x20e'),_0xc4c191);loggerPredictive['info'](_0x5114('0x20f'),_0x344a8c);loggerPredictive['info'](_0x5114('0x210'),_0x42751d);loggerPredictive[_0x5114('0x7d')](_0x5114('0x218'),_0x1b1b05);loggerPredictive[_0x5114('0x7d')](_0x5114('0x219'),_0x3616a3);loggerPredictive[_0x5114('0x7d')](_0x5114('0x83'));return new BPromise(function(_0x5a7735,_0x574f0a){if(_0xc4c191<=0x0||isNaN(_0xc4c191)){return _0x574f0a(msgResponse(_0x5114('0x21a'),_0x5114('0x49'),'m\x20=\x20'+_0xc4c191));}if(_0x42751d<=0x0||isNaN(_0x42751d)){return _0x574f0a(msgResponse(_0x5114('0x21a'),_0x5114('0x49'),_0x5114('0x214')+_0x42751d));}if(_0x1b1b05<=0x0||isNaN(_0x1b1b05)){return _0x574f0a(msgResponse('[busyFactor]',_0x5114('0x49'),_0x5114('0x215')+_0x1b1b05));}if(_0x344a8c<=0x0||isNaN(_0x344a8c)){return _0x574f0a(msgResponse(_0x5114('0x21a'),_0x5114('0x49'),_0x5114('0x21b')+_0x344a8c));}if(_0x3616a3<=0x0||isNaN(_0x3616a3)){return _0x574f0a(msgResponse(_0x5114('0x21a'),_0x5114('0x49'),'Umin\x20=\x20'+_0x3616a3));}_0x59dd81=_0x59dd81||0x0;var _0x17a176=0x1/_0x42751d;var _0x2574f5=0x0;var _0x194d46=0x0;var _0x3d5071=0x0;var _0x3a783d=0x0;for(var _0x3c343d=0x0;_0x3a783d<_0x3616a3;_0x3c343d+=0x1){_0x194d46=_0x3c343d/_0x344a8c;_0x2574f5=(_0x1b1b05*_0x194d46+_0x59dd81)/_0x17a176;_0x3d5071=erlangb(_0x2574f5,_0xc4c191);_0x3a783d=_0x2574f5/_0xc4c191*(0x1-erlangb(_0x2574f5,_0xc4c191));}return _0x5a7735({'erlangCalls':_0x3c343d,'erlangCallToSecond':_0x344a8c/_0x3c343d,'erlangAbandonmentRate':_0x3d5071,'erlangBusyFactor':_0x3a783d});});};module[_0x5114('0x21c')]=Dialer; \ No newline at end of file +var _0x5762=['[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','[syncAgentComplete][createHistory][0]','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','Abandoned','dialAbandonedMaxRetry','reason\x2011\x20abandoned','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','startMethodPredictive','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','tryOriginatePredictive','[countReScheduled]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','----\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]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','message','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','actions','[actions]','undefined','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','status','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','state','AMD','saveInDb','[syncHangupInAMD]','MACHINE','Machine','membername','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','ListId','CampaignId','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','value','add','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','paused','stateinterface','locked','push','pick','idHopper','queueStatusComplete','preview','run','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','true','Action','timezones','content','indexOf','all','some'];(function(_0x24c523,_0x2fcf50){var _0x884c17=function(_0x5381ed){while(--_0x5381ed){_0x24c523['push'](_0x24c523['shift']());}};_0x884c17(++_0x2fcf50);}(_0x5762,0xc2));var _0x2576=function(_0x54f56c,_0x5ca2a6){_0x54f56c=_0x54f56c-0x0;var _0x3efaec=_0x5762[_0x54f56c];return _0x3efaec;};'use strict';var util=require(_0x2576('0x0'));var _=require(_0x2576('0x1'));var BPromise=require(_0x2576('0x2'));var uuid=require(_0x2576('0x3'));var moment=require(_0x2576('0x4'));var rr=require('rr');var md5=require(_0x2576('0x5'));var Redis=require('ioredis');var ut=require(_0x2576('0x6'));var config=require(_0x2576('0x7'));var logger=require(_0x2576('0x8'))(_0x2576('0x9'));var loggerBooked=require(_0x2576('0x8'))(_0x2576('0xa'));var loggerPredictive=require(_0x2576('0x8'))(_0x2576('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x2576('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x2576('0xd'));var ami=require(_0x2576('0xe'));config['redis']=_['defaults'](config[_0x2576('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0x2576('0x10'))(new Redis(config[_0x2576('0xf')]));var cmHopper=require(_0x2576('0x11'));var cmHopperHistory=require(_0x2576('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2576('0x13'));var Action=require(_0x2576('0x14'));var History=require(_0x2576('0x15'));var Final=require(_0x2576('0x16'));var AgentComplete=require(_0x2576('0x17'));var QueueCallerAbandon=require(_0x2576('0x18'));var Hangup=require(_0x2576('0x19'));var ipAgi=process['env'][_0x2576('0x1a')]||'127.0.0.1';var strategy={'rrmemory':_0x2576('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2576('0x1c')][_0x2576('0x1d')]=function(_0x854ec0){this[_0x2576('0x1e')]=this[_0x2576('0x1e')]?this[_0x2576('0x1e')][_0x2576('0x1f')](_0x854ec0):_0x854ec0();};function Dialer(_0x50a148,_0x5b4afe){this[_0x2576('0x20')]=new Sequence();this['preview']=_0x5b4afe;this[_0x2576('0x21')]=_0x50a148[_0x2576('0x21')];this[_0x2576('0x22')]=_0x50a148[_0x2576('0x22')];this[_0x2576('0x23')]=_0x50a148[_0x2576('0x23')];this[_0x2576('0x24')]=_0x50a148[_0x2576('0x24')];this['maxNumberOriginate']=config[_0x2576('0x25')]||0x2;this[_0x2576('0x26')]={};this['actions']={};this['contactsId']={};this[_0x2576('0x27')]={};this[_0x2576('0x28')]={};this[_0x2576('0x29')]={};this[_0x2576('0x2a')]={};this[_0x2576('0x2b')]={};this[_0x2576('0x2c')]={};this[_0x2576('0x2d')]={};ami['on'](_0x2576('0x2e'),this[_0x2576('0x2f')]['bind'](this));ami['on']('queuecallerabandon',this[_0x2576('0x30')][_0x2576('0x31')](this));ami['on'](_0x2576('0x32'),this[_0x2576('0x33')][_0x2576('0x31')](this));ami['on']('agentcomplete',this[_0x2576('0x34')][_0x2576('0x31')](this));ami['on'](_0x2576('0x35'),this[_0x2576('0xd')]['bind'](this));ami['on'](_0x2576('0x36'),this['syncHangup'][_0x2576('0x31')](this));ami['on']('newexten',this[_0x2576('0x37')]['bind'](this));ami['on'](_0x2576('0x38'),this[_0x2576('0x39')][_0x2576('0x31')](this));ami['on'](_0x2576('0x3a'),this[_0x2576('0x3b')][_0x2576('0x31')](this));ami['on'](_0x2576('0x3c'),this[_0x2576('0x3d')][_0x2576('0x31')](this));this[_0x2576('0x3e')]();this[_0x2576('0x3f')]();}function isNotNull(_0x1192d1){return _0x1192d1!==null&&!_[_0x2576('0x40')](_0x1192d1);}function checkIsLoggedIn(_0x5c5b56,_0x453711){return function(){if(_0x453711<=0x0){_0x5c5b56['message']=_0x2576('0x41');throw _0x5c5b56[_0x2576('0x42')]+_0x2576('0x43');}};}function isActive(_0x365821){return _0x365821;}function checkIsActive(_0x4f7a2e,_0x270174){return function(){if(!isActive(_0x270174)){_0x4f7a2e['message']=_0x2576('0x44');throw _0x4f7a2e[_0x2576('0x42')]+_0x2576('0x45');}};}function checkInterval(_0x33c33e){return function(){if(!isNotNull(_0x33c33e[_0x2576('0x46')])){_0x33c33e['message']=_0x2576('0x47');throw _0x33c33e[_0x2576('0x42')]+_0x2576('0x48');}if(!isNotNull(_0x33c33e['Interval'][_0x2576('0x49')])){_0x33c33e['message']=_0x2576('0x47');throw _0x33c33e['name']+_0x2576('0x48');}if(!isNotNull(_[_0x2576('0x4a')](_0x33c33e['Interval'][_0x2576('0x49')]))){_0x33c33e[_0x2576('0x4b')]=_0x2576('0x47');throw _0x33c33e['name']+_0x2576('0x48');}};}function msgResponse(_0xd7f83e,_0x381af9,_0x48d54b){return{'action':_0xd7f83e,'response':_0x381af9,'message':_0x48d54b,'stack':_0x48d54b};}function myreject(_0x336fad){return function(_0x37535d){return _0x336fad(msgResponse(_0x2576('0x4c'),_0x2576('0x4d'),JSON[_0x2576('0x4e')](_0x37535d)));};}function getSeconds(_0x225bec,_0x5be03a){var _0x287202=moment(_0x225bec)[_0x2576('0x4f')](0x0);var _0x5ba68f=moment(_0x5be03a)['milliseconds'](0x0);return _0x287202[_0x2576('0x50')](_0x5ba68f,_0x2576('0x51'));}function emit(_0x26b694,_0x55c783,_0x4ccf38){io['to'](_0x26b694)[_0x2576('0x52')](_0x55c783,_0x4ccf38);}function emitVoiceQueueSummary(_0x457483){if(_0x457483[_0x2576('0x53')]===_0x2576('0x54')){var _0xe4162b={'id':_0x457483['id'],'name':_0x457483[_0x2576('0x42')],'strategy':_0x457483[_0x2576('0x55')],'answered':_0x457483[_0x2576('0x56')],'available':_0x457483['available'],'loggedIn':_0x457483[_0x2576('0x57')],'pTalking':_0x457483[_0x2576('0x58')],'sumBillable':_0x457483[_0x2576('0x59')],'sumDuration':_0x457483[_0x2576('0x5a')],'sumHoldTime':_0x457483[_0x2576('0x5b')]||0x0,'talking':_0x457483['talking'],'total':_0x457483[_0x2576('0x5c')],'type':_0x457483[_0x2576('0x53')],'unmanaged':_0x457483[_0x2576('0x5d')],'abandoned':_0x457483[_0x2576('0x5e')],'waiting':_0x457483[_0x2576('0x5f')],'loggedInDb':_0x457483[_0x2576('0x60')],'dialActive':_0x457483[_0x2576('0x61')],'dialMethod':_0x457483[_0x2576('0x62')],'dialOriginateCallerIdName':_0x457483['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x457483[_0x2576('0x63')],'dialOriginateTimeout':_0x457483[_0x2576('0x64')],'dialPrefix':_0x457483['dialPrefix'],'outboundAnswerAgiCallsDay':_0x457483[_0x2576('0x65')],'outboundAnswerCallsDay':_0x457483['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x457483[_0x2576('0x66')],'outboundBusyCallsDay':_0x457483[_0x2576('0x67')],'outboundCongestionCallsDay':_0x457483['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x457483['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x457483['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x457483[_0x2576('0x68')],'outboundNoAnswerCallsDay':_0x457483[_0x2576('0x69')],'outboundNoSuchCallsDay':_0x457483[_0x2576('0x6a')],'outboundOriginateFailureCallsDay':_0x457483[_0x2576('0x6b')],'outboundReCallsDay':_0x457483['outboundReCallsDay'],'outboundRejectCallsDay':_0x457483[_0x2576('0x6c')],'outboundUnknownCallsDay':_0x457483[_0x2576('0x6d')],'predictiveIntervalAnsweredCalls':_0x457483[_0x2576('0x6e')],'predictiveIntervalAvgHoldtime':_0x457483['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x457483[_0x2576('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x457483[_0x2576('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x457483[_0x2576('0x71')],'predictiveIntervalErlangCalls':_0x457483[_0x2576('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x457483[_0x2576('0x73')],'predictiveIntervalHitRate':_0x457483[_0x2576('0x74')],'predictiveIntervalMultiplicativeFactor':_0x457483[_0x2576('0x75')],'predictiveIntervalPauses':_0x457483[_0x2576('0x76')],'predictiveIntervalAvailable':_0x457483['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x457483[_0x2576('0x77')],'message':_0x457483['message'],'originated':_0x457483[_0x2576('0x78')],'erlangCalls':_0x457483[_0x2576('0x79')],'erlangCallToSecond':_0x457483[_0x2576('0x7a')],'erlangAbandonmentRate':_0x457483['erlangAbandonmentRate'],'erlangBusyFactor':_0x457483[_0x2576('0x7b')],'startPredictive':_0x457483[_0x2576('0x29')],'startProgressive':_0x457483['startProgressive']};if(_0x457483[_0x2576('0x7c')]){_0xe4162b['Trunk']={'id':_0x457483[_0x2576('0x7c')]['id'],'name':_0x457483[_0x2576('0x7c')]['name'],'active':_0x457483['Trunk'][_0x2576('0x7d')],'callerid':_0x457483[_0x2576('0x7c')][_0x2576('0x7e')]};}if(_0x457483['Interval']){_0xe4162b['Interval']={'id':_0x457483['Interval']['id'],'name':_0x457483[_0x2576('0x46')][_0x2576('0x42')]};}var _0x34a0d4=md5(JSON[_0x2576('0x4e')](_0xe4162b));if(_0x457483[_0x2576('0x5')]!==_0x34a0d4){_0x457483['md5']=_0x34a0d4;emit(util[_0x2576('0x7f')](_0x2576('0x80'),_0xe4162b[_0x2576('0x42')]),_0x2576('0x81'),_0xe4162b);}}}function emitCampaignSummary(_0x4c15b3){if(_0x4c15b3['type']===_0x2576('0x82')){emit(util[_0x2576('0x7f')](_0x2576('0x83'),_0x4c15b3['name']),_0x2576('0x84'),_0x4c15b3);}}function checkGetDataPredictive(_0x25303d){if(isNotNull(_0x25303d)&&!_['isEmpty'](_0x25303d)){loggerPredictive['info'](_0x2576('0x85'));loggerPredictive['info'](_0x2576('0x86'),_0x25303d['predictiveIntervalTotalCalls']);loggerPredictive[_0x2576('0x87')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25303d['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25303d[_0x2576('0x71')]);loggerPredictive[_0x2576('0x87')](_0x2576('0x88'),_0x25303d[_0x2576('0x70')]);loggerPredictive[_0x2576('0x87')](_0x2576('0x89'),_0x25303d[_0x2576('0x8a')]);loggerPredictive[_0x2576('0x87')](_0x2576('0x8b'),_0x25303d['predictiveIntervalAvgTalktime']);loggerPredictive[_0x2576('0x87')](_0x2576('0x8c'));if(_0x25303d[_0x2576('0x77')]>0x0){if(!_[_0x2576('0x40')](_0x25303d['predictiveIntervalAvgTalktime'])&&_0x25303d[_0x2576('0x6f')]>0x0){return!![];}loggerPredictive['info'](_0x2576('0x8d'));if(!_['isUndefined'](_0x25303d[_0x2576('0x8a')])&&_0x25303d['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x2576('0x8e'));}else{loggerPredictive[_0x2576('0x87')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2576('0x87')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x4c547a){return function(_0x59ae42){loggerPredictive['info'](_0x2576('0x8f'));loggerPredictive[_0x2576('0x87')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59ae42[_0x2576('0x79')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59ae42['erlangCallToSecond']);loggerPredictive[_0x2576('0x87')](_0x2576('0x90'),_0x59ae42[_0x2576('0x91')]);loggerPredictive[_0x2576('0x87')](_0x2576('0x92'),_0x59ae42[_0x2576('0x7b')]);loggerPredictive[_0x2576('0x87')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59ae42[_0x2576('0x91')]);loggerPredictive['info'](_0x2576('0x8c'));_[_0x2576('0x93')](_0x4c547a,_0x59ae42);};}function getDiff(_0x3cca9a){var _0x3e1dd3=moment()['milliseconds'](0x0);var _0x24f1db=moment(_0x3cca9a)['milliseconds'](0x0);return _0x3e1dd3[_0x2576('0x50')](_0x24f1db,_0x2576('0x51'));}function ifInterval(_0x7d7199,_0x4885f5){if(_[_0x2576('0x40')](_0x4885f5)){return![];}return getDiff(_0x4885f5)<_0x7d7199*0x3c;}function freeVariablesPredictive(_0xef501d){if(isNotNull(_0xef501d)){if(!_[_0x2576('0x40')](_0xef501d[_0x2576('0x2a')])){_0xef501d[_0x2576('0x2a')]=undefined;loggerPredictive[_0x2576('0x87')](_0xef501d[_0x2576('0x42')],_0x2576('0x94'));}if(!_[_0x2576('0x40')](_0xef501d[_0x2576('0x29')])){_0xef501d[_0x2576('0x29')]=undefined;loggerPredictive['info'](_0xef501d['name'],_0x2576('0x95'));}if(!_['isUndefined'](_0xef501d['handlePredictive'])){clearInterval(_0xef501d[_0x2576('0x96')]);_0xef501d['handlePredictive']=undefined;loggerPredictive['info'](_0xef501d[_0x2576('0x42')],_0x2576('0x97'));}}}function erlangb(_0x38d56e,_0x4ecf5f){if(_0x4ecf5f===0x0){return 0x0;}var _0x10b5db=0x1;for(var _0x416d29=0x1;_0x416d29<=_0x4ecf5f;_0x416d29+=0x1){_0x10b5db=0x1+_0x10b5db*_0x416d29/_0x38d56e;}return 0x1/_0x10b5db;}function isVoiceQueueOutbound(_0x428e6d){return _0x428e6d==='outbound';}function isNotPreview(_0x3f00fc){return _0x3f00fc!=='preview';}function isCampaignIvr(_0x2c87a6){return _0x2c87a6===_0x2576('0x82');}function getCallerId(_0xc25efb,_0x577185,_0x39a300){if(!_[_0x2576('0x40')](_0x39a300)&&typeof _0x39a300===_0x2576('0x98')&&!_[_0x2576('0x4a')](_0x39a300)){if(!_[_0x2576('0x40')](_0x577185)&&typeof _0x577185===_0x2576('0x98')&&!_['isEmpty'](_0x577185)){return util['format'](_0x2576('0x99'),_0x577185,_0x39a300);}return util['format'](_0x2576('0x99'),_0x39a300,_0x39a300);}if(!_[_0x2576('0x40')](_0xc25efb)&&typeof _0xc25efb===_0x2576('0x98')&&!_['isEmpty'](_0xc25efb)){return _0xc25efb;}return _0x2576('0x9a');}function loggerCatchQueueSummary(_0x536720,_0x408b86){return function(_0x194910){freeVariablesPredictive(_0x408b86);emitVoiceQueueSummary(_0x408b86);emitCampaignSummary(_0x408b86);loggerSyncQueueSummary[_0x2576('0x9b')](_0x536720,util['inspect'](_0x194910,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xedac32,_0x4d68d7){return function(_0x31eab9){loggerPredictive['error'](_0x4d68d7[_0x2576('0x42')],_0xedac32);loggerPredictive[_0x2576('0x9b')](_0x31eab9[_0x2576('0x9c')]);freeVariablesPredictive(_0x4d68d7);};}function loggerCatch(_0x4e8daf){return function(_0x17aee5){logger[_0x2576('0x9b')](_0x4e8daf,util[_0x2576('0x9d')](_0x17aee5,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x255548){return _0x255548&&!_[_0x2576('0x40')](_0x255548)&&_0x255548[_0x2576('0x9e')]>0x0;}function decremetOriginate(_0xb3ef69){if(!_[_0x2576('0x40')](_0xb3ef69)&&_0xb3ef69!==null){if(typeof _0xb3ef69[_0x2576('0x78')]!=='undefined'){if(_0xb3ef69[_0x2576('0x78')]>0x0){_0xb3ef69['originated']-=0x1;}else{logger['error'](_0x2576('0x9f'));}}}else{logger[_0x2576('0x9b')](_0x2576('0xa0'));}}function checkContactLowerLimitOriginate(_0x36e6e5,_0x421ce4,_0x304a22){if(_0x421ce4>_0x304a22){for(var _0x25f7a2=0x0;_0x25f7a2<_0x421ce4-_0x304a22;_0x25f7a2+=0x1){decremetOriginate(_0x36e6e5);}}}function loggerGetContactDialer(_0x208b71,_0x4bcc4b,_0x47dc65){return function(_0x21cacb){checkContactLowerLimitOriginate(_0x4bcc4b,_0x47dc65,0x0);logger[_0x2576('0x9b')](_0x208b71,util[_0x2576('0x9d')](_0x21cacb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x17c55a){return function(_0x4c527e){if(isNotNull(_0x4c527e)&&isNotNull(_0x4c527e[0x0])){if(_0x4c527e[0x0][_0x2576('0xa1')]>0x0){_0x17c55a[_0x2576('0x4b')]=_0x2576('0xa2');logger[_0x2576('0x87')](_0x2576('0xa3')+_0x17c55a[_0x2576('0x42')],_0x4c527e[0x0][_0x2576('0xa1')],_0x2576('0xa4'));}else{_0x17c55a[_0x2576('0x4b')]=_0x2576('0xa5');logger['info'](_0x2576('0xa6')+_0x17c55a['name']);}}};}function notSendMessagesQueue(_0x1884d5){if(_0x1884d5[_0x2576('0xa7')]){freeVariablesPredictive(_0x1884d5);if(_0x1884d5['originated']===0x0&&_0x1884d5[_0x2576('0xa8')]===0x0&&_0x1884d5['waiting']===0x0&&(_0x1884d5[_0x2576('0x58')]||0x0)===0x0){_0x1884d5[_0x2576('0xa7')]=![];_0x1884d5[_0x2576('0xa9')]=0x0;_0x1884d5[_0x2576('0x4b')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x2576('0x9b')](_0x2576('0xaa'),_0x1884d5[_0x2576('0x42')],_0x2576('0xab'));}else{_0x1884d5['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x2576('0x9b')](_0x2576('0xaa'),_0x1884d5['name'],_0x2576('0xac'));}emitVoiceQueueSummary(_0x1884d5);}}function notSendMessagesCampaign(_0x291fab){if(_0x291fab[_0x2576('0xa7')]){if(_0x291fab[_0x2576('0x78')]===0x0){_0x291fab[_0x2576('0xa7')]=![];_0x291fab[_0x2576('0x4b')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x2576('0x9b')](_0x2576('0xad'),_0x291fab[_0x2576('0x42')],_0x2576('0xab'));}else{_0x291fab[_0x2576('0x4b')]=_0x2576('0xae');loggerSyncQueueSummary[_0x2576('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x291fab[_0x2576('0x42')],_0x2576('0xac'));}emitCampaignSummary(_0x291fab);}}function createObjHistory(_0x3cb179,_0x2019ad,_0x8a44f1,_0x23dc40,_0x5cd2a3){_0x3cb179[_0x2576('0x4b')]=_0x8a44f1;var _0x2ad789=new Action(_0x3cb179,_0x2019ad);var _0x58eca1=new History(_0x2ad789);_0x58eca1['state']=_0x23dc40;_0x58eca1[_0x2576('0xaf')]=_0x5cd2a3;_0x58eca1[_0x2576('0xb0')]=_0x2ad789[_0x2576('0xb1')];return _0x58eca1;}Dialer[_0x2576('0x1c')][_0x2576('0x3f')]=function(){var _0x3f394d=this;setInterval(function(){_0x3f394d['clearZombieChannels'](_0x3f394d['uniqueId'],_0x2576('0xb2'));_0x3f394d[_0x2576('0xb3')](_0x3f394d[_0x2576('0xb4')],_0x2576('0xb5'));},0x32c8);};Dialer[_0x2576('0x1c')][_0x2576('0xb3')]=function(_0x25fb1b,_0x5f495c){var _0x5f2a4b=this;for(var _0x1cb1c4 in _0x25fb1b){if(typeof _0x25fb1b[_0x1cb1c4]!==_0x2576('0xb6')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x25fb1b[_0x1cb1c4])){return ami['Action']({'action':'status','channel':_0x25fb1b[_0x1cb1c4]['channel']})[_0x2576('0xb7')](function(_0x4a3ca3){if(_0x4a3ca3[_0x2576('0x4b')]===_0x2576('0xb8')){setTimeout(function(){if(_0x25fb1b[_0x1cb1c4]&&_0x25fb1b[_0x1cb1c4]['type']!==_0x2576('0x82')){_0x5f2a4b[_0x2576('0xb9')](_0x5f2a4b['voiceQueues'][_0x25fb1b[_0x1cb1c4][_0x2576('0xba')]]);logger[_0x2576('0x9b')](_0x2576('0xbb'),_0x5f495c,_0x1cb1c4,_0x25fb1b[_0x1cb1c4]['queue']);delete _0x25fb1b[_0x1cb1c4];}if(_0x25fb1b[_0x1cb1c4]&&_0x25fb1b[_0x1cb1c4][_0x2576('0x53')]==='ivr'){_0x5f2a4b[_0x2576('0xb9')](_0x5f2a4b[_0x2576('0x22')][_0x25fb1b[_0x1cb1c4][_0x2576('0xba')]]);logger['error'](_0x2576('0xbc'),_0x5f495c,_0x1cb1c4,_0x25fb1b[_0x1cb1c4][_0x2576('0xba')]);delete _0x25fb1b[_0x1cb1c4];}},0x2328);}});}});}}};Dialer['prototype'][_0x2576('0xbd')]=function(_0x491103){return BPromise['resolve']()[_0x2576('0xbe')](cmHopper[_0x2576('0xbd')](_0x491103))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x2576('0x1c')][_0x2576('0xbf')]=function(_0x40b9c1){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopperBlack['checkIsBlackList'](_0x40b9c1))[_0x2576('0xb7')](loggerCatch(_0x2576('0xc1')));};Dialer[_0x2576('0x1c')][_0x2576('0xc2')]=function(_0x35a4e7){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopperBlack[_0x2576('0xc2')](_0x35a4e7))['catch'](loggerCatch(_0x2576('0xc3')));};Dialer[_0x2576('0x1c')][_0x2576('0xc4')]=function(_0x1a16a8){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopperHistory[_0x2576('0xc5')](_0x1a16a8))[_0x2576('0xb7')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype']['rescheduleContact']=function(_0x38ab17){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopper[_0x2576('0xc6')](_0x38ab17))['catch'](loggerCatch(_0x2576('0xc7')));};Dialer['prototype']['unlockContact']=function(_0x1fbb85,_0x51e2ce,_0x536826){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopper[_0x2576('0xc8')](_0x1fbb85,_0x51e2ce,_0x536826))['catch'](loggerCatch(_0x2576('0xc9')));};Dialer[_0x2576('0x1c')][_0x2576('0xca')]=function(_0x20ee1a,_0x45d713,_0x1edd1f,_0x3d5967){return BPromise['resolve']()[_0x2576('0xbe')](cmHopper['getContactDialer'](_0x20ee1a,_0x45d713,_0x1edd1f,_0x3d5967))[_0x2576('0xb7')](loggerCatch(_0x2576('0xcb')));};Dialer[_0x2576('0x1c')][_0x2576('0xcc')]=function(_0x1f9b5b,_0x1a2ce9,_0x49aceb){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopper[_0x2576('0xcc')](_0x1f9b5b,_0x1a2ce9,_0x49aceb))['catch'](loggerCatch(_0x2576('0xcb')));};Dialer[_0x2576('0x1c')][_0x2576('0xcd')]=function(_0x47e671){return BPromise['resolve']()['then'](voiceQueueRt[_0x2576('0xcd')](_0x47e671))[_0x2576('0xb7')](loggerCatch(_0x2576('0xce')));};Dialer[_0x2576('0x1c')]['moveContactManagedDialer']=function(_0x46bc67){return BPromise[_0x2576('0xc0')]()[_0x2576('0xbe')](cmHopper[_0x2576('0xcf')](_0x46bc67))[_0x2576('0xb7')](loggerCatch(_0x2576('0xd0')));};Dialer[_0x2576('0x1c')]['createHistory']=function(_0x376f20){return BPromise[_0x2576('0xc0')]()['then'](cmHopperHistory[_0x2576('0xd1')](_0x376f20))['catch'](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x2576('0xb9')]=function(_0x34b2f7){if(!_[_0x2576('0x40')](_0x34b2f7)&&_0x34b2f7!==null){if(typeof _0x34b2f7['originated']!==_0x2576('0xb6')){if(_0x34b2f7['originated']>0x0){_0x34b2f7[_0x2576('0x78')]-=0x1;}else{logger[_0x2576('0x9b')](_0x2576('0xd2'));}}}else{logger[_0x2576('0x9b')](_0x2576('0xd3'));}};Dialer[_0x2576('0x1c')][_0x2576('0xd4')]=function(_0x34ed3c,_0x543119){var _0x52e748=this;return function(_0x348d00){_0x52e748[_0x2576('0xb9')](_0x543119);logger[_0x2576('0x9b')](_0x34ed3c,util['inspect'](_0x348d00,{'showHidden':![],'depth':null}));};};Dialer[_0x2576('0x1c')][_0x2576('0xd5')]=function(_0x5853a9,_0x1fea51,_0x2409b7){var _0x534d87={'state':0x19,'statedesc':_0x2576('0xd6')};this[_0x2576('0xb9')](_0x1fea51);this['saveInDb'](_['merge'](_0x534d87,_['pick'](_0x2409b7,[_0x2576('0xd7'),'ListId',_0x2576('0xd8'),_0x2576('0xd9'),'CampaignId'])),_0x2576('0xda'),_0x2576('0xdb'));logger['error'](_0x5853a9);};Dialer[_0x2576('0x1c')][_0x2576('0xdc')]=function(_0x507455){return _0x507455==='Success';};Dialer[_0x2576('0x1c')][_0x2576('0xdd')]=function(_0x3e9a85){return!_[_0x2576('0x40')](_0x3e9a85)&&_0x3e9a85&&!_[_0x2576('0x40')](_0x3e9a85[_0x2576('0x42')])&&!_[_0x2576('0x40')](_0x3e9a85['active'])&&_0x3e9a85[_0x2576('0x7d')]&&(this[_0x2576('0x24')][util[_0x2576('0x7f')](_0x2576('0xde'),_0x3e9a85['name'])][_0x2576('0xdf')]===_0x2576('0xe0')||this['trunks'][util['format'](_0x2576('0xde'),_0x3e9a85['name'])][_0x2576('0xdf')]===_0x2576('0xe1'));};Dialer[_0x2576('0x1c')]['saveInDb']=function(_0x4dd362,_0x365c04,_0xd25089){this[_0x2576('0xd1')](_0x4dd362)[_0x2576('0xb7')](loggerCatch(_0x365c04));this['moveContactManagedDialer'](_0x4dd362)[_0x2576('0xb7')](loggerCatch(_0xd25089));};Dialer[_0x2576('0x1c')][_0x2576('0x39')]=function(_0x328582){var _0x2cb67e=this['uniqueId'][_0x328582[_0x2576('0xe2')]];var _0x31c912;if(!_[_0x2576('0xe3')](_0x328582)&&!_['isNil'](_0x328582[_0x2576('0xe4')])&&!_[_0x2576('0xe3')](_0x328582[_0x2576('0xe4')][_0x2576('0xe5')])&&_0x328582[_0x2576('0xe6')]===_0x2576('0xe7')&&_0x2cb67e){if(_0x2cb67e[_0x2576('0x53')]!==_0x2576('0x82')&&this[_0x2576('0x21')][_0x2cb67e['queue']][_0x2576('0xe8')]&&_0x328582['value']===_0x2576('0xe9')){delete this['uniqueId'][_0x328582[_0x2576('0xe2')]];this[_0x2576('0xb9')](this[_0x2576('0x21')][_0x2cb67e['queue']]);this[_0x2576('0x21')][_0x2cb67e['queue']][_0x2576('0xea')]+=0x1;this[_0x2576('0x21')][_0x2cb67e[_0x2576('0xba')]][_0x2576('0x65')]+=0x1;_0x31c912=new Hangup(_0x2cb67e,_0x328582);_0x31c912[_0x2576('0xeb')]=0x12;_0x31c912[_0x2576('0xaf')]='HangupInAMD';_0x31c912['membername']=_0x2576('0xec');this[_0x2576('0xed')](_0x31c912,'[syncHangupInAMD][createHistory]',_0x2576('0xee'));}if(_0x2cb67e[_0x2576('0x53')]!==_0x2576('0x82')&&this[_0x2576('0x21')][_0x2cb67e[_0x2576('0xba')]][_0x2576('0xe8')]&&_0x328582['value']===_0x2576('0xef')){var _0x598764=this;return new BPromise(function(_0x4a7903,_0x2e7d14){delete _0x598764['uniqueId'][_0x328582[_0x2576('0xe2')]];_0x598764['updateOriginated'](_0x598764['voiceQueues'][_0x2cb67e['queue']]);_0x598764[_0x2576('0x21')][_0x2cb67e[_0x2576('0xba')]][_0x2576('0xea')]+=0x1;_0x598764[_0x2576('0x21')][_0x2cb67e[_0x2576('0xba')]][_0x2576('0x65')]+=0x1;var _0x61e88f=_0x598764[_0x2576('0x21')][_0x2cb67e[_0x2576('0xba')]];var _0x562236=new Hangup(_0x2cb67e,_0x328582);_0x562236[_0x2576('0xeb')]=0x13;_0x562236[_0x2576('0xaf')]=_0x2576('0xf0');_0x562236[_0x2576('0xf1')]=_0x2576('0xec');_0x562236[_0x2576('0xf2')]+=0x1;_0x562236[_0x2576('0xf3')]+=0x1;_0x562236[_0x2576('0xf4')]=!![];_0x598764[_0x2576('0xd1')](_0x562236)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x562236[_0x2576('0xf5')]+_0x562236[_0x2576('0xf6')]+_0x562236[_0x2576('0xf7')]+_0x562236[_0x2576('0xf8')]+_0x562236[_0x2576('0xf9')]+_0x562236[_0x2576('0xfa')]+_0x562236[_0x2576('0xf2')]+_0x562236[_0x2576('0xfb')]>=_0x61e88f[_0x2576('0xfc')]){_0x598764[_0x2576('0xfd')](_0x562236,_0x4a7903,_0x2e7d14,_0x2576('0xfe'));}else{if(_0x562236[_0x2576('0xf2')]>=_0x61e88f['dialMachineMaxRetry']){_0x598764[_0x2576('0xff')](_0x562236,_0x4a7903,_0x2e7d14,_0x2576('0x100'));}else{_0x598764[_0x2576('0xc6')]({'active':![],'countmachineretry':_0x562236[_0x2576('0xf2')],'scheduledat':moment()['add'](_0x61e88f[_0x2576('0x101')],_0x2576('0x102'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x562236[_0x2576('0xd7')],'ListId':_0x562236[_0x2576('0x103')],'VoiceQueueId':_0x562236[_0x2576('0xd9')]||undefined,'CampaignId':_0x562236[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch('[rescheduleContact][Machine]'));_0x4a7903({'reschedule':0x1});}}});}if(_0x2cb67e[_0x2576('0x53')]===_0x2576('0x82')&&this[_0x2576('0x22')][_0x2cb67e['queue']][_0x2576('0xe8')]&&_0x328582['value']===_0x2576('0xe9')){delete this[_0x2576('0x27')][_0x328582['uniqueid']];this[_0x2576('0xb9')](this[_0x2576('0x22')][_0x2cb67e[_0x2576('0xba')]]);_0x31c912=new Hangup(_0x2cb67e,_0x328582);_0x31c912[_0x2576('0xeb')]=0x12;_0x31c912[_0x2576('0xaf')]=_0x2576('0x105');_0x31c912[_0x2576('0xf1')]=_0x2576('0xec');this[_0x2576('0xed')](_0x31c912,_0x2576('0x106'),_0x2576('0x107'));}if(_0x2cb67e[_0x2576('0x53')]===_0x2576('0x82')&&this['campaigns'][_0x2cb67e[_0x2576('0xba')]][_0x2576('0xe8')]&&_0x328582[_0x2576('0x108')]===_0x2576('0xef')){var _0x598764=this;return new BPromise(function(_0x593bf3,_0x2aaf06){delete _0x598764[_0x2576('0x27')][_0x328582['uniqueid']];_0x598764[_0x2576('0xb9')](_0x598764[_0x2576('0x22')][_0x2cb67e[_0x2576('0xba')]]);_0x598764[_0x2576('0x22')][_0x2cb67e['queue']][_0x2576('0xea')]+=0x1;_0x598764[_0x2576('0x22')][_0x2cb67e[_0x2576('0xba')]][_0x2576('0x65')]+=0x1;var _0x574e26=_0x598764[_0x2576('0x22')][_0x2cb67e[_0x2576('0xba')]];var _0x3c94fb=new Hangup(_0x2cb67e,_0x328582);_0x3c94fb[_0x2576('0xeb')]=0x13;_0x3c94fb['statedesc']=_0x2576('0xf0');_0x3c94fb['membername']='AMD';_0x3c94fb['countmachineretry']+=0x1;_0x3c94fb[_0x2576('0xf3')]+=0x1;_0x3c94fb[_0x2576('0xf4')]=!![];_0x598764[_0x2576('0xd1')](_0x3c94fb)[_0x2576('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3c94fb['countbusyretry']+_0x3c94fb[_0x2576('0xf6')]+_0x3c94fb[_0x2576('0xf7')]+_0x3c94fb['countnosuchnumberretry']+_0x3c94fb[_0x2576('0xf9')]+_0x3c94fb[_0x2576('0xfa')]+_0x3c94fb[_0x2576('0xf2')]+_0x3c94fb[_0x2576('0xfb')]>=_0x574e26['dialGlobalMaxRetry']){_0x598764['stateGlobal'](_0x3c94fb,_0x593bf3,_0x2aaf06,_0x2576('0xfe'));}else{if(_0x3c94fb[_0x2576('0xf2')]>=_0x574e26['dialMachineMaxRetry']){_0x598764[_0x2576('0xff')](_0x3c94fb,_0x593bf3,_0x2aaf06,_0x2576('0x100'));}else{_0x598764['rescheduleContact']({'active':![],'countmachineretry':_0x3c94fb[_0x2576('0xf2')],'scheduledat':moment()[_0x2576('0x109')](_0x574e26[_0x2576('0x101')],_0x2576('0x102'))[_0x2576('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c94fb[_0x2576('0xd7')],'ListId':_0x3c94fb[_0x2576('0x103')],'VoiceQueueId':_0x3c94fb[_0x2576('0xd9')]||undefined,'CampaignId':_0x3c94fb[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch('[rescheduleContact][Machine]'));_0x593bf3({'reschedule':0x1});}}});}}};Dialer[_0x2576('0x1c')][_0x2576('0x10a')]=function(_0x1b7c6e){var _0x4131c6=this[_0x2576('0x27')][_0x1b7c6e[_0x2576('0xe2')]];var _0x35bf61=this;var _0x4723de;if(_0x4131c6&&_0x4131c6['type']===_0x2576('0x82')){delete this[_0x2576('0x27')][_0x1b7c6e[_0x2576('0xe2')]];this['updateOriginated'](this['campaigns'][_0x4131c6[_0x2576('0xba')]]);this['campaigns'][_0x4131c6[_0x2576('0xba')]][_0x2576('0x10b')]+=0x1;_0x4723de=new Hangup(_0x4131c6,_0x1b7c6e);this[_0x2576('0xd1')](_0x4723de)[_0x2576('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2576('0xcf')](_0x4723de)[_0x2576('0xb7')](loggerCatch(_0x2576('0x10c')));}if(_0x4131c6&&_0x4131c6['type']!=='ivr'&&isNotNull(this[_0x2576('0x21')][_0x4131c6['queue']][_0x2576('0x10d')])){delete this[_0x2576('0x27')][_0x1b7c6e[_0x2576('0xe2')]];this[_0x2576('0xb9')](this[_0x2576('0x21')][_0x4131c6[_0x2576('0xba')]]);this['voiceQueues'][_0x4131c6['queue']][_0x2576('0xea')]+=0x1;this['voiceQueues'][_0x4131c6[_0x2576('0xba')]][_0x2576('0x65')]+=0x1;_0x4723de=new Hangup(_0x4131c6,_0x1b7c6e);_0x4723de['state']=0x10;_0x4723de['statedesc']=_0x2576('0x10e');_0x4723de[_0x2576('0xf1')]=_0x2576('0x10f');this['createHistory'](_0x4723de)['catch'](loggerCatch(_0x2576('0x110')));this[_0x2576('0xcf')](_0x4723de)[_0x2576('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x4131c6&&_0x4131c6[_0x2576('0x53')]!==_0x2576('0x82')&&!isNotNull(this[_0x2576('0x21')][_0x4131c6['queue']][_0x2576('0x10d')])){delete this['uniqueId'][_0x1b7c6e[_0x2576('0xe2')]];this[_0x2576('0xb9')](this[_0x2576('0x21')][_0x4131c6['queue']]);this[_0x2576('0x21')][_0x4131c6[_0x2576('0xba')]][_0x2576('0x6d')]+=0x1;_0x4723de=new Hangup(_0x4131c6,_0x1b7c6e);_0x4723de[_0x2576('0xeb')]=0xc;_0x4723de[_0x2576('0xaf')]=_0x1b7c6e['cause-txt'];_0x4723de['membername']=_0x2576('0x111');this[_0x2576('0xd1')](_0x4723de)['catch'](loggerCatch(_0x2576('0x110')));this[_0x2576('0xcf')](_0x4723de)[_0x2576('0xb7')](loggerCatch(_0x2576('0x10c')));}};Dialer[_0x2576('0x1c')][_0x2576('0x34')]=function(_0x2795d1){var _0x309041=this[_0x2576('0x27')][_0x2795d1[_0x2576('0xe2')]];var _0x301b0e=this;if(this[_0x2576('0x21')][_0x2795d1[_0x2576('0xba')]]){if(_0x309041&&_0x309041[_0x2576('0x53')]!=='ivr'){delete this[_0x2576('0x27')][_0x2795d1['uniqueid']];this[_0x2576('0x21')][_0x2795d1['queue']][_0x2576('0xea')]+=0x1;var _0x46c943=new AgentComplete(_0x309041,_0x2795d1);if(_0x2795d1[_0x2576('0x112')]===_0x2576('0x113')){_0x46c943['agiafterat']=this[_0x2576('0x21')][_0x2795d1['queue']][_0x2576('0x114')]&&this[_0x2576('0x21')][_0x2795d1[_0x2576('0xba')]][_0x2576('0x115')]?moment()[_0x2576('0x7f')](_0x2576('0x116')):undefined;}this['createHistory'](_0x46c943)[_0x2576('0xb7')](loggerCatch(_0x2576('0x117')));this['moveContactManagedDialer'](_0x46c943)[_0x2576('0xb7')](loggerCatch(_0x2576('0x118')));}}};Dialer['prototype'][_0x2576('0x2f')]=function(_0x50c043){if(this['voiceQueues'][_0x50c043[_0x2576('0xba')]]){if(this['uniqueId'][_0x50c043[_0x2576('0xe2')]]&&this[_0x2576('0x27')][_0x50c043[_0x2576('0xe2')]][_0x2576('0x53')]!==_0x2576('0x82')){this['updateOriginated'](this[_0x2576('0x21')][_0x50c043[_0x2576('0xba')]]);this[_0x2576('0x27')][_0x50c043['uniqueid']][_0x2576('0x119')]=moment()[_0x2576('0x7f')](_0x2576('0x116'));}}};Dialer['prototype'][_0x2576('0x11a')]=function(_0x2c24b2){this[_0x2576('0xd1')](_0x2c24b2)[_0x2576('0xb7')](loggerCatch(_0x2576('0x117')));this[_0x2576('0xcf')](_0x2c24b2)[_0x2576('0xb7')](loggerCatch(_0x2576('0x11b')));};Dialer['prototype'][_0x2576('0x30')]=function(_0x49c333){var _0x47459c=this[_0x2576('0x27')][_0x49c333[_0x2576('0xe2')]];var _0x4ebbe3=this;if(this[_0x2576('0x21')][_0x49c333['queue']]){if(_0x47459c&&_0x47459c[_0x2576('0x53')]!==_0x2576('0x82')){delete this[_0x2576('0x27')][_0x49c333['uniqueid']];this[_0x2576('0xb9')](this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]]);_0x47459c[_0x2576('0x11c')]=moment()[_0x2576('0x7f')](_0x2576('0x116'));var _0x14b669=new QueueCallerAbandon(_0x47459c,_0x49c333);if(getSeconds(_0x47459c[_0x2576('0x11c')],_0x47459c[_0x2576('0x11d')])>=_0x47459c[_0x2576('0x11e')]){this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]][_0x2576('0x71')]+=0x1;this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]][_0x2576('0x73')]+=0x1;_0x14b669['state']=0xa;_0x14b669['statedesc']=_0x2576('0x11f');_0x14b669[_0x2576('0x120')]=_0x2576('0x121');_0x14b669[_0x2576('0x122')]=this[_0x2576('0x21')][_0x49c333['queue']][_0x2576('0x114')]?moment()['format'](_0x2576('0x116')):undefined;_0x14b669[_0x2576('0xf9')]+=0x1;_0x14b669[_0x2576('0xf3')]+=0x1;if(_0x14b669[_0x2576('0xf9')]>=this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]][_0x2576('0x123')]){this[_0x2576('0x11a')](_0x14b669);}else{this[_0x2576('0xc6')]({'active':![],'countdropretry':_0x14b669[_0x2576('0xf9')],'scheduledat':moment()['add'](this[_0x2576('0x21')][_0x49c333['queue']][_0x2576('0x124')],'minutes')[_0x2576('0x7f')](_0x2576('0x116')),'ContactId':_0x47459c[_0x2576('0xd7')],'ListId':_0x47459c['ListId'],'VoiceQueueId':_0x47459c[_0x2576('0xd9')]||undefined,'CampaignId':_0x47459c[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x125')));var _0x29699c=new History(_0x14b669);_0x29699c[_0x2576('0xeb')]=0xa;_0x29699c[_0x2576('0xaf')]='Drop';_0x29699c[_0x2576('0xb1')]=moment()[_0x2576('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x29699c[_0x2576('0xb0')]=_0x29699c[_0x2576('0xb1')];_0x29699c[_0x2576('0x126')]=_0x14b669[_0x2576('0x126')];_0x29699c[_0x2576('0x127')]=_0x14b669['calleridnum'];this[_0x2576('0xd1')](_0x29699c)[_0x2576('0xb7')](loggerCatch(_0x2576('0x128')));}}else{this['voiceQueues'][_0x49c333[_0x2576('0xba')]][_0x2576('0x70')]+=0x1;this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]][_0x2576('0x129')]+=0x1;_0x14b669[_0x2576('0xeb')]=0xb;_0x14b669[_0x2576('0xaf')]='Abandoned';_0x14b669[_0x2576('0x120')]=_0x2576('0x12a');_0x14b669[_0x2576('0xfa')]+=0x1;_0x14b669['countglobal']+=0x1;if(_0x14b669[_0x2576('0xfa')]>=this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]]['dialAbandonedMaxRetry']){this[_0x2576('0x11a')](_0x14b669);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x14b669['countabandonedretry'],'scheduledat':moment()[_0x2576('0x109')](this[_0x2576('0x21')][_0x49c333[_0x2576('0xba')]][_0x2576('0x12b')],'minutes')['format'](_0x2576('0x116')),'ContactId':_0x47459c['ContactId'],'ListId':_0x47459c['ListId'],'VoiceQueueId':_0x47459c[_0x2576('0xd9')]||undefined,'CampaignId':_0x47459c[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x12c')));var _0x29699c=new History(_0x14b669);_0x29699c[_0x2576('0xeb')]=0xb;_0x29699c['statedesc']='Abandoned';_0x29699c['starttime']=moment()[_0x2576('0x7f')](_0x2576('0x116'));_0x29699c[_0x2576('0xb0')]=_0x29699c[_0x2576('0xb1')];_0x29699c['calleridname']=_0x14b669[_0x2576('0x126')];_0x29699c[_0x2576('0x127')]=_0x14b669[_0x2576('0x127')];this['createHistory'](_0x29699c)[_0x2576('0xb7')](loggerCatch(_0x2576('0x12d')));}}}}};Dialer[_0x2576('0x1c')][_0x2576('0x37')]=function(_0x155e9d){if(this[_0x2576('0xb4')][_0x155e9d['uniqueid']]){this[_0x2576('0xb4')][_0x155e9d[_0x2576('0xe2')]]['channel']=_0x155e9d[_0x2576('0x12e')];}if(this[_0x2576('0x27')][_0x155e9d[_0x2576('0xe2')]]){this[_0x2576('0x27')][_0x155e9d[_0x2576('0xe2')]][_0x2576('0x12e')]=_0x155e9d[_0x2576('0x12e')];}};Dialer[_0x2576('0x1c')][_0x2576('0x3b')]=function(_0x47b792){if(strategy[this[_0x2576('0x21')][this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]][_0x2576('0xba')]][_0x2576('0x55')]]===_0x2576('0x130')){if(this['actions'][_0x47b792[_0x2576('0x12f')]]&&_[_0x2576('0xe3')](this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]]['locked'])&&_0x47b792[_0x2576('0xdf')]==='1'&&_0x47b792[_0x2576('0x131')]==='0'){if(this['agents'][_0x47b792['stateinterface']]){if(!this[_0x2576('0x23')][_0x47b792[_0x2576('0x132')]]['locked']){this[_0x2576('0x23')][_0x47b792['stateinterface']][_0x2576('0x133')]=!![];this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]]['locked']=!![];this[_0x2576('0xb4')][_0x47b792['actionid']]['stateinterface']=_0x47b792[_0x2576('0x132')];}}}}else if((strategy[this[_0x2576('0x21')][this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]][_0x2576('0xba')]][_0x2576('0x55')]]||_0x2576('0x1b'))==='rrmemory'){if(this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]]){if(this[_0x2576('0x23')][_0x47b792['stateinterface']]){this['actions'][_0x47b792[_0x2576('0x12f')]]['stateinterface']=_0x47b792['stateinterface'];if(_[_0x2576('0xe3')](this[_0x2576('0x2c')][this['actions'][_0x47b792[_0x2576('0x12f')]][_0x2576('0xba')]])){this['queueBooked'][this['actions'][_0x47b792[_0x2576('0x12f')]]['queue']]=[];}this[_0x2576('0x2c')][this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]]['queue']][_0x2576('0x134')](_[_0x2576('0x93')](_[_0x2576('0x135')](this[_0x2576('0xb4')][_0x47b792[_0x2576('0x12f')]],[_0x2576('0x136'),_0x2576('0x132')]),{'status':_0x47b792[_0x2576('0xdf')],'paused':_0x47b792[_0x2576('0x131')]}));}}}};function unlockQueueStatus(_0x407e39,_0x433d80){setTimeout(function(){if(_[_0x2576('0x40')](_0x407e39['queueStatusComplete'])){loggerBooked[_0x2576('0x9b')]('[unlockQueueStatus][undefined]',_0x433d80);}_0x407e39[_0x2576('0x137')]=!![];loggerBooked[_0x2576('0x87')]('[booked][unlockQueueStatus]',_0x433d80,JSON[_0x2576('0x4e')](_['pick'](_0x407e39,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0x2576('0x1c')][_0x2576('0x3d')]=function(_0x36ec4e){var _0x7e045b=this;var _0x3f113a=_0x7e045b['voiceQueues'][_0x7e045b[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]]['queue']];if(strategy[this[_0x2576('0x21')][this[_0x2576('0xb4')][_0x36ec4e['actionid']]['queue']][_0x2576('0x55')]]==='roundrobin'){if(this['actions'][_0x36ec4e['actionid']]&&this[_0x2576('0xb4')][_0x36ec4e['actionid']]['stateinterface']){this[_0x2576('0x138')][_0x2576('0x139')](this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0x136')],this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0x132')])[_0x2576('0xb7')](function(_0x5a72b8){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x5a72b8,{'showHidden':![],'depth':null}));})[_0x2576('0x1f')](function(){_0x7e045b['updateOriginated'](_0x7e045b[_0x2576('0x21')][_0x7e045b[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]);_0x7e045b['agents'][_0x7e045b[_0x2576('0xb4')][_0x36ec4e['actionid']][_0x2576('0x132')]]['locked']=![];delete _0x7e045b[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]];unlockQueueStatus(_0x3f113a);});}else{this['updateOriginated'](this[_0x2576('0x21')][this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]);this[_0x2576('0xc6')]({'active':![],'ContactId':this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xd7')],'ListId':this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0x103')],'VoiceQueueId':this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xd9')]||undefined,'CampaignId':this[_0x2576('0xb4')][_0x36ec4e['actionid']][_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]];unlockQueueStatus(_0x3f113a);}}else if((strategy[this[_0x2576('0x21')][this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]['strategy']]||_0x2576('0x1b'))===_0x2576('0x1b')){var _0x4cc073;if(this[_0x2576('0xb4')][_0x36ec4e['actionid']]&&!_['isEmpty'](this[_0x2576('0x2c')][this['actions'][_0x36ec4e[_0x2576('0x12f')]]['queue']])){if(this[_0x2576('0x2d')][_0x7e045b[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]){this[_0x2576('0x2d')][_0x7e045b['actions'][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]=this[_0x2576('0x2d')][this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]?this[_0x2576('0x2d')][this[_0x2576('0xb4')][_0x36ec4e['actionid']][_0x2576('0xba')]]:this[_0x2576('0x2c')][this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]]?this[_0x2576('0x2c')][this[_0x2576('0xb4')][_0x36ec4e['actionid']]['queue']][_0x2576('0x13a')]||0x0:0x0;}this['queueBooked'][this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]][_0x2576('0x13a')]=this[_0x2576('0x2d')][this[_0x2576('0xb4')][_0x36ec4e[_0x2576('0x12f')]][_0x2576('0xba')]];for(var _0x13b8f2=0x0;_0x13b8f2=0x0;})[_0x2576('0xb7')](myreject(_0xfa7b30)));}}else{_0x4939b3['push'](ami[_0x2576('0x153')]({'action':_0x2576('0x150'),'command':util[_0x2576('0x7f')](_0x2576('0x151'),_0x1425a7,!_[_0x2576('0x40')](config[_0x2576('0x154')][_0x3685b9])?_0x3685b9:'')})[_0x2576('0xbe')](function(_0x4ad4e3){return _0x4ad4e3[_0x2576('0x155')][_0x2576('0x156')](_0x2576('0x152'))>=0x0;})[_0x2576('0xb7')](myreject(_0xfa7b30)));}BPromise[_0x2576('0x157')](_0x4939b3)[_0x2576('0xbe')](function(_0x39801a){var _0x1d7084=_[_0x2576('0x158')](_0x39801a);if(_0x1d7084){return _0x41d977(_0x1d7084);}else{_0x488654['message']=_0x2815ec?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0xfa7b30(msgResponse(_0x2576('0x159'),_0x2576('0x149'),_0x2576('0x15a')+_0x2815ec+'\x20'+_0x246997+_0x2576('0x15b')+util[_0x2576('0x9d')](_0x1425a7,{'showHidden':![],'depth':null})+_0x2576('0x15c')+_0x3685b9));}})[_0x2576('0xb7')](function(_0x501190){return _0xfa7b30(msgResponse(_0x2576('0x147'),'Failure',JSON['stringify'](_0x501190)));});});};Dialer['prototype'][_0x2576('0x15d')]=function(_0x4b0e50){var _0x1318b9=this;return function(){switch(_0x4b0e50['dialMethod']){case _0x2576('0x15e'):freeVariablesPredictive(_0x4b0e50);_0x1318b9['handlePower'](_0x4b0e50,0x1);break;case'power':freeVariablesPredictive(_0x4b0e50);_0x1318b9['handlePower'](_0x4b0e50,_0x4b0e50[_0x2576('0x15f')]);break;case _0x2576('0xb'):_0x1318b9['predictive'](_0x4b0e50);break;case'booked':freeVariablesPredictive(_0x4b0e50);_0x1318b9[_0x2576('0x160')](_0x4b0e50,0x1);break;default:freeVariablesPredictive(_0x4b0e50);logger[_0x2576('0x9b')](_0x2576('0x161'),_0x4b0e50[_0x2576('0x42')],_0x2576('0x162'));}};};Dialer[_0x2576('0x1c')][_0x2576('0x163')]=function(_0x228ac7){var _0x544174=this;return function(){_0x544174[_0x2576('0x164')](_0x228ac7);};};Dialer['prototype'][_0x2576('0xd')]=function(_0x31a42a){var _0x7df6f1=this;if(isNotPreview(_0x31a42a[_0x2576('0x62')])){if(isVoiceQueueOutbound(_0x31a42a[_0x2576('0x53')])&&isActive(_0x31a42a[_0x2576('0x61')])){_0x31a42a[_0x2576('0xa7')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x31a42a,_0x31a42a[_0x2576('0x57')]))['then'](checkIsActive(_0x31a42a,_0x31a42a[_0x2576('0x61')]))[_0x2576('0xbe')](checkInterval(_0x31a42a))[_0x2576('0xbe')](_0x7df6f1[_0x2576('0x143')](_0x31a42a))[_0x2576('0xbe')](_0x7df6f1['checkIfTime'](_0x31a42a[_0x2576('0x165')],_0x31a42a[_0x2576('0x166')],_0x31a42a[_0x2576('0x42')],_0x31a42a))[_0x2576('0xbe')](_0x7df6f1[_0x2576('0x148')](_0x31a42a['Interval'],_0x31a42a[_0x2576('0x166')],_0x31a42a[_0x2576('0x42')],_0x31a42a))[_0x2576('0xbe')](_0x7df6f1[_0x2576('0x15d')](_0x31a42a))[_0x2576('0xb7')](loggerCatchQueueSummary(_0x2576('0x167'),_0x31a42a));}else{notSendMessagesQueue(_0x31a42a);}}else{freeVariablesPredictive(_0x31a42a);}};Dialer[_0x2576('0x1c')][_0x2576('0x168')]=function(){var _0x218968=this;var _0x21d669;for(var _0x5be86e in this[_0x2576('0x22')]){if(typeof this[_0x2576('0x22')][_0x5be86e]!==_0x2576('0xb6')){_0x21d669=this[_0x2576('0x22')][_0x5be86e];if(isCampaignIvr(_0x21d669['type'])&&isActive(_0x21d669['active'])){_0x21d669['sendMessageOneNotActive']=!![];BPromise[_0x2576('0xc0')]()['then'](checkIsActive(_0x21d669,_0x21d669['active']))[_0x2576('0xbe')](checkInterval(_0x21d669))['then'](_0x218968[_0x2576('0x143')](_0x21d669))[_0x2576('0xbe')](_0x218968[_0x2576('0x146')](_0x21d669[_0x2576('0x165')],_0x21d669[_0x2576('0x166')],_0x21d669[_0x2576('0x42')],_0x21d669))[_0x2576('0xbe')](_0x218968[_0x2576('0x148')](_0x21d669[_0x2576('0x46')],_0x21d669[_0x2576('0x166')],_0x21d669[_0x2576('0x42')],_0x21d669))[_0x2576('0xbe')](_0x218968[_0x2576('0x163')](_0x21d669))[_0x2576('0xb7')](loggerCatchQueueSummary(_0x2576('0x169'),_0x21d669));}else{notSendMessagesCampaign(_0x21d669);}}}};function getCallerIdRandom(_0x159523,_0x574206){var _0x2015b7;var _0x476cf8;var _0x9aae7a;if(_0x574206<=0x0){_0x574206=0x1;}_0x2015b7=new RegExp(_0x2576('0x16a')+_0x574206+'}$');_0x476cf8=Math[_0x2576('0x16b')](0xa,_0x574206-0x1);_0x9aae7a=Math[_0x2576('0x16b')](0xa,_0x574206)-0x1;return util[_0x2576('0x7f')]('%s',_[_0x2576('0x16c')](_0x159523,_0x2015b7,_['random'](_0x476cf8,_0x9aae7a)));}function extractCalleridName(_0x393861){var _0x529267=_0x393861[_0x2576('0x16d')](/"(.*?)"/);return _0x529267?_0x529267[0x1]:_0x393861;}function extractCalleridNumber(_0xe90d95){var _0x838e65=_0xe90d95['match'](/<(.*?)>/);return _0x838e65?_0x838e65[0x1]:_0xe90d95;}Dialer['prototype'][_0x2576('0x16e')]=function(_0x45233e,_0x128ff5){var _0x42bcbd=this;var _0x3f263c=uuid['v4']();this['actions'][_0x3f263c]=new Action(_0x45233e,_0x128ff5,_0x3f263c);return new BPromise(function(_0x45e4ae,_0x3d750b){if(_[_0x2576('0x40')](_0x45233e)&&typeof _0x45233e!==_0x2576('0x16f')){return _0x3d750b(msgResponse(_0x2576('0x170'),_0x2576('0x149'),'voiceQueue\x20is\x20undefine'));}if(_[_0x2576('0x40')](_0x128ff5['Contact'][_0x2576('0x171')])||_0x128ff5['Contact'][_0x2576('0x171')]===null){return _0x3d750b(msgResponse(_0x2576('0x170'),_0x2576('0x149'),'contact\x20is\x20undefine'));}var _0x2f7745={'XMD-CALLERID':_0x42bcbd[_0x2576('0xb4')][_0x3f263c][_0x2576('0x172')](),'XMD-AGI':_0x45233e['dialQueueProject']?util[_0x2576('0x7f')](_0x2576('0x173'),ipAgi,_0x45233e[_0x2576('0x10d')]):_0x2576('0x174'),'XMD-AGIAFTER':_0x45233e['dialQueueProject2']?util[_0x2576('0x7f')](_0x2576('0x173'),ipAgi,_0x45233e[_0x2576('0x114')]):_0x2576('0x174'),'XMD-QUEUE':_0x45233e['type']===_0x2576('0x54')?util['format'](_0x2576('0x175'),_0x45233e[_0x2576('0x42')],_0x45233e[_0x2576('0x176')]||'',_0x45233e[_0x2576('0x115')]?'c':'',_0x45233e[_0x2576('0x11e')]||0x3):'NONE','XMD-CONTACTID':_0x128ff5['ContactId'],'XMD-CDRTYPE':_0x2576('0x9'),'CALLERID(all)':_0x42bcbd['actions'][_0x3f263c][_0x2576('0x172')](),'XMD-AMD':_0x45233e[_0x2576('0xe8')]?'ACTIVE':_0x2576('0x174'),'XMD-DESTINATION':_0x2576('0xe7')};if(_0x45233e[_0x2576('0xe8')]){_0x2f7745['XMD-AMDINITIALSILENCE']=_0x45233e['dialAMDInitialSilence']||0x9c4;_0x2f7745[_0x2576('0x177')]=_0x45233e[_0x2576('0x178')]||0x5dc;_0x2f7745['XMD-AMDAFTERGREETINGSILENCE']=_0x45233e[_0x2576('0x179')]||0x320;_0x2f7745[_0x2576('0x17a')]=_0x45233e[_0x2576('0x17b')]||0x1388;_0x2f7745[_0x2576('0x17c')]=_0x45233e['dialAMDMinWordLength']||0x64;_0x2f7745[_0x2576('0x17d')]=_0x45233e['dialAMDBetweenWordsSilence']||0x32;_0x2f7745['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x45233e['dialAMDMaximumNumberOfWords']||0x3;_0x2f7745['XMD-AMDSILENCETHRESHOLD']=_0x45233e['dialAMDSilenceThreshold']||0x100;_0x2f7745['XMD-AMDMAXIMUMWORDLENGTH']=_0x45233e[_0x2576('0x17e')]||0x1388;}if(_0x45233e[_0x2576('0x53')]===_0x2576('0x54')){_0x2f7745[_0x2576('0x17f')]=_0x128ff5[_0x2576('0xd9')];}else{_0x2f7745['XMD-CAMPAIGNID']=_0x128ff5[_0x2576('0x104')];}for(var _0x4ab290 in _0x128ff5[_0x2576('0x180')]){if(typeof _0x128ff5['Contact'][_0x4ab290]!==_0x2576('0xb6')){if(isNotNull(_0x128ff5[_0x2576('0x180')][_0x4ab290])&&_0x4ab290!=='id'&&_0x4ab290!==_0x2576('0x181')&&_0x4ab290!=='createdAt'&&_0x4ab290!==_0x2576('0x182')){_0x2f7745[util['format'](_0x2576('0x183'),_0x2576('0x184'),_[_0x2576('0x185')](_0x4ab290))]=_0x128ff5[_0x2576('0x180')][_0x4ab290];}}}var _0x2b8c69=_0x42bcbd[_0x2576('0xdd')](_0x45233e[_0x2576('0x7c')])?getCallerId(_0x45233e[_0x2576('0x7c')]['callerid'],_0x45233e[_0x2576('0x186')],_0x45233e[_0x2576('0x187')]>0x0?getCallerIdRandom(_0x45233e['dialOriginateCallerIdNumber'],_0x45233e[_0x2576('0x187')]):_0x45233e['dialOriginateCallerIdNumber']):getCallerId(_[_0x2576('0xe3')](_0x45233e[_0x2576('0x188')])?_0x45233e[_0x2576('0x7c')]['callerid']:_0x45233e[_0x2576('0x188')][_0x2576('0x7e')],_0x45233e[_0x2576('0x186')],_0x45233e[_0x2576('0x187')]>0x0?getCallerIdRandom(_0x45233e['dialOriginateCallerIdNumber'],_0x45233e['dialRandomLastDigitCallerIdNumber']):_0x45233e[_0x2576('0x63')]);if(_0x2b8c69){_0x2f7745['XMD-ORIGINATECALLERIDNAME']=_0x42bcbd[_0x2576('0xb4')][_0x3f263c][_0x2576('0x189')]=extractCalleridName(_0x2b8c69);_0x2f7745[_0x2576('0x18a')]=_0x42bcbd[_0x2576('0xb4')][_0x3f263c][_0x2576('0x18b')]=extractCalleridNumber(_0x2b8c69);}return ami['Action']({'actionid':_0x3f263c,'action':'originate','channel':_0x42bcbd['isTrunkReachable'](_0x45233e[_0x2576('0x7c')])?util[_0x2576('0x7f')]('SIP/%s/%s%s',_0x45233e['Trunk'][_0x2576('0x42')],isNotNull(_0x45233e[_0x2576('0x18c')])?_0x45233e[_0x2576('0x18c')][_0x2576('0x18d')]()||'':'',_0x45233e[_0x2576('0x18e')]>0x0?_0x128ff5[_0x2576('0x180')][_0x2576('0x171')]['substring'](_0x45233e[_0x2576('0x18e')]):_0x128ff5[_0x2576('0x180')]['phone']):util[_0x2576('0x7f')]('SIP/%s/%s%s',_['isNil'](_0x45233e[_0x2576('0x188')])?_0x45233e['Trunk'][_0x2576('0x42')]:_0x45233e['TrunkBackup'][_0x2576('0x42')],isNotNull(_0x45233e['dialPrefix'])?_0x45233e[_0x2576('0x18c')]['trim']()||'':'',_0x45233e[_0x2576('0x18e')]>0x0?_0x128ff5['Contact'][_0x2576('0x171')][_0x2576('0x18f')](_0x45233e['dialCutDigit']):_0x128ff5[_0x2576('0x180')]['phone']),'callerid':_0x2b8c69,'Exten':_0x2576('0xe7'),'Context':_0x2576('0x190'),'Priority':'1','variable':_0x2f7745,'timeout':(_0x45233e[_0x2576('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f263c})[_0x2576('0xbe')](function(_0x121ded){return _0x45e4ae(_0x121ded);})['catch'](function(_0xd864b6){_0x45233e[_0x2576('0x6b')]+=0x1;var _0x4b9d04=new History(_0x42bcbd[_0x2576('0xb4')][_0x3f263c]);logger[_0x2576('0x9b')](util['format'](_0x2576('0x191'),JSON[_0x2576('0x4e')](_0xd864b6)));_0x4b9d04[_0x2576('0xeb')]=0xe;_0x4b9d04['statedesc']='OriginateError';_0x4b9d04[_0x2576('0xb1')]=moment()[_0x2576('0x7f')](_0x2576('0x116'));_0x4b9d04['endtime']=_0x4b9d04[_0x2576('0xb1')];_0x42bcbd['createHistory'](_0x4b9d04)[_0x2576('0xb7')](loggerCatch(_0x2576('0x192')));_0x42bcbd['moveContactManagedDialer'](_0x4b9d04)[_0x2576('0xb7')](loggerCatch(_0x2576('0x192')))[_0x2576('0x1f')](function(){delete _0x42bcbd['actions'][_0x3f263c];return _0x3d750b(msgResponse(_0x2576('0x170'),'Error',_0x2576('0x193')));});});});};Dialer[_0x2576('0x1c')]['syncOriginateResponse']=function(_0x1e3505){var _0x3a9170=this[_0x2576('0xb4')][_0x1e3505[_0x2576('0x12f')]];if(_0x3a9170){delete this[_0x2576('0xb4')][_0x1e3505['actionid']];_0x3a9170[_0x2576('0x11d')]=moment()[_0x2576('0x7f')](_0x2576('0x116'));var _0x16aac3=_0x3a9170[_0x2576('0x53')]===_0x2576('0x82')?this[_0x2576('0x22')][_0x3a9170[_0x2576('0xba')]]:this[_0x2576('0x21')][_0x3a9170[_0x2576('0x194')]()];if(!this[_0x2576('0xdc')](_0x1e3505[_0x2576('0x195')])){this['updateOriginated'](_0x16aac3);return this[_0x2576('0x196')](_0x3a9170,_0x16aac3,_0x1e3505)[_0x2576('0xb7')](loggerCatch(_0x2576('0x197')));}this['uniqueId'][_0x1e3505[_0x2576('0xe2')]]=_0x3a9170;}};Dialer[_0x2576('0x1c')][_0x2576('0x198')]=function(_0x4a0031,_0x457195,_0x2a728c){var _0xc32828=new History(_0x457195);if(_0xc32828[_0x2576('0xf5')]+_0xc32828['countcongestionretry']+_0xc32828[_0x2576('0xf7')]+_0xc32828['countnosuchnumberretry']+_0xc32828[_0x2576('0xf9')]+_0xc32828[_0x2576('0xfa')]+_0xc32828[_0x2576('0xf2')]+_0xc32828[_0x2576('0xfb')]>=_0x2a728c[_0x2576('0xfc')]-0x1){return!![];}switch(_0x4a0031){case 0x3:if(_0xc32828['countnoanswerretry']>=_0x2a728c['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x2576('0xc6')]({'active':![],'countnoanswerretry':_0xc32828[_0x2576('0xf7')]+=0x1,'scheduledat':moment()[_0x2576('0x109')](_0x2a728c[_0x2576('0x199')],'minutes')[_0x2576('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc32828['ContactId'],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828[_0x2576('0xd9')]||undefined,'CampaignId':_0xc32828[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x19a')));break;case 0x5:if(_0xc32828[_0x2576('0xf5')]>=_0x2a728c['dialBusyMaxRetry']-0x1){return!![];}this[_0x2576('0xc6')]({'active':![],'countbusyretry':_0xc32828['countbusyretry']+=0x1,'scheduledat':moment()[_0x2576('0x109')](_0x2a728c['dialBusyRetryFrequency'],_0x2576('0x102'))[_0x2576('0x7f')](_0x2576('0x116')),'ContactId':_0xc32828[_0x2576('0xd7')],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828['VoiceQueueId']||undefined,'CampaignId':_0xc32828[_0x2576('0x104')]||undefined})['catch'](loggerCatch(_0x2576('0x19b')));break;case 0x8:if(_0xc32828[_0x2576('0xf6')]>=_0x2a728c[_0x2576('0x19c')]-0x1){return!![];}this[_0x2576('0xc6')]({'active':![],'countcongestionretry':_0xc32828['countcongestionretry']+=0x1,'scheduledat':moment()[_0x2576('0x109')](_0x2a728c['dialCongestionRetryFrequency'],_0x2576('0x102'))[_0x2576('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc32828[_0x2576('0xd7')],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828[_0x2576('0xd9')]||undefined,'CampaignId':_0xc32828['CampaignId']||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x19d')));break;case 0x0:if(_0xc32828[_0x2576('0xf8')]>=_0x2a728c['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xc32828[_0x2576('0xf8')]+=0x1,'scheduledat':moment()[_0x2576('0x109')](_0x2a728c[_0x2576('0x19e')],'minutes')['format'](_0x2576('0x116')),'ContactId':_0xc32828['ContactId'],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828['VoiceQueueId']||undefined,'CampaignId':_0xc32828[_0x2576('0x104')]||undefined})['catch'](loggerCatch(_0x2576('0x19f')));}break;case 0xa:if(_0xc32828[_0x2576('0xf9')]>=_0x2a728c[_0x2576('0x123')]-0x1){return!![];}this[_0x2576('0xc6')]({'active':![],'countdropretry':_0xc32828[_0x2576('0xf9')]+=0x1,'scheduledat':moment()[_0x2576('0x109')](_0x2a728c['dialDropRetryFrequency'],'minutes')[_0x2576('0x7f')](_0x2576('0x116')),'ContactId':_0xc32828[_0x2576('0xd7')],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828['VoiceQueueId']||undefined,'CampaignId':_0xc32828[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x125')));break;case 0xb:if(_0xc32828[_0x2576('0xfa')]>=_0x2a728c['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0xc32828[_0x2576('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x2a728c[_0x2576('0x12b')],_0x2576('0x102'))[_0x2576('0x7f')](_0x2576('0x116')),'ContactId':_0xc32828[_0x2576('0xd7')],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828['VoiceQueueId']||undefined,'CampaignId':_0xc32828[_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xc32828[_0x2576('0xf2')]>=_0x2a728c[_0x2576('0x1a0')]-0x1){return!![];}this[_0x2576('0xc6')]({'active':![],'countmachineretry':_0xc32828[_0x2576('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x2a728c[_0x2576('0x101')],_0x2576('0x102'))['format'](_0x2576('0x116')),'ContactId':_0xc32828['ContactId'],'ListId':_0xc32828['ListId'],'VoiceQueueId':_0xc32828[_0x2576('0xd9')]||undefined,'CampaignId':_0xc32828['CampaignId']||undefined})[_0x2576('0xb7')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xc32828[_0x2576('0xfb')]>=_0x2a728c[_0x2576('0x1a1')]-0x1){return!![];}this[_0x2576('0xc6')]({'active':![],'countagentrejectretry':_0xc32828[_0x2576('0xfb')]+=0x1,'scheduledat':moment()[_0x2576('0x109')](_0x2a728c[_0x2576('0x1a2')],'minutes')[_0x2576('0x7f')](_0x2576('0x116')),'ContactId':_0xc32828[_0x2576('0xd7')],'ListId':_0xc32828[_0x2576('0x103')],'VoiceQueueId':_0xc32828[_0x2576('0xd9')]||undefined,'CampaignId':_0xc32828['CampaignId']||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x1a3')));break;default:return!![];}};Dialer[_0x2576('0x1c')][_0x2576('0x196')]=function(_0x2b7c2b,_0x1cd0d5,_0x552a75){var _0x40af3a=this;var _0x5d33be=new History(_0x2b7c2b);return new BPromise(function(_0x4d42fa,_0x400161){if(_['isUndefined'](_0x1cd0d5)&&typeof _0x1cd0d5!==_0x2576('0x16f')){return _0x400161(msgResponse(_0x2576('0x1a4'),_0x2576('0x149'),_0x2576('0x1a5')));}if(_[_0x2576('0x40')](_0x552a75)&&typeof _0x552a75!==_0x2576('0x16f')){return _0x400161(msgResponse(_0x2576('0x1a4'),_0x2576('0x149'),_0x2576('0x1a6')));}switch(_0x552a75[_0x2576('0x112')]){case'0':_0x1cd0d5[_0x2576('0x6a')]+=0x1;_0x5d33be[_0x2576('0xeb')]=0x0;_0x5d33be[_0x2576('0xaf')]=_0x2576('0x1a7');_0x5d33be[_0x2576('0xf8')]+=0x1;_0x5d33be[_0x2576('0xf3')]+=0x1;ami[_0x2576('0x52')](_0x2576('0x1a8'),ut[_0x2576('0x1a9')](_0x2b7c2b,'nosuchnumber'));_0x40af3a[_0x2576('0xd1')](_0x5d33be)['catch'](loggerCatch(_0x2576('0x1aa')));if(_0x40af3a['checkRetriveMax'](0x0,_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be[_0x2576('0xf8')]>=_0x1cd0d5[_0x2576('0x1ab')]){_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1ac'));}else{_0x40af3a[_0x2576('0xfd')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1ac'));}}break;case'3':_0x1cd0d5['outboundNoAnswerCallsDay']+=0x1;_0x5d33be[_0x2576('0xeb')]=0x3;_0x5d33be[_0x2576('0xaf')]=_0x2576('0x1ad');_0x5d33be[_0x2576('0xf7')]+=0x1;_0x5d33be[_0x2576('0xf3')]+=0x1;ami['emit'](_0x2576('0x1ae'),ut['buildObj'](_0x2b7c2b,_0x2576('0x1af')));_0x40af3a[_0x2576('0xd1')](_0x5d33be)[_0x2576('0xb7')](loggerCatch(_0x2576('0x1b0')));if(_0x40af3a[_0x2576('0x198')](0x3,_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be[_0x2576('0xf7')]>=_0x1cd0d5[_0x2576('0x1b1')]){_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,'reason\x203\x20ringing\x20no\x20answer');}else{_0x40af3a[_0x2576('0xfd')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1b2'));}}break;case'5':_0x1cd0d5[_0x2576('0x67')]+=0x1;_0x5d33be[_0x2576('0xeb')]=0x5;_0x5d33be['statedesc']=_0x2576('0x1b3');_0x5d33be[_0x2576('0xf5')]+=0x1;_0x5d33be[_0x2576('0xf3')]+=0x1;ami[_0x2576('0x52')](_0x2576('0x1b4'),ut[_0x2576('0x1a9')](_0x2b7c2b,_0x2576('0x1b5')));_0x40af3a['createHistory'](_0x5d33be)[_0x2576('0xb7')](loggerCatch(_0x2576('0x1b6')));if(_0x40af3a['checkRetriveMax'](0x5,_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be[_0x2576('0xf5')]>=_0x1cd0d5[_0x2576('0x1b7')]){_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1b8'));}else{_0x40af3a[_0x2576('0xfd')](_0x5d33be,_0x4d42fa,_0x400161,'reason\x205\x20busy');}}break;case'8':_0x1cd0d5[_0x2576('0x1b9')]+=0x1;_0x5d33be[_0x2576('0xeb')]=0x8;_0x5d33be[_0x2576('0xaf')]=_0x2576('0x1ba');_0x5d33be[_0x2576('0xf6')]+=0x1;_0x5d33be[_0x2576('0xf3')]+=0x1;ami[_0x2576('0x52')](_0x2576('0x1bb'),ut[_0x2576('0x1a9')](_0x2b7c2b,_0x2576('0x1bc')));_0x40af3a['createHistory'](_0x5d33be)['catch'](loggerCatch(_0x2576('0x1bd')));if(_0x40af3a['checkRetriveMax'](0x8,_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be['countcongestionretry']>=_0x1cd0d5[_0x2576('0x19c')]){_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,'reason\x208\x20congestion');}else{_0x40af3a['stateGlobal'](_0x5d33be,_0x4d42fa,_0x400161,'reason\x208\x20congestion');}}break;case'11':_0x1cd0d5[_0x2576('0x1be')]+=0x1;_0x5d33be[_0x2576('0xeb')]=0xb;_0x5d33be[_0x2576('0xaf')]=_0x2576('0x1bf');_0x5d33be[_0x2576('0xfa')]+=0x1;_0x5d33be[_0x2576('0xf3')]+=0x1;_0x40af3a[_0x2576('0xd1')](_0x5d33be)[_0x2576('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x40af3a[_0x2576('0x198')](0xb,_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be[_0x2576('0xfa')]>=_0x1cd0d5[_0x2576('0x1c0')]){_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1c1'));}else{_0x40af3a[_0x2576('0xfd')](_0x5d33be,_0x4d42fa,_0x400161,'reason\x2011\x20abandoned');}}break;case'20':_0x1cd0d5[_0x2576('0x6c')]+=0x1;_0x5d33be[_0x2576('0xeb')]=0x14;_0x5d33be['statedesc']='AgentReject';_0x5d33be[_0x2576('0xfb')]+=0x1;_0x5d33be[_0x2576('0xf3')]+=0x1;ami[_0x2576('0x52')](_0x2576('0x1c2'),ut[_0x2576('0x1a9')](_0x2b7c2b,_0x2576('0x1c3')));_0x40af3a[_0x2576('0xd1')](_0x5d33be)[_0x2576('0xb7')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x40af3a[_0x2576('0x198')](0x14,_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be[_0x2576('0xfb')]>=_0x1cd0d5[_0x2576('0x1a1')]){_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1c4'));}else{_0x40af3a[_0x2576('0xfd')](_0x5d33be,_0x4d42fa,_0x400161,_0x2576('0x1c4'));}}break;default:_0x1cd0d5['outboundUnknownCallsDay']+=0x1;_0x5d33be[_0x2576('0xeb')]=0xc;_0x5d33be[_0x2576('0xaf')]=_0x552a75[_0x2576('0x112')];_0x40af3a['createHistory'](_0x5d33be)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x40af3a['checkRetriveMax'](_0x552a75['reason'],_0x2b7c2b,_0x1cd0d5)){if(_0x5d33be[_0x2576('0xf5')]+_0x5d33be[_0x2576('0xf6')]+_0x5d33be[_0x2576('0xf7')]+_0x5d33be[_0x2576('0xf8')]+_0x5d33be[_0x2576('0xf9')]+_0x5d33be[_0x2576('0xfa')]+_0x5d33be[_0x2576('0xf2')]+_0x5d33be[_0x2576('0xfb')]>=_0x1cd0d5[_0x2576('0xfc')]){_0x40af3a[_0x2576('0xfd')](_0x5d33be,_0x4d42fa,_0x400161,_0x552a75['reason']);}else{_0x40af3a[_0x2576('0xff')](_0x5d33be,_0x4d42fa,_0x400161,_0x552a75['reason']);}}}});};Dialer[_0x2576('0x1c')][_0x2576('0xfd')]=function(_0x55f4b0,_0x3183f9,_0x28cd6d,_0x286f24){var _0x13075c=new Final(_0x55f4b0);_0x13075c[_0x2576('0xeb')]=0xf;_0x13075c[_0x2576('0xaf')]=_0x2576('0x1c5');this[_0x2576('0xff')](_0x13075c,_0x3183f9,_0x28cd6d,_0x286f24);};Dialer[_0x2576('0x1c')][_0x2576('0xff')]=function(_0x3219ea,_0x1ea8c1,_0x64c4ea,_0x145431){this[_0x2576('0xcf')](_0x3219ea)[_0x2576('0xbe')](function(){return _0x1ea8c1(msgResponse(_0x2576('0x1a4'),'Success',_0x145431));})[_0x2576('0xb7')](function(){return _0x64c4ea(msgResponse(_0x2576('0x1c6'),_0x2576('0x149'),_0x2576('0x1c7')));});};Dialer['prototype'][_0x2576('0xb')]=function(_0x3b330d){var _0x467667=_0x3b330d[_0x2576('0x1c8')]/0x64;var _0x4e0ff4=_0x3b330d[_0x2576('0x68')]/(_0x3b330d[_0x2576('0x68')]+_0x3b330d[_0x2576('0xea')]);var _0x25be8b=Math[_0x2576('0x1c9')](_0x3b330d[_0x2576('0x1ca')]*(_0x3b330d[_0x2576('0x1cb')]/0x64));var _0x58fe4e=Math[_0x2576('0x1c9')](_0x3b330d[_0x2576('0x1ca')]*(_0x3b330d[_0x2576('0x1cc')]/0x64));var _0x596f9e=_0x3b330d['available']+_0x3b330d[_0x2576('0xa8')];var _0x10079f=Math[_0x2576('0x1cd')](_0x3b330d['erlangCalls']*_0x3b330d[_0x2576('0x91')]*_0x3b330d[_0x2576('0x74')]*_0x3b330d[_0x2576('0x75')]);if(_[_0x2576('0x40')](_0x3b330d[_0x2576('0x2a')])){if(!_[_0x2576('0x40')](_0x3b330d[_0x2576('0x29')])){_0x3b330d[_0x2576('0x29')]=undefined;loggerPredictive['error'](_0x2576('0x1ce'),_0x2576('0x1cf'));}if(!_[_0x2576('0x40')](_0x3b330d[_0x2576('0x96')])){loggerPredictive[_0x2576('0x9b')](_0x2576('0x1ce'),_0x2576('0x1d0'));clearInterval(_0x3b330d[_0x2576('0x96')]);_0x3b330d[_0x2576('0x96')]=undefined;}_0x3b330d[_0x2576('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3b330d[_0x2576('0x42')],_0x2576('0x1d1'),_0x3b330d[_0x2576('0x2a')]);this[_0x2576('0x160')](_0x3b330d,0x1);}else if(ifInterval(_0x3b330d['dialPredictiveInterval'],_0x3b330d[_0x2576('0x2a')])){this[_0x2576('0x160')](_0x3b330d,0x1);loggerPredictiveCalls[_0x2576('0x87')](_0x2576('0x1d2'),_0x3b330d[_0x2576('0x2a')],_0x3b330d[_0x2576('0x42')]);_0x3b330d['erlangCalls']=0x0;_0x3b330d[_0x2576('0x73')]=0x0;}else if(_0x467667<_0x4e0ff4&&_0x3b330d[_0x2576('0x1d3')]===_0x2576('0x1d4')){freeVariablesPredictive(_0x3b330d);loggerPredictive[_0x2576('0x87')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x2576('0x1d5'),_0x4e0ff4,'startProgressive',_0x3b330d[_0x2576('0x42')]);}else if(_0x10079f<_0x3b330d[_0x2576('0x73')]&&_0x3b330d[_0x2576('0x1d3')]===_0x2576('0x1d4')){freeVariablesPredictive(_0x3b330d);loggerPredictive[_0x2576('0x87')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2576('0x1d6'),_0x10079f,'Drop\x20in\x20this\x20interval',_0x3b330d[_0x2576('0x73')],'startProgressive',_0x3b330d[_0x2576('0x42')]);}else if(!ifInterval(_0x3b330d[_0x2576('0x1d7')],_0x3b330d[_0x2576('0x2a')])&&_[_0x2576('0x40')](_0x3b330d[_0x2576('0x29')])&&!_[_0x2576('0x40')](_0x3b330d[_0x2576('0x2a')])){_0x3b330d[_0x2576('0x29')]=moment()['format'](_0x2576('0x116'));loggerPredictive[_0x2576('0x87')](_0x3b330d['name'],_0x2576('0x1d8'),_0x3b330d[_0x2576('0x29')]);this['averageHandleTime'](_0x3b330d['dialPredictiveInterval'])[_0x2576('0xbe')](this[_0x2576('0x1d9')](_0x3b330d))[_0x2576('0xbe')](mergeDataErlangB(_0x3b330d))[_0x2576('0xbe')](this['startMethodPredictive'](_0x3b330d))[_0x2576('0xb7')](loggerCatchPredictive(_0x2576('0x1da'),_0x3b330d));}else if(!ifInterval(_0x3b330d[_0x2576('0x1d7')],_0x3b330d[_0x2576('0x29')])){_0x3b330d[_0x2576('0x73')]=0x0;_0x3b330d[_0x2576('0x29')]=moment()[_0x2576('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3b330d[_0x2576('0x42')],'recalculate\x20predictive\x20at',_0x3b330d['startPredictive']);clearInterval(_0x3b330d[_0x2576('0x96')]);_0x3b330d['handlePredictive']=undefined;this[_0x2576('0xc4')](_0x3b330d[_0x2576('0x1d7')])[_0x2576('0xbe')](this[_0x2576('0x1d9')](_0x3b330d))[_0x2576('0xbe')](mergeDataErlangB(_0x3b330d))[_0x2576('0xbe')](this['startMethodPredictive'](_0x3b330d))[_0x2576('0xb7')](loggerCatchPredictive(_0x2576('0x1db'),_0x3b330d));}else if(_0x3b330d['predictiveIntervalAvailable']&&_0x596f9e<_0x3b330d['predictiveIntervalAvailable']-_0x58fe4e){freeVariablesPredictive(_0x3b330d);loggerPredictive['info'](_0x3b330d[_0x2576('0x42')],_0x2576('0x1dc'),_0x596f9e,')\x20are\x20less\x20than\x20threshold\x20(',_0x3b330d[_0x2576('0x1ca')],'-',_0x58fe4e,'=',_0x3b330d['predictiveIntervalAvailable']-_0x58fe4e,')');}else if(_0x3b330d[_0x2576('0x1ca')]&&_0x596f9e>_0x3b330d[_0x2576('0x1ca')]+_0x25be8b){freeVariablesPredictive(_0x3b330d);loggerPredictive[_0x2576('0x87')](_0x3b330d[_0x2576('0x42')],_0x2576('0x1dc'),_0x596f9e,_0x2576('0x1dd'),_0x3b330d['predictiveIntervalAvailable'],'+',_0x25be8b,'=',_0x3b330d['predictiveIntervalAvailable']+_0x25be8b,')');}};Dialer[_0x2576('0x1c')]['getDataPredictive']=function(_0x5b29cb){var _0x204670=this;return function(_0x3eaf96){return new BPromise(function(_0x391c11,_0x2965ce){_[_0x2576('0x93')](_0x5b29cb,_0x3eaf96[0x0]);if(checkGetDataPredictive(_0x3eaf96[0x0])){var _0x144532=_0x5b29cb[_0x2576('0x1ca')]=_0x5b29cb[_0x2576('0xa8')]+_0x5b29cb[_0x2576('0xa9')];var _0x2370a5=_0x5b29cb['dialPredictiveInterval']*0x3c;var _0xe8cd18=_0x3eaf96[0x0]['predictiveIntervalAvgTalktime']+_0x3eaf96[0x0][_0x2576('0x8a')];var _0x307212=(_0x3eaf96[0x0][_0x2576('0x6e')]+_0x3eaf96[0x0][_0x2576('0x71')]+_0x3eaf96[0x0][_0x2576('0x70')])/_0x3eaf96[0x0][_0x2576('0x77')];_0x5b29cb[_0x2576('0x74')]=_0x307212>0x0?_0x307212:0x1;switch(_0x5b29cb[_0x2576('0x1d3')]){case _0x2576('0x1d4'):var _0x585691=_0x5b29cb[_0x2576('0x1c8')]/0x64;return _0x204670['abandonmentRate'](_0x144532,_0x2370a5,_0xe8cd18,_0x307212,_0x585691)['then'](function(_0x309652){return _0x391c11(_0x309652);});case'agentBusyFactor':var _0xb30edb=_0x5b29cb[_0x2576('0x1c8')]/0x64;return _0x204670[_0x2576('0x1de')](_0x144532,_0x2370a5,_0xe8cd18,_0x307212,_0xb30edb)[_0x2576('0xbe')](function(_0x1929ab){return _0x391c11(_0x1929ab);});default:return _0x2965ce(msgResponse(_0x2576('0x1df'),_0x2576('0x149'),'Unknown\x20Predictive'));}}else{return _0x2965ce(msgResponse('[getDataPredictive]','Failure',_0x2576('0x1e0')));}});};};Dialer['prototype'][_0x2576('0x1e1')]=function(_0x3a1d3b){var _0x22933e=this;return function(_0x55d5d5){return new BPromise(function(_0x36d2f1,_0x5f2a2c){_[_0x2576('0x93')](_0x3a1d3b,_0x55d5d5[0x0]);if(checkGetDataPredictive(_0x55d5d5[0x0])){loggerPredictive[_0x2576('0x87')](JSON[_0x2576('0x4e')](_0x55d5d5[0x0]));if(_0x3a1d3b[_0x2576('0x1d3')]===_0x2576('0x1d4')){return _0x22933e[_0x2576('0xcd')](_0x3a1d3b['id'])['then'](function(_0x4edee1){var _0x5ef13b=_0x3a1d3b[_0x2576('0x57')]-_0x4edee1[0x0][_0x2576('0x1e2')];var _0x42c0eb=_0x3a1d3b[_0x2576('0x1d7')]*0x3c;var _0x58dfb1=_0x55d5d5[0x0][_0x2576('0x6f')]+_0x55d5d5[0x0][_0x2576('0x8a')];var _0xfee091=(_0x55d5d5[0x0][_0x2576('0x6e')]+_0x55d5d5[0x0][_0x2576('0x71')]+_0x55d5d5[0x0][_0x2576('0x70')])/_0x55d5d5[0x0][_0x2576('0x77')];var _0x29cb67=_0x3a1d3b['dialPredictiveOptimizationPercentage']/0x64;_0x3a1d3b['predictiveIntervalPauses']=_0x4edee1[0x0]['outboundQueuePauses']||0x0;_0x3a1d3b[_0x2576('0x74')]=_0xfee091>0x0?_0xfee091:0x1;return _0x22933e[_0x2576('0x1e3')](_0x5ef13b,_0x42c0eb,_0x58dfb1,_0xfee091,_0x29cb67);})[_0x2576('0xbe')](function(_0x22c2b2){return _0x36d2f1(_0x22c2b2);})[_0x2576('0xb7')](function(_0x94825a){return _0x5f2a2c(msgResponse('[CatchErlangB]',_0x2576('0x149'),JSON[_0x2576('0x4e')](_0x94825a)));});}if(_0x3a1d3b[_0x2576('0x1d3')]==='agentBusyFactor'){return _0x22933e[_0x2576('0xcd')](_0x3a1d3b['id'])[_0x2576('0xbe')](function(_0x3e47ad){var _0x3f00a8=_0x3a1d3b[_0x2576('0x57')]-_0x3e47ad[0x0][_0x2576('0x1e2')];var _0x19c5b2=_0x3a1d3b[_0x2576('0x1d7')]*0x3c;var _0x366791=_0x55d5d5[0x0]['predictiveIntervalAvgTalktime']+_0x55d5d5[0x0]['predictiveIntervalAvgHoldtime'];var _0x4fe4dd=(_0x55d5d5[0x0][_0x2576('0x6e')]+_0x55d5d5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x55d5d5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x55d5d5[0x0][_0x2576('0x77')];var _0x299066=_0x3a1d3b[_0x2576('0x1c8')]/0x64;_0x3a1d3b['predictiveIntervalPauses']=_0x3e47ad[0x0]['outboundQueuePauses']||0x0;_0x3a1d3b['predictiveIntervalHitRate']=_0x4fe4dd>0x0?_0x4fe4dd:0x1;return _0x22933e['busyFactor'](_0x3f00a8,_0x19c5b2,_0x366791,_0x4fe4dd,_0x299066);})[_0x2576('0xbe')](function(_0x5c286e){return _0x36d2f1(_0x5c286e);})[_0x2576('0xb7')](function(_0x4eda9f){return _0x5f2a2c(msgResponse(_0x2576('0x1e4'),_0x2576('0x149'),JSON['stringify'](_0x4eda9f)));});}}else{return _0x5f2a2c(msgResponse(_0x2576('0x1df'),_0x2576('0x149'),_0x2576('0x1e0')));}});};};Dialer[_0x2576('0x1c')][_0x2576('0x1e5')]=function(_0x5dfc8c){var _0x466ab5=this;return function(){var _0x7926c2=0x0;var _0x2abb45=Math[_0x2576('0x1cd')](_0x5dfc8c['erlangCallToSecond']*0x3e8);if(_0x2abb45>0x0){_0x2abb45=_0x2abb45<0x64?0x64:_0x2abb45;loggerPredictive[_0x2576('0x87')](_0x5dfc8c[_0x2576('0x42')],_0x2576('0x1e6'),_0x2abb45,_0x2576('0x4f'));_0x5dfc8c[_0x2576('0x96')]=setInterval(function(){_0x466ab5[_0x2576('0x96')](_0x5dfc8c);loggerPredictiveCalls[_0x2576('0x87')](_0x2576('0x1e7'),_0x7926c2+=0x1);},_0x2abb45);}else{loggerPredictive['info'](_0x5dfc8c[_0x2576('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x2576('0x1c')][_0x2576('0x1e8')]=function(_0x31ca05,_0x2ff56f){var _0x3d24f0=this;return function(_0x31b277){if(_[_0x2576('0x4a')](_0x31b277)){if(_['isNil'](_0x2ff56f[_0x2576('0xd8')])||!_0x2ff56f[_0x2576('0x1e9')]){if(_0x31ca05[_0x2576('0x62')]==='booked'){_0x31ca05[_0x2576('0x137')]=_['isUndefined'](_0x31ca05[_0x2576('0x137')])?!![]:_0x31ca05[_0x2576('0x137')];var _0x14d887=uuid['v4']();_0x3d24f0[_0x2576('0xb4')][_0x14d887]=new Action(_0x31ca05,_0x2ff56f,_0x14d887);loggerBooked[_0x2576('0x87')](_0x2576('0x1ea'),_0x14d887,_0x2576('0x1eb'),JSON[_0x2576('0x4e')](_0x31ca05[_0x2576('0x137')]),_0x2576('0x1ec'),_0x31ca05[_0x2576('0x42')]);if(_0x31ca05['queueStatusComplete']){_0x31ca05[_0x2576('0x137')]=![];_0x3d24f0['queueBooked'][_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0xba')]]=[];ami[_0x2576('0x153')]({'actionid':_0x14d887,'action':_0x2576('0x1ed'),'queue':_0x31ca05[_0x2576('0x42')]})[_0x2576('0xb7')](function(){_0x3d24f0[_0x2576('0xb9')](_0x31ca05);_0x3d24f0[_0x2576('0xc6')]({'active':![],'ContactId':_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0xd7')],'ListId':_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0x103')],'VoiceQueueId':_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0xd9')]||undefined,'CampaignId':_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x1ee')));delete _0x3d24f0[_0x2576('0xb4')][_0x14d887];});}else{loggerBooked[_0x2576('0x87')](_0x2576('0x1ef'),JSON[_0x2576('0x4e')](_0x31ca05[_0x2576('0x137')]),'Queue:\x20',_0x31ca05[_0x2576('0x42')]);_0x3d24f0['updateOriginated'](_0x31ca05);_0x3d24f0[_0x2576('0xc6')]({'active':![],'ContactId':_0x3d24f0[_0x2576('0xb4')][_0x14d887]['ContactId'],'ListId':_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0x103')],'VoiceQueueId':_0x3d24f0['actions'][_0x14d887]['VoiceQueueId']||undefined,'CampaignId':_0x3d24f0[_0x2576('0xb4')][_0x14d887][_0x2576('0x104')]||undefined})[_0x2576('0xb7')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3d24f0[_0x2576('0xb4')][_0x14d887];}}else{return _0x3d24f0[_0x2576('0x16e')](_0x31ca05,_0x2ff56f);}}else{if(getDiff(_0x2ff56f[_0x2576('0x1f0')])<_0x31ca05[_0x2576('0x1f1')]*0x3c){if(_0x2ff56f[_0x2576('0x1f2')]&&!_0x2ff56f[_0x2576('0x1f2')]['voicePause']){_0x3d24f0[_0x2576('0x138')][_0x2576('0x139')](_0x2ff56f['id'])['finally'](function(){_0x3d24f0['updateOriginated'](_0x31ca05);});}else{_0x3d24f0['unlockContact']({'active':![]},_0x2ff56f['id'],0x1)[_0x2576('0x1f')](function(){_0x3d24f0[_0x2576('0xb9')](_0x31ca05);});}}else{_0x31ca05[_0x2576('0x1f3')]+=0x1;_0x3d24f0[_0x2576('0xb9')](_0x31ca05);if(_0x31ca05[_0x2576('0x1f4')]){_0x3d24f0[_0x2576('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2ff56f[_0x2576('0xd7')],'ListId':_0x2ff56f[_0x2576('0x103')],'VoiceQueueId':_0x2ff56f[_0x2576('0xd9')]||undefined,'CampaignId':_0x2ff56f['CampaignId']||undefined})[_0x2576('0xb7')](loggerCatch(_0x2576('0x1f5')));_0x3d24f0[_0x2576('0xd1')](createObjHistory(_0x31ca05,_0x2ff56f,_0x2576('0x1f6'),0x17,'RecallInQueue'))[_0x2576('0xb7')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3d24f0[_0x2576('0xed')](createObjHistory(_0x31ca05,_0x2ff56f,'RECALLFAILEDTIMEOUT',0x16,_0x2576('0x1f7')),'[Originate][HistoryRecallClose][historyCatch]',_0x2576('0x1f8'));}}}}else{_0x31ca05[_0x2576('0x66')]+=0x1;_0x3d24f0['saveInDb'](createObjHistory(_0x31ca05,_0x2ff56f,_0x2576('0x1f9'),0xd,'Blacklist'),_0x2576('0x1fa'),_0x2576('0x1fb'));throw _0x2576('0x1fc');}};};Dialer[_0x2576('0x1c')]['handleIvr']=function(_0x542c56){var _0xfd595f=this;var _0x120fe6=_0x542c56[_0x2576('0x1fd')]-_0x542c56[_0x2576('0x78')]-_0x542c56[_0x2576('0x1fe')];emitCampaignSummary(_0x542c56);if(_0x120fe6>0x0){if(_0x120fe6>this[_0x2576('0x25')]){_0x120fe6=this[_0x2576('0x25')];}_0x542c56['temp']+=_0x120fe6;this[_0x2576('0xcc')](_0x542c56['id'],_0x120fe6,_0x542c56[_0x2576('0x1ff')])[_0x2576('0xbe')](function(_0x1893ab){_0x542c56['temp']-=_0x120fe6;_0x542c56[_0x2576('0x1fe')]=_0x542c56[_0x2576('0x1fe')]>0x0?_0x542c56['temp']:0x0;if(!checkContactEmpty(_0x1893ab)){_0x542c56[_0x2576('0x4b')]=_0x2576('0xa5');logger['info'](_0x2576('0x200')+_0x542c56[_0x2576('0x42')]);}else{_0x542c56[_0x2576('0x78')]+=_0x1893ab['length'];_0x542c56['message']=_0x2576('0x201');for(var _0x5985fa=0x0;_0x5985fa<_0x1893ab[_0x2576('0x9e')];_0x5985fa+=0x1){_0x542c56[_0x2576('0x202')]+=0x1;if(_['isNil'](_0x1893ab[_0x5985fa])||_[_0x2576('0xe3')](_0x1893ab[_0x5985fa][_0x2576('0x180')])||_[_0x2576('0xe3')](_0x1893ab[_0x5985fa]['Contact'][_0x2576('0x171')])){_0xfd595f[_0x2576('0xd5')](_0x2576('0x203'),_0x542c56,_0x1893ab[_0x5985fa]);}else{_0xfd595f['checkIsBlackListIvr'](_[_0x2576('0x135')](_0x1893ab[_0x5985fa],['CampaignId',_0x2576('0x204')]))[_0x2576('0xbe')](_0xfd595f[_0x2576('0x1e8')](_0x542c56,_0x1893ab[_0x5985fa]))[_0x2576('0xb7')](_0xfd595f[_0x2576('0xd4')](_0x2576('0x205'),_0x542c56));}}}})[_0x2576('0xb7')](loggerGetContactDialer(_0x2576('0x206'),_0x542c56,_0x120fe6));}};Dialer['prototype']['handlePower']=function(_0x45369e,_0x4960b7){var _0x8589f9=this;var _0x2d5c9b=[];var _0x52717f=_0x4960b7>=0x1?_0x4960b7:0x1;if(_0x45369e[_0x2576('0x62')]==='booked'){_0x52717f=0x1;}var _0x2c0d6d=Math['floor'](_0x45369e['available']*_0x52717f)-_0x45369e[_0x2576('0x78')]-_0x45369e[_0x2576('0x1fe')];emitVoiceQueueSummary(_0x45369e);if(_0x45369e[_0x2576('0x207')]>0x0){var _0x29020e=_0x45369e['dialLimitQueue']-_0x45369e['originated']-_0x45369e[_0x2576('0xa8')]-_0x45369e[_0x2576('0x1fe')]-_0x45369e[_0x2576('0x58')];if(_0x2c0d6d>_0x29020e){_0x2c0d6d=_0x29020e;}}if(_0x2c0d6d>0x0){if(_0x45369e[_0x2576('0x62')]===_0x2576('0xa')){_0x2c0d6d=0x1;}if(_0x2c0d6d>this[_0x2576('0x25')]){_0x2c0d6d=this[_0x2576('0x25')];}_0x45369e['temp']+=_0x2c0d6d;for(var _0x58b674 in this['agents']){if(typeof this[_0x2576('0x23')][_0x58b674]!==_0x2576('0xb6')){if(this[_0x2576('0x23')][_0x58b674][_0x2576('0xeb')]===_0x2576('0x208')&&this[_0x2576('0x23')][_0x58b674]['status']===_0x2576('0xe0')){_0x2d5c9b[_0x2576('0x134')](this['agents'][_0x58b674]['id']);}}}this[_0x2576('0xca')](_0x45369e['id'],_0x2d5c9b,_0x2c0d6d,_0x45369e['dialOrderByScheduledAt'])[_0x2576('0xbe')](function(_0x390963){_0x45369e[_0x2576('0x1fe')]-=_0x2c0d6d;_0x45369e[_0x2576('0x1fe')]=_0x45369e[_0x2576('0x1fe')]>0x0?_0x45369e[_0x2576('0x1fe')]:0x0;if(!checkContactEmpty(_0x390963)){_0x8589f9[_0x2576('0xbd')](_0x45369e)[_0x2576('0xbe')](sendMessageReschedule(_0x45369e))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x45369e[_0x2576('0x78')]+=_0x390963[_0x2576('0x9e')];_0x45369e['message']=_0x45369e[_0x2576('0x62')]===_0x2576('0xa')?_0x2576('0x209'):_0x2576('0x201');for(var _0x50fd61=0x0;_0x50fd61<_0x390963[_0x2576('0x9e')];_0x50fd61+=0x1){if(_[_0x2576('0xe3')](_0x390963[_0x50fd61])||_[_0x2576('0xe3')](_0x390963[_0x50fd61][_0x2576('0x180')])||_[_0x2576('0xe3')](_0x390963[_0x50fd61]['Contact'][_0x2576('0x171')])){_0x8589f9['emptyContact'](_0x2576('0x203'),_0x45369e,_0x390963[_0x50fd61]);}else{_0x8589f9[_0x2576('0xbf')](_[_0x2576('0x135')](_0x390963[_0x50fd61],[_0x2576('0xd9'),_0x2576('0x204')]))[_0x2576('0xbe')](_0x8589f9['checkContactBlack'](_0x45369e,_0x390963[_0x50fd61]))['catch'](_0x8589f9[_0x2576('0xd4')](_0x2576('0x203'),_0x45369e));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x45369e,_0x2c0d6d));}};Dialer[_0x2576('0x1c')][_0x2576('0x96')]=function(_0x281830){if(_0x281830[_0x2576('0x207')]>0x0){var _0x227119=_0x281830[_0x2576('0x207')]-_0x281830['originated']-_0x281830[_0x2576('0xa8')];if(_0x227119>0x0){this[_0x2576('0x20a')](_0x281830);}else{loggerPredictiveCalls[_0x2576('0x87')]('[handlePredictive][limitChannel]');}}else{this[_0x2576('0x20a')](_0x281830);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x20197a){var _0x70784=this;var _0x574895=[];_0x20197a[_0x2576('0x78')]+=0x1;for(var _0x3ceccf in this[_0x2576('0x23')]){if(typeof this[_0x2576('0x23')][_0x3ceccf]!==_0x2576('0xb6')){if(this[_0x2576('0x23')][_0x3ceccf][_0x2576('0xeb')]==='not_inuse'&&this['agents'][_0x3ceccf][_0x2576('0xdf')]==='reachable'){_0x574895['push'](this[_0x2576('0x23')][_0x3ceccf]['id']);}}}this[_0x2576('0xca')](_0x20197a['id'],_0x574895,0x1,_0x20197a[_0x2576('0x1ff')])[_0x2576('0xbe')](function(_0x3b296d){if(!checkContactEmpty(_0x3b296d)){checkContactLowerLimitOriginate(_0x20197a,0x1,0x0);_0x70784[_0x2576('0xbd')](_0x20197a)[_0x2576('0xbe')](sendMessageReschedule(_0x20197a))[_0x2576('0xb7')](loggerCatch(_0x2576('0x20b')));}else{_0x20197a[_0x2576('0x4b')]=_0x2576('0x201');if(_[_0x2576('0xe3')](_0x3b296d[0x0])||_[_0x2576('0xe3')](_0x3b296d[0x0][_0x2576('0x180')])||_['isNil'](_0x3b296d[0x0]['Contact'][_0x2576('0x171')])){_0x70784[_0x2576('0xd5')](_0x2576('0x203'),_0x20197a,_0x3b296d[0x0]);}else{_0x70784[_0x2576('0xbf')](_['pick'](_0x3b296d[0x0],['VoiceQueueId',_0x2576('0x204')]))[_0x2576('0xbe')](_0x70784[_0x2576('0x1e8')](_0x20197a,_0x3b296d[0x0]))[_0x2576('0xb7')](_0x70784['loggerHandler']('[actionOriginatePredictive]\x20',_0x20197a));}}})[_0x2576('0xb7')](loggerGetContactDialer(_0x2576('0x20c'),_0x20197a,0x1));emitVoiceQueueSummary(_0x20197a);};Dialer[_0x2576('0x1c')]['abandonmentRate']=function(_0x23aa46,_0x515ddb,_0x100200,_0x2f1381,_0x43952d,_0x669fd1){loggerPredictive[_0x2576('0x87')](_0x2576('0x20d'));loggerPredictive['info'](_0x2576('0x20e'),_0x23aa46);loggerPredictive['info'](_0x2576('0x20f'),_0x515ddb);loggerPredictive[_0x2576('0x87')](_0x2576('0x210'),_0x100200);loggerPredictive[_0x2576('0x87')](_0x2576('0x211'),_0x2f1381);loggerPredictive[_0x2576('0x87')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43952d);loggerPredictive[_0x2576('0x87')](_0x2576('0x8c'));return new BPromise(function(_0x57a8e5,_0x824e6b){if(_0x23aa46<=0x0||isNaN(_0x23aa46)){return _0x824e6b(msgResponse('[abandonmentRate]',_0x2576('0x4d'),_0x2576('0x212')+_0x23aa46));}if(_0x100200<=0x0||isNaN(_0x100200)){return _0x824e6b(msgResponse('[abandonmentRate]','Error',_0x2576('0x213')+_0x100200));}if(_0x2f1381<=0x0||isNaN(_0x2f1381)){return _0x824e6b(msgResponse('[abandonmentRate]',_0x2576('0x4d'),'p\x20=\x20'+_0x2f1381));}if(_0x515ddb<=0x0||isNaN(_0x515ddb)){return _0x824e6b(msgResponse('[abandonmentRate]',_0x2576('0x4d'),_0x2576('0x214')+_0x515ddb));}if(_0x43952d<=0x0||isNaN(_0x43952d)){return _0x824e6b(msgResponse('[abandonmentRate]',_0x2576('0x4d'),'Amax\x20=\x20'+_0x43952d));}_0x669fd1=_0x669fd1||0x0;var _0x3f6a6c=0x1/_0x100200;var _0x218432=0x0;var _0x1a12a2=0x0;var _0xacee2=0x0;var _0x47953d=0x0;for(var _0x6da97d=0x0;_0xacee2<_0x43952d;_0x6da97d+=0x1){_0x1a12a2=_0x6da97d/_0x515ddb;_0x218432=(_0x2f1381*_0x1a12a2+_0x669fd1)/_0x3f6a6c;_0xacee2=erlangb(_0x218432,_0x23aa46);_0x47953d=_0x218432/_0x23aa46*(0x1-erlangb(_0x218432,_0x23aa46));}return _0x57a8e5({'erlangCalls':_0x6da97d,'erlangCallToSecond':_0x515ddb/_0x6da97d,'erlangAbandonmentRate':_0xacee2,'erlangBusyFactor':_0x47953d});});};Dialer[_0x2576('0x1c')][_0x2576('0x1de')]=function(_0x4ca4df,_0x17874e,_0x12ae64,_0x3b7b62,_0x2c2526,_0xa898db){loggerPredictive[_0x2576('0x87')](_0x2576('0x215'));loggerPredictive[_0x2576('0x87')](_0x2576('0x20e'),_0x4ca4df);loggerPredictive[_0x2576('0x87')](_0x2576('0x20f'),_0x17874e);loggerPredictive['info'](_0x2576('0x210'),_0x12ae64);loggerPredictive['info'](_0x2576('0x211'),_0x3b7b62);loggerPredictive['info'](_0x2576('0x216'),_0x2c2526);loggerPredictive[_0x2576('0x87')]('---------------------------');return new BPromise(function(_0x4b0113,_0x427f54){if(_0x4ca4df<=0x0||isNaN(_0x4ca4df)){return _0x427f54(msgResponse(_0x2576('0x217'),_0x2576('0x4d'),_0x2576('0x212')+_0x4ca4df));}if(_0x12ae64<=0x0||isNaN(_0x12ae64)){return _0x427f54(msgResponse(_0x2576('0x217'),_0x2576('0x4d'),'Ts\x20=\x20'+_0x12ae64));}if(_0x3b7b62<=0x0||isNaN(_0x3b7b62)){return _0x427f54(msgResponse(_0x2576('0x217'),_0x2576('0x4d'),_0x2576('0x218')+_0x3b7b62));}if(_0x17874e<=0x0||isNaN(_0x17874e)){return _0x427f54(msgResponse(_0x2576('0x217'),'Error',_0x2576('0x214')+_0x17874e));}if(_0x2c2526<=0x0||isNaN(_0x2c2526)){return _0x427f54(msgResponse(_0x2576('0x217'),_0x2576('0x4d'),_0x2576('0x219')+_0x2c2526));}_0xa898db=_0xa898db||0x0;var _0x2e9317=0x1/_0x12ae64;var _0x646b85=0x0;var _0x8ead0e=0x0;var _0x3883d9=0x0;var _0x30caaa=0x0;for(var _0x43bcd1=0x0;_0x30caaa<_0x2c2526;_0x43bcd1+=0x1){_0x8ead0e=_0x43bcd1/_0x17874e;_0x646b85=(_0x3b7b62*_0x8ead0e+_0xa898db)/_0x2e9317;_0x3883d9=erlangb(_0x646b85,_0x4ca4df);_0x30caaa=_0x646b85/_0x4ca4df*(0x1-erlangb(_0x646b85,_0x4ca4df));}return _0x4b0113({'erlangCalls':_0x43bcd1,'erlangCallToSecond':_0x17874e/_0x43bcd1,'erlangAbandonmentRate':_0x3883d9,'erlangBusyFactor':_0x30caaa});});};module[_0x2576('0x21a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index d221bb7..e6047ed 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85be=['countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','reason','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85be,0x1dd));var _0xe85b=function(_0x1af8ca,_0xb66fef){_0x1af8ca=_0x1af8ca-0x0;var _0x3d69e5=_0x85be[_0x1af8ca];return _0x3d69e5;};'use strict';var util=require(_0xe85b('0x0'));var _=require('lodash');var moment=require(_0xe85b('0x1'));function getSeconds(_0x51f1ef,_0x11fd7d){var _0x2b2098=moment(_0x51f1ef)[_0xe85b('0x2')](0x0);var _0x902690=moment(_0x11fd7d)[_0xe85b('0x2')](0x0);return _0x2b2098[_0xe85b('0x3')](_0x902690,_0xe85b('0x4'));}function QueueCallerAbandon(_0x10009b,_0x51ae2d){this['scheduledat']=_0x10009b[_0xe85b('0x5')];this[_0xe85b('0x6')]=_0x10009b['type'];this[_0xe85b('0x7')]=_0x10009b[_0xe85b('0x6')]===_0xe85b('0x8')?_0xe85b('0x9'):_0x10009b[_0xe85b('0x6')];this[_0xe85b('0xa')]=_0x10009b[_0xe85b('0xa')];this[_0xe85b('0xb')]=_0x10009b[_0xe85b('0xb')];this[_0xe85b('0xc')]=_0x10009b['countnoanswerretry'];this['countglobal']=_0x10009b[_0xe85b('0xa')]+_0x10009b[_0xe85b('0xb')]+_0x10009b['countnoanswerretry']+_0x10009b[_0xe85b('0xd')]+_0x10009b[_0xe85b('0xe')]+_0x10009b[_0xe85b('0xf')]+_0x10009b['countmachineretry']+_0x10009b[_0xe85b('0x10')];this[_0xe85b('0xd')]=_0x10009b[_0xe85b('0xd')];this['countdropretry']=_0x10009b[_0xe85b('0xe')];this[_0xe85b('0xf')]=_0x10009b[_0xe85b('0xf')];this[_0xe85b('0x11')]=_0x10009b[_0xe85b('0x11')];this['countagentrejectretry']=_0x10009b[_0xe85b('0x10')];this[_0xe85b('0x12')]=_0x51ae2d[_0xe85b('0x12')];this[_0xe85b('0x13')]=_0x10009b[_0xe85b('0x14')];this[_0xe85b('0x15')]=_0x10009b[_0xe85b('0x16')];this[_0xe85b('0x17')]=_0x10009b[_0xe85b('0x17')];this[_0xe85b('0x18')]=_0x10009b[_0xe85b('0x18')];this[_0xe85b('0x19')]=_0x10009b['droptime'];this['endtime']=this[_0xe85b('0x19')];this[_0xe85b('0x1a')]=getSeconds(_0x10009b[_0xe85b('0x18')],_0x10009b['starttime']);this[_0xe85b('0x1b')]=getSeconds(this[_0xe85b('0x19')],_0x10009b[_0xe85b('0x18')]);this[_0xe85b('0x1c')]=0x0;this['queue']=_0x51ae2d[_0xe85b('0x9')];this['membername']=_0x51ae2d['connectedlinename'];this[_0xe85b('0x1d')]=_0x51ae2d['reason'];this['callback']=_0x10009b['callback'];this['callbackuniqueid']=_0x10009b['callbackuniqueid'];this[_0xe85b('0x1e')]=_0x10009b[_0xe85b('0x1e')];this['recallme']=_0x10009b['recallme'];this['ContactId']=_0x10009b[_0xe85b('0x1f')];this[_0xe85b('0x20')]=_0x10009b[_0xe85b('0x20')];this['UserId']=_0x10009b[_0xe85b('0x21')];this[_0xe85b('0x22')]=_0x10009b[_0xe85b('0x22')];this['CampaignId']=_0x10009b[_0xe85b('0x23')];this[_0xe85b('0x24')]=_0x10009b[_0xe85b('0x24')]||'';this[_0xe85b('0x25')]=_0x10009b['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x6944=['number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x6944,0x1ba));var _0x4694=function(_0x521ba2,_0x1fc36d){_0x521ba2=_0x521ba2-0x0;var _0x5d3e30=_0x6944[_0x521ba2];return _0x5d3e30;};'use strict';var util=require(_0x4694('0x0'));var _=require(_0x4694('0x1'));var moment=require('moment');function getSeconds(_0x409af6,_0x51cd77){var _0x581b04=moment(_0x409af6)[_0x4694('0x2')](0x0);var _0x537bdc=moment(_0x51cd77)[_0x4694('0x2')](0x0);return _0x581b04[_0x4694('0x3')](_0x537bdc,_0x4694('0x4'));}function QueueCallerAbandon(_0x12c7f3,_0x3fb4b4){this['scheduledat']=_0x12c7f3['scheduledat'];this[_0x4694('0x5')]=_0x12c7f3[_0x4694('0x5')];this[_0x4694('0x6')]=_0x12c7f3['type']===_0x4694('0x7')?_0x4694('0x8'):_0x12c7f3['type'];this[_0x4694('0x9')]=_0x12c7f3['countbusyretry'];this[_0x4694('0xa')]=_0x12c7f3[_0x4694('0xa')];this[_0x4694('0xb')]=_0x12c7f3[_0x4694('0xb')];this['countglobal']=_0x12c7f3['countbusyretry']+_0x12c7f3[_0x4694('0xa')]+_0x12c7f3[_0x4694('0xb')]+_0x12c7f3['countnosuchnumberretry']+_0x12c7f3[_0x4694('0xc')]+_0x12c7f3[_0x4694('0xd')]+_0x12c7f3[_0x4694('0xe')]+_0x12c7f3[_0x4694('0xf')];this[_0x4694('0x10')]=_0x12c7f3[_0x4694('0x10')];this[_0x4694('0xc')]=_0x12c7f3['countdropretry'];this[_0x4694('0xd')]=_0x12c7f3[_0x4694('0xd')];this[_0x4694('0xe')]=_0x12c7f3[_0x4694('0xe')];this['countagentrejectretry']=_0x12c7f3['countagentrejectretry'];this[_0x4694('0x11')]=_0x3fb4b4[_0x4694('0x11')];this[_0x4694('0x12')]=_0x12c7f3[_0x4694('0x13')];this['calleridnum']=_0x12c7f3[_0x4694('0x14')];this[_0x4694('0x15')]=_0x12c7f3[_0x4694('0x15')];this[_0x4694('0x16')]=_0x12c7f3[_0x4694('0x16')];this[_0x4694('0x17')]=_0x12c7f3[_0x4694('0x17')];this[_0x4694('0x18')]=this['droptime'];this['ringtime']=getSeconds(_0x12c7f3['responsetime'],_0x12c7f3['starttime']);this[_0x4694('0x19')]=getSeconds(this['droptime'],_0x12c7f3[_0x4694('0x16')]);this[_0x4694('0x1a')]=0x0;this[_0x4694('0x8')]=_0x3fb4b4['queue'];this[_0x4694('0x1b')]=_0x3fb4b4[_0x4694('0x1c')];this['reason']=_0x3fb4b4[_0x4694('0x1d')];this[_0x4694('0x1e')]=_0x12c7f3['callback'];this[_0x4694('0x1f')]=_0x12c7f3['callbackuniqueid'];this[_0x4694('0x20')]=_0x12c7f3[_0x4694('0x20')];this[_0x4694('0x21')]=_0x12c7f3[_0x4694('0x21')];this['ContactId']=_0x12c7f3[_0x4694('0x22')];this[_0x4694('0x23')]=_0x12c7f3[_0x4694('0x23')];this[_0x4694('0x24')]=_0x12c7f3['UserId'];this[_0x4694('0x25')]=_0x12c7f3[_0x4694('0x25')];this[_0x4694('0x26')]=_0x12c7f3[_0x4694('0x26')];this['originatecalleridnum']=_0x12c7f3[_0x4694('0x27')]||'';this[_0x4694('0x28')]=_0x12c7f3[_0x4694('0x28')]||'';}module[_0x4694('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d5feca1..75a1ef6 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 _0x6b07=['format','%s/%s/%s','Trunk','name','localstationid','headerinfo','path','AttachmentId','util','moment','uniqueid','channel'];(function(_0x3c957d,_0x40d8f3){var _0x46ab64=function(_0x470663){while(--_0x470663){_0x3c957d['push'](_0x3c957d['shift']());}};_0x46ab64(++_0x40d8f3);}(_0x6b07,0xb0));var _0x76b0=function(_0x1a45d9,_0x123386){_0x1a45d9=_0x1a45d9-0x0;var _0x1f651b=_0x6b07[_0x1a45d9];return _0x1f651b;};'use strict';var util=require(_0x76b0('0x0'));var _=require('lodash');var moment=require(_0x76b0('0x1'));function Action(_0x4a87e9,_0xc0b306,_0x6041bf){this[_0x76b0('0x2')]=_0x4a87e9||undefined;this[_0x76b0('0x3')]=util[_0x76b0('0x4')](_0x76b0('0x5'),_0xc0b306['tech'],_0xc0b306[_0x76b0('0x6')][_0x76b0('0x7')],_0x6041bf['fax']);this[_0x76b0('0x8')]=_0xc0b306[_0x76b0('0x8')];this[_0x76b0('0x9')]=_0xc0b306[_0x76b0('0x9')];this['path']=_0x6041bf[_0x76b0('0xa')];this[_0x76b0('0xb')]=_0x6041bf['AttachmentId'];}module['exports']=Action; \ No newline at end of file +var _0x2283=['exports','util','lodash','uniqueid','channel','format','name','localstationid','headerinfo','path','AttachmentId'];(function(_0x315f57,_0x2a5726){var _0x1cc470=function(_0x5e3f01){while(--_0x5e3f01){_0x315f57['push'](_0x315f57['shift']());}};_0x1cc470(++_0x2a5726);}(_0x2283,0x109));var _0x3228=function(_0x57997d,_0x31ff84){_0x57997d=_0x57997d-0x0;var _0x5f2156=_0x2283[_0x57997d];return _0x5f2156;};'use strict';var util=require(_0x3228('0x0'));var _=require(_0x3228('0x1'));var moment=require('moment');function Action(_0x313283,_0x92b004,_0xea06ac){this[_0x3228('0x2')]=_0x313283||undefined;this[_0x3228('0x3')]=util[_0x3228('0x4')]('%s/%s/%s',_0x92b004['tech'],_0x92b004['Trunk'][_0x3228('0x5')],_0xea06ac['fax']);this['localstationid']=_0x92b004[_0x3228('0x6')];this[_0x3228('0x7')]=_0x92b004['headerinfo'];this[_0x3228('0x8')]=_0xea06ac[_0x3228('0x8')];this[_0x3228('0x9')]=_0xea06ac[_0x3228('0x9')];}module[_0x3228('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 307f448..cae0816 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 _0x76d2=['syncVarSet','syncNewState','newexten','syncNewExten','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','hasOwnProperty','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','then','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','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','execute','%s/%s.tif','dir','XMF-PATH','variablesAction','.pdf','isTrunkReachable','isNil','active','format','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset'];(function(_0x42f737,_0x888f9c){var _0x1e7b98=function(_0x567c19){while(--_0x567c19){_0x42f737['push'](_0x42f737['shift']());}};_0x1e7b98(++_0x888f9c);}(_0x76d2,0x14a));var _0x276d=function(_0x621d35,_0x505c90){_0x621d35=_0x621d35-0x0;var _0x17325c=_0x76d2[_0x621d35];return _0x17325c;};'use strict';var util=require(_0x276d('0x0'));var _=require(_0x276d('0x1'));var BPromise=require(_0x276d('0x2'));var uuid=require('uuid');var moment=require(_0x276d('0x3'));var path=require(_0x276d('0x4'));var tiff2pdf=require(_0x276d('0x5'));var gs=require(_0x276d('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x276d('0x7'));var rpcDb=require(_0x276d('0x8'));var Channel=require('./channel');var ut=require(_0x276d('0x9'));var Action=require(_0x276d('0xa'));var faxAccount=require(_0x276d('0xb'));var attachment=require(_0x276d('0xc'));var faxMessage=require(_0x276d('0xd'));function Fax(_0x8c5a08){this['channels']={};this[_0x276d('0xe')]=_0x8c5a08[_0x276d('0xe')];this['trunks']=_0x8c5a08[_0x276d('0xf')];this[_0x276d('0x10')]={};ami['on'](_0x276d('0x11'),this[_0x276d('0x12')][_0x276d('0x13')](this));ami['on'](_0x276d('0x14'),this[_0x276d('0x15')][_0x276d('0x13')](this));ami['on']('newstate',this[_0x276d('0x16')][_0x276d('0x13')](this));ami['on'](_0x276d('0x17'),this[_0x276d('0x18')][_0x276d('0x13')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x276d('0x13')](this));ami['on'](_0x276d('0x19'),this['syncReceiveFax'][_0x276d('0x13')](this));ami['on'](_0x276d('0x1a'),this[_0x276d('0x1b')][_0x276d('0x13')](this));ami['on'](_0x276d('0x1c'),this[_0x276d('0x1d')][_0x276d('0x13')](this));}Fax['prototype']['syncNewchannel']=function(_0x59e80d){if(_0x59e80d['context']===_0x276d('0x1e')){for(var _0x32184b in this['faxAccounts']){if(this[_0x276d('0xe')]['hasOwnProperty'](_0x32184b)){if(_0x59e80d[_0x276d('0x1f')]===this['faxAccounts'][_0x32184b][_0x276d('0x20')]){this[_0x276d('0x21')][_0x59e80d[_0x276d('0x22')]]={};this[_0x276d('0x21')][_0x59e80d[_0x276d('0x22')]]['channel']=_0x59e80d[_0x276d('0x23')];this[_0x276d('0x21')][_0x59e80d[_0x276d('0x22')]]['id']=this['faxAccounts'][_0x32184b]['id'];this[_0x276d('0x21')][_0x59e80d[_0x276d('0x22')]][_0x276d('0x24')]=this[_0x276d('0xe')][_0x32184b]['name'];logger['info'](_0x59e80d[_0x276d('0x22')],_0x276d('0x25'));}}}}if(this[_0x276d('0x10')][_0x59e80d[_0x276d('0x22')]]){this[_0x276d('0x21')][_0x59e80d[_0x276d('0x22')]]={};this[_0x276d('0x21')][_0x59e80d[_0x276d('0x22')]]['channel']=_0x59e80d[_0x276d('0x23')];logger[_0x276d('0x26')](_0x59e80d['uniqueid'],_0x276d('0x25'));}};Fax[_0x276d('0x27')][_0x276d('0x15')]=function(_0x4b7cad){if(this[_0x276d('0x21')][_0x4b7cad[_0x276d('0x22')]]){for(var _0x200c1c in _0x4b7cad['variable']){if(_0x4b7cad[_0x276d('0x28')][_0x276d('0x29')](_0x200c1c)){this[_0x276d('0x21')][_0x4b7cad['uniqueid']][_0x200c1c]=_0x4b7cad['value'];}}}};Fax[_0x276d('0x27')][_0x276d('0x16')]=function(_0x536aa8){if(this[_0x276d('0x21')][_0x536aa8[_0x276d('0x22')]]){this['channels'][_0x536aa8[_0x276d('0x22')]][_0x276d('0x2a')]=_0x536aa8[_0x276d('0x2a')];this[_0x276d('0x21')][_0x536aa8['uniqueid']][_0x276d('0x2b')]=_0x536aa8[_0x276d('0x2b')];}};Fax[_0x276d('0x27')][_0x276d('0x18')]=function(_0x54f5cb){if(this[_0x276d('0x21')][_0x54f5cb[_0x276d('0x22')]]){for(var _0x317028 in _0x54f5cb[_0x276d('0x28')]){if(_0x54f5cb['variable'][_0x276d('0x29')](_0x317028)){this[_0x276d('0x21')][_0x54f5cb[_0x276d('0x22')]][_0x317028]=_0x54f5cb[_0x276d('0x2c')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x15634c){if(this[_0x276d('0x21')][_0x15634c[_0x276d('0x22')]]){this['channels'][_0x15634c[_0x276d('0x22')]]['operation']=_0x15634c[_0x276d('0x2d')];this['channels'][_0x15634c[_0x276d('0x22')]][_0x276d('0x2e')]=_0x15634c[_0x276d('0x2e')];this[_0x276d('0x21')][_0x15634c['uniqueid']]['localstationid']=_0x15634c[_0x276d('0x20')];this[_0x276d('0x21')][_0x15634c[_0x276d('0x22')]][_0x276d('0x2f')]=_0x15634c[_0x276d('0x2f')];logger[_0x276d('0x26')](_0x15634c[_0x276d('0x22')],_0x276d('0x30'));}};Fax[_0x276d('0x27')][_0x276d('0x31')]=function(_0x1a957f){var _0x5be86d=this;if(this[_0x276d('0x21')][_0x1a957f['uniqueid']]){var _0x343851=this[_0x276d('0x21')][_0x1a957f[_0x276d('0x22')]]['id'];this[_0x276d('0x21')][_0x1a957f[_0x276d('0x22')]]['remotestationid']=_0x1a957f[_0x276d('0x32')];this['channels'][_0x1a957f['uniqueid']][_0x276d('0x33')]=_0x1a957f[_0x276d('0x33')];this[_0x276d('0x21')][_0x1a957f['uniqueid']][_0x276d('0x20')]=_0x1a957f[_0x276d('0x20')];this[_0x276d('0x21')][_0x1a957f[_0x276d('0x22')]][_0x276d('0x34')]=_0x1a957f[_0x276d('0x34')];this[_0x276d('0x21')][_0x1a957f['uniqueid']][_0x276d('0x35')]=_0x1a957f[_0x276d('0x35')];this['channels'][_0x1a957f[_0x276d('0x22')]][_0x276d('0x2f')]=_0x1a957f[_0x276d('0x2f')];this[_0x276d('0x21')][_0x1a957f[_0x276d('0x22')]][_0x276d('0x36')]=_0x1a957f[_0x276d('0x36')];if(this['channels'][_0x1a957f[_0x276d('0x22')]][_0x276d('0x33')]>0x0){tiff2pdf(_0x1a957f[_0x276d('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x851ab7){logger['info'](_0x1a957f[_0x276d('0x22')],_0x276d('0x37'),_0x851ab7[_0x276d('0x38')]);attachment[_0x276d('0x39')]({'name':path['parse'](_0x1a957f[_0x276d('0x2f')])['name'],'basename':path[_0x276d('0x3a')](_0x1a957f['filename'])[_0x276d('0x24')]+'.pdf','type':'application/pdf'})[_0x276d('0x3b')](function(_0x3ea61a){faxAccount['notify'](_0x343851,{'from':_0x1a957f[_0x276d('0x36')],'mapKey':_0x276d('0x3c'),'body':path[_0x276d('0x3a')](_0x1a957f[_0x276d('0x2f')])[_0x276d('0x24')]+'.pdf','AttachmentId':_0x3ea61a['id']})[_0x276d('0x3d')](function(_0xff226a){logger[_0x276d('0x3e')](_0x1a957f['uniqueid'],_0x276d('0x3f'),JSON[_0x276d('0x40')](_0xff226a));});})[_0x276d('0x3d')](function(_0x4f7090){logger[_0x276d('0x3e')](_0x1a957f['uniqueid'],_0x276d('0x41'),JSON[_0x276d('0x40')](_0x4f7090));});});}logger[_0x276d('0x26')](_0x1a957f[_0x276d('0x22')],_0x276d('0x41'));}};Fax[_0x276d('0x27')]['syncOriginateResponse']=function(_0x57cb0a){if(this['actions'][_0x57cb0a[_0x276d('0x22')]]){_['merge'](this[_0x276d('0x21')][_0x57cb0a[_0x276d('0x22')]],_[_0x276d('0x42')](_0x57cb0a,[_0x276d('0x43'),_0x276d('0x44')]));}};function updateStatus(_0x4bc2e8){if(_0x4bc2e8[_0x276d('0x45')]){faxMessage[_0x276d('0x46')](_0x4bc2e8['AttachmentId'],{'failMessage':_0x276d('0x47')})[_0x276d('0x3b')](function(_0x26c940){ut[_0x276d('0x48')](_0x276d('0x49'),_0x26c940);})[_0x276d('0x3d')](function(_0x2d26ee){ut[_0x276d('0x48')](_0x276d('0x4a'),_0x2d26ee);});}else{ut['logger'](_0x276d('0x4b'));}}Fax[_0x276d('0x27')]['updateStatus']=function(_0x1d021e,_0x3d833a,_0xc46bf1){var _0x54859a=this;var _0x114c14={};if(_0x3d833a){_0x114c14={'read':_0x3d833a};}else{_0x114c14={'failMessage':_0xc46bf1};}if(this[_0x276d('0x10')][_0x1d021e][_0x276d('0x45')]){faxMessage[_0x276d('0x46')](this[_0x276d('0x10')][_0x1d021e][_0x276d('0x45')],_0x114c14)['then'](function(_0x459fcc){ut[_0x276d('0x48')](_0x276d('0x4c'),_0x459fcc);})[_0x276d('0x3d')](function(_0x3899c0){ut[_0x276d('0x48')](_0x276d('0x4d'),_0x3899c0);})[_0x276d('0x4e')](function(){delete _0x54859a[_0x276d('0x21')][_0x1d021e];delete _0x54859a[_0x276d('0x10')][_0x1d021e];});}else{ut['logger'](_0x276d('0x4f'));delete this[_0x276d('0x21')][_0x1d021e];delete this[_0x276d('0x10')][_0x1d021e];}};Fax[_0x276d('0x27')][_0x276d('0x1b')]=function(_0xee658c){var _0x5c43d6=this;if(this['channels'][_0xee658c[_0x276d('0x22')]]){if(this[_0x276d('0x10')][_0xee658c[_0x276d('0x22')]]){this[_0x276d('0x21')][_0xee658c[_0x276d('0x22')]]['id']=this['actions'][_0xee658c['uniqueid']]['id'];this[_0x276d('0x21')][_0xee658c[_0x276d('0x22')]][_0x276d('0x24')]=this['actions'][_0xee658c['uniqueid']][_0x276d('0x24')];}logger['info'](_0xee658c[_0x276d('0x22')],this[_0x276d('0x10')][_0xee658c['uniqueid']]?_0x276d('0x50'):_0x276d('0x51'),JSON[_0x276d('0x40')](this[_0x276d('0x21')][_0xee658c[_0x276d('0x22')]]));if(this['actions'][_0xee658c[_0x276d('0x22')]]){if(this[_0x276d('0x21')][_0xee658c[_0x276d('0x22')]][_0x276d('0x52')]>0x0&&this['channels'][_0xee658c['uniqueid']][_0x276d('0x53')]===_0x276d('0x54')){this[_0x276d('0x55')](_0xee658c[_0x276d('0x22')],!![]);}else{this[_0x276d('0x55')](_0xee658c['uniqueid'],![],this[_0x276d('0x21')][_0xee658c[_0x276d('0x22')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x276d('0x21')][_0xee658c[_0x276d('0x22')]][_0x276d('0x56')]:_0x276d('0x57'));}}}};Fax[_0x276d('0x27')]['send']=function(_0x34c57d){var _0x2f3c42=this;return new BPromise(function(_0x43e943,_0x2e85b5){_0x2f3c42[_0x276d('0x58')](_0x34c57d,_0x2f3c42[_0x276d('0xe')][_0x34c57d[_0x276d('0x59')]])['then'](function(_0x2409f4){ut[_0x276d('0x48')](_0x276d('0x5a'),_0x2409f4);_0x43e943(ut[_0x276d('0x38')]('Fax\x20received'));})['catch'](function(_0x10216a){ut['logger'](_0x276d('0x5b'),_0x10216a);updateStatus(_0x34c57d);_0x2e85b5(ut['message'](_0x276d('0x5c')));});});};Fax[_0x276d('0x27')]['checkAfterSend']=function(_0x27da22){var _0x53f605=this;return new BPromise(function(_0x366f5,_0x5a980d){var _0x14d4a2=_0x53f605['checkTrunk'](_0x53f605[_0x276d('0xe')][_0x27da22[_0x276d('0x59')]][_0x276d('0x5d')],_0x27da22);if(_0x14d4a2['isValid']){_0x366f5(ut['message'](_0x276d('0x5e')));}else{_0x5a980d(ut[_0x276d('0x38')](_0x14d4a2[_0x276d('0x38')]));}});};function originate(_0x2d278d,_0x37b288,_0x14ec39){return new BPromise(function(_0xea8719,_0x4aefa5){if(_0x14ec39){var _0x339746=util['format'](_0x276d('0x5f'),path[_0x276d('0x3a')](_0x2d278d[_0x276d('0x4')])['name'],_0x2d278d[_0x276d('0x4')]);gs[_0x276d('0x60')](_0x339746)[_0x276d('0x3b')](function(){_0x2d278d[_0x276d('0x4')]=util['format'](_0x276d('0x61'),path[_0x276d('0x3a')](_0x2d278d['path'])[_0x276d('0x62')],path[_0x276d('0x3a')](_0x2d278d[_0x276d('0x4')])[_0x276d('0x24')]);_0x37b288[_0x276d('0x63')]=_0x2d278d['path'];ut[_0x276d('0x48')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x2d278d,_0x37b288))['then'](function(_0x34ac9c){_0xea8719(_0x34ac9c);})[_0x276d('0x3d')](function(_0x1b7f7b){_0x4aefa5(_0x1b7f7b);});})[_0x276d('0x3d')](function(_0x281fe6){_0x4aefa5(_0x281fe6);});}else{ami['Action'](ut[_0x276d('0x64')](_0x2d278d,_0x37b288))[_0x276d('0x3b')](function(_0x469d51){_0xea8719(_0x469d51);})[_0x276d('0x3d')](function(_0x44b125){_0x4aefa5(_0x44b125);});}});}Fax[_0x276d('0x27')][_0x276d('0x58')]=function(_0x2e654a,_0xdccfa3){var _0x30c1b3=this;return new BPromise(function(_0x41a596,_0x4c40b2){var _0x5e0d92=uuid['v4']();var _0x1f455d=ut['addVariables'](_0x2e654a,_0xdccfa3);_0x30c1b3['actions'][_0x5e0d92]=new Action(_0x5e0d92,_0xdccfa3,_0x2e654a);var _0xf08b47=_0x30c1b3[_0x276d('0x10')][_0x5e0d92];if(path[_0x276d('0x3a')](_0x2e654a['path'])['ext']===_0x276d('0x65')){originate(_0xf08b47,_0x1f455d,!![])[_0x276d('0x3b')](function(_0x1f8b8e){_0x41a596(_0x1f8b8e);})[_0x276d('0x3d')](function(_0x2f307f){_0x4c40b2(_0x2f307f);});}else{originate(_0xf08b47,_0x1f455d,![])['then'](function(_0x16bd3c){_0x41a596(_0x16bd3c);})[_0x276d('0x3d')](function(_0x53385e){_0x4c40b2(_0x53385e);});}});};Fax[_0x276d('0x27')][_0x276d('0x66')]=function(_0x443ec7){return!_[_0x276d('0x67')](_0x443ec7)&&!_[_0x276d('0x67')](_0x443ec7[_0x276d('0x24')])&&!_[_0x276d('0x67')](_0x443ec7[_0x276d('0x68')])&&_0x443ec7[_0x276d('0x68')]&&!_[_0x276d('0x67')](this[_0x276d('0xf')][util[_0x276d('0x69')](_0x276d('0x6a'),_0x443ec7[_0x276d('0x24')])])&&!_[_0x276d('0x67')](this[_0x276d('0xf')][util[_0x276d('0x69')]('SIP/%s',_0x443ec7[_0x276d('0x24')])][_0x276d('0x2e')])&&(this[_0x276d('0xf')][util['format'](_0x276d('0x6a'),_0x443ec7['name'])][_0x276d('0x2e')]==='reachable'||this['trunks'][util[_0x276d('0x69')](_0x276d('0x6a'),_0x443ec7[_0x276d('0x24')])]['status']===_0x276d('0x6b'));};Fax[_0x276d('0x27')][_0x276d('0x6c')]=function(_0x1a9d00,_0x30faaa){if(!this[_0x276d('0x66')](_0x1a9d00)){ut['logger'](_0x276d('0x6d'),_[_0x276d('0x67')](_0x1a9d00)?'':_0x1a9d00['name']+_0x276d('0x6e'));return{'isValid':![],'message':_0x276d('0x6f')};}if(_[_0x276d('0x67')](_0x30faaa[_0x276d('0x3c')])){ut[_0x276d('0x48')](_0x276d('0x70'),JSON['stringify'](_0x30faaa));return{'isValid':![],'message':_0x276d('0x71')};}if(_['isNil'](_0x30faaa[_0x276d('0x4')])){ut[_0x276d('0x48')](_0x276d('0x72'),JSON[_0x276d('0x40')](_0x30faaa));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x276d('0x73')};};module[_0x276d('0x74')]=Fax; \ No newline at end of file +var _0x4516=['\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','merge','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','updateStatus','update','[Fax][Message][NoUpdate1]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','hasOwnProperty','value','channelstate','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4516,0x194));var _0x6451=function(_0x1de143,_0xb590fa){_0x1de143=_0x1de143-0x0;var _0x458cfa=_0x4516[_0x1de143];return _0x458cfa;};'use strict';var util=require(_0x6451('0x0'));var _=require(_0x6451('0x1'));var BPromise=require(_0x6451('0x2'));var uuid=require(_0x6451('0x3'));var moment=require(_0x6451('0x4'));var path=require(_0x6451('0x5'));var tiff2pdf=require(_0x6451('0x6'));var gs=require(_0x6451('0x7'));var logger=require(_0x6451('0x8'))(_0x6451('0x9'));var ami=require('../ami');var rpcDb=require(_0x6451('0xa'));var Channel=require(_0x6451('0xb'));var ut=require(_0x6451('0xc'));var Action=require(_0x6451('0xd'));var faxAccount=require(_0x6451('0xe'));var attachment=require(_0x6451('0xf'));var faxMessage=require(_0x6451('0x10'));function Fax(_0x4ec1e0){this[_0x6451('0x11')]={};this['faxAccounts']=_0x4ec1e0[_0x6451('0x12')];this[_0x6451('0x13')]=_0x4ec1e0[_0x6451('0x13')];this['actions']={};ami['on'](_0x6451('0x14'),this[_0x6451('0x15')][_0x6451('0x16')](this));ami['on'](_0x6451('0x17'),this['syncVarSet'][_0x6451('0x16')](this));ami['on'](_0x6451('0x18'),this[_0x6451('0x19')][_0x6451('0x16')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x6451('0x1a'),this[_0x6451('0x1b')]['bind'](this));ami['on'](_0x6451('0x1c'),this[_0x6451('0x1d')][_0x6451('0x16')](this));ami['on'](_0x6451('0x1e'),this[_0x6451('0x1f')]['bind'](this));ami['on'](_0x6451('0x20'),this[_0x6451('0x21')][_0x6451('0x16')](this));}Fax[_0x6451('0x22')][_0x6451('0x15')]=function(_0x5e03af){if(_0x5e03af[_0x6451('0x23')]==='from-voip-provider'){for(var _0xe58d18 in this[_0x6451('0x12')]){if(this[_0x6451('0x12')]['hasOwnProperty'](_0xe58d18)){if(_0x5e03af[_0x6451('0x24')]===this['faxAccounts'][_0xe58d18][_0x6451('0x25')]){this[_0x6451('0x11')][_0x5e03af['uniqueid']]={};this[_0x6451('0x11')][_0x5e03af[_0x6451('0x26')]][_0x6451('0x27')]=_0x5e03af[_0x6451('0x27')];this['channels'][_0x5e03af[_0x6451('0x26')]]['id']=this[_0x6451('0x12')][_0xe58d18]['id'];this[_0x6451('0x11')][_0x5e03af['uniqueid']][_0x6451('0x28')]=this[_0x6451('0x12')][_0xe58d18][_0x6451('0x28')];logger[_0x6451('0x29')](_0x5e03af[_0x6451('0x26')],_0x6451('0x2a'));}}}}if(this[_0x6451('0x2b')][_0x5e03af[_0x6451('0x26')]]){this[_0x6451('0x11')][_0x5e03af[_0x6451('0x26')]]={};this['channels'][_0x5e03af[_0x6451('0x26')]][_0x6451('0x27')]=_0x5e03af[_0x6451('0x27')];logger[_0x6451('0x29')](_0x5e03af[_0x6451('0x26')],_0x6451('0x2a'));}};Fax[_0x6451('0x22')][_0x6451('0x2c')]=function(_0x682522){if(this['channels'][_0x682522[_0x6451('0x26')]]){for(var _0x4d10f7 in _0x682522[_0x6451('0x2d')]){if(_0x682522[_0x6451('0x2d')][_0x6451('0x2e')](_0x4d10f7)){this['channels'][_0x682522[_0x6451('0x26')]][_0x4d10f7]=_0x682522[_0x6451('0x2f')];}}}};Fax[_0x6451('0x22')]['syncNewState']=function(_0x7b4f8){if(this['channels'][_0x7b4f8[_0x6451('0x26')]]){this[_0x6451('0x11')][_0x7b4f8['uniqueid']][_0x6451('0x30')]=_0x7b4f8[_0x6451('0x30')];this['channels'][_0x7b4f8[_0x6451('0x26')]]['channelstatedesc']=_0x7b4f8['channelstatedesc'];}};Fax['prototype'][_0x6451('0x31')]=function(_0x8bda79){if(this[_0x6451('0x11')][_0x8bda79['uniqueid']]){for(var _0x50960c in _0x8bda79[_0x6451('0x2d')]){if(_0x8bda79[_0x6451('0x2d')][_0x6451('0x2e')](_0x50960c)){this[_0x6451('0x11')][_0x8bda79[_0x6451('0x26')]][_0x50960c]=_0x8bda79['value'];}}}};Fax['prototype'][_0x6451('0x1b')]=function(_0x5cef0e){if(this[_0x6451('0x11')][_0x5cef0e['uniqueid']]){this[_0x6451('0x11')][_0x5cef0e[_0x6451('0x26')]][_0x6451('0x32')]=_0x5cef0e[_0x6451('0x32')];this[_0x6451('0x11')][_0x5cef0e[_0x6451('0x26')]][_0x6451('0x33')]=_0x5cef0e['status'];this['channels'][_0x5cef0e['uniqueid']]['localstationid']=_0x5cef0e[_0x6451('0x25')];this[_0x6451('0x11')][_0x5cef0e[_0x6451('0x26')]]['filename']=_0x5cef0e[_0x6451('0x34')];logger[_0x6451('0x29')](_0x5cef0e[_0x6451('0x26')],_0x6451('0x35'));}};Fax[_0x6451('0x22')]['syncReceiveFax']=function(_0xf1a7a8){var _0x3e58d4=this;if(this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]]){var _0x12b4d1=this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]]['id'];this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]][_0x6451('0x36')]=_0xf1a7a8[_0x6451('0x36')];this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]][_0x6451('0x37')]=_0xf1a7a8[_0x6451('0x37')];this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]][_0x6451('0x25')]=_0xf1a7a8[_0x6451('0x25')];this['channels'][_0xf1a7a8['uniqueid']]['resolution']=_0xf1a7a8[_0x6451('0x38')];this['channels'][_0xf1a7a8[_0x6451('0x26')]][_0x6451('0x39')]=_0xf1a7a8[_0x6451('0x39')];this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]][_0x6451('0x34')]=_0xf1a7a8[_0x6451('0x34')];this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]][_0x6451('0x3a')]=_0xf1a7a8[_0x6451('0x3a')];if(this[_0x6451('0x11')][_0xf1a7a8[_0x6451('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0xf1a7a8[_0x6451('0x34')],_0x6451('0x3b'),function(_0x539413){logger[_0x6451('0x29')](_0xf1a7a8[_0x6451('0x26')],_0x6451('0x3c'),_0x539413[_0x6451('0x3d')]);attachment[_0x6451('0x3e')]({'name':path[_0x6451('0x3f')](_0xf1a7a8['filename'])[_0x6451('0x28')],'basename':path[_0x6451('0x3f')](_0xf1a7a8[_0x6451('0x34')])[_0x6451('0x28')]+_0x6451('0x40'),'type':_0x6451('0x41')})[_0x6451('0x42')](function(_0x2575ad){faxAccount[_0x6451('0x43')](_0x12b4d1,{'from':_0xf1a7a8[_0x6451('0x3a')],'mapKey':_0x6451('0x9'),'body':path[_0x6451('0x3f')](_0xf1a7a8[_0x6451('0x34')])[_0x6451('0x28')]+_0x6451('0x40'),'AttachmentId':_0x2575ad['id']})['catch'](function(_0x5db43d){logger['error'](_0xf1a7a8['uniqueid'],_0x6451('0x44'),JSON[_0x6451('0x45')](_0x5db43d));});})[_0x6451('0x46')](function(_0x54457e){logger[_0x6451('0x47')](_0xf1a7a8['uniqueid'],_0x6451('0x48'),JSON[_0x6451('0x45')](_0x54457e));});});}logger[_0x6451('0x29')](_0xf1a7a8[_0x6451('0x26')],_0x6451('0x48'));}};Fax['prototype'][_0x6451('0x21')]=function(_0x3012bf){if(this['actions'][_0x3012bf[_0x6451('0x26')]]){_[_0x6451('0x49')](this['channels'][_0x3012bf[_0x6451('0x26')]],_['pick'](_0x3012bf,[_0x6451('0x4a'),_0x6451('0x4b')]));}};function updateStatus(_0x255b09){if(_0x255b09[_0x6451('0x4c')]){faxMessage['update'](_0x255b09[_0x6451('0x4c')],{'failMessage':_0x6451('0x4d')})[_0x6451('0x42')](function(_0x2be634){ut[_0x6451('0x4e')]('[Fax][Message][Error][Updated]',_0x2be634);})[_0x6451('0x46')](function(_0x364198){ut[_0x6451('0x4e')]('[Fax][Message][Error][NoUpdate1]',_0x364198);});}else{ut[_0x6451('0x4e')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x6451('0x22')][_0x6451('0x4f')]=function(_0x118b7b,_0x2b5097,_0x3a0b23){var _0x2553d7=this;var _0xf78fc5={};if(_0x2b5097){_0xf78fc5={'read':_0x2b5097};}else{_0xf78fc5={'failMessage':_0x3a0b23};}if(this['actions'][_0x118b7b][_0x6451('0x4c')]){faxMessage[_0x6451('0x50')](this[_0x6451('0x2b')][_0x118b7b]['AttachmentId'],_0xf78fc5)[_0x6451('0x42')](function(_0x5dc4d2){ut['logger']('[Fax][Message][Updated]',_0x5dc4d2);})[_0x6451('0x46')](function(_0x2380b8){ut['logger'](_0x6451('0x51'),_0x2380b8);})['finally'](function(){delete _0x2553d7[_0x6451('0x11')][_0x118b7b];delete _0x2553d7['actions'][_0x118b7b];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x118b7b];delete this['actions'][_0x118b7b];}};Fax['prototype'][_0x6451('0x1f')]=function(_0x2c0653){var _0x3b4265=this;if(this['channels'][_0x2c0653[_0x6451('0x26')]]){if(this['actions'][_0x2c0653[_0x6451('0x26')]]){this[_0x6451('0x11')][_0x2c0653[_0x6451('0x26')]]['id']=this[_0x6451('0x2b')][_0x2c0653[_0x6451('0x26')]]['id'];this[_0x6451('0x11')][_0x2c0653[_0x6451('0x26')]]['name']=this['actions'][_0x2c0653[_0x6451('0x26')]]['name'];}logger[_0x6451('0x29')](_0x2c0653[_0x6451('0x26')],this['actions'][_0x2c0653[_0x6451('0x26')]]?'\x20hangup\x20sendFile\x20':_0x6451('0x52'),JSON[_0x6451('0x45')](this[_0x6451('0x11')][_0x2c0653[_0x6451('0x26')]]));if(this[_0x6451('0x2b')][_0x2c0653['uniqueid']]){if(this[_0x6451('0x11')][_0x2c0653[_0x6451('0x26')]][_0x6451('0x53')]>0x0&&this[_0x6451('0x11')][_0x2c0653['uniqueid']][_0x6451('0x1a')]===_0x6451('0x54')){this[_0x6451('0x4f')](_0x2c0653['uniqueid'],!![]);}else{this[_0x6451('0x4f')](_0x2c0653[_0x6451('0x26')],![],this['channels'][_0x2c0653['uniqueid']][_0x6451('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x6451('0x11')][_0x2c0653[_0x6451('0x26')]][_0x6451('0x55')]:_0x6451('0x56'));}}}};Fax[_0x6451('0x22')][_0x6451('0x57')]=function(_0x2a002b){var _0x40ebae=this;return new BPromise(function(_0x2d2cec,_0x2ba14d){_0x40ebae['execOriginate'](_0x2a002b,_0x40ebae['faxAccounts'][_0x2a002b[_0x6451('0x58')]])[_0x6451('0x42')](function(_0x41cfe3){ut[_0x6451('0x4e')](_0x6451('0x59'),_0x41cfe3);_0x2d2cec(ut[_0x6451('0x3d')]('Fax\x20received'));})[_0x6451('0x46')](function(_0x549d6e){ut[_0x6451('0x4e')](_0x6451('0x5a'),_0x549d6e);updateStatus(_0x2a002b);_0x2ba14d(ut[_0x6451('0x3d')](_0x6451('0x5b')));});});};Fax[_0x6451('0x22')]['checkAfterSend']=function(_0x5ef2b4){var _0x406f27=this;return new BPromise(function(_0x482c68,_0x133cbc){var _0x5a49e0=_0x406f27[_0x6451('0x5c')](_0x406f27[_0x6451('0x12')][_0x5ef2b4[_0x6451('0x58')]][_0x6451('0x5d')],_0x5ef2b4);if(_0x5a49e0[_0x6451('0x5e')]){_0x482c68(ut[_0x6451('0x3d')](_0x6451('0x5f')));}else{_0x133cbc(ut[_0x6451('0x3d')](_0x5a49e0[_0x6451('0x3d')]));}});};function originate(_0x4bd0e0,_0x58bf9c,_0x59da1f){return new BPromise(function(_0x320cc6,_0xc6fc18){if(_0x59da1f){var _0x5112a3=util[_0x6451('0x60')](_0x6451('0x61'),path['parse'](_0x4bd0e0[_0x6451('0x5')])['name'],_0x4bd0e0[_0x6451('0x5')]);gs['execute'](_0x5112a3)[_0x6451('0x42')](function(){_0x4bd0e0['path']=util['format'](_0x6451('0x62'),path[_0x6451('0x3f')](_0x4bd0e0['path'])['dir'],path[_0x6451('0x3f')](_0x4bd0e0[_0x6451('0x5')])[_0x6451('0x28')]);_0x58bf9c[_0x6451('0x63')]=_0x4bd0e0['path'];ut[_0x6451('0x4e')](_0x6451('0x64'),'');ami[_0x6451('0x65')](ut[_0x6451('0x66')](_0x4bd0e0,_0x58bf9c))[_0x6451('0x42')](function(_0xca84ff){_0x320cc6(_0xca84ff);})[_0x6451('0x46')](function(_0xcbabd5){_0xc6fc18(_0xcbabd5);});})[_0x6451('0x46')](function(_0x41ebc6){_0xc6fc18(_0x41ebc6);});}else{ami[_0x6451('0x65')](ut[_0x6451('0x66')](_0x4bd0e0,_0x58bf9c))[_0x6451('0x42')](function(_0x38c75b){_0x320cc6(_0x38c75b);})[_0x6451('0x46')](function(_0x14ab2a){_0xc6fc18(_0x14ab2a);});}});}Fax[_0x6451('0x22')]['execOriginate']=function(_0x4c29eb,_0x1dd07f){var _0x2f62=this;return new BPromise(function(_0x6ff3c5,_0x31980b){var _0x25e4c7=uuid['v4']();var _0x3522e3=ut[_0x6451('0x67')](_0x4c29eb,_0x1dd07f);_0x2f62['actions'][_0x25e4c7]=new Action(_0x25e4c7,_0x1dd07f,_0x4c29eb);var _0x1318ba=_0x2f62[_0x6451('0x2b')][_0x25e4c7];if(path[_0x6451('0x3f')](_0x4c29eb[_0x6451('0x5')])[_0x6451('0x68')]===_0x6451('0x40')){originate(_0x1318ba,_0x3522e3,!![])[_0x6451('0x42')](function(_0x5e72b3){_0x6ff3c5(_0x5e72b3);})[_0x6451('0x46')](function(_0x2ea76c){_0x31980b(_0x2ea76c);});}else{originate(_0x1318ba,_0x3522e3,![])['then'](function(_0x2c47b8){_0x6ff3c5(_0x2c47b8);})['catch'](function(_0x1a2fcb){_0x31980b(_0x1a2fcb);});}});};Fax[_0x6451('0x22')][_0x6451('0x69')]=function(_0x1ff4cc){return!_['isNil'](_0x1ff4cc)&&!_[_0x6451('0x6a')](_0x1ff4cc['name'])&&!_[_0x6451('0x6a')](_0x1ff4cc['active'])&&_0x1ff4cc[_0x6451('0x6b')]&&!_['isNil'](this['trunks'][util[_0x6451('0x60')]('SIP/%s',_0x1ff4cc[_0x6451('0x28')])])&&!_[_0x6451('0x6a')](this['trunks'][util['format'](_0x6451('0x6c'),_0x1ff4cc[_0x6451('0x28')])][_0x6451('0x33')])&&(this[_0x6451('0x13')][util[_0x6451('0x60')](_0x6451('0x6c'),_0x1ff4cc[_0x6451('0x28')])]['status']===_0x6451('0x6d')||this[_0x6451('0x13')][util[_0x6451('0x60')]('SIP/%s',_0x1ff4cc[_0x6451('0x28')])][_0x6451('0x33')]==='unmonitored');};Fax[_0x6451('0x22')]['checkTrunk']=function(_0x456114,_0x563547){if(!this[_0x6451('0x69')](_0x456114)){ut[_0x6451('0x4e')](_0x6451('0x6e'),_[_0x6451('0x6a')](_0x456114)?'':_0x456114[_0x6451('0x28')]+_0x6451('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x6451('0x6a')](_0x563547[_0x6451('0x9')])){ut[_0x6451('0x4e')](_0x6451('0x70'),JSON[_0x6451('0x45')](_0x563547));return{'isValid':![],'message':_0x6451('0x71')};}if(_[_0x6451('0x6a')](_0x563547[_0x6451('0x5')])){ut[_0x6451('0x4e')](_0x6451('0x72'),JSON[_0x6451('0x45')](_0x563547));return{'isValid':![],'message':_0x6451('0x73')};}return{'isValid':!![],'message':_0x6451('0x74')};};module[_0x6451('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1a885eb..35a47c8 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 _0xd061=['../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x38b8da,_0x3c5e66){var _0x1f0ee0=function(_0x53c10c){while(--_0x53c10c){_0x38b8da['push'](_0x38b8da['shift']());}};_0x1f0ee0(++_0x3c5e66);}(_0xd061,0x8b));var _0x1d06=function(_0x214a2b,_0x24b283){_0x214a2b=_0x214a2b-0x0;var _0x483af6=_0xd061[_0x214a2b];return _0x483af6;};'use strict';var util=require(_0x1d06('0x0'));var BPromise=require(_0x1d06('0x1'));var logger=require(_0x1d06('0x2'))(_0x1d06('0x3'));var _=require(_0x1d06('0x4'));var faxAccount=require(_0x1d06('0x5'));function loggerCatch(_0x74c330){return function(_0x47d1e2){logger[_0x1d06('0x6')](_0x74c330,util[_0x1d06('0x7')](_0x47d1e2,{'showHidden':![],'depth':null}));};}exports[_0x1d06('0x8')]=function(_0x1edd97,_0x1c3cbe){return BPromise[_0x1d06('0x9')]()['then'](faxAccount[_0x1d06('0x8')](_0x1edd97,_0x1c3cbe))[_0x1d06('0xa')](loggerCatch(_0x1d06('0xb')));}; \ No newline at end of file +var _0xf97b=['resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xf97b,0x16e));var _0xbf97=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf97b[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xbf97('0x0'));var BPromise=require(_0xbf97('0x1'));var logger=require(_0xbf97('0x2'))(_0xbf97('0x3'));var _=require(_0xbf97('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x773f92){return function(_0x18a50b){logger[_0xbf97('0x5')](_0x773f92,util[_0xbf97('0x6')](_0x18a50b,{'showHidden':![],'depth':null}));};}exports[_0xbf97('0x7')]=function(_0x9d8d6e,_0x1c4bb2){return BPromise[_0xbf97('0x8')]()[_0xbf97('0x9')](faxAccount[_0xbf97('0x7')](_0x9d8d6e,_0x1c4bb2))['catch'](loggerCatch(_0xbf97('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e624d6b..2c0328e 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 _0x1d6f=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0x42446c,_0x106c25){var _0x29059d=function(_0x217ff2){while(--_0x217ff2){_0x42446c['push'](_0x42446c['shift']());}};_0x29059d(++_0x106c25);}(_0x1d6f,0x1e5));var _0xf1d6=function(_0x4647fc,_0x5603ac){_0x4647fc=_0x4647fc-0x0;var _0x31ad6d=_0x1d6f[_0x4647fc];return _0x31ad6d;};'use strict';var util=require(_0xf1d6('0x0'));var logger=require(_0xf1d6('0x1'))('fax');var BPromise=require(_0xf1d6('0x2'));var exec=require(_0xf1d6('0x3'))[_0xf1d6('0x4')];exports[_0xf1d6('0x5')]=function(_0xc34a41){return new BPromise(function(_0x5143f4,_0x5a4e6a){exec(_0xc34a41,function(_0x55eaf5,_0xf95b03,_0x4f9de9){logger[_0xf1d6('0x6')](_0xf1d6('0x7'),_0xf95b03);if(_0x55eaf5){logger[_0xf1d6('0x6')](_0xf1d6('0x7'),_0xf1d6('0x8'),util[_0xf1d6('0x9')](_0x55eaf5,{'showHidden':![],'depth':null}),_0xf95b03,_0x4f9de9);_0x5a4e6a(_0x55eaf5);}_0x5143f4(_0xf95b03);});});}; \ No newline at end of file +var _0xb0f3=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','exec'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb0f3,0xef));var _0x3b0f=function(_0x5484cf,_0x153f52){_0x5484cf=_0x5484cf-0x0;var _0x5b7de7=_0xb0f3[_0x5484cf];return _0x5b7de7;};'use strict';var util=require(_0x3b0f('0x0'));var logger=require('../../../../config/logger')(_0x3b0f('0x1'));var BPromise=require(_0x3b0f('0x2'));var exec=require('child_process')[_0x3b0f('0x3')];exports[_0x3b0f('0x4')]=function(_0x5d0899){return new BPromise(function(_0x4ea9aa,_0x5396a9){exec(_0x5d0899,function(_0x85c88,_0x2eb9de,_0x1fe7a0){logger[_0x3b0f('0x5')](_0x3b0f('0x6'),_0x2eb9de);if(_0x85c88){logger[_0x3b0f('0x5')](_0x3b0f('0x6'),_0x3b0f('0x7'),util[_0x3b0f('0x8')](_0x85c88,{'showHidden':![],'depth':null}),_0x2eb9de,_0x1fe7a0);_0x5396a9(_0x85c88);}_0x4ea9aa(_0x2eb9de);});});}; \ 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 ab6d5f6..03e0160 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 _0x8ce3=['logger','info','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message'];(function(_0x19bcf7,_0x59826e){var _0x3170df=function(_0x222615){while(--_0x222615){_0x19bcf7['push'](_0x19bcf7['shift']());}};_0x3170df(++_0x59826e);}(_0x8ce3,0xc3));var _0x38ce=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x8ce3[_0x181dfe];return _0x40c38f;};'use strict';var util=require(_0x38ce('0x0'));var _=require(_0x38ce('0x1'));var moment=require('moment');var logger=require(_0x38ce('0x2'))(_0x38ce('0x3'));exports[_0x38ce('0x4')]=function(_0x26ec48){return{'message':_0x26ec48};};exports[_0x38ce('0x5')]=function(_0x17b96d,_0x1efae3){logger[_0x38ce('0x6')](_0x17b96d,util['inspect'](_0x1efae3,{'showHidden':![],'depth':null}));};exports[_0x38ce('0x7')]=function(_0xb24f4c,_0x58074c){var _0x262b13={'XMF-ECM':_0x58074c[_0x38ce('0x8')],'XMF-HEADERINFO':_0x58074c[_0x38ce('0x9')],'XMF-MINRATE':_0x58074c['minrate'],'XMF-MAXRATE':_0x58074c[_0x38ce('0xa')],'XMF-MODEM':util['format'](_0x38ce('0xb'),_0x58074c['modem']),'XMF-GATEWAY':_0x58074c[_0x38ce('0xc')],'XMF-FAXDETECT':_0x58074c[_0x38ce('0xd')],'XMF-T38TIMEOUT':_0x58074c[_0x38ce('0xe')],'XMF-LOCALSTATIONID':_0x58074c[_0x38ce('0xf')],'XMF-PATH':_0xb24f4c[_0x38ce('0x10')]};return _0x262b13;};exports[_0x38ce('0x11')]=function(_0x2a9045,_0x171a02){return{'actionid':_0x2a9045[_0x38ce('0x12')],'action':_0x38ce('0x13'),'channel':_0x2a9045[_0x38ce('0x14')],'Exten':_0x38ce('0x15'),'Context':_0x38ce('0x16'),'Priority':'1','callerid':util[_0x38ce('0x17')](_0x38ce('0x18'),_0x2a9045[_0x38ce('0x9')]?_0x2a9045['headerinfo']:'',_0x2a9045['localstationid']),'variable':_0x171a02,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a9045[_0x38ce('0x12')]};}; \ No newline at end of file +var _0xd3d1=['gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','util','lodash','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd3d1,0x172));var _0x1d3d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd3d1[_0x36eaaa];return _0x461349;};'use strict';var util=require(_0x1d3d('0x0'));var _=require(_0x1d3d('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x1d3d('0x2'));exports[_0x1d3d('0x3')]=function(_0x1b8ea2){return{'message':_0x1b8ea2};};exports[_0x1d3d('0x4')]=function(_0x41a806,_0x328a4e){logger[_0x1d3d('0x5')](_0x41a806,util[_0x1d3d('0x6')](_0x328a4e,{'showHidden':![],'depth':null}));};exports[_0x1d3d('0x7')]=function(_0x449475,_0x3831ce){var _0xb1b3c6={'XMF-ECM':_0x3831ce[_0x1d3d('0x8')],'XMF-HEADERINFO':_0x3831ce[_0x1d3d('0x9')],'XMF-MINRATE':_0x3831ce[_0x1d3d('0xa')],'XMF-MAXRATE':_0x3831ce[_0x1d3d('0xb')],'XMF-MODEM':util[_0x1d3d('0xc')]('\x22%s\x22',_0x3831ce[_0x1d3d('0xd')]),'XMF-GATEWAY':_0x3831ce[_0x1d3d('0xe')],'XMF-FAXDETECT':_0x3831ce[_0x1d3d('0xf')],'XMF-T38TIMEOUT':_0x3831ce[_0x1d3d('0x10')],'XMF-LOCALSTATIONID':_0x3831ce[_0x1d3d('0x11')],'XMF-PATH':_0x449475[_0x1d3d('0x12')]};return _0xb1b3c6;};exports[_0x1d3d('0x13')]=function(_0x2fa11e,_0x3b3913){return{'actionid':_0x2fa11e[_0x1d3d('0x14')],'action':_0x1d3d('0x15'),'channel':_0x2fa11e['channel'],'Exten':_0x1d3d('0x16'),'Context':_0x1d3d('0x17'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2fa11e[_0x1d3d('0x9')]?_0x2fa11e[_0x1d3d('0x9')]:'',_0x2fa11e[_0x1d3d('0x11')]),'variable':_0x3b3913,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fa11e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index cda767a..cbef83b 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 _0x8261=['initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts'];(function(_0x428672,_0x73707){var _0x3765fc=function(_0x112207){while(--_0x112207){_0x428672['push'](_0x428672['shift']());}};_0x3765fc(++_0x73707);}(_0x8261,0xae));var _0x1826=function(_0x5e2f40,_0x3dc4f9){_0x5e2f40=_0x5e2f40-0x0;var _0x5049dd=_0x8261[_0x5e2f40];return _0x5049dd;};'use strict';var BPromise=require(_0x1826('0x0'));var util=require(_0x1826('0x1'));var moment=require(_0x1826('0x2'));var server=require(_0x1826('0x3'));var Realtime=require(_0x1826('0x4'));var Report=require(_0x1826('0x5'));var Acw=require('./acw');var Trigger=require(_0x1826('0x6'));var Dialer=require(_0x1826('0x7'));var Preview=require(_0x1826('0x8'));var Fax=require(_0x1826('0x9'));var user=require(_0x1826('0xa'));var voiceQueue=require(_0x1826('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x1826('0xc'));var trunk=require(_0x1826('0xd'));var trigger=require(_0x1826('0xe'));var template=require(_0x1826('0xf'));var cmHopperHistory=require(_0x1826('0x10'));var campaign=require(_0x1826('0x11'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x1826('0x12'));var zendesk=require(_0x1826('0x13'));var salesforce=require(_0x1826('0x14'));var sugarcrm=require(_0x1826('0x15'));var freshdesk=require(_0x1826('0x16'));var desk=require(_0x1826('0x17'));var zoho=require(_0x1826('0x18'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x1826('0x19'));var servicenow=require(_0x1826('0x1a'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x1826('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1826('0x1c')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1826('0x1d')]()[_0x1826('0x1e')](user[_0x1826('0x1f')]())[_0x1826('0x1e')](realtime[_0x1826('0x20')]())['then'](user[_0x1826('0x21')]())[_0x1826('0x1e')](realtime[_0x1826('0x22')]())[_0x1826('0x1e')](trunk[_0x1826('0x23')]())[_0x1826('0x1e')](realtime[_0x1826('0x24')]())['then'](voiceQueue[_0x1826('0x25')]())[_0x1826('0x1e')](realtime[_0x1826('0x26')]())['then'](trigger[_0x1826('0x27')]())[_0x1826('0x1e')](realtime[_0x1826('0x28')]())[_0x1826('0x1e')](template['getTemplates']())[_0x1826('0x1e')](realtime['initTemplates']())['then'](zendesk[_0x1826('0x29')]())[_0x1826('0x1e')](realtime[_0x1826('0x2a')]())['then'](salesforce[_0x1826('0x2b')]())[_0x1826('0x1e')](realtime['initSalesforceAccounts']())[_0x1826('0x1e')](sugarcrm['getSugarcrmAccounts']())[_0x1826('0x1e')](realtime[_0x1826('0x2c')]())[_0x1826('0x1e')](freshdesk[_0x1826('0x2d')]())['then'](realtime['initFreshdeskAccounts']())[_0x1826('0x1e')](desk[_0x1826('0x2e')]())[_0x1826('0x1e')](realtime[_0x1826('0x2f')]())[_0x1826('0x1e')](zoho[_0x1826('0x30')]())[_0x1826('0x1e')](realtime[_0x1826('0x31')]())[_0x1826('0x1e')](vtiger[_0x1826('0x32')]())[_0x1826('0x1e')](realtime['initVtigerAccounts']())['then'](freshsales[_0x1826('0x33')]())[_0x1826('0x1e')](realtime[_0x1826('0x34')]())[_0x1826('0x1e')](servicenow[_0x1826('0x35')]())[_0x1826('0x1e')](realtime[_0x1826('0x36')]())[_0x1826('0x1e')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x1826('0x37')]())[_0x1826('0x1e')](campaign[_0x1826('0x38')]())[_0x1826('0x1e')](realtime[_0x1826('0x39')]())[_0x1826('0x1e')](voiceExtension[_0x1826('0x3a')]())[_0x1826('0x1e')](realtime[_0x1826('0x3b')]())[_0x1826('0x1e')](faxAccount[_0x1826('0x3c')]())['then'](realtime[_0x1826('0x3d')]())[_0x1826('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x1826('0x1d')]()[_0x1826('0x1e')](voiceQueueReport[_0x1826('0x3e')]())[_0x1826('0x1e')](realtime[_0x1826('0x3f')]())[_0x1826('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1826('0x1e')](realtime[_0x1826('0x40')]())[_0x1826('0x1e')](cmHopperHistory[_0x1826('0x41')]())[_0x1826('0x1e')](realtime[_0x1826('0x42')]())[_0x1826('0x1e')](voiceCallReport[_0x1826('0x43')]())[_0x1826('0x1e')](realtime[_0x1826('0x44')]())[_0x1826('0x1e')](function(_0x5b10c3){})[_0x1826('0x45')](function(_0x2b5e4d){console[_0x1826('0x46')](_0x2b5e4d);});}function main(){return server['listen'](realtime,preview,fax)[_0x1826('0x1e')](function(_0x2ea95f){return initRealtime();})[_0x1826('0x1e')](function(){return initParams();})[_0x1826('0x1e')](function(){report[_0x1826('0x47')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3cf1c1){console['log'](_0x3cf1c1);});}main(); \ No newline at end of file +var _0x4db7=['initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','catch','bluebird','util','./realtime','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','resolve','then','getAgents','initAgents','initTrunks','getVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts'];(function(_0x1781e8,_0x23f48b){var _0x13c7f3=function(_0x57c90d){while(--_0x57c90d){_0x1781e8['push'](_0x1781e8['shift']());}};_0x13c7f3(++_0x23f48b);}(_0x4db7,0xd6));var _0x74db=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x4db7[_0x4c12ec];return _0x3ae42c;};'use strict';var BPromise=require(_0x74db('0x0'));var util=require(_0x74db('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x74db('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x74db('0x3'));var Preview=require(_0x74db('0x4'));var Fax=require('./fax');var user=require(_0x74db('0x5'));var voiceQueue=require(_0x74db('0x6'));var voiceQueueReport=require(_0x74db('0x7'));var voiceCallReport=require(_0x74db('0x8'));var trunk=require(_0x74db('0x9'));var trigger=require(_0x74db('0xa'));var template=require(_0x74db('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x74db('0xc'));var voiceExtension=require(_0x74db('0xd'));var faxAccount=require(_0x74db('0xe'));var zendesk=require(_0x74db('0xf'));var salesforce=require(_0x74db('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x74db('0x11'));var desk=require(_0x74db('0x12'));var zoho=require(_0x74db('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x74db('0x14'));var dynamics365=require(_0x74db('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x74db('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x74db('0x17')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x74db('0x18')]()[_0x74db('0x19')](user[_0x74db('0x1a')]())[_0x74db('0x19')](realtime[_0x74db('0x1b')]())[_0x74db('0x19')](user['getTelephones']())[_0x74db('0x19')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x74db('0x19')](realtime[_0x74db('0x1c')]())[_0x74db('0x19')](voiceQueue[_0x74db('0x1d')]())[_0x74db('0x19')](realtime['initVoiceQueues']())[_0x74db('0x19')](trigger[_0x74db('0x1e')]())[_0x74db('0x19')](realtime['initTriggers']())['then'](template[_0x74db('0x1f')]())[_0x74db('0x19')](realtime['initTemplates']())['then'](zendesk[_0x74db('0x20')]())[_0x74db('0x19')](realtime[_0x74db('0x21')]())[_0x74db('0x19')](salesforce['getSalesforceAccounts']())[_0x74db('0x19')](realtime['initSalesforceAccounts']())['then'](sugarcrm['getSugarcrmAccounts']())[_0x74db('0x19')](realtime[_0x74db('0x22')]())['then'](freshdesk[_0x74db('0x23')]())[_0x74db('0x19')](realtime[_0x74db('0x24')]())[_0x74db('0x19')](desk['getDeskAccounts']())['then'](realtime[_0x74db('0x25')]())[_0x74db('0x19')](zoho[_0x74db('0x26')]())['then'](realtime[_0x74db('0x27')]())[_0x74db('0x19')](vtiger[_0x74db('0x28')]())['then'](realtime[_0x74db('0x29')]())[_0x74db('0x19')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x74db('0x2a')]())[_0x74db('0x19')](servicenow[_0x74db('0x2b')]())[_0x74db('0x19')](realtime[_0x74db('0x2c')]())[_0x74db('0x19')](dynamics365['getDynamics365Accounts']())[_0x74db('0x19')](realtime[_0x74db('0x2d')]())[_0x74db('0x19')](campaign[_0x74db('0x2e')]())[_0x74db('0x19')](realtime[_0x74db('0x2f')]())[_0x74db('0x19')](voiceExtension[_0x74db('0x30')]())['then'](realtime[_0x74db('0x31')]())[_0x74db('0x19')](faxAccount[_0x74db('0x32')]())['then'](realtime[_0x74db('0x33')]())[_0x74db('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x74db('0x18')]()[_0x74db('0x19')](voiceQueueReport[_0x74db('0x34')]())['then'](realtime[_0x74db('0x35')]())[_0x74db('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x74db('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x74db('0x19')](cmHopperHistory[_0x74db('0x36')]())['then'](realtime[_0x74db('0x37')]())[_0x74db('0x19')](voiceCallReport[_0x74db('0x38')]())[_0x74db('0x19')](realtime[_0x74db('0x39')]())['then'](function(_0x347fd9){})['catch'](function(_0x3eb55b){console[_0x74db('0x3a')](_0x3eb55b);});}function main(){return server[_0x74db('0x3b')](realtime,preview,fax)[_0x74db('0x19')](function(_0x3fc894){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x74db('0x3c')]();setInterval(initRealtime,0x1388);})[_0x74db('0x3d')](function(_0x5da7b2){console[_0x74db('0x3a')](_0x5da7b2);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index d5e71f5..d3d83b9 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 _0xf483=['inuse','talking','format','stateTime','stringify','emit','user:save','exports','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','not_inuse','idle'];(function(_0xcc7707,_0x3e9f72){var _0x3d3479=function(_0x49e780){while(--_0x49e780){_0xcc7707['push'](_0xcc7707['shift']());}};_0x3d3479(++_0x3e9f72);}(_0xf483,0xf6));var _0x3f48=function(_0x575511,_0x51b6fd){_0x575511=_0x575511-0x0;var _0x1ef280=_0xf483[_0x575511];return _0x1ef280;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0x3f48('0x0'));var config=require(_0x3f48('0x1'));config[_0x3f48('0x2')]=_[_0x3f48('0x3')](config[_0x3f48('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x3f48('0x4'))(new Redis(config['redis']));function Agent(_0x4c0614){this['id']=_0x4c0614['id']||0x0;this['name']=_0x4c0614['name']||'';this[_0x3f48('0x5')]=_0x4c0614[_0x3f48('0x5')]||'';this[_0x3f48('0x6')]=_0x4c0614['accountcode']||'';this['fullname']=_0x4c0614[_0x3f48('0x7')]||'';this[_0x3f48('0x8')]=_0x3f48('0x9');this['stateTime']=0x0;this[_0x3f48('0xa')]=_0x3f48('0x9');this[_0x3f48('0xb')]='';this[_0x3f48('0xc')]='';this[_0x3f48('0xd')]='';this[_0x3f48('0xe')]='';this['online']=_0x4c0614[_0x3f48('0xf')]||![];this[_0x3f48('0x10')]=_0x3f48('0x9');this[_0x3f48('0x11')]=0x0;this[_0x3f48('0x12')]='';this[_0x3f48('0x13')]='';this[_0x3f48('0x14')]=![];this[_0x3f48('0x15')]=![];this[_0x3f48('0x16')]='';}Agent[_0x3f48('0x17')]['updateStatusRealtime']=function(_0x148c0f){var _0x1eebf7;if(_0x148c0f&&_0x148c0f[_0x3f48('0x8')]){_0x1eebf7=_0x148c0f[_0x3f48('0x8')]['toLowerCase']();switch(_0x1eebf7){case _0x3f48('0x18'):_0x1eebf7=_0x3f48('0x19');break;case _0x3f48('0x1a'):_0x1eebf7=_0x3f48('0x1b');break;}}if(_0x1eebf7&&this[_0x3f48('0x10')]!==_0x1eebf7||_0x148c0f['statePause']){this[_0x3f48('0x11')]=_['toNumber'](moment()[_0x3f48('0x1c')]('x'));}if(_0x1eebf7){this[_0x3f48('0x10')]=_0x1eebf7;}var _0xb6e472={'id':this['id'],'name':this['name'],'email':this[_0x3f48('0x5')],'accountcode':this[_0x3f48('0x6')],'fullname':this[_0x3f48('0x7')],'state':this[_0x3f48('0x8')],'stateTime':this[_0x3f48('0x1d')],'status':this['status'],'address':this['address'],'online':this[_0x3f48('0xf')],'voiceStatus':this[_0x3f48('0x10')],'voiceStatusTime':this[_0x3f48('0x11')],'voiceStatusCallerIdNumber':this[_0x3f48('0x12')],'voiceStatusQueue':this[_0x3f48('0x13')],'interface':this[_0x3f48('0xe')],'onhold':this[_0x3f48('0x14')]};var _0x12f1a7=md5(JSON[_0x3f48('0x1e')](_0xb6e472));if(this['md5']!==_0x12f1a7){this[_0x3f48('0x16')]=_0x12f1a7;io['to'](util[_0x3f48('0x1c')]('user:%s',_0xb6e472['name']))[_0x3f48('0x1f')](_0x3f48('0x20'),_0xb6e472);}};module[_0x3f48('0x21')]=Agent; \ No newline at end of file +var _0xca7d=['state','toLowerCase','idle','inuse','statePause','format','voiceStatusQueue','stringify','user:%s','emit','exports','util','moment','md5','ioredis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime'];(function(_0x210812,_0x28244f){var _0xea4fb8=function(_0x57ea4e){while(--_0x57ea4e){_0x210812['push'](_0x210812['shift']());}};_0xea4fb8(++_0x28244f);}(_0xca7d,0x123));var _0xdca7=function(_0x4f1baf,_0x5369be){_0x4f1baf=_0x4f1baf-0x0;var _0x23ed6f=_0xca7d[_0x4f1baf];return _0x23ed6f;};'use strict';var _=require('lodash');var util=require(_0xdca7('0x0'));var moment=require(_0xdca7('0x1'));var md5=require(_0xdca7('0x2'));var Redis=require(_0xdca7('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xdca7('0x4')](config['redis'],{'host':_0xdca7('0x5'),'port':0x18eb});var io=require(_0xdca7('0x6'))(new Redis(config['redis']));function Agent(_0x448ca8){this['id']=_0x448ca8['id']||0x0;this[_0xdca7('0x7')]=_0x448ca8[_0xdca7('0x7')]||'';this[_0xdca7('0x8')]=_0x448ca8['email']||'';this[_0xdca7('0x9')]=_0x448ca8[_0xdca7('0x9')]||'';this[_0xdca7('0xa')]=_0x448ca8[_0xdca7('0xa')]||'';this['state']='unknown';this[_0xdca7('0xb')]=0x0;this[_0xdca7('0xc')]=_0xdca7('0xd');this[_0xdca7('0xe')]='';this['phone']='';this[_0xdca7('0xf')]='';this[_0xdca7('0x10')]='';this[_0xdca7('0x11')]=_0x448ca8[_0xdca7('0x11')]||![];this[_0xdca7('0x12')]='unknown';this[_0xdca7('0x13')]=0x0;this[_0xdca7('0x14')]='';this['voiceStatusQueue']='';this[_0xdca7('0x15')]=![];this[_0xdca7('0x16')]=![];this[_0xdca7('0x2')]='';}Agent['prototype'][_0xdca7('0x17')]=function(_0x5c9954){var _0x1779d1;if(_0x5c9954&&_0x5c9954['state']){_0x1779d1=_0x5c9954[_0xdca7('0x18')][_0xdca7('0x19')]();switch(_0x1779d1){case'not_inuse':_0x1779d1=_0xdca7('0x1a');break;case _0xdca7('0x1b'):_0x1779d1='talking';break;}}if(_0x1779d1&&this[_0xdca7('0x12')]!==_0x1779d1||_0x5c9954[_0xdca7('0x1c')]){this['voiceStatusTime']=_['toNumber'](moment()[_0xdca7('0x1d')]('x'));}if(_0x1779d1){this['voiceStatus']=_0x1779d1;}var _0x3c31bf={'id':this['id'],'name':this[_0xdca7('0x7')],'email':this[_0xdca7('0x8')],'accountcode':this[_0xdca7('0x9')],'fullname':this[_0xdca7('0xa')],'state':this[_0xdca7('0x18')],'stateTime':this['stateTime'],'status':this[_0xdca7('0xc')],'address':this[_0xdca7('0xe')],'online':this[_0xdca7('0x11')],'voiceStatus':this[_0xdca7('0x12')],'voiceStatusTime':this[_0xdca7('0x13')],'voiceStatusCallerIdNumber':this[_0xdca7('0x14')],'voiceStatusQueue':this[_0xdca7('0x1e')],'interface':this['interface'],'onhold':this[_0xdca7('0x15')]};var _0x5d8f1d=md5(JSON[_0xdca7('0x1f')](_0x3c31bf));if(this[_0xdca7('0x2')]!==_0x5d8f1d){this['md5']=_0x5d8f1d;io['to'](util[_0xdca7('0x1d')](_0xdca7('0x20'),_0x3c31bf['name']))[_0xdca7('0x21')]('user:save',_0x3c31bf);}};module[_0xdca7('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4bb167c..7439aba 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 _0xb296=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x3ce7d7,_0x54418a){var _0x36702c=function(_0x5961bf){while(--_0x5961bf){_0x3ce7d7['push'](_0x3ce7d7['shift']());}};_0x36702c(++_0x54418a);}(_0xb296,0xeb));var _0x6b29=function(_0x567617,_0x25ba0e){_0x567617=_0x567617-0x0;var _0x3887e4=_0xb296[_0x567617];return _0x3887e4;};'use strict';function Campaign(_0xc7ebc){this['id']=_0xc7ebc['id']||0x0;this[_0x6b29('0x0')]=_0xc7ebc['name']||'';this[_0x6b29('0x1')]=_0xc7ebc[_0x6b29('0x1')]||_0x6b29('0x2');this[_0x6b29('0x3')]=0x0;this[_0x6b29('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x6b29('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0xc7ebc[_0x6b29('0x6')];this[_0x6b29('0x7')]=_0xc7ebc[_0x6b29('0x7')];this[_0x6b29('0x8')]=_0xc7ebc[_0x6b29('0x8')]||null;this[_0x6b29('0x9')]=_0xc7ebc['dialGlobalInterval']?_0xc7ebc[_0x6b29('0x9')]:null;this[_0x6b29('0xa')]=_0xc7ebc[_0x6b29('0xa')];this[_0x6b29('0xb')]=_0xc7ebc[_0x6b29('0xb')];this[_0x6b29('0xc')]=_0xc7ebc[_0x6b29('0xc')]||0x1e;this[_0x6b29('0xd')]=_0xc7ebc[_0x6b29('0xd')];this[_0x6b29('0xe')]=_0xc7ebc['dialCongestionRetryFrequency'];this[_0x6b29('0xf')]=_0xc7ebc[_0x6b29('0xf')];this['dialBusyRetryFrequency']=_0xc7ebc[_0x6b29('0x10')];this[_0x6b29('0x11')]=_0xc7ebc[_0x6b29('0x11')];this[_0x6b29('0x12')]=_0xc7ebc['dialNoAnswerRetryFrequency'];this[_0x6b29('0x13')]=_0xc7ebc[_0x6b29('0x13')];this[_0x6b29('0x14')]=_0xc7ebc[_0x6b29('0x14')]||0x3;this[_0x6b29('0x15')]=_0xc7ebc[_0x6b29('0x15')]||0x96;this[_0x6b29('0x16')]=_0xc7ebc['dialDropMaxRetry']||0x3;this[_0x6b29('0x17')]=_0xc7ebc['dialDropRetryFrequency']||0x96;this[_0x6b29('0x18')]=_0xc7ebc[_0x6b29('0x18')]||0x3;this[_0x6b29('0x19')]=_0xc7ebc[_0x6b29('0x19')]||0x96;this['dialMachineMaxRetry']=_0xc7ebc[_0x6b29('0x1a')]||0x3;this[_0x6b29('0x1b')]=_0xc7ebc[_0x6b29('0x1b')]||0x96;this[_0x6b29('0x1c')]=_0xc7ebc[_0x6b29('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xc7ebc[_0x6b29('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0xc7ebc[_0x6b29('0x1e')]||'DESC';this[_0x6b29('0x1f')]=_0xc7ebc[_0x6b29('0x1f')]||undefined;this[_0x6b29('0x20')]=_0xc7ebc[_0x6b29('0x20')]||undefined;this[_0x6b29('0x21')]=_0xc7ebc[_0x6b29('0x21')]||undefined;this['TrunkBackup']=_0xc7ebc['TrunkBackup']?_0xc7ebc[_0x6b29('0x22')]:undefined;this[_0x6b29('0x23')]=_0xc7ebc[_0x6b29('0x23')]?_0xc7ebc[_0x6b29('0x23')]:undefined;this['Interval']=_0xc7ebc['Interval']?_0xc7ebc[_0x6b29('0x24')]:undefined;this[_0x6b29('0x25')]=_0xc7ebc[_0x6b29('0x25')]?_0xc7ebc[_0x6b29('0x25')]:undefined;this[_0x6b29('0x26')]=_0xc7ebc['SquareProject']?_0xc7ebc['SquareProject'][_0x6b29('0x0')]:undefined;this['dialAMDActive']=_0xc7ebc[_0x6b29('0x27')]||![];this[_0x6b29('0x28')]=_0xc7ebc[_0x6b29('0x28')];this['dialAMDGreeting']=_0xc7ebc[_0x6b29('0x29')];this['dialAMDAfterGreetingSilence']=_0xc7ebc[_0x6b29('0x2a')];this[_0x6b29('0x2b')]=_0xc7ebc['dialAMDTotalAnalysisTime'];this[_0x6b29('0x2c')]=_0xc7ebc['dialAMDMinWordLength'];this[_0x6b29('0x2d')]=_0xc7ebc[_0x6b29('0x2d')];this[_0x6b29('0x2e')]=_0xc7ebc[_0x6b29('0x2e')];this[_0x6b29('0x2f')]=_0xc7ebc['dialAMDSilenceThreshold'];this[_0x6b29('0x30')]=_0xc7ebc[_0x6b29('0x30')];}module[_0x6b29('0x31')]=Campaign; \ No newline at end of file +var _0x2bc2=['active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','type','originated','ivrAnswerCallsDay','message'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x2bc2,0x1ac));var _0x22bc=function(_0x206969,_0x2106e4){_0x206969=_0x206969-0x0;var _0x20a94d=_0x2bc2[_0x206969];return _0x20a94d;};'use strict';function Campaign(_0x2c3847){this['id']=_0x2c3847['id']||0x0;this['name']=_0x2c3847['name']||'';this[_0x22bc('0x0')]=_0x2c3847['type']||'campaign';this[_0x22bc('0x1')]=0x0;this['temp']=0x0;this[_0x22bc('0x2')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x22bc('0x3')]='';this['sendMessageOneNotActive']=!![];this[_0x22bc('0x4')]=_0x2c3847[_0x22bc('0x4')];this[_0x22bc('0x5')]=_0x2c3847[_0x22bc('0x5')];this['dialTimezone']=_0x2c3847['dialTimezone']||null;this[_0x22bc('0x6')]=_0x2c3847[_0x22bc('0x6')]?_0x2c3847[_0x22bc('0x6')]:null;this[_0x22bc('0x7')]=_0x2c3847[_0x22bc('0x7')];this[_0x22bc('0x8')]=_0x2c3847[_0x22bc('0x8')];this['dialOriginateTimeout']=_0x2c3847[_0x22bc('0x9')]||0x1e;this[_0x22bc('0xa')]=_0x2c3847[_0x22bc('0xa')];this[_0x22bc('0xb')]=_0x2c3847['dialCongestionRetryFrequency'];this[_0x22bc('0xc')]=_0x2c3847[_0x22bc('0xc')];this[_0x22bc('0xd')]=_0x2c3847[_0x22bc('0xd')];this[_0x22bc('0xe')]=_0x2c3847[_0x22bc('0xe')];this[_0x22bc('0xf')]=_0x2c3847['dialNoAnswerRetryFrequency'];this[_0x22bc('0x10')]=_0x2c3847[_0x22bc('0x10')];this['dialNoSuchNumberMaxRetry']=_0x2c3847[_0x22bc('0x11')]||0x3;this[_0x22bc('0x12')]=_0x2c3847[_0x22bc('0x12')]||0x96;this['dialDropMaxRetry']=_0x2c3847[_0x22bc('0x13')]||0x3;this[_0x22bc('0x14')]=_0x2c3847[_0x22bc('0x14')]||0x96;this[_0x22bc('0x15')]=_0x2c3847[_0x22bc('0x15')]||0x3;this[_0x22bc('0x16')]=_0x2c3847[_0x22bc('0x16')]||0x96;this[_0x22bc('0x17')]=_0x2c3847[_0x22bc('0x17')]||0x3;this[_0x22bc('0x18')]=_0x2c3847[_0x22bc('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x2c3847[_0x22bc('0x19')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2c3847[_0x22bc('0x1a')]||0x96;this[_0x22bc('0x1b')]=_0x2c3847['dialOrderByScheduledAt']||_0x22bc('0x1c');this[_0x22bc('0x1d')]=_0x2c3847[_0x22bc('0x1d')]||undefined;this[_0x22bc('0x1e')]=_0x2c3847[_0x22bc('0x1e')]||undefined;this['dialCutDigit']=_0x2c3847[_0x22bc('0x1f')]||undefined;this['TrunkBackup']=_0x2c3847[_0x22bc('0x20')]?_0x2c3847[_0x22bc('0x20')]:undefined;this[_0x22bc('0x21')]=_0x2c3847[_0x22bc('0x21')]?_0x2c3847[_0x22bc('0x21')]:undefined;this[_0x22bc('0x22')]=_0x2c3847['Interval']?_0x2c3847[_0x22bc('0x22')]:undefined;this[_0x22bc('0x23')]=_0x2c3847[_0x22bc('0x23')]?_0x2c3847[_0x22bc('0x23')]:undefined;this[_0x22bc('0x24')]=_0x2c3847['SquareProject']?_0x2c3847['SquareProject'][_0x22bc('0x25')]:undefined;this[_0x22bc('0x26')]=_0x2c3847[_0x22bc('0x26')]||![];this[_0x22bc('0x27')]=_0x2c3847['dialAMDInitialSilence'];this[_0x22bc('0x28')]=_0x2c3847[_0x22bc('0x28')];this[_0x22bc('0x29')]=_0x2c3847[_0x22bc('0x29')];this['dialAMDTotalAnalysisTime']=_0x2c3847[_0x22bc('0x2a')];this[_0x22bc('0x2b')]=_0x2c3847[_0x22bc('0x2b')];this[_0x22bc('0x2c')]=_0x2c3847[_0x22bc('0x2c')];this[_0x22bc('0x2d')]=_0x2c3847[_0x22bc('0x2d')];this[_0x22bc('0x2e')]=_0x2c3847[_0x22bc('0x2e')];this['dialAMDMaximumWordLength']=_0x2c3847['dialAMDMaximumWordLength'];}module[_0x22bc('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 9bd1c28..c7964de 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 _0x0554=['connectedlinename','accountcode','context','exten','answered','unmanaged','abandoned','lastdata','duration','holdtime','type','tag','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','channel','calleridnum','connectedlinenum'];(function(_0x23196c,_0x1f8908){var _0x440bef=function(_0x18ebaf){while(--_0x18ebaf){_0x23196c['push'](_0x23196c['shift']());}};_0x440bef(++_0x1f8908);}(_0x0554,0x176));var _0x4055=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x0554[_0x6a0266];return _0x309e00;};'use strict';function Channel(){this[_0x4055('0x0')]=null;this[_0x4055('0x1')]='';this['destinationchannel']='';this[_0x4055('0x2')]=0x0;this['calleridname']='';this[_0x4055('0x3')]=undefined;this[_0x4055('0x4')]=undefined;this[_0x4055('0x5')]=0x0;this[_0x4055('0x6')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x4055('0x7')]=0x0;this[_0x4055('0x8')]=![];this['answertime']=null;this['endtime']=null;this[_0x4055('0x9')]=![];this[_0x4055('0xa')]=![];this['lastapplication']='';this[_0x4055('0xb')]='';this[_0x4055('0xc')]=0x0;this['billableseconds']=0x0;this[_0x4055('0xd')]=0x0;this[_0x4055('0xe')]=null;this[_0x4055('0xf')]=null;this['disposition']=null;this[_0x4055('0x10')]=![];this['monitorFilename']=null;this[_0x4055('0x11')]=null;this[_0x4055('0x12')]=[];this[_0x4055('0x13')]=undefined;this[_0x4055('0x14')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xf482=['exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid'];(function(_0x223fef,_0x85ab9c){var _0x1a5d86=function(_0x43ab35){while(--_0x43ab35){_0x223fef['push'](_0x223fef['shift']());}};_0x1a5d86(++_0x85ab9c);}(_0xf482,0xf0));var _0x2f48=function(_0x16277f,_0x8970b1){_0x16277f=_0x16277f-0x0;var _0x6683ee=_0xf482[_0x16277f];return _0x6683ee;};'use strict';function Channel(){this[_0x2f48('0x0')]=null;this[_0x2f48('0x1')]='';this[_0x2f48('0x2')]='';this[_0x2f48('0x3')]=0x0;this[_0x2f48('0x4')]='';this[_0x2f48('0x5')]=undefined;this[_0x2f48('0x6')]=undefined;this['accountcode']=0x0;this[_0x2f48('0x7')]='';this[_0x2f48('0x8')]=0x0;this[_0x2f48('0x9')]=0x0;this[_0x2f48('0xa')]=0x0;this[_0x2f48('0xb')]=![];this['answertime']=null;this[_0x2f48('0xc')]=null;this[_0x2f48('0xd')]=![];this[_0x2f48('0xe')]=![];this[_0x2f48('0xf')]='';this[_0x2f48('0x10')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x2f48('0x11')]=0x0;this['type']=null;this[_0x2f48('0x12')]=null;this[_0x2f48('0x13')]=null;this[_0x2f48('0x14')]=![];this['monitorFilename']=null;this[_0x2f48('0x15')]=null;this['monitors']=[];this[_0x2f48('0x16')]=undefined;this[_0x2f48('0x17')]=undefined;this['mohtime']=0x0;}module[_0x2f48('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2722aab..8adce3f 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 _0x2f74=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2f74,0x7b));var _0x42f7=function(_0x24d1c1,_0x365bf3){_0x24d1c1=_0x24d1c1-0x0;var _0x908781=_0x2f74[_0x24d1c1];return _0x908781;};'use strict';function DeskAccount(_0x1f6653){this['id']=_0x1f6653['id']||0x0;this['name']=_0x1f6653[_0x42f7('0x0')]||'';this[_0x42f7('0x1')]=_0x1f6653[_0x42f7('0x1')]||'';this[_0x42f7('0x2')]=_0x1f6653[_0x42f7('0x2')]||'';this[_0x42f7('0x3')]=_0x1f6653[_0x42f7('0x3')]||'';this[_0x42f7('0x4')]=_0x1f6653['password']||'';this['consumerKey']=_0x1f6653['consumerKey']||'';this[_0x42f7('0x5')]=_0x1f6653[_0x42f7('0x5')]||'';this[_0x42f7('0x6')]=_0x1f6653[_0x42f7('0x6')]||'';this[_0x42f7('0x7')]=_0x1f6653[_0x42f7('0x7')]||'';this[_0x42f7('0x8')]=_0x1f6653[_0x42f7('0x8')]||'';this['serverUrl']=_0x1f6653[_0x42f7('0x9')]||'';this[_0x42f7('0xa')]=_0x1f6653[_0x42f7('0xa')]||{};}module[_0x42f7('0xb')]=DeskAccount; \ No newline at end of file +var _0x9576=['serverUrl','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x4d6f03,_0x1ba36d){var _0x2989e9=function(_0x2e03ff){while(--_0x2e03ff){_0x4d6f03['push'](_0x4d6f03['shift']());}};_0x2989e9(++_0x1ba36d);}(_0x9576,0x182));var _0x6957=function(_0x3ea4cf,_0x459911){_0x3ea4cf=_0x3ea4cf-0x0;var _0x54efc7=_0x9576[_0x3ea4cf];return _0x54efc7;};'use strict';function DeskAccount(_0x4bfb2f){this['id']=_0x4bfb2f['id']||0x0;this[_0x6957('0x0')]=_0x4bfb2f[_0x6957('0x0')]||'';this[_0x6957('0x1')]=_0x4bfb2f['username']||'';this['remoteUri']=_0x4bfb2f[_0x6957('0x2')]||'';this[_0x6957('0x3')]=_0x4bfb2f[_0x6957('0x3')]||'';this[_0x6957('0x4')]=_0x4bfb2f[_0x6957('0x4')]||'';this[_0x6957('0x5')]=_0x4bfb2f[_0x6957('0x5')]||'';this['consumerSecret']=_0x4bfb2f[_0x6957('0x6')]||'';this[_0x6957('0x7')]=_0x4bfb2f[_0x6957('0x7')]||'';this[_0x6957('0x8')]=_0x4bfb2f[_0x6957('0x8')]||'';this[_0x6957('0x9')]=_0x4bfb2f['type']||'';this[_0x6957('0xa')]=_0x4bfb2f[_0x6957('0xa')]||'';this['Configurations']=_0x4bfb2f['Configurations']||{};}module[_0x6957('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 980e9ac..f206f33 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 _0x4075=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4075,0x16a));var _0x5407=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x4075[_0x44d9ab];return _0x31485e;};'use strict';function Dynamics365Account(_0xb0e3ec){this['id']=_0xb0e3ec['id']||0x0;this[_0x5407('0x0')]=_0xb0e3ec[_0x5407('0x0')]||'';this[_0x5407('0x1')]=_0xb0e3ec[_0x5407('0x1')]||'';this[_0x5407('0x2')]=_0xb0e3ec[_0x5407('0x2')]||'';this['remoteUri']=_0xb0e3ec[_0x5407('0x3')]||'';this[_0x5407('0x4')]=_0xb0e3ec[_0x5407('0x4')]||'';this[_0x5407('0x5')]=_0xb0e3ec[_0x5407('0x5')]||'';this[_0x5407('0x6')]=_0xb0e3ec[_0x5407('0x6')]||{};this['serverUrl']=_0xb0e3ec['serverUrl']||'';this[_0x5407('0x7')]=_0xb0e3ec[_0x5407('0x7')]||{};}module[_0x5407('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xd9ab=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x208749,_0x2b7b66){var _0x3e0042=function(_0x32abb0){while(--_0x32abb0){_0x208749['push'](_0x208749['shift']());}};_0x3e0042(++_0x2b7b66);}(_0xd9ab,0x1e7));var _0xbd9a=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xd9ab[_0x9df060];return _0x338dfe;};'use strict';function Dynamics365Account(_0x1a6e34){this['id']=_0x1a6e34['id']||0x0;this['name']=_0x1a6e34[_0xbd9a('0x0')]||'';this[_0xbd9a('0x1')]=_0x1a6e34[_0xbd9a('0x1')]||'';this['password']=_0x1a6e34[_0xbd9a('0x2')]||'';this['remoteUri']=_0x1a6e34[_0xbd9a('0x3')]||'';this[_0xbd9a('0x4')]=_0x1a6e34[_0xbd9a('0x4')]||'';this[_0xbd9a('0x5')]=_0x1a6e34[_0xbd9a('0x5')]||'';this[_0xbd9a('0x6')]=_0x1a6e34[_0xbd9a('0x6')]||{};this[_0xbd9a('0x7')]=_0x1a6e34['serverUrl']||'';this['Configurations']=_0x1a6e34[_0xbd9a('0x8')]||{};}module[_0xbd9a('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ca8806d..b894bb0 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 _0xa1cc=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xa1cc,0x10f));var _0xca1c=function(_0x5f2835,_0x1be416){_0x5f2835=_0x5f2835-0x0;var _0x132075=_0xa1cc[_0x5f2835];return _0x132075;};'use strict';function FaxAccount(_0x16c919){this['id']=_0x16c919['id']||0x0;this[_0xca1c('0x0')]=_0x16c919[_0xca1c('0x0')]||'';this['description']=_0x16c919[_0xca1c('0x1')];this[_0xca1c('0x2')]=_0x16c919[_0xca1c('0x2')];this['headerinfo']=_0x16c919[_0xca1c('0x3')];this['localstationid']=_0x16c919[_0xca1c('0x4')];this[_0xca1c('0x5')]=_0x16c919[_0xca1c('0x5')]||0x960;this[_0xca1c('0x6')]=_0x16c919['maxrate']||0x3840;this['modem']=_0x16c919[_0xca1c('0x7')]||_0xca1c('0x8');this[_0xca1c('0x9')]=_0x16c919['gateway']||'no';this['faxdetect']=_0x16c919['faxdetect']||'no';this[_0xca1c('0xa')]=_0x16c919['t38timeout']||0x1388;this[_0xca1c('0xb')]=_0x16c919[_0xca1c('0xb')]||_0xca1c('0xc');this[_0xca1c('0xd')]=_0x16c919[_0xca1c('0xd')]?_0x16c919['Trunk']:undefined;this[_0xca1c('0xe')]=_0x16c919[_0xca1c('0xe')];this['key']=_0x16c919[_0xca1c('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xf90c=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x44d6b8,_0xe7e065){var _0x18cbfa=function(_0x1704bc){while(--_0x1704bc){_0x44d6b8['push'](_0x44d6b8['shift']());}};_0x18cbfa(++_0xe7e065);}(_0xf90c,0x1a9));var _0xcf90=function(_0x55fd5b,_0x5b6189){_0x55fd5b=_0x55fd5b-0x0;var _0x368d81=_0xf90c[_0x55fd5b];return _0x368d81;};'use strict';function FaxAccount(_0x570c63){this['id']=_0x570c63['id']||0x0;this[_0xcf90('0x0')]=_0x570c63[_0xcf90('0x0')]||'';this[_0xcf90('0x1')]=_0x570c63[_0xcf90('0x1')];this[_0xcf90('0x2')]=_0x570c63[_0xcf90('0x2')];this[_0xcf90('0x3')]=_0x570c63[_0xcf90('0x3')];this[_0xcf90('0x4')]=_0x570c63[_0xcf90('0x4')];this[_0xcf90('0x5')]=_0x570c63[_0xcf90('0x5')]||0x960;this['maxrate']=_0x570c63[_0xcf90('0x6')]||0x3840;this['modem']=_0x570c63[_0xcf90('0x7')]||_0xcf90('0x8');this[_0xcf90('0x9')]=_0x570c63['gateway']||'no';this[_0xcf90('0xa')]=_0x570c63[_0xcf90('0xa')]||'no';this[_0xcf90('0xb')]=_0x570c63[_0xcf90('0xb')]||0x1388;this[_0xcf90('0xc')]=_0x570c63[_0xcf90('0xc')]||_0xcf90('0xd');this[_0xcf90('0xe')]=_0x570c63[_0xcf90('0xe')]?_0x570c63[_0xcf90('0xe')]:undefined;this['ListId']=_0x570c63[_0xcf90('0xf')];this[_0xcf90('0x10')]=_0x570c63[_0xcf90('0x10')];}module[_0xcf90('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 5262bfd..6ff76b4 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 _0xfcdc=['Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x31835f,_0x3f11ee){var _0x52d3bc=function(_0x4fcf51){while(--_0x4fcf51){_0x31835f['push'](_0x31835f['shift']());}};_0x52d3bc(++_0x3f11ee);}(_0xfcdc,0xb0));var _0xcfcd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfcdc[_0x4565bf];return _0x5610ba;};'use strict';function FreshdeskAccount(_0x47ff10){this['id']=_0x47ff10['id']||0x0;this[_0xcfcd('0x0')]=_0x47ff10[_0xcfcd('0x0')]||'';this[_0xcfcd('0x1')]=_0x47ff10[_0xcfcd('0x1')]||'';this[_0xcfcd('0x2')]=_0x47ff10['token']||'';this[_0xcfcd('0x3')]=_0x47ff10[_0xcfcd('0x3')]||'';this['serverUrl']=_0x47ff10['serverUrl']||'';this[_0xcfcd('0x4')]=_0x47ff10[_0xcfcd('0x4')]||{};}module[_0xcfcd('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x55f0=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x88baa1,_0x313a22){var _0x129e1b=function(_0x2f3a29){while(--_0x2f3a29){_0x88baa1['push'](_0x88baa1['shift']());}};_0x129e1b(++_0x313a22);}(_0x55f0,0xbb));var _0x055f=function(_0x1e35bd,_0x40ee90){_0x1e35bd=_0x1e35bd-0x0;var _0x2c379d=_0x55f0[_0x1e35bd];return _0x2c379d;};'use strict';function FreshdeskAccount(_0x5d11a2){this['id']=_0x5d11a2['id']||0x0;this[_0x055f('0x0')]=_0x5d11a2['name']||'';this[_0x055f('0x1')]=_0x5d11a2[_0x055f('0x1')]||'';this[_0x055f('0x2')]=_0x5d11a2[_0x055f('0x3')]||'';this[_0x055f('0x4')]=_0x5d11a2[_0x055f('0x4')]||'';this[_0x055f('0x5')]=_0x5d11a2[_0x055f('0x5')]||'';this[_0x055f('0x6')]=_0x5d11a2[_0x055f('0x6')]||{};}module[_0x055f('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b5f9546..a28c980 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 _0x9296=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1bb5a6,_0x5d3d9b){var _0x428be0=function(_0x112838){while(--_0x112838){_0x1bb5a6['push'](_0x1bb5a6['shift']());}};_0x428be0(++_0x5d3d9b);}(_0x9296,0x10d));var _0x6929=function(_0xd69f9f,_0x4ee4d2){_0xd69f9f=_0xd69f9f-0x0;var _0x532345=_0x9296[_0xd69f9f];return _0x532345;};'use strict';function FreshsalesAccount(_0x3ad48a){this['id']=_0x3ad48a['id']||0x0;this['name']=_0x3ad48a[_0x6929('0x0')]||'';this['username']=_0x3ad48a[_0x6929('0x1')]||'';this[_0x6929('0x2')]=_0x3ad48a[_0x6929('0x3')]||'';this[_0x6929('0x4')]=_0x3ad48a['remoteUri']||'';this[_0x6929('0x5')]=_0x3ad48a['serverUrl']||'';this['Configurations']=_0x3ad48a[_0x6929('0x6')]||{};}module[_0x6929('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xd03f=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x10328d,_0x4d5ca1){var _0x5b69d8=function(_0x566d7a){while(--_0x566d7a){_0x10328d['push'](_0x10328d['shift']());}};_0x5b69d8(++_0x4d5ca1);}(_0xd03f,0x183));var _0xfd03=function(_0x3156bd,_0x2fa15d){_0x3156bd=_0x3156bd-0x0;var _0x1128e1=_0xd03f[_0x3156bd];return _0x1128e1;};'use strict';function FreshsalesAccount(_0x1178cb){this['id']=_0x1178cb['id']||0x0;this[_0xfd03('0x0')]=_0x1178cb[_0xfd03('0x0')]||'';this[_0xfd03('0x1')]=_0x1178cb[_0xfd03('0x1')]||'';this[_0xfd03('0x2')]=_0x1178cb[_0xfd03('0x3')]||'';this[_0xfd03('0x4')]=_0x1178cb[_0xfd03('0x4')]||'';this[_0xfd03('0x5')]=_0x1178cb[_0xfd03('0x5')]||'';this['Configurations']=_0x1178cb[_0xfd03('0x6')]||{};}module[_0xfd03('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index d463d89..ca9cc37 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 _0x9aff=['queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','context','exten','priority','holdtime','mohtime','variables','type','inbound','uniqueid','calleridname'];(function(_0x4940bf,_0x453f80){var _0x1a528c=function(_0x1906a9){while(--_0x1906a9){_0x4940bf['push'](_0x4940bf['shift']());}};_0x1a528c(++_0x453f80);}(_0x9aff,0x183));var _0xf9af=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x9aff[_0x11005e];return _0x29338f;};'use strict';function QueueReport(){this[_0xf9af('0x0')]=_0xf9af('0x1');this[_0xf9af('0x2')]='';this['calleridnum']='';this[_0xf9af('0x3')]='';this[_0xf9af('0x4')]='';this[_0xf9af('0x5')]=null;this[_0xf9af('0x6')]=null;this[_0xf9af('0x7')]=0x1;this[_0xf9af('0x8')]=0x1;this[_0xf9af('0x9')]=![];this[_0xf9af('0xa')]=null;this[_0xf9af('0xb')]=![];this[_0xf9af('0xc')]=null;this[_0xf9af('0xd')]=![];this[_0xf9af('0xe')]=null;this[_0xf9af('0xf')]=0x1;this[_0xf9af('0x10')]='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0xf9af('0x11')]='';this[_0xf9af('0x12')]='';this[_0xf9af('0x13')]='';this[_0xf9af('0x14')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0xf9af('0x15')]=0x0;this[_0xf9af('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x5967=['connectedlinenum','connectedlinename','context','holdtime','assigned','mohtime','variables','exports','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x5967,0x148));var _0x7596=function(_0x4c5088,_0x12274c){_0x4c5088=_0x4c5088-0x0;var _0x396d8e=_0x5967[_0x4c5088];return _0x396d8e;};'use strict';function QueueReport(){this['type']=_0x7596('0x0');this[_0x7596('0x1')]='';this['calleridnum']='';this[_0x7596('0x2')]='';this['queue']='';this[_0x7596('0x3')]=null;this[_0x7596('0x4')]=null;this['position']=0x1;this[_0x7596('0x5')]=0x1;this[_0x7596('0x6')]=![];this['queuecallerabandonAt']=null;this[_0x7596('0x7')]=![];this[_0x7596('0x8')]=null;this[_0x7596('0x9')]=![];this[_0x7596('0xa')]=null;this[_0x7596('0xb')]=0x1;this['channel']='';this[_0x7596('0xc')]='';this[_0x7596('0xd')]='';this['accountcode']='';this[_0x7596('0xe')]='';this['exten']='';this['priority']='';this[_0x7596('0xf')]=0x0;this[_0x7596('0x10')]=![];this['lastAssignedTo']='';this[_0x7596('0x11')]=0x0;this[_0x7596('0x12')]={};}module[_0x7596('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f0f00ba..de93ed0 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 _0xd2c8=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xd2c8,0x148));var _0x8d2c=function(_0x4914d4,_0x3b8712){_0x4914d4=_0x4914d4-0x0;var _0x587461=_0xd2c8[_0x4914d4];return _0x587461;};'use strict';function SalesforceAccount(_0x3fb39c){this['id']=_0x3fb39c['id']||0x0;this['name']=_0x3fb39c[_0x8d2c('0x0')]||'';this['username']=_0x3fb39c[_0x8d2c('0x1')]||'';this[_0x8d2c('0x2')]=_0x3fb39c[_0x8d2c('0x2')]||'';this[_0x8d2c('0x3')]=_0x3fb39c[_0x8d2c('0x3')]||'';this[_0x8d2c('0x4')]=_0x3fb39c[_0x8d2c('0x4')]||'';this[_0x8d2c('0x5')]=_0x3fb39c['clientSecret']||'';this[_0x8d2c('0x6')]=_0x3fb39c[_0x8d2c('0x6')]||'';this[_0x8d2c('0x7')]=_0x3fb39c['type']||_0x8d2c('0x8');this['serverUrl']=_0x3fb39c[_0x8d2c('0x9')]||'';this[_0x8d2c('0xa')]=_0x3fb39c[_0x8d2c('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xc7e6=['name','username','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x24e9df,_0x2820d6){var _0x52ceb4=function(_0x391fe7){while(--_0x391fe7){_0x24e9df['push'](_0x24e9df['shift']());}};_0x52ceb4(++_0x2820d6);}(_0xc7e6,0x1a2));var _0x6c7e=function(_0xc4e62c,_0x5b226e){_0xc4e62c=_0xc4e62c-0x0;var _0x44c950=_0xc7e6[_0xc4e62c];return _0x44c950;};'use strict';function SalesforceAccount(_0x42b8d4){this['id']=_0x42b8d4['id']||0x0;this[_0x6c7e('0x0')]=_0x42b8d4[_0x6c7e('0x0')]||'';this['username']=_0x42b8d4[_0x6c7e('0x1')]||'';this['remoteUri']=_0x42b8d4['remoteUri']||'';this[_0x6c7e('0x2')]=_0x42b8d4['password']||'';this[_0x6c7e('0x3')]=_0x42b8d4[_0x6c7e('0x3')]||'';this[_0x6c7e('0x4')]=_0x42b8d4['clientSecret']||'';this['securityToken']=_0x42b8d4[_0x6c7e('0x5')]||'';this[_0x6c7e('0x6')]=_0x42b8d4[_0x6c7e('0x6')]||_0x6c7e('0x7');this['serverUrl']=_0x42b8d4[_0x6c7e('0x8')]||'';this[_0x6c7e('0x9')]=_0x42b8d4['Configurations']||{};}module[_0x6c7e('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 7a4ca36..771736c 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 _0xd80a=['remoteUri','serverUrl','name','username','password'];(function(_0x5afeea,_0x5135e0){var _0x2e6da9=function(_0x44ae35){while(--_0x44ae35){_0x5afeea['push'](_0x5afeea['shift']());}};_0x2e6da9(++_0x5135e0);}(_0xd80a,0x7f));var _0xad80=function(_0x1021ff,_0x9e3d56){_0x1021ff=_0x1021ff-0x0;var _0x1da558=_0xd80a[_0x1021ff];return _0x1da558;};'use strict';function ServicenowAccount(_0x740f15){this['id']=_0x740f15['id']||0x0;this[_0xad80('0x0')]=_0x740f15[_0xad80('0x0')]||'';this[_0xad80('0x1')]=_0x740f15[_0xad80('0x1')]||'';this[_0xad80('0x2')]=_0x740f15[_0xad80('0x2')]||'';this[_0xad80('0x3')]=_0x740f15[_0xad80('0x3')]||'';this[_0xad80('0x4')]=_0x740f15[_0xad80('0x4')]||'';this['Configurations']=_0x740f15['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xa7c9=['Configurations','exports','name','username','remoteUri'];(function(_0x42a54f,_0x5be837){var _0x358edf=function(_0x153656){while(--_0x153656){_0x42a54f['push'](_0x42a54f['shift']());}};_0x358edf(++_0x5be837);}(_0xa7c9,0xc5));var _0x9a7c=function(_0x20237a,_0x17d50d){_0x20237a=_0x20237a-0x0;var _0x5578dd=_0xa7c9[_0x20237a];return _0x5578dd;};'use strict';function ServicenowAccount(_0x5e6eee){this['id']=_0x5e6eee['id']||0x0;this['name']=_0x5e6eee[_0x9a7c('0x0')]||'';this[_0x9a7c('0x1')]=_0x5e6eee[_0x9a7c('0x1')]||'';this['password']=_0x5e6eee['password']||'';this[_0x9a7c('0x2')]=_0x5e6eee[_0x9a7c('0x2')]||'';this['serverUrl']=_0x5e6eee['serverUrl']||'';this[_0x9a7c('0x3')]=_0x5e6eee[_0x9a7c('0x3')]||{};}module[_0x9a7c('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1f96230..cfc262f 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 _0xa78b=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4c6c87,_0x3fc2d4){var _0x523970=function(_0x4ad8e3){while(--_0x4ad8e3){_0x4c6c87['push'](_0x4c6c87['shift']());}};_0x523970(++_0x3fc2d4);}(_0xa78b,0x11f));var _0xba78=function(_0x5252d3,_0xfadd6d){_0x5252d3=_0x5252d3-0x0;var _0x4f4267=_0xa78b[_0x5252d3];return _0x4f4267;};'use strict';function SugarcrmAccount(_0x254f4){this['id']=_0x254f4['id']||0x0;this['name']=_0x254f4[_0xba78('0x0')]||'';this[_0xba78('0x1')]=_0x254f4[_0xba78('0x1')]||'';this[_0xba78('0x2')]=_0x254f4['password']||'';this[_0xba78('0x3')]=_0x254f4['remoteUri']||'';this[_0xba78('0x4')]=_0x254f4[_0xba78('0x4')]||'';this['Configurations']=_0x254f4[_0xba78('0x5')]||{};}module[_0xba78('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xcfae=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x63d29d,_0x2d2f14){var _0xe5111a=function(_0x4544c2){while(--_0x4544c2){_0x63d29d['push'](_0x63d29d['shift']());}};_0xe5111a(++_0x2d2f14);}(_0xcfae,0x186));var _0xecfa=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcfae[_0x618414];return _0x21c19a;};'use strict';function SugarcrmAccount(_0x2ad51f){this['id']=_0x2ad51f['id']||0x0;this[_0xecfa('0x0')]=_0x2ad51f['name']||'';this['username']=_0x2ad51f[_0xecfa('0x1')]||'';this['password']=_0x2ad51f['password']||'';this[_0xecfa('0x2')]=_0x2ad51f['remoteUri']||'';this[_0xecfa('0x3')]=_0x2ad51f[_0xecfa('0x3')]||'';this[_0xecfa('0x4')]=_0x2ad51f[_0xecfa('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3efa8b4..50b5bd4 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 _0x89d8=['status','unknown','exports','name','accountcode','state','stateTime'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x89d8,0x14c));var _0x889d=function(_0x536dcf,_0x7da5f){_0x536dcf=_0x536dcf-0x0;var _0x4065b1=_0x89d8[_0x536dcf];return _0x4065b1;};'use strict';function Telephone(_0x38a009){this['id']=_0x38a009['id']||0x0;this[_0x889d('0x0')]=_0x38a009[_0x889d('0x0')]||'';this['accountcode']=_0x38a009[_0x889d('0x1')]||'';this[_0x889d('0x2')]='unknown';this[_0x889d('0x3')]=0x0;this[_0x889d('0x4')]=_0x889d('0x5');this['address']='';}module[_0x889d('0x6')]=Telephone; \ No newline at end of file +var _0x21d5=['state','unknown','stateTime','exports','name','accountcode'];(function(_0x24d92a,_0x5dcc4d){var _0x2d5aed=function(_0x2df528){while(--_0x2df528){_0x24d92a['push'](_0x24d92a['shift']());}};_0x2d5aed(++_0x5dcc4d);}(_0x21d5,0x88));var _0x521d=function(_0xa3bf8f,_0x3ef836){_0xa3bf8f=_0xa3bf8f-0x0;var _0x2ea586=_0x21d5[_0xa3bf8f];return _0x2ea586;};'use strict';function Telephone(_0x5b2855){this['id']=_0x5b2855['id']||0x0;this['name']=_0x5b2855[_0x521d('0x0')]||'';this[_0x521d('0x1')]=_0x5b2855['accountcode']||'';this[_0x521d('0x2')]=_0x521d('0x3');this[_0x521d('0x4')]=0x0;this['status']=_0x521d('0x3');this['address']='';}module[_0x521d('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index c25e751..a0ba58f 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 _0x9fba=['html','name'];(function(_0x194291,_0x476bc0){var _0x36a97d=function(_0x141408){while(--_0x141408){_0x194291['push'](_0x194291['shift']());}};_0x36a97d(++_0x476bc0);}(_0x9fba,0x11f));var _0xa9fb=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x9fba[_0x31cb5f];return _0x586042;};'use strict';function template(_0x259295){this['id']=_0x259295['id']||0x0;this['name']=_0x259295[_0xa9fb('0x0')]||'';this[_0xa9fb('0x1')]=_0x259295[_0xa9fb('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x33f1=['html','exports','name'];(function(_0x5a5b84,_0x2b3a8a){var _0x5c4710=function(_0x1e6587){while(--_0x1e6587){_0x5a5b84['push'](_0x5a5b84['shift']());}};_0x5c4710(++_0x2b3a8a);}(_0x33f1,0x16d));var _0x133f=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x33f1[_0x408e38];return _0x426b0e;};'use strict';function template(_0x42572c){this['id']=_0x42572c['id']||0x0;this[_0x133f('0x0')]=_0x42572c['name']||'';this[_0x133f('0x1')]=_0x42572c[_0x133f('0x1')]||'';}module[_0x133f('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 090748f..a5497d6 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 _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x4611ad,_0x502232){var _0x12bbd2=function(_0x21f695){while(--_0x21f695){_0x4611ad['push'](_0x4611ad['shift']());}};_0x12bbd2(++_0x502232);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0xf3cd[_0x57d370];return _0x550fd2;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file +var _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x9f8c46,_0x40fed7){var _0x233e97=function(_0x4fc5c0){while(--_0x4fc5c0){_0x9f8c46['push'](_0x9f8c46['shift']());}};_0x233e97(++_0x40fed7);}(_0x34e8,0x12c));var _0x834e=function(_0x47f27d,_0x3f77b2){_0x47f27d=_0x47f27d-0x0;var _0x3f8cda=_0x34e8[_0x47f27d];return _0x3f8cda;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('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 1dfe02e..f04c8eb 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 _0x55f2=['split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','exports','active','name','status','unknown','registry','indexOf'];(function(_0x24d125,_0xb598cd){var _0x32d86e=function(_0x1506f4){while(--_0x1506f4){_0x24d125['push'](_0x24d125['shift']());}};_0x32d86e(++_0xb598cd);}(_0x55f2,0x117));var _0x255f=function(_0x166fe5,_0x1218f7){_0x166fe5=_0x166fe5-0x0;var _0x52fd4f=_0x55f2[_0x166fe5];return _0x52fd4f;};'use strict';function Trunk(_0x447081){this['id']=_0x447081['id']||0x0;this[_0x255f('0x0')]=_0x447081[_0x255f('0x0')]||![];this[_0x255f('0x1')]=_0x447081[_0x255f('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0x255f('0x2')]=_0x255f('0x3');this[_0x255f('0x4')]=_0x447081[_0x255f('0x4')]&&_0x447081[_0x255f('0x4')][_0x255f('0x5')](':')?_0x447081[_0x255f('0x4')][_0x255f('0x6')](':')[0x0]:'';this[_0x255f('0x7')]='';this[_0x255f('0x8')]='';this[_0x255f('0x9')]='';this[_0x255f('0xa')]='';this[_0x255f('0xb')]='';this[_0x255f('0xc')]='unknown';this[_0x255f('0xd')]='';this['address']='';}module[_0x255f('0xe')]=Trunk; \ No newline at end of file +var _0xffc8=['registrationtime','address','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry'];(function(_0x2477fb,_0x475101){var _0x4eda62=function(_0x51fc42){while(--_0x51fc42){_0x2477fb['push'](_0x2477fb['shift']());}};_0x4eda62(++_0x475101);}(_0xffc8,0x123));var _0x8ffc=function(_0x1406dd,_0x187e2d){_0x1406dd=_0x1406dd-0x0;var _0x5ba016=_0xffc8[_0x1406dd];return _0x5ba016;};'use strict';function Trunk(_0x54b775){this['id']=_0x54b775['id']||0x0;this[_0x8ffc('0x0')]=_0x54b775[_0x8ffc('0x0')]||![];this[_0x8ffc('0x1')]=_0x54b775[_0x8ffc('0x1')]||'';this[_0x8ffc('0x2')]=_0x8ffc('0x3');this[_0x8ffc('0x4')]=0x0;this['status']=_0x8ffc('0x3');this[_0x8ffc('0x5')]=_0x54b775[_0x8ffc('0x5')]&&_0x54b775['registry'][_0x8ffc('0x6')](':')?_0x54b775['registry'][_0x8ffc('0x7')](':')[0x0]:'';this[_0x8ffc('0x8')]='';this['port']='';this[_0x8ffc('0x9')]='';this[_0x8ffc('0xa')]='';this[_0x8ffc('0xb')]='';this[_0x8ffc('0xc')]=_0x8ffc('0x3');this[_0x8ffc('0xd')]='';this[_0x8ffc('0xe')]='';}module[_0x8ffc('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 7fbe35f..f65c5e4 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 _0xf434=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x369548,_0xc21cfc){var _0x506f9a=function(_0x24e6cb){while(--_0x24e6cb){_0x369548['push'](_0x369548['shift']());}};_0x506f9a(++_0xc21cfc);}(_0xf434,0x95));var _0x4f43=function(_0x28c21d,_0xc69045){_0x28c21d=_0x28c21d-0x0;var _0x409c37=_0xf434[_0x28c21d];return _0x409c37;};'use strict';function voiceExtension(_0x337b56){this['id']=_0x337b56['id']||0x0;this['exten']=_0x337b56[_0x4f43('0x0')]||'';this[_0x4f43('0x1')]=_0x337b56[_0x4f43('0x1')]||'none';this[_0x4f43('0x2')]=_0x337b56[_0x4f43('0x2')]||![];}module[_0x4f43('0x3')]=voiceExtension; \ No newline at end of file +var _0x6be6=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x19b981,_0x293728){var _0x4b0a79=function(_0x5d13e8){while(--_0x5d13e8){_0x19b981['push'](_0x19b981['shift']());}};_0x4b0a79(++_0x293728);}(_0x6be6,0x90));var _0x66be=function(_0x24b930,_0x5c5d84){_0x24b930=_0x24b930-0x0;var _0x11ad0c=_0x6be6[_0x24b930];return _0x11ad0c;};'use strict';function voiceExtension(_0x4a9e09){this['id']=_0x4a9e09['id']||0x0;this[_0x66be('0x0')]=_0x4a9e09[_0x66be('0x0')]||'';this['recordingFormat']=_0x4a9e09[_0x66be('0x1')]||_0x66be('0x2');this['mandatoryDisposition']=_0x4a9e09[_0x66be('0x3')]||![];}module[_0x66be('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 5fe3a42..528bb13 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 _0x716c=['exports','unknown','not_inuse','inuse','busy','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x5d859a,_0x16eafb){var _0x2bc95f=function(_0x2b50ef){while(--_0x2b50ef){_0x5d859a['push'](_0x5d859a['shift']());}};_0x2bc95f(++_0x16eafb);}(_0x716c,0x7f));var _0xc716=function(_0x378a2b,_0x13433f){_0x378a2b=_0x378a2b-0x0;var _0x552cac=_0x716c[_0x378a2b];return _0x552cac;};'use strict';var statusDesc=[_0xc716('0x0'),_0xc716('0x1'),_0xc716('0x2'),_0xc716('0x3'),'invalid','unavailable','ringing',_0xc716('0x4'),_0xc716('0x5')];var monitorFormat={'wav':_0xc716('0x6'),'wav49':_0xc716('0x7'),'gsm':_0xc716('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xc716('0x9')};function VoiceQueue(_0x428209){this['id']=_0x428209['id']||0x0;this[_0xc716('0xa')]=_0x428209['name']||'';this[_0xc716('0xb')]=_0x428209[_0xc716('0xb')]||'';this[_0xc716('0xc')]=_0x428209[_0xc716('0xc')]||_0xc716('0xd');this[_0xc716('0xe')]=0x0;this['talking']=0x0;this[_0xc716('0xf')]=0x0;this[_0xc716('0x10')]=0x0;this[_0xc716('0x11')]=0x0;this[_0xc716('0x12')]=0x0;this['sumBillable']=0x0;this[_0xc716('0x13')]=0x0;this[_0xc716('0x14')]=0x0;this[_0xc716('0x15')]=0x0;this[_0xc716('0x16')]=0x0;this[_0xc716('0x17')]=_0x428209[_0xc716('0x17')]||![];this['acwTimeout']=_0x428209[_0xc716('0x18')]||0xa;this['autopause']=_0x428209[_0xc716('0x19')]||'no';this['sendMessageOneNotActive']=!![];this[_0xc716('0x1a')]='';this[_0xc716('0x1b')]=0x0;this['temp']=0x0;this[_0xc716('0x1c')]=_0x428209[_0xc716('0x1c')]||null;this[_0xc716('0x1d')]=_0x428209[_0xc716('0x1d')]?_0x428209[_0xc716('0x1d')]:null;this[_0xc716('0x1e')]=_0x428209['dialActive'];this[_0xc716('0x1f')]=_0x428209[_0xc716('0x1f')]||'progressive';this[_0xc716('0x20')]=_0x428209['dialLimitChannel']||0x0;this[_0xc716('0x21')]=_0x428209['dialLimitQueue']||0x0;this[_0xc716('0x22')]=_0x428209[_0xc716('0x22')]||0x1;this[_0xc716('0x23')]=_0x428209['dialPredictiveOptimization']||_0xc716('0x24');this[_0xc716('0x25')]=_0x428209[_0xc716('0x25')]||0.03;this[_0xc716('0x26')]=_0x428209[_0xc716('0x26')]||0x258;this[_0xc716('0x27')]=_0x428209['dialOriginateCallerIdName']||_0xc716('0x28');this[_0xc716('0x29')]=_0x428209['dialOriginateCallerIdNumber']||'anonymous';this[_0xc716('0x2a')]=_0x428209[_0xc716('0x2a')]||0x1e;this[_0xc716('0x2b')]=_0x428209[_0xc716('0x2b')]||_0xc716('0x2c');this[_0xc716('0x2d')]=_0x428209[_0xc716('0x2d')]||0x3;this['dialQueueProject']=_0x428209['dialQueueProject']||undefined;this[_0xc716('0x2e')]=_0x428209[_0xc716('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x428209[_0xc716('0x2f')]||0x96;this[_0xc716('0x30')]=_0x428209['dialBusyMaxRetry']||0x3;this[_0xc716('0x31')]=_0x428209[_0xc716('0x31')]||0x96;this[_0xc716('0x32')]=_0x428209[_0xc716('0x32')]||0x3;this[_0xc716('0x33')]=_0x428209[_0xc716('0x33')]||0x96;this[_0xc716('0x34')]=_0x428209[_0xc716('0x34')]||0x3;this[_0xc716('0x35')]=_0x428209[_0xc716('0x35')]||0x96;this[_0xc716('0x36')]=_0x428209[_0xc716('0x36')]||0x3;this[_0xc716('0x37')]=_0x428209[_0xc716('0x37')]||0x96;this[_0xc716('0x38')]=_0x428209[_0xc716('0x38')]||0x3;this[_0xc716('0x39')]=_0x428209[_0xc716('0x39')]||0x96;this[_0xc716('0x3a')]=_0x428209[_0xc716('0x3a')]||0x3;this[_0xc716('0x3b')]=_0x428209['dialMachineRetryFrequency']||0x96;this[_0xc716('0x3c')]=_0x428209[_0xc716('0x3c')]||0x3;this[_0xc716('0x3d')]=_0x428209['dialAgentRejectRetryFrequency']||0x96;this[_0xc716('0x3e')]=_0x428209[_0xc716('0x3e')]||0x4;this['Trunk']=_0x428209[_0xc716('0x3f')]?_0x428209[_0xc716('0x3f')]:undefined;this[_0xc716('0x40')]=_0x428209['TrunkBackup']?_0x428209['TrunkBackup']:undefined;this[_0xc716('0x41')]=_0x428209[_0xc716('0x41')]||undefined;this[_0xc716('0x42')]=_0x428209[_0xc716('0x42')]?_0x428209[_0xc716('0x42')]:undefined;this[_0xc716('0x43')]=_0x428209['dialOrderByScheduledAt']||'DESC';this[_0xc716('0x44')]=_0x428209[_0xc716('0x44')]||undefined;this[_0xc716('0x45')]=_0x428209[_0xc716('0x45')]||undefined;this[_0xc716('0x46')]=strategy[_0x428209[_0xc716('0x46')]]||_0xc716('0x47');this[_0xc716('0x48')]=!![];this['dialAMDActive']=_0x428209[_0xc716('0x49')]||![];this[_0xc716('0x4a')]=_0x428209['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x428209[_0xc716('0x4b')];this[_0xc716('0x4c')]=_0x428209['dialAMDAfterGreetingSilence'];this[_0xc716('0x4d')]=_0x428209[_0xc716('0x4d')];this[_0xc716('0x4e')]=_0x428209[_0xc716('0x4e')];this['dialAMDBetweenWordsSilence']=_0x428209[_0xc716('0x4f')];this[_0xc716('0x50')]=_0x428209[_0xc716('0x50')];this[_0xc716('0x51')]=_0x428209['dialAMDSilenceThreshold'];this[_0xc716('0x52')]=_0x428209[_0xc716('0x52')];this[_0xc716('0x53')]=0x0;this[_0xc716('0x54')]=0x0;this[_0xc716('0x55')]=_0x428209[_0xc716('0x55')];this[_0xc716('0x56')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xc716('0x57')]=0x0;this[_0xc716('0x58')]=0x0;this[_0xc716('0x59')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xc716('0x5a')]=0x0;this[_0xc716('0x5b')]=0x0;this[_0xc716('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xc716('0x5d')]=0x0;this[_0xc716('0x5e')]=0x0;this[_0xc716('0x5f')]=0x0;this[_0xc716('0x60')]=0x0;this[_0xc716('0x61')]=undefined;this[_0xc716('0x62')]=undefined;this[_0xc716('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xc716('0x64')]=0x0;this[_0xc716('0x65')]=0x0;this[_0xc716('0x66')]=0x0;this[_0xc716('0x67')]=0x0;this[_0xc716('0x68')]=0x0;this[_0xc716('0x69')]=0x0;this[_0xc716('0x6a')]=0x0;this[_0xc716('0x6b')]=0x0;this[_0xc716('0x6c')]=_0x428209[_0xc716('0x6d')]||0x14;this[_0xc716('0x6e')]=_0x428209['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc716('0x6f')]=0x0;this[_0xc716('0x70')]=0x0;this[_0xc716('0x71')]=0x1;this[_0xc716('0x72')]=0x0;this[_0xc716('0x73')]=0x0;this[_0xc716('0x74')]=0x0;this[_0xc716('0x75')]=0x0;this['dialRecallMeTimeout']=_0x428209[_0xc716('0x76')]||0x1e;this['dialRecallInQueue']=_0x428209[_0xc716('0x77')]||![];this[_0xc716('0x78')]=_0x428209['dialQueueProject2']||undefined;this[_0xc716('0x79')]=_0x428209['dialAgiAfterHangupClient']||![];this[_0xc716('0x7a')]=_0x428209[_0xc716('0x7a')]||![];this[_0xc716('0xb')]=monitorFormat[_0x428209[_0xc716('0xb')]]?monitorFormat[_0x428209[_0xc716('0xb')]]:undefined;this[_0xc716('0x7b')]=_0x428209[_0xc716('0x7b')]||![];this[_0xc716('0x7c')]=_0x428209[_0xc716('0x7c')]?_0x428209[_0xc716('0x7c')]:undefined;}module[_0xc716('0x7d')]=VoiceQueue; \ No newline at end of file +var _0x649f=['roundrobin','name','monitor_format','type','waiting','talking','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm'];(function(_0x334763,_0x575eff){var _0x566db0=function(_0x217cc2){while(--_0x217cc2){_0x334763['push'](_0x334763['shift']());}};_0x566db0(++_0x575eff);}(_0x649f,0x6b));var _0xf649=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x649f[_0x16b9ed];return _0x66b1f8;};'use strict';var statusDesc=[_0xf649('0x0'),'not_inuse',_0xf649('0x1'),'busy',_0xf649('0x2'),_0xf649('0x3'),_0xf649('0x4'),_0xf649('0x5'),_0xf649('0x6')];var monitorFormat={'wav':_0xf649('0x7'),'wav49':_0xf649('0x8'),'gsm':_0xf649('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xf649('0xa')};function VoiceQueue(_0x4743c6){this['id']=_0x4743c6['id']||0x0;this[_0xf649('0xb')]=_0x4743c6[_0xf649('0xb')]||'';this[_0xf649('0xc')]=_0x4743c6[_0xf649('0xc')]||'';this['type']=_0x4743c6[_0xf649('0xd')]||'inbound';this[_0xf649('0xe')]=0x0;this[_0xf649('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xf649('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0xf649('0x11')]=0x0;this[_0xf649('0x12')]=0x0;this['abandoned']=0x0;this[_0xf649('0x13')]=0x0;this[_0xf649('0x14')]=0x0;this['acw']=_0x4743c6[_0xf649('0x15')]||![];this[_0xf649('0x16')]=_0x4743c6[_0xf649('0x16')]||0xa;this['autopause']=_0x4743c6[_0xf649('0x17')]||'no';this[_0xf649('0x18')]=!![];this['message']='';this['originated']=0x0;this[_0xf649('0x19')]=0x0;this[_0xf649('0x1a')]=_0x4743c6['dialTimezone']||null;this[_0xf649('0x1b')]=_0x4743c6['dialGlobalInterval']?_0x4743c6[_0xf649('0x1b')]:null;this[_0xf649('0x1c')]=_0x4743c6[_0xf649('0x1c')];this[_0xf649('0x1d')]=_0x4743c6[_0xf649('0x1d')]||'progressive';this[_0xf649('0x1e')]=_0x4743c6[_0xf649('0x1e')]||0x0;this[_0xf649('0x1f')]=_0x4743c6[_0xf649('0x1f')]||0x0;this[_0xf649('0x20')]=_0x4743c6[_0xf649('0x20')]||0x1;this[_0xf649('0x21')]=_0x4743c6[_0xf649('0x21')]||'dropRate';this[_0xf649('0x22')]=_0x4743c6[_0xf649('0x22')]||0.03;this[_0xf649('0x23')]=_0x4743c6[_0xf649('0x23')]||0x258;this['dialOriginateCallerIdName']=_0x4743c6[_0xf649('0x24')]||_0xf649('0x25');this[_0xf649('0x26')]=_0x4743c6[_0xf649('0x26')]||'anonymous';this[_0xf649('0x27')]=_0x4743c6[_0xf649('0x27')]||0x1e;this['dialQueueOptions']=_0x4743c6[_0xf649('0x28')]||_0xf649('0x29');this[_0xf649('0x2a')]=_0x4743c6['dialQueueTimeout']||0x3;this[_0xf649('0x2b')]=_0x4743c6[_0xf649('0x2b')]||undefined;this[_0xf649('0x2c')]=_0x4743c6[_0xf649('0x2c')]||0x3;this['dialCongestionRetryFrequency']=_0x4743c6[_0xf649('0x2d')]||0x96;this[_0xf649('0x2e')]=_0x4743c6['dialBusyMaxRetry']||0x3;this[_0xf649('0x2f')]=_0x4743c6[_0xf649('0x2f')]||0x96;this[_0xf649('0x30')]=_0x4743c6[_0xf649('0x30')]||0x3;this[_0xf649('0x31')]=_0x4743c6['dialNoAnswerRetryFrequency']||0x96;this[_0xf649('0x32')]=_0x4743c6[_0xf649('0x32')]||0x3;this[_0xf649('0x33')]=_0x4743c6[_0xf649('0x33')]||0x96;this['dialDropMaxRetry']=_0x4743c6['dialDropMaxRetry']||0x3;this[_0xf649('0x34')]=_0x4743c6['dialDropRetryFrequency']||0x96;this[_0xf649('0x35')]=_0x4743c6['dialAbandonedMaxRetry']||0x3;this[_0xf649('0x36')]=_0x4743c6[_0xf649('0x36')]||0x96;this['dialMachineMaxRetry']=_0x4743c6[_0xf649('0x37')]||0x3;this[_0xf649('0x38')]=_0x4743c6[_0xf649('0x38')]||0x96;this[_0xf649('0x39')]=_0x4743c6[_0xf649('0x39')]||0x3;this[_0xf649('0x3a')]=_0x4743c6['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x4743c6[_0xf649('0x3b')]||0x4;this[_0xf649('0x3c')]=_0x4743c6['Trunk']?_0x4743c6['Trunk']:undefined;this['TrunkBackup']=_0x4743c6[_0xf649('0x3d')]?_0x4743c6['TrunkBackup']:undefined;this['dialPrefix']=_0x4743c6[_0xf649('0x3e')]||undefined;this[_0xf649('0x3f')]=_0x4743c6[_0xf649('0x3f')]?_0x4743c6[_0xf649('0x3f')]:undefined;this[_0xf649('0x40')]=_0x4743c6[_0xf649('0x40')]||_0xf649('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x4743c6[_0xf649('0x42')]||undefined;this['dialCutDigit']=_0x4743c6[_0xf649('0x43')]||undefined;this[_0xf649('0x44')]=strategy[_0x4743c6[_0xf649('0x44')]]||_0xf649('0x45');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x4743c6[_0xf649('0x46')]||![];this[_0xf649('0x47')]=_0x4743c6[_0xf649('0x47')];this[_0xf649('0x48')]=_0x4743c6[_0xf649('0x48')];this['dialAMDAfterGreetingSilence']=_0x4743c6['dialAMDAfterGreetingSilence'];this[_0xf649('0x49')]=_0x4743c6['dialAMDTotalAnalysisTime'];this[_0xf649('0x4a')]=_0x4743c6[_0xf649('0x4a')];this['dialAMDBetweenWordsSilence']=_0x4743c6['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x4743c6[_0xf649('0x4b')];this[_0xf649('0x4c')]=_0x4743c6[_0xf649('0x4c')];this[_0xf649('0x4d')]=_0x4743c6['dialAMDMaximumWordLength'];this[_0xf649('0x4e')]=0x0;this[_0xf649('0x4f')]=0x0;this[_0xf649('0x50')]=_0x4743c6[_0xf649('0x50')];this[_0xf649('0x51')]=0x0;this[_0xf649('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xf649('0x53')]=0x0;this[_0xf649('0x54')]=0x0;this[_0xf649('0x55')]=0x0;this[_0xf649('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xf649('0x57')]=0x0;this[_0xf649('0x58')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xf649('0x59')]=0x0;this[_0xf649('0x5a')]=0x0;this[_0xf649('0x5b')]=undefined;this[_0xf649('0x5c')]=undefined;this[_0xf649('0x5d')]=undefined;this[_0xf649('0x5e')]=1.05;this[_0xf649('0x5f')]=0x0;this[_0xf649('0x60')]=0x0;this[_0xf649('0x61')]=0x0;this[_0xf649('0x62')]=0x0;this[_0xf649('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xf649('0x64')]=0x0;this[_0xf649('0x65')]=0x0;this[_0xf649('0x66')]=_0x4743c6['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xf649('0x67')]=_0x4743c6[_0xf649('0x68')]||0xa;this[_0xf649('0x69')]=0x0;this[_0xf649('0x6a')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xf649('0x6b')]=0x0;this[_0xf649('0x6c')]=0x0;this['erlangBusyFactor']=0x0;this[_0xf649('0x6d')]=_0x4743c6[_0xf649('0x6d')]||0x1e;this[_0xf649('0x6e')]=_0x4743c6[_0xf649('0x6e')]||![];this[_0xf649('0x6f')]=_0x4743c6[_0xf649('0x6f')]||undefined;this[_0xf649('0x70')]=_0x4743c6[_0xf649('0x70')]||![];this[_0xf649('0x71')]=_0x4743c6[_0xf649('0x71')]||![];this['monitor_format']=monitorFormat[_0x4743c6['monitor_format']]?monitorFormat[_0x4743c6[_0xf649('0xc')]]:undefined;this[_0xf649('0x72')]=_0x4743c6[_0xf649('0x72')]||![];this[_0xf649('0x73')]=_0x4743c6[_0xf649('0x73')]?_0x4743c6[_0xf649('0x73')]:undefined;}module[_0xf649('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 59496b5..429105b 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 _0xad4b=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x22a2b3,_0x172046){var _0x38085c=function(_0x318233){while(--_0x318233){_0x22a2b3['push'](_0x22a2b3['shift']());}};_0x38085c(++_0x172046);}(_0xad4b,0xd0));var _0xbad4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xad4b[_0x23e7c1];return _0x1add43;};'use strict';function VtigerAccount(_0x1b1258){this['id']=_0x1b1258['id']||0x0;this[_0xbad4('0x0')]=_0x1b1258['name']||'';this['username']=_0x1b1258[_0xbad4('0x1')]||'';this[_0xbad4('0x2')]=_0x1b1258[_0xbad4('0x2')]||'';this[_0xbad4('0x3')]=_0x1b1258[_0xbad4('0x3')]||'';this[_0xbad4('0x4')]=_0x1b1258['serverUrl']||'';this[_0xbad4('0x5')]=_0x1b1258['Configurations']||{};}module[_0xbad4('0x6')]=VtigerAccount; \ No newline at end of file +var _0xab95=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0xbd18c1,_0x1374d9){var _0x20e3d6=function(_0x371afd){while(--_0x371afd){_0xbd18c1['push'](_0xbd18c1['shift']());}};_0x20e3d6(++_0x1374d9);}(_0xab95,0x85));var _0x5ab9=function(_0xd7267e,_0x314eb8){_0xd7267e=_0xd7267e-0x0;var _0x314ea0=_0xab95[_0xd7267e];return _0x314ea0;};'use strict';function VtigerAccount(_0x4ea40a){this['id']=_0x4ea40a['id']||0x0;this['name']=_0x4ea40a[_0x5ab9('0x0')]||'';this[_0x5ab9('0x1')]=_0x4ea40a['username']||'';this[_0x5ab9('0x2')]=_0x4ea40a[_0x5ab9('0x2')]||'';this[_0x5ab9('0x3')]=_0x4ea40a[_0x5ab9('0x3')]||'';this[_0x5ab9('0x4')]=_0x4ea40a[_0x5ab9('0x4')]||'';this[_0x5ab9('0x5')]=_0x4ea40a[_0x5ab9('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index df89bb1..d649259 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 _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x7a54,0x106));var _0x47a5=function(_0x2c662a,_0x148390){_0x2c662a=_0x2c662a-0x0;var _0x253fb8=_0x7a54[_0x2c662a];return _0x253fb8;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x7a54,0x106));var _0x47a5=function(_0x5959d6,_0x56652b){_0x5959d6=_0x5959d6-0x0;var _0x5fd52a=_0x7a54[_0x5959d6];return _0x5fd52a;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['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 a18f60f..c69aaa3 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 _0x2cf5=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId','clientSecret'];(function(_0x50eb9f,_0x4e99ad){var _0x1a3dec=function(_0x4810f3){while(--_0x4810f3){_0x50eb9f['push'](_0x50eb9f['shift']());}};_0x1a3dec(++_0x4e99ad);}(_0x2cf5,0x19f));var _0x52cf=function(_0x535cec,_0x42a116){_0x535cec=_0x535cec-0x0;var _0x441ed1=_0x2cf5[_0x535cec];return _0x441ed1;};'use strict';function ZohoAccount(_0x311197){this['id']=_0x311197['id']||0x0;this[_0x52cf('0x0')]=_0x311197['name']||'';this[_0x52cf('0x1')]=_0x311197['description']||'';this[_0x52cf('0x2')]=_0x311197[_0x52cf('0x2')]||'';this['zone']=_0x311197['zone']||'';this[_0x52cf('0x3')]=_0x311197[_0x52cf('0x3')]||'';this[_0x52cf('0x4')]=_0x311197[_0x52cf('0x4')]||'';this[_0x52cf('0x5')]=_0x311197[_0x52cf('0x5')]||'';this[_0x52cf('0x6')]=_0x311197[_0x52cf('0x6')]||'';this[_0x52cf('0x7')]=_0x311197[_0x52cf('0x7')]||'';this[_0x52cf('0x8')]=_0x311197['Configurations']||{};}module[_0x52cf('0x9')]=ZohoAccount; \ No newline at end of file +var _0xc19f=['clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x1352ea,_0x156581){var _0x1f4f9e=function(_0x2ca79f){while(--_0x2ca79f){_0x1352ea['push'](_0x1352ea['shift']());}};_0x1f4f9e(++_0x156581);}(_0xc19f,0x164));var _0xfc19=function(_0x21e284,_0x4c67a1){_0x21e284=_0x21e284-0x0;var _0x4e2c0a=_0xc19f[_0x21e284];return _0x4e2c0a;};'use strict';function ZohoAccount(_0x495153){this['id']=_0x495153['id']||0x0;this['name']=_0x495153[_0xfc19('0x0')]||'';this[_0xfc19('0x1')]=_0x495153['description']||'';this['host']=_0x495153[_0xfc19('0x2')]||'';this[_0xfc19('0x3')]=_0x495153[_0xfc19('0x3')]||'';this[_0xfc19('0x4')]=_0x495153[_0xfc19('0x4')]||'';this[_0xfc19('0x5')]=_0x495153[_0xfc19('0x5')]||'';this['serverUrl']=_0x495153['serverUrl']||'';this['code']=_0x495153[_0xfc19('0x6')]||'';this[_0xfc19('0x7')]=_0x495153[_0xfc19('0x7')]||'';this[_0xfc19('0x8')]=_0x495153[_0xfc19('0x8')]||{};}module[_0xfc19('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 11c9dbd..7ae8d97 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 _0x829f=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','type','queue','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x183850,_0x448d17){var _0x193cb8=function(_0x29f322){while(--_0x29f322){_0x183850['push'](_0x183850['shift']());}};_0x193cb8(++_0x448d17);}(_0x829f,0x181));var _0xf829=function(_0x5eaa4d,_0xa552bd){_0x5eaa4d=_0x5eaa4d-0x0;var _0x1a6079=_0x829f[_0x5eaa4d];return _0x1a6079;};'use strict';var util=require(_0xf829('0x0'));var _=require(_0xf829('0x1'));var moment=require(_0xf829('0x2'));function checkNameSurname(_0x347a82,_0x2c375b,_0x2e8876){var _0x3cabba='';if(!_[_0xf829('0x3')](_0x2c375b)&&_0xf829('0x4')===typeof _0x2c375b){_0x3cabba+=_0x2c375b;}if(!_[_0xf829('0x3')](_0x2e8876)&&_0xf829('0x4')===typeof _0x2e8876){_0x3cabba+='\x20'+_0x2e8876;}if(_0x3cabba!==''){return _0x3cabba;}return _0x347a82;}function Action(_0x23463e,_0x2842e1,_0x136c08,_0x4fe7b1,_0x18871d){this[_0xf829('0x5')]=_0x136c08||undefined;this[_0xf829('0x6')]=_0x23463e['id'];this['queue']=_0x2842e1['name'];this[_0xf829('0x7')]=_0x2842e1['type'];this['campaigntype']=_0xf829('0x8');this[_0xf829('0x9')]=![];this['membername']=_[_0xf829('0x3')](_0x23463e[_0xf829('0xa')])?undefined:_0x23463e[_0xf829('0xa')][_0xf829('0xb')];this[_0xf829('0xc')]=this[_0xf829('0xd')]?util[_0xf829('0xe')](_0xf829('0xf'),this[_0xf829('0xd')]):_0x4fe7b1||undefined;this[_0xf829('0x10')]=checkNameSurname(_0x23463e[_0xf829('0x11')][_0xf829('0x12')],_0x23463e[_0xf829('0x11')][_0xf829('0x13')],_0x23463e[_0xf829('0x11')][_0xf829('0x14')]);this[_0xf829('0x15')]=_0x23463e['active']||![];this[_0xf829('0x16')]=_0x23463e[_0xf829('0x11')][_0xf829('0x12')];this[_0xf829('0x17')]=_0x23463e[_0xf829('0x17')];this[_0xf829('0x18')]=_0x23463e[_0xf829('0x18')]||0x0;this[_0xf829('0x19')]=_0x23463e[_0xf829('0x19')]||0x0;this['countnoanswerretry']=_0x23463e[_0xf829('0x1a')]||0x0;this['countglobal']=(_0x23463e['countbusyretry']||0x0)+(_0x23463e['countcongestionretry']||0x0)+(_0x23463e[_0xf829('0x1a')]||0x0)+(_0x23463e[_0xf829('0x1b')]||0x0)+(_0x23463e[_0xf829('0x1c')]||0x0)+(_0x23463e['countabandonedretry']||0x0)+(_0x23463e['countmachineretry']||0x0)+(_0x23463e[_0xf829('0x1d')]||0x0);this['countnosuchnumberretry']=_0x23463e[_0xf829('0x1b')]||0x0;this[_0xf829('0x1c')]=_0x23463e[_0xf829('0x1c')]||0x0;this[_0xf829('0x1e')]=_0x23463e[_0xf829('0x1e')]||0x0;this[_0xf829('0x1f')]=_0x23463e[_0xf829('0x1f')]||0x0;this['countagentrejectretry']=_0x23463e['countagentrejectretry']||0x0;this['callback']=_0x23463e[_0xf829('0x20')];this[_0xf829('0x21')]=_0x23463e['callbackuniqueid'];this[_0xf829('0x22')]=_0x23463e[_0xf829('0x22')];this[_0xf829('0x23')]=_0x23463e[_0xf829('0x23')];this['ContactId']=_0x23463e[_0xf829('0x24')];this[_0xf829('0x25')]=_0x23463e[_0xf829('0x25')];this[_0xf829('0x26')]=_[_0xf829('0x3')](_0x23463e[_0xf829('0xa')])?_0x23463e[_0xf829('0x26')]:_0x23463e[_0xf829('0xa')]['id'];this['VoiceQueueId']=_0x23463e[_0xf829('0x27')];this[_0xf829('0x28')]='';this[_0xf829('0x29')]='';}Action[_0xf829('0x2a')][_0xf829('0x2b')]=function(){return util[_0xf829('0xe')](_0xf829('0x2c'),this[_0xf829('0x10')],this[_0xf829('0x2d')]);};module[_0xf829('0x2e')]=Action; \ No newline at end of file +var _0x60f5=['\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype'];(function(_0x5afd50,_0x456291){var _0xcf9ee8=function(_0x2c172a){while(--_0x2c172a){_0x5afd50['push'](_0x5afd50['shift']());}};_0xcf9ee8(++_0x456291);}(_0x60f5,0x8b));var _0x560f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x60f5[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x560f('0x0'));var _=require(_0x560f('0x1'));var moment=require(_0x560f('0x2'));function checkNameSurname(_0x270e45,_0x521161,_0x522777){var _0x30f22f='';if(!_[_0x560f('0x3')](_0x521161)&&_0x560f('0x4')===typeof _0x521161){_0x30f22f+=_0x521161;}if(!_[_0x560f('0x3')](_0x522777)&&'string'===typeof _0x522777){_0x30f22f+='\x20'+_0x522777;}if(_0x30f22f!==''){return _0x30f22f;}return _0x270e45;}function Action(_0x532342,_0x4a91c7,_0x25eb71,_0x7ec0bc,_0x31a014){this[_0x560f('0x5')]=_0x25eb71||undefined;this['idContact']=_0x532342['id'];this[_0x560f('0x6')]=_0x4a91c7[_0x560f('0x7')];this[_0x560f('0x8')]=_0x4a91c7['type'];this[_0x560f('0x9')]=_0x560f('0x6');this[_0x560f('0xa')]=![];this[_0x560f('0xb')]=_['isNil'](_0x532342[_0x560f('0xc')])?undefined:_0x532342[_0x560f('0xc')][_0x560f('0x7')];this['channelAgent']=this['membername']?util[_0x560f('0xd')](_0x560f('0xe'),this[_0x560f('0xb')]):_0x7ec0bc||undefined;this['calleridname']=checkNameSurname(_0x532342[_0x560f('0xf')][_0x560f('0x10')],_0x532342[_0x560f('0xf')][_0x560f('0x11')],_0x532342[_0x560f('0xf')][_0x560f('0x12')]);this[_0x560f('0x13')]=_0x532342[_0x560f('0x13')]||![];this[_0x560f('0x14')]=_0x532342['Contact'][_0x560f('0x10')];this[_0x560f('0x15')]=_0x532342[_0x560f('0x15')];this[_0x560f('0x16')]=_0x532342[_0x560f('0x16')]||0x0;this[_0x560f('0x17')]=_0x532342['countcongestionretry']||0x0;this[_0x560f('0x18')]=_0x532342[_0x560f('0x18')]||0x0;this['countglobal']=(_0x532342[_0x560f('0x16')]||0x0)+(_0x532342[_0x560f('0x17')]||0x0)+(_0x532342['countnoanswerretry']||0x0)+(_0x532342[_0x560f('0x19')]||0x0)+(_0x532342[_0x560f('0x1a')]||0x0)+(_0x532342[_0x560f('0x1b')]||0x0)+(_0x532342[_0x560f('0x1c')]||0x0)+(_0x532342[_0x560f('0x1d')]||0x0);this[_0x560f('0x19')]=_0x532342[_0x560f('0x19')]||0x0;this[_0x560f('0x1a')]=_0x532342[_0x560f('0x1a')]||0x0;this[_0x560f('0x1b')]=_0x532342[_0x560f('0x1b')]||0x0;this[_0x560f('0x1c')]=_0x532342['countmachineretry']||0x0;this['countagentrejectretry']=_0x532342['countagentrejectretry']||0x0;this[_0x560f('0x1e')]=_0x532342[_0x560f('0x1e')];this[_0x560f('0x1f')]=_0x532342[_0x560f('0x1f')];this[_0x560f('0x20')]=_0x532342['callbackat'];this[_0x560f('0x21')]=_0x532342[_0x560f('0x21')];this[_0x560f('0x22')]=_0x532342[_0x560f('0x22')];this[_0x560f('0x23')]=_0x532342[_0x560f('0x23')];this[_0x560f('0x24')]=_[_0x560f('0x3')](_0x532342[_0x560f('0xc')])?_0x532342[_0x560f('0x24')]:_0x532342['Agent']['id'];this[_0x560f('0x25')]=_0x532342[_0x560f('0x25')];this[_0x560f('0x26')]='';this[_0x560f('0x27')]='';}Action[_0x560f('0x28')]['getCaller']=function(){return util[_0x560f('0xd')](_0x560f('0x29'),this[_0x560f('0x2a')],this[_0x560f('0x2b')]);};module[_0x560f('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3e846a7..d63bfa6 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 _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0x47af8f,_0x440828){var _0x158d5d=function(_0x48948d){while(--_0x48948d){_0x47af8f['push'](_0x47af8f['shift']());}};_0x158d5d(++_0x440828);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file +var _0x34e8=['type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','emit','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0xf3cb02,_0x3688bd){_0xf3cb02=_0xf3cb02-0x0;var _0x5d2227=_0x34e8[_0xf3cb02];return _0x5d2227;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var uuid=require(_0x834e('0x3'));var moment=require('moment');var md5=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var loggerAction=require(_0x834e('0x7'))(_0x834e('0x9'));var ami=require('../ami');var rpcDb=require(_0x834e('0xa'));var Action=require('./action');var ut=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitCampaignPreview(_0x1b4bdf){if(_0x1b4bdf[_0x834e('0x25')]===_0x834e('0x26')){var _0x5c55ca={'id':_0x1b4bdf['id'],'name':_0x1b4bdf['name'],'strategy':_0x1b4bdf[_0x834e('0x27')],'answered':_0x1b4bdf[_0x834e('0x28')],'available':_0x1b4bdf['available'],'loggedIn':_0x1b4bdf[_0x834e('0x29')],'pTalking':_0x1b4bdf[_0x834e('0x2a')],'sumBillable':_0x1b4bdf['sumBillable'],'sumDuration':_0x1b4bdf[_0x834e('0x2b')],'sumHoldTime':_0x1b4bdf[_0x834e('0x2c')]||0x0,'talking':_0x1b4bdf[_0x834e('0x2d')],'total':_0x1b4bdf['total'],'type':_0x1b4bdf[_0x834e('0x25')],'unmanaged':_0x1b4bdf[_0x834e('0x2e')],'abandoned':_0x1b4bdf['abandoned'],'waiting':_0x1b4bdf['waiting'],'loggedInDb':_0x1b4bdf[_0x834e('0x2f')],'dialActive':_0x1b4bdf['dialActive'],'dialMethod':_0x1b4bdf[_0x834e('0x30')],'dialOriginateCallerIdName':_0x1b4bdf[_0x834e('0x31')],'dialOriginateCallerIdNumber':_0x1b4bdf[_0x834e('0x32')],'dialOriginateTimeout':_0x1b4bdf[_0x834e('0x33')],'dialPrefix':_0x1b4bdf[_0x834e('0x34')],'outboundAnswerAgiCallsDay':_0x1b4bdf[_0x834e('0x35')],'outboundAnswerCallsDay':_0x1b4bdf['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1b4bdf['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1b4bdf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1b4bdf['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1b4bdf[_0x834e('0x36')],'outboundDropCallsDayCallersExit':_0x1b4bdf[_0x834e('0x37')],'outboundDropCallsDayTimeout':_0x1b4bdf[_0x834e('0x38')],'outboundNoAnswerCallsDay':_0x1b4bdf['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1b4bdf[_0x834e('0x39')],'outboundOriginateFailureCallsDay':_0x1b4bdf[_0x834e('0x3a')],'outboundReCallsDay':_0x1b4bdf[_0x834e('0x3b')],'outboundRejectCallsDay':_0x1b4bdf[_0x834e('0x3c')],'outboundUnknownCallsDay':_0x1b4bdf[_0x834e('0x3d')],'outboundAbandonedCallsDay':_0x1b4bdf[_0x834e('0x3e')],'predictiveIntervalAnsweredCalls':_0x1b4bdf[_0x834e('0x3f')],'predictiveIntervalAvgHoldtime':_0x1b4bdf[_0x834e('0x40')],'predictiveIntervalAvgTalktime':_0x1b4bdf[_0x834e('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x1b4bdf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1b4bdf[_0x834e('0x42')],'predictiveIntervalErlangCalls':_0x1b4bdf['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b4bdf[_0x834e('0x43')],'predictiveIntervalHitRate':_0x1b4bdf[_0x834e('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1b4bdf[_0x834e('0x45')],'predictiveIntervalPauses':_0x1b4bdf[_0x834e('0x46')],'predictiveIntervalAvailable':_0x1b4bdf[_0x834e('0x47')],'predictiveIntervalTotalCalls':_0x1b4bdf[_0x834e('0x48')],'message':_0x1b4bdf[_0x834e('0x49')],'originated':_0x1b4bdf[_0x834e('0x4a')],'erlangCalls':_0x1b4bdf[_0x834e('0x4b')],'erlangCallToSecond':_0x1b4bdf[_0x834e('0x4c')],'erlangAbandonmentRate':_0x1b4bdf['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b4bdf[_0x834e('0x4d')],'startPredictive':_0x1b4bdf[_0x834e('0x4e')],'startProgressive':_0x1b4bdf[_0x834e('0x4f')]};if(_0x1b4bdf[_0x834e('0x50')]){_0x5c55ca['Trunk']={'id':_0x1b4bdf[_0x834e('0x50')]['id'],'name':_0x1b4bdf[_0x834e('0x50')]['name'],'active':_0x1b4bdf['Trunk']['active'],'callerid':_0x1b4bdf[_0x834e('0x50')][_0x834e('0x51')]};}if(_0x1b4bdf[_0x834e('0x52')]){_0x5c55ca[_0x834e('0x52')]={'id':_0x1b4bdf[_0x834e('0x52')]['id'],'name':_0x1b4bdf[_0x834e('0x52')]['name']};}var _0x2c2d94=md5(JSON['stringify'](_0x5c55ca));if(_0x1b4bdf[_0x834e('0x4')]!==_0x2c2d94){_0x1b4bdf[_0x834e('0x4')]=_0x2c2d94;emit(util['format'](_0x834e('0x53'),_0x5c55ca[_0x834e('0x54')]),'voice_queue:save',_0x5c55ca);}}}function emitVoiceQueueChannelRemove(_0x481f70){logger[_0x834e('0x55')](_0x834e('0x56'),JSON[_0x834e('0x57')](_0x481f70));emit(util[_0x834e('0x58')](_0x834e('0x53'),_0x481f70['name']),_0x834e('0x59'),_0x481f70);}function notSendMessagesQueue(_0x548d1d){if(_0x548d1d['sendMessageOneNotActive']){if(_0x548d1d[_0x834e('0x4a')]===0x0&&_0x548d1d['pTalking']===0x0){_0x548d1d[_0x834e('0x5a')]=![];_0x548d1d[_0x834e('0x5b')]=0x0;_0x548d1d[_0x834e('0x5c')]=0x0;_0x548d1d[_0x834e('0x49')]=_0x834e('0x5d');ut['logger'](_0x834e('0x5e'),_0x548d1d[_0x834e('0x54')]+_0x834e('0x5f'));}else{_0x548d1d['message']=_0x834e('0x60');ut[_0x834e('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x548d1d[_0x834e('0x54')]+'\x20is\x20disactive');}emitCampaignPreview(_0x548d1d);}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x4a18bb=this;setInterval(function(){_0x4a18bb['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x62')]=function(){var _0x3bcbf4=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x23feea in _0x3bcbf4){if(_0x3bcbf4[_0x834e('0x63')](_0x23feea)&&(_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x8')||_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x64'))&&_0x3bcbf4[_0x23feea]['type']===_0x834e('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x65')]();}}if(_0x3bcbf4['hasOwnProperty'](_0x23feea)&&_0x3bcbf4[_0x23feea][_0x834e('0x30')]===_0x834e('0x8')&&_0x3bcbf4[_0x23feea][_0x834e('0x25')]===_0x834e('0x26')){if(_0x3bcbf4[_0x23feea][_0x834e('0x66')]){this[_0x834e('0x67')](_0x3bcbf4[_0x23feea]);this[_0x834e('0x68')](_0x3bcbf4[_0x23feea]);}else{notSendMessagesQueue(_0x3bcbf4[_0x23feea]);}}}};Preview[_0x834e('0x10')][_0x834e('0x69')]=function(_0x279ea1){var _0x5f3943=this;this[_0x834e('0x14')][_0x834e('0x11')](function(){if(!_['isNil'](_0x5f3943[_0x834e('0x6a')][_0x279ea1])){loggerAction[_0x834e('0x55')](_0x834e('0x6b'),_0x279ea1,_0x834e('0x6c'),_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')],'originated:\x20',JSON['stringify'](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x4a')]),_0x834e('0x6e'),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x2a')]),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6f')]),JSON[_0x834e('0x57')](_[_0x834e('0x70')](_0x5f3943[_0x834e('0x6a')][_0x279ea1],[_0x834e('0x71'),_0x834e('0x72'),_0x834e('0x73'),_0x834e('0x74')])));return ami['Action']({'action':_0x834e('0x75'),'channel':_0x5f3943[_0x834e('0x6a')][_0x279ea1]['channel']})[_0x834e('0x76')](function(_0x3b0988){if(_0x3b0988['message']===_0x834e('0x77')){setTimeout(function(){if(_0x5f3943[_0x834e('0x6a')][_0x279ea1]){ut[_0x834e('0x78')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));if(_0x5f3943['actions'][_0x279ea1][_0x834e('0x6f')]===!![]){ut[_0x834e('0x7a')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));ut[_0x834e('0x7b')](_0x834e('0x7c')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);}ut['loggerError'](_0x834e('0x7d')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);delete _0x5f3943['actions'][_0x279ea1];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x65')]=function(){var _0x3e1bee=this;loggerAction['info']('[action]',_[_0x834e('0x7e')](this[_0x834e('0x6a')]));for(var _0x138ed2 in this[_0x834e('0x6a')]){if(_0x3e1bee[_0x834e('0x6a')][_0x834e('0x63')](_0x138ed2)){_0x3e1bee[_0x834e('0x69')](_0x138ed2);}}};Preview[_0x834e('0x10')]['recallMe']=function(_0x142334){var _0x3c70bf=this;rpcDb['getContactRecallMe'](_0x142334['id'],ut[_0x834e('0x7f')](this['agents']))[_0x834e('0x80')](function(_0x45eceb){if(!_['isNil'](_0x45eceb)){for(var _0x41ef86=0x0;_0x41ef86<_0x45eceb[_0x834e('0x81')];_0x41ef86+=0x1){if(ut[_0x834e('0x82')](_0x45eceb[_0x41ef86][_0x834e('0x83')])<_0x142334['dialRecallMeTimeout']*0x3c){if(_0x45eceb[_0x41ef86][_0x834e('0x84')]&&!_0x45eceb[_0x41ef86][_0x834e('0x84')][_0x834e('0x85')]){_0x3c70bf['run'](_0x45eceb[_0x41ef86]['id'])[_0x834e('0x80')](ut[_0x834e('0x86')](_0x834e('0x87')))[_0x834e('0x76')](ut[_0x834e('0x86')](_0x834e('0x87')));}else{rpcDb[_0x834e('0x88')](_0x45eceb[_0x41ef86]['id']);}}else{var _0x1def00=new Action(_0x45eceb[_0x41ef86],_0x142334);_0x1def00[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x142334[_0x834e('0x3b')]+=0x1;ut[_0x834e('0x8b')](_0x1def00,0x17,_0x834e('0x8c'));if(_0x142334[_0x834e('0x8d')]){rpcDb[_0x834e('0x8e')](ut[_0x834e('0x8f')](_0x45eceb[_0x41ef86]));rpcDb[_0x834e('0x90')](_0x1def00,_0x834e('0x91'));}else{ut[_0x834e('0x8b')](_0x1def00,0x16,_0x834e('0x92'));rpcDb[_0x834e('0x90')](_0x1def00,'[HistoryRecallClose]');rpcDb[_0x834e('0x93')](_0x1def00,_0x834e('0x94'));}}}}})[_0x834e('0x76')](ut[_0x834e('0x86')]('[getContactRecallMe]'));};Preview[_0x834e('0x10')]['setMessage']=function(_0x56a152){_0x56a152[_0x834e('0x5a')]=!![];if(ut[_0x834e('0x95')](_0x56a152[_0x834e('0x29')])){_0x56a152[_0x834e('0x49')]=_0x834e('0x96');}else if(!ut[_0x834e('0x97')](_0x56a152[_0x834e('0x66')])){_0x56a152[_0x834e('0x49')]='NOT_ACTIVE';}else if(!this[_0x834e('0x98')](_0x56a152['Trunk'])){if(!this[_0x834e('0x98')](_0x56a152[_0x834e('0x99')])){_0x56a152['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}emitCampaignPreview(_0x56a152);};Preview[_0x834e('0x10')]['callProgressDetectingCustomer']=function(_0x2b0d93,_0x15018f,_0x2df64f){var _0x228a60=this;var _0x3181af=this[_0x834e('0x6a')][_0x15018f];var _0x87818b=this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]];var _0x324f67;if(_0x87818b){switch(_0x2df64f){case'1':_0x87818b['outboundNoSuchCallsDay']+=0x1;_0x3181af[_0x834e('0x9b')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x0,'NoSuchNumber');ami[_0x834e('0x9e')]('custom:agentnosuchnumber',ut['buildObj'](_0x3181af,'nosuchnumber'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0x9f'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,'Global');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xa2'));}else{if(_0x3181af['countnosuchnumberretry']>=_0x87818b['dialNoSuchNumberMaxRetry']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xa2'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0x9b'),_0x87818b['dialNoSuchNumberRetryFrequency']),_0x3181af[_0x834e('0xa5')],_0x3181af['activeContact']);}}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xa7'):var _0x5afb41=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x3181af['responsetime']=_0x5afb41;_0x3181af[_0x834e('0xa8')]=_0x5afb41;_0x3181af[_0x834e('0x6f')]=!![];_0x87818b[_0x834e('0x2a')]+=0x1;logger['info'](_0x834e('0xa9'),_0x3181af[_0x834e('0xaa')],_0x834e('0xab'),_0x87818b[_0x834e('0x54')],_0x834e('0x6e'),_0x87818b[_0x834e('0x2a')]);ami[_0x834e('0x9e')](_0x834e('0xac'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xae'),this['campaignsPreview'][_0x3181af['queue']]));if(_0x87818b['acw']){ami[_0x834e('0x9e')](_0x834e('0xaf'),ut[_0x834e('0xb0')](_0x3181af));}break;case'16':ami[_0x834e('0x9e')](_0x834e('0xb1'),ut['buildObj'](_0x3181af,'complete',this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x834e('0xad')](_0x3181af,_0x834e('0xb2')));_0x87818b[_0x834e('0xb3')]+=0x1;_0x87818b['total']+=0x1;_0x87818b[_0x834e('0x28')]+=0x1;ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xb4'));_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xb6'));rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x834e('0xb7')](_0x3181af);_0x87818b[_0x834e('0x2b')]+=_0x3181af['talktime'];_0x87818b[_0x834e('0xb8')]+=_0x3181af['talktime'];logger[_0x834e('0x55')](_0x834e('0xb9'),_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'pTalking:\x20',_0x87818b['pTalking']);delete this['actions'][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xba'):_0x87818b[_0x834e('0xbb')]+=0x1;_0x3181af[_0x834e('0xbc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x5,_0x834e('0xbd'));ami[_0x834e('0x9e')]('custom:agentbusy',ut[_0x834e('0xad')](_0x3181af,'busy'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xbe'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3181af[_0x834e('0xbc')]>=_0x87818b[_0x834e('0xc0')]){rpcDb['createCustomerFinal'](_0x3181af,_0x834e('0xbe'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xbc'),_0x87818b[_0x834e('0xc1')]),_0x3181af['unlockAgent'],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xc3'):_0x87818b['outboundNoAnswerCallsDay']+=0x1;_0x3181af['countnoanswerretry']+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x3,'NoAnswer');ami[_0x834e('0x9e')](_0x834e('0xc4'),ut['buildObj'](_0x3181af,_0x834e('0xc5')));rpcDb['createCustomerHistory'](_0x3181af,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xc6'));}else{if(_0x3181af[_0x834e('0xc7')]>=_0x87818b[_0x834e('0xc8')]){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xc9'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xc7'),_0x87818b[_0x834e('0xca')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xcb'):_0x87818b[_0x834e('0xcc')]+=0x1;_0x3181af[_0x834e('0xcd')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x8,_0x834e('0xce'));ami[_0x834e('0x9e')](_0x834e('0xcf'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd0')));rpcDb['createCustomerHistory'](_0x3181af,_0x834e('0xd1'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd2'));}else{if(_0x3181af[_0x834e('0xcd')]>=_0x87818b[_0x834e('0xd3')]){rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0xa4')](_0x3181af,'countcongestionretry',_0x87818b[_0x834e('0xc1')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'CANCEL':_0x87818b[_0x834e('0x3c')]+=0x1;_0x3181af[_0x834e('0xd4')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x14,_0x834e('0xd5'));ami['emit'](_0x834e('0xd6'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd7')));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xd8'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b['dialGlobalMaxRetry']){_0x324f67=ut['cloneAction'](_0x3181af,0x14,'AgentReject');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd9'));}else{if(_0x3181af['countagentrejectretry']>=_0x87818b[_0x834e('0xda')]){rpcDb[_0x834e('0x93')](_0x3181af,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xd4'),_0x87818b[_0x834e('0xdb')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'ABANDONED':_0x87818b['outboundAbandonedCallsDay']+=0x1;_0x3181af[_0x834e('0xdc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut['logCustomer'](_0x3181af,0xb,_0x834e('0xdd'));rpcDb[_0x834e('0x90')](_0x3181af,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xde'));}else{if(_0x3181af['countabandonedetry']>=_0x87818b['dialAbandonedMaxRety']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xde'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xdc'),_0x87818b[_0x834e('0xdf')]),_0x3181af['unlockAgent'],_0x3181af['activeContact']);}}break;default:if(_0x3181af[_0x834e('0x6f')]){ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xe0'));ut[_0x834e('0x7b')](_0x834e('0xe1')+_0x87818b[_0x834e('0x54')],_0x2b0d93);}_0x87818b[_0x834e('0x3d')]+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0xc,_0x2b0d93['cause-txt']||_0x2b0d93[_0x834e('0xe2')]);rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xe3'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xe4'));}else{rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xe4'));}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];}if(!(_0x3181af[_0x834e('0x6f')]&&_0x2df64f==='16')){ut['updateOriginated'](_0x87818b,_0x834e('0xe5'));logger[_0x834e('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'originated:\x20',_0x87818b[_0x834e('0x4a')]);}if(_0x2df64f!=='ANSWER'){delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xe6')]];}}};Preview['prototype'][_0x834e('0xe7')]=function(_0x38085e,_0x375fec,_0x2247f7){if(_[_0x834e('0xe8')](_0x375fec)&&_0x834e('0xe9')!==typeof _0x375fec){return;}if(_[_0x834e('0xe8')](_0x2247f7)&&_0x834e('0xe9')!==typeof _0x2247f7){return;}switch(_0x2247f7[_0x834e('0xea')]){case'0':ut[_0x834e('0xeb')](_0x38085e,0x0,_0x834e('0xec'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xee'));break;case'3':ut[_0x834e('0xeb')](_0x38085e,0x3,_0x834e('0xef'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf0'));break;case'5':ut['logAgent'](_0x38085e,0x5,'Busy');rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf1'));break;case'8':ut[_0x834e('0xeb')](_0x38085e,0x8,_0x834e('0xce'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf2'));break;case'22':ut[_0x834e('0xeb')](_0x38085e,0x16,_0x834e('0xf3'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf4'));break;default:ut[_0x834e('0xeb')](_0x38085e,0xc,_0x2247f7[_0x834e('0xea')]);rpcDb['createAgentHistory'](_0x38085e,_0x834e('0xf2'));}ut['updateOriginated'](_0x375fec,_0x834e('0xf5'));logger[_0x834e('0x55')](_0x834e('0xf6'),_0x38085e['uniqueid'],_0x834e('0xab'),_0x375fec[_0x834e('0x54')],'originated:\x20',_0x375fec['originated']);delete this[_0x834e('0x6a')][_0x38085e[_0x834e('0xaa')]];};Preview['prototype'][_0x834e('0xf7')]=function(_0x132edd,_0x4643d9,_0x135219,_0x170ec2,_0x5e6fff){var _0x4e7545=this;return new BPromise(function(_0x453e58,_0x5dd31e){if(_['isNil'](_0x4643d9)||_['isNil'](_0x4643d9[_0x834e('0xf8')])||_[_0x834e('0xf9')](_0x4643d9['Contact'][_0x834e('0xfa')])||_[_0x834e('0xf9')](_0x4643d9[_0x834e('0x73')])){_0x5dd31e(ut[_0x834e('0x49')]('Contact\x20is\x20undefined',_0x170ec2,_0x5e6fff));return;}var _0x1998ba=uuid['v4']();var _0x288eb1=_0x4e7545[_0x834e('0x15')][_0x4643d9['Queue'][_0x834e('0x54')]];var _0x5f3b7d=_0x135219?_0x4e7545[_0x834e('0x17')][_0x135219]['id']:undefined;_0x4e7545['actions'][_0x1998ba]=new Action(_0x4643d9,_0x288eb1,_0x1998ba,_0x135219,_0x5f3b7d);var _0x461420=_0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x461420['unlockAgent']=_0x170ec2;_0x461420[_0x834e('0xc2')]=_0x5e6fff;_0x461420[_0x834e('0xfb')]=_0x135219;if(_[_0x834e('0xfc')](_0x132edd)){_0x4e7545[_0x834e('0xfd')](_0x461420,_0x288eb1,_0x4643d9,_0x135219)[_0x834e('0x80')](function(_0x24d77c){logger['info'](_0x834e('0xfe'),_0x834e('0xff')+_0x461420[_0x834e('0x6d')]+_0x834e('0x100')+_0x461420[_0x834e('0x101')],JSON[_0x834e('0x57')](_0x24d77c));ami['emit'](_0x834e('0x102'),ut['buildObj'](_0x461420,'called',_0x4e7545[_0x834e('0x15')][_0x461420['queue']]));_0x453e58(ut['message'](_0x834e('0x103')));})[_0x834e('0x76')](function(_0x257fed){ut[_0x834e('0x61')](_0x834e('0x104'),_0x257fed);_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x105'),_0x170ec2,_0x5e6fff));});}else{_0x288eb1[_0x834e('0x106')]+=0x1;ut[_0x834e('0x107')](_0x461420);rpcDb[_0x834e('0x108')](_0x461420,_0x834e('0x109'));delete _0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x10a'),_0x170ec2,_0x5e6fff));}});};Preview['prototype'][_0x834e('0x98')]=function(_0x4874e1){return!_[_0x834e('0xf9')](_0x4874e1)&&!_[_0x834e('0xf9')](_0x4874e1[_0x834e('0x54')])&&!_[_0x834e('0xf9')](_0x4874e1['active'])&&_0x4874e1['active']&&!_[_0x834e('0xf9')](this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])])&&!_['isNil'](this[_0x834e('0x16')][util[_0x834e('0x58')](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]==='reachable'||this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]===_0x834e('0x10c'));};Preview[_0x834e('0x10')][_0x834e('0x10d')]=function(_0x3c775f,_0x4fc61d){var _0x12a0f3=this;return new BPromise(function(_0x20d52f,_0x59ac23){_0x12a0f3[_0x834e('0x10e')](_0x3c775f,_0x4fc61d)[_0x834e('0x80')](function(_0x536f66){_0x20d52f(_['pick'](_0x536f66,['message']));})[_0x834e('0x76')](function(_0x19e17b){if(_0x19e17b[_0x834e('0x10f')]){rpcDb['unlockContact'](_0x3c775f);}if(_0x19e17b[_0x834e('0x110')]){rpcDb[_0x834e('0x88')](_0x3c775f);}_0x59ac23(_[_0x834e('0x70')](_0x19e17b,[_0x834e('0x49')]));});});};Preview[_0x834e('0x10')][_0x834e('0x10e')]=function(_0x19cb0b,_0x13af70){var _0x8804a8=this;return new BPromise(function(_0x102640,_0x48b6c4){var _0x5d6b66,_0x117e8f;rpcDb[_0x834e('0x111')](_0x19cb0b)[_0x834e('0x80')](function(_0x3eda93){if(!_[_0x834e('0xf9')](_0x3eda93[0x0])){_0x117e8f=_0x3eda93[0x0][_0x834e('0x112')]?![]:!![];_0x5d6b66=_0x3eda93[0x0][_0x834e('0x112')]?!![]:![];_0x5d6b66=_0x13af70?!![]:_0x5d6b66;}var _0x39210f=_0x8804a8[_0x834e('0x113')](_0x3eda93);if(_0x39210f[_0x834e('0x114')]){rpcDb[_0x834e('0x115')](_[_0x834e('0x70')](_0x3eda93[0x0],[_0x834e('0x73'),'Contact.phone']))[_0x834e('0x80')](function(_0x3b13be){_0x8804a8[_0x834e('0xf7')](_0x3b13be,_0x3eda93[0x0],_0x13af70,_0x117e8f,_0x5d6b66)[_0x834e('0x80')](function(_0x495697){_0x102640(_0x495697);})['catch'](function(_0x4e7c43){_0x48b6c4(_0x4e7c43);});})[_0x834e('0x76')](function(_0xf98fb4){ut[_0x834e('0x61')](_0x834e('0x116'),_0xf98fb4);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),_0x117e8f,_0x5d6b66));});}else{_0x48b6c4(ut[_0x834e('0x49')](_0x39210f[_0x834e('0x49')],_0x117e8f,_0x5d6b66));}})['catch'](function(_0x58ff66){ut['logger']('[Preview][getContactPreview]',_0x58ff66);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),![],!![]));});});};Preview[_0x834e('0x10')][_0x834e('0x113')]=function(_0x72f950){if(_[_0x834e('0xf9')](_0x72f950)||_[_0x834e('0xfc')](_0x72f950)||!_[_0x834e('0xf9')](_0x72f950[0x0][_0x834e('0x84')])&&_['isNil'](_0x72f950[0x0]['Agent']['name'])){ut['logger'](_0x834e('0x118'),_0x72f950);return{'isValid':![],'message':_0x834e('0x119')};}var _0x284183=this[_0x834e('0x15')][_0x72f950[0x0][_0x834e('0x6c')][_0x834e('0x54')]];_0x284183[_0x834e('0x49')]=_0x834e('0x9a');if(_[_0x834e('0xf9')](_0x284183)){ut[_0x834e('0x61')](_0x834e('0x11a'),_0x284183);return{'isValid':![],'message':_0x834e('0x11b')};}if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x50')])){ut[_0x834e('0x61')](_0x834e('0x11c'),'campaign\x20Name:\x20'+_0x284183[_0x834e('0x54')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x99')])){ut[_0x834e('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x284183[_0x834e('0x54')]+_0x834e('0x11d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x284183[_0x834e('0x66')])){ut[_0x834e('0x61')](_0x834e('0x11e'),_0x284183[_0x834e('0x54')]+_0x834e('0x11f'));return{'isValid':![],'message':_0x834e('0x120')+_0x284183[_0x834e('0x54')]+_0x834e('0x11f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x834e('0x10')][_0x834e('0xfd')]=function(_0x375e40,_0x1d4947,_0x1912e6,_0x614e15){var _0x17aaae=this;return new BPromise(function(_0x58ebc8,_0x40a92a){var _0x59e298=_0x375e40['uniqueid'];var _0x1115b7=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?util[_0x834e('0x58')](_0x834e('0x121'),_0x1d4947['Trunk'][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947['dialPrefix'])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6['Contact']['phone'][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6['Contact']['phone']):util['format']('SIP/%s/%s%s',_[_0x834e('0xf9')](_0x1d4947['TrunkBackup'])?_0x1d4947[_0x834e('0x50')]['name']:_0x1d4947[_0x834e('0x99')][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947[_0x834e('0x34')])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')]);var _0x464ae6=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?ut[_0x834e('0x125')](_0x1d4947['Trunk'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947['dialRandomLastDigitCallerIdNumber']):_0x1d4947[_0x834e('0x32')]):ut['getCallerId'](_['isNil'](_0x1d4947[_0x834e('0x99')])?_0x1d4947[_0x834e('0x50')][_0x834e('0x51')]:_0x1d4947['TrunkBackup'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947[_0x834e('0x126')]):_0x1d4947[_0x834e('0x32')]);if(_0x464ae6){_0x375e40[_0x834e('0x128')]=ut[_0x834e('0x129')](_0x464ae6);_0x375e40[_0x834e('0x12a')]=ut[_0x834e('0x12b')](_0x464ae6);}var _0x578204=ut[_0x834e('0x12c')](_0x1d4947,_0x1912e6,_0x1115b7,_0x464ae6,_0x59e298,_0x375e40);_[_0x834e('0x12d')](_0x375e40,ut[_0x834e('0x12e')](_0x578204));_0x375e40[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ami['Action'](ut[_0x834e('0x12f')](_0x375e40,_0x1d4947,_0x578204,_0x375e40[_0x834e('0xc2')],_0x614e15))[_0x834e('0x80')](function(_0x37dea1){_0x1d4947[_0x834e('0x4a')]+=0x1;logger[_0x834e('0x55')](_0x834e('0x130'),_0x59e298,_0x834e('0xab'),_0x1d4947[_0x834e('0x54')],_0x834e('0x131'),_0x1d4947['originated']);_0x58ebc8(_0x37dea1);})['catch'](function(_0x5f339f){ut['logAgent'](_0x375e40,0xe,_0x834e('0x132'));rpcDb[_0x834e('0xed')](_0x375e40,_0x834e('0x133'));_0x40a92a(_0x5f339f);});});};Preview[_0x834e('0x10')][_0x834e('0x134')]=function(_0x1d53c6){if(this['actions'][_0x1d53c6[_0x834e('0xa6')]]){this['actions'][_0x1d53c6['linkedid']]['channel']=_0x1d53c6[_0x834e('0x135')];}};Preview[_0x834e('0x10')]['syncOriginateResponse']=function(_0x5cb379){var _0x494e08=this;var _0x2515f6=this[_0x834e('0x6a')][_0x5cb379[_0x834e('0x136')]];if(_0x2515f6){if(_0x2515f6['lookAgent']&&this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]]){ut[_0x834e('0x137')](_0x2515f6,this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]][_0x834e('0x54')],this['agents'][_0x2515f6['lookAgent']]['id']);}var _0x5c7fe3=_['clone'](_0x2515f6);_0x5c7fe3[_0x834e('0x138')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));var _0xfa95ad=_0x494e08[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]];if(ut[_0x834e('0x139')](_0x5cb379[_0x834e('0x13a')])){if(_0x2515f6[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2515f6[_0x834e('0x101')]);}if(_0x2515f6[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2515f6[_0x834e('0x101')]);}ami[_0x834e('0x9e')]('custom:agentringnoanswer',ut['buildObj'](_0x2515f6,_0x834e('0x13c'),this[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]]));this['callProgressDetectingAgent'](_0x5c7fe3,_0xfa95ad,_0x5cb379);}else{_0x2515f6[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ut[_0x834e('0xeb')](_0x5c7fe3,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0xed')](_0x5c7fe3,_0x834e('0x13d'));}}};Preview[_0x834e('0x10')][_0x834e('0x13e')]=function(_0x53850c){var _0x1785ca=this;var _0x2e0674=this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]];var _0x4b6834;if(_0x2e0674){_0x4b6834=this[_0x834e('0x15')][_0x2e0674[_0x834e('0x6d')]];logger[_0x834e('0x55')](_0x834e('0x13f'),_0x53850c[_0x834e('0xa6')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);}if(this['actions'][_0x53850c[_0x834e('0xa6')]]&&_0x53850c['linkedid']!==_0x53850c[_0x834e('0xaa')]){if(_0x53850c['cause']==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c['cause']);}else if(this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]]['dialAnswer']){logger['info'](_0x834e('0x141'),_0x53850c['linkedid'],_0x53850c['cause'],'\x20Queue',_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}else if(_0x2e0674&&_[_0x834e('0xf9')](_0x2e0674['statedesc'])&&_0x4b6834[_0x834e('0x143')]&&_0x53850c[_0x834e('0xa6')]===_0x53850c['uniqueid']&&_['isNil'](_0x53850c[_0x834e('0xea')])&&_0x53850c[_0x834e('0x142')]==='16'&&_0x53850c['channelstate']==='6'&&_['isUndefined'](_0x2e0674[_0x834e('0x144')])){if(_0x2e0674[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2e0674['idContact']);}if(_0x2e0674[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2e0674[_0x834e('0x101')]);}_0x53850c['reason']='22';this[_0x834e('0xe7')](_0x2e0674,_0x4b6834,_0x53850c);}else if(_0x2e0674&&_0x2e0674['transfer']){if(_0x53850c[_0x834e('0x142')]==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){logger[_0x834e('0x55')]('[syncHangup][talking][transfer]',_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834['pTalking']);this['callProgressDetectingCustomer'](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}else if(this[_0x834e('0x6a')][_0x53850c['linkedid']][_0x834e('0x6f')]){logger[_0x834e('0x55')](_0x834e('0x141'),_0x53850c[_0x834e('0xa6')],_0x53850c['cause'],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],'pTalking:\x20',_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}};Preview['prototype'][_0x834e('0x1d')]=function(_0x52a673){if(this[_0x834e('0x6a')][_0x52a673[_0x834e('0xe6')]]&&_0x52a673[_0x834e('0xe6')]!==_0x52a673[_0x834e('0x145')]){this[_0x834e('0x140')](_0x52a673,_0x52a673[_0x834e('0xe6')],_0x52a673['dialstatus']);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x3f2c59){if(this['actions'][_0x3f2c59[_0x834e('0xa6')]]&&_0x3f2c59['linkedid']!==_0x3f2c59[_0x834e('0xaa')]&&!this[_0x834e('0x6a')][_0x3f2c59[_0x834e('0xa6')]][_0x834e('0x6f')]){if(_0x3f2c59[_0x834e('0x142')]==='1'){this[_0x834e('0x140')](_0x3f2c59,_0x3f2c59[_0x834e('0xa6')],_0x3f2c59['cause']);}}};Preview[_0x834e('0x10')][_0x834e('0x146')]=function(_0x2a6bca,_0x223d48,_0x1c03bc){if(this['actions'][_0x2a6bca]){if(_[_0x834e('0xf9')](this[_0x834e('0x6a')][_0x2a6bca][_0x834e('0x147')])){this['actions'][_0x2a6bca]['variables']={};}this['actions'][_0x2a6bca][_0x834e('0x147')][_0x223d48]=_0x1c03bc;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0xd6f2cc){try{if(!_[_0x834e('0xf9')](_0xd6f2cc)){if(ut[_0x834e('0x148')](_[_0x834e('0x149')](_0xd6f2cc[_0x834e('0x14a')])[0x0])){this[_0x834e('0x146')](_0xd6f2cc[_0x834e('0xaa')],_[_0x834e('0x149')](_0xd6f2cc['variable'])[0x0],_0xd6f2cc[_0x834e('0x14b')]);}}}catch(_0x3552b1){logger[_0x834e('0x14c')](_0x834e('0x14d'),util[_0x834e('0x14e')](_0x3552b1,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0xa4bb26){if(_0xa4bb26){if(this['actions'][_0xa4bb26[_0x834e('0x14f')]]){this[_0x834e('0x6a')][_0xa4bb26['transfertargetlinkedid']][_0x834e('0x144')]=!![];}}};Preview[_0x834e('0x10')][_0x834e('0x23')]=function(_0x3fba1d){if(_0x3fba1d){if(this['actions'][_0x3fba1d['transfererlinkedid']]){this[_0x834e('0x6a')][_0x3fba1d['transfererlinkedid']][_0x834e('0x144')]=!![];}}};module[_0x834e('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b81465a..3648379 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 _0x84e7=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','holdtime','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x84e7,0x122));var _0x784e=function(_0x3f6c70,_0xdb4b35){_0x3f6c70=_0x3f6c70-0x0;var _0x58550c=_0x84e7[_0x3f6c70];return _0x58550c;};'use strict';var util=require('util');var BPromise=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('preview');var _=require(_0x784e('0x2'));var cmHopper=require(_0x784e('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x784e('0x4'));var cmHopperBlack=require(_0x784e('0x5'));var voiceQueueRt=require(_0x784e('0x6'));var agentReportPreview=require(_0x784e('0x7'));var voiceQueueReport=require(_0x784e('0x8'));function loggerCatch(_0x133296){return function(_0x48ed22){logger[_0x784e('0x9')](_0x133296,util['inspect'](_0x48ed22,{'showHidden':![],'depth':null}));};}function create(_0xfaa170){return BPromise[_0x784e('0xa')]()['then'](cmHopperHistory[_0x784e('0xb')](_0xfaa170))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function createAgent(_0x3ddd55){return BPromise['resolve']()['then'](agentReportPreview[_0x784e('0xb')](_0x3ddd55))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function moveContact(_0x2fd1b5){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0xf')](_0x2fd1b5,!![]))[_0x784e('0xc')](loggerCatch(_0x784e('0x10')));}exports[_0x784e('0x11')]=function(_0x208d24){return BPromise['resolve']()[_0x784e('0xe')](cmHopperBlack['checkIsBlackList'](_0x208d24))[_0x784e('0xc')](loggerCatch(_0x784e('0x12')));};exports[_0x784e('0x13')]=function(_0x21e844){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x13')](_0x21e844))[_0x784e('0xc')](loggerCatch(_0x784e('0x14')));};exports['createHistory']=function(_0x519059,_0x112ba1){create(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));moveContact(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));};exports[_0x784e('0x15')]=function(_0x3ac83,_0x19072b){createAgent(_0x3ac83)[_0x784e('0xc')](loggerCatch(_0x19072b));};exports['createCustomerHistory']=function(_0x2524d0,_0x285ddd){create(_0x2524d0)[_0x784e('0xc')](loggerCatch(_0x285ddd));};exports[_0x784e('0x16')]=function(_0x440cd6,_0x42f894){moveContact(_0x440cd6)[_0x784e('0xc')](loggerCatch(_0x42f894));};exports['rescheduleContact']=function(_0x5add8f,_0x12aacb,_0x52bc9d){if(_0x12aacb){_0x5add8f[_0x784e('0x17')]=null;}if(_0x52bc9d){_0x5add8f[_0x784e('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x784e('0x19')](_0x5add8f))[_0x784e('0xc')](loggerCatch(_0x784e('0x1a')));};exports[_0x784e('0x1b')]=function(_0x51f452){return BPromise['resolve']()['then'](cmHopper[_0x784e('0x1b')](_0x51f452))[_0x784e('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x784e('0x1c')]=function(_0x5e809a){return BPromise[_0x784e('0xa')]()['then'](cmHopper[_0x784e('0x1c')]({'UserId':null},_0x5e809a,0x1))[_0x784e('0xc')](loggerCatch(_0x784e('0x1d')));};exports[_0x784e('0x1e')]=function(_0x5cb14f){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x1c')]({'active':![]},_0x5cb14f,0x1))[_0x784e('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x784e('0x1f')]=function(_0xa3603f){var _0x5f3da2={};_0x5f3da2['type']=_0xa3603f[_0x784e('0x20')];_0x5f3da2[_0x784e('0x21')]=_0xa3603f[_0x784e('0x21')];_0x5f3da2[_0x784e('0x22')]=_0xa3603f[_0x784e('0x22')];_0x5f3da2[_0x784e('0x23')]=_0xa3603f[_0x784e('0x23')];_0x5f3da2[_0x784e('0x24')]=_0xa3603f[_0x784e('0x24')];_0x5f3da2[_0x784e('0x25')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x27')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x28')]=0x1;_0x5f3da2[_0x784e('0x29')]=_0xa3603f['endtime'];_0x5f3da2[_0x784e('0x2a')]=_0xa3603f['membername'];_0x5f3da2[_0x784e('0x2b')]=_0x784e('0x2c');_0x5f3da2[_0x784e('0x2d')]='xcally-motion-preview';_0x5f3da2[_0x784e('0x2e')]=0x0;_0x5f3da2['assigned']=0x1;_0x5f3da2[_0x784e('0x2f')]=_0xa3603f[_0x784e('0x30')];_0x5f3da2['queuecallerexitreason']=_0x784e('0x31');return BPromise[_0x784e('0xa')]()['then'](voiceQueueReport['create'](_0x5f3da2))[_0x784e('0xc')](loggerCatch(_0x784e('0x32')));};exports[_0x784e('0x33')]=function(_0x4724af,_0x33b2a6){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x33')](_0x4724af,_0x33b2a6))['catch'](loggerCatch(_0x784e('0x34')));};exports['rescheduleContactInQueue']=function(_0x4adb1f){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x19')](_0x4adb1f,!![],!![]))['catch'](loggerCatch(_0x784e('0x35')));}; \ No newline at end of file +var _0xf006=['lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned'];(function(_0x1fae1f,_0x2de883){var _0x12bd2f=function(_0x3999d2){while(--_0x3999d2){_0x1fae1f['push'](_0x1fae1f['shift']());}};_0x12bd2f(++_0x2de883);}(_0xf006,0x146));var _0x6f00=function(_0x24ec9c,_0x56192a){_0x24ec9c=_0x24ec9c-0x0;var _0x567c87=_0xf006[_0x24ec9c];return _0x567c87;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var _=require('lodash');var cmHopper=require(_0x6f00('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x6f00('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x6f00('0x4'));var voiceQueueReport=require(_0x6f00('0x5'));function loggerCatch(_0x141e71){return function(_0x52c9a2){logger[_0x6f00('0x6')](_0x141e71,util['inspect'](_0x52c9a2,{'showHidden':![],'depth':null}));};}function create(_0x3875fb){return BPromise[_0x6f00('0x7')]()[_0x6f00('0x8')](cmHopperHistory[_0x6f00('0x9')](_0x3875fb))[_0x6f00('0xa')](loggerCatch(_0x6f00('0xb')));}function createAgent(_0x44b63c){return BPromise[_0x6f00('0x7')]()[_0x6f00('0x8')](agentReportPreview[_0x6f00('0x9')](_0x44b63c))[_0x6f00('0xa')](loggerCatch(_0x6f00('0xb')));}function moveContact(_0x723e6e){return BPromise['resolve']()[_0x6f00('0x8')](cmHopper[_0x6f00('0xc')](_0x723e6e,!![]))[_0x6f00('0xa')](loggerCatch(_0x6f00('0xd')));}exports[_0x6f00('0xe')]=function(_0x5e3264){return BPromise[_0x6f00('0x7')]()['then'](cmHopperBlack[_0x6f00('0xe')](_0x5e3264))['catch'](loggerCatch(_0x6f00('0xf')));};exports[_0x6f00('0x10')]=function(_0x327e10){return BPromise[_0x6f00('0x7')]()[_0x6f00('0x8')](cmHopper[_0x6f00('0x10')](_0x327e10))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x11')));};exports[_0x6f00('0x9')]=function(_0x4bfac3,_0x14b15d){create(_0x4bfac3)['catch'](loggerCatch(_0x14b15d));moveContact(_0x4bfac3)['catch'](loggerCatch(_0x14b15d));};exports[_0x6f00('0x12')]=function(_0x6cf83f,_0x466c7c){createAgent(_0x6cf83f)[_0x6f00('0xa')](loggerCatch(_0x466c7c));};exports[_0x6f00('0x13')]=function(_0x27e466,_0x23fe10){create(_0x27e466)[_0x6f00('0xa')](loggerCatch(_0x23fe10));};exports[_0x6f00('0x14')]=function(_0x198cc7,_0x2d807f){moveContact(_0x198cc7)[_0x6f00('0xa')](loggerCatch(_0x2d807f));};exports['rescheduleContact']=function(_0x4f3031,_0x5850dd,_0x2a5286){if(_0x5850dd){_0x4f3031[_0x6f00('0x15')]=null;}if(_0x2a5286){_0x4f3031[_0x6f00('0x16')]=![];}return BPromise['resolve']()[_0x6f00('0x8')](cmHopper[_0x6f00('0x17')](_0x4f3031))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x18')));};exports[_0x6f00('0x19')]=function(_0x1cbf1c){return BPromise[_0x6f00('0x7')]()[_0x6f00('0x8')](cmHopper['countReScheduled'](_0x1cbf1c))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x1a')));};exports[_0x6f00('0x1b')]=function(_0x4d41ef){return BPromise[_0x6f00('0x7')]()['then'](cmHopper[_0x6f00('0x1b')]({'UserId':null},_0x4d41ef,0x1))['catch'](loggerCatch(_0x6f00('0x1c')));};exports[_0x6f00('0x1d')]=function(_0x7c6bcb){return BPromise[_0x6f00('0x7')]()[_0x6f00('0x8')](cmHopper['unlockContact']({'active':![]},_0x7c6bcb,0x1))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x1e')));};exports[_0x6f00('0x1f')]=function(_0x4366a4){var _0x2671fe={};_0x2671fe[_0x6f00('0x20')]=_0x4366a4[_0x6f00('0x20')];_0x2671fe[_0x6f00('0x21')]=_0x4366a4[_0x6f00('0x21')];_0x2671fe[_0x6f00('0x22')]=_0x4366a4[_0x6f00('0x22')];_0x2671fe[_0x6f00('0x23')]=_0x4366a4[_0x6f00('0x23')];_0x2671fe[_0x6f00('0x24')]=_0x4366a4['queue'];_0x2671fe['queuecallerjoinAt']=_0x4366a4['answertime'];_0x2671fe['queuecallerleaveAt']=_0x4366a4['answertime'];_0x2671fe['queuecallercomplete']=0x1;_0x2671fe[_0x6f00('0x25')]=_0x4366a4['endtime'];_0x2671fe[_0x6f00('0x26')]=_0x4366a4[_0x6f00('0x27')];_0x2671fe[_0x6f00('0x28')]=_0x6f00('0x29');_0x2671fe[_0x6f00('0x2a')]=_0x6f00('0x2b');_0x2671fe['holdtime']=0x0;_0x2671fe[_0x6f00('0x2c')]=0x1;_0x2671fe[_0x6f00('0x2d')]=_0x4366a4[_0x6f00('0x27')];_0x2671fe[_0x6f00('0x2e')]=_0x6f00('0x2f');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0x2671fe))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x30')));};exports[_0x6f00('0x31')]=function(_0x27ebb4,_0xbece){return BPromise['resolve']()[_0x6f00('0x8')](cmHopper[_0x6f00('0x31')](_0x27ebb4,_0xbece))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x32')));};exports[_0x6f00('0x33')]=function(_0x493190){return BPromise[_0x6f00('0x7')]()['then'](cmHopper[_0x6f00('0x17')](_0x493190,!![],!![]))[_0x6f00('0xa')](loggerCatch(_0x6f00('0x34')));}; \ 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 217444b..c5113ed 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 _0x40fc=['U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','logLookAgent','logCustomer','endtime','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','campaigntype','dialAnswer','membername','countcongestionretry','countnoanswerretry','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','moment','../../../../config/logger','preview','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x40fc,0x183));var _0xc40f=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x40fc[_0x3e7e96];return _0x13f6f0;};'use strict';var util=require(_0xc40f('0x0'));var _=require('lodash');var moment=require(_0xc40f('0x1'));var logger=require(_0xc40f('0x2'))(_0xc40f('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xc40f('0x4');function getSeconds(_0x1aba11,_0xace02){var _0x29bc48=moment(_0x1aba11)[_0xc40f('0x5')](0x0);var _0x355494=moment(_0xace02)[_0xc40f('0x5')](0x0);return _0x29bc48[_0xc40f('0x6')](_0x355494,_0xc40f('0x7'));}exports[_0xc40f('0x8')]=function(_0xd7631b){return function(_0x1f178f){logger[_0xc40f('0x9')](_0xd7631b,util[_0xc40f('0xa')](_0x1f178f,{'showHidden':![],'depth':null}));};};exports[_0xc40f('0xb')]=function(_0x15a4d0,_0x531bde){logger[_0xc40f('0xc')](_0x15a4d0,util[_0xc40f('0xa')](_0x531bde,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x141543,_0x5a5ff9){logger[_0xc40f('0x9')](_0x141543,util[_0xc40f('0xa')](_0x5a5ff9,{'showHidden':![],'depth':null}));};exports[_0xc40f('0xd')]=function(_0x3d4edd){return function(_0x47f4e8){logger[_0xc40f('0xc')](_0x3d4edd,util[_0xc40f('0xa')](_0x47f4e8,{'showHidden':![],'depth':null}));};};exports[_0xc40f('0xe')]=function(_0x56648f,_0x368140,_0x160f70){return{'message':_0x56648f,'unlock':_0x368140,'active':_0x160f70};};exports[_0xc40f('0xf')]=function(_0x2b13c2,_0x3b7c7c,_0x4b7352){if(!_[_0xc40f('0x10')](_0x4b7352)&&_0xc40f('0x11')===typeof _0x4b7352&&!_[_0xc40f('0x12')](_0x4b7352)){if(!_[_0xc40f('0x10')](_0x3b7c7c)&&_0xc40f('0x11')===typeof _0x3b7c7c&&!_['isEmpty'](_0x3b7c7c)){return util[_0xc40f('0x13')](_0xc40f('0x14'),_0x3b7c7c,_0x4b7352);}return util[_0xc40f('0x13')](_0xc40f('0x14'),_0x4b7352,_0x4b7352);}if(!_['isUndefined'](_0x2b13c2)&&_0xc40f('0x11')===typeof _0x2b13c2&&!_[_0xc40f('0x12')](_0x2b13c2)){return _0x2b13c2;}return _0xc40f('0x15');};exports[_0xc40f('0x16')]=function(_0x28f456){if(_[_0xc40f('0x17')](_0x28f456)){return![];}return _0x28f456;};exports['addVariables']=function(_0x511ee7,_0x569694,_0x2f86e7,_0x111184,_0x352be4,_0x1ca251){var _0x1701da={'XMD-QUEUE':_0x569694[_0xc40f('0x18')]?_0x569694[_0xc40f('0x18')][_0xc40f('0x19')]:'','XMD-CALLERID':_0x111184,'XMD-CALLERID-PREVIEW':_0x1ca251?util[_0xc40f('0x13')]('\x22%s\x22\x20<%s>',_0x1ca251[_0xc40f('0x1a')],_0x1ca251[_0xc40f('0x1b')]):_0x111184,'XMD-DIALID':_0x352be4,'XMD-CONTACTID':_0x569694[_0xc40f('0x1c')],'XMD-CDRTYPE':_0xc40f('0x1d'),'CALLERID(all)':_0x111184,'XMD-VOICEQUEUEID':_0x569694[_0xc40f('0x1e')],'XMD-DIALCHANNEL':_0x2f86e7,'XMD-DIALTIMEOUT':_0x511ee7[_0xc40f('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xc40f('0x13')](_0xc40f('0x20'),_0x511ee7['dialQueueProject2']?'g':'',_[_0xc40f('0x12')](_0x511ee7['monitor_format'])?'':_0xc40f('0x21')),'XMD-DIALURL':_0x511ee7[_0xc40f('0x22')]||'','XMD-AGI':_0x511ee7[_0xc40f('0x23')]?util[_0xc40f('0x13')](_0xc40f('0x24'),ipAgi,_0x511ee7[_0xc40f('0x23')]):_0xc40f('0x25'),'XMD-AGIAFTER':_0x511ee7[_0xc40f('0x26')]?util[_0xc40f('0x13')](_0xc40f('0x24'),ipAgi,_0x511ee7[_0xc40f('0x26')]):_0xc40f('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x1ca251?_0x1ca251[_0xc40f('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x1ca251?_0x1ca251[_0xc40f('0x28')]:'','XMD-DESTINATION':_0xc40f('0x29')};if(!_[_0xc40f('0x12')](_0x511ee7[_0xc40f('0x2a')])){_0x1701da[util[_0xc40f('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x511ee7[_0xc40f('0x2a')];_0x1701da[util[_0xc40f('0x13')]('%s',_0xc40f('0x2b'))]=_0x352be4;}if(_0x569694&&_0x569694[_0xc40f('0x2c')]){for(var _0x4b1759 in _0x569694['Contact']){if(_0x569694[_0xc40f('0x2c')]['hasOwnProperty'](_0x4b1759)){if(!_[_0xc40f('0x17')](_0x569694['Contact'][_0x4b1759])&&_0x4b1759!=='id'&&_0x4b1759!==_0xc40f('0x2d')&&_0x4b1759!==_0xc40f('0x2e')&&_0x4b1759!==_0xc40f('0x2f')){_0x1701da[util['format'](_0xc40f('0x30'),_0xc40f('0x31'),_[_0xc40f('0x32')](_0x4b1759))]=_0x569694[_0xc40f('0x2c')][_0x4b1759];}}}}return _0x1701da;};exports[_0xc40f('0x33')]=function(_0x290042){var _0x1d6b99={};for(var _0x37193b in _0x290042){if(_0x290042[_0xc40f('0x34')](_0x37193b)){_0x1d6b99[util['format']('%s',_['toLower'](_0x37193b))]=_0x290042[_0x37193b];}}return{'variables':_0x1d6b99};};exports['updateOriginated']=function(_0x274d87,_0x40cf29){if(!_[_0xc40f('0x17')](_0x274d87)){if(_0x274d87['hasOwnProperty'](_0xc40f('0x35'))){if(_0x274d87[_0xc40f('0x35')]>0x0){_0x274d87[_0xc40f('0x35')]-=0x1;}else{logger[_0xc40f('0x9')](_0xc40f('0x36'),_0x40cf29);}}}else{logger[_0xc40f('0x9')](_0xc40f('0x37'),_0x40cf29);}};exports[_0xc40f('0x38')]=function(_0x27ebde){var _0x21224c=moment()[_0xc40f('0x13')](_0xc40f('0x39'));_0x27ebde['state']=0xd;_0x27ebde[_0xc40f('0x3a')]=_0xc40f('0x3b');_0x27ebde[_0xc40f('0x3c')]=_0x21224c;_0x27ebde[_0xc40f('0x3d')]=_0x21224c;_0x27ebde['endtime']=_0x21224c;};exports[_0xc40f('0x3e')]=function(_0x2dac10,_0xb2a185,_0x1958c5){var _0x4a7d60=moment()[_0xc40f('0x13')](_0xc40f('0x39'));_0x2dac10[_0xc40f('0x3f')]=_0xb2a185;_0x2dac10[_0xc40f('0x3a')]=_0x1958c5;_0x2dac10['responsetime']=_0x4a7d60;_0x2dac10[_0xc40f('0x40')]=getSeconds(_0x2dac10[_0xc40f('0x3d')],_0x2dac10['starttime']);};exports[_0xc40f('0x41')]=function(_0x14d073,_0x51ad70,_0x173b85){_0x14d073['membername']=_0x51ad70;_0x14d073['UserId']=_0x173b85;};exports[_0xc40f('0x42')]=function(_0x407ed5,_0x1b3308,_0x200d23){var _0x174c28=moment()[_0xc40f('0x13')](_0xc40f('0x39'));_0x407ed5[_0xc40f('0x3f')]=_0x1b3308;_0x407ed5[_0xc40f('0x3a')]=_0x200d23;_0x407ed5[_0xc40f('0x3d')]=_0x407ed5[_0xc40f('0x3d')]?_0x407ed5[_0xc40f('0x3d')]:_0x174c28;_0x407ed5[_0xc40f('0x43')]=_0x407ed5[_0xc40f('0x43')]?_0x407ed5[_0xc40f('0x43')]:_0x174c28;_0x407ed5[_0xc40f('0x40')]=getSeconds(_0x407ed5['responsetime']||0x0,_0x407ed5[_0xc40f('0x3c')]||0x0);_0x407ed5[_0xc40f('0x44')]=_0x407ed5[_0xc40f('0x45')]?getSeconds(_0x407ed5['endtime'],_0x407ed5['answertime']):0x0;};exports['isFailure']=function(_0x4db500){return _0x4db500===_0xc40f('0x46');};exports[_0xc40f('0x47')]=function(_0x279c8f,_0x2066ba,_0x26e717,_0x1d70e8,_0xd4f4bd){var _0x29f21c=_0x1d70e8?'RECALL':_0x279c8f[_0xc40f('0x1a')];_0x29f21c=_0xd4f4bd?_0xc40f('0x48'):_0x29f21c;return{'actionid':_0x279c8f[_0xc40f('0x49')],'action':_0xc40f('0x4a'),'channel':_0x279c8f[_0xc40f('0x4b')],'callerid':util[_0xc40f('0x13')](_0xc40f('0x14'),_0x29f21c,_0x279c8f[_0xc40f('0x1b')]),'Exten':_0xc40f('0x29'),'Context':_0xc40f('0x4c'),'Priority':'1','variable':_0x26e717,'timeout':(_0x2066ba['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x279c8f[_0xc40f('0x49')]};};exports['totalGlobal']=function(_0x481840){return _0x481840[_0xc40f('0x4d')]+_0x481840['countcongestionretry']+_0x481840['countnoanswerretry']+_0x481840['countagentrejectretry']+_0x481840['countnosuchnumberretry'];};exports[_0xc40f('0x4e')]=function(_0x3b204c){var _0x28e5d0=_[_0xc40f('0x4f')](_0x3b204c);_0x28e5d0['state']=0xf;_0x28e5d0[_0xc40f('0x3a')]=_0xc40f('0x50');return _0x28e5d0;};exports[_0xc40f('0x51')]=function(_0x30ca6d,_0x52f7ed,_0x1d7bf9){var _0x2889c6={};_0x2889c6[_0x52f7ed]=_0x30ca6d[_0x52f7ed];_0x2889c6[_0xc40f('0x52')]=![];_0x2889c6[_0xc40f('0x53')]=moment()[_0xc40f('0x54')](_0x1d7bf9,_0xc40f('0x55'))[_0xc40f('0x13')](_0xc40f('0x39'));_0x2889c6[_0xc40f('0x1c')]=_0x30ca6d[_0xc40f('0x1c')];_0x2889c6[_0xc40f('0x56')]=_0x30ca6d[_0xc40f('0x56')];_0x2889c6['VoiceQueueId']=_0x30ca6d[_0xc40f('0x1e')]||undefined;return _0x2889c6;};exports[_0xc40f('0x57')]=function(_0x49155a,_0x3ef27c){if(!_[_0xc40f('0x17')](_0x49155a)){if(_0x49155a[_0xc40f('0x58')]>0x0){_0x49155a[_0xc40f('0x58')]-=0x1;}else{logger[_0xc40f('0x9')](_0x3ef27c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc40f('0x9')](_0x3ef27c,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x4fdbf1){if(_0x4fdbf1<=0x0){return!![];}return![];};exports['buildObj']=function(_0x448f80,_0x56d860,_0x301e4d){_0x448f80['lastevent']=_0x56d860;_0x448f80[_0xc40f('0x19')]=_0x448f80[_0xc40f('0x59')];_0x448f80[_0xc40f('0x5a')]=_0x448f80[_0xc40f('0x4b')];if(_0x301e4d){_0x448f80[_0xc40f('0x5b')]=_0x301e4d['mandatoryDisposition'];}return _0x448f80;};exports['buildAcw']=function(_0x3bb8a4){var _0x983a94={};_0x983a94[_0xc40f('0x59')]=_0x3bb8a4[_0xc40f('0x59')];_0x983a94[_0xc40f('0x5a')]=_0x3bb8a4['channelAgent'];_0x983a94[_0xc40f('0x49')]=_0x3bb8a4[_0xc40f('0x49')];return _0x983a94;};exports[_0xc40f('0x5c')]=function(_0x7359d8){var _0x333f73=[];for(var _0x2d11a6 in _0x7359d8){if(_0x7359d8['hasOwnProperty'](_0x2d11a6)){if(!_[_0xc40f('0x17')](_0x7359d8[_0x2d11a6])&&_0x7359d8[_0x2d11a6][_0xc40f('0x3f')]===_0xc40f('0x5d')&&_0x7359d8[_0x2d11a6][_0xc40f('0x5e')]===_0xc40f('0x5f')){_0x333f73[_0xc40f('0x60')](_0x7359d8[_0x2d11a6]['id']);}}}return _0x333f73;};exports[_0xc40f('0x61')]=function(_0x198115){var _0x4b3317=moment()[_0xc40f('0x5')](0x0);var _0x5051d9=moment(_0x198115)[_0xc40f('0x5')](0x0);return _0x4b3317[_0xc40f('0x6')](_0x5051d9,_0xc40f('0x7'));};exports[_0xc40f('0x62')]=function(_0x216f9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x216f9[_0xc40f('0x1c')],'ListId':_0x216f9[_0xc40f('0x56')],'VoiceQueueId':_0x216f9[_0xc40f('0x1e')]||undefined,'CampaignId':_0x216f9['CampaignId']||undefined};};exports['filterKey']=function(_0x3fa69f){if(_0x3fa69f===_0xc40f('0x49')||_0x3fa69f==='idContact'||_0x3fa69f==='queue'||_0x3fa69f==='type'||_0x3fa69f===_0xc40f('0x63')||_0x3fa69f===_0xc40f('0x64')||_0x3fa69f===_0xc40f('0x65')||_0x3fa69f===_0xc40f('0x4b')||_0x3fa69f===_0xc40f('0x1a')||_0x3fa69f===_0xc40f('0x52')||_0x3fa69f===_0xc40f('0x1b')||_0x3fa69f===_0xc40f('0x53')||_0x3fa69f===_0xc40f('0x4d')||_0x3fa69f===_0xc40f('0x66')||_0x3fa69f===_0xc40f('0x67')||_0x3fa69f===_0xc40f('0x68')||_0x3fa69f===_0xc40f('0x69')||_0x3fa69f==='callbackuniqueid'||_0x3fa69f===_0xc40f('0x6a')||_0x3fa69f===_0xc40f('0x6b')||_0x3fa69f===_0xc40f('0x1c')||_0x3fa69f==='ListId'||_0x3fa69f===_0xc40f('0x6c')||_0x3fa69f===_0xc40f('0x1e')||_0x3fa69f===_0xc40f('0x6d')||_0x3fa69f===_0xc40f('0x6e')||_0x3fa69f===_0xc40f('0x6f')||_0x3fa69f===_0xc40f('0x70')||_0x3fa69f===_0xc40f('0x71')||_0x3fa69f===_0xc40f('0x72')||_0x3fa69f===_0xc40f('0x73')||_0x3fa69f===_0xc40f('0x74')||_0x3fa69f===_0xc40f('0x75')||_0x3fa69f===_0xc40f('0x76')||_0x3fa69f===_0xc40f('0x77')||_0x3fa69f===_0xc40f('0x78')||_0x3fa69f==='xmd-callerid'||_0x3fa69f===_0xc40f('0x79')||_0x3fa69f==='xmd-agi'||_0x3fa69f===_0xc40f('0x7a')||_0x3fa69f===_0xc40f('0x7b')||_0x3fa69f==='rtpaudioqosjitter'||_0x3fa69f===_0xc40f('0x7c')||_0x3fa69f==='rtpaudioqosloss'||_0x3fa69f===_0xc40f('0x7d')||_0x3fa69f==='rtpaudioqosrtt'||_0x3fa69f===_0xc40f('0x7e')||_0x3fa69f===_0xc40f('0x7a')||_0x3fa69f===_0xc40f('0x7b')||_0x3fa69f===_0xc40f('0x7f')||_0x3fa69f===_0xc40f('0x7c')||_0x3fa69f===_0xc40f('0x80')||_0x3fa69f===_0xc40f('0x7d')||_0x3fa69f===_0xc40f('0x81')||_0x3fa69f===_0xc40f('0x7e')||_0x3fa69f===_0xc40f('0x82')||_0x3fa69f===_0xc40f('0x83')||_0x3fa69f===_0xc40f('0x3f')||_0x3fa69f===_0xc40f('0x3a')){return![];}return!![];};exports[_0xc40f('0x84')]=function(_0x385dfc,_0x3db991){var _0x1fe80f,_0x3a025d,_0x15dc8e;if(_0x3db991<=0x0){_0x3db991=0x1;}_0x1fe80f=new RegExp(_0xc40f('0x85')+_0x3db991+'}$');_0x3a025d=Math[_0xc40f('0x86')](0xa,_0x3db991-0x1);_0x15dc8e=Math[_0xc40f('0x86')](0xa,_0x3db991)-0x1;return util[_0xc40f('0x13')]('%s',_[_0xc40f('0x87')](_0x385dfc,_0x1fe80f,_[_0xc40f('0x88')](_0x3a025d,_0x15dc8e)));};exports[_0xc40f('0x89')]=function(_0x45b332){var _0x3ed5b6=_0x45b332['match'](/"(.*?)"/);return _0x3ed5b6?_0x3ed5b6[0x1]:_0x45b332;};exports[_0xc40f('0x8a')]=function(_0x4d338f){var _0x4ffd87=_0x4d338f[_0xc40f('0x8b')](/<(.*?)>/);return _0x4ffd87?_0x4ffd87[0x1]:_0x4d338f;}; \ No newline at end of file +var _0xb72d=['xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','random','extractCalleridNumber','match','util','lodash','moment','milliseconds','diff','seconds','loggerCatch','error','inspect','loggerError','logger2','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','updatedAt','%s%s','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','endtime','talktime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','mandatoryDisposition','buildAcw','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xb72d,0x92));var _0xdb72=function(_0x37fb1d,_0x3dd89a){_0x37fb1d=_0x37fb1d-0x0;var _0x3a4536=_0xb72d[_0x37fb1d];return _0x3a4536;};'use strict';var util=require(_0xdb72('0x0'));var _=require(_0xdb72('0x1'));var moment=require(_0xdb72('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0xc52631,_0x380851){var _0x3872cd=moment(_0xc52631)[_0xdb72('0x3')](0x0);var _0x12a29c=moment(_0x380851)[_0xdb72('0x3')](0x0);return _0x3872cd[_0xdb72('0x4')](_0x12a29c,_0xdb72('0x5'));}exports[_0xdb72('0x6')]=function(_0x2c1a8c){return function(_0x3c8279){logger[_0xdb72('0x7')](_0x2c1a8c,util[_0xdb72('0x8')](_0x3c8279,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3f26df,_0x27f34d){logger['info'](_0x3f26df,util[_0xdb72('0x8')](_0x27f34d,{'showHidden':![],'depth':null}));};exports[_0xdb72('0x9')]=function(_0x22852f,_0x4e3948){logger[_0xdb72('0x7')](_0x22852f,util[_0xdb72('0x8')](_0x4e3948,{'showHidden':![],'depth':null}));};exports[_0xdb72('0xa')]=function(_0x1ef0ef){return function(_0x1e7d1b){logger['info'](_0x1ef0ef,util[_0xdb72('0x8')](_0x1e7d1b,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x20eb19,_0x1e0273,_0x42ce4b){return{'message':_0x20eb19,'unlock':_0x1e0273,'active':_0x42ce4b};};exports[_0xdb72('0xb')]=function(_0x42ae8b,_0x2c66e2,_0x21b49d){if(!_['isUndefined'](_0x21b49d)&&_0xdb72('0xc')===typeof _0x21b49d&&!_[_0xdb72('0xd')](_0x21b49d)){if(!_[_0xdb72('0xe')](_0x2c66e2)&&'string'===typeof _0x2c66e2&&!_[_0xdb72('0xd')](_0x2c66e2)){return util['format']('\x22%s\x22\x20<%s>',_0x2c66e2,_0x21b49d);}return util[_0xdb72('0xf')](_0xdb72('0x10'),_0x21b49d,_0x21b49d);}if(!_[_0xdb72('0xe')](_0x42ae8b)&&_0xdb72('0xc')===typeof _0x42ae8b&&!_[_0xdb72('0xd')](_0x42ae8b)){return _0x42ae8b;}return _0xdb72('0x11');};exports['isActive']=function(_0x453d82){if(_['isNil'](_0x453d82)){return![];}return _0x453d82;};exports['addVariables']=function(_0x2670c2,_0x224209,_0x2e65bc,_0x4b28ac,_0x7a38c1,_0x3606fa){var _0x2a9cea={'XMD-QUEUE':_0x224209[_0xdb72('0x12')]?_0x224209[_0xdb72('0x12')][_0xdb72('0x13')]:'','XMD-CALLERID':_0x4b28ac,'XMD-CALLERID-PREVIEW':_0x3606fa?util['format'](_0xdb72('0x10'),_0x3606fa[_0xdb72('0x14')],_0x3606fa[_0xdb72('0x15')]):_0x4b28ac,'XMD-DIALID':_0x7a38c1,'XMD-CONTACTID':_0x224209[_0xdb72('0x16')],'XMD-CDRTYPE':_0xdb72('0x17'),'CALLERID(all)':_0x4b28ac,'XMD-VOICEQUEUEID':_0x224209[_0xdb72('0x18')],'XMD-DIALCHANNEL':_0x2e65bc,'XMD-DIALTIMEOUT':_0x2670c2[_0xdb72('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xdb72('0xf')]('\x22rtTxX%s%s\x22',_0x2670c2[_0xdb72('0x1a')]?'g':'',_[_0xdb72('0xd')](_0x2670c2['monitor_format'])?'':_0xdb72('0x1b')),'XMD-DIALURL':_0x2670c2[_0xdb72('0x1c')]||'','XMD-AGI':_0x2670c2[_0xdb72('0x1d')]?util[_0xdb72('0xf')](_0xdb72('0x1e'),ipAgi,_0x2670c2['dialQueueProject']):_0xdb72('0x1f'),'XMD-AGIAFTER':_0x2670c2[_0xdb72('0x1a')]?util[_0xdb72('0xf')](_0xdb72('0x1e'),ipAgi,_0x2670c2[_0xdb72('0x1a')]):_0xdb72('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x3606fa?_0x3606fa[_0xdb72('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x3606fa?_0x3606fa['originatecalleridname']:'','XMD-DESTINATION':_0xdb72('0x21')};if(!_[_0xdb72('0xd')](_0x2670c2['monitor_format'])){_0x2a9cea[util[_0xdb72('0xf')]('%s',_0xdb72('0x22'))]=_0x2670c2[_0xdb72('0x23')];_0x2a9cea[util['format']('%s',_0xdb72('0x24'))]=_0x7a38c1;}if(_0x224209&&_0x224209[_0xdb72('0x25')]){for(var _0x4dca21 in _0x224209[_0xdb72('0x25')]){if(_0x224209[_0xdb72('0x25')][_0xdb72('0x26')](_0x4dca21)){if(!_[_0xdb72('0x27')](_0x224209[_0xdb72('0x25')][_0x4dca21])&&_0x4dca21!=='id'&&_0x4dca21!==_0xdb72('0x28')&&_0x4dca21!=='createdAt'&&_0x4dca21!==_0xdb72('0x29')){_0x2a9cea[util['format'](_0xdb72('0x2a'),'XMD-',_['toUpper'](_0x4dca21))]=_0x224209[_0xdb72('0x25')][_0x4dca21];}}}}return _0x2a9cea;};exports[_0xdb72('0x2b')]=function(_0x392b60){var _0x29e58d={};for(var _0x2a89cc in _0x392b60){if(_0x392b60[_0xdb72('0x26')](_0x2a89cc)){_0x29e58d[util['format']('%s',_[_0xdb72('0x2c')](_0x2a89cc))]=_0x392b60[_0x2a89cc];}}return{'variables':_0x29e58d};};exports['updateOriginated']=function(_0x1bf914,_0x2ad2e5){if(!_[_0xdb72('0x27')](_0x1bf914)){if(_0x1bf914['hasOwnProperty'](_0xdb72('0x2d'))){if(_0x1bf914['originated']>0x0){_0x1bf914[_0xdb72('0x2d')]-=0x1;}else{logger[_0xdb72('0x7')](_0xdb72('0x2e'),_0x2ad2e5);}}}else{logger[_0xdb72('0x7')](_0xdb72('0x2f'),_0x2ad2e5);}};exports['logBlacklist']=function(_0x21262a){var _0x2bb021=moment()[_0xdb72('0xf')](_0xdb72('0x30'));_0x21262a[_0xdb72('0x31')]=0xd;_0x21262a[_0xdb72('0x32')]=_0xdb72('0x33');_0x21262a[_0xdb72('0x34')]=_0x2bb021;_0x21262a[_0xdb72('0x35')]=_0x2bb021;_0x21262a['endtime']=_0x2bb021;};exports[_0xdb72('0x36')]=function(_0x10e6e0,_0x12f9c8,_0xd751b6){var _0x35c76f=moment()[_0xdb72('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x10e6e0[_0xdb72('0x31')]=_0x12f9c8;_0x10e6e0['statedesc']=_0xd751b6;_0x10e6e0[_0xdb72('0x35')]=_0x35c76f;_0x10e6e0[_0xdb72('0x37')]=getSeconds(_0x10e6e0[_0xdb72('0x35')],_0x10e6e0['starttime']);};exports[_0xdb72('0x38')]=function(_0xe75d0c,_0x5b0727,_0x19b1f9){_0xe75d0c[_0xdb72('0x39')]=_0x5b0727;_0xe75d0c['UserId']=_0x19b1f9;};exports['logCustomer']=function(_0x569bb7,_0x15379e,_0x54135e){var _0x3ef5e1=moment()[_0xdb72('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x569bb7[_0xdb72('0x31')]=_0x15379e;_0x569bb7[_0xdb72('0x32')]=_0x54135e;_0x569bb7[_0xdb72('0x35')]=_0x569bb7['responsetime']?_0x569bb7[_0xdb72('0x35')]:_0x3ef5e1;_0x569bb7[_0xdb72('0x3a')]=_0x569bb7[_0xdb72('0x3a')]?_0x569bb7[_0xdb72('0x3a')]:_0x3ef5e1;_0x569bb7[_0xdb72('0x37')]=getSeconds(_0x569bb7[_0xdb72('0x35')]||0x0,_0x569bb7[_0xdb72('0x34')]||0x0);_0x569bb7[_0xdb72('0x3b')]=_0x569bb7['answertime']?getSeconds(_0x569bb7[_0xdb72('0x3a')],_0x569bb7['answertime']):0x0;};exports[_0xdb72('0x3c')]=function(_0x253a86){return _0x253a86==='Failure';};exports[_0xdb72('0x3d')]=function(_0xea6de0,_0x567837,_0x278803,_0x20e313,_0xa4a5fa){var _0x7a0b6c=_0x20e313?_0xdb72('0x3e'):_0xea6de0[_0xdb72('0x14')];_0x7a0b6c=_0xa4a5fa?_0xdb72('0x3f'):_0x7a0b6c;return{'actionid':_0xea6de0[_0xdb72('0x40')],'action':_0xdb72('0x41'),'channel':_0xea6de0[_0xdb72('0x42')],'callerid':util['format'](_0xdb72('0x10'),_0x7a0b6c,_0xea6de0[_0xdb72('0x15')]),'Exten':_0xdb72('0x21'),'Context':'from-sip','Priority':'1','variable':_0x278803,'timeout':(_0x567837[_0xdb72('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0xea6de0[_0xdb72('0x40')]};};exports[_0xdb72('0x44')]=function(_0x214cd1){return _0x214cd1[_0xdb72('0x45')]+_0x214cd1[_0xdb72('0x46')]+_0x214cd1[_0xdb72('0x47')]+_0x214cd1['countagentrejectretry']+_0x214cd1[_0xdb72('0x48')];};exports[_0xdb72('0x49')]=function(_0x540881){var _0x177722=_[_0xdb72('0x4a')](_0x540881);_0x177722[_0xdb72('0x31')]=0xf;_0x177722[_0xdb72('0x32')]='Global';return _0x177722;};exports[_0xdb72('0x4b')]=function(_0x591b1c,_0x2a7a4f,_0x32f736){var _0x92304e={};_0x92304e[_0x2a7a4f]=_0x591b1c[_0x2a7a4f];_0x92304e[_0xdb72('0x4c')]=![];_0x92304e['scheduledat']=moment()[_0xdb72('0x4d')](_0x32f736,_0xdb72('0x4e'))[_0xdb72('0xf')](_0xdb72('0x30'));_0x92304e[_0xdb72('0x16')]=_0x591b1c[_0xdb72('0x16')];_0x92304e[_0xdb72('0x4f')]=_0x591b1c['ListId'];_0x92304e[_0xdb72('0x18')]=_0x591b1c[_0xdb72('0x18')]||undefined;return _0x92304e;};exports['decrementTalkink']=function(_0x12adeb,_0x5131c7){if(!_[_0xdb72('0x27')](_0x12adeb)){if(_0x12adeb['pTalking']>0x0){_0x12adeb[_0xdb72('0x50')]-=0x1;}else{logger[_0xdb72('0x7')](_0x5131c7,_0xdb72('0x51'));}}else{logger[_0xdb72('0x7')](_0x5131c7,_0xdb72('0x52'));}};exports[_0xdb72('0x53')]=function(_0xa450d0){if(_0xa450d0<=0x0){return!![];}return![];};exports[_0xdb72('0x54')]=function(_0x4aafdf,_0x4c4646,_0x1bb9fd){_0x4aafdf[_0xdb72('0x55')]=_0x4c4646;_0x4aafdf[_0xdb72('0x13')]=_0x4aafdf[_0xdb72('0x56')];_0x4aafdf['interface']=_0x4aafdf[_0xdb72('0x42')];if(_0x1bb9fd){_0x4aafdf[_0xdb72('0x57')]=_0x1bb9fd[_0xdb72('0x57')];}return _0x4aafdf;};exports[_0xdb72('0x58')]=function(_0x3d5bc2){var _0x21620f={};_0x21620f[_0xdb72('0x56')]=_0x3d5bc2[_0xdb72('0x56')];_0x21620f['interface']=_0x3d5bc2[_0xdb72('0x42')];_0x21620f[_0xdb72('0x40')]=_0x3d5bc2[_0xdb72('0x40')];return _0x21620f;};exports['agentReadyId']=function(_0x5104f5){var _0x3dbadb=[];for(var _0x2ff318 in _0x5104f5){if(_0x5104f5[_0xdb72('0x26')](_0x2ff318)){if(!_[_0xdb72('0x27')](_0x5104f5[_0x2ff318])&&_0x5104f5[_0x2ff318][_0xdb72('0x31')]===_0xdb72('0x59')&&_0x5104f5[_0x2ff318]['status']===_0xdb72('0x5a')){_0x3dbadb[_0xdb72('0x5b')](_0x5104f5[_0x2ff318]['id']);}}}return _0x3dbadb;};exports[_0xdb72('0x5c')]=function(_0x53efab){var _0x198254=moment()[_0xdb72('0x3')](0x0);var _0x25d946=moment(_0x53efab)['milliseconds'](0x0);return _0x198254[_0xdb72('0x4')](_0x25d946,_0xdb72('0x5'));};exports[_0xdb72('0x5d')]=function(_0x28c1ee){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x28c1ee[_0xdb72('0x16')],'ListId':_0x28c1ee[_0xdb72('0x4f')],'VoiceQueueId':_0x28c1ee[_0xdb72('0x18')]||undefined,'CampaignId':_0x28c1ee[_0xdb72('0x5e')]||undefined};};exports[_0xdb72('0x5f')]=function(_0x141d7e){if(_0x141d7e===_0xdb72('0x40')||_0x141d7e===_0xdb72('0x60')||_0x141d7e===_0xdb72('0x56')||_0x141d7e===_0xdb72('0x61')||_0x141d7e==='campaigntype'||_0x141d7e===_0xdb72('0x62')||_0x141d7e===_0xdb72('0x39')||_0x141d7e===_0xdb72('0x42')||_0x141d7e===_0xdb72('0x14')||_0x141d7e===_0xdb72('0x4c')||_0x141d7e===_0xdb72('0x15')||_0x141d7e==='scheduledat'||_0x141d7e==='countbusyretry'||_0x141d7e==='countcongestionretry'||_0x141d7e===_0xdb72('0x47')||_0x141d7e===_0xdb72('0x63')||_0x141d7e===_0xdb72('0x64')||_0x141d7e===_0xdb72('0x65')||_0x141d7e===_0xdb72('0x66')||_0x141d7e===_0xdb72('0x67')||_0x141d7e==='ContactId'||_0x141d7e===_0xdb72('0x4f')||_0x141d7e===_0xdb72('0x68')||_0x141d7e==='VoiceQueueId'||_0x141d7e===_0xdb72('0x69')||_0x141d7e===_0xdb72('0x6a')||_0x141d7e==='xmd-queue'||_0x141d7e===_0xdb72('0x6b')||_0x141d7e===_0xdb72('0x6c')||_0x141d7e===_0xdb72('0x6d')||_0x141d7e===_0xdb72('0x6e')||_0x141d7e==='xmd-dialoptions'||_0x141d7e===_0xdb72('0x6f')||_0x141d7e===_0xdb72('0x70')||_0x141d7e===_0xdb72('0x71')||_0x141d7e===_0xdb72('0x72')||_0x141d7e===_0xdb72('0x73')||_0x141d7e==='xmd-agiafter'||_0x141d7e==='xmd-agi'||_0x141d7e===_0xdb72('0x74')||_0x141d7e===_0xdb72('0x75')||_0x141d7e===_0xdb72('0x76')||_0x141d7e==='rtpaudioqosjitterbridged'||_0x141d7e==='rtpaudioqosloss'||_0x141d7e==='rtpaudioqoslossbridged'||_0x141d7e===_0xdb72('0x77')||_0x141d7e===_0xdb72('0x78')||_0x141d7e===_0xdb72('0x74')||_0x141d7e===_0xdb72('0x75')||_0x141d7e==='rtpaudioqosjitter'||_0x141d7e==='rtpaudioqosjitterbridged'||_0x141d7e===_0xdb72('0x79')||_0x141d7e===_0xdb72('0x7a')||_0x141d7e===_0xdb72('0x77')||_0x141d7e===_0xdb72('0x78')||_0x141d7e===_0xdb72('0x7b')||_0x141d7e===_0xdb72('0x7c')||_0x141d7e==='state'||_0x141d7e===_0xdb72('0x32')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x38a697,_0x5e0993){var _0x3b5962,_0x434d65,_0x2b3df9;if(_0x5e0993<=0x0){_0x5e0993=0x1;}_0x3b5962=new RegExp('\x5cw{0,'+_0x5e0993+'}$');_0x434d65=Math[_0xdb72('0x7d')](0xa,_0x5e0993-0x1);_0x2b3df9=Math['pow'](0xa,_0x5e0993)-0x1;return util[_0xdb72('0xf')]('%s',_['replace'](_0x38a697,_0x3b5962,_[_0xdb72('0x7e')](_0x434d65,_0x2b3df9)));};exports['extractCalleridName']=function(_0x3dcfdb){var _0x5186a0=_0x3dcfdb['match'](/"(.*?)"/);return _0x5186a0?_0x5186a0[0x1]:_0x3dcfdb;};exports[_0xdb72('0x7f')]=function(_0x4af32f){var _0x50755a=_0x4af32f[_0xdb72('0x80')](/<(.*?)>/);return _0x50755a?_0x50755a[0x1]:_0x4af32f;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 905961b..32786bc 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x4905a2,_0x53c4f9){var _0x4432b6=function(_0x5c11ce){while(--_0x5c11ce){_0x4905a2['push'](_0x4905a2['shift']());}};_0x4432b6(++_0x53c4f9);}(_0xb10b,0x12a));var _0xbb10=function(_0x44913c,_0x754aad){_0x44913c=_0x44913c-0x0;var _0x4b7ca2=_0xb10b[_0x44913c];return _0x4b7ca2;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x2c0cd0,_0x4d669e){var _0x30f63c=function(_0x32d979){while(--_0x32d979){_0x2c0cd0['push'](_0x2c0cd0['shift']());}};_0x30f63c(++_0x4d669e);}(_0xb10b,0x12a));var _0xbb10=function(_0x6eb02d,_0x20bdf5){_0x6eb02d=_0x6eb02d-0x0;var _0xb756de=_0xb10b[_0x6eb02d];return _0xb756de;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8506f76..5b036bb 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 _0xd654=['zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','telephones','length','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','diff','seconds','queuecallercomplete','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','voiceExtensions','faxAccounts','bluebird','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','trunks','voiceQueues','triggers','templates','channels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts'];(function(_0x3450af,_0x56beae){var _0x489a90=function(_0x451db1){while(--_0x451db1){_0x3450af['push'](_0x3450af['shift']());}};_0x489a90(++_0x56beae);}(_0xd654,0x16d));var _0x4d65=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd654[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require(_0x4d65('0x0'));var util=require('util');var _=require(_0x4d65('0x1'));var moment=require(_0x4d65('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x4d65('0x3'));var Trunk=require(_0x4d65('0x4'));var VoiceQueue=require(_0x4d65('0x5'));var Trigger=require(_0x4d65('0x6'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x4d65('0x7'));var ZendeskAccount=require(_0x4d65('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x4d65('0x9'));var SugarcrmAccount=require(_0x4d65('0xa'));var ZohoAccount=require(_0x4d65('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x4d65('0xc'));var ServicenowAccount=require(_0x4d65('0xd'));var Dynamics365Account=require(_0x4d65('0xe'));var FreshsalesAccount=require(_0x4d65('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x4d65('0x10')]={};this['telephones']={};this[_0x4d65('0x11')]={};this[_0x4d65('0x12')]={};this[_0x4d65('0x13')]={};this['campaigns']={};this[_0x4d65('0x14')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x4d65('0x15')]={};this['queueChannels']={};this['outboundChannels']={};this[_0x4d65('0x16')]={};this[_0x4d65('0x17')]={};this[_0x4d65('0x18')]={};this[_0x4d65('0x19')]={};this[_0x4d65('0x1a')]={};this[_0x4d65('0x1b')]={};this['deskAccounts']={};this[_0x4d65('0x1c')]={};this[_0x4d65('0x1d')]={};this[_0x4d65('0x1e')]={};this[_0x4d65('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5b7a79,_0x1e879c,_0x492d7e){var _0x30d397=_[_0x4d65('0x20')](_0x5b7a79,function(_0x355262,_0x238373){return _0x355262[_0x492d7e];});for(var _0x5b17e3 in _0x1e879c){if(_0x1e879c['hasOwnProperty'](_0x5b17e3)){if(!_0x30d397[_0x5b17e3]){delete _0x1e879c[_0x5b17e3];}}}}function freeIsNotKeySip(_0xab1bff,_0x245efc){var _0x48c322=_[_0x4d65('0x20')](_0xab1bff,function(_0x16493f,_0x49ad82){return util[_0x4d65('0x21')](_0x4d65('0x22'),_0x16493f['name']);});for(var _0x165047 in _0x245efc){if(_0x245efc[_0x4d65('0x23')](_0x165047)){if(!_0x48c322[_0x165047]){delete _0x245efc[_0x165047];}}}}function freeIsNotKeyAgent(_0x1cfdbd,_0x355a05){var _0x3bfa02=_[_0x4d65('0x20')](_0x1cfdbd,function(_0x47c885,_0x1ce488){var _0x3c2bd2=_[_0x4d65('0x24')](_0x47c885[_0x4d65('0x25')])?util['format'](_0x4d65('0x22'),_0x47c885[_0x4d65('0x26')]):_0x47c885['interface'];return _0x3c2bd2;});for(var _0x3bfd0b in _0x355a05){if(_0x355a05[_0x4d65('0x23')](_0x3bfd0b)){if(!_0x3bfa02[_0x3bfd0b]){delete _0x355a05[_0x3bfd0b];}}}}function clearVoiceCallReports(_0x40bb8d){_0x40bb8d[_0x4d65('0x27')]=0x0;_0x40bb8d[_0x4d65('0x28')]=0x0;_0x40bb8d[_0x4d65('0x29')]=0x0;_0x40bb8d[_0x4d65('0x2a')]=0x0;_0x40bb8d[_0x4d65('0x2b')]=0x0;}function clearCampaigns(_0x598eb5){if(!_['isEmpty'](_0x598eb5)){for(var _0x559a15 in _0x598eb5){if(_0x598eb5[_0x4d65('0x23')](_0x559a15)){_0x598eb5[_0x559a15]['ivrTotalCallsDays']=0x0;_0x598eb5[_0x559a15][_0x4d65('0x2c')]=0x0;}}}}function clearVoiceQueues(_0xbece65){if(!_['isEmpty'](_0xbece65)){for(var _0x4554e6 in _0xbece65){if(_0xbece65[_0x4d65('0x23')](_0x4554e6)){_0xbece65[_0x4554e6][_0x4d65('0x27')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x28')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x2d')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x2e')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x29')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x2a')]=0x0;_0xbece65[_0x4554e6]['sumBillable']=0x0;_0xbece65[_0x4554e6][_0x4d65('0x2f')]=0x0;_0xbece65[_0x4554e6]['outboundNoAnswerCallsDay']=0x0;_0xbece65[_0x4554e6][_0x4d65('0x30')]=0x0;_0xbece65[_0x4554e6]['outboundCongestionCallsDay']=0x0;_0xbece65[_0x4554e6][_0x4d65('0x31')]=0x0;_0xbece65[_0x4554e6]['outboundUnknownCallsDay']=0x0;_0xbece65[_0x4554e6][_0x4d65('0x32')]=0x0;_0xbece65[_0x4554e6]['outboundDropCallsDayCallersExit']=0x0;_0xbece65[_0x4554e6][_0x4d65('0x33')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x34')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x35')]=0x0;_0xbece65[_0x4554e6][_0x4d65('0x36')]=0x0;_0xbece65[_0x4554e6]['outboundAnswerAgiCallsDay']=0x0;_0xbece65[_0x4554e6]['outboundAnswerCallsDay']=0x0;_0xbece65[_0x4554e6][_0x4d65('0x37')]=!![];}}}}Realtime[_0x4d65('0x38')][_0x4d65('0x39')]=function(_0x2df578,_0x1b78bf){for(var _0x422286 in _0x1b78bf){if(_0x2df578['hasOwnProperty'](_0x422286)){_0x2df578[_0x422286]=_0x1b78bf[_0x422286];}}};Realtime[_0x4d65('0x38')][_0x4d65('0x3a')]=function(){var _0x313811=this;return function(_0x26f8bd){if(_0x26f8bd){freeIsNotKeyAgent(_0x26f8bd,_0x313811[_0x4d65('0x10')]);for(var _0x581941=0x0,_0x230308={},_0x494c14={};_0x581941<_0x26f8bd['length'];_0x581941+=0x1){_0x230308=_0x26f8bd[_0x581941];var _0x1fbff4=_['isNil'](_0x230308[_0x4d65('0x25')])?util[_0x4d65('0x21')](_0x4d65('0x22'),_0x230308[_0x4d65('0x26')]):_0x230308[_0x4d65('0x25')];if(_[_0x4d65('0x3b')](_0x313811['agents'][_0x1fbff4])){_0x313811[_0x4d65('0x10')][_0x1fbff4]=new Agent(_0x230308);}else{_0x313811[_0x4d65('0x39')](_0x313811[_0x4d65('0x10')][_0x1fbff4],_0x230308);}}}return _0x313811[_0x4d65('0x10')];};};Realtime['prototype'][_0x4d65('0x3c')]=function(){var _0x4b6703=this;return function(_0x337d08){if(_0x337d08){freeIsNotKeySip(_0x337d08,_0x4b6703[_0x4d65('0x3d')]);for(var _0x1ce2f8=0x0,_0x2807e3={},_0x14deba={};_0x1ce2f8<_0x337d08[_0x4d65('0x3e')];_0x1ce2f8+=0x1){_0x2807e3=_0x337d08[_0x1ce2f8];if(_[_0x4d65('0x3b')](_0x4b6703[_0x4d65('0x3d')][util['format'](_0x4d65('0x22'),_0x2807e3[_0x4d65('0x26')])])){_0x4b6703['telephones'][util[_0x4d65('0x21')](_0x4d65('0x22'),_0x2807e3[_0x4d65('0x26')])]=new Telephone(_0x2807e3);}else{_0x4b6703[_0x4d65('0x39')](_0x4b6703[_0x4d65('0x3d')][util[_0x4d65('0x21')](_0x4d65('0x22'),_0x2807e3[_0x4d65('0x26')])],_0x2807e3);}}}return _0x4b6703['telephones'];};};Realtime[_0x4d65('0x38')]['initTrunks']=function(){var _0x878ba=this;return function(_0x328233){if(_0x328233){freeIsNotKeySip(_0x328233,_0x878ba[_0x4d65('0x11')]);for(var _0x4fc4d4=0x0,_0x8fa677={},_0xec6f7c={};_0x4fc4d4<_0x328233[_0x4d65('0x3e')];_0x4fc4d4+=0x1){_0x8fa677=_0x328233[_0x4fc4d4];if(_[_0x4d65('0x3b')](_0x878ba['trunks'][util[_0x4d65('0x21')](_0x4d65('0x22'),_0x8fa677[_0x4d65('0x26')])])){_0x878ba['trunks'][util[_0x4d65('0x21')](_0x4d65('0x22'),_0x8fa677['name'])]=new Trunk(_0x8fa677);}else{_0x878ba[_0x4d65('0x39')](_0x878ba['trunks'][util[_0x4d65('0x21')](_0x4d65('0x22'),_0x8fa677[_0x4d65('0x26')])],_0x8fa677);}}}return _0x878ba[_0x4d65('0x11')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x3f')]=function(){var _0x2c382c=this;return function(_0x470092){if(_0x470092){freeIsNotKey(_0x470092,_0x2c382c[_0x4d65('0x12')],_0x4d65('0x26'));for(var _0x235a35=0x0,_0x287ccf={},_0x1bf7aa={};_0x235a35<_0x470092[_0x4d65('0x3e')];_0x235a35+=0x1){_0x287ccf=_0x470092[_0x235a35];if(_[_0x4d65('0x3b')](_0x2c382c['voiceQueues'][_0x287ccf[_0x4d65('0x26')]])){_0x2c382c[_0x4d65('0x12')][_0x287ccf['name']]=new VoiceQueue(_0x287ccf);}else{_0x2c382c[_0x4d65('0x39')](_0x2c382c['voiceQueues'][_0x287ccf['name']],_0x287ccf);}}}return _0x2c382c['voiceQueues'];};};Realtime[_0x4d65('0x38')][_0x4d65('0x40')]=function(){var _0x4d3644=this;return function(_0x137547){if(_0x137547){freeIsNotKey(_0x137547,_0x4d3644[_0x4d65('0x13')],'id');for(var _0x1ef923=0x0,_0x31bbc7={},_0x5067ce={};_0x1ef923<_0x137547['length'];_0x1ef923+=0x1){_0x31bbc7=_0x137547[_0x1ef923];if(_[_0x4d65('0x3b')](_0x4d3644['triggers'][_0x31bbc7['id']])){_0x4d3644[_0x4d65('0x13')][_0x31bbc7['id']]=new Trigger(_0x31bbc7);}else{_0x4d3644[_0x4d65('0x39')](_0x4d3644[_0x4d65('0x13')][_0x31bbc7['id']],_0x31bbc7);}}}return _0x4d3644[_0x4d65('0x13')];};};Realtime['prototype'][_0x4d65('0x41')]=function(){var _0x80b87c=this;return function(_0x5dba58){if(_0x5dba58){freeIsNotKey(_0x5dba58,_0x80b87c[_0x4d65('0x14')],'id');for(var _0x182784=0x0,_0x3e4e0c={},_0x3677b6={};_0x182784<_0x5dba58[_0x4d65('0x3e')];_0x182784+=0x1){_0x3e4e0c=_0x5dba58[_0x182784];if(_[_0x4d65('0x3b')](_0x80b87c['templates'][_0x3e4e0c['id']])){_0x80b87c['templates'][_0x3e4e0c['id']]=new Template(_0x3e4e0c);}else{_0x80b87c['mergeFromDatabase'](_0x80b87c[_0x4d65('0x14')][_0x3e4e0c['id']],_0x3e4e0c);}}}return _0x80b87c[_0x4d65('0x14')];};};Realtime['prototype'][_0x4d65('0x42')]=function(){var _0x582be0=this;return function(_0x4dd35c){if(_0x4dd35c){freeIsNotKey(_0x4dd35c,_0x582be0['zendeskAccounts'],'id');for(var _0x110846=0x0,_0x537ee0={},_0x1a58b3={};_0x110846<_0x4dd35c[_0x4d65('0x3e')];_0x110846+=0x1){_0x537ee0=_0x4dd35c[_0x110846];if(_[_0x4d65('0x3b')](_0x582be0[_0x4d65('0x17')][_0x537ee0['id']])){_0x582be0[_0x4d65('0x17')][_0x537ee0['id']]=new ZendeskAccount(_0x537ee0);}else{_0x582be0[_0x4d65('0x39')](_0x582be0[_0x4d65('0x17')][_0x537ee0['id']],_0x537ee0);}}}return _0x582be0[_0x4d65('0x17')];};};Realtime[_0x4d65('0x38')]['initSalesforceAccounts']=function(){var _0x388b8b=this;return function(_0x1b7f8b){if(_0x1b7f8b){freeIsNotKey(_0x1b7f8b,_0x388b8b[_0x4d65('0x18')],'id');for(var _0x4f4ceb=0x0,_0x2228c9={},_0x5510f2={};_0x4f4ceb<_0x1b7f8b[_0x4d65('0x3e')];_0x4f4ceb+=0x1){_0x2228c9=_0x1b7f8b[_0x4f4ceb];if(_['isUndefined'](_0x388b8b[_0x4d65('0x18')][_0x2228c9['id']])){_0x388b8b[_0x4d65('0x18')][_0x2228c9['id']]=new SalesforceAccount(_0x2228c9);}else{_0x388b8b['mergeFromDatabase'](_0x388b8b[_0x4d65('0x18')][_0x2228c9['id']],_0x2228c9);}}}return _0x388b8b[_0x4d65('0x18')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2a34e1=this;return function(_0xece672){if(_0xece672){freeIsNotKey(_0xece672,_0x2a34e1[_0x4d65('0x1a')],'id');for(var _0xd7c4e7=0x0,_0x22dc63={},_0x253ab0={};_0xd7c4e7<_0xece672[_0x4d65('0x3e')];_0xd7c4e7+=0x1){_0x22dc63=_0xece672[_0xd7c4e7];if(_[_0x4d65('0x3b')](_0x2a34e1[_0x4d65('0x1a')][_0x22dc63['id']])){_0x2a34e1[_0x4d65('0x1a')][_0x22dc63['id']]=new FreshdeskAccount(_0x22dc63);}else{_0x2a34e1[_0x4d65('0x39')](_0x2a34e1[_0x4d65('0x1a')][_0x22dc63['id']],_0x22dc63);}}}return _0x2a34e1[_0x4d65('0x1a')];};};Realtime[_0x4d65('0x38')]['initZohoAccounts']=function(){var _0x254a2f=this;return function(_0x323fe1){if(_0x323fe1){freeIsNotKey(_0x323fe1,_0x254a2f[_0x4d65('0x1b')],'id');for(var _0x5e3224=0x0,_0x193472={},_0x54d370={};_0x5e3224<_0x323fe1[_0x4d65('0x3e')];_0x5e3224+=0x1){_0x193472=_0x323fe1[_0x5e3224];if(_['isUndefined'](_0x254a2f['zohoAccounts'][_0x193472['id']])){_0x254a2f[_0x4d65('0x1b')][_0x193472['id']]=new ZohoAccount(_0x193472);}else{_0x254a2f[_0x4d65('0x39')](_0x254a2f[_0x4d65('0x1b')][_0x193472['id']],_0x193472);}}}return _0x254a2f[_0x4d65('0x1b')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x43')]=function(){var _0x1b4658=this;return function(_0x4cc3a5){if(_0x4cc3a5){freeIsNotKey(_0x4cc3a5,_0x1b4658[_0x4d65('0x44')],'id');for(var _0x3417a1=0x0,_0x1e28f1={},_0x339206={};_0x3417a1<_0x4cc3a5[_0x4d65('0x3e')];_0x3417a1+=0x1){_0x1e28f1=_0x4cc3a5[_0x3417a1];if(_[_0x4d65('0x3b')](_0x1b4658['deskAccounts'][_0x1e28f1['id']])){_0x1b4658[_0x4d65('0x44')][_0x1e28f1['id']]=new DeskAccount(_0x1e28f1);}else{_0x1b4658[_0x4d65('0x39')](_0x1b4658['deskAccounts'][_0x1e28f1['id']],_0x1e28f1);}}}return _0x1b4658[_0x4d65('0x44')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x45')]=function(){var _0x27aab7=this;return function(_0x2c623b){if(_0x2c623b){freeIsNotKey(_0x2c623b,_0x27aab7[_0x4d65('0x19')],'id');for(var _0x3c0f38=0x0,_0x388ccd={},_0x2fc947={};_0x3c0f38<_0x2c623b['length'];_0x3c0f38+=0x1){_0x388ccd=_0x2c623b[_0x3c0f38];if(_['isUndefined'](_0x27aab7[_0x4d65('0x19')][_0x388ccd['id']])){_0x27aab7[_0x4d65('0x19')][_0x388ccd['id']]=new SugarcrmAccount(_0x388ccd);}else{_0x27aab7[_0x4d65('0x39')](_0x27aab7[_0x4d65('0x19')][_0x388ccd['id']],_0x388ccd);}}}return _0x27aab7[_0x4d65('0x19')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x46')]=function(){var _0xa2405d=this;return function(_0x495de9){if(_0x495de9){freeIsNotKey(_0x495de9,_0xa2405d[_0x4d65('0x1c')],'id');for(var _0x2d2c3d=0x0,_0x880b5={},_0xb4ed5={};_0x2d2c3d<_0x495de9[_0x4d65('0x3e')];_0x2d2c3d+=0x1){_0x880b5=_0x495de9[_0x2d2c3d];if(_[_0x4d65('0x3b')](_0xa2405d[_0x4d65('0x1c')][_0x880b5['id']])){_0xa2405d[_0x4d65('0x1c')][_0x880b5['id']]=new VtigerAccount(_0x880b5);}else{_0xa2405d['mergeFromDatabase'](_0xa2405d[_0x4d65('0x1c')][_0x880b5['id']],_0x880b5);}}}return _0xa2405d[_0x4d65('0x1c')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x47')]=function(){var _0x3a9b6c=this;return function(_0x17a1d8){if(_0x17a1d8){freeIsNotKey(_0x17a1d8,_0x3a9b6c[_0x4d65('0x1d')],'id');for(var _0x391473=0x0,_0x2449c1={},_0x55457f={};_0x391473<_0x17a1d8[_0x4d65('0x3e')];_0x391473+=0x1){_0x2449c1=_0x17a1d8[_0x391473];if(_[_0x4d65('0x3b')](_0x3a9b6c['servicenowAccounts'][_0x2449c1['id']])){_0x3a9b6c[_0x4d65('0x1d')][_0x2449c1['id']]=new ServicenowAccount(_0x2449c1);}else{_0x3a9b6c['mergeFromDatabase'](_0x3a9b6c[_0x4d65('0x1d')][_0x2449c1['id']],_0x2449c1);}}}return _0x3a9b6c[_0x4d65('0x1d')];};};Realtime['prototype'][_0x4d65('0x48')]=function(){var _0x32544f=this;return function(_0x4d0d8d){if(_0x4d0d8d){freeIsNotKey(_0x4d0d8d,_0x32544f[_0x4d65('0x1e')],'id');for(var _0x4bc8b8=0x0,_0x49f133={},_0x595212={};_0x4bc8b8<_0x4d0d8d[_0x4d65('0x3e')];_0x4bc8b8+=0x1){_0x49f133=_0x4d0d8d[_0x4bc8b8];if(_['isUndefined'](_0x32544f[_0x4d65('0x1e')][_0x49f133['id']])){_0x32544f[_0x4d65('0x1e')][_0x49f133['id']]=new Dynamics365Account(_0x49f133);}else{_0x32544f[_0x4d65('0x39')](_0x32544f[_0x4d65('0x1e')][_0x49f133['id']],_0x49f133);}}}return _0x32544f[_0x4d65('0x1e')];};};Realtime['prototype'][_0x4d65('0x49')]=function(){var _0x8be190=this;return function(_0x653df9){if(_0x653df9){freeIsNotKey(_0x653df9,_0x8be190[_0x4d65('0x1f')],'id');for(var _0x10e96d=0x0,_0x364c68={},_0x540ce2={};_0x10e96d<_0x653df9[_0x4d65('0x3e')];_0x10e96d+=0x1){_0x364c68=_0x653df9[_0x10e96d];if(_[_0x4d65('0x3b')](_0x8be190[_0x4d65('0x1f')][_0x364c68['id']])){_0x8be190[_0x4d65('0x1f')][_0x364c68['id']]=new FreshsalesAccount(_0x364c68);}else{_0x8be190[_0x4d65('0x39')](_0x8be190[_0x4d65('0x1f')][_0x364c68['id']],_0x364c68);}}}return _0x8be190['freshsalesAccounts'];};};Realtime['prototype'][_0x4d65('0x4a')]=function(){var _0x485b79=this;return function(_0xbcca7){for(var _0x3bd428=0x0;_0x3bd428<_0xbcca7['length'];_0x3bd428+=0x1){_[_0x4d65('0x4b')](_0x485b79['voiceQueues'][_0xbcca7[_0x3bd428][_0x4d65('0x26')]],_0xbcca7[_0x3bd428]);}return _0x485b79[_0x4d65('0x12')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x4c')]=function(){var _0x14615a=this;return function(_0x2766dc){clearVoiceQueues(_0x14615a['voiceQueues']);if(_0x2766dc){_0x2766dc=_[_0x4d65('0x4d')](_0x2766dc,_0x4d65('0x4e'));for(var _0x5e08d7 in _0x2766dc){if(_0x2766dc[_0x4d65('0x23')](_0x5e08d7)){var _0x3b1f83={};for(var _0x46da89=0x0;_0x46da89<_0x2766dc[_0x5e08d7]['length'];_0x46da89+=0x1){var _0x594973=_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x4f')];if(_0x14615a[_0x4d65('0x12')][_0x594973]){if(_0x2766dc[_0x5e08d7][_0x46da89]['queuecallerexit']){_0x14615a[_0x4d65('0x12')][_0x594973][_0x4d65('0x2d')]+=0x1;}if(_0x2766dc[_0x5e08d7][_0x46da89]['queuecallerabandon']){_0x14615a['voiceQueues'][_0x594973]['abandoned']+=0x1;}_0x14615a['voiceQueues'][_0x594973][_0x4d65('0x29')]+=moment(_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x50')])['diff'](moment(_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x51')]),'seconds')||0x0;if(_0x46da89===_0x2766dc[_0x5e08d7][_0x4d65('0x3e')]-0x1){_0x14615a['voiceQueues'][_0x594973][_0x4d65('0x2a')]+=moment(_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x52')]||_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x53')]||_0x2766dc[_0x5e08d7][_0x46da89]['queuecallerexitAt'])[_0x4d65('0x54')](moment(_0x2766dc[_0x5e08d7][_0x46da89]['queuecallerjoinAt']),_0x4d65('0x55'))||0x0;_0x14615a[_0x4d65('0x12')][_0x594973][_0x4d65('0x27')]+=0x1;if(_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x56')]){_0x14615a[_0x4d65('0x12')][_0x594973]['answered']+=0x1;_0x14615a[_0x4d65('0x12')][_0x594973][_0x4d65('0x2b')]+=moment(_0x2766dc[_0x5e08d7][_0x46da89][_0x4d65('0x52')])['diff'](moment(_0x2766dc[_0x5e08d7][_0x46da89]['queuecallerleaveAt']),_0x4d65('0x55'))||0x0;}}else{_0x14615a[_0x4d65('0x12')][_0x594973][_0x4d65('0x2a')]+=_0x14615a['voiceQueues'][_0x594973][_0x4d65('0x29')]||0x0;}}}}}}return _0x14615a['voiceQueues'];};};Realtime[_0x4d65('0x38')]['initVoiceCallReports']=function(){var _0xfce934=this;return function(_0x38f698){clearVoiceCallReports(_0xfce934[_0x4d65('0x57')]);if(_0x38f698){for(var _0x1dfa55=0x0;_0x1dfa55<_0x38f698['length'];_0x1dfa55+=0x1){_0xfce934[_0x4d65('0x57')][_0x4d65('0x27')]+=0x1;_0xfce934['outbound'][_0x4d65('0x2a')]+=_0x38f698[_0x1dfa55][_0x4d65('0x58')];if(_0x38f698[_0x1dfa55][_0x4d65('0x59')]===_0x4d65('0x5a')){_0xfce934[_0x4d65('0x57')][_0x4d65('0x28')]+=0x1;_0xfce934[_0x4d65('0x57')][_0x4d65('0x29')]+=_0x38f698[_0x1dfa55][_0x4d65('0x58')]-_0x38f698[_0x1dfa55]['billableseconds']||0x0;_0xfce934[_0x4d65('0x57')][_0x4d65('0x2b')]+=_0x38f698[_0x1dfa55][_0x4d65('0x5b')];}}}return _0xfce934['outbound'];};};Realtime[_0x4d65('0x38')][_0x4d65('0x5c')]=function(){var _0x4f6e2a=this;return function(_0x5ca3b5){if(_0x5ca3b5){freeIsNotKey(_0x5ca3b5,_0x4f6e2a[_0x4d65('0x5d')],'name');for(var _0x5b310a=0x0,_0x6e85d={};_0x5b310a<_0x5ca3b5['length'];_0x5b310a+=0x1){_0x6e85d=_0x5ca3b5[_0x5b310a];if(_[_0x4d65('0x3b')](_0x4f6e2a['campaigns'][_0x6e85d[_0x4d65('0x26')]])){_0x4f6e2a['campaigns'][_0x6e85d[_0x4d65('0x26')]]=new Campaign(_0x6e85d);}else{_0x4f6e2a[_0x4d65('0x39')](_0x4f6e2a[_0x4d65('0x5d')][_0x6e85d[_0x4d65('0x26')]],_0x6e85d);_0x4f6e2a[_0x4d65('0x5d')][_0x6e85d['name']]['dialQueueProject']=_0x6e85d[_0x4d65('0x5e')]?_0x6e85d[_0x4d65('0x5e')]['name']:undefined;}}}return _0x4f6e2a[_0x4d65('0x5d')];};};Realtime[_0x4d65('0x38')][_0x4d65('0x5f')]=function(){var _0x190506=this;return function(_0x31d83f){if(_0x31d83f){freeIsNotKey(_0x31d83f,_0x190506[_0x4d65('0x60')],'id');for(var _0x271cfb=0x0,_0x25e538={};_0x271cfb<_0x31d83f[_0x4d65('0x3e')];_0x271cfb+=0x1){_0x25e538=_0x31d83f[_0x271cfb];if(_[_0x4d65('0x3b')](_0x190506['voiceExtensions'][_0x25e538['id']])){_0x190506[_0x4d65('0x60')][_0x25e538['id']]=new VoiceExtension(_0x25e538);}else{_0x190506[_0x4d65('0x39')](_0x190506[_0x4d65('0x60')][_0x25e538['id']],_0x25e538);}}}return _0x190506[_0x4d65('0x60')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x1d1233=this;return function(_0x139b59){clearCampaigns(_0x1d1233[_0x4d65('0x5d')]);for(var _0x28b8e0=0x0;_0x28b8e0<_0x139b59['length'];_0x28b8e0+=0x1){_[_0x4d65('0x4b')](_0x1d1233[_0x4d65('0x5d')][_0x139b59[_0x28b8e0][_0x4d65('0x26')]],_0x139b59[_0x28b8e0]);}return _0x1d1233[_0x4d65('0x5d')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x200f09=this;return function(_0x4a3843){if(_0x4a3843){freeIsNotKey(_0x4a3843,_0x200f09[_0x4d65('0x61')],'id');for(var _0x5a96ef=0x0,_0x2d88c5={},_0x55c113={};_0x5a96ef<_0x4a3843[_0x4d65('0x3e')];_0x5a96ef+=0x1){_0x2d88c5=_0x4a3843[_0x5a96ef];if(_[_0x4d65('0x3b')](_0x200f09['faxAccounts'][_0x2d88c5['id']])){_0x200f09[_0x4d65('0x61')][_0x2d88c5['id']]=new FaxAccount(_0x2d88c5);}else{_0x200f09['mergeFromDatabase'](_0x200f09[_0x4d65('0x61')][_0x2d88c5['id']],_0x2d88c5);}}}return _0x200f09[_0x4d65('0x61')];};};module['exports']=Realtime; \ No newline at end of file +var _0xab45=['../model/voiceQueue','../model/template','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','total','answered','sumDuration','sumBillable','isEmpty','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','isNil','interface','isUndefined','initTelephones','length','telephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','queue','queuecallerexit','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','merge','util','moment','../model/agent','../model/trunk'];(function(_0x709e27,_0x416e95){var _0x2840fb=function(_0x341561){while(--_0x341561){_0x709e27['push'](_0x709e27['shift']());}};_0x2840fb(++_0x416e95);}(_0xab45,0xc4));var _0x5ab4=function(_0xa191b8,_0x35c3a7){_0xa191b8=_0xa191b8-0x0;var _0x305fcd=_0xab45[_0xa191b8];return _0x305fcd;};'use strict';var BPromise=require('bluebird');var util=require(_0x5ab4('0x0'));var _=require('lodash');var moment=require(_0x5ab4('0x1'));var Agent=require(_0x5ab4('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x5ab4('0x3'));var VoiceQueue=require(_0x5ab4('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x5ab4('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5ab4('0x6'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x5ab4('0x7'));var ZohoAccount=require(_0x5ab4('0x8'));var DeskAccount=require(_0x5ab4('0x9'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x5ab4('0xa'));var Dynamics365Account=require(_0x5ab4('0xb'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x5ab4('0xc'));var Realtime=function(){this[_0x5ab4('0xd')]={};this['telephones']={};this[_0x5ab4('0xe')]={};this[_0x5ab4('0xf')]={};this[_0x5ab4('0x10')]={};this['campaigns']={};this[_0x5ab4('0x11')]={};this[_0x5ab4('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5ab4('0x13')]={};this[_0x5ab4('0x14')]={};this['queueChannels']={};this[_0x5ab4('0x15')]={};this[_0x5ab4('0x16')]={};this[_0x5ab4('0x17')]={};this[_0x5ab4('0x18')]={};this[_0x5ab4('0x19')]={};this[_0x5ab4('0x1a')]={};this[_0x5ab4('0x1b')]={};this['deskAccounts']={};this[_0x5ab4('0x1c')]={};this[_0x5ab4('0x1d')]={};this[_0x5ab4('0x1e')]={};this[_0x5ab4('0x1f')]={};this[_0x5ab4('0x20')]={};};function freeIsNotKey(_0xeecd5,_0x353845,_0x544b36){var _0x5cdbe6=_[_0x5ab4('0x21')](_0xeecd5,function(_0x23a7d6,_0x256a7c){return _0x23a7d6[_0x544b36];});for(var _0x9a0f65 in _0x353845){if(_0x353845['hasOwnProperty'](_0x9a0f65)){if(!_0x5cdbe6[_0x9a0f65]){delete _0x353845[_0x9a0f65];}}}}function freeIsNotKeySip(_0x50142b,_0x1f10ac){var _0x3fa704=_['mapKeys'](_0x50142b,function(_0x35dfe0,_0x17f8d1){return util[_0x5ab4('0x22')](_0x5ab4('0x23'),_0x35dfe0[_0x5ab4('0x24')]);});for(var _0x1fe420 in _0x1f10ac){if(_0x1f10ac['hasOwnProperty'](_0x1fe420)){if(!_0x3fa704[_0x1fe420]){delete _0x1f10ac[_0x1fe420];}}}}function freeIsNotKeyAgent(_0x6e51c7,_0x442e85){var _0x1807ea=_[_0x5ab4('0x21')](_0x6e51c7,function(_0x57859b,_0x58b65c){var _0x191fc4=_['isNil'](_0x57859b['interface'])?util['format'](_0x5ab4('0x23'),_0x57859b[_0x5ab4('0x24')]):_0x57859b['interface'];return _0x191fc4;});for(var _0x4c4e6e in _0x442e85){if(_0x442e85[_0x5ab4('0x25')](_0x4c4e6e)){if(!_0x1807ea[_0x4c4e6e]){delete _0x442e85[_0x4c4e6e];}}}}function clearVoiceCallReports(_0x3a4234){_0x3a4234[_0x5ab4('0x26')]=0x0;_0x3a4234[_0x5ab4('0x27')]=0x0;_0x3a4234['sumHoldTime']=0x0;_0x3a4234[_0x5ab4('0x28')]=0x0;_0x3a4234[_0x5ab4('0x29')]=0x0;}function clearCampaigns(_0x385ae4){if(!_[_0x5ab4('0x2a')](_0x385ae4)){for(var _0x398b0d in _0x385ae4){if(_0x385ae4[_0x5ab4('0x25')](_0x398b0d)){_0x385ae4[_0x398b0d]['ivrTotalCallsDays']=0x0;_0x385ae4[_0x398b0d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x35da55){if(!_[_0x5ab4('0x2a')](_0x35da55)){for(var _0x61178c in _0x35da55){if(_0x35da55[_0x5ab4('0x25')](_0x61178c)){_0x35da55[_0x61178c][_0x5ab4('0x26')]=0x0;_0x35da55[_0x61178c]['answered']=0x0;_0x35da55[_0x61178c]['unmanaged']=0x0;_0x35da55[_0x61178c][_0x5ab4('0x2b')]=0x0;_0x35da55[_0x61178c]['sumHoldTime']=0x0;_0x35da55[_0x61178c][_0x5ab4('0x28')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x29')]=0x0;_0x35da55[_0x61178c]['outboundAnswerAgiCallsDay']=0x0;_0x35da55[_0x61178c][_0x5ab4('0x2c')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x2d')]=0x0;_0x35da55[_0x61178c]['outboundCongestionCallsDay']=0x0;_0x35da55[_0x61178c][_0x5ab4('0x2e')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x2f')]=0x0;_0x35da55[_0x61178c]['outboundDropCallsDayTimeout']=0x0;_0x35da55[_0x61178c][_0x5ab4('0x30')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x31')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x32')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x33')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x34')]=0x0;_0x35da55[_0x61178c]['outboundAnswerAgiCallsDay']=0x0;_0x35da55[_0x61178c][_0x5ab4('0x35')]=0x0;_0x35da55[_0x61178c][_0x5ab4('0x36')]=!![];}}}}Realtime['prototype'][_0x5ab4('0x37')]=function(_0x10af65,_0x325dfc){for(var _0x36e806 in _0x325dfc){if(_0x10af65['hasOwnProperty'](_0x36e806)){_0x10af65[_0x36e806]=_0x325dfc[_0x36e806];}}};Realtime[_0x5ab4('0x38')]['initAgents']=function(){var _0x37ecc6=this;return function(_0xdfce4e){if(_0xdfce4e){freeIsNotKeyAgent(_0xdfce4e,_0x37ecc6[_0x5ab4('0xd')]);for(var _0x17111c=0x0,_0x5a07a8={},_0x1d2007={};_0x17111c<_0xdfce4e['length'];_0x17111c+=0x1){_0x5a07a8=_0xdfce4e[_0x17111c];var _0x5b938f=_[_0x5ab4('0x39')](_0x5a07a8[_0x5ab4('0x3a')])?util[_0x5ab4('0x22')](_0x5ab4('0x23'),_0x5a07a8[_0x5ab4('0x24')]):_0x5a07a8[_0x5ab4('0x3a')];if(_[_0x5ab4('0x3b')](_0x37ecc6[_0x5ab4('0xd')][_0x5b938f])){_0x37ecc6[_0x5ab4('0xd')][_0x5b938f]=new Agent(_0x5a07a8);}else{_0x37ecc6[_0x5ab4('0x37')](_0x37ecc6[_0x5ab4('0xd')][_0x5b938f],_0x5a07a8);}}}return _0x37ecc6[_0x5ab4('0xd')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x3c')]=function(){var _0x34f01a=this;return function(_0x42d8b0){if(_0x42d8b0){freeIsNotKeySip(_0x42d8b0,_0x34f01a['telephones']);for(var _0x1532f9=0x0,_0x4cae25={},_0x3de6bb={};_0x1532f9<_0x42d8b0[_0x5ab4('0x3d')];_0x1532f9+=0x1){_0x4cae25=_0x42d8b0[_0x1532f9];if(_['isUndefined'](_0x34f01a[_0x5ab4('0x3e')][util[_0x5ab4('0x22')]('SIP/%s',_0x4cae25[_0x5ab4('0x24')])])){_0x34f01a['telephones'][util[_0x5ab4('0x22')](_0x5ab4('0x23'),_0x4cae25[_0x5ab4('0x24')])]=new Telephone(_0x4cae25);}else{_0x34f01a[_0x5ab4('0x37')](_0x34f01a['telephones'][util[_0x5ab4('0x22')](_0x5ab4('0x23'),_0x4cae25[_0x5ab4('0x24')])],_0x4cae25);}}}return _0x34f01a['telephones'];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x3f')]=function(){var _0x7a7478=this;return function(_0x4c8e65){if(_0x4c8e65){freeIsNotKeySip(_0x4c8e65,_0x7a7478[_0x5ab4('0xe')]);for(var _0x4c8d28=0x0,_0x4cd2e0={},_0x5556dc={};_0x4c8d28<_0x4c8e65['length'];_0x4c8d28+=0x1){_0x4cd2e0=_0x4c8e65[_0x4c8d28];if(_[_0x5ab4('0x3b')](_0x7a7478[_0x5ab4('0xe')][util[_0x5ab4('0x22')](_0x5ab4('0x23'),_0x4cd2e0[_0x5ab4('0x24')])])){_0x7a7478[_0x5ab4('0xe')][util[_0x5ab4('0x22')](_0x5ab4('0x23'),_0x4cd2e0[_0x5ab4('0x24')])]=new Trunk(_0x4cd2e0);}else{_0x7a7478[_0x5ab4('0x37')](_0x7a7478[_0x5ab4('0xe')][util['format'](_0x5ab4('0x23'),_0x4cd2e0[_0x5ab4('0x24')])],_0x4cd2e0);}}}return _0x7a7478[_0x5ab4('0xe')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x40')]=function(){var _0x5e2423=this;return function(_0x307d81){if(_0x307d81){freeIsNotKey(_0x307d81,_0x5e2423[_0x5ab4('0xf')],_0x5ab4('0x24'));for(var _0xcaa80=0x0,_0x5baf3a={},_0x32e006={};_0xcaa80<_0x307d81['length'];_0xcaa80+=0x1){_0x5baf3a=_0x307d81[_0xcaa80];if(_['isUndefined'](_0x5e2423[_0x5ab4('0xf')][_0x5baf3a[_0x5ab4('0x24')]])){_0x5e2423[_0x5ab4('0xf')][_0x5baf3a['name']]=new VoiceQueue(_0x5baf3a);}else{_0x5e2423[_0x5ab4('0x37')](_0x5e2423[_0x5ab4('0xf')][_0x5baf3a[_0x5ab4('0x24')]],_0x5baf3a);}}}return _0x5e2423[_0x5ab4('0xf')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x41')]=function(){var _0x716c37=this;return function(_0x55cc8a){if(_0x55cc8a){freeIsNotKey(_0x55cc8a,_0x716c37['triggers'],'id');for(var _0x1319a0=0x0,_0x1e9e44={},_0x3bfc0a={};_0x1319a0<_0x55cc8a[_0x5ab4('0x3d')];_0x1319a0+=0x1){_0x1e9e44=_0x55cc8a[_0x1319a0];if(_['isUndefined'](_0x716c37['triggers'][_0x1e9e44['id']])){_0x716c37[_0x5ab4('0x10')][_0x1e9e44['id']]=new Trigger(_0x1e9e44);}else{_0x716c37[_0x5ab4('0x37')](_0x716c37[_0x5ab4('0x10')][_0x1e9e44['id']],_0x1e9e44);}}}return _0x716c37[_0x5ab4('0x10')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x42')]=function(){var _0x339e2c=this;return function(_0x277e5f){if(_0x277e5f){freeIsNotKey(_0x277e5f,_0x339e2c['templates'],'id');for(var _0x10cc02=0x0,_0x18131a={},_0x227626={};_0x10cc02<_0x277e5f[_0x5ab4('0x3d')];_0x10cc02+=0x1){_0x18131a=_0x277e5f[_0x10cc02];if(_[_0x5ab4('0x3b')](_0x339e2c[_0x5ab4('0x11')][_0x18131a['id']])){_0x339e2c[_0x5ab4('0x11')][_0x18131a['id']]=new Template(_0x18131a);}else{_0x339e2c[_0x5ab4('0x37')](_0x339e2c[_0x5ab4('0x11')][_0x18131a['id']],_0x18131a);}}}return _0x339e2c[_0x5ab4('0x11')];};};Realtime['prototype'][_0x5ab4('0x43')]=function(){var _0x20624a=this;return function(_0x2d7c3f){if(_0x2d7c3f){freeIsNotKey(_0x2d7c3f,_0x20624a[_0x5ab4('0x17')],'id');for(var _0x38c247=0x0,_0x55caf8={},_0x2590c5={};_0x38c247<_0x2d7c3f[_0x5ab4('0x3d')];_0x38c247+=0x1){_0x55caf8=_0x2d7c3f[_0x38c247];if(_[_0x5ab4('0x3b')](_0x20624a[_0x5ab4('0x17')][_0x55caf8['id']])){_0x20624a[_0x5ab4('0x17')][_0x55caf8['id']]=new ZendeskAccount(_0x55caf8);}else{_0x20624a[_0x5ab4('0x37')](_0x20624a['zendeskAccounts'][_0x55caf8['id']],_0x55caf8);}}}return _0x20624a[_0x5ab4('0x17')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x44')]=function(){var _0x234b1d=this;return function(_0x370f7f){if(_0x370f7f){freeIsNotKey(_0x370f7f,_0x234b1d[_0x5ab4('0x18')],'id');for(var _0x3998ab=0x0,_0x22758d={},_0x58d1dc={};_0x3998ab<_0x370f7f[_0x5ab4('0x3d')];_0x3998ab+=0x1){_0x22758d=_0x370f7f[_0x3998ab];if(_['isUndefined'](_0x234b1d['salesforceAccounts'][_0x22758d['id']])){_0x234b1d[_0x5ab4('0x18')][_0x22758d['id']]=new SalesforceAccount(_0x22758d);}else{_0x234b1d[_0x5ab4('0x37')](_0x234b1d[_0x5ab4('0x18')][_0x22758d['id']],_0x22758d);}}}return _0x234b1d[_0x5ab4('0x18')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x45')]=function(){var _0x5e58a8=this;return function(_0x5d65b2){if(_0x5d65b2){freeIsNotKey(_0x5d65b2,_0x5e58a8[_0x5ab4('0x1a')],'id');for(var _0x22d3c7=0x0,_0x3d4142={},_0x53887c={};_0x22d3c7<_0x5d65b2['length'];_0x22d3c7+=0x1){_0x3d4142=_0x5d65b2[_0x22d3c7];if(_[_0x5ab4('0x3b')](_0x5e58a8['freshdeskAccounts'][_0x3d4142['id']])){_0x5e58a8[_0x5ab4('0x1a')][_0x3d4142['id']]=new FreshdeskAccount(_0x3d4142);}else{_0x5e58a8[_0x5ab4('0x37')](_0x5e58a8[_0x5ab4('0x1a')][_0x3d4142['id']],_0x3d4142);}}}return _0x5e58a8[_0x5ab4('0x1a')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x46')]=function(){var _0x4aa97e=this;return function(_0xcc129){if(_0xcc129){freeIsNotKey(_0xcc129,_0x4aa97e[_0x5ab4('0x1b')],'id');for(var _0x14c0b9=0x0,_0x14c9d2={},_0x2a01e4={};_0x14c0b9<_0xcc129['length'];_0x14c0b9+=0x1){_0x14c9d2=_0xcc129[_0x14c0b9];if(_[_0x5ab4('0x3b')](_0x4aa97e['zohoAccounts'][_0x14c9d2['id']])){_0x4aa97e[_0x5ab4('0x1b')][_0x14c9d2['id']]=new ZohoAccount(_0x14c9d2);}else{_0x4aa97e[_0x5ab4('0x37')](_0x4aa97e[_0x5ab4('0x1b')][_0x14c9d2['id']],_0x14c9d2);}}}return _0x4aa97e['zohoAccounts'];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x47')]=function(){var _0x2c839c=this;return function(_0x19a63b){if(_0x19a63b){freeIsNotKey(_0x19a63b,_0x2c839c[_0x5ab4('0x48')],'id');for(var _0x57198c=0x0,_0x2ce9b4={},_0x41c796={};_0x57198c<_0x19a63b[_0x5ab4('0x3d')];_0x57198c+=0x1){_0x2ce9b4=_0x19a63b[_0x57198c];if(_['isUndefined'](_0x2c839c['deskAccounts'][_0x2ce9b4['id']])){_0x2c839c['deskAccounts'][_0x2ce9b4['id']]=new DeskAccount(_0x2ce9b4);}else{_0x2c839c[_0x5ab4('0x37')](_0x2c839c[_0x5ab4('0x48')][_0x2ce9b4['id']],_0x2ce9b4);}}}return _0x2c839c['deskAccounts'];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x49')]=function(){var _0x23b151=this;return function(_0x4d0611){if(_0x4d0611){freeIsNotKey(_0x4d0611,_0x23b151[_0x5ab4('0x19')],'id');for(var _0x36f700=0x0,_0x3adb3f={},_0x5a09fe={};_0x36f700<_0x4d0611[_0x5ab4('0x3d')];_0x36f700+=0x1){_0x3adb3f=_0x4d0611[_0x36f700];if(_[_0x5ab4('0x3b')](_0x23b151[_0x5ab4('0x19')][_0x3adb3f['id']])){_0x23b151[_0x5ab4('0x19')][_0x3adb3f['id']]=new SugarcrmAccount(_0x3adb3f);}else{_0x23b151[_0x5ab4('0x37')](_0x23b151[_0x5ab4('0x19')][_0x3adb3f['id']],_0x3adb3f);}}}return _0x23b151[_0x5ab4('0x19')];};};Realtime[_0x5ab4('0x38')]['initVtigerAccounts']=function(){var _0x4a1680=this;return function(_0x5de6da){if(_0x5de6da){freeIsNotKey(_0x5de6da,_0x4a1680[_0x5ab4('0x1c')],'id');for(var _0xafb633=0x0,_0x4523d6={},_0x313469={};_0xafb633<_0x5de6da[_0x5ab4('0x3d')];_0xafb633+=0x1){_0x4523d6=_0x5de6da[_0xafb633];if(_[_0x5ab4('0x3b')](_0x4a1680['vtigerAccounts'][_0x4523d6['id']])){_0x4a1680[_0x5ab4('0x1c')][_0x4523d6['id']]=new VtigerAccount(_0x4523d6);}else{_0x4a1680[_0x5ab4('0x37')](_0x4a1680[_0x5ab4('0x1c')][_0x4523d6['id']],_0x4523d6);}}}return _0x4a1680['vtigerAccounts'];};};Realtime['prototype'][_0x5ab4('0x4a')]=function(){var _0xb97b22=this;return function(_0x20a014){if(_0x20a014){freeIsNotKey(_0x20a014,_0xb97b22['servicenowAccounts'],'id');for(var _0x5a1515=0x0,_0xdf9dc1={},_0x1facea={};_0x5a1515<_0x20a014[_0x5ab4('0x3d')];_0x5a1515+=0x1){_0xdf9dc1=_0x20a014[_0x5a1515];if(_['isUndefined'](_0xb97b22['servicenowAccounts'][_0xdf9dc1['id']])){_0xb97b22[_0x5ab4('0x1d')][_0xdf9dc1['id']]=new ServicenowAccount(_0xdf9dc1);}else{_0xb97b22['mergeFromDatabase'](_0xb97b22[_0x5ab4('0x1d')][_0xdf9dc1['id']],_0xdf9dc1);}}}return _0xb97b22[_0x5ab4('0x1d')];};};Realtime[_0x5ab4('0x38')]['initDynamics365Accounts']=function(){var _0x17ce8e=this;return function(_0x3cf72d){if(_0x3cf72d){freeIsNotKey(_0x3cf72d,_0x17ce8e[_0x5ab4('0x1e')],'id');for(var _0x95d8e2=0x0,_0x1ece9f={},_0x20f668={};_0x95d8e2<_0x3cf72d[_0x5ab4('0x3d')];_0x95d8e2+=0x1){_0x1ece9f=_0x3cf72d[_0x95d8e2];if(_['isUndefined'](_0x17ce8e[_0x5ab4('0x1e')][_0x1ece9f['id']])){_0x17ce8e['dynamics365Accounts'][_0x1ece9f['id']]=new Dynamics365Account(_0x1ece9f);}else{_0x17ce8e[_0x5ab4('0x37')](_0x17ce8e[_0x5ab4('0x1e')][_0x1ece9f['id']],_0x1ece9f);}}}return _0x17ce8e[_0x5ab4('0x1e')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x4b')]=function(){var _0x364320=this;return function(_0x5c8a79){if(_0x5c8a79){freeIsNotKey(_0x5c8a79,_0x364320['freshsalesAccounts'],'id');for(var _0x40f583=0x0,_0x5985ca={},_0x514aca={};_0x40f583<_0x5c8a79[_0x5ab4('0x3d')];_0x40f583+=0x1){_0x5985ca=_0x5c8a79[_0x40f583];if(_[_0x5ab4('0x3b')](_0x364320['freshsalesAccounts'][_0x5985ca['id']])){_0x364320['freshsalesAccounts'][_0x5985ca['id']]=new FreshsalesAccount(_0x5985ca);}else{_0x364320['mergeFromDatabase'](_0x364320['freshsalesAccounts'][_0x5985ca['id']],_0x5985ca);}}}return _0x364320[_0x5ab4('0x1f')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x4c')]=function(){var _0x28c549=this;return function(_0x17fb30){for(var _0xa39369=0x0;_0xa39369<_0x17fb30['length'];_0xa39369+=0x1){_['merge'](_0x28c549['voiceQueues'][_0x17fb30[_0xa39369]['name']],_0x17fb30[_0xa39369]);}return _0x28c549[_0x5ab4('0xf')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x285bd5=this;return function(_0x3d418d){clearVoiceQueues(_0x285bd5['voiceQueues']);if(_0x3d418d){_0x3d418d=_[_0x5ab4('0x4d')](_0x3d418d,'uniqueid');for(var _0x225d29 in _0x3d418d){if(_0x3d418d[_0x5ab4('0x25')](_0x225d29)){var _0x15a2fc={};for(var _0x1e062=0x0;_0x1e062<_0x3d418d[_0x225d29]['length'];_0x1e062+=0x1){var _0x166f2d=_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x4e')];if(_0x285bd5[_0x5ab4('0xf')][_0x166f2d]){if(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x4f')]){_0x285bd5[_0x5ab4('0xf')][_0x166f2d]['unmanaged']+=0x1;}if(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x50')]){_0x285bd5[_0x5ab4('0xf')][_0x166f2d][_0x5ab4('0x2b')]+=0x1;}_0x285bd5[_0x5ab4('0xf')][_0x166f2d][_0x5ab4('0x51')]+=moment(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x52')])[_0x5ab4('0x53')](moment(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x54')]),'seconds')||0x0;if(_0x1e062===_0x3d418d[_0x225d29][_0x5ab4('0x3d')]-0x1){_0x285bd5[_0x5ab4('0xf')][_0x166f2d][_0x5ab4('0x28')]+=moment(_0x3d418d[_0x225d29][_0x1e062]['queuecallercompleteAt']||_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x55')]||_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x56')])[_0x5ab4('0x53')](moment(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x54')]),_0x5ab4('0x57'))||0x0;_0x285bd5[_0x5ab4('0xf')][_0x166f2d]['total']+=0x1;if(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x58')]){_0x285bd5['voiceQueues'][_0x166f2d][_0x5ab4('0x27')]+=0x1;_0x285bd5[_0x5ab4('0xf')][_0x166f2d][_0x5ab4('0x29')]+=moment(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x59')])[_0x5ab4('0x53')](moment(_0x3d418d[_0x225d29][_0x1e062][_0x5ab4('0x52')]),_0x5ab4('0x57'))||0x0;}}else{_0x285bd5[_0x5ab4('0xf')][_0x166f2d][_0x5ab4('0x28')]+=_0x285bd5[_0x5ab4('0xf')][_0x166f2d][_0x5ab4('0x51')]||0x0;}}}}}}return _0x285bd5[_0x5ab4('0xf')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x5a')]=function(){var _0x47e298=this;return function(_0x3a28d2){clearVoiceCallReports(_0x47e298[_0x5ab4('0x12')]);if(_0x3a28d2){for(var _0x53bc71=0x0;_0x53bc71<_0x3a28d2[_0x5ab4('0x3d')];_0x53bc71+=0x1){_0x47e298[_0x5ab4('0x12')][_0x5ab4('0x26')]+=0x1;_0x47e298['outbound'][_0x5ab4('0x28')]+=_0x3a28d2[_0x53bc71][_0x5ab4('0x5b')];if(_0x3a28d2[_0x53bc71][_0x5ab4('0x5c')]==='ANSWERED'){_0x47e298[_0x5ab4('0x12')][_0x5ab4('0x27')]+=0x1;_0x47e298[_0x5ab4('0x12')][_0x5ab4('0x51')]+=_0x3a28d2[_0x53bc71]['duration']-_0x3a28d2[_0x53bc71][_0x5ab4('0x5d')]||0x0;_0x47e298['outbound']['sumBillable']+=_0x3a28d2[_0x53bc71]['billableseconds'];}}}return _0x47e298[_0x5ab4('0x12')];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x5e')]=function(){var _0x541c3d=this;return function(_0x1c63d8){if(_0x1c63d8){freeIsNotKey(_0x1c63d8,_0x541c3d['campaigns'],'name');for(var _0x5de99a=0x0,_0x8f002e={};_0x5de99a<_0x1c63d8[_0x5ab4('0x3d')];_0x5de99a+=0x1){_0x8f002e=_0x1c63d8[_0x5de99a];if(_[_0x5ab4('0x3b')](_0x541c3d[_0x5ab4('0x5f')][_0x8f002e[_0x5ab4('0x24')]])){_0x541c3d['campaigns'][_0x8f002e[_0x5ab4('0x24')]]=new Campaign(_0x8f002e);}else{_0x541c3d[_0x5ab4('0x37')](_0x541c3d['campaigns'][_0x8f002e[_0x5ab4('0x24')]],_0x8f002e);_0x541c3d[_0x5ab4('0x5f')][_0x8f002e[_0x5ab4('0x24')]][_0x5ab4('0x60')]=_0x8f002e[_0x5ab4('0x61')]?_0x8f002e[_0x5ab4('0x61')][_0x5ab4('0x24')]:undefined;}}}return _0x541c3d['campaigns'];};};Realtime[_0x5ab4('0x38')][_0x5ab4('0x62')]=function(){var _0x3600af=this;return function(_0xe04503){if(_0xe04503){freeIsNotKey(_0xe04503,_0x3600af[_0x5ab4('0x13')],'id');for(var _0x2db9d8=0x0,_0x40e4ba={};_0x2db9d8<_0xe04503['length'];_0x2db9d8+=0x1){_0x40e4ba=_0xe04503[_0x2db9d8];if(_[_0x5ab4('0x3b')](_0x3600af[_0x5ab4('0x13')][_0x40e4ba['id']])){_0x3600af['voiceExtensions'][_0x40e4ba['id']]=new VoiceExtension(_0x40e4ba);}else{_0x3600af[_0x5ab4('0x37')](_0x3600af[_0x5ab4('0x13')][_0x40e4ba['id']],_0x40e4ba);}}}return _0x3600af[_0x5ab4('0x13')];};};Realtime[_0x5ab4('0x38')]['initCampaignHopperHistory']=function(){var _0x47e363=this;return function(_0x389a81){clearCampaigns(_0x47e363['campaigns']);for(var _0x450455=0x0;_0x450455<_0x389a81['length'];_0x450455+=0x1){_[_0x5ab4('0x63')](_0x47e363['campaigns'][_0x389a81[_0x450455][_0x5ab4('0x24')]],_0x389a81[_0x450455]);}return _0x47e363[_0x5ab4('0x5f')];};};Realtime[_0x5ab4('0x38')]['initFaxAccounts']=function(){var _0x5e1f13=this;return function(_0x18ff4c){if(_0x18ff4c){freeIsNotKey(_0x18ff4c,_0x5e1f13['faxAccounts'],'id');for(var _0x543e4e=0x0,_0x4b8741={},_0x5dcb3e={};_0x543e4e<_0x18ff4c[_0x5ab4('0x3d')];_0x543e4e+=0x1){_0x4b8741=_0x18ff4c[_0x543e4e];if(_[_0x5ab4('0x3b')](_0x5e1f13[_0x5ab4('0x20')][_0x4b8741['id']])){_0x5e1f13['faxAccounts'][_0x4b8741['id']]=new FaxAccount(_0x4b8741);}else{_0x5e1f13[_0x5ab4('0x37')](_0x5e1f13[_0x5ab4('0x20')][_0x4b8741['id']],_0x4b8741);}}}return _0x5e1f13[_0x5ab4('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9c35441..6ad6f84 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 _0x01d9=['./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','telephones','prototype','sync','realtime','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','ANSWERED','transfers','linkedid','uniqueid','create','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','indexOf','agents','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0x146));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var moment=require(_0x901d('0x1'));var util=require('util');var config=require(_0x901d('0x2'));var ami=require(_0x901d('0x3'));var RpcVoiceAgentReport=require(_0x901d('0x4'));var RpcVoiceCallReport=require(_0x901d('0x5'));var RpcVoiceDialReport=require(_0x901d('0x6'));var RpcMemberReport=require(_0x901d('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x901d('0x8'));var RpcVoiceTransferReport=require(_0x901d('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x901d('0xa'));var VoiceAgentReport=require(_0x901d('0xb'));var VoiceDialReport=require(_0x901d('0xc'));var UserReport=require(_0x901d('0xd'));function Report(_0x450437){this['realtime']=_0x450437;this['agents']=_0x450437['agents'];this[_0x901d('0xe')]=_0x450437[_0x901d('0xe')];}Report[_0x901d('0xf')][_0x901d('0x10')]=function(_0x107322){var _0x3f70c6=new VoiceQueueReport(this[_0x901d('0x11')]);var _0x32abf6=new VoiceAgentReport(this['realtime']);var _0x21262a=new VoiceDialReport(this[_0x901d('0x11')]);var _0x34768e=new VoiceCallReport(this[_0x901d('0x11')]);var _0x47ae80=new UserReport(this[_0x901d('0x11')]);if(config['xdr']&&config[_0x901d('0x12')]['disabled']){ami['on'](_0x901d('0x13'),this['voiceQueueReport'][_0x901d('0x14')](this));ami['on'](_0x901d('0x15'),this[_0x901d('0x16')]['bind'](this));ami['on'](_0x901d('0x17'),this['voiceAgentReport'][_0x901d('0x14')](this));ami['on'](_0x901d('0x18'),this['voiceDialReport'][_0x901d('0x14')](this));ami['on'](_0x901d('0x19'),this[_0x901d('0x1a')]['bind'](this));ami['on'](_0x901d('0x1b'),this[_0x901d('0x1c')]['bind'](this));}};Report[_0x901d('0xf')][_0x901d('0x1d')]=function(_0x465b8f){var _0xd9cdb3;_0xd9cdb3=_[_0x901d('0x1e')](this['agents'],function(_0x5d54ec){return _0x5d54ec[_0x901d('0x1f')]==_0x465b8f||_0x5d54ec[_0x901d('0x20')]==_0x465b8f;});if(_[_0x901d('0x21')](_0xd9cdb3)){var _0x1d669f=_[_0x901d('0x1e')](this[_0x901d('0xe')],function(_0x3b94e4){return _0x3b94e4[_0x901d('0x1f')]==_0x465b8f||_0x3b94e4['name']==_0x465b8f;});if(_0x1d669f){_0xd9cdb3=_['find'](this['agents'],function(_0x3ae114){return _0x3ae114[_0x901d('0x22')]==util[_0x901d('0x23')](_0x901d('0x24'),_0x1d669f['name']);});}}return _0xd9cdb3;};Report[_0x901d('0xf')][_0x901d('0x25')]=function(_0x3532e2){for(var _0x151400=0x0;_0x151400<_0x3532e2[_0x901d('0x26')];_0x151400+=0x1){var _0x48a081=this[_0x901d('0x1d')](_0x3532e2[_0x151400][_0x901d('0x27')]);if(_0x48a081){_0x3532e2[_0x151400][_0x901d('0x1f')]=_0x48a081[_0x901d('0x1f')];_0x3532e2[_0x151400]['assigned']=!![];_0x3532e2[_0x151400][_0x901d('0x28')]=_0x48a081[_0x901d('0x20')];_0x3532e2[_0x151400]['interface']=_['isNil'](_0x48a081[_0x901d('0x22')])?util['format'](_0x901d('0x24'),_0x48a081[_0x901d('0x20')]):_0x48a081[_0x901d('0x22')];if(_0x3532e2[_0x151400][_0x901d('0x29')]){_0x3532e2[_0x151400][_0x901d('0x2a')]=moment()[_0x901d('0x23')](_0x901d('0x2b'));}if(_0x3532e2[_0x151400][_0x901d('0x2c')]){_0x3532e2[_0x151400][_0x901d('0x2d')]=moment()[_0x901d('0x23')](_0x901d('0x2b'));}RpcMemberReport[_0x901d('0x25')](_0x3532e2[_0x151400]);}RpcVoiceQueueReport['create'](_0x3532e2[_0x151400]);}};function extractCalleridNumber(_0x4dc0b8){var _0x830183=_0x4dc0b8[_0x901d('0x2e')](/<(.*?)>/);return _0x830183?_0x830183[0x1]:_0x4dc0b8;}Report['prototype'][_0x901d('0x16')]=function(_0x46cf0f){_0x46cf0f[_0x901d('0x2f')]=_0x46cf0f[_0x901d('0x2f')]||_0x46cf0f[_0x901d('0x30')];if(_0x46cf0f[_0x901d('0x31')]==_0x901d('0x32')){_0x46cf0f[_0x901d('0x33')]='queue';_0x46cf0f['lastdata']=_0x46cf0f[_0x901d('0x34')];if(_0x46cf0f[_0x901d('0x35')]==_0x901d('0x36')){_0x46cf0f['accountcode']='';_0x46cf0f['destination']=extractCalleridNumber(_0x46cf0f['callerid']);}else if(_0x46cf0f[_0x901d('0x35')]=='from-sip'){if(_0x46cf0f[_0x901d('0x2f')]==_0x901d('0x37')){_0x46cf0f[_0x901d('0x2f')]=extractCalleridNumber(_0x46cf0f[_0x901d('0x38')]);_0x46cf0f[_0x901d('0x39')]=_0x46cf0f[_0x901d('0x3a')];_0x46cf0f[_0x901d('0x3b')]=[_0x46cf0f[_0x901d('0x3c')],_0x46cf0f[_0x901d('0x3c')]=_0x46cf0f[_0x901d('0x3b')]][0x0];_0x46cf0f[_0x901d('0x3d')]=_0x46cf0f[_0x901d('0x38')];}else{_0x46cf0f[_0x901d('0x2f')]=_0x46cf0f[_0x901d('0x39')];_0x46cf0f[_0x901d('0x39')]=_0x46cf0f[_0x901d('0x3a')];if(_0x46cf0f['disposition']==_0x901d('0x3e')){_0x46cf0f[_0x901d('0x1f')]=_0x46cf0f[_0x901d('0x27')];}else{_0x46cf0f[_0x901d('0x1f')]='';}}}}else{_0x46cf0f[_0x901d('0x3d')]=util['format']('\x22%s\x22\x20<%s>',_0x46cf0f['calleridname'],_0x46cf0f[_0x901d('0x39')]);}if(RpcVoiceTransferReport[_0x901d('0x3f')][_0x46cf0f[_0x901d('0x40')]]){var _0xf09da9=RpcVoiceTransferReport[_0x901d('0x3f')][_0x46cf0f[_0x901d('0x40')]];_0xf09da9['transfereelinkedid']=_0x46cf0f[_0x901d('0x41')];RpcVoiceTransferReport[_0x901d('0x1a')](_0xf09da9);delete RpcVoiceTransferReport[_0x901d('0x3f')][_0x46cf0f['linkedid']];}RpcVoiceCallReport[_0x901d('0x42')](_0x46cf0f);if(_0x46cf0f['monitor']){for(var _0xdff3c1=0x0;_0xdff3c1<_0x46cf0f[_0x901d('0x43')]['length'];_0xdff3c1+=0x1){_0x46cf0f[_0x901d('0x44')]=_0x46cf0f[_0x901d('0x43')][_0xdff3c1]['filename'];_0x46cf0f[_0x901d('0x45')]=_0x46cf0f[_0x901d('0x43')][_0xdff3c1][_0x901d('0x45')];if(_0x46cf0f[_0x901d('0x30')]==_0x901d('0x37')){_0x46cf0f['calleridnum']=_0x46cf0f[_0x901d('0x27')];_0x46cf0f['calleridname']=_0x46cf0f[_0x901d('0x46')];_0x46cf0f[_0x901d('0x27')]=_0x46cf0f[_0x901d('0x1f')];_0x46cf0f['connectedlinename']=_0x46cf0f[_0x901d('0x47')];_0x46cf0f[_0x901d('0x30')]=_0x46cf0f[_0x901d('0x3a')];}else if(_0x46cf0f[_0x901d('0x30')]==_0x901d('0x48')){_0x46cf0f[_0x901d('0x39')]=_0x46cf0f['destination'];_0x46cf0f[_0x901d('0x30')]=_0x46cf0f[_0x901d('0x3a')];}RpcVoiceRecording[_0x901d('0x42')](_0x46cf0f);}}};Report[_0x901d('0xf')][_0x901d('0x49')]=function(_0x538ed9){if(_[_0x901d('0x4a')](_0x538ed9)){_0x538ed9[_0x901d('0x4b')](function(_0x187de8){RpcVoiceAgentReport['create'](_0x187de8);});}else{RpcVoiceAgentReport[_0x901d('0x42')](_0x538ed9);}};Report[_0x901d('0xf')]['voiceDialReport']=function(_0x4886b0){RpcVoiceDialReport[_0x901d('0x42')](_0x4886b0);var _0x37d88d;var _0x2fcce4;var _0x2bfd6e=_0x4886b0[_0x901d('0x3c')];if(_[_0x901d('0x4c')](_0x2bfd6e,_0x901d('0x4d'))){_0x2fcce4=_0x2bfd6e['substring'](_0x2bfd6e[_0x901d('0x4e')]('/')+0x1,_0x2bfd6e[_0x901d('0x4e')]('@'));_0x37d88d=_['find'](this[_0x901d('0x4f')],function(_0x42462f){return _0x42462f['mobile']==_0x2fcce4||_0x42462f[_0x901d('0x50')]==_0x2fcce4||_0x42462f['accountcode']==_0x2fcce4;});}else{_0x2fcce4=_0x2bfd6e[_0x901d('0x51')](_0x2bfd6e[_0x901d('0x4e')]('/')+0x1,_0x2bfd6e[_0x901d('0x52')]('-'));_0x37d88d=this['findAgent'](_0x2fcce4);}if(_0x37d88d){_0x4886b0[_0x901d('0x22')]=_[_0x901d('0x21')](_0x37d88d[_0x901d('0x22')])?util[_0x901d('0x23')](_0x901d('0x24'),_0x37d88d[_0x901d('0x20')]):_0x37d88d[_0x901d('0x22')];_0x4886b0[_0x901d('0x47')]=_0x37d88d[_0x901d('0x20')];_0x4886b0['accountcode']=_0x37d88d[_0x901d('0x1f')];RpcMemberReport['voiceDialReport'](_0x4886b0);}};Report[_0x901d('0xf')][_0x901d('0x1a')]=function(_0x5d6cfd){RpcVoiceTransferReport[_0x901d('0x3f')][_0x5d6cfd[_0x901d('0x53')]]=_0x5d6cfd;};Report[_0x901d('0xf')][_0x901d('0x1c')]=function(_0x296138){RpcVoiceTransferReport[_0x901d('0x1c')](_0x296138);};module['exports']=Report; \ No newline at end of file +var _0x0379=['monitorFilename','filename','createdAt','exten','connectedlinenum','calleridname','connectedlinename','membername','isArray','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','find','agents','accountcode','name','isNil','interface','format','length','findAgent','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','destination','type','dialer','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','destinationchannel','channel','calleridpreview','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','linkedid','transfereelinkedid','uniqueid','transfers','monitor','monitors'];(function(_0x282238,_0x62834){var _0x57767c=function(_0x5a8387){while(--_0x5a8387){_0x282238['push'](_0x282238['shift']());}};_0x57767c(++_0x62834);}(_0x0379,0xba));var _0x9037=function(_0x55d3fa,_0x1993f3){_0x55d3fa=_0x55d3fa-0x0;var _0x2ec3c5=_0x0379[_0x55d3fa];return _0x2ec3c5;};'use strict';var _=require(_0x9037('0x0'));var moment=require('moment');var util=require(_0x9037('0x1'));var config=require(_0x9037('0x2'));var ami=require(_0x9037('0x3'));var RpcVoiceAgentReport=require(_0x9037('0x4'));var RpcVoiceCallReport=require(_0x9037('0x5'));var RpcVoiceDialReport=require(_0x9037('0x6'));var RpcMemberReport=require(_0x9037('0x7'));var RpcVoiceQueueReport=require(_0x9037('0x8'));var RpcVoiceRecording=require(_0x9037('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x9037('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x9037('0xb'));var VoiceDialReport=require(_0x9037('0xc'));var UserReport=require('./userReport');function Report(_0x35154c){this[_0x9037('0xd')]=_0x35154c;this['agents']=_0x35154c['agents'];this[_0x9037('0xe')]=_0x35154c[_0x9037('0xe')];}Report[_0x9037('0xf')][_0x9037('0x10')]=function(_0x4dc3af){var _0x2cc64f=new VoiceQueueReport(this['realtime']);var _0xcf483a=new VoiceAgentReport(this[_0x9037('0xd')]);var _0x53a984=new VoiceDialReport(this[_0x9037('0xd')]);var _0x244053=new VoiceCallReport(this['realtime']);var _0x51e615=new UserReport(this[_0x9037('0xd')]);if(config[_0x9037('0x11')]&&config[_0x9037('0x11')][_0x9037('0x12')]){ami['on'](_0x9037('0x13'),this[_0x9037('0x14')][_0x9037('0x15')](this));ami['on'](_0x9037('0x16'),this[_0x9037('0x17')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x9037('0x18')][_0x9037('0x15')](this));ami['on'](_0x9037('0x19'),this[_0x9037('0x1a')][_0x9037('0x15')](this));ami['on'](_0x9037('0x1b'),this[_0x9037('0x1c')][_0x9037('0x15')](this));ami['on']('attendedtransfer',this[_0x9037('0x1d')][_0x9037('0x15')](this));}};Report['prototype']['findAgent']=function(_0x4b3c17){var _0x3b2d02;_0x3b2d02=_[_0x9037('0x1e')](this[_0x9037('0x1f')],function(_0xe7e50c){return _0xe7e50c[_0x9037('0x20')]==_0x4b3c17||_0xe7e50c[_0x9037('0x21')]==_0x4b3c17;});if(_[_0x9037('0x22')](_0x3b2d02)){var _0x4b0dd1=_[_0x9037('0x1e')](this['telephones'],function(_0xcc2e0f){return _0xcc2e0f['accountcode']==_0x4b3c17||_0xcc2e0f[_0x9037('0x21')]==_0x4b3c17;});if(_0x4b0dd1){_0x3b2d02=_[_0x9037('0x1e')](this[_0x9037('0x1f')],function(_0x5f369c){return _0x5f369c[_0x9037('0x23')]==util[_0x9037('0x24')]('SIP/%s',_0x4b0dd1[_0x9037('0x21')]);});}}return _0x3b2d02;};Report[_0x9037('0xf')][_0x9037('0x14')]=function(_0x25f2db){for(var _0x3a0050=0x0;_0x3a0050<_0x25f2db[_0x9037('0x25')];_0x3a0050+=0x1){var _0xba6c52=this[_0x9037('0x26')](_0x25f2db[_0x3a0050]['connectedlinenum']);if(_0xba6c52){_0x25f2db[_0x3a0050][_0x9037('0x20')]=_0xba6c52[_0x9037('0x20')];_0x25f2db[_0x3a0050][_0x9037('0x27')]=!![];_0x25f2db[_0x3a0050][_0x9037('0x28')]=_0xba6c52['name'];_0x25f2db[_0x3a0050][_0x9037('0x23')]=_[_0x9037('0x22')](_0xba6c52[_0x9037('0x23')])?util[_0x9037('0x24')](_0x9037('0x29'),_0xba6c52[_0x9037('0x21')]):_0xba6c52[_0x9037('0x23')];if(_0x25f2db[_0x3a0050][_0x9037('0x2a')]){_0x25f2db[_0x3a0050][_0x9037('0x2b')]=moment()[_0x9037('0x24')](_0x9037('0x2c'));}if(_0x25f2db[_0x3a0050]['queuecallerexit']){_0x25f2db[_0x3a0050][_0x9037('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x9037('0x14')](_0x25f2db[_0x3a0050]);}RpcVoiceQueueReport[_0x9037('0x2e')](_0x25f2db[_0x3a0050]);}};function extractCalleridNumber(_0x64ead3){var _0x3518e4=_0x64ead3['match'](/<(.*?)>/);return _0x3518e4?_0x3518e4[0x1]:_0x64ead3;}Report['prototype'][_0x9037('0x17')]=function(_0x46fc6e){_0x46fc6e[_0x9037('0x2f')]=_0x46fc6e['destination']||_0x46fc6e['exten'];if(_0x46fc6e[_0x9037('0x30')]==_0x9037('0x31')){_0x46fc6e['lastapplication']=_0x9037('0x32');_0x46fc6e['lastdata']=_0x46fc6e['queue'];if(_0x46fc6e[_0x9037('0x33')]==_0x9037('0x34')){_0x46fc6e['accountcode']='';_0x46fc6e[_0x9037('0x2f')]=extractCalleridNumber(_0x46fc6e[_0x9037('0x35')]);}else if(_0x46fc6e[_0x9037('0x33')]==_0x9037('0x36')){if(_0x46fc6e[_0x9037('0x2f')]==_0x9037('0x37')){_0x46fc6e[_0x9037('0x2f')]=extractCalleridNumber(_0x46fc6e['calleridpreview']);_0x46fc6e[_0x9037('0x38')]=_0x46fc6e['originatecalleridnum'];_0x46fc6e[_0x9037('0x39')]=[_0x46fc6e[_0x9037('0x3a')],_0x46fc6e['channel']=_0x46fc6e[_0x9037('0x39')]][0x0];_0x46fc6e[_0x9037('0x35')]=_0x46fc6e[_0x9037('0x3b')];}else{_0x46fc6e['destination']=_0x46fc6e[_0x9037('0x38')];_0x46fc6e[_0x9037('0x38')]=_0x46fc6e[_0x9037('0x3c')];if(_0x46fc6e[_0x9037('0x3d')]=='ANSWERED'){_0x46fc6e['accountcode']=_0x46fc6e['connectedlinenum'];}else{_0x46fc6e[_0x9037('0x20')]='';}}}}else{_0x46fc6e['callerid']=util['format'](_0x9037('0x3e'),_0x46fc6e['calleridname'],_0x46fc6e['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x46fc6e[_0x9037('0x3f')]]){var _0x5cc267=RpcVoiceTransferReport['transfers'][_0x46fc6e[_0x9037('0x3f')]];_0x5cc267[_0x9037('0x40')]=_0x46fc6e[_0x9037('0x41')];RpcVoiceTransferReport[_0x9037('0x1c')](_0x5cc267);delete RpcVoiceTransferReport[_0x9037('0x42')][_0x46fc6e[_0x9037('0x3f')]];}RpcVoiceCallReport[_0x9037('0x2e')](_0x46fc6e);if(_0x46fc6e[_0x9037('0x43')]){for(var _0x5e017a=0x0;_0x5e017a<_0x46fc6e[_0x9037('0x44')][_0x9037('0x25')];_0x5e017a+=0x1){_0x46fc6e[_0x9037('0x45')]=_0x46fc6e[_0x9037('0x44')][_0x5e017a][_0x9037('0x46')];_0x46fc6e['createdAt']=_0x46fc6e[_0x9037('0x44')][_0x5e017a][_0x9037('0x47')];if(_0x46fc6e[_0x9037('0x48')]=='xcally-motion-preview'){_0x46fc6e['calleridnum']=_0x46fc6e[_0x9037('0x49')];_0x46fc6e[_0x9037('0x4a')]=_0x46fc6e[_0x9037('0x4b')];_0x46fc6e[_0x9037('0x49')]=_0x46fc6e[_0x9037('0x20')];_0x46fc6e['connectedlinename']=_0x46fc6e[_0x9037('0x4c')];_0x46fc6e[_0x9037('0x48')]=_0x46fc6e[_0x9037('0x3c')];}else if(_0x46fc6e[_0x9037('0x48')]=='xcally-motion-dialer'){_0x46fc6e[_0x9037('0x38')]=_0x46fc6e[_0x9037('0x2f')];_0x46fc6e['exten']=_0x46fc6e[_0x9037('0x3c')];}RpcVoiceRecording[_0x9037('0x2e')](_0x46fc6e);}}};Report[_0x9037('0xf')][_0x9037('0x18')]=function(_0xfddf8c){if(_[_0x9037('0x4d')](_0xfddf8c)){_0xfddf8c['forEach'](function(_0x2d3d23){RpcVoiceAgentReport[_0x9037('0x2e')](_0x2d3d23);});}else{RpcVoiceAgentReport[_0x9037('0x2e')](_0xfddf8c);}};Report[_0x9037('0xf')][_0x9037('0x1a')]=function(_0x46ba97){RpcVoiceDialReport[_0x9037('0x2e')](_0x46ba97);var _0x508938;var _0x4aa0ba;var _0x90abfb=_0x46ba97[_0x9037('0x3a')];if(_['startsWith'](_0x90abfb,'Local')){_0x4aa0ba=_0x90abfb[_0x9037('0x4e')](_0x90abfb['indexOf']('/')+0x1,_0x90abfb[_0x9037('0x4f')]('@'));_0x508938=_['find'](this[_0x9037('0x1f')],function(_0x2fb8f6){return _0x2fb8f6[_0x9037('0x50')]==_0x4aa0ba||_0x2fb8f6[_0x9037('0x51')]==_0x4aa0ba||_0x2fb8f6[_0x9037('0x20')]==_0x4aa0ba;});}else{_0x4aa0ba=_0x90abfb['substring'](_0x90abfb[_0x9037('0x4f')]('/')+0x1,_0x90abfb[_0x9037('0x52')]('-'));_0x508938=this[_0x9037('0x26')](_0x4aa0ba);}if(_0x508938){_0x46ba97[_0x9037('0x23')]=_[_0x9037('0x22')](_0x508938[_0x9037('0x23')])?util[_0x9037('0x24')](_0x9037('0x29'),_0x508938[_0x9037('0x21')]):_0x508938[_0x9037('0x23')];_0x46ba97['membername']=_0x508938[_0x9037('0x21')];_0x46ba97[_0x9037('0x20')]=_0x508938['accountcode'];RpcMemberReport[_0x9037('0x1a')](_0x46ba97);}};Report[_0x9037('0xf')][_0x9037('0x1c')]=function(_0x378092){RpcVoiceTransferReport[_0x9037('0x42')][_0x378092[_0x9037('0x53')]]=_0x378092;};Report[_0x9037('0xf')][_0x9037('0x1d')]=function(_0x3962f3){RpcVoiceTransferReport[_0x9037('0x1d')](_0x3962f3);};module[_0x9037('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index a83e34a..8c11b32 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3c8=['resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','username','state','omit','event','actionid','format','trunk:%s','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','telephone:save','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','name','trunk:save','startsWith','substring','indexOf','find','mobile','phone','accountcode','updateStatusRealtime','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','bind','registry','syncRegistry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xd3c8,0x161));var _0x8d3c=function(_0x241c30,_0x5efbe5){_0x241c30=_0x241c30-0x0;var _0x478e11=_0xd3c8[_0x241c30];return _0x478e11;};'use strict';var _=require(_0x8d3c('0x0'));var moment=require(_0x8d3c('0x1'));var util=require(_0x8d3c('0x2'));var Redis=require(_0x8d3c('0x3'));var BPromise=require(_0x8d3c('0x4'));var config=require('../../../config/environment');var logger=require(_0x8d3c('0x5'))(_0x8d3c('0x6'));var ami=require(_0x8d3c('0x7'));config[_0x8d3c('0x8')]=_['defaults'](config[_0x8d3c('0x8')],{'host':_0x8d3c('0x9'),'port':0x18eb});var io=require(_0x8d3c('0xa'))(new Redis(config[_0x8d3c('0x8')]));function UserReport(_0x87e7bf){this[_0x8d3c('0xb')]=_0x87e7bf[_0x8d3c('0xb')];this[_0x8d3c('0xc')]=_0x87e7bf[_0x8d3c('0xc')];this[_0x8d3c('0xd')]=_0x87e7bf['telephones'];ami['on']('registryentry',this['syncRegistry'][_0x8d3c('0xe')](this));ami['on'](_0x8d3c('0xf'),this[_0x8d3c('0x10')][_0x8d3c('0xe')](this));ami['on'](_0x8d3c('0x11'),this[_0x8d3c('0x12')][_0x8d3c('0xe')](this));ami['on'](_0x8d3c('0x13'),this[_0x8d3c('0x14')][_0x8d3c('0xe')](this));return this[_0x8d3c('0x15')]();}function showSipRegistrations(){Promise[_0x8d3c('0x16')]()[_0x8d3c('0x17')](ami[_0x8d3c('0x18')]())[_0x8d3c('0x19')](function(_0x239286){logger[_0x8d3c('0x1a')](_0x8d3c('0x1b'),util[_0x8d3c('0x1c')](_0x239286,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8d3c('0x16')]()['then'](ami[_0x8d3c('0x1d')]())[_0x8d3c('0x19')](function(_0x16575f){logger[_0x8d3c('0x1a')](_0x8d3c('0x1e'),util[_0x8d3c('0x1c')](_0x16575f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8d3c('0x16')]()[_0x8d3c('0x17')](ami[_0x8d3c('0x1f')]())[_0x8d3c('0x19')](function(_0x17db0f){logger[_0x8d3c('0x1a')]('[userReport][sippeerstatus]',util[_0x8d3c('0x1c')](_0x17db0f,{'showHidden':![],'depth':null}));});}UserReport[_0x8d3c('0x20')][_0x8d3c('0x15')]=function(){setInterval(function(){BPromise[_0x8d3c('0x16')]()[_0x8d3c('0x17')](showSipRegistrations())[_0x8d3c('0x17')](listDeviceStates())[_0x8d3c('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x8d3c('0x21')]=function(_0x3e7825){return _0x3e7825!==null&&!_[_0x8d3c('0x22')](_0x3e7825);};UserReport['prototype'][_0x8d3c('0x23')]=function(_0x7094ff,_0x8b712,_0x706c9a){io['to'](_0x7094ff)[_0x8d3c('0x23')](_0x8b712,_0x706c9a);};UserReport[_0x8d3c('0x20')]['syncRegistry']=function(_0x1b9dc3){try{if(this[_0x8d3c('0x21')](_0x1b9dc3)){logger[_0x8d3c('0x24')](_0x8d3c('0x25'),_0x1b9dc3['username'],_0x1b9dc3['state']);logger[_0x8d3c('0x26')](_0x8d3c('0x27'),util[_0x8d3c('0x1c')](_0x1b9dc3,{'showHidden':![],'depth':null}));var _0x4d4762=_['find'](this[_0x8d3c('0xb')],{'registry':_0x1b9dc3[_0x8d3c('0x28')]});if(_0x4d4762){_0x1b9dc3['stateRegistry']=_0x1b9dc3[_0x8d3c('0x29')];_['merge'](_0x4d4762,_[_0x8d3c('0x2a')](_0x1b9dc3,[_0x8d3c('0x2b'),_0x8d3c('0x2c'),'username',_0x8d3c('0x29')]));logger[_0x8d3c('0x26')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x8d3c('0x1c')](_0x4d4762,{'showHidden':![],'depth':null}));this[_0x8d3c('0x23')](util[_0x8d3c('0x2d')](_0x8d3c('0x2e'),_0x4d4762['name']),'trunk:save',_0x4d4762);}}}catch(_0x7c2920){logger[_0x8d3c('0x1a')](_0x8d3c('0x27'),util[_0x8d3c('0x1c')](_0x7c2920,{'showHidden':![],'depth':null}));}};UserReport[_0x8d3c('0x20')]['syncDeviceState']=function(_0x3b15df){try{if(this[_0x8d3c('0x21')](_0x3b15df)){logger[_0x8d3c('0x24')](_0x8d3c('0x2f'),_0x3b15df[_0x8d3c('0x30')],_0x3b15df[_0x8d3c('0x29')]);logger[_0x8d3c('0x26')](_0x8d3c('0x31'),util['inspect'](_0x3b15df,{'showHidden':![],'depth':null}));if(this['agents'][_0x3b15df[_0x8d3c('0x30')]]){if(!this['agents'][_0x3b15df[_0x8d3c('0x30')]][_0x8d3c('0x32')]||_0x3b15df[_0x8d3c('0x29')][_0x8d3c('0x33')]()==_0x8d3c('0x34')){this[_0x8d3c('0xc')][_0x3b15df['device']]['local']=![];if(this[_0x8d3c('0xc')][_0x3b15df['device']][_0x8d3c('0x29')]!==_0x3b15df[_0x8d3c('0x29')][_0x8d3c('0x33')]()){this['agents'][_0x3b15df[_0x8d3c('0x30')]]['stateTime']=_[_0x8d3c('0x35')](moment()[_0x8d3c('0x2d')]('x'));}this[_0x8d3c('0xc')][_0x3b15df['device']][_0x8d3c('0x29')]=_0x3b15df[_0x8d3c('0x29')][_0x8d3c('0x33')]();this[_0x8d3c('0xc')][_0x3b15df['device']]['updateStatusRealtime'](_0x3b15df);}}else if(this[_0x8d3c('0xd')][_0x3b15df[_0x8d3c('0x30')]]){if(this[_0x8d3c('0xd')][_0x3b15df[_0x8d3c('0x30')]]['state']!==_0x3b15df[_0x8d3c('0x29')]['toLowerCase']()){this[_0x8d3c('0xd')][_0x3b15df['device']]['stateTime']=_[_0x8d3c('0x35')](moment()['format']('x'));}this[_0x8d3c('0xd')][_0x3b15df[_0x8d3c('0x30')]][_0x8d3c('0x29')]=_0x3b15df[_0x8d3c('0x29')][_0x8d3c('0x33')]();logger[_0x8d3c('0x26')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x8d3c('0x1c')](this['telephones'][_0x3b15df['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x8d3c('0x2d')]('telephone:%s',this['telephones'][_0x3b15df[_0x8d3c('0x30')]]['name']),_0x8d3c('0x36'),this['telephones'][_0x3b15df[_0x8d3c('0x30')]]);}else if(this[_0x8d3c('0xb')][_0x3b15df['device']]){if(this[_0x8d3c('0xb')][_0x3b15df[_0x8d3c('0x30')]][_0x8d3c('0x29')]!==_0x3b15df['state'][_0x8d3c('0x33')]()){this[_0x8d3c('0xb')][_0x3b15df['device']][_0x8d3c('0x37')]=_['toNumber'](moment()['format']('x'));}this[_0x8d3c('0xb')][_0x3b15df[_0x8d3c('0x30')]][_0x8d3c('0x29')]=_0x3b15df[_0x8d3c('0x29')]['toLowerCase']();logger[_0x8d3c('0x26')](_0x8d3c('0x38'),util[_0x8d3c('0x1c')](this['trunks'][_0x3b15df[_0x8d3c('0x30')]],{'showHidden':![],'depth':null}));this[_0x8d3c('0x23')](util[_0x8d3c('0x2d')](_0x8d3c('0x2e'),this[_0x8d3c('0xb')][_0x3b15df[_0x8d3c('0x30')]][_0x8d3c('0x39')]),_0x8d3c('0x3a'),this[_0x8d3c('0xb')][_0x3b15df[_0x8d3c('0x30')]]);}else if(_[_0x8d3c('0x3b')](_0x3b15df['device'],'Local')){var _0x2d4413=_0x3b15df['device'];var _0x47d353=_0x2d4413[_0x8d3c('0x3c')](_0x2d4413[_0x8d3c('0x3d')]('/')+0x1,_0x2d4413['indexOf']('@'));var _0x2f5b66=_[_0x8d3c('0x3e')](this[_0x8d3c('0xc')],function(_0x281417){return _0x281417[_0x8d3c('0x3f')]==_0x47d353||_0x281417[_0x8d3c('0x40')]==_0x47d353||_0x281417[_0x8d3c('0x41')]==_0x47d353;});if(_0x2f5b66){if(_0x2f5b66[_0x8d3c('0x29')]!==_0x3b15df['state'][_0x8d3c('0x33')]()){_0x2f5b66[_0x8d3c('0x37')]=_[_0x8d3c('0x35')](moment()[_0x8d3c('0x2d')]('x'));}_0x2f5b66[_0x8d3c('0x29')]=_0x3b15df[_0x8d3c('0x29')]['toLowerCase']();_0x2f5b66[_0x8d3c('0x32')]=!![];_0x2f5b66[_0x8d3c('0x42')](_0x3b15df);}}}}catch(_0x30e03f){logger[_0x8d3c('0x1a')](_0x8d3c('0x31'),util['inspect'](_0x30e03f,{'showHidden':![],'depth':null}));}};UserReport[_0x8d3c('0x20')][_0x8d3c('0x14')]=function(_0x4aff84){try{if(this[_0x8d3c('0x21')](_0x4aff84)&&this[_0x8d3c('0x21')](_0x4aff84[_0x8d3c('0x13')])){logger[_0x8d3c('0x24')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4aff84[_0x8d3c('0x43')],_0x4aff84[_0x8d3c('0x44')],_0x4aff84[_0x8d3c('0x13')]);logger[_0x8d3c('0x26')](_0x8d3c('0x45'),util[_0x8d3c('0x1c')](_0x4aff84,{'showHidden':![],'depth':null}));if(this['agents'][_0x4aff84[_0x8d3c('0x43')]]){if(!this[_0x8d3c('0xc')][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x32')]||_0x4aff84[_0x8d3c('0x13')]['toLowerCase']()==_0x8d3c('0x46')){this['agents'][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x32')]=![];this[_0x8d3c('0xc')][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x47')]=_0x4aff84[_0x8d3c('0x13')][_0x8d3c('0x33')]();this['agents'][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x44')]=_0x4aff84[_0x8d3c('0x44')];this[_0x8d3c('0xc')][_0x4aff84['peer']][_0x8d3c('0x42')](_0x4aff84);}}else if(this[_0x8d3c('0xd')][_0x4aff84[_0x8d3c('0x43')]]){this['telephones'][_0x4aff84['peer']][_0x8d3c('0x47')]=_0x4aff84['peerstatus'][_0x8d3c('0x33')]();this['telephones'][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x44')]=_0x4aff84[_0x8d3c('0x44')];logger[_0x8d3c('0x26')](_0x8d3c('0x48'),util['inspect'](this[_0x8d3c('0xd')][_0x4aff84[_0x8d3c('0x43')]],{'showHidden':![],'depth':null}));this[_0x8d3c('0x23')](util['format'](_0x8d3c('0x49'),this[_0x8d3c('0xd')][_0x4aff84[_0x8d3c('0x43')]]['name']),'telephone:save',this[_0x8d3c('0xd')][_0x4aff84[_0x8d3c('0x43')]]);}else if(this[_0x8d3c('0xb')][_0x4aff84[_0x8d3c('0x43')]]){this['trunks'][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x47')]=_0x4aff84['peerstatus'][_0x8d3c('0x33')]();this[_0x8d3c('0xb')][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x44')]=_0x4aff84[_0x8d3c('0x44')];logger[_0x8d3c('0x26')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x8d3c('0x1c')](this[_0x8d3c('0xb')][_0x4aff84[_0x8d3c('0x43')]],{'showHidden':![],'depth':null}));this[_0x8d3c('0x23')](util[_0x8d3c('0x2d')](_0x8d3c('0x2e'),this[_0x8d3c('0xb')][_0x4aff84[_0x8d3c('0x43')]][_0x8d3c('0x39')]),_0x8d3c('0x3a'),this['trunks'][_0x4aff84[_0x8d3c('0x43')]]);}}}catch(_0x5e1427){logger[_0x8d3c('0x1a')](_0x8d3c('0x45'),util[_0x8d3c('0x1c')](_0x5e1427,{'showHidden':![],'depth':null}));}};module[_0x8d3c('0x4a')]=UserReport; \ No newline at end of file +var _0x4128=['actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','stateRegistry','omit','event','state','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','phone','accountcode','syncPeerStatus','peerstatus','peer','[userReport][peerstatus]','registered','address','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','defaults','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]'];(function(_0x5a461e,_0xe83e49){var _0x1fac23=function(_0x32517a){while(--_0x32517a){_0x5a461e['push'](_0x5a461e['shift']());}};_0x1fac23(++_0xe83e49);}(_0x4128,0x1a5));var _0x8412=function(_0x1a21af,_0x50c69a){_0x1a21af=_0x1a21af-0x0;var _0x32e826=_0x4128[_0x1a21af];return _0x32e826;};'use strict';var _=require(_0x8412('0x0'));var moment=require(_0x8412('0x1'));var util=require(_0x8412('0x2'));var Redis=require(_0x8412('0x3'));var BPromise=require(_0x8412('0x4'));var config=require(_0x8412('0x5'));var logger=require(_0x8412('0x6'))('ami');var ami=require(_0x8412('0x7'));config['redis']=_[_0x8412('0x8')](config[_0x8412('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x8412('0xa'))(new Redis(config['redis']));function UserReport(_0x49b9bb){this[_0x8412('0xb')]=_0x49b9bb[_0x8412('0xb')];this[_0x8412('0xc')]=_0x49b9bb[_0x8412('0xc')];this['telephones']=_0x49b9bb[_0x8412('0xd')];ami['on'](_0x8412('0xe'),this[_0x8412('0xf')][_0x8412('0x10')](this));ami['on'](_0x8412('0x11'),this['syncRegistry'][_0x8412('0x10')](this));ami['on'](_0x8412('0x12'),this[_0x8412('0x13')][_0x8412('0x10')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x8412('0x10')](this));return this[_0x8412('0x14')]();}function showSipRegistrations(){Promise[_0x8412('0x15')]()[_0x8412('0x16')](ami['actionSipShowRegistry']())[_0x8412('0x17')](function(_0x4b6a0c){logger[_0x8412('0x18')](_0x8412('0x19'),util[_0x8412('0x1a')](_0x4b6a0c,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x8412('0x1b')]())[_0x8412('0x17')](function(_0x3e7f93){logger['error'](_0x8412('0x1c'),util[_0x8412('0x1a')](_0x3e7f93,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8412('0x15')]()[_0x8412('0x16')](ami[_0x8412('0x1d')]())['catch'](function(_0x409c6a){logger['error'](_0x8412('0x1e'),util[_0x8412('0x1a')](_0x409c6a,{'showHidden':![],'depth':null}));});}UserReport[_0x8412('0x1f')][_0x8412('0x14')]=function(){setInterval(function(){BPromise[_0x8412('0x15')]()[_0x8412('0x16')](showSipRegistrations())[_0x8412('0x16')](listDeviceStates())[_0x8412('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x8412('0x1f')][_0x8412('0x20')]=function(_0x55f69f){return _0x55f69f!==null&&!_['isUndefined'](_0x55f69f);};UserReport[_0x8412('0x1f')][_0x8412('0x21')]=function(_0x5ef4f8,_0x505da3,_0x5d030f){io['to'](_0x5ef4f8)[_0x8412('0x21')](_0x505da3,_0x5d030f);};UserReport['prototype'][_0x8412('0xf')]=function(_0x3a6adb){try{if(this['isNotNull'](_0x3a6adb)){logger[_0x8412('0x22')](_0x8412('0x23'),_0x3a6adb[_0x8412('0x24')],_0x3a6adb['state']);logger['debug'](_0x8412('0x25'),util[_0x8412('0x1a')](_0x3a6adb,{'showHidden':![],'depth':null}));var _0xadc75b=_[_0x8412('0x26')](this['trunks'],{'registry':_0x3a6adb[_0x8412('0x24')]});if(_0xadc75b){_0x3a6adb[_0x8412('0x27')]=_0x3a6adb['state'];_['merge'](_0xadc75b,_[_0x8412('0x28')](_0x3a6adb,[_0x8412('0x29'),'actionid','username',_0x8412('0x2a')]));logger[_0x8412('0x2b')](_0x8412('0x2c'),util[_0x8412('0x1a')](_0xadc75b,{'showHidden':![],'depth':null}));this[_0x8412('0x21')](util[_0x8412('0x2d')](_0x8412('0x2e'),_0xadc75b[_0x8412('0x2f')]),'trunk:save',_0xadc75b);}}}catch(_0x3159ce){logger['error'](_0x8412('0x25'),util[_0x8412('0x1a')](_0x3159ce,{'showHidden':![],'depth':null}));}};UserReport[_0x8412('0x1f')][_0x8412('0x13')]=function(_0x1437dc){try{if(this[_0x8412('0x20')](_0x1437dc)){logger[_0x8412('0x22')](_0x8412('0x30'),_0x1437dc[_0x8412('0x31')],_0x1437dc[_0x8412('0x2a')]);logger[_0x8412('0x2b')](_0x8412('0x32'),util[_0x8412('0x1a')](_0x1437dc,{'showHidden':![],'depth':null}));if(this[_0x8412('0xc')][_0x1437dc[_0x8412('0x31')]]){if(!this[_0x8412('0xc')][_0x1437dc['device']][_0x8412('0x33')]||_0x1437dc['state'][_0x8412('0x34')]()==_0x8412('0x35')){this['agents'][_0x1437dc[_0x8412('0x31')]][_0x8412('0x33')]=![];if(this['agents'][_0x1437dc['device']][_0x8412('0x2a')]!==_0x1437dc[_0x8412('0x2a')][_0x8412('0x34')]()){this[_0x8412('0xc')][_0x1437dc['device']][_0x8412('0x36')]=_['toNumber'](moment()[_0x8412('0x2d')]('x'));}this['agents'][_0x1437dc['device']][_0x8412('0x2a')]=_0x1437dc['state'][_0x8412('0x34')]();this[_0x8412('0xc')][_0x1437dc[_0x8412('0x31')]][_0x8412('0x37')](_0x1437dc);}}else if(this['telephones'][_0x1437dc[_0x8412('0x31')]]){if(this[_0x8412('0xd')][_0x1437dc[_0x8412('0x31')]][_0x8412('0x2a')]!==_0x1437dc['state']['toLowerCase']()){this[_0x8412('0xd')][_0x1437dc[_0x8412('0x31')]][_0x8412('0x36')]=_[_0x8412('0x38')](moment()[_0x8412('0x2d')]('x'));}this['telephones'][_0x1437dc[_0x8412('0x31')]][_0x8412('0x2a')]=_0x1437dc[_0x8412('0x2a')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x8412('0xd')][_0x1437dc[_0x8412('0x31')]],{'showHidden':![],'depth':null}));this[_0x8412('0x21')](util[_0x8412('0x2d')](_0x8412('0x39'),this[_0x8412('0xd')][_0x1437dc['device']]['name']),_0x8412('0x3a'),this[_0x8412('0xd')][_0x1437dc[_0x8412('0x31')]]);}else if(this[_0x8412('0xb')][_0x1437dc[_0x8412('0x31')]]){if(this[_0x8412('0xb')][_0x1437dc[_0x8412('0x31')]][_0x8412('0x2a')]!==_0x1437dc['state'][_0x8412('0x34')]()){this[_0x8412('0xb')][_0x1437dc[_0x8412('0x31')]][_0x8412('0x36')]=_[_0x8412('0x38')](moment()['format']('x'));}this[_0x8412('0xb')][_0x1437dc['device']][_0x8412('0x2a')]=_0x1437dc[_0x8412('0x2a')][_0x8412('0x34')]();logger[_0x8412('0x2b')](_0x8412('0x3b'),util[_0x8412('0x1a')](this['trunks'][_0x1437dc[_0x8412('0x31')]],{'showHidden':![],'depth':null}));this[_0x8412('0x21')](util[_0x8412('0x2d')](_0x8412('0x2e'),this[_0x8412('0xb')][_0x1437dc[_0x8412('0x31')]][_0x8412('0x2f')]),'trunk:save',this[_0x8412('0xb')][_0x1437dc[_0x8412('0x31')]]);}else if(_[_0x8412('0x3c')](_0x1437dc[_0x8412('0x31')],_0x8412('0x3d'))){var _0x5375c4=_0x1437dc[_0x8412('0x31')];var _0xd65e6f=_0x5375c4[_0x8412('0x3e')](_0x5375c4[_0x8412('0x3f')]('/')+0x1,_0x5375c4[_0x8412('0x3f')]('@'));var _0x209594=_['find'](this[_0x8412('0xc')],function(_0x49262b){return _0x49262b['mobile']==_0xd65e6f||_0x49262b[_0x8412('0x40')]==_0xd65e6f||_0x49262b[_0x8412('0x41')]==_0xd65e6f;});if(_0x209594){if(_0x209594[_0x8412('0x2a')]!==_0x1437dc[_0x8412('0x2a')][_0x8412('0x34')]()){_0x209594[_0x8412('0x36')]=_[_0x8412('0x38')](moment()[_0x8412('0x2d')]('x'));}_0x209594[_0x8412('0x2a')]=_0x1437dc[_0x8412('0x2a')]['toLowerCase']();_0x209594['local']=!![];_0x209594[_0x8412('0x37')](_0x1437dc);}}}}catch(_0x5be7c3){logger[_0x8412('0x18')](_0x8412('0x32'),util[_0x8412('0x1a')](_0x5be7c3,{'showHidden':![],'depth':null}));}};UserReport[_0x8412('0x1f')][_0x8412('0x42')]=function(_0x2ad997){try{if(this['isNotNull'](_0x2ad997)&&this[_0x8412('0x20')](_0x2ad997[_0x8412('0x43')])){logger[_0x8412('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x2ad997[_0x8412('0x44')],_0x2ad997['address'],_0x2ad997[_0x8412('0x43')]);logger[_0x8412('0x2b')](_0x8412('0x45'),util[_0x8412('0x1a')](_0x2ad997,{'showHidden':![],'depth':null}));if(this[_0x8412('0xc')][_0x2ad997[_0x8412('0x44')]]){if(!this[_0x8412('0xc')][_0x2ad997[_0x8412('0x44')]][_0x8412('0x33')]||_0x2ad997['peerstatus']['toLowerCase']()==_0x8412('0x46')){this[_0x8412('0xc')][_0x2ad997['peer']]['local']=![];this[_0x8412('0xc')][_0x2ad997[_0x8412('0x44')]]['status']=_0x2ad997[_0x8412('0x43')][_0x8412('0x34')]();this[_0x8412('0xc')][_0x2ad997[_0x8412('0x44')]][_0x8412('0x47')]=_0x2ad997['address'];this[_0x8412('0xc')][_0x2ad997[_0x8412('0x44')]]['updateStatusRealtime'](_0x2ad997);}}else if(this['telephones'][_0x2ad997[_0x8412('0x44')]]){this[_0x8412('0xd')][_0x2ad997[_0x8412('0x44')]]['status']=_0x2ad997[_0x8412('0x43')][_0x8412('0x34')]();this[_0x8412('0xd')][_0x2ad997[_0x8412('0x44')]]['address']=_0x2ad997['address'];logger[_0x8412('0x2b')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x8412('0xd')][_0x2ad997['peer']],{'showHidden':![],'depth':null}));this[_0x8412('0x21')](util['format']('telephone:%s',this[_0x8412('0xd')][_0x2ad997['peer']][_0x8412('0x2f')]),_0x8412('0x3a'),this['telephones'][_0x2ad997[_0x8412('0x44')]]);}else if(this[_0x8412('0xb')][_0x2ad997[_0x8412('0x44')]]){this[_0x8412('0xb')][_0x2ad997[_0x8412('0x44')]][_0x8412('0x48')]=_0x2ad997[_0x8412('0x43')]['toLowerCase']();this['trunks'][_0x2ad997['peer']][_0x8412('0x47')]=_0x2ad997['address'];logger[_0x8412('0x2b')](_0x8412('0x49'),util['inspect'](this['trunks'][_0x2ad997[_0x8412('0x44')]],{'showHidden':![],'depth':null}));this[_0x8412('0x21')](util[_0x8412('0x2d')](_0x8412('0x2e'),this[_0x8412('0xb')][_0x2ad997[_0x8412('0x44')]][_0x8412('0x2f')]),_0x8412('0x4a'),this[_0x8412('0xb')][_0x2ad997[_0x8412('0x44')]]);}}}catch(_0x2a3d66){logger[_0x8412('0x18')](_0x8412('0x45'),util['inspect'](_0x2a3d66,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index de06157..d59ba56 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0491=['lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','bind','syncAgentConnect','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','syncAgentCalled','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','isUndefined','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','omit','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel'];(function(_0x440170,_0x37f10d){var _0x57ad89=function(_0x34a4cd){while(--_0x34a4cd){_0x440170['push'](_0x440170['shift']());}};_0x57ad89(++_0x37f10d);}(_0x0491,0xa3));var _0x1049=function(_0x564a24,_0x51212d){_0x564a24=_0x564a24-0x0;var _0x1f1cc0=_0x0491[_0x564a24];return _0x1f1cc0;};'use strict';var _=require('lodash');var moment=require(_0x1049('0x0'));var util=require(_0x1049('0x1'));var Redis=require(_0x1049('0x2'));var config=require(_0x1049('0x3'));var logger=require(_0x1049('0x4'))(_0x1049('0x5'));var ami=require(_0x1049('0x6'));config[_0x1049('0x7')]=_[_0x1049('0x8')](config[_0x1049('0x7')],{'host':_0x1049('0x9'),'port':0x18eb});var io=require(_0x1049('0xa'))(new Redis(config[_0x1049('0x7')]));function VoiceAgentReport(_0xad7a48){this[_0x1049('0xb')]={};this[_0x1049('0xc')]=_0xad7a48['voiceQueues'];this[_0x1049('0xd')]=_0xad7a48[_0x1049('0xd')];this[_0x1049('0xe')]={};ami['on'](_0x1049('0xf'),this['syncAgentCalled'][_0x1049('0x10')](this));ami['on']('agentconnect',this[_0x1049('0x11')][_0x1049('0x10')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x1049('0x10')](this));ami['on'](_0x1049('0x12'),this['syncQueueCallerAbandon'][_0x1049('0x10')](this));ami['on'](_0x1049('0x13'),this[_0x1049('0x14')][_0x1049('0x10')](this));ami['on'](_0x1049('0x15'),this[_0x1049('0x16')][_0x1049('0x10')](this));ami['on']('hangup',this[_0x1049('0x17')][_0x1049('0x10')](this));ami['on'](_0x1049('0x18'),this[_0x1049('0x19')][_0x1049('0x10')](this));ami['on'](_0x1049('0x1a'),this[_0x1049('0x1b')][_0x1049('0x10')](this));ami['on'](_0x1049('0x1c'),this[_0x1049('0x1d')][_0x1049('0x10')](this));ami['on'](_0x1049('0x1e'),this[_0x1049('0x1f')][_0x1049('0x10')](this));}VoiceAgentReport[_0x1049('0x20')][_0x1049('0x21')]=function(_0x1a84a0,_0x1d3505,_0x477dad){io['to'](_0x1a84a0)[_0x1049('0x21')](_0x1d3505,_0x477dad);};VoiceAgentReport[_0x1049('0x20')]['isNotNull']=function(_0x3a2030){return _0x3a2030!==null&&!_['isUndefined'](_0x3a2030);};VoiceAgentReport['prototype'][_0x1049('0x22')]=function(_0x46b6b1){try{if(this[_0x1049('0x23')](_0x46b6b1)){logger[_0x1049('0x24')](_0x1049('0x25'),_0x46b6b1[_0x1049('0x26')],_0x46b6b1[_0x1049('0x27')],_0x46b6b1[_0x1049('0x28')]);logger[_0x1049('0x29')](_0x1049('0x2a'),_0x46b6b1['uniqueid'],util['inspect'](_0x46b6b1,{'showHidden':![],'depth':null}));if(_[_0x1049('0x2b')](this[_0x1049('0xb')][_0x46b6b1[_0x1049('0x26')]])){this['channels'][_0x46b6b1[_0x1049('0x26')]]={};}if(_[_0x1049('0x2b')](this[_0x1049('0xb')][_0x46b6b1[_0x1049('0x26')]][_0x46b6b1[_0x1049('0x28')]])){this['channels'][_0x46b6b1[_0x1049('0x26')]][_0x46b6b1[_0x1049('0x28')]]={'agentcalledAt':moment()['format'](_0x1049('0x2c')),'lastevent':_0x1049('0x2d'),'mandatoryDisposition':this[_0x1049('0xc')][_0x46b6b1['queue']]?this[_0x1049('0xc')][_0x46b6b1[_0x1049('0x2e')]][_0x1049('0x2f')]||![]:![],'type':this[_0x1049('0xc')][_0x46b6b1['queue']]?this[_0x1049('0xc')][_0x46b6b1['queue']][_0x1049('0x30')]||_0x1049('0x31'):_0x1049('0x31'),'variables':this['variables'][_0x46b6b1[_0x1049('0x26')]]};}_[_0x1049('0x32')](this['channels'][_0x46b6b1[_0x1049('0x26')]][_0x46b6b1[_0x1049('0x28')]],_['omit'](_0x46b6b1,[_0x1049('0x33'),'privilege']));logger['debug'](_0x1049('0x34'),_0x46b6b1[_0x1049('0x26')],util[_0x1049('0x35')](this[_0x1049('0xb')][_0x46b6b1[_0x1049('0x26')]][_0x46b6b1['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x1049('0x21')](_0x1049('0x36'),this[_0x1049('0xb')][_0x46b6b1[_0x1049('0x26')]][_0x46b6b1['destuniqueid']]);logger[_0x1049('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x46b6b1[_0x1049('0x26')],util[_0x1049('0x35')](this[_0x1049('0xb')][_0x46b6b1['uniqueid']][_0x46b6b1[_0x1049('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1049('0x37')](_0x1049('0x38'),_0x46b6b1[_0x1049('0x27')]),_0x1049('0x39'),this['channels'][_0x46b6b1[_0x1049('0x26')]][_0x46b6b1[_0x1049('0x28')]]);}}catch(_0x414794){logger['error'](_0x1049('0x3a'),_0x46b6b1[_0x1049('0x26')],util[_0x1049('0x35')](_0x414794,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1049('0x11')]=function(_0x26c2a2){try{if(this[_0x1049('0x23')](_0x26c2a2)){if(this['channels'][_0x26c2a2['uniqueid']]){logger[_0x1049('0x29')](_0x1049('0x3b'),_0x26c2a2[_0x1049('0x26')],util[_0x1049('0x35')](_0x26c2a2,{'showHidden':![],'depth':null}));for(var _0x5af617 in this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]]){if(this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x1049('0x3c')](_0x5af617)){if(_0x26c2a2[_0x1049('0x28')]===_0x5af617){logger[_0x1049('0x24')](_0x1049('0x3d'),_0x26c2a2[_0x1049('0x26')],_0x26c2a2['membername'],_0x26c2a2[_0x1049('0x28')]);this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x3e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x3f')]=_0x26c2a2[_0x1049('0x3f')];this['channels'][_0x26c2a2['uniqueid']][_0x5af617][_0x1049('0x40')]=_0x26c2a2['connectedlinenum'];this[_0x1049('0xb')][_0x26c2a2['uniqueid']][_0x5af617][_0x1049('0x41')]=_0x26c2a2['destchannelstate'];this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x42')]=_0x26c2a2['destchannelstatedesc'];this[_0x1049('0xb')][_0x26c2a2['uniqueid']][_0x5af617][_0x1049('0x43')]=_0x26c2a2[_0x1049('0x43')];this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x5af617]['lastevent']='connect';_['merge'](this[_0x1049('0xd')][_0x26c2a2[_0x1049('0x44')]],_[_0x1049('0x45')](_0x26c2a2,['queue','destconnectedlinenum']));logger[_0x1049('0x29')](_0x1049('0x46'),_0x26c2a2[_0x1049('0x26')],util['inspect'](this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x26c2a2[_0x1049('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1049('0x47'),this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x26c2a2['destuniqueid']]);logger[_0x1049('0x29')](_0x1049('0x48'),_0x26c2a2[_0x1049('0x26')],util[_0x1049('0x35')](this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x26c2a2[_0x1049('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1049('0x37')](_0x1049('0x38'),_0x26c2a2[_0x1049('0x27')]),'user:agentconnect',this['channels'][_0x26c2a2['uniqueid']][_0x26c2a2[_0x1049('0x28')]]);}else if(!this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617]['agentringnoanswer']&&!this[_0x1049('0xb')][_0x26c2a2['uniqueid']][_0x5af617][_0x1049('0x13')]){logger[_0x1049('0x24')](_0x1049('0x49'),_0x26c2a2[_0x1049('0x26')],this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x27')],_0x5af617);this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x4a')]=!![];this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x4b')]=moment()['format'](_0x1049('0x2c'));this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x4c')]=_0x26c2a2['destuniqueid'];this['channels'][_0x26c2a2['uniqueid']][_0x5af617][_0x1049('0x4d')]=_0x26c2a2[_0x1049('0x27')];this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x4e')]='answered_elsewhere';this['channels'][_0x26c2a2[_0x1049('0x26')]][_0x5af617][_0x1049('0x4f')]=_0x1049('0x50');logger[_0x1049('0x29')](_0x1049('0x51'),_0x26c2a2[_0x1049('0x26')],util['inspect'](this['channels'][_0x26c2a2['uniqueid']][_0x5af617],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this[_0x1049('0xb')][_0x26c2a2[_0x1049('0x26')]][_0x5af617]);}}}}}}catch(_0x2e91bb){logger['error'](_0x1049('0x52'),_0x26c2a2[_0x1049('0x26')],util[_0x1049('0x35')](_0x2e91bb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1049('0x53')]=function(_0x5ecf12){try{if(this['isNotNull'](_0x5ecf12)){logger[_0x1049('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5ecf12[_0x1049('0x26')],util[_0x1049('0x35')](_0x5ecf12,{'showHidden':![],'depth':null}));if(this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]]&&this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]]){logger[_0x1049('0x24')](_0x1049('0x54'),_0x5ecf12[_0x1049('0x26')],_0x5ecf12[_0x1049('0x27')],_0x5ecf12[_0x1049('0x28')]);this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]][_0x1049('0x4a')]=!![];this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]][_0x1049('0x4b')]=moment()[_0x1049('0x37')](_0x1049('0x2c'));this['channels'][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]][_0x1049('0x4e')]='rejected';this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]]['reason']=_0x1049('0x55');logger[_0x1049('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5ecf12[_0x1049('0x26')],util[_0x1049('0x35')](this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1049('0x21')](_0x1049('0x56'),this[_0x1049('0xb')][_0x5ecf12[_0x1049('0x26')]][_0x5ecf12[_0x1049('0x28')]]);}}}catch(_0x387b2a){logger[_0x1049('0x57')](_0x1049('0x58'),_0x5ecf12[_0x1049('0x26')],util[_0x1049('0x35')](_0x387b2a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1049('0x20')][_0x1049('0x59')]=function(_0x12fc91){try{if(this[_0x1049('0x23')](_0x12fc91)){logger[_0x1049('0x29')](_0x1049('0x5a'),_0x12fc91[_0x1049('0x26')],util[_0x1049('0x35')](_0x12fc91,{'showHidden':![],'depth':null}));if(this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]]){for(var _0x11427f in this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]]){if(this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x1049('0x3c')](_0x11427f)&&!this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f][_0x1049('0x4a')]&&!this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f][_0x1049('0x13')]){logger['info'](_0x1049('0x5b'),_0x12fc91[_0x1049('0x26')],this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f]['membername'],_0x11427f);this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f][_0x1049('0x4a')]=!![];this[_0x1049('0xb')][_0x12fc91['uniqueid']][_0x11427f][_0x1049('0x4b')]=moment()['format'](_0x1049('0x2c'));this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f][_0x1049('0x4e')]='abandoned';this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f]['reason']=_0x1049('0x5c');logger[_0x1049('0x29')](_0x1049('0x5d'),_0x12fc91[_0x1049('0x26')],util[_0x1049('0x35')](this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f],{'showHidden':![],'depth':null}));ami[_0x1049('0x21')]('custom:agentqueuecallerabandon',this[_0x1049('0xb')][_0x12fc91[_0x1049('0x26')]][_0x11427f]);}}}}}catch(_0x2f02e4){logger[_0x1049('0x57')](_0x1049('0x5e'),_0x12fc91[_0x1049('0x26')],util[_0x1049('0x35')](_0x2f02e4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1049('0x20')][_0x1049('0x14')]=function(_0x456099){try{if(this[_0x1049('0x23')](_0x456099)){logger['debug'](_0x1049('0x5f'),_0x456099[_0x1049('0x26')],util[_0x1049('0x35')](_0x456099,{'showHidden':![],'depth':null}));if(this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]]){for(var _0xca9ec9 in this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]]){if(this['channels'][_0x456099[_0x1049('0x26')]][_0x1049('0x3c')](_0xca9ec9)){if(this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9]['agentconnectAt']&&!this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x13')]){logger['info'](_0x1049('0x60'),_0x456099[_0x1049('0x26')],this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x27')],_0xca9ec9);this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x13')]=!![];this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x61')]=moment()[_0x1049('0x37')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x4e')]=_0x1049('0x62');this['channels'][_0x456099[_0x1049('0x26')]][_0xca9ec9]['reason']=_0x456099[_0x1049('0x4f')]==_0x1049('0x63')?_0x1049('0x64'):_0x456099[_0x1049('0x4f')];this['channels'][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x65')]=_0x456099['talktime'];if(this[_0x1049('0xc')][_0x456099[_0x1049('0x2e')]]&&this[_0x1049('0xc')][_0x456099[_0x1049('0x2e')]][_0x1049('0x66')]){this[_0x1049('0xb')][_0x456099['uniqueid']][_0xca9ec9]['acwtime']=this['voiceQueues'][_0x456099[_0x1049('0x2e')]][_0x1049('0x67')];this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9][_0x1049('0x68')]=!![];}this[_0x1049('0xd')][_0x456099[_0x1049('0x44')]]=_[_0x1049('0x69')](this[_0x1049('0xd')][_0x456099[_0x1049('0x44')]],[_0x1049('0x2e'),_0x1049('0x6a')]);logger[_0x1049('0x29')](_0x1049('0x6b'),_0x456099[_0x1049('0x26')],util[_0x1049('0x35')](this['channels'][_0x456099[_0x1049('0x26')]][_0xca9ec9],{'showHidden':![],'depth':null}));ami[_0x1049('0x21')](_0x1049('0x6c'),this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9]);logger[_0x1049('0x29')](_0x1049('0x6d'),_0x456099[_0x1049('0x26')],util[_0x1049('0x35')](this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9],{'showHidden':![],'depth':null}));this['emit'](util[_0x1049('0x37')](_0x1049('0x38'),_0x456099[_0x1049('0x27')]),'user:agentcomplete',this[_0x1049('0xb')][_0x456099[_0x1049('0x26')]][_0xca9ec9]);}}}}}}catch(_0x19ac18){logger[_0x1049('0x57')]('[%s][voiceAgentReport][agentcomplete]',_0x456099[_0x1049('0x26')],util[_0x1049('0x35')](_0x19ac18,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1049('0x20')][_0x1049('0x16')]=function(_0x37d950){try{if(this[_0x1049('0x23')](_0x37d950)){logger[_0x1049('0x29')](_0x1049('0x6e'),_0x37d950['uniqueid'],util[_0x1049('0x35')](_0x37d950,{'showHidden':![],'depth':null}));this[_0x1049('0x6f')](_0x37d950[_0x1049('0x26')],_[_0x1049('0x70')](_0x37d950[_0x1049('0x71')])[0x0],_0x37d950[_0x1049('0x72')]);if(this['channels'][_0x37d950[_0x1049('0x26')]]){for(var _0x4f0537 in this[_0x1049('0xb')][_0x37d950[_0x1049('0x26')]]){if(this[_0x1049('0xb')][_0x37d950['uniqueid']][_0x1049('0x3c')](_0x4f0537)){logger['info'](_0x1049('0x73'),_0x37d950[_0x1049('0x26')],_0x4f0537,_['keys'](_0x37d950[_0x1049('0x71')])[0x0],_0x37d950[_0x1049('0x72')]);if(_[_0x1049('0x2b')](this[_0x1049('0xb')][_0x37d950[_0x1049('0x26')]][_0x4f0537][_0x1049('0xe')])){this[_0x1049('0xb')][_0x37d950['uniqueid']][_0x4f0537][_0x1049('0xe')]={};}this[_0x1049('0xb')][_0x37d950[_0x1049('0x26')]][_0x4f0537][_0x1049('0xe')]=this[_0x1049('0xe')][_0x37d950[_0x1049('0x26')]];}}}}}catch(_0x165687){logger[_0x1049('0x57')](_0x1049('0x74'),_0x37d950[_0x1049('0x26')],util[_0x1049('0x35')](_0x165687,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1049('0x6f')]=function(_0x5b380d,_0x1d886c,_0x5801a5){var _0x5e69f3=[_0x1049('0x75'),_0x1049('0x76'),_0x1049('0x77'),_0x1049('0x78'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x1049('0x79'),'sipuri',_0x1049('0x7a'),_0x1049('0x7b'),'membercalls',_0x1049('0x7c'),'memberinterface',_0x1049('0x7d'),'membername',_0x1049('0x7e'),_0x1049('0x7f')];if(!_[_0x1049('0x80')](_0x1d886c)&&!_['includes'](_0x5e69f3,_0x1d886c)){if(_[_0x1049('0x2b')](this[_0x1049('0xe')][_0x5b380d])){this[_0x1049('0xe')][_0x5b380d]={};}this['variables'][_0x5b380d][_0x1d886c]=_0x5801a5;}};VoiceAgentReport[_0x1049('0x20')][_0x1049('0x17')]=function(_0x388021){try{if(this[_0x1049('0x23')](_0x388021)){logger[_0x1049('0x29')](_0x1049('0x81'),_0x388021[_0x1049('0x26')],util[_0x1049('0x35')](_0x388021,{'showHidden':![],'depth':null}));if(this['channels'][_0x388021[_0x1049('0x26')]]){for(var _0x158127 in this[_0x1049('0xb')][_0x388021['uniqueid']]){if(this['channels'][_0x388021[_0x1049('0x26')]][_0x1049('0x3c')](_0x158127)){if(this['channels'][_0x388021[_0x1049('0x26')]][_0x158127][_0x1049('0x4f')]==_0x1049('0x63')&&this['channels'][_0x388021['uniqueid']][_0x158127][_0x1049('0x13')]){logger[_0x1049('0x24')](_0x1049('0x82'),_0x388021[_0x1049('0x26')],_0x158127);this[_0x1049('0xb')][_0x388021['uniqueid']][_0x158127]['agentcompleteAt']=moment()[_0x1049('0x37')](_0x1049('0x2c'));}}}logger[_0x1049('0x29')](_0x1049('0x83'),_0x388021['uniqueid'],util[_0x1049('0x35')](_[_0x1049('0x84')](this[_0x1049('0xb')][_0x388021[_0x1049('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x1049('0x21')](_0x1049('0x85'),_[_0x1049('0x84')](this[_0x1049('0xb')][_0x388021[_0x1049('0x26')]]));delete this['channels'][_0x388021['uniqueid']];}if(this[_0x1049('0xe')][_0x388021[_0x1049('0x26')]]){delete this['variables'][_0x388021[_0x1049('0x26')]];}}}catch(_0x179e9a){logger['error'](_0x1049('0x86'),_0x388021[_0x1049('0x26')],util[_0x1049('0x35')](_0x179e9a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1049('0x20')]['syncAttendedTransfer']=function(_0x2ab0d4){try{if(this['isNotNull'](_0x2ab0d4)){logger[_0x1049('0x29')](_0x1049('0x87'),_0x2ab0d4[_0x1049('0x26')],util[_0x1049('0x35')](_0x2ab0d4,{'showHidden':![],'depth':null}));if(this[_0x1049('0xb')][_0x2ab0d4[_0x1049('0x88')]]){for(var _0x13cef0 in this['channels'][_0x2ab0d4[_0x1049('0x88')]]){if(this[_0x1049('0xb')][_0x2ab0d4[_0x1049('0x88')]][_0x1049('0x3c')](_0x13cef0)){if(_0x2ab0d4[_0x1049('0x89')]===_0x13cef0){logger[_0x1049('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2ab0d4[_0x1049('0x26')],this[_0x1049('0xb')][_0x2ab0d4[_0x1049('0x88')]][_0x13cef0][_0x1049('0x27')],_0x13cef0);var _0x5ed9ed=moment();this[_0x1049('0xb')][_0x2ab0d4['transfereeuniqueid']][_0x13cef0][_0x1049('0x13')]=!![];this['channels'][_0x2ab0d4[_0x1049('0x88')]][_0x13cef0]['agentcompleteAt']=moment()[_0x1049('0x37')](_0x1049('0x2c'));this['channels'][_0x2ab0d4[_0x1049('0x88')]][_0x13cef0]['lastevent']=_0x1049('0x62');this[_0x1049('0xb')][_0x2ab0d4[_0x1049('0x88')]][_0x13cef0][_0x1049('0x4f')]='transfer';this[_0x1049('0xb')][_0x2ab0d4[_0x1049('0x88')]][_0x13cef0][_0x1049('0x65')]=_0x5ed9ed[_0x1049('0x8a')](this['channels'][_0x2ab0d4['transfereeuniqueid']][_0x13cef0][_0x1049('0x3e')],'seconds');}}}}if(this['channels'][_0x2ab0d4['secondtransfereruniqueid']]){var _0xf9b549=this[_0x1049('0xb')][_0x2ab0d4[_0x1049('0x8b')]];this[_0x1049('0xb')][_0x2ab0d4['secondtransfereruniqueid']]=this['channels'][_0x2ab0d4[_0x1049('0x88')]];this['channels'][_0x2ab0d4[_0x1049('0x88')]]=_0xf9b549;}}}catch(_0x4227f2){logger[_0x1049('0x57')](_0x1049('0x8c'),_0x2ab0d4[_0x1049('0x26')],util[_0x1049('0x35')](_0x4227f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1049('0x1f')]=function(_0x4015e7){try{if(this[_0x1049('0x23')](_0x4015e7)){logger['debug'](_0x1049('0x8d'),_0x4015e7[_0x1049('0x26')],util['inspect'](_0x4015e7,{'showHidden':![],'depth':null}));if(this[_0x1049('0xb')][_0x4015e7[_0x1049('0x88')]]){for(var _0x45f4f0 in this[_0x1049('0xb')][_0x4015e7['transfereeuniqueid']]){if(this[_0x1049('0xb')][_0x4015e7[_0x1049('0x88')]][_0x1049('0x3c')](_0x45f4f0)){if(_0x4015e7['transfereruniqueid']===_0x45f4f0){logger[_0x1049('0x24')](_0x1049('0x8e'),_0x4015e7[_0x1049('0x26')],this['channels'][_0x4015e7[_0x1049('0x88')]][_0x45f4f0]['membername'],_0x45f4f0);var _0x4b99ba=moment();this['channels'][_0x4015e7[_0x1049('0x88')]][_0x45f4f0][_0x1049('0x13')]=!![];this['channels'][_0x4015e7[_0x1049('0x88')]][_0x45f4f0][_0x1049('0x61')]=_0x4b99ba;this[_0x1049('0xb')][_0x4015e7[_0x1049('0x88')]][_0x45f4f0][_0x1049('0x4e')]=_0x1049('0x62');this['channels'][_0x4015e7[_0x1049('0x88')]][_0x45f4f0]['reason']=_0x1049('0x63');this[_0x1049('0xb')][_0x4015e7['transfereeuniqueid']][_0x45f4f0][_0x1049('0x65')]=_0x4b99ba[_0x1049('0x8a')](this[_0x1049('0xb')][_0x4015e7[_0x1049('0x88')]][_0x45f4f0][_0x1049('0x3e')],_0x1049('0x8f'));}}}}}}catch(_0x1db301){logger[_0x1049('0x57')](_0x1049('0x90'),_0x4015e7['uniqueid'],util['inspect'](_0x1db301,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1049('0x20')][_0x1049('0x19')]=function(_0x32fc5a){var _0x5ea51e='';try{if(this[_0x1049('0x23')](_0x32fc5a)){logger['debug'](_0x1049('0x91'),_0x32fc5a[_0x1049('0x26')],util[_0x1049('0x35')](_0x32fc5a,{'showHidden':![],'depth':null}));if(_0x32fc5a[_0x1049('0x92')]){_0x5ea51e=_0x32fc5a[_0x1049('0x92')]['substring'](0x0,_0x32fc5a[_0x1049('0x92')][_0x1049('0x93')]('-'));if(this[_0x1049('0xd')][_0x5ea51e]){logger['info'](_0x1049('0x94'),_0x32fc5a['uniqueid'],_0x5ea51e);this[_0x1049('0xd')][_0x5ea51e]['onhold']=!![];}}}}catch(_0x53952e){logger[_0x1049('0x57')](_0x1049('0x95'),_0x32fc5a['uniqueid'],util[_0x1049('0x35')](_0x53952e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1049('0x20')][_0x1049('0x1b')]=function(_0xd438e7){var _0x3baa99='';try{if(this[_0x1049('0x23')](_0xd438e7)){logger[_0x1049('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0xd438e7[_0x1049('0x26')],util['inspect'](_0xd438e7,{'showHidden':![],'depth':null}));if(_0xd438e7[_0x1049('0x92')]){_0x3baa99=_0xd438e7['channel'][_0x1049('0x96')](0x0,_0xd438e7[_0x1049('0x92')][_0x1049('0x93')]('-'));if(this[_0x1049('0xd')][_0x3baa99]){logger[_0x1049('0x24')](_0x1049('0x97'),_0xd438e7['uniqueid'],_0x3baa99);this[_0x1049('0xd')][_0x3baa99][_0x1049('0x98')]=![];}}}}catch(_0x36b4c9){logger[_0x1049('0x57')](_0x1049('0x99'),_0xd438e7[_0x1049('0x26')],util[_0x1049('0x35')](_0x36b4c9,{'showHidden':![],'depth':null}));}};module[_0x1049('0x9a')]=VoiceAgentReport; \ No newline at end of file +var _0xd410=['info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','called','queue','type','inbound','merge','omit','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','destchannelstate','holdtime','lastevent','interface','destconnectedlinenum','user:agentconnect','agentcomplete','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull'];(function(_0x2f7fe1,_0xcb2dff){var _0x4ba53e=function(_0x855369){while(--_0x855369){_0x2f7fe1['push'](_0x2f7fe1['shift']());}};_0x4ba53e(++_0xcb2dff);}(_0xd410,0x18f));var _0x0d41=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd410[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0d41('0x0'));var moment=require(_0x0d41('0x1'));var util=require(_0x0d41('0x2'));var Redis=require('ioredis');var config=require(_0x0d41('0x3'));var logger=require(_0x0d41('0x4'))('ami');var ami=require(_0x0d41('0x5'));config[_0x0d41('0x6')]=_[_0x0d41('0x7')](config[_0x0d41('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0d41('0x8'))(new Redis(config[_0x0d41('0x6')]));function VoiceAgentReport(_0x402d2b){this[_0x0d41('0x9')]={};this[_0x0d41('0xa')]=_0x402d2b[_0x0d41('0xa')];this['agents']=_0x402d2b[_0x0d41('0xb')];this[_0x0d41('0xc')]={};ami['on'](_0x0d41('0xd'),this[_0x0d41('0xe')][_0x0d41('0xf')](this));ami['on'](_0x0d41('0x10'),this[_0x0d41('0x11')][_0x0d41('0xf')](this));ami['on'](_0x0d41('0x12'),this['syncAgentRingNoAnswer'][_0x0d41('0xf')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x0d41('0xf')](this));ami['on']('agentcomplete',this[_0x0d41('0x13')][_0x0d41('0xf')](this));ami['on'](_0x0d41('0x14'),this[_0x0d41('0x15')][_0x0d41('0xf')](this));ami['on'](_0x0d41('0x16'),this[_0x0d41('0x17')][_0x0d41('0xf')](this));ami['on'](_0x0d41('0x18'),this[_0x0d41('0x19')][_0x0d41('0xf')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x0d41('0x1a'),this[_0x0d41('0x1b')][_0x0d41('0xf')](this));ami['on'](_0x0d41('0x1c'),this['syncBlindTransfer'][_0x0d41('0xf')](this));}VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x1e')]=function(_0x5a74ca,_0x46e9e2,_0x6c2ced){io['to'](_0x5a74ca)[_0x0d41('0x1e')](_0x46e9e2,_0x6c2ced);};VoiceAgentReport[_0x0d41('0x1d')]['isNotNull']=function(_0x5be216){return _0x5be216!==null&&!_[_0x0d41('0x1f')](_0x5be216);};VoiceAgentReport[_0x0d41('0x1d')]['syncAgentCalled']=function(_0x532d90){try{if(this[_0x0d41('0x20')](_0x532d90)){logger[_0x0d41('0x21')](_0x0d41('0x22'),_0x532d90[_0x0d41('0x23')],_0x532d90[_0x0d41('0x24')],_0x532d90[_0x0d41('0x25')]);logger['debug'](_0x0d41('0x26'),_0x532d90[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x532d90,{'showHidden':![],'depth':null}));if(_[_0x0d41('0x1f')](this['channels'][_0x532d90['uniqueid']])){this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]]={};}if(_[_0x0d41('0x1f')](this['channels'][_0x532d90['uniqueid']][_0x532d90[_0x0d41('0x25')]])){this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]][_0x532d90[_0x0d41('0x25')]]={'agentcalledAt':moment()[_0x0d41('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x0d41('0x29'),'mandatoryDisposition':this[_0x0d41('0xa')][_0x532d90[_0x0d41('0x2a')]]?this[_0x0d41('0xa')][_0x532d90[_0x0d41('0x2a')]]['mandatoryDisposition']||![]:![],'type':this[_0x0d41('0xa')][_0x532d90[_0x0d41('0x2a')]]?this[_0x0d41('0xa')][_0x532d90[_0x0d41('0x2a')]][_0x0d41('0x2b')]||_0x0d41('0x2c'):'inbound','variables':this['variables'][_0x532d90[_0x0d41('0x23')]]};}_[_0x0d41('0x2d')](this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]][_0x532d90[_0x0d41('0x25')]],_[_0x0d41('0x2e')](_0x532d90,['event',_0x0d41('0x2f')]));logger[_0x0d41('0x30')](_0x0d41('0x31'),_0x532d90['uniqueid'],util['inspect'](this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]][_0x532d90['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x0d41('0x32'),this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]][_0x532d90[_0x0d41('0x25')]]);logger[_0x0d41('0x30')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x532d90[_0x0d41('0x23')],util[_0x0d41('0x27')](this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]][_0x532d90[_0x0d41('0x25')]],{'showHidden':![],'depth':null}));this[_0x0d41('0x1e')](util[_0x0d41('0x28')](_0x0d41('0x33'),_0x532d90['membername']),_0x0d41('0x34'),this[_0x0d41('0x9')][_0x532d90[_0x0d41('0x23')]][_0x532d90[_0x0d41('0x25')]]);}}catch(_0x25dd49){logger[_0x0d41('0x35')](_0x0d41('0x36'),_0x532d90[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x25dd49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x11')]=function(_0x496046){try{if(this[_0x0d41('0x20')](_0x496046)){if(this[_0x0d41('0x9')][_0x496046['uniqueid']]){logger[_0x0d41('0x30')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x496046[_0x0d41('0x23')],util['inspect'](_0x496046,{'showHidden':![],'depth':null}));for(var _0x513962 in this[_0x0d41('0x9')][_0x496046['uniqueid']]){if(this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x0d41('0x37')](_0x513962)){if(_0x496046[_0x0d41('0x25')]===_0x513962){logger['info'](_0x0d41('0x38'),_0x496046[_0x0d41('0x23')],_0x496046['membername'],_0x496046[_0x0d41('0x25')]);this[_0x0d41('0x9')][_0x496046['uniqueid']][_0x513962][_0x0d41('0x39')]=moment()[_0x0d41('0x28')](_0x0d41('0x3a'));this['channels'][_0x496046['uniqueid']][_0x513962]['connectedlinename']=_0x496046['connectedlinename'];this['channels'][_0x496046['uniqueid']][_0x513962]['connectedlinenum']=_0x496046[_0x0d41('0x3b')];this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x3c')]=_0x496046[_0x0d41('0x3c')];this['channels'][_0x496046['uniqueid']][_0x513962]['destchannelstatedesc']=_0x496046['destchannelstatedesc'];this['channels'][_0x496046['uniqueid']][_0x513962][_0x0d41('0x3d')]=_0x496046[_0x0d41('0x3d')];this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x3e')]='connect';_['merge'](this['agents'][_0x496046[_0x0d41('0x3f')]],_['pick'](_0x496046,['queue',_0x0d41('0x40')]));logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x496046['uniqueid'],util[_0x0d41('0x27')](this[_0x0d41('0x9')][_0x496046['uniqueid']][_0x496046['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0d41('0x1e')]('custom:agentconnect',this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x496046[_0x0d41('0x25')]]);logger[_0x0d41('0x30')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x496046[_0x0d41('0x23')],util[_0x0d41('0x27')](this['channels'][_0x496046[_0x0d41('0x23')]][_0x496046[_0x0d41('0x25')]],{'showHidden':![],'depth':null}));this[_0x0d41('0x1e')](util[_0x0d41('0x28')](_0x0d41('0x33'),_0x496046[_0x0d41('0x24')]),_0x0d41('0x41'),this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x496046[_0x0d41('0x25')]]);}else if(!this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x12')]&&!this[_0x0d41('0x9')][_0x496046['uniqueid']][_0x513962][_0x0d41('0x42')]){logger[_0x0d41('0x21')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x496046[_0x0d41('0x23')],this['channels'][_0x496046['uniqueid']][_0x513962][_0x0d41('0x24')],_0x513962);this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962]['agentringnoanswer']=!![];this['channels'][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x43')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x44')]=_0x496046[_0x0d41('0x25')];this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x45')]=_0x496046[_0x0d41('0x24')];this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962]['lastevent']='answered_elsewhere';this[_0x0d41('0x9')][_0x496046[_0x0d41('0x23')]][_0x513962][_0x0d41('0x46')]='answered_elsewhere';logger['debug'](_0x0d41('0x47'),_0x496046[_0x0d41('0x23')],util[_0x0d41('0x27')](this[_0x0d41('0x9')][_0x496046['uniqueid']][_0x513962],{'showHidden':![],'depth':null}));ami[_0x0d41('0x1e')](_0x0d41('0x48'),this[_0x0d41('0x9')][_0x496046['uniqueid']][_0x513962]);}}}}}}catch(_0x3c3835){logger[_0x0d41('0x35')](_0x0d41('0x49'),_0x496046[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x3c3835,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')]['syncAgentRingNoAnswer']=function(_0x466b05){try{if(this['isNotNull'](_0x466b05)){logger[_0x0d41('0x30')](_0x0d41('0x4a'),_0x466b05[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x466b05,{'showHidden':![],'depth':null}));if(this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]]&&this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]][_0x466b05['destuniqueid']]){logger[_0x0d41('0x21')](_0x0d41('0x4b'),_0x466b05[_0x0d41('0x23')],_0x466b05[_0x0d41('0x24')],_0x466b05[_0x0d41('0x25')]);this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]][_0x466b05['destuniqueid']][_0x0d41('0x12')]=!![];this['channels'][_0x466b05[_0x0d41('0x23')]][_0x466b05[_0x0d41('0x25')]][_0x0d41('0x43')]=moment()[_0x0d41('0x28')](_0x0d41('0x3a'));this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]][_0x466b05['destuniqueid']][_0x0d41('0x3e')]=_0x0d41('0x4c');this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]][_0x466b05[_0x0d41('0x25')]]['reason']=_0x0d41('0x4c');logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x466b05[_0x0d41('0x23')],util['inspect'](this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]][_0x466b05[_0x0d41('0x25')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0d41('0x4d'),this[_0x0d41('0x9')][_0x466b05[_0x0d41('0x23')]][_0x466b05[_0x0d41('0x25')]]);}}}catch(_0x4dd10e){logger[_0x0d41('0x35')](_0x0d41('0x4e'),_0x466b05['uniqueid'],util[_0x0d41('0x27')](_0x4dd10e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x4f')]=function(_0x481a7c){try{if(this[_0x0d41('0x20')](_0x481a7c)){logger[_0x0d41('0x30')](_0x0d41('0x50'),_0x481a7c['uniqueid'],util[_0x0d41('0x27')](_0x481a7c,{'showHidden':![],'depth':null}));if(this[_0x0d41('0x9')][_0x481a7c[_0x0d41('0x23')]]){for(var _0x5d646d in this['channels'][_0x481a7c['uniqueid']]){if(this[_0x0d41('0x9')][_0x481a7c['uniqueid']]['hasOwnProperty'](_0x5d646d)&&!this[_0x0d41('0x9')][_0x481a7c['uniqueid']][_0x5d646d][_0x0d41('0x12')]&&!this['channels'][_0x481a7c[_0x0d41('0x23')]][_0x5d646d][_0x0d41('0x42')]){logger[_0x0d41('0x21')](_0x0d41('0x51'),_0x481a7c[_0x0d41('0x23')],this['channels'][_0x481a7c[_0x0d41('0x23')]][_0x5d646d]['membername'],_0x5d646d);this[_0x0d41('0x9')][_0x481a7c[_0x0d41('0x23')]][_0x5d646d][_0x0d41('0x12')]=!![];this[_0x0d41('0x9')][_0x481a7c[_0x0d41('0x23')]][_0x5d646d][_0x0d41('0x43')]=moment()['format'](_0x0d41('0x3a'));this[_0x0d41('0x9')][_0x481a7c[_0x0d41('0x23')]][_0x5d646d][_0x0d41('0x3e')]=_0x0d41('0x52');this[_0x0d41('0x9')][_0x481a7c[_0x0d41('0x23')]][_0x5d646d]['reason']=_0x0d41('0x52');logger['debug'](_0x0d41('0x53'),_0x481a7c[_0x0d41('0x23')],util[_0x0d41('0x27')](this['channels'][_0x481a7c[_0x0d41('0x23')]][_0x5d646d],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this['channels'][_0x481a7c[_0x0d41('0x23')]][_0x5d646d]);}}}}}catch(_0x25bbfd){logger['error'](_0x0d41('0x54'),_0x481a7c[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x25bbfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x13')]=function(_0x274d35){try{if(this['isNotNull'](_0x274d35)){logger[_0x0d41('0x30')](_0x0d41('0x55'),_0x274d35[_0x0d41('0x23')],util['inspect'](_0x274d35,{'showHidden':![],'depth':null}));if(this['channels'][_0x274d35[_0x0d41('0x23')]]){for(var _0x70b607 in this['channels'][_0x274d35[_0x0d41('0x23')]]){if(this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x0d41('0x37')](_0x70b607)){if(this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607]['agentconnectAt']&&!this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607]['agentcomplete']){logger[_0x0d41('0x21')](_0x0d41('0x56'),_0x274d35[_0x0d41('0x23')],this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607]['membername'],_0x70b607);this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607]['agentcomplete']=!![];this['channels'][_0x274d35[_0x0d41('0x23')]][_0x70b607][_0x0d41('0x57')]=moment()[_0x0d41('0x28')](_0x0d41('0x3a'));this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607][_0x0d41('0x3e')]=_0x0d41('0x58');this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607][_0x0d41('0x46')]=_0x274d35[_0x0d41('0x46')]==_0x0d41('0x59')?'agent':_0x274d35['reason'];this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607][_0x0d41('0x5a')]=_0x274d35[_0x0d41('0x5a')];if(this[_0x0d41('0xa')][_0x274d35[_0x0d41('0x2a')]]&&this['voiceQueues'][_0x274d35[_0x0d41('0x2a')]][_0x0d41('0x5b')]){this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607][_0x0d41('0x5c')]=this[_0x0d41('0xa')][_0x274d35[_0x0d41('0x2a')]][_0x0d41('0x5d')];this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607][_0x0d41('0x5e')]=!![];}this['agents'][_0x274d35[_0x0d41('0x3f')]]=_[_0x0d41('0x2e')](this[_0x0d41('0xb')][_0x274d35['interface']],[_0x0d41('0x2a'),_0x0d41('0x40')]);logger[_0x0d41('0x30')](_0x0d41('0x5f'),_0x274d35[_0x0d41('0x23')],util[_0x0d41('0x27')](this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607],{'showHidden':![],'depth':null}));ami[_0x0d41('0x1e')]('custom:agentcomplete',this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607]);logger[_0x0d41('0x30')](_0x0d41('0x60'),_0x274d35[_0x0d41('0x23')],util[_0x0d41('0x27')](this['channels'][_0x274d35[_0x0d41('0x23')]][_0x70b607],{'showHidden':![],'depth':null}));this['emit'](util[_0x0d41('0x28')]('user:%s',_0x274d35['membername']),_0x0d41('0x61'),this[_0x0d41('0x9')][_0x274d35[_0x0d41('0x23')]][_0x70b607]);}}}}}}catch(_0x3e96fe){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x274d35[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x3e96fe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x15')]=function(_0x56a860){try{if(this[_0x0d41('0x20')](_0x56a860)){logger[_0x0d41('0x30')](_0x0d41('0x62'),_0x56a860[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x56a860,{'showHidden':![],'depth':null}));this[_0x0d41('0x63')](_0x56a860[_0x0d41('0x23')],_['keys'](_0x56a860[_0x0d41('0x64')])[0x0],_0x56a860[_0x0d41('0x65')]);if(this[_0x0d41('0x9')][_0x56a860[_0x0d41('0x23')]]){for(var _0x442a9a in this[_0x0d41('0x9')][_0x56a860[_0x0d41('0x23')]]){if(this[_0x0d41('0x9')][_0x56a860['uniqueid']][_0x0d41('0x37')](_0x442a9a)){logger[_0x0d41('0x21')](_0x0d41('0x66'),_0x56a860[_0x0d41('0x23')],_0x442a9a,_[_0x0d41('0x67')](_0x56a860['variable'])[0x0],_0x56a860[_0x0d41('0x65')]);if(_[_0x0d41('0x1f')](this[_0x0d41('0x9')][_0x56a860['uniqueid']][_0x442a9a][_0x0d41('0xc')])){this['channels'][_0x56a860['uniqueid']][_0x442a9a][_0x0d41('0xc')]={};}this[_0x0d41('0x9')][_0x56a860[_0x0d41('0x23')]][_0x442a9a][_0x0d41('0xc')]=this['variables'][_0x56a860[_0x0d41('0x23')]];}}}}}catch(_0x2f1d64){logger['error'](_0x0d41('0x68'),_0x56a860[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x2f1d64,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x63')]=function(_0x453be5,_0x468841,_0x29d2e0){var _0x51b92e=['rtpaudioqos',_0x0d41('0x69'),_0x0d41('0x6a'),_0x0d41('0x6b'),_0x0d41('0x6c'),_0x0d41('0x6d'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x0d41('0x6e'),_0x0d41('0x6f'),_0x0d41('0x70'),'bridgepvtcallid','membercalls',_0x0d41('0x71'),'memberinterface',_0x0d41('0x72'),_0x0d41('0x24'),_0x0d41('0x73'),_0x0d41('0x74')];if(!_[_0x0d41('0x75')](_0x468841)&&!_[_0x0d41('0x76')](_0x51b92e,_0x468841)){if(_['isUndefined'](this[_0x0d41('0xc')][_0x453be5])){this['variables'][_0x453be5]={};}this[_0x0d41('0xc')][_0x453be5][_0x468841]=_0x29d2e0;}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x17')]=function(_0x3e2024){try{if(this[_0x0d41('0x20')](_0x3e2024)){logger[_0x0d41('0x30')](_0x0d41('0x77'),_0x3e2024[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x3e2024,{'showHidden':![],'depth':null}));if(this[_0x0d41('0x9')][_0x3e2024[_0x0d41('0x23')]]){for(var _0x4167d2 in this[_0x0d41('0x9')][_0x3e2024[_0x0d41('0x23')]]){if(this['channels'][_0x3e2024[_0x0d41('0x23')]]['hasOwnProperty'](_0x4167d2)){if(this[_0x0d41('0x9')][_0x3e2024[_0x0d41('0x23')]][_0x4167d2][_0x0d41('0x46')]=='transfer'&&this['channels'][_0x3e2024[_0x0d41('0x23')]][_0x4167d2]['agentcomplete']){logger['info'](_0x0d41('0x78'),_0x3e2024[_0x0d41('0x23')],_0x4167d2);this[_0x0d41('0x9')][_0x3e2024[_0x0d41('0x23')]][_0x4167d2]['agentcompleteAt']=moment()[_0x0d41('0x28')](_0x0d41('0x3a'));}}}logger[_0x0d41('0x30')](_0x0d41('0x79'),_0x3e2024[_0x0d41('0x23')],util['inspect'](_[_0x0d41('0x7a')](this[_0x0d41('0x9')][_0x3e2024[_0x0d41('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x0d41('0x1e')]('custom:voiceAgentReport',_[_0x0d41('0x7a')](this['channels'][_0x3e2024[_0x0d41('0x23')]]));delete this[_0x0d41('0x9')][_0x3e2024[_0x0d41('0x23')]];}if(this[_0x0d41('0xc')][_0x3e2024['uniqueid']]){delete this[_0x0d41('0xc')][_0x3e2024[_0x0d41('0x23')]];}}}catch(_0x111ca3){logger[_0x0d41('0x35')](_0x0d41('0x7b'),_0x3e2024[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x111ca3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')]['syncAttendedTransfer']=function(_0x5bb867){try{if(this['isNotNull'](_0x5bb867)){logger[_0x0d41('0x30')](_0x0d41('0x7c'),_0x5bb867[_0x0d41('0x23')],util['inspect'](_0x5bb867,{'showHidden':![],'depth':null}));if(this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]]){for(var _0x1f5662 in this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]]){if(this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]][_0x0d41('0x37')](_0x1f5662)){if(_0x5bb867[_0x0d41('0x7e')]===_0x1f5662){logger['info'](_0x0d41('0x7f'),_0x5bb867[_0x0d41('0x23')],this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]][_0x1f5662][_0x0d41('0x24')],_0x1f5662);var _0x3235d0=moment();this['channels'][_0x5bb867[_0x0d41('0x7d')]][_0x1f5662][_0x0d41('0x42')]=!![];this[_0x0d41('0x9')][_0x5bb867['transfereeuniqueid']][_0x1f5662]['agentcompleteAt']=moment()['format'](_0x0d41('0x3a'));this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]][_0x1f5662][_0x0d41('0x3e')]=_0x0d41('0x58');this['channels'][_0x5bb867[_0x0d41('0x7d')]][_0x1f5662][_0x0d41('0x46')]='transfer';this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]][_0x1f5662]['talktime']=_0x3235d0[_0x0d41('0x80')](this[_0x0d41('0x9')][_0x5bb867['transfereeuniqueid']][_0x1f5662][_0x0d41('0x39')],_0x0d41('0x81'));}}}}if(this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x82')]]){var _0x5dcfb2=this[_0x0d41('0x9')][_0x5bb867['secondtransfereruniqueid']];this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x82')]]=this[_0x0d41('0x9')][_0x5bb867[_0x0d41('0x7d')]];this['channels'][_0x5bb867[_0x0d41('0x7d')]]=_0x5dcfb2;}}}catch(_0x123733){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x5bb867[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x123733,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x83')]=function(_0x37063d){try{if(this[_0x0d41('0x20')](_0x37063d)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x37063d[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x37063d,{'showHidden':![],'depth':null}));if(this[_0x0d41('0x9')][_0x37063d[_0x0d41('0x7d')]]){for(var _0x5449a2 in this[_0x0d41('0x9')][_0x37063d[_0x0d41('0x7d')]]){if(this[_0x0d41('0x9')][_0x37063d['transfereeuniqueid']][_0x0d41('0x37')](_0x5449a2)){if(_0x37063d[_0x0d41('0x84')]===_0x5449a2){logger[_0x0d41('0x21')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x37063d['uniqueid'],this[_0x0d41('0x9')][_0x37063d[_0x0d41('0x7d')]][_0x5449a2]['membername'],_0x5449a2);var _0x32ed9c=moment();this['channels'][_0x37063d['transfereeuniqueid']][_0x5449a2][_0x0d41('0x42')]=!![];this[_0x0d41('0x9')][_0x37063d[_0x0d41('0x7d')]][_0x5449a2][_0x0d41('0x57')]=_0x32ed9c;this['channels'][_0x37063d[_0x0d41('0x7d')]][_0x5449a2][_0x0d41('0x3e')]=_0x0d41('0x58');this[_0x0d41('0x9')][_0x37063d['transfereeuniqueid']][_0x5449a2][_0x0d41('0x46')]='transfer';this[_0x0d41('0x9')][_0x37063d[_0x0d41('0x7d')]][_0x5449a2][_0x0d41('0x5a')]=_0x32ed9c[_0x0d41('0x80')](this['channels'][_0x37063d[_0x0d41('0x7d')]][_0x5449a2]['agentconnectAt'],_0x0d41('0x81'));}}}}}}catch(_0x305d11){logger['error'](_0x0d41('0x85'),_0x37063d[_0x0d41('0x23')],util[_0x0d41('0x27')](_0x305d11,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x19')]=function(_0x5dbf81){var _0x549129='';try{if(this[_0x0d41('0x20')](_0x5dbf81)){logger[_0x0d41('0x30')](_0x0d41('0x86'),_0x5dbf81['uniqueid'],util[_0x0d41('0x27')](_0x5dbf81,{'showHidden':![],'depth':null}));if(_0x5dbf81[_0x0d41('0x87')]){_0x549129=_0x5dbf81['channel'][_0x0d41('0x88')](0x0,_0x5dbf81[_0x0d41('0x87')][_0x0d41('0x89')]('-'));if(this[_0x0d41('0xb')][_0x549129]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x5dbf81[_0x0d41('0x23')],_0x549129);this[_0x0d41('0xb')][_0x549129][_0x0d41('0x8a')]=!![];}}}}catch(_0x5d1d9f){logger[_0x0d41('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x5dbf81[_0x0d41('0x23')],util['inspect'](_0x5d1d9f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d41('0x1d')][_0x0d41('0x8b')]=function(_0x118579){var _0x38a705='';try{if(this[_0x0d41('0x20')](_0x118579)){logger[_0x0d41('0x30')](_0x0d41('0x8c'),_0x118579['uniqueid'],util[_0x0d41('0x27')](_0x118579,{'showHidden':![],'depth':null}));if(_0x118579[_0x0d41('0x87')]){_0x38a705=_0x118579[_0x0d41('0x87')][_0x0d41('0x88')](0x0,_0x118579['channel'][_0x0d41('0x89')]('-'));if(this[_0x0d41('0xb')][_0x38a705]){logger[_0x0d41('0x21')](_0x0d41('0x8d'),_0x118579[_0x0d41('0x23')],_0x38a705);this[_0x0d41('0xb')][_0x38a705][_0x0d41('0x8a')]=![];}}}}catch(_0xa25271){logger[_0x0d41('0x35')](_0x0d41('0x8e'),_0x118579[_0x0d41('0x23')],util[_0x0d41('0x27')](_0xa25271,{'showHidden':![],'depth':null}));}};module[_0x0d41('0x8f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 3c8d584..0f90a5e 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c2b=['application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','startsWith','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','event','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','bind','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','isNotNull','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','disposition','toNumber','channelstate','from-sip','channel','split','destconnectedlinenum','debug','accountcode','user:%s','name','user:agentconnect'];(function(_0x5d41db,_0x162a31){var _0x18064c=function(_0x53ba26){while(--_0x53ba26){_0x5d41db['push'](_0x5d41db['shift']());}};_0x18064c(++_0x162a31);}(_0x6c2b,0x1d4));var _0xb6c2=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x6c2b[_0x3f0b30];return _0x2748a5;};'use strict';var BPromise=require(_0xb6c2('0x0'));var _=require(_0xb6c2('0x1'));var moment=require(_0xb6c2('0x2'));var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xb6c2('0x3'))(_0xb6c2('0x4'));var ami=require('../ami');var Channel=require(_0xb6c2('0x5'));var statusDesc=[_0xb6c2('0x6'),_0xb6c2('0x7'),_0xb6c2('0x8'),_0xb6c2('0x9'),_0xb6c2('0xa'),'unavailable',_0xb6c2('0xb'),_0xb6c2('0xc'),_0xb6c2('0xd')];var applications=[_0xb6c2('0xe'),_0xb6c2('0xf'),_0xb6c2('0x10'),_0xb6c2('0x11'),'playback',_0xb6c2('0x12')];var dispositions=['NO\x20ANSWER','FAILED',_0xb6c2('0x13'),'NO\x20ANSWER',_0xb6c2('0x14'),_0xb6c2('0x14'),_0xb6c2('0x15'),_0xb6c2('0x16'),_0xb6c2('0x13'),_0xb6c2('0x13'),_0xb6c2('0x13')];var actions={};config[_0xb6c2('0x17')]=_[_0xb6c2('0x18')](config['redis'],{'host':_0xb6c2('0x19'),'port':0x18eb});var io=require(_0xb6c2('0x1a'))(new Redis(config['redis']));function VoiceCallReport(_0x411e88){this['channels']=_0x411e88[_0xb6c2('0x1b')];this['agents']=_0x411e88[_0xb6c2('0x1c')];this[_0xb6c2('0x1d')]={};ami['on'](_0xb6c2('0x1e'),this[_0xb6c2('0x1f')]['bind'](this));ami['on'](_0xb6c2('0x20'),this[_0xb6c2('0x1f')]['bind'](this));ami['on'](_0xb6c2('0x21'),this['syncNewChannel'][_0xb6c2('0x22')](this));ami['on'](_0xb6c2('0x23'),this[_0xb6c2('0x24')][_0xb6c2('0x22')](this));ami['on'](_0xb6c2('0x25'),this[_0xb6c2('0x26')][_0xb6c2('0x22')](this));ami['on'](_0xb6c2('0x27'),this[_0xb6c2('0x28')][_0xb6c2('0x22')](this));ami['on'](_0xb6c2('0x29'),this['syncNewCallerId'][_0xb6c2('0x22')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0xb6c2('0x2a')][_0xb6c2('0x22')](this));ami['on'](_0xb6c2('0x2b'),this['syncMusicOnHoldStart'][_0xb6c2('0x22')](this));ami['on'](_0xb6c2('0x2c'),this[_0xb6c2('0x2d')][_0xb6c2('0x22')](this));try{logger[_0xb6c2('0x2e')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xb6c2('0x2f')]();}catch(_0x44c078){logger[_0xb6c2('0x30')](_0xb6c2('0x31'),util[_0xb6c2('0x32')](_0x44c078,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xb6c2('0x33')]['isNotNull']=function(_0x19d663){return _0x19d663!==null&&!_['isUndefined'](_0x19d663);};VoiceCallReport[_0xb6c2('0x33')][_0xb6c2('0x34')]=function(_0x12693e,_0x3b39a8,_0x157266){io['to'](_0x12693e)[_0xb6c2('0x34')](_0x3b39a8,_0x157266);};VoiceCallReport[_0xb6c2('0x33')]['syncNewCallerId']=function(_0x5df94f){try{if(this[_0xb6c2('0x35')](_0x5df94f)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x5df94f[_0xb6c2('0x36')],_0x5df94f[_0xb6c2('0x37')],_0x5df94f[_0xb6c2('0x38')]);logger['debug'](_0xb6c2('0x39'),_0x5df94f['uniqueid'],util[_0xb6c2('0x32')](_0x5df94f,{'showHidden':![],'depth':null}));if(_0x5df94f[_0xb6c2('0x36')]===_0x5df94f[_0xb6c2('0x3a')]){if(!_[_0xb6c2('0x3b')](this[_0xb6c2('0x1b')][_0x5df94f[_0xb6c2('0x36')]])){_[_0xb6c2('0x3c')](this[_0xb6c2('0x1b')][_0x5df94f[_0xb6c2('0x36')]],_[_0xb6c2('0x3d')](_0x5df94f,_[_0xb6c2('0x3e')](this[_0xb6c2('0x1b')][_0x5df94f[_0xb6c2('0x36')]])));}}}}catch(_0x1aeeea){logger[_0xb6c2('0x30')]('[%s][voiceCallReport][newcallerid]',_0x5df94f[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x1aeeea,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x34877a){try{if(this[_0xb6c2('0x35')](_0x34877a)){logger['debug'](_0xb6c2('0x3f'),_0x34877a['uniqueid'],util['inspect'](_0x34877a,{'showHidden':![],'depth':null}));if(_0x34877a['uniqueid']===_0x34877a['linkedid']&&_0x34877a['channel']!=_0xb6c2('0x40')){if(_[_0xb6c2('0x3b')](this[_0xb6c2('0x1b')][_0x34877a[_0xb6c2('0x36')]])){logger[_0xb6c2('0x2e')](_0xb6c2('0x41'),_0x34877a[_0xb6c2('0x36')],_0x34877a[_0xb6c2('0x42')],_0x34877a[_0xb6c2('0x43')]);this[_0xb6c2('0x1b')][_0x34877a[_0xb6c2('0x36')]]=new Channel();this['channels'][_0x34877a[_0xb6c2('0x36')]]['starttime']=moment()[_0xb6c2('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb6c2('0x1b')][_0x34877a[_0xb6c2('0x36')]][_0xb6c2('0x45')]=dispositions[_[_0xb6c2('0x46')](_0x34877a[_0xb6c2('0x47')])];_['merge'](this['channels'][_0x34877a[_0xb6c2('0x36')]],_[_0xb6c2('0x3d')](_0x34877a,_['keys'](this[_0xb6c2('0x1b')][_0x34877a[_0xb6c2('0x36')]])));if(_0x34877a['context']===_0xb6c2('0x48')){if(this['agents'][_0x34877a[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]]){this[_0xb6c2('0x1c')][_0x34877a[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]][_0xb6c2('0x4b')]=_0x34877a[_0xb6c2('0x43')];logger[_0xb6c2('0x4c')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x34877a[_0xb6c2('0x36')],util[_0xb6c2('0x32')]({'destaccountcode':this[_0xb6c2('0x1c')][_0x34877a[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]][_0xb6c2('0x4d')],'destconnectedlinenum':_0x34877a['exten']},{'showHidden':![],'depth':null}));this[_0xb6c2('0x34')](util['format'](_0xb6c2('0x4e'),this['agents'][_0x34877a[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]][_0xb6c2('0x4f')]),_0xb6c2('0x50'),{'destaccountcode':this['agents'][_0x34877a['channel'][_0xb6c2('0x4a')]('-')[0x0]][_0xb6c2('0x4d')],'destconnectedlinenum':_0x34877a[_0xb6c2('0x43')]});}}}}}}catch(_0x47d029){logger[_0xb6c2('0x30')]('[%s][voiceCallReport][newchannel]',_0x34877a[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x47d029,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb6c2('0x33')]['syncNewExten']=function(_0x16025c){try{if(this[_0xb6c2('0x35')](_0x16025c)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x16025c[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x16025c,{'showHidden':![],'depth':null}));if(_0x16025c[_0xb6c2('0x36')]===_0x16025c[_0xb6c2('0x3a')]&&_0x16025c[_0xb6c2('0x43')]!='h'&&_0x16025c['channel']!='OutgoingSpoolFailed'){_0x16025c[_0xb6c2('0x51')]=_0x16025c[_0xb6c2('0x51')][_0xb6c2('0x52')]();_0x16025c[_0xb6c2('0x53')]=(_0x16025c['appdata']||_0x16025c['applicationdata'])[_0xb6c2('0x52')]();logger['info'](_0xb6c2('0x54'),_0x16025c[_0xb6c2('0x36')],_0x16025c[_0xb6c2('0x51')],_0x16025c[_0xb6c2('0x53')]);if(_[_0xb6c2('0x3b')](this[_0xb6c2('0x1b')][_0x16025c['uniqueid']])){this['channels'][_0x16025c[_0xb6c2('0x36')]]=new Channel();this[_0xb6c2('0x1b')][_0x16025c['uniqueid']][_0xb6c2('0x55')]=_0x16025c['duration']?moment()[_0xb6c2('0x56')](moment[_0xb6c2('0x57')](_0x16025c[_0xb6c2('0x57')])[_0xb6c2('0x58')](),_0xb6c2('0x58'))[_0xb6c2('0x44')](_0xb6c2('0x59')):moment()[_0xb6c2('0x44')](_0xb6c2('0x59'));this[_0xb6c2('0x1b')][_0x16025c['uniqueid']][_0xb6c2('0x45')]='NO\x20ANSWER';}_['merge'](this[_0xb6c2('0x1b')][_0x16025c[_0xb6c2('0x36')]],_['pick'](_0x16025c,_['keys'](this[_0xb6c2('0x1b')][_0x16025c[_0xb6c2('0x36')]])));if(_[_0xb6c2('0x5a')](applications,_0x16025c[_0xb6c2('0x51')])){this[_0xb6c2('0x1b')][_0x16025c[_0xb6c2('0x36')]][_0xb6c2('0x5b')]=_0x16025c[_0xb6c2('0x51')];this[_0xb6c2('0x1b')][_0x16025c['uniqueid']]['lastdata']=_0x16025c[_0xb6c2('0x53')];if(_0x16025c[_0xb6c2('0x51')]==='set'&&_[_0xb6c2('0x5c')](_0x16025c['applicationdata'],'cdr(')){var _0x4aa583=_0x16025c[_0xb6c2('0x53')][_0xb6c2('0x4a')]('=');var _0x7f9b9e=_0x4aa583[0x0][_0xb6c2('0x5d')](/cdr\((.*)\)/);if(_0x7f9b9e){this[_0xb6c2('0x1b')][_0x16025c[_0xb6c2('0x36')]][_0x7f9b9e[0x1]]=_0x4aa583[0x1];}}else if(_0x16025c[_0xb6c2('0x51')]===_0xb6c2('0xf')){this[_0xb6c2('0x1b')][_0x16025c[_0xb6c2('0x36')]]['queue']=_0x16025c[_0xb6c2('0x53')][_0xb6c2('0x4a')](',')[0x0];}}}}}catch(_0x150861){logger['error'](_0xb6c2('0x5e'),_0x16025c['uniqueid'],util[_0xb6c2('0x32')](_0x150861,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x494fb3){try{if(this[_0xb6c2('0x35')](_0x494fb3)){logger[_0xb6c2('0x2e')](_0xb6c2('0x5f'),_0x494fb3['uniqueid'],_0x494fb3[_0xb6c2('0x3a')],_0x494fb3['calleridname'],_0x494fb3[_0xb6c2('0x38')]);logger[_0xb6c2('0x4c')](_0xb6c2('0x60'),_0x494fb3[_0xb6c2('0x36')],util['inspect'](_0x494fb3,{'showHidden':![],'depth':null}));if(_0x494fb3[_0xb6c2('0x36')]!==_0x494fb3[_0xb6c2('0x3a')]){if(this['channels'][_0x494fb3[_0xb6c2('0x3a')]]){if(_0x494fb3[_0xb6c2('0x47')]==='6'){if(!this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x61')]){var _0x48fa74=moment();this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]]['answered']=!![];this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x62')]=_0x48fa74[_0xb6c2('0x44')](_0xb6c2('0x59'));if(this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]]['starttime']){this['channels'][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x63')]=_0x48fa74[_0xb6c2('0x64')](this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]]['starttime'],_0xb6c2('0x58'));}}this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x3a')]=_0x494fb3[_0xb6c2('0x36')];if(_0x494fb3[_0xb6c2('0x38')]!==_0xb6c2('0x65')){this[_0xb6c2('0x1b')][_0x494fb3['linkedid']]['connectedlinenum']=_0x494fb3[_0xb6c2('0x38')];}this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x66')]=_0x494fb3['calleridname'];this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x67')]=_0x494fb3[_0xb6c2('0x49')];this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x3a')]][_0xb6c2('0x45')]=dispositions[_[_0xb6c2('0x46')](_0x494fb3[_0xb6c2('0x47')])];if(this[_0xb6c2('0x1c')][_0x494fb3[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]]){this[_0xb6c2('0x1b')][_0x494fb3['linkedid']]['UserId']=this[_0xb6c2('0x1c')][_0x494fb3[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]]['id'];this[_0xb6c2('0x1b')][_0x494fb3['linkedid']][_0xb6c2('0x68')]=this[_0xb6c2('0x1c')][_0x494fb3[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]]['name'];}}}}else{if(this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x36')]]){if(_0x494fb3[_0xb6c2('0x47')]==='6'){if(this[_0xb6c2('0x1c')][_0x494fb3[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]]){this['channels'][_0x494fb3['uniqueid']]['UserId']=this['agents'][_0x494fb3['channel'][_0xb6c2('0x4a')]('-')[0x0]]['id'];this[_0xb6c2('0x1b')][_0x494fb3[_0xb6c2('0x36')]][_0xb6c2('0x68')]=this[_0xb6c2('0x1c')][_0x494fb3[_0xb6c2('0x49')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x22d775){logger[_0xb6c2('0x30')](_0xb6c2('0x69'),_0x494fb3[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x22d775,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb6c2('0x33')][_0xb6c2('0x6a')]=function(_0x5dedcc,_0x43d0a6){try{if(this[_0xb6c2('0x1b')][_0x5dedcc]){logger[_0xb6c2('0x2e')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5dedcc,_0x43d0a6);this[_0xb6c2('0x1b')][_0x5dedcc][_0xb6c2('0x6b')]=!![];if(_[_0xb6c2('0x6c')](_0x43d0a6,_0xb6c2('0x6d'))){_0x43d0a6=_0x43d0a6[_0xb6c2('0x6e')]('.wav49',_0xb6c2('0x6f'));}this[_0xb6c2('0x1b')][_0x5dedcc]['monitorFilename']=_0x43d0a6;var _0x4bba57=_[_0xb6c2('0x70')](this[_0xb6c2('0x1b')][_0x5dedcc][_0xb6c2('0x71')],{'filename':_0x43d0a6});if(_['isNil'](_0x4bba57)){this[_0xb6c2('0x1b')][_0x5dedcc]['monitors']['push']({'filename':_0x43d0a6,'createdAt':moment()['format'](_0xb6c2('0x59')),'mixmonitorid':'','status':_0xb6c2('0x72')});}}}catch(_0x592951){logger[_0xb6c2('0x30')](_0xb6c2('0x73'),_0x5dedcc,util[_0xb6c2('0x32')](_0x592951,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb6c2('0x33')][_0xb6c2('0x26')]=function(_0xf209f2){try{if(this['isNotNull'](_0xf209f2)){logger['debug']('[%s][voiceCallReport][varset]\x20event:',_0xf209f2[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0xf209f2,{'showHidden':![],'depth':null}));if(this['channels'][_0xf209f2[_0xb6c2('0x36')]]&&_0xf209f2[_0xb6c2('0x49')]!=_0xb6c2('0x40')){if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')])){if(this[_0xb6c2('0x35')](_0xf209f2['variable'][_0xb6c2('0x75')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x6a')](_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);}else if(this['isNotNull'](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x77')])){logger[_0xb6c2('0x2e')](_0xb6c2('0x78'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2['uniqueid']][_0xb6c2('0x38')]=_0xf209f2[_0xb6c2('0x76')];}else if(this['isNotNull'](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x79')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2[_0xb6c2('0x36')]][_0xb6c2('0x7a')]=_0xf209f2[_0xb6c2('0x76')];}else if(this['isNotNull'](_0xf209f2[_0xb6c2('0x74')]['xmd-cdrtype'])){logger[_0xb6c2('0x2e')](_0xb6c2('0x7b'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2['value']);this[_0xb6c2('0x1b')][_0xf209f2[_0xb6c2('0x36')]]['type']=_0xf209f2[_0xb6c2('0x76')];}else if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x7c')])){logger[_0xb6c2('0x2e')](_0xb6c2('0x7d'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')][_0xb6c2('0x4a')](',')[0x0]);this[_0xb6c2('0x1b')][_0xf209f2[_0xb6c2('0x36')]][_0xb6c2('0xf')]=_0xf209f2[_0xb6c2('0x76')]['split'](',')[0x0];}else if(this['isNotNull'](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x7e')])){logger['info'](_0xb6c2('0x7f'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2[_0xb6c2('0x36')]][_0xb6c2('0x80')]=_0xf209f2['value'];}else if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x81')])){logger[_0xb6c2('0x2e')](_0xb6c2('0x82'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2['uniqueid']]['destination']=_0xf209f2[_0xb6c2('0x76')];}else if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x83')])){logger[_0xb6c2('0x2e')](_0xb6c2('0x84'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this['channels'][_0xf209f2[_0xb6c2('0x36')]][_0xb6c2('0x85')]=_0xf209f2[_0xb6c2('0x76')];}else if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')]['xmcs-queue'])){logger[_0xb6c2('0x2e')](_0xb6c2('0x86'),_0xf209f2[_0xb6c2('0x36')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2['uniqueid']][_0xb6c2('0xf')]=_0xf209f2['value'];}else if(this['isNotNull'](_0xf209f2[_0xb6c2('0x74')]['sipcallid'])){logger[_0xb6c2('0x2e')](_0xb6c2('0x87'),_0xf209f2['uniqueid'],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2[_0xb6c2('0x36')]][_0xb6c2('0x88')]=_0xf209f2[_0xb6c2('0x76')];}}}else if(this['isNotNull'](_0xf209f2[_0xb6c2('0x74')]['mixmonitor_filename'])){if(_0xf209f2[_0xb6c2('0x76')]){var _0x52b841=path[_0xb6c2('0x89')](_0xf209f2[_0xb6c2('0x76')])[_0xb6c2('0x4f')];logger['info'](_0xb6c2('0x8a'),_0x52b841,_0xf209f2['value']);this[_0xb6c2('0x6a')](_0x52b841,_0xf209f2[_0xb6c2('0x76')]);}}else if(this['channels'][_0xf209f2[_0xb6c2('0x3a')]]){if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')])){if(this[_0xb6c2('0x35')](_0xf209f2[_0xb6c2('0x74')][_0xb6c2('0x8b')])){logger[_0xb6c2('0x2e')](_0xb6c2('0x87'),_0xf209f2[_0xb6c2('0x3a')],_0xf209f2[_0xb6c2('0x76')]);this[_0xb6c2('0x1b')][_0xf209f2[_0xb6c2('0x3a')]]['sipcalllinkedid']=_0xf209f2[_0xb6c2('0x76')];}}}}}catch(_0x3dcab6){logger['error'](_0xb6c2('0x8c'),_0xf209f2[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x3dcab6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x41a260){try{if(this[_0xb6c2('0x35')](_0x41a260)){logger['debug'](_0xb6c2('0x8d'),_0x41a260[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x41a260,{'showHidden':![],'depth':null}));if(this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]]){logger['info'](_0xb6c2('0x8e'),_0x41a260['uniqueid'],_0x41a260[_0xb6c2('0x8f')]);var _0x5b25a1=moment();this['channels'][_0x41a260['uniqueid']][_0xb6c2('0x90')]=_0x5b25a1[_0xb6c2('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb6c2('0x1b')][_0x41a260['uniqueid']][_0xb6c2('0x57')]=_0x5b25a1[_0xb6c2('0x64')](this[_0xb6c2('0x1b')][_0x41a260['uniqueid']][_0xb6c2('0x55')],_0xb6c2('0x58'));if(this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]][_0xb6c2('0x61')]){this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]][_0xb6c2('0x91')]=_0x5b25a1[_0xb6c2('0x64')](this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]][_0xb6c2('0x62')],_0xb6c2('0x58'));this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]]['holdtime']=this[_0xb6c2('0x1b')][_0x41a260['uniqueid']][_0xb6c2('0x57')]-this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]][_0xb6c2('0x91')];}if(_0x41a260[_0xb6c2('0x42')]===_0xb6c2('0x48')){if(this['agents'][_0x41a260['channel']['split']('-')[0x0]]){this[_0xb6c2('0x1c')][_0x41a260[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]]=_[_0xb6c2('0x92')](this[_0xb6c2('0x1c')][_0x41a260['channel'][_0xb6c2('0x4a')]('-')[0x0]],[_0xb6c2('0x4b')]);logger[_0xb6c2('0x4c')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x41a260[_0xb6c2('0x36')],util[_0xb6c2('0x32')]({'destaccountcode':this[_0xb6c2('0x1c')][_0x41a260['channel'][_0xb6c2('0x4a')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xb6c2('0x34')](util[_0xb6c2('0x44')]('user:%s',this['agents'][_0x41a260[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]][_0xb6c2('0x4f')]),_0xb6c2('0x93'),{'destaccountcode':this[_0xb6c2('0x1c')][_0x41a260[_0xb6c2('0x49')][_0xb6c2('0x4a')]('-')[0x0]][_0xb6c2('0x4d')]});}}if(_0x41a260[_0xb6c2('0x94')]===_0xb6c2('0x95')){this[_0xb6c2('0x1d')][_0x41a260[_0xb6c2('0x36')]]=this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]];}else{if(this[_0xb6c2('0x1b')][_0x41a260['uniqueid']][_0xb6c2('0x96')]===_0xb6c2('0x97')&&this['blindTransfers'][_0x41a260[_0xb6c2('0x36')]]){this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]][_0xb6c2('0x36')]=[this['channels'][_0x41a260[_0xb6c2('0x36')]][_0xb6c2('0x3a')],this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]]['linkedid']=this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]]['uniqueid']][0x0];delete this[_0xb6c2('0x1d')][_0x41a260[_0xb6c2('0x36')]];}}logger[_0xb6c2('0x4c')](_0xb6c2('0x98'),_0x41a260[_0xb6c2('0x36')],util['inspect'](this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]],{'showHidden':![],'depth':null}));ami['emit'](_0xb6c2('0x99'),this['channels'][_0x41a260[_0xb6c2('0x36')]]);delete this[_0xb6c2('0x1b')][_0x41a260[_0xb6c2('0x36')]];}}}catch(_0x62d20){logger[_0xb6c2('0x30')](_0xb6c2('0x9a'),_0x41a260['uniqueid'],util['inspect'](_0x62d20,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb6c2('0x33')][_0xb6c2('0x9b')]=function(_0x5078cf){try{if(this['isNotNull'](_0x5078cf)){logger[_0xb6c2('0x2e')](_0xb6c2('0x9c'),_0x5078cf['uniqueid'],_0x5078cf['origtransferercalleridnum'],_0x5078cf[_0xb6c2('0x9d')]);logger['debug'](_0xb6c2('0x9e'),_0x5078cf[_0xb6c2('0x36')],util['inspect'](_0x5078cf,{'showHidden':![],'depth':null}));if(this['channels'][_0x5078cf[_0xb6c2('0x9f')]]){this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0x9f')]][_0xb6c2('0xa0')]=_0x5078cf[_0xb6c2('0xa1')];this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0x9f')]]['transferconnectedlinenum']=_0x5078cf['transfertargetcalleridnum'];if(this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa2')]]){var _0x1c6104=this['channels'][_0x5078cf[_0xb6c2('0xa2')]];this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa2')]]=this['channels'][_0x5078cf['transfereeuniqueid']];this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0x9f')]]=_0x1c6104;}}else if(this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa3')]]){this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa3')]][_0xb6c2('0xa0')]=_0x5078cf[_0xb6c2('0xa1')];this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa3')]][_0xb6c2('0xa4')]=_0x5078cf[_0xb6c2('0x9d')];if(this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa5')]]){var _0x1c6104=this['channels'][_0x5078cf[_0xb6c2('0xa5')]];this['channels'][_0x5078cf['origtransfereruniqueid']]=this[_0xb6c2('0x1b')][_0x5078cf[_0xb6c2('0xa3')]];this['channels'][_0x5078cf[_0xb6c2('0xa3')]]=_0x1c6104;}}}}catch(_0x28a67b){logger[_0xb6c2('0x30')]('[%s][voiceCallReport][attendedtransfer]',_0x5078cf[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x28a67b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb6c2('0x33')][_0xb6c2('0x2a')]=function(_0x58aee1){try{if(this[_0xb6c2('0x35')](_0x58aee1)){logger[_0xb6c2('0x2e')](_0xb6c2('0xa6'),_0x58aee1['uniqueid'],_0x58aee1['transfereecalleridnum'],_0x58aee1[_0xb6c2('0xa7')]);logger[_0xb6c2('0x4c')](_0xb6c2('0xa8'),_0x58aee1[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x58aee1,{'showHidden':![],'depth':null}));if(this['channels'][_0x58aee1[_0xb6c2('0x9f')]]){this['channels'][_0x58aee1[_0xb6c2('0x9f')]][_0xb6c2('0xa0')]=_0x58aee1[_0xb6c2('0xa9')];this['channels'][_0x58aee1['transfereeuniqueid']][_0xb6c2('0xa4')]=_0x58aee1[_0xb6c2('0xa7')];this[_0xb6c2('0x28')]({'event':_0xb6c2('0x95'),'uniqueid':_0x58aee1[_0xb6c2('0x9f')],'context':_0x58aee1[_0xb6c2('0x42')],'channel':_0x58aee1[_0xb6c2('0xaa')]});}}}catch(_0x4948e6){logger['error'](_0xb6c2('0xab'),_0x58aee1[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x4948e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb6c2('0x33')][_0xb6c2('0xac')]=function(_0x18ca8a){try{if(this[_0xb6c2('0x35')](_0x18ca8a)){logger[_0xb6c2('0x4c')](_0xb6c2('0xad'),_0x18ca8a['uniqueid'],util['inspect'](_0x18ca8a,{'showHidden':![],'depth':null}));if(this[_0xb6c2('0x1b')][_0x18ca8a[_0xb6c2('0x36')]]){if(!_[_0xb6c2('0xae')](this[_0xb6c2('0x1b')][_0x18ca8a[_0xb6c2('0x36')]][_0xb6c2('0x62')])){this[_0xb6c2('0x1b')][_0x18ca8a[_0xb6c2('0x36')]][_0xb6c2('0xaf')]=moment()['format'](_0xb6c2('0x59'));logger[_0xb6c2('0x2e')](_0xb6c2('0xb0'),_0x18ca8a[_0xb6c2('0x36')],this[_0xb6c2('0x1b')][_0x18ca8a[_0xb6c2('0x36')]][_0xb6c2('0xaf')]);}}}}catch(_0x25cc78){logger[_0xb6c2('0x30')](_0xb6c2('0xb1'),_0x18ca8a[_0xb6c2('0x36')],util['inspect'](_0x25cc78,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb6c2('0x2d')]=function(_0x42c1a3){try{if(this['isNotNull'](_0x42c1a3)){logger['debug'](_0xb6c2('0xb2'),_0x42c1a3['uniqueid'],util['inspect'](_0x42c1a3,{'showHidden':![],'depth':null}));if(this[_0xb6c2('0x1b')][_0x42c1a3[_0xb6c2('0x36')]]){if(!_['isNil'](this[_0xb6c2('0x1b')][_0x42c1a3['uniqueid']][_0xb6c2('0xaf')])){this['channels'][_0x42c1a3[_0xb6c2('0x36')]]['mohtime']+=moment()[_0xb6c2('0xb3')](0x0)[_0xb6c2('0x64')](this[_0xb6c2('0x1b')][_0x42c1a3[_0xb6c2('0x36')]]['mohstarttime'],_0xb6c2('0x58'));logger[_0xb6c2('0x2e')](_0xb6c2('0xb4'),_0x42c1a3[_0xb6c2('0x36')],this[_0xb6c2('0x1b')][_0x42c1a3['uniqueid']][_0xb6c2('0xb5')]);delete this[_0xb6c2('0x1b')][_0x42c1a3[_0xb6c2('0x36')]][_0xb6c2('0xaf')];}}}}catch(_0x24e378){logger[_0xb6c2('0x30')](_0xb6c2('0xb6'),_0x42c1a3[_0xb6c2('0x36')],util[_0xb6c2('0x32')](_0x24e378,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0xa6e0=['lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','isUndefined','pick','keys','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','merge','from-sip','split','channel','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','emit','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','linkedid','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','channelstate','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','context','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','answertime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird'];(function(_0x48ac62,_0xe4df71){var _0x56fff5=function(_0x53c8a0){while(--_0x53c8a0){_0x48ac62['push'](_0x48ac62['shift']());}};_0x56fff5(++_0xe4df71);}(_0xa6e0,0x181));var _0x0a6e=function(_0x5986fd,_0x257a8b){_0x5986fd=_0x5986fd-0x0;var _0x896bb3=_0xa6e0[_0x5986fd];return _0x896bb3;};'use strict';var BPromise=require(_0x0a6e('0x0'));var _=require(_0x0a6e('0x1'));var moment=require(_0x0a6e('0x2'));var util=require(_0x0a6e('0x3'));var path=require(_0x0a6e('0x4'));var Redis=require(_0x0a6e('0x5'));var config=require('../../../config/environment');var logger=require(_0x0a6e('0x6'))(_0x0a6e('0x7'));var ami=require(_0x0a6e('0x8'));var Channel=require(_0x0a6e('0x9'));var statusDesc=['unknown',_0x0a6e('0xa'),_0x0a6e('0xb'),_0x0a6e('0xc'),'invalid',_0x0a6e('0xd'),_0x0a6e('0xe'),_0x0a6e('0xf'),_0x0a6e('0x10')];var applications=['set',_0x0a6e('0x11'),_0x0a6e('0x12'),_0x0a6e('0x13'),_0x0a6e('0x14'),_0x0a6e('0x15')];var dispositions=['NO\x20ANSWER',_0x0a6e('0x16'),_0x0a6e('0x16'),_0x0a6e('0x17'),_0x0a6e('0x17'),'NO\x20ANSWER','ANSWERED',_0x0a6e('0x18'),'FAILED',_0x0a6e('0x16'),'FAILED'];var actions={};config[_0x0a6e('0x19')]=_[_0x0a6e('0x1a')](config[_0x0a6e('0x19')],{'host':_0x0a6e('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a6e('0x19')]));function VoiceCallReport(_0x353eef){this[_0x0a6e('0x1c')]=_0x353eef[_0x0a6e('0x1c')];this[_0x0a6e('0x1d')]=_0x353eef[_0x0a6e('0x1d')];this[_0x0a6e('0x1e')]={};ami['on'](_0x0a6e('0x1f'),this[_0x0a6e('0x20')][_0x0a6e('0x21')](this));ami['on'](_0x0a6e('0x22'),this[_0x0a6e('0x20')][_0x0a6e('0x21')](this));ami['on']('newchannel',this[_0x0a6e('0x23')][_0x0a6e('0x21')](this));ami['on'](_0x0a6e('0x24'),this[_0x0a6e('0x25')]['bind'](this));ami['on'](_0x0a6e('0x26'),this[_0x0a6e('0x27')][_0x0a6e('0x21')](this));ami['on'](_0x0a6e('0x28'),this['syncHangup'][_0x0a6e('0x21')](this));ami['on'](_0x0a6e('0x29'),this[_0x0a6e('0x2a')][_0x0a6e('0x21')](this));ami['on'](_0x0a6e('0x2b'),this[_0x0a6e('0x2c')][_0x0a6e('0x21')](this));ami['on'](_0x0a6e('0x2d'),this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this[_0x0a6e('0x2e')]['bind'](this));ami['on'](_0x0a6e('0x2f'),this[_0x0a6e('0x30')][_0x0a6e('0x21')](this));try{logger[_0x0a6e('0x31')](_0x0a6e('0x32'));ami[_0x0a6e('0x33')]();}catch(_0x5ebf72){logger['error'](_0x0a6e('0x34'),util[_0x0a6e('0x35')](_0x5ebf72,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0a6e('0x36')][_0x0a6e('0x37')]=function(_0x5b294e){return _0x5b294e!==null&&!_['isUndefined'](_0x5b294e);};VoiceCallReport[_0x0a6e('0x36')]['emit']=function(_0x4a5cd2,_0x4bc2a7,_0x11a52e){io['to'](_0x4a5cd2)['emit'](_0x4bc2a7,_0x11a52e);};VoiceCallReport['prototype'][_0x0a6e('0x2a')]=function(_0x50600f){try{if(this[_0x0a6e('0x37')](_0x50600f)){logger[_0x0a6e('0x31')](_0x0a6e('0x38'),_0x50600f['uniqueid'],_0x50600f[_0x0a6e('0x39')],_0x50600f['calleridnum']);logger[_0x0a6e('0x3a')](_0x0a6e('0x3b'),_0x50600f[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x50600f,{'showHidden':![],'depth':null}));if(_0x50600f['uniqueid']===_0x50600f['linkedid']){if(!_[_0x0a6e('0x3d')](this[_0x0a6e('0x1c')][_0x50600f['uniqueid']])){_['merge'](this['channels'][_0x50600f[_0x0a6e('0x3c')]],_[_0x0a6e('0x3e')](_0x50600f,_[_0x0a6e('0x3f')](this[_0x0a6e('0x1c')][_0x50600f[_0x0a6e('0x3c')]])));}}}}catch(_0x4943fe){logger[_0x0a6e('0x40')](_0x0a6e('0x41'),_0x50600f[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x4943fe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')]['syncNewChannel']=function(_0x252445){try{if(this[_0x0a6e('0x37')](_0x252445)){logger[_0x0a6e('0x3a')](_0x0a6e('0x42'),_0x252445[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x252445,{'showHidden':![],'depth':null}));if(_0x252445[_0x0a6e('0x3c')]===_0x252445['linkedid']&&_0x252445['channel']!=_0x0a6e('0x43')){if(_[_0x0a6e('0x3d')](this['channels'][_0x252445['uniqueid']])){logger[_0x0a6e('0x31')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x252445['uniqueid'],_0x252445['context'],_0x252445['exten']);this['channels'][_0x252445[_0x0a6e('0x3c')]]=new Channel();this['channels'][_0x252445[_0x0a6e('0x3c')]][_0x0a6e('0x44')]=moment()[_0x0a6e('0x45')](_0x0a6e('0x46'));this['channels'][_0x252445['uniqueid']][_0x0a6e('0x47')]=dispositions[_[_0x0a6e('0x48')](_0x252445['channelstate'])];_[_0x0a6e('0x49')](this[_0x0a6e('0x1c')][_0x252445[_0x0a6e('0x3c')]],_['pick'](_0x252445,_['keys'](this[_0x0a6e('0x1c')][_0x252445[_0x0a6e('0x3c')]])));if(_0x252445['context']===_0x0a6e('0x4a')){if(this[_0x0a6e('0x1d')][_0x252445['channel'][_0x0a6e('0x4b')]('-')[0x0]]){this['agents'][_0x252445[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]][_0x0a6e('0x4d')]=_0x252445[_0x0a6e('0x4e')];logger['debug'](_0x0a6e('0x4f'),_0x252445[_0x0a6e('0x3c')],util[_0x0a6e('0x35')]({'destaccountcode':this[_0x0a6e('0x1d')][_0x252445['channel']['split']('-')[0x0]][_0x0a6e('0x50')],'destconnectedlinenum':_0x252445[_0x0a6e('0x4e')]},{'showHidden':![],'depth':null}));this[_0x0a6e('0x51')](util['format'](_0x0a6e('0x52'),this[_0x0a6e('0x1d')][_0x252445[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]][_0x0a6e('0x53')]),_0x0a6e('0x54'),{'destaccountcode':this[_0x0a6e('0x1d')][_0x252445[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]][_0x0a6e('0x50')],'destconnectedlinenum':_0x252445['exten']});}}}}}}catch(_0x1aed32){logger[_0x0a6e('0x40')](_0x0a6e('0x55'),_0x252445[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x1aed32,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')][_0x0a6e('0x20')]=function(_0x490b1d){try{if(this[_0x0a6e('0x37')](_0x490b1d)){logger[_0x0a6e('0x3a')](_0x0a6e('0x56'),_0x490b1d['uniqueid'],util[_0x0a6e('0x35')](_0x490b1d,{'showHidden':![],'depth':null}));if(_0x490b1d['uniqueid']===_0x490b1d[_0x0a6e('0x57')]&&_0x490b1d[_0x0a6e('0x4e')]!='h'&&_0x490b1d[_0x0a6e('0x4c')]!='OutgoingSpoolFailed'){_0x490b1d['application']=_0x490b1d[_0x0a6e('0x58')][_0x0a6e('0x59')]();_0x490b1d[_0x0a6e('0x5a')]=(_0x490b1d[_0x0a6e('0x5b')]||_0x490b1d[_0x0a6e('0x5a')])[_0x0a6e('0x59')]();logger[_0x0a6e('0x31')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x490b1d['uniqueid'],_0x490b1d['application'],_0x490b1d['applicationdata']);if(_[_0x0a6e('0x3d')](this['channels'][_0x490b1d[_0x0a6e('0x3c')]])){this[_0x0a6e('0x1c')][_0x490b1d['uniqueid']]=new Channel();this[_0x0a6e('0x1c')][_0x490b1d[_0x0a6e('0x3c')]][_0x0a6e('0x44')]=_0x490b1d[_0x0a6e('0x5c')]?moment()[_0x0a6e('0x5d')](moment['duration'](_0x490b1d[_0x0a6e('0x5c')])['seconds'](),_0x0a6e('0x5e'))[_0x0a6e('0x45')](_0x0a6e('0x46')):moment()[_0x0a6e('0x45')](_0x0a6e('0x46'));this[_0x0a6e('0x1c')][_0x490b1d[_0x0a6e('0x3c')]][_0x0a6e('0x47')]=_0x0a6e('0x17');}_['merge'](this['channels'][_0x490b1d[_0x0a6e('0x3c')]],_['pick'](_0x490b1d,_[_0x0a6e('0x3f')](this[_0x0a6e('0x1c')][_0x490b1d[_0x0a6e('0x3c')]])));if(_[_0x0a6e('0x5f')](applications,_0x490b1d[_0x0a6e('0x58')])){this[_0x0a6e('0x1c')][_0x490b1d[_0x0a6e('0x3c')]]['lastapplication']=_0x490b1d[_0x0a6e('0x58')];this['channels'][_0x490b1d[_0x0a6e('0x3c')]][_0x0a6e('0x60')]=_0x490b1d[_0x0a6e('0x5a')];if(_0x490b1d[_0x0a6e('0x58')]==='set'&&_[_0x0a6e('0x61')](_0x490b1d[_0x0a6e('0x5a')],_0x0a6e('0x62'))){var _0x901625=_0x490b1d[_0x0a6e('0x5a')][_0x0a6e('0x4b')]('=');var _0x56ae3f=_0x901625[0x0]['match'](/cdr\((.*)\)/);if(_0x56ae3f){this[_0x0a6e('0x1c')][_0x490b1d[_0x0a6e('0x3c')]][_0x56ae3f[0x1]]=_0x901625[0x1];}}else if(_0x490b1d[_0x0a6e('0x58')]===_0x0a6e('0x11')){this[_0x0a6e('0x1c')][_0x490b1d[_0x0a6e('0x3c')]]['queue']=_0x490b1d[_0x0a6e('0x5a')][_0x0a6e('0x4b')](',')[0x0];}}}}}catch(_0x284e9c){logger[_0x0a6e('0x40')](_0x0a6e('0x63'),_0x490b1d['uniqueid'],util['inspect'](_0x284e9c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0a6e('0x25')]=function(_0x765083){try{if(this[_0x0a6e('0x37')](_0x765083)){logger[_0x0a6e('0x31')](_0x0a6e('0x64'),_0x765083[_0x0a6e('0x3c')],_0x765083['linkedid'],_0x765083[_0x0a6e('0x39')],_0x765083[_0x0a6e('0x65')]);logger[_0x0a6e('0x3a')](_0x0a6e('0x66'),_0x765083[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x765083,{'showHidden':![],'depth':null}));if(_0x765083['uniqueid']!==_0x765083['linkedid']){if(this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]]){if(_0x765083['channelstate']==='6'){if(!this['channels'][_0x765083['linkedid']][_0x0a6e('0x67')]){var _0x5a693e=moment();this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x67')]=!![];this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]]['answertime']=_0x5a693e[_0x0a6e('0x45')](_0x0a6e('0x46'));if(this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x44')]){this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x68')]=_0x5a693e[_0x0a6e('0x69')](this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x44')],'seconds');}}this['channels'][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x57')]=_0x765083[_0x0a6e('0x3c')];if(_0x765083['calleridnum']!==_0x0a6e('0x6a')){this['channels'][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x6b')]=_0x765083[_0x0a6e('0x65')];}this[_0x0a6e('0x1c')][_0x765083['linkedid']][_0x0a6e('0x6c')]=_0x765083['calleridname'];this['channels'][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x6d')]=_0x765083[_0x0a6e('0x4c')];this['channels'][_0x765083['linkedid']][_0x0a6e('0x47')]=dispositions[_['toNumber'](_0x765083[_0x0a6e('0x6e')])];if(this[_0x0a6e('0x1d')][_0x765083['channel'][_0x0a6e('0x4b')]('-')[0x0]]){this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x57')]][_0x0a6e('0x6f')]=this[_0x0a6e('0x1d')][_0x765083[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]]['id'];this[_0x0a6e('0x1c')][_0x765083['linkedid']]['membername']=this[_0x0a6e('0x1d')][_0x765083['channel'][_0x0a6e('0x4b')]('-')[0x0]]['name'];}}}}else{if(this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x3c')]]){if(_0x765083[_0x0a6e('0x6e')]==='6'){if(this[_0x0a6e('0x1d')][_0x765083[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]]){this[_0x0a6e('0x1c')][_0x765083[_0x0a6e('0x3c')]][_0x0a6e('0x6f')]=this['agents'][_0x765083[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]]['id'];this[_0x0a6e('0x1c')][_0x765083['uniqueid']][_0x0a6e('0x70')]=this[_0x0a6e('0x1d')][_0x765083['channel']['split']('-')[0x0]][_0x0a6e('0x53')];}}}}}}catch(_0x5d634d){logger[_0x0a6e('0x40')](_0x0a6e('0x71'),_0x765083[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x5d634d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')][_0x0a6e('0x72')]=function(_0x8dbcc5,_0x2c1827){try{if(this[_0x0a6e('0x1c')][_0x8dbcc5]){logger[_0x0a6e('0x31')](_0x0a6e('0x73'),_0x8dbcc5,_0x2c1827);this[_0x0a6e('0x1c')][_0x8dbcc5][_0x0a6e('0x74')]=!![];if(_['endsWith'](_0x2c1827,_0x0a6e('0x75'))){_0x2c1827=_0x2c1827['replace'](_0x0a6e('0x75'),_0x0a6e('0x76'));}this[_0x0a6e('0x1c')][_0x8dbcc5]['monitorFilename']=_0x2c1827;var _0x5815e7=_[_0x0a6e('0x77')](this[_0x0a6e('0x1c')][_0x8dbcc5][_0x0a6e('0x78')],{'filename':_0x2c1827});if(_[_0x0a6e('0x79')](_0x5815e7)){this[_0x0a6e('0x1c')][_0x8dbcc5][_0x0a6e('0x78')][_0x0a6e('0x7a')]({'filename':_0x2c1827,'createdAt':moment()[_0x0a6e('0x45')](_0x0a6e('0x46')),'mixmonitorid':'','status':_0x0a6e('0x7b')});}}}catch(_0x23aba8){logger[_0x0a6e('0x40')](_0x0a6e('0x7c'),_0x8dbcc5,util[_0x0a6e('0x35')](_0x23aba8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')][_0x0a6e('0x27')]=function(_0x2cef4e){try{if(this['isNotNull'](_0x2cef4e)){logger[_0x0a6e('0x3a')](_0x0a6e('0x7d'),_0x2cef4e[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x2cef4e,{'showHidden':![],'depth':null}));if(this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x3c')]]&&_0x2cef4e['channel']!=_0x0a6e('0x43')){if(this[_0x0a6e('0x37')](_0x2cef4e['variable'])){if(this['isNotNull'](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x7f')])){logger[_0x0a6e('0x31')](_0x0a6e('0x80'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e['value']);this['syncMixMonitorFilename'](_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e[_0x0a6e('0x81')]);}else if(this[_0x0a6e('0x37')](_0x2cef4e['variable'][_0x0a6e('0x82')])){logger['info'](_0x0a6e('0x83'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e[_0x0a6e('0x81')]);this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x65')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x84')])){logger[_0x0a6e('0x31')](_0x0a6e('0x85'),_0x2cef4e['uniqueid'],_0x2cef4e[_0x0a6e('0x81')]);this['channels'][_0x2cef4e['uniqueid']][_0x0a6e('0x86')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x87')])){logger[_0x0a6e('0x31')](_0x0a6e('0x88'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e['value']);this[_0x0a6e('0x1c')][_0x2cef4e['uniqueid']][_0x0a6e('0x89')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this[_0x0a6e('0x37')](_0x2cef4e['variable'][_0x0a6e('0x8a')])){logger[_0x0a6e('0x31')](_0x0a6e('0x8b'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e[_0x0a6e('0x81')][_0x0a6e('0x4b')](',')[0x0]);this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x11')]=_0x2cef4e['value'][_0x0a6e('0x4b')](',')[0x0];}else if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x8c')])){logger[_0x0a6e('0x31')](_0x0a6e('0x8d'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e[_0x0a6e('0x81')]);this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x8e')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x8f')])){logger[_0x0a6e('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x2cef4e['uniqueid'],_0x2cef4e[_0x0a6e('0x81')]);this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x90')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this['isNotNull'](_0x2cef4e['variable'][_0x0a6e('0x91')])){logger[_0x0a6e('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x2cef4e['uniqueid'],_0x2cef4e['value']);this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x92')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x93')])){logger[_0x0a6e('0x31')](_0x0a6e('0x94'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e[_0x0a6e('0x81')]);this['channels'][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x11')]=_0x2cef4e[_0x0a6e('0x81')];}else if(this[_0x0a6e('0x37')](_0x2cef4e['variable'][_0x0a6e('0x95')])){logger[_0x0a6e('0x31')](_0x0a6e('0x96'),_0x2cef4e[_0x0a6e('0x3c')],_0x2cef4e[_0x0a6e('0x81')]);this['channels'][_0x2cef4e[_0x0a6e('0x3c')]][_0x0a6e('0x97')]=_0x2cef4e[_0x0a6e('0x81')];}}}else if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')][_0x0a6e('0x7f')])){if(_0x2cef4e[_0x0a6e('0x81')]){var _0x244096=path[_0x0a6e('0x98')](_0x2cef4e[_0x0a6e('0x81')])[_0x0a6e('0x53')];logger[_0x0a6e('0x31')](_0x0a6e('0x80'),_0x244096,_0x2cef4e[_0x0a6e('0x81')]);this[_0x0a6e('0x72')](_0x244096,_0x2cef4e[_0x0a6e('0x81')]);}}else if(this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x57')]]){if(this[_0x0a6e('0x37')](_0x2cef4e[_0x0a6e('0x7e')])){if(this['isNotNull'](_0x2cef4e[_0x0a6e('0x7e')]['sipcallid'])){logger[_0x0a6e('0x31')](_0x0a6e('0x96'),_0x2cef4e[_0x0a6e('0x57')],_0x2cef4e[_0x0a6e('0x81')]);this[_0x0a6e('0x1c')][_0x2cef4e[_0x0a6e('0x57')]][_0x0a6e('0x99')]=_0x2cef4e['value'];}}}}}catch(_0x40a861){logger[_0x0a6e('0x40')](_0x0a6e('0x9a'),_0x2cef4e[_0x0a6e('0x3c')],util['inspect'](_0x40a861,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')][_0x0a6e('0x9b')]=function(_0x1bc595){try{if(this[_0x0a6e('0x37')](_0x1bc595)){logger[_0x0a6e('0x3a')](_0x0a6e('0x9c'),_0x1bc595[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x1bc595,{'showHidden':![],'depth':null}));if(this[_0x0a6e('0x1c')][_0x1bc595['uniqueid']]){logger[_0x0a6e('0x31')](_0x0a6e('0x9d'),_0x1bc595[_0x0a6e('0x3c')],_0x1bc595[_0x0a6e('0x9e')]);var _0x717bab=moment();this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]][_0x0a6e('0x9f')]=_0x717bab['format'](_0x0a6e('0x46'));this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]][_0x0a6e('0x5c')]=_0x717bab[_0x0a6e('0x69')](this[_0x0a6e('0x1c')][_0x1bc595['uniqueid']][_0x0a6e('0x44')],_0x0a6e('0x5e'));if(this['channels'][_0x1bc595[_0x0a6e('0x3c')]][_0x0a6e('0x67')]){this[_0x0a6e('0x1c')][_0x1bc595['uniqueid']][_0x0a6e('0xa0')]=_0x717bab[_0x0a6e('0x69')](this['channels'][_0x1bc595[_0x0a6e('0x3c')]]['answertime'],'seconds');this[_0x0a6e('0x1c')][_0x1bc595['uniqueid']][_0x0a6e('0x68')]=this[_0x0a6e('0x1c')][_0x1bc595['uniqueid']][_0x0a6e('0x5c')]-this[_0x0a6e('0x1c')][_0x1bc595['uniqueid']][_0x0a6e('0xa0')];}if(_0x1bc595[_0x0a6e('0xa1')]==='from-sip'){if(this[_0x0a6e('0x1d')][_0x1bc595['channel'][_0x0a6e('0x4b')]('-')[0x0]]){this[_0x0a6e('0x1d')][_0x1bc595[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]]=_[_0x0a6e('0xa2')](this[_0x0a6e('0x1d')][_0x1bc595[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]],[_0x0a6e('0x4d')]);logger[_0x0a6e('0x3a')](_0x0a6e('0xa3'),_0x1bc595[_0x0a6e('0x3c')],util['inspect']({'destaccountcode':this[_0x0a6e('0x1d')][_0x1bc595[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]][_0x0a6e('0x50')]},{'showHidden':![],'depth':null}));this[_0x0a6e('0x51')](util[_0x0a6e('0x45')](_0x0a6e('0x52'),this[_0x0a6e('0x1d')][_0x1bc595['channel']['split']('-')[0x0]]['name']),_0x0a6e('0xa4'),{'destaccountcode':this['agents'][_0x1bc595[_0x0a6e('0x4c')][_0x0a6e('0x4b')]('-')[0x0]][_0x0a6e('0x50')]});}}if(_0x1bc595['event']===_0x0a6e('0xa5')){this[_0x0a6e('0x1e')][_0x1bc595[_0x0a6e('0x3c')]]=this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]];}else{if(this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]][_0x0a6e('0x89')]===_0x0a6e('0xa6')&&this[_0x0a6e('0x1e')][_0x1bc595['uniqueid']]){this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]][_0x0a6e('0x3c')]=[this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]]['linkedid'],this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]]['linkedid']=this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]]['uniqueid']][0x0];delete this[_0x0a6e('0x1e')][_0x1bc595['uniqueid']];}}logger[_0x0a6e('0x3a')](_0x0a6e('0xa7'),_0x1bc595[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',this[_0x0a6e('0x1c')][_0x1bc595[_0x0a6e('0x3c')]]);delete this['channels'][_0x1bc595[_0x0a6e('0x3c')]];}}}catch(_0x5c2104){logger['error'](_0x0a6e('0xa8'),_0x1bc595['uniqueid'],util['inspect'](_0x5c2104,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')]['syncAttendedTransfer']=function(_0x7a9a58){try{if(this[_0x0a6e('0x37')](_0x7a9a58)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x7a9a58[_0x0a6e('0x3c')],_0x7a9a58[_0x0a6e('0xa9')],_0x7a9a58[_0x0a6e('0xaa')]);logger[_0x0a6e('0x3a')](_0x0a6e('0xab'),_0x7a9a58[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x7a9a58,{'showHidden':![],'depth':null}));if(this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xac')]]){this['channels'][_0x7a9a58['transfereeuniqueid']][_0x0a6e('0xad')]=_0x7a9a58[_0x0a6e('0xa9')];this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xac')]][_0x0a6e('0xae')]=_0x7a9a58['transfertargetcalleridnum'];if(this[_0x0a6e('0x1c')][_0x7a9a58['secondtransfereruniqueid']]){var _0x97cc87=this['channels'][_0x7a9a58['secondtransfereruniqueid']];this['channels'][_0x7a9a58['secondtransfereruniqueid']]=this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xac')]];this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xac')]]=_0x97cc87;}}else if(this[_0x0a6e('0x1c')][_0x7a9a58['transfertargetuniqueid']]){this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xaf')]][_0x0a6e('0xad')]=_0x7a9a58[_0x0a6e('0xa9')];this['channels'][_0x7a9a58[_0x0a6e('0xaf')]][_0x0a6e('0xae')]=_0x7a9a58['transfertargetcalleridnum'];if(this[_0x0a6e('0x1c')][_0x7a9a58['origtransfereruniqueid']]){var _0x97cc87=this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xb0')]];this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xb0')]]=this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xaf')]];this[_0x0a6e('0x1c')][_0x7a9a58[_0x0a6e('0xaf')]]=_0x97cc87;}}}}catch(_0x33f725){logger[_0x0a6e('0x40')](_0x0a6e('0xb1'),_0x7a9a58['uniqueid'],util[_0x0a6e('0x35')](_0x33f725,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0a6e('0x36')][_0x0a6e('0xb2')]=function(_0x555355){try{if(this['isNotNull'](_0x555355)){logger[_0x0a6e('0x31')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x555355[_0x0a6e('0x3c')],_0x555355['transfereecalleridnum'],_0x555355[_0x0a6e('0xb3')]);logger[_0x0a6e('0x3a')](_0x0a6e('0xb4'),_0x555355[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x555355,{'showHidden':![],'depth':null}));if(this['channels'][_0x555355[_0x0a6e('0xac')]]){this[_0x0a6e('0x1c')][_0x555355['transfereeuniqueid']][_0x0a6e('0xad')]=_0x555355[_0x0a6e('0xb5')];this[_0x0a6e('0x1c')][_0x555355[_0x0a6e('0xac')]][_0x0a6e('0xae')]=_0x555355['extension'];this[_0x0a6e('0x9b')]({'event':_0x0a6e('0xa5'),'uniqueid':_0x555355[_0x0a6e('0xac')],'context':_0x555355[_0x0a6e('0xa1')],'channel':_0x555355[_0x0a6e('0xb6')]});}}}catch(_0x4845de){logger['error'](_0x0a6e('0xb7'),_0x555355['uniqueid'],util[_0x0a6e('0x35')](_0x4845de,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0a6e('0x2e')]=function(_0x1dd4ca){try{if(this[_0x0a6e('0x37')](_0x1dd4ca)){logger[_0x0a6e('0x3a')](_0x0a6e('0xb8'),_0x1dd4ca['uniqueid'],util[_0x0a6e('0x35')](_0x1dd4ca,{'showHidden':![],'depth':null}));if(this[_0x0a6e('0x1c')][_0x1dd4ca['uniqueid']]){if(!_['isNil'](this[_0x0a6e('0x1c')][_0x1dd4ca[_0x0a6e('0x3c')]][_0x0a6e('0xb9')])){this[_0x0a6e('0x1c')][_0x1dd4ca['uniqueid']]['mohstarttime']=moment()[_0x0a6e('0x45')](_0x0a6e('0x46'));logger[_0x0a6e('0x31')](_0x0a6e('0xba'),_0x1dd4ca[_0x0a6e('0x3c')],this[_0x0a6e('0x1c')][_0x1dd4ca['uniqueid']][_0x0a6e('0xbb')]);}}}}catch(_0x2681e8){logger[_0x0a6e('0x40')](_0x0a6e('0xbc'),_0x1dd4ca[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x2681e8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0a6e('0x30')]=function(_0x10f900){try{if(this[_0x0a6e('0x37')](_0x10f900)){logger[_0x0a6e('0x3a')](_0x0a6e('0xbd'),_0x10f900[_0x0a6e('0x3c')],util[_0x0a6e('0x35')](_0x10f900,{'showHidden':![],'depth':null}));if(this[_0x0a6e('0x1c')][_0x10f900['uniqueid']]){if(!_[_0x0a6e('0x79')](this[_0x0a6e('0x1c')][_0x10f900[_0x0a6e('0x3c')]][_0x0a6e('0xbb')])){this[_0x0a6e('0x1c')][_0x10f900[_0x0a6e('0x3c')]][_0x0a6e('0xbe')]+=moment()['milliseconds'](0x0)['diff'](this[_0x0a6e('0x1c')][_0x10f900[_0x0a6e('0x3c')]][_0x0a6e('0xbb')],_0x0a6e('0x5e'));logger['info'](_0x0a6e('0xbf'),_0x10f900[_0x0a6e('0x3c')],this['channels'][_0x10f900[_0x0a6e('0x3c')]][_0x0a6e('0xbe')]);delete this['channels'][_0x10f900[_0x0a6e('0x3c')]]['mohstarttime'];}}}}catch(_0x163cf7){logger['error']('[%s][voiceCallReport][musiconholdstop]',_0x10f900[_0x0a6e('0x3c')],util['inspect'](_0x163cf7,{'showHidden':![],'depth':null}));}};module[_0x0a6e('0xc0')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 3031f97..0887648 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc6a=['[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','seconds','complete','total','answertime','answered','holdtime','diff','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','variables','syncDialBegin','dialend','syncVarSet','hangup','syncHangup','bind','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xbc6a,0x1f2));var _0xabc6=function(_0x265d8d,_0xa72de7){_0x265d8d=_0x265d8d-0x0;var _0x46ed52=_0xbc6a[_0x265d8d];return _0x46ed52;};'use strict';var _=require(_0xabc6('0x0'));var moment=require(_0xabc6('0x1'));var util=require(_0xabc6('0x2'));var Redis=require(_0xabc6('0x3'));var config=require(_0xabc6('0x4'));var logger=require(_0xabc6('0x5'))(_0xabc6('0x6'));var ami=require(_0xabc6('0x7'));config[_0xabc6('0x8')]=_[_0xabc6('0x9')](config[_0xabc6('0x8')],{'host':_0xabc6('0xa'),'port':0x18eb});var io=require(_0xabc6('0xb'))(new Redis(config[_0xabc6('0x8')]));function VoiceDialReport(_0x2a0fe1){this[_0xabc6('0xc')]=_0x2a0fe1['outboundChannels'];this['outbound']=_0x2a0fe1[_0xabc6('0xd')];this[_0xabc6('0xe')]={};ami['on']('dialbegin',this[_0xabc6('0xf')]['bind'](this));ami['on'](_0xabc6('0x10'),this['syncDialEnd']['bind'](this));ami['on']('varset',this[_0xabc6('0x11')]['bind'](this));ami['on'](_0xabc6('0x12'),this[_0xabc6('0x13')][_0xabc6('0x14')](this));}VoiceDialReport[_0xabc6('0x15')][_0xabc6('0x16')]=function(_0x291e43){return _0x291e43!==null&&!_[_0xabc6('0x17')](_0x291e43);};VoiceDialReport['prototype'][_0xabc6('0x18')]=function(_0xfdf8a1,_0xe9f3e2,_0x17617b){io['to'](_0xfdf8a1)[_0xabc6('0x18')](_0xe9f3e2,_0x17617b);};VoiceDialReport['prototype'][_0xabc6('0xf')]=function(_0x3d8459){try{if(this[_0xabc6('0x16')](_0x3d8459)){logger[_0xabc6('0x19')](_0xabc6('0x1a'),_0x3d8459[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x3d8459,{'showHidden':![],'depth':null}));if(this[_0xabc6('0xc')][_0x3d8459[_0xabc6('0x1b')]]){_[_0xabc6('0x1d')](this[_0xabc6('0xc')][_0x3d8459[_0xabc6('0x1b')]],{'starttime':moment()[_0xabc6('0x1e')](_0xabc6('0x1f')),'lastevent':_0xabc6('0x20'),'interface':_0x3d8459[_0xabc6('0x21')][_0xabc6('0x22')](0x0,_0x3d8459[_0xabc6('0x21')][_0xabc6('0x23')]('-')),'membername':_0x3d8459[_0xabc6('0x21')][_0xabc6('0x22')](_0x3d8459[_0xabc6('0x21')]['lastIndexOf']('/')+0x1,_0x3d8459['channel']['lastIndexOf']('-'))},_[_0xabc6('0x24')](_0x3d8459,[_0xabc6('0x25'),_0xabc6('0x26')]));logger[_0xabc6('0x27')](_0xabc6('0x28'),_0x3d8459['uniqueid'],this['channels'][_0x3d8459[_0xabc6('0x1b')]]['membername'],this[_0xabc6('0xc')][_0x3d8459[_0xabc6('0x1b')]]['interface']);logger['debug'](_0xabc6('0x29'),_0x3d8459[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this['channels'][_0x3d8459[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));this[_0xabc6('0x18')](_0xabc6('0x2a'),_0xabc6('0x2b'),this['channels'][_0x3d8459[_0xabc6('0x1b')]]);logger[_0xabc6('0x19')](_0xabc6('0x2c'),_0x3d8459[_0xabc6('0x1b')],util['inspect'](this[_0xabc6('0xc')][_0x3d8459[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xabc6('0x18')](_0xabc6('0x2d'),this['channels'][_0x3d8459['uniqueid']]);}}}catch(_0x1dc797){logger[_0xabc6('0x2e')](_0xabc6('0x2f'),_0x3d8459[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x1dc797,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x119b8d){try{if(this['isNotNull'](_0x119b8d)){logger[_0xabc6('0x19')](_0xabc6('0x30'),_0x119b8d[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x119b8d,{'showHidden':![],'depth':null}));if(this['channels'][_0x119b8d[_0xabc6('0x1b')]]){this[_0xabc6('0xc')][_0x119b8d[_0xabc6('0x1b')]][_0xabc6('0x31')]=_0x119b8d[_0xabc6('0x31')];if(_0x119b8d[_0xabc6('0x31')]===_0xabc6('0x32')){this[_0xabc6('0xc')][_0x119b8d[_0xabc6('0x1b')]]['connectedlinenum']=_0x119b8d[_0xabc6('0x33')];this[_0xabc6('0xc')][_0x119b8d[_0xabc6('0x1b')]][_0xabc6('0x34')]=_0x119b8d[_0xabc6('0x34')];this[_0xabc6('0xc')][_0x119b8d['uniqueid']]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x119b8d[_0xabc6('0x1b')]][_0xabc6('0x35')]='connect';logger['info'](_0xabc6('0x36'),_0x119b8d[_0xabc6('0x1b')],_0x119b8d['channel']['substring'](_0x119b8d['channel'][_0xabc6('0x23')]('/')+0x1,_0x119b8d[_0xabc6('0x21')][_0xabc6('0x23')]('-')));logger[_0xabc6('0x19')](_0xabc6('0x37'),_0x119b8d[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this[_0xabc6('0xc')][_0x119b8d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xabc6('0x18')](_0xabc6('0x38'),this[_0xabc6('0xc')][_0x119b8d['uniqueid']]);}logger[_0xabc6('0x19')](_0xabc6('0x39'),_0x119b8d[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this[_0xabc6('0xc')][_0x119b8d[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));this[_0xabc6('0x18')](_0xabc6('0x2a'),'voice_outbound_channel:save',this[_0xabc6('0xc')][_0x119b8d[_0xabc6('0x1b')]]);}}}catch(_0x3b86b2){logger['error'](_0xabc6('0x3a'),_0x119b8d[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x3b86b2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xabc6('0x15')][_0xabc6('0x11')]=function(_0x3133aa){try{if(this['isNotNull'](_0x3133aa)){logger[_0xabc6('0x19')](_0xabc6('0x3b'),_0x3133aa[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x3133aa,{'showHidden':![],'depth':null}));this['addVariable'](_0x3133aa[_0xabc6('0x1b')],_[_0xabc6('0x3c')](_0x3133aa[_0xabc6('0x3d')])[0x0],_0x3133aa[_0xabc6('0x3e')]);if(this['isNotNull'](_0x3133aa[_0xabc6('0x3d')])&&this[_0xabc6('0x16')](_0x3133aa[_0xabc6('0x3d')][_0xabc6('0x3f')])){if(_[_0xabc6('0x17')](this[_0xabc6('0xc')][_0x3133aa[_0xabc6('0x1b')]])){this[_0xabc6('0xc')][_0x3133aa[_0xabc6('0x1b')]]={'routeId':_0x3133aa[_0xabc6('0x3e')],'variables':this[_0xabc6('0xe')][_0x3133aa[_0xabc6('0x1b')]]};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x3133aa['uniqueid'],_0x3133aa[_0xabc6('0x3d')]['outboundrouteid'],_['keys'](_0x3133aa[_0xabc6('0x3d')])[0x0],_0x3133aa[_0xabc6('0x3e')]);logger[_0xabc6('0x19')](_0xabc6('0x40'),_0x3133aa[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this[_0xabc6('0xc')][_0x3133aa[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));this[_0xabc6('0x18')](_0xabc6('0x2a'),_0xabc6('0x2b'),this[_0xabc6('0xc')][_0x3133aa[_0xabc6('0x1b')]]);}}}}catch(_0x2baed2){logger[_0xabc6('0x2e')](_0xabc6('0x41'),_0x3133aa[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x2baed2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xabc6('0x15')]['addVariable']=function(_0x57cc3c,_0x3ebc9e,_0x4d8259){var _0x2238a9=['rtpaudioqos','rtpaudioqosbridged',_0xabc6('0x42'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0xabc6('0x43'),_0xabc6('0x44'),_0xabc6('0x45'),_0xabc6('0x46'),_0xabc6('0x47'),_0xabc6('0x48'),_0xabc6('0x49'),_0xabc6('0x4a'),_0xabc6('0x4b'),_0xabc6('0x4c'),_0xabc6('0x4d'),_0xabc6('0x4e'),'memberrealtime'];if(!_[_0xabc6('0x4f')](_0x3ebc9e)&&!_[_0xabc6('0x50')](_0x2238a9,_0x3ebc9e)){if(_[_0xabc6('0x17')](this[_0xabc6('0xe')][_0x57cc3c])){this[_0xabc6('0xe')][_0x57cc3c]={};}this['variables'][_0x57cc3c][_0x3ebc9e]=_0x4d8259;}};VoiceDialReport[_0xabc6('0x15')][_0xabc6('0x13')]=function(_0x3e26c2){try{if(this['isNotNull'](_0x3e26c2)){logger[_0xabc6('0x19')](_0xabc6('0x51'),_0x3e26c2[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x3e26c2,{'showHidden':![],'depth':null}));if(this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]]){logger[_0xabc6('0x27')](_0xabc6('0x52'),_0x3e26c2[_0xabc6('0x1b')],_0x3e26c2[_0xabc6('0x53')]);this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x54')]=moment()[_0xabc6('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x55')]=moment(this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x54')])['diff'](this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]]['starttime'],_0xabc6('0x56'));this[_0xabc6('0xc')][_0x3e26c2['uniqueid']][_0xabc6('0x35')]=_0xabc6('0x57');this[_0xabc6('0xd')][_0xabc6('0x58')]+=0x1;if(this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x59')]){this[_0xabc6('0xd')][_0xabc6('0x5a')]+=0x1;this[_0xabc6('0xc')][_0x3e26c2['uniqueid']][_0xabc6('0x5b')]=moment(this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x59')])[_0xabc6('0x5c')](this[_0xabc6('0xc')][_0x3e26c2['uniqueid']]['starttime'],_0xabc6('0x56'));this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x5d')]=moment(this['channels'][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x54')])['diff'](this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x59')],_0xabc6('0x56'));this[_0xabc6('0xd')][_0xabc6('0x5e')]+=this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x5b')]||0x0;this[_0xabc6('0xd')][_0xabc6('0x5f')]+=this[_0xabc6('0xc')][_0x3e26c2['uniqueid']][_0xabc6('0x5d')];}this['outbound'][_0xabc6('0x60')]+=this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]][_0xabc6('0x55')];logger[_0xabc6('0x19')](_0xabc6('0x61'),_0x3e26c2[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this['channels'][_0x3e26c2[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0xabc6('0xc')][_0x3e26c2['uniqueid']]);logger[_0xabc6('0x19')](_0xabc6('0x62'),_0x3e26c2[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xabc6('0x63'),this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x3e26c2[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));this[_0xabc6('0x18')](_0xabc6('0x2a'),_0xabc6('0x64'),this[_0xabc6('0xd')]);logger['info'](_0xabc6('0x65'),JSON[_0xabc6('0x66')](this['channels'][_0x3e26c2[_0xabc6('0x1b')]]));logger[_0xabc6('0x19')](_0xabc6('0x67'),_0x3e26c2[_0xabc6('0x1b')],util[_0xabc6('0x1c')](this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]],{'showHidden':![],'depth':null}));this[_0xabc6('0x18')](_0xabc6('0x2a'),_0xabc6('0x68'),this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]]);delete this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x1b')]];}else if(this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x69')]]){this[_0xabc6('0xc')][_0x3e26c2['linkedid']]['uniqueid']=this[_0xabc6('0xc')][_0x3e26c2[_0xabc6('0x69')]][_0xabc6('0x6a')];}if(this['variables'][_0x3e26c2[_0xabc6('0x1b')]]){delete this['variables'][_0x3e26c2[_0xabc6('0x1b')]];}}}catch(_0x590e8e){logger[_0xabc6('0x2e')](_0xabc6('0x6b'),_0x3e26c2[_0xabc6('0x1b')],util[_0xabc6('0x1c')](_0x590e8e,{'showHidden':![],'depth':null}));}};module[_0xabc6('0x6c')]=VoiceDialReport; \ No newline at end of file +var _0xdae6=['rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','starttime','lastevent','complete','total','answertime','answered','seconds','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','hangup','prototype','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','emit','voice_outbound_channel:save','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice:outbound','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x239632,_0x472e6a){var _0x2fad25=function(_0x2c7e31){while(--_0x2c7e31){_0x239632['push'](_0x239632['shift']());}};_0x2fad25(++_0x472e6a);}(_0xdae6,0x1d1));var _0x6dae=function(_0x1d2a42,_0x47635d){_0x1d2a42=_0x1d2a42-0x0;var _0x18c586=_0xdae6[_0x1d2a42];return _0x18c586;};'use strict';var _=require(_0x6dae('0x0'));var moment=require(_0x6dae('0x1'));var util=require(_0x6dae('0x2'));var Redis=require(_0x6dae('0x3'));var config=require(_0x6dae('0x4'));var logger=require(_0x6dae('0x5'))(_0x6dae('0x6'));var ami=require(_0x6dae('0x7'));config[_0x6dae('0x8')]=_[_0x6dae('0x9')](config[_0x6dae('0x8')],{'host':_0x6dae('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6dae('0x8')]));function VoiceDialReport(_0x5bb89a){this['channels']=_0x5bb89a[_0x6dae('0xb')];this[_0x6dae('0xc')]=_0x5bb89a[_0x6dae('0xc')];this[_0x6dae('0xd')]={};ami['on'](_0x6dae('0xe'),this[_0x6dae('0xf')][_0x6dae('0x10')](this));ami['on'](_0x6dae('0x11'),this[_0x6dae('0x12')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x6dae('0x10')](this));ami['on'](_0x6dae('0x13'),this['syncHangup'][_0x6dae('0x10')](this));}VoiceDialReport[_0x6dae('0x14')][_0x6dae('0x15')]=function(_0x5df789){return _0x5df789!==null&&!_['isUndefined'](_0x5df789);};VoiceDialReport[_0x6dae('0x14')]['emit']=function(_0x1e4a9a,_0x18ce8a,_0x15b788){io['to'](_0x1e4a9a)['emit'](_0x18ce8a,_0x15b788);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x58ba09){try{if(this['isNotNull'](_0x58ba09)){logger['debug'](_0x6dae('0x16'),_0x58ba09['uniqueid'],util[_0x6dae('0x17')](_0x58ba09,{'showHidden':![],'depth':null}));if(this['channels'][_0x58ba09[_0x6dae('0x18')]]){_[_0x6dae('0x19')](this[_0x6dae('0x1a')][_0x58ba09[_0x6dae('0x18')]],{'starttime':moment()[_0x6dae('0x1b')](_0x6dae('0x1c')),'lastevent':_0x6dae('0x1d'),'interface':_0x58ba09[_0x6dae('0x1e')]['substring'](0x0,_0x58ba09[_0x6dae('0x1e')][_0x6dae('0x1f')]('-')),'membername':_0x58ba09[_0x6dae('0x1e')]['substring'](_0x58ba09[_0x6dae('0x1e')][_0x6dae('0x1f')]('/')+0x1,_0x58ba09[_0x6dae('0x1e')][_0x6dae('0x1f')]('-'))},_['omit'](_0x58ba09,[_0x6dae('0x20'),_0x6dae('0x21')]));logger[_0x6dae('0x22')](_0x6dae('0x23'),_0x58ba09[_0x6dae('0x18')],this[_0x6dae('0x1a')][_0x58ba09[_0x6dae('0x18')]]['membername'],this['channels'][_0x58ba09[_0x6dae('0x18')]][_0x6dae('0x24')]);logger['debug'](_0x6dae('0x25'),_0x58ba09[_0x6dae('0x18')],util[_0x6dae('0x17')](this[_0x6dae('0x1a')][_0x58ba09[_0x6dae('0x18')]],{'showHidden':![],'depth':null}));this[_0x6dae('0x26')]('voice:outbound',_0x6dae('0x27'),this['channels'][_0x58ba09[_0x6dae('0x18')]]);logger[_0x6dae('0x28')](_0x6dae('0x29'),_0x58ba09[_0x6dae('0x18')],util['inspect'](this['channels'][_0x58ba09[_0x6dae('0x18')]],{'showHidden':![],'depth':null}));ami[_0x6dae('0x26')]('custom:dialbegin',this[_0x6dae('0x1a')][_0x58ba09[_0x6dae('0x18')]]);}}}catch(_0x4ed9f1){logger[_0x6dae('0x2a')](_0x6dae('0x2b'),_0x58ba09[_0x6dae('0x18')],util[_0x6dae('0x17')](_0x4ed9f1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6dae('0x14')][_0x6dae('0x12')]=function(_0x155f6f){try{if(this['isNotNull'](_0x155f6f)){logger['debug'](_0x6dae('0x2c'),_0x155f6f[_0x6dae('0x18')],util[_0x6dae('0x17')](_0x155f6f,{'showHidden':![],'depth':null}));if(this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]]){this['channels'][_0x155f6f[_0x6dae('0x18')]]['dialstatus']=_0x155f6f[_0x6dae('0x2d')];if(_0x155f6f[_0x6dae('0x2d')]==='ANSWER'){this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]][_0x6dae('0x2e')]=_0x155f6f['connectedlinenum'];this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]]['connectedlinename']=_0x155f6f['connectedlinename'];this['channels'][_0x155f6f[_0x6dae('0x18')]]['answertime']=moment()[_0x6dae('0x1b')](_0x6dae('0x1c'));this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]]['lastevent']=_0x6dae('0x2f');logger[_0x6dae('0x22')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x155f6f[_0x6dae('0x18')],_0x155f6f[_0x6dae('0x1e')][_0x6dae('0x30')](_0x155f6f[_0x6dae('0x1e')][_0x6dae('0x1f')]('/')+0x1,_0x155f6f['channel'][_0x6dae('0x1f')]('-')));logger[_0x6dae('0x28')](_0x6dae('0x31'),_0x155f6f[_0x6dae('0x18')],util['inspect'](this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6dae('0x32'),this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]]);}logger[_0x6dae('0x28')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x155f6f[_0x6dae('0x18')],util['inspect'](this[_0x6dae('0x1a')][_0x155f6f[_0x6dae('0x18')]],{'showHidden':![],'depth':null}));this[_0x6dae('0x26')](_0x6dae('0x33'),_0x6dae('0x27'),this['channels'][_0x155f6f[_0x6dae('0x18')]]);}}}catch(_0x31ce72){logger[_0x6dae('0x2a')](_0x6dae('0x34'),_0x155f6f[_0x6dae('0x18')],util[_0x6dae('0x17')](_0x31ce72,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6dae('0x14')][_0x6dae('0x35')]=function(_0x23fab8){try{if(this[_0x6dae('0x15')](_0x23fab8)){logger[_0x6dae('0x28')](_0x6dae('0x36'),_0x23fab8['uniqueid'],util['inspect'](_0x23fab8,{'showHidden':![],'depth':null}));this['addVariable'](_0x23fab8[_0x6dae('0x18')],_[_0x6dae('0x37')](_0x23fab8[_0x6dae('0x38')])[0x0],_0x23fab8[_0x6dae('0x39')]);if(this[_0x6dae('0x15')](_0x23fab8['variable'])&&this[_0x6dae('0x15')](_0x23fab8[_0x6dae('0x38')][_0x6dae('0x3a')])){if(_[_0x6dae('0x3b')](this[_0x6dae('0x1a')][_0x23fab8[_0x6dae('0x18')]])){this['channels'][_0x23fab8['uniqueid']]={'routeId':_0x23fab8[_0x6dae('0x39')],'variables':this[_0x6dae('0xd')][_0x23fab8[_0x6dae('0x18')]]};logger[_0x6dae('0x22')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x23fab8[_0x6dae('0x18')],_0x23fab8[_0x6dae('0x38')]['outboundrouteid'],_[_0x6dae('0x37')](_0x23fab8[_0x6dae('0x38')])[0x0],_0x23fab8['value']);logger[_0x6dae('0x28')](_0x6dae('0x3c'),_0x23fab8['uniqueid'],util[_0x6dae('0x17')](this[_0x6dae('0x1a')][_0x23fab8['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x6dae('0x1a')][_0x23fab8[_0x6dae('0x18')]]);}}}}catch(_0x2e992b){logger['error'](_0x6dae('0x3d'),_0x23fab8[_0x6dae('0x18')],util['inspect'](_0x2e992b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6dae('0x14')][_0x6dae('0x3e')]=function(_0x26172a,_0x376686,_0x3f2c71){var _0xf84a83=[_0x6dae('0x3f'),_0x6dae('0x40'),_0x6dae('0x41'),_0x6dae('0x42'),_0x6dae('0x43'),_0x6dae('0x44'),_0x6dae('0x45'),_0x6dae('0x46'),_0x6dae('0x47'),_0x6dae('0x48'),_0x6dae('0x49'),_0x6dae('0x4a'),_0x6dae('0x4b'),_0x6dae('0x4c'),_0x6dae('0x4d'),'memberlastcall','membername','memberpenalty','memberrealtime'];if(!_[_0x6dae('0x4e')](_0x376686)&&!_[_0x6dae('0x4f')](_0xf84a83,_0x376686)){if(_[_0x6dae('0x3b')](this['variables'][_0x26172a])){this[_0x6dae('0xd')][_0x26172a]={};}this[_0x6dae('0xd')][_0x26172a][_0x376686]=_0x3f2c71;}};VoiceDialReport[_0x6dae('0x14')][_0x6dae('0x50')]=function(_0x2c70c4){try{if(this[_0x6dae('0x15')](_0x2c70c4)){logger[_0x6dae('0x28')](_0x6dae('0x51'),_0x2c70c4[_0x6dae('0x18')],util['inspect'](_0x2c70c4,{'showHidden':![],'depth':null}));if(this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]){logger[_0x6dae('0x22')](_0x6dae('0x52'),_0x2c70c4[_0x6dae('0x18')],_0x2c70c4[_0x6dae('0x53')]);this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]['endtime']=moment()[_0x6dae('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6dae('0x1a')][_0x2c70c4['uniqueid']][_0x6dae('0x54')]=moment(this[_0x6dae('0x1a')][_0x2c70c4['uniqueid']][_0x6dae('0x55')])[_0x6dae('0x56')](this['channels'][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x57')],'seconds');this['channels'][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x58')]=_0x6dae('0x59');this[_0x6dae('0xc')][_0x6dae('0x5a')]+=0x1;if(this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x5b')]){this[_0x6dae('0xc')][_0x6dae('0x5c')]+=0x1;this['channels'][_0x2c70c4['uniqueid']]['holdtime']=moment(this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]['answertime'])[_0x6dae('0x56')](this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]['starttime'],_0x6dae('0x5d'));this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x5e')]=moment(this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x55')])[_0x6dae('0x56')](this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]['answertime'],_0x6dae('0x5d'));this[_0x6dae('0xc')][_0x6dae('0x5f')]+=this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]['holdtime']||0x0;this[_0x6dae('0xc')]['sumBillable']+=this['channels'][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x5e')];}this['outbound'][_0x6dae('0x60')]+=this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]][_0x6dae('0x54')];logger['debug'](_0x6dae('0x61'),_0x2c70c4['uniqueid'],util[_0x6dae('0x17')](this[_0x6dae('0x1a')][_0x2c70c4['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x6dae('0x26')](_0x6dae('0x62'),this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]);logger[_0x6dae('0x28')](_0x6dae('0x63'),_0x2c70c4[_0x6dae('0x18')],util[_0x6dae('0x17')](this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]],{'showHidden':![],'depth':null}));ami[_0x6dae('0x26')](_0x6dae('0x64'),this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x18')]]);logger[_0x6dae('0x28')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x2c70c4['uniqueid'],util[_0x6dae('0x17')](this['channels'][_0x2c70c4[_0x6dae('0x18')]],{'showHidden':![],'depth':null}));this[_0x6dae('0x26')](_0x6dae('0x33'),_0x6dae('0x65'),this[_0x6dae('0xc')]);logger[_0x6dae('0x22')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x6dae('0x66')](this['channels'][_0x2c70c4[_0x6dae('0x18')]]));logger[_0x6dae('0x28')](_0x6dae('0x67'),_0x2c70c4[_0x6dae('0x18')],util[_0x6dae('0x17')](this['channels'][_0x2c70c4['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6dae('0x26')](_0x6dae('0x33'),_0x6dae('0x68'),this['channels'][_0x2c70c4['uniqueid']]);delete this['channels'][_0x2c70c4[_0x6dae('0x18')]];}else if(this['channels'][_0x2c70c4[_0x6dae('0x69')]]){this[_0x6dae('0x1a')][_0x2c70c4[_0x6dae('0x69')]][_0x6dae('0x18')]=this[_0x6dae('0x1a')][_0x2c70c4['linkedid']]['destuniqueid'];}if(this[_0x6dae('0xd')][_0x2c70c4[_0x6dae('0x18')]]){delete this[_0x6dae('0xd')][_0x2c70c4['uniqueid']];}}}catch(_0xbcf262){logger[_0x6dae('0x2a')]('[%s][voiceDialReport][hangup]',_0x2c70c4[_0x6dae('0x18')],util[_0x6dae('0x17')](_0xbcf262,{'showHidden':![],'depth':null}));}};module[_0x6dae('0x6a')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 0b861b7..3e5091f 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4287=['linkedid','last','queuecallerjoinAt','add','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','length','unmanaged','seconds','diff','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','md5','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','agents','channels','queueChannels','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','clearZombieChannels','switch','isNil','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','queueReports','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save','[%s][voiceQueueReport][','emitVoiceQueueSummary','type','inbound','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','total','abandoned','Trunk','callerid','Interval','debug','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','Action','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20name:%s','callers','voiceQueues','toNumber','loggedIn','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/'];(function(_0xa78f84,_0x1e3295){var _0x29a66a=function(_0x47a178){while(--_0x47a178){_0xa78f84['push'](_0xa78f84['shift']());}};_0x29a66a(++_0x1e3295);}(_0x4287,0x114));var _0x7428=function(_0x53d650,_0x380fe7){_0x53d650=_0x53d650-0x0;var _0x1405a4=_0x4287[_0x53d650];return _0x1405a4;};'use strict';var _=require(_0x7428('0x0'));var moment=require(_0x7428('0x1'));var util=require(_0x7428('0x2'));var md5=require(_0x7428('0x3'));var Redis=require('ioredis');var config=require(_0x7428('0x4'));var logger=require('../../../config/logger')(_0x7428('0x5'));var ami=require(_0x7428('0x6'));var QueueReport=require(_0x7428('0x7'));config[_0x7428('0x8')]=_[_0x7428('0x9')](config[_0x7428('0x8')],{'host':_0x7428('0xa'),'port':0x18eb});var io=require(_0x7428('0xb'))(new Redis(config[_0x7428('0x8')]));var Sequence=function(){};Sequence[_0x7428('0xc')]['enqueue']=function(_0x1710ae){this[_0x7428('0xd')]=this['tail']?this[_0x7428('0xd')][_0x7428('0xe')](_0x1710ae):_0x1710ae();};function VoiceQueueReport(_0x4fa874){this[_0x7428('0xf')]=new Sequence();this['queueReports']={};this[_0x7428('0x10')]=_0x4fa874[_0x7428('0x10')];this[_0x7428('0x11')]=_0x4fa874[_0x7428('0x12')];this['voiceQueues']=_0x4fa874['voiceQueues'];this[_0x7428('0x13')]=!![];this[_0x7428('0x14')]=_0x4fa874[_0x7428('0x14')];this[_0x7428('0x15')]={};ami['on'](_0x7428('0x16'),this['syncQueueSummary'][_0x7428('0x17')](this));ami['on'](_0x7428('0x18'),this[_0x7428('0x19')][_0x7428('0x17')](this));ami['on'](_0x7428('0x1a'),this['syncQueueCallerJoin'][_0x7428('0x17')](this));ami['on'](_0x7428('0x1b'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave'][_0x7428('0x17')](this));ami['on'](_0x7428('0x1c'),this[_0x7428('0x1d')][_0x7428('0x17')](this));ami['on'](_0x7428('0x1e'),this[_0x7428('0x1f')][_0x7428('0x17')](this));ami['on'](_0x7428('0x20'),this[_0x7428('0x21')]['bind'](this));ami['on'](_0x7428('0x22'),this[_0x7428('0x23')]['bind'](this));ami['on'](_0x7428('0x24'),this[_0x7428('0x25')][_0x7428('0x17')](this));ami['on'](_0x7428('0x26'),this[_0x7428('0x27')]['bind'](this));ami['on']('musiconholdstop',this[_0x7428('0x28')][_0x7428('0x17')](this));ami['on'](_0x7428('0x29'),this[_0x7428('0x2a')][_0x7428('0x17')](this));ami['on'](_0x7428('0x2b'),this[_0x7428('0x2c')][_0x7428('0x17')](this));this[_0x7428('0x2d')]();this['loopQueueShow']();}function clearChannels(_0x4fc5a){if(!_[_0x7428('0x2e')](_0x4fc5a)){for(var _0x3224fc in _0x4fc5a){if(_0x4fc5a[_0x7428('0x2f')](_0x3224fc)){delete _0x4fc5a[_0x3224fc];}}}}function clearCampaigns(_0x18e70f){if(!_[_0x7428('0x2e')](_0x18e70f)){for(var _0x1495b1 in _0x18e70f){if(_0x18e70f[_0x7428('0x2f')](_0x1495b1)){_0x18e70f[_0x1495b1][_0x7428('0x30')]=0x0;}}}}function clearVoiceQueues(_0x327f7d){if(!_[_0x7428('0x2e')](_0x327f7d)){for(var _0x2f9669 in _0x327f7d){if(_0x327f7d[_0x7428('0x2f')](_0x2f9669)){_0x327f7d[_0x2f9669][_0x7428('0x30')]=0x0;_0x327f7d[_0x2f9669][_0x7428('0x31')]=0x0;_0x327f7d[_0x2f9669][_0x7428('0x32')]=0x0;_0x327f7d[_0x2f9669][_0x7428('0x33')]=0x0;_0x327f7d[_0x2f9669]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x40b8b2){if(!_[_0x7428('0x2e')](_0x40b8b2)){for(var _0x5e1c77 in _0x40b8b2){if(_0x40b8b2[_0x7428('0x2f')](_0x5e1c77)){_0x40b8b2[_0x5e1c77][_0x7428('0x34')]=!![];}}}}VoiceQueueReport[_0x7428('0xc')][_0x7428('0x35')]=function(){var _0x1a7262=this;for(var _0x37a87e in this[_0x7428('0x11')]){if(this[_0x7428('0x11')][_0x7428('0x2f')](_0x37a87e)&&!this[_0x7428('0x11')][_0x37a87e][_0x7428('0x36')]){this[_0x7428('0xf')]['enqueue'](function(){if(!_[_0x7428('0x37')](_0x1a7262[_0x7428('0x11')][_0x37a87e])){return ami['Action']({'action':_0x7428('0x38'),'channel':_0x1a7262[_0x7428('0x11')][_0x37a87e][_0x7428('0x39')]})[_0x7428('0x3a')](function(_0x46418b){if(_0x46418b[_0x7428('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1a7262[_0x7428('0x11')][_0x37a87e]){delete _0x1a7262[_0x7428('0x11')][_0x37a87e];logger[_0x7428('0x3c')](_0x7428('0x3d'),_0x37a87e,util['inspect'](_0x46418b,{'showHidden':![],'depth':null}));}if(_0x1a7262['queueReports'][_0x37a87e]){delete _0x1a7262['queueReports'][_0x37a87e];logger[_0x7428('0x3c')]('[%s][voiceQueueReport][checkQueueReport]',_0x37a87e,util[_0x7428('0x3e')](_0x46418b,{'showHidden':![],'depth':null}));}if(_0x1a7262[_0x7428('0x15')][_0x37a87e]){delete _0x1a7262[_0x7428('0x15')][_0x37a87e];logger[_0x7428('0x3c')](_0x7428('0x3f'),_0x37a87e,util[_0x7428('0x3e')](_0x46418b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x25')]=function(){logger[_0x7428('0x3c')](_0x7428('0x40'));clearChannels(this[_0x7428('0x11')]);this[_0x7428('0x41')](this[_0x7428('0x42')]);clearAgentBooked(this[_0x7428('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x7428('0x14')]);};VoiceQueueReport[_0x7428('0xc')]['clearQueueReport']=function(_0x4bd041){var _0x5dbcd1=this;if(!_[_0x7428('0x2e')](_0x4bd041)){for(var _0x191f85 in _0x4bd041){if(_0x4bd041[_0x7428('0x2f')](_0x191f85)){_0x5dbcd1[_0x7428('0x43')](_0x4bd041[_0x191f85],'clearqueuereport');delete _0x4bd041[_0x191f85];}}}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x44')]=function(_0x1e3109,_0x427e86,_0x3a9b7d){io['to'](_0x1e3109)['emit'](_0x427e86,_0x3a9b7d);};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x45')]=function(_0x3bb117,_0x210402){logger['debug']('[%s][voiceQueueReport]['+_0x210402+_0x7428('0x46'),_0x3bb117[_0x7428('0x47')],util['inspect'](_0x3bb117,{'showHidden':![],'depth':null}));this[_0x7428('0x44')](util[_0x7428('0x48')](_0x7428('0x49'),_0x3bb117[_0x7428('0x4a')]),_0x7428('0x4b'),_0x3bb117);};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x43')]=function(_0x1ba944,_0x3365f8){logger['debug'](_0x7428('0x4c')+_0x3365f8+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x1ba944[_0x7428('0x47')],util['inspect'](_0x1ba944,{'showHidden':![],'depth':null}));this[_0x7428('0x44')](util[_0x7428('0x48')](_0x7428('0x49'),_0x1ba944['name']),'voice_queue_channel:remove',_0x1ba944);};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x4d')]=function(_0x326534,_0x1ad446){if(_0x326534[_0x7428('0x4e')]===_0x7428('0x4f')){var _0x321af5={'id':_0x326534['id'],'name':_0x326534[_0x7428('0x4a')],'strategy':_0x326534[_0x7428('0x50')],'answered':_0x326534[_0x7428('0x51')],'available':_0x326534[_0x7428('0x52')],'loggedIn':_0x326534['loggedIn'],'pTalking':_0x326534['pTalking'],'sumBillable':_0x326534[_0x7428('0x53')],'sumDuration':_0x326534[_0x7428('0x54')],'sumHoldTime':_0x326534[_0x7428('0x55')]||0x0,'talking':_0x326534[_0x7428('0x31')],'total':_0x326534[_0x7428('0x56')],'type':_0x326534[_0x7428('0x4e')],'unmanaged':_0x326534['unmanaged'],'abandoned':_0x326534[_0x7428('0x57')],'waiting':_0x326534['waiting']};if(_0x326534[_0x7428('0x58')]){_0x321af5[_0x7428('0x58')]={'id':_0x326534[_0x7428('0x58')]['id'],'name':_0x326534['Trunk']['name'],'active':_0x326534[_0x7428('0x58')]['active'],'callerid':_0x326534[_0x7428('0x58')][_0x7428('0x59')]};}if(_0x326534[_0x7428('0x5a')]){_0x321af5[_0x7428('0x5a')]={'id':_0x326534[_0x7428('0x5a')]['id'],'name':_0x326534[_0x7428('0x5a')][_0x7428('0x4a')]};}var _0x4833a7=md5(JSON['stringify'](_0x321af5));if(_0x326534[_0x7428('0x3')]!==_0x4833a7){_0x326534['md5']=_0x4833a7;logger[_0x7428('0x5b')](_0x7428('0x5c')+_0x1ad446+_0x7428('0x5d'),util[_0x7428('0x3e')](_0x321af5,{'showHidden':![],'depth':null}));this[_0x7428('0x44')](util[_0x7428('0x48')]('voice:queue:%s',_0x321af5['name']),_0x7428('0x5e'),_0x321af5);}}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x5f')]=function(_0x450dd7){return _0x450dd7!==null&&!_['isUndefined'](_0x450dd7);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x26a675=this;setInterval(function(){_0x26a675[_0x7428('0x35')]();ami[_0x7428('0x60')]({'action':_0x7428('0x61')})['catch'](function(_0xe7b7fc){logger[_0x7428('0x3c')](_0x7428('0x62'),util[_0x7428('0x3e')](_0xe7b7fc,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x2d')]=function(){var _0x40ed52=this;setInterval(function(){if(_0x40ed52[_0x7428('0x13')]){return ami['Action']({'action':'queuesummary'})[_0x7428('0x63')](function(_0x33e1a7){_0x40ed52[_0x7428('0x13')]=![];})[_0x7428('0x3a')](function(_0x3b7261){logger[_0x7428('0x3c')](_0x7428('0x64'),util['inspect'](_0x3b7261,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x65')]=function(_0x4b8c1b){try{if(this['isNotNull'](_0x4b8c1b)&&this[_0x7428('0x5f')](_0x4b8c1b[_0x7428('0x66')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x7428('0x3e')](_0x4b8c1b,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x4b8c1b[_0x7428('0x66')]]){logger['info'](_0x7428('0x67'),_0x4b8c1b['queue']);var _0x5b948c=_['countBy'](this['channels'],_0x7428('0x66'))[_0x4b8c1b['queue']]||0x0;var _0x4ceb4f=_0x5b948c-_0x4b8c1b[_0x7428('0x68')];if(this[_0x7428('0x69')][_0x4b8c1b[_0x7428('0x66')]]['waiting']!==_[_0x7428('0x6a')](_0x4b8c1b[_0x7428('0x68')])||this['voiceQueues'][_0x4b8c1b[_0x7428('0x66')]][_0x7428('0x6b')]!==_[_0x7428('0x6a')](_0x4b8c1b['loggedin'])||this[_0x7428('0x69')][_0x4b8c1b[_0x7428('0x66')]]['available']!==_[_0x7428('0x6a')](_0x4b8c1b[_0x7428('0x52')])||this['voiceQueues'][_0x4b8c1b['queue']][_0x7428('0x31')]!==_0x4ceb4f){this['voiceQueues'][_0x4b8c1b[_0x7428('0x66')]][_0x7428('0x33')]=_[_0x7428('0x6a')](_0x4b8c1b[_0x7428('0x68')]);this[_0x7428('0x69')][_0x4b8c1b[_0x7428('0x66')]]['loggedIn']=_[_0x7428('0x6a')](_0x4b8c1b[_0x7428('0x6c')]);this['voiceQueues'][_0x4b8c1b['queue']][_0x7428('0x52')]=_['toNumber'](_0x4b8c1b['available']);this[_0x7428('0x69')][_0x4b8c1b[_0x7428('0x66')]][_0x7428('0x31')]=_0x4ceb4f>0x0?_0x4ceb4f:0x0;this[_0x7428('0x69')][_0x4b8c1b['queue']]['talking']=this[_0x7428('0x69')][_0x4b8c1b[_0x7428('0x66')]][_0x7428('0x31')]>_[_0x7428('0x6a')](_0x4b8c1b[_0x7428('0x6c')])?_[_0x7428('0x6a')](_0x4b8c1b[_0x7428('0x6c')]):this[_0x7428('0x69')][_0x4b8c1b[_0x7428('0x66')]][_0x7428('0x31')];this[_0x7428('0x4d')](this[_0x7428('0x69')][_0x4b8c1b['queue']],'queuesummary');}logger[_0x7428('0x5b')](_0x7428('0x6d'),util['inspect'](this['voiceQueues'][_0x4b8c1b[_0x7428('0x66')]],{'showHidden':![],'depth':null}));ami[_0x7428('0x44')]('custom:queuesummary',this['voiceQueues'][_0x4b8c1b[_0x7428('0x66')]]);}}}catch(_0x51e544){logger['error'](_0x7428('0x64'),util[_0x7428('0x3e')](_0x51e544,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x19')]=function(_0x51fdfa){logger[_0x7428('0x5b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x7428('0x3e')](_0x51fdfa,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x7428('0xc')]['syncQueueCallerJoin']=function(_0x28ab0d){try{if(this[_0x7428('0x5f')](_0x28ab0d)){logger[_0x7428('0x5b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x28ab0d[_0x7428('0x47')],util['inspect'](_0x28ab0d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7428('0x42')][_0x28ab0d['uniqueid']])){this[_0x7428('0x42')][_0x28ab0d[_0x7428('0x47')]]=[];this[_0x7428('0x11')][_0x28ab0d['uniqueid']]={};}var _0x53de59=new QueueReport();_0x53de59[_0x7428('0x4a')]=_0x28ab0d[_0x7428('0x66')];_0x53de59['type']=this[_0x7428('0x69')][_0x53de59[_0x7428('0x4a')]]&&this['voiceQueues'][_0x53de59['name']][_0x7428('0x4e')]?this[_0x7428('0x69')][_0x53de59['name']][_0x7428('0x4e')]||_0x7428('0x4f'):_0x7428('0x4f');_0x53de59[_0x7428('0x66')]=_0x28ab0d[_0x7428('0x66')];_0x53de59['queuecallerjoinAt']=moment()[_0x7428('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x53de59[_0x7428('0x6e')]=_0x28ab0d[_0x7428('0x6e')];_0x53de59[_0x7428('0x6f')]=_0x28ab0d[_0x7428('0x6f')];_0x53de59[_0x7428('0x47')]=_0x28ab0d[_0x7428('0x47')];logger['info'](_0x7428('0x70'),_0x53de59[_0x7428('0x4a')],_0x53de59['type']);_[_0x7428('0x71')](_0x53de59,_[_0x7428('0x72')](_0x28ab0d,_[_0x7428('0x73')](_0x53de59)));this['queueReports'][_0x28ab0d[_0x7428('0x47')]]['push'](_0x53de59);this[_0x7428('0x11')][_0x28ab0d[_0x7428('0x47')]]=_0x53de59;this[_0x7428('0x45')](_0x53de59,'queuecallerjoin');}}catch(_0x11570c){logger[_0x7428('0x3c')](_0x7428('0x74'),_0x28ab0d[_0x7428('0x47')],util['inspect'](_0x11570c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7428('0xc')]['syncQueueCallerAbandon']=function(_0x5840e8){try{if(this[_0x7428('0x5f')](_0x5840e8)){logger[_0x7428('0x5b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5840e8['uniqueid'],util[_0x7428('0x3e')](_0x5840e8,{'showHidden':![],'depth':null}));if(this[_0x7428('0x42')][_0x5840e8[_0x7428('0x47')]]){var _0xf2c9fe=_['last'](this['queueReports'][_0x5840e8[_0x7428('0x47')]]);_0xf2c9fe[_0x7428('0x75')]=![];_0xf2c9fe[_0x7428('0x76')]=null;_0xf2c9fe['holdtime']=_0x5840e8[_0x7428('0x77')];_0xf2c9fe[_0x7428('0x78')]=_0x5840e8[_0x7428('0x78')];_0xf2c9fe[_0x7428('0x1b')]=!![];_0xf2c9fe[_0x7428('0x79')]=moment()[_0x7428('0x48')](_0x7428('0x7a'));_0xf2c9fe['queuecallerexitreason']='ABANDONED';_0xf2c9fe[_0x7428('0x7b')]=null;logger[_0x7428('0x7c')](_0x7428('0x7d'),_0xf2c9fe[_0x7428('0x4a')],_0xf2c9fe[_0x7428('0x4e')]);this['channels'][_0x5840e8[_0x7428('0x47')]]=_0xf2c9fe;this['emitVoiceQueueChannelRemove'](_0xf2c9fe,_0x7428('0x1b'));}}}catch(_0x3a5841){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x5840e8[_0x7428('0x47')],util[_0x7428('0x3e')](_0x3a5841,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7428('0xc')]['syncQueueCallerLeave']=function(_0x5b60a6){try{if(this[_0x7428('0x5f')](_0x5b60a6)){logger[_0x7428('0x5b')]('[%s][voiceQueueReport][queuecallerleave]',_0x5b60a6[_0x7428('0x47')],util[_0x7428('0x3e')](_0x5b60a6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5b60a6[_0x7428('0x47')]]){var _0x1df732=_['last'](this[_0x7428('0x42')][_0x5b60a6[_0x7428('0x47')]]);_0x1df732[_0x7428('0x7e')]=moment()[_0x7428('0x48')](_0x7428('0x7a'));_0x1df732[_0x7428('0x7f')]=_0x5b60a6[_0x7428('0x7f')];_0x1df732[_0x7428('0x80')]=_0x5b60a6[_0x7428('0x80')];logger[_0x7428('0x7c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1df732[_0x7428('0x4a')],_0x1df732[_0x7428('0x4e')],_0x5b60a6[_0x7428('0x7f')],_0x5b60a6['connectedlinename']);this['channels'][_0x5b60a6[_0x7428('0x47')]]=_0x1df732;this[_0x7428('0x45')](_0x1df732,'queuecallerleave');}}}catch(_0x5217ec){logger['error'](_0x7428('0x81'),_0x5b60a6[_0x7428('0x47')],util['inspect'](_0x5217ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x1f')]=function(_0x24cbb2){try{if(this[_0x7428('0x5f')](_0x24cbb2)){logger[_0x7428('0x5b')](_0x7428('0x82'),_0x24cbb2[_0x7428('0x47')],util[_0x7428('0x3e')](_0x24cbb2,{'showHidden':![],'depth':null}));if(this[_0x7428('0x42')][_0x24cbb2['uniqueid']]){var _0x1e6bcd=_['last'](this['queueReports'][_0x24cbb2[_0x7428('0x47')]]);_0x1e6bcd['queuecallercomplete']=!![];_0x1e6bcd[_0x7428('0x83')]=_0x7428('0x84');logger[_0x7428('0x7c')](_0x7428('0x85'),_0x1e6bcd[_0x7428('0x4a')],_0x1e6bcd['type']);}}}catch(_0x4a6059){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x24cbb2[_0x7428('0x47')],util['inspect'](_0x4a6059,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7428('0x1d')]=function(_0x4e2d38){try{if(this[_0x7428('0x5f')](_0x4e2d38)){logger[_0x7428('0x5b')](_0x7428('0x86'),_0x4e2d38[_0x7428('0x47')],util[_0x7428('0x3e')](_0x4e2d38,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4e2d38['uniqueid']]){var _0x44c723=_['last'](this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x47')]]);_0x44c723[_0x7428('0x1b')]=![];_0x44c723[_0x7428('0x79')]=null;_0x44c723[_0x7428('0x87')]=!![];_0x44c723[_0x7428('0x7b')]=_0x4e2d38[_0x7428('0x88')];_0x44c723['holdtime']=_0x4e2d38[_0x7428('0x77')];_0x44c723[_0x7428('0x75')]=!![];_0x44c723[_0x7428('0x89')]=![];_0x44c723[_0x7428('0x8a')]=null;if(!_0x44c723[_0x7428('0x8b')]){if(_0x4e2d38[_0x7428('0x8c')]==_0x7428('0x8b')){_0x44c723[_0x7428('0x83')]=_0x7428('0x8d');logger[_0x7428('0x7c')](_0x7428('0x8e'),_0x44c723[_0x7428('0x4a')],_0x44c723[_0x7428('0x4e')]);}else{if(_[_0x7428('0x8f')](_0x4e2d38[_0x7428('0x39')][_0x7428('0x90')](),_0x7428('0x91'))){if(this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x92')]]){var _0x33bb48=_[_0x7428('0x93')](this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x92')]]);_0x33bb48['queuecallercomplete']=![];_0x33bb48[_0x7428('0x89')]=!![];_0x33bb48[_0x7428('0x8a')]=moment(_0x44c723[_0x7428('0x94')])[_0x7428('0x95')](_0x4e2d38[_0x7428('0x77')],'seconds')[_0x7428('0x48')](_0x7428('0x7a'));_0x33bb48[_0x7428('0x83')]=_0x7428('0x96');_0x33bb48[_0x7428('0x8b')]=!![];_0x33bb48[_0x7428('0x97')]=_0x7428('0x98');_0x33bb48['transferexten']=_0x4e2d38[_0x7428('0x99')];_0x33bb48[_0x7428('0x9a')]=_0x4e2d38[_0x7428('0x47')];logger[_0x7428('0x7c')](_0x7428('0x9b'),_0x33bb48[_0x7428('0x4a')],_0x33bb48[_0x7428('0x4e')]);var _0x559aae=this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x92')]];this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x92')]]=this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x47')]];this[_0x7428('0x42')][_0x4e2d38[_0x7428('0x47')]]=_0x559aae;}}else{_0x44c723[_0x7428('0x83')]=_0x7428('0x9c')+_0x4e2d38[_0x7428('0x8c')]['toUpperCase']();logger['info'](_0x7428('0x9d'),_0x44c723[_0x7428('0x4a')],_0x44c723[_0x7428('0x4e')],_0x44c723[_0x7428('0x83')]);}}}this['channels'][_0x4e2d38[_0x7428('0x47')]]=_0x44c723;this['emitVoiceQueueChannelRemove'](_0x44c723,_0x7428('0x1c'));}}}catch(_0x35958d){logger[_0x7428('0x3c')](_0x7428('0x86'),_0x4e2d38[_0x7428('0x47')],util[_0x7428('0x3e')](_0x35958d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x21')]=function(_0x313bc8){try{if(this[_0x7428('0x5f')](_0x313bc8)){logger[_0x7428('0x5b')](_0x7428('0x9e'),_0x313bc8['uniqueid'],util[_0x7428('0x3e')](_0x313bc8,{'showHidden':![],'depth':null}));this[_0x7428('0x9f')](_0x313bc8[_0x7428('0x47')],_[_0x7428('0x73')](_0x313bc8[_0x7428('0xa0')])[0x0],_0x313bc8['value']);if(this['queueReports'][_0x313bc8[_0x7428('0x47')]]){var _0x1b062c=_[_0x7428('0x93')](this['queueReports'][_0x313bc8[_0x7428('0x47')]]);if(_0x1b062c){if(this[_0x7428('0x5f')](_0x313bc8[_0x7428('0xa0')])&&this['isNotNull'](_0x313bc8[_0x7428('0xa0')]['queuestatus'])){switch(_0x313bc8[_0x7428('0xa1')]){case'CONTINUE':_0x1b062c[_0x7428('0x89')]=![];_0x1b062c[_0x7428('0x8a')]=null;break;case'TIMEOUT':_0x1b062c[_0x7428('0xa2')]='timeout';_0x1b062c['queuecallerexit']=!![];_0x1b062c[_0x7428('0x8a')]=moment()[_0x7428('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b062c['queuecallerleaveAt']=moment()[_0x7428('0x48')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x7428('0xa3'),_0x313bc8[_0x7428('0x47')],util['inspect'](_0x1b062c,{'showHidden':![],'depth':null}));ami['emit'](_0x7428('0xa4'),_0x1b062c);break;default:_0x1b062c['queuecallerexit']=!![];_0x1b062c[_0x7428('0x8a')]=moment()[_0x7428('0x48')](_0x7428('0x7a'));_0x1b062c[_0x7428('0x7e')]=moment()[_0x7428('0x48')](_0x7428('0x7a'));}_0x1b062c[_0x7428('0x1b')]=![];_0x1b062c[_0x7428('0x79')]=null;_0x1b062c[_0x7428('0x83')]=_0x313bc8['value'];this[_0x7428('0x11')][_0x313bc8[_0x7428('0x47')]]=_0x1b062c;this[_0x7428('0x43')](_0x1b062c,_0x7428('0x20'));}else if(this[_0x7428('0x5f')](_0x313bc8[_0x7428('0xa0')])&&this['isNotNull'](_0x313bc8[_0x7428('0xa0')][_0x7428('0xa5')])){if(!_0x1b062c[_0x7428('0x1b')]){_0x1b062c[_0x7428('0x89')]=!![];_0x1b062c[_0x7428('0x8a')]=moment()[_0x7428('0x48')](_0x7428('0x7a'));_0x1b062c[_0x7428('0x83')]='EXITWITHKEY';_0x1b062c['queuecallerleaveAt']=moment()[_0x7428('0x48')](_0x7428('0x7a'));this[_0x7428('0x11')][_0x313bc8[_0x7428('0x47')]]=_0x1b062c;}}logger[_0x7428('0x7c')](_0x7428('0xa6'),_0x313bc8[_0x7428('0x47')],_0x1b062c[_0x7428('0x4a')],_0x1b062c[_0x7428('0x4e')],_[_0x7428('0x73')](_0x313bc8[_0x7428('0xa0')])[0x0],_0x313bc8[_0x7428('0xa1')]);_0x1b062c[_0x7428('0x15')]=this[_0x7428('0x15')][_0x313bc8['uniqueid']];}}}}catch(_0x1faec9){logger[_0x7428('0x3c')](_0x7428('0x9e'),_0x313bc8[_0x7428('0x47')],util[_0x7428('0x3e')](_0x1faec9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x9f')]=function(_0x3040c8,_0x4a14dc,_0x1022bd){var _0x543b7f=[_0x7428('0xa7'),_0x7428('0xa8'),'rtpaudioqosjitter',_0x7428('0xa9'),_0x7428('0xaa'),_0x7428('0xab'),_0x7428('0xac'),_0x7428('0xad'),_0x7428('0xae'),'sipuri','bridgepeer','bridgepvtcallid',_0x7428('0xaf'),_0x7428('0xb0'),_0x7428('0xb1'),_0x7428('0xb2'),_0x7428('0x88'),'memberpenalty',_0x7428('0xb3')];if(!_[_0x7428('0x37')](_0x4a14dc)&&!_[_0x7428('0xb4')](_0x543b7f,_0x4a14dc)){if(_['isUndefined'](this[_0x7428('0x15')][_0x3040c8])){this['variables'][_0x3040c8]={};}this[_0x7428('0x15')][_0x3040c8][_0x4a14dc]=_0x1022bd;}};VoiceQueueReport[_0x7428('0xc')][_0x7428('0x23')]=function(_0x396e60){try{if(this['isNotNull'](_0x396e60)){logger[_0x7428('0x5b')]('[%s][voiceQueueReport][hangup]',_0x396e60[_0x7428('0x47')],util[_0x7428('0x3e')](_0x396e60,{'showHidden':![],'depth':null}));if(this[_0x7428('0x42')][_0x396e60[_0x7428('0x47')]]){for(var _0x5d237d=0x0,_0x169b4d={};_0x5d237d0x0?_0x2c9eae:0x0;this[_0x269b('0x11')][_0x2d910f[_0x269b('0x67')]]['talking']=this['voiceQueues'][_0x2d910f[_0x269b('0x67')]][_0x269b('0x53')]>_[_0x269b('0x6d')](_0x2d910f[_0x269b('0x6e')])?_['toNumber'](_0x2d910f['loggedin']):this[_0x269b('0x11')][_0x2d910f[_0x269b('0x67')]][_0x269b('0x53')];this['emitVoiceQueueSummary'](this[_0x269b('0x11')][_0x2d910f[_0x269b('0x67')]],'queuesummary');}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x269b('0x3d')](this[_0x269b('0x11')][_0x2d910f[_0x269b('0x67')]],{'showHidden':![],'depth':null}));ami[_0x269b('0x45')]('custom:queuesummary',this['voiceQueues'][_0x2d910f[_0x269b('0x67')]]);}}}catch(_0x8d5846){logger['error'](_0x269b('0x66'),util[_0x269b('0x3d')](_0x8d5846,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x269b('0x18')]=function(_0x180f2e){logger[_0x269b('0x42')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x269b('0x3d')](_0x180f2e,{'showHidden':![],'depth':null}));this[_0x269b('0x12')]=!![];};VoiceQueueReport['prototype'][_0x269b('0x1a')]=function(_0x15f753){try{if(this[_0x269b('0x5f')](_0x15f753)){logger['debug'](_0x269b('0x6f'),_0x15f753[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x15f753,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x15f753[_0x269b('0x4a')]])){this[_0x269b('0xf')][_0x15f753['uniqueid']]=[];this[_0x269b('0x32')][_0x15f753[_0x269b('0x4a')]]={};}var _0x561732=new QueueReport();_0x561732[_0x269b('0x48')]=_0x15f753[_0x269b('0x67')];_0x561732[_0x269b('0x4c')]=this[_0x269b('0x11')][_0x561732[_0x269b('0x48')]]&&this[_0x269b('0x11')][_0x561732['name']][_0x269b('0x4c')]?this[_0x269b('0x11')][_0x561732[_0x269b('0x48')]][_0x269b('0x4c')]||_0x269b('0x4d'):_0x269b('0x4d');_0x561732[_0x269b('0x67')]=_0x15f753[_0x269b('0x67')];_0x561732[_0x269b('0x70')]=moment()[_0x269b('0x46')](_0x269b('0x71'));_0x561732[_0x269b('0x72')]=_0x15f753[_0x269b('0x72')];_0x561732[_0x269b('0x73')]=_0x15f753['count'];_0x561732[_0x269b('0x4a')]=_0x15f753[_0x269b('0x4a')];logger[_0x269b('0x69')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x561732[_0x269b('0x48')],_0x561732[_0x269b('0x4c')]);_[_0x269b('0x74')](_0x561732,_['pick'](_0x15f753,_['keys'](_0x561732)));this[_0x269b('0xf')][_0x15f753[_0x269b('0x4a')]][_0x269b('0x75')](_0x561732);this[_0x269b('0x32')][_0x15f753[_0x269b('0x4a')]]=_0x561732;this[_0x269b('0x76')](_0x561732,_0x269b('0x19'));}}catch(_0x4247a8){logger['error'](_0x269b('0x6f'),_0x15f753[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x4247a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x269b('0xc')]['syncQueueCallerAbandon']=function(_0x38160c){try{if(this[_0x269b('0x5f')](_0x38160c)){logger[_0x269b('0x42')](_0x269b('0x77'),_0x38160c[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x38160c,{'showHidden':![],'depth':null}));if(this[_0x269b('0xf')][_0x38160c[_0x269b('0x4a')]]){var _0x17a1d6=_[_0x269b('0x78')](this[_0x269b('0xf')][_0x38160c[_0x269b('0x4a')]]);_0x17a1d6[_0x269b('0x79')]=![];_0x17a1d6['queuecallercompleteAt']=null;_0x17a1d6[_0x269b('0x7a')]=_0x38160c[_0x269b('0x7a')];_0x17a1d6[_0x269b('0x7b')]=_0x38160c['originalposition'];_0x17a1d6[_0x269b('0x1b')]=!![];_0x17a1d6[_0x269b('0x7c')]=moment()[_0x269b('0x46')](_0x269b('0x71'));_0x17a1d6[_0x269b('0x7d')]=_0x269b('0x7e');_0x17a1d6[_0x269b('0x7f')]=null;logger[_0x269b('0x69')](_0x269b('0x80'),_0x17a1d6[_0x269b('0x48')],_0x17a1d6[_0x269b('0x4c')]);this[_0x269b('0x32')][_0x38160c[_0x269b('0x4a')]]=_0x17a1d6;this[_0x269b('0x41')](_0x17a1d6,_0x269b('0x1b'));}}}catch(_0x254b8a){logger[_0x269b('0x3b')](_0x269b('0x77'),_0x38160c[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x254b8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x269b('0xc')][_0x269b('0x81')]=function(_0x5caa07){try{if(this[_0x269b('0x5f')](_0x5caa07)){logger[_0x269b('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x5caa07['uniqueid'],util[_0x269b('0x3d')](_0x5caa07,{'showHidden':![],'depth':null}));if(this[_0x269b('0xf')][_0x5caa07[_0x269b('0x4a')]]){var _0xc9146d=_[_0x269b('0x78')](this[_0x269b('0xf')][_0x5caa07['uniqueid']]);_0xc9146d[_0x269b('0x82')]=moment()[_0x269b('0x46')](_0x269b('0x71'));_0xc9146d[_0x269b('0x83')]=_0x5caa07['connectedlinenum'];_0xc9146d[_0x269b('0x84')]=_0x5caa07[_0x269b('0x84')];logger[_0x269b('0x69')](_0x269b('0x85'),_0xc9146d[_0x269b('0x48')],_0xc9146d[_0x269b('0x4c')],_0x5caa07[_0x269b('0x83')],_0x5caa07[_0x269b('0x84')]);this[_0x269b('0x32')][_0x5caa07[_0x269b('0x4a')]]=_0xc9146d;this[_0x269b('0x76')](_0xc9146d,_0x269b('0x1d'));}}}catch(_0x4548f4){logger['error'](_0x269b('0x86'),_0x5caa07[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x4548f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x269b('0x1f')]=function(_0x2a5b17){try{if(this[_0x269b('0x5f')](_0x2a5b17)){logger[_0x269b('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x2a5b17[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x2a5b17,{'showHidden':![],'depth':null}));if(this[_0x269b('0xf')][_0x2a5b17[_0x269b('0x4a')]]){var _0x57418b=_[_0x269b('0x78')](this['queueReports'][_0x2a5b17['uniqueid']]);_0x57418b[_0x269b('0x79')]=!![];_0x57418b[_0x269b('0x7d')]=_0x269b('0x87');logger[_0x269b('0x69')](_0x269b('0x88'),_0x57418b[_0x269b('0x48')],_0x57418b[_0x269b('0x4c')]);}}}catch(_0x40c37f){logger[_0x269b('0x3b')](_0x269b('0x89'),_0x2a5b17['uniqueid'],util[_0x269b('0x3d')](_0x40c37f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x269b('0x8a')]=function(_0x3fc3b2){try{if(this[_0x269b('0x5f')](_0x3fc3b2)){logger[_0x269b('0x42')](_0x269b('0x8b'),_0x3fc3b2['uniqueid'],util[_0x269b('0x3d')](_0x3fc3b2,{'showHidden':![],'depth':null}));if(this[_0x269b('0xf')][_0x3fc3b2['uniqueid']]){var _0x393b88=_[_0x269b('0x78')](this[_0x269b('0xf')][_0x3fc3b2[_0x269b('0x4a')]]);_0x393b88[_0x269b('0x1b')]=![];_0x393b88[_0x269b('0x7c')]=null;_0x393b88[_0x269b('0x8c')]=!![];_0x393b88[_0x269b('0x7f')]=_0x3fc3b2[_0x269b('0x8d')];_0x393b88['holdtime']=_0x3fc3b2[_0x269b('0x7a')];_0x393b88['queuecallercomplete']=!![];_0x393b88['queuecallerexit']=![];_0x393b88[_0x269b('0x8e')]=null;if(!_0x393b88[_0x269b('0x8f')]){if(_0x3fc3b2[_0x269b('0x90')]==_0x269b('0x8f')){_0x393b88[_0x269b('0x7d')]='COMPLETED';logger[_0x269b('0x69')](_0x269b('0x91'),_0x393b88[_0x269b('0x48')],_0x393b88[_0x269b('0x4c')]);}else{if(_[_0x269b('0x92')](_0x3fc3b2['channel'][_0x269b('0x93')](),_0x269b('0x94'))){if(this[_0x269b('0xf')][_0x3fc3b2[_0x269b('0x95')]]){var _0x3c1421=_[_0x269b('0x78')](this['queueReports'][_0x3fc3b2[_0x269b('0x95')]]);_0x3c1421[_0x269b('0x79')]=![];_0x3c1421['queuecallerexit']=!![];_0x3c1421[_0x269b('0x8e')]=moment(_0x393b88[_0x269b('0x70')])[_0x269b('0x96')](_0x3fc3b2['holdtime'],'seconds')[_0x269b('0x46')](_0x269b('0x71'));_0x3c1421[_0x269b('0x7d')]=_0x269b('0x97');_0x3c1421[_0x269b('0x8f')]=!![];_0x3c1421[_0x269b('0x98')]=_0x269b('0x99');_0x3c1421[_0x269b('0x9a')]=_0x3fc3b2[_0x269b('0x9b')];_0x3c1421[_0x269b('0x9c')]=_0x3fc3b2[_0x269b('0x4a')];logger[_0x269b('0x69')](_0x269b('0x9d'),_0x3c1421['name'],_0x3c1421[_0x269b('0x4c')]);var _0x277d86=this[_0x269b('0xf')][_0x3fc3b2[_0x269b('0x95')]];this[_0x269b('0xf')][_0x3fc3b2[_0x269b('0x95')]]=this[_0x269b('0xf')][_0x3fc3b2[_0x269b('0x4a')]];this[_0x269b('0xf')][_0x3fc3b2[_0x269b('0x4a')]]=_0x277d86;}}else{_0x393b88[_0x269b('0x7d')]=_0x269b('0x9e')+_0x3fc3b2['reason'][_0x269b('0x9f')]();logger[_0x269b('0x69')](_0x269b('0xa0'),_0x393b88[_0x269b('0x48')],_0x393b88['type'],_0x393b88[_0x269b('0x7d')]);}}}this[_0x269b('0x32')][_0x3fc3b2[_0x269b('0x4a')]]=_0x393b88;this[_0x269b('0x41')](_0x393b88,'agentcomplete');}}}catch(_0x4026ff){logger['error'](_0x269b('0x8b'),_0x3fc3b2['uniqueid'],util[_0x269b('0x3d')](_0x4026ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x269b('0xc')][_0x269b('0x21')]=function(_0x223cb6){try{if(this[_0x269b('0x5f')](_0x223cb6)){logger[_0x269b('0x42')]('[%s][voiceQueueReport][varset]',_0x223cb6[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x223cb6,{'showHidden':![],'depth':null}));this['addVariable'](_0x223cb6[_0x269b('0x4a')],_[_0x269b('0xa1')](_0x223cb6['variable'])[0x0],_0x223cb6[_0x269b('0xa2')]);if(this[_0x269b('0xf')][_0x223cb6[_0x269b('0x4a')]]){var _0x26b6b5=_[_0x269b('0x78')](this['queueReports'][_0x223cb6[_0x269b('0x4a')]]);if(_0x26b6b5){if(this['isNotNull'](_0x223cb6[_0x269b('0xa3')])&&this['isNotNull'](_0x223cb6[_0x269b('0xa3')][_0x269b('0xa4')])){switch(_0x223cb6[_0x269b('0xa2')]){case'CONTINUE':_0x26b6b5['queuecallerexit']=![];_0x26b6b5[_0x269b('0x8e')]=null;break;case'TIMEOUT':_0x26b6b5[_0x269b('0xa5')]=_0x269b('0xa6');_0x26b6b5['queuecallerexit']=!![];_0x26b6b5[_0x269b('0x8e')]=moment()[_0x269b('0x46')](_0x269b('0x71'));_0x26b6b5[_0x269b('0x82')]=moment()[_0x269b('0x46')](_0x269b('0x71'));logger[_0x269b('0x42')](_0x269b('0xa7'),_0x223cb6[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x26b6b5,{'showHidden':![],'depth':null}));ami[_0x269b('0x45')](_0x269b('0xa8'),_0x26b6b5);break;default:_0x26b6b5[_0x269b('0xa9')]=!![];_0x26b6b5[_0x269b('0x8e')]=moment()[_0x269b('0x46')](_0x269b('0x71'));_0x26b6b5[_0x269b('0x82')]=moment()[_0x269b('0x46')](_0x269b('0x71'));}_0x26b6b5['queuecallerabandon']=![];_0x26b6b5['queuecallerabandonAt']=null;_0x26b6b5[_0x269b('0x7d')]=_0x223cb6[_0x269b('0xa2')];this['channels'][_0x223cb6[_0x269b('0x4a')]]=_0x26b6b5;this['emitVoiceQueueChannelRemove'](_0x26b6b5,'varset');}else if(this[_0x269b('0x5f')](_0x223cb6[_0x269b('0xa3')])&&this[_0x269b('0x5f')](_0x223cb6['variable']['queueposition'])){if(!_0x26b6b5['queuecallerabandon']){_0x26b6b5['queuecallerexit']=!![];_0x26b6b5[_0x269b('0x8e')]=moment()[_0x269b('0x46')](_0x269b('0x71'));_0x26b6b5['queuecallerexitreason']=_0x269b('0xaa');_0x26b6b5[_0x269b('0x82')]=moment()['format'](_0x269b('0x71'));this[_0x269b('0x32')][_0x223cb6[_0x269b('0x4a')]]=_0x26b6b5;}}logger[_0x269b('0x69')](_0x269b('0xab'),_0x223cb6[_0x269b('0x4a')],_0x26b6b5[_0x269b('0x48')],_0x26b6b5['type'],_['keys'](_0x223cb6['variable'])[0x0],_0x223cb6[_0x269b('0xa2')]);_0x26b6b5[_0x269b('0x14')]=this[_0x269b('0x14')][_0x223cb6[_0x269b('0x4a')]];}}}}catch(_0x25c23e){logger[_0x269b('0x3b')](_0x269b('0xac'),_0x223cb6[_0x269b('0x4a')],util[_0x269b('0x3d')](_0x25c23e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x429b1e,_0xcfeac7,_0x4e77d5){var _0x16db60=[_0x269b('0xad'),_0x269b('0xae'),_0x269b('0xaf'),_0x269b('0xb0'),_0x269b('0xb1'),'rtpaudioqoslossbridged',_0x269b('0xb2'),_0x269b('0xb3'),_0x269b('0xb4'),_0x269b('0xb5'),'bridgepeer',_0x269b('0xb6'),_0x269b('0xb7'),_0x269b('0xb8'),_0x269b('0xb9'),_0x269b('0xba'),'membername',_0x269b('0xbb'),_0x269b('0xbc')];if(!_[_0x269b('0x35')](_0xcfeac7)&&!_[_0x269b('0xbd')](_0x16db60,_0xcfeac7)){if(_[_0x269b('0x60')](this[_0x269b('0x14')][_0x429b1e])){this[_0x269b('0x14')][_0x429b1e]={};}this[_0x269b('0x14')][_0x429b1e][_0xcfeac7]=_0x4e77d5;}};VoiceQueueReport['prototype'][_0x269b('0x22')]=function(_0x585e86){try{if(this[_0x269b('0x5f')](_0x585e86)){logger[_0x269b('0x42')](_0x269b('0xbe'),_0x585e86[_0x269b('0x4a')],util['inspect'](_0x585e86,{'showHidden':![],'depth':null}));if(this[_0x269b('0xf')][_0x585e86['uniqueid']]){for(var _0x3acc76=0x0,_0x3c5e5f={};_0x3acc76=0x0?moment(_0x5d2f7a[_0x9131('0x16')])[_0x9131('0xc')](_0x5d2f7a[_0x9131('0x17')],'seconds'):null,'data1':_0x9131('0x18'),'data2':_0x5d2f7a[_0x9131('0x12')],'data3':_0x5d2f7a['exten'],'data4':_0x5d2f7a[_0x9131('0x19')]||null,'role':_0x9131('0x11'),'internal':_0x5d2f7a[_0x9131('0x12')]?_[_0x9131('0x13')](_0x5d2f7a[_0x9131('0x12')]):undefined,'uniqueid':_0x5d2f7a[_0x9131('0x14')]},'log':_0x9131('0x6')});}; \ No newline at end of file +var _0xc481=['agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','membername','endtime','starttime','seconds','outbound','dialstring','lodash','util','../client','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','exten','queue'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc481,0xf4));var _0x1c48=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0xc481[_0x4acfd2];return _0x12afbe;};'use strict';var moment=require('moment');var _=require(_0x1c48('0x0'));var util=require(_0x1c48('0x1'));var client=require(_0x1c48('0x2'));exports['voiceQueueReport']=function(_0x3904f1){var _0x18eae5=_0x3904f1['queuecallercompleteAt']||_0x3904f1[_0x1c48('0x3')];return client[_0x1c48('0x4')](_0x1c48('0x5'),{'body':{'channel':'voice','membername':_0x3904f1[_0x1c48('0x6')],'interface':_[_0x1c48('0x7')](_0x3904f1[_0x1c48('0x8')])?util[_0x1c48('0x9')](_0x1c48('0xa'),_0x3904f1['lastAssignedTo']):_0x3904f1[_0x1c48('0x8')],'type':_0x1c48('0xb'),'enterAt':_0x3904f1[_0x1c48('0xc')],'exitAt':_0x18eae5,'duration':moment(_0x18eae5)[_0x1c48('0xd')](_0x3904f1[_0x1c48('0xc')],'seconds'),'data1':_0x1c48('0xe'),'data2':_0x3904f1['calleridnum'],'data3':_0x3904f1[_0x1c48('0xf')],'data4':null,'data5':_0x3904f1[_0x1c48('0x10')],'role':_0x1c48('0x11'),'internal':_0x3904f1[_0x1c48('0x12')]?_[_0x1c48('0x13')](_0x3904f1[_0x1c48('0x12')]):undefined,'uniqueid':_0x3904f1[_0x1c48('0x14')]},'log':_0x1c48('0x5')});};exports[_0x1c48('0x15')]=function(_0x301995){return client[_0x1c48('0x4')](_0x1c48('0x5'),{'body':{'channel':_0x1c48('0x16'),'membername':_0x301995[_0x1c48('0x17')],'interface':_0x301995[_0x1c48('0x8')],'type':_0x1c48('0xb'),'enterAt':_0x301995['starttime'],'exitAt':_0x301995[_0x1c48('0x18')],'duration':moment(_0x301995[_0x1c48('0x18')])['diff'](_0x301995['starttime'],'seconds')>=0x0?moment(_0x301995[_0x1c48('0x18')])['diff'](_0x301995[_0x1c48('0x19')],_0x1c48('0x1a')):null,'data1':_0x1c48('0x1b'),'data2':_0x301995[_0x1c48('0x12')],'data3':_0x301995[_0x1c48('0xf')],'data4':_0x301995[_0x1c48('0x1c')]||null,'role':'agent','internal':_0x301995[_0x1c48('0x12')]?_[_0x1c48('0x13')](_0x301995[_0x1c48('0x12')]):undefined,'uniqueid':_0x301995[_0x1c48('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 632a341..ac8344e 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 _0x878f=['html','getTemplates','Request','GetTemplate','name'];(function(_0x4d6df5,_0x470d1a){var _0x38a3c2=function(_0x558bbe){while(--_0x558bbe){_0x4d6df5['push'](_0x4d6df5['shift']());}};_0x38a3c2(++_0x470d1a);}(_0x878f,0x173));var _0xf878=function(_0x1a92c0,_0x1594c3){_0x1a92c0=_0x1a92c0-0x0;var _0x44c923=_0x878f[_0x1a92c0];return _0x44c923;};'use strict';var client=require('../client');exports[_0xf878('0x0')]=function(_0x658976){return function(_0x2e1d23){return client[_0xf878('0x1')](_0xf878('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf878('0x3'),_0xf878('0x4')]},'log':_0xf878('0x2')});};}; \ No newline at end of file +var _0xc6d8=['Request','name','../client'];(function(_0x3e9f18,_0x26b4e3){var _0x1ad1a6=function(_0x560f36){while(--_0x560f36){_0x3e9f18['push'](_0x3e9f18['shift']());}};_0x1ad1a6(++_0x26b4e3);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x194794,_0x2858f2){_0x194794=_0x194794-0x0;var _0x4720fb=_0xc6d8[_0x194794];return _0x4720fb;};'use strict';var client=require(_0x8c6d('0x0'));exports['getTemplates']=function(_0x170f12){return function(_0x49772b){return client[_0x8c6d('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x8c6d('0x2'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 9603d38..1367a92 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 _0x8f33=['Actions','action','data1','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','operator','AnyConditions','field'];(function(_0x424770,_0x34f0e7){var _0x3a59b1=function(_0x20c44a){while(--_0x20c44a){_0x424770['push'](_0x424770['shift']());}};_0x3a59b1(++_0x34f0e7);}(_0x8f33,0x67));var _0x38f3=function(_0x10037e,_0x28b6bd){_0x10037e=_0x10037e-0x0;var _0x371d49=_0x8f33[_0x10037e];return _0x371d49;};'use strict';var client=require(_0x38f3('0x0'));exports[_0x38f3('0x1')]=function(_0xc54fcc){return function(_0xbc3414){return client[_0x38f3('0x2')](_0x38f3('0x3'),{'options':{'raw':![],'attributes':['id',_0x38f3('0x4'),_0x38f3('0x5'),'status'],'include':[{'model':_0x38f3('0x6'),'as':_0x38f3('0x7'),'attributes':['id','field',_0x38f3('0x8'),'value']},{'model':_0x38f3('0x6'),'as':_0x38f3('0x9'),'attributes':['id',_0x38f3('0xa'),_0x38f3('0x8'),'value']},{'model':'Action','as':_0x38f3('0xb'),'attributes':['id',_0x38f3('0xc'),_0x38f3('0xd'),_0x38f3('0xe'),_0x38f3('0xf'),_0x38f3('0x10'),_0x38f3('0x11'),'data6',_0x38f3('0x12')]}]},'log':_0x38f3('0x3')});};}; \ No newline at end of file +var _0x8526=['Actions','data1','data2','data3','data4','data5','data6','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action'];(function(_0x5b7f50,_0x48faf4){var _0x288e99=function(_0xd4ab02){while(--_0xd4ab02){_0x5b7f50['push'](_0x5b7f50['shift']());}};_0x288e99(++_0x48faf4);}(_0x8526,0x11f));var _0x6852=function(_0x15b962,_0x3237ff){_0x15b962=_0x15b962-0x0;var _0x82683c=_0x8526[_0x15b962];return _0x82683c;};'use strict';var client=require(_0x6852('0x0'));exports[_0x6852('0x1')]=function(_0x285d4a){return function(_0x10b3ed){return client[_0x6852('0x2')](_0x6852('0x3'),{'options':{'raw':![],'attributes':['id',_0x6852('0x4'),_0x6852('0x5'),_0x6852('0x6')],'include':[{'model':_0x6852('0x7'),'as':_0x6852('0x8'),'attributes':['id',_0x6852('0x9'),_0x6852('0xa'),_0x6852('0xb')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x6852('0x9'),_0x6852('0xa'),_0x6852('0xb')]},{'model':_0x6852('0xc'),'as':_0x6852('0xd'),'attributes':['id','action',_0x6852('0xe'),_0x6852('0xf'),_0x6852('0x10'),_0x6852('0x11'),_0x6852('0x12'),_0x6852('0x13'),'data7']}]},'log':_0x6852('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5803adf..b7e8455 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 _0x81f9=['GetTrunk','name','../client','getTrunks','Request'];(function(_0x1a8047,_0x6e4830){var _0x41983e=function(_0xf9ac3b){while(--_0xf9ac3b){_0x1a8047['push'](_0x1a8047['shift']());}};_0x41983e(++_0x6e4830);}(_0x81f9,0x129));var _0x981f=function(_0x294e64,_0x22460a){_0x294e64=_0x294e64-0x0;var _0x42b05b=_0x81f9[_0x294e64];return _0x42b05b;};'use strict';var client=require(_0x981f('0x0'));exports[_0x981f('0x1')]=function(_0xc33334){return function(_0x314f86){return client[_0x981f('0x2')](_0x981f('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x981f('0x4'),'registry']},'log':_0x981f('0x3')});};}; \ No newline at end of file +var _0x131b=['GetTrunk','name','registry','../client'];(function(_0x3a6ad5,_0x3b84d8){var _0xc08e2a=function(_0x425836){while(--_0x425836){_0x3a6ad5['push'](_0x3a6ad5['shift']());}};_0xc08e2a(++_0x3b84d8);}(_0x131b,0x1d7));var _0xb131=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0x131b[_0x582d5a];return _0x5625ef;};'use strict';var client=require(_0xb131('0x0'));exports['getTrunks']=function(_0x443669){return function(_0x56fa77){return client['Request'](_0xb131('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb131('0x2'),_0xb131('0x3')]},'log':_0xb131('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 327dc71..b0c90f1 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 _0x2876=['accountcode','fullname','online','pauseType','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone','savePause','Request','PauseUser','saveUnpause','UnpauseUser','ShowUser','lastLoginAt','../client','getAgents','agent','name','email'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0x2876,0x199));var _0x6287=function(_0x3486b0,_0x248021){_0x3486b0=_0x3486b0-0x0;var _0x2c8a3f=_0x2876[_0x3486b0];return _0x2c8a3f;};'use strict';var client=require(_0x6287('0x0'));exports[_0x6287('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x6287('0x2')},'attributes':['id',_0x6287('0x3'),_0x6287('0x4'),_0x6287('0x5'),_0x6287('0x6'),_0x6287('0x7'),'lastLoginAt',_0x6287('0x8'),'lastPauseAt',_0x6287('0x9'),_0x6287('0xa'),_0x6287('0xb'),_0x6287('0xc')]},'log':'getAgents'});};};exports[_0x6287('0xd')]=function(){return function(){return client['Request'](_0x6287('0xe'),{'options':{'raw':!![],'where':{'role':_0x6287('0xf')},'attributes':['id',_0x6287('0x3'),_0x6287('0x5'),'internal']},'log':_0x6287('0xd')});};};exports[_0x6287('0x10')]=function(_0x1c26f2,_0x574264,_0x196748){return client[_0x6287('0x11')](_0x6287('0x12'),{'body':{'type':_0x574264,'uniqueid':_0x196748},'options':{'where':{'id':_0x1c26f2['id']}},'log':_0x6287('0x10')});};exports[_0x6287('0x13')]=function(_0x888662){return client['Request'](_0x6287('0x14'),{'body':{},'options':{'where':{'id':_0x888662['id']}},'log':_0x6287('0x10')});};exports['getAgent']=function(_0x1717ad){return client[_0x6287('0x11')](_0x6287('0x15'),{'options':{'raw':![],'where':{'role':_0x6287('0x2'),'id':_0x1717ad},'attributes':['id','name',_0x6287('0x4'),_0x6287('0x5'),_0x6287('0x6'),'online',_0x6287('0x16'),'pauseType','lastPauseAt',_0x6287('0x9'),_0x6287('0xc')]},'log':'getAgent'});}; \ No newline at end of file +var _0xc3a8=['agent','accountcode','fullname','online','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','name','internal','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','pauseType','../client','getAgents','Request','GetUser'];(function(_0x2cce72,_0x432665){var _0xe78e46=function(_0x5d2992){while(--_0x5d2992){_0x2cce72['push'](_0x2cce72['shift']());}};_0xe78e46(++_0x432665);}(_0xc3a8,0x1ac));var _0x8c3a=function(_0x386be7,_0x124b9e){_0x386be7=_0x386be7-0x0;var _0x2f45f9=_0xc3a8[_0x386be7];return _0x2f45f9;};'use strict';var client=require(_0x8c3a('0x0'));exports[_0x8c3a('0x1')]=function(){return function(){return client[_0x8c3a('0x2')](_0x8c3a('0x3'),{'options':{'raw':![],'where':{'role':_0x8c3a('0x4')},'attributes':['id','name','email',_0x8c3a('0x5'),_0x8c3a('0x6'),_0x8c3a('0x7'),_0x8c3a('0x8'),'pauseType',_0x8c3a('0x9'),_0x8c3a('0xa'),_0x8c3a('0xb'),_0x8c3a('0xc'),_0x8c3a('0xd')]},'log':'getAgents'});};};exports[_0x8c3a('0xe')]=function(){return function(){return client[_0x8c3a('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x8c3a('0xf')},'attributes':['id',_0x8c3a('0x10'),_0x8c3a('0x5'),_0x8c3a('0x11')]},'log':_0x8c3a('0xe')});};};exports[_0x8c3a('0x12')]=function(_0x539b14,_0x4efeb1,_0x3e6945){return client[_0x8c3a('0x2')]('PauseUser',{'body':{'type':_0x4efeb1,'uniqueid':_0x3e6945},'options':{'where':{'id':_0x539b14['id']}},'log':_0x8c3a('0x12')});};exports[_0x8c3a('0x13')]=function(_0x55f86b){return client['Request'](_0x8c3a('0x14'),{'body':{},'options':{'where':{'id':_0x55f86b['id']}},'log':_0x8c3a('0x12')});};exports[_0x8c3a('0x15')]=function(_0x4b9f1f){return client[_0x8c3a('0x2')](_0x8c3a('0x16'),{'options':{'raw':![],'where':{'role':'agent','id':_0x4b9f1f},'attributes':['id',_0x8c3a('0x10'),'email',_0x8c3a('0x5'),'fullname',_0x8c3a('0x7'),_0x8c3a('0x8'),_0x8c3a('0x17'),_0x8c3a('0x9'),_0x8c3a('0xa'),_0x8c3a('0xd')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ec3d593..ad2791e 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 _0xda5b=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x287f8b,_0x2e279b){var _0x595809=function(_0x33c742){while(--_0x33c742){_0x287f8b['push'](_0x287f8b['shift']());}};_0x595809(++_0x2e279b);}(_0xda5b,0x163));var _0xbda5=function(_0x3780bd,_0x81b109){_0x3780bd=_0x3780bd-0x0;var _0x2a7b7f=_0xda5b[_0x3780bd];return _0x2a7b7f;};'use strict';var client=require(_0xbda5('0x0'));exports['create']=function(_0xf350bc){return client['Request']('CreateVoiceAgentReport',{'body':_0xf350bc,'log':_0xbda5('0x1')});};exports[_0xbda5('0x2')]=function(_0x1d29fc,_0x6d3e1c,_0x6a491e){return client['Request'](_0xbda5('0x3'),{'body':_0x1d29fc,'options':{'where':{'uniqueid':_0x6d3e1c,'interface':_0x6a491e,'agentcomplete':!![]}},'log':_0xbda5('0x3')});}; \ No newline at end of file +var _0x9e59=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x1e7ca7,_0x426644){var _0x350815=function(_0x564057){while(--_0x564057){_0x1e7ca7['push'](_0x1e7ca7['shift']());}};_0x350815(++_0x426644);}(_0x9e59,0x1c5));var _0x99e5=function(_0x2f2322,_0x39cfc7){_0x2f2322=_0x2f2322-0x0;var _0x45b666=_0x9e59[_0x2f2322];return _0x45b666;};'use strict';var client=require('../client');exports[_0x99e5('0x0')]=function(_0x597a04){return client[_0x99e5('0x1')](_0x99e5('0x2'),{'body':_0x597a04,'log':_0x99e5('0x2')});};exports[_0x99e5('0x3')]=function(_0x4405bd,_0x31b6be,_0x208e00){return client[_0x99e5('0x1')](_0x99e5('0x4'),{'body':_0x4405bd,'options':{'where':{'uniqueid':_0x31b6be,'interface':_0x208e00,'agentcomplete':!![]}},'log':_0x99e5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 28f570b..009da48 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 _0x5272=['GetVoiceCallReport','outbound','startOf','format','endOf','day','disposition','duration','util','../client','create','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports'];(function(_0x40654a,_0x1dbbb2){var _0x2f656c=function(_0xa51ec8){while(--_0xa51ec8){_0x40654a['push'](_0x40654a['shift']());}};_0x2f656c(++_0x1dbbb2);}(_0x5272,0x1a0));var _0x2527=function(_0x54d8c2,_0xd2cdbf){_0x54d8c2=_0x54d8c2-0x0;var _0x31bbf3=_0x5272[_0x54d8c2];return _0x31bbf3;};'use strict';var moment=require('moment');var util=require(_0x2527('0x0'));var _=require('lodash');var client=require(_0x2527('0x1'));exports[_0x2527('0x2')]=function(_0x4eae4f){return client[_0x2527('0x3')](_0x2527('0x4'),{'body':_[_0x2527('0x5')](_0x4eae4f,{'source':_0x4eae4f['calleridnum'],'destinationcontext':_0x4eae4f['context'],'callerid':_0x4eae4f[_0x2527('0x6')],'amaflags':_0x2527('0x7')}),'log':_0x2527('0x4')});};exports[_0x2527('0x8')]=function(){return function(){return client[_0x2527('0x3')](_0x2527('0x9'),{'options':{'where':{'type':[_0x2527('0xa')],'createdAt':{'$between':[moment()[_0x2527('0xb')]('day')[_0x2527('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x2527('0xd')](_0x2527('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x2527('0xf'),_0x2527('0x10'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x1372=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','merge','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound'];(function(_0x4cc67f,_0x56d059){var _0x5bb585=function(_0x2bb64a){while(--_0x2bb64a){_0x4cc67f['push'](_0x4cc67f['shift']());}};_0x5bb585(++_0x56d059);}(_0x1372,0x148));var _0x2137=function(_0x2b2498,_0x1f4c3f){_0x2b2498=_0x2b2498-0x0;var _0x1f6b8a=_0x1372[_0x2b2498];return _0x1f6b8a;};'use strict';var moment=require(_0x2137('0x0'));var util=require(_0x2137('0x1'));var _=require(_0x2137('0x2'));var client=require('../client');exports['create']=function(_0x274ba5){return client['Request']('CreateVoiceCallReport',{'body':_[_0x2137('0x3')](_0x274ba5,{'source':_0x274ba5['calleridnum'],'destinationcontext':_0x274ba5[_0x2137('0x4')],'callerid':_0x274ba5[_0x2137('0x5')],'amaflags':_0x2137('0x6')}),'log':_0x2137('0x7')});};exports[_0x2137('0x8')]=function(){return function(){return client[_0x2137('0x9')](_0x2137('0xa'),{'options':{'where':{'type':[_0x2137('0xb')],'createdAt':{'$between':[moment()[_0x2137('0xc')]('day')[_0x2137('0xd')](_0x2137('0xe')),moment()['endOf'](_0x2137('0xf'))[_0x2137('0xd')](_0x2137('0xe'))]}},'attributes':[_0x2137('0x10'),_0x2137('0x11'),_0x2137('0x12'),'billableseconds']},'log':_0x2137('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 927d795..baa48ad 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 _0x3d46=['Request','CreateVoiceDialReport','../client','create'];(function(_0x4c3a25,_0x264cf9){var _0x1aad4c=function(_0x52c545){while(--_0x52c545){_0x4c3a25['push'](_0x4c3a25['shift']());}};_0x1aad4c(++_0x264cf9);}(_0x3d46,0x126));var _0x63d4=function(_0x92e26c,_0x33bd33){_0x92e26c=_0x92e26c-0x0;var _0x8bd992=_0x3d46[_0x92e26c];return _0x8bd992;};'use strict';var client=require(_0x63d4('0x0'));exports[_0x63d4('0x1')]=function(_0x5140ce){return client[_0x63d4('0x2')](_0x63d4('0x3'),{'body':_0x5140ce,'log':_0x63d4('0x3')});}; \ No newline at end of file +var _0x67ae=['CreateVoiceDialReport','Request'];(function(_0x1afa85,_0x394280){var _0x40d99e=function(_0x3acb6a){while(--_0x3acb6a){_0x1afa85['push'](_0x1afa85['shift']());}};_0x40d99e(++_0x394280);}(_0x67ae,0x14b));var _0xe67a=function(_0x25364a,_0x30fc6f){_0x25364a=_0x25364a-0x0;var _0x1a98d2=_0x67ae[_0x25364a];return _0x1a98d2;};'use strict';var client=require('../client');exports['create']=function(_0x5c3f02){return client[_0xe67a('0x0')](_0xe67a('0x1'),{'body':_0x5c3f02,'log':_0xe67a('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 8f8df32..729939d 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 _0x8192=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0x8192,0x82));var _0x2819=function(_0x568dee,_0x4e390e){_0x568dee=_0x568dee-0x0;var _0x5fa13=_0x8192[_0x568dee];return _0x5fa13;};'use strict';var client=require(_0x2819('0x0'));exports[_0x2819('0x1')]=function(){return function(){return client[_0x2819('0x2')](_0x2819('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2819('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x2819('0x1')});};}; \ No newline at end of file +var _0x0457=['Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x0457,0x11f));var _0x7045=function(_0x50e30b,_0x216368){_0x50e30b=_0x50e30b-0x0;var _0x4b7300=_0x0457[_0x50e30b];return _0x4b7300;};'use strict';var client=require('../client');exports[_0x7045('0x0')]=function(){return function(){return client[_0x7045('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x7045('0x2'),_0x7045('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x7045('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2b1b0e5..11cd9de 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 _0xed1b=['../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','active','Pause','mandatoryDispositionPause','Trunk','Interval','interval'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xed1b,0x156));var _0xbed1=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xed1b[_0x3f2a90];return _0xb46279;};'use strict';var client=require(_0xbed1('0x0'));exports[_0xbed1('0x1')]=function(){return function(){return client[_0xbed1('0x2')](_0xbed1('0x3'),{'options':{'raw':![],'attributes':['id',_0xbed1('0x4'),'acw',_0xbed1('0x5'),_0xbed1('0x6'),_0xbed1('0x7'),_0xbed1('0x8'),_0xbed1('0x9'),_0xbed1('0xa'),_0xbed1('0xb'),_0xbed1('0xc'),_0xbed1('0xd'),_0xbed1('0xe'),_0xbed1('0xf'),_0xbed1('0x10'),'dialOriginateCallerIdName',_0xbed1('0x11'),_0xbed1('0x12'),'dialQueueOptions',_0xbed1('0x13'),'dialQueueProject',_0xbed1('0x14'),_0xbed1('0x15'),'dialBusyMaxRetry',_0xbed1('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xbed1('0x17'),_0xbed1('0x18'),_0xbed1('0x19'),'dialCheckDuplicateType',_0xbed1('0x1a'),'dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence',_0xbed1('0x1b'),_0xbed1('0x1c'),'dialAMDBetweenWordsSilence',_0xbed1('0x1d'),_0xbed1('0x1e'),_0xbed1('0x1f'),_0xbed1('0x20'),_0xbed1('0x21'),'dialRecallInQueue',_0xbed1('0x22'),_0xbed1('0x23'),_0xbed1('0x24'),_0xbed1('0x25'),_0xbed1('0x7'),_0xbed1('0x26'),_0xbed1('0x27'),_0xbed1('0x28'),_0xbed1('0x29'),'dialNoSuchNumberRetryFrequency',_0xbed1('0x2a'),_0xbed1('0x2b'),_0xbed1('0x2c'),_0xbed1('0x2d'),_0xbed1('0x2e'),_0xbed1('0x2f'),_0xbed1('0x30'),'dialAgentRejectRetryFrequency',_0xbed1('0x31'),_0xbed1('0x32'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xbed1('0x4'),'callerid',_0xbed1('0x33')]},{'model':_0xbed1('0x34'),'as':_0xbed1('0x35'),'attributes':['id',_0xbed1('0x4')]},{'model':_0xbed1('0x36'),'as':'TrunkBackup','attributes':['id','name','callerid',_0xbed1('0x33')]},{'model':_0xbed1('0x37'),'as':_0xbed1('0x37'),'attributes':['id','name'],'include':[{'model':_0xbed1('0x37'),'as':'Intervals','attributes':['id',_0xbed1('0x4'),_0xbed1('0x38')]}]}]},'log':_0xbed1('0x1')});};}; \ No newline at end of file +var _0x0bd3=['dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x4fb2ad,_0x49b5e0){var _0x1457a5=function(_0x27eafb){while(--_0x27eafb){_0x4fb2ad['push'](_0x4fb2ad['shift']());}};_0x1457a5(++_0x49b5e0);}(_0x0bd3,0x10c));var _0x30bd=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0x0bd3[_0x5cca9f];return _0x55edda;};'use strict';var client=require(_0x30bd('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x30bd('0x1'),{'options':{'raw':![],'attributes':['id',_0x30bd('0x2'),_0x30bd('0x3'),_0x30bd('0x4'),'autopause',_0x30bd('0x5'),_0x30bd('0x6'),_0x30bd('0x7'),'dialMethod',_0x30bd('0x8'),_0x30bd('0x9'),'dialPowerLevel',_0x30bd('0xa'),_0x30bd('0xb'),_0x30bd('0xc'),_0x30bd('0xd'),'dialOriginateCallerIdNumber',_0x30bd('0xe'),_0x30bd('0xf'),_0x30bd('0x10'),_0x30bd('0x11'),'dialCongestionMaxRetry',_0x30bd('0x12'),_0x30bd('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x30bd('0x14'),_0x30bd('0x15'),_0x30bd('0x16'),_0x30bd('0x17'),_0x30bd('0x18'),'dialCheckDuplicateType','dialAMDActive',_0x30bd('0x19'),_0x30bd('0x1a'),_0x30bd('0x1b'),_0x30bd('0x1c'),_0x30bd('0x1d'),_0x30bd('0x1e'),_0x30bd('0x1f'),_0x30bd('0x20'),'dialAMDMaximumWordLength',_0x30bd('0x21'),_0x30bd('0x22'),_0x30bd('0x23'),'dialOrderByScheduledAt',_0x30bd('0x24'),_0x30bd('0x25'),_0x30bd('0x26'),'monitor_format','strategy',_0x30bd('0x27'),_0x30bd('0x28'),_0x30bd('0x29'),_0x30bd('0x2a'),_0x30bd('0x2b'),_0x30bd('0x2c'),'dialAbandonedMaxRetry',_0x30bd('0x2d'),_0x30bd('0x2e'),_0x30bd('0x2f'),_0x30bd('0x30'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x30bd('0x31'),_0x30bd('0x32')],'include':[{'model':_0x30bd('0x33'),'as':_0x30bd('0x33'),'attributes':['id',_0x30bd('0x2'),_0x30bd('0x34'),_0x30bd('0x35')]},{'model':_0x30bd('0x36'),'as':_0x30bd('0x37'),'attributes':['id',_0x30bd('0x2')]},{'model':_0x30bd('0x33'),'as':_0x30bd('0x38'),'attributes':['id',_0x30bd('0x2'),'callerid',_0x30bd('0x35')]},{'model':_0x30bd('0x39'),'as':_0x30bd('0x39'),'attributes':['id','name'],'include':[{'model':_0x30bd('0x39'),'as':'Intervals','attributes':['id',_0x30bd('0x2'),_0x30bd('0x3a')]}]}]},'log':_0x30bd('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2d82cdd..2d28d48 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 _0x3d2f=['moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports'];(function(_0x16cd8c,_0x12279f){var _0x3cb6a9=function(_0xc17ba3){while(--_0xc17ba3){_0x16cd8c['push'](_0x16cd8c['shift']());}};_0x3cb6a9(++_0x12279f);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x5bbde3,_0x29246d){_0x5bbde3=_0x5bbde3-0x0;var _0x49d6d3=_0x3d2f[_0x5bbde3];return _0x49d6d3;};'use strict';var moment=require(_0xf3d2('0x0'));var _=require(_0xf3d2('0x1'));var client=require('../client');exports[_0xf3d2('0x2')]=function(_0x1abff0){return client[_0xf3d2('0x3')](_0xf3d2('0x4'),{'body':_0x1abff0,'log':_0xf3d2('0x4')});};exports[_0xf3d2('0x5')]=function(){return function(){return client[_0xf3d2('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xf3d2('0x6')](_0xf3d2('0x7'))[_0xf3d2('0x8')](_0xf3d2('0x9')),moment()[_0xf3d2('0xa')]('day')[_0xf3d2('0x8')](_0xf3d2('0x9'))]}},'attributes':['uniqueid',_0xf3d2('0xb'),'queuecallerjoinAt',_0xf3d2('0xc'),_0xf3d2('0xd'),_0xf3d2('0xe'),_0xf3d2('0xf'),_0xf3d2('0x10'),_0xf3d2('0x11'),'queuecallerabandonAt']},'log':_0xf3d2('0x12')});};}; \ No newline at end of file +var _0xbb1f=['uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','getVoiceQueueReports','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format'];(function(_0x21fbab,_0x1bda8d){var _0x29fef1=function(_0x1ff144){while(--_0x1ff144){_0x21fbab['push'](_0x21fbab['shift']());}};_0x29fef1(++_0x1bda8d);}(_0xbb1f,0x68));var _0xfbb1=function(_0x492e32,_0x2e0a93){_0x492e32=_0x492e32-0x0;var _0x4a335e=_0xbb1f[_0x492e32];return _0x4a335e;};'use strict';var moment=require(_0xfbb1('0x0'));var _=require(_0xfbb1('0x1'));var client=require(_0xfbb1('0x2'));exports[_0xfbb1('0x3')]=function(_0xf73926){return client[_0xfbb1('0x4')]('CreateVoiceQueueReport',{'body':_0xf73926,'log':'CreateVoiceQueueReport'});};exports[_0xfbb1('0x5')]=function(){return function(){return client[_0xfbb1('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xfbb1('0x6')](_0xfbb1('0x7'))['format'](_0xfbb1('0x8')),moment()['endOf'](_0xfbb1('0x7'))[_0xfbb1('0x9')](_0xfbb1('0x8'))]}},'attributes':[_0xfbb1('0xa'),_0xfbb1('0xb'),_0xfbb1('0xc'),_0xfbb1('0xd'),_0xfbb1('0xe'),'queuecallercompleteAt',_0xfbb1('0xf'),'queuecallerexitAt',_0xfbb1('0x10'),_0xfbb1('0x11')]},'log':_0xfbb1('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 39c2ebd..eabfea5 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 _0xafd3=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xafd3,0x95));var _0x3afd=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xafd3[_0x34933a];return _0x36abb4;};'use strict';var client=require(_0x3afd('0x0'));exports[_0x3afd('0x1')]=function(_0x2a1b35){return function(){return client[_0x3afd('0x2')](_0x3afd('0x3'),{'options':{'where':{'VoiceQueueId':_0x2a1b35,'paused':!![]},'raw':!![]},'log':_0x3afd('0x1')});};}; \ No newline at end of file +var _0xd201=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x56085e,_0x5c69e9){var _0x4de130=function(_0x120b34){while(--_0x120b34){_0x56085e['push'](_0x56085e['shift']());}};_0x4de130(++_0x5c69e9);}(_0xd201,0x17a));var _0x1d20=function(_0x7c5834,_0xa96cfb){_0x7c5834=_0x7c5834-0x0;var _0x40becf=_0xd201[_0x7c5834];return _0x40becf;};'use strict';var client=require('../client');exports[_0x1d20('0x0')]=function(_0x3fa51d){return function(){return client['Request'](_0x1d20('0x1'),{'options':{'where':{'VoiceQueueId':_0x3fa51d,'paused':!![]},'raw':!![]},'log':_0x1d20('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7c719f5..436d1db 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 _0x1569=['create','Request','CreateVoiceRecording','merge','lodash','../client'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x1569,0xf4));var _0x9156=function(_0x30df75,_0x21ebdc){_0x30df75=_0x30df75-0x0;var _0x525282=_0x1569[_0x30df75];return _0x525282;};'use strict';var _=require(_0x9156('0x0'));var client=require(_0x9156('0x1'));exports[_0x9156('0x2')]=function(_0x2866bd){return client[_0x9156('0x3')](_0x9156('0x4'),{'body':_[_0x9156('0x5')](_0x2866bd,{'value':_0x2866bd['monitorFilename']}),'log':_0x9156('0x4')});}; \ No newline at end of file +var _0xd1e3=['lodash','../client','create','CreateVoiceRecording'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xd1e3,0xfc));var _0x3d1e=function(_0x2f0b82,_0xa07e26){_0x2f0b82=_0x2f0b82-0x0;var _0x5d6fb1=_0xd1e3[_0x2f0b82];return _0x5d6fb1;};'use strict';var _=require(_0x3d1e('0x0'));var client=require(_0x3d1e('0x1'));exports[_0x3d1e('0x2')]=function(_0xcf8e56){return client['Request']('CreateVoiceRecording',{'body':_['merge'](_0xcf8e56,{'value':_0xcf8e56['monitorFilename']}),'log':_0x3d1e('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index dad154f..b77bb78 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 _0xb48b=['transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x1c7446,_0x85c8da){var _0x5a2e4e=function(_0x26b2d4){while(--_0x26b2d4){_0x1c7446['push'](_0x1c7446['shift']());}};_0x5a2e4e(++_0x85c8da);}(_0xb48b,0x10f));var _0xbb48=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xb48b[_0x589aee];return _0x2f5ed4;};'use strict';var client=require(_0xbb48('0x0'));exports[_0xbb48('0x1')]={};exports[_0xbb48('0x2')]=function(_0x21a050){return client[_0xbb48('0x3')](_0xbb48('0x4'),{'body':{'result':_0x21a050['result'],'transfererchannel':_0x21a050[_0xbb48('0x5')],'transferercalleridnum':_0x21a050[_0xbb48('0x6')],'transferercalleridname':_0x21a050[_0xbb48('0x7')],'transfererconnectedlinenum':_0x21a050[_0xbb48('0x8')],'transfererconnectedlinename':_0x21a050['transfererconnectedlinename'],'transfereraccountcode':_0x21a050[_0xbb48('0x9')],'transferercontext':_0x21a050[_0xbb48('0xa')],'transfererexten':_0x21a050[_0xbb48('0xb')],'transfererlinkedid':_0x21a050[_0xbb48('0xc')],'transfereechannel':_0x21a050[_0xbb48('0xd')],'transfereecalleridnum':_0x21a050['transfereecalleridnum'],'transfereecalleridname':_0x21a050[_0xbb48('0xe')],'transfereeconnectedlinenum':_0x21a050[_0xbb48('0xf')],'transfereeconnectedlinename':_0x21a050['transfereeconnectedlinename'],'transfereeaccountcode':_0x21a050[_0xbb48('0x10')],'transfereecontext':_0x21a050['transfereecontext'],'transfereeexten':_0x21a050[_0xbb48('0x11')],'transfereelinkedid':_0x21a050[_0xbb48('0x12')],'isexternal':_0x21a050[_0xbb48('0x13')],'context':_0x21a050[_0xbb48('0x14')],'extension':_0x21a050[_0xbb48('0x15')],'type':'blind'},'log':_0xbb48('0x4')});};exports[_0xbb48('0x16')]=function(_0xc78c7c){return client[_0xbb48('0x3')](_0xbb48('0x4'),{'body':{'result':_0xc78c7c[_0xbb48('0x17')],'transfererchannel':_0xc78c7c['origtransfererchannel'],'transferercalleridnum':_0xc78c7c['origtransferercalleridnum'],'transferercalleridname':_0xc78c7c['origtransferercalleridname'],'transfererconnectedlinenum':_0xc78c7c[_0xbb48('0x18')],'transfererconnectedlinename':_0xc78c7c[_0xbb48('0x19')],'transfereraccountcode':_0xc78c7c[_0xbb48('0x1a')],'transferercontext':_0xc78c7c[_0xbb48('0x1b')],'transfererexten':_0xc78c7c[_0xbb48('0x1c')],'transfererlinkedid':_0xc78c7c[_0xbb48('0x1d')],'transfereechannel':_0xc78c7c['transfertargetchannel'],'transfereecalleridnum':_0xc78c7c['transfertargetcalleridnum'],'transfereecalleridname':_0xc78c7c[_0xbb48('0x1e')],'transfereeconnectedlinenum':_0xc78c7c[_0xbb48('0x1f')],'transfereeconnectedlinename':_0xc78c7c[_0xbb48('0x20')],'transfereeaccountcode':_0xc78c7c[_0xbb48('0x21')],'transfereecontext':_0xc78c7c['transfertargetcontext'],'transfereeexten':_0xc78c7c[_0xbb48('0x22')],'transfereelinkedid':_0xc78c7c[_0xbb48('0x23')],'isexternal':_0xc78c7c['isexternal'],'context':_0xc78c7c[_0xbb48('0x24')],'extension':_0xc78c7c[_0xbb48('0x25')],'type':'attended'},'log':_0xbb48('0x4')});}; \ No newline at end of file +var _0x4279=['origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension'];(function(_0x4846bd,_0x75c126){var _0x37d755=function(_0x2b1fd9){while(--_0x2b1fd9){_0x4846bd['push'](_0x4846bd['shift']());}};_0x37d755(++_0x75c126);}(_0x4279,0x101));var _0x9427=function(_0x454d50,_0x3bec1f){_0x454d50=_0x454d50-0x0;var _0x48e66a=_0x4279[_0x454d50];return _0x48e66a;};'use strict';var client=require('../client');exports[_0x9427('0x0')]={};exports[_0x9427('0x1')]=function(_0x34776c){return client[_0x9427('0x2')](_0x9427('0x3'),{'body':{'result':_0x34776c[_0x9427('0x4')],'transfererchannel':_0x34776c[_0x9427('0x5')],'transferercalleridnum':_0x34776c['transferercalleridnum'],'transferercalleridname':_0x34776c['transferercalleridname'],'transfererconnectedlinenum':_0x34776c[_0x9427('0x6')],'transfererconnectedlinename':_0x34776c[_0x9427('0x7')],'transfereraccountcode':_0x34776c[_0x9427('0x8')],'transferercontext':_0x34776c[_0x9427('0x9')],'transfererexten':_0x34776c[_0x9427('0xa')],'transfererlinkedid':_0x34776c[_0x9427('0xb')],'transfereechannel':_0x34776c[_0x9427('0xc')],'transfereecalleridnum':_0x34776c[_0x9427('0xd')],'transfereecalleridname':_0x34776c[_0x9427('0xe')],'transfereeconnectedlinenum':_0x34776c[_0x9427('0xf')],'transfereeconnectedlinename':_0x34776c[_0x9427('0x10')],'transfereeaccountcode':_0x34776c['transfereeaccountcode'],'transfereecontext':_0x34776c[_0x9427('0x11')],'transfereeexten':_0x34776c[_0x9427('0x12')],'transfereelinkedid':_0x34776c[_0x9427('0x13')],'isexternal':_0x34776c[_0x9427('0x14')],'context':_0x34776c[_0x9427('0x15')],'extension':_0x34776c[_0x9427('0x16')],'type':'blind'},'log':_0x9427('0x3')});};exports['attendedTransfer']=function(_0x3317fe){return client['Request'](_0x9427('0x3'),{'body':{'result':_0x3317fe[_0x9427('0x4')],'transfererchannel':_0x3317fe[_0x9427('0x17')],'transferercalleridnum':_0x3317fe['origtransferercalleridnum'],'transferercalleridname':_0x3317fe[_0x9427('0x18')],'transfererconnectedlinenum':_0x3317fe[_0x9427('0x19')],'transfererconnectedlinename':_0x3317fe[_0x9427('0x1a')],'transfereraccountcode':_0x3317fe['origtransfereraccountcode'],'transferercontext':_0x3317fe[_0x9427('0x1b')],'transfererexten':_0x3317fe[_0x9427('0x1c')],'transfererlinkedid':_0x3317fe['origtransfererlinkedid'],'transfereechannel':_0x3317fe[_0x9427('0x1d')],'transfereecalleridnum':_0x3317fe[_0x9427('0x1e')],'transfereecalleridname':_0x3317fe[_0x9427('0x1f')],'transfereeconnectedlinenum':_0x3317fe[_0x9427('0x20')],'transfereeconnectedlinename':_0x3317fe[_0x9427('0x21')],'transfereeaccountcode':_0x3317fe['transfertargetaccountcode'],'transfereecontext':_0x3317fe[_0x9427('0x22')],'transfereeexten':_0x3317fe[_0x9427('0x23')],'transfereelinkedid':_0x3317fe[_0x9427('0x24')],'isexternal':_0x3317fe[_0x9427('0x14')],'context':_0x3317fe[_0x9427('0x25')],'extension':_0x3317fe[_0x9427('0x26')],'type':_0x9427('0x27')},'log':_0x9427('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 34cd51b..5d6c087 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 _0x0df6=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','map','find','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','%s.%s','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','../../../config/environment','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','username','ami\x20disconnected','join','pick','keys','module','action','then','message','catch','asterisk','command','Command','Action','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0df6,0x160));var _0x60df=function(_0x2d7311,_0x41f398){_0x2d7311=_0x2d7311-0x0;var _0xd1b24=_0x0df6[_0x2d7311];return _0xd1b24;};'use strict';var _=require(_0x60df('0x0'));var util=require(_0x60df('0x1'));var jayson=require('jayson/promise');var schema=require(_0x60df('0x2'));var BPromise=require(_0x60df('0x3'));var moment=require('moment');var config=require(_0x60df('0x4'));var properties=require('../properties');var ami=require('../ami');exports[_0x60df('0x5')]=function(_0x489932,_0x590d5a,_0x4f19ef){return new BPromise(function(_0x29a00e,_0x2b83a4){var _0x1b4365={'QueuePause':function(_0x2f1ad4){return new Promise(function(_0x135011,_0x1a635a){var _0x11a354=util[_0x60df('0x6')](_0x60df('0x7'),_0x60df('0x8'),_0x2f1ad4[_0x60df('0x9')]);if(_0x489932['timers']&&_0x489932[_0x60df('0xa')][_0x11a354]&&_0x489932[_0x60df('0xa')][_0x11a354][_0x60df('0xb')]){_0x489932[_0x60df('0xa')][_0x11a354][_0x60df('0xc')]();}if(_0x489932[_0x60df('0xd')][_0x11a354]){_0x489932['agents'][_0x11a354][_0x60df('0xe')]({'statePause':_0x2f1ad4[_0x60df('0xf')]?!![]:![]});}_0x135011({'code':0xc8,'message':_0x60df('0x10')});});},'Reload':function(_0x22f4f9){var _0x4e44dc=this;return new Promise(function(_0x3395f8,_0x96a4f1){if(ami[_0x60df('0x11')]()==![]){return _0x96a4f1(_0x4e44dc[_0x60df('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x60df('0x13')],_0x60df('0x14')][_0x60df('0x15')]('\x20')));}_0x22f4f9=_[_0x60df('0x16')](_0x22f4f9,_[_0x60df('0x17')](properties[_0x60df('0x18')]));_0x22f4f9[_0x60df('0x19')]='Reload';return ami['Action'](_0x22f4f9)[_0x60df('0x1a')](function(_0x433d82){_0x3395f8({'code':0xc8,'message':_0x433d82[_0x60df('0x1b')]});})[_0x60df('0x1c')](function(_0x1268ef){_0x96a4f1(_0x4e44dc[_0x60df('0x12')](0x1f5,_0x1268ef[_0x60df('0x1b')]));});});},'Command':function(_0xf3bcc3){var _0x1802ed=this;return new Promise(function(_0x1621d0,_0x4b1db4){if(ami[_0x60df('0x11')]()==![]){return _0x4b1db4(_0x1802ed[_0x60df('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x60df('0x1d')][_0x60df('0x13')],_0x60df('0x14')]['join']('\x20')));}_0xf3bcc3=_[_0x60df('0x16')](_0xf3bcc3,_0x60df('0x1e'));_0xf3bcc3[_0x60df('0x19')]=_0x60df('0x1f');return ami[_0x60df('0x20')](_0xf3bcc3)['then'](function(_0x4d5239){_0x1621d0({'code':0xc8,'message':_0x4d5239[_0x60df('0x21')]});})[_0x60df('0x1c')](function(_0x73d870){_0x4b1db4(_0x1802ed[_0x60df('0x12')](0x1f5,_0x73d870[_0x60df('0x1b')]));});});},'VoiceQueues':function(_0x343b61){return new Promise(function(_0x5a2999,_0x2ff905){var _0x4e58af=[];for(var _0x5d1877 in _0x489932[_0x60df('0x22')]){if(_0x489932[_0x60df('0x22')][_0x60df('0x23')](_0x5d1877)){var _0x1b89a8=_0x489932[_0x60df('0x22')][_0x5d1877];var _0x42fe46={'id':_0x1b89a8['id'],'name':_0x1b89a8['name'],'strategy':_0x1b89a8['strategy'],'answered':_0x1b89a8[_0x60df('0x24')],'available':_0x1b89a8[_0x60df('0x25')],'loggedIn':_0x1b89a8[_0x60df('0x26')],'pTalking':_0x1b89a8[_0x60df('0x27')],'sumBillable':_0x1b89a8[_0x60df('0x28')],'sumDuration':_0x1b89a8[_0x60df('0x29')],'sumHoldTime':_0x1b89a8['sumHoldTime']||0x0,'talking':_0x1b89a8[_0x60df('0x2a')],'total':_0x1b89a8[_0x60df('0x2b')],'type':_0x1b89a8['type'],'unmanaged':_0x1b89a8[_0x60df('0x2c')],'abandoned':_0x1b89a8['abandoned'],'waiting':_0x1b89a8[_0x60df('0x2d')],'loggedInDb':_0x1b89a8[_0x60df('0x2e')]};if(_0x1b89a8[_0x60df('0x2f')]===_0x60df('0x30')){_0x42fe46[_0x60df('0x31')]=_0x1b89a8[_0x60df('0x31')];_0x42fe46[_0x60df('0x32')]=_0x1b89a8[_0x60df('0x32')];_0x42fe46[_0x60df('0x33')]=_0x1b89a8[_0x60df('0x33')];_0x42fe46[_0x60df('0x34')]=_0x1b89a8['dialOriginateCallerIdNumber'];_0x42fe46[_0x60df('0x35')]=_0x1b89a8[_0x60df('0x35')];_0x42fe46['dialPrefix']=_0x1b89a8[_0x60df('0x36')];_0x42fe46['outboundAnswerAgiCallsDay']=_0x1b89a8['outboundAnswerAgiCallsDay'];_0x42fe46['outboundAnswerCallsDay']=_0x1b89a8['outboundAnswerCallsDay'];_0x42fe46[_0x60df('0x37')]=_0x1b89a8['outboundBlacklistCallsDay'];_0x42fe46[_0x60df('0x38')]=_0x1b89a8[_0x60df('0x38')];_0x42fe46[_0x60df('0x39')]=_0x1b89a8[_0x60df('0x39')];_0x42fe46[_0x60df('0x3a')]=_0x1b89a8['outboundDropCallsDayACS'];_0x42fe46[_0x60df('0x3b')]=_0x1b89a8[_0x60df('0x3b')];_0x42fe46[_0x60df('0x3c')]=_0x1b89a8[_0x60df('0x3c')];_0x42fe46[_0x60df('0x3d')]=_0x1b89a8[_0x60df('0x3d')];_0x42fe46['outboundNoSuchCallsDay']=_0x1b89a8[_0x60df('0x3e')];_0x42fe46[_0x60df('0x3f')]=_0x1b89a8[_0x60df('0x3f')];_0x42fe46['outboundReCallsDay']=_0x1b89a8[_0x60df('0x40')];_0x42fe46[_0x60df('0x41')]=_0x1b89a8[_0x60df('0x41')];_0x42fe46[_0x60df('0x42')]=_0x1b89a8[_0x60df('0x42')];_0x42fe46[_0x60df('0x43')]=_0x1b89a8['predictiveIntervalAnsweredCalls'];_0x42fe46[_0x60df('0x44')]=_0x1b89a8[_0x60df('0x44')];_0x42fe46[_0x60df('0x45')]=_0x1b89a8[_0x60df('0x45')];_0x42fe46[_0x60df('0x46')]=_0x1b89a8[_0x60df('0x46')];_0x42fe46[_0x60df('0x47')]=_0x1b89a8[_0x60df('0x47')];_0x42fe46['predictiveIntervalErlangCalls']=_0x1b89a8[_0x60df('0x48')];_0x42fe46['predictiveIntervalErlangCallsDroppedCalls']=_0x1b89a8[_0x60df('0x49')];_0x42fe46[_0x60df('0x4a')]=_0x1b89a8[_0x60df('0x4a')];_0x42fe46['predictiveIntervalMultiplicativeFactor']=_0x1b89a8['predictiveIntervalMultiplicativeFactor'];_0x42fe46[_0x60df('0x4b')]=_0x1b89a8['predictiveIntervalPauses'];_0x42fe46[_0x60df('0x4c')]=_0x1b89a8[_0x60df('0x4c')];_0x42fe46[_0x60df('0x4d')]=_0x1b89a8[_0x60df('0x4d')];_0x42fe46['message']=_0x1b89a8[_0x60df('0x1b')];_0x42fe46[_0x60df('0x4e')]=_0x1b89a8['originated'];_0x42fe46[_0x60df('0x4f')]=_0x1b89a8[_0x60df('0x4f')];_0x42fe46['erlangCallToSecond']=_0x1b89a8[_0x60df('0x50')];_0x42fe46[_0x60df('0x51')]=_0x1b89a8[_0x60df('0x51')];_0x42fe46[_0x60df('0x52')]=_0x1b89a8['erlangBusyFactor'];_0x42fe46[_0x60df('0x53')]=_0x1b89a8[_0x60df('0x53')];_0x42fe46[_0x60df('0x54')]=_0x1b89a8[_0x60df('0x54')];}if(_0x1b89a8[_0x60df('0x55')]){_0x42fe46[_0x60df('0x55')]={'id':_0x1b89a8[_0x60df('0x55')]['id'],'name':_0x1b89a8['Trunk'][_0x60df('0x9')],'active':_0x1b89a8[_0x60df('0x55')][_0x60df('0x56')],'callerid':_0x1b89a8['Trunk'][_0x60df('0x57')]};}if(_0x1b89a8['Interval']){_0x42fe46[_0x60df('0x58')]={'id':_0x1b89a8['Interval']['id'],'name':_0x1b89a8[_0x60df('0x58')][_0x60df('0x9')]};}_0x4e58af[_0x60df('0x59')](_0x42fe46);}}_0x5a2999({'count':_0x4e58af[_0x60df('0x5a')],'rows':_0x4e58af});});},'VoiceChannels':function(_0x33db8b){return new Promise(function(_0x210673,_0xfa986b){var _0x261a7b=_[_0x60df('0x5b')](_0x489932[_0x60df('0x5c')]);_0x210673({'count':_0x261a7b['length'],'rows':_0x261a7b});});},'VoiceChannelMixMonitor':function(_0x28afe1){var _0x2998fa=this;return new Promise(function(_0x400481,_0x1c4210){if(ami[_0x60df('0x11')]()==![]){return _0x1c4210(_0x2998fa['error'](0x1f4,[config['asterisk']['ip'],config[_0x60df('0x1d')][_0x60df('0x13')],_0x60df('0x14')]['join']('\x20')));}var _0x11eced=schema(properties[_0x60df('0x5d')])[_0x60df('0x2')](_0x28afe1);if(_0x11eced[_0x60df('0x5a')]>0x0){return _0x1c4210(_0x2998fa[_0x60df('0x12')](0x1f4,_[_0x60df('0x5e')](_0x11eced,_0x60df('0x1b'))['join'](',\x20')));}var _0x1b7518=_[_0x60df('0x5f')](_0x489932['channels'],{'uniqueid':_0x28afe1[_0x60df('0x60')]});if(_0x1b7518&&_0x1b7518[_0x60df('0x61')]){var _0x2955d8=util[_0x60df('0x6')]('%s.%s',_0x28afe1[_0x60df('0x62')]||_0x28afe1['uniqueid'],_0x28afe1[_0x60df('0x6')]||_0x60df('0x63'));return ami['Action']({'action':_0x60df('0x64'),'channel':_0x1b7518['channel'],'file':_0x2955d8,'options':_0x60df('0x65')})[_0x60df('0x1a')](function(_0x563e52){var _0x475005=_[_0x60df('0x5f')](_0x1b7518[_0x60df('0x66')],{'filename':_0x60df('0x67')+_0x2955d8[_0x60df('0x68')]()});if(_[_0x60df('0x69')](_0x475005)){_0x1b7518['monitors'][_0x60df('0x59')]({'filename':_0x60df('0x67')+_0x2955d8[_0x60df('0x68')](),'createdAt':moment()[_0x60df('0x6')](_0x60df('0x6a')),'mixmonitorid':_0x563e52[_0x60df('0x6b')],'status':'rec'});}else{_0x475005[_0x60df('0x6b')]=_0x563e52[_0x60df('0x6b')];_0x475005[_0x60df('0x6c')]='rec';}_0x400481({'code':0xc8,'message':[_0x28afe1[_0x60df('0x60')],_0x60df('0x6d'),_0x563e52[_0x60df('0x6b')]][_0x60df('0x15')]('\x20'),'mixmonitorid':_0x563e52[_0x60df('0x6b')]});})[_0x60df('0x1c')](function(_0x12204b){_0x1c4210(_0x2998fa[_0x60df('0x12')](0x1f5,[_0x28afe1[_0x60df('0x60')],_0x12204b[_0x60df('0x1b')][_0x60df('0x68')]()]['join']('\x20')));});}else{return _0x1c4210(_0x2998fa[_0x60df('0x12')](0x1f5,_0x60df('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x386551){var _0x341eb1=this;return new Promise(function(_0x30a5f6,_0x4972c8){if(ami[_0x60df('0x11')]()==![]){return _0x4972c8(_0x341eb1[_0x60df('0x12')](0x1f4,[config[_0x60df('0x1d')]['ip'],config['asterisk'][_0x60df('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x5ca0b4=schema(properties['voicechannel'])[_0x60df('0x2')](_0x386551);if(_0x5ca0b4[_0x60df('0x5a')]>0x0){return _0x4972c8(_0x341eb1[_0x60df('0x12')](0x1f4,_[_0x60df('0x5e')](_0x5ca0b4,'message')[_0x60df('0x15')](',\x20')));}var _0x194317=_[_0x60df('0x5f')](_0x489932['channels'],{'uniqueid':_0x386551['uniqueid']});if(_0x194317){return BPromise['resolve']()['then'](function(){if(_0x194317[_0x60df('0x61')]){return ami['Action']({'action':_0x60df('0x6f'),'channel':_0x194317[_0x60df('0x61')],'mixmonitorid':_0x386551[_0x60df('0x6b')]})[_0x60df('0x1c')](function(_0x23ee73){});}})[_0x60df('0x1a')](function(){if(_0x194317[_0x60df('0x70')]){return ami['Action']({'action':_0x60df('0x6f'),'channel':_0x194317['destinationchannel'],'mixmonitorid':_0x386551[_0x60df('0x6b')]})[_0x60df('0x1c')](function(_0x533c8e){});}})['then'](function(_0x326461){var _0x5b4064=_[_0x60df('0x5f')](_0x194317[_0x60df('0x66')],{'mixmonitorid':_0x386551[_0x60df('0x6b')]});if(_0x5b4064){_0x5b4064[_0x60df('0x6c')]='stop';}})[_0x60df('0x1a')](function(){var _0xb02fab=util[_0x60df('0x6')](_0x60df('0x71'),_0x386551[_0x60df('0x62')]||_0x386551[_0x60df('0x60')],_0x386551[_0x60df('0x6')]||_0x60df('0x63'));var _0x3d555c=_[_0x60df('0x5f')](_0x194317[_0x60df('0x66')],{'filename':_0x60df('0x67')+_0xb02fab['toLowerCase']()});if(_0x3d555c){_0x3d555c[_0x60df('0x6c')]=_0x60df('0x72');}})[_0x60df('0x1a')](function(){_0x30a5f6({'code':0xc8,'message':[_0x386551[_0x60df('0x60')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x60df('0x1c')](function(_0x584f70){_0x4972c8(_0x341eb1[_0x60df('0x12')](0x1f5,[_0x386551[_0x60df('0x60')],_0x584f70[_0x60df('0x1b')]['toLowerCase']()][_0x60df('0x15')]('\x20')));});}else{return _0x4972c8(_0x341eb1[_0x60df('0x12')](0x1f5,_0x60df('0x6e')));}});},'VoiceQueuesChannels':function(_0x373a37){return new Promise(function(_0x4d1349,_0x5e2382){var _0x10f3a0=_[_0x60df('0x5b')](_0x489932[_0x60df('0x73')]);_0x4d1349({'count':_0x10f3a0[_0x60df('0x5a')],'rows':_0x10f3a0});});},'VoiceQueuesChannel':function(_0x59b78f){var _0x19d494=this;return new Promise(function(_0x57b33f,_0xe67d91){var _0x805b21=schema(properties[_0x60df('0x74')])[_0x60df('0x2')](_0x59b78f);if(_0x805b21[_0x60df('0x5a')]>0x0){return _0xe67d91(_0x19d494['error'](0x1f4,_[_0x60df('0x5e')](_0x805b21,_0x60df('0x1b'))[_0x60df('0x15')](',\x20')));}var _0x47600f=_[_0x60df('0x5f')](_0x489932[_0x60df('0x73')],{'uniqueid':_0x59b78f['uniqueid']});if(_0x47600f){_0x57b33f(_0x47600f);}else{return _0xe67d91(_0x19d494['error'](0x1f5,_0x60df('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x1773e2){var _0x2c216a=this;return new Promise(function(_0x17eb0f,_0x2f305e){if(ami[_0x60df('0x11')]()==![]){return _0x2f305e(_0x2c216a[_0x60df('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x60df('0x14')][_0x60df('0x15')]('\x20')));}var _0x2f6efd=schema(properties[_0x60df('0x75')])[_0x60df('0x2')](_0x1773e2);if(_0x2f6efd[_0x60df('0x5a')]>0x0){return _0x2f305e(_0x2c216a[_0x60df('0x12')](0x1f4,_[_0x60df('0x5e')](_0x2f6efd,_0x60df('0x1b'))[_0x60df('0x15')](',\x20')));}var _0x16fad4=_[_0x60df('0x5f')](_0x489932['queueChannels'],{'uniqueid':_0x1773e2['uniqueid']});if(_0x16fad4&&_0x16fad4['channel']){return ami[_0x60df('0x20')]({'action':_0x60df('0x76'),'channel':_0x16fad4[_0x60df('0x61')]})[_0x60df('0x1a')](function(_0x1f27c4){_0x17eb0f({'code':0xc8,'message':[_0x1773e2[_0x60df('0x60')],_0x1f27c4[_0x60df('0x1b')][_0x60df('0x68')]()][_0x60df('0x15')]('\x20')});})['catch'](function(_0x219f8c){_0x2f305e(_0x2c216a['error'](0x1f5,[_0x1773e2[_0x60df('0x60')],_0x219f8c['message'][_0x60df('0x68')]()][_0x60df('0x15')]('\x20')));});}else{return _0x2f305e(_0x2c216a[_0x60df('0x12')](0x1f5,_0x60df('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x31493f){var _0x336a9b=this;return new Promise(function(_0x18f901,_0x47dbcc){if(ami[_0x60df('0x11')]()==![]){return _0x47dbcc(_0x336a9b[_0x60df('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x60df('0x1d')]['username'],_0x60df('0x14')]['join']('\x20')));}var _0x533a4c=schema(properties['voicequeuechannelredirect'])[_0x60df('0x2')](_0x31493f);if(_0x533a4c[_0x60df('0x5a')]>0x0){return _0x47dbcc(_0x336a9b[_0x60df('0x12')](0x1f4,_[_0x60df('0x5e')](_0x533a4c,_0x60df('0x1b'))[_0x60df('0x15')](',\x20')));}var _0x1c0017=_[_0x60df('0x5f')](_0x489932['queueChannels'],{'uniqueid':_0x31493f[_0x60df('0x60')]});if(_0x1c0017&&_0x1c0017['channel']){return ami[_0x60df('0x20')]({'action':'Redirect','channel':_0x1c0017[_0x60df('0x61')],'exten':_0x31493f[_0x60df('0x77')],'context':_0x31493f[_0x60df('0x78')]||_0x1c0017['context'],'priority':0x1})[_0x60df('0x1a')](function(_0x4588e2){_0x18f901({'code':0xc8,'message':[_0x31493f['uniqueid'],_0x4588e2[_0x60df('0x1b')][_0x60df('0x68')]()][_0x60df('0x15')]('\x20')});})[_0x60df('0x1c')](function(_0xc8f43c){_0x47dbcc(_0x336a9b[_0x60df('0x12')](0x1f5,[_0x31493f[_0x60df('0x60')],_0xc8f43c[_0x60df('0x1b')][_0x60df('0x68')]()][_0x60df('0x15')]('\x20')));});}else{return _0x47dbcc(_0x336a9b[_0x60df('0x12')](0x1f5,_0x60df('0x6e')));}});},'Agents':function(_0x27e841){return new Promise(function(_0x1fb894,_0x38be83){var _0xb52a3f=_['values'](_0x489932['agents']);_0x1fb894({'count':_0xb52a3f[_0x60df('0x5a')],'rows':_0xb52a3f});});},'Telephones':function(_0x429065){return new Promise(function(_0x58d5b2,_0x43ddf3){var _0x2174c5=_[_0x60df('0x5b')](_0x489932[_0x60df('0x79')]);_0x58d5b2({'count':_0x2174c5['length'],'rows':_0x2174c5});});},'Trunks':function(_0x4540f6){return new Promise(function(_0x2eae32,_0x37061a){var _0x566e32=_[_0x60df('0x5b')](_0x489932[_0x60df('0x7a')]);_0x2eae32({'count':_0x566e32[_0x60df('0x5a')],'rows':_0x566e32});});},'OutboundChannels':function(_0x47b07c){return new Promise(function(_0x304449,_0x1d54d0){var _0x3de1d7=_[_0x60df('0x5b')](_0x489932['outboundChannels']);_0x304449({'count':_0x3de1d7['length'],'rows':_0x3de1d7});});},'Outbound':function(_0x57baea){return new Promise(function(_0x47a617,_0x45a7e4){_0x47a617(_0x489932[_0x60df('0x30')]);});},'Campaigns':function(_0x5410f3){return new Promise(function(_0x2462f3,_0x50b519){var _0x2c9fe7=_[_0x60df('0x5b')](_0x489932[_0x60df('0x7b')]);_0x2462f3({'count':_0x2c9fe7[_0x60df('0x5a')],'rows':_0x2c9fe7});});},'VoiceQueuesPreview':function(_0x40b190){var _0x56df5c=this;return new Promise(function(_0x5ae879,_0x506b84){_0x590d5a[_0x60df('0x7c')](_0x40b190['id'])[_0x60df('0x1a')](function(_0x5266f4){_0x5ae879({'code':0xc8,'message':_0x5266f4[_0x60df('0x1b')]});})[_0x60df('0x1c')](function(_0x48ec3a){_0x506b84(_0x56df5c['error'](0x1f4,_0x48ec3a['message']));});});},'EventManager':function(_0x1862b6){var _0x3e0f58=this;return new Promise(function(_0x197500,_0x5f477a){if(!_0x1862b6[_0x60df('0x7d')]){return _0x5f477a(_0x3e0f58[_0x60df('0x12')](0x1f4,_0x60df('0x7e')));}ami[_0x60df('0x7f')](_0x60df('0x80')+_0x1862b6[_0x60df('0x7d')],_0x1862b6['message']);_0x197500({'code':0xc8,'message':_0x1862b6});});},'FaxAccounts':function(_0x155495){return new Promise(function(_0x2deb4e,_0x3387af){var _0x4d06a6=_[_0x60df('0x5b')](_0x489932[_0x60df('0x81')]);_0x2deb4e({'count':_0x4d06a6[_0x60df('0x5a')],'rows':_0x4d06a6});});},'SendFax':function(_0x3e4da8){var _0x551fce=this;return new Promise(function(_0x19fac,_0x9612c6){_0x4f19ef['send'](_0x3e4da8)[_0x60df('0x1a')](function(_0x138a6b){_0x19fac({'code':0xc8,'message':_0x138a6b[_0x60df('0x1b')]});})[_0x60df('0x1c')](function(_0x165f63){_0x9612c6(_0x551fce[_0x60df('0x12')](0x1f4,_0x165f63[_0x60df('0x1b')]));});});},'CheckAfterSend':function(_0x1ae943){var _0x3f3cc2=this;return new Promise(function(_0x4d72b3,_0x3cbaed){_0x4f19ef[_0x60df('0x82')](_0x1ae943)[_0x60df('0x1a')](function(_0x3159e0){_0x4d72b3({'code':0xc8,'message':_0x3159e0[_0x60df('0x1b')]});})[_0x60df('0x1c')](function(_0x621e17){_0x3cbaed(_0x3f3cc2['error'](0x1f4,_0x621e17[_0x60df('0x1b')]));});});}};var _0x3338e6=jayson[_0x60df('0x83')](_0x1b4365)[_0x60df('0x84')]();_0x3338e6['on'](_0x60df('0x12'),function(_0xe37dd3){return _0x2b83a4(_0xe37dd3);});_0x3338e6[_0x60df('0x5')](0x232a,_0x60df('0x85'),function(){console[_0x60df('0x86')](_0x60df('0x87'),0x232a);return _0x29a00e(_0x60df('0x88')+0x232a);});});}; \ No newline at end of file +var _0x4816=['voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','moment','../../../config/environment','../ami','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','answered','available','pTalking','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','channels','length','validate','map','find','uniqueid','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','rec','status','MixMonitor\x20Success','mixmonitorid','voicechannel','resolve','channel','StopMixMonitor','destinationchannel','stop','filename','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup'];(function(_0x585bc3,_0x372039){var _0x19b977=function(_0x8a662b){while(--_0x8a662b){_0x585bc3['push'](_0x585bc3['shift']());}};_0x19b977(++_0x372039);}(_0x4816,0x9b));var _0x6481=function(_0x407e38,_0x30e1cb){_0x407e38=_0x407e38-0x0;var _0x996a91=_0x4816[_0x407e38];return _0x996a91;};'use strict';var _=require(_0x6481('0x0'));var util=require('util');var jayson=require(_0x6481('0x1'));var schema=require('validate');var BPromise=require(_0x6481('0x2'));var moment=require(_0x6481('0x3'));var config=require(_0x6481('0x4'));var properties=require('../properties');var ami=require(_0x6481('0x5'));exports['listen']=function(_0x43a963,_0x29211f,_0x313ce2){return new BPromise(function(_0x5b6847,_0x54eb08){var _0x40dd51={'QueuePause':function(_0x424808){return new Promise(function(_0x312222,_0x4affd7){var _0x2188e1=util[_0x6481('0x6')](_0x6481('0x7'),'SIP',_0x424808[_0x6481('0x8')]);if(_0x43a963['timers']&&_0x43a963[_0x6481('0x9')][_0x2188e1]&&_0x43a963[_0x6481('0x9')][_0x2188e1][_0x6481('0xa')]){_0x43a963[_0x6481('0x9')][_0x2188e1][_0x6481('0xb')]();}if(_0x43a963[_0x6481('0xc')][_0x2188e1]){_0x43a963[_0x6481('0xc')][_0x2188e1][_0x6481('0xd')]({'statePause':_0x424808[_0x6481('0xe')]?!![]:![]});}_0x312222({'code':0xc8,'message':_0x6481('0xf')});});},'Reload':function(_0x118e65){var _0x144beb=this;return new Promise(function(_0xa18b7,_0x5518fb){if(ami[_0x6481('0x10')]()==![]){return _0x5518fb(_0x144beb['error'](0x1f4,[config[_0x6481('0x11')]['ip'],config[_0x6481('0x11')][_0x6481('0x12')],_0x6481('0x13')][_0x6481('0x14')]('\x20')));}_0x118e65=_[_0x6481('0x15')](_0x118e65,_[_0x6481('0x16')](properties[_0x6481('0x17')]));_0x118e65[_0x6481('0x18')]=_0x6481('0x19');return ami[_0x6481('0x1a')](_0x118e65)[_0x6481('0x1b')](function(_0xe4c387){_0xa18b7({'code':0xc8,'message':_0xe4c387[_0x6481('0x1c')]});})[_0x6481('0x1d')](function(_0x3bbec6){_0x5518fb(_0x144beb['error'](0x1f5,_0x3bbec6[_0x6481('0x1c')]));});});},'Command':function(_0x2b2f6a){var _0x5bc5e6=this;return new Promise(function(_0x64ebe,_0x78b1f8){if(ami['isConnected']()==![]){return _0x78b1f8(_0x5bc5e6[_0x6481('0x1e')](0x1f4,[config[_0x6481('0x11')]['ip'],config[_0x6481('0x11')]['username'],_0x6481('0x13')][_0x6481('0x14')]('\x20')));}_0x2b2f6a=_[_0x6481('0x15')](_0x2b2f6a,_0x6481('0x1f'));_0x2b2f6a['action']=_0x6481('0x20');return ami[_0x6481('0x1a')](_0x2b2f6a)['then'](function(_0xe37c3){_0x64ebe({'code':0xc8,'message':_0xe37c3[_0x6481('0x21')]});})[_0x6481('0x1d')](function(_0x25d704){_0x78b1f8(_0x5bc5e6[_0x6481('0x1e')](0x1f5,_0x25d704[_0x6481('0x1c')]));});});},'VoiceQueues':function(_0x36b9b2){return new Promise(function(_0xb660e9,_0xd335fd){var _0x1eab0a=[];for(var _0x4f730b in _0x43a963[_0x6481('0x22')]){if(_0x43a963['voiceQueues'][_0x6481('0x23')](_0x4f730b)){var _0x297fb2=_0x43a963['voiceQueues'][_0x4f730b];var _0xed52a6={'id':_0x297fb2['id'],'name':_0x297fb2[_0x6481('0x8')],'strategy':_0x297fb2['strategy'],'answered':_0x297fb2[_0x6481('0x24')],'available':_0x297fb2[_0x6481('0x25')],'loggedIn':_0x297fb2['loggedIn'],'pTalking':_0x297fb2[_0x6481('0x26')],'sumBillable':_0x297fb2['sumBillable'],'sumDuration':_0x297fb2['sumDuration'],'sumHoldTime':_0x297fb2['sumHoldTime']||0x0,'talking':_0x297fb2[_0x6481('0x27')],'total':_0x297fb2['total'],'type':_0x297fb2[_0x6481('0x28')],'unmanaged':_0x297fb2[_0x6481('0x29')],'abandoned':_0x297fb2[_0x6481('0x2a')],'waiting':_0x297fb2[_0x6481('0x2b')],'loggedInDb':_0x297fb2[_0x6481('0x2c')]};if(_0x297fb2[_0x6481('0x28')]===_0x6481('0x2d')){_0xed52a6[_0x6481('0x2e')]=_0x297fb2[_0x6481('0x2e')];_0xed52a6['dialMethod']=_0x297fb2[_0x6481('0x2f')];_0xed52a6[_0x6481('0x30')]=_0x297fb2[_0x6481('0x30')];_0xed52a6[_0x6481('0x31')]=_0x297fb2[_0x6481('0x31')];_0xed52a6[_0x6481('0x32')]=_0x297fb2[_0x6481('0x32')];_0xed52a6['dialPrefix']=_0x297fb2[_0x6481('0x33')];_0xed52a6['outboundAnswerAgiCallsDay']=_0x297fb2[_0x6481('0x34')];_0xed52a6[_0x6481('0x35')]=_0x297fb2[_0x6481('0x35')];_0xed52a6['outboundBlacklistCallsDay']=_0x297fb2[_0x6481('0x36')];_0xed52a6['outboundBusyCallsDay']=_0x297fb2['outboundBusyCallsDay'];_0xed52a6[_0x6481('0x37')]=_0x297fb2['outboundCongestionCallsDay'];_0xed52a6[_0x6481('0x38')]=_0x297fb2[_0x6481('0x38')];_0xed52a6[_0x6481('0x39')]=_0x297fb2['outboundDropCallsDayCallersExit'];_0xed52a6[_0x6481('0x3a')]=_0x297fb2['outboundDropCallsDayTimeout'];_0xed52a6[_0x6481('0x3b')]=_0x297fb2[_0x6481('0x3b')];_0xed52a6[_0x6481('0x3c')]=_0x297fb2[_0x6481('0x3c')];_0xed52a6['outboundOriginateFailureCallsDay']=_0x297fb2[_0x6481('0x3d')];_0xed52a6['outboundReCallsDay']=_0x297fb2[_0x6481('0x3e')];_0xed52a6[_0x6481('0x3f')]=_0x297fb2[_0x6481('0x3f')];_0xed52a6[_0x6481('0x40')]=_0x297fb2[_0x6481('0x40')];_0xed52a6[_0x6481('0x41')]=_0x297fb2[_0x6481('0x41')];_0xed52a6[_0x6481('0x42')]=_0x297fb2[_0x6481('0x42')];_0xed52a6[_0x6481('0x43')]=_0x297fb2[_0x6481('0x43')];_0xed52a6[_0x6481('0x44')]=_0x297fb2['predictiveIntervalDroppedCallsCallersExit'];_0xed52a6[_0x6481('0x45')]=_0x297fb2[_0x6481('0x45')];_0xed52a6[_0x6481('0x46')]=_0x297fb2['predictiveIntervalErlangCalls'];_0xed52a6[_0x6481('0x47')]=_0x297fb2[_0x6481('0x47')];_0xed52a6['predictiveIntervalHitRate']=_0x297fb2[_0x6481('0x48')];_0xed52a6[_0x6481('0x49')]=_0x297fb2[_0x6481('0x49')];_0xed52a6['predictiveIntervalPauses']=_0x297fb2[_0x6481('0x4a')];_0xed52a6[_0x6481('0x4b')]=_0x297fb2[_0x6481('0x4b')];_0xed52a6[_0x6481('0x4c')]=_0x297fb2['predictiveIntervalTotalCalls'];_0xed52a6['message']=_0x297fb2[_0x6481('0x1c')];_0xed52a6[_0x6481('0x4d')]=_0x297fb2[_0x6481('0x4d')];_0xed52a6['erlangCalls']=_0x297fb2[_0x6481('0x4e')];_0xed52a6['erlangCallToSecond']=_0x297fb2[_0x6481('0x4f')];_0xed52a6[_0x6481('0x50')]=_0x297fb2[_0x6481('0x50')];_0xed52a6[_0x6481('0x51')]=_0x297fb2[_0x6481('0x51')];_0xed52a6[_0x6481('0x52')]=_0x297fb2[_0x6481('0x52')];_0xed52a6[_0x6481('0x53')]=_0x297fb2[_0x6481('0x53')];}if(_0x297fb2[_0x6481('0x54')]){_0xed52a6[_0x6481('0x54')]={'id':_0x297fb2['Trunk']['id'],'name':_0x297fb2[_0x6481('0x54')][_0x6481('0x8')],'active':_0x297fb2['Trunk']['active'],'callerid':_0x297fb2['Trunk'][_0x6481('0x55')]};}if(_0x297fb2[_0x6481('0x56')]){_0xed52a6[_0x6481('0x56')]={'id':_0x297fb2['Interval']['id'],'name':_0x297fb2[_0x6481('0x56')][_0x6481('0x8')]};}_0x1eab0a[_0x6481('0x57')](_0xed52a6);}}_0xb660e9({'count':_0x1eab0a['length'],'rows':_0x1eab0a});});},'VoiceChannels':function(_0xf0b3d2){return new Promise(function(_0x49d0b2,_0x16bf4b){var _0x2b5040=_['values'](_0x43a963[_0x6481('0x58')]);_0x49d0b2({'count':_0x2b5040[_0x6481('0x59')],'rows':_0x2b5040});});},'VoiceChannelMixMonitor':function(_0x2c0d54){var _0x986e94=this;return new Promise(function(_0x46372b,_0xbbf315){if(ami[_0x6481('0x10')]()==![]){return _0xbbf315(_0x986e94[_0x6481('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x6481('0x11')][_0x6481('0x12')],'ami\x20disconnected'][_0x6481('0x14')]('\x20')));}var _0x5ee51a=schema(properties['voicechannel'])[_0x6481('0x5a')](_0x2c0d54);if(_0x5ee51a[_0x6481('0x59')]>0x0){return _0xbbf315(_0x986e94[_0x6481('0x1e')](0x1f4,_[_0x6481('0x5b')](_0x5ee51a,'message')[_0x6481('0x14')](',\x20')));}var _0x5cd7cd=_[_0x6481('0x5c')](_0x43a963[_0x6481('0x58')],{'uniqueid':_0x2c0d54[_0x6481('0x5d')]});if(_0x5cd7cd&&_0x5cd7cd['channel']){var _0x40b998=util[_0x6481('0x6')](_0x6481('0x5e'),_0x2c0d54['filename']||_0x2c0d54[_0x6481('0x5d')],_0x2c0d54[_0x6481('0x6')]||_0x6481('0x5f'));return ami[_0x6481('0x1a')]({'action':_0x6481('0x60'),'channel':_0x5cd7cd['channel'],'file':_0x40b998,'options':_0x6481('0x61')})[_0x6481('0x1b')](function(_0x116382){var _0x364ea4=_[_0x6481('0x5c')](_0x5cd7cd[_0x6481('0x62')],{'filename':_0x6481('0x63')+_0x40b998[_0x6481('0x64')]()});if(_['isNil'](_0x364ea4)){_0x5cd7cd[_0x6481('0x62')][_0x6481('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x40b998[_0x6481('0x64')](),'createdAt':moment()[_0x6481('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x116382['mixmonitorid'],'status':_0x6481('0x65')});}else{_0x364ea4['mixmonitorid']=_0x116382['mixmonitorid'];_0x364ea4[_0x6481('0x66')]=_0x6481('0x65');}_0x46372b({'code':0xc8,'message':[_0x2c0d54[_0x6481('0x5d')],_0x6481('0x67'),_0x116382[_0x6481('0x68')]][_0x6481('0x14')]('\x20'),'mixmonitorid':_0x116382[_0x6481('0x68')]});})[_0x6481('0x1d')](function(_0x533268){_0xbbf315(_0x986e94[_0x6481('0x1e')](0x1f5,[_0x2c0d54[_0x6481('0x5d')],_0x533268[_0x6481('0x1c')][_0x6481('0x64')]()][_0x6481('0x14')]('\x20')));});}else{return _0xbbf315(_0x986e94['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1200d3){var _0x318813=this;return new Promise(function(_0x352033,_0x962316){if(ami[_0x6481('0x10')]()==![]){return _0x962316(_0x318813[_0x6481('0x1e')](0x1f4,[config[_0x6481('0x11')]['ip'],config[_0x6481('0x11')][_0x6481('0x12')],_0x6481('0x13')]['join']('\x20')));}var _0x4ed5e0=schema(properties[_0x6481('0x69')])[_0x6481('0x5a')](_0x1200d3);if(_0x4ed5e0[_0x6481('0x59')]>0x0){return _0x962316(_0x318813[_0x6481('0x1e')](0x1f4,_[_0x6481('0x5b')](_0x4ed5e0,_0x6481('0x1c'))[_0x6481('0x14')](',\x20')));}var _0x3c9f43=_[_0x6481('0x5c')](_0x43a963[_0x6481('0x58')],{'uniqueid':_0x1200d3[_0x6481('0x5d')]});if(_0x3c9f43){return BPromise[_0x6481('0x6a')]()[_0x6481('0x1b')](function(){if(_0x3c9f43[_0x6481('0x6b')]){return ami[_0x6481('0x1a')]({'action':_0x6481('0x6c'),'channel':_0x3c9f43[_0x6481('0x6b')],'mixmonitorid':_0x1200d3[_0x6481('0x68')]})[_0x6481('0x1d')](function(_0x5854e1){});}})[_0x6481('0x1b')](function(){if(_0x3c9f43['destinationchannel']){return ami[_0x6481('0x1a')]({'action':_0x6481('0x6c'),'channel':_0x3c9f43[_0x6481('0x6d')],'mixmonitorid':_0x1200d3[_0x6481('0x68')]})[_0x6481('0x1d')](function(_0x7af166){});}})[_0x6481('0x1b')](function(_0x13c891){var _0x1b9054=_['find'](_0x3c9f43['monitors'],{'mixmonitorid':_0x1200d3[_0x6481('0x68')]});if(_0x1b9054){_0x1b9054[_0x6481('0x66')]=_0x6481('0x6e');}})[_0x6481('0x1b')](function(){var _0x20b91a=util[_0x6481('0x6')]('%s.%s',_0x1200d3[_0x6481('0x6f')]||_0x1200d3[_0x6481('0x5d')],_0x1200d3[_0x6481('0x6')]||_0x6481('0x5f'));var _0x24c4f8=_[_0x6481('0x5c')](_0x3c9f43['monitors'],{'filename':_0x6481('0x63')+_0x20b91a[_0x6481('0x64')]()});if(_0x24c4f8){_0x24c4f8[_0x6481('0x66')]='stop';}})[_0x6481('0x1b')](function(){_0x352033({'code':0xc8,'message':[_0x1200d3[_0x6481('0x5d')],'StopMixMonitor\x20Success'][_0x6481('0x14')]('\x20')});})[_0x6481('0x1d')](function(_0x14afda){_0x962316(_0x318813[_0x6481('0x1e')](0x1f5,[_0x1200d3[_0x6481('0x5d')],_0x14afda[_0x6481('0x1c')][_0x6481('0x64')]()][_0x6481('0x14')]('\x20')));});}else{return _0x962316(_0x318813['error'](0x1f5,_0x6481('0x70')));}});},'VoiceQueuesChannels':function(_0x3c89e5){return new Promise(function(_0x4c6722,_0x4a59c1){var _0x52d478=_[_0x6481('0x71')](_0x43a963[_0x6481('0x72')]);_0x4c6722({'count':_0x52d478['length'],'rows':_0x52d478});});},'VoiceQueuesChannel':function(_0x236752){var _0x35b390=this;return new Promise(function(_0x29b44f,_0x30c3bf){var _0x5e7ca5=schema(properties[_0x6481('0x73')])['validate'](_0x236752);if(_0x5e7ca5['length']>0x0){return _0x30c3bf(_0x35b390['error'](0x1f4,_[_0x6481('0x5b')](_0x5e7ca5,_0x6481('0x1c'))[_0x6481('0x14')](',\x20')));}var _0xbfaf3a=_['find'](_0x43a963[_0x6481('0x72')],{'uniqueid':_0x236752[_0x6481('0x5d')]});if(_0xbfaf3a){_0x29b44f(_0xbfaf3a);}else{return _0x30c3bf(_0x35b390[_0x6481('0x1e')](0x1f5,_0x6481('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x2f4f22){var _0x6220c8=this;return new Promise(function(_0x2798e6,_0x3ed943){if(ami['isConnected']()==![]){return _0x3ed943(_0x6220c8[_0x6481('0x1e')](0x1f4,[config[_0x6481('0x11')]['ip'],config[_0x6481('0x11')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x59f68f=schema(properties[_0x6481('0x74')])[_0x6481('0x5a')](_0x2f4f22);if(_0x59f68f['length']>0x0){return _0x3ed943(_0x6220c8[_0x6481('0x1e')](0x1f4,_['map'](_0x59f68f,_0x6481('0x1c'))[_0x6481('0x14')](',\x20')));}var _0xe9f79f=_[_0x6481('0x5c')](_0x43a963[_0x6481('0x72')],{'uniqueid':_0x2f4f22[_0x6481('0x5d')]});if(_0xe9f79f&&_0xe9f79f['channel']){return ami['Action']({'action':'Hangup','channel':_0xe9f79f[_0x6481('0x6b')]})[_0x6481('0x1b')](function(_0x3c3d81){_0x2798e6({'code':0xc8,'message':[_0x2f4f22['uniqueid'],_0x3c3d81[_0x6481('0x1c')]['toLowerCase']()]['join']('\x20')});})[_0x6481('0x1d')](function(_0x586134){_0x3ed943(_0x6220c8[_0x6481('0x1e')](0x1f5,[_0x2f4f22[_0x6481('0x5d')],_0x586134[_0x6481('0x1c')][_0x6481('0x64')]()][_0x6481('0x14')]('\x20')));});}else{return _0x3ed943(_0x6220c8[_0x6481('0x1e')](0x1f5,_0x6481('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x397f6d){var _0x2bf160=this;return new Promise(function(_0x3596c8,_0x512b6f){if(ami['isConnected']()==![]){return _0x512b6f(_0x2bf160['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6481('0x14')]('\x20')));}var _0x238584=schema(properties[_0x6481('0x75')])[_0x6481('0x5a')](_0x397f6d);if(_0x238584['length']>0x0){return _0x512b6f(_0x2bf160[_0x6481('0x1e')](0x1f4,_[_0x6481('0x5b')](_0x238584,_0x6481('0x1c'))[_0x6481('0x14')](',\x20')));}var _0x143b10=_[_0x6481('0x5c')](_0x43a963['queueChannels'],{'uniqueid':_0x397f6d['uniqueid']});if(_0x143b10&&_0x143b10[_0x6481('0x6b')]){return ami[_0x6481('0x1a')]({'action':_0x6481('0x76'),'channel':_0x143b10[_0x6481('0x6b')],'exten':_0x397f6d['exten'],'context':_0x397f6d[_0x6481('0x77')]||_0x143b10[_0x6481('0x77')],'priority':0x1})[_0x6481('0x1b')](function(_0x53f81c){_0x3596c8({'code':0xc8,'message':[_0x397f6d[_0x6481('0x5d')],_0x53f81c['message']['toLowerCase']()][_0x6481('0x14')]('\x20')});})[_0x6481('0x1d')](function(_0x19167f){_0x512b6f(_0x2bf160[_0x6481('0x1e')](0x1f5,[_0x397f6d[_0x6481('0x5d')],_0x19167f[_0x6481('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x512b6f(_0x2bf160['error'](0x1f5,_0x6481('0x70')));}});},'Agents':function(_0x214e43){return new Promise(function(_0x38f71b,_0x5f044b){var _0x28fff0=_[_0x6481('0x71')](_0x43a963['agents']);_0x38f71b({'count':_0x28fff0[_0x6481('0x59')],'rows':_0x28fff0});});},'Telephones':function(_0x1baf8d){return new Promise(function(_0x772a01,_0x2f1a38){var _0x42be8f=_[_0x6481('0x71')](_0x43a963[_0x6481('0x78')]);_0x772a01({'count':_0x42be8f['length'],'rows':_0x42be8f});});},'Trunks':function(_0x5a6c18){return new Promise(function(_0x383754,_0xfa431){var _0x52ea1c=_[_0x6481('0x71')](_0x43a963[_0x6481('0x79')]);_0x383754({'count':_0x52ea1c[_0x6481('0x59')],'rows':_0x52ea1c});});},'OutboundChannels':function(_0x40f1d7){return new Promise(function(_0x3741af,_0x9e1a3b){var _0x5b5ed8=_[_0x6481('0x71')](_0x43a963[_0x6481('0x7a')]);_0x3741af({'count':_0x5b5ed8['length'],'rows':_0x5b5ed8});});},'Outbound':function(_0x569c56){return new Promise(function(_0x313831,_0x1d4026){_0x313831(_0x43a963[_0x6481('0x2d')]);});},'Campaigns':function(_0x3587f5){return new Promise(function(_0x19137b,_0x496f33){var _0x3dc2b5=_[_0x6481('0x71')](_0x43a963[_0x6481('0x7b')]);_0x19137b({'count':_0x3dc2b5[_0x6481('0x59')],'rows':_0x3dc2b5});});},'VoiceQueuesPreview':function(_0x22d0e9){var _0x1ccc26=this;return new Promise(function(_0x211e9b,_0x4cb9d3){_0x29211f[_0x6481('0x7c')](_0x22d0e9['id'])['then'](function(_0x199050){_0x211e9b({'code':0xc8,'message':_0x199050[_0x6481('0x1c')]});})[_0x6481('0x1d')](function(_0x8d6e7b){_0x4cb9d3(_0x1ccc26[_0x6481('0x1e')](0x1f4,_0x8d6e7b[_0x6481('0x1c')]));});});},'EventManager':function(_0x5ef848){var _0x3b266c=this;return new Promise(function(_0x4f9ca4,_0x794e58){if(!_0x5ef848[_0x6481('0x7d')]){return _0x794e58(_0x3b266c[_0x6481('0x1e')](0x1f4,_0x6481('0x7e')));}ami[_0x6481('0x7f')](_0x6481('0x80')+_0x5ef848['event'],_0x5ef848['message']);_0x4f9ca4({'code':0xc8,'message':_0x5ef848});});},'FaxAccounts':function(_0x261437){return new Promise(function(_0x271b28,_0x38a45f){var _0x37337e=_['values'](_0x43a963[_0x6481('0x81')]);_0x271b28({'count':_0x37337e['length'],'rows':_0x37337e});});},'SendFax':function(_0x389aed){var _0x54d572=this;return new Promise(function(_0x5c88bd,_0x4acf17){_0x313ce2['send'](_0x389aed)[_0x6481('0x1b')](function(_0x282f6b){_0x5c88bd({'code':0xc8,'message':_0x282f6b[_0x6481('0x1c')]});})['catch'](function(_0x2551e5){_0x4acf17(_0x54d572[_0x6481('0x1e')](0x1f4,_0x2551e5[_0x6481('0x1c')]));});});},'CheckAfterSend':function(_0x219322){var _0x2b6bcf=this;return new Promise(function(_0x34f12a,_0x54974e){_0x313ce2['checkAfterSend'](_0x219322)['then'](function(_0x48e512){_0x34f12a({'code':0xc8,'message':_0x48e512['message']});})['catch'](function(_0xe16fcc){_0x54974e(_0x2b6bcf[_0x6481('0x1e')](0x1f4,_0xe16fcc[_0x6481('0x1c')]));});});}};var _0x25700f=jayson[_0x6481('0x82')](_0x40dd51)[_0x6481('0x83')]();_0x25700f['on']('error',function(_0x1ad264){return _0x54eb08(_0x1ad264);});_0x25700f[_0x6481('0x84')](0x232a,_0x6481('0x85'),function(){console[_0x6481('0x86')](_0x6481('0x87'),0x232a);return _0x5b6847('RPC\x20listening\x20on\x20port:'+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 aa0f979..482e58a 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 _0x2c8d=['map','routeId','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','firstName','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','emit','data1','data2','ListId','data3','split','phone','$or'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0x2c8d,0x19d));var _0xd2c8=function(_0x35b7e5,_0x5d95c7){_0x35b7e5=_0x35b7e5-0x0;var _0x210718=_0x2c8d[_0x35b7e5];return _0x210718;};'use strict';var _=require(_0xd2c8('0x0'));var BPromise=require(_0xd2c8('0x1'));var Redis=require(_0xd2c8('0x2'));var util=require(_0xd2c8('0x3'));var config=require('../../../../config/environment');var logger=require(_0xd2c8('0x4'))(_0xd2c8('0x5'));var cmContactRpc=require(_0xd2c8('0x6'));config[_0xd2c8('0x7')]=_['defaults'](config[_0xd2c8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd2c8('0x8'))(new Redis(config[_0xd2c8('0x7')]));function emit(_0x69bddf,_0x258184,_0x326072,_0x2c0472,_0x3feacb){logger[_0xd2c8('0x9')](_0xd2c8('0xa'),_0x69bddf,_0x258184['id'],_0x326072,_0x2c0472,JSON['stringify'](_0x3feacb));io['to'](_0x326072)[_0xd2c8('0xb')](_0x2c0472,_0x3feacb);}exports['exec']=function(_0x3bc255,_0x18906e,_0x1b3987,_0x17e1e8){var _0x698f46,_0x774747;var _0x1899c2={};var _0x3ddc77=Number(_0x1b3987[_0xd2c8('0xc')]);var _0x4f4db3=_0x1b3987[_0xd2c8('0xd')]?Boolean(Number(_0x1b3987[_0xd2c8('0xd')])):![];var _0xc90056;if(_0x17e1e8['xmd-contactid']){_0x1899c2['id']=_0x17e1e8['xmd-contactid'];}if(!_0x1899c2['id']){_0x1899c2[_0xd2c8('0xe')]=_0x3ddc77;_0xc90056=_0x1b3987[_0xd2c8('0xf')]&&_0x1b3987[_0xd2c8('0xf')]!=='0'?_0x1b3987['data3'][_0xd2c8('0x10')](','):[_0xd2c8('0x11')];_0x1899c2[_0xd2c8('0x12')]=_[_0xd2c8('0x13')](_0xc90056,function(_0x43fa8b){var _0x396cbe={};_0x396cbe[_0x43fa8b]=_0x17e1e8[_0xd2c8('0x14')]?_0x17e1e8[_0xd2c8('0x15')]:_0x17e1e8['calleridnum'];return _0x396cbe;});}var _0x34673e=['id','firstName',_0xd2c8('0x16'),_0xd2c8('0x11'),_0xd2c8('0x17'),_0xd2c8('0x18'),_0xd2c8('0xe'),_0xd2c8('0x19'),_0xd2c8('0x1a'),_0xd2c8('0x1b')];var _0x439ec4=_[_0xd2c8('0x1c')](_0x34673e,_0xc90056);BPromise[_0xd2c8('0x1d')]()[_0xd2c8('0x1e')](cmContactRpc[_0xd2c8('0x1f')]({'attributes':_0x439ec4,'where':_0x1899c2}))[_0xd2c8('0x1e')](function(_0x42274a){_0x774747=_0x42274a;if(!_[_0xd2c8('0x20')](_0x774747)){if(_0x774747[_0xd2c8('0x21')]===0x1){_0x698f46=_0x774747[0x0];logger['info'](_0xd2c8('0x22'),_0x17e1e8[_0xd2c8('0x23')],_0x18906e['id'],_0x698f46['id']);}else{logger['info'](_0xd2c8('0x24'),_0x17e1e8[_0xd2c8('0x23')],_0x18906e['id'],_['map'](_0x774747,'id')[_0xd2c8('0x25')](','));}return;}else{logger['info'](_0xd2c8('0x26'),_0x17e1e8['uniqueid'],_0x18906e['id']);var _0x4d20d1={'ListId':_0x3ddc77};var _0x2fe7aa=_0x1b3987[_0xd2c8('0x27')]&&_0x1b3987[_0xd2c8('0x27')]!=='0'?_0x1b3987[_0xd2c8('0x27')]:_0xd2c8('0x11');if(_0x4f4db3){logger[_0xd2c8('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x17e1e8[_0xd2c8('0x23')],_0x18906e['id']);_0x4d20d1[_0x2fe7aa]=_[_0xd2c8('0x28')](_0x17e1e8[_0xd2c8('0x14')])?_0x17e1e8[_0xd2c8('0x29')]:_0x17e1e8[_0xd2c8('0x15')];if(_[_0xd2c8('0x28')](_0x17e1e8[_0xd2c8('0x14')])){_0x4d20d1[_0xd2c8('0x2a')]=_0x17e1e8[_0xd2c8('0x2b')]&&_0x17e1e8[_0xd2c8('0x2b')]!==_0xd2c8('0x2c')?_0x17e1e8[_0xd2c8('0x2b')]:'Unknown';}else{_0x4d20d1[_0xd2c8('0x2a')]=_0x17e1e8['destcalleridname']&&_0x17e1e8[_0xd2c8('0x2d')]!==_0xd2c8('0x2c')?_0x17e1e8[_0xd2c8('0x2d')]:_0xd2c8('0x2e');}return BPromise[_0xd2c8('0x1d')]()[_0xd2c8('0x1e')](cmContactRpc['createContact'](_0x4d20d1))[_0xd2c8('0x1e')](function(_0x4b9c6f){_0x698f46=_0x4b9c6f;_0x774747[_0xd2c8('0x2f')](_0x4b9c6f);if(_0x698f46){logger[_0xd2c8('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x17e1e8['uniqueid'],_0x18906e['id'],_0x698f46['id']);}return;});}else{logger[_0xd2c8('0x9')](_0xd2c8('0x30'),_0x17e1e8[_0xd2c8('0x23')],_0x18906e['id']);_0x4d20d1[_0x2fe7aa]=_[_0xd2c8('0x28')](_0x17e1e8[_0xd2c8('0x14')])?_0x17e1e8['calleridnum']:_0x17e1e8[_0xd2c8('0x15')];if(_[_0xd2c8('0x28')](_0x17e1e8[_0xd2c8('0x14')])){_0x4d20d1[_0xd2c8('0x2a')]=_0x17e1e8['calleridname']&&_0x17e1e8[_0xd2c8('0x2b')]!==''?_0x17e1e8[_0xd2c8('0x2b')]:'Unknown';}else{_0x4d20d1[_0xd2c8('0x2a')]=_0x17e1e8['destcalleridname']&&_0x17e1e8['destcalleridname']!==_0xd2c8('0x2c')?_0x17e1e8[_0xd2c8('0x2d')]:_0xd2c8('0x2e');}_0x698f46=_0x4d20d1;_0x774747[_0xd2c8('0x2f')](_0x4d20d1);return;}}})[_0xd2c8('0x1e')](function(){if(_0x3bc255){emit(_0x17e1e8[_0xd2c8('0x23')],_0x18906e,util[_0xd2c8('0x31')](_0xd2c8('0x32'),_0x3bc255[_0xd2c8('0x33')]),util[_0xd2c8('0x31')]('trigger:%s',_0x1b3987[_0xd2c8('0x34')]['toLowerCase']()),{'evt':_[_0xd2c8('0x35')](_0x17e1e8,{'autoCreate':_0x4f4db3}),'contact':_0x698f46===undefined?{}:_0x698f46,'contacts':_0x774747[_0xd2c8('0x21')]===0x0?undefined:_0x774747});}});}; \ No newline at end of file +var _0x4d57=['defaults','socket.io-emitter','[CM][%s][%s]','emit','exec','data2','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','Unknown','destcalleridname','','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4d57,0x179));var _0x74d5=function(_0x426ee9,_0x2311b8){_0x426ee9=_0x426ee9-0x0;var _0x57b1ec=_0x4d57[_0x426ee9];return _0x57b1ec;};'use strict';var _=require('lodash');var BPromise=require(_0x74d5('0x0'));var Redis=require(_0x74d5('0x1'));var util=require(_0x74d5('0x2'));var config=require(_0x74d5('0x3'));var logger=require(_0x74d5('0x4'))(_0x74d5('0x5'));var cmContactRpc=require(_0x74d5('0x6'));config[_0x74d5('0x7')]=_[_0x74d5('0x8')](config[_0x74d5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x74d5('0x9'))(new Redis(config[_0x74d5('0x7')]));function emit(_0x4d0759,_0x588a5a,_0x11db7c,_0x3bbd79,_0x2a9753){logger['info'](_0x74d5('0xa'),_0x4d0759,_0x588a5a['id'],_0x11db7c,_0x3bbd79,JSON['stringify'](_0x2a9753));io['to'](_0x11db7c)[_0x74d5('0xb')](_0x3bbd79,_0x2a9753);}exports[_0x74d5('0xc')]=function(_0xf61e9c,_0x48ed55,_0xbaa4da,_0x643a71){var _0x399f9a,_0x274005;var _0x27d505={};var _0x2cf5b7=Number(_0xbaa4da['data1']);var _0x2d1e89=_0xbaa4da[_0x74d5('0xd')]?Boolean(Number(_0xbaa4da[_0x74d5('0xd')])):![];var _0xfda661;if(_0x643a71[_0x74d5('0xe')]){_0x27d505['id']=_0x643a71[_0x74d5('0xe')];}if(!_0x27d505['id']){_0x27d505['ListId']=_0x2cf5b7;_0xfda661=_0xbaa4da[_0x74d5('0xf')]&&_0xbaa4da['data3']!=='0'?_0xbaa4da[_0x74d5('0xf')][_0x74d5('0x10')](','):[_0x74d5('0x11')];_0x27d505[_0x74d5('0x12')]=_[_0x74d5('0x13')](_0xfda661,function(_0x20c0b4){var _0x1eba4e={};_0x1eba4e[_0x20c0b4]=_0x643a71[_0x74d5('0x14')]?_0x643a71[_0x74d5('0x15')]:_0x643a71[_0x74d5('0x16')];return _0x1eba4e;});}var _0x9524a6=['id',_0x74d5('0x17'),'lastName',_0x74d5('0x11'),_0x74d5('0x18'),_0x74d5('0x19'),_0x74d5('0x1a'),_0x74d5('0x1b'),_0x74d5('0x1c'),_0x74d5('0x1d')];var _0x2dd5b7=_[_0x74d5('0x1e')](_0x9524a6,_0xfda661);BPromise[_0x74d5('0x1f')]()[_0x74d5('0x20')](cmContactRpc[_0x74d5('0x21')]({'attributes':_0x2dd5b7,'where':_0x27d505}))[_0x74d5('0x20')](function(_0x516a56){_0x274005=_0x516a56;if(!_[_0x74d5('0x22')](_0x274005)){if(_0x274005[_0x74d5('0x23')]===0x1){_0x399f9a=_0x274005[0x0];logger[_0x74d5('0x24')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x643a71['uniqueid'],_0x48ed55['id'],_0x399f9a['id']);}else{logger[_0x74d5('0x24')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x643a71[_0x74d5('0x25')],_0x48ed55['id'],_['map'](_0x274005,'id')[_0x74d5('0x26')](','));}return;}else{logger[_0x74d5('0x24')](_0x74d5('0x27'),_0x643a71[_0x74d5('0x25')],_0x48ed55['id']);var _0x496b03={'ListId':_0x2cf5b7};var _0x2c3ec0=_0xbaa4da['data4']&&_0xbaa4da[_0x74d5('0x28')]!=='0'?_0xbaa4da[_0x74d5('0x28')]:_0x74d5('0x11');if(_0x2d1e89){logger[_0x74d5('0x24')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x643a71[_0x74d5('0x25')],_0x48ed55['id']);_0x496b03[_0x2c3ec0]=_[_0x74d5('0x29')](_0x643a71['routeId'])?_0x643a71[_0x74d5('0x16')]:_0x643a71[_0x74d5('0x15')];if(_[_0x74d5('0x29')](_0x643a71[_0x74d5('0x14')])){_0x496b03[_0x74d5('0x17')]=_0x643a71[_0x74d5('0x2a')]&&_0x643a71[_0x74d5('0x2a')]!==''?_0x643a71[_0x74d5('0x2a')]:_0x74d5('0x2b');}else{_0x496b03[_0x74d5('0x17')]=_0x643a71[_0x74d5('0x2c')]&&_0x643a71['destcalleridname']!==_0x74d5('0x2d')?_0x643a71[_0x74d5('0x2c')]:'Unknown';}return BPromise[_0x74d5('0x1f')]()[_0x74d5('0x20')](cmContactRpc['createContact'](_0x496b03))[_0x74d5('0x20')](function(_0x57ca4e){_0x399f9a=_0x57ca4e;_0x274005['push'](_0x57ca4e);if(_0x399f9a){logger['info'](_0x74d5('0x2e'),_0x643a71[_0x74d5('0x25')],_0x48ed55['id'],_0x399f9a['id']);}return;});}else{logger['info'](_0x74d5('0x2f'),_0x643a71[_0x74d5('0x25')],_0x48ed55['id']);_0x496b03[_0x2c3ec0]=_['isNil'](_0x643a71[_0x74d5('0x14')])?_0x643a71['calleridnum']:_0x643a71[_0x74d5('0x15')];if(_[_0x74d5('0x29')](_0x643a71[_0x74d5('0x14')])){_0x496b03['firstName']=_0x643a71['calleridname']&&_0x643a71['calleridname']!==_0x74d5('0x2d')?_0x643a71['calleridname']:_0x74d5('0x2b');}else{_0x496b03[_0x74d5('0x17')]=_0x643a71['destcalleridname']&&_0x643a71[_0x74d5('0x2c')]!==_0x74d5('0x2d')?_0x643a71[_0x74d5('0x2c')]:_0x74d5('0x2b');}_0x399f9a=_0x496b03;_0x274005[_0x74d5('0x30')](_0x496b03);return;}}})[_0x74d5('0x20')](function(){if(_0xf61e9c){emit(_0x643a71[_0x74d5('0x25')],_0x48ed55,util[_0x74d5('0x31')](_0x74d5('0x32'),_0xf61e9c[_0x74d5('0x33')]),util[_0x74d5('0x31')]('trigger:%s',_0xbaa4da[_0x74d5('0x34')][_0x74d5('0x35')]()),{'evt':_[_0x74d5('0x36')](_0x643a71,{'autoCreate':_0x2d1e89}),'contact':_0x399f9a===undefined?{}:_0x399f9a,'contacts':_0x274005['length']===0x0?undefined:_0x274005});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 85ac3f5..050372a 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 _0x74fb=['isNil','data4','location','uriLocation','data5','800','600','data6','winApplication','format','interface','trigger:%s:%s','action','user:%s','name','trigger:%s','exec','accounts','queue','routeId','script','parse','query','search','replace','every','AllConditions','checkConditions','channel','AnyConditions','some','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','util','lodash','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','url','winapp','triggers','voiceQueues','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','freshdeskAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','emit','info','stringify','prototype','clone','agents','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','templates','render','template\x20not\x20found','uri','buildUri','data3'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x74fb,0x111));var _0xb74f=function(_0x5ed63c,_0x55b1f3){_0x5ed63c=_0x5ed63c-0x0;var _0x5cdf92=_0x74fb[_0x5ed63c];return _0x5cdf92;};'use strict';var util=require(_0xb74f('0x0'));var _=require(_0xb74f('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xb74f('0x2'));var urlforward=require(_0xb74f('0x3'));var integration=require(_0xb74f('0x4'));var cmContact=require(_0xb74f('0x5'));var script=require('./script');var config=require(_0xb74f('0x6'));var logger=require(_0xb74f('0x7'))(_0xb74f('0x8'));var ami=require(_0xb74f('0x9'));config[_0xb74f('0xa')]=_[_0xb74f('0xb')](config[_0xb74f('0xa')],{'host':_0xb74f('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb74f('0xa')]));var operators={'equals':function(_0x5b1b15,_0x4630b4){return _0x5b1b15==_0x4630b4;},'not_equals':function(_0x52894a,_0x30fbe8){return _0x52894a!=_0x30fbe8;}};var barAndWebActions=['popup',_0xb74f('0xd'),_0xb74f('0xe')];function Trigger(_0x51b59f){this[_0xb74f('0xf')]=_0x51b59f[_0xb74f('0xf')];this['agents']=_0x51b59f['agents'];this[_0xb74f('0x10')]=_0x51b59f[_0xb74f('0x10')];this['templates']=_0x51b59f['templates'];this['voiceExtensions']=_0x51b59f[_0xb74f('0x11')];this['zendeskAccounts']=_0x51b59f[_0xb74f('0x12')];this['freshdeskAccounts']=_0x51b59f['freshdeskAccounts'];this[_0xb74f('0x13')]=_0x51b59f['salesforceAccounts'];this[_0xb74f('0x14')]=_0x51b59f[_0xb74f('0x14')];this[_0xb74f('0x15')]=_0x51b59f[_0xb74f('0x15')];this[_0xb74f('0x16')]=_0x51b59f[_0xb74f('0x16')];this[_0xb74f('0x17')]=_0x51b59f[_0xb74f('0x17')];this[_0xb74f('0x18')]=_0x51b59f[_0xb74f('0x18')];this[_0xb74f('0x19')]=_0x51b59f[_0xb74f('0x19')];this[_0xb74f('0x1a')]=_0x51b59f[_0xb74f('0x1a')];this['accounts']={'zendesk':this[_0xb74f('0x12')],'salesforce':this[_0xb74f('0x13')],'freshdesk':this[_0xb74f('0x1b')],'sugarcrm':this[_0xb74f('0x14')],'zoho':this[_0xb74f('0x15')],'desk':this[_0xb74f('0x16')],'vtiger':this[_0xb74f('0x17')],'dynamics365':this[_0xb74f('0x19')],'freshsales':this[_0xb74f('0x1a')],'servicenow':this['servicenowAccounts']};ami['on'](_0xb74f('0x1c'),this['syncCustomEvent'][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x1e'),this[_0xb74f('0x1f')]['bind'](this));ami['on'](_0xb74f('0x20'),this['syncCustomEvent'][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x21'),this[_0xb74f('0x1f')]['bind'](this));ami['on'](_0xb74f('0x22'),this['syncCustomEvent'][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x23'),this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x24'),this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x25'),this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x26'),this[_0xb74f('0x1f')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x27'),this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on']('custom:dialbegin',this[_0xb74f('0x28')][_0xb74f('0x1d')](this));ami['on']('custom:dialconnect',this[_0xb74f('0x28')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x29'),this[_0xb74f('0x28')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x2a'),this[_0xb74f('0x1f')]['bind'](this));ami['on'](_0xb74f('0x2b'),this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on']('custom:incomingmessage',this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on'](_0xb74f('0x2c'),this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on']('custom:acceptmessage',this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));ami['on']('custom:rejectmessage',this[_0xb74f('0x1f')][_0xb74f('0x1d')](this));}Trigger['prototype'][_0xb74f('0x2d')]=function(_0x516f96,_0x7f5d56,_0x1968b5){logger[_0xb74f('0x2e')](_0x516f96,_0x7f5d56,JSON[_0xb74f('0x2f')](_0x1968b5));io['to'](_0x516f96)['emit'](_0x7f5d56,_0x1968b5);};Trigger[_0xb74f('0x30')][_0xb74f('0x1f')]=function(_0x2689d0){var _0x2c87b3=_[_0xb74f('0x31')](_0x2689d0);this['checkTriggers'](_0x2c87b3);};Trigger[_0xb74f('0x30')][_0xb74f('0x28')]=function(_0x16ed8e){if(this[_0xb74f('0x32')][_0x16ed8e['interface']]){this['syncCustomEvent'](_0x16ed8e);}};Trigger[_0xb74f('0x30')]['checkTriggers']=function(_0x54a2d7){var _0x3410a4;for(var _0x3d3aed in this[_0xb74f('0xf')]){if(this[_0xb74f('0xf')][_0xb74f('0x33')](_0x3d3aed)){if(this['triggers'][_0x3d3aed][_0xb74f('0x34')]){_0x3410a4=this[_0xb74f('0x35')](this[_0xb74f('0xf')][_0x3d3aed],_0x54a2d7);if(_0x3410a4){_[_0xb74f('0x36')](_0x54a2d7,_0x54a2d7[_0xb74f('0x37')]);for(var _0x5968bd=0x0,_0x424880,_0x42f185,_0x442781;_0x5968bd0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ 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 a8ec894..a2782ec 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 _0x60a6=['isdisabled','info','systemuserid','username','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','telephone1','enduserId',']\x20Enduser\x20created!','forEach','type','string','customField','idField','ticketType','incident','assign','getString','Subjects','/contacts(','/systemusers(','Fields','phonecall','phonecalls','Descriptions','callDirection','queue','headers','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress'];(function(_0x27a8e1,_0xbfecea){var _0x2e4d37=function(_0x286cee){while(--_0x286cee){_0x27a8e1['push'](_0x27a8e1['shift']());}};_0x2e4d37(++_0xbfecea);}(_0x60a6,0xf4));var _0x660a=function(_0x1fe01c,_0x3fb0a8){_0x1fe01c=_0x1fe01c-0x0;var _0x3b1915=_0x60a6[_0x1fe01c];return _0x3b1915;};'use strict';var _=require(_0x660a('0x0'));var BPromise=require(_0x660a('0x1'));var rp=require(_0x660a('0x2'));var util=require(_0x660a('0x3'));var intUtil=require(_0x660a('0x4'));var md5=require(_0x660a('0x5'));var Redis=require(_0x660a('0x6'));var logger=require(_0x660a('0x7'))(_0x660a('0x8'));var config=require('../../../../config/environment');config[_0x660a('0x9')]=_[_0x660a('0xa')](config[_0x660a('0x9')],{'host':_0x660a('0xb'),'port':0x18eb});var io=require(_0x660a('0xc'))(new Redis(config[_0x660a('0x9')]));function getAuthToken(_0x2e468c,_0x51ccdc,_0x5c19fc){var _0x3f9995={'method':_0x660a('0xd'),'uri':_0x51ccdc,'form':{'client_id':_0x2e468c[_0x660a('0xe')],'resource':_0x2e468c[_0x660a('0xf')],'username':_0x2e468c['username'],'password':_0x2e468c[_0x660a('0x10')],'grant_type':'password','client_secret':_0x2e468c[_0x660a('0x11')]},'json':!![]};return rp(_0x3f9995)[_0x660a('0x12')](function(_0xdc3bae){return _0xdc3bae[_0x660a('0x13')];})[_0x660a('0x14')](function(_0x227cc7){logger[_0x660a('0x15')]('['+[_0x5c19fc[_0x660a('0x16')]()]+']\x20Wrong\x20credentials!');return _0x227cc7[_0x660a('0x17')];});}function getUser(_0x389d00,_0xb079f1,_0x4aa356,_0x5087ce,_0x56c3f7,_0x3bbd46){return new BPromise(function(_0x3b210e,_0x4158b2){return getAuthToken(_0xb079f1,_0x5087ce,_0x3bbd46)['then'](function(_0x2cc821){var _0x2903eb={'method':_0x660a('0x18'),'uri':_0x56c3f7+_0x660a('0x19'),'headers':{'Authorization':_0x660a('0x1a')+_0x2cc821,'OData-Version':_0x660a('0x1b')},'json':!![]};return rp(_0x2903eb);})[_0x660a('0x12')](function(_0x5bff15){var _0x3ce34f=_0x5bff15[_0x660a('0x1c')];var _0x4fdd41=![];var _0x2cbd04=null;if(!_[_0x660a('0x1d')](_0x4aa356)){if(intUtil[_0x660a('0x1e')](_0x4aa356[_0x660a('0x1f')])){_0x389d00[_0x660a('0x20')]=_0x4aa356['email'];for(_0x2cbd04=0x0;_0x2cbd04<_0x3ce34f[_0x660a('0x21')];_0x2cbd04++){if(_0x3ce34f[_0x2cbd04][_0x660a('0x22')]===_0x4aa356[_0x660a('0x1f')]&&!_0x3ce34f[_0x2cbd04][_0x660a('0x23')]){_0x4fdd41=!![];logger[_0x660a('0x24')]('['+[_0x3bbd46[_0x660a('0x16')]()]+']\x20Agent\x20found\x20'+_0x3ce34f[_0x2cbd04][_0x660a('0x25')]+'!');_0x389d00['userId']=_0x3ce34f[_0x2cbd04][_0x660a('0x25')];}}}}if(!_0x4fdd41){logger[_0x660a('0x24')]('['+[_0x3bbd46[_0x660a('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x389d00[_0x660a('0x20')]=_0xb079f1[_0x660a('0x26')];for(_0x2cbd04=0x0;_0x2cbd04<_0x3ce34f['length'];_0x2cbd04++){if(_0x3ce34f[_0x2cbd04][_0x660a('0x22')]===_0xb079f1[_0x660a('0x26')]){_0x389d00[_0x660a('0x27')]=_0x3ce34f[_0x2cbd04][_0x660a('0x25')];}}}_0x3b210e(_0x389d00);})[_0x660a('0x14')](function(_0x16a34f){_0x4158b2(_0x16a34f[_0x660a('0x17')]);});});}function createEndUser(_0x10f424,_0x59ea1a,_0x36e83d,_0x666777,_0x9ad689,_0x3b41d7){return new BPromise(function(_0x7c2518,_0x2e64c9){return getAuthToken(_0x59ea1a,_0x36e83d,_0x3b41d7)[_0x660a('0x12')](function(_0x233200){var _0x5228d8=_0x3b41d7[_0x660a('0x28')]()===_0x660a('0x29')?_0x9ad689[_0x660a('0x2a')]:_0x9ad689[_0x660a('0x2b')];var _0x5bfb72={'method':_0x660a('0xd'),'uri':_0x666777+_0x660a('0x2c'),'body':{'telephone1':_0x5228d8,'fullname':_0x5228d8,'firstname':_0x5228d8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x10f424['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x233200,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5bfb72);})[_0x660a('0x12')](function(_0x197df0){var _0x4cb0cd=_0x197df0['headers'][_0x660a('0x2d')];var _0x1c634c=_0x4cb0cd[_0x660a('0x2e')](_0x4cb0cd['lastIndexOf']('(')+0x1,_0x4cb0cd[_0x660a('0x2f')](')'));_0x10f424['enduserId']=_0x1c634c;_0x7c2518(_0x10f424);})[_0x660a('0x14')](function(_0x45a15a){_0x2e64c9(_0x45a15a[_0x660a('0x17')]);});});}function getEndUser(_0x115bd6,_0xf1126e,_0x57e0c8,_0x3acae3,_0x280b89,_0x4411cf){return new BPromise(function(_0x352d70,_0x43c50a){return getAuthToken(_0xf1126e,_0x57e0c8,_0x4411cf)[_0x660a('0x12')](function(_0x379730){var _0x56b7d8={'method':'GET','uri':_0x3acae3+_0x660a('0x30'),'headers':{'Authorization':'Bearer\x20'+_0x379730,'If-None-Match':null,'OData-Version':_0x660a('0x1b')},'json':!![]};return rp(_0x56b7d8);})['then'](function(_0x5d0ac3){var _0x3e0306=null;if(_0x5d0ac3){var _0x332b83=_0x5d0ac3['value'];var _0xff64b8=![];for(_0x3e0306=0x0;_0x3e0306<_0x332b83['length'];_0x3e0306++){var _0x3aa9cb=_0x4411cf[_0x660a('0x28')]()===_0x660a('0x29')?_0x280b89[_0x660a('0x2a')]:_0x280b89[_0x660a('0x2b')];if(_0x332b83[_0x3e0306][_0x660a('0x31')]===_0x3aa9cb){_0xff64b8=!![];_0x115bd6[_0x660a('0x32')]=_0x332b83[_0x3e0306]['contactid'];}}if(_0xff64b8){_0x352d70(_0x115bd6);}else{return createEndUser(_0x115bd6,_0xf1126e,_0x57e0c8,_0x3acae3,_0x280b89,_0x4411cf)[_0x660a('0x12')](function(_0x2c1655){logger[_0x660a('0x24')]('['+[_0x4411cf[_0x660a('0x16')]()]+_0x660a('0x33'),_0x2c1655['enduserId']);_0x352d70(_0x2c1655);});}}else{return createEndUser(_0x115bd6,_0xf1126e,_0x57e0c8,_0x3acae3,_0x280b89,_0x4411cf)[_0x660a('0x12')](function(_0x9fcd32){logger[_0x660a('0x24')]('['+[_0x4411cf[_0x660a('0x16')]()]+']\x20Enduser\x20Created!',_0x9fcd32[_0x660a('0x32')]);_0x352d70(_0x9fcd32);});}});});}function getCustomFields(_0x2ac6fe,_0x20b2a5,_0x332bc4){var _0x33a975={};if(_0x2ac6fe[_0x660a('0x21')]>0x0){_[_0x660a('0x34')](_0x2ac6fe,function(_0x38b098){if(_0x38b098[_0x660a('0x35')]===_0x660a('0x36')&&_0x38b098['nameField']&&!_0x38b098[_0x660a('0x37')]){var _0x2433ad=_0x38b098[_0x660a('0x38')][_0x660a('0x28')]();var _0x501a69=_0x2433ad[_0x660a('0x2e')](0x0,_0x2433ad['indexOf']('_'));var _0x5c4bd9=_0x2433ad[_0x660a('0x2e')](_0x2433ad['indexOf']('_')+0x1);if(_0x501a69===_0x332bc4){_0x33a975[_0x5c4bd9]=_0x38b098['content'];}}});}return _0x33a975;}function getTicket(_0x244a98,_0x38a3d6,_0x3c05cd,_0x50e304,_0x2bc99b,_0x7168e1,_0x12cdd3){return new BPromise(function(_0x332723,_0x5c98df){var _0x4f75de;return getAuthToken(_0x38a3d6,_0x3c05cd,_0x12cdd3)['then'](function(_0x5aefdc){if(_0x7168e1[_0x660a('0x39')]===_0x660a('0x3a')){_0x4f75de={'method':_0x660a('0xd'),'uri':_0x50e304+'incidents','body':Object[_0x660a('0x3b')]({},{'title':intUtil[_0x660a('0x3c')](_0x7168e1[_0x660a('0x3d')],_0x2bc99b,'\x20'),'description':intUtil[_0x660a('0x3c')](_0x7168e1['Descriptions'],_0x2bc99b,'\x0a'),'customerid_contact@odata.bind':_0x660a('0x3e')+_0x244a98[_0x660a('0x32')]+')','ownerid@odata.bind':_0x660a('0x3f')+_0x244a98[_0x660a('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x7168e1[_0x660a('0x40')],_0x2bc99b,_0x7168e1[_0x660a('0x39')])),'headers':{'Authorization':_0x660a('0x1a')+_0x5aefdc,'OData-Version':_0x660a('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x7168e1[_0x660a('0x39')]===_0x660a('0x41')){_0x4f75de={'method':_0x660a('0xd'),'uri':_0x50e304+_0x660a('0x42'),'body':Object[_0x660a('0x3b')]({},{'subject':intUtil[_0x660a('0x3c')](_0x7168e1['Subjects'],_0x2bc99b,'\x20'),'phonenumber':String(_0x2bc99b[_0x660a('0x2b')]),'description':intUtil[_0x660a('0x3c')](_0x7168e1[_0x660a('0x43')],_0x2bc99b,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x244a98[_0x660a('0x32')]+')','ownerid@odata.bind':_0x660a('0x3f')+_0x244a98[_0x660a('0x27')]+')','directioncode':_0x244a98[_0x660a('0x44')]===_0x660a('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x244a98[_0x660a('0x27')]+')','participationtypemask':_0x244a98['callDirection']===_0x660a('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x660a('0x3e')+_0x244a98['enduserId']+')','participationtypemask':_0x244a98[_0x660a('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x7168e1[_0x660a('0x40')],_0x2bc99b,_0x7168e1[_0x660a('0x39')])),'headers':{'Authorization':_0x660a('0x1a')+_0x5aefdc,'OData-Version':_0x660a('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4f75de);})['then'](function(_0x48cd87){var _0x1c6e15=_0x48cd87[_0x660a('0x46')][_0x660a('0x2d')];var _0x3a95b2=_0x1c6e15[_0x660a('0x2e')](_0x1c6e15['lastIndexOf']('(')+0x1,_0x1c6e15[_0x660a('0x2f')](')'));_0x244a98[_0x660a('0x47')]=_0x3a95b2;_0x332723(_0x244a98);})[_0x660a('0x14')](function(_0x217848){_0x5c98df(_0x217848[_0x660a('0x17')]);});});}function emit(_0x27917b,_0x5620e1,_0x3379fa,_0x52b8e7){var _0x3c16d7={'uri':util[_0x660a('0x48')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x27917b,_0x3379fa,_0x52b8e7)};io['to'](util[_0x660a('0x48')](_0x660a('0x49'),_0x5620e1))[_0x660a('0x4a')](_0x660a('0x4b'),_0x3c16d7);}exports['cs']=function(_0x6e7f76,_0xebe241,_0x2afb23,_0x310d7c,_0x5bf3f2,_0x569a60,_0x42be3a,_0xcf00af){var _0x55d49c={};_0x569a60[_0x660a('0xf')]=intUtil[_0x660a('0x4c')](_0x569a60[_0x660a('0xf')]);_0x569a60['serverUrl']=intUtil[_0x660a('0x4c')](_0x569a60['serverUrl']);_0x55d49c['callDirection']=_0xcf00af===_0x660a('0x45')||_0xcf00af===_0x660a('0x4d')?_0x660a('0x45'):_0x660a('0x29');var _0x1064af=util['format']('%s/api/data/v9.0/',_0x569a60[_0x660a('0xf')]);var _0x1e007b=util[_0x660a('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x569a60[_0x660a('0x4e')]);var _0x405760=util[_0x660a('0x48')](_0x660a('0x4f'),_0x569a60[_0x660a('0x50')],_0xebe241['uniqueid'],md5(_0xebe241['uniqueid']));if(_0x5bf3f2&&_0x5bf3f2[_0x660a('0x51')]){logger[_0x660a('0x24')](_0x660a('0x52'),_0x660a('0x53'));_0xebe241['recordingURL']=_0x405760;}else if(_0x42be3a&&_0x42be3a[_0x660a('0x54')]&&_0x42be3a[_0x660a('0x54')]!==_0x660a('0x55')){logger[_0x660a('0x24')]('[OUTBOUND]',_0x660a('0x53'));_0xebe241[_0x660a('0x56')]=_0x405760;}else{_0xebe241[_0x660a('0x56')]='';}return getUser(_0x55d49c,_0x569a60,_0x310d7c,_0x1e007b,_0x1064af,_0xcf00af)[_0x660a('0x12')](function(_0x598df7){logger['info']('['+_0xcf00af[_0x660a('0x16')]()+']\x20The\x20User\x20ID\x20is:',_0x598df7[_0x660a('0x27')]);logger[_0x660a('0x24')]('['+_0xcf00af[_0x660a('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x598df7[_0x660a('0x20')]);return getEndUser(_0x598df7,_0x569a60,_0x1e007b,_0x1064af,_0xebe241,_0xcf00af);})['then'](function(_0x556928){logger['info']('['+_0xcf00af['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x556928[_0x660a('0x32')]);logger[_0x660a('0x24')]('['+_0xcf00af[_0x660a('0x16')]()+_0x660a('0x57'),_0xebe241[_0x660a('0x2b')]);return getTicket(_0x556928,_0x569a60,_0x1e007b,_0x1064af,_0xebe241,_0x2afb23,_0xcf00af);})[_0x660a('0x12')](function(_0x495b4f){logger[_0x660a('0x24')](util['format']('['+_0xcf00af['toUpperCase']()+_0x660a('0x58'),_0x2afb23[_0x660a('0x39')],_0x495b4f[_0x660a('0x47')]));logger[_0x660a('0x24')](util[_0x660a('0x48')]('['+_0xcf00af['toUpperCase']()+_0x660a('0x59'),_0xcf00af));if(_0xcf00af!==_0x660a('0x4d')){logger[_0x660a('0x24')]('['+_0xcf00af['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x569a60['remoteUri'],_0x310d7c[_0x660a('0x5a')],_0x2afb23[_0x660a('0x39')],_0x495b4f[_0x660a('0x47')]);}})[_0x660a('0x14')](function(_0x5c7a4e){logger[_0x660a('0x15')]('['+_0xcf00af[_0x660a('0x16')]()+_0x660a('0x5b'),util[_0x660a('0x5c')](_0x5c7a4e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdf13=['outbound','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','substring','indexOf','incident','incidents','assign','Subjects','Descriptions','/contacts(','ticketType','phonecall','phonecalls','getString','callDirection','queue','Fields','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','remoteUri','username','clientSecret','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','catch','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xdf13,0x91));var _0x3df1=function(_0x56d54c,_0x24037a){_0x56d54c=_0x56d54c-0x0;var _0x35fd91=_0xdf13[_0x56d54c];return _0x35fd91;};'use strict';var _=require(_0x3df1('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x3df1('0x1'));var intUtil=require(_0x3df1('0x2'));var md5=require('md5');var Redis=require(_0x3df1('0x3'));var logger=require(_0x3df1('0x4'))(_0x3df1('0x5'));var config=require(_0x3df1('0x6'));config['redis']=_[_0x3df1('0x7')](config[_0x3df1('0x8')],{'host':_0x3df1('0x9'),'port':0x18eb});var io=require(_0x3df1('0xa'))(new Redis(config[_0x3df1('0x8')]));function getAuthToken(_0x1f9819,_0x7ee220,_0x5238c3){var _0x24acb2={'method':_0x3df1('0xb'),'uri':_0x7ee220,'form':{'client_id':_0x1f9819['clientId'],'resource':_0x1f9819[_0x3df1('0xc')],'username':_0x1f9819[_0x3df1('0xd')],'password':_0x1f9819['password'],'grant_type':'password','client_secret':_0x1f9819[_0x3df1('0xe')]},'json':!![]};return rp(_0x24acb2)[_0x3df1('0xf')](function(_0x7abde4){return _0x7abde4[_0x3df1('0x10')];})['catch'](function(_0x327c9){logger['error']('['+[_0x5238c3[_0x3df1('0x11')]()]+_0x3df1('0x12'));return _0x327c9[_0x3df1('0x13')];});}function getUser(_0xfc0485,_0x36d9f3,_0x4921c2,_0x3aebf5,_0x4b9844,_0x8155fe){return new BPromise(function(_0x385a3a,_0x4ad53b){return getAuthToken(_0x36d9f3,_0x3aebf5,_0x8155fe)[_0x3df1('0xf')](function(_0x9bb85a){var _0x4491c4={'method':_0x3df1('0x14'),'uri':_0x4b9844+_0x3df1('0x15'),'headers':{'Authorization':_0x3df1('0x16')+_0x9bb85a,'OData-Version':_0x3df1('0x17')},'json':!![]};return rp(_0x4491c4);})[_0x3df1('0xf')](function(_0x1cbdb2){var _0x4973bc=_0x1cbdb2[_0x3df1('0x18')];var _0x52949b=![];var _0x371e30=null;if(!_['isNil'](_0x4921c2)){if(intUtil['validateEmail'](_0x4921c2[_0x3df1('0x19')])){_0xfc0485[_0x3df1('0x1a')]=_0x4921c2['email'];for(_0x371e30=0x0;_0x371e30<_0x4973bc[_0x3df1('0x1b')];_0x371e30++){if(_0x4973bc[_0x371e30][_0x3df1('0x1c')]===_0x4921c2[_0x3df1('0x19')]&&!_0x4973bc[_0x371e30][_0x3df1('0x1d')]){_0x52949b=!![];logger[_0x3df1('0x1e')]('['+[_0x8155fe[_0x3df1('0x11')]()]+_0x3df1('0x1f')+_0x4973bc[_0x371e30][_0x3df1('0x20')]+'!');_0xfc0485[_0x3df1('0x21')]=_0x4973bc[_0x371e30]['systemuserid'];}}}}if(!_0x52949b){logger[_0x3df1('0x1e')]('['+[_0x8155fe['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xfc0485[_0x3df1('0x1a')]=_0x36d9f3[_0x3df1('0xd')];for(_0x371e30=0x0;_0x371e30<_0x4973bc[_0x3df1('0x1b')];_0x371e30++){if(_0x4973bc[_0x371e30][_0x3df1('0x1c')]===_0x36d9f3[_0x3df1('0xd')]){_0xfc0485['userId']=_0x4973bc[_0x371e30][_0x3df1('0x20')];}}}_0x385a3a(_0xfc0485);})[_0x3df1('0x22')](function(_0x1f0820){_0x4ad53b(_0x1f0820[_0x3df1('0x13')]);});});}function createEndUser(_0x500292,_0x4be6ee,_0x360669,_0x4eaaf5,_0x29d43c,_0x48911c){return new BPromise(function(_0x26ecb6,_0x3a882d){return getAuthToken(_0x4be6ee,_0x360669,_0x48911c)[_0x3df1('0xf')](function(_0x444bd6){var _0x3c1ee5=_0x48911c['toLowerCase']()==='outbound'?_0x29d43c[_0x3df1('0x23')]:_0x29d43c[_0x3df1('0x24')];var _0xf2fdec={'method':'POST','uri':_0x4eaaf5+_0x3df1('0x25'),'body':{'telephone1':_0x3c1ee5,'fullname':_0x3c1ee5,'firstname':_0x3c1ee5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3df1('0x26')+_0x500292['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x444bd6,'OData-Version':_0x3df1('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xf2fdec);})[_0x3df1('0xf')](function(_0xee0c81){var _0x4a808d=_0xee0c81[_0x3df1('0x27')][_0x3df1('0x28')];var _0x4c33e4=_0x4a808d['substring'](_0x4a808d[_0x3df1('0x29')]('(')+0x1,_0x4a808d[_0x3df1('0x29')](')'));_0x500292[_0x3df1('0x2a')]=_0x4c33e4;_0x26ecb6(_0x500292);})['catch'](function(_0x208cc1){_0x3a882d(_0x208cc1[_0x3df1('0x13')]);});});}function getEndUser(_0x2d3ea7,_0x499e73,_0x21bcb8,_0x50104c,_0x17cc14,_0x1f0378){return new BPromise(function(_0x303e53,_0xc4ad57){return getAuthToken(_0x499e73,_0x21bcb8,_0x1f0378)['then'](function(_0x336fec){var _0x2b2c72={'method':_0x3df1('0x14'),'uri':_0x50104c+_0x3df1('0x2b'),'headers':{'Authorization':_0x3df1('0x16')+_0x336fec,'If-None-Match':null,'OData-Version':_0x3df1('0x17')},'json':!![]};return rp(_0x2b2c72);})[_0x3df1('0xf')](function(_0x45a763){var _0x231dec=null;if(_0x45a763){var _0xbd715=_0x45a763['value'];var _0x50b38c=![];for(_0x231dec=0x0;_0x231dec<_0xbd715[_0x3df1('0x1b')];_0x231dec++){var _0x373280=_0x1f0378[_0x3df1('0x2c')]()===_0x3df1('0x2d')?_0x17cc14[_0x3df1('0x23')]:_0x17cc14[_0x3df1('0x24')];if(_0xbd715[_0x231dec][_0x3df1('0x2e')]===_0x373280){_0x50b38c=!![];_0x2d3ea7[_0x3df1('0x2a')]=_0xbd715[_0x231dec][_0x3df1('0x2f')];}}if(_0x50b38c){_0x303e53(_0x2d3ea7);}else{return createEndUser(_0x2d3ea7,_0x499e73,_0x21bcb8,_0x50104c,_0x17cc14,_0x1f0378)[_0x3df1('0xf')](function(_0xc95be0){logger['info']('['+[_0x1f0378[_0x3df1('0x11')]()]+_0x3df1('0x30'),_0xc95be0[_0x3df1('0x2a')]);_0x303e53(_0xc95be0);});}}else{return createEndUser(_0x2d3ea7,_0x499e73,_0x21bcb8,_0x50104c,_0x17cc14,_0x1f0378)[_0x3df1('0xf')](function(_0x27f755){logger[_0x3df1('0x1e')]('['+[_0x1f0378['toUpperCase']()]+']\x20Enduser\x20Created!',_0x27f755[_0x3df1('0x2a')]);_0x303e53(_0x27f755);});}});});}function getCustomFields(_0x5e3900,_0x16898e,_0x3018fc){var _0x1a220b={};if(_0x5e3900[_0x3df1('0x1b')]>0x0){_[_0x3df1('0x31')](_0x5e3900,function(_0x1e6b93){if(_0x1e6b93[_0x3df1('0x32')]===_0x3df1('0x33')&&_0x1e6b93[_0x3df1('0x34')]&&!_0x1e6b93[_0x3df1('0x35')]){var _0x28b17d=_0x1e6b93['idField'][_0x3df1('0x2c')]();var _0x205e44=_0x28b17d[_0x3df1('0x36')](0x0,_0x28b17d[_0x3df1('0x37')]('_'));var _0x49f3a9=_0x28b17d['substring'](_0x28b17d[_0x3df1('0x37')]('_')+0x1);if(_0x205e44===_0x3018fc){_0x1a220b[_0x49f3a9]=_0x1e6b93['content'];}}});}return _0x1a220b;}function getTicket(_0x4fe130,_0x2b8d39,_0x234b4e,_0x132cda,_0x37f61a,_0x482f0f,_0x4eb732){return new BPromise(function(_0x530f17,_0x8b6d3b){var _0x2ea5ec;return getAuthToken(_0x2b8d39,_0x234b4e,_0x4eb732)[_0x3df1('0xf')](function(_0x42cb60){if(_0x482f0f['ticketType']===_0x3df1('0x38')){_0x2ea5ec={'method':'POST','uri':_0x132cda+_0x3df1('0x39'),'body':Object[_0x3df1('0x3a')]({},{'title':intUtil['getString'](_0x482f0f[_0x3df1('0x3b')],_0x37f61a,'\x20'),'description':intUtil['getString'](_0x482f0f[_0x3df1('0x3c')],_0x37f61a,'\x0a'),'customerid_contact@odata.bind':_0x3df1('0x3d')+_0x4fe130[_0x3df1('0x2a')]+')','ownerid@odata.bind':_0x3df1('0x26')+_0x4fe130[_0x3df1('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x482f0f['Fields'],_0x37f61a,_0x482f0f['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x42cb60,'OData-Version':_0x3df1('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x482f0f[_0x3df1('0x3e')]===_0x3df1('0x3f')){_0x2ea5ec={'method':_0x3df1('0xb'),'uri':_0x132cda+_0x3df1('0x40'),'body':Object[_0x3df1('0x3a')]({},{'subject':intUtil[_0x3df1('0x41')](_0x482f0f['Subjects'],_0x37f61a,'\x20'),'phonenumber':String(_0x37f61a[_0x3df1('0x24')]),'description':intUtil['getString'](_0x482f0f[_0x3df1('0x3c')],_0x37f61a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3df1('0x3d')+_0x4fe130[_0x3df1('0x2a')]+')','ownerid@odata.bind':_0x3df1('0x26')+_0x4fe130[_0x3df1('0x21')]+')','directioncode':_0x4fe130['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3df1('0x26')+_0x4fe130[_0x3df1('0x21')]+')','participationtypemask':_0x4fe130[_0x3df1('0x42')]===_0x3df1('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x3df1('0x3d')+_0x4fe130[_0x3df1('0x2a')]+')','participationtypemask':_0x4fe130[_0x3df1('0x42')]===_0x3df1('0x43')?0x1:0x2}]},getCustomFields(_0x482f0f[_0x3df1('0x44')],_0x37f61a,_0x482f0f[_0x3df1('0x3e')])),'headers':{'Authorization':_0x3df1('0x16')+_0x42cb60,'OData-Version':_0x3df1('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2ea5ec);})[_0x3df1('0xf')](function(_0x2d1f4e){var _0x1e50cb=_0x2d1f4e[_0x3df1('0x27')][_0x3df1('0x28')];var _0x2dedd8=_0x1e50cb[_0x3df1('0x36')](_0x1e50cb[_0x3df1('0x29')]('(')+0x1,_0x1e50cb[_0x3df1('0x29')](')'));_0x4fe130['ticketId']=_0x2dedd8;_0x530f17(_0x4fe130);})['catch'](function(_0x418b04){_0x8b6d3b(_0x418b04['message']);});});}function emit(_0x38c12c,_0xc1e016,_0x127eb0,_0xed61f1){var _0x13e795={'uri':util[_0x3df1('0x45')](_0x3df1('0x46'),_0x38c12c,_0x127eb0,_0xed61f1)};io['to'](util['format'](_0x3df1('0x47'),_0xc1e016))[_0x3df1('0x48')](_0x3df1('0x49'),_0x13e795);}exports['cs']=function(_0x1a801b,_0x5de2b2,_0x405ac2,_0x1dfaa5,_0x1f4d82,_0x4293f5,_0x527b4b,_0x3a1aa0){var _0x3bc418={};_0x4293f5[_0x3df1('0xc')]=intUtil[_0x3df1('0x4a')](_0x4293f5['remoteUri']);_0x4293f5['serverUrl']=intUtil[_0x3df1('0x4a')](_0x4293f5[_0x3df1('0x4b')]);_0x3bc418['callDirection']=_0x3a1aa0===_0x3df1('0x43')||_0x3a1aa0===_0x3df1('0x4c')?_0x3df1('0x43'):_0x3df1('0x2d');var _0x34ce4e=util[_0x3df1('0x45')](_0x3df1('0x4d'),_0x4293f5[_0x3df1('0xc')]);var _0x47e3a4=util['format'](_0x3df1('0x4e'),_0x4293f5[_0x3df1('0x4f')]);var _0x3924b8=util[_0x3df1('0x45')](_0x3df1('0x50'),_0x4293f5[_0x3df1('0x4b')],_0x5de2b2[_0x3df1('0x51')],md5(_0x5de2b2[_0x3df1('0x51')]));if(_0x1f4d82&&_0x1f4d82[_0x3df1('0x52')]){logger[_0x3df1('0x1e')](_0x3df1('0x53'),_0x3df1('0x54'));_0x5de2b2[_0x3df1('0x55')]=_0x3924b8;}else if(_0x527b4b&&_0x527b4b[_0x3df1('0x56')]&&_0x527b4b[_0x3df1('0x56')]!==_0x3df1('0x57')){logger[_0x3df1('0x1e')](_0x3df1('0x58'),_0x3df1('0x54'));_0x5de2b2[_0x3df1('0x55')]=_0x3924b8;}else{_0x5de2b2[_0x3df1('0x55')]='';}return getUser(_0x3bc418,_0x4293f5,_0x1dfaa5,_0x47e3a4,_0x34ce4e,_0x3a1aa0)[_0x3df1('0xf')](function(_0x1c1ef3){logger[_0x3df1('0x1e')]('['+_0x3a1aa0[_0x3df1('0x11')]()+_0x3df1('0x59'),_0x1c1ef3['userId']);logger[_0x3df1('0x1e')]('['+_0x3a1aa0[_0x3df1('0x11')]()+']\x20The\x20User\x20email\x20is:',_0x1c1ef3[_0x3df1('0x1a')]);return getEndUser(_0x1c1ef3,_0x4293f5,_0x47e3a4,_0x34ce4e,_0x5de2b2,_0x3a1aa0);})['then'](function(_0x5393f9){logger[_0x3df1('0x1e')]('['+_0x3a1aa0[_0x3df1('0x11')]()+_0x3df1('0x5a'),_0x5393f9['enduserId']);logger[_0x3df1('0x1e')]('['+_0x3a1aa0[_0x3df1('0x11')]()+_0x3df1('0x5b'),_0x5de2b2['calleridnum']);return getTicket(_0x5393f9,_0x4293f5,_0x47e3a4,_0x34ce4e,_0x5de2b2,_0x405ac2,_0x3a1aa0);})[_0x3df1('0xf')](function(_0x45941d){logger[_0x3df1('0x1e')](util[_0x3df1('0x45')]('['+_0x3a1aa0[_0x3df1('0x11')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x405ac2['ticketType'],_0x45941d[_0x3df1('0x5c')]));logger[_0x3df1('0x1e')](util[_0x3df1('0x45')]('['+_0x3a1aa0[_0x3df1('0x11')]()+_0x3df1('0x5d'),_0x3a1aa0));if(_0x3a1aa0!==_0x3df1('0x4c')){logger[_0x3df1('0x1e')]('['+_0x3a1aa0[_0x3df1('0x11')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4293f5[_0x3df1('0xc')],_0x1dfaa5['name'],_0x405ac2['ticketType'],_0x45941d[_0x3df1('0x5c')]);}})[_0x3df1('0x22')](function(_0x5cd64c){logger['error']('['+_0x3a1aa0[_0x3df1('0x11')]()+_0x3df1('0x5e'),util['inspect'](_0x5cd64c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index f436722..d9999b9 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 _0x7946=['destcalleridnum','user:%s','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','stringify','GET','forEach','string','nameField','content','idField','customField','push','type','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:'];(function(_0x39c047,_0x567fc6){var _0x3713ce=function(_0x30409c){while(--_0x30409c){_0x39c047['push'](_0x39c047['shift']());}};_0x3713ce(++_0x567fc6);}(_0x7946,0x17a));var _0x6794=function(_0x28f6d2,_0x2a4fb9){_0x28f6d2=_0x28f6d2-0x0;var _0x352af1=_0x7946[_0x28f6d2];return _0x352af1;};'use strict';var _=require(_0x6794('0x0'));var rp=require(_0x6794('0x1'));var md5=require(_0x6794('0x2'));var util=require(_0x6794('0x3'));var Redis=require(_0x6794('0x4'));var intUtil=require(_0x6794('0x5'));var config=require(_0x6794('0x6'));var logger=require(_0x6794('0x7'))('freshdesk');config[_0x6794('0x8')]=_[_0x6794('0x9')](config[_0x6794('0x8')],{'host':_0x6794('0xa'),'port':0x18eb});var io=require(_0x6794('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0x6794('0xc'),'Accept':_0x6794('0xc')};function emit(_0x27ccf5,_0x2c417a,_0x19ce29){io['to'](_0x27ccf5)[_0x6794('0xd')](_0x2c417a,_0x19ce29);}function getTicket(_0x487942,_0x332fee,_0x579ce2,_0x4f1f5c,_0x5a00c1){logger[_0x6794('0xe')]('Creating\x20new\x20ticket...');var _0x31a5f1=_[_0x6794('0xf')]({'responder_id':_0x332fee['id'],'requester_id':_0x579ce2['id'],'name':util[_0x6794('0x10')](_0x6794('0x11'),_0x5a00c1[_0x6794('0x12')]),'phone':_0x5a00c1[_0x6794('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6794('0x14')](_0x4f1f5c[_0x6794('0x15')],_0x5a00c1,'\x20'),'description':intUtil[_0x6794('0x14')](_0x4f1f5c[_0x6794('0x16')],_0x5a00c1,_0x6794('0x17')),'tags':getTags(_0x4f1f5c[_0x6794('0x18')],_0x6794('0x19'))},getCustomFields(_0x4f1f5c['Fields'],_0x5a00c1));_0x31a5f1[_0x6794('0x1a')]=_[_0x6794('0x1b')](_[_0x6794('0x1c')](_0x31a5f1[_0x6794('0x1a')],'id'),_0x6794('0x1d'));return request({'uri':util[_0x6794('0x10')](_0x6794('0x1e'),_0x487942[_0x6794('0x1f')]),'method':_0x6794('0x20'),'body':_0x31a5f1})[_0x6794('0x21')](function(_0x4d5ddf){logger['info'](_0x6794('0x22'));return _0x4d5ddf;});}function getUser(_0xa0a85a,_0x232d78){if(intUtil[_0x6794('0x23')](_0x232d78)){return request({'uri':util[_0x6794('0x10')](_0x6794('0x24'),_0xa0a85a[_0x6794('0x1f')]),'qs':{'email':_0x232d78}})[_0x6794('0x21')](function(_0x3ff86f){if(_0x3ff86f[_0x6794('0x25')]){logger['info']('Agent\x20found!');return _[_0x6794('0x26')](_0x3ff86f,function(_0x457d47){return _0x457d47['contact']['email']===_0x232d78;});}else{logger[_0x6794('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6794('0x10')](_0x6794('0x27'),_0xa0a85a[_0x6794('0x1f')])})[_0x6794('0x21')](function(_0x4207e6){logger['info']('Admin\x20account\x20selected.');return _0x4207e6;});}});}else{logger[_0x6794('0xe')](_0x6794('0x28'));return request({'uri':util[_0x6794('0x10')]('%s/api/v2/agents/me',_0xa0a85a[_0x6794('0x1f')])})[_0x6794('0x21')](function(_0x43dce8){logger['info'](_0x6794('0x29'));return _0x43dce8;});}}function getEndUser(_0xdda87d,_0x15402f,_0x4d998a){logger['info'](_0x6794('0x2a'),_0x4d998a);return request({'uri':util[_0x6794('0x10')](_0x6794('0x2b'),_0xdda87d[_0x6794('0x1f')]),'qs':{'phone':_0x4d998a}})[_0x6794('0x21')](function(_0x3aab80){if(_0x3aab80[_0x6794('0x25')]){logger[_0x6794('0xe')](_0x6794('0x2c'));return _[_0x6794('0x26')](_0x3aab80,{'phone':_0x4d998a});}else{logger['info'](_0x6794('0x2d'));return request({'uri':util[_0x6794('0x10')]('%s/api/v2/contacts',_0xdda87d[_0x6794('0x1f')]),'method':_0x6794('0x20'),'body':{'name':_0x15402f,'phone':_0x4d998a}})['then'](function(_0x3ca134){logger[_0x6794('0xe')]('Enduser\x20created.');return _0x3ca134;});}});}function getAuth(_0xe8555f){return util[_0x6794('0x10')](_0x6794('0x2e'),new Buffer(_0xe8555f[_0x6794('0x2f')]+':X')[_0x6794('0x30')](_0x6794('0x31')));}function request(_0x55cdef){logger['debug']('[HTTP]',JSON[_0x6794('0x32')](_0x55cdef));return rp(_['defaults'](_0x55cdef,{'method':_0x6794('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x7cd203,_0xf850df){var _0x498a19=[];if(_0x7cd203&&_0x7cd203[_0x6794('0x25')]>0x0){_0x498a19=_['map'](_0x7cd203,_0xf850df);}return _0x498a19;}function getCustomFields(_0x19d6d0,_0x6b9a79){var _0x2975d6=[];var _0x3036fb={'custom_fields':[]};if(_0x19d6d0[_0x6794('0x25')]>0x0){_[_0x6794('0x34')](_0x19d6d0,function(_0x4121cc){if(_0x4121cc['type']===_0x6794('0x35')&&_0x4121cc[_0x6794('0x36')]&&!_0x4121cc['customField']){_0x3036fb[_0x4121cc[_0x6794('0x36')]['toLowerCase']()]=_0x4121cc[_0x6794('0x37')][_0x6794('0x30')]();}else if(_0x4121cc['type']===_0x6794('0x35')&&_0x4121cc[_0x6794('0x38')]&&_0x4121cc[_0x6794('0x39')]){_0x3036fb[_0x6794('0x1a')][_0x6794('0x3a')]({'id':_0x4121cc['idField'],'value':_0x4121cc['content'][_0x6794('0x30')]()});}else if(_0x4121cc[_0x6794('0x3b')]===_0x6794('0x3c')&&_0x4121cc[_0x6794('0x3d')]&&_0x4121cc[_0x6794('0x38')]&&_0x4121cc[_0x6794('0x39')]){_0x6b9a79[_0x4121cc[_0x6794('0x3d')]]&&_0x3036fb['custom_fields']['push']({'id':_0x4121cc[_0x6794('0x38')],'value':_0x6b9a79[_0x4121cc[_0x6794('0x3d')]][_0x6794('0x30')]()});}else if(_0x4121cc[_0x6794('0x3b')]===_0x6794('0x3e')&&_0x4121cc['Variable']&&_0x4121cc[_0x6794('0x3f')][_0x6794('0x19')]&&_0x4121cc[_0x6794('0x38')]&&_0x4121cc[_0x6794('0x39')]){_0x6b9a79[_0x4121cc[_0x6794('0x3f')][_0x6794('0x19')]['toLowerCase']()]&&_0x3036fb[_0x6794('0x1a')]['push']({'id':_0x4121cc['idField'],'value':_0x6b9a79[_0x4121cc[_0x6794('0x3f')][_0x6794('0x19')][_0x6794('0x40')]()][_0x6794('0x30')]()});}});}return _0x3036fb;}exports[_0x6794('0x41')]=function(_0x45b793,_0x1ce85e,_0x9c6b93,_0x3f22ac,_0x595f29,_0x61d96d){var _0x4f7028,_0x4b8196;_0x61d96d[_0x6794('0x1f')]=intUtil[_0x6794('0x42')](_0x61d96d[_0x6794('0x1f')]);_0x61d96d[_0x6794('0x43')]=intUtil['stripTrailingSlash'](_0x61d96d[_0x6794('0x43')]);if(_0x595f29&&_0x595f29[_0x6794('0x44')]){logger[_0x6794('0xe')]('[QUEUE]',_0x6794('0x45'));_0x1ce85e[_0x6794('0x46')]=util[_0x6794('0x10')](_0x6794('0x47'),_0x61d96d['serverUrl'],_0x1ce85e[_0x6794('0x48')],md5(_0x1ce85e[_0x6794('0x48')]));}else{_0x1ce85e[_0x6794('0x46')]='';}headers[_0x6794('0x49')]=getAuth(_0x61d96d);return getUser(_0x61d96d,_0x3f22ac['email'])[_0x6794('0x21')](function(_0x7380a0){_0x4f7028=_0x7380a0;logger[_0x6794('0xe')]('The\x20User\x20ID\x20is:',_0x4f7028['id']);return getEndUser(_0x61d96d,_0x1ce85e['calleridname'],_0x1ce85e[_0x6794('0x13')]);})[_0x6794('0x21')](function(_0x21dbdb){_0x4b8196=_0x21dbdb;logger[_0x6794('0xe')](_0x6794('0x4a'),_0x4b8196['id']);return getTicket(_0x61d96d,_0x4f7028,_0x4b8196,_0x9c6b93,_0x1ce85e);})[_0x6794('0x21')](function(_0x3986bd){if(_0x3986bd&&_0x3986bd['id']){logger['info'](_0x6794('0x22'));logger[_0x6794('0xe')](_0x6794('0x4b'),_0x3986bd['id']);logger['info'](_0x6794('0x4c'),_0x6794('0x4d'));emit(util[_0x6794('0x10')]('user:%s',_0x3f22ac[_0x6794('0x19')]),_0x6794('0x4e'),{'uri':util[_0x6794('0x10')]('%s/helpdesk/tickets/%d',_0x61d96d[_0x6794('0x1f')],_0x3986bd['id'])});}})[_0x6794('0x4f')](function(_0x5a1edb){logger[_0x6794('0x50')](_0x6794('0x4c'),JSON[_0x6794('0x32')](_0x5a1edb));});};exports[_0x6794('0x51')]=function(_0x18719c,_0x2221a8,_0x2537bc,_0x4a5829,_0xab992a,_0x6cd0b8,_0x4316c9){var _0xc0217,_0x353f57;_0x6cd0b8[_0x6794('0x1f')]=intUtil[_0x6794('0x42')](_0x6cd0b8['remoteUri']);_0x6cd0b8[_0x6794('0x43')]=intUtil[_0x6794('0x42')](_0x6cd0b8['serverUrl']);if(_0x4316c9&&_0x4316c9[_0x6794('0x52')]&&_0x4316c9[_0x6794('0x52')]!==_0x6794('0x53')){logger[_0x6794('0xe')](_0x6794('0x54'),'Recording\x20is\x20enabled!');_0x2221a8[_0x6794('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6cd0b8[_0x6794('0x43')],_0x2221a8[_0x6794('0x48')],md5(_0x2221a8[_0x6794('0x48')]));}headers['Authorization']=getAuth(_0x6cd0b8);return getUser(_0x6cd0b8,_0x4a5829[_0x6794('0x55')])[_0x6794('0x21')](function(_0xb3bd26){_0xc0217=_0xb3bd26;logger[_0x6794('0xe')](_0x6794('0x56'),_0xc0217['id']);return getEndUser(_0x6cd0b8,_0x2221a8['destcalleridname'],_0x2221a8[_0x6794('0x57')]);})['then'](function(_0x219464){_0x353f57=_0x219464;logger[_0x6794('0xe')](_0x6794('0x4a'),_0x353f57['id']);return getTicket(_0x6cd0b8,_0xc0217,_0x353f57,_0x2537bc,_0x2221a8);})[_0x6794('0x21')](function(_0xa94294){if(_0xa94294&&_0xa94294['id']){logger[_0x6794('0xe')](_0x6794('0x22'));logger['info'](_0x6794('0x4b'),_0xa94294['id']);logger[_0x6794('0xe')](_0x6794('0x54'),_0x6794('0x4d'));emit(util[_0x6794('0x10')](_0x6794('0x58'),_0x4a5829[_0x6794('0x19')]),_0x6794('0x4e'),{'uri':util[_0x6794('0x10')](_0x6794('0x59'),_0x6cd0b8[_0x6794('0x1f')],_0xa94294['id'])});}})[_0x6794('0x4f')](function(_0x91c3f){logger[_0x6794('0x50')](_0x6794('0x54'),JSON[_0x6794('0x32')](_0x91c3f));});};exports[_0x6794('0x5a')]=function(_0x15c9d7,_0x561c4f,_0x14c48c,_0x5779b0,_0xb3063d,_0x585e3e){var _0x5dee37,_0x67d417;_0x585e3e[_0x6794('0x1f')]=intUtil[_0x6794('0x42')](_0x585e3e[_0x6794('0x1f')]);_0x585e3e[_0x6794('0x43')]=intUtil[_0x6794('0x42')](_0x585e3e[_0x6794('0x43')]);if(_0xb3063d&&_0xb3063d['monitor_format']){logger[_0x6794('0xe')]('['+_0x561c4f[_0x6794('0x5b')][_0x6794('0x5c')]()+']',_0x6794('0x45'));_0x561c4f[_0x6794('0x46')]=util[_0x6794('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x585e3e['serverUrl'],_0x561c4f[_0x6794('0x48')],md5(_0x561c4f[_0x6794('0x48')]));}else{_0x561c4f[_0x6794('0x46')]='';}headers[_0x6794('0x49')]=getAuth(_0x585e3e);return getUser(_0x585e3e,'')[_0x6794('0x21')](function(_0x1b2ca7){_0x5dee37=_0x1b2ca7;logger[_0x6794('0xe')]('The\x20User\x20ID\x20is:',_0x5dee37['id']);return getEndUser(_0x585e3e,_0x561c4f[_0x6794('0x12')],_0x561c4f[_0x6794('0x13')]);})[_0x6794('0x21')](function(_0xb967a7){_0x67d417=_0xb967a7;logger[_0x6794('0xe')](_0x6794('0x4a'),_0x67d417['id']);return getTicket(_0x585e3e,_0x5dee37,_0x67d417,_0x14c48c,_0x561c4f);})[_0x6794('0x21')](function(_0x4d37bd){if(_0x4d37bd){logger['info']('Ticket\x20created!');logger[_0x6794('0xe')]('The\x20Ticket\x20ID\x20is:',_0x4d37bd['id']);}})['catch'](function(_0x446a9b){logger['error']('['+_0x561c4f[_0x6794('0x5b')]['toUpperCase']()+']',JSON['stringify'](_0x446a9b));});}; \ No newline at end of file +var _0x540b=['string','nameField','customField','content','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','stringify','map','forEach','type'];(function(_0x51f84a,_0x445f17){var _0x4ba63d=function(_0x5c8b6c){while(--_0x5c8b6c){_0x51f84a['push'](_0x51f84a['shift']());}};_0x4ba63d(++_0x445f17);}(_0x540b,0xdf));var _0xb540=function(_0x2a55ce,_0x1c1c8f){_0x2a55ce=_0x2a55ce-0x0;var _0x3b5c60=_0x540b[_0x2a55ce];return _0x3b5c60;};'use strict';var _=require(_0xb540('0x0'));var rp=require(_0xb540('0x1'));var md5=require(_0xb540('0x2'));var util=require('util');var Redis=require(_0xb540('0x3'));var intUtil=require(_0xb540('0x4'));var config=require(_0xb540('0x5'));var logger=require(_0xb540('0x6'))('freshdesk');config['redis']=_[_0xb540('0x7')](config[_0xb540('0x8')],{'host':_0xb540('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb540('0x8')]));var headers={'Content-Type':_0xb540('0xa'),'Accept':'application/json'};function emit(_0x29300e,_0x1bb79f,_0x396442){io['to'](_0x29300e)[_0xb540('0xb')](_0x1bb79f,_0x396442);}function getTicket(_0x1c3df7,_0x41fc73,_0x58f560,_0xb1b0a5,_0x19a386){logger['info'](_0xb540('0xc'));var _0x1ff887=_['merge']({'responder_id':_0x41fc73['id'],'requester_id':_0x58f560['id'],'name':util[_0xb540('0xd')](_0xb540('0xe'),_0x19a386['calleridname']),'phone':_0x19a386[_0xb540('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb540('0x10')](_0xb1b0a5[_0xb540('0x11')],_0x19a386,'\x20'),'description':intUtil['getString'](_0xb1b0a5['Descriptions'],_0x19a386,_0xb540('0x12')),'tags':getTags(_0xb1b0a5[_0xb540('0x13')],_0xb540('0x14'))},getCustomFields(_0xb1b0a5[_0xb540('0x15')],_0x19a386));_0x1ff887['custom_fields']=_[_0xb540('0x16')](_[_0xb540('0x17')](_0x1ff887[_0xb540('0x18')],'id'),_0xb540('0x19'));return request({'uri':util[_0xb540('0xd')](_0xb540('0x1a'),_0x1c3df7[_0xb540('0x1b')]),'method':_0xb540('0x1c'),'body':_0x1ff887})['then'](function(_0x1cab55){logger[_0xb540('0x1d')](_0xb540('0x1e'));return _0x1cab55;});}function getUser(_0x18965f,_0x4d3c8f){if(intUtil[_0xb540('0x1f')](_0x4d3c8f)){return request({'uri':util[_0xb540('0xd')](_0xb540('0x20'),_0x18965f['remoteUri']),'qs':{'email':_0x4d3c8f}})[_0xb540('0x21')](function(_0x45a0a3){if(_0x45a0a3[_0xb540('0x22')]){logger['info'](_0xb540('0x23'));return _[_0xb540('0x24')](_0x45a0a3,function(_0x1f9e5e){return _0x1f9e5e[_0xb540('0x25')][_0xb540('0x26')]===_0x4d3c8f;});}else{logger[_0xb540('0x1d')](_0xb540('0x27'));return request({'uri':util[_0xb540('0xd')](_0xb540('0x28'),_0x18965f[_0xb540('0x1b')])})[_0xb540('0x21')](function(_0x33f643){logger[_0xb540('0x1d')]('Admin\x20account\x20selected.');return _0x33f643;});}});}else{logger['info'](_0xb540('0x29'));return request({'uri':util[_0xb540('0xd')](_0xb540('0x28'),_0x18965f[_0xb540('0x1b')])})['then'](function(_0x3f23f5){logger[_0xb540('0x1d')](_0xb540('0x2a'));return _0x3f23f5;});}}function getEndUser(_0x4e8517,_0x356a5d,_0x46906a){logger[_0xb540('0x1d')](_0xb540('0x2b'),_0x46906a);return request({'uri':util[_0xb540('0xd')]('%s/api/v2/contacts',_0x4e8517[_0xb540('0x1b')]),'qs':{'phone':_0x46906a}})[_0xb540('0x21')](function(_0x567632){if(_0x567632[_0xb540('0x22')]){logger[_0xb540('0x1d')](_0xb540('0x2c'));return _[_0xb540('0x24')](_0x567632,{'phone':_0x46906a});}else{logger[_0xb540('0x1d')](_0xb540('0x2d'));return request({'uri':util['format'](_0xb540('0x2e'),_0x4e8517['remoteUri']),'method':'POST','body':{'name':_0x356a5d,'phone':_0x46906a}})['then'](function(_0x19ca11){logger[_0xb540('0x1d')](_0xb540('0x2f'));return _0x19ca11;});}});}function getAuth(_0x5a572b){return util['format'](_0xb540('0x30'),new Buffer(_0x5a572b[_0xb540('0x31')]+':X')[_0xb540('0x32')](_0xb540('0x33')));}function request(_0x5cdd9a){logger['debug']('[HTTP]',JSON[_0xb540('0x34')](_0x5cdd9a));return rp(_[_0xb540('0x7')](_0x5cdd9a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x462ad,_0x5596a4){var _0x376d7b=[];if(_0x462ad&&_0x462ad[_0xb540('0x22')]>0x0){_0x376d7b=_[_0xb540('0x35')](_0x462ad,_0x5596a4);}return _0x376d7b;}function getCustomFields(_0x54618f,_0x256dd7){var _0x222c0d=[];var _0x693c7e={'custom_fields':[]};if(_0x54618f['length']>0x0){_[_0xb540('0x36')](_0x54618f,function(_0x18d25b){if(_0x18d25b[_0xb540('0x37')]===_0xb540('0x38')&&_0x18d25b[_0xb540('0x39')]&&!_0x18d25b[_0xb540('0x3a')]){_0x693c7e[_0x18d25b['nameField']['toLowerCase']()]=_0x18d25b[_0xb540('0x3b')][_0xb540('0x32')]();}else if(_0x18d25b[_0xb540('0x37')]===_0xb540('0x38')&&_0x18d25b[_0xb540('0x3c')]&&_0x18d25b['customField']){_0x693c7e[_0xb540('0x18')][_0xb540('0x3d')]({'id':_0x18d25b[_0xb540('0x3c')],'value':_0x18d25b[_0xb540('0x3b')][_0xb540('0x32')]()});}else if(_0x18d25b['type']==='variable'&&_0x18d25b[_0xb540('0x3e')]&&_0x18d25b['idField']&&_0x18d25b['customField']){_0x256dd7[_0x18d25b['variableName']]&&_0x693c7e[_0xb540('0x18')]['push']({'id':_0x18d25b[_0xb540('0x3c')],'value':_0x256dd7[_0x18d25b[_0xb540('0x3e')]][_0xb540('0x32')]()});}else if(_0x18d25b[_0xb540('0x37')]===_0xb540('0x3f')&&_0x18d25b['Variable']&&_0x18d25b['Variable'][_0xb540('0x14')]&&_0x18d25b[_0xb540('0x3c')]&&_0x18d25b['customField']){_0x256dd7[_0x18d25b[_0xb540('0x40')][_0xb540('0x14')][_0xb540('0x41')]()]&&_0x693c7e[_0xb540('0x18')]['push']({'id':_0x18d25b[_0xb540('0x3c')],'value':_0x256dd7[_0x18d25b['Variable'][_0xb540('0x14')][_0xb540('0x41')]()][_0xb540('0x32')]()});}});}return _0x693c7e;}exports[_0xb540('0x42')]=function(_0x31a0fc,_0x4a4cd8,_0xed2a06,_0x6ff295,_0x3c240c,_0x12f24a){var _0x2f41c1,_0xf69462;_0x12f24a[_0xb540('0x1b')]=intUtil[_0xb540('0x43')](_0x12f24a['remoteUri']);_0x12f24a[_0xb540('0x44')]=intUtil['stripTrailingSlash'](_0x12f24a[_0xb540('0x44')]);if(_0x3c240c&&_0x3c240c[_0xb540('0x45')]){logger[_0xb540('0x1d')](_0xb540('0x46'),'Recording\x20is\x20enabled!');_0x4a4cd8[_0xb540('0x47')]=util[_0xb540('0xd')](_0xb540('0x48'),_0x12f24a[_0xb540('0x44')],_0x4a4cd8[_0xb540('0x49')],md5(_0x4a4cd8[_0xb540('0x49')]));}else{_0x4a4cd8[_0xb540('0x47')]='';}headers[_0xb540('0x4a')]=getAuth(_0x12f24a);return getUser(_0x12f24a,_0x6ff295['email'])['then'](function(_0x2d1688){_0x2f41c1=_0x2d1688;logger[_0xb540('0x1d')](_0xb540('0x4b'),_0x2f41c1['id']);return getEndUser(_0x12f24a,_0x4a4cd8[_0xb540('0x4c')],_0x4a4cd8[_0xb540('0xf')]);})[_0xb540('0x21')](function(_0x3ee86a){_0xf69462=_0x3ee86a;logger[_0xb540('0x1d')]('The\x20Enduser\x20ID\x20is:',_0xf69462['id']);return getTicket(_0x12f24a,_0x2f41c1,_0xf69462,_0xed2a06,_0x4a4cd8);})[_0xb540('0x21')](function(_0x495fb7){if(_0x495fb7&&_0x495fb7['id']){logger['info'](_0xb540('0x1e'));logger['info'](_0xb540('0x4d'),_0x495fb7['id']);logger[_0xb540('0x1d')](_0xb540('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb540('0xd')](_0xb540('0x4e'),_0x6ff295[_0xb540('0x14')]),_0xb540('0x4f'),{'uri':util[_0xb540('0xd')](_0xb540('0x50'),_0x12f24a[_0xb540('0x1b')],_0x495fb7['id'])});}})[_0xb540('0x51')](function(_0x56bade){logger[_0xb540('0x52')](_0xb540('0x46'),JSON['stringify'](_0x56bade));});};exports[_0xb540('0x53')]=function(_0x266728,_0x5e10af,_0x3b2db1,_0x453dac,_0x1a5a73,_0x13d624,_0x34bfa3){var _0x584751,_0x1cc250;_0x13d624[_0xb540('0x1b')]=intUtil[_0xb540('0x43')](_0x13d624['remoteUri']);_0x13d624[_0xb540('0x44')]=intUtil[_0xb540('0x43')](_0x13d624[_0xb540('0x44')]);if(_0x34bfa3&&_0x34bfa3['recordingFormat']&&_0x34bfa3[_0xb540('0x54')]!=='none'){logger[_0xb540('0x1d')](_0xb540('0x55'),_0xb540('0x56'));_0x5e10af[_0xb540('0x47')]=util[_0xb540('0xd')](_0xb540('0x48'),_0x13d624[_0xb540('0x44')],_0x5e10af[_0xb540('0x49')],md5(_0x5e10af[_0xb540('0x49')]));}headers[_0xb540('0x4a')]=getAuth(_0x13d624);return getUser(_0x13d624,_0x453dac['email'])[_0xb540('0x21')](function(_0x447b4b){_0x584751=_0x447b4b;logger[_0xb540('0x1d')]('The\x20User\x20ID\x20is:',_0x584751['id']);return getEndUser(_0x13d624,_0x5e10af[_0xb540('0x57')],_0x5e10af['destcalleridnum']);})['then'](function(_0x2aaf33){_0x1cc250=_0x2aaf33;logger[_0xb540('0x1d')](_0xb540('0x58'),_0x1cc250['id']);return getTicket(_0x13d624,_0x584751,_0x1cc250,_0x3b2db1,_0x5e10af);})['then'](function(_0x4bce5c){if(_0x4bce5c&&_0x4bce5c['id']){logger[_0xb540('0x1d')](_0xb540('0x1e'));logger[_0xb540('0x1d')](_0xb540('0x4d'),_0x4bce5c['id']);logger[_0xb540('0x1d')]('[OUTBOUND]',_0xb540('0x59'));emit(util[_0xb540('0xd')]('user:%s',_0x453dac[_0xb540('0x14')]),_0xb540('0x4f'),{'uri':util[_0xb540('0xd')](_0xb540('0x50'),_0x13d624[_0xb540('0x1b')],_0x4bce5c['id'])});}})[_0xb540('0x51')](function(_0x11d584){logger[_0xb540('0x52')]('[OUTBOUND]',JSON[_0xb540('0x34')](_0x11d584));});};exports[_0xb540('0x5a')]=function(_0x4b6c60,_0x1aff4b,_0x394ed0,_0xbfdef9,_0x271c97,_0xfaf581){var _0x4b85ab,_0x317585;_0xfaf581[_0xb540('0x1b')]=intUtil[_0xb540('0x43')](_0xfaf581[_0xb540('0x1b')]);_0xfaf581[_0xb540('0x44')]=intUtil[_0xb540('0x43')](_0xfaf581[_0xb540('0x44')]);if(_0x271c97&&_0x271c97[_0xb540('0x45')]){logger[_0xb540('0x1d')]('['+_0x1aff4b[_0xb540('0x5b')][_0xb540('0x5c')]()+']',_0xb540('0x56'));_0x1aff4b[_0xb540('0x47')]=util[_0xb540('0xd')](_0xb540('0x48'),_0xfaf581['serverUrl'],_0x1aff4b['uniqueid'],md5(_0x1aff4b['uniqueid']));}else{_0x1aff4b[_0xb540('0x47')]='';}headers[_0xb540('0x4a')]=getAuth(_0xfaf581);return getUser(_0xfaf581,'')[_0xb540('0x21')](function(_0x348a25){_0x4b85ab=_0x348a25;logger[_0xb540('0x1d')](_0xb540('0x4b'),_0x4b85ab['id']);return getEndUser(_0xfaf581,_0x1aff4b[_0xb540('0x4c')],_0x1aff4b['calleridnum']);})[_0xb540('0x21')](function(_0x1a70bc){_0x317585=_0x1a70bc;logger[_0xb540('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x317585['id']);return getTicket(_0xfaf581,_0x4b85ab,_0x317585,_0x394ed0,_0x1aff4b);})[_0xb540('0x21')](function(_0x410fea){if(_0x410fea){logger[_0xb540('0x1d')](_0xb540('0x1e'));logger['info'](_0xb540('0x4d'),_0x410fea['id']);}})[_0xb540('0x51')](function(_0x2f3c78){logger[_0xb540('0x52')]('['+_0x1aff4b['lastevent']['toUpperCase']()+']',JSON[_0xb540('0x34')](_0x2f3c78));});}; \ 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 423fbc2..751b7da 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 _0xf611=['/api/lookup?q=','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','name','inspect','request-promise','md5','util','./util','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','GET'];(function(_0x28f5cb,_0x37fadc){var _0x27cd13=function(_0x248b27){while(--_0x248b27){_0x28f5cb['push'](_0x28f5cb['shift']());}};_0x27cd13(++_0x37fadc);}(_0xf611,0x7b));var _0x1f61=function(_0x5a09f3,_0x9ce907){_0x5a09f3=_0x5a09f3-0x0;var _0x3665c2=_0xf611[_0x5a09f3];return _0x3665c2;};'use strict';var _=require('lodash');var rp=require(_0x1f61('0x0'));var md5=require(_0x1f61('0x1'));var util=require(_0x1f61('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x1f61('0x3'));var config=require('../../../../config/environment');var logger=require(_0x1f61('0x4'))(_0x1f61('0x5'));config['redis']=_['defaults'](config[_0x1f61('0x6')],{'host':_0x1f61('0x7'),'port':0x18eb});var io=require(_0x1f61('0x8'))(new Redis(config[_0x1f61('0x6')]));function getAdminId(_0x5b2e5b,_0x2d3aeb,_0x2c0254,_0x2dafd0){return new Promise(function(_0x47f426,_0x27a10a){var _0x1ce344=![];var _0x548156={'method':'GET','uri':_0x2dafd0+_0x1f61('0x9'),'json':!![]};_0x548156[_0x1f61('0xa')]=_0x2c0254;logger[_0x1f61('0xb')](_0x1f61('0xc'));return rp(_0x548156)[_0x1f61('0xd')](function(_0x4011a3){if(_0x4011a3){var _0x48592e=_0x4011a3[_0x1f61('0xe')];var _0x486473=null;for(_0x486473=0x0;_0x486473<_0x48592e[_0x1f61('0xf')];_0x486473++){if(_0x48592e[_0x486473][_0x1f61('0x10')]===_0x5b2e5b[_0x1f61('0x11')]){_0x5b2e5b[_0x1f61('0x12')]=_0x48592e[_0x486473]['id'];_0x1ce344=!![];}}if(_0x1ce344){logger[_0x1f61('0xb')](_0x1f61('0x13'),_0x5b2e5b[_0x1f61('0x12')]);_0x47f426(_0x5b2e5b);}else{_0x27a10a({'statusCode':0x194,'message':_0x1f61('0x14')});}}else{_0x27a10a({'statusCode':0x194,'message':_0x1f61('0x14')});}})[_0x1f61('0x15')](function(_0x17fd3b){logger[_0x1f61('0x16')]('['+[_0x2d3aeb[_0x1f61('0x17')]()]+']',_0x17fd3b[_0x1f61('0x18')]);_0x27a10a(_0x17fd3b);});});}function getUser(_0x3e6ef5,_0x3a3a5a,_0x3e0322){return function(_0xd655a0){return new Promise(function(_0xf5e83a,_0x3f84d7){var _0x40ff13={'method':'GET','uri':_0x3e0322+_0x1f61('0x9'),'json':!![]};_0x40ff13[_0x1f61('0xa')]=_0x3a3a5a;logger[_0x1f61('0xb')]('Getting\x20user\x20list');return rp(_0x40ff13)[_0x1f61('0xd')](function(_0x43f643){if(_0x43f643){var _0x3e052=_0x43f643[_0x1f61('0xe')];var _0x994383=![];var _0x3df30f=null;if(_0xd655a0[_0x1f61('0x19')]!==null){logger[_0x1f61('0xb')](_0x1f61('0x1a'),_0xd655a0[_0x1f61('0x19')]);_0xd655a0['userEmail']=_0xd655a0[_0x1f61('0x19')];for(_0x3df30f=0x0;_0x3df30f<_0x3e052['length'];_0x3df30f++){if(_0x3e052[_0x3df30f][_0x1f61('0x10')]===_0xd655a0['agentEmail']){_0x994383=!![];_0xd655a0[_0x1f61('0x1b')]=_0x3e052[_0x3df30f]['id'];logger[_0x1f61('0xb')](_0x1f61('0x1c'),_0xd655a0[_0x1f61('0x1b')]);}}}if(!_0x994383){logger['info'](_0x1f61('0x1d'));_0xd655a0['userEmail']=_0xd655a0[_0x1f61('0x11')];_0xd655a0[_0x1f61('0x1b')]=_0xd655a0['adminId'];_0x994383=!![];}if(_0x994383){_0xf5e83a(_0xd655a0);}else{_0x3f84d7({'statusCode':0x194,'message':_0x1f61('0x14')});}}else{_0x3f84d7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x1f61('0x15')](function(_0x3cd0c9){logger[_0x1f61('0x16')]('['+[_0x3e6ef5[_0x1f61('0x17')]()]+']',_0x3cd0c9['message']);_0x3f84d7(_0x3cd0c9);});});};}function searchContact(_0x41ccee,_0x2099da,_0x27abe5,_0x31dab2){return new Promise(function(_0x3b22e3,_0x43669e){var _0x559d0c={'method':_0x1f61('0x1e'),'headers':_0x2099da,'uri':_0x41ccee+_0x1f61('0x1f')+_0x31dab2+_0x1f61('0x20')+_0x27abe5+_0x1f61('0x21'),'json':!![]};rp(_0x559d0c)['then'](function(_0x50f109){var _0x22c545=_['find'](_0x50f109[_0x1f61('0x22')][_0x1f61('0x22')],[_0x27abe5,_0x31dab2]);_0x3b22e3(_0x22c545);})[_0x1f61('0x15')](function(_0x3c3413){_0x43669e(_0x3c3413);});});}function getEndUser(_0x405666,_0x37097e,_0x3d8127){return function(_0x44cb76){return new Promise(function(_0x5a7977,_0x2116af){logger[_0x1f61('0xb')](util['format'](_0x1f61('0x23'),_0x44cb76[_0x1f61('0x24')]));searchContact(_0x3d8127,_0x37097e,'mobile_number',_0x44cb76['contactNumber'])[_0x1f61('0xd')](function(_0x2d6264){if(_0x2d6264){_0x44cb76['endUserId']=_0x2d6264['id'];logger[_0x1f61('0xb')](_0x1f61('0x25'),_0x44cb76[_0x1f61('0x26')]);return _0x5a7977(_0x44cb76);}searchContact(_0x3d8127,_0x37097e,'work_number',_0x44cb76[_0x1f61('0x24')])[_0x1f61('0xd')](function(_0x34c302){if(_0x34c302){_0x44cb76['endUserId']=_0x34c302['id'];logger[_0x1f61('0xb')]('Contact\x20found\x20work_number:',_0x44cb76[_0x1f61('0x26')]);return _0x5a7977(_0x44cb76);}createEndUser(_0x44cb76,_0x405666,_0x37097e,_0x3d8127)['then'](function(_0x502c2c){logger[_0x1f61('0xb')](_0x1f61('0x27'),_0x502c2c['endUserId']);return _0x5a7977(_0x502c2c);});});})[_0x1f61('0x15')](function(_0xa8129e){_0x2116af(_0xa8129e);});});};}function createEndUser(_0x4deed8,_0x8b23ed,_0x953bcc,_0xe64f1f){return new Promise(function(_0x286580,_0x4c16a0){var _0x2ad1ff=moment();var _0x30c217={'method':_0x1f61('0x28'),'uri':_0xe64f1f+_0x1f61('0x29'),'body':{'contact':{'last_name':_0x4deed8[_0x1f61('0x24')],'work_number':_0x4deed8[_0x1f61('0x24')],'mobile_number':_0x4deed8[_0x1f61('0x24')],'owner_id':_0x4deed8[_0x1f61('0x1b')],'created_at':_0x2ad1ff[_0x1f61('0x2a')](_0x1f61('0x2b'))}},'json':!![]};_0x30c217[_0x1f61('0xa')]=_0x953bcc;logger[_0x1f61('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x30c217)['then'](function(_0x22f04f){_0x4deed8[_0x1f61('0x26')]=_0x22f04f[_0x1f61('0x2c')]['id'];_0x286580(_0x4deed8);})['catch'](function(_0x521a23){logger['error']('['+[_0x8b23ed[_0x1f61('0x17')]()]+']',_0x521a23[_0x1f61('0x18')]);_0x4c16a0(_0x521a23[_0x1f61('0x18')]);});});}function getTicket(_0x682505,_0x320312,_0x2ce2f2,_0x537c90,_0x1d5d26){return function(_0x1ccef0){logger[_0x1f61('0xb')]('Creating\x20new\x20task');return new Promise(function(_0x3492c1,_0x31947f){var _0x1901d2=moment();var _0x58ece8={'method':_0x1f61('0x28'),'uri':_0x2ce2f2+_0x1f61('0x2d'),'body':{'title':intUtil[_0x1f61('0x2e')](_0x537c90[_0x1f61('0x2f')],_0x1d5d26,'\x20'),'description':intUtil['getString'](_0x537c90[_0x1f61('0x30')],_0x1d5d26,'\x0a'),'owner_id':_0x1ccef0[_0x1f61('0x1b')],'creater_id':_0x1ccef0[_0x1f61('0x12')],'targetable_id':_0x1ccef0[_0x1f61('0x26')],'targetable_type':_0x1f61('0x31'),'created_at':_0x1901d2[_0x1f61('0x2a')](_0x1f61('0x2b')),'due_date':_0x1901d2[_0x1f61('0x32')](0x1e,'m')[_0x1f61('0x2a')](_0x1f61('0x2b'))},'json':!![]};_0x58ece8[_0x1f61('0xa')]=_0x320312;return rp(_0x58ece8)[_0x1f61('0xd')](function(_0x21d411){_0x1ccef0['ticketId']=_0x21d411[_0x1f61('0x33')]['id'];logger[_0x1f61('0xb')](_0x1f61('0x34'),_0x1ccef0['ticketId']);_0x3492c1(_0x1ccef0);})[_0x1f61('0x15')](function(_0x574525){logger[_0x1f61('0x16')]('['+[_0x682505[_0x1f61('0x17')]()]+']',_0x574525[_0x1f61('0x18')]);_0x31947f(_0x574525[_0x1f61('0x18')]);});});};}function emit(_0x4e9455,_0x1f1d69,_0x53ca79){var _0x54e7e9={'uri':_0x4e9455+_0x1f61('0x35')+_0x53ca79};io['to'](util[_0x1f61('0x2a')](_0x1f61('0x36'),_0x1f1d69))['emit'](_0x1f61('0x37'),_0x54e7e9);}exports['cs']=function(_0x183499,_0x1fde0e,_0x112c84,_0x4b0671,_0xe33ad0,_0x3072b6,_0x175499,_0x112edd){var _0x4f0be2={};var _0x397786={'Authorization':_0x1f61('0x38')+_0x3072b6['apiKey']};_0x3072b6[_0x1f61('0x39')]=intUtil[_0x1f61('0x3a')](_0x3072b6[_0x1f61('0x39')]);_0x3072b6[_0x1f61('0x3b')]=intUtil[_0x1f61('0x3a')](_0x3072b6[_0x1f61('0x3b')]);var _0x3cdc81=_0x3072b6[_0x1f61('0x39')];_0x4f0be2['adminEmail']=_0x3072b6[_0x1f61('0x3c')];_0x4f0be2[_0x1f61('0x24')]=_0x112edd[_0x1f61('0x3d')]()==='outbound'?_0x1fde0e['destcalleridnum']:_0x1fde0e['calleridnum'];_0x4f0be2[_0x1f61('0x3e')]=_0x112edd===_0x1f61('0x3f')||_0x112edd===_0x1f61('0x40')?'queue':_0x1f61('0x41');if(_0x4b0671){_0x4f0be2[_0x1f61('0x19')]=_0x4b0671[_0x1f61('0x10')];}var _0x2565bb=util[_0x1f61('0x2a')](_0x1f61('0x42'),_0x3072b6[_0x1f61('0x3b')],_0x1fde0e['uniqueid'],md5(_0x1fde0e[_0x1f61('0x43')]));if(_0xe33ad0&&_0xe33ad0[_0x1f61('0x44')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x1fde0e[_0x1f61('0x45')]=_0x2565bb;}else if(_0x175499&&_0x175499['recordingFormat']&&_0x175499[_0x1f61('0x46')]!==_0x1f61('0x47')){logger[_0x1f61('0xb')](_0x1f61('0x48'),'Recording\x20is\x20enabled!');_0x1fde0e[_0x1f61('0x45')]=_0x2565bb;}else{_0x1fde0e['recordingURL']='';}return getAdminId(_0x4f0be2,_0x112edd,_0x397786,_0x3cdc81)[_0x1f61('0xd')](getUser(_0x112edd,_0x397786,_0x3cdc81))[_0x1f61('0xd')](getEndUser(_0x112edd,_0x397786,_0x3cdc81))[_0x1f61('0xd')](getTicket(_0x112edd,_0x397786,_0x3cdc81,_0x112c84,_0x1fde0e))[_0x1f61('0xd')](function(_0x452ea5){logger['info'](util[_0x1f61('0x2a')](_0x1f61('0x49'),_0x452ea5[_0x1f61('0x4a')]));if(_0x112edd!==_0x1f61('0x40')){logger[_0x1f61('0xb')]('['+[_0x112edd['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3cdc81,_0x4b0671[_0x1f61('0x4b')],_0x452ea5['endUserId']);}})[_0x1f61('0x15')](function(_0x7dc44f){logger[_0x1f61('0x16')]('['+[_0x112edd[_0x1f61('0x17')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x1f61('0x4c')](_0x7dc44f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x86f4=['Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects'];(function(_0x3d32f5,_0x5afc2c){var _0x4da2fe=function(_0x2c44d4){while(--_0x2c44d4){_0x3d32f5['push'](_0x3d32f5['shift']());}};_0x4da2fe(++_0x5afc2c);}(_0x86f4,0x18a));var _0x486f=function(_0xe9c579,_0x8cddb){_0xe9c579=_0xe9c579-0x0;var _0x2b05c2=_0x86f4[_0xe9c579];return _0x2b05c2;};'use strict';var _=require(_0x486f('0x0'));var rp=require(_0x486f('0x1'));var md5=require(_0x486f('0x2'));var util=require(_0x486f('0x3'));var moment=require(_0x486f('0x4'));var Promise=require(_0x486f('0x5'));var Redis=require(_0x486f('0x6'));var intUtil=require('./util');var config=require(_0x486f('0x7'));var logger=require(_0x486f('0x8'))('freshsales');config[_0x486f('0x9')]=_[_0x486f('0xa')](config[_0x486f('0x9')],{'host':_0x486f('0xb'),'port':0x18eb});var io=require(_0x486f('0xc'))(new Redis(config[_0x486f('0x9')]));function getAdminId(_0x5bfabc,_0x33363d,_0x24f724,_0x37975a){return new Promise(function(_0x468a82,_0x377d09){var _0x362036=![];var _0x19ccdd={'method':_0x486f('0xd'),'uri':_0x37975a+_0x486f('0xe'),'json':!![]};_0x19ccdd[_0x486f('0xf')]=_0x24f724;logger[_0x486f('0x10')](_0x486f('0x11'));return rp(_0x19ccdd)[_0x486f('0x12')](function(_0x7bcd98){if(_0x7bcd98){var _0x471aef=_0x7bcd98[_0x486f('0x13')];var _0x1c4e55=null;for(_0x1c4e55=0x0;_0x1c4e55<_0x471aef['length'];_0x1c4e55++){if(_0x471aef[_0x1c4e55][_0x486f('0x14')]===_0x5bfabc['adminEmail']){_0x5bfabc[_0x486f('0x15')]=_0x471aef[_0x1c4e55]['id'];_0x362036=!![];}}if(_0x362036){logger[_0x486f('0x10')](_0x486f('0x16'),_0x5bfabc['adminId']);_0x468a82(_0x5bfabc);}else{_0x377d09({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x377d09({'statusCode':0x194,'message':_0x486f('0x17')});}})[_0x486f('0x18')](function(_0x51334f){logger[_0x486f('0x19')]('['+[_0x33363d[_0x486f('0x1a')]()]+']',_0x51334f[_0x486f('0x1b')]);_0x377d09(_0x51334f);});});}function getUser(_0x4ec12f,_0x53561a,_0x232a5e){return function(_0x3eeae0){return new Promise(function(_0x360cb7,_0x39bfac){var _0x4e68d1={'method':'GET','uri':_0x232a5e+_0x486f('0xe'),'json':!![]};_0x4e68d1[_0x486f('0xf')]=_0x53561a;logger[_0x486f('0x10')](_0x486f('0x1c'));return rp(_0x4e68d1)[_0x486f('0x12')](function(_0x243dbf){if(_0x243dbf){var _0x1c3887=_0x243dbf[_0x486f('0x13')];var _0xe0b1cc=![];var _0x3d79bc=null;if(_0x3eeae0[_0x486f('0x1d')]!==null){logger[_0x486f('0x10')](_0x486f('0x1e'),_0x3eeae0[_0x486f('0x1d')]);_0x3eeae0[_0x486f('0x1f')]=_0x3eeae0[_0x486f('0x1d')];for(_0x3d79bc=0x0;_0x3d79bc<_0x1c3887['length'];_0x3d79bc++){if(_0x1c3887[_0x3d79bc][_0x486f('0x14')]===_0x3eeae0[_0x486f('0x1d')]){_0xe0b1cc=!![];_0x3eeae0[_0x486f('0x20')]=_0x1c3887[_0x3d79bc]['id'];logger[_0x486f('0x10')](_0x486f('0x21'),_0x3eeae0[_0x486f('0x20')]);}}}if(!_0xe0b1cc){logger[_0x486f('0x10')](_0x486f('0x22'));_0x3eeae0[_0x486f('0x1f')]=_0x3eeae0[_0x486f('0x23')];_0x3eeae0[_0x486f('0x20')]=_0x3eeae0[_0x486f('0x15')];_0xe0b1cc=!![];}if(_0xe0b1cc){_0x360cb7(_0x3eeae0);}else{_0x39bfac({'statusCode':0x194,'message':_0x486f('0x17')});}}else{_0x39bfac({'statusCode':0x194,'message':_0x486f('0x17')});}})[_0x486f('0x18')](function(_0x30b322){logger[_0x486f('0x19')]('['+[_0x4ec12f[_0x486f('0x1a')]()]+']',_0x30b322[_0x486f('0x1b')]);_0x39bfac(_0x30b322);});});};}function searchContact(_0x3d6e7,_0x3c2762,_0x25531f,_0x5105ee){return new Promise(function(_0x486b86,_0x52fb3a){var _0x5b4718={'method':_0x486f('0xd'),'headers':_0x3c2762,'uri':_0x3d6e7+'/api/lookup?q='+_0x5105ee+_0x486f('0x24')+_0x25531f+_0x486f('0x25'),'json':!![]};rp(_0x5b4718)['then'](function(_0x71e759){var _0x562c1b=_[_0x486f('0x26')](_0x71e759[_0x486f('0x27')][_0x486f('0x27')],[_0x25531f,_0x5105ee]);_0x486b86(_0x562c1b);})[_0x486f('0x18')](function(_0x1962c2){_0x52fb3a(_0x1962c2);});});}function getEndUser(_0x34f637,_0x5613ca,_0x1f320e){return function(_0x323892){return new Promise(function(_0xdd39fe,_0x429b8d){logger[_0x486f('0x10')](util[_0x486f('0x28')](_0x486f('0x29'),_0x323892[_0x486f('0x2a')]));searchContact(_0x1f320e,_0x5613ca,'mobile_number',_0x323892[_0x486f('0x2a')])[_0x486f('0x12')](function(_0x493d24){if(_0x493d24){_0x323892[_0x486f('0x2b')]=_0x493d24['id'];logger[_0x486f('0x10')](_0x486f('0x2c'),_0x323892[_0x486f('0x2b')]);return _0xdd39fe(_0x323892);}searchContact(_0x1f320e,_0x5613ca,_0x486f('0x2d'),_0x323892['contactNumber'])[_0x486f('0x12')](function(_0x40dd81){if(_0x40dd81){_0x323892[_0x486f('0x2b')]=_0x40dd81['id'];logger[_0x486f('0x10')](_0x486f('0x2e'),_0x323892[_0x486f('0x2b')]);return _0xdd39fe(_0x323892);}createEndUser(_0x323892,_0x34f637,_0x5613ca,_0x1f320e)[_0x486f('0x12')](function(_0x4bc471){logger[_0x486f('0x10')](_0x486f('0x2f'),_0x4bc471[_0x486f('0x2b')]);return _0xdd39fe(_0x4bc471);});});})['catch'](function(_0x5678d8){_0x429b8d(_0x5678d8);});});};}function createEndUser(_0x3fbdc6,_0x115419,_0x4b80f8,_0x22c18d){return new Promise(function(_0x4ade99,_0x217e8f){var _0x87a417=moment();var _0x5ca543={'method':'POST','uri':_0x22c18d+_0x486f('0x30'),'body':{'contact':{'last_name':_0x3fbdc6[_0x486f('0x2a')],'work_number':_0x3fbdc6[_0x486f('0x2a')],'mobile_number':_0x3fbdc6[_0x486f('0x2a')],'owner_id':_0x3fbdc6[_0x486f('0x20')],'created_at':_0x87a417[_0x486f('0x28')](_0x486f('0x31'))}},'json':!![]};_0x5ca543[_0x486f('0xf')]=_0x4b80f8;logger[_0x486f('0x10')](_0x486f('0x32'));return rp(_0x5ca543)[_0x486f('0x12')](function(_0x737fee){_0x3fbdc6[_0x486f('0x2b')]=_0x737fee[_0x486f('0x33')]['id'];_0x4ade99(_0x3fbdc6);})['catch'](function(_0x3f9acd){logger[_0x486f('0x19')]('['+[_0x115419['toUpperCase']()]+']',_0x3f9acd[_0x486f('0x1b')]);_0x217e8f(_0x3f9acd[_0x486f('0x1b')]);});});}function getTicket(_0x2c4dbf,_0x32e001,_0x115c44,_0x383f42,_0x38c1c9){return function(_0x2cf3dd){logger[_0x486f('0x10')]('Creating\x20new\x20task');return new Promise(function(_0x57f9dd,_0x2b87bd){var _0x35e476=moment();var _0x3cf897={'method':_0x486f('0x34'),'uri':_0x115c44+_0x486f('0x35'),'body':{'title':intUtil[_0x486f('0x36')](_0x383f42[_0x486f('0x37')],_0x38c1c9,'\x20'),'description':intUtil[_0x486f('0x36')](_0x383f42[_0x486f('0x38')],_0x38c1c9,'\x0a'),'owner_id':_0x2cf3dd['userId'],'creater_id':_0x2cf3dd[_0x486f('0x15')],'targetable_id':_0x2cf3dd[_0x486f('0x2b')],'targetable_type':_0x486f('0x39'),'created_at':_0x35e476[_0x486f('0x28')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x35e476[_0x486f('0x3a')](0x1e,'m')['format'](_0x486f('0x31'))},'json':!![]};_0x3cf897[_0x486f('0xf')]=_0x32e001;return rp(_0x3cf897)[_0x486f('0x12')](function(_0x1fe73f){_0x2cf3dd[_0x486f('0x3b')]=_0x1fe73f[_0x486f('0x3c')]['id'];logger['info']('Task\x20created:',_0x2cf3dd[_0x486f('0x3b')]);_0x57f9dd(_0x2cf3dd);})[_0x486f('0x18')](function(_0x63dace){logger[_0x486f('0x19')]('['+[_0x2c4dbf['toUpperCase']()]+']',_0x63dace[_0x486f('0x1b')]);_0x2b87bd(_0x63dace[_0x486f('0x1b')]);});});};}function emit(_0x3b89ea,_0x5e32c3,_0x272a8f){var _0x1f16c9={'uri':_0x3b89ea+_0x486f('0x3d')+_0x272a8f};io['to'](util[_0x486f('0x28')](_0x486f('0x3e'),_0x5e32c3))[_0x486f('0x3f')](_0x486f('0x40'),_0x1f16c9);}exports['cs']=function(_0x21f222,_0x51ca91,_0x1a8c1c,_0x5a1072,_0xfd815,_0x132199,_0x4554f3,_0x1055cf){var _0x34033e={};var _0x2e5746={'Authorization':'Token\x20token='+_0x132199[_0x486f('0x41')]};_0x132199[_0x486f('0x42')]=intUtil[_0x486f('0x43')](_0x132199[_0x486f('0x42')]);_0x132199[_0x486f('0x44')]=intUtil[_0x486f('0x43')](_0x132199[_0x486f('0x44')]);var _0x3ce3fb=_0x132199[_0x486f('0x42')];_0x34033e['adminEmail']=_0x132199[_0x486f('0x45')];_0x34033e[_0x486f('0x2a')]=_0x1055cf[_0x486f('0x46')]()==='outbound'?_0x51ca91[_0x486f('0x47')]:_0x51ca91[_0x486f('0x48')];_0x34033e[_0x486f('0x49')]=_0x1055cf==='queue'||_0x1055cf===_0x486f('0x4a')?_0x486f('0x4b'):_0x486f('0x4c');if(_0x5a1072){_0x34033e[_0x486f('0x1d')]=_0x5a1072['email'];}var _0x57aac0=util[_0x486f('0x28')](_0x486f('0x4d'),_0x132199[_0x486f('0x44')],_0x51ca91[_0x486f('0x4e')],md5(_0x51ca91[_0x486f('0x4e')]));if(_0xfd815&&_0xfd815[_0x486f('0x4f')]){logger[_0x486f('0x10')](_0x486f('0x50'),'Recording\x20is\x20enabled!');_0x51ca91[_0x486f('0x51')]=_0x57aac0;}else if(_0x4554f3&&_0x4554f3['recordingFormat']&&_0x4554f3[_0x486f('0x52')]!==_0x486f('0x53')){logger[_0x486f('0x10')](_0x486f('0x54'),'Recording\x20is\x20enabled!');_0x51ca91[_0x486f('0x51')]=_0x57aac0;}else{_0x51ca91[_0x486f('0x51')]='';}return getAdminId(_0x34033e,_0x1055cf,_0x2e5746,_0x3ce3fb)[_0x486f('0x12')](getUser(_0x1055cf,_0x2e5746,_0x3ce3fb))[_0x486f('0x12')](getEndUser(_0x1055cf,_0x2e5746,_0x3ce3fb))['then'](getTicket(_0x1055cf,_0x2e5746,_0x3ce3fb,_0x1a8c1c,_0x51ca91))[_0x486f('0x12')](function(_0x33d5d9){logger[_0x486f('0x10')](util[_0x486f('0x28')](_0x486f('0x55'),_0x33d5d9[_0x486f('0x3b')]));if(_0x1055cf!==_0x486f('0x4a')){logger[_0x486f('0x10')]('['+[_0x1055cf['toUpperCase']()]+']',_0x486f('0x56'));emit(_0x3ce3fb,_0x5a1072[_0x486f('0x57')],_0x33d5d9[_0x486f('0x2b')]);}})[_0x486f('0x18')](function(_0x5a5046){logger[_0x486f('0x19')]('['+[_0x1055cf['toUpperCase']()]+_0x486f('0x58'),util[_0x486f('0x59')](_0x5a5046,{'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 b273f28..ed1774b 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 _0x4024=['zendesk','salesforce','sugarcrm','zoho','dynamics365','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','servicenow','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow'];(function(_0x3c09aa,_0x5282de){var _0x6cdd5c=function(_0x250160){while(--_0x250160){_0x3c09aa['push'](_0x3c09aa['shift']());}};_0x6cdd5c(++_0x5282de);}(_0x4024,0x89));var _0x4402=function(_0x4a8c5e,_0x541016){_0x4a8c5e=_0x4a8c5e-0x0;var _0x13d5ec=_0x4024[_0x4a8c5e];return _0x13d5ec;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4402('0x2'));var sugarcrm=require(_0x4402('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x4402('0x4'));var desk=require('./desk');var vtiger=require(_0x4402('0x5'));var servicenow=require(_0x4402('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x4402('0x7'),_0x4402('0x8'),_0x4402('0x9'),'freshdesk',_0x4402('0xa'),'desk','vtiger',_0x4402('0xb'),'freshsales','servicenow'];exports[_0x4402('0xc')]=function(_0x4f56aa,_0x1a4a47,_0x4e1a7e,_0x34b4a6,_0x525531,_0x3663e7){if(_0x4e1a7e){if(_[_0x4402('0xd')](integrations,_0x4f56aa['data1'][_0x4402('0xe')]())){try{var _0x302c4d=null;var _0xa819e9='';var _0x4c9032=_0x4e1a7e[_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]()];if(_0x4c9032){var _0x42f1b0=_0x4c9032[_0x4f56aa[_0x4402('0x10')]];if(_0x42f1b0){var _0x248ad9=_[_0x4402('0x11')](_0x42f1b0[_0x4402('0x12')],{'id':parseInt(_0x4f56aa[_0x4402('0x13')],0xa)});if(_0x248ad9){if(_0x34b4a6){if(_0x525531&&_0x1a4a47[_0x4402('0x14')]){_0xa819e9=_0x4402('0x14');}else if(_0x1a4a47[_0x4402('0x15')]){_0xa819e9=_0x4402('0x16');}else{console[_0x4402('0x17')](_0x4402('0x18'),_0x1a4a47);}}else{_0xa819e9=_0x4402('0x19');}switch(_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]()){case _0x4402('0x7'):zendesk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x8'):salesforce[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x9'):sugarcrm[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'freshdesk':freshdesk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'zoho':zoho[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x1a'):desk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x1b'):vtiger[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'freshsales':freshsales['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;case _0x4402('0x1c'):servicenow['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;case _0x4402('0xb'):dynamics365['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;default:console['log'](_0x4402('0x1d'));}}else{_0x302c4d=require('../../../../config/logger')(_0x4f56aa['data1'][_0x4402('0xe')]());_0x302c4d[_0x4402('0x1e')](_0x4402('0x1f'),util['format'](_0x4402('0x20'),_0x4f56aa['data1']['toLowerCase'](),_0x4f56aa[_0x4402('0x13')]));}}else{_0x302c4d=require(_0x4402('0x21'))(_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]());_0x302c4d[_0x4402('0x1e')](_0x4402('0x1f'),util[_0x4402('0x22')](_0x4402('0x23'),_0x4f56aa[_0x4402('0xf')]['toLowerCase'](),_0x4f56aa[_0x4402('0x10')]));}}else{}}catch(_0x4e1c04){console[_0x4402('0x1e')](_0x4e1c04);}}}}; \ No newline at end of file +var _0x93e9=['EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x4feffa,_0xc5f020){var _0x308324=function(_0x5e374c){while(--_0x5e374c){_0x4feffa['push'](_0x4feffa['shift']());}};_0x308324(++_0xc5f020);}(_0x93e9,0xcc));var _0x993e=function(_0x492e0b,_0x495310){_0x492e0b=_0x492e0b-0x0;var _0x5c646a=_0x93e9[_0x492e0b];return _0x5c646a;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var zendesk=require(_0x993e('0x2'));var salesforce=require(_0x993e('0x3'));var sugarcrm=require(_0x993e('0x4'));var freshdesk=require(_0x993e('0x5'));var zoho=require(_0x993e('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x993e('0x7'));var dynamics365=require(_0x993e('0x8'));var freshsales=require(_0x993e('0x9'));var integrations=[_0x993e('0xa'),_0x993e('0xb'),_0x993e('0xc'),_0x993e('0xd'),_0x993e('0xe'),'desk',_0x993e('0xf'),_0x993e('0x10'),_0x993e('0x11'),_0x993e('0x12')];exports[_0x993e('0x13')]=function(_0x27a28f,_0x1c2324,_0x48291a,_0x196f6d,_0x10cf0e,_0x4fe40b){if(_0x48291a){if(_['includes'](integrations,_0x27a28f[_0x993e('0x14')]['toLowerCase']())){try{var _0x333aa9=null;var _0x5d5c0d='';var _0x4c2707=_0x48291a[_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()];if(_0x4c2707){var _0x156bef=_0x4c2707[_0x27a28f[_0x993e('0x16')]];if(_0x156bef){var _0x3e082b=_[_0x993e('0x17')](_0x156bef[_0x993e('0x18')],{'id':parseInt(_0x27a28f[_0x993e('0x19')],0xa)});if(_0x3e082b){if(_0x196f6d){if(_0x10cf0e&&_0x1c2324[_0x993e('0x1a')]){_0x5d5c0d=_0x993e('0x1a');}else if(_0x1c2324[_0x993e('0x1b')]){_0x5d5c0d=_0x993e('0x1c');}else{console[_0x993e('0x1d')](_0x993e('0x1e'),_0x1c2324);}}else{_0x5d5c0d=_0x993e('0x1f');}switch(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()){case'zendesk':zendesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xb'):salesforce[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xc'):sugarcrm[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xd'):freshdesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xe'):zoho[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0x20'):desk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xf'):vtiger[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case'freshsales':freshsales['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x12'):servicenow['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x10'):dynamics365['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;default:console[_0x993e('0x1d')](_0x993e('0x21'));}}else{_0x333aa9=require(_0x993e('0x22'))(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')]('[EXEC]',util[_0x993e('0x24')]('%s\x20configuration\x20#%s\x20not\x20found',_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x19')]));}}else{_0x333aa9=require('../../../../config/logger')(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')](_0x993e('0x25'),util[_0x993e('0x24')](_0x993e('0x26'),_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x16')]));}}else{}}catch(_0x18f6ac){console[_0x993e('0x23')](_0x18f6ac);}}}}; \ 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 4ee9e22..d92be34 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 _0x766e=['toString','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','bluebird','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','User','execute','then','find','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length','Lead','contact','Contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','lead','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','type','string','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x766e,0x1ea));var _0xe766=function(_0x374785,_0x4f71b8){_0x374785=_0x374785-0x0;var _0x572c40=_0x766e[_0x374785];return _0x572c40;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe766('0x0'));var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xe766('0x1'));var config=require('../../../../config/environment');var logger=require(_0xe766('0x2'))('salesforce');config[_0xe766('0x3')]=_[_0xe766('0x4')](config[_0xe766('0x3')],{'host':_0xe766('0x5'),'port':0x18eb});var io=require(_0xe766('0x6'))(new Redis(config[_0xe766('0x3')]));function emit(_0xff6f0c,_0x45ef31,_0x4a1cc7){io['to'](_0xff6f0c)['emit'](_0x45ef31,_0x4a1cc7);}function getTicket(_0x5eddcf,_0x3793c9,_0x2917be,_0x1f8153,_0x83858,_0x10bf4b,_0x422450,_0x2356b4){var _0x411d62={};if(_0x1f8153[_0xe766('0x7')]===_0xe766('0x8')){_0x411d62=Object[_0xe766('0x9')]({},{'OwnerId':_0x3793c9['id'],'ActivityDate':moment[_0xe766('0xa')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xe766('0xb')](_0x1f8153[_0xe766('0xc')],_0x83858,'\x20'),'Description':intUtil['getString'](_0x1f8153[_0xe766('0xd')],_0x83858,'\x0a')},getCustomFields(_0x10bf4b,_0x83858));if(_0x2917be){_0x411d62[_0xe766('0xe')]=_0x2917be['id'];}}else if(_0x1f8153[_0xe766('0x7')]===_0xe766('0xf')){_0x411d62=Object[_0xe766('0x9')]({},{'OwnerId':_0x3793c9['id'],'Subject':intUtil[_0xe766('0xb')](_0x1f8153[_0xe766('0xc')],_0x83858,'\x20'),'Description':intUtil[_0xe766('0xb')](_0x1f8153[_0xe766('0xd')],_0x83858,'\x0a')},getCustomFields(_0x10bf4b,_0x83858));if(_0x2917be){_0x411d62[_0xe766('0x10')]=_0x2917be['id'];}}return _0x422450[_0xe766('0x11')](_0x1f8153[_0xe766('0x7')])[_0xe766('0x12')](_0x411d62);}function getUser(_0x1277a0,_0x1088a0,_0xdd002a){if(!_[_0xe766('0x13')](_0x1088a0)&&intUtil[_0xe766('0x14')](_0x1088a0)){var _0xa9d3d0={'Email':_0x1088a0};var _0x146d10={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xdd002a['sobject'](_0xe766('0x15'))['find'](_0xa9d3d0,_0x146d10)[_0xe766('0x16')]()[_0xe766('0x17')](function(_0x2ab082){if(_0x2ab082['length']){var _0x482f57=_[_0xe766('0x18')](_0x2ab082,function(_0xc57dd1){return _0xc57dd1[_0xe766('0x19')]===_0x1088a0;});if(_0x482f57){logger[_0xe766('0x1a')]('Agent\x20%s\x20found.',_0x1088a0);return BPromise[_0xe766('0x1b')]({'id':_0x482f57['Id'],'name':_0x482f57[_0xe766('0x1c')]});}}else{logger[_0xe766('0x1a')](_0xe766('0x1d'),_0x1088a0);return _0xdd002a[_0xe766('0x1e')]()['then'](function(_0x583158){return BPromise[_0xe766('0x1b')]({'id':_0x583158[_0xe766('0x1f')],'name':_0x583158['display_name']});});}});}else{logger[_0xe766('0x1a')](_0xe766('0x1d'),_0x1088a0);return _0xdd002a[_0xe766('0x1e')]()[_0xe766('0x17')](function(_0x5b137b){return BPromise[_0xe766('0x1b')]({'id':_0x5b137b['user_id'],'name':_0x5b137b['display_name']});});}}function getEndUser(_0x517d7b,_0x50118a,_0x513a16,_0x5bd6ff,_0x21c09a){var _0xba6f26={'Phone':_0x5bd6ff};var _0x27c1ad={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe766('0x1b')]()[_0xe766('0x17')](function(){if(_0x50118a[_0xe766('0x7')]===_0xe766('0x8')){logger[_0xe766('0x1a')](_0xe766('0x20'),_0x5bd6ff,_0x50118a[_0xe766('0x21')]);switch(_0x50118a[_0xe766('0x21')]){case _0xe766('0x22'):return _0x21c09a[_0xe766('0x11')]('Contact')['find'](_0xba6f26,_0x27c1ad)[_0xe766('0x16')]()[_0xe766('0x17')](function(_0xeb04a6){if(_0xeb04a6&&_0xeb04a6[_0xe766('0x23')]){return _0xeb04a6;}else{return _0x21c09a[_0xe766('0x11')](_0xe766('0x24'))[_0xe766('0x18')](_0xba6f26,_0x27c1ad);}});case _0xe766('0x25'):return _0x21c09a[_0xe766('0x11')](_0xe766('0x26'))[_0xe766('0x18')](_0xba6f26,_0x27c1ad)[_0xe766('0x16')]();case'lead':return _0x21c09a[_0xe766('0x11')](_0xe766('0x24'))[_0xe766('0x18')](_0xba6f26,_0x27c1ad);default:return null;}}else if(_0x50118a[_0xe766('0x7')]===_0xe766('0xf')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5bd6ff,'contact');return _0x21c09a[_0xe766('0x11')](_0xe766('0x26'))[_0xe766('0x18')](_0xba6f26,_0x27c1ad)['execute']();}})['then'](function(_0x28cc55){if(_0x28cc55&&_0x28cc55['length']){var _0x580a31=_[_0xe766('0x18')](_0x28cc55,function(_0x3c096b){return _0x3c096b[_0xe766('0x27')]===_0x5bd6ff;});if(_0x580a31){return BPromise['resolve']({'id':_0x580a31['Id'],'name':_0x580a31['Name'],'phone':_0x580a31['Phone']});}}})['then'](function(_0xc3e932){if(_0xc3e932){logger[_0xe766('0x1a')](_0xe766('0x28'),_0x5bd6ff);return BPromise[_0xe766('0x1b')](_0xc3e932);}else{logger[_0xe766('0x1a')](_0xe766('0x29'),_0x5bd6ff);var _0x430e80={'LastName':_0x513a16!==''?_0x513a16:util[_0xe766('0x2a')](_0xe766('0x2b'),_0x5bd6ff),'Phone':_0x5bd6ff};if(_0x50118a[_0xe766('0x2c')]){if(_0x50118a[_0xe766('0x2c')]===_0xe766('0x25')){logger[_0xe766('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5bd6ff,_0x50118a['moduleCreate']);}else if(_0x50118a['moduleCreate']===_0xe766('0x2d')&&_0x50118a[_0xe766('0x7')]===_0xe766('0x8')){logger[_0xe766('0x1a')](_0xe766('0x2e'),_0x5bd6ff,_0x50118a[_0xe766('0x2c')]);_0x430e80[_0xe766('0x2f')]=_0xe766('0x30');}else{return null;}}return _0x21c09a['sobject'](_['upperFirst'](_0x50118a[_0xe766('0x2c')]))['create'](_0x430e80);}});}function getCustomFields(_0x6595c4,_0x51f016){var _0x43fe87={};if(_0x6595c4[_0xe766('0x23')]>0x0){_[_0xe766('0x31')](_0x6595c4,function(_0x4121c0){if(_0x4121c0[_0xe766('0x32')]===_0xe766('0x33')&&_0x4121c0['idField']){_0x43fe87[_0x4121c0[_0xe766('0x34')]]=_0x4121c0[_0xe766('0x35')]['toString']();}else if(_0x4121c0[_0xe766('0x32')]===_0xe766('0x36')&&_0x4121c0['variableName']&&_0x4121c0['idField']){_0x51f016[_0x4121c0[_0xe766('0x37')]]&&(_0x43fe87[_0x4121c0[_0xe766('0x34')]]=_0x51f016[_0x4121c0[_0xe766('0x37')]]['toString']());}else if(_0x4121c0[_0xe766('0x32')]===_0xe766('0x38')&&_0x4121c0[_0xe766('0x39')]&&_0x4121c0['Variable']['name']&&_0x4121c0['idField']){_0x51f016[_0x4121c0['Variable'][_0xe766('0x3a')][_0xe766('0x3b')]()]&&(_0x43fe87[_0x4121c0[_0xe766('0x34')]]=_0x51f016[_0x4121c0[_0xe766('0x39')][_0xe766('0x3a')][_0xe766('0x3b')]()][_0xe766('0x3c')]());}});}return _0x43fe87;}function getConnection(_0x4e403d){var _0x34d5ef=_0x4e403d[_0xe766('0x3d')][_0xe766('0x3e')](_0x4e403d[_0xe766('0x3f')]);var _0x58ab12=new jsforce[(_0xe766('0x40'))]({'oauth2':{'loginUrl':_0x4e403d[_0xe766('0x41')]||_0xe766('0x42'),'clientId':_0x4e403d[_0xe766('0x43')],'clientSecret':_0x4e403d[_0xe766('0x44')]}});return _0x58ab12[_0xe766('0x45')](_0x4e403d['username'],_0x34d5ef)[_0xe766('0x17')](function(){logger[_0xe766('0x1a')]('Connection\x20established.');return _0x58ab12;});}exports['queue']=function(_0x2c6b1e,_0x4456be,_0x2feadd,_0x346920,_0x403f3b,_0x37a6ab){var _0x4095dd,_0x16792f,_0x1fe0e0,_0x3acc36;_0x37a6ab[_0xe766('0x46')]=intUtil['stripTrailingSlash'](_0x37a6ab[_0xe766('0x46')]);_0x37a6ab[_0xe766('0x41')]=intUtil[_0xe766('0x47')](_0x37a6ab[_0xe766('0x41')]);if(_0x403f3b&&_0x403f3b[_0xe766('0x48')]){logger[_0xe766('0x1a')](_0xe766('0x49'),_0xe766('0x4a'));_0x4456be[_0xe766('0x4b')]=util[_0xe766('0x2a')](_0xe766('0x4c'),_0x37a6ab['serverUrl'],_0x4456be[_0xe766('0x4d')],md5(_0x4456be[_0xe766('0x4d')]));}else{_0x4456be[_0xe766('0x4b')]='';}return getConnection(_0x37a6ab)['then'](function(_0x3e90bf){_0x3acc36=_0x3e90bf;return getUser(_0x37a6ab,_0x346920[_0xe766('0x4e')],_0x3acc36);})[_0xe766('0x17')](function(_0x485ce8){_0x4095dd=_0x485ce8;return getEndUser(_0x37a6ab,_0x2feadd,_0x4456be[_0xe766('0x4f')],_0x4456be[_0xe766('0x50')],_0x3acc36);})[_0xe766('0x17')](function(_0x4d28d7){_0x16792f=_0x4d28d7;return getTicket(_0x37a6ab,_0x4095dd,_0x16792f,_0x2feadd,_0x4456be,_0x2feadd[_0xe766('0x51')],_0x3acc36,_0xe766('0x52'));})[_0xe766('0x17')](function(_0x1a95bf){_0x1fe0e0=_0x1a95bf;logger[_0xe766('0x1a')](_0xe766('0x53'),_0x1fe0e0['id']);logger[_0xe766('0x1a')](_0xe766('0x54'),_0x1fe0e0['id'],_0x346920[_0xe766('0x3a')],_0x37a6ab[_0xe766('0x32')]);switch(_0x37a6ab[_0xe766('0x32')]){case _0xe766('0x55'):emit(util['format']('user:%s',_0x346920[_0xe766('0x3a')]),_0xe766('0x56'),{'recordId':_0x1fe0e0['id']});break;case _0xe766('0x57'):emit(util['format']('user:%s',_0x346920[_0xe766('0x3a')]),_0xe766('0x58'),{'uri':util[_0xe766('0x2a')]('%s/%s/e',_0x3acc36[_0xe766('0x59')],_0x1fe0e0['id'])});break;default:logger[_0xe766('0x5a')](_0xe766('0x5b'));}})[_0xe766('0x5c')](function(_0xfa198b){logger[_0xe766('0x5a')](_0xe766('0x49'),JSON['stringify'](_0xfa198b));});};exports[_0xe766('0x5d')]=function(_0x1624d4,_0xdab7c8,_0x103ee8,_0x90cbb6,_0x19495f,_0x356eb6,_0x1d05a9){var _0x44ea46,_0x2f296b,_0x1d8174,_0x43813c;_0x356eb6[_0xe766('0x46')]=intUtil[_0xe766('0x47')](_0x356eb6['serverUrl']);_0x356eb6[_0xe766('0x41')]=intUtil[_0xe766('0x47')](_0x356eb6[_0xe766('0x41')]);if(_0x1d05a9&&_0x1d05a9[_0xe766('0x5e')]&&_0x1d05a9['recordingFormat']!==_0xe766('0x5f')){logger[_0xe766('0x1a')](_0xe766('0x60'),_0xe766('0x4a'));_0xdab7c8[_0xe766('0x4b')]=util[_0xe766('0x2a')](_0xe766('0x4c'),_0x356eb6[_0xe766('0x46')],_0xdab7c8[_0xe766('0x4d')],md5(_0xdab7c8['uniqueid']));}return getConnection(_0x356eb6)[_0xe766('0x17')](function(_0x4d6029){_0x43813c=_0x4d6029;return getUser(_0x356eb6,_0x90cbb6['email'],_0x43813c);})[_0xe766('0x17')](function(_0x31d4da){_0x44ea46=_0x31d4da;return getEndUser(_0x356eb6,_0x103ee8,_0xdab7c8[_0xe766('0x61')],_0xdab7c8[_0xe766('0x62')],_0x43813c);})[_0xe766('0x17')](function(_0x31e38c){_0x2f296b=_0x31e38c;return getTicket(_0x356eb6,_0x44ea46,_0x2f296b,_0x103ee8,_0xdab7c8,_0x103ee8[_0xe766('0x51')],_0x43813c,'outbound');})[_0xe766('0x17')](function(_0x395ebc){_0x1d8174=_0x395ebc;logger[_0xe766('0x1a')](_0xe766('0x63'),_0x1d8174['id']);logger[_0xe766('0x1a')](_0xe766('0x64'),_0x1d8174['id'],_0x90cbb6[_0xe766('0x3a')],_0x356eb6[_0xe766('0x32')]);switch(_0x356eb6['type']){case'integrationTab':emit(util[_0xe766('0x2a')]('user:%s',_0x90cbb6[_0xe766('0x3a')]),_0xe766('0x56'),{'recordId':_0x1d8174['id']});break;case'newTab':emit(util[_0xe766('0x2a')](_0xe766('0x65'),_0x90cbb6[_0xe766('0x3a')]),'trigger:browser:url',{'uri':util['format'](_0xe766('0x66'),_0x43813c[_0xe766('0x59')],_0x1d8174['id'])});break;default:logger[_0xe766('0x5a')](_0xe766('0x60'),_0xe766('0x67'));}})[_0xe766('0x5c')](function(_0x4163d6){logger['error'](_0xe766('0x60'),JSON[_0xe766('0x68')](_0x4163d6));});};exports[_0xe766('0x69')]=function(_0x5d2721,_0x24abe8,_0x19559a,_0x40b3ae,_0x1b478f,_0x22c47d){var _0x5cf467,_0x259c1d,_0x57817b,_0xdc02c2;_0x22c47d[_0xe766('0x46')]=intUtil['stripTrailingSlash'](_0x22c47d['serverUrl']);_0x22c47d['remoteUri']=intUtil[_0xe766('0x47')](_0x22c47d[_0xe766('0x41')]);if(_0x1b478f&&_0x1b478f[_0xe766('0x48')]){logger[_0xe766('0x1a')]('['+_0x24abe8['lastevent']['toUpperCase']()+']',_0xe766('0x4a'));_0x24abe8[_0xe766('0x4b')]=util[_0xe766('0x2a')](_0xe766('0x4c'),_0x22c47d[_0xe766('0x46')],_0x24abe8[_0xe766('0x4d')],md5(_0x24abe8[_0xe766('0x4d')]));}else{_0x24abe8[_0xe766('0x4b')]='';}return getConnection(_0x22c47d)[_0xe766('0x17')](function(_0x1262ad){_0xdc02c2=_0x1262ad;if(!_['isNil'](_0x40b3ae)){return getUser(_0x22c47d,_0x40b3ae['name'],_0xdc02c2);}else{return getUser(_0x22c47d,null,_0xdc02c2);}})[_0xe766('0x17')](function(_0x36b0be){_0x5cf467=_0x36b0be;return getEndUser(_0x22c47d,_0x19559a,_0x24abe8[_0xe766('0x4f')],_0x24abe8[_0xe766('0x50')],_0xdc02c2);})[_0xe766('0x17')](function(_0x1385a4){_0x259c1d=_0x1385a4;return getTicket(_0x22c47d,_0x5cf467,_0x259c1d,_0x19559a,_0x24abe8,_0x19559a['Fields'],_0xdc02c2);})[_0xe766('0x17')](function(_0x1209e0){_0x57817b=_0x1209e0;logger[_0xe766('0x1a')]('['+_0x24abe8['lastevent'][_0xe766('0x6a')]()+_0xe766('0x6b'),_0x57817b['id']);logger[_0xe766('0x1a')]('['+_0x24abe8[_0xe766('0x6c')]['toUpperCase']()+_0xe766('0x6d'),_0x22c47d['type']);})[_0xe766('0x5c')](function(_0x1ff7e2){logger[_0xe766('0x5a')]('['+_0x24abe8[_0xe766('0x6c')][_0xe766('0x6a')]()+']',JSON['stringify'](_0x1ff7e2));});}; \ No newline at end of file +var _0xd211=['contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','stringify','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','Task','assign','getString','Subjects','ticketType','Case','Descriptions','sobject','create','isNil','validateEmail','User','find','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','execute','length','Lead'];(function(_0x57b1af,_0x20c2d4){var _0x5073d3=function(_0x16343e){while(--_0x16343e){_0x57b1af['push'](_0x57b1af['shift']());}};_0x5073d3(++_0x20c2d4);}(_0xd211,0x128));var _0x1d21=function(_0x27bb2e,_0x25130e){_0x27bb2e=_0x27bb2e-0x0;var _0x5dca65=_0xd211[_0x27bb2e];return _0x5dca65;};'use strict';var _=require(_0x1d21('0x0'));var rp=require(_0x1d21('0x1'));var moment=require('moment');var BPromise=require(_0x1d21('0x2'));var md5=require(_0x1d21('0x3'));var jsforce=require(_0x1d21('0x4'));var util=require(_0x1d21('0x5'));var Redis=require(_0x1d21('0x6'));var intUtil=require(_0x1d21('0x7'));var config=require(_0x1d21('0x8'));var logger=require(_0x1d21('0x9'))(_0x1d21('0xa'));config['redis']=_[_0x1d21('0xb')](config[_0x1d21('0xc')],{'host':_0x1d21('0xd'),'port':0x18eb});var io=require(_0x1d21('0xe'))(new Redis(config[_0x1d21('0xc')]));function emit(_0x676b62,_0x4c2143,_0x472441){io['to'](_0x676b62)['emit'](_0x4c2143,_0x472441);}function getTicket(_0x20f0ff,_0x910af8,_0x23a1c3,_0x5a8368,_0x1bce18,_0x495cd6,_0x24008b,_0xb2fff8){var _0x5950ba={};if(_0x5a8368['ticketType']===_0x1d21('0xf')){_0x5950ba=Object[_0x1d21('0x10')]({},{'OwnerId':_0x910af8['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x1d21('0x11')](_0x5a8368[_0x1d21('0x12')],_0x1bce18,'\x20'),'Description':intUtil[_0x1d21('0x11')](_0x5a8368['Descriptions'],_0x1bce18,'\x0a')},getCustomFields(_0x495cd6,_0x1bce18));if(_0x23a1c3){_0x5950ba['WhoId']=_0x23a1c3['id'];}}else if(_0x5a8368[_0x1d21('0x13')]===_0x1d21('0x14')){_0x5950ba=Object[_0x1d21('0x10')]({},{'OwnerId':_0x910af8['id'],'Subject':intUtil[_0x1d21('0x11')](_0x5a8368[_0x1d21('0x12')],_0x1bce18,'\x20'),'Description':intUtil[_0x1d21('0x11')](_0x5a8368[_0x1d21('0x15')],_0x1bce18,'\x0a')},getCustomFields(_0x495cd6,_0x1bce18));if(_0x23a1c3){_0x5950ba['ContactId']=_0x23a1c3['id'];}}return _0x24008b[_0x1d21('0x16')](_0x5a8368[_0x1d21('0x13')])[_0x1d21('0x17')](_0x5950ba);}function getUser(_0x4b1b93,_0x756652,_0x146955){if(!_[_0x1d21('0x18')](_0x756652)&&intUtil[_0x1d21('0x19')](_0x756652)){var _0x560413={'Email':_0x756652};var _0x2322a3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x146955[_0x1d21('0x16')](_0x1d21('0x1a'))[_0x1d21('0x1b')](_0x560413,_0x2322a3)['execute']()[_0x1d21('0x1c')](function(_0x30c26c){if(_0x30c26c['length']){var _0x1e3bc3=_[_0x1d21('0x1b')](_0x30c26c,function(_0xcbf20){return _0xcbf20[_0x1d21('0x1d')]===_0x756652;});if(_0x1e3bc3){logger[_0x1d21('0x1e')](_0x1d21('0x1f'),_0x756652);return BPromise[_0x1d21('0x20')]({'id':_0x1e3bc3['Id'],'name':_0x1e3bc3[_0x1d21('0x21')]});}}else{logger['info'](_0x1d21('0x22'),_0x756652);return _0x146955[_0x1d21('0x23')]()[_0x1d21('0x1c')](function(_0x90051c){return BPromise[_0x1d21('0x20')]({'id':_0x90051c[_0x1d21('0x24')],'name':_0x90051c['display_name']});});}});}else{logger['info'](_0x1d21('0x22'),_0x756652);return _0x146955[_0x1d21('0x23')]()[_0x1d21('0x1c')](function(_0x33aaf7){return BPromise['resolve']({'id':_0x33aaf7[_0x1d21('0x24')],'name':_0x33aaf7[_0x1d21('0x25')]});});}}function getEndUser(_0x35002b,_0x523083,_0x1cfc25,_0x59b74a,_0x1652a3){var _0x11e65f={'Phone':_0x59b74a};var _0x29b54e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1d21('0x20')]()['then'](function(){if(_0x523083['ticketType']===_0x1d21('0xf')){logger['info'](_0x1d21('0x26'),_0x59b74a,_0x523083[_0x1d21('0x27')]);switch(_0x523083[_0x1d21('0x27')]){case'contact_lead':return _0x1652a3[_0x1d21('0x16')]('Contact')[_0x1d21('0x1b')](_0x11e65f,_0x29b54e)[_0x1d21('0x28')]()[_0x1d21('0x1c')](function(_0x55fab1){if(_0x55fab1&&_0x55fab1[_0x1d21('0x29')]){return _0x55fab1;}else{return _0x1652a3[_0x1d21('0x16')](_0x1d21('0x2a'))[_0x1d21('0x1b')](_0x11e65f,_0x29b54e);}});case _0x1d21('0x2b'):return _0x1652a3[_0x1d21('0x16')](_0x1d21('0x2c'))[_0x1d21('0x1b')](_0x11e65f,_0x29b54e)[_0x1d21('0x28')]();case _0x1d21('0x2d'):return _0x1652a3[_0x1d21('0x16')]('Lead')[_0x1d21('0x1b')](_0x11e65f,_0x29b54e);default:return null;}}else if(_0x523083['ticketType']===_0x1d21('0x14')){logger[_0x1d21('0x1e')](_0x1d21('0x26'),_0x59b74a,_0x1d21('0x2b'));return _0x1652a3[_0x1d21('0x16')]('Contact')[_0x1d21('0x1b')](_0x11e65f,_0x29b54e)[_0x1d21('0x28')]();}})[_0x1d21('0x1c')](function(_0x1973ae){if(_0x1973ae&&_0x1973ae['length']){var _0x14f5b5=_[_0x1d21('0x1b')](_0x1973ae,function(_0x34ab28){return _0x34ab28[_0x1d21('0x2e')]===_0x59b74a;});if(_0x14f5b5){return BPromise['resolve']({'id':_0x14f5b5['Id'],'name':_0x14f5b5[_0x1d21('0x21')],'phone':_0x14f5b5[_0x1d21('0x2e')]});}}})[_0x1d21('0x1c')](function(_0x3f140e){if(_0x3f140e){logger[_0x1d21('0x1e')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x59b74a);return BPromise['resolve'](_0x3f140e);}else{logger[_0x1d21('0x1e')](_0x1d21('0x2f'),_0x59b74a);var _0xa1b327={'LastName':_0x1cfc25!==_0x1d21('0x30')?_0x1cfc25:util['format'](_0x1d21('0x31'),_0x59b74a),'Phone':_0x59b74a};if(_0x523083[_0x1d21('0x32')]){if(_0x523083['moduleCreate']===_0x1d21('0x2b')){logger[_0x1d21('0x1e')](_0x1d21('0x33'),_0x59b74a,_0x523083[_0x1d21('0x32')]);}else if(_0x523083['moduleCreate']===_0x1d21('0x2d')&&_0x523083['ticketType']==='Task'){logger[_0x1d21('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x59b74a,_0x523083[_0x1d21('0x32')]);_0xa1b327[_0x1d21('0x34')]=_0x1d21('0x35');}else{return null;}}return _0x1652a3['sobject'](_[_0x1d21('0x36')](_0x523083[_0x1d21('0x32')]))['create'](_0xa1b327);}});}function getCustomFields(_0x1b91f8,_0x5a7779){var _0x540d26={};if(_0x1b91f8['length']>0x0){_[_0x1d21('0x37')](_0x1b91f8,function(_0x3f1a83){if(_0x3f1a83[_0x1d21('0x38')]===_0x1d21('0x39')&&_0x3f1a83['idField']){_0x540d26[_0x3f1a83[_0x1d21('0x3a')]]=_0x3f1a83[_0x1d21('0x3b')]['toString']();}else if(_0x3f1a83[_0x1d21('0x38')]===_0x1d21('0x3c')&&_0x3f1a83[_0x1d21('0x3d')]&&_0x3f1a83[_0x1d21('0x3a')]){_0x5a7779[_0x3f1a83[_0x1d21('0x3d')]]&&(_0x540d26[_0x3f1a83['idField']]=_0x5a7779[_0x3f1a83[_0x1d21('0x3d')]][_0x1d21('0x3e')]());}else if(_0x3f1a83[_0x1d21('0x38')]===_0x1d21('0x3f')&&_0x3f1a83['Variable']&&_0x3f1a83[_0x1d21('0x40')]['name']&&_0x3f1a83[_0x1d21('0x3a')]){_0x5a7779[_0x3f1a83['Variable'][_0x1d21('0x41')]['toLowerCase']()]&&(_0x540d26[_0x3f1a83[_0x1d21('0x3a')]]=_0x5a7779[_0x3f1a83['Variable'][_0x1d21('0x41')][_0x1d21('0x42')]()][_0x1d21('0x3e')]());}});}return _0x540d26;}function getConnection(_0xf6cded){var _0x2c78ae=_0xf6cded[_0x1d21('0x43')][_0x1d21('0x44')](_0xf6cded['securityToken']);var _0x5a7f0c=new jsforce[(_0x1d21('0x45'))]({'oauth2':{'loginUrl':_0xf6cded[_0x1d21('0x46')]||_0x1d21('0x47'),'clientId':_0xf6cded[_0x1d21('0x48')],'clientSecret':_0xf6cded[_0x1d21('0x49')]}});return _0x5a7f0c[_0x1d21('0x4a')](_0xf6cded[_0x1d21('0x4b')],_0x2c78ae)['then'](function(){logger[_0x1d21('0x1e')](_0x1d21('0x4c'));return _0x5a7f0c;});}exports[_0x1d21('0x4d')]=function(_0x2b3f46,_0x136c34,_0x52d023,_0xf38818,_0x203ef9,_0x25ee77){var _0x1af75c,_0x3e83ab,_0x779939,_0x7bd068;_0x25ee77['serverUrl']=intUtil['stripTrailingSlash'](_0x25ee77[_0x1d21('0x4e')]);_0x25ee77[_0x1d21('0x46')]=intUtil[_0x1d21('0x4f')](_0x25ee77[_0x1d21('0x46')]);if(_0x203ef9&&_0x203ef9[_0x1d21('0x50')]){logger[_0x1d21('0x1e')](_0x1d21('0x51'),_0x1d21('0x52'));_0x136c34[_0x1d21('0x53')]=util[_0x1d21('0x54')](_0x1d21('0x55'),_0x25ee77['serverUrl'],_0x136c34['uniqueid'],md5(_0x136c34['uniqueid']));}else{_0x136c34[_0x1d21('0x53')]='';}return getConnection(_0x25ee77)[_0x1d21('0x1c')](function(_0x4c4cc8){_0x7bd068=_0x4c4cc8;return getUser(_0x25ee77,_0xf38818[_0x1d21('0x56')],_0x7bd068);})[_0x1d21('0x1c')](function(_0x2aae4a){_0x1af75c=_0x2aae4a;return getEndUser(_0x25ee77,_0x52d023,_0x136c34[_0x1d21('0x57')],_0x136c34[_0x1d21('0x58')],_0x7bd068);})['then'](function(_0x10fa34){_0x3e83ab=_0x10fa34;return getTicket(_0x25ee77,_0x1af75c,_0x3e83ab,_0x52d023,_0x136c34,_0x52d023['Fields'],_0x7bd068,'queue');})[_0x1d21('0x1c')](function(_0x16b50c){_0x779939=_0x16b50c;logger[_0x1d21('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x779939['id']);logger['info'](_0x1d21('0x59'),_0x779939['id'],_0xf38818[_0x1d21('0x41')],_0x25ee77[_0x1d21('0x38')]);switch(_0x25ee77[_0x1d21('0x38')]){case _0x1d21('0x5a'):emit(util['format']('user:%s',_0xf38818[_0x1d21('0x41')]),_0x1d21('0x5b'),{'recordId':_0x779939['id']});break;case _0x1d21('0x5c'):emit(util[_0x1d21('0x54')](_0x1d21('0x5d'),_0xf38818[_0x1d21('0x41')]),_0x1d21('0x5e'),{'uri':util[_0x1d21('0x54')](_0x1d21('0x5f'),_0x7bd068[_0x1d21('0x60')],_0x779939['id'])});break;default:logger[_0x1d21('0x61')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x1d21('0x62')](function(_0x33b074){logger[_0x1d21('0x61')](_0x1d21('0x51'),JSON[_0x1d21('0x63')](_0x33b074));});};exports['outbound']=function(_0x4f245c,_0x2a14f4,_0x58f597,_0x1fac90,_0x4ce2f2,_0x18b9d4,_0x245e01){var _0x460787,_0x5f4ecd,_0x3e9499,_0x2b9d5d;_0x18b9d4['serverUrl']=intUtil['stripTrailingSlash'](_0x18b9d4['serverUrl']);_0x18b9d4[_0x1d21('0x46')]=intUtil[_0x1d21('0x4f')](_0x18b9d4[_0x1d21('0x46')]);if(_0x245e01&&_0x245e01[_0x1d21('0x64')]&&_0x245e01['recordingFormat']!==_0x1d21('0x65')){logger[_0x1d21('0x1e')](_0x1d21('0x66'),_0x1d21('0x52'));_0x2a14f4[_0x1d21('0x53')]=util['format'](_0x1d21('0x55'),_0x18b9d4[_0x1d21('0x4e')],_0x2a14f4[_0x1d21('0x67')],md5(_0x2a14f4[_0x1d21('0x67')]));}return getConnection(_0x18b9d4)[_0x1d21('0x1c')](function(_0x4d320c){_0x2b9d5d=_0x4d320c;return getUser(_0x18b9d4,_0x1fac90[_0x1d21('0x56')],_0x2b9d5d);})['then'](function(_0x3da033){_0x460787=_0x3da033;return getEndUser(_0x18b9d4,_0x58f597,_0x2a14f4[_0x1d21('0x68')],_0x2a14f4[_0x1d21('0x69')],_0x2b9d5d);})[_0x1d21('0x1c')](function(_0x1d5590){_0x5f4ecd=_0x1d5590;return getTicket(_0x18b9d4,_0x460787,_0x5f4ecd,_0x58f597,_0x2a14f4,_0x58f597[_0x1d21('0x6a')],_0x2b9d5d,_0x1d21('0x6b'));})[_0x1d21('0x1c')](function(_0x24f680){_0x3e9499=_0x24f680;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3e9499['id']);logger[_0x1d21('0x1e')](_0x1d21('0x6c'),_0x3e9499['id'],_0x1fac90[_0x1d21('0x41')],_0x18b9d4['type']);switch(_0x18b9d4[_0x1d21('0x38')]){case'integrationTab':emit(util[_0x1d21('0x54')](_0x1d21('0x5d'),_0x1fac90[_0x1d21('0x41')]),_0x1d21('0x5b'),{'recordId':_0x3e9499['id']});break;case _0x1d21('0x5c'):emit(util[_0x1d21('0x54')](_0x1d21('0x5d'),_0x1fac90[_0x1d21('0x41')]),'trigger:browser:url',{'uri':util['format'](_0x1d21('0x5f'),_0x2b9d5d['instanceUrl'],_0x3e9499['id'])});break;default:logger[_0x1d21('0x61')](_0x1d21('0x66'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x1d21('0x62')](function(_0x50820){logger['error']('[OUTBOUND]',JSON[_0x1d21('0x63')](_0x50820));});};exports[_0x1d21('0x6d')]=function(_0x3fcccd,_0x258939,_0x36b57a,_0x59e85f,_0x1abe2d,_0x29964a){var _0x43eee0,_0x2e24f2,_0x2141f4,_0x377996;_0x29964a[_0x1d21('0x4e')]=intUtil[_0x1d21('0x4f')](_0x29964a[_0x1d21('0x4e')]);_0x29964a[_0x1d21('0x46')]=intUtil[_0x1d21('0x4f')](_0x29964a[_0x1d21('0x46')]);if(_0x1abe2d&&_0x1abe2d[_0x1d21('0x50')]){logger[_0x1d21('0x1e')]('['+_0x258939['lastevent']['toUpperCase']()+']',_0x1d21('0x52'));_0x258939[_0x1d21('0x53')]=util[_0x1d21('0x54')](_0x1d21('0x55'),_0x29964a[_0x1d21('0x4e')],_0x258939['uniqueid'],md5(_0x258939[_0x1d21('0x67')]));}else{_0x258939['recordingURL']='';}return getConnection(_0x29964a)['then'](function(_0xad63e){_0x377996=_0xad63e;if(!_[_0x1d21('0x18')](_0x59e85f)){return getUser(_0x29964a,_0x59e85f[_0x1d21('0x41')],_0x377996);}else{return getUser(_0x29964a,null,_0x377996);}})[_0x1d21('0x1c')](function(_0x2e16a6){_0x43eee0=_0x2e16a6;return getEndUser(_0x29964a,_0x36b57a,_0x258939[_0x1d21('0x57')],_0x258939[_0x1d21('0x58')],_0x377996);})['then'](function(_0x2a423b){_0x2e24f2=_0x2a423b;return getTicket(_0x29964a,_0x43eee0,_0x2e24f2,_0x36b57a,_0x258939,_0x36b57a['Fields'],_0x377996);})[_0x1d21('0x1c')](function(_0x2901e0){_0x2141f4=_0x2901e0;logger[_0x1d21('0x1e')]('['+_0x258939[_0x1d21('0x6e')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x2141f4['id']);logger['info']('['+_0x258939[_0x1d21('0x6e')][_0x1d21('0x6f')]()+_0x1d21('0x70'),_0x29964a[_0x1d21('0x38')]);})[_0x1d21('0x62')](function(_0x3dd6cc){logger[_0x1d21('0x61')]('['+_0x258939['lastevent'][_0x1d21('0x6f')]()+']',JSON[_0x1d21('0x63')](_0x3dd6cc));});}; \ 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 7733189..292ecde 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 _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0xdb75d7,_0x3ea4fe){var _0x558b8c=function(_0xf99036){while(--_0xf99036){_0xdb75d7['push'](_0xdb75d7['shift']());}};_0x558b8c(++_0x3ea4fe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x466573,_0x32911c){var _0x410e5d=function(_0x430067){while(--_0x430067){_0x466573['push'](_0x466573['shift']());}};_0x410e5d(++_0x32911c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'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 9fa342c..7f2c9b0 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 _0x0817=['The\x20Ticket\x20ID\x20is:','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','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','toUpperCase','lastevent','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','[HTTP]','map','string','nameField','customField','toLowerCase','content','toString','type','custom_fields','idField','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0817,0x90));var _0x7081=function(_0x2e69e8,_0xd3e3c0){_0x2e69e8=_0x2e69e8-0x0;var _0x3449e5=_0x0817[_0x2e69e8];return _0x3449e5;};'use strict';var _=require(_0x7081('0x0'));var rp=require('request-promise');var BPromise=require(_0x7081('0x1'));var md5=require(_0x7081('0x2'));var util=require(_0x7081('0x3'));var Redis=require(_0x7081('0x4'));var intUtil=require(_0x7081('0x5'));var config=require(_0x7081('0x6'));var logger=require(_0x7081('0x7'))(_0x7081('0x8'));config[_0x7081('0x9')]=_[_0x7081('0xa')](config[_0x7081('0x9')],{'host':_0x7081('0xb'),'port':0x18eb});var io=require(_0x7081('0xc'))(new Redis(config['redis']));var def={'method':_0x7081('0xd'),'json':!![]};function emit(_0x394e8b,_0x19288d,_0x5e4c7d){io['to'](_0x394e8b)[_0x7081('0xe')](_0x19288d,_0x5e4c7d);}function getTicket(_0x4b54fd,_0x4a0643,_0x35ea68,_0x2dd830,_0x2d12f7,_0x578b71,_0x493d4f,_0xa1d798){logger[_0x7081('0xf')]('Creating\x20new\x20ticket...');var _0xdaf292=new Date();var _0x2db490=[{'name':_0x7081('0x10'),'value':intUtil[_0x7081('0x11')](_0x2dd830[_0x7081('0x12')],_0x2d12f7,'\x20')},{'name':_0x7081('0x13'),'value':_0x4a0643['id']},{'name':_0x7081('0x14'),'value':_0x4a0643['id']},{'name':_0x7081('0x15'),'value':intUtil[_0x7081('0x11')](_0x2dd830[_0x7081('0x16')],_0x2d12f7,'\x0a')},{'name':_0x7081('0x17'),'value':_0xdaf292['toISOString']()[_0x7081('0x18')](0x0,0x13)['replace']('T','\x20')},{'name':_0x7081('0x19'),'value':'0'},{'name':_0x7081('0x1a'),'value':'15'},{'name':_0x7081('0x1b'),'value':_0x35ea68['id']},{'name':_0x7081('0x1c'),'value':_0x7081('0x1d')},{'name':'parent_name','value':_0x35ea68[_0x7081('0x10')]},{'name':_0x7081('0x1e'),'value':_0xa1d798}];if(_0x578b71[_0x7081('0x1f')]){_[_0x7081('0x20')](_0x578b71,function(_0x641315){if(_0x2d12f7[_0x641315[_0x7081('0x21')]]){_0x2db490[_0x7081('0x22')]({'name':_0x641315['idField'],'value':_0x2d12f7[_0x641315[_0x7081('0x21')]]});}});}return request({'form':{'method':_0x7081('0x23'),'input_type':_0x7081('0x24'),'response_type':_0x7081('0x24'),'rest_data':JSON[_0x7081('0x25')]({'session':_0x493d4f['id'],'module_name':'Calls','name_value_list':_0x2db490})}});}function getAuth(_0x1b8519){return util[_0x7081('0x26')](_0x7081('0x27'),new Buffer(_0x1b8519['apiKey']+':X')['toString'](_0x7081('0x28')));}function getServerInfo(_0x4a03fd){return request({'form':{'method':_0x7081('0x29'),'input_type':'JSON','response_type':_0x7081('0x24'),'rest_data':JSON[_0x7081('0x25')]({'session':_0x4a03fd['id']})}});}function getUser(_0x485eeb,_0x16b9db,_0x176172){if(!_[_0x7081('0x2a')](_0x16b9db)){logger['info'](_0x7081('0x2b'),_0x16b9db);return request({'form':{'method':_0x7081('0x2c'),'input_type':_0x7081('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x176172['id'],'module_name':_0x7081('0x2d'),'query':util[_0x7081('0x26')](_0x7081('0x2e'),_0x16b9db),'order_by':'','offset':'0','select_fields':['id',_0x7081('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7081('0x2f')](function(_0x187777){if(_0x187777[_0x7081('0x30')]['length']){var _0x614321=_[_0x7081('0x31')](_0x187777['entry_list'],function(_0x2595e9){return _0x2595e9[_0x7081('0x32')]['user_name']['value']===_0x16b9db;});if(_0x614321){logger[_0x7081('0xf')]('Agent\x20found!');return BPromise[_0x7081('0x33')]({'id':_0x614321[_0x7081('0x32')]['id'][_0x7081('0x34')],'name':_0x614321[_0x7081('0x32')][_0x7081('0x10')][_0x7081('0x34')]});}}logger[_0x7081('0xf')](_0x7081('0x35'));return BPromise['resolve']({'id':_0x176172['name_value_list'][_0x7081('0x36')][_0x7081('0x34')],'name':_0x176172[_0x7081('0x32')][_0x7081('0x37')][_0x7081('0x34')]});});}else{logger[_0x7081('0xf')](_0x7081('0x38'));return BPromise[_0x7081('0x33')]({'id':_0x176172[_0x7081('0x32')][_0x7081('0x36')][_0x7081('0x34')],'name':_0x176172[_0x7081('0x32')][_0x7081('0x37')][_0x7081('0x34')]});}}function getEndUser(_0x1a3b3b,_0x23266b,_0x708d47,_0x4938fd){logger[_0x7081('0xf')](_0x7081('0x39'),_0x708d47);return request({'form':{'method':_0x7081('0x2c'),'input_type':'JSON','response_type':_0x7081('0x24'),'rest_data':JSON[_0x7081('0x25')]({'session':_0x4938fd['id'],'module_name':_0x7081('0x1d'),'query':util[_0x7081('0x26')](_0x7081('0x3a'),_0x708d47),'order_by':'','offset':'0','select_fields':['id','name',_0x7081('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7081('0x2f')](function(_0x53f0ec){if(_0x53f0ec[_0x7081('0x30')]['length']){var _0x2b68bd=_['find'](_0x53f0ec[_0x7081('0x30')],function(_0x5adc81){return _0x5adc81[_0x7081('0x32')][_0x7081('0x3b')]['value']===_0x708d47;});if(_0x2b68bd){logger['info'](_0x7081('0x3c'));return BPromise['resolve']({'id':_0x2b68bd[_0x7081('0x32')]['id']['value'],'name':_0x2b68bd[_0x7081('0x32')]['name'][_0x7081('0x34')],'phone':_0x2b68bd['name_value_list']['phone_home']['value']});}}else{logger[_0x7081('0xf')](_0x7081('0x3d'));return request({'form':{'method':'set_entry','input_type':_0x7081('0x24'),'response_type':'JSON','rest_data':JSON[_0x7081('0x25')]({'session':_0x4938fd['id'],'module_name':_0x7081('0x1d'),'name_value_list':[{'name':'first_name','value':_0x23266b!==_0x7081('0x3e')?_0x23266b:util[_0x7081('0x26')]('Caller\x20-\x20%s',_0x708d47)},{'name':_0x7081('0x3b'),'value':_0x708d47}]})}})[_0x7081('0x2f')](function(_0x4f78ac){logger[_0x7081('0xf')](_0x7081('0x3f'));return BPromise[_0x7081('0x33')]({'id':_0x4f78ac['id'],'name':_0x4f78ac['entry_list'][_0x7081('0x40')]['value'],'phone':_0x4f78ac[_0x7081('0x30')]['phone_home'][_0x7081('0x34')]});});}});}function request(_0x3a7117){logger['debug'](_0x7081('0x41'),JSON[_0x7081('0x25')](_0x3a7117));return rp(_['merge'](def,_0x3a7117));}function getTags(_0x15ce39,_0x689102){var _0x4055db=[];if(_0x15ce39&&_0x15ce39[_0x7081('0x1f')]>0x0){_0x4055db=_[_0x7081('0x42')](_0x15ce39,_0x689102);}return _0x4055db;}function getCustomFields(_0x339837,_0x5b5e1d){var _0x1ec699=[];var _0x46a524={'custom_fields':[]};if(_0x339837[_0x7081('0x1f')]>0x0){_[_0x7081('0x20')](_0x339837,function(_0x36e3bb){if(_0x36e3bb['type']===_0x7081('0x43')&&_0x36e3bb[_0x7081('0x44')]&&!_0x36e3bb[_0x7081('0x45')]){_0x46a524[_0x36e3bb[_0x7081('0x44')][_0x7081('0x46')]()]=_0x36e3bb[_0x7081('0x47')][_0x7081('0x48')]();}else if(_0x36e3bb[_0x7081('0x49')]===_0x7081('0x43')&&_0x36e3bb['idField']&&_0x36e3bb[_0x7081('0x45')]){_0x46a524[_0x7081('0x4a')][_0x7081('0x22')]({'id':_0x36e3bb[_0x7081('0x4b')],'value':_0x36e3bb['content'][_0x7081('0x48')]()});}else if(_0x36e3bb[_0x7081('0x49')]==='variable'&&_0x36e3bb[_0x7081('0x21')]&&_0x36e3bb[_0x7081('0x4b')]&&_0x36e3bb['customField']){_0x5b5e1d[_0x36e3bb['variableName']]&&_0x46a524['custom_fields'][_0x7081('0x22')]({'id':_0x36e3bb['idField'],'value':_0x5b5e1d[_0x36e3bb[_0x7081('0x21')]]['toString']()});}else if(_0x36e3bb[_0x7081('0x49')]===_0x7081('0x4c')&&_0x36e3bb[_0x7081('0x4d')]&&_0x36e3bb[_0x7081('0x4d')]['name']&&_0x36e3bb[_0x7081('0x4b')]&&_0x36e3bb[_0x7081('0x45')]){_0x5b5e1d[_0x36e3bb[_0x7081('0x4d')][_0x7081('0x10')]['toLowerCase']()]&&_0x46a524[_0x7081('0x4a')][_0x7081('0x22')]({'id':_0x36e3bb[_0x7081('0x4b')],'value':_0x5b5e1d[_0x36e3bb[_0x7081('0x4d')][_0x7081('0x10')][_0x7081('0x46')]()]['toString']()});}});}return _0x46a524;}function getConnection(_0x467a2c){return request({'method':_0x7081('0xd'),'form':{'method':_0x7081('0x4e'),'input_type':'JSON','response_type':_0x7081('0x24'),'rest_data':JSON[_0x7081('0x25')]({'user_auth':{'user_name':_0x467a2c[_0x7081('0x4f')],'password':_0x467a2c['password'],'encryption':'PLAIN'},'application':_0x7081('0x50')})}})[_0x7081('0x2f')](function(_0x1f976e){var _0x4651fa=_0x1f976e;if(_0x4651fa['id']){def['sessionID']=_0x4651fa['id'];return BPromise['resolve'](_0x4651fa);}else{throw new Error(util['format'](_0x7081('0x51'),_0x467a2c['id']));}});}function setRelationship(_0x160b39,_0x1eba3d,_0x214397,_0xcba7de){return request({'form':{'method':_0x7081('0x52'),'input_type':_0x7081('0x24'),'response_type':_0x7081('0x24'),'rest_data':JSON[_0x7081('0x25')]({'session':_0x160b39['id'],'module_name':_0x7081('0x53'),'module_id':_0x214397['id'],'link_field_name':_0xcba7de,'related_ids':[_0x1eba3d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7081('0x54')]=function(_0x4485e7,_0x3715d1,_0x2dd1cf,_0x1323af,_0x2a403f,_0x215cd5){var _0x5b5226,_0x6d6b27,_0x286ba5,_0x5115d0;_0x215cd5[_0x7081('0x55')]=intUtil[_0x7081('0x56')](_0x215cd5['remoteUri']);_0x215cd5[_0x7081('0x57')]=intUtil[_0x7081('0x56')](_0x215cd5['serverUrl']);def[_0x7081('0x58')]=util[_0x7081('0x26')](_0x7081('0x59'),_0x215cd5[_0x7081('0x55')]);if(_0x2a403f&&_0x2a403f[_0x7081('0x5a')]){logger['info'](_0x7081('0x5b'),'Recording\x20is\x20enabled!');_0x3715d1['recordingURL']=util['format'](_0x7081('0x5c'),_0x215cd5[_0x7081('0x57')],_0x3715d1[_0x7081('0x5d')],md5(_0x3715d1[_0x7081('0x5d')]));}else{_0x3715d1[_0x7081('0x5e')]='';}return getConnection(_0x215cd5)[_0x7081('0x2f')](function(_0x4aea00){_0x5115d0=_0x4aea00;return getUser(_0x215cd5,_0x1323af[_0x7081('0x10')],_0x5115d0);})['then'](function(_0x1e750a){_0x5b5226=_0x1e750a;logger['info'](_0x7081('0x5f'),_0x5b5226['id']);return getEndUser(_0x215cd5,_0x3715d1[_0x7081('0x60')],_0x3715d1[_0x7081('0x61')],_0x5115d0);})['then'](function(_0xafe471){_0x6d6b27=_0xafe471;logger[_0x7081('0xf')](_0x7081('0x62'),_0x6d6b27['id']);return getTicket(_0x215cd5,_0x5b5226,_0x6d6b27,_0x2dd1cf,_0x3715d1,_0x2dd1cf[_0x7081('0x63')],_0x5115d0,_0x7081('0x64'));})[_0x7081('0x2f')](function(_0x4c9d35){_0x286ba5=_0x4c9d35;logger[_0x7081('0xf')](_0x7081('0x65'));logger[_0x7081('0xf')](_0x7081('0x66'),_0x286ba5['id']);return setRelationship(_0x5115d0,_0x5b5226,_0x286ba5,'users');})['then'](function(){return setRelationship(_0x5115d0,_0x6d6b27,_0x286ba5,_0x7081('0x67'));})[_0x7081('0x2f')](function(){return getServerInfo(_0x5115d0);})['then'](function(_0x138f51){var _0x3241a3=parseInt(_0x138f51['version'][_0x7081('0x68')](0x0));var _0x474a96=util[_0x7081('0x26')](_0x7081('0x69'),_0x215cd5['remoteUri'],_0x286ba5['id']);if(_0x3241a3>0x6){_0x474a96=util[_0x7081('0x26')](_0x7081('0x6a'),_0x215cd5[_0x7081('0x55')],_0x286ba5['id']);}logger[_0x7081('0xf')](_0x7081('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7081('0x6b'),_0x1323af[_0x7081('0x10')]),_0x7081('0x6c'),{'uri':_0x474a96});})['catch'](function(_0x48404c){logger[_0x7081('0x6d')]('[QUEUE]',JSON[_0x7081('0x25')](_0x48404c));});};exports[_0x7081('0x6e')]=function(_0x57b5b3,_0x2ec969,_0x1a3261,_0x19fc61,_0x58d875,_0x2d2589,_0x3b2052){var _0x175c31,_0x5a0ef3,_0x51ec98,_0xd012b5;_0x2d2589['remoteUri']=intUtil[_0x7081('0x56')](_0x2d2589[_0x7081('0x55')]);_0x2d2589['serverUrl']=intUtil[_0x7081('0x56')](_0x2d2589[_0x7081('0x57')]);def[_0x7081('0x58')]=util[_0x7081('0x26')](_0x7081('0x59'),_0x2d2589[_0x7081('0x55')]);if(_0x3b2052&&_0x3b2052[_0x7081('0x6f')]&&_0x3b2052[_0x7081('0x6f')]!=='none'){logger[_0x7081('0xf')](_0x7081('0x70'),_0x7081('0x71'));_0x2ec969[_0x7081('0x5e')]=util[_0x7081('0x26')](_0x7081('0x5c'),_0x2d2589[_0x7081('0x57')],_0x2ec969[_0x7081('0x5d')],md5(_0x2ec969[_0x7081('0x5d')]));}return getConnection(_0x2d2589)[_0x7081('0x2f')](function(_0x5e34a6){_0xd012b5=_0x5e34a6;return getUser(_0x2d2589,_0x19fc61[_0x7081('0x10')],_0xd012b5);})['then'](function(_0x53fe35){_0x175c31=_0x53fe35;logger['info'](_0x7081('0x5f'),_0x175c31['id']);return getEndUser(_0x2d2589,_0x2ec969[_0x7081('0x72')],_0x2ec969[_0x7081('0x73')],_0xd012b5);})[_0x7081('0x2f')](function(_0x3744be){_0x5a0ef3=_0x3744be;logger[_0x7081('0xf')]('The\x20Enduser\x20ID\x20is:',_0x5a0ef3['id']);return getTicket(_0x2d2589,_0x175c31,_0x5a0ef3,_0x1a3261,_0x2ec969,_0x1a3261['Fields'],_0xd012b5,_0x7081('0x74'));})[_0x7081('0x2f')](function(_0x36ae6c){_0x51ec98=_0x36ae6c;logger[_0x7081('0xf')](_0x7081('0x65'));logger[_0x7081('0xf')]('The\x20Ticket\x20ID\x20is:',_0x51ec98['id']);return setRelationship(_0xd012b5,_0x175c31,_0x51ec98,'users');})[_0x7081('0x2f')](function(){return setRelationship(_0xd012b5,_0x5a0ef3,_0x51ec98,_0x7081('0x67'));})['then'](function(){return getServerInfo(_0xd012b5);})[_0x7081('0x2f')](function(_0x44f8e9){var _0x5cd0c7=parseInt(_0x44f8e9[_0x7081('0x75')][_0x7081('0x68')](0x0));var _0x1bc1de=util[_0x7081('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2d2589[_0x7081('0x55')],_0x51ec98['id']);if(_0x5cd0c7>0x6){_0x1bc1de=util['format'](_0x7081('0x6a'),_0x2d2589[_0x7081('0x55')],_0x51ec98['id']);}logger[_0x7081('0xf')](_0x7081('0x70'),_0x7081('0x76'));emit(util[_0x7081('0x26')]('user:%s',_0x19fc61[_0x7081('0x10')]),_0x7081('0x6c'),{'uri':_0x1bc1de});})[_0x7081('0x77')](function(_0x281cbb){logger[_0x7081('0x6d')](_0x7081('0x70'),JSON['stringify'](_0x281cbb));});};exports[_0x7081('0x78')]=function(_0x14f576,_0x3d00e0,_0x1282a8,_0x8a7ae8,_0x13d0c9,_0x545bff){var _0x4498ba,_0x1380bd,_0x19296f,_0x1bb8c5;_0x545bff[_0x7081('0x55')]=intUtil[_0x7081('0x56')](_0x545bff[_0x7081('0x55')]);_0x545bff[_0x7081('0x57')]=intUtil[_0x7081('0x56')](_0x545bff[_0x7081('0x57')]);def[_0x7081('0x58')]=util[_0x7081('0x26')](_0x7081('0x59'),_0x545bff[_0x7081('0x55')]);if(_0x13d0c9&&_0x13d0c9[_0x7081('0x5a')]){logger[_0x7081('0xf')]('['+_0x3d00e0['lastevent'][_0x7081('0x79')]()+']',_0x7081('0x71'));_0x3d00e0['recordingURL']=util[_0x7081('0x26')](_0x7081('0x5c'),_0x545bff[_0x7081('0x57')],_0x3d00e0['uniqueid'],md5(_0x3d00e0[_0x7081('0x5d')]));}else{_0x3d00e0[_0x7081('0x5e')]='';}return getConnection(_0x545bff)[_0x7081('0x2f')](function(_0x125bd0){_0x1bb8c5=_0x125bd0;if(!_[_0x7081('0x2a')](_0x8a7ae8)){return getUser(_0x545bff,_0x8a7ae8['name'],_0x1bb8c5);}else{return getUser(_0x545bff,null,_0x1bb8c5);}})[_0x7081('0x2f')](function(_0x201d39){_0x4498ba=_0x201d39;logger[_0x7081('0xf')]('The\x20User\x20ID\x20is:',_0x4498ba['id']);return getEndUser(_0x545bff,_0x3d00e0[_0x7081('0x60')],_0x3d00e0[_0x7081('0x61')],_0x1bb8c5);})[_0x7081('0x2f')](function(_0x2a9515){_0x1380bd=_0x2a9515;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1380bd['id']);return getTicket(_0x545bff,_0x4498ba,_0x1380bd,_0x1282a8,_0x3d00e0,_0x1282a8[_0x7081('0x63')],_0x1bb8c5,_0x7081('0x64'));})[_0x7081('0x2f')](function(_0x4f9b48){_0x19296f=_0x4f9b48;logger[_0x7081('0xf')](_0x7081('0x65'));logger[_0x7081('0xf')]('The\x20Ticket\x20ID\x20is:',_0x19296f['id']);return setRelationship(_0x1bb8c5,_0x4498ba,_0x19296f,'users');})[_0x7081('0x2f')](function(){return setRelationship(_0x1bb8c5,_0x1380bd,_0x19296f,_0x7081('0x67'));})[_0x7081('0x2f')](function(){return getServerInfo(_0x1bb8c5);})[_0x7081('0x77')](function(_0x327386){logger[_0x7081('0x6d')]('['+_0x3d00e0[_0x7081('0x7a')][_0x7081('0x79')]()+']',JSON[_0x7081('0x25')](_0x327386));});}; \ No newline at end of file +var _0x3d5d=['emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','slice','replace','duration_minutes','parent_type','Contacts','parent_name','direction','length','push','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','user_name','entry_list','find','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','map','forEach','string','nameField','toLowerCase','type','customField','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','then','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','contacts','version','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','users','%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...','catch','error','toUpperCase','isNil','lastevent','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST'];(function(_0x12e526,_0x50f1ad){var _0x272fca=function(_0x561570){while(--_0x561570){_0x12e526['push'](_0x12e526['shift']());}};_0x272fca(++_0x50f1ad);}(_0x3d5d,0xe2));var _0xd3d5=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0x3d5d[_0x178668];return _0x26107d;};'use strict';var _=require(_0xd3d5('0x0'));var rp=require('request-promise');var BPromise=require(_0xd3d5('0x1'));var md5=require(_0xd3d5('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd3d5('0x3'));var config=require(_0xd3d5('0x4'));var logger=require(_0xd3d5('0x5'))(_0xd3d5('0x6'));config[_0xd3d5('0x7')]=_[_0xd3d5('0x8')](config['redis'],{'host':_0xd3d5('0x9'),'port':0x18eb});var io=require(_0xd3d5('0xa'))(new Redis(config[_0xd3d5('0x7')]));var def={'method':_0xd3d5('0xb'),'json':!![]};function emit(_0x2b4892,_0x9e67b4,_0x4f5421){io['to'](_0x2b4892)[_0xd3d5('0xc')](_0x9e67b4,_0x4f5421);}function getTicket(_0x48c5fd,_0x6b10a5,_0x3dd64e,_0x561ca9,_0x30a079,_0x43308d,_0x577231,_0xd62609){logger[_0xd3d5('0xd')](_0xd3d5('0xe'));var _0x5c18b2=new Date();var _0x5c1498=[{'name':_0xd3d5('0xf'),'value':intUtil[_0xd3d5('0x10')](_0x561ca9['Subjects'],_0x30a079,'\x20')},{'name':_0xd3d5('0x11'),'value':_0x6b10a5['id']},{'name':'created_by','value':_0x6b10a5['id']},{'name':_0xd3d5('0x12'),'value':intUtil[_0xd3d5('0x10')](_0x561ca9[_0xd3d5('0x13')],_0x30a079,'\x0a')},{'name':'date_start','value':_0x5c18b2['toISOString']()[_0xd3d5('0x14')](0x0,0x13)[_0xd3d5('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd3d5('0x16'),'value':'15'},{'name':'parent_id','value':_0x3dd64e['id']},{'name':_0xd3d5('0x17'),'value':_0xd3d5('0x18')},{'name':_0xd3d5('0x19'),'value':_0x3dd64e['name']},{'name':_0xd3d5('0x1a'),'value':_0xd62609}];if(_0x43308d[_0xd3d5('0x1b')]){_['forEach'](_0x43308d,function(_0x39a5cb){if(_0x30a079[_0x39a5cb['variableName']]){_0x5c1498[_0xd3d5('0x1c')]({'name':_0x39a5cb[_0xd3d5('0x1d')],'value':_0x30a079[_0x39a5cb[_0xd3d5('0x1e')]]});}});}return request({'form':{'method':_0xd3d5('0x1f'),'input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON['stringify']({'session':_0x577231['id'],'module_name':_0xd3d5('0x21'),'name_value_list':_0x5c1498})}});}function getAuth(_0x4893f6){return util[_0xd3d5('0x22')](_0xd3d5('0x23'),new Buffer(_0x4893f6[_0xd3d5('0x24')]+':X')[_0xd3d5('0x25')](_0xd3d5('0x26')));}function getServerInfo(_0x3d2a3a){return request({'form':{'method':_0xd3d5('0x27'),'input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON[_0xd3d5('0x28')]({'session':_0x3d2a3a['id']})}});}function getUser(_0x4ea31b,_0x1a8301,_0x376014){if(!_['isNil'](_0x1a8301)){logger[_0xd3d5('0xd')](_0xd3d5('0x29'),_0x1a8301);return request({'form':{'method':_0xd3d5('0x2a'),'input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON[_0xd3d5('0x28')]({'session':_0x376014['id'],'module_name':'Employees','query':util[_0xd3d5('0x22')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1a8301),'order_by':'','offset':'0','select_fields':['id',_0xd3d5('0xf'),_0xd3d5('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x49270d){if(_0x49270d[_0xd3d5('0x2c')][_0xd3d5('0x1b')]){var _0x3c83db=_[_0xd3d5('0x2d')](_0x49270d[_0xd3d5('0x2c')],function(_0x41b882){return _0x41b882[_0xd3d5('0x2e')][_0xd3d5('0x2b')]['value']===_0x1a8301;});if(_0x3c83db){logger[_0xd3d5('0xd')]('Agent\x20found!');return BPromise[_0xd3d5('0x2f')]({'id':_0x3c83db['name_value_list']['id'][_0xd3d5('0x30')],'name':_0x3c83db['name_value_list'][_0xd3d5('0xf')][_0xd3d5('0x30')]});}}logger[_0xd3d5('0xd')](_0xd3d5('0x31'));return BPromise[_0xd3d5('0x2f')]({'id':_0x376014[_0xd3d5('0x2e')][_0xd3d5('0x32')][_0xd3d5('0x30')],'name':_0x376014['name_value_list'][_0xd3d5('0x2b')]['value']});});}else{logger[_0xd3d5('0xd')](_0xd3d5('0x33'));return BPromise[_0xd3d5('0x2f')]({'id':_0x376014[_0xd3d5('0x2e')][_0xd3d5('0x32')][_0xd3d5('0x30')],'name':_0x376014['name_value_list'][_0xd3d5('0x2b')][_0xd3d5('0x30')]});}}function getEndUser(_0x446fdd,_0x5aa8e0,_0x30e3b1,_0x500b24){logger[_0xd3d5('0xd')](_0xd3d5('0x34'),_0x30e3b1);return request({'form':{'method':'get_entry_list','input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON[_0xd3d5('0x28')]({'session':_0x500b24['id'],'module_name':_0xd3d5('0x18'),'query':util[_0xd3d5('0x22')](_0xd3d5('0x35'),_0x30e3b1),'order_by':'','offset':'0','select_fields':['id',_0xd3d5('0xf'),_0xd3d5('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5b4a69){if(_0x5b4a69['entry_list'][_0xd3d5('0x1b')]){var _0x2a0440=_[_0xd3d5('0x2d')](_0x5b4a69[_0xd3d5('0x2c')],function(_0x38ce9e){return _0x38ce9e['name_value_list'][_0xd3d5('0x36')][_0xd3d5('0x30')]===_0x30e3b1;});if(_0x2a0440){logger[_0xd3d5('0xd')](_0xd3d5('0x37'));return BPromise[_0xd3d5('0x2f')]({'id':_0x2a0440[_0xd3d5('0x2e')]['id'][_0xd3d5('0x30')],'name':_0x2a0440[_0xd3d5('0x2e')][_0xd3d5('0xf')][_0xd3d5('0x30')],'phone':_0x2a0440[_0xd3d5('0x2e')]['phone_home'][_0xd3d5('0x30')]});}}else{logger[_0xd3d5('0xd')](_0xd3d5('0x38'));return request({'form':{'method':_0xd3d5('0x1f'),'input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON[_0xd3d5('0x28')]({'session':_0x500b24['id'],'module_name':_0xd3d5('0x18'),'name_value_list':[{'name':_0xd3d5('0x39'),'value':_0x5aa8e0!==_0xd3d5('0x3a')?_0x5aa8e0:util['format']('Caller\x20-\x20%s',_0x30e3b1)},{'name':_0xd3d5('0x36'),'value':_0x30e3b1}]})}})['then'](function(_0x3bb358){logger[_0xd3d5('0xd')](_0xd3d5('0x3b'));return BPromise['resolve']({'id':_0x3bb358['id'],'name':_0x3bb358['entry_list']['first_name'][_0xd3d5('0x30')],'phone':_0x3bb358['entry_list']['phone_home'][_0xd3d5('0x30')]});});}});}function request(_0x45bddd){logger[_0xd3d5('0x3c')](_0xd3d5('0x3d'),JSON[_0xd3d5('0x28')](_0x45bddd));return rp(_['merge'](def,_0x45bddd));}function getTags(_0x454245,_0x30d6fa){var _0x51ac09=[];if(_0x454245&&_0x454245[_0xd3d5('0x1b')]>0x0){_0x51ac09=_[_0xd3d5('0x3e')](_0x454245,_0x30d6fa);}return _0x51ac09;}function getCustomFields(_0x3882ce,_0x17210b){var _0x454b8a=[];var _0x3ae50e={'custom_fields':[]};if(_0x3882ce[_0xd3d5('0x1b')]>0x0){_[_0xd3d5('0x3f')](_0x3882ce,function(_0x273b0d){if(_0x273b0d['type']===_0xd3d5('0x40')&&_0x273b0d['nameField']&&!_0x273b0d['customField']){_0x3ae50e[_0x273b0d[_0xd3d5('0x41')][_0xd3d5('0x42')]()]=_0x273b0d['content'][_0xd3d5('0x25')]();}else if(_0x273b0d[_0xd3d5('0x43')]==='string'&&_0x273b0d[_0xd3d5('0x1d')]&&_0x273b0d[_0xd3d5('0x44')]){_0x3ae50e[_0xd3d5('0x45')][_0xd3d5('0x1c')]({'id':_0x273b0d[_0xd3d5('0x1d')],'value':_0x273b0d[_0xd3d5('0x46')][_0xd3d5('0x25')]()});}else if(_0x273b0d[_0xd3d5('0x43')]===_0xd3d5('0x47')&&_0x273b0d['variableName']&&_0x273b0d[_0xd3d5('0x1d')]&&_0x273b0d[_0xd3d5('0x44')]){_0x17210b[_0x273b0d['variableName']]&&_0x3ae50e[_0xd3d5('0x45')]['push']({'id':_0x273b0d[_0xd3d5('0x1d')],'value':_0x17210b[_0x273b0d[_0xd3d5('0x1e')]][_0xd3d5('0x25')]()});}else if(_0x273b0d[_0xd3d5('0x43')]===_0xd3d5('0x48')&&_0x273b0d[_0xd3d5('0x49')]&&_0x273b0d[_0xd3d5('0x49')][_0xd3d5('0xf')]&&_0x273b0d['idField']&&_0x273b0d['customField']){_0x17210b[_0x273b0d[_0xd3d5('0x49')][_0xd3d5('0xf')][_0xd3d5('0x42')]()]&&_0x3ae50e[_0xd3d5('0x45')][_0xd3d5('0x1c')]({'id':_0x273b0d[_0xd3d5('0x1d')],'value':_0x17210b[_0x273b0d[_0xd3d5('0x49')][_0xd3d5('0xf')][_0xd3d5('0x42')]()][_0xd3d5('0x25')]()});}});}return _0x3ae50e;}function getConnection(_0x3e3459){return request({'method':_0xd3d5('0xb'),'form':{'method':_0xd3d5('0x4a'),'input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON[_0xd3d5('0x28')]({'user_auth':{'user_name':_0x3e3459[_0xd3d5('0x4b')],'password':_0x3e3459[_0xd3d5('0x4c')],'encryption':_0xd3d5('0x4d')},'application':_0xd3d5('0x4e')})}})['then'](function(_0x2e8a66){var _0xbebe9e=_0x2e8a66;if(_0xbebe9e['id']){def[_0xd3d5('0x4f')]=_0xbebe9e['id'];return BPromise['resolve'](_0xbebe9e);}else{throw new Error(util[_0xd3d5('0x22')](_0xd3d5('0x50'),_0x3e3459['id']));}});}function setRelationship(_0xef667b,_0x1a2a45,_0x4d6157,_0x5be314){return request({'form':{'method':_0xd3d5('0x51'),'input_type':_0xd3d5('0x20'),'response_type':_0xd3d5('0x20'),'rest_data':JSON['stringify']({'session':_0xef667b['id'],'module_name':_0xd3d5('0x21'),'module_id':_0x4d6157['id'],'link_field_name':_0x5be314,'related_ids':[_0x1a2a45['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2d4948,_0x30c100,_0x1a0cd8,_0x3a5499,_0x45a6e8,_0x52b446){var _0x2797b0,_0x20d7f0,_0x5f003d,_0x2122c0;_0x52b446[_0xd3d5('0x52')]=intUtil[_0xd3d5('0x53')](_0x52b446['remoteUri']);_0x52b446['serverUrl']=intUtil[_0xd3d5('0x53')](_0x52b446['serverUrl']);def[_0xd3d5('0x54')]=util[_0xd3d5('0x22')](_0xd3d5('0x55'),_0x52b446[_0xd3d5('0x52')]);if(_0x45a6e8&&_0x45a6e8[_0xd3d5('0x56')]){logger[_0xd3d5('0xd')](_0xd3d5('0x57'),_0xd3d5('0x58'));_0x30c100['recordingURL']=util[_0xd3d5('0x22')](_0xd3d5('0x59'),_0x52b446[_0xd3d5('0x5a')],_0x30c100[_0xd3d5('0x5b')],md5(_0x30c100[_0xd3d5('0x5b')]));}else{_0x30c100[_0xd3d5('0x5c')]='';}return getConnection(_0x52b446)[_0xd3d5('0x5d')](function(_0x162f9f){_0x2122c0=_0x162f9f;return getUser(_0x52b446,_0x3a5499[_0xd3d5('0xf')],_0x2122c0);})[_0xd3d5('0x5d')](function(_0x3d9d23){_0x2797b0=_0x3d9d23;logger[_0xd3d5('0xd')]('The\x20User\x20ID\x20is:',_0x2797b0['id']);return getEndUser(_0x52b446,_0x30c100[_0xd3d5('0x5e')],_0x30c100[_0xd3d5('0x5f')],_0x2122c0);})[_0xd3d5('0x5d')](function(_0x2b5146){_0x20d7f0=_0x2b5146;logger[_0xd3d5('0xd')]('The\x20Enduser\x20ID\x20is:',_0x20d7f0['id']);return getTicket(_0x52b446,_0x2797b0,_0x20d7f0,_0x1a0cd8,_0x30c100,_0x1a0cd8[_0xd3d5('0x60')],_0x2122c0,_0xd3d5('0x61'));})['then'](function(_0x2d86bb){_0x5f003d=_0x2d86bb;logger[_0xd3d5('0xd')](_0xd3d5('0x62'));logger[_0xd3d5('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5f003d['id']);return setRelationship(_0x2122c0,_0x2797b0,_0x5f003d,'users');})['then'](function(){return setRelationship(_0x2122c0,_0x20d7f0,_0x5f003d,_0xd3d5('0x63'));})[_0xd3d5('0x5d')](function(){return getServerInfo(_0x2122c0);})[_0xd3d5('0x5d')](function(_0x1efbd1){var _0x1f4f75=parseInt(_0x1efbd1[_0xd3d5('0x64')]['charAt'](0x0));var _0x9f3779=util[_0xd3d5('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x52b446['remoteUri'],_0x5f003d['id']);if(_0x1f4f75>0x6){_0x9f3779=util[_0xd3d5('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x52b446[_0xd3d5('0x52')],_0x5f003d['id']);}logger[_0xd3d5('0xd')](_0xd3d5('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd3d5('0x22')](_0xd3d5('0x65'),_0x3a5499[_0xd3d5('0xf')]),_0xd3d5('0x66'),{'uri':_0x9f3779});})['catch'](function(_0x43ae47){logger['error'](_0xd3d5('0x57'),JSON[_0xd3d5('0x28')](_0x43ae47));});};exports[_0xd3d5('0x67')]=function(_0x2f51b8,_0x3f7bfd,_0x46bf49,_0x391f39,_0x192c58,_0x3ac80d,_0x5f4cee){var _0x18f981,_0x5233cb,_0x2e00ec,_0x15a0b9;_0x3ac80d['remoteUri']=intUtil[_0xd3d5('0x53')](_0x3ac80d[_0xd3d5('0x52')]);_0x3ac80d[_0xd3d5('0x5a')]=intUtil[_0xd3d5('0x53')](_0x3ac80d[_0xd3d5('0x5a')]);def[_0xd3d5('0x54')]=util[_0xd3d5('0x22')](_0xd3d5('0x55'),_0x3ac80d[_0xd3d5('0x52')]);if(_0x5f4cee&&_0x5f4cee['recordingFormat']&&_0x5f4cee[_0xd3d5('0x68')]!=='none'){logger[_0xd3d5('0xd')](_0xd3d5('0x69'),_0xd3d5('0x58'));_0x3f7bfd[_0xd3d5('0x5c')]=util[_0xd3d5('0x22')](_0xd3d5('0x59'),_0x3ac80d[_0xd3d5('0x5a')],_0x3f7bfd[_0xd3d5('0x5b')],md5(_0x3f7bfd[_0xd3d5('0x5b')]));}return getConnection(_0x3ac80d)['then'](function(_0x39192e){_0x15a0b9=_0x39192e;return getUser(_0x3ac80d,_0x391f39[_0xd3d5('0xf')],_0x15a0b9);})[_0xd3d5('0x5d')](function(_0x11b133){_0x18f981=_0x11b133;logger['info'](_0xd3d5('0x6a'),_0x18f981['id']);return getEndUser(_0x3ac80d,_0x3f7bfd['destcalleridname'],_0x3f7bfd[_0xd3d5('0x6b')],_0x15a0b9);})[_0xd3d5('0x5d')](function(_0x5e9307){_0x5233cb=_0x5e9307;logger[_0xd3d5('0xd')](_0xd3d5('0x6c'),_0x5233cb['id']);return getTicket(_0x3ac80d,_0x18f981,_0x5233cb,_0x46bf49,_0x3f7bfd,_0x46bf49[_0xd3d5('0x60')],_0x15a0b9,'Outbound');})[_0xd3d5('0x5d')](function(_0x2a8da4){_0x2e00ec=_0x2a8da4;logger['info'](_0xd3d5('0x62'));logger[_0xd3d5('0xd')](_0xd3d5('0x6d'),_0x2e00ec['id']);return setRelationship(_0x15a0b9,_0x18f981,_0x2e00ec,_0xd3d5('0x6e'));})['then'](function(){return setRelationship(_0x15a0b9,_0x5233cb,_0x2e00ec,_0xd3d5('0x63'));})[_0xd3d5('0x5d')](function(){return getServerInfo(_0x15a0b9);})[_0xd3d5('0x5d')](function(_0x462f03){var _0x59a34d=parseInt(_0x462f03['version']['charAt'](0x0));var _0x2fa898=util['format'](_0xd3d5('0x6f'),_0x3ac80d[_0xd3d5('0x52')],_0x2e00ec['id']);if(_0x59a34d>0x6){_0x2fa898=util[_0xd3d5('0x22')](_0xd3d5('0x70'),_0x3ac80d[_0xd3d5('0x52')],_0x2e00ec['id']);}logger[_0xd3d5('0xd')](_0xd3d5('0x69'),_0xd3d5('0x71'));emit(util[_0xd3d5('0x22')](_0xd3d5('0x65'),_0x391f39[_0xd3d5('0xf')]),_0xd3d5('0x66'),{'uri':_0x2fa898});})[_0xd3d5('0x72')](function(_0x37bde2){logger[_0xd3d5('0x73')](_0xd3d5('0x69'),JSON[_0xd3d5('0x28')](_0x37bde2));});};exports['unmanaged']=function(_0x5d7f0e,_0x28b4a2,_0x372e24,_0x327304,_0xbced26,_0x397ac7){var _0x4cf75f,_0x35382b,_0x5d2b4e,_0x4b75ef;_0x397ac7['remoteUri']=intUtil['stripTrailingSlash'](_0x397ac7['remoteUri']);_0x397ac7[_0xd3d5('0x5a')]=intUtil[_0xd3d5('0x53')](_0x397ac7[_0xd3d5('0x5a')]);def['uri']=util[_0xd3d5('0x22')](_0xd3d5('0x55'),_0x397ac7[_0xd3d5('0x52')]);if(_0xbced26&&_0xbced26['monitor_format']){logger[_0xd3d5('0xd')]('['+_0x28b4a2['lastevent'][_0xd3d5('0x74')]()+']',_0xd3d5('0x58'));_0x28b4a2[_0xd3d5('0x5c')]=util[_0xd3d5('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x397ac7['serverUrl'],_0x28b4a2[_0xd3d5('0x5b')],md5(_0x28b4a2[_0xd3d5('0x5b')]));}else{_0x28b4a2[_0xd3d5('0x5c')]='';}return getConnection(_0x397ac7)[_0xd3d5('0x5d')](function(_0x4b652a){_0x4b75ef=_0x4b652a;if(!_[_0xd3d5('0x75')](_0x327304)){return getUser(_0x397ac7,_0x327304[_0xd3d5('0xf')],_0x4b75ef);}else{return getUser(_0x397ac7,null,_0x4b75ef);}})[_0xd3d5('0x5d')](function(_0x3f510e){_0x4cf75f=_0x3f510e;logger[_0xd3d5('0xd')]('The\x20User\x20ID\x20is:',_0x4cf75f['id']);return getEndUser(_0x397ac7,_0x28b4a2['calleridname'],_0x28b4a2[_0xd3d5('0x5f')],_0x4b75ef);})[_0xd3d5('0x5d')](function(_0xe42af1){_0x35382b=_0xe42af1;logger[_0xd3d5('0xd')](_0xd3d5('0x6c'),_0x35382b['id']);return getTicket(_0x397ac7,_0x4cf75f,_0x35382b,_0x372e24,_0x28b4a2,_0x372e24[_0xd3d5('0x60')],_0x4b75ef,'Inbound');})[_0xd3d5('0x5d')](function(_0xcb7aa7){_0x5d2b4e=_0xcb7aa7;logger[_0xd3d5('0xd')]('Ticket\x20created!');logger[_0xd3d5('0xd')](_0xd3d5('0x6d'),_0x5d2b4e['id']);return setRelationship(_0x4b75ef,_0x4cf75f,_0x5d2b4e,_0xd3d5('0x6e'));})[_0xd3d5('0x5d')](function(){return setRelationship(_0x4b75ef,_0x35382b,_0x5d2b4e,_0xd3d5('0x63'));})[_0xd3d5('0x5d')](function(){return getServerInfo(_0x4b75ef);})[_0xd3d5('0x72')](function(_0x4bae3e){logger[_0xd3d5('0x73')]('['+_0x28b4a2[_0xd3d5('0x76')]['toUpperCase']()+']',JSON['stringify'](_0x4bae3e));});}; \ 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 f53b85c..0e110f1 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 _0x1e69=['keyType','key','format','%s:\x20%s','keyContent','join','substring','lastIndexOf','validateEmail','isNil','test','toLowerCase','lodash','util','getString','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e69,0xa2));var _0x91e6=function(_0x58f9a8,_0x46cc13){_0x58f9a8=_0x58f9a8-0x0;var _0x551362=_0x1e69[_0x58f9a8];return _0x551362;};'use strict';var _=require(_0x91e6('0x0'));var util=require(_0x91e6('0x1'));exports[_0x91e6('0x2')]=function(_0x599f97,_0x4f2ef8,_0x2d6096){var _0x2c695d=[];if(_0x599f97['length']>0x0){var _0x3ccca5=_[_0x91e6('0x3')](_0x599f97,['id']);for(var _0x18881f=0x0;_0x18881f<_0x3ccca5['length'];_0x18881f++){var _0x5a2ffd=_0x3ccca5[_0x18881f];if(_0x5a2ffd[_0x91e6('0x4')]===_0x91e6('0x5')){_0x2c695d[_0x91e6('0x6')](_0x5a2ffd[_0x91e6('0x7')]);}else if(_0x5a2ffd['type']===_0x91e6('0x8')&&_0x5a2ffd['variableName']){_0x4f2ef8[_0x5a2ffd[_0x91e6('0x9')]]&&_0x2c695d[_0x91e6('0x6')](_0x4f2ef8[_0x5a2ffd[_0x91e6('0x9')]]['toString']());}else if(_0x5a2ffd[_0x91e6('0x4')]===_0x91e6('0xa')&&_0x5a2ffd['Variable']&&_0x5a2ffd[_0x91e6('0xb')][_0x91e6('0xc')]){_0x4f2ef8[_0x5a2ffd['Variable'][_0x91e6('0xc')]['toLowerCase']()]&&_0x2c695d[_0x91e6('0x6')](_0x4f2ef8[_0x5a2ffd[_0x91e6('0xb')][_0x91e6('0xc')]['toLowerCase']()]['toString']());}else if(_0x5a2ffd[_0x91e6('0x4')]==='keyValue'){if(_0x5a2ffd[_0x91e6('0xd')]===_0x91e6('0x5')&&_0x5a2ffd[_0x91e6('0xe')]){_0x2c695d[_0x91e6('0x6')](util[_0x91e6('0xf')](_0x91e6('0x10'),_0x5a2ffd['key'],_0x5a2ffd[_0x91e6('0x11')]));}else if(_0x5a2ffd['keyType']===_0x91e6('0x8')&&_0x5a2ffd['variableName']&&_0x5a2ffd[_0x91e6('0xe')]){_0x4f2ef8[_0x5a2ffd['variableName']]&&_0x2c695d['push'](util[_0x91e6('0xf')](_0x91e6('0x10'),_0x5a2ffd[_0x91e6('0xe')],_0x4f2ef8[_0x5a2ffd[_0x91e6('0x9')]]));}else if(_0x5a2ffd['keyType']==='customVariable'&&_0x5a2ffd[_0x91e6('0xb')]&&_0x5a2ffd[_0x91e6('0xb')][_0x91e6('0xc')]&&_0x5a2ffd[_0x91e6('0xe')]){_0x4f2ef8[_0x5a2ffd['Variable']['name']['toLowerCase']()]&&_0x2c695d[_0x91e6('0x6')](util['format'](_0x91e6('0x10'),_0x5a2ffd['key'],_0x4f2ef8[_0x5a2ffd[_0x91e6('0xb')][_0x91e6('0xc')]['toLowerCase']()]));}}}}return _0x2c695d[_0x91e6('0x12')](_0x2d6096);};exports['stripTrailingSlash']=function(_0x1fc7f6){var _0x9ac12e=_0x1fc7f6['slice'](-0x1);if(_0x9ac12e==='/'){_0x1fc7f6=_0x1fc7f6[_0x91e6('0x13')](0x0,_0x1fc7f6[_0x91e6('0x14')](_0x9ac12e));}return _0x1fc7f6;};exports[_0x91e6('0x15')]=function(_0x5bb9a2){if(!_[_0x91e6('0x16')](_0x5bb9a2)&&_0x5bb9a2!==''){var _0x4b247a=/^(([^<>()\[\]\\.,;:\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 _0x4b247a[_0x91e6('0x17')](String(_0x5bb9a2)[_0x91e6('0x18')]());}else{return![];}}; \ No newline at end of file +var _0x275c=['substring','lastIndexOf','validateEmail','isNil','getString','length','type','string','push','content','variableName','toString','Variable','name','toLowerCase','keyType','key','keyContent','variable','format','%s:\x20%s','stripTrailingSlash','slice'];(function(_0x4fbdd4,_0x2cb875){var _0x304005=function(_0x59d66d){while(--_0x59d66d){_0x4fbdd4['push'](_0x4fbdd4['shift']());}};_0x304005(++_0x2cb875);}(_0x275c,0x77));var _0xc275=function(_0x1520a7,_0x1b6404){_0x1520a7=_0x1520a7-0x0;var _0x41572b=_0x275c[_0x1520a7];return _0x41572b;};'use strict';var _=require('lodash');var util=require('util');exports[_0xc275('0x0')]=function(_0x290028,_0x3c2e9f,_0xc5fb35){var _0x3aefdd=[];if(_0x290028['length']>0x0){var _0x4bce02=_['sortBy'](_0x290028,['id']);for(var _0xc51703=0x0;_0xc51703<_0x4bce02[_0xc275('0x1')];_0xc51703++){var _0x5b1b16=_0x4bce02[_0xc51703];if(_0x5b1b16[_0xc275('0x2')]===_0xc275('0x3')){_0x3aefdd[_0xc275('0x4')](_0x5b1b16[_0xc275('0x5')]);}else if(_0x5b1b16[_0xc275('0x2')]==='variable'&&_0x5b1b16['variableName']){_0x3c2e9f[_0x5b1b16['variableName']]&&_0x3aefdd[_0xc275('0x4')](_0x3c2e9f[_0x5b1b16[_0xc275('0x6')]][_0xc275('0x7')]());}else if(_0x5b1b16[_0xc275('0x2')]==='customVariable'&&_0x5b1b16[_0xc275('0x8')]&&_0x5b1b16[_0xc275('0x8')][_0xc275('0x9')]){_0x3c2e9f[_0x5b1b16[_0xc275('0x8')][_0xc275('0x9')][_0xc275('0xa')]()]&&_0x3aefdd[_0xc275('0x4')](_0x3c2e9f[_0x5b1b16['Variable'][_0xc275('0x9')][_0xc275('0xa')]()]['toString']());}else if(_0x5b1b16[_0xc275('0x2')]==='keyValue'){if(_0x5b1b16[_0xc275('0xb')]==='string'&&_0x5b1b16[_0xc275('0xc')]){_0x3aefdd['push'](util['format']('%s:\x20%s',_0x5b1b16[_0xc275('0xc')],_0x5b1b16[_0xc275('0xd')]));}else if(_0x5b1b16[_0xc275('0xb')]===_0xc275('0xe')&&_0x5b1b16['variableName']&&_0x5b1b16[_0xc275('0xc')]){_0x3c2e9f[_0x5b1b16[_0xc275('0x6')]]&&_0x3aefdd[_0xc275('0x4')](util[_0xc275('0xf')](_0xc275('0x10'),_0x5b1b16[_0xc275('0xc')],_0x3c2e9f[_0x5b1b16[_0xc275('0x6')]]));}else if(_0x5b1b16[_0xc275('0xb')]==='customVariable'&&_0x5b1b16['Variable']&&_0x5b1b16['Variable'][_0xc275('0x9')]&&_0x5b1b16[_0xc275('0xc')]){_0x3c2e9f[_0x5b1b16[_0xc275('0x8')]['name'][_0xc275('0xa')]()]&&_0x3aefdd[_0xc275('0x4')](util[_0xc275('0xf')](_0xc275('0x10'),_0x5b1b16[_0xc275('0xc')],_0x3c2e9f[_0x5b1b16[_0xc275('0x8')][_0xc275('0x9')][_0xc275('0xa')]()]));}}}}return _0x3aefdd['join'](_0xc5fb35);};exports[_0xc275('0x11')]=function(_0x5a9530){var _0x4d0a7c=_0x5a9530[_0xc275('0x12')](-0x1);if(_0x4d0a7c==='/'){_0x5a9530=_0x5a9530[_0xc275('0x13')](0x0,_0x5a9530[_0xc275('0x14')](_0x4d0a7c));}return _0x5a9530;};exports[_0xc275('0x15')]=function(_0x498dc7){if(!_[_0xc275('0x16')](_0x498dc7)&&_0x498dc7!==''){var _0x31a44c=/^(([^<>()\[\]\\.,;:\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 _0x31a44c['test'](String(_0x498dc7)[_0xc275('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 2b9ce64..845e982 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 _0xea3b=['Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','toString','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','stringify','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','info','first_name','last_name','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','getEndUser','accessKey','getchallenge','login','token'];(function(_0x271321,_0x44762d){var _0x1427b6=function(_0x22f218){while(--_0x22f218){_0x271321['push'](_0x271321['shift']());}};_0x1427b6(++_0x44762d);}(_0xea3b,0xe4));var _0xbea3=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0xea3b[_0x1b8bda];return _0x1f7050;};'use strict';var _=require(_0xbea3('0x0'));var rp=require(_0xbea3('0x1'));var BPromise=require(_0xbea3('0x2'));var md5=require(_0xbea3('0x3'));var util=require('util');var Redis=require(_0xbea3('0x4'));var intUtil=require(_0xbea3('0x5'));var config=require(_0xbea3('0x6'));var logger=require('../../../../config/logger')('vTiger');config[_0xbea3('0x7')]=_['defaults'](config['redis'],{'host':_0xbea3('0x8'),'port':0x18eb});var io=require(_0xbea3('0x9'))(new Redis(config[_0xbea3('0x7')]));function emit(_0x41d395,_0x4fa401,_0x2f06d1){io['to'](_0x41d395)[_0xbea3('0xa')](_0x4fa401,_0x2f06d1);}function getCustomFields(_0x50e6b9,_0x47ae77){var _0xf97cc0={};if(_0x50e6b9[_0xbea3('0xb')]>0x0){_[_0xbea3('0xc')](_0x50e6b9,function(_0x5a9552){if(_0x5a9552[_0xbea3('0xd')]===_0xbea3('0xe')&&_0x5a9552[_0xbea3('0xf')]){_0xf97cc0[_0x5a9552[_0xbea3('0xf')]]=_0x5a9552['content'][_0xbea3('0x10')]();}else if(_0x5a9552[_0xbea3('0xd')]==='variable'&&_0x5a9552[_0xbea3('0x11')]&&_0x5a9552[_0xbea3('0xf')]&&_0x47ae77[_0x5a9552[_0xbea3('0x11')]]){_0xf97cc0[_0x5a9552[_0xbea3('0xf')]]=_0x47ae77[_0x5a9552['variableName']][_0xbea3('0x10')]();}else if(_0x5a9552[_0xbea3('0xd')]===_0xbea3('0x12')&&_0x5a9552[_0xbea3('0x13')]&&_0x5a9552[_0xbea3('0x13')][_0xbea3('0x14')]&&_0x5a9552[_0xbea3('0xf')]&&_0x47ae77[_0x5a9552[_0xbea3('0x13')][_0xbea3('0x14')][_0xbea3('0x15')]()]){_0xf97cc0[_0x5a9552[_0xbea3('0xf')]]=_0x47ae77[_0x5a9552['Variable'][_0xbea3('0x14')][_0xbea3('0x15')]()]['toString']();}});}return _0xf97cc0;}function createTicket(_0x2853b0,_0x5574e8,_0x218ac2,_0x1d4778,_0x513cd8,_0x5dc4c4,_0x5837c9){logger['info'](_0xbea3('0x16'));var _0x116215=_[_0xbea3('0x17')]({'parent_id':'','assigned_user_id':_0x5574e8['id'],'ticketpriorities':_0xbea3('0x18'),'ticketstatus':_0xbea3('0x19'),'ticket_title':intUtil[_0xbea3('0x1a')](_0x1d4778[_0xbea3('0x1b')],_0x513cd8,'\x20'),'description':intUtil['getString'](_0x1d4778['Descriptions'],_0x513cd8,'\x0a'),'contact_id':_0x218ac2['id']},getCustomFields(_0x5dc4c4,_0x513cd8));var _0x5ad24b={'method':_0xbea3('0x1c'),'uri':util[_0xbea3('0x1d')](_0xbea3('0x1e'),_0x2853b0[_0xbea3('0x1f')]),'form':{'operation':_0xbea3('0x20'),'username':_0x2853b0[_0xbea3('0x21')],'sessionName':_0x5837c9[_0xbea3('0x22')],'elementType':_0xbea3('0x23'),'element':JSON['stringify'](_0x116215)},'json':!![]};return request(_0x5ad24b)[_0xbea3('0x24')](function(_0x34af95){if(_0x34af95[_0xbea3('0x25')]){return BPromise[_0xbea3('0x26')]({'id':_0x34af95[_0xbea3('0x27')]['id']});}else{throw new Error(util[_0xbea3('0x1d')](_0xbea3('0x28'),JSON['stringify'](_0x34af95[_0xbea3('0x29')])));}})[_0xbea3('0x2a')](function(_0x4c5e54){var _0x281c49=_0x4c5e54[_0xbea3('0x2b')]||0x1f4;logger['error'](_0xbea3('0x2c'),_0xbea3('0x2d'),_0x281c49,JSON[_0xbea3('0x2e')](_0x4c5e54));});}function getUser(_0x2440e0,_0x52f501,_0x18f7a0){if(intUtil['validateEmail'](_0x52f501)){logger['info'](_0xbea3('0x2f'),_0x52f501);return request({'method':_0xbea3('0x30'),'uri':util[_0xbea3('0x1d')](_0xbea3('0x1e'),_0x2440e0['remoteUri']),'qs':{'operation':_0xbea3('0x31'),'username':_0x2440e0[_0xbea3('0x21')],'sessionName':_0x18f7a0[_0xbea3('0x22')],'query':util[_0xbea3('0x1d')](_0xbea3('0x32'),_0x52f501)},'json':!![]})['then'](function(_0x1ad94a){if(_0x1ad94a[_0xbea3('0x25')]&&_0x1ad94a[_0xbea3('0x27')]['length']){logger[_0xbea3('0x33')]('Agent\x20found!');return BPromise['resolve']({'id':_0x1ad94a[_0xbea3('0x27')][0x0]['id'],'email':_0x1ad94a[_0xbea3('0x27')][0x0]['email1'],'name':_0x1ad94a[_0xbea3('0x27')][0x0][_0xbea3('0x34')]+'\x20'+_0x1ad94a[_0xbea3('0x27')][_0xbea3('0x35')]});}else{logger[_0xbea3('0x33')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbea3('0x26')]({'id':_0x18f7a0[_0xbea3('0x36')],'email':_0x2440e0['username'],'name':_0xbea3('0x37')});}})[_0xbea3('0x2a')](function(_0x4f2d8c){var _0x5b7f1f=_0x4f2d8c['statusCode']||0x1f4;logger[_0xbea3('0x29')](_0xbea3('0x2c'),'getUser',_0x5b7f1f,JSON['stringify'](_0x4f2d8c));});}else{logger[_0xbea3('0x33')](_0xbea3('0x38'));return BPromise['resolve']({'id':_0x18f7a0['userId'],'email':_0x2440e0[_0xbea3('0x21')],'name':_0xbea3('0x37')})[_0xbea3('0x2a')](function(_0x2b7ef4){var _0x5545f0=_0x2b7ef4[_0xbea3('0x2b')]||0x1f4;logger[_0xbea3('0x29')](_0xbea3('0x2c'),_0xbea3('0x39'),_0x5545f0,JSON[_0xbea3('0x2e')](_0x2b7ef4));});}}function getEndUser(_0x5ebedd,_0xbcf079,_0x5f0deb,_0x33d871){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x5f0deb);return request({'method':_0xbea3('0x30'),'uri':util[_0xbea3('0x1d')](_0xbea3('0x1e'),_0x5ebedd[_0xbea3('0x1f')]),'qs':{'operation':_0xbea3('0x31'),'username':_0x5ebedd['username'],'sessionName':_0x33d871[_0xbea3('0x22')],'query':util[_0xbea3('0x1d')]('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;',_0x5f0deb,_0x5f0deb,_0x5f0deb,_0x5f0deb,_0x5f0deb)},'json':!![]})['then'](function(_0x303798){if(_0x303798[_0xbea3('0x25')]&&_0x303798[_0xbea3('0x27')][_0xbea3('0xb')]){logger['info']('Enduser\x20found!');return BPromise[_0xbea3('0x26')]({'id':_0x303798[_0xbea3('0x27')][0x0]['id'],'name':_0x303798[_0xbea3('0x27')][0x0][_0xbea3('0x3a')]+'\x20'+_0x303798['result'][0x0][_0xbea3('0x3b')],'phone':_0x5f0deb});}else{logger[_0xbea3('0x33')](_0xbea3('0x3c'));return request({'method':_0xbea3('0x1c'),'uri':util[_0xbea3('0x1d')](_0xbea3('0x1e'),_0x5ebedd[_0xbea3('0x1f')]),'form':{'operation':_0xbea3('0x20'),'sessionName':_0x33d871['sessionName'],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0xbcf079,'phone':_0x5f0deb,'assigned_user_id':'\x20'})},'json':!![]})[_0xbea3('0x24')](function(_0x2c3c0d){logger['info']('Enduser\x20created.');return BPromise[_0xbea3('0x26')]({'id':_0x2c3c0d[_0xbea3('0x27')]['id'],'name':_0x2c3c0d['result']['lastname'],'phone':_0x2c3c0d['result']['phone']});})[_0xbea3('0x2a')](function(_0x40bd10){var _0x2d82d2=_0x40bd10[_0xbea3('0x2b')]||0x1f4;logger['error'](_0xbea3('0x2c'),_0xbea3('0x3d'),_0x2d82d2,JSON['stringify'](_0x40bd10));});}});}function getConnection(_0x523853){var _0x581edd=_0x523853[_0xbea3('0x21')];var _0x1bf5f0=_0x523853[_0xbea3('0x3e')];return request({'method':_0xbea3('0x30'),'uri':util[_0xbea3('0x1d')](_0xbea3('0x1e'),_0x523853[_0xbea3('0x1f')]),'qs':{'operation':_0xbea3('0x3f'),'username':_0x581edd},'json':!![]})[_0xbea3('0x24')](function(_0x29d1a2){if(_0x29d1a2[_0xbea3('0x25')]){return request({'method':_0xbea3('0x1c'),'uri':util['format'](_0xbea3('0x1e'),_0x523853[_0xbea3('0x1f')]),'form':{'operation':_0xbea3('0x40'),'username':_0x581edd,'accessKey':md5(_0x29d1a2[_0xbea3('0x27')][_0xbea3('0x41')]+_0x1bf5f0)},'json':!![]});}})[_0xbea3('0x24')](function(_0x2bf837){if(_0x2bf837[_0xbea3('0x25')]){return BPromise[_0xbea3('0x26')](_0x2bf837[_0xbea3('0x27')]);}else{throw new Error(util['format'](_0xbea3('0x42'),_0x523853['id']));}})[_0xbea3('0x2a')](function(_0x48a52b){var _0x4b21f0=_0x48a52b[_0xbea3('0x2b')]||0x1f4;logger[_0xbea3('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xbea3('0x43'),_0x4b21f0,JSON['stringify'](_0x48a52b));});}function request(_0x5259a4){logger['info'](_0xbea3('0x44'),JSON['stringify'](_0x5259a4));return rp(_0x5259a4);}exports[_0xbea3('0x45')]=function(_0x599912,_0x24a37a,_0x3cbb67,_0x1349d8,_0x483a69,_0x117c9c){var _0x2f0575,_0x16cd25,_0x13059e,_0x5cc2f6;_0x117c9c['remoteUri']=intUtil[_0xbea3('0x46')](_0x117c9c[_0xbea3('0x1f')]);if(_0x483a69&&_0x483a69[_0xbea3('0x47')]){logger['info'](_0xbea3('0x48'),_0xbea3('0x49'));_0x24a37a['recordingURL']=util['format'](_0xbea3('0x4a'),_0x117c9c['serverUrl'],_0x24a37a['uniqueid'],md5(_0x24a37a[_0xbea3('0x4b')]));}else{_0x24a37a[_0xbea3('0x4c')]='';}return getConnection(_0x117c9c)['then'](function(_0xd84a8){_0x5cc2f6=_0xd84a8;return getUser(_0x117c9c,_0x1349d8[_0xbea3('0x4d')],_0x5cc2f6);})[_0xbea3('0x24')](function(_0x162899){_0x2f0575=_0x162899;logger[_0xbea3('0x33')](_0xbea3('0x4e'),_0x2f0575['id']);return getEndUser(_0x117c9c,_0x24a37a[_0xbea3('0x4f')],_0x24a37a[_0xbea3('0x50')],_0x5cc2f6);})[_0xbea3('0x24')](function(_0x311a43){_0x16cd25=_0x311a43;logger['info'](_0xbea3('0x51'),_0x16cd25['id']);return createTicket(_0x117c9c,_0x2f0575,_0x16cd25,_0x3cbb67,_0x24a37a,_0x3cbb67[_0xbea3('0x52')],_0x5cc2f6);})[_0xbea3('0x24')](function(_0x21eec8){_0x13059e=_0x21eec8;logger[_0xbea3('0x33')](_0xbea3('0x53'));logger[_0xbea3('0x33')](_0xbea3('0x54'),_0x13059e['id']);var _0x282d30=util[_0xbea3('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x117c9c[_0xbea3('0x1f')],_[_0xbea3('0x55')](_0x13059e['id'],'x')[0x1]);logger[_0xbea3('0x33')](_0xbea3('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1349d8['name']),_0xbea3('0x56'),{'uri':_0x282d30});})[_0xbea3('0x2a')](function(_0xbaf913){logger[_0xbea3('0x29')](_0xbea3('0x48'),JSON['stringify'](_0xbaf913));});};exports[_0xbea3('0x57')]=function(_0x5b3ce1,_0x57330c,_0x3054b4,_0x37fd3a,_0x335155,_0x342b3f,_0x27b957){var _0x205b01,_0x18c834,_0x5126b9,_0x57b68e;_0x342b3f[_0xbea3('0x1f')]=intUtil[_0xbea3('0x46')](_0x342b3f['remoteUri']);_0x342b3f[_0xbea3('0x58')]=intUtil[_0xbea3('0x46')](_0x342b3f['serverUrl']);if(_0x27b957&&_0x27b957[_0xbea3('0x59')]&&_0x27b957[_0xbea3('0x59')]!==_0xbea3('0x5a')){logger[_0xbea3('0x33')](_0xbea3('0x5b'),_0xbea3('0x49'));_0x57330c[_0xbea3('0x4c')]=util[_0xbea3('0x1d')](_0xbea3('0x4a'),_0x342b3f[_0xbea3('0x58')],_0x57330c[_0xbea3('0x4b')],md5(_0x57330c['uniqueid']));}return getConnection(_0x342b3f)[_0xbea3('0x24')](function(_0x2d29f9){_0x57b68e=_0x2d29f9;return getUser(_0x342b3f,_0x37fd3a['email'],_0x57b68e);})[_0xbea3('0x24')](function(_0x14357c){_0x205b01=_0x14357c;logger[_0xbea3('0x33')](_0xbea3('0x4e'),_0x205b01['id']);return getEndUser(_0x342b3f,_0x57330c[_0xbea3('0x5c')],_0x57330c[_0xbea3('0x5d')],_0x57b68e);})[_0xbea3('0x24')](function(_0x18a6ac){_0x18c834=_0x18a6ac;logger[_0xbea3('0x33')](_0xbea3('0x51'),_0x18c834['id']);return createTicket(_0x342b3f,_0x205b01,_0x18c834,_0x3054b4,_0x57330c,_0x3054b4[_0xbea3('0x52')],_0x57b68e);})[_0xbea3('0x24')](function(_0xade515){_0x5126b9=_0xade515;logger[_0xbea3('0x33')](_0xbea3('0x53'));logger[_0xbea3('0x33')](_0xbea3('0x54'),_0x5126b9['id']);var _0x392e13=util[_0xbea3('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x342b3f['remoteUri'],_[_0xbea3('0x55')](_0x5126b9['id'],'x')[0x1]);logger[_0xbea3('0x33')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbea3('0x1d')](_0xbea3('0x5e'),_0x37fd3a[_0xbea3('0x14')]),_0xbea3('0x56'),{'uri':_0x392e13});})[_0xbea3('0x2a')](function(_0x528889){logger[_0xbea3('0x29')]('[OUTBOUND]',JSON[_0xbea3('0x2e')](_0x528889));});};exports[_0xbea3('0x5f')]=function(_0x42f76f,_0x3fde79,_0x4e74ed,_0x4bc24a,_0x50da4b,_0x3a00d0){var _0x2b1594,_0x46e6e6,_0x4ba3d4,_0x226272;_0x3a00d0[_0xbea3('0x1f')]=intUtil[_0xbea3('0x46')](_0x3a00d0[_0xbea3('0x1f')]);_0x3a00d0['serverUrl']=intUtil[_0xbea3('0x46')](_0x3a00d0['serverUrl']);if(_0x50da4b&&_0x50da4b[_0xbea3('0x47')]){logger['info']('['+_0x3fde79[_0xbea3('0x60')][_0xbea3('0x61')]()+']',_0xbea3('0x49'));_0x3fde79['recordingURL']=util[_0xbea3('0x1d')](_0xbea3('0x4a'),_0x3a00d0['serverUrl'],_0x3fde79[_0xbea3('0x4b')],md5(_0x3fde79['uniqueid']));}else{_0x3fde79['recordingURL']='';}return getConnection(_0x3a00d0)['then'](function(_0x499e53){_0x226272=_0x499e53;return getUser(_0x3a00d0,'',_0x226272);})[_0xbea3('0x24')](function(_0x8367a9){_0x2b1594=_0x8367a9;logger[_0xbea3('0x33')]('The\x20User\x20ID\x20is:',_0x2b1594['id']);return getEndUser(_0x3a00d0,_0x3fde79[_0xbea3('0x4f')],_0x3fde79['calleridnum'],_0x226272);})[_0xbea3('0x24')](function(_0x4550db){_0x46e6e6=_0x4550db;logger[_0xbea3('0x33')](_0xbea3('0x51'),_0x46e6e6['id']);return createTicket(_0x3a00d0,_0x2b1594,_0x46e6e6,_0x4e74ed,_0x3fde79,_0x4e74ed[_0xbea3('0x52')],_0x226272);})[_0xbea3('0x24')](function(_0x4382ac){_0x4ba3d4=_0x4382ac;logger[_0xbea3('0x33')](_0xbea3('0x53'));logger[_0xbea3('0x33')](_0xbea3('0x54'),_0x4ba3d4['id']);})[_0xbea3('0x2a')](function(_0x5953c9){logger[_0xbea3('0x29')]('['+_0x3fde79[_0xbea3('0x60')][_0xbea3('0x61')]()+']',JSON['stringify'](_0x5953c9));});}; \ No newline at end of file +var _0x94f1=['email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','defaults','redis','localhost','emit','length','forEach','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','Open','getString','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','then','success','resolve','result','stringify','catch','statusCode','error','Getting\x20agent\x20with\x20email','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','info','GET','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!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid'];(function(_0x45064a,_0xd82c7f){var _0x270006=function(_0x19e492){while(--_0x19e492){_0x45064a['push'](_0x45064a['shift']());}};_0x270006(++_0xd82c7f);}(_0x94f1,0x1f3));var _0x194f=function(_0x44b8c6,_0x5ac4cb){_0x44b8c6=_0x44b8c6-0x0;var _0x258815=_0x94f1[_0x44b8c6];return _0x258815;};'use strict';var _=require(_0x194f('0x0'));var rp=require(_0x194f('0x1'));var BPromise=require(_0x194f('0x2'));var md5=require(_0x194f('0x3'));var util=require(_0x194f('0x4'));var Redis=require(_0x194f('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x194f('0x6'))('vTiger');config['redis']=_[_0x194f('0x7')](config[_0x194f('0x8')],{'host':_0x194f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4ee04c,_0x3a1c00,_0x442f34){io['to'](_0x4ee04c)[_0x194f('0xa')](_0x3a1c00,_0x442f34);}function getCustomFields(_0x2b134f,_0x3cccc1){var _0x126498={};if(_0x2b134f[_0x194f('0xb')]>0x0){_[_0x194f('0xc')](_0x2b134f,function(_0x338f5d){if(_0x338f5d['type']==='string'&&_0x338f5d['idField']){_0x126498[_0x338f5d[_0x194f('0xd')]]=_0x338f5d['content'][_0x194f('0xe')]();}else if(_0x338f5d[_0x194f('0xf')]===_0x194f('0x10')&&_0x338f5d[_0x194f('0x11')]&&_0x338f5d[_0x194f('0xd')]&&_0x3cccc1[_0x338f5d[_0x194f('0x11')]]){_0x126498[_0x338f5d[_0x194f('0xd')]]=_0x3cccc1[_0x338f5d[_0x194f('0x11')]]['toString']();}else if(_0x338f5d[_0x194f('0xf')]===_0x194f('0x12')&&_0x338f5d[_0x194f('0x13')]&&_0x338f5d[_0x194f('0x13')][_0x194f('0x14')]&&_0x338f5d[_0x194f('0xd')]&&_0x3cccc1[_0x338f5d[_0x194f('0x13')][_0x194f('0x14')][_0x194f('0x15')]()]){_0x126498[_0x338f5d['idField']]=_0x3cccc1[_0x338f5d[_0x194f('0x13')]['name'][_0x194f('0x15')]()][_0x194f('0xe')]();}});}return _0x126498;}function createTicket(_0x5880dd,_0x44acfa,_0x1f7f9c,_0x237ffe,_0x22a9d5,_0x41e889,_0x3b587c){logger['info'](_0x194f('0x16'));var _0x5ea046=_[_0x194f('0x17')]({'parent_id':'','assigned_user_id':_0x44acfa['id'],'ticketpriorities':_0x194f('0x18'),'ticketstatus':_0x194f('0x19'),'ticket_title':intUtil[_0x194f('0x1a')](_0x237ffe['Subjects'],_0x22a9d5,'\x20'),'description':intUtil['getString'](_0x237ffe['Descriptions'],_0x22a9d5,'\x0a'),'contact_id':_0x1f7f9c['id']},getCustomFields(_0x41e889,_0x22a9d5));var _0x153cc1={'method':_0x194f('0x1b'),'uri':util[_0x194f('0x1c')](_0x194f('0x1d'),_0x5880dd['remoteUri']),'form':{'operation':_0x194f('0x1e'),'username':_0x5880dd[_0x194f('0x1f')],'sessionName':_0x3b587c[_0x194f('0x20')],'elementType':_0x194f('0x21'),'element':JSON['stringify'](_0x5ea046)},'json':!![]};return request(_0x153cc1)[_0x194f('0x22')](function(_0x1cf159){if(_0x1cf159[_0x194f('0x23')]){return BPromise[_0x194f('0x24')]({'id':_0x1cf159[_0x194f('0x25')]['id']});}else{throw new Error(util[_0x194f('0x1c')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x194f('0x26')](_0x1cf159['error'])));}})[_0x194f('0x27')](function(_0x9e83ff){var _0x1ab17c=_0x9e83ff[_0x194f('0x28')]||0x1f4;logger[_0x194f('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x1ab17c,JSON['stringify'](_0x9e83ff));});}function getUser(_0x4065e0,_0x5114d1,_0x4ac06e){if(intUtil['validateEmail'](_0x5114d1)){logger['info'](_0x194f('0x2a'),_0x5114d1);return request({'method':'GET','uri':util[_0x194f('0x1c')](_0x194f('0x1d'),_0x4065e0['remoteUri']),'qs':{'operation':'query','username':_0x4065e0[_0x194f('0x1f')],'sessionName':_0x4ac06e[_0x194f('0x20')],'query':util['format'](_0x194f('0x2b'),_0x5114d1)},'json':!![]})['then'](function(_0x4490c2){if(_0x4490c2[_0x194f('0x23')]&&_0x4490c2[_0x194f('0x25')][_0x194f('0xb')]){logger['info']('Agent\x20found!');return BPromise[_0x194f('0x24')]({'id':_0x4490c2[_0x194f('0x25')][0x0]['id'],'email':_0x4490c2[_0x194f('0x25')][0x0][_0x194f('0x2c')],'name':_0x4490c2[_0x194f('0x25')][0x0][_0x194f('0x2d')]+'\x20'+_0x4490c2[_0x194f('0x25')][_0x194f('0x2e')]});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x194f('0x24')]({'id':_0x4ac06e[_0x194f('0x2f')],'email':_0x4065e0['username'],'name':_0x194f('0x30')});}})[_0x194f('0x27')](function(_0x10480b){var _0x2f5641=_0x10480b['statusCode']||0x1f4;logger[_0x194f('0x29')](_0x194f('0x31'),_0x194f('0x32'),_0x2f5641,JSON[_0x194f('0x26')](_0x10480b));});}else{logger['info'](_0x194f('0x33'));return BPromise[_0x194f('0x24')]({'id':_0x4ac06e[_0x194f('0x2f')],'email':_0x4065e0[_0x194f('0x1f')],'name':_0x194f('0x30')})['catch'](function(_0x37f952){var _0xba1c05=_0x37f952['statusCode']||0x1f4;logger['error'](_0x194f('0x31'),'getUser',_0xba1c05,JSON[_0x194f('0x26')](_0x37f952));});}}function getEndUser(_0x82407a,_0x42a21a,_0x4c6f20,_0x3f7801){logger[_0x194f('0x34')]('Searching\x20end\x20user\x20with\x20phone',_0x4c6f20);return request({'method':_0x194f('0x35'),'uri':util[_0x194f('0x1c')](_0x194f('0x1d'),_0x82407a[_0x194f('0x36')]),'qs':{'operation':'query','username':_0x82407a[_0x194f('0x1f')],'sessionName':_0x3f7801[_0x194f('0x20')],'query':util[_0x194f('0x1c')](_0x194f('0x37'),_0x4c6f20,_0x4c6f20,_0x4c6f20,_0x4c6f20,_0x4c6f20)},'json':!![]})[_0x194f('0x22')](function(_0x5f4675){if(_0x5f4675[_0x194f('0x23')]&&_0x5f4675['result'][_0x194f('0xb')]){logger[_0x194f('0x34')](_0x194f('0x38'));return BPromise[_0x194f('0x24')]({'id':_0x5f4675[_0x194f('0x25')][0x0]['id'],'name':_0x5f4675[_0x194f('0x25')][0x0]['firstname']+'\x20'+_0x5f4675[_0x194f('0x25')][0x0][_0x194f('0x39')],'phone':_0x4c6f20});}else{logger[_0x194f('0x34')](_0x194f('0x3a'));return request({'method':_0x194f('0x1b'),'uri':util[_0x194f('0x1c')](_0x194f('0x1d'),_0x82407a[_0x194f('0x36')]),'form':{'operation':'create','sessionName':_0x3f7801[_0x194f('0x20')],'elementType':_0x194f('0x3b'),'element':JSON[_0x194f('0x26')]({'lastname':_0x42a21a,'phone':_0x4c6f20,'assigned_user_id':'\x20'})},'json':!![]})[_0x194f('0x22')](function(_0x281a7f){logger[_0x194f('0x34')](_0x194f('0x3c'));return BPromise[_0x194f('0x24')]({'id':_0x281a7f[_0x194f('0x25')]['id'],'name':_0x281a7f[_0x194f('0x25')][_0x194f('0x39')],'phone':_0x281a7f[_0x194f('0x25')]['phone']});})[_0x194f('0x27')](function(_0x28d925){var _0x461f73=_0x28d925['statusCode']||0x1f4;logger[_0x194f('0x29')](_0x194f('0x31'),_0x194f('0x3d'),_0x461f73,JSON[_0x194f('0x26')](_0x28d925));});}});}function getConnection(_0x2b5058){var _0x42fe61=_0x2b5058[_0x194f('0x1f')];var _0x1ce26a=_0x2b5058[_0x194f('0x3e')];return request({'method':_0x194f('0x35'),'uri':util[_0x194f('0x1c')](_0x194f('0x1d'),_0x2b5058[_0x194f('0x36')]),'qs':{'operation':_0x194f('0x3f'),'username':_0x42fe61},'json':!![]})['then'](function(_0x2b9f54){if(_0x2b9f54['success']){return request({'method':_0x194f('0x1b'),'uri':util[_0x194f('0x1c')](_0x194f('0x1d'),_0x2b5058[_0x194f('0x36')]),'form':{'operation':_0x194f('0x40'),'username':_0x42fe61,'accessKey':md5(_0x2b9f54[_0x194f('0x25')]['token']+_0x1ce26a)},'json':!![]});}})['then'](function(_0x51cb05){if(_0x51cb05[_0x194f('0x23')]){return BPromise['resolve'](_0x51cb05[_0x194f('0x25')]);}else{throw new Error(util[_0x194f('0x1c')](_0x194f('0x41'),_0x2b5058['id']));}})[_0x194f('0x27')](function(_0x35bb0e){var _0x35a44a=_0x35bb0e[_0x194f('0x28')]||0x1f4;logger['error'](_0x194f('0x31'),_0x194f('0x42'),_0x35a44a,JSON[_0x194f('0x26')](_0x35bb0e));});}function request(_0x3bdbdc){logger[_0x194f('0x34')](_0x194f('0x43'),JSON[_0x194f('0x26')](_0x3bdbdc));return rp(_0x3bdbdc);}exports[_0x194f('0x44')]=function(_0x505103,_0x844975,_0x360e86,_0x129978,_0x5b04bb,_0x5289ca){var _0x3f2a19,_0x3ac549,_0x1a06bb,_0x1ecf81;_0x5289ca[_0x194f('0x36')]=intUtil[_0x194f('0x45')](_0x5289ca[_0x194f('0x36')]);if(_0x5b04bb&&_0x5b04bb[_0x194f('0x46')]){logger['info'](_0x194f('0x47'),_0x194f('0x48'));_0x844975[_0x194f('0x49')]=util[_0x194f('0x1c')](_0x194f('0x4a'),_0x5289ca[_0x194f('0x4b')],_0x844975[_0x194f('0x4c')],md5(_0x844975['uniqueid']));}else{_0x844975[_0x194f('0x49')]='';}return getConnection(_0x5289ca)['then'](function(_0x5e1f24){_0x1ecf81=_0x5e1f24;return getUser(_0x5289ca,_0x129978[_0x194f('0x4d')],_0x1ecf81);})[_0x194f('0x22')](function(_0x4e9adb){_0x3f2a19=_0x4e9adb;logger['info'](_0x194f('0x4e'),_0x3f2a19['id']);return getEndUser(_0x5289ca,_0x844975[_0x194f('0x4f')],_0x844975[_0x194f('0x50')],_0x1ecf81);})[_0x194f('0x22')](function(_0x4c95e4){_0x3ac549=_0x4c95e4;logger['info'](_0x194f('0x51'),_0x3ac549['id']);return createTicket(_0x5289ca,_0x3f2a19,_0x3ac549,_0x360e86,_0x844975,_0x360e86[_0x194f('0x52')],_0x1ecf81);})[_0x194f('0x22')](function(_0x4a4965){_0x1a06bb=_0x4a4965;logger[_0x194f('0x34')](_0x194f('0x53'));logger[_0x194f('0x34')]('The\x20Ticket\x20ID\x20is:',_0x1a06bb['id']);var _0x4b29a5=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x5289ca[_0x194f('0x36')],_[_0x194f('0x54')](_0x1a06bb['id'],'x')[0x1]);logger['info'](_0x194f('0x47'),_0x194f('0x55'));emit(util['format'](_0x194f('0x56'),_0x129978[_0x194f('0x14')]),_0x194f('0x57'),{'uri':_0x4b29a5});})['catch'](function(_0x20f0b1){logger['error'](_0x194f('0x47'),JSON[_0x194f('0x26')](_0x20f0b1));});};exports[_0x194f('0x58')]=function(_0x329be0,_0x223d73,_0x102232,_0x1a0ed0,_0x384514,_0x55b7e9,_0x4e854d){var _0x28ad47,_0xf91305,_0x4e84d8,_0x1ff1f3;_0x55b7e9[_0x194f('0x36')]=intUtil[_0x194f('0x45')](_0x55b7e9[_0x194f('0x36')]);_0x55b7e9['serverUrl']=intUtil[_0x194f('0x45')](_0x55b7e9[_0x194f('0x4b')]);if(_0x4e854d&&_0x4e854d[_0x194f('0x59')]&&_0x4e854d[_0x194f('0x59')]!=='none'){logger[_0x194f('0x34')](_0x194f('0x5a'),_0x194f('0x48'));_0x223d73[_0x194f('0x49')]=util[_0x194f('0x1c')](_0x194f('0x4a'),_0x55b7e9[_0x194f('0x4b')],_0x223d73[_0x194f('0x4c')],md5(_0x223d73[_0x194f('0x4c')]));}return getConnection(_0x55b7e9)[_0x194f('0x22')](function(_0x19175d){_0x1ff1f3=_0x19175d;return getUser(_0x55b7e9,_0x1a0ed0[_0x194f('0x4d')],_0x1ff1f3);})['then'](function(_0x395ce2){_0x28ad47=_0x395ce2;logger[_0x194f('0x34')](_0x194f('0x4e'),_0x28ad47['id']);return getEndUser(_0x55b7e9,_0x223d73['destcalleridname'],_0x223d73[_0x194f('0x5b')],_0x1ff1f3);})[_0x194f('0x22')](function(_0x567ace){_0xf91305=_0x567ace;logger[_0x194f('0x34')](_0x194f('0x51'),_0xf91305['id']);return createTicket(_0x55b7e9,_0x28ad47,_0xf91305,_0x102232,_0x223d73,_0x102232[_0x194f('0x52')],_0x1ff1f3);})[_0x194f('0x22')](function(_0x39e28f){_0x4e84d8=_0x39e28f;logger[_0x194f('0x34')](_0x194f('0x53'));logger['info'](_0x194f('0x5c'),_0x4e84d8['id']);var _0x303276=util[_0x194f('0x1c')](_0x194f('0x5d'),_0x55b7e9[_0x194f('0x36')],_[_0x194f('0x54')](_0x4e84d8['id'],'x')[0x1]);logger['info'](_0x194f('0x5a'),_0x194f('0x55'));emit(util[_0x194f('0x1c')](_0x194f('0x56'),_0x1a0ed0[_0x194f('0x14')]),_0x194f('0x57'),{'uri':_0x303276});})[_0x194f('0x27')](function(_0x2c1d83){logger[_0x194f('0x29')](_0x194f('0x5a'),JSON[_0x194f('0x26')](_0x2c1d83));});};exports[_0x194f('0x5e')]=function(_0xa2d689,_0x57b780,_0x470a8a,_0xdbdd39,_0x4c9fd5,_0x59ed9f){var _0x518bca,_0x5bd09f,_0x446252,_0x3ef99c;_0x59ed9f[_0x194f('0x36')]=intUtil['stripTrailingSlash'](_0x59ed9f[_0x194f('0x36')]);_0x59ed9f[_0x194f('0x4b')]=intUtil[_0x194f('0x45')](_0x59ed9f[_0x194f('0x4b')]);if(_0x4c9fd5&&_0x4c9fd5[_0x194f('0x46')]){logger['info']('['+_0x57b780[_0x194f('0x5f')]['toUpperCase']()+']',_0x194f('0x48'));_0x57b780[_0x194f('0x49')]=util[_0x194f('0x1c')](_0x194f('0x4a'),_0x59ed9f[_0x194f('0x4b')],_0x57b780[_0x194f('0x4c')],md5(_0x57b780['uniqueid']));}else{_0x57b780[_0x194f('0x49')]='';}return getConnection(_0x59ed9f)[_0x194f('0x22')](function(_0xaed6fc){_0x3ef99c=_0xaed6fc;return getUser(_0x59ed9f,'',_0x3ef99c);})['then'](function(_0x20ba10){_0x518bca=_0x20ba10;logger[_0x194f('0x34')](_0x194f('0x4e'),_0x518bca['id']);return getEndUser(_0x59ed9f,_0x57b780[_0x194f('0x4f')],_0x57b780[_0x194f('0x50')],_0x3ef99c);})[_0x194f('0x22')](function(_0x5c7941){_0x5bd09f=_0x5c7941;logger[_0x194f('0x34')]('The\x20Enduser\x20ID\x20is:',_0x5bd09f['id']);return createTicket(_0x59ed9f,_0x518bca,_0x5bd09f,_0x470a8a,_0x57b780,_0x470a8a[_0x194f('0x52')],_0x3ef99c);})[_0x194f('0x22')](function(_0x406645){_0x446252=_0x406645;logger[_0x194f('0x34')](_0x194f('0x53'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x446252['id']);})[_0x194f('0x27')](function(_0x3440d5){logger[_0x194f('0x29')]('['+_0x57b780['lastevent']['toUpperCase']()+']',JSON[_0x194f('0x26')](_0x3440d5));});}; \ 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 b6bc72c..6d3c914 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 _0xb259=['error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','newTab','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','base64','debug','[HTTP]','stringify','defaults','GET','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','push','toString','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/api/v2'];(function(_0x20e3ae,_0x2d25ae){var _0x52e82f=function(_0x48bc2a){while(--_0x48bc2a){_0x20e3ae['push'](_0x20e3ae['shift']());}};_0x52e82f(++_0x2d25ae);}(_0xb259,0x1d2));var _0x9b25=function(_0x23d7c5,_0x2a7547){_0x23d7c5=_0x23d7c5-0x0;var _0x350950=_0xb259[_0x23d7c5];return _0x350950;};'use strict';var _=require('lodash');var rp=require(_0x9b25('0x0'));var md5=require(_0x9b25('0x1'));var util=require(_0x9b25('0x2'));var Redis=require('ioredis');var intUtil=require(_0x9b25('0x3'));var config=require('../../../../config/environment');var logger=require(_0x9b25('0x4'))(_0x9b25('0x5'));config[_0x9b25('0x6')]=_['defaults'](config[_0x9b25('0x6')],{'host':_0x9b25('0x7'),'port':0x18eb});var io=require(_0x9b25('0x8'))(new Redis(config[_0x9b25('0x6')]));function emit(_0xb0daa,_0x173e5d,_0x45d547){io['to'](_0xb0daa)[_0x9b25('0x9')](_0x173e5d,_0x45d547);}var headers={'Content-Type':'application/json','Accept':_0x9b25('0xa')};function getTicket(_0x35cf71,_0x3519ea,_0x28490d,_0x3bfd76,_0x3bb2e0){logger[_0x9b25('0xb')](_0x9b25('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x35cf71[_0x9b25('0xd')]),'method':_0x9b25('0xe'),'body':{'ticket':_[_0x9b25('0xf')]({'requester_id':_0x28490d['id'],'submitter_id':_0x3519ea?_0x3519ea['id']:undefined,'assignee_id':_0x3519ea?_0x3519ea['id']:undefined,'tags':getTags(_0x3bfd76['Tags'],_0x9b25('0x10')),'subject':intUtil[_0x9b25('0x11')](_0x3bfd76[_0x9b25('0x12')],_0x3bb2e0,'\x20'),'description':intUtil[_0x9b25('0x11')](_0x3bfd76[_0x9b25('0x13')],_0x3bb2e0,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9b25('0x11')](_0x3bfd76[_0x9b25('0x13')],_0x3bb2e0,'\x0a')}},getCustomFields(_0x3bfd76[_0x9b25('0x14')],_0x3bb2e0))}})[_0x9b25('0x15')](function(_0x1fce8a){logger[_0x9b25('0xb')](_0x9b25('0x16'));return _0x1fce8a[_0x9b25('0x17')];});}function getUser(_0x6ed44a,_0x1cd2c6){if(intUtil[_0x9b25('0x18')](_0x1cd2c6)){logger[_0x9b25('0xb')]('Getting\x20agent\x20with\x20email',_0x1cd2c6);return request({'uri':util[_0x9b25('0x19')]('%s/search.json',_0x6ed44a[_0x9b25('0xd')]),'qs':{'query':util['format'](_0x9b25('0x1a'),_0x1cd2c6)}})[_0x9b25('0x15')](function(_0x2578f9){if(_0x2578f9[_0x9b25('0x1b')]){logger[_0x9b25('0xb')](_0x9b25('0x1c'));return _[_0x9b25('0x1d')](_0x2578f9[_0x9b25('0x1e')],{'email':_0x1cd2c6,'role':_0x9b25('0x1f')});}else{logger[_0x9b25('0xb')](_0x9b25('0x20'));return request({'uri':util[_0x9b25('0x19')](_0x9b25('0x21'),_0x6ed44a[_0x9b25('0xd')])})[_0x9b25('0x15')](function(_0x16dfd2){logger['info']('Admin\x20account\x20selected.');return _0x16dfd2[_0x9b25('0x22')];});}});}else{logger[_0x9b25('0xb')](_0x9b25('0x20'));return request({'uri':util[_0x9b25('0x19')](_0x9b25('0x21'),_0x6ed44a[_0x9b25('0xd')])})['then'](function(_0x251e8f){logger[_0x9b25('0xb')](_0x9b25('0x23'));return _0x251e8f[_0x9b25('0x22')];});}}function getEndUser(_0x3ae92c,_0x23a213,_0x30e7dd){logger[_0x9b25('0xb')](_0x9b25('0x24'),_0x30e7dd);return request({'uri':util[_0x9b25('0x19')](_0x9b25('0x25'),_0x3ae92c['remoteUri']),'qs':{'query':util[_0x9b25('0x19')](_0x9b25('0x26'),_0x30e7dd)}})['then'](function(_0x5df531){var _0x4f722b;if(_0x5df531[_0x9b25('0x1e')]['length']){_0x5df531[_0x9b25('0x1e')]=_[_0x9b25('0x27')](_0x5df531['results'],{'suspended':![],'role':_0x9b25('0x28')});if(_0x5df531[_0x9b25('0x1e')][_0x9b25('0x29')]){_0x4f722b=_[_0x9b25('0x2a')](_0x5df531[_0x9b25('0x1e')]);}}if(_0x4f722b){logger[_0x9b25('0xb')](_0x9b25('0x2b'));return _0x4f722b;}else{logger[_0x9b25('0xb')](_0x9b25('0x2c'));return request({'uri':util[_0x9b25('0x19')]('%s/users.json',_0x3ae92c[_0x9b25('0xd')]),'method':_0x9b25('0xe'),'body':{'user':{'role':_0x9b25('0x28'),'name':util[_0x9b25('0x19')]('Caller\x20-\x20%s',_0x23a213||_0x30e7dd),'phone':_0x30e7dd}}})[_0x9b25('0x15')](function(_0x271c0f){logger[_0x9b25('0xb')]('Enduser\x20created.');return _0x271c0f[_0x9b25('0x22')];});}});}function getAuth(_0x168ce1){var _0x3c0b8f;if(_0x168ce1[_0x9b25('0x2d')]===_0x9b25('0x2e')){_0x3c0b8f=util['format'](_0x9b25('0x2f'),_0x168ce1[_0x9b25('0x30')],_0x168ce1[_0x9b25('0x2e')]);}else if(_0x168ce1[_0x9b25('0x2d')]==='token'){_0x3c0b8f=util[_0x9b25('0x19')](_0x9b25('0x31'),_0x168ce1[_0x9b25('0x30')],_0x168ce1[_0x9b25('0x32')]);}return util['format'](_0x9b25('0x33'),new Buffer(_0x3c0b8f)['toString'](_0x9b25('0x34')));}function request(_0x5670f3){logger[_0x9b25('0x35')](_0x9b25('0x36'),JSON[_0x9b25('0x37')](_0x5670f3));return rp(_[_0x9b25('0x38')](_0x5670f3,{'method':_0x9b25('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x58e859,_0x4d5a74){var _0x5b3e7a=[];if(_0x58e859&&_0x58e859[_0x9b25('0x29')]>0x0){_0x5b3e7a=_['map'](_0x58e859,_0x4d5a74);}return _0x5b3e7a;}function getCustomFields(_0x1888c8,_0x537c6e){var _0x2349bc=[];var _0x30fec9={'custom_fields':[]};if(_0x1888c8[_0x9b25('0x29')]>0x0){_['forEach'](_0x1888c8,function(_0x34b5d2){if(_0x34b5d2[_0x9b25('0x3a')]===_0x9b25('0x3b')&&_0x34b5d2['nameField']&&!_0x34b5d2[_0x9b25('0x3c')]){_0x30fec9[_0x34b5d2[_0x9b25('0x3d')][_0x9b25('0x3e')]()]=_0x34b5d2[_0x9b25('0x3f')]['toString']();}else if(_0x34b5d2[_0x9b25('0x3a')]===_0x9b25('0x3b')&&_0x34b5d2[_0x9b25('0x40')]&&_0x34b5d2[_0x9b25('0x3c')]){_0x30fec9[_0x9b25('0x41')][_0x9b25('0x42')]({'id':_0x34b5d2[_0x9b25('0x40')],'value':_0x34b5d2[_0x9b25('0x3f')][_0x9b25('0x43')]()});}else if(_0x34b5d2[_0x9b25('0x3a')]===_0x9b25('0x44')&&_0x34b5d2['variableName']&&_0x34b5d2[_0x9b25('0x40')]&&_0x34b5d2['customField']){_0x537c6e[_0x34b5d2[_0x9b25('0x45')]]&&_0x30fec9[_0x9b25('0x41')]['push']({'id':_0x34b5d2['idField'],'value':_0x537c6e[_0x34b5d2[_0x9b25('0x45')]]['toString']()});}else if(_0x34b5d2[_0x9b25('0x3a')]===_0x9b25('0x46')&&_0x34b5d2[_0x9b25('0x47')]&&_0x34b5d2[_0x9b25('0x47')][_0x9b25('0x10')]&&_0x34b5d2[_0x9b25('0x40')]&&_0x34b5d2[_0x9b25('0x3c')]){_0x537c6e[_0x34b5d2[_0x9b25('0x47')][_0x9b25('0x10')][_0x9b25('0x3e')]()]&&_0x30fec9[_0x9b25('0x41')][_0x9b25('0x42')]({'id':_0x34b5d2['idField'],'value':_0x537c6e[_0x34b5d2[_0x9b25('0x47')][_0x9b25('0x10')][_0x9b25('0x3e')]()][_0x9b25('0x43')]()});}});}return _0x30fec9;}exports['queue']=function(_0x26667c,_0xaed30b,_0x99b6a0,_0x8dc5af,_0x2ae533,_0x2c7e37){var _0x29efd3,_0x582021;_0x2c7e37[_0x9b25('0xd')]=intUtil[_0x9b25('0x48')](_0x2c7e37[_0x9b25('0xd')]);_0x2c7e37[_0x9b25('0x49')]=intUtil[_0x9b25('0x48')](_0x2c7e37['serverUrl']);if(_0x2ae533&&_0x2ae533[_0x9b25('0x4a')]){logger[_0x9b25('0xb')](_0x9b25('0x4b'),_0x9b25('0x4c'));_0xaed30b[_0x9b25('0x4d')]=util[_0x9b25('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c7e37['serverUrl'],_0xaed30b[_0x9b25('0x4e')],md5(_0xaed30b[_0x9b25('0x4e')]));}else{_0xaed30b[_0x9b25('0x4d')]='';}headers['Authorization']=getAuth(_0x2c7e37);return getUser(_0x2c7e37,_0x8dc5af['email'])['then'](function(_0x17dfc7){_0x29efd3=_0x17dfc7;logger[_0x9b25('0xb')](_0x9b25('0x4f'),_0x29efd3['id']);return getEndUser(_0x2c7e37,_0xaed30b[_0x9b25('0x50')],_0xaed30b[_0x9b25('0x51')]);})[_0x9b25('0x15')](function(_0x351035){_0x582021=_0x351035;logger['info']('The\x20Enduser\x20ID\x20is:',_0x582021['id']);return getTicket(_0x2c7e37,_0x29efd3,_0x582021,_0x99b6a0,_0xaed30b);})['then'](function(_0x5194ec){if(_0x5194ec){logger[_0x9b25('0xb')](_0x9b25('0x52'),_0x5194ec['id']);switch(_0x2c7e37[_0x9b25('0x3a')]){case _0x9b25('0x53'):logger['info']('[QUEUE]',_0x9b25('0x54'));return request({'uri':util[_0x9b25('0x19')](_0x9b25('0x55'),_0x2c7e37[_0x9b25('0xd')],_0x29efd3['id'],_0x5194ec['id']),'method':_0x9b25('0xe')});case'newTab':logger['info'](_0x9b25('0x4b'),_0x9b25('0x56'));emit(util[_0x9b25('0x19')]('user:%s',_0x8dc5af[_0x9b25('0x10')]),_0x9b25('0x57'),{'uri':util[_0x9b25('0x19')]('%s/agent/tickets/%s',_0x2c7e37[_0x9b25('0xd')]['replace'](_0x9b25('0x58'),''),_0x5194ec['id'])});break;default:logger[_0x9b25('0x59')](_0x9b25('0x4b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x9b25('0x5a')](function(_0x41d480){logger[_0x9b25('0x59')](_0x9b25('0x5b'),util[_0x9b25('0x5c')](_0x41d480,{'showHidden':!![],'depth':null}));});};exports[_0x9b25('0x5d')]=function(_0xc5b5c3,_0x114c15,_0x6dd0c0,_0x1bde6b,_0x43f578,_0x521463,_0x224a07){var _0x4ad75c,_0x3c5173;_0x521463[_0x9b25('0xd')]=intUtil[_0x9b25('0x48')](_0x521463[_0x9b25('0xd')]);_0x521463[_0x9b25('0x49')]=intUtil[_0x9b25('0x48')](_0x521463[_0x9b25('0x49')]);if(_0x224a07&&_0x224a07['recordingFormat']&&_0x224a07[_0x9b25('0x5e')]!==_0x9b25('0x5f')){logger[_0x9b25('0xb')]('[OUTBOUND]',_0x9b25('0x4c'));_0x114c15[_0x9b25('0x4d')]=util[_0x9b25('0x19')](_0x9b25('0x60'),_0x521463[_0x9b25('0x49')],_0x114c15[_0x9b25('0x4e')],md5(_0x114c15['uniqueid']));}headers[_0x9b25('0x61')]=getAuth(_0x521463);return getUser(_0x521463,_0x1bde6b[_0x9b25('0x62')])[_0x9b25('0x15')](function(_0x4662e8){_0x4ad75c=_0x4662e8;logger['info'](_0x9b25('0x4f'),_0x4ad75c['id']);return getEndUser(_0x521463,_0x114c15[_0x9b25('0x63')],_0x114c15[_0x9b25('0x64')]);})['then'](function(_0x1b3492){_0x3c5173=_0x1b3492;logger[_0x9b25('0xb')](_0x9b25('0x65'),_0x3c5173['id']);return getTicket(_0x521463,_0x4ad75c,_0x3c5173,_0x6dd0c0,_0x114c15);})[_0x9b25('0x15')](function(_0x33c962){if(_0x33c962){logger[_0x9b25('0xb')]('The\x20Ticket\x20ID\x20is:',_0x33c962['id']);switch(_0x521463['type']){case _0x9b25('0x53'):logger[_0x9b25('0xb')](_0x9b25('0x66'),_0x9b25('0x54'));return request({'uri':util[_0x9b25('0x19')](_0x9b25('0x55'),_0x521463[_0x9b25('0xd')],_0x4ad75c['id'],_0x33c962['id']),'method':'POST'});case _0x9b25('0x67'):logger[_0x9b25('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b25('0x19')]('user:%s',_0x1bde6b[_0x9b25('0x10')]),'trigger:browser:url',{'uri':util[_0x9b25('0x19')](_0x9b25('0x68'),_0x521463[_0x9b25('0xd')][_0x9b25('0x69')](_0x9b25('0x58'),''),_0x33c962['id'])});break;default:logger['error']('[OUTBOUND]',_0x9b25('0x6a'));}}})[_0x9b25('0x5a')](function(_0x593023){logger[_0x9b25('0x59')](_0x9b25('0x6b'),util['inspect'](_0x593023,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x7d8d0,_0x447efd,_0x1988fc,_0x2b6445,_0x23db23,_0x4ca2d2){var _0x41c08e,_0x2cbdcc;_0x4ca2d2[_0x9b25('0xd')]=intUtil[_0x9b25('0x48')](_0x4ca2d2[_0x9b25('0xd')]);_0x4ca2d2[_0x9b25('0x49')]=intUtil[_0x9b25('0x48')](_0x4ca2d2[_0x9b25('0x49')]);if(_0x23db23&&_0x23db23[_0x9b25('0x4a')]){logger[_0x9b25('0xb')]('['+_0x447efd[_0x9b25('0x6c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x447efd[_0x9b25('0x4d')]=util[_0x9b25('0x19')](_0x9b25('0x60'),_0x4ca2d2['serverUrl'],_0x447efd['uniqueid'],md5(_0x447efd['uniqueid']));}else{_0x447efd['recordingURL']='';}headers[_0x9b25('0x61')]=getAuth(_0x4ca2d2);return getUser(_0x4ca2d2)['then'](function(_0x461da3){_0x41c08e=_0x461da3;logger[_0x9b25('0xb')]('The\x20User\x20ID\x20is:',_0x41c08e['id']);return getEndUser(_0x4ca2d2,_0x447efd[_0x9b25('0x50')],_0x447efd[_0x9b25('0x51')]);})[_0x9b25('0x15')](function(_0x46329d){_0x2cbdcc=_0x46329d;logger[_0x9b25('0xb')](_0x9b25('0x65'),_0x2cbdcc['id']);return getTicket(_0x4ca2d2,_0x41c08e,_0x2cbdcc,_0x1988fc,_0x447efd);})[_0x9b25('0x15')](function(_0x47013d){if(_0x47013d){logger[_0x9b25('0xb')]('The\x20Ticket\x20ID\x20is:',_0x47013d['id']);}})[_0x9b25('0x5a')](function(_0x56f2cd){logger['error']('['+_0x447efd['lastevent'][_0x9b25('0x6d')]()+']'+_0x9b25('0x6e'),util[_0x9b25('0x5c')](_0x56f2cd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x75a0=['[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','info','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error'];(function(_0x339c17,_0x25ff64){var _0x34b172=function(_0x111508){while(--_0x111508){_0x339c17['push'](_0x339c17['shift']());}};_0x34b172(++_0x25ff64);}(_0x75a0,0x83));var _0x075a=function(_0x37f85a,_0x240e20){_0x37f85a=_0x37f85a-0x0;var _0x190eeb=_0x75a0[_0x37f85a];return _0x190eeb;};'use strict';var _=require(_0x075a('0x0'));var rp=require(_0x075a('0x1'));var md5=require(_0x075a('0x2'));var util=require(_0x075a('0x3'));var Redis=require('ioredis');var intUtil=require(_0x075a('0x4'));var config=require(_0x075a('0x5'));var logger=require(_0x075a('0x6'))(_0x075a('0x7'));config[_0x075a('0x8')]=_[_0x075a('0x9')](config[_0x075a('0x8')],{'host':_0x075a('0xa'),'port':0x18eb});var io=require(_0x075a('0xb'))(new Redis(config[_0x075a('0x8')]));function emit(_0x4512e5,_0x132376,_0x3534a9){io['to'](_0x4512e5)[_0x075a('0xc')](_0x132376,_0x3534a9);}var headers={'Content-Type':_0x075a('0xd'),'Accept':_0x075a('0xd')};function getTicket(_0x2f2fbb,_0x4bd43d,_0x35eb0c,_0x48d0e4,_0x174490){logger['info'](_0x075a('0xe'));return request({'uri':util[_0x075a('0xf')](_0x075a('0x10'),_0x2f2fbb[_0x075a('0x11')]),'method':_0x075a('0x12'),'body':{'ticket':_[_0x075a('0x13')]({'requester_id':_0x35eb0c['id'],'submitter_id':_0x4bd43d?_0x4bd43d['id']:undefined,'assignee_id':_0x4bd43d?_0x4bd43d['id']:undefined,'tags':getTags(_0x48d0e4[_0x075a('0x14')],_0x075a('0x15')),'subject':intUtil[_0x075a('0x16')](_0x48d0e4[_0x075a('0x17')],_0x174490,'\x20'),'description':intUtil['getString'](_0x48d0e4['Descriptions'],_0x174490,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x48d0e4[_0x075a('0x18')],_0x174490,'\x0a')}},getCustomFields(_0x48d0e4['Fields'],_0x174490))}})[_0x075a('0x19')](function(_0x4c203f){logger[_0x075a('0x1a')]('Ticket\x20created!');return _0x4c203f['ticket'];});}function getUser(_0x36ab09,_0x5c5093){if(intUtil[_0x075a('0x1b')](_0x5c5093)){logger[_0x075a('0x1a')](_0x075a('0x1c'),_0x5c5093);return request({'uri':util[_0x075a('0xf')](_0x075a('0x1d'),_0x36ab09[_0x075a('0x11')]),'qs':{'query':util['format'](_0x075a('0x1e'),_0x5c5093)}})[_0x075a('0x19')](function(_0x8eb335){if(_0x8eb335[_0x075a('0x1f')]){logger['info'](_0x075a('0x20'));return _[_0x075a('0x21')](_0x8eb335[_0x075a('0x22')],{'email':_0x5c5093,'role':_0x075a('0x23')});}else{logger[_0x075a('0x1a')](_0x075a('0x24'));return request({'uri':util[_0x075a('0xf')]('%s/users/me.json',_0x36ab09[_0x075a('0x11')])})[_0x075a('0x19')](function(_0x198e30){logger[_0x075a('0x1a')](_0x075a('0x25'));return _0x198e30[_0x075a('0x26')];});}});}else{logger[_0x075a('0x1a')](_0x075a('0x24'));return request({'uri':util[_0x075a('0xf')](_0x075a('0x27'),_0x36ab09[_0x075a('0x11')])})[_0x075a('0x19')](function(_0x289246){logger[_0x075a('0x1a')](_0x075a('0x25'));return _0x289246[_0x075a('0x26')];});}}function getEndUser(_0x2e3b8b,_0x578bb0,_0x5199c4){logger['info'](_0x075a('0x28'),_0x5199c4);return request({'uri':util[_0x075a('0xf')](_0x075a('0x1d'),_0x2e3b8b[_0x075a('0x11')]),'qs':{'query':util[_0x075a('0xf')](_0x075a('0x29'),_0x5199c4)}})[_0x075a('0x19')](function(_0x371680){var _0x16ad79;if(_0x371680[_0x075a('0x22')][_0x075a('0x2a')]){_0x371680['results']=_[_0x075a('0x2b')](_0x371680[_0x075a('0x22')],{'suspended':![],'role':_0x075a('0x2c')});if(_0x371680['results'][_0x075a('0x2a')]){_0x16ad79=_[_0x075a('0x2d')](_0x371680[_0x075a('0x22')]);}}if(_0x16ad79){logger[_0x075a('0x1a')](_0x075a('0x2e'));return _0x16ad79;}else{logger[_0x075a('0x1a')](_0x075a('0x2f'));return request({'uri':util['format'](_0x075a('0x30'),_0x2e3b8b[_0x075a('0x11')]),'method':'POST','body':{'user':{'role':_0x075a('0x2c'),'name':util['format'](_0x075a('0x31'),_0x578bb0||_0x5199c4),'phone':_0x5199c4}}})['then'](function(_0x532284){logger['info']('Enduser\x20created.');return _0x532284[_0x075a('0x26')];});}});}function getAuth(_0x500d46){var _0x41bdd9;if(_0x500d46[_0x075a('0x32')]===_0x075a('0x33')){_0x41bdd9=util[_0x075a('0xf')](_0x075a('0x34'),_0x500d46[_0x075a('0x35')],_0x500d46[_0x075a('0x33')]);}else if(_0x500d46[_0x075a('0x32')]===_0x075a('0x36')){_0x41bdd9=util['format'](_0x075a('0x37'),_0x500d46[_0x075a('0x35')],_0x500d46['token']);}return util['format'](_0x075a('0x38'),new Buffer(_0x41bdd9)[_0x075a('0x39')](_0x075a('0x3a')));}function request(_0x4229fe){logger[_0x075a('0x3b')](_0x075a('0x3c'),JSON[_0x075a('0x3d')](_0x4229fe));return rp(_[_0x075a('0x9')](_0x4229fe,{'method':_0x075a('0x3e'),'headers':headers,'json':!![]}));}function getTags(_0x1ba471,_0x354e56){var _0x2c4be0=[];if(_0x1ba471&&_0x1ba471['length']>0x0){_0x2c4be0=_[_0x075a('0x3f')](_0x1ba471,_0x354e56);}return _0x2c4be0;}function getCustomFields(_0x38e79f,_0x436c87){var _0xa504e4=[];var _0x3d9e63={'custom_fields':[]};if(_0x38e79f['length']>0x0){_['forEach'](_0x38e79f,function(_0x1f6255){if(_0x1f6255[_0x075a('0x40')]===_0x075a('0x41')&&_0x1f6255[_0x075a('0x42')]&&!_0x1f6255[_0x075a('0x43')]){_0x3d9e63[_0x1f6255[_0x075a('0x42')][_0x075a('0x44')]()]=_0x1f6255[_0x075a('0x45')]['toString']();}else if(_0x1f6255[_0x075a('0x40')]===_0x075a('0x41')&&_0x1f6255[_0x075a('0x46')]&&_0x1f6255['customField']){_0x3d9e63[_0x075a('0x47')][_0x075a('0x48')]({'id':_0x1f6255[_0x075a('0x46')],'value':_0x1f6255[_0x075a('0x45')][_0x075a('0x39')]()});}else if(_0x1f6255[_0x075a('0x40')]==='variable'&&_0x1f6255[_0x075a('0x49')]&&_0x1f6255[_0x075a('0x46')]&&_0x1f6255['customField']){_0x436c87[_0x1f6255[_0x075a('0x49')]]&&_0x3d9e63[_0x075a('0x47')][_0x075a('0x48')]({'id':_0x1f6255[_0x075a('0x46')],'value':_0x436c87[_0x1f6255[_0x075a('0x49')]][_0x075a('0x39')]()});}else if(_0x1f6255[_0x075a('0x40')]==='customVariable'&&_0x1f6255[_0x075a('0x4a')]&&_0x1f6255[_0x075a('0x4a')][_0x075a('0x15')]&&_0x1f6255[_0x075a('0x46')]&&_0x1f6255[_0x075a('0x43')]){_0x436c87[_0x1f6255[_0x075a('0x4a')][_0x075a('0x15')]['toLowerCase']()]&&_0x3d9e63['custom_fields'][_0x075a('0x48')]({'id':_0x1f6255[_0x075a('0x46')],'value':_0x436c87[_0x1f6255[_0x075a('0x4a')][_0x075a('0x15')]['toLowerCase']()][_0x075a('0x39')]()});}});}return _0x3d9e63;}exports[_0x075a('0x4b')]=function(_0x2defe7,_0x307838,_0xb59e1f,_0x1f6fb4,_0x355c9b,_0x80cf36){var _0x30e12e,_0x8f4723;_0x80cf36['remoteUri']=intUtil[_0x075a('0x4c')](_0x80cf36[_0x075a('0x11')]);_0x80cf36['serverUrl']=intUtil[_0x075a('0x4c')](_0x80cf36[_0x075a('0x4d')]);if(_0x355c9b&&_0x355c9b[_0x075a('0x4e')]){logger['info'](_0x075a('0x4f'),'Recording\x20is\x20enabled!');_0x307838[_0x075a('0x50')]=util[_0x075a('0xf')](_0x075a('0x51'),_0x80cf36['serverUrl'],_0x307838['uniqueid'],md5(_0x307838[_0x075a('0x52')]));}else{_0x307838[_0x075a('0x50')]='';}headers[_0x075a('0x53')]=getAuth(_0x80cf36);return getUser(_0x80cf36,_0x1f6fb4[_0x075a('0x54')])['then'](function(_0x1d274a){_0x30e12e=_0x1d274a;logger[_0x075a('0x1a')](_0x075a('0x55'),_0x30e12e['id']);return getEndUser(_0x80cf36,_0x307838[_0x075a('0x56')],_0x307838[_0x075a('0x57')]);})[_0x075a('0x19')](function(_0x881068){_0x8f4723=_0x881068;logger['info'](_0x075a('0x58'),_0x8f4723['id']);return getTicket(_0x80cf36,_0x30e12e,_0x8f4723,_0xb59e1f,_0x307838);})[_0x075a('0x19')](function(_0x430b0b){if(_0x430b0b){logger[_0x075a('0x1a')](_0x075a('0x59'),_0x430b0b['id']);switch(_0x80cf36[_0x075a('0x40')]){case _0x075a('0x5a'):logger[_0x075a('0x1a')](_0x075a('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x075a('0x5b'),_0x80cf36[_0x075a('0x11')],_0x30e12e['id'],_0x430b0b['id']),'method':_0x075a('0x12')});case _0x075a('0x5c'):logger[_0x075a('0x1a')](_0x075a('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x075a('0xf')](_0x075a('0x5d'),_0x1f6fb4[_0x075a('0x15')]),_0x075a('0x5e'),{'uri':util['format'](_0x075a('0x5f'),_0x80cf36[_0x075a('0x11')][_0x075a('0x60')](_0x075a('0x61'),''),_0x430b0b['id'])});break;default:logger['error'](_0x075a('0x4f'),_0x075a('0x62'));}}})[_0x075a('0x63')](function(_0x52a1c2){logger[_0x075a('0x64')](_0x075a('0x65'),util[_0x075a('0x66')](_0x52a1c2,{'showHidden':!![],'depth':null}));});};exports[_0x075a('0x67')]=function(_0x2c9a7b,_0x12b7b4,_0x1ac89e,_0x53c807,_0x4b45af,_0xb06403,_0x511ce2){var _0x399aac,_0xae183f;_0xb06403[_0x075a('0x11')]=intUtil['stripTrailingSlash'](_0xb06403[_0x075a('0x11')]);_0xb06403['serverUrl']=intUtil[_0x075a('0x4c')](_0xb06403[_0x075a('0x4d')]);if(_0x511ce2&&_0x511ce2[_0x075a('0x68')]&&_0x511ce2[_0x075a('0x68')]!==_0x075a('0x69')){logger[_0x075a('0x1a')](_0x075a('0x6a'),_0x075a('0x6b'));_0x12b7b4[_0x075a('0x50')]=util[_0x075a('0xf')](_0x075a('0x51'),_0xb06403[_0x075a('0x4d')],_0x12b7b4[_0x075a('0x52')],md5(_0x12b7b4[_0x075a('0x52')]));}headers[_0x075a('0x53')]=getAuth(_0xb06403);return getUser(_0xb06403,_0x53c807[_0x075a('0x54')])[_0x075a('0x19')](function(_0x5adedc){_0x399aac=_0x5adedc;logger[_0x075a('0x1a')]('The\x20User\x20ID\x20is:',_0x399aac['id']);return getEndUser(_0xb06403,_0x12b7b4[_0x075a('0x6c')],_0x12b7b4[_0x075a('0x6d')]);})[_0x075a('0x19')](function(_0x19060d){_0xae183f=_0x19060d;logger['info'](_0x075a('0x58'),_0xae183f['id']);return getTicket(_0xb06403,_0x399aac,_0xae183f,_0x1ac89e,_0x12b7b4);})[_0x075a('0x19')](function(_0x352421){if(_0x352421){logger[_0x075a('0x1a')](_0x075a('0x59'),_0x352421['id']);switch(_0xb06403[_0x075a('0x40')]){case _0x075a('0x5a'):logger[_0x075a('0x1a')](_0x075a('0x6a'),_0x075a('0x6e'));return request({'uri':util[_0x075a('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xb06403[_0x075a('0x11')],_0x399aac['id'],_0x352421['id']),'method':_0x075a('0x12')});case _0x075a('0x5c'):logger[_0x075a('0x1a')](_0x075a('0x6a'),_0x075a('0x6f'));emit(util[_0x075a('0xf')](_0x075a('0x5d'),_0x53c807[_0x075a('0x15')]),'trigger:browser:url',{'uri':util[_0x075a('0xf')](_0x075a('0x5f'),_0xb06403[_0x075a('0x11')]['replace'](_0x075a('0x61'),''),_0x352421['id'])});break;default:logger[_0x075a('0x64')]('[OUTBOUND]',_0x075a('0x62'));}}})[_0x075a('0x63')](function(_0x3154d7){logger[_0x075a('0x64')](_0x075a('0x70'),util[_0x075a('0x66')](_0x3154d7,{'showHidden':!![],'depth':null}));});};exports[_0x075a('0x71')]=function(_0x29b6a9,_0x3a3292,_0x5b7914,_0x138935,_0x9c5ca8,_0x36535b){var _0x26bd69,_0x57c910;_0x36535b[_0x075a('0x11')]=intUtil['stripTrailingSlash'](_0x36535b[_0x075a('0x11')]);_0x36535b[_0x075a('0x4d')]=intUtil['stripTrailingSlash'](_0x36535b[_0x075a('0x4d')]);if(_0x9c5ca8&&_0x9c5ca8[_0x075a('0x4e')]){logger[_0x075a('0x1a')]('['+_0x3a3292[_0x075a('0x72')][_0x075a('0x73')]()+']',_0x075a('0x6b'));_0x3a3292[_0x075a('0x50')]=util[_0x075a('0xf')](_0x075a('0x51'),_0x36535b[_0x075a('0x4d')],_0x3a3292[_0x075a('0x52')],md5(_0x3a3292[_0x075a('0x52')]));}else{_0x3a3292['recordingURL']='';}headers[_0x075a('0x53')]=getAuth(_0x36535b);return getUser(_0x36535b)[_0x075a('0x19')](function(_0x41bad7){_0x26bd69=_0x41bad7;logger[_0x075a('0x1a')](_0x075a('0x55'),_0x26bd69['id']);return getEndUser(_0x36535b,_0x3a3292[_0x075a('0x56')],_0x3a3292[_0x075a('0x57')]);})[_0x075a('0x19')](function(_0x2e9b8a){_0x57c910=_0x2e9b8a;logger[_0x075a('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x57c910['id']);return getTicket(_0x36535b,_0x26bd69,_0x57c910,_0x5b7914,_0x3a3292);})[_0x075a('0x19')](function(_0x3e87f8){if(_0x3e87f8){logger[_0x075a('0x1a')](_0x075a('0x59'),_0x3e87f8['id']);}})[_0x075a('0x63')](function(_0x3d9ec5){logger[_0x075a('0x64')]('['+_0x3a3292[_0x075a('0x72')][_0x075a('0x73')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x075a('0x66')](_0x3d9ec5,{'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 f040b06..3000866 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 _0x79ad=['Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','mm:ss','answertime','endtime','Call_Duration','utc','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','refreshToken','refresh_token','then','seconds','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x79ad,0x16e));var _0xd79a=function(_0x4f97d6,_0x2454d2){_0x4f97d6=_0x4f97d6-0x0;var _0x2db489=_0x79ad[_0x4f97d6];return _0x2db489;};'use strict';var _=require(_0xd79a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xd79a('0x1'));var intUtil=require(_0xd79a('0x2'));var moment=require(_0xd79a('0x3'));var Redis=require(_0xd79a('0x4'));var BPromise=require(_0xd79a('0x5'));var config=require(_0xd79a('0x6'));var logger=require(_0xd79a('0x7'))('zoho');config['redis']=_[_0xd79a('0x8')](config[_0xd79a('0x9')],{'host':_0xd79a('0xa'),'port':0x18eb});var io=require(_0xd79a('0xb'))(new Redis(config[_0xd79a('0x9')]));function emit(_0x263519,_0x2d3ec9,_0x2f2ed1){io['to'](_0x263519)[_0xd79a('0xc')](_0x2d3ec9,_0x2f2ed1);}function request(_0x3080b0){logger[_0xd79a('0xd')](_0xd79a('0xe'),JSON[_0xd79a('0xf')](_0x3080b0));return rp(_0x3080b0);}function getCustomFields(_0x5a7743,_0x3acce0){var _0x2a4b35={};if(_0x5a7743[_0xd79a('0x10')]>0x0){_[_0xd79a('0x11')](_0x5a7743,function(_0x708f5f){if(_0x708f5f[_0xd79a('0x12')]===_0xd79a('0x13')&&_0x708f5f[_0xd79a('0x14')]){_0x2a4b35[_0x708f5f[_0xd79a('0x14')]]=_0x708f5f['content']['toString']();}else if(_0x708f5f[_0xd79a('0x12')]==='variable'&&_0x708f5f[_0xd79a('0x15')]&&_0x708f5f[_0xd79a('0x14')]&&_0x3acce0[_0x708f5f[_0xd79a('0x15')]]){_0x2a4b35[_0x708f5f[_0xd79a('0x14')]]=_0x3acce0[_0x708f5f[_0xd79a('0x15')]][_0xd79a('0x16')]();}else if(_0x708f5f[_0xd79a('0x12')]===_0xd79a('0x17')&&_0x708f5f[_0xd79a('0x18')]&&_0x708f5f[_0xd79a('0x18')][_0xd79a('0x19')]&&_0x708f5f[_0xd79a('0x14')]&&_0x3acce0[_0x708f5f['Variable'][_0xd79a('0x19')][_0xd79a('0x1a')]()]){_0x2a4b35[_0x708f5f[_0xd79a('0x14')]]=_0x3acce0[_0x708f5f[_0xd79a('0x18')][_0xd79a('0x19')][_0xd79a('0x1a')]()][_0xd79a('0x16')]();}});}return _0x2a4b35;}function getName(_0x27125c){if(_0x27125c[_0xd79a('0x1b')]('\x20')>0x0){var _0xcb00c9=_0x27125c[_0xd79a('0x1c')](/ (.+)/);if(_0xcb00c9[0x1]){return _0xcb00c9;}}return[_0x27125c,_0x27125c];}var accountsTokens={};function getAccessToken(_0x51a253){return new Promise(function(_0x2ac9ea,_0x558db5){if(!_['isNil'](accountsTokens[_0x51a253['id']])&&!_['isNil'](accountsTokens[_0x51a253['id']][_0xd79a('0x1d')])){if(moment()[_0xd79a('0x1e')](accountsTokens[_0x51a253['id']][_0xd79a('0x1f')])){_0x2ac9ea(accountsTokens[_0x51a253['id']]['access_token']);}}var _0x389520;switch(_0x51a253[_0xd79a('0x20')]){case'US':_0x389520=_0xd79a('0x21');break;case'AU':_0x389520=_0xd79a('0x22');break;case'EU':_0x389520='https://accounts.zoho.eu';break;case'IN':_0x389520='https://accounts.zoho.in';break;case'CN':_0x389520='https://accounts.zoho.com.cn';break;default:_0x389520='https://accounts.zoho.eu';break;}var _0x170aa1={'method':'POST','uri':_0x389520+'/oauth/v2/token','qs':{'refresh_token':_0x51a253[_0xd79a('0x23')],'client_id':_0x51a253['clientId'],'client_secret':_0x51a253['clientSecret'],'grant_type':_0xd79a('0x24')},'json':!![]};return rp(_0x170aa1)[_0xd79a('0x25')](function(_0x4de7e8){accountsTokens[_0x51a253['id']]={'access_token':_0x4de7e8['access_token'],'expires_in':moment()['add'](_0x4de7e8['expires_in'],_0xd79a('0x26'))};_0x2ac9ea(_0x4de7e8[_0xd79a('0x1d')]);})['catch'](function(_0x445acf){logger['error']('Failing\x20creating\x20the\x20access_token',_0x445acf[_0xd79a('0x27')]);_0x558db5(_0x445acf);});});}function getUser(_0x5be5bd,_0x2bc0e5,_0x4b36b9,_0x2bf0b2){logger[_0xd79a('0x28')](_0xd79a('0x29'));return request({'method':_0xd79a('0x2a'),'uri':util[_0xd79a('0x2b')](_0xd79a('0x2c'),_0x2bc0e5),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xd79a('0x2d')+_0x5be5bd},'json':!![]})[_0xd79a('0x25')](function(_0x3d1069){if(_0x3d1069[_0xd79a('0x2e')]){var _0x1203e9=-0x1;if(_[_0xd79a('0x2f')](_0x3d1069[_0xd79a('0x2e')])){if(!_[_0xd79a('0x30')](_0x2bf0b2)){_0x1203e9=_[_0xd79a('0x31')](_0x3d1069['users'],function(_0xb68e78){return _0xb68e78['email']===_0x2bf0b2;});}if(_0x1203e9>=0x0){logger[_0xd79a('0x28')]('Agent\x20found!');}else{logger[_0xd79a('0x28')](_0xd79a('0x32'));_0x1203e9=_[_0xd79a('0x31')](_0x3d1069['users'],function(_0x34bdac){return _0x34bdac['profile']['name']==='Administrator';});}return _0x3d1069[_0xd79a('0x2e')][_0x1203e9];}else{if(_0x3d1069['user'][_0xd79a('0x33')]['name']===_0xd79a('0x34')){logger['info'](_0xd79a('0x32'));user=_0x3d1069[_0xd79a('0x35')];return user;}else{logger[_0xd79a('0x36')](_0xd79a('0x37'),JSON[_0xd79a('0xf')](_0x3d1069));throw new Error(_0xd79a('0x38')+JSON[_0xd79a('0xf')](_0x3d1069));}}}else{logger[_0xd79a('0x36')]('The\x20failing\x20result\x20is',JSON[_0xd79a('0xf')](_0x3d1069));throw new Error(_0xd79a('0x38')+JSON[_0xd79a('0xf')](_0x3d1069));}})['catch'](function(_0x5b0b92){console['error'](_0x5b0b92);});}function getZohoUser(_0x427c2f,_0x337239){return new BPromise(function(_0x4ce0de,_0x3e9a52){request(_0x427c2f)[_0xd79a('0x25')](function(_0x192ab0){var _0x206004=null;if(_0x192ab0){_0x206004=_0x192ab0[_0xd79a('0x39')][0x0];_0x206004[_0xd79a('0x3a')]=_0x337239;}_0x4ce0de(_0x206004);})[_0xd79a('0x3b')](function(_0x575117){_0x3e9a52(_0x575117);});});}function createEndUser(_0x2d95ab,_0x1c2f92,_0x1ef077,_0x449b58,_0x33a17d,_0x3518a3){var _0x1ef077=getName(_0x1ef077);return request({'method':_0xd79a('0x3c'),'uri':_0xd79a('0x3d')+_0x1c2f92+_0xd79a('0x3e')+_[_0xd79a('0x3f')](_0x3518a3[_0xd79a('0x40')])+'s','body':{'data':[{'Last_Name':_0x1ef077[0x1],'First_Name':_0x1ef077[0x0],'Phone':_0x449b58,'Owner':{'name':!_[_0xd79a('0x30')](_0x33a17d['role'][_0xd79a('0x19')])?_0x33a17d[_0xd79a('0x41')][_0xd79a('0x19')]:!_[_0xd79a('0x30')](_0x33a17d[_0xd79a('0x42')])?_0x33a17d[_0xd79a('0x42')]+'\x20'+_0x33a17d[_0xd79a('0x43')]:_0x33a17d['last_name'],'id':_0x33a17d['id']}}]},'headers':{'Authorization':_0xd79a('0x2d')+_0x2d95ab},'json':!![]})[_0xd79a('0x25')](function(_0x4a6cfa){if(_0x4a6cfa&&_0x4a6cfa['data'][0x0][_0xd79a('0x44')]===_0xd79a('0x45')){var _0x203355=_0x4a6cfa[_0xd79a('0x39')][0x0]['details'];_0x203355[_0xd79a('0x3a')]=_[_0xd79a('0x3f')](_0x3518a3[_0xd79a('0x40')])+'s';return _0x203355;}logger['error'](_0xd79a('0x37'),JSON[_0xd79a('0xf')](data));throw new Error(_0xd79a('0x46')+JSON[_0xd79a('0xf')](data));})[_0xd79a('0x3b')](function(_0x3c8981){console[_0xd79a('0x47')]('CREATE\x20ERROR',_0x3c8981);});}function getEndUser(_0x2a2fc1,_0x407074,_0x1f5dd3,_0x372b43,_0x37fb3a,_0x355a93,_0x4cffe1){var _0x582385={'method':_0xd79a('0x2a'),'uri':'','headers':{'Authorization':_0xd79a('0x2d')+_0x2a2fc1},'json':!![]};switch(_0x4cffe1[_0xd79a('0x48')]){case _0xd79a('0x49'):_0x582385[_0xd79a('0x4a')]='https://www.zohoapis.'+_0x407074+_0xd79a('0x4b')+_0x37fb3a+'))';return getZohoUser(_0x582385,_0xd79a('0x4c'))['then'](function(_0x53bbc4){if(_0x53bbc4)return _0x53bbc4;_0x582385['uri']=_0xd79a('0x3d')+_0x407074+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x37fb3a+'))';return getZohoUser(_0x582385,_0xd79a('0x4d'))[_0xd79a('0x25')](function(_0x5039a9){if(_0x5039a9)return _0x5039a9;if(_0x4cffe1['moduleCreate']!='nothing'){return createEndUser(_0x2a2fc1,_0x407074,_0x372b43,_0x37fb3a,_0x355a93,_0x4cffe1);}else{return{};}});});break;case _0xd79a('0x4e'):_0x582385[_0xd79a('0x4a')]='https://www.zohoapis.'+_0x407074+_0xd79a('0x4b')+_0x37fb3a+'))';return getZohoUser(_0x582385,'Contacts')[_0xd79a('0x25')](function(_0x373df3){if(_0x373df3)return _0x373df3;if(_0x4cffe1[_0xd79a('0x40')]!=_0xd79a('0x4f')){return createEndUser(_0x2a2fc1,_0x407074,_0x372b43,_0x37fb3a,_0x355a93,_0x4cffe1);}else{return{};}});break;case'lead':_0x582385[_0xd79a('0x4a')]=_0xd79a('0x3d')+_0x407074+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x37fb3a+'))';return getZohoUser(_0x582385,_0xd79a('0x4d'))[_0xd79a('0x25')](function(_0x576226){if(_0x576226)return _0x576226;if(_0x4cffe1[_0xd79a('0x40')]!=_0xd79a('0x4f')){return createEndUser(_0x2a2fc1,_0x407074,_0x372b43,_0x37fb3a,_0x355a93,_0x4cffe1);}else{return{};}});break;}}function getCall(_0x5e5a48,_0x5ebf19,_0x26cf2f,_0x506b37,_0x9b9ba8,_0x8436a,_0x3f1b77,_0x583a52){logger[_0xd79a('0x28')](_0xd79a('0x50'));var _0x1f469d={};_0x1f469d[_0xd79a('0x51')]={'name':!_['isNil'](_0x506b37['role'][_0xd79a('0x19')])&&!_[_0xd79a('0x30')](_0x506b37[_0xd79a('0x33')]['name'])&&_0x506b37[_0xd79a('0x33')][_0xd79a('0x19')]===_0xd79a('0x52')?_0x506b37['role'][_0xd79a('0x19')]:!_['isNil'](_0x506b37[_0xd79a('0x42')])?_0x506b37[_0xd79a('0x42')]+'\x20'+_0x506b37[_0xd79a('0x43')]:_0x506b37[_0xd79a('0x43')],'id':_0x506b37['id']};_0x1f469d[_0xd79a('0x53')]=intUtil[_0xd79a('0x54')](_0x8436a[_0xd79a('0x55')],_0x3f1b77,'\x20');_0x1f469d[_0xd79a('0x56')]=intUtil['getString'](_0x8436a['Descriptions'],_0x3f1b77,'\x0a');if(_0x9b9ba8['enduserType']==='Contacts'){_0x1f469d[_0xd79a('0x57')]={'name':!_['isNil'](_0x9b9ba8['Full_Name'])?_0x9b9ba8['Full_Name']:!_[_0xd79a('0x30')](_0x9b9ba8[_0xd79a('0x58')])?_0x9b9ba8[_0xd79a('0x58')]+'\x20'+_0x9b9ba8[_0xd79a('0x59')]:_0x9b9ba8[_0xd79a('0x59')],'id':_0x9b9ba8['id']};}if(_0x9b9ba8['enduserType']===_0xd79a('0x4d')){_0x1f469d[_0xd79a('0x5a')]={'name':!_[_0xd79a('0x30')](_0x9b9ba8['Full_Name'])?_0x9b9ba8[_0xd79a('0x5b')]:!_[_0xd79a('0x30')](_0x9b9ba8[_0xd79a('0x58')])?_0x9b9ba8['First_Name']+'\x20'+_0x9b9ba8[_0xd79a('0x59')]:_0x9b9ba8[_0xd79a('0x59')],'id':_0x9b9ba8['id']};_0x1f469d[_0xd79a('0x5c')]=_[_0xd79a('0x3f')](_0x9b9ba8[_0xd79a('0x3a')]);}if(_0x3f1b77[_0xd79a('0x5d')]){_0x1f469d['Call_Duration']=moment['utc'](parseInt(_0x3f1b77[_0xd79a('0x5d')])*0x3e8)[_0xd79a('0x2b')](_0xd79a('0x5e'));}else if(_0x3f1b77[_0xd79a('0x5f')]&&_0x3f1b77[_0xd79a('0x60')]){_0x1f469d[_0xd79a('0x61')]=moment[_0xd79a('0x62')](moment(_0x3f1b77[_0xd79a('0x60')],'YYYY-MM-DDTHH:mm:ss')[_0xd79a('0x63')](moment(_0x3f1b77['starttime'],_0xd79a('0x64'))))[_0xd79a('0x2b')]('mm:ss');}switch(_0x3f1b77[_0xd79a('0x65')]){case _0xd79a('0x66'):_0x1f469d[_0xd79a('0x67')]=_0xd79a('0x68');break;case _0xd79a('0x69'):case _0xd79a('0x6a'):_0x1f469d[_0xd79a('0x67')]=_0xd79a('0x6b');break;case _0xd79a('0x6c'):_0x1f469d[_0xd79a('0x67')]='Rejected';break;case _0xd79a('0x6d'):_0x1f469d[_0xd79a('0x67')]=_0xd79a('0x6e');break;case _0xd79a('0x6f'):_0x1f469d[_0xd79a('0x67')]='Timeout';default:}_0x1f469d['Call_Start_Time']=(_0x583a52===_0xd79a('0x70')?moment(_0x3f1b77[_0xd79a('0x71')])[_0xd79a('0x2b')](_0xd79a('0x64')):moment(_0x3f1b77[_0xd79a('0x72')])['format'](_0xd79a('0x64')))||moment()[_0xd79a('0x2b')](_0xd79a('0x64'));_0x1f469d[_0xd79a('0x73')]=_0x583a52||_0xd79a('0x74');_0x1f469d=_[_0xd79a('0x75')](_0x1f469d,getCustomFields(_0x8436a[_0xd79a('0x76')],_0x3f1b77));return request({'method':_0xd79a('0x3c'),'uri':_0xd79a('0x3d')+_0x5ebf19+_0xd79a('0x77'),'headers':{'Authorization':_0xd79a('0x2d')+_0x5e5a48},'body':{'data':[_0x1f469d]},'json':!![]})[_0xd79a('0x25')](function(_0x11ca88){if(_0x11ca88&&_0x11ca88[_0xd79a('0x39')][0x0][_0xd79a('0x44')]==='SUCCESS'){logger[_0xd79a('0x28')](_0xd79a('0x78'));return{'id':_0x11ca88[_0xd79a('0x39')][0x0]['details']['id']};}})[_0xd79a('0x3b')](function(_0x1409da){logger[_0xd79a('0x28')](_0xd79a('0x79'),_0x1409da[_0xd79a('0x27')]);console[_0xd79a('0x47')]('err',_0x1409da);});}exports['queue']=function(_0x36a030,_0x18ef8b,_0x4d56ab,_0x2aca56,_0x108852,_0x254b45){var _0x970077,_0x13e037,_0x7407;_0x254b45[_0xd79a('0x7a')]=intUtil[_0xd79a('0x7b')](_0x254b45[_0xd79a('0x7a')]);_0x254b45[_0xd79a('0x7c')]=intUtil[_0xd79a('0x7b')](_0x254b45['serverUrl']);if(_0x108852&&_0x108852[_0xd79a('0x7d')]){logger[_0xd79a('0x28')]('[QUEUE]','Recording\x20is\x20enabled!');_0x18ef8b['recordingURL']=_0x254b45[_0xd79a('0x7c')]+_0xd79a('0x7e')+_0x18ef8b[_0xd79a('0x7f')]+_0xd79a('0x80')+md5(_0x18ef8b['uniqueid']);}else{_0x18ef8b[_0xd79a('0x81')]='';}var _0x116b46=_0x254b45['host']===_0xd79a('0x82')?'eu':_0xd79a('0x83');return getAccessToken(_0x254b45)[_0xd79a('0x25')](function(_0x32370a){_0x7407=_0x32370a;return getUser(_0x7407,_0x116b46,_0x254b45,_0x2aca56[_0xd79a('0x84')]);})[_0xd79a('0x25')](function(_0x1df32b){_0x970077=_0x1df32b;logger[_0xd79a('0x28')](_0xd79a('0x85'),_0x970077['id']);return getEndUser(_0x7407,_0x116b46,_0x254b45,_0x18ef8b[_0xd79a('0x86')],_0x18ef8b[_0xd79a('0x87')],_0x970077,_0x4d56ab);})[_0xd79a('0x25')](function(_0x189db6){_0x13e037=_0x189db6;return getCall(_0x7407,_0x116b46,_0x254b45,_0x970077,_0x13e037,_0x4d56ab,_0x18ef8b,_0xd79a('0x74'));})[_0xd79a('0x25')](function(_0x10d4de){if(_0x10d4de){logger[_0xd79a('0x28')](_0xd79a('0x88'),_0x10d4de['id']);logger[_0xd79a('0x28')](_0xd79a('0x89'),_0xd79a('0x8a'));emit(util[_0xd79a('0x2b')](_0xd79a('0x8b'),_0x2aca56[_0xd79a('0x19')]),_0xd79a('0x8c'),{'uri':'https://crm.'+_0x254b45['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x10d4de['id']});}})[_0xd79a('0x3b')](function(_0x84c610){logger[_0xd79a('0x36')](_0xd79a('0x89'),JSON[_0xd79a('0xf')](_0x84c610));});};exports[_0xd79a('0x70')]=function(_0x3f591c,_0x282ce8,_0x438d94,_0x4a3fac,_0xda6f8f,_0x21669c,_0xf32156){var _0x2c3eb0,_0x494ca8,_0xc078b0;_0x21669c[_0xd79a('0x7a')]=intUtil[_0xd79a('0x7b')](_0x21669c[_0xd79a('0x7a')]);_0x21669c['serverUrl']=intUtil[_0xd79a('0x7b')](_0x21669c['serverUrl']);if(_0xf32156&&_0xf32156['recordingFormat']&&_0xf32156[_0xd79a('0x8d')]!=='none'){logger['info'](_0xd79a('0x8e'),_0xd79a('0x8f'));_0x282ce8['recordingURL']=_0x21669c[_0xd79a('0x7c')]+_0xd79a('0x7e')+_0x282ce8[_0xd79a('0x7f')]+_0xd79a('0x80')+md5(_0x282ce8['uniqueid']);}var _0x25dd45=_0x21669c[_0xd79a('0x7a')]==='zoho.eu'?'eu':_0xd79a('0x83');return getAccessToken(_0x21669c)[_0xd79a('0x25')](function(_0x5984d4){_0xc078b0=_0x5984d4;return getUser(_0xc078b0,_0x25dd45,_0x21669c,_0x4a3fac['email']);})[_0xd79a('0x25')](function(_0x2bfc73){_0x2c3eb0=_0x2bfc73;logger[_0xd79a('0x28')](_0xd79a('0x85'),_0x2c3eb0['id']);return getEndUser(_0xc078b0,_0x25dd45,_0x21669c,_0x282ce8[_0xd79a('0x90')],_0x282ce8[_0xd79a('0x91')],_0x2c3eb0,_0x438d94);})[_0xd79a('0x25')](function(_0x22b01c){_0x494ca8=_0x22b01c;return getCall(_0xc078b0,_0x25dd45,_0x21669c,_0x2c3eb0,_0x494ca8,_0x438d94,_0x282ce8,_0xd79a('0x92'));})[_0xd79a('0x25')](function(_0x463601){if(_0x463601){logger[_0xd79a('0x28')]('The\x20Call\x20ID\x20is:',_0x463601['id']);logger[_0xd79a('0x28')]('[OUTBOUND]',_0xd79a('0x8a'));emit(util[_0xd79a('0x2b')](_0xd79a('0x8b'),_0x4a3fac['name']),_0xd79a('0x8c'),{'uri':_0xd79a('0x93')+_0x21669c['host']+_0xd79a('0x94')+_0x463601['id']});}})[_0xd79a('0x3b')](function(_0x16b524){logger[_0xd79a('0x36')](_0xd79a('0x8e'),JSON[_0xd79a('0xf')](_0x16b524));});};exports[_0xd79a('0x95')]=function(_0x4914d5,_0x27b524,_0x21984,_0x5ada11,_0x1a4ac9,_0x43fe95){var _0x5a8b0b,_0x293e77,_0x3f9efb;_0x43fe95['host']=intUtil[_0xd79a('0x7b')](_0x43fe95[_0xd79a('0x7a')]);_0x43fe95[_0xd79a('0x7c')]=intUtil[_0xd79a('0x7b')](_0x43fe95[_0xd79a('0x7c')]);if(_0x1a4ac9&&_0x1a4ac9['monitor_format']){logger[_0xd79a('0x28')]('['+_0x27b524[_0xd79a('0x65')]['toUpperCase']()+']',_0xd79a('0x8f'));_0x27b524[_0xd79a('0x81')]=_0x43fe95[_0xd79a('0x7c')]+_0xd79a('0x7e')+_0x27b524[_0xd79a('0x7f')]+_0xd79a('0x80')+md5(_0x27b524[_0xd79a('0x7f')]);}else{_0x27b524[_0xd79a('0x81')]='';}var _0x42fe73=_0x43fe95[_0xd79a('0x7a')]===_0xd79a('0x82')?'eu':'com';return getAccessToken(_0x43fe95)['then'](function(_0x426ade){_0x3f9efb=_0x426ade;return getUser(_0x3f9efb,_0x42fe73,_0x43fe95);})['then'](function(_0x14e97b){_0x5a8b0b=_0x14e97b;logger['info'](_0xd79a('0x85'),_0x5a8b0b['id']);return getEndUser(_0x3f9efb,_0x42fe73,_0x43fe95,_0x27b524[_0xd79a('0x86')],_0x27b524[_0xd79a('0x87')],_0x5a8b0b,_0x21984);})[_0xd79a('0x25')](function(_0x337d5a){_0x293e77=_0x337d5a;return getCall(_0x3f9efb,_0x42fe73,_0x43fe95,_0x5a8b0b,_0x293e77,_0x21984,_0x27b524,'Inbound');})[_0xd79a('0x25')](function(_0x4e2ab6){if(_0x4e2ab6){logger[_0xd79a('0x28')]('The\x20Call\x20ID\x20is:',_0x4e2ab6['id']);}})['catch'](function(_0x540a47){logger[_0xd79a('0x36')]('['+_0x27b524[_0xd79a('0x65')][_0xd79a('0x96')]()+']',JSON[_0xd79a('0xf')](_0x540a47));});}; \ No newline at end of file +var _0x578c=['queue','stripTrailingSlash','host','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','seconds','catch','error','stack','info','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','first_name','last_name','data','enduserType','Error:\x20','log','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','nothing','Creating\x20new\x20call...','Owner','role','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','format','Call_Type','Inbound','merge','/crm/v2/Calls','code','SUCCESS','details','err'];(function(_0x156410,_0x2adb1d){var _0x57f584=function(_0x4d55c5){while(--_0x4d55c5){_0x156410['push'](_0x156410['shift']());}};_0x57f584(++_0x2adb1d);}(_0x578c,0x158));var _0xc578=function(_0x150e10,_0x34fa79){_0x150e10=_0x150e10-0x0;var _0x1e3a66=_0x578c[_0x150e10];return _0x1e3a66;};'use strict';var _=require(_0xc578('0x0'));var rp=require(_0xc578('0x1'));var md5=require(_0xc578('0x2'));var util=require('util');var intUtil=require(_0xc578('0x3'));var moment=require(_0xc578('0x4'));var Redis=require(_0xc578('0x5'));var BPromise=require('bluebird');var config=require(_0xc578('0x6'));var logger=require(_0xc578('0x7'))(_0xc578('0x8'));config[_0xc578('0x9')]=_[_0xc578('0xa')](config[_0xc578('0x9')],{'host':_0xc578('0xb'),'port':0x18eb});var io=require(_0xc578('0xc'))(new Redis(config[_0xc578('0x9')]));function emit(_0x258f93,_0x1b6291,_0x24628f){io['to'](_0x258f93)[_0xc578('0xd')](_0x1b6291,_0x24628f);}function request(_0xaa68b3){logger['debug']('[HTTP]',JSON[_0xc578('0xe')](_0xaa68b3));return rp(_0xaa68b3);}function getCustomFields(_0x4fded8,_0x3394d7){var _0x9a3a12={};if(_0x4fded8[_0xc578('0xf')]>0x0){_['forEach'](_0x4fded8,function(_0x47486d){if(_0x47486d[_0xc578('0x10')]===_0xc578('0x11')&&_0x47486d['idField']){_0x9a3a12[_0x47486d[_0xc578('0x12')]]=_0x47486d[_0xc578('0x13')][_0xc578('0x14')]();}else if(_0x47486d[_0xc578('0x10')]===_0xc578('0x15')&&_0x47486d['variableName']&&_0x47486d[_0xc578('0x12')]&&_0x3394d7[_0x47486d[_0xc578('0x16')]]){_0x9a3a12[_0x47486d[_0xc578('0x12')]]=_0x3394d7[_0x47486d[_0xc578('0x16')]][_0xc578('0x14')]();}else if(_0x47486d[_0xc578('0x10')]===_0xc578('0x17')&&_0x47486d[_0xc578('0x18')]&&_0x47486d[_0xc578('0x18')][_0xc578('0x19')]&&_0x47486d[_0xc578('0x12')]&&_0x3394d7[_0x47486d[_0xc578('0x18')][_0xc578('0x19')][_0xc578('0x1a')]()]){_0x9a3a12[_0x47486d[_0xc578('0x12')]]=_0x3394d7[_0x47486d[_0xc578('0x18')][_0xc578('0x19')][_0xc578('0x1a')]()]['toString']();}});}return _0x9a3a12;}function getName(_0x13b317){if(_0x13b317[_0xc578('0x1b')]('\x20')>0x0){var _0x198a54=_0x13b317[_0xc578('0x1c')](/ (.+)/);if(_0x198a54[0x1]){return _0x198a54;}}return[_0x13b317,_0x13b317];}var accountsTokens={};function getAccessToken(_0x48df07){return new Promise(function(_0x29284c,_0x3e6213){if(!_[_0xc578('0x1d')](accountsTokens[_0x48df07['id']])&&!_['isNil'](accountsTokens[_0x48df07['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x48df07['id']][_0xc578('0x1e')])){_0x29284c(accountsTokens[_0x48df07['id']][_0xc578('0x1f')]);}}var _0x2d9a76;switch(_0x48df07[_0xc578('0x20')]){case'US':_0x2d9a76=_0xc578('0x21');break;case'AU':_0x2d9a76='https://accounts.zoho.com.au';break;case'EU':_0x2d9a76=_0xc578('0x22');break;case'IN':_0x2d9a76=_0xc578('0x23');break;case'CN':_0x2d9a76=_0xc578('0x24');break;default:_0x2d9a76='https://accounts.zoho.eu';break;}var _0x23b202={'method':'POST','uri':_0x2d9a76+'/oauth/v2/token','qs':{'refresh_token':_0x48df07[_0xc578('0x25')],'client_id':_0x48df07[_0xc578('0x26')],'client_secret':_0x48df07[_0xc578('0x27')],'grant_type':_0xc578('0x28')},'json':!![]};return rp(_0x23b202)['then'](function(_0x45593d){accountsTokens[_0x48df07['id']]={'access_token':_0x45593d[_0xc578('0x1f')],'expires_in':moment()['add'](_0x45593d[_0xc578('0x1e')],_0xc578('0x29'))};_0x29284c(_0x45593d['access_token']);})[_0xc578('0x2a')](function(_0x5141ac){logger[_0xc578('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x5141ac[_0xc578('0x2c')]);_0x3e6213(_0x5141ac);});});}function getUser(_0x9474f7,_0x5398f7,_0x5d0023,_0x5eeee1){logger[_0xc578('0x2d')](_0xc578('0x2e'));return request({'method':_0xc578('0x2f'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x5398f7),'qs':{'type':_0xc578('0x30')},'headers':{'Authorization':_0xc578('0x31')+_0x9474f7},'json':!![]})[_0xc578('0x32')](function(_0x169586){if(_0x169586[_0xc578('0x33')]){var _0x313c01=-0x1;if(_[_0xc578('0x34')](_0x169586['users'])){if(!_[_0xc578('0x1d')](_0x5eeee1)){_0x313c01=_[_0xc578('0x35')](_0x169586[_0xc578('0x33')],function(_0x2c0fc9){return _0x2c0fc9[_0xc578('0x36')]===_0x5eeee1;});}if(_0x313c01>=0x0){logger[_0xc578('0x2d')](_0xc578('0x37'));}else{logger[_0xc578('0x2d')](_0xc578('0x38'));_0x313c01=_[_0xc578('0x35')](_0x169586[_0xc578('0x33')],function(_0x3ac265){return _0x3ac265[_0xc578('0x39')][_0xc578('0x19')]===_0xc578('0x3a');});}return _0x169586[_0xc578('0x33')][_0x313c01];}else{if(_0x169586[_0xc578('0x3b')][_0xc578('0x39')][_0xc578('0x19')]==='Administrator'){logger[_0xc578('0x2d')](_0xc578('0x38'));user=_0x169586[_0xc578('0x3b')];return user;}else{logger[_0xc578('0x2b')](_0xc578('0x3c'),JSON[_0xc578('0xe')](_0x169586));throw new Error(_0xc578('0x3d')+JSON[_0xc578('0xe')](_0x169586));}}}else{logger[_0xc578('0x2b')](_0xc578('0x3c'),JSON['stringify'](_0x169586));throw new Error(_0xc578('0x3d')+JSON[_0xc578('0xe')](_0x169586));}})[_0xc578('0x2a')](function(_0x38dcf3){console[_0xc578('0x2b')](_0x38dcf3);});}function getZohoUser(_0x4c93b4,_0x29e20d){return new BPromise(function(_0x51767d,_0x37c9a4){request(_0x4c93b4)[_0xc578('0x32')](function(_0x323a8a){var _0x4799fb=null;if(_0x323a8a){_0x4799fb=_0x323a8a['data'][0x0];_0x4799fb['enduserType']=_0x29e20d;}_0x51767d(_0x4799fb);})[_0xc578('0x2a')](function(_0x605d5d){_0x37c9a4(_0x605d5d);});});}function createEndUser(_0x8bafa5,_0x16142d,_0xe26db7,_0x38ec41,_0x5d03e4,_0x402e76){var _0xe26db7=getName(_0xe26db7);return request({'method':_0xc578('0x3e'),'uri':_0xc578('0x3f')+_0x16142d+_0xc578('0x40')+_[_0xc578('0x41')](_0x402e76[_0xc578('0x42')])+'s','body':{'data':[{'Last_Name':_0xe26db7[0x1],'First_Name':_0xe26db7[0x0],'Phone':_0x38ec41,'Owner':{'name':!_[_0xc578('0x1d')](_0x5d03e4['role'][_0xc578('0x19')])?_0x5d03e4['role'][_0xc578('0x19')]:!_['isNil'](_0x5d03e4[_0xc578('0x43')])?_0x5d03e4[_0xc578('0x43')]+'\x20'+_0x5d03e4[_0xc578('0x44')]:_0x5d03e4['last_name'],'id':_0x5d03e4['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x8bafa5},'json':!![]})[_0xc578('0x32')](function(_0x43349f){if(_0x43349f&&_0x43349f[_0xc578('0x45')][0x0]['code']==='SUCCESS'){var _0x14d110=_0x43349f[_0xc578('0x45')][0x0]['details'];_0x14d110[_0xc578('0x46')]=_[_0xc578('0x41')](_0x402e76[_0xc578('0x42')])+'s';return _0x14d110;}logger[_0xc578('0x2b')](_0xc578('0x3c'),JSON[_0xc578('0xe')](data));throw new Error(_0xc578('0x47')+JSON[_0xc578('0xe')](data));})[_0xc578('0x2a')](function(_0x5bc8af){console[_0xc578('0x48')]('CREATE\x20ERROR',_0x5bc8af);});}function getEndUser(_0x31cfcd,_0x520d87,_0x21101f,_0xbfc7cf,_0x1bd93f,_0x332384,_0x422394){var _0x59ad7b={'method':_0xc578('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x31cfcd},'json':!![]};switch(_0x422394[_0xc578('0x49')]){case _0xc578('0x4a'):_0x59ad7b[_0xc578('0x4b')]=_0xc578('0x3f')+_0x520d87+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1bd93f+'))';return getZohoUser(_0x59ad7b,_0xc578('0x4c'))[_0xc578('0x32')](function(_0x296b52){if(_0x296b52)return _0x296b52;_0x59ad7b[_0xc578('0x4b')]=_0xc578('0x3f')+_0x520d87+_0xc578('0x4d')+_0x1bd93f+'))';return getZohoUser(_0x59ad7b,'Leads')[_0xc578('0x32')](function(_0x12fa96){if(_0x12fa96)return _0x12fa96;if(_0x422394[_0xc578('0x42')]!='nothing'){return createEndUser(_0x31cfcd,_0x520d87,_0xbfc7cf,_0x1bd93f,_0x332384,_0x422394);}else{return{};}});});break;case _0xc578('0x4e'):_0x59ad7b[_0xc578('0x4b')]=_0xc578('0x3f')+_0x520d87+_0xc578('0x4f')+_0x1bd93f+'))';return getZohoUser(_0x59ad7b,_0xc578('0x4c'))['then'](function(_0x2b88d9){if(_0x2b88d9)return _0x2b88d9;if(_0x422394[_0xc578('0x42')]!='nothing'){return createEndUser(_0x31cfcd,_0x520d87,_0xbfc7cf,_0x1bd93f,_0x332384,_0x422394);}else{return{};}});break;case _0xc578('0x50'):_0x59ad7b[_0xc578('0x4b')]=_0xc578('0x3f')+_0x520d87+_0xc578('0x4d')+_0x1bd93f+'))';return getZohoUser(_0x59ad7b,_0xc578('0x51'))[_0xc578('0x32')](function(_0x2236ea){if(_0x2236ea)return _0x2236ea;if(_0x422394['moduleCreate']!=_0xc578('0x52')){return createEndUser(_0x31cfcd,_0x520d87,_0xbfc7cf,_0x1bd93f,_0x332384,_0x422394);}else{return{};}});break;}}function getCall(_0x11e979,_0x1698b0,_0x213200,_0x23da7d,_0x4ae075,_0x134cf5,_0x5ac565,_0x12163f){logger[_0xc578('0x2d')](_0xc578('0x53'));var _0x5df6e0={};_0x5df6e0[_0xc578('0x54')]={'name':!_[_0xc578('0x1d')](_0x23da7d[_0xc578('0x55')][_0xc578('0x19')])&&!_[_0xc578('0x1d')](_0x23da7d[_0xc578('0x39')][_0xc578('0x19')])&&_0x23da7d['profile'][_0xc578('0x19')]==='administrator'?_0x23da7d['role'][_0xc578('0x19')]:!_[_0xc578('0x1d')](_0x23da7d[_0xc578('0x43')])?_0x23da7d['first_name']+'\x20'+_0x23da7d[_0xc578('0x44')]:_0x23da7d['last_name'],'id':_0x23da7d['id']};_0x5df6e0[_0xc578('0x56')]=intUtil[_0xc578('0x57')](_0x134cf5[_0xc578('0x58')],_0x5ac565,'\x20');_0x5df6e0[_0xc578('0x59')]=intUtil[_0xc578('0x57')](_0x134cf5[_0xc578('0x5a')],_0x5ac565,'\x0a');if(_0x4ae075['enduserType']===_0xc578('0x4c')){_0x5df6e0['Who_Id']={'name':!_[_0xc578('0x1d')](_0x4ae075[_0xc578('0x5b')])?_0x4ae075['Full_Name']:!_[_0xc578('0x1d')](_0x4ae075['First_Name'])?_0x4ae075[_0xc578('0x5c')]+'\x20'+_0x4ae075[_0xc578('0x5d')]:_0x4ae075[_0xc578('0x5d')],'id':_0x4ae075['id']};}if(_0x4ae075['enduserType']==='Leads'){_0x5df6e0[_0xc578('0x5e')]={'name':!_[_0xc578('0x1d')](_0x4ae075[_0xc578('0x5b')])?_0x4ae075[_0xc578('0x5b')]:!_[_0xc578('0x1d')](_0x4ae075[_0xc578('0x5c')])?_0x4ae075[_0xc578('0x5c')]+'\x20'+_0x4ae075[_0xc578('0x5d')]:_0x4ae075[_0xc578('0x5d')],'id':_0x4ae075['id']};_0x5df6e0[_0xc578('0x5f')]=_['startCase'](_0x4ae075[_0xc578('0x46')]);}if(_0x5ac565[_0xc578('0x60')]){_0x5df6e0[_0xc578('0x61')]=moment[_0xc578('0x62')](parseInt(_0x5ac565[_0xc578('0x60')])*0x3e8)['format'](_0xc578('0x63'));}else if(_0x5ac565[_0xc578('0x64')]&&_0x5ac565[_0xc578('0x65')]){_0x5df6e0['Call_Duration']=moment['utc'](moment(_0x5ac565[_0xc578('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0xc578('0x66')](moment(_0x5ac565[_0xc578('0x67')],_0xc578('0x68'))))['format'](_0xc578('0x63'));}switch(_0x5ac565[_0xc578('0x69')]){case _0xc578('0x6a'):_0x5df6e0[_0xc578('0x6b')]='Called';break;case _0xc578('0x6c'):case _0xc578('0x6d'):_0x5df6e0[_0xc578('0x6b')]=_0xc578('0x6e');break;case _0xc578('0x6f'):_0x5df6e0['Call_Result']=_0xc578('0x70');break;case _0xc578('0x71'):_0x5df6e0['Call_Result']=_0xc578('0x72');break;case _0xc578('0x73'):_0x5df6e0['Call_Result']=_0xc578('0x74');default:}_0x5df6e0['Call_Start_Time']=(_0x12163f===_0xc578('0x75')?moment(_0x5ac565['starttime'])[_0xc578('0x76')](_0xc578('0x68')):moment(_0x5ac565['agentcalledAt'])['format'](_0xc578('0x68')))||moment()[_0xc578('0x76')](_0xc578('0x68'));_0x5df6e0[_0xc578('0x77')]=_0x12163f||_0xc578('0x78');_0x5df6e0=_[_0xc578('0x79')](_0x5df6e0,getCustomFields(_0x134cf5['Fields'],_0x5ac565));return request({'method':_0xc578('0x3e'),'uri':'https://www.zohoapis.'+_0x1698b0+_0xc578('0x7a'),'headers':{'Authorization':_0xc578('0x31')+_0x11e979},'body':{'data':[_0x5df6e0]},'json':!![]})['then'](function(_0x20cd82){if(_0x20cd82&&_0x20cd82[_0xc578('0x45')][0x0][_0xc578('0x7b')]===_0xc578('0x7c')){logger['info']('Call\x20created!');return{'id':_0x20cd82[_0xc578('0x45')][0x0][_0xc578('0x7d')]['id']};}})[_0xc578('0x2a')](function(_0x19de7e){logger[_0xc578('0x2d')](_0xc578('0x7e'),_0x19de7e[_0xc578('0x2c')]);console[_0xc578('0x48')](_0xc578('0x7e'),_0x19de7e);});}exports[_0xc578('0x7f')]=function(_0x255e67,_0x8c449,_0xbcd558,_0x40119a,_0x164254,_0x297d0b){var _0x15a501,_0xf1621b,_0x11a961;_0x297d0b['host']=intUtil[_0xc578('0x80')](_0x297d0b[_0xc578('0x81')]);_0x297d0b[_0xc578('0x82')]=intUtil[_0xc578('0x80')](_0x297d0b[_0xc578('0x82')]);if(_0x164254&&_0x164254[_0xc578('0x83')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x8c449[_0xc578('0x84')]=_0x297d0b[_0xc578('0x82')]+_0xc578('0x85')+_0x8c449[_0xc578('0x86')]+_0xc578('0x87')+md5(_0x8c449['uniqueid']);}else{_0x8c449[_0xc578('0x84')]='';}var _0x21059c=_0x297d0b['host']===_0xc578('0x88')?'eu':_0xc578('0x89');return getAccessToken(_0x297d0b)[_0xc578('0x32')](function(_0x3a21c2){_0x11a961=_0x3a21c2;return getUser(_0x11a961,_0x21059c,_0x297d0b,_0x40119a[_0xc578('0x36')]);})[_0xc578('0x32')](function(_0x4410f9){_0x15a501=_0x4410f9;logger['info'](_0xc578('0x8a'),_0x15a501['id']);return getEndUser(_0x11a961,_0x21059c,_0x297d0b,_0x8c449[_0xc578('0x8b')],_0x8c449[_0xc578('0x8c')],_0x15a501,_0xbcd558);})['then'](function(_0x58ba22){_0xf1621b=_0x58ba22;return getCall(_0x11a961,_0x21059c,_0x297d0b,_0x15a501,_0xf1621b,_0xbcd558,_0x8c449,'Inbound');})[_0xc578('0x32')](function(_0x59b110){if(_0x59b110){logger[_0xc578('0x2d')](_0xc578('0x8d'),_0x59b110['id']);logger[_0xc578('0x2d')](_0xc578('0x8e'),_0xc578('0x8f'));emit(util[_0xc578('0x76')](_0xc578('0x90'),_0x40119a[_0xc578('0x19')]),_0xc578('0x91'),{'uri':'https://crm.'+_0x297d0b[_0xc578('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x59b110['id']});}})[_0xc578('0x2a')](function(_0x53329b){logger['error'](_0xc578('0x8e'),JSON[_0xc578('0xe')](_0x53329b));});};exports[_0xc578('0x75')]=function(_0x1088ee,_0x541a4a,_0x2de03d,_0x1dc1df,_0x139cf1,_0x54623f,_0x3414a9){var _0x423afc,_0x2c0827,_0x2a1fd3;_0x54623f[_0xc578('0x81')]=intUtil[_0xc578('0x80')](_0x54623f['host']);_0x54623f['serverUrl']=intUtil[_0xc578('0x80')](_0x54623f[_0xc578('0x82')]);if(_0x3414a9&&_0x3414a9[_0xc578('0x92')]&&_0x3414a9['recordingFormat']!==_0xc578('0x93')){logger[_0xc578('0x2d')]('[OUTBOUND]',_0xc578('0x94'));_0x541a4a['recordingURL']=_0x54623f[_0xc578('0x82')]+_0xc578('0x85')+_0x541a4a[_0xc578('0x86')]+_0xc578('0x87')+md5(_0x541a4a[_0xc578('0x86')]);}var _0x4d20c7=_0x54623f[_0xc578('0x81')]===_0xc578('0x88')?'eu':_0xc578('0x89');return getAccessToken(_0x54623f)[_0xc578('0x32')](function(_0x255732){_0x2a1fd3=_0x255732;return getUser(_0x2a1fd3,_0x4d20c7,_0x54623f,_0x1dc1df[_0xc578('0x36')]);})[_0xc578('0x32')](function(_0x777dae){_0x423afc=_0x777dae;logger[_0xc578('0x2d')]('The\x20User\x20ID\x20is:',_0x423afc['id']);return getEndUser(_0x2a1fd3,_0x4d20c7,_0x54623f,_0x541a4a[_0xc578('0x95')],_0x541a4a[_0xc578('0x96')],_0x423afc,_0x2de03d);})[_0xc578('0x32')](function(_0x2ae2af){_0x2c0827=_0x2ae2af;return getCall(_0x2a1fd3,_0x4d20c7,_0x54623f,_0x423afc,_0x2c0827,_0x2de03d,_0x541a4a,_0xc578('0x97'));})[_0xc578('0x32')](function(_0x521413){if(_0x521413){logger[_0xc578('0x2d')]('The\x20Call\x20ID\x20is:',_0x521413['id']);logger[_0xc578('0x2d')](_0xc578('0x98'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc578('0x76')]('user:%s',_0x1dc1df['name']),_0xc578('0x91'),{'uri':_0xc578('0x99')+_0x54623f[_0xc578('0x81')]+_0xc578('0x9a')+_0x521413['id']});}})[_0xc578('0x2a')](function(_0x386abd){logger[_0xc578('0x2b')](_0xc578('0x98'),JSON[_0xc578('0xe')](_0x386abd));});};exports[_0xc578('0x9b')]=function(_0x1ff02c,_0x1ef8f9,_0x3a5006,_0x5606ac,_0x2f28d5,_0x356f31){var _0x37c840,_0x22cc9d,_0x5bab3c;_0x356f31['host']=intUtil[_0xc578('0x80')](_0x356f31['host']);_0x356f31[_0xc578('0x82')]=intUtil[_0xc578('0x80')](_0x356f31[_0xc578('0x82')]);if(_0x2f28d5&&_0x2f28d5[_0xc578('0x83')]){logger[_0xc578('0x2d')]('['+_0x1ef8f9[_0xc578('0x69')][_0xc578('0x9c')]()+']',_0xc578('0x94'));_0x1ef8f9[_0xc578('0x84')]=_0x356f31[_0xc578('0x82')]+_0xc578('0x85')+_0x1ef8f9['uniqueid']+_0xc578('0x87')+md5(_0x1ef8f9[_0xc578('0x86')]);}else{_0x1ef8f9[_0xc578('0x84')]='';}var _0x556046=_0x356f31[_0xc578('0x81')]===_0xc578('0x88')?'eu':_0xc578('0x89');return getAccessToken(_0x356f31)[_0xc578('0x32')](function(_0x3deb53){_0x5bab3c=_0x3deb53;return getUser(_0x5bab3c,_0x556046,_0x356f31);})[_0xc578('0x32')](function(_0x5612ab){_0x37c840=_0x5612ab;logger[_0xc578('0x2d')](_0xc578('0x8a'),_0x37c840['id']);return getEndUser(_0x5bab3c,_0x556046,_0x356f31,_0x1ef8f9[_0xc578('0x8b')],_0x1ef8f9[_0xc578('0x8c')],_0x37c840,_0x3a5006);})[_0xc578('0x32')](function(_0x2569bf){_0x22cc9d=_0x2569bf;return getCall(_0x5bab3c,_0x556046,_0x356f31,_0x37c840,_0x22cc9d,_0x3a5006,_0x1ef8f9,_0xc578('0x78'));})[_0xc578('0x32')](function(_0x5d5a0f){if(_0x5d5a0f){logger['info'](_0xc578('0x8d'),_0x5d5a0f['id']);}})['catch'](function(_0x3e5c3d){logger[_0xc578('0x2b')]('['+_0x1ef8f9[_0xc578('0x69')][_0xc578('0x9c')]()+']',JSON[_0xc578('0xe')](_0x3e5c3d));});}; \ 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 06d5416..766de2d 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x5f2b2c,_0x5c2604){var _0x2a0c16=function(_0x20fc03){while(--_0x20fc03){_0x5f2b2c['push'](_0x5f2b2c['shift']());}};_0x2a0c16(++_0x5c2604);}(_0x7a54,0x106));var _0x47a5=function(_0xb11170,_0x4db7aa){_0xb11170=_0xb11170-0x0;var _0x33dfc0=_0x7a54[_0xb11170];return _0x33dfc0;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x57ec45,_0x2a3db5){var _0x98945=function(_0x48fb31){while(--_0x48fb31){_0x57ec45['push'](_0x57ec45['shift']());}};_0x98945(++_0x2a3db5);}(_0x7a54,0x106));var _0x47a5=function(_0x1a654b,_0x1358df){_0x1a654b=_0x1a654b-0x0;var _0x6ce5b3=_0x7a54[_0x1a654b];return _0x6ce5b3;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 8b7205a..a879461 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x1f3964,_0x19cb7a){var _0x34a670=function(_0x1c7442){while(--_0x1c7442){_0x1f3964['push'](_0x1f3964['shift']());}};_0x34a670(++_0x19cb7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x14f21c,_0x315b28){_0x14f21c=_0x14f21c-0x0;var _0x2b509b=_0xb10b[_0x14f21c];return _0x2b509b;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x524eb8,_0x6392dd){var _0x26a441=function(_0x597cf2){while(--_0x597cf2){_0x524eb8['push'](_0x524eb8['shift']());}};_0x26a441(++_0x6392dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x308375,_0x3a93cc){_0x308375=_0x308375-0x0;var _0x18d40c=_0xb10b[_0x308375];return _0x18d40c;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index cf4ad4b..5d1af7c 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 _0x2e8a=['debug','routing','error','rpc','message','result','catch','bluebird','../../config/logger','client','http','then'];(function(_0x2154b0,_0x5ae1e6){var _0x47b74d=function(_0x5a9936){while(--_0x5a9936){_0x2154b0['push'](_0x2154b0['shift']());}};_0x47b74d(++_0x5ae1e6);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x47c39a,_0x165a5d){_0x47c39a=_0x47c39a-0x0;var _0x590928=_0x2e8a[_0x47c39a];return _0x590928;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('routing');var client=jayson[_0xa2e8('0x2')][_0xa2e8('0x3')]({'port':0x2329});client['Request']=function(_0x426f9e,_0x522e76){return new BPromise(function(_0x492531,_0x4efec7){return client['request'](_0x426f9e,_0x522e76)[_0xa2e8('0x4')](function(_0x32fb35){logger[_0xa2e8('0x5')]('rpc',_0xa2e8('0x6'),_0x426f9e,_0x522e76,_0x32fb35);if(_0x32fb35[_0xa2e8('0x7')]){logger[_0xa2e8('0x7')](_0xa2e8('0x8'),'routing',_0x426f9e,_0x32fb35[_0xa2e8('0x7')]['message'],_0x522e76);return _0x4efec7(_0x32fb35[_0xa2e8('0x7')][_0xa2e8('0x9')]);}else{return _0x492531(_0x32fb35[_0xa2e8('0xa')]);}})[_0xa2e8('0xb')](function(_0x1d8b32){logger['error'](_0xa2e8('0x8'),_0xa2e8('0x6'),_0x426f9e,_0x1d8b32,_0x522e76);return _0x4efec7(_0x1d8b32);});});};module['exports']=client; \ No newline at end of file +var _0x1cc7=['rpc','routing','error','message','exports','jayson/promise','bluebird','../../config/logger','Request','then','debug'];(function(_0x20ccc8,_0xae5880){var _0xc16803=function(_0x342bc7){while(--_0x342bc7){_0x20ccc8['push'](_0x20ccc8['shift']());}};_0xc16803(++_0xae5880);}(_0x1cc7,0x15a));var _0x71cc=function(_0x51eff7,_0x27578c){_0x51eff7=_0x51eff7-0x0;var _0x20df78=_0x1cc7[_0x51eff7];return _0x20df78;};'use strict';var jayson=require(_0x71cc('0x0'));var BPromise=require(_0x71cc('0x1'));var logger=require(_0x71cc('0x2'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x71cc('0x3')]=function(_0x1fac93,_0x402191){return new BPromise(function(_0x5431e1,_0x5dfed9){return client['request'](_0x1fac93,_0x402191)[_0x71cc('0x4')](function(_0x4ecf81){logger[_0x71cc('0x5')](_0x71cc('0x6'),_0x71cc('0x7'),_0x1fac93,_0x402191,_0x4ecf81);if(_0x4ecf81[_0x71cc('0x8')]){logger[_0x71cc('0x8')]('rpc',_0x71cc('0x7'),_0x1fac93,_0x4ecf81[_0x71cc('0x8')][_0x71cc('0x9')],_0x402191);return _0x5dfed9(_0x4ecf81['error']['message']);}else{return _0x5431e1(_0x4ecf81['result']);}})['catch'](function(_0xeb4747){logger[_0x71cc('0x8')](_0x71cc('0x6'),'routing',_0x1fac93,_0xeb4747,_0x402191);return _0x5dfed9(_0xeb4747);});});};module[_0x71cc('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d8e89e0..46bf23b 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 _0x647c=['catch','log','bluebird','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x55b6fa,_0x8a977a){var _0x41d44f=function(_0x39b9b9){while(--_0x39b9b9){_0x55b6fa['push'](_0x55b6fa['shift']());}};_0x41d44f(++_0x8a977a);}(_0x647c,0x1d3));var _0xc647=function(_0x270061,_0x4e41e1){_0x270061=_0x270061-0x0;var _0x329604=_0x647c[_0x270061];return _0x329604;};'use strict';var BPromise=require(_0xc647('0x0'));var server=require('./server');var Realtime=require(_0xc647('0x1'));var EmailChannel=require(_0xc647('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xc647('0x3'))['db'];function initRealtime(){return BPromise[_0xc647('0x4')]()[_0xc647('0x5')](mailAccount[_0xc647('0x6')]())[_0xc647('0x5')](realtime['initMailAccounts']())[_0xc647('0x5')](function(){email[_0xc647('0x7')](realtime[_0xc647('0x8')]);return realtime;});}function main(){return server[_0xc647('0x9')](realtime,email)[_0xc647('0x5')](function(_0x2d63e8){return initRealtime();})['then'](function(_0x5b91af){return db[_0xc647('0xa')][_0xc647('0xb')]({'attributes':['id',_0xc647('0xc')],'raw':!![]});})['then'](function(_0x3ba0ca){return setInterval(initRealtime,_0x3ba0ca[_0xc647('0xc')]*0x3e8);})[_0xc647('0xd')](function(_0x457bb1){console[_0xc647('0xe')](_0x457bb1);});}main(); \ No newline at end of file +var _0x4148=['findOne','loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','mailAccounts','Setting'];(function(_0x5d0e93,_0x46a5e6){var _0x31890a=function(_0x33f8b0){while(--_0x33f8b0){_0x5d0e93['push'](_0x5d0e93['shift']());}};_0x31890a(++_0x46a5e6);}(_0x4148,0xc6));var _0x8414=function(_0x45c536,_0x52a556){_0x45c536=_0x45c536-0x0;var _0x10e06d=_0x4148[_0x45c536];return _0x10e06d;};'use strict';var BPromise=require(_0x8414('0x0'));var server=require(_0x8414('0x1'));var Realtime=require(_0x8414('0x2'));var EmailChannel=require(_0x8414('0x3'));var mailAccount=require(_0x8414('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x8414('0x5')]()[_0x8414('0x6')](mailAccount[_0x8414('0x7')]())[_0x8414('0x6')](realtime['initMailAccounts']())[_0x8414('0x6')](function(){email['refresh'](realtime[_0x8414('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x131b88){return initRealtime();})[_0x8414('0x6')](function(_0x1623c3){return db[_0x8414('0x9')][_0x8414('0xa')]({'attributes':['id',_0x8414('0xb')],'raw':!![]});})[_0x8414('0x6')](function(_0x1c102a){return setInterval(initRealtime,_0x1c102a[_0x8414('0xb')]*0x3e8);})[_0x8414('0xc')](function(_0x9e85e1){console['log'](_0x9e85e1);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 417afa3..0061e36 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 _0xade7=['defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','messageStatus','total','mailAccount:update','refresh','hasOwnProperty','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','isNil','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','stringify','sendMail','send','verifySmtp','lastSync','smtp','verify','Smtp','verified','exports','lodash','md5','ioredis','../../../config/logger','email','redis'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xade7,0xd2));var _0x7ade=function(_0x5c84b3,_0x20fd99){_0x5c84b3=_0x5c84b3-0x0;var _0x1b07b4=_0xade7[_0x5c84b3];return _0x1b07b4;};'use strict';var _=require(_0x7ade('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x7ade('0x1'));var Redis=require(_0x7ade('0x2'));var config=require('../../../config/environment');var logger=require(_0x7ade('0x3'))(_0x7ade('0x4'));config[_0x7ade('0x5')]=_[_0x7ade('0x6')](config[_0x7ade('0x5')],{'host':_0x7ade('0x7'),'port':0x18eb});var io=require(_0x7ade('0x8'))(new Redis(config[_0x7ade('0x5')]));var EmailImap=require(_0x7ade('0x9'));var EmailSmtp=require(_0x7ade('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x564e1d){logger['info'](_0x7ade('0xb'));this[_0x7ade('0xc')]=_0x564e1d['mailAccounts'];this[_0x7ade('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7ade('0xe')][_0x7ade('0xf')]=function(_0xaed127){var _0x2c508a=this['mailAccounts'][_0xaed127];var _0x4cf41f={'id':_0x2c508a['id'],'name':_0x2c508a[_0x7ade('0x10')],'key':_0x2c508a[_0x7ade('0x11')],'active':_0x2c508a[_0x7ade('0x12')],'Imap':{'status':_0x2c508a[_0x7ade('0x13')]['status'],'messageStatus':_0x2c508a['Imap'][_0x7ade('0x14')],'total':_0x2c508a['Imap'][_0x7ade('0x15')]}};if(_['isNil'](md5Accounts[_0xaed127])){md5Accounts[_0xaed127]={};}var _0x3048e9=md5(JSON['stringify'](_0x4cf41f));if(md5Accounts[_0xaed127][_0x7ade('0x1')]!==_0x3048e9){md5Accounts[_0xaed127]['md5']=_0x3048e9;io[_0x7ade('0xf')](_0x7ade('0x16'),_0x4cf41f);}};EmailChannel[_0x7ade('0xe')][_0x7ade('0x17')]=function(_0x5ca4f2){for(var _0x5162de in _0x5ca4f2){if(_0x5ca4f2[_0x7ade('0x18')](_0x5162de)){if(_0x5ca4f2[_0x5162de]['Imap']&&_0x5ca4f2[_0x5162de][_0x7ade('0x12')]){var _0x4f11b9=_0x5ca4f2[_0x5162de][_0x7ade('0x13')];if(!this[_0x7ade('0xd')][_0x7ade('0x18')](_0x4f11b9['id'])){this[_0x7ade('0xd')][_0x4f11b9['id']]=new EmailImap(_0x4f11b9,_0x5ca4f2[_0x5162de][_0x7ade('0x4')]);this['imapAccounts'][_0x4f11b9['id']]['on']('box',this[_0x7ade('0x19')]['bind'](this,_0x5162de));this[_0x7ade('0xd')][_0x4f11b9['id']]['on']('email',this[_0x7ade('0x1a')]['bind'](this,_0x5162de));this['imapAccounts'][_0x4f11b9['id']]['on'](_0x7ade('0x1b'),this[_0x7ade('0x1c')][_0x7ade('0x1d')](this,_0x5162de));this[_0x7ade('0xd')][_0x4f11b9['id']]['on'](_0x7ade('0x1e'),this[_0x7ade('0x1f')][_0x7ade('0x1d')](this,_0x5162de));}}else{if(_[_0x7ade('0x20')](this['mailAccounts'][_0x5162de][_0x7ade('0x13')])){this[_0x7ade('0xc')][_0x5162de][_0x7ade('0x13')]={};}this[_0x7ade('0xc')][_0x5162de][_0x7ade('0x13')][_0x7ade('0x21')]='disabled';this[_0x7ade('0xc')][_0x5162de][_0x7ade('0x13')][_0x7ade('0x14')]='';this[_0x7ade('0xf')](_0x5162de);}}}};EmailChannel[_0x7ade('0xe')][_0x7ade('0x19')]=function(_0x115223,_0x3f67fa){if(this[_0x7ade('0xc')][_0x115223]){this[_0x7ade('0xc')][_0x115223][_0x7ade('0x13')][_0x7ade('0x21')]=_0x7ade('0x22');this[_0x7ade('0xc')][_0x115223][_0x7ade('0x13')][_0x7ade('0x14')]=_0x3f67fa[_0x7ade('0x10')];if(_0x3f67fa['messages']){this[_0x7ade('0xc')][_0x115223][_0x7ade('0x13')][_0x7ade('0x15')]=_0x3f67fa[_0x7ade('0x23')][_0x7ade('0x15')];}return this[_0x7ade('0xf')](_0x115223);}};EmailChannel[_0x7ade('0xe')]['handleImapEmail']=function(_0x50ab58,_0x20294f){logger['info'](_0x7ade('0x24'),_0x20294f[_0x7ade('0x25')],_0x20294f[_0x7ade('0x26')],_0x20294f[_0x7ade('0x27')],_0x50ab58);if(this[_0x7ade('0xc')][_0x50ab58]){return mailAccount[_0x7ade('0x28')](_0x50ab58,_0x20294f)[_0x7ade('0x29')](function(_0x3a7334){if(_0x3a7334){logger['info'](_0x7ade('0x2a'));}})[_0x7ade('0x2b')](function(_0x1c5c5e){logger[_0x7ade('0x1e')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x7ade('0x2c')](_0x1c5c5e));});}};EmailChannel[_0x7ade('0xe')]['handleImapEnd']=function(_0xc90427){if(this[_0x7ade('0xc')][_0xc90427]&&this[_0x7ade('0xc')][_0xc90427][_0x7ade('0x13')]){if(this[_0x7ade('0xd')][this[_0x7ade('0xc')][_0xc90427]['Imap']['id']]){delete this[_0x7ade('0xd')][this[_0x7ade('0xc')][_0xc90427]['Imap']['id']];}this[_0x7ade('0xc')][_0xc90427][_0x7ade('0x13')]['lastSync']=moment();this[_0x7ade('0xf')](_0xc90427);}};EmailChannel[_0x7ade('0xe')][_0x7ade('0x1f')]=function(_0x2790ef,_0x21ca4f){if(this['mailAccounts'][_0x2790ef]){this[_0x7ade('0xc')][_0x2790ef][_0x7ade('0x13')][_0x7ade('0x21')]=_0x7ade('0x1e');this['mailAccounts'][_0x2790ef][_0x7ade('0x13')][_0x7ade('0x14')]=_0x21ca4f;return this[_0x7ade('0xf')](_0x2790ef);}};EmailChannel[_0x7ade('0xe')][_0x7ade('0x2d')]=function(_0x5d7166,_0x16f4ae){return this['smtp'][_0x7ade('0x2e')](_0x5d7166,_0x16f4ae);};EmailChannel[_0x7ade('0xe')][_0x7ade('0x2f')]=function(_0x3743b2){var _0x50df03=this;if(this[_0x7ade('0xc')][_0x3743b2['id']]){if(_['isNil'](this[_0x7ade('0xc')][_0x3743b2['id']]['Smtp'])){this[_0x7ade('0xc')][_0x3743b2['id']]['Smtp']={};}this[_0x7ade('0xc')][_0x3743b2['id']]['Smtp'][_0x7ade('0x30')]=moment();return new BPromise(function(_0x55edf7,_0x221641){return _0x50df03[_0x7ade('0x31')][_0x7ade('0x32')](_0x3743b2)[_0x7ade('0x29')](function(_0x5d96cd){_0x50df03[_0x7ade('0xc')][_0x3743b2['id']][_0x7ade('0x33')][_0x7ade('0x21')]=_0x7ade('0x34');_0x50df03['mailAccounts'][_0x3743b2['id']][_0x7ade('0x33')][_0x7ade('0x14')]='';_0x50df03['emit'](_0x3743b2['id']);_0x55edf7(_0x5d96cd);})[_0x7ade('0x2b')](function(_0xd7289b){_0x50df03['mailAccounts'][_0x3743b2['id']]['Smtp'][_0x7ade('0x21')]='error';_0x50df03[_0x7ade('0xc')][_0x3743b2['id']][_0x7ade('0x33')][_0x7ade('0x14')]=_0xd7289b;_0x50df03[_0x7ade('0xf')](_0x3743b2['id']);_0x221641(_0xd7289b);});});}return this['smtp']['verify'](_0x3743b2);};module[_0x7ade('0x35')]=EmailChannel; \ No newline at end of file +var _0x629e=['bind','email','handleImapEmail','end','handleImapEnd','error','handleImapError','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box'];(function(_0x35f022,_0x9783ba){var _0x112c53=function(_0x4fc43f){while(--_0x4fc43f){_0x35f022['push'](_0x35f022['shift']());}};_0x112c53(++_0x9783ba);}(_0x629e,0x13a));var _0xe629=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x629e[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xe629('0x0'));var moment=require(_0xe629('0x1'));var BPromise=require(_0xe629('0x2'));var md5=require(_0xe629('0x3'));var Redis=require(_0xe629('0x4'));var config=require(_0xe629('0x5'));var logger=require(_0xe629('0x6'))('email');config[_0xe629('0x7')]=_[_0xe629('0x8')](config[_0xe629('0x7')],{'host':_0xe629('0x9'),'port':0x18eb});var io=require(_0xe629('0xa'))(new Redis(config['redis']));var EmailImap=require(_0xe629('0xb'));var EmailSmtp=require(_0xe629('0xc'));var mailAccount=require(_0xe629('0xd'));var md5Accounts={};function EmailChannel(_0x1e4796){logger[_0xe629('0xe')](_0xe629('0xf'));this[_0xe629('0x10')]=_0x1e4796[_0xe629('0x10')];this[_0xe629('0x11')]={};this[_0xe629('0x12')]=new EmailSmtp();}EmailChannel[_0xe629('0x13')][_0xe629('0x14')]=function(_0x37b3c4){var _0x1285c3=this['mailAccounts'][_0x37b3c4];var _0x511703={'id':_0x1285c3['id'],'name':_0x1285c3[_0xe629('0x15')],'key':_0x1285c3[_0xe629('0x16')],'active':_0x1285c3[_0xe629('0x17')],'Imap':{'status':_0x1285c3['Imap'][_0xe629('0x18')],'messageStatus':_0x1285c3[_0xe629('0x19')][_0xe629('0x1a')],'total':_0x1285c3[_0xe629('0x19')][_0xe629('0x1b')]}};if(_[_0xe629('0x1c')](md5Accounts[_0x37b3c4])){md5Accounts[_0x37b3c4]={};}var _0x42e647=md5(JSON[_0xe629('0x1d')](_0x511703));if(md5Accounts[_0x37b3c4][_0xe629('0x3')]!==_0x42e647){md5Accounts[_0x37b3c4]['md5']=_0x42e647;io[_0xe629('0x14')](_0xe629('0x1e'),_0x511703);}};EmailChannel[_0xe629('0x13')][_0xe629('0x1f')]=function(_0x4016a7){for(var _0x4029ed in _0x4016a7){if(_0x4016a7[_0xe629('0x20')](_0x4029ed)){if(_0x4016a7[_0x4029ed][_0xe629('0x19')]&&_0x4016a7[_0x4029ed][_0xe629('0x17')]){var _0xb0bb22=_0x4016a7[_0x4029ed][_0xe629('0x19')];if(!this[_0xe629('0x11')]['hasOwnProperty'](_0xb0bb22['id'])){this[_0xe629('0x11')][_0xb0bb22['id']]=new EmailImap(_0xb0bb22,_0x4016a7[_0x4029ed]['email']);this['imapAccounts'][_0xb0bb22['id']]['on'](_0xe629('0x21'),this['handleImapBox'][_0xe629('0x22')](this,_0x4029ed));this[_0xe629('0x11')][_0xb0bb22['id']]['on'](_0xe629('0x23'),this[_0xe629('0x24')][_0xe629('0x22')](this,_0x4029ed));this[_0xe629('0x11')][_0xb0bb22['id']]['on'](_0xe629('0x25'),this[_0xe629('0x26')][_0xe629('0x22')](this,_0x4029ed));this[_0xe629('0x11')][_0xb0bb22['id']]['on'](_0xe629('0x27'),this[_0xe629('0x28')]['bind'](this,_0x4029ed));}}else{if(_[_0xe629('0x1c')](this['mailAccounts'][_0x4029ed][_0xe629('0x19')])){this[_0xe629('0x10')][_0x4029ed][_0xe629('0x19')]={};}this['mailAccounts'][_0x4029ed][_0xe629('0x19')][_0xe629('0x18')]='disabled';this['mailAccounts'][_0x4029ed][_0xe629('0x19')][_0xe629('0x1a')]='';this['emit'](_0x4029ed);}}}};EmailChannel[_0xe629('0x13')][_0xe629('0x29')]=function(_0x41c271,_0x50d015){if(this[_0xe629('0x10')][_0x41c271]){this['mailAccounts'][_0x41c271][_0xe629('0x19')][_0xe629('0x18')]=_0xe629('0x2a');this[_0xe629('0x10')][_0x41c271]['Imap'][_0xe629('0x1a')]=_0x50d015[_0xe629('0x15')];if(_0x50d015[_0xe629('0x2b')]){this[_0xe629('0x10')][_0x41c271][_0xe629('0x19')]['total']=_0x50d015[_0xe629('0x2b')][_0xe629('0x1b')];}return this[_0xe629('0x14')](_0x41c271);}};EmailChannel[_0xe629('0x13')][_0xe629('0x24')]=function(_0x201a36,_0xf00fce){logger['info'](_0xe629('0x2c'),_0xf00fce[_0xe629('0x2d')],_0xf00fce[_0xe629('0x2e')],_0xf00fce[_0xe629('0x2f')],_0x201a36);if(this[_0xe629('0x10')][_0x201a36]){return mailAccount[_0xe629('0x30')](_0x201a36,_0xf00fce)['then'](function(_0x2ee497){if(_0x2ee497){logger['info'](_0xe629('0x31'));}})[_0xe629('0x32')](function(_0x165c7b){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xe629('0x1d')](_0x165c7b));});}};EmailChannel[_0xe629('0x13')][_0xe629('0x26')]=function(_0x278c88){if(this[_0xe629('0x10')][_0x278c88]&&this[_0xe629('0x10')][_0x278c88]['Imap']){if(this[_0xe629('0x11')][this[_0xe629('0x10')][_0x278c88]['Imap']['id']]){delete this[_0xe629('0x11')][this['mailAccounts'][_0x278c88][_0xe629('0x19')]['id']];}this[_0xe629('0x10')][_0x278c88][_0xe629('0x19')][_0xe629('0x33')]=moment();this[_0xe629('0x14')](_0x278c88);}};EmailChannel['prototype'][_0xe629('0x28')]=function(_0x2beafd,_0x3a93c2){if(this[_0xe629('0x10')][_0x2beafd]){this[_0xe629('0x10')][_0x2beafd][_0xe629('0x19')][_0xe629('0x18')]='error';this[_0xe629('0x10')][_0x2beafd][_0xe629('0x19')][_0xe629('0x1a')]=_0x3a93c2;return this[_0xe629('0x14')](_0x2beafd);}};EmailChannel[_0xe629('0x13')]['sendMail']=function(_0x4d16bf,_0x16b27c){return this['smtp'][_0xe629('0x34')](_0x4d16bf,_0x16b27c);};EmailChannel['prototype'][_0xe629('0x35')]=function(_0x4fd6bb){var _0x6d3947=this;if(this[_0xe629('0x10')][_0x4fd6bb['id']]){if(_['isNil'](this['mailAccounts'][_0x4fd6bb['id']][_0xe629('0x36')])){this[_0xe629('0x10')][_0x4fd6bb['id']]['Smtp']={};}this['mailAccounts'][_0x4fd6bb['id']][_0xe629('0x36')]['lastSync']=moment();return new BPromise(function(_0x3a13bd,_0x16f0ce){return _0x6d3947[_0xe629('0x12')][_0xe629('0x37')](_0x4fd6bb)['then'](function(_0x3b029a){_0x6d3947[_0xe629('0x10')][_0x4fd6bb['id']]['Smtp'][_0xe629('0x18')]=_0xe629('0x38');_0x6d3947['mailAccounts'][_0x4fd6bb['id']][_0xe629('0x36')][_0xe629('0x1a')]='';_0x6d3947[_0xe629('0x14')](_0x4fd6bb['id']);_0x3a13bd(_0x3b029a);})[_0xe629('0x32')](function(_0x255e73){_0x6d3947['mailAccounts'][_0x4fd6bb['id']]['Smtp'][_0xe629('0x18')]=_0xe629('0x27');_0x6d3947['mailAccounts'][_0x4fd6bb['id']][_0xe629('0x36')][_0xe629('0x1a')]=_0x255e73;_0x6d3947[_0xe629('0x14')](_0x4fd6bb['id']);_0x16f0ce(_0x255e73);});});}return this['smtp']['verify'](_0x4fd6bb);};module[_0xe629('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 b972733..87c93f6 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 _0xf4ad=['fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','emit','textCode','hasOwnProperty','exports','path','imap','lodash','randomstring','mailparser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','end','handleEnd','bind','handleError','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','getHost','service','handleOpenBox','box','handleCloseBox','readUnseen','search','handleReadUnseen','length'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf4ad,0xbf));var _0xdf4a=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xf4ad[_0x3aaf0a];return _0x33e6bc;};'use strict';var fs=require('fs');var path=require(_0xdf4a('0x0'));var util=require('util');var Imap=require(_0xdf4a('0x1'));var _=require(_0xdf4a('0x2'));var rs=require(_0xdf4a('0x3'));var simpleParser=require(_0xdf4a('0x4'))['simpleParser'];var Iconv=require('iconv')[_0xdf4a('0x5')];var EventEmitter=require(_0xdf4a('0x6'))[_0xdf4a('0x7')];var utils=require(_0xdf4a('0x8'));var logger=require(_0xdf4a('0x9'))(_0xdf4a('0xa'));function EmailImap(_0x1ffba7,_0x1bc418){this[_0xdf4a('0xb')]=_0xdf4a('0xc');this[_0xdf4a('0xd')]=this[_0xdf4a('0xe')](_0x1ffba7,_0x1bc418);this[_0xdf4a('0x1')]=new Imap(this[_0xdf4a('0xd')]);this[_0xdf4a('0x1')][_0xdf4a('0xf')](_0xdf4a('0x10'),this['handleReady']['bind'](this));this[_0xdf4a('0x1')]['once'](_0xdf4a('0x11'),this[_0xdf4a('0x12')][_0xdf4a('0x13')](this));this['imap']['on']('error',this[_0xdf4a('0x14')]['bind'](this));this[_0xdf4a('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xdf4a('0x15')][_0xdf4a('0xe')]=function(_0x3634e9,_0x32d477){var _0x24b64e={'connTimeout':_0x3634e9[_0xdf4a('0x16')]?_0x3634e9[_0xdf4a('0x16')]*0x3e8:0x2710,'authTimeout':_0x3634e9[_0xdf4a('0x17')]?_0x3634e9['authTimeout']*0x3e8:0x1388};if(_[_0xdf4a('0x18')](_0x3634e9['service'])){if(_0x3634e9[_0xdf4a('0x19')]){_0x24b64e[_0xdf4a('0x1a')]=_0x3634e9[_0xdf4a('0x1a')];_0x24b64e[_0xdf4a('0x1b')]=_0x3634e9[_0xdf4a('0x1b')];}_0x24b64e[_0xdf4a('0x1c')]=_0x3634e9['host'];_0x24b64e[_0xdf4a('0x1d')]=_0x3634e9['port']||0x3e1;if(_0x3634e9[_0xdf4a('0x1e')]){_0x24b64e['tls']=!![];}else{_0x24b64e[_0xdf4a('0x1e')]=![];_0x24b64e[_0xdf4a('0x1f')]='required';}}else{_0x24b64e[_0xdf4a('0x1a')]=_0x3634e9['user'];_0x24b64e[_0xdf4a('0x1b')]=_0x3634e9[_0xdf4a('0x1b')];_0x24b64e['host']=utils[_0xdf4a('0x20')](_0x3634e9[_0xdf4a('0x21')]);_0x24b64e[_0xdf4a('0x1d')]=0x3e1;_0x24b64e['tls']=!![];}_0x24b64e[_0xdf4a('0xa')]=_0x32d477||_0x3634e9[_0xdf4a('0x1a')]||'anonymous@xcally.com';return _0x24b64e;};EmailImap[_0xdf4a('0x15')]['handleReady']=function(){this[_0xdf4a('0x1')]['openBox'](this['mailbox'],![],this['handleOpenBox'][_0xdf4a('0x13')](this));};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x22')]=function(_0x272466,_0x4edf62){if(_0x272466){this[_0xdf4a('0x14')](_0x272466,!![]);}else{this['emit'](_0xdf4a('0x23'),_0x4edf62);this['readUnseen']();}};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x24')]=function(_0x225a54){if(_0x225a54){this[_0xdf4a('0x14')](_0x225a54,!![]);}else{this[_0xdf4a('0x1')][_0xdf4a('0x11')]();}};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x25')]=function(){this['imap'][_0xdf4a('0x26')](['UNSEEN'],this[_0xdf4a('0x27')][_0xdf4a('0x13')](this));};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x27')]=function(_0x309569,_0x34d60e){if(_0x309569){this[_0xdf4a('0x14')](_0x309569,!![]);}else{if(_0x34d60e[_0xdf4a('0x28')]){try{var _0x39bdb2=this['imap'][_0xdf4a('0x29')](_0x34d60e,{'bodies':'','markSeen':!![]});_0x39bdb2['on'](_0xdf4a('0x2a'),this[_0xdf4a('0x2b')][_0xdf4a('0x13')](this));_0x39bdb2['once'](_0xdf4a('0x2c'),this[_0xdf4a('0x2d')][_0xdf4a('0x13')](this));_0x39bdb2[_0xdf4a('0xf')]('end',this[_0xdf4a('0x2e')][_0xdf4a('0x13')](this));}catch(_0x2d9154){logger['error'](_0x2d9154);}}else{this[_0xdf4a('0x1')][_0xdf4a('0x2f')](!![],this['handleCloseBox'][_0xdf4a('0x13')](this));}}};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x2b')]=function(_0x5d2fda,_0x117c7e){_0x5d2fda['on']('body',this['handleMessageBody'][_0xdf4a('0x13')](this));_0x5d2fda['once'](_0xdf4a('0x30'),this[_0xdf4a('0x31')][_0xdf4a('0x13')](this));_0x5d2fda[_0xdf4a('0xf')](_0xdf4a('0x11'),this[_0xdf4a('0x32')][_0xdf4a('0x13')](this));};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x33')]=function(_0x1d22e5,_0xee434d){simpleParser(_0x1d22e5,{'Iconv':Iconv},this[_0xdf4a('0x34')][_0xdf4a('0x13')](this));};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x31')]=function(_0x258c0b){};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x32')]=function(){};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x34')]=function(_0x3e936a,_0x2b988b){if(_0x3e936a){logger['error'](_0x3e936a);}else{var _0x414fbd=this;utils[_0xdf4a('0x35')](this[_0xdf4a('0xd')],_0x2b988b,function(_0x3f70fb){_0x414fbd[_0xdf4a('0x36')](_0xdf4a('0xa'),_0x3f70fb);});}};EmailImap[_0xdf4a('0x15')]['handleFetchEnd']=function(){this[_0xdf4a('0x1')]['closeBox'](!![],this[_0xdf4a('0x24')][_0xdf4a('0x13')](this));};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x2d')]=function(_0xa931de){this[_0xdf4a('0x14')](_0xa931de);this[_0xdf4a('0x1')][_0xdf4a('0x2f')](!![],this[_0xdf4a('0x24')][_0xdf4a('0x13')](this));};EmailImap['prototype'][_0xdf4a('0x12')]=function(){this[_0xdf4a('0x36')](_0xdf4a('0x11'));};EmailImap[_0xdf4a('0x15')][_0xdf4a('0x14')]=function(_0x21edab,_0x1b9239){logger[_0xdf4a('0x2c')](_0xdf4a('0x14'),this[_0xdf4a('0xd')][_0xdf4a('0xa')],JSON['stringify'](_0x21edab));var _0x5d73f6='';if(_0x21edab){if(_0x21edab[_0xdf4a('0x37')]){_0x5d73f6=_0x21edab[_0xdf4a('0x37')];}else{for(var _0x4ed509 in _0x21edab){if(_0x21edab[_0xdf4a('0x38')](_0x4ed509)){_0x5d73f6+=_['upperFirst'](_0x4ed509)+':\x20'+_0x21edab[_0x4ed509]+'\x0a';}}}}if(_0x1b9239){this[_0xdf4a('0x1')][_0xdf4a('0x11')]();}else{this[_0xdf4a('0x36')](_0xdf4a('0x2c'),_0x5d73f6);this[_0xdf4a('0x36')](_0xdf4a('0x11'));}};module[_0xdf4a('0x39')]=EmailImap; \ No newline at end of file +var _0x20fa=['../../../config/logger','email','INBOX','account','getAccount','imap','once','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','required','password','getHost','anonymous@xcally.com','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','handleError','fetch','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','handleFetchError','textCode','hasOwnProperty','upperFirst','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20fa,0xea));var _0xa20f=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x20fa[_0x254081];return _0x5d1e2a;};'use strict';var fs=require('fs');var path=require(_0xa20f('0x0'));var util=require(_0xa20f('0x1'));var Imap=require('imap');var _=require(_0xa20f('0x2'));var rs=require(_0xa20f('0x3'));var simpleParser=require(_0xa20f('0x4'))[_0xa20f('0x5')];var Iconv=require(_0xa20f('0x6'))[_0xa20f('0x7')];var EventEmitter=require(_0xa20f('0x8'))['EventEmitter'];var utils=require(_0xa20f('0x9'));var logger=require(_0xa20f('0xa'))(_0xa20f('0xb'));function EmailImap(_0x63a690,_0x61164d){this['mailbox']=_0xa20f('0xc');this[_0xa20f('0xd')]=this[_0xa20f('0xe')](_0x63a690,_0x61164d);this[_0xa20f('0xf')]=new Imap(this[_0xa20f('0xd')]);this[_0xa20f('0xf')][_0xa20f('0x10')]('ready',this[_0xa20f('0x11')][_0xa20f('0x12')](this));this['imap'][_0xa20f('0x10')](_0xa20f('0x13'),this[_0xa20f('0x14')][_0xa20f('0x12')](this));this[_0xa20f('0xf')]['on'](_0xa20f('0x15'),this['handleError'][_0xa20f('0x12')](this));this[_0xa20f('0xf')][_0xa20f('0x16')]();}util[_0xa20f('0x17')](EmailImap,EventEmitter);EmailImap[_0xa20f('0x18')][_0xa20f('0xe')]=function(_0x1e0c85,_0x15eb73){var _0x5cb5b5={'connTimeout':_0x1e0c85[_0xa20f('0x19')]?_0x1e0c85['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1e0c85[_0xa20f('0x1a')]?_0x1e0c85[_0xa20f('0x1a')]*0x3e8:0x1388};if(_[_0xa20f('0x1b')](_0x1e0c85[_0xa20f('0x1c')])){if(_0x1e0c85[_0xa20f('0x1d')]){_0x5cb5b5['user']=_0x1e0c85[_0xa20f('0x1e')];_0x5cb5b5['password']=_0x1e0c85['password'];}_0x5cb5b5[_0xa20f('0x1f')]=_0x1e0c85['host'];_0x5cb5b5['port']=_0x1e0c85[_0xa20f('0x20')]||0x3e1;if(_0x1e0c85[_0xa20f('0x21')]){_0x5cb5b5['tls']=!![];}else{_0x5cb5b5[_0xa20f('0x21')]=![];_0x5cb5b5[_0xa20f('0x22')]=_0xa20f('0x23');}}else{_0x5cb5b5[_0xa20f('0x1e')]=_0x1e0c85['user'];_0x5cb5b5['password']=_0x1e0c85[_0xa20f('0x24')];_0x5cb5b5[_0xa20f('0x1f')]=utils[_0xa20f('0x25')](_0x1e0c85['service']);_0x5cb5b5[_0xa20f('0x20')]=0x3e1;_0x5cb5b5['tls']=!![];}_0x5cb5b5[_0xa20f('0xb')]=_0x15eb73||_0x1e0c85['user']||_0xa20f('0x26');return _0x5cb5b5;};EmailImap['prototype'][_0xa20f('0x11')]=function(){this[_0xa20f('0xf')]['openBox'](this['mailbox'],![],this['handleOpenBox'][_0xa20f('0x12')](this));};EmailImap['prototype'][_0xa20f('0x27')]=function(_0x4b271d,_0x5653f1){if(_0x4b271d){this['handleError'](_0x4b271d,!![]);}else{this[_0xa20f('0x28')](_0xa20f('0x29'),_0x5653f1);this['readUnseen']();}};EmailImap[_0xa20f('0x18')][_0xa20f('0x2a')]=function(_0x3235ea){if(_0x3235ea){this['handleError'](_0x3235ea,!![]);}else{this['imap'][_0xa20f('0x13')]();}};EmailImap['prototype'][_0xa20f('0x2b')]=function(){this[_0xa20f('0xf')][_0xa20f('0x2c')]([_0xa20f('0x2d')],this[_0xa20f('0x2e')][_0xa20f('0x12')](this));};EmailImap['prototype'][_0xa20f('0x2e')]=function(_0x3617f3,_0x435b18){if(_0x3617f3){this[_0xa20f('0x2f')](_0x3617f3,!![]);}else{if(_0x435b18['length']){try{var _0x2f2cf6=this[_0xa20f('0xf')][_0xa20f('0x30')](_0x435b18,{'bodies':'','markSeen':!![]});_0x2f2cf6['on']('message',this['handleFetchMessage'][_0xa20f('0x12')](this));_0x2f2cf6[_0xa20f('0x10')](_0xa20f('0x15'),this['handleFetchError'][_0xa20f('0x12')](this));_0x2f2cf6[_0xa20f('0x10')]('end',this[_0xa20f('0x31')][_0xa20f('0x12')](this));}catch(_0x2d814b){logger['error'](_0x2d814b);}}else{this[_0xa20f('0xf')][_0xa20f('0x32')](!![],this[_0xa20f('0x2a')][_0xa20f('0x12')](this));}}};EmailImap[_0xa20f('0x18')][_0xa20f('0x33')]=function(_0x2464ff,_0x3d1f14){_0x2464ff['on']('body',this[_0xa20f('0x34')][_0xa20f('0x12')](this));_0x2464ff['once'](_0xa20f('0x35'),this['handleMessageAttributes']['bind'](this));_0x2464ff[_0xa20f('0x10')](_0xa20f('0x13'),this[_0xa20f('0x36')][_0xa20f('0x12')](this));};EmailImap[_0xa20f('0x18')][_0xa20f('0x34')]=function(_0x5d1dad,_0x57aef4){simpleParser(_0x5d1dad,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xa20f('0x18')][_0xa20f('0x37')]=function(_0x4bc2b5){};EmailImap['prototype'][_0xa20f('0x36')]=function(){};EmailImap[_0xa20f('0x18')][_0xa20f('0x38')]=function(_0x21fcf9,_0x4889c5){if(_0x21fcf9){logger[_0xa20f('0x15')](_0x21fcf9);}else{var _0x197356=this;utils['parser'](this[_0xa20f('0xd')],_0x4889c5,function(_0x4ea937){_0x197356['emit'](_0xa20f('0xb'),_0x4ea937);});}};EmailImap[_0xa20f('0x18')]['handleFetchEnd']=function(){this[_0xa20f('0xf')][_0xa20f('0x32')](!![],this[_0xa20f('0x2a')][_0xa20f('0x12')](this));};EmailImap[_0xa20f('0x18')][_0xa20f('0x39')]=function(_0x3741af){this['handleError'](_0x3741af);this[_0xa20f('0xf')][_0xa20f('0x32')](!![],this[_0xa20f('0x2a')][_0xa20f('0x12')](this));};EmailImap[_0xa20f('0x18')][_0xa20f('0x14')]=function(){this['emit'](_0xa20f('0x13'));};EmailImap[_0xa20f('0x18')][_0xa20f('0x2f')]=function(_0x14a21e,_0xd4f35c){logger[_0xa20f('0x15')](_0xa20f('0x2f'),this['account'][_0xa20f('0xb')],JSON['stringify'](_0x14a21e));var _0x3d3e1f='';if(_0x14a21e){if(_0x14a21e[_0xa20f('0x3a')]){_0x3d3e1f=_0x14a21e[_0xa20f('0x3a')];}else{for(var _0x2b7bee in _0x14a21e){if(_0x14a21e[_0xa20f('0x3b')](_0x2b7bee)){_0x3d3e1f+=_[_0xa20f('0x3c')](_0x2b7bee)+':\x20'+_0x14a21e[_0x2b7bee]+'\x0a';}}}}if(_0xd4f35c){this[_0xa20f('0xf')][_0xa20f('0x13')]();}else{this[_0xa20f('0x28')]('error',_0x3d3e1f);this[_0xa20f('0x28')](_0xa20f('0x13'));}};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 e66d88b..120601d 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 _0x01aa=['nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','verify','exports'];(function(_0x43a84a,_0x6c500e){var _0x2ed43a=function(_0x8f88c3){while(--_0x8f88c3){_0x43a84a['push'](_0x43a84a['shift']());}};_0x2ed43a(++_0x6c500e);}(_0x01aa,0x6c));var _0xa01a=function(_0x27ba97,_0x1f79b3){_0x27ba97=_0x27ba97-0x0;var _0xd1c801=_0x01aa[_0x27ba97];return _0xd1c801;};'use strict';var nodemailer=require(_0xa01a('0x0'));var BPromise=require(_0xa01a('0x1'));var inlineBase64=require(_0xa01a('0x2'));function EmailSmtp(){}EmailSmtp[_0xa01a('0x3')][_0xa01a('0x4')]=function(_0x393103,_0x1bcacb){return new BPromise(function(_0x17c2fe,_0x292b1b){var _0xe7ddc=nodemailer[_0xa01a('0x5')](_0x393103);_0xe7ddc[_0xa01a('0x6')](_0xa01a('0x7'),inlineBase64());_0xe7ddc[_0xa01a('0x8')](_0x1bcacb,function(_0x38612c,_0x2e33ef){if(_0x38612c){_0x292b1b(_0x38612c[_0xa01a('0x9')]());}else{_0x17c2fe(_0x2e33ef);}});});};EmailSmtp[_0xa01a('0x3')][_0xa01a('0xa')]=function(_0x410e61){return new BPromise(function(_0x52d941,_0x3397fd){var _0x1ec724=nodemailer['createTransport'](_0x410e61);_0x1ec724[_0xa01a('0xa')](function(_0xac6ec4,_0xf7ddcf){if(_0xac6ec4){_0x3397fd(_0xac6ec4['toString']());}else{if(_0xf7ddcf){_0x52d941(_0xf7ddcf);}else{_0x3397fd('Not\x20verifired');}}});});};module[_0xa01a('0xb')]=EmailSmtp; \ No newline at end of file +var _0xed42=['Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','use','sendMail','toString','prototype','verify'];(function(_0x38534a,_0x3b0df0){var _0x4ffdee=function(_0x5ad50a){while(--_0x5ad50a){_0x38534a['push'](_0x38534a['shift']());}};_0x4ffdee(++_0x3b0df0);}(_0xed42,0x10a));var _0x2ed4=function(_0x48bb13,_0x5bbf43){_0x48bb13=_0x48bb13-0x0;var _0x2a0ef4=_0xed42[_0x48bb13];return _0x2a0ef4;};'use strict';var nodemailer=require(_0x2ed4('0x0'));var BPromise=require(_0x2ed4('0x1'));var inlineBase64=require(_0x2ed4('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x2ed4('0x3')]=function(_0x243239,_0x2b6e86){return new BPromise(function(_0x504f23,_0x11520a){var _0x574645=nodemailer[_0x2ed4('0x4')](_0x243239);_0x574645[_0x2ed4('0x5')]('compile',inlineBase64());_0x574645[_0x2ed4('0x6')](_0x2b6e86,function(_0x347dae,_0x5c6e3a){if(_0x347dae){_0x11520a(_0x347dae[_0x2ed4('0x7')]());}else{_0x504f23(_0x5c6e3a);}});});};EmailSmtp[_0x2ed4('0x8')][_0x2ed4('0x9')]=function(_0x43cdf9){return new BPromise(function(_0x46d1e8,_0x1db806){var _0x3e226a=nodemailer['createTransport'](_0x43cdf9);_0x3e226a['verify'](function(_0x87e91c,_0x223ecb){if(_0x87e91c){_0x1db806(_0x87e91c[_0x2ed4('0x7')]());}else{if(_0x223ecb){_0x46d1e8(_0x223ecb);}else{_0x1db806(_0x2ed4('0xa'));}}});});};module[_0x2ed4('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 0db5efb..19851f0 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 _0x61a9=['server/files/attachments/','writeFileSync','content','push','contentType','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','length','join','Anonymous','pop','isEmpty','anonymous','html','test','\x20[Attachment:\x20','\x20]','body','0x1?_0x1ac407[_0x961a('0x11')]():'';}return'';}function getMails(_0x3d6458,_0x33e34d){var _0x1d9ee7='';for(var _0x326aa0=0x0;_0x326aa0<_0x33e34d[_0x961a('0x8')][_0x961a('0xe')];_0x326aa0+=0x1){if(_0x33e34d[_0x961a('0x8')][_0x326aa0]['address']!==_0x3d6458){if(!_[_0x961a('0x12')](_0x1d9ee7)){_0x1d9ee7+=',';}_0x1d9ee7+=_0x33e34d[_0x961a('0x8')][_0x326aa0][_0x961a('0xc')]||_0x33e34d[_0x961a('0x8')][_0x326aa0][_0x961a('0x9')]||'';_0x1d9ee7+='\x20<';_0x1d9ee7+=_0x33e34d[_0x961a('0x8')][_0x326aa0][_0x961a('0x9')]?_0x33e34d['value'][_0x326aa0][_0x961a('0x9')]:_0x961a('0x13')+random['generate'](0x6)+_0x961a('0xb');_0x1d9ee7+='>';}}return _0x1d9ee7;}function parseEmail(_0xd1baa3,_0x2083fa,_0x90f6ac){if(_0x2083fa[_0x961a('0x14')]){var _0x3a630d=/)<[^<]*)*<\/script>/gi;while(_0x3a630d[_0x961a('0x15')](_0x2083fa[_0x961a('0x14')])){_0x2083fa['html']=_0x2083fa[_0x961a('0x14')]['replace'](_0x3a630d,'');}if(_0x2083fa[_0x961a('0x14')]['includes'](_0x961a('0x16'))){var _0x26314e=[];_0x2083fa['attachments']['forEach'](_0x141bd9=>{_0x26314e['push'](_0x141bd9[_0x961a('0x17')]);});var _0x52e641=/]+>/g;var _0x10665a=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x58ab54=_0x2083fa[_0x961a('0x14')]['replace'](_0x10665a,_0x961a('0x18'));var _0x3fc846=_0x58ab54['replace'](_0x52e641,_0x961a('0x19'));for(let _0x407a68=0x0;_0x407a68<_0x26314e[_0x961a('0xe')];_0x407a68++){var _0x200472=_0x3fc846[_0x961a('0x1a')]('_IMG',_0x961a('0x1b')+_0x26314e[_0x407a68]+_0x961a('0x1c'));_0x3fc846=_0x200472;}_0x2083fa[_0x961a('0x14')]=_0x3fc846;}_0x90f6ac[_0x961a('0x1d')]=_0x2083fa[_0x961a('0x14')];}else{_0x90f6ac['body']=_0x2083fa['textAsHtml'];}if(_0x90f6ac[_0x961a('0x1d')]){_0x90f6ac['body']=_0x90f6ac[_0x961a('0x1d')][_0x961a('0x1a')](/\x20[Attachment:\x20','body','textAsHtml','originTo','message','originCc','isEmpty','attach','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','email','head','value','address','anonymous','generate'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x4185,0xc3));var _0x5418=function(_0x26e4bf,_0xafca10){_0x26e4bf=_0x26e4bf-0x0;var _0x4b69da=_0x4185[_0x26e4bf];return _0x4b69da;};'use strict';var _=require(_0x5418('0x0'));var moment=require(_0x5418('0x1'));var random=require(_0x5418('0x2'));var fs=require('fs');var path=require(_0x5418('0x3'));var util=require(_0x5418('0x4'));var tnef=require(_0x5418('0x5'));var logger=require('../../../config/logger')(_0x5418('0x6'));var config=require('../../../config/environment');function getAddress(_0x2361d0){var _0x3472d4=_[_0x5418('0x7')](_0x2361d0[_0x5418('0x8')]);return _0x3472d4&&_0x3472d4[_0x5418('0x9')]?_0x3472d4[_0x5418('0x9')]:_0x5418('0xa')+random[_0x5418('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x580a9e){var _0x369393=_[_0x5418('0x7')](_0x580a9e['value']);if(_0x369393&&_0x369393['name']){var _0x22ed5c=_0x369393['name'][_0x5418('0xc')](/\s+/);return _0x22ed5c[_0x5418('0xd')]?_0x22ed5c['slice'](0x0,-0x1)[_0x5418('0xe')]('\x20'):_0x369393[_0x5418('0xf')];}return _0x5418('0x10');}function getLastName(_0x1afbc9){var _0x30f124=_[_0x5418('0x7')](_0x1afbc9[_0x5418('0x8')]);if(_0x30f124&&_0x30f124[_0x5418('0xf')]){var _0x4edad7=_0x30f124['name'][_0x5418('0xc')](/\s+/);return _0x4edad7[_0x5418('0xd')]>0x1?_0x4edad7['pop']():'';}return'';}function getMails(_0x2b7ef1,_0x3141af){var _0x38d1b4='';for(var _0x290644=0x0;_0x290644<_0x3141af[_0x5418('0x8')][_0x5418('0xd')];_0x290644+=0x1){if(_0x3141af[_0x5418('0x8')][_0x290644][_0x5418('0x9')]!==_0x2b7ef1){if(!_['isEmpty'](_0x38d1b4)){_0x38d1b4+=',';}_0x38d1b4+=_0x3141af[_0x5418('0x8')][_0x290644][_0x5418('0xf')]||_0x3141af[_0x5418('0x8')][_0x290644][_0x5418('0x9')]||'';_0x38d1b4+='\x20<';_0x38d1b4+=_0x3141af[_0x5418('0x8')][_0x290644][_0x5418('0x9')]?_0x3141af[_0x5418('0x8')][_0x290644][_0x5418('0x9')]:_0x5418('0xa')+random[_0x5418('0xb')](0x6)+_0x5418('0x11');_0x38d1b4+='>';}}return _0x38d1b4;}function parseEmail(_0xfc3027,_0x20729f,_0x1f3748){if(_0x20729f[_0x5418('0x12')]){var _0x5e08b1=/)<[^<]*)*<\/script>/gi;while(_0x5e08b1[_0x5418('0x13')](_0x20729f[_0x5418('0x12')])){_0x20729f[_0x5418('0x12')]=_0x20729f[_0x5418('0x12')][_0x5418('0x14')](_0x5e08b1,'');}if(_0x20729f[_0x5418('0x12')][_0x5418('0x15')](_0x5418('0x16'))){var _0x5c839f=[];_0x20729f[_0x5418('0x17')][_0x5418('0x18')](_0x2ba592=>{_0x5c839f[_0x5418('0x19')](_0x2ba592['filename']);});var _0x1a5abf=/]+>/g;var _0x634160=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5a4959=_0x20729f[_0x5418('0x12')]['replace'](_0x634160,_0x5418('0x1a'));var _0x27dc19=_0x5a4959[_0x5418('0x14')](_0x1a5abf,_0x5418('0x1b'));for(let _0x2b6a38=0x0;_0x2b6a38<_0x5c839f[_0x5418('0xd')];_0x2b6a38++){var _0x4a1743=_0x27dc19[_0x5418('0x14')](_0x5418('0x1b'),_0x5418('0x1c')+_0x5c839f[_0x2b6a38]+'\x20]');_0x27dc19=_0x4a1743;}_0x20729f['html']=_0x27dc19;}_0x1f3748[_0x5418('0x1d')]=_0x20729f['html'];}else{_0x1f3748['body']=_0x20729f[_0x5418('0x1e')];}if(_0x1f3748['body']){_0x1f3748[_0x5418('0x1d')]=_0x1f3748[_0x5418('0x1d')]['replace'](/Empty\x20message

';if(_0x421874[_0x5418('0x38')]){for(var _0x4c2a25=0x0;_0x4c2a25<_0x421874[_0x5418('0x38')]['length'];_0x4c2a25++){var _0x4a753a=_0x421874[_0x5418('0x38')][_0x4c2a25];_0x2b395c[_0x5418('0x20')][_0x5418('0x17')][_0x5418('0x19')]({'filename':_0x4a753a[_0x5418('0x39')],'content':new Buffer(_0x4a753a[_0x5418('0x3a')])});}}}_0x2cf19e(parseEmail(_0x3c2e47,_0x55d396,_0x2b395c));});}else{_0x55d396['html']=_0x5418('0x3b');_0x2cf19e(parseEmail(_0x3c2e47,_0x55d396,_0x2b395c));}}else{_0x2cf19e(parseEmail(_0x3c2e47,_0x55d396,_0x2b395c));}};exports['getHost']=function(_0x56c5d0){switch(_0x56c5d0){case _0x5418('0x3c'):return _0x5418('0x3d');case _0x5418('0x3e'):return _0x5418('0x3f');case _0x5418('0x40'):return _0x5418('0x41');case _0x5418('0x42'):return _0x5418('0x43');}return _0x5418('0x44');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9e3b5b8..30fc8a0 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 _0x3436=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x41b930,_0x12eac9){var _0xb1bcf6=function(_0xd06d07){while(--_0xd06d07){_0x41b930['push'](_0x41b930['shift']());}};_0xb1bcf6(++_0x12eac9);}(_0x3436,0x1a7));var _0x6343=function(_0x5cc41c,_0x3297f7){_0x5cc41c=_0x5cc41c-0x0;var _0x4d1256=_0x3436[_0x5cc41c];return _0x4d1256;};'use strict';var _=require(_0x6343('0x0'));function MailAccount(_0x53852b){this['id']=_0x53852b['id']||0x0;this[_0x6343('0x1')]=_0x53852b['name']||_0x6343('0x2');this[_0x6343('0x3')]=_0x53852b[_0x6343('0x3')]||_0x6343('0x4');this[_0x6343('0x5')]=_0x53852b[_0x6343('0x5')]||![];this[_0x6343('0x6')]=_0x53852b[_0x6343('0x6')]||[];this[_0x6343('0x7')]=_0x53852b['Smtp']||[];}module[_0x6343('0x8')]=MailAccount; \ No newline at end of file +var _0xa2e0=['active','Imap','Smtp','name','Service','key','SERV'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2e0,0x8f));var _0x0a2e=function(_0x17fb5b,_0x3129eb){_0x17fb5b=_0x17fb5b-0x0;var _0x1a9c07=_0xa2e0[_0x17fb5b];return _0x1a9c07;};'use strict';var _=require('lodash');function MailAccount(_0x11b152){this['id']=_0x11b152['id']||0x0;this[_0x0a2e('0x0')]=_0x11b152['name']||_0x0a2e('0x1');this[_0x0a2e('0x2')]=_0x11b152[_0x0a2e('0x2')]||_0x0a2e('0x3');this['active']=_0x11b152[_0x0a2e('0x4')]||![];this[_0x0a2e('0x5')]=_0x11b152[_0x0a2e('0x5')]||[];this[_0x0a2e('0x6')]=_0x11b152['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index ab90ffa..51061e0 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 _0x47be=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined','merge'];(function(_0x3bac01,_0x3f7081){var _0x36a58a=function(_0x5b8bce){while(--_0x5b8bce){_0x3bac01['push'](_0x3bac01['shift']());}};_0x36a58a(++_0x3f7081);}(_0x47be,0x114));var _0xe47b=function(_0x56e6c6,_0x4486ce){_0x56e6c6=_0x56e6c6-0x0;var _0x21547e=_0x47be[_0x56e6c6];return _0x21547e;};'use strict';var _=require(_0xe47b('0x0'));var MailAccount=require(_0xe47b('0x1'));var Realtime=function(){this[_0xe47b('0x2')]={};};function freeIsNotKey(_0x2bde2e,_0x433ca7,_0x38854e){var _0x349505=_[_0xe47b('0x3')](_0x2bde2e,function(_0x588647,_0x2156f5){return _0x588647[_0x38854e];});for(var _0x5426c6 in _0x433ca7){if(_0x433ca7[_0xe47b('0x4')](_0x5426c6)){if(!_0x349505[_0x5426c6]){delete _0x433ca7[_0x5426c6];}}}}Realtime['prototype'][_0xe47b('0x5')]=function(_0xe1da04,_0x4a4bf8){for(var _0x2d44a4 in _0x4a4bf8){if(_0xe1da04[_0xe47b('0x4')](_0x2d44a4)){_0xe1da04[_0x2d44a4]=_0x4a4bf8[_0x2d44a4];}}};Realtime[_0xe47b('0x6')]['initMailAccounts']=function(){var _0x28ae5=this;return function(_0xf0d262){if(_0xf0d262){freeIsNotKey(_0xf0d262,_0x28ae5[_0xe47b('0x2')],'id');for(var _0x40971c=0x0,_0x68bfb5={},_0x4b5838={};_0x40971c<_0xf0d262[_0xe47b('0x7')];_0x40971c+=0x1){_0x68bfb5=_0xf0d262[_0x40971c];if(_[_0xe47b('0x8')](_0x28ae5[_0xe47b('0x2')][_0x68bfb5['id']])){_0x28ae5[_0xe47b('0x2')][_0x68bfb5['id']]=new MailAccount(_0x68bfb5);}else{_[_0xe47b('0x9')](_0x28ae5['mailAccounts'][_0x68bfb5['id']],_0x68bfb5);}}}return _0x28ae5[_0xe47b('0x2')];};};module[_0xe47b('0xa')]=Realtime; \ No newline at end of file +var _0x97a1=['lodash','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','isUndefined','exports'];(function(_0xa8fd2e,_0x30722b){var _0x13108b=function(_0xd44030){while(--_0xd44030){_0xa8fd2e['push'](_0xa8fd2e['shift']());}};_0x13108b(++_0x30722b);}(_0x97a1,0x1e6));var _0x197a=function(_0x1257e4,_0x42a5af){_0x1257e4=_0x1257e4-0x0;var _0x1c48c6=_0x97a1[_0x1257e4];return _0x1c48c6;};'use strict';var _=require(_0x197a('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x197a('0x1')]={};};function freeIsNotKey(_0x382521,_0x42fcea,_0x1a9d48){var _0x1c6b56=_[_0x197a('0x2')](_0x382521,function(_0x1b9d3d,_0x432e4a){return _0x1b9d3d[_0x1a9d48];});for(var _0x1007b6 in _0x42fcea){if(_0x42fcea[_0x197a('0x3')](_0x1007b6)){if(!_0x1c6b56[_0x1007b6]){delete _0x42fcea[_0x1007b6];}}}}Realtime['prototype'][_0x197a('0x4')]=function(_0x348e38,_0x5ab6e8){for(var _0x33ae41 in _0x5ab6e8){if(_0x348e38[_0x197a('0x3')](_0x33ae41)){_0x348e38[_0x33ae41]=_0x5ab6e8[_0x33ae41];}}};Realtime[_0x197a('0x5')][_0x197a('0x6')]=function(){var _0x202f32=this;return function(_0x2aae19){if(_0x2aae19){freeIsNotKey(_0x2aae19,_0x202f32[_0x197a('0x1')],'id');for(var _0x4e6a5b=0x0,_0x197e63={},_0x5cdc8a={};_0x4e6a5b<_0x2aae19['length'];_0x4e6a5b+=0x1){_0x197e63=_0x2aae19[_0x4e6a5b];if(_[_0x197a('0x7')](_0x202f32[_0x197a('0x1')][_0x197e63['id']])){_0x202f32[_0x197a('0x1')][_0x197e63['id']]=new MailAccount(_0x197e63);}else{_['merge'](_0x202f32[_0x197a('0x1')][_0x197e63['id']],_0x197e63);}}}return _0x202f32[_0x197a('0x1')];};};module[_0x197a('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 b1bd8ad..8dcd9f7 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 _0x8c8b=['Imap','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','GetMailAccount','name','service','email','ListId','TemplateId','MailServerIn'];(function(_0x486b7c,_0x9e78bd){var _0x22c5d7=function(_0x59530c){while(--_0x59530c){_0x486b7c['push'](_0x486b7c['shift']());}};_0x22c5d7(++_0x9e78bd);}(_0x8c8b,0x106));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xb8c8('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0xb8c8('0x1'),{'options':{'attributes':['id',_0xb8c8('0x2'),_0xb8c8('0x3'),_0xb8c8('0x4'),'active','key',_0xb8c8('0x5'),_0xb8c8('0x6')],'raw':![],'include':[{'model':_0xb8c8('0x7'),'as':_0xb8c8('0x8')},{'model':_0xb8c8('0x9'),'as':_0xb8c8('0xa')}]},'log':_0xb8c8('0xb')});};};exports[_0xb8c8('0xc')]=function(_0x1d9bd8,_0x2badd9){return client[_0xb8c8('0xd')]('NotifyMailAccount',{'account':{'id':_0x1d9bd8},'body':_0x2badd9,'log':_0xb8c8('0xe')});}; \ No newline at end of file +var _0x7ee1=['service','email','key','ListId','TemplateId','MailServerIn','MailServerOut','Smtp','notify','Request','NotifyMailAccount','../client','name'];(function(_0x5e8087,_0x484bbc){var _0x3bb9d4=function(_0x3a5432){while(--_0x3a5432){_0x5e8087['push'](_0x5e8087['shift']());}};_0x3bb9d4(++_0x484bbc);}(_0x7ee1,0x8d));var _0x17ee=function(_0x41a6ca,_0x4cdd06){_0x41a6ca=_0x41a6ca-0x0;var _0xfaec63=_0x7ee1[_0x41a6ca];return _0xfaec63;};'use strict';var client=require(_0x17ee('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x17ee('0x1'),_0x17ee('0x2'),_0x17ee('0x3'),'active',_0x17ee('0x4'),_0x17ee('0x5'),_0x17ee('0x6')],'raw':![],'include':[{'model':_0x17ee('0x7'),'as':'Imap'},{'model':_0x17ee('0x8'),'as':_0x17ee('0x9')}]},'log':'getMailAccount'});};};exports[_0x17ee('0xa')]=function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0xb')](_0x17ee('0xc'),{'account':{'id':_0x57e1d1},'body':_0x3d767b,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b9b3964..d9199d4 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 _0x4120=['log','RPC\x20listening\x20on\x20port:','jayson/promise','../../../config/logger','email','sendMail','account','message','then','error','verifySmtp','mailAccounts','length','Imap','password','Smtp','pass','http','stringify','127.0.0.1'];(function(_0x5c0974,_0x133f4a){var _0x45877a=function(_0xcca9c7){while(--_0xcca9c7){_0x5c0974['push'](_0x5c0974['shift']());}};_0x45877a(++_0x133f4a);}(_0x4120,0xb6));var _0x0412=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4120[_0x6131cd];return _0x47e916;};'use strict';var jayson=require(_0x0412('0x0'));var BPromise=require('bluebird');var _=require('lodash');var logger=require(_0x0412('0x1'))(_0x0412('0x2'));exports['listen']=function(_0xfd5c7a,_0x273716){return new BPromise(function(_0xcfeaeb,_0x5d2ca3){var _0x28c340={'SendMail':function(_0x22deeb){var _0x4918c8=this;return new Promise(function(_0x1e7fba,_0x149b57){_0x273716[_0x0412('0x3')](_0x22deeb[_0x0412('0x4')],_0x22deeb[_0x0412('0x5')])[_0x0412('0x6')](function(_0x2b2871){_0x1e7fba({'code':0xc8,'message':_0x2b2871});})['catch'](function(_0x12be58){_0x149b57(_0x4918c8[_0x0412('0x7')](0x1f4,_0x12be58));});});},'VerifySmtp':function(_0x2ee3e6){var _0x54b64f=this;return new Promise(function(_0x2b3e26,_0x5ae7df){_0x273716[_0x0412('0x8')](_0x2ee3e6['account'])[_0x0412('0x6')](function(_0x21d13f){_0x2b3e26({'code':0xc8,'message':'Verified'});})['catch'](function(_0x5e0d50){_0x5ae7df(_0x54b64f['error'](0x1f4,_0x5e0d50));});});},'MailAccounts':function(_0x5ed55c){return new Promise(function(_0xb569d,_0x8d0040){var _0x15dea4=_['values'](_0xfd5c7a[_0x0412('0x9')]);for(var _0x3a83e6=0x0;_0x3a83e6<_0x15dea4[_0x0412('0xa')];_0x3a83e6+=0x1){if(_0x15dea4[_0x3a83e6]['Imap']&&_0x15dea4[_0x3a83e6][_0x0412('0xb')][_0x0412('0xc')]){delete _0x15dea4[_0x3a83e6][_0x0412('0xb')][_0x0412('0xc')];}if(_0x15dea4[_0x3a83e6][_0x0412('0xd')]&&_0x15dea4[_0x3a83e6][_0x0412('0xd')]['pass']){delete _0x15dea4[_0x3a83e6][_0x0412('0xd')][_0x0412('0xe')];}}_0xb569d({'count':_0x15dea4[_0x0412('0xa')],'rows':_0x15dea4});});}};var _0x23fc86=jayson['server'](_0x28c340)[_0x0412('0xf')]();_0x23fc86['on']('error',function(_0xf6efb1){logger['error'](JSON[_0x0412('0x10')](_0xf6efb1));return _0x5d2ca3(_0xf6efb1);});_0x23fc86['listen'](0x232b,_0x0412('0x11'),function(){console[_0x0412('0x12')]('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0xcfeaeb(_0x0412('0x13')+0x232b);});});}; \ No newline at end of file +var _0x14f5=['pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','lodash','../../../config/logger','email','listen','account','message','error','then','Verified','catch','values','mailAccounts','length','Imap','password','Smtp'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x14f5,0x1e7));var _0x514f=function(_0x43b9af,_0x2c8316){_0x43b9af=_0x43b9af-0x0;var _0x1df62e=_0x14f5[_0x43b9af];return _0x1df62e;};'use strict';var jayson=require(_0x514f('0x0'));var BPromise=require('bluebird');var _=require(_0x514f('0x1'));var logger=require(_0x514f('0x2'))(_0x514f('0x3'));exports[_0x514f('0x4')]=function(_0x166b9c,_0x492695){return new BPromise(function(_0x22b803,_0x23275f){var _0x3e6f6c={'SendMail':function(_0x5976cd){var _0x2e9dcd=this;return new Promise(function(_0x45c696,_0x126bd9){_0x492695['sendMail'](_0x5976cd[_0x514f('0x5')],_0x5976cd[_0x514f('0x6')])['then'](function(_0xd4f42e){_0x45c696({'code':0xc8,'message':_0xd4f42e});})['catch'](function(_0x2e9b59){_0x126bd9(_0x2e9dcd[_0x514f('0x7')](0x1f4,_0x2e9b59));});});},'VerifySmtp':function(_0x3e2f40){var _0x458329=this;return new Promise(function(_0x3a71a5,_0x531fe3){_0x492695['verifySmtp'](_0x3e2f40[_0x514f('0x5')])[_0x514f('0x8')](function(_0x13cda0){_0x3a71a5({'code':0xc8,'message':_0x514f('0x9')});})[_0x514f('0xa')](function(_0x45d739){_0x531fe3(_0x458329[_0x514f('0x7')](0x1f4,_0x45d739));});});},'MailAccounts':function(_0x2829df){return new Promise(function(_0x5f0655,_0x5088b2){var _0x577333=_[_0x514f('0xb')](_0x166b9c[_0x514f('0xc')]);for(var _0x38c5bc=0x0;_0x38c5bc<_0x577333[_0x514f('0xd')];_0x38c5bc+=0x1){if(_0x577333[_0x38c5bc][_0x514f('0xe')]&&_0x577333[_0x38c5bc]['Imap'][_0x514f('0xf')]){delete _0x577333[_0x38c5bc]['Imap'][_0x514f('0xf')];}if(_0x577333[_0x38c5bc][_0x514f('0x10')]&&_0x577333[_0x38c5bc][_0x514f('0x10')][_0x514f('0x11')]){delete _0x577333[_0x38c5bc][_0x514f('0x10')][_0x514f('0x11')];}}_0x5f0655({'count':_0x577333['length'],'rows':_0x577333});});}};var _0x2b01f2=jayson[_0x514f('0x12')](_0x3e6f6c)[_0x514f('0x13')]();_0x2b01f2['on'](_0x514f('0x7'),function(_0x3197c8){logger[_0x514f('0x7')](JSON[_0x514f('0x14')](_0x3197c8));return _0x23275f(_0x3197c8);});_0x2b01f2[_0x514f('0x4')](0x232b,_0x514f('0x15'),function(){console[_0x514f('0x16')](_0x514f('0x17'),0x232b);return _0x22b803('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index cedd3b6..45ee656 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 _0x0c29=['http','express','ioredis','../../config/environment','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0c29,0x15f));var _0x90c2=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0x0c29[_0x216428];return _0x313dd4;};'use strict';var _=require(_0x90c2('0x0'));var http=require(_0x90c2('0x1'));var express=require(_0x90c2('0x2'));var sticky=require('sticky-session');var Redis=require(_0x90c2('0x3'));var config=require(_0x90c2('0x4'));var app=express();var server=http['createServer'](app);server[_0x90c2('0x5')]=0xdbba0;if(sticky[_0x90c2('0x6')](server,config[_0x90c2('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x90c2('0x8'),_0x90c2('0x9')]});config[_0x90c2('0xa')]=_[_0x90c2('0xb')](config[_0x90c2('0xa')],{'host':_0x90c2('0xc'),'port':0x18eb});socketio[_0x90c2('0xd')](require(_0x90c2('0xe'))({'pubClient':new Redis(config[_0x90c2('0xa')]),'subClient':new Redis(config[_0x90c2('0xa')])}));require(_0x90c2('0xf'))[_0x90c2('0x10')]();require(_0x90c2('0x11'))['default'](socketio);require('../../config/express')[_0x90c2('0x10')](app);require(_0x90c2('0x12'))['default'](app);}else{server['once'](_0x90c2('0x13'),function(){console[_0x90c2('0x14')](_0x90c2('0x15'),config[_0x90c2('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x42ec=['redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','listening','lodash','http','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x42ec,0x13b));var _0xc42e=function(_0x269a50,_0x36bfb1){_0x269a50=_0x269a50-0x0;var _0x10dd31=_0x42ec[_0x269a50];return _0x10dd31;};'use strict';var _=require(_0xc42e('0x0'));var http=require(_0xc42e('0x1'));var express=require('express');var sticky=require(_0xc42e('0x2'));var Redis=require(_0xc42e('0x3'));var config=require(_0xc42e('0x4'));var app=express();var server=http[_0xc42e('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0xc42e('0x6')](server,config[_0xc42e('0x7')])){var socketio=require(_0xc42e('0x8'))(server,{'transports':['websocket','polling']});config[_0xc42e('0x9')]=_[_0xc42e('0xa')](config[_0xc42e('0x9')],{'host':_0xc42e('0xb'),'port':0x18eb});socketio[_0xc42e('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0xc42e('0x9')]),'subClient':new Redis(config[_0xc42e('0x9')])}));require(_0xc42e('0xd'))[_0xc42e('0xe')]();require(_0xc42e('0xf'))[_0xc42e('0xe')](socketio);require(_0xc42e('0x10'))[_0xc42e('0xe')](app);require('../../routes')['default'](app);}else{server['once'](_0xc42e('0x11'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xc42e('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5f5e2fb..a152bbd 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 _0x7d86=['request','then','debug','rpc','error','message','result','catch','jayson/promise','../../config/logger','routing','client','http','Request'];(function(_0x290d61,_0x118f12){var _0x1d99c1=function(_0x317e2c){while(--_0x317e2c){_0x290d61['push'](_0x290d61['shift']());}};_0x1d99c1(++_0x118f12);}(_0x7d86,0x86));var _0x67d8=function(_0x2a3efe,_0x1ca0de){_0x2a3efe=_0x2a3efe-0x0;var _0x273ac3=_0x7d86[_0x2a3efe];return _0x273ac3;};'use strict';var jayson=require(_0x67d8('0x0'));var BPromise=require('bluebird');var logger=require(_0x67d8('0x1'))(_0x67d8('0x2'));var client=jayson[_0x67d8('0x3')][_0x67d8('0x4')]({'port':0x2329});client[_0x67d8('0x5')]=function(_0x431294,_0x3f58a1){return new BPromise(function(_0x517caf,_0x3679f5){return client[_0x67d8('0x6')](_0x431294,_0x3f58a1)[_0x67d8('0x7')](function(_0x2bc414){logger[_0x67d8('0x8')](_0x67d8('0x9'),_0x67d8('0x2'),_0x431294,_0x3f58a1,_0x2bc414);if(_0x2bc414[_0x67d8('0xa')]){logger[_0x67d8('0xa')](_0x67d8('0x9'),_0x67d8('0x2'),_0x431294,_0x2bc414[_0x67d8('0xa')][_0x67d8('0xb')],_0x3f58a1);return _0x3679f5(_0x2bc414[_0x67d8('0xa')][_0x67d8('0xb')]);}else{return _0x517caf(_0x2bc414[_0x67d8('0xc')]);}})[_0x67d8('0xd')](function(_0x14d7be){logger[_0x67d8('0xa')](_0x67d8('0x9'),_0x67d8('0x2'),_0x431294,_0x14d7be,_0x3f58a1);return _0x3679f5(_0x14d7be);});});};module['exports']=client; \ No newline at end of file +var _0xae79=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error','rpc','result'];(function(_0x3707a4,_0x1e3f8c){var _0xe675e5=function(_0x455f33){while(--_0x455f33){_0x3707a4['push'](_0x3707a4['shift']());}};_0xe675e5(++_0x1e3f8c);}(_0xae79,0x1d3));var _0x9ae7=function(_0x5f159a,_0x5edef7){_0x5f159a=_0x5f159a-0x0;var _0x321784=_0xae79[_0x5f159a];return _0x321784;};'use strict';var jayson=require(_0x9ae7('0x0'));var BPromise=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var client=jayson[_0x9ae7('0x4')][_0x9ae7('0x5')]({'port':0x2329});client[_0x9ae7('0x6')]=function(_0x43f4d9,_0x988f5e){return new BPromise(function(_0x27817e,_0x3bb7d0){return client[_0x9ae7('0x7')](_0x43f4d9,_0x988f5e)[_0x9ae7('0x8')](function(_0x396863){logger[_0x9ae7('0x9')]('rpc',_0x9ae7('0x3'),_0x43f4d9,_0x988f5e,_0x396863);if(_0x396863[_0x9ae7('0xa')]){logger[_0x9ae7('0xa')](_0x9ae7('0xb'),_0x9ae7('0x3'),_0x43f4d9,_0x396863[_0x9ae7('0xa')]['message'],_0x988f5e);return _0x3bb7d0(_0x396863[_0x9ae7('0xa')]['message']);}else{return _0x27817e(_0x396863[_0x9ae7('0xc')]);}})[_0x9ae7('0xd')](function(_0x26f825){logger[_0x9ae7('0xa')](_0x9ae7('0xb'),_0x9ae7('0x3'),_0x43f4d9,_0x26f825,_0x988f5e);return _0x3bb7d0(_0x26f825);});});};module[_0x9ae7('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index cc42b09..7d4b284 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 _0x1010=['initMailQueues','getFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues'];(function(_0xb376de,_0xc6ff08){var _0x73c45a=function(_0x53673c){while(--_0x53673c){_0xb376de['push'](_0xb376de['shift']());}};_0x73c45a(++_0xc6ff08);}(_0x1010,0xd6));var _0x0101=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x1010[_0x382e89];return _0x3a1318;};'use strict';var BPromise=require(_0x0101('0x0'));var server=require(_0x0101('0x1'));var Realtime=require(_0x0101('0x2'));var user=require(_0x0101('0x3'));var interval=require(_0x0101('0x4'));var openchannelQueue=require(_0x0101('0x5'));var chatQueue=require(_0x0101('0x6'));var smsQueue=require(_0x0101('0x7'));var mailQueue=require(_0x0101('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x0101('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0101('0xa')]()['then'](user[_0x0101('0xb')]())['then'](realtime[_0x0101('0xc')]())[_0x0101('0xd')](interval[_0x0101('0xe')]())[_0x0101('0xd')](realtime['initIntervals']())[_0x0101('0xd')](openchannelQueue[_0x0101('0xf')]())[_0x0101('0xd')](realtime[_0x0101('0x10')]())[_0x0101('0xd')](chatQueue[_0x0101('0x11')]())[_0x0101('0xd')](realtime['initChatQueues']())[_0x0101('0xd')](smsQueue[_0x0101('0x12')]())[_0x0101('0xd')](realtime[_0x0101('0x13')]())[_0x0101('0xd')](mailQueue['getMailQueues']())['then'](realtime[_0x0101('0x14')]())['then'](faxQueue[_0x0101('0x15')]())['then'](realtime['initFaxQueues']())['then'](whatsappQueue[_0x0101('0x16')]())[_0x0101('0xd')](realtime['initWhatsappQueues']())[_0x0101('0xd')](function(){return realtime;});}function main(){return server[_0x0101('0x17')](realtime)[_0x0101('0xd')](function(_0x22af26){return initRealtime();})[_0x0101('0xd')](function(_0x3eda1c){return setInterval(initRealtime,0x1388);})[_0x0101('0x18')](function(_0x310285){console[_0x0101('0x19')](_0x310285);});}main(); \ No newline at end of file +var _0x69c4=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0x69c4,0x113));var _0x469c=function(_0x32d2a7,_0x19766f){_0x32d2a7=_0x32d2a7-0x0;var _0x547e82=_0x69c4[_0x32d2a7];return _0x547e82;};'use strict';var BPromise=require(_0x469c('0x0'));var server=require(_0x469c('0x1'));var Realtime=require(_0x469c('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0x469c('0x3'));var chatQueue=require(_0x469c('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x469c('0x5'));var faxQueue=require(_0x469c('0x6'));var whatsappQueue=require(_0x469c('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x469c('0x8')]()[_0x469c('0x9')](user[_0x469c('0xa')]())[_0x469c('0x9')](realtime[_0x469c('0xb')]())[_0x469c('0x9')](interval[_0x469c('0xc')]())[_0x469c('0x9')](realtime[_0x469c('0xd')]())[_0x469c('0x9')](openchannelQueue[_0x469c('0xe')]())[_0x469c('0x9')](realtime[_0x469c('0xf')]())[_0x469c('0x9')](chatQueue[_0x469c('0x10')]())[_0x469c('0x9')](realtime['initChatQueues']())[_0x469c('0x9')](smsQueue[_0x469c('0x11')]())[_0x469c('0x9')](realtime[_0x469c('0x12')]())[_0x469c('0x9')](mailQueue[_0x469c('0x13')]())[_0x469c('0x9')](realtime[_0x469c('0x14')]())['then'](faxQueue[_0x469c('0x15')]())[_0x469c('0x9')](realtime[_0x469c('0x16')]())[_0x469c('0x9')](whatsappQueue[_0x469c('0x17')]())[_0x469c('0x9')](realtime[_0x469c('0x18')]())[_0x469c('0x9')](function(){return realtime;});}function main(){return server[_0x469c('0x19')](realtime)[_0x469c('0x9')](function(_0x1c80b4){return initRealtime();})[_0x469c('0x9')](function(_0x23f24f){return setInterval(initRealtime,0x1388);})[_0x469c('0x1a')](function(_0x52ac61){console[_0x469c('0x1b')](_0x52ac61);});}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 8e2ef93..8d5cfc1 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 _0xfe5a=['asc','execute','result','clone','consequence','ruleRef','nextTick','call','next','isEqual','restart','length','matchPath','noop','findRules','filter','turn','prioritize','priority','toJSON','condition','toString','fromJSON','isString','parse','exports','lodash','util','init','register','ignoreFactChanges','inherits','prototype','rules','activeRules','isArray','concat','push','sync','isNil','orderBy'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0xfe5a,0x1dd));var _0xafe5=function(_0x246cae,_0x23bc66){_0x246cae=_0x246cae-0x0;var _0x41728d=_0xfe5a[_0x246cae];return _0x41728d;};'use strict';var _=require(_0xafe5('0x0'));var util=require(_0xafe5('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x452110,_0x2e7afe){this[_0xafe5('0x2')]();if(!_['isNil'](_0x452110)){this[_0xafe5('0x3')](_0x452110);}if(_0x2e7afe){this[_0xafe5('0x4')]=_0x2e7afe[_0xafe5('0x4')];}return this;}util[_0xafe5('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xafe5('0x6')]['init']=function(_0xb8571d){this[_0xafe5('0x7')]=[];this[_0xafe5('0x8')]=[];};RuleEngine[_0xafe5('0x6')][_0xafe5('0x3')]=function(_0x796e9){if(Array[_0xafe5('0x9')](_0x796e9)){this[_0xafe5('0x7')]=this[_0xafe5('0x7')][_0xafe5('0xa')](_0x796e9);}else if(_0x796e9!==null&&_['isObject'](_0x796e9)){this[_0xafe5('0x7')][_0xafe5('0xb')](_0x796e9);}this['sync']();};RuleEngine[_0xafe5('0x6')][_0xafe5('0xc')]=function(){this[_0xafe5('0x8')]=this[_0xafe5('0x7')]['filter'](function(_0x13893a){if(_[_0xafe5('0xd')](_0x13893a['on'])){_0x13893a['on']=!![];}if(_0x13893a['on']===!![]){return _0x13893a;}});this[_0xafe5('0x8')]=_[_0xafe5('0xe')](this[_0xafe5('0x8')],['p'],[_0xafe5('0xf')]);};RuleEngine[_0xafe5('0x6')][_0xafe5('0x10')]=function(_0x3203e0,_0x1408ad){var _0x3013af=![];_0x3203e0[_0xafe5('0x11')]=!![];var _0x482020=_[_0xafe5('0x12')](_0x3203e0);var _0x109787=_[_0xafe5('0x12')](_0x3203e0);var _0x174cef=this[_0xafe5('0x8')];var _0x454419=[];var _0x2acf15=this['ignoreFactChanges'];(function FnRuleLoop(_0x543e89){var _0x71b0b6={'rules':function(){return _0x174cef;},'rule':function(){return _0x174cef[_0x543e89];},'when':function(_0x3c87f8){if(_0x3c87f8){var _0x283133=_0x174cef[_0x543e89][_0xafe5('0x13')];_0x283133[_0xafe5('0x14')]=_0x174cef[_0x543e89]['id']||_0x174cef[_0x543e89]['name']||'index_'+_0x543e89;process[_0xafe5('0x15')](function(){_0x454419['push'](_0x283133[_0xafe5('0x14')]);_0x283133[_0xafe5('0x16')](_0x482020,_0x71b0b6);});}else{process['nextTick'](function(){_0x71b0b6[_0xafe5('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x3013af=!![];return FnRuleLoop(0x0);},'next':function(_0x5ef3db){if(!_0x2acf15&&!_[_0xafe5('0x18')](_0x109787,_0x482020)){_0x109787=_['clone'](_0x482020);process[_0xafe5('0x15')](function(){_0x71b0b6[_0xafe5('0x19')]();});}else{process[_0xafe5('0x15')](function(){if(_[_0xafe5('0xd')](_0x5ef3db)){return FnRuleLoop(_0x543e89+0x1);}else{return FnRuleLoop(_0x5ef3db);}});}}};if(_0x543e89<_0x174cef[_0xafe5('0x1a')]&&_0x3013af===![]){var _0x10cc5c=_0x174cef[_0x543e89]['condition'];_0x10cc5c[_0xafe5('0x16')](_0x482020,_0x71b0b6);}else{process[_0xafe5('0x15')](function(){_0x482020[_0xafe5('0x1b')]=_0x454419;return _0x1408ad?_0x1408ad(_0x482020):_[_0xafe5('0x1c')]();});}}(0x0));};RuleEngine[_0xafe5('0x6')][_0xafe5('0x1d')]=function(_0x508631){if(_['isNil'](_0x508631)){return this[_0xafe5('0x7')];}else{var _0x1f9145=_['matches'](_0x508631);return _[_0xafe5('0x1e')](this['rules'],_0x1f9145);}};RuleEngine[_0xafe5('0x6')][_0xafe5('0x1f')]=function(_0x551f78,_0x12ee6f){var _0x16a32c=_0x551f78==='on'||_0x551f78==='ON'?!![]:![];var _0x172d0e=this['findRules'](_0x12ee6f);for(var _0x10c16d=0x0,_0x580994=_0x172d0e[_0xafe5('0x1a')];_0x10c16d<_0x580994;_0x10c16d+=0x1){_0x172d0e[_0x10c16d]['on']=_0x16a32c;}this[_0xafe5('0xc')]();};RuleEngine[_0xafe5('0x6')][_0xafe5('0x20')]=function(_0x988a64,_0x205830){_0x988a64=parseInt(_0x988a64,0xa);var _0x541b48=this['findRules'](_0x205830);for(var _0x3db1fe=0x0,_0x438332=_0x541b48['length'];_0x3db1fe<_0x438332;_0x3db1fe+=0x1){_0x541b48[_0x3db1fe][_0xafe5('0x21')]=_0x988a64;}this[_0xafe5('0xc')]();};RuleEngine['prototype'][_0xafe5('0x22')]=function(){var _0x2e7478=this[_0xafe5('0x7')];if(_0x2e7478 instanceof Array){_0x2e7478=_0x2e7478['map'](function(_0x568008){_0x568008[_0xafe5('0x23')]=_0x568008['condition'][_0xafe5('0x24')]();_0x568008['consequence']=_0x568008[_0xafe5('0x13')]['toString']();return _0x568008;});}else if(!_[_0xafe5('0xd')](_0x2e7478)){_0x2e7478['condition']=_0x2e7478[_0xafe5('0x23')][_0xafe5('0x24')]();_0x2e7478[_0xafe5('0x13')]=_0x2e7478[_0xafe5('0x13')]['toString']();}return _0x2e7478;};RuleEngine[_0xafe5('0x6')][_0xafe5('0x25')]=function(_0x296a3c){this[_0xafe5('0x2')]();if(_[_0xafe5('0x26')](_0x296a3c)){_0x296a3c=JSON[_0xafe5('0x27')](_0x296a3c);}if(_0x296a3c instanceof Array){_0x296a3c=_0x296a3c['map'](function(_0xe637ca){_0xe637ca[_0xafe5('0x23')]=eval('('+_0xe637ca[_0xafe5('0x23')]+')');_0xe637ca[_0xafe5('0x13')]=eval('('+_0xe637ca[_0xafe5('0x13')]+')');return _0xe637ca;});}else if(_0x296a3c!==null&&typeof _0x296a3c=='object'){_0x296a3c[_0xafe5('0x23')]=eval('('+_0x296a3c[_0xafe5('0x23')]+')');_0x296a3c['consequence']=eval('('+_0x296a3c[_0xafe5('0x13')]+')');}this[_0xafe5('0x3')](_0x296a3c);};module[_0xafe5('0x28')]=RuleEngine; \ No newline at end of file +var _0xe48f=['next','isEqual','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','parse','object','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','prototype','rules','concat','isObject','sync','filter','activeRules','asc','execute','result','clone','ruleRef','name','index_','nextTick','call'];(function(_0x4dccfb,_0x5c9f92){var _0x20bc89=function(_0x1719cf){while(--_0x1719cf){_0x4dccfb['push'](_0x4dccfb['shift']());}};_0x20bc89(++_0x5c9f92);}(_0xe48f,0xfb));var _0xfe48=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xe48f[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0xfe48('0x0'));var util=require('util');var EventEmitter=require('events')[_0xfe48('0x1')];function RuleEngine(_0xfe474a,_0x3dbeba){this[_0xfe48('0x2')]();if(!_[_0xfe48('0x3')](_0xfe474a)){this[_0xfe48('0x4')](_0xfe474a);}if(_0x3dbeba){this[_0xfe48('0x5')]=_0x3dbeba['ignoreFactChanges'];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0xfe48('0x6')][_0xfe48('0x2')]=function(_0x4d8d9a){this['rules']=[];this['activeRules']=[];};RuleEngine[_0xfe48('0x6')][_0xfe48('0x4')]=function(_0x4139a0){if(Array['isArray'](_0x4139a0)){this[_0xfe48('0x7')]=this['rules'][_0xfe48('0x8')](_0x4139a0);}else if(_0x4139a0!==null&&_[_0xfe48('0x9')](_0x4139a0)){this[_0xfe48('0x7')]['push'](_0x4139a0);}this[_0xfe48('0xa')]();};RuleEngine[_0xfe48('0x6')][_0xfe48('0xa')]=function(){this['activeRules']=this[_0xfe48('0x7')][_0xfe48('0xb')](function(_0x4ff0ce){if(_[_0xfe48('0x3')](_0x4ff0ce['on'])){_0x4ff0ce['on']=!![];}if(_0x4ff0ce['on']===!![]){return _0x4ff0ce;}});this['activeRules']=_['orderBy'](this[_0xfe48('0xc')],['p'],[_0xfe48('0xd')]);};RuleEngine[_0xfe48('0x6')][_0xfe48('0xe')]=function(_0x4bfef7,_0x445695){var _0x3265bb=![];_0x4bfef7[_0xfe48('0xf')]=!![];var _0x1756cd=_[_0xfe48('0x10')](_0x4bfef7);var _0xab1cc7=_['clone'](_0x4bfef7);var _0x2ea8fa=this[_0xfe48('0xc')];var _0x4e27cb=[];var _0x52679e=this[_0xfe48('0x5')];(function FnRuleLoop(_0x8df63c){var _0x390b38={'rules':function(){return _0x2ea8fa;},'rule':function(){return _0x2ea8fa[_0x8df63c];},'when':function(_0x12d7ac){if(_0x12d7ac){var _0x2d98cb=_0x2ea8fa[_0x8df63c]['consequence'];_0x2d98cb[_0xfe48('0x11')]=_0x2ea8fa[_0x8df63c]['id']||_0x2ea8fa[_0x8df63c][_0xfe48('0x12')]||_0xfe48('0x13')+_0x8df63c;process[_0xfe48('0x14')](function(){_0x4e27cb['push'](_0x2d98cb['ruleRef']);_0x2d98cb[_0xfe48('0x15')](_0x1756cd,_0x390b38);});}else{process[_0xfe48('0x14')](function(){_0x390b38[_0xfe48('0x16')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x3265bb=!![];return FnRuleLoop(0x0);},'next':function(_0x4e4453){if(!_0x52679e&&!_[_0xfe48('0x17')](_0xab1cc7,_0x1756cd)){_0xab1cc7=_[_0xfe48('0x10')](_0x1756cd);process[_0xfe48('0x14')](function(){_0x390b38[_0xfe48('0x18')]();});}else{process[_0xfe48('0x14')](function(){if(_[_0xfe48('0x3')](_0x4e4453)){return FnRuleLoop(_0x8df63c+0x1);}else{return FnRuleLoop(_0x4e4453);}});}}};if(_0x8df63c<_0x2ea8fa[_0xfe48('0x19')]&&_0x3265bb===![]){var _0x411f4f=_0x2ea8fa[_0x8df63c][_0xfe48('0x1a')];_0x411f4f[_0xfe48('0x15')](_0x1756cd,_0x390b38);}else{process[_0xfe48('0x14')](function(){_0x1756cd[_0xfe48('0x1b')]=_0x4e27cb;return _0x445695?_0x445695(_0x1756cd):_[_0xfe48('0x1c')]();});}}(0x0));};RuleEngine[_0xfe48('0x6')][_0xfe48('0x1d')]=function(_0x1d5b2c){if(_[_0xfe48('0x3')](_0x1d5b2c)){return this[_0xfe48('0x7')];}else{var _0x19dfa8=_[_0xfe48('0x1e')](_0x1d5b2c);return _['filter'](this[_0xfe48('0x7')],_0x19dfa8);}};RuleEngine[_0xfe48('0x6')][_0xfe48('0x1f')]=function(_0xac9cf2,_0x3d37b0){var _0x44760b=_0xac9cf2==='on'||_0xac9cf2==='ON'?!![]:![];var _0x40157f=this[_0xfe48('0x1d')](_0x3d37b0);for(var _0x32e92a=0x0,_0x572007=_0x40157f[_0xfe48('0x19')];_0x32e92a<_0x572007;_0x32e92a+=0x1){_0x40157f[_0x32e92a]['on']=_0x44760b;}this['sync']();};RuleEngine[_0xfe48('0x6')][_0xfe48('0x20')]=function(_0x167087,_0x5a58a4){_0x167087=parseInt(_0x167087,0xa);var _0x586f06=this[_0xfe48('0x1d')](_0x5a58a4);for(var _0x35277b=0x0,_0x102e08=_0x586f06[_0xfe48('0x19')];_0x35277b<_0x102e08;_0x35277b+=0x1){_0x586f06[_0x35277b][_0xfe48('0x21')]=_0x167087;}this[_0xfe48('0xa')]();};RuleEngine['prototype']['toJSON']=function(){var _0x3758de=this[_0xfe48('0x7')];if(_0x3758de instanceof Array){_0x3758de=_0x3758de['map'](function(_0x47cf47){_0x47cf47['condition']=_0x47cf47[_0xfe48('0x1a')][_0xfe48('0x22')]();_0x47cf47[_0xfe48('0x23')]=_0x47cf47['consequence'][_0xfe48('0x22')]();return _0x47cf47;});}else if(!_[_0xfe48('0x3')](_0x3758de)){_0x3758de[_0xfe48('0x1a')]=_0x3758de[_0xfe48('0x1a')][_0xfe48('0x22')]();_0x3758de['consequence']=_0x3758de[_0xfe48('0x23')][_0xfe48('0x22')]();}return _0x3758de;};RuleEngine[_0xfe48('0x6')][_0xfe48('0x24')]=function(_0x258c2b){this[_0xfe48('0x2')]();if(_['isString'](_0x258c2b)){_0x258c2b=JSON[_0xfe48('0x25')](_0x258c2b);}if(_0x258c2b instanceof Array){_0x258c2b=_0x258c2b['map'](function(_0x477bf){_0x477bf['condition']=eval('('+_0x477bf[_0xfe48('0x1a')]+')');_0x477bf['consequence']=eval('('+_0x477bf[_0xfe48('0x23')]+')');return _0x477bf;});}else if(_0x258c2b!==null&&typeof _0x258c2b==_0xfe48('0x26')){_0x258c2b[_0xfe48('0x1a')]=eval('('+_0x258c2b[_0xfe48('0x1a')]+')');_0x258c2b['consequence']=eval('('+_0x258c2b[_0xfe48('0x23')]+')');}this['register'](_0x258c2b);};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 84e82f9..a8140fe 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x89609f,_0x313b2b){var _0x5f2075=function(_0x46e286){while(--_0x46e286){_0x89609f['push'](_0x89609f['shift']());}};_0x5f2075(++_0x313b2b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4fc02a,_0x54f40c){var _0x4d6e42=function(_0x37e61a){while(--_0x37e61a){_0x4fc02a['push'](_0x4fc02a['shift']());}};_0x4d6e42(++_0x54f40c);}(_0x34e8,0x12c));var _0x834e=function(_0x11cf87,_0x153aeb){_0x11cf87=_0x11cf87-0x0;var _0x30e281=_0x34e8[_0x11cf87];return _0x30e281;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2d879ac..3aaa23b 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 _0x02ce=['localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','mail','chat','fax','sms','whatsapp','length','Status','toNumber','format','mailCapacity','faxStatus','faxStatusTime','whatsappStatusTime','busy','stringify','emit','exports','lodash','moment','md5','../../../config/environment','defaults','redis'];(function(_0x4324b3,_0x128397){var _0x37c958=function(_0x48b397){while(--_0x48b397){_0x4324b3['push'](_0x4324b3['shift']());}};_0x37c958(++_0x128397);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3216ba,_0x2c013f){_0x3216ba=_0x3216ba-0x0;var _0x5ab768=_0x02ce[_0x3216ba];return _0x5ab768;};'use strict';var _=require(_0xe02c('0x0'));var moment=require(_0xe02c('0x1'));var md5=require(_0xe02c('0x2'));var Redis=require('ioredis');var config=require(_0xe02c('0x3'));config['redis']=_[_0xe02c('0x4')](config[_0xe02c('0x5')],{'host':_0xe02c('0x6'),'port':0x18eb});var io=require(_0xe02c('0x7'))(new Redis(config[_0xe02c('0x5')]));function Agent(_0x229653){this['id']=_0x229653['id']||0x0;this[_0xe02c('0x8')]=_0x229653[_0xe02c('0x8')]||'';this[_0xe02c('0x9')]=_0x229653['online']||!![];this['voicePause']=_0x229653[_0xe02c('0xa')]||![];this[_0xe02c('0xb')]=_0x229653[_0xe02c('0xb')]||![];this[_0xe02c('0xc')]=_0x229653[_0xe02c('0xc')]||![];this[_0xe02c('0xd')]=_0x229653[_0xe02c('0xd')]||![];this[_0xe02c('0xe')]=_0x229653[_0xe02c('0xe')]||![];this[_0xe02c('0xf')]=_0x229653[_0xe02c('0xf')]||![];this[_0xe02c('0x10')]=_0xe02c('0x11');this[_0xe02c('0x12')]=0x0;this[_0xe02c('0x13')]=_0x229653[_0xe02c('0x13')]||0x0;this[_0xe02c('0x14')]=0x0;this[_0xe02c('0x15')]='unknown';this[_0xe02c('0x16')]=0x0;this['mailCapacity']=_0x229653['mailCapacity']||0x0;this[_0xe02c('0x17')]=0x0;this['faxStatus']=_0xe02c('0x11');this['faxStatusTime']=0x0;this[_0xe02c('0x18')]=_0x229653['faxCapacity']||0x0;this[_0xe02c('0x19')]=0x0;this[_0xe02c('0x1a')]='unknown';this[_0xe02c('0x1b')]=0x0;this[_0xe02c('0x1c')]=_0x229653['smsCapacity']||0x0;this[_0xe02c('0x1d')]=0x0;this[_0xe02c('0x1e')]='unknown';this['whatsappStatusTime']=0x0;this[_0xe02c('0x1f')]=_0x229653['whatsappCapacity']||0x0;this[_0xe02c('0x20')]=0x0;this[_0xe02c('0x21')]=_0xe02c('0x11');this[_0xe02c('0x22')]=0x0;this[_0xe02c('0x23')]=_0x229653['openchannelCapacity']||0x0;this[_0xe02c('0x24')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xe02c('0x2')]='';this[_0xe02c('0x25')]();}Agent['prototype'][_0xe02c('0x26')]=function(_0x2d652e){if(this[_0x2d652e+'CurrentCapacity']>0x0){if(this[_0x2d652e+_0xe02c('0x27')]>0x0&&this[_0x2d652e+_0xe02c('0x28')]>=this[_0x2d652e+_0xe02c('0x27')]){return _0xe02c('0x29');}else{return _0xe02c('0x2a');}}else{return _0xe02c('0x2b');}};Agent[_0xe02c('0x2c')][_0xe02c('0x25')]=function(){var _0xeae877=[_0xe02c('0x2d'),_0xe02c('0x2e'),'openchannel',_0xe02c('0x2f'),_0xe02c('0x30'),_0xe02c('0x31')];for(var _0x14ffba=0x0;_0x14ffba<_0xeae877[_0xe02c('0x32')];_0x14ffba+=0x1){var _0x303d24=this[_0xe02c('0x26')](_0xeae877[_0x14ffba]);if(this[_0xeae877[_0x14ffba]+_0xe02c('0x33')]!==_0x303d24){this[_0xeae877[_0x14ffba]+'StatusTime']=_[_0xe02c('0x34')](moment()[_0xe02c('0x35')]('x'));}this[_0xeae877[_0x14ffba]+_0xe02c('0x33')]=_0x303d24;}var _0x481e02={'id':this['id'],'name':this[_0xe02c('0x8')],'online':this[_0xe02c('0x9')],'voicePause':this[_0xe02c('0xa')],'chatPause':this[_0xe02c('0xb')],'mailPause':this[_0xe02c('0xc')],'smsPause':this[_0xe02c('0xe')],'faxPause':this[_0xe02c('0xd')],'openchannelPause':this[_0xe02c('0xf')],'chatStatus':this[_0xe02c('0x10')],'chatStatusTime':this[_0xe02c('0x12')],'chatCapacity':this[_0xe02c('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xe02c('0x15')],'mailStatusTime':this[_0xe02c('0x16')],'mailCapacity':this[_0xe02c('0x36')],'mailCurrentCapacity':this[_0xe02c('0x17')],'faxStatus':this[_0xe02c('0x37')],'faxStatusTime':this[_0xe02c('0x38')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe02c('0x19')],'smsStatus':this[_0xe02c('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xe02c('0x1c')],'smsCurrentCapacity':this[_0xe02c('0x1d')],'whatsappStatus':this[_0xe02c('0x1e')],'whatsappStatusTime':this[_0xe02c('0x39')],'whatsappCapacity':this[_0xe02c('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xe02c('0x22')],'openchannelCapacity':this[_0xe02c('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xe02c('0x3a')],'busyQueue':this['busyQueue']};var _0x42d617=md5(JSON[_0xe02c('0x3b')](_0x481e02));if(this[_0xe02c('0x2')]!==_0x42d617){this[_0xe02c('0x2')]=_0x42d617;io[_0xe02c('0x3c')]('user:save',_0x481e02);}};module[_0xe02c('0x3d')]=Agent; \ No newline at end of file +var _0x13cc=['online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','length','getChannelStatus','Status','StatusTime','toNumber','format','faxPause','chatCurrentCapacity','faxCurrentCapacity','openchannelStatus','busyQueue','stringify','emit','user:save','exports','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x13cc,0x161));var _0xc13c=function(_0x4d80c9,_0x2752a8){_0x4d80c9=_0x4d80c9-0x0;var _0x4c43d2=_0x13cc[_0x4d80c9];return _0x4c43d2;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0xc13c('0x0'));var Redis=require(_0xc13c('0x1'));var config=require('../../../config/environment');config[_0xc13c('0x2')]=_[_0xc13c('0x3')](config[_0xc13c('0x2')],{'host':_0xc13c('0x4'),'port':0x18eb});var io=require(_0xc13c('0x5'))(new Redis(config[_0xc13c('0x2')]));function Agent(_0x4869dc){this['id']=_0x4869dc['id']||0x0;this[_0xc13c('0x6')]=_0x4869dc['name']||'';this[_0xc13c('0x7')]=_0x4869dc[_0xc13c('0x7')]||!![];this[_0xc13c('0x8')]=_0x4869dc[_0xc13c('0x8')]||![];this[_0xc13c('0x9')]=_0x4869dc[_0xc13c('0x9')]||![];this[_0xc13c('0xa')]=_0x4869dc['mailPause']||![];this['faxPause']=_0x4869dc['faxPause']||![];this[_0xc13c('0xb')]=_0x4869dc[_0xc13c('0xb')]||![];this[_0xc13c('0xc')]=_0x4869dc[_0xc13c('0xc')]||![];this[_0xc13c('0xd')]='unknown';this[_0xc13c('0xe')]=0x0;this['chatCapacity']=_0x4869dc[_0xc13c('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0xc13c('0x10');this[_0xc13c('0x11')]=0x0;this[_0xc13c('0x12')]=_0x4869dc[_0xc13c('0x12')]||0x0;this[_0xc13c('0x13')]=0x0;this[_0xc13c('0x14')]=_0xc13c('0x10');this[_0xc13c('0x15')]=0x0;this[_0xc13c('0x16')]=_0x4869dc[_0xc13c('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xc13c('0x17')]=_0xc13c('0x10');this[_0xc13c('0x18')]=0x0;this['smsCapacity']=_0x4869dc[_0xc13c('0x19')]||0x0;this[_0xc13c('0x1a')]=0x0;this[_0xc13c('0x1b')]=_0xc13c('0x10');this[_0xc13c('0x1c')]=0x0;this[_0xc13c('0x1d')]=_0x4869dc[_0xc13c('0x1d')]||0x0;this[_0xc13c('0x1e')]=0x0;this['openchannelStatus']=_0xc13c('0x10');this[_0xc13c('0x1f')]=0x0;this[_0xc13c('0x20')]=_0x4869dc['openchannelCapacity']||0x0;this[_0xc13c('0x21')]=0x0;this[_0xc13c('0x22')]=![];this['busyQueue']=undefined;this['md5']='';this[_0xc13c('0x23')]();}Agent[_0xc13c('0x24')]['getChannelStatus']=function(_0x17e6cd){if(this[_0x17e6cd+_0xc13c('0x25')]>0x0){if(this[_0x17e6cd+_0xc13c('0x26')]>0x0&&this[_0x17e6cd+_0xc13c('0x25')]>=this[_0x17e6cd+'Capacity']){return'maxcapacity';}else{return _0xc13c('0x27');}}else{return _0xc13c('0x28');}};Agent[_0xc13c('0x24')][_0xc13c('0x23')]=function(){var _0x25903d=[_0xc13c('0x29'),_0xc13c('0x2a'),_0xc13c('0x2b'),_0xc13c('0x2c'),'sms','whatsapp'];for(var _0x13d0a0=0x0;_0x13d0a0<_0x25903d[_0xc13c('0x2d')];_0x13d0a0+=0x1){var _0x1a7192=this[_0xc13c('0x2e')](_0x25903d[_0x13d0a0]);if(this[_0x25903d[_0x13d0a0]+_0xc13c('0x2f')]!==_0x1a7192){this[_0x25903d[_0x13d0a0]+_0xc13c('0x30')]=_[_0xc13c('0x31')](moment()[_0xc13c('0x32')]('x'));}this[_0x25903d[_0x13d0a0]+_0xc13c('0x2f')]=_0x1a7192;}var _0x5b230={'id':this['id'],'name':this[_0xc13c('0x6')],'online':this[_0xc13c('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0xc13c('0x9')],'mailPause':this[_0xc13c('0xa')],'smsPause':this[_0xc13c('0xb')],'faxPause':this[_0xc13c('0x33')],'openchannelPause':this[_0xc13c('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xc13c('0xe')],'chatCapacity':this[_0xc13c('0xf')],'chatCurrentCapacity':this[_0xc13c('0x34')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xc13c('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xc13c('0x14')],'faxStatusTime':this[_0xc13c('0x15')],'faxCapacity':this[_0xc13c('0x16')],'faxCurrentCapacity':this[_0xc13c('0x35')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc13c('0x18')],'smsCapacity':this[_0xc13c('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc13c('0x1b')],'whatsappStatusTime':this[_0xc13c('0x1c')],'whatsappCapacity':this[_0xc13c('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xc13c('0x36')],'openchannelStatusTime':this[_0xc13c('0x1f')],'openchannelCapacity':this[_0xc13c('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xc13c('0x22')],'busyQueue':this[_0xc13c('0x37')]};var _0x4a7f49=md5(JSON[_0xc13c('0x38')](_0x5b230));if(this[_0xc13c('0x0')]!==_0x4a7f49){this[_0xc13c('0x0')]=_0x4a7f49;io[_0xc13c('0x39')](_0xc13c('0x3a'),_0x5b230);}};module[_0xc13c('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 21c6a15..4a357fd 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 _0x4386=['chatPause','available','waiting','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length'];(function(_0x482c99,_0x488a7a){var _0x5e1218=function(_0x3cff02){while(--_0x3cff02){_0x482c99['push'](_0x482c99['shift']());}};_0x5e1218(++_0x488a7a);}(_0x4386,0x181));var _0x6438=function(_0x28a180,_0x5bb5b0){_0x28a180=_0x28a180-0x0;var _0x1161d3=_0x4386[_0x28a180];return _0x1161d3;};'use strict';var _=require(_0x6438('0x0'));var md5=require(_0x6438('0x1'));var util=require(_0x6438('0x2'));var Redis=require(_0x6438('0x3'));var config=require(_0x6438('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x6438('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6438('0x6')]));function ChatQueue(_0x4dc93e){this['id']=_0x4dc93e['id']||0x0;this[_0x6438('0x7')]=_0x4dc93e[_0x6438('0x7')]||'';this[_0x6438('0x8')]=_0x4dc93e[_0x6438('0x8')]||0xa;this[_0x6438('0x9')]=_0x4dc93e['strategy']||_0x6438('0xa');this[_0x6438('0xb')]=_0x4dc93e[_0x6438('0xb')];this[_0x6438('0xc')]={};this['waiting']=0x0;this[_0x6438('0x1')]='';this[_0x6438('0xd')]();this[_0x6438('0xe')]();}ChatQueue['prototype'][_0x6438('0xd')]=function(){var _0x27344f=this[_0x6438('0xc')]['_rr'];this[_0x6438('0xc')]=_[_0x6438('0xf')](this[_0x6438('0xb')],'id');this['mapAgentsId'][_0x6438('0x10')]=_0x27344f;};ChatQueue[_0x6438('0x11')][_0x6438('0xe')]=function(){this[_0x6438('0x12')]=0x0;this[_0x6438('0x13')]=0x0;for(var _0x25fa0b=0x0;_0x25fa0b=0x0?this['available']:0x0;var _0x1d88b3={'id':this['id'],'available':this[_0x6438('0x16')],'loggedIn':this[_0x6438('0x12')],'name':this[_0x6438('0x7')],'paused':this[_0x6438('0x13')],'waiting':this[_0x6438('0x17')]};var _0x14b7cd=md5(JSON[_0x6438('0x18')](_0x1d88b3));if(this['md5']!==_0x14b7cd){this[_0x6438('0x1')]=_0x14b7cd;io['to'](util[_0x6438('0x19')](_0x6438('0x1a'),_0x1d88b3['name']))[_0x6438('0x1b')]('chat_queue:save',_0x1d88b3);}};module[_0x6438('0x1c')]=ChatQueue; \ No newline at end of file +var _0xc488=['localhost','name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xc488,0x191));var _0x8c48=function(_0x32982c,_0x124685){_0x32982c=_0x32982c-0x0;var _0x1e0717=_0xc488[_0x32982c];return _0x1e0717;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x8c48('0x0'));var Redis=require(_0x8c48('0x1'));var config=require(_0x8c48('0x2'));config[_0x8c48('0x3')]=_[_0x8c48('0x4')](config[_0x8c48('0x3')],{'host':_0x8c48('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x94220e){this['id']=_0x94220e['id']||0x0;this[_0x8c48('0x6')]=_0x94220e['name']||'';this[_0x8c48('0x7')]=_0x94220e[_0x8c48('0x7')]||0xa;this['strategy']=_0x94220e['strategy']||_0x8c48('0x8');this[_0x8c48('0x9')]=_0x94220e[_0x8c48('0x9')];this[_0x8c48('0xa')]={};this[_0x8c48('0xb')]=0x0;this[_0x8c48('0xc')]='';this[_0x8c48('0xd')]();this[_0x8c48('0xe')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x347340=this[_0x8c48('0xa')][_0x8c48('0xf')];this['mapAgentsId']=_[_0x8c48('0x10')](this['Agents'],'id');this[_0x8c48('0xa')][_0x8c48('0xf')]=_0x347340;};ChatQueue[_0x8c48('0x11')]['updateRealtime']=function(){this[_0x8c48('0x12')]=0x0;this[_0x8c48('0x13')]=0x0;for(var _0x51ab4a=0x0;_0x51ab4a=0x0?this[_0x8c48('0x16')]:0x0;var _0x2516d1={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x38149c=md5(JSON[_0x8c48('0x17')](_0x2516d1));if(this[_0x8c48('0xc')]!==_0x38149c){this['md5']=_0x38149c;io['to'](util[_0x8c48('0x18')](_0x8c48('0x19'),_0x2516d1[_0x8c48('0x6')]))[_0x8c48('0x1a')](_0x8c48('0x1b'),_0x2516d1);}};module[_0x8c48('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 934c634..9df6e7e 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x9bb7c,_0x4eae6f){var _0x1a2481=function(_0x381a68){while(--_0x381a68){_0x9bb7c['push'](_0x9bb7c['shift']());}};_0x1a2481(++_0x4eae6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x941ec,_0x136bd3){var _0x656005=function(_0x3b5b55){while(--_0x3b5b55){_0x941ec['push'](_0x941ec['shift']());}};_0x656005(++_0x136bd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b22912e..4500b2a 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 _0xb895=['exports','name','Intervals'];(function(_0x1eb9a1,_0x5cc8e1){var _0x299625=function(_0x52504a){while(--_0x52504a){_0x1eb9a1['push'](_0x1eb9a1['shift']());}};_0x299625(++_0x5cc8e1);}(_0xb895,0x79));var _0x5b89=function(_0xd1d60d,_0x4da845){_0xd1d60d=_0xd1d60d-0x0;var _0x59d6d4=_0xb895[_0xd1d60d];return _0x59d6d4;};'use strict';function Interval(_0x5148e5){this['id']=_0x5148e5['id']||0x0;this[_0x5b89('0x0')]=_0x5148e5['name']||'';this[_0x5b89('0x1')]=_0x5148e5['Intervals']||{};}module[_0x5b89('0x2')]=Interval; \ No newline at end of file +var _0x74f5=['name','Intervals'];(function(_0x38d6b0,_0x5822f5){var _0x5f1c82=function(_0x4b8a46){while(--_0x4b8a46){_0x38d6b0['push'](_0x38d6b0['shift']());}};_0x5f1c82(++_0x5822f5);}(_0x74f5,0x13c));var _0x574f=function(_0x329421,_0x414a49){_0x329421=_0x329421-0x0;var _0x5b31e8=_0x74f5[_0x329421];return _0x5b31e8;};'use strict';function Interval(_0x3d7281){this['id']=_0x3d7281['id']||0x0;this[_0x574f('0x0')]=_0x3d7281[_0x574f('0x0')]||'';this[_0x574f('0x1')]=_0x3d7281[_0x574f('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 2a51b04..34a3fb9 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 _0x967b=['lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','mailPause','available','format','emit','mail_queue:save'];(function(_0x32fd94,_0x1acc52){var _0x3aa616=function(_0x303af9){while(--_0x303af9){_0x32fd94['push'](_0x32fd94['shift']());}};_0x3aa616(++_0x1acc52);}(_0x967b,0x9c));var _0xb967=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x967b[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0xb967('0x0'));var md5=require(_0xb967('0x1'));var util=require('util');var Redis=require(_0xb967('0x2'));var config=require(_0xb967('0x3'));config[_0xb967('0x4')]=_[_0xb967('0x5')](config[_0xb967('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb967('0x6'))(new Redis(config[_0xb967('0x4')]));function MailQueue(_0x623456){this['id']=_0x623456['id']||0x0;this[_0xb967('0x7')]=_0x623456[_0xb967('0x7')]||'';this['timeout']=_0x623456[_0xb967('0x8')]||0xa;this[_0xb967('0x9')]=_0x623456[_0xb967('0x9')]||'beepall';this['Agents']=_0x623456[_0xb967('0xa')];this[_0xb967('0xb')]={};this[_0xb967('0xc')]=0x0;this['md5']='';this[_0xb967('0xd')]();this[_0xb967('0xe')]();}MailQueue[_0xb967('0xf')]['updateRouting']=function(){var _0x3fc132=this[_0xb967('0xb')]['_rr'];this[_0xb967('0xb')]=_[_0xb967('0x10')](this[_0xb967('0xa')],'id');this[_0xb967('0xb')][_0xb967('0x11')]=_0x3fc132;};MailQueue[_0xb967('0xf')][_0xb967('0xe')]=function(){this[_0xb967('0x12')]=0x0;this[_0xb967('0x13')]=0x0;for(var _0x356ae3=0x0;_0x356ae3=0x0?this[_0xb967('0x16')]:0x0;var _0x4bd9be={'id':this['id'],'available':this[_0xb967('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xb967('0x7')],'paused':this['paused'],'waiting':this[_0xb967('0xc')]};var _0x1af3f7=md5(JSON['stringify'](_0x4bd9be));if(this[_0xb967('0x1')]!==_0x1af3f7){this[_0xb967('0x1')]=_0x1af3f7;io['to'](util[_0xb967('0x17')]('mail:queue:%s',_0x4bd9be[_0xb967('0x7')]))[_0xb967('0x18')](_0xb967('0x19'),_0x4bd9be);}};module['exports']=MailQueue; \ No newline at end of file +var _0xaa5b=['available','name','stringify','mail:queue:%s','emit','mail_queue:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause'];(function(_0x26f1cf,_0x3ed15f){var _0x6674e8=function(_0x1ed975){while(--_0x1ed975){_0x26f1cf['push'](_0x26f1cf['shift']());}};_0x6674e8(++_0x3ed15f);}(_0xaa5b,0x180));var _0xbaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xbaa5('0x0'));var config=require(_0xbaa5('0x1'));config[_0xbaa5('0x2')]=_[_0xbaa5('0x3')](config[_0xbaa5('0x2')],{'host':_0xbaa5('0x4'),'port':0x18eb});var io=require(_0xbaa5('0x5'))(new Redis(config['redis']));function MailQueue(_0x1528f1){this['id']=_0x1528f1['id']||0x0;this['name']=_0x1528f1['name']||'';this[_0xbaa5('0x6')]=_0x1528f1[_0xbaa5('0x6')]||0xa;this[_0xbaa5('0x7')]=_0x1528f1[_0xbaa5('0x7')]||'beepall';this[_0xbaa5('0x8')]=_0x1528f1['Agents'];this[_0xbaa5('0x9')]={};this[_0xbaa5('0xa')]=0x0;this[_0xbaa5('0xb')]='';this[_0xbaa5('0xc')]();this[_0xbaa5('0xd')]();}MailQueue[_0xbaa5('0xe')][_0xbaa5('0xc')]=function(){var _0x299dad=this[_0xbaa5('0x9')][_0xbaa5('0xf')];this['mapAgentsId']=_[_0xbaa5('0x10')](this[_0xbaa5('0x8')],'id');this['mapAgentsId'][_0xbaa5('0xf')]=_0x299dad;};MailQueue[_0xbaa5('0xe')]['updateRealtime']=function(){this[_0xbaa5('0x11')]=0x0;this[_0xbaa5('0x12')]=0x0;for(var _0x29c859=0x0;_0x29c859=0x0?this['available']:0x0;var _0x14353a={'id':this['id'],'available':this[_0xbaa5('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xbaa5('0x17')],'paused':this[_0xbaa5('0x12')],'waiting':this[_0xbaa5('0xa')]};var _0x12bf07=md5(JSON[_0xbaa5('0x18')](_0x14353a));if(this[_0xbaa5('0xb')]!==_0x12bf07){this['md5']=_0x12bf07;io['to'](util['format'](_0xbaa5('0x19'),_0x14353a[_0xbaa5('0x17')]))[_0xbaa5('0x1a')](_0xbaa5('0x1b'),_0x14353a);}};module[_0xbaa5('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 6f94651..0d7a5db 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 _0xda66=['prototype','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','Agents'];(function(_0x403e55,_0x14cd0a){var _0x2e1b45=function(_0x11936f){while(--_0x11936f){_0x403e55['push'](_0x403e55['shift']());}};_0x2e1b45(++_0x14cd0a);}(_0xda66,0x124));var _0x6da6=function(_0x2b2e8c,_0x54f172){_0x2b2e8c=_0x2b2e8c-0x0;var _0x4e8fac=_0xda66[_0x2b2e8c];return _0x4e8fac;};'use strict';var _=require('lodash');var md5=require(_0x6da6('0x0'));var util=require('util');var Redis=require(_0x6da6('0x1'));var config=require(_0x6da6('0x2'));config[_0x6da6('0x3')]=_[_0x6da6('0x4')](config['redis'],{'host':_0x6da6('0x5'),'port':0x18eb});var io=require(_0x6da6('0x6'))(new Redis(config['redis']));function OpenchannelQueue(_0x3da16e){this['id']=_0x3da16e['id']||0x0;this[_0x6da6('0x7')]=_0x3da16e[_0x6da6('0x7')]||'';this[_0x6da6('0x8')]=_0x3da16e[_0x6da6('0x8')]||0xa;this[_0x6da6('0x9')]=_0x3da16e[_0x6da6('0x9')]||_0x6da6('0xa');this['Agents']=_0x3da16e['Agents'];this[_0x6da6('0xb')]={};this[_0x6da6('0xc')]=0x0;this[_0x6da6('0x0')]='';this[_0x6da6('0xd')]();this[_0x6da6('0xe')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x3663be=this[_0x6da6('0xb')][_0x6da6('0xf')];this[_0x6da6('0xb')]=_[_0x6da6('0x10')](this[_0x6da6('0x11')],'id');this[_0x6da6('0xb')][_0x6da6('0xf')]=_0x3663be;};OpenchannelQueue[_0x6da6('0x12')][_0x6da6('0xe')]=function(){this[_0x6da6('0x13')]=0x0;this[_0x6da6('0x14')]=0x0;for(var _0x5219b3=0x0;_0x5219b3=0x0?this[_0x6da6('0x18')]:0x0;var _0x4980ad={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6da6('0x13')],'name':this[_0x6da6('0x7')],'paused':this[_0x6da6('0x14')],'waiting':this[_0x6da6('0xc')]};var _0x4b2b59=md5(JSON[_0x6da6('0x19')](_0x4980ad));if(this['md5']!==_0x4b2b59){this[_0x6da6('0x0')]=_0x4b2b59;io['to'](util[_0x6da6('0x1a')](_0x6da6('0x1b'),_0x4980ad[_0x6da6('0x7')]))[_0x6da6('0x1c')](_0x6da6('0x1d'),_0x4980ad);}};module[_0x6da6('0x1e')]=OpenchannelQueue; \ No newline at end of file +var _0xb6bf=['md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','Agents','online','openchannelPause','available','name','stringify','openchannel:queue:%s','emit','exports','lodash','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','waiting'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xb6bf,0x66));var _0xfb6b=function(_0x33b620,_0xf1fa11){_0x33b620=_0x33b620-0x0;var _0xb1e129=_0xb6bf[_0x33b620];return _0xb1e129;};'use strict';var _=require(_0xfb6b('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xfb6b('0x1'));var config=require(_0xfb6b('0x2'));config[_0xfb6b('0x3')]=_[_0xfb6b('0x4')](config[_0xfb6b('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xfb6b('0x5'))(new Redis(config[_0xfb6b('0x3')]));function OpenchannelQueue(_0x42c1dd){this['id']=_0x42c1dd['id']||0x0;this['name']=_0x42c1dd['name']||'';this[_0xfb6b('0x6')]=_0x42c1dd[_0xfb6b('0x6')]||0xa;this[_0xfb6b('0x7')]=_0x42c1dd[_0xfb6b('0x7')]||_0xfb6b('0x8');this['Agents']=_0x42c1dd['Agents'];this['mapAgentsId']={};this[_0xfb6b('0x9')]=0x0;this[_0xfb6b('0xa')]='';this[_0xfb6b('0xb')]();this[_0xfb6b('0xc')]();}OpenchannelQueue[_0xfb6b('0xd')][_0xfb6b('0xb')]=function(){var _0x48d7f0=this[_0xfb6b('0xe')]['_rr'];this[_0xfb6b('0xe')]=_[_0xfb6b('0xf')](this['Agents'],'id');this[_0xfb6b('0xe')][_0xfb6b('0x10')]=_0x48d7f0;};OpenchannelQueue[_0xfb6b('0xd')][_0xfb6b('0xc')]=function(){this[_0xfb6b('0x11')]=0x0;this[_0xfb6b('0x12')]=0x0;for(var _0x101206=0x0;_0x101206=0x0?this['available']:0x0;var _0x216b8d={'id':this['id'],'available':this[_0xfb6b('0x16')],'loggedIn':this[_0xfb6b('0x11')],'name':this[_0xfb6b('0x17')],'paused':this[_0xfb6b('0x12')],'waiting':this[_0xfb6b('0x9')]};var _0x21311a=md5(JSON[_0xfb6b('0x18')](_0x216b8d));if(this[_0xfb6b('0xa')]!==_0x21311a){this[_0xfb6b('0xa')]=_0x21311a;io['to'](util['format'](_0xfb6b('0x19'),_0x216b8d[_0xfb6b('0x17')]))[_0xfb6b('0x1a')]('openchannel_queue:save',_0x216b8d);}};module[_0xfb6b('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bb141e8..88a23a2 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x406f51,_0xd33cc1){var _0x252180=function(_0x30415e){while(--_0x30415e){_0x406f51['push'](_0x406f51['shift']());}};_0x252180(++_0xd33cc1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x403e4d,_0x31e625){var _0x4343ee=function(_0xf1552e){while(--_0xf1552e){_0x403e4d['push'](_0x403e4d['shift']());}};_0x4343ee(++_0x31e625);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index df0804c..5799d40 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 _0x4752=['name','stringify','whatsapp:queue:%s','emit','exports','md5','util','defaults','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','online','whatsappPause','available'];(function(_0x21f089,_0x5ebacd){var _0x59c5e7=function(_0x2af336){while(--_0x2af336){_0x21f089['push'](_0x21f089['shift']());}};_0x59c5e7(++_0x5ebacd);}(_0x4752,0x14a));var _0x2475=function(_0x51ea2f,_0x2faf08){_0x51ea2f=_0x51ea2f-0x0;var _0x3a92eb=_0x4752[_0x51ea2f];return _0x3a92eb;};'use strict';var _=require('lodash');var md5=require(_0x2475('0x0'));var util=require(_0x2475('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x2475('0x2')](config[_0x2475('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x2475('0x4'))(new Redis(config[_0x2475('0x3')]));function WhatsappQueue(_0x334291){this['id']=_0x334291['id']||0x0;this['name']=_0x334291['name']||'';this['timeout']=_0x334291[_0x2475('0x5')]||0xa;this['strategy']=_0x334291[_0x2475('0x6')]||_0x2475('0x7');this[_0x2475('0x8')]=_0x334291[_0x2475('0x8')];this[_0x2475('0x9')]={};this[_0x2475('0xa')]=0x0;this['md5']='';this[_0x2475('0xb')]();this['updateRealtime']();}WhatsappQueue[_0x2475('0xc')][_0x2475('0xb')]=function(){var _0x37b3d1=this['mapAgentsId'][_0x2475('0xd')];this['mapAgentsId']=_[_0x2475('0xe')](this[_0x2475('0x8')],'id');this['mapAgentsId'][_0x2475('0xd')]=_0x37b3d1;};WhatsappQueue[_0x2475('0xc')]['updateRealtime']=function(){this[_0x2475('0xf')]=0x0;this[_0x2475('0x10')]=0x0;for(var _0x495e2b=0x0;_0x495e2b=0x0?this[_0x2475('0x13')]:0x0;var _0x148673={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2475('0xf')],'name':this[_0x2475('0x14')],'paused':this[_0x2475('0x10')],'waiting':this[_0x2475('0xa')]};var _0x1ed4bd=md5(JSON[_0x2475('0x15')](_0x148673));if(this['md5']!==_0x1ed4bd){this[_0x2475('0x0')]=_0x1ed4bd;io['to'](util['format'](_0x2475('0x16'),_0x148673['name']))[_0x2475('0x17')]('whatsapp_queue:save',_0x148673);}};module[_0x2475('0x18')]=WhatsappQueue; \ No newline at end of file +var _0x042d=['updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x582ffa,_0x31fb82){var _0x20b7b2=function(_0x10f01d){while(--_0x10f01d){_0x582ffa['push'](_0x582ffa['shift']());}};_0x20b7b2(++_0x31fb82);}(_0x042d,0xab));var _0xd042=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x042d[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xd042('0x0'));var md5=require(_0xd042('0x1'));var util=require(_0xd042('0x2'));var Redis=require(_0xd042('0x3'));var config=require(_0xd042('0x4'));config['redis']=_[_0xd042('0x5')](config[_0xd042('0x6')],{'host':_0xd042('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x5cf2c7){this['id']=_0x5cf2c7['id']||0x0;this[_0xd042('0x8')]=_0x5cf2c7[_0xd042('0x8')]||'';this[_0xd042('0x9')]=_0x5cf2c7['timeout']||0xa;this[_0xd042('0xa')]=_0x5cf2c7['strategy']||_0xd042('0xb');this[_0xd042('0xc')]=_0x5cf2c7['Agents'];this[_0xd042('0xd')]={};this[_0xd042('0xe')]=0x0;this[_0xd042('0x1')]='';this[_0xd042('0xf')]();this[_0xd042('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x4214a5=this[_0xd042('0xd')][_0xd042('0x11')];this['mapAgentsId']=_[_0xd042('0x12')](this[_0xd042('0xc')],'id');this[_0xd042('0xd')][_0xd042('0x11')]=_0x4214a5;};WhatsappQueue[_0xd042('0x13')][_0xd042('0x10')]=function(){this[_0xd042('0x14')]=0x0;this[_0xd042('0x15')]=0x0;for(var _0x58887e=0x0;_0x58887e=0x0?this[_0xd042('0x19')]:0x0;var _0x30a425={'id':this['id'],'available':this[_0xd042('0x19')],'loggedIn':this[_0xd042('0x14')],'name':this[_0xd042('0x8')],'paused':this[_0xd042('0x15')],'waiting':this[_0xd042('0xe')]};var _0x11c8c8=md5(JSON[_0xd042('0x1a')](_0x30a425));if(this['md5']!==_0x11c8c8){this['md5']=_0x11c8c8;io['to'](util[_0xd042('0x1b')](_0xd042('0x1c'),_0x30a425[_0xd042('0x8')]))[_0xd042('0x1d')](_0xd042('0x1e'),_0x30a425);}};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 0b75c2b..5e05f74 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('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 0b00c71..e21b9e9 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 _0x9e24=['updateChatInteraction','addTags','Request','../client','update','UpdateChatInteraction'];(function(_0x2f8349,_0xc39962){var _0x2bac05=function(_0x573e1f){while(--_0x573e1f){_0x2f8349['push'](_0x2f8349['shift']());}};_0x2bac05(++_0xc39962);}(_0x9e24,0xff));var _0x49e2=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0x9e24[_0x12e3e3];return _0x26602e;};'use strict';var client=require(_0x49e2('0x0'));exports[_0x49e2('0x1')]=function(_0x5362a2,_0x53fd27){return client['Request'](_0x49e2('0x2'),{'body':_0x53fd27,'options':{'where':{'id':_0x5362a2}},'log':_0x49e2('0x3')});};exports[_0x49e2('0x4')]=function(_0x2f68ad,_0x41eadc){return client[_0x49e2('0x5')]('AddTagsToChatInteraction',{'body':_0x41eadc,'options':{'where':{'id':_0x2f68ad}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xfe51=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x4be6f6,_0x28bdbc){var _0x5adc04=function(_0x1828f1){while(--_0x1828f1){_0x4be6f6['push'](_0x4be6f6['shift']());}};_0x5adc04(++_0x28bdbc);}(_0xfe51,0x1e3));var _0x1fe5=function(_0x5118ba,_0x1df3e2){_0x5118ba=_0x5118ba-0x0;var _0x27dc7a=_0xfe51[_0x5118ba];return _0x27dc7a;};'use strict';var client=require('../client');exports['update']=function(_0x13269c,_0x13f4d4){return client[_0x1fe5('0x0')](_0x1fe5('0x1'),{'body':_0x13f4d4,'options':{'where':{'id':_0x13269c}},'log':_0x1fe5('0x2')});};exports[_0x1fe5('0x3')]=function(_0x4a26c1,_0x46e16c){return client['Request'](_0x1fe5('0x4'),{'body':_0x46e16c,'options':{'where':{'id':_0x4a26c1}},'log':_0x1fe5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6bbc9a9..f5cdcfe 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 _0x4554=['create','createChatMessage'];(function(_0xeb4c8b,_0x1dc497){var _0x90b0d0=function(_0x332e32){while(--_0x332e32){_0xeb4c8b['push'](_0xeb4c8b['shift']());}};_0x90b0d0(++_0x1dc497);}(_0x4554,0xaa));var _0x4455=function(_0x275730,_0x46f836){_0x275730=_0x275730-0x0;var _0x32b100=_0x4554[_0x275730];return _0x32b100;};'use strict';var client=require('../client');exports[_0x4455('0x0')]=function(_0x338343){return client['Request']('CreateChatMessage',{'body':_0x338343,'log':_0x4455('0x1')});}; \ No newline at end of file +var _0xa090=['createChatMessage','create','Request'];(function(_0x25e995,_0x143cdc){var _0x446a58=function(_0x545ebc){while(--_0x545ebc){_0x25e995['push'](_0x25e995['shift']());}};_0x446a58(++_0x143cdc);}(_0xa090,0x79));var _0x0a09=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0xa090[_0x2181b1];return _0x530548;};'use strict';var client=require('../client');exports[_0x0a09('0x0')]=function(_0x4d6fe4){return client[_0x0a09('0x1')]('CreateChatMessage',{'body':_0x4d6fe4,'log':_0x0a09('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index afda0f7..cc80f5b 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 _0x9631=['getChatQueues','Request','GetChatQueue','User','name','../client'];(function(_0x665019,_0x37eb8c){var _0x467c97=function(_0x37bc5c){while(--_0x37bc5c){_0x665019['push'](_0x665019['shift']());}};_0x467c97(++_0x37eb8c);}(_0x9631,0xdd));var _0x1963=function(_0x1ca91c,_0x131938){_0x1ca91c=_0x1ca91c-0x0;var _0x5e858f=_0x9631[_0x1ca91c];return _0x5e858f;};'use strict';var client=require(_0x1963('0x0'));exports[_0x1963('0x1')]=function(){return function(){return client[_0x1963('0x2')](_0x1963('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x1963('0x4'),'as':'Agents','attributes':['id',_0x1963('0x5'),'online','chatPause']}]},'log':_0x1963('0x1')});};}; \ No newline at end of file +var _0x36ed=['Request','GetChatQueue','name','strategy','User','Agents','chatPause','../client','getChatQueues'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x36ed,0x115));var _0xd36e=function(_0x3643b2,_0x3201bc){_0x3643b2=_0x3643b2-0x0;var _0x16c1b7=_0x36ed[_0x3643b2];return _0x16c1b7;};'use strict';var client=require(_0xd36e('0x0'));exports[_0xd36e('0x1')]=function(){return function(){return client[_0xd36e('0x2')](_0xd36e('0x3'),{'options':{'raw':![],'attributes':['id',_0xd36e('0x4'),'timeout',_0xd36e('0x5')],'include':[{'model':_0xd36e('0x6'),'as':_0xd36e('0x7'),'attributes':['id',_0xd36e('0x4'),'online',_0xd36e('0x8')]}]},'log':_0xd36e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 77a2949..66ae32c 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 _0xed1f=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x355ca3,_0xd3e1e7){var _0x55edba=function(_0x29ec8e){while(--_0x29ec8e){_0x355ca3['push'](_0x355ca3['shift']());}};_0x55edba(++_0xd3e1e7);}(_0xed1f,0x6a));var _0xfed1=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xed1f[_0x20ef64];return _0x3707d8;};'use strict';var client=require(_0xfed1('0x0'));exports[_0xfed1('0x1')]=function(_0x21e140){return client[_0xfed1('0x2')](_0xfed1('0x3'),{'body':_0x21e140,'log':_0xfed1('0x3')});};exports[_0xfed1('0x4')]=function(_0xa68587,_0x2209b3){return client[_0xfed1('0x2')](_0xfed1('0x5'),{'body':_0x2209b3,'options':{'where':{'uniqueid':_0xa68587},'order':[['id',_0xfed1('0x6')]],'limit':0x1},'log':_0xfed1('0x5')});}; \ No newline at end of file +var _0x330c=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x4f8a20,_0x4a9fed){var _0x560e72=function(_0x39f453){while(--_0x39f453){_0x4f8a20['push'](_0x4f8a20['shift']());}};_0x560e72(++_0x4a9fed);}(_0x330c,0x186));var _0xc330=function(_0x35b341,_0x465e1c){_0x35b341=_0x35b341-0x0;var _0x28dec5=_0x330c[_0x35b341];return _0x28dec5;};'use strict';var client=require(_0xc330('0x0'));exports[_0xc330('0x1')]=function(_0x38be68){return client[_0xc330('0x2')]('CreateChatQueueReport',{'body':_0x38be68,'log':_0xc330('0x3')});};exports[_0xc330('0x4')]=function(_0x4552ee,_0x207daa){return client[_0xc330('0x2')](_0xc330('0x5'),{'body':_0x207daa,'options':{'where':{'uniqueid':_0x4552ee},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 5b349c5..e7d6fd4 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 _0x1d4a=['addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','updateFaxInteraction'];(function(_0xb75a6e,_0x15b4ab){var _0x1ac263=function(_0x1d168b){while(--_0x1d168b){_0xb75a6e['push'](_0xb75a6e['shift']());}};_0x1ac263(++_0x15b4ab);}(_0x1d4a,0x1f0));var _0xa1d4=function(_0x5c557f,_0x25913a){_0x5c557f=_0x5c557f-0x0;var _0x4e90d0=_0x1d4a[_0x5c557f];return _0x4e90d0;};'use strict';var client=require(_0xa1d4('0x0'));exports['update']=function(_0x15d398,_0x4ee93a){return client['Request']('UpdateFaxInteraction',{'body':_0x4ee93a,'options':{'where':{'id':_0x15d398}},'log':_0xa1d4('0x1')});};exports[_0xa1d4('0x2')]=function(_0x51387c,_0x40a824){return client[_0xa1d4('0x3')](_0xa1d4('0x4'),{'body':_0x40a824,'options':{'where':{'id':_0x51387c}},'log':_0xa1d4('0x5')});}; \ No newline at end of file +var _0xf75a=['update','UpdateFaxInteraction','updateFaxInteraction','Request','AddTagsToFaxInteraction','../client'];(function(_0x589254,_0x5b9fca){var _0x2aed81=function(_0x434b29){while(--_0x434b29){_0x589254['push'](_0x589254['shift']());}};_0x2aed81(++_0x5b9fca);}(_0xf75a,0xd7));var _0xaf75=function(_0x4d2366,_0x412bfe){_0x4d2366=_0x4d2366-0x0;var _0xefd8bb=_0xf75a[_0x4d2366];return _0xefd8bb;};'use strict';var client=require(_0xaf75('0x0'));exports[_0xaf75('0x1')]=function(_0x1555f3,_0x20ba8f){return client['Request'](_0xaf75('0x2'),{'body':_0x20ba8f,'options':{'where':{'id':_0x1555f3}},'log':_0xaf75('0x3')});};exports['addTags']=function(_0x3e54b9,_0x3f3d34){return client[_0xaf75('0x4')](_0xaf75('0x5'),{'body':_0x3f3d34,'options':{'where':{'id':_0x3e54b9}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 322472e..3e81e6c 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 _0x2a86=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x2a86,0x158));var _0x62a8=function(_0x15fc3e,_0x1a347e){_0x15fc3e=_0x15fc3e-0x0;var _0x45c8c6=_0x2a86[_0x15fc3e];return _0x45c8c6;};'use strict';var client=require(_0x62a8('0x0'));exports[_0x62a8('0x1')]=function(_0x13d47a){return client[_0x62a8('0x2')](_0x62a8('0x3'),{'body':_0x13d47a,'log':_0x62a8('0x4')});}; \ No newline at end of file +var _0x2594=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x287a56,_0x16836e){var _0x27d07c=function(_0x517e86){while(--_0x517e86){_0x287a56['push'](_0x287a56['shift']());}};_0x27d07c(++_0x16836e);}(_0x2594,0xe4));var _0x4259=function(_0x55daab,_0x1de3f7){_0x55daab=_0x55daab-0x0;var _0x2df808=_0x2594[_0x55daab];return _0x2df808;};'use strict';var client=require(_0x4259('0x0'));exports[_0x4259('0x1')]=function(_0x58f59a){return client['Request'](_0x4259('0x2'),{'body':_0x58f59a,'log':_0x4259('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2ce63a4..f64e74c 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 _0x6830=['name','strategy','User','Agents','online','getFaxQueues'];(function(_0x3cf414,_0x2d5c52){var _0x43c0c7=function(_0x5c1a4b){while(--_0x5c1a4b){_0x3cf414['push'](_0x3cf414['shift']());}};_0x43c0c7(++_0x2d5c52);}(_0x6830,0x65));var _0x0683=function(_0x289309,_0x15e1a8){_0x289309=_0x289309-0x0;var _0x9c4163=_0x6830[_0x289309];return _0x9c4163;};'use strict';var client=require('../client');exports[_0x0683('0x0')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x0683('0x1'),'timeout',_0x0683('0x2')],'include':[{'model':_0x0683('0x3'),'as':_0x0683('0x4'),'attributes':['id',_0x0683('0x1'),_0x0683('0x5'),'faxPause']}]},'log':_0x0683('0x0')});};}; \ No newline at end of file +var _0x977e=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','Agents'];(function(_0x44b43d,_0x1ac4cf){var _0x3df151=function(_0x5698b6){while(--_0x5698b6){_0x44b43d['push'](_0x44b43d['shift']());}};_0x3df151(++_0x1ac4cf);}(_0x977e,0x121));var _0xe977=function(_0x587a2c,_0x282493){_0x587a2c=_0x587a2c-0x0;var _0x2b98af=_0x977e[_0x587a2c];return _0x2b98af;};'use strict';var client=require(_0xe977('0x0'));exports[_0xe977('0x1')]=function(){return function(){return client[_0xe977('0x2')](_0xe977('0x3'),{'options':{'raw':![],'attributes':['id',_0xe977('0x4'),_0xe977('0x5'),_0xe977('0x6')],'include':[{'model':'User','as':_0xe977('0x7'),'attributes':['id','name','online',_0xe977('0x8')]}]},'log':_0xe977('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 69e7bd7..d81b3e4 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 _0x3d01=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3d01,0xd4));var _0x13d0=function(_0x2b7ea3,_0x2198ef){_0x2b7ea3=_0x2b7ea3-0x0;var _0x2b93c0=_0x3d01[_0x2b7ea3];return _0x2b93c0;};'use strict';var client=require(_0x13d0('0x0'));exports[_0x13d0('0x1')]=function(_0x34df2f){return client[_0x13d0('0x2')](_0x13d0('0x3'),{'body':_0x34df2f,'log':_0x13d0('0x3')});};exports[_0x13d0('0x4')]=function(_0x2e955e,_0x5bb3d){return client[_0x13d0('0x2')](_0x13d0('0x5'),{'body':_0x5bb3d,'options':{'where':{'uniqueid':_0x2e955e},'order':[['id','DESC']],'limit':0x1},'log':_0x13d0('0x5')});}; \ No newline at end of file +var _0xd88b=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x5ccfa9,_0x415e4d){var _0x228ced=function(_0x57750a){while(--_0x57750a){_0x5ccfa9['push'](_0x5ccfa9['shift']());}};_0x228ced(++_0x415e4d);}(_0xd88b,0xa7));var _0xbd88=function(_0x27b4d9,_0x33085e){_0x27b4d9=_0x27b4d9-0x0;var _0x3e7a11=_0xd88b[_0x27b4d9];return _0x3e7a11;};'use strict';var client=require(_0xbd88('0x0'));exports['create']=function(_0x450ce9){return client[_0xbd88('0x1')](_0xbd88('0x2'),{'body':_0x450ce9,'log':_0xbd88('0x2')});};exports[_0xbd88('0x3')]=function(_0x4275b2,_0x13bce9){return client[_0xbd88('0x1')](_0xbd88('0x4'),{'body':_0x13bce9,'options':{'where':{'uniqueid':_0x4275b2},'order':[['id',_0xbd88('0x5')]],'limit':0x1},'log':_0xbd88('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a2d7194..25e5e33 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 _0xe9e8=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x23ccf5,_0x800ed1){_0x23ccf5=_0x23ccf5-0x0;var _0x3758f0=_0xe9e8[_0x23ccf5];return _0x3758f0;};'use strict';var client=require(_0x8e9e('0x0'));exports[_0x8e9e('0x1')]=function(){return function(){return client[_0x8e9e('0x2')](_0x8e9e('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8e9e('0x4')],'include':[{'model':_0x8e9e('0x5'),'as':_0x8e9e('0x6'),'attributes':['id','name',_0x8e9e('0x7')]}]},'log':_0x8e9e('0x1')});};}; \ No newline at end of file +var _0xa45c=['getIntervals','name','Intervals','interval','../client'];(function(_0x57a904,_0x575734){var _0x67785c=function(_0x3c8917){while(--_0x3c8917){_0x57a904['push'](_0x57a904['shift']());}};_0x67785c(++_0x575734);}(_0xa45c,0x6d));var _0xca45=function(_0x5dbd00,_0xbd388f){_0x5dbd00=_0x5dbd00-0x0;var _0x1da04c=_0xa45c[_0x5dbd00];return _0x1da04c;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xca45('0x2')],'include':[{'model':'Interval','as':_0xca45('0x3'),'attributes':['id','name',_0xca45('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ea53730..517aa45 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 _0x74a2=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','../client'];(function(_0x407143,_0x1bb74f){var _0x58313c=function(_0x54d2ea){while(--_0x54d2ea){_0x407143['push'](_0x407143['shift']());}};_0x58313c(++_0x1bb74f);}(_0x74a2,0x1cd));var _0x274a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x74a2[_0x4f9b18];return _0x29f20c;};'use strict';var client=require(_0x274a('0x0'));exports[_0x274a('0x1')]=function(_0x5df4e2,_0x5e5395){return client[_0x274a('0x2')](_0x274a('0x3'),{'body':_0x5e5395,'options':{'where':{'id':_0x5df4e2}},'log':_0x274a('0x4')});};exports[_0x274a('0x5')]=function(_0x721e0,_0x108077){return client[_0x274a('0x2')]('AddTagsToMailInteraction',{'body':_0x108077,'options':{'where':{'id':_0x721e0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xb931=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','AddTagsToMailInteraction'];(function(_0x55cee0,_0x10b0f3){var _0x1cd897=function(_0xf28a0){while(--_0xf28a0){_0x55cee0['push'](_0x55cee0['shift']());}};_0x1cd897(++_0x10b0f3);}(_0xb931,0x91));var _0x1b93=function(_0x1ec124,_0x33b63b){_0x1ec124=_0x1ec124-0x0;var _0xa01be2=_0xb931[_0x1ec124];return _0xa01be2;};'use strict';var client=require(_0x1b93('0x0'));exports[_0x1b93('0x1')]=function(_0xbf315,_0x1f535a){return client[_0x1b93('0x2')]('UpdateMailInteraction',{'body':_0x1f535a,'options':{'where':{'id':_0xbf315}},'log':_0x1b93('0x3')});};exports['addTags']=function(_0x28ee23,_0x21ae30){return client[_0x1b93('0x2')](_0x1b93('0x4'),{'body':_0x21ae30,'options':{'where':{'id':_0x28ee23}},'log':_0x1b93('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 97fdfb7..f46346d 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 _0xbe40=['createMailMessage','../client','Request'];(function(_0x5e3723,_0x1c76c3){var _0x192078=function(_0x1ea92a){while(--_0x1ea92a){_0x5e3723['push'](_0x5e3723['shift']());}};_0x192078(++_0x1c76c3);}(_0xbe40,0xfd));var _0x0be4=function(_0x5f51db,_0x1d96fb){_0x5f51db=_0x5f51db-0x0;var _0x5cd236=_0xbe40[_0x5f51db];return _0x5cd236;};'use strict';var client=require(_0x0be4('0x0'));exports['create']=function(_0x35c118){return client[_0x0be4('0x1')]('CreateMailMessage',{'body':_0x35c118,'log':_0x0be4('0x2')});}; \ No newline at end of file +var _0x7c40=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x114da0,_0x19188f){var _0x5f1d8a=function(_0x154c3d){while(--_0x154c3d){_0x114da0['push'](_0x114da0['shift']());}};_0x5f1d8a(++_0x19188f);}(_0x7c40,0x1e1));var _0x07c4=function(_0x45db0d,_0x21adf1){_0x45db0d=_0x45db0d-0x0;var _0x467a00=_0x7c40[_0x45db0d];return _0x467a00;};'use strict';var client=require(_0x07c4('0x0'));exports[_0x07c4('0x1')]=function(_0x2b10e3){return client['Request'](_0x07c4('0x2'),{'body':_0x2b10e3,'log':_0x07c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 92b7ea3..01b1ab3 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 _0xc496=['Request','GetMailQueue','name','strategy','User','Agents','mailPause','getMailQueues'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xc496,0x68));var _0x6c49=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xc496[_0x233cb1];return _0x29ee7e;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x6c49('0x0')](_0x6c49('0x1'),{'options':{'raw':![],'attributes':['id',_0x6c49('0x2'),'timeout',_0x6c49('0x3')],'include':[{'model':_0x6c49('0x4'),'as':_0x6c49('0x5'),'attributes':['id',_0x6c49('0x2'),'online',_0x6c49('0x6')]}]},'log':_0x6c49('0x7')});};}; \ No newline at end of file +var _0x089d=['GetMailQueue','name','timeout','User','Agents','online','mailPause','getMailQueues'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x089d,0x67));var _0xd089=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x089d[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports[_0xd089('0x0')]=function(){return function(){return client['Request'](_0xd089('0x1'),{'options':{'raw':![],'attributes':['id',_0xd089('0x2'),_0xd089('0x3'),'strategy'],'include':[{'model':_0xd089('0x4'),'as':_0xd089('0x5'),'attributes':['id',_0xd089('0x2'),_0xd089('0x6'),_0xd089('0x7')]}]},'log':_0xd089('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c8f31c1..c93860d 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 _0xd223=['create','CreateMailQueueReport','update','Request','DESC'];(function(_0x116b76,_0xc09507){var _0x1ea7c4=function(_0xf8776c){while(--_0xf8776c){_0x116b76['push'](_0x116b76['shift']());}};_0x1ea7c4(++_0xc09507);}(_0xd223,0xb9));var _0x3d22=function(_0x513cbb,_0x5bbea5){_0x513cbb=_0x513cbb-0x0;var _0x481b9e=_0xd223[_0x513cbb];return _0x481b9e;};'use strict';var client=require('../client');exports[_0x3d22('0x0')]=function(_0x2505ca){return client['Request'](_0x3d22('0x1'),{'body':_0x2505ca,'log':_0x3d22('0x1')});};exports[_0x3d22('0x2')]=function(_0x31b60c,_0x3ca448){return client[_0x3d22('0x3')]('UpdateMailQueueReport',{'body':_0x3ca448,'options':{'where':{'uniqueid':_0x31b60c},'order':[['id',_0x3d22('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x5d1b=['update','Request','UpdateMailQueueReport','../client','CreateMailQueueReport'];(function(_0x5d3030,_0x44648c){var _0x6d479=function(_0x1b5f31){while(--_0x1b5f31){_0x5d3030['push'](_0x5d3030['shift']());}};_0x6d479(++_0x44648c);}(_0x5d1b,0x67));var _0xb5d1=function(_0x5b02b4,_0x3b7f20){_0x5b02b4=_0x5b02b4-0x0;var _0x3d38a9=_0x5d1b[_0x5b02b4];return _0x3d38a9;};'use strict';var client=require(_0xb5d1('0x0'));exports['create']=function(_0x5375a4){return client['Request'](_0xb5d1('0x1'),{'body':_0x5375a4,'log':'CreateMailQueueReport'});};exports[_0xb5d1('0x2')]=function(_0x5c42d5,_0x327c2e){return client[_0xb5d1('0x3')](_0xb5d1('0x4'),{'body':_0x327c2e,'options':{'where':{'uniqueid':_0x5c42d5},'order':[['id','DESC']],'limit':0x1},'log':_0xb5d1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index efb7cf2..37912ff 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 _0x3904=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x340d75,_0x561cb0){var _0x3f1114=function(_0x2e2bcf){while(--_0x2e2bcf){_0x340d75['push'](_0x340d75['shift']());}};_0x3f1114(++_0x561cb0);}(_0x3904,0x1a0));var _0x4390=function(_0xc2c89,_0x22c701){_0xc2c89=_0xc2c89-0x0;var _0x4f9032=_0x3904[_0xc2c89];return _0x4f9032;};'use strict';var client=require(_0x4390('0x0'));exports['update']=function(_0x27aea5,_0x3bfe5f){return client[_0x4390('0x1')](_0x4390('0x2'),{'body':_0x3bfe5f,'options':{'where':{'id':_0x27aea5}},'log':_0x4390('0x3')});};exports[_0x4390('0x4')]=function(_0x1b5992,_0x148d02){return client['Request'](_0x4390('0x5'),{'body':_0x148d02,'options':{'where':{'id':_0x1b5992}},'log':_0x4390('0x6')});}; \ No newline at end of file +var _0xde2a=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x533f64,_0x1bb77d){var _0x1fa465=function(_0xa14150){while(--_0xa14150){_0x533f64['push'](_0x533f64['shift']());}};_0x1fa465(++_0x1bb77d);}(_0xde2a,0xe0));var _0xade2=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xde2a[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require(_0xade2('0x0'));exports[_0xade2('0x1')]=function(_0x226836,_0x364728){return client[_0xade2('0x2')](_0xade2('0x3'),{'body':_0x364728,'options':{'where':{'id':_0x226836}},'log':_0xade2('0x4')});};exports[_0xade2('0x5')]=function(_0x291764,_0x473ab6){return client[_0xade2('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x473ab6,'options':{'where':{'id':_0x291764}},'log':_0xade2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 91a5808..a43f7ea 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 _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x2e7c5c,_0x842591){var _0x4c2589=function(_0x164451){while(--_0x164451){_0x2e7c5c['push'](_0x2e7c5c['shift']());}};_0x4c2589(++_0x842591);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x54a57e,_0x3a8ff9){_0x54a57e=_0x54a57e-0x0;var _0x56dc7f=_0xbdb7[_0x54a57e];return _0x56dc7f;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file +var _0x5b02=['create','Request','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x64d352,_0x4caf55){_0x64d352=_0x64d352-0x0;var _0x10f868=_0x5b02[_0x64d352];return _0x10f868;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateOpenchannelMessage',{'body':_0x428458,'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 4df1290..97787bb 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 _0x67c1=['timeout','User','Agents','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x67c1,0xf3));var _0x167c=function(_0x2554d6,_0x441ea2){_0x2554d6=_0x2554d6-0x0;var _0x522023=_0x67c1[_0x2554d6];return _0x522023;};'use strict';var client=require('../client');exports[_0x167c('0x0')]=function(){return function(){return client[_0x167c('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x167c('0x2'),'strategy'],'include':[{'model':_0x167c('0x3'),'as':_0x167c('0x4'),'attributes':['id','name',_0x167c('0x5'),_0x167c('0x6')]}]},'log':_0x167c('0x0')});};}; \ No newline at end of file +var _0x2ae5=['Request','timeout','strategy','User','name','online','../client','getOpenchannelQueues'];(function(_0x11500a,_0x59a47e){var _0x1ea80a=function(_0x2bd8f7){while(--_0x2bd8f7){_0x11500a['push'](_0x11500a['shift']());}};_0x1ea80a(++_0x59a47e);}(_0x2ae5,0xb6));var _0x52ae=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x2ae5[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x52ae('0x0'));exports[_0x52ae('0x1')]=function(){return function(){return client[_0x52ae('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x52ae('0x3'),_0x52ae('0x4')],'include':[{'model':_0x52ae('0x5'),'as':'Agents','attributes':['id',_0x52ae('0x6'),_0x52ae('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9d87630..a6c124c 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 _0x2ea3=['DESC','create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport'];(function(_0xaa0140,_0xd6c719){var _0x11ac88=function(_0x563a95){while(--_0x563a95){_0xaa0140['push'](_0xaa0140['shift']());}};_0x11ac88(++_0xd6c719);}(_0x2ea3,0xa6));var _0x32ea=function(_0x49c616,_0x56777c){_0x49c616=_0x49c616-0x0;var _0x164b49=_0x2ea3[_0x49c616];return _0x164b49;};'use strict';var client=require('../client');exports[_0x32ea('0x0')]=function(_0xc9c3aa){return client['Request'](_0x32ea('0x1'),{'body':_0xc9c3aa,'log':_0x32ea('0x1')});};exports['update']=function(_0x3806f5,_0x4003e9){return client[_0x32ea('0x2')](_0x32ea('0x3'),{'body':_0x4003e9,'options':{'where':{'uniqueid':_0x3806f5},'order':[['id',_0x32ea('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x8e52=['create','Request','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x490734,_0x6ef2f3){var _0x437cf2=function(_0x3c1483){while(--_0x3c1483){_0x490734['push'](_0x490734['shift']());}};_0x437cf2(++_0x6ef2f3);}(_0x8e52,0x15b));var _0x28e5=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x8e52[_0x52a857];return _0x4e2aae;};'use strict';var client=require(_0x28e5('0x0'));exports[_0x28e5('0x1')]=function(_0x408980){return client[_0x28e5('0x2')]('CreateOpenchannelQueueReport',{'body':_0x408980,'log':'CreateOpenchannelQueueReport'});};exports[_0x28e5('0x3')]=function(_0xe72f53,_0x3b1251){return client[_0x28e5('0x2')](_0x28e5('0x4'),{'body':_0x3b1251,'options':{'where':{'uniqueid':_0xe72f53},'order':[['id',_0x28e5('0x5')]],'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 50368bd..5eaf73c 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 _0x2764=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x4b992a,_0x51dd3e){var _0x39f09a=function(_0x1394f4){while(--_0x1394f4){_0x4b992a['push'](_0x4b992a['shift']());}};_0x39f09a(++_0x51dd3e);}(_0x2764,0xa8));var _0x4276=function(_0x17124c,_0x6b2453){_0x17124c=_0x17124c-0x0;var _0x3636e3=_0x2764[_0x17124c];return _0x3636e3;};'use strict';var client=require(_0x4276('0x0'));exports[_0x4276('0x1')]=function(_0x23347c,_0x1be67a){return client[_0x4276('0x2')](_0x4276('0x3'),{'body':_0x1be67a,'options':{'where':{'id':_0x23347c}},'log':_0x4276('0x4')});};exports[_0x4276('0x5')]=function(_0x1fa284,_0x4b93b0){return client[_0x4276('0x2')](_0x4276('0x6'),{'body':_0x4b93b0,'options':{'where':{'id':_0x1fa284}},'log':_0x4276('0x7')});}; \ No newline at end of file +var _0x1d7a=['../client','update','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1d7a,0x1c2));var _0xa1d7=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0x1d7a[_0x2a6571];return _0xdf7731;};'use strict';var client=require(_0xa1d7('0x0'));exports[_0xa1d7('0x1')]=function(_0x12e69d,_0x59dbff){return client[_0xa1d7('0x2')]('UpdateSmsInteraction',{'body':_0x59dbff,'options':{'where':{'id':_0x12e69d}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0xec68b4,_0x2e35c6){return client[_0xa1d7('0x2')](_0xa1d7('0x3'),{'body':_0x2e35c6,'options':{'where':{'id':_0xec68b4}},'log':_0xa1d7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2bc1b85..91b3c32 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 _0x88f3=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x5be791,_0x94dd5a){var _0x2ea8b8=function(_0x4423c0){while(--_0x4423c0){_0x5be791['push'](_0x5be791['shift']());}};_0x2ea8b8(++_0x94dd5a);}(_0x88f3,0x81));var _0x388f=function(_0x1a5075,_0xbe9751){_0x1a5075=_0x1a5075-0x0;var _0x240505=_0x88f3[_0x1a5075];return _0x240505;};'use strict';var client=require(_0x388f('0x0'));exports['create']=function(_0x3396e3){return client[_0x388f('0x1')](_0x388f('0x2'),{'body':_0x3396e3,'log':_0x388f('0x3')});}; \ No newline at end of file +var _0x0d97=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x3cca02,_0x4a7674){var _0x236b68=function(_0x2db865){while(--_0x2db865){_0x3cca02['push'](_0x3cca02['shift']());}};_0x236b68(++_0x4a7674);}(_0x0d97,0x159));var _0x70d9=function(_0x220911,_0x2c54e7){_0x220911=_0x220911-0x0;var _0x479cf8=_0x0d97[_0x220911];return _0x479cf8;};'use strict';var client=require(_0x70d9('0x0'));exports[_0x70d9('0x1')]=function(_0x49673e){return client[_0x70d9('0x2')](_0x70d9('0x3'),{'body':_0x49673e,'log':_0x70d9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5dc4ee3..ae3f06c 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 _0x816f=['strategy','User','online','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x5cbb2b,_0x1e8d68){var _0x19f043=function(_0x953ac9){while(--_0x953ac9){_0x5cbb2b['push'](_0x5cbb2b['shift']());}};_0x19f043(++_0x1e8d68);}(_0x816f,0x1af));var _0xf816=function(_0x4bde21,_0x20a077){_0x4bde21=_0x4bde21-0x0;var _0xa1e9fa=_0x816f[_0x4bde21];return _0xa1e9fa;};'use strict';var client=require('../client');exports[_0xf816('0x0')]=function(){return function(){return client[_0xf816('0x1')](_0xf816('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf816('0x3')],'include':[{'model':_0xf816('0x4'),'as':'Agents','attributes':['id','name',_0xf816('0x5'),_0xf816('0x6')]}]},'log':_0xf816('0x0')});};}; \ No newline at end of file +var _0xb35d=['Request','GetSmsQueue','name','timeout','strategy','User','online','../client','getSmsQueues'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xb35d,0x14b));var _0xdb35=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xb35d[_0x4382bc];return _0x13c82a;};'use strict';var client=require(_0xdb35('0x0'));exports[_0xdb35('0x1')]=function(){return function(){return client[_0xdb35('0x2')](_0xdb35('0x3'),{'options':{'raw':![],'attributes':['id',_0xdb35('0x4'),_0xdb35('0x5'),_0xdb35('0x6')],'include':[{'model':_0xdb35('0x7'),'as':'Agents','attributes':['id',_0xdb35('0x4'),_0xdb35('0x8'),'smsPause']}]},'log':_0xdb35('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e0632cb..2356bcf 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 _0x1516=['UpdateSmsQueueReport','../client','create','CreateSmsQueueReport','update'];(function(_0x36918d,_0x58e21a){var _0x42d708=function(_0x1b824c){while(--_0x1b824c){_0x36918d['push'](_0x36918d['shift']());}};_0x42d708(++_0x58e21a);}(_0x1516,0xb0));var _0x6151=function(_0x3b3769,_0x52abaf){_0x3b3769=_0x3b3769-0x0;var _0xb90f8a=_0x1516[_0x3b3769];return _0xb90f8a;};'use strict';var client=require(_0x6151('0x0'));exports[_0x6151('0x1')]=function(_0x171bb6){return client['Request'](_0x6151('0x2'),{'body':_0x171bb6,'log':_0x6151('0x2')});};exports[_0x6151('0x3')]=function(_0xe69754,_0x122679){return client['Request'](_0x6151('0x4'),{'body':_0x122679,'options':{'where':{'uniqueid':_0xe69754},'order':[['id','DESC']],'limit':0x1},'log':_0x6151('0x4')});}; \ No newline at end of file +var _0xf7fb=['../client','Request','CreateSmsQueueReport','DESC','UpdateSmsQueueReport'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf7fb,0x1cc));var _0xbf7f=function(_0x4c5272,_0x5ec3e7){_0x4c5272=_0x4c5272-0x0;var _0x47af06=_0xf7fb[_0x4c5272];return _0x47af06;};'use strict';var client=require(_0xbf7f('0x0'));exports['create']=function(_0x4f4539){return client[_0xbf7f('0x1')](_0xbf7f('0x2'),{'body':_0x4f4539,'log':_0xbf7f('0x2')});};exports['update']=function(_0x2b500b,_0x510654){return client[_0xbf7f('0x1')]('UpdateSmsQueueReport',{'body':_0x510654,'options':{'where':{'uniqueid':_0x2b500b},'order':[['id',_0xbf7f('0x3')]],'limit':0x1},'log':_0xbf7f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 08e4c37..ee55c99 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 _0x0f7c=['smsPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause'];(function(_0x56fd18,_0x35c3ce){var _0xd83fdd=function(_0x3da713){while(--_0x3da713){_0x56fd18['push'](_0x56fd18['shift']());}};_0xd83fdd(++_0x35c3ce);}(_0x0f7c,0x116));var _0xc0f7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0f7c[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xc0f7('0x0'));exports[_0xc0f7('0x1')]=function(){return function(){return client[_0xc0f7('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xc0f7('0x3'),_0xc0f7('0x4'),_0xc0f7('0x5'),_0xc0f7('0x6'),_0xc0f7('0x7'),_0xc0f7('0x8'),_0xc0f7('0x9'),_0xc0f7('0xa'),_0xc0f7('0xb'),'whatsappPause','openchannelPause',_0xc0f7('0xc'),_0xc0f7('0xd'),_0xc0f7('0xe'),_0xc0f7('0xf'),_0xc0f7('0x10'),'openchannelCapacity']},'log':_0xc0f7('0x1')});};}; \ No newline at end of file +var _0x3dfe=['faxCapacity','openchannelCapacity','../client','getAgents','agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x3dfe,0x82));var _0xe3df=function(_0x1f7ff3,_0x5000cf){_0x1f7ff3=_0x1f7ff3-0x0;var _0x525533=_0x3dfe[_0x1f7ff3];return _0x525533;};'use strict';var client=require(_0xe3df('0x0'));exports[_0xe3df('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0xe3df('0x2')},'attributes':['id',_0xe3df('0x3'),_0xe3df('0x4'),_0xe3df('0x5'),_0xe3df('0x6'),'voicePause',_0xe3df('0x7'),_0xe3df('0x8'),'faxPause',_0xe3df('0x9'),_0xe3df('0xa'),_0xe3df('0xb'),_0xe3df('0xc'),_0xe3df('0xd'),_0xe3df('0xe'),'smsCapacity','whatsappCapacity',_0xe3df('0xf')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 95a065d..5cb17bc 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 _0xe630=['../client','update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe630,0x149));var _0x0e63=function(_0x38e6ce,_0x2532e2){_0x38e6ce=_0x38e6ce-0x0;var _0x1e3a03=_0xe630[_0x38e6ce];return _0x1e3a03;};'use strict';var client=require(_0x0e63('0x0'));exports[_0x0e63('0x1')]=function(_0x54847d,_0x1a262a){return client[_0x0e63('0x2')](_0x0e63('0x3'),{'body':_0x1a262a,'options':{'where':{'id':_0x54847d}},'log':'updateWhatsappInteraction'});};exports[_0x0e63('0x4')]=function(_0x219cbe,_0x42c141){return client['Request'](_0x0e63('0x5'),{'body':_0x42c141,'options':{'where':{'id':_0x219cbe}},'log':_0x0e63('0x6')});}; \ No newline at end of file +var _0x8d9b=['../client','update','Request','addTags'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb8d9('0x0'));exports[_0xb8d9('0x1')]=function(_0x2a3616,_0x8360b6){return client[_0xb8d9('0x2')]('UpdateWhatsappInteraction',{'body':_0x8360b6,'options':{'where':{'id':_0x2a3616}},'log':'updateWhatsappInteraction'});};exports[_0xb8d9('0x3')]=function(_0x47b650,_0x2192ff){return client[_0xb8d9('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x2192ff,'options':{'where':{'id':_0x47b650}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index da17095..c7c084d 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 _0xbb83=['../client','Request'];(function(_0x1df5cd,_0x3dc641){var _0xf6df9b=function(_0x3c5b96){while(--_0x3c5b96){_0x1df5cd['push'](_0x1df5cd['shift']());}};_0xf6df9b(++_0x3dc641);}(_0xbb83,0x7a));var _0x3bb8=function(_0x3b4aef,_0x313df6){_0x3b4aef=_0x3b4aef-0x0;var _0x444bd1=_0xbb83[_0x3b4aef];return _0x444bd1;};'use strict';var client=require(_0x3bb8('0x0'));exports['create']=function(_0x125fc2){return client[_0x3bb8('0x1')]('CreateWhatsappMessage',{'body':_0x125fc2,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xecc7=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecc7,0xa2));var _0x7ecc=function(_0x43abfd,_0x2bda74){_0x43abfd=_0x43abfd-0x0;var _0x45f8c7=_0xecc7[_0x43abfd];return _0x45f8c7;};'use strict';var client=require(_0x7ecc('0x0'));exports['create']=function(_0x21e9d5){return client['Request'](_0x7ecc('0x1'),{'body':_0x21e9d5,'log':_0x7ecc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index a0df356..4144d20 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 _0x131e=['strategy','User','Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout'];(function(_0x290201,_0x279632){var _0x3d5c08=function(_0x3d0f41){while(--_0x3d0f41){_0x290201['push'](_0x290201['shift']());}};_0x3d5c08(++_0x279632);}(_0x131e,0x1ec));var _0xe131=function(_0x217be2,_0x46fc9e){_0x217be2=_0x217be2-0x0;var _0x5a9cf5=_0x131e[_0x217be2];return _0x5a9cf5;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xe131('0x0'),{'options':{'raw':![],'attributes':['id',_0xe131('0x1'),_0xe131('0x2'),_0xe131('0x3')],'include':[{'model':_0xe131('0x4'),'as':_0xe131('0x5'),'attributes':['id','name',_0xe131('0x6'),_0xe131('0x7')]}]},'log':_0xe131('0x8')});};}; \ No newline at end of file +var _0x02a7=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','getWhatsappQueues'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x02a7,0x1a6));var _0x702a=function(_0x316429,_0x1ee135){_0x316429=_0x316429-0x0;var _0x273bc4=_0x02a7[_0x316429];return _0x273bc4;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5')],'include':[{'model':_0x702a('0x6'),'as':_0x702a('0x7'),'attributes':['id',_0x702a('0x3'),_0x702a('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 2b908ca..bf0c423 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 _0x0203=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x4f708f,_0x19857c){var _0xc14ea8=function(_0x4f3728){while(--_0x4f3728){_0x4f708f['push'](_0x4f708f['shift']());}};_0xc14ea8(++_0x19857c);}(_0x0203,0xd2));var _0x3020=function(_0x3ff78c,_0x3ef19b){_0x3ff78c=_0x3ff78c-0x0;var _0xbe9978=_0x0203[_0x3ff78c];return _0xbe9978;};'use strict';var client=require(_0x3020('0x0'));exports[_0x3020('0x1')]=function(_0x55dc4d){return client[_0x3020('0x2')](_0x3020('0x3'),{'body':_0x55dc4d,'log':_0x3020('0x3')});};exports[_0x3020('0x4')]=function(_0x3c0092,_0x204480){return client['Request'](_0x3020('0x5'),{'body':_0x204480,'options':{'where':{'uniqueid':_0x3c0092},'order':[['id',_0x3020('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x4baf=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x3127cd,_0x1f0c31){var _0x3725db=function(_0xf82a07){while(--_0xf82a07){_0x3127cd['push'](_0x3127cd['shift']());}};_0x3725db(++_0x1f0c31);}(_0x4baf,0x17f));var _0xf4ba=function(_0x58c3ef,_0x56747d){_0x58c3ef=_0x58c3ef-0x0;var _0x42d5e5=_0x4baf[_0x58c3ef];return _0x42d5e5;};'use strict';var client=require(_0xf4ba('0x0'));exports[_0xf4ba('0x1')]=function(_0x5b0d74){return client[_0xf4ba('0x2')](_0xf4ba('0x3'),{'body':_0x5b0d74,'log':'CreateWhatsappQueueReport'});};exports[_0xf4ba('0x4')]=function(_0x5111ef,_0xf48271){return client[_0xf4ba('0x2')](_0xf4ba('0x5'),{'body':_0xf48271,'options':{'where':{'uniqueid':_0x5111ef},'order':[['id',_0xf4ba('0x6')]],'limit':0x1},'log':_0xf4ba('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 a8d6929..254d302 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 _0x76d7=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','info','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format'];(function(_0x383cad,_0x133407){var _0x1e8934=function(_0x4adb58){while(--_0x4adb58){_0x383cad['push'](_0x383cad['shift']());}};_0x1e8934(++_0x133407);}(_0x76d7,0x15f));var _0x776d=function(_0x287515,_0x14ee4c){_0x287515=_0x287515-0x0;var _0x1572ad=_0x76d7[_0x287515];return _0x1572ad;};'use strict';var schema=require(_0x776d('0x0'));var _=require('lodash');var util=require(_0x776d('0x1'));var seqqueue=require(_0x776d('0x2'));var logger=require('../../../../config/logger')(_0x776d('0x3'));var strategy=require(_0x776d('0x4'));var queue=schema({'name':{'type':_0x776d('0x5'),'required':!![],'message':_0x776d('0x6')},'timeout':{'type':'number','message':_0x776d('0x7')}});function writeLog(_0xa3ae5b,_0x6d0cb0,_0x316629){return logger['info'](util[_0x776d('0x8')](_0x776d('0x9'),_0xa3ae5b,_0x6d0cb0[_0x776d('0xa')],_0x316629));}function handleFindAgent(_0x260d65){return function(_0x3f4122){return _0x3f4122[_0x776d('0xa')][_0x776d('0xb')]()===_0x260d65[_0x776d('0xb')]();};}exports[_0x776d('0xc')]=function(_0x5adc18,_0x317920,_0x8308dc,_0x364cd6){return function(_0x32364f){try{var _0x5b354f={'name':_0x317920[0x0],'timeout':_0x317920[0x1]};var _0x12489d=queue[_0x776d('0x0')](_0x5b354f,{'typecast':!![]});if(_0x12489d['length']){logger[_0x776d('0xd')](_0x776d('0xe'),_0x5adc18,_[_0x776d('0xf')](_0x12489d,_0x776d('0x10'))[_0x776d('0x11')](',\x20'));_0x32364f[_0x776d('0x12')]();}else{var _0x1e11cd=_[_0x776d('0x13')](_0x8308dc['agents'],handleFindAgent(_0x5b354f['name']));if(_0x1e11cd){var _0x208ed7=(_0x5b354f[_0x776d('0x14')]||0xa)*0x3e8;var _0x4940a8,_0x1ad2c4;var _0x597333=seqqueue[_0x776d('0x15')](_0x208ed7);_0x597333['id']=_0x5adc18;_0x597333[_0x776d('0x16')]=_0x208ed7;_0x597333[_0x776d('0x17')]=_0x364cd6[_0x776d('0x17')];writeLog(_0x5adc18,_0x1e11cd,util[_0x776d('0x8')](_0x776d('0x18'),_0x208ed7));_0x8308dc[_0x776d('0x19')][_0x5adc18]['on'](_0x776d('0x1a'),function(){logger['info'](_0x776d('0x1b'),_0x5adc18);clearTimeout(_0x1ad2c4);_0x1ad2c4=undefined;_0x597333[_0x776d('0x1c')]();if(_0x8308dc['rules'][_0x5adc18]){delete _0x8308dc[_0x776d('0x19')][_0x5adc18];}_0x32364f['stop']();});_0x8308dc['rules'][_0x5adc18]['on']('complete',function(){if(_0x8308dc['rules'][_0x5adc18]){delete _0x8308dc[_0x776d('0x19')][_0x5adc18];}});_0x1ad2c4=setTimeout(function(){logger[_0x776d('0x1d')](_0x776d('0x1e'),_0x5adc18);clearTimeout(_0x1ad2c4);_0x597333[_0x776d('0x1c')]();_0x32364f['next']();},_0x208ed7);strategy[_0x776d('0x1f')](_0x597333,_0x1e11cd,_0x8308dc,_0x364cd6);}else{logger['error'](_0x776d('0x20'),_0x5adc18,_0x5b354f[_0x776d('0xa')]);_0x32364f[_0x776d('0x12')]();}}}catch(_0x31bebb){console[_0x776d('0x21')](_0x31bebb);logger[_0x776d('0xd')](_0x776d('0x22'),_0x5adc18,_0x31bebb[_0x776d('0x23')]);_0x32364f[_0x776d('0x12')]();}};}; \ No newline at end of file +var _0xd571=['routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','join','find','atimeout','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger'];(function(_0x5825ec,_0x465d97){var _0x334587=function(_0x5b7c32){while(--_0x5b7c32){_0x5825ec['push'](_0x5825ec['shift']());}};_0x334587(++_0x465d97);}(_0xd571,0x12e));var _0x1d57=function(_0xcc3c39,_0x96eadf){_0xcc3c39=_0xcc3c39-0x0;var _0xc666f8=_0xd571[_0xcc3c39];return _0xc666f8;};'use strict';var schema=require('validate');var _=require(_0x1d57('0x0'));var util=require(_0x1d57('0x1'));var seqqueue=require(_0x1d57('0x2'));var logger=require(_0x1d57('0x3'))(_0x1d57('0x4'));var strategy=require(_0x1d57('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x1d57('0x6')},'timeout':{'type':_0x1d57('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x41a5d2,_0x26faed,_0x1944eb){return logger['info'](util[_0x1d57('0x8')](_0x1d57('0x9'),_0x41a5d2,_0x26faed[_0x1d57('0xa')],_0x1944eb));}function handleFindAgent(_0xbbaac9){return function(_0x86f0fb){return _0x86f0fb[_0x1d57('0xa')][_0x1d57('0xb')]()===_0xbbaac9['toLowerCase']();};}exports['consequence']=function(_0x163af7,_0x2e34e0,_0x136236,_0x52e8c2){return function(_0x28cb82){try{var _0x56182e={'name':_0x2e34e0[0x0],'timeout':_0x2e34e0[0x1]};var _0x25175=queue[_0x1d57('0xc')](_0x56182e,{'typecast':!![]});if(_0x25175[_0x1d57('0xd')]){logger[_0x1d57('0xe')](_0x1d57('0xf'),_0x163af7,_[_0x1d57('0x10')](_0x25175,_0x1d57('0x11'))[_0x1d57('0x12')](',\x20'));_0x28cb82['stop']();}else{var _0xdb0ea1=_[_0x1d57('0x13')](_0x136236['agents'],handleFindAgent(_0x56182e['name']));if(_0xdb0ea1){var _0x4c6bc7=(_0x56182e['timeout']||0xa)*0x3e8;var _0x1ee662,_0x34c92a;var _0x53b368=seqqueue['createQueue'](_0x4c6bc7);_0x53b368['id']=_0x163af7;_0x53b368[_0x1d57('0x14')]=_0x4c6bc7;_0x53b368['channel']=_0x52e8c2['channel'];writeLog(_0x163af7,_0xdb0ea1,util[_0x1d57('0x8')](_0x1d57('0x15'),_0x4c6bc7));_0x136236[_0x1d57('0x16')][_0x163af7]['on'](_0x1d57('0x17'),function(){logger[_0x1d57('0x18')](_0x1d57('0x19'),_0x163af7);clearTimeout(_0x34c92a);_0x34c92a=undefined;_0x53b368[_0x1d57('0x1a')]();if(_0x136236[_0x1d57('0x16')][_0x163af7]){delete _0x136236[_0x1d57('0x16')][_0x163af7];}_0x28cb82[_0x1d57('0x1b')]();});_0x136236['rules'][_0x163af7]['on'](_0x1d57('0x1c'),function(){if(_0x136236['rules'][_0x163af7]){delete _0x136236[_0x1d57('0x16')][_0x163af7];}});_0x34c92a=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x163af7);clearTimeout(_0x34c92a);_0x53b368[_0x1d57('0x1a')]();_0x28cb82['next']();},_0x4c6bc7);strategy[_0x1d57('0x1d')](_0x53b368,_0xdb0ea1,_0x136236,_0x52e8c2);}else{logger[_0x1d57('0xe')](_0x1d57('0x1e'),_0x163af7,_0x56182e[_0x1d57('0xa')]);_0x28cb82[_0x1d57('0x1b')]();}}}catch(_0x1c2e97){console[_0x1d57('0x1f')](_0x1c2e97);logger['error'](_0x1d57('0x20'),_0x163af7,_0x1c2e97[_0x1d57('0x21')]);_0x28cb82[_0x1d57('0x1b')]();}};}; \ 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 5275c2f..ddf97c0 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 _0xdf1e=['channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','created','body','getMustacheRender','create','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','postText','amazonlex','Message','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','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'];(function(_0x2cb9fd,_0x3fb564){var _0x58067=function(_0x475f1d){while(--_0x475f1d){_0x2cb9fd['push'](_0x2cb9fd['shift']());}};_0x58067(++_0x3fb564);}(_0xdf1e,0xb3));var _0xedf1=function(_0x276c87,_0x12b561){_0x276c87=_0x276c87-0x0;var _0x15bb23=_0xdf1e[_0x276c87];return _0x15bb23;};'use strict';var _=require(_0xedf1('0x0'));var moment=require(_0xedf1('0x1'));var AWS=require(_0xedf1('0x2'));var utils=require(_0xedf1('0x3'));var logger=require(_0xedf1('0x4'))(_0xedf1('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xedf1('0x6')),'smsMessage':require(_0xedf1('0x7')),'faxMessage':require(_0xedf1('0x8')),'whatsappMessage':require(_0xedf1('0x9'))};exports[_0xedf1('0xa')]=function(_0xc8777,_0x3d0af7){return function(_0xf3cc5a){try{if(!_[_0xedf1('0xb')](this['interaction'][_0xedf1('0xc')])){logger[_0xedf1('0xd')](_0xedf1('0xe'),_0xc8777,_0xedf1('0xf'));return _0xf3cc5a[_0xedf1('0x10')]();}var _0x21a553={'ContactId':this[_0xedf1('0x11')]['id'],'sentAt':moment()[_0xedf1('0x12')](_0xedf1('0x13')),'direction':_0xedf1('0x14')};if(this[_0xedf1('0x15')]===_0xedf1('0x16')||this[_0xedf1('0x15')]===_0xedf1('0x17')){_0x21a553[_0xedf1('0x18')]=this[_0xedf1('0x19')][_0xedf1('0x18')];}var _0x11f0da=this[_0xedf1('0x15')];if(_0x11f0da===_0xedf1('0x1a')){_0x21a553[_0xedf1('0x1b')]=this[_0xedf1('0x1c')]['id'];}else{_0x21a553[_['upperFirst'](_0x11f0da)+_0xedf1('0x1d')]=this['account']['id'];}_0x21a553[_[_0xedf1('0x1e')](_0x11f0da)+'InteractionId']=this[_0xedf1('0x19')]['id'];if(this['interaction'][_0xedf1('0x1f')]){var _0x15f996=_0x3d0af7[0x4];if(!_['isEmpty'](_0x15f996)){_0x21a553[_0xedf1('0x20')]=utils[_0xedf1('0x21')](_0x15f996,this);return rpc[_0x11f0da+'Message'][_0xedf1('0x22')](_0x21a553)['then'](function(_0x422ab7){logger['info'](_0xedf1('0xe'),_0xc8777,_0x21a553[_0xedf1('0x20')]);})[_0xedf1('0x23')](function(_0x21361d){logger[_0xedf1('0x24')](_0xedf1('0xe'),_0xc8777,JSON[_0xedf1('0x25')](_0x21361d));})[_0xedf1('0x26')](function(){logger[_0xedf1('0xd')](_0xedf1('0x27'),_0xc8777);_0xf3cc5a[_0xedf1('0x28')]();});}else{logger['info'](_0xedf1('0x29'),_0xc8777);_0xf3cc5a[_0xedf1('0x28')]();}}else{var _0x3f630c=this;var _0x489d50=new AWS['LexRuntime']({'accessKeyId':_0x3d0af7[0x0],'secretAccessKey':_0x3d0af7[0x1],'region':_0x3d0af7[0x2]});var _0x77f41f={'botAlias':_0xedf1('0x2a'),'botName':_0x3d0af7[0x3],'inputText':this[_0xedf1('0x2b')][_0xedf1('0x20')],'userId':this[_0xedf1('0x15')]+':'+this['interaction']['id']['toString']()};_0x489d50[_0xedf1('0x2c')](_0x77f41f,function(_0x219bac,_0x4d6029){if(_0x219bac){logger[_0xedf1('0x24')]('[%s][AMAZONLEX]\x20%s',_0xc8777,_0x219bac[_0xedf1('0x2b')]);_0xf3cc5a[_0xedf1('0x10')]();}else if(_0x4d6029&&_0x4d6029[_0xedf1('0x2b')]){_0x3f630c[_0xedf1('0x20')][_0xedf1('0x2d')]=_0x4d6029;_0x21a553[_0xedf1('0x20')]=_0x4d6029[_0xedf1('0x2b')];_0x21a553['providerName']=_0xedf1('0x2d');_0x21a553['providerResponse']=JSON[_0xedf1('0x25')](_0x4d6029);return rpc[_0x11f0da+_0xedf1('0x2e')][_0xedf1('0x22')](_0x21a553)[_0xedf1('0x2f')](function(_0x53a2fb){logger[_0xedf1('0xd')](_0xedf1('0xe'),_0xc8777,_0x21a553[_0xedf1('0x20')]);if(_0x4d6029[_0xedf1('0x30')]==_0xedf1('0x31')){_0xf3cc5a[_0xedf1('0x10')]();}else{_0xf3cc5a[_0xedf1('0x28')]();}})[_0xedf1('0x23')](function(_0x49f891){logger[_0xedf1('0x24')](_0xedf1('0xe'),_0xc8777,JSON[_0xedf1('0x25')](_0x49f891));_0xf3cc5a[_0xedf1('0x10')]();});}else{_0xf3cc5a['next']();}});}}catch(_0x3ec3d5){logger[_0xedf1('0x24')]('[%s][AMAZONLEX]\x20%s',_0xc8777,JSON['stringify'](_0x3ec3d5));_0xf3cc5a[_0xedf1('0x28')]();}};}; \ No newline at end of file +var _0xb0e8=['consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','info','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','next','providerName','amazonlex','stringify','create','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb0e8,0x19d));var _0x8b0e=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xb0e8[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0x8b0e('0x0'));var moment=require('moment');var AWS=require(_0x8b0e('0x1'));var utils=require(_0x8b0e('0x2'));var logger=require(_0x8b0e('0x3'))(_0x8b0e('0x4'));var rpc={'chatMessage':require(_0x8b0e('0x5')),'openchannelMessage':require(_0x8b0e('0x6')),'mailMessage':require(_0x8b0e('0x7')),'smsMessage':require(_0x8b0e('0x8')),'faxMessage':require(_0x8b0e('0x9')),'whatsappMessage':require(_0x8b0e('0xa'))};exports[_0x8b0e('0xb')]=function(_0x7cd308,_0x3a2c40){return function(_0x123ef2){try{if(!_[_0x8b0e('0xc')](this['interaction'][_0x8b0e('0xd')])){logger['info'](_0x8b0e('0xe'),_0x7cd308,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x123ef2['next']();}var _0x2fca26={'ContactId':this[_0x8b0e('0xf')]['id'],'sentAt':moment()[_0x8b0e('0x10')](_0x8b0e('0x11')),'direction':_0x8b0e('0x12')};if(this[_0x8b0e('0x13')]===_0x8b0e('0x14')||this[_0x8b0e('0x13')]===_0x8b0e('0x15')){_0x2fca26['phone']=this[_0x8b0e('0x16')][_0x8b0e('0x17')];}var _0x57f380=this[_0x8b0e('0x13')];if(_0x57f380===_0x8b0e('0x18')){_0x2fca26[_0x8b0e('0x19')]=this[_0x8b0e('0x1a')]['id'];}else{_0x2fca26[_[_0x8b0e('0x1b')](_0x57f380)+_0x8b0e('0x1c')]=this[_0x8b0e('0x1a')]['id'];}_0x2fca26[_[_0x8b0e('0x1b')](_0x57f380)+_0x8b0e('0x1d')]=this[_0x8b0e('0x16')]['id'];if(this[_0x8b0e('0x16')][_0x8b0e('0x1e')]){var _0x324a8c=_0x3a2c40[0x4];if(!_[_0x8b0e('0x1f')](_0x324a8c)){_0x2fca26[_0x8b0e('0x20')]=utils[_0x8b0e('0x21')](_0x324a8c,this);return rpc[_0x57f380+_0x8b0e('0x22')]['create'](_0x2fca26)[_0x8b0e('0x23')](function(_0x5e073d){logger[_0x8b0e('0x24')](_0x8b0e('0xe'),_0x7cd308,_0x2fca26['body']);})[_0x8b0e('0x25')](function(_0x9b2d5b){logger[_0x8b0e('0x26')](_0x8b0e('0xe'),_0x7cd308,JSON['stringify'](_0x9b2d5b));})['finally'](function(){logger[_0x8b0e('0x24')](_0x8b0e('0x27'),_0x7cd308);_0x123ef2[_0x8b0e('0x28')]();});}else{logger[_0x8b0e('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x7cd308);_0x123ef2[_0x8b0e('0x28')]();}}else{var _0x418b0c=this;var _0x2ac10d=new AWS[(_0x8b0e('0x29'))]({'accessKeyId':_0x3a2c40[0x0],'secretAccessKey':_0x3a2c40[0x1],'region':_0x3a2c40[0x2]});var _0x1c7063={'botAlias':_0x8b0e('0x2a'),'botName':_0x3a2c40[0x3],'inputText':this[_0x8b0e('0x2b')][_0x8b0e('0x20')],'userId':this[_0x8b0e('0x13')]+':'+this[_0x8b0e('0x16')]['id'][_0x8b0e('0x2c')]()};_0x2ac10d[_0x8b0e('0x2d')](_0x1c7063,function(_0x3c94d9,_0x5e2439){if(_0x3c94d9){logger['error'](_0x8b0e('0xe'),_0x7cd308,_0x3c94d9[_0x8b0e('0x2b')]);_0x123ef2[_0x8b0e('0x2e')]();}else if(_0x5e2439&&_0x5e2439['message']){_0x418b0c[_0x8b0e('0x20')]['amazonlex']=_0x5e2439;_0x2fca26['body']=_0x5e2439[_0x8b0e('0x2b')];_0x2fca26[_0x8b0e('0x2f')]=_0x8b0e('0x30');_0x2fca26['providerResponse']=JSON[_0x8b0e('0x31')](_0x5e2439);return rpc[_0x57f380+_0x8b0e('0x22')][_0x8b0e('0x32')](_0x2fca26)[_0x8b0e('0x23')](function(_0x43b421){logger['info'](_0x8b0e('0xe'),_0x7cd308,_0x2fca26['body']);if(_0x5e2439[_0x8b0e('0x33')]==_0x8b0e('0x34')){_0x123ef2[_0x8b0e('0x2e')]();}else{_0x123ef2[_0x8b0e('0x28')]();}})[_0x8b0e('0x25')](function(_0x30c0aa){logger[_0x8b0e('0x26')](_0x8b0e('0xe'),_0x7cd308,JSON[_0x8b0e('0x31')](_0x30c0aa));_0x123ef2['next']();});}else{_0x123ef2['next']();}});}}catch(_0x209930){logger['error']('[%s][AMAZONLEX]\x20%s',_0x7cd308,JSON[_0x8b0e('0x31')](_0x209930));_0x123ef2[_0x8b0e('0x28')]();}};}; \ 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 3dce7f2..53f001d 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 _0xe635=['pass','inReplyTo','html','','replace','','headers','then','messageId','Message','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','next','catch','finally','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','format','out','mail','body','getMustacheRender','from','message','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','Smtp','service','host','secure','authentication','user'];(function(_0x3a3e30,_0x5996b5){var _0x19f849=function(_0xc6e736){while(--_0xc6e736){_0x3a3e30['push'](_0x3a3e30['shift']());}};_0x19f849(++_0x5996b5);}(_0xe635,0x1be));var _0x5e63=function(_0x649a3b,_0x2b1cf5){_0x649a3b=_0x649a3b-0x0;var _0x8ec5a5=_0xe635[_0x649a3b];return _0x8ec5a5;};'use strict';var _=require(_0x5e63('0x0'));var moment=require(_0x5e63('0x1'));var utils=require(_0x5e63('0x2'));var logger=require(_0x5e63('0x3'))(_0x5e63('0x4'));var rpc={'chatMessage':require(_0x5e63('0x5')),'openchannelMessage':require(_0x5e63('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5e63('0x7')),'whatsappMessage':require(_0x5e63('0x8'))};var mailRpc=require(_0x5e63('0x9'));exports[_0x5e63('0xa')]=function(_0x2d48ac,_0x2d15fb){return function(_0x1ba31c){try{if(_0x2d15fb[0x0]==='1'&&(_[_0x5e63('0xb')](this[_0x5e63('0xc')][_0x5e63('0xd')])||!this['interaction'][_0x5e63('0xd')])){logger[_0x5e63('0xe')](_0x5e63('0xf'),_0x2d48ac,_0x5e63('0x10'));return _0x1ba31c['next']();}var _0xd64e99=this[_0x5e63('0x11')];var _0x4a82d7={'ContactId':this[_0x5e63('0x12')]['id'],'sentAt':moment()[_0x5e63('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5e63('0x14')};if(this['channel']===_0x5e63('0x15')){_0x4a82d7[_0x5e63('0x16')]=utils[_0x5e63('0x17')](_0x2d15fb[0x2],this);}else{_0x4a82d7[_0x5e63('0x16')]=utils['getMustacheRender'](_0x2d15fb[0x1],this);}if(this['message']){_0x4a82d7['to']=this['message'][_0x5e63('0x18')]||'';if(this[_0x5e63('0x11')]==='mail'&&_0x2d15fb[0x1]==='1'){_0x4a82d7['cc']=this[_0x5e63('0x19')]['cc']||'';}_0x4a82d7[_0x5e63('0x18')]=this[_0x5e63('0x19')]['to']||'';_0x4a82d7['phone']=this[_0x5e63('0x19')][_0x5e63('0x1a')]||'';_0x4a82d7[_0x5e63('0x1b')]=!![];if(this[_0x5e63('0x19')][_0x5e63('0x1c')]){_0x4a82d7['subject']='';_0x4a82d7[_0x5e63('0x1c')]+=_[_0x5e63('0x1d')](this[_0x5e63('0x19')][_0x5e63('0x1c')],_0x5e63('0x1e'))?'':'Re:\x20';_0x4a82d7[_0x5e63('0x1c')]+=this['message']['subject'];}}if(this[_0x5e63('0x11')]===_0x5e63('0x1f')){_0x4a82d7[_0x5e63('0x20')]=this[_0x5e63('0x21')]['id'];}else{_0x4a82d7[_[_0x5e63('0x22')](this[_0x5e63('0x11')])+_0x5e63('0x23')]=this[_0x5e63('0x21')]['id'];}_0x4a82d7[_[_0x5e63('0x22')](this[_0x5e63('0x11')])+'InteractionId']=this[_0x5e63('0xc')]['id'];if(rpc[this['channel']+'Message']){if(this[_0x5e63('0x11')]===_0x5e63('0x15')){var _0x2d9387={'tls':{'rejectUnauthorized':![]}};if(this[_0x5e63('0x21')][_0x5e63('0x24')][_0x5e63('0x25')]){_0x2d9387[_0x5e63('0x25')]=this['account'][_0x5e63('0x24')]['service'];}else{_0x2d9387[_0x5e63('0x26')]=this[_0x5e63('0x21')]['Smtp'][_0x5e63('0x26')];_0x2d9387['port']=this[_0x5e63('0x21')][_0x5e63('0x24')]['port'];_0x2d9387['secure']=this[_0x5e63('0x21')][_0x5e63('0x24')][_0x5e63('0x27')];}if(this[_0x5e63('0x21')][_0x5e63('0x24')][_0x5e63('0x28')]){_0x2d9387['auth']={'user':this[_0x5e63('0x21')]['Smtp'][_0x5e63('0x29')],'pass':this[_0x5e63('0x21')][_0x5e63('0x24')][_0x5e63('0x2a')]};}_0x4a82d7[_0x5e63('0x2b')]=this[_0x5e63('0x19')]['messageId'];_0x4a82d7[_0x5e63('0x2c')]=_0x5e63('0x2d')+_[_0x5e63('0x2e')](_0x4a82d7['body'],_0x5e63('0x2f'),_0x5e63('0x30'))+_0x5e63('0x31');_0x4a82d7[_0x5e63('0x32')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x2d9387,_0x4a82d7)[_0x5e63('0x33')](function(_0x271522){logger[_0x5e63('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x2d48ac);_0x4a82d7[_0x5e63('0x34')]=_0x271522[_0x5e63('0x19')]['messageId'];return rpc[_0xd64e99+_0x5e63('0x35')][_0x5e63('0x36')](_0x4a82d7);})[_0x5e63('0x33')](function(_0x195146){logger['info'](_0x5e63('0xf'),_0x2d48ac,JSON['stringify'](_0x195146));})['catch'](function(_0x3de99f){logger[_0x5e63('0x37')](_0x5e63('0x38'),_0x2d48ac,JSON[_0x5e63('0x39')](_0x3de99f));})['finally'](function(){_0x1ba31c[_0x5e63('0x3a')]();});}else{return rpc[this[_0x5e63('0x11')]+_0x5e63('0x35')][_0x5e63('0x36')](_0x4a82d7)[_0x5e63('0x33')](function(_0x15c84e){logger[_0x5e63('0xe')](_0x5e63('0xf'),_0x2d48ac,_0x4a82d7['body']);})[_0x5e63('0x3b')](function(_0x582e25){logger[_0x5e63('0x37')]('[%s][AUTOREPLY]\x20%s',_0x2d48ac,JSON[_0x5e63('0x39')](_0x582e25));})[_0x5e63('0x3c')](function(){_0x1ba31c['next']();});}}}catch(_0x354ce2){logger[_0x5e63('0x37')](_0x5e63('0xf'),_0x2d48ac,JSON[_0x5e63('0x39')](_0x354ce2));_0x1ba31c['stop']();}};}; \ No newline at end of file +var _0x4b11=['../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','account','AccountId','upperFirst','Message','Smtp','service','host','port','secure','auth','user','inReplyTo','messageId','','replace','';_0x56142f['headers']={'Auto-Submitted':_0x14b1('0x31'),'X-Auto-Response-Suppress':'All','Precedence':_0x14b1('0x32')};return mailRpc[_0x14b1('0x33')](_0x590166,_0x56142f)['then'](function(_0x2397b8){logger['info'](_0x14b1('0x34'),_0x322430);_0x56142f[_0x14b1('0x2c')]=_0x2397b8[_0x14b1('0x18')][_0x14b1('0x2c')];return rpc[_0x2c5978+_0x14b1('0x23')][_0x14b1('0x35')](_0x56142f);})[_0x14b1('0x36')](function(_0xe1c336){logger['info'](_0x14b1('0xf'),_0x322430,JSON[_0x14b1('0x37')](_0xe1c336));})[_0x14b1('0x38')](function(_0x33f24d){logger['error'](_0x14b1('0x39'),_0x322430,JSON[_0x14b1('0x37')](_0x33f24d));})[_0x14b1('0x3a')](function(){_0x36b3df['next']();});}else{return rpc[this['channel']+_0x14b1('0x23')][_0x14b1('0x35')](_0x56142f)['then'](function(_0x3c0a4c){logger['info'](_0x14b1('0xf'),_0x322430,_0x56142f[_0x14b1('0x3b')]);})[_0x14b1('0x38')](function(_0x64ab64){logger[_0x14b1('0x3c')](_0x14b1('0xf'),_0x322430,JSON['stringify'](_0x64ab64));})[_0x14b1('0x3a')](function(){_0x36b3df[_0x14b1('0x3d')]();});}}}catch(_0x34f5e0){logger['error']('[%s][AUTOREPLY]\x20%s',_0x322430,JSON[_0x14b1('0x37')](_0x34f5e0));_0x36b3df[_0x14b1('0x3e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 635361e..6f20286 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa3=['consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2aa3,0x83));var _0x32aa=function(_0x22f6d5,_0x42b6e6){_0x22f6d5=_0x22f6d5-0x0;var _0xc6a75f=_0x2aa3[_0x22f6d5];return _0xc6a75f;};'use strict';var moment=require(_0x32aa('0x0'));var logger=require(_0x32aa('0x1'))(_0x32aa('0x2'));var rpc={'chatInteraction':require(_0x32aa('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x32aa('0x4')),'faxInteraction':require(_0x32aa('0x5')),'whatsappInteraction':require(_0x32aa('0x6'))};exports[_0x32aa('0x7')]=function(_0x22e989,_0x3d7c94,_0x53ab98,_0x17346a){return function(_0x112396){try{logger[_0x32aa('0x8')](_0x32aa('0x9'),_0x22e989,_0x3d7c94[0x0]);var _0x18ded0={'closed':0x1,'closedAt':moment()[_0x32aa('0xa')](_0x32aa('0xb')),'closeReason':_0x32aa('0xc'),'disposition':_0x3d7c94[0x0]};if(rpc[_0x17346a['channel']+_0x32aa('0xd')]){rpc[_0x17346a['channel']+_0x32aa('0xd')][_0x32aa('0xe')](_0x17346a[_0x32aa('0xf')]['id'],_0x18ded0)[_0x32aa('0x10')](function(_0x492c48){logger[_0x32aa('0x8')](_0x32aa('0x11'),_0x22e989,_0x17346a[_0x32aa('0xf')]['id']);})['catch'](function(_0x3d341f){logger[_0x32aa('0x12')](_0x32aa('0x13'),_0x22e989,JSON[_0x32aa('0x14')](_0x3d341f));})[_0x32aa('0x15')](function(){_0x112396[_0x32aa('0x16')]();});}}catch(_0x5e96e3){logger[_0x32aa('0x12')]('[%s][CLOSE]\x20%s',_0x22e989,JSON[_0x32aa('0x14')](_0x5e96e3));_0x112396[_0x32aa('0x16')]();}};}; \ No newline at end of file +var _0x1a44=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','stop','moment','routing'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0x1a44,0xc4));var _0x41a4=function(_0x2ecd36,_0x116ded){_0x2ecd36=_0x2ecd36-0x0;var _0x356b25=_0x1a44[_0x2ecd36];return _0x356b25;};'use strict';var moment=require(_0x41a4('0x0'));var logger=require('../../../../config/logger')(_0x41a4('0x1'));var rpc={'chatInteraction':require(_0x41a4('0x2')),'openchannelInteraction':require(_0x41a4('0x3')),'smsInteraction':require(_0x41a4('0x4')),'mailInteraction':require(_0x41a4('0x5')),'faxInteraction':require(_0x41a4('0x6')),'whatsappInteraction':require(_0x41a4('0x7'))};exports['consequence']=function(_0x20ab2d,_0x26b91a,_0xb62f3c,_0x412bd8){return function(_0x599ccc){try{logger['info'](_0x41a4('0x8'),_0x20ab2d,_0x26b91a[0x0]);var _0x141ae3={'closed':0x1,'closedAt':moment()[_0x41a4('0x9')](_0x41a4('0xa')),'closeReason':_0x41a4('0xb'),'disposition':_0x26b91a[0x0]};if(rpc[_0x412bd8['channel']+'Interaction']){rpc[_0x412bd8[_0x41a4('0xc')]+_0x41a4('0xd')][_0x41a4('0xe')](_0x412bd8[_0x41a4('0xf')]['id'],_0x141ae3)[_0x41a4('0x10')](function(_0x3e5320){logger['info'](_0x41a4('0x11'),_0x20ab2d,_0x412bd8[_0x41a4('0xf')]['id']);})[_0x41a4('0x12')](function(_0x184baf){logger['error'](_0x41a4('0x13'),_0x20ab2d,JSON[_0x41a4('0x14')](_0x184baf));})['finally'](function(){_0x599ccc[_0x41a4('0x15')]();});}}catch(_0x43150b){logger['error']('[%s][CLOSE]\x20%s',_0x20ab2d,JSON[_0x41a4('0x14')](_0x43150b));_0x599ccc[_0x41a4('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 49ed4c9..e5aa702 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x617a=['channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','create','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','then','endConversation','next','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','sms'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x617a,0x150));var _0xa617=function(_0x324245,_0xf9122c){_0x324245=_0x324245-0x0;var _0x28302a=_0x617a[_0x324245];return _0x28302a;};'use strict';var _=require(_0xa617('0x0'));var moment=require(_0xa617('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xa617('0x2'));var logger=require(_0xa617('0x3'))(_0xa617('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa617('0x5')),'mailMessage':require(_0xa617('0x6')),'smsMessage':require(_0xa617('0x7')),'faxMessage':require(_0xa617('0x8')),'whatsappMessage':require(_0xa617('0x9'))};exports[_0xa617('0xa')]=function(_0x181a17,_0x102166){return function(_0x3ae85f){try{if(!_[_0xa617('0xb')](this[_0xa617('0xc')][_0xa617('0xd')])){logger[_0xa617('0xe')](_0xa617('0xf'),_0x181a17,_0xa617('0x10'));return _0x3ae85f['next']();}var _0x2cb885={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa617('0x11')](_0xa617('0x12')),'direction':_0xa617('0x13')};if(this['channel']===_0xa617('0x14')||this[_0xa617('0x15')]===_0xa617('0x16')){_0x2cb885[_0xa617('0x17')]=this[_0xa617('0xc')][_0xa617('0x17')];}var _0x51d3a6=this[_0xa617('0x15')];if(_0x51d3a6===_0xa617('0x18')){_0x2cb885[_0xa617('0x19')]=this[_0xa617('0x1a')]['id'];}else{_0x2cb885[_['upperFirst'](_0x51d3a6)+'AccountId']=this[_0xa617('0x1a')]['id'];}_0x2cb885[_[_0xa617('0x1b')](_0x51d3a6)+_0xa617('0x1c')]=this['interaction']['id'];if(this[_0xa617('0xc')][_0xa617('0x1d')]){var _0x43e039=_0x102166[0x2];if(!_[_0xa617('0x1e')](_0x43e039)){_0x2cb885[_0xa617('0x1f')]=utils['getMustacheRender'](_0x43e039,this);return rpc[_0x51d3a6+'Message'][_0xa617('0x20')](_0x2cb885)['then'](function(_0x4c99e3){logger['info'](_0xa617('0xf'),_0x181a17,_0x2cb885[_0xa617('0x1f')]);})[_0xa617('0x21')](function(_0x4051c5){logger[_0xa617('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x181a17,JSON[_0xa617('0x23')](_0x4051c5));})[_0xa617('0x24')](function(){logger[_0xa617('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x181a17);_0x3ae85f[_0xa617('0x25')]();});}else{logger[_0xa617('0xe')](_0xa617('0x26'),_0x181a17);_0x3ae85f[_0xa617('0x25')]();}}else{var _0x229430=this;var _0x153a93=apiai(_0x102166[0x0],{'language':_0x102166[0x1]||'en'});return _0x153a93[_0xa617('0x27')](this[_0xa617('0x28')][_0xa617('0x1f')],{'sessionId':md5(this[_0xa617('0xc')]['id'])})['then'](function(_0x52a3d6){_0x229430[_0xa617('0x1f')][_0xa617('0x29')]=_0x52a3d6;_0x2cb885[_0xa617('0x1f')]=_0x52a3d6[_0xa617('0x2a')][_0xa617('0x2b')][_0xa617('0x2c')];_0x2cb885[_0xa617('0x2d')]=_0xa617('0x29');_0x2cb885[_0xa617('0x2e')]=JSON[_0xa617('0x23')](_0x52a3d6);return rpc[_0x51d3a6+_0xa617('0x2f')][_0xa617('0x20')](_0x2cb885)[_0xa617('0x30')](function(_0x3ab253){logger[_0xa617('0xe')](_0xa617('0xf'),_0x181a17,_0x2cb885[_0xa617('0x1f')]);if(_0x52a3d6[_0xa617('0x2a')]['metadata'][_0xa617('0x31')]){_0x3ae85f['next']();}else{_0x3ae85f[_0xa617('0x25')]();}})[_0xa617('0x21')](function(_0x3f63af){logger[_0xa617('0x22')](_0xa617('0xf'),_0x181a17,JSON[_0xa617('0x23')](_0x3f63af));_0x3ae85f[_0xa617('0x32')]();});})[_0xa617('0x21')](function(_0x48ea53){logger[_0xa617('0x22')](_0xa617('0xf'),_0x181a17,_0x48ea53[_0xa617('0x28')]);_0x3ae85f[_0xa617('0x32')]();});}}catch(_0x356888){logger[_0xa617('0x22')](_0xa617('0xf'),_0x181a17,JSON[_0xa617('0x23')](_0x356888));_0x3ae85f[_0xa617('0x25')]();}};}; \ No newline at end of file +var _0x9c13=['isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','Message','metadata','next','lodash','moment','apiai-promise','md5','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x4d36dd,_0x4bc5bc){var _0xa9350f=function(_0x2ff7a9){while(--_0x2ff7a9){_0x4d36dd['push'](_0x4d36dd['shift']());}};_0xa9350f(++_0x4bc5bc);}(_0x9c13,0x127));var _0x39c1=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x9c13[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0x39c1('0x0'));var moment=require(_0x39c1('0x1'));var apiai=require(_0x39c1('0x2'));var md5=require(_0x39c1('0x3'));var utils=require(_0x39c1('0x4'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x39c1('0x5')),'openchannelMessage':require(_0x39c1('0x6')),'mailMessage':require(_0x39c1('0x7')),'smsMessage':require(_0x39c1('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x39c1('0x9'))};exports[_0x39c1('0xa')]=function(_0x4bd4ef,_0x527946){return function(_0x16c4c5){try{if(!_[_0x39c1('0xb')](this[_0x39c1('0xc')][_0x39c1('0xd')])){logger[_0x39c1('0xe')](_0x39c1('0xf'),_0x4bd4ef,_0x39c1('0x10'));return _0x16c4c5['next']();}var _0x3919e0={'ContactId':this[_0x39c1('0x11')]['id'],'sentAt':moment()[_0x39c1('0x12')](_0x39c1('0x13')),'direction':_0x39c1('0x14')};if(this[_0x39c1('0x15')]===_0x39c1('0x16')||this['channel']===_0x39c1('0x17')){_0x3919e0[_0x39c1('0x18')]=this[_0x39c1('0xc')][_0x39c1('0x18')];}var _0x493ff1=this[_0x39c1('0x15')];if(_0x493ff1===_0x39c1('0x19')){_0x3919e0[_0x39c1('0x1a')]=this['account']['id'];}else{_0x3919e0[_['upperFirst'](_0x493ff1)+_0x39c1('0x1b')]=this[_0x39c1('0x1c')]['id'];}_0x3919e0[_[_0x39c1('0x1d')](_0x493ff1)+_0x39c1('0x1e')]=this['interaction']['id'];if(this[_0x39c1('0xc')]['created']){var _0x580346=_0x527946[0x2];if(!_[_0x39c1('0x1f')](_0x580346)){_0x3919e0[_0x39c1('0x20')]=utils[_0x39c1('0x21')](_0x580346,this);return rpc[_0x493ff1+'Message'][_0x39c1('0x22')](_0x3919e0)[_0x39c1('0x23')](function(_0x12da18){logger[_0x39c1('0xe')](_0x39c1('0xf'),_0x4bd4ef,_0x3919e0[_0x39c1('0x20')]);})[_0x39c1('0x24')](function(_0x217ed2){logger[_0x39c1('0x25')](_0x39c1('0xf'),_0x4bd4ef,JSON['stringify'](_0x217ed2));})[_0x39c1('0x26')](function(){logger[_0x39c1('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4bd4ef);_0x16c4c5['stop']();});}else{logger[_0x39c1('0xe')](_0x39c1('0x27'),_0x4bd4ef);_0x16c4c5['stop']();}}else{var _0x156a82=this;var _0x4da2b1=apiai(_0x527946[0x0],{'language':_0x527946[0x1]||'en'});return _0x4da2b1['textRequest'](this[_0x39c1('0x28')][_0x39c1('0x20')],{'sessionId':md5(this[_0x39c1('0xc')]['id'])})[_0x39c1('0x23')](function(_0x12b1b6){_0x156a82[_0x39c1('0x20')][_0x39c1('0x29')]=_0x12b1b6;_0x3919e0['body']=_0x12b1b6[_0x39c1('0x2a')][_0x39c1('0x2b')][_0x39c1('0x2c')];_0x3919e0[_0x39c1('0x2d')]='dialogflow';_0x3919e0[_0x39c1('0x2e')]=JSON[_0x39c1('0x2f')](_0x12b1b6);return rpc[_0x493ff1+_0x39c1('0x30')][_0x39c1('0x22')](_0x3919e0)[_0x39c1('0x23')](function(_0x1834a7){logger['info'](_0x39c1('0xf'),_0x4bd4ef,_0x3919e0[_0x39c1('0x20')]);if(_0x12b1b6[_0x39c1('0x2a')][_0x39c1('0x31')]['endConversation']){_0x16c4c5[_0x39c1('0x32')]();}else{_0x16c4c5['stop']();}})[_0x39c1('0x24')](function(_0xbaae14){logger[_0x39c1('0x25')](_0x39c1('0xf'),_0x4bd4ef,JSON[_0x39c1('0x2f')](_0xbaae14));_0x16c4c5['next']();});})[_0x39c1('0x24')](function(_0x37e4f6){logger[_0x39c1('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x4bd4ef,_0x37e4f6[_0x39c1('0x28')]);_0x16c4c5[_0x39c1('0x32')]();});}}catch(_0xe508a4){logger[_0x39c1('0x25')](_0x39c1('0xf'),_0x4bd4ef,JSON[_0x39c1('0x2f')](_0xe508a4));_0x16c4c5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 8997143..950c8a8 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6874=['dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','next','message','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','detectIntent','length'];(function(_0x2d0049,_0x1a6e0f){var _0x44ae3a=function(_0x20d118){while(--_0x20d118){_0x2d0049['push'](_0x2d0049['shift']());}};_0x44ae3a(++_0x1a6e0f);}(_0x6874,0xf3));var _0x4687=function(_0x1df0a9,_0xc0d944){_0x1df0a9=_0x1df0a9-0x0;var _0x13238e=_0x6874[_0x1df0a9];return _0x13238e;};'use strict';var _=require('lodash');var dialogflow=require(_0x4687('0x0'));var md5=require(_0x4687('0x1'));var moment=require(_0x4687('0x2'));var Promise=require(_0x4687('0x3'));var logger=require(_0x4687('0x4'))(_0x4687('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4687('0x6')),'mailMessage':require(_0x4687('0x7')),'smsMessage':require(_0x4687('0x8')),'faxMessage':require(_0x4687('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x142b98,_0x250e4e,_0x90c063,_0x522120){return new Promise(function(_0x559d1d,_0x4acf3c){var _0x19b485=_[_0x4687('0xa')](_0x90c063);_0x19b485[_0x4687('0xb')]=_0x522120;return rpc[_0x250e4e+'Message'][_0x4687('0xc')](_0x19b485)[_0x4687('0xd')](function(){logger['info'](_0x4687('0xe'),_0x142b98,_0x19b485[_0x4687('0xb')]);_0x559d1d();})[_0x4687('0xf')](function(_0x470203){logger[_0x4687('0x10')](_0x4687('0xe'),_0x142b98,JSON['stringify'](_0x470203));_0x4acf3c(_0x470203);});});}exports[_0x4687('0x11')]=function(_0x288a9c,_0x39948b){return function(_0x569bb4){try{if(!_[_0x4687('0x12')](this['interaction'][_0x4687('0x13')])){logger[_0x4687('0x14')](_0x4687('0xe'),_0x288a9c,_0x4687('0x15'));return _0x569bb4['next']();}var _0x29ded4={'ContactId':this[_0x4687('0x16')]['id'],'sentAt':moment()[_0x4687('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x4687('0x18')]==='sms'||this[_0x4687('0x18')]==='whatsapp'){_0x29ded4[_0x4687('0x19')]=this[_0x4687('0x1a')][_0x4687('0x19')];}var _0x452090=this[_0x4687('0x18')];if(_0x452090===_0x4687('0x1b')){_0x29ded4[_0x4687('0x1c')]=this[_0x4687('0x1d')]['id'];}else{_0x29ded4[_[_0x4687('0x1e')](_0x452090)+_0x4687('0x1f')]=this['account']['id'];}_0x29ded4[_['upperFirst'](_0x452090)+_0x4687('0x20')]=this['interaction']['id'];if(this[_0x4687('0x1a')][_0x4687('0x21')]){var _0x5c8bf3=_0x39948b[0x4];if(!_[_0x4687('0x22')](_0x5c8bf3)){_0x29ded4[_0x4687('0xb')]=utils[_0x4687('0x23')](_0x5c8bf3,this);return rpc[_0x452090+_0x4687('0x24')][_0x4687('0xc')](_0x29ded4)[_0x4687('0xd')](function(_0x2e154b){logger[_0x4687('0x14')](_0x4687('0xe'),_0x288a9c,_0x29ded4['body']);})[_0x4687('0xf')](function(_0x108b60){logger[_0x4687('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x288a9c,JSON[_0x4687('0x25')](_0x108b60));})['finally'](function(){logger[_0x4687('0x14')](_0x4687('0x26'),_0x288a9c);_0x569bb4[_0x4687('0x27')]();});}else{logger[_0x4687('0x14')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x288a9c);_0x569bb4['stop']();}}else{var _0x23cc16=this;var _0x2d4a22=_0x39948b[0x2][_0x4687('0x28')](/\\n/g,'\x0a');var _0x1c5fe7={'credentials':{'private_key':_0x2d4a22,'client_email':_0x39948b[0x1]}};var _0x143081=new dialogflow[(_0x4687('0x29'))](_0x1c5fe7);var _0xfc6f5e=_0x143081[_0x4687('0x2a')](_0x39948b[0x0],md5(_0x23cc16[_0x4687('0x1a')]['id']));var _0x3bd7b5={'session':_0xfc6f5e,'queryInput':{'text':{'text':_0x23cc16['message'][_0x4687('0xb')],'languageCode':_0x39948b[0x3]||'en'}}};return _0x143081[_0x4687('0x2b')](_0x3bd7b5)[_0x4687('0xd')](function(_0xa9bdbb){if(_0xa9bdbb&&_0xa9bdbb[_0x4687('0x2c')]){_0x23cc16[_0x4687('0xb')][_0x4687('0x2d')]=_0xa9bdbb;var _0x552fa8=_0xa9bdbb[0x0];var _0x44c427=_0x552fa8[_0x4687('0x2e')][_0x4687('0x2f')]&&_0x552fa8[_0x4687('0x2e')]['diagnosticInfo'][_0x4687('0x30')]?_0x552fa8[_0x4687('0x2e')][_0x4687('0x2f')][_0x4687('0x30')]['end_conversation'][_0x4687('0x31')]:![];_0x23cc16[_0x4687('0xb')]['DIALOGFLOWV2_ACTION']=_0x552fa8[_0x4687('0x2e')][_0x4687('0x32')];_0x23cc16[_0x4687('0xb')][_0x4687('0x33')]=_0x552fa8['queryResult']['allRequiredParamsPresent'];_0x23cc16['body'][_0x4687('0x34')]=_0x552fa8[_0x4687('0x2e')][_0x4687('0x2f')]&&_0x552fa8['queryResult']['diagnosticInfo'][_0x4687('0x30')]?_0x552fa8[_0x4687('0x2e')][_0x4687('0x2f')][_0x4687('0x30')][_0x4687('0x35')][_0x4687('0x31')]:![];_0x23cc16['body'][_0x4687('0x36')]=_0x552fa8[_0x4687('0x2e')]['intent'][_0x4687('0x37')];_0x23cc16[_0x4687('0xb')][_0x4687('0x38')]=_0x552fa8['queryResult'][_0x4687('0x39')]['displayName'];_0x23cc16['body'][_0x4687('0x3a')]=_0x552fa8[_0x4687('0x2e')][_0x4687('0x39')][_0x4687('0x3b')];_0x23cc16['body'][_0x4687('0x3c')]=_0x552fa8[_0x4687('0x2e')][_0x4687('0x3d')];_0x23cc16[_0x4687('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x552fa8[_0x4687('0x2e')][_0x4687('0x3e')];_0x23cc16[_0x4687('0xb')][_0x4687('0x3f')]=_0x552fa8[_0x4687('0x2e')][_0x4687('0x40')];_0x29ded4[_0x4687('0x41')]=_0x4687('0x2d');_0x29ded4[_0x4687('0x42')]=JSON[_0x4687('0x25')](_0xa9bdbb);var _0x12dfb6=[];for(var _0x37924a=0x0;_0x37924a<_0xa9bdbb[_0x4687('0x2c')];_0x37924a++){var _0x297aff=_0xa9bdbb[_0x37924a];if(_0x297aff&&_0x297aff[_0x4687('0x2e')]&&_0x297aff[_0x4687('0x2e')][_0x4687('0x43')]){_0x12dfb6[_0x4687('0x44')](createMessage(_0x288a9c,_0x452090,_0x29ded4,_0x297aff['queryResult']['fulfillmentText']));}}return Promise[_0x4687('0x45')](_0x12dfb6)[_0x4687('0xd')](function(){if(_0x44c427){_0x569bb4['next']();}else{_0x569bb4[_0x4687('0x27')]();}})[_0x4687('0xf')](function(_0x2a5088){logger[_0x4687('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x288a9c,JSON[_0x4687('0x25')](_0x2a5088));_0x569bb4[_0x4687('0x46')]();});}})[_0x4687('0xf')](function(_0x5279b0){logger[_0x4687('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x288a9c,_0x5279b0[_0x4687('0x47')]);_0x569bb4['next']();});}}catch(_0x2196f6){logger['error'](_0x4687('0xe'),_0x288a9c,JSON[_0x4687('0x25')](_0x2196f6));_0x569bb4[_0x4687('0x27')]();}};}; \ No newline at end of file +var _0xd48e=['DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','all','lodash','dialogflow','md5','bluebird','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName'];(function(_0x258bbc,_0x27a30){var _0x54dee0=function(_0x1714bb){while(--_0x1714bb){_0x258bbc['push'](_0x258bbc['shift']());}};_0x54dee0(++_0x27a30);}(_0xd48e,0x187));var _0xed48=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xd48e[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0xed48('0x0'));var dialogflow=require(_0xed48('0x1'));var md5=require(_0xed48('0x2'));var moment=require('moment');var Promise=require(_0xed48('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xed48('0x4'));var rpc={'chatMessage':require(_0xed48('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xed48('0x6')),'smsMessage':require(_0xed48('0x7')),'faxMessage':require(_0xed48('0x8')),'whatsappMessage':require(_0xed48('0x9'))};function createMessage(_0x3b4945,_0x3ad105,_0x52f78a,_0x48b921){return new Promise(function(_0x288ff4,_0x3c40da){var _0x5d54cc=_[_0xed48('0xa')](_0x52f78a);_0x5d54cc[_0xed48('0xb')]=_0x48b921;return rpc[_0x3ad105+'Message'][_0xed48('0xc')](_0x5d54cc)[_0xed48('0xd')](function(){logger[_0xed48('0xe')](_0xed48('0xf'),_0x3b4945,_0x5d54cc[_0xed48('0xb')]);_0x288ff4();})[_0xed48('0x10')](function(_0x5c1938){logger[_0xed48('0x11')](_0xed48('0xf'),_0x3b4945,JSON[_0xed48('0x12')](_0x5c1938));_0x3c40da(_0x5c1938);});});}exports[_0xed48('0x13')]=function(_0xf0d446,_0x57ef03){return function(_0x231645){try{if(!_['isNil'](this['interaction'][_0xed48('0x14')])){logger['info'](_0xed48('0xf'),_0xf0d446,_0xed48('0x15'));return _0x231645[_0xed48('0x16')]();}var _0x1c5e7b={'ContactId':this[_0xed48('0x17')]['id'],'sentAt':moment()[_0xed48('0x18')](_0xed48('0x19')),'direction':_0xed48('0x1a')};if(this[_0xed48('0x1b')]===_0xed48('0x1c')||this[_0xed48('0x1b')]===_0xed48('0x1d')){_0x1c5e7b[_0xed48('0x1e')]=this[_0xed48('0x1f')][_0xed48('0x1e')];}var _0x427981=this[_0xed48('0x1b')];if(_0x427981===_0xed48('0x20')){_0x1c5e7b['ChatWebsiteId']=this[_0xed48('0x21')]['id'];}else{_0x1c5e7b[_[_0xed48('0x22')](_0x427981)+_0xed48('0x23')]=this[_0xed48('0x21')]['id'];}_0x1c5e7b[_[_0xed48('0x22')](_0x427981)+_0xed48('0x24')]=this[_0xed48('0x1f')]['id'];if(this[_0xed48('0x1f')][_0xed48('0x25')]){var _0x207790=_0x57ef03[0x4];if(!_[_0xed48('0x26')](_0x207790)){_0x1c5e7b[_0xed48('0xb')]=utils[_0xed48('0x27')](_0x207790,this);return rpc[_0x427981+_0xed48('0x28')][_0xed48('0xc')](_0x1c5e7b)['then'](function(_0x431492){logger['info'](_0xed48('0xf'),_0xf0d446,_0x1c5e7b['body']);})[_0xed48('0x10')](function(_0x2586e8){logger[_0xed48('0x11')](_0xed48('0xf'),_0xf0d446,JSON[_0xed48('0x12')](_0x2586e8));})[_0xed48('0x29')](function(){logger[_0xed48('0xe')](_0xed48('0x2a'),_0xf0d446);_0x231645[_0xed48('0x2b')]();});}else{logger[_0xed48('0xe')](_0xed48('0x2c'),_0xf0d446);_0x231645['stop']();}}else{var _0x14ebe7=this;var _0xa322d=_0x57ef03[0x2][_0xed48('0x2d')](/\\n/g,'\x0a');var _0x8df29c={'credentials':{'private_key':_0xa322d,'client_email':_0x57ef03[0x1]}};var _0x1dcc99=new dialogflow[(_0xed48('0x2e'))](_0x8df29c);var _0x1fb8c9=_0x1dcc99[_0xed48('0x2f')](_0x57ef03[0x0],md5(_0x14ebe7[_0xed48('0x1f')]['id']));var _0x2c7e99={'session':_0x1fb8c9,'queryInput':{'text':{'text':_0x14ebe7[_0xed48('0x30')][_0xed48('0xb')],'languageCode':_0x57ef03[0x3]||'en'}}};return _0x1dcc99[_0xed48('0x31')](_0x2c7e99)[_0xed48('0xd')](function(_0x51a53b){if(_0x51a53b&&_0x51a53b[_0xed48('0x32')]){_0x14ebe7[_0xed48('0xb')][_0xed48('0x33')]=_0x51a53b;var _0x332877=_0x51a53b[0x0];var _0x54299a=_0x332877[_0xed48('0x34')][_0xed48('0x35')]&&_0x332877['queryResult'][_0xed48('0x35')][_0xed48('0x36')]?_0x332877[_0xed48('0x34')][_0xed48('0x35')][_0xed48('0x36')][_0xed48('0x37')][_0xed48('0x38')]:![];_0x14ebe7[_0xed48('0xb')][_0xed48('0x39')]=_0x332877[_0xed48('0x34')][_0xed48('0x3a')];_0x14ebe7['body'][_0xed48('0x3b')]=_0x332877[_0xed48('0x34')][_0xed48('0x3c')];_0x14ebe7[_0xed48('0xb')][_0xed48('0x3d')]=_0x332877['queryResult'][_0xed48('0x35')]&&_0x332877[_0xed48('0x34')][_0xed48('0x35')][_0xed48('0x36')]?_0x332877['queryResult'][_0xed48('0x35')]['fields']['end_conversation'][_0xed48('0x38')]:![];_0x14ebe7[_0xed48('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x332877['queryResult'][_0xed48('0x3e')]['name'];_0x14ebe7['body'][_0xed48('0x3f')]=_0x332877[_0xed48('0x34')][_0xed48('0x3e')][_0xed48('0x40')];_0x14ebe7['body'][_0xed48('0x41')]=_0x332877['queryResult'][_0xed48('0x3e')][_0xed48('0x42')];_0x14ebe7[_0xed48('0xb')][_0xed48('0x43')]=_0x332877[_0xed48('0x34')][_0xed48('0x44')];_0x14ebe7[_0xed48('0xb')][_0xed48('0x45')]=_0x332877['queryResult'][_0xed48('0x46')];_0x14ebe7[_0xed48('0xb')][_0xed48('0x47')]=_0x332877[_0xed48('0x34')][_0xed48('0x48')];_0x1c5e7b['providerName']=_0xed48('0x33');_0x1c5e7b[_0xed48('0x49')]=JSON['stringify'](_0x51a53b);var _0x3d955f=[];for(var _0x4fdb00=0x0;_0x4fdb00<_0x51a53b[_0xed48('0x32')];_0x4fdb00++){var _0x425a32=_0x51a53b[_0x4fdb00];if(_0x425a32&&_0x425a32[_0xed48('0x34')]&&_0x425a32[_0xed48('0x34')]['fulfillmentText']){_0x3d955f['push'](createMessage(_0xf0d446,_0x427981,_0x1c5e7b,_0x425a32[_0xed48('0x34')][_0xed48('0x4a')]));}}return Promise[_0xed48('0x4b')](_0x3d955f)[_0xed48('0xd')](function(){if(_0x54299a){_0x231645[_0xed48('0x16')]();}else{_0x231645['stop']();}})[_0xed48('0x10')](function(_0x2fe71f){logger[_0xed48('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0xf0d446,JSON[_0xed48('0x12')](_0x2fe71f));_0x231645[_0xed48('0x16')]();});}})[_0xed48('0x10')](function(_0x3a27d6){logger[_0xed48('0x11')](_0xed48('0xf'),_0xf0d446,_0x3a27d6[_0xed48('0x30')]);_0x231645[_0xed48('0x16')]();});}}catch(_0xf3291f){logger['error'](_0xed48('0xf'),_0xf0d446,JSON[_0xed48('0x12')](_0xf3291f));_0x231645[_0xed48('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 0c08503..935b5e6 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4305=['info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x5e4605,_0x2ddec7){var _0x25215=function(_0x44a0e3){while(--_0x44a0e3){_0x5e4605['push'](_0x5e4605['shift']());}};_0x25215(++_0x2ddec7);}(_0x4305,0x71));var _0x5430=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0x4305[_0x289874];return _0x2f8bbb;};'use strict';var schema=require(_0x5430('0x0'));var _=require('lodash');var htmlToText=require(_0x5430('0x1'));var utils=require(_0x5430('0x2'));var logger=require(_0x5430('0x3'))(_0x5430('0x4'));var gotoif=schema({'condition':{'type':_0x5430('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x5430('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x5430('0x6'),'message':_0x5430('0x7')}});exports[_0x5430('0x8')]=function(_0xf1be54,_0x58f478){return function(_0x59aa64){try{var _0x59eee8={'condition':htmlToText[_0x5430('0x9')](utils['getMustacheRender'](_0x58f478[0x0],this),{'wordwrap':![]})[_0x5430('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x58f478[0x1],'priorityFalse':_0x58f478[0x2]};var _0xbe2f5=gotoif['validate'](_0x59eee8,{'typecast':!![]});if(_0xbe2f5[_0x5430('0xb')]){logger['error'](_0x5430('0xc'),_0xf1be54,_[_0x5430('0xd')](_0xbe2f5,_0x5430('0xe'))['join'](',\x20'));_0x59aa64[_0x5430('0xf')]();}else{try{var _0x27bef8=eval('('+_0x59eee8[_0x5430('0x10')]+')');var _0x2273d2=_0x27bef8?_0x59eee8['priorityTrue']:_0x59eee8[_0x5430('0x11')];logger['info'](_0x5430('0x12'),_0xf1be54,_0x59eee8[_0x5430('0x10')],_0x27bef8,_0x2273d2||_0x5430('0x13'));if(_0x2273d2){var _0x196814=_[_0x5430('0x14')](_0x59aa64[_0x5430('0x15')](),{'p':_0x2273d2});if(_0x196814>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xf1be54,_0x2273d2||'next',_0x196814);_0x59aa64['next'](_0x196814);}else{logger[_0x5430('0x16')](_0x5430('0x17'),_0xf1be54,_0x2273d2||_0x5430('0x13'));_0x59aa64['stop']();}}else{_0x59aa64['next']();}}catch(_0x190616){logger[_0x5430('0x18')](_0x5430('0x19'),_0xf1be54,_0x190616[_0x5430('0xe')]);_0x59aa64[_0x5430('0xf')]();}}}catch(_0x1d8433){logger[_0x5430('0x18')](_0x5430('0xc'),_0xf1be54,JSON[_0x5430('0x1a')](_0x1d8433));_0x59aa64[_0x5430('0xf')]();}};}; \ No newline at end of file +var _0x9a16=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x9a16,0x185));var _0x69a1=function(_0x4a5482,_0x3ea9b9){_0x4a5482=_0x4a5482-0x0;var _0x2e1bc3=_0x9a16[_0x4a5482];return _0x2e1bc3;};'use strict';var schema=require(_0x69a1('0x0'));var _=require(_0x69a1('0x1'));var htmlToText=require(_0x69a1('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x69a1('0x3'));var gotoif=schema({'condition':{'type':_0x69a1('0x4'),'required':!![],'message':_0x69a1('0x5')},'priorityTrue':{'type':_0x69a1('0x6'),'message':_0x69a1('0x7')},'priorityFalse':{'type':'number','message':_0x69a1('0x8')}});exports[_0x69a1('0x9')]=function(_0x5d4798,_0x4942ab){return function(_0x16d773){try{var _0x3f6fea={'condition':htmlToText[_0x69a1('0xa')](utils[_0x69a1('0xb')](_0x4942ab[0x0],this),{'wordwrap':![]})[_0x69a1('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4942ab[0x1],'priorityFalse':_0x4942ab[0x2]};var _0x3c6f6c=gotoif['validate'](_0x3f6fea,{'typecast':!![]});if(_0x3c6f6c[_0x69a1('0xd')]){logger[_0x69a1('0xe')](_0x69a1('0xf'),_0x5d4798,_['map'](_0x3c6f6c,'message')['join'](',\x20'));_0x16d773[_0x69a1('0x10')]();}else{try{var _0x458325=eval('('+_0x3f6fea[_0x69a1('0x11')]+')');var _0x352113=_0x458325?_0x3f6fea['priorityTrue']:_0x3f6fea[_0x69a1('0x12')];logger[_0x69a1('0x13')](_0x69a1('0x14'),_0x5d4798,_0x3f6fea[_0x69a1('0x11')],_0x458325,_0x352113||_0x69a1('0x15'));if(_0x352113){var _0x220c80=_['findIndex'](_0x16d773[_0x69a1('0x16')](),{'p':_0x352113});if(_0x220c80>=0x0){logger[_0x69a1('0x13')](_0x69a1('0x17'),_0x5d4798,_0x352113||_0x69a1('0x15'),_0x220c80);_0x16d773[_0x69a1('0x15')](_0x220c80);}else{logger[_0x69a1('0x13')](_0x69a1('0x18'),_0x5d4798,_0x352113||_0x69a1('0x15'));_0x16d773[_0x69a1('0x10')]();}}else{_0x16d773[_0x69a1('0x15')]();}}catch(_0x60413){logger[_0x69a1('0xe')](_0x69a1('0x19'),_0x5d4798,_0x60413[_0x69a1('0x1a')]);_0x16d773[_0x69a1('0x10')]();}}}catch(_0x1c930e){logger[_0x69a1('0xe')](_0x69a1('0xf'),_0x5d4798,JSON[_0x69a1('0x1b')](_0x1c930e));_0x16d773['stop']();}};}; \ 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 fd598c2..1a225c2 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 _0x0bb5=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0xc7fafc,_0x56651a){var _0x3e5270=function(_0x2e9c67){while(--_0x2e9c67){_0xc7fafc['push'](_0xc7fafc['shift']());}};_0x3e5270(++_0x56651a);}(_0x0bb5,0x80));var _0x50bb=function(_0x4996fd,_0x35293e){_0x4996fd=_0x4996fd-0x0;var _0x32a129=_0x0bb5[_0x4996fd];return _0x32a129;};'use strict';var schema=require(_0x50bb('0x0'));var _=require(_0x50bb('0x1'));var logger=require('../../../../config/logger')(_0x50bb('0x2'));var gotop=schema({'priority':{'type':_0x50bb('0x3'),'required':!![],'message':_0x50bb('0x4')}});exports['consequence']=function(_0xb6c481,_0x11db8c){return function(_0x1b25fb){try{var _0x42b52c={'priority':_0x11db8c[0x0]};var _0x3f154f=gotop[_0x50bb('0x0')](_0x42b52c,{'typecast':!![]});if(_0x3f154f[_0x50bb('0x5')]){logger[_0x50bb('0x6')](_0x50bb('0x7'),_0xb6c481,_[_0x50bb('0x8')](_0x3f154f,'message')[_0x50bb('0x9')](',\x20'));_0x1b25fb[_0x50bb('0xa')]();}else{logger[_0x50bb('0xb')](_0x50bb('0xc'),_0xb6c481,_0x42b52c[_0x50bb('0xd')]);if(_0x42b52c['priority']){var _0x244046=_[_0x50bb('0xe')](_0x1b25fb['rules'](),{'p':_0x42b52c[_0x50bb('0xd')]});if(_0x244046>=0x0){logger[_0x50bb('0xb')](_0x50bb('0xf'),_0xb6c481,_0x42b52c[_0x50bb('0xd')]||_0x50bb('0x10'),_0x244046);_0x1b25fb[_0x50bb('0x10')](_0x244046);}else{logger[_0x50bb('0xb')](_0x50bb('0x11'),_0xb6c481,_0x42b52c[_0x50bb('0xd')]||_0x50bb('0x10'));_0x1b25fb[_0x50bb('0xa')]();}}else{_0x1b25fb[_0x50bb('0x10')]();}}}catch(_0xc070b0){logger[_0x50bb('0x6')]('[%s][GOTOP]\x20%s',_0xb6c481,JSON['stringify'](_0xc070b0));_0x1b25fb[_0x50bb('0xa')]();}};}; \ No newline at end of file +var _0xaf8e=['info','[%s][GOTOP]\x20priority\x20%s','findIndex','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','stop'];(function(_0xf73ea6,_0x5bc59b){var _0x369c39=function(_0x17a0c1){while(--_0x17a0c1){_0xf73ea6['push'](_0xf73ea6['shift']());}};_0x369c39(++_0x5bc59b);}(_0xaf8e,0xf8));var _0xeaf8=function(_0x4961d3,_0x2e5a63){_0x4961d3=_0x4961d3-0x0;var _0x261685=_0xaf8e[_0x4961d3];return _0x261685;};'use strict';var schema=require(_0xeaf8('0x0'));var _=require('lodash');var logger=require(_0xeaf8('0x1'))(_0xeaf8('0x2'));var gotop=schema({'priority':{'type':_0xeaf8('0x3'),'required':!![],'message':_0xeaf8('0x4')}});exports[_0xeaf8('0x5')]=function(_0x40729f,_0x3cd214){return function(_0x7228a5){try{var _0x283e64={'priority':_0x3cd214[0x0]};var _0x47f0b0=gotop[_0xeaf8('0x0')](_0x283e64,{'typecast':!![]});if(_0x47f0b0[_0xeaf8('0x6')]){logger[_0xeaf8('0x7')]('[%s][GOTOP]\x20%s',_0x40729f,_[_0xeaf8('0x8')](_0x47f0b0,_0xeaf8('0x9'))[_0xeaf8('0xa')](',\x20'));_0x7228a5[_0xeaf8('0xb')]();}else{logger[_0xeaf8('0xc')](_0xeaf8('0xd'),_0x40729f,_0x283e64['priority']);if(_0x283e64['priority']){var _0x29309f=_[_0xeaf8('0xe')](_0x7228a5['rules'](),{'p':_0x283e64[_0xeaf8('0xf')]});if(_0x29309f>=0x0){logger[_0xeaf8('0xc')](_0xeaf8('0x10'),_0x40729f,_0x283e64['priority']||'next',_0x29309f);_0x7228a5[_0xeaf8('0x11')](_0x29309f);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x40729f,_0x283e64[_0xeaf8('0xf')]||'next');_0x7228a5[_0xeaf8('0xb')]();}}else{_0x7228a5[_0xeaf8('0x11')]();}}}catch(_0x269770){logger[_0xeaf8('0x7')](_0xeaf8('0x12'),_0x40729f,JSON[_0xeaf8('0x13')](_0x269770));_0x7228a5[_0xeaf8('0xb')]();}};}; \ 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 f86726b..6b5ec45 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 _0xfe32=['AccountId','account','channel','InteractionId','interaction','Message','create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','upperFirst'];(function(_0x562431,_0x3bd79f){var _0x11d1af=function(_0x162c37){while(--_0x162c37){_0x562431['push'](_0x562431['shift']());}};_0x11d1af(++_0x3bd79f);}(_0xfe32,0xe2));var _0x2fe3=function(_0x4879a0,_0x575e37){_0x4879a0=_0x4879a0-0x0;var _0x25f3d4=_0xfe32[_0x4879a0];return _0x25f3d4;};'use strict';var _=require(_0x2fe3('0x0'));var utils=require('./utils');var logger=require(_0x2fe3('0x1'))(_0x2fe3('0x2'));var rpc={'chatMessage':require(_0x2fe3('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2fe3('0x4')),'smsMessage':require(_0x2fe3('0x5')),'faxMessage':require(_0x2fe3('0x6')),'whatsappMessage':require(_0x2fe3('0x7'))};exports[_0x2fe3('0x8')]=function(_0x2179f0,_0x43ea13){return function(_0x421861){try{var _0x4662d4={'body':utils[_0x2fe3('0x9')](_0x43ea13[0x0],this),'ContactId':this[_0x2fe3('0xa')]['id']};if(this['channel']===_0x2fe3('0xb')){_0x4662d4[_0x2fe3('0xc')]=this['account']['id'];}else{_0x4662d4[_[_0x2fe3('0xd')](this['channel'])+_0x2fe3('0xe')]=this[_0x2fe3('0xf')]['id'];}_0x4662d4[_[_0x2fe3('0xd')](this[_0x2fe3('0x10')])+_0x2fe3('0x11')]=this[_0x2fe3('0x12')]['id'];if(rpc[this['channel']+_0x2fe3('0x13')]){return rpc[this[_0x2fe3('0x10')]+_0x2fe3('0x13')][_0x2fe3('0x14')](_0x4662d4)[_0x2fe3('0x15')](function(_0x278f7e){logger[_0x2fe3('0x16')]('[%s][MESSAGE]\x20%s',_0x2179f0,_0x4662d4[_0x2fe3('0x17')]);_0x421861[_0x2fe3('0x18')]();})[_0x2fe3('0x19')](function(_0x5b9b00){logger[_0x2fe3('0x1a')](_0x2fe3('0x1b'),_0x2179f0,JSON[_0x2fe3('0x1c')](_0x5b9b00));_0x421861[_0x2fe3('0x1d')]();});}}catch(_0xbf426f){logger['error'](_0x2fe3('0x1b'),_0x2179f0,JSON[_0x2fe3('0x1c')](_0xbf426f));_0x421861[_0x2fe3('0x1d')]();}};}; \ No newline at end of file +var _0x6558=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils'];(function(_0x4ff6e4,_0x475790){var _0x5d723d=function(_0x31b204){while(--_0x31b204){_0x4ff6e4['push'](_0x4ff6e4['shift']());}};_0x5d723d(++_0x475790);}(_0x6558,0x153));var _0x8655=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x6558[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x8655('0x0'));var utils=require(_0x8655('0x1'));var logger=require(_0x8655('0x2'))(_0x8655('0x3'));var rpc={'chatMessage':require(_0x8655('0x4')),'openchannelMessage':require(_0x8655('0x5')),'mailMessage':require(_0x8655('0x6')),'smsMessage':require(_0x8655('0x7')),'faxMessage':require(_0x8655('0x8')),'whatsappMessage':require(_0x8655('0x9'))};exports[_0x8655('0xa')]=function(_0x2f93e5,_0x4c8837){return function(_0x26fd46){try{var _0x34f8f9={'body':utils[_0x8655('0xb')](_0x4c8837[0x0],this),'ContactId':this[_0x8655('0xc')]['id']};if(this[_0x8655('0xd')]==='chat'){_0x34f8f9[_0x8655('0xe')]=this[_0x8655('0xf')]['id'];}else{_0x34f8f9[_[_0x8655('0x10')](this['channel'])+_0x8655('0x11')]=this[_0x8655('0xf')]['id'];}_0x34f8f9[_[_0x8655('0x10')](this[_0x8655('0xd')])+_0x8655('0x12')]=this[_0x8655('0x13')]['id'];if(rpc[this[_0x8655('0xd')]+_0x8655('0x14')]){return rpc[this['channel']+'Message'][_0x8655('0x15')](_0x34f8f9)[_0x8655('0x16')](function(_0x1f6e23){logger[_0x8655('0x17')](_0x8655('0x18'),_0x2f93e5,_0x34f8f9[_0x8655('0x19')]);_0x26fd46[_0x8655('0x1a')]();})[_0x8655('0x1b')](function(_0xcc94a1){logger[_0x8655('0x1c')]('[%s][MESSAGE]\x20%s',_0x2f93e5,JSON[_0x8655('0x1d')](_0xcc94a1));_0x26fd46[_0x8655('0x1e')]();});}}catch(_0xb90b4c){logger['error'](_0x8655('0x18'),_0x2f93e5,JSON['stringify'](_0xb90b4c));_0x26fd46[_0x8655('0x1e')]();}};}; \ 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 3a3dd31..7a8052e 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 _0x58a7=['error','stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0x58a7,0xba));var _0x758a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x58a7[_0x59ee6f];return _0x4c0979;};'use strict';var utils=require('./utils');var logger=require(_0x758a('0x0'))('routing');exports[_0x758a('0x1')]=function(_0x8b1790,_0xb9ac2c){return function(_0x4398a6){try{logger[_0x758a('0x2')](_0x758a('0x3'),_0x8b1790,utils[_0x758a('0x4')](_0xb9ac2c[0x0],this));_0x4398a6[_0x758a('0x5')]();}catch(_0x2d7660){logger[_0x758a('0x6')]('[%s][NOOP]\x20%s',_0x8b1790,JSON['stringify'](_0x2d7660));_0x4398a6[_0x758a('0x7')]();}};}; \ No newline at end of file +var _0xdedd=['stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0xb914ad,_0x479d2e){var _0xa22241=function(_0x5236f8){while(--_0x5236f8){_0xb914ad['push'](_0xb914ad['shift']());}};_0xa22241(++_0x479d2e);}(_0xdedd,0x155));var _0xdded=function(_0xf7490,_0x561c3a){_0xf7490=_0xf7490-0x0;var _0x18e166=_0xdedd[_0xf7490];return _0x18e166;};'use strict';var utils=require(_0xdded('0x0'));var logger=require(_0xdded('0x1'))(_0xdded('0x2'));exports[_0xdded('0x3')]=function(_0x13be47,_0x3ee0cb){return function(_0x36688f){try{logger[_0xdded('0x4')](_0xdded('0x5'),_0x13be47,utils[_0xdded('0x6')](_0x3ee0cb[0x0],this));_0x36688f['next']();}catch(_0xd13a5d){logger[_0xdded('0x7')](_0xdded('0x5'),_0x13be47,JSON[_0xdded('0x8')](_0xd13a5d));_0x36688f[_0xdded('0x9')]();}};}; \ 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 eb53f3c..eef98f3 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 _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['stop']();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x4fc0cf,_0x475fb1){var _0x31892d=function(_0x15d722){while(--_0x15d722){_0x4fc0cf['push'](_0x4fc0cf['shift']());}};_0x31892d(++_0x475fb1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ 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 43111e5..1feed5f 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 _0xc72e=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','busyQueue','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents'];(function(_0x140957,_0x20ecc9){var _0x52286a=function(_0x224d2b){while(--_0x224d2b){_0x140957['push'](_0x140957['shift']());}};_0x52286a(++_0x20ecc9);}(_0xc72e,0xed));var _0xec72=function(_0x8d5cf2,_0x373c6d){_0x8d5cf2=_0x8d5cf2-0x0;var _0x3f449d=_0xc72e[_0x8d5cf2];return _0x3f449d;};'use strict';var _=require('lodash');var uuid=require(_0xec72('0x0'));var util=require('./util');var logger=require(_0xec72('0x1'))(_0xec72('0x2'));var Agent=function(_0x3a386c,_0x32a5de,_0x3f5caf,_0x17ce31){this[_0xec72('0x3')]=uuid['v4']();this[_0xec72('0x4')]=_0x3a386c;this[_0xec72('0x5')]=_0x32a5de;this[_0xec72('0x6')]=_0x3f5caf;this[_0xec72('0x2')]=_0x17ce31;this[_0xec72('0x4')][_0xec72('0x7')](this[_0xec72('0x8')][_0xec72('0x9')](this),this[_0xec72('0xa')][_0xec72('0x9')](this));this[_0xec72('0x4')]['on'](_0xec72('0xb'),this[_0xec72('0xa')][_0xec72('0x9')](this));this[_0xec72('0x4')]['on'](_0xec72('0xc'),this[_0xec72('0xd')][_0xec72('0x9')](this));};Agent[_0xec72('0xe')]['push']=function(){this[_0xec72('0x4')]['push'](this[_0xec72('0x8')]['bind'](this),this[_0xec72('0xa')][_0xec72('0x9')](this));};Agent[_0xec72('0xe')][_0xec72('0xd')]=function(){this[_0xec72('0xa')](!![]);};Agent[_0xec72('0xe')]['handleRun']=function(_0x237edf){logger[_0xec72('0xf')](_0xec72('0x10'),this[_0xec72('0x4')]['id'],this['agent']['id']);if(_[_0xec72('0x11')](this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']])){logger[_0xec72('0xf')](_0xec72('0x13'),this[_0xec72('0x4')]['id'],this[_0xec72('0x5')]['id']);setTimeout(this[_0xec72('0x7')][_0xec72('0x9')](this),0x3e8);}else{if(this['routing'][_0xec72('0x14')]||util[_0xec72('0x15')](this['squeue']['id'],this['realtime'][_0xec72('0x12')][this[_0xec72('0x5')]['id']],this['squeue'][_0xec72('0x16')],![])){this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']]['busy']=!![];this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']]['busyQueue']=undefined;util[_0xec72('0x17')](this[_0xec72('0x3')],this[_0xec72('0x4')]['id'],this[_0xec72('0x6')]['agents'][this[_0xec72('0x5')]['id']],null,this[_0xec72('0x2')]);util['writeLog'](this[_0xec72('0x4')]['id'],this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']],_0xec72('0x18')+(this['routing']['forcedOwnership']?_0xec72('0x19'):''));}else{logger[_0xec72('0xf')](_0xec72('0x1a'),this['squeue']['id'],this[_0xec72('0x5')]['id']);setTimeout(this[_0xec72('0x7')]['bind'](this),0x3e8);}}};Agent[_0xec72('0xe')][_0xec72('0xa')]=function(_0x5dc10b){if(_[_0xec72('0x11')](this['realtime'][_0xec72('0x12')][this[_0xec72('0x5')]['id']])){return logger[_0xec72('0xf')](_0xec72('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xec72('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xec72('0x4')]['id'],this[_0xec72('0x5')]['id']);util[_0xec72('0x1b')](this['notificationId'],this[_0xec72('0x4')]['id'],this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']],null,this[_0xec72('0x2')]);this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']][_0xec72('0x1c')]=![];this[_0xec72('0x6')][_0xec72('0x12')][this[_0xec72('0x5')]['id']][_0xec72('0x1d')]=undefined;util['writeLog'](this[_0xec72('0x4')]['id'],this[_0xec72('0x6')]['agents'][this[_0xec72('0x5')]['id']],_0x5dc10b?'STOP':_0xec72('0x1e'));}if(!_0x5dc10b){setTimeout(this[_0xec72('0x7')][_0xec72('0x9')](this),0x3e8);}};function agent(_0x568704,_0x30d1b5,_0x37c9fb,_0x5758e0){return new Agent(_0x568704,_0x30d1b5,_0x37c9fb,_0x5758e0);}module[_0xec72('0x1f')]=agent; \ No newline at end of file +var _0xc3b1=['[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info'];(function(_0xf1545b,_0x28dfbc){var _0x331993=function(_0x1f9a3c){while(--_0x1f9a3c){_0xf1545b['push'](_0xf1545b['shift']());}};_0x331993(++_0x28dfbc);}(_0xc3b1,0xc9));var _0x1c3b=function(_0x45d99d,_0x4630cb){_0x45d99d=_0x45d99d-0x0;var _0x3cff80=_0xc3b1[_0x45d99d];return _0x3cff80;};'use strict';var _=require(_0x1c3b('0x0'));var uuid=require('uuid');var util=require(_0x1c3b('0x1'));var logger=require(_0x1c3b('0x2'))(_0x1c3b('0x3'));var Agent=function(_0x2554c9,_0x1ac0ad,_0xb5e42f,_0x40f1fd){this[_0x1c3b('0x4')]=uuid['v4']();this[_0x1c3b('0x5')]=_0x2554c9;this[_0x1c3b('0x6')]=_0x1ac0ad;this[_0x1c3b('0x7')]=_0xb5e42f;this[_0x1c3b('0x3')]=_0x40f1fd;this[_0x1c3b('0x5')][_0x1c3b('0x8')](this[_0x1c3b('0x9')][_0x1c3b('0xa')](this),this[_0x1c3b('0xb')][_0x1c3b('0xa')](this));this[_0x1c3b('0x5')]['on']('timeout',this[_0x1c3b('0xb')]['bind'](this));this['squeue']['on'](_0x1c3b('0xc'),this[_0x1c3b('0xd')][_0x1c3b('0xa')](this));};Agent[_0x1c3b('0xe')][_0x1c3b('0x8')]=function(){this[_0x1c3b('0x5')][_0x1c3b('0x8')](this[_0x1c3b('0x9')][_0x1c3b('0xa')](this),this[_0x1c3b('0xb')][_0x1c3b('0xa')](this));};Agent[_0x1c3b('0xe')][_0x1c3b('0xd')]=function(){this[_0x1c3b('0xb')](!![]);};Agent['prototype'][_0x1c3b('0x9')]=function(_0x512319){logger[_0x1c3b('0xf')](_0x1c3b('0x10'),this[_0x1c3b('0x5')]['id'],this[_0x1c3b('0x6')]['id']);if(_[_0x1c3b('0x11')](this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']])){logger[_0x1c3b('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1c3b('0x5')]['id'],this[_0x1c3b('0x6')]['id']);setTimeout(this[_0x1c3b('0x8')][_0x1c3b('0xa')](this),0x3e8);}else{if(this[_0x1c3b('0x3')][_0x1c3b('0x13')]||util[_0x1c3b('0x14')](this[_0x1c3b('0x5')]['id'],this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']],this[_0x1c3b('0x5')][_0x1c3b('0x15')],![])){this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']][_0x1c3b('0x16')]=!![];this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']][_0x1c3b('0x17')]=undefined;util[_0x1c3b('0x18')](this[_0x1c3b('0x4')],this['squeue']['id'],this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']],null,this[_0x1c3b('0x3')]);util[_0x1c3b('0x19')](this['squeue']['id'],this['realtime'][_0x1c3b('0x12')][this['agent']['id']],_0x1c3b('0x1a')+(this[_0x1c3b('0x3')]['forcedOwnership']?':FORCED':''));}else{logger[_0x1c3b('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1c3b('0xa')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x65277d){if(_[_0x1c3b('0x11')](this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']])){return logger[_0x1c3b('0xf')](_0x1c3b('0x1b'),this['squeue']['id'],this[_0x1c3b('0x6')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x1c3b('0x5')]['id'],this[_0x1c3b('0x6')]['id']);util['hideNotification'](this[_0x1c3b('0x4')],this[_0x1c3b('0x5')]['id'],this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']],null,this[_0x1c3b('0x3')]);this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']][_0x1c3b('0x16')]=![];this['realtime'][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']][_0x1c3b('0x17')]=undefined;util['writeLog'](this[_0x1c3b('0x5')]['id'],this[_0x1c3b('0x7')][_0x1c3b('0x12')][this[_0x1c3b('0x6')]['id']],_0x65277d?_0x1c3b('0x1c'):_0x1c3b('0x1d'));}if(!_0x65277d){setTimeout(this[_0x1c3b('0x8')]['bind'](this),0x3e8);}};function agent(_0x2b48cd,_0xd0b72a,_0xe6491d,_0x2938a9){return new Agent(_0x2b48cd,_0xd0b72a,_0xe6491d,_0x2938a9);}module[_0x1c3b('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index af3075a..423259d 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 _0x5d4d=['busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','RINGING','busy'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5d4d,0x1cf));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d4('0x0'));var uuid=require(_0xd5d4('0x1'));var util=require(_0xd5d4('0x2'));var logger=require(_0xd5d4('0x3'))(_0xd5d4('0x4'));var Beepall=function(_0x78d467,_0x261be0,_0x28be0e,_0xa48c8b){this[_0xd5d4('0x5')]=uuid['v4']();this[_0xd5d4('0x6')]=_0x78d467;this[_0xd5d4('0x7')]=_0x261be0;this['realtime']=_0x28be0e;this[_0xd5d4('0x4')]=_0xa48c8b;this[_0xd5d4('0x6')][_0xd5d4('0x8')](this[_0xd5d4('0x9')][_0xd5d4('0xa')](this),this['handleTimeout'][_0xd5d4('0xa')](this));this[_0xd5d4('0x6')]['on'](_0xd5d4('0xb'),this[_0xd5d4('0xc')]['bind'](this));this['squeue']['on'](_0xd5d4('0xd'),this[_0xd5d4('0xe')][_0xd5d4('0xa')](this));};Beepall['prototype'][_0xd5d4('0x8')]=function(){this['squeue'][_0xd5d4('0x8')](this[_0xd5d4('0x9')][_0xd5d4('0xa')](this),this[_0xd5d4('0xc')][_0xd5d4('0xa')](this));};Beepall['prototype']['handleDrained']=function(_0x3b653e){this[_0xd5d4('0xc')](!![]);};Beepall[_0xd5d4('0xf')][_0xd5d4('0x9')]=function(_0x2b63f9){var _0x3d2b94=!![];if(!_[_0xd5d4('0x10')](this[_0xd5d4('0x7')])&&!_[_0xd5d4('0x10')](this['queue'][_0xd5d4('0x11')])&&this[_0xd5d4('0x7')][_0xd5d4('0x11')][_0xd5d4('0x12')]>0x0){for(var _0x3e980e=0x0,_0x3b8da0;_0x3e980e0x0){for(var _0x5a9ee4=0x0,_0x57c5df;_0x5a9ee40x0&&_0x43d5d7[_0x573450+_0x6db0('0x23')]>=_0x43d5d7[_0x573450+_0x6db0('0x22')]){writeLog(_0x489839,_0x43d5d7,_0x573450['toUpperCase']()+_0x6db0('0x24'));return![];}}return!![];};exports[_0x6db0('0x25')]=function(_0x18a791,_0x1d28bc,_0x4e2023,_0x256da8,_0x327470){return sendNotification(!![],_0x18a791,_0x1d28bc,_0x4e2023,_0x256da8,_0x327470);};exports['hideNotification']=function(_0x403ec3,_0x22eb49,_0x391a46,_0x2a10fa,_0x4d9225){return sendNotification(![],_0x403ec3,_0x22eb49,_0x391a46,_0x2a10fa,_0x4d9225);};exports[_0x6db0('0x26')]=writeLog; \ No newline at end of file +var _0x9010=['../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','emit','format','user:%s','name','user:save','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util'];(function(_0x1e2925,_0x5412f9){var _0x3efcd3=function(_0x15c2d9){while(--_0x15c2d9){_0x1e2925['push'](_0x1e2925['shift']());}};_0x3efcd3(++_0x5412f9);}(_0x9010,0xdf));var _0x0901=function(_0x460a8f,_0x12e2bb){_0x460a8f=_0x460a8f-0x0;var _0x4a5247=_0x9010[_0x460a8f];return _0x4a5247;};'use strict';var _=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var utils=require(_0x0901('0x2'));var Mustache=require(_0x0901('0x3'));var Redis=require(_0x0901('0x4'));var config=require(_0x0901('0x5'));var logger=require(_0x0901('0x6'))(_0x0901('0x7'));config[_0x0901('0x8')]=_[_0x0901('0x9')](config[_0x0901('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0901('0xa'))(new Redis(config[_0x0901('0x8')]));function emit(_0x203675,_0x3c8e45,_0x3d07ea){io['to'](_0x203675)[_0x0901('0xb')](_0x3c8e45,_0x3d07ea);}function sendNotification(_0x5196b0,_0x41e6b8,_0x5c5ecf,_0x2156ae,_0x54069b,_0x164ab5){io['to'](util[_0x0901('0xc')](_0x0901('0xd'),_0x2156ae[_0x0901('0xe')]))[_0x0901('0xb')](_0x0901('0xf'),_0x2156ae);var _0x4b9333=_0x164ab5||{};var _0x52521d=_0x5c5ecf['split']('.');var _0x4542c7={'uniqueid':_0x41e6b8,'channel':_0x52521d[0x0],'id':_0x52521d[0x1],'title':_0x52521d[0x0]+'\x20interaction','interactionId':_0x52521d[0x2],'queue':_0x54069b?_0x54069b['name']:null,'sound':_0x4b9333[_0x0901('0x10')][_0x0901('0x11')],'shake':_0x4b9333[_0x0901('0x10')][_0x0901('0x12')]};try{if(!_0x4b9333[_0x0901('0x13')]){_0x4b9333[_0x0901('0x13')]={};}if(_0x54069b){_0x4b9333[_0x0901('0x13')][_0x0901('0x14')]=_0x54069b;}else if(_0x4b9333['body'][_0x0901('0x14')]){delete _0x4b9333[_0x0901('0x13')]['queue'];}_0x4542c7[_0x0901('0x15')]=utils[_0x0901('0x16')](_0x4b9333[_0x0901('0x10')][_0x0901('0x17')],_0x4b9333);}catch(_0x1733c3){_0x4542c7[_0x0901('0x15')]=_0x0901('0x18');logger[_0x0901('0x19')](util[_0x0901('0xc')](_0x0901('0x1a'),_0x41e6b8,_0x1733c3['message']));}io['to'](util[_0x0901('0xc')]('user:%s',_0x2156ae[_0x0901('0xe')]))[_0x0901('0xb')](util[_0x0901('0xc')](_0x0901('0x1b'),_0x5196b0?_0x0901('0x1c'):_0x0901('0x1d')),_0x4542c7);}function writeLog(_0x23d27a,_0x4427e9,_0x2125a8){return logger[_0x0901('0x1e')](util[_0x0901('0xc')](_0x0901('0x1f'),_0x23d27a,_0x4427e9[_0x0901('0xe')],_0x2125a8));}exports[_0x0901('0x20')]=function(_0x12b98d,_0x34ba32,_0x1a4eed,_0x8407a6){if(_0x34ba32['busy']){writeLog(_0x12b98d,_0x34ba32,_0x0901('0x21'));return![];}if(!_0x34ba32[_0x0901('0x22')]){writeLog(_0x12b98d,_0x34ba32,_0x0901('0x23'));return![];}if(_0x34ba32[_0x1a4eed+_0x0901('0x24')]){writeLog(_0x12b98d,_0x34ba32,_0x0901('0x25'));return![];}if(_0x8407a6&&_0x34ba32['hasOwnProperty'](_0x1a4eed+'Capacity')&&_0x34ba32[_0x0901('0x26')](_0x1a4eed+_0x0901('0x27'))){if(_0x34ba32[_0x1a4eed+_0x0901('0x28')]>0x0&&_0x34ba32[_0x1a4eed+'CurrentCapacity']>=_0x34ba32[_0x1a4eed+_0x0901('0x28')]){writeLog(_0x12b98d,_0x34ba32,_0x1a4eed[_0x0901('0x29')]()+_0x0901('0x2a'));return![];}}return!![];};exports[_0x0901('0x2b')]=function(_0x43203c,_0x5e54ca,_0xbf7548,_0x5dfe5d,_0xecc951){return sendNotification(!![],_0x43203c,_0x5e54ca,_0xbf7548,_0x5dfe5d,_0xecc951);};exports['hideNotification']=function(_0x13165c,_0x5012bb,_0x2455f4,_0x3f6e3d,_0x388f4a){return sendNotification(![],_0x13165c,_0x5012bb,_0x2455f4,_0x3f6e3d,_0x388f4a);};exports[_0x0901('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 192a85a..d3f06ac 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 _0x8082=['lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs'];(function(_0x2a1ec5,_0x5df62f){var _0x190696=function(_0x2c776b){while(--_0x2c776b){_0x2a1ec5['push'](_0x2a1ec5['shift']());}};_0x190696(++_0x5df62f);}(_0x8082,0x1a2));var _0x2808=function(_0xcf2eb0,_0x54eb04){_0xcf2eb0=_0xcf2eb0-0x0;var _0x82ba02=_0x8082[_0xcf2eb0];return _0x82ba02;};'use strict';var schema=require(_0x2808('0x0'));var sh=require(_0x2808('0x1'));var _=require(_0x2808('0x2'));var utils=require('./utils');var logger=require(_0x2808('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x2808('0x4')}});exports[_0x2808('0x5')]=function(_0xd3d983,_0x26b151){return function(_0xd869cb){try{var _0x4e23e4={'command':_0x26b151[0x0]};var _0xaee6cb=system['validate'](_0x4e23e4,{'typecast':!![]});if(_0xaee6cb['length']){logger['error'](_0x2808('0x6'),_0xd3d983,_[_0x2808('0x7')](_0xaee6cb,_0x2808('0x8'))['join'](',\x20'));logger[_0x2808('0x9')](_0x2808('0xa'),_0xd3d983);_0xd869cb[_0x2808('0xb')]();}else{var _0x46c035=this;var _0x40e4fa=utils[_0x2808('0xc')](_0x26b151[0x0],this);logger[_0x2808('0x9')](_0x2808('0xd'),_0xd3d983,_0x40e4fa);sh[_0x2808('0xe')](_['trim'](_0x40e4fa),function(_0x113fc6,_0x5b8afa){logger[_0x2808('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xd3d983,_0x113fc6);if(_0x113fc6==0x0){var _0x12e72f=_0x5b8afa[_0x2808('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x26b151[0x1])||_[_0x2808('0x10')](_0x26b151[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0xd3d983);_0x46c035[_0x2808('0x11')][_0x26b151[0x1]]=_0x12e72f;}else{logger[_0x2808('0x9')](_0x2808('0x12'),_0xd3d983,_0x26b151[0x1],_0x12e72f);_0x46c035[_0x2808('0x11')][_0x26b151[0x1]]=_0x12e72f;}}_0xd869cb[_0x2808('0xb')]();});}}catch(_0x44e8b0){logger['error'](_0x2808('0x6'),_0xd3d983,_[_0x2808('0x13')](_0x44e8b0)?JSON[_0x2808('0x14')](_0x44e8b0):_0x44e8b0);logger[_0x2808('0x9')](_0x2808('0xa'),_0xd3d983);_0xd869cb[_0x2808('0xb')]();}};}; \ No newline at end of file +var _0x71a6=['join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','message'];(function(_0x524bc6,_0x5cb778){var _0x18f651=function(_0x3ab3d5){while(--_0x3ab3d5){_0x524bc6['push'](_0x524bc6['shift']());}};_0x18f651(++_0x5cb778);}(_0x71a6,0x1a4));var _0x671a=function(_0x651909,_0x15c6b4){_0x651909=_0x651909-0x0;var _0x572299=_0x71a6[_0x651909];return _0x572299;};'use strict';var schema=require('validate');var sh=require(_0x671a('0x0'));var _=require(_0x671a('0x1'));var utils=require(_0x671a('0x2'));var logger=require(_0x671a('0x3'))(_0x671a('0x4'));var system=schema({'command':{'type':_0x671a('0x5'),'required':!![],'message':_0x671a('0x6')}});exports[_0x671a('0x7')]=function(_0x407345,_0x48b986){return function(_0x4ddb8e){try{var _0x145e0a={'command':_0x48b986[0x0]};var _0x4950f5=system[_0x671a('0x8')](_0x145e0a,{'typecast':!![]});if(_0x4950f5['length']){logger[_0x671a('0x9')](_0x671a('0xa'),_0x407345,_['map'](_0x4950f5,_0x671a('0xb'))[_0x671a('0xc')](',\x20'));logger[_0x671a('0xd')](_0x671a('0xe'),_0x407345);_0x4ddb8e[_0x671a('0xf')]();}else{var _0x5344aa=this;var _0x3b1e79=utils['getMustacheRender'](_0x48b986[0x0],this);logger[_0x671a('0xd')](_0x671a('0x10'),_0x407345,_0x3b1e79);sh[_0x671a('0x11')](_[_0x671a('0x12')](_0x3b1e79),function(_0x1c80e8,_0x5d9c1f){logger['info'](_0x671a('0x13'),_0x407345,_0x1c80e8);if(_0x1c80e8==0x0){var _0x216533=_0x5d9c1f[_0x671a('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x671a('0x15')](_0x48b986[0x1])||_[_0x671a('0x16')](_0x48b986[0x1])){logger[_0x671a('0xd')](_0x671a('0x17'),_0x407345);_0x5344aa[_0x671a('0x18')][_0x48b986[0x1]]=_0x216533;}else{logger[_0x671a('0xd')](_0x671a('0x19'),_0x407345,_0x48b986[0x1],_0x216533);_0x5344aa[_0x671a('0x18')][_0x48b986[0x1]]=_0x216533;}}_0x4ddb8e[_0x671a('0xf')]();});}}catch(_0x4c84c7){logger[_0x671a('0x9')](_0x671a('0xa'),_0x407345,_[_0x671a('0x1a')](_0x4c84c7)?JSON['stringify'](_0x4c84c7):_0x4c84c7);logger[_0x671a('0xd')](_0x671a('0xe'),_0x407345);_0x4ddb8e['next']();}};}; \ 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 03f1f7e..71752ee 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 _0x86ce=['../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x3904b7,_0x3eb9ff){var _0x2478f4=function(_0x3f785f){while(--_0x3f785f){_0x3904b7['push'](_0x3904b7['shift']());}};_0x2478f4(++_0x3eb9ff);}(_0x86ce,0x1ce));var _0xe86c=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x86ce[_0x7cb10c];return _0x11df59;};'use strict';var schema=require(_0xe86c('0x0'));var _=require(_0xe86c('0x1'));var rpc={'chatInteraction':require(_0xe86c('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xe86c('0x3')),'mailInteraction':require(_0xe86c('0x4')),'faxInteraction':require(_0xe86c('0x5')),'whatsappInteraction':require(_0xe86c('0x6'))};var logger=require('../../../../config/logger')(_0xe86c('0x7'));var tag=schema({'tag':{'type':_0xe86c('0x8'),'required':!![],'message':_0xe86c('0x9')}});exports['consequence']=function(_0xf9d078,_0x376b54,_0x5a3816,_0x14796b){return function(_0xf1421c){try{var _0xb732e8={'tag':_0x376b54[0x0]};var _0x4b2aeb=tag[_0xe86c('0x0')](_0xb732e8,{'typecast':!![]});if(_0x4b2aeb[_0xe86c('0xa')]){logger[_0xe86c('0xb')]('[%s][TAG]\x20%s',_0xf9d078,_[_0xe86c('0xc')](_0x4b2aeb,_0xe86c('0xd'))[_0xe86c('0xe')](',\x20'));logger[_0xe86c('0xf')](_0xe86c('0x10'),_0xf9d078);_0xf1421c[_0xe86c('0x11')]();}else{var _0x534723={'ids':[_0x376b54[0x0]]};if(rpc[_0x14796b[_0xe86c('0x12')]+_0xe86c('0x13')]){rpc[_0x14796b[_0xe86c('0x12')]+_0xe86c('0x13')]['addTags'](_0x14796b['interaction']['id'],_0x534723)[_0xe86c('0x14')](function(_0x387dcd){logger['info'](_0xe86c('0x15'),_0xf9d078,_0x376b54[0x1],_0x14796b[_0xe86c('0x12')],_0x14796b['interaction']['id']);})[_0xe86c('0x16')](function(_0x13a2d6){logger[_0xe86c('0xb')](_0xe86c('0x17'),_0xf9d078,JSON[_0xe86c('0x18')](_0x13a2d6));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xf9d078);})[_0xe86c('0x19')](function(){_0xf1421c[_0xe86c('0x11')]();});}}}catch(_0x2f673a){logger[_0xe86c('0xb')]('[%s][TAG]\x20%s',_0xf9d078,_['isObject'](_0x2f673a)?JSON['stringify'](_0x2f673a):_0x2f673a);logger['info'](_0xe86c('0x10'),_0xf9d078);_0xf1421c[_0xe86c('0x11')]();}};}; \ No newline at end of file +var _0x8930=['../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','error','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x1950e1,_0x4c8cbd){var _0xe47e1b=function(_0x59e60c){while(--_0x59e60c){_0x1950e1['push'](_0x1950e1['shift']());}};_0xe47e1b(++_0x4c8cbd);}(_0x8930,0x182));var _0x0893=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8930[_0x40a045];return _0x1a687c;};'use strict';var schema=require(_0x0893('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x0893('0x1')),'openchannelInteraction':require(_0x0893('0x2')),'smsInteraction':require(_0x0893('0x3')),'mailInteraction':require(_0x0893('0x4')),'faxInteraction':require(_0x0893('0x5')),'whatsappInteraction':require(_0x0893('0x6'))};var logger=require('../../../../config/logger')(_0x0893('0x7'));var tag=schema({'tag':{'type':_0x0893('0x8'),'required':!![],'message':_0x0893('0x9')}});exports[_0x0893('0xa')]=function(_0x3dfb1a,_0x226abd,_0x56a28c,_0x53933f){return function(_0x4954bc){try{var _0x5c2e86={'tag':_0x226abd[0x0]};var _0x2a98da=tag[_0x0893('0x0')](_0x5c2e86,{'typecast':!![]});if(_0x2a98da[_0x0893('0xb')]){logger['error'](_0x0893('0xc'),_0x3dfb1a,_['map'](_0x2a98da,_0x0893('0xd'))[_0x0893('0xe')](',\x20'));logger['info'](_0x0893('0xf'),_0x3dfb1a);_0x4954bc[_0x0893('0x10')]();}else{var _0x1a1839={'ids':[_0x226abd[0x0]]};if(rpc[_0x53933f['channel']+_0x0893('0x11')]){rpc[_0x53933f[_0x0893('0x12')]+'Interaction'][_0x0893('0x13')](_0x53933f['interaction']['id'],_0x1a1839)[_0x0893('0x14')](function(_0x47ac94){logger[_0x0893('0x15')](_0x0893('0x16'),_0x3dfb1a,_0x226abd[0x1],_0x53933f[_0x0893('0x12')],_0x53933f[_0x0893('0x17')]['id']);})[_0x0893('0x18')](function(_0x411b2e){logger[_0x0893('0x19')](_0x0893('0xc'),_0x3dfb1a,JSON['stringify'](_0x411b2e));logger[_0x0893('0x15')](_0x0893('0xf'),_0x3dfb1a);})[_0x0893('0x1a')](function(){_0x4954bc[_0x0893('0x10')]();});}}}catch(_0x1b7530){logger[_0x0893('0x19')]('[%s][TAG]\x20%s',_0x3dfb1a,_[_0x0893('0x1b')](_0x1b7530)?JSON['stringify'](_0x1b7530):_0x1b7530);logger[_0x0893('0x15')](_0x0893('0xf'),_0x3dfb1a);_0x4954bc[_0x0893('0x10')]();}};}; \ 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 ce249e5..9ca4bd8 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 _0xd6d6=['mustache','lodash','exports','render','merge','body','contact','message','account','interaction'];(function(_0x4534af,_0x1c8390){var _0x2dc7f9=function(_0x505375){while(--_0x505375){_0x4534af['push'](_0x4534af['shift']());}};_0x2dc7f9(++_0x1c8390);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x34be96,_0x5dbc64){_0x34be96=_0x34be96-0x0;var _0x17b4e8=_0xd6d6[_0x34be96];return _0x17b4e8;};'use strict';var Mustache=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));module[_0x6d6d('0x2')]={'getMustacheRender':function(_0x33226e,_0x536523){return Mustache[_0x6d6d('0x3')](_0x33226e,_[_0x6d6d('0x4')](_0x536523[_0x6d6d('0x5')],{'contact':_0x536523[_0x6d6d('0x6')],'message':_0x536523[_0x6d6d('0x7')],'account':_0x536523[_0x6d6d('0x8')],'interaction':_0x536523[_0x6d6d('0x9')],'list':_0x536523['list']}))||'';}}; \ No newline at end of file +var _0x8bdf=['mustache','lodash','exports','merge','body','contact','message','account','interaction'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8bdf[_0x5ddb1c];return _0x354adc;};'use strict';var Mustache=require(_0xf8bd('0x0'));var _=require(_0xf8bd('0x1'));module[_0xf8bd('0x2')]={'getMustacheRender':function(_0x46b662,_0x336d9f){return Mustache['render'](_0x46b662,_[_0xf8bd('0x3')](_0x336d9f[_0xf8bd('0x4')],{'contact':_0x336d9f[_0xf8bd('0x5')],'message':_0x336d9f[_0xf8bd('0x6')],'account':_0x336d9f[_0xf8bd('0x7')],'interaction':_0x336d9f[_0xf8bd('0x8')],'list':_0x336d9f['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7ae6b8a..20476f4 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 _0x5636=['slice','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','channel','interaction','emit','end','QueueReport','update','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','name','waiting','mailQueues','loggedIn','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','message','applications','length','existsSync','join','app','.js','toLowerCase','appdata','mail','push'];(function(_0x2cfa03,_0x45b41b){var _0x291f8c=function(_0x407b53){while(--_0x407b53){_0x2cfa03['push'](_0x2cfa03['shift']());}};_0x291f8c(++_0x45b41b);}(_0x5636,0x102));var _0x6563=function(_0x4a64f0,_0x3640a3){_0x4a64f0=_0x4a64f0-0x0;var _0x2ba017=_0x5636[_0x4a64f0];return _0x2ba017;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x6563('0x2'));var config=require(_0x6563('0x3'));var logger=require(_0x6563('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0x6563('0x5')),'mailQueueReport':require(_0x6563('0x6')),'chatQueueReport':require(_0x6563('0x7')),'smsQueueReport':require(_0x6563('0x8')),'faxQueueReport':require(_0x6563('0x9')),'whatsappQueueReport':require(_0x6563('0xa'))};var RuleEngine=require(_0x6563('0xb'));function getId(_0x2d57d5,_0x2d0d5b,_0x98fcd4){return util[_0x6563('0xc')](_0x6563('0xd'),_0x2d57d5,_0x2d0d5b||0x0,_0x98fcd4||0x0);}function getIntervals(_0x3ccb4e,_0x516d1a){var _0x51fdc2=[];if(!_[_0x6563('0xe')](_0x516d1a[_0x6563('0xf')])&&!_['isNil'](_0x3ccb4e[_0x516d1a['IntervalId']])&&!_['isNil'](_0x3ccb4e[_0x516d1a[_0x6563('0xf')]][_0x6563('0x10')])){_0x51fdc2=_[_0x6563('0x11')](_0x3ccb4e[_0x516d1a[_0x6563('0xf')]][_0x6563('0x10')],_0x6563('0x12'));}else if(!_[_0x6563('0xe')](_0x516d1a[_0x6563('0x12')])){_0x51fdc2=[_0x516d1a[_0x6563('0x12')]];}return _0x51fdc2;}exports['listen']=function(_0xa0a0b6){_0xa0a0b6['rules']={};return new BPromise(function(_0x37131e,_0x59bee1){var _0x33f8e4={'Start':function(_0x10d08c){var _0x5af5d0=this;return new Promise(function(_0x26f26e,_0x11baa2){if(_0x10d08c){try{var _0x477d9b=[];var _0xd398ce=getId(_0x10d08c['channel'],_0x10d08c[_0x6563('0x13')]?_0x10d08c['message']['id']:0x0,_0x10d08c['interaction']?_0x10d08c['interaction']['id']:0x0);if(_0x10d08c[_0x6563('0x14')]&&_['isArray'](_0x10d08c['applications'])&&_0x10d08c[_0x6563('0x14')][_0x6563('0x15')]){for(var _0x17a29f=0x0;_0x17a29f<_0x10d08c[_0x6563('0x14')][_0x6563('0x15')];_0x17a29f+=0x1){var _0x10811d=_0x10d08c[_0x6563('0x14')][_0x17a29f];if(fs[_0x6563('0x16')](path[_0x6563('0x17')](__dirname,'applications',_0x10811d[_0x6563('0x18')]+_0x6563('0x19')))){var _0x20b478=[];switch(_0x10811d['app'][_0x6563('0x1a')]()){case'autoreply':var _0x5953c5=_0x10811d[_0x6563('0x1b')]['split'](',');if(_0x10d08c['channel']===_0x6563('0x1c')){_0x20b478['push'](_0x5953c5[0x0]);_0x20b478[_0x6563('0x1d')](_0x5953c5[0x1]);_0x20b478[_0x6563('0x1d')](_0x5953c5[_0x6563('0x1e')](0x2,_0x5953c5['length'])[_0x6563('0x17')](','));}else{_0x20b478['push'](_0x5953c5[0x0]);_0x20b478[_0x6563('0x1d')](_0x5953c5[_0x6563('0x1e')](0x1,_0x5953c5['length'])[_0x6563('0x17')](','));}break;case _0x6563('0x1f'):var _0x49a824=_0x10811d[_0x6563('0x1b')]['split'](',');_0x20b478[_0x6563('0x1d')](_0x49a824[0x0]);_0x20b478['push'](_0x49a824[0x1]);_0x20b478['push'](_0x49a824[_0x6563('0x1e')](0x2,_0x49a824[_0x6563('0x15')])[_0x6563('0x17')](','));break;case _0x6563('0x20'):var _0x3eb23b=_0x10811d['appdata'][_0x6563('0x21')](',');_0x20b478['push'](_0x3eb23b[0x0]);_0x20b478['push'](_0x3eb23b[0x1]);_0x20b478[_0x6563('0x1d')](_0x3eb23b[0x2]);_0x20b478[_0x6563('0x1d')](_0x3eb23b[0x3]);_0x20b478[_0x6563('0x1d')](_0x3eb23b[_0x6563('0x1e')](0x4,_0x3eb23b[_0x6563('0x15')])[_0x6563('0x17')](','));break;case _0x6563('0x22'):var _0x334874=_0x10811d[_0x6563('0x1b')][_0x6563('0x21')](',');_0x20b478['push'](_0x334874[0x0]);_0x20b478[_0x6563('0x1d')](_0x334874[0x1]);_0x20b478[_0x6563('0x1d')](_0x334874[0x2]);_0x20b478[_0x6563('0x1d')](_0x334874[0x3]);_0x20b478[_0x6563('0x1d')](_0x334874[_0x6563('0x1e')](0x4,_0x334874[_0x6563('0x15')])[_0x6563('0x17')](','));break;case'message':_0x20b478[_0x6563('0x1d')](_0x10811d[_0x6563('0x1b')]);break;case _0x6563('0x23'):_0x20b478[_0x6563('0x1d')](_0x10811d[_0x6563('0x24')]);_0x20b478[_0x6563('0x1d')](_0x10811d['appdata']);break;default:_0x20b478=_[_0x6563('0xe')](_0x10811d[_0x6563('0x1b')])?[]:_0x10811d[_0x6563('0x1b')][_0x6563('0x21')](',');}var _0x2c03ac={'id':util[_0x6563('0xc')](_0x6563('0x25'),_0xd398ce,_0x10811d['id'],_0x10811d['app']),'condition':require(_0x6563('0x26'))[_0x6563('0x27')](_0xd398ce,getIntervals(_0xa0a0b6['intervals'],_0x10811d),_0xa0a0b6),'consequence':require(_0x6563('0x28')+_0x10811d[_0x6563('0x18')])['consequence'](_0xd398ce,_0x20b478,_0xa0a0b6,_0x10d08c),'p':_0x10811d['priority']||0x0};logger[_0x6563('0x29')](_0x6563('0x2a'),_0x2c03ac['id'],_0x6563('0x2b'),getIntervals(_0xa0a0b6[_0x6563('0x2c')],_0x10811d)['join'](_0x6563('0x2d')));_0x477d9b[_0x6563('0x1d')](_0x2c03ac);}else{logger['error'](_0x6563('0x2e'),path[_0x6563('0x17')](__dirname,_0x6563('0x14'),_0x10811d[_0x6563('0x18')]+_0x6563('0x19')));}}_0xa0a0b6[_0x6563('0x2f')][_0xd398ce]=new RuleEngine(_0x477d9b);_0xa0a0b6[_0x6563('0x2f')][_0xd398ce][_0x6563('0x30')](_0x10d08c,function(_0x2e4177){logger['info'](_0x6563('0x31'),JSON[_0x6563('0x32')](_0x2e4177[_0x6563('0x33')]));if(_0xa0a0b6[_0x6563('0x2f')][_0xd398ce]){_0xa0a0b6['rules'][_0xd398ce]['emit'](_0x6563('0x34'));}});return _0x26f26e({'code':0xc8,'message':_0x10d08c});}else{logger[_0x6563('0x29')](_0x6563('0x35'));return _0x26f26e({'code':0xc8,'message':_0x10d08c});}}catch(_0x5db29d){logger[_0x6563('0x36')](_0x5db29d['stack']);return _0x11baa2(_0x5af5d0[_0x6563('0x36')](0x1f4,_0x5db29d));}}return _0x11baa2(_0x6563('0x37'));});},'AcceptMessage':function(_0x57c1bf){var _0x13d9d9=this;return new Promise(function(_0x3625b7,_0xea186){if(_0x57c1bf[_0x6563('0x38')]&&_0x57c1bf[_0x6563('0x38')]['id']){if(_0xa0a0b6[_0x6563('0x39')][_0x57c1bf[_0x6563('0x38')]['id']]){_0xa0a0b6[_0x6563('0x39')][_0x57c1bf[_0x6563('0x38')]['id']][_0x6563('0x3a')]=![];_0xa0a0b6[_0x6563('0x39')][_0x57c1bf['agent']['id']]['busyQueue']=undefined;}}if(_0x57c1bf[_0x6563('0x13')]&&_0x57c1bf[_0x6563('0x13')]['id']){try{var _0x43a33e=getId(_0x57c1bf[_0x6563('0x3b')],_0x57c1bf[_0x6563('0x13')]?_0x57c1bf[_0x6563('0x13')]['id']:0x0,_0x57c1bf[_0x6563('0x3c')]?_0x57c1bf['interaction']['id']:0x0);if(_0xa0a0b6[_0x6563('0x2f')][_0x43a33e]){_0xa0a0b6[_0x6563('0x2f')][_0x43a33e][_0x6563('0x3d')](_0x6563('0x3e'));if(rpc[_0x57c1bf['channel']+_0x6563('0x3f')]){rpc[_0x57c1bf[_0x6563('0x3b')]+_0x6563('0x3f')][_0x6563('0x40')](_0x43a33e,{'UserId':_0x57c1bf[_0x6563('0x13')]['UserId']})['catch'](function(_0x1504ca){logger[_0x6563('0x36')](_0x6563('0x41'));});}}return _0x3625b7({'code':0xc8,'message':_0x57c1bf});}catch(_0x5b0d2c){logger[_0x6563('0x36')](_0x5b0d2c[_0x6563('0x42')]);return _0xea186(_0x13d9d9[_0x6563('0x36')](0x1f4,_0x5b0d2c));}}logger[_0x6563('0x36')]('message\x20is\x20empty');return _0xea186(_0x13d9d9[_0x6563('0x36')](0x1f4,_0x6563('0x43')));});},'RejectMessage':function(_0xd54477){var _0x55e927=this;return new Promise(function(_0x35b0ce,_0x4bcfff){if(_0xd54477[_0x6563('0x38')]&&_0xd54477['agent']['id']){try{if(_0xa0a0b6['agents'][_0xd54477[_0x6563('0x38')]['id']]){_0xa0a0b6[_0x6563('0x39')][_0xd54477[_0x6563('0x38')]['id']][_0x6563('0x3a')]=![];_0xa0a0b6[_0x6563('0x39')][_0xd54477[_0x6563('0x38')]['id']][_0x6563('0x44')]=undefined;}return _0x35b0ce({'code':0xc8,'message':_0xd54477});}catch(_0x16da30){logger[_0x6563('0x36')](_0x16da30[_0x6563('0x42')]);return _0x4bcfff(_0x55e927['error'](0x1f4,_0x16da30));}}logger[_0x6563('0x36')]('message\x20is\x20empty');return _0x4bcfff(_0x55e927[_0x6563('0x36')](0x1f4,_0x6563('0x43')));});},'AbandonInteraction':function(_0x19062a){var _0x528b26=this;return new Promise(function(_0x2a8ed1,_0x141f0c){if(_0x19062a['channel']&&_0x19062a[_0x6563('0x3c')]&&_0x19062a[_0x6563('0x3c')]['id']){try{var _0x1c90b1=getId(_0x19062a[_0x6563('0x3b')],_0x19062a[_0x6563('0x13')]?_0x19062a['message']['id']:0x0,_0x19062a[_0x6563('0x3c')]?_0x19062a['interaction']['id']:0x0);if(_0xa0a0b6[_0x6563('0x2f')][_0x1c90b1]){_0xa0a0b6['rules'][_0x1c90b1][_0x6563('0x3d')]('end');}return _0x2a8ed1({'code':0xc8,'message':_0x19062a});}catch(_0x55e002){logger['error'](_0x55e002['stack']);return _0x141f0c(_0x528b26[_0x6563('0x36')](0x1f4,_0x55e002));}}logger['error'](_0x6563('0x43'));return _0x141f0c(_0x528b26['error'](0x1f4,_0x6563('0x43')));});},'AgentCapacity':function(_0x10a127){var _0x426664=this;return new Promise(function(_0x32ebac,_0x39cf33){if(_0xa0a0b6[_0x6563('0x39')][_0x6563('0x45')](_0x10a127['id'])){for(var _0xdc94f8 in _0x10a127[_0x6563('0x46')]){if(_0x10a127['capacity'][_0x6563('0x45')](_0xdc94f8)){if(_0xa0a0b6[_0x6563('0x39')][_0x10a127['id']][_0x6563('0x45')](_0xdc94f8+_0x6563('0x47'))){_0xa0a0b6[_0x6563('0x39')][_0x10a127['id']][_0xdc94f8+_0x6563('0x47')]=parseInt(_0x10a127[_0x6563('0x46')][_0xdc94f8],0xa);}}}_0xa0a0b6[_0x6563('0x39')][_0x10a127['id']][_0x6563('0x48')]();return _0x32ebac({'code':0xc8,'message':_0xa0a0b6[_0x6563('0x39')][_0x10a127['id']]});}else{return _0x39cf33(_0x426664[_0x6563('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1a3317){return new Promise(function(_0x1a6adb,_0x23f38d){var _0x2e9c69=_[_0x6563('0x49')](_0xa0a0b6[_0x6563('0x39')]);_0x1a6adb({'count':_0x2e9c69[_0x6563('0x15')],'rows':_0x2e9c69});});},'ChatQueues':function(_0x4268b2){return new Promise(function(_0x53292e,_0xbfb2a6){var _0x4f51d2=[];for(var _0x1f597f in _0xa0a0b6[_0x6563('0x4a')]){if(_0xa0a0b6['chatQueues']['hasOwnProperty'](_0x1f597f)){var _0x3374b0=_0xa0a0b6[_0x6563('0x4a')][_0x1f597f];var _0x41940b={'id':_0x3374b0['id'],'available':_0x3374b0[_0x6563('0x4b')],'loggedIn':_0x3374b0['loggedIn'],'name':_0x3374b0[_0x6563('0x4c')],'paused':_0x3374b0['paused'],'waiting':_0x3374b0[_0x6563('0x4d')]};_0x4f51d2[_0x6563('0x1d')](_0x41940b);}}_0x53292e({'count':_0x4f51d2['length'],'rows':_0x4f51d2});});},'MailQueues':function(_0x5ca0d5){return new Promise(function(_0x3a3a35,_0x5bae4c){var _0x4f1f02=[];for(var _0x1fa23f in _0xa0a0b6['mailQueues']){if(_0xa0a0b6[_0x6563('0x4e')][_0x6563('0x45')](_0x1fa23f)){var _0x1de316=_0xa0a0b6[_0x6563('0x4e')][_0x1fa23f];var _0x4829ab={'id':_0x1de316['id'],'available':_0x1de316[_0x6563('0x4b')],'loggedIn':_0x1de316[_0x6563('0x4f')],'name':_0x1de316[_0x6563('0x4c')],'paused':_0x1de316[_0x6563('0x50')],'waiting':_0x1de316[_0x6563('0x4d')]};_0x4f1f02[_0x6563('0x1d')](_0x4829ab);}}_0x3a3a35({'count':_0x4f1f02[_0x6563('0x15')],'rows':_0x4f1f02});});},'OpenchannelQueues':function(_0x7d8546){return new Promise(function(_0x58728d,_0x4b182c){var _0x2c855f=[];for(var _0x3a756a in _0xa0a0b6['openchannelQueues']){if(_0xa0a0b6['openchannelQueues']['hasOwnProperty'](_0x3a756a)){var _0x4607d0=_0xa0a0b6[_0x6563('0x51')][_0x3a756a];var _0x463df4={'id':_0x4607d0['id'],'available':_0x4607d0[_0x6563('0x4b')],'loggedIn':_0x4607d0['loggedIn'],'name':_0x4607d0[_0x6563('0x4c')],'paused':_0x4607d0[_0x6563('0x50')],'waiting':_0x4607d0[_0x6563('0x4d')]};_0x2c855f[_0x6563('0x1d')](_0x463df4);}}_0x58728d({'count':_0x2c855f[_0x6563('0x15')],'rows':_0x2c855f});});},'SmsQueues':function(_0x4e4e6d){return new Promise(function(_0x4fd7fc,_0x25e2e6){var _0x1d7b5d=[];for(var _0x2426cd in _0xa0a0b6['smsQueues']){if(_0xa0a0b6[_0x6563('0x52')]['hasOwnProperty'](_0x2426cd)){var _0x311036=_0xa0a0b6[_0x6563('0x52')][_0x2426cd];var _0x417b8e={'id':_0x311036['id'],'available':_0x311036[_0x6563('0x4b')],'loggedIn':_0x311036[_0x6563('0x4f')],'name':_0x311036[_0x6563('0x4c')],'paused':_0x311036[_0x6563('0x50')],'waiting':_0x311036['waiting']};_0x1d7b5d['push'](_0x417b8e);}}_0x4fd7fc({'count':_0x1d7b5d[_0x6563('0x15')],'rows':_0x1d7b5d});});},'FaxQueues':function(_0x1228b3){return new Promise(function(_0x2327fe,_0x2daeb2){var _0x961a12=[];for(var _0x422c9a in _0xa0a0b6['faxQueues']){if(_0xa0a0b6['faxQueues']['hasOwnProperty'](_0x422c9a)){var _0x20560f=_0xa0a0b6[_0x6563('0x53')][_0x422c9a];var _0x2a222e={'id':_0x20560f['id'],'available':_0x20560f[_0x6563('0x4b')],'loggedIn':_0x20560f[_0x6563('0x4f')],'name':_0x20560f['name'],'paused':_0x20560f[_0x6563('0x50')],'waiting':_0x20560f[_0x6563('0x4d')]};_0x961a12[_0x6563('0x1d')](_0x2a222e);}}_0x2327fe({'count':_0x961a12[_0x6563('0x15')],'rows':_0x961a12});});},'WhatsappQueues':function(_0x5898b6){return new Promise(function(_0x1c3633,_0xd0ec42){var _0x3e4687=[];for(var _0x3d5186 in _0xa0a0b6[_0x6563('0x54')]){if(_0xa0a0b6[_0x6563('0x54')][_0x6563('0x45')](_0x3d5186)){var _0x937aae=_0xa0a0b6[_0x6563('0x54')][_0x3d5186];var _0x1e08a8={'id':_0x937aae['id'],'available':_0x937aae[_0x6563('0x4b')],'loggedIn':_0x937aae[_0x6563('0x4f')],'name':_0x937aae[_0x6563('0x4c')],'paused':_0x937aae[_0x6563('0x50')],'waiting':_0x937aae[_0x6563('0x4d')]};_0x3e4687['push'](_0x1e08a8);}}_0x1c3633({'count':_0x3e4687[_0x6563('0x15')],'rows':_0x3e4687});});},'ChatQueuesWaitingInteractions':function(_0x3594f7){return new Promise(function(_0x3a36f3,_0x2b8fbc){var _0x2b4801=_[_0x6563('0x49')](_0xa0a0b6[_0x6563('0x55')]);_0x3a36f3({'count':_0x2b4801[_0x6563('0x15')],'rows':_0x2b4801});});},'MailQueuesWaitingInteractions':function(_0x1e4f72){return new Promise(function(_0x18d34d,_0x5d01b7){var _0x1fd976=_[_0x6563('0x49')](_0xa0a0b6[_0x6563('0x56')]);_0x18d34d({'count':_0x1fd976[_0x6563('0x15')],'rows':_0x1fd976});});},'OpenchannelQueuesWaitingInteractions':function(_0x2a3851){return new Promise(function(_0xf37913,_0x30fd2f){var _0x489c26=_[_0x6563('0x49')](_0xa0a0b6[_0x6563('0x57')]);_0xf37913({'count':_0x489c26[_0x6563('0x15')],'rows':_0x489c26});});},'SmsQueuesWaitingInteractions':function(_0x3aaf22){return new Promise(function(_0x1a053e,_0x241e73){var _0x49335e=_[_0x6563('0x49')](_0xa0a0b6[_0x6563('0x58')]);_0x1a053e({'count':_0x49335e[_0x6563('0x15')],'rows':_0x49335e});});},'FaxQueuesWaitingInteractions':function(_0x4ff0fa){return new Promise(function(_0x38267c,_0x4acc5e){var _0x9018ac=_['values'](_0xa0a0b6['faxQueuesWaitingInteractions']);_0x38267c({'count':_0x9018ac['length'],'rows':_0x9018ac});});},'WhatsappQueuesWaitingInteractions':function(_0x2712b4){return new Promise(function(_0x144f9d,_0x2397e5){var _0x18e325=_['values'](_0xa0a0b6[_0x6563('0x59')]);_0x144f9d({'count':_0x18e325[_0x6563('0x15')],'rows':_0x18e325});});}};var _0x50e7b4=jayson['server'](_0x33f8e4)[_0x6563('0x5a')]();_0x50e7b4['on'](_0x6563('0x36'),function(_0x180a02){logger[_0x6563('0x36')](JSON['stringify'](_0x180a02));return _0x59bee1(_0x180a02);});_0x50e7b4[_0x6563('0x5b')](0x232c,_0x6563('0x5c'),function(){console[_0x6563('0x5d')](_0x6563('0x5e'),0x232c);return _0x37131e(_0x6563('0x5f')+0x232c);});});}; \ No newline at end of file +var _0xc874=['interaction','applications','length','existsSync','join','app','.js','toLowerCase','appdata','channel','mail','push','slice','split','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','intervals','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','message'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xc874,0x154));var _0x4c87=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xc874[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var fs=require('fs');var jayson=require(_0x4c87('0x2'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require(_0x4c87('0x3'));var logger=require(_0x4c87('0x4'))(_0x4c87('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x4c87('0x6')),'chatQueueReport':require(_0x4c87('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x4c87('0x8')),'whatsappQueueReport':require(_0x4c87('0x9'))};var RuleEngine=require(_0x4c87('0xa'));function getId(_0xdc4a29,_0x116649,_0x5b7720){return util[_0x4c87('0xb')]('%s.%s.%s',_0xdc4a29,_0x116649||0x0,_0x5b7720||0x0);}function getIntervals(_0x384268,_0x42f471){var _0x30e64f=[];if(!_[_0x4c87('0xc')](_0x42f471[_0x4c87('0xd')])&&!_['isNil'](_0x384268[_0x42f471[_0x4c87('0xd')]])&&!_[_0x4c87('0xc')](_0x384268[_0x42f471['IntervalId']][_0x4c87('0xe')])){_0x30e64f=_[_0x4c87('0xf')](_0x384268[_0x42f471[_0x4c87('0xd')]][_0x4c87('0xe')],_0x4c87('0x10'));}else if(!_['isNil'](_0x42f471['interval'])){_0x30e64f=[_0x42f471['interval']];}return _0x30e64f;}exports[_0x4c87('0x11')]=function(_0x355e94){_0x355e94[_0x4c87('0x12')]={};return new BPromise(function(_0x3f1cc5,_0x292ce9){var _0x453274={'Start':function(_0x45e476){var _0x21712e=this;return new Promise(function(_0x532a63,_0x27abb9){if(_0x45e476){try{var _0x3c32cc=[];var _0x585705=getId(_0x45e476['channel'],_0x45e476[_0x4c87('0x13')]?_0x45e476[_0x4c87('0x13')]['id']:0x0,_0x45e476[_0x4c87('0x14')]?_0x45e476['interaction']['id']:0x0);if(_0x45e476[_0x4c87('0x15')]&&_['isArray'](_0x45e476[_0x4c87('0x15')])&&_0x45e476[_0x4c87('0x15')][_0x4c87('0x16')]){for(var _0x22f775=0x0;_0x22f775<_0x45e476['applications'][_0x4c87('0x16')];_0x22f775+=0x1){var _0x219612=_0x45e476[_0x4c87('0x15')][_0x22f775];if(fs[_0x4c87('0x17')](path[_0x4c87('0x18')](__dirname,_0x4c87('0x15'),_0x219612[_0x4c87('0x19')]+_0x4c87('0x1a')))){var _0x50289b=[];switch(_0x219612[_0x4c87('0x19')][_0x4c87('0x1b')]()){case'autoreply':var _0x3ff588=_0x219612[_0x4c87('0x1c')]['split'](',');if(_0x45e476[_0x4c87('0x1d')]===_0x4c87('0x1e')){_0x50289b[_0x4c87('0x1f')](_0x3ff588[0x0]);_0x50289b[_0x4c87('0x1f')](_0x3ff588[0x1]);_0x50289b['push'](_0x3ff588[_0x4c87('0x20')](0x2,_0x3ff588[_0x4c87('0x16')])[_0x4c87('0x18')](','));}else{_0x50289b[_0x4c87('0x1f')](_0x3ff588[0x0]);_0x50289b[_0x4c87('0x1f')](_0x3ff588[_0x4c87('0x20')](0x1,_0x3ff588[_0x4c87('0x16')])[_0x4c87('0x18')](','));}break;case'dialogflow':var _0x4ecad3=_0x219612['appdata'][_0x4c87('0x21')](',');_0x50289b[_0x4c87('0x1f')](_0x4ecad3[0x0]);_0x50289b[_0x4c87('0x1f')](_0x4ecad3[0x1]);_0x50289b[_0x4c87('0x1f')](_0x4ecad3[_0x4c87('0x20')](0x2,_0x4ecad3[_0x4c87('0x16')])['join'](','));break;case _0x4c87('0x22'):var _0x23483e=_0x219612[_0x4c87('0x1c')][_0x4c87('0x21')](',');_0x50289b[_0x4c87('0x1f')](_0x23483e[0x0]);_0x50289b[_0x4c87('0x1f')](_0x23483e[0x1]);_0x50289b[_0x4c87('0x1f')](_0x23483e[0x2]);_0x50289b[_0x4c87('0x1f')](_0x23483e[0x3]);_0x50289b[_0x4c87('0x1f')](_0x23483e[_0x4c87('0x20')](0x4,_0x23483e[_0x4c87('0x16')])[_0x4c87('0x18')](','));break;case _0x4c87('0x23'):var _0xf636e5=_0x219612[_0x4c87('0x1c')][_0x4c87('0x21')](',');_0x50289b['push'](_0xf636e5[0x0]);_0x50289b[_0x4c87('0x1f')](_0xf636e5[0x1]);_0x50289b['push'](_0xf636e5[0x2]);_0x50289b[_0x4c87('0x1f')](_0xf636e5[0x3]);_0x50289b['push'](_0xf636e5[_0x4c87('0x20')](0x4,_0xf636e5[_0x4c87('0x16')])[_0x4c87('0x18')](','));break;case _0x4c87('0x13'):_0x50289b['push'](_0x219612[_0x4c87('0x1c')]);break;case _0x4c87('0x24'):_0x50289b[_0x4c87('0x1f')](_0x219612[_0x4c87('0x25')]);_0x50289b['push'](_0x219612[_0x4c87('0x1c')]);break;default:_0x50289b=_[_0x4c87('0xc')](_0x219612[_0x4c87('0x1c')])?[]:_0x219612[_0x4c87('0x1c')]['split'](',');}var _0x3d4f4a={'id':util[_0x4c87('0xb')](_0x4c87('0x26'),_0x585705,_0x219612['id'],_0x219612[_0x4c87('0x19')]),'condition':require('./interval')['condition'](_0x585705,getIntervals(_0x355e94[_0x4c87('0x27')],_0x219612),_0x355e94),'consequence':require('./applications/'+_0x219612[_0x4c87('0x19')])[_0x4c87('0x28')](_0x585705,_0x50289b,_0x355e94,_0x45e476),'p':_0x219612[_0x4c87('0x29')]||0x0};logger[_0x4c87('0x2a')](_0x4c87('0x2b'),_0x3d4f4a['id'],'on\x20interval',getIntervals(_0x355e94[_0x4c87('0x27')],_0x219612)[_0x4c87('0x18')](_0x4c87('0x2c')));_0x3c32cc['push'](_0x3d4f4a);}else{logger['error'](_0x4c87('0x2d'),path[_0x4c87('0x18')](__dirname,_0x4c87('0x15'),_0x219612['app']+_0x4c87('0x1a')));}}_0x355e94['rules'][_0x585705]=new RuleEngine(_0x3c32cc);_0x355e94['rules'][_0x585705]['execute'](_0x45e476,function(_0xfb5651){logger[_0x4c87('0x2a')](_0x4c87('0x2e'),JSON['stringify'](_0xfb5651[_0x4c87('0x2f')]));if(_0x355e94[_0x4c87('0x12')][_0x585705]){_0x355e94['rules'][_0x585705][_0x4c87('0x30')]('complete');}});return _0x532a63({'code':0xc8,'message':_0x45e476});}else{logger['info'](_0x4c87('0x31'));return _0x532a63({'code':0xc8,'message':_0x45e476});}}catch(_0x57a9b8){logger[_0x4c87('0x32')](_0x57a9b8[_0x4c87('0x33')]);return _0x27abb9(_0x21712e['error'](0x1f4,_0x57a9b8));}}return _0x27abb9(_0x4c87('0x34'));});},'AcceptMessage':function(_0x32790f){var _0x48cfe6=this;return new Promise(function(_0x3d4983,_0x5a70b7){if(_0x32790f['agent']&&_0x32790f[_0x4c87('0x35')]['id']){if(_0x355e94['agents'][_0x32790f['agent']['id']]){_0x355e94[_0x4c87('0x36')][_0x32790f[_0x4c87('0x35')]['id']]['busy']=![];_0x355e94[_0x4c87('0x36')][_0x32790f[_0x4c87('0x35')]['id']][_0x4c87('0x37')]=undefined;}}if(_0x32790f[_0x4c87('0x13')]&&_0x32790f['message']['id']){try{var _0x44e6c7=getId(_0x32790f[_0x4c87('0x1d')],_0x32790f[_0x4c87('0x13')]?_0x32790f[_0x4c87('0x13')]['id']:0x0,_0x32790f['interaction']?_0x32790f[_0x4c87('0x14')]['id']:0x0);if(_0x355e94[_0x4c87('0x12')][_0x44e6c7]){_0x355e94[_0x4c87('0x12')][_0x44e6c7]['emit'](_0x4c87('0x38'));if(rpc[_0x32790f[_0x4c87('0x1d')]+_0x4c87('0x39')]){rpc[_0x32790f[_0x4c87('0x1d')]+'QueueReport'][_0x4c87('0x3a')](_0x44e6c7,{'UserId':_0x32790f[_0x4c87('0x13')][_0x4c87('0x3b')]})['catch'](function(_0x507686){logger[_0x4c87('0x32')](_0x4c87('0x3c'));});}}return _0x3d4983({'code':0xc8,'message':_0x32790f});}catch(_0x1696ad){logger[_0x4c87('0x32')](_0x1696ad['stack']);return _0x5a70b7(_0x48cfe6['error'](0x1f4,_0x1696ad));}}logger[_0x4c87('0x32')](_0x4c87('0x3d'));return _0x5a70b7(_0x48cfe6[_0x4c87('0x32')](0x1f4,_0x4c87('0x3d')));});},'RejectMessage':function(_0x2c7eef){var _0x3c0104=this;return new Promise(function(_0x281a22,_0x290761){if(_0x2c7eef[_0x4c87('0x35')]&&_0x2c7eef[_0x4c87('0x35')]['id']){try{if(_0x355e94['agents'][_0x2c7eef[_0x4c87('0x35')]['id']]){_0x355e94[_0x4c87('0x36')][_0x2c7eef[_0x4c87('0x35')]['id']][_0x4c87('0x3e')]=![];_0x355e94['agents'][_0x2c7eef[_0x4c87('0x35')]['id']][_0x4c87('0x37')]=undefined;}return _0x281a22({'code':0xc8,'message':_0x2c7eef});}catch(_0x27d82e){logger['error'](_0x27d82e[_0x4c87('0x33')]);return _0x290761(_0x3c0104[_0x4c87('0x32')](0x1f4,_0x27d82e));}}logger[_0x4c87('0x32')]('message\x20is\x20empty');return _0x290761(_0x3c0104[_0x4c87('0x32')](0x1f4,_0x4c87('0x3d')));});},'AbandonInteraction':function(_0x1f10be){var _0x5e68a6=this;return new Promise(function(_0x5a7786,_0x578b39){if(_0x1f10be['channel']&&_0x1f10be['interaction']&&_0x1f10be[_0x4c87('0x14')]['id']){try{var _0x67dce1=getId(_0x1f10be['channel'],_0x1f10be['message']?_0x1f10be[_0x4c87('0x13')]['id']:0x0,_0x1f10be[_0x4c87('0x14')]?_0x1f10be[_0x4c87('0x14')]['id']:0x0);if(_0x355e94[_0x4c87('0x12')][_0x67dce1]){_0x355e94[_0x4c87('0x12')][_0x67dce1][_0x4c87('0x30')](_0x4c87('0x38'));}return _0x5a7786({'code':0xc8,'message':_0x1f10be});}catch(_0x2d3486){logger['error'](_0x2d3486['stack']);return _0x578b39(_0x5e68a6[_0x4c87('0x32')](0x1f4,_0x2d3486));}}logger[_0x4c87('0x32')](_0x4c87('0x3d'));return _0x578b39(_0x5e68a6[_0x4c87('0x32')](0x1f4,_0x4c87('0x3d')));});},'AgentCapacity':function(_0x2eef57){var _0x348354=this;return new Promise(function(_0x1cec70,_0x1b13e3){if(_0x355e94[_0x4c87('0x36')]['hasOwnProperty'](_0x2eef57['id'])){for(var _0x57f1c9 in _0x2eef57[_0x4c87('0x3f')]){if(_0x2eef57['capacity'][_0x4c87('0x40')](_0x57f1c9)){if(_0x355e94[_0x4c87('0x36')][_0x2eef57['id']][_0x4c87('0x40')](_0x57f1c9+'CurrentCapacity')){_0x355e94[_0x4c87('0x36')][_0x2eef57['id']][_0x57f1c9+_0x4c87('0x41')]=parseInt(_0x2eef57[_0x4c87('0x3f')][_0x57f1c9],0xa);}}}_0x355e94[_0x4c87('0x36')][_0x2eef57['id']][_0x4c87('0x42')]();return _0x1cec70({'code':0xc8,'message':_0x355e94[_0x4c87('0x36')][_0x2eef57['id']]});}else{return _0x1b13e3(_0x348354[_0x4c87('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x53595b){return new Promise(function(_0x244066,_0x2fb4a){var _0x253e8b=_[_0x4c87('0x43')](_0x355e94[_0x4c87('0x36')]);_0x244066({'count':_0x253e8b[_0x4c87('0x16')],'rows':_0x253e8b});});},'ChatQueues':function(_0x24ac5e){return new Promise(function(_0x1f7b9b,_0xccc4dd){var _0x133d03=[];for(var _0x3a1c10 in _0x355e94[_0x4c87('0x44')]){if(_0x355e94[_0x4c87('0x44')]['hasOwnProperty'](_0x3a1c10)){var _0x37b319=_0x355e94[_0x4c87('0x44')][_0x3a1c10];var _0x114dac={'id':_0x37b319['id'],'available':_0x37b319[_0x4c87('0x45')],'loggedIn':_0x37b319[_0x4c87('0x46')],'name':_0x37b319[_0x4c87('0x47')],'paused':_0x37b319[_0x4c87('0x48')],'waiting':_0x37b319['waiting']};_0x133d03['push'](_0x114dac);}}_0x1f7b9b({'count':_0x133d03[_0x4c87('0x16')],'rows':_0x133d03});});},'MailQueues':function(_0x57a526){return new Promise(function(_0x53e6ba,_0x5122f8){var _0x19f4d3=[];for(var _0x43a2b4 in _0x355e94[_0x4c87('0x49')]){if(_0x355e94[_0x4c87('0x49')][_0x4c87('0x40')](_0x43a2b4)){var _0x546143=_0x355e94['mailQueues'][_0x43a2b4];var _0x3173f2={'id':_0x546143['id'],'available':_0x546143['available'],'loggedIn':_0x546143['loggedIn'],'name':_0x546143['name'],'paused':_0x546143[_0x4c87('0x48')],'waiting':_0x546143[_0x4c87('0x4a')]};_0x19f4d3[_0x4c87('0x1f')](_0x3173f2);}}_0x53e6ba({'count':_0x19f4d3[_0x4c87('0x16')],'rows':_0x19f4d3});});},'OpenchannelQueues':function(_0x44a2c7){return new Promise(function(_0x4ed555,_0x51aaa9){var _0x8b4bac=[];for(var _0x4371a1 in _0x355e94[_0x4c87('0x4b')]){if(_0x355e94[_0x4c87('0x4b')]['hasOwnProperty'](_0x4371a1)){var _0x4d2697=_0x355e94[_0x4c87('0x4b')][_0x4371a1];var _0x4b5ec7={'id':_0x4d2697['id'],'available':_0x4d2697[_0x4c87('0x45')],'loggedIn':_0x4d2697[_0x4c87('0x46')],'name':_0x4d2697['name'],'paused':_0x4d2697[_0x4c87('0x48')],'waiting':_0x4d2697['waiting']};_0x8b4bac[_0x4c87('0x1f')](_0x4b5ec7);}}_0x4ed555({'count':_0x8b4bac[_0x4c87('0x16')],'rows':_0x8b4bac});});},'SmsQueues':function(_0x55200d){return new Promise(function(_0xd09637,_0x4fa9ff){var _0x44a493=[];for(var _0xd7f5fb in _0x355e94[_0x4c87('0x4c')]){if(_0x355e94[_0x4c87('0x4c')][_0x4c87('0x40')](_0xd7f5fb)){var _0x3e7237=_0x355e94['smsQueues'][_0xd7f5fb];var _0x49650b={'id':_0x3e7237['id'],'available':_0x3e7237[_0x4c87('0x45')],'loggedIn':_0x3e7237[_0x4c87('0x46')],'name':_0x3e7237[_0x4c87('0x47')],'paused':_0x3e7237['paused'],'waiting':_0x3e7237[_0x4c87('0x4a')]};_0x44a493[_0x4c87('0x1f')](_0x49650b);}}_0xd09637({'count':_0x44a493[_0x4c87('0x16')],'rows':_0x44a493});});},'FaxQueues':function(_0x47feb1){return new Promise(function(_0x2d3212,_0x153f25){var _0x1dcd1f=[];for(var _0x103dd6 in _0x355e94[_0x4c87('0x4d')]){if(_0x355e94[_0x4c87('0x4d')][_0x4c87('0x40')](_0x103dd6)){var _0x3db9a4=_0x355e94[_0x4c87('0x4d')][_0x103dd6];var _0x25724e={'id':_0x3db9a4['id'],'available':_0x3db9a4['available'],'loggedIn':_0x3db9a4['loggedIn'],'name':_0x3db9a4[_0x4c87('0x47')],'paused':_0x3db9a4[_0x4c87('0x48')],'waiting':_0x3db9a4[_0x4c87('0x4a')]};_0x1dcd1f['push'](_0x25724e);}}_0x2d3212({'count':_0x1dcd1f[_0x4c87('0x16')],'rows':_0x1dcd1f});});},'WhatsappQueues':function(_0x41364e){return new Promise(function(_0x4dce47,_0x20ffa3){var _0x5a220c=[];for(var _0x10fc16 in _0x355e94[_0x4c87('0x4e')]){if(_0x355e94[_0x4c87('0x4e')][_0x4c87('0x40')](_0x10fc16)){var _0xda0e64=_0x355e94[_0x4c87('0x4e')][_0x10fc16];var _0x4d1ec0={'id':_0xda0e64['id'],'available':_0xda0e64[_0x4c87('0x45')],'loggedIn':_0xda0e64['loggedIn'],'name':_0xda0e64[_0x4c87('0x47')],'paused':_0xda0e64[_0x4c87('0x48')],'waiting':_0xda0e64[_0x4c87('0x4a')]};_0x5a220c[_0x4c87('0x1f')](_0x4d1ec0);}}_0x4dce47({'count':_0x5a220c[_0x4c87('0x16')],'rows':_0x5a220c});});},'ChatQueuesWaitingInteractions':function(_0x1c7aec){return new Promise(function(_0x4e5c3b,_0x456531){var _0x5a7d63=_[_0x4c87('0x43')](_0x355e94[_0x4c87('0x4f')]);_0x4e5c3b({'count':_0x5a7d63[_0x4c87('0x16')],'rows':_0x5a7d63});});},'MailQueuesWaitingInteractions':function(_0x1f26ca){return new Promise(function(_0x48d463,_0x513173){var _0x3f3388=_[_0x4c87('0x43')](_0x355e94[_0x4c87('0x50')]);_0x48d463({'count':_0x3f3388['length'],'rows':_0x3f3388});});},'OpenchannelQueuesWaitingInteractions':function(_0x2722ba){return new Promise(function(_0x2ac851,_0x17f89a){var _0x4a9ba3=_[_0x4c87('0x43')](_0x355e94[_0x4c87('0x51')]);_0x2ac851({'count':_0x4a9ba3[_0x4c87('0x16')],'rows':_0x4a9ba3});});},'SmsQueuesWaitingInteractions':function(_0x569346){return new Promise(function(_0x28f16e,_0x2df5fb){var _0x10279d=_[_0x4c87('0x43')](_0x355e94['smsQueuesWaitingInteractions']);_0x28f16e({'count':_0x10279d['length'],'rows':_0x10279d});});},'FaxQueuesWaitingInteractions':function(_0x384028){return new Promise(function(_0x37388e,_0x46118c){var _0x1a3914=_[_0x4c87('0x43')](_0x355e94[_0x4c87('0x52')]);_0x37388e({'count':_0x1a3914['length'],'rows':_0x1a3914});});},'WhatsappQueuesWaitingInteractions':function(_0x1a09ca){return new Promise(function(_0x10766e,_0x167587){var _0x49ffc2=_[_0x4c87('0x43')](_0x355e94[_0x4c87('0x53')]);_0x10766e({'count':_0x49ffc2[_0x4c87('0x16')],'rows':_0x49ffc2});});}};var _0x3f5c09=jayson[_0x4c87('0x54')](_0x453274)[_0x4c87('0x55')]();_0x3f5c09['on'](_0x4c87('0x32'),function(_0x364ab0){logger[_0x4c87('0x32')](JSON[_0x4c87('0x56')](_0x364ab0));return _0x292ce9(_0x364ab0);});_0x3f5c09[_0x4c87('0x11')](0x232c,_0x4c87('0x57'),function(){console[_0x4c87('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3f1cc5(_0x4c87('0x59')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 24524fe..7b88849 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 _0x956c=['routing','client','request','then','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','format','iftime\x20%s','indexOf','info','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','join','util','jayson/promise','lodash','../../../config/logger'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x956c,0x1f4));var _0xc956=function(_0x234ca1,_0x50d56b){_0x234ca1=_0x234ca1-0x0;var _0x265176=_0x956c[_0x234ca1];return _0x265176;};'use strict';var util=require(_0xc956('0x0'));var BPromise=require('bluebird');var jayson=require(_0xc956('0x1'));var _=require(_0xc956('0x2'));var logger=require(_0xc956('0x3'))(_0xc956('0x4'));var client=jayson[_0xc956('0x5')]['http']({'port':0x232a});function request(_0x3aaf51,_0xdb0008){return new BPromise(function(_0x32c787,_0x553970){return client[_0xc956('0x6')](_0x3aaf51,_0xdb0008)[_0xc956('0x7')](function(_0x33e110){if(_0x33e110[_0xc956('0x8')]){return _0x553970(_0x33e110[_0xc956('0x8')][_0xc956('0x9')]);}else{return _0x32c787(_0x33e110['result']);}})[_0xc956('0xa')](function(_0x58466e){return _0x553970(_0x58466e);});});}exports[_0xc956('0xb')]=function(_0x3b0403,_0x56b61a,_0x3005a6){return function(_0x289b04){if(_0x3005a6[_0xc956('0xc')]&&!_0x3005a6['rules'][_0x3b0403]){logger['info'](_0xc956('0xd'),_0x3b0403);return _0x289b04[_0xc956('0xe')]();}var _0xffd96a=[];for(var _0x4cd3ff=0x0;_0x4cd3ff<_0x56b61a[_0xc956('0xf')];_0x4cd3ff+=0x1){_0xffd96a['push'](request('Command',{'command':util[_0xc956('0x10')](_0xc956('0x11'),_0x56b61a[_0x4cd3ff])})[_0xc956('0x7')](function(_0x5b5f31){return _0x5b5f31&&_0x5b5f31[_0xc956('0x9')]&&_0x5b5f31[_0xc956('0x9')][_0xc956('0x12')]('true')>=0x0?!![]:![];})[_0xc956('0xa')](function(_0x530aec){logger[_0xc956('0x8')]('[%s][INTERVAL]\x20%s',_0x3b0403,_0x56b61a[_0x4cd3ff]);}));}BPromise['all'](_0xffd96a)['then'](function(_0x9bb12){var _0xf96ea3=_['some'](_0x9bb12);logger[_0xc956('0x13')]('[%s][INTERVAL]\x20%s\x20%s',_0x3b0403,_0x56b61a['join'](_0xc956('0x14')),_0xf96ea3);_0x289b04['when'](_0xf96ea3);})[_0xc956('0xa')](function(_0x5455d3){console[_0xc956('0x15')](_0x5455d3);logger[_0xc956('0x8')](_0xc956('0x16'),_0x3b0403,_0x56b61a[_0xc956('0x17')](_0xc956('0x14')),_0x5455d3['stack']);_0x289b04[_0xc956('0xe')]();});};}; \ No newline at end of file +var _0xc5c7=['join','\x20|\x20','when','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','error','message','catch','rules','info','stop','length','push','Command','format','iftime\x20%s','then','indexOf','true','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x29f3d3,_0x54f72d){var _0x3144d6=function(_0x4ca6e8){while(--_0x4ca6e8){_0x29f3d3['push'](_0x29f3d3['shift']());}};_0x3144d6(++_0x54f72d);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x5828ce,_0x5c7a50){_0x5828ce=_0x5828ce-0x0;var _0x47a0b4=_0xc5c7[_0x5828ce];return _0x47a0b4;};'use strict';var util=require('util');var BPromise=require(_0x7c5c('0x0'));var jayson=require(_0x7c5c('0x1'));var _=require(_0x7c5c('0x2'));var logger=require(_0x7c5c('0x3'))(_0x7c5c('0x4'));var client=jayson[_0x7c5c('0x5')]['http']({'port':0x232a});function request(_0xff325e,_0x2b4355){return new BPromise(function(_0x214653,_0x16a81c){return client[_0x7c5c('0x6')](_0xff325e,_0x2b4355)['then'](function(_0x5ec99e){if(_0x5ec99e[_0x7c5c('0x7')]){return _0x16a81c(_0x5ec99e['error'][_0x7c5c('0x8')]);}else{return _0x214653(_0x5ec99e['result']);}})[_0x7c5c('0x9')](function(_0x15f4c1){return _0x16a81c(_0x15f4c1);});});}exports['condition']=function(_0x4f0093,_0x17597c,_0x1cd540){return function(_0x5c7073){if(_0x1cd540[_0x7c5c('0xa')]&&!_0x1cd540['rules'][_0x4f0093]){logger[_0x7c5c('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4f0093);return _0x5c7073[_0x7c5c('0xc')]();}var _0x1ddace=[];for(var _0x529ab7=0x0;_0x529ab7<_0x17597c[_0x7c5c('0xd')];_0x529ab7+=0x1){_0x1ddace[_0x7c5c('0xe')](request(_0x7c5c('0xf'),{'command':util[_0x7c5c('0x10')](_0x7c5c('0x11'),_0x17597c[_0x529ab7])})[_0x7c5c('0x12')](function(_0x184f0f){return _0x184f0f&&_0x184f0f[_0x7c5c('0x8')]&&_0x184f0f[_0x7c5c('0x8')][_0x7c5c('0x13')](_0x7c5c('0x14'))>=0x0?!![]:![];})[_0x7c5c('0x9')](function(_0x2af6b3){logger[_0x7c5c('0x7')]('[%s][INTERVAL]\x20%s',_0x4f0093,_0x17597c[_0x529ab7]);}));}BPromise['all'](_0x1ddace)[_0x7c5c('0x12')](function(_0x12e92a){var _0x445a03=_[_0x7c5c('0x15')](_0x12e92a);logger['info'](_0x7c5c('0x16'),_0x4f0093,_0x17597c[_0x7c5c('0x17')](_0x7c5c('0x18')),_0x445a03);_0x5c7073[_0x7c5c('0x19')](_0x445a03);})[_0x7c5c('0x9')](function(_0x4c5c93){console['log'](_0x4c5c93);logger[_0x7c5c('0x7')](_0x7c5c('0x16'),_0x4f0093,_0x17597c[_0x7c5c('0x17')]('\x20|\x20'),_0x4c5c93[_0x7c5c('0x1a')]);_0x5c7073[_0x7c5c('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2b9a916..0aed4ca 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 _0x0737=['[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','format','destuniqueid','agentcalledAt','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','now','reason','timeout','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]'];(function(_0x59b93c,_0x24668f){var _0x1dcd69=function(_0x132de5){while(--_0x132de5){_0x59b93c['push'](_0x59b93c['shift']());}};_0x1dcd69(++_0x24668f);}(_0x0737,0x18c));var _0x7073=function(_0x2e4c37,_0x46da9d){_0x2e4c37=_0x2e4c37-0x0;var _0x5e0cf8=_0x0737[_0x2e4c37];return _0x5e0cf8;};'use strict';var _=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var utils=require(_0x7073('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5db0e7,_0x4373af){utils[_0x7073('0x3')](util['format'](_0x7073('0x4'),_0x5db0e7[_0x7073('0x5')],_0x5db0e7[_0x7073('0x6')],_0x5db0e7[_0x7073('0x7')],_0x5db0e7[_0x7073('0x8')],_0x5db0e7[_0x7073('0x9')],_0x5db0e7[_0x7073('0xa')],_0x5db0e7[_0x7073('0xb')],_0x5db0e7['lastevent']));if(_0x5db0e7[_0x7073('0x7')]){utils[_0x7073('0xc')](_0x5db0e7['queue'])['then'](function(_0x3c6632){if(_0x3c6632){_0x5db0e7[_0x7073('0xd')]=_0x3c6632['type'];_0x5db0e7[_0x7073('0xe')]=_0x5db0e7[_0x7073('0xf')]?_0x3c6632['acw']:![];_0x5db0e7[_0x7073('0x10')]=_0x5db0e7['agentacw']?_0x3c6632[_0x7073('0x11')]:0x0;}utils[_0x7073('0x12')](_0x7073('0x13'),_0x5db0e7);});}else{utils[_0x7073('0x12')](_0x7073('0x13'),_0x5db0e7);}if(_0x4373af){delete transfers[_0x5db0e7[_0x7073('0x5')]];}else{delete agents[_0x5db0e7['destuniqueid']];}}exports[_0x7073('0x14')]=function(_0x2f8639){try{utils['debug'](util[_0x7073('0x15')]('[%s][agents][agentcalled]',_0x2f8639[_0x7073('0x5')]),_0x2f8639);agents[_0x2f8639[_0x7073('0x16')]]=_0x2f8639;agents[_0x2f8639['destuniqueid']][_0x7073('0x17')]=utils['now']();agents[_0x2f8639[_0x7073('0x16')]][_0x7073('0x18')]=_0x7073('0x19');agents[_0x2f8639[_0x7073('0x16')]][_0x7073('0xb')]=null;agents[_0x2f8639['destuniqueid']][_0x7073('0x1a')]=null;utils[_0x7073('0x3')](util[_0x7073('0x15')](_0x7073('0x1b'),_0x2f8639[_0x7073('0x5')],agents[_0x2f8639[_0x7073('0x16')]][_0x7073('0x8')],_0x2f8639[_0x7073('0x16')]));}catch(_0x1f3881){utils[_0x7073('0x1c')](util[_0x7073('0x15')](_0x7073('0x1d'),_0x2f8639[_0x7073('0x5')]),_0x1f3881);}};exports['agentringnoanswer']=function(_0x141e67){try{if(!_[_0x7073('0x1e')](agents[_0x141e67[_0x7073('0x16')]])){utils[_0x7073('0x1f')](util[_0x7073('0x15')](_0x7073('0x20'),_0x141e67[_0x7073('0x5')]),_0x141e67);utils[_0x7073('0x3')](util['format'](_0x7073('0x21'),_0x141e67['uniqueid'],agents[_0x141e67['destuniqueid']][_0x7073('0x8')],_0x141e67['destuniqueid']));agents[_0x141e67[_0x7073('0x16')]][_0x7073('0x22')]=!![];agents[_0x141e67[_0x7073('0x16')]][_0x7073('0x23')]=utils[_0x7073('0x24')]();agents[_0x141e67[_0x7073('0x16')]][_0x7073('0x18')]='timeout';agents[_0x141e67[_0x7073('0x16')]][_0x7073('0x25')]=_0x7073('0x26');agents[_0x141e67[_0x7073('0x16')]]['holdtime']=_0x141e67[_0x7073('0x27')]?parseInt(_0x141e67['ringtime'])/0x3e8:0x0;agents[_0x141e67[_0x7073('0x16')]][_0x7073('0x28')]=0x0;unanswered['push'](_0x141e67[_0x7073('0x16')]);}}catch(_0x5c8bf7){utils[_0x7073('0x1c')](util[_0x7073('0x15')](_0x7073('0x20'),_0x141e67[_0x7073('0x5')]),_0x5c8bf7);}};exports['queuecallerabandon']=function(_0x162b6e){try{_[_0x7073('0x29')](agents,function(_0x595a99,_0x9b9303){if(_0x595a99['uniqueid']==_0x162b6e['uniqueid']&&!_[_0x7073('0x2a')](unanswered,_0x595a99[_0x7073('0x16')])){utils[_0x7073('0x1f')](util['format'](_0x7073('0x2b'),_0x162b6e['uniqueid']),_0x162b6e);utils[_0x7073('0x3')](util[_0x7073('0x15')](_0x7073('0x2c'),_0x162b6e['uniqueid'],_0x595a99['membername'],_0x595a99[_0x7073('0x16')]));_0x595a99['agentringnoanswer']=!![];_0x595a99[_0x7073('0x23')]=utils[_0x7073('0x24')]();_0x595a99[_0x7073('0x18')]=_0x7073('0x2d');_0x595a99[_0x7073('0x25')]=_0x7073('0x2d');_0x595a99[_0x7073('0x2e')]=_0x162b6e['holdtime'];_0x595a99[_0x7073('0x28')]=0x0;writeDB(_0x595a99);}});}catch(_0x39f594){utils[_0x7073('0x1c')](util[_0x7073('0x15')](_0x7073('0x2b'),_0x162b6e['uniqueid']),_0x39f594);}};exports[_0x7073('0x2f')]=function(_0x29af12){try{if(agents[_0x29af12[_0x7073('0x16')]]){utils[_0x7073('0x1f')](util[_0x7073('0x15')](_0x7073('0x30'),_0x29af12[_0x7073('0x5')]),_0x29af12);utils['info'](util[_0x7073('0x15')](_0x7073('0x31'),_0x29af12['uniqueid'],agents[_0x29af12[_0x7073('0x16')]][_0x7073('0x8')],_0x29af12[_0x7073('0x16')]));agents[_0x29af12[_0x7073('0x16')]][_0x7073('0x32')]=utils['now']();agents[_0x29af12[_0x7073('0x16')]][_0x7073('0xb')]=_0x29af12['connectedlinenum'];agents[_0x29af12[_0x7073('0x16')]][_0x7073('0x1a')]=_0x29af12[_0x7073('0x1a')];agents[_0x29af12['destuniqueid']][_0x7073('0x2e')]=_0x29af12['ringtime'];agents[_0x29af12[_0x7073('0x16')]]['lastevent']=_0x7073('0x33');_['forIn'](agents,function(_0x36e2cc,_0x27f348){if(_0x36e2cc[_0x7073('0x16')]!=_0x29af12[_0x7073('0x16')]&&_0x36e2cc[_0x7073('0x5')]==_0x29af12[_0x7073('0x5')]){_0x36e2cc[_0x7073('0x28')]=0x0;_0x36e2cc[_0x7073('0x2e')]=_0x29af12['ringtime'];_0x36e2cc['agentringnoanswer']=!![];_0x36e2cc[_0x7073('0x23')]=utils[_0x7073('0x24')]();_0x36e2cc['lastevent']=_0x7073('0x34');_0x36e2cc[_0x7073('0x25')]=_0x7073('0x34');_0x36e2cc[_0x7073('0x35')]=_0x29af12[_0x7073('0x16')];_0x36e2cc[_0x7073('0x36')]=_0x29af12[_0x7073('0x8')];writeDB(_0x36e2cc);}});}}catch(_0x47b2f2){utils['error'](util['format'](_0x7073('0x30'),_0x29af12[_0x7073('0x5')]),_0x47b2f2);}};exports[_0x7073('0xf')]=function(_0x3fd665){try{if(!_[_0x7073('0x1e')](agents[_0x3fd665[_0x7073('0x16')]])){utils['debug'](util[_0x7073('0x15')](_0x7073('0x37'),_0x3fd665[_0x7073('0x5')]),_0x3fd665);utils[_0x7073('0x3')](util[_0x7073('0x15')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3fd665['uniqueid'],agents[_0x3fd665[_0x7073('0x16')]]['membername'],_0x3fd665[_0x7073('0x16')]));agents[_0x3fd665[_0x7073('0x16')]]['agentcomplete']=!![];agents[_0x3fd665[_0x7073('0x16')]][_0x7073('0x38')]=utils[_0x7073('0x24')]();agents[_0x3fd665[_0x7073('0x16')]][_0x7073('0x28')]=utils[_0x7073('0x39')](agents[_0x3fd665[_0x7073('0x16')]]['agentcompleteAt'],agents[_0x3fd665[_0x7073('0x16')]][_0x7073('0x32')]);agents[_0x3fd665[_0x7073('0x16')]][_0x7073('0x25')]=_0x3fd665['reason'];agents[_0x3fd665['destuniqueid']][_0x7073('0x18')]='complete';writeDB(agents[_0x3fd665[_0x7073('0x16')]]);}}catch(_0x17d46f){utils[_0x7073('0x1c')](util[_0x7073('0x15')](_0x7073('0x37'),_0x3fd665[_0x7073('0x5')]),_0x17d46f);}};exports['blindtransfer']=function(_0x5d996a){try{if(!_[_0x7073('0x1e')](agents[_0x5d996a[_0x7073('0x3a')]])){utils[_0x7073('0x1f')](util[_0x7073('0x15')](_0x7073('0x3b'),_0x5d996a['uniqueid']),_0x5d996a);utils[_0x7073('0x3')](util[_0x7073('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5d996a[_0x7073('0x5')],agents[_0x5d996a[_0x7073('0x3a')]][_0x7073('0x8')],agents[_0x5d996a['transfereruniqueid']][_0x7073('0x5')]));agents[_0x5d996a[_0x7073('0x3a')]][_0x7073('0x3c')]=!![];agents[_0x5d996a[_0x7073('0x3a')]][_0x7073('0x3d')]='blind';agents[_0x5d996a['transfereruniqueid']]['transferexten']=_0x5d996a[_0x7073('0x3e')];agents[_0x5d996a['transfereruniqueid']][_0x7073('0x3f')]=agents[_0x5d996a[_0x7073('0x3a')]][_0x7073('0x5')];}}catch(_0x36fb4c){utils[_0x7073('0x1c')](util['format'](_0x7073('0x3b'),_0x5d996a[_0x7073('0x5')]),_0x36fb4c);}};exports[_0x7073('0x40')]=function(_0x56fec8){try{utils[_0x7073('0x1f')](util[_0x7073('0x15')](_0x7073('0x41'),_0x56fec8[_0x7073('0x42')]),_0x56fec8);if(_0x56fec8['origtransfereruniqueid']==_0x56fec8[_0x7073('0x43')]){if(!_[_0x7073('0x1e')](agents[_0x56fec8[_0x7073('0x44')]])){utils[_0x7073('0x3')](util[_0x7073('0x15')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x56fec8['origtransfereruniqueid'],agents[_0x56fec8['secondtransfereruniqueid']]['membername']));agents[_0x56fec8[_0x7073('0x44')]][_0x7073('0x3c')]=!![];agents[_0x56fec8['secondtransfereruniqueid']][_0x7073('0x3d')]=_0x7073('0x45');agents[_0x56fec8[_0x7073('0x44')]][_0x7073('0x46')]=_0x56fec8[_0x7073('0x47')];agents[_0x56fec8[_0x7073('0x44')]]['transferuniqueid']=_0x56fec8[_0x7073('0x42')];}if(_0x56fec8[_0x7073('0x48')]&&agents[_0x56fec8[_0x7073('0x48')]]){agents[_0x56fec8[_0x7073('0x48')]][_0x7073('0x49')]=0x1;transfers[_0x56fec8[_0x7073('0x48')]]=_[_0x7073('0x4a')](agents[_0x56fec8['transfereeuniqueid']]);transfers[_0x56fec8[_0x7073('0x48')]][_0x7073('0xa')]=agents[_0x56fec8[_0x7073('0x44')]][_0x7073('0xa')];transfers[_0x56fec8[_0x7073('0x48')]]['calleridname']=agents[_0x56fec8[_0x7073('0x44')]][_0x7073('0x4b')];transfers[_0x56fec8[_0x7073('0x48')]][_0x7073('0x17')]=utils[_0x7073('0x24')]();transfers[_0x56fec8[_0x7073('0x48')]][_0x7073('0x32')]=utils[_0x7073('0x24')]();transfers[_0x56fec8[_0x7073('0x48')]][_0x7073('0x2e')]=0x0;transfers[_0x56fec8[_0x7073('0x48')]][_0x7073('0x49')]=0x2;}}else if(_0x56fec8['secondtransfereruniqueid']==_0x56fec8[_0x7073('0x4c')]){if(!_['isNil'](agents[_0x56fec8[_0x7073('0x42')]])){utils[_0x7073('0x3')](util['format'](_0x7073('0x4d'),_0x56fec8['origtransfereruniqueid'],agents[_0x56fec8[_0x7073('0x42')]][_0x7073('0x8')]));agents[_0x56fec8[_0x7073('0x42')]]['transfer']=!![];agents[_0x56fec8['origtransfereruniqueid']][_0x7073('0x3d')]='ATTENDED';agents[_0x56fec8[_0x7073('0x42')]][_0x7073('0x46')]=_0x56fec8[_0x7073('0x4e')];agents[_0x56fec8['origtransfereruniqueid']][_0x7073('0x3f')]=_0x56fec8[_0x7073('0x44')];}if(_0x56fec8[_0x7073('0x4f')]&&agents[_0x56fec8['transfertargetuniqueid']]){agents[_0x56fec8[_0x7073('0x4f')]][_0x7073('0x49')]=0x1;transfers[_0x56fec8[_0x7073('0x4f')]]=_[_0x7073('0x4a')](agents[_0x56fec8[_0x7073('0x4f')]]);transfers[_0x56fec8['transfertargetuniqueid']][_0x7073('0xa')]=agents[_0x56fec8[_0x7073('0x42')]]['calleridnum'];transfers[_0x56fec8[_0x7073('0x4f')]]['calleridname']=agents[_0x56fec8[_0x7073('0x42')]][_0x7073('0x4b')];transfers[_0x56fec8['transfertargetuniqueid']][_0x7073('0x17')]=utils[_0x7073('0x24')]();transfers[_0x56fec8[_0x7073('0x4f')]][_0x7073('0x32')]=utils[_0x7073('0x24')]();transfers[_0x56fec8['transfertargetuniqueid']][_0x7073('0x2e')]=0x0;transfers[_0x56fec8['transfertargetuniqueid']][_0x7073('0x49')]=0x2;}}}catch(_0x5b1112){utils[_0x7073('0x1c')](util[_0x7073('0x15')]('[%s][agents][attendedtransfer]',_0x56fec8['origtransfereruniqueid']),_0x5b1112);}};exports[_0x7073('0x50')]=function(_0x5b9688){try{utils[_0x7073('0x1f')](util['format'](_0x7073('0x51'),_0x5b9688[_0x7073('0x5')]),_0x5b9688);if(agents[_0x5b9688['uniqueid']]&&agents[_0x5b9688[_0x7073('0x5')]]['reason']===_0x7073('0x26')){if(_0x5b9688[_0x7073('0x52')]==='21'){agents[_0x5b9688[_0x7073('0x5')]]['reason']='rejected';agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x18')]=_0x7073('0x53');}utils[_0x7073('0x3')](util[_0x7073('0x15')](_0x7073('0x54'),_0x5b9688[_0x7073('0x5')],agents[_0x5b9688['uniqueid']]['membername'],agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x25')],agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x18')]));writeDB(agents[_0x5b9688[_0x7073('0x5')]]);var _0x4455d0=unanswered[_0x7073('0x55')](_0x5b9688['uniqueid']);if(_0x4455d0>-0x1){unanswered[_0x7073('0x56')](_0x4455d0,0x1);}}if(transfers[_0x5b9688[_0x7073('0x5')]]){transfers[_0x5b9688[_0x7073('0x5')]]['agentcomplete']=!![];transfers[_0x5b9688[_0x7073('0x5')]][_0x7073('0x38')]=utils[_0x7073('0x24')]();transfers[_0x5b9688[_0x7073('0x5')]]['talktime']=utils[_0x7073('0x39')](transfers[_0x5b9688['uniqueid']]['agentcompleteAt'],transfers[_0x5b9688[_0x7073('0x5')]][_0x7073('0x32')]);transfers[_0x5b9688[_0x7073('0x5')]][_0x7073('0x25')]=_0x7073('0x57');transfers[_0x5b9688['uniqueid']][_0x7073('0x18')]=_0x7073('0x58');utils['info'](util[_0x7073('0x15')](_0x7073('0x54'),_0x5b9688['uniqueid'],transfers[_0x5b9688[_0x7073('0x5')]][_0x7073('0x8')],transfers[_0x5b9688[_0x7073('0x5')]][_0x7073('0x25')],transfers[_0x5b9688[_0x7073('0x5')]][_0x7073('0x18')]));writeDB(transfers[_0x5b9688['uniqueid']],!![]);}if(agents[_0x5b9688[_0x7073('0x5')]]&&agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x32')]){agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0xf')]=!![];agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x38')]=utils[_0x7073('0x24')]();agents[_0x5b9688['uniqueid']][_0x7073('0x28')]=utils[_0x7073('0x39')](agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x38')],agents[_0x5b9688[_0x7073('0x5')]]['agentconnectAt']);agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x25')]=agents[_0x5b9688[_0x7073('0x5')]]['transfer']?_0x7073('0x3c'):_0x7073('0x57');agents[_0x5b9688['uniqueid']]['lastevent']='complete';utils['info'](util[_0x7073('0x15')](_0x7073('0x54'),_0x5b9688[_0x7073('0x5')],agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x8')],agents[_0x5b9688[_0x7073('0x5')]][_0x7073('0x25')],agents[_0x5b9688['uniqueid']][_0x7073('0x18')]));writeDB(agents[_0x5b9688[_0x7073('0x5')]]);}}catch(_0xebcb9){utils[_0x7073('0x1c')](util[_0x7073('0x15')](_0x7073('0x51'),_0x5b9688[_0x7073('0x5')]),_0xebcb9);}}; \ No newline at end of file +var _0x0cfa=['answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transferuniqueid','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','now','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x0cfa,0x12e));var _0xa0cf=function(_0x5a1629,_0x24efad){_0x5a1629=_0x5a1629-0x0;var _0x31f0dd=_0x0cfa[_0x5a1629];return _0x31f0dd;};'use strict';var _=require(_0xa0cf('0x0'));var util=require('util');var utils=require(_0xa0cf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x556a4c,_0x2ecf55){utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x4'),_0x556a4c[_0xa0cf('0x5')],_0x556a4c['channel'],_0x556a4c[_0xa0cf('0x6')],_0x556a4c[_0xa0cf('0x7')],_0x556a4c['interface'],_0x556a4c['calleridnum'],_0x556a4c['connectedlinenum'],_0x556a4c[_0xa0cf('0x8')]));if(_0x556a4c[_0xa0cf('0x6')]){utils[_0xa0cf('0x9')](_0x556a4c[_0xa0cf('0x6')])[_0xa0cf('0xa')](function(_0x59aac1){if(_0x59aac1){_0x556a4c[_0xa0cf('0xb')]=_0x59aac1[_0xa0cf('0xb')];_0x556a4c[_0xa0cf('0xc')]=_0x556a4c[_0xa0cf('0xd')]?_0x59aac1[_0xa0cf('0xe')]:![];_0x556a4c[_0xa0cf('0xf')]=_0x556a4c[_0xa0cf('0xc')]?_0x59aac1[_0xa0cf('0x10')]:0x0;}utils[_0xa0cf('0x11')](_0xa0cf('0x12'),_0x556a4c);});}else{utils[_0xa0cf('0x11')](_0xa0cf('0x12'),_0x556a4c);}if(_0x2ecf55){delete transfers[_0x556a4c['uniqueid']];}else{delete agents[_0x556a4c['destuniqueid']];}}exports[_0xa0cf('0x13')]=function(_0x1be42a){try{utils[_0xa0cf('0x14')](util[_0xa0cf('0x3')](_0xa0cf('0x15'),_0x1be42a[_0xa0cf('0x5')]),_0x1be42a);agents[_0x1be42a[_0xa0cf('0x16')]]=_0x1be42a;agents[_0x1be42a['destuniqueid']]['agentcalledAt']=utils[_0xa0cf('0x17')]();agents[_0x1be42a['destuniqueid']]['lastevent']='called';agents[_0x1be42a[_0xa0cf('0x16')]][_0xa0cf('0x18')]=null;agents[_0x1be42a[_0xa0cf('0x16')]]['connectedlinename']=null;utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x19'),_0x1be42a['uniqueid'],agents[_0x1be42a['destuniqueid']]['membername'],_0x1be42a[_0xa0cf('0x16')]));}catch(_0x17ead3){utils[_0xa0cf('0x1a')](util[_0xa0cf('0x3')](_0xa0cf('0x15'),_0x1be42a[_0xa0cf('0x5')]),_0x17ead3);}};exports[_0xa0cf('0x1b')]=function(_0x1d75ca){try{if(!_['isNil'](agents[_0x1d75ca[_0xa0cf('0x16')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x1d75ca['uniqueid']),_0x1d75ca);utils[_0xa0cf('0x2')](util['format'](_0xa0cf('0x1c'),_0x1d75ca[_0xa0cf('0x5')],agents[_0x1d75ca[_0xa0cf('0x16')]][_0xa0cf('0x7')],_0x1d75ca[_0xa0cf('0x16')]));agents[_0x1d75ca[_0xa0cf('0x16')]][_0xa0cf('0x1b')]=!![];agents[_0x1d75ca[_0xa0cf('0x16')]][_0xa0cf('0x1d')]=utils['now']();agents[_0x1d75ca[_0xa0cf('0x16')]]['lastevent']=_0xa0cf('0x1e');agents[_0x1d75ca[_0xa0cf('0x16')]][_0xa0cf('0x1f')]=_0xa0cf('0x1e');agents[_0x1d75ca[_0xa0cf('0x16')]]['holdtime']=_0x1d75ca['ringtime']?parseInt(_0x1d75ca[_0xa0cf('0x20')])/0x3e8:0x0;agents[_0x1d75ca[_0xa0cf('0x16')]][_0xa0cf('0x21')]=0x0;unanswered[_0xa0cf('0x22')](_0x1d75ca['destuniqueid']);}}catch(_0x2e83fd){utils[_0xa0cf('0x1a')](util[_0xa0cf('0x3')](_0xa0cf('0x23'),_0x1d75ca[_0xa0cf('0x5')]),_0x2e83fd);}};exports[_0xa0cf('0x24')]=function(_0x451dc3){try{_['forIn'](agents,function(_0x619ea1,_0x240b08){if(_0x619ea1[_0xa0cf('0x5')]==_0x451dc3[_0xa0cf('0x5')]&&!_[_0xa0cf('0x25')](unanswered,_0x619ea1['destuniqueid'])){utils[_0xa0cf('0x14')](util[_0xa0cf('0x3')](_0xa0cf('0x26'),_0x451dc3['uniqueid']),_0x451dc3);utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x27'),_0x451dc3['uniqueid'],_0x619ea1[_0xa0cf('0x7')],_0x619ea1[_0xa0cf('0x16')]));_0x619ea1[_0xa0cf('0x1b')]=!![];_0x619ea1[_0xa0cf('0x1d')]=utils['now']();_0x619ea1[_0xa0cf('0x8')]=_0xa0cf('0x28');_0x619ea1[_0xa0cf('0x1f')]=_0xa0cf('0x28');_0x619ea1['holdtime']=_0x451dc3[_0xa0cf('0x29')];_0x619ea1[_0xa0cf('0x21')]=0x0;writeDB(_0x619ea1);}});}catch(_0xb81f88){utils[_0xa0cf('0x1a')](util['format'](_0xa0cf('0x26'),_0x451dc3[_0xa0cf('0x5')]),_0xb81f88);}};exports[_0xa0cf('0x2a')]=function(_0x18e9ee){try{if(agents[_0x18e9ee[_0xa0cf('0x16')]]){utils[_0xa0cf('0x14')](util['format'](_0xa0cf('0x2b'),_0x18e9ee[_0xa0cf('0x5')]),_0x18e9ee);utils['info'](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x18e9ee[_0xa0cf('0x5')],agents[_0x18e9ee[_0xa0cf('0x16')]][_0xa0cf('0x7')],_0x18e9ee['destuniqueid']));agents[_0x18e9ee['destuniqueid']][_0xa0cf('0x2c')]=utils[_0xa0cf('0x17')]();agents[_0x18e9ee[_0xa0cf('0x16')]]['connectedlinenum']=_0x18e9ee[_0xa0cf('0x18')];agents[_0x18e9ee['destuniqueid']]['connectedlinename']=_0x18e9ee['connectedlinename'];agents[_0x18e9ee[_0xa0cf('0x16')]][_0xa0cf('0x29')]=_0x18e9ee[_0xa0cf('0x20')];agents[_0x18e9ee[_0xa0cf('0x16')]][_0xa0cf('0x8')]=_0xa0cf('0x2d');_['forIn'](agents,function(_0x1f9bbd,_0x1e7459){if(_0x1f9bbd['destuniqueid']!=_0x18e9ee['destuniqueid']&&_0x1f9bbd[_0xa0cf('0x5')]==_0x18e9ee[_0xa0cf('0x5')]){_0x1f9bbd[_0xa0cf('0x21')]=0x0;_0x1f9bbd[_0xa0cf('0x29')]=_0x18e9ee[_0xa0cf('0x20')];_0x1f9bbd[_0xa0cf('0x1b')]=!![];_0x1f9bbd[_0xa0cf('0x1d')]=utils[_0xa0cf('0x17')]();_0x1f9bbd[_0xa0cf('0x8')]=_0xa0cf('0x2e');_0x1f9bbd[_0xa0cf('0x1f')]='answered_elsewhere';_0x1f9bbd[_0xa0cf('0x2f')]=_0x18e9ee[_0xa0cf('0x16')];_0x1f9bbd[_0xa0cf('0x30')]=_0x18e9ee['membername'];writeDB(_0x1f9bbd);}});}}catch(_0x39a41b){utils[_0xa0cf('0x1a')](util['format'](_0xa0cf('0x2b'),_0x18e9ee[_0xa0cf('0x5')]),_0x39a41b);}};exports[_0xa0cf('0xd')]=function(_0x1ed2ff){try{if(!_[_0xa0cf('0x31')](agents[_0x1ed2ff[_0xa0cf('0x16')]])){utils['debug'](util[_0xa0cf('0x3')]('[%s][agents][agentcomplete]',_0x1ed2ff[_0xa0cf('0x5')]),_0x1ed2ff);utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x32'),_0x1ed2ff[_0xa0cf('0x5')],agents[_0x1ed2ff[_0xa0cf('0x16')]][_0xa0cf('0x7')],_0x1ed2ff[_0xa0cf('0x16')]));agents[_0x1ed2ff[_0xa0cf('0x16')]][_0xa0cf('0xd')]=!![];agents[_0x1ed2ff[_0xa0cf('0x16')]]['agentcompleteAt']=utils[_0xa0cf('0x17')]();agents[_0x1ed2ff[_0xa0cf('0x16')]]['talktime']=utils[_0xa0cf('0x33')](agents[_0x1ed2ff[_0xa0cf('0x16')]][_0xa0cf('0x34')],agents[_0x1ed2ff[_0xa0cf('0x16')]]['agentconnectAt']);agents[_0x1ed2ff[_0xa0cf('0x16')]]['reason']=_0x1ed2ff[_0xa0cf('0x1f')];agents[_0x1ed2ff[_0xa0cf('0x16')]][_0xa0cf('0x8')]=_0xa0cf('0x35');writeDB(agents[_0x1ed2ff['destuniqueid']]);}}catch(_0x5372c2){utils['error'](util[_0xa0cf('0x3')](_0xa0cf('0x36'),_0x1ed2ff[_0xa0cf('0x5')]),_0x5372c2);}};exports[_0xa0cf('0x37')]=function(_0x27f846){try{if(!_[_0xa0cf('0x31')](agents[_0x27f846['transfereruniqueid']])){utils[_0xa0cf('0x14')](util[_0xa0cf('0x3')](_0xa0cf('0x38'),_0x27f846[_0xa0cf('0x5')]),_0x27f846);utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x39'),_0x27f846[_0xa0cf('0x5')],agents[_0x27f846[_0xa0cf('0x3a')]][_0xa0cf('0x7')],agents[_0x27f846[_0xa0cf('0x3a')]]['uniqueid']));agents[_0x27f846[_0xa0cf('0x3a')]]['transfer']=!![];agents[_0x27f846[_0xa0cf('0x3a')]][_0xa0cf('0x3b')]=_0xa0cf('0x3c');agents[_0x27f846[_0xa0cf('0x3a')]]['transferexten']=_0x27f846[_0xa0cf('0x3d')];agents[_0x27f846[_0xa0cf('0x3a')]]['transferuniqueid']=agents[_0x27f846['transfereruniqueid']][_0xa0cf('0x5')];}}catch(_0x34f12c){utils[_0xa0cf('0x1a')](util['format'](_0xa0cf('0x38'),_0x27f846[_0xa0cf('0x5')]),_0x34f12c);}};exports[_0xa0cf('0x3e')]=function(_0x3cde2b){try{utils[_0xa0cf('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x3cde2b[_0xa0cf('0x3f')]),_0x3cde2b);if(_0x3cde2b[_0xa0cf('0x3f')]==_0x3cde2b[_0xa0cf('0x40')]){if(!_[_0xa0cf('0x31')](agents[_0x3cde2b[_0xa0cf('0x41')]])){utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cde2b[_0xa0cf('0x3f')],agents[_0x3cde2b[_0xa0cf('0x41')]]['membername']));agents[_0x3cde2b[_0xa0cf('0x41')]][_0xa0cf('0x42')]=!![];agents[_0x3cde2b[_0xa0cf('0x41')]][_0xa0cf('0x3b')]=_0xa0cf('0x43');agents[_0x3cde2b[_0xa0cf('0x41')]]['transferexten']=_0x3cde2b[_0xa0cf('0x44')];agents[_0x3cde2b[_0xa0cf('0x41')]]['transferuniqueid']=_0x3cde2b[_0xa0cf('0x3f')];}if(_0x3cde2b[_0xa0cf('0x45')]&&agents[_0x3cde2b['transfereeuniqueid']]){agents[_0x3cde2b['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x3cde2b[_0xa0cf('0x45')]]=_[_0xa0cf('0x46')](agents[_0x3cde2b['transfereeuniqueid']]);transfers[_0x3cde2b['transfereeuniqueid']][_0xa0cf('0x47')]=agents[_0x3cde2b[_0xa0cf('0x41')]][_0xa0cf('0x47')];transfers[_0x3cde2b[_0xa0cf('0x45')]][_0xa0cf('0x48')]=agents[_0x3cde2b[_0xa0cf('0x41')]][_0xa0cf('0x48')];transfers[_0x3cde2b[_0xa0cf('0x45')]][_0xa0cf('0x49')]=utils[_0xa0cf('0x17')]();transfers[_0x3cde2b[_0xa0cf('0x45')]][_0xa0cf('0x2c')]=utils[_0xa0cf('0x17')]();transfers[_0x3cde2b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x3cde2b[_0xa0cf('0x45')]][_0xa0cf('0x4a')]=0x2;}}else if(_0x3cde2b['secondtransfereruniqueid']==_0x3cde2b[_0xa0cf('0x4b')]){if(!_[_0xa0cf('0x31')](agents[_0x3cde2b[_0xa0cf('0x3f')]])){utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x4c'),_0x3cde2b[_0xa0cf('0x3f')],agents[_0x3cde2b[_0xa0cf('0x3f')]]['membername']));agents[_0x3cde2b[_0xa0cf('0x3f')]][_0xa0cf('0x42')]=!![];agents[_0x3cde2b[_0xa0cf('0x3f')]][_0xa0cf('0x3b')]=_0xa0cf('0x43');agents[_0x3cde2b[_0xa0cf('0x3f')]]['transferexten']=_0x3cde2b[_0xa0cf('0x4d')];agents[_0x3cde2b[_0xa0cf('0x3f')]][_0xa0cf('0x4e')]=_0x3cde2b['secondtransfereruniqueid'];}if(_0x3cde2b['transfertargetuniqueid']&&agents[_0x3cde2b['transfertargetuniqueid']]){agents[_0x3cde2b[_0xa0cf('0x4f')]]['agententerreason']=0x1;transfers[_0x3cde2b[_0xa0cf('0x4f')]]=_[_0xa0cf('0x46')](agents[_0x3cde2b['transfertargetuniqueid']]);transfers[_0x3cde2b['transfertargetuniqueid']][_0xa0cf('0x47')]=agents[_0x3cde2b[_0xa0cf('0x3f')]][_0xa0cf('0x47')];transfers[_0x3cde2b[_0xa0cf('0x4f')]]['calleridname']=agents[_0x3cde2b[_0xa0cf('0x3f')]][_0xa0cf('0x48')];transfers[_0x3cde2b[_0xa0cf('0x4f')]]['agentcalledAt']=utils['now']();transfers[_0x3cde2b['transfertargetuniqueid']][_0xa0cf('0x2c')]=utils[_0xa0cf('0x17')]();transfers[_0x3cde2b[_0xa0cf('0x4f')]][_0xa0cf('0x29')]=0x0;transfers[_0x3cde2b[_0xa0cf('0x4f')]]['agententerreason']=0x2;}}}catch(_0x11abec){utils[_0xa0cf('0x1a')](util[_0xa0cf('0x3')](_0xa0cf('0x50'),_0x3cde2b['origtransfereruniqueid']),_0x11abec);}};exports[_0xa0cf('0x51')]=function(_0x113d4e){try{utils[_0xa0cf('0x14')](util['format'](_0xa0cf('0x52'),_0x113d4e[_0xa0cf('0x5')]),_0x113d4e);if(agents[_0x113d4e[_0xa0cf('0x5')]]&&agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x1f')]===_0xa0cf('0x1e')){if(_0x113d4e[_0xa0cf('0x53')]==='21'){agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x1f')]='rejected';agents[_0x113d4e[_0xa0cf('0x5')]]['lastevent']='rejected';}utils[_0xa0cf('0x2')](util['format'](_0xa0cf('0x54'),_0x113d4e[_0xa0cf('0x5')],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x7')],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x1f')],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x8')]));writeDB(agents[_0x113d4e[_0xa0cf('0x5')]]);var _0xde7c1a=unanswered[_0xa0cf('0x55')](_0x113d4e[_0xa0cf('0x5')]);if(_0xde7c1a>-0x1){unanswered['splice'](_0xde7c1a,0x1);}}if(transfers[_0x113d4e['uniqueid']]){transfers[_0x113d4e[_0xa0cf('0x5')]]['agentcomplete']=!![];transfers[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x34')]=utils[_0xa0cf('0x17')]();transfers[_0x113d4e['uniqueid']][_0xa0cf('0x21')]=utils[_0xa0cf('0x33')](transfers[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x34')],transfers[_0x113d4e['uniqueid']][_0xa0cf('0x2c')]);transfers[_0x113d4e[_0xa0cf('0x5')]]['reason']='agent';transfers[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x8')]=_0xa0cf('0x35');utils[_0xa0cf('0x2')](util[_0xa0cf('0x3')](_0xa0cf('0x54'),_0x113d4e[_0xa0cf('0x5')],transfers[_0x113d4e[_0xa0cf('0x5')]]['membername'],transfers[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x1f')],transfers[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x8')]));writeDB(transfers[_0x113d4e[_0xa0cf('0x5')]],!![]);}if(agents[_0x113d4e[_0xa0cf('0x5')]]&&agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x2c')]){agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0xd')]=!![];agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x34')]=utils[_0xa0cf('0x17')]();agents[_0x113d4e['uniqueid']][_0xa0cf('0x21')]=utils[_0xa0cf('0x33')](agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x34')],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x2c')]);agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x1f')]=agents[_0x113d4e['uniqueid']]['transfer']?_0xa0cf('0x42'):_0xa0cf('0x56');agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x8')]='complete';utils['info'](util[_0xa0cf('0x3')](_0xa0cf('0x54'),_0x113d4e['uniqueid'],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x7')],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x1f')],agents[_0x113d4e[_0xa0cf('0x5')]][_0xa0cf('0x8')]));writeDB(agents[_0x113d4e[_0xa0cf('0x5')]]);}}catch(_0x5dbabf){utils[_0xa0cf('0x1a')](util['format']('[%s][agents][hangup]',_0x113d4e['uniqueid']),_0x5dbabf);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7bb3829..1d4dabe 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 _0x8f9c=['[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','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','uniqueid','channel','queue','interface','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum'];(function(_0x3d5293,_0x9c3ab){var _0x45d471=function(_0x462fe1){while(--_0x462fe1){_0x3d5293['push'](_0x3d5293['shift']());}};_0x45d471(++_0x9c3ab);}(_0x8f9c,0xfc));var _0xc8f9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8f9c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xc8f9('0x0'));var util=require(_0xc8f9('0x1'));var utils=require(_0xc8f9('0x2'));var dispositions=[_0xc8f9('0x3'),_0xc8f9('0x4'),_0xc8f9('0x4'),_0xc8f9('0x3'),_0xc8f9('0x3'),_0xc8f9('0x3'),_0xc8f9('0x5'),_0xc8f9('0x6'),'FAILED',_0xc8f9('0x4'),_0xc8f9('0x4')];var channels={};function writeDB(_0xa2114a){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x9'),_0xa2114a[_0xc8f9('0xa')],_0xa2114a[_0xc8f9('0xb')],_0xa2114a[_0xc8f9('0xc')],_0xa2114a['membername'],_0xa2114a[_0xc8f9('0xd')],_0xa2114a['calleridnum'],_0xa2114a['connectedlinenum'],_0xa2114a[_0xc8f9('0xe')]));if(_0xa2114a[_0xc8f9('0xf')]){utils[_0xc8f9('0x10')](_0xa2114a[_0xc8f9('0xf')])['then'](function(_0x242f3e){if(_0x242f3e){_0xa2114a[_0xc8f9('0x11')]=_0x242f3e['id'];}utils[_0xc8f9('0x12')]('CreateVoiceCallReport',_0xa2114a);});}else{utils[_0xc8f9('0x12')](_0xc8f9('0x13'),_0xa2114a);}if(channels[_0xa2114a[_0xc8f9('0xa')]]){delete channels[_0xa2114a[_0xc8f9('0xa')]];}}exports[_0xc8f9('0x14')]=function(_0x272e97){try{utils['debug'](util['format'](_0xc8f9('0x15'),_0x272e97[_0xc8f9('0xa')]),_0x272e97);if(_0x272e97['uniqueid']==_0x272e97['linkedid']&&_0x272e97[_0xc8f9('0xb')]!='OutgoingSpoolFailed'){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x16'),_0x272e97['uniqueid'],_0x272e97['context'],_0x272e97[_0xc8f9('0x17')]));channels[_0x272e97[_0xc8f9('0xa')]]={'uniqueid':_0x272e97[_0xc8f9('0xa')],'accountcode':_0x272e97[_0xc8f9('0xf')],'source':_0x272e97[_0xc8f9('0x18')],'destination':_0x272e97[_0xc8f9('0x17')],'destinationcontext':_0x272e97[_0xc8f9('0x19')],'channel':_0x272e97[_0xc8f9('0xb')],'starttime':utils[_0xc8f9('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xc8f9('0x1b')};}}catch(_0x23c96f){utils[_0xc8f9('0x1c')](util[_0xc8f9('0x8')](_0xc8f9('0x15'),_0x272e97['uniqueid']),_0x23c96f);}};exports[_0xc8f9('0x1d')]=function(_0x3739e6){try{utils[_0xc8f9('0x1e')](util[_0xc8f9('0x8')](_0xc8f9('0x1f'),_0x3739e6[_0xc8f9('0xa')]),_0x3739e6);if(!_[_0xc8f9('0x20')](channels[_0x3739e6['uniqueid']])&&_0x3739e6[_0xc8f9('0x21')]==0x6){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x22'),_0x3739e6['uniqueid'],_0x3739e6[_0xc8f9('0x19')],_0x3739e6[_0xc8f9('0xb')]));if(_[_0xc8f9('0x20')](channels[_0x3739e6[_0xc8f9('0xa')]][_0xc8f9('0x23')])){channels[_0x3739e6[_0xc8f9('0xa')]][_0xc8f9('0x23')]=utils[_0xc8f9('0x1a')]();}}else if(!_[_0xc8f9('0x20')](channels[_0x3739e6['linkedid']])&&_0x3739e6['channelstate']==0x6&&_0x3739e6[_0xc8f9('0x19')]!=_0xc8f9('0x24')){utils['info'](util[_0xc8f9('0x8')](_0xc8f9('0x25'),_0x3739e6[_0xc8f9('0xa')],_0x3739e6['linkedid'],_0x3739e6[_0xc8f9('0x19')],_0x3739e6[_0xc8f9('0xb')]));channels[_0x3739e6['linkedid']][_0xc8f9('0xf')]=_0x3739e6[_0xc8f9('0xf')];channels[_0x3739e6[_0xc8f9('0x26')]][_0xc8f9('0x27')]=_0x3739e6['channel'];if(_[_0xc8f9('0x20')](channels[_0x3739e6['linkedid']][_0xc8f9('0x28')])){channels[_0x3739e6[_0xc8f9('0x26')]]['answertime']=utils[_0xc8f9('0x1a')]();}channels[_0x3739e6[_0xc8f9('0x26')]][_0xc8f9('0x29')]=dispositions[_[_0xc8f9('0x2a')](_0x3739e6[_0xc8f9('0x21')])]||_0xc8f9('0x5');}}catch(_0x43690e){utils['error'](util[_0xc8f9('0x8')]('[%s][calls][newstate]',_0x3739e6[_0xc8f9('0xa')]),_0x43690e);}};exports[_0xc8f9('0x2b')]=function(_0x5ac5ce){try{if(!_[_0xc8f9('0x20')](channels[_0x5ac5ce[_0xc8f9('0xa')]])){utils[_0xc8f9('0x1e')](util[_0xc8f9('0x8')](_0xc8f9('0x2c'),_0x5ac5ce[_0xc8f9('0xa')]),_0x5ac5ce);if(_[_0xc8f9('0x20')](channels[_0x5ac5ce['uniqueid']][_0xc8f9('0x2d')])){channels[_0x5ac5ce[_0xc8f9('0xa')]][_0xc8f9('0x2d')]=_0x5ac5ce['calleridname']+'\x20<'+_0x5ac5ce['calleridnum']+'>';}utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5ac5ce['uniqueid'],channels[_0x5ac5ce[_0xc8f9('0xa')]][_0xc8f9('0x2d')],_0x5ac5ce[_0xc8f9('0x2e')]));channels[_0x5ac5ce[_0xc8f9('0xa')]][_0xc8f9('0x2f')]=utils[_0xc8f9('0x1a')]();channels[_0x5ac5ce['uniqueid']][_0xc8f9('0x30')]=utils[_0xc8f9('0x31')](channels[_0x5ac5ce[_0xc8f9('0xa')]]['endtime'],channels[_0x5ac5ce['uniqueid']][_0xc8f9('0x32')]);channels[_0x5ac5ce[_0xc8f9('0xa')]]['billableseconds']=channels[_0x5ac5ce[_0xc8f9('0xa')]][_0xc8f9('0x28')]?utils['diffTime'](channels[_0x5ac5ce[_0xc8f9('0xa')]]['endtime'],channels[_0x5ac5ce[_0xc8f9('0xa')]]['answertime']):0x0;writeDB(channels[_0x5ac5ce['uniqueid']]);}}catch(_0x15f4d7){utils[_0xc8f9('0x1c')](util['format'](_0xc8f9('0x2c'),_0x5ac5ce[_0xc8f9('0xa')]),_0x15f4d7);}};exports[_0xc8f9('0x33')]=function(_0x2c6928){try{if(!_[_0xc8f9('0x20')](channels[_0x2c6928[_0xc8f9('0x34')]])){utils[_0xc8f9('0x1e')](util[_0xc8f9('0x8')](_0xc8f9('0x35'),_0x2c6928[_0xc8f9('0x36')]),_0x2c6928);if(channels[_0x2c6928[_0xc8f9('0x34')]]['channel']==_0x2c6928['transfereechannel']){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x37'),_0x2c6928[_0xc8f9('0x36')],_0x2c6928[_0xc8f9('0x34')],_0x2c6928['secondtransfererchannel']));channels[_0x2c6928[_0xc8f9('0x34')]][_0xc8f9('0x27')]=_0x2c6928[_0xc8f9('0x38')];channels[_0x2c6928['localtwolinkedid']][_0xc8f9('0x39')]='_attended';}else if(channels[_0x2c6928['localtwolinkedid']][_0xc8f9('0xb')]=_0x2c6928['transfertargetchannel']){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x37'),_0x2c6928['origtransfereruniqueid'],_0x2c6928[_0xc8f9('0x34')],_0x2c6928[_0xc8f9('0x3a')]));channels[_0x2c6928[_0xc8f9('0x34')]][_0xc8f9('0x27')]=_0x2c6928[_0xc8f9('0x3a')];channels[_0x2c6928[_0xc8f9('0x34')]][_0xc8f9('0x39')]=_0xc8f9('0x3b');}}}catch(_0x1ce9a8){utils[_0xc8f9('0x1c')](util[_0xc8f9('0x8')]('[%s][calls][attendedtransfer]',_0x2c6928['origtransfereruniqueid']),_0x1ce9a8);}};exports[_0xc8f9('0x3c')]=function(_0x360049){try{if(!_[_0xc8f9('0x20')](channels[_0x360049['uniqueid']])){utils[_0xc8f9('0x1e')](util[_0xc8f9('0x8')]('[%s][calls][musiconholdstart]',_0x360049[_0xc8f9('0xa')]),_0x360049);channels[_0x360049[_0xc8f9('0xa')]]['musiconholdstartAt']=utils[_0xc8f9('0x1a')]();utils['info'](util[_0xc8f9('0x8')](_0xc8f9('0x3d'),_0x360049[_0xc8f9('0xa')],channels[_0x360049[_0xc8f9('0xa')]][_0xc8f9('0x3e')]));}}catch(_0x4bd4d7){utils[_0xc8f9('0x1c')](util['format'](_0xc8f9('0x3f'),_0x360049[_0xc8f9('0xa')]),_0x4bd4d7);}};exports[_0xc8f9('0x40')]=function(_0x1a9174){try{if(!_[_0xc8f9('0x20')](channels[_0x1a9174[_0xc8f9('0xa')]])){utils[_0xc8f9('0x1e')](util['format'](_0xc8f9('0x41'),_0x1a9174[_0xc8f9('0xa')]),_0x1a9174);if(!_['isNil'](channels[_0x1a9174[_0xc8f9('0xa')]][_0xc8f9('0x3e')])){channels[_0x1a9174['uniqueid']][_0xc8f9('0x42')]+=utils[_0xc8f9('0x31')](utils['now'](),channels[_0x1a9174['uniqueid']][_0xc8f9('0x3e')]);utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x43'),_0x1a9174[_0xc8f9('0xa')],channels[_0x1a9174['uniqueid']][_0xc8f9('0x42')]));delete channels[_0x1a9174['uniqueid']][_0xc8f9('0x3e')];}}}catch(_0x2544b6){utils['error'](util[_0xc8f9('0x8')]('[%s][calls][musiconholdstop]',_0x1a9174['uniqueid']),_0x2544b6);}};exports[_0xc8f9('0x44')]=function(_0x544433){try{if(!_[_0xc8f9('0x20')](channels[_0x544433[_0xc8f9('0xa')]])){utils[_0xc8f9('0x1e')](util['format'](_0xc8f9('0x45'),_0x544433[_0xc8f9('0xa')]),_0x544433);if(!_[_0xc8f9('0x20')](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x47')])){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x48'),_0x544433[_0xc8f9('0xa')],_0x544433[_0xc8f9('0x49')]));channels[_0x544433[_0xc8f9('0xa')]]['source']=_0x544433[_0xc8f9('0x49')];}if(!_[_0xc8f9('0x20')](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x4a')])){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x4b'),_0x544433[_0xc8f9('0xa')],_0x544433['value']));channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0x4c')]=_0x544433['value'];channels[_0x544433['uniqueid']][_0xc8f9('0x2d')]='\x22'+_0x544433[_0xc8f9('0x49')]+_0xc8f9('0x4d')+_0x544433[_0xc8f9('0x49')]+'>';}if(!_[_0xc8f9('0x20')](_0x544433['variable'][_0xc8f9('0x4e')])||!_['isNil'](_0x544433[_0xc8f9('0x46')]['xmd-callerid'])){utils['info'](util[_0xc8f9('0x8')](_0xc8f9('0x4f'),_0x544433[_0xc8f9('0xa')],!_[_0xc8f9('0x20')](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x4e')])?_0xc8f9('0x4e'):_0xc8f9('0x50'),_0x544433['value']));channels[_0x544433[_0xc8f9('0xa')]]['callerid']=_0x544433[_0xc8f9('0x49')];}if(!_['isNil'](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x51')])||!_['isNil'](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x52')])){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x4f'),_0x544433[_0xc8f9('0xa')],!_[_0xc8f9('0x20')](_0x544433['variable'][_0xc8f9('0x51')])?_0xc8f9('0x51'):_0xc8f9('0x52'),_0x544433[_0xc8f9('0x49')]));channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0x53')]=_0xc8f9('0x54');channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0x55')]=_0x544433[_0xc8f9('0x49')];channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0xc')]=!![];}if(!_[_0xc8f9('0x20')](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x56')])){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x57'),_0x544433[_0xc8f9('0xa')],_0x544433['value']));channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0x58')]=_0x544433[_0xc8f9('0x49')];}if(!_[_0xc8f9('0x20')](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x59')])){utils['info'](util['format'](_0xc8f9('0x5a'),_0x544433[_0xc8f9('0xa')],_0x544433[_0xc8f9('0x49')]));channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0x5b')]=_0x544433['value'];}if(!_['isNil'](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x5c')])){utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x544433[_0xc8f9('0xa')],_0x544433[_0xc8f9('0x49')]));channels[_0x544433['uniqueid']]['routeid']=_0x544433['value'];}if(!_[_0xc8f9('0x20')](_0x544433[_0xc8f9('0x46')][_0xc8f9('0x5d')])){utils['info'](util[_0xc8f9('0x8')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x544433['uniqueid'],_0x544433[_0xc8f9('0x49')]));channels[_0x544433[_0xc8f9('0xa')]][_0xc8f9('0x5d')]=_0x544433[_0xc8f9('0x49')];}}}catch(_0x186809){utils['error'](util[_0xc8f9('0x8')](_0xc8f9('0x45'),_0x544433[_0xc8f9('0xa')]),_0x186809);}};exports[_0xc8f9('0x5e')]=function(_0x545369){try{if(!_[_0xc8f9('0x20')](channels[_0x545369[_0xc8f9('0xa')]])){utils[_0xc8f9('0x1e')](util[_0xc8f9('0x8')]('[%s][calls][newexten]',_0x545369[_0xc8f9('0xa')]),_0x545369);utils[_0xc8f9('0x7')](util[_0xc8f9('0x8')](_0xc8f9('0x5f'),_0x545369[_0xc8f9('0xa')],_0x545369[_0xc8f9('0x60')],_0x545369['appdata']));if(_0x545369[_0xc8f9('0x60')][_0xc8f9('0x61')]()==_0xc8f9('0x62')&&_[_0xc8f9('0x63')](_0x545369['appdata'][_0xc8f9('0x61')](),_0xc8f9('0x64'))){var _0x4a29bf=_0x545369[_0xc8f9('0x65')][_0xc8f9('0x66')]('=');var _0x3e92e1=_0x4a29bf[0x0][_0xc8f9('0x67')](_0x4a29bf[0x0][_0xc8f9('0x68')]('(')+0x1,_0x4a29bf[0x0][_0xc8f9('0x68')](')'));var _0x4514be=_0x4a29bf[0x1];channels[_0x545369[_0xc8f9('0xa')]][_0x3e92e1]=_0x4514be;}if(!_['includes']([_0xc8f9('0x2b'),_0xc8f9('0x69'),_0xc8f9('0x6a'),_0xc8f9('0x62'),_0xc8f9('0x6b')],_0x545369[_0xc8f9('0x60')][_0xc8f9('0x61')]())){channels[_0x545369[_0xc8f9('0xa')]]['lastapplication']=_0x545369['application'];channels[_0x545369[_0xc8f9('0xa')]][_0xc8f9('0x55')]=_0x545369['appdata'];}}}catch(_0x276f59){utils[_0xc8f9('0x1c')](util[_0xc8f9('0x8')]('[%s][calls][newexten]',_0x545369['uniqueid']),_0x276f59);}}; \ No newline at end of file +var _0xc56a=['context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed'];(function(_0x4a7b2b,_0x1e0354){var _0x5601b4=function(_0x3453f3){while(--_0x3453f3){_0x4a7b2b['push'](_0x4a7b2b['shift']());}};_0x5601b4(++_0x1e0354);}(_0xc56a,0x13d));var _0xac56=function(_0x34e164,_0x12fd46){_0x34e164=_0x34e164-0x0;var _0x5cf8b2=_0xc56a[_0x34e164];return _0x5cf8b2;};'use strict';var _=require(_0xac56('0x0'));var util=require(_0xac56('0x1'));var utils=require(_0xac56('0x2'));var dispositions=[_0xac56('0x3'),'FAILED','FAILED','NO\x20ANSWER',_0xac56('0x3'),_0xac56('0x3'),_0xac56('0x4'),_0xac56('0x5'),_0xac56('0x6'),'FAILED',_0xac56('0x6')];var channels={};function writeDB(_0x422d3c){utils[_0xac56('0x7')](util[_0xac56('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x422d3c[_0xac56('0x9')],_0x422d3c[_0xac56('0xa')],_0x422d3c[_0xac56('0xb')],_0x422d3c[_0xac56('0xc')],_0x422d3c[_0xac56('0xd')],_0x422d3c[_0xac56('0xe')],_0x422d3c[_0xac56('0xf')],_0x422d3c[_0xac56('0x10')]));if(_0x422d3c['accountcode']){utils[_0xac56('0x11')](_0x422d3c[_0xac56('0x12')])[_0xac56('0x13')](function(_0x23ad04){if(_0x23ad04){_0x422d3c[_0xac56('0x14')]=_0x23ad04['id'];}utils[_0xac56('0x15')](_0xac56('0x16'),_0x422d3c);});}else{utils[_0xac56('0x15')](_0xac56('0x16'),_0x422d3c);}if(channels[_0x422d3c[_0xac56('0x9')]]){delete channels[_0x422d3c[_0xac56('0x9')]];}}exports[_0xac56('0x17')]=function(_0x3111dd){try{utils[_0xac56('0x18')](util[_0xac56('0x8')](_0xac56('0x19'),_0x3111dd[_0xac56('0x9')]),_0x3111dd);if(_0x3111dd[_0xac56('0x9')]==_0x3111dd[_0xac56('0x1a')]&&_0x3111dd[_0xac56('0xa')]!=_0xac56('0x1b')){utils[_0xac56('0x7')](util[_0xac56('0x8')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3111dd[_0xac56('0x9')],_0x3111dd[_0xac56('0x1c')],_0x3111dd[_0xac56('0x1d')]));channels[_0x3111dd['uniqueid']]={'uniqueid':_0x3111dd['uniqueid'],'accountcode':_0x3111dd[_0xac56('0x12')],'source':_0x3111dd[_0xac56('0xe')],'destination':_0x3111dd[_0xac56('0x1d')],'destinationcontext':_0x3111dd['context'],'channel':_0x3111dd[_0xac56('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xac56('0x1e')};}}catch(_0x319f30){utils[_0xac56('0x1f')](util[_0xac56('0x8')](_0xac56('0x19'),_0x3111dd[_0xac56('0x9')]),_0x319f30);}};exports[_0xac56('0x20')]=function(_0x109d1c){try{utils['debug'](util[_0xac56('0x8')](_0xac56('0x21'),_0x109d1c[_0xac56('0x9')]),_0x109d1c);if(!_[_0xac56('0x22')](channels[_0x109d1c[_0xac56('0x9')]])&&_0x109d1c[_0xac56('0x23')]==0x6){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x24'),_0x109d1c[_0xac56('0x9')],_0x109d1c['context'],_0x109d1c['channel']));if(_['isNil'](channels[_0x109d1c['uniqueid']]['systemanswertime'])){channels[_0x109d1c['uniqueid']]['systemanswertime']=utils['now']();}}else if(!_['isNil'](channels[_0x109d1c[_0xac56('0x1a')]])&&_0x109d1c['channelstate']==0x6&&_0x109d1c[_0xac56('0x1c')]!=_0xac56('0x25')){utils['info'](util[_0xac56('0x8')](_0xac56('0x26'),_0x109d1c[_0xac56('0x9')],_0x109d1c[_0xac56('0x1a')],_0x109d1c['context'],_0x109d1c[_0xac56('0xa')]));channels[_0x109d1c[_0xac56('0x1a')]][_0xac56('0x12')]=_0x109d1c[_0xac56('0x12')];channels[_0x109d1c[_0xac56('0x1a')]][_0xac56('0x27')]=_0x109d1c[_0xac56('0xa')];if(_[_0xac56('0x22')](channels[_0x109d1c['linkedid']]['answertime'])){channels[_0x109d1c[_0xac56('0x1a')]][_0xac56('0x28')]=utils[_0xac56('0x29')]();}channels[_0x109d1c[_0xac56('0x1a')]][_0xac56('0x2a')]=dispositions[_[_0xac56('0x2b')](_0x109d1c['channelstate'])]||'ANSWERED';}}catch(_0x444242){utils[_0xac56('0x1f')](util[_0xac56('0x8')](_0xac56('0x21'),_0x109d1c[_0xac56('0x9')]),_0x444242);}};exports[_0xac56('0x2c')]=function(_0x49ffa8){try{if(!_[_0xac56('0x22')](channels[_0x49ffa8[_0xac56('0x9')]])){utils[_0xac56('0x18')](util[_0xac56('0x8')](_0xac56('0x2d'),_0x49ffa8[_0xac56('0x9')]),_0x49ffa8);if(_[_0xac56('0x22')](channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x2e')])){channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x2e')]=_0x49ffa8['calleridname']+'\x20<'+_0x49ffa8['calleridnum']+'>';}utils['info'](util['format'](_0xac56('0x2f'),_0x49ffa8[_0xac56('0x9')],channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x2e')],_0x49ffa8[_0xac56('0x30')]));channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x31')]=utils[_0xac56('0x29')]();channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x32')]=utils[_0xac56('0x33')](channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x31')],channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x34')]);channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x35')]=channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x28')]?utils[_0xac56('0x33')](channels[_0x49ffa8[_0xac56('0x9')]][_0xac56('0x31')],channels[_0x49ffa8['uniqueid']][_0xac56('0x28')]):0x0;writeDB(channels[_0x49ffa8[_0xac56('0x9')]]);}}catch(_0x36674d){utils[_0xac56('0x1f')](util['format'](_0xac56('0x2d'),_0x49ffa8[_0xac56('0x9')]),_0x36674d);}};exports[_0xac56('0x36')]=function(_0x4c0d18){try{if(!_[_0xac56('0x22')](channels[_0x4c0d18[_0xac56('0x37')]])){utils[_0xac56('0x18')](util['format'](_0xac56('0x38'),_0x4c0d18[_0xac56('0x39')]),_0x4c0d18);if(channels[_0x4c0d18[_0xac56('0x37')]][_0xac56('0xa')]==_0x4c0d18[_0xac56('0x3a')]){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x3b'),_0x4c0d18['origtransfereruniqueid'],_0x4c0d18[_0xac56('0x37')],_0x4c0d18['secondtransfererchannel']));channels[_0x4c0d18[_0xac56('0x37')]]['destinationchannel']=_0x4c0d18[_0xac56('0x3c')];channels[_0x4c0d18['localtwolinkedid']][_0xac56('0x3d')]='_attended';}else if(channels[_0x4c0d18[_0xac56('0x37')]][_0xac56('0xa')]=_0x4c0d18[_0xac56('0x3e')]){utils[_0xac56('0x7')](util[_0xac56('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4c0d18[_0xac56('0x39')],_0x4c0d18['localtwolinkedid'],_0x4c0d18[_0xac56('0x3f')]));channels[_0x4c0d18[_0xac56('0x37')]]['destinationchannel']=_0x4c0d18[_0xac56('0x3f')];channels[_0x4c0d18[_0xac56('0x37')]][_0xac56('0x3d')]=_0xac56('0x40');}}}catch(_0x1a2109){utils['error'](util[_0xac56('0x8')](_0xac56('0x38'),_0x4c0d18[_0xac56('0x39')]),_0x1a2109);}};exports[_0xac56('0x41')]=function(_0x262e71){try{if(!_[_0xac56('0x22')](channels[_0x262e71[_0xac56('0x9')]])){utils['debug'](util[_0xac56('0x8')](_0xac56('0x42'),_0x262e71['uniqueid']),_0x262e71);channels[_0x262e71[_0xac56('0x9')]][_0xac56('0x43')]=utils['now']();utils['info'](util['format'](_0xac56('0x44'),_0x262e71[_0xac56('0x9')],channels[_0x262e71['uniqueid']][_0xac56('0x43')]));}}catch(_0x4cef09){utils[_0xac56('0x1f')](util['format'](_0xac56('0x42'),_0x262e71[_0xac56('0x9')]),_0x4cef09);}};exports[_0xac56('0x45')]=function(_0x8d6875){try{if(!_[_0xac56('0x22')](channels[_0x8d6875[_0xac56('0x9')]])){utils[_0xac56('0x18')](util[_0xac56('0x8')]('[%s][calls][musiconholdstop]',_0x8d6875[_0xac56('0x9')]),_0x8d6875);if(!_[_0xac56('0x22')](channels[_0x8d6875[_0xac56('0x9')]][_0xac56('0x43')])){channels[_0x8d6875['uniqueid']]['mohtime']+=utils[_0xac56('0x33')](utils[_0xac56('0x29')](),channels[_0x8d6875['uniqueid']][_0xac56('0x43')]);utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x46'),_0x8d6875[_0xac56('0x9')],channels[_0x8d6875[_0xac56('0x9')]][_0xac56('0x47')]));delete channels[_0x8d6875[_0xac56('0x9')]][_0xac56('0x43')];}}}catch(_0x5f27ba){utils['error'](util['format'](_0xac56('0x48'),_0x8d6875[_0xac56('0x9')]),_0x5f27ba);}};exports[_0xac56('0x49')]=function(_0x3264d9){try{if(!_[_0xac56('0x22')](channels[_0x3264d9[_0xac56('0x9')]])){utils['debug'](util[_0xac56('0x8')]('[%s][calls][varset]',_0x3264d9[_0xac56('0x9')]),_0x3264d9);if(!_['isNil'](_0x3264d9['variable']['xmd-originatecalleridnum'])){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x4a'),_0x3264d9[_0xac56('0x9')],_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9[_0xac56('0x9')]]['source']=_0x3264d9[_0xac56('0x4b')];}if(!_['isNil'](_0x3264d9[_0xac56('0x4c')][_0xac56('0x4d')])){utils['info'](util[_0xac56('0x8')](_0xac56('0x4e'),_0x3264d9[_0xac56('0x9')],_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x4f')]=_0x3264d9[_0xac56('0x4b')];channels[_0x3264d9['uniqueid']][_0xac56('0x2e')]='\x22'+_0x3264d9[_0xac56('0x4b')]+_0xac56('0x50')+_0x3264d9[_0xac56('0x4b')]+'>';}if(!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')]['xmd-callerid-preview'])||!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')]['xmd-callerid'])){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x51'),_0x3264d9[_0xac56('0x9')],!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')]['xmd-callerid-preview'])?'xmd-callerid-preview':'xmd-callerid',_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9['uniqueid']][_0xac56('0x2e')]=_0x3264d9[_0xac56('0x4b')];}if(!_['isNil'](_0x3264d9[_0xac56('0x4c')]['xmd-queue'])||!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')][_0xac56('0x52')])){utils[_0xac56('0x7')](util['format'](_0xac56('0x51'),_0x3264d9['uniqueid'],!_['isNil'](_0x3264d9[_0xac56('0x4c')][_0xac56('0x53')])?_0xac56('0x53'):_0xac56('0x52'),_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x54')]=_0xac56('0x55');channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x56')]=_0x3264d9[_0xac56('0x4b')];channels[_0x3264d9['uniqueid']][_0xac56('0xb')]=!![];}if(!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')][_0xac56('0x57')])){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x58'),_0x3264d9[_0xac56('0x9')],_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x59')]=_0x3264d9['value'];}if(!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')][_0xac56('0x5a')])){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x5b'),_0x3264d9[_0xac56('0x9')],_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x5c')]=_0x3264d9[_0xac56('0x4b')];}if(!_['isNil'](_0x3264d9[_0xac56('0x4c')][_0xac56('0x5d')])){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x5e'),_0x3264d9['uniqueid'],_0x3264d9[_0xac56('0x4b')]));channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x5f')]=_0x3264d9[_0xac56('0x4b')];}if(!_[_0xac56('0x22')](_0x3264d9[_0xac56('0x4c')][_0xac56('0x60')])){utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x61'),_0x3264d9[_0xac56('0x9')],_0x3264d9['value']));channels[_0x3264d9[_0xac56('0x9')]][_0xac56('0x60')]=_0x3264d9[_0xac56('0x4b')];}}}catch(_0x40c8f4){utils[_0xac56('0x1f')](util[_0xac56('0x8')](_0xac56('0x62'),_0x3264d9[_0xac56('0x9')]),_0x40c8f4);}};exports[_0xac56('0x63')]=function(_0x3275af){try{if(!_['isNil'](channels[_0x3275af['uniqueid']])){utils['debug'](util[_0xac56('0x8')](_0xac56('0x64'),_0x3275af['uniqueid']),_0x3275af);utils[_0xac56('0x7')](util[_0xac56('0x8')](_0xac56('0x65'),_0x3275af[_0xac56('0x9')],_0x3275af[_0xac56('0x66')],_0x3275af['appdata']));if(_0x3275af[_0xac56('0x66')]['toLowerCase']()=='set'&&_[_0xac56('0x67')](_0x3275af[_0xac56('0x68')][_0xac56('0x69')](),_0xac56('0x6a'))){var _0x12b8f5=_0x3275af['appdata'][_0xac56('0x6b')]('=');var _0x51b97a=_0x12b8f5[0x0][_0xac56('0x6c')](_0x12b8f5[0x0][_0xac56('0x6d')]('(')+0x1,_0x12b8f5[0x0][_0xac56('0x6d')](')'));var _0x2fa190=_0x12b8f5[0x1];channels[_0x3275af[_0xac56('0x9')]][_0x51b97a]=_0x2fa190;}if(!_[_0xac56('0x6e')]([_0xac56('0x2c'),_0xac56('0x6f'),_0xac56('0x70'),_0xac56('0x71'),_0xac56('0x72')],_0x3275af[_0xac56('0x66')][_0xac56('0x69')]())){channels[_0x3275af[_0xac56('0x9')]][_0xac56('0x54')]=_0x3275af[_0xac56('0x66')];channels[_0x3275af[_0xac56('0x9')]][_0xac56('0x56')]=_0x3275af[_0xac56('0x68')];}}}catch(_0x5c5295){utils['error'](util[_0xac56('0x8')](_0xac56('0x64'),_0x3275af[_0xac56('0x9')]),_0x5c5295);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3db47ee..79d4be6 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 _0x3637=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','[core]\x20connected','shutdown','info'];(function(_0x3bbb76,_0x1828c8){var _0x170407=function(_0x407127){while(--_0x407127){_0x3bbb76['push'](_0x3bbb76['shift']());}};_0x170407(++_0x1828c8);}(_0x3637,0xc2));var _0x7363=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x3637[_0x3e7804];return _0x56efda;};'use strict';var utils=require(_0x7363('0x0'));exports['connect']=function(){utils['info'](_0x7363('0x1'));};exports[_0x7363('0x2')]=function(){utils[_0x7363('0x3')](_0x7363('0x4'));};exports[_0x7363('0x5')]=function(){utils[_0x7363('0x3')](_0x7363('0x6'));};exports['error']=function(_0x50d156){utils[_0x7363('0x7')](_0x7363('0x8'),_0x50d156);};exports[_0x7363('0x9')]=function(){utils[_0x7363('0x3')](_0x7363('0xa'));};exports['managerevent']=function(_0x108053){}; \ No newline at end of file +var _0xbf70=['shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected'];(function(_0x1e6245,_0x36e4cc){var _0x490cb9=function(_0x5ecd78){while(--_0x5ecd78){_0x1e6245['push'](_0x1e6245['shift']());}};_0x490cb9(++_0x36e4cc);}(_0xbf70,0x1cb));var _0x0bf7=function(_0x4a211f,_0x13534b){_0x4a211f=_0x4a211f-0x0;var _0x34b889=_0xbf70[_0x4a211f];return _0x34b889;};'use strict';var utils=require('./utils');exports[_0x0bf7('0x0')]=function(){utils[_0x0bf7('0x1')](_0x0bf7('0x2'));};exports[_0x0bf7('0x3')]=function(){utils[_0x0bf7('0x1')](_0x0bf7('0x4'));};exports[_0x0bf7('0x5')]=function(){utils[_0x0bf7('0x1')]('[core]\x20fullybooted');};exports[_0x0bf7('0x6')]=function(_0x37e024){utils[_0x0bf7('0x6')](_0x0bf7('0x7'),_0x37e024);};exports[_0x0bf7('0x8')]=function(){utils[_0x0bf7('0x1')](_0x0bf7('0x9'));};exports[_0x0bf7('0xa')]=function(_0x23bd39){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1cbdd8e..6b87476 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 _0xd5cd=['channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','uniqueid','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','startsWith','cdr(routeid)','split','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','isNil','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','connect','answertime','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','[%s][dials][hangup]','lodash','util','./utils','info'];(function(_0x4220d3,_0x3d3e39){var _0x7318ba=function(_0x131926){while(--_0x131926){_0x4220d3['push'](_0x4220d3['shift']());}};_0x7318ba(++_0x3d3e39);}(_0xd5cd,0x15a));var _0xdd5c=function(_0x375dc2,_0x2a5afa){_0x375dc2=_0x375dc2-0x0;var _0x361d81=_0xd5cd[_0x375dc2];return _0x361d81;};'use strict';var _=require(_0xdd5c('0x0'));var util=require(_0xdd5c('0x1'));var utils=require(_0xdd5c('0x2'));var dials={};function writeDB(_0x22151f){utils[_0xdd5c('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x22151f['uniqueid'],_0x22151f[_0xdd5c('0x4')],_0x22151f[_0xdd5c('0x5')],_0x22151f[_0xdd5c('0x6')],_0x22151f[_0xdd5c('0x7')],_0x22151f[_0xdd5c('0x8')]));utils[_0xdd5c('0x9')](_0xdd5c('0xa'),_0x22151f);delete dials[_0x22151f['uniqueid']];}exports[_0xdd5c('0xb')]=function(_0x276837){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x276837[_0xdd5c('0xc')]),_0x276837);utils['info'](util[_0xdd5c('0xd')](_0xdd5c('0xe'),_0x276837[_0xdd5c('0xc')],_0x276837['application'],_0x276837[_0xdd5c('0xf')]));if(_0x276837['application'][_0xdd5c('0x10')]()=='set'&&_[_0xdd5c('0x11')](_0x276837[_0xdd5c('0xf')][_0xdd5c('0x10')](),_0xdd5c('0x12'))){var _0x238b9a=_0x276837[_0xdd5c('0xf')][_0xdd5c('0x13')]('=');dials[_0x276837[_0xdd5c('0xc')]]={'routeId':_0x238b9a[0x1]};}}catch(_0x5dac8d){utils['error'](util[_0xdd5c('0xd')](_0xdd5c('0x14'),_0x276837[_0xdd5c('0xc')]),_0x5dac8d);}};exports[_0xdd5c('0x15')]=function(_0x536614){try{utils[_0xdd5c('0x16')](util[_0xdd5c('0xd')](_0xdd5c('0x17'),_0x536614['uniqueid']),_0x536614);if(!_['isNil'](_0x536614[_0xdd5c('0x18')]['outboundrouteid'])){utils['info'](util[_0xdd5c('0xd')](_0xdd5c('0x19'),_0x536614[_0xdd5c('0xc')],_0x536614[_0xdd5c('0x1a')]));dials[_0x536614[_0xdd5c('0xc')]]={'routeId':_0x536614[_0xdd5c('0x1a')]};}}catch(_0x2f3868){utils[_0xdd5c('0x1b')](util[_0xdd5c('0xd')]('[%s][dials][varset]',_0x536614[_0xdd5c('0xc')]),_0x2f3868);}};exports[_0xdd5c('0x1c')]=function(_0x32a744){try{if(!_[_0xdd5c('0x1d')](dials[_0x32a744[_0xdd5c('0xc')]])){utils['debug'](util[_0xdd5c('0xd')]('[%s][dials][dialbegin]',_0x32a744[_0xdd5c('0xc')]),_0x32a744);dials[_0x32a744[_0xdd5c('0xc')]]=_[_0xdd5c('0x1e')](dials[_0x32a744['uniqueid']],_0x32a744);dials[_0x32a744[_0xdd5c('0xc')]][_0xdd5c('0x1f')]=utils[_0xdd5c('0x20')]();dials[_0x32a744[_0xdd5c('0xc')]][_0xdd5c('0x21')]=_0xdd5c('0x22');utils[_0xdd5c('0x3')](util[_0xdd5c('0xd')](_0xdd5c('0x23'),_0x32a744[_0xdd5c('0xc')],dials[_0x32a744['uniqueid']][_0xdd5c('0x1f')]));}}catch(_0x58248b){utils[_0xdd5c('0x1b')](util['format'](_0xdd5c('0x24'),_0x32a744['uniqueid']),_0x58248b);}};exports[_0xdd5c('0x25')]=function(_0x59ec6f){try{if(!_[_0xdd5c('0x1d')](dials[_0x59ec6f['uniqueid']])){utils['debug'](util[_0xdd5c('0xd')](_0xdd5c('0x26'),_0x59ec6f[_0xdd5c('0xc')]),_0x59ec6f);dials[_0x59ec6f[_0xdd5c('0xc')]][_0xdd5c('0x8')]=_0x59ec6f[_0xdd5c('0x8')];if(_0x59ec6f['dialstatus']==_0xdd5c('0x27')){dials[_0x59ec6f[_0xdd5c('0xc')]]=_[_0xdd5c('0x1e')](dials[_0x59ec6f[_0xdd5c('0xc')]],_0x59ec6f);dials[_0x59ec6f[_0xdd5c('0xc')]]['answertime']=utils[_0xdd5c('0x20')]();dials[_0x59ec6f[_0xdd5c('0xc')]]['lastevent']=_0xdd5c('0x28');utils['info'](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x59ec6f[_0xdd5c('0xc')],_0x59ec6f[_0xdd5c('0x8')],dials[_0x59ec6f['uniqueid']][_0xdd5c('0x29')]));}else{utils[_0xdd5c('0x3')](util[_0xdd5c('0xd')]('[%s][dials][dialend]\x20dialstatus:%s',_0x59ec6f[_0xdd5c('0xc')],_0x59ec6f[_0xdd5c('0x8')]));}}}catch(_0x30d951){utils[_0xdd5c('0x1b')](util[_0xdd5c('0xd')]('[%s][dials][dialend]',_0x59ec6f['uniqueid']),_0x30d951);}};exports['hangup']=function(_0x4d575a){try{if(!_[_0xdd5c('0x1d')](dials[_0x4d575a['uniqueid']])){utils[_0xdd5c('0x16')](util[_0xdd5c('0xd')]('[%s][dials][hangup]',_0x4d575a[_0xdd5c('0xc')]),_0x4d575a);utils[_0xdd5c('0x3')](util[_0xdd5c('0xd')](_0xdd5c('0x2a'),_0x4d575a['uniqueid'],_0x4d575a['calleridnum'],_0x4d575a[_0xdd5c('0x2b')],_0x4d575a['cause-txt']));dials[_0x4d575a[_0xdd5c('0xc')]]=_[_0xdd5c('0x1e')](dials[_0x4d575a['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xdd5c('0x2c')});dials[_0x4d575a[_0xdd5c('0xc')]][_0xdd5c('0x2d')]=utils[_0xdd5c('0x2e')](dials[_0x4d575a['uniqueid']][_0xdd5c('0x2f')],dials[_0x4d575a[_0xdd5c('0xc')]]['starttime']);dials[_0x4d575a[_0xdd5c('0xc')]][_0xdd5c('0x30')]=utils[_0xdd5c('0x2e')](dials[_0x4d575a[_0xdd5c('0xc')]][_0xdd5c('0x29')]||dials[_0x4d575a[_0xdd5c('0xc')]][_0xdd5c('0x2f')],dials[_0x4d575a[_0xdd5c('0xc')]]['starttime']);dials[_0x4d575a[_0xdd5c('0xc')]]['billableseconds']=dials[_0x4d575a[_0xdd5c('0xc')]][_0xdd5c('0x29')]?utils[_0xdd5c('0x2e')](dials[_0x4d575a[_0xdd5c('0xc')]]['endtime'],dials[_0x4d575a[_0xdd5c('0xc')]][_0xdd5c('0x29')]):0x0;writeDB(dials[_0x4d575a[_0xdd5c('0xc')]]);}}catch(_0x44f404){utils[_0xdd5c('0x1b')](util[_0xdd5c('0xd')](_0xdd5c('0x31'),_0x4d575a['uniqueid']),_0x44f404);}}; \ No newline at end of file +var _0x0971=['ANSWER','answertime','now','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','channel','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','uniqueid','newexten','[%s][dials][newexten]','application','appdata','set','toLowerCase','cdr(routeid)','split','varset','debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','assign','starttime','lastevent','called','[%s][dials][dialend]','dialstatus'];(function(_0x323cef,_0x234499){var _0x4063bd=function(_0x498c51){while(--_0x498c51){_0x323cef['push'](_0x323cef['shift']());}};_0x4063bd(++_0x234499);}(_0x0971,0x6e));var _0x1097=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0x0971[_0x3c4e4c];return _0x144a87;};'use strict';var _=require(_0x1097('0x0'));var util=require(_0x1097('0x1'));var utils=require(_0x1097('0x2'));var dials={};function writeDB(_0x2694a7){utils[_0x1097('0x3')](util[_0x1097('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2694a7['uniqueid'],_0x2694a7[_0x1097('0x5')],_0x2694a7[_0x1097('0x6')],_0x2694a7[_0x1097('0x7')],_0x2694a7[_0x1097('0x8')],_0x2694a7['dialstatus']));utils['request'](_0x1097('0x9'),_0x2694a7);delete dials[_0x2694a7[_0x1097('0xa')]];}exports[_0x1097('0xb')]=function(_0x4110c7){try{utils['debug'](util['format'](_0x1097('0xc'),_0x4110c7[_0x1097('0xa')]),_0x4110c7);utils[_0x1097('0x3')](util[_0x1097('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4110c7['uniqueid'],_0x4110c7[_0x1097('0xd')],_0x4110c7[_0x1097('0xe')]));if(_0x4110c7['application']['toLowerCase']()==_0x1097('0xf')&&_['startsWith'](_0x4110c7['appdata'][_0x1097('0x10')](),_0x1097('0x11'))){var _0x41e8fb=_0x4110c7[_0x1097('0xe')][_0x1097('0x12')]('=');dials[_0x4110c7[_0x1097('0xa')]]={'routeId':_0x41e8fb[0x1]};}}catch(_0x234cc2){utils['error'](util['format'](_0x1097('0xc'),_0x4110c7['uniqueid']),_0x234cc2);}};exports[_0x1097('0x13')]=function(_0x51c911){try{utils[_0x1097('0x14')](util[_0x1097('0x4')](_0x1097('0x15'),_0x51c911[_0x1097('0xa')]),_0x51c911);if(!_[_0x1097('0x16')](_0x51c911[_0x1097('0x17')]['outboundrouteid'])){utils[_0x1097('0x3')](util[_0x1097('0x4')](_0x1097('0x18'),_0x51c911[_0x1097('0xa')],_0x51c911[_0x1097('0x19')]));dials[_0x51c911['uniqueid']]={'routeId':_0x51c911[_0x1097('0x19')]};}}catch(_0x2081ab){utils[_0x1097('0x1a')](util[_0x1097('0x4')](_0x1097('0x15'),_0x51c911[_0x1097('0xa')]),_0x2081ab);}};exports[_0x1097('0x1b')]=function(_0x35811c){try{if(!_[_0x1097('0x16')](dials[_0x35811c[_0x1097('0xa')]])){utils['debug'](util[_0x1097('0x4')]('[%s][dials][dialbegin]',_0x35811c['uniqueid']),_0x35811c);dials[_0x35811c[_0x1097('0xa')]]=_[_0x1097('0x1c')](dials[_0x35811c[_0x1097('0xa')]],_0x35811c);dials[_0x35811c['uniqueid']][_0x1097('0x1d')]=utils['now']();dials[_0x35811c[_0x1097('0xa')]][_0x1097('0x1e')]=_0x1097('0x1f');utils['info'](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x35811c[_0x1097('0xa')],dials[_0x35811c[_0x1097('0xa')]][_0x1097('0x1d')]));}}catch(_0x43d6f0){utils[_0x1097('0x1a')](util['format']('[%s][dials][dialbegin]',_0x35811c['uniqueid']),_0x43d6f0);}};exports['dialend']=function(_0x30632d){try{if(!_[_0x1097('0x16')](dials[_0x30632d[_0x1097('0xa')]])){utils[_0x1097('0x14')](util[_0x1097('0x4')](_0x1097('0x20'),_0x30632d['uniqueid']),_0x30632d);dials[_0x30632d['uniqueid']]['dialstatus']=_0x30632d[_0x1097('0x21')];if(_0x30632d[_0x1097('0x21')]==_0x1097('0x22')){dials[_0x30632d['uniqueid']]=_['assign'](dials[_0x30632d[_0x1097('0xa')]],_0x30632d);dials[_0x30632d[_0x1097('0xa')]][_0x1097('0x23')]=utils[_0x1097('0x24')]();dials[_0x30632d[_0x1097('0xa')]][_0x1097('0x1e')]='connect';utils[_0x1097('0x3')](util[_0x1097('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x30632d[_0x1097('0xa')],_0x30632d['dialstatus'],dials[_0x30632d[_0x1097('0xa')]][_0x1097('0x23')]));}else{utils[_0x1097('0x3')](util[_0x1097('0x4')](_0x1097('0x25'),_0x30632d['uniqueid'],_0x30632d[_0x1097('0x21')]));}}}catch(_0x99b450){utils[_0x1097('0x1a')](util['format'](_0x1097('0x20'),_0x30632d['uniqueid']),_0x99b450);}};exports[_0x1097('0x26')]=function(_0x1fb2cc){try{if(!_['isNil'](dials[_0x1fb2cc[_0x1097('0xa')]])){utils[_0x1097('0x14')](util[_0x1097('0x4')](_0x1097('0x27'),_0x1fb2cc['uniqueid']),_0x1fb2cc);utils[_0x1097('0x3')](util[_0x1097('0x4')](_0x1097('0x28'),_0x1fb2cc[_0x1097('0xa')],_0x1fb2cc['calleridnum'],_0x1fb2cc[_0x1097('0x29')],_0x1fb2cc[_0x1097('0x2a')]));dials[_0x1fb2cc['uniqueid']]=_[_0x1097('0x1c')](dials[_0x1fb2cc['uniqueid']],{'endtime':utils[_0x1097('0x24')](),'lastevent':_0x1097('0x2b')});dials[_0x1fb2cc[_0x1097('0xa')]][_0x1097('0x2c')]=utils[_0x1097('0x2d')](dials[_0x1fb2cc[_0x1097('0xa')]]['endtime'],dials[_0x1fb2cc['uniqueid']]['starttime']);dials[_0x1fb2cc[_0x1097('0xa')]]['holdtime']=utils[_0x1097('0x2d')](dials[_0x1fb2cc[_0x1097('0xa')]][_0x1097('0x23')]||dials[_0x1fb2cc[_0x1097('0xa')]][_0x1097('0x2e')],dials[_0x1fb2cc[_0x1097('0xa')]]['starttime']);dials[_0x1fb2cc['uniqueid']][_0x1097('0x2f')]=dials[_0x1fb2cc['uniqueid']]['answertime']?utils[_0x1097('0x2d')](dials[_0x1fb2cc['uniqueid']]['endtime'],dials[_0x1fb2cc[_0x1097('0xa')]][_0x1097('0x23')]):0x0;writeDB(dials[_0x1fb2cc[_0x1097('0xa')]]);}}catch(_0x6466f8){utils[_0x1097('0x1a')](util[_0x1097('0x4')](_0x1097('0x27'),_0x1fb2cc[_0x1097('0xa')]),_0x6466f8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 45bf5cc..804e9c8 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 _0x52aa=['asterisk','username','keepConnected','xdr','disabled','info','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils'];(function(_0x35401d,_0x113e10){var _0x42af93=function(_0xd69fb6){while(--_0xd69fb6){_0x35401d['push'](_0x35401d['shift']());}};_0x42af93(++_0x113e10);}(_0x52aa,0x1d2));var _0xa52a=function(_0x203fbe,_0x152cd8){_0x203fbe=_0x203fbe-0x0;var _0x28f47e=_0x52aa[_0x203fbe];return _0x28f47e;};var AsteriskManager=require(_0xa52a('0x0'));var config=require(_0xa52a('0x1'));var utils=require(_0xa52a('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xa52a('0x3')]['port'],config[_0xa52a('0x3')]['ip'],config[_0xa52a('0x3')][_0xa52a('0x4')],config[_0xa52a('0x3')]['password'],!![]);ami[_0xa52a('0x5')]();if(config['xdr']&&config[_0xa52a('0x6')][_0xa52a('0x7')]){utils[_0xa52a('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0xa52a('0x9'));var calls=require('./calls.controller');var queues=require(_0xa52a('0xa'));var recordings=require(_0xa52a('0xb'));var members=require(_0xa52a('0xc'));var dials=require(_0xa52a('0xd'));var transfers=require(_0xa52a('0xe'));var core=require(_0xa52a('0xf'));ami['on'](_0xa52a('0x10'),core[_0xa52a('0x10')]);ami['on'](_0xa52a('0x11'),core[_0xa52a('0x11')]);ami['on'](_0xa52a('0x12'),core[_0xa52a('0x12')]);ami['on'](_0xa52a('0x13'),core[_0xa52a('0x13')]);ami['on']('close',core[_0xa52a('0x14')]);ami['on'](_0xa52a('0x15'),core[_0xa52a('0x15')]);ami['on'](_0xa52a('0x16'),function(_0x2b0261){try{utils[_0xa52a('0x17')](util['format'](_0xa52a('0x18'),_0x2b0261[_0xa52a('0x19')]),_0x2b0261);members[_0xa52a('0x16')](_0x2b0261);}catch(_0x436b9f){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x18'),_0x2b0261['device']),_0x436b9f);}});ami['on'](_0xa52a('0x1b'),function(_0x38ba7f){try{utils[_0xa52a('0x17')](util['format'](_0xa52a('0x1c'),_0x38ba7f[_0xa52a('0x1d')]),_0x38ba7f);agents[_0xa52a('0x1b')](_0x38ba7f);}catch(_0x4ff3a2){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x1c'),_0x38ba7f['uniqueid']),_0x4ff3a2);}});ami['on'](_0xa52a('0x1e'),function(_0x45aa0a){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')](_0xa52a('0x1f'),_0x45aa0a['uniqueid']),_0x45aa0a);agents[_0xa52a('0x1e')](_0x45aa0a);}catch(_0x1f4244){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x1f'),_0x45aa0a[_0xa52a('0x1d')]),_0x1f4244);}});ami['on'](_0xa52a('0x20'),function(_0x5ae3e0){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')]('[%s][index][agentconnect]',_0x5ae3e0[_0xa52a('0x1d')]),_0x5ae3e0);agents[_0xa52a('0x20')](_0x5ae3e0);queues[_0xa52a('0x20')](_0x5ae3e0);}catch(_0x112430){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')]('[%s][index][agentconnect]',_0x5ae3e0[_0xa52a('0x1d')]),_0x112430);}});ami['on']('agentcomplete',function(_0x1da638){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')]('[%s][index][agentcomplete]',_0x1da638[_0xa52a('0x1d')]),_0x1da638);agents[_0xa52a('0x21')](_0x1da638);queues[_0xa52a('0x21')](_0x1da638);members[_0xa52a('0x21')](_0x1da638);}catch(_0x1ada77){utils['error'](util[_0xa52a('0x1a')](_0xa52a('0x22'),_0x1da638[_0xa52a('0x1d')]),_0x1ada77);}});ami['on'](_0xa52a('0x23'),function(_0x443204){try{utils[_0xa52a('0x17')](util['format']('[%s][index][queuecallerabandon]',_0x443204[_0xa52a('0x1d')]),_0x443204);agents['queuecallerabandon'](_0x443204);queues['queuecallerabandon'](_0x443204);}catch(_0x3424b8){utils[_0xa52a('0x13')](util['format'](_0xa52a('0x24'),_0x443204['uniqueid']),_0x3424b8);}});ami['on'](_0xa52a('0x25'),function(_0x3fa034){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')](_0xa52a('0x26'),_0x3fa034[_0xa52a('0x1d')]),_0x3fa034);queues[_0xa52a('0x25')](_0x3fa034);recordings[_0xa52a('0x25')](_0x3fa034);}catch(_0x3c72fc){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x26'),_0x3fa034[_0xa52a('0x1d')]),_0x3c72fc);}});ami['on'](_0xa52a('0x27'),function(_0xde07d5){try{utils[_0xa52a('0x17')](util['format'](_0xa52a('0x28'),_0xde07d5[_0xa52a('0x1d')]),_0xde07d5);queues[_0xa52a('0x27')](_0xde07d5);}catch(_0x20bcee){utils[_0xa52a('0x13')](util['format'](_0xa52a('0x28'),_0xde07d5[_0xa52a('0x1d')]),_0x20bcee);}});ami['on'](_0xa52a('0x29'),function(_0x35b3c8){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')]('[%s][index][musiconholdstart]',_0x35b3c8[_0xa52a('0x1d')]),_0x35b3c8);queues[_0xa52a('0x29')](_0x35b3c8);calls[_0xa52a('0x29')](_0x35b3c8);}catch(_0x37fd3e){utils['error'](util[_0xa52a('0x1a')](_0xa52a('0x2a'),_0x35b3c8[_0xa52a('0x1d')]),_0x37fd3e);}});ami['on'](_0xa52a('0x2b'),function(_0x3d90cf){try{utils[_0xa52a('0x17')](util['format'](_0xa52a('0x2c'),_0x3d90cf[_0xa52a('0x1d')]),_0x3d90cf);queues[_0xa52a('0x2b')](_0x3d90cf);calls[_0xa52a('0x2b')](_0x3d90cf);}catch(_0x2621d3){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x3d90cf[_0xa52a('0x1d')]),_0x2621d3);}});ami['on'](_0xa52a('0x2d'),function(_0x5e4645){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')](_0xa52a('0x2e'),_0x5e4645[_0xa52a('0x1d')]),_0x5e4645);calls[_0xa52a('0x2d')](_0x5e4645);recordings[_0xa52a('0x2d')](_0x5e4645);}catch(_0x3a7b9c){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x2e'),_0x5e4645[_0xa52a('0x1d')]),_0x3a7b9c);}});ami['on'](_0xa52a('0x2f'),function(_0x20f15a){try{utils['debug'](util[_0xa52a('0x1a')](_0xa52a('0x30'),_0x20f15a[_0xa52a('0x1d')]),_0x20f15a);calls[_0xa52a('0x2f')](_0x20f15a);recordings['hangup'](_0x20f15a);dials[_0xa52a('0x2f')](_0x20f15a);agents[_0xa52a('0x2f')](_0x20f15a);queues[_0xa52a('0x2f')](_0x20f15a);}catch(_0x489682){utils[_0xa52a('0x13')](util['format'](_0xa52a('0x30'),_0x20f15a[_0xa52a('0x1d')]),_0x489682);}});ami['on'](_0xa52a('0x31'),function(_0xe4ef4c){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')]('[%s][index][cdr]',_0xe4ef4c[_0xa52a('0x1d')]),_0xe4ef4c);members[_0xa52a('0x31')](_0xe4ef4c);}catch(_0x1696a1){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x32'),_0xe4ef4c['uniqueid']),_0x1696a1);}});ami['on'](_0xa52a('0x33'),function(_0x37b05){try{utils[_0xa52a('0x17')](util['format'](_0xa52a('0x34'),_0x37b05[_0xa52a('0x1d')]),_0x37b05);queues[_0xa52a('0x33')](_0x37b05);agents[_0xa52a('0x33')](_0x37b05);transfers[_0xa52a('0x33')](_0x37b05);}catch(_0x42d828){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')]('[%s][index][blindtransfer]',_0x37b05['uniqueid']),_0x42d828);}});ami['on']('attendedtransfer',function(_0x2995c5){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')](_0xa52a('0x35'),_0x2995c5[_0xa52a('0x36')]),_0x2995c5);queues[_0xa52a('0x37')](_0x2995c5);transfers[_0xa52a('0x37')](_0x2995c5);agents[_0xa52a('0x37')](_0x2995c5);calls[_0xa52a('0x37')](_0x2995c5);}catch(_0x1e5b98){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')]('[%s][index][attendedtransfer]',_0x2995c5['origtransfereruniqueid']),_0x1e5b98);}});ami['on'](_0xa52a('0x38'),function(_0x3ce75a){try{utils[_0xa52a('0x17')](util['format']('[%s][index][varset]',_0x3ce75a[_0xa52a('0x1d')]),_0x3ce75a);queues[_0xa52a('0x38')](_0x3ce75a);recordings[_0xa52a('0x38')](_0x3ce75a);calls[_0xa52a('0x38')](_0x3ce75a);dials['varset'](_0x3ce75a);}catch(_0x450fd0){utils[_0xa52a('0x13')](util['format'](_0xa52a('0x39'),_0x3ce75a[_0xa52a('0x1d')]),_0x450fd0);}});ami['on']('newexten',function(_0x7a5373){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')](_0xa52a('0x3a'),_0x7a5373[_0xa52a('0x1d')]),_0x7a5373);calls[_0xa52a('0x3b')](_0x7a5373);recordings[_0xa52a('0x3b')](_0x7a5373);dials[_0xa52a('0x3b')](_0x7a5373);}catch(_0x240ba8){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x3a'),_0x7a5373[_0xa52a('0x1d')]),_0x240ba8);}});ami['on'](_0xa52a('0x3c'),function(_0x38922c){try{utils[_0xa52a('0x17')](util[_0xa52a('0x1a')](_0xa52a('0x3d'),_0x38922c[_0xa52a('0x1d')]),_0x38922c);calls[_0xa52a('0x3c')](_0x38922c);recordings[_0xa52a('0x3c')](_0x38922c);}catch(_0x408b5d){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x3d'),_0x38922c[_0xa52a('0x1d')]),_0x408b5d);}});ami['on'](_0xa52a('0x3e'),function(_0x61baa6){try{utils['debug'](util[_0xa52a('0x1a')](_0xa52a('0x3f'),_0x61baa6[_0xa52a('0x1d')]),_0x61baa6);dials[_0xa52a('0x3e')](_0x61baa6);}catch(_0x4c935a){utils[_0xa52a('0x13')](util['format'](_0xa52a('0x40'),_0x61baa6[_0xa52a('0x1d')]),_0x4c935a);}});ami['on']('dialend',function(_0xc45cc8){try{utils['debug'](util[_0xa52a('0x1a')](_0xa52a('0x41'),_0xc45cc8[_0xa52a('0x1d')]),_0xc45cc8);dials[_0xa52a('0x42')](_0xc45cc8);}catch(_0x57615f){utils[_0xa52a('0x13')](util[_0xa52a('0x1a')](_0xa52a('0x41'),_0xc45cc8[_0xa52a('0x1d')]),_0x57615f);}});} \ No newline at end of file +var _0x02a8=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','username','xdr','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x02a8,0xe1));var _0x802a=function(_0x18a29b,_0x264804){_0x18a29b=_0x18a29b-0x0;var _0x1992b8=_0x02a8[_0x18a29b];return _0x1992b8;};var AsteriskManager=require(_0x802a('0x0'));var config=require(_0x802a('0x1'));var utils=require(_0x802a('0x2'));var util=require(_0x802a('0x3'));var ami=new AsteriskManager(config[_0x802a('0x4')]['port'],config[_0x802a('0x4')]['ip'],config[_0x802a('0x4')][_0x802a('0x5')],config['asterisk']['password'],!![]);ami['keepConnected']();if(config[_0x802a('0x6')]&&config[_0x802a('0x6')]['disabled']){utils['info'](_0x802a('0x7'));}else{var agents=require(_0x802a('0x8'));var calls=require('./calls.controller');var queues=require(_0x802a('0x9'));var recordings=require('./recordings.controller');var members=require(_0x802a('0xa'));var dials=require(_0x802a('0xb'));var transfers=require(_0x802a('0xc'));var core=require(_0x802a('0xd'));ami['on'](_0x802a('0xe'),core['connect']);ami['on'](_0x802a('0xf'),core[_0x802a('0xf')]);ami['on'](_0x802a('0x10'),core[_0x802a('0x10')]);ami['on'](_0x802a('0x11'),core['error']);ami['on'](_0x802a('0x12'),core[_0x802a('0x12')]);ami['on']('managerevent',core[_0x802a('0x13')]);ami['on'](_0x802a('0x14'),function(_0x11e685){try{utils[_0x802a('0x15')](util[_0x802a('0x16')](_0x802a('0x17'),_0x11e685[_0x802a('0x18')]),_0x11e685);members[_0x802a('0x14')](_0x11e685);}catch(_0x2181c3){utils[_0x802a('0x11')](util['format'](_0x802a('0x17'),_0x11e685['device']),_0x2181c3);}});ami['on'](_0x802a('0x19'),function(_0xeb81ec){try{utils[_0x802a('0x15')](util[_0x802a('0x16')](_0x802a('0x1a'),_0xeb81ec[_0x802a('0x1b')]),_0xeb81ec);agents[_0x802a('0x19')](_0xeb81ec);}catch(_0x5a650c){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x1a'),_0xeb81ec['uniqueid']),_0x5a650c);}});ami['on'](_0x802a('0x1c'),function(_0x43447f){try{utils[_0x802a('0x15')](util['format']('[%s][index][agentringnoanswer]',_0x43447f['uniqueid']),_0x43447f);agents[_0x802a('0x1c')](_0x43447f);}catch(_0x2a8e85){utils[_0x802a('0x11')](util[_0x802a('0x16')]('[%s][index][agentringnoanswer]',_0x43447f['uniqueid']),_0x2a8e85);}});ami['on'](_0x802a('0x1d'),function(_0x229b15){try{utils[_0x802a('0x15')](util['format'](_0x802a('0x1e'),_0x229b15[_0x802a('0x1b')]),_0x229b15);agents['agentconnect'](_0x229b15);queues[_0x802a('0x1d')](_0x229b15);}catch(_0x291cad){utils[_0x802a('0x11')](util[_0x802a('0x16')]('[%s][index][agentconnect]',_0x229b15[_0x802a('0x1b')]),_0x291cad);}});ami['on'](_0x802a('0x1f'),function(_0x556d39){try{utils[_0x802a('0x15')](util[_0x802a('0x16')](_0x802a('0x20'),_0x556d39['uniqueid']),_0x556d39);agents['agentcomplete'](_0x556d39);queues[_0x802a('0x1f')](_0x556d39);members[_0x802a('0x1f')](_0x556d39);}catch(_0x2e4c4d){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x20'),_0x556d39[_0x802a('0x1b')]),_0x2e4c4d);}});ami['on'](_0x802a('0x21'),function(_0x24116d){try{utils[_0x802a('0x15')](util[_0x802a('0x16')](_0x802a('0x22'),_0x24116d['uniqueid']),_0x24116d);agents[_0x802a('0x21')](_0x24116d);queues[_0x802a('0x21')](_0x24116d);}catch(_0x53a276){utils[_0x802a('0x11')](util[_0x802a('0x16')]('[%s][index][queuecallerabandon]',_0x24116d[_0x802a('0x1b')]),_0x53a276);}});ami['on'](_0x802a('0x23'),function(_0x137a73){try{utils[_0x802a('0x15')](util[_0x802a('0x16')]('[%s][index][queuecallerjoin]',_0x137a73[_0x802a('0x1b')]),_0x137a73);queues[_0x802a('0x23')](_0x137a73);recordings[_0x802a('0x23')](_0x137a73);}catch(_0x23e868){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x24'),_0x137a73[_0x802a('0x1b')]),_0x23e868);}});ami['on'](_0x802a('0x25'),function(_0x22789e){try{utils[_0x802a('0x15')](util['format'](_0x802a('0x26'),_0x22789e[_0x802a('0x1b')]),_0x22789e);queues[_0x802a('0x25')](_0x22789e);}catch(_0xba09a2){utils[_0x802a('0x11')](util['format']('[%s][index][queuecallerleave]',_0x22789e[_0x802a('0x1b')]),_0xba09a2);}});ami['on'](_0x802a('0x27'),function(_0x5577a8){try{utils['debug'](util[_0x802a('0x16')](_0x802a('0x28'),_0x5577a8[_0x802a('0x1b')]),_0x5577a8);queues[_0x802a('0x27')](_0x5577a8);calls[_0x802a('0x27')](_0x5577a8);}catch(_0xf582df){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x28'),_0x5577a8[_0x802a('0x1b')]),_0xf582df);}});ami['on']('musiconholdstop',function(_0x2139cb){try{utils[_0x802a('0x15')](util['format']('[%s][index][musiconholdstop]',_0x2139cb[_0x802a('0x1b')]),_0x2139cb);queues['musiconholdstop'](_0x2139cb);calls[_0x802a('0x29')](_0x2139cb);}catch(_0x4ef777){utils[_0x802a('0x11')](util['format'](_0x802a('0x2a'),_0x2139cb[_0x802a('0x1b')]),_0x4ef777);}});ami['on']('newstate',function(_0x1293a6){try{utils[_0x802a('0x15')](util['format'](_0x802a('0x2b'),_0x1293a6[_0x802a('0x1b')]),_0x1293a6);calls[_0x802a('0x2c')](_0x1293a6);recordings[_0x802a('0x2c')](_0x1293a6);}catch(_0x183f7d){utils[_0x802a('0x11')](util['format']('[%s][index][newstate]',_0x1293a6['uniqueid']),_0x183f7d);}});ami['on']('hangup',function(_0x18b194){try{utils[_0x802a('0x15')](util[_0x802a('0x16')](_0x802a('0x2d'),_0x18b194[_0x802a('0x1b')]),_0x18b194);calls[_0x802a('0x2e')](_0x18b194);recordings[_0x802a('0x2e')](_0x18b194);dials[_0x802a('0x2e')](_0x18b194);agents[_0x802a('0x2e')](_0x18b194);queues[_0x802a('0x2e')](_0x18b194);}catch(_0x5b63ca){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x2d'),_0x18b194['uniqueid']),_0x5b63ca);}});ami['on'](_0x802a('0x2f'),function(_0x30a085){try{utils['debug'](util[_0x802a('0x16')](_0x802a('0x30'),_0x30a085[_0x802a('0x1b')]),_0x30a085);members[_0x802a('0x2f')](_0x30a085);}catch(_0x567d9c){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x30'),_0x30a085['uniqueid']),_0x567d9c);}});ami['on']('blindtransfer',function(_0x53d77a){try{utils[_0x802a('0x15')](util[_0x802a('0x16')](_0x802a('0x31'),_0x53d77a[_0x802a('0x1b')]),_0x53d77a);queues['blindtransfer'](_0x53d77a);agents[_0x802a('0x32')](_0x53d77a);transfers['blindtransfer'](_0x53d77a);}catch(_0x1330c3){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x31'),_0x53d77a['uniqueid']),_0x1330c3);}});ami['on'](_0x802a('0x33'),function(_0x570707){try{utils[_0x802a('0x15')](util['format']('[%s][index][attendedtransfer]',_0x570707['origtransfereruniqueid']),_0x570707);queues['attendedtransfer'](_0x570707);transfers[_0x802a('0x33')](_0x570707);agents[_0x802a('0x33')](_0x570707);calls['attendedtransfer'](_0x570707);}catch(_0xa70639){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x34'),_0x570707[_0x802a('0x35')]),_0xa70639);}});ami['on'](_0x802a('0x36'),function(_0x29aa0e){try{utils[_0x802a('0x15')](util[_0x802a('0x16')]('[%s][index][varset]',_0x29aa0e['uniqueid']),_0x29aa0e);queues[_0x802a('0x36')](_0x29aa0e);recordings[_0x802a('0x36')](_0x29aa0e);calls[_0x802a('0x36')](_0x29aa0e);dials['varset'](_0x29aa0e);}catch(_0x45e5ee){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x37'),_0x29aa0e['uniqueid']),_0x45e5ee);}});ami['on']('newexten',function(_0x5858c3){try{utils['debug'](util[_0x802a('0x16')](_0x802a('0x38'),_0x5858c3[_0x802a('0x1b')]),_0x5858c3);calls[_0x802a('0x39')](_0x5858c3);recordings['newexten'](_0x5858c3);dials[_0x802a('0x39')](_0x5858c3);}catch(_0x1e663f){utils[_0x802a('0x11')](util[_0x802a('0x16')](_0x802a('0x38'),_0x5858c3[_0x802a('0x1b')]),_0x1e663f);}});ami['on']('newchannel',function(_0x458b80){try{utils[_0x802a('0x15')](util['format'](_0x802a('0x3a'),_0x458b80[_0x802a('0x1b')]),_0x458b80);calls[_0x802a('0x3b')](_0x458b80);recordings[_0x802a('0x3b')](_0x458b80);}catch(_0x7d4e45){utils[_0x802a('0x11')](util[_0x802a('0x16')]('[%s][index][newchannel]',_0x458b80['uniqueid']),_0x7d4e45);}});ami['on']('dialbegin',function(_0x2b0736){try{utils[_0x802a('0x15')](util['format']('[%s][index][dialbegin]',_0x2b0736[_0x802a('0x1b')]),_0x2b0736);dials[_0x802a('0x3c')](_0x2b0736);}catch(_0x2b63e9){utils[_0x802a('0x11')](util['format'](_0x802a('0x3d'),_0x2b0736[_0x802a('0x1b')]),_0x2b63e9);}});ami['on']('dialend',function(_0x1beccd){try{utils[_0x802a('0x15')](util['format'](_0x802a('0x3e'),_0x1beccd[_0x802a('0x1b')]),_0x1beccd);dials[_0x802a('0x3f')](_0x1beccd);}catch(_0x3f7d17){utils[_0x802a('0x11')](util['format'](_0x802a('0x3e'),_0x1beccd[_0x802a('0x1b')]),_0x3f7d17);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 91b065b..11afaf6 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 _0xf31e=['[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','uniqueid'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf31e,0x159));var _0xef31=function(_0x46666b,_0x84908a){_0x46666b=_0x46666b-0x0;var _0x2bebd9=_0xf31e[_0x46666b];return _0x2bebd9;};'use strict';var _=require(_0xef31('0x0'));var util=require('util');var utils=require(_0xef31('0x1'));var members={};var exclude=[_0xef31('0x2'),_0xef31('0x3')];function writeDB(_0x362da9){utils['info'](util[_0xef31('0x4')](_0xef31('0x5'),_0x362da9['uniqueid'],_0x362da9[_0xef31('0x6')],_0x362da9[_0xef31('0x7')],_0x362da9[_0xef31('0x8')],_0x362da9[_0xef31('0x9')],_0x362da9['type']));if(_0x362da9[_0xef31('0x6')]){utils[_0xef31('0xa')](_0x362da9['interface'])[_0xef31('0xb')](function(_0x480b11){if(_0x480b11){_0x362da9['membername']=_0x480b11[_0xef31('0xc')];_0x362da9[_0xef31('0xd')]=_0x480b11['internal'];utils[_0xef31('0xe')](_0xef31('0xf'),_0x362da9);}else{utils[_0xef31('0x10')](_0x362da9[_0xef31('0x6')]['split']('/')[0x1])[_0xef31('0xb')](function(_0x491e35){if(_0x491e35){_0x362da9['membername']=_0x491e35['name'];_0x362da9[_0xef31('0xd')]=_0x491e35[_0xef31('0xd')];utils[_0xef31('0xe')](_0xef31('0xf'),_0x362da9);}});}})[_0xef31('0x11')](function(_0x206bcb){utils[_0xef31('0x12')](util['format'](_0xef31('0x13'),_0x362da9['uniqueid']),_0x206bcb);});}delete members[_0x362da9['interface']];}function startsWith(_0x30871c,_0x218890){return _[_0xef31('0x14')](_0x30871c,function(_0x228858){return _[_0xef31('0x15')](_0x218890,_0x228858);});}exports['devicestatechange']=function(_0x4a639b){try{utils[_0xef31('0x16')](util[_0xef31('0x4')](_0xef31('0x17'),members[_0x4a639b[_0xef31('0x18')]]?members[_0x4a639b[_0xef31('0x18')]][_0xef31('0x19')]:_0x4a639b[_0xef31('0x18')]),_0x4a639b);utils['info'](util[_0xef31('0x4')](_0xef31('0x1a'),members[_0x4a639b[_0xef31('0x18')]]?members[_0x4a639b[_0xef31('0x18')]]['uniqueid']:_0x4a639b[_0xef31('0x18')],_0x4a639b['state'],_0x4a639b[_0xef31('0x18')]));switch(_0x4a639b[_0xef31('0x1b')]){case _0xef31('0x1c'):case _0xef31('0x1d'):if(!startsWith(exclude,_0x4a639b[_0xef31('0x18')])){members[_0x4a639b[_0xef31('0x18')]]={'channel':'voice','interface':_0x4a639b[_0xef31('0x18')],'type':_0xef31('0x1e'),'enterAt':utils[_0xef31('0x1f')](),'role':_0xef31('0x20')};}break;case _0xef31('0x21'):if(!_[_0xef31('0x22')](members[_0x4a639b['device']])){members[_0x4a639b['device']][_0xef31('0x23')]=utils[_0xef31('0x1f')]();members[_0x4a639b[_0xef31('0x18')]][_0xef31('0x24')]=utils['diffTime'](members[_0x4a639b[_0xef31('0x18')]][_0xef31('0x23')],members[_0x4a639b['device']]['enterAt']);if(members[_0x4a639b['device']]['uniqueid']){writeDB(members[_0x4a639b[_0xef31('0x18')]]);}}break;default:break;}}catch(_0x4e8412){utils[_0xef31('0x12')](util[_0xef31('0x4')]('[%s][members][devicestatechange]',members[_0x4a639b[_0xef31('0x18')]]?members[_0x4a639b[_0xef31('0x18')]][_0xef31('0x19')]:_0x4a639b[_0xef31('0x18')]),_0x4e8412);}};exports[_0xef31('0x25')]=function(_0x1de5dd){try{if(!_[_0xef31('0x22')](members[_0x1de5dd[_0xef31('0x6')]])){utils[_0xef31('0x16')](util['format'](_0xef31('0x26'),_0x1de5dd[_0xef31('0x19')]),_0x1de5dd);utils[_0xef31('0x27')](util['format'](_0xef31('0x28'),_0x1de5dd[_0xef31('0x19')],_0x1de5dd['interface'],_0x1de5dd[_0xef31('0x29')]));members[_0x1de5dd['interface']]=_[_0xef31('0x2a')](members[_0x1de5dd[_0xef31('0x6')]],{'data4':_0x1de5dd['queue'],'uniqueid':_0x1de5dd[_0xef31('0x19')]});}}catch(_0x49e729){utils[_0xef31('0x12')](util[_0xef31('0x4')](_0xef31('0x26'),_0x1de5dd[_0xef31('0x19')]),_0x49e729);}};exports[_0xef31('0x2b')]=function(_0x4f2818){try{utils[_0xef31('0x16')](util[_0xef31('0x4')](_0xef31('0x2c'),_0x4f2818[_0xef31('0x19')]),_0x4f2818);if(_0x4f2818[_0xef31('0x7')]){var _0x59206f=_0x4f2818[_0xef31('0x7')][_0xef31('0x2d')]('-')[0x0];if(!_[_0xef31('0x22')](members[_0x59206f])){members[_0x59206f]=_['assign'](members[_0x59206f],{'data1':members[_0x59206f][_0xef31('0x2e')]||_0x4f2818[_0xef31('0x2f')],'data2':members[_0x59206f]['data2']||_0x4f2818[_0xef31('0x30')],'data3':members[_0x59206f][_0xef31('0x31')]||_0x4f2818[_0xef31('0x32')],'uniqueid':members[_0x59206f][_0xef31('0x19')]||_0x4f2818['uniqueid']});utils['info'](util[_0xef31('0x4')](_0xef31('0x33'),_0x4f2818[_0xef31('0x19')],members[_0x59206f][_0xef31('0x2e')],members[_0x59206f][_0xef31('0x8')],members[_0x59206f]['data3']));if(members[_0x59206f][_0xef31('0x23')]){writeDB(members[_0x59206f]);}}}if(_0x4f2818[_0xef31('0x34')]){var _0x2c1703=_0x4f2818[_0xef31('0x34')]['split']('-')[0x0];if(!_[_0xef31('0x22')](members[_0x2c1703])){members[_0x2c1703]=_[_0xef31('0x2a')](members[_0x2c1703],{'data1':members[_0x2c1703][_0xef31('0x2e')]||_0x4f2818[_0xef31('0x2f')],'data2':members[_0x2c1703][_0xef31('0x8')]||_0x4f2818[_0xef31('0x30')],'data3':members[_0x2c1703]['data3']||_0x4f2818[_0xef31('0x32')],'uniqueid':members[_0x2c1703]['uniqueid']||_0x4f2818[_0xef31('0x19')]});utils['info'](util['format'](_0xef31('0x33'),_0x4f2818['uniqueid'],members[_0x2c1703][_0xef31('0x2e')],members[_0x2c1703][_0xef31('0x8')],members[_0x2c1703][_0xef31('0x31')]));if(members[_0x2c1703][_0xef31('0x23')]){writeDB(members[_0x2c1703]);}}}}catch(_0x2e116b){utils[_0xef31('0x12')](util['format'](_0xef31('0x2c'),_0x4f2818[_0xef31('0x19')]),_0x2e116b);}}; \ No newline at end of file +var _0xd66c=['error','some','devicestatechange','device','state','INUSE','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','debug','queue','[%s][members][agentcomplete]','[%s][members][cdr]','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','type','then','membername','name','request','CreateMemberReport','getUserByName','split','internal','catch'];(function(_0x3befc5,_0xc3742){var _0x564b1c=function(_0x50506d){while(--_0x50506d){_0x3befc5['push'](_0x3befc5['shift']());}};_0x564b1c(++_0xc3742);}(_0xd66c,0x1a4));var _0xcd66=function(_0x27ea2a,_0x25fa5d){_0x27ea2a=_0x27ea2a-0x0;var _0x4ceca1=_0xd66c[_0x27ea2a];return _0x4ceca1;};'use strict';var _=require(_0xcd66('0x0'));var util=require(_0xcd66('0x1'));var utils=require('./utils');var members={};var exclude=[_0xcd66('0x2'),_0xcd66('0x3')];function writeDB(_0x6d82a4){utils[_0xcd66('0x4')](util[_0xcd66('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x6d82a4[_0xcd66('0x6')],_0x6d82a4[_0xcd66('0x7')],_0x6d82a4[_0xcd66('0x8')],_0x6d82a4[_0xcd66('0x9')],_0x6d82a4['membername'],_0x6d82a4[_0xcd66('0xa')]));if(_0x6d82a4['interface']){utils['getUserByInterface'](_0x6d82a4[_0xcd66('0x7')])[_0xcd66('0xb')](function(_0x2164e1){if(_0x2164e1){_0x6d82a4[_0xcd66('0xc')]=_0x2164e1[_0xcd66('0xd')];_0x6d82a4['internal']=_0x2164e1['internal'];utils[_0xcd66('0xe')](_0xcd66('0xf'),_0x6d82a4);}else{utils[_0xcd66('0x10')](_0x6d82a4[_0xcd66('0x7')][_0xcd66('0x11')]('/')[0x1])[_0xcd66('0xb')](function(_0x3225d9){if(_0x3225d9){_0x6d82a4['membername']=_0x3225d9[_0xcd66('0xd')];_0x6d82a4[_0xcd66('0x12')]=_0x3225d9[_0xcd66('0x12')];utils[_0xcd66('0xe')](_0xcd66('0xf'),_0x6d82a4);}});}})[_0xcd66('0x13')](function(_0x540faf){utils[_0xcd66('0x14')](util[_0xcd66('0x5')]('[%s][members][writeDB]',_0x6d82a4[_0xcd66('0x6')]),_0x540faf);});}delete members[_0x6d82a4[_0xcd66('0x7')]];}function startsWith(_0x4d9564,_0x3de99f){return _[_0xcd66('0x15')](_0x4d9564,function(_0x97b561){return _['startsWith'](_0x3de99f,_0x97b561);});}exports[_0xcd66('0x16')]=function(_0xab4512){try{utils['debug'](util['format']('[%s][members][devicestatechange]',members[_0xab4512[_0xcd66('0x17')]]?members[_0xab4512[_0xcd66('0x17')]][_0xcd66('0x6')]:_0xab4512[_0xcd66('0x17')]),_0xab4512);utils[_0xcd66('0x4')](util[_0xcd66('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xab4512['device']]?members[_0xab4512[_0xcd66('0x17')]][_0xcd66('0x6')]:_0xab4512[_0xcd66('0x17')],_0xab4512[_0xcd66('0x18')],_0xab4512[_0xcd66('0x17')]));switch(_0xab4512[_0xcd66('0x18')]){case _0xcd66('0x19'):case'BUSY':if(!startsWith(exclude,_0xab4512[_0xcd66('0x17')])){members[_0xab4512[_0xcd66('0x17')]]={'channel':'voice','interface':_0xab4512[_0xcd66('0x17')],'type':'TALKING','enterAt':utils[_0xcd66('0x1a')](),'role':_0xcd66('0x1b')};}break;case _0xcd66('0x1c'):if(!_[_0xcd66('0x1d')](members[_0xab4512[_0xcd66('0x17')]])){members[_0xab4512[_0xcd66('0x17')]][_0xcd66('0x1e')]=utils[_0xcd66('0x1a')]();members[_0xab4512[_0xcd66('0x17')]]['duration']=utils[_0xcd66('0x1f')](members[_0xab4512[_0xcd66('0x17')]][_0xcd66('0x1e')],members[_0xab4512[_0xcd66('0x17')]][_0xcd66('0x20')]);if(members[_0xab4512[_0xcd66('0x17')]][_0xcd66('0x6')]){writeDB(members[_0xab4512[_0xcd66('0x17')]]);}}break;default:break;}}catch(_0x6dcea5){utils[_0xcd66('0x14')](util[_0xcd66('0x5')]('[%s][members][devicestatechange]',members[_0xab4512[_0xcd66('0x17')]]?members[_0xab4512[_0xcd66('0x17')]]['uniqueid']:_0xab4512[_0xcd66('0x17')]),_0x6dcea5);}};exports['agentcomplete']=function(_0x286c6a){try{if(!_[_0xcd66('0x1d')](members[_0x286c6a[_0xcd66('0x7')]])){utils[_0xcd66('0x21')](util['format']('[%s][members][agentcomplete]',_0x286c6a['uniqueid']),_0x286c6a);utils['info'](util[_0xcd66('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x286c6a[_0xcd66('0x6')],_0x286c6a['interface'],_0x286c6a[_0xcd66('0x22')]));members[_0x286c6a[_0xcd66('0x7')]]=_['assign'](members[_0x286c6a[_0xcd66('0x7')]],{'data4':_0x286c6a[_0xcd66('0x22')],'uniqueid':_0x286c6a[_0xcd66('0x6')]});}}catch(_0x5d1f85){utils['error'](util['format'](_0xcd66('0x23'),_0x286c6a[_0xcd66('0x6')]),_0x5d1f85);}};exports['cdr']=function(_0x1d30d4){try{utils[_0xcd66('0x21')](util[_0xcd66('0x5')](_0xcd66('0x24'),_0x1d30d4[_0xcd66('0x6')]),_0x1d30d4);if(_0x1d30d4[_0xcd66('0x8')]){var _0x214ca6=_0x1d30d4[_0xcd66('0x8')][_0xcd66('0x11')]('-')[0x0];if(!_[_0xcd66('0x1d')](members[_0x214ca6])){members[_0x214ca6]=_[_0xcd66('0x25')](members[_0x214ca6],{'data1':members[_0x214ca6][_0xcd66('0x26')]||_0x1d30d4[_0xcd66('0xa')],'data2':members[_0x214ca6][_0xcd66('0x9')]||_0x1d30d4[_0xcd66('0x27')],'data3':members[_0x214ca6]['data3']||_0x1d30d4[_0xcd66('0x28')],'uniqueid':members[_0x214ca6][_0xcd66('0x6')]||_0x1d30d4[_0xcd66('0x6')]});utils['info'](util[_0xcd66('0x5')](_0xcd66('0x29'),_0x1d30d4[_0xcd66('0x6')],members[_0x214ca6][_0xcd66('0x26')],members[_0x214ca6][_0xcd66('0x9')],members[_0x214ca6][_0xcd66('0x2a')]));if(members[_0x214ca6][_0xcd66('0x1e')]){writeDB(members[_0x214ca6]);}}}if(_0x1d30d4[_0xcd66('0x2b')]){var _0x577dff=_0x1d30d4[_0xcd66('0x2b')][_0xcd66('0x11')]('-')[0x0];if(!_[_0xcd66('0x1d')](members[_0x577dff])){members[_0x577dff]=_['assign'](members[_0x577dff],{'data1':members[_0x577dff][_0xcd66('0x26')]||_0x1d30d4[_0xcd66('0xa')],'data2':members[_0x577dff][_0xcd66('0x9')]||_0x1d30d4[_0xcd66('0x27')],'data3':members[_0x577dff]['data3']||_0x1d30d4['destination'],'uniqueid':members[_0x577dff][_0xcd66('0x6')]||_0x1d30d4[_0xcd66('0x6')]});utils[_0xcd66('0x4')](util[_0xcd66('0x5')](_0xcd66('0x29'),_0x1d30d4[_0xcd66('0x6')],members[_0x577dff][_0xcd66('0x26')],members[_0x577dff]['data2'],members[_0x577dff]['data3']));if(members[_0x577dff]['exitAt']){writeDB(members[_0x577dff]);}}}}catch(_0x1b0ce0){utils[_0xcd66('0x14')](util[_0xcd66('0x5')]('[%s][members][cdr]',_0x1d30d4['uniqueid']),_0x1b0ce0);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d8dc01e..6f7d076 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 _0x4137=['blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%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','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','position','now','error','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s'];(function(_0x13c5bf,_0x336fca){var _0x242af1=function(_0xe19740){while(--_0xe19740){_0x13c5bf['push'](_0x13c5bf['shift']());}};_0x242af1(++_0x336fca);}(_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 utils=require(_0x7413('0x2'));var queues={};function writeDB(_0x4f372c){utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x5'),_0x4f372c[_0x7413('0x6')],_0x4f372c[_0x7413('0x7')],_0x4f372c[_0x7413('0x8')],_0x4f372c[_0x7413('0x9')],_0x4f372c[_0x7413('0xa')],_0x4f372c['accountcode'],_0x4f372c[_0x7413('0xb')]));if(_0x4f372c[_0x7413('0x8')]){utils[_0x7413('0xc')](_0x4f372c[_0x7413('0x8')])['then'](function(_0x3236ec){if(_0x3236ec){_0x4f372c[_0x7413('0xd')]=_0x3236ec['type'];}utils[_0x7413('0xe')](_0x7413('0xf'),_0x4f372c);});}else{utils['request'](_0x7413('0xf'),_0x4f372c);}if(_0x4f372c[_0x7413('0x10')]){delete queues[_0x4f372c[_0x7413('0x10')]];}else{delete queues[_0x4f372c[_0x7413('0x6')]];}}exports[_0x7413('0x11')]=function(_0x5a1e62){try{utils[_0x7413('0x12')](util[_0x7413('0x4')]('[%s][queues][queuecallerjoin]',_0x5a1e62[_0x7413('0x6')]),_0x5a1e62);utils[_0x7413('0x3')](util[_0x7413('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5a1e62['uniqueid'],_0x5a1e62['queue'],_0x5a1e62[_0x7413('0x13')]));queues[_0x5a1e62[_0x7413('0x6')]]=_['assign'](_0x5a1e62,{'originalposition':_0x5a1e62[_0x7413('0x13')],'queuecallerjoinAt':utils[_0x7413('0x14')](),'mohtime':0x0});}catch(_0x4955d3){utils[_0x7413('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x5a1e62[_0x7413('0x6')]),_0x4955d3);}};exports['hangup']=function(_0x195c72){try{if(!_['isNil'](queues[_0x195c72[_0x7413('0x6')]])){utils[_0x7413('0x12')](util[_0x7413('0x4')](_0x7413('0x16'),_0x195c72[_0x7413('0x6')]),_0x195c72);if(queues[_0x195c72[_0x7413('0x6')]]['queuecallerleaveAt']){if(!queues[_0x195c72[_0x7413('0x6')]][_0x7413('0x17')]&&!queues[_0x195c72[_0x7413('0x6')]][_0x7413('0x18')]){queues[_0x195c72['uniqueid']][_0x7413('0x19')]=!![];queues[_0x195c72[_0x7413('0x6')]][_0x7413('0x1a')]=utils[_0x7413('0x14')]();queues[_0x195c72[_0x7413('0x6')]][_0x7413('0xb')]=_0x7413('0x1b');}utils[_0x7413('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x195c72[_0x7413('0x6')],queues[_0x195c72['uniqueid']][_0x7413('0x1c')],queues[_0x195c72[_0x7413('0x6')]][_0x7413('0xb')]));writeDB(queues[_0x195c72[_0x7413('0x6')]]);}else if(queues[_0x195c72[_0x7413('0x6')]][_0x7413('0x10')]){utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x1d'),_0x195c72['uniqueid'],queues[_0x195c72['uniqueid']][_0x7413('0x1c')],queues[_0x195c72['uniqueid']][_0x7413('0x10')]));queues[queues[_0x195c72[_0x7413('0x6')]][_0x7413('0x10')]]=queues[_0x195c72['uniqueid']];queues[queues[_0x195c72[_0x7413('0x6')]][_0x7413('0x10')]][_0x7413('0x1e')]=0x2;delete queues[_0x195c72[_0x7413('0x6')]];}}}catch(_0x19970c){utils[_0x7413('0x15')](util['format'](_0x7413('0x16'),_0x195c72['uniqueid']),_0x19970c);}};exports[_0x7413('0x1f')]=function(_0x23e682){try{utils[_0x7413('0x12')](util[_0x7413('0x4')](_0x7413('0x20'),_0x23e682[_0x7413('0x6')]),_0x23e682);if(!_['isNil'](_0x23e682[_0x7413('0x21')][_0x7413('0x22')])&&_0x23e682[_0x7413('0x23')][_0x7413('0x24')]()!==_0x7413('0x25')){if(!_[_0x7413('0x26')](queues[_0x23e682[_0x7413('0x6')]])){queues[_0x23e682['uniqueid']][_0x7413('0x17')]=![];queues[_0x23e682[_0x7413('0x6')]][_0x7413('0x27')]=null;queues[_0x23e682[_0x7413('0x6')]][_0x7413('0x18')]=!![];queues[_0x23e682['uniqueid']][_0x7413('0x28')]=utils['now']();queues[_0x23e682[_0x7413('0x6')]][_0x7413('0xb')]=_0x23e682[_0x7413('0x23')]['toUpperCase']();utils[_0x7413('0x3')](util['format'](_0x7413('0x29'),_0x23e682[_0x7413('0x6')],queues[_0x23e682['uniqueid']]['name'],_0x23e682[_0x7413('0x23')],queues[_0x23e682[_0x7413('0x6')]][_0x7413('0xb')]));writeDB(queues[_0x23e682['uniqueid']]);}}else if(!_['isNil'](_0x23e682[_0x7413('0x21')]['queueposition'])){if(!_['isNil'](queues[_0x23e682[_0x7413('0x6')]])&&!queues[_0x23e682['uniqueid']][_0x7413('0x17')]){queues[_0x23e682[_0x7413('0x6')]][_0x7413('0x17')]=![];queues[_0x23e682[_0x7413('0x6')]][_0x7413('0x27')]=null;queues[_0x23e682['uniqueid']][_0x7413('0x18')]=!![];queues[_0x23e682[_0x7413('0x6')]][_0x7413('0x28')]=utils[_0x7413('0x14')]();queues[_0x23e682[_0x7413('0x6')]][_0x7413('0xb')]=_0x7413('0x2a');utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x2b'),_0x23e682[_0x7413('0x6')],queues[_0x23e682[_0x7413('0x6')]]['name'],_0x23e682[_0x7413('0x23')],queues[_0x23e682['uniqueid']]['queuecallerexitreason']));}}}catch(_0x5b592c){utils['error'](util['format'](_0x7413('0x20'),_0x23e682['uniqueid']),_0x5b592c);}};exports['queuecallerabandon']=function(_0x5dc077){try{if(!_['isNil'](queues[_0x5dc077['uniqueid']])){utils[_0x7413('0x12')](util[_0x7413('0x4')](_0x7413('0x2c'),_0x5dc077[_0x7413('0x6')]),_0x5dc077);queues[_0x5dc077[_0x7413('0x6')]]['queuecallerexit']=![];queues[_0x5dc077[_0x7413('0x6')]]['queuecallerexitAt']=null;queues[_0x5dc077[_0x7413('0x6')]][_0x7413('0x17')]=!![];queues[_0x5dc077[_0x7413('0x6')]][_0x7413('0x27')]=utils[_0x7413('0x14')]();queues[_0x5dc077[_0x7413('0x6')]][_0x7413('0xb')]=_0x7413('0x2d');utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x2e'),_0x5dc077[_0x7413('0x6')],queues[_0x5dc077[_0x7413('0x6')]]['name'],queues[_0x5dc077[_0x7413('0x6')]][_0x7413('0xb')]));}}catch(_0x32ab6e){utils[_0x7413('0x15')](util[_0x7413('0x4')](_0x7413('0x2c'),_0x5dc077[_0x7413('0x6')]),_0x32ab6e);}};exports[_0x7413('0x2f')]=function(_0x426852){try{if(!_[_0x7413('0x26')](queues[_0x426852[_0x7413('0x6')]])){utils['debug'](util[_0x7413('0x4')]('[%s][queues][queuecallerleave]',_0x426852[_0x7413('0x6')]),_0x426852);utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x30'),_0x426852[_0x7413('0x6')],queues[_0x426852[_0x7413('0x6')]][_0x7413('0x1c')],_0x426852[_0x7413('0x31')],_0x426852[_0x7413('0x32')]));queues[_0x426852[_0x7413('0x6')]]['queuecallerleave']=!![];queues[_0x426852['uniqueid']][_0x7413('0x33')]=utils['now']();queues[_0x426852['uniqueid']][_0x7413('0x34')]=utils[_0x7413('0x35')](queues[_0x426852['uniqueid']][_0x7413('0x33')],queues[_0x426852['uniqueid']]['queuecallerjoinAt']);queues[_0x426852[_0x7413('0x6')]]['position']=_0x426852[_0x7413('0x13')];queues[_0x426852[_0x7413('0x6')]][_0x7413('0x36')]=_0x426852[_0x7413('0x36')];queues[_0x426852[_0x7413('0x6')]][_0x7413('0x31')]=_0x426852[_0x7413('0x31')];queues[_0x426852[_0x7413('0x6')]][_0x7413('0x32')]=_0x426852[_0x7413('0x32')];}}catch(_0x50a27d){utils[_0x7413('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x426852['uniqueid']),_0x50a27d);}};exports[_0x7413('0x37')]=function(_0x4299a3){try{if(!_[_0x7413('0x26')](queues[_0x4299a3[_0x7413('0x6')]])){utils['debug'](util['format'](_0x7413('0x38'),_0x4299a3['uniqueid']),_0x4299a3);utils[_0x7413('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4299a3['uniqueid'],queues[_0x4299a3['uniqueid']]['name'],_0x4299a3[_0x7413('0x39')],_0x4299a3[_0x7413('0x3a')]));queues[_0x4299a3[_0x7413('0x6')]][_0x7413('0x17')]=![];queues[_0x4299a3[_0x7413('0x6')]]['queuecallerabandon']=![];queues[_0x4299a3[_0x7413('0x6')]][_0x7413('0x27')]=null;queues[_0x4299a3[_0x7413('0x6')]]['queuecallerexit']=![];queues[_0x4299a3[_0x7413('0x6')]]['queuecallerexitreason']=null;queues[_0x4299a3['uniqueid']][_0x7413('0x28')]=null;queues[_0x4299a3[_0x7413('0x6')]][_0x7413('0x3b')]=!![];queues[_0x4299a3[_0x7413('0x6')]][_0x7413('0x3c')]=_0x4299a3[_0x7413('0x3a')];queues[_0x4299a3['uniqueid']][_0x7413('0x9')]=_0x4299a3['membername'];}}catch(_0x1d5ff2){utils['error'](util[_0x7413('0x4')]('[%s][queues][agentconnect]',_0x4299a3[_0x7413('0x6')]),_0x1d5ff2);}};exports[_0x7413('0x3d')]=function(_0x5e6013){try{if(!_[_0x7413('0x26')](queues[_0x5e6013['uniqueid']])){if(queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x33')]){utils['debug'](util[_0x7413('0x4')](_0x7413('0x3e'),_0x5e6013['uniqueid']),_0x5e6013);queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x17')]=![];queues[_0x5e6013['uniqueid']][_0x7413('0x17')]=![];queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x27')]=null;queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x18')]=![];queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x28')]=null;queues[_0x5e6013[_0x7413('0x6')]]['assigned']=!![];queues[_0x5e6013[_0x7413('0x6')]]['lastAssignedTo']=_0x5e6013[_0x7413('0x39')];queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x19')]=!![];queues[_0x5e6013[_0x7413('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x5e6013['reason']=='transfer'){if(!queues[_0x5e6013['uniqueid']][_0x7413('0x3f')]){queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0xb')]='TRANSFER';}}else{queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0xb')]=_0x7413('0x40')+_0x5e6013[_0x7413('0x41')][_0x7413('0x24')]();}utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x42'),_0x5e6013[_0x7413('0x6')],queues[_0x5e6013[_0x7413('0x6')]][_0x7413('0x1c')],_0x5e6013[_0x7413('0x39')],queues[_0x5e6013[_0x7413('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x5e6013[_0x7413('0x6')]]);}}}catch(_0x405ae4){utils['error'](util[_0x7413('0x4')](_0x7413('0x3e'),_0x5e6013[_0x7413('0x6')]),_0x405ae4);}};exports[_0x7413('0x43')]=function(_0x102fd2){try{if(!_[_0x7413('0x26')](queues[_0x102fd2['transfereeuniqueid']])){utils[_0x7413('0x12')](util[_0x7413('0x4')]('[%s][queues][blindtransfer]',_0x102fd2[_0x7413('0x6')]),_0x102fd2);queues[_0x102fd2['transfereeuniqueid']]['transfer']=!![];queues[_0x102fd2[_0x7413('0x44')]][_0x7413('0x45')]=_0x7413('0x46');queues[_0x102fd2[_0x7413('0x44')]][_0x7413('0x47')]=_0x102fd2[_0x7413('0x48')];queues[_0x102fd2[_0x7413('0x44')]][_0x7413('0x49')]=_0x102fd2['transfereeuniqueid'];queues[_0x102fd2[_0x7413('0x44')]]['queuecallerexitreason']=_0x7413('0x4a');utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x4b'),_0x102fd2[_0x7413('0x6')],queues[_0x102fd2[_0x7413('0x44')]][_0x7413('0x1c')],_0x102fd2[_0x7413('0x44')],_0x102fd2[_0x7413('0x48')]));}}catch(_0x50910a){utils[_0x7413('0x15')](util[_0x7413('0x4')]('[%s][queues][blindtransfer]',_0x102fd2[_0x7413('0x6')]),_0x50910a);}};exports[_0x7413('0x4c')]=function(_0x599a91){try{utils[_0x7413('0x12')](util['format'](_0x7413('0x4d'),_0x599a91[_0x7413('0x4e')]),_0x599a91);if(_0x599a91['origtransfereruniqueid']==_0x599a91['origtransfererlinkedid']){if(!_[_0x7413('0x26')](queues[_0x599a91[_0x7413('0x4f')]])){utils[_0x7413('0x3')](util['format'](_0x7413('0x50'),_0x599a91[_0x7413('0x4e')],queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0x1c')],_0x599a91[_0x7413('0x51')]));queues[_0x599a91[_0x7413('0x4f')]]['transfer']=!![];queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0x45')]=_0x7413('0x52');queues[_0x599a91['secondtransfererlinkedid']][_0x7413('0x47')]=_0x599a91[_0x7413('0x51')];queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0x49')]=_0x599a91[_0x7413('0x4e')];queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0xb')]=_0x7413('0x53');}if(!_[_0x7413('0x26')](queues[_0x599a91['origtransfererlinkedid']])){if(_0x599a91[_0x7413('0x54')]&&queues[_0x599a91[_0x7413('0x54')]]){queues[_0x599a91[_0x7413('0x54')]][_0x7413('0x1e')]=0x1;queues[_0x599a91[_0x7413('0x44')]]=_[_0x7413('0x55')](queues[_0x599a91['transfereelinkedid']]);queues[_0x599a91[_0x7413('0x44')]]['transfereduniqueid']=_0x599a91['transfertargetuniqueid'];queues[_0x599a91[_0x7413('0x44')]][_0x7413('0x1e')]=0x2;queues[_0x599a91['transfereeuniqueid']][_0x7413('0xa')]=queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0xa')];queues[_0x599a91[_0x7413('0x44')]][_0x7413('0x56')]=queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0x56')];queues[_0x599a91[_0x7413('0x44')]]['queuecallerjoinAt']=utils[_0x7413('0x14')]();queues[_0x599a91['transfereeuniqueid']][_0x7413('0x33')]=utils[_0x7413('0x14')]();queues[_0x599a91['transfereeuniqueid']][_0x7413('0x34')]=0x0;queues[_0x599a91[_0x7413('0x44')]][_0x7413('0x57')]=0x0;utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x58'),_0x599a91[_0x7413('0x4e')],queues[_0x599a91[_0x7413('0x44')]][_0x7413('0x1c')],queues[_0x599a91[_0x7413('0x44')]]['calleridnum'],queues[_0x599a91[_0x7413('0x44')]][_0x7413('0x56')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x599a91[_0x7413('0x4e')],queues[_0x599a91['origtransfererlinkedid']][_0x7413('0x1c')],_0x599a91[_0x7413('0x4f')]));queues[_0x599a91[_0x7413('0x59')]][_0x7413('0x10')]=_0x599a91[_0x7413('0x4f')];}}}else if(_0x599a91[_0x7413('0x5a')]==_0x599a91[_0x7413('0x4f')]){if(!_[_0x7413('0x26')](queues[_0x599a91[_0x7413('0x59')]])){utils['info'](util[_0x7413('0x4')](_0x7413('0x5b'),_0x599a91[_0x7413('0x4e')],queues[_0x599a91['origtransfererlinkedid']][_0x7413('0x1c')],_0x599a91[_0x7413('0x5a')],_0x599a91[_0x7413('0x5c')]));queues[_0x599a91[_0x7413('0x59')]][_0x7413('0x3f')]=!![];queues[_0x599a91[_0x7413('0x59')]][_0x7413('0x45')]=_0x7413('0x52');queues[_0x599a91[_0x7413('0x59')]][_0x7413('0x47')]=_0x599a91['secondtransfererexten'];queues[_0x599a91[_0x7413('0x59')]][_0x7413('0x49')]=_0x599a91['secondtransfereruniqueid'];queues[_0x599a91[_0x7413('0x59')]][_0x7413('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x7413('0x26')](queues[_0x599a91[_0x7413('0x4f')]])){if(_0x599a91[_0x7413('0x5d')]&&queues[_0x599a91['transfertargetlinkedid']]){queues[_0x599a91[_0x7413('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x599a91[_0x7413('0x5e')]]=_[_0x7413('0x55')](queues[_0x599a91[_0x7413('0x5d')]]);queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0x10')]=_0x599a91[_0x7413('0x5e')];queues[_0x599a91['transfertargetuniqueid']][_0x7413('0x1e')]=0x2;queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0xa')]=queues[_0x599a91[_0x7413('0x59')]][_0x7413('0xa')];queues[_0x599a91['transfertargetuniqueid']][_0x7413('0x56')]=queues[_0x599a91[_0x7413('0x59')]][_0x7413('0x56')];queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0x5f')]=utils['now']();queues[_0x599a91['transfertargetuniqueid']][_0x7413('0x33')]=utils[_0x7413('0x14')]();queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0x34')]=0x0;queues[_0x599a91['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x60'),_0x599a91['origtransfereruniqueid'],queues[_0x599a91['transfertargetuniqueid']][_0x7413('0x1c')],queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0x10')],queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0xa')],queues[_0x599a91[_0x7413('0x5e')]][_0x7413('0x56')]));}else{utils['info'](util['format'](_0x7413('0x61'),_0x599a91[_0x7413('0x4e')],queues[_0x599a91['secondtransfererlinkedid']][_0x7413('0x1c')],_0x599a91[_0x7413('0x59')]));queues[_0x599a91[_0x7413('0x4f')]][_0x7413('0x10')]=_0x599a91[_0x7413('0x59')];}}}}catch(_0x1b22e7){utils[_0x7413('0x15')](util[_0x7413('0x4')](_0x7413('0x4d'),_0x599a91['origtransfereruniqueid']),_0x1b22e7);}};exports[_0x7413('0x62')]=function(_0x3baf5c){try{if(!_[_0x7413('0x26')](queues[_0x3baf5c[_0x7413('0x6')]])){utils[_0x7413('0x12')](util[_0x7413('0x4')]('[%s][queues][musiconholdstart]',_0x3baf5c['uniqueid']),_0x3baf5c);queues[_0x3baf5c['uniqueid']][_0x7413('0x63')]=utils[_0x7413('0x14')]();utils[_0x7413('0x3')](util[_0x7413('0x4')](_0x7413('0x64'),_0x3baf5c[_0x7413('0x6')],queues[_0x3baf5c[_0x7413('0x6')]][_0x7413('0x1c')],queues[_0x3baf5c['uniqueid']][_0x7413('0x63')]));}}catch(_0x4ef245){utils[_0x7413('0x15')](util[_0x7413('0x4')](_0x7413('0x65'),_0x3baf5c[_0x7413('0x6')]),_0x4ef245);}};exports[_0x7413('0x66')]=function(_0x5881d6){try{if(!_[_0x7413('0x26')](queues[_0x5881d6[_0x7413('0x6')]])){if(!_[_0x7413('0x26')](queues[_0x5881d6[_0x7413('0x6')]][_0x7413('0x63')])){utils[_0x7413('0x12')](util[_0x7413('0x4')](_0x7413('0x67'),_0x5881d6[_0x7413('0x6')]),_0x5881d6);queues[_0x5881d6[_0x7413('0x6')]][_0x7413('0x57')]+=utils[_0x7413('0x35')](utils[_0x7413('0x14')](),queues[_0x5881d6[_0x7413('0x6')]][_0x7413('0x63')]);utils['info'](util['format'](_0x7413('0x68'),_0x5881d6[_0x7413('0x6')],queues[_0x5881d6['uniqueid']][_0x7413('0x1c')],queues[_0x5881d6['uniqueid']][_0x7413('0x57')]));delete queues[_0x5881d6[_0x7413('0x6')]][_0x7413('0x63')];}}}catch(_0xc3ea36){utils[_0x7413('0x15')](util[_0x7413('0x4')](_0x7413('0x67'),_0x5881d6[_0x7413('0x6')]),_0xc3ea36);}}; \ No newline at end of file +var _0x4959=['diffTime','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexit','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename'];(function(_0x3c4bab,_0x1cd10d){var _0xff77fa=function(_0x5eba05){while(--_0x5eba05){_0x3c4bab['push'](_0x3c4bab['shift']());}};_0xff77fa(++_0x1cd10d);}(_0x4959,0x9b));var _0x9495=function(_0x1f7e36,_0x35e286){_0x1f7e36=_0x1f7e36-0x0;var _0x2b9cf6=_0x4959[_0x1f7e36];return _0x2b9cf6;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9495('0x0'));var queues={};function writeDB(_0x14df5f){utils[_0x9495('0x1')](util['format'](_0x9495('0x2'),_0x14df5f[_0x9495('0x3')],_0x14df5f[_0x9495('0x4')],_0x14df5f[_0x9495('0x5')],_0x14df5f['lastAssignedTo'],_0x14df5f[_0x9495('0x6')],_0x14df5f[_0x9495('0x7')],_0x14df5f[_0x9495('0x8')]));if(_0x14df5f[_0x9495('0x5')]){utils[_0x9495('0x9')](_0x14df5f[_0x9495('0x5')])[_0x9495('0xa')](function(_0x19f08c){if(_0x19f08c){_0x14df5f[_0x9495('0xb')]=_0x19f08c[_0x9495('0xb')];}utils[_0x9495('0xc')]('CreateVoiceQueueReport',_0x14df5f);});}else{utils[_0x9495('0xc')]('CreateVoiceQueueReport',_0x14df5f);}if(_0x14df5f['transfereduniqueid']){delete queues[_0x14df5f['transfereduniqueid']];}else{delete queues[_0x14df5f['uniqueid']];}}exports[_0x9495('0xd')]=function(_0x5e15a3){try{utils[_0x9495('0xe')](util[_0x9495('0xf')](_0x9495('0x10'),_0x5e15a3[_0x9495('0x3')]),_0x5e15a3);utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x11'),_0x5e15a3[_0x9495('0x3')],_0x5e15a3[_0x9495('0x5')],_0x5e15a3[_0x9495('0x12')]));queues[_0x5e15a3[_0x9495('0x3')]]=_[_0x9495('0x13')](_0x5e15a3,{'originalposition':_0x5e15a3[_0x9495('0x12')],'queuecallerjoinAt':utils[_0x9495('0x14')](),'mohtime':0x0});}catch(_0x583db3){utils[_0x9495('0x15')](util[_0x9495('0xf')](_0x9495('0x10'),_0x5e15a3[_0x9495('0x3')]),_0x583db3);}};exports[_0x9495('0x16')]=function(_0x4c1d9d){try{if(!_[_0x9495('0x17')](queues[_0x4c1d9d[_0x9495('0x3')]])){utils[_0x9495('0xe')](util[_0x9495('0xf')](_0x9495('0x18'),_0x4c1d9d['uniqueid']),_0x4c1d9d);if(queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x19')]){if(!queues[_0x4c1d9d['uniqueid']]['queuecallerabandon']&&!queues[_0x4c1d9d['uniqueid']]['queuecallerexit']){queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1a')]=!![];queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1b')]=utils[_0x9495('0x14')]();queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x8')]=_0x9495('0x1c');}utils[_0x9495('0x1')](util[_0x9495('0xf')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4c1d9d[_0x9495('0x3')],queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1d')],queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x8')]));writeDB(queues[_0x4c1d9d[_0x9495('0x3')]]);}else if(queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1e')]){utils[_0x9495('0x1')](util['format'](_0x9495('0x1f'),_0x4c1d9d[_0x9495('0x3')],queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1d')],queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1e')]));queues[queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1e')]]=queues[_0x4c1d9d['uniqueid']];queues[queues[_0x4c1d9d[_0x9495('0x3')]][_0x9495('0x1e')]][_0x9495('0x20')]=0x2;delete queues[_0x4c1d9d[_0x9495('0x3')]];}}}catch(_0x5ee329){utils[_0x9495('0x15')](util[_0x9495('0xf')](_0x9495('0x18'),_0x4c1d9d['uniqueid']),_0x5ee329);}};exports[_0x9495('0x21')]=function(_0x1cae34){try{utils[_0x9495('0xe')](util[_0x9495('0xf')](_0x9495('0x22'),_0x1cae34[_0x9495('0x3')]),_0x1cae34);if(!_[_0x9495('0x17')](_0x1cae34['variable'][_0x9495('0x23')])&&_0x1cae34[_0x9495('0x24')][_0x9495('0x25')]()!==_0x9495('0x26')){if(!_[_0x9495('0x17')](queues[_0x1cae34[_0x9495('0x3')]])){queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x27')]=![];queues[_0x1cae34['uniqueid']][_0x9495('0x28')]=null;queues[_0x1cae34['uniqueid']]['queuecallerexit']=!![];queues[_0x1cae34['uniqueid']][_0x9495('0x29')]=utils[_0x9495('0x14')]();queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x8')]=_0x1cae34[_0x9495('0x24')][_0x9495('0x25')]();utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x2a'),_0x1cae34[_0x9495('0x3')],queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x1d')],_0x1cae34[_0x9495('0x24')],queues[_0x1cae34['uniqueid']][_0x9495('0x8')]));writeDB(queues[_0x1cae34[_0x9495('0x3')]]);}}else if(!_[_0x9495('0x17')](_0x1cae34[_0x9495('0x2b')][_0x9495('0x2c')])){if(!_[_0x9495('0x17')](queues[_0x1cae34[_0x9495('0x3')]])&&!queues[_0x1cae34['uniqueid']]['queuecallerabandon']){queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x27')]=![];queues[_0x1cae34['uniqueid']][_0x9495('0x28')]=null;queues[_0x1cae34[_0x9495('0x3')]]['queuecallerexit']=!![];queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x29')]=utils['now']();queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x8')]=_0x9495('0x2d');utils['info'](util[_0x9495('0xf')](_0x9495('0x2e'),_0x1cae34[_0x9495('0x3')],queues[_0x1cae34[_0x9495('0x3')]][_0x9495('0x1d')],_0x1cae34[_0x9495('0x24')],queues[_0x1cae34['uniqueid']][_0x9495('0x8')]));}}}catch(_0x182495){utils[_0x9495('0x15')](util['format'](_0x9495('0x22'),_0x1cae34[_0x9495('0x3')]),_0x182495);}};exports[_0x9495('0x27')]=function(_0x1f9879){try{if(!_[_0x9495('0x17')](queues[_0x1f9879[_0x9495('0x3')]])){utils[_0x9495('0xe')](util[_0x9495('0xf')]('[%s][queues][queuecallerabandon]',_0x1f9879[_0x9495('0x3')]),_0x1f9879);queues[_0x1f9879[_0x9495('0x3')]][_0x9495('0x2f')]=![];queues[_0x1f9879['uniqueid']][_0x9495('0x29')]=null;queues[_0x1f9879[_0x9495('0x3')]][_0x9495('0x27')]=!![];queues[_0x1f9879[_0x9495('0x3')]]['queuecallerabandonAt']=utils[_0x9495('0x14')]();queues[_0x1f9879[_0x9495('0x3')]][_0x9495('0x8')]=_0x9495('0x30');utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x31'),_0x1f9879[_0x9495('0x3')],queues[_0x1f9879[_0x9495('0x3')]][_0x9495('0x1d')],queues[_0x1f9879['uniqueid']][_0x9495('0x8')]));}}catch(_0x40f05a){utils[_0x9495('0x15')](util[_0x9495('0xf')](_0x9495('0x32'),_0x1f9879['uniqueid']),_0x40f05a);}};exports[_0x9495('0x33')]=function(_0x3abc39){try{if(!_[_0x9495('0x17')](queues[_0x3abc39[_0x9495('0x3')]])){utils[_0x9495('0xe')](util['format'](_0x9495('0x34'),_0x3abc39[_0x9495('0x3')]),_0x3abc39);utils['info'](util[_0x9495('0xf')](_0x9495('0x35'),_0x3abc39['uniqueid'],queues[_0x3abc39['uniqueid']]['name'],_0x3abc39['connectedlinenum'],_0x3abc39[_0x9495('0x36')]));queues[_0x3abc39[_0x9495('0x3')]][_0x9495('0x33')]=!![];queues[_0x3abc39[_0x9495('0x3')]][_0x9495('0x19')]=utils[_0x9495('0x14')]();queues[_0x3abc39[_0x9495('0x3')]]['holdtime']=utils[_0x9495('0x37')](queues[_0x3abc39[_0x9495('0x3')]][_0x9495('0x19')],queues[_0x3abc39[_0x9495('0x3')]]['queuecallerjoinAt']);queues[_0x3abc39[_0x9495('0x3')]]['position']=_0x3abc39[_0x9495('0x12')];queues[_0x3abc39[_0x9495('0x3')]]['count']=_0x3abc39['count'];queues[_0x3abc39[_0x9495('0x3')]][_0x9495('0x38')]=_0x3abc39['connectedlinenum'];queues[_0x3abc39[_0x9495('0x3')]][_0x9495('0x36')]=_0x3abc39[_0x9495('0x36')];}}catch(_0x28bba3){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x3abc39[_0x9495('0x3')]),_0x28bba3);}};exports[_0x9495('0x39')]=function(_0x3cd68e){try{if(!_[_0x9495('0x17')](queues[_0x3cd68e[_0x9495('0x3')]])){utils['debug'](util['format'](_0x9495('0x3a'),_0x3cd68e['uniqueid']),_0x3cd68e);utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x3b'),_0x3cd68e[_0x9495('0x3')],queues[_0x3cd68e['uniqueid']][_0x9495('0x1d')],_0x3cd68e[_0x9495('0x3c')],_0x3cd68e[_0x9495('0x3d')]));queues[_0x3cd68e[_0x9495('0x3')]][_0x9495('0x27')]=![];queues[_0x3cd68e['uniqueid']]['queuecallerabandon']=![];queues[_0x3cd68e['uniqueid']][_0x9495('0x28')]=null;queues[_0x3cd68e[_0x9495('0x3')]]['queuecallerexit']=![];queues[_0x3cd68e['uniqueid']][_0x9495('0x8')]=null;queues[_0x3cd68e[_0x9495('0x3')]]['queuecallerexitAt']=null;queues[_0x3cd68e['uniqueid']]['assigned']=!![];queues[_0x3cd68e[_0x9495('0x3')]][_0x9495('0x7')]=_0x3cd68e[_0x9495('0x3d')];queues[_0x3cd68e['uniqueid']][_0x9495('0x3e')]=_0x3cd68e[_0x9495('0x3c')];}}catch(_0x2ccea2){utils['error'](util['format']('[%s][queues][agentconnect]',_0x3cd68e[_0x9495('0x3')]),_0x2ccea2);}};exports[_0x9495('0x3f')]=function(_0x4a48a3){try{if(!_[_0x9495('0x17')](queues[_0x4a48a3[_0x9495('0x3')]])){if(queues[_0x4a48a3[_0x9495('0x3')]]['queuecallerleaveAt']){utils[_0x9495('0xe')](util[_0x9495('0xf')](_0x9495('0x40'),_0x4a48a3[_0x9495('0x3')]),_0x4a48a3);queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x27')]=![];queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x27')]=![];queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x28')]=null;queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x2f')]=![];queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x29')]=null;queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x41')]=!![];queues[_0x4a48a3[_0x9495('0x3')]]['lastAssignedTo']=_0x4a48a3['membername'];queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x1a')]=!![];queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x1b')]=utils[_0x9495('0x14')]();if(_0x4a48a3['reason']==_0x9495('0x42')){if(!queues[_0x4a48a3[_0x9495('0x3')]]['transfer']){queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x8')]='TRANSFER';}}else{queues[_0x4a48a3['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x4a48a3[_0x9495('0x43')][_0x9495('0x25')]();}utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x44'),_0x4a48a3['uniqueid'],queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x1d')],_0x4a48a3['membername'],queues[_0x4a48a3[_0x9495('0x3')]][_0x9495('0x8')]));writeDB(queues[_0x4a48a3[_0x9495('0x3')]]);}}}catch(_0xcc4881){utils[_0x9495('0x15')](util[_0x9495('0xf')](_0x9495('0x40'),_0x4a48a3['uniqueid']),_0xcc4881);}};exports[_0x9495('0x45')]=function(_0x30a886){try{if(!_['isNil'](queues[_0x30a886[_0x9495('0x46')]])){utils[_0x9495('0xe')](util[_0x9495('0xf')](_0x9495('0x47'),_0x30a886[_0x9495('0x3')]),_0x30a886);queues[_0x30a886['transfereeuniqueid']][_0x9495('0x42')]=!![];queues[_0x30a886[_0x9495('0x46')]][_0x9495('0x48')]=_0x9495('0x49');queues[_0x30a886[_0x9495('0x46')]][_0x9495('0x4a')]=_0x30a886[_0x9495('0x4b')];queues[_0x30a886[_0x9495('0x46')]]['transferuniqueid']=_0x30a886[_0x9495('0x46')];queues[_0x30a886[_0x9495('0x46')]][_0x9495('0x8')]='BLINDTRANSFER';utils[_0x9495('0x1')](util['format'](_0x9495('0x4c'),_0x30a886[_0x9495('0x3')],queues[_0x30a886['transfereeuniqueid']][_0x9495('0x1d')],_0x30a886[_0x9495('0x46')],_0x30a886[_0x9495('0x4b')]));}}catch(_0x3b0ecd){utils[_0x9495('0x15')](util[_0x9495('0xf')](_0x9495('0x47'),_0x30a886[_0x9495('0x3')]),_0x3b0ecd);}};exports[_0x9495('0x4d')]=function(_0x1d1472){try{utils[_0x9495('0xe')](util['format'](_0x9495('0x4e'),_0x1d1472['origtransfereruniqueid']),_0x1d1472);if(_0x1d1472[_0x9495('0x4f')]==_0x1d1472[_0x9495('0x50')]){if(!_[_0x9495('0x17')](queues[_0x1d1472[_0x9495('0x51')]])){utils['info'](util[_0x9495('0xf')](_0x9495('0x52'),_0x1d1472[_0x9495('0x4f')],queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x1d')],_0x1d1472[_0x9495('0x53')]));queues[_0x1d1472[_0x9495('0x51')]]['transfer']=!![];queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x48')]=_0x9495('0x54');queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x4a')]=_0x1d1472[_0x9495('0x53')];queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x55')]=_0x1d1472[_0x9495('0x4f')];queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x8')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1d1472[_0x9495('0x50')]])){if(_0x1d1472[_0x9495('0x56')]&&queues[_0x1d1472[_0x9495('0x56')]]){queues[_0x1d1472[_0x9495('0x56')]][_0x9495('0x20')]=0x1;queues[_0x1d1472[_0x9495('0x46')]]=_[_0x9495('0x57')](queues[_0x1d1472['transfereelinkedid']]);queues[_0x1d1472[_0x9495('0x46')]]['transfereduniqueid']=_0x1d1472['transfertargetuniqueid'];queues[_0x1d1472[_0x9495('0x46')]]['queuecallerenterreason']=0x2;queues[_0x1d1472[_0x9495('0x46')]]['calleridnum']=queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x6')];queues[_0x1d1472[_0x9495('0x46')]][_0x9495('0x58')]=queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x58')];queues[_0x1d1472[_0x9495('0x46')]]['queuecallerjoinAt']=utils[_0x9495('0x14')]();queues[_0x1d1472[_0x9495('0x46')]][_0x9495('0x19')]=utils[_0x9495('0x14')]();queues[_0x1d1472['transfereeuniqueid']][_0x9495('0x59')]=0x0;queues[_0x1d1472[_0x9495('0x46')]][_0x9495('0x5a')]=0x0;utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x5b'),_0x1d1472[_0x9495('0x4f')],queues[_0x1d1472['transfereeuniqueid']][_0x9495('0x1d')],queues[_0x1d1472[_0x9495('0x46')]][_0x9495('0x6')],queues[_0x1d1472[_0x9495('0x46')]]['calleridname']));}else{utils[_0x9495('0x1')](util[_0x9495('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1d1472[_0x9495('0x4f')],queues[_0x1d1472[_0x9495('0x50')]]['name'],_0x1d1472[_0x9495('0x51')]));queues[_0x1d1472[_0x9495('0x50')]][_0x9495('0x1e')]=_0x1d1472[_0x9495('0x51')];}}}else if(_0x1d1472[_0x9495('0x5c')]==_0x1d1472[_0x9495('0x51')]){if(!_[_0x9495('0x17')](queues[_0x1d1472[_0x9495('0x50')]])){utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x5d'),_0x1d1472[_0x9495('0x4f')],queues[_0x1d1472[_0x9495('0x50')]][_0x9495('0x1d')],_0x1d1472[_0x9495('0x5c')],_0x1d1472['secondtransfererexten']));queues[_0x1d1472[_0x9495('0x50')]][_0x9495('0x42')]=!![];queues[_0x1d1472['origtransfererlinkedid']][_0x9495('0x48')]=_0x9495('0x54');queues[_0x1d1472[_0x9495('0x50')]]['transferexten']=_0x1d1472[_0x9495('0x5e')];queues[_0x1d1472[_0x9495('0x50')]][_0x9495('0x55')]=_0x1d1472[_0x9495('0x5c')];queues[_0x1d1472[_0x9495('0x50')]][_0x9495('0x8')]=_0x9495('0x5f');}if(!_[_0x9495('0x17')](queues[_0x1d1472['secondtransfererlinkedid']])){if(_0x1d1472[_0x9495('0x60')]&&queues[_0x1d1472[_0x9495('0x60')]]){queues[_0x1d1472['transfertargetlinkedid']][_0x9495('0x20')]=0x1;queues[_0x1d1472[_0x9495('0x61')]]=_[_0x9495('0x57')](queues[_0x1d1472['transfertargetlinkedid']]);queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x1e')]=_0x1d1472[_0x9495('0x61')];queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x20')]=0x2;queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x6')]=queues[_0x1d1472[_0x9495('0x50')]][_0x9495('0x6')];queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x58')]=queues[_0x1d1472['origtransfererlinkedid']][_0x9495('0x58')];queues[_0x1d1472['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x9495('0x14')]();queues[_0x1d1472['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x9495('0x14')]();queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x59')]=0x0;queues[_0x1d1472[_0x9495('0x61')]]['mohtime']=0x0;utils[_0x9495('0x1')](util['format'](_0x9495('0x62'),_0x1d1472['origtransfereruniqueid'],queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x1d')],queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x1e')],queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x6')],queues[_0x1d1472[_0x9495('0x61')]][_0x9495('0x58')]));}else{utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x63'),_0x1d1472[_0x9495('0x4f')],queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x1d')],_0x1d1472[_0x9495('0x50')]));queues[_0x1d1472[_0x9495('0x51')]][_0x9495('0x1e')]=_0x1d1472[_0x9495('0x50')];}}}}catch(_0x3c41a7){utils[_0x9495('0x15')](util[_0x9495('0xf')](_0x9495('0x4e'),_0x1d1472[_0x9495('0x4f')]),_0x3c41a7);}};exports['musiconholdstart']=function(_0x35e738){try{if(!_[_0x9495('0x17')](queues[_0x35e738['uniqueid']])){utils[_0x9495('0xe')](util[_0x9495('0xf')]('[%s][queues][musiconholdstart]',_0x35e738[_0x9495('0x3')]),_0x35e738);queues[_0x35e738['uniqueid']][_0x9495('0x64')]=utils[_0x9495('0x14')]();utils[_0x9495('0x1')](util[_0x9495('0xf')](_0x9495('0x65'),_0x35e738['uniqueid'],queues[_0x35e738[_0x9495('0x3')]][_0x9495('0x1d')],queues[_0x35e738[_0x9495('0x3')]][_0x9495('0x64')]));}}catch(_0xdbb403){utils['error'](util[_0x9495('0xf')](_0x9495('0x66'),_0x35e738[_0x9495('0x3')]),_0xdbb403);}};exports[_0x9495('0x67')]=function(_0x1a41a1){try{if(!_[_0x9495('0x17')](queues[_0x1a41a1[_0x9495('0x3')]])){if(!_['isNil'](queues[_0x1a41a1[_0x9495('0x3')]][_0x9495('0x64')])){utils[_0x9495('0xe')](util['format'](_0x9495('0x68'),_0x1a41a1[_0x9495('0x3')]),_0x1a41a1);queues[_0x1a41a1[_0x9495('0x3')]][_0x9495('0x5a')]+=utils[_0x9495('0x37')](utils[_0x9495('0x14')](),queues[_0x1a41a1[_0x9495('0x3')]]['musiconholdstartAt']);utils[_0x9495('0x1')](util[_0x9495('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1a41a1['uniqueid'],queues[_0x1a41a1['uniqueid']]['name'],queues[_0x1a41a1['uniqueid']][_0x9495('0x5a')]));delete queues[_0x1a41a1[_0x9495('0x3')]][_0x9495('0x64')];}}}catch(_0x231f5f){utils[_0x9495('0x15')](util['format']('[%s][queues][musiconholdstop]',_0x1a41a1[_0x9495('0x3')]),_0x231f5f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5608206..2e29621 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 _0x2aa2=['membername','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','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','info','uniqueid','accountcode','getUserByInternal'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x2aa2,0x75));var _0x22aa=function(_0x3fc81c,_0x34014b){_0x3fc81c=_0x3fc81c-0x0;var _0x57d3b7=_0x2aa2[_0x3fc81c];return _0x57d3b7;};'use strict';var _=require(_0x22aa('0x0'));var util=require(_0x22aa('0x1'));var utils=require(_0x22aa('0x2'));var recordings={};function writeDB(_0x1cbcad){utils[_0x22aa('0x3')](util['format']('[%s][recordings][writeDB]',_0x1cbcad[_0x22aa('0x4')]));if(_0x1cbcad[_0x22aa('0x5')]){utils[_0x22aa('0x6')](_0x1cbcad['accountcode'])['then'](function(_0x3d7c36){if(_0x3d7c36){_0x1cbcad[_0x22aa('0x7')]=_0x3d7c36['name'];_0x1cbcad[_0x22aa('0x8')]=_0x3d7c36['id'];}utils[_0x22aa('0x9')](_0x22aa('0xa'),_0x1cbcad);});}else{utils[_0x22aa('0x9')](_0x22aa('0xa'),_0x1cbcad);}}exports['newchannel']=function(_0x167899){try{utils[_0x22aa('0xb')](util[_0x22aa('0xc')](_0x22aa('0xd'),_0x167899[_0x22aa('0x4')]),_0x167899);if(_0x167899[_0x22aa('0x4')]==_0x167899[_0x22aa('0xe')]){utils[_0x22aa('0x3')](util[_0x22aa('0xc')](_0x22aa('0xf'),_0x167899[_0x22aa('0x4')],_0x167899[_0x22aa('0x10')],_0x167899[_0x22aa('0x11')]));recordings[_0x167899[_0x22aa('0x4')]]={'uniqueid':_0x167899[_0x22aa('0x4')],'accountcode':_0x167899[_0x22aa('0x5')],'exten':_0x167899['exten'],'context':_0x167899[_0x22aa('0x10')],'channel':_0x167899[_0x22aa('0x12')],'monitors':[]};}}catch(_0x5d1e2f){utils[_0x22aa('0x13')](util['format'](_0x22aa('0xd'),_0x167899[_0x22aa('0x4')]),_0x5d1e2f);}};exports[_0x22aa('0x14')]=function(_0x57d5bc){try{utils[_0x22aa('0xb')](util[_0x22aa('0xc')](_0x22aa('0x15'),_0x57d5bc['uniqueid']),_0x57d5bc);if(!_['isNil'](recordings[_0x57d5bc[_0x22aa('0x4')]])&&_0x57d5bc[_0x22aa('0x16')]==0x6){utils[_0x22aa('0x3')](util[_0x22aa('0xc')](_0x22aa('0x17'),_0x57d5bc[_0x22aa('0x4')],_0x57d5bc[_0x22aa('0x10')],_0x57d5bc['channel']));}else if(!_[_0x22aa('0x18')](recordings[_0x57d5bc['linkedid']])&&_0x57d5bc[_0x22aa('0x16')]==0x6&&_0x57d5bc[_0x22aa('0x10')]!=_0x22aa('0x19')){utils[_0x22aa('0x3')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x57d5bc[_0x22aa('0x4')],_0x57d5bc[_0x22aa('0xe')],_0x57d5bc[_0x22aa('0x10')],_0x57d5bc[_0x22aa('0x12')]));recordings[_0x57d5bc[_0x22aa('0xe')]][_0x22aa('0x5')]=_0x57d5bc[_0x22aa('0x5')];}}catch(_0x32369b){utils[_0x22aa('0x13')](util[_0x22aa('0xc')](_0x22aa('0x15'),_0x57d5bc[_0x22aa('0x4')]),_0x32369b);}};exports[_0x22aa('0x1a')]=function(_0x2ed817){try{if(!_['isNil'](_0x2ed817['variable'])&&!_[_0x22aa('0x18')](_0x2ed817[_0x22aa('0x1b')][_0x22aa('0x1c')])){utils['debug'](util['format'](_0x22aa('0x1d'),_0x2ed817[_0x22aa('0x4')]),_0x2ed817);utils[_0x22aa('0x3')](util[_0x22aa('0xc')](_0x22aa('0x1e'),_0x2ed817[_0x22aa('0x4')],_0x2ed817[_0x22aa('0x1b')],_0x2ed817[_0x22aa('0x1f')]));if(_[_0x22aa('0x20')](_0x2ed817[_0x22aa('0x1f')],_0x22aa('0x21'))){_0x2ed817['value']=_0x2ed817['value']['replace']('.wav49',_0x22aa('0x22'));}if(recordings[_0x2ed817[_0x22aa('0xe')]]){var _0x15ea66=_[_0x22aa('0x23')](recordings[_0x2ed817[_0x22aa('0xe')]][_0x22aa('0x24')],{'value':_0x2ed817['value']});if(_[_0x22aa('0x18')](_0x15ea66)){recordings[_0x2ed817[_0x22aa('0xe')]][_0x22aa('0x24')]['push']({'value':_0x2ed817[_0x22aa('0x1f')]});}}}}catch(_0x105b16){utils[_0x22aa('0x13')](util[_0x22aa('0xc')](_0x22aa('0x1d'),_0x2ed817['uniqueid']),_0x105b16);}};exports['hangup']=function(_0xc5e8d7){try{if(!_[_0x22aa('0x18')](recordings[_0xc5e8d7['uniqueid']])){utils[_0x22aa('0xb')](util[_0x22aa('0xc')]('[%s][recordings][hangup]',_0xc5e8d7[_0x22aa('0x4')]),_0xc5e8d7);utils[_0x22aa('0x3')](util[_0x22aa('0xc')](_0x22aa('0x25'),_0xc5e8d7['uniqueid'],_0xc5e8d7[_0x22aa('0x26')],_0xc5e8d7[_0x22aa('0x27')],_0xc5e8d7[_0x22aa('0x28')]));recordings[_0xc5e8d7[_0x22aa('0x4')]][_0x22aa('0x26')]=_0xc5e8d7[_0x22aa('0x26')];recordings[_0xc5e8d7[_0x22aa('0x4')]][_0x22aa('0x27')]=_0xc5e8d7['calleridname'];recordings[_0xc5e8d7['uniqueid']][_0x22aa('0x29')]=_0xc5e8d7[_0x22aa('0x29')];recordings[_0xc5e8d7[_0x22aa('0x4')]][_0x22aa('0x2a')]=_0xc5e8d7[_0x22aa('0x2a')];if(recordings[_0xc5e8d7['uniqueid']]['type']==_0x22aa('0x2b')&&recordings[_0xc5e8d7[_0x22aa('0x4')]]['accountcode']){recordings[_0xc5e8d7[_0x22aa('0x4')]][_0x22aa('0x29')]=recordings[_0xc5e8d7[_0x22aa('0x4')]][_0x22aa('0x5')];recordings[_0xc5e8d7[_0x22aa('0x4')]]['connectedlinename']='';}recordings[_0xc5e8d7[_0x22aa('0x4')]][_0x22aa('0x24')][_0x22aa('0x2c')](function(_0x7c1cfd){var _0x31cdea=_[_0x22aa('0x2d')](recordings[_0xc5e8d7[_0x22aa('0x4')]]);_0x31cdea[_0x22aa('0x1f')]=_0x7c1cfd[_0x22aa('0x1f')];writeDB(_0x31cdea);});delete recordings[_0xc5e8d7[_0x22aa('0x4')]];}}catch(_0x2887b8){utils['error'](util[_0x22aa('0xc')]('[%s][recordings][hangup]',_0xc5e8d7[_0x22aa('0x4')]),_0x2887b8);}};exports[_0x22aa('0x2e')]=function(_0x4de641){try{if(!_[_0x22aa('0x18')](recordings[_0x4de641[_0x22aa('0x4')]])){utils['debug'](util[_0x22aa('0xc')](_0x22aa('0x2f'),_0x4de641[_0x22aa('0x4')]),_0x4de641);utils[_0x22aa('0x3')](util[_0x22aa('0xc')](_0x22aa('0x30'),_0x4de641[_0x22aa('0x4')],_0x4de641[_0x22aa('0x31')],_0x4de641[_0x22aa('0x32')]));if(_0x4de641[_0x22aa('0x31')][_0x22aa('0x33')]()==_0x22aa('0x34')&&_[_0x22aa('0x35')](_0x4de641[_0x22aa('0x32')][_0x22aa('0x33')](),_0x22aa('0x36'))){var _0x30163d=_0x4de641[_0x22aa('0x32')][_0x22aa('0x37')]('=');var _0x48d9f4=_0x30163d[0x0][_0x22aa('0x38')](_0x30163d[0x0]['lastIndexOf']('(')+0x1,_0x30163d[0x0][_0x22aa('0x39')](')'));var _0x584e91=_0x30163d[0x1];recordings[_0x4de641[_0x22aa('0x4')]][_0x48d9f4]=_0x584e91;}}}catch(_0x34c6ee){utils[_0x22aa('0x13')](util[_0x22aa('0xc')]('[%s][recordings][newexten]',_0x4de641[_0x22aa('0x4')]),_0x34c6ee);}};exports[_0x22aa('0x3a')]=function(_0x5aa2e4){try{if(!_['isNil'](recordings[_0x5aa2e4['uniqueid']])){utils[_0x22aa('0xb')](util[_0x22aa('0xc')](_0x22aa('0x3b'),_0x5aa2e4[_0x22aa('0x4')]),_0x5aa2e4);utils['info'](util[_0x22aa('0xc')](_0x22aa('0x3c'),_0x5aa2e4[_0x22aa('0x4')],_0x5aa2e4[_0x22aa('0x3d')]));recordings[_0x5aa2e4['uniqueid']]['queue']=_0x5aa2e4[_0x22aa('0x3d')];}}catch(_0x5078f9){utils[_0x22aa('0x13')](util[_0x22aa('0xc')](_0x22aa('0x3b'),_0x5aa2e4[_0x22aa('0x4')]),_0x5078f9);}}; \ No newline at end of file +var _0xb3f6=['[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','isNil','channel','channelstate','transfer','[%s][recordings][newstate]','variable','mixmonitor_filename','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','[%s][recordings][newexten]'];(function(_0x52897c,_0x5cd493){var _0x2ab21f=function(_0x562823){while(--_0x562823){_0x52897c['push'](_0x52897c['shift']());}};_0x2ab21f(++_0x5cd493);}(_0xb3f6,0x198));var _0x6b3f=function(_0x4a2a9c,_0xdffb0c){_0x4a2a9c=_0x4a2a9c-0x0;var _0x1b24ee=_0xb3f6[_0x4a2a9c];return _0x1b24ee;};'use strict';var _=require(_0x6b3f('0x0'));var util=require(_0x6b3f('0x1'));var utils=require(_0x6b3f('0x2'));var recordings={};function writeDB(_0x14d384){utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')](_0x6b3f('0x5'),_0x14d384['uniqueid']));if(_0x14d384[_0x6b3f('0x6')]){utils['getUserByInternal'](_0x14d384[_0x6b3f('0x6')])[_0x6b3f('0x7')](function(_0x1b4cc7){if(_0x1b4cc7){_0x14d384[_0x6b3f('0x8')]=_0x1b4cc7[_0x6b3f('0x9')];_0x14d384[_0x6b3f('0xa')]=_0x1b4cc7['id'];}utils[_0x6b3f('0xb')]('CreateVoiceRecording',_0x14d384);});}else{utils[_0x6b3f('0xb')](_0x6b3f('0xc'),_0x14d384);}}exports[_0x6b3f('0xd')]=function(_0x18805a){try{utils['debug'](util[_0x6b3f('0x4')](_0x6b3f('0xe'),_0x18805a[_0x6b3f('0xf')]),_0x18805a);if(_0x18805a[_0x6b3f('0xf')]==_0x18805a[_0x6b3f('0x10')]){utils[_0x6b3f('0x3')](util['format'](_0x6b3f('0x11'),_0x18805a[_0x6b3f('0xf')],_0x18805a[_0x6b3f('0x12')],_0x18805a['exten']));recordings[_0x18805a[_0x6b3f('0xf')]]={'uniqueid':_0x18805a[_0x6b3f('0xf')],'accountcode':_0x18805a[_0x6b3f('0x6')],'exten':_0x18805a[_0x6b3f('0x13')],'context':_0x18805a[_0x6b3f('0x12')],'channel':_0x18805a['channel'],'monitors':[]};}}catch(_0x483f31){utils[_0x6b3f('0x14')](util[_0x6b3f('0x4')]('[%s][recordings][newchannel]',_0x18805a['uniqueid']),_0x483f31);}};exports[_0x6b3f('0x15')]=function(_0x3da9b7){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x3da9b7[_0x6b3f('0xf')]),_0x3da9b7);if(!_[_0x6b3f('0x16')](recordings[_0x3da9b7[_0x6b3f('0xf')]])&&_0x3da9b7['channelstate']==0x6){utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3da9b7[_0x6b3f('0xf')],_0x3da9b7[_0x6b3f('0x12')],_0x3da9b7[_0x6b3f('0x17')]));}else if(!_[_0x6b3f('0x16')](recordings[_0x3da9b7['linkedid']])&&_0x3da9b7[_0x6b3f('0x18')]==0x6&&_0x3da9b7['context']!=_0x6b3f('0x19')){utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3da9b7[_0x6b3f('0xf')],_0x3da9b7[_0x6b3f('0x10')],_0x3da9b7[_0x6b3f('0x12')],_0x3da9b7[_0x6b3f('0x17')]));recordings[_0x3da9b7[_0x6b3f('0x10')]][_0x6b3f('0x6')]=_0x3da9b7[_0x6b3f('0x6')];}}catch(_0x4ce1df){utils[_0x6b3f('0x14')](util[_0x6b3f('0x4')](_0x6b3f('0x1a'),_0x3da9b7['uniqueid']),_0x4ce1df);}};exports['varset']=function(_0x59a1c5){try{if(!_[_0x6b3f('0x16')](_0x59a1c5[_0x6b3f('0x1b')])&&!_[_0x6b3f('0x16')](_0x59a1c5[_0x6b3f('0x1b')][_0x6b3f('0x1c')])){utils[_0x6b3f('0x1d')](util[_0x6b3f('0x4')]('[%s][recordings][varset]',_0x59a1c5[_0x6b3f('0xf')]),_0x59a1c5);utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')](_0x6b3f('0x1e'),_0x59a1c5['uniqueid'],_0x59a1c5[_0x6b3f('0x1b')],_0x59a1c5['value']));if(_[_0x6b3f('0x1f')](_0x59a1c5['value'],_0x6b3f('0x20'))){_0x59a1c5[_0x6b3f('0x21')]=_0x59a1c5[_0x6b3f('0x21')][_0x6b3f('0x22')]('.wav49','.WAV');}if(recordings[_0x59a1c5[_0x6b3f('0x10')]]){var _0x1af0ff=_['find'](recordings[_0x59a1c5[_0x6b3f('0x10')]][_0x6b3f('0x23')],{'value':_0x59a1c5['value']});if(_[_0x6b3f('0x16')](_0x1af0ff)){recordings[_0x59a1c5[_0x6b3f('0x10')]][_0x6b3f('0x23')][_0x6b3f('0x24')]({'value':_0x59a1c5[_0x6b3f('0x21')]});}}}}catch(_0x4736bf){utils[_0x6b3f('0x14')](util[_0x6b3f('0x4')](_0x6b3f('0x25'),_0x59a1c5[_0x6b3f('0xf')]),_0x4736bf);}};exports['hangup']=function(_0x2da2a8){try{if(!_[_0x6b3f('0x16')](recordings[_0x2da2a8[_0x6b3f('0xf')]])){utils[_0x6b3f('0x1d')](util[_0x6b3f('0x4')]('[%s][recordings][hangup]',_0x2da2a8[_0x6b3f('0xf')]),_0x2da2a8);utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')](_0x6b3f('0x26'),_0x2da2a8[_0x6b3f('0xf')],_0x2da2a8[_0x6b3f('0x27')],_0x2da2a8['calleridname'],_0x2da2a8[_0x6b3f('0x28')]));recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x27')]=_0x2da2a8[_0x6b3f('0x27')];recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x29')]=_0x2da2a8[_0x6b3f('0x29')];recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x2a')]=_0x2da2a8['connectedlinenum'];recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x2b')]=_0x2da2a8[_0x6b3f('0x2b')];if(recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x2c')]==_0x6b3f('0x2d')&&recordings[_0x2da2a8['uniqueid']]['accountcode']){recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x2a')]=recordings[_0x2da2a8[_0x6b3f('0xf')]][_0x6b3f('0x6')];recordings[_0x2da2a8[_0x6b3f('0xf')]]['connectedlinename']='';}recordings[_0x2da2a8[_0x6b3f('0xf')]]['monitors'][_0x6b3f('0x2e')](function(_0x3d91de){var _0x79b38a=_['clone'](recordings[_0x2da2a8[_0x6b3f('0xf')]]);_0x79b38a['value']=_0x3d91de[_0x6b3f('0x21')];writeDB(_0x79b38a);});delete recordings[_0x2da2a8['uniqueid']];}}catch(_0x26a2bc){utils[_0x6b3f('0x14')](util[_0x6b3f('0x4')](_0x6b3f('0x2f'),_0x2da2a8['uniqueid']),_0x26a2bc);}};exports['newexten']=function(_0x12de65){try{if(!_[_0x6b3f('0x16')](recordings[_0x12de65[_0x6b3f('0xf')]])){utils[_0x6b3f('0x1d')](util[_0x6b3f('0x4')]('[%s][recordings][newexten]',_0x12de65[_0x6b3f('0xf')]),_0x12de65);utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x12de65[_0x6b3f('0xf')],_0x12de65[_0x6b3f('0x30')],_0x12de65[_0x6b3f('0x31')]));if(_0x12de65['application'][_0x6b3f('0x32')]()==_0x6b3f('0x33')&&_[_0x6b3f('0x34')](_0x12de65[_0x6b3f('0x31')]['toLowerCase'](),_0x6b3f('0x35'))){var _0x283d7c=_0x12de65[_0x6b3f('0x31')]['split']('=');var _0x5b715f=_0x283d7c[0x0]['substring'](_0x283d7c[0x0]['lastIndexOf']('(')+0x1,_0x283d7c[0x0][_0x6b3f('0x36')](')'));var _0x4d997e=_0x283d7c[0x1];recordings[_0x12de65[_0x6b3f('0xf')]][_0x5b715f]=_0x4d997e;}}}catch(_0x2d3507){utils[_0x6b3f('0x14')](util[_0x6b3f('0x4')](_0x6b3f('0x37'),_0x12de65[_0x6b3f('0xf')]),_0x2d3507);}};exports['queuecallerjoin']=function(_0x23bbcc){try{if(!_[_0x6b3f('0x16')](recordings[_0x23bbcc[_0x6b3f('0xf')]])){utils[_0x6b3f('0x1d')](util[_0x6b3f('0x4')](_0x6b3f('0x38'),_0x23bbcc['uniqueid']),_0x23bbcc);utils[_0x6b3f('0x3')](util[_0x6b3f('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x23bbcc[_0x6b3f('0xf')],_0x23bbcc[_0x6b3f('0x39')]));recordings[_0x23bbcc['uniqueid']][_0x6b3f('0x39')]=_0x23bbcc[_0x6b3f('0x39')];}}catch(_0x4c8131){utils['error'](util[_0x6b3f('0x4')](_0x6b3f('0x38'),_0x23bbcc[_0x6b3f('0xf')]),_0x4c8131);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2427538..189fcde 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 _0xf079=['secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xf079,0x16c));var _0x9f07=function(_0x5508bb,_0x1e366d){_0x5508bb=_0x5508bb-0x0;var _0x389c19=_0xf079[_0x5508bb];return _0x389c19;};'use strict';var _=require(_0x9f07('0x0'));var util=require('util');var utils=require(_0x9f07('0x1'));function writeDB(_0x4327f3){utils['info'](util[_0x9f07('0x2')](_0x9f07('0x3'),_0x4327f3[_0x9f07('0x4')]===_0x9f07('0x5')?_0x4327f3[_0x9f07('0x6')]:_0x4327f3[_0x9f07('0x7')],_0x4327f3['type']));utils[_0x9f07('0x8')](_0x9f07('0x9'),_0x4327f3);}exports[_0x9f07('0xa')]=function(_0x3cd60a){try{utils[_0x9f07('0xb')](util[_0x9f07('0x2')](_0x9f07('0xc'),_0x3cd60a['uniqueid']),_0x3cd60a);utils[_0x9f07('0xd')](util[_0x9f07('0x2')](_0x9f07('0xe'),_0x3cd60a[_0x9f07('0x7')],_0x3cd60a['transferercalleridnum'],_0x3cd60a[_0x9f07('0xf')],_0x3cd60a[_0x9f07('0x10')],_0x3cd60a[_0x9f07('0x11')]));_0x3cd60a[_0x9f07('0x4')]=_0x9f07('0x12');writeDB(_0x3cd60a);}catch(_0x507053){utils[_0x9f07('0x13')](util[_0x9f07('0x2')](_0x9f07('0xc'),_0x3cd60a[_0x9f07('0x7')]),_0x507053);}};exports[_0x9f07('0x14')]=function(_0x5d9f1b){try{utils[_0x9f07('0xb')](util['format'](_0x9f07('0x15'),_0x5d9f1b[_0x9f07('0x6')]),_0x5d9f1b);utils[_0x9f07('0xd')](util[_0x9f07('0x2')](_0x9f07('0x16'),_0x5d9f1b['origtransfereruniqueid'],_0x5d9f1b[_0x9f07('0x17')],_0x5d9f1b[_0x9f07('0x18')],_0x5d9f1b[_0x9f07('0x19')],_0x5d9f1b[_0x9f07('0x1a')]));_0x5d9f1b=_['assign'](_0x5d9f1b,{'transfererchannel':_0x5d9f1b[_0x9f07('0x1b')],'transferercalleridnum':_0x5d9f1b[_0x9f07('0x17')],'transferercalleridname':_0x5d9f1b['origtransferercalleridname'],'transfererconnectedlinenum':_0x5d9f1b[_0x9f07('0x1c')],'transfererconnectedlinename':_0x5d9f1b[_0x9f07('0x1d')],'transfereraccountcode':_0x5d9f1b[_0x9f07('0x1e')],'transferercontext':_0x5d9f1b[_0x9f07('0x1f')],'transfererexten':_0x5d9f1b[_0x9f07('0x20')],'transfererlinkedid':_0x5d9f1b[_0x9f07('0x21')],'context':_0x5d9f1b[_0x9f07('0x22')],'extension':_0x5d9f1b[_0x9f07('0x23')],'type':'attended'});if(_[_0x9f07('0x24')](_0x5d9f1b[_0x9f07('0x25')])){_0x5d9f1b=_['assign'](_0x5d9f1b,{'transfereechannel':_0x5d9f1b['transfertargetchannel'],'transfereecalleridnum':_0x5d9f1b[_0x9f07('0x19')],'transfereecalleridname':_0x5d9f1b[_0x9f07('0x1a')],'transfereeconnectedlinenum':_0x5d9f1b[_0x9f07('0x26')],'transfereeconnectedlinename':_0x5d9f1b[_0x9f07('0x27')],'transfereeaccountcode':_0x5d9f1b[_0x9f07('0x28')],'transfereecontext':_0x5d9f1b[_0x9f07('0x29')],'transfereeexten':_0x5d9f1b[_0x9f07('0x2a')],'transfereelinkedid':_0x5d9f1b[_0x9f07('0x2b')]});}writeDB(_0x5d9f1b);}catch(_0x4a29c9){utils['error'](util[_0x9f07('0x2')](_0x9f07('0x15'),_0x5d9f1b[_0x9f07('0x6')]),_0x4a29c9);}}; \ No newline at end of file +var _0xaec1=['origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xaec1,0x16d));var _0x1aec=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xaec1[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0x1aec('0x0'));var util=require(_0x1aec('0x1'));var utils=require(_0x1aec('0x2'));function writeDB(_0x42109f){utils[_0x1aec('0x3')](util['format'](_0x1aec('0x4'),_0x42109f[_0x1aec('0x5')]===_0x1aec('0x6')?_0x42109f['origtransfereruniqueid']:_0x42109f[_0x1aec('0x7')],_0x42109f[_0x1aec('0x5')]));utils[_0x1aec('0x8')](_0x1aec('0x9'),_0x42109f);}exports[_0x1aec('0xa')]=function(_0x3812b7){try{utils[_0x1aec('0xb')](util[_0x1aec('0xc')](_0x1aec('0xd'),_0x3812b7[_0x1aec('0x7')]),_0x3812b7);utils[_0x1aec('0x3')](util[_0x1aec('0xc')](_0x1aec('0xe'),_0x3812b7[_0x1aec('0x7')],_0x3812b7[_0x1aec('0xf')],_0x3812b7['transferercalleridname'],_0x3812b7[_0x1aec('0x10')],_0x3812b7[_0x1aec('0x11')]));_0x3812b7[_0x1aec('0x5')]=_0x1aec('0x12');writeDB(_0x3812b7);}catch(_0x244729){utils[_0x1aec('0x13')](util[_0x1aec('0xc')]('[%s][transfers][blindtransfer]',_0x3812b7[_0x1aec('0x7')]),_0x244729);}};exports['attendedtransfer']=function(_0x34d80a){try{utils['debug'](util[_0x1aec('0xc')](_0x1aec('0x14'),_0x34d80a[_0x1aec('0x15')]),_0x34d80a);utils[_0x1aec('0x3')](util['format'](_0x1aec('0x16'),_0x34d80a[_0x1aec('0x15')],_0x34d80a[_0x1aec('0x17')],_0x34d80a['origtransferercalleridname'],_0x34d80a[_0x1aec('0x18')],_0x34d80a['transfertargetcalleridname']));_0x34d80a=_['assign'](_0x34d80a,{'transfererchannel':_0x34d80a[_0x1aec('0x19')],'transferercalleridnum':_0x34d80a[_0x1aec('0x17')],'transferercalleridname':_0x34d80a[_0x1aec('0x1a')],'transfererconnectedlinenum':_0x34d80a[_0x1aec('0x1b')],'transfererconnectedlinename':_0x34d80a[_0x1aec('0x1c')],'transfereraccountcode':_0x34d80a['origtransfereraccountcode'],'transferercontext':_0x34d80a[_0x1aec('0x1d')],'transfererexten':_0x34d80a[_0x1aec('0x1e')],'transfererlinkedid':_0x34d80a[_0x1aec('0x1f')],'context':_0x34d80a[_0x1aec('0x20')],'extension':_0x34d80a[_0x1aec('0x21')],'type':'attended'});if(_[_0x1aec('0x22')](_0x34d80a[_0x1aec('0x23')])){_0x34d80a=_[_0x1aec('0x24')](_0x34d80a,{'transfereechannel':_0x34d80a[_0x1aec('0x25')],'transfereecalleridnum':_0x34d80a[_0x1aec('0x18')],'transfereecalleridname':_0x34d80a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x34d80a[_0x1aec('0x26')],'transfereeconnectedlinename':_0x34d80a[_0x1aec('0x27')],'transfereeaccountcode':_0x34d80a[_0x1aec('0x28')],'transfereecontext':_0x34d80a[_0x1aec('0x29')],'transfereeexten':_0x34d80a[_0x1aec('0x2a')],'transfereelinkedid':_0x34d80a[_0x1aec('0x2b')]});}writeDB(_0x34d80a);}catch(_0x5b20e1){utils[_0x1aec('0x13')](util['format'](_0x1aec('0x14'),_0x34d80a[_0x1aec('0x15')]),_0x5b20e1);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 05735f1..0dc8154 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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x1e9761,_0x5be100){var _0x419f3e=function(_0x480e16){while(--_0x480e16){_0x1e9761['push'](_0x1e9761['shift']());}};_0x419f3e(++_0x5be100);}(_0x7a54,0x106));var _0x47a5=function(_0x39cc51,_0x4d99f6){_0x39cc51=_0x39cc51-0x0;var _0x2b2c26=_0x7a54[_0x39cc51];return _0x2b2c26;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x13009f,_0xaeb37f){var _0x1117bf=function(_0x486ece){while(--_0x486ece){_0x13009f['push'](_0x13009f['shift']());}};_0x1117bf(++_0xaeb37f);}(_0x7a54,0x106));var _0x47a5=function(_0x7f0426,_0x4cba1c){_0x7f0426=_0x7f0426-0x0;var _0x34b333=_0x7a54[_0x7f0426];return _0x34b333;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file